@visactor/vtable 0.15.5 → 0.16.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 (123) hide show
  1. package/cjs/ListTable.d.ts +5 -2
  2. package/cjs/ListTable.js +161 -16
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/PivotChart.d.ts +1 -1
  5. package/cjs/PivotChart.js +1 -1
  6. package/cjs/PivotChart.js.map +1 -1
  7. package/cjs/PivotTable.d.ts +1 -1
  8. package/cjs/PivotTable.js +1 -1
  9. package/cjs/PivotTable.js.map +1 -1
  10. package/cjs/components/menu/dom/logic/MenuElement.js +3 -3
  11. package/cjs/components/menu/dom/logic/MenuElement.js.map +1 -1
  12. package/cjs/core/BaseTable.d.ts +1 -1
  13. package/cjs/core/BaseTable.js +4 -4
  14. package/cjs/core/BaseTable.js.map +1 -1
  15. package/cjs/core/tableHelper.d.ts +2 -0
  16. package/cjs/core/tableHelper.js +18 -3
  17. package/cjs/core/tableHelper.js.map +1 -1
  18. package/cjs/data/DataSource.d.ts +8 -1
  19. package/cjs/data/DataSource.js +59 -2
  20. package/cjs/data/DataSource.js.map +1 -1
  21. package/cjs/index.d.ts +1 -1
  22. package/cjs/index.js +1 -1
  23. package/cjs/index.js.map +1 -1
  24. package/cjs/scenegraph/group-creater/column.d.ts +0 -4
  25. package/cjs/scenegraph/group-creater/column.js +1 -19
  26. package/cjs/scenegraph/group-creater/column.js.map +1 -1
  27. package/cjs/scenegraph/group-creater/progress/proxy.d.ts +2 -0
  28. package/cjs/scenegraph/group-creater/progress/proxy.js +15 -1
  29. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  30. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +4 -0
  31. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
  32. package/cjs/scenegraph/layout/auto-height.d.ts +1 -2
  33. package/cjs/scenegraph/layout/auto-height.js +1 -36
  34. package/cjs/scenegraph/layout/auto-height.js.map +1 -1
  35. package/cjs/scenegraph/layout/compute-col-width.js +1 -1
  36. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  37. package/cjs/scenegraph/layout/update-col.d.ts +3 -0
  38. package/cjs/scenegraph/layout/update-col.js +203 -0
  39. package/cjs/scenegraph/layout/update-col.js.map +1 -0
  40. package/cjs/scenegraph/layout/update-height.js +1 -1
  41. package/cjs/scenegraph/layout/update-height.js.map +1 -1
  42. package/cjs/scenegraph/layout/update-row.js +94 -49
  43. package/cjs/scenegraph/layout/update-row.js.map +1 -1
  44. package/cjs/scenegraph/scenegraph.d.ts +5 -0
  45. package/cjs/scenegraph/scenegraph.js +24 -3
  46. package/cjs/scenegraph/scenegraph.js.map +1 -1
  47. package/cjs/scenegraph/utils/get-hierarchy-offset.js +1 -1
  48. package/cjs/scenegraph/utils/get-hierarchy-offset.js.map +1 -1
  49. package/cjs/state/resize/update-resize-column.js +1 -1
  50. package/cjs/state/resize/update-resize-column.js.map +1 -1
  51. package/cjs/state/state.d.ts +2 -0
  52. package/cjs/state/state.js +47 -2
  53. package/cjs/state/state.js.map +1 -1
  54. package/cjs/themes/DARK.js.map +1 -1
  55. package/cjs/tools/diff-cell.js +1 -1
  56. package/cjs/tools/diff-cell.js.map +1 -1
  57. package/cjs/ts-types/base-table.d.ts +1 -1
  58. package/cjs/ts-types/base-table.js.map +1 -1
  59. package/cjs/ts-types/table-engine.d.ts +3 -0
  60. package/cjs/ts-types/table-engine.js.map +1 -1
  61. package/dist/vtable.js +979 -116
  62. package/dist/vtable.min.js +2 -2
  63. package/es/ListTable.d.ts +5 -2
  64. package/es/ListTable.js +161 -17
  65. package/es/ListTable.js.map +1 -1
  66. package/es/PivotChart.d.ts +1 -1
  67. package/es/PivotChart.js +1 -1
  68. package/es/PivotChart.js.map +1 -1
  69. package/es/PivotTable.d.ts +1 -1
  70. package/es/PivotTable.js +1 -1
  71. package/es/PivotTable.js.map +1 -1
  72. package/es/components/menu/dom/logic/MenuElement.js +3 -3
  73. package/es/components/menu/dom/logic/MenuElement.js.map +1 -1
  74. package/es/core/BaseTable.d.ts +1 -1
  75. package/es/core/BaseTable.js +4 -4
  76. package/es/core/BaseTable.js.map +1 -1
  77. package/es/core/tableHelper.d.ts +2 -0
  78. package/es/core/tableHelper.js +16 -0
  79. package/es/core/tableHelper.js.map +1 -1
  80. package/es/data/DataSource.d.ts +8 -1
  81. package/es/data/DataSource.js +59 -2
  82. package/es/data/DataSource.js.map +1 -1
  83. package/es/index.d.ts +1 -1
  84. package/es/index.js +1 -1
  85. package/es/index.js.map +1 -1
  86. package/es/scenegraph/group-creater/column.d.ts +0 -4
  87. package/es/scenegraph/group-creater/column.js +0 -16
  88. package/es/scenegraph/group-creater/column.js.map +1 -1
  89. package/es/scenegraph/group-creater/progress/proxy.d.ts +2 -0
  90. package/es/scenegraph/group-creater/progress/proxy.js +14 -0
  91. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  92. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +4 -0
  93. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
  94. package/es/scenegraph/layout/auto-height.d.ts +1 -2
  95. package/es/scenegraph/layout/auto-height.js +0 -33
  96. package/es/scenegraph/layout/auto-height.js.map +1 -1
  97. package/es/scenegraph/layout/compute-col-width.js +1 -1
  98. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  99. package/es/scenegraph/layout/update-col.d.ts +3 -0
  100. package/es/scenegraph/layout/update-col.js +200 -0
  101. package/es/scenegraph/layout/update-col.js.map +1 -0
  102. package/es/scenegraph/layout/update-height.js +1 -1
  103. package/es/scenegraph/layout/update-height.js.map +1 -1
  104. package/es/scenegraph/layout/update-row.js +94 -49
  105. package/es/scenegraph/layout/update-row.js.map +1 -1
  106. package/es/scenegraph/scenegraph.d.ts +5 -0
  107. package/es/scenegraph/scenegraph.js +25 -2
  108. package/es/scenegraph/scenegraph.js.map +1 -1
  109. package/es/scenegraph/utils/get-hierarchy-offset.js +1 -1
  110. package/es/scenegraph/utils/get-hierarchy-offset.js.map +1 -1
  111. package/es/state/resize/update-resize-column.js +1 -1
  112. package/es/state/resize/update-resize-column.js.map +1 -1
  113. package/es/state/state.d.ts +2 -0
  114. package/es/state/state.js +47 -2
  115. package/es/state/state.js.map +1 -1
  116. package/es/themes/DARK.js.map +1 -1
  117. package/es/tools/diff-cell.js +1 -1
  118. package/es/tools/diff-cell.js.map +1 -1
  119. package/es/ts-types/base-table.d.ts +1 -1
  120. package/es/ts-types/base-table.js.map +1 -1
  121. package/es/ts-types/table-engine.d.ts +3 -0
  122. package/es/ts-types/table-engine.js.map +1 -1
  123. package/package.json +4 -4
