@visactor/vtable-gantt 1.22.7 → 1.22.8-alpha.13

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.22.7";
9
+ export declare const version = "1.22.8-alpha.13";
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.22.7";
59
+ exports.plugins = plugins, exports.version = "1.22.8-alpha.13";
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.22.7\";\n/**\n * @namespace VTableGantt\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,iBAAiB,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.22.8-alpha.13\";\n/**\n * @namespace VTableGantt\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"]}
@@ -38768,7 +38768,9 @@
38768
38768
  DELETE_RECORD: "delete_record",
38769
38769
  UPDATE_RECORD: "update_record",
38770
38770
  ADD_COLUMN: "add_column",
38771
- DELETE_COLUMN: "delete_column"
38771
+ DELETE_COLUMN: "delete_column",
38772
+ FILTER_MENU_SHOW: "filter_menu_show",
38773
+ FILTER_MENU_HIDE: "filter_menu_hide"
38772
38774
  };
38773
38775
 
38774
38776
  const judgeType$1 = value => {
@@ -41086,9 +41088,9 @@
41086
41088
  length: this._sourceLength
41087
41089
  }, (_, i) => i), "tree" === this.rowHierarchyType && this.initTreeHierarchyState(), this.userPagination || (this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength);
41088
41090
  }
41089
- updateFilterRules(filterRules) {
41091
+ updateFilterRules(filterRules, onFilterRecordsEnd) {
41090
41092
  var _a, _b, _c;
41091
- this.lastFilterRules = this.dataConfig.filterRules, this.dataConfig.filterRules = filterRules, this._source = this.processRecords(null !== (_b = null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.records) && void 0 !== _b ? _b : this.dataSourceObj), this._sourceLength = (null === (_c = this._source) || void 0 === _c ? void 0 : _c.length) || 0, this.currentIndexedData = Array.from({
41093
+ this.lastFilterRules = this.dataConfig.filterRules, this.dataConfig.filterRules = filterRules, this._source = this.processRecords(null !== (_b = null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.records) && void 0 !== _b ? _b : this.dataSourceObj), onFilterRecordsEnd && onFilterRecordsEnd(this._source), this._sourceLength = (null === (_c = this._source) || void 0 === _c ? void 0 : _c.length) || 0, this.currentIndexedData = Array.from({
41092
41094
  length: this._sourceLength
41093
41095
  }, (_, i) => i), this.userPagination || (this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength, "tree" === this.rowHierarchyType && this.initTreeHierarchyState()), this.updatePagerData();
41094
41096
  }
@@ -55488,13 +55490,14 @@
55488
55490
  }), oldHorizontalBarPos !== this.scroll.horizontalBarPos && this.checkHorizontalScrollBarEnd();
55489
55491
  }
