@visactor/vtable-sheet 1.22.6-alpha.1 → 1.22.6-alpha.2

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.
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  const vtable_plugins_1 = require("@visactor/vtable-plugins"), vutils_1 = require("@visactor/vutils");
8
8
 
9
9
  function getTablePlugins(sheetDefine, options) {
10
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
10
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
11
11
  const plugins = [], disabledPluginsUserSetted = null === (_a = null == options ? void 0 : options.VTablePluginModules) || void 0 === _a ? void 0 : _a.filter((module => module.disabled));
12
12
  let enabledPluginsUserSetted = null === (_b = null == options ? void 0 : options.VTablePluginModules) || void 0 === _b ? void 0 : _b.filter((module => !module.disabled));
13
13
  if (!(null == disabledPluginsUserSetted ? void 0 : disabledPluginsUserSetted.some((module => module.module === vtable_plugins_1.FilterPlugin)))) {
@@ -39,7 +39,7 @@ function getTablePlugins(sheetDefine, options) {
39
39
  plugins.push(contextMenuPlugin), enabledPluginsUserSetted = null == enabledPluginsUserSetted ? void 0 : enabledPluginsUserSetted.filter((module => module.module !== vtable_plugins_1.ContextMenuPlugin));
40
40
  }
41
41
  if (!(null == disabledPluginsUserSetted ? void 0 : disabledPluginsUserSetted.some((module => module.module === vtable_plugins_1.ExcelEditCellKeyboardPlugin)))) {
42
- const userPluginOptions = null === (_l = null == enabledPluginsUserSetted ? void 0 : enabledPluginsUserSetted.find((module => module.module === vtable_plugins_1.ExcelEditCellKeyboardPlugin))) || void 0 === _l ? void 0 : _l.moduleOptions, excelEditCellKeyboardPlugin = new vtable_plugins_1.ExcelEditCellKeyboardPlugin(userPluginOptions);
42
+ const userPluginOptions = null !== (_m = null === (_l = null == enabledPluginsUserSetted ? void 0 : enabledPluginsUserSetted.find((module => module.module === vtable_plugins_1.ExcelEditCellKeyboardPlugin))) || void 0 === _l ? void 0 : _l.moduleOptions) && void 0 !== _m ? _m : {}, excelEditCellKeyboardPlugin = new vtable_plugins_1.ExcelEditCellKeyboardPlugin(userPluginOptions);
43
43
  plugins.push(excelEditCellKeyboardPlugin), enabledPluginsUserSetted = null == enabledPluginsUserSetted ? void 0 : enabledPluginsUserSetted.filter((module => module.module !== vtable_plugins_1.ExcelEditCellKeyboardPlugin));
44
44
  }
45
45
  if (!(null == disabledPluginsUserSetted ? void 0 : disabledPluginsUserSetted.some((module => module.module === vtable_plugins_1.AutoFillPlugin)))) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/table-plugins.ts"],"names":[],"mappings":";;;AACA,6DAWkC;AAWlC,6CAA2C;AAO3C,SAAgB,eAAe,CAC7B,WAA0B,EAC1B,OAA6B;;IAE7B,MAAM,OAAO,GAAmC,EAAE,CAAC;IAEnD,MAAM,yBAAyB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,mBAAmB,0CAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAClG,IAAI,wBAAwB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,mBAAmB,0CAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAChG,IAAI,CAAC,CAAA,yBAAyB,aAAzB,yBAAyB,uBAAzB,yBAAyB,CAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,6BAAY,CAAC,CAAA,EAAE;QAC9E,MAAM,iBAAiB,GAAG,MAAA,wBAAwB,aAAxB,wBAAwB,uBAAxB,wBAAwB,CAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,6BAAY,CAAC,0CAC9F,aAA8B,CAAC;QACnC,MAAM,YAAY,GAAG,kBAAkB,CAAC,WAAW,EA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,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;IACpD,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE;QACzG,kBAAkB,EAAE,KAAK;QACzB,mBAAmB,EAAE,KAAK;KAC3B,CAAC,CAAC;IACH,KAAK,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;AACrC,CAAC","file":"table-plugins.js","sourcesContent":["import type * as VTable from '@visactor/vtable';\nimport {\n FilterPlugin,\n AddRowColumnPlugin,\n TableSeriesNumber,\n HighlightHeaderWhenSelectCellPlugin,\n ContextMenuPlugin,\n ExcelEditCellKeyboardPlugin,\n AutoFillPlugin,\n DEFAULT_HEADER_MENU_ITEMS,\n DEFAULT_BODY_MENU_ITEMS,\n DEFAULT_COLUMN_SERIES_MENU_ITEMS\n} from '@visactor/vtable-plugins';\nimport type {\n FilterOptions,\n MenuItemOrSeparator,\n MenuClickEventArgs,\n AddRowColumnOptions,\n TableSeriesNumberOptions,\n IHighlightHeaderWhenSelectCellPluginOptions,\n ContextMenuOptions\n} from '@visactor/vtable-plugins';\nimport type { ISheetDefine, IColumnDefine, IVTableSheetOptions } from '../ts-types';\nimport { isValid } from '@visactor/vutils';\n\n/**\n * 获取表格插件列表\n * @param sheetDefine Sheet配置定义\n * @returns 插件数组\n */\nexport function getTablePlugins(\n sheetDefine?: ISheetDefine,\n options?: IVTableSheetOptions\n): VTable.plugins.IVTablePlugin[] {\n const plugins: VTable.plugins.IVTablePlugin[] = [];\n // 结合options.VTablePluginModules,来判断是否禁用插件\n const disabledPluginsUserSetted = options?.VTablePluginModules?.filter(module => module.disabled);\n let enabledPluginsUserSetted = options?.VTablePluginModules?.filter(module => !module.disabled);\n if (!disabledPluginsUserSetted?.some(module => module.module === FilterPlugin)) {\n const userPluginOptions = enabledPluginsUserSetted?.find(module => module.module === FilterPlugin)\n ?.moduleOptions as FilterOptions;\n const filterPlugin = createFilterPlugin(sheetDefine, userPluginOptions);\n plugins.push(filterPlugin);\n }\n if (!disabledPluginsUserSetted?.some(module => module.module === AddRowColumnPlugin)) {\n const userPluginOptions = enabledPluginsUserSetted?.find(module => module.module === AddRowColumnPlugin)\n ?.moduleOptions as AddRowColumnOptions;\n const addRowColumnPlugin = new AddRowColumnPlugin({\n addRowCallback: (row: number, tableInstance: VTable.ListTable) => {\n tableInstance.addRecord([], row - tableInstance.columnHeaderLevelCount);\n },\n ...userPluginOptions\n });\n plugins.push(addRowColumnPlugin);\n //已经初始化过的插件,从enabledPluginsUserSetted中移除\n enabledPluginsUserSetted = enabledPluginsUserSetted?.filter(module => module.module !== AddRowColumnPlugin);\n }\n if (!disabledPluginsUserSetted?.some(module => module.module === TableSeriesNumber)) {\n const userPluginOptions = enabledPluginsUserSetted?.find(module => module.module === TableSeriesNumber)\n ?.moduleOptions as TableSeriesNumberOptions;\n const tableSeriesNumberPlugin = new TableSeriesNumber({\n rowCount: sheetDefine?.rowCount || 100,\n colCount: sheetDefine?.columnCount || 100,\n dragOrder: sheetDefine?.dragOrder,\n rowSeriesNumberWidth: 30,\n colSeriesNumberHeight: 30,\n rowSeriesNumberCellStyle:\n sheetDefine?.theme?.rowSeriesNumberCellStyle || options?.theme?.rowSeriesNumberCellStyle,\n colSeriesNumberCellStyle:\n sheetDefine?.theme?.colSeriesNumberCellStyle || options?.theme?.colSeriesNumberCellStyle,\n ...userPluginOptions\n });\n plugins.push(tableSeriesNumberPlugin);\n //已经初始化过的插件,从enabledPluginsUserSetted中移除\n enabledPluginsUserSetted = enabledPluginsUserSetted?.filter(module => module.module !== TableSeriesNumber);\n }\n // 这个插件有个bug 先不启用 #4447\n // if (!disabledPlugins?.some(module => module.module === HighlightHeaderWhenSelectCellPlugin)) {\n // const userPluginOptions = enabledPlugins?.find(module => module.module === HighlightHeaderWhenSelectCellPlugin)\n // ?.moduleOptions as IHighlightHeaderWhenSelectCellPluginOptions;\n // const highlightHeaderWhenSelectCellPlugin = new HighlightHeaderWhenSelectCellPlugin({\n // colHighlight: true,\n // rowHighlight: true,\n // ...userPluginOptions\n // });\n // plugins.push(highlightHeaderWhenSelectCellPlugin); // 这个插件有个bug 先不启用 #4447\n // }\n if (!disabledPluginsUserSetted?.some(module => module.module === ContextMenuPlugin)) {\n const userPluginOptions = enabledPluginsUserSetted?.find(\n module => module.module === ContextMenuPlugin\n )?.moduleOptions;\n const contextMenuPlugin = createContextMenuItems(sheetDefine, userPluginOptions);\n plugins.push(contextMenuPlugin);\n //已经初始化过的插件,从enabledPluginsUserSetted中移除\n enabledPluginsUserSetted = enabledPluginsUserSetted?.filter(module => module.module !== ContextMenuPlugin);\n }\n if (!disabledPluginsUserSetted?.some(module => module.module === ExcelEditCellKeyboardPlugin)) {\n const userPluginOptions = enabledPluginsUserSetted?.find(\n module => module.module === ExcelEditCellKeyboardPlugin\n )?.moduleOptions;\n const excelEditCellKeyboardPlugin = new ExcelEditCellKeyboardPlugin(userPluginOptions);\n plugins.push(excelEditCellKeyboardPlugin);\n //已经初始化过的插件,从enabledPluginsUserSetted中移除\n enabledPluginsUserSetted = enabledPluginsUserSetted?.filter(\n module => module.module !== ExcelEditCellKeyboardPlugin\n );\n }\n if (!disabledPluginsUserSetted?.some(module => module.module === AutoFillPlugin)) {\n // const userPluginOptions = enabledPlugins?.find(\n // module => module.module === VTablePlugins.AutoFillPlugin\n // )?.moduleOptions;\n const autoFillPlugin = new AutoFillPlugin();\n plugins.push(autoFillPlugin);\n //已经初始化过的插件,从enabledPluginsUserSetted中移除\n enabledPluginsUserSetted = enabledPluginsUserSetted?.filter(module => module.module !== AutoFillPlugin);\n }\n if (enabledPluginsUserSetted?.length) {\n enabledPluginsUserSetted.forEach(\n (module: {\n module: new (options: any) => VTable.plugins.IVTablePlugin;\n moduleOptions: any;\n disabled: boolean;\n }) => {\n if (typeof module?.module === 'function') {\n // 检查是否为构造函数\n plugins.push(new module.module(module.moduleOptions));\n } else {\n console.error(`Invalid plugin: ${module.module}`);\n }\n }\n );\n }\n return plugins;\n}\n\n/**\n * 创建筛选插件(如果需要)\n * @param sheetDefine Sheet配置\n * @returns 筛选插件实例或null\n */\nfunction createFilterPlugin(sheetDefine?: ISheetDefine, userPluginOptions?: FilterOptions): FilterPlugin | null {\n // // 对象配置\n // if (typeof sheetDefine.filter === 'object') {\n // return new VTablePlugins.FilterPlugin({\n // filterIcon: sheetDefine.filter.filterIcon,\n // filteringIcon: sheetDefine.filter.filteringIcon,\n // enableFilter: createColumnFilterChecker(sheetDefine),\n // filterModes: sheetDefine.filter.filterModes\n // });\n // }\n return new FilterPlugin({\n enableFilter: createColumnFilterChecker(sheetDefine),\n ...userPluginOptions\n });\n}\n\n/**\n * 创建列级别筛选检查函数\n * @param sheetDefine Sheet配置\n * @returns 筛选检查函数\n */\nfunction createColumnFilterChecker(sheetDefine: ISheetDefine) {\n return (columnIndex: number, column: VTable.TYPES.ColumnDefine): boolean => {\n // 由于在 vtable-sheet,把列索引作为列的唯一标识 field,因此这里直接使用列索引\n if (columnIndex < 0 || !sheetDefine.columns || columnIndex >= sheetDefine.columns.length) {\n return false; // 默认启用,保持向后兼容\n }\n\n // 获取列定义配置\n const columnDefine = sheetDefine.columns[columnIndex] as IColumnDefine;\n const filter = !!(columnDefine?.filter ?? sheetDefine.filter);\n // 明确禁用检查\n return filter;\n };\n}\n\nfunction createContextMenuItems(sheetDefine: ISheetDefine, userPluginOptions?: ContextMenuOptions) {\n return new ContextMenuPlugin({\n headerCellMenuItems: [\n ...DEFAULT_HEADER_MENU_ITEMS,\n {\n text: '设置筛选器',\n menuKey: 'set_filter'\n },\n {\n text: '取消筛选器',\n menuKey: 'cancel_filter'\n },\n {\n text: '首行表头',\n menuKey: 'enable_first_row_as_header'\n },\n {\n text: '取消表头',\n menuKey: 'disable_first_row_as_header'\n }\n ],\n bodyCellMenuItems: [\n ...DEFAULT_BODY_MENU_ITEMS,\n {\n text: '启用首行表头',\n menuKey: 'enable_first_row_as_header'\n }\n ],\n columnSeriesNumberMenuItems: [\n ...DEFAULT_COLUMN_SERIES_MENU_ITEMS,\n {\n text: '首行表头',\n menuKey: 'enable_first_row_as_header'\n },\n {\n text: '取消表头',\n menuKey: 'disable_first_row_as_header'\n }\n ],\n beforeShowAdjustMenuItems: (\n menuItems: MenuItemOrSeparator[],\n table: VTable.ListTable,\n col: number,\n row: number\n ) => {\n let isColumnSeriesNumber = false;\n let isHeaderCell = false;\n let isBodyCell = false;\n\n if (!isValid(row)) {\n isColumnSeriesNumber = true;\n }\n if (isValid(col) && isValid(row)) {\n if (table.isHeader(col, row)) {\n isHeaderCell = true;\n } else {\n isBodyCell = true;\n }\n }\n if (isHeaderCell) {\n const column = table.options.columns[col] as IColumnDefine;\n if (column.filter ?? sheetDefine?.filter) {\n menuItems = menuItems.filter(item => typeof item === 'string' || item.menuKey !== 'set_filter');\n } else {\n menuItems = menuItems.filter(item => typeof item === 'string' || item.menuKey !== 'cancel_filter');\n }\n }\n\n if (isHeaderCell) {\n menuItems = menuItems.filter(item => typeof item === 'string' || item.menuKey !== 'enable_first_row_as_header');\n } else if (isBodyCell) {\n if (row === 0) {\n menuItems = menuItems.filter(\n item => typeof item === 'string' || item.menuKey !== 'disable_first_row_as_header'\n );\n } else {\n menuItems = menuItems.filter(\n item => typeof item === 'string' || item.menuKey !== 'enable_first_row_as_header'\n );\n }\n } else if (isColumnSeriesNumber) {\n if (table.isHeader(col, 0)) {\n menuItems = menuItems.filter(\n item => typeof item === 'string' || item.menuKey !== 'enable_first_row_as_header'\n );\n } else {\n menuItems = menuItems.filter(\n item => typeof item === 'string' || item.menuKey !== 'disable_first_row_as_header'\n );\n }\n }\n return menuItems;\n },\n menuClickCallback: {\n set_filter: (args: MenuClickEventArgs, table: VTable.ListTable) => {\n // 更新 sheetDefine 配置\n sheetDefine.columns[args.colIndex].filter = true;\n\n // 创建新的 options 对象,确保配置变化被正确传递\n const newOptions = {\n ...table.options,\n columns: table.options.columns.map((col: VTable.ColumnDefine, index: number) => {\n if (index === args.colIndex) {\n return { ...col, filter: true };\n }\n return col;\n })\n };\n // 更新表格配置\n table.updateOption(newOptions, { clearColWidthCache: false, clearRowHeightCache: false });\n },\n cancel_filter: (args: MenuClickEventArgs, table: VTable.ListTable) => {\n // 更新 sheetDefine 配置\n sheetDefine.columns[args.colIndex].filter = false;\n\n // 创建新的 options 对象,确保配置变化被正确传递\n const newOptions = {\n ...table.options,\n columns: table.options.columns.map((col: VTable.ColumnDefine, index: number) => {\n if (index === args.colIndex) {\n return { ...col, filter: false };\n }\n return col;\n })\n };\n\n // 更新表格配置\n table.updateOption(newOptions, { clearColWidthCache: false, clearRowHeightCache: false });\n },\n enable_first_row_as_header: (args: MenuClickEventArgs, table: VTable.ListTable) => {\n handleEnableFirstRowAsHeader(table);\n },\n disable_first_row_as_header: (args: MenuClickEventArgs, table: VTable.ListTable) => {\n handleDisableFirstRowAsHeader(table);\n }\n },\n ...userPluginOptions\n });\n}\n\n/**\n * 处理启用第一行作为表头\n */\nfunction handleEnableFirstRowAsHeader(table: VTable.ListTable): void {\n // 获取第一行数据\n const firstRecord = table.records[0] as string[];\n // 获取剩余数据\n const new_records = table.records.slice(1);\n //获取当前column\n const columns = table.columns;\n // 设置第一行为表头\n firstRecord.forEach((item, index) => {\n columns[index].title = item;\n });\n table.updateOption(Object.assign({}, table.options, { records: new_records, columns, showHeader: true }), {\n clearColWidthCache: false,\n clearRowHeightCache: false\n });\n // 更新渲染\n table.scenegraph.updateNextFrame();\n}\n\n/**\n * 处理禁用第一行作为表头\n */\nfunction handleDisableFirstRowAsHeader(table: VTable.ListTable): void {\n const columns = table.columns;\n const firstRecord: (string | number)[] = [];\n columns.forEach((col, index) => {\n firstRecord.push(col.title as string);\n });\n //像records中添加第一行\n const new_records = [firstRecord, ...table.records];\n table.updateOption(Object.assign({}, table.options, { records: new_records, columns, showHeader: false }), {\n clearColWidthCache: false,\n clearRowHeightCache: false\n });\n table.scenegraph.updateNextFrame();\n}\n"]}
1
+ {"version":3,"sources":["../src/core/table-plugins.ts"],"names":[],"mappings":";;;AACA,6DAWkC;AAWlC,6CAA2C;AAO3C,SAAgB,eAAe,CAC7B,WAA0B,EAC1B,OAA6B;;IAE7B,MAAM,OAAO,GAAmC,EAAE,CAAC;IAEnD,MAAM,yBAAyB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,mBAAmB,0CAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAClG,IAAI,wBAAwB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,mBAAmB,0CAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAChG,IAAI,CAAC,CAAA,yBAAyB,aAAzB,yBAAyB,uBAAzB,yBAAyB,CAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,6BAAY,CAAC,CAAA,EAAE;QAC9E,MAAM,iBAAiB,GAAG,MAAA,wBAAwB,aAAxB,wBAAwB,uBAAxB,wBAAwB,CAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,6BAAY,CAAC,0CAC9F,aAA8B,CAAC;QACnC,MAAM,YAAY,GAAG,kBAAkB,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;QACxE,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;KAC5B;IACD,IAAI,CAAC,CAAA,yBAAyB,aAAzB,yBAAyB,uBAAzB,yBAAyB,CAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,mCAAkB,CAAC,CAAA,EAAE;QACpF,MAAM,iBAAiB,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,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE;QACzG,kBAAkB,EAAE,KAAK;QACzB,mBAAmB,EAAE,KAAK;KAC3B,CAAC,CAAC;IACH,KAAK,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;AACrC,CAAC","file":"table-plugins.js","sourcesContent":["import type * as VTable from '@visactor/vtable';\nimport {\n FilterPlugin,\n AddRowColumnPlugin,\n TableSeriesNumber,\n HighlightHeaderWhenSelectCellPlugin,\n ContextMenuPlugin,\n ExcelEditCellKeyboardPlugin,\n AutoFillPlugin,\n DEFAULT_HEADER_MENU_ITEMS,\n DEFAULT_BODY_MENU_ITEMS,\n DEFAULT_COLUMN_SERIES_MENU_ITEMS\n} from '@visactor/vtable-plugins';\nimport type {\n FilterOptions,\n MenuItemOrSeparator,\n MenuClickEventArgs,\n AddRowColumnOptions,\n TableSeriesNumberOptions,\n IHighlightHeaderWhenSelectCellPluginOptions,\n ContextMenuOptions\n} from '@visactor/vtable-plugins';\nimport type { ISheetDefine, IColumnDefine, IVTableSheetOptions } from '../ts-types';\nimport { isValid } from '@visactor/vutils';\n\n/**\n * 获取表格插件列表\n * @param sheetDefine Sheet配置定义\n * @returns 插件数组\n */\nexport function getTablePlugins(\n sheetDefine?: ISheetDefine,\n options?: IVTableSheetOptions\n): VTable.plugins.IVTablePlugin[] {\n const plugins: VTable.plugins.IVTablePlugin[] = [];\n // 结合options.VTablePluginModules,来判断是否禁用插件\n const disabledPluginsUserSetted = options?.VTablePluginModules?.filter(module => module.disabled);\n let enabledPluginsUserSetted = options?.VTablePluginModules?.filter(module => !module.disabled);\n if (!disabledPluginsUserSetted?.some(module => module.module === FilterPlugin)) {\n const userPluginOptions = enabledPluginsUserSetted?.find(module => module.module === FilterPlugin)\n ?.moduleOptions as FilterOptions;\n const filterPlugin = createFilterPlugin(sheetDefine, userPluginOptions);\n plugins.push(filterPlugin);\n }\n if (!disabledPluginsUserSetted?.some(module => module.module === AddRowColumnPlugin)) {\n const userPluginOptions = enabledPluginsUserSetted?.find(module => module.module === AddRowColumnPlugin)\n ?.moduleOptions as AddRowColumnOptions;\n const addRowColumnPlugin = new AddRowColumnPlugin({\n addRowCallback: (row: number, tableInstance: VTable.ListTable) => {\n tableInstance.addRecord([], row - tableInstance.columnHeaderLevelCount);\n },\n ...userPluginOptions\n });\n plugins.push(addRowColumnPlugin);\n //已经初始化过的插件,从enabledPluginsUserSetted中移除\n enabledPluginsUserSetted = enabledPluginsUserSetted?.filter(module => module.module !== AddRowColumnPlugin);\n }\n if (!disabledPluginsUserSetted?.some(module => module.module === TableSeriesNumber)) {\n const userPluginOptions = enabledPluginsUserSetted?.find(module => module.module === TableSeriesNumber)\n ?.moduleOptions as TableSeriesNumberOptions;\n const tableSeriesNumberPlugin = new TableSeriesNumber({\n rowCount: sheetDefine?.rowCount || 100,\n colCount: sheetDefine?.columnCount || 100,\n dragOrder: sheetDefine?.dragOrder,\n rowSeriesNumberWidth: 30,\n colSeriesNumberHeight: 30,\n rowSeriesNumberCellStyle:\n sheetDefine?.theme?.rowSeriesNumberCellStyle || options?.theme?.rowSeriesNumberCellStyle,\n colSeriesNumberCellStyle:\n sheetDefine?.theme?.colSeriesNumberCellStyle || options?.theme?.colSeriesNumberCellStyle,\n ...userPluginOptions\n });\n plugins.push(tableSeriesNumberPlugin);\n //已经初始化过的插件,从enabledPluginsUserSetted中移除\n enabledPluginsUserSetted = enabledPluginsUserSetted?.filter(module => module.module !== TableSeriesNumber);\n }\n // 这个插件有个bug 先不启用 #4447\n // if (!disabledPlugins?.some(module => module.module === HighlightHeaderWhenSelectCellPlugin)) {\n // const userPluginOptions = enabledPlugins?.find(module => module.module === HighlightHeaderWhenSelectCellPlugin)\n // ?.moduleOptions as IHighlightHeaderWhenSelectCellPluginOptions;\n // const highlightHeaderWhenSelectCellPlugin = new HighlightHeaderWhenSelectCellPlugin({\n // colHighlight: true,\n // rowHighlight: true,\n // ...userPluginOptions\n // });\n // plugins.push(highlightHeaderWhenSelectCellPlugin); // 这个插件有个bug 先不启用 #4447\n // }\n if (!disabledPluginsUserSetted?.some(module => module.module === ContextMenuPlugin)) {\n const userPluginOptions = enabledPluginsUserSetted?.find(\n module => module.module === ContextMenuPlugin\n )?.moduleOptions;\n const contextMenuPlugin = createContextMenuItems(sheetDefine, userPluginOptions);\n plugins.push(contextMenuPlugin);\n //已经初始化过的插件,从enabledPluginsUserSetted中移除\n enabledPluginsUserSetted = enabledPluginsUserSetted?.filter(module => module.module !== ContextMenuPlugin);\n }\n if (!disabledPluginsUserSetted?.some(module => module.module === ExcelEditCellKeyboardPlugin)) {\n const userPluginOptions =\n enabledPluginsUserSetted?.find(module => module.module === ExcelEditCellKeyboardPlugin)?.moduleOptions ?? {};\n // let currentState_editingEditor: IEditor | null = null; //需要在keyDownBeforeCallback中保存下来,因为插件处理事件中会影响这个值(调用了completeEdit)\n // const keyDownBeforeCallback = function (this: ExcelEditCellKeyboardPlugin, event: KeyboardEvent) {\n // currentState_editingEditor = sheet.getActiveSheet()?.tableInstance?.editorManager.editingEditor;\n // };\n // // 注意:这里使用普通函数而不是箭头函数,这样才能通过 apply 正确绑定 this 为插件实例\n // const keyDownAfterCallback = function (this: ExcelEditCellKeyboardPlugin, event: KeyboardEvent) {\n // const eventKey = event.key.toLowerCase() as ExcelEditCellKeyboardResponse;\n // if (this.responseKeyboard.includes(eventKey)) {\n // if (\n // (currentState_editingEditor &&\n // eventKey !== ExcelEditCellKeyboardResponse.DELETE &&\n // eventKey !== ExcelEditCellKeyboardResponse.BACKSPACE) ||\n // (!currentState_editingEditor &&\n // (eventKey === ExcelEditCellKeyboardResponse.DELETE ||\n // eventKey === ExcelEditCellKeyboardResponse.BACKSPACE)) ||\n // sheet.formulaManager._formulaWorkingOnCell\n // ) {\n // event.stopPropagation();\n // event.preventDefault();\n // }\n // }\n // };\n // 创建插件时包含回调\n const excelEditCellKeyboardPlugin = new ExcelEditCellKeyboardPlugin(userPluginOptions);\n plugins.push(excelEditCellKeyboardPlugin);\n //已经初始化过的插件,从enabledPluginsUserSetted中移除\n enabledPluginsUserSetted = enabledPluginsUserSetted?.filter(\n module => module.module !== ExcelEditCellKeyboardPlugin\n );\n }\n if (!disabledPluginsUserSetted?.some(module => module.module === AutoFillPlugin)) {\n // const userPluginOptions = enabledPlugins?.find(\n // module => module.module === VTablePlugins.AutoFillPlugin\n // )?.moduleOptions;\n const autoFillPlugin = new AutoFillPlugin();\n plugins.push(autoFillPlugin);\n //已经初始化过的插件,从enabledPluginsUserSetted中移除\n enabledPluginsUserSetted = enabledPluginsUserSetted?.filter(module => module.module !== AutoFillPlugin);\n }\n if (enabledPluginsUserSetted?.length) {\n enabledPluginsUserSetted.forEach(\n (module: {\n module: new (options: any) => VTable.plugins.IVTablePlugin;\n moduleOptions: any;\n disabled: boolean;\n }) => {\n if (typeof module?.module === 'function') {\n // 检查是否为构造函数\n plugins.push(new module.module(module.moduleOptions));\n } else {\n console.error(`Invalid plugin: ${module.module}`);\n }\n }\n );\n }\n return plugins;\n}\n\n/**\n * 创建筛选插件(如果需要)\n * @param sheetDefine Sheet配置\n * @returns 筛选插件实例或null\n */\nfunction createFilterPlugin(sheetDefine?: ISheetDefine, userPluginOptions?: FilterOptions): FilterPlugin | null {\n // // 对象配置\n // if (typeof sheetDefine.filter === 'object') {\n // return new VTablePlugins.FilterPlugin({\n // filterIcon: sheetDefine.filter.filterIcon,\n // filteringIcon: sheetDefine.filter.filteringIcon,\n // enableFilter: createColumnFilterChecker(sheetDefine),\n // filterModes: sheetDefine.filter.filterModes\n // });\n // }\n return new FilterPlugin({\n enableFilter: createColumnFilterChecker(sheetDefine),\n ...userPluginOptions\n });\n}\n\n/**\n * 创建列级别筛选检查函数\n * @param sheetDefine Sheet配置\n * @returns 筛选检查函数\n */\nfunction createColumnFilterChecker(sheetDefine: ISheetDefine) {\n return (columnIndex: number, column: VTable.TYPES.ColumnDefine): boolean => {\n // 由于在 vtable-sheet,把列索引作为列的唯一标识 field,因此这里直接使用列索引\n if (columnIndex < 0 || !sheetDefine.columns || columnIndex >= sheetDefine.columns.length) {\n return false; // 默认启用,保持向后兼容\n }\n\n // 获取列定义配置\n const columnDefine = sheetDefine.columns[columnIndex] as IColumnDefine;\n const filter = !!(columnDefine?.filter ?? sheetDefine.filter);\n // 明确禁用检查\n return filter;\n };\n}\n\nfunction createContextMenuItems(sheetDefine: ISheetDefine, userPluginOptions?: ContextMenuOptions) {\n return new ContextMenuPlugin({\n headerCellMenuItems: [\n ...DEFAULT_HEADER_MENU_ITEMS,\n {\n text: '设置筛选器',\n menuKey: 'set_filter'\n },\n {\n text: '取消筛选器',\n menuKey: 'cancel_filter'\n },\n {\n text: '首行表头',\n menuKey: 'enable_first_row_as_header'\n },\n {\n text: '取消表头',\n menuKey: 'disable_first_row_as_header'\n }\n ],\n bodyCellMenuItems: [\n ...DEFAULT_BODY_MENU_ITEMS,\n {\n text: '启用首行表头',\n menuKey: 'enable_first_row_as_header'\n }\n ],\n columnSeriesNumberMenuItems: [\n ...DEFAULT_COLUMN_SERIES_MENU_ITEMS,\n {\n text: '首行表头',\n menuKey: 'enable_first_row_as_header'\n },\n {\n text: '取消表头',\n menuKey: 'disable_first_row_as_header'\n }\n ],\n beforeShowAdjustMenuItems: (\n menuItems: MenuItemOrSeparator[],\n table: VTable.ListTable,\n col: number,\n row: number\n ) => {\n let isColumnSeriesNumber = false;\n let isHeaderCell = false;\n let isBodyCell = false;\n\n if (!isValid(row)) {\n isColumnSeriesNumber = true;\n }\n if (isValid(col) && isValid(row)) {\n if (table.isHeader(col, row)) {\n isHeaderCell = true;\n } else {\n isBodyCell = true;\n }\n }\n if (isHeaderCell) {\n const column = table.options.columns[col] as IColumnDefine;\n if (column.filter ?? sheetDefine?.filter) {\n menuItems = menuItems.filter(item => typeof item === 'string' || item.menuKey !== 'set_filter');\n } else {\n menuItems = menuItems.filter(item => typeof item === 'string' || item.menuKey !== 'cancel_filter');\n }\n }\n\n if (isHeaderCell) {\n menuItems = menuItems.filter(item => typeof item === 'string' || item.menuKey !== 'enable_first_row_as_header');\n } else if (isBodyCell) {\n if (row === 0) {\n menuItems = menuItems.filter(\n item => typeof item === 'string' || item.menuKey !== 'disable_first_row_as_header'\n );\n } else {\n menuItems = menuItems.filter(\n item => typeof item === 'string' || item.menuKey !== 'enable_first_row_as_header'\n );\n }\n } else if (isColumnSeriesNumber) {\n if (table.isHeader(col, 0)) {\n menuItems = menuItems.filter(\n item => typeof item === 'string' || item.menuKey !== 'enable_first_row_as_header'\n );\n } else {\n menuItems = menuItems.filter(\n item => typeof item === 'string' || item.menuKey !== 'disable_first_row_as_header'\n );\n }\n }\n return menuItems;\n },\n menuClickCallback: {\n set_filter: (args: MenuClickEventArgs, table: VTable.ListTable) => {\n // 更新 sheetDefine 配置\n sheetDefine.columns[args.colIndex].filter = true;\n\n // 创建新的 options 对象,确保配置变化被正确传递\n const newOptions = {\n ...table.options,\n columns: table.options.columns.map((col: VTable.ColumnDefine, index: number) => {\n if (index === args.colIndex) {\n return { ...col, filter: true };\n }\n return col;\n })\n };\n // 更新表格配置\n table.updateOption(newOptions, { clearColWidthCache: false, clearRowHeightCache: false });\n },\n cancel_filter: (args: MenuClickEventArgs, table: VTable.ListTable) => {\n // 更新 sheetDefine 配置\n sheetDefine.columns[args.colIndex].filter = false;\n\n // 创建新的 options 对象,确保配置变化被正确传递\n const newOptions = {\n ...table.options,\n columns: table.options.columns.map((col: VTable.ColumnDefine, index: number) => {\n if (index === args.colIndex) {\n return { ...col, filter: false };\n }\n return col;\n })\n };\n\n // 更新表格配置\n table.updateOption(newOptions, { clearColWidthCache: false, clearRowHeightCache: false });\n },\n enable_first_row_as_header: (args: MenuClickEventArgs, table: VTable.ListTable) => {\n handleEnableFirstRowAsHeader(table);\n },\n disable_first_row_as_header: (args: MenuClickEventArgs, table: VTable.ListTable) => {\n handleDisableFirstRowAsHeader(table);\n }\n },\n ...userPluginOptions\n });\n}\n\n/**\n * 处理启用第一行作为表头\n */\nfunction handleEnableFirstRowAsHeader(table: VTable.ListTable): void {\n // 获取第一行数据\n const firstRecord = table.records[0] as string[];\n // 获取剩余数据\n const new_records = table.records.slice(1);\n //获取当前column\n const columns = table.columns;\n // 设置第一行为表头\n firstRecord.forEach((item, index) => {\n columns[index].title = item;\n });\n table.updateOption(Object.assign({}, table.options, { records: new_records, columns, showHeader: true }), {\n clearColWidthCache: false,\n clearRowHeightCache: false\n });\n // 更新渲染\n table.scenegraph.updateNextFrame();\n}\n\n/**\n * 处理禁用第一行作为表头\n */\nfunction handleDisableFirstRowAsHeader(table: VTable.ListTable): void {\n const columns = table.columns;\n const firstRecord: (string | number)[] = [];\n columns.forEach((col, index) => {\n firstRecord.push(col.title as string);\n });\n //像records中添加第一行\n const new_records = [firstRecord, ...table.records];\n table.updateOption(Object.assign({}, table.options, { records: new_records, columns, showHeader: false }), {\n clearColWidthCache: false,\n clearRowHeightCache: false\n });\n table.scenegraph.updateNextFrame();\n}\n"]}
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.6-alpha.1";
5
+ export declare const version = "1.22.6-alpha.2";
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.6-alpha.1", (0, style_manager_1.importStyles)();
50
+ exports.version = "1.22.6-alpha.2", (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.6-alpha.1\";\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.2\";\n// 导入样式\nimportStyles();\n/**\n * @namespace VTableSheet\n */\nexport { VTableSheet, TYPES, VTable, ISheetDefine, IVTableSheetOptions };\n"]}
@@ -47903,11 +47903,8 @@
47903
47903
  }, axisOption, {
47904
47904
  orient: "left",
47905
47905
  type: null !== (_e = null == axisOption ? void 0 : axisOption.type) && void 0 !== _e ? _e : "band",
47906
- label: {
47907
- flush: !0
47908
- },
47909
- inverse: transformInverse(axisOption, "horizontal" === (null !== (_f = null == spec ? void 0 : spec.direction) && void 0 !== _f ? _f : "scatter" === chartType ? "vertical" : "horizontal")),
47910
47906
  __vtableChartTheme: theme,
47907
+ inverse: transformInverse(axisOption, "horizontal" === (null !== (_f = null == spec ? void 0 : spec.direction) && void 0 !== _f ? _f : "scatter" === chartType ? "vertical" : "horizontal")),
47911
47908
  __vtableBodyChartCellPadding: bodyChartCellPadding
47912
47909
  });
