@visactor/vtable-calendar 1.22.9-alpha.1 → 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.
@@ -34919,6 +34919,7 @@
34919
34919
  AFTER_UPDATE_CELL_CONTENT_WIDTH: "after_update_cell_content_width",
34920
34920
  AFTER_UPDATE_SELECT_BORDER_HEIGHT: "after_update_select_border_height",
34921
34921
  CHANGE_CELL_VALUE: "change_cell_value",
34922
+ CHANGE_CELL_VALUES: "change_cell_values",
34922
34923
  DRAG_FILL_HANDLE_END: "drag_fill_handle_end",
34923
34924
  MOUSEDOWN_FILL_HANDLE: "mousedown_fill_handle",
34924
34925
  DBLCLICK_FILL_HANDLE: "dblclick_fill_handle",
@@ -44112,10 +44113,10 @@
44112
44113
  function getAxisConfigInPivotChart(col, row, layout) {
44113
44114
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
44114
44115
  if (layout._table.isPivotChart()) if (layout.indicatorsAsCol) {
44115
- if (layout.hasTopIndicatorAxis && row === layout.columnHeaderLevelCount - 1 && col >= layout.rowHeaderLevelCount && col < layout.colCount - layout.rightFrozenColCount) {
44116
+ if (layout.hasTwoIndicatorAxes && row === layout.columnHeaderLevelCount - 1 && col >= layout.rowHeaderLevelCount && col < layout.colCount - layout.rightFrozenColCount) {
44116
44117
  const indicatorKey = layout.getIndicatorKey(col, row),
44117
44118
  indicatorInfo = layout.getIndicatorInfo(indicatorKey);
44118
- if (!(null == indicatorInfo ? void 0 : indicatorInfo.hasTopIndicatorAxis)) return;
44119
+ if (!(null == indicatorInfo ? void 0 : indicatorInfo.hasTwoIndicatorAxes)) return;
44119
44120
  const axisRange = getRange("top", col, row + 1, col, layout.columnHeaderLevelCount - 1, col, row, 1, layout);
44120
44121
  if (!axisRange) return;
44121
44122
  const chartCellStyle = layout._table._getCellStyle(col, row + 1),
@@ -44286,7 +44287,7 @@
44286
44287
  if (col === layout.colCount - layout.rightFrozenColCount && row >= layout.columnHeaderLevelCount && row < layout.rowCount - layout.bottomFrozenRowCount) {
44287
44288
  const indicatorKey = layout.getIndicatorKey(col, row),
44288
44289
  indicatorInfo = layout.getIndicatorInfo(indicatorKey);
44289
- if (!(null == indicatorInfo ? void 0 : indicatorInfo.hasRightIndicatorAxis)) return;
44290
+ if (!(null == indicatorInfo ? void 0 : indicatorInfo.hasTwoIndicatorAxes)) return;
44290
44291
  const {
44291
44292
  axisOption: axisOption,
44292
44293
  chartType: chartType
@@ -44456,7 +44457,7 @@
44456
44457
  function isTopOrBottomAxis(col, row, layout) {
44457
44458
  if (!layout._table.isPivotChart()) return !1;
44458
44459
  if (layout.indicatorsAsCol) {
44459
- if (layout.hasTopIndicatorAxis && row === layout.columnHeaderLevelCount - 1 && col >= layout.rowHeaderLevelCount && col < layout.colCount - layout.rightFrozenColCount) return !0;
44460
+ if (layout.hasTwoIndicatorAxes && row === layout.columnHeaderLevelCount - 1 && col >= layout.rowHeaderLevelCount && col < layout.colCount - layout.rightFrozenColCount) return !0;
44460
44461
  if (row === layout.rowCount - layout.bottomFrozenRowCount && col >= layout.rowHeaderLevelCount && col < layout.colCount - layout.rightFrozenColCount) return !0;
44461
44462
  } else if (row === layout.rowCount - layout.bottomFrozenRowCount && col >= layout.rowHeaderLevelCount && col < layout.colCount - layout.rightFrozenColCount) return !0;
44462
44463
  return !1;
@@ -44483,7 +44484,7 @@
44483
44484
  Direction.vertical = "vertical", Direction.horizontal = "horizontal";
44484
44485
  }(Direction || (Direction = {}));
44485
44486
  function getRange(position, colForAxisOption, rowForAxisOption, colForIndicatorKey, rowForIndicatorKey, col, row, defaultSeriesIndice, layout) {
44486
- const indicatorKeys = layout.getIndicatorKeyInChartSpec(colForIndicatorKey >= 0 ? colForIndicatorKey : col, rowForIndicatorKey >= 0 ? rowForIndicatorKey : row);
44487
+ const indicatorKeys = layout.getIndicatorKeyInChartSpec(colForIndicatorKey, rowForIndicatorKey);
44487
44488
  let path;
44488
44489
  path = "top" === position || "bottom" === position ? layout.getColKeysPath(col, row) : layout.getRowKeysPath(col, row);
44489
44490
  const rangeConfig = getChartAxisRange(colForAxisOption, rowForAxisOption, defaultSeriesIndice, position, indicatorKeys, path, layout);
@@ -44675,7 +44676,7 @@
44675
44676
  prev_justShowMarkTooltip = this.justShowMarkTooltip;
44676
44677
  params.mark && params.datum && !Array.isArray(params.datum) ? (this.activeChartInstanceHoverOnMark = params.mark, justShowMarkTooltip = !0) : (this.activeChartInstanceHoverOnMark = null, justShowMarkTooltip = !1), this.justShowMarkTooltip = justShowMarkTooltip;
44677
44678
  let delayRunDimensionHover = !1;
44678
- if (!1 !== prev_justShowMarkTooltip && !1 === justShowMarkTooltip ? (this.justShowMarkTooltipTimer = Date.now(), delayRunDimensionHover = !0) : !1 === prev_justShowMarkTooltip && !1 === justShowMarkTooltip ? delayRunDimensionHover = Date.now() - this.justShowMarkTooltipTimer < 100 : (!1 === prev_justShowMarkTooltip && !0 === justShowMarkTooltip || !0 === prev_justShowMarkTooltip && !0 === justShowMarkTooltip) && (delayRunDimensionHover = !1, clearTimeout(this.delayRunDimensionHoverTimer), this.delayRunDimensionHoverTimer = void 0), "enter" === params.action || "move" === params.action || preMark !== this.activeChartInstanceHoverOnMark) {
44679
+ if (!0 === prev_justShowMarkTooltip && !1 === justShowMarkTooltip ? (this.justShowMarkTooltipTimer = Date.now(), delayRunDimensionHover = !0) : !1 === prev_justShowMarkTooltip && !1 === justShowMarkTooltip ? delayRunDimensionHover = Date.now() - this.justShowMarkTooltipTimer < 100 : (!1 === prev_justShowMarkTooltip && !0 === justShowMarkTooltip || !0 === prev_justShowMarkTooltip && !0 === justShowMarkTooltip) && (delayRunDimensionHover = !1, clearTimeout(this.delayRunDimensionHoverTimer), this.delayRunDimensionHoverTimer = void 0), "enter" === params.action || "move" === params.action || preMark !== this.activeChartInstanceHoverOnMark) {
44679
44680
  const dimensionValue = dimensionInfo.value,
44680
44681
  indicatorsAsCol = table.options.indicatorsAsCol;
44681
44682
  if (delayRunDimensionHover ? (clearTimeout(this.delayRunDimensionHoverTimer), this.delayRunDimensionHoverTimer = setTimeout(() => {
@@ -45882,7 +45883,7 @@
45882
45883
  maxWidth = Math.max(axisWidth, maxWidth);
45883
45884
  continue;
45884
45885
  }
45885
- } else if (layout.isLeftBottomCorner(col, row) || layout.isRightTopCorner(col, row) || layout.isRightBottomCorner(col, row) || layout.isAxisCell(col, row)) continue;
45886
+ } else if (layout.isLeftBottomCorner(col, row) || layout.isRightTopCorner(col, row) || layout.isRightBottomCorner(col, row)) continue;
45886
45887
  }
45887
45888
  const customWidth = computeCustomRenderWidth(col, row, table);
45888
45889
  if (customWidth && (maxWidth = Math.max(customWidth.width, maxWidth), !customWidth.renderDefault)) continue;
@@ -53184,7 +53185,7 @@
53184
53185
  }
53185
53186
  function getAxisPosition(col, row, layout) {
53186
53187
  if (layout.indicatorsAsCol) {
53187
- if (layout.hasTopIndicatorAxis && row === layout.columnHeaderLevelCount - 1 && col >= layout.rowHeaderLevelCount && col < layout.colCount - layout.rightFrozenColCount) return "top";
53188
+ if (layout.hasTwoIndicatorAxes && row === layout.columnHeaderLevelCount - 1 && col >= layout.rowHeaderLevelCount && col < layout.colCount - layout.rightFrozenColCount) return "top";
53188
53189
  if (row === layout.rowCount - layout.bottomFrozenRowCount && col >= layout.rowHeaderLevelCount && col < layout.colCount - layout.rightFrozenColCount) return "bottom";
53189
53190
  if (col === layout.rowHeaderLevelCount - 1 && row >= layout.rowHeaderLevelCount && row < layout.rowCount - layout.bottomFrozenRowCount) return "left";
53190
53191
  } else {
@@ -53840,7 +53841,13 @@
53840
53841
  try {
53841
53842
  const selectCells = this.cutCellRange;
53842
53843
  if (!selectCells || 0 === selectCells.length) return;
53843
- 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);
53844
+ const changeValues = [];
53845
+ for (let i = 0; i < selectCells.length; i++) for (let j = 0; j < selectCells[i].length; j++) selectCells[i][j] && changeValues.push({
53846
+ col: selectCells[i][j].col,
53847
+ row: selectCells[i][j].row,
53848
+ value: void 0
53849
+ });
53850
+ table.changeCellValuesByIds(changeValues);
53844
53851
  } catch (error) {}
53845
53852
  }
53846
53853
  checkClipboardChanged() {
@@ -56083,7 +56090,7 @@
56083
56090
  }
56084
56091
  constructor(container, options = {}) {
56085
56092
  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;
56086
- if (super(), this.showFrozenIcon = !0, this.version = "1.22.9-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");
56093
+ 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.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");
56087
56094
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
56088
56095
  options: options,
56089
56096
  container: container
@@ -60616,13 +60623,19 @@
60616
60623
  table.scenegraph.updateRowHeight(row, newHeight - oldHeight);
60617
60624
  }
60618
60625
  const changedValue = table.getCellOriginValue(col, row);
60619
- oldValue !== changedValue && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
60620
- col: col,
60621
- row: row,
60622
- rawValue: beforeChangeValue,
60623
- currentValue: oldValue,
60624
- changedValue: changedValue
60625
- }), table.scenegraph.updateNextFrame();
60626
+ if (oldValue !== changedValue && triggerEvent) {
60627
+ const changeValue = {
60628
+ col: col,
60629
+ row: row,
60630
+ rawValue: beforeChangeValue,
60631
+ currentValue: oldValue,
60632
+ changedValue: changedValue
60633
+ };
60634
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
60635
+ values: [changeValue]
60636
+ });
60637
+ }
60638
+ table.scenegraph.updateNextFrame();
60626
60639
  }
60627
60640
  }
60628
60641
  function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table) {
@@ -60647,6 +60660,7 @@
60647
60660
  oldRowValues.push(oldValue);
60648
60661
  }
60649
60662
  }
