@visactor/vtable 1.22.11-alpha.7 → 1.22.11-alpha.8

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 (151) 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/core/BaseTable.js +1 -1
  8. package/cjs/core/BaseTable.js.map +1 -1
  9. package/cjs/core/TABLE_EVENT_TYPE.d.ts +0 -1
  10. package/cjs/core/TABLE_EVENT_TYPE.js +0 -1
  11. package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
  12. package/cjs/core/record-helper.d.ts +2 -4
  13. package/cjs/core/record-helper.js +47 -120
  14. package/cjs/core/record-helper.js.map +1 -1
  15. package/cjs/data/DataSource.d.ts +4 -10
  16. package/cjs/data/DataSource.js +56 -155
  17. package/cjs/data/DataSource.js.map +1 -1
  18. package/cjs/dataset/DataStatistics.js +2 -1
  19. package/cjs/dataset/dataset-pivot-table.js +1 -2
  20. package/cjs/event/event.d.ts +1 -2
  21. package/cjs/event/event.js +9 -20
  22. package/cjs/event/event.js.map +1 -1
  23. package/cjs/event/listener/container-dom.js +1 -1
  24. package/cjs/event/listener/container-dom.js.map +1 -1
  25. package/cjs/event/listener/scroll-bar.js +8 -2
  26. package/cjs/event/listener/scroll-bar.js.map +1 -1
  27. package/cjs/event/listener/table-group.js +14 -8
  28. package/cjs/event/listener/table-group.js.map +1 -1
  29. package/cjs/event/media-click.js +1 -1
  30. package/cjs/event/scroll.js +1 -1
  31. package/cjs/event/sparkline-event.js +1 -1
  32. package/cjs/event/util.js +1 -1
  33. package/cjs/header-helper/style.js +2 -1
  34. package/cjs/index.d.ts +1 -1
  35. package/cjs/index.js +1 -1
  36. package/cjs/index.js.map +1 -1
  37. package/cjs/layout/pivot-header-layout.d.ts +6 -0
  38. package/cjs/layout/pivot-header-layout.js +39 -20
  39. package/cjs/layout/pivot-header-layout.js.map +1 -1
  40. package/cjs/plugins/custom-cell-style.d.ts +0 -5
  41. package/cjs/plugins/custom-cell-style.js +0 -9
  42. package/cjs/plugins/custom-cell-style.js.map +1 -1
  43. package/cjs/plugins/index.js +1 -1
  44. package/cjs/plugins/interface.js +1 -1
  45. package/cjs/plugins/invert-highlight.js +1 -2
  46. package/cjs/plugins/list-tree-stick-cell.js +1 -1
  47. package/cjs/plugins/plugin-manager.js +1 -1
  48. package/cjs/scenegraph/graphic/active-cell-chart-list.d.ts +15 -2
  49. package/cjs/scenegraph/graphic/active-cell-chart-list.js +198 -75
  50. package/cjs/scenegraph/graphic/active-cell-chart-list.js.map +1 -1
  51. package/cjs/scenegraph/graphic/chart.d.ts +10 -1
  52. package/cjs/scenegraph/graphic/chart.js +61 -27
  53. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  54. package/cjs/scenegraph/graphic/contributions/chart-render.js +3 -4
  55. package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  56. package/cjs/scenegraph/refresh-node/update-chart.d.ts +1 -1
  57. package/cjs/scenegraph/refresh-node/update-chart.js +2 -1
  58. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
  59. package/cjs/scenegraph/scenegraph.d.ts +2 -2
  60. package/cjs/scenegraph/scenegraph.js +44 -11
  61. package/cjs/scenegraph/scenegraph.js.map +1 -1
  62. package/cjs/tools/util.d.ts +5 -0
  63. package/cjs/tools/util.js +22 -4
  64. package/cjs/tools/util.js.map +1 -1
  65. package/cjs/ts-types/base-table.d.ts +2 -2
  66. package/cjs/ts-types/base-table.js.map +1 -1
  67. package/cjs/ts-types/events.d.ts +0 -15
  68. package/cjs/ts-types/events.js.map +1 -1
  69. package/cjs/ts-types/table-engine.d.ts +13 -33
  70. package/cjs/ts-types/table-engine.js.map +1 -1
  71. package/cjs/vrender.js.map +1 -1
  72. package/dist/vtable.js +712 -869
  73. package/dist/vtable.min.js +2 -2
  74. package/es/ListTable.d.ts +7 -34
  75. package/es/ListTable.js +14 -130
  76. package/es/ListTable.js.map +1 -1
  77. package/es/PivotChart.d.ts +3 -0
  78. package/es/PivotChart.js +13 -4
  79. package/es/PivotChart.js.map +1 -1
  80. package/es/core/BaseTable.js +1 -1
  81. package/es/core/BaseTable.js.map +1 -1
  82. package/es/core/TABLE_EVENT_TYPE.d.ts +0 -1
  83. package/es/core/TABLE_EVENT_TYPE.js +0 -1
  84. package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
  85. package/es/core/record-helper.d.ts +2 -4
  86. package/es/core/record-helper.js +43 -114
  87. package/es/core/record-helper.js.map +1 -1
  88. package/es/data/DataSource.d.ts +4 -10
  89. package/es/data/DataSource.js +56 -155
  90. package/es/data/DataSource.js.map +1 -1
  91. package/es/dataset/DataStatistics.js +2 -1
  92. package/es/dataset/dataset-pivot-table.js +1 -2
  93. package/es/event/event.d.ts +1 -2
  94. package/es/event/event.js +9 -20
  95. package/es/event/event.js.map +1 -1
  96. package/es/event/listener/container-dom.js +1 -1
  97. package/es/event/listener/container-dom.js.map +1 -1
  98. package/es/event/listener/scroll-bar.js +8 -2
  99. package/es/event/listener/scroll-bar.js.map +1 -1
  100. package/es/event/listener/table-group.js +13 -8
  101. package/es/event/listener/table-group.js.map +1 -1
  102. package/es/event/media-click.js +1 -1
  103. package/es/event/scroll.js +1 -1
  104. package/es/event/sparkline-event.js +1 -1
  105. package/es/event/util.js +1 -1
  106. package/es/header-helper/style.js +2 -1
  107. package/es/index.d.ts +1 -1
  108. package/es/index.js +1 -1
  109. package/es/index.js.map +1 -1
  110. package/es/layout/pivot-header-layout.d.ts +6 -0
  111. package/es/layout/pivot-header-layout.js +39 -20
  112. package/es/layout/pivot-header-layout.js.map +1 -1
  113. package/es/plugins/custom-cell-style.d.ts +0 -5
  114. package/es/plugins/custom-cell-style.js +0 -9
  115. package/es/plugins/custom-cell-style.js.map +1 -1
  116. package/es/plugins/index.js +1 -1
  117. package/es/plugins/interface.js +1 -1
  118. package/es/plugins/invert-highlight.js +1 -2
  119. package/es/plugins/list-tree-stick-cell.js +1 -1
  120. package/es/plugins/plugin-manager.js +1 -1
  121. package/es/scenegraph/graphic/active-cell-chart-list.d.ts +15 -2
  122. package/es/scenegraph/graphic/active-cell-chart-list.js +186 -68
  123. package/es/scenegraph/graphic/active-cell-chart-list.js.map +1 -1
  124. package/es/scenegraph/graphic/chart.d.ts +10 -1
  125. package/es/scenegraph/graphic/chart.js +58 -25
  126. package/es/scenegraph/graphic/chart.js.map +1 -1
  127. package/es/scenegraph/graphic/contributions/chart-render.js +3 -4
  128. package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  129. package/es/scenegraph/refresh-node/update-chart.d.ts +1 -1
  130. package/es/scenegraph/refresh-node/update-chart.js +2 -1
  131. package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
  132. package/es/scenegraph/scenegraph.d.ts +2 -2
  133. package/es/scenegraph/scenegraph.js +43 -10
  134. package/es/scenegraph/scenegraph.js.map +1 -1
  135. package/es/tools/util.d.ts +5 -0
  136. package/es/tools/util.js +18 -0
  137. package/es/tools/util.js.map +1 -1
  138. package/es/ts-types/base-table.d.ts +2 -2
  139. package/es/ts-types/base-table.js.map +1 -1
  140. package/es/ts-types/events.d.ts +0 -15
  141. package/es/ts-types/events.js.map +1 -1
  142. package/es/ts-types/table-engine.d.ts +13 -33
  143. package/es/ts-types/table-engine.js.map +1 -1
  144. package/es/vrender.js.map +1 -1
  145. package/package.json +4 -4
  146. package/cjs/core/index.d.ts +0 -1
  147. package/cjs/core/index.js +0 -30
  148. package/cjs/core/index.js.map +0 -1
  149. package/es/core/index.d.ts +0 -1
  150. package/es/core/index.js +0 -2
  151. 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;
