@visactor/vtable-sheet 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.
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.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.1", (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.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.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",
@@ -57775,13 +57774,7 @@
57775
57774
  try {
57776
57775
  const selectCells = this.cutCellRange;
57777
57776
  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);
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);
57785
57778
  } catch (error) {}
57786
57779
  }
57787
57780
  checkClipboardChanged() {
@@ -60024,7 +60017,7 @@
60024
60017
  }
60025
60018
  constructor(container, options = {}) {
60026
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;
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");
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");
60028
60021
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
60029
60022
  options: options,
60030
60023
  container: container
@@ -63684,9 +63677,9 @@
63684
63677
  };
63685
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;
63686
63679
  const editor = this.table.getEditor(col, row);
63687
- setTimeout(() => {
63680
+ editor && setTimeout(() => {
63688
63681
  var _a;
63689
- 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, {
63690
63683
  referencePosition: referencePosition,
63691
63684
  container: this.table.getElement(),
63692
63685
  table: this.table,
@@ -63835,16 +63828,15 @@
63835
63828
  step((generator = generator.apply(thisArg, _arguments || [])).next());
63836
63829
  });
63837
63830
  };
63838
- function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
63831
+ function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table) {
63839
63832
  if (workOnEditableCell && table.isHasEditorDefine(col, row) || !1 === workOnEditableCell) {
63840
- const recordShowIndex = table.getRecordShowIndexByCell(col, row),
63841
- recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
63833
+ const recordIndex = table.getRecordShowIndexByCell(col, row),
63842
63834
  {
63843
63835
  field: field
63844
63836
  } = table.internalProps.layoutMap.getBody(col, row),
63845
63837
  beforeChangeValue = table.getCellRawValue(col, row),
63846
63838
  oldValue = table.getCellOriginValue(col, row);
63847
- 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);
63848
63840
  const range = table.getCellRange(col, row),
63849
63841
  aggregators = table.internalProps.layoutMap.getAggregatorsByCell(col, row);
63850
63842
  if (aggregators) {
@@ -63867,24 +63859,16 @@
63867
63859
  table.scenegraph.updateRowHeight(row, newHeight - oldHeight);
63868
63860
  }
63869
63861
  const changedValue = table.getCellOriginValue(col, row);
63870
- if (oldValue !== changedValue && triggerEvent) {
63871
- const changeValue = {
63872
- col: col,
63873
- row: row,
63874
- recordIndex: recordIndex,
63875
- field: field,
63876
- rawValue: beforeChangeValue,
63877
- currentValue: oldValue,
63878
- changedValue: changedValue
63879
- };
63880
- table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), silentChangeCellValuesEvent || table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
63881
- values: [changeValue]
63882
- });
63883
- }
63884
- 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();
63885
63869
  }
63886
63870
  }
63887
- function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
63871
+ function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table) {
63888
63872
  var _a, _b;
63889
63873
  return __awaiter(this, void 0, void 0, function* () {
63890
63874
  const changedCellResults = [];
@@ -63906,7 +63890,6 @@
63906
63890
  oldRowValues.push(oldValue);
63907
63891
  }
63908
63892
  }
63909
- const resultChangeValues = [];
63910
63893
  for (let i = 0; i < values.length && !(startRow + i > table.rowCount - 1); i++) {
63911
63894
  changedCellResults[i] = [], pasteRowEnd = startRow + i;
63912
63895
  const rowValues = values[i];
@@ -63930,34 +63913,25 @@
63930
63913
  if (isCanChange) {
63931
63914
  changedCellResults[i][j] = !0;
63932
63915
  const value = rowValues[j],
63933
- recordShowIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i),
63934
- recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
63916
+ recordIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i),
63935
63917
  {
63936
63918
  field: field
63937
63919
  } = table.internalProps.layoutMap.getBody(startCol + j, startRow + i),
63938
63920
  beforeChangeValue = beforeChangeValues[i][j],
63939
63921
  oldValue = oldValues[i][j];
63940
- 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);
63941
63923
  const changedValue = table.getCellOriginValue(startCol + j, startRow + i);
63942
- if (oldValue !== changedValue && triggerEvent) {
63943
- const changeValue = {
63944
- col: startCol + j,
63945
- row: startRow + i,
63946
- recordIndex: recordIndex,
63947
- field: field,
63948
- rawValue: beforeChangeValue,
63949
- currentValue: oldValue,
63950
- changedValue: changedValue
63951
- };
63952
- table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), resultChangeValues.push(changeValue);
63953
- }
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
+ });
63954
63931
  } else changedCellResults[i][j] = !1;
63955
63932
  }
63956
63933
  pasteColEnd = Math.max(pasteColEnd, thisRowPasteColEnd);
63957
63934
  }
63958
- silentChangeCellValuesEvent || table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
63959
- values: resultChangeValues
63960
- });
63961
63935
  const startRange = table.getCellRange(startCol, startRow),
