@visactor/vtable 1.15.1-alpha.1 → 1.15.2-alpha.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 (93) hide show
  1. package/cjs/ListTable.d.ts +3 -3
  2. package/cjs/ListTable.js +6 -8
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/components/empty-tip/empty-tip.d.ts +6 -0
  5. package/cjs/components/empty-tip/empty-tip.js +11 -2
  6. package/cjs/components/empty-tip/empty-tip.js.map +1 -1
  7. package/cjs/core/BaseTable.d.ts +3 -2
  8. package/cjs/core/BaseTable.js +42 -10
  9. package/cjs/core/BaseTable.js.map +1 -1
  10. package/cjs/core/record-helper.d.ts +3 -3
  11. package/cjs/core/record-helper.js +24 -16
  12. package/cjs/core/record-helper.js.map +1 -1
  13. package/cjs/core/tableHelper.js +5 -5
  14. package/cjs/core/tableHelper.js.map +1 -1
  15. package/cjs/core/utils/get-cell-position.d.ts +2 -12
  16. package/cjs/core/utils/get-cell-position.js +6 -8
  17. package/cjs/core/utils/get-cell-position.js.map +1 -1
  18. package/cjs/data/CachedDataSource.d.ts +13 -5
  19. package/cjs/data/CachedDataSource.js +106 -15
  20. package/cjs/data/CachedDataSource.js.map +1 -1
  21. package/cjs/data/DataSource.d.ts +16 -8
  22. package/cjs/data/DataSource.js +71 -33
  23. package/cjs/data/DataSource.js.map +1 -1
  24. package/cjs/index.d.ts +1 -1
  25. package/cjs/index.js +1 -1
  26. package/cjs/index.js.map +1 -1
  27. package/cjs/layout/simple-header-layout.js +1 -1
  28. package/cjs/layout/simple-header-layout.js.map +1 -1
  29. package/cjs/scenegraph/group-creater/cell-helper.js +2 -2
  30. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  31. package/cjs/scenegraph/group-creater/column-helper.js +2 -2
  32. package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
  33. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +1 -1
  34. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  35. package/cjs/scenegraph/layout/compute-row-height.js +7 -13
  36. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  37. package/cjs/scenegraph/stick-text/index.js +1 -1
  38. package/cjs/scenegraph/stick-text/index.js.map +1 -1
  39. package/cjs/state/checkbox/checkbox.js +1 -1
  40. package/cjs/state/checkbox/checkbox.js.map +1 -1
  41. package/cjs/ts-types/base-table.d.ts +4 -2
  42. package/cjs/ts-types/base-table.js.map +1 -1
  43. package/cjs/ts-types/table-engine.d.ts +3 -2
  44. package/cjs/ts-types/table-engine.js.map +1 -1
  45. package/cjs/vrender.js.map +1 -1
  46. package/dist/vtable.js +406 -120
  47. package/dist/vtable.min.js +2 -2
  48. package/es/ListTable.d.ts +3 -3
  49. package/es/ListTable.js +7 -8
  50. package/es/ListTable.js.map +1 -1
  51. package/es/components/empty-tip/empty-tip.d.ts +6 -0
  52. package/es/components/empty-tip/empty-tip.js +11 -2
  53. package/es/components/empty-tip/empty-tip.js.map +1 -1
  54. package/es/core/BaseTable.d.ts +3 -2
  55. package/es/core/BaseTable.js +42 -10
  56. package/es/core/BaseTable.js.map +1 -1
  57. package/es/core/record-helper.d.ts +3 -3
  58. package/es/core/record-helper.js +24 -16
  59. package/es/core/record-helper.js.map +1 -1
  60. package/es/core/tableHelper.js +5 -5
  61. package/es/core/tableHelper.js.map +1 -1
  62. package/es/core/utils/get-cell-position.d.ts +2 -12
  63. package/es/core/utils/get-cell-position.js +6 -8
  64. package/es/core/utils/get-cell-position.js.map +1 -1
  65. package/es/data/CachedDataSource.d.ts +13 -5
  66. package/es/data/CachedDataSource.js +106 -17
  67. package/es/data/CachedDataSource.js.map +1 -1
  68. package/es/data/DataSource.d.ts +16 -8
  69. package/es/data/DataSource.js +75 -37
  70. package/es/data/DataSource.js.map +1 -1
  71. package/es/index.d.ts +1 -1
  72. package/es/index.js +1 -1
  73. package/es/index.js.map +1 -1
  74. package/es/layout/simple-header-layout.js +1 -1
  75. package/es/layout/simple-header-layout.js.map +1 -1
  76. package/es/scenegraph/group-creater/cell-helper.js +2 -2
  77. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  78. package/es/scenegraph/group-creater/column-helper.js +2 -2
  79. package/es/scenegraph/group-creater/column-helper.js.map +1 -1
  80. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +1 -1
  81. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  82. package/es/scenegraph/layout/compute-row-height.js +7 -13
  83. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  84. package/es/scenegraph/stick-text/index.js +1 -1
  85. package/es/scenegraph/stick-text/index.js.map +1 -1
  86. package/es/state/checkbox/checkbox.js +1 -1
  87. package/es/state/checkbox/checkbox.js.map +1 -1
  88. package/es/ts-types/base-table.d.ts +4 -2
  89. package/es/ts-types/base-table.js.map +1 -1
  90. package/es/ts-types/table-engine.d.ts +3 -2
  91. package/es/ts-types/table-engine.js.map +1 -1
  92. package/es/vrender.js.map +1 -1
  93. package/package.json +2 -2
package/dist/vtable.js CHANGED
@@ -30743,7 +30743,7 @@
30743
30743
  return EVENT_TYPE$1;
30744
30744
  }
30745
30745
  hasHierarchyStateExpand = false;
30746
- beforeChangedRecordsMap = {};
30746
+ beforeChangedRecordsMap = new Map();
30747
30747
  registedAggregators = {};
30748
30748
  rowHierarchyType;
30749
30749
  fieldAggregators = [];
@@ -30803,6 +30803,27 @@
30803
30803
  }
30804
30804
  }
30805
30805
  }
30806
+ supplementConfig(pagination, columns, rowHierarchyType, hierarchyExpandLevel) {
30807
+ this.columns = columns;
30808
+ this._sourceLength = this._source?.length || 0;
30809
+ this.sortedIndexMap = new Map();
30810
+ this._currentPagerIndexedData = [];
30811
+ this.userPagination = pagination;
30812
+ this.pagination = pagination || {
30813
+ totalCount: this._sourceLength,
30814
+ perPageCount: this._sourceLength,
30815
+ currentPage: 0
30816
+ };
30817
+ if (hierarchyExpandLevel >= 1) {
30818
+ this.hierarchyExpandLevel = hierarchyExpandLevel;
30819
+ }
30820
+ this.currentIndexedData = Array.from({ length: this._sourceLength }, (_, i) => i);
30821
+ if (rowHierarchyType === 'tree') {
30822
+ this.initTreeHierarchyState();
30823
+ }
30824
+ this.rowHierarchyType = rowHierarchyType;
30825
+ this.updatePagerData();
30826
+ }
30806
30827
  registerAggregator(type, aggregator) {
30807
30828
  this.registedAggregators[type] = aggregator;
30808
30829
  }
@@ -30981,6 +31002,9 @@
30981
31002
  throw new Error(`currentIndexedData should has values!`);
30982
31003
  }
