@visactor/vtable-sheet 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/index.d.ts CHANGED
@@ -2,5 +2,5 @@ import VTableSheet from './components/vtable-sheet';
2
2
  import type { ISheetDefine, IVTableSheetOptions } from './ts-types';
3
3
  import * as TYPES from './ts-types';
4
4
  import * as VTable from './vtable';
5
- export declare const version = "1.22.11-alpha.1";
5
+ export declare const version = "1.22.11-alpha.2";
6
6
  export { VTableSheet, TYPES, VTable, ISheetDefine, IVTableSheetOptions };
package/cjs/index.js CHANGED
@@ -47,4 +47,4 @@ exports.VTable = VTable;
47
47
 
48
48
  const style_manager_1 = require("./styles/style-manager");
49
49
 
50
- exports.version = "1.22.11-alpha.1", (0, style_manager_1.importStyles)();
50
+ exports.version = "1.22.11-alpha.2", (0, style_manager_1.importStyles)();
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6EAAoD;AAW3C,sBAXF,sBAAW,CAWE;AATpB,kDAAoC;AASd,sBAAK;AAR3B,iDAAmC;AAQN,wBAAM;AAPnC,0DAAsD;AACzC,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,IAAA,4BAAY,GAAE,CAAC","file":"index.js","sourcesContent":["import VTableSheet from './components/vtable-sheet';\nimport type { ISheetDefine, IVTableSheetOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport * as VTable from './vtable';\nimport { importStyles } from './styles/style-manager';\nexport const version = \"1.22.11-alpha.1\";\n// 导入样式\nimportStyles();\n/**\n * @namespace VTableSheet\n */\nexport { VTableSheet, TYPES, VTable, ISheetDefine, IVTableSheetOptions };\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6EAAoD;AAW3C,sBAXF,sBAAW,CAWE;AATpB,kDAAoC;AASd,sBAAK;AAR3B,iDAAmC;AAQN,wBAAM;AAPnC,0DAAsD;AACzC,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,IAAA,4BAAY,GAAE,CAAC","file":"index.js","sourcesContent":["import VTableSheet from './components/vtable-sheet';\nimport type { ISheetDefine, IVTableSheetOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport * as VTable from './vtable';\nimport { importStyles } from './styles/style-manager';\nexport const version = \"1.22.11-alpha.2\";\n// 导入样式\nimportStyles();\n/**\n * @namespace VTableSheet\n */\nexport { VTableSheet, TYPES, VTable, ISheetDefine, IVTableSheetOptions };\n"]}
@@ -40955,6 +40955,24 @@
40955
40955
  }
40956
40956
  }
40957
40957
  }
40958
+ changeFieldValueByRecordIndex(value, recordIndex, field, table) {
40959
+ var _a, _b, _c, _d;
40960
+ if (null === field) return;
40961
+ if (null == recordIndex) return;
40962
+ const rawKey = recordIndex.toString();
40963
+ if (!this.beforeChangedRecordsMap.has(rawKey)) {
40964
+ const rawRecords = Array.isArray(null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.records) ? this.dataSourceObj.records : null,
40965
+ originRecord = rawRecords ? Array.isArray(recordIndex) ? getValueFromDeepArray(rawRecords, recordIndex) : rawRecords[recordIndex] : void 0;
40966
+ this.beforeChangedRecordsMap.set(rawKey, null !== (_b = cloneDeep$1(originRecord, void 0, ["vtable_gantt_linkedFrom", "vtable_gantt_linkedTo"])) && void 0 !== _b ? _b : {});
40967
+ }
40968
+ if ("string" == typeof field || "number" == typeof field) {
40969
+ const beforeChangedValue = null === (_c = this.beforeChangedRecordsMap.get(rawKey)) || void 0 === _c ? void 0 : _c[field],
40970
+ rawRecords = Array.isArray(null === (_d = this.dataSourceObj) || void 0 === _d ? void 0 : _d.records) ? this.dataSourceObj.records : null,
40971
+ record = rawRecords ? Array.isArray(recordIndex) ? getValueFromDeepArray(rawRecords, recordIndex) : rawRecords[recordIndex] : void 0;
40972
+ let formatValue = value;
40973
+ "number" == typeof beforeChangedValue && isAllDigits(value) && (formatValue = parseFloat(value)), record ? record[field] = formatValue : rawRecords && "number" == typeof recordIndex && (rawRecords[recordIndex] = "Array" === this.addRecordRule ? [] : {}, rawRecords[recordIndex][field] = formatValue);
40974
+ }
40975
+ }
40958
40976
  cacheBeforeChangedRecord(dataIndex, table) {
40959
40977
  var _a;
40960
40978
  if (!this.beforeChangedRecordsMap.has(dataIndex.toString())) {
@@ -41020,9 +41038,16 @@
41020
41038
  }
41021
41039
  }
