@visactor/vtable-sheet 1.22.3 → 1.22.4-alpha.0

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.
@@ -378,5 +378,4 @@ class WorkSheet extends event_target_1.EventTarget {
378
378
  }
379
379
  }
380
380
 
381
- exports.WorkSheet = WorkSheet;
382
- //# sourceMappingURL=WorkSheet.js.map
381
+ exports.WorkSheet = WorkSheet;
@@ -225,4 +225,5 @@ class FormulaUIManager {
225
225
  }
226
226
  }
227
227
 
228
- exports.FormulaUIManager = FormulaUIManager;
228
+ exports.FormulaUIManager = FormulaUIManager;
229
+ //# sourceMappingURL=formula-ui-manager.js.map
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.3";
5
+ export declare const version = "1.22.4-alpha.0";
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.3", (0, style_manager_1.importStyles)();
50
+ exports.version = "1.22.4-alpha.0", (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,QAAQ,CAAC;AAEhC,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.3\";\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.0\";\n// 导入样式\nimportStyles();\n/**\n * @namespace VTableSheet\n */\nexport { VTableSheet, TYPES, VTable, ISheetDefine, IVTableSheetOptions };\n"]}
@@ -54207,8 +54207,8 @@
54207
54207
  return endMoveCol(this);
54208
54208
  }
54209
54209
  checkFrozen() {
54210
- var _a;
54211
- let originalFrozenColCount = this.table.options.frozenColCount ? this.table.options.frozenColCount : this.table.isPivotTable() || this.table.isListTable() && this.table.internalProps.transpose ? (null !== (_a = this.table.rowHeaderLevelCount) && void 0 !== _a ? _a : 0) + this.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount : 0;
54210
+ var _a, _b;
54211
+ let originalFrozenColCount = (null !== (_a = this.table.options.frozenColCount) && void 0 !== _a ? _a : this.table.isPivotTable() || this.table.isListTable() && this.table.internalProps.transpose) ? (null !== (_b = this.table.rowHeaderLevelCount) && void 0 !== _b ? _b : 0) + this.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount : 0;
54212
54212
  if (originalFrozenColCount) {
54213
54213
  originalFrozenColCount = Math.min(originalFrozenColCount, this.table.colCount);
54214
54214
  const container = this.table.getContainer();
@@ -59310,7 +59310,7 @@
59310
59310
  }
59311
59311
  constructor(container, options = {}) {
59312
59312
  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.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");
59313
+ if (super(), this.showFrozenIcon = !0, this.version = "1.22.4-alpha.0", 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
59314
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
59315
59315
  options: options,
59316
59316
  container: container
@@ -73032,13 +73032,20 @@
73032
73032
  e.stopPropagation();
73033
73033
  });
73034
73034
  }
