* expression_reveal_image skeleton. * expression_functions added. * expression_renderers added. * Backup of daily work. * Fixed errors. * Added legacy support. Added button for legacy. * Added storybook. * Removed revealImage from canvas. * setState while rendering error fixed. * tsconfig.json added. * jest.config.js added. * Demo doc added. * Types fixed. * added limits. * Removed not used imports. * i18n namespaces fixed. * Fixed test suite error. * Some errors fixed. * Fixed eslint error. * Removed more unused translations. * Moved UI and elements, related to expressionRevealImage from canvas. * Fixed unused translations errors. * Moved type of element to types. * Fixed types and added service for representing elements, ui and supported renderers to canvas. * Added expression registration to canvas. * Fixed * Fixed mutiple call of the function. * Removed support of a legacy lib for revealImage chart. * Removed legacy presentation_utils plugin import. * Doc error fixed. * Removed useless translations and tried to fix error. * One more fix. * Small imports fix. * Fixed translations. * Made fixes based on nits. * Removed useless params. * fix. * Fixed errors, related to jest and __mocks__. * Removed useless type definition. * Replaced RendererHandlers with IInterpreterRendererHandlers. * fixed supported_shareable. * Moved elements back to canvas. * Moved views to canvas, removed expression service and imported renderer to canvas. * Fixed translations. * Types fix. * Moved libs to presentation utils. * Fixed one mistake. * removed dataurl lib. * Fixed jest files. * elasticLogo removed. * Removed elastic_outline. * removed httpurl. * Removed missing_asset. * removed url. * replaced mostly all tests. * Fixed types. * Fixed types and removed function_wrapper.ts * Fixed types of test helpers. * Changed limits of presentationUtil plugin. * Fixed imports. * One more fix. * Fixed huge size of bundle. * Reduced allow limit for presentationUtil * Updated limits for presentationUtil. * Fixed public API. * fixed type errors. * Moved css to component. * Fixed spaces at element. * Changed order of requiredPlugins. * Updated limits. * Removed unused plugin. * Added rule for allowing import from __stories__ directory. * removed useless comment. * Changed readme.md * Fixed docs error. * A possible of smoke test. * onResize changed to useResizeObserver. * Remove useless events and `useEffect` block. * Changed from passing handlers to separate functions. * `function` moved to `server`. * Fixed eslint error. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
57 lines
2.4 KiB
TypeScript
57 lines
2.4 KiB
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
* 2.0.
|
|
*/
|
|
|
|
import { ExpressionRenderDefinition, IInterpreterRenderHandlers } from 'src/plugins/expressions';
|
|
|
|
type GenericRendererCallback = (callback: () => void) => void;
|
|
|
|
export interface CanvasSpecificRendererHandlers {
|
|
/** Handler to invoke when an element should be destroyed. */
|
|
destroy: () => void;
|
|
/** Get the id of the element being rendered. Can be used as a unique ID in a render function */
|
|
getElementId: () => string;
|
|
/** Retrieves the value of the filter property on the element object persisted on the workpad */
|
|
getFilter: () => string;
|
|
/** Handler to invoke when a renderer is considered complete */
|
|
onComplete: (fn: () => void) => void;
|
|
/** Handler to invoke when a rendered embeddable is destroyed */
|
|
onEmbeddableDestroyed: () => void;
|
|
/** Handler to invoke when the input to a function has changed internally */
|
|
onEmbeddableInputChange: (expression: string) => void;
|
|
/** Handler to invoke when an element's dimensions have changed*/
|
|
onResize: GenericRendererCallback;
|
|
/** Handler to invoke when an element should be resized. */
|
|
resize: (size: { height: number; width: number }) => void;
|
|
/** Sets the value of the filter property on the element object persisted on the workpad */
|
|
setFilter: (filter: string) => void;
|
|
}
|
|
|
|
export type RendererHandlers = IInterpreterRenderHandlers & CanvasSpecificRendererHandlers;
|
|
export interface RendererSpec<RendererConfig = {}> {
|
|
/** The render type */
|
|
name: string;
|
|
/** The name to display */
|
|
displayName?: string;
|
|
/** A description of what is rendered */
|
|
help?: string;
|
|
/** Indicate whether the element should reuse the existing DOM element when re-rendering */
|
|
reuseDomNode: boolean;
|
|
/** The default width of the element in pixels */
|
|
width?: number;
|
|
/** The default height of the element in pixels */
|
|
height?: number;
|
|
/** A function that renders an element into the specified DOM element */
|
|
render: (domNode: HTMLElement, config: RendererConfig, handlers: RendererHandlers) => void;
|
|
}
|
|
|
|
export type RendererFactory<RendererConfig = {}> = () => RendererSpec<RendererConfig>;
|
|
|
|
export type AnyRendererFactory =
|
|
| RendererFactory<any>
|
|
| Array<() => ExpressionRenderDefinition<any>>;
|
|
export type AnyRendererSpec = RendererSpec<any>;
|