@visactor/vrender-components 1.0.25-alpha.1 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/axis/constant.d.ts +0 -1
- package/cjs/axis/constant.js +4 -5
- package/cjs/axis/constant.js.map +1 -1
- package/cjs/axis/line.d.ts +2 -7
- package/cjs/axis/line.js +2 -71
- package/cjs/axis/line.js.map +1 -1
- package/cjs/axis/type.d.ts +0 -12
- package/cjs/axis/type.js.map +1 -1
- package/cjs/crosshair/rect.js +1 -2
- package/cjs/data-zoom/type.js +2 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/label/base.js +9 -2
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/type.d.ts +2 -0
- package/cjs/label/type.js.map +1 -1
- package/dist/index.es.js +18 -132
- package/es/axis/constant.d.ts +0 -1
- package/es/axis/constant.js +4 -5
- package/es/axis/constant.js.map +1 -1
- package/es/axis/line.d.ts +2 -7
- package/es/axis/line.js +1 -72
- package/es/axis/line.js.map +1 -1
- package/es/axis/type.d.ts +0 -12
- package/es/axis/type.js.map +1 -1
- package/es/crosshair/rect.js +1 -2
- package/es/data-zoom/type.js +2 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/label/base.js +10 -3
- package/es/label/base.js.map +1 -1
- package/es/label/type.d.ts +2 -0
- package/es/label/type.js.map +1 -1
- package/package.json +6 -6
package/es/label/type.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/label/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n EasingType,\n IGraphic,\n IGroupGraphicAttribute,\n ITextGraphicAttribute,\n IRichTextGraphicAttribute,\n IText,\n TextAlignType,\n TextBaselineType,\n ILineGraphicAttribute,\n IRichTextCharacter,\n IRichText,\n ILine,\n ICustomPath2D,\n IArc,\n IGroup\n} from '@visactor/vrender-core';\nimport type { BoundsAnchorType, IPointLike, InsideBoundsAnchorType } from '@visactor/vutils';\n\nexport type LabelItemStateStyle<T> = {\n hover?: T;\n hover_reverse?: T;\n selected?: T;\n selected_reverse?: T;\n [key: string]: T;\n};\n\nexport type LabelItem = {\n // 用于动画\n id?: string;\n // 原始数据\n data?: any;\n [key: string]: any;\n // 文本类型:text, rich, html (区分于图元类型)\n textType?: string;\n /**\n * 文本内容,如果需要进行换行,则使用数组形式,如 ['abc', '123']\n * 支持富文本内容, 如textConfig, html\n */\n text?: string | string[] | number | number[] | IRichTextCharacter[];\n /**\n * 兼容ITextGraphicAttribute与IRichTextGraphicAttribute的textAlign属性\n */\n textAlign?: 'left' | 'right' | 'center' | 'start' | 'end';\n textBaseline?: 'top' | 'middle' | 'bottom' | 'alphabetic';\n} & (\n | Omit<Partial<ITextGraphicAttribute>, 'textAlign' | 'textBaseline'>\n | Omit<Partial<IRichTextGraphicAttribute>, 'textAlign' | 'textBaseline'>\n);\n\nexport interface BaseLabelAttrs extends IGroupGraphicAttribute {\n type: string;\n /**\n * 图元 group 名称\n */\n baseMarkGroupName: string;\n /**\n * @hack not recommend to use\n * @returns\n */\n getBaseMarks?: () => IGraphic[];\n /**\n * 是否开启选中交互\n * @default false\n */\n select?: boolean;\n /**\n * 是否开启 hover 交互\n * @default false\n */\n hover?: boolean;\n /**\n * 标签数据\n */\n data: LabelItem[];\n\n /** 文本样式,优先级低于 data */\n textStyle?: Partial<ITextGraphicAttribute>;\n\n /** 文本交互样式 */\n state?: LabelItemStateStyle<ITextGraphicAttribute>;\n\n /** 连接线样式 */\n line?: ILabelLineSpec;\n\n /** 连线的交互样式 */\n labelLineState?: LabelItemStateStyle<ILineGraphicAttribute>;\n\n syncState?: boolean;\n\n /** 标签默认位置 */\n position?: Functional<string>;\n\n /** 偏移量 */\n offset?: number;\n\n /** 是否开启防重叠\n * @default true\n */\n overlap?: OverlapAttrs | boolean;\n\n /** 智能反色 */\n smartInvert?: SmartInvertAttrs | boolean;\n\n /** 动画配置 */\n animation?: ILabelAnimation | boolean;\n /**\n * 新增标签动画\n */\n animationEnter?: ILabelUpdateAnimation | boolean;\n /**\n * 标签更新动画\n */\n animationUpdate?: ILabelUpdateAnimation | ILabelUpdateChannelAnimation[] | boolean;\n /**\n * 标签被删除的动画配置\n */\n animationExit?: ILabelExitAnimation | boolean;\n\n /**\n * 数据过滤自定义函数,可以用于 排序 or 删减\n */\n dataFilter?: (data: LabelItem[]) => LabelItem[];\n\n /** 自定义布局函数\n * @description 当配置了 customLayoutFunc 后,默认布局逻辑将不再生效。(position/offset不生效)\n */\n customLayoutFunc?: (\n item: LabelItem[],\n labels: (IText | IRichText)[],\n getRelatedGraphic: (data: LabelItem) => IGraphic,\n getRelatedPoint: ((data: LabelItem) => IPointLike) | null | undefined,\n labelComponent: IGroup\n ) => (IText | IRichText)[];\n\n /** 自定义标签躲避函数\n * @description 当配置了 customOverlapFunc 后,会根据 position 和 offset 进行初始布局。配置的防重叠逻辑(overlap)不生效。\n */\n customOverlapFunc?: (\n label: (IText | IRichText)[],\n getRelatedGraphic: (data: LabelItem) => IGraphic,\n getRelatedPoint: ((data: LabelItem) => IPointLike) | null | undefined,\n labelComponent: IGroup\n ) => (IText | IRichText)[];\n /**\n * 防重叠计算完成后的回调函数\n * @since 1.19.16\n */\n onAfterOverlapping?: (\n labels: (IText | IRichText)[],\n getRelatedGraphic: (data: LabelItem) => IGraphic,\n getRelatedPoint: ((data: LabelItem) => IPointLike) | null | undefined,\n labelComponent: IGroup\n ) => void;\n /**\n * 关闭交互效果\n * @default false\n */\n disableTriggerEvent?: boolean;\n /** 唯一标志符 */\n id?: string;\n}\n\nexport interface OverlapAttrs {\n /**\n * 防重叠的区域大小\n */\n size?: {\n /**\n * 防重叠区域的宽度\n */\n width: number;\n /**\n * 防重叠区域的高度\n */\n height: number;\n };\n\n /**\n * 发生重叠后,是否隐藏标签\n * @default true\n */\n hideOnHit?: boolean;\n\n /**\n * 是否约束标签在指定 size 的范围内。开启后若标签被区域裁剪,会向内收缩。\n * @default true\n */\n clampForce?: boolean;\n\n /**\n * 标签是否超出区域裁剪\n * @default false\n */\n hideOnOverflow?: boolean;\n\n /**\n * 是否躲避基础图元\n * @default false\n */\n avoidBaseMark?: boolean;\n\n /**\n * 躲避指定图元\n * @default []\n */\n avoidMarks?: string[] | IGraphic[];\n\n /**\n * 发生重叠后的躲避策略\n * @since 0.20.10 支持全局 Y 方向偏移策略 'shiftY'。当标签发生重叠时,会保相对位置并在 Y 方向上散开。由于 'shiftY' 是全局布局策略,不与其他策略同时生效。\n */\n strategy?: Strategy[] | ShiftYStrategy;\n\n /**\n * 文字在防重叠计算中预留的边距。\n * @default 0\n */\n overlapPadding?: number;\n\n /**\n * 防重叠的顺序权重\n * @since 0.20.10\n * @param labelItem\n * @returns number 数值越大,权重越高。权重越高的标签越优先被布局。\n */\n priority?: (labelItem: LabelItem) => number;\n}\n\nexport interface SmartInvertAttrs {\n /**\n * 对比度度量\n * 'WCAG' | 'lightness'\n * 默认使用'WCAG'\n */\n mode?: string;\n /**\n * 文本类型\n * 包含普通文本和大文本,对应不同的对比度标准,label默认为普通文本\n * 'normalText' | 'largeText'\n * @default 'normalText'\n */\n textType?: string;\n /**\n * 自定义对比度阈值\n */\n contrastRatiosThreshold?: number;\n /**\n * 自定义备选label颜色\n */\n alternativeColors?: string | string[];\n /**\n * fillStrategy四种策略:\n * - base(baseMark色),\n * - invertBase(执行智能反色),\n * - similarBase(智能反色的补色),\n * - null(不执行智能反色,保持fill设置的颜色)\n * @default 'invertBase'\n */\n fillStrategy?: 'base' | 'invertBase' | 'similarBase' | 'null';\n /**\n * strokeStrategy的四种策略:\n * - base(baseMark色),\n * - invertBase(执行智能反色),\n * - similarBase(智能反色的补色),\n * - null(不执行智能反色,保持stroke设置的颜色)\n * @default 'base'\n */\n strokeStrategy?: 'base' | 'invertBase' | 'similarBase' | 'null';\n /**\n * 前景色与亮色具有对比度时,similarSeries使用该色\n * @default '#ffffff'\n */\n brightColor?: string;\n /**\n * 前景色与暗色具有对比度时,similarSeries使用该色\n * @default '#000000'\n */\n darkColor?: string;\n /**\n * label超出mark范围,也以mark作为背景色进行反色\n */\n outsideEnable?: boolean;\n /**\n * 当标签和mark相交,但是没有完全在mark内部的时候,支持三种处理方式:\n *\n * * none:不做任何处理\n * * stroked:标签存在描边的时候,根据描边进行处理\n * * inside: 和标签完全在mark内部一样处理\n */\n interactInvertType?: 'none' | 'stroked' | 'inside';\n}\n\nexport type ShiftYStrategy = {\n /**\n * 将防重叠策略设置为 'shiftY'\n */\n type: 'shiftY';\n /**\n * 布局迭代次数\n * @default 10\n */\n iteration?: number;\n /**\n * 布局容差\n * @default 0.1\n */\n maxError?: number;\n /**\n * 散开后的间距\n * @default 1\n */\n padding?: number;\n};\n\nexport type PositionStrategy = {\n /**\n * 将防重叠的策略设置为'position',即可选位置策略。\n * 若默认位置没有足够的空间放置标签,则考虑 position 内的备选位置。\n */\n type: 'position';\n /**\n * 所有的备选位置\n */\n position?: Functional<LabelPosition[]>;\n /**\n * 当 position 内的备选位置依然无法放下标签时,标签是否放回原位。\n * 默认为 true,若为 false,则标签会被放在 position 数组的最后一个位置。\n * @since 0.20.18\n * @default true\n */\n restorePosition?: boolean;\n};\n\nexport type BoundStrategy = {\n /**\n * 将防重叠策略设置为'bound',当标签配置在图形内部时使用。\n * 当图形大小不足以放下标签,则考虑 position 内的备选位置。\n */\n type: 'bound';\n /**\n * 所有的备选位置\n */\n position?: Functional<LabelPosition[]>;\n /**\n * 当 position 内的备选位置依然无法放下标签时,标签是否放回原位。\n * 默认为 true,若为 false,则标签会被放在 position 数组的最后一个位置。\n * @since 0.20.18\n * @default true\n */\n restorePosition?: boolean;\n};\n\nexport type MoveYStrategy = {\n /**\n * 将防重叠策略设置为'moveY'\n * 若默认位置没有足够的空间放置标签,则根据 offset 在Y方向上寻找位置。\n */\n type: 'moveY';\n /**\n * Y方向上的尝试的位置偏移量\n */\n offset: Functional<number[]>;\n};\n\nexport type MoveXStrategy = {\n /**\n * 将防重叠策略设置为'moveX'\n * 若默认位置没有足够的空间放置标签,则根据 offset 在X方向上寻找位置。\n */\n type: 'moveX';\n /**\n * X方向上的尝试的位置偏移量\n */\n offset: Functional<number[]>;\n};\n\nexport type Strategy = PositionStrategy | BoundStrategy | MoveYStrategy | MoveXStrategy;\n\nexport type LabelPosition = SymbolLabelAttrs['position'] | RectLabelAttrs['position'];\n\nexport interface SymbolLabelAttrs extends BaseLabelAttrs {\n type: 'symbol';\n\n /**\n * 标签位置\n * @default 'top'\n */\n position?: Functional<BoundsAnchorType>;\n}\n\nexport interface RectLabelAttrs extends BaseLabelAttrs {\n type: 'rect';\n /**\n * 标签位置\n * @default 'top'\n */\n position?: Functional<InsideBoundsAnchorType | BoundsAnchorType>;\n}\n\nexport interface LineLabelAttrs extends BaseLabelAttrs {\n type: 'line';\n /**\n * 标签位置\n * @default 'end'\n */\n position?: Functional<'start' | 'end'>;\n}\n\nexport interface AreaLabelAttrs extends BaseLabelAttrs {\n type: 'area';\n /**\n * 标签位置\n * @default 'end'\n */\n position?: Functional<'start' | 'end'>;\n}\n\nexport interface LineDataLabelAttrs extends BaseLabelAttrs {\n type: 'line-data';\n\n /**\n * 标签位置\n * @default 'top'\n * @since 0.21.1 支持 'inside-middle' 在面积图元中显示在中间位置\n */\n position?: Functional<BoundsAnchorType | 'inside-middle'>;\n}\n\nexport interface PolygonLabelAttrs extends BaseLabelAttrs {\n type: 'polygon';\n /**\n * 标签位置\n * @default 'center'\n */\n position?: Functional<'center'>;\n}\n\nexport interface ArcLabelAttrs extends BaseLabelAttrs {\n type: 'arc';\n\n /**\n * 图元 group 名称\n */\n baseMarkGroupName: string;\n\n /**\n * 标签位置\n * @default 'outside'\n * @since 0.20.1 support 'inside-center'\n */\n position?: 'inside' | 'outside' | 'inside-inner' | 'inside-outer' | 'inside-center';\n\n // 画布宽度\n width?: number;\n // 画布高度\n height?: number;\n\n /**\n * 是否允许标签重叠\n * @default false\n */\n coverEnable?: boolean;\n /**\n * 是否允许标签旋转\n * @default true\n */\n rotate?: boolean;\n\n /**\n * 文字与引导线间隔宽度\n * @default 5\n */\n spaceWidth?: number;\n /**\n * 标签旋转角度\n */\n angle?: number;\n /**\n * 标签旋转角度的偏移角度\n */\n offsetAngle?: number;\n /**\n * 标签相对于 `outerRadius` 的径向偏移,目前仅作用于 inside 标签\n */\n offsetRadius?: number;\n /**\n * 标签横向点对齐\n */\n textAlign?: TextAlignType;\n /**\n * 标签纵向点对齐\n */\n textBaseline?: TextBaselineType;\n /**\n * 扇区间标签的间隔\n * @default 6\n */\n layoutArcGap?: number;\n /** 标签引导线样式 */\n line?: IArcLabelLineSpec;\n /** 标签布局配置 */\n layout?: IArcLabelLayoutSpec;\n /** 标签引导线点集 */\n points?: IPoint[];\n /** 饼图扇区中心偏移 */\n centerOffset?: number;\n}\n\nexport interface ILabelLineSpec {\n /**\n * 是否显示引导线\n * @default true\n */\n visible?: boolean;\n /**\n * 自定义路径\n * @since 0.19.21\n */\n customShape?: (container: IGroup, attrs: Partial<ILineGraphicAttribute>, path: ICustomPath2D) => ICustomPath2D;\n /**\n * 引导线样式\n */\n style?: Partial<ILineGraphicAttribute>;\n}\n\nexport interface IArcLabelLineSpec extends ILabelLineSpec {\n /**\n * 引导线 line1 部分最小长度\n * @default 20\n */\n line1MinLength?: number;\n /**\n * 引导线 line2 部分最小长度\n * @default 10\n * @since 0.20.3 支持函数回调\n */\n line2MinLength?: number | ((texts: IGraphic[], arcs: IArc[], attrs: Partial<ArcLabelAttrs>) => number);\n /**\n * 引导线是否光滑\n * @default false\n */\n smooth?: boolean;\n}\n\nexport type ArcLabelAlignType = 'arc' | 'labelLine' | 'edge';\n\nexport type ArcLabelStrategyType = 'priority' | 'vertical' | 'none';\n\nexport interface IArcLabelLayoutSpec {\n /**\n * 标签对齐方式\n * @default 'arc'\n */\n textAlign?: ArcLabelAlignType;\n /** @deprecate 建议统一使用textAlign,后续将废除 */\n align?: ArcLabelAlignType;\n /**\n * 标签对齐的偏移量\n * @since 0.20.3\n */\n alignOffset?: number | ((texts: IGraphic[], arcs: IArc[], attrs: Partial<ArcLabelAttrs>) => number);\n /**\n * 标签布局策略\n * @default 'priority'\n */\n strategy?: ArcLabelStrategyType;\n /**\n * 是否启用切线约束\n * @default true\n */\n tangentConstraint?: boolean;\n}\n\nexport interface DataLabelAttrs extends IGroupGraphicAttribute {\n dataLabels: (RectLabelAttrs | SymbolLabelAttrs | ArcLabelAttrs | LineDataLabelAttrs)[];\n /**\n * 防重叠的区域大小\n */\n size: { width: number; height: number; padding?: { top?: number; left?: number; right?: number; bottom?: number } };\n}\n\nexport type Functional<T> = T | ((data: any) => T);\n\n/**\n * 标签的离场动画配置\n */\nexport interface ILabelExitAnimation {\n /**\n * 动画执行的时长\n */\n duration?: number;\n /**\n * 动画延迟的时长\n */\n delay?: number;\n /**\n * 动画的缓动函数\n */\n easing?: EasingType;\n}\n\n/**\n * 标签的入场动画配置\n */\nexport interface ILabelEnterAnimation extends ILabelExitAnimation {\n /**\n * 标签动画的模式,支持三种类型\n * - same-time:标签出现动画和关联图形的动画同时进行\n * - after:当关联动图的出场动画结束后,执行标签的出场动画\n * - after-all:当所有关联图元的出场动画结束后,执行标签的出场动画\n */\n mode?: 'same-time' | 'after' | 'after-all';\n}\n\n/**\n * 标签的更新动画配置\n */\nexport interface ILabelUpdateAnimation extends ILabelExitAnimation {\n /**\n * 是否开启 increaseCount 动画\n * @default true\n */\n increaseEffect?: boolean;\n}\n\n/**\n * 标签更新的时候,动画的通道配置\n */\nexport interface ILabelUpdateChannelAnimation extends ILabelUpdateAnimation {\n /**\n * 进行插值动画的视觉通道\n */\n channel?: string[];\n /**\n * 动画的配置\n */\n options?: {\n /**\n * 忽略的视觉通道\n */\n excludeChannels?: string[];\n };\n}\n\nexport interface ILabelAnimation extends ILabelEnterAnimation, ILabelExitAnimation, ILabelUpdateAnimation {}\n\nexport interface IPoint {\n x: number;\n y: number;\n}\n\nexport interface IPolarPoint {\n radius: number;\n angle: number;\n}\n\nexport type Quadrant = 1 | 2 | 3 | 4;\n\nexport type TextAlign = 'left' | 'right' | 'center';\n\nexport type LabelContent = {\n text: IText | IRichText;\n labelLine?: ILine;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/label/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n EasingType,\n IGraphic,\n IGroupGraphicAttribute,\n ITextGraphicAttribute,\n IRichTextGraphicAttribute,\n IText,\n TextAlignType,\n TextBaselineType,\n ILineGraphicAttribute,\n IRichTextCharacter,\n IRichText,\n ILine,\n ICustomPath2D,\n IArc,\n IGroup\n} from '@visactor/vrender-core';\nimport type { BoundsAnchorType, IPointLike, InsideBoundsAnchorType } from '@visactor/vutils';\n\nexport type LabelItemStateStyle<T> = {\n hover?: T;\n hover_reverse?: T;\n selected?: T;\n selected_reverse?: T;\n [key: string]: T;\n};\n\nexport type LabelItem = {\n // 用于动画\n id?: string;\n // 原始数据\n data?: any;\n [key: string]: any;\n // 文本类型:text, rich, html (区分于图元类型)\n textType?: string;\n /**\n * 文本内容,如果需要进行换行,则使用数组形式,如 ['abc', '123']\n * 支持富文本内容, 如textConfig, html\n */\n text?: string | string[] | number | number[] | IRichTextCharacter[];\n /**\n * 兼容ITextGraphicAttribute与IRichTextGraphicAttribute的textAlign属性\n */\n textAlign?: 'left' | 'right' | 'center' | 'start' | 'end';\n textBaseline?: 'top' | 'middle' | 'bottom' | 'alphabetic';\n} & (\n | Omit<Partial<ITextGraphicAttribute>, 'textAlign' | 'textBaseline'>\n | Omit<Partial<IRichTextGraphicAttribute>, 'textAlign' | 'textBaseline'>\n);\n\nexport interface BaseLabelAttrs extends IGroupGraphicAttribute {\n type: string;\n /**\n * 图元 group 名称\n */\n baseMarkGroupName: string;\n /**\n * @hack not recommend to use\n * @returns\n */\n getBaseMarks?: () => IGraphic[];\n /**\n * 是否开启选中交互\n * @default false\n */\n select?: boolean;\n /**\n * 是否开启 hover 交互\n * @default false\n */\n hover?: boolean;\n /**\n * 标签数据\n */\n data: LabelItem[];\n\n /** 文本样式,优先级低于 data */\n textStyle?: Partial<ITextGraphicAttribute>;\n\n /** 文本交互样式 */\n state?: LabelItemStateStyle<ITextGraphicAttribute>;\n\n /** 连接线样式 */\n line?: ILabelLineSpec;\n\n /** 连线的交互样式 */\n labelLineState?: LabelItemStateStyle<ILineGraphicAttribute>;\n\n syncState?: boolean;\n\n /** 标签默认位置 */\n position?: Functional<string>;\n\n /** 偏移量 */\n offset?: number;\n\n /** 是否开启防重叠\n * @default true\n */\n overlap?: OverlapAttrs | boolean;\n\n /** 智能反色 */\n smartInvert?: SmartInvertAttrs | boolean;\n\n /** 动画配置 */\n animation?: ILabelAnimation | boolean;\n /**\n * 新增标签动画\n */\n animationEnter?: ILabelUpdateAnimation | boolean;\n /**\n * 标签更新动画\n */\n animationUpdate?: ILabelUpdateAnimation | ILabelUpdateChannelAnimation[] | boolean;\n /**\n * 标签被删除的动画配置\n */\n animationExit?: ILabelExitAnimation | boolean;\n\n /**\n * 数据过滤自定义函数,可以用于 排序 or 删减\n */\n dataFilter?: (data: LabelItem[]) => LabelItem[];\n\n /** 自定义布局函数\n * @description 当配置了 customLayoutFunc 后,默认布局逻辑将不再生效。(position/offset不生效)\n */\n customLayoutFunc?: (\n item: LabelItem[],\n labels: (IText | IRichText)[],\n getRelatedGraphic: (data: LabelItem) => IGraphic,\n getRelatedPoint: ((data: LabelItem) => IPointLike) | null | undefined,\n labelComponent: IGroup\n ) => (IText | IRichText)[];\n\n /** 自定义标签躲避函数\n * @description 当配置了 customOverlapFunc 后,会根据 position 和 offset 进行初始布局。配置的防重叠逻辑(overlap)不生效。\n */\n customOverlapFunc?: (\n label: (IText | IRichText)[],\n getRelatedGraphic: (data: LabelItem) => IGraphic,\n getRelatedPoint: ((data: LabelItem) => IPointLike) | null | undefined,\n labelComponent: IGroup\n ) => (IText | IRichText)[];\n /**\n * 防重叠计算完成后的回调函数\n * @since 1.19.16\n */\n onAfterOverlapping?: (\n labels: (IText | IRichText)[],\n getRelatedGraphic: (data: LabelItem) => IGraphic,\n getRelatedPoint: ((data: LabelItem) => IPointLike) | null | undefined,\n labelComponent: IGroup\n ) => void;\n\n /**\n * 防重叠计算前的回调函数\n * 返回true的标签会被计算防重叠\n * 返回false的标签会被直接跳过防重叠计算\n * @since 1.19.16\n */\n filterBeforeOverlap?: (\n label: IText | IRichText,\n getRelatedGraphic: (data: LabelItem) => IGraphic,\n labelComponent: IGroup\n ) => boolean;\n\n /**\n * 关闭交互效果\n * @default false\n */\n disableTriggerEvent?: boolean;\n /** 唯一标志符 */\n id?: string;\n}\n\nexport interface OverlapAttrs {\n /**\n * 防重叠的区域大小\n */\n size?: {\n /**\n * 防重叠区域的宽度\n */\n width: number;\n /**\n * 防重叠区域的高度\n */\n height: number;\n };\n\n /**\n * 发生重叠后,是否隐藏标签\n * @default true\n */\n hideOnHit?: boolean;\n\n /**\n * 是否约束标签在指定 size 的范围内。开启后若标签被区域裁剪,会向内收缩。\n * @default true\n */\n clampForce?: boolean;\n\n /**\n * 标签是否超出区域裁剪\n * @default false\n */\n hideOnOverflow?: boolean;\n\n /**\n * 是否躲避基础图元\n * @default false\n */\n avoidBaseMark?: boolean;\n\n /**\n * 躲避指定图元\n * @default []\n */\n avoidMarks?: string[] | IGraphic[];\n\n /**\n * 发生重叠后的躲避策略\n * @since 0.20.10 支持全局 Y 方向偏移策略 'shiftY'。当标签发生重叠时,会保相对位置并在 Y 方向上散开。由于 'shiftY' 是全局布局策略,不与其他策略同时生效。\n */\n strategy?: Strategy[] | ShiftYStrategy;\n\n /**\n * 文字在防重叠计算中预留的边距。\n * @default 0\n */\n overlapPadding?: number;\n\n /**\n * 防重叠的顺序权重\n * @since 0.20.10\n * @param labelItem\n * @returns number 数值越大,权重越高。权重越高的标签越优先被布局。\n */\n priority?: (labelItem: LabelItem) => number;\n\n /**\n * 防重叠计算前的回调函数\n * 返回true的标签会被计算防重叠\n * 返回false的标签会被直接跳过防重叠计算\n * @since 1.0.24\n */\n filterBeforeOverlap?: (\n label: IText | IRichText,\n getRelatedGraphic: (data: LabelItem) => IGraphic,\n labelComponent: IGroup\n ) => boolean;\n}\n\nexport interface SmartInvertAttrs {\n /**\n * 对比度度量\n * 'WCAG' | 'lightness'\n * 默认使用'WCAG'\n */\n mode?: string;\n /**\n * 文本类型\n * 包含普通文本和大文本,对应不同的对比度标准,label默认为普通文本\n * 'normalText' | 'largeText'\n * @default 'normalText'\n */\n textType?: string;\n /**\n * 自定义对比度阈值\n */\n contrastRatiosThreshold?: number;\n /**\n * 自定义备选label颜色\n */\n alternativeColors?: string | string[];\n /**\n * fillStrategy四种策略:\n * - base(baseMark色),\n * - invertBase(执行智能反色),\n * - similarBase(智能反色的补色),\n * - null(不执行智能反色,保持fill设置的颜色)\n * @default 'invertBase'\n */\n fillStrategy?: 'base' | 'invertBase' | 'similarBase' | 'null';\n /**\n * strokeStrategy的四种策略:\n * - base(baseMark色),\n * - invertBase(执行智能反色),\n * - similarBase(智能反色的补色),\n * - null(不执行智能反色,保持stroke设置的颜色)\n * @default 'base'\n */\n strokeStrategy?: 'base' | 'invertBase' | 'similarBase' | 'null';\n /**\n * 前景色与亮色具有对比度时,similarSeries使用该色\n * @default '#ffffff'\n */\n brightColor?: string;\n /**\n * 前景色与暗色具有对比度时,similarSeries使用该色\n * @default '#000000'\n */\n darkColor?: string;\n /**\n * label超出mark范围,也以mark作为背景色进行反色\n */\n outsideEnable?: boolean;\n /**\n * 当标签和mark相交,但是没有完全在mark内部的时候,支持三种处理方式:\n *\n * * none:不做任何处理\n * * stroked:标签存在描边的时候,根据描边进行处理\n * * inside: 和标签完全在mark内部一样处理\n */\n interactInvertType?: 'none' | 'stroked' | 'inside';\n}\n\nexport type ShiftYStrategy = {\n /**\n * 将防重叠策略设置为 'shiftY'\n */\n type: 'shiftY';\n /**\n * 布局迭代次数\n * @default 10\n */\n iteration?: number;\n /**\n * 布局容差\n * @default 0.1\n */\n maxError?: number;\n /**\n * 散开后的间距\n * @default 1\n */\n padding?: number;\n};\n\nexport type PositionStrategy = {\n /**\n * 将防重叠的策略设置为'position',即可选位置策略。\n * 若默认位置没有足够的空间放置标签,则考虑 position 内的备选位置。\n */\n type: 'position';\n /**\n * 所有的备选位置\n */\n position?: Functional<LabelPosition[]>;\n /**\n * 当 position 内的备选位置依然无法放下标签时,标签是否放回原位。\n * 默认为 true,若为 false,则标签会被放在 position 数组的最后一个位置。\n * @since 0.20.18\n * @default true\n */\n restorePosition?: boolean;\n};\n\nexport type BoundStrategy = {\n /**\n * 将防重叠策略设置为'bound',当标签配置在图形内部时使用。\n * 当图形大小不足以放下标签,则考虑 position 内的备选位置。\n */\n type: 'bound';\n /**\n * 所有的备选位置\n */\n position?: Functional<LabelPosition[]>;\n /**\n * 当 position 内的备选位置依然无法放下标签时,标签是否放回原位。\n * 默认为 true,若为 false,则标签会被放在 position 数组的最后一个位置。\n * @since 0.20.18\n * @default true\n */\n restorePosition?: boolean;\n};\n\nexport type MoveYStrategy = {\n /**\n * 将防重叠策略设置为'moveY'\n * 若默认位置没有足够的空间放置标签,则根据 offset 在Y方向上寻找位置。\n */\n type: 'moveY';\n /**\n * Y方向上的尝试的位置偏移量\n */\n offset: Functional<number[]>;\n};\n\nexport type MoveXStrategy = {\n /**\n * 将防重叠策略设置为'moveX'\n * 若默认位置没有足够的空间放置标签,则根据 offset 在X方向上寻找位置。\n */\n type: 'moveX';\n /**\n * X方向上的尝试的位置偏移量\n */\n offset: Functional<number[]>;\n};\n\nexport type Strategy = PositionStrategy | BoundStrategy | MoveYStrategy | MoveXStrategy;\n\nexport type LabelPosition = SymbolLabelAttrs['position'] | RectLabelAttrs['position'];\n\nexport interface SymbolLabelAttrs extends BaseLabelAttrs {\n type: 'symbol';\n\n /**\n * 标签位置\n * @default 'top'\n */\n position?: Functional<BoundsAnchorType>;\n}\n\nexport interface RectLabelAttrs extends BaseLabelAttrs {\n type: 'rect';\n /**\n * 标签位置\n * @default 'top'\n */\n position?: Functional<InsideBoundsAnchorType | BoundsAnchorType>;\n}\n\nexport interface LineLabelAttrs extends BaseLabelAttrs {\n type: 'line';\n /**\n * 标签位置\n * @default 'end'\n */\n position?: Functional<'start' | 'end'>;\n}\n\nexport interface AreaLabelAttrs extends BaseLabelAttrs {\n type: 'area';\n /**\n * 标签位置\n * @default 'end'\n */\n position?: Functional<'start' | 'end'>;\n}\n\nexport interface LineDataLabelAttrs extends BaseLabelAttrs {\n type: 'line-data';\n\n /**\n * 标签位置\n * @default 'top'\n * @since 0.21.1 支持 'inside-middle' 在面积图元中显示在中间位置\n */\n position?: Functional<BoundsAnchorType | 'inside-middle'>;\n}\n\nexport interface PolygonLabelAttrs extends BaseLabelAttrs {\n type: 'polygon';\n /**\n * 标签位置\n * @default 'center'\n */\n position?: Functional<'center'>;\n}\n\nexport interface ArcLabelAttrs extends BaseLabelAttrs {\n type: 'arc';\n\n /**\n * 图元 group 名称\n */\n baseMarkGroupName: string;\n\n /**\n * 标签位置\n * @default 'outside'\n * @since 0.20.1 support 'inside-center'\n */\n position?: 'inside' | 'outside' | 'inside-inner' | 'inside-outer' | 'inside-center';\n\n // 画布宽度\n width?: number;\n // 画布高度\n height?: number;\n\n /**\n * 是否允许标签重叠\n * @default false\n */\n coverEnable?: boolean;\n /**\n * 是否允许标签旋转\n * @default true\n */\n rotate?: boolean;\n\n /**\n * 文字与引导线间隔宽度\n * @default 5\n */\n spaceWidth?: number;\n /**\n * 标签旋转角度\n */\n angle?: number;\n /**\n * 标签旋转角度的偏移角度\n */\n offsetAngle?: number;\n /**\n * 标签相对于 `outerRadius` 的径向偏移,目前仅作用于 inside 标签\n */\n offsetRadius?: number;\n /**\n * 标签横向点对齐\n */\n textAlign?: TextAlignType;\n /**\n * 标签纵向点对齐\n */\n textBaseline?: TextBaselineType;\n /**\n * 扇区间标签的间隔\n * @default 6\n */\n layoutArcGap?: number;\n /** 标签引导线样式 */\n line?: IArcLabelLineSpec;\n /** 标签布局配置 */\n layout?: IArcLabelLayoutSpec;\n /** 标签引导线点集 */\n points?: IPoint[];\n /** 饼图扇区中心偏移 */\n centerOffset?: number;\n}\n\nexport interface ILabelLineSpec {\n /**\n * 是否显示引导线\n * @default true\n */\n visible?: boolean;\n /**\n * 自定义路径\n * @since 0.19.21\n */\n customShape?: (container: IGroup, attrs: Partial<ILineGraphicAttribute>, path: ICustomPath2D) => ICustomPath2D;\n /**\n * 引导线样式\n */\n style?: Partial<ILineGraphicAttribute>;\n}\n\nexport interface IArcLabelLineSpec extends ILabelLineSpec {\n /**\n * 引导线 line1 部分最小长度\n * @default 20\n */\n line1MinLength?: number;\n /**\n * 引导线 line2 部分最小长度\n * @default 10\n * @since 0.20.3 支持函数回调\n */\n line2MinLength?: number | ((texts: IGraphic[], arcs: IArc[], attrs: Partial<ArcLabelAttrs>) => number);\n /**\n * 引导线是否光滑\n * @default false\n */\n smooth?: boolean;\n}\n\nexport type ArcLabelAlignType = 'arc' | 'labelLine' | 'edge';\n\nexport type ArcLabelStrategyType = 'priority' | 'vertical' | 'none';\n\nexport interface IArcLabelLayoutSpec {\n /**\n * 标签对齐方式\n * @default 'arc'\n */\n textAlign?: ArcLabelAlignType;\n /** @deprecate 建议统一使用textAlign,后续将废除 */\n align?: ArcLabelAlignType;\n /**\n * 标签对齐的偏移量\n * @since 0.20.3\n */\n alignOffset?: number | ((texts: IGraphic[], arcs: IArc[], attrs: Partial<ArcLabelAttrs>) => number);\n /**\n * 标签布局策略\n * @default 'priority'\n */\n strategy?: ArcLabelStrategyType;\n /**\n * 是否启用切线约束\n * @default true\n */\n tangentConstraint?: boolean;\n}\n\nexport interface DataLabelAttrs extends IGroupGraphicAttribute {\n dataLabels: (RectLabelAttrs | SymbolLabelAttrs | ArcLabelAttrs | LineDataLabelAttrs)[];\n /**\n * 防重叠的区域大小\n */\n size: { width: number; height: number; padding?: { top?: number; left?: number; right?: number; bottom?: number } };\n}\n\nexport type Functional<T> = T | ((data: any) => T);\n\n/**\n * 标签的离场动画配置\n */\nexport interface ILabelExitAnimation {\n /**\n * 动画执行的时长\n */\n duration?: number;\n /**\n * 动画延迟的时长\n */\n delay?: number;\n /**\n * 动画的缓动函数\n */\n easing?: EasingType;\n}\n\n/**\n * 标签的入场动画配置\n */\nexport interface ILabelEnterAnimation extends ILabelExitAnimation {\n /**\n * 标签动画的模式,支持三种类型\n * - same-time:标签出现动画和关联图形的动画同时进行\n * - after:当关联动图的出场动画结束后,执行标签的出场动画\n * - after-all:当所有关联图元的出场动画结束后,执行标签的出场动画\n */\n mode?: 'same-time' | 'after' | 'after-all';\n}\n\n/**\n * 标签的更新动画配置\n */\nexport interface ILabelUpdateAnimation extends ILabelExitAnimation {\n /**\n * 是否开启 increaseCount 动画\n * @default true\n */\n increaseEffect?: boolean;\n}\n\n/**\n * 标签更新的时候,动画的通道配置\n */\nexport interface ILabelUpdateChannelAnimation extends ILabelUpdateAnimation {\n /**\n * 进行插值动画的视觉通道\n */\n channel?: string[];\n /**\n * 动画的配置\n */\n options?: {\n /**\n * 忽略的视觉通道\n */\n excludeChannels?: string[];\n };\n}\n\nexport interface ILabelAnimation extends ILabelEnterAnimation, ILabelExitAnimation, ILabelUpdateAnimation {}\n\nexport interface IPoint {\n x: number;\n y: number;\n}\n\nexport interface IPolarPoint {\n radius: number;\n angle: number;\n}\n\nexport type Quadrant = 1 | 2 | 3 | 4;\n\nexport type TextAlign = 'left' | 'right' | 'center';\n\nexport type LabelContent = {\n text: IText | IRichText;\n labelLine?: ILine;\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/vrender-components",
|
|
3
|
-
"version": "1.0.25
|
|
3
|
+
"version": "1.0.25",
|
|
4
4
|
"description": "components library for dp visualization",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "cjs/index.js",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@visactor/vutils": "~1.0.12",
|
|
16
16
|
"@visactor/vscale": "~1.0.12",
|
|
17
|
-
"@visactor/vrender-core": "1.0.25
|
|
18
|
-
"@visactor/vrender-kits": "1.0.25
|
|
19
|
-
"@visactor/vrender-animate": "1.0.25
|
|
17
|
+
"@visactor/vrender-core": "1.0.25",
|
|
18
|
+
"@visactor/vrender-kits": "1.0.25",
|
|
19
|
+
"@visactor/vrender-animate": "1.0.25"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@rushstack/eslint-patch": "~1.1.4",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"vite": "3.2.6",
|
|
31
31
|
"typescript": "4.9.5",
|
|
32
32
|
"cross-env": "^7.0.3",
|
|
33
|
+
"@internal/bundler": "0.0.1",
|
|
33
34
|
"@internal/eslint-config": "0.0.1",
|
|
34
|
-
"@internal/ts-config": "0.0.1"
|
|
35
|
-
"@internal/bundler": "0.0.1"
|
|
35
|
+
"@internal/ts-config": "0.0.1"
|
|
36
36
|
},
|
|
37
37
|
"keywords": [
|
|
38
38
|
"VisActor",
|