30983
31004
  }
31005
+ getRecordIndexPaths(bodyShowIndex) {
31006
+ return this._currentPagerIndexedData[bodyShowIndex];
31007
+ }
30984
31008
  get records() {
30985
31009
  return Array.isArray(this._source) ? this._source : [];
30986
31010
  }
@@ -31016,7 +31040,13 @@
31016
31040
  }
31017
31041
  getHierarchyState(index) {
31018
31042
  const record = this.getOriginalRecord(this.currentPagerIndexedData[index]);
31019
- return record?.hierarchyState ?? null;
31043
+ if (record?.hierarchyState) {
31044
+ const hierarchyState = record.hierarchyState;
31045
+ if (record.children?.length > 0 || record.children === true) {
31046
+ return hierarchyState;
31047
+ }
31048
+ }
31049
+ return null;
31020
31050
  }
31021
31051
  toggleHierarchyState(index, bodyStartIndex, bodyEndIndex) {
31022
31052
  const oldIndexedData = this.currentIndexedData.slice(0);
@@ -31103,13 +31133,9 @@
31103
31133
  }
31104
31134
  if (index >= 0) {
31105
31135
  const dataIndex = this.getIndexKey(index);
31106
- if (!this.beforeChangedRecordsMap[dataIndex]) {
31107
- const originRecord = this.getOriginalRecord(dataIndex);
31108
- this.beforeChangedRecordsMap[dataIndex] =
31109
- cloneDeep$1(originRecord, undefined, ['vtable_gantt_linkedFrom', 'vtable_gantt_linkedTo']) ?? {};
31110
- }
31136
+ this.cacheBeforeChangedRecord(dataIndex, table);
31111
31137
  if (typeof field === 'string' || typeof field === 'number') {
31112
- const beforeChangedValue = this.beforeChangedRecordsMap[dataIndex][field];
31138
+ const beforeChangedValue = this.beforeChangedRecordsMap.get(dataIndex.toString())?.[field];
31113
31139
  const record = this.getOriginalRecord(dataIndex);
31114
31140
  let formatValue = value;
31115
31141
  if (typeof beforeChangedValue === 'number' && isAllDigits(value)) {
@@ -31135,6 +31161,12 @@
31135
31161
  }
31136
31162
  }
31137
31163
  }
