@visactor/vtable-calendar 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.
@@ -34932,7 +34932,9 @@
34932
34932
  DELETE_RECORD: "delete_record",
34933
34933
  UPDATE_RECORD: "update_record",
34934
34934
  ADD_COLUMN: "add_column",
34935
- DELETE_COLUMN: "delete_column"
34935
+ DELETE_COLUMN: "delete_column",
34936
+ FILTER_MENU_SHOW: "filter_menu_show",
34937
+ FILTER_MENU_HIDE: "filter_menu_hide"
34936
34938
  };
34937
34939
 
34938
34940
  const judgeType = value => {
@@ -37236,9 +37238,9 @@
37236
37238
  length: this._sourceLength
37237
37239
  }, (_, i) => i), "tree" === this.rowHierarchyType && this.initTreeHierarchyState(), this.userPagination || (this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength);
37238
37240
  }
37239
- updateFilterRules(filterRules) {
37241
+ updateFilterRules(filterRules, onFilterRecordsEnd) {
37240
37242
  var _a, _b, _c;
37241
- 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({
37243
+ 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({
37242
37244
  length: this._sourceLength
37243
37245
  }, (_, i) => i), this.userPagination || (this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength, "tree" === this.rowHierarchyType && this.initTreeHierarchyState()), this.updatePagerData();
37244
37246
  }
@@ -51638,13 +51640,14 @@
51638
51640
  }), oldHorizontalBarPos !== this.scroll.horizontalBarPos && this.checkHorizontalScrollBarEnd();
51639
51641
  }
51640
51642
  setScrollTop(top, event, triggerEvent = !0) {
51641
- var _a, _b, _c, _d, _e, _f, _g;
51643
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
51644
+ if (!this.table || !this.table.scenegraph) return;
51642
51645
  const totalHeight = this.table.getAllRowsHeight(),
51643
51646
  sizeTolerance = (null === (_a = this.table.options.customConfig) || void 0 === _a ? void 0 : _a._disableColumnAndRowSizeRound) ? 1 : 0;
51644
- top = Math.max(0, Math.min(top, totalHeight - this.table.scenegraph.height - sizeTolerance)), top = Math.ceil(top);
51647
+ 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);
51645
51648
  const oldVerticalBarPos = this.scroll.verticalBarPos,
51646
- yRatio = top / (totalHeight - this.table.scenegraph.height);
51647
- 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) {
51649
+ yRatio = top / (totalHeight - (null !== (_e = null === (_d = this.table.scenegraph) || void 0 === _d ? void 0 : _d.height) && void 0 !== _e ? _e : 0));
51650
+ 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) {
51648
51651
  let verticalBarPos = top;
51649
51652
  isValid$3(verticalBarPos) && !isNaN(verticalBarPos) || (verticalBarPos = 0);
51650
51653
  const dy = verticalBarPos - oldVerticalBarPos;
@@ -51652,15 +51655,15 @@
51652
51655
  event: null == event ? void 0 : event.nativeEvent,
51653
51656
  scrollTop: verticalBarPos,
51654
51657
  scrollLeft: this.scroll.horizontalBarPos,
51655
- scrollHeight: null === (_d = this.table.theme.scrollStyle) || void 0 === _d ? void 0 : _d.width,
51656
- scrollWidth: null === (_e = this.table.theme.scrollStyle) || void 0 === _e ? void 0 : _e.width,
51658
+ scrollHeight: null === (_h = this.table.theme.scrollStyle) || void 0 === _h ? void 0 : _h.width,
51659
+ scrollWidth: null === (_j = this.table.theme.scrollStyle) || void 0 === _j ? void 0 : _j.width,
51657
51660
  viewHeight: this.table.tableNoFrameHeight,
51658
51661
  viewWidth: this.table.tableNoFrameWidth,
51659
51662
  scrollDirection: "vertical",
51660
51663
  scrollRatioY: yRatio,
51661
51664
  dy: dy
51662
51665
  }).some(value => !1 === value)) {
51663
- const yRatio = this.scroll.verticalBarPos / (totalHeight - this.table.scenegraph.height);
51666
+ 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));
51664
51667
  return void this.table.scenegraph.component.updateVerticalScrollBarPos(yRatio);
51665
51668
  }
51666
51669
  }
@@ -51670,8 +51673,8 @@
51670
51673
  event: null == event ? void 0 : event.nativeEvent,
51671
51674
  scrollTop: this.scroll.verticalBarPos,
51672
51675
  scrollLeft: this.scroll.horizontalBarPos,
51673
- scrollHeight: null === (_f = this.table.theme.scrollStyle) || void 0 === _f ? void 0 : _f.width,
51674
- scrollWidth: null === (_g = this.table.theme.scrollStyle) || void 0 === _g ? void 0 : _g.width,
51676
+ scrollHeight: null === (_m = this.table.theme.scrollStyle) || void 0 === _m ? void 0 : _m.width,
51677
+ scrollWidth: null === (_o = this.table.theme.scrollStyle) || void 0 === _o ? void 0 : _o.width,
51675
51678
  viewHeight: this.table.tableNoFrameHeight,
51676
51679
  viewWidth: this.table.tableNoFrameWidth,
51677
51680
  scrollDirection: "vertical",
@@ -51681,6 +51684,7 @@
51681
51684
  }