@@ -8,15 +8,6 @@ export class CustomCellStylePlugin {
8
8
  constructor(table, customCellStyle, customCellStyleArrangement) {
9
9
  this.table = table, this.customCellStyle = customCellStyle, this.customCellStyleArrangement = customCellStyleArrangement;
10
10
  }
11
- clearCustomCellStyleArrangement() {
12
- this.customCellStyleArrangement = [];
13
- }
14
- addCustomCellStyleArrangement(cellPosition, customStyleId) {
15
- this.customCellStyleArrangement.push({
16
- cellPosition: cellPosition,
17
- customStyleId: customStyleId
18
- });
19
- }
20
11
  getCustomCellStyle(col, row) {
21
12
  const customStyleIds = this.getCustomCellStyleIds(col, row);
22
13
  if (customStyleIds.length) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugins/custom-cell-style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EACL,aAAa,EAKd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAU1C,MAAM,OAAO,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,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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;AAED,MAAM,UAAU,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,OAAO,CAAC,KAAK,CAAC,EAAE;YACjB,UAAkB,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;SACxC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,EAAE;IAChD,OAAO,CAAC,iBAAiB,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC;AAC5E,CAAC,CAAC","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-style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EACL,aAAa,EAKd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAU1C,MAAM,OAAO,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,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,CAAC,CAAC;gBACjE,IAAI,UAAU,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,CAAC,EAAE;oBAClC,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC;wBAC9B,GAAG;wBACH,GAAG;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B,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE;YACjB,UAAkB,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;SACxC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,EAAE;IAChD,OAAO,CAAC,iBAAiB,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC;AAC5E,CAAC,CAAC","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,4 +1,4 @@
1
1
  export { PluginManager } from "./plugin-manager";
2
2
 
3
3
  export { CustomCellStylePlugin } from "./custom-cell-style";
4
- //# sourceMappingURL=index.js.map
4
+ //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
1
  export { };
2
- //# sourceMappingURL=interface.js.map
2
+ //# sourceMappingURL=interface.js.map
@@ -10,5 +10,4 @@ export function onBeforeAttributeUpdateForInvertHighlight(val, attribute) {
10
10
  height: null !== (_b = val.height) && void 0 !== _b ? _b : shadowRect.attribute.height
11
11
  });
12
12
  }