73035
- show(col, row, filterModes) {
73036
- this.filterModes = filterModes, this.filterModes.includes("byValue") ? this.filterModes.includes("byCondition") || (this.filterTabByCondition.style.display = "none", setTimeout(() => this.onTabSwitch("byValue"), 0)) : (this.filterTabByValue.style.display = "none", setTimeout(() => this.onTabSwitch("byCondition"), 0));
73035
+ adjustMenuPosition(col, row, providedLeft, providedTop) {
73036
+ if ("number" == typeof providedLeft && "number" == typeof providedTop) return this.filterMenu.style.display = this.isVisible ? "block" : "none", this.filterMenu.style.left = `${providedLeft}px`, void (this.filterMenu.style.top = `${providedTop}px`);
73037
+ const effectiveCol = "number" == typeof col ? col : this.currentCol,
73038
+ effectiveRow = "number" == typeof row ? row : this.currentRow;
73039
+ if ("number" != typeof effectiveCol || "number" != typeof effectiveRow) return;
73040
+ this.currentCol = effectiveCol, this.currentRow = effectiveRow;
73037
73041
  let left = 0,
73038
73042
  top = 0;
73039
73043
  const canvasBounds = this.table.canvas.getBoundingClientRect(),
73040
- cell = this.table.getMergeCellRect(col, row);
73041
- 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 = "block", this.filterMenu.style.left = `${left}px`, this.filterMenu.style.top = `${top}px`;
73044
+ cell = this.table.getCellRelativeRect(effectiveCol, effectiveRow);
73045
+ 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`;
73046
+ }
73047
+ show(col, row, filterModes) {
73048
+ 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";
73042
73049
  const field = this.table.internalProps.layoutMap.getHeaderField(col, row);
73043
73050
  this.updateSelectedField(field);
73044
73051
  const currentFilter = this.filterStateManager.getFilterState(field);
@@ -73054,7 +73061,7 @@
73054
73061
  class FilterPlugin {
73055
73062
  constructor(pluginOptions) {
73056
73063
  var _a, _b, _c;
73057
- this.id = "filter", this.name = "Filter", this.runTime = [TABLE_EVENT_TYPE.BEFORE_INIT, TABLE_EVENT_TYPE.BEFORE_UPDATE_OPTION, TABLE_EVENT_TYPE.ICON_CLICK], 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 : {
73064
+ 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 : {
73058
73065
  name: "filter-icon",
73059
73066
  type: "svg",
73060
73067
  width: 12,
@@ -73077,23 +73084,23 @@
73077
73084
  const eventArgs = args[0],
73078
73085
  runtime = args[1],
73079
73086
  table = args[2];
73080
- 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.filterToolbar.render(document.body), this.updateFilterIcons(eventArgs.options), this.filterStateManager.subscribe(() => {
73081
- this.updateFilterIcons(eventArgs.options), this.table.updateColumns(eventArgs.options.columns, {
73087
+ 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.columns = eventArgs.options.columns, this.filterToolbar.render(document.body), this.updateFilterIcons(this.columns), this.filterStateManager.subscribe(() => {
73088
+ this.updateFilterIcons(this.columns), this.table.updateColumns(this.columns, {
73082
73089
  clearRowHeightCache: !1
73083
73090
  });
73084
- });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.handleOptionUpdate(eventArgs.options);else if (runtime === TABLE_EVENT_TYPE.ICON_CLICK && "filter-icon" === eventArgs.name || "filtering-icon" === eventArgs.name) {
73091
+ });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) {
73085
73092
  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;
73086
73093
  const col = eventArgs.col,
73087
73094
  row = eventArgs.row;
73088
73095
  this.filterToolbar.isVisible ? this.filterToolbar.hide() : this.filterToolbar.show(col, row, this.pluginOptions.filterModes);
73089
- }
73096
+ } else runtime === TABLE_EVENT_TYPE.SCROLL && "horizontal" === eventArgs.scrollDirection && this.filterToolbar.adjustMenuPosition();
73090
73097
  }
73091
73098
  update() {
73092
73099
  this.filterStateManager && this.reapplyActiveFilters();
73093
73100
  }
73094
73101
  handleOptionUpdate(options) {
73095
73102
  const currentActiveFields = this.filterStateManager ? this.filterStateManager.getActiveFilterFields() : [];
73096
- this.filterStateManager && currentActiveFields.length > 0 && this.validateFilterStatesAfterUpdate(options, currentActiveFields), this.updateFilterIcons(options);
73103
+ this.filterStateManager && currentActiveFields.length > 0 && this.validateFilterStatesAfterUpdate(options, currentActiveFields), this.updateFilterIcons(options.columns);
73097
73104
  }
73098
73105
  reapplyActiveFilters() {
73099
73106
  this.filterStateManager.reapplyCurrentFilters();
@@ -73113,11 +73120,11 @@
73113
73120
  });
73114
73121
  });
73115
73122
  }
73116
- updateFilterIcons(options) {
73123
+ updateFilterIcons(columns = []) {
73117
73124
  const filterIcon = this.pluginOptions.filterIcon,
73118
73125
  filteringIcon = this.pluginOptions.filteringIcon,
73119
73126
  isIconEqual = (a, b) => a === b || a && b && "object" == typeof a && "object" == typeof b && a.name === b.name;
73120
- options.columns.forEach(column => {
73127
+ columns.forEach(column => {
73121
73128
  var _a;
73122
73129
  const shouldShow = this.shouldEnableFilterForColumn(column.field, column),
73123
73130
  isFiltering = !!(null === (_a = this.filterStateManager.getFilterState(column.field)) || void 0 === _a ? void 0 : _a.enable);
@@ -73149,13 +73156,10 @@
73149
73156
  };
73150
73157
  }
73151
73158
  setFilterState(filterState) {
73152
- if (!this.filterStateManager || !filterState || !filterState.filters) return;
73153
- this.filterStateManager.dispatch({
73159
+ this.filterStateManager && (this.filterStateManager.dispatch({
73154
73160
  type: FilterActionType.CLEAR_ALL_FILTERS,
73155
73161
  payload: {}
73156
- });
73157
- this.table.columns;
73158
- Object.entries(filterState.filters).forEach(([, config]) => {
73162
+ }), filterState && filterState.filters && Object.entries(filterState.filters).forEach(([, config]) => {
73159
73163
  config.enable && this.filterStateManager.dispatch({
73160
73164
  type: FilterActionType.ADD_FILTER,
73161
73165
  payload: {
@@ -73167,7 +73171,7 @@
73167
73171
  enable: !0
73168
73172
  }
73169
73173
  });
73170
- });
73174
+ }));
73171
73175
  }
73172
73176
  release() {
73173
73177
  this.table = null, this.filterEngine = null, this.filterStateManager = null, this.filterToolbar = null;
@@ -80481,7 +80485,7 @@
80481
80485
  importStyle();
80482
80486
  }
80483
80487
 
80484
- const version = "1.22.3";
80488
+ const version = "1.22.4-alpha.0";
80485
80489
  importStyles();
80486
80490
 
80487
80491
  exports.TYPES = index;