@visactor/vtable-gantt 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.
package/cjs/index.d.ts CHANGED
@@ -6,5 +6,5 @@ import * as tools from './tools';
6
6
  import * as VRender from './vrender';
7
7
  import * as VTable from './vtable';
8
8
  import * as plugins from './plugins';
9
- export declare const version = "1.19.3";
9
+ export declare const version = "1.19.4-alpha.1";
10
10
  export { TYPES, GanttConstructorOptions, Gantt, ColumnsDefine, ColumnDefine, LinkColumnDefine, ChartColumnDefine, ImageColumnDefine, SparklineColumnDefine, ProgressbarColumnDefine, TextColumnDefine, GroupColumnDefine, TextAlignType, TextBaselineType, tools, VRender, VTable, plugins };
package/cjs/index.js CHANGED
@@ -56,5 +56,5 @@ exports.VTable = VTable;
56
56
 
57
57
  const plugins = __importStar(require("./plugins"));
58
58
 
59
- exports.plugins = plugins, exports.version = "1.19.3";
59
+ exports.plugins = plugins, exports.version = "1.19.4-alpha.1";
60
60
  //# sourceMappingURL=index.js.map
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAAoC;AAwBlC,sBAAK;AAVP,mCAAgC;AAY9B,sFAZO,aAAK,OAYP;AAXP,+CAAiC;AAuB/B,sBAAK;AAtBP,mDAAqC;AAuBnC,0BAAO;AAtBT,iDAAmC;AAuBjC,wBAAM;AAtBR,mDAAqC;AAuBnC,0BAAO;AAtBI,QAAA,OAAO,GAAG,QAAQ,CAAC","file":"index.js","sourcesContent":["import type { GanttConstructorOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType\n} from '@visactor/vtable';\nimport { Gantt } from './Gantt';\nimport * as tools from './tools';\nimport * as VRender from './vrender';\nimport * as VTable from './vtable';\nimport * as plugins from './plugins';\nexport const version = \"1.19.3\";\n/**\n * @namespace VTable\n */\nexport {\n TYPES,\n GanttConstructorOptions,\n Gantt,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n tools,\n VRender,\n VTable,\n plugins\n};\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAAoC;AAwBlC,sBAAK;AAVP,mCAAgC;AAY9B,sFAZO,aAAK,OAYP;AAXP,+CAAiC;AAuB/B,sBAAK;AAtBP,mDAAqC;AAuBnC,0BAAO;AAtBT,iDAAmC;AAuBjC,wBAAM;AAtBR,mDAAqC;AAuBnC,0BAAO;AAtBI,QAAA,OAAO,GAAG,gBAAgB,CAAC","file":"index.js","sourcesContent":["import type { GanttConstructorOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType\n} from '@visactor/vtable';\nimport { Gantt } from './Gantt';\nimport * as tools from './tools';\nimport * as VRender from './vrender';\nimport * as VTable from './vtable';\nimport * as plugins from './plugins';\nexport const version = \"1.19.4-alpha.1\";\n/**\n * @namespace VTable\n */\nexport {\n TYPES,\n GanttConstructorOptions,\n Gantt,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n tools,\n VRender,\n VTable,\n plugins\n};\n"]}
@@ -35785,6 +35785,16 @@
35785
35785
  function traverseObject(obj, childrenProperty, callback) {
35786
35786
  callback(obj), (null == obj ? void 0 : obj[childrenProperty]) && Array.isArray(null == obj ? void 0 : obj[childrenProperty]) && obj[childrenProperty].forEach(child => traverseObject(child, childrenProperty, callback));
35787
35787
  }
35788
+ function computeChildrenNodeLength(indexKey, hierarchyState, nodeData) {
35789
+ let size = 0;
35790
+ if (!hierarchyState || hierarchyState === HierarchyState.collapse || hierarchyState === HierarchyState.none) return size;
35791
+ const children = nodeData.filteredChildren ? nodeData.filteredChildren : nodeData.children;
35792
+ if (children) for (let i = 0; i < children.length; i++) {
35793
+ size += 1;
35794
+ size += computeChildrenNodeLength(Array.isArray(indexKey) ? indexKey.concat([i]) : [indexKey, i], children[i].hierarchyState, children[i]);
35795
+ }
35796
+ return size;
35797
+ }
35788
35798
 
35789
35799
  const isNode = "undefined" == typeof window || void 0 === window.window;
35790
35800
  let arrayFind, arrayFindIndex;
@@ -38056,17 +38066,8 @@
38056
38066
  state = this.getHierarchyState(index),
