@visactor/vtable-sheet 1.22.9-alpha.0 → 1.22.9-alpha.15

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.9-alpha.0";
5
+ export declare const version = "1.22.9-alpha.15";
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.9-alpha.0", (0, style_manager_1.importStyles)();
50
+ exports.version = "1.22.9-alpha.15", (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,gBAAgB,CAAC;AAExC,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.9-alpha.0\";\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.9-alpha.15\";\n// 导入样式\nimportStyles();\n/**\n * @namespace VTableSheet\n */\nexport { VTableSheet, TYPES, VTable, ISheetDefine, IVTableSheetOptions };\n"]}
@@ -38815,6 +38815,7 @@
38815
38815
  AFTER_UPDATE_CELL_CONTENT_WIDTH: "after_update_cell_content_width",
38816
38816
  AFTER_UPDATE_SELECT_BORDER_HEIGHT: "after_update_select_border_height",
38817
38817
  CHANGE_CELL_VALUE: "change_cell_value",
38818
+ CHANGE_CELL_VALUES: "change_cell_values",
38818
38819
  DRAG_FILL_HANDLE_END: "drag_fill_handle_end",
38819
38820
  MOUSEDOWN_FILL_HANDLE: "mousedown_fill_handle",
38820
38821
  DBLCLICK_FILL_HANDLE: "dblclick_fill_handle",
