@visactor/vtable-plugins 1.23.1-alpha.2 → 1.23.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.
@@ -15,6 +15,7 @@ export type IExcelEditCellKeyboardPluginOptions = {
15
15
  id?: string;
16
16
  responseKeyboard?: ExcelEditCellKeyboardResponse[];
17
17
  deleteWorkOnEditableCell?: boolean;
18
+ batchCallChangeCellValuesApi?: boolean;
18
19
  };
19
20
  export declare class ExcelEditCellKeyboardPlugin implements pluginsDefinition.IVTablePlugin {
20
21
  id: string;
@@ -23,6 +24,7 @@ export declare class ExcelEditCellKeyboardPlugin implements pluginsDefinition.IV
23
24
  table: ListTable;
24
25
  pluginOptions: IExcelEditCellKeyboardPluginOptions;
25
26
  responseKeyboard: ExcelEditCellKeyboardResponse[];
27
+ batchCallChangeCellValuesApi: boolean;
26
28
  constructor(pluginOptions?: IExcelEditCellKeyboardPluginOptions);
27
29
  run(...args: [EventArg, TableEvents[keyof TableEvents] | TableEvents[keyof TableEvents][], BaseTableAPI]): void;
28
30
  bindEvent(): void;
@@ -17,10 +17,11 @@ var ExcelEditCellKeyboardResponse;
17
17
 
18
18
  class ExcelEditCellKeyboardPlugin {
19
19
  constructor(pluginOptions) {
20
- var _a, _b;
20
+ var _a, _b, _c;
21
21
  this.id = "excel-edit-cell-keyboard", this.name = "Excel Edit Cell Keyboard", this.runTime = [ vtable_1.TABLE_EVENT_TYPE.INITIALIZED ],
22
22
  this.id = null !== (_a = null == pluginOptions ? void 0 : pluginOptions.id) && void 0 !== _a ? _a : this.id,
23
23
  this.pluginOptions = pluginOptions, this.responseKeyboard = null !== (_b = null == pluginOptions ? void 0 : pluginOptions.responseKeyboard) && void 0 !== _b ? _b : [ ExcelEditCellKeyboardResponse.ENTER, ExcelEditCellKeyboardResponse.TAB, ExcelEditCellKeyboardResponse.ARROW_LEFT, ExcelEditCellKeyboardResponse.ARROW_RIGHT, ExcelEditCellKeyboardResponse.ARROW_DOWN, ExcelEditCellKeyboardResponse.ARROW_UP, ExcelEditCellKeyboardResponse.DELETE, ExcelEditCellKeyboardResponse.BACKSPACE ],
24
+ this.batchCallChangeCellValuesApi = null !== (_c = null == pluginOptions ? void 0 : pluginOptions.batchCallChangeCellValuesApi) && void 0 !== _c && _c,
24
25
  this.bindEvent();
25
26
  }
26
27
  run(...args) {
@@ -47,7 +48,7 @@ class ExcelEditCellKeyboardPlugin {
47
48
  (null == selectCells ? void 0 : selectCells.length) > 0 && (document.activeElement === this.table.getElement() || Object.values(this.table.editorManager.cacheLastSelectedCellEditor || {}).some((editor => {
48
49
  var _a;
49
50
  return (null === (_a = editor.getInputElement) || void 0 === _a ? void 0 : _a.call(editor)) === document.activeElement;
50
- }))) && (deleteSelectRange(selectCells, this.table, null === (_c = null === (_b = this.pluginOptions) || void 0 === _b ? void 0 : _b.deleteWorkOnEditableCell) || void 0 === _c || _c),
51
+ }))) && (deleteSelectRange(selectCells, this.table, null === (_c = null === (_b = this.pluginOptions) || void 0 === _b ? void 0 : _b.deleteWorkOnEditableCell) || void 0 === _c || _c, this.batchCallChangeCellValuesApi),
51
52
  event.stopPropagation(), event.preventDefault());
52
53
  }
53
54
  } else this.table.editorManager.completeEdit(), this.table.getElement().focus(),
@@ -73,8 +74,11 @@ class ExcelEditCellKeyboardPlugin {
73
74
  }
74
75
  }
75
76
 