41022
41040
  adjustBeforeChangedRecordsMap(insertIndex, insertCount, type = "add") {
41023
- for (let key = this.beforeChangedRecordsMap.size - 1; key >= insertIndex; key--) {
41024
- const record = this.beforeChangedRecordsMap.get(key.toString());
41025
- this.beforeChangedRecordsMap.delete(key.toString()), this.beforeChangedRecordsMap.set((key + ("add" === type ? insertCount : -insertCount)).toString(), record);
41041
+ const delta = "add" === type ? insertCount : -insertCount,
41042
+ numericKeys = [];
41043
+ this.beforeChangedRecordsMap.forEach((_, key) => {
41044
+ const numKey = Number(key);
41045
+ Number.isInteger(numKey) && numKey.toString() === key && numKey >= insertIndex && numericKeys.push(numKey);
41046
+ }), numericKeys.sort((a, b) => "add" === type ? b - a : a - b);
41047
+ for (let i = 0; i < numericKeys.length; i++) {
41048
+ const key = numericKeys[i],
41049
+ record = this.beforeChangedRecordsMap.get(key.toString());
41050
+ this.beforeChangedRecordsMap.delete(key.toString()), this.beforeChangedRecordsMap.set((key + delta).toString(), record);
41026
41051
  }
41027
41052
  }
41028
41053
  deleteRecords(recordIndexs) {
@@ -57386,7 +57411,7 @@
57386
57411
  };
57387
57412
  let EventManager$1 = class EventManager {
57388
57413
  constructor(table) {
57389
- this.isDown = !1, this.isDraging = !1, this.globalEventListeners = [], this._enableTableScroll = !0, this.cutWaitPaste = !1, this.clipboardCheckTimer = null, this.cutOperationTime = 0, this.lastClipboardContent = "", this.cutCellRange = null, this.copySourceRange = null, this.table = table, this.handleTextStickBindId = [], this.inertiaScroll = new InertiaScroll(table.stateManager), "node" === Env$1.mode || table.options.disableInteraction || (this.bindOuterEvent(), setTimeout(() => {
57414
+ this.isDown = !1, this.isDraging = !1, this.globalEventListeners = [], this._enableTableScroll = !0, this.cutWaitPaste = !1, this.clipboardCheckTimer = null, this.cutOperationTime = 0, this.lastClipboardContent = "", this.cutCellRange = null, this.cutRanges = null, this.copySourceRange = null, this.table = table, this.handleTextStickBindId = [], this.inertiaScroll = new InertiaScroll(table.stateManager), "node" === Env$1.mode || table.options.disableInteraction || (this.bindOuterEvent(), setTimeout(() => {
57390
57415
  this.bindSelfEvent();
57391
57416
  }, 0));
57392
57417
  }
@@ -57688,15 +57713,25 @@
57688
57713
  } catch (error) {}
57689
57714
  }
57690
57715
  handleCut(e) {
57716
+ var _a;
57691
57717
  return __awaiter$1(this, void 0, void 0, function* () {
57692
- this.handleCopy(e, !0), this.cutWaitPaste = !0, this.cutCellRange = this.table.getSelectedCellInfos(), this.clipboardCheckTimer && clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = window.setTimeout(() => {
57693
- this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer = null);
57718
+ this.handleCopy(e, !0), this.cutWaitPaste = !0, this.cutCellRange = this.table.getSelectedCellInfos(), this.cutRanges = null === (_a = this.table.stateManager.select.ranges) || void 0 === _a ? void 0 : _a.map(r => ({
57719
+ start: {
57720
+ col: r.start.col,
57721
+ row: r.start.row
57722
+ },
57723
+ end: {
57724
+ col: r.end.col,
57725
+ row: r.end.row
57726
+ }
57727
+ })), this.clipboardCheckTimer && clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = window.setTimeout(() => {
57728
+ this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.cutRanges = null, this.clipboardCheckTimer = null);
57694
57729
  }, 3e4), this.saveClipboardContent();
57695
57730
  });
57696
57731
  }
57697
57732
  handlePaste(e) {
57698
57733
  this.cutWaitPaste ? this.checkClipboardChanged().then(changed => {
57699
- this.executePaste(e), changed || this.clearCutArea(this.table), this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer && (clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = null));
57734
+ this.executePaste(e), changed || this.clearCutArea(this.table), this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.cutRanges = null, this.clipboardCheckTimer && (clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = null));
57700
57735
  }).catch(() => {
57701
57736
  this.executePaste(e), this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer && (clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = null));
57702
57737
  }) : this.executePaste(e);
@@ -57773,15 +57808,9 @@
57773
57808
  }
