@visactor/vchart 2.1.5-alpha.0 → 2.1.5

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.
Files changed (46) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +63 -6
  3. package/build/index.js +105 -100
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/chart/base/base-chart.js +1 -1
  7. package/cjs/chart/base/base-chart.js.map +1 -1
  8. package/cjs/component/legend/discrete/interface.d.ts +9 -1
  9. package/cjs/component/legend/discrete/interface.js.map +1 -1
  10. package/cjs/component/legend/discrete/util.js +12 -2
  11. package/cjs/component/legend/discrete/util.js.map +1 -1
  12. package/cjs/component/marker/interface.d.ts +1 -1
  13. package/cjs/component/marker/interface.js.map +1 -1
  14. package/cjs/component/marker/mark-point/base-mark-point.d.ts +5 -0
  15. package/cjs/component/marker/mark-point/base-mark-point.js +30 -2
  16. package/cjs/component/marker/mark-point/base-mark-point.js.map +1 -1
  17. package/cjs/core/expression-function.js +1 -1
  18. package/cjs/core/factory-registry.js +1 -1
  19. package/cjs/core/factory-registry.js.map +1 -1
  20. package/cjs/core/index.d.ts +1 -1
  21. package/cjs/core/index.js +1 -1
  22. package/cjs/core/index.js.map +1 -1
  23. package/cjs/core/vchart.js +1 -6
  24. package/cjs/core/vchart.js.map +1 -1
  25. package/cjs/data/data-view-utils.js +1 -1
  26. package/esm/chart/base/base-chart.js +1 -1
  27. package/esm/chart/base/base-chart.js.map +1 -1
  28. package/esm/component/legend/discrete/interface.d.ts +9 -1
  29. package/esm/component/legend/discrete/interface.js.map +1 -1
  30. package/esm/component/legend/discrete/util.js +11 -2
  31. package/esm/component/legend/discrete/util.js.map +1 -1
  32. package/esm/component/marker/interface.d.ts +1 -1
  33. package/esm/component/marker/interface.js.map +1 -1
  34. package/esm/component/marker/mark-point/base-mark-point.d.ts +5 -0
  35. package/esm/component/marker/mark-point/base-mark-point.js +34 -2
  36. package/esm/component/marker/mark-point/base-mark-point.js.map +1 -1
  37. package/esm/core/expression-function.js +1 -1
  38. package/esm/core/factory-registry.js +1 -1
  39. package/esm/core/factory-registry.js.map +1 -1
  40. package/esm/core/index.d.ts +1 -1
  41. package/esm/core/index.js +1 -1
  42. package/esm/core/index.js.map +1 -1
  43. package/esm/core/vchart.js +1 -6
  44. package/esm/core/vchart.js.map +1 -1
  45. package/esm/data/data-view-utils.js +1 -1
  46. package/package.json +9 -9
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/legend/discrete/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { IRectMarkSpec, ISymbolMarkSpec, ITextMarkSpec } from '../../../typings/visual';\nimport type {\n DiscreteLegendAttrs,\n LegendItemDatum,\n LegendItem,\n LegendPagerAttributes,\n LegendScrollbarAttributes\n} from '@visactor/vrender-components';\nimport type { ILegendCommonSpec, NoVisibleMarkStyle } from '../interface';\nimport type { IFormatMethod, StringOrNumber } from '../../../typings';\nimport type { ILayoutRect } from '../../../typings/layout';\nimport type { IOrientType } from '../../../typings/space';\nimport type { IBaseScale } from '@visactor/vscale';\nimport type { IGlobalScale } from '../../../scale/interface';\nimport type { ComponentThemeWithDirection } from '../../interface';\n\n// export type formatterCallback = (text: StringOrNumber, item: LegendItemDatum, index: number) => any;\nexport type formatterCallback = IFormatMethod<[text: StringOrNumber, item: LegendItemDatum, index: number]>;\nexport type LegendItemStyleValue<T> =\n | T\n | ((item: LegendItemDatum, isSelected: boolean, index: number, allItems: LegendItemDatum[]) => T);\nexport type LegendItemStyle<T> = {\n /**\n * 样式配置\n */\n style?: T;\n /**\n * 状态样式配置\n */\n state?: {\n /**\n * 选中态\n */\n selected?: T;\n /**\n * 非选中态\n */\n unSelected?: T;\n /**\n * 选中态 hover\n */\n selectedHover?: T;\n /**\n * 非选中态 hover\n */\n unSelectedHover?: T;\n };\n};\n\nexport type IItem = {\n /**\n * @since 1.10.0\n * 指定图例项中图标和文字的摆放位置,可选值为:\n * 'left' 图标在左侧\n * 'right' 图标在右侧\n * 默认值为: 'left'\n */\n align?: 'left' | 'right';\n /**\n * 图例项背景配置\n */\n background?: {\n /**\n * 是否展示图例项背景\n */\n visible?: boolean;\n } & LegendItemStyle<LegendItemStyleValue<NoVisibleMarkStyle<IRectMarkSpec>>>;\n /**\n * 图例项的 shape 图标的配置\n */\n shape?: {\n /**\n * 图例项的 shape 图标\n */\n visible?: boolean;\n /** shape 同后面 label 的间距 */\n space?: number;\n } & LegendItemStyle<LegendItemStyleValue<Partial<NoVisibleMarkStyle<ISymbolMarkSpec>>>>;\n /**\n * 图例项的 label 文本配置\n */\n label?: {\n /**\n * @since 1.10.0\n * 当 label + value 同时展示,文字超长的时候,label的宽度占比\n */\n widthRatio?: number;\n /**\n * 图例项 label 同后面 value 的间距\n */\n space?: number;\n /**\n * 格式化文本函数\n */\n formatMethod?: formatterCallback;\n /**\n * 格式化模板\n * @description 可以通过类似 `{value:.2f}%` 的形式对指定数据字段进行格式化\n * @since 1.10.0\n */\n formatter?: string;\n } & LegendItemStyle<LegendItemStyleValue<NoVisibleMarkStyle<ITextMarkSpec>>>;\n /**\n * 图例项 value 配置\n */\n value?: {\n /**\n * @since 1.10.0\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 /**\n * 格式化模板\n * @description 可以通过类似 `{value:.2f}%` 的形式对指定数据字段进行格式化\n * @since 1.10.0\n */\n formatter?: string | string[];\n } & LegendItemStyle<LegendItemStyleValue<NoVisibleMarkStyle<ITextMarkSpec>>>;\n /**\n * 聚焦按钮配置\n */\n focusIconStyle?: NoVisibleMarkStyle<ISymbolMarkSpec>;\n /**\n * 图例项的最大宽度,默认为 null。\n * 可使用百分比,表示显示区域的宽度占比。\n */\n maxWidth?: number | string;\n /**\n * 图例项的宽度, 默认自动计算。\n * 可使用百分比,表示显示区域的宽度占比。\n */\n width?: number | string;\n /**\n * 图例的高度,默认自动计算。\n * 可使用百分比,表示显示区域的高度占比。\n */\n height?: number | string;\n /**\n * @since 1.10.0\n * 当label+ value同时存在的时候,自动省略的策略\n * 'labelFirst' - 尽量保证完整展示`label`\n * 'valueFirst' - 尽量保证完整展示`value`\n * 'none' - 按照`widthRatio`展示label 和 value\n */\n autoEllipsisStrategy?: 'labelFirst' | 'valueFirst' | 'none';\n} & Omit<LegendItem, 'background' | 'shape' | 'label' | 'value' | 'focusIconStyle' | 'width' | 'height' | 'maxWidth'>;\n\nexport type IPager = {\n /**\n * 文本样式配置\n */\n textStyle?: Partial<NoVisibleMarkStyle<ITextMarkSpec>>;\n handler?: {\n /**\n * 按钮同文本内容区的间距,默认为 8\n */\n space?: number;\n /**\n * 上一页按钮形状\n */\n preShape?: string;\n /**\n * 下一页按钮形状\n */\n nextShape?: string;\n style?: Omit<NoVisibleMarkStyle<ISymbolMarkSpec>, 'symbolType'>;\n state?: {\n /**\n * hover 状态下的样式\n */\n hover?: Omit<NoVisibleMarkStyle<ISymbolMarkSpec>, 'symbolType'>;\n /**\n * 不可用状态样式\n */\n disable?: Omit<NoVisibleMarkStyle<ISymbolMarkSpec>, 'symbolType'>;\n };\n };\n} & Omit<LegendPagerAttributes, 'textStyle' | 'handler'>;\n\nexport type ILegendScrollbar = {\n type: 'scrollbar';\n railStyle?: Omit<Partial<NoVisibleMarkStyle<IRectMarkSpec>>, 'width' | 'height'>;\n sliderStyle?: Omit<Partial<NoVisibleMarkStyle<IRectMarkSpec>>, 'width' | 'height'>;\n} & Omit<LegendScrollbarAttributes, 'railStyle' | 'sliderStyle'>;\n\n/** spec */\n/**\n * The layout context passed to a `maxRow` / `maxCol` callback. The callback is evaluated during\n * layout, so the row / column count can be derived from the space actually allocated to the legend.\n * @since 2.0.23\n */\nexport interface IDiscreteLegendArrangeContext {\n /** the layout rect allocated to the legend in the current layout */\n rect: ILayoutRect;\n /** the resolved orient the legend lays out with (defaults to `'left'` when `spec.orient` is unset) */\n orient: IOrientType;\n /** the id of the legend */\n id?: StringOrNumber;\n}\n\n/**\n * The max row / col count of a discrete legend. Either a fixed number, or a callback that returns a\n * number, evaluated during layout against {@link IDiscreteLegendArrangeContext}.\n */\nexport type DiscreteLegendArrangeCount = number | ((ctx: IDiscreteLegendArrangeContext) => number);\n\nexport type IDiscreteLegendSpec = ILegendCommonSpec & {\n type?: 'discrete';\n /**\n * 在原始图例绘制数据的基础上,进行自定义,比如可以自定义 value 值\n * @param data 图例的绘制数据\n * @param colorScale 全局颜色映射 scale\n * @param globalScale 图表上所有的 scale\n * @returns\n */\n data?: (data: LegendItemDatum[], colorScale: IBaseScale, globalScale: IGlobalScale) => LegendItemDatum[];\n\n /** 图例项配置 */\n item?: IItem;\n\n /**\n * 翻页器配置\n */\n pager?: IPager | ILegendScrollbar;\n /**\n * scale must match the id of the scale configured in **scales**\n * 离散图例对应的scale\n * @since 1.10.5\n */\n scale?: string;\n /**\n * 同`scale`,为了和连续图例保持一致,建议统一为`scale`\n */\n scaleName?: string;\n /**\n * After the legend is bound to the scale, the dimension associated with the series data and the legend can be configured through field.\n * If the field is not configured, the first item of fields in the domain of scale is used by default\n * If the domain of the scale is not dependent on data statistics, series.getSeriesField() is used by default\n */\n field?: string;\n /**\n * 默认筛选的数据范围\n */\n defaultSelected?: string[];\n /**\n * The maximum number of rows displayed (for horizontal legend). Besides a fixed number, a\n * callback `(ctx) => number` is also supported, which is evaluated during layout so the row\n * count can adapt to the space allocated to the legend.\n * @since 2.0.23\n */\n maxRow?: DiscreteLegendArrangeCount;\n /**\n * The maximum number of columns displayed (for vertical legend). Besides a fixed number, a\n * callback `(ctx) => number` is also supported (see {@link maxRow}).\n * @since 2.0.23\n */\n maxCol?: DiscreteLegendArrangeCount;\n} & Omit<DiscreteLegendAttrs, 'layout' | 'title' | 'items' | 'item' | 'pager' | 'maxRow' | 'maxCol'>;\n\n// theme 主题相关配置\nexport type IDiscreteLegendCommonTheme = Omit<\n IDiscreteLegendSpec,\n 'type' | 'data' | 'regionIndex' | 'regionId' | 'seriesIndex' | 'seriesId' | 'id' | 'defaultSelected'\n>;\n\nexport type IDiscreteLegendTheme = ComponentThemeWithDirection<IDiscreteLegendCommonTheme>;\n"]}
1
+ {"version":3,"sources":["../src/component/legend/discrete/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { IRectMarkSpec, ISymbolMarkSpec, ITextMarkSpec } from '../../../typings/visual';\nimport type {\n DiscreteLegendAttrs,\n LegendItemDatum,\n LegendItem,\n LegendPagerAttributes,\n LegendScrollbarAttributes\n} from '@visactor/vrender-components';\nimport type { ILegendCommonSpec, NoVisibleMarkStyle } from '../interface';\nimport type { IFormatMethod, StringOrNumber } from '../../../typings';\nimport type { ILayoutRect } from '../../../typings/layout';\nimport type { IOrientType } from '../../../typings/space';\nimport type { IBaseScale } from '@visactor/vscale';\nimport type { IGlobalScale } from '../../../scale/interface';\nimport type { ComponentThemeWithDirection } from '../../interface';\n\n// export type formatterCallback = (text: StringOrNumber, item: LegendItemDatum, index: number) => any;\nexport type formatterCallback = IFormatMethod<[text: StringOrNumber, item: LegendItemDatum, index: number]>;\nexport type LegendItemStyleValue<T> =\n | T\n | ((item: LegendItemDatum, isSelected: boolean, index: number, allItems: LegendItemDatum[]) => T);\nexport type LegendItemStyle<T> = {\n /**\n * 样式配置\n */\n style?: T;\n /**\n * 状态样式配置\n */\n state?: {\n /**\n * 选中态\n */\n selected?: T;\n /**\n * 非选中态\n */\n unSelected?: T;\n /**\n * 选中态 hover\n */\n selectedHover?: T;\n /**\n * 非选中态 hover\n */\n unSelectedHover?: T;\n };\n};\n\nexport type IItem = {\n /**\n * @since 1.10.0\n * 指定图例项中图标和文字的摆放位置,可选值为:\n * 'left' 图标在左侧\n * 'right' 图标在右侧\n * 默认值为: 'left'\n */\n align?: 'left' | 'right';\n /**\n * 图例项背景配置\n */\n background?: {\n /**\n * 是否展示图例项背景\n */\n visible?: boolean;\n } & LegendItemStyle<LegendItemStyleValue<NoVisibleMarkStyle<IRectMarkSpec>>>;\n /**\n * 图例项的 shape 图标的配置\n */\n shape?: {\n /**\n * 图例项的 shape 图标\n */\n visible?: boolean;\n /** shape 同后面 label 的间距 */\n space?: number;\n } & LegendItemStyle<LegendItemStyleValue<Partial<NoVisibleMarkStyle<ISymbolMarkSpec>>>>;\n /**\n * 图例项的 label 文本配置\n */\n label?: {\n /**\n * @since 1.10.0\n * 当 label + value 同时展示,文字超长的时候,label的宽度占比\n */\n widthRatio?: number;\n /**\n * 图例项 label 同后面 value 的间距\n */\n space?: number;\n /**\n * 格式化文本函数\n */\n formatMethod?: formatterCallback;\n /**\n * 格式化模板\n * @description 可以通过类似 `{value:.2f}%` 的形式对指定数据字段进行格式化\n * @since 1.10.0\n */\n formatter?: string;\n } & LegendItemStyle<LegendItemStyleValue<NoVisibleMarkStyle<ITextMarkSpec>>>;\n /**\n * 图例项 value 配置\n */\n value?: {\n /**\n * @since 1.10.0\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 /**\n * 格式化模板\n * @description 可以通过类似 `{value:.2f}%` 的形式对指定数据字段进行格式化\n * @since 1.10.0\n */\n formatter?: string | string[];\n } & LegendItemStyle<LegendItemStyleValue<NoVisibleMarkStyle<ITextMarkSpec>>>;\n /**\n * 聚焦按钮配置\n */\n focusIconStyle?: NoVisibleMarkStyle<ISymbolMarkSpec>;\n /**\n * 图例项的最大宽度,默认为 null。\n * 可使用百分比,表示显示区域的宽度占比。\n */\n maxWidth?: number | string;\n /**\n * 图例项的宽度, 默认自动计算。\n * 可使用百分比,表示显示区域的宽度占比。\n */\n width?: number | string;\n /**\n * 图例的高度,默认自动计算。\n * 可使用百分比,表示显示区域的高度占比。\n */\n height?: number | string;\n /**\n * @since 1.10.0\n * 当label+ value同时存在的时候,自动省略的策略\n * 'labelFirst' - 尽量保证完整展示`label`\n * 'valueFirst' - 尽量保证完整展示`value`\n * 'none' - 按照`widthRatio`展示label 和 value\n */\n autoEllipsisStrategy?: 'labelFirst' | 'valueFirst' | 'none';\n} & Omit<LegendItem, 'background' | 'shape' | 'label' | 'value' | 'focusIconStyle' | 'width' | 'height' | 'maxWidth'>;\n\nexport type LegendPagerLayout = 'horizontal' | 'vertical';\nexport type LegendPagerPosition = 'start' | 'middle' | 'end';\n\nexport type IPager = {\n /**\n * 文本样式配置\n */\n textStyle?: Partial<NoVisibleMarkStyle<ITextMarkSpec>>;\n handler?: {\n /**\n * 按钮同文本内容区的间距,默认为 8\n */\n space?: number;\n /**\n * 上一页按钮形状\n */\n preShape?: string;\n /**\n * 下一页按钮形状\n */\n nextShape?: string;\n style?: Omit<NoVisibleMarkStyle<ISymbolMarkSpec>, 'symbolType'>;\n state?: {\n /**\n * hover 状态下的样式\n */\n hover?: Omit<NoVisibleMarkStyle<ISymbolMarkSpec>, 'symbolType'>;\n /**\n * 不可用状态样式\n */\n disable?: Omit<NoVisibleMarkStyle<ISymbolMarkSpec>, 'symbolType'>;\n };\n };\n /**\n * The layout of the pager. A callback is evaluated during layout after `maxRow` / `maxCol`\n * have been resolved, allowing the pager handlers to adapt to a multi-row / multi-column legend.\n * @since 2.2.0\n */\n layout?: LegendPagerLayout | ((ctx: IDiscreteLegendPagerCallbackContext) => LegendPagerLayout);\n /**\n * The cross-axis position of the pager. A callback is evaluated during layout after `maxRow` /\n * `maxCol` have been resolved, allowing the pager alignment to adapt to the resolved page layout.\n * @since 2.2.0\n */\n position?: LegendPagerPosition | ((ctx: IDiscreteLegendPagerCallbackContext) => LegendPagerPosition);\n} & Omit<LegendPagerAttributes, 'textStyle' | 'handler' | 'layout' | 'position'>;\n\nexport type ILegendScrollbar = {\n type: 'scrollbar';\n railStyle?: Omit<Partial<NoVisibleMarkStyle<IRectMarkSpec>>, 'width' | 'height'>;\n sliderStyle?: Omit<Partial<NoVisibleMarkStyle<IRectMarkSpec>>, 'width' | 'height'>;\n} & Omit<LegendScrollbarAttributes, 'railStyle' | 'sliderStyle'>;\n\n/** spec */\n/**\n * The layout context passed to a `maxRow` / `maxCol` callback. The callback is evaluated during\n * layout, so the row / column count can be derived from the space actually allocated to the legend.\n * @since 2.0.23\n */\nexport interface IDiscreteLegendArrangeContext {\n /** the layout rect allocated to the legend in the current layout */\n rect: ILayoutRect;\n /** the resolved orient the legend lays out with (defaults to `'left'` when `spec.orient` is unset) */\n orient: IOrientType;\n /** the id of the legend */\n id?: StringOrNumber;\n}\n\n/**\n * The layout context passed to `pager.layout` and `pager.position` callbacks.\n * @since 2.2.0\n */\nexport interface IDiscreteLegendPagerCallbackContext extends IDiscreteLegendArrangeContext {\n /** the resolved maximum row count, when configured */\n maxRow?: number;\n /** the resolved maximum column count, when configured */\n maxCol?: number;\n}\n\n/**\n * The max row / col count of a discrete legend. Either a fixed number, or a callback that returns a\n * number, evaluated during layout against {@link IDiscreteLegendArrangeContext}.\n */\nexport type DiscreteLegendArrangeCount = number | ((ctx: IDiscreteLegendArrangeContext) => number);\n\nexport type IDiscreteLegendSpec = ILegendCommonSpec & {\n type?: 'discrete';\n /**\n * 在原始图例绘制数据的基础上,进行自定义,比如可以自定义 value 值\n * @param data 图例的绘制数据\n * @param colorScale 全局颜色映射 scale\n * @param globalScale 图表上所有的 scale\n * @returns\n */\n data?: (data: LegendItemDatum[], colorScale: IBaseScale, globalScale: IGlobalScale) => LegendItemDatum[];\n\n /** 图例项配置 */\n item?: IItem;\n\n /**\n * 翻页器配置\n */\n pager?: IPager | ILegendScrollbar;\n /**\n * scale must match the id of the scale configured in **scales**\n * 离散图例对应的scale\n * @since 1.10.5\n */\n scale?: string;\n /**\n * 同`scale`,为了和连续图例保持一致,建议统一为`scale`\n */\n scaleName?: string;\n /**\n * After the legend is bound to the scale, the dimension associated with the series data and the legend can be configured through field.\n * If the field is not configured, the first item of fields in the domain of scale is used by default\n * If the domain of the scale is not dependent on data statistics, series.getSeriesField() is used by default\n */\n field?: string;\n /**\n * 默认筛选的数据范围\n */\n defaultSelected?: string[];\n /**\n * The maximum number of rows displayed (for horizontal legend). Besides a fixed number, a\n * callback `(ctx) => number` is also supported, which is evaluated during layout so the row\n * count can adapt to the space allocated to the legend.\n * @since 2.0.23\n */\n maxRow?: DiscreteLegendArrangeCount;\n /**\n * The maximum number of columns displayed (for vertical legend). Besides a fixed number, a\n * callback `(ctx) => number` is also supported (see {@link maxRow}).\n * @since 2.0.23\n */\n maxCol?: DiscreteLegendArrangeCount;\n} & Omit<DiscreteLegendAttrs, 'layout' | 'title' | 'items' | 'item' | 'pager' | 'maxRow' | 'maxCol'>;\n\n// theme 主题相关配置\nexport type IDiscreteLegendCommonTheme = Omit<\n IDiscreteLegendSpec,\n 'type' | 'data' | 'regionIndex' | 'regionId' | 'seriesIndex' | 'seriesId' | 'id' | 'defaultSelected'\n>;\n\nexport type IDiscreteLegendTheme = ComponentThemeWithDirection<IDiscreteLegendCommonTheme>;\n"]}
@@ -42,8 +42,9 @@ function getLegendAttributes(spec, rect, layoutOrient) {
42
42
  let {title: title = {}, item: item = {}, pager: pager = {}, background: background = {}} = spec;
43
43
  title = (0, vutils_1.cloneDeep)(title), item = (0, vutils_1.cloneDeep)(item), pager = (0,
44
44
  vutils_1.cloneDeep)(pager), background = (0, vutils_1.cloneDeep)(background);
45
- const attrs = restSpec;
46
- if ((0, vutils_1.isFunction)(attrs.maxRow) || (0, vutils_1.isFunction)(attrs.maxCol)) {
45
+ const attrs = restSpec, pagerLayout = pager.layout, pagerPosition = pager.position;
46
+ if ((0, vutils_1.isFunction)(attrs.maxRow) || (0, vutils_1.isFunction)(attrs.maxCol) || (0,
47
+ vutils_1.isFunction)(pagerLayout) || (0, vutils_1.isFunction)(pagerPosition)) {
47
48
  const resolvedOrient = (0, space_1.isValidOrient)(layoutOrient) ? layoutOrient : (0,
48
49
  space_1.isValidOrient)(orient) ? orient : "left";
49
50
  (0, vutils_1.isFunction)(attrs.maxRow) && (attrs.maxRow = attrs.maxRow({
@@ -55,6 +56,15 @@ function getLegendAttributes(spec, rect, layoutOrient) {
55
56
  orient: resolvedOrient,
56
57
  id: id
57
58
  }));
59
+ const isArrowPager = "scrollbar" !== pager.type, pagerContext = {
60
+ rect: rect,
61
+ orient: resolvedOrient,
62
+ id: id,
63
+ maxRow: attrs.maxRow,
64
+ maxCol: attrs.maxCol
65
+ };
66
+ isArrowPager && (0, vutils_1.isFunction)(pagerLayout) && (pager.layout = pagerLayout(pagerContext)),
67
+ isArrowPager && (0, vutils_1.isFunction)(pagerPosition) && (pager.position = pagerPosition(pagerContext));
58
68
  }
59
69
  return title.visible ? attrs.title = (0, util_1.transformLegendTitleAttributes)(title) : attrs.title = {
60
70
  visible: !1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/legend/discrete/util.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,6CAA2E;AAC3E,+CAA+D;AAC/D,iEAAuD;AACvD,+CAAkF;AAClF,kCAAyD;AAKzD,SAAS,gCAAgC,CAAC,KAAU;IAClD,IAAI,CAAC,IAAA,gBAAO,EAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,CAAC,EAAE;QAC5B,OAAO,KAAK,CAAC;KACd;IAED,uCACK,KAAK,KACR,cAAc,EAAE,IAAA,gBAAO,EAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EACxE,WAAW,EAAE,IAAA,gBAAO,EAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAC/D;AACJ,CAAC;AAED,SAAS,iCAAiC,CAAC,KAAU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AAG,KAAK,CAAC;IAEpB,IAAI,UAAU,CAAC,OAAO,IAAI,CAAC,IAAA,gBAAO,EAAC,UAAU,CAAC,KAAK,CAAC,EAAE;QACpD,IAAA,4BAAS,EAAC,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;QACnC,IAAI,IAAA,gBAAO,EAAC,UAAU,CAAC,OAAO,CAAC,EAAE;YAC/B,KAAK,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;SACpC;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AArHD,kDAqHC","file":"util.js","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { cloneDeep, isEmpty, isFunction, isValid } from '@visactor/vutils';\nimport { isPercent, isValidOrient } from '../../../util/space';\nimport { mergeSpec } from '@visactor/vutils-extension';\nimport { transformComponentStyle, transformToGraphic } from '../../../util/style';\nimport { transformLegendTitleAttributes } from '../util';\nimport type { IDiscreteLegendSpec, ILegendScrollbar, IPager } from './interface';\nimport type { ILayoutRect } from '../../../typings/layout';\nimport type { IOrientType } from '../../../typings/space';\n\nfunction normalizeLegendShapeTextureStyle(style: any) {\n if (!isValid(style?.texture)) {\n return style;\n }\n\n return {\n ...style,\n texturePadding: isValid(style.texturePadding) ? style.texturePadding : 1,\n textureSize: isValid(style.textureSize) ? style.textureSize : 4\n };\n}\n\nfunction normalizeLegendShapeTextureConfig(shape: any) {\n const normalizeStyle = (style: any) => normalizeLegendShapeTextureStyle(style);\n\n if (isFunction(shape.style)) {\n const style = shape.style;\n shape.style = (...args: any[]) => normalizeStyle(style(...args));\n } else if (!isEmpty(shape.style)) {\n shape.style = normalizeStyle(shape.style);\n }\n\n if (!isEmpty(shape.state)) {\n Object.keys(shape.state).forEach(key => {\n if (isFunction(shape.state[key])) {\n const stateStyle = shape.state[key];\n shape.state[key] = (...args: any[]) => normalizeStyle(stateStyle(...args));\n } else if (!isEmpty(shape.state[key])) {\n shape.state[key] = normalizeStyle(shape.state[key]);\n }\n });\n }\n\n return shape;\n}\n\nexport function getLegendAttributes(spec: IDiscreteLegendSpec, rect: ILayoutRect, layoutOrient?: IOrientType) {\n const {\n title: titleSpec = {},\n item: itemSpec = {},\n pager: pagerSpec = {},\n background: backgroundSpec = {},\n // 以下不属于 legend 需要的属性,单独拿出来以免污染传递给组件的属性\n type,\n id,\n visible,\n orient,\n position,\n data,\n filter,\n regionId,\n regionIndex,\n seriesIndex,\n seriesId,\n padding, // vchart 布局模块已经处理了\n\n ...restSpec\n } = spec;\n\n let {\n // 需要进行样式转换的属性\n title = {},\n item = {},\n pager = {},\n background = {}\n } = spec;\n // 需要进行深拷贝,否则会影响到 spec 中的原始数据\n title = cloneDeep(title);\n item = cloneDeep(item);\n pager = cloneDeep(pager);\n background = cloneDeep(background);\n\n const attrs: any = restSpec;\n\n // `maxRow` / `maxCol` may be a callback, evaluated here during layout against the legend's\n // available `rect` so the row / column count can adapt to the space (e.g. allow more rows on\n // a tall-and-narrow legend). The callback receives the layout context and returns a number.\n // Use the layout-resolved orient (falling back to the spec orient default rule) so the callback\n // sees the orient the legend actually lays out with, not the raw `spec.orient` which is\n // `undefined` when the user omits it.\n if (isFunction(attrs.maxRow) || isFunction(attrs.maxCol)) {\n const resolvedOrient = isValidOrient(layoutOrient) ? layoutOrient : isValidOrient(orient) ? orient : 'left';\n if (isFunction(attrs.maxRow)) {\n attrs.maxRow = attrs.maxRow({ rect, orient: resolvedOrient, id });\n }\n if (isFunction(attrs.maxCol)) {\n attrs.maxCol = attrs.maxCol({ rect, orient: resolvedOrient, id });\n }\n }\n\n // transform title\n if (title.visible) {\n attrs.title = transformLegendTitleAttributes(title);\n } else {\n attrs.title = { visible: false };\n }\n\n // transform item\n if (!isEmpty(item.focusIconStyle)) {\n transformToGraphic(item.focusIconStyle);\n }\n if (item.shape) {\n item.shape = normalizeLegendShapeTextureConfig(transformComponentStyle(item.shape));\n }\n if (item.label) {\n item.label = transformComponentStyle(item.label);\n }\n if (item.value) {\n item.value = transformComponentStyle(item.value);\n }\n if (item.background) {\n item.background = transformComponentStyle(item.background);\n }\n\n if (isPercent(item.maxWidth)) {\n item.maxWidth = (Number(item.maxWidth.substring(0, item.maxWidth.length - 1)) * rect.width) / 100;\n }\n if (isPercent(item.width)) {\n item.width = (Number(item.width.substring(0, item.width.length - 1)) * rect.width) / 100;\n }\n if (isPercent(item.height)) {\n item.height = (Number(item.height.substring(0, item.height.length - 1)) * rect.width) / 100;\n }\n attrs.item = item;\n\n if ((pager as ILegendScrollbar).type === 'scrollbar') {\n if (!isEmpty((pager as ILegendScrollbar).railStyle)) {\n transformToGraphic((pager as ILegendScrollbar).railStyle);\n }\n if (!isEmpty((pager as ILegendScrollbar).sliderStyle)) {\n transformToGraphic((pager as ILegendScrollbar).sliderStyle);\n }\n } else {\n // transform pager\n if (!isEmpty((pager as IPager).textStyle)) {\n transformToGraphic((pager as IPager).textStyle);\n }\n\n if ((pager as IPager).handler) {\n transformComponentStyle((pager as IPager).handler);\n }\n }\n\n attrs.pager = pager;\n\n if (background.visible && !isEmpty(background.style)) {\n mergeSpec(attrs, background.style);\n if (isValid(background.padding)) {\n attrs.padding = background.padding;\n }\n }\n\n return attrs;\n}\n"]}
1
+ {"version":3,"sources":["../src/component/legend/discrete/util.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,6CAA2E;AAC3E,+CAA+D;AAC/D,iEAAuD;AACvD,+CAAkF;AAClF,kCAAyD;AAKzD,SAAS,gCAAgC,CAAC,KAAU;IAClD,IAAI,CAAC,IAAA,gBAAO,EAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,CAAC,EAAE;QAC5B,OAAO,KAAK,CAAC;KACd;IAED,uCACK,KAAK,KACR,cAAc,EAAE,IAAA,gBAAO,EAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EACxE,WAAW,EAAE,IAAA,gBAAO,EAAC,KAAK,CAAC,WAAW,C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AC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC;KAC7F;IACD,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;IAElB,IAAK,KAA0B,CAAC,IAAI,KAAK,WAAW,EAAE;QACpD,IAAI,CAAC,IAAA,gBAAO,EAAE,KAA0B,CAAC,SAAS,CAAC,EAAE;YACnD,IAAA,0BAAkB,EAAE,KAA0B,CAAC,SAAS,CAAC,CAAC;SAC3D;QACD,IAAI,CAAC,IAAA,gBAAO,EAAE,KAA0B,CAAC,WAAW,CAAC,EAAE;YACrD,IAAA,0BAAkB,EAAE,KAA0B,CAAC,WAAW,CAAC,CAAC;SAC7D;KACF;SAAM;QAEL,IAAI,CAAC,IAAA,gBAAO,EAAE,KAAgB,CAAC,SAAS,CAAC,EAAE;YACzC,IAAA,0BAAkB,EAAE,KAAgB,CAAC,SAAS,CAAC,CAAC;SACjD;QAED,IAAK,KAAgB,CAAC,OAAO,EAAE;YAC7B,IAAA,+BAAuB,EAAE,KAAgB,CAAC,OAAO,CAAC,CAAC;SACpD;KACF;IAED,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;IAEpB,IAAI,UAAU,CAAC,OAAO,IAAI,CAAC,IAAA,gBAAO,EAAC,UAAU,CAAC,KAAK,CAAC,EAAE;QACpD,IAAA,4BAAS,EAAC,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;QACnC,IAAI,IAAA,gBAAO,EAAC,UAAU,CAAC,OAAO,CAAC,EAAE;YAC/B,KAAK,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;SACpC;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAtID,kDAsIC","file":"util.js","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { cloneDeep, isEmpty, isFunction, isValid } from '@visactor/vutils';\nimport { isPercent, isValidOrient } from '../../../util/space';\nimport { mergeSpec } from '@visactor/vutils-extension';\nimport { transformComponentStyle, transformToGraphic } from '../../../util/style';\nimport { transformLegendTitleAttributes } from '../util';\nimport type { IDiscreteLegendPagerCallbackContext, IDiscreteLegendSpec, ILegendScrollbar, IPager } from './interface';\nimport type { ILayoutRect } from '../../../typings/layout';\nimport type { IOrientType } from '../../../typings/space';\n\nfunction normalizeLegendShapeTextureStyle(style: any) {\n if (!isValid(style?.texture)) {\n return style;\n }\n\n return {\n ...style,\n texturePadding: isValid(style.texturePadding) ? style.texturePadding : 1,\n textureSize: isValid(style.textureSize) ? style.textureSize : 4\n };\n}\n\nfunction normalizeLegendShapeTextureConfig(shape: any) {\n const normalizeStyle = (style: any) => normalizeLegendShapeTextureStyle(style);\n\n if (isFunction(shape.style)) {\n const style = shape.style;\n shape.style = (...args: any[]) => normalizeStyle(style(...args));\n } else if (!isEmpty(shape.style)) {\n shape.style = normalizeStyle(shape.style);\n }\n\n if (!isEmpty(shape.state)) {\n Object.keys(shape.state).forEach(key => {\n if (isFunction(shape.state[key])) {\n const stateStyle = shape.state[key];\n shape.state[key] = (...args: any[]) => normalizeStyle(stateStyle(...args));\n } else if (!isEmpty(shape.state[key])) {\n shape.state[key] = normalizeStyle(shape.state[key]);\n }\n });\n }\n\n return shape;\n}\n\nexport function getLegendAttributes(spec: IDiscreteLegendSpec, rect: ILayoutRect, layoutOrient?: IOrientType) {\n const {\n title: titleSpec = {},\n item: itemSpec = {},\n pager: pagerSpec = {},\n background: backgroundSpec = {},\n // 以下不属于 legend 需要的属性,单独拿出来以免污染传递给组件的属性\n type,\n id,\n visible,\n orient,\n position,\n data,\n filter,\n regionId,\n regionIndex,\n seriesIndex,\n seriesId,\n padding, // vchart 布局模块已经处理了\n\n ...restSpec\n } = spec;\n\n let {\n // 需要进行样式转换的属性\n title = {},\n item = {},\n pager = {},\n background = {}\n } = spec;\n // 需要进行深拷贝,否则会影响到 spec 中的原始数据\n title = cloneDeep(title);\n item = cloneDeep(item);\n pager = cloneDeep(pager);\n background = cloneDeep(background);\n\n const attrs: any = restSpec;\n\n // `maxRow` / `maxCol` may be a callback, evaluated here during layout against the legend's\n // available `rect` so the row / column count can adapt to the space (e.g. allow more rows on\n // a tall-and-narrow legend). The callback receives the layout context and returns a number.\n // Use the layout-resolved orient (falling back to the spec orient default rule) so the callback\n // sees the orient the legend actually lays out with, not the raw `spec.orient` which is\n // `undefined` when the user omits it.\n const pagerLayout = (pager as IPager).layout;\n const pagerPosition = (pager as IPager).position;\n if (isFunction(attrs.maxRow) || isFunction(attrs.maxCol) || isFunction(pagerLayout) || isFunction(pagerPosition)) {\n const resolvedOrient = isValidOrient(layoutOrient) ? layoutOrient : isValidOrient(orient) ? orient : 'left';\n if (isFunction(attrs.maxRow)) {\n attrs.maxRow = attrs.maxRow({ rect, orient: resolvedOrient, id });\n }\n if (isFunction(attrs.maxCol)) {\n attrs.maxCol = attrs.maxCol({ rect, orient: resolvedOrient, id });\n }\n // `layout` / `position` callbacks only apply to the arrow pager, not the scrollbar.\n const isArrowPager = (pager as ILegendScrollbar).type !== 'scrollbar';\n const pagerContext: IDiscreteLegendPagerCallbackContext = {\n rect,\n orient: resolvedOrient,\n id,\n maxRow: attrs.maxRow,\n maxCol: attrs.maxCol\n };\n if (isArrowPager && isFunction(pagerLayout)) {\n (pager as IPager).layout = pagerLayout(pagerContext);\n }\n if (isArrowPager && isFunction(pagerPosition)) {\n (pager as IPager).position = pagerPosition(pagerContext);\n }\n }\n\n // transform title\n if (title.visible) {\n attrs.title = transformLegendTitleAttributes(title);\n } else {\n attrs.title = { visible: false };\n }\n\n // transform item\n if (!isEmpty(item.focusIconStyle)) {\n transformToGraphic(item.focusIconStyle);\n }\n if (item.shape) {\n item.shape = normalizeLegendShapeTextureConfig(transformComponentStyle(item.shape));\n }\n if (item.label) {\n item.label = transformComponentStyle(item.label);\n }\n if (item.value) {\n item.value = transformComponentStyle(item.value);\n }\n if (item.background) {\n item.background = transformComponentStyle(item.background);\n }\n\n if (isPercent(item.maxWidth)) {\n item.maxWidth = (Number(item.maxWidth.substring(0, item.maxWidth.length - 1)) * rect.width) / 100;\n }\n if (isPercent(item.width)) {\n item.width = (Number(item.width.substring(0, item.width.length - 1)) * rect.width) / 100;\n }\n if (isPercent(item.height)) {\n item.height = (Number(item.height.substring(0, item.height.length - 1)) * rect.width) / 100;\n }\n attrs.item = item;\n\n if ((pager as ILegendScrollbar).type === 'scrollbar') {\n if (!isEmpty((pager as ILegendScrollbar).railStyle)) {\n transformToGraphic((pager as ILegendScrollbar).railStyle);\n }\n if (!isEmpty((pager as ILegendScrollbar).sliderStyle)) {\n transformToGraphic((pager as ILegendScrollbar).sliderStyle);\n }\n } else {\n // transform pager\n if (!isEmpty((pager as IPager).textStyle)) {\n transformToGraphic((pager as IPager).textStyle);\n }\n\n if ((pager as IPager).handler) {\n transformComponentStyle((pager as IPager).handler);\n }\n }\n\n attrs.pager = pager;\n\n if (background.visible && !isEmpty(background.style)) {\n mergeSpec(attrs, background.style);\n if (isValid(background.padding)) {\n attrs.padding = background.padding;\n }\n }\n\n return attrs;\n}\n"]}
@@ -101,7 +101,7 @@ export type IMarkerSymbol = IMarkerRef & {
101
101
  } & Partial<IMarkerState<Omit<ISymbolMarkSpec, 'visible'>>>;
102
102
  export type MarkerStyleCallback<T> = (markerData: DataView, context: IMarkerAttributeContext) => T;
103
103
  export type MarkerStateCallback<T> = (markerData: DataView, context: IMarkerAttributeContext) => T;
104
- export type MarkerStateValue = 'hover' | 'hover_reverse' | 'selected' | 'selected_reverse';
104
+ export type MarkerStateValue = 'hover' | 'hover_reverse' | 'dimension_hover' | 'dimension_hover_reverse' | 'selected' | 'selected_reverse';
105
105
  export type IMarkerState<T> = {
106
106
  style?: T | MarkerStyleCallback<T>;
107
107
  state?: Record<MarkerStateValue, T | MarkerStateCallback<T>>;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/marker/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { DataView } from '@visactor/vdataset';\nimport type { IPadding } from '@visactor/vutils';\nimport type {\n SymbolType,\n IGraphicAttribute,\n ICustomPath2D,\n ITextGraphicAttribute,\n IRichTextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type {\n IComposedTextMarkSpec,\n IFormatMethod,\n IRectMarkSpec,\n IRichTextFormatMethod,\n ISymbolMarkSpec,\n StringOrNumber\n} from '../../typings';\nimport type { IComponentSpec } from '../base/interface';\nimport type { Datum } from '@visactor/vrender-components';\nimport type { ICartesianSeries, IGeoSeries, IPolarSeries } from '../../series/interface';\nimport type {\n IOptionAggr,\n IOptionAggrField,\n IOptionRegr,\n IOptionSeries,\n IOptionWithCoordinates\n} from '../../data/transforms/interface';\nimport type { IVChart } from '../../core/interface';\n\nexport type IMarkerSupportSeries = ICartesianSeries | IPolarSeries | IGeoSeries;\n\nexport type IPolarPoint = {\n angle: number;\n radius: number;\n};\nexport type OffsetPoint = {\n /**\n * x 方向的偏移\n * 1. number 类型表示像素值,如 12\n * 2. string 类型表示百分比,如 '10%' 表示相对于所在 region 宽度的占比\n */\n x?: number | string;\n /**\n * y 方向的偏移\n * 1. number 类型表示像素值,如 12\n * 2. string 类型表示百分比,如 '10%' 表示相对于所在 region 高度的占比\n */\n y?: number | string;\n};\n\nexport type IAggrType = 'sum' | 'average' | 'min' | 'max' | 'variance' | 'standardDeviation' | 'median';\nexport type IDataPos = StringOrNumber | IAggrType;\nexport type IDataPosCallback = (\n relativeSeriesData: Datum[],\n startRelativeSeriesData: Datum[],\n endRelativeSeriesData: Datum[],\n relativeSeries: IMarkerSupportSeries,\n startRelativeSeries: IMarkerSupportSeries,\n endRelativeSeries: IMarkerSupportSeries\n) => StringOrNumber;\n\nexport type IDataPointSpec = {\n /**\n * 数据字段配置\n */\n [key: string]: IDataPos | IDataPosCallback;\n /**\n * 具体某个数据元素关联的series序号(仅在标注目标:数据元素下有效)\n */\n refRelativeSeriesIndex?: number;\n /**\n * 具体某个数据元素关联的series 的id(仅在标注目标:数据元素下有效)\n */\n refRelativeSeriesId?: StringOrNumber;\n /**\n * 指定使用 xField 上的那个维度索引,因为 xField 字段有可能会包含多个维度,比如分组场景\n * @default 0\n * @since 1.7.0\n */\n xFieldIndex?: number;\n /**\n * 指定使用 xField 上的维度名称,因为 xField 字段有可能会包含多个维度,比如分组场景。\n * `xFieldIndex` 和 `xFieldDim` 声明一个即可,同时声明则 `xFieldDim` 优先级更高。\n * @since 1.7.0\n */\n xFieldDim?: string;\n /**\n * 指定使用 yField 上的那个维度索引,因为 yField 字段有可能会包含多个维度,比如分组场景。\n * @default 0\n * @since 1.7.0\n */\n yFieldIndex?: number;\n /**\n * 指定使用 yField 上的维度名称,因为 yField 字段有可能会包含多个维度,比如分组场景。\n * `yFieldIndex` 和 `yFieldDim` 声明一个即可,同时声明则 `yFieldDim` 优先级更高。\n * @since 1.7.0\n */\n yFieldDim?: string;\n /**\n * 指定使用 angleField 上的那个维度索引,因为 angleField 字段有可能会包含多个维度,比如分组场景\n * @default 0\n * @since 1.11.0\n */\n angleFieldIndex?: number;\n /**\n * 指定使用 angleField 上的维度名称,因为 angleField 字段有可能会包含多个维度,比如分组场景。\n * `angleFieldIndex` 和 `angleFieldDim` 声明一个即可,同时声明则 `angleFieldDim` 优先级更高。\n * @since 1.11.0\n */\n angleFieldDim?: string;\n /**\n * 指定使用 radiusField 上的那个维度索引,因为 radiusField 字段有可能会包含多个维度,比如分组场景\n * @default 0\n * @since 1.11.0\n */\n radiusFieldIndex?: number;\n /**\n * 指定使用 radiusField 上的维度名称,因为 radiusField 字段有可能会包含多个维度,比如分组场景。\n * `radiusFieldIndex` 和 `radiusFieldDim` 声明一个即可,同时声明则 `radiusFieldDim` 优先级更高。\n * @since 1.11.0\n */\n radiusFieldDim?: string;\n};\n\nexport type MarkerPositionPoint = {\n /**\n * x 坐标位置,number 类型表示像素值,string 类型表示相对画布宽度或者 region 宽度的占比(从左往右)\n */\n x: StringOrNumber;\n /**\n * y 坐标位置,number 类型表示像素值,string 类型表示相对画布高度或者 region 高度的占比(从上至下)\n */\n y: StringOrNumber;\n};\n\nexport type ICoordinateOption = {\n x?: IOptionAggrField | (IDataPosCallback | StringOrNumber)[];\n y?: IOptionAggrField | (IDataPosCallback | StringOrNumber)[];\n angle?: IOptionAggrField | (IDataPosCallback | StringOrNumber)[];\n radius?: IOptionAggrField | (IDataPosCallback | StringOrNumber)[];\n getRefRelativeSeries?: () => IMarkerSupportSeries;\n} & IOptionSeries;\n\nexport type IMarkerPositionsSpec = {\n /**\n * 画布坐标\n * `positions` 自 1.12.0 版本开始支持回调函数\n */\n positions:\n | MarkerPositionPoint[]\n | ((seriesData: Datum[], relativeSeries: IMarkerSupportSeries) => MarkerPositionPoint[]);\n /**\n * 是否为相对 region 的坐标,默认为 false,即相对画布的坐标\n * @default false\n * @since 1.7.0\n */\n regionRelative?: boolean;\n};\n\nexport type IMarkerLabelWithoutRefSpec = {\n /**\n * 是否展示标注标签\n */\n visible?: boolean;\n /**\n * label整体 - 是否自动旋转\n */\n autoRotate?: boolean;\n /**\n * label整体 - 最小宽度,像素值\n * @default 30\n */\n minWidth?: number;\n /**\n * label整体 - 最大宽度,像素值。当文字超过最大宽度时,会自动省略。\n */\n maxWidth?: number;\n /**\n * label整体 - 背景面板配置\n */\n labelBackground?: {\n /**\n * 标签背景是否显示,是否可见\n */\n visible?: boolean;\n /**\n * 标签背景支持自定义path\n * @since 1.11.10\n */\n customShape?: (\n text: ITextGraphicAttribute | IRichTextGraphicAttribute,\n attrs: Partial<IGraphicAttribute>,\n path: ICustomPath2D\n ) => ICustomPath2D;\n /**\n * 内部边距\n */\n padding?: IPadding | number[] | number;\n } & Partial<IMarkerState<Omit<IRectMarkSpec, 'visible'>>>;\n\n /**\n * @deprecated\n * 设置文本类型为富文本或者普通文本,已废弃\n **/\n type?: 'rich' | 'text';\n /**\n * 文本内容,如果需要进行换行,则使用数组形式,如 ['abc', '123']\n * 支持富文本内容 textConfig,设置富文本时要配置 textType 类型为 'rich'\n */\n text?: string | string[] | number | number[] | ReturnType<IRichTextFormatMethod<[]>>;\n /**\n * label文本 - 文本格式化\n * @param markData 组成标注的数据\n * @param seriesData 标注关联的数据\n * @returns 格式化后的文本\n */\n formatMethod?: IFormatMethod<[markData: Datum[], seriesData: Datum[]]>;\n\n /**\n * label文本 - 文本前 mark 图元\n */\n shape?: {\n /**\n * 是否显示标签文本前的图形\n */\n visible?: boolean;\n /**\n * 标签文本前的图形对应的样式设置\n */\n style: Omit<ISymbolMarkSpec, 'visible'>;\n };\n /**\n * label文本 - shape 同文本之间的间距\n */\n space?: number;\n\n /**\n * 是否自动调整 label 使其展示在 marker 可见区域内。\n * @default false\n * @since 1.4.0\n */\n confine?: boolean;\n /**\n * 水平方向的偏移\n */\n dx?: number;\n /**\n * 垂直方向的偏移\n */\n dy?: number;\n} & Partial<IMarkerState<Omit<IComposedTextMarkSpec, 'visible'>>>; // label文本 - 文本样式\n\nexport type IMarkerLabelSpec = IMarkerLabelWithoutRefSpec & IMarkerRef;\n\nexport interface IMarkerRef {\n /**\n * label or symbol 相对line平行方向上的偏移\n */\n refX?: number;\n /**\n * label or symbol 相对line正交方向上的偏移\n */\n refY?: number;\n /**\n * label or symbol 相对默认角度的偏移 (label跟随line的角度做自动旋转时,默认按照line的平行向量作为初始角度)\n */\n refAngle?: number;\n}\n\n// 跨越系列的配置\nexport interface IMarkerCrossSeriesSpec {\n /**\n * 设置起点关联的系列,设置该系列的序号(仅在标注目标:坐标空间下有效)\n */\n startRelativeSeriesIndex?: number;\n /**\n * 设置终点关联的系列,设置该序列的序号(仅在标注目标:坐标空间下有效)\n */\n endRelativeSeriesIndex?: number;\n /**\n * 设置起点关联的系列,设置该系列的id(仅在标注目标:坐标空间下有效)\n */\n startRelativeSeriesId?: string;\n /**\n * 设置终点关联的系列,设置该序列的id(仅在标注目标:坐标空间下有效)\n */\n endRelativeSeriesId?: string;\n /**\n * 数据处理需要单独关联系列, 设置序列的序号来进行关联,当配置为'all'时代表关联当前region下所有系列\n * @since 1.11.0\n */\n specifiedDataSeriesIndex?: 'all' | number | number[];\n /**\n * 数据处理需要单独关联系列, 设置序列的id来进行关联,当配置为'all'时代表关联当前region下所有系列\n * @since 1.11.0\n */\n specifiedDataSeriesId?: 'all' | string | string[];\n}\n\nexport type IMarkerSpec = IComponentSpec & {\n /**\n * 标注数据关联的series序号\n */\n relativeSeriesIndex?: number;\n /**\n * 标注数据关联系列对应的id\n */\n relativeSeriesId?: number | string;\n /**\n * marker组件是否可见\n * @default true\n */\n visible?: boolean;\n /**\n * marker组件是否可交互\n * @default true\n */\n interactive?: boolean;\n /**\n * marker组件是否自动拓展轴范围\n * @default false\n * @since 1.1.0\n */\n autoRange?: boolean;\n /**\n * marker组件超出图表区域是否被裁剪\n * @default false\n * @since 1.3.0\n */\n clip?: boolean;\n\n /**\n * 标注组件的名称标识\n * @since 1.7.0\n */\n name?: string;\n /**\n * 标注所在的坐标系类型\n * @description 一般情况下内部逻辑会根据配置自动推导类型,但如果是coordinates的配置方式,则无法推导,需要用户自行配置\n * @since 1.11.0\n */\n coordinateType?: string;\n\n /**\n * 在band轴下标注组件是否包含全band\n * @default false\n * @since 2.0.5\n */\n includeFullBand?: boolean;\n};\n\nexport type IMarkerSymbol = IMarkerRef & {\n /** 是否展示 symbol */\n visible: boolean;\n /**\n * symbol 形状,默认为带左右方向的箭头\n */\n symbolType?: SymbolType;\n /**\n * symbol 大小\n */\n size?: number;\n} & Partial<IMarkerState<Omit<ISymbolMarkSpec, 'visible'>>>;\n\nexport type MarkerStyleCallback<T> = (\n /**\n * markerData 标注组件聚合后的数据\n */\n markerData: DataView,\n /**\n * @since 1.13.0\n * context 组件上下文, 包括相对系列,起始相对系列,结束相对系列和图表实例\n */\n context: IMarkerAttributeContext\n) => T;\nexport type MarkerStateCallback<T> = (\n /**\n * markerData 标注组件聚合后的数据\n */\n markerData: DataView,\n /**\n * @since 1.13.0\n * context 组件上下文, 包括相对系列,起始相对系列,结束相对系列和图表实例\n */\n context: IMarkerAttributeContext\n) => T;\nexport type MarkerStateValue = 'hover' | 'hover_reverse' | 'selected' | 'selected_reverse';\nexport type IMarkerState<T> = {\n /** 默认样式设置 */\n style?: T | MarkerStyleCallback<T>;\n /** 不同状态下的样式配置 */\n state?: Record<MarkerStateValue, T | MarkerStateCallback<T>>;\n};\n\nexport type MarkCoordinateType = 'cartesian' | 'polar' | 'geo';\n\nexport type IMarkProcessOptions = {\n options: IOptionAggr[] | IOptionRegr | IOptionWithCoordinates;\n needAggr?: boolean;\n needRegr?: boolean;\n processData?: DataView;\n};\n\nexport type IMarkerAttributeContext = {\n vchart: IVChart;\n relativeSeries: IMarkerSupportSeries;\n startRelativeSeries: IMarkerSupportSeries;\n endRelativeSeries: IMarkerSupportSeries;\n};\n"]}
1
+ {"version":3,"sources":["../src/component/marker/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { DataView } from '@visactor/vdataset';\nimport type { IPadding } from '@visactor/vutils';\nimport type {\n SymbolType,\n IGraphicAttribute,\n ICustomPath2D,\n ITextGraphicAttribute,\n IRichTextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type {\n IComposedTextMarkSpec,\n IFormatMethod,\n IRectMarkSpec,\n IRichTextFormatMethod,\n ISymbolMarkSpec,\n StringOrNumber\n} from '../../typings';\nimport type { IComponentSpec } from '../base/interface';\nimport type { Datum } from '@visactor/vrender-components';\nimport type { ICartesianSeries, IGeoSeries, IPolarSeries } from '../../series/interface';\nimport type {\n IOptionAggr,\n IOptionAggrField,\n IOptionRegr,\n IOptionSeries,\n IOptionWithCoordinates\n} from '../../data/transforms/interface';\nimport type { IVChart } from '../../core/interface';\n\nexport type IMarkerSupportSeries = ICartesianSeries | IPolarSeries | IGeoSeries;\n\nexport type IPolarPoint = {\n angle: number;\n radius: number;\n};\nexport type OffsetPoint = {\n /**\n * x 方向的偏移\n * 1. number 类型表示像素值,如 12\n * 2. string 类型表示百分比,如 '10%' 表示相对于所在 region 宽度的占比\n */\n x?: number | string;\n /**\n * y 方向的偏移\n * 1. number 类型表示像素值,如 12\n * 2. string 类型表示百分比,如 '10%' 表示相对于所在 region 高度的占比\n */\n y?: number | string;\n};\n\nexport type IAggrType = 'sum' | 'average' | 'min' | 'max' | 'variance' | 'standardDeviation' | 'median';\nexport type IDataPos = StringOrNumber | IAggrType;\nexport type IDataPosCallback = (\n relativeSeriesData: Datum[],\n startRelativeSeriesData: Datum[],\n endRelativeSeriesData: Datum[],\n relativeSeries: IMarkerSupportSeries,\n startRelativeSeries: IMarkerSupportSeries,\n endRelativeSeries: IMarkerSupportSeries\n) => StringOrNumber;\n\nexport type IDataPointSpec = {\n /**\n * 数据字段配置\n */\n [key: string]: IDataPos | IDataPosCallback;\n /**\n * 具体某个数据元素关联的series序号(仅在标注目标:数据元素下有效)\n */\n refRelativeSeriesIndex?: number;\n /**\n * 具体某个数据元素关联的series 的id(仅在标注目标:数据元素下有效)\n */\n refRelativeSeriesId?: StringOrNumber;\n /**\n * 指定使用 xField 上的那个维度索引,因为 xField 字段有可能会包含多个维度,比如分组场景\n * @default 0\n * @since 1.7.0\n */\n xFieldIndex?: number;\n /**\n * 指定使用 xField 上的维度名称,因为 xField 字段有可能会包含多个维度,比如分组场景。\n * `xFieldIndex` 和 `xFieldDim` 声明一个即可,同时声明则 `xFieldDim` 优先级更高。\n * @since 1.7.0\n */\n xFieldDim?: string;\n /**\n * 指定使用 yField 上的那个维度索引,因为 yField 字段有可能会包含多个维度,比如分组场景。\n * @default 0\n * @since 1.7.0\n */\n yFieldIndex?: number;\n /**\n * 指定使用 yField 上的维度名称,因为 yField 字段有可能会包含多个维度,比如分组场景。\n * `yFieldIndex` 和 `yFieldDim` 声明一个即可,同时声明则 `yFieldDim` 优先级更高。\n * @since 1.7.0\n */\n yFieldDim?: string;\n /**\n * 指定使用 angleField 上的那个维度索引,因为 angleField 字段有可能会包含多个维度,比如分组场景\n * @default 0\n * @since 1.11.0\n */\n angleFieldIndex?: number;\n /**\n * 指定使用 angleField 上的维度名称,因为 angleField 字段有可能会包含多个维度,比如分组场景。\n * `angleFieldIndex` 和 `angleFieldDim` 声明一个即可,同时声明则 `angleFieldDim` 优先级更高。\n * @since 1.11.0\n */\n angleFieldDim?: string;\n /**\n * 指定使用 radiusField 上的那个维度索引,因为 radiusField 字段有可能会包含多个维度,比如分组场景\n * @default 0\n * @since 1.11.0\n */\n radiusFieldIndex?: number;\n /**\n * 指定使用 radiusField 上的维度名称,因为 radiusField 字段有可能会包含多个维度,比如分组场景。\n * `radiusFieldIndex` 和 `radiusFieldDim` 声明一个即可,同时声明则 `radiusFieldDim` 优先级更高。\n * @since 1.11.0\n */\n radiusFieldDim?: string;\n};\n\nexport type MarkerPositionPoint = {\n /**\n * x 坐标位置,number 类型表示像素值,string 类型表示相对画布宽度或者 region 宽度的占比(从左往右)\n */\n x: StringOrNumber;\n /**\n * y 坐标位置,number 类型表示像素值,string 类型表示相对画布高度或者 region 高度的占比(从上至下)\n */\n y: StringOrNumber;\n};\n\nexport type ICoordinateOption = {\n x?: IOptionAggrField | (IDataPosCallback | StringOrNumber)[];\n y?: IOptionAggrField | (IDataPosCallback | StringOrNumber)[];\n angle?: IOptionAggrField | (IDataPosCallback | StringOrNumber)[];\n radius?: IOptionAggrField | (IDataPosCallback | StringOrNumber)[];\n getRefRelativeSeries?: () => IMarkerSupportSeries;\n} & IOptionSeries;\n\nexport type IMarkerPositionsSpec = {\n /**\n * 画布坐标\n * `positions` 自 1.12.0 版本开始支持回调函数\n */\n positions:\n | MarkerPositionPoint[]\n | ((seriesData: Datum[], relativeSeries: IMarkerSupportSeries) => MarkerPositionPoint[]);\n /**\n * 是否为相对 region 的坐标,默认为 false,即相对画布的坐标\n * @default false\n * @since 1.7.0\n */\n regionRelative?: boolean;\n};\n\nexport type IMarkerLabelWithoutRefSpec = {\n /**\n * 是否展示标注标签\n */\n visible?: boolean;\n /**\n * label整体 - 是否自动旋转\n */\n autoRotate?: boolean;\n /**\n * label整体 - 最小宽度,像素值\n * @default 30\n */\n minWidth?: number;\n /**\n * label整体 - 最大宽度,像素值。当文字超过最大宽度时,会自动省略。\n */\n maxWidth?: number;\n /**\n * label整体 - 背景面板配置\n */\n labelBackground?: {\n /**\n * 标签背景是否显示,是否可见\n */\n visible?: boolean;\n /**\n * 标签背景支持自定义path\n * @since 1.11.10\n */\n customShape?: (\n text: ITextGraphicAttribute | IRichTextGraphicAttribute,\n attrs: Partial<IGraphicAttribute>,\n path: ICustomPath2D\n ) => ICustomPath2D;\n /**\n * 内部边距\n */\n padding?: IPadding | number[] | number;\n } & Partial<IMarkerState<Omit<IRectMarkSpec, 'visible'>>>;\n\n /**\n * @deprecated\n * 设置文本类型为富文本或者普通文本,已废弃\n **/\n type?: 'rich' | 'text';\n /**\n * 文本内容,如果需要进行换行,则使用数组形式,如 ['abc', '123']\n * 支持富文本内容 textConfig,设置富文本时要配置 textType 类型为 'rich'\n */\n text?: string | string[] | number | number[] | ReturnType<IRichTextFormatMethod<[]>>;\n /**\n * label文本 - 文本格式化\n * @param markData 组成标注的数据\n * @param seriesData 标注关联的数据\n * @returns 格式化后的文本\n */\n formatMethod?: IFormatMethod<[markData: Datum[], seriesData: Datum[]]>;\n\n /**\n * label文本 - 文本前 mark 图元\n */\n shape?: {\n /**\n * 是否显示标签文本前的图形\n */\n visible?: boolean;\n /**\n * 标签文本前的图形对应的样式设置\n */\n style: Omit<ISymbolMarkSpec, 'visible'>;\n };\n /**\n * label文本 - shape 同文本之间的间距\n */\n space?: number;\n\n /**\n * 是否自动调整 label 使其展示在 marker 可见区域内。\n * @default false\n * @since 1.4.0\n */\n confine?: boolean;\n /**\n * 水平方向的偏移\n */\n dx?: number;\n /**\n * 垂直方向的偏移\n */\n dy?: number;\n} & Partial<IMarkerState<Omit<IComposedTextMarkSpec, 'visible'>>>; // label文本 - 文本样式\n\nexport type IMarkerLabelSpec = IMarkerLabelWithoutRefSpec & IMarkerRef;\n\nexport interface IMarkerRef {\n /**\n * label or symbol 相对line平行方向上的偏移\n */\n refX?: number;\n /**\n * label or symbol 相对line正交方向上的偏移\n */\n refY?: number;\n /**\n * label or symbol 相对默认角度的偏移 (label跟随line的角度做自动旋转时,默认按照line的平行向量作为初始角度)\n */\n refAngle?: number;\n}\n\n// 跨越系列的配置\nexport interface IMarkerCrossSeriesSpec {\n /**\n * 设置起点关联的系列,设置该系列的序号(仅在标注目标:坐标空间下有效)\n */\n startRelativeSeriesIndex?: number;\n /**\n * 设置终点关联的系列,设置该序列的序号(仅在标注目标:坐标空间下有效)\n */\n endRelativeSeriesIndex?: number;\n /**\n * 设置起点关联的系列,设置该系列的id(仅在标注目标:坐标空间下有效)\n */\n startRelativeSeriesId?: string;\n /**\n * 设置终点关联的系列,设置该序列的id(仅在标注目标:坐标空间下有效)\n */\n endRelativeSeriesId?: string;\n /**\n * 数据处理需要单独关联系列, 设置序列的序号来进行关联,当配置为'all'时代表关联当前region下所有系列\n * @since 1.11.0\n */\n specifiedDataSeriesIndex?: 'all' | number | number[];\n /**\n * 数据处理需要单独关联系列, 设置序列的id来进行关联,当配置为'all'时代表关联当前region下所有系列\n * @since 1.11.0\n */\n specifiedDataSeriesId?: 'all' | string | string[];\n}\n\nexport type IMarkerSpec = IComponentSpec & {\n /**\n * 标注数据关联的series序号\n */\n relativeSeriesIndex?: number;\n /**\n * 标注数据关联系列对应的id\n */\n relativeSeriesId?: number | string;\n /**\n * marker组件是否可见\n * @default true\n */\n visible?: boolean;\n /**\n * marker组件是否可交互\n * @default true\n */\n interactive?: boolean;\n /**\n * marker组件是否自动拓展轴范围\n * @default false\n * @since 1.1.0\n */\n autoRange?: boolean;\n /**\n * marker组件超出图表区域是否被裁剪\n * @default false\n * @since 1.3.0\n */\n clip?: boolean;\n\n /**\n * 标注组件的名称标识\n * @since 1.7.0\n */\n name?: string;\n /**\n * 标注所在的坐标系类型\n * @description 一般情况下内部逻辑会根据配置自动推导类型,但如果是coordinates的配置方式,则无法推导,需要用户自行配置\n * @since 1.11.0\n */\n coordinateType?: string;\n\n /**\n * 在band轴下标注组件是否包含全band\n * @default false\n * @since 2.0.5\n */\n includeFullBand?: boolean;\n};\n\nexport type IMarkerSymbol = IMarkerRef & {\n /** 是否展示 symbol */\n visible: boolean;\n /**\n * symbol 形状,默认为带左右方向的箭头\n */\n symbolType?: SymbolType;\n /**\n * symbol 大小\n */\n size?: number;\n} & Partial<IMarkerState<Omit<ISymbolMarkSpec, 'visible'>>>;\n\nexport type MarkerStyleCallback<T> = (\n /**\n * markerData 标注组件聚合后的数据\n */\n markerData: DataView,\n /**\n * @since 1.13.0\n * context 组件上下文, 包括相对系列,起始相对系列,结束相对系列和图表实例\n */\n context: IMarkerAttributeContext\n) => T;\nexport type MarkerStateCallback<T> = (\n /**\n * markerData 标注组件聚合后的数据\n */\n markerData: DataView,\n /**\n * @since 1.13.0\n * context 组件上下文, 包括相对系列,起始相对系列,结束相对系列和图表实例\n */\n context: IMarkerAttributeContext\n) => T;\nexport type MarkerStateValue =\n | 'hover'\n | 'hover_reverse'\n | 'dimension_hover'\n | 'dimension_hover_reverse'\n | 'selected'\n | 'selected_reverse';\nexport type IMarkerState<T> = {\n /** 默认样式设置 */\n style?: T | MarkerStyleCallback<T>;\n /** 不同状态下的样式配置 */\n state?: Record<MarkerStateValue, T | MarkerStateCallback<T>>;\n};\n\nexport type MarkCoordinateType = 'cartesian' | 'polar' | 'geo';\n\nexport type IMarkProcessOptions = {\n options: IOptionAggr[] | IOptionRegr | IOptionWithCoordinates;\n needAggr?: boolean;\n needRegr?: boolean;\n processData?: DataView;\n};\n\nexport type IMarkerAttributeContext = {\n vchart: IVChart;\n relativeSeries: IMarkerSupportSeries;\n startRelativeSeries: IMarkerSupportSeries;\n endRelativeSeries: IMarkerSupportSeries;\n};\n"]}
@@ -1,6 +1,7 @@
1
1
  import type { IMarkPoint, IMarkPointSpec } from './interface';
2
2
  import { MarkPoint as MarkPointComponent } from '@visactor/vrender-components';
3
3
  import { BaseMarker } from '../base-marker';
4
+ import { type DimensionEventParams } from '../../../event/events/dimension/interface';
4
5
  import type { IGroup } from '@visactor/vrender-core';
5
6
  export declare abstract class BaseMarkPoint extends BaseMarker<IMarkPointSpec> implements IMarkPoint {
6
7
  static specKey: string;
@@ -8,6 +9,10 @@ export declare abstract class BaseMarkPoint extends BaseMarker<IMarkPointSpec> i
8
9
  layoutZIndex: number;
9
10
  protected _markerComponent: MarkPointComponent;
10
11
  protected abstract _computePointsAttr(): any;
12
+ protected initEvent(): void;
13
+ protected _handleDimensionHover: (params: DimensionEventParams) => void;
14
+ private _getTargetSymbolGraphic;
15
+ private _isDimensionHoverTarget;
11
16
  static _getMarkerCoordinateType(markerSpec: any): string;
12
17
  protected _createMarkerComponent(): IGroup;
13
18
  protected _markerLayout(): void;
@@ -14,7 +14,7 @@ Object.defineProperty(exports, "__esModule", {
14
14
  value: !0
15
15
  }), exports.BaseMarkPoint = void 0;
16
16
 
17
- const utils_1 = require("../utils"), vrender_components_1 = require("@visactor/vrender-components"), vutils_1 = require("@visactor/vutils"), style_1 = require("../../../util/style"), base_marker_1 = require("../base-marker"), layout_1 = require("../../../constant/layout"), isRichTextStyle = style => "rich" === (null == style ? void 0 : style.type), normalizeRichTextStyle = style => {
17
+ const utils_1 = require("../utils"), vrender_components_1 = require("@visactor/vrender-components"), vutils_1 = require("@visactor/vutils"), style_1 = require("../../../util/style"), base_marker_1 = require("../base-marker"), layout_1 = require("../../../constant/layout"), interface_1 = require("../../../compile/mark/interface"), interface_2 = require("../../../event/events/dimension/interface"), isRichTextStyle = style => "rich" === (null == style ? void 0 : style.type), normalizeRichTextStyle = style => {
18
18
  if (!style) return style;
19
19
  const {type: _type, text: text, textConfig: textConfig} = style, restStyle = __rest(style, [ "type", "text", "textConfig" ]), normalizedStyle = Object.assign({}, restStyle), richTextConfig = (0,
20
20
  vutils_1.isValid)(textConfig) ? textConfig : text;
@@ -24,7 +24,35 @@ const utils_1 = require("../utils"), vrender_components_1 = require("@visactor/v
24
24
 
25
25
  class BaseMarkPoint extends base_marker_1.BaseMarker {
26
26
  constructor() {
27
- super(...arguments), this.specKey = "markPoint", this.layoutZIndex = layout_1.LayoutZIndex.MarkPoint;
27
+ super(...arguments), this.specKey = "markPoint", this.layoutZIndex = layout_1.LayoutZIndex.MarkPoint,
28
+ this._handleDimensionHover = params => {
29
+ var _a, _b;
30
+ const targetSymbol = this._getTargetSymbolGraphic();
31
+ if (targetSymbol) switch (params.action) {
32
+ case "enter":
33
+ targetSymbol.removeState(interface_1.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER), targetSymbol.removeState(interface_1.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE),
34
+ this._isDimensionHoverTarget(params) ? targetSymbol.addState(interface_1.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER, !0) : (null === (_b = null === (_a = this._spec.targetSymbol) || void 0 === _a ? void 0 : _a.state) || void 0 === _b ? void 0 : _b.dimension_hover_reverse) && targetSymbol.addState(interface_1.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE, !0);
35
+ break;
36
+
37
+ case "leave":
38
+ targetSymbol.removeState(interface_1.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER), targetSymbol.removeState(interface_1.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE);
39
+ }
40
+ };
41
+ }
42
+ initEvent() {
43
+ var _a;
44
+ super.initEvent();
45
+ const targetSymbolState = null === (_a = this._spec.targetSymbol) || void 0 === _a ? void 0 : _a.state;
46
+ "cartesian" === this.coordinateType && ((null == targetSymbolState ? void 0 : targetSymbolState.dimension_hover) || (null == targetSymbolState ? void 0 : targetSymbolState.dimension_hover_reverse)) && this.event.on(interface_2.DimensionEventEnum.dimensionHover, this._handleDimensionHover);
47
+ }
48
+ _getTargetSymbolGraphic() {
49
+ var _a;
50
+ return null === (_a = this._markerComponent) || void 0 === _a ? void 0 : _a.find((node => "mark-point-targetItem" === node.name), !0);
51
+ }
52
+ _isDimensionHoverTarget(params) {
53
+ var _a, _b, _c, _d;
54
+ const latestData = null === (_a = this._markerData) || void 0 === _a ? void 0 : _a.latestData, markerData = null !== (_c = null === (_b = null == latestData ? void 0 : latestData[0]) || void 0 === _b ? void 0 : _b.latestData) && void 0 !== _c ? _c : latestData;
55
+ return (0, vutils_1.array)(null === (_d = null == markerData ? void 0 : markerData[0]) || void 0 === _d ? void 0 : _d.x).filter(vutils_1.isValid).some((value => params.dimensionInfo.some((dimension => dimension.value === value))));
28
56
  }
29
57
  static _getMarkerCoordinateType(markerSpec) {
30
58
  const {doPolarProcess: doPolarProcess, doGeoProcess: doGeoProcess} = (0, utils_1.getMarkPointProcessInfo)(markerSpec);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/marker/mark-point/base-mark-point.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,oCAQkB;AAGlB,qEAA+E;AAC/E,6CAAkD;AAClD,+CAAyD;AACzD,gDAA4C;AAC5C,qDAAwD;AAIxD,MAAM,eAAe,GAAG,CAAC,KAAU,EAAE,EAAE,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,MAAK,MAAM,CAAC;AAE/D,MAAM,sBAAsB,GAAG,CAAC,KAAU,EAAE,EAAE;IAC5C,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,KAAK,CAAC;KACd;IACD,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,KAAmB,KAAK,EAAnB,SAAS,UAAK,KAAK,EAAvD,8BAA+C,CAAQ,CAAC;IAC9D,MAAM,eAAe,qBAChB,SAAS,CACb,CAAC;IACF,MAAM,cAAc,GAAG,IAAA,gBAAO,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;IAC/D,IAAI,IAAA,gBAAO,EAAC,cAAc,CAAC,EAAE;QAC1B,eAAuB,CAAC,UAAU,GAAG,cAAc,CAAC;KACtD;IACD,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAEF,MAAsB,aAAc,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AE,GAAG,IAAA,+BAAuB,EAAC,IAAI,CAAC,CAAC;QACpF,MAAM,mBAAmB,GAAG,IAAA,gBAAO,EAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACrD,IAAI,CAAC,mBAAmB,IAAI,CAAC,WAAW,IAAI,CAAC,cAAc,IAAI,CAAC,YAAY,EAAE;YAC5E,OAAO;SACR;QAED,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;;AAhRH,sCAiRC;AAhRQ,qBAAO,GAAG,WAAW,CAAC","file":"base-mark-point.js","sourcesContent":["import type { IMarkPoint, IMarkPointSpec } from './interface';\nimport {\n computeClipRange,\n computeOffsetFromRegion,\n getMarkPointProcessInfo,\n transformLabelAttributes,\n transformOffset,\n transformState,\n transformStyle\n} from '../utils';\nimport type { MarkPointAttrs } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { MarkPoint as MarkPointComponent } from '@visactor/vrender-components';\nimport { isValid, merge } from '@visactor/vutils';\nimport { transformToGraphic } from '../../../util/style';\nimport { BaseMarker } from '../base-marker';\nimport { LayoutZIndex } from '../../../constant/layout';\nimport type { IGroup } from '@visactor/vrender-core';\nimport type { IMarkerLabelSpec, IMarkerLabelWithoutRefSpec } from '../interface';\n\nconst isRichTextStyle = (style: any) => style?.type === 'rich';\n\nconst normalizeRichTextStyle = (style: any) => {\n if (!style) {\n return style;\n }\n const { type: _type, text, textConfig, ...restStyle } = style;\n const normalizedStyle = {\n ...restStyle\n };\n const richTextConfig = isValid(textConfig) ? textConfig : text;\n if (isValid(richTextConfig)) {\n (normalizedStyle as any).textConfig = richTextConfig;\n }\n return normalizedStyle;\n};\n\nexport abstract class BaseMarkPoint extends BaseMarker<IMarkPointSpec> implements IMarkPoint {\n static specKey = 'markPoint';\n specKey = 'markPoint';\n\n layoutZIndex: number = LayoutZIndex.MarkPoint;\n protected declare _markerComponent: MarkPointComponent;\n\n protected abstract _computePointsAttr(): any;\n\n static _getMarkerCoordinateType(markerSpec: any): string {\n const { doPolarProcess, doGeoProcess } = getMarkPointProcessInfo(markerSpec);\n if (markerSpec.coordinateType === 'polar' || doPolarProcess) {\n return 'polar';\n } else if (markerSpec.coordinateType === 'geo' || doGeoProcess) {\n return 'geo';\n }\n return 'cartesian';\n }\n\n protected _createMarkerComponent() {\n const { itemContent = {}, itemLine = {}, targetSymbol = {} } = this._spec;\n const region = this._relativeSeries.getRegion();\n const {\n type = 'text',\n\n // 老写法\n text: label,\n symbol,\n image,\n richText,\n customMark,\n textStyle,\n symbolStyle,\n imageStyle,\n richTextStyle,\n customMarkStyle,\n\n // 新写法\n style = {},\n state = {},\n\n ...restItemContent\n } = itemContent as any;\n\n let itemContentState = null;\n let itemContentStyle = null;\n let itemContentType = type;\n let defaultStyle = {};\n\n if (type === 'text') {\n itemContentState = label?.state ?? state;\n const labelStyle = label?.style ?? label?.textStyle ?? textStyle ?? (style as Pick<IMarkerLabelSpec, 'style'>);\n if (isRichTextStyle(labelStyle)) {\n itemContentType = 'richText';\n defaultStyle = {\n width: 100,\n height: 100\n };\n itemContentStyle = transformStyle(\n merge(defaultStyle, normalizeRichTextStyle(labelStyle)),\n this._markerData,\n this._markAttributeContext\n );\n } else {\n defaultStyle = {\n dx: 0,\n dy: 0\n };\n itemContentStyle = transformLabelAttributes(\n {\n ...label,\n style: merge(defaultStyle, labelStyle)\n },\n this._markerData,\n this._markAttributeContext\n );\n }\n } else if ((type as any) === 'richText') {\n itemContentState = richText?.state ?? state;\n defaultStyle = {\n width: 100,\n height: 100\n };\n itemContentStyle = transformStyle(\n merge(defaultStyle, richText?.style ?? richTextStyle ?? style),\n this._markerData,\n this._markAttributeContext\n );\n } else if (type === 'symbol') {\n itemContentState = symbol?.state ?? state;\n defaultStyle = {\n symbolType: 'star',\n fill: 'rgb(48, 115, 242)',\n fillOpacity: 0.8,\n size: 20\n };\n itemContentStyle = transformToGraphic(\n transformStyle(\n merge(defaultStyle, symbol?.style ?? symbolStyle ?? style),\n this._markerData,\n this._markAttributeContext\n )\n );\n } else if (type === 'image') {\n itemContentState = image?.state ?? state;\n defaultStyle = {\n width: 80,\n height: 80\n };\n itemContentStyle = transformStyle(\n merge(defaultStyle, image?.style ?? imageStyle ?? style),\n this._markerData,\n this._markAttributeContext\n );\n } else if (type === 'custom') {\n itemContentState = customMark?.state ?? state;\n itemContentStyle = transformStyle(\n customMark?.style ?? customMarkStyle ?? style,\n this._markerData,\n this._markAttributeContext\n );\n }\n const markPointAttrs: MarkPointAttrs = {\n zIndex: this.layoutZIndex,\n interactive: this._spec.interactive ?? true,\n hover: this._spec.interactive ?? true,\n select: this._spec.interactive ?? true,\n position: { x: 0, y: 0 },\n clipInRange: this._spec.clip ?? false,\n itemContent: {\n type: itemContentType,\n offsetX: transformOffset(itemContent.offsetX, region),\n offsetY: transformOffset(itemContent.offsetY, region),\n ...restItemContent, // Tips: 因为网站 demo 上已经透出了 imageStyle richTextStyle 的写法,为了兼容所以这个需要在后面覆盖\n style: transformStyle(itemContentStyle, this._markerData, this._markAttributeContext)\n },\n targetSymbol: {\n offset: targetSymbol.offset ?? 0,\n visible: targetSymbol.visible ?? false,\n size: targetSymbol.size ?? 20,\n style: transformStyle(targetSymbol.style, this._markerData, this._markAttributeContext)\n },\n state: {\n line: transformState(this._spec.itemLine.line?.state ?? {}, this._markerData, this._markAttributeContext),\n lineStartSymbol: transformState(\n this._spec.itemLine.startSymbol?.state ?? {},\n this._markerData,\n this._markAttributeContext\n ),\n lineEndSymbol: transformState(\n this._spec.itemLine.endSymbol?.state ?? {},\n this._markerData,\n this._markAttributeContext\n ),\n itemContent: transformState(itemContentState, this._markerData, this._markAttributeContext),\n textBackground: transformState(\n this._spec.itemContent.text?.labelBackground?.state,\n this._markerData,\n this._markAttributeContext\n ),\n targetItem: transformState(this._spec.targetSymbol?.state ?? {}, this._markerData, this._markAttributeContext)\n },\n animation: this._spec.animation ?? false,\n animationEnter: this._spec.animationEnter,\n animationExit: this._spec.animationExit,\n animationUpdate: this._spec.animationUpdate\n };\n\n const { visible, line = {}, ...restItemLine } = itemLine;\n if (visible !== false) {\n markPointAttrs.itemLine = {\n ...restItemLine,\n visible: true,\n lineStyle: transformToGraphic(line.style)\n } as any;\n } else {\n markPointAttrs.itemLine = {\n visible: false\n };\n }\n\n const markPoint = new MarkPointComponent(markPointAttrs);\n return markPoint as unknown as IGroup;\n }\n\n protected _markerLayout() {\n const spec = this._spec;\n const data = this._markerData;\n const relativeSeries = this._relativeSeries;\n\n const { point } = this._computePointsAttr();\n\n const seriesData = this._getRelativeDataView().latestData;\n const dataPoints = data\n ? data.latestData[0] && data.latestData[0].latestData\n ? data.latestData[0].latestData\n : data.latestData\n : seriesData;\n const { itemLine = {}, itemContent = {} } = this._spec;\n const region = this._relativeSeries.getRegion();\n const { visible: itemLineVisible, line = {}, ...restItemLine } = itemLine;\n const itemLineAttrs =\n itemLineVisible !== false\n ? ({\n ...restItemLine,\n visible: true,\n lineStyle: transformToGraphic(line.style)\n } as any)\n : {\n visible: false\n };\n const labelAttrs = transformLabelAttributes(\n {\n ...itemContent.text,\n style: merge({ dx: 0, dy: 0 }, itemContent.text?.style ?? itemContent.style)\n } as IMarkerLabelWithoutRefSpec,\n data,\n this._markAttributeContext\n ) as any;\n\n let limitRect;\n if (spec.clip || spec.itemContent?.confine) {\n const { minX, maxX, minY, maxY } = computeClipRange([relativeSeries.getRegion()]);\n limitRect = {\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY\n };\n }\n if (this._markerComponent) {\n const attribute = this._markerComponent.attribute ?? {};\n const textStyle = (attribute.itemContent as any)?.textStyle ?? {};\n const specText = this._spec.itemContent.text?.text;\n const offsetX = transformOffset(itemContent.offsetX, region);\n const offsetY = transformOffset(itemContent.offsetY, region);\n this._markerComponent.setAttributes({\n position: point === undefined ? { x: null, y: null } : point, // setAttrs时merge时undefined会被忽略, 所以这里做转换\n itemContent: {\n ...attribute.itemContent,\n panel: labelAttrs.panel ?? (attribute.itemContent as any)?.panel,\n padding: labelAttrs.padding ?? (attribute.itemContent as any)?.padding,\n textStyle: {\n ...textStyle,\n ...(labelAttrs.textStyle ?? {}),\n text: this._spec.itemContent.text?.formatMethod\n ? // type error here will be fixed in components\n (this._spec.itemContent.text.formatMethod(dataPoints, seriesData) as any)\n : isValid(specText)\n ? specText\n : textStyle.text\n },\n offsetX: computeOffsetFromRegion(point, offsetX, region),\n offsetY: computeOffsetFromRegion(point, offsetY, region)\n } as any,\n itemLine: itemLineAttrs,\n limitRect,\n dx: this._layoutOffsetX,\n dy: this._layoutOffsetY\n });\n }\n }\n\n protected _initDataView(): void {\n const spec = this._spec as any;\n const { doXYProcess, doPolarProcess, doGeoProcess } = getMarkPointProcessInfo(spec);\n const isCoordinateProcess = isValid(spec.coordinate);\n if (!isCoordinateProcess && !doXYProcess && !doPolarProcess && !doGeoProcess) {\n return;\n }\n\n this._initCommonDataView();\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/component/marker/mark-point/base-mark-point.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,oCAQkB;AAGlB,qEAA+E;AAC/E,6CAAyD;AACzD,+CAAyD;AACzD,gDAA4C;AAC5C,qDAAwD;AACxD,+DAAmE;AACnE,yEAA0G;AAI1G,MAAM,eAAe,GAAG,CAAC,KAAU,EAAE,EAAE,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,MAAK,MAAM,CAAC;AAE/D,MAAM,sBAAsB,GAAG,CAAC,KAAU,EAAE,EAAE;IAC5C,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,KAAK,CAAC;KACd;IACD,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,KAAmB,KAAK,EAAnB,SAAS,UAAK,KAAK,EAAvD,8BAA+C,CAAQ,CAAC;IAC9D,MAAM,eAAe,qBAChB,SAAS,CACb,CAAC;IACF,MAAM,cAAc,GAAG,IAAA,gBAAO,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAA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OAAO;SACR;QAED,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;;AAtUH,sCAuUC;AAtUQ,qBAAO,GAAG,WAAW,CAAC","file":"base-mark-point.js","sourcesContent":["import type { IMarkPoint, IMarkPointSpec } from './interface';\nimport {\n computeClipRange,\n computeOffsetFromRegion,\n getMarkPointProcessInfo,\n transformLabelAttributes,\n transformOffset,\n transformState,\n transformStyle\n} from '../utils';\nimport type { MarkPointAttrs } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { MarkPoint as MarkPointComponent } from '@visactor/vrender-components';\nimport { array, isValid, merge } from '@visactor/vutils';\nimport { transformToGraphic } from '../../../util/style';\nimport { BaseMarker } from '../base-marker';\nimport { LayoutZIndex } from '../../../constant/layout';\nimport { STATE_VALUE_ENUM } from '../../../compile/mark/interface';\nimport { DimensionEventEnum, type DimensionEventParams } from '../../../event/events/dimension/interface';\nimport type { IGraphic, IGroup } from '@visactor/vrender-core';\nimport type { IMarkerLabelSpec, IMarkerLabelWithoutRefSpec } from '../interface';\n\nconst isRichTextStyle = (style: any) => style?.type === 'rich';\n\nconst normalizeRichTextStyle = (style: any) => {\n if (!style) {\n return style;\n }\n const { type: _type, text, textConfig, ...restStyle } = style;\n const normalizedStyle = {\n ...restStyle\n };\n const richTextConfig = isValid(textConfig) ? textConfig : text;\n if (isValid(richTextConfig)) {\n (normalizedStyle as any).textConfig = richTextConfig;\n }\n return normalizedStyle;\n};\n\nexport abstract class BaseMarkPoint extends BaseMarker<IMarkPointSpec> implements IMarkPoint {\n static specKey = 'markPoint';\n specKey = 'markPoint';\n\n layoutZIndex: number = LayoutZIndex.MarkPoint;\n protected declare _markerComponent: MarkPointComponent;\n\n protected abstract _computePointsAttr(): any;\n\n protected initEvent() {\n super.initEvent();\n\n const targetSymbolState = this._spec.targetSymbol?.state;\n if (\n this.coordinateType === 'cartesian' &&\n (targetSymbolState?.dimension_hover || targetSymbolState?.dimension_hover_reverse)\n ) {\n this.event.on(DimensionEventEnum.dimensionHover, this._handleDimensionHover);\n }\n }\n\n protected _handleDimensionHover = (params: DimensionEventParams) => {\n const targetSymbol = this._getTargetSymbolGraphic();\n if (!targetSymbol) {\n return;\n }\n\n switch (params.action) {\n case 'enter': {\n targetSymbol.removeState(STATE_VALUE_ENUM.STATE_DIMENSION_HOVER);\n targetSymbol.removeState(STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE);\n\n if (this._isDimensionHoverTarget(params)) {\n targetSymbol.addState(STATE_VALUE_ENUM.STATE_DIMENSION_HOVER, true);\n } else if (this._spec.targetSymbol?.state?.dimension_hover_reverse) {\n targetSymbol.addState(STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE, true);\n }\n break;\n }\n case 'leave':\n targetSymbol.removeState(STATE_VALUE_ENUM.STATE_DIMENSION_HOVER);\n targetSymbol.removeState(STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE);\n break;\n default:\n break;\n }\n };\n\n private _getTargetSymbolGraphic() {\n return this._markerComponent?.find(\n node => node.name === 'mark-point-targetItem',\n true\n ) as unknown as IGraphic | null;\n }\n\n private _isDimensionHoverTarget(params: DimensionEventParams) {\n const latestData = this._markerData?.latestData;\n const markerData = latestData?.[0]?.latestData ?? latestData;\n const markerXValues = array(markerData?.[0]?.x).filter(isValid);\n\n return markerXValues.some(value => params.dimensionInfo.some(dimension => dimension.value === value));\n }\n\n static _getMarkerCoordinateType(markerSpec: any): string {\n const { doPolarProcess, doGeoProcess } = getMarkPointProcessInfo(markerSpec);\n if (markerSpec.coordinateType === 'polar' || doPolarProcess) {\n return 'polar';\n } else if (markerSpec.coordinateType === 'geo' || doGeoProcess) {\n return 'geo';\n }\n return 'cartesian';\n }\n\n protected _createMarkerComponent() {\n const { itemContent = {}, itemLine = {}, targetSymbol = {} } = this._spec;\n const region = this._relativeSeries.getRegion();\n const {\n type = 'text',\n\n // 老写法\n text: label,\n symbol,\n image,\n richText,\n customMark,\n textStyle,\n symbolStyle,\n imageStyle,\n richTextStyle,\n customMarkStyle,\n\n // 新写法\n style = {},\n state = {},\n\n ...restItemContent\n } = itemContent as any;\n\n let itemContentState = null;\n let itemContentStyle = null;\n let itemContentType = type;\n let defaultStyle = {};\n\n if (type === 'text') {\n itemContentState = label?.state ?? state;\n const labelStyle = label?.style ?? label?.textStyle ?? textStyle ?? (style as Pick<IMarkerLabelSpec, 'style'>);\n if (isRichTextStyle(labelStyle)) {\n itemContentType = 'richText';\n defaultStyle = {\n width: 100,\n height: 100\n };\n itemContentStyle = transformStyle(\n merge(defaultStyle, normalizeRichTextStyle(labelStyle)),\n this._markerData,\n this._markAttributeContext\n );\n } else {\n defaultStyle = {\n dx: 0,\n dy: 0\n };\n itemContentStyle = transformLabelAttributes(\n {\n ...label,\n style: merge(defaultStyle, labelStyle)\n },\n this._markerData,\n this._markAttributeContext\n );\n }\n } else if ((type as any) === 'richText') {\n itemContentState = richText?.state ?? state;\n defaultStyle = {\n width: 100,\n height: 100\n };\n itemContentStyle = transformStyle(\n merge(defaultStyle, richText?.style ?? richTextStyle ?? style),\n this._markerData,\n this._markAttributeContext\n );\n } else if (type === 'symbol') {\n itemContentState = symbol?.state ?? state;\n defaultStyle = {\n symbolType: 'star',\n fill: 'rgb(48, 115, 242)',\n fillOpacity: 0.8,\n size: 20\n };\n itemContentStyle = transformToGraphic(\n transformStyle(\n merge(defaultStyle, symbol?.style ?? symbolStyle ?? style),\n this._markerData,\n this._markAttributeContext\n )\n );\n } else if (type === 'image') {\n itemContentState = image?.state ?? state;\n defaultStyle = {\n width: 80,\n height: 80\n };\n itemContentStyle = transformStyle(\n merge(defaultStyle, image?.style ?? imageStyle ?? style),\n this._markerData,\n this._markAttributeContext\n );\n } else if (type === 'custom') {\n itemContentState = customMark?.state ?? state;\n itemContentStyle = transformStyle(\n customMark?.style ?? customMarkStyle ?? style,\n this._markerData,\n this._markAttributeContext\n );\n }\n const markPointAttrs: MarkPointAttrs = {\n zIndex: this.layoutZIndex,\n interactive: this._spec.interactive ?? true,\n hover: this._spec.interactive ?? true,\n select: this._spec.interactive ?? true,\n position: { x: 0, y: 0 },\n clipInRange: this._spec.clip ?? false,\n itemContent: {\n type: itemContentType,\n offsetX: transformOffset(itemContent.offsetX, region),\n offsetY: transformOffset(itemContent.offsetY, region),\n ...restItemContent, // Tips: 因为网站 demo 上已经透出了 imageStyle richTextStyle 的写法,为了兼容所以这个需要在后面覆盖\n style: transformStyle(itemContentStyle, this._markerData, this._markAttributeContext)\n },\n targetSymbol: {\n offset: targetSymbol.offset ?? 0,\n visible: targetSymbol.visible ?? false,\n size: targetSymbol.size ?? 20,\n style: transformStyle(targetSymbol.style, this._markerData, this._markAttributeContext)\n },\n state: {\n line: transformState(this._spec.itemLine.line?.state ?? {}, this._markerData, this._markAttributeContext),\n lineStartSymbol: transformState(\n this._spec.itemLine.startSymbol?.state ?? {},\n this._markerData,\n this._markAttributeContext\n ),\n lineEndSymbol: transformState(\n this._spec.itemLine.endSymbol?.state ?? {},\n this._markerData,\n this._markAttributeContext\n ),\n itemContent: transformState(itemContentState, this._markerData, this._markAttributeContext),\n textBackground: transformState(\n this._spec.itemContent.text?.labelBackground?.state,\n this._markerData,\n this._markAttributeContext\n ),\n targetItem: transformState(this._spec.targetSymbol?.state ?? {}, this._markerData, this._markAttributeContext)\n },\n animation: this._spec.animation ?? false,\n animationEnter: this._spec.animationEnter,\n animationExit: this._spec.animationExit,\n animationUpdate: this._spec.animationUpdate\n };\n\n const { visible, line = {}, ...restItemLine } = itemLine;\n if (visible !== false) {\n markPointAttrs.itemLine = {\n ...restItemLine,\n visible: true,\n lineStyle: transformToGraphic(line.style)\n } as any;\n } else {\n markPointAttrs.itemLine = {\n visible: false\n };\n }\n\n const markPoint = new MarkPointComponent(markPointAttrs);\n return markPoint as unknown as IGroup;\n }\n\n protected _markerLayout() {\n const spec = this._spec;\n const data = this._markerData;\n const relativeSeries = this._relativeSeries;\n\n const { point } = this._computePointsAttr();\n\n const seriesData = this._getRelativeDataView().latestData;\n const dataPoints = data\n ? data.latestData[0] && data.latestData[0].latestData\n ? data.latestData[0].latestData\n : data.latestData\n : seriesData;\n const { itemLine = {}, itemContent = {} } = this._spec;\n const region = this._relativeSeries.getRegion();\n const { visible: itemLineVisible, line = {}, ...restItemLine } = itemLine;\n const itemLineAttrs =\n itemLineVisible !== false\n ? ({\n ...restItemLine,\n visible: true,\n lineStyle: transformToGraphic(line.style)\n } as any)\n : {\n visible: false\n };\n const labelAttrs = transformLabelAttributes(\n {\n ...itemContent.text,\n style: merge({ dx: 0, dy: 0 }, itemContent.text?.style ?? itemContent.style)\n } as IMarkerLabelWithoutRefSpec,\n data,\n this._markAttributeContext\n ) as any;\n\n let limitRect;\n if (spec.clip || spec.itemContent?.confine) {\n const { minX, maxX, minY, maxY } = computeClipRange([relativeSeries.getRegion()]);\n limitRect = {\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY\n };\n }\n if (this._markerComponent) {\n const attribute = this._markerComponent.attribute ?? {};\n const textStyle = (attribute.itemContent as any)?.textStyle ?? {};\n const specText = this._spec.itemContent.text?.text;\n const offsetX = transformOffset(itemContent.offsetX, region);\n const offsetY = transformOffset(itemContent.offsetY, region);\n this._markerComponent.setAttributes({\n position: point === undefined ? { x: null, y: null } : point, // setAttrs时merge时undefined会被忽略, 所以这里做转换\n itemContent: {\n ...attribute.itemContent,\n panel: labelAttrs.panel ?? (attribute.itemContent as any)?.panel,\n padding: labelAttrs.padding ?? (attribute.itemContent as any)?.padding,\n textStyle: {\n ...textStyle,\n ...(labelAttrs.textStyle ?? {}),\n text: this._spec.itemContent.text?.formatMethod\n ? // type error here will be fixed in components\n (this._spec.itemContent.text.formatMethod(dataPoints, seriesData) as any)\n : isValid(specText)\n ? specText\n : textStyle.text\n },\n offsetX: computeOffsetFromRegion(point, offsetX, region),\n offsetY: computeOffsetFromRegion(point, offsetY, region)\n } as any,\n itemLine: itemLineAttrs,\n limitRect,\n dx: this._layoutOffsetX,\n dy: this._layoutOffsetY\n });\n }\n }\n\n protected _initDataView(): void {\n const spec = this._spec as any;\n const { doXYProcess, doPolarProcess, doGeoProcess } = getMarkPointProcessInfo(spec);\n const isCoordinateProcess = isValid(spec.coordinate);\n if (!isCoordinateProcess && !doXYProcess && !doPolarProcess && !doGeoProcess) {\n return;\n }\n\n this._initCommonDataView();\n }\n}\n"]}
@@ -27,4 +27,4 @@ class ExpressionFunction {
27
27
  }
28
28
 
29
29
  exports.ExpressionFunction = ExpressionFunction;
30
- //# sourceMappingURL=expression-function.js.map
30
+ //# sourceMappingURL=expression-function.js.map
@@ -36,7 +36,7 @@ const vdataset_1 = require("@visactor/vdataset"), createFactoryRegistry = () =>
36
36
  tooltipProcessors: {},
37
37
  runtimePluginInstallers: {},
38
38
  formatter: void 0
39
- }), factoryRegistryVersion = "2.1.4", factoryRegistryKey = Symbol.for("@visactor/vchart/factory-registry@2.1.4"), globalFactoryRegistry = globalThis;
39
+ }), factoryRegistryVersion = "2.1.5", factoryRegistryKey = Symbol.for("@visactor/vchart/factory-registry@2.1.5"), globalFactoryRegistry = globalThis;
40
40
 
41
41
  exports.factoryRegistry = null !== (_a = globalFactoryRegistry[factoryRegistryKey]) && void 0 !== _a ? _a : globalFactoryRegistry[factoryRegistryKey] = {
42
42
  charts: {},
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/factory-registry.ts"],"names":[],"mappings":";;;;AAEA,iDAA2F;AA+C3F,MAAM,qBAAqB,GAAG,GAAqB,EAAE,CAAC,CAAC;IACrD,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;IACV,UAAU,EAAE,EAAE;IACd,iBAAiB,EAAE,EAAE;IACrB,KAAK,EAAE,EAAE;IACT,OAAO,EAAE,EAAE;IACX,UAAU,EAAE,EAAE;IACd,UAAU,EAAE,EAAE;IACd,WAAW,EAAE,EAAE;IACf,YAAY,EAAE,EAAE;IAChB,eAAe,EAAE,EAAE;IACnB,UAAU,EAAE;QAEV,MAAM,EAAN,iBAAM;QACN,MAAM,EAAN,iBAAM;QACN,IAAI,EAAJ,eAAI;KACL;IACD,UAAU,EAAE;QAEV,GAAG,EAAE,oBAAS;QACd,GAAG,EAAE,oBAAS;QACd,GAAG,EAAE,oBAAS;KACf;IACD,MAAM,EAAE,EAAE;IACV,iBAAiB,EAAE,EAAE;IACrB,iBAAiB,EAAE,EAAE;IACrB,mBAAmB,EAAE,EAAE;IACvB,gBAAgB,EAAE,EAAE;IACpB,iBAAiB,EAAE,EAAE;IACrB,uBAAuB,EAAE,EAAE;IAC3B,SAAS,EAAE,SAAS;CACrB,CAAC,CAAC;AAEH,MAAM,sBAAsB,GAAG,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;AACpF,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,qCAAqC,sBAAsB,EAAE,CAAC,CAAC;AACrG,MAAM,qBAAqB,GAAG,UAE7B,CAAC;AAEW,QAAA,eAAe,GAC1B,MAAA,qBAAqB,CAAC,kBAAkB,CAAC,mCAAI,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,GAAG,qBAAqB,EAAE,CAAC,CAAC","file":"factory-registry.js","sourcesContent":["import type { Transform, Parser } from '@visactor/vdataset';\n// eslint-disable-next-line no-duplicate-imports\nimport { fields, filter, fold, csvParser, dsvParser, tsvParser } from '@visactor/vdataset';\nimport type { IChartConstructor } from '../chart/interface';\nimport type { ISeriesConstructor } from '../series/interface';\nimport type { IComponentConstructor } from '../component/interface';\nimport type { MarkConstructor } from '../mark/interface';\nimport type { IRegionConstructor } from '../region/interface';\nimport type { ILayoutConstructor } from '../layout/interface';\nimport type { IChartPluginConstructor } from '../plugin/chart/interface';\nimport type { IComponentPluginConstructor } from '../plugin/components/interface';\nimport type { IApp, IGraphic } from '@visactor/vrender-core';\nimport type { GrammarTransformOption, IStageEventPlugin, VRenderComponentOptions } from './interface';\nimport type { MarkAnimationSpec } from '../animation/interface';\nimport type { ITriggerConstructor } from '../interaction/interface/trigger';\nimport type { IComposedEventConstructor } from '../index-harmony-simple';\nimport type { ITooltipProcessorConstructor } from '../component/tooltip/processor/interface';\nimport type { IVChartPluginConstructor } from '../plugin/vchart';\n\nexport interface IFactoryRegistry {\n charts: { [key: string]: IChartConstructor };\n series: { [key: string]: ISeriesConstructor };\n components: {\n [key: string]: {\n cmp: IComponentConstructor;\n alwaysCheck?: boolean;\n createOrder: number;\n };\n };\n graphicComponents: Record<string, (attrs: any, options?: VRenderComponentOptions) => IGraphic>;\n marks: { [key: string]: MarkConstructor };\n regions: { [key: string]: IRegionConstructor };\n animations: { [key: string]: (params?: any, preset?: any) => MarkAnimationSpec };\n implements: { [key: string]: (...args: any) => void };\n chartPlugin: { [key: string]: IChartPluginConstructor };\n vChartPlugin: { [key: string]: IVChartPluginConstructor };\n componentPlugin: { [key: string]: IComponentPluginConstructor };\n transforms: { [key: string]: Transform };\n dataParser: { [key: string]: Parser };\n layout: { [key: string]: ILayoutConstructor };\n grammarTransforms: Record<string, GrammarTransformOption>;\n stageEventPlugins: Record<string, IStageEventPlugin<any>>;\n interactionTriggers: Record<string, ITriggerConstructor>;\n composedEventMap: Record<string, IComposedEventConstructor>;\n tooltipProcessors: Record<string, ITooltipProcessorConstructor>;\n runtimePluginInstallers: Record<string, (app?: IApp) => void>;\n formatter?: (text: string | number | string[] | number[], datum: any, formatter: string | string[]) => any;\n}\n\nconst createFactoryRegistry = (): IFactoryRegistry => ({\n charts: {},\n series: {},\n components: {},\n graphicComponents: {},\n marks: {},\n regions: {},\n animations: {},\n implements: {},\n chartPlugin: {},\n vChartPlugin: {},\n componentPlugin: {},\n transforms: {\n // buildIn transforms\n fields,\n filter,\n fold\n },\n dataParser: {\n // buildIn parser\n csv: csvParser,\n dsv: dsvParser,\n tsv: tsvParser\n },\n layout: {},\n grammarTransforms: {},\n stageEventPlugins: {},\n interactionTriggers: {},\n composedEventMap: {},\n tooltipProcessors: {},\n runtimePluginInstallers: {},\n formatter: undefined\n});\n\nconst factoryRegistryVersion = typeof \"2.1.4\" === 'undefined' ? 'unknown' : \"2.1.4\";\nconst factoryRegistryKey = Symbol.for(`@visactor/vchart/factory-registry@${factoryRegistryVersion}`);\nconst globalFactoryRegistry = globalThis as typeof globalThis & {\n [factoryRegistryKey]?: IFactoryRegistry;\n};\n\nexport const factoryRegistry: IFactoryRegistry =\n globalFactoryRegistry[factoryRegistryKey] ?? (globalFactoryRegistry[factoryRegistryKey] = createFactoryRegistry());\n"]}
1
+ {"version":3,"sources":["../src/core/factory-registry.ts"],"names":[],"mappings":";;;;AAEA,iDAA2F;AA+C3F,MAAM,qBAAqB,GAAG,GAAqB,EAAE,CAAC,CAAC;IACrD,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;IACV,UAAU,EAAE,EAAE;IACd,iBAAiB,EAAE,EAAE;IACrB,KAAK,EAAE,EAAE;IACT,OAAO,EAAE,EAAE;IACX,UAAU,EAAE,EAAE;IACd,UAAU,EAAE,EAAE;IACd,WAAW,EAAE,EAAE;IACf,YAAY,EAAE,EAAE;IAChB,eAAe,EAAE,EAAE;IACnB,UAAU,EAAE;QAEV,MAAM,EAAN,iBAAM;QACN,MAAM,EAAN,iBAAM;QACN,IAAI,EAAJ,eAAI;KACL;IACD,UAAU,EAAE;QAEV,GAAG,EAAE,oBAAS;QACd,GAAG,EAAE,oBAAS;QACd,GAAG,EAAE,oBAAS;KACf;IACD,MAAM,EAAE,EAAE;IACV,iBAAiB,EAAE,EAAE;IACrB,iBAAiB,EAAE,EAAE;IACrB,mBAAmB,EAAE,EAAE;IACvB,gBAAgB,EAAE,EAAE;IACpB,iBAAiB,EAAE,EAAE;IACrB,uBAAuB,EAAE,EAAE;IAC3B,SAAS,EAAE,SAAS;CACrB,CAAC,CAAC;AAEH,MAAM,sBAAsB,GAAG,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;AACpF,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,qCAAqC,sBAAsB,EAAE,CAAC,CAAC;AACrG,MAAM,qBAAqB,GAAG,UAE7B,CAAC;AAEW,QAAA,eAAe,GAC1B,MAAA,qBAAqB,CAAC,kBAAkB,CAAC,mCAAI,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,GAAG,qBAAqB,EAAE,CAAC,CAAC","file":"factory-registry.js","sourcesContent":["import type { Transform, Parser } from '@visactor/vdataset';\n// eslint-disable-next-line no-duplicate-imports\nimport { fields, filter, fold, csvParser, dsvParser, tsvParser } from '@visactor/vdataset';\nimport type { IChartConstructor } from '../chart/interface';\nimport type { ISeriesConstructor } from '../series/interface';\nimport type { IComponentConstructor } from '../component/interface';\nimport type { MarkConstructor } from '../mark/interface';\nimport type { IRegionConstructor } from '../region/interface';\nimport type { ILayoutConstructor } from '../layout/interface';\nimport type { IChartPluginConstructor } from '../plugin/chart/interface';\nimport type { IComponentPluginConstructor } from '../plugin/components/interface';\nimport type { IApp, IGraphic } from '@visactor/vrender-core';\nimport type { GrammarTransformOption, IStageEventPlugin, VRenderComponentOptions } from './interface';\nimport type { MarkAnimationSpec } from '../animation/interface';\nimport type { ITriggerConstructor } from '../interaction/interface/trigger';\nimport type { IComposedEventConstructor } from '../index-harmony-simple';\nimport type { ITooltipProcessorConstructor } from '../component/tooltip/processor/interface';\nimport type { IVChartPluginConstructor } from '../plugin/vchart';\n\nexport interface IFactoryRegistry {\n charts: { [key: string]: IChartConstructor };\n series: { [key: string]: ISeriesConstructor };\n components: {\n [key: string]: {\n cmp: IComponentConstructor;\n alwaysCheck?: boolean;\n createOrder: number;\n };\n };\n graphicComponents: Record<string, (attrs: any, options?: VRenderComponentOptions) => IGraphic>;\n marks: { [key: string]: MarkConstructor };\n regions: { [key: string]: IRegionConstructor };\n animations: { [key: string]: (params?: any, preset?: any) => MarkAnimationSpec };\n implements: { [key: string]: (...args: any) => void };\n chartPlugin: { [key: string]: IChartPluginConstructor };\n vChartPlugin: { [key: string]: IVChartPluginConstructor };\n componentPlugin: { [key: string]: IComponentPluginConstructor };\n transforms: { [key: string]: Transform };\n dataParser: { [key: string]: Parser };\n layout: { [key: string]: ILayoutConstructor };\n grammarTransforms: Record<string, GrammarTransformOption>;\n stageEventPlugins: Record<string, IStageEventPlugin<any>>;\n interactionTriggers: Record<string, ITriggerConstructor>;\n composedEventMap: Record<string, IComposedEventConstructor>;\n tooltipProcessors: Record<string, ITooltipProcessorConstructor>;\n runtimePluginInstallers: Record<string, (app?: IApp) => void>;\n formatter?: (text: string | number | string[] | number[], datum: any, formatter: string | string[]) => any;\n}\n\nconst createFactoryRegistry = (): IFactoryRegistry => ({\n charts: {},\n series: {},\n components: {},\n graphicComponents: {},\n marks: {},\n regions: {},\n animations: {},\n implements: {},\n chartPlugin: {},\n vChartPlugin: {},\n componentPlugin: {},\n transforms: {\n // buildIn transforms\n fields,\n filter,\n fold\n },\n dataParser: {\n // buildIn parser\n csv: csvParser,\n dsv: dsvParser,\n tsv: tsvParser\n },\n layout: {},\n grammarTransforms: {},\n stageEventPlugins: {},\n interactionTriggers: {},\n composedEventMap: {},\n tooltipProcessors: {},\n runtimePluginInstallers: {},\n formatter: undefined\n});\n\nconst factoryRegistryVersion = typeof \"2.1.5\" === 'undefined' ? 'unknown' : \"2.1.5\";\nconst factoryRegistryKey = Symbol.for(`@visactor/vchart/factory-registry@${factoryRegistryVersion}`);\nconst globalFactoryRegistry = globalThis as typeof globalThis & {\n [factoryRegistryKey]?: IFactoryRegistry;\n};\n\nexport const factoryRegistry: IFactoryRegistry =\n globalFactoryRegistry[factoryRegistryKey] ?? (globalFactoryRegistry[factoryRegistryKey] = createFactoryRegistry());\n"]}
@@ -1,7 +1,7 @@
1
1
  import { VChart } from './vchart';
2
2
  import { Factory } from './factory';
3
3
  export { VChart, Factory };
4
- export declare const version = "2.1.4";
4
+ export declare const version = "2.1.5";
5
5
  export type { IVChart } from './interface';
6
6
  export type { IStateSpec, StateValueType } from '../compile/mark';
7
7
  export type { IRegion } from '../region/interface';
package/cjs/core/index.js CHANGED
@@ -35,7 +35,7 @@ Object.defineProperty(exports, "Factory", {
35
35
  get: function() {
36
36
  return factory_1.Factory;
37
37
  }
38
- }), exports.version = "2.1.4", __exportStar(require("../event/interface"), exports),
38
+ }), exports.version = "2.1.5", __exportStar(require("../event/interface"), exports),
39
39
  __exportStar(require("../theme/interface"), exports), __exportStar(require("../model/interface"), exports),
40
40
  __exportStar(require("./interface"), exports), __exportStar(require("../typings"), exports),
41
41
  __exportStar(require("../constant/base"), exports), __exportStar(require("../constant/data"), exports),
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,qCAAkC;AAGzB,uFAHA,eAAM,OAGA;AAFf,uCAAoC;AAEnB,wFAFR,iBAAO,OAEQ;AAGX,QAAA,OAAO,GAAG,OAAO,CAAC;AAO/B,qDAAmC;AACnC,qDAAmC;AACnC,qDAAmC;AAEnC,8CAA4B;AAC5B,6CAA2B;AAI3B,mDAAiC;AACjC,mDAAiC;AACjC,qDAAmC;AACnC,mDAAuD;AAA9C,2GAAA,cAAc,OAAA;AACvB,iDAAoD;AAA3C,4GAAA,cAAc,OAAA;AACvB,uDAA6D;AAApD,6GAAA,gBAAgB,OAAA;AACzB,2CAA+C;AAAtC,mGAAA,UAAU,OAAA;AAKnB,wDAAsC;AACtC,oDAAkC;AAGlC,qDAAmC;AAGnC,iDAA+B;AAG/B,oDAA4C;AAAnC,yGAAA,OAAO,OAAA;AAChB,oDAS2B;AARzB,6GAAA,WAAW,OAAA;AACX,gHAAA,cAAc,OAAA;AACd,4GAAA,UAAU,OAAA;AACV,2GAAA,SAAS,OAAA;AACT,4GAAA,UAAU,OAAA;AACV,4GAAA,UAAU,OAAA;AACV,4GAAA,UAAU,OAAA;AACV,8GAAA,YAAY,OAAA;AAEd,gFAA8E;AAArE,6GAAA,YAAY,OAAA;AACrB,4EAA2E;AAAlE,0GAAA,WAAW,OAAA;AAGpB,gDAA8B;AAC9B,uCAAmD;AAA1C,2GAAA,kBAAkB,OAAA;AAC3B,0CAAgD;AAAvC,mGAAA,WAAW,OAAA;AACpB,6CAAmG;AAA1F,yHAAA,6BAA6B,OAAA;AAAE,4HAAA,gCAAgC,OAAA;AACxE,oDAAmD;AAA1C,gGAAA,MAAM,OAAA;AACf,uCAAqC;AAA5B,6FAAA,IAAI,OAAA;AACb,qCAA2C;AAAlC,mGAAA,WAAW,OAAA","file":"index.js","sourcesContent":["/**\n * @description The core module of VChart, containing the necessary interfaces for using VChart.\n */\n\nimport { VChart } from './vchart';\nimport { Factory } from './factory';\n\nexport { VChart, Factory };\n\n// export the version\nexport const version = \"2.1.4\";\n\n// export necessary types\nexport type { IVChart } from './interface';\nexport type { IStateSpec, StateValueType } from '../compile/mark';\nexport type { IRegion } from '../region/interface';\n\nexport * from '../event/interface';\nexport * from '../theme/interface';\nexport * from '../model/interface';\n\nexport * from './interface';\nexport * from '../typings';\nexport type { IMarkGraphic, IGraphicContext } from '../mark/interface/';\n\n// some constants\nexport * from '../constant/base';\nexport * from '../constant/data';\nexport * from '../constant/layout';\nexport { AttributeLevel } from '../constant/attribute';\nexport { TransformLevel } from '../data/initialize';\nexport { STATE_VALUE_ENUM } from '../compile/mark/interface';\nexport { ChartEvent } from '../constant/event';\n\n/**\n * spec\n */\nexport * from '../typings/spec/index';\nexport * from '../typings/visual';\n\n// tooltip\nexport * from '../typings/tooltip';\n\n// theme\nexport * from '../theme/index';\n\n// vrender\nexport { vglobal } from '../vrender-bridge';\nexport {\n createGroup,\n createRichText,\n createText,\n createArc,\n createArea,\n createRect,\n createLine,\n createSymbol\n} from '../vrender-bridge';\nexport { ManualTicker } from '@visactor/vrender-animate/ticker/manual-ticker';\nexport { StreamLight } from '@visactor/vrender-animate/custom/streamLight';\n\n// utils\nexport * from '../util/space';\nexport { transformToGraphic } from '../util/style';\nexport { getSpecInfo } from '../component/util';\nexport { registerDataSetInstanceParser, registerDataSetInstanceTransform } from '../data/register';\nexport { lookup } from '../data/transforms/lookup';\nexport { warn } from '../util/debug';\nexport { measureText } from '../util/text';\n"]}
1
+ {"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,qCAAkC;AAGzB,uFAHA,eAAM,OAGA;AAFf,uCAAoC;AAEnB,wFAFR,iBAAO,OAEQ;AAGX,QAAA,OAAO,GAAG,OAAO,CAAC;AAO/B,qDAAmC;AACnC,qDAAmC;AACnC,qDAAmC;AAEnC,8CAA4B;AAC5B,6CAA2B;AAI3B,mDAAiC;AACjC,mDAAiC;AACjC,qDAAmC;AACnC,mDAAuD;AAA9C,2GAAA,cAAc,OAAA;AACvB,iDAAoD;AAA3C,4GAAA,cAAc,OAAA;AACvB,uDAA6D;AAApD,6GAAA,gBAAgB,OAAA;AACzB,2CAA+C;AAAtC,mGAAA,UAAU,OAAA;AAKnB,wDAAsC;AACtC,oDAAkC;AAGlC,qDAAmC;AAGnC,iDAA+B;AAG/B,oDAA4C;AAAnC,yGAAA,OAAO,OAAA;AAChB,oDAS2B;AARzB,6GAAA,WAAW,OAAA;AACX,gHAAA,cAAc,OAAA;AACd,4GAAA,UAAU,OAAA;AACV,2GAAA,SAAS,OAAA;AACT,4GAAA,UAAU,OAAA;AACV,4GAAA,UAAU,OAAA;AACV,4GAAA,UAAU,OAAA;AACV,8GAAA,YAAY,OAAA;AAEd,gFAA8E;AAArE,6GAAA,YAAY,OAAA;AACrB,4EAA2E;AAAlE,0GAAA,WAAW,OAAA;AAGpB,gDAA8B;AAC9B,uCAAmD;AAA1C,2GAAA,kBAAkB,OAAA;AAC3B,0CAAgD;AAAvC,mGAAA,WAAW,OAAA;AACpB,6CAAmG;AAA1F,yHAAA,6BAA6B,OAAA;AAAE,4HAAA,gCAAgC,OAAA;AACxE,oDAAmD;AAA1C,gGAAA,MAAM,OAAA;AACf,uCAAqC;AAA5B,6FAAA,IAAI,OAAA;AACb,qCAA2C;AAAlC,mGAAA,WAAW,OAAA","file":"index.js","sourcesContent":["/**\n * @description The core module of VChart, containing the necessary interfaces for using VChart.\n */\n\nimport { VChart } from './vchart';\nimport { Factory } from './factory';\n\nexport { VChart, Factory };\n\n// export the version\nexport const version = \"2.1.5\";\n\n// export necessary types\nexport type { IVChart } from './interface';\nexport type { IStateSpec, StateValueType } from '../compile/mark';\nexport type { IRegion } from '../region/interface';\n\nexport * from '../event/interface';\nexport * from '../theme/interface';\nexport * from '../model/interface';\n\nexport * from './interface';\nexport * from '../typings';\nexport type { IMarkGraphic, IGraphicContext } from '../mark/interface/';\n\n// some constants\nexport * from '../constant/base';\nexport * from '../constant/data';\nexport * from '../constant/layout';\nexport { AttributeLevel } from '../constant/attribute';\nexport { TransformLevel } from '../data/initialize';\nexport { STATE_VALUE_ENUM } from '../compile/mark/interface';\nexport { ChartEvent } from '../constant/event';\n\n/**\n * spec\n */\nexport * from '../typings/spec/index';\nexport * from '../typings/visual';\n\n// tooltip\nexport * from '../typings/tooltip';\n\n// theme\nexport * from '../theme/index';\n\n// vrender\nexport { vglobal } from '../vrender-bridge';\nexport {\n createGroup,\n createRichText,\n createText,\n createArc,\n createArea,\n createRect,\n createLine,\n createSymbol\n} from '../vrender-bridge';\nexport { ManualTicker } from '@visactor/vrender-animate/ticker/manual-ticker';\nexport { StreamLight } from '@visactor/vrender-animate/custom/streamLight';\n\n// utils\nexport * from '../util/space';\nexport { transformToGraphic } from '../util/style';\nexport { getSpecInfo } from '../component/util';\nexport { registerDataSetInstanceParser, registerDataSetInstanceTransform } from '../data/register';\nexport { lookup } from '../data/transforms/lookup';\nexport { warn } from '../util/debug';\nexport { measureText } from '../util/text';\n"]}
@@ -314,17 +314,12 @@ class VChart {
314
314
  }
315
315
  _reCompile(updateResult, morphConfig) {
316
316
  var _a, _b, _c, _d, _e, _f, _g;
317
- const shouldRestoreUserEvents = updateResult.reMake && !!this._chart;
318
317
  if (updateResult.reMake && (this._releaseData(), this._initDataSet(), null === (_a = this._chart) || void 0 === _a || _a.release(!1),
319
318
  this._chart = null), updateResult.reTransformSpec && (this._chartSpecTransformer = null),
320
319
  updateResult.changeTheme ? (this._setCurrentTheme(), this._setFontFamilyTheme(this.getTheme("fontFamily"))) : updateResult.changeBackground && (null === (_b = this._compiler) || void 0 === _b || _b.setBackground(this._getBackground())),
321
320
  updateResult.reMake) {
322
321
  const cacheGrammarForMorph = this.isAnimationEnable() && !1 !== (null == morphConfig ? void 0 : morphConfig.morph);
323
- null === (_c = this._compiler) || void 0 === _c || _c.releaseGrammar(!cacheGrammarForMorph),
324
- shouldRestoreUserEvents && this._userEvents.forEach((e => {
325
- var _a;
326
- return null === (_a = this._event) || void 0 === _a ? void 0 : _a.on(e.eType, e.query, e.handler);
327
- }));
322
+ null === (_c = this._compiler) || void 0 === _c || _c.releaseGrammar(!cacheGrammarForMorph);
328
323
  } else updateResult.reCompile && (null === (_d = this._compiler) || void 0 === _d || _d.clear({
329
324
  chart: this._chart,
330
325
  vChart: this