@visactor/vrender-components 0.21.9-alpha.0 → 0.21.9
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/type.js.map +1 -1
- package/cjs/brush/brush.js +1 -2
- package/cjs/brush/type.js +2 -1
- package/cjs/core/type.js.map +1 -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 +4 -1
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/type.js.map +1 -1
- package/cjs/legend/discrete/type.js.map +1 -1
- package/cjs/marker/type.js.map +1 -1
- package/cjs/poptip/type.js.map +1 -1
- package/dist/index.es.js +44 -132
- package/es/axis/type.js.map +1 -1
- package/es/brush/brush.js +1 -2
- package/es/brush/type.js +2 -1
- package/es/core/type.js.map +1 -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 +4 -1
- package/es/label/base.js.map +1 -1
- package/es/label/type.js.map +1 -1
- package/es/legend/discrete/type.js.map +1 -1
- package/es/marker/type.js.map +1 -1
- package/es/poptip/type.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/legend/discrete/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n EasingType,\n IGroupGraphicAttribute,\n ILinearGradient,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { BaseGraphicAttributes, Padding } from '../../core/type';\nimport type { PagerAttributes } from '../../pager/type';\nimport type { LegendBaseAttributes } from '../type';\nimport type { ScrollBarAttributes } from '../../scrollbar/type';\nimport type { GraphicEventType } from '@visactor/vrender-core';\n\nexport interface LegendSwitchComponentAttributes {\n /**\n * 翻页组件同图例内容项之间的间距\n */\n space?: number;\n /**\n * the default page\n */\n defaultCurrent?: number;\n /**\n * 翻页是否开启动画\n */\n animation?: boolean;\n /**\n * 动画执行时间\n */\n animationDuration?: number;\n /**\n * 动画执行效果\n */\n animationEasing?: EasingType;\n}\n\nexport type LegendPagerAttributes = Omit<PagerAttributes, 'total'> &\n LegendSwitchComponentAttributes & {\n /**\n * 分页器的显示位置,默认 'middle'\n * @default 'middle'\n */\n position?: 'start' | 'middle' | 'end';\n };\n\nexport type LegendScrollbarAttributes = Omit<ScrollBarAttributes, 'range' | 'limitRange'> &\n LegendSwitchComponentAttributes & {\n type: 'scrollbar';\n /**\n * @deprecated since 0.20.13\n * 滚动条的位置是否支持展示在分页的中间。\n * 0.20.13 版本改造了滚动条逻辑后,此配置废弃。改造内容:\n * 由分页拟合的滚动调整为滚动窗口的逻辑,不再与分页绑定\n */\n scrollByPosition?: boolean;\n /**\n * 是否支持鼠标/触控板滚动\n * @default false\n */\n roamScroll?: boolean;\n /**\n * @since 0.20.13\n * 是否隐藏滚动条\n */\n visible?: boolean;\n /**\n * @since 0.20.13\n * 滚动时,图例区域未到尽头时的前后遮罩\n */\n scrollMask?: {\n /** 是否显示 @default false */\n visible?: boolean;\n /** 渐变区域长度 @default 16 */\n gradientLength?: number;\n /** 渐变配置 */\n gradientStops: ILinearGradient['stops'];\n };\n };\n\nexport type LegendItemDatum = {\n /**\n * 该条数据的唯一标识,可用于动画或者查找\n */\n id?: string;\n /** 显示文本 */\n label: string;\n /** 显示数据 */\n value?: string | number;\n /** 图例项前的 shape 形状定义 */\n shape: {\n symbolType?: string;\n fill?: string;\n stroke?: string;\n };\n [key: string]: any;\n};\n\nexport type StyleCallback<T> = (\n item: LegendItemDatum,\n isSelected: boolean,\n index: number,\n allItems: LegendItemDatum[]\n) => T;\n\nexport type formatterCallback = (text: string | number, item: LegendItemDatum, index: number) => any;\n\nexport type LegendItem = {\n /**\n * 是否展示图例项\n * @default true\n */\n visible?: boolean;\n /**\n * 图例项的列间距 水平间距\n */\n spaceCol?: number;\n /**\n * 图例项的行间距 垂直间距\n */\n spaceRow?: number;\n /**\n * 图例项的最大宽度,默认为 null,由上层传入\n */\n maxWidth?: number;\n /**\n * 图例项的宽度, 默认自动计算\n */\n width?: number;\n /**\n * 图例的高度,默认自动计算\n */\n height?: number;\n /**\n * 图例项自身的内边距\n */\n padding?: Padding;\n /**\n * 图例项背景配置\n */\n background?: {\n visible?: boolean;\n } & BaseGraphicAttributes<Partial<IGroupGraphicAttribute> | StyleCallback<Partial<IGroupGraphicAttribute>>>;\n /**\n * 图例项的 shape 图标的配置\n */\n shape?: {\n visible?: boolean;\n /** shape 同后面 label 的间距 */\n space?: number;\n } & BaseGraphicAttributes<Partial<ISymbolGraphicAttribute> | StyleCallback<Partial<ISymbolGraphicAttribute>>>;\n\n /**\n * 当label+ value同时存在的时候,自动省略的策略\n * 'labelFirst' - 尽量保证完整展示`label`\n * 'valueFirst' - 尽量保证完整展示`value`\n * 'none' - 按照`widthRatio`展示label 和 value\n */\n autoEllipsisStrategy?: 'labelFirst' | 'valueFirst' | 'none';\n\n /**\n * 图例项的 label 文本配置\n */\n label?: {\n /**\n * 当 label + value 同时展示,切超长的时候,label的宽度占比\n */\n widthRatio?: number;\n /**\n * 图例项 label 同后面 value 的间距\n */\n space?: number;\n /**\n * 格式化文本函数\n */\n formatMethod?: formatterCallback;\n } & BaseGraphicAttributes<Partial<ITextGraphicAttribute> | StyleCallback<Partial<ITextGraphicAttribute>>>;\n /**\n * 图例项 value 配置\n */\n value?: {\n /**\n * 当 label + value 同时展示,切超长的时候,label的宽度占比\n */\n widthRatio?: number;\n /** value 同后面元素的间距 */\n space?: number;\n /**\n * 是否右对齐显示,仅当设置图例项宽度 itemWidth 时生效\n * 默认为 false,\n */\n alignRight?: boolean;\n /**\n * 格式化文本函数\n */\n formatMethod?: formatterCallback;\n } & BaseGraphicAttributes<Partial<ITextGraphicAttribute> | StyleCallback<Partial<ITextGraphicAttribute>>>;\n /**\n * 是否开启聚焦功能,默认关闭\n */\n focus?: boolean;\n /**\n * 聚焦按钮配置\n */\n focusIconStyle?: Partial<ISymbolGraphicAttribute>;\n /**\n * 指定图例项中图标和文字的摆放位置,可选值为:\n * 'left' 图标在左侧\n * 'right' 图标在右侧\n */\n align?: 'left' | 'right';\n /**\n * @since 0.21.3\n
|
|
1
|
+
{"version":3,"sources":["../src/legend/discrete/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n EasingType,\n IGroupGraphicAttribute,\n ILinearGradient,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { BaseGraphicAttributes, Padding } from '../../core/type';\nimport type { PagerAttributes } from '../../pager/type';\nimport type { LegendBaseAttributes } from '../type';\nimport type { ScrollBarAttributes } from '../../scrollbar/type';\nimport type { GraphicEventType } from '@visactor/vrender-core';\n\nexport interface LegendSwitchComponentAttributes {\n /**\n * 翻页组件同图例内容项之间的间距\n */\n space?: number;\n /**\n * the default page\n */\n defaultCurrent?: number;\n /**\n * 翻页是否开启动画\n */\n animation?: boolean;\n /**\n * 动画执行时间\n */\n animationDuration?: number;\n /**\n * 动画执行效果\n */\n animationEasing?: EasingType;\n}\n\n/**\n * 离散类型的图例组件,当图例项较多的时候,默认使用分页器组件\n */\nexport type LegendPagerAttributes = Omit<PagerAttributes, 'total'> &\n LegendSwitchComponentAttributes & {\n /**\n * 分页器的显示位置,默认 'middle'\n * @default 'middle'\n */\n position?: 'start' | 'middle' | 'end';\n };\n\n/**\n * 离散类型的图例组件使用滚动条组件的时候对应的配置\n */\nexport type LegendScrollbarAttributes = Omit<ScrollBarAttributes, 'range' | 'limitRange'> &\n LegendSwitchComponentAttributes & {\n /**\n * 将翻页器的类型设置为 'scrollbar'\n * 申明图例组件使用滚动条进行翻页展示更多的图例项\n */\n type: 'scrollbar';\n /**\n * @deprecated since 0.20.13\n * 滚动条的位置是否支持展示在分页的中间。\n * 0.20.13 版本改造了滚动条逻辑后,此配置废弃。改造内容:\n * 由分页拟合的滚动调整为滚动窗口的逻辑,不再与分页绑定\n */\n scrollByPosition?: boolean;\n /**\n * 是否支持鼠标/触控板滚动\n * @default false\n */\n roamScroll?: boolean;\n /**\n * @since 0.20.13\n * 是否隐藏滚动条\n */\n visible?: boolean;\n /**\n * @since 0.20.13\n * 滚动时,图例区域未到尽头时的前后遮罩\n */\n scrollMask?: {\n /** 是否显示 @default false */\n visible?: boolean;\n /** 渐变区域长度 @default 16 */\n gradientLength?: number;\n /** 渐变配置 */\n gradientStops: ILinearGradient['stops'];\n };\n };\n\nexport type LegendItemDatum = {\n /**\n * 该条数据的唯一标识,可用于动画或者查找\n */\n id?: string;\n /** 显示文本 */\n label: string;\n /** 显示数据 */\n value?: string | number;\n /** 图例项前的 shape 形状定义 */\n shape: {\n symbolType?: string;\n fill?: string;\n stroke?: string;\n };\n [key: string]: any;\n};\n\nexport type StyleCallback<T> = (\n item: LegendItemDatum,\n isSelected: boolean,\n index: number,\n allItems: LegendItemDatum[]\n) => T;\n\nexport type formatterCallback = (text: string | number, item: LegendItemDatum, index: number) => any;\n\nexport type LegendItem = {\n /**\n * 是否展示图例项\n * @default true\n */\n visible?: boolean;\n /**\n * 图例项的列间距 水平间距\n */\n spaceCol?: number;\n /**\n * 图例项的行间距 垂直间距\n */\n spaceRow?: number;\n /**\n * 图例项的最大宽度,默认为 null,由上层传入\n */\n maxWidth?: number;\n /**\n * 图例项的宽度, 默认自动计算\n */\n width?: number;\n /**\n * 图例的高度,默认自动计算\n */\n height?: number;\n /**\n * 图例项自身的内边距\n */\n padding?: Padding;\n /**\n * 图例项背景配置\n */\n background?: {\n visible?: boolean;\n } & BaseGraphicAttributes<Partial<IGroupGraphicAttribute> | StyleCallback<Partial<IGroupGraphicAttribute>>>;\n /**\n * 图例项的 shape 图标的配置\n */\n shape?: {\n visible?: boolean;\n /** shape 同后面 label 的间距 */\n space?: number;\n } & BaseGraphicAttributes<Partial<ISymbolGraphicAttribute> | StyleCallback<Partial<ISymbolGraphicAttribute>>>;\n\n /**\n * 当label+ value同时存在的时候,自动省略的策略\n * 'labelFirst' - 尽量保证完整展示`label`\n * 'valueFirst' - 尽量保证完整展示`value`\n * 'none' - 按照`widthRatio`展示label 和 value\n */\n autoEllipsisStrategy?: 'labelFirst' | 'valueFirst' | 'none';\n\n /**\n * 图例项的 label 文本配置\n */\n label?: {\n /**\n * 当 label + value 同时展示,切超长的时候,label的宽度占比\n */\n widthRatio?: number;\n /**\n * 图例项 label 同后面 value 的间距\n */\n space?: number;\n /**\n * 格式化文本函数\n */\n formatMethod?: formatterCallback;\n } & BaseGraphicAttributes<Partial<ITextGraphicAttribute> | StyleCallback<Partial<ITextGraphicAttribute>>>;\n /**\n * 图例项 value 配置\n */\n value?: {\n /**\n * 当 label + value 同时展示,切超长的时候,label的宽度占比\n */\n widthRatio?: number;\n /** value 同后面元素的间距 */\n space?: number;\n /**\n * 是否右对齐显示,仅当设置图例项宽度 itemWidth 时生效\n * 默认为 false,\n */\n alignRight?: boolean;\n /**\n * 格式化文本函数\n */\n formatMethod?: formatterCallback;\n } & BaseGraphicAttributes<Partial<ITextGraphicAttribute> | StyleCallback<Partial<ITextGraphicAttribute>>>;\n /**\n * 是否开启聚焦功能,默认关闭\n */\n focus?: boolean;\n /**\n * 聚焦按钮配置\n */\n focusIconStyle?: Partial<ISymbolGraphicAttribute>;\n /**\n * 指定图例项中图标和文字的摆放位置,可选值为:\n * 'left' 图标在左侧\n * 'right' 图标在右侧\n */\n align?: 'left' | 'right';\n /**\n * 水平方向时,一行中多个图例的垂直对齐方式\n * @since 0.21.3\n */\n verticalAlign?: 'top' | 'middle' | 'bottom';\n};\n\nexport type DiscreteLegendAttrs = {\n /**\n * 是否开启选中交互\n */\n select?:\n | boolean\n | {\n /**\n * 触发选中交互的事件类型\n * @since 0.20.13\n **/\n trigger?: GraphicEventType;\n };\n\n /**\n * 是否开启 hover 交互\n */\n hover?:\n | boolean\n | {\n /**\n * 触发hover交互的事件类型\n * @since 0.20.13\n **/\n trigger?: GraphicEventType;\n /**\n * 触发取消hover交互的事件类型\n * @since 0.20.13\n **/\n triggerOff?: GraphicEventType;\n };\n /**\n * 图例数据\n */\n items: LegendItemDatum[];\n /**\n * 默认选中的图例项\n */\n defaultSelected?: (string | number)[];\n /**\n * 单选/多选模式配置,默认 'multiple'。\n * - `single` 表示单选\n * - `multiple` 表示多选\n * - `focus` 表示聚焦模式 (自 0.19.2版本开始支持)\n */\n selectMode?: 'single' | 'multiple' | 'focus';\n /**\n * 是否允许图例全部取消,多选模式下生效\n */\n allowAllCanceled?: boolean;\n /**\n * 图例项的顺序是否要逆序,默认为 false\n */\n reversed?: boolean;\n /**\n * 图例项相关的配置\n */\n item?: LegendItem;\n /**\n * 最大宽度,决定 layout : 'horizontal' 是否自动换行\n */\n maxWidth?: number;\n /**\n * 最大高度,决定是否分页\n */\n maxHeight?: number;\n /**\n * 最大行数,当且仅当 layout 为 'horizontal' 时生效\n */\n maxRow?: number;\n /**\n * 最大列数,当且仅当 layout 为 'vertical' 时生效\n */\n maxCol?: number;\n /**\n * 延迟渲染,按需渲染图例项目\n */\n lazyload?: boolean;\n /**\n * 是否进行自动分页,默认为 true\n */\n autoPage?: boolean;\n /**\n * 翻页器配置\n */\n pager?: LegendPagerAttributes | LegendScrollbarAttributes;\n} & LegendBaseAttributes;\n"]}
|
package/cjs/marker/type.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/type.ts"],"names":[],"mappings":";;;AAmBA,IAAY,sBAkBX;AAlBD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,+CAAqB,CAAA;IACrB,qDAA2B,CAAA;IAC3B,qDAA2B,CAAA;IAC3B,2DAAiC,CAAA;IACjC,iEAAuC,CAAA;IAEvC,2CAAiB,CAAA;IACjB,6DAAmC,CAAA;IACnC,mEAAyC,CAAA;IAEzC,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;IACvB,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,6DAAmC,CAAA;AACrC,CAAC,EAlBW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAkBjC;AAED,IAAY,sBAoBX;AApBD,WAAY,sBAAsB;IAChC,uCAAa,CAAA;IACb,yCAAe,CAAA;IACf,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,6CAAmB,CAAA;IACnB,+CAAqB,CAAA;IACrB,mDAAyB,CAAA;IACzB,qDAA2B,CAAA;IAE3B,2CAAiB,CAAA;IAEjB,mDAAyB,CAAA;IACzB,qDAA2B,CAAA;IAC3B,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,yDAA+B,CAAA;IAC/B,2DAAiC,CAAA;IACjC,+DAAqC,CAAA;IACrC,iEAAuC,CAAA;AACzC,CAAC,EApBW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAoBjC;AAED,IAAY,2BAQX;AARD,WAAY,2BAA2B;IACrC,8DAA+B,CAAA;IAC/B,0DAA2B,CAAA;IAC3B,gEAAiC,CAAA;IACjC,8DAA+B,CAAA;IAC/B,0DAA2B,CAAA;IAC3B,gEAAiC,CAAA;IACjC,gDAAiB,CAAA;AACnB,CAAC,EARW,2BAA2B,GAA3B,mCAA2B,KAA3B,mCAA2B,QAQtC;AAED,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,uDAA6B,CAAA;AAC/B,CAAC,EAPW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAOjC","file":"type.js","sourcesContent":["import type {\n EasingType,\n IArcGraphicAttribute,\n IGroup,\n IGroupGraphicAttribute,\n IImageGraphicAttribute,\n ILineGraphicAttribute,\n IPolygonAttribute,\n IPolygonGraphicAttribute,\n IRectGraphicAttribute,\n IRichTextGraphicAttribute,\n ISymbol,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { CommonSegmentAttributes, ILineGraphicWithCornerRadius, SegmentAttributes } from '../segment/type';\nimport type { TagAttributes } from '../tag/type';\nimport type { Point, State } from '../core/type';\n\nexport enum IMarkLineLabelPosition {\n start = 'start',\n startTop = 'startTop',\n startBottom = 'startBottom',\n insideStart = 'insideStart',\n insideStartTop = 'insideStartTop',\n insideStartBottom = 'insideStartBottom',\n\n middle = 'middle',\n insideMiddleTop = 'insideMiddleTop',\n insideMiddleBottom = 'insideMiddleBottom',\n\n end = 'end',\n endTop = 'endTop',\n endBottom = 'endBottom',\n insideEnd = 'insideEnd',\n insideEndTop = 'insideEndTop',\n insideEndBottom = 'insideEndBottom'\n}\n\nexport enum IMarkAreaLabelPosition {\n left = 'left',\n right = 'right',\n top = 'top',\n bottom = 'bottom',\n topLeft = 'topLeft',\n topRight = 'topRight',\n bottomLeft = 'bottomLeft',\n bottomRight = 'bottomRight',\n\n middle = 'middle',\n\n insideLeft = 'insideLeft',\n insideRight = 'insideRight',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom',\n insideTopLeft = 'insideTopLeft',\n insideTopRight = 'insideTopRight',\n insideBottomLeft = 'insideBottomLeft',\n insideBottomRight = 'insideBottomRight'\n}\n\nexport enum IMarkCommonArcLabelPosition {\n arcInnerStart = 'arcInnerStart',\n arcInnerEnd = 'arcInnerEnd',\n arcInnerMiddle = 'arcInnerMiddle',\n arcOuterStart = 'arcOuterStart',\n arcOuterEnd = 'arcOuterEnd',\n arcOuterMiddle = 'arcOuterMiddle',\n center = 'center'\n}\n\nexport enum IMarkPointItemPosition {\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom',\n insideMiddle = 'insideMiddle'\n}\n\nexport type IMarkBackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n /**\n * TODO: 根据文字宽度进行背景 panel size自适应\n */\n autoHeight?: boolean;\n /**\n * TODO: 根据文高度度进行背景 panel size自适应\n */\n autoWidth?: boolean;\n} & Partial<IRectGraphicAttribute>;\n\nexport type IMarkLabel = Omit<TagAttributes, 'x' | 'y' | 'panel'> & {\n /**\n * 标签的背景面板配置\n */\n panel?: IMarkBackgroundAttributes;\n};\n\nexport type IMarkRef = {\n /**\n * 自动旋转,沿着线的方向\n * @default\n * mark-line/mark-area/mark-point: false - 旧逻辑里autoRotate是false, 保持不变\n * mark-arc-line/mark-arc-area: true - 新增逻辑, 如果不开启的话, 效果不太好, 所以默认true\n * mark-point - 旧逻辑里autoRotate是true, 保持不变\n */\n autoRotate?: boolean;\n /**\n * label 相对line平行方向上的偏移\n */\n refX?: number;\n /**\n * label 相对line正交方向上的偏移\n */\n refY?: number;\n /**\n * label 相对默认角度的偏移 (label跟随line的角度做自动旋转时,默认按照line的平行向量作为初始角度)\n */\n refAngle?: number;\n};\n\nexport type MarkerAttrs<AnimationType> = IGroupGraphicAttribute & {\n type?: 'line' | 'arc-line' | 'area' | 'arc-area' | 'point';\n /**\n * 是否支持交互\n * @default true\n */\n interactive?: boolean;\n /**\n * 是否开启选中交互\n * @default false\n */\n select?: boolean;\n /**\n * 是否开启 hover 交互\n * @default false\n */\n hover?: boolean;\n /**\n * 是否显示marker组件\n * @default true\n */\n visible?: boolean;\n /**\n * 是否将组件在绘制区域内进行剪切\n * @default true\n */\n clipInRange?: boolean;\n /**\n * 组件绘制范围配置\n */\n limitRect?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n} & BaseMarkerAnimation<AnimationType>;\n\n/** animation type */\nexport type BaseMarkerAnimation<T> = {\n animation?: MarkerAnimation<T> | boolean;\n animationEnter?: MarkerUpdateAnimation<T>;\n animationUpdate?: MarkerUpdateAnimation<T>;\n animationExit?: MarkerExitAnimation;\n};\nexport type MarkerAnimation<T> = MarkerUpdateAnimation<T> | MarkerUpdateAnimation<T>;\n\nexport type MarkerUpdateAnimation<T> = {\n type: T;\n} & MarkerExitAnimation;\n\nexport type MarkCommonLineAnimationType = 'clipIn' | 'fadeIn';\n\nexport type CommonMarkAreaAnimationType = 'fadeIn';\n\nexport type MarkPointAnimationType = 'callIn' | 'fadeIn';\n\nexport type MarkerExitAnimation = {\n type: 'fadeOut';\n duration?: number;\n delay?: number;\n easing?: EasingType;\n};\n\nexport type MarkerAnimationState = 'enter' | 'update' | 'exit';\n\n/** state type */\nexport type MarkCommonLineState<LineAttr> = {\n line?: State<LineAttr>;\n lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n label?: State<Partial<ITextGraphicAttribute>>;\n labelBackground?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type CommonMarkAreaState<AreaAttr> = {\n area?: State<Partial<AreaAttr>>;\n label?: State<Partial<ITextGraphicAttribute>>;\n labelBackground?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type MarkPointState = {\n line?: State<ILineGraphicWithCornerRadius | Partial<ILineGraphicAttribute>[]>;\n lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n symbol?: State<Partial<ISymbolGraphicAttribute>>;\n image?: State<Partial<IImageGraphicAttribute>>;\n text?: State<Partial<ITextGraphicAttribute>>;\n textBackground?: State<Partial<IRectGraphicAttribute>>;\n richText?: State<Partial<IRichTextGraphicAttribute>>;\n customMark?: State<Partial<IGroupGraphicAttribute>>;\n targetItem?: State<Partial<ISymbolGraphicAttribute>>;\n};\n\nexport type MarkCommonLineAttrs<LineAttr, LineLabelPosition, MarkCommonLineAnimationType> =\n MarkerAttrs<MarkCommonLineAnimationType> &\n Omit<CommonSegmentAttributes, 'state' | 'lineStyle'> & {\n /**\n * 标签\n */\n label?: {\n /**\n * label 相对line的位置\n */\n position?: LineLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkRef &\n IMarkLabel;\n state?: MarkCommonLineState<LineAttr>;\n };\n\nexport type MarkLineAttrs = MarkCommonLineAttrs<\n ILineGraphicWithCornerRadius | ILineGraphicAttribute[],\n keyof typeof IMarkLineLabelPosition,\n MarkCommonLineAnimationType\n> & {\n type?: 'line';\n /**\n * 是否对 points 进行多段处理,默认为 false,即直接将所有的点连接成线。\n * 如果需要进行多段处理,需要将 points 属性配置为 Point[][] 类型\n * @default false\n */\n multiSegment?: boolean;\n /**\n * 在 `multiSegment` 属性开启的前提下,用于声明那一段线段用来作为主线段,如果不声明,默认全段为主线段\n */\n mainSegmentIndex?: number;\n /**\n * 构成line的点: 如果是两个点,则为直线;多个点则为曲线\n */\n points: Point[] | Point[][];\n lineStyle?: ILineGraphicAttribute;\n};\n\nexport type MarkArcLineAttrs = MarkCommonLineAttrs<\n IArcGraphicAttribute,\n keyof typeof IMarkCommonArcLabelPosition,\n MarkCommonLineAnimationType\n> & {\n type?: 'arc-line';\n /**\n * 弧线中心位置\n */\n center: {\n x: number;\n y: number;\n };\n /**\n * 弧线半径\n */\n radius: number;\n /**\n * 弧线起始角度(弧度)\n */\n startAngle: number;\n /**\n * 弧线终点角度(弧度)\n */\n endAngle: number;\n lineStyle?: IArcGraphicAttribute;\n};\n\nexport type MarkAreaAttrs = MarkerAttrs<CommonMarkAreaAnimationType> & {\n type?: 'area';\n /**\n * 构成area的点\n */\n points: Point[];\n /**\n * 标签\n */\n label?: {\n position?: keyof typeof IMarkAreaLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IPolygonAttribute;\n\n state?: CommonMarkAreaState<IPolygonGraphicAttribute>;\n};\n\nexport type MarkArcAreaAttrs = MarkerAttrs<CommonMarkAreaAnimationType> & {\n type?: 'arc-area';\n /**\n * 扇区中心位置\n */\n center: {\n x: number;\n y: number;\n };\n /**\n * 扇区内半径\n */\n innerRadius: number;\n /**\n * 扇区外半径\n */\n outerRadius: number;\n /**\n * 扇区起始角度(弧度)\n */\n startAngle: number;\n /**\n * 扇区终点角度(弧度)\n */\n endAngle: number;\n /**\n * 标签\n */\n label?: {\n position?: keyof typeof IMarkCommonArcLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkRef &\n IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IArcGraphicAttribute;\n\n state?: CommonMarkAreaState<IArcGraphicAttribute>;\n};\n\nexport type IItemContent = IMarkRef & {\n /**\n * 标注类型\n * Tips: 保留'richText'与之前的定义做兼容\n */\n type?: 'symbol' | 'text' | 'image' | 'richText' | 'custom';\n position?: keyof typeof IMarkPointItemPosition;\n /**\n * x 方向偏移量\n */\n offsetX?: number;\n /**\n * y 方向偏移量\n */\n offsetY?: number;\n /**\n * type为symbol时, symbol的样式\n */\n symbolStyle?: ISymbolGraphicAttribute;\n /**\n * type为image时, image的样式\n */\n imageStyle?: IImageGraphicAttribute;\n /**\n * type为text时, text的配置\n * 'text'类型的ItemContent新增三种子类型:'text','rich','html'。配置在textStyle.type上,继承自TagAttributes。\n */\n textStyle?: IMarkLabel;\n /**\n * type为rich text时, rich text的样式\n */\n richTextStyle?: IRichTextGraphicAttribute;\n /**\n * type为custom时,允许以callback的方式传入需要render的item\n */\n renderCustomCallback?: () => IGroup;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n};\n\nexport type IItemLine = {\n /** TODO:'type-opo' */\n type?: 'type-s' | 'type-do' | 'type-po' | 'type-op' | 'type-arc';\n visible?: boolean;\n /**\n * 当type为type-arc时生效, 数值决定曲率, 符号决定法向, 不能等于0\n * @default 0.8\n */\n arcRatio?: number;\n /**\n * 垂直于引导线的装饰线,参考案例: https://observablehq.com/@mikelotis/edmonton-population-history-line-chart\n */\n decorativeLine?: {\n visible?: boolean;\n length?: number;\n };\n} & Omit<SegmentAttributes, 'points'>;\n\nexport type MarkPointAttrs = Omit<MarkerAttrs<MarkPointAnimationType>, 'labelStyle'> & {\n /**\n * markPoint的位置(也是path的起点)\n */\n position: Point;\n /**\n * 标注引导线\n */\n itemLine?: IItemLine;\n\n /**\n * 标注内容\n */\n itemContent?: IItemContent;\n\n /**\n * 被标注的内容\n */\n targetSymbol?: {\n /**\n * 被标注内容与标记线间的间隙\n * @default 0\n */\n offset?: number;\n /**\n * 是否显示\n * @default false\n */\n visible?: boolean;\n /**\n * 大小\n * @default 20\n */\n size?: number;\n style?: ISymbol;\n };\n\n state?: MarkPointState;\n} & BaseMarkerAnimation<MarkPointAnimationType>;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/marker/type.ts"],"names":[],"mappings":";;;AAmBA,IAAY,sBAkBX;AAlBD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,+CAAqB,CAAA;IACrB,qDAA2B,CAAA;IAC3B,qDAA2B,CAAA;IAC3B,2DAAiC,CAAA;IACjC,iEAAuC,CAAA;IAEvC,2CAAiB,CAAA;IACjB,6DAAmC,CAAA;IACnC,mEAAyC,CAAA;IAEzC,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;IACvB,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,6DAAmC,CAAA;AACrC,CAAC,EAlBW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAkBjC;AAED,IAAY,sBAoBX;AApBD,WAAY,sBAAsB;IAChC,uCAAa,CAAA;IACb,yCAAe,CAAA;IACf,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,6CAAmB,CAAA;IACnB,+CAAqB,CAAA;IACrB,mDAAyB,CAAA;IACzB,qDAA2B,CAAA;IAE3B,2CAAiB,CAAA;IAEjB,mDAAyB,CAAA;IACzB,qDAA2B,CAAA;IAC3B,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,yDAA+B,CAAA;IAC/B,2DAAiC,CAAA;IACjC,+DAAqC,CAAA;IACrC,iEAAuC,CAAA;AACzC,CAAC,EApBW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAoBjC;AAED,IAAY,2BAQX;AARD,WAAY,2BAA2B;IACrC,8DAA+B,CAAA;IAC/B,0DAA2B,CAAA;IAC3B,gEAAiC,CAAA;IACjC,8DAA+B,CAAA;IAC/B,0DAA2B,CAAA;IAC3B,gEAAiC,CAAA;IACjC,gDAAiB,CAAA;AACnB,CAAC,EARW,2BAA2B,GAA3B,mCAA2B,KAA3B,mCAA2B,QAQtC;AAED,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,uDAA6B,CAAA;AAC/B,CAAC,EAPW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAOjC","file":"type.js","sourcesContent":["import type {\n EasingType,\n IArcGraphicAttribute,\n IGroup,\n IGroupGraphicAttribute,\n IImageGraphicAttribute,\n ILineGraphicAttribute,\n IPolygonAttribute,\n IPolygonGraphicAttribute,\n IRectGraphicAttribute,\n IRichTextGraphicAttribute,\n ISymbol,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { CommonSegmentAttributes, ILineGraphicWithCornerRadius, SegmentAttributes } from '../segment/type';\nimport type { TagAttributes } from '../tag/type';\nimport type { Point, State } from '../core/type';\n\nexport enum IMarkLineLabelPosition {\n start = 'start',\n startTop = 'startTop',\n startBottom = 'startBottom',\n insideStart = 'insideStart',\n insideStartTop = 'insideStartTop',\n insideStartBottom = 'insideStartBottom',\n\n middle = 'middle',\n insideMiddleTop = 'insideMiddleTop',\n insideMiddleBottom = 'insideMiddleBottom',\n\n end = 'end',\n endTop = 'endTop',\n endBottom = 'endBottom',\n insideEnd = 'insideEnd',\n insideEndTop = 'insideEndTop',\n insideEndBottom = 'insideEndBottom'\n}\n\nexport enum IMarkAreaLabelPosition {\n left = 'left',\n right = 'right',\n top = 'top',\n bottom = 'bottom',\n topLeft = 'topLeft',\n topRight = 'topRight',\n bottomLeft = 'bottomLeft',\n bottomRight = 'bottomRight',\n\n middle = 'middle',\n\n insideLeft = 'insideLeft',\n insideRight = 'insideRight',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom',\n insideTopLeft = 'insideTopLeft',\n insideTopRight = 'insideTopRight',\n insideBottomLeft = 'insideBottomLeft',\n insideBottomRight = 'insideBottomRight'\n}\n\nexport enum IMarkCommonArcLabelPosition {\n arcInnerStart = 'arcInnerStart',\n arcInnerEnd = 'arcInnerEnd',\n arcInnerMiddle = 'arcInnerMiddle',\n arcOuterStart = 'arcOuterStart',\n arcOuterEnd = 'arcOuterEnd',\n arcOuterMiddle = 'arcOuterMiddle',\n center = 'center'\n}\n\nexport enum IMarkPointItemPosition {\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom',\n insideMiddle = 'insideMiddle'\n}\n\nexport type IMarkBackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n /**\n * TODO: 根据文字宽度进行背景 panel size自适应\n */\n autoHeight?: boolean;\n /**\n * TODO: 根据文高度度进行背景 panel size自适应\n */\n autoWidth?: boolean;\n} & Partial<IRectGraphicAttribute>;\n\nexport type IMarkLabel = Omit<TagAttributes, 'x' | 'y' | 'panel'> & {\n /**\n * 标签的背景面板配置\n */\n panel?: IMarkBackgroundAttributes;\n};\n\nexport type IMarkRef = {\n /**\n * 自动旋转,沿着线的方向\n * @default\n * mark-line/mark-area/mark-point: false - 旧逻辑里autoRotate是false, 保持不变\n * mark-arc-line/mark-arc-area: true - 新增逻辑, 如果不开启的话, 效果不太好, 所以默认true\n * mark-point - 旧逻辑里autoRotate是true, 保持不变\n */\n autoRotate?: boolean;\n /**\n * label 相对line平行方向上的偏移\n */\n refX?: number;\n /**\n * label 相对line正交方向上的偏移\n */\n refY?: number;\n /**\n * label 相对默认角度的偏移 (label跟随line的角度做自动旋转时,默认按照line的平行向量作为初始角度)\n */\n refAngle?: number;\n};\n\nexport type MarkerAttrs<AnimationType> = IGroupGraphicAttribute & {\n /**\n * 设置标注的类型\n */\n type?: 'line' | 'arc-line' | 'area' | 'arc-area' | 'point';\n /**\n * 是否支持交互\n * @default true\n */\n interactive?: boolean;\n /**\n * 是否开启选中交互\n * @default false\n */\n select?: boolean;\n /**\n * 是否开启 hover 交互\n * @default false\n */\n hover?: boolean;\n /**\n * 是否显示marker组件\n * @default true\n */\n visible?: boolean;\n /**\n * 是否将组件在绘制区域内进行剪切\n * @default true\n */\n clipInRange?: boolean;\n /**\n * 组件绘制范围配置\n */\n limitRect?: {\n /**\n * 绘制范围的起点x坐标\n */\n x: number;\n /**\n * 绘制范围的起点y坐标\n */\n y: number;\n /**\n * 绘制范围的宽度\n */\n width: number;\n /**\n * 绘制范围的高度\n */\n height: number;\n };\n} & BaseMarkerAnimation<AnimationType>;\n\n/** animation type */\nexport type BaseMarkerAnimation<T> = {\n /**\n * 动画公共配置\n */\n animation?: MarkerAnimation<T> | boolean;\n /**\n * 入场动画配置\n */\n animationEnter?: MarkerUpdateAnimation<T>;\n /**\n * 更新动画配置\n */\n animationUpdate?: MarkerUpdateAnimation<T>;\n /**\n * 离场动画配置\n */\n animationExit?: MarkerExitAnimation;\n};\nexport type MarkerAnimation<T> = MarkerUpdateAnimation<T> | MarkerUpdateAnimation<T>;\n\nexport type MarkerUpdateAnimation<T> = {\n /**\n * 设置动画的类型\n */\n type: T;\n} & MarkerExitAnimation;\n\nexport type MarkCommonLineAnimationType = 'clipIn' | 'fadeIn';\n\nexport type CommonMarkAreaAnimationType = 'fadeIn';\n\nexport type MarkPointAnimationType = 'callIn' | 'fadeIn';\n\nexport type MarkerExitAnimation = {\n /**\n * 设置离场动画的类型为fadeOut,即淡出\n */\n type: 'fadeOut';\n /**\n * 动画的时长\n */\n duration?: number;\n /**\n * 动画延迟的时长\n */\n delay?: number;\n /**\n * 动画的缓动函数\n */\n easing?: EasingType;\n};\n\nexport type MarkerAnimationState = 'enter' | 'update' | 'exit';\n\n/** state type */\nexport type MarkCommonLineState<LineAttr> = {\n /**\n * 设置线图形的在特定状态下的样式\n */\n line?: State<LineAttr>;\n /**\n * 设置线的起点在特定状态下的样式\n */\n lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n /**\n * 设置线的终点在特定状态下的样式\n */\n lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n /**\n * 设置标签在特定状态下的样式\n */\n label?: State<Partial<ITextGraphicAttribute>>;\n /**\n * 设置标签背景区块在特定状态下的样式\n */\n labelBackground?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type CommonMarkAreaState<AreaAttr> = {\n /**\n * 设置标注区域在特定状态下的样式\n */\n area?: State<Partial<AreaAttr>>;\n /**\n * 设置标注区域标签在特定状态下的样式\n */\n label?: State<Partial<ITextGraphicAttribute>>;\n /**\n * 设置标签背景区块在特定状态下的样式\n */\n labelBackground?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type MarkPointState = {\n /**\n * 设置标注点连线在特定状态下的样式\n */\n line?: State<ILineGraphicWithCornerRadius | Partial<ILineGraphicAttribute>[]>;\n /**\n * 设置线起点图形在特定状态下的样式\n */\n lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n /**\n * 设置线终点图形在特定状态下的样式\n */\n lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n /**\n * 设置标注图形在特定状态下的样式\n */\n symbol?: State<Partial<ISymbolGraphicAttribute>>;\n /**\n * 设置标注图形在特定状态下的样式\n */\n image?: State<Partial<IImageGraphicAttribute>>;\n /**\n * 设置标签在特定状态下的样式\n */\n text?: State<Partial<ITextGraphicAttribute>>;\n /**\n * 设置标签背景区块在特定状态下的样式\n */\n textBackground?: State<Partial<IRectGraphicAttribute>>;\n /**\n * 设置富文本在特定状态下的样式\n */\n richText?: State<Partial<IRichTextGraphicAttribute>>;\n /**\n * 设置自定义标注图形在特定状态下的样式\n */\n customMark?: State<Partial<IGroupGraphicAttribute>>;\n /**\n * 设置目标元素在特定状态下的样式\n */\n targetItem?: State<Partial<ISymbolGraphicAttribute>>;\n};\n\nexport type MarkCommonLineAttrs<LineAttr, LineLabelPosition, MarkCommonLineAnimationType> =\n MarkerAttrs<MarkCommonLineAnimationType> &\n Omit<CommonSegmentAttributes, 'state' | 'lineStyle'> & {\n /**\n * 标签\n */\n label?: {\n /**\n * label 相对line的位置\n */\n position?: LineLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkRef &\n IMarkLabel;\n /**\n * 辅助线各种状态下的样式\n */\n state?: MarkCommonLineState<LineAttr>;\n };\n\nexport type MarkLineAttrs = MarkCommonLineAttrs<\n ILineGraphicWithCornerRadius | ILineGraphicAttribute[],\n keyof typeof IMarkLineLabelPosition,\n MarkCommonLineAnimationType\n> & {\n /**\n * 将辅助线的类型设置为 'line'\n */\n type?: 'line';\n /**\n * 是否对 points 进行多段处理,默认为 false,即直接将所有的点连接成线。\n * 如果需要进行多段处理,需要将 points 属性配置为 Point[][] 类型\n * @default false\n */\n multiSegment?: boolean;\n /**\n * 在 `multiSegment` 属性开启的前提下,用于声明那一段线段用来作为主线段,如果不声明,默认全段为主线段\n */\n mainSegmentIndex?: number;\n /**\n * 构成line的点: 如果是两个点,则为直线;多个点则为折线\n */\n points: Point[] | Point[][];\n /**\n * 线的样式设置\n */\n lineStyle?: ILineGraphicAttribute;\n};\n\nexport type MarkArcLineAttrs = MarkCommonLineAttrs<\n IArcGraphicAttribute,\n keyof typeof IMarkCommonArcLabelPosition,\n MarkCommonLineAnimationType\n> & {\n /**\n * 将辅助线的类型设置为 'arc-line',即弧线\n */\n type?: 'arc-line';\n /**\n * 弧线中心位置\n */\n center: {\n x: number;\n y: number;\n };\n /**\n * 弧线半径\n */\n radius: number;\n /**\n * 弧线起始角度(弧度)\n */\n startAngle: number;\n /**\n * 弧线终点角度(弧度)\n */\n endAngle: number;\n /**\n * 设置弧线的样式\n */\n lineStyle?: IArcGraphicAttribute;\n};\n\nexport type MarkAreaAttrs = MarkerAttrs<CommonMarkAreaAnimationType> & {\n type?: 'area';\n /**\n * 构成area的点\n */\n points: Point[];\n /**\n * 标签\n */\n label?: {\n /**\n * 设置标签的位置\n */\n position?: keyof typeof IMarkAreaLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IPolygonAttribute;\n /**\n * 设置标注区域在各种状态下的样式\n */\n state?: CommonMarkAreaState<IPolygonGraphicAttribute>;\n};\n\nexport type MarkArcAreaAttrs = MarkerAttrs<CommonMarkAreaAnimationType> & {\n type?: 'arc-area';\n /**\n * 扇区中心位置\n */\n center: {\n x: number;\n y: number;\n };\n /**\n * 扇区内半径\n */\n innerRadius: number;\n /**\n * 扇区外半径\n */\n outerRadius: number;\n /**\n * 扇区起始角度(弧度)\n */\n startAngle: number;\n /**\n * 扇区终点角度(弧度)\n */\n endAngle: number;\n /**\n * 标签\n */\n label?: {\n /**\n * 标签的位置\n */\n position?: keyof typeof IMarkCommonArcLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkRef &\n IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IArcGraphicAttribute;\n /**\n * 辅助区域这种状态下各个图元的样式设置\n */\n state?: CommonMarkAreaState<IArcGraphicAttribute>;\n};\n\nexport type IItemContent = IMarkRef & {\n /**\n * 标注类型\n * Tips: 保留'richText'与之前的定义做兼容\n */\n type?: 'symbol' | 'text' | 'image' | 'richText' | 'custom';\n /**\n * 设置标注的位置\n */\n position?: keyof typeof IMarkPointItemPosition;\n /**\n * x 方向偏移量\n */\n offsetX?: number;\n /**\n * y 方向偏移量\n */\n offsetY?: number;\n /**\n * type为symbol时, symbol的样式\n */\n symbolStyle?: ISymbolGraphicAttribute;\n /**\n * type为image时, image的样式\n */\n imageStyle?: IImageGraphicAttribute;\n /**\n * type为text时, text的配置\n * 'text'类型的ItemContent新增三种子类型:'text','rich','html'。配置在textStyle.type上,继承自TagAttributes。\n */\n textStyle?: IMarkLabel;\n /**\n * type为rich text时, rich text的样式\n */\n richTextStyle?: IRichTextGraphicAttribute;\n /**\n * type为custom时,允许以callback的方式传入需要render的item\n */\n renderCustomCallback?: () => IGroup;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n};\n\nexport type IItemLine = {\n /** TODO:'type-opo' */\n type?: 'type-s' | 'type-do' | 'type-po' | 'type-op' | 'type-arc';\n /**\n * 是否展示该标注\n */\n visible?: boolean;\n /**\n * 当type为type-arc时生效, 数值决定曲率, 符号决定法向, 不能等于0\n * @default 0.8\n */\n arcRatio?: number;\n /**\n * 垂直于引导线的装饰线,参考案例: https://observablehq.com/@mikelotis/edmonton-population-history-line-chart\n */\n decorativeLine?: {\n /**\n * 是否显示引导线的装饰线\n */\n visible?: boolean;\n /**\n * 装饰线的长度\n */\n length?: number;\n };\n} & Omit<SegmentAttributes, 'points'>;\n\nexport type MarkPointAttrs = Omit<MarkerAttrs<MarkPointAnimationType>, 'labelStyle'> & {\n /**\n * markPoint的位置(也是path的起点)\n */\n position: Point;\n /**\n * 标注引导线\n */\n itemLine?: IItemLine;\n\n /**\n * 标注内容\n */\n itemContent?: IItemContent;\n\n /**\n * 被标注的内容\n */\n targetSymbol?: {\n /**\n * 被标注内容与标记线间的间隙\n * @default 0\n */\n offset?: number;\n /**\n * 是否显示\n * @default false\n */\n visible?: boolean;\n /**\n * 大小\n * @default 20\n */\n size?: number;\n /**\n * 被标注内容的样式设置\n */\n style?: ISymbol;\n };\n /**\n * 标注点各个状态下的样式\n */\n state?: MarkPointState;\n} & BaseMarkerAnimation<MarkPointAnimationType>;\n"]}
|
package/cjs/poptip/type.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/poptip/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n IGraphic,\n IGroupGraphicAttribute,\n IRectGraphicAttribute,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { Padding, State } from '../core/type';\nimport type { BackgroundAttributes } from '../interface';\n\ntype StateStyle = {\n /**\n * title 文本的状态配置\n */\n title?: State<Partial<ITextGraphicAttribute>>;\n /**\n * content 文本的状态配置\n */\n content?: State<Partial<ITextGraphicAttribute>>;\n /**\n * panel 背景的状态配置ß\n */\n panel?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type PopTipAttributes = {\n
|
|
1
|
+
{"version":3,"sources":["../src/poptip/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n IGraphic,\n IGroupGraphicAttribute,\n IRectGraphicAttribute,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { Padding, State } from '../core/type';\nimport type { BackgroundAttributes } from '../interface';\n\ntype StateStyle = {\n /**\n * title 文本的状态配置\n */\n title?: State<Partial<ITextGraphicAttribute>>;\n /**\n * content 文本的状态配置\n */\n content?: State<Partial<ITextGraphicAttribute>>;\n /**\n * panel 背景的状态配置ß\n */\n panel?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type PopTipAttributes = {\n /**\n * 弹出框的方位,有 12 个方位可供选择\n */\n position?: 'auto' | 'top' | 'tl' | 'tr' | 'bottom' | 'bl' | 'br' | 'left' | 'lt' | 'lb' | 'right' | 'rt' | 'rb';\n /**\n * 标题内容,如果需要进行换行,则使用数组形式,如 ['abc', '123']\n */\n title?: string | string[] | number | number[];\n /**\n * 标题样式\n */\n titleStyle?: Partial<ITextGraphicAttribute>;\n /**\n * 标题的格式化方法\n */\n titleFormatMethod?: (t: string | string[] | number | number[]) => string | string[] | number | number[];\n /**\n * 内容文本,如果需要进行换行,则使用数组形式,如 ['abc', '123']\n */\n content?: string | string[] | number | number[];\n /**\n * 内容文本样式\n */\n contentStyle?: Partial<ITextGraphicAttribute>;\n /**\n * 内容的格式化方法\n */\n contentFormatMethod?: (t: string | string[] | number | number[]) => string | string[] | number | number[];\n /**\n * 标题与内容的间距\n */\n space?: number;\n /**\n * 内部边距\n */\n padding?: Padding;\n /**\n * 标签的背景面板配置, TODO: 支持symbol形状\n */\n panel?: BackgroundAttributes & ISymbolGraphicAttribute & { space?: number };\n\n /**\n * 最小宽度,像素值\n * @default 30\n */\n minWidth?: number;\n /**\n * 最大宽度,像素值。当文字超过最大宽度时,会自动省略。\n */\n maxWidth?: number;\n\n /**\n * 最大宽度比例\n */\n maxWidthPercent?: number;\n /**\n * 是否展示\n */\n visible?: boolean;\n /**\n * 自定义的展示逻辑\n */\n visibleFunc?: (graphic: IGraphic) => boolean;\n state?: StateStyle;\n dx?: number;\n dy?: number;\n} & Omit<IGroupGraphicAttribute, 'background'>;\n\nexport type PoptipShapeAttributes = {\n /**\n * 是否展示 shape\n */\n visible: boolean;\n} & Partial<ISymbolGraphicAttribute>;\n"]}
|
package/dist/index.es.js
CHANGED
|
@@ -1494,7 +1494,7 @@ let Step$1 = class Step {
|
|
|
1494
1494
|
default:
|
|
1495
1495
|
if (this._t <= 0) this.context.lineTo(this._x, y, !1 !== this._lastDefined && !1 !== p.defined, this.lastPoint), this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined, p);else {
|
|
1496
1496
|
const x1 = this._x * (1 - this._t) + x * this._t;
|
|
1497
|
-
this.context.lineTo(x1, this._y, !1 !== this._lastDefined && !1 !== p.defined, this.lastPoint), this.context.lineTo(x1, y, !1 !== this._lastDefined && !1 !== p.defined, p);
|
|
1497
|
+
.5 === this._t ? this.context.lineTo(x1, this._y, !1 !== this._lastDefined, this.lastPoint) : this.context.lineTo(x1, this._y, !1 !== this._lastDefined && !1 !== p.defined, this.lastPoint), this.context.lineTo(x1, y, !1 !== this._lastDefined && !1 !== p.defined, p);
|
|
1498
1498
|
}
|
|
1499
1499
|
}
|
|
1500
1500
|
this._lastDefined = p.defined, this._x = x, this._y = y, this.lastPoint = p;
|
|
@@ -4177,7 +4177,7 @@ class Animate {
|
|
|
4177
4177
|
let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Generator.GenAutoIncrementId();
|
|
4178
4178
|
let timeline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultTimeline;
|
|
4179
4179
|
let slience = arguments.length > 2 ? arguments[2] : undefined;
|
|
4180
|
-
this.id = id, this.timeline = timeline, this.status = AnimateStatus.INITIAL, this.tailAnimate = new SubAnimate(this), this.subAnimates = [this.tailAnimate], this.timeScale = 1, this.rawPosition = -1, this._startTime = 0, this._duringTime = 0, this.timeline.addAnimate(this), this.slience = slience;
|
|
4180
|
+
this.id = id, this.timeline = timeline || defaultTimeline, this.status = AnimateStatus.INITIAL, this.tailAnimate = new SubAnimate(this), this.subAnimates = [this.tailAnimate], this.timeScale = 1, this.rawPosition = -1, this._startTime = 0, this._duringTime = 0, this.timeline.addAnimate(this), this.slience = slience;
|
|
4181
4181
|
}
|
|
4182
4182
|
setTimeline(timeline) {
|
|
4183
4183
|
timeline !== this.timeline && (this.timeline.removeAnimate(this, !1), timeline.addAnimate(this));
|
|
@@ -7887,7 +7887,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
|
|
|
7887
7887
|
this._draw(line, lineAttribute, !1, drawContext, params);
|
|
7888
7888
|
}
|
|
7889
7889
|
drawSegmentItem(context, cache, fill, stroke, fillOpacity, strokeOpacity, attribute, defaultAttribute, clipRange, clipRangeByDimension, offsetX, offsetY, line, fillCb, strokeCb) {
|
|
7890
|
-
var _a
|
|
7890
|
+
var _a;
|
|
7891
7891
|
if (!cache) return;
|
|
7892
7892
|
context.beginPath();
|
|
7893
7893
|
const z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
|
|
@@ -7900,27 +7900,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
|
|
|
7900
7900
|
x: originX = 0,
|
|
7901
7901
|
x: originY = 0
|
|
7902
7902
|
} = attribute;
|
|
7903
|
-
!1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.fill())), !1 !== stroke && (strokeCb ? strokeCb(context, attribute, defaultAttribute) : strokeOpacity && (context.setStrokeStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.stroke()));
|
|
7904
|
-
let {
|
|
7905
|
-
connectedType: connectedType,
|
|
7906
|
-
connectedX: connectedX,
|
|
7907
|
-
connectedY: connectedY,
|
|
7908
|
-
connectedStyle: connectedStyle
|
|
7909
|
-
} = attribute;
|
|
7910
|
-
if (isArray(defaultAttribute) ? (connectedType = null !== (_b = null != connectedType ? connectedType : defaultAttribute[0].connectedType) && void 0 !== _b ? _b : defaultAttribute[1].connectedType, connectedX = null !== (_c = null != connectedX ? connectedX : defaultAttribute[0].connectedX) && void 0 !== _c ? _c : defaultAttribute[1].connectedX, connectedY = null !== (_d = null != connectedY ? connectedY : defaultAttribute[0].connectedY) && void 0 !== _d ? _d : defaultAttribute[1].connectedY, connectedStyle = null !== (_e = null != connectedStyle ? connectedStyle : defaultAttribute[0].connectedStyle) && void 0 !== _e ? _e : defaultAttribute[1].connectedStyle) : (connectedType = null != connectedType ? connectedType : defaultAttribute.connectedType, connectedX = null != connectedX ? connectedX : defaultAttribute.connectedX, connectedY = null != connectedY ? connectedY : defaultAttribute.connectedY, connectedStyle = null != connectedStyle ? connectedStyle : defaultAttribute.connectedStyle), "connect" !== connectedType && "zero" !== connectedType && (connectedType = "none"), "none" !== connectedType) {
|
|
7911
|
-
context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, cache, clipRange, clipRangeByDimension, {
|
|
7912
|
-
offsetX: offsetX,
|
|
7913
|
-
offsetY: offsetY,
|
|
7914
|
-
offsetZ: z,
|
|
7915
|
-
drawConnect: !0,
|
|
7916
|
-
mode: connectedType,
|
|
7917
|
-
zeroX: connectedX,
|
|
7918
|
-
zeroY: connectedY
|
|
7919
|
-
});
|
|
7920
|
-
const da = [];
|
|
7921
|
-
isArray(defaultAttribute) ? defaultAttribute.forEach(i => da.push(i)) : da.push(defaultAttribute), da.push(attribute), !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(line, connectedStyle, originX - offsetX, originY - offsetY, da), context.fill())), !1 !== stroke && (strokeCb ? strokeCb(context, attribute, defaultAttribute) : strokeOpacity && (context.setStrokeStyle(line, connectedStyle, originX - offsetX, originY - offsetY, da), context.stroke()));
|
|
7922
|
-
}
|
|
7923
|
-
return !1;
|
|
7903
|
+
return !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.fill())), !1 !== stroke && (strokeCb ? strokeCb(context, attribute, defaultAttribute) : strokeOpacity && (context.setStrokeStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.stroke())), !1;
|
|
7924
7904
|
}
|
|
7925
7905
|
drawLinearLineHighPerformance(line, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, lineAttribute, drawContext, params, fillCb, strokeCb) {
|
|
7926
7906
|
var _a;
|
|
@@ -7952,7 +7932,8 @@ let DefaultCanvasLineRender = class extends BaseRender {
|
|
|
7952
7932
|
segments: segments,
|
|
7953
7933
|
points: points,
|
|
7954
7934
|
closePath: closePath,
|
|
7955
|
-
curveTension = lineAttribute.curveTension
|
|
7935
|
+
curveTension = lineAttribute.curveTension,
|
|
7936
|
+
connectedType = lineAttribute.connectedType
|
|
7956
7937
|
} = line.attribute;
|
|
7957
7938
|
if (!this.valid(line, lineAttribute, fillCb, strokeCb)) return;
|
|
7958
7939
|
let {
|
|
@@ -7964,6 +7945,9 @@ let DefaultCanvasLineRender = class extends BaseRender {
|
|
|
7964
7945
|
clipRangeByDimension = lineAttribute.clipRangeByDimension
|
|
7965
7946
|
} = line.attribute;
|
|
7966
7947
|
if (1 === clipRange && !segments && !points.some(p => !1 === p.defined) && "linear" === curveType) return this.drawLinearLineHighPerformance(line, context, !!fill, !!stroke, fillOpacity, strokeOpacity, x, y, lineAttribute, drawContext, params, fillCb, strokeCb);
|
|
7948
|
+
function parsePoint(points, connectedType) {
|
|
7949
|
+
return "none" === connectedType ? points : points.filter(p => !1 !== p.defined);
|
|
7950
|
+
}
|
|
7967
7951
|
if (line.shouldUpdateShape()) {
|
|
7968
7952
|
const {
|
|
7969
7953
|
points: points,
|
|
@@ -7985,7 +7969,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
|
|
|
7985
7969
|
y: lastSeg.endY,
|
|
7986
7970
|
defined: lastSeg.curves[lastSeg.curves.length - 1].defined
|
|
7987
7971
|
} : index > 1 && (startPoint.x = lastSeg.endX, startPoint.y = lastSeg.endY, startPoint.defined = lastSeg.curves[lastSeg.curves.length - 1].defined);
|
|
7988
|
-
const data = calcLineCache(seg.points, curveType, {
|
|
7972
|
+
const data = calcLineCache(parsePoint(seg.points, connectedType), curveType, {
|
|
7989
7973
|
startPoint: startPoint,
|
|
7990
7974
|
curveTension: curveTension
|
|
7991
7975
|
});
|
|
@@ -8004,7 +7988,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
|
|
|
8004
7988
|
}
|
|
8005
7989
|
} else {
|
|
8006
7990
|
if (!points || !points.length) return line.cache = null, void line.clearUpdateShapeTag();
|
|
8007
|
-
line.cache = calcLineCache(_points, curveType, {
|
|
7991
|
+
line.cache = calcLineCache(parsePoint(_points, connectedType), curveType, {
|
|
8008
7992
|
curveTension: curveTension
|
|
8009
7993
|
});
|
|
8010
7994
|
}
|
|
@@ -8036,11 +8020,6 @@ DefaultCanvasLineRender = __decorate$E([injectable()], DefaultCanvasLineRender);
|
|
|
8036
8020
|
|
|
8037
8021
|
function drawAreaSegments(path, segPath, percent, params) {
|
|
8038
8022
|
var _a;
|
|
8039
|
-
const {
|
|
8040
|
-
drawConnect = !1,
|
|
8041
|
-
mode = "none"
|
|
8042
|
-
} = params || {};
|
|
8043
|
-
if (drawConnect && "none" === mode) return;
|
|
8044
8023
|
const {
|
|
8045
8024
|
top: top,
|
|
8046
8025
|
bottom: bottom
|
|
@@ -8050,34 +8029,11 @@ function drawAreaSegments(path, segPath, percent, params) {
|
|
|
8050
8029
|
const topList = [],
|
|
8051
8030
|
bottomList = [];
|
|
8052
8031
|
let lastDefined = !0;
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
|
|
8056
|
-
defined0 = !0;
|
|
8057
|
-
const n = top.curves.length;
|
|
8058
|
-
top.curves.forEach((curve, i) => {
|
|
8059
|
-
const bototmCurve = bottom.curves[n - i - 1];
|
|
8060
|
-
let currentTopCurve = curve,
|
|
8061
|
-
currentBottomCurve = bototmCurve;
|
|
8062
|
-
if (curve.originP1 === curve.originP2) return lastCurve = curve, void (lastBottomCurve = bototmCurve);
|
|
8063
|
-
if (lastCurve && lastCurve.originP1 === lastCurve.originP2 && (currentTopCurve = lastCurve, currentBottomCurve = lastBottomCurve), curve.defined) defined0 || (topList.push(currentTopCurve), bottomList.push(currentBottomCurve), drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0, defined0 = !defined0);else {
|
|
8064
|
-
const {
|
|
8065
|
-
originP1: originP1,
|
|
8066
|
-
originP2: originP2
|
|
8067
|
-
} = curve;
|
|
8068
|
-
let validTopCurve, validBottomCurve;
|
|
8069
|
-
originP1 && !1 !== originP1.defined ? (validTopCurve = currentTopCurve, validBottomCurve = currentBottomCurve) : originP1 && !1 !== originP2.defined && (validTopCurve = curve, validBottomCurve = bototmCurve), defined0 ? (defined0 = !defined0, topList.push(validTopCurve || curve), bottomList.push(validBottomCurve || bototmCurve)) : validTopCurve && (defined0 = !defined0, topList.push(validTopCurve || curve), bottomList.push(validBottomCurve || bototmCurve), drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0);
|
|
8070
|
-
}
|
|
8071
|
-
lastCurve = curve;
|
|
8072
|
-
}), drawAreaConnectBlock(path, topList, bottomList, params);
|
|
8073
|
-
} else {
|
|
8074
|
-
for (let i = 0, n = top.curves.length; i < n; i++) {
|
|
8075
|
-
const topCurve = top.curves[i];
|
|
8076
|
-
lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0) : (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1])), lastDefined = !lastDefined) : lastDefined && (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1]));
|
|
8077
|
-
}
|
|
8078
|
-
drawAreaBlock(path, topList, bottomList, params);
|
|
8032
|
+
for (let i = 0, n = top.curves.length; i < n; i++) {
|
|
8033
|
+
const topCurve = top.curves[i];
|
|
8034
|
+
lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0) : (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1])), lastDefined = !lastDefined) : lastDefined && (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1]));
|
|
8079
8035
|
}
|
|
8080
|
-
return;
|
|
8036
|
+
return void drawAreaBlock(path, topList, bottomList, params);
|
|
8081
8037
|
}
|
|
8082
8038
|
if (percent <= 0) return;
|
|
8083
8039
|
let {
|
|
@@ -8095,51 +8051,17 @@ function drawAreaSegments(path, segPath, percent, params) {
|
|
|
8095
8051
|
lastDefined = !0;
|
|
8096
8052
|
const topList = [],
|
|
8097
8053
|
bottomList = [];
|
|
8098
|
-
let lastTopCurve,
|
|
8099
|
-
lastBottomCurve,
|
|
8100
|
-
defined0 = !0;
|
|
8101
8054
|
for (let i = 0, n = top.curves.length; i < n; i++) {
|
|
8102
8055
|
const topCurve = top.curves[i],
|
|
8103
8056
|
curCurveLength = topCurve.getLength(direction),
|
|
8104
8057
|
percent = (totalDrawLength - drawedLengthUntilLast) / curCurveLength;
|
|
8105
8058
|
if (percent < 0) break;
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
if (topCurve.originP1 === topCurve.originP2) {
|
|
8111
|
-
lastTopCurve = topCurve, lastBottomCurve = bototmCurve;
|
|
8112
|
-
continue;
|
|
8113
|
-
}
|
|
8114
|
-
if (lastTopCurve && lastTopCurve.originP1 === lastTopCurve.originP2 && (currentTopCurve = lastTopCurve, currentBottomCurve = lastBottomCurve), topCurve.defined) defined0 || (topList.push(currentTopCurve), bottomList.push(currentBottomCurve), drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0, defined0 = !defined0);else {
|
|
8115
|
-
const {
|
|
8116
|
-
originP1: originP1,
|
|
8117
|
-
originP2: originP2
|
|
8118
|
-
} = topCurve;
|
|
8119
|
-
let validTopCurve, validBottomCurve;
|
|
8120
|
-
originP1 && !1 !== originP1.defined ? (validTopCurve = currentTopCurve, validBottomCurve = currentBottomCurve) : originP1 && !1 !== originP2.defined && (validTopCurve = topCurve, validBottomCurve = bototmCurve), defined0 ? (defined0 = !defined0, topList.push(validTopCurve || topCurve), bottomList.push(validBottomCurve || bototmCurve)) : validTopCurve && (defined0 = !defined0, topList.push(validTopCurve || topCurve), bottomList.push(validBottomCurve || bototmCurve), drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0);
|
|
8121
|
-
}
|
|
8122
|
-
lastTopCurve = topCurve;
|
|
8123
|
-
} else {
|
|
8124
|
-
let tc = null,
|
|
8125
|
-
bc = null;
|
|
8126
|
-
lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0) : (tc = topCurve, bc = bottom.curves[n - i - 1]), lastDefined = !lastDefined) : lastDefined && (tc = topCurve, bc = bottom.curves[n - i - 1]), tc && bc && (percent < 1 && (tc = tc.p2 && tc.p3 ? divideCubic(tc, percent)[0] : divideLinear(tc, percent)[0], bc = bc.p2 && bc.p3 ? divideCubic(bc, 1 - percent)[1] : divideLinear(bc, 1 - percent)[1]), tc.defined = lastDefined, bc.defined = lastDefined, topList.push(tc), bottomList.push(bc)), tc = null, bc = null;
|
|
8127
|
-
}
|
|
8059
|
+
drawedLengthUntilLast += curCurveLength;
|
|
8060
|
+
let tc = null,
|
|
8061
|
+
bc = null;
|
|
8062
|
+
lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0) : (tc = topCurve, bc = bottom.curves[n - i - 1]), lastDefined = !lastDefined) : lastDefined && (tc = topCurve, bc = bottom.curves[n - i - 1]), tc && bc && (percent < 1 && (tc = tc.p2 && tc.p3 ? divideCubic(tc, percent)[0] : divideLinear(tc, percent)[0], bc = bc.p2 && bc.p3 ? divideCubic(bc, 1 - percent)[1] : divideLinear(bc, 1 - percent)[1]), tc.defined = lastDefined, bc.defined = lastDefined, topList.push(tc), bottomList.push(bc)), tc = null, bc = null;
|
|
8128
8063
|
}
|
|
8129
|
-
|
|
8130
|
-
}
|
|
8131
|
-
function drawAreaConnectBlock(path, topList, bottomList, params) {
|
|
8132
|
-
if (topList.length < 2) return;
|
|
8133
|
-
const {
|
|
8134
|
-
offsetX = 0,
|
|
8135
|
-
offsetY = 0,
|
|
8136
|
-
offsetZ = 0,
|
|
8137
|
-
mode: mode
|
|
8138
|
-
} = params || {};
|
|
8139
|
-
let curve = topList[0];
|
|
8140
|
-
path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), curve = topList[topList.length - 1];
|
|
8141
|
-
let end = curve.p3 || curve.p1;
|
|
8142
|
-
path.lineTo(end.x + offsetX, end.y + offsetY, offsetZ), curve = bottomList[bottomList.length - 1], path.lineTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), curve = bottomList[0], end = curve.p3 || curve.p1, path.lineTo(end.x + offsetX, end.y + offsetY, offsetZ), path.closePath();
|
|
8064
|
+
drawAreaBlock(path, topList, bottomList, params);
|
|
8143
8065
|
}
|
|
8144
8066
|
function drawAreaBlock(path, topList, bottomList, params) {
|
|
8145
8067
|
const {
|
|
@@ -8240,7 +8162,8 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
8240
8162
|
fillOpacity = areaAttribute.fillOpacity,
|
|
8241
8163
|
z = areaAttribute.z,
|
|
8242
8164
|
strokeOpacity = areaAttribute.strokeOpacity,
|
|
8243
|
-
curveTension = areaAttribute.curveTension
|
|
8165
|
+
curveTension = areaAttribute.curveTension,
|
|
8166
|
+
connectedType = areaAttribute.connectedType
|
|
8244
8167
|
} = area.attribute,
|
|
8245
8168
|
data = this.valid(area, areaAttribute, fillCb, strokeCb);
|
|
8246
8169
|
if (!data) return;
|
|
@@ -8257,6 +8180,9 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
8257
8180
|
let {
|
|
8258
8181
|
curveType = areaAttribute.curveType
|
|
8259
8182
|
} = area.attribute;
|
|
8183
|
+
function parsePoint(points, connectedType) {
|
|
8184
|
+
return "connect" !== connectedType ? points : points.filter(p => !1 !== p.defined);
|
|
8185
|
+
}
|
|
8260
8186
|
if (closePath && "linear" === curveType && (curveType = "linearClosed"), 1 === clipRange && !segments && !points.some(p => !1 === p.defined) && "linear" === curveType) return this.drawLinearAreaHighPerformance(area, context, !!fill, doStroke, fillOpacity, strokeOpacity, x, y, areaAttribute, drawContext, params, fillCb, strokeCb);
|
|
8261
8187
|
if (area.shouldUpdateShape()) {
|
|
8262
8188
|
if (segments && segments.length) {
|
|
@@ -8270,7 +8196,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
8270
8196
|
x: lastTopSeg.endX,
|
|
8271
8197
|
y: lastTopSeg.endY
|
|
8272
8198
|
} : index > 1 && (startPoint.x = lastTopSeg.endX, startPoint.y = lastTopSeg.endY);
|
|
8273
|
-
const data = calcLineCache(seg.points, curveType, {
|
|
8199
|
+
const data = calcLineCache(parsePoint(seg.points, connectedType), curveType, {
|
|
8274
8200
|
startPoint: startPoint,
|
|
8275
8201
|
curveTension: curveTension
|
|
8276
8202
|
});
|
|
@@ -8293,7 +8219,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
8293
8219
|
y: null !== (_d = endPoint.y1) && void 0 !== _d ? _d : endPoint.y
|
|
8294
8220
|
});
|
|
8295
8221
|
}
|
|
8296
|
-
bottomPoints.length > 1 && (lastBottomSeg = calcLineCache(bottomPoints, "stepBefore" === curveType ? "stepAfter" : "stepAfter" === curveType ? "stepBefore" : curveType, {
|
|
8222
|
+
bottomPoints.length > 1 && (lastBottomSeg = calcLineCache(parsePoint(bottomPoints, connectedType), "stepBefore" === curveType ? "stepAfter" : "stepAfter" === curveType ? "stepBefore" : curveType, {
|
|
8297
8223
|
curveTension: curveTension
|
|
8298
8224
|
}), bottomCaches.unshift(lastBottomSeg));
|
|
8299
8225
|
}
|
|
@@ -8304,11 +8230,11 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
8304
8230
|
} else {
|
|
8305
8231
|
if (!points || !points.length) return area.cacheArea = null, void area.clearUpdateShapeTag();
|
|
8306
8232
|
{
|
|
8307
|
-
const topPoints = points,
|
|
8233
|
+
const topPoints = parsePoint(points, connectedType),
|
|
8308
8234
|
bottomPoints = [];
|
|
8309
|
-
for (let i =
|
|
8310
|
-
x: null !== (_e = points[i].x1) && void 0 !== _e ? _e :
|
|
8311
|
-
y: null !== (_f = points[i].y1) && void 0 !== _f ? _f :
|
|
8235
|
+
for (let i = topPoints.length - 1; i >= 0; i--) bottomPoints.push({
|
|
8236
|
+
x: null !== (_e = points[i].x1) && void 0 !== _e ? _e : topPoints[i].x,
|
|
8237
|
+
y: null !== (_f = points[i].y1) && void 0 !== _f ? _f : topPoints[i].y
|
|
8312
8238
|
});
|
|
8313
8239
|
const topCache = calcLineCache(topPoints, curveType, {
|
|
8314
8240
|
curveTension: curveTension
|
|
@@ -8350,20 +8276,10 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
8350
8276
|
this._draw(area, areaAttribute, !1, drawContext, params);
|
|
8351
8277
|
}
|
|
8352
8278
|
drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb) {
|
|
8353
|
-
|
|
8354
|
-
return ret = ret || this._drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, !1, fillCb, strokeCb), ret = ret || this._drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, !0, fillCb, strokeCb), ret;
|
|
8279
|
+
return this._drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb);
|
|
8355
8280
|
}
|
|
8356
|
-
_drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext,
|
|
8357
|
-
var _a, _b, _c, _d;
|
|
8281
|
+
_drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb) {
|
|
8358
8282
|
if (!(cache && cache.top && cache.bottom && cache.top.curves && cache.top.curves.length && cache.bottom.curves && cache.bottom.curves.length)) return;
|
|
8359
|
-
let {
|
|
8360
|
-
connectedType: connectedType,
|
|
8361
|
-
connectedX: connectedX,
|
|
8362
|
-
connectedY: connectedY,
|
|
8363
|
-
connectedStyle: connectedStyle
|
|
8364
|
-
} = attribute;
|
|
8365
|
-
const da = [];
|
|
8366
|
-
if (connect && (isArray(defaultAttribute) ? (connectedType = null !== (_a = null != connectedType ? connectedType : defaultAttribute[0].connectedType) && void 0 !== _a ? _a : defaultAttribute[1].connectedType, connectedX = null !== (_b = null != connectedX ? connectedX : defaultAttribute[0].connectedX) && void 0 !== _b ? _b : defaultAttribute[1].connectedX, connectedY = null !== (_c = null != connectedY ? connectedY : defaultAttribute[0].connectedY) && void 0 !== _c ? _c : defaultAttribute[1].connectedY, connectedStyle = null !== (_d = null != connectedStyle ? connectedStyle : defaultAttribute[0].connectedStyle) && void 0 !== _d ? _d : defaultAttribute[1].connectedStyle) : (connectedType = null != connectedType ? connectedType : defaultAttribute.connectedType, connectedX = null != connectedX ? connectedX : defaultAttribute.connectedX, connectedY = null != connectedY ? connectedY : defaultAttribute.connectedY, connectedStyle = null != connectedStyle ? connectedStyle : defaultAttribute.connectedStyle), "connect" !== connectedType && "zero" !== connectedType && (connectedType = "none"), isArray(defaultAttribute) ? defaultAttribute.forEach(i => da.push(i)) : da.push(defaultAttribute), da.push(attribute)), connect && "none" === connectedType) return !1;
|
|
8367
8283
|
context.beginPath();
|
|
8368
8284
|
const {
|
|
8369
8285
|
points: points,
|
|
@@ -8382,11 +8298,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
8382
8298
|
offsetX: offsetX,
|
|
8383
8299
|
offsetY: offsetY,
|
|
8384
8300
|
offsetZ: offsetZ,
|
|
8385
|
-
direction: direction
|
|
8386
|
-
drawConnect: connect,
|
|
8387
|
-
mode: connectedType,
|
|
8388
|
-
zeroX: connectedX,
|
|
8389
|
-
zeroY: connectedY
|
|
8301
|
+
direction: direction
|
|
8390
8302
|
}), this.beforeRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, drawContext, fillCb, null, {
|
|
8391
8303
|
attribute: attribute
|
|
8392
8304
|
}), context.setShadowBlendStyle && context.setShadowBlendStyle(area, attribute, defaultAttribute);
|
|
@@ -8394,7 +8306,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
8394
8306
|
x: originX = 0,
|
|
8395
8307
|
x: originY = 0
|
|
8396
8308
|
} = attribute;
|
|
8397
|
-
return !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(area,
|
|
8309
|
+
return !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(area, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.fill())), this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, drawContext, fillCb, null, {
|
|
8398
8310
|
attribute: attribute
|
|
8399
8311
|
}), (() => {
|
|
8400
8312
|
if (!1 !== stroke) if (strokeCb) strokeCb(context, attribute, defaultAttribute);else {
|
|
@@ -8404,12 +8316,8 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
8404
8316
|
isArray(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1] && (context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, stroke[0] ? cache.top : cache.bottom, clipRange, direction === Direction$1.ROW ? "x" : "y", {
|
|
8405
8317
|
offsetX: offsetX,
|
|
8406
8318
|
offsetY: offsetY,
|
|
8407
|
-
offsetZ: offsetZ
|
|
8408
|
-
|
|
8409
|
-
mode: connectedType,
|
|
8410
|
-
zeroX: connectedX,
|
|
8411
|
-
zeroY: connectedY
|
|
8412
|
-
})), context.setStrokeStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.stroke();
|
|
8319
|
+
offsetZ: offsetZ
|
|
8320
|
+
})), context.setStrokeStyle(area, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.stroke();
|
|
8413
8321
|
}
|
|
8414
8322
|
})(), !1;
|
|
8415
8323
|
}
|
|
@@ -10846,7 +10754,7 @@ let Line$1 = class Line extends Graphic {
|
|
|
10846
10754
|
} = attribute,
|
|
10847
10755
|
b = aabbBounds;
|
|
10848
10756
|
return points.forEach(p => {
|
|
10849
|
-
!1 === p.defined && "
|
|
10757
|
+
!1 === p.defined && "connect" !== connectedType || b.add(p.x, p.y);
|
|
10850
10758
|
}), b;
|
|
10851
10759
|
}
|
|
10852
10760
|
updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds, graphic) {
|
|
@@ -10857,7 +10765,7 @@ let Line$1 = class Line extends Graphic {
|
|
|
10857
10765
|
b = aabbBounds;
|
|
10858
10766
|
return segments.forEach(s => {
|
|
10859
10767
|
s.points.forEach(p => {
|
|
10860
|
-
!1 === p.defined && "
|
|
10768
|
+
!1 === p.defined && "connect" !== connectedType || b.add(p.x, p.y);
|
|
10861
10769
|
});
|
|
10862
10770
|
}), b;
|
|
10863
10771
|
}
|
|
@@ -19956,6 +19864,10 @@ class LabelBase extends AbstractComponent {
|
|
|
19956
19864
|
if (isFunction(dataFilter)) {
|
|
19957
19865
|
data = dataFilter(data);
|
|
19958
19866
|
}
|
|
19867
|
+
if (data && data.length) {
|
|
19868
|
+
const seenIds = new Set();
|
|
19869
|
+
data = data.filter(d => !seenIds.has(d.id) && seenIds.add(d.id));
|
|
19870
|
+
}
|
|
19959
19871
|
let labels = this._initText(data);
|
|
19960
19872
|
if (isFunction(customLayoutFunc)) {
|
|
19961
19873
|
labels = customLayoutFunc(data, labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? (d) => this._idToPoint.get(d.id) : null);
|
|
@@ -30360,6 +30272,6 @@ Switch.defaultAttributes = {
|
|
|
30360
30272
|
spaceBetweenTextAndCircle: 6
|
|
30361
30273
|
};
|
|
30362
30274
|
|
|
30363
|
-
const version = "0.21.9
|
|
30275
|
+
const version = "0.21.9";
|
|
30364
30276
|
|
|
30365
30277
|
export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PolygonSectorCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, Switch, SymbolLabel, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, hasOverlap, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, loadScrollbar, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, scrollbarModule, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };
|
package/es/axis/type.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/axis/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n ILineGraphicAttribute,\n ITextGraphicAttribute,\n ISymbolGraphicAttribute,\n IRectGraphicAttribute,\n IGroupGraphicAttribute,\n IText,\n IGroup,\n IGraphic\n} from '@visactor/vrender-core';\nimport type { Dict } from '@visactor/vutils';\nimport type { ContinuousScale, CustomTicksFunc } from '@visactor/vscale';\nimport type { Point, TextContent } from '../core/type';\nimport type { SegmentAttributes } from '../segment/type';\nimport type { TagAttributes } from '../tag/type';\n\nexport type AxisItemStateStyle<T> = {\n hover?: T;\n hover_reverse?: T;\n selected?: T;\n selected_reverse?: T;\n};\n\nexport type callbackFunc<T> = (datum: Dict<any>, index: number, data?: Dict<any>[], layer?: number) => T;\n\n// 处理过的用于绘制的 tickLine 数据\nexport type TickLineItem = {\n start: Point;\n end: Point;\n /** 归一化后的数据 */\n value: number;\n // 3d数据\n anchor?: [number, number];\n alpha?: number;\n beta?: number;\n [key: string]: any;\n};\n\n// 处理过的用于绘制的数据\nexport type TransformedAxisItem = AxisItem & {\n point: Point;\n};\n\nexport type AxisItem = {\n /** 标识符,用于动画以及图形查找 */\n id?: string | number;\n /** 显示文本 */\n label: string | number;\n /** 归一化后的数据 */\n value: number;\n /** 对应原始数据 */\n rawValue: any;\n [key: string]: any;\n};\n\nexport interface AxisBaseAttributes extends IGroupGraphicAttribute {\n /**\n * 是否开启选中交互\n * @default false\n */\n select?: boolean;\n /**\n * 是否开启 hover 交互\n * @default false\n */\n hover?: boolean;\n /**\n * 垂直于坐标轴方向的因子,默认为 1\n */\n verticalFactor?: number;\n /**\n * 坐标轴的显示位置,用于文本的防重叠处理\n */\n orient?: string;\n /** 坐标轴数据 */\n items: AxisItem[][];\n /**\n * 轴标题配置\n */\n title?: TitleAttributes;\n /**\n * 轴标签配置\n */\n label?: LabelAttributes;\n /**\n * 轴刻度线配置\n */\n tick?: TickAttributes;\n /**\n * 自刻度线配置\n */\n subTick?: SubTickAttributes;\n /**\n * 轴线配置\n */\n line?: LineAttributes;\n /**\n * 关闭交互效果\n * @default false\n */\n disableTriggerEvent?: boolean;\n}\n\nexport interface ILine3dType {\n alpha: number;\n anchor3d?: [number, number];\n}\n\nexport interface BreakSymbol {\n /**\n * 是否显示\n */\n visible?: boolean;\n /**\n * 截断图形旋转的弧度。\n */\n angle?: number;\n\n /**\n * 样式配置\n */\n style?: Partial<ISymbolGraphicAttribute>;\n}\nexport interface AxisBreakProps {\n /**\n * 轴截断的范围,值为归一化后的数据\n */\n range: [number, number];\n /**\n * 截断图形配置\n */\n breakSymbol?: BreakSymbol;\n /**\n * 轴截断原始的数据范围\n */\n rawRange?: [number, number];\n}\n\nexport interface TransformedAxisBreak extends AxisBreakProps {\n /**\n * 截断的起始点\n */\n startPoint: Point;\n /**\n * 截断的结束点\n */\n endPoint: Point;\n}\n\nexport interface LineAxisAttributes extends Omit<AxisBaseAttributes, 'label'> {\n /**\n * 起始点坐标\n */\n start: Point;\n /**\n * 结束点坐标\n */\n end: Point;\n /**\n * 坐标轴垂直方向的限制空间,该配置会影响文本的显示,\n * 即如果超出,文本则会进行自动旋转、自动隐藏等动作。\n */\n verticalLimitSize?: number;\n /**\n * 坐标轴垂直方向的最小空间,如果小于该值,则以该值占据显示空间。\n * 如果同时声明了 verticalLimitSize,请保证 verticalMinSize <= verticalLimitSize,否则会以 verticalLimitSize 为准。\n */\n verticalMinSize?: number;\n\n /**\n * 轴标签配置\n */\n label?: LabelAttributes & {\n /**\n * label 相对于容器整体的对齐方式\n * - `top`:整体向上对齐(垂直方向)\n * - `middle`:整体居中对齐(垂直方向)\n * - `bottom`:整体向下对齐(垂直方向)\n * - `left`:整体向左对齐(水平方向)\n * - `center`:整体居中对齐(水平方向)\n * - `right`:整体向右对齐(水平方向)\n */\n containerAlign?: 'left' | 'right' | 'center' | 'top' | 'bottom' | 'middle';\n /**\n * 坐标轴首尾文字向内收缩\n * @default false\n */\n flush?: boolean;\n /**\n * 保证最后的label必须展示\n * @default false\n * @since 0.17.10\n */\n lastVisible?: boolean;\n /**\n * 保证第一个的label必须展示\n * @default false\n * @since 0.20.7\n */\n firstVisible?: boolean;\n };\n /**\n * 坐标轴背景配置\n */\n panel?: {\n /**\n * 是否绘制坐标轴背景\n */\n visible?: boolean;\n /**\n * 坐标轴背景配置\n */\n style?: Partial<IRectGraphicAttribute>;\n /**\n * 坐标轴背景交互状态样式配置\n */\n state?: AxisItemStateStyle<Partial<IRectGraphicAttribute>>;\n };\n\n /**\n * 轴截断配置\n * @since 0.20.3\n */\n breaks?: AxisBreakProps[];\n}\n\nexport interface CircleAxisAttributes extends AxisBaseAttributes {\n /**\n * 坐标轴可用布局区域的大小,之前是通过width,height传入,会影响组件的Bounds大小,影响拾取\n * @since 0.20.11\n */\n size?: { width: number; height: number };\n /**\n * 当配置了 innerRadius 时,可以通过设置 inside: true,将坐标轴战士在内圆半径上。\n * @default false\n */\n inside?: boolean;\n /**\n * 圆心坐标\n */\n center: Point;\n /**\n * **弧度值**,起始弧度,默认 -0.5 * Math.PI\n *\n */\n startAngle?: number;\n /**\n * **弧度值**,结束弧度,默认 1.5 * Math.PI\n */\n endAngle?: number;\n /**\n * 半径\n */\n radius: number;\n /** 内半径 */\n innerRadius?: number;\n /**\n * 边数\n * @since 0.19.24\n */\n sides?: number;\n}\n\n// 坐标轴标题配置\nexport type TitleAttributes = Omit<TagAttributes, 'shape' | 'space' | 'panel' | 'state'> & {\n /**\n * 是否展示标题\n */\n visible?: boolean;\n /**\n * 标题的显示位置,默认 'middle'\n */\n position?: 'start' | 'middle' | 'end';\n /**\n * 标题距离坐标轴(轴线、刻度、标签共同构成的包围盒)的距离\n */\n space?: number;\n /**\n * 标题是否自动旋转以和坐标轴平行\n */\n autoRotate?: boolean;\n shape?: {\n /**\n * 是否展示 shape\n */\n visible?: boolean;\n /**\n * shape 同 文本的间距\n */\n space?: number;\n style?: Omit<Partial<ISymbolGraphicAttribute>, 'visible'>;\n };\n /**\n * 背景设置\n */\n background?: {\n /**\n * 是否绘制背景层\n */\n visible?: boolean;\n /**\n * 背景层样式\n */\n style?: Omit<Partial<IRectGraphicAttribute>, 'visible' | 'width' | 'height'>;\n };\n\n /**\n * 交互状态样式配置\n */\n state?: {\n /**\n * text 文本的状态配置\n */\n text?: AxisItemStateStyle<Partial<ITextGraphicAttribute>>;\n /**\n * shape 标记的状态配置\n */\n shape?: AxisItemStateStyle<Partial<ISymbolGraphicAttribute>>;\n /**\n * panel 背景的状态配置\n */\n background?: AxisItemStateStyle<Partial<IRectGraphicAttribute>>;\n };\n};\n// 坐标轴线配置\nexport interface LineAttributes extends Pick<SegmentAttributes, 'startSymbol' | 'endSymbol'> {\n /**\n * 是否展示轴线\n */\n visible?: boolean;\n /**\n * 线的样式配置\n */\n style?: Partial<ILineGraphicAttribute>;\n state?: AxisItemStateStyle<Partial<ILineGraphicAttribute>>;\n}\n\n// 轴刻度线配置\nexport interface TickAttributes {\n /** 是否显示轴刻度线 */\n visible: boolean;\n /**\n * 刻度线朝向,默认朝外(坐标线包围盒外部)\n * @default false\n */\n inside?: boolean;\n /**\n * tick 是否与 label 对齐\n * @default true\n */\n alignWithLabel?: boolean;\n /**\n * 刻度线的长度\n */\n length?: number;\n /**\n * 刻度线样式配置\n */\n style?: Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>;\n /**\n * 刻度线状态样式配置\n */\n state?: AxisItemStateStyle<Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>>;\n /**\n * 用于 tick 的数据过滤\n * @param data\n * @returns\n */\n dataFilter?: (data: AxisItem[]) => AxisItem[];\n}\n\n// 子轴刻度线配置\nexport interface SubTickAttributes {\n /** 是否显示子轴刻度线 */\n visible: boolean;\n /**\n * TODO: 考虑下 log 轴,自刻度线之间的间距是不均匀的问题\n * 子刻度个数\n */\n count?: number;\n /**\n * 子刻度线朝向,默认朝外(坐标线包围盒外部)\n * @default false\n */\n inside?: boolean;\n /**\n * 子刻度线的长度\n */\n length?: number;\n /**\n * 子刻度线样式配置\n */\n style?: Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>;\n /**\n * 子刻度线状态样式配置\n */\n state?: AxisItemStateStyle<Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>>;\n}\n\nexport type CustomMethod = (items: IText[], separation: number) => IText[];\n\nexport interface AxisLabelOverlap {\n /**\n * 自动旋转配置\n * @default false\n */\n autoRotate?: boolean;\n /**\n * 仅当 `autoRotate` 为 true 时生效,可选的旋转范围,默认为 [0, 45, 90]\n * @default [0, 45, 90]\n */\n autoRotateAngle?: number[];\n /**\n * 自动隐藏配置\n * @default false\n */\n autoHide?: boolean;\n /**\n * 防重叠策略,默认为 'parity'。\n * - 'parity': 奇偶校验,使用删除所有其他标签的策略(这对于标准线性轴非常有效)。\n * - 'greedy': 将执行标签的线性扫描,并删除与最后一个可见标签重叠的所有标签。\n * - 也可以传入函数用于自定义策略\n * @default 'parity'\n */\n autoHideMethod?: 'parity' | 'greedy' | CustomMethod;\n /**\n * 仅当 `autoHide` 为 true 时生效,设置文本之间的间隔距离,单位 px\n * @default 0\n */\n autoHideSeparation?: number;\n /**\n * 自动隐藏配置\n * @default false\n */\n autoLimit?: boolean;\n /**\n * 仅当 `autoLimit` 为 true 时生效,省略占位符,默认为 '...'\n * @default '...'\n */\n limitEllipsis?: string;\n /**\n * 文字超出坐标轴范围时,两侧可以提供扩充的空间大小。\n * 例如,x 轴坐标 135 度旋转时,左侧第一个标签可能超出坐标轴范围,导致文本被缩略,此时可以通过配置 `overflowLimitLength` 优化效果。\n * 仅当 `autoLimit` 为 true 时生效。\n * @default 0\n * @since 0.20.3 支持 X 轴配置生效\n */\n overflowLimitLength?:\n | number\n | {\n left?: number;\n right?: number;\n // top?: number;\n // bottom?: number;\n };\n\n /**\n * 自定义布局配置,如果声明了 `layoutFunc`,则默认提供的防重叠相关的配置(`autoHide`, `autoRotate`, `autoLimit`)均不生效\n * @param labels 标签图形元素\n * @param labelData 标签数据\n * @param layer 当前轴的层级\n * @param axis 当前轴组件实例\n * @returns void\n */\n layoutFunc?: (labels: IText[], labelData: AxisItem[], layer: number, axis: IGroup) => void;\n\n /**\n * 标签自动换行。与 `autoRotate` 不能同时生效,若开启了 `autoRotate`,则优先使用自动旋转策略。\n * @since 0.20.3\n * @default false\n */\n autoWrap?: boolean;\n}\n\nexport type LabelAttributes = Omit<AxisLabelOverlap, 'text'> &\n TextContent & {\n /** 是否展示标签 */\n visible: boolean;\n /**\n * 标签朝向,默认朝外(坐标线包围盒外部)\n * @default false\n */\n inside?: boolean;\n /** 标签同 tick 之间的间距 */\n space?: number;\n /**\n * 格式化文本回调\n * @param text 文本原始值\n * @param item 对应的图形元素\n * @param index 文本索引顺序\n * @returns 格式化文本\n */\n formatMethod?: (value: string, datum: Dict<any>, index: number, data?: Dict<any>[], layer?: number) => string;\n /**\n * 文本样式\n */\n style?: Partial<ITextGraphicAttribute> | callbackFunc<Partial<ITextGraphicAttribute> | undefined>;\n /**\n * 文本状态样式配置\n */\n state?: AxisItemStateStyle<\n Partial<ITextGraphicAttribute> | callbackFunc<Partial<ITextGraphicAttribute> | undefined>\n >;\n\n /**\n * 用于 label 的数据过滤\n * @param data\n * @param layer\n * @returns\n */\n dataFilter?: (data: AxisItem[], layer: number) => AxisItem[];\n };\n\nexport type CoordinateType = 'cartesian' | 'polar' | 'geo' | 'none';\nexport type IOrientType = 'left' | 'top' | 'right' | 'bottom' | 'z';\nexport type IPolarOrientType = 'radius' | 'angle';\n\ntype breakData = {\n /**\n * 截断后的值域范围\n */\n domain?: [number, number][];\n /**\n * 截断后的归一化范围\n */\n scope?: [number, number][];\n /**\n * 用户配置的截断范围\n */\n breakDomains: [number, number][];\n};\n\nexport interface ITickDataOpt {\n /**\n * 是否进行轴采样\n */\n sampling?: boolean;\n tickCount?: number | ((option: ITickCallbackOption) => number);\n forceTickCount?: number;\n tickStep?: number;\n tickMode?: 'average' | 'd3' | string | CustomTicksFunc<ContinuousScale>;\n noDecimals?: boolean;\n\n coordinateType: CoordinateType;\n axisOrientType: IOrientType | IPolarOrientType;\n startAngle?: number;\n\n labelFormatter?: (value: any) => string;\n labelStyle: ITextGraphicAttribute;\n labelGap?: number;\n labelFirstVisible?: boolean;\n labelLastVisible?: boolean;\n /**\n * 截断数据范围配置\n */\n breakData?: () => breakData;\n}\n\nexport interface ICartesianTickDataOpt extends ITickDataOpt {\n axisOrientType: IOrientType;\n labelFlush: boolean;\n /**\n * 截断数据范围配置\n */\n breakData?: () => breakData;\n}\n\nexport interface IPolarTickDataOpt extends ITickDataOpt {\n axisOrientType: IPolarOrientType;\n getRadius: () => number;\n labelOffset: number;\n inside: boolean;\n}\n\nexport interface ITickData {\n index: number;\n value: number | string;\n // label: string;\n}\n\nexport type ITickCallbackOption = {\n /**\n * 坐标轴占据的画布大小。\n * 直角坐标系中为轴的宽度或高度。\n * 极坐标系中半径轴的长度。\n */\n axisLength?: number;\n /**\n * 轴标签的样式\n */\n labelStyle?: ITextGraphicAttribute;\n};\n\nexport interface ILabelItem<T> extends Pick<IGraphic, 'AABBBounds'> {\n value?: T;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/axis/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n ILineGraphicAttribute,\n ITextGraphicAttribute,\n ISymbolGraphicAttribute,\n IRectGraphicAttribute,\n IGroupGraphicAttribute,\n IText,\n IGroup,\n IGraphic\n} from '@visactor/vrender-core';\nimport type { Dict } from '@visactor/vutils';\nimport type { ContinuousScale, CustomTicksFunc } from '@visactor/vscale';\nimport type { Point, TextContent } from '../core/type';\nimport type { SegmentAttributes } from '../segment/type';\nimport type { TagAttributes } from '../tag/type';\n\nexport type AxisItemStateStyle<T> = {\n hover?: T;\n hover_reverse?: T;\n selected?: T;\n selected_reverse?: T;\n};\n\nexport type callbackFunc<T> = (datum: Dict<any>, index: number, data?: Dict<any>[], layer?: number) => T;\n\n// 处理过的用于绘制的 tickLine 数据\nexport type TickLineItem = {\n start: Point;\n end: Point;\n /** 归一化后的数据 */\n value: number;\n // 3d数据\n anchor?: [number, number];\n alpha?: number;\n beta?: number;\n [key: string]: any;\n};\n\n// 处理过的用于绘制的数据\nexport type TransformedAxisItem = AxisItem & {\n point: Point;\n};\n\nexport type AxisItem = {\n /** 标识符,用于动画以及图形查找 */\n id?: string | number;\n /** 显示文本 */\n label: string | number;\n /** 归一化后的数据 */\n value: number;\n /** 对应原始数据 */\n rawValue: any;\n [key: string]: any;\n};\n\nexport interface AxisBaseAttributes extends IGroupGraphicAttribute {\n /**\n * 是否开启选中交互\n * @default false\n */\n select?: boolean;\n /**\n * 是否开启 hover 交互\n * @default false\n */\n hover?: boolean;\n /**\n * 垂直于坐标轴方向的因子,默认为 1\n */\n verticalFactor?: number;\n /**\n * 坐标轴的显示位置,用于文本的防重叠处理\n */\n orient?: string;\n /** 坐标轴数据 */\n items: AxisItem[][];\n /**\n * 轴标题配置\n */\n title?: TitleAttributes;\n /**\n * 轴标签配置\n */\n label?: LabelAttributes;\n /**\n * 轴刻度线配置\n */\n tick?: TickAttributes;\n /**\n * 自刻度线配置\n */\n subTick?: SubTickAttributes;\n /**\n * 轴线配置\n */\n line?: LineAttributes;\n /**\n * 关闭交互效果\n * @default false\n */\n disableTriggerEvent?: boolean;\n}\n\nexport interface ILine3dType {\n alpha: number;\n anchor3d?: [number, number];\n}\n\nexport interface BreakSymbol {\n /**\n * 是否显示\n */\n visible?: boolean;\n /**\n * 截断图形旋转的弧度。\n */\n angle?: number;\n\n /**\n * 样式配置\n */\n style?: Partial<ISymbolGraphicAttribute>;\n}\nexport interface AxisBreakProps {\n /**\n * 轴截断的范围,值为归一化后的数据\n */\n range: [number, number];\n /**\n * 截断图形配置\n */\n breakSymbol?: BreakSymbol;\n /**\n * 轴截断原始的数据范围\n */\n rawRange?: [number, number];\n}\n\nexport interface TransformedAxisBreak extends AxisBreakProps {\n /**\n * 截断的起始点\n */\n startPoint: Point;\n /**\n * 截断的结束点\n */\n endPoint: Point;\n}\n\nexport interface LineAxisAttributes extends Omit<AxisBaseAttributes, 'label'> {\n /**\n * 起始点坐标\n */\n start: Point;\n /**\n * 结束点坐标\n */\n end: Point;\n /**\n * 坐标轴垂直方向的限制空间,该配置会影响文本的显示,\n * 即如果超出,文本则会进行自动旋转、自动隐藏等动作。\n */\n verticalLimitSize?: number;\n /**\n * 坐标轴垂直方向的最小空间,如果小于该值,则以该值占据显示空间。\n * 如果同时声明了 verticalLimitSize,请保证 verticalMinSize <= verticalLimitSize,否则会以 verticalLimitSize 为准。\n */\n verticalMinSize?: number;\n\n /**\n * 轴标签配置\n */\n label?: LabelAttributes & {\n /**\n * label 相对于容器整体的对齐方式\n * - `top`:整体向上对齐(垂直方向)\n * - `middle`:整体居中对齐(垂直方向)\n * - `bottom`:整体向下对齐(垂直方向)\n * - `left`:整体向左对齐(水平方向)\n * - `center`:整体居中对齐(水平方向)\n * - `right`:整体向右对齐(水平方向)\n */\n containerAlign?: 'left' | 'right' | 'center' | 'top' | 'bottom' | 'middle';\n /**\n * 坐标轴首尾文字向内收缩\n * @default false\n */\n flush?: boolean;\n /**\n * 保证最后的label必须展示\n * @default false\n * @since 0.17.10\n */\n lastVisible?: boolean;\n /**\n * 保证第一个的label必须展示\n * @default false\n * @since 0.20.7\n */\n firstVisible?: boolean;\n };\n /**\n * 坐标轴背景配置\n */\n panel?: {\n /**\n * 是否绘制坐标轴背景\n */\n visible?: boolean;\n /**\n * 坐标轴背景配置\n */\n style?: Partial<IRectGraphicAttribute>;\n /**\n * 坐标轴背景交互状态样式配置\n */\n state?: AxisItemStateStyle<Partial<IRectGraphicAttribute>>;\n };\n\n /**\n * 轴截断配置\n * @since 0.20.3\n */\n breaks?: AxisBreakProps[];\n}\n\nexport interface CircleAxisAttributes extends AxisBaseAttributes {\n /**\n * 坐标轴可用布局区域的大小,之前是通过width,height传入,会影响组件的Bounds大小,影响拾取\n * @since 0.20.11\n */\n size?: { width: number; height: number };\n /**\n * 当配置了 innerRadius 时,可以通过设置 inside: true,将坐标轴战士在内圆半径上。\n * @default false\n */\n inside?: boolean;\n /**\n * 圆心坐标\n */\n center: Point;\n /**\n * **弧度值**,起始弧度,默认 -0.5 * Math.PI\n *\n */\n startAngle?: number;\n /**\n * **弧度值**,结束弧度,默认 1.5 * Math.PI\n */\n endAngle?: number;\n /**\n * 半径\n */\n radius: number;\n /** 内半径 */\n innerRadius?: number;\n /**\n * 边数\n * @since 0.19.24\n */\n sides?: number;\n}\n\n// 坐标轴标题配置\nexport type TitleAttributes = Omit<TagAttributes, 'shape' | 'space' | 'panel' | 'state'> & {\n /**\n * 是否展示标题\n */\n visible?: boolean;\n /**\n * 标题的显示位置,默认 'middle'\n */\n position?: 'start' | 'middle' | 'end';\n /**\n * 标题距离坐标轴(轴线、刻度、标签共同构成的包围盒)的距离\n */\n space?: number;\n /**\n * 标题是否自动旋转以和坐标轴平行\n */\n autoRotate?: boolean;\n shape?: {\n /**\n * 是否展示 shape\n */\n visible?: boolean;\n /**\n * shape 同 文本的间距\n */\n space?: number;\n style?: Omit<Partial<ISymbolGraphicAttribute>, 'visible'>;\n };\n /**\n * 背景设置\n */\n background?: {\n /**\n * 是否绘制背景层\n */\n visible?: boolean;\n /**\n * 背景层样式\n */\n style?: Omit<Partial<IRectGraphicAttribute>, 'visible' | 'width' | 'height'>;\n };\n\n /**\n * 交互状态样式配置\n */\n state?: {\n /**\n * text 文本的状态配置\n */\n text?: AxisItemStateStyle<Partial<ITextGraphicAttribute>>;\n /**\n * shape 标记的状态配置\n */\n shape?: AxisItemStateStyle<Partial<ISymbolGraphicAttribute>>;\n /**\n * panel 背景的状态配置\n */\n background?: AxisItemStateStyle<Partial<IRectGraphicAttribute>>;\n };\n};\n// 坐标轴线配置\nexport interface LineAttributes extends Pick<SegmentAttributes, 'startSymbol' | 'endSymbol'> {\n /**\n * 是否展示轴线\n */\n visible?: boolean;\n /**\n * 线的样式配置\n */\n style?: Partial<ILineGraphicAttribute>;\n state?: AxisItemStateStyle<Partial<ILineGraphicAttribute>>;\n}\n\n// 轴刻度线配置\nexport interface TickAttributes {\n /** 是否显示轴刻度线 */\n visible: boolean;\n /**\n * 刻度线朝向,默认朝外(坐标线包围盒外部)\n * @default false\n */\n inside?: boolean;\n /**\n * tick 是否与 label 对齐\n * @default true\n */\n alignWithLabel?: boolean;\n /**\n * 刻度线的长度\n */\n length?: number;\n /**\n * 刻度线样式配置\n */\n style?: Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>;\n /**\n * 刻度线状态样式配置\n */\n state?: AxisItemStateStyle<Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>>;\n /**\n * 用于 tick 的数据过滤\n * @param data\n * @returns\n */\n dataFilter?: (data: AxisItem[]) => AxisItem[];\n}\n\n// 子轴刻度线配置\nexport interface SubTickAttributes {\n /** 是否显示子轴刻度线 */\n visible: boolean;\n /**\n * TODO: 考虑下 log 轴,自刻度线之间的间距是不均匀的问题\n * 子刻度个数\n */\n count?: number;\n /**\n * 子刻度线朝向,默认朝外(坐标线包围盒外部)\n * @default false\n */\n inside?: boolean;\n /**\n * 子刻度线的长度\n */\n length?: number;\n /**\n * 子刻度线样式配置\n */\n style?: Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>;\n /**\n * 子刻度线状态样式配置\n */\n state?: AxisItemStateStyle<Partial<ILineGraphicAttribute> | callbackFunc<Partial<ILineGraphicAttribute> | undefined>>;\n}\n\nexport type CustomMethod = (items: IText[], separation: number) => IText[];\n\nexport interface AxisLabelOverlap {\n /**\n * 自动旋转配置\n * @default false\n */\n autoRotate?: boolean;\n /**\n * 仅当 `autoRotate` 为 true 时生效,可选的旋转范围,默认为 [0, 45, 90]\n * @default [0, 45, 90]\n */\n autoRotateAngle?: number[];\n /**\n * 自动隐藏配置\n * @default false\n */\n autoHide?: boolean;\n /**\n * 防重叠策略,默认为 'parity'。\n * - 'parity': 奇偶校验,使用删除所有其他标签的策略(这对于标准线性轴非常有效)。\n * - 'greedy': 将执行标签的线性扫描,并删除与最后一个可见标签重叠的所有标签。\n * - 也可以传入函数用于自定义策略\n * @default 'parity'\n */\n autoHideMethod?: 'parity' | 'greedy' | CustomMethod;\n /**\n * 仅当 `autoHide` 为 true 时生效,设置文本之间的间隔距离,单位 px\n * @default 0\n */\n autoHideSeparation?: number;\n /**\n * 自动隐藏配置\n * @default false\n */\n autoLimit?: boolean;\n /**\n * 仅当 `autoLimit` 为 true 时生效,省略占位符,默认为 '...'\n * @default '...'\n */\n limitEllipsis?: string;\n /**\n * 文字超出坐标轴范围时,两侧可以提供扩充的空间大小。\n * 例如,x 轴坐标 135 度旋转时,左侧第一个标签可能超出坐标轴范围,导致文本被缩略,此时可以通过配置 `overflowLimitLength` 优化效果。\n * 仅当 `autoLimit` 为 true 时生效。\n * @default 0\n * @since 0.20.3 支持 X 轴配置生效\n */\n overflowLimitLength?:\n | number\n | {\n /**\n * 左侧扩充空间的大小\n */\n left?: number;\n /**\n * 右侧扩充空间的大小\n */\n right?: number;\n // top?: number;\n // bottom?: number;\n };\n\n /**\n * 自定义布局配置,如果声明了 `layoutFunc`,则默认提供的防重叠相关的配置(`autoHide`, `autoRotate`, `autoLimit`)均不生效\n * @param labels 标签图形元素\n * @param labelData 标签数据\n * @param layer 当前轴的层级\n * @param axis 当前轴组件实例\n * @returns void\n */\n layoutFunc?: (labels: IText[], labelData: AxisItem[], layer: number, axis: IGroup) => void;\n\n /**\n * 标签自动换行。与 `autoRotate` 不能同时生效,若开启了 `autoRotate`,则优先使用自动旋转策略。\n * @since 0.20.3\n * @default false\n */\n autoWrap?: boolean;\n}\n\nexport type LabelAttributes = Omit<AxisLabelOverlap, 'text'> &\n TextContent & {\n /** 是否展示标签 */\n visible: boolean;\n /**\n * 标签朝向,默认朝外(坐标线包围盒外部)\n * @default false\n */\n inside?: boolean;\n /** 标签同 tick 之间的间距 */\n space?: number;\n /**\n * 格式化文本回调\n * @param text 文本原始值\n * @param item 对应的图形元素\n * @param index 文本索引顺序\n * @returns 格式化文本\n */\n formatMethod?: (value: string, datum: Dict<any>, index: number, data?: Dict<any>[], layer?: number) => string;\n /**\n * 文本样式\n */\n style?: Partial<ITextGraphicAttribute> | callbackFunc<Partial<ITextGraphicAttribute> | undefined>;\n /**\n * 文本状态样式配置\n */\n state?: AxisItemStateStyle<\n Partial<ITextGraphicAttribute> | callbackFunc<Partial<ITextGraphicAttribute> | undefined>\n >;\n\n /**\n * 用于 label 的数据过滤\n * @param data\n * @param layer\n * @returns\n */\n dataFilter?: (data: AxisItem[], layer: number) => AxisItem[];\n };\n\nexport type CoordinateType = 'cartesian' | 'polar' | 'geo' | 'none';\nexport type IOrientType = 'left' | 'top' | 'right' | 'bottom' | 'z';\nexport type IPolarOrientType = 'radius' | 'angle';\n\ntype breakData = {\n /**\n * 截断后的值域范围\n */\n domain?: [number, number][];\n /**\n * 截断后的归一化范围\n */\n scope?: [number, number][];\n /**\n * 用户配置的截断范围\n */\n breakDomains: [number, number][];\n};\n\nexport interface ITickDataOpt {\n /**\n * 是否进行轴采样\n */\n sampling?: boolean;\n tickCount?: number | ((option: ITickCallbackOption) => number);\n forceTickCount?: number;\n tickStep?: number;\n tickMode?: 'average' | 'd3' | string | CustomTicksFunc<ContinuousScale>;\n noDecimals?: boolean;\n\n coordinateType: CoordinateType;\n axisOrientType: IOrientType | IPolarOrientType;\n startAngle?: number;\n\n labelFormatter?: (value: any) => string;\n labelStyle: ITextGraphicAttribute;\n labelGap?: number;\n labelFirstVisible?: boolean;\n labelLastVisible?: boolean;\n /**\n * 截断数据范围配置\n */\n breakData?: () => breakData;\n}\n\nexport interface ICartesianTickDataOpt extends ITickDataOpt {\n axisOrientType: IOrientType;\n labelFlush: boolean;\n /**\n * 截断数据范围配置\n */\n breakData?: () => breakData;\n}\n\nexport interface IPolarTickDataOpt extends ITickDataOpt {\n axisOrientType: IPolarOrientType;\n getRadius: () => number;\n labelOffset: number;\n inside: boolean;\n}\n\nexport interface ITickData {\n index: number;\n value: number | string;\n // label: string;\n}\n\nexport type ITickCallbackOption = {\n /**\n * 坐标轴占据的画布大小。\n * 直角坐标系中为轴的宽度或高度。\n * 极坐标系中半径轴的长度。\n */\n axisLength?: number;\n /**\n * 轴标签的样式\n */\n labelStyle?: ITextGraphicAttribute;\n};\n\nexport interface ILabelItem<T> extends Pick<IGraphic, 'AABBBounds'> {\n value?: T;\n}\n"]}
|
package/es/brush/brush.js
CHANGED
package/es/brush/type.js
CHANGED
|
@@ -4,4 +4,5 @@ export var IOperateType;
|
|
|
4
4
|
IOperateType.drawStart = "drawStart", IOperateType.drawEnd = "drawEnd", IOperateType.drawing = "drawing",
|
|
5
5
|
IOperateType.moving = "moving", IOperateType.moveStart = "moveStart", IOperateType.moveEnd = "moveEnd",
|
|
6
6
|
IOperateType.brushClear = "brushClear";
|
|
7
|
-
}(IOperateType || (IOperateType = {}));
|
|
7
|
+
}(IOperateType || (IOperateType = {}));
|
|
8
|
+
//# sourceMappingURL=type.js.map
|
package/es/core/type.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type { IGraphicStyle, IRichTextCharacter } from '@visactor/vrender-core';\n\nexport type Point = {\n x: number;\n y: number;\n};\n\nexport interface LocationCfg {\n [key: string]: any;\n}\n\nexport interface PointLocationCfg extends LocationCfg {\n /**\n * 位置 x\n * @type {number}\n */\n x: number;\n /**\n * 位置 y\n * @type {number}\n */\n y: number;\n}\n\nexport interface RegionLocationCfg extends LocationCfg {\n /**\n * 起始点\n */\n start: Point;\n /**\n * 结束点\n */\n end: Point;\n}\n\nexport type State<T> = {\n [key: string]: T;\n};\n\nexport type BaseGraphicAttributes<T> = {\n /**\n * 基础样式设置\n */\n style?: T;\n /**\n * 状态样式设置\n */\n state?: State<T>;\n};\n\nexport type Padding =\n | number\n | number[]\n | {\n top?: number;\n bottom?: number;\n left?: number;\n right?: number;\n };\n\ntype CommonTextContent = {\n text?:\n | string\n | string[]\n | number\n | number[]\n | {\n type?: 'text';\n text: string | string[] | number | number[];\n };\n};\n\nexport type RichTextContent = {\n text?: {\n type: 'rich';\n text: IRichTextCharacter[];\n };\n};\n\n/**\n * html supported @since 0.19.0\n */\nexport type HTMLTextContent = {\n text: {\n type: 'html';\n text: IGraphicStyle['html'];\n };\n _originText: string; // 原始 text,用于预估 bounds\n};\n\n/**\n * react supported @since 0.19.0\n */\nexport type ReactTextContent = {\n text: {\n type: 'react';\n text: IGraphicStyle['react'];\n };\n _originText: string; // 原始 text,用于预估 bounds\n};\n\nexport type TextContent = (CommonTextContent | RichTextContent | HTMLTextContent | ReactTextContent) & {\n /** @deprecated */\n type?: 'text' | 'rich';\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type { IGraphicStyle, IRichTextCharacter } from '@visactor/vrender-core';\n\nexport type Point = {\n x: number;\n y: number;\n};\n\nexport interface LocationCfg {\n [key: string]: any;\n}\n\nexport interface PointLocationCfg extends LocationCfg {\n /**\n * 位置 x\n * @type {number}\n */\n x: number;\n /**\n * 位置 y\n * @type {number}\n */\n y: number;\n}\n\nexport interface RegionLocationCfg extends LocationCfg {\n /**\n * 起始点\n */\n start: Point;\n /**\n * 结束点\n */\n end: Point;\n}\n\nexport type State<T> = {\n [key: string]: T;\n};\n\nexport type BaseGraphicAttributes<T> = {\n /**\n * 基础样式设置\n */\n style?: T;\n /**\n * 状态样式设置\n */\n state?: State<T>;\n};\n\nexport type Padding =\n | number\n | number[]\n | {\n /**\n * 上边距\n */\n top?: number;\n /**\n * 下边距\n */\n bottom?: number;\n /**\n * 左边距\n */\n left?: number;\n /**\n * 右边距\n */\n right?: number;\n };\n\ntype CommonTextContent = {\n text?:\n | string\n | string[]\n | number\n | number[]\n | {\n /**\n * 指定文本节点类型为'text'\n */\n type?: 'text';\n /**\n * 设置文本的内容\n */\n text: string | string[] | number | number[];\n };\n};\n\nexport type RichTextContent = {\n text?: {\n type: 'rich';\n text: IRichTextCharacter[];\n };\n};\n\n/**\n * html supported @since 0.19.0\n */\nexport type HTMLTextContent = {\n text: {\n type: 'html';\n text: IGraphicStyle['html'];\n };\n _originText: string; // 原始 text,用于预估 bounds\n};\n\n/**\n * react supported @since 0.19.0\n */\nexport type ReactTextContent = {\n text: {\n type: 'react';\n text: IGraphicStyle['react'];\n };\n _originText: string; // 原始 text,用于预估 bounds\n};\n\nexport type TextContent = (CommonTextContent | RichTextContent | HTMLTextContent | ReactTextContent) & {\n /** @deprecated */\n type?: 'text' | 'rich';\n};\n"]}
|