@visactor/vtable-sheet 1.22.7-alpha.2 → 1.22.7-alpha.3

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.7-alpha.2";
5
+ export declare const version = "1.22.7-alpha.3";
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.7-alpha.2", (0, style_manager_1.importStyles)();
50
+ exports.version = "1.22.7-alpha.3", (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.7-alpha.2\";\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.7-alpha.3\";\n// 导入样式\nimportStyles();\n/**\n * @namespace VTableSheet\n */\nexport { VTableSheet, TYPES, VTable, ISheetDefine, IVTableSheetOptions };\n"]}
@@ -59755,7 +59755,7 @@
59755
59755
  }
59756
59756
  constructor(container, options = {}) {
59757
59757
  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;
59758
- if (super(), this.showFrozenIcon = !0, this.version = "1.22.7-alpha.2", 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");
59758
+ if (super(), this.showFrozenIcon = !0, this.version = "1.22.7-alpha.3", 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");
59759
59759
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
59760
59760
  options: options,
59761
59761
  container: container
@@ -72975,16 +72975,31 @@
72975
72975
  }
72976
72976
  }), this.candidateKeys.set(fieldId, countMap), this.toUnformattedCache.set(fieldId, toUnformatted);
72977
72977
  }
72978
- update() {
72978
+ updateBeforeFilter() {
72979
72979
  const currentRecords = this.table.internalProps.dataSource.records,
72980
72980
  filteredFields = this.filterStateManager.getActiveFilterFields();
72981
72981
  currentRecords.forEach(record => {
72982
72982
  filteredFields.forEach(candidateField => {
72983
72983
  var _a, _b;
72984
- const formatFn = this.getFormatFnCache(candidateField),
72985
- originalValue = record[candidateField],
72986
- formattedValue = formatFn(record);
72987
- !(this.toUnformattedCache.get(candidateField) || new Map()).has(formattedValue) && (null === (_b = null === (_a = this.filterStateManager.getFilterState(candidateField)) || void 0 === _a ? void 0 : _a.values) || void 0 === _b ? void 0 : _b.length) > 0 && (this.filterStateManager.getFilterState(candidateField).values.push(originalValue), this.selectedKeys.get(candidateField).add(originalValue));
72984
+ const formatFn = this.getFormatFnCache(candidateField);
72985
+ if (isValid$4(record)) {
72986
+ const originalValue = record[candidateField],
72987
+ formattedValue = formatFn(record);
72988
+ !(this.toUnformattedCache.get(candidateField) || new Map()).has(formattedValue) && (null === (_b = null === (_a = this.filterStateManager.getFilterState(candidateField)) || void 0 === _a ? void 0 : _a.values) || void 0 === _b ? void 0 : _b.length) > 0 && (this.filterStateManager.getFilterState(candidateField).values.push(originalValue), this.selectedKeys.get(candidateField).add(originalValue));
72989
+ }
72990
+ });
72991
+ });
72992
+ }
72993
+ updateAfterFilter() {
72994
+ const currentRecords = this.table.internalProps.dataSource.records,
72995
+ filteredFields = this.filterStateManager.getActiveFilterFields();
72996
+ currentRecords.forEach(record => {
72997
+ filteredFields.forEach(candidateField => {
72998
+ var _a;
72999
+ if (isValid$4(record)) {
73000
+ const originalValue = record[candidateField];
73001
+ "byCondition" === (null === (_a = this.filterStateManager.getFilterState(candidateField)) || void 0 === _a ? void 0 : _a.type) && (this.selectedKeys.get(candidateField) || this.selectedKeys.set(candidateField, new Set()), this.selectedKeys.get(candidateField).add(originalValue));
73002
+ }
72988
73003
  });
72989
73004
  });
72990
73005
  }
@@ -73000,11 +73015,13 @@
73000
73015
  records = this.table.internalProps.records.filter(record => filteredFields.every(field => this.selectedKeys.get(field).has(record[field])));
73001
73016
  } else records = this.table.internalProps.records;
