@visactor/vtable-sheet 1.22.11-alpha.2 → 1.22.11-alpha.3

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.2";
5
+ export declare const version = "1.22.11-alpha.3";
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.2", (0, style_manager_1.importStyles)();
50
+ exports.version = "1.22.11-alpha.3", (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.2\";\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.3\";\n// 导入样式\nimportStyles();\n/**\n * @namespace VTableSheet\n */\nexport { VTableSheet, TYPES, VTable, ISheetDefine, IVTableSheetOptions };\n"]}
@@ -38828,7 +38828,6 @@
38828
38828
  AFTER_UPDATE_CELL_CONTENT_WIDTH: "after_update_cell_content_width",
38829
38829
  AFTER_UPDATE_SELECT_BORDER_HEIGHT: "after_update_select_border_height",
38830
38830
  CHANGE_CELL_VALUE: "change_cell_value",
38831
- CHANGE_CELL_VALUES: "change_cell_values",
38832
38831
  DRAG_FILL_HANDLE_END: "drag_fill_handle_end",
38833
38832
  MOUSEDOWN_FILL_HANDLE: "mousedown_fill_handle",
38834
38833
  DBLCLICK_FILL_HANDLE: "dblclick_fill_handle",
@@ -40955,24 +40954,6 @@
40955
40954
  }
40956
40955
  }
40957
40956
  }
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
- }
40976
40957
  cacheBeforeChangedRecord(dataIndex, table) {
40977
40958
  var _a;
40978
40959
  if (!this.beforeChangedRecordsMap.has(dataIndex.toString())) {
@@ -41038,16 +41019,9 @@
41038
41019
  }
41039
41020
  }
41040
41021
  adjustBeforeChangedRecordsMap(insertIndex, insertCount, type = "add") {
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);
41022
+ for (let key = this.beforeChangedRecordsMap.size - 1; key >= insertIndex; key--) {
41023
+ const record = this.beforeChangedRecordsMap.get(key.toString());
41024
+ this.beforeChangedRecordsMap.delete(key.toString()), this.beforeChangedRecordsMap.set((key + ("add" === type ? insertCount : -insertCount)).toString(), record);
41051
41025
  }
41052
41026
  }
41053
41027
  deleteRecords(recordIndexs) {
@@ -57411,7 +57385,7 @@
57411
57385
  };
57412
57386
  let EventManager$1 = class EventManager {
57413
57387
  constructor(table) {
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(() => {
57388
+ 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(() => {
57415
57389
  this.bindSelfEvent();
57416
57390
  }, 0));
57417
57391
  }
@@ -57713,25 +57687,15 @@
57713
57687
  } catch (error) {}
57714
57688
  }
57715
57689
  handleCut(e) {
57716
- var _a;
57717
57690
  return __awaiter$1(this, void 0, void 0, function* () {
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);
57691
+ this.handleCopy(e, !0), this.cutWaitPaste = !0, this.cutCellRange = this.table.getSelectedCellInfos(), this.clipboardCheckTimer && clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = window.setTimeout(() => {
57692
+ this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer = null);
57729
57693
  }, 3e4), this.saveClipboardContent();
57730
57694
  });
57731
57695
  }
57732
57696
  handlePaste(e) {
57733
57697
  this.cutWaitPaste ? this.checkClipboardChanged().then(changed => {
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));
57698
+ this.executePaste(e), changed || this.clearCutArea(this.table), this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer && (clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = null));
57735
57699
  }).catch(() => {
57736
57700
  this.executePaste(e), this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer && (clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = null));
57737
57701
  }) : this.executePaste(e);
@@ -57808,9 +57772,9 @@
57808
57772
  }
57809
57773
  clearCutArea(table) {
57810
57774
  try {
57811
- const ranges = this.cutRanges;
57812
- if (!ranges || 0 === ranges.length) return;
57813
- table.changeCellValuesByIds(ranges, "");
57775
+ const selectCells = this.cutCellRange;
57776
+ if (!selectCells || 0 === selectCells.length) return;
57777
+ for (let i = 0; i < selectCells.length; i++) for (let j = 0; j < selectCells[i].length; j++) selectCells[i][j] && table.changeCellValue(selectCells[i][j].col, selectCells[i][j].row, void 0);
57814
57778
  } catch (error) {}
57815
57779
  }
57816
57780
  checkClipboardChanged() {
@@ -60053,7 +60017,7 @@
60053
60017
  }
