@visactor/vtable-sheet 1.22.5 → 1.22.6-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.
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.5";
5
+ export declare const version = "1.22.6-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.5", (0, style_manager_1.importStyles)();
50
+ exports.version = "1.22.6-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.5\";\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.6-alpha.0\";\n// 导入样式\nimportStyles();\n/**\n * @namespace VTableSheet\n */\nexport { VTableSheet, TYPES, VTable, ISheetDefine, IVTableSheetOptions };\n"]}
@@ -59664,7 +59664,7 @@
59664
59664
  }
59665
59665
  constructor(container, options = {}) {
59666
59666
  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;
59667
- if (super(), this.showFrozenIcon = !0, this.version = "1.22.5", 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");
59667
+ if (super(), this.showFrozenIcon = !0, this.version = "1.22.6-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");
59668
59668
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
59669
59669
  options: options,
59670
59670
  container: container
@@ -70676,27 +70676,30 @@
70676
70676
  document.addEventListener("keydown", this.handleKeyDown.bind(this), !0);
70677
70677
  }
70678
70678
  handleKeyDown(event) {
70679
- if (this.table.editorManager && this.isExcelShortcutKey(event)) if (this.table.editorManager.editingEditor && "keydown" === this.table.editorManager.beginTriggerEditCellMode) {
70680
- const {
70681
- col: col,
70682
- row: row
70683
- } = this.table.editorManager.editCell;
70684
- this.table.editorManager.completeEdit(), this.table.getElement().focus(), event.shiftKey || event.ctrlKey || event.metaKey || (event.key === ExcelEditCellKeyboardResponse.ENTER ? this.table.selectCell(col, row + 1) : event.key === ExcelEditCellKeyboardResponse.TAB ? this.table.selectCell(col + 1, row) : event.key === ExcelEditCellKeyboardResponse.ARROW_LEFT ? this.table.selectCell(col - 1, row) : event.key === ExcelEditCellKeyboardResponse.ARROW_RIGHT ? this.table.selectCell(col + 1, row) : event.key === ExcelEditCellKeyboardResponse.ARROW_DOWN ? this.table.selectCell(col, row + 1) : event.key === ExcelEditCellKeyboardResponse.ARROW_UP && this.table.selectCell(col, row - 1), event.stopPropagation(), event.preventDefault());
70685
- } else {
70686
- const {
70687
- col: col,
70688
- row: row
70689
- } = this.table.stateManager.select.cellPos;
70690
- if (!this.table.editorManager.editingEditor || event.key !== ExcelEditCellKeyboardResponse.ENTER && event.key !== ExcelEditCellKeyboardResponse.TAB) {
70691
- if (!this.table.editorManager.editingEditor && (event.key === ExcelEditCellKeyboardResponse.DELETE || event.key === ExcelEditCellKeyboardResponse.BACKSPACE)) {
70692
- const selectCells = this.table.getSelectedCellInfos();
70693
- (null == selectCells ? void 0 : selectCells.length) > 0 && deleteSelectRange(selectCells, this.table), event.stopPropagation(), event.preventDefault();
70694
- }
70695
- } else this.table.editorManager.completeEdit(), this.table.getElement().focus(), event.key === ExcelEditCellKeyboardResponse.ENTER ? this.table.selectCell(col, row + 1) : event.key === ExcelEditCellKeyboardResponse.TAB && this.table.selectCell(col + 1, row), event.stopPropagation(), event.preventDefault();
70679
+ if (this.table.editorManager && this.isExcelShortcutKey(event)) {
70680
+ const eventKey = event.key.toLowerCase();
70681
+ if (this.table.editorManager.editingEditor && "keydown" === this.table.editorManager.beginTriggerEditCellMode) {
70682
+ const {
70683
+ col: col,
70684
+ row: row
70685
+ } = this.table.editorManager.editCell;
70686
+ this.table.editorManager.completeEdit(), this.table.getElement().focus(), event.shiftKey || event.ctrlKey || event.metaKey || (eventKey === ExcelEditCellKeyboardResponse.ENTER ? this.table.selectCell(col, row + 1) : eventKey === ExcelEditCellKeyboardResponse.TAB ? this.table.selectCell(col + 1, row) : eventKey === ExcelEditCellKeyboardResponse.ARROW_LEFT ? this.table.selectCell(col - 1, row) : eventKey === ExcelEditCellKeyboardResponse.ARROW_RIGHT ? this.table.selectCell(col + 1, row) : eventKey === ExcelEditCellKeyboardResponse.ARROW_DOWN ? this.table.selectCell(col, row + 1) : eventKey === ExcelEditCellKeyboardResponse.ARROW_UP && this.table.selectCell(col, row - 1), event.stopPropagation(), event.preventDefault());
70687
+ } else {
70688
+ const {
70689
+ col: col,
70690
+ row: row
70691
+ } = this.table.stateManager.select.cellPos;
70692
+ if (!this.table.editorManager.editingEditor || eventKey !== ExcelEditCellKeyboardResponse.ENTER && eventKey !== ExcelEditCellKeyboardResponse.TAB) {
70693
+ if (!this.table.editorManager.editingEditor && (eventKey === ExcelEditCellKeyboardResponse.DELETE || eventKey === ExcelEditCellKeyboardResponse.BACKSPACE)) {
70694
+ const selectCells = this.table.getSelectedCellInfos();
70695
+ (null == selectCells ? void 0 : selectCells.length) > 0 && deleteSelectRange(selectCells, this.table), event.stopPropagation(), event.preventDefault();
70696
+ }
70697
+ } else this.table.editorManager.completeEdit(), this.table.getElement().focus(), eventKey === ExcelEditCellKeyboardResponse.ENTER ? this.table.selectCell(col, row + 1) : eventKey === ExcelEditCellKeyboardResponse.TAB && this.table.selectCell(col + 1, row), event.stopPropagation(), event.preventDefault();
70698
+ }
70696
70699
  }
70697
70700
  }
70698
70701
  isExcelShortcutKey(event) {
70699
- return this.responseKeyboard.includes(event.key);
70702
+ return this.responseKeyboard.includes(event.key.toLowerCase());
70700
70703
  }
70701
70704
  setResponseKeyboard(responseKeyboard) {
70702
70705
  this.responseKeyboard = responseKeyboard;
@@ -72650,15 +72653,15 @@
72650
72653
  this.getActiveFilterFields().length > 0 && this.applyFilters();
72651
72654
  }
72652
72655
  dispatch(action) {
72653
- this.state = this.reduce(this.state, action), this.shouldApplyFilter(action) && this.applyFilters(), this.notifyListeners();
72656
+ this.state = this.reduce(this.state, action), this.shouldApplyFilter(action) && this.applyFilters(), this.notifyListeners(action);
72654
72657
  }
72655
72658
  subscribe(listener) {
72656
72659
  return this.listeners.push(listener), () => {
72657
72660
  this.listeners = this.listeners.filter(l => l !== listener);
72658
72661
  };
72659
72662
  }
72660
- notifyListeners() {
72661
- this.listeners.forEach(listener => listener(this.state));
72663
+ notifyListeners(action) {
72664
+ this.listeners.forEach(listener => listener(this.state, action));
72662
72665
  }
72663
72666
  reduce(state, action) {
72664
72667
  const {
@@ -73112,6 +73115,9 @@
73112
73115
  hide() {
73113
73116
  this.filterByValuePanel.style.display = "none";
73114
73117
  }
73118
+ clearSearchInputValue() {
73119
+ this.filterByValueSearchInput.value = "";
73120
+ }
73115
73121
  }
73116
73122
 
73117
73123
  class ConditionFilter {
@@ -73407,7 +73413,7 @@
73407
73413
  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`;
73408
73414
  }
73409
73415
  show(col, row, filterModes) {
73410
- 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";
73416
+ 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";
73411
73417
  const field = this.table.internalProps.layoutMap.getHeaderField(col, row);
73412
73418
  this.updateSelectedField(field);
73413
73419
  const currentFilter = this.filterStateManager.getFilterState(field);
@@ -73446,10 +73452,10 @@
73446
73452
  const eventArgs = args[0],
73447
73453
  runtime = args[1],
73448
73454
  table = args[2];
73449
- 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(() => {
73450
- this.updateFilterIcons(this.columns), this.table.updateColumns(this.columns, {
73455
+ 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((_, action) => {
73456
+ (null == action ? void 0 : action.type) !== FilterActionType.ADD_FILTER && (this.updateFilterIcons(this.columns), this.table.updateColumns(this.columns, {
73451
73457
  clearRowHeightCache: !1
73452
- });
73458
+ }));
73453
73459
  });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) {
73454
73460
  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;
73455
73461
  const col = eventArgs.col,
@@ -80847,7 +80853,7 @@
80847
80853
  importStyle();
80848
80854
  }
80849
80855
 
80850
- const version = "1.22.5";
80856
+ const version = "1.22.6-alpha.0";
80851
80857
  importStyles();
80852
80858
 
80853
80859
  exports.TYPES = index;