@visactor/vtable 1.11.2 → 1.11.3

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 (85) hide show
  1. package/cjs/ListTable.js +15 -12
  2. package/cjs/ListTable.js.map +1 -1
  3. package/cjs/PivotChart.js +6 -6
  4. package/cjs/PivotChart.js.map +1 -1
  5. package/cjs/PivotTable.js +13 -11
  6. package/cjs/PivotTable.js.map +1 -1
  7. package/cjs/components/react/react-custom-layout.d.ts +5 -1
  8. package/cjs/components/react/react-custom-layout.js +19 -5
  9. package/cjs/components/react/react-custom-layout.js.map +1 -1
  10. package/cjs/core/BaseTable.d.ts +1 -1
  11. package/cjs/core/BaseTable.js +6 -5
  12. package/cjs/core/BaseTable.js.map +1 -1
  13. package/cjs/core/record-helper.js +5 -3
  14. package/cjs/core/record-helper.js.map +1 -1
  15. package/cjs/event/event.js +3 -3
  16. package/cjs/event/event.js.map +1 -1
  17. package/cjs/index.d.ts +1 -1
  18. package/cjs/index.js +1 -1
  19. package/cjs/index.js.map +1 -1
  20. package/cjs/plugins/custom-cell-style.js +2 -2
  21. package/cjs/plugins/custom-cell-style.js.map +1 -1
  22. package/cjs/scenegraph/refresh-node/update-chart.js +46 -22
  23. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
  24. package/cjs/scenegraph/scenegraph.d.ts +1 -1
  25. package/cjs/scenegraph/scenegraph.js +6 -1
  26. package/cjs/scenegraph/scenegraph.js.map +1 -1
  27. package/cjs/state/checkbox/checkbox.js +2 -2
  28. package/cjs/state/checkbox/checkbox.js.map +1 -1
  29. package/cjs/state/select/is-cell-select-highlight.js +4 -4
  30. package/cjs/state/select/is-cell-select-highlight.js.map +1 -1
  31. package/cjs/state/select/update-position.js +5 -5
  32. package/cjs/state/select/update-position.js.map +1 -1
  33. package/cjs/state/state.js +1 -1
  34. package/cjs/state/state.js.map +1 -1
  35. package/cjs/ts-types/base-table.d.ts +1 -1
  36. package/cjs/ts-types/base-table.js.map +1 -1
  37. package/cjs/ts-types/list-table/define/basic-define.d.ts +1 -1
  38. package/cjs/ts-types/list-table/define/basic-define.js.map +1 -1
  39. package/cjs/ts-types/pivot-table/indicator/basic-indicator.d.ts +1 -1
  40. package/cjs/ts-types/pivot-table/indicator/basic-indicator.js.map +1 -1
  41. package/cjs/vrender.js.map +1 -1
  42. package/dist/vtable.js +172 -75
  43. package/dist/vtable.min.js +2 -2
  44. package/es/ListTable.js +15 -12
  45. package/es/ListTable.js.map +1 -1
  46. package/es/PivotChart.js +6 -6
  47. package/es/PivotChart.js.map +1 -1
  48. package/es/PivotTable.js +13 -11
  49. package/es/PivotTable.js.map +1 -1
  50. package/es/components/react/react-custom-layout.d.ts +5 -1
  51. package/es/components/react/react-custom-layout.js +19 -5
  52. package/es/components/react/react-custom-layout.js.map +1 -1
  53. package/es/core/BaseTable.d.ts +1 -1
  54. package/es/core/BaseTable.js +5 -4
  55. package/es/core/BaseTable.js.map +1 -1
  56. package/es/core/record-helper.js +5 -3
  57. package/es/core/record-helper.js.map +1 -1
  58. package/es/event/event.js +3 -3
  59. package/es/event/event.js.map +1 -1
  60. package/es/index.d.ts +1 -1
  61. package/es/index.js +1 -1
  62. package/es/index.js.map +1 -1
  63. package/es/plugins/custom-cell-style.js +2 -2
  64. package/es/plugins/custom-cell-style.js.map +1 -1
  65. package/es/scenegraph/refresh-node/update-chart.js +46 -22
  66. package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
  67. package/es/scenegraph/scenegraph.d.ts +1 -1
  68. package/es/scenegraph/scenegraph.js +6 -1
  69. package/es/scenegraph/scenegraph.js.map +1 -1
  70. package/es/state/checkbox/checkbox.js +2 -2
  71. package/es/state/checkbox/checkbox.js.map +1 -1
  72. package/es/state/select/is-cell-select-highlight.js +4 -4
  73. package/es/state/select/is-cell-select-highlight.js.map +1 -1
  74. package/es/state/select/update-position.js +5 -5
  75. package/es/state/select/update-position.js.map +1 -1
  76. package/es/state/state.js +1 -1
  77. package/es/state/state.js.map +1 -1
  78. package/es/ts-types/base-table.d.ts +1 -1
  79. package/es/ts-types/base-table.js.map +1 -1
  80. package/es/ts-types/list-table/define/basic-define.d.ts +1 -1
  81. package/es/ts-types/list-table/define/basic-define.js.map +1 -1
  82. package/es/ts-types/pivot-table/indicator/basic-indicator.d.ts +1 -1
  83. package/es/ts-types/pivot-table/indicator/basic-indicator.js.map +1 -1
  84. package/es/vrender.js.map +1 -1
  85. package/package.json +4 -4