13
- }
14
- //# sourceMappingURL=invert-highlight.js.map
13
+ }
@@ -175,4 +175,4 @@ function scrollToRow(row, table) {
175
175
  export const registerListTreeStickCellPlugin = () => {
176
176
  Factory.registerComponent("listTreeStickCellPlugin", ListTreeStickCellPlugin);
177
177
  };
178
- //# sourceMappingURL=list-tree-stick-cell.js.map
178
+ //# sourceMappingURL=list-tree-stick-cell.js.map
@@ -51,4 +51,4 @@ export class PluginManager {
51
51
  }));
52
52
  }
53
53
  }
54
- //# sourceMappingURL=plugin-manager.js.map
54
+ //# sourceMappingURL=plugin-manager.js.map
@@ -1,13 +1,26 @@
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 isDisabledShowTooltipToAllChartInstances(): boolean;
25
+ export declare function disableTooltipToAllChartInstances(): void;
26
+ export declare function enableTooltipToAllChartInstances(): void;
@@ -1,136 +1,223 @@
1
1
  import { isValid } from "@visactor/vutils";
2
2
 
3
+ let brushingChartInstance, brushingChartInstanceCellPos = {
4
+ col: -1,
5
+ row: -1
6
+ };
7
+
8
+ export function setBrushingChartInstance(chartInstance, col, row) {
9
+ brushingChartInstance = chartInstance, brushingChartInstanceCellPos = {
10
+ col: col,
11
+ row: row
12
+ };
13
+ }
14
+
15
+ export function clearBrushingChartInstance() {
16
+ brushingChartInstance = void 0, brushingChartInstanceCellPos = {
17
+ col: -1,
18
+ row: -1
19
+ };
20
+ }
21
+
22
+ export function getBrushingChartInstance() {
23
+ return brushingChartInstance;
24
+ }
25
+
26
+ export function getBrushingChartInstanceCellPos() {
27
+ return brushingChartInstanceCellPos;
28
+ }
29
+
3
30
  export const chartInstanceListColumnByColumnDirection = {};
4
31
 
5
32
  export const chartInstanceListRowByRowDirection = {};
6
33
 