55490
55492
  setScrollTop(top, event, triggerEvent = !0) {
55491
- var _a, _b, _c, _d, _e, _f, _g;
55493
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
55494
+ if (!this.table || !this.table.scenegraph) return;
55492
55495
  const totalHeight = this.table.getAllRowsHeight(),
55493
55496
  sizeTolerance = (null === (_a = this.table.options.customConfig) || void 0 === _a ? void 0 : _a._disableColumnAndRowSizeRound) ? 1 : 0;
55494
- top = Math.max(0, Math.min(top, totalHeight - this.table.scenegraph.height - sizeTolerance)), top = Math.ceil(top);
55497
+ top = Math.max(0, Math.min(top, totalHeight - (null !== (_c = null === (_b = this.table.scenegraph) || void 0 === _b ? void 0 : _b.height) && void 0 !== _c ? _c : 0) - sizeTolerance)), top = Math.ceil(top);
55495
55498
  const oldVerticalBarPos = this.scroll.verticalBarPos,
55496
- yRatio = top / (totalHeight - this.table.scenegraph.height);
55497
- if ((oldVerticalBarPos !== top || !0 === (null === (_c = null === (_b = this.table.options) || void 0 === _b ? void 0 : _b.customConfig) || void 0 === _c ? void 0 : _c.scrollEventAlwaysTrigger)) && triggerEvent) {
55499
+ yRatio = top / (totalHeight - (null !== (_e = null === (_d = this.table.scenegraph) || void 0 === _d ? void 0 : _d.height) && void 0 !== _e ? _e : 0));
55500
+ if ((oldVerticalBarPos !== top || !0 === (null === (_g = null === (_f = this.table.options) || void 0 === _f ? void 0 : _f.customConfig) || void 0 === _g ? void 0 : _g.scrollEventAlwaysTrigger)) && triggerEvent) {
55498
55501
  let verticalBarPos = top;
55499
55502
  isValid$3(verticalBarPos) && !isNaN(verticalBarPos) || (verticalBarPos = 0);
55500
55503
  const dy = verticalBarPos - oldVerticalBarPos;
@@ -55502,15 +55505,15 @@
55502
55505
  event: null == event ? void 0 : event.nativeEvent,
55503
55506
  scrollTop: verticalBarPos,
55504
55507
  scrollLeft: this.scroll.horizontalBarPos,
55505
- scrollHeight: null === (_d = this.table.theme.scrollStyle) || void 0 === _d ? void 0 : _d.width,
55506
- scrollWidth: null === (_e = this.table.theme.scrollStyle) || void 0 === _e ? void 0 : _e.width,
55508
+ scrollHeight: null === (_h = this.table.theme.scrollStyle) || void 0 === _h ? void 0 : _h.width,
55509
+ scrollWidth: null === (_j = this.table.theme.scrollStyle) || void 0 === _j ? void 0 : _j.width,
55507
55510
  viewHeight: this.table.tableNoFrameHeight,
55508
55511
  viewWidth: this.table.tableNoFrameWidth,
55509
55512
  scrollDirection: "vertical",
55510
55513
  scrollRatioY: yRatio,
55511
55514
  dy: dy
55512
55515
  }).some(value => !1 === value)) {
55513
- const yRatio = this.scroll.verticalBarPos / (totalHeight - this.table.scenegraph.height);
55516
+ const yRatio = this.scroll.verticalBarPos / (totalHeight - (null !== (_l = null === (_k = this.table.scenegraph) || void 0 === _k ? void 0 : _k.height) && void 0 !== _l ? _l : 0));
55514
55517
  return void this.table.scenegraph.component.updateVerticalScrollBarPos(yRatio);
55515
55518
  }
55516
55519
  }
@@ -55520,8 +55523,8 @@
55520
55523
  event: null == event ? void 0 : event.nativeEvent,
55521
55524
  scrollTop: this.scroll.verticalBarPos,
55522
55525
  scrollLeft: this.scroll.horizontalBarPos,
55523
- scrollHeight: null === (_f = this.table.theme.scrollStyle) || void 0 === _f ? void 0 : _f.width,
55524
- scrollWidth: null === (_g = this.table.theme.scrollStyle) || void 0 === _g ? void 0 : _g.width,
55526
+ scrollHeight: null === (_m = this.table.theme.scrollStyle) || void 0 === _m ? void 0 : _m.width,
55527
+ scrollWidth: null === (_o = this.table.theme.scrollStyle) || void 0 === _o ? void 0 : _o.width,
55525
55528
  viewHeight: this.table.tableNoFrameHeight,
55526
55529
  viewWidth: this.table.tableNoFrameWidth,
55527
55530
  scrollDirection: "vertical",
@@ -55531,6 +55534,7 @@
55531
55534
  }
