@visactor/vtable-calendar 1.22.6 → 1.22.7-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.
@@ -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 => {
@@ -55977,7 +55979,7 @@
55977
55979
  class PluginManager {
55978
55980
  constructor(table, options) {
55979
55981
  var _a;
55980
- this.plugins = new Map(), this.table = table, null === (_a = options.plugins) || void 0 === _a || _a.map(plugin => {
55982
+ this.plugins = new Map(), this.pluginEventMap = new Map(), this.table = table, null === (_a = options.plugins) || void 0 === _a || _a.map(plugin => {
55981
55983
  this.register(plugin), this._bindTableEventForPlugin(plugin);
55982
55984
  });
55983
55985
  }
@@ -55996,23 +55998,30 @@
55996
55998
  _bindTableEventForPlugin(plugin) {
55997
55999
  var _a;
55998
56000
  null === (_a = plugin.runTime) || void 0 === _a || _a.forEach(runTime => {
55999
- this.table.on(runTime, (...args) => {
56001
+ const id = this.table.on(runTime, (...args) => {
56000
56002
  var _a;
56001
56003
  null === (_a = plugin.run) || void 0 === _a || _a.call(plugin, ...args, runTime, this.table);
56002
56004
  });
56005
+ this.pluginEventMap.set(plugin.id, [...(this.pluginEventMap.get(plugin.id) || []), id]);
56003
56006
  });
56004
56007
  }
56005
- updatePlugins(plugins) {
56008
+ removeOrAddPlugins(plugins) {
56006
56009
  Array.from(this.plugins.values()).filter(plugin => !(null == plugins ? void 0 : plugins.some(p => p.id === plugin.id))).forEach(plugin => {
56007
- this.release(), this.plugins.delete(plugin.id);
56008
- }), this.plugins.forEach(plugin => {
56009
- plugin.update && plugin.update();
56010
+ var _a;
56011
+ null === (_a = this.pluginEventMap.get(plugin.id)) || void 0 === _a || _a.forEach(id => {
56012
+ this.table.off(id);
56013
+ }), this.release(), this.plugins.delete(plugin.id);
56010
56014
  });
56011
56015
  const addedPlugins = null == plugins ? void 0 : plugins.filter(plugin => !this.plugins.has(plugin.id));
56012
56016
  null == addedPlugins || addedPlugins.forEach(plugin => {
56013
56017
  this.register(plugin), this._bindTableEventForPlugin(plugin);
56014
56018
  });
56015
56019
  }
56020
+ updatePlugins() {
56021
+ this.plugins.forEach(plugin => {
56022
+ plugin.update && plugin.update();
56023
+ });
56024
+ }
56016
56025
  release() {
56017
56026
  this.plugins.forEach(plugin => {
56018
56027
  var _a;
@@ -56035,7 +56044,7 @@
56035
56044
  }
56036
56045
  constructor(container, options = {}) {
56037
56046
  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;
56038
- if (super(), this.showFrozenIcon = !0, this.version = "1.22.6", 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");
56047
+ if (super(), this.showFrozenIcon = !0, this.version = "1.22.7-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");
56039
56048
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
56040
56049
  options: options,
56041
56050
  container: container
@@ -56651,11 +56660,13 @@
56651
56660
  this.colContentWidthsMap.put(col, width);
56652
56661
  }
56653
56662
  getAllRowsHeight() {
56654
- if (this.internalProps.rowCount <= 0) return 0;
56663
+ var _a;
56664
+ if (!(null === (_a = this.internalProps) || void 0 === _a ? void 0 : _a.rowCount) || this.internalProps.rowCount <= 0) return 0;
56655
56665
  return this.getRowsHeight(0, this.internalProps.rowCount - 1);
56656
56666
  }
56657
56667
  getAllColsWidth() {
56658
- if (this.internalProps.colCount <= 0) return 0;
56668
+ var _a;
56669
+ if (!(null === (_a = this.internalProps) || void 0 === _a ? void 0 : _a.colCount) || this.internalProps.colCount <= 0) return 0;
56659
56670
  return this.getColsWidth(0, this.internalProps.colCount - 1);
56660
56671
  }
56661
56672
  getColsWidths() {
@@ -61467,7 +61478,7 @@
61467
61478
  }) {
61468
61479
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
61469
61480
  const internalProps = this.internalProps;
61470
- 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) : {
61481
+ 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) : {
61471
61482
  addRecordRule: options.addRecordRule
61472
61483
  }, 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--) {
61473
61484
  const releaseObj = internalProps.releaseList[i];
@@ -61483,7 +61494,7 @@
61483
61494
  const EmptyTip = Factory.getComponent("emptyTip");
61484
61495
  this.internalProps.emptyTip = new EmptyTip(this.options.emptyTip, this), null === (_j = this.internalProps.emptyTip) || void 0 === _j || _j.resetVisible();
61485
61496
  }
61486
- return this.pluginManager.updatePlugins(options.plugins), setTimeout(() => {
61497
+ return this.pluginManager.updatePlugins(), setTimeout(() => {
61487
61498
  this.fireListeners(TABLE_EVENT_TYPE.UPDATED, null);
61488
61499
  }, 0), new Promise(resolve => {
61489
61500
  setTimeout(resolve, 0);
@@ -61713,7 +61724,7 @@
61713
61724
  }).map(key => this.stateManager.checkedState.get(key));
61714
61725
  return this.options.groupBy && (stateArr = getGroupCheckboxState(this)), Array.from(stateArr, state => state && state[field]);
61715
61726
  }
61716
- return new Array(...this.stateManager.checkedState.values());
61727
+ return [...this.stateManager.checkedState.values()];
61717
61728
  }
61718
61729
  getCellCheckboxState(col, row) {
61719
61730
  var _a;