import * as zrUtil from 'zrender/lib/core/util.js'; import * as modelUtil from '../../util/model.js'; import { ComponentOption, BoxLayoutOptionMixin, Dictionary, ZRStyleProps, OptionId, CommonTooltipOption, AnimationOptionMixin, AnimationOption } from '../../util/types.js'; import ComponentModel from '../../model/Component.js'; import Element, { ElementTextConfig } from 'zrender/lib/Element.js'; import Displayable from 'zrender/lib/graphic/Displayable.js'; import { PathProps, PathStyleProps } from 'zrender/lib/graphic/Path.js'; import { ImageStyleProps, ImageProps } from 'zrender/lib/graphic/Image.js'; import { TextStyleProps, TextProps } from 'zrender/lib/graphic/Text.js'; import GlobalModel from '../../model/Global.js'; import { TransitionOptionMixin } from '../../animation/customGraphicTransition.js'; import { ElementKeyframeAnimationOption } from '../../animation/customGraphicKeyframeAnimation.js'; import { GroupProps } from 'zrender/lib/graphic/Group.js'; import { TransformProp } from 'zrender/lib/core/Transformable.js'; import { ElementEventNameWithOn } from 'zrender/lib/core/types.js'; interface GraphicComponentBaseElementOption extends Partial>, /** * left/right/top/bottom: (like 12, '22%', 'center', default undefined) * If left/rigth is set, shape.x/shape.cx/position will not be used. * If top/bottom is set, shape.y/shape.cy/position will not be used. * This mechanism is useful when you want to position a group/element * against the right side or the center of this container. */ Partial> { /** * element type, mandatory. * Only can be omit if call setOption not at the first time and perform merge. */ type?: string; id?: OptionId; name?: string; parentId?: OptionId; parentOption?: GraphicComponentElementOption; children?: GraphicComponentElementOption[]; hv?: [boolean, boolean]; /** * bounding: (enum: 'all' (default) | 'raw') * Specify how to calculate boundingRect when locating. * 'all': Get uioned and transformed boundingRect * from both itself and its descendants. * This mode simplies confining a group of elements in the bounding * of their ancester container (e.g., using 'right: 0'). * 'raw': Only use the boundingRect of itself and before transformed. * This mode is similar to css behavior, which is useful when you * want an element to be able to overflow its container. (Consider * a rotated circle needs to be located in a corner.) */ bounding?: 'raw' | 'all'; /** * info: custom info. enables user to mount some info on elements and use them * in event handlers. Update them only when user specified, otherwise, remain. */ info?: GraphicExtraElementInfo; clipPath?: Omit | false; textContent?: Omit; textConfig?: ElementTextConfig; $action?: 'merge' | 'replace' | 'remove'; tooltip?: CommonTooltipOption; enterAnimation?: AnimationOption; updateAnimation?: AnimationOption; leaveAnimation?: AnimationOption; } export interface GraphicComponentDisplayableOption extends GraphicComponentBaseElementOption, Partial> { style?: ZRStyleProps; z2?: number; } export interface GraphicComponentGroupOption extends GraphicComponentBaseElementOption, TransitionOptionMixin { type?: 'group'; /** * width/height: (can only be pixel value, default 0) * Only be used to specify contianer(group) size, if needed. And * can not be percentage value (like '33%'). See the reason in the * layout algorithm below. */ width?: number; height?: number; children: GraphicComponentElementOption[]; keyframeAnimation?: ElementKeyframeAnimationOption | ElementKeyframeAnimationOption[]; } export interface GraphicComponentZRPathOption extends GraphicComponentDisplayableOption, TransitionOptionMixin { shape?: PathProps['shape'] & TransitionOptionMixin; style?: PathStyleProps & TransitionOptionMixin; keyframeAnimation?: ElementKeyframeAnimationOption | ElementKeyframeAnimationOption[]; } export interface GraphicComponentImageOption extends GraphicComponentDisplayableOption, TransitionOptionMixin { type?: 'image'; style?: ImageStyleProps & TransitionOptionMixin; keyframeAnimation?: ElementKeyframeAnimationOption | ElementKeyframeAnimationOption[]; } interface GraphicComponentTextOption extends Omit, TransitionOptionMixin { type?: 'text'; style?: TextStyleProps & TransitionOptionMixin; keyframeAnimation?: ElementKeyframeAnimationOption | ElementKeyframeAnimationOption[]; } export declare type GraphicComponentElementOption = GraphicComponentGroupOption | GraphicComponentZRPathOption | GraphicComponentImageOption | GraphicComponentTextOption; declare type GraphicExtraElementInfo = Dictionary; export declare type ElementMap = zrUtil.HashMap; export declare type GraphicComponentLooseOption = (GraphicComponentOption | GraphicComponentElementOption) & { mainType?: 'graphic'; }; export interface GraphicComponentOption extends ComponentOption, AnimationOptionMixin { elements?: GraphicComponentElementOption[]; } export declare function setKeyInfoToNewElOption(resultItem: ReturnType[number], newElOption: GraphicComponentElementOption): void; export declare class GraphicComponentModel extends ComponentModel { static type: string; type: string; preventAutoZ: boolean; static defaultOption: GraphicComponentOption; /** * Save el options for the sake of the performance (only update modified graphics). * The order is the same as those in option. (ancesters -> descendants) */ private _elOptionsToUpdate; mergeOption(option: GraphicComponentOption, ecModel: GlobalModel): void; optionUpdated(newOption: GraphicComponentOption, isInit: boolean): void; /** * Convert * [{ * type: 'group', * id: 'xx', * children: [{type: 'circle'}, {type: 'polygon'}] * }] * to * [ * {type: 'group', id: 'xx'}, * {type: 'circle', parentId: 'xx'}, * {type: 'polygon', parentId: 'xx'} * ] */ private _flatten; useElOptionsToUpdate(): GraphicComponentElementOption[]; } export {};