60054
60018
  constructor(container, options = {}) {
60055
60019
  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;
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");
60020
+ if (super(), this.showFrozenIcon = !0, this.version = "1.22.11-alpha.3", 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");
60057
60021
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
60058
60022
  options: options,
60059
60023
  container: container
@@ -63713,9 +63677,9 @@
63713
63677
  };
63714
63678
  col === this.table.colCount - 1 ? referencePosition.rect.width = rect.width - 1 : referencePosition.rect.width = rect.width + 1, row === this.table.rowCount - 1 ? referencePosition.rect.height = rect.height - 1 : referencePosition.rect.height = rect.height + 1;
63715
63679
  const editor = this.table.getEditor(col, row);
63716
- setTimeout(() => {
63680
+ editor && setTimeout(() => {
63717
63681
  var _a;
63718
- this.editingEditor !== editor && (null === (_a = editor.prepareEdit) || void 0 === _a || _a.call(editor, {
63682
+ editor && this.editingEditor !== editor && (null === (_a = editor.prepareEdit) || void 0 === _a || _a.call(editor, {
63719
63683
  referencePosition: referencePosition,
63720
63684
  container: this.table.getElement(),
63721
63685
  table: this.table,
@@ -63864,16 +63828,15 @@
63864
63828
  step((generator = generator.apply(thisArg, _arguments || [])).next());
63865
63829
  });
63866
63830
  };
63867
- function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
63831
+ function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table) {
63868
63832
  if (workOnEditableCell && table.isHasEditorDefine(col, row) || !1 === workOnEditableCell) {
63869
- const recordShowIndex = table.getRecordShowIndexByCell(col, row),
63870
- recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
63833
+ const recordIndex = table.getRecordShowIndexByCell(col, row),
63871
63834
  {
63872
63835
  field: field
63873
63836
  } = table.internalProps.layoutMap.getBody(col, row),
63874
63837
  beforeChangeValue = table.getCellRawValue(col, row),
63875
63838
  oldValue = table.getCellOriginValue(col, row);
63876
- table.isHeader(col, row) ? table.internalProps.layoutMap.updateColumnTitle(col, row, value) : table.dataSource.changeFieldValue(value, recordShowIndex, field, col, row, table);
63839
+ table.isHeader(col, row) ? table.internalProps.layoutMap.updateColumnTitle(col, row, value) : table.dataSource.changeFieldValue(value, recordIndex, field, col, row, table);
63877
63840
  const range = table.getCellRange(col, row),
63878
63841
  aggregators = table.internalProps.layoutMap.getAggregatorsByCell(col, row);
63879
63842
  if (aggregators) {
@@ -63896,24 +63859,16 @@
63896
63859
  table.scenegraph.updateRowHeight(row, newHeight - oldHeight);
63897
63860
  }
63898
63861
  const changedValue = table.getCellOriginValue(col, row);
63899
- if (oldValue !== changedValue && triggerEvent) {
63900
- const changeValue = {
63901
- col: col,
63902
- row: row,
63903
- recordIndex: recordIndex,
63904
- field: field,
63905
- rawValue: beforeChangeValue,
63906
- currentValue: oldValue,
63907
- changedValue: changedValue
63908
- };
63909
- table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), silentChangeCellValuesEvent || table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
63910
- values: [changeValue]
63911
- });
63912
- }
63913
- table.scenegraph.updateNextFrame();
63862
+ oldValue !== changedValue && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
63863
+ col: col,
63864
+ row: row,
63865
+ rawValue: beforeChangeValue,
63866
+ currentValue: oldValue,
63867
+ changedValue: changedValue
63868
+ }), table.scenegraph.updateNextFrame();
63914
63869
  }
63915
63870
  }
63916
- function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
63871
+ function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table) {
63917
63872
  var _a, _b;
63918
63873
  return __awaiter(this, void 0, void 0, function* () {
63919
63874
  const changedCellResults = [];
@@ -63935,7 +63890,6 @@
63935
63890
  oldRowValues.push(oldValue);
63936
63891
  }
63937
63892
  }
63938
- const resultChangeValues = [];
63939
63893
  for (let i = 0; i < values.length && !(startRow + i > table.rowCount - 1); i++) {
63940
63894
  changedCellResults[i] = [], pasteRowEnd = startRow + i;
63941
63895
  const rowValues = values[i];
@@ -63959,34 +63913,25 @@
63959
63913
  if (isCanChange) {
63960
63914
  changedCellResults[i][j] = !0;
63961
63915
  const value = rowValues[j],
63962
- recordShowIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i),
63963
- recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
63916
+ recordIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i),
63964
63917
  {
63965
63918
  field: field
63966
63919
  } = table.internalProps.layoutMap.getBody(startCol + j, startRow + i),
63967
63920
  beforeChangeValue = beforeChangeValues[i][j],
63968
63921
  oldValue = oldValues[i][j];
63969
- table.isHeader(startCol + j, startRow + i) ? table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value) : table.dataSource.changeFieldValue(value, recordShowIndex, field, startCol + j, startRow + i, table);
63922
+ table.isHeader(startCol + j, startRow + i) ? table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value) : table.dataSource.changeFieldValue(value, recordIndex, field, startCol + j, startRow + i, table);
63970
63923
  const changedValue = table.getCellOriginValue(startCol + j, startRow + i);
