@visactor/vtable 1.5.3-alpha.1 → 1.5.4-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.
- package/cjs/ListTable.d.ts +1 -2
- package/cjs/ListTable.js +194 -26
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotTable.d.ts +1 -1
- package/cjs/PivotTable.js +3 -3
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +3 -5
- package/cjs/core/BaseTable.js +79 -8
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/tableHelper.d.ts +2 -0
- package/cjs/core/tableHelper.js +18 -9
- package/cjs/core/tableHelper.js.map +1 -1
- package/cjs/data/CachedDataSource.d.ts +1 -10
- package/cjs/data/CachedDataSource.js +3 -78
- package/cjs/data/CachedDataSource.js.map +1 -1
- package/cjs/dataset/statistics-helper.js +1 -0
- package/cjs/edit/edit-manager.d.ts +1 -1
- package/cjs/edit/edit-manager.js +4 -5
- package/cjs/edit/edit-manager.js.map +1 -1
- package/cjs/event/listener/container-dom.js +6 -5
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/event/scroll.js +6 -4
- package/cjs/event/scroll.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/layout/layout-helper.js +2 -2
- package/cjs/layout/layout-helper.js.map +1 -1
- package/cjs/layout/pivot-header-layout.js +5 -5
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/row-height-map.js +0 -1
- package/cjs/layout/simple-header-layout.d.ts +2 -1
- package/cjs/layout/simple-header-layout.js +88 -2
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/plugins/icons.js +1 -1
- package/cjs/plugins/themes.js +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +6 -11
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/column-helper.js +2 -7
- package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
- package/cjs/scenegraph/scenegraph.js +1 -1
- package/cjs/scenegraph/utils/get-cell-merge.js +1 -1
- package/cjs/scenegraph/utils/get-cell-merge.js.map +1 -1
- package/cjs/scenegraph/utils/get-hierarchy-offset.js +8 -6
- package/cjs/scenegraph/utils/get-hierarchy-offset.js.map +1 -1
- package/cjs/state/select/is-cell-select-highlight.d.ts +1 -0
- package/cjs/state/select/is-cell-select-highlight.js +8 -2
- package/cjs/state/select/is-cell-select-highlight.js.map +1 -1
- package/cjs/themes/theme.d.ts +0 -2
- package/cjs/themes/theme.js +4 -12
- package/cjs/themes/theme.js.map +1 -1
- package/cjs/tools/helper.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +0 -9
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/new-data-set.d.ts +0 -1
- package/cjs/ts-types/new-data-set.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +1 -9
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/ts-types/theme.d.ts +0 -1
- package/cjs/ts-types/theme.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +2903 -3151
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +1 -2
- package/es/ListTable.js +192 -30
- package/es/ListTable.js.map +1 -1
- package/es/PivotTable.d.ts +1 -1
- package/es/PivotTable.js +3 -3
- package/es/PivotTable.js.map +1 -1
- package/es/core/BaseTable.d.ts +3 -5
- package/es/core/BaseTable.js +83 -11
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/tableHelper.d.ts +2 -0
- package/es/core/tableHelper.js +16 -6
- package/es/core/tableHelper.js.map +1 -1
- package/es/data/CachedDataSource.d.ts +1 -10
- package/es/data/CachedDataSource.js +0 -79
- package/es/data/CachedDataSource.js.map +1 -1
- package/es/dataset/statistics-helper.js +2 -1
- package/es/edit/edit-manager.d.ts +1 -1
- package/es/edit/edit-manager.js +5 -4
- package/es/edit/edit-manager.js.map +1 -1
- package/es/event/listener/container-dom.js +7 -4
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/listener/table-group.js.map +1 -1
- package/es/event/scroll.js +6 -4
- package/es/event/scroll.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/layout/layout-helper.js +2 -2
- package/es/layout/layout-helper.js.map +1 -1
- package/es/layout/pivot-header-layout.js +5 -5
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/row-height-map.js +1 -2
- package/es/layout/simple-header-layout.d.ts +2 -1
- package/es/layout/simple-header-layout.js +87 -3
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/plugins/icons.js +1 -1
- package/es/plugins/themes.js +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +6 -11
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/column-helper.js +2 -7
- package/es/scenegraph/group-creater/column-helper.js.map +1 -1
- package/es/scenegraph/scenegraph.js +1 -1
- package/es/scenegraph/utils/get-cell-merge.js +1 -1
- package/es/scenegraph/utils/get-cell-merge.js.map +1 -1
- package/es/scenegraph/utils/get-hierarchy-offset.js +9 -7
- package/es/scenegraph/utils/get-hierarchy-offset.js.map +1 -1
- package/es/state/select/is-cell-select-highlight.d.ts +1 -0
- package/es/state/select/is-cell-select-highlight.js +5 -0
- package/es/state/select/is-cell-select-highlight.js.map +1 -1
- package/es/themes/theme.d.ts +0 -2
- package/es/themes/theme.js +4 -11
- package/es/themes/theme.js.map +1 -1
- package/es/tools/helper.js.map +1 -1
- package/es/ts-types/base-table.d.ts +0 -9
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/new-data-set.d.ts +0 -1
- package/es/ts-types/new-data-set.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +1 -9
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/ts-types/theme.d.ts +0 -1
- package/es/ts-types/theme.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +4 -4
- package/cjs/core/group-helper.d.ts +0 -6
- package/cjs/core/group-helper.js +0 -22
- package/cjs/core/group-helper.js.map +0 -1
- package/cjs/core/record-helper.d.ts +0 -6
- package/cjs/core/record-helper.js +0 -230
- package/cjs/core/record-helper.js.map +0 -1
- package/cjs/core/style-helper.d.ts +0 -3
- package/cjs/core/style-helper.js +0 -110
- package/cjs/core/style-helper.js.map +0 -1
- package/cjs/layout/cell-range/simple-cell-range.d.ts +0 -4
- package/cjs/layout/cell-range/simple-cell-range.js +0 -106
- package/cjs/layout/cell-range/simple-cell-range.js.map +0 -1
- package/es/core/group-helper.d.ts +0 -6
- package/es/core/group-helper.js +0 -14
- package/es/core/group-helper.js.map +0 -1
- package/es/core/record-helper.d.ts +0 -6
- package/es/core/record-helper.js +0 -220
- package/es/core/record-helper.js.map +0 -1
- package/es/core/style-helper.d.ts +0 -3
- package/es/core/style-helper.js +0 -86
- package/es/core/style-helper.js.map +0 -1
- package/es/layout/cell-range/simple-cell-range.d.ts +0 -4
- package/es/layout/cell-range/simple-cell-range.js +0 -99
- package/es/layout/cell-range/simple-cell-range.js.map +0 -1
package/cjs/ListTable.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ export declare class ListTable extends BaseTable implements ListTableAPI {
|
|
|
68
68
|
sortState?: SortState | SortState[];
|
|
69
69
|
}): void;
|
|
70
70
|
setRecordChildren(records: any[], col: number, row: number): void;
|
|
71
|
-
startEditCell(col?: number, row?: number): void;
|
|
71
|
+
startEditCell(col?: number, row?: number, value?: string | number): void;
|
|
72
72
|
completeEditCell(): void;
|
|
73
73
|
getEditor(col: number, row: number): IEditor<any>;
|
|
74
74
|
isHasEditorDefine(col: number, row: number): boolean;
|
|
@@ -87,5 +87,4 @@ export declare class ListTable extends BaseTable implements ListTableAPI {
|
|
|
87
87
|
}[];
|
|
88
88
|
}[];
|
|
89
89
|
isAggregation(col: number, row: number): boolean;
|
|
90
|
-
getGroupTitleLevel(col: number, row: number): number | undefined;
|
|
91
90
|
}
|
package/cjs/ListTable.js
CHANGED
|
@@ -29,22 +29,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
29
29
|
value: !0
|
|
30
30
|
}), exports.ListTable = void 0;
|
|
31
31
|
|
|
32
|
-
const ts_types_1 = require("./ts-types"), layout_1 = require("./layout"), vutils_1 = require("@visactor/vutils"), tableHelper_1 = require("./core/tableHelper"), core_1 = require("./core"), TABLE_EVENT_TYPE_1 = require("./core/TABLE_EVENT_TYPE"), env_1 = require("./tools/env"), editors = __importStar(require("./edit/editors")), edit_manager_1 = require("./edit/edit-manager"), compute_col_width_1 = require("./scenegraph/layout/compute-col-width"), compute_row_height_1 = require("./scenegraph/layout/compute-row-height"), util_1 = require("./tools/util"), radio_1 = require("./state/radio/radio"), vutils_extension_1 = require("@visactor/vutils-extension"), checkbox_1 = require("./state/checkbox/checkbox"), factory_1 = require("./core/factory")
|
|
32
|
+
const ts_types_1 = require("./ts-types"), layout_1 = require("./layout"), vutils_1 = require("@visactor/vutils"), tableHelper_1 = require("./core/tableHelper"), core_1 = require("./core"), TABLE_EVENT_TYPE_1 = require("./core/TABLE_EVENT_TYPE"), env_1 = require("./tools/env"), editors = __importStar(require("./edit/editors")), edit_manager_1 = require("./edit/edit-manager"), compute_col_width_1 = require("./scenegraph/layout/compute-col-width"), compute_row_height_1 = require("./scenegraph/layout/compute-row-height"), util_1 = require("./tools/util"), radio_1 = require("./state/radio/radio"), vutils_extension_1 = require("@visactor/vutils-extension"), checkbox_1 = require("./state/checkbox/checkbox"), factory_1 = require("./core/factory");
|
|
33
33
|
|
|
34
34
|
class ListTable extends core_1.BaseTable {
|
|
35
35
|
constructor(container, options) {
|
|
36
|
-
var _a, _b
|
|
36
|
+
var _a, _b;
|
|
37
37
|
"node" === env_1.Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container,
|
|
38
38
|
container = container.container ? container.container : null), super(container, options),
|
|
39
39
|
this.showHeader = !0;
|
|
40
40
|
const internalProps = this.internalProps;
|
|
41
41
|
if (internalProps.frozenColDragHeaderMode = options.frozenColDragHeaderMode, this.pagination = options.pagination,
|
|
42
|
-
internalProps.sortState = options.sortState, internalProps.dataConfig = options.
|
|
43
|
-
group_helper_1.getGroupByDataConfig)(options.groupBy) : {}, internalProps.columns = options.columns ? (0,
|
|
42
|
+
internalProps.sortState = options.sortState, internalProps.dataConfig = {}, internalProps.columns = options.columns ? (0,
|
|
44
43
|
vutils_extension_1.cloneDeepSpec)(options.columns, [ "children" ]) : options.header ? (0,
|
|
45
|
-
vutils_extension_1.cloneDeepSpec)(options.header, [ "children" ]) : [], internalProps.
|
|
46
|
-
|
|
47
|
-
this.showHeader = null === (_c = options.showHeader) || void 0 === _c || _c, this.transpose = null !== (_d = options.transpose) && void 0 !== _d && _d,
|
|
44
|
+
vutils_extension_1.cloneDeepSpec)(options.header, [ "children" ]) : [], this.internalProps.headerHelper.setTableColumnsEditor(),
|
|
45
|
+
this.showHeader = null === (_a = options.showHeader) || void 0 === _a || _a, this.transpose = null !== (_b = options.transpose) && void 0 !== _b && _b,
|
|
48
46
|
"node" !== env_1.Env.mode && (this.editorManager = new edit_manager_1.EditManeger(this)),
|
|
49
47
|
this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1, options.dataSource ? (0,
|
|
50
48
|
tableHelper_1._setDataSource)(this, options.dataSource) : options.records ? this.setRecords(options.records, {
|
|
@@ -351,9 +349,7 @@ class ListTable extends core_1.BaseTable {
|
|
|
351
349
|
return null;
|
|
352
350
|
}
|
|
353
351
|
getHierarchyState(col, row) {
|
|
354
|
-
if (!this.
|
|
355
|
-
if (!this.getBodyColumnDefine(col, row).tree) return ts_types_1.HierarchyState.none;
|
|
356
|
-
}
|
|
352
|
+
if (!this.getBodyColumnDefine(col, row).tree) return ts_types_1.HierarchyState.none;
|
|
357
353
|
const index = this.getRecordShowIndexByCell(col, row);
|
|
358
354
|
return this.dataSource.getHierarchyState(index);
|
|
359
355
|
}
|
|
@@ -424,7 +420,7 @@ class ListTable extends core_1.BaseTable {
|
|
|
424
420
|
}
|
|
425
421
|
updateFilterRules(filterRules) {
|
|
426
422
|
this.scenegraph.clearCells(), this.sortState ? (this.dataSource.updateFilterRulesForSorted(filterRules),
|
|
427
|
-
(0,
|
|
423
|
+
(0, tableHelper_1.sortRecords)(this)) : this.dataSource.updateFilterRules(filterRules),
|
|
428
424
|
this.refreshRowColCount(), this.scenegraph.createSceneGraph();
|
|
429
425
|
}
|
|
430
426
|
getCheckboxState(field) {
|
|
@@ -490,12 +486,12 @@ class ListTable extends core_1.BaseTable {
|
|
|
490
486
|
const index = this.getRecordShowIndexByCell(col, row);
|
|
491
487
|
this.dataSource.setRecord(record, index), this._refreshHierarchyState(col, row);
|
|
492
488
|
}
|
|
493
|
-
startEditCell(col, row) {
|
|
489
|
+
startEditCell(col, row, value) {
|
|
494
490
|
var _a;
|
|
495
491
|
if ((0, vutils_1.isValid)(col) && (0, vutils_1.isValid)(row)) this.eventManager.isDraging = !1,
|
|
496
|
-
this.selectCell(col, row), this.editorManager.startEditCell(col, row); else if (null === (_a = this.stateManager.select) || void 0 === _a ? void 0 : _a.cellPos) {
|
|
492
|
+
this.selectCell(col, row), this.editorManager.startEditCell(col, row, value); else if (null === (_a = this.stateManager.select) || void 0 === _a ? void 0 : _a.cellPos) {
|
|
497
493
|
const {col: col, row: row} = this.stateManager.select.cellPos;
|
|
498
|
-
(0, vutils_1.isValid)(col) && (0, vutils_1.isValid)(row) && this.editorManager.startEditCell(col, row);
|
|
494
|
+
(0, vutils_1.isValid)(col) && (0, vutils_1.isValid)(row) && this.editorManager.startEditCell(col, row, value);
|
|
499
495
|
}
|
|
500
496
|
}
|
|
501
497
|
completeEditCell() {
|
|
@@ -618,16 +614,196 @@ class ListTable extends core_1.BaseTable {
|
|
|
618
614
|
this.scenegraph.updateNextFrame();
|
|
619
615
|
}
|
|
620
616
|
addRecord(record, recordIndex) {
|
|
621
|
-
(
|
|
617
|
+
if (this.sortState) this.dataSource.addRecordForSorted(record), (0, tableHelper_1.sortRecords)(this),
|
|
618
|
+
this.refreshRowColCount(), this.scenegraph.clearCells(), this.scenegraph.createSceneGraph(); else {
|
|
619
|
+
(void 0 === recordIndex || recordIndex > this.dataSource.sourceLength) && (recordIndex = this.dataSource.sourceLength);
|
|
620
|
+
const headerCount = this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount;
|
|
621
|
+
this.dataSource.addRecord(record, recordIndex);
|
|
622
|
+
const oldRowCount = this.rowCount;
|
|
623
|
+
if (this.refreshRowColCount(), 0 === this.scenegraph.proxy.totalActualBodyRowCount) return this.scenegraph.clearCells(),
|
|
624
|
+
void this.scenegraph.createSceneGraph();
|
|
625
|
+
const newRowCount = this.transpose ? this.colCount : this.rowCount;
|
|
626
|
+
if (this.pagination) {
|
|
627
|
+
const {perPageCount: perPageCount, currentPage: currentPage} = this.pagination, endIndex = perPageCount * (currentPage || 0) + perPageCount;
|
|
628
|
+
if (recordIndex < endIndex) if (recordIndex < endIndex - perPageCount) this.scenegraph.clearCells(),
|
|
629
|
+
this.scenegraph.createSceneGraph(); else {
|
|
630
|
+
const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
|
|
631
|
+
if (oldRowCount - headerCount === this.pagination.perPageCount) {
|
|
632
|
+
const updateRows = [];
|
|
633
|
+
for (let row = rowNum; row < newRowCount; row++) this.transpose ? updateRows.push({
|
|
634
|
+
col: row,
|
|
635
|
+
row: 0
|
|
636
|
+
}) : updateRows.push({
|
|
637
|
+
col: 0,
|
|
638
|
+
row: row
|
|
639
|
+
});
|
|
640
|
+
this.transpose ? this.scenegraph.updateCol([], [], updateRows) : this.scenegraph.updateRow([], [], updateRows);
|
|
641
|
+
} else {
|
|
642
|
+
const addRows = [];
|
|
643
|
+
for (let row = rowNum; row < Math.min(newRowCount, rowNum + 1); row++) this.transpose ? addRows.push({
|
|
644
|
+
col: row,
|
|
645
|
+
row: 0
|
|
646
|
+
}) : addRows.push({
|
|
647
|
+
col: 0,
|
|
648
|
+
row: row
|
|
649
|
+
});
|
|
650
|
+
this.transpose ? this.scenegraph.updateCol([], addRows, []) : this.scenegraph.updateRow([], addRows, []);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
} else {
|
|
654
|
+
const addRows = [];
|
|
655
|
+
for (let row = recordIndex + headerCount; row < recordIndex + headerCount + 1; row++) this.transpose ? addRows.push({
|
|
656
|
+
col: row,
|
|
657
|
+
row: 0
|
|
658
|
+
}) : addRows.push({
|
|
659
|
+
col: 0,
|
|
660
|
+
row: row
|
|
661
|
+
});
|
|
662
|
+
this.transpose ? this.scenegraph.updateCol([], addRows, []) : this.scenegraph.updateRow([], addRows, []);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
622
665
|
}
|
|
623
666
|
addRecords(records, recordIndex) {
|
|
624
|
-
(
|
|
667
|
+
if (this.sortState) this.dataSource.addRecordsForSorted(records), (0, tableHelper_1.sortRecords)(this),
|
|
668
|
+
this.refreshRowColCount(), this.scenegraph.clearCells(), this.scenegraph.createSceneGraph(); else {
|
|
669
|
+
void 0 === recordIndex || recordIndex > this.dataSource.sourceLength ? recordIndex = this.dataSource.sourceLength : recordIndex < 0 && (recordIndex = 0);
|
|
670
|
+
const headerCount = this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount;
|
|
671
|
+
this.dataSource.addRecords(records, recordIndex);
|
|
672
|
+
const oldRowCount = this.transpose ? this.colCount : this.rowCount;
|
|
673
|
+
if (this.refreshRowColCount(), 0 === this.scenegraph.proxy.totalActualBodyRowCount) return this.scenegraph.clearCells(),
|
|
674
|
+
void this.scenegraph.createSceneGraph();
|
|
675
|
+
const newRowCount = this.transpose ? this.colCount : this.rowCount;
|
|
676
|
+
if (this.pagination) {
|
|
677
|
+
const {perPageCount: perPageCount, currentPage: currentPage} = this.pagination, endIndex = perPageCount * (currentPage || 0) + perPageCount;
|
|
678
|
+
if (recordIndex < endIndex) if (recordIndex < endIndex - perPageCount) this.scenegraph.clearCells(),
|
|
679
|
+
this.scenegraph.createSceneGraph(); else {
|
|
680
|
+
const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
|
|
681
|
+
if (oldRowCount - headerCount === this.pagination.perPageCount) {
|
|
682
|
+
const updateRows = [];
|
|
683
|
+
for (let row = rowNum; row < newRowCount; row++) this.transpose ? updateRows.push({
|
|
684
|
+
col: row,
|
|
685
|
+
row: 0
|
|
686
|
+
}) : updateRows.push({
|
|
687
|
+
col: 0,
|
|
688
|
+
row: row
|
|
689
|
+
});
|
|
690
|
+
this.transpose ? this.scenegraph.updateCol([], [], updateRows) : this.scenegraph.updateRow([], [], updateRows);
|
|
691
|
+
} else {
|
|
692
|
+
const addRows = [];
|
|
693
|
+
for (let row = rowNum; row < Math.min(newRowCount, rowNum + (Array.isArray(records) ? records.length : 1)); row++) this.transpose ? addRows.push({
|
|
694
|
+
col: row,
|
|
695
|
+
row: 0
|
|
696
|
+
}) : addRows.push({
|
|
697
|
+
col: 0,
|
|
698
|
+
row: row
|
|
699
|
+
});
|
|
700
|
+
this.transpose ? this.scenegraph.updateCol([], addRows, []) : this.scenegraph.updateRow([], addRows, []);
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
} else {
|
|
704
|
+
const addRows = [];
|
|
705
|
+
for (let row = recordIndex + headerCount; row < recordIndex + headerCount + (Array.isArray(records) ? records.length : 1); row++) this.transpose ? addRows.push({
|
|
706
|
+
col: row,
|
|
707
|
+
row: 0
|
|
708
|
+
}) : addRows.push({
|
|
709
|
+
col: 0,
|
|
710
|
+
row: row
|
|
711
|
+
});
|
|
712
|
+
this.transpose ? this.scenegraph.updateCol([], addRows, []) : this.scenegraph.updateRow([], addRows, []);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
625
715
|
}
|
|
626
716
|
deleteRecords(recordIndexs) {
|
|
627
|
-
(0
|
|
717
|
+
if ((null == recordIndexs ? void 0 : recordIndexs.length) > 0) if (this.sortState) this.dataSource.deleteRecordsForSorted(recordIndexs),
|
|
718
|
+
(0, tableHelper_1.sortRecords)(this), this.refreshRowColCount(), this.scenegraph.clearCells(),
|
|
719
|
+
this.scenegraph.createSceneGraph(); else {
|
|
720
|
+
const deletedRecordIndexs = this.dataSource.deleteRecords(recordIndexs);
|
|
721
|
+
if (0 === deletedRecordIndexs.length) return;
|
|
722
|
+
const oldRowCount = this.transpose ? this.colCount : this.rowCount;
|
|
723
|
+
this.refreshRowColCount();
|
|
724
|
+
const newRowCount = this.transpose ? this.colCount : this.rowCount, recordIndexsMinToMax = deletedRecordIndexs.sort(((a, b) => a - b)), minRecordIndex = recordIndexsMinToMax[0];
|
|
725
|
+
if (this.pagination) {
|
|
726
|
+
const {perPageCount: perPageCount, currentPage: currentPage} = this.pagination, endIndex = perPageCount * (currentPage || 0) + perPageCount;
|
|
727
|
+
if (minRecordIndex < endIndex) if (minRecordIndex < endIndex - perPageCount) this.scenegraph.clearCells(),
|
|
728
|
+
this.scenegraph.createSceneGraph(); else {
|
|
729
|
+
const updateRows = [], delRows = [];
|
|
730
|
+
for (let row = minRecordIndex - (endIndex - perPageCount) + (this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount); row < newRowCount; row++) this.transpose ? updateRows.push({
|
|
731
|
+
col: row,
|
|
732
|
+
row: 0
|
|
733
|
+
}) : updateRows.push({
|
|
734
|
+
col: 0,
|
|
735
|
+
row: row
|
|
736
|
+
});
|
|
737
|
+
if (newRowCount < oldRowCount) for (let row = newRowCount; row < oldRowCount; row++) this.transpose ? delRows.push({
|
|
738
|
+
col: row,
|
|
739
|
+
row: 0
|
|
740
|
+
}) : delRows.push({
|
|
741
|
+
col: 0,
|
|
742
|
+
row: row
|
|
743
|
+
});
|
|
744
|
+
this.transpose ? this.scenegraph.updateCol(delRows, [], updateRows) : this.scenegraph.updateRow(delRows, [], updateRows);
|
|
745
|
+
}
|
|
746
|
+
} else {
|
|
747
|
+
const delRows = [];
|
|
748
|
+
for (let index = 0; index < recordIndexsMinToMax.length; index++) {
|
|
749
|
+
const rowNum = recordIndexsMinToMax[index] + (this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount);
|
|
750
|
+
this.transpose ? delRows.push({
|
|
751
|
+
col: rowNum,
|
|
752
|
+
row: 0
|
|
753
|
+
}) : delRows.push({
|
|
754
|
+
col: 0,
|
|
755
|
+
row: rowNum
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
this.transpose ? this.scenegraph.updateCol(delRows, [], []) : this.scenegraph.updateRow(delRows, [], []);
|
|
759
|
+
}
|
|
760
|
+
}
|
|
628
761
|
}
|
|
629
762
|
updateRecords(records, recordIndexs) {
|
|
630
|
-
(0
|
|
763
|
+
if ((null == recordIndexs ? void 0 : recordIndexs.length) > 0) if (this.sortState) this.dataSource.updateRecordsForSorted(records, recordIndexs),
|
|
764
|
+
(0, tableHelper_1.sortRecords)(this), this.refreshRowColCount(), this.scenegraph.clearCells(),
|
|
765
|
+
this.scenegraph.createSceneGraph(); else {
|
|
766
|
+
const updateRecordIndexs = this.dataSource.updateRecords(records, recordIndexs);
|
|
767
|
+
if (0 === updateRecordIndexs.length) return;
|
|
768
|
+
const recordIndexsMinToMax = updateRecordIndexs.sort(((a, b) => a - b));
|
|
769
|
+
if (this.pagination) {
|
|
770
|
+
const {perPageCount: perPageCount, currentPage: currentPage} = this.pagination, endIndex = perPageCount * (currentPage || 0) + perPageCount, updateRows = [];
|
|
771
|
+
for (let index = 0; index < recordIndexsMinToMax.length; index++) {
|
|
772
|
+
const recordIndex = recordIndexsMinToMax[index];
|
|
773
|
+
if (recordIndex < endIndex && recordIndex >= endIndex - perPageCount) {
|
|
774
|
+
const rowNum = recordIndex - (endIndex - perPageCount) + (this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount);
|
|
775
|
+
updateRows.push(rowNum);
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
if (updateRows.length >= 1) {
|
|
779
|
+
const updateRowCells = [];
|
|
780
|
+
for (let index = 0; index < updateRows.length; index++) {
|
|
781
|
+
const updateRow = updateRows[index];
|
|
782
|
+
this.transpose ? updateRowCells.push({
|
|
783
|
+
col: updateRow,
|
|
784
|
+
row: 0
|
|
785
|
+
}) : updateRowCells.push({
|
|
786
|
+
col: 0,
|
|
787
|
+
row: updateRow
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
this.transpose ? this.scenegraph.updateCol([], [], updateRowCells) : this.scenegraph.updateRow([], [], updateRowCells);
|
|
791
|
+
}
|
|
792
|
+
} else {
|
|
793
|
+
const updateRows = [];
|
|
794
|
+
for (let index = 0; index < recordIndexsMinToMax.length; index++) {
|
|
795
|
+
const rowNum = recordIndexsMinToMax[index] + (this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount);
|
|
796
|
+
this.transpose ? updateRows.push({
|
|
797
|
+
col: rowNum,
|
|
798
|
+
row: 0
|
|
799
|
+
}) : updateRows.push({
|
|
800
|
+
col: 0,
|
|
801
|
+
row: rowNum
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
this.transpose ? this.scenegraph.updateCol([], [], updateRows) : this.scenegraph.updateRow([], [], updateRows);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
631
807
|
}
|
|
632
808
|
_hasCustomRenderOrLayout() {
|
|
633
809
|
var _a, _b, _c, _d;
|
|
@@ -663,14 +839,6 @@ class ListTable extends core_1.BaseTable {
|
|
|
663
839
|
isAggregation(col, row) {
|
|
664
840
|
return this.internalProps.layoutMap.isAggregation(col, row);
|
|
665
841
|
}
|
|
666
|
-
getGroupTitleLevel(col, row) {
|
|
667
|
-
var _a;
|
|
668
|
-
if (!this.options.groupBy) return;
|
|
669
|
-
const indexArr = this.dataSource.getIndexKey(this.getRecordShowIndexByCell(col, row)), groupLength = null !== (_a = this.dataSource.getGroupLength()) && void 0 !== _a ? _a : 0;
|
|
670
|
-
let indexArrLngth = (0, vutils_1.isArray)(indexArr) ? indexArr.length - 1 : 0;
|
|
671
|
-
return groupLength > 0 && indexArrLngth === groupLength && (indexArrLngth = void 0),
|
|
672
|
-
indexArrLngth;
|
|
673
|
-
}
|
|
674
842
|
}
|
|
675
843
|
|
|
676
844
|
exports.ListTable = ListTable;
|