38057
38067
  data = this.getOriginalRecord(indexed);
38058
38068
  if (this.clearSortedIndexMap(), state === HierarchyState.collapse) data.hierarchyState = HierarchyState.expand, this.pushChildrenNode(indexed, HierarchyState.expand, data), this.hasHierarchyStateExpand = !0;else if (state === HierarchyState.expand) {
38059
- let childrenLength = 0;
38060
- const computeChildrenNodeLength = (indexKey, hierarchyState, nodeData) => {
38061
- if (!hierarchyState || hierarchyState === HierarchyState.collapse || hierarchyState === HierarchyState.none) return;
38062
- const children = nodeData.filteredChildren ? nodeData.filteredChildren : nodeData.children;
38063
- if (children) for (let i = 0; i < children.length; i++) {
38064
- childrenLength += 1;
38065
- const childIndex = Array.isArray(indexKey) ? indexKey.concat([i]) : [indexKey, i];
38066
- computeChildrenNodeLength(childIndex, children[i].hierarchyState, children[i]);
38067
- }
38068
- };
38069
- computeChildrenNodeLength(indexed, state, data), this.currentIndexedData.splice(this.currentIndexedData.indexOf(indexed) + 1, childrenLength), data.hierarchyState = HierarchyState.collapse;
38069
+ const childrenLength = computeChildrenNodeLength(indexed, state, data);
38070
+ this.currentIndexedData.splice(this.currentIndexedData.indexOf(indexed) + 1, childrenLength), data.hierarchyState = HierarchyState.collapse;
38070
38071
  }
38071
38072
  this.updatePagerData();
38072
38073
  const add = [],
@@ -50493,7 +50494,13 @@
50493
50494
  function startMoveCol(col, row, x, y, state, event) {
50494
50495
  var _a;
50495
50496
  if (!("canMoveHeaderPosition" in state.table.internalProps.layoutMap)) return;
50496
- 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;
50497
+ if (state.columnMove.moving = !0, state.columnMove.colSource = col, state.columnMove.rowSource = row, state.table.isListTable()) {
50498
+ const nodeIndex = state.table.getRecordIndexByCell(col, row),
50499
+ nodeData = state.table.getRecordByCell(col, row),
50500
+ hierarchyState = state.table.getRecordHierarchyState(col, row);
50501
+ state.columnMove.rowSourceSize = computeChildrenNodeLength(nodeIndex, hierarchyState, nodeData) + 1;
50502
+ }
50503
+ state.columnMove.x = x - state.table.tableX, state.columnMove.y = y - state.table.tableY;
50497
50504
  const cellLocation = state.table.getCellLocation(col, row),
50498
50505
  delta = "columnHeader" === cellLocation ? state.columnMove.x : "rowHeader" === cellLocation || state.table.internalProps.layoutMap.isSeriesNumberInBody(col, row) ? state.columnMove.y : 0,
50499
50506
  {
@@ -50532,8 +50539,14 @@
50532
50539
  col: targetCell.col,
50533
50540
  row: targetCell.row
50534
50541
  })) {
50542
+ 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()) {
50543
+ const nodeIndex = state.table.getRecordIndexByCell(targetCell.col, targetCell.row),
50544
+ nodeData = state.table.getRecordByCell(targetCell.col, targetCell.row),
50545
+ hierarchyState = state.table.getRecordHierarchyState(targetCell.col, targetCell.row);
50546
+ state.columnMove.rowTargetSize = computeChildrenNodeLength(nodeIndex, hierarchyState, nodeData) + 1;
50547
+ }
50535
50548
  let lineX, backX, lineY, backY;
50536
- 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");
50549
+ state.updateCursor("grabbing");
50537
50550
  const cellLocation = state.table.getCellLocation(state.columnMove.colSource, state.columnMove.rowSource);
50538
50551
  "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, {
50539
50552
  col: col,
@@ -51062,6 +51075,8 @@
51062
51075
  colTarget: -1,
51063
51076
  rowSource: -1,
51064
51077
  rowTarget: -1,
51078
+ rowSourceSize: 0,
51079
+ rowTargetSize: 0,
51065
51080
  x: 0,
51066
51081
  y: 0,
51067
51082
  moving: !1
@@ -51127,6 +51142,8 @@
51127
51142
  colTarget: -1,
51128
51143
  rowSource: -1,
51129
51144
  rowTarget: -1,
51145
+ rowSourceSize: 0,
51146
+ rowTargetSize: 0,
51130
51147
  x: 0,
