@univerjs/sheets-table 0.23.0 → 0.24.0-insiders.20260528-29f582d

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.
Files changed (111) hide show
  1. package/lib/cjs/index.js +514 -123
  2. package/lib/cjs/locale/ar-SA.js +10 -0
  3. package/lib/cjs/locale/ca-ES.js +10 -0
  4. package/lib/cjs/locale/de-DE.js +10 -0
  5. package/lib/cjs/locale/en-US.js +25 -0
  6. package/lib/cjs/locale/es-ES.js +10 -0
  7. package/lib/cjs/locale/fa-IR.js +10 -0
  8. package/lib/cjs/locale/fr-FR.js +10 -0
  9. package/lib/cjs/locale/id-ID.js +10 -0
  10. package/lib/cjs/locale/it-IT.js +10 -0
  11. package/lib/cjs/locale/ja-JP.js +10 -0
  12. package/lib/cjs/locale/ko-KR.js +10 -0
  13. package/lib/cjs/locale/pl-PL.js +10 -0
  14. package/lib/cjs/locale/pt-BR.js +10 -0
  15. package/lib/cjs/locale/ru-RU.js +10 -0
  16. package/lib/cjs/locale/sk-SK.js +10 -0
  17. package/lib/cjs/locale/vi-VN.js +10 -0
  18. package/lib/cjs/locale/zh-CN.js +10 -0
  19. package/lib/cjs/locale/zh-HK.js +10 -0
  20. package/lib/cjs/locale/zh-TW.js +10 -0
  21. package/lib/es/index.js +508 -123
  22. package/lib/es/locale/ar-SA.js +9 -0
  23. package/lib/es/locale/ca-ES.js +9 -0
  24. package/lib/es/locale/de-DE.js +9 -0
  25. package/lib/es/locale/en-US.js +24 -0
  26. package/lib/es/locale/es-ES.js +9 -0
  27. package/lib/es/locale/fa-IR.js +9 -0
  28. package/lib/es/locale/fr-FR.js +9 -0
  29. package/lib/es/locale/id-ID.js +9 -0
  30. package/lib/es/locale/it-IT.js +9 -0
  31. package/lib/es/locale/ja-JP.js +9 -0
  32. package/lib/es/locale/ko-KR.js +9 -0
  33. package/lib/es/locale/pl-PL.js +9 -0
  34. package/lib/es/locale/pt-BR.js +9 -0
  35. package/lib/es/locale/ru-RU.js +9 -0
  36. package/lib/es/locale/sk-SK.js +9 -0
  37. package/lib/es/locale/vi-VN.js +9 -0
  38. package/lib/es/locale/zh-CN.js +9 -0
  39. package/lib/es/locale/zh-HK.js +9 -0
  40. package/lib/es/locale/zh-TW.js +9 -0
  41. package/lib/index.js +508 -123
  42. package/lib/locale/ar-SA.js +9 -0
  43. package/lib/locale/ca-ES.js +9 -0
  44. package/lib/locale/de-DE.js +9 -0
  45. package/lib/locale/en-US.js +24 -0
  46. package/lib/locale/es-ES.js +9 -0
  47. package/lib/locale/fa-IR.js +9 -0
  48. package/lib/locale/fr-FR.js +9 -0
  49. package/lib/locale/id-ID.js +9 -0
  50. package/lib/locale/it-IT.js +9 -0
  51. package/lib/locale/ja-JP.js +9 -0
  52. package/lib/locale/ko-KR.js +9 -0
  53. package/lib/locale/pl-PL.js +9 -0
  54. package/lib/locale/pt-BR.js +9 -0
  55. package/lib/locale/ru-RU.js +9 -0
  56. package/lib/locale/sk-SK.js +9 -0
  57. package/lib/locale/vi-VN.js +9 -0
  58. package/lib/locale/zh-CN.js +9 -0
  59. package/lib/locale/zh-HK.js +9 -0
  60. package/lib/locale/zh-TW.js +9 -0
  61. package/lib/types/commands/commands/set-sheet-table.command.d.ts +1 -0
  62. package/lib/types/commands/commands/sheet-table-row-col.command.d.ts +7 -0
  63. package/lib/types/const.d.ts +1 -0
  64. package/lib/types/controllers/sheet-table-ref-range.controller.d.ts +3 -0
  65. package/lib/types/controllers/table-filter.controller.d.ts +4 -4
  66. package/lib/types/facade/f-workbook.d.ts +8 -4
  67. package/lib/types/facade/f-worksheet.d.ts +18 -9
  68. package/lib/types/index.d.ts +6 -4
  69. package/lib/types/locale/ar-SA.d.ts +18 -0
  70. package/lib/types/locale/ca-ES.d.ts +18 -0
  71. package/lib/types/locale/de-DE.d.ts +18 -0
  72. package/lib/types/locale/en-US.d.ts +23 -0
  73. package/lib/types/locale/es-ES.d.ts +18 -0
  74. package/lib/types/locale/fa-IR.d.ts +18 -0
  75. package/lib/types/locale/fr-FR.d.ts +18 -0
  76. package/lib/types/locale/id-ID.d.ts +18 -0
  77. package/lib/types/locale/it-IT.d.ts +18 -0
  78. package/lib/types/locale/ja-JP.d.ts +18 -0
  79. package/lib/types/locale/ko-KR.d.ts +18 -0
  80. package/lib/types/locale/pl-PL.d.ts +18 -0
  81. package/lib/types/locale/pt-BR.d.ts +18 -0
  82. package/lib/types/locale/ru-RU.d.ts +18 -0
  83. package/lib/types/locale/sk-SK.d.ts +18 -0
  84. package/lib/types/locale/vi-VN.d.ts +18 -0
  85. package/lib/types/locale/zh-CN.d.ts +18 -0
  86. package/lib/types/locale/zh-HK.d.ts +18 -0
  87. package/lib/types/locale/zh-TW.d.ts +18 -0
  88. package/lib/types/util/table-name.d.ts +21 -0
  89. package/lib/umd/index.js +1 -1
  90. package/lib/umd/locale/ar-SA.js +1 -0
  91. package/lib/umd/locale/ca-ES.js +1 -0
  92. package/lib/umd/locale/de-DE.js +1 -0
  93. package/lib/umd/locale/en-US.js +1 -0
  94. package/lib/umd/locale/es-ES.js +1 -0
  95. package/lib/umd/locale/fa-IR.js +1 -0
  96. package/lib/umd/locale/fr-FR.js +1 -0
  97. package/lib/umd/locale/id-ID.js +1 -0
  98. package/lib/umd/locale/it-IT.js +1 -0
  99. package/lib/umd/locale/ja-JP.js +1 -0
  100. package/lib/umd/locale/ko-KR.js +1 -0
  101. package/lib/umd/locale/pl-PL.js +1 -0
  102. package/lib/umd/locale/pt-BR.js +1 -0
  103. package/lib/umd/locale/ru-RU.js +1 -0
  104. package/lib/umd/locale/sk-SK.js +1 -0
  105. package/lib/umd/locale/vi-VN.js +1 -0
  106. package/lib/umd/locale/zh-CN.js +1 -0
  107. package/lib/umd/locale/zh-HK.js +1 -0
  108. package/lib/umd/locale/zh-TW.js +1 -0
  109. package/package.json +12 -5
  110. package/LICENSE +0 -176
  111. /package/lib/types/services/{table-service.d.ts → table.service.d.ts} +0 -0