76
- function deleteSelectRange(selectCells, tableInstance, workOnEditableCell = !1) {
77
- for (let i = 0; i < selectCells.length; i++) for (let j = 0; j < selectCells[i].length; j++) tableInstance.changeCellValue(selectCells[i][j].col, selectCells[i][j].row, "", workOnEditableCell);
77
+ function deleteSelectRange(selectCells, tableInstance, workOnEditableCell = !1, batchCallChangeCellValuesApi = !1) {
78
+ if (batchCallChangeCellValuesApi) {
79
+ const ranges = tableInstance.stateManager.select.ranges;
80
+ (null == ranges ? void 0 : ranges.length) && tableInstance.changeCellValuesByRanges(ranges, "", workOnEditableCell, !0);
81
+ } else for (let i = 0; i < selectCells.length; i++) for (let j = 0; j < selectCells[i].length; j++) tableInstance.changeCellValue(selectCells[i][j].col, selectCells[i][j].row, "", workOnEditableCell);
78
82
  }
79
83
 
80
84
  //# sourceMappingURL=excel-edit-cell-keyboard.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/excel-edit-cell-keyboard.ts"],"names":[],"mappings":";;;AACA,6CAAoD;AAIpD,IAAY,6BASX;AATD,WAAY,6BAA6B;IACvC,gDAAe,CAAA;IACf,4CAAW,CAAA;IACX,yDAAwB,CAAA;IACxB,2DAA0B,CAAA;IAC1B,yDAAwB,CAAA;IACxB,qDAAoB,CAAA;IACpB,kDAAiB,CAAA;IACjB,wDAAuB,CAAA;AACzB,CAAC,EATW,6BAA6B,GAA7B,qCAA6B,KAA7B,qCAA6B,QASxC;AAYD,MAAa,2BAA2B;IAOtC,YAAY,aAAmD;;QAN/D,OAAE,GAAG,0BAA0B,CAAC;QAChC,SAAI,GAAG,0BAA0B,CAAC;QAClC,YAAO,GAAG,CAAC,yBAAgB,CAAC,WAAW,CAAC,CAAC;QAKvC,IAAI,CAAC,EAAE,GAAG,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,EAAE,mCAAI,IAAI,CAAC,EAAE,CAAC;QACvC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,gBAAgB,GAAG,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,gBAAgB,mCAAI;YACzD,6BAA6B,CAAC,KAAK;YACnC,6BAA6B,CAAC,GAAG;YACjC,6BAA6B,CAAC,UAAU;YACxC,6BAA6B,CAAC,WAAW;YACzC,6BAA6B,CAAC,UAAU;YACxC,6BAA6B,CAAC,QAAQ;YACtC,6BAA6B,CAAC,MAAM;YACpC,6BAA6B,CAAC,SAAS;SACxC,CAAC;QAEF,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;IACD,GAAG,CAAC,GAAG,IAAiG;QACtG,MAAM,KAAK,GAAiB,IAA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,CAAC,WAAW,EAAmC,CAAC,CAAC;IAClG,CAAC;IACD,mBAAmB,CAAC,gBAAiD;QACnE,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC3C,CAAC;IACD,sBAAsB,CAAC,gBAAiD;QACtE,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/F,CAAC;IACD,mBAAmB,CAAC,gBAAiD;QACnE,IAAI,CAAC,gBAAgB,GAAG,CAAC,GAAG,IAAI,CAAC,gBAAgB,EAAE,GAAG,gBAAgB,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO;QACL,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IACpE,CAAC;CACF;AAvID,kEAuIC;AAED,SAAS,iBAAiB,CACxB,WAA+B,EAC/B,aAAwB,EACxB,qBAA8B,KAAK;IAEnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC9C,aAAa,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,EAAE,kBAAkB,CAAC,CAAC;SACrG;KACF;AACH,CAAC","file":"excel-edit-cell-keyboard.js","sourcesContent":["import type { ListTable, BaseTableAPI, TYPES, pluginsDefinition } from '@visactor/vtable';\nimport { TABLE_EVENT_TYPE } from '@visactor/vtable';\nimport type { TableEvents } from '@visactor/vtable/src/core/TABLE_EVENT_TYPE';\nimport type { EventArg } from './types';\nimport type { IEditor } from '@visactor/vtable-editors';\nexport enum ExcelEditCellKeyboardResponse {\n ENTER = 'enter',\n TAB = 'tab',\n ARROW_LEFT = 'arrowLeft',\n ARROW_RIGHT = 'arrowRight',\n ARROW_DOWN = 'arrowDown',\n ARROW_UP = 'arrowUp',\n DELETE = 'delete',\n BACKSPACE = 'backspace'\n}\n//备用 插件配置项 目前感觉都走默认逻辑就行\nexport type IExcelEditCellKeyboardPluginOptions = {\n id?: string;\n /** 该插件响应的键盘事件列表 */\n responseKeyboard?: ExcelEditCellKeyboardResponse[];\n /** 删除能力是否只应用到可编辑单元格 */\n deleteWorkOnEditableCell?: boolean;\n // keyDown_before?: (event: KeyboardEvent) => void;\n // keyDown_after?: (event: KeyboardEvent) => void;\n};\n\nexport class ExcelEditCellKeyboardPlugin implements pluginsDefinition.IVTablePlugin {\n id = `excel-edit-cell-keyboard`;\n name = 'Excel Edit Cell Keyboard';\n runTime = [TABLE_EVENT_TYPE.INITIALIZED];\n table: ListTable;\n pluginOptions: IExcelEditCellKeyboardPluginOptions;\n responseKeyboard: ExcelEditCellKeyboardResponse[];\n constructor(pluginOptions?: IExcelEditCellKeyboardPluginOptions) {\n this.id = pluginOptions?.id ?? this.id;\n this.pluginOptions = pluginOptions;\n this.responseKeyboard = pluginOptions?.responseKeyboard ?? [\n ExcelEditCellKeyboardResponse.ENTER,\n ExcelEditCellKeyboardResponse.TAB,\n ExcelEditCellKeyboardResponse.ARROW_LEFT,\n ExcelEditCellKeyboardResponse.ARROW_RIGHT,\n ExcelEditCellKeyboardResponse.ARROW_DOWN,\n ExcelEditCellKeyboardResponse.ARROW_UP,\n ExcelEditCellKeyboardResponse.DELETE,\n ExcelEditCellKeyboardResponse.BACKSPACE\n ];\n\n this.bindEvent();\n }\n run(...args: [EventArg, TableEvents[keyof TableEvents] | TableEvents[keyof TableEvents][], BaseTableAPI]) {\n const table: BaseTableAPI = args[2];\n this.table = table as ListTable;\n }\n\n bindEvent() {\n //监听document全局的keydown事件 捕获阶段监听 可以及时阻止事件传播和默认行为\n document.addEventListener('keydown', this.handleKeyDown.bind(this), true);\n // this.table.on('selected_cell', () => {\n // this.updateHighlight();\n // });\n\n // this.table.on('selected_clear', () => {\n // this.clearHighlight();\n // });\n\n // this.table.on('mousemove_table', () => {\n // if (this.table.stateManager.select.selecting) {\n // this.updateHighlight();\n // }\n // });\n }\n handleKeyDown(event: KeyboardEvent) {\n // this.pluginOptions?.keyDown_before?.(event);\n if (this.table?.editorManager && this.isExcelShortcutKey(event)) {\n const eventKey = event.key.toLowerCase() as ExcelEditCellKeyboardResponse;\n //判断是键盘触发编辑单元格的情况下,那么在编辑状态中切换方向需要选中下一个继续编辑\n if (this.table.editorManager.editingEditor && this.table.editorManager.beginTriggerEditCellMode === 'keydown') {\n const { col, row } = this.table.editorManager.editCell;\n if (eventKey !== ExcelEditCellKeyboardResponse.BACKSPACE && eventKey !== ExcelEditCellKeyboardResponse.DELETE) {\n this.table.editorManager.completeEdit();\n } else {\n //如果输入了删除或退格键,应正常删除输入框内容\n return;\n }\n this.table.getElement().focus();\n if (!event.shiftKey && !event.ctrlKey && !event.metaKey) {\n //有这些配合键,则不进行选中下一个单元格的行为 执行vtable内部逻辑\n if (eventKey === ExcelEditCellKeyboardResponse.ENTER) {\n this.table.selectCell(col, row + 1);\n } else if (eventKey === ExcelEditCellKeyboardResponse.TAB) {\n this.table.selectCell(col + 1, row);\n } else if (eventKey === ExcelEditCellKeyboardResponse.ARROW_LEFT) {\n this.table.selectCell(col - 1, row);\n } else if (eventKey === ExcelEditCellKeyboardResponse.ARROW_RIGHT) {\n this.table.selectCell(col + 1, row);\n } else if (eventKey === ExcelEditCellKeyboardResponse.ARROW_DOWN) {\n this.table.selectCell(col, row + 1);\n } else if (eventKey === ExcelEditCellKeyboardResponse.ARROW_UP) {\n this.table.selectCell(col, row - 1);\n }\n // 阻止事件传播和默认行为\n event.stopPropagation();\n event.preventDefault();\n }\n } else {\n const { col, row } = this.table.stateManager.select.cellPos;\n if (\n this.table.editorManager.editingEditor &&\n (eventKey === ExcelEditCellKeyboardResponse.ENTER || eventKey === ExcelEditCellKeyboardResponse.TAB)\n ) {\n this.table.editorManager.completeEdit();\n this.table.getElement().focus();\n if (eventKey === ExcelEditCellKeyboardResponse.ENTER) {\n this.table.selectCell(col, row + 1);\n } else if (eventKey === ExcelEditCellKeyboardResponse.TAB) {\n this.table.selectCell(col + 1, row);\n }\n // 阻止事件传播和默认行为\n event.stopPropagation();\n event.preventDefault();\n } else if (\n !this.table.editorManager.editingEditor &&\n (eventKey === ExcelEditCellKeyboardResponse.DELETE || eventKey === ExcelEditCellKeyboardResponse.BACKSPACE)\n ) {\n //响应删除键,删除\n const selectCells = this.table.getSelectedCellInfos();\n if (\n selectCells?.length > 0 &&\n (document.activeElement === this.table.getElement() ||\n Object.values(this.table.editorManager.cacheLastSelectedCellEditor || {}).some(\n // 处理情况:没有开始编辑但编辑器及编辑输入框已经存在的情况下(editCellTrigger为keydown)判断当前激活的是cacheLastSelectedCellEditor中的input也应该响应删除单元格\n (editor: IEditor) => editor.getInputElement?.() === document.activeElement\n ))\n ) {\n // 如果选中的是范围,则删除范围内的所有单元格\n deleteSelectRange(selectCells, this.table, this.pluginOptions?.deleteWorkOnEditableCell ?? true);\n // 阻止事件传播和默认行为\n event.stopPropagation();\n event.preventDefault();\n }\n }\n }\n }\n // this.pluginOptions?.keyDown_after?.apply(this, [event]);\n }\n // 判断event的keyCode是否是excel的快捷键\n isExcelShortcutKey(event: KeyboardEvent) {\n return this.responseKeyboard.includes(event.key.toLowerCase() as ExcelEditCellKeyboardResponse);\n }\n setResponseKeyboard(responseKeyboard: ExcelEditCellKeyboardResponse[]) {\n this.responseKeyboard = responseKeyboard;\n }\n deleteResponseKeyboard(responseKeyboard: ExcelEditCellKeyboardResponse[]) {\n this.responseKeyboard = this.responseKeyboard.filter(key => !responseKeyboard.includes(key));\n }\n addResponseKeyboard(responseKeyboard: ExcelEditCellKeyboardResponse[]) {\n this.responseKeyboard = [...this.responseKeyboard, ...responseKeyboard];\n }\n release() {\n document.removeEventListener('keydown', this.handleKeyDown, true);\n }\n}\n//将选中单元格的值设置为空\nfunction deleteSelectRange(\n selectCells: TYPES.CellInfo[][],\n tableInstance: ListTable,\n workOnEditableCell: boolean = false\n) {\n for (let i = 0; i < selectCells.length; i++) {\n for (let j = 0; j < selectCells[i].length; j++) {\n tableInstance.changeCellValue(selectCells[i][j].col, selectCells[i][j].row, '', workOnEditableCell);\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/excel-edit-cell-keyboard.ts"],"names":[],"mappings":";;;AACA,6CAAoD;AAIpD,IAAY,6BASX;AATD,WAAY,6BAA6B;IACvC,gDAAe,CAAA;IACf,4CAAW,CAAA;IACX,yDAAwB,CAAA;IACxB,2DAA0B,CAAA;IAC1B,yDAAwB,CAAA;IACxB,qDAAoB,CAAA;IACpB,kDAAiB,CAAA;IACjB,wDAAuB,CAAA;AACzB,CAAC,EATW,6BAA6B,GAA7B,qCAA6B,KAA7B,qCAA6B,QASxC;AAcD,MAAa,2BAA2B;IAQtC,YAAY,aAAmD;;QAP/D,OAAE,GAAG,0BAA0B,CAAC;QAChC,SAAI,GAAG,0BAA0B,CAAC;QAClC,YAAO,GAAG,CAAC,yBAAgB,CAAC,WAAW,CAAC,CAAC;QAMvC,IAAI,CAAC,EAAE,GAAG,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,EAAE,mCAAI,IAAI,CAAC,EAAE,CAAC;QACvC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,gBAAgB,GAAG,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,gBAAgB,mCAAI;YACzD,6BAA6B,CAAC,KAAK;YACnC,6BAA6B,CAAC,GAAG;YACjC,6BAA6B,CAAC,UAAU;YACxC,6BAA6B,CAAC,WAAW;YACzC,6BAA6B,CAAC,UAAU;YACxC,6B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IAAI,CAAC,CAAC;SAC9E;QACD,OAAO;KACR;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC9C,aAAa,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,EAAE,kBAAkB,CAAC,CAAC;SACrG;KACF;AACH,CAAC","file":"excel-edit-cell-keyboard.js","sourcesContent":["import type { ListTable, BaseTableAPI, TYPES, pluginsDefinition } from '@visactor/vtable';\nimport { TABLE_EVENT_TYPE } from '@visactor/vtable';\nimport type { TableEvents } from '@visactor/vtable/src/core/TABLE_EVENT_TYPE';\nimport type { EventArg } from './types';\nimport type { IEditor } from '@visactor/vtable-editors';\nexport enum ExcelEditCellKeyboardResponse {\n ENTER = 'enter',\n TAB = 'tab',\n ARROW_LEFT = 'arrowLeft',\n ARROW_RIGHT = 'arrowRight',\n ARROW_DOWN = 'arrowDown',\n ARROW_UP = 'arrowUp',\n DELETE = 'delete',\n BACKSPACE = 'backspace'\n}\n//备用 插件配置项 目前感觉都走默认逻辑就行\nexport type IExcelEditCellKeyboardPluginOptions = {\n id?: string;\n /** 该插件响应的键盘事件列表 */\n responseKeyboard?: ExcelEditCellKeyboardResponse[];\n /** 删除能力是否只应用到可编辑单元格 */\n deleteWorkOnEditableCell?: boolean;\n /** 删除范围时通过 changeCellValuesByRanges 批量更新,从而聚合成一次 change_cell_values 事件 */\n batchCallChangeCellValuesApi?: boolean;\n // keyDown_before?: (event: KeyboardEvent) => void;\n // keyDown_after?: (event: KeyboardEvent) => void;\n};\n\nexport class ExcelEditCellKeyboardPlugin implements pluginsDefinition.IVTablePlugin {\n id = `excel-edit-cell-keyboard`;\n name = 'Excel Edit Cell Keyboard';\n runTime = [TABLE_EVENT_TYPE.INITIALIZED];\n table: ListTable;\n pluginOptions: IExcelEditCellKeyboardPluginOptions;\n responseKeyboard: ExcelEditCellKeyboardResponse[];\n batchCallChangeCellValuesApi: boolean;\n constructor(pluginOptions?: IExcelEditCellKeyboardPluginOptions) {\n this.id = pluginOptions?.id ?? this.id;\n this.pluginOptions = pluginOptions;\n this.responseKeyboard = pluginOptions?.responseKeyboard ?? [\n ExcelEditCellKeyboardResponse.ENTER,\n ExcelEditCellKeyboardResponse.TAB,\n ExcelEditCellKeyboardResponse.ARROW_LEFT,\n ExcelEditCellKeyboardResponse.ARROW_RIGHT,\n ExcelEditCellKeyboardResponse.ARROW_DOWN,\n ExcelEditCellKeyboardResponse.ARROW_UP,\n ExcelEditCellKeyboardResponse.DELETE,\n ExcelEditCellKeyboardResponse.BACKSPACE\n ];\n\n this.batchCallChangeCellValuesApi = pluginOptions?.batchCallChangeCellValuesApi ?? false;\n\n this.bindEvent();\n }\n run(...args: [EventArg, TableEvents[keyof TableEvents] | TableEvents[keyof TableEvents][], BaseTableAPI]) {\n const table: BaseTableAPI = args[2];\n this.table = table as ListTable;\n }\n\n bindEvent() {\n //监听document全局的keydown事件 捕获阶段监听 可以及时阻止事件传播和默认行为\n document.addEventListener('keydown', this.handleKeyDown.bind(this), true);\n // this.table.on('selected_cell', () => {\n // this.updateHighlight();\n // });\n\n // this.table.on('selected_clear', () => {\n // this.clearHighlight();\n // });\n\n // this.table.on('mousemove_table', () => {\n // if (this.table.stateManager.select.selecting) {\n // this.updateHighlight();\n // }\n // });\n }\n handleKeyDown(event: KeyboardEvent) {\n // this.pluginOptions?.keyDown_before?.(event);\n if (this.table?.editorManager && this.isExcelShortcutKey(event)) {\n const eventKey = event.key.toLowerCase() as ExcelEditCellKeyboardResponse;\n //判断是键盘触发编辑单元格的情况下,那么在编辑状态中切换方向需要选中下一个继续编辑\n if (this.table.editorManager.editingEditor && this.table.editorManager.beginTriggerEditCellMode === 'keydown') {\n const { col, row } = this.table.editorManager.editCell;\n if (eventKey !== ExcelEditCellKeyboardResponse.BACKSPACE && eventKey !== ExcelEditCellKeyboardResponse.DELETE) {\n this.table.editorManager.completeEdit();\n } else {\n //如果输入了删除或退格键,应正常删除输入框内容\n return;\n }\n this.table.getElement().focus();\n if (!event.shiftKey && !event.ctrlKey && !event.metaKey) {\n //有这些配合键,则不进行选中下一个单元格的行为 执行vtable内部逻辑\n if (eventKey === ExcelEditCellKeyboardResponse.ENTER) {\n this.table.selectCell(col, row + 1);\n } else if (eventKey === ExcelEditCellKeyboardResponse.TAB) {\n this.table.selectCell(col + 1, row);\n } else if (eventKey === ExcelEditCellKeyboardResponse.ARROW_LEFT) {\n this.table.selectCell(col - 1, row);\n } else if (eventKey === ExcelEditCellKeyboardResponse.ARROW_RIGHT) {\n this.table.selectCell(col + 1, row);\n } else if (eventKey === ExcelEditCellKeyboardResponse.ARROW_DOWN) {\n this.table.selectCell(col, row + 1);\n } else if (eventKey === ExcelEditCellKeyboardResponse.ARROW_UP) {\n this.table.selectCell(col, row - 1);\n }\n // 阻止事件传播和默认行为\n event.stopPropagation();\n event.preventDefault();\n }\n } else {\n const { col, row } = this.table.stateManager.select.cellPos;\n if (\n this.table.editorManager.editingEditor &&\n (eventKey === ExcelEditCellKeyboardResponse.ENTER || eventKey === ExcelEditCellKeyboardResponse.TAB)\n ) {\n this.table.editorManager.completeEdit();\n this.table.getElement().focus();\n if (eventKey === ExcelEditCellKeyboardResponse.ENTER) {\n this.table.selectCell(col, row + 1);\n } else if (eventKey === ExcelEditCellKeyboardResponse.TAB) {\n this.table.selectCell(col + 1, row);\n }\n // 阻止事件传播和默认行为\n event.stopPropagation();\n event.preventDefault();\n } else if (\n !this.table.editorManager.editingEditor &&\n (eventKey === ExcelEditCellKeyboardResponse.DELETE || eventKey === ExcelEditCellKeyboardResponse.BACKSPACE)\n ) {\n //响应删除键,删除\n const selectCells = this.table.getSelectedCellInfos();\n if (\n selectCells?.length > 0 &&\n (document.activeElement === this.table.getElement() ||\n Object.values(this.table.editorManager.cacheLastSelectedCellEditor || {}).some(\n // 处理情况:没有开始编辑但编辑器及编辑输入框已经存在的情况下(editCellTrigger为keydown)判断当前激活的是cacheLastSelectedCellEditor中的input也应该响应删除单元格\n (editor: IEditor) => editor.getInputElement?.() === document.activeElement\n ))\n ) {\n // 如果选中的是范围,则删除范围内的所有单元格\n deleteSelectRange(\n selectCells,\n this.table,\n this.pluginOptions?.deleteWorkOnEditableCell ?? true,\n this.batchCallChangeCellValuesApi\n );\n // 阻止事件传播和默认行为\n event.stopPropagation();\n event.preventDefault();\n }\n }\n }\n }\n // this.pluginOptions?.keyDown_after?.apply(this, [event]);\n }\n // 判断event的keyCode是否是excel的快捷键\n isExcelShortcutKey(event: KeyboardEvent) {\n return this.responseKeyboard.includes(event.key.toLowerCase() as ExcelEditCellKeyboardResponse);\n }\n setResponseKeyboard(responseKeyboard: ExcelEditCellKeyboardResponse[]) {\n this.responseKeyboard = responseKeyboard;\n }\n deleteResponseKeyboard(responseKeyboard: ExcelEditCellKeyboardResponse[]) {\n this.responseKeyboard = this.responseKeyboard.filter(key => !responseKeyboard.includes(key));\n }\n addResponseKeyboard(responseKeyboard: ExcelEditCellKeyboardResponse[]) {\n this.responseKeyboard = [...this.responseKeyboard, ...responseKeyboard];\n }\n release() {\n document.removeEventListener('keydown', this.handleKeyDown, true);\n }\n}\n//将选中单元格的值设置为空\nfunction deleteSelectRange(\n selectCells: TYPES.CellInfo[][],\n tableInstance: ListTable,\n workOnEditableCell: boolean = false,\n batchCallChangeCellValuesApi: boolean = false\n) {\n if (batchCallChangeCellValuesApi) {\n const ranges = tableInstance.stateManager.select.ranges;\n if (ranges?.length) {\n tableInstance.changeCellValuesByRanges(ranges, '', workOnEditableCell, true);\n }\n return;\n }\n\n for (let i = 0; i < selectCells.length; i++) {\n for (let j = 0; j < selectCells[i].length; j++) {\n tableInstance.changeCellValue(selectCells[i][j].col, selectCells[i][j].row, '', workOnEditableCell);\n }\n }\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import * as VTable from '@visactor/vtable';
2
2
  import type { MasterDetailPluginOptions } from './types';
3
- export declare class MasterDetailPlugin implements VTable.plugins.IVTablePlugin {
3
+ import type { pluginsDefinition } from '@visactor/vtable';
4
+ export declare class MasterDetailPlugin implements pluginsDefinition.IVTablePlugin {
4
5
  id: string;
5
6
  name: string;
6
7
  runTime: ("sort_click" | "after_sort" | "before_init" | "initialized" | "after_update_cell_content_width" | "after_update_select_border_height")[];
@@ -246,9 +246,7 @@ class MasterDetailPlugin {
246
246
  }
247
247
  }
248
248
  setRecordChildren(children, col, row) {
249
- const recordIndex = this.table.getRecordIndexByCell(col, row);
250
- if (null == recordIndex) return;
251
- const realRecordIndex = "number" == typeof recordIndex ? recordIndex : recordIndex[0], record = this.table.dataSource.get(realRecordIndex);
249
+ const record = this.table.getCellOriginRecord(col, row);
252
250
  record && (record.children = children, this.expandRow(row, col), this.table.scenegraph.updateCellContent(col, row));
253
251
  }
254
252
  release() {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/master-detail-plugin/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA2C;AAG3C,mCAAuE;AACvE,mCAAsF;AACtF,qCAAyC;AACzC,qCAAwC;AACxC,yCAA6C;AAC7C,iEAA4D;AAC5D,yCAA4D;AAK5D,MAAa,kBAAkB;IAqB7B,YAAY,gBAA2C,EAAE;QApBzD,OAAE,GAAG,sBAAsB,CAAC;QAC5B,SAAI,GAAG,sBAAsB,CAAC;QAC9B,YAAO,GAAG;YACR,MAAM,CAAC,gBAAgB,CAAC,WAAW;YACnC,MAAM,CAAC,gBAAgB,CAAC,WAAW;YACnC,MAAM,CAAC,gBAAgB,CAAC,UAAU;YAClC,MAAM,CAAC,gBAAgB,CAAC,UAAU;YAClC,MAAM,CAAC,gBAAgB,C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AAC,kBAAkB,CAAC,OAAO,EAAE,CAAC;YAClC,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;SACrC;IACH,CAAC;CACF;AAhvBD,gDAgvBC","file":"core.js","sourcesContent":["import * as VTable from '@visactor/vtable';\r\nimport type { Group } from '@visactor/vtable/es/scenegraph/graphic/group';\r\nimport type { MasterDetailPluginOptions } from './types';\r\nimport { includesRecordIndex, findRecordIndexPosition } from './types';\r\nimport { getInternalProps, getRecordByRowIndex, getOriginalRowHeight } from './utils';\r\nimport { ConfigManager } from './config';\r\nimport { EventManager } from './events';\r\nimport { SubTableManager } from './subtable';\r\nimport { TableAPIExtensions } from './table-api-extensions';\r\nimport { bindMasterDetailCheckboxChange } from './checkbox';\r\n\r\n/**\r\n * 主从表插件核心类\r\n */\r\nexport class MasterDetailPlugin implements VTable.plugins.IVTablePlugin {\r\n id = `Master Detail Plugin`;\r\n name = 'Master Detail Plugin';\r\n runTime = [\r\n VTable.TABLE_EVENT_TYPE.BEFORE_INIT,\r\n VTable.TABLE_EVENT_TYPE.INITIALIZED,\r\n VTable.TABLE_EVENT_TYPE.SORT_CLICK,\r\n VTable.TABLE_EVENT_TYPE.AFTER_SORT,\r\n VTable.TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH,\r\n VTable.TABLE_EVENT_TYPE.AFTER_UPDATE_SELECT_BORDER_HEIGHT\r\n ];\r\n\r\n pluginOptions: MasterDetailPluginOptions;\r\n table: VTable.ListTable;\r\n private configManager: ConfigManager;\r\n private eventManager: EventManager;\r\n private subTableManager: SubTableManager;\r\n private tableAPIExtensions: TableAPIExtensions;\r\n private resizeObserver?: ResizeObserver;\r\n private checkboxCascadeCleanup: () => void;\r\n\r\n constructor(pluginOptions: MasterDetailPluginOptions = {}) {\r\n this.pluginOptions = pluginOptions;\r\n }\r\n run(...args: unknown[]): boolean | void {\r\n const eventArgs = args[0];\r\n const runTime = args[1];\r\n const table = args[2] as VTable.ListTable;\r\n\r\n if (runTime === VTable.TABLE_EVENT_TYPE.BEFORE_INIT) {\r\n this.table = table;\r\n this.initializeManagers();\r\n this.configManager.injectMasterDetailOptions(\r\n (eventArgs as { options: VTable.ListTableConstructorOptions }).options\r\n );\r\n } else if (runTime === VTable.TABLE_EVENT_TYPE.INITIALIZED) {\r\n this.setupMasterDetailFeatures();\r\n } else if (runTime === VTable.TABLE_EVENT_TYPE.SORT_CLICK) {\r\n // 排序前处理:保存展开状态并收起所有行\r\n this.eventManager.executeMasterDetailBeforeSort();\r\n return true;\r\n } else if (runTime === VTable.TABLE_EVENT_TYPE.AFTER_SORT) {\r\n // 排序后处理:恢复展开状态\r\n this.eventManager.executeMasterDetailAfterSort();\r\n } else if (runTime === VTable.TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH) {\r\n // 单元格内容处理\r\n this.eventManager.handleAfterUpdateCellContentWidth(eventArgs as any);\r\n } else if (runTime === VTable.TABLE_EVENT_TYPE.AFTER_UPDATE_SELECT_BORDER_HEIGHT) {\r\n // 高亮处理\r\n this.eventManager.handleAfterUpdateSelectBorderHeight(eventArgs as any);\r\n }\r\n }\r\n /**\r\n * 初始化管理器\r\n */\r\n private initializeManagers(): void {\r\n this.configManager = new ConfigManager(this.pluginOptions, this.table);\r\n this.eventManager = new EventManager(this.table);\r\n const enableCheckboxCascade = this.pluginOptions.enableCheckboxCascade ?? true;\r\n this.subTableManager = new SubTableManager(this.table, enableCheckboxCascade);\r\n\r\n // 设置配置管理器的行展开状态检查函数\r\n this.configManager.setRowExpandedChecker((row: number) => this.eventManager.isRowExpanded(row));\r\n // 设置配置管理器的展开行回调函数\r\n this.configManager.setExpandRowCallback((rowIndex: number) => this.expandRow(rowIndex));\r\n\r\n // 设置事件管理器的回调函数\r\n this.eventManager.setCallbacks({\r\n onUpdateSubTablePositions: () => this.subTableManager.recalculateAllSubTablePositions(),\r\n onUpdateSubTablePositionsForRow: () => this.subTableManager.updateSubTablePositionsForRowResize(),\r\n onExpandRow: (rowIndex: number, colIndex?: number) => this.expandRow(rowIndex, colIndex),\r\n onCollapseRow: (rowIndex: number, colIndex?: number) => this.collapseRow(rowIndex, colIndex),\r\n onCollapseRowToNoRealRecordIndex: (rowIndex: number) => this.collapseRowToNoRealRecordIndex(rowIndex),\r\n onToggleRowExpand: (rowIndex: number, colIndex?: number) => this.toggleRowExpand(rowIndex, colIndex),\r\n getOriginalRowHeight: (bodyRowIndex: number) => getOriginalRowHeight(this.table, bodyRowIndex)\r\n });\r\n\r\n // 设置子表管理器的回调函数\r\n this.subTableManager.setCallbacks({\r\n getDetailConfigForRecord: (record, bodyRowIndex) =>\r\n this.configManager.getDetailConfigForRecord(record, bodyRowIndex)\r\n });\r\n\r\n // 设置auto高度计算完成的回调\r\n this.subTableManager.setAutoHeightCallback((bodyRowIndex: number, newTotalHeight: number) => {\r\n this.handleAutoHeightUpdate(bodyRowIndex, newTotalHeight);\r\n });\r\n }\r\n\r\n /**\r\n * 设置主从表功能\r\n */\r\n private setupMasterDetailFeatures(): void {\r\n // 初始化内部属性\r\n this.initInternalProps();\r\n // 绑定事件处理器\r\n this.eventManager.bindEventHandlers();\r\n // 设置统一选择状态管理\r\n this.setupUnifiedSelectionManagement();\r\n // 扩展表格 API\r\n this.extendTableAPI();\r\n // 初始化checkbox联动功能\r\n this.initCheckboxCascade();\r\n }\r\n\r\n // 主表点击事件处理器引用\r\n private mainTableClickHandler?: () => void;\r\n\r\n /**\r\n * 设置统一选中状态管理\r\n */\r\n private setupUnifiedSelectionManagement(): void {\r\n // 绑定主表的点击事件,清除所有子表选中状态\r\n this.mainTableClickHandler = () => {\r\n this.clearAllSubTableVisibleSelections();\r\n };\r\n this.table.on('click_cell', this.mainTableClickHandler);\r\n }\r\n\r\n /**\r\n * 初始化checkbox联动功能\r\n * 设置主从表之间的复选框状态同步,并保存清理函数以便后续释放资源\r\n */\r\n private initCheckboxCascade(): void {\r\n // 检查是否启用checkbox级联功能,默认为 true\r\n const enableCheckboxCascade = this.pluginOptions.enableCheckboxCascade ?? true;\r\n if (enableCheckboxCascade) {\r\n // 设置checkbox联动并保存清理函数\r\n this.checkboxCascadeCleanup = bindMasterDetailCheckboxChange(this.table, this.eventManager);\r\n }\r\n }\r\n\r\n /**\r\n * 初始化内部属性\r\n */\r\n private initInternalProps(): void {\r\n const internalProps = getInternalProps(this.table);\r\n internalProps.expandedRecordIndices = [];\r\n internalProps.subTableInstances = new Map();\r\n internalProps.originalRowHeights = new Map();\r\n internalProps.subTableCheckboxStates = new Map();\r\n }\r\n\r\n /**\r\n * 扩展表格 API\r\n */\r\n private extendTableAPI(): void {\r\n // 创建 TableAPIExtensions 实例\r\n this.tableAPIExtensions = new TableAPIExtensions(this.table, this.configManager, this.eventManager, {\r\n addUnderlineToCell: (cellGroup: Group) => this.addUnderlineToCell(cellGroup),\r\n updateOriginalHeightsAfterAdaptive: (\r\n expandedRowsInfo: Map<number, { baseHeight: number; detailHeight: number }>\r\n ) => this.updateOriginalHeightsAfterAdaptive(expandedRowsInfo),\r\n collapseRowToNoRealRecordIndex: (rowIndex: number) => this.collapseRowToNoRealRecordIndex(rowIndex),\r\n expandRow: (rowIndex: number) => this.expandRow(rowIndex),\r\n restoreExpandedStatesAfter: () => this.restoreExpandedStatesAfter(),\r\n collapseRow: (rowIndex: number) => this.collapseRow(rowIndex),\r\n updateSubTablePositions: () => this.subTableManager.recalculateAllSubTablePositions(),\r\n updateRowHeightForExpand: (rowIndex: number, deltaHeight: number) =>\r\n this.updateRowHeightForExpand(rowIndex, deltaHeight)\r\n });\r\n\r\n // 执行API扩展\r\n this.tableAPIExtensions.extendTableAPI();\r\n }\r\n\r\n /**\r\n * 在 adaptive 处理后更新原始高度缓存\r\n */\r\n private updateOriginalHeightsAfterAdaptive(\r\n expandedRowsInfo: Map<number, { baseHeight: number; detailHeight: number }>\r\n ): void {\r\n const internalProps = getInternalProps(this.table);\r\n // 更新展开行的原始高度缓存\r\n for (const [rowIndex, info] of expandedRowsInfo) {\r\n const bodyRowIndex = rowIndex - this.table.columnHeaderLevelCount;\r\n if (internalProps.originalRowHeights) {\r\n // 将新的基础高度设置为原始高度\r\n internalProps.originalRowHeights.set(bodyRowIndex, info.baseHeight);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * 分页后恢复展开状态\r\n */\r\n private restoreExpandedStatesAfter(): void {\r\n const internalProps = getInternalProps(this.table);\r\n if (!internalProps.expandedRecordIndices || internalProps.expandedRecordIndices.length === 0) {\r\n return;\r\n }\r\n const currentPagerData = this.table.dataSource._currentPagerIndexedData;\r\n if (!currentPagerData) {\r\n return;\r\n }\r\n internalProps.expandedRecordIndices.forEach(recordIndex => {\r\n try {\r\n const bodyRowIndex = this.table.getBodyRowIndexByRecordIndex(recordIndex);\r\n if (bodyRowIndex >= 0) {\r\n const targetRowIndex = bodyRowIndex + this.table.columnHeaderLevelCount;\r\n this.expandRow(targetRowIndex);\r\n }\r\n } catch (error) {\r\n console.warn(`处理记录索引 ${recordIndex} 时出错:`, error);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * 展开行\r\n * @param rowIndex 行索引\r\n * @param colIndex 列索引\r\n */\r\n expandRow(rowIndex: number, colIndex?: number): void {\r\n const bodyRowIndex = rowIndex - this.table.columnHeaderLevelCount;\r\n const internalProps = getInternalProps(this.table);\r\n if (this.eventManager.isRowExpanded(rowIndex)) {\r\n return;\r\n }\r\n\r\n const realRecordIndex = this.table.getRecordIndexByCell(0, rowIndex);\r\n if (realRecordIndex === undefined || realRecordIndex === null) {\r\n return;\r\n }\r\n // 更新展开行的数据源\r\n if (internalProps.expandedRecordIndices) {\r\n if (!includesRecordIndex(internalProps.expandedRecordIndices, realRecordIndex)) {\r\n internalProps.expandedRecordIndices.push(realRecordIndex);\r\n }\r\n }\r\n // 更新展开状态数组\r\n this.eventManager.addExpandedRow(rowIndex);\r\n\r\n const originalHeight = this.table.getRowHeight(rowIndex);\r\n if (internalProps.originalRowHeights) {\r\n const oldCellGroup = this.table.scenegraph.getCell(colIndex, rowIndex);\r\n // console.log(bodyRowIndex,oldCellGroup)\r\n internalProps.originalRowHeights.set(bodyRowIndex, originalHeight);\r\n }\r\n const record = getRecordByRowIndex(this.table, bodyRowIndex);\r\n const detailConfig = this.configManager.getDetailConfigForRecord(record, bodyRowIndex);\r\n const height = detailConfig?.style?.height || 300;\r\n\r\n const childrenData = Array.isArray(record.children) ? record.children : [];\r\n\r\n // 处理初始高度:如果是auto,先用默认值300展开\r\n const isAutoHeight = height === 'auto';\r\n const deltaHeight = isAutoHeight ? 300 : typeof height === 'number' ? height : 300;\r\n this.updateRowHeightForExpand(rowIndex, deltaHeight);\r\n this.table.scenegraph.updateContainerHeight(rowIndex, deltaHeight);\r\n internalProps._heightResizedRowMap.add(rowIndex);\r\n if (rowIndex === 96) {\r\n console.log('wokk');\r\n }\r\n this.subTableManager.renderSubTable(bodyRowIndex, childrenData, (record, bodyRowIndex) =>\r\n this.configManager.getDetailConfigForRecord(record, bodyRowIndex)\r\n );\r\n\r\n if (rowIndex !== this.table.rowCount - 1) {\r\n this.drawUnderlineForRow(rowIndex);\r\n }\r\n this.refreshRowIcon(rowIndex, colIndex);\r\n if (this.table.heightMode === 'adaptive') {\r\n this.table.scenegraph.dealHeightMode();\r\n }\r\n // 更新冻结线高度\r\n this.updateFrozenColumnShadowHeight();\r\n }\r\n\r\n /**\r\n * 处理auto高度更新\r\n * 当子表计算出实际内容高度后,更新主表行高\r\n */\r\n private handleAutoHeightUpdate(bodyRowIndex: number, newTotalHeight: number): void {\r\n try {\r\n const rowIndex = bodyRowIndex + this.table.columnHeaderLevelCount;\r\n // 获取当前行高\r\n const currentRowHeight = this.table.getRowHeight(rowIndex);\r\n const internalProps = getInternalProps(this.table);\r\n const originalHeight = internalProps.originalRowHeights?.get(bodyRowIndex) || 0;\r\n const currentDetailHeight = currentRowHeight - originalHeight;\r\n // 计算需要调整的高度差\r\n const heightDifference = newTotalHeight - currentDetailHeight;\r\n this.updateRowHeightForExpand(rowIndex, heightDifference);\r\n this.table.scenegraph.updateContainerHeight(rowIndex, heightDifference);\r\n } catch (error) {\r\n console.warn('Error in auto height update:', error);\r\n }\r\n }\r\n\r\n /**\r\n * 收起行\r\n * @param rowIndex 行索引\r\n * @param colIndex 列索引\r\n */\r\n collapseRow(rowIndex: number, colIndex?: number): void {\r\n const bodyRowIndex = rowIndex - this.table.columnHeaderLevelCount;\r\n const internalProps = getInternalProps(this.table);\r\n\r\n if (!this.eventManager.isRowExpanded(rowIndex)) {\r\n return;\r\n }\r\n\r\n const realRecordIndex = this.table.getRecordIndexByCell(0, rowIndex);\r\n if (realRecordIndex === undefined || realRecordIndex === null) {\r\n return;\r\n }\r\n // 更新展开行的数据源\r\n this.subTableManager.removeSubTable(bodyRowIndex);\r\n if (internalProps.expandedRecordIndices) {\r\n const index = findRecordIndexPosition(internalProps.expandedRecordIndices, realRecordIndex);\r\n if (index > -1) {\r\n internalProps.expandedRecordIndices.splice(index, 1);\r\n }\r\n }\r\n\r\n // 更新展开状态数组\r\n this.eventManager.removeExpandedRow(rowIndex);\r\n\r\n const currentHeight = this.table.getRowHeight(rowIndex);\r\n const originalHeight = getOriginalRowHeight(this.table, bodyRowIndex);\r\n const deltaHeight = currentHeight - originalHeight;\r\n this.updateRowHeightForExpand(rowIndex, -deltaHeight);\r\n internalProps._heightResizedRowMap.delete(rowIndex);\r\n this.table.scenegraph.updateContainerHeight(rowIndex, -deltaHeight);\r\n if (internalProps.originalRowHeights) {\r\n internalProps.originalRowHeights.delete(bodyRowIndex);\r\n }\r\n if (rowIndex !== this.table.rowCount - 1) {\r\n this.removeUnderlineFromRow(rowIndex);\r\n }\r\n this.refreshRowIcon(rowIndex, colIndex);\r\n if (this.table.heightMode === 'adaptive') {\r\n this.table.scenegraph.dealHeightMode();\r\n }\r\n // 更新冻结线高度\r\n this.updateFrozenColumnShadowHeight();\r\n }\r\n\r\n /**\r\n * 收起行(不修改expandedRecordIndices)\r\n */\r\n private collapseRowToNoRealRecordIndex(rowIndex: number): void {\r\n const bodyRowIndex = rowIndex - this.table.columnHeaderLevelCount;\r\n const internalProps = getInternalProps(this.table);\r\n\r\n if (!this.eventManager.isRowExpanded(rowIndex)) {\r\n return;\r\n }\r\n this.subTableManager.removeSubTable(bodyRowIndex);\r\n this.eventManager.removeExpandedRow(rowIndex);\r\n const currentHeight = this.table.getRowHeight(rowIndex);\r\n const originalHeight = getOriginalRowHeight(this.table, bodyRowIndex);\r\n const deltaHeight = currentHeight - originalHeight;\r\n this.updateRowHeightForExpand(rowIndex, -deltaHeight);\r\n internalProps._heightResizedRowMap.delete(rowIndex);\r\n this.table.scenegraph.updateContainerHeight(rowIndex, -deltaHeight);\r\n if (internalProps.originalRowHeights) {\r\n internalProps.originalRowHeights.delete(bodyRowIndex);\r\n }\r\n\r\n if (rowIndex !== this.table.rowCount - 1) {\r\n this.removeUnderlineFromRow(rowIndex);\r\n }\r\n this.refreshRowIcon(rowIndex);\r\n if (this.table.heightMode === 'adaptive') {\r\n this.table.scenegraph.dealHeightMode();\r\n }\r\n // 更新冻结线高度\r\n this.updateFrozenColumnShadowHeight();\r\n }\r\n\r\n /**\r\n * 切换行展开状态\r\n * @param rowIndex 行索引\r\n * @param colIndex 列索引\r\n */\r\n toggleRowExpand(rowIndex: number, colIndex?: number): void {\r\n if (this.eventManager.isRowExpanded(rowIndex)) {\r\n this.collapseRow(rowIndex, colIndex);\r\n } else {\r\n this.expandRow(rowIndex, colIndex);\r\n }\r\n }\r\n\r\n /**\r\n * 更新行高用于展开\r\n */\r\n private updateRowHeightForExpand(rowIndex: number, deltaHeight: number): void {\r\n this.table._setRowHeight(rowIndex, this.table.getRowHeight(rowIndex) + deltaHeight, true);\r\n\r\n // 更新以下行的位置\r\n const rowStart = rowIndex + 1;\r\n let rowEnd = 0;\r\n\r\n if (rowIndex < this.table.frozenRowCount) {\r\n rowEnd = this.table.frozenRowCount - 1;\r\n } else if (rowIndex >= this.table.rowCount - this.table.bottomFrozenRowCount) {\r\n rowEnd = this.table.rowCount - 1;\r\n } else {\r\n rowEnd = Math.min(\r\n (this.table.scenegraph as { proxy: { rowEnd: number } }).proxy.rowEnd,\r\n this.table.rowCount - this.table.bottomFrozenRowCount - 1\r\n );\r\n }\r\n\r\n for (let colIndex = 0; colIndex < this.table.colCount; colIndex++) {\r\n for (let rowIdx = rowStart; rowIdx <= rowEnd; rowIdx++) {\r\n const cellGroup = this.table.scenegraph.highPerformanceGetCell(colIndex, rowIdx);\r\n if (cellGroup.role === 'cell') {\r\n cellGroup.setAttribute('y', cellGroup.attribute.y + deltaHeight);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * 为指定行绘制下划线\r\n */\r\n private drawUnderlineForRow(rowIndex: number): void {\r\n const sceneGraph = this.table.scenegraph;\r\n if (!sceneGraph) {\r\n return;\r\n }\r\n // 获取指定行的所有cell\r\n const rowCells = this.getRowCells(rowIndex);\r\n if (rowCells.length === 0) {\r\n return;\r\n }\r\n rowCells.forEach((cellGroup: Group, index: number) => {\r\n if (cellGroup && cellGroup.attribute) {\r\n this.addUnderlineToCell(cellGroup);\r\n }\r\n });\r\n // 触发重新渲染\r\n this.table.scenegraph.updateNextFrame();\r\n }\r\n\r\n /**\r\n * 获取指定行的所有cell元素\r\n */\r\n private getRowCells(rowIndex: number): Group[] {\r\n const cells: Group[] = [];\r\n for (let col = 0; col < this.table.colCount; col++) {\r\n const cellGroup = this.table.scenegraph.getCell(col, rowIndex);\r\n if (cellGroup && cellGroup.role === 'cell') {\r\n cells.push(cellGroup);\r\n }\r\n }\r\n return cells;\r\n }\r\n\r\n /**\r\n * 为cell添加下划线\r\n */\r\n private addUnderlineToCell(cellGroup: any): void {\r\n const currentAttr = cellGroup.attribute;\r\n const currentStrokeArrayWidth =\r\n currentAttr.strokeArrayWidth ||\r\n (currentAttr.lineWidth\r\n ? [currentAttr.lineWidth, currentAttr.lineWidth, currentAttr.lineWidth, currentAttr.lineWidth]\r\n : [1, 1, 1, 1]);\r\n const currentStrokeArrayColor =\r\n currentAttr.strokeArrayColor ||\r\n (currentAttr.stroke\r\n ? [currentAttr.stroke, currentAttr.stroke, currentAttr.stroke, currentAttr.stroke]\r\n : ['transparent', 'transparent', 'transparent', 'transparent']);\r\n const isAlreadyEnhanced = cellGroup._hasUnderline;\r\n if (!isAlreadyEnhanced) {\r\n cellGroup._originalStrokeArrayWidth = [...currentStrokeArrayWidth];\r\n cellGroup._originalStrokeArrayColor = [...currentStrokeArrayColor];\r\n cellGroup._hasUnderline = true;\r\n }\r\n const originalStrokeArrayWidth = cellGroup._originalStrokeArrayWidth || currentStrokeArrayWidth;\r\n const originalStrokeArrayColor = cellGroup._originalStrokeArrayColor || currentStrokeArrayColor;\r\n const enhancedStrokeArrayWidth = [...originalStrokeArrayWidth];\r\n const enhancedStrokeArrayColor = [...originalStrokeArrayColor];\r\n const enhancedWidth = ((originalStrokeArrayWidth[2] || 1) * 0.75 + (originalStrokeArrayWidth[0] || 1) * 0.75) * 2;\r\n enhancedStrokeArrayWidth[2] = enhancedWidth;\r\n if (originalStrokeArrayColor[2] === 'transparent' || !originalStrokeArrayColor[2]) {\r\n const theme = this.table.theme;\r\n enhancedStrokeArrayColor[2] = theme?.bodyStyle?.borderColor || '#e1e4e8';\r\n } else {\r\n enhancedStrokeArrayColor[2] = originalStrokeArrayColor[2];\r\n }\r\n cellGroup.setAttributes({\r\n strokeArrayWidth: enhancedStrokeArrayWidth,\r\n strokeArrayColor: enhancedStrokeArrayColor,\r\n stroke: true\r\n });\r\n }\r\n\r\n /**\r\n * 删除展开行的下划线\r\n */\r\n private removeUnderlineFromRow(rowIndex: number): void {\r\n const rowCells = this.getRowCells(rowIndex);\r\n rowCells.forEach((cellGroup: any, index: number) => {\r\n if (cellGroup && cellGroup._hasUnderline) {\r\n this.removeUnderlineFromCell(cellGroup);\r\n }\r\n });\r\n this.table.scenegraph.updateNextFrame();\r\n }\r\n\r\n /**\r\n * 从cell中删除下划线\r\n */\r\n private removeUnderlineFromCell(cellGroup: any): void {\r\n if (cellGroup._hasUnderline) {\r\n // 恢复原始的strokeArray样式\r\n if (cellGroup._originalStrokeArrayWidth && cellGroup._originalStrokeArrayColor) {\r\n cellGroup.setAttributes({\r\n strokeArrayWidth: cellGroup._originalStrokeArrayWidth,\r\n strokeArrayColor: cellGroup._originalStrokeArrayColor\r\n });\r\n delete cellGroup._originalStrokeArrayWidth;\r\n delete cellGroup._originalStrokeArrayColor;\r\n }\r\n // 清除下划线标记\r\n cellGroup._hasUnderline = false;\r\n }\r\n }\r\n\r\n /**\r\n * 刷新行图标\r\n * @param rowIndex 行索引\r\n * @param colIndex 列索引\r\n */\r\n private refreshRowIcon(rowIndex: number, colIndex?: number): void {\r\n let targetColumnIndex: number;\r\n if (typeof colIndex === 'number') {\r\n targetColumnIndex = colIndex;\r\n } else {\r\n const hasRowSeriesNumber = !!this.table.options.rowSeriesNumber;\r\n targetColumnIndex = hasRowSeriesNumber ? 1 : 0;\r\n }\r\n\r\n const record = this.table.getCellOriginRecord(targetColumnIndex, rowIndex);\r\n if (record && typeof record === 'object') {\r\n const recordObj = record as Record<string, unknown>;\r\n const HierarchyState = VTable.TYPES.HierarchyState;\r\n const isExpanded = this.eventManager.isRowExpanded(rowIndex);\r\n recordObj.hierarchyState = isExpanded ? HierarchyState.expand : HierarchyState.collapse;\r\n this.table.scenegraph.updateHierarchyIcon(targetColumnIndex, rowIndex);\r\n }\r\n }\r\n\r\n /**\r\n * 设置记录的子数据并展开\r\n */\r\n setRecordChildren(children: unknown[], col: number, row: number): void {\r\n // 获取原始记录数据\r\n const recordIndex = this.table.getRecordIndexByCell(col, row);\r\n if (recordIndex === undefined || recordIndex === null) {\r\n console.warn('Invalid row, cannot get record index');\r\n return;\r\n }\r\n\r\n const realRecordIndex = typeof recordIndex === 'number' ? recordIndex : recordIndex[0];\r\n const record = this.table.dataSource.get(realRecordIndex);\r\n if (!record) {\r\n console.warn('Cannot find record for index:', realRecordIndex);\r\n return;\r\n }\r\n\r\n // 直接修改原始记录的 children 属性\r\n (record as Record<string, unknown>).children = children;\r\n this.expandRow(row, col);\r\n this.table.scenegraph.updateCellContent(col, row);\r\n }\r\n\r\n release(): void {\r\n // 设置释放标志\r\n const internalProps = getInternalProps(this.table);\r\n if (internalProps) {\r\n (internalProps as { _isReleasing?: boolean })._isReleasing = true;\r\n }\r\n\r\n try {\r\n if (this.resizeObserver) {\r\n this.resizeObserver.disconnect();\r\n this.resizeObserver = undefined;\r\n }\r\n\r\n // 清理checkbox联动功能\r\n if (this.checkboxCascadeCleanup) {\r\n try {\r\n this.checkboxCascadeCleanup();\r\n } catch (error) {\r\n console.warn('Error during checkbox cascade cleanup:', error);\r\n }\r\n this.checkboxCascadeCleanup = undefined;\r\n }\r\n\r\n // 清理事件管理器\r\n if (this.eventManager) {\r\n try {\r\n this.eventManager.cleanup();\r\n } catch (error) {\r\n console.warn('Error during event manager cleanup:', error);\r\n }\r\n }\r\n\r\n // 清理子表管理器\r\n if (this.subTableManager) {\r\n try {\r\n this.subTableManager.cleanup();\r\n } catch (error) {\r\n console.warn('Error during sub table manager cleanup:', error);\r\n }\r\n }\r\n\r\n // 清理配置管理器\r\n if (this.configManager) {\r\n try {\r\n this.configManager.release();\r\n } catch (error) {\r\n console.warn('Error during config manager cleanup:', error);\r\n }\r\n }\r\n\r\n // 清理主从表功能\r\n this.cleanupMasterDetailFeatures();\r\n\r\n // 清理内部属性\r\n if (this.table && internalProps) {\r\n try {\r\n // 清理Map和Set,防止内存泄露\r\n internalProps.expandedRecordIndices?.splice(0);\r\n internalProps.subTableInstances?.clear();\r\n internalProps.originalRowHeights?.clear();\r\n internalProps.subTableCheckboxStates?.clear();\r\n internalProps._heightResizedRowMap?.clear();\r\n } catch (error) {\r\n console.warn('Error clearing internal props:', error);\r\n }\r\n }\r\n } catch (error) {\r\n console.warn('Error during release:', error);\r\n } finally {\r\n // 避免循环引用\r\n try {\r\n (this as unknown as { configManager: unknown }).configManager = null;\r\n (this as unknown as { eventManager: unknown }).eventManager = null;\r\n (this as unknown as { subTableManager: unknown }).subTableManager = null;\r\n (this as unknown as { tableAPIExtensions: unknown }).tableAPIExtensions = null;\r\n (this as unknown as { table: unknown }).table = null;\r\n (this as unknown as { pluginOptions: unknown }).pluginOptions = null;\r\n } catch (error) {\r\n console.warn('Error clearing references:', error);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * 清除所有子表的可见选中状态\r\n */\r\n private clearAllSubTableVisibleSelections(): void {\r\n const internalProps = getInternalProps(this.table);\r\n internalProps.subTableInstances?.forEach(subTable => {\r\n if (subTable && typeof (subTable as { clearSelected?: () => void }).clearSelected === 'function') {\r\n (subTable as { clearSelected: () => void }).clearSelected();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * 获取所有子表实例\r\n * @returns 子表实例的Map,键为bodyRowIndex,值为VTable实例\r\n */\r\n getAllSubTableInstances(): Map<number, VTable.ListTable> | null {\r\n return this.subTableManager.getAllSubTableInstances();\r\n }\r\n\r\n /**\r\n * 根据主表行号获取子表实例\r\n * @param rowIndex 主表行索引(包含表头)\r\n * @returns 子表实例,如果不存在则返回null\r\n */\r\n getSubTableByRowIndex(rowIndex: number): VTable.ListTable | null {\r\n const bodyRowIndex = rowIndex - this.table.columnHeaderLevelCount;\r\n return this.subTableManager.getSubTableInstance(bodyRowIndex);\r\n }\r\n\r\n /**\r\n * 根据主表body行号获取子表实例\r\n * @param bodyRowIndex 主表body行索引(不包含表头)\r\n * @returns 子表实例,如果不存在则返回null\r\n */\r\n getSubTableByBodyRowIndex(bodyRowIndex: number): VTable.ListTable | null {\r\n return this.subTableManager.getSubTableInstance(bodyRowIndex);\r\n }\r\n\r\n /**\r\n * 根据条件筛选子表实例\r\n * @param predicate 筛选条件函数\r\n * @returns 符合条件的子表实例数组\r\n */\r\n filterSubTables(\r\n predicate: (bodyRowIndex: number, subTable: VTable.ListTable, record?: unknown) => boolean\r\n ): Array<{ bodyRowIndex: number; subTable: VTable.ListTable; record?: unknown }> {\r\n const result: Array<{ bodyRowIndex: number; subTable: VTable.ListTable }> = [];\r\n const allSubTables = this.subTableManager.getAllSubTableInstances();\r\n if (!allSubTables) {\r\n return result;\r\n }\r\n\r\n for (const [bodyRowIndex, subTable] of allSubTables) {\r\n try {\r\n const record = getRecordByRowIndex(this.table, bodyRowIndex);\r\n if (predicate(bodyRowIndex, subTable, record)) {\r\n result.push({ bodyRowIndex, subTable });\r\n }\r\n } catch (error) {\r\n console.warn(`筛选子表时出错:`, error);\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * 更新冻结列阴影高度\r\n * 当行展开/收起导致表格总高度变化时,需要更新冻结列的阴影高度\r\n */\r\n private updateFrozenColumnShadowHeight(): void {\r\n try {\r\n // 获取当前冻结列数量\r\n const frozenColCount = this.table.frozenColCount;\r\n if (frozenColCount > 0) {\r\n this.table.scenegraph.component.setFrozenColumnShadow(frozenColCount - 1);\r\n }\r\n } catch (error) {\r\n console.warn('更新冻结列阴影高度失败:', error);\r\n }\r\n }\r\n\r\n /**\r\n * 清理主从表功能\r\n */\r\n private cleanupMasterDetailFeatures(): void {\r\n // 清理主表事件处理器\r\n if (this.mainTableClickHandler) {\r\n this.table.off('click_cell', this.mainTableClickHandler);\r\n this.mainTableClickHandler = undefined;\r\n }\r\n // 清理表格 API 扩展\r\n if (this.tableAPIExtensions) {\r\n this.tableAPIExtensions.cleanup();\r\n this.tableAPIExtensions = undefined;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"sources":["../src/master-detail-plugin/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA2C;AAG3C,mCAAuE;AACvE,mCAAsF;AACtF,qCAAyC;AACzC,qCAAwC;AACxC,yCAA6C;AAC7C,iEAA4D;AAC5D,yCAA4D;AAK5D,MAAa,kBAAkB;IAqB7B,YAAY,gBAA2C,EAAE;QApBzD,OAAE,GAAG,sBAAsB,CAAC;QAC5B,SAAI,GAAG,sBAAsB,CAAC;QAC9B,YAAO,GAAG;YACR,MAAM,CAAC,gBAAgB,CAAC,WAA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able/es/scenegraph/graphic/group';\r\nimport type { MasterDetailPluginOptions } from './types';\r\nimport { includesRecordIndex, findRecordIndexPosition } from './types';\r\nimport { getInternalProps, getRecordByRowIndex, getOriginalRowHeight } from './utils';\r\nimport { ConfigManager } from './config';\r\nimport { EventManager } from './events';\r\nimport { SubTableManager } from './subtable';\r\nimport { TableAPIExtensions } from './table-api-extensions';\r\nimport { bindMasterDetailCheckboxChange } from './checkbox';\r\nimport type { pluginsDefinition } from '@visactor/vtable';\r\n/**\r\n * 主从表插件核心类\r\n */\r\nexport class MasterDetailPlugin implements pluginsDefinition.IVTablePlugin {\r\n id = `Master Detail Plugin`;\r\n name = 'Master Detail Plugin';\r\n runTime = [\r\n VTable.TABLE_EVENT_TYPE.BEFORE_INIT,\r\n VTable.TABLE_EVENT_TYPE.INITIALIZED,\r\n VTable.TABLE_EVENT_TYPE.SORT_CLICK,\r\n VTable.TABLE_EVENT_TYPE.AFTER_SORT,\r\n VTable.TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH,\r\n VTable.TABLE_EVENT_TYPE.AFTER_UPDATE_SELECT_BORDER_HEIGHT\r\n ];\r\n\r\n pluginOptions: MasterDetailPluginOptions;\r\n table: VTable.ListTable;\r\n private configManager: ConfigManager;\r\n private eventManager: EventManager;\r\n private subTableManager: SubTableManager;\r\n private tableAPIExtensions: TableAPIExtensions;\r\n private resizeObserver?: ResizeObserver;\r\n private checkboxCascadeCleanup: () => void;\r\n\r\n constructor(pluginOptions: MasterDetailPluginOptions = {}) {\r\n this.pluginOptions = pluginOptions;\r\n }\r\n run(...args: unknown[]): boolean | void {\r\n const eventArgs = args[0];\r\n const runTime = args[1];\r\n const table = args[2] as VTable.ListTable;\r\n\r\n if (runTime === VTable.TABLE_EVENT_TYPE.BEFORE_INIT) {\r\n this.table = table;\r\n this.initializeManagers();\r\n this.configManager.injectMasterDetailOptions(\r\n (eventArgs as { options: VTable.ListTableConstructorOptions }).options\r\n );\r\n } else if (runTime === VTable.TABLE_EVENT_TYPE.INITIALIZED) {\r\n this.setupMasterDetailFeatures();\r\n } else if (runTime === VTable.TABLE_EVENT_TYPE.SORT_CLICK) {\r\n // 排序前处理:保存展开状态并收起所有行\r\n this.eventManager.executeMasterDetailBeforeSort();\r\n return true;\r\n } else if (runTime === VTable.TABLE_EVENT_TYPE.AFTER_SORT) {\r\n // 排序后处理:恢复展开状态\r\n this.eventManager.executeMasterDetailAfterSort();\r\n } else if (runTime === VTable.TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH) {\r\n // 单元格内容处理\r\n this.eventManager.handleAfterUpdateCellContentWidth(eventArgs as any);\r\n } else if (runTime === VTable.TABLE_EVENT_TYPE.AFTER_UPDATE_SELECT_BORDER_HEIGHT) {\r\n // 高亮处理\r\n this.eventManager.handleAfterUpdateSelectBorderHeight(eventArgs as any);\r\n }\r\n }\r\n /**\r\n * 初始化管理器\r\n */\r\n private initializeManagers(): void {\r\n this.configManager = new ConfigManager(this.pluginOptions, this.table);\r\n this.eventManager = new EventManager(this.table);\r\n const enableCheckboxCascade = this.pluginOptions.enableCheckboxCascade ?? true;\r\n this.subTableManager = new SubTableManager(this.table, enableCheckboxCascade);\r\n\r\n // 设置配置管理器的行展开状态检查函数\r\n this.configManager.setRowExpandedChecker((row: number) => this.eventManager.isRowExpanded(row));\r\n // 设置配置管理器的展开行回调函数\r\n this.configManager.setExpandRowCallback((rowIndex: number) => this.expandRow(rowIndex));\r\n\r\n // 设置事件管理器的回调函数\r\n this.eventManager.setCallbacks({\r\n onUpdateSubTablePositions: () => this.subTableManager.recalculateAllSubTablePositions(),\r\n onUpdateSubTablePositionsForRow: () => this.subTableManager.updateSubTablePositionsForRowResize(),\r\n onExpandRow: (rowIndex: number, colIndex?: number) => this.expandRow(rowIndex, colIndex),\r\n onCollapseRow: (rowIndex: number, colIndex?: number) => this.collapseRow(rowIndex, colIndex),\r\n onCollapseRowToNoRealRecordIndex: (rowIndex: number) => this.collapseRowToNoRealRecordIndex(rowIndex),\r\n onToggleRowExpand: (rowIndex: number, colIndex?: number) => this.toggleRowExpand(rowIndex, colIndex),\r\n getOriginalRowHeight: (bodyRowIndex: number) => getOriginalRowHeight(this.table, bodyRowIndex)\r\n });\r\n\r\n // 设置子表管理器的回调函数\r\n this.subTableManager.setCallbacks({\r\n getDetailConfigForRecord: (record, bodyRowIndex) =>\r\n this.configManager.getDetailConfigForRecord(record, bodyRowIndex)\r\n });\r\n\r\n // 设置auto高度计算完成的回调\r\n this.subTableManager.setAutoHeightCallback((bodyRowIndex: number, newTotalHeight: number) => {\r\n this.handleAutoHeightUpdate(bodyRowIndex, newTotalHeight);\r\n });\r\n }\r\n\r\n /**\r\n * 设置主从表功能\r\n */\r\n private setupMasterDetailFeatures(): void {\r\n // 初始化内部属性\r\n this.initInternalProps();\r\n // 绑定事件处理器\r\n this.eventManager.bindEventHandlers();\r\n // 设置统一选择状态管理\r\n this.setupUnifiedSelectionManagement();\r\n // 扩展表格 API\r\n this.extendTableAPI();\r\n // 初始化checkbox联动功能\r\n this.initCheckboxCascade();\r\n }\r\n\r\n // 主表点击事件处理器引用\r\n private mainTableClickHandler?: () => void;\r\n\r\n /**\r\n * 设置统一选中状态管理\r\n */\r\n private setupUnifiedSelectionManagement(): void {\r\n // 绑定主表的点击事件,清除所有子表选中状态\r\n this.mainTableClickHandler = () => {\r\n this.clearAllSubTableVisibleSelections();\r\n };\r\n this.table.on('click_cell', this.mainTableClickHandler);\r\n }\r\n\r\n /**\r\n * 初始化checkbox联动功能\r\n * 设置主从表之间的复选框状态同步,并保存清理函数以便后续释放资源\r\n */\r\n private initCheckboxCascade(): void {\r\n // 检查是否启用checkbox级联功能,默认为 true\r\n const enableCheckboxCascade = this.pluginOptions.enableCheckboxCascade ?? true;\r\n if (enableCheckboxCascade) {\r\n // 设置checkbox联动并保存清理函数\r\n this.checkboxCascadeCleanup = bindMasterDetailCheckboxChange(this.table, this.eventManager);\r\n }\r\n }\r\n\r\n /**\r\n * 初始化内部属性\r\n */\r\n private initInternalProps(): void {\r\n const internalProps = getInternalProps(this.table);\r\n internalProps.expandedRecordIndices = [];\r\n internalProps.subTableInstances = new Map();\r\n internalProps.originalRowHeights = new Map();\r\n internalProps.subTableCheckboxStates = new Map();\r\n }\r\n\r\n /**\r\n * 扩展表格 API\r\n */\r\n private extendTableAPI(): void {\r\n // 创建 TableAPIExtensions 实例\r\n this.tableAPIExtensions = new TableAPIExtensions(this.table, this.configManager, this.eventManager, {\r\n addUnderlineToCell: (cellGroup: Group) => this.addUnderlineToCell(cellGroup),\r\n updateOriginalHeightsAfterAdaptive: (\r\n expandedRowsInfo: Map<number, { baseHeight: number; detailHeight: number }>\r\n ) => this.updateOriginalHeightsAfterAdaptive(expandedRowsInfo),\r\n collapseRowToNoRealRecordIndex: (rowIndex: number) => this.collapseRowToNoRealRecordIndex(rowIndex),\r\n expandRow: (rowIndex: number) => this.expandRow(rowIndex),\r\n restoreExpandedStatesAfter: () => this.restoreExpandedStatesAfter(),\r\n collapseRow: (rowIndex: number) => this.collapseRow(rowIndex),\r\n updateSubTablePositions: () => this.subTableManager.recalculateAllSubTablePositions(),\r\n updateRowHeightForExpand: (rowIndex: number, deltaHeight: number) =>\r\n this.updateRowHeightForExpand(rowIndex, deltaHeight)\r\n });\r\n\r\n // 执行API扩展\r\n this.tableAPIExtensions.extendTableAPI();\r\n }\r\n\r\n /**\r\n * 在 adaptive 处理后更新原始高度缓存\r\n */\r\n private updateOriginalHeightsAfterAdaptive(\r\n expandedRowsInfo: Map<number, { baseHeight: number; detailHeight: number }>\r\n ): void {\r\n const internalProps = getInternalProps(this.table);\r\n // 更新展开行的原始高度缓存\r\n for (const [rowIndex, info] of expandedRowsInfo) {\r\n const bodyRowIndex = rowIndex - this.table.columnHeaderLevelCount;\r\n if (internalProps.originalRowHeights) {\r\n // 将新的基础高度设置为原始高度\r\n internalProps.originalRowHeights.set(bodyRowIndex, info.baseHeight);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * 分页后恢复展开状态\r\n */\r\n private restoreExpandedStatesAfter(): void {\r\n const internalProps = getInternalProps(this.table);\r\n if (!internalProps.expandedRecordIndices || internalProps.expandedRecordIndices.length === 0) {\r\n return;\r\n }\r\n const currentPagerData = this.table.dataSource._currentPagerIndexedData;\r\n if (!currentPagerData) {\r\n return;\r\n }\r\n internalProps.expandedRecordIndices.forEach(recordIndex => {\r\n try {\r\n const bodyRowIndex = this.table.getBodyRowIndexByRecordIndex(recordIndex);\r\n if (bodyRowIndex >= 0) {\r\n const targetRowIndex = bodyRowIndex + this.table.columnHeaderLevelCount;\r\n this.expandRow(targetRowIndex);\r\n }\r\n } catch (error) {\r\n console.warn(`处理记录索引 ${recordIndex} 时出错:`, error);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * 展开行\r\n * @param rowIndex 行索引\r\n * @param colIndex 列索引\r\n */\r\n expandRow(rowIndex: number, colIndex?: number): void {\r\n const bodyRowIndex = rowIndex - this.table.columnHeaderLevelCount;\r\n const internalProps = getInternalProps(this.table);\r\n if (this.eventManager.isRowExpanded(rowIndex)) {\r\n return;\r\n }\r\n\r\n const realRecordIndex = this.table.getRecordIndexByCell(0, rowIndex);\r\n if (realRecordIndex === undefined || realRecordIndex === null) {\r\n return;\r\n }\r\n // 更新展开行的数据源\r\n if (internalProps.expandedRecordIndices) {\r\n if (!includesRecordIndex(internalProps.expandedRecordIndices, realRecordIndex)) {\r\n internalProps.expandedRecordIndices.push(realRecordIndex);\r\n }\r\n }\r\n // 更新展开状态数组\r\n this.eventManager.addExpandedRow(rowIndex);\r\n\r\n const originalHeight = this.table.getRowHeight(rowIndex);\r\n if (internalProps.originalRowHeights) {\r\n const oldCellGroup = this.table.scenegraph.getCell(colIndex, rowIndex);\r\n // console.log(bodyRowIndex,oldCellGroup)\r\n internalProps.originalRowHeights.set(bodyRowIndex, originalHeight);\r\n }\r\n const record = getRecordByRowIndex(this.table, bodyRowIndex);\r\n const detailConfig = this.configManager.getDetailConfigForRecord(record, bodyRowIndex);\r\n const height = detailConfig?.style?.height || 300;\r\n\r\n const childrenData = Array.isArray(record.children) ? record.children : [];\r\n\r\n // 处理初始高度:如果是auto,先用默认值300展开\r\n const isAutoHeight = height === 'auto';\r\n const deltaHeight = isAutoHeight ? 300 : typeof height === 'number' ? height : 300;\r\n this.updateRowHeightForExpand(rowIndex, deltaHeight);\r\n this.table.scenegraph.updateContainerHeight(rowIndex, deltaHeight);\r\n internalProps._heightResizedRowMap.add(rowIndex);\r\n if (rowIndex === 96) {\r\n console.log('wokk');\r\n }\r\n this.subTableManager.renderSubTable(bodyRowIndex, childrenData, (record, bodyRowIndex) =>\r\n this.configManager.getDetailConfigForRecord(record, bodyRowIndex)\r\n );\r\n\r\n if (rowIndex !== this.table.rowCount - 1) {\r\n this.drawUnderlineForRow(rowIndex);\r\n }\r\n this.refreshRowIcon(rowIndex, colIndex);\r\n if (this.table.heightMode === 'adaptive') {\r\n this.table.scenegraph.dealHeightMode();\r\n }\r\n // 更新冻结线高度\r\n this.updateFrozenColumnShadowHeight();\r\n }\r\n\r\n /**\r\n * 处理auto高度更新\r\n * 当子表计算出实际内容高度后,更新主表行高\r\n */\r\n private handleAutoHeightUpdate(bodyRowIndex: number, newTotalHeight: number): void {\r\n try {\r\n const rowIndex = bodyRowIndex + this.table.columnHeaderLevelCount;\r\n // 获取当前行高\r\n const currentRowHeight = this.table.getRowHeight(rowIndex);\r\n const internalProps = getInternalProps(this.table);\r\n const originalHeight = internalProps.originalRowHeights?.get(bodyRowIndex) || 0;\r\n const currentDetailHeight = currentRowHeight - originalHeight;\r\n // 计算需要调整的高度差\r\n const heightDifference = newTotalHeight - currentDetailHeight;\r\n this.updateRowHeightForExpand(rowIndex, heightDifference);\r\n this.table.scenegraph.updateContainerHeight(rowIndex, heightDifference);\r\n } catch (error) {\r\n console.warn('Error in auto height update:', error);\r\n }\r\n }\r\n\r\n /**\r\n * 收起行\r\n * @param rowIndex 行索引\r\n * @param colIndex 列索引\r\n */\r\n collapseRow(rowIndex: number, colIndex?: number): void {\r\n const bodyRowIndex = rowIndex - this.table.columnHeaderLevelCount;\r\n const internalProps = getInternalProps(this.table);\r\n\r\n if (!this.eventManager.isRowExpanded(rowIndex)) {\r\n return;\r\n }\r\n\r\n const realRecordIndex = this.table.getRecordIndexByCell(0, rowIndex);\r\n if (realRecordIndex === undefined || realRecordIndex === null) {\r\n return;\r\n }\r\n // 更新展开行的数据源\r\n this.subTableManager.removeSubTable(bodyRowIndex);\r\n if (internalProps.expandedRecordIndices) {\r\n const index = findRecordIndexPosition(internalProps.expandedRecordIndices, realRecordIndex);\r\n if (index > -1) {\r\n internalProps.expandedRecordIndices.splice(index, 1);\r\n }\r\n }\r\n\r\n // 更新展开状态数组\r\n this.eventManager.removeExpandedRow(rowIndex);\r\n\r\n const currentHeight = this.table.getRowHeight(rowIndex);\r\n const originalHeight = getOriginalRowHeight(this.table, bodyRowIndex);\r\n const deltaHeight = currentHeight - originalHeight;\r\n this.updateRowHeightForExpand(rowIndex, -deltaHeight);\r\n internalProps._heightResizedRowMap.delete(rowIndex);\r\n this.table.scenegraph.updateContainerHeight(rowIndex, -deltaHeight);\r\n if (internalProps.originalRowHeights) {\r\n internalProps.originalRowHeights.delete(bodyRowIndex);\r\n }\r\n if (rowIndex !== this.table.rowCount - 1) {\r\n this.removeUnderlineFromRow(rowIndex);\r\n }\r\n this.refreshRowIcon(rowIndex, colIndex);\r\n if (this.table.heightMode === 'adaptive') {\r\n this.table.scenegraph.dealHeightMode();\r\n }\r\n // 更新冻结线高度\r\n this.updateFrozenColumnShadowHeight();\r\n }\r\n\r\n /**\r\n * 收起行(不修改expandedRecordIndices)\r\n */\r\n private collapseRowToNoRealRecordIndex(rowIndex: number): void {\r\n const bodyRowIndex = rowIndex - this.table.columnHeaderLevelCount;\r\n const internalProps = getInternalProps(this.table);\r\n\r\n if (!this.eventManager.isRowExpanded(rowIndex)) {\r\n return;\r\n }\r\n this.subTableManager.removeSubTable(bodyRowIndex);\r\n this.eventManager.removeExpandedRow(rowIndex);\r\n const currentHeight = this.table.getRowHeight(rowIndex);\r\n const originalHeight = getOriginalRowHeight(this.table, bodyRowIndex);\r\n const deltaHeight = currentHeight - originalHeight;\r\n this.updateRowHeightForExpand(rowIndex, -deltaHeight);\r\n internalProps._heightResizedRowMap.delete(rowIndex);\r\n this.table.scenegraph.updateContainerHeight(rowIndex, -deltaHeight);\r\n if (internalProps.originalRowHeights) {\r\n internalProps.originalRowHeights.delete(bodyRowIndex);\r\n }\r\n\r\n if (rowIndex !== this.table.rowCount - 1) {\r\n this.removeUnderlineFromRow(rowIndex);\r\n }\r\n this.refreshRowIcon(rowIndex);\r\n if (this.table.heightMode === 'adaptive') {\r\n this.table.scenegraph.dealHeightMode();\r\n }\r\n // 更新冻结线高度\r\n this.updateFrozenColumnShadowHeight();\r\n }\r\n\r\n /**\r\n * 切换行展开状态\r\n * @param rowIndex 行索引\r\n * @param colIndex 列索引\r\n */\r\n toggleRowExpand(rowIndex: number, colIndex?: number): void {\r\n if (this.eventManager.isRowExpanded(rowIndex)) {\r\n this.collapseRow(rowIndex, colIndex);\r\n } else {\r\n this.expandRow(rowIndex, colIndex);\r\n }\r\n }\r\n\r\n /**\r\n * 更新行高用于展开\r\n */\r\n private updateRowHeightForExpand(rowIndex: number, deltaHeight: number): void {\r\n this.table._setRowHeight(rowIndex, this.table.getRowHeight(rowIndex) + deltaHeight, true);\r\n\r\n // 更新以下行的位置\r\n const rowStart = rowIndex + 1;\r\n let rowEnd = 0;\r\n\r\n if (rowIndex < this.table.frozenRowCount) {\r\n rowEnd = this.table.frozenRowCount - 1;\r\n } else if (rowIndex >= this.table.rowCount - this.table.bottomFrozenRowCount) {\r\n rowEnd = this.table.rowCount - 1;\r\n } else {\r\n rowEnd = Math.min(\r\n (this.table.scenegraph as { proxy: { rowEnd: number } }).proxy.rowEnd,\r\n this.table.rowCount - this.table.bottomFrozenRowCount - 1\r\n );\r\n }\r\n\r\n for (let colIndex = 0; colIndex < this.table.colCount; colIndex++) {\r\n for (let rowIdx = rowStart; rowIdx <= rowEnd; rowIdx++) {\r\n const cellGroup = this.table.scenegraph.highPerformanceGetCell(colIndex, rowIdx);\r\n if (cellGroup.role === 'cell') {\r\n cellGroup.setAttribute('y', cellGroup.attribute.y + deltaHeight);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * 为指定行绘制下划线\r\n */\r\n private drawUnderlineForRow(rowIndex: number): void {\r\n const sceneGraph = this.table.scenegraph;\r\n if (!sceneGraph) {\r\n return;\r\n }\r\n // 获取指定行的所有cell\r\n const rowCells = this.getRowCells(rowIndex);\r\n if (rowCells.length === 0) {\r\n return;\r\n }\r\n rowCells.forEach((cellGroup: Group, index: number) => {\r\n if (cellGroup && cellGroup.attribute) {\r\n this.addUnderlineToCell(cellGroup);\r\n }\r\n });\r\n // 触发重新渲染\r\n this.table.scenegraph.updateNextFrame();\r\n }\r\n\r\n /**\r\n * 获取指定行的所有cell元素\r\n */\r\n private getRowCells(rowIndex: number): Group[] {\r\n const cells: Group[] = [];\r\n for (let col = 0; col < this.table.colCount; col++) {\r\n const cellGroup = this.table.scenegraph.getCell(col, rowIndex);\r\n if (cellGroup && cellGroup.role === 'cell') {\r\n cells.push(cellGroup);\r\n }\r\n }\r\n return cells;\r\n }\r\n\r\n /**\r\n * 为cell添加下划线\r\n */\r\n private addUnderlineToCell(cellGroup: any): void {\r\n const currentAttr = cellGroup.attribute;\r\n const currentStrokeArrayWidth =\r\n currentAttr.strokeArrayWidth ||\r\n (currentAttr.lineWidth\r\n ? [currentAttr.lineWidth, currentAttr.lineWidth, currentAttr.lineWidth, currentAttr.lineWidth]\r\n : [1, 1, 1, 1]);\r\n const currentStrokeArrayColor =\r\n currentAttr.strokeArrayColor ||\r\n (currentAttr.stroke\r\n ? [currentAttr.stroke, currentAttr.stroke, currentAttr.stroke, currentAttr.stroke]\r\n : ['transparent', 'transparent', 'transparent', 'transparent']);\r\n const isAlreadyEnhanced = cellGroup._hasUnderline;\r\n if (!isAlreadyEnhanced) {\r\n cellGroup._originalStrokeArrayWidth = [...currentStrokeArrayWidth];\r\n cellGroup._originalStrokeArrayColor = [...currentStrokeArrayColor];\r\n cellGroup._hasUnderline = true;\r\n }\r\n const originalStrokeArrayWidth = cellGroup._originalStrokeArrayWidth || currentStrokeArrayWidth;\r\n const originalStrokeArrayColor = cellGroup._originalStrokeArrayColor || currentStrokeArrayColor;\r\n const enhancedStrokeArrayWidth = [...originalStrokeArrayWidth];\r\n const enhancedStrokeArrayColor = [...originalStrokeArrayColor];\r\n const enhancedWidth = ((originalStrokeArrayWidth[2] || 1) * 0.75 + (originalStrokeArrayWidth[0] || 1) * 0.75) * 2;\r\n enhancedStrokeArrayWidth[2] = enhancedWidth;\r\n if (originalStrokeArrayColor[2] === 'transparent' || !originalStrokeArrayColor[2]) {\r\n const theme = this.table.theme;\r\n enhancedStrokeArrayColor[2] = theme?.bodyStyle?.borderColor || '#e1e4e8';\r\n } else {\r\n enhancedStrokeArrayColor[2] = originalStrokeArrayColor[2];\r\n }\r\n cellGroup.setAttributes({\r\n strokeArrayWidth: enhancedStrokeArrayWidth,\r\n strokeArrayColor: enhancedStrokeArrayColor,\r\n stroke: true\r\n });\r\n }\r\n\r\n /**\r\n * 删除展开行的下划线\r\n */\r\n private removeUnderlineFromRow(rowIndex: number): void {\r\n const rowCells = this.getRowCells(rowIndex);\r\n rowCells.forEach((cellGroup: any, index: number) => {\r\n if (cellGroup && cellGroup._hasUnderline) {\r\n this.removeUnderlineFromCell(cellGroup);\r\n }\r\n });\r\n this.table.scenegraph.updateNextFrame();\r\n }\r\n\r\n /**\r\n * 从cell中删除下划线\r\n */\r\n private removeUnderlineFromCell(cellGroup: any): void {\r\n if (cellGroup._hasUnderline) {\r\n // 恢复原始的strokeArray样式\r\n if (cellGroup._originalStrokeArrayWidth && cellGroup._originalStrokeArrayColor) {\r\n cellGroup.setAttributes({\r\n strokeArrayWidth: cellGroup._originalStrokeArrayWidth,\r\n strokeArrayColor: cellGroup._originalStrokeArrayColor\r\n });\r\n delete cellGroup._originalStrokeArrayWidth;\r\n delete cellGroup._originalStrokeArrayColor;\r\n }\r\n // 清除下划线标记\r\n cellGroup._hasUnderline = false;\r\n }\r\n }\r\n\r\n /**\r\n * 刷新行图标\r\n * @param rowIndex 行索引\r\n * @param colIndex 列索引\r\n */\r\n private refreshRowIcon(rowIndex: number, colIndex?: number): void {\r\n let targetColumnIndex: number;\r\n if (typeof colIndex === 'number') {\r\n targetColumnIndex = colIndex;\r\n } else {\r\n const hasRowSeriesNumber = !!this.table.options.rowSeriesNumber;\r\n targetColumnIndex = hasRowSeriesNumber ? 1 : 0;\r\n }\r\n\r\n const record = this.table.getCellOriginRecord(targetColumnIndex, rowIndex);\r\n if (record && typeof record === 'object') {\r\n const recordObj = record as Record<string, unknown>;\r\n const HierarchyState = VTable.TYPES.HierarchyState;\r\n const isExpanded = this.eventManager.isRowExpanded(rowIndex);\r\n recordObj.hierarchyState = isExpanded ? HierarchyState.expand : HierarchyState.collapse;\r\n this.table.scenegraph.updateHierarchyIcon(targetColumnIndex, rowIndex);\r\n }\r\n }\r\n\r\n /**\r\n * 设置记录的子数据并展开\r\n */\r\n setRecordChildren(children: unknown[], col: number, row: number): void {\r\n // 获取当前单元格对应的源数据记录,避免排序后索引不一致 #4986\r\n const record = this.table.getCellOriginRecord(col, row);\r\n if (!record) {\r\n console.warn('Cannot find record for cell:', col, row);\r\n return;\r\n }\r\n\r\n // 直接修改原始记录的 children 属性\r\n (record as Record<string, unknown>).children = children;\r\n this.expandRow(row, col);\r\n this.table.scenegraph.updateCellContent(col, row);\r\n }\r\n\r\n release(): void {\r\n // 设置释放标志\r\n const internalProps = getInternalProps(this.table);\r\n if (internalProps) {\r\n (internalProps as { _isReleasing?: boolean })._isReleasing = true;\r\n }\r\n\r\n try {\r\n if (this.resizeObserver) {\r\n this.resizeObserver.disconnect();\r\n this.resizeObserver = undefined;\r\n }\r\n\r\n // 清理checkbox联动功能\r\n if (this.checkboxCascadeCleanup) {\r\n try {\r\n this.checkboxCascadeCleanup();\r\n } catch (error) {\r\n console.warn('Error during checkbox cascade cleanup:', error);\r\n }\r\n this.checkboxCascadeCleanup = undefined;\r\n }\r\n\r\n // 清理事件管理器\r\n if (this.eventManager) {\r\n try {\r\n this.eventManager.cleanup();\r\n } catch (error) {\r\n console.warn('Error during event manager cleanup:', error);\r\n }\r\n }\r\n\r\n // 清理子表管理器\r\n if (this.subTableManager) {\r\n try {\r\n this.subTableManager.cleanup();\r\n } catch (error) {\r\n console.warn('Error during sub table manager cleanup:', error);\r\n }\r\n }\r\n\r\n // 清理配置管理器\r\n if (this.configManager) {\r\n try {\r\n this.configManager.release();\r\n } catch (error) {\r\n console.warn('Error during config manager cleanup:', error);\r\n }\r\n }\r\n\r\n // 清理主从表功能\r\n this.cleanupMasterDetailFeatures();\r\n\r\n // 清理内部属性\r\n if (this.table && internalProps) {\r\n try {\r\n // 清理Map和Set,防止内存泄露\r\n internalProps.expandedRecordIndices?.splice(0);\r\n internalProps.subTableInstances?.clear();\r\n internalProps.originalRowHeights?.clear();\r\n internalProps.subTableCheckboxStates?.clear();\r\n internalProps._heightResizedRowMap?.clear();\r\n } catch (error) {\r\n console.warn('Error clearing internal props:', error);\r\n }\r\n }\r\n } catch (error) {\r\n console.warn('Error during release:', error);\r\n } finally {\r\n // 避免循环引用\r\n try {\r\n (this as unknown as { configManager: unknown }).configManager = null;\r\n (this as unknown as { eventManager: unknown }).eventManager = null;\r\n (this as unknown as { subTableManager: unknown }).subTableManager = null;\r\n (this as unknown as { tableAPIExtensions: unknown }).tableAPIExtensions = null;\r\n (this as unknown as { table: unknown }).table = null;\r\n (this as unknown as { pluginOptions: unknown }).pluginOptions = null;\r\n } catch (error) {\r\n console.warn('Error clearing references:', error);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * 清除所有子表的可见选中状态\r\n */\r\n private clearAllSubTableVisibleSelections(): void {\r\n const internalProps = getInternalProps(this.table);\r\n internalProps.subTableInstances?.forEach(subTable => {\r\n if (subTable && typeof (subTable as { clearSelected?: () => void }).clearSelected === 'function') {\r\n (subTable as { clearSelected: () => void }).clearSelected();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * 获取所有子表实例\r\n * @returns 子表实例的Map,键为bodyRowIndex,值为VTable实例\r\n */\r\n getAllSubTableInstances(): Map<number, VTable.ListTable> | null {\r\n return this.subTableManager.getAllSubTableInstances();\r\n }\r\n\r\n /**\r\n * 根据主表行号获取子表实例\r\n * @param rowIndex 主表行索引(包含表头)\r\n * @returns 子表实例,如果不存在则返回null\r\n */\r\n getSubTableByRowIndex(rowIndex: number): VTable.ListTable | null {\r\n const bodyRowIndex = rowIndex - this.table.columnHeaderLevelCount;\r\n return this.subTableManager.getSubTableInstance(bodyRowIndex);\r\n }\r\n\r\n /**\r\n * 根据主表body行号获取子表实例\r\n * @param bodyRowIndex 主表body行索引(不包含表头)\r\n * @returns 子表实例,如果不存在则返回null\r\n */\r\n getSubTableByBodyRowIndex(bodyRowIndex: number): VTable.ListTable | null {\r\n return this.subTableManager.getSubTableInstance(bodyRowIndex);\r\n }\r\n\r\n /**\r\n * 根据条件筛选子表实例\r\n * @param predicate 筛选条件函数\r\n * @returns 符合条件的子表实例数组\r\n */\r\n filterSubTables(\r\n predicate: (bodyRowIndex: number, subTable: VTable.ListTable, record?: unknown) => boolean\r\n ): Array<{ bodyRowIndex: number; subTable: VTable.ListTable; record?: unknown }> {\r\n const result: Array<{ bodyRowIndex: number; subTable: VTable.ListTable }> = [];\r\n const allSubTables = this.subTableManager.getAllSubTableInstances();\r\n if (!allSubTables) {\r\n return result;\r\n }\r\n\r\n for (const [bodyRowIndex, subTable] of allSubTables) {\r\n try {\r\n const record = getRecordByRowIndex(this.table, bodyRowIndex);\r\n if (predicate(bodyRowIndex, subTable, record)) {\r\n result.push({ bodyRowIndex, subTable });\r\n }\r\n } catch (error) {\r\n console.warn(`筛选子表时出错:`, error);\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * 更新冻结列阴影高度\r\n * 当行展开/收起导致表格总高度变化时,需要更新冻结列的阴影高度\r\n */\r\n private updateFrozenColumnShadowHeight(): void {\r\n try {\r\n // 获取当前冻结列数量\r\n const frozenColCount = this.table.frozenColCount;\r\n if (frozenColCount > 0) {\r\n this.table.scenegraph.component.setFrozenColumnShadow(frozenColCount - 1);\r\n }\r\n } catch (error) {\r\n console.warn('更新冻结列阴影高度失败:', error);\r\n }\r\n }\r\n\r\n /**\r\n * 清理主从表功能\r\n */\r\n private cleanupMasterDetailFeatures(): void {\r\n // 清理主表事件处理器\r\n if (this.mainTableClickHandler) {\r\n this.table.off('click_cell', this.mainTableClickHandler);\r\n this.mainTableClickHandler = undefined;\r\n }\r\n // 清理表格 API 扩展\r\n if (this.tableAPIExtensions) {\r\n this.tableAPIExtensions.cleanup();\r\n this.tableAPIExtensions = undefined;\r\n }\r\n }\r\n}\r\n"]}
@@ -40,7 +40,7 @@ function getCopyCellValue(col, row, tableInstance, option) {
40
40
  const cellRange = tableInstance.getCellRange(col, row), copyStartCol = cellRange.start.col, copyStartRow = cellRange.start.row;
41
41
  if (copyStartCol !== col || copyStartRow !== row) return "";
42
42
  let value = cellValue;
43
- return (null == option ? void 0 : option.escape) ? value = escapeForCSV(value) : "string" == typeof value && (value = '"' + value + '"'),
43
+ return !1 !== (null == option ? void 0 : option.escape) ? value = escapeForCSV(value) : "string" == typeof value && (value = '"' + value + '"'),
44
44
  value;
45
45
  }
46
46
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/table-export/csv/index.ts"],"names":[],"mappings":";;;AAEA,mDAA4D;AAK5D,MAAM,OAAO,GAAG,MAAM,CAAC;AACvB,MAAM,SAAS,GAAG,GAAG,CAAC;AAUtB,SAAgB,iBAAiB,CAC/B,aAAkD,EAClD,MAAiC;IAEjC,MAAM,aAAa,GAAG,CAAC,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,CAAA,CAAC;IAC9C,MAAM,EAAE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,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,OAAO,GAAG,CAAC;KACZ;IAGD,IAAI,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAGzC,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;QAC/B,UAAU,GAAG,IAAI,UAAU,GAAG,CAAC;KAChC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","file":"index.js","sourcesContent":["import type { ListTable, PivotTable, PivotChart, TYPES } from '@visactor/vtable';\nimport type { CellInfo } from '../excel';\nimport { handlePaginationExport } from '../util/pagination';\n\ntype IVTable = ListTable | PivotTable | PivotChart;\ntype CellRange = TYPES.CellRange;\n\nconst newLine = '\\r\\n';\nconst separator = ',';\n\nexport type ExportVTableToCsvOptions = {\n formatExportOutput?: (cellInfo: CellInfo) => string | undefined;\n escape?: boolean;\n exportAllData?: boolean;\n downloadFile?: boolean;\n fileName?: string;\n};\n\nexport function exportVTableToCsv(\n tableInstance: ListTable | PivotTable | PivotChart,\n option?: ExportVTableToCsvOptions\n): string {\n const exportAllData = !!option?.exportAllData;\n const { handleRowCount, reset } = handlePaginationExport(tableInstance, exportAllData);\n const minRow = 0;\n const maxRow = handleRowCount();\n const minCol = 0;\n const maxCol = tableInstance.colCount - 1;\n\n let copyValue = '';\n for (let row = minRow; row <= maxRow; row++) {\n for (let col = minCol; col <= maxCol; col++) {\n const copyCellValue = getCopyCellValue(col, row, tableInstance, option);\n if (typeof Promise !== 'undefined' && copyCellValue instanceof Promise) {\n // not support async\n } else {\n const strCellValue = `${copyCellValue === undefined ? '' : copyCellValue}`;\n if (/^\\[object .*\\]$/.exec(strCellValue)) {\n // ignore object\n } else {\n copyValue += strCellValue;\n }\n }\n if (col !== maxCol) {\n copyValue += separator;\n }\n }\n copyValue += newLine;\n }\n // 恢复透视表的pagination配置\n reset();\n return copyValue;\n}\n\nfunction getCopyCellValue(\n col: number,\n row: number,\n tableInstance: ListTable | PivotTable | PivotChart,\n option?: ExportVTableToCsvOptions\n): string | Promise<string> | void {\n const rawRecord = tableInstance.getCellRawRecord(col, row);\n const cellValue = (rawRecord && rawRecord.vtableMergeName) ?? tableInstance.getCellValue(col, row, false);\n\n if (option?.formatExportOutput) {\n const cellType = tableInstance.getCellType(col, row);\n const cellInfo = { cellType, cellValue, table: tableInstance, col, row };\n const formattedValue = option.formatExportOutput(cellInfo);\n if (formattedValue !== undefined) {\n if (typeof formattedValue === 'string') {\n return '\"' + formattedValue + '\"';\n }\n return formattedValue;\n }\n }\n const cellRange: CellRange = tableInstance.getCellRange(col, row);\n const copyStartCol = cellRange.start.col;\n const copyStartRow = cellRange.start.row;\n\n if (copyStartCol !== col || copyStartRow !== row) {\n return '';\n }\n\n let value = cellValue;\n if (option?.escape) {\n value = escapeForCSV(value);\n } else if (typeof value === 'string') {\n value = '\"' + value + '\"';\n }\n return value;\n}\n\n/**\n * 将字符串中的特殊符号进行转义,以避免干扰CSV解析\n * @param {string} str - 需要处理的字符串\n * @return {string} - 已处理的字符串\n */\nfunction escapeForCSV(str: any) {\n if (typeof str !== 'string') {\n return str;\n }\n\n // 替换双引号为两个双引号\n let escapedStr = str.replace(/\"/g, '\"\"');\n\n // 如果字符串中包含逗号、换行符或双引号,则需要用双引号包裹\n if (/[,\"\\r\\n]/.test(escapedStr)) {\n escapedStr = `\"${escapedStr}\"`;\n }\n\n return escapedStr;\n}\n"]}
1
+ {"version":3,"sources":["../src/table-export/csv/index.ts"],"names":[],"mappings":";;;AAEA,mDAA4D;AAK5D,MAAM,OAAO,GAAG,MAAM,CAAC;AACvB,MAAM,SAAS,GAAG,GAAG,CAAC;AAUtB,SAAgB,iBAAiB,CAC/B,aAAkD,EAClD,MAAiC;IAEjC,MAAM,aAAa,GAAG,CAAC,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,CAAA,CAAC;IAC9C,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,GAAG,IAAA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K,QAAQ,EAAE;QAC3B,OAAO,GAAG,CAAC;KACZ;IAGD,IAAI,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAGzC,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;QAC/B,UAAU,GAAG,IAAI,UAAU,GAAG,CAAC;KAChC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","file":"index.js","sourcesContent":["import type { ListTable, PivotTable, PivotChart, TYPES } from '@visactor/vtable';\nimport type { CellInfo } from '../excel';\nimport { handlePaginationExport } from '../util/pagination';\n\ntype IVTable = ListTable | PivotTable | PivotChart;\ntype CellRange = TYPES.CellRange;\n\nconst newLine = '\\r\\n';\nconst separator = ',';\n\nexport type ExportVTableToCsvOptions = {\n formatExportOutput?: (cellInfo: CellInfo) => string | undefined;\n escape?: boolean;\n exportAllData?: boolean;\n downloadFile?: boolean;\n fileName?: string;\n};\n\nexport function exportVTableToCsv(\n tableInstance: ListTable | PivotTable | PivotChart,\n option?: ExportVTableToCsvOptions\n): string {\n const exportAllData = !!option?.exportAllData;\n const { handleRowCount, reset } = handlePaginationExport(tableInstance, exportAllData);\n const minRow = 0;\n const maxRow = handleRowCount();\n const minCol = 0;\n const maxCol = tableInstance.colCount - 1;\n\n let copyValue = '';\n for (let row = minRow; row <= maxRow; row++) {\n for (let col = minCol; col <= maxCol; col++) {\n const copyCellValue = getCopyCellValue(col, row, tableInstance, option);\n if (typeof Promise !== 'undefined' && copyCellValue instanceof Promise) {\n // not support async\n } else {\n const strCellValue = `${copyCellValue === undefined ? '' : copyCellValue}`;\n if (/^\\[object .*\\]$/.exec(strCellValue)) {\n // ignore object\n } else {\n copyValue += strCellValue;\n }\n }\n if (col !== maxCol) {\n copyValue += separator;\n }\n }\n copyValue += newLine;\n }\n // 恢复透视表的pagination配置\n reset();\n return copyValue;\n}\n\nfunction getCopyCellValue(\n col: number,\n row: number,\n tableInstance: ListTable | PivotTable | PivotChart,\n option?: ExportVTableToCsvOptions\n): string | Promise<string> | void {\n const rawRecord = tableInstance.getCellRawRecord(col, row);\n const cellValue = (rawRecord && rawRecord.vtableMergeName) ?? tableInstance.getCellValue(col, row, false);\n\n if (option?.formatExportOutput) {\n const cellType = tableInstance.getCellType(col, row);\n const cellInfo = { cellType, cellValue, table: tableInstance, col, row };\n const formattedValue = option.formatExportOutput(cellInfo);\n if (formattedValue !== undefined) {\n if (typeof formattedValue === 'string') {\n return '\"' + formattedValue + '\"';\n }\n return formattedValue;\n }\n }\n const cellRange: CellRange = tableInstance.getCellRange(col, row);\n const copyStartCol = cellRange.start.col;\n const copyStartRow = cellRange.start.row;\n\n if (copyStartCol !== col || copyStartRow !== row) {\n return '';\n }\n\n let value = cellValue;\n if (option?.escape !== false) {\n //escape默认逻辑改为true,进行转义\n value = escapeForCSV(value);\n } else if (typeof value === 'string') {\n value = '\"' + value + '\"';\n }\n return value;\n}\n\n/**\n * 将字符串中的特殊符号进行转义,以避免干扰CSV解析\n * @param {string} str - 需要处理的字符串\n * @return {string} - 已处理的字符串\n */\nfunction escapeForCSV(str: any) {\n if (typeof str !== 'string') {\n return str;\n }\n\n // 替换双引号为两个双引号\n let escapedStr = str.replace(/\"/g, '\"\"');\n\n // 如果字符串中包含逗号、换行符或双引号,则需要用双引号包裹\n if (/[,\"\\r\\n]/.test(escapedStr)) {\n escapedStr = `\"${escapedStr}\"`;\n }\n\n return escapedStr;\n}\n"]}
@@ -1102,6 +1102,7 @@
1102
1102
  table;
1103
1103
  pluginOptions;
1104
1104
  responseKeyboard;
1105
+ batchCallChangeCellValuesApi;
1105
1106
  constructor(pluginOptions) {
1106
1107
  this.id = pluginOptions?.id ?? this.id;
1107
1108
  this.pluginOptions = pluginOptions;
@@ -1115,6 +1116,7 @@
1115
1116
  exports.ExcelEditCellKeyboardResponse.DELETE,
1116
1117
  exports.ExcelEditCellKeyboardResponse.BACKSPACE
1117
1118
  ];
1119
+ this.batchCallChangeCellValuesApi = pluginOptions?.batchCallChangeCellValuesApi ?? false;
1118
1120
  this.bindEvent();
1119
1121
  }
1120
1122
  run(...args) {
@@ -1180,7 +1182,7 @@
1180
1182
  if (selectCells?.length > 0 &&
1181
1183
  (document.activeElement === this.table.getElement() ||
1182
1184
  Object.values(this.table.editorManager.cacheLastSelectedCellEditor || {}).some((editor) => editor.getInputElement?.() === document.activeElement))) {
1183
- deleteSelectRange(selectCells, this.table, this.pluginOptions?.deleteWorkOnEditableCell ?? true);
1185
+ deleteSelectRange(selectCells, this.table, this.pluginOptions?.deleteWorkOnEditableCell ?? true, this.batchCallChangeCellValuesApi);
1184
1186
  event.stopPropagation();
1185
1187
  event.preventDefault();
1186
1188
  }
@@ -1204,7 +1206,14 @@
1204
1206
  document.removeEventListener('keydown', this.handleKeyDown, true);
1205
1207
  }
1206
1208
  }
1207
- function deleteSelectRange(selectCells, tableInstance, workOnEditableCell = false) {
1209
+ function deleteSelectRange(selectCells, tableInstance, workOnEditableCell = false, batchCallChangeCellValuesApi = false) {
1210
+ if (batchCallChangeCellValuesApi) {
1211
+ const ranges = tableInstance.stateManager.select.ranges;
1212
+ if (ranges?.length) {
1213
+ tableInstance.changeCellValuesByRanges(ranges, '', workOnEditableCell, true);
1214
+ }
1215
+ return;
1216
+ }
1208
1217
  for (let i = 0; i < selectCells.length; i++) {
1209
1218
  for (let j = 0; j < selectCells[i].length; j++) {
1210
1219
  tableInstance.changeCellValue(selectCells[i][j].col, selectCells[i][j].row, '', workOnEditableCell);
@@ -8464,12 +8473,7 @@
8464
8473
  }
8465
8474
  }
8466
8475
  setRecordChildren(children, col, row) {
8467
- const recordIndex = this.table.getRecordIndexByCell(col, row);
8468
- if (recordIndex === undefined || recordIndex === null) {
8469
- return;
8470
- }
8471
- const realRecordIndex = typeof recordIndex === 'number' ? recordIndex : recordIndex[0];
8472
- const record = this.table.dataSource.get(realRecordIndex);
8476
+ const record = this.table.getCellOriginRecord(col, row);
8473
8477
  if (!record) {
8474
8478
  return;
8475
8479
  }
@@ -22321,7 +22325,7 @@ ${recordsStr}
22321
22325
  return '';
22322
22326
  }
22323
22327
  let value = cellValue;
22324
- if (option?.escape) {
22328
+ if (option?.escape !== false) {
22325
22329
  value = escapeForCSV(value);
22326
22330
  }
22327
22331
  else if (typeof value === 'string') {