@visactor/vtable 1.22.11-alpha.5 → 1.22.11-alpha.6

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 (137) hide show
  1. package/cjs/ListTable.d.ts +7 -34
  2. package/cjs/ListTable.js +14 -134
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/PivotChart.d.ts +3 -0
  5. package/cjs/PivotChart.js +12 -5
  6. package/cjs/PivotChart.js.map +1 -1
  7. package/cjs/body-helper/style.js +2 -1
  8. package/cjs/core/BaseTable.js +1 -1
  9. package/cjs/core/BaseTable.js.map +1 -1
  10. package/cjs/core/FouseInput.js +1 -2
  11. package/cjs/core/TABLE_EVENT_TYPE.d.ts +0 -1
  12. package/cjs/core/TABLE_EVENT_TYPE.js +0 -1
  13. package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
  14. package/cjs/core/record-helper.d.ts +2 -4
  15. package/cjs/core/record-helper.js +24 -81
  16. package/cjs/core/record-helper.js.map +1 -1
  17. package/cjs/data/DataSource.d.ts +0 -1
  18. package/cjs/data/DataSource.js +3 -25
  19. package/cjs/data/DataSource.js.map +1 -1
  20. package/cjs/dataset/DataStatistics.js +2 -1
  21. package/cjs/dataset/dataset-pivot-table.js +1 -2
  22. package/cjs/event/event.d.ts +1 -2
  23. package/cjs/event/event.js +9 -20
  24. package/cjs/event/event.js.map +1 -1
  25. package/cjs/event/listener/table-group.js +10 -6
  26. package/cjs/event/listener/table-group.js.map +1 -1
  27. package/cjs/header-helper/style.js +2 -1
  28. package/cjs/index.d.ts +1 -1
  29. package/cjs/index.js +1 -1
  30. package/cjs/index.js.map +1 -1
  31. package/cjs/layout/index.js +1 -2
  32. package/cjs/layout/pivot-header-layout.d.ts +6 -0
  33. package/cjs/layout/pivot-header-layout.js +39 -20
  34. package/cjs/layout/pivot-header-layout.js.map +1 -1
  35. package/cjs/plugins/custom-cell-style.d.ts +0 -5
  36. package/cjs/plugins/custom-cell-style.js +1 -10
  37. package/cjs/plugins/custom-cell-style.js.map +1 -1
  38. package/cjs/scenegraph/graphic/active-cell-chart-list.d.ts +14 -2
  39. package/cjs/scenegraph/graphic/active-cell-chart-list.js +195 -75
  40. package/cjs/scenegraph/graphic/active-cell-chart-list.js.map +1 -1
  41. package/cjs/scenegraph/graphic/chart.d.ts +9 -1
  42. package/cjs/scenegraph/graphic/chart.js +48 -20
  43. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  44. package/cjs/scenegraph/graphic/contributions/chart-render.js +3 -4
  45. package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  46. package/cjs/scenegraph/refresh-node/update-chart.d.ts +1 -1
  47. package/cjs/scenegraph/refresh-node/update-chart.js +2 -1
  48. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
  49. package/cjs/scenegraph/scenegraph.d.ts +2 -2
  50. package/cjs/scenegraph/scenegraph.js +41 -12
  51. package/cjs/scenegraph/scenegraph.js.map +1 -1
  52. package/cjs/state/state.js +1 -1
  53. package/cjs/themes/theme-define.js +6 -0
  54. package/cjs/themes/theme-define.js.map +1 -1
  55. package/cjs/tools/util.d.ts +5 -0
  56. package/cjs/tools/util.js +22 -4
  57. package/cjs/tools/util.js.map +1 -1
  58. package/cjs/ts-types/base-table.d.ts +2 -2
  59. package/cjs/ts-types/base-table.js.map +1 -1
  60. package/cjs/ts-types/events.d.ts +0 -15
  61. package/cjs/ts-types/events.js.map +1 -1
  62. package/cjs/ts-types/table-engine.d.ts +13 -32
  63. package/cjs/ts-types/table-engine.js.map +1 -1
  64. package/cjs/vrender.js.map +1 -1
  65. package/dist/vtable.js +585 -559
  66. package/dist/vtable.min.js +2 -2
  67. package/es/ListTable.d.ts +7 -34
  68. package/es/ListTable.js +14 -130
  69. package/es/ListTable.js.map +1 -1
  70. package/es/PivotChart.d.ts +3 -0
  71. package/es/PivotChart.js +13 -4
  72. package/es/PivotChart.js.map +1 -1
  73. package/es/body-helper/style.js +2 -1
  74. package/es/core/BaseTable.js +1 -1
  75. package/es/core/BaseTable.js.map +1 -1
  76. package/es/core/FouseInput.js +1 -2
  77. package/es/core/TABLE_EVENT_TYPE.d.ts +0 -1
  78. package/es/core/TABLE_EVENT_TYPE.js +0 -1
  79. package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
  80. package/es/core/record-helper.d.ts +2 -4
  81. package/es/core/record-helper.js +20 -75
  82. package/es/core/record-helper.js.map +1 -1
  83. package/es/data/DataSource.d.ts +0 -1
  84. package/es/data/DataSource.js +3 -25
  85. package/es/data/DataSource.js.map +1 -1
  86. package/es/dataset/DataStatistics.js +2 -1
  87. package/es/dataset/dataset-pivot-table.js +1 -2
  88. package/es/event/event.d.ts +1 -2
  89. package/es/event/event.js +9 -20
  90. package/es/event/event.js.map +1 -1
  91. package/es/event/listener/table-group.js +9 -6
  92. package/es/event/listener/table-group.js.map +1 -1
  93. package/es/header-helper/style.js +2 -1
  94. package/es/index.d.ts +1 -1
  95. package/es/index.js +1 -1
  96. package/es/index.js.map +1 -1
  97. package/es/layout/index.js +1 -2
  98. package/es/layout/pivot-header-layout.d.ts +6 -0
  99. package/es/layout/pivot-header-layout.js +39 -20
  100. package/es/layout/pivot-header-layout.js.map +1 -1
  101. package/es/plugins/custom-cell-style.d.ts +0 -5
  102. package/es/plugins/custom-cell-style.js +1 -10
  103. package/es/plugins/custom-cell-style.js.map +1 -1
  104. package/es/scenegraph/graphic/active-cell-chart-list.d.ts +14 -2
  105. package/es/scenegraph/graphic/active-cell-chart-list.js +183 -68
  106. package/es/scenegraph/graphic/active-cell-chart-list.js.map +1 -1
  107. package/es/scenegraph/graphic/chart.d.ts +9 -1
  108. package/es/scenegraph/graphic/chart.js +47 -19
  109. package/es/scenegraph/graphic/chart.js.map +1 -1
  110. package/es/scenegraph/graphic/contributions/chart-render.js +3 -4
  111. package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  112. package/es/scenegraph/refresh-node/update-chart.d.ts +1 -1
  113. package/es/scenegraph/refresh-node/update-chart.js +2 -1
  114. package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
  115. package/es/scenegraph/scenegraph.d.ts +2 -2
  116. package/es/scenegraph/scenegraph.js +41 -11
  117. package/es/scenegraph/scenegraph.js.map +1 -1
  118. package/es/state/state.js +1 -1
  119. package/es/themes/theme-define.js +6 -0
  120. package/es/themes/theme-define.js.map +1 -1
  121. package/es/tools/util.d.ts +5 -0
  122. package/es/tools/util.js +18 -0
  123. package/es/tools/util.js.map +1 -1
  124. package/es/ts-types/base-table.d.ts +2 -2
  125. package/es/ts-types/base-table.js.map +1 -1
  126. package/es/ts-types/events.d.ts +0 -15
  127. package/es/ts-types/events.js.map +1 -1
  128. package/es/ts-types/table-engine.d.ts +13 -32
  129. package/es/ts-types/table-engine.js.map +1 -1
  130. package/es/vrender.js.map +1 -1
  131. package/package.json +5 -5
  132. package/cjs/core/index.d.ts +0 -1
  133. package/cjs/core/index.js +0 -30
  134. package/cjs/core/index.js.map +0 -1
  135. package/es/core/index.d.ts +0 -1
  136. package/es/core/index.js +0 -2
  137. package/es/core/index.js.map +0 -1