package/lib/cjs/index.js CHANGED
@@ -248,8 +248,8 @@ const tableDefaultThemeStyleArr = [
248
248
  [[
249
249
  "#6280F9",
250
250
  "#FFFFFF",
251
- "#BAC6F8",
252
- "#D2DAFA"
251
+ "#EEF2FF",
252
+ "#DCE4FF"
253
253
  ], ["#fff"]],
254
254
  [[
255
255
  "#16BDCA",
@@ -394,6 +394,28 @@ var TableColumn = class {
394
394
  }
395
395
  };
396
396
 
397
+ //#endregion
398
+ //#region src/const.ts
399
+ /**
400
+ * Copyright 2023-present DreamNum Co., Ltd.
401
+ *
402
+ * Licensed under the Apache License, Version 2.0 (the "License");
403
+ * you may not use this file except in compliance with the License.
404
+ * You may obtain a copy of the License at
405
+ *
406
+ * http://www.apache.org/licenses/LICENSE-2.0
407
+ *
408
+ * Unless required by applicable law or agreed to in writing, software
409
+ * distributed under the License is distributed on an "AS IS" BASIS,
410
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
411
+ * See the License for the specific language governing permissions and
412
+ * limitations under the License.
413
+ */
414
+ const PLUGIN_NAME = "SHEET_TABLE_PLUGIN";
415
+ const FEATURE_TABLE_ID = "SHEET_TABLE";
416
+ const SHEET_TABLE_CUSTOM_THEME_PREFIX = "table-custom";
417
+ const TABLE_FILTER_EMPTY_VALUE = "__UNIVER_TABLE_FILTER_EMPTY__";
418
+
397
419
  //#endregion
398
420
  //#region src/model/filter-util/date-filter-util.ts
399
421
  /**
@@ -1298,7 +1320,8 @@ var TableFilters = class {
1298
1320
  const executeFunc = this.getExecuteFunc(sheet, range, columnIndex, filter);
1299
1321
  for (let row = startRow; row <= endRow; row++) {
1300
1322
  const conditionType = isConditionFilter(filter) ? filter.filterInfo.conditionType : "string";
1301
- if (getCellValueWithConditionType(sheet, row, column, conditionType) === null) filterOutRows.add(row);
1323
+ const cellValue = getCellValueWithConditionType(sheet, row, column, conditionType);
1324
+ if (cellValue === null && !executeFunc(cellValue)) filterOutRows.add(row);
1302
1325
  else if (!executeFunc(getCellValueWithConditionType(sheet, row, column, conditionType))) filterOutRows.add(row);
1303
1326
  }
1304
1327
  }
@@ -1326,6 +1349,7 @@ var TableFilters = class {
1326
1349
  if (filter.filterType === "manual") {
1327
1350
  const valuesSet = new Set(filter.values);
1328
1351
  return (value) => {
1352
+ if (value == null) return valuesSet.has(TABLE_FILTER_EMPTY_VALUE);
1329
1353
  return valuesSet.has(value);
1330
1354
  };
1331
1355
  } else if (filter.filterType === "condition") return getConditionExecuteFunc(filter, isNumberDynamicFilter(filter.filterInfo.compareType) ? this._getNumberCalculatedOptions(sheet, range, columnIndex) : void 0);
@@ -1839,7 +1863,8 @@ let TableManager = class TableManager extends _univerjs_core.Disposable {
1839
1863
  }
1840
1864
  } else if (newRange.endColumn > oldRange.endColumn) {
1841
1865
  const diff = newRange.endColumn - oldRange.endColumn;
1842
- for (let i = 0; i < diff; i++) table.insertColumn(oldRange.endColumn, new TableColumn((0, _univerjs_core.generateRandomId)(), getColumnName(table.getColumnsCount() + 1, "Column")));
1866
+ const columnPrefix = this._localeService.t("sheets-table.columnPrefix");
1867
+ for (let i = 0; i < diff; i++) table.insertColumn(oldRange.endColumn, new TableColumn((0, _univerjs_core.generateRandomId)(), getColumnName(table.getColumnsCount() + 1, columnPrefix)));
1843
1868
  }
1844
1869
  table.setRange(newRange);
1845
1870
  this._tableRangeChanged$.next({
@@ -1966,7 +1991,7 @@ let TableManager = class TableManager extends _univerjs_core.Disposable {
1966
1991
  TableManager = __decorate([__decorateParam(0, _univerjs_core.IUniverInstanceService), __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService))], TableManager);
1967
1992
 
1968
1993
  //#endregion
1969
- //#region src/services/table-service.ts
1994
+ //#region src/services/table.service.ts
1970
1995
  let SheetTableService = class SheetTableService extends _univerjs_core.Disposable {
1971
1996
  constructor(_tableManager) {
1972
1997
  super();
@@ -2177,6 +2202,7 @@ const DeleteSheetTableCommand = {
2177
2202
  id: "sheet.command.delete-table",
2178
2203
  type: _univerjs_core.CommandType.COMMAND,
2179
2204
  handler: (accessor, params) => {
2205
+ var _interceptorCommands$, _interceptorCommands$2;
2180
2206
  if (!params) return false;
2181
2207
  const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
2182
2208
  const commandService = accessor.get(_univerjs_core.ICommandService);
@@ -2190,10 +2216,20 @@ const DeleteSheetTableCommand = {
2190
2216
  logService.error("[TableManager]: Table not found");
2191
2217
  return false;
2192
2218
  }
2219
+ const interceptorCommands = accessor.get(_univerjs_sheets.SheetInterceptorService).onCommandExecute({
2220
+ id: DeleteSheetTableCommand.id,
2221
+ params: {
2222
+ ...params,
2223
+ tableName: tableConfig.name
2224
+ }
2225
+ });
2226
+ redos.push(...(_interceptorCommands$ = interceptorCommands.preRedos) !== null && _interceptorCommands$ !== void 0 ? _interceptorCommands$ : []);
2193
2227
  redos.push({
2194
2228
  id: DeleteSheetTableMutation.id,
2195
2229
  params: { ...params }
2196
2230
  });
2231
+ redos.push(...interceptorCommands.redos);
2232
+ undos.push(...(_interceptorCommands$2 = interceptorCommands.preUndos) !== null && _interceptorCommands$2 !== void 0 ? _interceptorCommands$2 : []);
2197
2233
  undos.push({
2198
2234
  id: AddSheetTableMutation.id,
2199
2235
  params: {
@@ -2205,6 +2241,7 @@ const DeleteSheetTableCommand = {
2205
2241
  options: tableConfig.options
2206
2242
  }
2207
2243
  });
2244
+ undos.push(...interceptorCommands.undos);
2208
2245
  if ((0, _univerjs_core.sequenceExecute)(redos, commandService).result) {
2209
2246
  undoRedoService.pushUndoRedo({
2210
2247
  unitID: params.unitId,
@@ -2217,27 +2254,6 @@ const DeleteSheetTableCommand = {
2217
2254
  }
2218
2255
  };
2219
2256
 
2220
- //#endregion
2221
- //#region src/const.ts
2222
- /**
2223
- * Copyright 2023-present DreamNum Co., Ltd.
2224
- *
2225
- * Licensed under the Apache License, Version 2.0 (the "License");
2226
- * you may not use this file except in compliance with the License.
2227
- * You may obtain a copy of the License at
2228
- *
2229
- * http://www.apache.org/licenses/LICENSE-2.0
2230
- *
2231
- * Unless required by applicable law or agreed to in writing, software
2232
- * distributed under the License is distributed on an "AS IS" BASIS,
2233
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2234
- * See the License for the specific language governing permissions and
2235
- * limitations under the License.
2236
- */
2237
- const PLUGIN_NAME = "SHEET_TABLE_PLUGIN";
2238
- const FEATURE_TABLE_ID = "SHEET_TABLE";
2239
- const SHEET_TABLE_CUSTOM_THEME_PREFIX = "table-custom";
2240
-
2241
2257
  //#endregion
2242
2258
  //#region src/commands/commands/remove-table-theme.command.ts
2243
2259
  const RemoveTableThemeCommand = {
@@ -2305,12 +2321,44 @@ const RemoveTableThemeCommand = {
2305
2321
  }
2306
2322
  };
2307
2323
 
2324
+ //#endregion
2325
+ //#region src/util/table-name.ts
2326
+ /**
2327
+ * Copyright 2023-present DreamNum Co., Ltd.
2328
+ *
2329
+ * Licensed under the Apache License, Version 2.0 (the "License");
2330
+ * you may not use this file except in compliance with the License.
2331
+ * You may obtain a copy of the License at
2332
+ *
2333
+ * http://www.apache.org/licenses/LICENSE-2.0
2334
+ *
2335
+ * Unless required by applicable law or agreed to in writing, software
2336
+ * distributed under the License is distributed on an "AS IS" BASIS,
2337
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2338
+ * See the License for the specific language governing permissions and
2339
+ * limitations under the License.
2340
+ */
2341
+ function validateSheetTableName(name, existingNamesSet) {
2342
+ const trimmedName = name.trim();
2343
+ if (!trimmedName) return {
2344
+ valid: false,
2345
+ reason: "empty"
2346
+ };
2347
+ const normalizedExistingNames = new Set(Array.from(existingNamesSet, (item) => item.toLowerCase()));
2348
+ if (!(0, _univerjs_core.customNameCharacterCheck)(trimmedName.toLowerCase(), normalizedExistingNames)) return {
2349
+ valid: false,
2350
+ reason: "invalid"
2351
+ };
2352
+ return { valid: true };
2353
+ }
2354
+
2308
2355
  //#endregion
2309
2356
  //#region src/commands/commands/set-sheet-table.command.ts
2310
2357
  const SetSheetTableCommand = {
2311
2358
  id: "sheet.command.set-table-config",
2312
2359
  type: _univerjs_core.CommandType.COMMAND,
2313
2360
  handler: (accessor, params) => {
2361
+ var _interceptorCommands$, _interceptorCommands$2;
2314
2362
  if (!params) return false;
2315
2363
  const { unitId, tableId, name, updateRange, rowColOperation, theme } = params;
2316
2364
  const tableManager = accessor.get(TableManager);
@@ -2325,7 +2373,7 @@ const SetSheetTableCommand = {
2325
2373
  definedNamesService: accessor.get(_univerjs_engine_formula.IDefinedNamesService)
2326
2374
  });
2327
2375
  if (name) {
2328
- if (!(0, _univerjs_core.customNameCharacterCheck)(name.toLowerCase(), existingNamesSet)) {
2376
+ if (!validateSheetTableName(name, existingNamesSet).valid) {
2329
2377
  accessor.get(_univerjs_core.ILogService).warn(localeService.t("sheets-table.tableNameError"));
2330
2378
  return false;
2331
2379
  }
@@ -2355,22 +2403,43 @@ const SetSheetTableCommand = {
2355
2403
  tableId,
2356
2404
  config: newTableConfig
2357
2405
  };
2358
- accessor.get(_univerjs_core.ICommandService).executeCommand(SetSheetTableMutation.id, redoParams);
2359
- accessor.get(_univerjs_core.IUndoRedoService).pushUndoRedo({
2360
- unitID: unitId,
2361
- undoMutations: [{
2362
- id: SetSheetTableMutation.id,
2363
- params: {
2364
- unitId,
2365
- subUnitId: table.getSubunitId(),
2366
- tableId,
2367
- config: oldTableConfig
2368
- }
2369
- }],
2370
- redoMutations: [{
2406
+ const undoParams = {
2407
+ unitId,
2408
+ subUnitId: table.getSubunitId(),
2409
+ tableId,
2410
+ config: oldTableConfig
2411
+ };
2412
+ const interceptorCommands = accessor.get(_univerjs_sheets.SheetInterceptorService).onCommandExecute({
2413
+ id: SetSheetTableCommand.id,
2414
+ params: {
2415
+ ...params,
2416
+ oldTableName: oldTableConfig.name
2417
+ }
2418
+ });
2419
+ const redos = [
2420
+ ...(_interceptorCommands$ = interceptorCommands.preRedos) !== null && _interceptorCommands$ !== void 0 ? _interceptorCommands$ : [],
2421
+ {
2371
2422
  id: SetSheetTableMutation.id,
2372
2423
  params: redoParams
2373
- }]
2424
+ },
2425
+ ...interceptorCommands.redos
2426
+ ];
2427
+ const undos = [
2428
+ ...(_interceptorCommands$2 = interceptorCommands.preUndos) !== null && _interceptorCommands$2 !== void 0 ? _interceptorCommands$2 : [],
2429
+ {
2430
+ id: SetSheetTableMutation.id,
2431
+ params: undoParams
2432
+ },
2433
+ ...interceptorCommands.undos
2434
+ ];
2435
+ const commandService = accessor.get(_univerjs_core.ICommandService);
2436
+ redos.forEach((mutation) => {
2437
+ commandService.executeCommand(mutation.id, mutation.params);
2438
+ });
2439
+ accessor.get(_univerjs_core.IUndoRedoService).pushUndoRedo({
2440
+ unitID: unitId,
2441
+ undoMutations: undos,
2442
+ redoMutations: redos
2374
2443
  });
2375
2444
  return true;
2376
2445
  }
@@ -2678,6 +2747,17 @@ SheetsTableController = __decorate([
2678
2747
 
2679
2748
  //#endregion
2680
2749
  //#region src/commands/commands/sheet-table-row-col.command.ts
2750
+ function executeTableMutationSequence(accessor, unitId, redos, undos) {
2751
+ if ((0, _univerjs_core.sequenceExecute)(redos, accessor.get(_univerjs_core.ICommandService)).result) {
2752
+ accessor.get(_univerjs_core.IUndoRedoService).pushUndoRedo({
2753
+ unitID: unitId,
2754
+ undoMutations: undos,
2755
+ redoMutations: redos
2756
+ });
2757
+ return true;
2758
+ }
2759
+ return false;
2760
+ }
2681
2761
  const SheetTableInsertRowCommand = {
2682
2762
  id: "sheet.command.table-insert-row",
2683
2763
  type: _univerjs_core.CommandType.COMMAND,
@@ -2792,6 +2872,70 @@ const SheetTableInsertRowCommand = {
2792
2872
  return false;
2793
2873
  }
2794
2874
  };
2875
+ const SheetTableInsertRowAtCommand = {
2876
+ id: "sheet.command.table-insert-row-at",
2877
+ type: _univerjs_core.CommandType.COMMAND,
2878
+ handler: (accessor, params) => {
2879
+ if (!params) return false;
2880
+ const { unitId, subUnitId, tableId, index, count = 1 } = params;
2881
+ if (count <= 0) return false;
2882
+ const target = (0, _univerjs_sheets.getSheetCommandTarget)(accessor.get(_univerjs_core.IUniverInstanceService), {
2883
+ unitId,
2884
+ subUnitId
2885
+ });
2886
+ if (!target) return false;
2887
+ const table = accessor.get(TableManager).getTableById(unitId, tableId);
2888
+ if (!table || table.getSubunitId() !== subUnitId) return false;
2889
+ const oldRange = table.getRange();
2890
+ if (index <= oldRange.startRow || index > oldRange.endRow + 1) return false;
2891
+ const redos = [{
2892
+ id: SetSheetTableMutation.id,
2893
+ params: {
2894
+ unitId,
2895
+ subUnitId,
2896
+ tableId,
2897
+ config: { updateRange: { newRange: {
2898
+ ...oldRange,
2899
+ endRow: oldRange.endRow + count
2900
+ } } }
2901
+ }
2902
+ }];
2903
+ const undos = [{
2904
+ id: SetSheetTableMutation.id,
2905
+ params: {
2906
+ unitId,
2907
+ subUnitId,
2908
+ tableId,
2909
+ config: { updateRange: { newRange: { ...oldRange } } }
2910
+ }
2911
+ }];
2912
+ const rowContentIndex = target.worksheet.getCellMatrix().getDataRange().endRow;
2913
+ const moveRangeMutations = (0, _univerjs_sheets.getMoveRangeUndoRedoMutations)(accessor, {
2914
+ unitId,
2915
+ subUnitId,
2916
+ range: {
2917
+ startRow: index,
2918
+ endRow: rowContentIndex,
2919
+ startColumn: oldRange.startColumn,
2920
+ endColumn: oldRange.endColumn
2921
+ }
2922
+ }, {
2923
+ unitId,
2924
+ subUnitId,
2925
+ range: {
2926
+ startRow: index + count,
2927
+ endRow: rowContentIndex + count,
2928
+ startColumn: oldRange.startColumn,
2929
+ endColumn: oldRange.endColumn
2930
+ }
2931
+ });
2932
+ if (moveRangeMutations) {
2933
+ redos.push(...moveRangeMutations.redos);
2934
+ undos.push(...moveRangeMutations.undos);
2935
+ }
2936
+ return executeTableMutationSequence(accessor, unitId, redos, undos);
2937
+ }
2938
+ };
2795
2939
  const SheetTableInsertColCommand = {
2796
2940
  id: "sheet.command.table-insert-col",
2797
2941
  type: _univerjs_core.CommandType.COMMAND,
@@ -2919,6 +3063,177 @@ const SheetTableInsertColCommand = {
2919
3063
  return false;
2920
3064
  }
2921
3065
  };
3066
+ const SheetTableInsertColumnAtCommand = {
3067
+ id: "sheet.command.table-insert-column-at",
3068
+ type: _univerjs_core.CommandType.COMMAND,
3069
+ handler: (accessor, params) => {
3070
+ if (!params) return false;
3071
+ const { unitId, subUnitId, tableId, index, count = 1 } = params;
3072
+ if (count <= 0) return false;
3073
+ const target = (0, _univerjs_sheets.getSheetCommandTarget)(accessor.get(_univerjs_core.IUniverInstanceService), {
3074
+ unitId,
3075
+ subUnitId
3076
+ });
3077
+ if (!target) return false;
3078
+ const table = accessor.get(TableManager).getTableById(unitId, tableId);
3079
+ if (!table || table.getSubunitId() !== subUnitId) return false;
3080
+ const oldRange = table.getRange();
3081
+ if (index < oldRange.startColumn || index > oldRange.endColumn + 1) return false;
3082
+ const redos = [{
3083
+ id: SetSheetTableMutation.id,
3084
+ params: {
3085
+ unitId,
3086
+ subUnitId,
3087
+ tableId,
3088
+ config: { rowColOperation: {
3089
+ operationType: "insert",
3090
+ rowColType: "column",
3091
+ index,
3092
+ count
3093
+ } }
3094
+ }
3095
+ }];
3096
+ const undos = [{
3097
+ id: SetSheetTableMutation.id,
3098
+ params: {
3099
+ unitId,
3100
+ subUnitId,
3101
+ tableId,
3102
+ config: { rowColOperation: {
3103
+ operationType: "delete",
3104
+ rowColType: "column",
3105
+ index,
3106
+ count
3107
+ } }
3108
+ }
3109
+ }];
3110
+ const colContentIndex = target.worksheet.getCellMatrix().getDataRange().endColumn;
3111
+ if (index <= colContentIndex) {
3112
+ const moveRangeMutations = (0, _univerjs_sheets.getMoveRangeUndoRedoMutations)(accessor, {
3113
+ unitId,
3114
+ subUnitId,
3115
+ range: {
3116
+ startRow: oldRange.startRow,
3117
+ endRow: oldRange.endRow,
3118
+ startColumn: index,
3119
+ endColumn: colContentIndex
3120
+ }
3121
+ }, {
3122
+ unitId,
3123
+ subUnitId,
3124
+ range: {
3125
+ startRow: oldRange.startRow,
3126
+ endRow: oldRange.endRow,
3127
+ startColumn: index + count,
3128
+ endColumn: colContentIndex + count
3129
+ }
3130
+ });
3131
+ if (moveRangeMutations) {
3132
+ redos.push(...moveRangeMutations.redos);
3133
+ undos.push(...moveRangeMutations.undos);
3134
+ }
3135
+ }
3136
+ return executeTableMutationSequence(accessor, unitId, redos, undos);
3137
+ }
3138
+ };
3139
+ const SheetTableRemoveColumnAtCommand = {
3140
+ id: "sheet.command.table-remove-column-at",
3141
+ type: _univerjs_core.CommandType.COMMAND,
3142
+ handler: (accessor, params) => {
3143
+ var _interceptorCommands$, _interceptorCommands$2;
3144
+ if (!params) return false;
3145
+ const { unitId, subUnitId, tableId, index, count = 1 } = params;
3146
+ if (count <= 0) return false;
3147
+ const target = (0, _univerjs_sheets.getSheetCommandTarget)(accessor.get(_univerjs_core.IUniverInstanceService), {
3148
+ unitId,
3149
+ subUnitId
3150
+ });
3151
+ if (!target) return false;
3152
+ const table = accessor.get(TableManager).getTableById(unitId, tableId);
3153
+ if (!table || table.getSubunitId() !== subUnitId) return false;
3154
+ const oldRange = table.getRange();
3155
+ if (index < oldRange.startColumn || index + count - 1 > oldRange.endColumn || count >= oldRange.endColumn - oldRange.startColumn + 1) return false;
3156
+ const tableInfo = table.getTableInfo();
3157
+ const columns = [];
3158
+ const gap = index - oldRange.startColumn;
3159
+ for (let i = 0; i < count; i++) {
3160
+ const column = tableInfo.columns[gap + i];
3161
+ if (column) columns.push(column);
3162
+ }
3163
+ const interceptorCommands = accessor.get(_univerjs_sheets.SheetInterceptorService).onCommandExecute({
3164
+ id: SheetTableRemoveColumnAtCommand.id,
3165
+ params: {
3166
+ ...params,
3167
+ tableName: tableInfo.name,
3168
+ removedColumnNames: columns.map((column) => column.displayName)
3169
+ }
3170
+ });
3171
+ const redos = [
3172
+ ...(_interceptorCommands$ = interceptorCommands.preRedos) !== null && _interceptorCommands$ !== void 0 ? _interceptorCommands$ : [],
3173
+ {
3174
+ id: SetSheetTableMutation.id,
3175
+ params: {
3176
+ unitId,
3177
+ subUnitId,
3178
+ tableId,
3179
+ config: { rowColOperation: {
3180
+ operationType: "delete",
3181
+ rowColType: "column",
3182
+ index,
3183
+ count
3184
+ } }
3185
+ }
3186
+ },
3187
+ ...interceptorCommands.redos
3188
+ ];
3189
+ const undos = [
3190
+ ...(_interceptorCommands$2 = interceptorCommands.preUndos) !== null && _interceptorCommands$2 !== void 0 ? _interceptorCommands$2 : [],
3191
+ {
3192
+ id: SetSheetTableMutation.id,
3193
+ params: {
3194
+ unitId,
3195
+ subUnitId,
3196
+ tableId,
3197
+ config: { rowColOperation: {
3198
+ operationType: "insert",
3199
+ rowColType: "column",
3200
+ index,
3201
+ count,
3202
+ columnsJson: columns
3203
+ } }
3204
+ }
3205
+ },
3206
+ ...interceptorCommands.undos
3207
+ ];
3208
+ const colContentIndex = target.worksheet.getCellMatrix().getDataRange().endColumn;
3209
+ if (index + count <= colContentIndex) {
3210
+ const moveRangeMutations = (0, _univerjs_sheets.getMoveRangeUndoRedoMutations)(accessor, {
3211
+ unitId,
3212
+ subUnitId,
3213
+ range: {
3214
+ startRow: oldRange.startRow,
3215
+ endRow: oldRange.endRow,
3216
+ startColumn: index + count,
3217
+ endColumn: colContentIndex
3218
+ }
3219
+ }, {
3220
+ unitId,
3221
+ subUnitId,
3222
+ range: {
3223
+ startRow: oldRange.startRow,
3224
+ endRow: oldRange.endRow,
3225
+ startColumn: index,
3226
+ endColumn: colContentIndex - count
3227
+ }
3228
+ });
3229
+ if (moveRangeMutations) {
3230
+ redos.push(...moveRangeMutations.redos);
3231
+ undos.push(...moveRangeMutations.undos);
3232
+ }
3233
+ }
3234
+ return executeTableMutationSequence(accessor, unitId, redos, undos);
3235
+ }
3236
+ };
2922
3237
  const SheetTableRemoveRowCommand = {
2923
3238
  id: "sheet.command.table-remove-row",
2924
3239
  type: _univerjs_core.CommandType.COMMAND,
@@ -2996,6 +3311,7 @@ const SheetTableRemoveColCommand = {
2996
3311
  id: "sheet.command.table-remove-col",
2997
3312
  type: _univerjs_core.CommandType.COMMAND,
2998
3313
  handler: (accessor, params) => {
3314
+ var _interceptorCommands$3, _interceptorCommands$4;
2999
3315
  if (!params) return false;
3000
3316
  const target = (0, _univerjs_sheets.getSheetCommandTarget)(accessor.get(_univerjs_core.IUniverInstanceService), params);
3001
3317
  if (!target) return false;
@@ -3024,12 +3340,24 @@ const SheetTableRemoveColCommand = {
3024
3340
  } }
3025
3341
  }
3026
3342
  });
3343
+ const tableInfo = table.getTableInfo();
3027
3344
  const columns = [];
3028
3345
  const gap = range.startColumn - oldRange.startColumn;
3029
3346
  for (let i = 0; i < removeColCount; i++) {
3030
- const column = table.getTableInfo().columns[gap + i];
3347
+ const column = tableInfo.columns[gap + i];
3031
3348
  if (column) columns.push(column);
3032
3349
  }
3350
+ const interceptorCommands = accessor.get(_univerjs_sheets.SheetInterceptorService).onCommandExecute({
3351
+ id: SheetTableRemoveColCommand.id,
3352
+ params: {
3353
+ ...params,
3354
+ tableName: tableInfo.name,
3355
+ removedColumnNames: columns.map((column) => column.displayName)
3356
+ }
3357
+ });
3358
+ redos.unshift(...(_interceptorCommands$3 = interceptorCommands.preRedos) !== null && _interceptorCommands$3 !== void 0 ? _interceptorCommands$3 : []);
3359
+ redos.push(...interceptorCommands.redos);
3360
+ undos.unshift(...(_interceptorCommands$4 = interceptorCommands.preUndos) !== null && _interceptorCommands$4 !== void 0 ? _interceptorCommands$4 : []);
3033
3361
  undos.push({
3034
3362
  id: SetSheetTableMutation.id,
3035
3363
  params: {
@@ -3045,6 +3373,7 @@ const SheetTableRemoveColCommand = {
3045
3373
  } }
3046
3374
  }
3047
3375
  });
3376
+ undos.push(...interceptorCommands.undos);
3048
3377
  const colContentIndex = target.worksheet.getCellMatrix().getDataRange().endColumn;
3049
3378
  const moveRangeMutations = (0, _univerjs_sheets.getMoveRangeUndoRedoMutations)(accessor, {
3050
3379
  unitId,
@@ -3084,7 +3413,7 @@ const SheetTableRemoveColCommand = {
3084
3413
  //#endregion
3085
3414
  //#region package.json
3086
3415
  var name = "@univerjs/sheets-table";
3087
- var version = "0.23.0";
3416
+ var version = "0.24.0-insiders.20260528-29f582d";
3088
3417
 
3089
3418
  //#endregion
3090
3419
  //#region src/controllers/sheet-table-formula.controller.ts
@@ -3123,10 +3452,10 @@ let SheetTableFormulaController = class SheetTableFormulaController extends _uni
3123
3452
  });
3124
3453
  const table = this._tableManager.getTableById(unitId, tableId);
3125
3454
  if (!table) return;
3126
- this._updateSuperTable(unitId, table);
3455
+ this._updateSuperTable(unitId, table, oldTableName);
3127
3456
  }));
3128
3457
  }
3129
- _updateSuperTable(unitId, table) {
3458
+ _updateSuperTable(unitId, table, oldTableName) {
3130
3459
  const tableInfo = table.getTableInfo();
3131
3460
  const name = tableInfo.name;
3132
3461
  const columns = tableInfo.columns;
@@ -3137,6 +3466,7 @@ let SheetTableFormulaController = class SheetTableFormulaController extends _uni
3137
3466
  this._commandService.executeCommand(_univerjs_engine_formula.SetSuperTableMutation.id, {
3138
3467
  unitId,
3139
3468
  tableName: name,
3469
+ oldTableName,
3140
3470
  reference: {
3141
3471
  range: tableInfo.range,
3142
3472
  sheetId: tableInfo.subUnitId,
@@ -3197,6 +3527,8 @@ SheetTableRangeController = __decorate([__decorateParam(0, (0, _univerjs_core.In
3197
3527
 
3198
3528
  //#endregion
3199
3529
  //#region src/controllers/sheet-table-ref-range.controller.ts
3530
+ const SHEET_TABLE_REMOVE_COL_COMMAND_ID = "sheet.command.table-remove-col";
3531
+ const DELETE_SHEET_TABLE_COMMAND_ID = "sheet.command.delete-table";
3200
3532
  let SheetTableRefRangeController = class SheetTableRefRangeController extends _univerjs_core.Disposable {
3201
3533
  constructor(_commandService, _refRangeService, _univerInstanceService, _injector, _sheetInterceptorService, _tableManager, _localeService) {
3202
3534
  super();
@@ -3212,20 +3544,23 @@ let SheetTableRefRangeController = class SheetTableRefRangeController extends _u
3212
3544
  }
3213
3545
  _initCommandInterceptor() {
3214
3546
  const self = this;
3215
- this._sheetInterceptorService.interceptCommand({ getMutations(commandInfo) {
3216
- const defaultReturn = {
3217
- redos: [],
3218
- undos: []
3219
- };
3220
- const { id, params } = commandInfo;
3221
- switch (id) {
3222
- case _univerjs_sheets.InsertRowCommand.id: return self._generateTableMutationWithInsertRow(params);
3223
- case _univerjs_sheets.InsertColCommand.id: return self._generateTableMutationWithInsertCol(params);
3224
- case _univerjs_sheets.RemoveRowCommand.id: return self._generateTableMutationWithRemoveRow(params);
3225
- case _univerjs_sheets.RemoveColCommand.id: return self._generateTableMutationWithRemoveCol(params);
3547
+ this._sheetInterceptorService.interceptCommand({
3548
+ priority: -1,
3549
+ getMutations(commandInfo) {
3550
+ const defaultReturn = {
3551
+ redos: [],
3552
+ undos: []
3553
+ };
3554
+ const { id, params } = commandInfo;
3555
+ switch (id) {
3556
+ case _univerjs_sheets.InsertRowCommand.id: return self._generateTableMutationWithInsertRow(params);
3557
+ case _univerjs_sheets.InsertColCommand.id: return self._generateTableMutationWithInsertCol(params);
3558
+ case _univerjs_sheets.RemoveRowCommand.id: return self._generateTableMutationWithRemoveRow(params);
3559
+ case _univerjs_sheets.RemoveColCommand.id: return self._generateTableMutationWithRemoveCol(params);
3560
+ }
3561
+ return defaultReturn;
3226
3562
  }
3227
- return defaultReturn;
3228
- } });
3563
+ });
3229
3564
  }
3230
3565
  _generateTableMutationWithInsertRow(insertParams) {
3231
3566
  const undos = [];
@@ -3454,6 +3789,18 @@ let SheetTableRefRangeController = class SheetTableRefRangeController extends _u
3454
3789
  const tableRange = table.getRange();
3455
3790
  if (_univerjs_core.Rectangle.intersects(tableRange, range)) {
3456
3791
  if (range.startColumn <= tableRange.startColumn && range.endColumn >= tableRange.endColumn) {
3792
+ var _formulaMutations$pre, _formulaMutations$pre2;
3793
+ const tableInfo = table.getTableInfo();
3794
+ const formulaMutations = this._sheetInterceptorService.onCommandExecute({
3795
+ id: DELETE_SHEET_TABLE_COMMAND_ID,
3796
+ params: {
3797
+ unitId,
3798
+ subUnitId,
3799
+ tableId: table.getId(),
3800
+ tableName: tableInfo.name
3801
+ }
3802
+ });
3803
+ preRedos.push(...(_formulaMutations$pre = formulaMutations.preRedos) !== null && _formulaMutations$pre !== void 0 ? _formulaMutations$pre : [], ...formulaMutations.redos);
3457
3804
  preRedos.push({
3458
3805
  id: DeleteSheetTableMutation.id,
3459
3806
  params: {
@@ -3486,7 +3833,9 @@ let SheetTableRefRangeController = class SheetTableRefRangeController extends _u
3486
3833
  options: tableJson.options
3487
3834
  }
3488
3835
  });
3836
+ undos.push(...(_formulaMutations$pre2 = formulaMutations.preUndos) !== null && _formulaMutations$pre2 !== void 0 ? _formulaMutations$pre2 : [], ...formulaMutations.undos);
3489
3837
  } else if (range.startColumn <= tableRange.startColumn && range.endColumn >= tableRange.startColumn) {
3838
+ const tableJson = table.toJSON();
3490
3839
  const removeColumnCount = range.endColumn - tableRange.startColumn + 1;
3491
3840
  redos.push({
3492
3841
  id: SetSheetTableMutation.id,
@@ -3507,22 +3856,18 @@ let SheetTableRefRangeController = class SheetTableRefRangeController extends _u
3507
3856
  const column = table.getTableColumnByIndex(i);
3508
3857
  if (column) columns.push(column.toJSON());
3509
3858
  }
3510
- undos.push({
3511
- id: SetSheetTableMutation.id,
3512
- params: {
3513
- unitId,
3514
- subUnitId,
3515
- tableId: table.getId(),
3516
- config: { rowColOperation: {
3517
- operationType: "insert",
3518
- rowColType: "column",
3519
- index: tableRange.startColumn,
3520
- count: removeColumnCount,
3521
- columnsJson: columns
3522
- } }
3523
- }
3859
+ preUndos.push(this._getDeleteTableMutation(unitId, subUnitId, table.getId()));
3860
+ undos.push(this._getAddTableMutation(unitId, subUnitId, tableJson));
3861
+ this._appendTableColumnFormulaMutations(redos, undos, {
3862
+ unitId,
3863
+ subUnitId,
3864
+ tableId: table.getId(),
3865
+ tableName: table.getTableInfo().name,
3866
+ range,
3867
+ columns
3524
3868
  });
3525
3869
  } else if (range.startColumn > tableRange.startColumn && range.endColumn > tableRange.endColumn) {
3870
+ const tableJson = table.toJSON();
3526
3871
  const removeColumnCount = tableRange.endColumn - range.startColumn + 1;
3527
3872
  redos.push({
3528
3873
  id: SetSheetTableMutation.id,
@@ -3544,22 +3889,18 @@ let SheetTableRefRangeController = class SheetTableRefRangeController extends _u
3544
3889
  const column = table.getTableColumnByIndex(i + gap);
3545
3890
  if (column) columns.push(column.toJSON());
3546
3891
  }
3547
- undos.push({
3548
- id: SetSheetTableMutation.id,
3549
- params: {
3550
- unitId,
3551
- subUnitId,
3552
- tableId: table.getId(),
3553
- config: { rowColOperation: {
3554
- operationType: "insert",
3555
- rowColType: "column",
3556
- index: range.startColumn,
3557
- count: removeColCount,
3558
- columnsJson: columns
3559
- } }
3560
- }
3892
+ preUndos.push(this._getDeleteTableMutation(unitId, subUnitId, table.getId()));
3893
+ undos.push(this._getAddTableMutation(unitId, subUnitId, tableJson));
3894
+ this._appendTableColumnFormulaMutations(redos, undos, {
3895
+ unitId,
3896
+ subUnitId,
3897
+ tableId: table.getId(),
3898
+ tableName: table.getTableInfo().name,
3899
+ range,
3900
+ columns
3561
3901
  });
3562
3902
  } else if (range.startColumn > tableRange.startColumn && range.endColumn <= tableRange.endColumn) {
3903
+ const tableJson = table.toJSON();
3563
3904
  redos.push({
3564
3905
  id: SetSheetTableMutation.id,
3565
3906
  params: {
@@ -3580,20 +3921,15 @@ let SheetTableRefRangeController = class SheetTableRefRangeController extends _u
3580
3921
  const column = table.getTableColumnByIndex(i + gap);
3581
3922
  if (column) columns.push(column.toJSON());
3582
3923
  }
3583
- undos.push({
3584
- id: SetSheetTableMutation.id,
3585
- params: {
3586
- unitId,
3587
- subUnitId,
3588
- tableId: table.getId(),
3589
- config: { rowColOperation: {
3590
- operationType: "insert",
3591
- rowColType: "column",
3592
- index: range.startColumn,
3593
- count: removeColCount,
3594
- columnsJson: columns
3595
- } }
3596
- }
3924
+ preUndos.push(this._getDeleteTableMutation(unitId, subUnitId, table.getId()));
3925
+ undos.push(this._getAddTableMutation(unitId, subUnitId, tableJson));
3926
+ this._appendTableColumnFormulaMutations(redos, undos, {
3927
+ unitId,
3928
+ subUnitId,
3929
+ tableId: table.getId(),
3930
+ tableName: table.getTableInfo().name,
3931
+ range,
3932
+ columns
3597
3933
  });
3598
3934
  }
3599
3935
  }
@@ -3605,6 +3941,53 @@ let SheetTableRefRangeController = class SheetTableRefRangeController extends _u
3605
3941
  preUndos
3606
3942
  };
3607
3943
  }
3944
+ _getDeleteTableMutation(unitId, subUnitId, tableId) {
3945
+ return {
3946
+ id: DeleteSheetTableMutation.id,
3947
+ params: {
3948
+ unitId,
3949
+ subUnitId,
3950
+ tableId
3951
+ }
3952
+ };
3953
+ }
3954
+ _getAddTableMutation(unitId, subUnitId, tableJson) {
3955
+ const header = tableJson.columns.map((column) => column.displayName);
3956
+ return {
3957
+ id: AddSheetTableMutation.id,
3958
+ params: {
3959
+ unitId,
3960
+ subUnitId,
3961
+ tableId: tableJson.id,
3962
+ name: tableJson.name,
3963
+ header,
3964
+ range: tableJson.range,
3965
+ options: {
3966
+ ...tableJson.options,
3967
+ columns: tableJson.columns,
3968
+ filters: tableJson.filters.tableColumnFilterList
3969
+ }
3970
+ }
3971
+ };
3972
+ }
3973
+ _appendTableColumnFormulaMutations(redos, undos, info) {
3974
+ var _formulaMutations$pre3, _formulaMutations$pre4;
3975
+ const removedColumnNames = info.columns.map((column) => column.displayName);
3976
+ if (!removedColumnNames.length) return;
3977
+ const formulaMutations = this._sheetInterceptorService.onCommandExecute({
3978
+ id: SHEET_TABLE_REMOVE_COL_COMMAND_ID,
3979
+ params: {
3980
+ unitId: info.unitId,
3981
+ subUnitId: info.subUnitId,
3982
+ tableId: info.tableId,
3983
+ tableName: info.tableName,
3984
+ range: info.range,
3985
+ removedColumnNames
3986
+ }
3987
+ });
3988
+ redos.splice(Math.max(redos.length - 1, 0), 0, ...(_formulaMutations$pre3 = formulaMutations.preRedos) !== null && _formulaMutations$pre3 !== void 0 ? _formulaMutations$pre3 : [], ...formulaMutations.redos);
3989
+ undos.push(...(_formulaMutations$pre4 = formulaMutations.preUndos) !== null && _formulaMutations$pre4 !== void 0 ? _formulaMutations$pre4 : [], ...formulaMutations.undos);
3990
+ }
3608
3991
  _initCommandListener() {
3609
3992
  this._commandService.onCommandExecuted((commandInfo) => {
3610
3993
  if (commandInfo.id === _univerjs_sheets.InsertRowMutation.id) {
@@ -3770,25 +4153,18 @@ let TableFilterController = class TableFilterController extends _univerjs_core.D
3770
4153
  this._sheetInterceptorService = _sheetInterceptorService;
3771
4154
  this._univerInstanceService = _univerInstanceService;
3772
4155
  this._zebraCrossingCacheController = _zebraCrossingCacheController;
3773
- _defineProperty(this, "_tableFilteredOutRows$", new rxjs.BehaviorSubject(/* @__PURE__ */ new Set()));
3774
- _defineProperty(this, "tableFilteredOutRows$", this._tableFilteredOutRows$.asObservable());
4156
+ _defineProperty(this, "_tableFilteredOutRows", /* @__PURE__ */ new Map());
3775
4157
  _defineProperty(this, "_subscription", null);
3776
4158
  this.registerFilterChangeEvent();
3777
4159
  this.initTableHiddenRowIntercept();
3778
4160
  this._initFilteredOutRows();
3779
4161
  }
3780
- get tableFilteredOutRows() {
3781
- return this._tableFilteredOutRows$.value;
3782
- }
3783
- set tableFilteredOutRows(value) {
3784
- this._tableFilteredOutRows$.next(value);
3785
- }
3786
4162
  initTableHiddenRowIntercept() {
3787
4163
  this.disposeWithMe(this._sheetInterceptorService.intercept(_univerjs_sheets.INTERCEPTOR_POINT.ROW_FILTERED, {
3788
4164
  priority: 100,
3789
4165
  handler: (filtered, rowLocation, next) => {
3790
4166
  if (filtered) return true;
3791
- const isTableFiltered = this.tableFilteredOutRows.has(rowLocation.row);
4167
+ const isTableFiltered = this._getTableFilteredOutRows(rowLocation.unitId, rowLocation.subUnitId).has(rowLocation.row);
3792
4168
  return isTableFiltered ? true : next(isTableFiltered);
3793
4169
  }
3794
4170
  }));
@@ -3800,12 +4176,7 @@ let TableFilterController = class TableFilterController extends _univerjs_core.D
3800
4176
  const target = (0, _univerjs_sheets.getSheetCommandTarget)(this._univerInstanceService);
3801
4177
  if (!target) return;
3802
4178
  const { unitId, subUnitId } = target;
3803
- this.tableFilteredOutRows.clear();
3804
- this._tableManager.getTablesBySubunitId(unitId, subUnitId).forEach((table) => {
3805
- const tableFilteredRows = table.getTableFilters().getFilterOutRows();
3806
- if (!tableFilteredRows) return;
3807
- for (const row of tableFilteredRows) this.tableFilteredOutRows.add(row);
3808
- });
4179
+ this._refreshTableFilteredOutRows(unitId, subUnitId);
3809
4180
  });
3810
4181
  }
3811
4182
  registerFilterChangeEvent() {
@@ -3815,16 +4186,27 @@ let TableFilterController = class TableFilterController extends _univerjs_core.D
3815
4186
  const worksheet = (_this$_univerInstance = this._univerInstanceService.getUnit(unitId)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getSheetBySheetId(subUnitId);
3816
4187
  const table = this._tableManager.getTable(unitId, tableId);
3817
4188
  if (!worksheet || !table) return;
3818
- this.tableFilteredOutRows.clear();
3819
4189
  table.getTableFilters().doFilter(worksheet, table.getTableFilterRange());
3820
- this._tableManager.getTablesBySubunitId(unitId, subUnitId).forEach((table) => {
3821
- const tableFilteredRows = table.getTableFilters().getFilterOutRows();
3822
- if (!tableFilteredRows) return;
3823
- for (const row of tableFilteredRows) this.tableFilteredOutRows.add(row);
3824
- });
4190
+ this._refreshTableFilteredOutRows(unitId, subUnitId);
3825
4191
  this._zebraCrossingCacheController.updateZebraCrossingCache(unitId, subUnitId);
3826
4192
  }));
3827
4193
  }
4194
+ _refreshTableFilteredOutRows(unitId, subUnitId) {
4195
+ const filteredOutRows = /* @__PURE__ */ new Set();
4196
+ this._tableManager.getTablesBySubunitId(unitId, subUnitId).forEach((table) => {
4197
+ const tableFilteredRows = table.getTableFilters().getFilterOutRows();
4198
+ if (!tableFilteredRows) return;
4199
+ for (const row of tableFilteredRows) filteredOutRows.add(row);
4200
+ });
4201
+ this._tableFilteredOutRows.set(this._getSheetKey(unitId, subUnitId), filteredOutRows);
4202
+ }
4203
+ _getTableFilteredOutRows(unitId, subUnitId) {
4204
+ var _this$_tableFilteredO;
4205
+ return (_this$_tableFilteredO = this._tableFilteredOutRows.get(this._getSheetKey(unitId, subUnitId))) !== null && _this$_tableFilteredO !== void 0 ? _this$_tableFilteredO : /* @__PURE__ */ new Set();
4206
+ }
4207
+ _getSheetKey(unitId, subUnitId) {
4208
+ return `${unitId}|${subUnitId}`;
4209
+ }
3828
4210
  dispose() {
3829
4211
  var _this$_subscription;
3830
4212
  super.dispose();
@@ -3889,8 +4271,11 @@ let UniverSheetsTablePlugin = class UniverSheetsTablePlugin extends _univerjs_co
3889
4271
  RemoveTableThemeCommand,
3890
4272
  SheetTableInsertRowCommand,
3891
4273
  SheetTableInsertColCommand,
4274
+ SheetTableInsertRowAtCommand,
4275
+ SheetTableInsertColumnAtCommand,
3892
4276
  SheetTableRemoveRowCommand,
3893
- SheetTableRemoveColCommand
4277
+ SheetTableRemoveColCommand,
4278
+ SheetTableRemoveColumnAtCommand
3894
4279
  ].forEach((m) => this._commandService.registerCommand(m));
3895
4280
  }
3896
4281
  };
@@ -3917,8 +4302,11 @@ exports.SetSheetTableFilterCommand = SetSheetTableFilterCommand;
3917
4302
  exports.SetSheetTableFilterMutation = SetSheetTableFilterMutation;
3918
4303
  exports.SetSheetTableMutation = SetSheetTableMutation;
3919
4304
  exports.SheetTableInsertColCommand = SheetTableInsertColCommand;
4305
+ exports.SheetTableInsertColumnAtCommand = SheetTableInsertColumnAtCommand;
4306
+ exports.SheetTableInsertRowAtCommand = SheetTableInsertRowAtCommand;
3920
4307
  exports.SheetTableInsertRowCommand = SheetTableInsertRowCommand;
3921
4308
  exports.SheetTableRemoveColCommand = SheetTableRemoveColCommand;
4309
+ exports.SheetTableRemoveColumnAtCommand = SheetTableRemoveColumnAtCommand;
3922
4310
  exports.SheetTableRemoveRowCommand = SheetTableRemoveRowCommand;
3923
4311
  Object.defineProperty(exports, 'SheetTableService', {
3924
4312
  enumerable: true,
@@ -3934,6 +4322,7 @@ Object.defineProperty(exports, 'SheetsTableController', {
3934
4322
  }
3935
4323
  });
3936
4324
  exports.SheetsTableSortStateEnum = SheetsTableSortStateEnum;
4325
+ exports.TABLE_FILTER_EMPTY_VALUE = TABLE_FILTER_EMPTY_VALUE;
3937
4326
  exports.TableColumnDataTypeEnum = TableColumnDataTypeEnum;
3938
4327
  exports.TableColumnFilterTypeEnum = TableColumnFilterTypeEnum;
3939
4328
  exports.TableConditionTypeEnum = TableConditionTypeEnum;
@@ -3953,6 +4342,8 @@ Object.defineProperty(exports, 'UniverSheetsTablePlugin', {
3953
4342
  }
3954
4343
  });
3955
4344
  exports.customEmptyThemeWithBorderStyle = customEmptyThemeWithBorderStyle;
4345
+ exports.getExistingNamesSet = getExistingNamesSet;
3956
4346
  exports.isConditionFilter = isConditionFilter;
3957
4347
  exports.isManualTableFilter = isManualTableFilter;
3958
- exports.processStyleWithBorderStyle = processStyleWithBorderStyle;
4348
+ exports.processStyleWithBorderStyle = processStyleWithBorderStyle;
4349
+ exports.validateSheetTableName = validateSheetTableName;