@visactor/vtable 1.5.2 → 1.5.3-alpha.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 +1 -0
- package/cjs/ListTable.js +23 -191
- package/cjs/ListTable.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +5 -3
- package/cjs/core/BaseTable.js +8 -79
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/group-helper.d.ts +6 -0
- package/cjs/core/group-helper.js +22 -0
- package/cjs/core/group-helper.js.map +1 -0
- package/cjs/core/record-helper.d.ts +6 -0
- package/cjs/core/record-helper.js +230 -0
- package/cjs/core/record-helper.js.map +1 -0
- package/cjs/core/style-helper.d.ts +3 -0
- package/cjs/core/style-helper.js +110 -0
- package/cjs/core/style-helper.js.map +1 -0
- package/cjs/core/tableHelper.d.ts +0 -2
- package/cjs/core/tableHelper.js +9 -18
- package/cjs/core/tableHelper.js.map +1 -1
- package/cjs/data/CachedDataSource.d.ts +10 -1
- package/cjs/data/CachedDataSource.js +78 -3
- package/cjs/data/CachedDataSource.js.map +1 -1
- package/cjs/dataset/statistics-helper.js +0 -1
- package/cjs/event/event.js +2 -1
- package/cjs/event/listener/table-group.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/cell-range/simple-cell-range.d.ts +4 -0
- package/cjs/layout/cell-range/simple-cell-range.js +106 -0
- package/cjs/layout/cell-range/simple-cell-range.js.map +1 -0
- package/cjs/layout/layout-helper.js +2 -2
- package/cjs/layout/layout-helper.js.map +1 -1
- package/cjs/layout/row-height-map.js +1 -0
- package/cjs/layout/simple-header-layout.d.ts +1 -2
- package/cjs/layout/simple-header-layout.js +2 -88
- 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 +11 -6
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/column-helper.js +7 -2
- 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 +6 -8
- package/cjs/scenegraph/utils/get-hierarchy-offset.js.map +1 -1
- package/cjs/themes/theme.d.ts +2 -0
- package/cjs/themes/theme.js +12 -4
- package/cjs/themes/theme.js.map +1 -1
- package/cjs/tools/helper.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +9 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/new-data-set.d.ts +1 -0
- package/cjs/ts-types/new-data-set.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +8 -0
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/ts-types/theme.d.ts +1 -0
- package/cjs/ts-types/theme.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +3137 -2870
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +1 -0
- package/es/ListTable.js +27 -189
- package/es/ListTable.js.map +1 -1
- package/es/core/BaseTable.d.ts +5 -3
- package/es/core/BaseTable.js +11 -83
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/group-helper.d.ts +6 -0
- package/es/core/group-helper.js +14 -0
- package/es/core/group-helper.js.map +1 -0
- package/es/core/record-helper.d.ts +6 -0
- package/es/core/record-helper.js +220 -0
- package/es/core/record-helper.js.map +1 -0
- package/es/core/style-helper.d.ts +3 -0
- package/es/core/style-helper.js +86 -0
- package/es/core/style-helper.js.map +1 -0
- package/es/core/tableHelper.d.ts +0 -2
- package/es/core/tableHelper.js +6 -16
- package/es/core/tableHelper.js.map +1 -1
- package/es/data/CachedDataSource.d.ts +10 -1
- package/es/data/CachedDataSource.js +79 -0
- package/es/data/CachedDataSource.js.map +1 -1
- package/es/dataset/statistics-helper.js +1 -2
- package/es/event/event.js +2 -1
- package/es/event/listener/table-group.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/cell-range/simple-cell-range.d.ts +4 -0
- package/es/layout/cell-range/simple-cell-range.js +99 -0
- package/es/layout/cell-range/simple-cell-range.js.map +1 -0
- package/es/layout/layout-helper.js +2 -2
- package/es/layout/layout-helper.js.map +1 -1
- package/es/layout/row-height-map.js +2 -1
- package/es/layout/simple-header-layout.d.ts +1 -2
- package/es/layout/simple-header-layout.js +3 -87
- 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 +11 -6
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/column-helper.js +7 -2
- 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 +7 -9
- package/es/scenegraph/utils/get-hierarchy-offset.js.map +1 -1
- package/es/themes/theme.d.ts +2 -0
- package/es/themes/theme.js +11 -4
- package/es/themes/theme.js.map +1 -1
- package/es/tools/helper.js.map +1 -1
- package/es/ts-types/base-table.d.ts +9 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/new-data-set.d.ts +1 -0
- package/es/ts-types/new-data-set.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +8 -0
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/ts-types/theme.d.ts +1 -0
- package/es/ts-types/theme.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.getGroupByDataConfig = void 0;
|
|
6
|
+
|
|
7
|
+
const vutils_1 = require("@visactor/vutils");
|
|
8
|
+
|
|
9
|
+
function getGroupByDataConfig(groupByOption) {
|
|
10
|
+
if ((0, vutils_1.isString)(groupByOption)) return {
|
|
11
|
+
groupByRules: [ groupByOption ]
|
|
12
|
+
};
|
|
13
|
+
if ((0, vutils_1.isArray)(groupByOption)) {
|
|
14
|
+
return {
|
|
15
|
+
groupByRules: groupByOption.map((item => (0, vutils_1.isString)(item) ? item : item.key))
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return {};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
exports.getGroupByDataConfig = getGroupByDataConfig;
|
|
22
|
+
//# sourceMappingURL=group-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/group-helper.ts"],"names":[],"mappings":";;;AAAA,6CAAqD;AAGrD,SAAgB,oBAAoB,CAAC,aAA4B;IAE/D,IAAI,IAAA,iBAAQ,EAAC,aAAa,CAAC,EAAE;QAC3B,OAAO,EAAE,YAAY,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC;KAC1C;IACD,IAAI,IAAA,gBAAO,EAAC,aAAa,CAAC,EAAE;QAC1B,MAAM,YAAY,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC5C,IAAI,IAAA,iBAAQ,EAAC,IAAI,CAAC,EAAE;gBAClB,OAAO,IAAI,CAAC;aACb;YACD,OAAO,IAAI,CAAC,GAAG,CAAC;QAClB,CAAC,CAAC,CAAC;QACH,OAAO,EAAE,YAAY,EAAE,CAAC;KACzB;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAhBD,oDAgBC","file":"group-helper.js","sourcesContent":["import { isArray, isString } from '@visactor/vutils';\nimport type { GroupByOption } from '../ts-types';\n\nexport function getGroupByDataConfig(groupByOption: GroupByOption) {\n // no sort temply\n if (isString(groupByOption)) {\n return { groupByRules: [groupByOption] };\n }\n if (isArray(groupByOption)) {\n const groupByRules = groupByOption.map(item => {\n if (isString(item)) {\n return item;\n }\n return item.key;\n });\n return { groupByRules };\n }\n\n return {};\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ListTable } from '../ListTable';
|
|
2
|
+
export declare function sortRecords(table: ListTable): void;
|
|
3
|
+
export declare function listTableAddRecord(record: any, recordIndex: number, table: ListTable): void;
|
|
4
|
+
export declare function listTableAddRecords(records: any[], recordIndex: number, table: ListTable): void;
|
|
5
|
+
export declare function listTableDeleteRecords(recordIndexs: number[], table: ListTable): void;
|
|
6
|
+
export declare function listTableUpdateRecords(records: any[], recordIndexs: number[], table: ListTable): void;
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.listTableUpdateRecords = exports.listTableDeleteRecords = exports.listTableAddRecords = exports.listTableAddRecord = exports.sortRecords = void 0;
|
|
6
|
+
|
|
7
|
+
const util_1 = require("../tools/util");
|
|
8
|
+
|
|
9
|
+
function sortRecords(table) {
|
|
10
|
+
var _a;
|
|
11
|
+
if (table.sortState) {
|
|
12
|
+
let order, field;
|
|
13
|
+
if (Array.isArray(table.sortState) ? 0 !== table.sortState.length && ({order: order, field: field} = null === (_a = table.sortState) || void 0 === _a ? void 0 : _a[0]) : ({order: order, field: field} = table.sortState),
|
|
14
|
+
order && field && "normal" !== order) {
|
|
15
|
+
const sortFunc = table._getSortFuncFromHeaderOption(void 0, field), hd = table.internalProps.layoutMap.headerObjects.find((col => col && col.field === field));
|
|
16
|
+
table.dataSource.sort(hd.field, order, null != sortFunc ? sortFunc : util_1.defaultOrderFn);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function listTableAddRecord(record, recordIndex, table) {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
if (table.options.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, [ record ]),
|
|
24
|
+
table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(),
|
|
25
|
+
table.scenegraph.createSceneGraph(); else if (table.sortState) table.dataSource.addRecordForSorted(record),
|
|
26
|
+
sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(); else {
|
|
27
|
+
(void 0 === recordIndex || recordIndex > table.dataSource.sourceLength) && (recordIndex = table.dataSource.sourceLength);
|
|
28
|
+
const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
|
|
29
|
+
table.dataSource.addRecord(record, recordIndex);
|
|
30
|
+
const oldRowCount = table.rowCount;
|
|
31
|
+
if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(),
|
|
32
|
+
void table.scenegraph.createSceneGraph();
|
|
33
|
+
const newRowCount = table.transpose ? table.colCount : table.rowCount;
|
|
34
|
+
if (table.pagination) {
|
|
35
|
+
const {perPageCount: perPageCount, currentPage: currentPage} = table.pagination, endIndex = perPageCount * (currentPage || 0) + perPageCount;
|
|
36
|
+
if (recordIndex < endIndex) if (recordIndex < endIndex - perPageCount) table.scenegraph.clearCells(),
|
|
37
|
+
table.scenegraph.createSceneGraph(); else {
|
|
38
|
+
const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
|
|
39
|
+
if (oldRowCount - headerCount === table.pagination.perPageCount) {
|
|
40
|
+
const updateRows = [];
|
|
41
|
+
for (let row = rowNum; row < newRowCount; row++) table.transpose ? updateRows.push({
|
|
42
|
+
col: row,
|
|
43
|
+
row: 0
|
|
44
|
+
}) : updateRows.push({
|
|
45
|
+
col: 0,
|
|
46
|
+
row: row
|
|
47
|
+
});
|
|
48
|
+
table.transpose ? table.scenegraph.updateCol([], [], updateRows) : table.scenegraph.updateRow([], [], updateRows);
|
|
49
|
+
} else {
|
|
50
|
+
const addRows = [];
|
|
51
|
+
for (let row = rowNum; row < Math.min(newRowCount, rowNum + 1); row++) table.transpose ? addRows.push({
|
|
52
|
+
col: row,
|
|
53
|
+
row: 0
|
|
54
|
+
}) : addRows.push({
|
|
55
|
+
col: 0,
|
|
56
|
+
row: row
|
|
57
|
+
});
|
|
58
|
+
table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
const addRows = [];
|
|
63
|
+
for (let row = recordIndex + headerCount; row < recordIndex + headerCount + 1; row++) table.transpose ? addRows.push({
|
|
64
|
+
col: row,
|
|
65
|
+
row: 0
|
|
66
|
+
}) : addRows.push({
|
|
67
|
+
col: 0,
|
|
68
|
+
row: row
|
|
69
|
+
});
|
|
70
|
+
table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function listTableAddRecords(records, recordIndex, table) {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
if (table.options.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, records),
|
|
78
|
+
table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(),
|
|
79
|
+
table.scenegraph.createSceneGraph(); else if (table.sortState) table.dataSource.addRecordsForSorted(records),
|
|
80
|
+
sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(); else {
|
|
81
|
+
void 0 === recordIndex || recordIndex > table.dataSource.sourceLength ? recordIndex = table.dataSource.sourceLength : recordIndex < 0 && (recordIndex = 0);
|
|
82
|
+
const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
|
|
83
|
+
table.dataSource.addRecords(records, recordIndex);
|
|
84
|
+
const oldRowCount = table.transpose ? table.colCount : table.rowCount;
|
|
85
|
+
if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(),
|
|
86
|
+
void table.scenegraph.createSceneGraph();
|
|
87
|
+
const newRowCount = table.transpose ? table.colCount : table.rowCount;
|
|
88
|
+
if (table.pagination) {
|
|
89
|
+
const {perPageCount: perPageCount, currentPage: currentPage} = table.pagination, endIndex = perPageCount * (currentPage || 0) + perPageCount;
|
|
90
|
+
if (recordIndex < endIndex) if (recordIndex < endIndex - perPageCount) table.scenegraph.clearCells(),
|
|
91
|
+
table.scenegraph.createSceneGraph(); else {
|
|
92
|
+
const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
|
|
93
|
+
if (oldRowCount - headerCount === table.pagination.perPageCount) {
|
|
94
|
+
const updateRows = [];
|
|
95
|
+
for (let row = rowNum; row < newRowCount; row++) table.transpose ? updateRows.push({
|
|
96
|
+
col: row,
|
|
97
|
+
row: 0
|
|
98
|
+
}) : updateRows.push({
|
|
99
|
+
col: 0,
|
|
100
|
+
row: row
|
|
101
|
+
});
|
|
102
|
+
table.transpose ? table.scenegraph.updateCol([], [], updateRows) : table.scenegraph.updateRow([], [], updateRows);
|
|
103
|
+
} else {
|
|
104
|
+
const addRows = [];
|
|
105
|
+
for (let row = rowNum; row < Math.min(newRowCount, rowNum + (Array.isArray(records) ? records.length : 1)); row++) table.transpose ? addRows.push({
|
|
106
|
+
col: row,
|
|
107
|
+
row: 0
|
|
108
|
+
}) : addRows.push({
|
|
109
|
+
col: 0,
|
|
110
|
+
row: row
|
|
111
|
+
});
|
|
112
|
+
table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
} else {
|
|
116
|
+
const addRows = [];
|
|
117
|
+
for (let row = recordIndex + headerCount; row < recordIndex + headerCount + (Array.isArray(records) ? records.length : 1); row++) table.transpose ? addRows.push({
|
|
118
|
+
col: row,
|
|
119
|
+
row: 0
|
|
120
|
+
}) : addRows.push({
|
|
121
|
+
col: 0,
|
|
122
|
+
row: row
|
|
123
|
+
});
|
|
124
|
+
table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function listTableDeleteRecords(recordIndexs, table) {
|
|
130
|
+
var _a, _b;
|
|
131
|
+
if ((null == recordIndexs ? void 0 : recordIndexs.length) > 0) if (table.options.groupBy) null === (_b = (_a = table.dataSource).deleteRecordsForGroup) || void 0 === _b || _b.call(_a, recordIndexs),
|
|
132
|
+
table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(),
|
|
133
|
+
table.scenegraph.createSceneGraph(); else if (table.sortState) table.dataSource.deleteRecordsForSorted(recordIndexs),
|
|
134
|
+
sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(); else {
|
|
135
|
+
const deletedRecordIndexs = table.dataSource.deleteRecords(recordIndexs);
|
|
136
|
+
if (0 === deletedRecordIndexs.length) return;
|
|
137
|
+
const oldRowCount = table.transpose ? table.colCount : table.rowCount;
|
|
138
|
+
table.refreshRowColCount();
|
|
139
|
+
const newRowCount = table.transpose ? table.colCount : table.rowCount, recordIndexsMinToMax = deletedRecordIndexs.sort(((a, b) => a - b)), minRecordIndex = recordIndexsMinToMax[0];
|
|
140
|
+
if (table.pagination) {
|
|
141
|
+
const {perPageCount: perPageCount, currentPage: currentPage} = table.pagination, endIndex = perPageCount * (currentPage || 0) + perPageCount;
|
|
142
|
+
if (minRecordIndex < endIndex) if (minRecordIndex < endIndex - perPageCount) table.scenegraph.clearCells(),
|
|
143
|
+
table.scenegraph.createSceneGraph(); else {
|
|
144
|
+
const updateRows = [], delRows = [];
|
|
145
|
+
for (let row = minRecordIndex - (endIndex - perPageCount) + (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount); row < newRowCount; row++) table.transpose ? updateRows.push({
|
|
146
|
+
col: row,
|
|
147
|
+
row: 0
|
|
148
|
+
}) : updateRows.push({
|
|
149
|
+
col: 0,
|
|
150
|
+
row: row
|
|
151
|
+
});
|
|
152
|
+
if (newRowCount < oldRowCount) for (let row = newRowCount; row < oldRowCount; row++) table.transpose ? delRows.push({
|
|
153
|
+
col: row,
|
|
154
|
+
row: 0
|
|
155
|
+
}) : delRows.push({
|
|
156
|
+
col: 0,
|
|
157
|
+
row: row
|
|
158
|
+
});
|
|
159
|
+
table.transpose ? table.scenegraph.updateCol(delRows, [], updateRows) : table.scenegraph.updateRow(delRows, [], updateRows);
|
|
160
|
+
}
|
|
161
|
+
} else {
|
|
162
|
+
const delRows = [];
|
|
163
|
+
for (let index = 0; index < recordIndexsMinToMax.length; index++) {
|
|
164
|
+
const rowNum = recordIndexsMinToMax[index] + (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount);
|
|
165
|
+
table.transpose ? delRows.push({
|
|
166
|
+
col: rowNum,
|
|
167
|
+
row: 0
|
|
168
|
+
}) : delRows.push({
|
|
169
|
+
col: 0,
|
|
170
|
+
row: rowNum
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
table.transpose ? table.scenegraph.updateCol(delRows, [], []) : table.scenegraph.updateRow(delRows, [], []);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function listTableUpdateRecords(records, recordIndexs, table) {
|
|
179
|
+
var _a, _b;
|
|
180
|
+
if ((null == recordIndexs ? void 0 : recordIndexs.length) > 0) if (table.options.groupBy) null === (_b = (_a = table.dataSource).updateRecordsForGroup) || void 0 === _b || _b.call(_a, records, recordIndexs),
|
|
181
|
+
table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(),
|
|
182
|
+
table.scenegraph.createSceneGraph(); else if (table.sortState) table.dataSource.updateRecordsForSorted(records, recordIndexs),
|
|
183
|
+
sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(); else {
|
|
184
|
+
const updateRecordIndexs = table.dataSource.updateRecords(records, recordIndexs);
|
|
185
|
+
if (0 === updateRecordIndexs.length) return;
|
|
186
|
+
const recordIndexsMinToMax = updateRecordIndexs.sort(((a, b) => a - b));
|
|
187
|
+
if (table.pagination) {
|
|
188
|
+
const {perPageCount: perPageCount, currentPage: currentPage} = table.pagination, endIndex = perPageCount * (currentPage || 0) + perPageCount, updateRows = [];
|
|
189
|
+
for (let index = 0; index < recordIndexsMinToMax.length; index++) {
|
|
190
|
+
const recordIndex = recordIndexsMinToMax[index];
|
|
191
|
+
if (recordIndex < endIndex && recordIndex >= endIndex - perPageCount) {
|
|
192
|
+
const rowNum = recordIndex - (endIndex - perPageCount) + (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount);
|
|
193
|
+
updateRows.push(rowNum);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (updateRows.length >= 1) {
|
|
197
|
+
const updateRowCells = [];
|
|
198
|
+
for (let index = 0; index < updateRows.length; index++) {
|
|
199
|
+
const updateRow = updateRows[index];
|
|
200
|
+
table.transpose ? updateRowCells.push({
|
|
201
|
+
col: updateRow,
|
|
202
|
+
row: 0
|
|
203
|
+
}) : updateRowCells.push({
|
|
204
|
+
col: 0,
|
|
205
|
+
row: updateRow
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
table.transpose ? table.scenegraph.updateCol([], [], updateRowCells) : table.scenegraph.updateRow([], [], updateRowCells);
|
|
209
|
+
}
|
|
210
|
+
} else {
|
|
211
|
+
const updateRows = [];
|
|
212
|
+
for (let index = 0; index < recordIndexsMinToMax.length; index++) {
|
|
213
|
+
const rowNum = recordIndexsMinToMax[index] + (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount);
|
|
214
|
+
table.transpose ? updateRows.push({
|
|
215
|
+
col: rowNum,
|
|
216
|
+
row: 0
|
|
217
|
+
}) : updateRows.push({
|
|
218
|
+
col: 0,
|
|
219
|
+
row: rowNum
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
table.transpose ? table.scenegraph.updateCol([], [], updateRows) : table.scenegraph.updateRow([], [], updateRows);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
exports.sortRecords = sortRecords, exports.listTableAddRecord = listTableAddRecord,
|
|
228
|
+
exports.listTableAddRecords = listTableAddRecords, exports.listTableDeleteRecords = listTableDeleteRecords,
|
|
229
|
+
exports.listTableUpdateRecords = listTableUpdateRecords;
|
|
230
|
+
//# sourceMappingURL=record-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/record-helper.ts"],"names":[],"mappings":";;;AAGA,wCAA+C;AAG/C,SAAgB,WAAW,CAAC,KAAgB;;IAC1C,IAAI,KAAK,CAAC,SAAS,EAAE;QACnB,IAAI,KAAU,CAAC;QACf,IAAI,KAAU,CAAC;QACf,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE;YAClC,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;gBAChC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,MAAA,KAAK,CAAC,SAAS,0CAAG,CAAC,CAAC,CAAC,CAAC;aAC3C;SACF;aAAM;YACL,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,SAAsB,CAAC,CAAC;SACnD;QAED,IAAI,KAAK,IAAI,KAAK,IAAI,KAAK,KAAK,QAAQ,EAAE;YACxC,MAAM,QAAQ,GAAG,KAAK,CAAC,4BAA4B,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;YAEtE,MAAM,EAAE,GAAG,KAA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SAAS;wBACb,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC;wBACpD,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,CAAC;iBACxD;aACF;iBAAM;gBACL,MAAM,UAAU,GAAG,EAAE,CAAC;gBACtB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,oBAAoB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;oBAChE,MAAM,WAAW,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;oBAChD,MAAM,MAAM,GAAG,WAAW,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;oBAC1G,IAAI,KAAK,CAAC,SAAS,EAAE;wBACnB,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;qBAC1C;yBAAM;wBACL,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;qBAC1C;iBACF;gBACD,KAAK,CAAC,SAAS;oBACb,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,UAAU,CAAC;oBAChD,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;aACpD;SACF;KAEF;AACH,CAAC;AAtED,wDAsEC","file":"record-helper.js","sourcesContent":["/* eslint-disable max-depth */\nimport type { ListTable } from '../ListTable';\nimport type { CachedDataSource } from '../data';\nimport { defaultOrderFn } from '../tools/util';\nimport type { SortState } from '../ts-types';\n\nexport function sortRecords(table: ListTable) {\n if (table.sortState) {\n let order: any;\n let field: any;\n if (Array.isArray(table.sortState)) {\n if (table.sortState.length !== 0) {\n ({ order, field } = table.sortState?.[0]);\n }\n } else {\n ({ order, field } = table.sortState as SortState);\n }\n // 根据sort规则进行排序\n if (order && field && order !== 'normal') {\n const sortFunc = table._getSortFuncFromHeaderOption(undefined, field);\n // 如果sort传入的信息不能生成正确的sortFunc,直接更新表格,避免首次加载无法正常显示内容\n const hd = table.internalProps.layoutMap.headerObjects.find((col: any) => col && col.field === field);\n\n // hd?.define?.sort && //如果这里也判断 那想要利用sortState来排序 但不显示排序图标就实现不了\n table.dataSource.sort(hd.field, order, sortFunc ?? defaultOrderFn);\n }\n }\n}\n\n/**\n * 添加数据 单条数据\n * @param record 数据\n * @param recordIndex 向数据源中要插入的位置,从0开始。不设置recordIndex的话 默认追加到最后。\n * 如果设置了排序规则recordIndex无效,会自动适应排序逻辑确定插入顺序。\n * recordIndex 可以通过接口getRecordShowIndexByCell获取\n */\nexport function listTableAddRecord(record: any, recordIndex: number, table: ListTable) {\n if (table.options.groupBy) {\n (table.dataSource as CachedDataSource).addRecordsForGroup?.([record]);\n table.refreshRowColCount();\n table.internalProps.layoutMap.clearCellRangeMap();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else if (table.sortState) {\n table.dataSource.addRecordForSorted(record);\n sortRecords(table);\n table.refreshRowColCount();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else {\n if (recordIndex === undefined || recordIndex > table.dataSource.sourceLength) {\n recordIndex = table.dataSource.sourceLength;\n }\n const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;\n table.dataSource.addRecord(record, recordIndex);\n const oldRowCount = table.rowCount;\n table.refreshRowColCount();\n if (table.scenegraph.proxy.totalActualBodyRowCount === 0) {\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n return;\n }\n const newRowCount = table.transpose ? table.colCount : table.rowCount;\n if (table.pagination) {\n const { perPageCount, currentPage } = table.pagination;\n const startIndex = perPageCount * (currentPage || 0);\n const endIndex = startIndex + perPageCount;\n if (recordIndex < endIndex) {\n //插入当前页或者前面的数据才需要更新 如果是插入的是当前页后面的数据不需要更新场景树\n if (recordIndex < endIndex - perPageCount) {\n // 如果是当页之前的数据 则整个场景树都更新\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else {\n //如果是插入当前页数据\n const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;\n if (oldRowCount - headerCount === table.pagination.perPageCount) {\n //如果当页数据是满的 则更新插入的部分行\n const updateRows = [];\n for (let row = rowNum; row < newRowCount; row++) {\n if (table.transpose) {\n updateRows.push({ col: row, row: 0 });\n } else {\n updateRows.push({ col: 0, row });\n }\n }\n table.transpose\n ? table.scenegraph.updateCol([], [], updateRows)\n : table.scenegraph.updateRow([], [], updateRows);\n } else {\n //如果当页数据不是满的 则插入新数据\n const addRows = [];\n for (let row = rowNum; row < Math.min(newRowCount, rowNum + 1); row++) {\n if (table.transpose) {\n addRows.push({ col: row, row: 0 });\n } else {\n addRows.push({ col: 0, row });\n }\n }\n table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);\n }\n }\n }\n } else {\n const addRows = [];\n for (let row = recordIndex + headerCount; row < recordIndex + headerCount + 1; row++) {\n if (table.transpose) {\n addRows.push({ col: row, row: 0 });\n } else {\n addRows.push({ col: 0, row });\n }\n }\n table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);\n }\n }\n // table.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, { row });\n}\n\n/**\n * 添加数据 支持多条数据\n * @param records 多条数据\n * @param recordIndex 向数据源中要插入的位置,从0开始。不设置recordIndex的话 默认追加到最后。\n * 如果设置了排序规则recordIndex无效,会自动适应排序逻辑确定插入顺序。\n * recordIndex 可以通过接口getRecordShowIndexByCell获取\n */\nexport function listTableAddRecords(records: any[], recordIndex: number, table: ListTable) {\n if (table.options.groupBy) {\n (table.dataSource as CachedDataSource).addRecordsForGroup?.(records);\n table.refreshRowColCount();\n table.internalProps.layoutMap.clearCellRangeMap();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else if (table.sortState) {\n table.dataSource.addRecordsForSorted(records);\n sortRecords(table);\n table.refreshRowColCount();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else {\n if (recordIndex === undefined || recordIndex > table.dataSource.sourceLength) {\n recordIndex = table.dataSource.sourceLength;\n } else if (recordIndex < 0) {\n recordIndex = 0;\n }\n const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;\n table.dataSource.addRecords(records, recordIndex);\n const oldRowCount = table.transpose ? table.colCount : table.rowCount;\n table.refreshRowColCount();\n if (table.scenegraph.proxy.totalActualBodyRowCount === 0) {\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n return;\n }\n const newRowCount = table.transpose ? table.colCount : table.rowCount;\n if (table.pagination) {\n const { perPageCount, currentPage } = table.pagination;\n const startIndex = perPageCount * (currentPage || 0);\n const endIndex = startIndex + perPageCount;\n if (recordIndex < endIndex) {\n //插入当前页或者前面的数据才需要更新 如果是插入的是当前页后面的数据不需要更新场景树\n if (recordIndex < endIndex - perPageCount) {\n // 如果是当页之前的数据 则整个场景树都更新\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else {\n //如果是插入当前页数据\n\n const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;\n if (oldRowCount - headerCount === table.pagination.perPageCount) {\n //如果当页数据是满的 则更新插入的部分行\n const updateRows = [];\n for (let row = rowNum; row < newRowCount; row++) {\n if (table.transpose) {\n updateRows.push({ col: row, row: 0 });\n } else {\n updateRows.push({ col: 0, row });\n }\n }\n table.transpose\n ? table.scenegraph.updateCol([], [], updateRows)\n : table.scenegraph.updateRow([], [], updateRows);\n } else {\n //如果当页数据不是满的 则插入新数据\n const addRows = [];\n for (\n let row = rowNum;\n row < Math.min(newRowCount, rowNum + (Array.isArray(records) ? records.length : 1));\n row++\n ) {\n if (table.transpose) {\n addRows.push({ col: row, row: 0 });\n } else {\n addRows.push({ col: 0, row });\n }\n }\n table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);\n }\n }\n }\n } else {\n const addRows = [];\n for (\n let row = recordIndex + headerCount;\n row < recordIndex + headerCount + (Array.isArray(records) ? records.length : 1);\n row++\n ) {\n if (table.transpose) {\n addRows.push({ col: row, row: 0 });\n } else {\n addRows.push({ col: 0, row });\n }\n }\n table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);\n }\n }\n // table.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, { row });\n}\n\n/**\n * 删除数据 支持多条数据\n * @param recordIndexs 要删除数据的索引(显示在body中的索引,即要修改的是body部分的第几行数据)\n */\nexport function listTableDeleteRecords(recordIndexs: number[], table: ListTable) {\n if (recordIndexs?.length > 0) {\n if (table.options.groupBy) {\n (table.dataSource as CachedDataSource).deleteRecordsForGroup?.(recordIndexs);\n table.refreshRowColCount();\n table.internalProps.layoutMap.clearCellRangeMap();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else if (table.sortState) {\n table.dataSource.deleteRecordsForSorted(recordIndexs);\n sortRecords(table);\n table.refreshRowColCount();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else {\n const deletedRecordIndexs = table.dataSource.deleteRecords(recordIndexs);\n if (deletedRecordIndexs.length === 0) {\n return;\n }\n const oldRowCount = table.transpose ? table.colCount : table.rowCount;\n table.refreshRowColCount();\n const newRowCount = table.transpose ? table.colCount : table.rowCount;\n const recordIndexsMinToMax = deletedRecordIndexs.sort((a, b) => a - b);\n const minRecordIndex = recordIndexsMinToMax[0];\n if (table.pagination) {\n const { perPageCount, currentPage } = table.pagination;\n const startIndex = perPageCount * (currentPage || 0);\n const endIndex = startIndex + perPageCount;\n if (minRecordIndex < endIndex) {\n //删除当前页或者前面的数据才需要更新 如果是删除的是当前页后面的数据不需要更新场景树\n if (minRecordIndex < endIndex - perPageCount) {\n // 如果删除包含当页之前的数据 则整个场景树都更新\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else {\n //如果是仅删除当前页数据\n const minRowNum =\n minRecordIndex -\n (endIndex - perPageCount) +\n (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount);\n //如果当页数据是满的 则更新影响的部分行\n const updateRows = [];\n const delRows = [];\n\n for (let row = minRowNum; row < newRowCount; row++) {\n if (table.transpose) {\n updateRows.push({ col: row, row: 0 });\n } else {\n updateRows.push({ col: 0, row });\n }\n }\n if (newRowCount < oldRowCount) {\n //如果如果删除后不满 需要有删除数据\n for (let row = newRowCount; row < oldRowCount; row++) {\n if (table.transpose) {\n delRows.push({ col: row, row: 0 });\n } else {\n delRows.push({ col: 0, row });\n }\n }\n }\n table.transpose\n ? table.scenegraph.updateCol(delRows, [], updateRows)\n : table.scenegraph.updateRow(delRows, [], updateRows);\n }\n }\n } else {\n const delRows = [];\n\n for (let index = 0; index < recordIndexsMinToMax.length; index++) {\n const recordIndex = recordIndexsMinToMax[index];\n const rowNum = recordIndex + (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount);\n if (table.transpose) {\n delRows.push({ col: rowNum, row: 0 });\n } else {\n delRows.push({ col: 0, row: rowNum });\n }\n }\n table.transpose ? table.scenegraph.updateCol(delRows, [], []) : table.scenegraph.updateRow(delRows, [], []);\n }\n }\n // table.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, { row });\n }\n}\n\n/**\n * 修改数据 支持多条数据\n * @param records 修改数据条目\n * @param recordIndexs 对应修改数据的索引(显示在body中的索引,即要修改的是body部分的第几行数据)\n */\nexport function listTableUpdateRecords(records: any[], recordIndexs: number[], table: ListTable) {\n if (recordIndexs?.length > 0) {\n if (table.options.groupBy) {\n (table.dataSource as CachedDataSource).updateRecordsForGroup?.(records, recordIndexs);\n table.refreshRowColCount();\n table.internalProps.layoutMap.clearCellRangeMap();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else if (table.sortState) {\n table.dataSource.updateRecordsForSorted(records, recordIndexs);\n sortRecords(table);\n table.refreshRowColCount();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else {\n const updateRecordIndexs = table.dataSource.updateRecords(records, recordIndexs);\n if (updateRecordIndexs.length === 0) {\n return;\n }\n\n const recordIndexsMinToMax = updateRecordIndexs.sort((a, b) => a - b);\n if (table.pagination) {\n const { perPageCount, currentPage } = table.pagination;\n const startIndex = perPageCount * (currentPage || 0);\n const endIndex = startIndex + perPageCount;\n const updateRows = [];\n for (let index = 0; index < recordIndexsMinToMax.length; index++) {\n const recordIndex = recordIndexsMinToMax[index];\n if (recordIndex < endIndex && recordIndex >= endIndex - perPageCount) {\n const rowNum =\n recordIndex -\n (endIndex - perPageCount) +\n (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount);\n updateRows.push(rowNum);\n }\n }\n if (updateRows.length >= 1) {\n const updateRowCells = [];\n for (let index = 0; index < updateRows.length; index++) {\n const updateRow = updateRows[index];\n if (table.transpose) {\n updateRowCells.push({ col: updateRow, row: 0 });\n } else {\n updateRowCells.push({ col: 0, row: updateRow });\n }\n }\n table.transpose\n ? table.scenegraph.updateCol([], [], updateRowCells)\n : table.scenegraph.updateRow([], [], updateRowCells);\n }\n } else {\n const updateRows = [];\n for (let index = 0; index < recordIndexsMinToMax.length; index++) {\n const recordIndex = recordIndexsMinToMax[index];\n const rowNum = recordIndex + (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount);\n if (table.transpose) {\n updateRows.push({ col: rowNum, row: 0 });\n } else {\n updateRows.push({ col: 0, row: rowNum });\n }\n }\n table.transpose\n ? table.scenegraph.updateCol([], [], updateRows)\n : table.scenegraph.updateRow([], [], updateRows);\n }\n }\n // table.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, { row });\n }\n}\n"]}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
4
|
+
void 0 === k2 && (k2 = k);
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
desc && !("get" in desc ? !m.__esModule : desc.writable || desc.configurable) || (desc = {
|
|
7
|
+
enumerable: !0,
|
|
8
|
+
get: function() {
|
|
9
|
+
return m[k];
|
|
10
|
+
}
|
|
11
|
+
}), Object.defineProperty(o, k2, desc);
|
|
12
|
+
} : function(o, m, k, k2) {
|
|
13
|
+
void 0 === k2 && (k2 = k), o[k2] = m[k];
|
|
14
|
+
}), __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", {
|
|
16
|
+
enumerable: !0,
|
|
17
|
+
value: v
|
|
18
|
+
});
|
|
19
|
+
} : function(o, v) {
|
|
20
|
+
o.default = v;
|
|
21
|
+
}), __importStar = this && this.__importStar || function(mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (null != mod) for (var k in mod) "default" !== k && Object.prototype.hasOwnProperty.call(mod, k) && __createBinding(result, mod, k);
|
|
25
|
+
return __setModuleDefault(result, mod), result;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
Object.defineProperty(exports, "__esModule", {
|
|
29
|
+
value: !0
|
|
30
|
+
}), exports.getCellStyle = void 0;
|
|
31
|
+
|
|
32
|
+
const custom_cell_style_1 = require("../plugins/custom-cell-style"), get_axis_config_1 = require("../layout/chart-helper/get-axis-config"), vutils_1 = require("@visactor/vutils"), headerStyleContents = __importStar(require("../header-helper/style")), columnStyleContents = __importStar(require("../body-helper/style")), EMPTY_STYLE = {};
|
|
33
|
+
|
|
34
|
+
function getCellStyle(col, row, table) {
|
|
35
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
36
|
+
const customCellStyle = table.customCellStylePlugin.getCustomCellStyle(col, row), {layoutMap: layoutMap} = table.internalProps;
|
|
37
|
+
if (layoutMap.isHeader(col, row)) {
|
|
38
|
+
let cacheKey;
|
|
39
|
+
if (!table.isPivotTable() || table.isBottomFrozenRow(row) || table.isRightFrozenColumn(col)) cacheKey = `${col}-${row}`; else {
|
|
40
|
+
const define = table.getHeaderDefine(col, row), isCorner = table.isCornerHeader(col, row);
|
|
41
|
+
cacheKey = (null == define ? void 0 : define.dimensionKey) ? isCorner ? `dim-cor-${define.dimensionKey}` : `dim-${define.dimensionKey}` : (null == define ? void 0 : define.indicatorKey) ? `ind-${define.indicatorKey}` : `${col}-${row}`;
|
|
42
|
+
}
|
|
43
|
+
let cacheStyle = table.headerStyleCache.get(cacheKey);
|
|
44
|
+
if (cacheStyle) return customCellStyle ? (0, custom_cell_style_1.mergeStyle)(cacheStyle, customCellStyle) : cacheStyle;
|
|
45
|
+
const hd = layoutMap.getHeader(col, row);
|
|
46
|
+
let paddingForAxis;
|
|
47
|
+
if (table.isPivotChart() && (0, get_axis_config_1.isTopOrBottomAxis)(col, row, layoutMap) && layoutMap.isAxisCell(col, row)) {
|
|
48
|
+
paddingForAxis = null !== (_b = null === (_a = layoutMap.getBody(col, table.rowHeaderLevelCount).style) || void 0 === _a ? void 0 : _a.padding) && void 0 !== _b ? _b : table.theme.bodyStyle.padding;
|
|
49
|
+
} else if (table.isPivotChart() && (0, get_axis_config_1.isLeftOrRightAxis)(col, row, layoutMap) && layoutMap.isAxisCell(col, row)) {
|
|
50
|
+
paddingForAxis = null !== (_d = null === (_c = layoutMap.getBody(table.columnHeaderLevelCount, row).style) || void 0 === _c ? void 0 : _c.padding) && void 0 !== _d ? _d : table.theme.bodyStyle.padding;
|
|
51
|
+
}
|
|
52
|
+
if ((!hd || hd.isEmpty) && (layoutMap.isLeftBottomCorner(col, row) || layoutMap.isRightBottomCorner(col, row) || layoutMap.isCornerHeader(col, row) || layoutMap.isRightTopCorner(col, row))) return EMPTY_STYLE;
|
|
53
|
+
const styleClass = table.internalProps.headerHelper.getStyleClass((null == hd ? void 0 : hd.headerType) || "text");
|
|
54
|
+
if (layoutMap.isBottomFrozenRow(col, row) && table.theme.bottomFrozenStyle) cacheStyle = headerStyleContents.of(paddingForAxis ? {
|
|
55
|
+
padding: paddingForAxis
|
|
56
|
+
} : {}, table.theme.bottomFrozenStyle, {
|
|
57
|
+
col: col,
|
|
58
|
+
row: row,
|
|
59
|
+
table: table,
|
|
60
|
+
value: table.getCellValue(col, row),
|
|
61
|
+
dataValue: table.getCellOriginValue(col, row),
|
|
62
|
+
cellHeaderPaths: table.getCellHeaderPaths(col, row)
|
|
63
|
+
}, styleClass, table.options.autoWrapText, table.theme); else if (layoutMap.isRightFrozenColumn(col, row) && table.theme.rightFrozenStyle) cacheStyle = headerStyleContents.of(paddingForAxis ? {
|
|
64
|
+
padding: paddingForAxis
|
|
65
|
+
} : {}, table.theme.rightFrozenStyle, {
|
|
66
|
+
col: col,
|
|
67
|
+
row: row,
|
|
68
|
+
table: table,
|
|
69
|
+
value: table.getCellValue(col, row),
|
|
70
|
+
dataValue: table.getCellOriginValue(col, row),
|
|
71
|
+
cellHeaderPaths: table.getCellHeaderPaths(col, row)
|
|
72
|
+
}, styleClass, table.options.autoWrapText, table.theme); else {
|
|
73
|
+
const style = (null == hd ? void 0 : hd.style) || {};
|
|
74
|
+
paddingForAxis && (style.padding = paddingForAxis), cacheStyle = headerStyleContents.of(style, layoutMap.isColumnHeader(col, row) || layoutMap.isBottomFrozenRow(col, row) ? table.theme.headerStyle : layoutMap.isRowHeader(col, row) || layoutMap.isRightFrozenColumn(col, row) ? table.theme.rowHeaderStyle : table.theme.cornerHeaderStyle, {
|
|
75
|
+
col: col,
|
|
76
|
+
row: row,
|
|
77
|
+
table: table,
|
|
78
|
+
value: table.getCellValue(col, row),
|
|
79
|
+
dataValue: table.getCellOriginValue(col, row),
|
|
80
|
+
cellHeaderPaths: table.getCellHeaderPaths(col, row)
|
|
81
|
+
}, styleClass, table.options.autoWrapText, table.theme);
|
|
82
|
+
}
|
|
83
|
+
return table.headerStyleCache.set(cacheKey, cacheStyle), customCellStyle ? (0, custom_cell_style_1.mergeStyle)(cacheStyle, customCellStyle) : cacheStyle;
|
|
84
|
+
}
|
|
85
|
+
let bgColorFunc, cacheKey;
|
|
86
|
+
(null === (_f = null === (_e = table.internalProps) || void 0 === _e ? void 0 : _e.dataConfig) || void 0 === _f ? void 0 : _f.mappingRules) && !table.isHeader(col, row) && (null === (_j = null === (_h = null === (_g = table.internalProps) || void 0 === _g ? void 0 : _g.dataConfig) || void 0 === _h ? void 0 : _h.mappingRules) || void 0 === _j || _j.forEach(((mappingRule, i) => {
|
|
87
|
+
mappingRule.bgColor && table.internalProps.layoutMap.getIndicatorKey(col, row) === mappingRule.bgColor.indicatorKey && (bgColorFunc = mappingRule.bgColor.mapping);
|
|
88
|
+
})));
|
|
89
|
+
const cellType = table.getCellType(col, row), rawRecord = table.getCellOriginRecord(col, row);
|
|
90
|
+
let cacheStyle;
|
|
91
|
+
if (cacheKey = (null == rawRecord ? void 0 : rawRecord.vTableMerge) ? "merge-title" : table.isSeriesNumberInBody(col, row) ? `${col}-series-` + cellType : table.isListTable() && !table.transpose || table.isPivotTable() && table.internalProps.layoutMap.indicatorsAsCol ? col + cellType : row + cellType,
|
|
92
|
+
cacheStyle = (null == rawRecord ? void 0 : rawRecord.vTableMerge) ? table.bodyMergeTitleCache.get(cacheKey) : layoutMap.isBottomFrozenRow(row) ? table.bodyBottomStyleCache.get(cacheKey) : table.bodyStyleCache.get(cacheKey),
|
|
93
|
+
cacheStyle) return customCellStyle ? (0, custom_cell_style_1.mergeStyle)(cacheStyle, customCellStyle) : cacheStyle;
|
|
94
|
+
const column = layoutMap.getBody(col, row), styleClass = table.internalProps.bodyHelper.getStyleClass(table.getCellType(col, row)), style = null == column ? void 0 : column.style;
|
|
95
|
+
return cacheStyle = columnStyleContents.of(style, (null == rawRecord ? void 0 : rawRecord.vTableMerge) && table.theme.groupTitleStyle ? table.theme.groupTitleStyle : layoutMap.isBottomFrozenRow(row) && table.theme.bottomFrozenStyle ? table.theme.bottomFrozenStyle : layoutMap.isRightFrozenColumn(col) && table.theme.rightFrozenStyle ? table.theme.rightFrozenStyle : table.theme.bodyStyle, {
|
|
96
|
+
col: col,
|
|
97
|
+
row: row,
|
|
98
|
+
table: table,
|
|
99
|
+
value: table.getCellValue(col, row),
|
|
100
|
+
dataValue: table.getCellOriginValue(col, row),
|
|
101
|
+
cellHeaderPaths: table.getCellHeaderPaths(col, row)
|
|
102
|
+
}, styleClass, table.options.autoWrapText, table.theme), bgColorFunc && (cacheStyle = (0,
|
|
103
|
+
custom_cell_style_1.mergeStyle)(cacheStyle, {
|
|
104
|
+
bgColor: bgColorFunc
|
|
105
|
+
})), (0, vutils_1.isFunction)(style) || (layoutMap.isBottomFrozenRow(row) ? table.bodyBottomStyleCache.set(cacheKey, cacheStyle) : table.bodyStyleCache.set(cacheKey, cacheStyle)),
|
|
106
|
+
customCellStyle ? (0, custom_cell_style_1.mergeStyle)(cacheStyle, customCellStyle) : cacheStyle;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
exports.getCellStyle = getCellStyle;
|
|
110
|
+
//# sourceMappingURL=style-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/style-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oEAA0D;AAE1D,4EAA8F;AAC9F,6CAA8C;AAC9C,4EAA8D;AAC9D,0EAA4D;AAI5D,MAAM,WAAW,GAAG,EAAE,CAAC;AAQvB,SAAgB,YAAY,CAAC,GAAW,EAAE,GAAW,EAAE,KAAmB;;IACxE,MAAM,eAAe,GAAG,KAAK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K,CAAC,iBAAiB;YACnE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB;YAC/B,CAAC,CAAC,SAAS,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,gBAAgB;gBACpE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,gBAAgB;gBAC9B,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,EACzB;QACE,GAAG;QACH,GAAG;QACH,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC;QACnC,SAAS,EAAE,KAAK,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC;QAC7C,eAAe,EAAE,KAAK,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC;KACpD,EACD,UAAU,EACV,KAAK,CAAC,OAAO,CAAC,YAAY,EAC1B,KAAK,CAAC,KAAK,CACZ,CAAC;IACF,IAAI,WAAW,EAAE;QACf,UAAU,GAAG,IAAA,8BAAU,EAAC,UAAiB,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;KACtE;IACD,IAAI,CAAC,IAAA,mBAAU,EAAC,KAAK,CAAC,EAAE;QACtB,IAAI,SAAS,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE;YACpC,KAAK,CAAC,oBAAoB,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;SACtD;aAAM;YACL,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;SAChD;KACF;IACD,IAAI,eAAe,EAAE;QACnB,OAAO,IAAA,8BAAU,EAAC,UAAiB,EAAE,eAAe,CAAC,CAAC;KACvD;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAxOD,oCAwOC","file":"style-helper.js","sourcesContent":["import { mergeStyle } from '../plugins/custom-cell-style';\nimport type { PivotHeaderLayoutMap } from '../layout/pivot-header-layout';\nimport { isLeftOrRightAxis, isTopOrBottomAxis } from '../layout/chart-helper/get-axis-config';\nimport { isFunction } from '@visactor/vutils';\nimport * as headerStyleContents from '../header-helper/style';\nimport * as columnStyleContents from '../body-helper/style';\nimport type { BaseTableAPI, HeaderData, PivotTableProtected } from '../ts-types/base-table';\nimport type { ColorPropertyDefine, FullExtendStyle, MappingRule } from '../ts-types';\n\nconst EMPTY_STYLE = {};\n\n/**\n * 获取单元格的样式 内部逻辑使用 获取到的样式并不是计算后的\n * @param col\n * @param row\n * @returns\n */\nexport function getCellStyle(col: number, row: number, table: BaseTableAPI): FullExtendStyle {\n const customCellStyle = table.customCellStylePlugin.getCustomCellStyle(col, row);\n const { layoutMap } = table.internalProps;\n const isHeader = layoutMap.isHeader(col, row);\n if (isHeader) {\n // const cacheKey = `${col}-${row}`;\n let cacheKey;\n if (table.isPivotTable() && !table.isBottomFrozenRow(row) && !table.isRightFrozenColumn(col)) {\n // use dimensionKey&indicatorKey to cache style object in pivot table\n const define = table.getHeaderDefine(col, row) as any;\n const isCorner = table.isCornerHeader(col, row);\n cacheKey = define?.dimensionKey\n ? isCorner\n ? `dim-cor-${define.dimensionKey}`\n : `dim-${define.dimensionKey}`\n : define?.indicatorKey\n ? `ind-${define.indicatorKey}`\n : `${col}-${row}`;\n } else {\n cacheKey = `${col}-${row}`;\n }\n let cacheStyle = table.headerStyleCache.get(cacheKey);\n if (cacheStyle) {\n if (customCellStyle) {\n return mergeStyle(cacheStyle, customCellStyle);\n }\n return cacheStyle;\n }\n const hd = layoutMap.getHeader(col, row);\n\n let paddingForAxis;\n if (\n table.isPivotChart() &&\n isTopOrBottomAxis(col, row, layoutMap as PivotHeaderLayoutMap) &&\n layoutMap.isAxisCell(col, row)\n ) {\n // get chart padding for axis cell\n const chartColumn = layoutMap.getBody(col, table.rowHeaderLevelCount);\n const padding = (chartColumn.style as any)?.padding ?? table.theme.bodyStyle.padding;\n paddingForAxis = padding;\n } else if (\n table.isPivotChart() &&\n isLeftOrRightAxis(col, row, layoutMap as PivotHeaderLayoutMap) &&\n layoutMap.isAxisCell(col, row)\n ) {\n // get chart padding for axis cell\n const chartColumn = layoutMap.getBody(table.columnHeaderLevelCount, row);\n const padding = (chartColumn.style as any)?.padding ?? table.theme.bodyStyle.padding;\n paddingForAxis = padding;\n }\n\n if (\n (!hd || (hd as HeaderData).isEmpty) &&\n (layoutMap.isLeftBottomCorner(col, row) ||\n layoutMap.isRightBottomCorner(col, row) ||\n layoutMap.isCornerHeader(col, row) ||\n layoutMap.isRightTopCorner(col, row))\n ) {\n return EMPTY_STYLE;\n }\n\n const styleClass = table.internalProps.headerHelper.getStyleClass((hd as HeaderData)?.headerType || 'text');\n if (layoutMap.isBottomFrozenRow(col, row) && table.theme.bottomFrozenStyle) {\n cacheStyle = <FullExtendStyle>headerStyleContents.of(\n paddingForAxis ? { padding: paddingForAxis } : {},\n table.theme.bottomFrozenStyle,\n {\n col,\n row,\n table: table as BaseTableAPI,\n value: table.getCellValue(col, row),\n dataValue: table.getCellOriginValue(col, row),\n cellHeaderPaths: table.getCellHeaderPaths(col, row)\n },\n styleClass,\n table.options.autoWrapText,\n table.theme\n );\n } else if (layoutMap.isRightFrozenColumn(col, row) && table.theme.rightFrozenStyle) {\n cacheStyle = <FullExtendStyle>headerStyleContents.of(\n paddingForAxis ? { padding: paddingForAxis } : {},\n table.theme.rightFrozenStyle,\n {\n col,\n row,\n table: table as BaseTableAPI,\n value: table.getCellValue(col, row),\n dataValue: table.getCellOriginValue(col, row),\n cellHeaderPaths: table.getCellHeaderPaths(col, row)\n },\n styleClass,\n table.options.autoWrapText,\n table.theme\n );\n } else {\n // let defaultStyle;\n // if (layoutMap.isColumnHeader(col, row) || layoutMap.isBottomFrozenRow(col, row)) {\n // defaultStyle = table.theme.headerStyle;\n // } else if (table.internalProps.transpose && layoutMap.isRowHeader(col, row)) {\n // defaultStyle = table.theme.headerStyle;\n // } else if (layoutMap.isRowHeader(col, row) || layoutMap.isRightFrozenColumn(col, row)) {\n // defaultStyle = table.theme.rowHeaderStyle;\n // } else {\n // defaultStyle = table.theme.cornerHeaderStyle;\n // }\n // const styleClass = hd.headerType.StyleClass; //BaseHeader文件\n // const { style } = hd;\n const style = hd?.style || {};\n if (paddingForAxis) {\n (style as any).padding = paddingForAxis;\n }\n cacheStyle = <FullExtendStyle>headerStyleContents.of(\n style,\n // defaultStyle,\n layoutMap.isColumnHeader(col, row) || layoutMap.isBottomFrozenRow(col, row)\n ? table.theme.headerStyle\n : layoutMap.isRowHeader(col, row) || layoutMap.isRightFrozenColumn(col, row)\n ? table.theme.rowHeaderStyle\n : table.theme.cornerHeaderStyle,\n {\n col,\n row,\n table: table as BaseTableAPI,\n value: table.getCellValue(col, row),\n dataValue: table.getCellOriginValue(col, row),\n cellHeaderPaths: table.getCellHeaderPaths(col, row)\n },\n styleClass,\n table.options.autoWrapText,\n table.theme\n );\n }\n table.headerStyleCache.set(cacheKey, cacheStyle);\n if (customCellStyle) {\n return mergeStyle(cacheStyle, customCellStyle);\n }\n return cacheStyle;\n }\n\n let bgColorFunc: ColorPropertyDefine;\n // 判断是否有mapping 遍历dataset中mappingRules\n if ((table.internalProps as PivotTableProtected)?.dataConfig?.mappingRules && !table.isHeader(col, row)) {\n (table.internalProps as PivotTableProtected)?.dataConfig?.mappingRules?.forEach(\n (mappingRule: MappingRule, i: number) => {\n if (\n mappingRule.bgColor &&\n (table.internalProps.layoutMap as PivotHeaderLayoutMap).getIndicatorKey(col, row) ===\n mappingRule.bgColor.indicatorKey\n ) {\n bgColorFunc = mappingRule.bgColor.mapping;\n }\n }\n );\n // // 判断是否有mapping 遍历dataset中mappingRules 但这里还需要根据fieldName来判断\n // if (bgColorFunc && typeof bgColorFunc === 'function') {\n // const cellValue = table.getCellOriginValue(col, row);\n // bgColor = bgColorFunc(this, cellValue);\n // }\n }\n\n let cacheKey;\n const cellType = table.getCellType(col, row);\n const rawRecord = table.getCellOriginRecord(col, row);\n\n //如果是主体部分,获取相应的style\n if (rawRecord?.vTableMerge) {\n cacheKey = 'merge-title';\n } else if (table.isSeriesNumberInBody(col, row)) {\n // 如果是行序号\n cacheKey = `${col}-series-` + cellType;\n } else if (\n (table.isListTable() && !(table as any).transpose) ||\n (table.isPivotTable() && (table.internalProps.layoutMap as PivotHeaderLayoutMap).indicatorsAsCol)\n ) {\n cacheKey = col + cellType;\n } else {\n cacheKey = row + cellType;\n }\n let cacheStyle;\n\n if (rawRecord?.vTableMerge) {\n cacheStyle = table.bodyMergeTitleCache.get(cacheKey);\n } else if (layoutMap.isBottomFrozenRow(row)) {\n cacheStyle = table.bodyBottomStyleCache.get(cacheKey);\n } else {\n cacheStyle = table.bodyStyleCache.get(cacheKey);\n }\n if (cacheStyle) {\n if (customCellStyle) {\n return mergeStyle(cacheStyle, customCellStyle);\n }\n return cacheStyle;\n }\n const column = layoutMap.getBody(col, row);\n // const styleClass = column?.cellType?.StyleClass; //BaseColumn文件\n const styleClass = table.internalProps.bodyHelper.getStyleClass(table.getCellType(col, row));\n const style = column?.style;\n cacheStyle = <FullExtendStyle>columnStyleContents.of(\n style,\n rawRecord?.vTableMerge && table.theme.groupTitleStyle\n ? table.theme.groupTitleStyle\n : layoutMap.isBottomFrozenRow(row) && table.theme.bottomFrozenStyle\n ? table.theme.bottomFrozenStyle\n : layoutMap.isRightFrozenColumn(col) && table.theme.rightFrozenStyle\n ? table.theme.rightFrozenStyle\n : table.theme.bodyStyle,\n {\n col,\n row,\n table: table,\n value: table.getCellValue(col, row),\n dataValue: table.getCellOriginValue(col, row),\n cellHeaderPaths: table.getCellHeaderPaths(col, row)\n },\n styleClass,\n table.options.autoWrapText,\n table.theme\n );\n if (bgColorFunc) {\n cacheStyle = mergeStyle(cacheStyle as any, { bgColor: bgColorFunc });\n }\n if (!isFunction(style)) {\n if (layoutMap.isBottomFrozenRow(row)) {\n table.bodyBottomStyleCache.set(cacheKey, cacheStyle);\n } else {\n table.bodyStyleCache.set(cacheKey, cacheStyle);\n }\n }\n if (customCellStyle) {\n return mergeStyle(cacheStyle as any, customCellStyle);\n }\n return cacheStyle;\n}\n"]}
|
|
@@ -4,7 +4,6 @@ import { DataSource } from '../data';
|
|
|
4
4
|
import { Rect } from '../tools/Rect';
|
|
5
5
|
import type { FullExtendStyle, ListTableAPI } from '../ts-types';
|
|
6
6
|
import type { BaseTableAPI } from '../ts-types/base-table';
|
|
7
|
-
import type { ListTable } from '../ListTable';
|
|
8
7
|
export declare function createRootElement(padding: any): HTMLElement;
|
|
9
8
|
export declare function updateRootElementPadding(element: HTMLElement, padding: any): void;
|
|
10
9
|
export declare function _dealWithUpdateDataSource(table: BaseTableAPI, fn: (table: BaseTableAPI) => void): void;
|
|
@@ -38,6 +37,5 @@ export declare function getStyleTheme(headerStyle: FullExtendStyle, table: BaseT
|
|
|
38
37
|
};
|
|
39
38
|
hasFunctionPros: boolean;
|
|
40
39
|
};
|
|
41
|
-
export declare function sortRecords(table: ListTable): void;
|
|
42
40
|
export declare function getCellCornerRadius(col: number, row: number, table: BaseTableAPI): number[] | 0;
|
|
43
41
|
export declare function parseMarkLineGetExtendRange(markLine: any): number | 'sum' | 'max';
|
package/cjs/core/tableHelper.js
CHANGED
|
@@ -27,9 +27,9 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
27
27
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", {
|
|
29
29
|
value: !0
|
|
30
|
-
}), exports.parseMarkLineGetExtendRange = exports.getCellCornerRadius = exports.
|
|
30
|
+
}), exports.parseMarkLineGetExtendRange = exports.getCellCornerRadius = exports.getStyleTheme = exports._getScrollableVisibleRect = exports.isAutoDefine = exports._applyColWidthLimits = exports._toPxWidth = exports._getTargetFrozenColAt = exports._getTargetFrozenRowAt = exports._setDataSource = exports._setRecords = exports._dealWithUpdateDataSource = exports.updateRootElementPadding = exports.createRootElement = void 0;
|
|
31
31
|
|
|
32
|
-
const data_1 = require("../data"), font_1 = require("../scenegraph/utils/font"), padding_1 = require("../scenegraph/utils/padding"), Rect_1 = require("../tools/Rect"), calc = __importStar(require("../tools/calc"))
|
|
32
|
+
const data_1 = require("../data"), font_1 = require("../scenegraph/utils/font"), padding_1 = require("../scenegraph/utils/padding"), Rect_1 = require("../tools/Rect"), calc = __importStar(require("../tools/calc"));
|
|
33
33
|
|
|
34
34
|
function createRootElement(padding) {
|
|
35
35
|
var _a, _b;
|
|
@@ -60,13 +60,17 @@ function _dealWithUpdateDataSource(table, fn) {
|
|
|
60
60
|
|
|
61
61
|
function _setRecords(table, records = []) {
|
|
62
62
|
_dealWithUpdateDataSource(table, (() => {
|
|
63
|
-
var _a, _b;
|
|
64
63
|
table.internalProps.records = records;
|
|
65
|
-
const newDataSource = table.internalProps.dataSource = data_1.CachedDataSource.ofArray(records, table.internalProps.dataConfig, table.pagination, table.internalProps.layoutMap.columnObjects, table.internalProps.layoutMap.rowHierarchyType,
|
|
64
|
+
const newDataSource = table.internalProps.dataSource = data_1.CachedDataSource.ofArray(records, table.internalProps.dataConfig, table.pagination, table.internalProps.layoutMap.columnObjects, table.internalProps.layoutMap.rowHierarchyType, getHierarchyExpandLevel(table));
|
|
66
65
|
table.addReleaseObj(newDataSource);
|
|
67
66
|
}));
|
|
68
67
|
}
|
|
69
68
|
|
|
69
|
+
function getHierarchyExpandLevel(table) {
|
|
70
|
+
var _a;
|
|
71
|
+
return table.options.hierarchyExpandLevel ? table.options.hierarchyExpandLevel : table.options.groupBy ? 1 / 0 : (null === (_a = table._hasHierarchyTreeHeader) || void 0 === _a ? void 0 : _a.call(table)) ? 1 : void 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
70
74
|
function _setDataSource(table, dataSource) {
|
|
71
75
|
_dealWithUpdateDataSource(table, (() => {
|
|
72
76
|
if (dataSource) if (dataSource instanceof data_1.DataSource) table.internalProps.dataSource = dataSource; else {
|
|
@@ -189,18 +193,6 @@ function getStyleTheme(headerStyle, table, col, row, getProp, needGetTheme = !0)
|
|
|
189
193
|
};
|
|
190
194
|
}
|
|
191
195
|
|
|
192
|
-
function sortRecords(table) {
|
|
193
|
-
var _a;
|
|
194
|
-
if (table.sortState) {
|
|
195
|
-
let order, field;
|
|
196
|
-
if (Array.isArray(table.sortState) ? 0 !== table.sortState.length && ({order: order, field: field} = null === (_a = table.sortState) || void 0 === _a ? void 0 : _a[0]) : ({order: order, field: field} = table.sortState),
|
|
197
|
-
order && field && "normal" !== order) {
|
|
198
|
-
const sortFunc = table._getSortFuncFromHeaderOption(void 0, field), hd = table.internalProps.layoutMap.headerObjects.find((col => col && col.field === field));
|
|
199
|
-
table.dataSource.sort(hd.field, order, null != sortFunc ? sortFunc : util_1.defaultOrderFn);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
196
|
function getCellCornerRadius(col, row, table) {
|
|
205
197
|
const tableCornerRadius = table.theme.frameStyle.cornerRadius;
|
|
206
198
|
if (tableCornerRadius) {
|
|
@@ -244,6 +236,5 @@ exports._setDataSource = _setDataSource, exports._getTargetFrozenRowAt = _getTar
|
|
|
244
236
|
exports._getTargetFrozenColAt = _getTargetFrozenColAt, exports._toPxWidth = _toPxWidth,
|
|
245
237
|
exports._applyColWidthLimits = _applyColWidthLimits, exports.isAutoDefine = isAutoDefine,
|
|
246
238
|
exports._getScrollableVisibleRect = _getScrollableVisibleRect, exports.getStyleTheme = getStyleTheme,
|
|
247
|
-
exports.
|
|
248
|
-
exports.parseMarkLineGetExtendRange = parseMarkLineGetExtendRange;
|
|
239
|
+
exports.getCellCornerRadius = getCellCornerRadius, exports.parseMarkLineGetExtendRange = parseMarkLineGetExtendRange;
|
|
249
240
|
//# sourceMappingURL=tableHelper.js.map
|