57774
57809
  clearCutArea(table) {
57775
57810
  try {
57776
- const selectCells = this.cutCellRange;
57777
- if (!selectCells || 0 === selectCells.length) return;
57778
- const changeValues = [];
57779
- for (let i = 0; i < selectCells.length; i++) for (let j = 0; j < selectCells[i].length; j++) selectCells[i][j] && changeValues.push({
57780
- col: selectCells[i][j].col,
57781
- row: selectCells[i][j].row,
57782
- value: void 0
57783
- });
57784
- table.changeCellValuesByIds(changeValues);
57811
+ const ranges = this.cutRanges;
57812
+ if (!ranges || 0 === ranges.length) return;
57813
+ table.changeCellValuesByIds(ranges, "");
57785
57814
  } catch (error) {}
57786
57815
  }
57787
57816
  checkClipboardChanged() {
@@ -60024,7 +60053,7 @@
60024
60053
  }
60025
60054
  constructor(container, options = {}) {
60026
60055
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
60027
- if (super(), this.showFrozenIcon = !0, this.version = "1.22.11-alpha.1", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env$1.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
60056
+ if (super(), this.showFrozenIcon = !0, this.version = "1.22.11-alpha.2", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env$1.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
60028
60057
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
60029
60058
  options: options,
60030
60059
  container: container
@@ -63991,32 +64020,54 @@
63991
64020
  return table.scenegraph.updateNextFrame(), changedCellResults;
63992
64021
  });
63993
64022
  }