47913
47910
  }
@@ -48034,9 +48031,6 @@
48034
48031
  }, axisOption, {
48035
48032
  orient: "bottom",
48036
48033
  type: null !== (_o = null == axisOption ? void 0 : axisOption.type) && void 0 !== _o ? _o : "band",
48037
- label: {
48038
- flush: !0
48039
- },
48040
48034
  __vtableChartTheme: theme,
48041
48035
  __vtableBodyChartCellPadding: bodyChartCellPadding
48042
48036
  });
@@ -48401,7 +48395,7 @@
48401
48395
  releaseColumnChartInstance = !0,
48402
48396
  releaseRowChartInstance = !0
48403
48397
  } = {}) {
48404
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
48398
+ var _a, _b, _c, _d, _e, _f;
48405
48399
  if (this.activeChartInstanceHoverOnMark = null, this.justShowMarkTooltip = void 0, this.justShowMarkTooltipTimer = Date.now(), clearTimeout(this.delayRunDimensionHoverTimer), this.delayRunDimensionHoverTimer = void 0, releaseChartInstance) {
48406
48400
  null === (_a = this.activeChartInstance) || void 0 === _a || _a.updateViewBox({
48407
48401
  x1: -1e3,
@@ -48410,16 +48404,11 @@
48410
48404
  y2: -800
48411
48405
  }, !1, !1), null === (_b = this.activeChartInstance) || void 0 === _b || _b.release(), this.activeChartInstance = null;
48412
48406
  const {
48413
- col: col,
48414
- row: row
48415
- } = this.parent;
48407
+ col: col,
48408
+ row: row
48409
+ } = this.parent,
48410
+ table = this.stage.table;
48416
48411
  table.internalProps.layoutMap.isAxisCell(table.rowHeaderLevelCount - 1, row) && (null === (_d = (_c = table.scenegraph.getCell(table.rowHeaderLevelCount - 1, row).firstChild).hideLabelHoverOnAxis) || void 0 === _d || _d.call(_c)), table.internalProps.layoutMap.isAxisCell(col, table.rowCount - table.bottomFrozenRowCount) && (null === (_f = (_e = table.scenegraph.getCell(col, table.rowCount - table.bottomFrozenRowCount).firstChild).hideLabelHoverOnAxis) || void 0 === _f || _f.call(_e));
48417
- } else {
48418
- const {
48419
- col: col,
48420
- row: row
48421
- } = this.parent;
48422
- releaseColumnChartInstance && table.internalProps.layoutMap.isAxisCell(col, table.rowCount - table.bottomFrozenRowCount) && (null === (_h = (_g = table.scenegraph.getCell(col, table.rowCount - table.bottomFrozenRowCount).firstChild).hideLabelHoverOnAxis) || void 0 === _h || _h.call(_g)), releaseRowChartInstance && table.internalProps.layoutMap.isAxisCell(table.rowHeaderLevelCount - 1, row) && (null === (_k = (_j = table.scenegraph.getCell(table.rowHeaderLevelCount - 1, row).firstChild).hideLabelHoverOnAxis) || void 0 === _k || _k.call(_j));
48423
48412
  }