31164
+ cacheBeforeChangedRecord(dataIndex, table) {
31165
+ if (!this.beforeChangedRecordsMap.has(dataIndex.toString())) {
31166
+ const originRecord = this.getOriginalRecord(dataIndex);
31167
+ this.beforeChangedRecordsMap.set(dataIndex.toString(), cloneDeep$1(originRecord, undefined, ['vtable_gantt_linkedFrom', 'vtable_gantt_linkedTo']) ?? {});
31168
+ }
31169
+ }
31138
31170
  setRecord(record, index) {
31139
31171
  let isAdd = true;
31140
31172
  if (this.dataConfig?.filterRules?.length >= 1) {
@@ -31221,7 +31253,7 @@
31221
31253
  }
31222
31254
  addRecordForSorted(record) {
31223
31255
  if (Array.isArray(this.records)) {
31224
- this.beforeChangedRecordsMap = [];
31256
+ this.beforeChangedRecordsMap.clear();
31225
31257
  this.records.push(record);
31226
31258
  this.currentIndexedData.push(this.currentIndexedData.length);
31227
31259
  this._sourceLength += 1;
@@ -31234,7 +31266,7 @@
31234
31266
  }
31235
31267
  addRecordsForSorted(recordArr) {
31236
31268
  if (Array.isArray(this.records)) {
31237
- this.beforeChangedRecordsMap = [];
31269
+ this.beforeChangedRecordsMap.clear();
31238
31270
  if (Array.isArray(recordArr)) {
31239
31271
  this.records.push(...recordArr);
31240
31272
  for (let i = 0; i < recordArr.length; i++) {
@@ -31249,12 +31281,12 @@
31249
31281
  }
31250
31282
  }
31251
31283
  }
31252
- adjustBeforeChangedRecordsMap(insertIndex, insertCount) {
31253
- const length = this.beforeChangedRecordsMap.length;
31284
+ adjustBeforeChangedRecordsMap(insertIndex, insertCount, type = 'add') {
31285
+ const length = this.beforeChangedRecordsMap.size;
31254
31286
  for (let key = length - 1; key >= insertIndex; key--) {
31255
- const record = this.beforeChangedRecordsMap[key];
31256
- delete this.beforeChangedRecordsMap[key];
31257
- this.beforeChangedRecordsMap[key + insertCount] = record;
31287
+ const record = this.beforeChangedRecordsMap.get(key.toString());
31288
+ this.beforeChangedRecordsMap.delete(key.toString());
31289
+ this.beforeChangedRecordsMap.set((key + (type === 'add' ? insertCount : -insertCount)).toString(), record);
31258
31290
  }
31259
31291
  }
31260
31292
  deleteRecords(recordIndexs) {
@@ -31266,7 +31298,7 @@
31266
31298
  if (recordIndex >= this._sourceLength || recordIndex < 0) {
31267
31299
  continue;
31268
31300
  }
31269
- delete this.beforeChangedRecordsMap[recordIndex];
31301
+ this.adjustBeforeChangedRecordsMap(recordIndex, 1, 'delete');
31270
31302
  realDeletedRecordIndexs.push(recordIndex);
31271
31303
  const deletedRecord = this.records[recordIndex];
31272
31304
  for (let i = 0; i < this.fieldAggregators.length; i++) {
@@ -31300,7 +31332,6 @@
31300
31332
  continue;
31301
31333
  }
31302
31334
  const rawIndex = this.currentIndexedData[recordIndex];
31303
- delete this.beforeChangedRecordsMap[rawIndex];
31304
31335
  this.records.splice(rawIndex, 1);
31305
31336
  this._sourceLength -= 1;
31306
31337
  }
@@ -31309,6 +31340,7 @@
31309
31340
  this.pagination.perPageCount = this._sourceLength;
31310
31341
  this.pagination.totalCount = this._sourceLength;
31311
31342
  }
31343
+ this.beforeChangedRecordsMap.clear();
31312
31344
  }
31313
31345
  }
31314
31346
  updateRecords(records, recordIndexs) {
@@ -31316,7 +31348,7 @@
31316
31348
  for (let index = 0; index < recordIndexs.length; index++) {
31317
31349
  const recordIndex = recordIndexs[index];
31318
31350
  if (Array.isArray(recordIndex)) {
31319
- delete this.beforeChangedRecordsMap[recordIndex.join(',')];
31351
+ this.beforeChangedRecordsMap.delete(recordIndex.toString());
31320
31352
  realDeletedRecordIndexs.push(recordIndex);
31321
31353
  recordIndex.slice(0, -1).reduce((acc, key) => {
31322
31354
  if (acc[key] === undefined) {
@@ -31329,7 +31361,7 @@
31329
31361
  if (recordIndex >= this._sourceLength || recordIndex < 0) {
31330
31362
  continue;
31331
31363
  }
31332
- delete this.beforeChangedRecordsMap[recordIndex];
31364
+ this.beforeChangedRecordsMap.delete(recordIndex.toString());
31333
31365
  realDeletedRecordIndexs.push(recordIndex);
31334
31366
  for (let i = 0; i < this.fieldAggregators.length; i++) {
31335
31367
  this.fieldAggregators[i].updateRecord(this.records[recordIndex], records[index]);
@@ -31352,7 +31384,7 @@
31352
31384
  if (typeof rawIndex !== 'number') {
31353
31385
  return;
31354
31386
  }
31355
- delete this.beforeChangedRecordsMap[rawIndex];
31387
+ this.beforeChangedRecordsMap.delete(rawIndex.toString());
31356
31388
  this.records[rawIndex] = records[index];
31357
31389
  }
31358
31390
  this.sortedIndexMap.clear();
@@ -31418,7 +31450,7 @@
31418
31450
  }
31419
31451
  clearFilteredChildren(record) {
31420
31452
  record.filteredChildren = undefined;
31421
- for (let i = 0; i < record.children?.length ?? 0; i++) {
31453
+ for (let i = 0; i < (record.children?.length ?? 0); i++) {
31422
31454
  this.clearFilteredChildren(record.children[i]);
31423
31455
  }
31424
31456
  }
@@ -31553,8 +31585,8 @@
31553
31585
  });
31554
31586
  }
31555
31587
  getRawRecord(dataIndex) {
31556
- if (this.beforeChangedRecordsMap?.[dataIndex]) {
31557
- return this.beforeChangedRecordsMap[dataIndex];
31588
+ if (this.beforeChangedRecordsMap?.has(dataIndex.toString())) {
31589
+ return this.beforeChangedRecordsMap?.get(dataIndex.toString());
31558
31590
  }
31559
31591
  let data;
31560
31592
  if (!this.dataSourceObj.records) {
@@ -31609,7 +31641,10 @@
31609
31641
  },
31610
31642
  length: 0
31611
31643
  });
31612
- isCanExchangeOrder(sourceIndex, targetIndex) {
31644
+ canChangeOrder(sourceIndex, targetIndex) {
31645
+ if ((this.dataSourceObj?.canChangeOrder)) {
31646
+ return this.dataSourceObj.canChangeOrder(sourceIndex, targetIndex);
31647
+ }
31613
31648
  if (this.hasHierarchyStateExpand) {
31614
31649
  let sourceIndexs = this.currentPagerIndexedData[sourceIndex];
31615
31650
  let targetIndexs = this.currentPagerIndexedData[targetIndex];
@@ -31651,11 +31686,15 @@
31651
31686
  }
31652
31687
  return true;
31653
31688
  }
31654
- reorderRecord(sourceIndex, targetIndex) {
31689
+ changeOrder(sourceIndex, targetIndex) {
31690
+ if ((this.dataSourceObj?.changeOrder)) {
31691
+ this.dataSourceObj.changeOrder(sourceIndex, targetIndex);
31692
+ return;
31693
+ }
31655
31694
  if (this.lastSortStates?.some(state => state.order === 'asc' || state.order === 'desc')) {
31656
31695
  return;
31657
31696
  }
31658
- else if (this.isCanExchangeOrder(sourceIndex, targetIndex)) {
31697
+ else if (this.canChangeOrder(sourceIndex, targetIndex)) {
31659
31698
  if (this.hasHierarchyStateExpand) {
31660
31699
  let sourceIndexs = this.currentPagerIndexedData[sourceIndex];
31661
31700
  let targetIndexs = this.currentPagerIndexedData[targetIndex];
@@ -31781,6 +31820,26 @@
31781
31820
  }
31782
31821
  return result;
31783
31822
  }
31823
+ function sortRecordIndexs(recordIndexs, sort) {
31824
+ const result = recordIndexs.sort((a, b) => {
31825
+ if (isNumber$4(a)) {
31826
+ a = [a];
31827
+ }
31828
+ if (isNumber$4(b)) {
31829
+ b = [b];
31830
+ }
31831
+ const length = Math.max(a.length, b.length);
31832
+ for (let i = 0; i < length; i++) {
31833
+ const aa = a[i] ?? -1;
31834
+ const bb = b[i] ?? -1;
31835
+ if (aa !== bb) {
31836
+ return sort === 1 ? aa - bb : bb - aa;
31837
+ }
31838
+ }
31839
+ return 0;
31840
+ });
31841
+ return result;
31842
+ }
31784
31843
 
31785
31844
  /**
31786
31845
  * Checks if `value` is classified as an `Array` object.
@@ -33011,6 +33070,7 @@
33011
33070
  _recordCache;
33012
33071
  _fieldCache;
33013
33072
  groupAggregator;
33073
+ _isGrouped;
33014
33074
  static get EVENT_TYPE() {
33015
33075
  return DataSource.EVENT_TYPE;
33016
33076
  }
@@ -33024,27 +33084,53 @@
33024
33084
  }, dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel);
33025
33085
  }
33026
33086
  constructor(opt, dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel) {
33087
+ let _isGrouped;
33027
33088
  if (isArray$7(dataConfig?.groupByRules)) {
33028
33089
  rowHierarchyType = 'tree';
33090
+ _isGrouped = true;
33029
33091
  }
33030
33092
  super(opt, dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel);
33093
+ this._isGrouped = _isGrouped;
33031
33094
  this._recordCache = [];
33032
33095
  this._fieldCache = {};
33033
33096
  }
33034
33097
  getOriginalRecord(index) {
33035
- if (this._recordCache && this._recordCache[index]) {
33098
+ if (isNumber$4(index) && this._recordCache && this._recordCache[index]) {
33036
33099
  return this._recordCache[index];
33037
33100
  }
33038
33101
  return super.getOriginalRecord(index);
33039
33102
  }
33040
33103
  getRawRecord(index) {
33041
- if (this.beforeChangedRecordsMap?.[index]) {
33042
- return this.beforeChangedRecordsMap[index];
33104
+ let originRecordIndex;
33105
+ if (this._isGrouped) {
33106
+ originRecordIndex = this.getOriginRecordIndexForGroup(index);
33107
+ if (isValid$3(originRecordIndex) && this.beforeChangedRecordsMap?.has(originRecordIndex.toString())) {
33108
+ return this.beforeChangedRecordsMap?.get(originRecordIndex.toString());
33109
+ }
33043
33110
  }
33044
- if (this._recordCache && this._recordCache[index]) {
33111
+ else {
33112
+ if (this.beforeChangedRecordsMap?.has(index.toString())) {
33113
+ return this.beforeChangedRecordsMap?.get(index.toString());
33114
+ }
33115
+ }
33116
+ if (isNumber$4(index) && this._recordCache && this._recordCache[index]) {
33045
33117
  return this._recordCache[index];
33046
33118
  }
33047
- return super.getRawRecord(index);
33119
+ let data;
33120
+ if (!this.dataSourceObj.records) {
33121
+ data = this._get(index);
33122
+ }
33123
+ else {
33124
+ if (Array.isArray(index)) {
33125
+ data = getValueFromDeepArray(this.records, index);
33126
+ }
33127
+ else {
33128
+ data = this.records[index];
33129
+ }
33130
+ }
33131
+ return getValue$2(data, (val) => {
33132
+ this.recordPromiseCallBack(index, val);
33133
+ });
33048
33134
  }
33049
33135
  getOriginalField(index, field, col, row, table) {
33050
33136
  const rowCache = this._fieldCache && this._fieldCache[index];
@@ -33089,7 +33175,6 @@
33089
33175
  const groupResult = [];
33090
33176
  for (let i = 0; i < records.length; i++) {
33091
33177
  dealWithGroup(records[i], groupResult, groupMap, groupByKeys, 0);
33092
- records[i].vtableOriginIndex = i;
33093
33178
  }
33094
33179
  return groupResult;
33095
33180
  }
@@ -33125,43 +33210,185 @@
33125
33210
  this.initTreeHierarchyState();
33126
33211
  this.updatePagerData();
33127
33212
  }
33213
+ getOriginRecordIndexForGroup(recordIndex) {
33214
+ const targetRecord = this.getOriginalRecord(recordIndex);
33215
+ if (!isValid$3(targetRecord)) {
33216
+ return undefined;
33217
+ }
33218
+ if (targetRecord.children && targetRecord.children.length > 0) {
33219
+ return undefined;
33220
+ }
33221
+ for (let i = 0; i < this.dataSourceObj.records.length; i++) {
33222
+ if (this.dataSourceObj.records[i] === targetRecord) {
33223
+ return i;
33224
+ }
33225
+ }
33226
+ return undefined;
33227
+ }
33128
33228
  addRecordsForGroup(recordArr, recordIndex) {
33129
33229
  if (!isArray$7(recordArr) || recordArr.length === 0) {
33130
33230
  return;
33131
33231
  }
33132
- if (recordIndex === undefined || recordIndex > this.dataSourceObj.records) {
33133
- recordIndex = this.dataSourceObj.records;
33232
+ let originRecordIndex = this.getOriginRecordIndexForGroup(recordIndex);
33233
+ if (originRecordIndex === undefined || originRecordIndex > this.dataSourceObj.records) {
33234
+ originRecordIndex = this.dataSourceObj.records.length;
33134
33235
  }
33135
- this.dataSourceObj.records.splice(recordIndex, 0, ...recordArr);
33236
+ this.dataSourceObj.records.splice(originRecordIndex, 0, ...recordArr);
33237
+ this.adjustBeforeChangedRecordsMap(originRecordIndex, recordArr.length);
33136
33238
  this.updateGroup();
33137
33239
  }
33138
33240
  deleteRecordsForGroup(recordIndexs) {
33139
33241
  if (!isArray$7(recordIndexs) || recordIndexs.length === 0) {
33140
33242
  return;
33141
33243
  }
33142
- const recordIndexsMaxToMin = recordIndexs.sort((a, b) => b - a);
33244
+ const recordIndexsMaxToMin = sortRecordIndexs(recordIndexs, -1);
33143
33245
  for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
33144
33246
  const recordIndex = recordIndexsMaxToMin[index];
33145
- if (recordIndex >= this.sourceLength || recordIndex < 0) {
33247
+ if (isNumber$4(recordIndex) && (recordIndex >= this.sourceLength || recordIndex < 0)) {
33146
33248
  continue;
33147
33249
  }
33148
- delete this.beforeChangedRecordsMap[recordIndex];
33149
- this.dataSourceObj.records.splice(recordIndex, 1);
33250
+ const originRecordIndex = this.getOriginRecordIndexForGroup(recordIndex);
33251
+ this.beforeChangedRecordsMap.delete(originRecordIndex.toString());
33252
+ this.dataSourceObj.records.splice(originRecordIndex, 1);
33150
33253
  this.sourceLength -= 1;
33254
+ this.adjustBeforeChangedRecordsMap(originRecordIndex, 1, 'delete');
33151
33255
  }
33152
33256
  this.updateGroup();
33153
33257
  }
33154
33258
  updateRecordsForGroup(records, recordIndexs) {
33155
33259
  for (let index = 0; index < recordIndexs.length; index++) {
33156
33260
  const recordIndex = recordIndexs[index];
33157
- if (recordIndex >= this.sourceLength || recordIndex < 0) {
33261
+ if (isNumber$4(recordIndex) && (recordIndex >= this.sourceLength || recordIndex < 0)) {
33158
33262
  continue;
33159
33263
  }
33160
- delete this.beforeChangedRecordsMap[recordIndex];
33161
- this.dataSourceObj.records[recordIndex] = records[index];
33264
+ const originRecordIndex = this.getOriginRecordIndexForGroup(recordIndex);
33265
+ this.beforeChangedRecordsMap.delete(originRecordIndex.toString());
33266
+ this.dataSourceObj.records[originRecordIndex] = records[index];
33162
33267
  }
33163
33268
  this.updateGroup();
33164
33269
  }
33270
+ addRecordsForTree(recordArr, recordIndex) {
33271
+ if (!isArray$7(recordArr) || recordArr.length === 0) {
33272
+ return;
33273
+ }
33274
+ this.adjustBeforeChangedRecordsMap(recordIndex, recordArr.length);
33275
+ if (isNumber$4(recordIndex)) {
33276
+ this.dataSourceObj.records.splice(recordIndex, 0, ...recordArr);
33277
+ }
33278
+ else {
33279
+ const index = recordIndex.pop();
33280
+ const parentRecord = this.getOriginalRecord(recordIndex);
33281
+ if (parentRecord.children) {
33282
+ parentRecord.children.splice(index, 0, ...recordArr);
33283
+ }
33284
+ else {
33285
+ parentRecord.children = recordArr;
33286
+ }
33287
+ }
33288
+ this.initTreeHierarchyState();
33289
+ this.updatePagerData();
33290
+ }
33291
+ deleteRecordsForTree(recordIndexs) {
33292
+ if (!isArray$7(recordIndexs) || recordIndexs.length === 0) {
33293
+ return;
33294
+ }
33295
+ const recordIndexsMaxToMin = sortRecordIndexs(recordIndexs, -1);
33296
+ for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
33297
+ const recordIndex = recordIndexsMaxToMin[index];
33298
+ if (isNumber$4(recordIndex) && (recordIndex >= this.sourceLength || recordIndex < 0)) {
33299
+ continue;
33300
+ }
33301
+ this.beforeChangedRecordsMap.delete(recordIndex.toString());
33302
+ if (isNumber$4(recordIndex)) {
33303
+ this.dataSourceObj.records.splice(recordIndex, 1);
33304
+ }
33305
+ else {
33306
+ const index = recordIndex.pop();
33307
+ const parentRecord = this.getOriginalRecord(recordIndex);
33308
+ parentRecord.children.splice(index, 1);
33309
+ }
33310
+ this.adjustBeforeChangedRecordsMap(recordIndex, 1, 'delete');
33311
+ }
33312
+ this.initTreeHierarchyState();
33313
+ this.updatePagerData();
33314
+ }
33315
+ updateRecordsForTree(records, recordIndexs) {
33316
+ for (let index = 0; index < recordIndexs.length; index++) {
33317
+ const recordIndex = recordIndexs[index];
33318
+ const record = records[index];
33319
+ if (isNumber$4(recordIndex) && (recordIndex >= this.sourceLength || recordIndex < 0)) {
33320
+ continue;
33321
+ }
33322
+ this.beforeChangedRecordsMap.delete(recordIndex.toString());
33323
+ if (isNumber$4(recordIndex)) {
33324
+ this.dataSourceObj.records.splice(recordIndex, 1, record);
33325
+ }
33326
+ else {
33327
+ const index = recordIndex.pop();
33328
+ const parentRecord = this.getOriginalRecord(recordIndex);
33329
+ parentRecord.children.splice(index, 1, record);
33330
+ }
33331
+ }
33332
+ this.initTreeHierarchyState();
33333
+ this.updatePagerData();
33334
+ }
33335
+ adjustBeforeChangedRecordsMap(insertIndex, insertCount, type = 'add') {
33336
+ if (this.rowHierarchyType === 'tree') {
33337
+ let insertIndexArr;
33338
+ if (isNumber$4(insertIndex)) {
33339
+ insertIndexArr = [insertIndex];
33340
+ }
33341
+ else {
33342
+ insertIndexArr = insertIndex;
33343
+ }
33344
+ const targetResult = [];
33345
+ this.beforeChangedRecordsMap.forEach((value, key) => {
33346
+ const keyArray = key.split(',');
33347
+ const length = Math.max(keyArray.length, insertIndexArr.length);
33348
+ for (let i = 0; i < length; i++) {
33349
+ const current = insertIndexArr[i] ?? -1;
33350
+ const keyIndex = Number(keyArray[i]) ?? -1;
33351
+ if (current < keyIndex ||
33352
+ (current === keyIndex && i === keyArray.length - 1 && i === insertIndexArr.length - 1)) {
33353
+ keyArray[i] = (keyIndex + (type === 'add' ? insertCount : -insertCount)).toString();
33354
+ targetResult.push({
33355
+ originKey: key,
33356
+ targetKey: keyArray.toString(),
33357
+ value
33358
+ });
33359
+ return;
33360
+ }
33361
+ }
33362
+ });
33363
+ targetResult.forEach(({ originKey, targetKey, value }) => {
33364
+ this.beforeChangedRecordsMap.delete(originKey);
33365
+ this.beforeChangedRecordsMap.set(targetKey, value);
33366
+ });
33367
+ }
33368
+ else {
33369
+ super.adjustBeforeChangedRecordsMap(insertIndex, insertCount, type);
33370
+ }
33371
+ }
33372
+ cacheBeforeChangedRecord(dataIndex, table) {
33373
+ const originRecord = this.getOriginalRecord(dataIndex);
33374
+ if (table.options.groupBy) {
33375
+ dataIndex = this.getOriginRecordIndexForGroup(dataIndex);
33376
+ }
33377
+ if (!this.beforeChangedRecordsMap.has(dataIndex.toString())) {
33378
+ this.beforeChangedRecordsMap.set(dataIndex.toString(), cloneDeep$1(originRecord, undefined, ['vtable_gantt_linkedFrom', 'vtable_gantt_linkedTo']) ?? {});
33379
+ }
33380
+ }
33381
+ getGroupSeriesNumber(showIndex) {
33382
+ const recordIndex = this.dataSource.currentIndexedData[showIndex];
33383
+ const parentRecordIndexLength = recordIndex.length - 1;
33384
+ let recordIndexLength = recordIndex.length;
33385
+ let i = 1;
33386
+ for (; recordIndexLength > parentRecordIndexLength; i++) {
33387
+ const index = this.dataSource.currentIndexedData[showIndex - i];
33388
+ recordIndexLength = isNumber$4(index) ? 1 : index.length;
33389
+ }
33390
+ return i - 1;
33391
+ }
33165
33392
  }
33166
33393
  function dealWithGroup(record, children, map, groupByKeys, level) {
33167
33394
  const groupByKey = groupByKeys[level];
@@ -33714,18 +33941,20 @@
33714
33941
  }
33715
33942
  function _setDataSource(table, dataSource) {
33716
33943
  _dealWithUpdateDataSource(table, () => {
33944
+ table.internalProps.dataSource && table.internalProps.dataSource.release?.();
33717
33945
  if (dataSource) {
33718
33946
  if (dataSource instanceof DataSource) {
33719
33947
  table.internalProps.dataSource = dataSource;
33948
+ table.internalProps.dataSource.supplementConfig(table.pagination, table.options.columns, table.internalProps.layoutMap.rowHierarchyType, getHierarchyExpandLevel(table));
33720
33949
  }
33721
33950
  else {
33722
- const newDataSource = (table.internalProps.dataSource = new CachedDataSource(dataSource));
33723
- table.addReleaseObj(newDataSource);
33951
+ table.internalProps.dataSource = new CachedDataSource(dataSource);
33724
33952
  }
33725
33953
  }
33726
33954
  else {
33727
33955
  table.internalProps.dataSource = DataSource.EMPTY;
33728
33956
  }
33957
+ table.addReleaseObj(table.internalProps.dataSource);
33729
33958
  table.internalProps.records = null;
33730
33959
  });
33731
33960
  }
@@ -37046,9 +37275,12 @@
37046
37275
  if (table.options.groupTitleCustomLayout) {
37047
37276
  customResult = dealWithCustom(table.options.groupTitleCustomLayout, undefined, range.start.col, range.start.row, table.getColsWidth(range.start.col, range.end.col), table.getRowsHeight(range.start.row, range.end.row), false, table.isAutoRowHeight(row), [0, 0, 0, 0], range, table);
37048
37277
  }
37049
- }
37050
- if (vtableMergeName) {
37051
- value = vtableMergeName;
37278
+ if (table.options.groupTitleFieldFormat) {
37279
+ value = table.options.groupTitleFieldFormat(rawRecord, col, row, table);
37280
+ }
37281
+ else if (vtableMergeName) {
37282
+ value = vtableMergeName;
37283
+ }
37052
37284
  }
37053
37285
  }
37054
37286
  const cellStyle = customStyle || table._getCellStyle(range ? range.start.col : col, range ? range.start.row : row);
@@ -37887,22 +38119,13 @@
37887
38119
  table._setRowHeight(row, newRowHeight);
37888
38120
  }
37889
38121
  }
37890
- if (table.heightMode === 'adaptive' ||
37891
- (table.autoFillHeight && table.getAllRowsHeight() <= table.tableNoFrameHeight)) {
37892
- for (let row = 0; row <= table.columnHeaderLevelCount - 1; row++) {
37893
- const newRowHeight = table.getRowHeight(row);
37894
- if (newRowHeight !== (oldRowHeights[row] ?? table.getRowHeight(row))) {
37895
- table.scenegraph.updateRowHeight(row, newRowHeight - (oldRowHeights[row] ?? table.getRowHeight(row)), true);
37896
- }
37897
- }
37898
- for (let row = table.rowCount - table.bottomFrozenRowCount; row <= table.rowCount - 1; row++) {
37899
- const newRowHeight = table.getRowHeight(row);
37900
- if (newRowHeight !== (oldRowHeights[row] ?? table.getRowHeight(row))) {
37901
- table.scenegraph.updateRowHeight(row, newRowHeight - (oldRowHeights[row] ?? table.getRowHeight(row)), true);
37902
- }
38122
+ for (let row = 0; row <= table.frozenRowCount - 1; row++) {
38123
+ const newRowHeight = table.getRowHeight(row);
38124
+ if (newRowHeight !== (oldRowHeights[row] ?? table.getRowHeight(row))) {
38125
+ table.scenegraph.updateRowHeight(row, newRowHeight - (oldRowHeights[row] ?? table.getRowHeight(row)), true);
37903
38126
  }
37904
38127
  }
37905
- for (let row = 0; row < table.frozenRowCount; row++) {
38128
+ for (let row = table.rowCount - table.bottomFrozenRowCount; row <= table.rowCount - 1; row++) {
37906
38129
  const newRowHeight = table.getRowHeight(row);
37907
38130
  if (newRowHeight !== (oldRowHeights[row] ?? table.getRowHeight(row))) {
37908
38131
  table.scenegraph.updateRowHeight(row, newRowHeight - (oldRowHeights[row] ?? table.getRowHeight(row)), true);
@@ -42985,9 +43208,12 @@
42985
43208
  if (table.options.groupTitleCustomLayout) {
42986
43209
  customResult = dealWithCustom(table.options.groupTitleCustomLayout, undefined, range.start.col, range.start.row, table.getColsWidth(range.start.col, range.end.col), table.getRowsHeight(range.start.row, range.end.row), false, table.isAutoRowHeight(row), [0, 0, 0, 0], range, table);
42987
43210
  }
42988
- }
42989
- if (vtableMergeName) {
42990
- value = vtableMergeName;
43211
+ if (table.options.groupTitleFieldFormat) {
43212
+ value = table.options.groupTitleFieldFormat(rawRecord, col, row, table);
43213
+ }
43214
+ else if (vtableMergeName) {
43215
+ value = vtableMergeName;
43216
+ }
42991
43217
  }
42992
43218
  }
42993
43219
  const type = isVtableMerge || isCustomMerge
@@ -43189,7 +43415,7 @@
43189
43415
  computeColsWidth(table, 0, distColForCompute ?? distCol);
43190
43416
  }
43191
43417
  if (table.internalProps._heightResizedRowMap.size === 0) {
43192
- computeRowsHeight(table, 0, distRowForCompute ?? distRow);
43418
+ computeRowsHeight(table, 0, table.options.canvasHeight === 'auto' ? table.rowCount - 1 : distRowForCompute ?? distRow);
43193
43419
  }
43194
43420
  if (distCol < table.colCount - table.rightFrozenColCount) {
43195
43421
  computeColsWidth(table, table.colCount - table.rightFrozenColCount, table.colCount - 1);
@@ -44030,7 +44256,6 @@
44030
44256
  [rowStart, rowEnd].forEach((row) => {
44031
44257
  const style = table._getCellStyle(col, row);
44032
44258
  if (style?.textStick &&
44033
- table.internalProps.layoutMap.rowHierarchyType !== 'tree' &&
44034
44259
  style?.textStick !== 'horizontal') {
44035
44260
  const cellGroup = table.scenegraph.getCell(col, row);
44036
44261
  adjustCellContentVerticalLayout(cellGroup, frozenRowsHeight + table.tableY, table.tableNoFrameHeight - table.getBottomFrozenRowsHeight() + table.tableY, changedCells, style?.textStickBaseOnAlign, table);
@@ -50644,7 +50869,7 @@
50644
50869
  const groupKeyLength = dataSource.dataConfig.groupByRules.length + 1;
50645
50870
  dataSource.currentIndexedData.forEach((indexArr, index) => {
50646
50871
  if (isArray$7(indexArr) && indexArr.length === groupKeyLength) {
50647
- const { vtableOriginIndex } = dataSource.getRawRecord(indexArr);
50872
+ const vtableOriginIndex = dataSource.getOriginRecordIndexForGroup(indexArr);
50648
50873
  result[vtableOriginIndex] = table.stateManager.checkedState.get(indexArr.toString());
50649
50874
  }
50650
50875
  });
@@ -57457,32 +57682,14 @@
57457
57682
  if (frozen) {
57458
57683
  return frozen;
57459
57684
  }
57460
- let row = getTargetRowAt(absoluteY, _this);
57461
- if (!row) {
57462
- row = {
57463
- top: -1,
57464
- row: -1,
57465
- bottom: -1,
57466
- height: -1
57467
- };
57468
- }
57469
- return row;
57685
+ return getTargetRowAt(absoluteY, _this) ?? { top: -1, row: -1, bottom: -1, height: -1 };
57470
57686
  }
57471
57687
  function getColAt(absoluteX, _this) {
57472
57688
  const frozen = _getTargetFrozenColAt(_this, absoluteX);
57473
57689
  if (frozen) {
57474
57690
  return frozen;
57475
57691
  }
57476
- let col = getTargetColAt(absoluteX, _this);
57477
- if (!col) {
57478
- col = {
57479
- left: -1,
57480
- col: -1,
57481
- right: -1,
57482
- width: 1
57483
- };
57484
- }
57485
- return col;
57692
+ return getTargetColAt(absoluteX, _this) ?? { left: -1, col: -1, right: -1, width: 1 };
57486
57693
  }
57487
57694
  function getCellAt(absoluteX, absoluteY, _this) {
57488
57695
  const rowInfo = getRowAt(absoluteY, _this);
@@ -58991,7 +59198,7 @@
58991
59198
  return TABLE_EVENT_TYPE;
58992
59199
  }
58993
59200
  options;
58994
- version = "1.15.1-alpha.1";
59201
+ version = "1.15.2-alpha.0";
58995
59202
  pagination;
58996
59203
  id = `VTable${Date.now()}`;
58997
59204
  headerStyleCache;
@@ -59043,8 +59250,8 @@
59043
59250
  }
59044
59251
  this.tableNoFrameWidth = 0;
59045
59252
  this.tableNoFrameHeight = 0;
59046
- this.canvasWidth = canvasWidth;
59047
- this.canvasHeight = canvasHeight;
59253
+ this.canvasWidth = isNumber$4(canvasWidth) ? canvasWidth : undefined;
59254
+ this.canvasHeight = isNumber$4(canvasHeight) ? canvasHeight : undefined;
59048
59255
  this.columnWidthComputeMode = options.columnWidthComputeMode ?? 'normal';
59049
59256
  const internalProps = (this.internalProps = {});
59050
59257
  showFrozenIcon !== undefined && (this.showFrozenIcon = showFrozenIcon);
@@ -59097,11 +59304,12 @@
59097
59304
  this.colWidthsMap = new NumberMap();
59098
59305
  this.colContentWidthsMap = new NumberMap();
59099
59306
  this.colWidthsLimit = {};
59307
+ const that = this;
59100
59308
  internalProps.calcWidthContext = {
59101
59309
  _: internalProps,
59102
59310
  get full() {
59103
59311
  if (Env.mode === 'node') {
59104
- return canvasWidth / (pixelRatio ?? 1);
59312
+ return that.canvasWidth / (pixelRatio ?? 1);
59105
59313
  }
59106
59314
  return this._.canvas.width / (this._.context.pixelRatio ?? window.devicePixelRatio);
59107
59315
  }
@@ -59200,6 +59408,52 @@
59200
59408
  if (CustomCellStylePlugin) {
59201
59409
  this.customCellStylePlugin = new CustomCellStylePlugin(this, options.customCellStyle ?? [], options.customCellStyleArrangement ?? []);
59202
59410
  }
59411
+ this._adjustCanvasSizeByOption();
59412
+ }
59413
+ _adjustCanvasSizeByOption() {
59414
+ if (this.options.canvasHeight === 'auto' || this.options.canvasWidth === 'auto') {
59415
+ setTimeout(() => {
59416
+ let canvasWidth;
59417
+ let canvasHeight;
59418
+ if (this.options.canvasHeight === 'auto') {
59419
+ let borderWidth = 0;
59420
+ if (this.theme.frameStyle?.innerBorder) {
59421
+ const shadowWidths = toBoxArray(this.internalProps.theme.frameStyle?.shadowBlur ?? [0]);
59422
+ borderWidth += shadowWidths[1] ?? 0;
59423
+ }
59424
+ else if (this.theme.frameStyle) {
59425
+ const lineWidths = toBoxArray(this.internalProps.theme.frameStyle?.borderLineWidth ?? [null]);
59426
+ const shadowWidths = toBoxArray(this.internalProps.theme.frameStyle?.shadowBlur ?? [0]);
59427
+ borderWidth +=
59428
+ (lineWidths[0] ?? 0) + (shadowWidths[0] ?? 0) + ((lineWidths[2] ?? 0) + (shadowWidths[2] ?? 0));
59429
+ }
59430
+ canvasHeight =
59431
+ Math.min(this.options.maxCanvasHeight ? this.options.maxCanvasHeight - borderWidth : 20000, this.getAllRowsHeight()) + borderWidth;
59432
+ }
59433
+ else {
59434
+ canvasHeight = this.canvasHeight;
59435
+ }
59436
+ if (this.options.canvasWidth === 'auto') {
59437
+ let borderWidth = 0;
59438
+ if (this.theme.frameStyle?.innerBorder) {
59439
+ const shadowWidths = toBoxArray(this.internalProps.theme.frameStyle?.shadowBlur ?? [0]);
59440
+ borderWidth += shadowWidths[2] ?? 0;
59441
+ }
59442
+ else if (this.theme.frameStyle) {
59443
+ const lineWidths = toBoxArray(this.internalProps.theme.frameStyle?.borderLineWidth ?? [null]);
59444
+ const shadowWidths = toBoxArray(this.internalProps.theme.frameStyle?.shadowBlur ?? [0]);
59445
+ borderWidth +=
59446
+ (lineWidths[1] ?? 0) + (shadowWidths[1] ?? 0) + ((lineWidths[3] ?? 0) + (shadowWidths[3] ?? 0));
59447
+ }
59448
+ canvasWidth =
59449
+ Math.min(this.options.maxCanvasWidth ? this.options.maxCanvasWidth - borderWidth : 20000, this.getAllColsWidth()) + borderWidth;
59450
+ }
59451
+ else {
59452
+ canvasWidth = this.canvasWidth;
59453
+ }
59454
+ this.setCanvasSize(canvasWidth, canvasHeight);
59455
+ }, 0);
59456
+ }
59203
59457
  }
59204
59458
  throttleInvalidate = throttle2(this.render.bind(this), 200);
59205
59459
  getContainer() {
@@ -59492,7 +59746,7 @@
59492
59746
  setPixelRatio(pixelRatio) {
59493
59747
  if (pixelRatio !== this.internalProps.pixelRatio) {
59494
59748
  this.internalProps.pixelRatio = pixelRatio;
59495
- const canvasWidth = this.options.canvasWidth;
59749
+ const canvasWidth = this.canvasWidth;
59496
59750
  this.internalProps.calcWidthContext = {
59497
59751
  _: this.internalProps,
59498
59752
  get full() {
@@ -60348,8 +60602,8 @@
60348
60602
  this.autoFillWidth = autoFillWidth ?? false;
60349
60603
  this.autoFillHeight = autoFillHeight ?? false;
60350
60604
  this.customRender = customRender;
60351
- this.canvasWidth = canvasWidth;
60352
- this.canvasHeight = canvasHeight;
60605
+ this.canvasWidth = isNumber$4(canvasWidth) ? canvasWidth : undefined;
60606
+ this.canvasHeight = isNumber$4(canvasHeight) ? canvasHeight : undefined;
60353
60607
  const internalProps = this.internalProps;
60354
60608
  if (Env.mode !== 'node' && !options.canvas) {
60355
60609
  updateRootElementPadding(internalProps.element, this.padding);
@@ -60464,6 +60718,7 @@
60464
60718
  this.clearRowHeightCache();
60465
60719
  internalProps.customMergeCell = getCustomMergeCellFunc(options.customMergeCell);
60466
60720
  this.customCellStylePlugin?.updateCustomCell(options.customCellStyle ?? [], options.customCellStyleArrangement ?? []);
60721
+ this._adjustCanvasSizeByOption();
60467
60722
  }
60468
60723
  renderWithRecreateCells() {
60469
60724
  const oldHoverState = { col: this.stateManager.hover.cellPos.col, row: this.stateManager.hover.cellPos.row };
@@ -64658,7 +64913,7 @@
64658
64913
  this.isSeriesNumberInBody(source.col, source.row)) {
64659
64914
  const sourceIndex = this.getRecordShowIndexByCell(0, source.row);
64660
64915
  const targetIndex = this.getRecordShowIndexByCell(0, target.row);
64661
- const canMove = this._table.dataSource.isCanExchangeOrder(sourceIndex, targetIndex);
64916
+ const canMove = this._table.dataSource.canChangeOrder(sourceIndex, targetIndex);
64662
64917
  return canMove;
64663
64918
  }
64664
64919
  else if (this.transpose &&
@@ -65356,6 +65611,15 @@
65356
65611
  table.dataSource.addRecordsForGroup?.([record], recordIndex);
65357
65612
  table.refreshRowColCount();
65358
65613
  table.internalProps.layoutMap.clearCellRangeMap();
65614
+ table.sortState && sortRecords(table);
65615
+ table.scenegraph.clearCells();
65616
+ table.scenegraph.createSceneGraph();
65617
+ }
65618
+ else if (table.dataSource.rowHierarchyType === 'tree') {
65619
+ table.dataSource.addRecordsForTree?.([record], recordIndex);
65620
+ table.refreshRowColCount();
65621
+ table.internalProps.layoutMap.clearCellRangeMap();
65622
+ table.sortState && sortRecords(table);
65359
65623
  table.scenegraph.clearCells();
65360
65624
  table.scenegraph.createSceneGraph();
65361
65625
  }
@@ -65367,6 +65631,7 @@
65367
65631
  table.scenegraph.createSceneGraph();
65368
65632
  }
65369
65633
  else {
65634
+ recordIndex = recordIndex;
65370
65635
  if (recordIndex === undefined || recordIndex > table.dataSource.sourceLength) {
65371
65636
  recordIndex = table.dataSource.sourceLength;
65372
65637
  }
@@ -65447,6 +65712,15 @@
65447
65712
  table.dataSource.addRecordsForGroup?.(records, recordIndex);
65448
65713
  table.refreshRowColCount();
65449
65714
  table.internalProps.layoutMap.clearCellRangeMap();
65715
+ table.sortState && sortRecords(table);
65716
+ table.scenegraph.clearCells();
65717
+ table.scenegraph.createSceneGraph();
65718
+ }
65719
+ else if (table.dataSource.rowHierarchyType === 'tree') {
65720
+ table.dataSource.addRecordsForTree?.(records, recordIndex);
65721
+ table.refreshRowColCount();
65722
+ table.internalProps.layoutMap.clearCellRangeMap();
65723
+ table.sortState && sortRecords(table);
65450
65724
  table.scenegraph.clearCells();
65451
65725
  table.scenegraph.createSceneGraph();
65452
65726
  }
@@ -65458,6 +65732,7 @@
65458
65732
  table.scenegraph.createSceneGraph();
65459
65733
  }
65460
65734
  else {
65735
+ recordIndex = recordIndex;
65461
65736
  if (recordIndex === undefined || recordIndex > table.dataSource.sourceLength) {
65462
65737
  recordIndex = table.dataSource.sourceLength;
65463
65738
  }
@@ -65555,6 +65830,15 @@
65555
65830
  table.dataSource.deleteRecordsForGroup?.(recordIndexs);
65556
65831
  table.refreshRowColCount();
65557
65832
  table.internalProps.layoutMap.clearCellRangeMap();
65833
+ table.sortState && sortRecords(table);
65834
+ table.scenegraph.clearCells();
65835
+ table.scenegraph.createSceneGraph();
65836
+ }
65837
+ else if (table.dataSource.rowHierarchyType === 'tree') {
65838
+ table.dataSource.deleteRecordsForTree?.(recordIndexs);
65839
+ table.refreshRowColCount();
65840
+ table.internalProps.layoutMap.clearCellRangeMap();
65841
+ table.sortState && sortRecords(table);
65558
65842
  table.scenegraph.clearCells();
65559
65843
  table.scenegraph.createSceneGraph();
65560
65844
  }
@@ -65674,6 +65958,15 @@
65674
65958
  table.dataSource.updateRecordsForGroup?.(records, recordIndexs);
65675
65959
  table.refreshRowColCount();
65676
65960
  table.internalProps.layoutMap.clearCellRangeMap();
65961
+ table.sortState && sortRecords(table);
65962
+ table.scenegraph.clearCells();
65963
+ table.scenegraph.createSceneGraph();
65964
+ }
65965
+ else if (table.dataSource.rowHierarchyType === 'tree') {
65966
+ table.dataSource.updateRecordsForTree?.(records, recordIndexs);
65967
+ table.refreshRowColCount();
65968
+ table.internalProps.layoutMap.clearCellRangeMap();
65969
+ table.sortState && sortRecords(table);
65677
65970
  table.scenegraph.clearCells();
65678
65971
  table.scenegraph.createSceneGraph();
65679
65972
  }
@@ -65877,7 +66170,7 @@
65877
66170
  this.refreshHeader();
65878
66171
  this.internalProps.useOneRowHeightFillAll = false;
65879
66172
  if (options.dataSource) {
65880
- _setDataSource(this, options.dataSource);
66173
+ this.dataSource = options.dataSource;
65881
66174
  }
65882
66175
  else if (options.records) {
65883
66176
  this.setRecords(options.records, { sortState: internalProps.sortState });
@@ -65999,8 +66292,7 @@
65999
66292
  if (record?.vtableMerge) {
66000
66293
  return '';
66001
66294
  }
66002
- const indexs = this.dataSource.currentIndexedData[row - this.columnHeaderLevelCount];
66003
- value = indexs[indexs.length - 1] + 1;
66295
+ value = this.dataSource.getGroupSeriesNumber(row - this.columnHeaderLevelCount);
66004
66296
  }
66005
66297
  else {
66006
66298
  value = row - this.columnHeaderLevelCount + 1;
@@ -66074,7 +66366,7 @@
66074
66366
  getRecordIndexByCell(col, row) {
66075
66367
  const { layoutMap } = this.internalProps;
66076
66368
  const recordShowIndex = layoutMap.getRecordShowIndexByCell(col, row);
66077
- return this.dataSource.currentPagerIndexedData[recordShowIndex];
66369
+ return this.dataSource.getRecordIndexPaths(recordShowIndex);
66078
66370
  }
66079
66371
  getTableIndexByRecordIndex(recordIndex) {
66080
66372
  if (this.transpose) {
@@ -66156,7 +66448,7 @@
66156
66448
  internalProps.releaseList = null;
66157
66449
  }
66158
66450
  if (options.dataSource) {
66159
- _setDataSource(this, options.dataSource);
66451
+ this.dataSource = options.dataSource;
66160
66452
  }
66161
66453
  else if (options.records) {
66162
66454
  this.setRecords(options.records, {
@@ -66306,7 +66598,7 @@
66306
66598
  sourceIndex = this.getRecordShowIndexByCell(0, sourceIndex);
66307
66599
  targetIndex = this.getRecordShowIndexByCell(0, targetIndex);
66308
66600
  }
66309
- this.dataSource.reorderRecord(sourceIndex, targetIndex);
66601
+ this.dataSource.changeOrder(sourceIndex, targetIndex);
66310
66602
  }
66311
66603
  getCellAddress(findTargetRecord, field) {
66312
66604
  let targetRecordIndex;
@@ -66510,7 +66802,7 @@
66510
66802
  return {
66511
66803
  field: item.field,
66512
66804
  order: item.order,
66513
- orderFn: sortFunc
66805
+ orderFn: sortFunc ?? defaultOrderFn
66514
66806
  };
66515
66807
  }));
66516
66808
  this.internalProps.layoutMap.clearCellRangeMap();
@@ -68710,22 +69002,7 @@
68710
69002
  if (!this._emptyTipComponent) {
68711
69003
  return;
68712
69004
  }
68713
- const leftHeaderWidth = this.table.transpose || this.table.options.indicatorsAsCol === false
68714
- ? this.table.getFrozenColsWidth()
68715
- : 0;
68716
- const topHeaderHeight = !this.table.transpose || this.table.options.indicatorsAsCol
68717
- ? this.table.getFrozenRowsHeight()
68718
- : 0;
68719
- const width = (this.table.columnHeaderLevelCount > 0 && this.table.isListTable()
68720
- ? this.table.getDrawRange().width
68721
- : this.table.tableNoFrameWidth) -
68722
- leftHeaderWidth -
68723
- this.table.getTheme().scrollStyle.width;
68724
- const height = (this.table.rowHeaderLevelCount > 0 && this.table.isListTable()
68725
- ? this.table.getDrawRange().height
68726
- : this.table.tableNoFrameHeight) -
68727
- topHeaderHeight -
68728
- this.table.getTheme().scrollStyle.width;
69005
+ const { leftHeaderWidth, topHeaderHeight, width, height } = this.getWidthAndHeight();
68729
69006
  this._emptyTipComponent.setAttributes({
68730
69007
  spaceBetweenTextAndIcon: this._emptyTipOption.spaceBetweenTextAndIcon,
68731
69008
  x: this.table.tableX + leftHeaderWidth,
@@ -68761,7 +69038,7 @@
68761
69038
  }
68762
69039
  }
68763
69040
  }
68764
- _getEmptyTipAttrs() {
69041
+ getWidthAndHeight() {
68765
69042
  const leftHeaderWidth = this.table.transpose || this.table.options.indicatorsAsCol === false
68766
69043
  ? this.table.getFrozenColsWidth()
68767
69044
  : 0;
@@ -68782,6 +69059,15 @@
68782
69059
  : this.table.tableNoFrameHeight) -
68783
69060
  topHeaderHeight -
68784
69061
  this.table.getTheme().scrollStyle.width;
69062
+ return {
69063
+ leftHeaderWidth,
69064
+ topHeaderHeight,
69065
+ width,
69066
+ height
69067
+ };
69068
+ }
69069
+ _getEmptyTipAttrs() {
69070
+ const { leftHeaderWidth, topHeaderHeight, width, height } = this.getWidthAndHeight();
68785
69071
  return {
68786
69072
  spaceBetweenTextAndIcon: this._emptyTipOption.spaceBetweenTextAndIcon,
68787
69073
  x: this.table.tableX + leftHeaderWidth,
@@ -80518,7 +80804,7 @@
80518
80804
  }
80519
80805
 
80520
80806
  registerForVrender();
80521
- const version = "1.15.1-alpha.1";
80807
+ const version = "1.15.2-alpha.0";
80522
80808
  function getIcons() {
80523
80809
  return get$2();
80524
80810
  }