@visactor/vtable 0.24.2-alpha.4 → 0.25.0

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 (161) hide show
  1. package/cjs/ListTable.js +5 -3
  2. package/cjs/ListTable.js.map +1 -1
  3. package/cjs/PivotChart.js +14 -12
  4. package/cjs/PivotChart.js.map +1 -1
  5. package/cjs/PivotTable.js +89 -43
  6. package/cjs/PivotTable.js.map +1 -1
  7. package/cjs/core/BaseTable.d.ts +1 -0
  8. package/cjs/core/BaseTable.js +62 -16
  9. package/cjs/core/BaseTable.js.map +1 -1
  10. package/cjs/core/TABLE_EVENT_TYPE.d.ts +3 -1
  11. package/cjs/core/TABLE_EVENT_TYPE.js +3 -0
  12. package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
  13. package/cjs/dataset/dataset.d.ts +1 -0
  14. package/cjs/dataset/dataset.js +14 -0
  15. package/cjs/dataset/dataset.js.map +1 -1
  16. package/cjs/dataset/flatDataToObject.d.ts +8 -3
  17. package/cjs/dataset/flatDataToObject.js +39 -8
  18. package/cjs/dataset/flatDataToObject.js.map +1 -1
  19. package/cjs/edit/edit-manager.js +0 -2
  20. package/cjs/edit/edit-manager.js.map +1 -1
  21. package/cjs/event/event.d.ts +2 -0
  22. package/cjs/event/event.js +12 -2
  23. package/cjs/event/event.js.map +1 -1
  24. package/cjs/event/listener/container-dom.js +5 -2
  25. package/cjs/event/listener/container-dom.js.map +1 -1
  26. package/cjs/event/listener/scroll-bar.js +8 -0
  27. package/cjs/event/listener/scroll-bar.js.map +1 -1
  28. package/cjs/event/listener/table-group.js +23 -8
  29. package/cjs/event/listener/table-group.js.map +1 -1
  30. package/cjs/index.d.ts +1 -1
  31. package/cjs/index.js +1 -1
  32. package/cjs/index.js.map +1 -1
  33. package/cjs/layout/pivot-header-layout.d.ts +1 -0
  34. package/cjs/layout/pivot-header-layout.js +16 -4
  35. package/cjs/layout/pivot-header-layout.js.map +1 -1
  36. package/cjs/scenegraph/component/table-component.d.ts +8 -0
  37. package/cjs/scenegraph/component/table-component.js +180 -2
  38. package/cjs/scenegraph/component/table-component.js.map +1 -1
  39. package/cjs/scenegraph/component/util.d.ts +1 -0
  40. package/cjs/scenegraph/component/util.js +8 -2
  41. package/cjs/scenegraph/component/util.js.map +1 -1
  42. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +18 -9
  43. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  44. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +5 -5
  45. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  46. package/cjs/scenegraph/group-creater/progress/proxy.js +4 -2
  47. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  48. package/cjs/scenegraph/layout/frozen.js +4 -2
  49. package/cjs/scenegraph/layout/frozen.js.map +1 -1
  50. package/cjs/scenegraph/scenegraph.d.ts +7 -0
  51. package/cjs/scenegraph/scenegraph.js +42 -19
  52. package/cjs/scenegraph/scenegraph.js.map +1 -1
  53. package/cjs/scenegraph/select/update-select-border.js +4 -4
  54. package/cjs/scenegraph/select/update-select-border.js.map +1 -1
  55. package/cjs/state/cell-move/index.js +2 -1
  56. package/cjs/state/cell-move/index.js.map +1 -1
  57. package/cjs/state/resize/update-resize-column.js +4 -3
  58. package/cjs/state/resize/update-resize-column.js.map +1 -1
  59. package/cjs/state/resize/update-resize-row.d.ts +2 -0
  60. package/cjs/state/resize/update-resize-row.js +63 -0
  61. package/cjs/state/resize/update-resize-row.js.map +1 -0
  62. package/cjs/state/state.d.ts +11 -1
  63. package/cjs/state/state.js +30 -5
  64. package/cjs/state/state.js.map +1 -1
  65. package/cjs/themes/component.js +1 -1
  66. package/cjs/tools/global.d.ts +1 -0
  67. package/cjs/tools/global.js +2 -2
  68. package/cjs/tools/global.js.map +1 -1
  69. package/cjs/ts-types/base-table.d.ts +7 -0
  70. package/cjs/ts-types/base-table.js.map +1 -1
  71. package/cjs/ts-types/events.d.ts +11 -0
  72. package/cjs/ts-types/events.js.map +1 -1
  73. package/cjs/ts-types/pivot-table/dimension/basic-dimension.d.ts +6 -1
  74. package/cjs/ts-types/pivot-table/dimension/basic-dimension.js.map +1 -1
  75. package/cjs/ts-types/pivot-table/indicator/basic-indicator.d.ts +3 -0
  76. package/cjs/ts-types/pivot-table/indicator/basic-indicator.js.map +1 -1
  77. package/cjs/ts-types/table-engine.d.ts +5 -0
  78. package/cjs/ts-types/table-engine.js.map +1 -1
  79. package/cjs/vrender.js.map +1 -1
  80. package/dist/vtable.js +914 -107
  81. package/dist/vtable.min.js +2 -2
  82. package/es/ListTable.js +5 -3
  83. package/es/ListTable.js.map +1 -1
  84. package/es/PivotChart.js +14 -12
  85. package/es/PivotChart.js.map +1 -1
  86. package/es/PivotTable.js +89 -43
  87. package/es/PivotTable.js.map +1 -1
  88. package/es/core/BaseTable.d.ts +1 -0
  89. package/es/core/BaseTable.js +62 -17
  90. package/es/core/BaseTable.js.map +1 -1
  91. package/es/core/TABLE_EVENT_TYPE.d.ts +3 -1
  92. package/es/core/TABLE_EVENT_TYPE.js +3 -0
  93. package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
  94. package/es/dataset/dataset.d.ts +1 -0
  95. package/es/dataset/dataset.js +14 -0
  96. package/es/dataset/dataset.js.map +1 -1
  97. package/es/dataset/flatDataToObject.d.ts +8 -3
  98. package/es/dataset/flatDataToObject.js +38 -8
  99. package/es/dataset/flatDataToObject.js.map +1 -1
  100. package/es/edit/edit-manager.js +0 -2
  101. package/es/edit/edit-manager.js.map +1 -1
  102. package/es/event/event.d.ts +2 -0
  103. package/es/event/event.js +12 -2
  104. package/es/event/event.js.map +1 -1
  105. package/es/event/listener/container-dom.js +5 -2
  106. package/es/event/listener/container-dom.js.map +1 -1
  107. package/es/event/listener/scroll-bar.js +8 -0
  108. package/es/event/listener/scroll-bar.js.map +1 -1
  109. package/es/event/listener/table-group.js +23 -8
  110. package/es/event/listener/table-group.js.map +1 -1
  111. package/es/index.d.ts +1 -1
  112. package/es/index.js +1 -1
  113. package/es/index.js.map +1 -1
  114. package/es/layout/pivot-header-layout.d.ts +1 -0
  115. package/es/layout/pivot-header-layout.js +12 -2
  116. package/es/layout/pivot-header-layout.js.map +1 -1
  117. package/es/scenegraph/component/table-component.d.ts +8 -0
  118. package/es/scenegraph/component/table-component.js +181 -3
  119. package/es/scenegraph/component/table-component.js.map +1 -1
  120. package/es/scenegraph/component/util.d.ts +1 -0
  121. package/es/scenegraph/component/util.js +7 -1
  122. package/es/scenegraph/component/util.js.map +1 -1
  123. package/es/scenegraph/graphic/contributions/group-contribution-render.js +18 -9
  124. package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  125. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +5 -4
  126. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  127. package/es/scenegraph/group-creater/progress/proxy.js +4 -2
  128. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  129. package/es/scenegraph/layout/frozen.js +4 -2
  130. package/es/scenegraph/layout/frozen.js.map +1 -1
  131. package/es/scenegraph/scenegraph.d.ts +7 -0
  132. package/es/scenegraph/scenegraph.js +44 -19
  133. package/es/scenegraph/scenegraph.js.map +1 -1
  134. package/es/scenegraph/select/update-select-border.js +4 -4
  135. package/es/scenegraph/select/update-select-border.js.map +1 -1
  136. package/es/state/cell-move/index.js +2 -1
  137. package/es/state/cell-move/index.js.map +1 -1
  138. package/es/state/resize/update-resize-column.js +4 -3
  139. package/es/state/resize/update-resize-column.js.map +1 -1
  140. package/es/state/resize/update-resize-row.d.ts +2 -0
  141. package/es/state/resize/update-resize-row.js +57 -0
  142. package/es/state/resize/update-resize-row.js.map +1 -0
  143. package/es/state/state.d.ts +11 -1
  144. package/es/state/state.js +31 -4
  145. package/es/state/state.js.map +1 -1
  146. package/es/themes/component.js +1 -1
  147. package/es/tools/global.d.ts +1 -0
  148. package/es/tools/global.js +2 -0
  149. package/es/tools/global.js.map +1 -1
  150. package/es/ts-types/base-table.d.ts +7 -0
  151. package/es/ts-types/base-table.js.map +1 -1
  152. package/es/ts-types/events.d.ts +11 -0
  153. package/es/ts-types/events.js.map +1 -1
  154. package/es/ts-types/pivot-table/dimension/basic-dimension.d.ts +6 -1
  155. package/es/ts-types/pivot-table/dimension/basic-dimension.js.map +1 -1
  156. package/es/ts-types/pivot-table/indicator/basic-indicator.d.ts +3 -0
  157. package/es/ts-types/pivot-table/indicator/basic-indicator.js.map +1 -1
  158. package/es/ts-types/table-engine.d.ts +5 -0
  159. package/es/ts-types/table-engine.js.map +1 -1
  160. package/es/vrender.js.map +1 -1
  161. package/package.json +5 -5
