@visactor/vtable-calendar 1.22.10 → 1.22.11-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34879,6 +34879,7 @@
34879
34879
  AFTER_UPDATE_CELL_CONTENT_WIDTH: "after_update_cell_content_width",
34880
34880
  AFTER_UPDATE_SELECT_BORDER_HEIGHT: "after_update_select_border_height",
34881
34881
  CHANGE_CELL_VALUE: "change_cell_value",
34882
+ CHANGE_CELL_VALUES: "change_cell_values",
34882
34883
  DRAG_FILL_HANDLE_END: "drag_fill_handle_end",
34883
34884
  MOUSEDOWN_FILL_HANDLE: "mousedown_fill_handle",
34884
34885
  DBLCLICK_FILL_HANDLE: "dblclick_fill_handle",
@@ -53811,7 +53812,13 @@
53811
53812
  try {
53812
53813
  const selectCells = this.cutCellRange;
53813
53814
  if (!selectCells || 0 === selectCells.length) return;
53814
- 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);
53815
+ const changeValues = [];
53816
+ for (let i = 0; i < selectCells.length; i++) for (let j = 0; j < selectCells[i].length; j++) selectCells[i][j] && changeValues.push({
53817
+ col: selectCells[i][j].col,
53818
+ row: selectCells[i][j].row,
53819
+ value: void 0
53820
+ });
53821
+ table.changeCellValuesByIds(changeValues);
53815
53822
  } catch (error) {}
53816
53823
  }
53817
53824
  checkClipboardChanged() {
@@ -56054,7 +56061,7 @@
56054
56061
  }
56055
56062
  constructor(container, options = {}) {
56056
56063
  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;
56057
- if (super(), this.showFrozenIcon = !0, this.version = "1.22.10", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.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");
56064
+ 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.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");
56058
56065
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
56059
56066
  options: options,
56060
56067
  container: container
@@ -59829,15 +59836,16 @@
59829
59836
  step((generator = generator.apply(thisArg, _arguments || [])).next());
59830
59837
  });
59831
59838
  };
59832
- function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table) {
59839
+ function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
59833
59840
  if (workOnEditableCell && table.isHasEditorDefine(col, row) || !1 === workOnEditableCell) {
59834
- const recordIndex = table.getRecordShowIndexByCell(col, row),
59841
+ const recordShowIndex = table.getRecordShowIndexByCell(col, row),
59842
+ recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
59835
59843
  {
59836
59844
  field: field
59837
59845
  } = table.internalProps.layoutMap.getBody(col, row),
59838
59846
  beforeChangeValue = table.getCellRawValue(col, row),
59839
59847
  oldValue = table.getCellOriginValue(col, row);
59840
- table.isHeader(col, row) ? table.internalProps.layoutMap.updateColumnTitle(col, row, value) : table.dataSource.changeFieldValue(value, recordIndex, field, col, row, table);
59848
+ table.isHeader(col, row) ? table.internalProps.layoutMap.updateColumnTitle(col, row, value) : table.dataSource.changeFieldValue(value, recordShowIndex, field, col, row, table);
59841
59849
  const range = table.getCellRange(col, row),
59842
59850
  aggregators = table.internalProps.layoutMap.getAggregatorsByCell(col, row);
59843
59851
  if (aggregators) {
@@ -59860,16 +59868,24 @@
59860
59868
  table.scenegraph.updateRowHeight(row, newHeight - oldHeight);
59861
59869
  }
59862
59870
  const changedValue = table.getCellOriginValue(col, row);
59863
- oldValue !== changedValue && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
59864
- col: col,
59865
- row: row,
59866
- rawValue: beforeChangeValue,
59867
- currentValue: oldValue,
59868
- changedValue: changedValue
59869
- }), table.scenegraph.updateNextFrame();
59871
+ if (oldValue !== changedValue && triggerEvent) {
59872
+ const changeValue = {
59873
+ col: col,
59874
+ row: row,
59875
+ recordIndex: recordIndex,
59876
+ field: field,
59877
+ rawValue: beforeChangeValue,
59878
+ currentValue: oldValue,
59879
+ changedValue: changedValue
59880
+ };
59881
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), silentChangeCellValuesEvent || table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
59882
+ values: [changeValue]
59883
+ });
59884
+ }
59885
+ table.scenegraph.updateNextFrame();
59870
59886
  }
