@visactor/vtable 0.15.5 → 0.16.1
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.
- package/cjs/ListTable.d.ts +5 -2
- package/cjs/ListTable.js +161 -16
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.d.ts +1 -1
- package/cjs/PivotChart.js +1 -1
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.d.ts +1 -1
- package/cjs/PivotTable.js +1 -1
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/components/menu/dom/logic/MenuElement.js +3 -3
- package/cjs/components/menu/dom/logic/MenuElement.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +1 -1
- package/cjs/core/BaseTable.js +4 -4
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/tableHelper.d.ts +2 -0
- package/cjs/core/tableHelper.js +18 -3
- package/cjs/core/tableHelper.js.map +1 -1
- package/cjs/data/DataSource.d.ts +8 -1
- package/cjs/data/DataSource.js +59 -2
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/scenegraph/group-creater/column.d.ts +0 -4
- package/cjs/scenegraph/group-creater/column.js +1 -19
- package/cjs/scenegraph/group-creater/column.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.d.ts +2 -0
- package/cjs/scenegraph/group-creater/progress/proxy.js +17 -3
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +4 -0
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
- package/cjs/scenegraph/layout/auto-height.d.ts +1 -2
- package/cjs/scenegraph/layout/auto-height.js +1 -36
- package/cjs/scenegraph/layout/auto-height.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/update-col.d.ts +3 -0
- package/cjs/scenegraph/layout/update-col.js +203 -0
- package/cjs/scenegraph/layout/update-col.js.map +1 -0
- package/cjs/scenegraph/layout/update-height.js +1 -1
- package/cjs/scenegraph/layout/update-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-row.js +94 -49
- package/cjs/scenegraph/layout/update-row.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +5 -0
- package/cjs/scenegraph/scenegraph.js +24 -3
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/utils/get-hierarchy-offset.js +1 -1
- package/cjs/scenegraph/utils/get-hierarchy-offset.js.map +1 -1
- package/cjs/state/resize/update-resize-column.js +1 -1
- package/cjs/state/resize/update-resize-column.js.map +1 -1
- package/cjs/state/state.d.ts +2 -0
- package/cjs/state/state.js +47 -2
- package/cjs/state/state.js.map +1 -1
- package/cjs/themes/DARK.js.map +1 -1
- package/cjs/tools/diff-cell.js +1 -1
- package/cjs/tools/diff-cell.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +1 -1
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +3 -0
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/dist/vtable.js +981 -118
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +5 -2
- package/es/ListTable.js +161 -17
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.d.ts +1 -1
- package/es/PivotChart.js +1 -1
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.d.ts +1 -1
- package/es/PivotTable.js +1 -1
- package/es/PivotTable.js.map +1 -1
- package/es/components/menu/dom/logic/MenuElement.js +3 -3
- package/es/components/menu/dom/logic/MenuElement.js.map +1 -1
- package/es/core/BaseTable.d.ts +1 -1
- package/es/core/BaseTable.js +4 -4
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/tableHelper.d.ts +2 -0
- package/es/core/tableHelper.js +16 -0
- package/es/core/tableHelper.js.map +1 -1
- package/es/data/DataSource.d.ts +8 -1
- package/es/data/DataSource.js +59 -2
- package/es/data/DataSource.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/scenegraph/group-creater/column.d.ts +0 -4
- package/es/scenegraph/group-creater/column.js +0 -16
- package/es/scenegraph/group-creater/column.js.map +1 -1
- package/es/scenegraph/group-creater/progress/proxy.d.ts +2 -0
- package/es/scenegraph/group-creater/progress/proxy.js +16 -2
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +4 -0
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
- package/es/scenegraph/layout/auto-height.d.ts +1 -2
- package/es/scenegraph/layout/auto-height.js +0 -33
- package/es/scenegraph/layout/auto-height.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js +1 -1
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/update-col.d.ts +3 -0
- package/es/scenegraph/layout/update-col.js +200 -0
- package/es/scenegraph/layout/update-col.js.map +1 -0
- package/es/scenegraph/layout/update-height.js +1 -1
- package/es/scenegraph/layout/update-height.js.map +1 -1
- package/es/scenegraph/layout/update-row.js +94 -49
- package/es/scenegraph/layout/update-row.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +5 -0
- package/es/scenegraph/scenegraph.js +25 -2
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/utils/get-hierarchy-offset.js +1 -1
- package/es/scenegraph/utils/get-hierarchy-offset.js.map +1 -1
- package/es/state/resize/update-resize-column.js +1 -1
- package/es/state/resize/update-resize-column.js.map +1 -1
- package/es/state/state.d.ts +2 -0
- package/es/state/state.js +47 -2
- package/es/state/state.js.map +1 -1
- package/es/themes/DARK.js.map +1 -1
- package/es/tools/diff-cell.js +1 -1
- package/es/tools/diff-cell.js.map +1 -1
- package/es/ts-types/base-table.d.ts +1 -1
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +3 -0
- package/es/ts-types/table-engine.js.map +1 -1
- package/package.json +4 -4
package/cjs/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
|
-
|
|
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
|
-
|
|
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/cjs/ListTable.js
CHANGED
|
@@ -122,7 +122,7 @@ class ListTable extends core_1.BaseTable {
|
|
|
122
122
|
const {field: field} = table.internalProps.layoutMap.getBody(col, row);
|
|
123
123
|
return table.getRawFieldData(field, col, row);
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
getRecordShowIndexByCell(col, row) {
|
|
126
126
|
const {layoutMap: layoutMap} = this.internalProps;
|
|
127
127
|
return layoutMap.getRecordIndexByCell(col, row);
|
|
128
128
|
}
|
|
@@ -143,11 +143,11 @@ class ListTable extends core_1.BaseTable {
|
|
|
143
143
|
};
|
|
144
144
|
}
|
|
145
145
|
getCellOriginRecord(col, row) {
|
|
146
|
-
const table = this, index = table.
|
|
146
|
+
const table = this, index = table.getRecordShowIndexByCell(col, row);
|
|
147
147
|
if (index > -1) return table.dataSource.get(index);
|
|
148
148
|
}
|
|
149
149
|
getCellRawRecord(col, row) {
|
|
150
|
-
const table = this, index = table.
|
|
150
|
+
const table = this, index = table.getRecordShowIndexByCell(col, row);
|
|
151
151
|
if (index > -1) return table.dataSource.getRaw(index);
|
|
152
152
|
}
|
|
153
153
|
_canResizeColumn(col, row) {
|
|
@@ -193,29 +193,30 @@ class ListTable extends core_1.BaseTable {
|
|
|
193
193
|
this.refreshRowColCount();
|
|
194
194
|
}
|
|
195
195
|
refreshRowColCount() {
|
|
196
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
196
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
197
197
|
const table = this, {layoutMap: layoutMap} = table.internalProps;
|
|
198
198
|
layoutMap && (layoutMap.recordsCount = null !== (_b = null === (_a = table.internalProps.dataSource) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0,
|
|
199
199
|
table.transpose ? (table.rowCount = null !== (_c = layoutMap.rowCount) && void 0 !== _c ? _c : 0,
|
|
200
200
|
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,
|
|
201
201
|
table.frozenRowCount = 0, this.internalProps.frozenColCount = null !== (_f = layoutMap.headerLevelCount) && void 0 !== _f ? _f : 0,
|
|
202
|
-
table.
|
|
203
|
-
table.
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
table.
|
|
202
|
+
table.bottomFrozenRowCount !== (null !== (_g = this.options.bottomFrozenRowCount) && void 0 !== _g ? _g : 0) && (table.bottomFrozenRowCount = null !== (_h = this.options.bottomFrozenRowCount) && void 0 !== _h ? _h : 0),
|
|
203
|
+
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,
|
|
204
|
+
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,
|
|
205
|
+
this.internalProps.frozenColCount = null !== (_p = this.options.frozenColCount) && void 0 !== _p ? _p : 0,
|
|
206
|
+
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),
|
|
207
|
+
table.rightFrozenColCount !== (null !== (_s = this.options.rightFrozenColCount) && void 0 !== _s ? _s : 0) && (table.rightFrozenColCount = null !== (_t = this.options.rightFrozenColCount) && void 0 !== _t ? _t : 0)),
|
|
207
208
|
this.stateManager.setFrozenCol(this.internalProps.frozenColCount));
|
|
208
209
|
}
|
|
209
210
|
getFieldData(field, col, row) {
|
|
210
211
|
if (null === field) return null;
|
|
211
212
|
if (this.internalProps.layoutMap.isHeader(col, row)) return null;
|
|
212
|
-
const index = this.
|
|
213
|
+
const index = this.getRecordShowIndexByCell(col, row);
|
|
213
214
|
return this.internalProps.dataSource.getField(index, field, col, row, this);
|
|
214
215
|
}
|
|
215
216
|
getRawFieldData(field, col, row) {
|
|
216
217
|
if (null === field) return null;
|
|
217
218
|
if (this.internalProps.layoutMap.isHeader(col, row)) return null;
|
|
218
|
-
const index = this.
|
|
219
|
+
const index = this.getRecordShowIndexByCell(col, row);
|
|
219
220
|
return this.internalProps.dataSource.getRawField(index, field, col, row, this);
|
|
220
221
|
}
|
|
221
222
|
moveHeaderPosition(source, target) {
|
|
@@ -292,7 +293,7 @@ class ListTable extends core_1.BaseTable {
|
|
|
292
293
|
}
|
|
293
294
|
getHierarchyState(col, row) {
|
|
294
295
|
if (!this.getBodyColumnDefine(col, row).tree) return ts_types_1.HierarchyState.none;
|
|
295
|
-
const index = this.
|
|
296
|
+
const index = this.getRecordShowIndexByCell(col, row);
|
|
296
297
|
return this.dataSource.getHierarchyState(index);
|
|
297
298
|
}
|
|
298
299
|
toggleHierarchyState(col, row) {
|
|
@@ -313,7 +314,7 @@ class ListTable extends core_1.BaseTable {
|
|
|
313
314
|
}
|
|
314
315
|
}
|
|
315
316
|
_refreshHierarchyState(col, row) {
|
|
316
|
-
const index = this.
|
|
317
|
+
const index = this.getRecordShowIndexByCell(col, row), diffDataIndices = this.dataSource.toggleHierarchyState(index), diffPositions = this.internalProps.layoutMap.toggleHierarchyState(diffDataIndices);
|
|
317
318
|
this.refreshRowColCount(), this.clearCellStyleCache(), this.scenegraph.updateHierarchyIcon(col, row),
|
|
318
319
|
this.scenegraph.updateRow(diffPositions.removeCellPositions, diffPositions.addCellPositions);
|
|
319
320
|
}
|
|
@@ -361,7 +362,7 @@ class ListTable extends core_1.BaseTable {
|
|
|
361
362
|
getCellCheckboxState(col, row) {
|
|
362
363
|
const define = this.getBodyColumnDefine(col, row), field = null == define ? void 0 : define.field, cellType = null == define ? void 0 : define.cellType;
|
|
363
364
|
if ((0, vutils_1.isValid)(field) && "checkbox" === cellType) {
|
|
364
|
-
const dataIndex = this.dataSource.getIndexKey(this.
|
|
365
|
+
const dataIndex = this.dataSource.getIndexKey(this.getRecordShowIndexByCell(col, row));
|
|
365
366
|
return this.stateManager.checkedState[dataIndex][field];
|
|
366
367
|
}
|
|
367
368
|
}
|
|
@@ -393,7 +394,7 @@ class ListTable extends core_1.BaseTable {
|
|
|
393
394
|
setRecordChildren(records, col, row) {
|
|
394
395
|
const record = this.getCellOriginRecord(col, row);
|
|
395
396
|
record.children = records;
|
|
396
|
-
const index = this.
|
|
397
|
+
const index = this.getRecordShowIndexByCell(col, row);
|
|
397
398
|
this.dataSource.setRecord(record, index), this._refreshHierarchyState(col, row);
|
|
398
399
|
}
|
|
399
400
|
startEditCell(col, row) {
|
|
@@ -422,7 +423,7 @@ class ListTable extends core_1.BaseTable {
|
|
|
422
423
|
return "string" == typeof editorDefine ? editors.get(editorDefine) : editorDefine;
|
|
423
424
|
}
|
|
424
425
|
changeCellValue(col, row, value) {
|
|
425
|
-
const recordIndex = this.
|
|
426
|
+
const recordIndex = this.getRecordShowIndexByCell(col, row), {field: field} = this.internalProps.layoutMap.getBody(col, row);
|
|
426
427
|
if (this.dataSource.changeFieldValue(value, recordIndex, field, col, row, this),
|
|
427
428
|
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)) {
|
|
428
429
|
const oldWidth = this.getColWidth(col), newWidth = (0, compute_col_width_1.computeColWidth)(col, 0, this.rowCount - 1, this, !1);
|
|
@@ -439,6 +440,150 @@ class ListTable extends core_1.BaseTable {
|
|
|
439
440
|
changedValue: this.getCellOriginValue(col, row)
|
|
440
441
|
}), this.scenegraph.updateNextFrame();
|
|
441
442
|
}
|
|
443
|
+
addRecord(record, recordIndex) {
|
|
444
|
+
if (this.sortState) this.dataSource.addRecordForSorted(record), (0, tableHelper_1.sortRecords)(this),
|
|
445
|
+
this.refreshRowColCount(), this.scenegraph.clearCells(), this.scenegraph.createSceneGraph(); else {
|
|
446
|
+
(void 0 === recordIndex || recordIndex > this.dataSource.sourceLength) && (recordIndex = this.dataSource.sourceLength);
|
|
447
|
+
const headerCount = this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount;
|
|
448
|
+
this.dataSource.addRecord(record, recordIndex);
|
|
449
|
+
const oldRowCount = this.rowCount;
|
|
450
|
+
this.refreshRowColCount();
|
|
451
|
+
const newRowCount = this.transpose ? this.colCount : this.rowCount;
|
|
452
|
+
if (this.pagination) {
|
|
453
|
+
const {perPageCount: perPageCount, currentPage: currentPage} = this.pagination, endIndex = perPageCount * (currentPage || 0) + perPageCount;
|
|
454
|
+
if (recordIndex < endIndex) if (recordIndex < endIndex - perPageCount) this.scenegraph.clearCells(),
|
|
455
|
+
this.scenegraph.createSceneGraph(); else {
|
|
456
|
+
const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
|
|
457
|
+
if (oldRowCount - headerCount === this.pagination.perPageCount) {
|
|
458
|
+
const updateRows = [];
|
|
459
|
+
for (let row = rowNum; row < newRowCount; row++) this.transpose ? updateRows.push({
|
|
460
|
+
col: row,
|
|
461
|
+
row: 0
|
|
462
|
+
}) : updateRows.push({
|
|
463
|
+
col: 0,
|
|
464
|
+
row: row
|
|
465
|
+
});
|
|
466
|
+
this.transpose ? this.scenegraph.updateCol([], [], updateRows) : this.scenegraph.updateRow([], [], updateRows);
|
|
467
|
+
} else {
|
|
468
|
+
const addRows = [];
|
|
469
|
+
for (let row = rowNum; row < Math.min(newRowCount, rowNum + 1); row++) this.transpose ? addRows.push({
|
|
470
|
+
col: row,
|
|
471
|
+
row: 0
|
|
472
|
+
}) : addRows.push({
|
|
473
|
+
col: 0,
|
|
474
|
+
row: row
|
|
475
|
+
});
|
|
476
|
+
this.transpose ? this.scenegraph.updateCol([], addRows, []) : this.scenegraph.updateRow([], addRows, []);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
} else {
|
|
480
|
+
const addRows = [];
|
|
481
|
+
for (let row = recordIndex + headerCount; row < recordIndex + headerCount + 1; row++) this.transpose ? addRows.push({
|
|
482
|
+
col: row,
|
|
483
|
+
row: 0
|
|
484
|
+
}) : addRows.push({
|
|
485
|
+
col: 0,
|
|
486
|
+
row: row
|
|
487
|
+
});
|
|
488
|
+
this.transpose ? this.scenegraph.updateCol([], addRows, []) : this.scenegraph.updateRow([], addRows, []);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
addRecords(records, recordIndex) {
|
|
493
|
+
if (this.sortState) this.dataSource.addRecordsForSorted(records), (0, tableHelper_1.sortRecords)(this),
|
|
494
|
+
this.refreshRowColCount(), this.scenegraph.clearCells(), this.scenegraph.createSceneGraph(); else {
|
|
495
|
+
void 0 === recordIndex || recordIndex > this.dataSource.sourceLength ? recordIndex = this.dataSource.sourceLength : recordIndex < 0 && (recordIndex = 0);
|
|
496
|
+
const headerCount = this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount;
|
|
497
|
+
this.dataSource.addRecords(records, recordIndex);
|
|
498
|
+
const oldRowCount = this.transpose ? this.colCount : this.rowCount;
|
|
499
|
+
this.refreshRowColCount();
|
|
500
|
+
const newRowCount = this.transpose ? this.colCount : this.rowCount;
|
|
501
|
+
if (this.pagination) {
|
|
502
|
+
const {perPageCount: perPageCount, currentPage: currentPage} = this.pagination, endIndex = perPageCount * (currentPage || 0) + perPageCount;
|
|
503
|
+
if (recordIndex < endIndex) if (recordIndex < endIndex - perPageCount) this.scenegraph.clearCells(),
|
|
504
|
+
this.scenegraph.createSceneGraph(); else {
|
|
505
|
+
const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
|
|
506
|
+
if (oldRowCount - headerCount === this.pagination.perPageCount) {
|
|
507
|
+
const updateRows = [];
|
|
508
|
+
for (let row = rowNum; row < newRowCount; row++) this.transpose ? updateRows.push({
|
|
509
|
+
col: row,
|
|
510
|
+
row: 0
|
|
511
|
+
}) : updateRows.push({
|
|
512
|
+
col: 0,
|
|
513
|
+
row: row
|
|
514
|
+
});
|
|
515
|
+
this.transpose ? this.scenegraph.updateCol([], [], updateRows) : this.scenegraph.updateRow([], [], updateRows);
|
|
516
|
+
} else {
|
|
517
|
+
const addRows = [];
|
|
518
|
+
for (let row = rowNum; row < Math.min(newRowCount, rowNum + (Array.isArray(records) ? records.length : 1)); row++) this.transpose ? addRows.push({
|
|
519
|
+
col: row,
|
|
520
|
+
row: 0
|
|
521
|
+
}) : addRows.push({
|
|
522
|
+
col: 0,
|
|
523
|
+
row: row
|
|
524
|
+
});
|
|
525
|
+
this.transpose ? this.scenegraph.updateCol([], addRows, []) : this.scenegraph.updateRow([], addRows, []);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
} else {
|
|
529
|
+
const addRows = [];
|
|
530
|
+
for (let row = recordIndex + headerCount; row < recordIndex + headerCount + (Array.isArray(records) ? records.length : 1); row++) this.transpose ? addRows.push({
|
|
531
|
+
col: row,
|
|
532
|
+
row: 0
|
|
533
|
+
}) : addRows.push({
|
|
534
|
+
col: 0,
|
|
535
|
+
row: row
|
|
536
|
+
});
|
|
537
|
+
this.transpose ? this.scenegraph.updateCol([], addRows, []) : this.scenegraph.updateRow([], addRows, []);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
deleteRecords(recordIndexs) {
|
|
542
|
+
if ((null == recordIndexs ? void 0 : recordIndexs.length) > 0) if (this.sortState) this.dataSource.deleteRecordsForSorted(recordIndexs),
|
|
543
|
+
(0, tableHelper_1.sortRecords)(this), this.refreshRowColCount(), this.scenegraph.clearCells(),
|
|
544
|
+
this.scenegraph.createSceneGraph(); else {
|
|
545
|
+
const deletedRecordIndexs = this.dataSource.deleteRecords(recordIndexs);
|
|
546
|
+
if (0 === deletedRecordIndexs.length) return;
|
|
547
|
+
const oldRowCount = this.transpose ? this.colCount : this.rowCount;
|
|
548
|
+
this.refreshRowColCount();
|
|
549
|
+
const newRowCount = this.transpose ? this.colCount : this.rowCount, recordIndexsMinToMax = deletedRecordIndexs.sort(((a, b) => a - b)), minRecordIndex = recordIndexsMinToMax[0];
|
|
550
|
+
if (this.pagination) {
|
|
551
|
+
const {perPageCount: perPageCount, currentPage: currentPage} = this.pagination, endIndex = perPageCount * (currentPage || 0) + perPageCount;
|
|
552
|
+
if (minRecordIndex < endIndex) if (minRecordIndex < endIndex - perPageCount) this.scenegraph.clearCells(),
|
|
553
|
+
this.scenegraph.createSceneGraph(); else {
|
|
554
|
+
const updateRows = [], delRows = [];
|
|
555
|
+
for (let row = minRecordIndex - (endIndex - perPageCount) + (this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount); row < newRowCount; row++) this.transpose ? updateRows.push({
|
|
556
|
+
col: row,
|
|
557
|
+
row: 0
|
|
558
|
+
}) : updateRows.push({
|
|
559
|
+
col: 0,
|
|
560
|
+
row: row
|
|
561
|
+
});
|
|
562
|
+
if (newRowCount < oldRowCount) for (let row = newRowCount; row < oldRowCount; row++) this.transpose ? delRows.push({
|
|
563
|
+
col: row,
|
|
564
|
+
row: 0
|
|
565
|
+
}) : delRows.push({
|
|
566
|
+
col: 0,
|
|
567
|
+
row: row
|
|
568
|
+
});
|
|
569
|
+
this.transpose ? this.scenegraph.updateCol(delRows, [], updateRows) : this.scenegraph.updateRow(delRows, [], updateRows);
|
|
570
|
+
}
|
|
571
|
+
} else {
|
|
572
|
+
const delRows = [];
|
|
573
|
+
for (let index = 0; index < recordIndexsMinToMax.length; index++) {
|
|
574
|
+
const rowNum = recordIndexsMinToMax[index] + (this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount);
|
|
575
|
+
this.transpose ? delRows.push({
|
|
576
|
+
col: rowNum,
|
|
577
|
+
row: 0
|
|
578
|
+
}) : delRows.push({
|
|
579
|
+
col: 0,
|
|
580
|
+
row: rowNum
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
this.transpose ? this.scenegraph.updateCol(delRows, [], []) : this.scenegraph.updateRow(delRows, [], []);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
442
587
|
}
|
|
443
588
|
|
|
444
589
|
exports.ListTable = ListTable;
|