63994
- function listTableChangeCellValuesByIds(changeValues, triggerEvent, table, silentChangeCellValuesEvent) {
64023
+ function listTableChangeCellValuesByIds(ranges, value, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
64024
+ var _a, _b;
63995
64025
  return __awaiter(this, void 0, void 0, function* () {
63996
- const resultChangeValues = [];
63997
- for (let i = 0; i < changeValues.length; i++) {
63998
- const {
64026
+ const resultChangeValues = [],
64027
+ processed = new Set(),
64028
+ nextValue = null != value ? value : "";
64029
+ for (let i = 0; i < (null !== (_a = null == ranges ? void 0 : ranges.length) && void 0 !== _a ? _a : 0); i++) {
64030
+ const range = ranges[i],
64031
+ startCol = Math.min(range.start.col, range.end.col),
64032
+ endCol = Math.max(range.start.col, range.end.col),
64033
+ startRow = Math.min(range.start.row, range.end.row),
64034
+ endRow = Math.max(range.start.row, range.end.row);
64035
+ if (startCol > endCol || startRow > endRow) continue;
64036
+ const values = [],
64037
+ oldValues = [];
64038
+ for (let row = startRow; row <= endRow; row++) {
64039
+ const rowValues = [],
64040
+ rowOldValues = [];
64041
+ for (let col = startCol; col <= endCol; col++) rowValues.push(nextValue), rowOldValues.push(table.getCellOriginValue(col, row));
64042
+ values.push(rowValues), oldValues.push(rowOldValues);
64043
+ }
64044
+ const changedCellResults = yield listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, !0);
64045
+ for (let r = 0; r < values.length; r++) for (let c = 0; c < values[r].length; c++) {
64046
+ const col = startCol + c,
64047
+ row = startRow + r,
64048
+ key = `${col},${row}`;
64049
+ if (processed.has(key)) continue;
64050
+ if (processed.add(key), !triggerEvent || !(null === (_b = null == changedCellResults ? void 0 : changedCellResults[r]) || void 0 === _b ? void 0 : _b[c])) continue;
64051
+ const oldValue = oldValues[r][c],
64052
+ changedValue = table.getCellOriginValue(col, row);
64053
+ if (oldValue === changedValue) continue;
64054
+ const recordShowIndex = table.getRecordShowIndexByCell(col, row),
64055
+ recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
64056
+ {
64057
+ field: field
64058
+ } = table.internalProps.layoutMap.getBody(col, row);
64059
+ resultChangeValues.push({
63999
64060
  col: col,
64000
64061
  row: row,
64001
- value: value
64002
- } = changeValues[i],
64003
- recordShowIndex = table.getRecordShowIndexByCell(col, row),
64004
- recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
64005
- {
64006
- field: field
64007
- } = table.internalProps.layoutMap.getBody(col, row),
64008
- oldValue = table.getCellOriginValue(col, row);
64009
- listTableChangeCellValue(col, row, value, !1, triggerEvent, table, !0), oldValue !== value && triggerEvent && resultChangeValues.push({
64010
- col: col,
64011
- row: row,
64012
- recordIndex: recordIndex,
64013
- field: field,
64014
- rawValue: oldValue,
64015
- currentValue: oldValue,
64016
- changedValue: value
64017
- });
64062
+ recordIndex: recordIndex,
64063
+ field: field,
64064
+ rawValue: oldValue,
64065
+ currentValue: oldValue,
64066
+ changedValue: changedValue
64067
+ });
64068
+ }
64018
64069
  }
64019
- silentChangeCellValuesEvent || table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
64070
+ !silentChangeCellValuesEvent && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
64020
64071
  values: resultChangeValues
64021
64072
  });
64022
64073
  });
@@ -65190,8 +65241,8 @@
65190
65241
  changeCellValues(startCol, startRow, values, workOnEditableCell = !1, triggerEvent = !0, silentChangeCellValuesEvent) {
65191
65242
  return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
65192
65243
  }
65193
- changeCellValuesByIds(changeValues, triggerEvent = !0, silentChangeCellValuesEvent) {
65194
- return listTableChangeCellValuesByIds(changeValues, triggerEvent, this, silentChangeCellValuesEvent);
65244
+ changeCellValuesByIds(ranges, value, workOnEditableCell = !1, triggerEvent = !0, silentChangeCellValuesEvent) {
65245
+ return listTableChangeCellValuesByIds(ranges, value, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
65195
65246
  }
65196
65247
  changeSourceCellValue(recordIndex, field, value) {
65197
65248
  const tableIndex = this.getTableIndexByRecordIndex(recordIndex),
@@ -65216,25 +65267,116 @@
65216
65267
  });
65217
65268
  }
65218
65269
  }
