@visactor/vtable-calendar 1.26.1 → 1.26.2-none

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.
@@ -50872,7 +50872,7 @@
50872
50872
  col: col,
50873
50873
  row: row
50874
50874
  };
50875
- enableShiftSelectMode || (currentRange.end = currentRange.start), scenegraph.deleteLastSelectedRangeComponents(), scenegraph.updateCellSelectBorder(currentRange);
50875
+ enableShiftSelectMode || (currentRange.end = currentRange.start), cellPos.col = col, cellPos.row = row, scenegraph.deleteLastSelectedRangeComponents(), scenegraph.updateCellSelectBorder(currentRange);
50876
50876
  } else {
50877
50877
  let extendSelectRange = !isValid$1(skipBodyMerge) || !skipBodyMerge;
50878
50878
  if (-1 === cellPos.col || -1 === cellPos.row || enableCtrlSelectMode || (state.select.ranges = [], scenegraph.deleteAllSelectBorder()), "cell" !== state.select.headerSelectMode && table.isColumnHeader(col, row)) {
@@ -54559,13 +54559,14 @@
54559
54559
  }
54560
54560
  cellIsHeaderCheck(eventArgsSet, update) {
54561
54561
  const {
54562
- eventArgs: eventArgs
54563
- } = eventArgsSet,
54564
- {
54565
- col: col,
54566
- row: row,
54567
- target: target
54568
- } = eventArgs;
54562
+ eventArgs: eventArgs
54563
+ } = eventArgsSet;
54564
+ if (!eventArgs) return !1;
54565
+ const {
54566
+ col: col,
54567
+ row: row,
54568
+ target: target
54569
+ } = eventArgs;
54569
54570
  if (!this.table.isHeader(col, row)) return !1;
54570
54571
  return "checkbox" === this.table.getCellType(eventArgs.col, eventArgs.row) && "checkbox" === target.name;
54571
54572
  }
@@ -57158,7 +57159,7 @@
57158
57159
  }