@@ -48022,10 +48023,10 @@
48022
48023
  function getAxisConfigInPivotChart(col, row, layout) {
48023
48024
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
48024
48025
  if (layout._table.isPivotChart()) if (layout.indicatorsAsCol) {
48025
- if (layout.hasTopIndicatorAxis && row === layout.columnHeaderLevelCount - 1 && col >= layout.rowHeaderLevelCount && col < layout.colCount - layout.rightFrozenColCount) {
48026
+ if (layout.hasTwoIndicatorAxes && row === layout.columnHeaderLevelCount - 1 && col >= layout.rowHeaderLevelCount && col < layout.colCount - layout.rightFrozenColCount) {
48026
48027
  const indicatorKey = layout.getIndicatorKey(col, row),
48027
48028
  indicatorInfo = layout.getIndicatorInfo(indicatorKey);
48028
- if (!(null == indicatorInfo ? void 0 : indicatorInfo.hasTopIndicatorAxis)) return;
48029
+ if (!(null == indicatorInfo ? void 0 : indicatorInfo.hasTwoIndicatorAxes)) return;
48029
48030
  const axisRange = getRange("top", col, row + 1, col, layout.columnHeaderLevelCount - 1, col, row, 1, layout);
48030
48031
  if (!axisRange) return;
48031
48032
  const chartCellStyle = layout._table._getCellStyle(col, row + 1),
@@ -48196,7 +48197,7 @@
48196
48197
  if (col === layout.colCount - layout.rightFrozenColCount && row >= layout.columnHeaderLevelCount && row < layout.rowCount - layout.bottomFrozenRowCount) {
48197
48198
  const indicatorKey = layout.getIndicatorKey(col, row),
48198
48199
  indicatorInfo = layout.getIndicatorInfo(indicatorKey);
48199
- if (!(null == indicatorInfo ? void 0 : indicatorInfo.hasRightIndicatorAxis)) return;
48200
+ if (!(null == indicatorInfo ? void 0 : indicatorInfo.hasTwoIndicatorAxes)) return;
48200
48201
  const {
48201
48202
  axisOption: axisOption,
48202
48203
  chartType: chartType
@@ -48366,7 +48367,7 @@
48366
48367
  function isTopOrBottomAxis(col, row, layout) {
48367
48368
  if (!layout._table.isPivotChart()) return !1;
48368
48369
  if (layout.indicatorsAsCol) {
48369
- if (layout.hasTopIndicatorAxis && row === layout.columnHeaderLevelCount - 1 && col >= layout.rowHeaderLevelCount && col < layout.colCount - layout.rightFrozenColCount) return !0;
48370
+ if (layout.hasTwoIndicatorAxes && row === layout.columnHeaderLevelCount - 1 && col >= layout.rowHeaderLevelCount && col < layout.colCount - layout.rightFrozenColCount) return !0;
48370
48371
  if (row === layout.rowCount - layout.bottomFrozenRowCount && col >= layout.rowHeaderLevelCount && col < layout.colCount - layout.rightFrozenColCount) return !0;
48371
48372
  } else if (row === layout.rowCount - layout.bottomFrozenRowCount && col >= layout.rowHeaderLevelCount && col < layout.colCount - layout.rightFrozenColCount) return !0;
48372
48373
  return !1;
@@ -48393,7 +48394,7 @@
48393
48394
  Direction.vertical = "vertical", Direction.horizontal = "horizontal";
48394
48395
  }(Direction$1 || (Direction$1 = {}));
48395
48396
  function getRange(position, colForAxisOption, rowForAxisOption, colForIndicatorKey, rowForIndicatorKey, col, row, defaultSeriesIndice, layout) {
48396
- const indicatorKeys = layout.getIndicatorKeyInChartSpec(colForIndicatorKey >= 0 ? colForIndicatorKey : col, rowForIndicatorKey >= 0 ? rowForIndicatorKey : row);
48397
+ const indicatorKeys = layout.getIndicatorKeyInChartSpec(colForIndicatorKey, rowForIndicatorKey);
48397
48398
  let path;
48398
48399
  path = "top" === position || "bottom" === position ? layout.getColKeysPath(col, row) : layout.getRowKeysPath(col, row);
48399
48400
  const rangeConfig = getChartAxisRange(colForAxisOption, rowForAxisOption, defaultSeriesIndice, position, indicatorKeys, path, layout);
@@ -49792,7 +49793,7 @@
49792
49793
  maxWidth = Math.max(axisWidth, maxWidth);
49793
49794
  continue;
49794
49795
  }
49795
- } else if (layout.isLeftBottomCorner(col, row) || layout.isRightTopCorner(col, row) || layout.isRightBottomCorner(col, row) || layout.isAxisCell(col, row)) continue;
49796
+ } else if (layout.isLeftBottomCorner(col, row) || layout.isRightTopCorner(col, row) || layout.isRightBottomCorner(col, row)) continue;
49796
49797
  }
49797
49798
  const customWidth = computeCustomRenderWidth(col, row, table);
49798
49799
  if (customWidth && (maxWidth = Math.max(customWidth.width, maxWidth), !customWidth.renderDefault)) continue;
@@ -57094,7 +57095,7 @@
57094
57095
  }
57095
57096
  function getAxisPosition(col, row, layout) {
57096
57097
  if (layout.indicatorsAsCol) {
57097
- if (layout.hasTopIndicatorAxis && row === layout.columnHeaderLevelCount - 1 && col >= layout.rowHeaderLevelCount && col < layout.colCount - layout.rightFrozenColCount) return "top";
57098
+ if (layout.hasTwoIndicatorAxes && row === layout.columnHeaderLevelCount - 1 && col >= layout.rowHeaderLevelCount && col < layout.colCount - layout.rightFrozenColCount) return "top";
57098
57099
  if (row === layout.rowCount - layout.bottomFrozenRowCount && col >= layout.rowHeaderLevelCount && col < layout.colCount - layout.rightFrozenColCount) return "bottom";
57099
57100
  if (col === layout.rowHeaderLevelCount - 1 && row >= layout.rowHeaderLevelCount && row < layout.rowCount - layout.bottomFrozenRowCount) return "left";
57100
57101
  } else {
@@ -57750,7 +57751,13 @@
57750
57751
  try {
57751
57752
  const selectCells = this.cutCellRange;
57752
57753
  if (!selectCells || 0 === selectCells.length) return;
57753
- 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);
57754
+ const changeValues = [];
57755
+ for (let i = 0; i < selectCells.length; i++) for (let j = 0; j < selectCells[i].length; j++) selectCells[i][j] && changeValues.push({
57756
+ col: selectCells[i][j].col,
57757
+ row: selectCells[i][j].row,
57758
+ value: void 0
57759
+ });
57760
+ table.changeCellValuesByIds(changeValues);
57754
57761
  } catch (error) {}
57755
57762
  }
57756
57763
  checkClipboardChanged() {
@@ -59993,7 +60000,7 @@
59993
60000
  }
59994
60001
  constructor(container, options = {}) {
59995
60002
  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;
59996
- if (super(), this.showFrozenIcon = !0, this.version = "1.22.9-alpha.0", 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");
60003
+ if (super(), this.showFrozenIcon = !0, this.version = "1.22.9-alpha.15", 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");
59997
60004
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
59998
60005
  options: options,
59999
60006
  container: container
@@ -64562,13 +64569,19 @@
64562
64569
  table.scenegraph.updateRowHeight(row, newHeight - oldHeight);
64563
64570
  }
64564
64571
  const changedValue = table.getCellOriginValue(col, row);
64565
- oldValue !== changedValue && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
64566
- col: col,
64567
- row: row,
64568
- rawValue: beforeChangeValue,
64569
- currentValue: oldValue,
64570
- changedValue: changedValue
64571
- }), table.scenegraph.updateNextFrame();
64572
+ if (oldValue !== changedValue && triggerEvent) {
64573
+ const changeValue = {
64574
+ col: col,
64575
+ row: row,
64576
+ rawValue: beforeChangeValue,
64577
+ currentValue: oldValue,
64578
+ changedValue: changedValue
64579
+ };
64580
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
64581
+ values: [changeValue]
64582
+ });
64583
+ }
64584
+ table.scenegraph.updateNextFrame();
64572
64585
  }
64573
64586
  }
64574
64587
  function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table) {
@@ -64593,6 +64606,7 @@
64593
64606
  oldRowValues.push(oldValue);
64594
64607
  }
64595
64608
  }
