@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/cjs/PivotTable.js CHANGED
@@ -33,7 +33,7 @@ const ts_types_1 = require("./ts-types"), pivot_header_layout_1 = require("./lay
33
33
 
34
34
  class PivotTable extends BaseTable_1.BaseTable {
35
35
  constructor(container, options) {
36
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
36
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
37
37
  "node" === env_1.Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container,
38
38
  container = container.container ? container.container : null), super(container, options),
39
39
  options.layout && Object.assign(options, options.layout), this.internalProps.columns = (0,
@@ -45,19 +45,20 @@ class PivotTable extends BaseTable_1.BaseTable {
45
45
  vutils_1.cloneDeep)(options.columnTree) : [], this.internalProps.rowTree = options.indicatorsAsCol || (null === (_c = options.rows) || void 0 === _c ? void 0 : _c.length) || options.rowTree ? (0,
46
46
  vutils_1.cloneDeep)(options.rowTree) : [], this.internalProps.records = options.records,
47
47
  this.pagination = options.pagination, 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 = (0, vutils_1.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_1.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_1.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 pivot_header_layout_1.PivotHeaderLayoutMap(this, this.dataset);
57
58
  } else {
58
59
  if (!Array.isArray(this.internalProps.columnTree) && !Array.isArray(this.internalProps.rowTree)) return;
59
60
  this.internalProps.layoutMap = new pivot_header_layout_1.PivotHeaderLayoutMap(this, null),
60
- (null === (_m = null == records ? void 0 : records[0]) || void 0 === _m ? void 0 : _m.constructor) !== Array && (this.flatDataToObjects = new flatDataToObject_1.FlatDataToObjects({
61
+ (null === (_o = null == records ? void 0 : records[0]) || void 0 === _o ? void 0 : _o.constructor) !== Array && (this.flatDataToObjects = new flatDataToObject_1.FlatDataToObjects({
61
62
  rows: this.internalProps.layoutMap.fullRowDimensionKeys,
62
63
  columns: this.internalProps.layoutMap.colDimensionKeys,
63
64
  indicators: this.internalProps.layoutMap.indicatorKeys,
@@ -98,7 +99,7 @@ class PivotTable extends BaseTable_1.BaseTable {
98
99
  return ifCan;
99
100
  }
100
101
  updateOption(options) {
101
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
102
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
102
103
  const internalProps = this.internalProps;
103
104
  if (super.updateOption(options), this.internalProps.columns = (0, vutils_1.cloneDeep)(options.columns),
104
105
  this.internalProps.rows = (0, vutils_1.cloneDeep)(options.rows), this.internalProps.indicators = (null === (_a = options.indicators) || void 0 === _a ? void 0 : _a.length) ? (0,
@@ -109,26 +110,27 @@ class PivotTable extends BaseTable_1.BaseTable {
109
110
  vutils_1.cloneDeep)(options.rowTree) : [], options.records && (this.internalProps.records = options.records),
110
111
  this.stateManager.initCheckedState(this.internalProps.records), this.stateManager.updateDrillState(void 0, void 0, !1, !1, -1, -1),
111
112
  this.pagination = options.pagination, internalProps.columnResizeType = null !== (_e = options.columnResizeType) && void 0 !== _e ? _e : "column",
113
+ internalProps.rowResizeType = null !== (_f = options.rowResizeType) && void 0 !== _f ? _f : "row",
112
114
  internalProps.dataConfig = (0, vutils_1.cloneDeep)(options.dataConfig), options.rowTree || options.columnTree ? internalProps.enableDataAnalysis = !1 : internalProps.enableDataAnalysis = !0,
113
115
  "tree" === (null == options ? void 0 : options.rowHierarchyType) && "tree" === this.internalProps.layoutMap.rowHierarchyType && this.internalProps.layoutMap.rowExpandLevel === (null == options ? void 0 : options.rowExpandLevel)) {
114
116
  const beforeRowDimensions = this.internalProps.layoutMap.rowDimensionTree.tree.children;
115
- null === (_f = this.internalProps.rowTree) || void 0 === _f || _f.forEach(((node, index) => {
117
+ null === (_g = this.internalProps.rowTree) || void 0 === _g || _g.forEach(((node, index) => {
116
118
  const beforeRowDimension = beforeRowDimensions.find((item => item.dimensionKey === node.dimensionKey && item.value === node.value));
117
119
  beforeRowDimension && this.syncHierarchyState(beforeRowDimension, node);
118
120
  }));
119
121
  }
120
122
  const records = this.internalProps.records;
121
123
  if (this.internalProps.enableDataAnalysis && (options.rows || options.columns)) {
122
- 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),
123
- 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),
124
- 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),
124
+ 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),
125
+ 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),
126
+ 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),
125
127
  keys)), []);
126
- this.dataset = new dataset_1.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),
128
+ this.dataset = new dataset_1.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),
127
129
  internalProps.layoutMap = new pivot_header_layout_1.PivotHeaderLayoutMap(this, this.dataset);
128
130
  } else {
129
131
  if (!Array.isArray(this.internalProps.columnTree) && !Array.isArray(this.internalProps.rowTree)) return this;
130
132
  internalProps.layoutMap = new pivot_header_layout_1.PivotHeaderLayoutMap(this, null),
131
- (null === (_l = null == records ? void 0 : records[0]) || void 0 === _l ? void 0 : _l.constructor) !== Array && (this.flatDataToObjects = new flatDataToObject_1.FlatDataToObjects({
133
+ (null === (_m = null == records ? void 0 : records[0]) || void 0 === _m ? void 0 : _m.constructor) !== Array && (this.flatDataToObjects = new flatDataToObject_1.FlatDataToObjects({
132
134
  rows: internalProps.layoutMap.fullRowDimensionKeys,
133
135
  columns: internalProps.layoutMap.colDimensionKeys,
134
136
  indicators: internalProps.layoutMap.indicatorKeys,
@@ -348,14 +350,37 @@ class PivotTable extends BaseTable_1.BaseTable {
348
350
  })), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
349
351
  var _a;
350
352
  return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
351
- })), treeNode = this.flatDataToObjects.getTreeNode(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, !1);
353
+ })), treeNode = this.flatDataToObjects.getTreeNode(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey);
352
354
  return null == treeNode ? void 0 : treeNode.record;
353
355
  }
354
356
  const rowIndex = this.getBodyIndexByRow(row), colIndex = this.getBodyIndexByCol(col);
355
357
  return null === (_a = this.records[rowIndex]) || void 0 === _a ? void 0 : _a[colIndex];
356
358
  }
357
359
  getCellRawRecord(col, row) {
358
- return this.getCellOriginRecord(col, row);
360
+ var _a;
361
+ if (this.internalProps.layoutMap.isHeader(col, row)) return;
362
+ if (this.dataset) {
363
+ const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row), colKeys = cellDimensionPath.colHeaderPaths.map((colPath => {
364
+ var _a;
365
+ return null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
366
+ })), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
367
+ var _a;
368
+ return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
369
+ }));
370
+ 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;
371
+ }
372
+ if (this.flatDataToObjects) {
373
+ const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row), colKeys = cellDimensionPath.colHeaderPaths.map((colPath => {
374
+ var _a;
375
+ return null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
376
+ })), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
377
+ var _a;
378
+ return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
379
+ })), treeNode = this.flatDataToObjects.getTreeNode(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, !1);
380
+ return null == treeNode ? void 0 : treeNode.record;
381
+ }
382
+ const rowIndex = this.getBodyIndexByRow(row), colIndex = this.getBodyIndexByCol(col);
383
+ return null === (_a = this.records[rowIndex]) || void 0 === _a ? void 0 : _a[colIndex];
359
384
  }