65219
- addRecord(record, recordIndex) {
65270
+ changeCellValueByRecord(recordIndex, field, value, options) {
65271
+ var _a, _b, _c, _d, _e;
65272
+ const triggerEvent = null === (_a = null == options ? void 0 : options.triggerEvent) || void 0 === _a || _a,
65273
+ silentChangeCellValuesEvent = null == options ? void 0 : options.silentChangeCellValuesEvent,
65274
+ autoRefresh = null === (_b = null == options ? void 0 : options.autoRefresh) || void 0 === _b || _b,
65275
+ records = null === (_c = this.dataSource.dataSourceObj) || void 0 === _c ? void 0 : _c.records;
65276
+ let record, oldValue;
65277
+ if (!Array.isArray(records) || "string" != typeof field && "number" != typeof field || (record = Array.isArray(recordIndex) ? getValueFromDeepArray(records, recordIndex) : records[recordIndex], oldValue = null == record ? void 0 : record[field]), this.dataSource.changeFieldValueByRecordIndex(value, recordIndex, field, this), !triggerEvent) return;
65278
+ const changedValue = !record || "string" != typeof field && "number" != typeof field ? value : null == record ? void 0 : record[field];
65279
+ if (oldValue !== changedValue) {
65280
+ const cellAddr = this.getCellAddrByFieldRecord(field, recordIndex),
65281
+ changeValue = {
65282
+ col: null !== (_d = null == cellAddr ? void 0 : cellAddr.col) && void 0 !== _d ? _d : -1,
65283
+ row: null !== (_e = null == cellAddr ? void 0 : cellAddr.row) && void 0 !== _e ? _e : -1,
65284
+ recordIndex: recordIndex,
65285
+ field: field,
65286
+ rawValue: oldValue,
65287
+ currentValue: oldValue,
65288
+ changedValue: changedValue
65289
+ };
65290
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), silentChangeCellValuesEvent || this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
65291
+ values: [changeValue]
65292
+ });
65293
+ }
65294
+ autoRefresh && this.refreshAfterSourceChange();
65295
+ }
65296
+ changeCellValueBySource(recordIndex, field, value, triggerEvent = !0, silentChangeCellValuesEvent) {
65297
+ return this.changeCellValueByRecord(recordIndex, field, value, {
65298
+ triggerEvent: triggerEvent,
65299
+ silentChangeCellValuesEvent: silentChangeCellValuesEvent,
65300
+ autoRefresh: !0
65301
+ });
65302
+ }
65303
+ changeCellValuesByRecords(changeValues, options) {
65304
+ var _a, _b, _c, _d, _e, _f, _g;
65305
+ const triggerEvent = null === (_a = null == options ? void 0 : options.triggerEvent) || void 0 === _a || _a,
65306
+ silentChangeCellValuesEvent = null == options ? void 0 : options.silentChangeCellValuesEvent,
65307
+ autoRefresh = null === (_b = null == options ? void 0 : options.autoRefresh) || void 0 === _b || _b,
65308
+ resultChangeValues = [];
65309
+ for (let i = 0; i < changeValues.length; i++) {
65310
+ const {
65311
+ recordIndex: recordIndex,
65312
+ field: field,
65313
+ value: value
65314
+ } = changeValues[i],
65315
+ records = null === (_c = this.dataSource.dataSourceObj) || void 0 === _c ? void 0 : _c.records;
65316
+ let record, oldValue;
65317
+ if (!Array.isArray(records) || "string" != typeof field && "number" != typeof field || (record = Array.isArray(recordIndex) ? getValueFromDeepArray(records, recordIndex) : records[recordIndex], oldValue = null == record ? void 0 : record[field]), this.dataSource.changeFieldValueByRecordIndex(value, recordIndex, field, this), triggerEvent) {
65318
+ const changedValue = !record || "string" != typeof field && "number" != typeof field ? value : null == record ? void 0 : record[field];
65319
+ if (oldValue !== changedValue) {
65320
+ const changeValue = {
65321
+ col: null !== (_e = null === (_d = this.getCellAddrByFieldRecord(field, recordIndex)) || void 0 === _d ? void 0 : _d.col) && void 0 !== _e ? _e : -1,
65322
+ row: null !== (_g = null === (_f = this.getCellAddrByFieldRecord(field, recordIndex)) || void 0 === _f ? void 0 : _f.row) && void 0 !== _g ? _g : -1,
65323
+ recordIndex: recordIndex,
65324
+ field: field,
65325
+ rawValue: oldValue,
65326
+ currentValue: oldValue,
65327
+ changedValue: changedValue
65328
+ };
65329
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), resultChangeValues.push(changeValue);
65330
+ }
65331
+ }
65332
+ }
65333
+ !silentChangeCellValuesEvent && resultChangeValues.length && triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
65334
+ values: resultChangeValues
65335
+ }), autoRefresh && this.refreshAfterSourceChange();
65336
+ }
65337
+ changeCellValuesBySource(changeValues, triggerEvent = !0, silentChangeCellValuesEvent) {
65338
+ return this.changeCellValuesByRecords(changeValues, {
65339
+ triggerEvent: triggerEvent,
65340
+ silentChangeCellValuesEvent: silentChangeCellValuesEvent,
65341
+ autoRefresh: !0
65342
+ });
65343
+ }
65344
+ refreshAfterSourceChange(options) {
65345
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
65346
+ const reapplyFilter = null === (_a = null == options ? void 0 : options.reapplyFilter) || void 0 === _a || _a,
65347
+ reapplySort = null === (_b = null == options ? void 0 : options.reapplySort) || void 0 === _b || _b,
65348
+ clearRowHeightCache = null === (_c = null == options ? void 0 : options.clearRowHeightCache) || void 0 === _c || _c;
65349
+ this.scenegraph.clearCells(), this.sortState && reapplySort && (null === (_e = (_d = this.dataSource).clearSortedIndexMap) || void 0 === _e || _e.call(_d), null === (_g = null === (_f = this.dataSource.sortedIndexMap) || void 0 === _f ? void 0 : _f.clear) || void 0 === _g || _g.call(_f)), reapplyFilter ? this.sortState && reapplySort ? (this.dataSource.updateFilterRulesForSorted(null === (_h = this.dataSource.dataConfig) || void 0 === _h ? void 0 : _h.filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(null === (_j = this.dataSource.dataConfig) || void 0 === _j ? void 0 : _j.filterRules) : this.sortState && reapplySort && sortRecords(this);
65350
+ const traverseColumns = columns => {
65351
+ var _a, _b, _c, _d;
65352
+ for (let i = 0; i < (null !== (_a = null == columns ? void 0 : columns.length) && void 0 !== _a ? _a : 0); i++) {
65353
+ const column = columns[i],
65354
+ aggregators = null == column ? void 0 : column.vtable_aggregator;
65355
+ if (aggregators) if (Array.isArray(aggregators)) for (let j = 0; j < aggregators.length; j++) null === (_c = null === (_b = aggregators[j]) || void 0 === _b ? void 0 : _b.recalculate) || void 0 === _c || _c.call(_b);else null === (_d = null == aggregators ? void 0 : aggregators.recalculate) || void 0 === _d || _d.call(aggregators);
65356
+ (null == column ? void 0 : column.columns) && traverseColumns(column.columns);
65357
+ }
65358
+ };
65359
+ traverseColumns(this.internalProps.columns), this.refreshRowColCount(), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1, this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(!clearRowHeightCache), null === (_k = this.internalProps.emptyTip) || void 0 === _k || _k.resetVisible(), this.resize();
65360
+ }
65361
+ addRecord(record, recordIndex, triggerEvent = !0) {
65220
65362
  var _a;
65221
65363
  const success = listTableAddRecord(record, recordIndex, this);
65222
- adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
65364
+ adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
65223
65365
  records: [record],
65224
65366
  recordIndex: recordIndex,
65225
65367
  recordCount: 1
65226
65368
  });
65227
65369
  }