60663
+ const resultChangeValues = [];
60650
60664
  for (let i = 0; i < values.length && !(startRow + i > table.rowCount - 1); i++) {
60651
60665
  changedCellResults[i] = [], pasteRowEnd = startRow + i;
60652
60666
  const rowValues = values[i];
@@ -60678,17 +60692,23 @@
60678
60692
  oldValue = oldValues[i][j];
60679
60693
  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);
60680
60694
  const changedValue = table.getCellOriginValue(startCol + j, startRow + i);
60681
- oldValue !== changedValue && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
60682
- col: startCol + j,
60683
- row: startRow + i,
60684
- rawValue: beforeChangeValue,
60685
- currentValue: oldValue,
60686
- changedValue: changedValue
60687
- });
60695
+ if (oldValue !== changedValue && triggerEvent) {
60696
+ const changeValue = {
60697
+ col: startCol + j,
60698
+ row: startRow + i,
60699
+ rawValue: beforeChangeValue,
60700
+ currentValue: oldValue,
60701
+ changedValue: changedValue
60702
+ };
60703
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), resultChangeValues.push(changeValue);
60704
+ }
60688
60705
  } else changedCellResults[i][j] = !1;
60689
60706
  }
60690
60707
  pasteColEnd = Math.max(pasteColEnd, thisRowPasteColEnd);