57159
57160
  constructor(container, options = {}) {
57160
57161
  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;
57161
- if (super(), this.showFrozenIcon = !0, this._scrollToRowCorrectTimer = null, this._tableBorderWidth_left = 0, this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0, this.version = "1.26.1", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "undefined" != typeof window) {
57162
+ if (super(), this.showFrozenIcon = !0, this._scrollToRowCorrectTimer = null, this._tableBorderWidth_left = 0, this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0, this.version = "1.26.2-none", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "undefined" != typeof window) {
57162
57163
  const g = window;
57163
57164
  g[this.id] = this;
57164
57165
  const registry = g.__vtable__ || (g.__vtable__ = {
@@ -58008,22 +58009,20 @@
58008
58009
  return count;
58009
58010
  }
58010
58011
  getBodyVisibleCellRange() {
58012
+ var _a, _b, _c, _d;
58011
58013
  const {
58012
58014
  scrollTop: scrollTop,
58013
58015
  scrollLeft: scrollLeft
58014
58016
  } = this,
58015
- frozenRowsHeight = this.getFrozenRowsHeight(),
58016
58017
  frozenColsContentWidth = this.getFrozenColsContentWidth(),
58017
58018
  frozenColsOffset = this.getFrozenColsOffset(),
58018
58019
  bottomFrozenRowsHeight = this.getBottomFrozenRowsHeight(),
58019
58020
  rightFrozenColsWidth = this.getRightFrozenColsWidth(),
58020
- {
58021
- row: rowStart
58022
- } = this.getRowAt(scrollTop + frozenRowsHeight + 1),
58021
+ rowStart = Math.max(null !== (_b = null === (_a = this.getTargetRowAt(scrollTop + 1)) || void 0 === _a ? void 0 : _a.row) && void 0 !== _b ? _b : -1, this.frozenRowCount),
58023
58022
  {
58024
58023
  col: colStart
58025
58024
  } = this.getColAt(scrollLeft + frozenColsContentWidth + 1),
58026
- rowEnd = this.getAllRowsHeight() > this.tableNoFrameHeight ? this.getRowAt(scrollTop + this.tableNoFrameHeight - 1 - bottomFrozenRowsHeight).row : this.rowCount - 1,
58025
+ rowEnd = this.getAllRowsHeight() > this.tableNoFrameHeight ? Math.max(null !== (_d = null === (_c = this.getTargetRowAt(scrollTop + this.tableNoFrameHeight - 1 - bottomFrozenRowsHeight)) || void 0 === _c ? void 0 : _c.row) && void 0 !== _d ? _d : -1, rowStart) : this.rowCount - 1,
58027
58026
  colEnd = this.getAllColsWidth() > this.tableNoFrameWidth ? this.getColAt(scrollLeft + frozenColsOffset + this.tableNoFrameWidth - 1 - rightFrozenColsWidth).col : this.colCount - 1;
58028
58027
  return colEnd < 0 || rowEnd < 0 ? null : {
58029
58028
  rowStart: rowStart,
@@ -58033,15 +58032,13 @@
58033
58032
  };
58034
58033
  }
58035
58034
  getBodyVisibleRowRange(start_deltaY = 0, end_deltaY = 0) {
58035
+ var _a, _b, _c, _d;
58036
58036
  const {
58037
58037
  scrollTop: scrollTop
58038
58038
  } = this,
58039
- frozenRowsHeight = this.getFrozenRowsHeight(),
58040
58039
  bottomFrozenRowsHeight = this.getBottomFrozenRowsHeight(),
58041
- {
58042
- row: rowStart
58043
- } = this.getRowAt(scrollTop + frozenRowsHeight + 1 + start_deltaY),
58044
- rowEnd = this.getAllRowsHeight() > this.tableNoFrameHeight ? this.getRowAt(scrollTop + this.tableNoFrameHeight - 1 - bottomFrozenRowsHeight + end_deltaY).row : this.rowCount - 1;
58040
+ rowStart = Math.max(null !== (_b = null === (_a = this.getTargetRowAt(scrollTop + 1 + start_deltaY)) || void 0 === _a ? void 0 : _a.row) && void 0 !== _b ? _b : -1, this.frozenRowCount),
58041
+ rowEnd = this.getAllRowsHeight() > this.tableNoFrameHeight ? Math.max(null !== (_d = null === (_c = this.getTargetRowAt(scrollTop + this.tableNoFrameHeight - 1 - bottomFrozenRowsHeight + end_deltaY)) || void 0 === _c ? void 0 : _c.row) && void 0 !== _d ? _d : -1, rowStart) : this.rowCount - 1;
58045
58042
  return rowEnd < 0 ? null : {
58046
58043
  rowStart: rowStart,
58047
58044
  rowEnd: rowEnd
@@ -60722,7 +60719,7 @@
60722
60719
  return !1;
60723
60720
  }
60724
60721
  moveHeaderPosition(source, target) {
60725
- var _a, _b, _c, _d, _e, _f, _g;
60722
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
60726
60723
  if ((!(null === (_a = this._table.options.dragOrder) || void 0 === _a ? void 0 : _a.validateDragOrderOnEnd) || (null === (_b = this._table.options.dragOrder) || void 0 === _b ? void 0 : _b.validateDragOrderOnEnd(source, target))) && this.canMoveHeaderPosition(source, target)) {
60727
60724
  let sourceCellRange = this.getCellRange(source.col, source.row);
60728
60725
  if (this.isColumnHeader(source.col, source.row) || "column" === this._table.stateManager.columnMove.movingColumnOrRow && 0 === source.row) {
@@ -60742,9 +60739,13 @@
60742
60739
  sourceData.unshift(targetIndex - this.leftRowSeriesNumberColumnCount, 0), Array.prototype.splice.apply(rowRecords, sourceData);
60743
60740
  }
60744
60741
  }
60745
- const sourceColumns = this._columns.splice(sourceCellRange.start.col - this.leftRowSeriesNumberColumnCount, sourceSize);
60746
- if (sourceColumns.unshift(targetIndex - this.leftRowSeriesNumberColumnCount, 0), Array.prototype.splice.apply(this._columns, sourceColumns), null === (_f = this._table.options.dragOrder) || void 0 === _f ? void 0 : _f.maintainArrayDataOrder) for (let i = 0; i < this._columns.length; i++) this._columns[i].field = i;
60747
- if (this.columnTree.movePosition(sourceCellRange.start.row, sourceCellRange.start.col - this.leftRowSeriesNumberColumnCount, targetIndex - this.leftRowSeriesNumberColumnCount), null === (_g = this._table.options.dragOrder) || void 0 === _g ? void 0 : _g.maintainArrayDataOrder) for (let i = 0; i < this.columnTree.tree.children.length; i++) this.columnTree.tree.children[i].field = i;
60742
+ const sourceColIndex = sourceCellRange.start.col - this.leftRowSeriesNumberColumnCount,
60743
+ targetColIndex = target.col >= source.col ? targetCellRange.end.col - this.leftRowSeriesNumberColumnCount : targetCellRange.start.col - this.leftRowSeriesNumberColumnCount,
60744
+ sourceTotalIndex = null !== (_h = null === (_g = null === (_f = this._columns[sourceColIndex]) || void 0 === _f ? void 0 : _f.define) || void 0 === _g ? void 0 : _g.startInTotal) && void 0 !== _h ? _h : sourceColIndex,
60745
+ targetTotalIndex = null !== (_l = null === (_k = null === (_j = this._columns[targetColIndex]) || void 0 === _j ? void 0 : _j.define) || void 0 === _k ? void 0 : _k.startInTotal) && void 0 !== _l ? _l : targetColIndex,
60746
+ sourceColumns = this._columns.splice(sourceColIndex, sourceSize);
60747
+ if (sourceColumns.unshift(targetIndex - this.leftRowSeriesNumberColumnCount, 0), Array.prototype.splice.apply(this._columns, sourceColumns), null === (_m = this._table.options.dragOrder) || void 0 === _m ? void 0 : _m.maintainArrayDataOrder) for (let i = 0; i < this._columns.length; i++) this._columns[i].field = i;
60748
+ if (this.columnTree.movePosition(sourceCellRange.start.row, sourceTotalIndex, targetTotalIndex), null === (_o = this._table.options.dragOrder) || void 0 === _o ? void 0 : _o.maintainArrayDataOrder) for (let i = 0; i < this.columnTree.tree.children.length; i++) this.columnTree.tree.children[i].field = i;
60748
60749
  return this.columnTree.reset(this.columnTree.tree.children), this._cellRangeMap = new Map(), {
60749
60750
  sourceIndex: sourceCellRange.start.col,
60750
60751
  targetIndex: targetIndex,
@@ -60763,8 +60764,12 @@
60763
60764
  const sourceIds = this._headerCellIds[row].splice(sourceCellRange.start.row, sourceSize);
60764
60765
  sourceIds.unshift(targetIndex, 0), Array.prototype.splice.apply(this._headerCellIds[row], sourceIds);
60765
60766
  }
60766
- const sourceColumns = this._columns.splice(sourceCellRange.start.row, sourceSize);
60767
- return sourceColumns.unshift(targetIndex, 0), Array.prototype.splice.apply(this._columns, sourceColumns), this.columnTree.movePosition(sourceCellRange.start.col - this.leftRowSeriesNumberColumnCount, sourceCellRange.start.row, targetIndex + (target.row > source.row ? sourceCellRange.end.row - sourceCellRange.start.row : 0)), this.columnTree.reset(this.columnTree.tree.children), this._cellRangeMap = new Map(), {
60767
+ const sourceRowIndex = sourceCellRange.start.row,
60768
+ targetRowIndex = target.row >= source.row ? targetCellRange.end.row : targetCellRange.start.row,
60769
+ sourceTotalIndex = null !== (_r = null === (_q = null === (_p = this._columns[sourceRowIndex]) || void 0 === _p ? void 0 : _p.define) || void 0 === _q ? void 0 : _q.startInTotal) && void 0 !== _r ? _r : sourceRowIndex,
60770
+ targetTotalIndex = null !== (_u = null === (_t = null === (_s = this._columns[targetRowIndex]) || void 0 === _s ? void 0 : _s.define) || void 0 === _t ? void 0 : _t.startInTotal) && void 0 !== _u ? _u : targetRowIndex,
60771
+ sourceColumns = this._columns.splice(sourceRowIndex, sourceSize);
60772
+ return sourceColumns.unshift(targetIndex, 0), Array.prototype.splice.apply(this._columns, sourceColumns), this.columnTree.movePosition(sourceCellRange.start.col - this.leftRowSeriesNumberColumnCount, sourceTotalIndex, targetTotalIndex), this.columnTree.reset(this.columnTree.tree.children), this._cellRangeMap = new Map(), {
60768
60773
  sourceIndex: sourceCellRange.start.row,
60769
60774
  targetIndex: targetIndex,
60770
60775
  sourceSize: sourceSize,
@@ -62297,7 +62302,16 @@
62297
62302
  const sourceCellRange = this.getCellRange(source.col, source.row),
62298
62303
  targetCellRange = this.getCellRange(target.col, target.row),
62299
62304
  moveContext = this.internalProps.layoutMap.moveHeaderPosition(source, target);
62300
- return moveContext ? ("column" === moveContext.moveType ? (this.colWidthsMap.exchangeOrder(sourceCellRange.start.col, sourceCellRange.end.col - sourceCellRange.start.col + 1, targetCellRange.start.col, targetCellRange.end.col - targetCellRange.start.col + 1, moveContext.targetIndex), adjustWidthResizedColMap(moveContext, this), this.transpose || (this.colWidthsLimit = {}, this.setMinMaxLimitWidth())) : (moveContext.targetIndex > moveContext.sourceIndex ? this.rowHeightsMap.exchangeOrder(moveContext.sourceIndex, moveContext.sourceSize, moveContext.targetIndex + moveContext.sourceSize - moveContext.targetSize, moveContext.targetSize, moveContext.targetIndex) : this.rowHeightsMap.exchangeOrder(moveContext.sourceIndex, moveContext.sourceSize, moveContext.targetIndex, moveContext.targetSize, moveContext.targetIndex), adjustHeightResizedRowMap(moveContext, this)), moveContext) : null;
62305
+ return moveContext ? ("column" === moveContext.moveType ? (this.colWidthsMap.exchangeOrder(sourceCellRange.start.col, sourceCellRange.end.col - sourceCellRange.start.col + 1, targetCellRange.start.col, targetCellRange.end.col - targetCellRange.start.col + 1, moveContext.targetIndex), adjustWidthResizedColMap(moveContext, this), this.transpose || (this.colWidthsLimit = {}, this.setMinMaxLimitWidth())) : (moveContext.targetIndex > moveContext.sourceIndex ? this.rowHeightsMap.exchangeOrder(moveContext.sourceIndex, moveContext.sourceSize, moveContext.targetIndex + moveContext.sourceSize - moveContext.targetSize, moveContext.targetSize, moveContext.targetIndex) : this.rowHeightsMap.exchangeOrder(moveContext.sourceIndex, moveContext.sourceSize, moveContext.targetIndex, moveContext.targetSize, moveContext.targetIndex), adjustHeightResizedRowMap(moveContext, this)), this.syncColumnsStateFromLayoutMap(), moveContext) : null;
62306
+ }
62307
+ syncColumnsStateFromLayoutMap() {
62308
+ const nextColumns = cloneDeepSpec(this.internalProps.columns, ["children"]),
62309
+ cleanColumns = columns => {
62310
+ columns.forEach(col => {
62311
+ delete col.level, delete col.size, delete col.startInTotal, delete col.startIndex, delete col.id, delete col.hierarchyState, col.columns && cleanColumns(col.columns);
62312
+ });
62313
+ };
62314
+ cleanColumns(nextColumns), this.options.columns = nextColumns, this.options.header && (this.options.header = nextColumns);
62301
62315
  }
62302
62316
  changeRecordOrder(sourceIndex, targetIndex) {
62303
62317
  this.transpose ? (sourceIndex = this.getRecordShowIndexByCell(sourceIndex, 0), targetIndex = this.getRecordShowIndexByCell(targetIndex, 0)) : (sourceIndex = this.getRecordShowIndexByCell(0, sourceIndex), targetIndex = this.getRecordShowIndexByCell(0, targetIndex)), this.dataSource.changeOrder(sourceIndex, targetIndex);
@@ -65066,15 +65080,22 @@
65066
65080
  cursor: "pointer"
65067
65081
  });
65068
65082
  colHeaderGroup.add(hackBorder), colHeaderGroup.border = hackBorder, hackBorder.attachShadow(hackBorder.shadowRoot), hackBorder.name = "border-rect", hackBorder.addEventListener("click", e => {
65083
+ var _a, _b;
65069
65084
  const titleRows = table.listTreeStickCellPlugin.titleRows,
65070
65085
  {
65071
65086
  shadowTarget: shadowTarget
65072
65087
  } = e.pickParams,
65073
- cellGroup = getTargetCell(shadowTarget),
65074
- {
65075
- col: col,
65076
- row: row
65077
- } = cellGroup;
65088
+ cellGroup = getTargetCell(shadowTarget);
65089
+ if (!cellGroup) return;
65090
+ const iconInfo = getIconAndPositionFromTarget(shadowTarget),
65091
+ funcType = null === (_b = null === (_a = null == iconInfo ? void 0 : iconInfo.icon) || void 0 === _a ? void 0 : _a.attribute) || void 0 === _b ? void 0 : _b.funcType;
65092
+ if (funcType === IconFuncTypeEnum.collapse || funcType === IconFuncTypeEnum.expand) {
65093
+ const stickCellTop = getStickCellTop(cellGroup, table);
65094
+ return table.toggleHierarchyState(cellGroup.col, cellGroup.row), void keepRowAtVisiblePosition(cellGroup.col, cellGroup.row, stickCellTop, table);
65095
+ }
65096
+ const {
65097
+ row: row
65098
+ } = cellGroup;
65078
65099
  scrollToRow(row - titleRows.indexOf(row), table);
65079
65100
  });
65080
65101
  }
@@ -65087,15 +65108,22 @@
65087
65108
  cursor: "pointer"
65088
65109
  });
65089
65110
  cornerHeaderGroup.add(hackBorder), cornerHeaderGroup.border = hackBorder, hackBorder.attachShadow(hackBorder.shadowRoot), hackBorder.name = "border-rect", hackBorder.addEventListener("click", e => {
65111
+ var _a, _b;
65090
65112
  const titleRows = table.listTreeStickCellPlugin.titleRows,
65091
65113
  {
65092
65114
  shadowTarget: shadowTarget
65093
65115
  } = e.pickParams,
65094
- cellGroup = getTargetCell(shadowTarget),
65095
- {
65096
- col: col,
65097
- row: row
65098
- } = cellGroup;
65116
+ cellGroup = getTargetCell(shadowTarget);
65117
+ if (!cellGroup) return;
65118
+ const iconInfo = getIconAndPositionFromTarget(shadowTarget),
65119
+ funcType = null === (_b = null === (_a = null == iconInfo ? void 0 : iconInfo.icon) || void 0 === _a ? void 0 : _a.attribute) || void 0 === _b ? void 0 : _b.funcType;
65120
+ if (funcType === IconFuncTypeEnum.collapse || funcType === IconFuncTypeEnum.expand) {
65121
+ const stickCellTop = getStickCellTop(cellGroup, table);
65122
+ return table.toggleHierarchyState(cellGroup.col, cellGroup.row), void keepRowAtVisiblePosition(cellGroup.col, cellGroup.row, stickCellTop, table);
65123
+ }
65124
+ const {
65125
+ row: row
65126
+ } = cellGroup;
65099
65127
  scrollToRow(row - titleRows.indexOf(row), table);
65100
65128
  });
65101
65129
  }
@@ -65115,6 +65143,15 @@
65115
65143
  }
65116
65144
  table.scenegraph.updateNextFrame();
65117
65145
  }
65146
+ function getStickCellTop(cellGroup, table) {
65147
+ var _a, _b;
65148
+ return table.getFrozenRowsHeight() + (null !== (_b = null === (_a = cellGroup.attribute) || void 0 === _a ? void 0 : _a.y) && void 0 !== _b ? _b : 0);
65149
+ }
65150
+ function keepRowAtVisiblePosition(col, row, visibleTop, table) {
65151
+ const drawRange = table.getDrawRange(),
65152
+ targetScrollTop = Math.max(0, Math.min(table.getCellRect(col, row).top - visibleTop, table.getAllRowsHeight() - drawRange.height));
65153
+ table.scrollTop = targetScrollTop, table.scenegraph.updateNextFrame();
65154
+ }
65118
65155
  const registerListTreeStickCellPlugin = () => {
65119
65156
  Factory.registerComponent("listTreeStickCellPlugin", ListTreeStickCellPlugin);
65120
65157
  };