360
385
  updateSortRules(sortRules) {
361
386
  this.internalProps.dataConfig.sortRules = sortRules, this.dataset.updateSortRules(sortRules),
@@ -509,9 +534,15 @@ class PivotTable extends BaseTable_1.BaseTable {
509
534
  this.editorManager.completeEdit();
510
535
  }
511
536
  getEditor(col, row) {
512
- var _a;
513
- const define = this.getBodyColumnDefine(col, row);
514
- let editorDefine = null !== (_a = null == define ? void 0 : define.editor) && void 0 !== _a ? _a : this.options.editor;
537
+ var _a, _b;
538
+ let editorDefine;
539
+ if (this.isHeader(col, row) && !this.isCornerHeader(col, row)) {
540
+ const define = this.getHeaderDefine(col, row);
541
+ editorDefine = null !== (_a = null == define ? void 0 : define.headerEditor) && void 0 !== _a ? _a : this.options.headerEditor;
542
+ } else {
543
+ const define = this.getBodyColumnDefine(col, row);
544
+ editorDefine = null !== (_b = null == define ? void 0 : define.editor) && void 0 !== _b ? _b : this.options.editor;
545
+ }
515
546
  if ("function" == typeof editorDefine) {
516
547
  editorDefine = editorDefine({
517
548
  col: col,
@@ -541,20 +572,24 @@ class PivotTable extends BaseTable_1.BaseTable {
541
572
  changeCellValue(col, row, value, workOnEditableCell = !1) {
542
573
  if (workOnEditableCell && this.isHasEditorDefine(col, row) || !1 === workOnEditableCell) {
543
574
  let newValue = value;
544
- if ("number" == typeof this.getCellRawValue(col, row) && (0, util_1.isAllDigits)(value) && (newValue = parseFloat(value)),
545
- this._changeCellValueToDataSet(col, row, newValue), this.scenegraph.updateCellContent(col, row),
546
- "adaptive" === this.widthMode || this.autoFillWidth && this.getAllColsWidth() <= this.tableNoFrameWidth) 0 === this.internalProps._widthResizedColMap.size && this.scenegraph.recalculateColWidths(); else if (!this.internalProps._widthResizedColMap.has(col)) {
575
+ const oldValue = this.getCellOriginValue(col, row), rawValue = this.getCellRawValue(col, row);
576
+ "number" == typeof rawValue && (0, util_1.isAllDigits)(value) && (newValue = parseFloat(value)),
577
+ this._changeCellValueToDataSet(col, row, oldValue, newValue);
578
+ const range = this.getCellRange(col, row);
579
+ 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);
580
+ 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)) {
547
581
  const oldWidth = this.getColWidth(col), newWidth = (0, compute_col_width_1.computeColWidth)(col, 0, this.rowCount - 1, this, !1);
548
582
  newWidth !== oldWidth && this.scenegraph.updateColWidth(col, newWidth - oldWidth);
549
583
  }
550
- if ("adaptive" === this.heightMode || this.autoFillHeight && this.getAllRowsHeight() <= this.tableNoFrameHeight) this.scenegraph.recalculateRowHeights(); else if ("autoHeight" === this.heightMode) {
584
+ 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)) {
551
585
  const oldHeight = this.getRowHeight(row), newHeight = (0, compute_row_height_1.computeRowHeight)(row, 0, this.colCount - 1, this);
552
586
  this.scenegraph.updateRowHeight(row, newHeight - oldHeight);
553
587
  }
554
588
  this.fireListeners(TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
555
589
  col: col,
556
590
  row: row,
557
- rawValue: this.getCellRawValue(col, row),
591
+ rawValue: rawValue,
592
+ currentValue: oldValue,
558
593
  changedValue: newValue
559
594
  }), this.scenegraph.updateNextFrame();
560
595
  }
@@ -569,12 +604,14 @@ class PivotTable extends BaseTable_1.BaseTable {
569
604
  workOnEditableCell && this.isHasEditorDefine(startCol + j, startRow + i) || !1 === workOnEditableCell) {
570
605
  const value = rowValues[j];
571
606
  let newValue = value;
572
- const rawValue = this.getCellRawValue(startCol + j, startRow + i);
607
+ const oldValue = this.getCellOriginValue(startCol + j, startRow + i), rawValue = this.getCellRawValue(startCol + j, startRow + i);
573
608
  "number" == typeof rawValue && (0, util_1.isAllDigits)(value) && (newValue = parseFloat(value)),
574
- this._changeCellValueToDataSet(startCol + j, startRow + i, newValue), this.fireListeners(TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
609
+ this._changeCellValueToDataSet(startCol + j, startRow + i, oldValue, newValue),
610
+ this.fireListeners(TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
575
611
  col: startCol + j,
576
612
  row: startRow + i,
577
613
  rawValue: rawValue,
614
+ currentValue: oldValue,
578
615
  changedValue: this.getCellOriginValue(startCol + j, startRow + i)
579
616
  });
580
617
  }
@@ -596,25 +633,34 @@ class PivotTable extends BaseTable_1.BaseTable {
596
633
  }
597
634
  this.scenegraph.updateNextFrame();
598
635
  }
599
- _changeCellValueToDataSet(col, row, newValue) {
636
+ _changeCellValueToDataSet(col, row, oldValue, newValue) {
637
+ var _a, _b, _c, _d, _e, _f;
600
638
  if (this.dataset) {
601
- const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row), colKeys = cellDimensionPath.colHeaderPaths.map((colPath => {
602
- var _a;
603
- return null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
604
- })), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
605
- var _a;
606
- return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
607
- }));
608
- 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);
639
+ const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
640
+ if (this.isHeader(col, row)) this.internalProps.layoutMap.changeTreeNodeTitle(col, row, newValue),
641
+ !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 {
642
+ const colKeys = cellDimensionPath.colHeaderPaths.map((colPath => {
643
+ var _a;
644
+ return null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
645
+ })), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
646
+ var _a;
647
+ return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
648
+ }));
649
+ 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);
650
+ }
609
651
  } else if (this.flatDataToObjects) {
610
- const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row), colKeys = cellDimensionPath.colHeaderPaths.map((colPath => {
611
- var _a;
612
- return null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
613
- })), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
614
- var _a;
615
- return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
616
- }));
617
- this.flatDataToObjects.changeTreeNodeValue(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, newValue);
652
+ const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
653
+ if (this.isHeader(col, row)) this.internalProps.layoutMap.changeTreeNodeTitle(col, row, newValue),
654
+ !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 {
655
+ const colKeys = cellDimensionPath.colHeaderPaths.map((colPath => {
656
+ var _a;
657
+ return null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
658
+ })), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
659
+ var _a;
660
+ return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
661
+ }));
662
+ this.flatDataToObjects.changeTreeNodeValue(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, newValue);
663
+ }
618
664
  } else {
619
665
  const rowIndex = this.getBodyIndexByRow(row), colIndex = this.getBodyIndexByCol(col);
620
666
  this.records[rowIndex][colIndex] = newValue;