@visactor/vchart 1.12.1-alpha.0 → 1.12.1

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 (79) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +88 -53
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/chart/base/base-chart-transformer.js +2 -2
  6. package/cjs/chart/base/base-chart-transformer.js.map +1 -1
  7. package/cjs/chart/base/base-chart.js +12 -1
  8. package/cjs/chart/base/base-chart.js.map +1 -1
  9. package/cjs/compile/compilable-base.js +2 -1
  10. package/cjs/compile/util.js +1 -2
  11. package/cjs/component/axis/polar/axis.d.ts +1 -1
  12. package/cjs/component/axis/polar/axis.js +11 -9
  13. package/cjs/component/axis/polar/axis.js.map +1 -1
  14. package/cjs/component/axis/polar/util/common.d.ts +4 -1
  15. package/cjs/component/axis/polar/util/common.js +7 -2
  16. package/cjs/component/axis/polar/util/common.js.map +1 -1
  17. package/cjs/component/brush/brush.js +1 -1
  18. package/cjs/component/brush/brush.js.map +1 -1
  19. package/cjs/component/title/title.js +4 -2
  20. package/cjs/component/title/title.js.map +1 -1
  21. package/cjs/core/index.d.ts +1 -1
  22. package/cjs/core/index.js +1 -1
  23. package/cjs/core/index.js.map +1 -1
  24. package/cjs/data/transforms/add-property.js +1 -1
  25. package/cjs/data/transforms/add-property.js.map +1 -1
  26. package/cjs/data/transforms/copy-data-view.js +1 -1
  27. package/cjs/data/transforms/copy-data-view.js.map +1 -1
  28. package/cjs/data/transforms/dimension-statistics.js +1 -1
  29. package/cjs/data/transforms/dimension-statistics.js.map +1 -1
  30. package/cjs/data/transforms/stack-split.js +1 -1
  31. package/cjs/data/transforms/stack-split.js.map +1 -1
  32. package/cjs/plugin/chart/media-query/util/filter.js +5 -2
  33. package/cjs/plugin/chart/media-query/util/filter.js.map +1 -1
  34. package/cjs/plugin/components/tooltip-handler/base.js +3 -3
  35. package/cjs/plugin/components/tooltip-handler/base.js.map +1 -1
  36. package/cjs/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js +1 -1
  37. package/cjs/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js.map +1 -1
  38. package/cjs/series/pie/pie.js +4 -1
  39. package/cjs/series/pie/pie.js.map +1 -1
  40. package/cjs/series/progress/linear/linear.js +4 -2
  41. package/cjs/series/progress/linear/linear.js.map +1 -1
  42. package/esm/chart/base/base-chart-transformer.js +2 -2
  43. package/esm/chart/base/base-chart-transformer.js.map +1 -1
  44. package/esm/chart/base/base-chart.js +12 -1
  45. package/esm/chart/base/base-chart.js.map +1 -1
  46. package/esm/compile/compilable-base.js +2 -1
  47. package/esm/compile/util.js +1 -2
  48. package/esm/component/axis/polar/axis.d.ts +1 -1
  49. package/esm/component/axis/polar/axis.js +11 -9
  50. package/esm/component/axis/polar/axis.js.map +1 -1
  51. package/esm/component/axis/polar/util/common.d.ts +4 -1
  52. package/esm/component/axis/polar/util/common.js +7 -2
  53. package/esm/component/axis/polar/util/common.js.map +1 -1
  54. package/esm/component/brush/brush.js +1 -1
  55. package/esm/component/brush/brush.js.map +1 -1
  56. package/esm/component/title/title.js +4 -2
  57. package/esm/component/title/title.js.map +1 -1
  58. package/esm/core/index.d.ts +1 -1
  59. package/esm/core/index.js +1 -1
  60. package/esm/core/index.js.map +1 -1
  61. package/esm/data/transforms/add-property.js +1 -1
  62. package/esm/data/transforms/add-property.js.map +1 -1
  63. package/esm/data/transforms/copy-data-view.js +1 -1
  64. package/esm/data/transforms/copy-data-view.js.map +1 -1
  65. package/esm/data/transforms/dimension-statistics.js +1 -1
  66. package/esm/data/transforms/dimension-statistics.js.map +1 -1
  67. package/esm/data/transforms/stack-split.js +1 -1
  68. package/esm/data/transforms/stack-split.js.map +1 -1
  69. package/esm/plugin/chart/media-query/util/filter.js +5 -2
  70. package/esm/plugin/chart/media-query/util/filter.js.map +1 -1
  71. package/esm/plugin/components/tooltip-handler/base.js +3 -3
  72. package/esm/plugin/components/tooltip-handler/base.js.map +1 -1
  73. package/esm/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js +1 -1
  74. package/esm/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js.map +1 -1
  75. package/esm/series/pie/pie.js +4 -1
  76. package/esm/series/pie/pie.js.map +1 -1
  77. package/esm/series/progress/linear/linear.js +3 -2
  78. package/esm/series/progress/linear/linear.js.map +1 -1
  79. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAG3B,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAMxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAG5B,cAAc,kBAAkB,CAAC;AAKjC,cAAc,uBAAuB,CAAC;AAGtC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC","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 = \"1.12.1-alpha.0\";\n\n// export necessary types\nexport type { IVChart } from './interface';\nexport type { IStateSpec, StateValueType } from '../compile/mark';\n\nexport * from '../typings/spec/common';\nexport * from '../event/interface';\nexport * from '../theme/interface';\nexport * from './interface';\n\n// some constants\nexport * from '../constant/base';\n\n/**\n * spec\n */\nexport * from '../typings/spec/index';\n\n// tooltip\nexport * from '../typings/tooltip';\n\n// theme\nexport * from '../theme/index';\n\n// vrender\nexport { vglobal } from '@visactor/vrender-core';\n"]}
