@visactor/vtable-sheet 1.22.4-alpha.4 → 1.22.4-alpha.6

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
@@ -2,5 +2,5 @@ import VTableSheet from './components/vtable-sheet';
2
2
  import type { ISheetDefine, IVTableSheetOptions } from './ts-types';
3
3
  import * as TYPES from './ts-types';
4
4
  import * as VTable from './vtable';
5
- export declare const version = "1.22.4-alpha.4";
5
+ export declare const version = "1.22.4-alpha.6";
6
6
  export { VTableSheet, TYPES, VTable, ISheetDefine, IVTableSheetOptions };
package/cjs/index.js CHANGED
@@ -47,4 +47,4 @@ exports.VTable = VTable;
47
47
 
48
48
  const style_manager_1 = require("./styles/style-manager");
49
49
 
50
- exports.version = "1.22.4-alpha.4", (0, style_manager_1.importStyles)();
50
+ exports.version = "1.22.4-alpha.6", (0, style_manager_1.importStyles)();
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6EAAoD;AAW3C,sBAXF,sBAAW,CAWE;AATpB,kDAAoC;AASd,sBAAK;AAR3B,iDAAmC;AAQN,wBAAM;AAPnC,0DAAsD;AACzC,QAAA,OAAO,GAAG,gBAAgB,CAAC;AAExC,IAAA,4BAAY,GAAE,CAAC","file":"index.js","sourcesContent":["import VTableSheet from './components/vtable-sheet';\nimport type { ISheetDefine, IVTableSheetOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport * as VTable from './vtable';\nimport { importStyles } from './styles/style-manager';\nexport const version = \"1.22.4-alpha.4\";\n// 导入样式\nimportStyles();\n/**\n * @namespace VTableSheet\n */\nexport { VTableSheet, TYPES, VTable, ISheetDefine, IVTableSheetOptions };\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6EAAoD;AAW3C,sBAXF,sBAAW,CAWE;AATpB,kDAAoC;AASd,sBAAK;AAR3B,iDAAmC;AAQN,wBAAM;AAPnC,0DAAsD;AACzC,QAAA,OAAO,GAAG,gBAAgB,CAAC;AAExC,IAAA,4BAAY,GAAE,CAAC","file":"index.js","sourcesContent":["import VTableSheet from './components/vtable-sheet';\nimport type { ISheetDefine, IVTableSheetOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport * as VTable from './vtable';\nimport { importStyles } from './styles/style-manager';\nexport const version = \"1.22.4-alpha.6\";\n// 导入样式\nimportStyles();\n/**\n * @namespace VTableSheet\n */\nexport { VTableSheet, TYPES, VTable, ISheetDefine, IVTableSheetOptions };\n"]}
@@ -38507,7 +38507,9 @@
38507
38507
  DELETE_RECORD: "delete_record",
38508
38508
  UPDATE_RECORD: "update_record",
38509
38509
  ADD_COLUMN: "add_column",
38510
- DELETE_COLUMN: "delete_column"
38510
+ DELETE_COLUMN: "delete_column",
38511
+ FILTER_MENU_SHOW: "filter_menu_show",
38512
+ FILTER_MENU_HIDE: "filter_menu_hide"
38511
38513
  };
38512
38514
 