48424
48413
  releaseColumnChartInstance && clearChartInstanceListByColumnDirection(this.parent.col, "scatter" === this.attribute.spec.type ? this.parent.row : void 0, table), releaseRowChartInstance && clearChartInstanceListByRowDirection(this.parent.row, "scatter" === this.attribute.spec.type ? this.parent.col : void 0, table);
48425
48414
  }
@@ -48544,7 +48533,7 @@
48544
48533
  tickMode: null === (_e = axis.tick) || void 0 === _e ? void 0 : _e.tickMode
48545
48534
  }
48546
48535
  }, !0);
48547
- }), null === (_c = null === (_b = table.internalProps.layoutMap) || void 0 === _b ? void 0 : _b.updateDataStateToActiveChartInstance) || void 0 === _c || _c.call(_b, chartInstance), "string" == typeof dataId || "number" == typeof dataId) chartInstance.getChart().setLayoutTag(!0), chartInstance.updateDataSync(dataId, null != data ? data : []);else {
48536
+ }), null === (_c = null === (_b = table.internalProps.layoutMap) || void 0 === _b ? void 0 : _b.updateDataStateToActiveChartInstance) || void 0 === _c || _c.call(_b, chartInstance), "string" == typeof dataId) chartInstance.getChart().setLayoutTag(!0), chartInstance.updateDataSync(dataId, null != data ? data : []);else {
48548
48537
  const dataBatch = [];
48549
48538
  for (const dataIdStr in dataId) {
48550
48539
  const dataIdAndField = dataId[dataIdStr],
@@ -48696,7 +48685,7 @@
48696
48685
  chartStage.needRender = !0;
48697
48686
  const matrix = chart.globalTransMatrix.clone(),
48698
48687
  stageMatrix = chart.stage.window.getViewBoxTransform().clone();
48699
- if (stageMatrix.multiply(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f), chartStage.window.setViewBoxTransform(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f), "string" == typeof dataId || "number" == typeof dataId) activeChartInstance.updateDataSync(dataId, null != data ? data : []);else {
48688
+ if (stageMatrix.multiply(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f), chartStage.window.setViewBoxTransform(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f), "string" == typeof dataId) activeChartInstance.updateDataSync(dataId, null != data ? data : []);else {
48700
48689
  const dataBatch = [];
48701
48690
  for (const dataIdStr in dataId) {
48702
48691
  const dataIdAndField = dataId[dataIdStr],
@@ -59675,7 +59664,7 @@
59675
59664
  }
59676
59665
  constructor(container, options = {}) {
59677
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;
59678
- if (super(), this.showFrozenIcon = !0, this.version = "1.22.6-alpha.1", 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.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");
59679
59668
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
59680
59669
  options: options,
59681
59670
  container: container
@@ -70687,27 +70676,30 @@
70687
70676
  document.addEventListener("keydown", this.handleKeyDown.bind(this), !0);
70688
70677
  }
70689
70678
  handleKeyDown(event) {
70690
- if (this.table.editorManager && this.isExcelShortcutKey(event)) if (this.table.editorManager.editingEditor && "keydown" === this.table.editorManager.beginTriggerEditCellMode) {
70691
- const {
70692
- col: col,
70693
- row: row
70694
- } = this.table.editorManager.editCell;
70695
- 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());
70696
- } else {
70697
- const {
70698
- col: col,
70699
- row: row
70700
- } = this.table.stateManager.select.cellPos;
70701
- if (!this.table.editorManager.editingEditor || event.key !== ExcelEditCellKeyboardResponse.ENTER && event.key !== ExcelEditCellKeyboardResponse.TAB) {
70702
- if (!this.table.editorManager.editingEditor && (event.key === ExcelEditCellKeyboardResponse.DELETE || event.key === ExcelEditCellKeyboardResponse.BACKSPACE)) {
70703
- const selectCells = this.table.getSelectedCellInfos();
70704
- (null == selectCells ? void 0 : selectCells.length) > 0 && deleteSelectRange(selectCells, this.table), event.stopPropagation(), event.preventDefault();
70705
- }
70706
- } 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 && document.activeElement === this.table.getElement() && (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
+ }
70707
70699
  }
70708
70700
  }
70709
70701
  isExcelShortcutKey(event) {
70710
- return this.responseKeyboard.includes(event.key);
70702
+ return this.responseKeyboard.includes(event.key.toLowerCase());
70711
70703
  }
70712
70704
  setResponseKeyboard(responseKeyboard) {
70713
70705
  this.responseKeyboard = responseKeyboard;
@@ -78029,7 +78021,7 @@
78029
78021
  enabledPluginsUserSetted = enabledPluginsUserSetted?.filter(module => module.module !== ContextMenuPlugin);
78030
78022
  }
78031
78023
  if (!disabledPluginsUserSetted?.some(module => module.module === ExcelEditCellKeyboardPlugin)) {
78032
- const userPluginOptions = enabledPluginsUserSetted?.find(module => module.module === ExcelEditCellKeyboardPlugin)?.moduleOptions;
78024
+ const userPluginOptions = enabledPluginsUserSetted?.find(module => module.module === ExcelEditCellKeyboardPlugin)?.moduleOptions ?? {};
78033
78025
  const excelEditCellKeyboardPlugin = new ExcelEditCellKeyboardPlugin(userPluginOptions);
78034
78026
  plugins.push(excelEditCellKeyboardPlugin);
78035
78027
  enabledPluginsUserSetted = enabledPluginsUserSetted?.filter(module => module.module !== ExcelEditCellKeyboardPlugin);
@@ -80861,7 +80853,7 @@
80861
80853
  importStyle();
80862
80854
  }
80863
80855
 
80864
- const version = "1.22.6-alpha.1";
80856
+ const version = "1.22.6-alpha.2";
80865
80857
  importStyles();
80866
80858
 
80867
80859
  exports.TYPES = index;