@visactor/vtable-calendar 1.19.4-alpha.0 → 1.19.4-alpha.1

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.
@@ -33159,6 +33159,16 @@
33159
33159
  function traverseObject(obj, childrenProperty, callback) {
33160
33160
  callback(obj), (null == obj ? void 0 : obj[childrenProperty]) && Array.isArray(null == obj ? void 0 : obj[childrenProperty]) && obj[childrenProperty].forEach(child => traverseObject(child, childrenProperty, callback));
33161
33161
  }
33162
+ function computeChildrenNodeLength(indexKey, hierarchyState, nodeData) {
33163
+ let size = 0;
33164
+ if (!hierarchyState || hierarchyState === HierarchyState.collapse || hierarchyState === HierarchyState.none) return size;
33165
+ const children = nodeData.filteredChildren ? nodeData.filteredChildren : nodeData.children;
33166
+ if (children) for (let i = 0; i < children.length; i++) {
33167
+ size += 1;
33168
+ size += computeChildrenNodeLength(Array.isArray(indexKey) ? indexKey.concat([i]) : [indexKey, i], children[i].hierarchyState, children[i]);
33169
+ }
33170
+ return size;
33171
+ }
33162
33172
 
33163
33173
  const isNode = "undefined" == typeof window || void 0 === window.window;
33164
33174
  let arrayFind, arrayFindIndex;
@@ -35416,17 +35426,8 @@
35416
35426
  state = this.getHierarchyState(index),
35417
35427
  data = this.getOriginalRecord(indexed);
35418
35428
  if (this.clearSortedIndexMap(), state === HierarchyState.collapse) data.hierarchyState = HierarchyState.expand, this.pushChildrenNode(indexed, HierarchyState.expand, data), this.hasHierarchyStateExpand = !0;else if (state === HierarchyState.expand) {
35419
- let childrenLength = 0;
35420
- const computeChildrenNodeLength = (indexKey, hierarchyState, nodeData) => {
35421
- if (!hierarchyState || hierarchyState === HierarchyState.collapse || hierarchyState === HierarchyState.none) return;
35422
- const children = nodeData.filteredChildren ? nodeData.filteredChildren : nodeData.children;
35423
- if (children) for (let i = 0; i < children.length; i++) {
35424
- childrenLength += 1;
35425
- const childIndex = Array.isArray(indexKey) ? indexKey.concat([i]) : [indexKey, i];
35426
- computeChildrenNodeLength(childIndex, children[i].hierarchyState, children[i]);
35427
- }
35428
- };
35429
- computeChildrenNodeLength(indexed, state, data), this.currentIndexedData.splice(this.currentIndexedData.indexOf(indexed) + 1, childrenLength), data.hierarchyState = HierarchyState.collapse;
35429
+ const childrenLength = computeChildrenNodeLength(indexed, state, data);
35430
+ this.currentIndexedData.splice(this.currentIndexedData.indexOf(indexed) + 1, childrenLength), data.hierarchyState = HierarchyState.collapse;
35430
35431
  }
35431
35432
  this.updatePagerData();
35432
35433
  const add = [],
@@ -45224,20 +45225,13 @@
45224
45225
  const pos = _getUpdateRowIndex(addRows[0] - 1, addRows[addRows.length - 1] + 1, scene);
45225
45226
  rowUpdatePos = isValid$3(rowUpdatePos) ? isValid$3(pos) ? Math.min(rowUpdatePos, pos) : rowUpdatePos : pos;
45226
45227
  }
45227
- const batchMergePos = new Set();
45228
45228
  for (let col = 0; col < table.colCount; col++) updateRows.forEach(row => {
45229
45229
  if (row < table.frozenRowCount) {
45230
45230
  const mergeInfo = getCellMergeInfo(scene.table, col, row);
45231
- if (mergeInfo) for (let col = mergeInfo.start.col; col <= mergeInfo.end.col; col++) for (let row = mergeInfo.start.row; row <= mergeInfo.end.row; row++) {
45232
- const key = `${col}-${row}`;
45233
- batchMergePos.has(key) || (updateCell$1(col, row, scene.table, !1), batchMergePos.add(key));
45234
- } else updateCell$1(col, row, scene.table, !1);
45231
+ if (mergeInfo) for (let col = mergeInfo.start.col; col <= mergeInfo.end.col; col++) for (let row = mergeInfo.start.row; row <= mergeInfo.end.row; row++) updateCell$1(col, row, scene.table, !1);else updateCell$1(col, row, scene.table, !1);
45235
45232
  } else if (row > table.rowCount - 1 || row < scene.table.rowCount - scene.table.bottomFrozenRowCount && (row < scene.proxy.rowStart || row > scene.proxy.rowEnd)) removeCellGroup(row, scene);else {
45236
45233
  const mergeInfo = getCellMergeInfo(scene.table, col, row);
45237
- if (mergeInfo) for (let col = mergeInfo.start.col; col <= mergeInfo.end.col; col++) for (let row = mergeInfo.start.row; row <= mergeInfo.end.row; row++) {
45238
- const key = `${col}-${row}`;
45239
- batchMergePos.has(key) || (updateCell$1(col, row, scene.table, !1), batchMergePos.add(key));
45240
- } else updateCell$1(col, row, scene.table, !1);
45234
+ if (mergeInfo) for (let col = mergeInfo.start.col; col <= mergeInfo.end.col; col++) for (let row = mergeInfo.start.row; row <= mergeInfo.end.row; row++) updateCell$1(col, row, scene.table, !1);else updateCell$1(col, row, scene.table, !1);
45241
45235
  }
45242
45236
  });