51682
51685
  setScrollLeft(left, event, triggerEvent = !0) {
51683
51686
  var _a, _b, _c, _d, _e, _f, _g;
51687
+ if (!this.table || !this.table.scenegraph) return;
51684
51688
  this.table.scrollLeft;
51685
51689
  const totalWidth = this.table.getAllColsWidth(),
51686
51690
  sizeTolerance = (this.table.getFrozenColsWidth(), (null === (_a = this.table.options.customConfig) || void 0 === _a ? void 0 : _a._disableColumnAndRowSizeRound) ? 1 : 0);
@@ -56014,7 +56018,7 @@
56014
56018
  class PluginManager {
56015
56019
  constructor(table, options) {
56016
56020
  var _a;
56017
- this.plugins = new Map(), this.table = table, null === (_a = options.plugins) || void 0 === _a || _a.map(plugin => {
56021
+ this.plugins = new Map(), this.pluginEventMap = new Map(), this.table = table, null === (_a = options.plugins) || void 0 === _a || _a.map(plugin => {
56018
56022
  this.register(plugin), this._bindTableEventForPlugin(plugin);
56019
56023
  });
56020
56024
  }
@@ -56033,23 +56037,30 @@
56033
56037
  _bindTableEventForPlugin(plugin) {
56034
56038
  var _a;
56035
56039
  null === (_a = plugin.runTime) || void 0 === _a || _a.forEach(runTime => {
56036
- this.table.on(runTime, (...args) => {
56040
+ const id = this.table.on(runTime, (...args) => {
56037
56041
  var _a;
56038
56042
  null === (_a = plugin.run) || void 0 === _a || _a.call(plugin, ...args, runTime, this.table);
56039
56043
  });
56044
+ this.pluginEventMap.set(plugin.id, [...(this.pluginEventMap.get(plugin.id) || []), id]);
56040
56045
  });
56041
56046
  }
56042
- updatePlugins(plugins) {
56047
+ removeOrAddPlugins(plugins) {
56043
56048
  Array.from(this.plugins.values()).filter(plugin => !(null == plugins ? void 0 : plugins.some(p => p.id === plugin.id))).forEach(plugin => {
56044
- this.release(), this.plugins.delete(plugin.id);
56045
- }), this.plugins.forEach(plugin => {
56046
- plugin.update && plugin.update();
56049
+ var _a;
56050
+ null === (_a = this.pluginEventMap.get(plugin.id)) || void 0 === _a || _a.forEach(id => {
56051
+ this.table.off(id);
56052
+ }), this.release(), this.plugins.delete(plugin.id);
56047
56053
  });
56048
56054
  const addedPlugins = null == plugins ? void 0 : plugins.filter(plugin => !this.plugins.has(plugin.id));
56049
56055
  null == addedPlugins || addedPlugins.forEach(plugin => {
56050
56056
  this.register(plugin), this._bindTableEventForPlugin(plugin);
56051
56057
  });
56052
56058
  }
56059
+ updatePlugins(plugins) {
56060
+ null == plugins || plugins.forEach(plugin => {
56061
+ plugin.update && plugin.update();
56062
+ });
56063
+ }
56053
56064
  release() {
56054
56065
  this.plugins.forEach(plugin => {
56055
56066
  var _a;
@@ -56072,7 +56083,7 @@
56072
56083
  }
56073
56084
  constructor(container, options = {}) {
56074
56085
  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;
56075
- 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");
56086
+ 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");
56076
56087
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
56077
56088
  options: options,
56078
56089
  container: container
@@ -56688,11 +56699,13 @@
56688
56699
  this.colContentWidthsMap.put(col, width);
56689
56700
  }
56690
56701
  getAllRowsHeight() {
56691
- if (this.internalProps.rowCount <= 0) return 0;
56702
+ var _a;
56703
+ if (!(null === (_a = this.internalProps) || void 0 === _a ? void 0 : _a.rowCount) || this.internalProps.rowCount <= 0) return 0;
56692
56704
  return this.getRowsHeight(0, this.internalProps.rowCount - 1);
56693
56705
  }
56694
56706
  getAllColsWidth() {
56695
- if (this.internalProps.colCount <= 0) return 0;
56707
+ var _a;
56708
+ if (!(null === (_a = this.internalProps) || void 0 === _a ? void 0 : _a.colCount) || this.internalProps.colCount <= 0) return 0;
56696
56709
  return this.getColsWidth(0, this.internalProps.colCount - 1);
56697
56710
  }
56698
56711
  getColsWidths() {
@@ -61504,7 +61517,7 @@
61504
61517
  }) {
61505
61518
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
61506
61519
  const internalProps = this.internalProps;
61507
- 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) : {
61520
+ 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) : {
61508
61521
  addRecordRule: options.addRecordRule
61509
61522
  }, 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--) {
61510
61523
  const releaseObj = internalProps.releaseList[i];
@@ -61729,7 +61742,8 @@
61729
61742
  updateFilterRules(filterRules, options = {
61730
61743
  clearRowHeightCache: !0
61731
61744
  }) {
61732
- 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();
61745
+ var _a;
61746
+ 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();
61733
61747
  }
61734
61748
  getFilteredRecords() {
61735
61749
  return this.dataSource.records;
@@ -61750,7 +61764,7 @@
61750
61764
  }).map(key => this.stateManager.checkedState.get(key));
61751
61765
  return this.options.groupBy && (stateArr = getGroupCheckboxState(this)), Array.from(stateArr, state => state && state[field]);
61752
61766
  }
61753
- return new Array(...this.stateManager.checkedState.values());
61767
+ return [...this.stateManager.checkedState.values()];
61754
61768
  }
61755
61769
  getCellCheckboxState(col, row) {
61756
61770
  var _a;