63971
- if (oldValue !== changedValue && triggerEvent) {
63972
- const changeValue = {
63973
- col: startCol + j,
63974
- row: startRow + i,
63975
- recordIndex: recordIndex,
63976
- field: field,
63977
- rawValue: beforeChangeValue,
63978
- currentValue: oldValue,
63979
- changedValue: changedValue
63980
- };
63981
- table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), resultChangeValues.push(changeValue);
63982
- }
63924
+ oldValue !== changedValue && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
63925
+ col: startCol + j,
63926
+ row: startRow + i,
63927
+ rawValue: beforeChangeValue,
63928
+ currentValue: oldValue,
63929
+ changedValue: changedValue
63930
+ });
63983
63931
  } else changedCellResults[i][j] = !1;
63984
63932
  }
63985
63933
  pasteColEnd = Math.max(pasteColEnd, thisRowPasteColEnd);
63986
63934
  }
63987
- silentChangeCellValuesEvent || table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
63988
- values: resultChangeValues
63989
- });
63990
63935
  const startRange = table.getCellRange(startCol, startRow),
63991
63936
  range = table.getCellRange(pasteColEnd, pasteRowEnd),
63992
63937
  aggregators = table.internalProps.layoutMap.getAggregatorsByCellRange(startRange.start.col, startRange.start.row, range.end.col, range.end.row);
@@ -64020,58 +63965,6 @@
64020
63965
  return table.scenegraph.updateNextFrame(), changedCellResults;
64021
63966
  });
64022
63967
  }
64023
- function listTableChangeCellValuesByIds(ranges, value, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
64024
- var _a, _b;
64025
- return __awaiter(this, void 0, void 0, function* () {
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({
64060
- col: col,
64061
- row: row,
64062
- recordIndex: recordIndex,
64063
- field: field,
64064
- rawValue: oldValue,
64065
- currentValue: oldValue,
64066
- changedValue: changedValue
64067
- });
64068
- }
64069
- }
64070
- !silentChangeCellValuesEvent && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
64071
- values: resultChangeValues
64072
- });
64073
- });
64074
- }
64075
63968
  function getCellUpdateType(col, row, table, oldCellUpdateType) {
64076
63969
  if ("group" === oldCellUpdateType) return oldCellUpdateType;
64077
63970
  if ("sort" === oldCellUpdateType && !table.internalProps.groupBy) return oldCellUpdateType;
@@ -65235,165 +65128,43 @@
65235
65128
  }
65236
65129
  return isValid$2(editorDefine);
65237
65130
  }
65238
- changeCellValue(col, row, value, workOnEditableCell = !1, triggerEvent = !0, silentChangeCellValuesEvent) {
65239
- return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
65240
- }
65241
- changeCellValues(startCol, startRow, values, workOnEditableCell = !1, triggerEvent = !0, silentChangeCellValuesEvent) {
65242
- return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
65243
- }
65244
- changeCellValuesByIds(ranges, value, workOnEditableCell = !1, triggerEvent = !0, silentChangeCellValuesEvent) {
65245
- return listTableChangeCellValuesByIds(ranges, value, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
65246
- }
65247
- changeSourceCellValue(recordIndex, field, value) {
65248
- const tableIndex = this.getTableIndexByRecordIndex(recordIndex),
65249
- cellAddr = this.getCellAddrByFieldRecord(field, recordIndex);
65250
- if (tableIndex < 0 || cellAddr.col < 0 || cellAddr.row < 0) return;
65251
- this.dataSource.changeFieldValue(value, tableIndex, field, cellAddr.col, cellAddr.row, this);
65252
- const beforeChangeValue = this.getCellRawValue(cellAddr.col, cellAddr.row),
65253
- oldValue = this.getCellOriginValue(cellAddr.col, cellAddr.row),
65254
- changedValue = this.getCellOriginValue(cellAddr.col, cellAddr.row);
65255
- if (oldValue !== changedValue) {
65256
- const changeValue = {
65257
- col: cellAddr.col,
65258
- row: cellAddr.row,
65259
- recordIndex: recordIndex,
65260
- field: field,
65261
- rawValue: beforeChangeValue,
65262
- currentValue: oldValue,
65263
- changedValue: changedValue
65264
- };
65265
- this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
65266
- values: [changeValue]
65267
- });
65268
- }
65269
- }
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
- });
65131
+ changeCellValue(col, row, value, workOnEditableCell = !1, triggerEvent = !0) {
65132
+ return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this);
65343
65133
  }
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();
65134
+ changeCellValues(startCol, startRow, values, workOnEditableCell = !1, triggerEvent = !0) {
65135
+ return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this);
65360
65136
  }