55532
55535
  setScrollLeft(left, event, triggerEvent = !0) {
55533
55536
  var _a, _b, _c, _d, _e, _f, _g;
55537
+ if (!this.table || !this.table.scenegraph) return;
55534
55538
  this.table.scrollLeft;
55535
55539
  const totalWidth = this.table.getAllColsWidth(),
55536
55540
  sizeTolerance = (this.table.getFrozenColsWidth(), (null === (_a = this.table.options.customConfig) || void 0 === _a ? void 0 : _a._disableColumnAndRowSizeRound) ? 1 : 0);
@@ -59864,7 +59868,7 @@
59864
59868
  let PluginManager$1 = class PluginManager {
59865
59869
  constructor(table, options) {
59866
59870
  var _a;
59867
- this.plugins = new Map(), this.table = table, null === (_a = options.plugins) || void 0 === _a || _a.map(plugin => {
59871
+ this.plugins = new Map(), this.pluginEventMap = new Map(), this.table = table, null === (_a = options.plugins) || void 0 === _a || _a.map(plugin => {
59868
59872
  this.register(plugin), this._bindTableEventForPlugin(plugin);
59869
59873
  });
59870
59874
  }
@@ -59883,23 +59887,30 @@
59883
59887
  _bindTableEventForPlugin(plugin) {
59884
59888
  var _a;
59885
59889
  null === (_a = plugin.runTime) || void 0 === _a || _a.forEach(runTime => {
59886
- this.table.on(runTime, (...args) => {
59890
+ const id = this.table.on(runTime, (...args) => {
59887
59891
  var _a;
59888
59892
  null === (_a = plugin.run) || void 0 === _a || _a.call(plugin, ...args, runTime, this.table);
59889
59893
  });
59894
+ this.pluginEventMap.set(plugin.id, [...(this.pluginEventMap.get(plugin.id) || []), id]);
59890
59895
  });
59891
59896
  }
59892
- updatePlugins(plugins) {
59897
+ removeOrAddPlugins(plugins) {
59893
59898
  Array.from(this.plugins.values()).filter(plugin => !(null == plugins ? void 0 : plugins.some(p => p.id === plugin.id))).forEach(plugin => {
59894
- this.release(), this.plugins.delete(plugin.id);
59895
- }), this.plugins.forEach(plugin => {
59896
- plugin.update && plugin.update();
59899
+ var _a;
59900
+ null === (_a = this.pluginEventMap.get(plugin.id)) || void 0 === _a || _a.forEach(id => {
59901
+ this.table.off(id);
59902
+ }), this.release(), this.plugins.delete(plugin.id);
59897
59903
  });
59898
59904
  const addedPlugins = null == plugins ? void 0 : plugins.filter(plugin => !this.plugins.has(plugin.id));
59899
59905
  null == addedPlugins || addedPlugins.forEach(plugin => {
59900
59906
  this.register(plugin), this._bindTableEventForPlugin(plugin);
59901
59907
  });
59902
59908
  }
59909
+ updatePlugins(plugins) {
59910
+ null == plugins || plugins.forEach(plugin => {
59911
+ plugin.update && plugin.update();
59912
+ });
59913
+ }
59903
59914
  release() {
59904
59915
  this.plugins.forEach(plugin => {
59905
59916
  var _a;
@@ -59922,7 +59933,7 @@
59922
59933
  }
59923
59934
  constructor(container, options = {}) {
59924
59935
  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;
59925
- if (super(), this.showFrozenIcon = !0, this.version = "1.22.7", 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");
59936
+ if (super(), this.showFrozenIcon = !0, this.version = "1.22.8-alpha.13", 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");
59926
59937
  this.pluginManager = new PluginManager$1(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
59927
59938
  options: options,
59928
59939
  container: container
@@ -60538,11 +60549,13 @@
60538
60549
  this.colContentWidthsMap.put(col, width);
60539
60550
  }
60540
60551
  getAllRowsHeight() {
60541
- if (this.internalProps.rowCount <= 0) return 0;
60552
+ var _a;
60553
+ if (!(null === (_a = this.internalProps) || void 0 === _a ? void 0 : _a.rowCount) || this.internalProps.rowCount <= 0) return 0;
60542
60554
  return this.getRowsHeight(0, this.internalProps.rowCount - 1);
60543
60555
  }
60544
60556
  getAllColsWidth() {
60545
- if (this.internalProps.colCount <= 0) return 0;
60557
+ var _a;
60558
+ if (!(null === (_a = this.internalProps) || void 0 === _a ? void 0 : _a.colCount) || this.internalProps.colCount <= 0) return 0;
60546
60559
  return this.getColsWidth(0, this.internalProps.colCount - 1);
60547
60560
  }
60548
60561
  getColsWidths() {
@@ -65390,7 +65403,7 @@
65390
65403
  }) {
65391
65404
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
65392
65405
  const internalProps = this.internalProps;
65393
- if (super.updateOption(options, updateConfig), internalProps.frozenColDragHeaderMode = null !== (_b = null === (_a = options.dragOrder) || void 0 === _a ? void 0 : _a.frozenColDragHeaderMode) && void 0 !== _b ? _b : options.frozenColDragHeaderMode, this.pagination = options.pagination, internalProps.sortState = options.sortState, internalProps.dataConfig = this.internalProps.groupBy ? getGroupByDataConfig(this.internalProps.groupBy, options.addRecordRule) : {
65406
+ if (this.pluginManager.removeOrAddPlugins(options.plugins), super.updateOption(options, updateConfig), internalProps.frozenColDragHeaderMode = null !== (_b = null === (_a = options.dragOrder) || void 0 === _a ? void 0 : _a.frozenColDragHeaderMode) && void 0 !== _b ? _b : options.frozenColDragHeaderMode, this.pagination = options.pagination, internalProps.sortState = options.sortState, internalProps.dataConfig = this.internalProps.groupBy ? getGroupByDataConfig(this.internalProps.groupBy, options.addRecordRule) : {
65394
65407
  addRecordRule: options.addRecordRule
65395
65408
  }, this.showHeader = null === (_c = options.showHeader) || void 0 === _c || _c, internalProps.columns = options.columns ? cloneDeepSpec(options.columns, ["children"]) : options.header ? cloneDeepSpec(options.header, ["children"]) : [], generateAggregationForColumn(this), internalProps.enableTreeNodeMerge = null !== (_e = null !== (_d = options.enableTreeNodeMerge) && void 0 !== _d ? _d : isValid$3(this.internalProps.groupBy)) && void 0 !== _e && _e, this.internalProps.headerHelper.setTableColumnsEditor(), this.transpose = null !== (_f = options.transpose) && void 0 !== _f && _f, this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1, this.internalProps.columnWidthConfig = options.columnWidthConfig, this.internalProps.rowHeightConfig = options.rowHeightConfig, internalProps.releaseList) for (let i = internalProps.releaseList.length - 1; i >= 0; i--) {
65396
65409
  const releaseObj = internalProps.releaseList[i];
@@ -65615,7 +65628,8 @@
65615
65628
  updateFilterRules(filterRules, options = {
65616
65629
  clearRowHeightCache: !0
65617
65630
  }) {
65618
- this.scenegraph.clearCells(), this.sortState ? (this.dataSource.updateFilterRulesForSorted(filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(filterRules), this.refreshRowColCount(), this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(!(null == options ? void 0 : options.clearRowHeightCache)), this.resize();
65631
+ var _a;
65632
+ this.scenegraph.clearCells(), this.sortState ? (this.dataSource.updateFilterRulesForSorted(filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(filterRules, null == options ? void 0 : options.onFilterRecordsEnd), this.refreshRowColCount(), this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(!(null == options ? void 0 : options.clearRowHeightCache)), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), this.resize();
65619
65633
  }
65620
65634
  getFilteredRecords() {
65621
65635
  return this.dataSource.records;
@@ -65636,7 +65650,7 @@
65636
65650
  }).map(key => this.stateManager.checkedState.get(key));
65637
65651
  return this.options.groupBy && (stateArr = getGroupCheckboxState(this)), Array.from(stateArr, state => state && state[field]);
65638
65652
  }
65639
- return new Array(...this.stateManager.checkedState.values());
65653
+ return [...this.stateManager.checkedState.values()];
65640
65654
  }
65641
65655
  getCellCheckboxState(col, row) {
65642
65656
  var _a;
@@ -77849,7 +77863,7 @@
77849
77863
  PluginManager: PluginManager
77850
77864
  });
77851
77865
 
77852
- const version = "1.22.7";
77866
+ const version = "1.22.8-alpha.13";
77853
77867
 
77854
77868
  exports.Gantt = Gantt;
77855
77869
  exports.TYPES = index$4;