65228
- addRecords(records, recordIndex) {
65370
+ addRecords(records, recordIndex, triggerEvent = !0) {
65229
65371
  var _a;
65230
65372
  const success = listTableAddRecords(records, recordIndex, this);
65231
- "number" == typeof recordIndex && adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
65373
+ "number" == typeof recordIndex && adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
65232
65374
  records: records,
65233
65375
  recordIndex: recordIndex,
65234
65376
  recordCount: records.length
65235
65377
  });
65236
65378
  }
65237
- deleteRecords(recordIndexs) {
65379
+ deleteRecords(recordIndexs, triggerEvent = !0) {
65238
65380
  var _a;
65239
65381
  const deletedRecords = [];
65240
65382
  (null == recordIndexs ? void 0 : recordIndexs.length) > 0 && recordIndexs.forEach(index => {
@@ -65243,15 +65385,15 @@
65243
65385
  }), listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
65244
65386
  const rowIndexs = [];
65245
65387
  for (let i = 0; i < recordIndexs.length; i++) rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
65246
- this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
65388
+ triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
65247
65389
  recordIndexs: recordIndexs,
65248
65390
  records: deletedRecords,
65249
65391
  rowIndexs: rowIndexs,
65250
65392
  deletedCount: (Array.isArray(recordIndexs[0]), recordIndexs.length)
65251
65393
  });