34
+ const delayRunDimensionHoverTimer = [];
35
+
7
36
  export function generateChartInstanceListByColumnDirection(col, dimensionValueOrXValue, positionValueOrYValue, canvasXY, table, hideTooltip = !1, isScatter = !1) {
8
37
  var _a;
9
- isValid(chartInstanceListColumnByColumnDirection[col]) || (chartInstanceListColumnByColumnDirection[col] = {});
38
+ clearDelayRunDimensionHoverTimers(), isValid(chartInstanceListColumnByColumnDirection[col]) || (chartInstanceListColumnByColumnDirection[col] = {});
10
39
  const {rowStart: rowStart} = table.getBodyVisibleRowRange();
11
40
  let rowEnd = table.getBodyVisibleRowRange().rowEnd;
12
41
  rowEnd = Math.min(table.rowCount - 1 - table.bottomFrozenRowCount, rowEnd);
13
42
  for (let i = rowStart; i <= rowEnd; i++) {
14
43
  const cellGroup = table.scenegraph.getCell(col, i), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
15
- chartNode.addUpdateShapeAndBoundsTag(), chartInstanceListColumnByColumnDirection[col][i] || isValid(chartNode) && (chartNode.activeChartInstance || chartNode.activate(table),
16
- chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance),
17
- setTimeout((() => {
18
- var _a, _b, _c, _d, _e, _f;
44
+ chartInstanceListColumnByColumnDirection[col][i] || isValid(chartNode) && (chartNode.addUpdateShapeAndBoundsTag(),
45
+ chartNode.activeChartInstance || chartNode.activate(table), chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance);
46
+ const timer = setTimeout((() => {
47
+ var _a, _b, _c, _d;
19
48
  if (null === (_a = chartInstanceListColumnByColumnDirection[col]) || void 0 === _a ? void 0 : _a[i]) {
20
49
  const chartDimensionLinkage = table.options.chartDimensionLinkage;
21
50
  let isShowTooltip = !isScatter;
22
- if (!isScatter && "object" == typeof chartDimensionLinkage) if (isShowTooltip = null === (_b = chartDimensionLinkage.showTooltip) || void 0 === _b || _b,
23
- i === rowEnd && isShowTooltip) {
24
- const heightLimitToShowTooltipForEdgeRow = null !== (_c = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow) && void 0 !== _c ? _c : 0, {rowEnd: rowEnd1} = table.getBodyVisibleRowRange(0, -heightLimitToShowTooltipForEdgeRow);
25
- if (rowEnd1 === rowEnd) isShowTooltip = !0; else {
26
- const {rowEnd: rowEnd2} = table.getBodyVisibleRowRange(0, 5);
27
- isShowTooltip = rowEnd2 !== rowEnd;
28
- }
29
- } else if (i === rowStart && isShowTooltip) {
30
- const heightLimitToShowTooltipForEdgeRow = null !== (_d = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow) && void 0 !== _d ? _d : 0, {rowStart: rowStart1} = table.getBodyVisibleRowRange(heightLimitToShowTooltipForEdgeRow, 0);
31
- if (rowStart1 === rowStart) isShowTooltip = !0; else {
32
- const {rowStart: rowStart2} = table.getBodyVisibleRowRange(0, -5);
33
- isShowTooltip = rowStart2 !== rowStart;
34
- }
35
- }
36
- if (isScatter) table.stateManager.hover.cellPos.col === col && table.stateManager.hover.cellPos.row === i || null === (_f = (_e = chartInstanceListColumnByColumnDirection[col][i]).showCrosshair) || void 0 === _f || _f.call(_e, (axis => "left" === axis.layoutOrient ? positionValueOrYValue : dimensionValueOrXValue)); else {
37
- const bodyBoundryTop = table.frozenRowCount ? table.getCellRelativeRect(col, table.frozenRowCount - 1).bottom : 0, absolutePositionTop = Math.max(bodyBoundryTop, table.getCellRelativeRect(col, i).top);
51
+ if (isScatter || "object" != typeof chartDimensionLinkage || (isShowTooltip = null === (_b = chartDimensionLinkage.showTooltip) || void 0 === _b || _b,
52
+ isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeRow(i, table)), isScatter) table.stateManager.hover.cellPos.col === col && table.stateManager.hover.cellPos.row === i || null === (_d = (_c = chartInstanceListColumnByColumnDirection[col][i]).showCrosshair) || void 0 === _d || _d.call(_c, (axis => "left" === axis.layoutOrient ? positionValueOrYValue : dimensionValueOrXValue)); else {
53
+ 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);
38
54
  hideTooltip ? (table.stateManager.hover.cellPos.col === col && table.stateManager.hover.cellPos.row === i || chartInstanceListColumnByColumnDirection[col][i].hideTooltip(),
39
55
  chartInstanceListColumnByColumnDirection[col][i].setDimensionIndex(dimensionValueOrXValue, {
40
56
  tooltip: !1,
41
57
  showTooltipOption: {
42
- x: canvasXY.x,
43
- y: absolutePositionTop,
58
+ x: canvasXY.x - cellBoundry.left,
59
+ y: absolutePositionTop - cellBoundry.top,
44
60
  activeType: "dimension"
45
61
  }
46
62
  })) : chartInstanceListColumnByColumnDirection[col][i].setDimensionIndex(dimensionValueOrXValue, {
47
63
  tooltip: isShowTooltip,
48
64
  showTooltipOption: {
49
- x: canvasXY.x,
50
- y: absolutePositionTop,
65
+ x: canvasXY.x - cellBoundry.left,
66
+ y: absolutePositionTop - cellBoundry.top,
51
67
  activeType: "dimension"
52
68
  }
53
69
  });
54
70
  }
55
71
  }
56
- }), 0), table.scenegraph.updateNextFrame();
57
- }
58
- }
59
-
60
- export function clearChartInstanceListByColumnDirection(col, excludedRow, table) {
61
- var _a;
62
- if (isValid(chartInstanceListColumnByColumnDirection[col])) {
63
- for (const i in chartInstanceListColumnByColumnDirection[col]) {
64
- if (isValid(excludedRow) && Number(i) === excludedRow) continue;
65
- const cellGroup = table.scenegraph.getCell(col, Number(i)), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
66
- chartNode.addUpdateShapeAndBoundsTag(), isValid(chartNode) && (chartNode.deactivate(table, {
67
- releaseChartInstance: !0,
68
- releaseColumnChartInstance: !1,
69
- releaseRowChartInstance: !1
70
- }), chartInstanceListColumnByColumnDirection[col][i] = null);
71
- }
72
- delete chartInstanceListColumnByColumnDirection[col];
72
+ }), 0);
73
+ delayRunDimensionHoverTimer.push(timer), table.scenegraph.updateNextFrame();
73
74
  }
74
75
  }