59871
59887
  }
59872
- function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table) {
59888
+ function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
59873
59889
  var _a, _b;
59874
59890
  return __awaiter(this, void 0, void 0, function* () {
59875
59891
  const changedCellResults = [];
@@ -59891,6 +59907,7 @@
59891
59907
  oldRowValues.push(oldValue);
59892
59908
  }
59893
59909
  }
59910
+ const resultChangeValues = [];
59894
59911
  for (let i = 0; i < values.length && !(startRow + i > table.rowCount - 1); i++) {
59895
59912
  changedCellResults[i] = [], pasteRowEnd = startRow + i;
59896
59913
  const rowValues = values[i];
@@ -59914,25 +59931,34 @@
59914
59931
  if (isCanChange) {
59915
59932
  changedCellResults[i][j] = !0;
59916
59933
  const value = rowValues[j],
59917
- recordIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i),
59934
+ recordShowIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i),
59935
+ recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
59918
59936
  {
59919
59937
  field: field
59920
59938
  } = table.internalProps.layoutMap.getBody(startCol + j, startRow + i),
59921
59939
  beforeChangeValue = beforeChangeValues[i][j],
59922
59940
  oldValue = oldValues[i][j];
59923
- 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);
59941
+ 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);
59924
59942
  const changedValue = table.getCellOriginValue(startCol + j, startRow + i);
59925
- oldValue !== changedValue && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
59926
- col: startCol + j,
59927
- row: startRow + i,
59928
- rawValue: beforeChangeValue,
59929
- currentValue: oldValue,
59930
- changedValue: changedValue
59931
- });
59943
+ if (oldValue !== changedValue && triggerEvent) {
59944
+ const changeValue = {
59945
+ col: startCol + j,
59946
+ row: startRow + i,
59947
+ recordIndex: recordIndex,
59948
+ field: field,
59949
+ rawValue: beforeChangeValue,
59950
+ currentValue: oldValue,
59951
+ changedValue: changedValue
59952
+ };
59953
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), resultChangeValues.push(changeValue);
59954
+ }
59932
59955
  } else changedCellResults[i][j] = !1;
59933
59956
  }
59934
59957
  pasteColEnd = Math.max(pasteColEnd, thisRowPasteColEnd);
59935
59958
  }
59959
+ silentChangeCellValuesEvent || table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
59960
+ values: resultChangeValues
59961
+ });
59936
59962
  const startRange = table.getCellRange(startCol, startRow),
59937
59963
  range = table.getCellRange(pasteColEnd, pasteRowEnd),
59938
59964
  aggregators = table.internalProps.layoutMap.getAggregatorsByCellRange(startRange.start.col, startRange.start.row, range.end.col, range.end.row);
@@ -59966,6 +59992,36 @@
59966
59992
  return table.scenegraph.updateNextFrame(), changedCellResults;
59967
59993
  });
59968
59994
  }
59995
+ function listTableChangeCellValuesByIds(changeValues, triggerEvent, table, silentChangeCellValuesEvent) {
59996
+ return __awaiter(this, void 0, void 0, function* () {
59997
+ const resultChangeValues = [];
59998
+ for (let i = 0; i < changeValues.length; i++) {
59999
+ const {
60000
+ col: col,
60001
+ row: row,
60002
+ value: value
60003
+ } = changeValues[i],
60004
+ recordShowIndex = table.getRecordShowIndexByCell(col, row),
60005
+ recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
60006
+ {
60007
+ field: field
60008
+ } = table.internalProps.layoutMap.getBody(col, row),
60009
+ oldValue = table.getCellOriginValue(col, row);
60010
+ listTableChangeCellValue(col, row, value, !1, triggerEvent, table, !0), oldValue !== value && triggerEvent && resultChangeValues.push({
60011
+ col: col,
60012
+ row: row,
60013
+ recordIndex: recordIndex,
60014
+ field: field,
60015
+ rawValue: oldValue,
60016
+ currentValue: oldValue,
60017
+ changedValue: value
60018
+ });
60019
+ }
60020
+ silentChangeCellValuesEvent || table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
60021
+ values: resultChangeValues
60022
+ });
60023
+ });
60024
+ }
59969
60025
  function getCellUpdateType(col, row, table, oldCellUpdateType) {
59970
60026
  if ("group" === oldCellUpdateType) return oldCellUpdateType;
59971
60027
  if ("sort" === oldCellUpdateType && !table.internalProps.groupBy) return oldCellUpdateType;
@@ -61129,11 +61185,37 @@
61129
61185
  }