64609
+ const resultChangeValues = [];
64596
64610
  for (let i = 0; i < values.length && !(startRow + i > table.rowCount - 1); i++) {
64597
64611
  changedCellResults[i] = [], pasteRowEnd = startRow + i;
64598
64612
  const rowValues = values[i];
@@ -64624,17 +64638,23 @@
64624
64638
  oldValue = oldValues[i][j];
64625
64639
  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);
64626
64640
  const changedValue = table.getCellOriginValue(startCol + j, startRow + i);
64627
- oldValue !== changedValue && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
64628
- col: startCol + j,
64629
- row: startRow + i,
64630
- rawValue: beforeChangeValue,
64631
- currentValue: oldValue,
64632
- changedValue: changedValue
64633
- });
64641
+ if (oldValue !== changedValue && triggerEvent) {
64642
+ const changeValue = {
64643
+ col: startCol + j,
64644
+ row: startRow + i,
64645
+ rawValue: beforeChangeValue,
64646
+ currentValue: oldValue,
64647
+ changedValue: changedValue
64648
+ };
64649
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), resultChangeValues.push(changeValue);
64650
+ }
64634
64651
  } else changedCellResults[i][j] = !1;
64635
64652
  }
64636
64653
  pasteColEnd = Math.max(pasteColEnd, thisRowPasteColEnd);
64637
64654
  }
64655
+ triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
64656
+ values: resultChangeValues
64657
+ });
64638
64658
  const startRange = table.getCellRange(startCol, startRow),
64639
64659
  range = table.getCellRange(pasteColEnd, pasteRowEnd),
64640
64660
  aggregators = table.internalProps.layoutMap.getAggregatorsByCellRange(startRange.start.col, startRange.start.row, range.end.col, range.end.row);
@@ -64668,6 +64688,29 @@
64668
64688
  return table.scenegraph.updateNextFrame(), changedCellResults;
64669
64689
  });
64670
64690
  }
64691
+ function listTableChangeCellValuesByIds(changeValues, triggerEvent, table) {
64692
+ return __awaiter(this, void 0, void 0, function* () {
64693
+ const resultChangeValues = [];
64694
+ for (let i = 0; i < changeValues.length; i++) {
64695
+ const {
64696
+ col: col,
64697
+ row: row,
64698
+ value: value
64699
+ } = changeValues[i],
64700
+ oldValue = table.getCellOriginValue(col, row);
64701
+ listTableChangeCellValue(col, row, value, !1, triggerEvent, table), oldValue !== value && triggerEvent && resultChangeValues.push({
64702
+ col: col,
64703
+ row: row,
64704
+ rawValue: oldValue,
64705
+ currentValue: oldValue,
64706
+ changedValue: value
64707
+ });
64708
+ }
64709
+ triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
64710
+ values: resultChangeValues
64711
+ });
64712
+ });
64713
+ }
64671
64714
  function getCellUpdateType(col, row, table, oldCellUpdateType) {
64672
64715
  if ("group" === oldCellUpdateType) return oldCellUpdateType;
64673
64716
  if ("sort" === oldCellUpdateType && !table.internalProps.groupBy) return oldCellUpdateType;
@@ -65831,6 +65874,9 @@
65831
65874
  changeCellValues(startCol, startRow, values, workOnEditableCell = !1, triggerEvent = !0) {
65832
65875
  return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this);
65833
65876
  }
65877
+ changeCellValuesByIds(changeValues, triggerEvent = !0) {
65878
+ return listTableChangeCellValuesByIds(changeValues, triggerEvent, this);
65879
+ }
65834
65880
  addRecord(record, recordIndex) {
65835
65881
  var _a;
65836
65882
  const success = listTableAddRecord(record, recordIndex, this);
@@ -65851,11 +65897,18 @@
65851
65897
  }
65852
65898
  deleteRecords(recordIndexs) {
65853
65899
  var _a;
65854
- listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
65900
+ const deletedRecords = [];
65901
+ (null == recordIndexs ? void 0 : recordIndexs.length) > 0 && recordIndexs.forEach(index => {
65902
+ let record = null;
65903
+ "number" == typeof index ? record = this.dataSource.get(index) : (record = [], index.forEach(item => {
65904
+ record.push(this.dataSource.get(item));
65905
+ })), deletedRecords.push(record);
65906
+ }), listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
65855
65907
  const rowIndexs = [];
65856
65908
  for (let i = 0; i < recordIndexs.length; i++) rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
65857
65909
  this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
65858
65910
  recordIndexs: recordIndexs,
65911
+ records: deletedRecords,
65859
65912
  rowIndexs: rowIndexs,
65860
65913
  deletedCount: (Array.isArray(recordIndexs[0]), recordIndexs.length)
65861
65914
  });
@@ -92598,7 +92651,7 @@
92598
92651
  importStyle();
92599
92652
  }
92600
92653
 
92601
- const version = "1.22.9-alpha.0";
92654
+ const version = "1.22.9-alpha.15";
92602
92655
  importStyles();
92603
92656
 
92604
92657
  exports.TYPES = index;