@visactor/vtable 1.22.11-alpha.1 → 1.22.11-alpha.2
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 +30 -9
- package/cjs/ListTable.js +102 -11
- package/cjs/ListTable.js.map +1 -1
- package/cjs/core/BaseTable.js +1 -1
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/record-helper.d.ts +2 -5
- package/cjs/core/record-helper.js +31 -14
- package/cjs/core/record-helper.js.map +1 -1
- package/cjs/data/DataSource.d.ts +1 -0
- package/cjs/data/DataSource.js +25 -3
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/event/event.d.ts +2 -1
- package/cjs/event/event.js +20 -15
- package/cjs/event/event.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/ts-types/table-engine.d.ts +29 -8
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +290 -61
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +30 -9
- package/es/ListTable.js +98 -10
- package/es/ListTable.js.map +1 -1
- package/es/core/BaseTable.js +1 -1
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/record-helper.d.ts +2 -5
- package/es/core/record-helper.js +31 -14
- package/es/core/record-helper.js.map +1 -1
- package/es/data/DataSource.d.ts +1 -0
- package/es/data/DataSource.js +25 -3
- package/es/data/DataSource.js.map +1 -1
- package/es/event/event.d.ts +2 -1
- package/es/event/event.js +20 -15
- package/es/event/event.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/ts-types/table-engine.d.ts +29 -8
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +2 -2
package/dist/vtable.js
CHANGED
|
@@ -38927,6 +38927,48 @@
|
|
|
38927
38927
|
}
|
|
38928
38928
|
}
|
|
38929
38929
|
}
|
|
38930
|
+
changeFieldValueByRecordIndex(value, recordIndex, field, table) {
|
|
38931
|
+
if (field === null) {
|
|
38932
|
+
return undefined;
|
|
38933
|
+
}
|
|
38934
|
+
if (recordIndex === undefined || recordIndex === null) {
|
|
38935
|
+
return;
|
|
38936
|
+
}
|
|
38937
|
+
const rawKey = recordIndex.toString();
|
|
38938
|
+
if (!this.beforeChangedRecordsMap.has(rawKey)) {
|
|
38939
|
+
const rawRecords = Array.isArray(this.dataSourceObj?.records)
|
|
38940
|
+
? this.dataSourceObj.records
|
|
38941
|
+
: null;
|
|
38942
|
+
const originRecord = rawRecords
|
|
38943
|
+
? Array.isArray(recordIndex)
|
|
38944
|
+
? getValueFromDeepArray(rawRecords, recordIndex)
|
|
38945
|
+
: rawRecords[recordIndex]
|
|
38946
|
+
: undefined;
|
|
38947
|
+
this.beforeChangedRecordsMap.set(rawKey, cloneDeep(originRecord, undefined, ['vtable_gantt_linkedFrom', 'vtable_gantt_linkedTo']) ?? {});
|
|
38948
|
+
}
|
|
38949
|
+
if (typeof field === 'string' || typeof field === 'number') {
|
|
38950
|
+
const beforeChangedValue = this.beforeChangedRecordsMap.get(rawKey)?.[field];
|
|
38951
|
+
const rawRecords = Array.isArray(this.dataSourceObj?.records)
|
|
38952
|
+
? this.dataSourceObj.records
|
|
38953
|
+
: null;
|
|
38954
|
+
const record = rawRecords
|
|
38955
|
+
? Array.isArray(recordIndex)
|
|
38956
|
+
? getValueFromDeepArray(rawRecords, recordIndex)
|
|
38957
|
+
: rawRecords[recordIndex]
|
|
38958
|
+
: undefined;
|
|
38959
|
+
let formatValue = value;
|
|
38960
|
+
if (typeof beforeChangedValue === 'number' && isAllDigits(value)) {
|
|
38961
|
+
formatValue = parseFloat(value);
|
|
38962
|
+
}
|
|
38963
|
+
if (record) {
|
|
38964
|
+
record[field] = formatValue;
|
|
38965
|
+
}
|
|
38966
|
+
else if (rawRecords && typeof recordIndex === 'number') {
|
|
38967
|
+
rawRecords[recordIndex] = this.addRecordRule === 'Array' ? [] : {};
|
|
38968
|
+
rawRecords[recordIndex][field] = formatValue;
|
|
38969
|
+
}
|
|
38970
|
+
}
|
|
38971
|
+
}
|
|
38930
38972
|
cacheBeforeChangedRecord(dataIndex, table) {
|
|
38931
38973
|
if (!this.beforeChangedRecordsMap.has(dataIndex.toString())) {
|
|
38932
38974
|
const originRecord = this.getOriginalRecord(dataIndex);
|
|
@@ -39048,11 +39090,20 @@
|
|
|
39048
39090
|
}
|
|
39049
39091
|
}
|
|
39050
39092
|
adjustBeforeChangedRecordsMap(insertIndex, insertCount, type = 'add') {
|
|
39051
|
-
const
|
|
39052
|
-
|
|
39093
|
+
const delta = type === 'add' ? insertCount : -insertCount;
|
|
39094
|
+
const numericKeys = [];
|
|
39095
|
+
this.beforeChangedRecordsMap.forEach((_, key) => {
|
|
39096
|
+
const numKey = Number(key);
|
|
39097
|
+
if (Number.isInteger(numKey) && numKey.toString() === key && numKey >= insertIndex) {
|
|
39098
|
+
numericKeys.push(numKey);
|
|
39099
|
+
}
|
|
39100
|
+
});
|
|
39101
|
+
numericKeys.sort((a, b) => (type === 'add' ? b - a : a - b));
|
|
39102
|
+
for (let i = 0; i < numericKeys.length; i++) {
|
|
39103
|
+
const key = numericKeys[i];
|
|
39053
39104
|
const record = this.beforeChangedRecordsMap.get(key.toString());
|
|
39054
39105
|
this.beforeChangedRecordsMap.delete(key.toString());
|
|
39055
|
-
this.beforeChangedRecordsMap.set((key +
|
|
39106
|
+
this.beforeChangedRecordsMap.set((key + delta).toString(), record);
|
|
39056
39107
|
}
|
|
39057
39108
|
}
|
|
39058
39109
|
deleteRecords(recordIndexs) {
|
|
@@ -39219,7 +39270,11 @@
|
|
|
39219
39270
|
}
|
|
39220
39271
|
}
|
|
39221
39272
|
if (!filedMapArray.length) {
|
|
39222
|
-
filedMapArray = states.map(() => ({
|
|
39273
|
+
filedMapArray = states.map(() => ({
|
|
39274
|
+
asc: [],
|
|
39275
|
+
desc: [],
|
|
39276
|
+
normal: []
|
|
39277
|
+
}));
|
|
39223
39278
|
for (let index = 0; index < states.length; index++) {
|
|
39224
39279
|
this.sortedIndexMap.set(states[index].field, filedMapArray[index]);
|
|
39225
39280
|
}
|
|
@@ -65450,6 +65505,7 @@
|
|
|
65450
65505
|
cutOperationTime = 0;
|
|
65451
65506
|
lastClipboardContent = '';
|
|
65452
65507
|
cutCellRange = null;
|
|
65508
|
+
cutRanges = null;
|
|
65453
65509
|
copySourceRange = null;
|
|
65454
65510
|
constructor(table) {
|
|
65455
65511
|
this.table = table;
|
|
@@ -65969,6 +66025,10 @@
|
|
|
65969
66025
|
this.handleCopy(e, true);
|
|
65970
66026
|
this.cutWaitPaste = true;
|
|
65971
66027
|
this.cutCellRange = this.table.getSelectedCellInfos();
|
|
66028
|
+
this.cutRanges = this.table.stateManager.select.ranges?.map(r => ({
|
|
66029
|
+
start: { col: r.start.col, row: r.start.row },
|
|
66030
|
+
end: { col: r.end.col, row: r.end.row }
|
|
66031
|
+
}));
|
|
65972
66032
|
if (this.clipboardCheckTimer) {
|
|
65973
66033
|
clearTimeout(this.clipboardCheckTimer);
|
|
65974
66034
|
}
|
|
@@ -65976,6 +66036,7 @@
|
|
|
65976
66036
|
if (this.cutWaitPaste) {
|
|
65977
66037
|
this.cutWaitPaste = false;
|
|
65978
66038
|
this.cutCellRange = null;
|
|
66039
|
+
this.cutRanges = null;
|
|
65979
66040
|
this.clipboardCheckTimer = null;
|
|
65980
66041
|
}
|
|
65981
66042
|
}, 30000);
|
|
@@ -65995,6 +66056,7 @@
|
|
|
65995
66056
|
if (this.cutWaitPaste) {
|
|
65996
66057
|
this.cutWaitPaste = false;
|
|
65997
66058
|
this.cutCellRange = null;
|
|
66059
|
+
this.cutRanges = null;
|
|
65998
66060
|
if (this.clipboardCheckTimer) {
|
|
65999
66061
|
clearTimeout(this.clipboardCheckTimer);
|
|
66000
66062
|
this.clipboardCheckTimer = null;
|
|
@@ -66110,23 +66172,11 @@
|
|
|
66110
66172
|
}
|
|
66111
66173
|
clearCutArea(table) {
|
|
66112
66174
|
try {
|
|
66113
|
-
const
|
|
66114
|
-
if (!
|
|
66175
|
+
const ranges = this.cutRanges;
|
|
66176
|
+
if (!ranges || ranges.length === 0) {
|
|
66115
66177
|
return;
|
|
66116
66178
|
}
|
|
66117
|
-
|
|
66118
|
-
for (let i = 0; i < selectCells.length; i++) {
|
|
66119
|
-
for (let j = 0; j < selectCells[i].length; j++) {
|
|
66120
|
-
if (selectCells[i][j]) {
|
|
66121
|
-
changeValues.push({
|
|
66122
|
-
col: selectCells[i][j].col,
|
|
66123
|
-
row: selectCells[i][j].row,
|
|
66124
|
-
value: undefined
|
|
66125
|
-
});
|
|
66126
|
-
}
|
|
66127
|
-
}
|
|
66128
|
-
}
|
|
66129
|
-
table.changeCellValuesByIds(changeValues);
|
|
66179
|
+
table.changeCellValuesByIds(ranges, '');
|
|
66130
66180
|
}
|
|
66131
66181
|
catch (error) {
|
|
66132
66182
|
}
|
|
@@ -70176,7 +70226,7 @@
|
|
|
70176
70226
|
return TABLE_EVENT_TYPE;
|
|
70177
70227
|
}
|
|
70178
70228
|
options;
|
|
70179
|
-
version = "1.22.11-alpha.
|
|
70229
|
+
version = "1.22.11-alpha.2";
|
|
70180
70230
|
pagination;
|
|
70181
70231
|
id = `VTable${Date.now()}`;
|
|
70182
70232
|
headerStyleCache;
|
|
@@ -76468,28 +76518,65 @@
|
|
|
76468
76518
|
table.scenegraph.updateNextFrame();
|
|
76469
76519
|
return changedCellResults;
|
|
76470
76520
|
}
|
|
76471
|
-
async function listTableChangeCellValuesByIds(
|
|
76521
|
+
async function listTableChangeCellValuesByIds(ranges, value, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
|
|
76472
76522
|
const resultChangeValues = [];
|
|
76473
|
-
|
|
76474
|
-
|
|
76475
|
-
|
|
76476
|
-
const
|
|
76477
|
-
const
|
|
76478
|
-
const
|
|
76479
|
-
|
|
76480
|
-
|
|
76481
|
-
|
|
76482
|
-
|
|
76483
|
-
|
|
76484
|
-
|
|
76485
|
-
|
|
76486
|
-
|
|
76487
|
-
|
|
76488
|
-
|
|
76489
|
-
|
|
76523
|
+
const processed = new Set();
|
|
76524
|
+
const nextValue = (value ?? '');
|
|
76525
|
+
for (let i = 0; i < (ranges?.length ?? 0); i++) {
|
|
76526
|
+
const range = ranges[i];
|
|
76527
|
+
const startCol = Math.min(range.start.col, range.end.col);
|
|
76528
|
+
const endCol = Math.max(range.start.col, range.end.col);
|
|
76529
|
+
const startRow = Math.min(range.start.row, range.end.row);
|
|
76530
|
+
const endRow = Math.max(range.start.row, range.end.row);
|
|
76531
|
+
if (startCol > endCol || startRow > endRow) {
|
|
76532
|
+
continue;
|
|
76533
|
+
}
|
|
76534
|
+
const values = [];
|
|
76535
|
+
const oldValues = [];
|
|
76536
|
+
for (let row = startRow; row <= endRow; row++) {
|
|
76537
|
+
const rowValues = [];
|
|
76538
|
+
const rowOldValues = [];
|
|
76539
|
+
for (let col = startCol; col <= endCol; col++) {
|
|
76540
|
+
rowValues.push(nextValue);
|
|
76541
|
+
rowOldValues.push(table.getCellOriginValue(col, row));
|
|
76542
|
+
}
|
|
76543
|
+
values.push(rowValues);
|
|
76544
|
+
oldValues.push(rowOldValues);
|
|
76545
|
+
}
|
|
76546
|
+
const changedCellResults = await listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, true);
|
|
76547
|
+
for (let r = 0; r < values.length; r++) {
|
|
76548
|
+
for (let c = 0; c < values[r].length; c++) {
|
|
76549
|
+
const col = startCol + c;
|
|
76550
|
+
const row = startRow + r;
|
|
76551
|
+
const key = `${col},${row}`;
|
|
76552
|
+
if (processed.has(key)) {
|
|
76553
|
+
continue;
|
|
76554
|
+
}
|
|
76555
|
+
processed.add(key);
|
|
76556
|
+
if (!triggerEvent || !changedCellResults?.[r]?.[c]) {
|
|
76557
|
+
continue;
|
|
76558
|
+
}
|
|
76559
|
+
const oldValue = oldValues[r][c];
|
|
76560
|
+
const changedValue = table.getCellOriginValue(col, row);
|
|
76561
|
+
if (oldValue === changedValue) {
|
|
76562
|
+
continue;
|
|
76563
|
+
}
|
|
76564
|
+
const recordShowIndex = table.getRecordShowIndexByCell(col, row);
|
|
76565
|
+
const recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : undefined;
|
|
76566
|
+
const { field } = table.internalProps.layoutMap.getBody(col, row);
|
|
76567
|
+
resultChangeValues.push({
|
|
76568
|
+
col,
|
|
76569
|
+
row,
|
|
76570
|
+
recordIndex,
|
|
76571
|
+
field,
|
|
76572
|
+
rawValue: oldValue,
|
|
76573
|
+
currentValue: oldValue,
|
|
76574
|
+
changedValue
|
|
76575
|
+
});
|
|
76576
|
+
}
|
|
76490
76577
|
}
|
|
76491
76578
|
}
|
|
76492
|
-
if (!silentChangeCellValuesEvent) {
|
|
76579
|
+
if (!silentChangeCellValuesEvent && triggerEvent) {
|
|
76493
76580
|
table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: resultChangeValues });
|
|
76494
76581
|
}
|
|
76495
76582
|
}
|
|
@@ -78349,8 +78436,8 @@
|
|
|
78349
78436
|
changeCellValues(startCol, startRow, values, workOnEditableCell = false, triggerEvent = true, silentChangeCellValuesEvent) {
|
|
78350
78437
|
return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
|
|
78351
78438
|
}
|
|
78352
|
-
changeCellValuesByIds(
|
|
78353
|
-
return listTableChangeCellValuesByIds(
|
|
78439
|
+
changeCellValuesByIds(ranges, value, workOnEditableCell = false, triggerEvent = true, silentChangeCellValuesEvent) {
|
|
78440
|
+
return listTableChangeCellValuesByIds(ranges, value, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
|
|
78354
78441
|
}
|
|
78355
78442
|
changeSourceCellValue(recordIndex, field, value) {
|
|
78356
78443
|
const tableIndex = this.getTableIndexByRecordIndex(recordIndex);
|
|
@@ -78376,11 +78463,149 @@
|
|
|
78376
78463
|
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: [changeValue] });
|
|
78377
78464
|
}
|
|
78378
78465
|
}
|
|
78379
|
-
|
|
78466
|
+
changeCellValueByRecord(recordIndex, field, value, options) {
|
|
78467
|
+
const triggerEvent = options?.triggerEvent ?? true;
|
|
78468
|
+
const silentChangeCellValuesEvent = options?.silentChangeCellValuesEvent;
|
|
78469
|
+
const autoRefresh = options?.autoRefresh ?? true;
|
|
78470
|
+
const records = this.dataSource.dataSourceObj?.records;
|
|
78471
|
+
let record;
|
|
78472
|
+
let oldValue;
|
|
78473
|
+
if (Array.isArray(records) && (typeof field === 'string' || typeof field === 'number')) {
|
|
78474
|
+
record = Array.isArray(recordIndex) ? getValueFromDeepArray(records, recordIndex) : records[recordIndex];
|
|
78475
|
+
oldValue = record?.[field];
|
|
78476
|
+
}
|
|
78477
|
+
this.dataSource.changeFieldValueByRecordIndex(value, recordIndex, field, this);
|
|
78478
|
+
if (!triggerEvent) {
|
|
78479
|
+
return;
|
|
78480
|
+
}
|
|
78481
|
+
const changedValue = record && (typeof field === 'string' || typeof field === 'number') ? record?.[field] : value;
|
|
78482
|
+
if (oldValue !== changedValue) {
|
|
78483
|
+
const cellAddr = this.getCellAddrByFieldRecord(field, recordIndex);
|
|
78484
|
+
const changeValue = {
|
|
78485
|
+
col: cellAddr?.col ?? -1,
|
|
78486
|
+
row: cellAddr?.row ?? -1,
|
|
78487
|
+
recordIndex,
|
|
78488
|
+
field,
|
|
78489
|
+
rawValue: oldValue,
|
|
78490
|
+
currentValue: oldValue,
|
|
78491
|
+
changedValue
|
|
78492
|
+
};
|
|
78493
|
+
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue);
|
|
78494
|
+
if (!silentChangeCellValuesEvent) {
|
|
78495
|
+
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: [changeValue] });
|
|
78496
|
+
}
|
|
78497
|
+
}
|
|
78498
|
+
if (autoRefresh) {
|
|
78499
|
+
this.refreshAfterSourceChange();
|
|
78500
|
+
}
|
|
78501
|
+
}
|
|
78502
|
+
changeCellValueBySource(recordIndex, field, value, triggerEvent = true, silentChangeCellValuesEvent) {
|
|
78503
|
+
return this.changeCellValueByRecord(recordIndex, field, value, {
|
|
78504
|
+
triggerEvent,
|
|
78505
|
+
silentChangeCellValuesEvent,
|
|
78506
|
+
autoRefresh: true
|
|
78507
|
+
});
|
|
78508
|
+
}
|
|
78509
|
+
changeCellValuesByRecords(changeValues, options) {
|
|
78510
|
+
const triggerEvent = options?.triggerEvent ?? true;
|
|
78511
|
+
const silentChangeCellValuesEvent = options?.silentChangeCellValuesEvent;
|
|
78512
|
+
const autoRefresh = options?.autoRefresh ?? true;
|
|
78513
|
+
const resultChangeValues = [];
|
|
78514
|
+
for (let i = 0; i < changeValues.length; i++) {
|
|
78515
|
+
const { recordIndex, field, value } = changeValues[i];
|
|
78516
|
+
const records = this.dataSource.dataSourceObj?.records;
|
|
78517
|
+
let record;
|
|
78518
|
+
let oldValue;
|
|
78519
|
+
if (Array.isArray(records) && (typeof field === 'string' || typeof field === 'number')) {
|
|
78520
|
+
record = Array.isArray(recordIndex) ? getValueFromDeepArray(records, recordIndex) : records[recordIndex];
|
|
78521
|
+
oldValue = record?.[field];
|
|
78522
|
+
}
|
|
78523
|
+
this.dataSource.changeFieldValueByRecordIndex(value, recordIndex, field, this);
|
|
78524
|
+
if (triggerEvent) {
|
|
78525
|
+
const changedValue = record && (typeof field === 'string' || typeof field === 'number') ? record?.[field] : value;
|
|
78526
|
+
if (oldValue !== changedValue) {
|
|
78527
|
+
const changeValue = {
|
|
78528
|
+
col: (this.getCellAddrByFieldRecord(field, recordIndex)?.col ?? -1),
|
|
78529
|
+
row: (this.getCellAddrByFieldRecord(field, recordIndex)?.row ?? -1),
|
|
78530
|
+
recordIndex,
|
|
78531
|
+
field,
|
|
78532
|
+
rawValue: oldValue,
|
|
78533
|
+
currentValue: oldValue,
|
|
78534
|
+
changedValue
|
|
78535
|
+
};
|
|
78536
|
+
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue);
|
|
78537
|
+
resultChangeValues.push(changeValue);
|
|
78538
|
+
}
|
|
78539
|
+
}
|
|
78540
|
+
}
|
|
78541
|
+
if (!silentChangeCellValuesEvent && resultChangeValues.length && triggerEvent) {
|
|
78542
|
+
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: resultChangeValues });
|
|
78543
|
+
}
|
|
78544
|
+
if (autoRefresh) {
|
|
78545
|
+
this.refreshAfterSourceChange();
|
|
78546
|
+
}
|
|
78547
|
+
}
|
|
78548
|
+
changeCellValuesBySource(changeValues, triggerEvent = true, silentChangeCellValuesEvent) {
|
|
78549
|
+
return this.changeCellValuesByRecords(changeValues, {
|
|
78550
|
+
triggerEvent,
|
|
78551
|
+
silentChangeCellValuesEvent,
|
|
78552
|
+
autoRefresh: true
|
|
78553
|
+
});
|
|
78554
|
+
}
|
|
78555
|
+
refreshAfterSourceChange(options) {
|
|
78556
|
+
const reapplyFilter = options?.reapplyFilter ?? true;
|
|
78557
|
+
const reapplySort = options?.reapplySort ?? true;
|
|
78558
|
+
const clearRowHeightCache = options?.clearRowHeightCache ?? true;
|
|
78559
|
+
this.scenegraph.clearCells();
|
|
78560
|
+
if (this.sortState && reapplySort) {
|
|
78561
|
+
this.dataSource.clearSortedIndexMap?.();
|
|
78562
|
+
this.dataSource.sortedIndexMap?.clear?.();
|
|
78563
|
+
}
|
|
78564
|
+
if (reapplyFilter) {
|
|
78565
|
+
if (this.sortState && reapplySort) {
|
|
78566
|
+
this.dataSource.updateFilterRulesForSorted(this.dataSource.dataConfig?.filterRules);
|
|
78567
|
+
sortRecords(this);
|
|
78568
|
+
}
|
|
78569
|
+
else {
|
|
78570
|
+
this.dataSource.updateFilterRules(this.dataSource.dataConfig?.filterRules);
|
|
78571
|
+
}
|
|
78572
|
+
}
|
|
78573
|
+
else if (this.sortState && reapplySort) {
|
|
78574
|
+
sortRecords(this);
|
|
78575
|
+
}
|
|
78576
|
+
const traverseColumns = (columns) => {
|
|
78577
|
+
for (let i = 0; i < (columns?.length ?? 0); i++) {
|
|
78578
|
+
const column = columns[i];
|
|
78579
|
+
const aggregators = column?.vtable_aggregator;
|
|
78580
|
+
if (aggregators) {
|
|
78581
|
+
if (Array.isArray(aggregators)) {
|
|
78582
|
+
for (let j = 0; j < aggregators.length; j++) {
|
|
78583
|
+
aggregators[j]?.recalculate?.();
|
|
78584
|
+
}
|
|
78585
|
+
}
|
|
78586
|
+
else {
|
|
78587
|
+
aggregators?.recalculate?.();
|
|
78588
|
+
}
|
|
78589
|
+
}
|
|
78590
|
+
if (column?.columns) {
|
|
78591
|
+
traverseColumns(column.columns);
|
|
78592
|
+
}
|
|
78593
|
+
}
|
|
78594
|
+
};
|
|
78595
|
+
traverseColumns(this.internalProps.columns);
|
|
78596
|
+
this.refreshRowColCount();
|
|
78597
|
+
this.internalProps.layoutMap.clearCellRangeMap();
|
|
78598
|
+
this.internalProps.useOneRowHeightFillAll = false;
|
|
78599
|
+
this.stateManager.initCheckedState(this.records);
|
|
78600
|
+
this.scenegraph.createSceneGraph(!clearRowHeightCache);
|
|
78601
|
+
this.internalProps.emptyTip?.resetVisible();
|
|
78602
|
+
this.resize();
|
|
78603
|
+
}
|
|
78604
|
+
addRecord(record, recordIndex, triggerEvent = true) {
|
|
78380
78605
|
const success = listTableAddRecord(record, recordIndex, this);
|
|
78381
78606
|
adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]);
|
|
78382
78607
|
this.internalProps.emptyTip?.resetVisible();
|
|
78383
|
-
if (success) {
|
|
78608
|
+
if (triggerEvent && success) {
|
|
78384
78609
|
this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
|
|
78385
78610
|
records: [record],
|
|
78386
78611
|
recordIndex,
|
|
@@ -78388,13 +78613,13 @@
|
|
|
78388
78613
|
});
|
|
78389
78614
|
}
|
|
78390
78615
|
}
|
|
78391
|
-
addRecords(records, recordIndex) {
|
|
78616
|
+
addRecords(records, recordIndex, triggerEvent = true) {
|
|
78392
78617
|
const success = listTableAddRecords(records, recordIndex, this);
|
|
78393
78618
|
if (typeof recordIndex === 'number') {
|
|
78394
78619
|
adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records);
|
|
78395
78620
|
}
|
|
78396
78621
|
this.internalProps.emptyTip?.resetVisible();
|
|
78397
|
-
if (success) {
|
|
78622
|
+
if (triggerEvent && success) {
|
|
78398
78623
|
this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
|
|
78399
78624
|
records,
|
|
78400
78625
|
recordIndex,
|
|
@@ -78402,7 +78627,7 @@
|
|
|
78402
78627
|
});
|
|
78403
78628
|
}
|
|
78404
78629
|
}
|
|
78405
|
-
deleteRecords(recordIndexs) {
|
|
78630
|
+
deleteRecords(recordIndexs, triggerEvent = true) {
|
|
78406
78631
|
const deletedRecords = [];
|
|
78407
78632
|
if (recordIndexs?.length > 0) {
|
|
78408
78633
|
recordIndexs.forEach(index => {
|
|
@@ -78423,22 +78648,26 @@
|
|
|
78423
78648
|
for (let i = 0; i < recordIndexs.length; i++) {
|
|
78424
78649
|
rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
|
|
78425
78650
|
}
|
|
78426
|
-
|
|
78427
|
-
|
|
78428
|
-
|
|
78429
|
-
|
|
78430
|
-
|
|
78431
|
-
|
|
78432
|
-
|
|
78433
|
-
|
|
78651
|
+
if (triggerEvent) {
|
|
78652
|
+
this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
|
|
78653
|
+
recordIndexs,
|
|
78654
|
+
records: deletedRecords,
|
|
78655
|
+
rowIndexs,
|
|
78656
|
+
deletedCount: Array.isArray(recordIndexs[0])
|
|
78657
|
+
? recordIndexs.length
|
|
78658
|
+
: recordIndexs.length
|
|
78659
|
+
});
|
|
78660
|
+
}
|
|
78434
78661
|
}
|
|
78435
|
-
updateRecords(records, recordIndexs) {
|
|
78662
|
+
updateRecords(records, recordIndexs, triggerEvent = true) {
|
|
78436
78663
|
listTableUpdateRecords(records, recordIndexs, this);
|
|
78437
|
-
|
|
78438
|
-
|
|
78439
|
-
|
|
78440
|
-
|
|
78441
|
-
|
|
78664
|
+
if (triggerEvent) {
|
|
78665
|
+
this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
|
|
78666
|
+
records,
|
|
78667
|
+
recordIndexs,
|
|
78668
|
+
updateCount: records.length
|
|
78669
|
+
});
|
|
78670
|
+
}
|
|
78442
78671
|
}
|
|
78443
78672
|
_hasCustomRenderOrLayout() {
|
|
78444
78673
|
const { headerObjects } = this.internalProps.layoutMap;
|
|
@@ -93403,7 +93632,7 @@
|
|
|
93403
93632
|
}
|
|
93404
93633
|
|
|
93405
93634
|
registerForVrender();
|
|
93406
|
-
const version = "1.22.11-alpha.
|
|
93635
|
+
const version = "1.22.11-alpha.2";
|
|
93407
93636
|
function getIcons() {
|
|
93408
93637
|
return get$2();
|
|
93409
93638
|
}
|