75
76
 
76
77
  export function generateChartInstanceListByRowDirection(row, dimensionValueOrXValue, positionValueOrYValue, canvasXY, table, hideTooltip = !1, isScatter = !1) {
77
78
  var _a;
78
- isValid(chartInstanceListRowByRowDirection[row]) || (chartInstanceListRowByRowDirection[row] = {});
79
+ clearDelayRunDimensionHoverTimers(), isValid(chartInstanceListRowByRowDirection[row]) || (chartInstanceListRowByRowDirection[row] = {});
79
80
  const {colStart: colStart} = table.getBodyVisibleColRange();
80
81
  let colEnd = table.getBodyVisibleColRange().colEnd;
81
82
  colEnd = Math.min(table.colCount - 1 - table.rightFrozenColCount, colEnd);
82
83
  for (let i = colStart; i <= colEnd; i++) {
83
84
  const cellGroup = table.scenegraph.getCell(i, row), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
84
- chartNode.addUpdateShapeAndBoundsTag(), chartInstanceListRowByRowDirection[row][i] || isValid(chartNode) && (chartNode.activeChartInstance || chartNode.activate(table),
85
- chartInstanceListRowByRowDirection[row][i] = chartNode.activeChartInstance), setTimeout((() => {
85
+ chartInstanceListRowByRowDirection[row][i] || isValid(chartNode) && (chartNode.addUpdateShapeAndBoundsTag(),
86
+ chartNode.activeChartInstance || chartNode.activate(table), chartInstanceListRowByRowDirection[row][i] = chartNode.activeChartInstance);
87
+ const timer = setTimeout((() => {
86
88
  var _a, _b, _c, _d;
87
89
  if (null === (_a = chartInstanceListRowByRowDirection[row]) || void 0 === _a ? void 0 : _a[i]) {
88
90
  const chartDimensionLinkage = table.options.chartDimensionLinkage;
89
91
  let isShowTooltip = !isScatter;
90
- if (!isScatter && "object" == typeof chartDimensionLinkage) if (isShowTooltip = null === (_b = chartDimensionLinkage.showTooltip) || void 0 === _b || _b,
91
- i === colEnd && isShowTooltip) {
92
- const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn, {colEnd: colEnd1} = table.getBodyVisibleColRange(0, -widthLimitToShowTooltipForEdgeColumn);
93
- if (colEnd1 === colEnd) isShowTooltip = !0; else {
94
- const {colEnd: colEnd2} = table.getBodyVisibleColRange(0, 5);
95
- isShowTooltip = colEnd2 !== colEnd;
96
- }
97
- } else if (i === colStart && isShowTooltip) {
98
- const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn, {colStart: colStart1} = table.getBodyVisibleColRange(widthLimitToShowTooltipForEdgeColumn, 0);
99
- if (colStart1 === colStart) isShowTooltip = !0; else {
100
- const {colStart: colStart2} = table.getBodyVisibleColRange(0, -5);
101
- isShowTooltip = colStart2 !== colStart;
102
- }
103
- }
104
- if (isScatter) table.stateManager.hover.cellPos.col === i && table.stateManager.hover.cellPos.row === row || null === (_d = (_c = chartInstanceListRowByRowDirection[row][i]).showCrosshair) || void 0 === _d || _d.call(_c, (axis => "left" === axis.layoutOrient ? positionValueOrYValue : dimensionValueOrXValue)); else {
105
- const bodyBoundryLeft = table.frozenColCount ? table.getCellRelativeRect(table.frozenColCount - 1, row).right : 0, absolutePositionLeft = Math.max(bodyBoundryLeft, table.getCellRelativeRect(i, row).left);
92
+ if (isScatter || "object" != typeof chartDimensionLinkage || (isShowTooltip = null === (_b = chartDimensionLinkage.showTooltip) || void 0 === _b || _b,
93
+ isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeColumn(i, table)), isScatter) table.stateManager.hover.cellPos.col === i && table.stateManager.hover.cellPos.row === row || null === (_d = (_c = chartInstanceListRowByRowDirection[row][i]).showCrosshair) || void 0 === _d || _d.call(_c, (axis => "left" === axis.layoutOrient ? positionValueOrYValue : dimensionValueOrXValue)); else {
94
+ 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);
106
95
  hideTooltip ? (table.stateManager.hover.cellPos.col === i && table.stateManager.hover.cellPos.row === row || chartInstanceListRowByRowDirection[row][i].hideTooltip(),
107
96
  chartInstanceListRowByRowDirection[row][i].setDimensionIndex(dimensionValueOrXValue, {
108
97
  tooltip: !1,
109
98
  showTooltipOption: {
110
- x: absolutePositionLeft,
111
- y: canvasXY.y,
99
+ x: absolutePositionLeft - cellBoundry.left,
100
+ y: canvasXY.y - cellBoundry.top,
112
101
  activeType: "dimension"
113
102
  }
114
103
  })) : chartInstanceListRowByRowDirection[row][i].setDimensionIndex(dimensionValueOrXValue, {
115
104
  tooltip: isShowTooltip,
116
105
  showTooltipOption: {
117
- x: absolutePositionLeft,
118
- y: canvasXY.y,
106
+ x: absolutePositionLeft - cellBoundry.left,
107
+ y: canvasXY.y - cellBoundry.top,
119
108
  activeType: "dimension"
120
109
  }
121
110
  });
122
111
  }
123
112
  }
124
- }), 0), table.scenegraph.updateNextFrame();
113
+ }), 0);
114
+ delayRunDimensionHoverTimer.push(timer), table.scenegraph.updateNextFrame();
115
+ }
116
+ }
117
+
118
+ export function generateChartInstanceListByViewRange(datum, table, deactivate = !1) {
119
+ var _a;
120
+ clearDelayRunDimensionHoverTimers();
121
+ const {rowStart: rowStart} = table.getBodyVisibleRowRange();
122
+ let rowEnd = table.getBodyVisibleRowRange().rowEnd;
123
+ rowEnd = Math.min(table.rowCount - 1 - table.bottomFrozenRowCount, rowEnd);
124
+ const {colStart: colStart} = table.getBodyVisibleColRange();
125
+ let colEnd = table.getBodyVisibleColRange().colEnd;
126
+ colEnd = Math.min(table.colCount - 1 - table.rightFrozenColCount, colEnd);
127
+ for (let col = colStart; col <= colEnd; col++) {
128
+ isValid(chartInstanceListColumnByColumnDirection[col]) || (chartInstanceListColumnByColumnDirection[col] = {});
129
+ for (let i = rowStart; i <= rowEnd; i++) {
130
+ const cellGroup = table.scenegraph.getCell(col, i), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
131
+ chartInstanceListColumnByColumnDirection[col][i] || isValid(chartNode) && (chartNode.addUpdateShapeAndBoundsTag(),
132
+ chartNode.activeChartInstance ? chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance : "pie" === chartNode.attribute.spec.type && (chartNode.activate(table),
133
+ chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance));
134
+ const timer = setTimeout((() => {
135
+ var _a, _b;
136
+ if (null === (_a = chartInstanceListColumnByColumnDirection[col]) || void 0 === _a ? void 0 : _a[i]) {
137
+ const chartDimensionLinkage = table.options.chartDimensionLinkage;
138
+ let isShowTooltip = !0;
139
+ "object" == typeof chartDimensionLinkage && (deactivate ? (chartInstanceListColumnByColumnDirection[col][i].setHovered(),
140
+ chartInstanceListColumnByColumnDirection[col][i].hideTooltip()) : (isShowTooltip = null === (_b = chartDimensionLinkage.showTooltip) || void 0 === _b || _b,
141
+ isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeRow(i, table), isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeColumn(col, table),
142
+ chartInstanceListColumnByColumnDirection[col][i].setHovered(datum), isShowTooltip && chartInstanceListColumnByColumnDirection[col][i].showTooltip(datum, {
143
+ activeType: "mark"
144
+ })));
145
+ }
146
+ }), 0);
147
+ delayRunDimensionHoverTimer.push(timer), table.scenegraph.updateNextFrame();
148
+ }
149
+ }
150
+ }
151
+
152
+ function checkIsShowTooltipForEdgeRow(row, table) {
153
+ var _a, _b;
154
+ let isShowTooltip = !0;
155
+ const {rowStart: rowStart} = table.getBodyVisibleRowRange();
156
+ let rowEnd = table.getBodyVisibleRowRange().rowEnd;
157
+ rowEnd = Math.min(table.rowCount - 1 - table.bottomFrozenRowCount, rowEnd);
158
+ const chartDimensionLinkage = table.options.chartDimensionLinkage;
159
+ if (row === rowEnd && isShowTooltip) {
160
+ const heightLimitToShowTooltipForEdgeRow = null !== (_a = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow) && void 0 !== _a ? _a : 0, {rowEnd: rowEnd1} = table.getBodyVisibleRowRange(0, -heightLimitToShowTooltipForEdgeRow);
161
+ if (rowEnd1 === rowEnd) isShowTooltip = !0; else {
162
+ const {rowEnd: rowEnd2} = table.getBodyVisibleRowRange(0, 5);
163
+ isShowTooltip = rowEnd2 !== rowEnd;
164
+ }
165
+ } else if (row === rowStart && isShowTooltip) {
166
+ const heightLimitToShowTooltipForEdgeRow = null !== (_b = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow) && void 0 !== _b ? _b : 0, {rowStart: rowStart1} = table.getBodyVisibleRowRange(heightLimitToShowTooltipForEdgeRow, 0);
167
+ if (rowStart1 === rowStart) isShowTooltip = !0; else {
168
+ const {rowStart: rowStart2} = table.getBodyVisibleRowRange(0, -5);
169
+ isShowTooltip = rowStart2 !== rowStart;
170
+ }
171
+ }
172
+ return isShowTooltip;
173
+ }
174
+
175
+ function checkIsShowTooltipForEdgeColumn(col, table) {
176
+ let isShowTooltip = !0;
177
+ const {colStart: colStart} = table.getBodyVisibleColRange();
178
+ let colEnd = table.getBodyVisibleColRange().colEnd;
179
+ colEnd = Math.min(table.colCount - 1 - table.rightFrozenColCount, colEnd);
180
+ const chartDimensionLinkage = table.options.chartDimensionLinkage;
181
+ if (col === colEnd && isShowTooltip) {
182
+ const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn, {colEnd: colEnd1} = table.getBodyVisibleColRange(0, -widthLimitToShowTooltipForEdgeColumn);
183
+ if (colEnd1 === colEnd) isShowTooltip = !0; else {
184
+ const {colEnd: colEnd2} = table.getBodyVisibleColRange(0, 5);
185
+ isShowTooltip = colEnd2 !== colEnd;
186
+ }
187
+ } else if (col === colStart && isShowTooltip) {
188
+ const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn, {colStart: colStart1} = table.getBodyVisibleColRange(widthLimitToShowTooltipForEdgeColumn, 0);
189
+ if (colStart1 === colStart) isShowTooltip = !0; else {
190
+ const {colStart: colStart2} = table.getBodyVisibleColRange(0, -5);
191
+ isShowTooltip = colStart2 !== colStart;
192
+ }
193
+ }
194
+ return isShowTooltip;
195
+ }
196
+
197
+ export function clearChartInstanceListByColumnDirection(col, excludedRow, table, forceRelease = !1) {
198
+ var _a;
199
+ if (isValid(chartInstanceListColumnByColumnDirection[col])) {
200
+ for (const i in chartInstanceListColumnByColumnDirection[col]) {
201
+ if (isValid(excludedRow) && Number(i) === excludedRow) continue;
202
+ const cellGroup = table.scenegraph.getCell(col, Number(i)), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
203
+ isValid(chartNode) && (chartNode.addUpdateShapeAndBoundsTag(), chartNode.deactivate(table, {
204
+ forceRelease: forceRelease,
205
+ releaseChartInstance: !0,
206
+ releaseColumnChartInstance: !1,
207
+ releaseRowChartInstance: !1
208
+ }), chartInstanceListColumnByColumnDirection[col][i] = null);
209
+ }
210
+ delete chartInstanceListColumnByColumnDirection[col];
125
211
  }
126
212
  }