@@ -10,14 +10,18 @@ export declare class ReactCustomLayout {
10
10
  table: BaseTableAPI;
11
11
  customLayoutFuncCache: Map<string, ICustomLayoutFuc>;
12
12
  reactRemoveGraphicCache: Map<string, (col: number, row: number) => void>;
13
+ reactRemoveAllGraphicCache: Map<string, () => void>;
13
14
  headerCustomLayoutFuncCache: Map<string, ICustomLayoutFuc>;
14
15
  headerReactRemoveGraphicCache: Map<string, (col: number, row: number) => void>;
15
- constructor(removeAllContainer: () => void, table: BaseTableAPI);
16
+ headerReactRemoveAllGraphicCache: Map<string, () => void>;
17
+ constructor(table: BaseTableAPI);
16
18
  hasReactCreateGraphic(componentId: string, isHeaderCustomLayout?: boolean): boolean;
17
19
  setReactCreateGraphic(componentId: string, createGraphic: ICustomLayoutFuc, isHeaderCustomLayout?: boolean): void;
18
20
  setReactRemoveGraphic(componentId: string, removeGraphic: (col: number, row: number) => void, isHeaderCustomLayout?: boolean): void;
21
+ setReactRemoveAllGraphic(componentId: string, removeGraphic: () => void, isHeaderCustomLayout?: boolean): void;
19
22
  updateCustomCell(componentId: string, isHeaderCustomLayout?: boolean): void;
20
23
  getCustomLayoutFunc(col: number, row: number): ICustomLayoutFuc | typeof emptyCustomLayout;
21
24
  removeCustomCell(col: number, row: number): void;
22
25
  clearCache(): void;
26
+ updateAllCustomCell(): void;
23
27
  }
@@ -8,10 +8,10 @@ export function emptyCustomLayout(args) {
8
8
  }
9
9
 