60691
60708
  }
60709
+ triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
60710
+ values: resultChangeValues
60711
+ });
60692
60712
  const startRange = table.getCellRange(startCol, startRow),
60693
60713
  range = table.getCellRange(pasteColEnd, pasteRowEnd),
60694
60714
  aggregators = table.internalProps.layoutMap.getAggregatorsByCellRange(startRange.start.col, startRange.start.row, range.end.col, range.end.row);
@@ -60722,6 +60742,29 @@
60722
60742
  return table.scenegraph.updateNextFrame(), changedCellResults;
60723
60743
  });
60724
60744
  }
60745
+ function listTableChangeCellValuesByIds(changeValues, triggerEvent, table) {
60746
+ return __awaiter(this, void 0, void 0, function* () {
60747
+ const resultChangeValues = [];
60748
+ for (let i = 0; i < changeValues.length; i++) {
60749
+ const {
60750
+ col: col,
60751
+ row: row,
60752
+ value: value
60753
+ } = changeValues[i],
60754
+ oldValue = table.getCellOriginValue(col, row);
60755
+ listTableChangeCellValue(col, row, value, !1, triggerEvent, table), oldValue !== value && triggerEvent && resultChangeValues.push({
60756
+ col: col,
60757
+ row: row,
60758
+ rawValue: oldValue,
60759
+ currentValue: oldValue,
60760
+ changedValue: value
60761
+ });
60762
+ }
60763
+ triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
60764
+ values: resultChangeValues
60765
+ });
60766
+ });
60767
+ }
60725
60768
  function getCellUpdateType(col, row, table, oldCellUpdateType) {
60726
60769
  if ("group" === oldCellUpdateType) return oldCellUpdateType;
60727
60770
  if ("sort" === oldCellUpdateType && !table.internalProps.groupBy) return oldCellUpdateType;
@@ -61885,6 +61928,9 @@
61885
61928
  changeCellValues(startCol, startRow, values, workOnEditableCell = !1, triggerEvent = !0) {
61886
61929
  return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this);
61887
61930
  }
