@visactor/vtable 1.22.11-alpha.2 → 1.22.11-alpha.4
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 +7 -34
- package/cjs/ListTable.js +14 -134
- 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/TABLE_EVENT_TYPE.d.ts +0 -1
- package/cjs/core/TABLE_EVENT_TYPE.js +0 -1
- package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/cjs/core/record-helper.d.ts +2 -4
- package/cjs/core/record-helper.js +24 -81
- package/cjs/core/record-helper.js.map +1 -1
- package/cjs/data/DataSource.d.ts +0 -1
- package/cjs/data/DataSource.js +3 -25
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/dataset/DataStatistics.js +2 -1
- package/cjs/dataset/dataset-pivot-table.js +1 -2
- package/cjs/edit/edit-manager.js +2 -2
- package/cjs/edit/edit-manager.js.map +1 -1
- package/cjs/event/event.d.ts +1 -2
- package/cjs/event/event.js +9 -20
- package/cjs/event/event.js.map +1 -1
- package/cjs/header-helper/style.js +2 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/index.js +1 -2
- package/cjs/plugins/index.js +1 -1
- package/cjs/ts-types/base-table.d.ts +2 -2
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/events.d.ts +0 -15
- package/cjs/ts-types/events.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +6 -32
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +60 -377
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +7 -34
- package/es/ListTable.js +14 -130
- 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/TABLE_EVENT_TYPE.d.ts +0 -1
- package/es/core/TABLE_EVENT_TYPE.js +0 -1
- package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/es/core/record-helper.d.ts +2 -4
- package/es/core/record-helper.js +20 -75
- package/es/core/record-helper.js.map +1 -1
- package/es/data/DataSource.d.ts +0 -1
- package/es/data/DataSource.js +3 -25
- package/es/data/DataSource.js.map +1 -1
- package/es/dataset/DataStatistics.js +2 -1
- package/es/dataset/dataset-pivot-table.js +1 -2
- package/es/edit/edit-manager.js +2 -2
- package/es/edit/edit-manager.js.map +1 -1
- package/es/event/event.d.ts +1 -2
- package/es/event/event.js +9 -20
- package/es/event/event.js.map +1 -1
- package/es/header-helper/style.js +2 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/index.js +1 -2
- package/es/plugins/index.js +1 -1
- package/es/ts-types/base-table.d.ts +2 -2
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/events.d.ts +0 -15
- package/es/ts-types/events.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +6 -32
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +2 -2
- package/cjs/core/index.d.ts +0 -1
- package/cjs/core/index.js +0 -30
- package/cjs/core/index.js.map +0 -1
- package/es/core/index.d.ts +0 -1
- package/es/core/index.js +0 -2
- package/es/core/index.js.map +0 -1
package/dist/vtable.js
CHANGED
|
@@ -36410,7 +36410,6 @@
|
|
|
36410
36410
|
AFTER_UPDATE_CELL_CONTENT_WIDTH: 'after_update_cell_content_width',
|
|
36411
36411
|
AFTER_UPDATE_SELECT_BORDER_HEIGHT: 'after_update_select_border_height',
|
|
36412
36412
|
CHANGE_CELL_VALUE: 'change_cell_value',
|
|
36413
|
-
CHANGE_CELL_VALUES: 'change_cell_values',
|
|
36414
36413
|
DRAG_FILL_HANDLE_END: 'drag_fill_handle_end',
|
|
36415
36414
|
MOUSEDOWN_FILL_HANDLE: 'mousedown_fill_handle',
|
|
36416
36415
|
DBLCLICK_FILL_HANDLE: 'dblclick_fill_handle',
|
|
@@ -38927,48 +38926,6 @@
|
|
|
38927
38926
|
}
|
|
38928
38927
|
}
|
|
38929
38928
|
}
|
|
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
|
-
}
|
|
38972
38929
|
cacheBeforeChangedRecord(dataIndex, table) {
|
|
38973
38930
|
if (!this.beforeChangedRecordsMap.has(dataIndex.toString())) {
|
|
38974
38931
|
const originRecord = this.getOriginalRecord(dataIndex);
|
|
@@ -39090,20 +39047,11 @@
|
|
|
39090
39047
|
}
|
|
39091
39048
|
}
|
|
39092
39049
|
adjustBeforeChangedRecordsMap(insertIndex, insertCount, type = 'add') {
|
|
39093
|
-
const
|
|
39094
|
-
|
|
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];
|
|
39050
|
+
const length = this.beforeChangedRecordsMap.size;
|
|
39051
|
+
for (let key = length - 1; key >= insertIndex; key--) {
|
|
39104
39052
|
const record = this.beforeChangedRecordsMap.get(key.toString());
|
|
39105
39053
|
this.beforeChangedRecordsMap.delete(key.toString());
|
|
39106
|
-
this.beforeChangedRecordsMap.set((key +
|
|
39054
|
+
this.beforeChangedRecordsMap.set((key + (type === 'add' ? insertCount : -insertCount)).toString(), record);
|
|
39107
39055
|
}
|
|
39108
39056
|
}
|
|
39109
39057
|
deleteRecords(recordIndexs) {
|
|
@@ -39270,11 +39218,7 @@
|
|
|
39270
39218
|
}
|
|
39271
39219
|
}
|
|
39272
39220
|
if (!filedMapArray.length) {
|
|
39273
|
-
filedMapArray = states.map(() => ({
|
|
39274
|
-
asc: [],
|
|
39275
|
-
desc: [],
|
|
39276
|
-
normal: []
|
|
39277
|
-
}));
|
|
39221
|
+
filedMapArray = states.map(() => ({ asc: [], desc: [], normal: [] }));
|
|
39278
39222
|
for (let index = 0; index < states.length; index++) {
|
|
39279
39223
|
this.sortedIndexMap.set(states[index].field, filedMapArray[index]);
|
|
39280
39224
|
}
|
|
@@ -65505,7 +65449,6 @@
|
|
|
65505
65449
|
cutOperationTime = 0;
|
|
65506
65450
|
lastClipboardContent = '';
|
|
65507
65451
|
cutCellRange = null;
|
|
65508
|
-
cutRanges = null;
|
|
65509
65452
|
copySourceRange = null;
|
|
65510
65453
|
constructor(table) {
|
|
65511
65454
|
this.table = table;
|
|
@@ -65633,7 +65576,7 @@
|
|
|
65633
65576
|
}
|
|
65634
65577
|
const shiftMultiSelect = this.table.keyboardOptions?.shiftMultiSelect ?? true;
|
|
65635
65578
|
const ctrlMultiSelect = this.table.keyboardOptions?.ctrlMultiSelect ?? true;
|
|
65636
|
-
this.table.stateManager.updateSelectPos(this.table.stateManager.select.selectInline === 'row' ? this.table.colCount - 1 : eventArgs.col, this.table.stateManager.select.selectInline === 'col' ? this.table.rowCount - 1 : eventArgs.row, eventArgs.event.shiftKey && shiftMultiSelect, (eventArgs.event.ctrlKey || eventArgs.event.metaKey) && ctrlMultiSelect, false, isSelectMoving ? false : this.table.options.select?.makeSelectCellVisible ?? true);
|
|
65579
|
+
this.table.stateManager.updateSelectPos(this.table.stateManager.select.selectInline === 'row' ? this.table.colCount - 1 : eventArgs.col, this.table.stateManager.select.selectInline === 'col' ? this.table.rowCount - 1 : eventArgs.row, eventArgs.event.shiftKey && shiftMultiSelect, (eventArgs.event.ctrlKey || eventArgs.event.metaKey) && ctrlMultiSelect, false, isSelectMoving ? false : (this.table.options.select?.makeSelectCellVisible ?? true));
|
|
65637
65580
|
return true;
|
|
65638
65581
|
}
|
|
65639
65582
|
return false;
|
|
@@ -66025,10 +65968,6 @@
|
|
|
66025
65968
|
this.handleCopy(e, true);
|
|
66026
65969
|
this.cutWaitPaste = true;
|
|
66027
65970
|
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
|
-
}));
|
|
66032
65971
|
if (this.clipboardCheckTimer) {
|
|
66033
65972
|
clearTimeout(this.clipboardCheckTimer);
|
|
66034
65973
|
}
|
|
@@ -66036,7 +65975,6 @@
|
|
|
66036
65975
|
if (this.cutWaitPaste) {
|
|
66037
65976
|
this.cutWaitPaste = false;
|
|
66038
65977
|
this.cutCellRange = null;
|
|
66039
|
-
this.cutRanges = null;
|
|
66040
65978
|
this.clipboardCheckTimer = null;
|
|
66041
65979
|
}
|
|
66042
65980
|
}, 30000);
|
|
@@ -66056,7 +65994,6 @@
|
|
|
66056
65994
|
if (this.cutWaitPaste) {
|
|
66057
65995
|
this.cutWaitPaste = false;
|
|
66058
65996
|
this.cutCellRange = null;
|
|
66059
|
-
this.cutRanges = null;
|
|
66060
65997
|
if (this.clipboardCheckTimer) {
|
|
66061
65998
|
clearTimeout(this.clipboardCheckTimer);
|
|
66062
65999
|
this.clipboardCheckTimer = null;
|
|
@@ -66172,11 +66109,17 @@
|
|
|
66172
66109
|
}
|
|
66173
66110
|
clearCutArea(table) {
|
|
66174
66111
|
try {
|
|
66175
|
-
const
|
|
66176
|
-
if (!
|
|
66112
|
+
const selectCells = this.cutCellRange;
|
|
66113
|
+
if (!selectCells || selectCells.length === 0) {
|
|
66177
66114
|
return;
|
|
66178
66115
|
}
|
|
66179
|
-
|
|
66116
|
+
for (let i = 0; i < selectCells.length; i++) {
|
|
66117
|
+
for (let j = 0; j < selectCells[i].length; j++) {
|
|
66118
|
+
if (selectCells[i][j]) {
|
|
66119
|
+
table.changeCellValue(selectCells[i][j].col, selectCells[i][j].row, undefined);
|
|
66120
|
+
}
|
|
66121
|
+
}
|
|
66122
|
+
}
|
|
66180
66123
|
}
|
|
66181
66124
|
catch (error) {
|
|
66182
66125
|
}
|
|
@@ -70226,7 +70169,7 @@
|
|
|
70226
70169
|
return TABLE_EVENT_TYPE;
|
|
70227
70170
|
}
|
|
70228
70171
|
options;
|
|
70229
|
-
version = "1.22.11-alpha.
|
|
70172
|
+
version = "1.22.11-alpha.4";
|
|
70230
70173
|
pagination;
|
|
70231
70174
|
id = `VTable${Date.now()}`;
|
|
70232
70175
|
headerStyleCache;
|
|
@@ -76062,17 +76005,18 @@
|
|
|
76062
76005
|
referencePosition.rect.height = rect.height + 1;
|
|
76063
76006
|
}
|
|
76064
76007
|
const editor = this.table.getEditor(col, row);
|
|
76065
|
-
|
|
76066
|
-
|
|
76067
|
-
editor.
|
|
76068
|
-
|
|
76069
|
-
|
|
76070
|
-
|
|
76071
|
-
|
|
76072
|
-
|
|
76073
|
-
|
|
76074
|
-
|
|
76075
|
-
|
|
76008
|
+
editor &&
|
|
76009
|
+
setTimeout(() => {
|
|
76010
|
+
if (editor && this.editingEditor !== editor) {
|
|
76011
|
+
editor.prepareEdit?.({
|
|
76012
|
+
referencePosition,
|
|
76013
|
+
container: this.table.getElement(),
|
|
76014
|
+
table: this.table,
|
|
76015
|
+
col,
|
|
76016
|
+
row
|
|
76017
|
+
});
|
|
76018
|
+
}
|
|
76019
|
+
}, 10);
|
|
76076
76020
|
}
|
|
76077
76021
|
});
|
|
76078
76022
|
this.listenersId.push(doubleClickEventId, clickEventId, selectedChangedEventId);
|
|
@@ -76263,10 +76207,9 @@
|
|
|
76263
76207
|
return { addRecordRule };
|
|
76264
76208
|
}
|
|
76265
76209
|
|
|
76266
|
-
function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table
|
|
76210
|
+
function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table) {
|
|
76267
76211
|
if ((workOnEditableCell && table.isHasEditorDefine(col, row)) || workOnEditableCell === false) {
|
|
76268
|
-
const
|
|
76269
|
-
const recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : undefined;
|
|
76212
|
+
const recordIndex = table.getRecordShowIndexByCell(col, row);
|
|
76270
76213
|
const { field } = table.internalProps.layoutMap.getBody(col, row);
|
|
76271
76214
|
const beforeChangeValue = table.getCellRawValue(col, row);
|
|
76272
76215
|
const oldValue = table.getCellOriginValue(col, row);
|
|
@@ -76274,7 +76217,7 @@
|
|
|
76274
76217
|
table.internalProps.layoutMap.updateColumnTitle(col, row, value);
|
|
76275
76218
|
}
|
|
76276
76219
|
else {
|
|
76277
|
-
table.dataSource.changeFieldValue(value,
|
|
76220
|
+
table.dataSource.changeFieldValue(value, recordIndex, field, col, row, table);
|
|
76278
76221
|
}
|
|
76279
76222
|
const range = table.getCellRange(col, row);
|
|
76280
76223
|
const aggregators = table.internalProps.layoutMap.getAggregatorsByCell(col, row);
|
|
@@ -76327,24 +76270,18 @@
|
|
|
76327
76270
|
}
|
|
76328
76271
|
const changedValue = table.getCellOriginValue(col, row);
|
|
76329
76272
|
if (oldValue !== changedValue && triggerEvent) {
|
|
76330
|
-
|
|
76273
|
+
table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
|
|
76331
76274
|
col,
|
|
76332
76275
|
row,
|
|
76333
|
-
recordIndex,
|
|
76334
|
-
field,
|
|
76335
76276
|
rawValue: beforeChangeValue,
|
|
76336
76277
|
currentValue: oldValue,
|
|
76337
76278
|
changedValue
|
|
76338
|
-
};
|
|
76339
|
-
table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue);
|
|
76340
|
-
if (!silentChangeCellValuesEvent) {
|
|
76341
|
-
table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: [changeValue] });
|
|
76342
|
-
}
|
|
76279
|
+
});
|
|
76343
76280
|
}
|
|
76344
76281
|
table.scenegraph.updateNextFrame();
|
|
76345
76282
|
}
|
|
76346
76283
|
}
|
|
76347
|
-
async function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table
|
|
76284
|
+
async function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table) {
|
|
76348
76285
|
const changedCellResults = [];
|
|
76349
76286
|
let pasteColEnd = startCol;
|
|
76350
76287
|
let pasteRowEnd = startRow;
|
|
@@ -76371,7 +76308,6 @@
|
|
|
76371
76308
|
oldRowValues.push(oldValue);
|
|
76372
76309
|
}
|
|
76373
76310
|
}
|
|
76374
|
-
const resultChangeValues = [];
|
|
76375
76311
|
for (let i = 0; i < values.length; i++) {
|
|
76376
76312
|
if (startRow + i > table.rowCount - 1) {
|
|
76377
76313
|
break;
|
|
@@ -76411,8 +76347,7 @@
|
|
|
76411
76347
|
if (isCanChange) {
|
|
76412
76348
|
changedCellResults[i][j] = true;
|
|
76413
76349
|
const value = rowValues[j];
|
|
76414
|
-
const
|
|
76415
|
-
const recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : undefined;
|
|
76350
|
+
const recordIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i);
|
|
76416
76351
|
const { field } = table.internalProps.layoutMap.getBody(startCol + j, startRow + i);
|
|
76417
76352
|
const beforeChangeValue = beforeChangeValues[i][j];
|
|
76418
76353
|
const oldValue = oldValues[i][j];
|
|
@@ -76420,21 +76355,17 @@
|
|
|
76420
76355
|
table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value);
|
|
76421
76356
|
}
|
|
76422
76357
|
else {
|
|
76423
|
-
table.dataSource.changeFieldValue(value,
|
|
76358
|
+
table.dataSource.changeFieldValue(value, recordIndex, field, startCol + j, startRow + i, table);
|
|
76424
76359
|
}
|
|
76425
76360
|
const changedValue = table.getCellOriginValue(startCol + j, startRow + i);
|
|
76426
76361
|
if (oldValue !== changedValue && triggerEvent) {
|
|
76427
|
-
|
|
76362
|
+
table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
|
|
76428
76363
|
col: startCol + j,
|
|
76429
76364
|
row: startRow + i,
|
|
76430
|
-
recordIndex,
|
|
76431
|
-
field,
|
|
76432
76365
|
rawValue: beforeChangeValue,
|
|
76433
76366
|
currentValue: oldValue,
|
|
76434
76367
|
changedValue
|
|
76435
|
-
};
|
|
76436
|
-
table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue);
|
|
76437
|
-
resultChangeValues.push(changeValue);
|
|
76368
|
+
});
|
|
76438
76369
|
}
|
|
76439
76370
|
}
|
|
76440
76371
|
else {
|
|
@@ -76443,9 +76374,6 @@
|
|
|
76443
76374
|
}
|
|
76444
76375
|
pasteColEnd = Math.max(pasteColEnd, thisRowPasteColEnd);
|
|
76445
76376
|
}
|
|
76446
|
-
if (!silentChangeCellValuesEvent) {
|
|
76447
|
-
table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: resultChangeValues });
|
|
76448
|
-
}
|
|
76449
76377
|
const startRange = table.getCellRange(startCol, startRow);
|
|
76450
76378
|
const range = table.getCellRange(pasteColEnd, pasteRowEnd);
|
|
76451
76379
|
const aggregators = table.internalProps.layoutMap.getAggregatorsByCellRange(startRange.start.col, startRange.start.row, range.end.col, range.end.row);
|
|
@@ -76518,68 +76446,6 @@
|
|
|
76518
76446
|
table.scenegraph.updateNextFrame();
|
|
76519
76447
|
return changedCellResults;
|
|
76520
76448
|
}
|
|
76521
|
-
async function listTableChangeCellValuesByIds(ranges, value, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
|
|
76522
|
-
const resultChangeValues = [];
|
|
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
|
-
}
|
|
76577
|
-
}
|
|
76578
|
-
}
|
|
76579
|
-
if (!silentChangeCellValuesEvent && triggerEvent) {
|
|
76580
|
-
table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: resultChangeValues });
|
|
76581
|
-
}
|
|
76582
|
-
}
|
|
76583
76449
|
function getCellUpdateType(col, row, table, oldCellUpdateType) {
|
|
76584
76450
|
if (oldCellUpdateType === 'group') {
|
|
76585
76451
|
return oldCellUpdateType;
|
|
@@ -78430,182 +78296,17 @@
|
|
|
78430
78296
|
}
|
|
78431
78297
|
return isValid$1(editorDefine);
|
|
78432
78298
|
}
|
|
78433
|
-
changeCellValue(col, row, value, workOnEditableCell = false, triggerEvent = true
|
|
78434
|
-
return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this
|
|
78435
|
-
}
|
|
78436
|
-
changeCellValues(startCol, startRow, values, workOnEditableCell = false, triggerEvent = true, silentChangeCellValuesEvent) {
|
|
78437
|
-
return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
|
|
78438
|
-
}
|
|
78439
|
-
changeCellValuesByIds(ranges, value, workOnEditableCell = false, triggerEvent = true, silentChangeCellValuesEvent) {
|
|
78440
|
-
return listTableChangeCellValuesByIds(ranges, value, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
|
|
78441
|
-
}
|
|
78442
|
-
changeSourceCellValue(recordIndex, field, value) {
|
|
78443
|
-
const tableIndex = this.getTableIndexByRecordIndex(recordIndex);
|
|
78444
|
-
const cellAddr = this.getCellAddrByFieldRecord(field, recordIndex);
|
|
78445
|
-
if (tableIndex < 0 || cellAddr.col < 0 || cellAddr.row < 0) {
|
|
78446
|
-
return;
|
|
78447
|
-
}
|
|
78448
|
-
this.dataSource.changeFieldValue(value, tableIndex, field, cellAddr.col, cellAddr.row, this);
|
|
78449
|
-
const beforeChangeValue = this.getCellRawValue(cellAddr.col, cellAddr.row);
|
|
78450
|
-
const oldValue = this.getCellOriginValue(cellAddr.col, cellAddr.row);
|
|
78451
|
-
const changedValue = this.getCellOriginValue(cellAddr.col, cellAddr.row);
|
|
78452
|
-
if (oldValue !== changedValue) {
|
|
78453
|
-
const changeValue = {
|
|
78454
|
-
col: cellAddr.col,
|
|
78455
|
-
row: cellAddr.row,
|
|
78456
|
-
recordIndex,
|
|
78457
|
-
field,
|
|
78458
|
-
rawValue: beforeChangeValue,
|
|
78459
|
-
currentValue: oldValue,
|
|
78460
|
-
changedValue
|
|
78461
|
-
};
|
|
78462
|
-
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue);
|
|
78463
|
-
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, { values: [changeValue] });
|
|
78464
|
-
}
|
|
78465
|
-
}
|
|
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
|
-
});
|
|
78299
|
+
changeCellValue(col, row, value, workOnEditableCell = false, triggerEvent = true) {
|
|
78300
|
+
return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this);
|
|
78508
78301
|
}
|
|
78509
|
-
|
|
78510
|
-
|
|
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
|
-
});
|
|
78302
|
+
changeCellValues(startCol, startRow, values, workOnEditableCell = false, triggerEvent = true) {
|
|
78303
|
+
return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this);
|
|
78554
78304
|
}
|
|
78555
|
-
|
|
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) {
|
|
78305
|
+
addRecord(record, recordIndex) {
|
|
78605
78306
|
const success = listTableAddRecord(record, recordIndex, this);
|
|
78606
78307
|
adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]);
|
|
78607
78308
|
this.internalProps.emptyTip?.resetVisible();
|
|
78608
|
-
if (
|
|
78309
|
+
if (success) {
|
|
78609
78310
|
this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
|
|
78610
78311
|
records: [record],
|
|
78611
78312
|
recordIndex,
|
|
@@ -78613,13 +78314,13 @@
|
|
|
78613
78314
|
});
|
|
78614
78315
|
}
|
|
78615
78316
|
}
|
|
78616
|
-
addRecords(records, recordIndex
|
|
78317
|
+
addRecords(records, recordIndex) {
|
|
78617
78318
|
const success = listTableAddRecords(records, recordIndex, this);
|
|
78618
78319
|
if (typeof recordIndex === 'number') {
|
|
78619
78320
|
adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records);
|
|
78620
78321
|
}
|
|
78621
78322
|
this.internalProps.emptyTip?.resetVisible();
|
|
78622
|
-
if (
|
|
78323
|
+
if (success) {
|
|
78623
78324
|
this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
|
|
78624
78325
|
records,
|
|
78625
78326
|
recordIndex,
|
|
@@ -78627,20 +78328,7 @@
|
|
|
78627
78328
|
});
|
|
78628
78329
|
}
|
|
78629
78330
|
}
|
|
78630
|
-
deleteRecords(recordIndexs
|
|
78631
|
-
const deletedRecords = [];
|
|
78632
|
-
if (recordIndexs?.length > 0) {
|
|
78633
|
-
recordIndexs.forEach(index => {
|
|
78634
|
-
let record = null;
|
|
78635
|
-
if (typeof index === 'number') {
|
|
78636
|
-
record = this.dataSource.get(index);
|
|
78637
|
-
}
|
|
78638
|
-
else {
|
|
78639
|
-
record = [];
|
|
78640
|
-
}
|
|
78641
|
-
deletedRecords.push(record);
|
|
78642
|
-
});
|
|
78643
|
-
}
|
|
78331
|
+
deleteRecords(recordIndexs) {
|
|
78644
78332
|
listTableDeleteRecords(recordIndexs, this);
|
|
78645
78333
|
adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs);
|
|
78646
78334
|
this.internalProps.emptyTip?.resetVisible();
|
|
@@ -78648,26 +78336,21 @@
|
|
|
78648
78336
|
for (let i = 0; i < recordIndexs.length; i++) {
|
|
78649
78337
|
rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
|
|
78650
78338
|
}
|
|
78651
|
-
|
|
78652
|
-
|
|
78653
|
-
|
|
78654
|
-
|
|
78655
|
-
|
|
78656
|
-
|
|
78657
|
-
|
|
78658
|
-
: recordIndexs.length
|
|
78659
|
-
});
|
|
78660
|
-
}
|
|
78339
|
+
this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
|
|
78340
|
+
recordIndexs,
|
|
78341
|
+
rowIndexs,
|
|
78342
|
+
deletedCount: Array.isArray(recordIndexs[0])
|
|
78343
|
+
? recordIndexs.length
|
|
78344
|
+
: recordIndexs.length
|
|
78345
|
+
});
|
|
78661
78346
|
}
|
|
78662
|
-
updateRecords(records, recordIndexs
|
|
78347
|
+
updateRecords(records, recordIndexs) {
|
|
78663
78348
|
listTableUpdateRecords(records, recordIndexs, this);
|
|
78664
|
-
|
|
78665
|
-
|
|
78666
|
-
|
|
78667
|
-
|
|
78668
|
-
|
|
78669
|
-
});
|
|
78670
|
-
}
|
|
78349
|
+
this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
|
|
78350
|
+
records,
|
|
78351
|
+
recordIndexs,
|
|
78352
|
+
updateCount: records.length
|
|
78353
|
+
});
|
|
78671
78354
|
}
|
|
78672
78355
|
_hasCustomRenderOrLayout() {
|
|
78673
78356
|
const { headerObjects } = this.internalProps.layoutMap;
|
|
@@ -93632,7 +93315,7 @@
|
|
|
93632
93315
|
}
|
|
93633
93316
|
|
|
93634
93317
|
registerForVrender();
|
|
93635
|
-
const version = "1.22.11-alpha.
|
|
93318
|
+
const version = "1.22.11-alpha.4";
|
|
93636
93319
|
function getIcons() {
|
|
93637
93320
|
return get$2();
|
|
93638
93321
|
}
|