65361
- addRecord(record, recordIndex, triggerEvent = !0) {
65137
+ addRecord(record, recordIndex) {
65362
65138
  var _a;
65363
65139
  const success = listTableAddRecord(record, recordIndex, this);
65364
- adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
65140
+ adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
65365
65141
  records: [record],
65366
65142
  recordIndex: recordIndex,
65367
65143
  recordCount: 1
65368
65144
  });
65369
65145
  }
65370
- addRecords(records, recordIndex, triggerEvent = !0) {
65146
+ addRecords(records, recordIndex) {
65371
65147
  var _a;
65372
65148
  const success = listTableAddRecords(records, recordIndex, this);
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, {
65149
+ "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, {
65374
65150
  records: records,
65375
65151
  recordIndex: recordIndex,
65376
65152
  recordCount: records.length
65377
65153
  });
65378
65154
  }
65379
- deleteRecords(recordIndexs, triggerEvent = !0) {
65155
+ deleteRecords(recordIndexs) {
65380
65156
  var _a;
65381
- const deletedRecords = [];
65382
- (null == recordIndexs ? void 0 : recordIndexs.length) > 0 && recordIndexs.forEach(index => {
65383
- let record = null;
65384
- record = "number" == typeof index ? this.dataSource.get(index) : [], deletedRecords.push(record);
65385
- }), listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
65157
+ listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
65386
65158
  const rowIndexs = [];
65387
65159
  for (let i = 0; i < recordIndexs.length; i++) rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
65388
- triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
65160
+ this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
65389
65161
  recordIndexs: recordIndexs,
65390
- records: deletedRecords,
65391
65162
  rowIndexs: rowIndexs,
65392
65163
  deletedCount: (Array.isArray(recordIndexs[0]), recordIndexs.length)
65393
65164
  });
65394
65165
  }
65395
- updateRecords(records, recordIndexs, triggerEvent = !0) {
65396
- listTableUpdateRecords(records, recordIndexs, this), triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
65166
+ updateRecords(records, recordIndexs) {
65167
+ listTableUpdateRecords(records, recordIndexs, this), this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
65397
65168
  records: records,
65398
65169
  recordIndexs: recordIndexs,
65399
65170
  updateCount: records.length
@@ -69613,8 +69384,8 @@
69613
69384
  }(ExcelEditCellKeyboardResponse || (ExcelEditCellKeyboardResponse = {}));
69614
69385
  class ExcelEditCellKeyboardPlugin {
69615
69386
  constructor(pluginOptions) {
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();
69387
+ var _a, _b;
69388
+ 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();
69618
69389
  }
69619
69390
  run(...args) {
69620
69391
  const table = args[2];
@@ -69645,7 +69416,7 @@
69645
69416
  (null == selectCells ? void 0 : selectCells.length) > 0 && (document.activeElement === this.table.getElement() || Object.values(this.table.editorManager.cacheLastSelectedCellEditor || {}).some(editor => {
69646
69417
  var _a;
69647
69418
  return (null === (_a = editor.getInputElement) || void 0 === _a ? void 0 : _a.call(editor)) === document.activeElement;
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());
69419
+ })) && (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());
69649
69420
  }
69650
69421
  } 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();
69651
69422
  }
@@ -69667,11 +69438,8 @@
69667
69438
  document.removeEventListener("keydown", this.handleKeyDown, !0);
69668
69439
  }
69669
69440
  }
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);
69441
+ function deleteSelectRange(selectCells, tableInstance, workOnEditableCell = !1) {
69442
+ 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);
69675
69443
  }
69676
69444
 
69677
69445
  const MENU_CONTAINER_CLASS = "vtable-context-menu-container";
@@ -91234,7 +91002,7 @@
91234
91002
  importStyle();
91235
91003
  }
91236
91004
 
91237
- const version = "1.22.11-alpha.2";
91005
+ const version = "1.22.11-alpha.3";
91238
91006
  importStyles();
91239
91007
 
91240
91008
  exports.TYPES = index;