61931
+ changeCellValuesByIds(changeValues, triggerEvent = !0) {
61932
+ return listTableChangeCellValuesByIds(changeValues, triggerEvent, this);
61933
+ }
61888
61934
  addRecord(record, recordIndex) {
61889
61935
  var _a;
61890
61936
  const success = listTableAddRecord(record, recordIndex, this);
@@ -61905,11 +61951,18 @@
61905
61951
  }
61906
61952
  deleteRecords(recordIndexs) {
61907
61953
  var _a;
61908
- listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
61954
+ const deletedRecords = [];
61955
+ (null == recordIndexs ? void 0 : recordIndexs.length) > 0 && recordIndexs.forEach(index => {
61956
+ let record = null;
61957
+ "number" == typeof index ? record = this.dataSource.get(index) : (record = [], index.forEach(item => {
61958
+ record.push(this.dataSource.get(item));
61959
+ })), deletedRecords.push(record);
61960
+ }), listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
61909
61961
  const rowIndexs = [];
61910
61962
  for (let i = 0; i < recordIndexs.length; i++) rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
61911
61963
  this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
61912
61964
  recordIndexs: recordIndexs,
61965
+ records: deletedRecords,
61913
61966
  rowIndexs: rowIndexs,
61914
61967
  deletedCount: (Array.isArray(recordIndexs[0]), recordIndexs.length)
61915
61968
  });