61130
61186
  return isValid$1(editorDefine);
61131
61187
  }
61132
- changeCellValue(col, row, value, workOnEditableCell = !1, triggerEvent = !0) {
61133
- return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this);
61134
- }
61135
- changeCellValues(startCol, startRow, values, workOnEditableCell = !1, triggerEvent = !0) {
61136
- return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this);
61188
+ changeCellValue(col, row, value, workOnEditableCell = !1, triggerEvent = !0, silentChangeCellValuesEvent) {
61189
+ return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
61190
+ }
61191
+ changeCellValues(startCol, startRow, values, workOnEditableCell = !1, triggerEvent = !0, silentChangeCellValuesEvent) {
61192
+ return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
61193
+ }
61194
+ changeCellValuesByIds(changeValues, triggerEvent = !0, silentChangeCellValuesEvent) {
61195
+ return listTableChangeCellValuesByIds(changeValues, triggerEvent, this, silentChangeCellValuesEvent);
61196
+ }
61197
+ changeSourceCellValue(recordIndex, field, value) {
61198
+ const tableIndex = this.getTableIndexByRecordIndex(recordIndex),
61199
+ cellAddr = this.getCellAddrByFieldRecord(field, recordIndex);
61200
+ if (tableIndex < 0 || cellAddr.col < 0 || cellAddr.row < 0) return;
61201
+ this.dataSource.changeFieldValue(value, tableIndex, field, cellAddr.col, cellAddr.row, this);
61202
+ const beforeChangeValue = this.getCellRawValue(cellAddr.col, cellAddr.row),
61203
+ oldValue = this.getCellOriginValue(cellAddr.col, cellAddr.row),
61204
+ changedValue = this.getCellOriginValue(cellAddr.col, cellAddr.row);
61205
+ if (oldValue !== changedValue) {
61206
+ const changeValue = {
61207
+ col: cellAddr.col,
61208
+ row: cellAddr.row,
61209
+ recordIndex: recordIndex,
61210
+ field: field,
61211
+ rawValue: beforeChangeValue,
61212
+ currentValue: oldValue,
61213
+ changedValue: changedValue
61214
+ };
61215
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
61216
+ values: [changeValue]
61217
+ });
61218
+ }
61137
61219
  }
61138
61220
  addRecord(record, recordIndex) {
61139
61221
  var _a;
@@ -61155,11 +61237,16 @@
61155
61237
  }
61156
61238
  deleteRecords(recordIndexs) {
61157
61239
  var _a;
61158
- listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
61240
+ const deletedRecords = [];
61241
+ (null == recordIndexs ? void 0 : recordIndexs.length) > 0 && recordIndexs.forEach(index => {
61242
+ let record = null;
61243
+ record = "number" == typeof index ? this.dataSource.get(index) : [], deletedRecords.push(record);
61244
+ }), listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
61159
61245
  const rowIndexs = [];
61160
61246
  for (let i = 0; i < recordIndexs.length; i++) rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
61161
61247
  this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
61162
61248
  recordIndexs: recordIndexs,
61249
+ records: deletedRecords,
61163
61250
  rowIndexs: rowIndexs,
61164
61251
  deletedCount: (Array.isArray(recordIndexs[0]), recordIndexs.length)
61165
61252
  });