38513
38515
  const judgeType = value => {
@@ -59252,7 +59254,7 @@
59252
59254
  class PluginManager {
59253
59255
  constructor(table, options) {
59254
59256
  var _a;
59255
- this.plugins = new Map(), this.table = table, null === (_a = options.plugins) || void 0 === _a || _a.map(plugin => {
59257
+ this.plugins = new Map(), this.pluginEventMap = new Map(), this.table = table, null === (_a = options.plugins) || void 0 === _a || _a.map(plugin => {
59256
59258
  this.register(plugin), this._bindTableEventForPlugin(plugin);
59257
59259
  });
59258
59260
  }
@@ -59271,15 +59273,19 @@
59271
59273
  _bindTableEventForPlugin(plugin) {
59272
59274
  var _a;
59273
59275
  null === (_a = plugin.runTime) || void 0 === _a || _a.forEach(runTime => {
59274
- this.table.on(runTime, (...args) => {
59276
+ const id = this.table.on(runTime, (...args) => {
59275
59277
  var _a;
59276
59278
  null === (_a = plugin.run) || void 0 === _a || _a.call(plugin, ...args, runTime, this.table);
59277
59279
  });
59280
+ this.pluginEventMap.set(plugin.id, [...(this.pluginEventMap.get(plugin.id) || []), id]);
59278
59281
  });
59279
59282
  }
59280
59283
  updatePlugins(plugins) {
59281
59284
  Array.from(this.plugins.values()).filter(plugin => !(null == plugins ? void 0 : plugins.some(p => p.id === plugin.id))).forEach(plugin => {
59282
- this.release(), this.plugins.delete(plugin.id);
59285
+ var _a;
59286
+ null === (_a = this.pluginEventMap.get(plugin.id)) || void 0 === _a || _a.forEach(id => {
59287
+ this.table.off(id);
59288
+ }), this.release(), this.plugins.delete(plugin.id);
59283
59289
  }), this.plugins.forEach(plugin => {
59284
59290
  plugin.update && plugin.update();
59285
59291
  });
@@ -59310,7 +59316,7 @@
59310
59316
  }
59311
59317
  constructor(container, options = {}) {
59312
59318
  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;
59313
- if (super(), this.showFrozenIcon = !0, this.version = "1.22.4-alpha.4", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env$1.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");
59319
+ if (super(), this.showFrozenIcon = !0, this.version = "1.22.4-alpha.6", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env$1.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");
59314
59320
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
59315
59321
  options: options,
59316
59322
  container: container
@@ -64775,7 +64781,7 @@
64775
64781
  }) {
64776
64782
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
64777
64783
  const internalProps = this.internalProps;
64778
- 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) : {
64784
+ if (this.pluginManager.updatePlugins(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) : {
64779
64785
  addRecordRule: options.addRecordRule
64780
64786
  }, 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$4(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--) {
64781
64787
  const releaseObj = internalProps.releaseList[i];
@@ -64791,7 +64797,7 @@
64791
64797
  const EmptyTip = Factory.getComponent("emptyTip");
64792
64798
  this.internalProps.emptyTip = new EmptyTip(this.options.emptyTip, this), null === (_j = this.internalProps.emptyTip) || void 0 === _j || _j.resetVisible();
64793
64799
  }
64794
- return this.pluginManager.updatePlugins(options.plugins), setTimeout(() => {
64800
+ return setTimeout(() => {
64795
64801
  this.fireListeners(TABLE_EVENT_TYPE.UPDATED, null);
64796
64802
  }, 0), new Promise(resolve => {
64797
64803
  setTimeout(resolve, 0);
@@ -65021,7 +65027,7 @@
65021
65027
  }).map(key => this.stateManager.checkedState.get(key));
65022
65028
  return this.options.groupBy && (stateArr = getGroupCheckboxState(this)), Array.from(stateArr, state => state && state[field]);
65023
65029
  }
65024
- return new Array(...this.stateManager.checkedState.values());
65030
+ return [...this.stateManager.checkedState.values()];
65025
65031
  }
65026
65032
  getCellCheckboxState(col, row) {
65027
65033
  var _a;
@@ -72288,15 +72294,15 @@
72288
72294
  this.getActiveFilterFields().length > 0 && this.applyFilters();
72289
72295
  }
72290
72296
  dispatch(action) {
72291
- this.state = this.reduce(this.state, action), this.shouldApplyFilter(action) && this.applyFilters(), this.notifyListeners();
72297
+ this.state = this.reduce(this.state, action), this.shouldApplyFilter(action) && this.applyFilters(), this.notifyListeners(action);
72292
72298
  }
72293
72299
  subscribe(listener) {
72294
72300
  return this.listeners.push(listener), () => {
72295
72301
  this.listeners = this.listeners.filter(l => l !== listener);
72296
72302
  };
72297
72303
  }
72298
- notifyListeners() {
72299
- this.listeners.forEach(listener => listener(this.state));
72304
+ notifyListeners(action) {
72305
+ this.listeners.forEach(listener => listener(this.state, action));
72300
72306
  }
72301
72307
  reduce(state, action) {
72302
72308
  const {
@@ -72819,125 +72825,131 @@
72819
72825
  hide() {
72820
72826
  this.filterByValuePanel.style.display = "none";
72821
72827
  }
72828
+ clearSearchInputValue() {
72829
+ this.filterByValueSearchInput.value = "";
72830
+ }
72822
72831
  }
72823
72832
 
72833
+ const categories = [{
72834
+ value: FilterOperatorCategory.ALL,
72835
+ label: "全部"
72836
+ }, {
72837
+ value: FilterOperatorCategory.TEXT,
72838
+ label: "文本"
72839
+ }, {
72840
+ value: FilterOperatorCategory.NUMBER,
72841
+ label: "数值"
72842
+ }, {
72843
+ value: FilterOperatorCategory.COLOR,
72844
+ label: "颜色"
72845
+ }, {
72846
+ value: FilterOperatorCategory.CHECKBOX,
72847
+ label: "复选框"
72848
+ }, {
72849
+ value: FilterOperatorCategory.RADIO,
72850
+ label: "单选框"
72851
+ }];
72852
+ const operators = [{
72853
+ value: "equals",
72854
+ label: "等于",
72855
+ category: FilterOperatorCategory.ALL
72856
+ }, {
72857
+ value: "notEquals",
72858
+ label: "不等于",
72859
+ category: FilterOperatorCategory.ALL
72860
+ }, {
72861
+ value: "equals",
72862
+ label: "等于",
72863
+ category: FilterOperatorCategory.NUMBER
72864
+ }, {
72865
+ value: "notEquals",
72866
+ label: "不等于",
72867
+ category: FilterOperatorCategory.NUMBER
72868
+ }, {
72869
+ value: "greaterThan",
72870
+ label: "大于",
72871
+ category: FilterOperatorCategory.NUMBER
72872
+ }, {
72873
+ value: "lessThan",
72874
+ label: "小于",
72875
+ category: FilterOperatorCategory.NUMBER
72876
+ }, {
72877
+ value: "greaterThanOrEqual",
72878
+ label: "大于等于",
72879
+ category: FilterOperatorCategory.NUMBER
72880
+ }, {
72881
+ value: "lessThanOrEqual",
72882
+ label: "小于等于",
72883
+ category: FilterOperatorCategory.NUMBER
72884
+ }, {
72885
+ value: "between",
72886
+ label: "介于",
72887
+ category: FilterOperatorCategory.NUMBER
72888
+ }, {
72889
+ value: "notBetween",
72890
+ label: "不介于",
72891
+ category: FilterOperatorCategory.NUMBER
72892
+ }, {
72893
+ value: "equals",
72894
+ label: "等于",
72895
+ category: FilterOperatorCategory.TEXT
72896
+ }, {
72897
+ value: "notEquals",
72898
+ label: "不等于",
72899
+ category: FilterOperatorCategory.TEXT
72900
+ }, {
72901
+ value: "contains",
72902
+ label: "包含",
72903
+ category: FilterOperatorCategory.TEXT
72904
+ }, {
72905
+ value: "notContains",
72906
+ label: "不包含",
72907
+ category: FilterOperatorCategory.TEXT
72908
+ }, {
72909
+ value: "startsWith",
72910
+ label: "开头是",
72911
+ category: FilterOperatorCategory.TEXT
72912
+ }, {
72913
+ value: "notStartsWith",
72914
+ label: "开头不是",
72915
+ category: FilterOperatorCategory.TEXT
72916
+ }, {
72917
+ value: "endsWith",
72918
+ label: "结尾是",
72919
+ category: FilterOperatorCategory.TEXT
72920
+ }, {
72921
+ value: "notEndsWith",
72922
+ label: "结尾不是",
72923
+ category: FilterOperatorCategory.TEXT
72924
+ }, {
72925
+ value: "equals",
72926
+ label: "等于",
72927
+ category: FilterOperatorCategory.COLOR
72928
+ }, {
72929
+ value: "notEquals",
72930
+ label: "不等于",
72931
+ category: FilterOperatorCategory.COLOR
72932
+ }, {
72933
+ value: "isChecked",
72934
+ label: "已选中",
72935
+ category: FilterOperatorCategory.CHECKBOX
72936
+ }, {
72937
+ value: "isUnchecked",
72938
+ label: "未选中",
72939
+ category: FilterOperatorCategory.CHECKBOX
72940
+ }, {
72941
+ value: "isChecked",
72942
+ label: "已选中",
72943
+ category: FilterOperatorCategory.RADIO
72944
+ }, {
72945
+ value: "isUnchecked",
72946
+ label: "未选中",
72947
+ category: FilterOperatorCategory.RADIO
72948
+ }];
72949
+
72824
72950
  class ConditionFilter {
72825
- constructor(table, filterStateManager, styles) {
72826
- this.currentCategory = FilterOperatorCategory.ALL, this.operators = [{
72827
- value: "equals",
72828
- label: "等于",
72829
- category: FilterOperatorCategory.ALL
72830
- }, {
72831
- value: "notEquals",
72832
- label: "不等于",
72833
- category: FilterOperatorCategory.ALL
72834
- }, {
72835
- value: "equals",
72836
- label: "等于",
72837
- category: FilterOperatorCategory.NUMBER
72838
- }, {
72839
- value: "notEquals",
72840
- label: "不等于",
72841
- category: FilterOperatorCategory.NUMBER
72842
- }, {
72843
- value: "greaterThan",
72844
- label: "大于",
72845
- category: FilterOperatorCategory.NUMBER
72846
- }, {
72847
- value: "lessThan",
72848
- label: "小于",
72849
- category: FilterOperatorCategory.NUMBER
72850
- }, {
72851
- value: "greaterThanOrEqual",
72852
- label: "大于等于",
72853
- category: FilterOperatorCategory.NUMBER
72854
- }, {
72855
- value: "lessThanOrEqual",
72856
- label: "小于等于",
72857
- category: FilterOperatorCategory.NUMBER
72858
- }, {
72859
- value: "between",
72860
- label: "介于",
72861
- category: FilterOperatorCategory.NUMBER
72862
- }, {
72863
- value: "notBetween",
72864
- label: "不介于",
72865
- category: FilterOperatorCategory.NUMBER
72866
- }, {
72867
- value: "equals",
72868
- label: "等于",
72869
- category: FilterOperatorCategory.TEXT
72870
- }, {
72871
- value: "notEquals",
72872
- label: "不等于",
72873
- category: FilterOperatorCategory.TEXT
72874
- }, {
72875
- value: "contains",
72876
- label: "包含",
72877
- category: FilterOperatorCategory.TEXT
72878
- }, {
72879
- value: "notContains",
72880
- label: "不包含",
72881
- category: FilterOperatorCategory.TEXT
72882
- }, {
72883
- value: "startsWith",
72884
- label: "开头是",
72885
- category: FilterOperatorCategory.TEXT
72886
- }, {
72887
- value: "notStartsWith",
72888
- label: "开头不是",
72889
- category: FilterOperatorCategory.TEXT
72890
- }, {
72891
- value: "endsWith",
72892
- label: "结尾是",
72893
- category: FilterOperatorCategory.TEXT
72894
- }, {
72895
- value: "notEndsWith",
72896
- label: "结尾不是",
72897
- category: FilterOperatorCategory.TEXT
72898
- }, {
72899
- value: "equals",
72900
- label: "等于",
72901
- category: FilterOperatorCategory.COLOR
72902
- }, {
72903
- value: "notEquals",
72904
- label: "不等于",
72905
- category: FilterOperatorCategory.COLOR
72906
- }, {
72907
- value: "isChecked",
72908
- label: "已选中",
72909
- category: FilterOperatorCategory.CHECKBOX
72910
- }, {
72911
- value: "isUnchecked",
72912
- label: "未选中",
72913
- category: FilterOperatorCategory.CHECKBOX
72914
- }, {
72915
- value: "isChecked",
72916
- label: "已选中",
72917
- category: FilterOperatorCategory.RADIO
72918
- }, {
72919
- value: "isUnchecked",
72920
- label: "未选中",
72921
- category: FilterOperatorCategory.RADIO
72922
- }], this.categories = [{
72923
- value: FilterOperatorCategory.ALL,
72924
- label: "全部"
72925
- }, {
72926
- value: FilterOperatorCategory.TEXT,
72927
- label: "文本"
72928
- }, {
72929
- value: FilterOperatorCategory.NUMBER,
72930
- label: "数值"
72931
- }, {
72932
- value: FilterOperatorCategory.COLOR,
72933
- label: "颜色"
72934
- }, {
72935
- value: FilterOperatorCategory.CHECKBOX,
72936
- label: "复选框"
72937
- }, {
72938
- value: FilterOperatorCategory.RADIO,
72939
- label: "单选框"
72940
- }], this.table = table, this.styles = styles, this.filterStateManager = filterStateManager;
72951
+ constructor(table, filterStateManager, styles, conditionCategories) {
72952
+ this.currentCategory = FilterOperatorCategory.ALL, this.categories = [], this.operators = [], this.table = table, this.styles = styles, this.filterStateManager = filterStateManager, this.categories = conditionCategories, this.operators = operators;
72941
72953
  }
72942
72954
  setSelectedField(fieldId) {
72943
72955
  this.selectedField = fieldId, this.updateOperatorOptions(), this.loadCurrentFilterState();
@@ -72947,7 +72959,7 @@
72947
72959
  let filteredOperators;
72948
72960
  if (this.operatorSelect.innerHTML = "", this.currentCategory === FilterOperatorCategory.ALL) {
72949
72961
  const uniqueOperators = new Map();
72950
- this.operators.forEach(op => {
72962
+ this.operators.filter(op => this.categories.map(cat => cat.value).includes(op.category)).forEach(op => {
72951
72963
  uniqueOperators.has(op.value) || uniqueOperators.set(op.value, op);
72952
72964
  }), filteredOperators = Array.from(uniqueOperators.values());
72953
72965
  } else filteredOperators = this.operators.filter(op => op.category === this.currentCategory);
@@ -73060,8 +73072,8 @@
73060
73072
  }
73061
73073
 
73062
73074
  class FilterToolbar {
73063
- constructor(table, filterStateManager, styles) {
73064
- this.valueFilter = null, this.conditionFilter = null, this.activeTab = "byValue", this.isVisible = !1, this.selectedField = null, this.filterModes = [], this.table = table, this.filterStateManager = filterStateManager, this.styles = styles, this.valueFilter = new ValueFilter(this.table, this.filterStateManager, this.styles), this.conditionFilter = new ConditionFilter(this.table, this.filterStateManager, this.styles), this.filterMenuWidth = 300, this.filterStateManager.subscribe(state => {
73075
+ constructor(table, filterStateManager, styles, conditionCategories) {
73076
+ this.valueFilter = null, this.conditionFilter = null, this.activeTab = "byValue", this.isVisible = !1, this.selectedField = null, this.filterModes = [], this.table = table, this.filterStateManager = filterStateManager, this.styles = styles, this.valueFilter = new ValueFilter(this.table, this.filterStateManager, this.styles), this.conditionFilter = new ConditionFilter(this.table, this.filterStateManager, this.styles, conditionCategories), this.filterMenuWidth = 300, this.filterStateManager.subscribe(state => {
73065
73077
  this.isVisible && null !== this.selectedField && this.updateClearFilterButtonState(this.selectedField);
73066
73078
  });
73067
73079
  }
@@ -73121,7 +73133,7 @@
73121
73133
  cell.right < this.filterMenuWidth ? (left = cell.left + canvasBounds.left, top = cell.bottom + canvasBounds.top) : (left = cell.right + canvasBounds.left - this.filterMenuWidth, top = cell.bottom + canvasBounds.top), this.filterMenu.style.display = this.isVisible ? "block" : "none", this.filterMenu.style.left = `${left}px`, this.filterMenu.style.top = `${top}px`;
73122
73134
  }
73123
73135
  show(col, row, filterModes) {
73124
- this.filterModes = filterModes, this.filterModes.includes("byValue") ? this.filterModes.includes("byCondition") || (this.filterTabByCondition.style.display = "none", this.onTabSwitch("byValue")) : (this.filterTabByValue.style.display = "none", this.onTabSwitch("byCondition")), this.adjustMenuPosition(col, row), this.filterMenu.style.display = "block";
73136
+ this.valueFilter.clearSearchInputValue(), this.filterModes = filterModes, this.filterModes.includes("byValue") ? this.filterModes.includes("byCondition") || (this.filterTabByCondition.style.display = "none", this.onTabSwitch("byValue")) : (this.filterTabByValue.style.display = "none", this.onTabSwitch("byCondition")), this.adjustMenuPosition(col, row), this.filterMenu.style.display = "block";
73125
73137
  const field = this.table.internalProps.layoutMap.getHeaderField(col, row);
73126
73138
  this.updateSelectedField(field);
73127
73139
  const currentFilter = this.filterStateManager.getFilterState(field);
@@ -82602,7 +82614,7 @@
82602
82614
 
82603
82615
  class FilterPlugin {
82604
82616
  constructor(pluginOptions) {
82605
- var _a, _b, _c;
82617
+ var _a, _b, _c, _d;
82606
82618
  this.id = "filter", this.name = "Filter", this.runTime = [TABLE_EVENT_TYPE.BEFORE_INIT, TABLE_EVENT_TYPE.BEFORE_UPDATE_OPTION, TABLE_EVENT_TYPE.ICON_CLICK, TABLE_EVENT_TYPE.SCROLL], this.id = null !== (_a = null == pluginOptions ? void 0 : pluginOptions.id) && void 0 !== _a ? _a : this.id, this.pluginOptions = pluginOptions, this.pluginOptions.filterIcon = null !== (_b = pluginOptions.filterIcon) && void 0 !== _b ? _b : {
82607
82619
  name: "filter-icon",
82608
82620
  type: "svg",
@@ -82619,22 +82631,31 @@
82619
82631
  positionType: IconPosition.right,
82620
82632
  cursor: "pointer",
82621
82633
  svg: '<svg t="1752821771292" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11926" width="200" height="200"><path d="M971.614323 53.05548L655.77935 412.054233C635.196622 435.434613 623.906096 465.509377 623.906096 496.583302v495.384307c0 28.975686-35.570152 43.063864-55.353551 21.781723l-159.865852-171.256294c-5.495389-5.895053-8.59279-13.688514-8.592789-21.781722V496.583302c0-31.073925-11.290526-61.148688-31.873254-84.429153L52.385677 53.05548C34.200936 32.472751 48.888611 0 76.365554 0h871.268892c27.476943 0 42.164618 32.472751 23.979877 53.05548z" fill="#416eff" p-id="11927"></path></svg>'
82622
- }, this.pluginOptions.filterModes && this.pluginOptions.filterModes.length || (this.pluginOptions.filterModes = ["byValue", "byCondition"]), this.pluginOptions.styles = lodashExports.merge({}, filterStyles, pluginOptions.styles);
82634
+ }, this.pluginOptions.filterModes && this.pluginOptions.filterModes.length || (this.pluginOptions.filterModes = ["byValue", "byCondition"]), this.pluginOptions.styles = lodashExports.merge({}, filterStyles, pluginOptions.styles), this.pluginOptions.conditionCategories = null !== (_d = pluginOptions.conditionCategories) && void 0 !== _d ? _d : categories;
82635
+ }
82636
+ initFilterPlugin(eventArgs) {
82637
+ this.filterEngine = new FilterEngine(), this.filterStateManager = new FilterStateManager(this.table, this.filterEngine), this.filterToolbar = new FilterToolbar(this.table, this.filterStateManager, this.pluginOptions.styles, this.pluginOptions.conditionCategories), this.columns = eventArgs.options.columns, this.filterToolbar.render(document.body), this.updateFilterIcons(this.columns), this.filterStateManager.subscribe((_, action) => {
82638
+ (null == action ? void 0 : action.type) !== FilterActionType.ADD_FILTER && (this.updateFilterIcons(this.columns), this.table.updateColumns(this.columns, {
82639
+ clearRowHeightCache: !1
82640
+ }));
82641
+ });
82623
82642
  }
82624
82643
  run(...args) {
82625
- var _a, _b, _c;
82644
+ var _a, _b, _c, _d, _e;
82626
82645
  const eventArgs = args[0],
82627
82646
  runtime = args[1],
82628
82647
  table = args[2];
82629
- if (this.table = table, runtime === TABLE_EVENT_TYPE.BEFORE_INIT) this.filterEngine = new FilterEngine(), this.filterStateManager = new FilterStateManager(this.table, this.filterEngine), this.filterToolbar = new FilterToolbar(this.table, this.filterStateManager, this.pluginOptions.styles), this.columns = eventArgs.options.columns, this.filterToolbar.render(document.body), this.updateFilterIcons(this.columns), this.filterStateManager.subscribe(() => {
82630
- this.updateFilterIcons(this.columns), this.table.updateColumns(this.columns, {
82631
- clearRowHeightCache: !1
82632
- });
82633
- });else if (runtime === TABLE_EVENT_TYPE.BEFORE_UPDATE_OPTION) this.pluginOptions = Object.assign(Object.assign({}, this.pluginOptions), eventArgs.options.plugins.find(plugin => plugin.id === this.id).pluginOptions), this.columns = eventArgs.options.columns, this.handleOptionUpdate(eventArgs.options);else if (runtime === TABLE_EVENT_TYPE.ICON_CLICK && "filter-icon" === eventArgs.name || "filtering-icon" === eventArgs.name) {
82634
- if (3 === (null === (_a = eventArgs.event) || void 0 === _a ? void 0 : _a.which) || 2 === (null === (_b = eventArgs.event) || void 0 === _b ? void 0 : _b.button) || 2 == (2 & (null === (_c = eventArgs.event) || void 0 === _c ? void 0 : _c.buttons))) return;
82648
+ if (this.table = table, runtime === TABLE_EVENT_TYPE.BEFORE_INIT) this.initFilterPlugin(eventArgs);else if (runtime === TABLE_EVENT_TYPE.BEFORE_UPDATE_OPTION) this.filterEngine && this.filterStateManager && this.filterToolbar || this.initFilterPlugin(eventArgs), this.pluginOptions = Object.assign(Object.assign({}, this.pluginOptions), null === (_b = null === (_a = eventArgs.options.plugins) || void 0 === _a ? void 0 : _a.find(plugin => plugin.id === this.id)) || void 0 === _b ? void 0 : _b.pluginOptions), this.columns = eventArgs.options.columns, this.handleOptionUpdate(eventArgs.options);else if (runtime === TABLE_EVENT_TYPE.ICON_CLICK && "filter-icon" === eventArgs.name || "filtering-icon" === eventArgs.name) {
82649
+ if (3 === (null === (_c = eventArgs.event) || void 0 === _c ? void 0 : _c.which) || 2 === (null === (_d = eventArgs.event) || void 0 === _d ? void 0 : _d.button) || 2 == (2 & (null === (_e = eventArgs.event) || void 0 === _e ? void 0 : _e.buttons))) return;
82635
82650
  const col = eventArgs.col,
82636
82651
  row = eventArgs.row;
82637
- this.filterToolbar.isVisible ? this.filterToolbar.hide() : this.filterToolbar.show(col, row, this.pluginOptions.filterModes);
82652
+ this.filterToolbar.isVisible ? (this.filterToolbar.hide(), this.table.fireListeners(TABLE_EVENT_TYPE.FILTER_MENU_HIDE, {
82653
+ col: eventArgs.col,
82654
+ row: eventArgs.row
82655
+ })) : (this.filterToolbar.show(col, row, this.pluginOptions.filterModes), this.table.fireListeners(TABLE_EVENT_TYPE.FILTER_MENU_SHOW, {
82656
+ col: eventArgs.col,
82657
+ row: eventArgs.row
82658
+ }));
82638
82659
  } else runtime === TABLE_EVENT_TYPE.SCROLL && "horizontal" === eventArgs.scrollDirection && this.filterToolbar.adjustMenuPosition();
82639
82660
  }
82640
82661
  update() {
@@ -82716,7 +82737,9 @@
82716
82737
  }));
82717
82738
  }
82718
82739
  release() {
82719
- this.table = null, this.filterEngine = null, this.filterStateManager = null, this.filterToolbar = null;
82740
+ this.columns.forEach(column => {
82741
+ column.headerIcon = void 0;
82742
+ }), this.table = null, this.filterEngine = null, this.filterStateManager = null, this.filterToolbar = null;
82720
82743
  }
82721
82744
  }
82722
82745
 
@@ -90027,7 +90050,7 @@
90027
90050
  importStyle();
90028
90051
  }
90029
90052
 
90030
- const version = "1.22.4-alpha.4";
90053
+ const version = "1.22.4-alpha.6";
90031
90054
  importStyles();
90032
90055
 
90033
90056
  exports.TYPES = index;