@visactor/vtable 1.3.0 → 1.3.1-alpha.0

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.
Files changed (41) hide show
  1. package/cjs/PivotTable.js +17 -11
  2. package/cjs/PivotTable.js.map +1 -1
  3. package/cjs/components/empty-tip/empty-tip.js +2 -2
  4. package/cjs/components/empty-tip/empty-tip.js.map +1 -1
  5. package/cjs/core/BaseTable.js +1 -1
  6. package/cjs/core/BaseTable.js.map +1 -1
  7. package/cjs/dataset/dataset.d.ts +2 -0
  8. package/cjs/dataset/dataset.js +8 -7
  9. package/cjs/dataset/dataset.js.map +1 -1
  10. package/cjs/index.d.ts +1 -1
  11. package/cjs/index.js +2 -2
  12. package/cjs/index.js.map +1 -1
  13. package/cjs/layout/pivot-header-layout.js +17 -13
  14. package/cjs/layout/pivot-header-layout.js.map +1 -1
  15. package/cjs/scenegraph/group-creater/cell-helper.js +2 -2
  16. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  17. package/cjs/scenegraph/layout/frozen.js +12 -4
  18. package/cjs/scenegraph/layout/frozen.js.map +1 -1
  19. package/cjs/vrender.js.map +1 -1
  20. package/dist/vtable.js +111 -23
  21. package/dist/vtable.min.js +2 -2
  22. package/es/PivotTable.js +17 -11
  23. package/es/PivotTable.js.map +1 -1
  24. package/es/components/empty-tip/empty-tip.js +2 -2
  25. package/es/components/empty-tip/empty-tip.js.map +1 -1
  26. package/es/core/BaseTable.js +1 -1
  27. package/es/core/BaseTable.js.map +1 -1
  28. package/es/dataset/dataset.d.ts +2 -0
  29. package/es/dataset/dataset.js +8 -7
  30. package/es/dataset/dataset.js.map +1 -1
  31. package/es/index.d.ts +1 -1
  32. package/es/index.js +1 -1
  33. package/es/index.js.map +1 -1
  34. package/es/layout/pivot-header-layout.js +17 -13
  35. package/es/layout/pivot-header-layout.js.map +1 -1
  36. package/es/scenegraph/group-creater/cell-helper.js +2 -2
  37. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  38. package/es/scenegraph/layout/frozen.js +12 -4
  39. package/es/scenegraph/layout/frozen.js.map +1 -1
  40. package/es/vrender.js.map +1 -1
  41. package/package.json +5 -5
