@visactor/vtable-calendar 1.19.3 → 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 = [],
@@ -47853,7 +47854,13 @@
47853
47854
  function startMoveCol(col, row, x, y, state, event) {
47854
47855
  var _a;
47855
47856
  if (!("canMoveHeaderPosition" in state.table.internalProps.layoutMap)) return;
47856
- 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;
47857
47864
  const cellLocation = state.table.getCellLocation(col, row),
47858
47865
  delta = "columnHeader" === cellLocation ? state.columnMove.x : "rowHeader" === cellLocation || state.table.internalProps.layoutMap.isSeriesNumberInBody(col, row) ? state.columnMove.y : 0,
47859
47866
  {
@@ -47892,8 +47899,14 @@
47892
47899
  col: targetCell.col,
47893
47900
  row: targetCell.row
47894
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
+ }
47895
47908
  let lineX, backX, lineY, backY;
47896
- 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");
47897
47910
  const cellLocation = state.table.getCellLocation(state.columnMove.colSource, state.columnMove.rowSource);
47898
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, {
47899
47912
  col: col,
@@ -48422,6 +48435,8 @@
48422
48435
  colTarget: -1,
48423
48436
  rowSource: -1,
48424
48437
  rowTarget: -1,
48438
+ rowSourceSize: 0,
48439
+ rowTargetSize: 0,
48425
48440
  x: 0,
48426
48441
  y: 0,
48427
48442
  moving: !1
@@ -48487,6 +48502,8 @@
48487
48502
  colTarget: -1,
48488
48503
  rowSource: -1,
48489
48504
  rowTarget: -1,
48505
+ rowSourceSize: 0,
48506
+ rowTargetSize: 0,
48490
48507
  x: 0,
48491
48508
  y: 0,
48492
48509
  moving: !1
@@ -49382,28 +49399,44 @@
49382
49399
  }
49383
49400
 
49384
49401
  function fireMoveColEventListeners(table, endMoveColSuccess, e) {
49385
- var _a, _b, _c, _d;
49386
- 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, {
49387
- target: {
49388
- col: table.stateManager.columnMove.colTarget,
49389
- row: table.stateManager.columnMove.rowTarget
49390
- },
49391
- source: {
49392
- col: table.stateManager.columnMove.colSource,
49393
- row: table.stateManager.columnMove.rowSource
49394
- },
49395
- event: e
49396
- }) : endMoveColSuccess || table.hasListeners(TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION_FAIL) && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION_FAIL, {
49397
- target: {
49398
- col: table.stateManager.columnMove.colTarget,
49399
- row: table.stateManager.columnMove.rowTarget
49400
- },
49401
- source: {
49402
- col: table.stateManager.columnMove.colSource,
49403
- row: table.stateManager.columnMove.rowSource
49404
- },
49405
- event: e
49406
- });
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
+ }
49407
49440
  }
49408
49441
 
49409
49442
  function bindTableGroupListener(eventManager) {
@@ -53619,7 +53652,7 @@
53619
53652
  }
53620
53653
  constructor(container, options = {}) {
53621
53654
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
53622
- if (super(), this.showFrozenIcon = !0, this.version = "1.19.3", 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");
53623
53656
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
53624
53657
  options: options,
53625
53658
  container: container
@@ -58773,6 +58806,10 @@
58773
58806
  const index = this.getRecordShowIndexByCell(col, row);
58774
58807
  return this.dataSource.getHierarchyState(index);
58775
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
+ }
58776
58813
  toggleHierarchyState(col, row, recalculateColWidths = !0) {
58777
58814
  this.stateManager.updateHoverIcon(col, row, void 0, void 0);
58778
58815
  const hierarchyState = this.getHierarchyState(col, row);