65252
65394
  }
65253
- updateRecords(records, recordIndexs) {
65254
- listTableUpdateRecords(records, recordIndexs, this), this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
65395
+ updateRecords(records, recordIndexs, triggerEvent = !0) {
65396
+ listTableUpdateRecords(records, recordIndexs, this), triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
65255
65397
  records: records,
65256
65398
  recordIndexs: recordIndexs,
65257
65399
  updateCount: records.length
@@ -69471,8 +69613,8 @@
69471
69613
  }(ExcelEditCellKeyboardResponse || (ExcelEditCellKeyboardResponse = {}));
69472
69614
  class ExcelEditCellKeyboardPlugin {
69473
69615
  constructor(pluginOptions) {
69474
- var _a, _b;
69475
- this.id = "excel-edit-cell-keyboard", this.name = "Excel Edit Cell Keyboard", this.runTime = [TABLE_EVENT_TYPE.INITIALIZED], this.id = null !== (_a = null == pluginOptions ? void 0 : pluginOptions.id) && void 0 !== _a ? _a : this.id, this.pluginOptions = pluginOptions, this.responseKeyboard = null !== (_b = null == pluginOptions ? void 0 : pluginOptions.responseKeyboard) && void 0 !== _b ? _b : [ExcelEditCellKeyboardResponse.ENTER, ExcelEditCellKeyboardResponse.TAB, ExcelEditCellKeyboardResponse.ARROW_LEFT, ExcelEditCellKeyboardResponse.ARROW_RIGHT, ExcelEditCellKeyboardResponse.ARROW_DOWN, ExcelEditCellKeyboardResponse.ARROW_UP, ExcelEditCellKeyboardResponse.DELETE, ExcelEditCellKeyboardResponse.BACKSPACE], this.bindEvent();
69616
+ var _a, _b, _c;
69617
+ this.id = "excel-edit-cell-keyboard", this.name = "Excel Edit Cell Keyboard", this.runTime = [TABLE_EVENT_TYPE.INITIALIZED], this.id = null !== (_a = null == pluginOptions ? void 0 : pluginOptions.id) && void 0 !== _a ? _a : this.id, this.pluginOptions = pluginOptions, this.responseKeyboard = null !== (_b = null == pluginOptions ? void 0 : pluginOptions.responseKeyboard) && void 0 !== _b ? _b : [ExcelEditCellKeyboardResponse.ENTER, ExcelEditCellKeyboardResponse.TAB, ExcelEditCellKeyboardResponse.ARROW_LEFT, ExcelEditCellKeyboardResponse.ARROW_RIGHT, ExcelEditCellKeyboardResponse.ARROW_DOWN, ExcelEditCellKeyboardResponse.ARROW_UP, ExcelEditCellKeyboardResponse.DELETE, ExcelEditCellKeyboardResponse.BACKSPACE], this.aggregateDeleteToOneChangeCellValuesEvent = null !== (_c = null == pluginOptions ? void 0 : pluginOptions.aggregateDeleteToOneChangeCellValuesEvent) && void 0 !== _c && _c, this.bindEvent();
69476
69618
  }
69477
69619
  run(...args) {
69478
69620
  const table = args[2];
@@ -69503,7 +69645,7 @@
69503
69645
  (null == selectCells ? void 0 : selectCells.length) > 0 && (document.activeElement === this.table.getElement() || Object.values(this.table.editorManager.cacheLastSelectedCellEditor || {}).some(editor => {
69504
69646
  var _a;
69505
69647
  return (null === (_a = editor.getInputElement) || void 0 === _a ? void 0 : _a.call(editor)) === document.activeElement;
69506
- })) && (deleteSelectRange(selectCells, this.table, null === (_c = null === (_b = this.pluginOptions) || void 0 === _b ? void 0 : _b.deleteWorkOnEditableCell) || void 0 === _c || _c), event.stopPropagation(), event.preventDefault());
69648
+ })) && (deleteSelectRange(selectCells, this.table, null === (_c = null === (_b = this.pluginOptions) || void 0 === _b ? void 0 : _b.deleteWorkOnEditableCell) || void 0 === _c || _c, this.aggregateDeleteToOneChangeCellValuesEvent), event.stopPropagation(), event.preventDefault());
69507
69649
  }