51131
51148
  y: 0,
51132
51149
  moving: !1
@@ -52022,28 +52039,44 @@
52022
52039
  }
52023
52040
 
52024
52041
  function fireMoveColEventListeners(table, endMoveColSuccess, e) {
52025
- var _a, _b, _c, _d;
52026
- 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, {
52027
- target: {
52028
- col: table.stateManager.columnMove.colTarget,
52029
- row: table.stateManager.columnMove.rowTarget
52030
- },
52031
- source: {
52032
- col: table.stateManager.columnMove.colSource,
52033
- row: table.stateManager.columnMove.rowSource
52034
- },
52035
- event: e
52036
- }) : endMoveColSuccess || table.hasListeners(TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION_FAIL) && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION_FAIL, {
52037
- target: {
52038
- col: table.stateManager.columnMove.colTarget,
52039
- row: table.stateManager.columnMove.rowTarget
52040
- },
52041
- source: {
52042
- col: table.stateManager.columnMove.colSource,
52043
- row: table.stateManager.columnMove.rowSource
52044
- },
52045
- event: e
52046
- });
52042
+ var _a, _b, _c, _d, _e, _f, _g, _h;
52043
+ 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)) {
52044
+ if (table.hasListeners(TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION)) {
52045
+ const {
52046
+ colSource: colSource,
52047
+ rowSource: rowSource,
52048
+ colTarget: colTarget,
52049
+ rowTarget: rowTarget
52050
+ } = table.stateManager.columnMove,
52051
+ rowSourceSize = null !== (_e = table.stateManager.columnMove.rowSourceSize) && void 0 !== _e ? _e : 0,
52052
+ rowTargetSize = null !== (_f = table.stateManager.columnMove.rowTargetSize) && void 0 !== _f ? _f : 0;
52053
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION, {
52054
+ target: {
52055
+ col: colTarget,
52056
+ row: rowTarget + rowTargetSize - rowSourceSize
52057
+ },
52058
+ source: {
52059
+ col: colSource,
52060
+ row: rowSource
52061
+ },
52062
+ event: e
52063
+ });
52064
+ }
52065
+ } else if (!endMoveColSuccess && table.hasListeners(TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION_FAIL)) {
52066
+ const rowSourceSize = null !== (_g = table.stateManager.columnMove.rowSourceSize) && void 0 !== _g ? _g : 0,
52067
+ rowTargetSize = null !== (_h = table.stateManager.columnMove.rowTargetSize) && void 0 !== _h ? _h : 0;
52068
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION_FAIL, {
52069
+ target: {
52070
+ col: table.stateManager.columnMove.colTarget,
52071
+ row: table.stateManager.columnMove.rowTarget + rowTargetSize - rowSourceSize
52072
+ },
52073
+ source: {
52074
+ col: table.stateManager.columnMove.colSource,
52075
+ row: table.stateManager.columnMove.rowSource
52076
+ },
52077
+ event: e
52078
+ });
52079
+ }
52047
52080
  }
52048
52081
 
52049
52082
  function bindTableGroupListener$1(eventManager) {
@@ -56259,7 +56292,7 @@
56259
56292
  }
56260
56293
  constructor(container, options = {}) {
56261
56294
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
56262
- 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");
56295
+ 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");
56263
56296
  this.pluginManager = new PluginManager$1(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
56264
56297
  options: options,
56265
56298
  container: container
@@ -61449,6 +61482,10 @@
61449
61482
  const index = this.getRecordShowIndexByCell(col, row);
61450
61483
  return this.dataSource.getHierarchyState(index);
61451
61484
  }
61485
+ getRecordHierarchyState(col, row) {
61486
+ let recordIndex;
61487
+ return this.transpose ? this.getRecordShowIndexByCell(col, 0) : recordIndex = this.getRecordShowIndexByCell(0, row), this.dataSource.getHierarchyState(recordIndex);
61488
+ }
61452
61489
  toggleHierarchyState(col, row, recalculateColWidths = !0) {
61453
61490
  this.stateManager.updateHoverIcon(col, row, void 0, void 0);
61454
61491
  const hierarchyState = this.getHierarchyState(col, row);
@@ -72519,7 +72556,7 @@
72519
72556
  PluginManager: PluginManager
72520
72557
  });
72521
72558
 
72522
- const version = "1.19.3";
72559
+ const version = "1.19.4-alpha.1";
72523
72560
 
72524
72561
  exports.Gantt = Gantt;
72525
72562
  exports.TYPES = index$4;