10
10
  export class ReactCustomLayout {
11
- constructor(removeAllContainer, table) {
12
- this.removeAllContainer = removeAllContainer, this.table = table, this.customLayoutFuncCache = new Map,
13
- this.reactRemoveGraphicCache = new Map, this.headerCustomLayoutFuncCache = new Map,
14
- this.headerReactRemoveGraphicCache = new Map;
11
+ constructor(table) {
12
+ this.table = table, this.customLayoutFuncCache = new Map, this.reactRemoveGraphicCache = new Map,
13
+ this.reactRemoveAllGraphicCache = new Map, this.headerCustomLayoutFuncCache = new Map,
14
+ this.headerReactRemoveGraphicCache = new Map, this.headerReactRemoveAllGraphicCache = new Map;
15
15
  }
16
16
  hasReactCreateGraphic(componentId, isHeaderCustomLayout) {
17
17
  return isHeaderCustomLayout ? this.headerCustomLayoutFuncCache.has(componentId) : this.customLayoutFuncCache.has(componentId);
@@ -22,6 +22,9 @@ export class ReactCustomLayout {
22
22
  setReactRemoveGraphic(componentId, removeGraphic, isHeaderCustomLayout) {
23
23
  isHeaderCustomLayout ? this.headerReactRemoveGraphicCache.set(componentId, removeGraphic) : this.reactRemoveGraphicCache.set(componentId, removeGraphic);
24
24
  }
25
+ setReactRemoveAllGraphic(componentId, removeGraphic, isHeaderCustomLayout) {
26
+ isHeaderCustomLayout ? this.headerReactRemoveAllGraphicCache.set(componentId, removeGraphic) : this.reactRemoveAllGraphicCache.set(componentId, removeGraphic);
27
+ }
25
28
  updateCustomCell(componentId, isHeaderCustomLayout) {
26
29
  const table = this.table;
27
30
  if (table.isPivotTable()) {
@@ -58,7 +61,18 @@ export class ReactCustomLayout {
58
61
  removeFun && removeFun(col, row);
59
62
  }
60
63
  clearCache() {
61
- this.removeAllContainer();
64
+ this.reactRemoveAllGraphicCache.forEach((removeFun => {
65
+ removeFun();
66
+ })), this.headerReactRemoveAllGraphicCache.forEach((removeFun => {
67
+ removeFun();
68
+ }));
69
+ }
70
+ updateAllCustomCell() {
71
+ this.customLayoutFuncCache.forEach(((createFun, componentId) => {
72
+ this.updateCustomCell(componentId);
73
+ })), this.headerCustomLayoutFuncCache.forEach(((createFun, componentId) => {
74
+ this.updateCustomCell(componentId, !0);
75
+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W,EACxD,MAAM,GAAG,SAAS,CAAC,QAAQ,EAC3B,MAAM,IAAI,aAAa,CAAC,MAAM,EAC9B;gBACA,MAAM,KAAK,GAAG;oBACZ,KAAK,EAAE;wBACL,GAAG,EAAE,MAAM,GAAG,eAAe;wBAC7B,GAAG,EAAE,SAAS,CAAC,sBAAsB;qBACtC;oBACD,GAAG,EAAE;wBACH,GAAG,EAAE,MAAM,GAAG,eAAe;wBAC7B,GAAG,EAAE,SAAS,CAAC,QAAQ,GAAG,CAAC;qBAC5B;iBACF,CAAC;gBACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACpB;SACF;aAAM;YACL,KACE,IAAI,GAAG,GAAG,SAAS,CAAC,sBAAsB,GAAG,WAAW,EACxD,GAAG,GAAG,SAAS,CAAC,QAAQ,EACxB,GAAG,IAAI,aAAa,CAAC,MAAM,EAC3B;gBACA,MAAM,KAAK,GAAG;oBACZ,KAAK,EAAE;wBACL,GAAG,EAAE,SAAS,CAAC,mBAAmB,GAAG,eAAe;wBACpD,GAAG,EAAE,GAAG;qBACT;oBACD,GAAG,EAAE;wBACH,GAAG,EAAE,SAAS,CAAC,QAAQ,GAAG,CAAC;wBAC3B,GAAG,EAAE,GAAG;qBACT;iBACF,CAAC;gBACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACpB;SACF;KACF;IAED,OAAO,MAAM,CAAC;AAQhB,CAAC","file":"react-custom-layout.js","sourcesContent":["import { Group } from './../../vrender';\nimport type { CustomRenderFunctionArg, ICustomLayoutFuc } from '../../ts-types';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { PivotHeaderLayoutMap } from '../../layout/pivot-header-layout';\nimport type { SimpleHeaderLayoutMap } from '../../layout';\n\nexport function emptyCustomLayout(args: CustomRenderFunctionArg) {\n const group = new Group({});\n return {\n rootContainer: group,\n renderDefault: true\n };\n}\n\nexport class ReactCustomLayout {\n removeAllContainer: () => void;\n table: BaseTableAPI;\n customLayoutFuncCache: Map<string, ICustomLayoutFuc>;\n reactRemoveGraphicCache: Map<string, (col: number, row: number) => void>;\n headerCustomLayoutFuncCache: Map<string, ICustomLayoutFuc>;\n headerReactRemoveGraphicCache: Map<string, (col: number, row: number) => void>;\n // reactContainerCache: Map<number, Map<string, any>>;\n constructor(removeAllContainer: () => void, table: BaseTableAPI) {\n this.removeAllContainer = removeAllContainer;\n this.table = table;\n this.customLayoutFuncCache = new Map();\n // this.reactContainerCache = new Map();\n this.reactRemoveGraphicCache = new Map();\n this.headerCustomLayoutFuncCache = new Map();\n // this.headerCeactContainerCache = new Map();\n this.headerReactRemoveGraphicCache = new Map();\n }\n\n hasReactCreateGraphic(componentId: string, isHeaderCustomLayout?: boolean) {\n if (isHeaderCustomLayout) {\n return this.headerCustomLayoutFuncCache.has(componentId);\n }\n return this.customLayoutFuncCache.has(componentId);\n }\n\n setReactCreateGraphic(\n componentId: string,\n createGraphic: ICustomLayoutFuc,\n // containerCache: Map<string, any>,\n isHeaderCustomLayout?: boolean\n ) {\n if (isHeaderCustomLayout) {\n this.headerCustomLayoutFuncCache.set(componentId, createGraphic);\n } else {\n this.customLayoutFuncCache.set(componentId, createGraphic);\n }\n // this.reactContainerCache.set(componentId, containerCache);\n }\n\n setReactRemoveGraphic(\n componentId: string,\n removeGraphic: (col: number, row: number) => void,\n isHeaderCustomLayout?: boolean\n ) {\n if (isHeaderCustomLayout) {\n this.headerReactRemoveGraphicCache.set(componentId, removeGraphic);\n } else {\n this.reactRemoveGraphicCache.set(componentId, removeGraphic);\n }\n }\n\n updateCustomCell(componentId: string, isHeaderCustomLayout?: boolean) {\n const table = this.table;\n // const col = componentId;\n // // to do: deal with transpose table\n // if (isHeaderCustomLayout) {\n // for (let row = 0; row < table.columnHeaderLevelCount; row++) {\n // table.scenegraph.updateCellContent(col, row);\n // }\n // } else {\n // for (let row = table.columnHeaderLevelCount; row < table.rowCount; row++) {\n // table.scenegraph.updateCellContent(col, row);\n // }\n // }\n\n if (table.isPivotTable()) {\n const ranges = getUpdateCustomCellRangeInPivotTable(componentId, table, isHeaderCustomLayout);\n for (let i = 0; i < ranges.length; i++) {\n const range = ranges[i];\n for (let col = range.start.col; col <= range.end.col; col++) {\n for (let row = range.start.row; row <= range.end.row; row++) {\n table.scenegraph.updateCellContent(col, row);\n }\n }\n }\n } else {\n const range = getUpdateCustomCellRangeInListTable(componentId, table, isHeaderCustomLayout);\n for (let col = range.start.col; col <= range.end.col; col++) {\n for (let row = range.start.row; row <= range.end.row; row++) {\n table.scenegraph.updateCellContent(col, row);\n }\n }\n }\n if (table.widthMode === 'autoWidth') {\n table.scenegraph.recalculateColWidths();\n }\n if (table.heightMode === 'autoHeight') {\n table.scenegraph.recalculateRowHeights();\n }\n // table.scenegraph.updateNextFrame();\n table.scenegraph.renderSceneGraph(); // use sync render for faster update\n }\n\n getCustomLayoutFunc(col: number, row: number) {\n const isHeader = this.table.isHeader(col, row);\n if (isHeader) {\n const { componentId } = this.table.getHeaderDefine(col, row) as any;\n return this.headerCustomLayoutFuncCache.get(componentId) ?? emptyCustomLayout;\n }\n const { componentId } = this.table.getBodyColumnDefine(col, row) as any;\n return this.customLayoutFuncCache.get(componentId) || emptyCustomLayout;\n }\n\n removeCustomCell(col: number, row: number) {\n // const { startInTotal } = this.table.getBodyColumnDefine(col, row) as any;\n const isHeader = this.table.isHeader(col, row);\n let removeFun;\n if (isHeader) {\n const define = this.table.getHeaderDefine(col, row);\n const { componentId } = define as any;\n removeFun = this.headerReactRemoveGraphicCache.get(componentId);\n } else {\n const define = this.table.getBodyColumnDefine(col, row);\n const { componentId } = define as any;\n removeFun = this.reactRemoveGraphicCache.get(componentId);\n }\n if (removeFun) {\n removeFun(col, row);\n }\n }\n\n clearCache() {\n this.removeAllContainer();\n }\n}\n\nfunction getUpdateCustomCellRangeInListTable(componentId: string, table: BaseTableAPI, isHeaderCustomLayout?: boolean) {\n const rowSeriesNumber = table.internalProps.rowSeriesNumber ? 1 : 0;\n if (isHeaderCustomLayout) {\n const layoutMap = table.internalProps.layoutMap as SimpleHeaderLayoutMap;\n const { headerObjects } = table.internalProps.layoutMap;\n let headerId: number;\n for (let i = 0; i < headerObjects.length; i++) {\n const headerObject = headerObjects[i];\n if ((headerObject.define as any).componentId === componentId) {\n headerId = headerObject.id as number;\n break;\n }\n }\n\n const startCell = layoutMap.getHeaderCellAdressById(headerId);\n const range = layoutMap.getCellRange(startCell.col, startCell.row);\n return range;\n\n // let startCol = -1;\n // let endCol = -1;\n // let startRow = -1;\n // let endRow = -1;\n // for (let i = 0; i < _headerCellIds.length; i++) {\n // const row = _headerCellIds[i];\n // let rowHasObject = false;\n // for (let j = 0; j < row.length; j++) {\n // if (row[j] === headerId) {\n // rowHasObject = true;\n // if (transpose) {\n // // return { col: i, row: j };\n // startCol === -1 && (startCol = i);\n // startRow === -1 && (startRow = j);\n // } else {\n // // return { col: j + this.leftRowSeriesNumberColumnCount, row: i };\n // startCol === -1 && (startCol = j);\n // startRow === -1 && (startRow = i);\n // }\n // } else {\n // if (transpose) {\n // // endCol === -1 && startCol !== -1 && (endCol = i);\n // endRow === -1 && startRow !== -1 && (endRow = j - 1);\n // } else {\n // endCol === -1 && startCol !== -1 && (endCol = j - 1);\n // // endRow === -1 && startRow !== -1 && (endRow = i);\n // }\n // }\n\n // if (startCol !== -1 && endCol !== -1 && startRow !== -1 && endRow !== -1) {\n // break;\n // }\n // }\n\n // if (!rowHasObject) {\n // if (transpose) {\n // endCol === -1 && startCol !== -1 && (endCol = i - 1);\n // } else {\n // endRow === -1 && startRow !== -1 && (endRow = i - 1);\n // }\n // }\n\n // if (startCol !== -1 && endCol !== -1 && startRow !== -1 && endRow !== -1) {\n // break;\n // }\n // }\n\n // return {\n // startCol: startCol + rowSeriesNumber,\n // endCol: endCol + rowSeriesNumber,\n // startRow,\n // endRow\n // };\n }\n const { columnObjects } = table.internalProps.layoutMap;\n for (let i = 0; i < columnObjects.length; i++) {\n const columnObject = columnObjects[i];\n if ((columnObject.define as any).componentId === componentId) {\n return {\n start: {\n col: rowSeriesNumber + i,\n row: table.columnHeaderLevelCount\n },\n end: {\n col: rowSeriesNumber + i,\n row: table.rowCount - 1\n }\n };\n }\n }\n\n return {\n start: {\n col: 0,\n row: 0\n },\n end: {\n col: table.colCount - 1,\n row: table.rowCount - 1\n }\n };\n}\n\nfunction getUpdateCustomCellRangeInPivotTable(\n componentId: string,\n table: BaseTableAPI,\n isHeaderCustomLayout?: boolean\n) {\n const rowSeriesNumber = table.internalProps.rowSeriesNumber ? 1 : 0;\n const ranges = [];\n const layoutMap = table.internalProps.layoutMap as PivotHeaderLayoutMap;\n if (isHeaderCustomLayout) {\n const { headerObjects } = layoutMap;\n const headerIds: number[] = [];\n for (let i = 0; i < headerObjects.length; i++) {\n const headerObject = headerObjects[i];\n if (!headerObject) {\n continue;\n }\n if ((headerObject.define as any).componentId === componentId) {\n headerIds.push(headerObject.id as number);\n }\n }\n\n for (let i = 0; i < headerIds.length; i++) {\n const headerId = headerIds[i];\n const startCell = layoutMap.getHeaderCellAdressById(headerId);\n const range = layoutMap.getCellRange(startCell.col, startCell.row);\n ranges.push(range);\n }\n } else {\n let columnIndex: number;\n const { columnObjects, indicatorsAsCol } = layoutMap;\n for (let i = 0; i < columnObjects.length; i++) {\n const columnObject = columnObjects[i];\n if ((columnObject.define as any).componentId === componentId) {\n columnIndex = i;\n break;\n }\n }\n\n if (indicatorsAsCol) {\n for (\n let column = layoutMap.rowHeaderLevelCount + columnIndex;\n column < layoutMap.colCount;\n column += columnObjects.length\n ) {\n const range = {\n start: {\n col: column + rowSeriesNumber,\n row: layoutMap.columnHeaderLevelCount\n },\n end: {\n col: column + rowSeriesNumber,\n row: layoutMap.rowCount - 1\n }\n };\n ranges.push(range);\n }\n } else {\n for (\n let row = layoutMap.columnHeaderLevelCount + columnIndex;\n row < layoutMap.rowCount;\n row += columnObjects.length\n ) {\n const range = {\n start: {\n col: layoutMap.rowHeaderLevelCount + rowSeriesNumber,\n row: row\n },\n end: {\n col: layoutMap.colCount - 1,\n row: row\n }\n };\n ranges.push(range);\n }\n }\n }\n\n return ranges;\n\n // return {\n // startCol: 0,\n // endCol: table.colCount - 1,\n // startRow: 0,\n // endRow: table.rowCount - 1\n // };\n}\n"]}
1
+ {"version":3,"sources":["../src/components/react/react-custom-layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAMxC,MAAM,UAAU,iBAAiB,CAAC,IAA6B;IAC7D,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5B,OAAO;QACL,aAAa,EAAE,KAAK;QACpB,aAAa,EAAE,IAAI;KACpB,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,iBAAiB;IAU5B,YAAY,KAAmB;QAE7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,qBAAqB,GAAG,IAAI,GAAG,EAAE,CAAC;QAEvC,IAAI,CAAC,uBAAuB,GAAG,IAAI,GAAG,EAAE,CAAC;QACzC,IAAI,CAAC,0BAA0B,GAAG,IAAI,GAAG,EAAE,CAAC;QAC5C,IAAI,CAAC,2BAA2B,GAAG,IAAI,GAAG,EAAE,CAAC;QAE7C,IAAI,CAAC,6BAA6B,GAAG,IAAI,GAAG,EAAE,CAAC;QAC/C,IAAI,CAAC,gCAAgC,GAAG,IAAI,GAAG,EAAE,CAAC;IACpD,CAAC;IAED,qBAAqB,CAAC,WAAmB,EAAE,oBAA8B;QACvE,IAAI,oBAAoB,EAAE;YACxB,OAAO,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;SAC1D;QACD,OAAO,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACrD,CAAC;IAED,qBAAqB,CACnB,WAAmB,EACnB,aAA+B,EAE/B,oBAA8B;QAE9B,IAAI,oBAAoB,EAAE;YACxB,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,WAA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,QAAQ,GAAG,CAAC;qBAC5B;iBACF,CAAC;gBACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACpB;SACF;aAAM;YACL,KACE,IAAI,GAAG,GAAG,SAAS,CAAC,sBAAsB,GAAG,WAAW,EACxD,GAAG,GAAG,SAAS,CAAC,QAAQ,EACxB,GAAG,IAAI,aAAa,CAAC,MAAM,EAC3B;gBACA,MAAM,KAAK,GAAG;oBACZ,KAAK,EAAE;wBACL,GAAG,EAAE,SAAS,CAAC,mBAAmB,GAAG,eAAe;wBACpD,GAAG,EAAE,GAAG;qBACT;oBACD,GAAG,EAAE;wBACH,GAAG,EAAE,SAAS,CAAC,QAAQ,GAAG,CAAC;wBAC3B,GAAG,EAAE,GAAG;qBACT;iBACF,CAAC;gBACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACpB;SACF;KACF;IAED,OAAO,MAAM,CAAC;AAQhB,CAAC","file":"react-custom-layout.js","sourcesContent":["import { Group } from './../../vrender';\nimport type { CustomRenderFunctionArg, ICustomLayoutFuc } from '../../ts-types';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { PivotHeaderLayoutMap } from '../../layout/pivot-header-layout';\nimport type { SimpleHeaderLayoutMap } from '../../layout';\n\nexport function emptyCustomLayout(args: CustomRenderFunctionArg) {\n const group = new Group({});\n return {\n rootContainer: group,\n renderDefault: true\n };\n}\n\nexport class ReactCustomLayout {\n removeAllContainer: () => void;\n table: BaseTableAPI;\n customLayoutFuncCache: Map<string, ICustomLayoutFuc>;\n reactRemoveGraphicCache: Map<string, (col: number, row: number) => void>;\n reactRemoveAllGraphicCache: Map<string, () => void>;\n headerCustomLayoutFuncCache: Map<string, ICustomLayoutFuc>;\n headerReactRemoveGraphicCache: Map<string, (col: number, row: number) => void>;\n headerReactRemoveAllGraphicCache: Map<string, () => void>;\n // reactContainerCache: Map<number, Map<string, any>>;\n constructor(table: BaseTableAPI) {\n // this.removeAllContainer = removeAllContainer;\n this.table = table;\n this.customLayoutFuncCache = new Map();\n // this.reactContainerCache = new Map();\n this.reactRemoveGraphicCache = new Map();\n this.reactRemoveAllGraphicCache = new Map();\n this.headerCustomLayoutFuncCache = new Map();\n // this.headerCeactContainerCache = new Map();\n this.headerReactRemoveGraphicCache = new Map();\n this.headerReactRemoveAllGraphicCache = new Map();\n }\n\n hasReactCreateGraphic(componentId: string, isHeaderCustomLayout?: boolean) {\n if (isHeaderCustomLayout) {\n return this.headerCustomLayoutFuncCache.has(componentId);\n }\n return this.customLayoutFuncCache.has(componentId);\n }\n\n setReactCreateGraphic(\n componentId: string,\n createGraphic: ICustomLayoutFuc,\n // containerCache: Map<string, any>,\n isHeaderCustomLayout?: boolean\n ) {\n if (isHeaderCustomLayout) {\n this.headerCustomLayoutFuncCache.set(componentId, createGraphic);\n } else {\n this.customLayoutFuncCache.set(componentId, createGraphic);\n }\n // this.reactContainerCache.set(componentId, containerCache);\n }\n\n setReactRemoveGraphic(\n componentId: string,\n removeGraphic: (col: number, row: number) => void,\n isHeaderCustomLayout?: boolean\n ) {\n if (isHeaderCustomLayout) {\n this.headerReactRemoveGraphicCache.set(componentId, removeGraphic);\n } else {\n this.reactRemoveGraphicCache.set(componentId, removeGraphic);\n }\n }\n\n setReactRemoveAllGraphic(componentId: string, removeGraphic: () => void, isHeaderCustomLayout?: boolean) {\n if (isHeaderCustomLayout) {\n this.headerReactRemoveAllGraphicCache.set(componentId, removeGraphic);\n } else {\n this.reactRemoveAllGraphicCache.set(componentId, removeGraphic);\n }\n }\n\n updateCustomCell(componentId: string, isHeaderCustomLayout?: boolean) {\n const table = this.table;\n // const col = componentId;\n // // to do: deal with transpose table\n // if (isHeaderCustomLayout) {\n // for (let row = 0; row < table.columnHeaderLevelCount; row++) {\n // table.scenegraph.updateCellContent(col, row);\n // }\n // } else {\n // for (let row = table.columnHeaderLevelCount; row < table.rowCount; row++) {\n // table.scenegraph.updateCellContent(col, row);\n // }\n // }\n\n if (table.isPivotTable()) {\n const ranges = getUpdateCustomCellRangeInPivotTable(componentId, table, isHeaderCustomLayout);\n for (let i = 0; i < ranges.length; i++) {\n const range = ranges[i];\n for (let col = range.start.col; col <= range.end.col; col++) {\n for (let row = range.start.row; row <= range.end.row; row++) {\n table.scenegraph.updateCellContent(col, row);\n }\n }\n }\n } else {\n const range = getUpdateCustomCellRangeInListTable(componentId, table, isHeaderCustomLayout);\n for (let col = range.start.col; col <= range.end.col; col++) {\n for (let row = range.start.row; row <= range.end.row; row++) {\n table.scenegraph.updateCellContent(col, row);\n }\n }\n }\n if (table.widthMode === 'autoWidth') {\n table.scenegraph.recalculateColWidths();\n }\n if (table.heightMode === 'autoHeight') {\n table.scenegraph.recalculateRowHeights();\n }\n // table.scenegraph.updateNextFrame();\n table.scenegraph.renderSceneGraph(); // use sync render for faster update\n }\n\n getCustomLayoutFunc(col: number, row: number) {\n const isHeader = this.table.isHeader(col, row);\n if (isHeader) {\n const { componentId } = this.table.getHeaderDefine(col, row) as any;\n return this.headerCustomLayoutFuncCache.get(componentId) ?? emptyCustomLayout;\n }\n const { componentId } = this.table.getBodyColumnDefine(col, row) as any;\n return this.customLayoutFuncCache.get(componentId) || emptyCustomLayout;\n }\n\n removeCustomCell(col: number, row: number) {\n // const { startInTotal } = this.table.getBodyColumnDefine(col, row) as any;\n const isHeader = this.table.isHeader(col, row);\n let removeFun;\n if (isHeader) {\n const define = this.table.getHeaderDefine(col, row);\n const { componentId } = define as any;\n removeFun = this.headerReactRemoveGraphicCache.get(componentId);\n } else {\n const define = this.table.getBodyColumnDefine(col, row);\n const { componentId } = define as any;\n removeFun = this.reactRemoveGraphicCache.get(componentId);\n }\n if (removeFun) {\n removeFun(col, row);\n }\n }\n\n clearCache() {\n this.reactRemoveAllGraphicCache.forEach(removeFun => {\n removeFun();\n });\n this.headerReactRemoveAllGraphicCache.forEach(removeFun => {\n removeFun();\n });\n }\n\n updateAllCustomCell() {\n this.customLayoutFuncCache.forEach((createFun, componentId) => {\n this.updateCustomCell(componentId);\n });\n this.headerCustomLayoutFuncCache.forEach((createFun, componentId) => {\n this.updateCustomCell(componentId, true);\n });\n }\n}\n\nfunction getUpdateCustomCellRangeInListTable(componentId: string, table: BaseTableAPI, isHeaderCustomLayout?: boolean) {\n const rowSeriesNumber = table.internalProps.rowSeriesNumber ? 1 : 0;\n if (isHeaderCustomLayout) {\n const layoutMap = table.internalProps.layoutMap as SimpleHeaderLayoutMap;\n const { headerObjects } = table.internalProps.layoutMap;\n let headerId: number;\n for (let i = 0; i < headerObjects.length; i++) {\n const headerObject = headerObjects[i];\n if ((headerObject.define as any).componentId === componentId) {\n headerId = headerObject.id as number;\n break;\n }\n }\n\n const startCell = layoutMap.getHeaderCellAdressById(headerId);\n const range = layoutMap.getCellRange(startCell.col, startCell.row);\n return range;\n\n // let startCol = -1;\n // let endCol = -1;\n // let startRow = -1;\n // let endRow = -1;\n // for (let i = 0; i < _headerCellIds.length; i++) {\n // const row = _headerCellIds[i];\n // let rowHasObject = false;\n // for (let j = 0; j < row.length; j++) {\n // if (row[j] === headerId) {\n // rowHasObject = true;\n // if (transpose) {\n // // return { col: i, row: j };\n // startCol === -1 && (startCol = i);\n // startRow === -1 && (startRow = j);\n // } else {\n // // return { col: j + this.leftRowSeriesNumberColumnCount, row: i };\n // startCol === -1 && (startCol = j);\n // startRow === -1 && (startRow = i);\n // }\n // } else {\n // if (transpose) {\n // // endCol === -1 && startCol !== -1 && (endCol = i);\n // endRow === -1 && startRow !== -1 && (endRow = j - 1);\n // } else {\n // endCol === -1 && startCol !== -1 && (endCol = j - 1);\n // // endRow === -1 && startRow !== -1 && (endRow = i);\n // }\n // }\n\n // if (startCol !== -1 && endCol !== -1 && startRow !== -1 && endRow !== -1) {\n // break;\n // }\n // }\n\n // if (!rowHasObject) {\n // if (transpose) {\n // endCol === -1 && startCol !== -1 && (endCol = i - 1);\n // } else {\n // endRow === -1 && startRow !== -1 && (endRow = i - 1);\n // }\n // }\n\n // if (startCol !== -1 && endCol !== -1 && startRow !== -1 && endRow !== -1) {\n // break;\n // }\n // }\n\n // return {\n // startCol: startCol + rowSeriesNumber,\n // endCol: endCol + rowSeriesNumber,\n // startRow,\n // endRow\n // };\n }\n const { columnObjects } = table.internalProps.layoutMap;\n for (let i = 0; i < columnObjects.length; i++) {\n const columnObject = columnObjects[i];\n if ((columnObject.define as any).componentId === componentId) {\n return {\n start: {\n col: rowSeriesNumber + i,\n row: table.columnHeaderLevelCount\n },\n end: {\n col: rowSeriesNumber + i,\n row: table.rowCount - 1\n }\n };\n }\n }\n\n return {\n start: {\n col: 0,\n row: 0\n },\n end: {\n col: table.colCount - 1,\n row: table.rowCount - 1\n }\n };\n}\n\nfunction getUpdateCustomCellRangeInPivotTable(\n componentId: string,\n table: BaseTableAPI,\n isHeaderCustomLayout?: boolean\n) {\n const rowSeriesNumber = table.internalProps.rowSeriesNumber ? 1 : 0;\n const ranges = [];\n const layoutMap = table.internalProps.layoutMap as PivotHeaderLayoutMap;\n if (isHeaderCustomLayout) {\n const { headerObjects } = layoutMap;\n const headerIds: number[] = [];\n for (let i = 0; i < headerObjects.length; i++) {\n const headerObject = headerObjects[i];\n if (!headerObject) {\n continue;\n }\n if ((headerObject.define as any).componentId === componentId) {\n headerIds.push(headerObject.id as number);\n }\n }\n\n for (let i = 0; i < headerIds.length; i++) {\n const headerId = headerIds[i];\n const startCell = layoutMap.getHeaderCellAdressById(headerId);\n const range = layoutMap.getCellRange(startCell.col, startCell.row);\n ranges.push(range);\n }\n } else {\n let columnIndex: number;\n const { columnObjects, indicatorsAsCol } = layoutMap;\n for (let i = 0; i < columnObjects.length; i++) {\n const columnObject = columnObjects[i];\n if ((columnObject.define as any).componentId === componentId) {\n columnIndex = i;\n break;\n }\n }\n\n if (indicatorsAsCol) {\n for (\n let column = layoutMap.rowHeaderLevelCount + columnIndex;\n column < layoutMap.colCount;\n column += columnObjects.length\n ) {\n const range = {\n start: {\n col: column + rowSeriesNumber,\n row: layoutMap.columnHeaderLevelCount\n },\n end: {\n col: column + rowSeriesNumber,\n row: layoutMap.rowCount - 1\n }\n };\n ranges.push(range);\n }\n } else {\n for (\n let row = layoutMap.columnHeaderLevelCount + columnIndex;\n row < layoutMap.rowCount;\n row += columnObjects.length\n ) {\n const range = {\n start: {\n col: layoutMap.rowHeaderLevelCount + rowSeriesNumber,\n row: row\n },\n end: {\n col: layoutMap.colCount - 1,\n row: row\n }\n };\n ranges.push(range);\n }\n }\n }\n\n return ranges;\n\n // return {\n // startCol: 0,\n // endCol: table.colCount - 1,\n // startRow: 0,\n // endRow: table.rowCount - 1\n // };\n}\n"]}
@@ -404,7 +404,7 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
404
404
  get leftRowSeriesNumberCount(): number;
405
405
  setMinMaxLimitWidth(setWidth?: boolean): void;
406
406
  setSortedIndexMap(field: FieldDef, filedMap: ISortedMapItem): void;
407
- checkReactCustomLayout(removeAllContainer: () => void): void;
407
+ checkReactCustomLayout(): void;
408
408
  get bodyDomContainer(): HTMLElement;
409
409
  get headerDomContainer(): HTMLElement;
410
410
  get frozenBodyDomContainer(): HTMLElement;
@@ -86,7 +86,7 @@ export class BaseTable extends EventTarget {
86
86
  }
87
87
  constructor(container, options = {}) {
88
88
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
89
- if (super(), this.showFrozenIcon = !0, this.version = "1.11.2", this.id = `VTable${Date.now()}`,
89
+ if (super(), this.showFrozenIcon = !0, this.version = "1.11.3", this.id = `VTable${Date.now()}`,
90
90
  this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200),
91
91
  !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
92
92
  const {frozenColCount: frozenColCount = 0, frozenRowCount: frozenRowCount, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth, widthMode: widthMode = "standard", heightMode: heightMode = "standard", autoFillWidth: autoFillWidth = !1, autoFillHeight: autoFillHeight = !1, widthAdaptiveMode: widthAdaptiveMode = "only-body", heightAdaptiveMode: heightAdaptiveMode = "only-body", keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, columnResizeMode: columnResizeMode, rowResizeMode: rowResizeMode = "none", dragHeaderMode: dragHeaderMode, showFrozenIcon: showFrozenIcon, allowFrozenColCount: allowFrozenColCount, padding: padding, hover: hover, menu: menu, select: click, customRender: customRender, pixelRatio: pixelRatio = defaultPixelRatio, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, mode: mode, modeParams: modeParams, canvasWidth: canvasWidth, canvasHeight: canvasHeight, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth, limitMinHeight: limitMinHeight, clearDOM: clearDOM = !0} = options;
@@ -1277,7 +1277,8 @@ export class BaseTable extends EventTarget {
1277
1277
  }
1278
1278
  _canDragHeaderPosition(col, row) {
1279
1279
  var _a, _b, _c;
1280
- if (this.isHeader(col, row) && (this.stateManager.isSelected(col, row) || "body" === (null === (_a = this.options.select) || void 0 === _a ? void 0 : _a.headerSelectMode) && checkCellInSelect(col, row, [ this.getCellRange(this.stateManager.select.cellPos.col, this.stateManager.select.cellPos.row) ]) || (null === (_b = this.options.select) || void 0 === _b ? void 0 : _b.disableHeaderSelect) || (null === (_c = this.options.select) || void 0 === _c ? void 0 : _c.disableSelect))) {
1280
+ const disableSelect = null === (_a = this.options.select) || void 0 === _a ? void 0 : _a.disableSelect, cellDisable = "function" == typeof disableSelect ? disableSelect(col, row, this) : disableSelect;
1281
+ if (this.isHeader(col, row) && (this.stateManager.isSelected(col, row) || "body" === (null === (_b = this.options.select) || void 0 === _b ? void 0 : _b.headerSelectMode) && checkCellInSelect(col, row, [ this.getCellRange(this.stateManager.select.cellPos.col, this.stateManager.select.cellPos.row) ]) || (null === (_c = this.options.select) || void 0 === _c ? void 0 : _c.disableHeaderSelect) || cellDisable)) {
1281
1282
  if ("disabled" === this.internalProps.frozenColDragHeaderMode && this.isFrozenColumn(col)) return !1;
1282
1283
  if (this.stateManager.isSelected(col, row)) {
1283
1284
  const selectRange = this.stateManager.select.ranges[0];
@@ -1722,8 +1723,8 @@ export class BaseTable extends EventTarget {
1722
1723
  var _a;
1723
1724
  null === (_a = this.dataSource) || void 0 === _a || _a.setSortedIndexMap(field, filedMap);
1724
1725
  }
1725
- checkReactCustomLayout(removeAllContainer) {
1726
- this.reactCustomLayout || (this.reactCustomLayout = new ReactCustomLayout(removeAllContainer, this));
1726
+ checkReactCustomLayout() {
1727
+ this.reactCustomLayout || (this.reactCustomLayout = new ReactCustomLayout(this));
1727
1728
  }
1728
1729
  get bodyDomContainer() {
1729
1730
  return this.internalProps.bodyDomContainer;