@visactor/vtable-calendar 1.22.11-alpha.1 → 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.
@@ -34879,7 +34879,6 @@
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",
34883
34882
  DRAG_FILL_HANDLE_END: "drag_fill_handle_end",
34884
34883
  MOUSEDOWN_FILL_HANDLE: "mousedown_fill_handle",
34885
34884
  DBLCLICK_FILL_HANDLE: "dblclick_fill_handle",
@@ -53812,13 +53811,7 @@
53812
53811
  try {
53813
53812
  const selectCells = this.cutCellRange;
53814
53813
  if (!selectCells || 0 === selectCells.length) return;
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);
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);
53822
53815
  } catch (error) {}
53823
53816
  }
53824
53817
  checkClipboardChanged() {
@@ -56061,7 +56054,7 @@
56061
56054
  }
56062
56055
  constructor(container, options = {}) {
56063
56056
  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;
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");
56057
+ 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.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");
56065
56058
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
56066
56059
  options: options,
56067
56060
  container: container
@@ -59685,9 +59678,9 @@
59685
59678
  };
59686
59679
  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;
59687
59680
  const editor = this.table.getEditor(col, row);
59688
- setTimeout(() => {
59681
+ editor && setTimeout(() => {
59689
59682
  var _a;
59690
- this.editingEditor !== editor && (null === (_a = editor.prepareEdit) || void 0 === _a || _a.call(editor, {
59683
+ editor && this.editingEditor !== editor && (null === (_a = editor.prepareEdit) || void 0 === _a || _a.call(editor, {
59691
59684
  referencePosition: referencePosition,
59692
59685
  container: this.table.getElement(),
59693
59686
  table: this.table,
@@ -59836,16 +59829,15 @@
59836
59829
  step((generator = generator.apply(thisArg, _arguments || [])).next());
59837
59830
  });
59838
59831
  };
59839
- function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
59832
+ function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table) {
59840
59833
  if (workOnEditableCell && table.isHasEditorDefine(col, row) || !1 === workOnEditableCell) {
59841
- const recordShowIndex = table.getRecordShowIndexByCell(col, row),
59842
- recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
59834
+ const recordIndex = table.getRecordShowIndexByCell(col, row),
59843
59835
  {
59844
59836
  field: field
59845
59837
  } = table.internalProps.layoutMap.getBody(col, row),
59846
59838
  beforeChangeValue = table.getCellRawValue(col, row),
59847
59839
  oldValue = table.getCellOriginValue(col, row);
59848
- table.isHeader(col, row) ? table.internalProps.layoutMap.updateColumnTitle(col, row, value) : table.dataSource.changeFieldValue(value, recordShowIndex, field, col, row, table);
59840
+ table.isHeader(col, row) ? table.internalProps.layoutMap.updateColumnTitle(col, row, value) : table.dataSource.changeFieldValue(value, recordIndex, field, col, row, table);
59849
59841
  const range = table.getCellRange(col, row),
59850
59842
  aggregators = table.internalProps.layoutMap.getAggregatorsByCell(col, row);
59851
59843
  if (aggregators) {
@@ -59868,24 +59860,16 @@
59868
59860
  table.scenegraph.updateRowHeight(row, newHeight - oldHeight);
59869
59861
  }
59870
59862
  const changedValue = table.getCellOriginValue(col, row);
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();
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();
59886
59870
  }
59887
59871
  }
59888
- function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
59872
+ function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table) {
59889
59873
  var _a, _b;
59890
59874
  return __awaiter(this, void 0, void 0, function* () {
59891
59875
  const changedCellResults = [];
@@ -59907,7 +59891,6 @@
59907
59891
  oldRowValues.push(oldValue);
59908
59892
  }
59909
59893
  }
59910
- const resultChangeValues = [];
59911
59894
  for (let i = 0; i < values.length && !(startRow + i > table.rowCount - 1); i++) {
59912
59895
  changedCellResults[i] = [], pasteRowEnd = startRow + i;
59913
59896
  const rowValues = values[i];
@@ -59931,34 +59914,25 @@
59931
59914
  if (isCanChange) {
59932
59915
  changedCellResults[i][j] = !0;
59933
59916
  const value = rowValues[j],
59934
- recordShowIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i),
59935
- recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
59917
+ recordIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i),
59936
59918
  {
59937
59919
  field: field
59938
59920
  } = table.internalProps.layoutMap.getBody(startCol + j, startRow + i),
59939
59921
  beforeChangeValue = beforeChangeValues[i][j],
59940
59922
  oldValue = oldValues[i][j];
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);
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);
59942
59924
  const changedValue = table.getCellOriginValue(startCol + j, startRow + i);
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
- }
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
+ });
59955
59932
  } else changedCellResults[i][j] = !1;
59956
59933
  }
59957
59934
  pasteColEnd = Math.max(pasteColEnd, thisRowPasteColEnd);
59958
59935
  }
59959
- silentChangeCellValuesEvent || table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
59960
- values: resultChangeValues
59961
- });
59962
59936
  const startRange = table.getCellRange(startCol, startRow),
59963
59937
  range = table.getCellRange(pasteColEnd, pasteRowEnd),
59964
59938
  aggregators = table.internalProps.layoutMap.getAggregatorsByCellRange(startRange.start.col, startRange.start.row, range.end.col, range.end.row);
@@ -59992,36 +59966,6 @@
59992
59966
  return table.scenegraph.updateNextFrame(), changedCellResults;
59993
59967
  });
59994
59968
  }
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
- }
60025
59969
  function getCellUpdateType(col, row, table, oldCellUpdateType) {
60026
59970
  if ("group" === oldCellUpdateType) return oldCellUpdateType;
60027
59971
  if ("sort" === oldCellUpdateType && !table.internalProps.groupBy) return oldCellUpdateType;
@@ -61185,37 +61129,11 @@
61185
61129
  }
61186
61130
  return isValid$1(editorDefine);
61187
61131
  }
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
- }
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);
61219
61137
  }
61220
61138
  addRecord(record, recordIndex) {
61221
61139
  var _a;
@@ -61237,16 +61155,11 @@
61237
61155
  }
61238
61156
  deleteRecords(recordIndexs) {
61239
61157
  var _a;
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();
61158
+ listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
61245
61159
  const rowIndexs = [];
61246
61160
  for (let i = 0; i < recordIndexs.length; i++) rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
61247
61161
  this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
61248
61162
  recordIndexs: recordIndexs,
61249
- records: deletedRecords,
61250
61163
  rowIndexs: rowIndexs,
61251
61164
  deletedCount: (Array.isArray(recordIndexs[0]), recordIndexs.length)
61252
61165
  });