package/cjs/PivotTable.js CHANGED
@@ -33,7 +33,7 @@ const ts_types_1 = require("./ts-types"), pivot_header_layout_1 = require("./lay
33
33
 
34
34
  class PivotTable extends BaseTable_1.BaseTable {
35
35
  constructor(container, options) {
36
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
36
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
37
37
  if ("node" === env_1.Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container,
38
38
  container = container.container ? container.container : null), super(container, options),
39
39
  this.layoutNodeId = {
@@ -68,13 +68,15 @@ class PivotTable extends BaseTable_1.BaseTable {
68
68
  this.dataset = new dataset_1.Dataset(this.internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, null === (_l = options.indicatorsAsCol) || void 0 === _l || _l, options.records, options.rowHierarchyType, this.internalProps.columnTree, this.internalProps.rowTree),
69
69
  options.columnTree || (!1 !== options.indicatorsAsCol && (this.dataset.colHeaderTree = (0,
70
70
  layout_helper_1.supplementIndicatorNodesForCustomTree)(this.dataset.colHeaderTree, options.indicators)),
71
- columnDimensionTree = new tree_helper_1.DimensionTree(null !== (_m = this.dataset.colHeaderTree) && void 0 !== _m ? _m : [], this.layoutNodeId)),
71
+ 0 !== (null !== (_o = null === (_m = this.records) || void 0 === _m ? void 0 : _m.length) && void 0 !== _o ? _o : 0) || this.dataset.customColTree || this.dataset.customRowTree || (this.dataset.colHeaderTree = []),
72
+ columnDimensionTree = new tree_helper_1.DimensionTree(null !== (_p = this.dataset.colHeaderTree) && void 0 !== _p ? _p : [], this.layoutNodeId)),
72
73
  options.rowTree || (!1 === options.indicatorsAsCol && (this.dataset.rowHeaderTree = (0,
73
74
  layout_helper_1.supplementIndicatorNodesForCustomTree)(this.dataset.rowHeaderTree, options.indicators)),
74
- rowDimensionTree = new tree_helper_1.DimensionTree(null !== (_o = this.dataset.rowHeaderTree) && void 0 !== _o ? _o : [], this.layoutNodeId, this.options.rowHierarchyType, "tree" === this.options.rowHierarchyType ? null !== (_p = this.options.rowExpandLevel) && void 0 !== _p ? _p : 1 : void 0)),
75
+ 0 !== (null !== (_r = null === (_q = this.records) || void 0 === _q ? void 0 : _q.length) && void 0 !== _r ? _r : 0) || this.dataset.customColTree || this.dataset.customRowTree || (this.dataset.rowHeaderTree = []),
76
+ rowDimensionTree = new tree_helper_1.DimensionTree(null !== (_s = this.dataset.rowHeaderTree) && void 0 !== _s ? _s : [], this.layoutNodeId, this.options.rowHierarchyType, "tree" === this.options.rowHierarchyType ? null !== (_t = this.options.rowExpandLevel) && void 0 !== _t ? _t : 1 : void 0)),
75
77
  this.internalProps.layoutMap = new pivot_header_layout_1.PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree);
76
78
  }
77
- this._changePivotSortStateBySortRules(), (null !== (_r = null === (_q = options.pivotSortState) || void 0 === _q ? void 0 : _q.length) && void 0 !== _r ? _r : 0) > 0 && (this.pivotSortState = [],
79
+ this._changePivotSortStateBySortRules(), (null !== (_v = null === (_u = options.pivotSortState) || void 0 === _u ? void 0 : _u.length) && void 0 !== _v ? _v : 0) > 0 && (this.pivotSortState = [],
78
80
  this.pivotSortState = options.pivotSortState), "node" !== env_1.Env.mode && (this.editorManager = new edit_manager_1.EditManeger(this)),
79
81
  this.refreshHeader(), this.stateManager.initCheckedState(records), this.scenegraph.createSceneGraph(),
80
82
  options.title && (this.internalProps.title = new title_1.Title(options.title, this),
@@ -112,7 +114,7 @@ class PivotTable extends BaseTable_1.BaseTable {
112
114
  return ifCan;
113
115
  }
114
116
  updateOption(options) {
115
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
117
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
116
118
  const internalProps = this.internalProps;
117
119
  if (super.updateOption(options), this.layoutNodeId = {
118
120
  seqId: 0
@@ -153,13 +155,15 @@ class PivotTable extends BaseTable_1.BaseTable {
153
155
  this.dataset = new dataset_1.Dataset(internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, null === (_o = options.indicatorsAsCol) || void 0 === _o || _o, records, options.rowHierarchyType, this.internalProps.columnTree, this.internalProps.rowTree),
154
156
  options.columnTree || (!1 !== options.indicatorsAsCol && (this.dataset.colHeaderTree = (0,
155
157
  layout_helper_1.supplementIndicatorNodesForCustomTree)(this.dataset.colHeaderTree, options.indicators)),
156
- columnDimensionTree = new tree_helper_1.DimensionTree(null !== (_p = this.dataset.colHeaderTree) && void 0 !== _p ? _p : [], this.layoutNodeId)),
158
+ 0 !== (null !== (_q = null === (_p = this.records) || void 0 === _p ? void 0 : _p.length) && void 0 !== _q ? _q : 0) || this.dataset.customColTree || this.dataset.customRowTree || (this.dataset.colHeaderTree = []),
159
+ columnDimensionTree = new tree_helper_1.DimensionTree(null !== (_r = this.dataset.colHeaderTree) && void 0 !== _r ? _r : [], this.layoutNodeId)),
157
160
  options.rowTree || (!1 === options.indicatorsAsCol && (this.dataset.rowHeaderTree = (0,
158
161
  layout_helper_1.supplementIndicatorNodesForCustomTree)(this.dataset.rowHeaderTree, options.indicators)),
159
- rowDimensionTree = new tree_helper_1.DimensionTree(null !== (_q = this.dataset.rowHeaderTree) && void 0 !== _q ? _q : [], this.layoutNodeId, this.options.rowHierarchyType, "tree" === this.options.rowHierarchyType ? null !== (_r = this.options.rowExpandLevel) && void 0 !== _r ? _r : 1 : void 0)),
162
+ 0 !== (null !== (_t = null === (_s = this.records) || void 0 === _s ? void 0 : _s.length) && void 0 !== _t ? _t : 0) || this.dataset.customColTree || this.dataset.customRowTree || (this.dataset.rowHeaderTree = []),
163
+ rowDimensionTree = new tree_helper_1.DimensionTree(null !== (_u = this.dataset.rowHeaderTree) && void 0 !== _u ? _u : [], this.layoutNodeId, this.options.rowHierarchyType, "tree" === this.options.rowHierarchyType ? null !== (_v = this.options.rowExpandLevel) && void 0 !== _v ? _v : 1 : void 0)),
160
164
  internalProps.layoutMap = new pivot_header_layout_1.PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree);
161
165
  }
162
- return this._changePivotSortStateBySortRules(), (null !== (_t = null === (_s = options.pivotSortState) || void 0 === _s ? void 0 : _s.length) && void 0 !== _t ? _t : 0) > 0 && (this.pivotSortState = [],
166
+ return this._changePivotSortStateBySortRules(), (null !== (_x = null === (_w = options.pivotSortState) || void 0 === _w ? void 0 : _w.length) && void 0 !== _x ? _x : 0) > 0 && (this.pivotSortState = [],
163
167
  this.pivotSortState = options.pivotSortState), this.refreshHeader(), internalProps.releaseList && (internalProps.releaseList.forEach((releaseObj => {
164
168
  var _a;
165
169
  return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
@@ -649,7 +653,7 @@ class PivotTable extends BaseTable_1.BaseTable {
649
653
  };
650
654
  }
651
655
  setRecords(records) {
652
- var _a, _b, _c, _d, _e;
656
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
653
657
  const oldHoverState = {
654
658
  col: this.stateManager.hover.cellPos.col,
655
659
  row: this.stateManager.hover.cellPos.row
@@ -665,8 +669,10 @@ class PivotTable extends BaseTable_1.BaseTable {
665
669
  indicatorDimensionKey: internalProps.layoutMap.indicatorDimensionKey
666
670
  }, records)); else {
667
671
  let columnDimensionTree, rowDimensionTree;
668
- this.dataset.setRecords(records), columnDimensionTree = options.columnTree ? internalProps.layoutMap.columnDimensionTree : new tree_helper_1.DimensionTree(null !== (_c = this.dataset.colHeaderTree) && void 0 !== _c ? _c : [], this.layoutNodeId),
669
- rowDimensionTree = options.rowTree ? internalProps.layoutMap.rowDimensionTree : new tree_helper_1.DimensionTree(null !== (_d = this.dataset.rowHeaderTree) && void 0 !== _d ? _d : [], this.layoutNodeId, this.options.rowHierarchyType, "tree" === this.options.rowHierarchyType ? null !== (_e = this.options.rowExpandLevel) && void 0 !== _e ? _e : 1 : void 0),
672
+ this.dataset.setRecords(records), options.columnTree ? columnDimensionTree = internalProps.layoutMap.columnDimensionTree : (0 !== (null !== (_d = null === (_c = this.records) || void 0 === _c ? void 0 : _c.length) && void 0 !== _d ? _d : 0) || this.dataset.customColTree || this.dataset.customRowTree || (this.dataset.colHeaderTree = []),
673
+ columnDimensionTree = new tree_helper_1.DimensionTree(null !== (_e = this.dataset.colHeaderTree) && void 0 !== _e ? _e : [], this.layoutNodeId)),
674
+ options.rowTree ? rowDimensionTree = internalProps.layoutMap.rowDimensionTree : (0 !== (null !== (_g = null === (_f = this.records) || void 0 === _f ? void 0 : _f.length) && void 0 !== _g ? _g : 0) || this.dataset.customColTree || this.dataset.customRowTree || (this.dataset.rowHeaderTree = []),
675
+ rowDimensionTree = new tree_helper_1.DimensionTree(null !== (_h = this.dataset.rowHeaderTree) && void 0 !== _h ? _h : [], this.layoutNodeId, this.options.rowHierarchyType, "tree" === this.options.rowHierarchyType ? null !== (_j = this.options.rowExpandLevel) && void 0 !== _j ? _j : 1 : void 0)),
670
676
  internalProps.layoutMap = new pivot_header_layout_1.PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree),
671
677
  this.pivotSortState = [], options.pivotSortState && (this.pivotSortState = options.pivotSortState);
672
678
  }