@visactor/vtable-calendar 1.22.4-alpha.1 → 1.22.4-alpha.10

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.
@@ -34810,7 +34810,9 @@
34810
34810
  DELETE_RECORD: "delete_record",
34811
34811
  UPDATE_RECORD: "update_record",
34812
34812
  ADD_COLUMN: "add_column",
34813
- DELETE_COLUMN: "delete_column"
34813
+ DELETE_COLUMN: "delete_column",
34814
+ FILTER_MENU_SHOW: "filter_menu_show",
34815
+ FILTER_MENU_HIDE: "filter_menu_hide"
34814
34816
  };
34815
34817
 
34816
34818
  const judgeType = value => {
@@ -55541,7 +55543,7 @@
55541
55543
  class PluginManager {
55542
55544
  constructor(table, options) {
55543
55545
  var _a;
55544
- this.plugins = new Map(), this.table = table, null === (_a = options.plugins) || void 0 === _a || _a.map(plugin => {
55546
+ this.plugins = new Map(), this.pluginEventMap = new Map(), this.table = table, null === (_a = options.plugins) || void 0 === _a || _a.map(plugin => {
55545
55547
  this.register(plugin), this._bindTableEventForPlugin(plugin);
55546
55548
  });
55547
55549
  }
@@ -55560,23 +55562,30 @@
55560
55562
  _bindTableEventForPlugin(plugin) {
55561
55563
  var _a;
55562
55564
  null === (_a = plugin.runTime) || void 0 === _a || _a.forEach(runTime => {
55563
- this.table.on(runTime, (...args) => {
55565
+ const id = this.table.on(runTime, (...args) => {
55564
55566
  var _a;
55565
55567
  null === (_a = plugin.run) || void 0 === _a || _a.call(plugin, ...args, runTime, this.table);
55566
55568
  });
55569
+ this.pluginEventMap.set(plugin.id, [...(this.pluginEventMap.get(plugin.id) || []), id]);
55567
55570
  });
55568
55571
  }
55569
- updatePlugins(plugins) {
55572
+ removeOrAddPlugins(plugins) {
55570
55573
  Array.from(this.plugins.values()).filter(plugin => !(null == plugins ? void 0 : plugins.some(p => p.id === plugin.id))).forEach(plugin => {
55571
- this.release(), this.plugins.delete(plugin.id);
55572
- }), this.plugins.forEach(plugin => {
55573
- plugin.update && plugin.update();
55574
+ var _a;
55575
+ null === (_a = this.pluginEventMap.get(plugin.id)) || void 0 === _a || _a.forEach(id => {
55576
+ this.table.off(id);
55577
+ }), this.release(), this.plugins.delete(plugin.id);
55574
55578
  });
55575
55579
  const addedPlugins = null == plugins ? void 0 : plugins.filter(plugin => !this.plugins.has(plugin.id));
55576
55580
  null == addedPlugins || addedPlugins.forEach(plugin => {
55577
55581
  this.register(plugin), this._bindTableEventForPlugin(plugin);
55578
55582
  });
55579
55583
  }
55584
+ updatePlugins() {
55585
+ this.plugins.forEach(plugin => {
55586
+ plugin.update && plugin.update();
55587
+ });
55588
+ }
55580
55589
  release() {
55581
55590
  this.plugins.forEach(plugin => {
55582
55591
  var _a;
@@ -55599,7 +55608,7 @@
55599
55608
  }
55600
55609
  constructor(container, options = {}) {
55601
55610
  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;
55602
- if (super(), this.showFrozenIcon = !0, this.version = "1.22.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");
55611
+ if (super(), this.showFrozenIcon = !0, this.version = "1.22.4-alpha.10", 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");
55603
55612
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
55604
55613
  options: options,
55605
55614
  container: container
@@ -61028,7 +61037,7 @@
61028
61037
  }) {
61029
61038
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
61030
61039
  const internalProps = this.internalProps;
61031
- 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) : {
61040
+ 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) : {
61032
61041
  addRecordRule: options.addRecordRule
61033
61042
  }, 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--) {
61034
61043
  const releaseObj = internalProps.releaseList[i];
@@ -61044,7 +61053,7 @@
61044
61053
  const EmptyTip = Factory.getComponent("emptyTip");
61045
61054
  this.internalProps.emptyTip = new EmptyTip(this.options.emptyTip, this), null === (_j = this.internalProps.emptyTip) || void 0 === _j || _j.resetVisible();
61046
61055
  }
61047
- return this.pluginManager.updatePlugins(options.plugins), setTimeout(() => {
61056
+ return this.pluginManager.updatePlugins(), setTimeout(() => {
61048
61057
  this.fireListeners(TABLE_EVENT_TYPE.UPDATED, null);
61049
61058
  }, 0), new Promise(resolve => {
61050
61059
  setTimeout(resolve, 0);
@@ -61274,7 +61283,7 @@
61274
61283
  }).map(key => this.stateManager.checkedState.get(key));
61275
61284
  return this.options.groupBy && (stateArr = getGroupCheckboxState(this)), Array.from(stateArr, state => state && state[field]);
61276
61285
  }
61277
- return new Array(...this.stateManager.checkedState.values());
61286
+ return [...this.stateManager.checkedState.values()];
61278
61287
  }
61279
61288
  getCellCheckboxState(col, row) {
61280
61289
  var _a;