73002
73017
  records.forEach(record => {
73003
- const originalValue = record[candidateField],
73004
- formattedValue = formatFn(record);
73005
- if (countMap.set(formattedValue, (countMap.get(formattedValue) || 0) + 1), null != formattedValue) {
73006
- const unformattedSet = toUnformatted.get(formattedValue);
73007
- null != unformattedSet ? unformattedSet.add(originalValue) : toUnformatted.set(formattedValue, new Set([originalValue]));
73018
+ if (isValid$4(record)) {
73019
+ const originalValue = record[candidateField],
73020
+ formattedValue = formatFn(record);
73021
+ if (countMap.set(formattedValue, (countMap.get(formattedValue) || 0) + 1), null != formattedValue) {
73022
+ const unformattedSet = toUnformatted.get(formattedValue);
73023
+ null != unformattedSet ? unformattedSet.add(originalValue) : toUnformatted.set(formattedValue, new Set([originalValue]));
73024
+ }
73008
73025
  }
73009
73026
  }), this.candidateKeys.set(candidateField, countMap), this.toUnformattedCache.set(candidateField, toUnformatted);
73010
73027
  }
@@ -73034,10 +73051,10 @@
73034
73051
  const selectedValues = new Set(),
73035
73052
  originalValues = new Set();
73036
73053
  this.table.internalProps.dataSource.records.forEach(record => {
73037
- selectedValues.add(record[fieldId]);
73054
+ isValid$4(record) && selectedValues.add(record[fieldId]);
73038
73055
  });
73039
73056
  this.table.internalProps.records.forEach(record => {
73040
- originalValues.add(record[fieldId]);
73057
+ isValid$4(record) && originalValues.add(record[fieldId]);
73041
73058
  });
73042
73059
  !arrayEqual(Array.from(originalValues), Array.from(selectedValues)) && (this.selectedKeys.set(fieldId, selectedValues), this.filterStateManager.dispatch({
73043
73060
  type: FilterActionType.ADD_FILTER,
@@ -73419,6 +73436,8 @@
73419
73436
  }
73420
73437
  updateStyles(styles) {
73421
73438
  applyStyles(this.filterMenu, styles.filterMenu), applyStyles(this.filterTabsContainer, styles.tabsContainer), applyStyles(this.filterTabByValue, styles.tabStyle(!0)), applyStyles(this.footerContainer, styles.footerContainer), applyStyles(this.clearFilterOptionLink, styles.clearLink), applyStyles(this.cancelFilterButton, styles.footerButton(!1)), applyStyles(this.applyFilterButton, styles.footerButton(!0)), this.valueFilter.updateStyles(styles), this.conditionFilter.updateStyles(styles);
73439
+ const currentFilter = this.filterStateManager.getFilterState(this.selectedField);
73440
+ currentFilter && "byCondition" === currentFilter.type ? this.onTabSwitch("byCondition") : this.onTabSwitch("byValue");
73422
73441
  }
73423
73442
  attachEventListeners() {
73424
73443
  this.filterTabByValue.addEventListener("click", () => {
@@ -82981,8 +83000,8 @@
82981
83000
  this.pluginOptions = lodashExports.merge(this.pluginOptions, pluginOptions), this.filterToolbar.updateStyles(this.pluginOptions.styles);
82982
83001
  }
82983
83002
  update() {
82984
- var _a;
82985
- null === (_a = this.filterToolbar.valueFilter) || void 0 === _a || _a.update(), this.filterStateManager && this.reapplyActiveFilters();
83003
+ var _a, _b;
83004
+ null === (_a = this.filterToolbar.valueFilter) || void 0 === _a || _a.updateBeforeFilter(), this.filterStateManager && this.reapplyActiveFilters(), null === (_b = this.filterToolbar.valueFilter) || void 0 === _b || _b.updateAfterFilter();
82986
83005
  }
82987
83006
  handleOptionUpdate(options) {
82988
83007
  const currentActiveFields = this.filterStateManager ? this.filterStateManager.getActiveFilterFields() : [];
@@ -91001,7 +91020,7 @@
91001
91020
  importStyle();
91002
91021
  }
91003
91022
 
91004
- const version = "1.22.7-alpha.2";
91023
+ const version = "1.22.7-alpha.3";
91005
91024
  importStyles();
91006
91025
 
91007
91026
  exports.TYPES = index;