package/es/ListTable.d.ts CHANGED
@@ -23,7 +23,7 @@ export declare class ListTable extends BaseTable implements ListTableAPI {
23
23
  getCellValue(col: number, row: number): FieldData;
24
24
  getCellOriginValue(col: number, row: number): FieldData;
25
25
  getCellRawValue(col: number, row: number): FieldData;
26
- getRecordIndexByCell(col: number, row: number): number;
26
+ getRecordShowIndexByCell(col: number, row: number): number;
27
27
  getTableIndexByRecordIndex(recordIndex: number): number;
28
28
  getTableIndexByField(field: FieldDef): number;
29
29
  getCellAddrByFieldRecord(field: FieldDef, recordIndex: number): CellAddress;
@@ -44,7 +44,7 @@ export declare class ListTable extends BaseTable implements ListTableAPI {
44
44
  _refreshHierarchyState(col: number, row: number): void;
45
45
  _hasHierarchyTreeHeader(): boolean;
46
46
  getMenuInfo(col: number, row: number, type: string): DropDownMenuEventInfo;
47
- protected _getSortFuncFromHeaderOption(columns: ColumnsDefine | undefined, field: FieldDef, fieldKey?: FieldKeyDef): ((v1: any, v2: any, order: SortOrder) => 0 | 1 | -1) | undefined;
47
+ _getSortFuncFromHeaderOption(columns: ColumnsDefine | undefined, field: FieldDef, fieldKey?: FieldKeyDef): ((v1: any, v2: any, order: SortOrder) => 0 | 1 | -1) | undefined;
48
48
  updateSortState(sortState: SortState[] | SortState | null, executeSort?: boolean): void;
49
49
  getCheckboxState(field?: string | number): boolean[] | Record<string | number, boolean>[];
50
50
  getCellCheckboxState(col: number, row: number): boolean;
@@ -54,4 +54,7 @@ export declare class ListTable extends BaseTable implements ListTableAPI {
54
54
  completeEditCell(): void;
55
55
  getEditor(col: number, row: number): IEditor;
56
56
  changeCellValue(col: number, row: number, value: string | number | null): void;
57
+ addRecord(record: any, recordIndex?: number): void;
58
+ addRecords(records: any[], recordIndex?: number): void;
59
+ deleteRecords(recordIndexs: number[]): void;
57
60
  }
package/es/ListTable.js CHANGED
@@ -4,7 +4,7 @@ import { SimpleHeaderLayoutMap } from "./layout";
4
4
 
5
5
  import { isValid } from "@visactor/vutils";
6
6
 
7
- import { _setDataSource, _setRecords } from "./core/tableHelper";
7
+ import { _setDataSource, _setRecords, sortRecords } from "./core/tableHelper";
8
8
 
9
9
  import { BaseTable } from "./core";
10
10
 
@@ -117,7 +117,7 @@ export class ListTable extends BaseTable {
117
117
  const {field: field} = table.internalProps.layoutMap.getBody(col, row);
118
118
  return table.getRawFieldData(field, col, row);
119
119
  }
120
- getRecordIndexByCell(col, row) {
120
+ getRecordShowIndexByCell(col, row) {
121
121
  const {layoutMap: layoutMap} = this.internalProps;
122
122
  return layoutMap.getRecordIndexByCell(col, row);
123
123
  }
@@ -138,11 +138,11 @@ export class ListTable extends BaseTable {
138
138
  };
139
139
  }
140
140
  getCellOriginRecord(col, row) {
141
- const table = this, index = table.getRecordIndexByCell(col, row);
141
+ const table = this, index = table.getRecordShowIndexByCell(col, row);
142
142
  if (index > -1) return table.dataSource.get(index);
143
143
  }
144
144
  getCellRawRecord(col, row) {
145
- const table = this, index = table.getRecordIndexByCell(col, row);
145
+ const table = this, index = table.getRecordShowIndexByCell(col, row);
146
146
  if (index > -1) return table.dataSource.getRaw(index);
147
147
  }
148
148
  _canResizeColumn(col, row) {
@@ -188,29 +188,30 @@ export class ListTable extends BaseTable {
188
188
  this.refreshRowColCount();
189
189
  }
190
190
  refreshRowColCount() {
191
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
191
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
192
192
  const table = this, {layoutMap: layoutMap} = table.internalProps;
193
193
  layoutMap && (layoutMap.recordsCount = null !== (_b = null === (_a = table.internalProps.dataSource) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0,
194
194
  table.transpose ? (table.rowCount = null !== (_c = layoutMap.rowCount) && void 0 !== _c ? _c : 0,
195
195
  table.colCount = (null !== (_e = null === (_d = table.internalProps.dataSource) || void 0 === _d ? void 0 : _d.length) && void 0 !== _e ? _e : 0) * layoutMap.bodyRowSpanCount + layoutMap.headerLevelCount,
196
196
  table.frozenRowCount = 0, this.internalProps.frozenColCount = null !== (_f = layoutMap.headerLevelCount) && void 0 !== _f ? _f : 0,
197
- table.rightFrozenColCount !== (null !== (_g = this.options.rightFrozenColCount) && void 0 !== _g ? _g : 0) && (table.rightFrozenColCount = null !== (_h = this.options.rightFrozenColCount) && void 0 !== _h ? _h : 0)) : (table.colCount = null !== (_j = layoutMap.colCount) && void 0 !== _j ? _j : 0,
198
- table.rowCount = (null !== (_l = null === (_k = table.internalProps.dataSource) || void 0 === _k ? void 0 : _k.length) && void 0 !== _l ? _l : 0) * layoutMap.bodyRowSpanCount + layoutMap.headerLevelCount,
199
- this.internalProps.frozenColCount = null !== (_m = this.options.frozenColCount) && void 0 !== _m ? _m : 0,
200
- table.frozenRowCount = layoutMap.headerLevelCount, table.bottomFrozenRowCount !== (null !== (_o = this.options.bottomFrozenRowCount) && void 0 !== _o ? _o : 0) && (table.bottomFrozenRowCount = null !== (_p = this.options.bottomFrozenRowCount) && void 0 !== _p ? _p : 0),
201
- table.rightFrozenColCount !== (null !== (_q = this.options.rightFrozenColCount) && void 0 !== _q ? _q : 0) && (table.rightFrozenColCount = null !== (_r = this.options.rightFrozenColCount) && void 0 !== _r ? _r : 0)),
197
+ table.bottomFrozenRowCount !== (null !== (_g = this.options.bottomFrozenRowCount) && void 0 !== _g ? _g : 0) && (table.bottomFrozenRowCount = null !== (_h = this.options.bottomFrozenRowCount) && void 0 !== _h ? _h : 0),
198
+ table.rightFrozenColCount !== (null !== (_j = this.options.rightFrozenColCount) && void 0 !== _j ? _j : 0) && (table.rightFrozenColCount = null !== (_k = this.options.rightFrozenColCount) && void 0 !== _k ? _k : 0)) : (table.colCount = null !== (_l = layoutMap.colCount) && void 0 !== _l ? _l : 0,
199
+ table.rowCount = (null !== (_o = null === (_m = table.internalProps.dataSource) || void 0 === _m ? void 0 : _m.length) && void 0 !== _o ? _o : 0) * layoutMap.bodyRowSpanCount + layoutMap.headerLevelCount,
200
+ this.internalProps.frozenColCount = null !== (_p = this.options.frozenColCount) && void 0 !== _p ? _p : 0,
201
+ table.frozenRowCount = layoutMap.headerLevelCount, table.bottomFrozenRowCount !== (null !== (_q = this.options.bottomFrozenRowCount) && void 0 !== _q ? _q : 0) && (table.bottomFrozenRowCount = null !== (_r = this.options.bottomFrozenRowCount) && void 0 !== _r ? _r : 0),
202
+ table.rightFrozenColCount !== (null !== (_s = this.options.rightFrozenColCount) && void 0 !== _s ? _s : 0) && (table.rightFrozenColCount = null !== (_t = this.options.rightFrozenColCount) && void 0 !== _t ? _t : 0)),
202
203
  this.stateManager.setFrozenCol(this.internalProps.frozenColCount));
203
204
  }
204
205
  getFieldData(field, col, row) {
205
206
  if (null === field) return null;
206
207
  if (this.internalProps.layoutMap.isHeader(col, row)) return null;
207
- const index = this.getRecordIndexByCell(col, row);
208
+ const index = this.getRecordShowIndexByCell(col, row);
208
209
  return this.internalProps.dataSource.getField(index, field, col, row, this);
209
210
  }
210
211
  getRawFieldData(field, col, row) {
211
212
  if (null === field) return null;
212
213
  if (this.internalProps.layoutMap.isHeader(col, row)) return null;
213
- const index = this.getRecordIndexByCell(col, row);
214
+ const index = this.getRecordShowIndexByCell(col, row);
214
215
  return this.internalProps.dataSource.getRawField(index, field, col, row, this);
215
216
  }
216
217
  moveHeaderPosition(source, target) {
@@ -287,7 +288,7 @@ export class ListTable extends BaseTable {
287
288
  }
288
289
  getHierarchyState(col, row) {
289
290
  if (!this.getBodyColumnDefine(col, row).tree) return HierarchyState.none;
290
- const index = this.getRecordIndexByCell(col, row);
291
+ const index = this.getRecordShowIndexByCell(col, row);
291
292
  return this.dataSource.getHierarchyState(index);
292
293
  }
293
294
  toggleHierarchyState(col, row) {
@@ -308,7 +309,7 @@ export class ListTable extends BaseTable {
308
309
  }
309
310
  }
310
311
  _refreshHierarchyState(col, row) {
311
- const index = this.getRecordIndexByCell(col, row), diffDataIndices = this.dataSource.toggleHierarchyState(index), diffPositions = this.internalProps.layoutMap.toggleHierarchyState(diffDataIndices);
312
+ const index = this.getRecordShowIndexByCell(col, row), diffDataIndices = this.dataSource.toggleHierarchyState(index), diffPositions = this.internalProps.layoutMap.toggleHierarchyState(diffDataIndices);
312
313
  this.refreshRowColCount(), this.clearCellStyleCache(), this.scenegraph.updateHierarchyIcon(col, row),
313
314
  this.scenegraph.updateRow(diffPositions.removeCellPositions, diffPositions.addCellPositions);
314
315
  }
@@ -356,7 +357,7 @@ export class ListTable extends BaseTable {
356
357
  getCellCheckboxState(col, row) {
357
358
  const define = this.getBodyColumnDefine(col, row), field = null == define ? void 0 : define.field, cellType = null == define ? void 0 : define.cellType;
358
359
  if (isValid(field) && "checkbox" === cellType) {
359
- const dataIndex = this.dataSource.getIndexKey(this.getRecordIndexByCell(col, row));
360
+ const dataIndex = this.dataSource.getIndexKey(this.getRecordShowIndexByCell(col, row));
360
361
  return this.stateManager.checkedState[dataIndex][field];
361
362
  }
362
363
  }
@@ -388,7 +389,7 @@ export class ListTable extends BaseTable {
388
389
  setRecordChildren(records, col, row) {
389
390
  const record = this.getCellOriginRecord(col, row);
390
391
  record.children = records;
391
- const index = this.getRecordIndexByCell(col, row);
392
+ const index = this.getRecordShowIndexByCell(col, row);
392
393
  this.dataSource.setRecord(record, index), this._refreshHierarchyState(col, row);
393
394
  }
394
395
  startEditCell(col, row) {
@@ -417,7 +418,7 @@ export class ListTable extends BaseTable {
417
418
  return "string" == typeof editorDefine ? editors.get(editorDefine) : editorDefine;
418
419
  }
419
420
  changeCellValue(col, row, value) {
420
- const recordIndex = this.getRecordIndexByCell(col, row), {field: field} = this.internalProps.layoutMap.getBody(col, row);
421
+ const recordIndex = this.getRecordShowIndexByCell(col, row), {field: field} = this.internalProps.layoutMap.getBody(col, row);
421
422
  if (this.dataSource.changeFieldValue(value, recordIndex, field, col, row, this),
422
423
  this.scenegraph.updateCellContent(col, row), "adaptive" === this.widthMode || this.autoFillWidth && this.getAllColsWidth() <= this.tableNoFrameWidth) 0 === this.internalProps._widthResizedColMap.size && this.scenegraph.recalculateColWidths(); else if (!this.internalProps._widthResizedColMap.has(col)) {
423
424
  const oldWidth = this.getColWidth(col), newWidth = computeColWidth(col, 0, this.rowCount - 1, this, !1);
@@ -434,4 +435,147 @@ export class ListTable extends BaseTable {
434
435
  changedValue: this.getCellOriginValue(col, row)
435
436
  }), this.scenegraph.updateNextFrame();
436
437
  }
438
+ addRecord(record, recordIndex) {
439
+ if (this.sortState) this.dataSource.addRecordForSorted(record), sortRecords(this),
440
+ this.refreshRowColCount(), this.scenegraph.clearCells(), this.scenegraph.createSceneGraph(); else {
441
+ (void 0 === recordIndex || recordIndex > this.dataSource.sourceLength) && (recordIndex = this.dataSource.sourceLength);
442
+ const headerCount = this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount;
443
+ this.dataSource.addRecord(record, recordIndex);
444
+ const oldRowCount = this.rowCount;
445
+ this.refreshRowColCount();
446
+ const newRowCount = this.transpose ? this.colCount : this.rowCount;
447
+ if (this.pagination) {
448
+ const {perPageCount: perPageCount, currentPage: currentPage} = this.pagination, endIndex = perPageCount * (currentPage || 0) + perPageCount;
449
+ if (recordIndex < endIndex) if (recordIndex < endIndex - perPageCount) this.scenegraph.clearCells(),
450
+ this.scenegraph.createSceneGraph(); else {
451
+ const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
452
+ if (oldRowCount - headerCount === this.pagination.perPageCount) {
453
+ const updateRows = [];
454
+ for (let row = rowNum; row < newRowCount; row++) this.transpose ? updateRows.push({
455
+ col: row,
456
+ row: 0
457
+ }) : updateRows.push({
458
+ col: 0,
459
+ row: row
460
+ });
461
+ this.transpose ? this.scenegraph.updateCol([], [], updateRows) : this.scenegraph.updateRow([], [], updateRows);
462
+ } else {
463
+ const addRows = [];
464
+ for (let row = rowNum; row < Math.min(newRowCount, rowNum + 1); row++) this.transpose ? addRows.push({
465
+ col: row,
466
+ row: 0
467
+ }) : addRows.push({
468
+ col: 0,
469
+ row: row
470
+ });
471
+ this.transpose ? this.scenegraph.updateCol([], addRows, []) : this.scenegraph.updateRow([], addRows, []);
472
+ }
473
+ }
474
+ } else {
475
+ const addRows = [];
476
+ for (let row = recordIndex + headerCount; row < recordIndex + headerCount + 1; row++) this.transpose ? addRows.push({
477
+ col: row,
478
+ row: 0
479
+ }) : addRows.push({
480
+ col: 0,
481
+ row: row
482
+ });
483
+ this.transpose ? this.scenegraph.updateCol([], addRows, []) : this.scenegraph.updateRow([], addRows, []);
484
+ }
485
+ }
486
+ }
487
+ addRecords(records, recordIndex) {
488
+ if (this.sortState) this.dataSource.addRecordsForSorted(records), sortRecords(this),
489
+ this.refreshRowColCount(), this.scenegraph.clearCells(), this.scenegraph.createSceneGraph(); else {
490
+ void 0 === recordIndex || recordIndex > this.dataSource.sourceLength ? recordIndex = this.dataSource.sourceLength : recordIndex < 0 && (recordIndex = 0);
491
+ const headerCount = this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount;
492
+ this.dataSource.addRecords(records, recordIndex);
493
+ const oldRowCount = this.transpose ? this.colCount : this.rowCount;
494
+ this.refreshRowColCount();
495
+ const newRowCount = this.transpose ? this.colCount : this.rowCount;
496
+ if (this.pagination) {
497
+ const {perPageCount: perPageCount, currentPage: currentPage} = this.pagination, endIndex = perPageCount * (currentPage || 0) + perPageCount;
498
+ if (recordIndex < endIndex) if (recordIndex < endIndex - perPageCount) this.scenegraph.clearCells(),
499
+ this.scenegraph.createSceneGraph(); else {
500
+ const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
501
+ if (oldRowCount - headerCount === this.pagination.perPageCount) {
502
+ const updateRows = [];
503
+ for (let row = rowNum; row < newRowCount; row++) this.transpose ? updateRows.push({
504
+ col: row,
505
+ row: 0
506
+ }) : updateRows.push({
507
+ col: 0,
508
+ row: row
509
+ });
510
+ this.transpose ? this.scenegraph.updateCol([], [], updateRows) : this.scenegraph.updateRow([], [], updateRows);
511
+ } else {
512
+ const addRows = [];
513
+ for (let row = rowNum; row < Math.min(newRowCount, rowNum + (Array.isArray(records) ? records.length : 1)); row++) this.transpose ? addRows.push({
514
+ col: row,
515
+ row: 0
516
+ }) : addRows.push({
517
+ col: 0,
518
+ row: row
519
+ });
520
+ this.transpose ? this.scenegraph.updateCol([], addRows, []) : this.scenegraph.updateRow([], addRows, []);
521
+ }
522
+ }
523
+ } else {
524
+ const addRows = [];
525
+ for (let row = recordIndex + headerCount; row < recordIndex + headerCount + (Array.isArray(records) ? records.length : 1); row++) this.transpose ? addRows.push({
526
+ col: row,
527
+ row: 0
528
+ }) : addRows.push({
529
+ col: 0,
530
+ row: row
531
+ });
532
+ this.transpose ? this.scenegraph.updateCol([], addRows, []) : this.scenegraph.updateRow([], addRows, []);
533
+ }
534
+ }
535
+ }
536
+ deleteRecords(recordIndexs) {
537
+ if ((null == recordIndexs ? void 0 : recordIndexs.length) > 0) if (this.sortState) this.dataSource.deleteRecordsForSorted(recordIndexs),
538
+ sortRecords(this), this.refreshRowColCount(), this.scenegraph.clearCells(), this.scenegraph.createSceneGraph(); else {
539
+ const deletedRecordIndexs = this.dataSource.deleteRecords(recordIndexs);
540
+ if (0 === deletedRecordIndexs.length) return;
541
+ const oldRowCount = this.transpose ? this.colCount : this.rowCount;
542
+ this.refreshRowColCount();
543
+ const newRowCount = this.transpose ? this.colCount : this.rowCount, recordIndexsMinToMax = deletedRecordIndexs.sort(((a, b) => a - b)), minRecordIndex = recordIndexsMinToMax[0];
544
+ if (this.pagination) {
545
+ const {perPageCount: perPageCount, currentPage: currentPage} = this.pagination, endIndex = perPageCount * (currentPage || 0) + perPageCount;
546
+ if (minRecordIndex < endIndex) if (minRecordIndex < endIndex - perPageCount) this.scenegraph.clearCells(),
547
+ this.scenegraph.createSceneGraph(); else {
548
+ const updateRows = [], delRows = [];
549
+ for (let row = minRecordIndex - (endIndex - perPageCount) + (this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount); row < newRowCount; row++) this.transpose ? updateRows.push({
550
+ col: row,
551
+ row: 0
552
+ }) : updateRows.push({
553
+ col: 0,
554
+ row: row
555
+ });
556
+ if (newRowCount < oldRowCount) for (let row = newRowCount; row < oldRowCount; row++) this.transpose ? delRows.push({
557
+ col: row,
558
+ row: 0
559
+ }) : delRows.push({
560
+ col: 0,
561
+ row: row
562
+ });
563
+ this.transpose ? this.scenegraph.updateCol(delRows, [], updateRows) : this.scenegraph.updateRow(delRows, [], updateRows);
564
+ }
565
+ } else {
566
+ const delRows = [];
567
+ for (let index = 0; index < recordIndexsMinToMax.length; index++) {
568
+ const rowNum = recordIndexsMinToMax[index] + (this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount);
569
+ this.transpose ? delRows.push({
570
+ col: rowNum,
571
+ row: 0
572
+ }) : delRows.push({
573
+ col: 0,
574
+ row: rowNum
575
+ });
576
+ }
577
+ this.transpose ? this.scenegraph.updateCol(delRows, [], []) : this.scenegraph.updateRow(delRows, [], []);
578
+ }
579
+ }
580
+ }
437
581
  }