@@ -10,11 +10,6 @@ export declare class CustomCellStylePlugin {
10
10
  customCellStyle: CustomCellStyle[];
11
11
  customCellStyleArrangement: CustomCellStyleArrangement[];
12
12
  constructor(table: BaseTableAPI, customCellStyle: CustomCellStyle[], customCellStyleArrangement: CustomCellStyleArrangement[]);
13
- clearCustomCellStyleArrangement(): void;
14
- addCustomCellStyleArrangement(cellPosition: {
15
- col: number;
16
- row: number;
17
- }, customStyleId: string | undefined | null): void;
18
13
  getCustomCellStyle(col: number, row: number): any;
19
14
  getCustomCellStyleIds(col: number, row: number): string[];
20
15
  getCustomCellStyleOption(customStyleId: string): CustomCellStyle;
@@ -10,15 +10,6 @@ class CustomCellStylePlugin {
10
10
  constructor(table, customCellStyle, customCellStyleArrangement) {
11
11
  this.table = table, this.customCellStyle = customCellStyle, this.customCellStyleArrangement = customCellStyleArrangement;
12
12
  }
13
- clearCustomCellStyleArrangement() {
14
- this.customCellStyleArrangement = [];
15
- }
16
- addCustomCellStyleArrangement(cellPosition, customStyleId) {
17
- this.customCellStyleArrangement.push({
18
- cellPosition: cellPosition,
19
- customStyleId: customStyleId
20
- });
21
- }
22
13
  getCustomCellStyle(col, row) {
23
14
  const customStyleIds = this.getCustomCellStyleIds(col, row);
24
15
  if (customStyleIds.length) {
@@ -119,4 +110,4 @@ const registerCustomCellStylePlugin = () => {
119
110
  };
120
111
 
121
112
  exports.registerCustomCellStylePlugin = registerCustomCellStylePlugin;
122
- //# sourceMappingURL=custom-cell-style.js.map
113
+ //# sourceMappingURL=custom-cell-style.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugins/custom-cell-style.ts"],"names":[],"mappings":";;;AAAA,6CAA8D;AAE9D,0CAMqB;AAErB,6CAA0C;AAU1C,MAAa,qBAAqB;IAKhC,YACE,KAAmB,EACnB,eAAkC,EAClC,0BAAwD;QAExD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,0BAA0B,GAAG,0BAA0B,CAAC;IAC/D,CAAC;IAED,+BAA+B;QAC7B,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC;IACvC,CAAC;IAED,6BAA6B,CAC3B,YAGC,EACD,aAAwC;QAExC,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC;YACnC,YAAY;YACZ,aAAa;SACd,CAAC,CAAC;IACL,CAAC;IAED,kBAAkB,CAAC,GAAW,EAAE,GAAW;QACzC,MAAM,cAAc,GAAG,IAAI,CAAC,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC5D,IAAI,cAAc,CAAC,MAAM,EAAE;YACzB,MAAM,MAAM,GAAwB,EAAE,CAAC;YAEvC,cAAc,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;gBACrC,MAAM,WAAW,GAAG,IAAI,CAAC,wBAAwB,CAAC,aAAa,C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CAAC;CACF;AA5OD,sDA4OC;AAED,SAAgB,UAAU,CAAC,UAAiB,EAAE,eAAkC;IAC9E,UAAU,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC;IAEhC,KAAK,MAAM,GAAG,IAAI,eAAe,EAAE;QACjC,MAAM,KAAK,GAAI,eAAuB,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,IAAA,gBAAO,EAAC,KAAK,CAAC,EAAE;YACjB,UAAkB,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;SACxC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAXD,gCAWC;AAEM,MAAM,6BAA6B,GAAG,GAAG,EAAE;IAChD,iBAAO,CAAC,iBAAiB,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC;AAC5E,CAAC,CAAC;AAFW,QAAA,6BAA6B,iCAExC","file":"custom-cell-style.js","sourcesContent":["import { isFunction, isValid, merge } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../ts-types/base-table';\nimport {\n cellStyleKeys,\n type CellRange,\n type ColumnStyleOption,\n type CustomCellStyle,\n type CustomCellStyleArrangement\n} from '../ts-types';\nimport type { Style } from '../body-helper/style';\nimport { Factory } from '../core/factory';\nimport type { StylePropertyFunctionArg } from '../ts-types/style-define';\nexport interface ICustomCellStylePlugin {\n new (\n table: BaseTableAPI,\n customCellStyle: CustomCellStyle[],\n customCellStyleArrangement: CustomCellStyleArrangement[]\n ): CustomCellStylePlugin;\n}\n\nexport class CustomCellStylePlugin {\n table: BaseTableAPI;\n customCellStyle: CustomCellStyle[];\n customCellStyleArrangement: CustomCellStyleArrangement[];\n\n constructor(\n table: BaseTableAPI,\n customCellStyle: CustomCellStyle[],\n customCellStyleArrangement: CustomCellStyleArrangement[]\n ) {\n this.table = table;\n this.customCellStyle = customCellStyle;\n this.customCellStyleArrangement = customCellStyleArrangement;\n }\n\n clearCustomCellStyleArrangement() {\n this.customCellStyleArrangement = [];\n }\n\n addCustomCellStyleArrangement(\n cellPosition: {\n col: number;\n row: number;\n },\n customStyleId: string | undefined | null\n ) {\n this.customCellStyleArrangement.push({\n cellPosition,\n customStyleId\n });\n }\n\n getCustomCellStyle(col: number, row: number) {\n const customStyleIds = this.getCustomCellStyleIds(col, row);\n if (customStyleIds.length) {\n const styles: ColumnStyleOption[] = [];\n\n customStyleIds.forEach(customStyleId => {\n const styleOption = this.getCustomCellStyleOption(customStyleId);\n if (isFunction(styleOption?.style)) {\n const style = styleOption.style({\n col,\n row,\n table: this.table,\n value: this.table.getCellValue(col, row),\n dataValue: this.table.getCellOriginValue(col, row),\n cellHeaderPaths: this.table.getCellHeaderPaths(col, row)\n });\n styles.push(style);\n } else if (styleOption?.style) {\n styles.push(styleOption.style);\n }\n });\n\n return merge({}, ...styles);\n // const styleOption = this.getCustomCellStyleOption(customStyleId);\n // return styleOption?.style;\n }\n return undefined;\n }\n\n getCustomCellStyleIds(col: number, row: number) {\n // let customStyleId;\n const customStyleIds: string[] = [];\n\n const range = this.table.getCellRange(col, row);\n for (let c = range.start.col; c <= range.end.col; c++) {\n for (let r = range.start.row; r <= range.end.row; r++) {\n // eslint-disable-next-line no-loop-func\n this.customCellStyleArrangement.forEach(style => {\n if (style.cellPosition.range) {\n if (\n style.cellPosition.range.start.col <= c &&\n style.cellPosition.range.end.col >= c &&\n style.cellPosition.range.start.row <= r &&\n style.cellPosition.range.end.row >= r\n ) {\n // customStyleId = style.customStyleId;\n customStyleIds.push(style.customStyleId);\n }\n } else if (style.cellPosition.col === c && style.cellPosition.row === r) {\n // customStyleId = style.customStyleId;\n customStyleIds.push(style.customStyleId);\n }\n });\n }\n }\n\n return customStyleIds;\n }\n\n getCustomCellStyleOption(customStyleId: string) {\n return this.customCellStyle.find(style => style.id === customStyleId);\n }\n\n registerCustomCellStyle(\n customStyleId: string,\n customStyle: ColumnStyleOption | ((styleArg: StylePropertyFunctionArg) => ColumnStyleOption) | undefined | null\n ) {\n const index = this.customCellStyle.findIndex(style => style.id === customStyleId);\n if (index === -1) {\n this.customCellStyle.push({\n id: customStyleId,\n style: customStyle\n });\n } else {\n this.customCellStyle[index] = {\n id: customStyleId,\n style: customStyle\n };\n }\n\n this.customCellStyleArrangement.forEach(cellStyle => {\n const cellPos = cellStyle.cellPosition;\n if (cellStyle.customStyleId === customStyleId) {\n if (cellPos.range) {\n for (\n let col = Math.max(0, cellPos.range.start.col);\n col <= Math.min(this.table.colCount - 1, cellPos.range.end.col);\n col++\n ) {\n for (\n let row = Math.max(0, cellPos.range.start.row);\n row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row);\n row++\n ) {\n this.table.scenegraph.updateCellContent(col, row);\n }\n }\n } else {\n this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row);\n }\n }\n });\n this.table.scenegraph.updateNextFrame();\n }\n\n arrangeCustomCellStyle(\n cellPos: {\n col?: number;\n row?: number;\n range?: CellRange;\n },\n customStyleId: string | undefined | null,\n forceFastUpdate?: boolean\n ) {\n const index = this.customCellStyleArrangement.findIndex(style => {\n if (style.cellPosition.range && cellPos.range) {\n return (\n style.cellPosition.range.start.col === cellPos.range.start.col &&\n style.cellPosition.range.start.row === cellPos.range.start.row &&\n style.cellPosition.range.end.col === cellPos.range.end.col &&\n style.cellPosition.range.end.row === cellPos.range.end.row\n );\n }\n return style.cellPosition.col === cellPos.col && style.cellPosition.row === cellPos.row;\n });\n\n if (index === -1 && !customStyleId) {\n // do nothing\n return;\n } else if (index === -1 && customStyleId) {\n // add new style\n this.customCellStyleArrangement.push({\n cellPosition: {\n col: cellPos.col,\n row: cellPos.row,\n range: cellPos.range\n },\n customStyleId: customStyleId\n });\n } else if (this.customCellStyleArrangement[index].customStyleId === customStyleId) {\n // same style\n return;\n } else if (customStyleId) {\n // update style\n this.customCellStyleArrangement[index].customStyleId = customStyleId;\n } else {\n // delete useless style\n this.customCellStyleArrangement.splice(index, 1);\n }\n\n const style = this.getCustomCellStyleOption(customStyleId)?.style;\n // let forceFastUpdate;\n if (style) {\n forceFastUpdate = true;\n for (const key in style) {\n if (cellStyleKeys.indexOf(key) === -1) {\n forceFastUpdate = false;\n break;\n }\n }\n }\n\n // update cell group\n if (cellPos.range) {\n for (\n let col = Math.max(0, cellPos.range.start.col);\n col <= Math.min(this.table.colCount - 1, cellPos.range.end.col);\n col++\n ) {\n for (\n let row = Math.max(0, cellPos.range.start.row);\n row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row);\n row++\n ) {\n const range = this.table.getCellRange(col, row);\n for (let c = range.start.col; c <= range.end.col; c++) {\n for (let r = range.start.row; r <= range.end.row; r++) {\n this.table.scenegraph.updateCellContent(c, r, forceFastUpdate);\n }\n }\n // this.table.scenegraph.updateCellContent(col, row);\n }\n }\n } else {\n this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row, forceFastUpdate);\n }\n\n this.table.scenegraph.updateNextFrame();\n }\n\n updateCustomCell(customCellStyle: CustomCellStyle[], customCellStyleArrangement: CustomCellStyleArrangement[]) {\n this.customCellStyle.length = 0;\n this.customCellStyleArrangement.length = 0;\n customCellStyle.forEach((cellStyle: CustomCellStyle) => {\n this.registerCustomCellStyle(cellStyle.id, cellStyle.style);\n });\n customCellStyleArrangement.forEach((cellStyle: CustomCellStyleArrangement) => {\n this.arrangeCustomCellStyle(cellStyle.cellPosition, cellStyle.customStyleId);\n });\n }\n\n hasCustomCellStyle(customStyleId: string) {\n return this.customCellStyle.some(style => style.id === customStyleId);\n }\n}\n\nexport function mergeStyle(cacheStyle: Style, customCellStyle: ColumnStyleOption): Style {\n cacheStyle = cacheStyle.clone();\n\n for (const key in customCellStyle) {\n const value = (customCellStyle as any)[key];\n if (isValid(value)) {\n (cacheStyle as any)[`_${key}`] = value;\n }\n }\n\n return cacheStyle;\n}\n\nexport const registerCustomCellStylePlugin = () => {\n Factory.registerComponent('customCellStylePlugin', CustomCellStylePlugin);\n};\n\n// export type ICustomCellStylePlugin = typeof CustomCellStylePlugin;\n"]}
1
+ {"version":3,"sources":["../src/plugins/custom-cell-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AAC,MAAM,GAAG,CAAC,CAAC;QAChC,IAAI,CAAC,0BAA0B,CAAC,MAAM,GAAG,CAAC,CAAC;QAC3C,eAAe,CAAC,OAAO,CAAC,CAAC,SAA0B,EAAE,EAAE;YACrD,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;QACH,0BAA0B,CAAC,OAAO,CAAC,CAAC,SAAqC,EAAE,EAAE;YAC3E,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,YAAY,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;QAC/E,CAAC,CAAC,CAAC;IACL,CAAC;IAED,kBAAkB,CAAC,aAAqB;QACtC,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,aAAa,CAAC,CAAC;IACxE,CAAC;CACF;AA3ND,sDA2NC;AAED,SAAgB,UAAU,CAAC,UAAiB,EAAE,eAAkC;IAC9E,UAAU,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC;IAEhC,KAAK,MAAM,GAAG,IAAI,eAAe,EAAE;QACjC,MAAM,KAAK,GAAI,eAAuB,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,IAAA,gBAAO,EAAC,KAAK,CAAC,EAAE;YACjB,UAAkB,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;SACxC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAXD,gCAWC;AAEM,MAAM,6BAA6B,GAAG,GAAG,EAAE;IAChD,iBAAO,CAAC,iBAAiB,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC;AAC5E,CAAC,CAAC;AAFW,QAAA,6BAA6B,iCAExC","file":"custom-cell-style.js","sourcesContent":["import { isFunction, isValid, merge } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../ts-types/base-table';\nimport {\n cellStyleKeys,\n type CellRange,\n type ColumnStyleOption,\n type CustomCellStyle,\n type CustomCellStyleArrangement\n} from '../ts-types';\nimport type { Style } from '../body-helper/style';\nimport { Factory } from '../core/factory';\nimport type { StylePropertyFunctionArg } from '../ts-types/style-define';\nexport interface ICustomCellStylePlugin {\n new (\n table: BaseTableAPI,\n customCellStyle: CustomCellStyle[],\n customCellStyleArrangement: CustomCellStyleArrangement[]\n ): CustomCellStylePlugin;\n}\n\nexport class CustomCellStylePlugin {\n table: BaseTableAPI;\n customCellStyle: CustomCellStyle[];\n customCellStyleArrangement: CustomCellStyleArrangement[];\n\n constructor(\n table: BaseTableAPI,\n customCellStyle: CustomCellStyle[],\n customCellStyleArrangement: CustomCellStyleArrangement[]\n ) {\n this.table = table;\n this.customCellStyle = customCellStyle;\n this.customCellStyleArrangement = customCellStyleArrangement;\n }\n\n getCustomCellStyle(col: number, row: number) {\n const customStyleIds = this.getCustomCellStyleIds(col, row);\n if (customStyleIds.length) {\n const styles: ColumnStyleOption[] = [];\n\n customStyleIds.forEach(customStyleId => {\n const styleOption = this.getCustomCellStyleOption(customStyleId);\n if (isFunction(styleOption?.style)) {\n const style = styleOption.style({\n col,\n row,\n table: this.table,\n value: this.table.getCellValue(col, row),\n dataValue: this.table.getCellOriginValue(col, row),\n cellHeaderPaths: this.table.getCellHeaderPaths(col, row)\n });\n styles.push(style);\n } else if (styleOption?.style) {\n styles.push(styleOption.style);\n }\n });\n\n return merge({}, ...styles);\n // const styleOption = this.getCustomCellStyleOption(customStyleId);\n // return styleOption?.style;\n }\n return undefined;\n }\n\n getCustomCellStyleIds(col: number, row: number) {\n // let customStyleId;\n const customStyleIds: string[] = [];\n\n const range = this.table.getCellRange(col, row);\n for (let c = range.start.col; c <= range.end.col; c++) {\n for (let r = range.start.row; r <= range.end.row; r++) {\n // eslint-disable-next-line no-loop-func\n this.customCellStyleArrangement.forEach(style => {\n if (style.cellPosition.range) {\n if (\n style.cellPosition.range.start.col <= c &&\n style.cellPosition.range.end.col >= c &&\n style.cellPosition.range.start.row <= r &&\n style.cellPosition.range.end.row >= r\n ) {\n // customStyleId = style.customStyleId;\n customStyleIds.push(style.customStyleId);\n }\n } else if (style.cellPosition.col === c && style.cellPosition.row === r) {\n // customStyleId = style.customStyleId;\n customStyleIds.push(style.customStyleId);\n }\n });\n }\n }\n\n return customStyleIds;\n }\n\n getCustomCellStyleOption(customStyleId: string) {\n return this.customCellStyle.find(style => style.id === customStyleId);\n }\n\n registerCustomCellStyle(\n customStyleId: string,\n customStyle: ColumnStyleOption | ((styleArg: StylePropertyFunctionArg) => ColumnStyleOption) | undefined | null\n ) {\n const index = this.customCellStyle.findIndex(style => style.id === customStyleId);\n if (index === -1) {\n this.customCellStyle.push({\n id: customStyleId,\n style: customStyle\n });\n } else {\n this.customCellStyle[index] = {\n id: customStyleId,\n style: customStyle\n };\n }\n\n this.customCellStyleArrangement.forEach(cellStyle => {\n const cellPos = cellStyle.cellPosition;\n if (cellStyle.customStyleId === customStyleId) {\n if (cellPos.range) {\n for (\n let col = Math.max(0, cellPos.range.start.col);\n col <= Math.min(this.table.colCount - 1, cellPos.range.end.col);\n col++\n ) {\n for (\n let row = Math.max(0, cellPos.range.start.row);\n row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row);\n row++\n ) {\n this.table.scenegraph.updateCellContent(col, row);\n }\n }\n } else {\n this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row);\n }\n }\n });\n this.table.scenegraph.updateNextFrame();\n }\n\n arrangeCustomCellStyle(\n cellPos: {\n col?: number;\n row?: number;\n range?: CellRange;\n },\n customStyleId: string | undefined | null,\n forceFastUpdate?: boolean\n ) {\n const index = this.customCellStyleArrangement.findIndex(style => {\n if (style.cellPosition.range && cellPos.range) {\n return (\n style.cellPosition.range.start.col === cellPos.range.start.col &&\n style.cellPosition.range.start.row === cellPos.range.start.row &&\n style.cellPosition.range.end.col === cellPos.range.end.col &&\n style.cellPosition.range.end.row === cellPos.range.end.row\n );\n }\n return style.cellPosition.col === cellPos.col && style.cellPosition.row === cellPos.row;\n });\n\n if (index === -1 && !customStyleId) {\n // do nothing\n return;\n } else if (index === -1 && customStyleId) {\n // add new style\n this.customCellStyleArrangement.push({\n cellPosition: {\n col: cellPos.col,\n row: cellPos.row,\n range: cellPos.range\n },\n customStyleId: customStyleId\n });\n } else if (this.customCellStyleArrangement[index].customStyleId === customStyleId) {\n // same style\n return;\n } else if (customStyleId) {\n // update style\n this.customCellStyleArrangement[index].customStyleId = customStyleId;\n } else {\n // delete useless style\n this.customCellStyleArrangement.splice(index, 1);\n }\n\n const style = this.getCustomCellStyleOption(customStyleId)?.style;\n // let forceFastUpdate;\n if (style) {\n forceFastUpdate = true;\n for (const key in style) {\n if (cellStyleKeys.indexOf(key) === -1) {\n forceFastUpdate = false;\n break;\n }\n }\n }\n\n // update cell group\n if (cellPos.range) {\n for (\n let col = Math.max(0, cellPos.range.start.col);\n col <= Math.min(this.table.colCount - 1, cellPos.range.end.col);\n col++\n ) {\n for (\n let row = Math.max(0, cellPos.range.start.row);\n row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row);\n row++\n ) {\n const range = this.table.getCellRange(col, row);\n for (let c = range.start.col; c <= range.end.col; c++) {\n for (let r = range.start.row; r <= range.end.row; r++) {\n this.table.scenegraph.updateCellContent(c, r, forceFastUpdate);\n }\n }\n // this.table.scenegraph.updateCellContent(col, row);\n }\n }\n } else {\n this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row, forceFastUpdate);\n }\n\n this.table.scenegraph.updateNextFrame();\n }\n\n updateCustomCell(customCellStyle: CustomCellStyle[], customCellStyleArrangement: CustomCellStyleArrangement[]) {\n this.customCellStyle.length = 0;\n this.customCellStyleArrangement.length = 0;\n customCellStyle.forEach((cellStyle: CustomCellStyle) => {\n this.registerCustomCellStyle(cellStyle.id, cellStyle.style);\n });\n customCellStyleArrangement.forEach((cellStyle: CustomCellStyleArrangement) => {\n this.arrangeCustomCellStyle(cellStyle.cellPosition, cellStyle.customStyleId);\n });\n }\n\n hasCustomCellStyle(customStyleId: string) {\n return this.customCellStyle.some(style => style.id === customStyleId);\n }\n}\n\nexport function mergeStyle(cacheStyle: Style, customCellStyle: ColumnStyleOption): Style {\n cacheStyle = cacheStyle.clone();\n\n for (const key in customCellStyle) {\n const value = (customCellStyle as any)[key];\n if (isValid(value)) {\n (cacheStyle as any)[`_${key}`] = value;\n }\n }\n\n return cacheStyle;\n}\n\nexport const registerCustomCellStylePlugin = () => {\n Factory.registerComponent('customCellStylePlugin', CustomCellStylePlugin);\n};\n\n// export type ICustomCellStylePlugin = typeof CustomCellStylePlugin;\n"]}
@@ -1,13 +1,25 @@
1
1
  import type { BaseTableAPI } from '../../ts-types/base-table';
2
+ export declare function setBrushingChartInstance(chartInstance: any, col: number, row: number): void;
3
+ export declare function clearBrushingChartInstance(): void;
4
+ export declare function getBrushingChartInstance(): any;
5
+ export declare function getBrushingChartInstanceCellPos(): {
6
+ col: number;
7
+ row: number;
8
+ };
2
9
  export declare const chartInstanceListColumnByColumnDirection: Record<number, Record<number, any>>;
3
10
  export declare const chartInstanceListRowByRowDirection: Record<number, Record<number, any>>;
4
11
  export declare function generateChartInstanceListByColumnDirection(col: number, dimensionValueOrXValue: string, positionValueOrYValue: string | number, canvasXY: {
5
12
  x: number;
6
13
  y: number;
7
14
  }, table: BaseTableAPI, hideTooltip?: boolean, isScatter?: boolean): void;
8
- export declare function clearChartInstanceListByColumnDirection(col: number, excludedRow: number, table: BaseTableAPI): void;
9
15
  export declare function generateChartInstanceListByRowDirection(row: number, dimensionValueOrXValue: string, positionValueOrYValue: string | number, canvasXY: {
10
16
  x: number;
11
17
  y: number;
12
18
  }, table: BaseTableAPI, hideTooltip?: boolean, isScatter?: boolean): void;
13
- export declare function clearChartInstanceListByRowDirection(row: number, excludedCol: number, table: BaseTableAPI): void;
19
+ export declare function generateChartInstanceListByViewRange(datum: any, table: BaseTableAPI, deactivate?: boolean): void;
20
+ export declare function clearChartInstanceListByColumnDirection(col: number, excludedRow: number, table: BaseTableAPI, forceRelease?: boolean): void;
21
+ export declare function clearChartInstanceListByRowDirection(row: number, excludedCol: number, table: BaseTableAPI, forceRelease?: boolean): void;
22
+ export declare function clearDelayRunDimensionHoverTimers(): void;
23
+ export declare function clearAllChartInstanceList(table: BaseTableAPI, forceRelease?: boolean): void;
24
+ export declare function disableDimensionHoverToAllChartInstances(): void;
25
+ export declare function enableDimensionHoverToAllChartInstances(): void;
@@ -2,140 +2,228 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.clearChartInstanceListByRowDirection = exports.generateChartInstanceListByRowDirection = exports.clearChartInstanceListByColumnDirection = exports.generateChartInstanceListByColumnDirection = exports.chartInstanceListRowByRowDirection = exports.chartInstanceListColumnByColumnDirection = void 0;
5
+ }), exports.enableDimensionHoverToAllChartInstances = exports.disableDimensionHoverToAllChartInstances = exports.clearAllChartInstanceList = exports.clearDelayRunDimensionHoverTimers = exports.clearChartInstanceListByRowDirection = exports.clearChartInstanceListByColumnDirection = exports.generateChartInstanceListByViewRange = exports.generateChartInstanceListByRowDirection = exports.generateChartInstanceListByColumnDirection = exports.chartInstanceListRowByRowDirection = exports.chartInstanceListColumnByColumnDirection = exports.getBrushingChartInstanceCellPos = exports.getBrushingChartInstance = exports.clearBrushingChartInstance = exports.setBrushingChartInstance = void 0;
6
6
 
7
7
  const vutils_1 = require("@visactor/vutils");
8
8
 
9
+ let brushingChartInstance, brushingChartInstanceCellPos = {
10
+ col: -1,
11
+ row: -1
12
+ };
13
+
14
+ function setBrushingChartInstance(chartInstance, col, row) {
15
+ brushingChartInstance = chartInstance, brushingChartInstanceCellPos = {
16
+ col: col,
17
+ row: row
18
+ };
19
+ }
20
+
21
+ function clearBrushingChartInstance() {
22
+ brushingChartInstance = void 0, brushingChartInstanceCellPos = {
23
+ col: -1,
24
+ row: -1
25
+ };
26
+ }
27
+
28
+ function getBrushingChartInstance() {
29
+ return brushingChartInstance;
30
+ }
31
+
32
+ function getBrushingChartInstanceCellPos() {
33
+ return brushingChartInstanceCellPos;
34
+ }
35
+
36
+ exports.setBrushingChartInstance = setBrushingChartInstance, exports.clearBrushingChartInstance = clearBrushingChartInstance,
37
+ exports.getBrushingChartInstance = getBrushingChartInstance, exports.getBrushingChartInstanceCellPos = getBrushingChartInstanceCellPos,
38
+ exports.chartInstanceListColumnByColumnDirection = {}, exports.chartInstanceListRowByRowDirection = {};
39
+
40
+ const delayRunDimensionHoverTimer = [];
41
+
9
42
  function generateChartInstanceListByColumnDirection(col, dimensionValueOrXValue, positionValueOrYValue, canvasXY, table, hideTooltip = !1, isScatter = !1) {
10
43
  var _a;
11
- (0, vutils_1.isValid)(exports.chartInstanceListColumnByColumnDirection[col]) || (exports.chartInstanceListColumnByColumnDirection[col] = {});
44
+ clearDelayRunDimensionHoverTimers(), (0, vutils_1.isValid)(exports.chartInstanceListColumnByColumnDirection[col]) || (exports.chartInstanceListColumnByColumnDirection[col] = {});
12
45
  const {rowStart: rowStart} = table.getBodyVisibleRowRange();
13
46
  let rowEnd = table.getBodyVisibleRowRange().rowEnd;
14
47
  rowEnd = Math.min(table.rowCount - 1 - table.bottomFrozenRowCount, rowEnd);
15
48
  for (let i = rowStart; i <= rowEnd; i++) {
16
49
  const cellGroup = table.scenegraph.getCell(col, i), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
17
- chartNode.addUpdateShapeAndBoundsTag(), exports.chartInstanceListColumnByColumnDirection[col][i] || (0,
18
- vutils_1.isValid)(chartNode) && (chartNode.activeChartInstance || chartNode.activate(table),
19
- exports.chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance),
20
- setTimeout((() => {
21
- var _a, _b, _c, _d, _e, _f;
50
+ exports.chartInstanceListColumnByColumnDirection[col][i] || (0, vutils_1.isValid)(chartNode) && (chartNode.addUpdateShapeAndBoundsTag(),
51
+ chartNode.activeChartInstance || chartNode.activate(table), exports.chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance);
52
+ const timer = setTimeout((() => {
53
+ var _a, _b, _c, _d;
22
54
  if (null === (_a = exports.chartInstanceListColumnByColumnDirection[col]) || void 0 === _a ? void 0 : _a[i]) {
23
55
  const chartDimensionLinkage = table.options.chartDimensionLinkage;
24
56
  let isShowTooltip = !isScatter;
25
- if (!isScatter && "object" == typeof chartDimensionLinkage) if (isShowTooltip = null === (_b = chartDimensionLinkage.showTooltip) || void 0 === _b || _b,
26
- i === rowEnd && isShowTooltip) {
27
- const heightLimitToShowTooltipForEdgeRow = null !== (_c = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow) && void 0 !== _c ? _c : 0, {rowEnd: rowEnd1} = table.getBodyVisibleRowRange(0, -heightLimitToShowTooltipForEdgeRow);
28
- if (rowEnd1 === rowEnd) isShowTooltip = !0; else {
29
- const {rowEnd: rowEnd2} = table.getBodyVisibleRowRange(0, 5);
30
- isShowTooltip = rowEnd2 !== rowEnd;
31
- }
32
- } else if (i === rowStart && isShowTooltip) {
33
- const heightLimitToShowTooltipForEdgeRow = null !== (_d = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow) && void 0 !== _d ? _d : 0, {rowStart: rowStart1} = table.getBodyVisibleRowRange(heightLimitToShowTooltipForEdgeRow, 0);
34
- if (rowStart1 === rowStart) isShowTooltip = !0; else {
35
- const {rowStart: rowStart2} = table.getBodyVisibleRowRange(0, -5);
36
- isShowTooltip = rowStart2 !== rowStart;
37
- }
38
- }
39
- if (isScatter) table.stateManager.hover.cellPos.col === col && table.stateManager.hover.cellPos.row === i || null === (_f = (_e = exports.chartInstanceListColumnByColumnDirection[col][i]).showCrosshair) || void 0 === _f || _f.call(_e, (axis => "left" === axis.layoutOrient ? positionValueOrYValue : dimensionValueOrXValue)); else {
40
- const bodyBoundryTop = table.frozenRowCount ? table.getCellRelativeRect(col, table.frozenRowCount - 1).bottom : 0, absolutePositionTop = Math.max(bodyBoundryTop, table.getCellRelativeRect(col, i).top);
57
+ if (isScatter || "object" != typeof chartDimensionLinkage || (isShowTooltip = null === (_b = chartDimensionLinkage.showTooltip) || void 0 === _b || _b,
58
+ isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeRow(i, table)), isScatter) table.stateManager.hover.cellPos.col === col && table.stateManager.hover.cellPos.row === i || null === (_d = (_c = exports.chartInstanceListColumnByColumnDirection[col][i]).showCrosshair) || void 0 === _d || _d.call(_c, (axis => "left" === axis.layoutOrient ? positionValueOrYValue : dimensionValueOrXValue)); else {
59
+ const cellBoundry = table.getCellRelativeRect(col, i), bodyBoundryTop = table.frozenRowCount ? table.getCellRelativeRect(col, table.frozenRowCount - 1).bottom : 0, absolutePositionTop = Math.max(bodyBoundryTop, table.getCellRelativeRect(col, i).top);
41
60
  hideTooltip ? (table.stateManager.hover.cellPos.col === col && table.stateManager.hover.cellPos.row === i || exports.chartInstanceListColumnByColumnDirection[col][i].hideTooltip(),
42
61
  exports.chartInstanceListColumnByColumnDirection[col][i].setDimensionIndex(dimensionValueOrXValue, {
43
62
  tooltip: !1,
44
63
  showTooltipOption: {
45
- x: canvasXY.x,
46
- y: absolutePositionTop,
64
+ x: canvasXY.x - cellBoundry.left,
65
+ y: absolutePositionTop - cellBoundry.top,
47
66
  activeType: "dimension"
48
67
  }
49
68
  })) : exports.chartInstanceListColumnByColumnDirection[col][i].setDimensionIndex(dimensionValueOrXValue, {
50
69
  tooltip: isShowTooltip,
51
70
  showTooltipOption: {
52
- x: canvasXY.x,
53
- y: absolutePositionTop,
71
+ x: canvasXY.x - cellBoundry.left,
72
+ y: absolutePositionTop - cellBoundry.top,
54
73
  activeType: "dimension"
55
74
  }
56
75
  });
57
76
  }
58
77
  }
59
- }), 0), table.scenegraph.updateNextFrame();
60
- }
61
- }
62
-
63
- function clearChartInstanceListByColumnDirection(col, excludedRow, table) {
64
- var _a;
65
- if ((0, vutils_1.isValid)(exports.chartInstanceListColumnByColumnDirection[col])) {
66
- for (const i in exports.chartInstanceListColumnByColumnDirection[col]) {
67
- if ((0, vutils_1.isValid)(excludedRow) && Number(i) === excludedRow) continue;
68
- const cellGroup = table.scenegraph.getCell(col, Number(i)), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
69
- chartNode.addUpdateShapeAndBoundsTag(), (0, vutils_1.isValid)(chartNode) && (chartNode.deactivate(table, {
70
- releaseChartInstance: !0,
71
- releaseColumnChartInstance: !1,
72
- releaseRowChartInstance: !1
73
- }), exports.chartInstanceListColumnByColumnDirection[col][i] = null);
74
- }
75
- delete exports.chartInstanceListColumnByColumnDirection[col];
78
+ }), 0);
79
+ delayRunDimensionHoverTimer.push(timer), table.scenegraph.updateNextFrame();
76
80
  }
77
81
  }
78
82
 
79
83
  function generateChartInstanceListByRowDirection(row, dimensionValueOrXValue, positionValueOrYValue, canvasXY, table, hideTooltip = !1, isScatter = !1) {
80
84
  var _a;
81
- (0, vutils_1.isValid)(exports.chartInstanceListRowByRowDirection[row]) || (exports.chartInstanceListRowByRowDirection[row] = {});
85
+ clearDelayRunDimensionHoverTimers(), (0, vutils_1.isValid)(exports.chartInstanceListRowByRowDirection[row]) || (exports.chartInstanceListRowByRowDirection[row] = {});
82
86
  const {colStart: colStart} = table.getBodyVisibleColRange();
83
87
  let colEnd = table.getBodyVisibleColRange().colEnd;
84
88
  colEnd = Math.min(table.colCount - 1 - table.rightFrozenColCount, colEnd);
85
89
  for (let i = colStart; i <= colEnd; i++) {
86
90
  const cellGroup = table.scenegraph.getCell(i, row), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
87
- chartNode.addUpdateShapeAndBoundsTag(), exports.chartInstanceListRowByRowDirection[row][i] || (0,
88
- vutils_1.isValid)(chartNode) && (chartNode.activeChartInstance || chartNode.activate(table),
89
- exports.chartInstanceListRowByRowDirection[row][i] = chartNode.activeChartInstance),
90
- setTimeout((() => {
91
+ exports.chartInstanceListRowByRowDirection[row][i] || (0, vutils_1.isValid)(chartNode) && (chartNode.addUpdateShapeAndBoundsTag(),
92
+ chartNode.activeChartInstance || chartNode.activate(table), exports.chartInstanceListRowByRowDirection[row][i] = chartNode.activeChartInstance);
93
+ const timer = setTimeout((() => {
91
94
  var _a, _b, _c, _d;
92
95
  if (null === (_a = exports.chartInstanceListRowByRowDirection[row]) || void 0 === _a ? void 0 : _a[i]) {
93
96
  const chartDimensionLinkage = table.options.chartDimensionLinkage;
94
97
  let isShowTooltip = !isScatter;
95
- if (!isScatter && "object" == typeof chartDimensionLinkage) if (isShowTooltip = null === (_b = chartDimensionLinkage.showTooltip) || void 0 === _b || _b,
96
- i === colEnd && isShowTooltip) {
97
- const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn, {colEnd: colEnd1} = table.getBodyVisibleColRange(0, -widthLimitToShowTooltipForEdgeColumn);
98
- if (colEnd1 === colEnd) isShowTooltip = !0; else {
99
- const {colEnd: colEnd2} = table.getBodyVisibleColRange(0, 5);
100
- isShowTooltip = colEnd2 !== colEnd;
101
- }
102
- } else if (i === colStart && isShowTooltip) {
103
- const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn, {colStart: colStart1} = table.getBodyVisibleColRange(widthLimitToShowTooltipForEdgeColumn, 0);
104
- if (colStart1 === colStart) isShowTooltip = !0; else {
105
- const {colStart: colStart2} = table.getBodyVisibleColRange(0, -5);
106
- isShowTooltip = colStart2 !== colStart;
107
- }
108
- }
109
- if (isScatter) table.stateManager.hover.cellPos.col === i && table.stateManager.hover.cellPos.row === row || null === (_d = (_c = exports.chartInstanceListRowByRowDirection[row][i]).showCrosshair) || void 0 === _d || _d.call(_c, (axis => "left" === axis.layoutOrient ? positionValueOrYValue : dimensionValueOrXValue)); else {
110
- const bodyBoundryLeft = table.frozenColCount ? table.getCellRelativeRect(table.frozenColCount - 1, row).right : 0, absolutePositionLeft = Math.max(bodyBoundryLeft, table.getCellRelativeRect(i, row).left);
98
+ if (isScatter || "object" != typeof chartDimensionLinkage || (isShowTooltip = null === (_b = chartDimensionLinkage.showTooltip) || void 0 === _b || _b,
99
+ isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeColumn(i, table)), isScatter) table.stateManager.hover.cellPos.col === i && table.stateManager.hover.cellPos.row === row || null === (_d = (_c = exports.chartInstanceListRowByRowDirection[row][i]).showCrosshair) || void 0 === _d || _d.call(_c, (axis => "left" === axis.layoutOrient ? positionValueOrYValue : dimensionValueOrXValue)); else {
100
+ const cellBoundry = table.getCellRelativeRect(i, row), bodyBoundryLeft = table.frozenColCount ? table.getCellRelativeRect(table.frozenColCount - 1, row).right : 0, absolutePositionLeft = Math.max(bodyBoundryLeft, table.getCellRelativeRect(i, row).left);
111
101
  hideTooltip ? (table.stateManager.hover.cellPos.col === i && table.stateManager.hover.cellPos.row === row || exports.chartInstanceListRowByRowDirection[row][i].hideTooltip(),
112
102
  exports.chartInstanceListRowByRowDirection[row][i].setDimensionIndex(dimensionValueOrXValue, {
113
103
  tooltip: !1,
114
104
  showTooltipOption: {
115
- x: absolutePositionLeft,
116
- y: canvasXY.y,
105
+ x: absolutePositionLeft - cellBoundry.left,
106
+ y: canvasXY.y - cellBoundry.top,
117
107
  activeType: "dimension"
118
108
  }
119
109
  })) : exports.chartInstanceListRowByRowDirection[row][i].setDimensionIndex(dimensionValueOrXValue, {
120
110
  tooltip: isShowTooltip,
121
111
  showTooltipOption: {
122
- x: absolutePositionLeft,
123
- y: canvasXY.y,
112
+ x: absolutePositionLeft - cellBoundry.left,
113
+ y: canvasXY.y - cellBoundry.top,
124
114
  activeType: "dimension"
125
115
  }
126
116
  });
127
117
  }
128
118
  }
129
- }), 0), table.scenegraph.updateNextFrame();
119
+ }), 0);
120
+ delayRunDimensionHoverTimer.push(timer), table.scenegraph.updateNextFrame();
121
+ }
122
+ }
123
+
124
+ function generateChartInstanceListByViewRange(datum, table, deactivate = !1) {
125
+ var _a;
126
+ clearDelayRunDimensionHoverTimers();
127
+ const {rowStart: rowStart} = table.getBodyVisibleRowRange();
128
+ let rowEnd = table.getBodyVisibleRowRange().rowEnd;
129
+ rowEnd = Math.min(table.rowCount - 1 - table.bottomFrozenRowCount, rowEnd);
130
+ const {colStart: colStart} = table.getBodyVisibleColRange();
131
+ let colEnd = table.getBodyVisibleColRange().colEnd;
132
+ colEnd = Math.min(table.colCount - 1 - table.rightFrozenColCount, colEnd);
133
+ for (let col = colStart; col <= colEnd; col++) {
134
+ (0, vutils_1.isValid)(exports.chartInstanceListColumnByColumnDirection[col]) || (exports.chartInstanceListColumnByColumnDirection[col] = {});
135
+ for (let i = rowStart; i <= rowEnd; i++) {
136
+ const cellGroup = table.scenegraph.getCell(col, i), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
137
+ exports.chartInstanceListColumnByColumnDirection[col][i] || (0, vutils_1.isValid)(chartNode) && (chartNode.addUpdateShapeAndBoundsTag(),
138
+ chartNode.activeChartInstance ? exports.chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance : "pie" === chartNode.attribute.spec.type && (chartNode.activate(table),
139
+ exports.chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance));
140
+ const timer = setTimeout((() => {
141
+ var _a, _b;
142
+ if (null === (_a = exports.chartInstanceListColumnByColumnDirection[col]) || void 0 === _a ? void 0 : _a[i]) {
143
+ const chartDimensionLinkage = table.options.chartDimensionLinkage;
144
+ let isShowTooltip = !0;
145
+ "object" == typeof chartDimensionLinkage && (deactivate ? (exports.chartInstanceListColumnByColumnDirection[col][i].setHovered(),
146
+ exports.chartInstanceListColumnByColumnDirection[col][i].hideTooltip()) : (isShowTooltip = null === (_b = chartDimensionLinkage.showTooltip) || void 0 === _b || _b,
147
+ isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeRow(i, table), isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeColumn(col, table),
148
+ exports.chartInstanceListColumnByColumnDirection[col][i].setHovered(datum), isShowTooltip && exports.chartInstanceListColumnByColumnDirection[col][i].showTooltip(datum, {
149
+ activeType: "mark"
150
+ })));
151
+ }
152
+ }), 0);
153
+ delayRunDimensionHoverTimer.push(timer), table.scenegraph.updateNextFrame();
154
+ }
130
155
  }
131
156
  }
132
157
 
133
- function clearChartInstanceListByRowDirection(row, excludedCol, table) {
158
+ function checkIsShowTooltipForEdgeRow(row, table) {
159
+ var _a, _b;
160
+ let isShowTooltip = !0;
161
+ const {rowStart: rowStart} = table.getBodyVisibleRowRange();
162
+ let rowEnd = table.getBodyVisibleRowRange().rowEnd;
163
+ rowEnd = Math.min(table.rowCount - 1 - table.bottomFrozenRowCount, rowEnd);
164
+ const chartDimensionLinkage = table.options.chartDimensionLinkage;
165
+ if (row === rowEnd && isShowTooltip) {
166
+ const heightLimitToShowTooltipForEdgeRow = null !== (_a = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow) && void 0 !== _a ? _a : 0, {rowEnd: rowEnd1} = table.getBodyVisibleRowRange(0, -heightLimitToShowTooltipForEdgeRow);
167
+ if (rowEnd1 === rowEnd) isShowTooltip = !0; else {
168
+ const {rowEnd: rowEnd2} = table.getBodyVisibleRowRange(0, 5);
169
+ isShowTooltip = rowEnd2 !== rowEnd;
170
+ }
171
+ } else if (row === rowStart && isShowTooltip) {
172
+ const heightLimitToShowTooltipForEdgeRow = null !== (_b = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow) && void 0 !== _b ? _b : 0, {rowStart: rowStart1} = table.getBodyVisibleRowRange(heightLimitToShowTooltipForEdgeRow, 0);
173
+ if (rowStart1 === rowStart) isShowTooltip = !0; else {
174
+ const {rowStart: rowStart2} = table.getBodyVisibleRowRange(0, -5);
175
+ isShowTooltip = rowStart2 !== rowStart;
176
+ }
177
+ }
178
+ return isShowTooltip;
179
+ }
180
+
181
+ function checkIsShowTooltipForEdgeColumn(col, table) {
182
+ let isShowTooltip = !0;
183
+ const {colStart: colStart} = table.getBodyVisibleColRange();
184
+ let colEnd = table.getBodyVisibleColRange().colEnd;
185
+ colEnd = Math.min(table.colCount - 1 - table.rightFrozenColCount, colEnd);
186
+ const chartDimensionLinkage = table.options.chartDimensionLinkage;
187
+ if (col === colEnd && isShowTooltip) {
188
+ const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn, {colEnd: colEnd1} = table.getBodyVisibleColRange(0, -widthLimitToShowTooltipForEdgeColumn);
189
+ if (colEnd1 === colEnd) isShowTooltip = !0; else {
190
+ const {colEnd: colEnd2} = table.getBodyVisibleColRange(0, 5);
191
+ isShowTooltip = colEnd2 !== colEnd;
192
+ }
193
+ } else if (col === colStart && isShowTooltip) {
194
+ const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn, {colStart: colStart1} = table.getBodyVisibleColRange(widthLimitToShowTooltipForEdgeColumn, 0);
195
+ if (colStart1 === colStart) isShowTooltip = !0; else {
196
+ const {colStart: colStart2} = table.getBodyVisibleColRange(0, -5);
197
+ isShowTooltip = colStart2 !== colStart;
198
+ }
199
+ }
200
+ return isShowTooltip;
201
+ }
202
+
203
+ function clearChartInstanceListByColumnDirection(col, excludedRow, table, forceRelease = !1) {
204
+ var _a;
205
+ if ((0, vutils_1.isValid)(exports.chartInstanceListColumnByColumnDirection[col])) {
206
+ for (const i in exports.chartInstanceListColumnByColumnDirection[col]) {
207
+ if ((0, vutils_1.isValid)(excludedRow) && Number(i) === excludedRow) continue;
208
+ const cellGroup = table.scenegraph.getCell(col, Number(i)), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
209
+ (0, vutils_1.isValid)(chartNode) && (chartNode.addUpdateShapeAndBoundsTag(), chartNode.deactivate(table, {
210
+ forceRelease: forceRelease,
211
+ releaseChartInstance: !0,
212
+ releaseColumnChartInstance: !1,
213
+ releaseRowChartInstance: !1
214
+ }), exports.chartInstanceListColumnByColumnDirection[col][i] = null);
215
+ }
216
+ delete exports.chartInstanceListColumnByColumnDirection[col];
217
+ }
218
+ }
219
+
220
+ function clearChartInstanceListByRowDirection(row, excludedCol, table, forceRelease = !1) {
134
221
  var _a;
135
222
  if ((0, vutils_1.isValid)(exports.chartInstanceListRowByRowDirection[row])) for (const i in exports.chartInstanceListRowByRowDirection[row]) {
136
223
  if ((0, vutils_1.isValid)(excludedCol) && Number(i) === excludedCol) continue;
137
224
  const cellGroup = table.scenegraph.getCell(Number(i), row), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
138
- chartNode.addUpdateShapeAndBoundsTag(), (0, vutils_1.isValid)(chartNode) && (chartNode.deactivate(table, {
225
+ (0, vutils_1.isValid)(chartNode) && (chartNode.addUpdateShapeAndBoundsTag(), chartNode.deactivate(table, {
226
+ forceRelease: forceRelease,
139
227
  releaseChartInstance: !0,
140
228
  releaseColumnChartInstance: !1,
141
229
  releaseRowChartInstance: !1
@@ -144,9 +232,41 @@ function clearChartInstanceListByRowDirection(row, excludedCol, table) {
144
232
  delete exports.chartInstanceListRowByRowDirection[row];
145
233
  }
146
234
 
147
- exports.chartInstanceListColumnByColumnDirection = {}, exports.chartInstanceListRowByRowDirection = {},
235
+ function clearDelayRunDimensionHoverTimers() {
236
+ for (const timer of delayRunDimensionHoverTimer) clearTimeout(timer);
237
+ delayRunDimensionHoverTimer.length = 0;
238
+ }
239
+
240
+ function clearAllChartInstanceList(table, forceRelease = !1) {
241
+ clearDelayRunDimensionHoverTimers();
242
+ for (const col in exports.chartInstanceListColumnByColumnDirection) clearChartInstanceListByColumnDirection(Number(col), void 0, table, forceRelease);
243
+ for (const row in exports.chartInstanceListRowByRowDirection) clearChartInstanceListByRowDirection(Number(row), void 0, table, forceRelease);
244
+ }
245
+
246
+ function disableDimensionHoverToAllChartInstances() {
247
+ clearDelayRunDimensionHoverTimers();
248
+ for (const col in exports.chartInstanceListColumnByColumnDirection) for (const row in exports.chartInstanceListColumnByColumnDirection[col]) exports.chartInstanceListColumnByColumnDirection[col][row].disableDimensionHoverEvent(!0),
249
+ exports.chartInstanceListColumnByColumnDirection[col][row].disableCrossHair(!0),
250
+ exports.chartInstanceListColumnByColumnDirection[col][row].disableTooltip(!0), exports.chartInstanceListColumnByColumnDirection[col][row].hideTooltip();
251
+ for (const row in exports.chartInstanceListRowByRowDirection) for (const col in exports.chartInstanceListRowByRowDirection[row]) exports.chartInstanceListRowByRowDirection[row][col].disableDimensionHoverEvent(!0),
252
+ exports.chartInstanceListRowByRowDirection[row][col].disableCrossHair(!0), exports.chartInstanceListRowByRowDirection[row][col].disableTooltip(!0),
253
+ exports.chartInstanceListRowByRowDirection[row][col].hideTooltip();
254
+ }
255
+
256
+ function enableDimensionHoverToAllChartInstances() {
257
+ for (const col in exports.chartInstanceListColumnByColumnDirection) for (const row in exports.chartInstanceListColumnByColumnDirection[col]) exports.chartInstanceListColumnByColumnDirection[col][row].disableDimensionHoverEvent(!1),
258
+ exports.chartInstanceListColumnByColumnDirection[col][row].disableCrossHair(!1),
259
+ exports.chartInstanceListColumnByColumnDirection[col][row].disableTooltip(!1);
260
+ for (const row in exports.chartInstanceListRowByRowDirection) for (const col in exports.chartInstanceListRowByRowDirection[row]) exports.chartInstanceListRowByRowDirection[row][col].disableDimensionHoverEvent(!1),
261
+ exports.chartInstanceListRowByRowDirection[row][col].disableCrossHair(!1), exports.chartInstanceListRowByRowDirection[row][col].disableTooltip(!1);
262
+ }
263
+
148
264
  exports.generateChartInstanceListByColumnDirection = generateChartInstanceListByColumnDirection,
149
- exports.clearChartInstanceListByColumnDirection = clearChartInstanceListByColumnDirection,
150
265
  exports.generateChartInstanceListByRowDirection = generateChartInstanceListByRowDirection,
151
- exports.clearChartInstanceListByRowDirection = clearChartInstanceListByRowDirection;
266
+ exports.generateChartInstanceListByViewRange = generateChartInstanceListByViewRange,
267
+ exports.clearChartInstanceListByColumnDirection = clearChartInstanceListByColumnDirection,
268
+ exports.clearChartInstanceListByRowDirection = clearChartInstanceListByRowDirection,
269
+ exports.clearDelayRunDimensionHoverTimers = clearDelayRunDimensionHoverTimers, exports.clearAllChartInstanceList = clearAllChartInstanceList,
270
+ exports.disableDimensionHoverToAllChartInstances = disableDimensionHoverToAllChartInstances,
271
+ exports.enableDimensionHoverToAllChartInstances = enableDimensionHoverToAllChartInstances;
152
272
  //# sourceMappingURL=active-cell-chart-list.js.map