127
213
 
128
- export function clearChartInstanceListByRowDirection(row, excludedCol, table) {
214
+ export function clearChartInstanceListByRowDirection(row, excludedCol, table, forceRelease = !1) {
129
215
  var _a;
130
216
  if (isValid(chartInstanceListRowByRowDirection[row])) for (const i in chartInstanceListRowByRowDirection[row]) {
131
217
  if (isValid(excludedCol) && Number(i) === excludedCol) continue;
132
218
  const cellGroup = table.scenegraph.getCell(Number(i), row), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
133
- chartNode.addUpdateShapeAndBoundsTag(), isValid(chartNode) && (chartNode.deactivate(table, {
219
+ isValid(chartNode) && (chartNode.addUpdateShapeAndBoundsTag(), chartNode.deactivate(table, {
220
+ forceRelease: forceRelease,
134
221
  releaseChartInstance: !0,
135
222
  releaseColumnChartInstance: !1,
136
223
  releaseRowChartInstance: !1
@@ -138,4 +225,35 @@ export function clearChartInstanceListByRowDirection(row, excludedCol, table) {
138
225
  }
139
226
  delete chartInstanceListRowByRowDirection[row];
140
227
  }
228
+
229
+ export function clearDelayRunDimensionHoverTimers() {
230
+ for (const timer of delayRunDimensionHoverTimer) clearTimeout(timer);
231
+ delayRunDimensionHoverTimer.length = 0;
232
+ }
233
+
234
+ export function clearAllChartInstanceList(table, forceRelease = !1) {
235
+ clearDelayRunDimensionHoverTimers();
236
+ for (const col in chartInstanceListColumnByColumnDirection) clearChartInstanceListByColumnDirection(Number(col), void 0, table, forceRelease);
237
+ for (const row in chartInstanceListRowByRowDirection) clearChartInstanceListByRowDirection(Number(row), void 0, table, forceRelease);
238
+ }
239
+
240
+ let disabledShowTooltipToAllChartInstances = !1;
241
+
242
+ export function isDisabledShowTooltipToAllChartInstances() {
243
+ return disabledShowTooltipToAllChartInstances;
244
+ }
245
+
246
+ export function disableTooltipToAllChartInstances() {
247
+ disabledShowTooltipToAllChartInstances = !0, clearDelayRunDimensionHoverTimers();
248
+ for (const col in chartInstanceListColumnByColumnDirection) for (const row in chartInstanceListColumnByColumnDirection[col]) chartInstanceListColumnByColumnDirection[col][row].disableTooltip(!0),
249
+ chartInstanceListColumnByColumnDirection[col][row].hideTooltip();
250
+ for (const row in chartInstanceListRowByRowDirection) for (const col in chartInstanceListRowByRowDirection[row]) chartInstanceListRowByRowDirection[row][col].disableTooltip(!0),
251
+ chartInstanceListRowByRowDirection[row][col].hideTooltip();
252
+ }
253
+
254
+ export function enableTooltipToAllChartInstances() {
255
+ disabledShowTooltipToAllChartInstances = !1;
256
+ for (const col in chartInstanceListColumnByColumnDirection) for (const row in chartInstanceListColumnByColumnDirection[col]) chartInstanceListColumnByColumnDirection[col][row].disableTooltip(!1);
257
+ for (const row in chartInstanceListRowByRowDirection) for (const col in chartInstanceListRowByRowDirection[row]) chartInstanceListRowByRowDirection[row][col].disableTooltip(!1);
258
+ }
141
259
  //# sourceMappingURL=active-cell-chart-list.js.map