69508
69650
  } else this.table.editorManager.completeEdit(), this.table.getElement().focus(), eventKey === ExcelEditCellKeyboardResponse.ENTER ? this.table.selectCell(col, row + 1) : eventKey === ExcelEditCellKeyboardResponse.TAB && this.table.selectCell(col + 1, row), event.stopPropagation(), event.preventDefault();
69509
69651
  }
@@ -69525,8 +69667,11 @@
69525
69667
  document.removeEventListener("keydown", this.handleKeyDown, !0);
69526
69668
  }
69527
69669
  }
69528
- function deleteSelectRange(selectCells, tableInstance, workOnEditableCell = !1) {
69529
- for (let i = 0; i < selectCells.length; i++) for (let j = 0; j < selectCells[i].length; j++) tableInstance.changeCellValue(selectCells[i][j].col, selectCells[i][j].row, "", workOnEditableCell);
69670
+ function deleteSelectRange(selectCells, tableInstance, workOnEditableCell = !1, aggregateToOneChangeCellValuesEvent = !1) {
69671
+ if (aggregateToOneChangeCellValuesEvent) {
69672
+ const ranges = tableInstance.stateManager.select.ranges;
69673
+ (null == ranges ? void 0 : ranges.length) && tableInstance.changeCellValuesByIds(ranges, "", workOnEditableCell, !0);
69674
+ } else for (let i = 0; i < selectCells.length; i++) for (let j = 0; j < selectCells[i].length; j++) tableInstance.changeCellValue(selectCells[i][j].col, selectCells[i][j].row, "", workOnEditableCell);
69530
69675
  }
69531
69676
 
69532
69677
  const MENU_CONTAINER_CLASS = "vtable-context-menu-container";
@@ -91089,7 +91234,7 @@
91089
91234
  importStyle();
91090
91235
  }
91091
91236
 
91092
- const version = "1.22.11-alpha.1";
91237
+ const version = "1.22.11-alpha.2";
91093
91238
  importStyles();
91094
91239
 
91095
91240
  exports.TYPES = index;