package/es/PivotTable.js CHANGED
@@ -34,7 +34,7 @@ import { cloneDeepSpec } from "@visactor/vutils-extension";
34
34
 
35
35
  export class PivotTable extends BaseTable {
36
36
  constructor(container, options) {
37
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
37
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
38
38
  "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container,
39
39
  container = container.container ? container.container : null), super(container, options),
40
40
  options.layout && Object.assign(options, options.layout), this.internalProps.columns = cloneDeep(options.columns),
@@ -45,18 +45,19 @@ export class PivotTable extends BaseTable {
45
45
  this.internalProps.rowTree = options.indicatorsAsCol || (null === (_c = options.rows) || void 0 === _c ? void 0 : _c.length) || options.rowTree ? cloneDeep(options.rowTree) : [],
46
46
  this.internalProps.records = options.records, this.pagination = options.pagination,
47
47
  this.internalProps.columnResizeType = null !== (_d = options.columnResizeType) && void 0 !== _d ? _d : "column",
48
+ this.internalProps.rowResizeType = null !== (_e = options.rowResizeType) && void 0 !== _e ? _e : "row",
48
49
  this.internalProps.dataConfig = cloneDeep(options.dataConfig), options.rowTree || options.columnTree ? this.internalProps.enableDataAnalysis = !1 : this.internalProps.enableDataAnalysis = !0;
49
50
  const records = this.internalProps.records;
50
51
  if (this.internalProps.enableDataAnalysis && (options.rows || options.columns)) {
51
- const rowKeys = null !== (_f = null === (_e = options.rows) || void 0 === _e ? void 0 : _e.reduce(((keys, rowObj) => ("string" == typeof rowObj ? keys.push(rowObj) : keys.push(rowObj.dimensionKey),
52
- keys)), [])) && void 0 !== _f ? _f : [], columnKeys = null !== (_h = null === (_g = options.columns) || void 0 === _g ? void 0 : _g.reduce(((keys, columnObj) => ("string" == typeof columnObj ? keys.push(columnObj) : keys.push(columnObj.dimensionKey),
53
- keys)), [])) && void 0 !== _h ? _h : [], indicatorKeys = null !== (_k = null === (_j = options.indicators) || void 0 === _j ? void 0 : _j.reduce(((keys, indicatorObj) => ("string" == typeof indicatorObj ? keys.push(indicatorObj) : keys.push(indicatorObj.indicatorKey),
54
- keys)), [])) && void 0 !== _k ? _k : [];
55
- this.dataset = new Dataset(this.internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, null === (_l = options.indicatorsAsCol) || void 0 === _l || _l, options.records, options.rowHierarchyType, this.internalProps.columnTree, this.internalProps.rowTree),
52
+ const rowKeys = null !== (_g = null === (_f = options.rows) || void 0 === _f ? void 0 : _f.reduce(((keys, rowObj) => ("string" == typeof rowObj ? keys.push(rowObj) : keys.push(rowObj.dimensionKey),
53
+ keys)), [])) && void 0 !== _g ? _g : [], columnKeys = null !== (_j = null === (_h = options.columns) || void 0 === _h ? void 0 : _h.reduce(((keys, columnObj) => ("string" == typeof columnObj ? keys.push(columnObj) : keys.push(columnObj.dimensionKey),
54
+ keys)), [])) && void 0 !== _j ? _j : [], indicatorKeys = null !== (_l = null === (_k = options.indicators) || void 0 === _k ? void 0 : _k.reduce(((keys, indicatorObj) => ("string" == typeof indicatorObj ? keys.push(indicatorObj) : keys.push(indicatorObj.indicatorKey),
55
+ keys)), [])) && void 0 !== _l ? _l : [];
56
+ this.dataset = new Dataset(this.internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, null === (_m = options.indicatorsAsCol) || void 0 === _m || _m, options.records, options.rowHierarchyType, this.internalProps.columnTree, this.internalProps.rowTree),
56
57
  this.internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset);
57
58
  } else {
58
59
  if (!Array.isArray(this.internalProps.columnTree) && !Array.isArray(this.internalProps.rowTree)) return;
59
- this.internalProps.layoutMap = new PivotHeaderLayoutMap(this, null), (null === (_m = null == records ? void 0 : records[0]) || void 0 === _m ? void 0 : _m.constructor) !== Array && (this.flatDataToObjects = new FlatDataToObjects({
60
+ this.internalProps.layoutMap = new PivotHeaderLayoutMap(this, null), (null === (_o = null == records ? void 0 : records[0]) || void 0 === _o ? void 0 : _o.constructor) !== Array && (this.flatDataToObjects = new FlatDataToObjects({
60
61
  rows: this.internalProps.layoutMap.fullRowDimensionKeys,
61
62
  columns: this.internalProps.layoutMap.colDimensionKeys,
62
63
  indicators: this.internalProps.layoutMap.indicatorKeys,
@@ -97,7 +98,7 @@ export class PivotTable extends BaseTable {
97
98
  return ifCan;
98
99
  }
99
100
  updateOption(options) {
100
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
101
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
101
102
  const internalProps = this.internalProps;
102
103
  if (super.updateOption(options), this.internalProps.columns = cloneDeep(options.columns),
103
104
  this.internalProps.rows = cloneDeep(options.rows), this.internalProps.indicators = (null === (_a = options.indicators) || void 0 === _a ? void 0 : _a.length) ? cloneDeepSpec(options.indicators) : [],
@@ -108,25 +109,26 @@ export class PivotTable extends BaseTable {
108
109
  options.records && (this.internalProps.records = options.records), this.stateManager.initCheckedState(this.internalProps.records),
109
110
  this.stateManager.updateDrillState(void 0, void 0, !1, !1, -1, -1), this.pagination = options.pagination,
110
111
  internalProps.columnResizeType = null !== (_e = options.columnResizeType) && void 0 !== _e ? _e : "column",
112
+ internalProps.rowResizeType = null !== (_f = options.rowResizeType) && void 0 !== _f ? _f : "row",
111
113
  internalProps.dataConfig = cloneDeep(options.dataConfig), options.rowTree || options.columnTree ? internalProps.enableDataAnalysis = !1 : internalProps.enableDataAnalysis = !0,
112
114
  "tree" === (null == options ? void 0 : options.rowHierarchyType) && "tree" === this.internalProps.layoutMap.rowHierarchyType && this.internalProps.layoutMap.rowExpandLevel === (null == options ? void 0 : options.rowExpandLevel)) {
113
115
  const beforeRowDimensions = this.internalProps.layoutMap.rowDimensionTree.tree.children;
114
- null === (_f = this.internalProps.rowTree) || void 0 === _f || _f.forEach(((node, index) => {
116
+ null === (_g = this.internalProps.rowTree) || void 0 === _g || _g.forEach(((node, index) => {
115
117
  const beforeRowDimension = beforeRowDimensions.find((item => item.dimensionKey === node.dimensionKey && item.value === node.value));
116
118
  beforeRowDimension && this.syncHierarchyState(beforeRowDimension, node);
117
119
  }));
118
120
  }
119
121
  const records = this.internalProps.records;
120
122
  if (this.internalProps.enableDataAnalysis && (options.rows || options.columns)) {
121
- const rowKeys = null === (_g = options.rows) || void 0 === _g ? void 0 : _g.reduce(((keys, rowObj) => ("string" == typeof rowObj ? keys.push(rowObj) : keys.push(rowObj.dimensionKey),
122
- keys)), []), columnKeys = null === (_h = options.columns) || void 0 === _h ? void 0 : _h.reduce(((keys, columnObj) => ("string" == typeof columnObj ? keys.push(columnObj) : keys.push(columnObj.dimensionKey),
123
- keys)), []), indicatorKeys = null === (_j = options.indicators) || void 0 === _j ? void 0 : _j.reduce(((keys, indicatorObj) => ("string" == typeof indicatorObj ? keys.push(indicatorObj) : keys.push(indicatorObj.indicatorKey),
123
+ const rowKeys = null === (_h = options.rows) || void 0 === _h ? void 0 : _h.reduce(((keys, rowObj) => ("string" == typeof rowObj ? keys.push(rowObj) : keys.push(rowObj.dimensionKey),
124
+ keys)), []), columnKeys = null === (_j = options.columns) || void 0 === _j ? void 0 : _j.reduce(((keys, columnObj) => ("string" == typeof columnObj ? keys.push(columnObj) : keys.push(columnObj.dimensionKey),
125
+ keys)), []), indicatorKeys = null === (_k = options.indicators) || void 0 === _k ? void 0 : _k.reduce(((keys, indicatorObj) => ("string" == typeof indicatorObj ? keys.push(indicatorObj) : keys.push(indicatorObj.indicatorKey),
124
126
  keys)), []);
125
- this.dataset = new Dataset(internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, null === (_k = options.indicatorsAsCol) || void 0 === _k || _k, options.records, options.rowHierarchyType, this.internalProps.columnTree, this.internalProps.rowTree),
127
+ this.dataset = new Dataset(internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, null === (_l = options.indicatorsAsCol) || void 0 === _l || _l, options.records, options.rowHierarchyType, this.internalProps.columnTree, this.internalProps.rowTree),
126
128
  internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset);
127
129
  } else {
128
130
  if (!Array.isArray(this.internalProps.columnTree) && !Array.isArray(this.internalProps.rowTree)) return this;
129
- internalProps.layoutMap = new PivotHeaderLayoutMap(this, null), (null === (_l = null == records ? void 0 : records[0]) || void 0 === _l ? void 0 : _l.constructor) !== Array && (this.flatDataToObjects = new FlatDataToObjects({
131
+ internalProps.layoutMap = new PivotHeaderLayoutMap(this, null), (null === (_m = null == records ? void 0 : records[0]) || void 0 === _m ? void 0 : _m.constructor) !== Array && (this.flatDataToObjects = new FlatDataToObjects({
130
132
  rows: internalProps.layoutMap.fullRowDimensionKeys,
131
133
  columns: internalProps.layoutMap.colDimensionKeys,
132
134
  indicators: internalProps.layoutMap.indicatorKeys,
@@ -346,14 +348,37 @@ export class PivotTable extends BaseTable {
346
348
  })), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
347
349
  var _a;
348
350
  return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
349
- })), treeNode = this.flatDataToObjects.getTreeNode(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, !1);
351
+ })), treeNode = this.flatDataToObjects.getTreeNode(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey);
350
352
  return null == treeNode ? void 0 : treeNode.record;
351
353
  }
352
354
  const rowIndex = this.getBodyIndexByRow(row), colIndex = this.getBodyIndexByCol(col);
353
355
  return null === (_a = this.records[rowIndex]) || void 0 === _a ? void 0 : _a[colIndex];
354
356
  }
355
357
  getCellRawRecord(col, row) {
356
- return this.getCellOriginRecord(col, row);
358
+ var _a;
359
+ if (this.internalProps.layoutMap.isHeader(col, row)) return;
360
+ if (this.dataset) {
361
+ const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row), colKeys = cellDimensionPath.colHeaderPaths.map((colPath => {
362
+ var _a;
363
+ return null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
364
+ })), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
365
+ var _a;
366
+ return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
367
+ }));
368
+ return this.dataset.getAggregator(this.internalProps.layoutMap.indicatorsAsCol ? rowKeys : rowKeys.slice(0, -1), this.internalProps.layoutMap.indicatorsAsCol ? colKeys.slice(0, -1) : colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row)).records;
369
+ }
370
+ if (this.flatDataToObjects) {
371
+ const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row), colKeys = cellDimensionPath.colHeaderPaths.map((colPath => {
372
+ var _a;
373
+ return null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
374
+ })), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
375
+ var _a;
376
+ return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
377
+ })), treeNode = this.flatDataToObjects.getTreeNode(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, !1);
378
+ return null == treeNode ? void 0 : treeNode.record;
379
+ }
380
+ const rowIndex = this.getBodyIndexByRow(row), colIndex = this.getBodyIndexByCol(col);
381
+ return null === (_a = this.records[rowIndex]) || void 0 === _a ? void 0 : _a[colIndex];
357
382
  }
358
383
  updateSortRules(sortRules) {
359
384
  this.internalProps.dataConfig.sortRules = sortRules, this.dataset.updateSortRules(sortRules),
@@ -506,9 +531,15 @@ export class PivotTable extends BaseTable {
506
531
  this.editorManager.completeEdit();
507
532
  }
508
533
  getEditor(col, row) {
509
- var _a;
510
- const define = this.getBodyColumnDefine(col, row);
511
- let editorDefine = null !== (_a = null == define ? void 0 : define.editor) && void 0 !== _a ? _a : this.options.editor;
534
+ var _a, _b;
535
+ let editorDefine;
536
+ if (this.isHeader(col, row) && !this.isCornerHeader(col, row)) {
537
+ const define = this.getHeaderDefine(col, row);
538
+ editorDefine = null !== (_a = null == define ? void 0 : define.headerEditor) && void 0 !== _a ? _a : this.options.headerEditor;
539
+ } else {
540
+ const define = this.getBodyColumnDefine(col, row);
541
+ editorDefine = null !== (_b = null == define ? void 0 : define.editor) && void 0 !== _b ? _b : this.options.editor;
542
+ }
512
543
  if ("function" == typeof editorDefine) {
513
544
  editorDefine = editorDefine({
514
545
  col: col,
@@ -538,20 +569,24 @@ export class PivotTable extends BaseTable {
538
569
  changeCellValue(col, row, value, workOnEditableCell = !1) {
539
570
  if (workOnEditableCell && this.isHasEditorDefine(col, row) || !1 === workOnEditableCell) {
540
571
  let newValue = value;
541
- if ("number" == typeof this.getCellRawValue(col, row) && isAllDigits(value) && (newValue = parseFloat(value)),
542
- this._changeCellValueToDataSet(col, row, newValue), this.scenegraph.updateCellContent(col, row),
543
- "adaptive" === this.widthMode || this.autoFillWidth && this.getAllColsWidth() <= this.tableNoFrameWidth) 0 === this.internalProps._widthResizedColMap.size && this.scenegraph.recalculateColWidths(); else if (!this.internalProps._widthResizedColMap.has(col)) {
572
+ const oldValue = this.getCellOriginValue(col, row), rawValue = this.getCellRawValue(col, row);
573
+ "number" == typeof rawValue && isAllDigits(value) && (newValue = parseFloat(value)),
574
+ this._changeCellValueToDataSet(col, row, oldValue, newValue);
575
+ const range = this.getCellRange(col, row);
576
+ for (let sCol = range.start.col; sCol <= range.end.col; sCol++) for (let sRow = range.start.row; sRow <= range.end.row; sRow++) this.scenegraph.updateCellContent(sCol, sRow);
577
+ if ("adaptive" === this.widthMode || this.autoFillWidth && this.getAllColsWidth() <= this.tableNoFrameWidth) 0 === this.internalProps._widthResizedColMap.size && this.scenegraph.recalculateColWidths(); else if (!this.internalProps._widthResizedColMap.has(col)) {
544
578
  const oldWidth = this.getColWidth(col), newWidth = computeColWidth(col, 0, this.rowCount - 1, this, !1);
545
579
  newWidth !== oldWidth && this.scenegraph.updateColWidth(col, newWidth - oldWidth);
546
580
  }
547
- if ("adaptive" === this.heightMode || this.autoFillHeight && this.getAllRowsHeight() <= this.tableNoFrameHeight) this.scenegraph.recalculateRowHeights(); else if ("autoHeight" === this.heightMode) {
581
+ if ("adaptive" === this.heightMode || this.autoFillHeight && this.getAllRowsHeight() <= this.tableNoFrameHeight) 0 === this.internalProps._heightResizedRowMap.size && this.scenegraph.recalculateRowHeights(); else if ("autoHeight" === this.heightMode && !this.internalProps._heightResizedRowMap.has(row)) {
548
582
  const oldHeight = this.getRowHeight(row), newHeight = computeRowHeight(row, 0, this.colCount - 1, this);
549
583
  this.scenegraph.updateRowHeight(row, newHeight - oldHeight);
550
584
  }
551
585
  this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
552
586
  col: col,
553
587
  row: row,
554
- rawValue: this.getCellRawValue(col, row),
588
+ rawValue: rawValue,
589
+ currentValue: oldValue,
555
590
  changedValue: newValue
556
591
  }), this.scenegraph.updateNextFrame();
557
592
  }
@@ -566,12 +601,14 @@ export class PivotTable extends BaseTable {
566
601
  workOnEditableCell && this.isHasEditorDefine(startCol + j, startRow + i) || !1 === workOnEditableCell) {
567
602
  const value = rowValues[j];
568
603
  let newValue = value;
569
- const rawValue = this.getCellRawValue(startCol + j, startRow + i);
604
+ const oldValue = this.getCellOriginValue(startCol + j, startRow + i), rawValue = this.getCellRawValue(startCol + j, startRow + i);
570
605
  "number" == typeof rawValue && isAllDigits(value) && (newValue = parseFloat(value)),
571
- this._changeCellValueToDataSet(startCol + j, startRow + i, newValue), this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
606
+ this._changeCellValueToDataSet(startCol + j, startRow + i, oldValue, newValue),
607
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
572
608
  col: startCol + j,
573
609
  row: startRow + i,
574
610
  rawValue: rawValue,
611
+ currentValue: oldValue,
575
612
  changedValue: this.getCellOriginValue(startCol + j, startRow + i)
576
613
  });
577
614
  }
@@ -593,25 +630,34 @@ export class PivotTable extends BaseTable {
593
630
  }
594
631
  this.scenegraph.updateNextFrame();
595
632
  }
596
- _changeCellValueToDataSet(col, row, newValue) {
633
+ _changeCellValueToDataSet(col, row, oldValue, newValue) {
634
+ var _a, _b, _c, _d, _e, _f;
597
635
  if (this.dataset) {
598
- const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row), colKeys = cellDimensionPath.colHeaderPaths.map((colPath => {
599
- var _a;
600
- return null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
601
- })), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
602
- var _a;
603
- return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
604
- }));
605
- this.dataset.changeTreeNodeValue(this.internalProps.layoutMap.indicatorsAsCol ? rowKeys : rowKeys.slice(0, -1), this.internalProps.layoutMap.indicatorsAsCol ? colKeys.slice(0, -1) : colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row), newValue);
636
+ const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
637
+ if (this.isHeader(col, row)) this.internalProps.layoutMap.changeTreeNodeTitle(col, row, newValue),
638
+ !this.isCornerHeader(col, row) && this.dataset.changeRecordFieldValue((null === (_a = cellDimensionPath.colHeaderPaths) || void 0 === _a ? void 0 : _a.length) ? null !== (_b = cellDimensionPath.colHeaderPaths[cellDimensionPath.colHeaderPaths.length - 1].indicatorKey) && void 0 !== _b ? _b : cellDimensionPath.colHeaderPaths[cellDimensionPath.colHeaderPaths.length - 1].dimensionKey : null !== (_c = cellDimensionPath.rowHeaderPaths[cellDimensionPath.rowHeaderPaths.length - 1].indicatorKey) && void 0 !== _c ? _c : cellDimensionPath.rowHeaderPaths[cellDimensionPath.rowHeaderPaths.length - 1].dimensionKey, oldValue, newValue); else {
639
+ const colKeys = cellDimensionPath.colHeaderPaths.map((colPath => {
640
+ var _a;
641
+ return null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
642
+ })), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
643
+ var _a;
644
+ return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
645
+ }));
646
+ this.dataset.changeTreeNodeValue(this.internalProps.layoutMap.indicatorsAsCol ? rowKeys : rowKeys.slice(0, -1), this.internalProps.layoutMap.indicatorsAsCol ? colKeys.slice(0, -1) : colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row), newValue);
647
+ }
606
648
  } else if (this.flatDataToObjects) {
607
- const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row), colKeys = cellDimensionPath.colHeaderPaths.map((colPath => {
608
- var _a;
609
- return null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
610
- })), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
611
- var _a;
612
- return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
613
- }));
614
- this.flatDataToObjects.changeTreeNodeValue(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, newValue);
649
+ const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
650
+ if (this.isHeader(col, row)) this.internalProps.layoutMap.changeTreeNodeTitle(col, row, newValue),
651
+ !this.isCornerHeader(col, row) && this.flatDataToObjects.changeRecordFieldValue((null === (_d = cellDimensionPath.colHeaderPaths) || void 0 === _d ? void 0 : _d.length) ? null !== (_e = cellDimensionPath.colHeaderPaths[cellDimensionPath.colHeaderPaths.length - 1].indicatorKey) && void 0 !== _e ? _e : cellDimensionPath.colHeaderPaths[cellDimensionPath.colHeaderPaths.length - 1].dimensionKey : null !== (_f = cellDimensionPath.rowHeaderPaths[cellDimensionPath.rowHeaderPaths.length - 1].indicatorKey) && void 0 !== _f ? _f : cellDimensionPath.rowHeaderPaths[cellDimensionPath.rowHeaderPaths.length - 1].dimensionKey, oldValue, newValue); else {
652
+ const colKeys = cellDimensionPath.colHeaderPaths.map((colPath => {
653
+ var _a;
654
+ return null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
655
+ })), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
656
+ var _a;
657
+ return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
658
+ }));
659
+ this.flatDataToObjects.changeTreeNodeValue(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, newValue);
660
+ }
615
661
  } else {
616
662
  const rowIndex = this.getBodyIndexByRow(row), colIndex = this.getBodyIndexByCol(col);
617
663
  this.records[rowIndex][colIndex] = newValue;