45243
45237
  if (updateRows.length) {
@@ -46214,20 +46208,15 @@
46214
46208
  });
46215
46209
  const colWidthsMap = table.colWidthsMap;
46216
46210
  let updateAfter;
46217
- removeCols.forEach(col => {
46211
+ if (removeCols.forEach(col => {
46218
46212
  colWidthsMap.delAndReorder(col);
46219
46213
  }), removeCols.length && resetColNumber(scene), scene.table._clearColRangeWidthsMap(), addCols.forEach(col => {
46220
46214
  const needUpdateAfter = addCol(col, scene);
46221
46215
  resetColNumber(scene), updateAfter = null != updateAfter ? updateAfter : needUpdateAfter, colWidthsMap.addAndReorder(col);
46222
- }), resetColNumberAndX(scene);
46223
- const batchMergePos = new Set();
46224
- if (updateCols.forEach(col => {
46216
+ }), resetColNumberAndX(scene), updateCols.forEach(col => {
46225
46217
  for (let row = 0; row < table.rowCount; row++) {
46226
46218
  const mergeInfo = getCellMergeInfo(scene.table, col, row);
46227
- if (mergeInfo) for (let col = mergeInfo.start.col; col <= mergeInfo.end.col; col++) for (let col = mergeInfo.start.col; col <= mergeInfo.end.col; col++) {
46228
- const key = `${col}-${row}`;
46229
- batchMergePos.has(key) || (updateCell$1(col, row, scene.table, !1), batchMergePos.add(key));
46230
- } else updateCell$1(col, row, scene.table, !1);
46219
+ if (mergeInfo) for (let col = mergeInfo.start.col; col <= mergeInfo.end.col; col++) for (let col = mergeInfo.start.col; col <= mergeInfo.end.col; col++) updateCell$1(col, row, scene.table, !1);else updateCell$1(col, row, scene.table, !1);
46231
46220
  }
46232
46221
  }), isNumber$4(updateAfter)) {
46233
46222
  for (let col = updateAfter; col < Math.max(table.colCount, null !== (_a = table.internalProps._oldColCount) && void 0 !== _a ? _a : table.colCount); col++) for (let row = 0; row < Math.max(table.rowCount, null !== (_b = table.internalProps._oldRowCount) && void 0 !== _b ? _b : table.rowCount); row++) {
@@ -47865,7 +47854,13 @@
47865
47854
  function startMoveCol(col, row, x, y, state, event) {
47866
47855
  var _a;
47867
47856
  if (!("canMoveHeaderPosition" in state.table.internalProps.layoutMap)) return;
47868
- state.columnMove.moving = !0, state.columnMove.colSource = col, state.columnMove.rowSource = row, state.columnMove.x = x - state.table.tableX, state.columnMove.y = y - state.table.tableY;
47857
+ if (state.columnMove.moving = !0, state.columnMove.colSource = col, state.columnMove.rowSource = row, state.table.isListTable()) {
47858
+ const nodeIndex = state.table.getRecordIndexByCell(col, row),
47859
+ nodeData = state.table.getRecordByCell(col, row),
47860
+ hierarchyState = state.table.getRecordHierarchyState(col, row);
47861
+ state.columnMove.rowSourceSize = computeChildrenNodeLength(nodeIndex, hierarchyState, nodeData) + 1;
47862
+ }
47863
+ state.columnMove.x = x - state.table.tableX, state.columnMove.y = y - state.table.tableY;
47869
47864
  const cellLocation = state.table.getCellLocation(col, row),
47870
47865
  delta = "columnHeader" === cellLocation ? state.columnMove.x : "rowHeader" === cellLocation || state.table.internalProps.layoutMap.isSeriesNumberInBody(col, row) ? state.columnMove.y : 0,
47871
47866
  {
@@ -47904,8 +47899,14 @@
47904
47899
  col: targetCell.col,
47905
47900
  row: targetCell.row
47906
47901
  })) {
47902
+ if (state.columnMove.x = x - state.table.tableX, state.columnMove.y = y - state.table.tableY, state.columnMove.colTarget = targetCell.col, state.columnMove.rowTarget = targetCell.row, state.table.isListTable()) {
47903
+ const nodeIndex = state.table.getRecordIndexByCell(targetCell.col, targetCell.row),
47904
+ nodeData = state.table.getRecordByCell(targetCell.col, targetCell.row),
47905
+ hierarchyState = state.table.getRecordHierarchyState(targetCell.col, targetCell.row);
47906
+ state.columnMove.rowTargetSize = computeChildrenNodeLength(nodeIndex, hierarchyState, nodeData) + 1;
47907
+ }
47907
47908
  let lineX, backX, lineY, backY;
47908
- state.columnMove.x = x - state.table.tableX, state.columnMove.y = y - state.table.tableY, state.columnMove.colTarget = targetCell.col, state.columnMove.rowTarget = targetCell.row, state.updateCursor("grabbing");
47909
+ state.updateCursor("grabbing");
47909
47910
  const cellLocation = state.table.getCellLocation(state.columnMove.colSource, state.columnMove.rowSource);
47910
47911
  "columnHeader" === cellLocation ? (backX = state.columnMove.x, lineX = state.table.isLeftFrozenColumn(col) ? state.columnMove.colTarget >= state.columnMove.colSource ? state.table.getColsWidth(0, state.columnMove.colTarget) : state.table.getColsWidth(0, state.columnMove.colTarget - 1) : state.table.isRightFrozenColumn(col) ? state.table.tableNoFrameWidth - state.table.getColsWidth(targetCell.col + 1, state.table.colCount - 1) : (state.columnMove.colTarget >= state.columnMove.colSource ? state.table.getColsWidth(0, state.columnMove.colTarget) : state.table.getColsWidth(0, state.columnMove.colTarget - 1)) - state.table.stateManager.scroll.horizontalBarPos) : ("rowHeader" === cellLocation || state.table.internalProps.layoutMap.isSeriesNumberInBody(col, row)) && (backY = state.columnMove.y, lineY = state.table.isFrozenRow(row) ? state.columnMove.rowTarget >= state.columnMove.rowSource ? state.table.getRowsHeight(0, state.columnMove.rowTarget) : state.table.getRowsHeight(0, state.columnMove.rowTarget - 1) : state.table.isBottomFrozenRow(row) ? state.table.tableNoFrameHeight - state.table.getRowsHeight(targetCell.row + 1, state.table.rowCount - 1) : (state.columnMove.rowTarget >= state.columnMove.rowSource ? state.table.getRowsHeight(0, state.columnMove.rowTarget) : state.table.getRowsHeight(0, state.columnMove.rowTarget - 1)) - state.table.stateManager.scroll.verticalBarPos), state.table.scenegraph.component.updateMoveCol(backX, lineX, backY, lineY), state.table.fireListeners(TABLE_EVENT_TYPE.CHANGING_HEADER_POSITION, {
47911
47912
  col: col,
@@ -48434,6 +48435,8 @@
48434
48435
  colTarget: -1,
48435
48436
  rowSource: -1,
48436
48437
  rowTarget: -1,
48438
+ rowSourceSize: 0,
48439
+ rowTargetSize: 0,
48437
48440
  x: 0,
48438
48441
  y: 0,
48439
48442
  moving: !1
@@ -48499,6 +48502,8 @@
48499
48502
  colTarget: -1,
48500
48503
  rowSource: -1,
48501
48504
  rowTarget: -1,
48505
+ rowSourceSize: 0,
48506
+ rowTargetSize: 0,
48502
48507
  x: 0,
48503
48508
  y: 0,
48504
48509
  moving: !1
@@ -49394,28 +49399,44 @@
49394
49399
  }
49395
49400
 
49396
49401
  function fireMoveColEventListeners(table, endMoveColSuccess, e) {
49397
- var _a, _b, _c, _d;
49398
- endMoveColSuccess && -1 !== (null === (_a = table.stateManager.columnMove) || void 0 === _a ? void 0 : _a.colSource) && -1 !== (null === (_b = table.stateManager.columnMove) || void 0 === _b ? void 0 : _b.rowSource) && -1 !== (null === (_c = table.stateManager.columnMove) || void 0 === _c ? void 0 : _c.colTarget) && -1 !== (null === (_d = table.stateManager.columnMove) || void 0 === _d ? void 0 : _d.rowTarget) ? table.hasListeners(TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION) && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION, {
49399
- target: {
49400
- col: table.stateManager.columnMove.colTarget,
49401
- row: table.stateManager.columnMove.rowTarget
49402
- },
49403
- source: {
49404
- col: table.stateManager.columnMove.colSource,
49405
- row: table.stateManager.columnMove.rowSource
49406
- },
49407
- event: e
49408
- }) : endMoveColSuccess || table.hasListeners(TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION_FAIL) && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION_FAIL, {
49409
- target: {
49410
- col: table.stateManager.columnMove.colTarget,
49411
- row: table.stateManager.columnMove.rowTarget
49412
- },
49413
- source: {
49414
- col: table.stateManager.columnMove.colSource,
49415
- row: table.stateManager.columnMove.rowSource
49416
- },
49417
- event: e
49418
- });
49402
+ var _a, _b, _c, _d, _e, _f, _g, _h;
49403
+ if (endMoveColSuccess && -1 !== (null === (_a = table.stateManager.columnMove) || void 0 === _a ? void 0 : _a.colSource) && -1 !== (null === (_b = table.stateManager.columnMove) || void 0 === _b ? void 0 : _b.rowSource) && -1 !== (null === (_c = table.stateManager.columnMove) || void 0 === _c ? void 0 : _c.colTarget) && -1 !== (null === (_d = table.stateManager.columnMove) || void 0 === _d ? void 0 : _d.rowTarget)) {
49404
+ if (table.hasListeners(TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION)) {
49405
+ const {
49406
+ colSource: colSource,
49407
+ rowSource: rowSource,
49408
+ colTarget: colTarget,
49409
+ rowTarget: rowTarget
49410
+ } = table.stateManager.columnMove,
49411
+ rowSourceSize = null !== (_e = table.stateManager.columnMove.rowSourceSize) && void 0 !== _e ? _e : 0,
49412
+ rowTargetSize = null !== (_f = table.stateManager.columnMove.rowTargetSize) && void 0 !== _f ? _f : 0;
49413
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION, {
49414
+ target: {
49415
+ col: colTarget,
49416
+ row: rowTarget + rowTargetSize - rowSourceSize
49417
+ },
49418
+ source: {
49419
+ col: colSource,
49420
+ row: rowSource
49421
+ },
49422
+ event: e
49423
+ });
49424
+ }
49425
+ } else if (!endMoveColSuccess && table.hasListeners(TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION_FAIL)) {
49426
+ const rowSourceSize = null !== (_g = table.stateManager.columnMove.rowSourceSize) && void 0 !== _g ? _g : 0,
49427
+ rowTargetSize = null !== (_h = table.stateManager.columnMove.rowTargetSize) && void 0 !== _h ? _h : 0;
49428
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION_FAIL, {
49429
+ target: {
49430
+ col: table.stateManager.columnMove.colTarget,
49431
+ row: table.stateManager.columnMove.rowTarget + rowTargetSize - rowSourceSize
49432
+ },
49433
+ source: {
49434
+ col: table.stateManager.columnMove.colSource,
49435
+ row: table.stateManager.columnMove.rowSource
49436
+ },
49437
+ event: e
49438
+ });
49439
+ }
49419
49440
  }
49420
49441
 
49421
49442
  function bindTableGroupListener(eventManager) {
@@ -53631,7 +53652,7 @@
53631
53652
  }
53632
53653
  constructor(container, options = {}) {
53633
53654
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
53634
- if (super(), this.showFrozenIcon = !0, this.version = "1.19.4-alpha.0", 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");
53655
+ if (super(), this.showFrozenIcon = !0, this.version = "1.19.4-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");
53635
53656
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
53636
53657
  options: options,
53637
53658
  container: container
@@ -58785,6 +58806,10 @@
58785
58806
  const index = this.getRecordShowIndexByCell(col, row);
58786
58807
  return this.dataSource.getHierarchyState(index);
58787
58808
  }
58809
+ getRecordHierarchyState(col, row) {
58810
+ let recordIndex;
58811
+ return this.transpose ? this.getRecordShowIndexByCell(col, 0) : recordIndex = this.getRecordShowIndexByCell(0, row), this.dataSource.getHierarchyState(recordIndex);
58812
+ }
58788
58813
  toggleHierarchyState(col, row, recalculateColWidths = !0) {
58789
58814
  this.stateManager.updateHoverIcon(col, row, void 0, void 0);
58790
58815
  const hierarchyState = this.getHierarchyState(col, row);