1
+ {"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAG3B,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAMhC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAG5B,cAAc,kBAAkB,CAAC;AAKjC,cAAc,uBAAuB,CAAC;AAGtC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC","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 = \"1.12.1\";\n\n// export necessary types\nexport type { IVChart } from './interface';\nexport type { IStateSpec, StateValueType } from '../compile/mark';\n\nexport * from '../typings/spec/common';\nexport * from '../event/interface';\nexport * from '../theme/interface';\nexport * from './interface';\n\n// some constants\nexport * from '../constant/base';\n\n/**\n * spec\n */\nexport * from '../typings/spec/index';\n\n// tooltip\nexport * from '../typings/tooltip';\n\n// theme\nexport * from '../theme/index';\n\n// vrender\nexport { vglobal } from '@visactor/vrender-core';\n"]}
@@ -1,6 +1,6 @@
1
1
  export const addVChartProperty = (data, op) => {
2
2
  const context = op.beforeCall();
3
- return data.forEach(((d, i) => op.call(d, i, context))), context.keyMap && (context.keyMap.clear(),
3
+ return data && data.forEach(((d, i) => op.call(d, i, context))), context.keyMap && (context.keyMap.clear(),
4
4
  context.keyMap = null), data;
5
5
  };
6
6
  //# sourceMappingURL=add-property.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/data/transforms/add-property.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAgB,EAAE,EAAyB,EAAE,EAAE;IAC/E,MAAM,OAAO,GAAG,EAAE,CAAC,UAAU,EAAE,CAAC;IAChC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;IAE/C,IAAI,OAAO,CAAC,MAAM,EAAE;QAClB,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACvB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;KACvB;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","file":"add-property.js","sourcesContent":["export type AddVChartPropertyContext = {\n keyMap: Map<string, number>;\n needDefaultSeriesField: boolean;\n defaultSeriesField?: string;\n getKey?: (d: any, i: number, context: AddVChartPropertyContext) => string;\n categoryField?: string;\n};\nexport interface IAddVChartPropertyOpt {\n beforeCall: () => AddVChartPropertyContext;\n call: (d: any, i: number, context: AddVChartPropertyContext) => void;\n}\n\nexport const addVChartProperty = (data: Array<any>, op: IAddVChartPropertyOpt) => {\n const context = op.beforeCall();\n data.forEach((d, i) => op.call(d, i, context));\n\n if (context.keyMap) {\n context.keyMap.clear();\n context.keyMap = null;\n }\n\n return data;\n};\n"]}
1
+ {"version":3,"sources":["../src/data/transforms/add-property.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAgB,EAAE,EAAyB,EAAE,EAAE;IAC/E,MAAM,OAAO,GAAG,EAAE,CAAC,UAAU,EAAE,CAAC;IAChC,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;IAEvD,IAAI,OAAO,CAAC,MAAM,EAAE;QAClB,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACvB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;KACvB;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","file":"add-property.js","sourcesContent":["export type AddVChartPropertyContext = {\n keyMap: Map<string, number>;\n needDefaultSeriesField: boolean;\n defaultSeriesField?: string;\n getKey?: (d: any, i: number, context: AddVChartPropertyContext) => string;\n categoryField?: string;\n};\nexport interface IAddVChartPropertyOpt {\n beforeCall: () => AddVChartPropertyContext;\n call: (d: any, i: number, context: AddVChartPropertyContext) => void;\n}\n\nexport const addVChartProperty = (data: Array<any>, op: IAddVChartPropertyOpt) => {\n const context = op.beforeCall();\n data && data.forEach((d, i) => op.call(d, i, context));\n\n if (context.keyMap) {\n context.keyMap.clear();\n context.keyMap = null;\n }\n\n return data;\n};\n"]}
@@ -4,7 +4,7 @@ import { DataView } from "@visactor/vdataset";
4
4
 
5
5
  function copyOneDataView(d, deep = !1) {
6
6
  let _deep = deep;
7
- return d.latestData instanceof DataView && (_deep = !1), _deep ? cloneDeep(d.latestData) : d.latestData.slice();
7
+ return d.latestData instanceof DataView && (_deep = !1), _deep ? cloneDeep(d.latestData) : d.latestData && d.latestData.slice();
8
8
  }
9
9
 
10
10
  export const copyDataView = (data, options) => 0 === data.length ? [] : 1 === data.length ? copyOneDataView(data[0], null == options ? void 0 : options.deep) : data.map((d => copyOneDataView(d, null == options ? void 0 : options.deep)));
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/data/transforms/copy-data-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,SAAS,eAAe,CAAC,CAAW,EAAE,IAAI,GAAG,KAAK;IAChD,IAAI,KAAK,GAAG,IAAI,CAAC;IACjB,IAAI,CAAC,CAAC,UAAU,YAAY,QAAQ,EAAE;QACpC,KAAK,GAAG,KAAK,CAAC;KACf;IACD,IAAI,KAAK,EAAE;QACT,OAAO,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;KAChC;IAED,OAAO,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;AAC9B,CAAC;AAQD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAqB,EAAE,OAA6B,EAAE,EAAE;IACnF,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACrB,OAAO,EAAE,CAAC;KACX;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACrB,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAC,CAAC;KAChD;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAC,CAAC,CAAC;AAC1D,CAAC,CAAC","file":"copy-data-view.js","sourcesContent":["import { cloneDeep } from '@visactor/vutils';\nimport { DataView } from '@visactor/vdataset';\n\nfunction copyOneDataView(d: DataView, deep = false) {\n let _deep = deep;\n if (d.latestData instanceof DataView) {\n _deep = false;\n }\n if (_deep) {\n return cloneDeep(d.latestData);\n }\n\n return d.latestData.slice();\n}\n\n/**\n * 聚合统计主要用于处理数据(诸如统计平均值,求和等),并返回计算后的数据结果\n * @param data\n * @param options\n * @returns\n */\nexport const copyDataView = (data: Array<DataView>, options?: ICopyDataViewOption) => {\n if (data.length === 0) {\n return [];\n }\n if (data.length === 1) {\n return copyOneDataView(data[0], options?.deep);\n }\n return data.map(d => copyOneDataView(d, options?.deep));\n};\n\nexport interface ICopyDataViewOption {\n deep?: boolean;\n}\n"]}
1
+ {"version":3,"sources":["../src/data/transforms/copy-data-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,SAAS,eAAe,CAAC,CAAW,EAAE,IAAI,GAAG,KAAK;IAChD,IAAI,KAAK,GAAG,IAAI,CAAC;IACjB,IAAI,CAAC,CAAC,UAAU,YAAY,QAAQ,EAAE;QACpC,KAAK,GAAG,KAAK,CAAC;KACf;IACD,IAAI,KAAK,EAAE;QACT,OAAO,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;KAChC;IAED,OAAO,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;AAC9C,CAAC;AAQD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAqB,EAAE,OAA6B,EAAE,EAAE;IACnF,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACrB,OAAO,EAAE,CAAC;KACX;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACrB,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAC,CAAC;KAChD;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAC,CAAC,CAAC;AAC1D,CAAC,CAAC","file":"copy-data-view.js","sourcesContent":["import { cloneDeep } from '@visactor/vutils';\nimport { DataView } from '@visactor/vdataset';\n\nfunction copyOneDataView(d: DataView, deep = false) {\n let _deep = deep;\n if (d.latestData instanceof DataView) {\n _deep = false;\n }\n if (_deep) {\n return cloneDeep(d.latestData);\n }\n\n return d.latestData && d.latestData.slice();\n}\n\n/**\n * 聚合统计主要用于处理数据(诸如统计平均值,求和等),并返回计算后的数据结果\n * @param data\n * @param options\n * @returns\n */\nexport const copyDataView = (data: Array<DataView>, options?: ICopyDataViewOption) => {\n if (data.length === 0) {\n return [];\n }\n if (data.length === 1) {\n return copyOneDataView(data[0], options?.deep);\n }\n return data.map(d => copyOneDataView(d, options?.deep));\n};\n\nexport interface ICopyDataViewOption {\n deep?: boolean;\n}\n"]}
@@ -33,7 +33,7 @@ export const dimensionStatisticsOfSimpleData = (latestData, fields, dataFields)
33
33
  result[key] = {};
34
34
  const dataFieldInKey = null == dataFields ? void 0 : dataFields[key], operations = f.operations, isNumberField = operations.some((op => "min" === op || "max" === op || "allValid" === op));
35
35
  let allValid = !0;
36
- fValues.length = 0, latestData.forEach((d => {
36
+ fValues.length = 0, latestData && latestData.forEach((d => {
37
37
  d && fValues.push(d[key]);
38
38
  }));
39
39
  const len = fValues.length;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/data/transforms/dimension-statistics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI9C,MAAM,OAAO,GAAG;IACd,GAAG,EAAE,CAAC,GAAU,EAAE,EAAE;QAClB,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;IACD,GAAG,EAAE,CAAC,GAAU,EAAE,EAAE;QAClB,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;IACD,WAAW,EAAE,CAAC,GAAU,EAA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,CAAC;SACpC;QAED,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;YAEtB,IAAI,CAAC,CAAC,SAAS,EAAE;gBACf,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC;aAC/B;iBAAM;gBACL,IAAI,cAAc,IAAI,cAAc,CAAC,sBAAsB,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE;oBAC5F,IAAI,EAAE,KAAK,QAAQ,EAAE;wBACnB,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;wBAChD,OAAO;qBACR;iBACF;qBAAM,IAAI,EAAE,KAAK,UAAU,EAAE;oBAC5B,OAAO;iBACR;gBAED,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;gBAEvC,IAAI,EAAE,KAAK,WAAW,EAAE;oBACtB,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;iBACnC;gBACD,IAAI,EAAE,KAAK,WAAW,EAAE;oBACtB,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;iBACnC;aACF;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,aAAa,EAAE;YACjB,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,GAAG,QAAQ,CAAC;SACjC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","file":"dimension-statistics.js","sourcesContent":["import { isNil, isFunction, minInArray, maxInArray } from '@visactor/vutils';\nimport type { IFieldsMeta } from '../../typings/spec';\nimport { couldBeValidNumber } from '../../util/type';\nimport { mergeFields } from '../../util/data';\nimport type { DataView } from '@visactor/vdataset';\nimport type { Datum } from '../../typings';\n\nconst methods = {\n min: (arr: any[]) => {\n return arr.length ? minInArray(arr.map(n => n * 1)) : 0;\n },\n max: (arr: any[]) => {\n return arr.length ? maxInArray(arr.map(n => n * 1)) : 0;\n },\n 'array-min': (arr: any[]) => {\n return arr.length ? minInArray(arr.map(n => n * 1)) : 0;\n },\n 'array-max': (arr: any[]) => {\n return arr.length ? maxInArray(arr.map(n => n * 1)) : 0;\n },\n values: (arr: any[]) => {\n const map = {};\n const res: any[] = [];\n\n for (const entry of arr) {\n if (!map[entry]) {\n res.push(entry);\n map[entry] = 1;\n }\n }\n\n return res;\n }\n};\n\nexport type StatisticOperations = Array<'max' | 'min' | 'values' | 'array-max' | 'array-min' | 'allValid'>;\n\nexport interface IStatisticsOption {\n fields: {\n key: string;\n operations: StatisticOperations;\n filter?: (fv: any) => boolean;\n customize?: { max: number; min: number } | any[];\n }[];\n // operations: Array<'max' | 'min' | 'values'>;\n target?: 'parser' | 'latest';\n}\n\n/**\n * 聚合统计主要用于处理数据(诸如统计平均值,求和等),并返回计算后的数据结果\n * @param data\n * @param options\n * @returns\n */\nexport const dimensionStatistics = (data: Array<DataView>, op: IStatisticsOption) => {\n // const operations = op.operations;\n let fields = op.fields;\n if (isFunction(fields)) {\n fields = fields();\n }\n if (!fields?.length || !data?.length) {\n return {};\n }\n\n // merge same key\n fields = mergeFields([], fields);\n\n const dataKey = op.target === 'parser' ? 'parserData' : 'latestData';\n const latestData = data[0][dataKey] ? data[0][dataKey] : data || [];\n const dataFields = data[0].getFields?.() as Record<\n /** 字段key */\n string,\n IFieldsMeta\n >;\n\n return dimensionStatisticsOfSimpleData(latestData, fields, dataFields);\n};\n\n/**\n * 聚合统计主要用于处理数据(诸如统计平均值,求和等),并返回计算后的数据结果\n * @param data\n * @param options\n * @returns\n */\nexport const dimensionStatisticsOfSimpleData = (\n latestData: Datum[],\n fields: {\n key: string;\n operations: StatisticOperations;\n filter?: (fv: any) => boolean;\n customize?: { max: number; min: number } | any[];\n }[],\n dataFields?: Record<\n /** 字段key */\n string,\n IFieldsMeta\n >\n) => {\n const result = {};\n\n let fValues: any[] = [];\n let nextFValues: any[] = [];\n fields.forEach(f => {\n const key = f.key;\n // NOTE: the same key in fields has been merge already\n result[key] = {};\n const dataFieldInKey = dataFields?.[key];\n const operations: StatisticOperations = f.operations;\n const isNumberField = operations.some(op => op === 'min' || op === 'max' || op === 'allValid');\n let allValid = true;\n fValues.length = 0;\n\n latestData.forEach((d: Datum) => {\n if (d) {\n fValues.push(d[key]);\n }\n });\n const len = fValues.length;\n\n if (isNumberField) {\n nextFValues.length = 0;\n fValues.forEach((item, i) => {\n if (couldBeValidNumber(item)) {\n nextFValues.push(item);\n }\n });\n const t = fValues;\n fValues = nextFValues;\n nextFValues = t;\n // fValues = fValues.filter(couldBeValidNumber);\n allValid = fValues.length === len;\n } else if (operations.some(op => op === 'array-min' || op === 'array-max')) {\n fValues = fValues.reduce((res, entry) => {\n if (entry) {\n entry.forEach((d: any) => {\n if (couldBeValidNumber(d)) {\n res.push(d);\n }\n });\n }\n\n return res;\n }, []);\n } else {\n fValues = fValues.filter((entry: any) => entry !== undefined);\n }\n\n if (f.filter) {\n fValues = fValues.filter(f.filter);\n }\n\n operations.forEach(op => {\n // @chensij 如果指定了计算的domain结果,则忽略计算(目前该逻辑仅在dot series中维护,因为dot series期望在filter data之后x轴改变domain,y轴不改变domain)\n if (f.customize) {\n result[key][op] = f.customize;\n } else {\n if (dataFieldInKey && dataFieldInKey.lockStatisticsByDomain && !isNil(dataFieldInKey.domain)) {\n if (op === 'values') {\n result[key][op] = dataFieldInKey.domain.slice();\n return;\n }\n } else if (op === 'allValid') {\n return;\n }\n\n result[key][op] = methods[op](fValues);\n\n if (op === 'array-max') {\n result[key].max = result[key][op];\n }\n if (op === 'array-min') {\n result[key].min = result[key][op];\n }\n }\n });\n\n if (isNumberField) {\n result[key].allValid = allValid;\n }\n });\n\n return result;\n};\n"]}
1
+ {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K,UAAU,EAAE;oBAC5B,OAAO;iBACR;gBAED,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;gBAEvC,IAAI,EAAE,KAAK,WAAW,EAAE;oBACtB,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;iBACnC;gBACD,IAAI,EAAE,KAAK,WAAW,EAAE;oBACtB,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;iBACnC;aACF;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,aAAa,EAAE;YACjB,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,GAAG,QAAQ,CAAC;SACjC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","file":"dimension-statistics.js","sourcesContent":["import { isNil, isFunction, minInArray, maxInArray } from '@visactor/vutils';\nimport type { IFieldsMeta } from '../../typings/spec';\nimport { couldBeValidNumber } from '../../util/type';\nimport { mergeFields } from '../../util/data';\nimport type { DataView } from '@visactor/vdataset';\nimport type { Datum } from '../../typings';\n\nconst methods = {\n min: (arr: any[]) => {\n return arr.length ? minInArray(arr.map(n => n * 1)) : 0;\n },\n max: (arr: any[]) => {\n return arr.length ? maxInArray(arr.map(n => n * 1)) : 0;\n },\n 'array-min': (arr: any[]) => {\n return arr.length ? minInArray(arr.map(n => n * 1)) : 0;\n },\n 'array-max': (arr: any[]) => {\n return arr.length ? maxInArray(arr.map(n => n * 1)) : 0;\n },\n values: (arr: any[]) => {\n const map = {};\n const res: any[] = [];\n\n for (const entry of arr) {\n if (!map[entry]) {\n res.push(entry);\n map[entry] = 1;\n }\n }\n\n return res;\n }\n};\n\nexport type StatisticOperations = Array<'max' | 'min' | 'values' | 'array-max' | 'array-min' | 'allValid'>;\n\nexport interface IStatisticsOption {\n fields: {\n key: string;\n operations: StatisticOperations;\n filter?: (fv: any) => boolean;\n customize?: { max: number; min: number } | any[];\n }[];\n // operations: Array<'max' | 'min' | 'values'>;\n target?: 'parser' | 'latest';\n}\n\n/**\n * 聚合统计主要用于处理数据(诸如统计平均值,求和等),并返回计算后的数据结果\n * @param data\n * @param options\n * @returns\n */\nexport const dimensionStatistics = (data: Array<DataView>, op: IStatisticsOption) => {\n // const operations = op.operations;\n let fields = op.fields;\n if (isFunction(fields)) {\n fields = fields();\n }\n if (!fields?.length || !data?.length) {\n return {};\n }\n\n // merge same key\n fields = mergeFields([], fields);\n\n const dataKey = op.target === 'parser' ? 'parserData' : 'latestData';\n const latestData = data[0][dataKey] ? data[0][dataKey] : data || [];\n const dataFields = data[0].getFields?.() as Record<\n /** 字段key */\n string,\n IFieldsMeta\n >;\n\n return dimensionStatisticsOfSimpleData(latestData, fields, dataFields);\n};\n\n/**\n * 聚合统计主要用于处理数据(诸如统计平均值,求和等),并返回计算后的数据结果\n * @param data\n * @param options\n * @returns\n */\nexport const dimensionStatisticsOfSimpleData = (\n latestData: Datum[],\n fields: {\n key: string;\n operations: StatisticOperations;\n filter?: (fv: any) => boolean;\n customize?: { max: number; min: number } | any[];\n }[],\n dataFields?: Record<\n /** 字段key */\n string,\n IFieldsMeta\n >\n) => {\n const result = {};\n\n let fValues: any[] = [];\n let nextFValues: any[] = [];\n fields.forEach(f => {\n const key = f.key;\n // NOTE: the same key in fields has been merge already\n result[key] = {};\n const dataFieldInKey = dataFields?.[key];\n const operations: StatisticOperations = f.operations;\n const isNumberField = operations.some(op => op === 'min' || op === 'max' || op === 'allValid');\n let allValid = true;\n fValues.length = 0;\n\n latestData &&\n latestData.forEach((d: Datum) => {\n if (d) {\n fValues.push(d[key]);\n }\n });\n const len = fValues.length;\n\n if (isNumberField) {\n nextFValues.length = 0;\n fValues.forEach((item, i) => {\n if (couldBeValidNumber(item)) {\n nextFValues.push(item);\n }\n });\n const t = fValues;\n fValues = nextFValues;\n nextFValues = t;\n // fValues = fValues.filter(couldBeValidNumber);\n allValid = fValues.length === len;\n } else if (operations.some(op => op === 'array-min' || op === 'array-max')) {\n fValues = fValues.reduce((res, entry) => {\n if (entry) {\n entry.forEach((d: any) => {\n if (couldBeValidNumber(d)) {\n res.push(d);\n }\n });\n }\n\n return res;\n }, []);\n } else {\n fValues = fValues.filter((entry: any) => entry !== undefined);\n }\n\n if (f.filter) {\n fValues = fValues.filter(f.filter);\n }\n\n operations.forEach(op => {\n // @chensij 如果指定了计算的domain结果,则忽略计算(目前该逻辑仅在dot series中维护,因为dot series期望在filter data之后x轴改变domain,y轴不改变domain)\n if (f.customize) {\n result[key][op] = f.customize;\n } else {\n if (dataFieldInKey && dataFieldInKey.lockStatisticsByDomain && !isNil(dataFieldInKey.domain)) {\n if (op === 'values') {\n result[key][op] = dataFieldInKey.domain.slice();\n return;\n }\n } else if (op === 'allValid') {\n return;\n }\n\n result[key][op] = methods[op](fValues);\n\n if (op === 'array-max') {\n result[key].max = result[key][op];\n }\n if (op === 'array-min') {\n result[key].min = result[key][op];\n }\n }\n });\n\n if (isNumberField) {\n result[key].allValid = allValid;\n }\n });\n\n return result;\n};\n"]}
@@ -8,7 +8,7 @@ export const stackSplit = (data, op) => {
8
8
  const lastFieldIndex = fields.length - 1;
9
9
  let nextNode, leaf, temp = result;
10
10
  return data.forEach((dv => {
11
- dv.latestData.forEach((d => {
11
+ dv.latestData && dv.latestData.forEach((d => {
12
12
  temp = result;
13
13
  for (let i = 0; i < fields.length; i++) {
14
14
  const f = fields[i], fV = d[f];
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/data/transforms/stack-split.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAQzC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAqB,EAAE,EAAgB,EAAE,EAAE;IACpE,MAAM,MAAM,GAAqB;QAC/B,KAAK,EAAE,E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AC,IAAI,CAAC,CAAC,CAAC,CAAC;iBACrB;qBAAM;oBACL,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAyB,CAAC;iBAC/C;aACF;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","file":"stack-split.js","sourcesContent":["import type { ISeriesStackData, ISeriesStackDataLeaf, ISeriesStackDataNode } from '../../series/interface';\nimport { isNil } from '@visactor/vutils';\nimport type { DataView } from '@visactor/vdataset';\nimport type { Datum } from '../../typings';\n\nexport interface IStackOption {\n fields: string[];\n}\n\nexport const stackSplit = (data: Array<DataView>, op: IStackOption) => {\n const result: ISeriesStackData = {\n nodes: {}\n };\n const { fields } = op;\n if (!fields?.length) {\n return result;\n }\n const lastFieldIndex = fields.length - 1;\n let temp: ISeriesStackDataNode = result;\n let nextNode: ISeriesStackDataNode;\n let leaf: ISeriesStackDataLeaf;\n data.forEach(dv => {\n dv.latestData.forEach((d: Datum) => {\n temp = result;\n for (let i = 0; i < fields.length; i++) {\n const f = fields[i];\n const fV = d[f];\n if (isNil(fV)) {\n break;\n }\n temp.groupField = f;\n if (!temp.nodes[fV]) {\n if (i === lastFieldIndex) {\n temp.nodes[fV] = { values: [] };\n } else {\n nextNode = { nodes: {} };\n temp.nodes[fV] = nextNode;\n }\n }\n if (i === lastFieldIndex) {\n leaf = temp.nodes[fV] as ISeriesStackDataLeaf;\n leaf.values.push(d);\n } else {\n temp = temp.nodes[fV] as ISeriesStackDataNode;\n }\n }\n });\n });\n return result;\n};\n"]}
1
+ {"version":3,"sources":["../src/data/transforms/stack-split.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAQzC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAqB,EAAE,EAAgB,EAAE,EAAE;IACpE,MAAM,MAAM,GAAqB;QAC/B,KAAK,EAAE,EAAE;KACV,CAAC;IACF,M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,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;qBACrB;yBAAM;wBACL,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAyB,CAAC;qBAC/C;iBACF;YACH,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","file":"stack-split.js","sourcesContent":["import type { ISeriesStackData, ISeriesStackDataLeaf, ISeriesStackDataNode } from '../../series/interface';\nimport { isNil } from '@visactor/vutils';\nimport type { DataView } from '@visactor/vdataset';\nimport type { Datum } from '../../typings';\n\nexport interface IStackOption {\n fields: string[];\n}\n\nexport const stackSplit = (data: Array<DataView>, op: IStackOption) => {\n const result: ISeriesStackData = {\n nodes: {}\n };\n const { fields } = op;\n if (!fields?.length) {\n return result;\n }\n const lastFieldIndex = fields.length - 1;\n let temp: ISeriesStackDataNode = result;\n let nextNode: ISeriesStackDataNode;\n let leaf: ISeriesStackDataLeaf;\n data.forEach(dv => {\n dv.latestData &&\n dv.latestData.forEach((d: Datum) => {\n temp = result;\n for (let i = 0; i < fields.length; i++) {\n const f = fields[i];\n const fV = d[f];\n if (isNil(fV)) {\n break;\n }\n temp.groupField = f;\n if (!temp.nodes[fV]) {\n if (i === lastFieldIndex) {\n temp.nodes[fV] = { values: [] };\n } else {\n nextNode = { nodes: {} };\n temp.nodes[fV] = nextNode;\n }\n }\n if (i === lastFieldIndex) {\n leaf = temp.nodes[fV] as ISeriesStackDataLeaf;\n leaf.values.push(d);\n } else {\n temp = temp.nodes[fV] as ISeriesStackDataNode;\n }\n }\n });\n });\n return result;\n};\n"]}
@@ -49,9 +49,12 @@ export const executeMediaQueryActionFilterType = (filterType = "chart", chartSpe
49
49
  const {specKey: specKey} = result, infoList = array(null !== (_f = null === (_e = chartSpecInfo.component) || void 0 === _e ? void 0 : _e[specKey]) && void 0 !== _f ? _f : []);
50
50
  null === (_h = array(null !== (_g = chartSpec[specKey]) && void 0 !== _g ? _g : [])) || void 0 === _h || _h.forEach(((componentSpec, i) => {
51
51
  const specInfo = infoList[i];
52
- specInfo.type === filterType && result.modelInfo.push(Object.assign(Object.assign({}, specInfo), {
52
+ specInfo && specInfo.type === filterType ? result.modelInfo.push(Object.assign(Object.assign({}, specInfo), {
53
53
  spec: componentSpec
54
- }));
54
+ })) : componentSpec && !1 === componentSpec.visible && result.modelInfo.push({
55
+ type: filterType,
56
+ spec: componentSpec
57
+ });
55
58
  }));
56
59
  } else {
57
60
  const componentTypes = Factory.getComponents().filter((({cmp: cmp}) => cmp.specKey === filterType)).map((({cmp: cmp}) => cmp.type));
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin/chart/media-query/util/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAG5D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAQnD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAKzD,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,aAAyC,OAAO,EAChD,MAAyD,EACzD,MAA4B,EAC5B,KAA2B,EAC3B,SAAc,EACd,aAA6B,EACE,EAAE;IACjC,MAAM,MAAM,GAAG,iCAAiC,CAAI,UAAU,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;IAC1F,uCACK,MAAM,KACT,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YACxC,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE;gBACjB,OAAO,IAAI,CAAC;aACb;YACD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;gBAC5B,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE;oBACjB,OA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} from '@visactor/vutils';\nimport type { IChartSpec } from '../../../../typings/spec/common';\n// eslint-disable-next-line no-duplicate-imports\nimport { Factory } from '../../../../core/factory';\nimport type {\n IMediaQueryAction,\n IMediaQueryActionFilterResult,\n IMediaQueryCondition,\n MediaQueryActionFilter,\n MediaQueryActionFilterType\n} from '../interface';\nimport { SeriesTypeEnum } from '../../../../series/interface';\nimport { ComponentTypeEnum } from '../../../../component/interface';\nimport { includeSpec } from '@visactor/vutils-extension';\nimport type { MaybeArray } from '../../../../typings';\nimport type { IChartSpecInfo } from '../../../../chart/interface';\n\n/** 执行元素过滤器 */\nexport const executeMediaQueryActionFilter = <T extends Record<string, unknown>>(\n filterType: MediaQueryActionFilterType = 'chart',\n filter: MaybeArray<MediaQueryActionFilter<T>> | undefined,\n action: IMediaQueryAction<T>,\n query: IMediaQueryCondition,\n chartSpec: any,\n chartSpecInfo: IChartSpecInfo\n): IMediaQueryActionFilterResult => {\n const result = executeMediaQueryActionFilterType<T>(filterType, chartSpec, chartSpecInfo);\n return {\n ...result,\n modelInfo: result.modelInfo.filter(info => {\n if (isNil(filter)) {\n return true;\n }\n return array(filter).some(f => {\n if (isFunction(f)) {\n return f(info, action, query);\n }\n // spec 模糊匹配\n return includeSpec(info.spec, f);\n });\n })\n };\n};\n\n/** 执行元素过滤器的 filterType 部分的筛选 */\nexport const executeMediaQueryActionFilterType = <T extends Record<string, unknown>>(\n filterType: MediaQueryActionFilterType = 'chart',\n chartSpec: any,\n chartSpecInfo: IChartSpecInfo\n): IMediaQueryActionFilterResult<T> => {\n const result: IMediaQueryActionFilterResult<T> = {\n modelInfo: []\n };\n\n if (filterType === 'chart') {\n result.isChart = true;\n result.modelInfo.push({\n spec: chartSpec,\n type: 'chart'\n });\n } else if (filterType === 'region') {\n result.modelType = 'region';\n result.specKey = 'region';\n\n chartSpec.region?.forEach((regionSpec: T, i: number) => {\n result.modelInfo.push({\n spec: regionSpec,\n specPath: ['region', i],\n type: 'region'\n });\n });\n } else if (filterType === 'series') {\n result.modelType = 'series';\n result.specKey = 'series';\n\n chartSpec.series?.forEach((seriesSpec: T, i: number) => {\n result.modelInfo.push({\n spec: seriesSpec,\n specPath: ['series', i],\n type: seriesSpec.type as string\n });\n });\n } else if (Object.values(SeriesTypeEnum).includes(filterType as SeriesTypeEnum)) {\n result.modelType = 'series';\n result.specKey = 'series';\n result.type = filterType as SeriesTypeEnum;\n\n chartSpec.series?.forEach((seriesSpec: T, i: number) => {\n if (seriesSpec.type === filterType) {\n result.modelInfo.push({\n spec: seriesSpec,\n specPath: ['series', i],\n type: filterType\n });\n }\n });\n } else if (Object.values(ComponentTypeEnum).includes(filterType as ComponentTypeEnum)) {\n result.modelType = 'component';\n result.type = filterType as ComponentTypeEnum;\n result.specKey = Factory.getComponentInKey(filterType)?.specKey as keyof IChartSpec;\n\n const { specKey } = result;\n const infoList = array(chartSpecInfo.component?.[specKey] ?? []);\n array(chartSpec[specKey] ?? [])?.forEach((componentSpec, i) => {\n const specInfo = infoList[i];\n if (specInfo.type === filterType) {\n result.modelInfo.push({\n ...specInfo,\n spec: componentSpec\n });\n }\n });\n } else {\n // 根据 specKey 进行匹配\n const componentTypes = Factory.getComponents()\n .filter(({ cmp }) => cmp.specKey === filterType)\n .map(({ cmp }) => cmp.type);\n if (componentTypes.length > 0) {\n result.modelType = 'component';\n const specKey = filterType as keyof IChartSpec;\n result.specKey = specKey;\n\n const infoList = array(chartSpecInfo.component?.[specKey] ?? []);\n array(chartSpec[specKey] ?? []).forEach((componentSpec, i) => {\n const specInfo = infoList[i];\n if (componentTypes.includes(specInfo.type as ComponentTypeEnum)) {\n result.modelInfo.push({\n ...specInfo,\n spec: componentSpec\n });\n }\n });\n }\n }\n\n return result;\n};\n"]}
1
+ {"version":3,"sources":["../src/plugin/chart/media-query/util/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAG5D,OAAO,EAAE,OAAO,EA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AAE,CAAC,GAAG,CAAC,OAAO,KAAK,UAAU,CAAC;aAC/C,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;YAC7B,MAAM,CAAC,SAAS,GAAG,WAAW,CAAC;YAC/B,MAAM,OAAO,GAAG,UAA8B,CAAC;YAC/C,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;YAEzB,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAA,MAAA,aAAa,CAAC,SAAS,0CAAG,OAAO,CAAC,mCAAI,EAAE,CAAC,CAAC;YACjE,KAAK,CAAC,MAAA,SAAS,CAAC,OAAO,CAAC,mCAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,CAAC,EAAE,EAAE;gBAC3D,MAAM,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;gBAC7B,IAAI,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAyB,CAAC,EAAE;oBAC/D,MAAM,CAAC,SAAS,CAAC,IAAI,iCAChB,QAAQ,KACX,IAAI,EAAE,aAAa,IACnB,CAAC;iBACJ;YACH,CAAC,CAAC,CAAC;SACJ;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","file":"filter.js","sourcesContent":["import { array, isFunction, isNil } from '@visactor/vutils';\nimport type { IChartSpec } from '../../../../typings/spec/common';\n// eslint-disable-next-line no-duplicate-imports\nimport { Factory } from '../../../../core/factory';\nimport type {\n IMediaQueryAction,\n IMediaQueryActionFilterResult,\n IMediaQueryCondition,\n MediaQueryActionFilter,\n MediaQueryActionFilterType\n} from '../interface';\nimport { SeriesTypeEnum } from '../../../../series/interface';\nimport { ComponentTypeEnum } from '../../../../component/interface';\nimport { includeSpec } from '@visactor/vutils-extension';\nimport type { MaybeArray } from '../../../../typings';\nimport type { IChartSpecInfo } from '../../../../chart/interface';\n\n/** 执行元素过滤器 */\nexport const executeMediaQueryActionFilter = <T extends Record<string, unknown>>(\n filterType: MediaQueryActionFilterType = 'chart',\n filter: MaybeArray<MediaQueryActionFilter<T>> | undefined,\n action: IMediaQueryAction<T>,\n query: IMediaQueryCondition,\n chartSpec: any,\n chartSpecInfo: IChartSpecInfo\n): IMediaQueryActionFilterResult => {\n const result = executeMediaQueryActionFilterType<T>(filterType, chartSpec, chartSpecInfo);\n\n return {\n ...result,\n modelInfo: result.modelInfo.filter(info => {\n if (isNil(filter)) {\n return true;\n }\n return array(filter).some(f => {\n if (isFunction(f)) {\n return f(info, action, query);\n }\n // spec 模糊匹配\n return includeSpec(info.spec, f);\n });\n })\n };\n};\n\n/** 执行元素过滤器的 filterType 部分的筛选 */\nexport const executeMediaQueryActionFilterType = <T extends Record<string, unknown>>(\n filterType: MediaQueryActionFilterType = 'chart',\n chartSpec: any,\n chartSpecInfo: IChartSpecInfo\n): IMediaQueryActionFilterResult<T> => {\n const result: IMediaQueryActionFilterResult<T> = {\n modelInfo: []\n };\n\n if (filterType === 'chart') {\n result.isChart = true;\n result.modelInfo.push({\n spec: chartSpec,\n type: 'chart'\n });\n } else if (filterType === 'region') {\n result.modelType = 'region';\n result.specKey = 'region';\n\n chartSpec.region?.forEach((regionSpec: T, i: number) => {\n result.modelInfo.push({\n spec: regionSpec,\n specPath: ['region', i],\n type: 'region'\n });\n });\n } else if (filterType === 'series') {\n result.modelType = 'series';\n result.specKey = 'series';\n\n chartSpec.series?.forEach((seriesSpec: T, i: number) => {\n result.modelInfo.push({\n spec: seriesSpec,\n specPath: ['series', i],\n type: seriesSpec.type as string\n });\n });\n } else if (Object.values(SeriesTypeEnum).includes(filterType as SeriesTypeEnum)) {\n result.modelType = 'series';\n result.specKey = 'series';\n result.type = filterType as SeriesTypeEnum;\n\n chartSpec.series?.forEach((seriesSpec: T, i: number) => {\n if (seriesSpec.type === filterType) {\n result.modelInfo.push({\n spec: seriesSpec,\n specPath: ['series', i],\n type: filterType\n });\n }\n });\n } else if (Object.values(ComponentTypeEnum).includes(filterType as ComponentTypeEnum)) {\n result.modelType = 'component';\n result.type = filterType as ComponentTypeEnum;\n result.specKey = Factory.getComponentInKey(filterType)?.specKey as keyof IChartSpec;\n\n const { specKey } = result;\n const infoList = array(chartSpecInfo.component?.[specKey] ?? []);\n array(chartSpec[specKey] ?? [])?.forEach((componentSpec, i) => {\n const specInfo = infoList[i];\n\n if (specInfo && specInfo.type === filterType) {\n result.modelInfo.push({\n ...specInfo,\n spec: componentSpec\n });\n } else if (componentSpec && componentSpec.visible === false) {\n result.modelInfo.push({\n type: filterType,\n spec: componentSpec\n });\n }\n });\n } else {\n // 根据 specKey 进行匹配\n const componentTypes = Factory.getComponents()\n .filter(({ cmp }) => cmp.specKey === filterType)\n .map(({ cmp }) => cmp.type);\n if (componentTypes.length > 0) {\n result.modelType = 'component';\n const specKey = filterType as keyof IChartSpec;\n result.specKey = specKey;\n\n const infoList = array(chartSpecInfo.component?.[specKey] ?? []);\n array(chartSpec[specKey] ?? []).forEach((componentSpec, i) => {\n const specInfo = infoList[i];\n if (componentTypes.includes(specInfo.type as ComponentTypeEnum)) {\n result.modelInfo.push({\n ...specInfo,\n spec: componentSpec\n });\n }\n });\n }\n }\n\n return result;\n};\n"]}
@@ -49,7 +49,7 @@ export class BaseTooltipHandler extends BasePlugin {
49
49
  changePositionOnly: changePositionOnly
50
50
  })), 0;
51
51
  }, this._getActualTooltipPosition = (actualTooltip, params, tooltipBoxSize) => {
52
- var _a, _b, _c, _d, _e, _f, _g;
52
+ var _a, _b, _c, _d, _e, _f, _g, _h;
53
53
  const event = params.event, {tooltipSpec: tooltipSpec} = params, firstDimensionInfo = null === (_a = params.dimensionInfo) || void 0 === _a ? void 0 : _a[0], invalidPosition = {
54
54
  x: 1 / 0,
55
55
  y: 1 / 0
@@ -72,8 +72,8 @@ export class BaseTooltipHandler extends BasePlugin {
72
72
  if (isTrueBrowser(this._env) && !tooltipSpec.confine) {
73
73
  if (containerSize.width = window.innerWidth, containerSize.height = window.innerHeight,
74
74
  !isCanvas) {
75
- tooltipParentElementRect = null !== (_f = null == tooltipParentElement ? void 0 : tooltipParentElement.getBoundingClientRect()) && void 0 !== _f ? _f : invalidPosition;
76
- const chartElement = null !== (_g = this._compiler.getCanvas()) && void 0 !== _g ? _g : this._chartContainer, chartElementRect = null == chartElement ? void 0 : chartElement.getBoundingClientRect();
75
+ tooltipParentElementRect = null !== (_g = null === (_f = null == tooltipParentElement ? void 0 : tooltipParentElement.getBoundingClientRect) || void 0 === _f ? void 0 : _f.call(tooltipParentElement)) && void 0 !== _g ? _g : invalidPosition;
76
+ const chartElement = null !== (_h = this._compiler.getCanvas()) && void 0 !== _h ? _h : this._chartContainer, chartElementRect = null == chartElement ? void 0 : chartElement.getBoundingClientRect();
77
77
  relativePosOffset = {
78
78
  x: chartElementRect.x - tooltipParentElementRect.x,
79
79
  y: chartElementRect.y - tooltipParentElementRect.y
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin/components/tooltip-handler/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAGnF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAK9C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAWlD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,6BAA6B,EAC7B,yBAAyB,EACzB,yBAAyB,EACzB,uBAAuB,EACvB,6BAA6B,EAC7B,8BAA8B,EAC/B,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,OAAO,EACP,QAAQ,EACR,KAAK,EACL,mBAAmB,EACnB,WAAW,EACX,UAAU,EACX,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAMzD,OAAO,EA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AAC;IAED,mBAAmB;QACjB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAES,aAAa;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAExC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAQ,CAAC;QAChE,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,sBAAsB,CAAQ,CAAC;IAClF,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;;AAxtBe,0BAAO,GAAG,SAAS,CAAC","file":"base.js","sourcesContent":["import { DEFAULT_CHART_WIDTH, DEFAULT_CHART_HEIGHT } from '../../../constant/base';\nimport type { Options } from './constants';\n// eslint-disable-next-line no-duplicate-imports\nimport { DEFAULT_OPTIONS } from './constants';\nimport type { Maybe, IPoint, ILayoutPoint, RenderMode } from '../../../typings';\n// eslint-disable-next-line no-duplicate-imports\nimport type { ITooltipPositionFixedValue } from '../../../typings/tooltip/position';\n// eslint-disable-next-line no-duplicate-imports\nimport { isTrueBrowser } from '../../../util/env';\nimport type {\n TooltipData,\n ITooltipActual,\n TooltipActiveType,\n ITooltipHandler,\n ITooltipPositionActual,\n IGlobalTooltipPositionPattern\n} from '../../../typings/tooltip';\n// eslint-disable-next-line no-duplicate-imports\nimport type { TooltipFixedPosition } from '../../../typings/tooltip';\nimport { getScale } from './utils/common';\nimport {\n getActualTooltipPositionValue,\n getCartesianCrosshairRect,\n getHorizontalPositionType,\n getVerticalPositionType,\n isFixedTooltipPositionPattern,\n isGlobalTooltipPositionPattern\n} from './utils/position';\nimport type { ICartesianSeries } from '../../../series/interface';\nimport type { IGroup } from '@visactor/vrender-core';\nimport type { AABBBounds } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport {\n isNumber,\n isObject,\n isValidNumber,\n isValid,\n throttle,\n isNil,\n polygonContainPoint,\n pointInRect,\n isFunction\n} from '@visactor/vutils';\nimport type { IElement } from '@visactor/vgrammar-core';\nimport type { ILayoutModel } from '../../../model/interface';\nimport type { Compiler } from '../../../compile/compiler';\nimport type { IContainerSize } from '@visactor/vrender-components';\nimport { getTooltipAttributes } from './utils/attribute';\nimport type { IChartOption } from '../../../chart/interface';\nimport type { ITooltipSpec, Tooltip, TooltipHandlerParams } from '../../../component/tooltip';\n// eslint-disable-next-line no-duplicate-imports\nimport { TooltipResult } from '../../../component/tooltip';\nimport type { IComponentPlugin, IComponentPluginService } from '../interface';\nimport { BasePlugin } from '../../base/base-plugin';\nimport type { ITooltipAttributes } from './interface';\nimport { getFirstSeries } from '../../../util';\nimport { getTooltipPatternValue } from '../../../component/tooltip/utils';\n\ntype ChangeTooltipFunc = (visible: boolean, params: TooltipHandlerParams, data?: TooltipData) => TooltipResult;\n\ntype ChangeTooltipPositionFunc = (params: TooltipHandlerParams, data: TooltipData) => TooltipResult;\n\n/**\n * The tooltip handler class.\n */\nexport abstract class BaseTooltipHandler extends BasePlugin implements ITooltipHandler, IComponentPlugin {\n static readonly pluginType: 'component';\n static readonly specKey = 'tooltip';\n\n readonly type: string;\n\n /** 是否可见 */\n protected _visible = true;\n\n // protected _style: ITooltipStyle = {};\n\n protected _option: Options;\n\n protected _chartOption: IChartOption;\n\n protected _env: RenderMode;\n public get env() {\n return this._env;\n }\n\n protected _component: Tooltip;\n protected _attributes?: ITooltipAttributes | null = null;\n\n protected _chartContainer: Maybe<HTMLElement>;\n protected _compiler: Compiler;\n\n protected _isTooltipPaused: boolean;\n protected _isPointerEscaped: boolean;\n protected _cachePointerTimer: number;\n protected _cachePointerPosition: ILayoutPoint;\n protected _cacheTooltipPosition: ILayoutPoint;\n protected _cacheTooltipSize: IContainerSize;\n\n // tooltip 容器\n protected _container!: Maybe<IGroup | HTMLElement>;\n\n protected _isReleased: boolean = false;\n\n onAdd(service: IComponentPluginService<any>): void {\n super.onAdd(service);\n const component = service.component as Tooltip;\n this._component = component;\n this._chartOption = component.getOption() as any;\n this._env = this._chartOption.mode;\n this._chartContainer = this._chartOption.globalInstance.getContainer();\n this._compiler = component.getCompiler();\n this._initFromSpec();\n }\n\n showTooltip = (activeType: TooltipActiveType, data: TooltipData, params: TooltipHandlerParams) => {\n const { changePositionOnly } = params;\n\n if (changePositionOnly) {\n return this.changeTooltipPosition(params, data);\n }\n return this.changeTooltip(true, params, data);\n };\n\n /** 改变 tooltip 内容和位置(带 throttle 版本),返回是否遇到异常 */\n protected changeTooltip: ChangeTooltipFunc;\n\n /** 改变 tooltip 内容和位置(不带 throttle 版本),返回是否遇到异常 */\n protected _changeTooltip: ChangeTooltipFunc = (\n visible: boolean,\n params: TooltipHandlerParams,\n data?: TooltipData\n ) => {\n if (this._isReleased) {\n return TooltipResult.failed;\n }\n\n if (!visible) {\n this._clearAllCache();\n /** 关闭 tooltip */\n this._updateTooltip(false, params);\n return TooltipResult.success;\n }\n\n return this._changeTooltipPosition(params, data);\n };\n\n /** 改变 tooltip 位置(带 throttle 版本),返回是否遇到异常 */\n protected changeTooltipPosition: ChangeTooltipPositionFunc;\n\n /** 改变 tooltip 位置(不带 throttle 版本),返回是否遇到异常 */\n protected _changeTooltipPosition: ChangeTooltipPositionFunc = (params: TooltipHandlerParams, data: TooltipData) => {\n if (this._isReleased) {\n return TooltipResult.failed;\n }\n\n const event = params.event as MouseEvent;\n const { tooltipSpec, tooltipActual, changePositionOnly } = params;\n\n if (tooltipSpec.enterable) {\n if (!this._isPointerEscaped && this._isPointerMovingToTooltip(params)) {\n if (!this._isTooltipPaused) {\n this._isTooltipPaused = true;\n this._cachePointerTimer = setTimeout(() => {\n this._isPointerEscaped = true;\n }, 300) as unknown as number;\n }\n return TooltipResult.success;\n }\n this._isTooltipPaused = false;\n this._isPointerEscaped = false;\n clearTimeout(this._cachePointerTimer);\n this._cachePointerPosition = this._getPointerPositionRelativeToTooltipParent(params);\n }\n\n const activeType = tooltipActual.activeType;\n\n /** 用户自定义逻辑 */\n if (tooltipSpec.handler) {\n return tooltipSpec.handler.showTooltip?.(activeType, data, params) ?? TooltipResult.success;\n }\n\n /** 默认逻辑 */\n const pattern = tooltipSpec[activeType];\n if (!pattern) {\n return TooltipResult.failed;\n }\n\n // 计算 tooltip 位置\n const position = this._getActualTooltipPosition(\n tooltipActual,\n params,\n this._getTooltipBoxSize(tooltipActual, changePositionOnly)\n );\n tooltipActual.position = position;\n if (pattern.updatePosition) {\n tooltipActual.position = pattern.updatePosition(tooltipActual.position, data, params);\n }\n\n // 判断 tooltip 可见性\n let tooltipVisible = pattern?.visible !== false;\n if (\n !data ||\n event.type === 'pointerout' ||\n !tooltipActual.visible ||\n (!tooltipActual.title && !tooltipActual.content)\n ) {\n tooltipVisible = false;\n }\n\n this._updateTooltip(tooltipVisible, {\n ...params,\n changePositionOnly\n });\n return TooltipResult.success;\n };\n\n hideTooltip(params: TooltipHandlerParams): TooltipResult {\n return this.changeTooltip(false, params);\n }\n\n release(): void {\n this._clearAllCache();\n const spec = this._component.getSpec() ?? {};\n /** 用户自定义逻辑 */\n if (spec.handler) {\n spec.handler.release?.();\n return;\n }\n /** 默认逻辑 */\n this._removeTooltip();\n\n this._isReleased = true;\n }\n\n protected _clearAllCache() {\n this._isTooltipPaused = false;\n this._isPointerEscaped = false;\n clearTimeout(this._cachePointerTimer);\n this._cachePointerTimer = -1;\n this._cachePointerPosition = undefined;\n this._cacheTooltipPosition = undefined;\n this._cacheTooltipSize = undefined;\n }\n\n /* -----需要子类继承的方法开始----- */\n\n protected abstract _updateTooltip(visible: boolean, params: TooltipHandlerParams): void;\n protected abstract _removeTooltip(): void;\n\n /* -----需要子类继承的方法结束----- */\n\n protected _throttle(callback: any) {\n const tooltipSpec = this._component.getSpec();\n let wait: number;\n if (isNumber(tooltipSpec.throttleInterval)) {\n wait = tooltipSpec.throttleInterval;\n } else {\n if (tooltipSpec.renderMode !== 'html' || !tooltipSpec.transitionDuration) {\n wait = 10;\n } else {\n wait = 50;\n }\n }\n return throttle(callback, wait);\n }\n\n protected _getDefaultOption(): Options {\n const { offset } = this._component.getSpec();\n return {\n ...DEFAULT_OPTIONS,\n offsetX: offset?.x ?? DEFAULT_OPTIONS.offsetX,\n offsetY: offset?.y ?? DEFAULT_OPTIONS.offsetY\n };\n }\n\n /**\n * 计算实际的 tooltip 位置\n */\n protected _getActualTooltipPosition = (\n actualTooltip: ITooltipActual,\n params: TooltipHandlerParams,\n tooltipBoxSize: IContainerSize | undefined\n ): ITooltipPositionActual => {\n const event = params.event as MouseEvent;\n const { tooltipSpec } = params;\n const firstDimensionInfo = params.dimensionInfo?.[0];\n\n const invalidPosition = {\n x: Infinity,\n y: Infinity\n };\n\n let { offsetX, offsetY } = this._option;\n if (!tooltipSpec) {\n this._cacheTooltipPosition = undefined;\n return invalidPosition;\n }\n\n const { activeType, data } = actualTooltip;\n const pattern = tooltipSpec[activeType];\n const position = getTooltipPatternValue(pattern.position, data, params);\n const positionMode =\n getTooltipPatternValue(pattern.positionMode, data, params) ?? (activeType === 'mark' ? 'mark' : 'pointer');\n const tooltipParentElement = this._getParentElement(tooltipSpec);\n const { width: tooltipBoxWidth = 0, height: tooltipBoxHeight = 0 } = tooltipBoxSize ?? {};\n\n const isCanvas = tooltipSpec.renderMode === 'canvas';\n const canvasRect = params?.chart?.getCanvasRect();\n const canvasWidth = canvasRect?.width ?? DEFAULT_CHART_WIDTH;\n const canvasHeight = canvasRect?.height ?? DEFAULT_CHART_HEIGHT;\n let isFixedPosition = false;\n\n const containerSize = {\n width: 0,\n height: 0\n };\n let relativePosOffset = { x: 0, y: 0 };\n let tooltipParentElementRect: IPoint | DOMRect = { x: 0, y: 0 };\n let chartElementScale = 1;\n let tooltipParentElementScale = 1;\n\n if (isTrueBrowser(this._env) && !tooltipSpec.confine) {\n // 只有在 browser 模式下才可以获取到 window 对象\n containerSize.width = window.innerWidth;\n containerSize.height = window.innerHeight;\n\n if (!isCanvas) {\n tooltipParentElementRect = tooltipParentElement?.getBoundingClientRect() ?? invalidPosition;\n const chartElement = (this._compiler.getCanvas() ?? this._chartContainer) as HTMLElement;\n const chartElementRect = chartElement?.getBoundingClientRect();\n relativePosOffset = {\n x: chartElementRect.x - tooltipParentElementRect.x,\n y: chartElementRect.y - tooltipParentElementRect.y\n };\n chartElementScale = getScale(chartElement, chartElementRect);\n tooltipParentElementScale = getScale(tooltipParentElement, tooltipParentElementRect as DOMRect);\n }\n } else {\n containerSize.width = canvasWidth;\n containerSize.height = canvasHeight;\n }\n const tooltipSizeScale = tooltipParentElementScale / chartElementScale;\n\n /* 一、计算 left、top、right、bottom */\n let left: number | undefined;\n let top: number | undefined;\n let right: number | undefined;\n let bottom: number | undefined;\n\n let pointerFixedPositionX: TooltipFixedPosition = position as any;\n let pointerFixedPositionY: TooltipFixedPosition = position as any;\n\n const processCartesianFixedPositionX = ({ orient, mode, offset }: ITooltipPositionFixedValue) => {\n let x1: number;\n let x2: number;\n const model = params.model as ILayoutModel;\n const startPoint = model?.getLayoutStartPoint();\n offsetX = offset ?? offsetX;\n\n if (mode === 'mark') {\n isFixedPosition = true;\n const element = params.item as IElement;\n const bounds = element?.getBounds() as AABBBounds;\n if (bounds && startPoint) {\n x1 = bounds.x1 + startPoint.x;\n x2 = bounds.x2 + startPoint.x;\n }\n } else if (mode === 'crosshair' && firstDimensionInfo?.axis?.getCoordinateType() === 'cartesian') {\n isFixedPosition = true;\n const rect = getCartesianCrosshairRect(\n params.dimensionInfo,\n getFirstSeries(this._component.getRegions(), 'cartesian') as ICartesianSeries,\n startPoint\n );\n if (rect) {\n x1 = rect.start.x;\n x2 = rect.end.x;\n }\n } else {\n pointerFixedPositionX = orient;\n }\n\n if (isFixedPosition) {\n switch (getHorizontalPositionType(orient)) {\n case 'left':\n left = x1 - tooltipBoxWidth * tooltipSizeScale - offsetX;\n break;\n case 'right':\n left = x2 + offsetX;\n break;\n case 'center':\n left = (x1 + x2) / 2 - (tooltipBoxWidth * tooltipSizeScale) / 2;\n break;\n case 'centerLeft':\n left = (x1 + x2) / 2 - tooltipBoxWidth * tooltipSizeScale - offsetX;\n break;\n case 'centerRight':\n left = (x1 + x2) / 2 + offsetX;\n break;\n }\n }\n };\n const processCartesianFixedPositionY = ({ orient, mode, offset }: ITooltipPositionFixedValue) => {\n let y1: number;\n let y2: number;\n const model = params.model as ILayoutModel;\n const startPoint = model?.getLayoutStartPoint();\n offsetY = offset ?? offsetY;\n\n if (mode === 'mark') {\n isFixedPosition = true;\n const element = params.item as IElement;\n const bounds = element?.getBounds() as AABBBounds;\n if (bounds && startPoint) {\n y1 = bounds.y1 + startPoint.y;\n y2 = bounds.y2 + startPoint.y;\n }\n } else if (mode === 'crosshair' && firstDimensionInfo?.axis?.getCoordinateType() === 'cartesian') {\n isFixedPosition = true;\n const rect = getCartesianCrosshairRect(\n params.dimensionInfo,\n getFirstSeries(this._component.getRegions(), 'cartesian') as ICartesianSeries,\n startPoint\n );\n if (rect) {\n y1 = rect.start.y;\n y2 = rect.end.y;\n }\n } else {\n pointerFixedPositionY = orient;\n }\n\n if (isFixedPosition) {\n switch (getVerticalPositionType(orient)) {\n case 'top':\n top = y1 - tooltipBoxHeight * tooltipSizeScale - offsetY;\n break;\n case 'bottom':\n top = y2 + offsetY;\n break;\n case 'center':\n top = (y1 + y2) / 2 - (tooltipBoxHeight * tooltipSizeScale) / 2;\n break;\n case 'centerTop':\n top = (y1 + y2) / 2 - tooltipBoxHeight * tooltipSizeScale - offsetY;\n break;\n case 'centerBottom':\n top = (y1 + y2) / 2 + offsetY;\n break;\n }\n }\n };\n\n if (isObject(position)) {\n if (isGlobalTooltipPositionPattern(position)) {\n const {\n left: posLeft,\n right: posRight,\n top: posTop,\n bottom: posBottom\n } = position as IGlobalTooltipPositionPattern;\n left = getActualTooltipPositionValue(posLeft, event);\n top = getActualTooltipPositionValue(posTop, event);\n right = getActualTooltipPositionValue(posRight, event);\n bottom = getActualTooltipPositionValue(posBottom, event);\n } else if (isFixedTooltipPositionPattern(position)) {\n const { x, y } = position;\n if (isNumber(x) || isFunction(x)) {\n left = getActualTooltipPositionValue(x, event);\n } else {\n processCartesianFixedPositionX(x);\n }\n if (isNumber(y) || isFunction(y)) {\n top = getActualTooltipPositionValue(y, event);\n } else {\n processCartesianFixedPositionY(y);\n }\n }\n } else if (isValid(position)) {\n processCartesianFixedPositionX({ orient: position, mode: positionMode });\n processCartesianFixedPositionY({ orient: position, mode: positionMode });\n }\n\n /* 二、换算成 x 和 y */\n let x: number;\n let y: number;\n\n const { canvasX, canvasY } = event as any;\n if (isValidNumber(left)) {\n x = left;\n } else if (isValidNumber(right)) {\n x = canvasWidth - tooltipBoxWidth * tooltipSizeScale - right;\n } else {\n const x0 = canvasX;\n switch (getHorizontalPositionType(pointerFixedPositionX, 'right')) {\n case 'center':\n x = x0 - (tooltipBoxWidth * tooltipSizeScale) / 2;\n break;\n case 'left':\n case 'centerLeft':\n x = x0 - tooltipBoxWidth * tooltipSizeScale - offsetX;\n break;\n case 'right':\n case 'centerRight':\n x = x0 + offsetX;\n break;\n }\n }\n if (isValidNumber(top)) {\n y = top;\n } else if (isValidNumber(bottom)) {\n y = canvasHeight - tooltipBoxHeight * tooltipSizeScale - bottom;\n } else {\n const y0 = canvasY;\n switch (getVerticalPositionType(pointerFixedPositionY, 'bottom')) {\n case 'center':\n y = y0 - (tooltipBoxHeight * tooltipSizeScale) / 2;\n break;\n case 'top':\n case 'centerTop':\n y = y0 - tooltipBoxHeight * tooltipSizeScale - offsetY;\n break;\n case 'bottom':\n case 'centerBottom':\n y = y0 + offsetY;\n break;\n }\n }\n\n x *= chartElementScale;\n y *= chartElementScale;\n if (isTrueBrowser(this._env)) {\n x += relativePosOffset.x;\n y += relativePosOffset.y;\n }\n x /= tooltipParentElementScale;\n y /= tooltipParentElementScale;\n\n /* 三、确保tooltip在视区内 */\n const { width: containerWidth, height: containerHeight } = containerSize;\n\n const isLeftOut = () => x * tooltipParentElementScale + tooltipParentElementRect.x < 0;\n const isRightOut = () =>\n (x + tooltipBoxWidth) * tooltipParentElementScale + tooltipParentElementRect.x > containerWidth;\n const isTopOut = () => y * tooltipParentElementScale + tooltipParentElementRect.y < 0;\n const isBottomOut = () =>\n (y + tooltipBoxHeight) * tooltipParentElementScale + tooltipParentElementRect.y > containerHeight;\n\n const detectLeftFirst = () => {\n if (isLeftOut()) {\n // 位置不超出视区左界\n if (isFixedPosition) {\n x = -tooltipParentElementRect.x / tooltipParentElementScale;\n } else {\n if (getHorizontalPositionType(position as TooltipFixedPosition, 'right') === 'center') {\n x += offsetX + tooltipBoxWidth / 2;\n } else {\n x += offsetX * 2 + tooltipBoxWidth;\n }\n }\n }\n };\n const detectLeftLast = () => {\n if (isLeftOut()) {\n // 位置不超出视区左界\n x = -tooltipParentElementRect.x / tooltipParentElementScale;\n }\n };\n const detectRightFirst = () => {\n if (isRightOut()) {\n // 位置不超出视区右界\n if (isFixedPosition) {\n x = (containerWidth - tooltipParentElementRect.x) / tooltipParentElementScale - tooltipBoxWidth;\n } else {\n if (getHorizontalPositionType(position as TooltipFixedPosition, 'right') === 'center') {\n x -= offsetX + tooltipBoxWidth / 2;\n } else {\n x -= offsetX * 2 + tooltipBoxWidth;\n }\n }\n }\n };\n const detectRightLast = () => {\n if (isRightOut()) {\n // 位置不超出视区右界\n x = (containerWidth - tooltipParentElementRect.x) / tooltipParentElementScale - tooltipBoxWidth;\n }\n };\n const detectTopFirst = () => {\n if (isTopOut()) {\n // 位置不超出视区上界\n if (isFixedPosition) {\n y = -tooltipParentElementRect.y / tooltipParentElementScale;\n } else {\n if (getVerticalPositionType(position as TooltipFixedPosition, 'bottom') === 'center') {\n y += offsetY + tooltipBoxHeight / 2;\n } else {\n y += offsetY * 2 + tooltipBoxHeight;\n }\n }\n }\n };\n const detectTopLast = () => {\n if (isTopOut()) {\n // 位置不超出视区上界\n y = 0 - tooltipParentElementRect.y / tooltipParentElementScale;\n }\n };\n const detectBottomFirst = () => {\n if (isBottomOut()) {\n // 位置不超出视区下界\n if (isFixedPosition) {\n y = (containerHeight - tooltipParentElementRect.y) / tooltipParentElementScale - tooltipBoxHeight;\n } else {\n if (getVerticalPositionType(position as TooltipFixedPosition, 'bottom') === 'center') {\n y -= offsetY + tooltipBoxHeight / 2;\n } else {\n y -= offsetY * 2 + tooltipBoxHeight;\n }\n }\n }\n };\n const detectBottomLast = () => {\n if (isBottomOut()) {\n // 位置不超出视区下界\n y = (containerHeight - tooltipParentElementRect.y) / tooltipParentElementScale - tooltipBoxHeight;\n }\n };\n\n // 处理左右\n switch (getHorizontalPositionType(position as TooltipFixedPosition, 'right')) {\n case 'center':\n case 'centerLeft':\n case 'centerRight':\n if (isLeftOut()) {\n detectLeftFirst();\n detectRightLast();\n } else {\n detectRightFirst();\n detectLeftLast();\n }\n break;\n case 'left':\n detectLeftFirst();\n detectRightLast();\n break;\n case 'right':\n detectRightFirst();\n detectLeftLast();\n break;\n }\n // 处理上下\n switch (getVerticalPositionType(position as TooltipFixedPosition, 'bottom')) {\n case 'center':\n case 'centerTop':\n case 'centerBottom':\n if (isTopOut()) {\n detectTopFirst();\n detectBottomLast();\n } else {\n detectBottomFirst();\n detectTopLast();\n }\n break;\n case 'top':\n detectTopFirst();\n detectBottomLast();\n break;\n case 'bottom':\n detectBottomFirst();\n detectTopLast();\n break;\n }\n\n const result = { x, y };\n this._cacheTooltipPosition = result;\n this._cacheTooltipSize = { width: tooltipBoxWidth, height: tooltipBoxHeight };\n return result;\n };\n\n // 计算 tooltip 内容区域的宽高,并缓存结果\n protected _getTooltipBoxSize(actualTooltip: ITooltipActual, changePositionOnly: boolean): IContainerSize | undefined {\n if (!changePositionOnly || isNil(this._attributes)) {\n const chartTheme = this._chartOption?.getTheme() ?? {};\n this._attributes = getTooltipAttributes(actualTooltip, this._component.getSpec(), chartTheme);\n }\n const { panel, panelDomHeight } = this._attributes ?? {};\n // canvas模式下, size需要考虑border size, 目的是为了精准判断边界是否超出画布,达到confine效果\n // html模式不提供confine, 所以不考虑精准计算size\n const isCanvas = this._component.getSpec().renderMode === 'canvas';\n\n return {\n width: panel?.width + (isCanvas ? panel.lineWidth : 0),\n height: (panelDomHeight ?? panel?.height) + (isCanvas ? panel.lineWidth : 0)\n };\n }\n\n protected _getPointerPositionRelativeToTooltipParent(params: TooltipHandlerParams) {\n let { canvasX: x, canvasY: y } = params.event;\n const { tooltipSpec } = params;\n\n const invalidPosition = {\n x: Infinity,\n y: Infinity\n };\n\n const isCanvas = tooltipSpec.renderMode === 'canvas';\n const tooltipParentElement = this._getParentElement(tooltipSpec);\n\n let relativePosOffset = { x: 0, y: 0 };\n let tooltipParentElementRect: IPoint | DOMRect = { x: 0, y: 0 };\n let chartElementScale = 1;\n let tooltipParentElementScale = 1;\n\n if (isTrueBrowser(this._env) && !tooltipSpec.confine) {\n if (!isCanvas) {\n tooltipParentElementRect = tooltipParentElement?.getBoundingClientRect() ?? invalidPosition;\n const chartElement = (this._compiler.getCanvas() ?? this._chartContainer) as HTMLElement;\n const chartElementRect = chartElement?.getBoundingClientRect();\n relativePosOffset = {\n x: chartElementRect.x - tooltipParentElementRect.x,\n y: chartElementRect.y - tooltipParentElementRect.y\n };\n chartElementScale = getScale(chartElement, chartElementRect);\n tooltipParentElementScale = getScale(tooltipParentElement, tooltipParentElementRect as DOMRect);\n }\n }\n\n x *= chartElementScale;\n y *= chartElementScale;\n if (isTrueBrowser(this._env)) {\n x += relativePosOffset.x;\n y += relativePosOffset.y;\n }\n x /= tooltipParentElementScale;\n y /= tooltipParentElementScale;\n return { x, y };\n }\n\n protected _isPointerMovingToTooltip(params: TooltipHandlerParams) {\n if (!this._cacheTooltipPosition || !this._cacheTooltipSize || !this._cachePointerPosition) {\n return false;\n }\n const { width: tooltipWidth, height: tooltipHeight } = this._cacheTooltipSize;\n const { x: tooltipX = 0, y: tooltipY } = this._cacheTooltipPosition;\n\n const pos = this._getPointerPositionRelativeToTooltipParent(params);\n\n if (\n pointInRect(\n pos,\n {\n x1: tooltipX,\n y1: tooltipY,\n x2: tooltipX + tooltipWidth,\n y2: tooltipY + tooltipHeight\n },\n false\n )\n ) {\n return true;\n }\n\n // 确定 tooltip 四端点坐标\n const a = { x: tooltipX, y: tooltipY };\n const b = { x: a.x + tooltipWidth, y: a.y };\n const c = { x: a.x, y: a.y + tooltipHeight };\n const d = { x: b.x, y: c.y };\n const oldPos = this._cachePointerPosition;\n\n return (\n polygonContainPoint([oldPos, a, b], pos.x, pos.y) ||\n polygonContainPoint([oldPos, c, d], pos.x, pos.y) ||\n polygonContainPoint([oldPos, a, d], pos.x, pos.y) ||\n polygonContainPoint([oldPos, b, c], pos.x, pos.y)\n );\n }\n\n protected _getParentElement(spec: ITooltipSpec): HTMLElement {\n return spec.parentElement as any;\n }\n\n getTooltipContainer() {\n return this._container;\n }\n\n protected _initFromSpec() {\n this._option = this._getDefaultOption();\n // 为方法加防抖\n this.changeTooltip = this._throttle(this._changeTooltip) as any;\n this.changeTooltipPosition = this._throttle(this._changeTooltipPosition) as any;\n }\n\n reInit() {\n this._initFromSpec();\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/plugin/components/tooltip-handler/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAGnF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAK9C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAWlD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,6BAA6B,EAC7B,yBAAyB,EACzB,yBAAyB,EACzB,uBAAuB,EACvB,6BAA6B,EAC7B,8BAA8B,EAC/B,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,OAAO,EACP,QAAQ,EACR,KAAK,EACL,mBAAmB,EACnB,WAAW,EACX,UAAU,EACX,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAMzD,OA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CAAC;IACnC,CAAC;IAED,mBAAmB;QACjB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAES,aAAa;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAExC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAQ,CAAC;QAChE,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,sBAAsB,CAAQ,CAAC;IAClF,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;;AAxtBe,0BAAO,GAAG,SAAS,CAAC","file":"base.js","sourcesContent":["import { DEFAULT_CHART_WIDTH, DEFAULT_CHART_HEIGHT } from '../../../constant/base';\nimport type { Options } from './constants';\n// eslint-disable-next-line no-duplicate-imports\nimport { DEFAULT_OPTIONS } from './constants';\nimport type { Maybe, IPoint, ILayoutPoint, RenderMode } from '../../../typings';\n// eslint-disable-next-line no-duplicate-imports\nimport type { ITooltipPositionFixedValue } from '../../../typings/tooltip/position';\n// eslint-disable-next-line no-duplicate-imports\nimport { isTrueBrowser } from '../../../util/env';\nimport type {\n TooltipData,\n ITooltipActual,\n TooltipActiveType,\n ITooltipHandler,\n ITooltipPositionActual,\n IGlobalTooltipPositionPattern\n} from '../../../typings/tooltip';\n// eslint-disable-next-line no-duplicate-imports\nimport type { TooltipFixedPosition } from '../../../typings/tooltip';\nimport { getScale } from './utils/common';\nimport {\n getActualTooltipPositionValue,\n getCartesianCrosshairRect,\n getHorizontalPositionType,\n getVerticalPositionType,\n isFixedTooltipPositionPattern,\n isGlobalTooltipPositionPattern\n} from './utils/position';\nimport type { ICartesianSeries } from '../../../series/interface';\nimport type { IGroup } from '@visactor/vrender-core';\nimport type { AABBBounds } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport {\n isNumber,\n isObject,\n isValidNumber,\n isValid,\n throttle,\n isNil,\n polygonContainPoint,\n pointInRect,\n isFunction\n} from '@visactor/vutils';\nimport type { IElement } from '@visactor/vgrammar-core';\nimport type { ILayoutModel } from '../../../model/interface';\nimport type { Compiler } from '../../../compile/compiler';\nimport type { IContainerSize } from '@visactor/vrender-components';\nimport { getTooltipAttributes } from './utils/attribute';\nimport type { IChartOption } from '../../../chart/interface';\nimport type { ITooltipSpec, Tooltip, TooltipHandlerParams } from '../../../component/tooltip';\n// eslint-disable-next-line no-duplicate-imports\nimport { TooltipResult } from '../../../component/tooltip';\nimport type { IComponentPlugin, IComponentPluginService } from '../interface';\nimport { BasePlugin } from '../../base/base-plugin';\nimport type { ITooltipAttributes } from './interface';\nimport { getFirstSeries } from '../../../util';\nimport { getTooltipPatternValue } from '../../../component/tooltip/utils';\n\ntype ChangeTooltipFunc = (visible: boolean, params: TooltipHandlerParams, data?: TooltipData) => TooltipResult;\n\ntype ChangeTooltipPositionFunc = (params: TooltipHandlerParams, data: TooltipData) => TooltipResult;\n\n/**\n * The tooltip handler class.\n */\nexport abstract class BaseTooltipHandler extends BasePlugin implements ITooltipHandler, IComponentPlugin {\n static readonly pluginType: 'component';\n static readonly specKey = 'tooltip';\n\n readonly type: string;\n\n /** 是否可见 */\n protected _visible = true;\n\n // protected _style: ITooltipStyle = {};\n\n protected _option: Options;\n\n protected _chartOption: IChartOption;\n\n protected _env: RenderMode;\n public get env() {\n return this._env;\n }\n\n protected _component: Tooltip;\n protected _attributes?: ITooltipAttributes | null = null;\n\n protected _chartContainer: Maybe<HTMLElement>;\n protected _compiler: Compiler;\n\n protected _isTooltipPaused: boolean;\n protected _isPointerEscaped: boolean;\n protected _cachePointerTimer: number;\n protected _cachePointerPosition: ILayoutPoint;\n protected _cacheTooltipPosition: ILayoutPoint;\n protected _cacheTooltipSize: IContainerSize;\n\n // tooltip 容器\n protected _container!: Maybe<IGroup | HTMLElement>;\n\n protected _isReleased: boolean = false;\n\n onAdd(service: IComponentPluginService<any>): void {\n super.onAdd(service);\n const component = service.component as Tooltip;\n this._component = component;\n this._chartOption = component.getOption() as any;\n this._env = this._chartOption.mode;\n this._chartContainer = this._chartOption.globalInstance.getContainer();\n this._compiler = component.getCompiler();\n this._initFromSpec();\n }\n\n showTooltip = (activeType: TooltipActiveType, data: TooltipData, params: TooltipHandlerParams) => {\n const { changePositionOnly } = params;\n\n if (changePositionOnly) {\n return this.changeTooltipPosition(params, data);\n }\n return this.changeTooltip(true, params, data);\n };\n\n /** 改变 tooltip 内容和位置(带 throttle 版本),返回是否遇到异常 */\n protected changeTooltip: ChangeTooltipFunc;\n\n /** 改变 tooltip 内容和位置(不带 throttle 版本),返回是否遇到异常 */\n protected _changeTooltip: ChangeTooltipFunc = (\n visible: boolean,\n params: TooltipHandlerParams,\n data?: TooltipData\n ) => {\n if (this._isReleased) {\n return TooltipResult.failed;\n }\n\n if (!visible) {\n this._clearAllCache();\n /** 关闭 tooltip */\n this._updateTooltip(false, params);\n return TooltipResult.success;\n }\n\n return this._changeTooltipPosition(params, data);\n };\n\n /** 改变 tooltip 位置(带 throttle 版本),返回是否遇到异常 */\n protected changeTooltipPosition: ChangeTooltipPositionFunc;\n\n /** 改变 tooltip 位置(不带 throttle 版本),返回是否遇到异常 */\n protected _changeTooltipPosition: ChangeTooltipPositionFunc = (params: TooltipHandlerParams, data: TooltipData) => {\n if (this._isReleased) {\n return TooltipResult.failed;\n }\n\n const event = params.event as MouseEvent;\n const { tooltipSpec, tooltipActual, changePositionOnly } = params;\n\n if (tooltipSpec.enterable) {\n if (!this._isPointerEscaped && this._isPointerMovingToTooltip(params)) {\n if (!this._isTooltipPaused) {\n this._isTooltipPaused = true;\n this._cachePointerTimer = setTimeout(() => {\n this._isPointerEscaped = true;\n }, 300) as unknown as number;\n }\n return TooltipResult.success;\n }\n this._isTooltipPaused = false;\n this._isPointerEscaped = false;\n clearTimeout(this._cachePointerTimer);\n this._cachePointerPosition = this._getPointerPositionRelativeToTooltipParent(params);\n }\n\n const activeType = tooltipActual.activeType;\n\n /** 用户自定义逻辑 */\n if (tooltipSpec.handler) {\n return tooltipSpec.handler.showTooltip?.(activeType, data, params) ?? TooltipResult.success;\n }\n\n /** 默认逻辑 */\n const pattern = tooltipSpec[activeType];\n if (!pattern) {\n return TooltipResult.failed;\n }\n\n // 计算 tooltip 位置\n const position = this._getActualTooltipPosition(\n tooltipActual,\n params,\n this._getTooltipBoxSize(tooltipActual, changePositionOnly)\n );\n tooltipActual.position = position;\n if (pattern.updatePosition) {\n tooltipActual.position = pattern.updatePosition(tooltipActual.position, data, params);\n }\n\n // 判断 tooltip 可见性\n let tooltipVisible = pattern?.visible !== false;\n if (\n !data ||\n event.type === 'pointerout' ||\n !tooltipActual.visible ||\n (!tooltipActual.title && !tooltipActual.content)\n ) {\n tooltipVisible = false;\n }\n\n this._updateTooltip(tooltipVisible, {\n ...params,\n changePositionOnly\n });\n return TooltipResult.success;\n };\n\n hideTooltip(params: TooltipHandlerParams): TooltipResult {\n return this.changeTooltip(false, params);\n }\n\n release(): void {\n this._clearAllCache();\n const spec = this._component.getSpec() ?? {};\n /** 用户自定义逻辑 */\n if (spec.handler) {\n spec.handler.release?.();\n return;\n }\n /** 默认逻辑 */\n this._removeTooltip();\n\n this._isReleased = true;\n }\n\n protected _clearAllCache() {\n this._isTooltipPaused = false;\n this._isPointerEscaped = false;\n clearTimeout(this._cachePointerTimer);\n this._cachePointerTimer = -1;\n this._cachePointerPosition = undefined;\n this._cacheTooltipPosition = undefined;\n this._cacheTooltipSize = undefined;\n }\n\n /* -----需要子类继承的方法开始----- */\n\n protected abstract _updateTooltip(visible: boolean, params: TooltipHandlerParams): void;\n protected abstract _removeTooltip(): void;\n\n /* -----需要子类继承的方法结束----- */\n\n protected _throttle(callback: any) {\n const tooltipSpec = this._component.getSpec();\n let wait: number;\n if (isNumber(tooltipSpec.throttleInterval)) {\n wait = tooltipSpec.throttleInterval;\n } else {\n if (tooltipSpec.renderMode !== 'html' || !tooltipSpec.transitionDuration) {\n wait = 10;\n } else {\n wait = 50;\n }\n }\n return throttle(callback, wait);\n }\n\n protected _getDefaultOption(): Options {\n const { offset } = this._component.getSpec();\n return {\n ...DEFAULT_OPTIONS,\n offsetX: offset?.x ?? DEFAULT_OPTIONS.offsetX,\n offsetY: offset?.y ?? DEFAULT_OPTIONS.offsetY\n };\n }\n\n /**\n * 计算实际的 tooltip 位置\n */\n protected _getActualTooltipPosition = (\n actualTooltip: ITooltipActual,\n params: TooltipHandlerParams,\n tooltipBoxSize: IContainerSize | undefined\n ): ITooltipPositionActual => {\n const event = params.event as MouseEvent;\n const { tooltipSpec } = params;\n const firstDimensionInfo = params.dimensionInfo?.[0];\n\n const invalidPosition = {\n x: Infinity,\n y: Infinity\n };\n\n let { offsetX, offsetY } = this._option;\n if (!tooltipSpec) {\n this._cacheTooltipPosition = undefined;\n return invalidPosition;\n }\n\n const { activeType, data } = actualTooltip;\n const pattern = tooltipSpec[activeType];\n const position = getTooltipPatternValue(pattern.position, data, params);\n const positionMode =\n getTooltipPatternValue(pattern.positionMode, data, params) ?? (activeType === 'mark' ? 'mark' : 'pointer');\n const tooltipParentElement = this._getParentElement(tooltipSpec);\n const { width: tooltipBoxWidth = 0, height: tooltipBoxHeight = 0 } = tooltipBoxSize ?? {};\n\n const isCanvas = tooltipSpec.renderMode === 'canvas';\n const canvasRect = params?.chart?.getCanvasRect();\n const canvasWidth = canvasRect?.width ?? DEFAULT_CHART_WIDTH;\n const canvasHeight = canvasRect?.height ?? DEFAULT_CHART_HEIGHT;\n let isFixedPosition = false;\n\n const containerSize = {\n width: 0,\n height: 0\n };\n let relativePosOffset = { x: 0, y: 0 };\n let tooltipParentElementRect: IPoint | DOMRect = { x: 0, y: 0 };\n let chartElementScale = 1;\n let tooltipParentElementScale = 1;\n\n if (isTrueBrowser(this._env) && !tooltipSpec.confine) {\n // 只有在 browser 模式下才可以获取到 window 对象\n containerSize.width = window.innerWidth;\n containerSize.height = window.innerHeight;\n\n if (!isCanvas) {\n tooltipParentElementRect = tooltipParentElement?.getBoundingClientRect?.() ?? invalidPosition;\n const chartElement = (this._compiler.getCanvas() ?? this._chartContainer) as HTMLElement;\n const chartElementRect = chartElement?.getBoundingClientRect();\n relativePosOffset = {\n x: chartElementRect.x - tooltipParentElementRect.x,\n y: chartElementRect.y - tooltipParentElementRect.y\n };\n chartElementScale = getScale(chartElement, chartElementRect);\n tooltipParentElementScale = getScale(tooltipParentElement, tooltipParentElementRect as DOMRect);\n }\n } else {\n containerSize.width = canvasWidth;\n containerSize.height = canvasHeight;\n }\n const tooltipSizeScale = tooltipParentElementScale / chartElementScale;\n\n /* 一、计算 left、top、right、bottom */\n let left: number | undefined;\n let top: number | undefined;\n let right: number | undefined;\n let bottom: number | undefined;\n\n let pointerFixedPositionX: TooltipFixedPosition = position as any;\n let pointerFixedPositionY: TooltipFixedPosition = position as any;\n\n const processCartesianFixedPositionX = ({ orient, mode, offset }: ITooltipPositionFixedValue) => {\n let x1: number;\n let x2: number;\n const model = params.model as ILayoutModel;\n const startPoint = model?.getLayoutStartPoint();\n offsetX = offset ?? offsetX;\n\n if (mode === 'mark') {\n isFixedPosition = true;\n const element = params.item as IElement;\n const bounds = element?.getBounds() as AABBBounds;\n if (bounds && startPoint) {\n x1 = bounds.x1 + startPoint.x;\n x2 = bounds.x2 + startPoint.x;\n }\n } else if (mode === 'crosshair' && firstDimensionInfo?.axis?.getCoordinateType() === 'cartesian') {\n isFixedPosition = true;\n const rect = getCartesianCrosshairRect(\n params.dimensionInfo,\n getFirstSeries(this._component.getRegions(), 'cartesian') as ICartesianSeries,\n startPoint\n );\n if (rect) {\n x1 = rect.start.x;\n x2 = rect.end.x;\n }\n } else {\n pointerFixedPositionX = orient;\n }\n\n if (isFixedPosition) {\n switch (getHorizontalPositionType(orient)) {\n case 'left':\n left = x1 - tooltipBoxWidth * tooltipSizeScale - offsetX;\n break;\n case 'right':\n left = x2 + offsetX;\n break;\n case 'center':\n left = (x1 + x2) / 2 - (tooltipBoxWidth * tooltipSizeScale) / 2;\n break;\n case 'centerLeft':\n left = (x1 + x2) / 2 - tooltipBoxWidth * tooltipSizeScale - offsetX;\n break;\n case 'centerRight':\n left = (x1 + x2) / 2 + offsetX;\n break;\n }\n }\n };\n const processCartesianFixedPositionY = ({ orient, mode, offset }: ITooltipPositionFixedValue) => {\n let y1: number;\n let y2: number;\n const model = params.model as ILayoutModel;\n const startPoint = model?.getLayoutStartPoint();\n offsetY = offset ?? offsetY;\n\n if (mode === 'mark') {\n isFixedPosition = true;\n const element = params.item as IElement;\n const bounds = element?.getBounds() as AABBBounds;\n if (bounds && startPoint) {\n y1 = bounds.y1 + startPoint.y;\n y2 = bounds.y2 + startPoint.y;\n }\n } else if (mode === 'crosshair' && firstDimensionInfo?.axis?.getCoordinateType() === 'cartesian') {\n isFixedPosition = true;\n const rect = getCartesianCrosshairRect(\n params.dimensionInfo,\n getFirstSeries(this._component.getRegions(), 'cartesian') as ICartesianSeries,\n startPoint\n );\n if (rect) {\n y1 = rect.start.y;\n y2 = rect.end.y;\n }\n } else {\n pointerFixedPositionY = orient;\n }\n\n if (isFixedPosition) {\n switch (getVerticalPositionType(orient)) {\n case 'top':\n top = y1 - tooltipBoxHeight * tooltipSizeScale - offsetY;\n break;\n case 'bottom':\n top = y2 + offsetY;\n break;\n case 'center':\n top = (y1 + y2) / 2 - (tooltipBoxHeight * tooltipSizeScale) / 2;\n break;\n case 'centerTop':\n top = (y1 + y2) / 2 - tooltipBoxHeight * tooltipSizeScale - offsetY;\n break;\n case 'centerBottom':\n top = (y1 + y2) / 2 + offsetY;\n break;\n }\n }\n };\n\n if (isObject(position)) {\n if (isGlobalTooltipPositionPattern(position)) {\n const {\n left: posLeft,\n right: posRight,\n top: posTop,\n bottom: posBottom\n } = position as IGlobalTooltipPositionPattern;\n left = getActualTooltipPositionValue(posLeft, event);\n top = getActualTooltipPositionValue(posTop, event);\n right = getActualTooltipPositionValue(posRight, event);\n bottom = getActualTooltipPositionValue(posBottom, event);\n } else if (isFixedTooltipPositionPattern(position)) {\n const { x, y } = position;\n if (isNumber(x) || isFunction(x)) {\n left = getActualTooltipPositionValue(x, event);\n } else {\n processCartesianFixedPositionX(x);\n }\n if (isNumber(y) || isFunction(y)) {\n top = getActualTooltipPositionValue(y, event);\n } else {\n processCartesianFixedPositionY(y);\n }\n }\n } else if (isValid(position)) {\n processCartesianFixedPositionX({ orient: position, mode: positionMode });\n processCartesianFixedPositionY({ orient: position, mode: positionMode });\n }\n\n /* 二、换算成 x 和 y */\n let x: number;\n let y: number;\n\n const { canvasX, canvasY } = event as any;\n if (isValidNumber(left)) {\n x = left;\n } else if (isValidNumber(right)) {\n x = canvasWidth - tooltipBoxWidth * tooltipSizeScale - right;\n } else {\n const x0 = canvasX;\n switch (getHorizontalPositionType(pointerFixedPositionX, 'right')) {\n case 'center':\n x = x0 - (tooltipBoxWidth * tooltipSizeScale) / 2;\n break;\n case 'left':\n case 'centerLeft':\n x = x0 - tooltipBoxWidth * tooltipSizeScale - offsetX;\n break;\n case 'right':\n case 'centerRight':\n x = x0 + offsetX;\n break;\n }\n }\n if (isValidNumber(top)) {\n y = top;\n } else if (isValidNumber(bottom)) {\n y = canvasHeight - tooltipBoxHeight * tooltipSizeScale - bottom;\n } else {\n const y0 = canvasY;\n switch (getVerticalPositionType(pointerFixedPositionY, 'bottom')) {\n case 'center':\n y = y0 - (tooltipBoxHeight * tooltipSizeScale) / 2;\n break;\n case 'top':\n case 'centerTop':\n y = y0 - tooltipBoxHeight * tooltipSizeScale - offsetY;\n break;\n case 'bottom':\n case 'centerBottom':\n y = y0 + offsetY;\n break;\n }\n }\n\n x *= chartElementScale;\n y *= chartElementScale;\n if (isTrueBrowser(this._env)) {\n x += relativePosOffset.x;\n y += relativePosOffset.y;\n }\n x /= tooltipParentElementScale;\n y /= tooltipParentElementScale;\n\n /* 三、确保tooltip在视区内 */\n const { width: containerWidth, height: containerHeight } = containerSize;\n\n const isLeftOut = () => x * tooltipParentElementScale + tooltipParentElementRect.x < 0;\n const isRightOut = () =>\n (x + tooltipBoxWidth) * tooltipParentElementScale + tooltipParentElementRect.x > containerWidth;\n const isTopOut = () => y * tooltipParentElementScale + tooltipParentElementRect.y < 0;\n const isBottomOut = () =>\n (y + tooltipBoxHeight) * tooltipParentElementScale + tooltipParentElementRect.y > containerHeight;\n\n const detectLeftFirst = () => {\n if (isLeftOut()) {\n // 位置不超出视区左界\n if (isFixedPosition) {\n x = -tooltipParentElementRect.x / tooltipParentElementScale;\n } else {\n if (getHorizontalPositionType(position as TooltipFixedPosition, 'right') === 'center') {\n x += offsetX + tooltipBoxWidth / 2;\n } else {\n x += offsetX * 2 + tooltipBoxWidth;\n }\n }\n }\n };\n const detectLeftLast = () => {\n if (isLeftOut()) {\n // 位置不超出视区左界\n x = -tooltipParentElementRect.x / tooltipParentElementScale;\n }\n };\n const detectRightFirst = () => {\n if (isRightOut()) {\n // 位置不超出视区右界\n if (isFixedPosition) {\n x = (containerWidth - tooltipParentElementRect.x) / tooltipParentElementScale - tooltipBoxWidth;\n } else {\n if (getHorizontalPositionType(position as TooltipFixedPosition, 'right') === 'center') {\n x -= offsetX + tooltipBoxWidth / 2;\n } else {\n x -= offsetX * 2 + tooltipBoxWidth;\n }\n }\n }\n };\n const detectRightLast = () => {\n if (isRightOut()) {\n // 位置不超出视区右界\n x = (containerWidth - tooltipParentElementRect.x) / tooltipParentElementScale - tooltipBoxWidth;\n }\n };\n const detectTopFirst = () => {\n if (isTopOut()) {\n // 位置不超出视区上界\n if (isFixedPosition) {\n y = -tooltipParentElementRect.y / tooltipParentElementScale;\n } else {\n if (getVerticalPositionType(position as TooltipFixedPosition, 'bottom') === 'center') {\n y += offsetY + tooltipBoxHeight / 2;\n } else {\n y += offsetY * 2 + tooltipBoxHeight;\n }\n }\n }\n };\n const detectTopLast = () => {\n if (isTopOut()) {\n // 位置不超出视区上界\n y = 0 - tooltipParentElementRect.y / tooltipParentElementScale;\n }\n };\n const detectBottomFirst = () => {\n if (isBottomOut()) {\n // 位置不超出视区下界\n if (isFixedPosition) {\n y = (containerHeight - tooltipParentElementRect.y) / tooltipParentElementScale - tooltipBoxHeight;\n } else {\n if (getVerticalPositionType(position as TooltipFixedPosition, 'bottom') === 'center') {\n y -= offsetY + tooltipBoxHeight / 2;\n } else {\n y -= offsetY * 2 + tooltipBoxHeight;\n }\n }\n }\n };\n const detectBottomLast = () => {\n if (isBottomOut()) {\n // 位置不超出视区下界\n y = (containerHeight - tooltipParentElementRect.y) / tooltipParentElementScale - tooltipBoxHeight;\n }\n };\n\n // 处理左右\n switch (getHorizontalPositionType(position as TooltipFixedPosition, 'right')) {\n case 'center':\n case 'centerLeft':\n case 'centerRight':\n if (isLeftOut()) {\n detectLeftFirst();\n detectRightLast();\n } else {\n detectRightFirst();\n detectLeftLast();\n }\n break;\n case 'left':\n detectLeftFirst();\n detectRightLast();\n break;\n case 'right':\n detectRightFirst();\n detectLeftLast();\n break;\n }\n // 处理上下\n switch (getVerticalPositionType(position as TooltipFixedPosition, 'bottom')) {\n case 'center':\n case 'centerTop':\n case 'centerBottom':\n if (isTopOut()) {\n detectTopFirst();\n detectBottomLast();\n } else {\n detectBottomFirst();\n detectTopLast();\n }\n break;\n case 'top':\n detectTopFirst();\n detectBottomLast();\n break;\n case 'bottom':\n detectBottomFirst();\n detectTopLast();\n break;\n }\n\n const result = { x, y };\n this._cacheTooltipPosition = result;\n this._cacheTooltipSize = { width: tooltipBoxWidth, height: tooltipBoxHeight };\n return result;\n };\n\n // 计算 tooltip 内容区域的宽高,并缓存结果\n protected _getTooltipBoxSize(actualTooltip: ITooltipActual, changePositionOnly: boolean): IContainerSize | undefined {\n if (!changePositionOnly || isNil(this._attributes)) {\n const chartTheme = this._chartOption?.getTheme() ?? {};\n this._attributes = getTooltipAttributes(actualTooltip, this._component.getSpec(), chartTheme);\n }\n const { panel, panelDomHeight } = this._attributes ?? {};\n // canvas模式下, size需要考虑border size, 目的是为了精准判断边界是否超出画布,达到confine效果\n // html模式不提供confine, 所以不考虑精准计算size\n const isCanvas = this._component.getSpec().renderMode === 'canvas';\n\n return {\n width: panel?.width + (isCanvas ? panel.lineWidth : 0),\n height: (panelDomHeight ?? panel?.height) + (isCanvas ? panel.lineWidth : 0)\n };\n }\n\n protected _getPointerPositionRelativeToTooltipParent(params: TooltipHandlerParams) {\n let { canvasX: x, canvasY: y } = params.event;\n const { tooltipSpec } = params;\n\n const invalidPosition = {\n x: Infinity,\n y: Infinity\n };\n\n const isCanvas = tooltipSpec.renderMode === 'canvas';\n const tooltipParentElement = this._getParentElement(tooltipSpec);\n\n let relativePosOffset = { x: 0, y: 0 };\n let tooltipParentElementRect: IPoint | DOMRect = { x: 0, y: 0 };\n let chartElementScale = 1;\n let tooltipParentElementScale = 1;\n\n if (isTrueBrowser(this._env) && !tooltipSpec.confine) {\n if (!isCanvas) {\n tooltipParentElementRect = tooltipParentElement?.getBoundingClientRect() ?? invalidPosition;\n const chartElement = (this._compiler.getCanvas() ?? this._chartContainer) as HTMLElement;\n const chartElementRect = chartElement?.getBoundingClientRect();\n relativePosOffset = {\n x: chartElementRect.x - tooltipParentElementRect.x,\n y: chartElementRect.y - tooltipParentElementRect.y\n };\n chartElementScale = getScale(chartElement, chartElementRect);\n tooltipParentElementScale = getScale(tooltipParentElement, tooltipParentElementRect as DOMRect);\n }\n }\n\n x *= chartElementScale;\n y *= chartElementScale;\n if (isTrueBrowser(this._env)) {\n x += relativePosOffset.x;\n y += relativePosOffset.y;\n }\n x /= tooltipParentElementScale;\n y /= tooltipParentElementScale;\n return { x, y };\n }\n\n protected _isPointerMovingToTooltip(params: TooltipHandlerParams) {\n if (!this._cacheTooltipPosition || !this._cacheTooltipSize || !this._cachePointerPosition) {\n return false;\n }\n const { width: tooltipWidth, height: tooltipHeight } = this._cacheTooltipSize;\n const { x: tooltipX = 0, y: tooltipY } = this._cacheTooltipPosition;\n\n const pos = this._getPointerPositionRelativeToTooltipParent(params);\n\n if (\n pointInRect(\n pos,\n {\n x1: tooltipX,\n y1: tooltipY,\n x2: tooltipX + tooltipWidth,\n y2: tooltipY + tooltipHeight\n },\n false\n )\n ) {\n return true;\n }\n\n // 确定 tooltip 四端点坐标\n const a = { x: tooltipX, y: tooltipY };\n const b = { x: a.x + tooltipWidth, y: a.y };\n const c = { x: a.x, y: a.y + tooltipHeight };\n const d = { x: b.x, y: c.y };\n const oldPos = this._cachePointerPosition;\n\n return (\n polygonContainPoint([oldPos, a, b], pos.x, pos.y) ||\n polygonContainPoint([oldPos, c, d], pos.x, pos.y) ||\n polygonContainPoint([oldPos, a, d], pos.x, pos.y) ||\n polygonContainPoint([oldPos, b, c], pos.x, pos.y)\n );\n }\n\n protected _getParentElement(spec: ITooltipSpec): HTMLElement {\n return spec.parentElement as any;\n }\n\n getTooltipContainer() {\n return this._container;\n }\n\n protected _initFromSpec() {\n this._option = this._getDefaultOption();\n // 为方法加防抖\n this.changeTooltip = this._throttle(this._changeTooltip) as any;\n this.changeTooltipPosition = this._throttle(this._changeTooltipPosition) as any;\n }\n\n reInit() {\n this._initFromSpec();\n }\n}\n"]}
@@ -33,7 +33,7 @@ export class DomTooltipHandler extends BaseTooltipHandler {
33
33
  }
34
34
  initEl() {
35
35
  const tooltipSpec = this._component.getSpec(), parentElement = tooltipSpec.parentElement;
36
- if (domDocument && parentElement) {
36
+ if (domDocument && parentElement && parentElement.children && parentElement.children.length) {
37
37
  for (let i = 0; i < parentElement.children.length; i++) if (parentElement.children[i].classList.contains(TOOLTIP_CONTAINER_EL_CLASS_NAME)) {
38
38
  this._container = parentElement.children[i];
39
39
  break;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin/components/tooltip-handler/dom/dom-tooltip-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AAC/D,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B,CAAC,aAAa,EAAE,IAAI,CAAC,mBAAmB,EAAiB,CAAC,CAAC,EAC9E;oBACA,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;iBAC/B;aACF;QACH,CAAC,CAAC,CAAC;IACL,CAAC;;AA3Je,sBAAI,GAAG,kBAAkB,CAAC,GAAG,CAAC;AA8JhD,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC5C,uBAAuB,CAAC,iBAAiB,CAAC,CAAC;AAC7C,CAAC,CAAC","file":"dom-tooltip-handler.js","sourcesContent":["import type { ITooltipActual, ITooltipPositionActual } from '../../../../typings/tooltip';\nimport { BaseTooltipHandler } from '../base';\nimport { getDomStyles } from './utils';\nimport type { IDomTooltipStyle } from './interface';\nimport { TooltipModel } from './model/tooltip-model';\nimport { TOOLTIP_CONTAINER_EL_CLASS_NAME } from '../constants';\nimport { hasParentElement, isNil, type Maybe } from '@visactor/vutils';\nimport { domDocument } from '../../../../util/env';\nimport type { ITooltipSpec, TooltipHandlerParams } from '../../../../component/tooltip';\nimport type { IComponentPluginService } from '../../interface';\nimport { registerComponentPlugin } from '../../register';\nimport { DEFAULT_TOOLTIP_Z_INDEX } from './constant';\nimport type { ILayoutPoint } from '../../../../typings';\nimport { TooltipHandlerType } from '../../../../component/tooltip/constant';\n\n/**\n * The tooltip handler class.\n */\nexport class DomTooltipHandler extends BaseTooltipHandler {\n static readonly type = TooltipHandlerType.dom;\n readonly type = TooltipHandlerType.dom;\n\n protected _tooltipContainer = domDocument?.body;\n protected _domStyle: IDomTooltipStyle;\n protected _tooltipActual?: ITooltipActual;\n protected declare _container: Maybe<HTMLDivElement>;\n\n /** 自定义 tooltip 的位置缓存 */\n protected _cacheCustomTooltipPosition: ILayoutPoint;\n\n protected model: TooltipModel;\n\n getVisibility() {\n return !!this.model?.getVisibility();\n }\n\n setVisibility(_value: boolean) {\n // 这里做个节流\n if (_value !== this.getVisibility()) {\n this.model?.setVisibility(_value);\n }\n }\n\n constructor() {\n super(DomTooltipHandler.type);\n }\n\n onAdd(service: IComponentPluginService<any>): void {\n super.onAdd(service);\n this._initStyle();\n this.initEl();\n }\n\n initEl() {\n const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n const parentElement = tooltipSpec.parentElement as HTMLElement | HTMLCanvasElement;\n if (domDocument && parentElement) {\n for (let i = 0; i < parentElement.children.length; i++) {\n if (parentElement.children[i].classList.contains(TOOLTIP_CONTAINER_EL_CLASS_NAME)) {\n this._container = parentElement.children[i] as HTMLDivElement;\n break;\n }\n }\n if (!this._container) {\n this._container = domDocument.createElement('div');\n this._container.style.position = 'relative';\n this._container.style.zIndex = DEFAULT_TOOLTIP_Z_INDEX;\n this._container.classList.add(TOOLTIP_CONTAINER_EL_CLASS_NAME);\n parentElement.appendChild(this._container);\n }\n this.model = new TooltipModel(\n {\n valueToHtml: this._option.sanitize,\n getTooltipStyle: () => this._domStyle,\n getTooltipActual: () => this._tooltipActual,\n getTooltipAttributes: () => this._attributes,\n getContainer: () => this._container\n },\n [tooltipSpec.className],\n this.name\n );\n }\n }\n\n protected _removeTooltip() {\n this.model?.release();\n this._container = null;\n }\n\n protected _updateTooltip(visible: boolean, params: TooltipHandlerParams) {\n const { tooltipActual, tooltipSpec } = params;\n if (!visible || !this.model) {\n this.setVisibility(visible);\n this._cacheCustomTooltipPosition = undefined;\n } else {\n if (!params.changePositionOnly) {\n this._tooltipActual = tooltipActual;\n this._initStyle();\n\n const firstInit = !this.model.product;\n this.model.initAll();\n if (firstInit) {\n this._initEvent(this.model.product);\n }\n this.model.setStyle();\n this.model.setContent();\n }\n this.setVisibility(visible);\n\n // 位置\n const el = this.model.product;\n if (el) {\n const { x = 0, y = 0 } = tooltipActual.position ?? {};\n if (tooltipSpec.updateElement) {\n // 此处先设定一次位置,防止页面暂时出现滚动条(优先设置上次的位置)\n this._updatePosition(this._cacheCustomTooltipPosition ?? { x, y });\n // 更新 tooltip dom\n tooltipSpec.updateElement(el, tooltipActual, params);\n // 重新计算 tooltip 位置\n const position = this._getActualTooltipPosition(tooltipActual, params, {\n width: el.offsetWidth,\n height: el.offsetHeight\n });\n // 更新位置\n this._updatePosition(position);\n // 更新缓存\n this._cacheCustomTooltipPosition = position;\n } else {\n this._updatePosition({ x, y });\n }\n }\n }\n }\n\n protected _initStyle() {\n this._domStyle = getDomStyles(this._attributes);\n }\n\n protected _getParentElement(spec: ITooltipSpec): HTMLElement {\n return this._container ?? super._getParentElement(spec);\n }\n\n isTooltipShown() {\n return this.getVisibility();\n }\n\n reInit() {\n super.reInit();\n this._initStyle();\n }\n\n protected _updatePosition({ x, y }: ITooltipPositionActual) {\n const el = this.model.product;\n if (el) {\n // translate3d 性能较好:https://stackoverflow.com/questions/22111256/translate3d-vs-translate-performance\n el.style.transform = `translate3d(${x}px, ${y}px, 0)`;\n }\n }\n\n protected _initEvent(el: HTMLElement) {\n el.addEventListener('pointerleave', event => {\n const { renderMode, enterable } = this._component.getSpec();\n const relatedTarget = event.relatedTarget as HTMLElement;\n if (renderMode === 'html' && enterable) {\n if (\n // 判断用户鼠标是否从 tooltip 内部直接滑入非图表区域\n isNil(relatedTarget) ||\n (relatedTarget !== this._compiler.getCanvas() &&\n !hasParentElement(relatedTarget, this.getTooltipContainer() as HTMLElement))\n ) {\n this._component.hideTooltip();\n }\n }\n });\n }\n}\n\nexport const registerDomTooltipHandler = () => {\n registerComponentPlugin(DomTooltipHandler);\n};\n"]}
1
+ {"version":3,"sources":["../src/plugin/components/tooltip-handler/dom/dom-tooltip-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAc,MAAM,kBAAkB,CAAC;AACvE,OAAO,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,aAAa,EAAE,IAAI,CAAC,mBAAmB,EAAiB,CAAC,CAAC,EAC9E;oBACA,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;iBAC/B;aACF;QACH,CAAC,CAAC,CAAC;IACL,CAAC;;AA3Je,sBAAI,GAAG,kBAAkB,CAAC,GAAG,CAAC;AA8JhD,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC5C,uBAAuB,CAAC,iBAAiB,CAAC,CAAC;AAC7C,CAAC,CAAC","file":"dom-tooltip-handler.js","sourcesContent":["import type { ITooltipActual, ITooltipPositionActual } from '../../../../typings/tooltip';\nimport { BaseTooltipHandler } from '../base';\nimport { getDomStyles } from './utils';\nimport type { IDomTooltipStyle } from './interface';\nimport { TooltipModel } from './model/tooltip-model';\nimport { TOOLTIP_CONTAINER_EL_CLASS_NAME } from '../constants';\nimport { hasParentElement, isNil, type Maybe } from '@visactor/vutils';\nimport { domDocument } from '../../../../util/env';\nimport type { ITooltipSpec, TooltipHandlerParams } from '../../../../component/tooltip';\nimport type { IComponentPluginService } from '../../interface';\nimport { registerComponentPlugin } from '../../register';\nimport { DEFAULT_TOOLTIP_Z_INDEX } from './constant';\nimport type { ILayoutPoint } from '../../../../typings';\nimport { TooltipHandlerType } from '../../../../component/tooltip/constant';\n\n/**\n * The tooltip handler class.\n */\nexport class DomTooltipHandler extends BaseTooltipHandler {\n static readonly type = TooltipHandlerType.dom;\n readonly type = TooltipHandlerType.dom;\n\n protected _tooltipContainer = domDocument?.body;\n protected _domStyle: IDomTooltipStyle;\n protected _tooltipActual?: ITooltipActual;\n protected declare _container: Maybe<HTMLDivElement>;\n\n /** 自定义 tooltip 的位置缓存 */\n protected _cacheCustomTooltipPosition: ILayoutPoint;\n\n protected model: TooltipModel;\n\n getVisibility() {\n return !!this.model?.getVisibility();\n }\n\n setVisibility(_value: boolean) {\n // 这里做个节流\n if (_value !== this.getVisibility()) {\n this.model?.setVisibility(_value);\n }\n }\n\n constructor() {\n super(DomTooltipHandler.type);\n }\n\n onAdd(service: IComponentPluginService<any>): void {\n super.onAdd(service);\n this._initStyle();\n this.initEl();\n }\n\n initEl() {\n const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n const parentElement = tooltipSpec.parentElement as HTMLElement | HTMLCanvasElement;\n if (domDocument && parentElement && parentElement.children && parentElement.children.length) {\n for (let i = 0; i < parentElement.children.length; i++) {\n if (parentElement.children[i].classList.contains(TOOLTIP_CONTAINER_EL_CLASS_NAME)) {\n this._container = parentElement.children[i] as HTMLDivElement;\n break;\n }\n }\n if (!this._container) {\n this._container = domDocument.createElement('div');\n this._container.style.position = 'relative';\n this._container.style.zIndex = DEFAULT_TOOLTIP_Z_INDEX;\n this._container.classList.add(TOOLTIP_CONTAINER_EL_CLASS_NAME);\n parentElement.appendChild(this._container);\n }\n this.model = new TooltipModel(\n {\n valueToHtml: this._option.sanitize,\n getTooltipStyle: () => this._domStyle,\n getTooltipActual: () => this._tooltipActual,\n getTooltipAttributes: () => this._attributes,\n getContainer: () => this._container\n },\n [tooltipSpec.className],\n this.name\n );\n }\n }\n\n protected _removeTooltip() {\n this.model?.release();\n this._container = null;\n }\n\n protected _updateTooltip(visible: boolean, params: TooltipHandlerParams) {\n const { tooltipActual, tooltipSpec } = params;\n if (!visible || !this.model) {\n this.setVisibility(visible);\n this._cacheCustomTooltipPosition = undefined;\n } else {\n if (!params.changePositionOnly) {\n this._tooltipActual = tooltipActual;\n this._initStyle();\n\n const firstInit = !this.model.product;\n this.model.initAll();\n if (firstInit) {\n this._initEvent(this.model.product);\n }\n this.model.setStyle();\n this.model.setContent();\n }\n this.setVisibility(visible);\n\n // 位置\n const el = this.model.product;\n if (el) {\n const { x = 0, y = 0 } = tooltipActual.position ?? {};\n if (tooltipSpec.updateElement) {\n // 此处先设定一次位置,防止页面暂时出现滚动条(优先设置上次的位置)\n this._updatePosition(this._cacheCustomTooltipPosition ?? { x, y });\n // 更新 tooltip dom\n tooltipSpec.updateElement(el, tooltipActual, params);\n // 重新计算 tooltip 位置\n const position = this._getActualTooltipPosition(tooltipActual, params, {\n width: el.offsetWidth,\n height: el.offsetHeight\n });\n // 更新位置\n this._updatePosition(position);\n // 更新缓存\n this._cacheCustomTooltipPosition = position;\n } else {\n this._updatePosition({ x, y });\n }\n }\n }\n }\n\n protected _initStyle() {\n this._domStyle = getDomStyles(this._attributes);\n }\n\n protected _getParentElement(spec: ITooltipSpec): HTMLElement {\n return this._container ?? super._getParentElement(spec);\n }\n\n isTooltipShown() {\n return this.getVisibility();\n }\n\n reInit() {\n super.reInit();\n this._initStyle();\n }\n\n protected _updatePosition({ x, y }: ITooltipPositionActual) {\n const el = this.model.product;\n if (el) {\n // translate3d 性能较好:https://stackoverflow.com/questions/22111256/translate3d-vs-translate-performance\n el.style.transform = `translate3d(${x}px, ${y}px, 0)`;\n }\n }\n\n protected _initEvent(el: HTMLElement) {\n el.addEventListener('pointerleave', event => {\n const { renderMode, enterable } = this._component.getSpec();\n const relatedTarget = event.relatedTarget as HTMLElement;\n if (renderMode === 'html' && enterable) {\n if (\n // 判断用户鼠标是否从 tooltip 内部直接滑入非图表区域\n isNil(relatedTarget) ||\n (relatedTarget !== this._compiler.getCanvas() &&\n !hasParentElement(relatedTarget, this.getTooltipContainer() as HTMLElement))\n ) {\n this._component.hideTooltip();\n }\n }\n });\n }\n}\n\nexport const registerDomTooltipHandler = () => {\n registerComponentPlugin(DomTooltipHandler);\n};\n"]}
@@ -145,7 +145,10 @@ export class BasePieSeries extends PolarSeries {
145
145
  return field(ARC_END_ANGLE)(datum);
146
146
  }
147
147
  _computeLayoutRadius() {
148
- return computeLayoutRadius(this._spec.layoutRadius, this.getLayoutRect, this.getCenter, this._startAngle, this._endAngle);
148
+ return computeLayoutRadius((() => this._spec.layoutRadius), this.getLayoutRect, this.getCenter, (() => ({
149
+ startAngle: this._startAngle,
150
+ endAngle: this._endAngle
151
+ })));
149
152
  }
150
153
  initMarkStyle() {
151
154
  const initialStyle = {