63962
63936
  range = table.getCellRange(pasteColEnd, pasteRowEnd),
63963
63937
  aggregators = table.internalProps.layoutMap.getAggregatorsByCellRange(startRange.start.col, startRange.start.row, range.end.col, range.end.row);
@@ -63991,36 +63965,6 @@
63991
63965
  return table.scenegraph.updateNextFrame(), changedCellResults;
63992
63966
  });
63993
63967
  }
63994
- function listTableChangeCellValuesByIds(changeValues, triggerEvent, table, silentChangeCellValuesEvent) {
63995
- return __awaiter(this, void 0, void 0, function* () {
63996
- const resultChangeValues = [];
63997
- for (let i = 0; i < changeValues.length; i++) {
63998
- const {
63999
- col: col,
64000
- 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
- });
64018
- }
64019
- silentChangeCellValuesEvent || table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
64020
- values: resultChangeValues
64021
- });
64022
- });
64023
- }
64024
63968
  function getCellUpdateType(col, row, table, oldCellUpdateType) {
64025
63969
  if ("group" === oldCellUpdateType) return oldCellUpdateType;
64026
63970
  if ("sort" === oldCellUpdateType && !table.internalProps.groupBy) return oldCellUpdateType;
@@ -65184,37 +65128,11 @@
65184
65128
  }
65185
65129
  return isValid$2(editorDefine);
65186
65130
  }
65187
- changeCellValue(col, row, value, workOnEditableCell = !1, triggerEvent = !0, silentChangeCellValuesEvent) {
65188
- return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
65189
- }
65190
- changeCellValues(startCol, startRow, values, workOnEditableCell = !1, triggerEvent = !0, silentChangeCellValuesEvent) {
65191
- return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
65192
- }
65193
- changeCellValuesByIds(changeValues, triggerEvent = !0, silentChangeCellValuesEvent) {
65194
- return listTableChangeCellValuesByIds(changeValues, triggerEvent, this, silentChangeCellValuesEvent);
65195
- }
65196
- changeSourceCellValue(recordIndex, field, value) {
65197
- const tableIndex = this.getTableIndexByRecordIndex(recordIndex),
65198
- cellAddr = this.getCellAddrByFieldRecord(field, recordIndex);
65199
- if (tableIndex < 0 || cellAddr.col < 0 || cellAddr.row < 0) return;
65200
- this.dataSource.changeFieldValue(value, tableIndex, field, cellAddr.col, cellAddr.row, this);
65201
- const beforeChangeValue = this.getCellRawValue(cellAddr.col, cellAddr.row),
65202
- oldValue = this.getCellOriginValue(cellAddr.col, cellAddr.row),
65203
- changedValue = this.getCellOriginValue(cellAddr.col, cellAddr.row);
65204
- if (oldValue !== changedValue) {
65205
- const changeValue = {
65206
- col: cellAddr.col,
65207
- row: cellAddr.row,
65208
- recordIndex: recordIndex,
65209
- field: field,
65210
- rawValue: beforeChangeValue,
65211
- currentValue: oldValue,
65212
- changedValue: changedValue
65213
- };
65214
- this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
65215
- values: [changeValue]
65216
- });
65217
- }
65131
+ changeCellValue(col, row, value, workOnEditableCell = !1, triggerEvent = !0) {
65132
+ return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this);
65133
+ }
65134
+ changeCellValues(startCol, startRow, values, workOnEditableCell = !1, triggerEvent = !0) {
65135
+ return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this);
65218
65136
  }
65219
65137
  addRecord(record, recordIndex) {
65220
65138
  var _a;
@@ -65236,16 +65154,11 @@
65236
65154
  }
65237
65155
  deleteRecords(recordIndexs) {
65238
65156
  var _a;
65239
- const deletedRecords = [];
65240
- (null == recordIndexs ? void 0 : recordIndexs.length) > 0 && recordIndexs.forEach(index => {
65241
- let record = null;
65242
- record = "number" == typeof index ? this.dataSource.get(index) : [], deletedRecords.push(record);
65243
- }), 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();
65244
65158
  const rowIndexs = [];
65245
65159
  for (let i = 0; i < recordIndexs.length; i++) rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
65246
65160
  this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
65247
65161
  recordIndexs: recordIndexs,
65248
- records: deletedRecords,
65249
65162
  rowIndexs: rowIndexs,
65250
65163
  deletedCount: (Array.isArray(recordIndexs[0]), recordIndexs.length)
65251
65164
  });
@@ -91089,7 +91002,7 @@
91089
91002
  importStyle();
91090
91003
  }
91091
91004
 
91092
- const version = "1.22.11-alpha.1";
91005
+ const version = "1.22.11-alpha.3";
91093
91006
  importStyles();
91094
91007
 
91095
91008
  exports.TYPES = index;