@univerjs/sheets-table 0.22.1 → 0.23.0-insiders.20260522-e8f2a3b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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",
@@ -1839,7 +1839,8 @@ let TableManager = class TableManager extends _univerjs_core.Disposable {
1839
1839
  }
1840
1840
  } else if (newRange.endColumn > oldRange.endColumn) {
1841
1841
  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")));
1842
+ const columnPrefix = this._localeService.t("sheets-table.columnPrefix");
1843
+ for (let i = 0; i < diff; i++) table.insertColumn(oldRange.endColumn, new TableColumn((0, _univerjs_core.generateRandomId)(), getColumnName(table.getColumnsCount() + 1, columnPrefix)));
1843
1844
  }
1844
1845
  table.setRange(newRange);
1845
1846
  this._tableRangeChanged$.next({
@@ -2305,6 +2306,37 @@ const RemoveTableThemeCommand = {
2305
2306
  }
2306
2307
  };
2307
2308
 
2309
+ //#endregion
2310
+ //#region src/util/table-name.ts
2311
+ /**
2312
+ * Copyright 2023-present DreamNum Co., Ltd.
2313
+ *
2314
+ * Licensed under the Apache License, Version 2.0 (the "License");
2315
+ * you may not use this file except in compliance with the License.
2316
+ * You may obtain a copy of the License at
2317
+ *
2318
+ * http://www.apache.org/licenses/LICENSE-2.0
2319
+ *
2320
+ * Unless required by applicable law or agreed to in writing, software
2321
+ * distributed under the License is distributed on an "AS IS" BASIS,
2322
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2323
+ * See the License for the specific language governing permissions and
2324
+ * limitations under the License.
2325
+ */
2326
+ function validateSheetTableName(name, existingNamesSet) {
2327
+ const trimmedName = name.trim();
2328
+ if (!trimmedName) return {
2329
+ valid: false,
2330
+ reason: "empty"
2331
+ };
2332
+ const normalizedExistingNames = new Set(Array.from(existingNamesSet, (item) => item.toLowerCase()));
2333
+ if (!(0, _univerjs_core.customNameCharacterCheck)(trimmedName.toLowerCase(), normalizedExistingNames)) return {
2334
+ valid: false,
2335
+ reason: "invalid"
2336
+ };
2337
+ return { valid: true };
2338
+ }
2339
+
2308
2340
  //#endregion
2309
2341
  //#region src/commands/commands/set-sheet-table.command.ts
2310
2342
  const SetSheetTableCommand = {
@@ -2325,7 +2357,7 @@ const SetSheetTableCommand = {
2325
2357
  definedNamesService: accessor.get(_univerjs_engine_formula.IDefinedNamesService)
2326
2358
  });
2327
2359
  if (name) {
2328
- if (!(0, _univerjs_core.customNameCharacterCheck)(name.toLowerCase(), existingNamesSet)) {
2360
+ if (!validateSheetTableName(name, existingNamesSet).valid) {
2329
2361
  accessor.get(_univerjs_core.ILogService).warn(localeService.t("sheets-table.tableNameError"));
2330
2362
  return false;
2331
2363
  }
@@ -2678,6 +2710,17 @@ SheetsTableController = __decorate([
2678
2710
 
2679
2711
  //#endregion
2680
2712
  //#region src/commands/commands/sheet-table-row-col.command.ts
2713
+ function executeTableMutationSequence(accessor, unitId, redos, undos) {
2714
+ if ((0, _univerjs_core.sequenceExecute)(redos, accessor.get(_univerjs_core.ICommandService)).result) {
2715
+ accessor.get(_univerjs_core.IUndoRedoService).pushUndoRedo({
2716
+ unitID: unitId,
2717
+ undoMutations: undos,
2718
+ redoMutations: redos
2719
+ });
2720
+ return true;
2721
+ }
2722
+ return false;
2723
+ }
2681
2724
  const SheetTableInsertRowCommand = {
2682
2725
  id: "sheet.command.table-insert-row",
2683
2726
  type: _univerjs_core.CommandType.COMMAND,
@@ -2792,6 +2835,70 @@ const SheetTableInsertRowCommand = {
2792
2835
  return false;
2793
2836
  }
2794
2837
  };
2838
+ const SheetTableInsertRowAtCommand = {
2839
+ id: "sheet.command.table-insert-row-at",
2840
+ type: _univerjs_core.CommandType.COMMAND,
2841
+ handler: (accessor, params) => {
2842
+ if (!params) return false;
2843
+ const { unitId, subUnitId, tableId, index, count = 1 } = params;
2844
+ if (count <= 0) return false;
2845
+ const target = (0, _univerjs_sheets.getSheetCommandTarget)(accessor.get(_univerjs_core.IUniverInstanceService), {
2846
+ unitId,
2847
+ subUnitId
2848
+ });
2849
+ if (!target) return false;
2850
+ const table = accessor.get(TableManager).getTableById(unitId, tableId);
2851
+ if (!table || table.getSubunitId() !== subUnitId) return false;
2852
+ const oldRange = table.getRange();
2853
+ if (index <= oldRange.startRow || index > oldRange.endRow + 1) return false;
2854
+ const redos = [{
2855
+ id: SetSheetTableMutation.id,
2856
+ params: {
2857
+ unitId,
2858
+ subUnitId,
2859
+ tableId,
2860
+ config: { updateRange: { newRange: {
2861
+ ...oldRange,
2862
+ endRow: oldRange.endRow + count
2863
+ } } }
2864
+ }
2865
+ }];
2866
+ const undos = [{
2867
+ id: SetSheetTableMutation.id,
2868
+ params: {
2869
+ unitId,
2870
+ subUnitId,
2871
+ tableId,
2872
+ config: { updateRange: { newRange: { ...oldRange } } }
2873
+ }
2874
+ }];
2875
+ const rowContentIndex = target.worksheet.getCellMatrix().getDataRange().endRow;
2876
+ const moveRangeMutations = (0, _univerjs_sheets.getMoveRangeUndoRedoMutations)(accessor, {
2877
+ unitId,
2878
+ subUnitId,
2879
+ range: {
2880
+ startRow: index,
2881
+ endRow: rowContentIndex,
2882
+ startColumn: oldRange.startColumn,
2883
+ endColumn: oldRange.endColumn
2884
+ }
2885
+ }, {
2886
+ unitId,
2887
+ subUnitId,
2888
+ range: {
2889
+ startRow: index + count,
2890
+ endRow: rowContentIndex + count,
2891
+ startColumn: oldRange.startColumn,
2892
+ endColumn: oldRange.endColumn
2893
+ }
2894
+ });
2895
+ if (moveRangeMutations) {
2896
+ redos.push(...moveRangeMutations.redos);
2897
+ undos.push(...moveRangeMutations.undos);
2898
+ }
2899
+ return executeTableMutationSequence(accessor, unitId, redos, undos);
2900
+ }
2901
+ };
2795
2902
  const SheetTableInsertColCommand = {
2796
2903
  id: "sheet.command.table-insert-col",
2797
2904
  type: _univerjs_core.CommandType.COMMAND,
@@ -2919,6 +3026,159 @@ const SheetTableInsertColCommand = {
2919
3026
  return false;
2920
3027
  }
2921
3028
  };
3029
+ const SheetTableInsertColumnAtCommand = {
3030
+ id: "sheet.command.table-insert-column-at",
3031
+ type: _univerjs_core.CommandType.COMMAND,
3032
+ handler: (accessor, params) => {
3033
+ if (!params) return false;
3034
+ const { unitId, subUnitId, tableId, index, count = 1 } = params;
3035
+ if (count <= 0) return false;
3036
+ const target = (0, _univerjs_sheets.getSheetCommandTarget)(accessor.get(_univerjs_core.IUniverInstanceService), {
3037
+ unitId,
3038
+ subUnitId
3039
+ });
3040
+ if (!target) return false;
3041
+ const table = accessor.get(TableManager).getTableById(unitId, tableId);
3042
+ if (!table || table.getSubunitId() !== subUnitId) return false;
3043
+ const oldRange = table.getRange();
3044
+ if (index < oldRange.startColumn || index > oldRange.endColumn + 1) return false;
3045
+ const redos = [{
3046
+ id: SetSheetTableMutation.id,
3047
+ params: {
3048
+ unitId,
3049
+ subUnitId,
3050
+ tableId,
3051
+ config: { rowColOperation: {
3052
+ operationType: "insert",
3053
+ rowColType: "column",
3054
+ index,
3055
+ count
3056
+ } }
3057
+ }
3058
+ }];
3059
+ const undos = [{
3060
+ id: SetSheetTableMutation.id,
3061
+ params: {
3062
+ unitId,
3063
+ subUnitId,
3064
+ tableId,
3065
+ config: { rowColOperation: {
3066
+ operationType: "delete",
3067
+ rowColType: "column",
3068
+ index,
3069
+ count
3070
+ } }
3071
+ }
3072
+ }];
3073
+ const colContentIndex = target.worksheet.getCellMatrix().getDataRange().endColumn;
3074
+ if (index <= colContentIndex) {
3075
+ const moveRangeMutations = (0, _univerjs_sheets.getMoveRangeUndoRedoMutations)(accessor, {
3076
+ unitId,
3077
+ subUnitId,
3078
+ range: {
3079
+ startRow: oldRange.startRow,
3080
+ endRow: oldRange.endRow,
3081
+ startColumn: index,
3082
+ endColumn: colContentIndex
3083
+ }
3084
+ }, {
3085
+ unitId,
3086
+ subUnitId,
3087
+ range: {
3088
+ startRow: oldRange.startRow,
3089
+ endRow: oldRange.endRow,
3090
+ startColumn: index + count,
3091
+ endColumn: colContentIndex + count
3092
+ }
3093
+ });
3094
+ if (moveRangeMutations) {
3095
+ redos.push(...moveRangeMutations.redos);
3096
+ undos.push(...moveRangeMutations.undos);
3097
+ }
3098
+ }
3099
+ return executeTableMutationSequence(accessor, unitId, redos, undos);
3100
+ }
3101
+ };
3102
+ const SheetTableRemoveColumnAtCommand = {
3103
+ id: "sheet.command.table-remove-column-at",
3104
+ type: _univerjs_core.CommandType.COMMAND,
3105
+ handler: (accessor, params) => {
3106
+ if (!params) return false;
3107
+ const { unitId, subUnitId, tableId, index, count = 1 } = params;
3108
+ if (count <= 0) return false;
3109
+ const target = (0, _univerjs_sheets.getSheetCommandTarget)(accessor.get(_univerjs_core.IUniverInstanceService), {
3110
+ unitId,
3111
+ subUnitId
3112
+ });
3113
+ if (!target) return false;
3114
+ const table = accessor.get(TableManager).getTableById(unitId, tableId);
3115
+ if (!table || table.getSubunitId() !== subUnitId) return false;
3116
+ const oldRange = table.getRange();
3117
+ if (index < oldRange.startColumn || index + count - 1 > oldRange.endColumn || count >= oldRange.endColumn - oldRange.startColumn + 1) return false;
3118
+ const columns = [];
3119
+ const gap = index - oldRange.startColumn;
3120
+ for (let i = 0; i < count; i++) {
3121
+ const column = table.getTableInfo().columns[gap + i];
3122
+ if (column) columns.push(column);
3123
+ }
3124
+ const redos = [{
3125
+ id: SetSheetTableMutation.id,
3126
+ params: {
3127
+ unitId,
3128
+ subUnitId,
3129
+ tableId,
3130
+ config: { rowColOperation: {
3131
+ operationType: "delete",
3132
+ rowColType: "column",
3133
+ index,
3134
+ count
3135
+ } }
3136
+ }
3137
+ }];
3138
+ const undos = [{
3139
+ id: SetSheetTableMutation.id,
3140
+ params: {
3141
+ unitId,
3142
+ subUnitId,
3143
+ tableId,
3144
+ config: { rowColOperation: {
3145
+ operationType: "insert",
3146
+ rowColType: "column",
3147
+ index,
3148
+ count,
3149
+ columnsJson: columns
3150
+ } }
3151
+ }
3152
+ }];
3153
+ const colContentIndex = target.worksheet.getCellMatrix().getDataRange().endColumn;
3154
+ if (index + count <= colContentIndex) {
3155
+ const moveRangeMutations = (0, _univerjs_sheets.getMoveRangeUndoRedoMutations)(accessor, {
3156
+ unitId,
3157
+ subUnitId,
3158
+ range: {
3159
+ startRow: oldRange.startRow,
3160
+ endRow: oldRange.endRow,
3161
+ startColumn: index + count,
3162
+ endColumn: colContentIndex
3163
+ }
3164
+ }, {
3165
+ unitId,
3166
+ subUnitId,
3167
+ range: {
3168
+ startRow: oldRange.startRow,
3169
+ endRow: oldRange.endRow,
3170
+ startColumn: index,
3171
+ endColumn: colContentIndex - count
3172
+ }
3173
+ });
3174
+ if (moveRangeMutations) {
3175
+ redos.push(...moveRangeMutations.redos);
3176
+ undos.push(...moveRangeMutations.undos);
3177
+ }
3178
+ }
3179
+ return executeTableMutationSequence(accessor, unitId, redos, undos);
3180
+ }
3181
+ };
2922
3182
  const SheetTableRemoveRowCommand = {
2923
3183
  id: "sheet.command.table-remove-row",
2924
3184
  type: _univerjs_core.CommandType.COMMAND,
@@ -3084,7 +3344,7 @@ const SheetTableRemoveColCommand = {
3084
3344
  //#endregion
3085
3345
  //#region package.json
3086
3346
  var name = "@univerjs/sheets-table";
3087
- var version = "0.22.1";
3347
+ var version = "0.23.0-insiders.20260522-e8f2a3b";
3088
3348
 
3089
3349
  //#endregion
3090
3350
  //#region src/controllers/sheet-table-formula.controller.ts
@@ -3889,8 +4149,11 @@ let UniverSheetsTablePlugin = class UniverSheetsTablePlugin extends _univerjs_co
3889
4149
  RemoveTableThemeCommand,
3890
4150
  SheetTableInsertRowCommand,
3891
4151
  SheetTableInsertColCommand,
4152
+ SheetTableInsertRowAtCommand,
4153
+ SheetTableInsertColumnAtCommand,
3892
4154
  SheetTableRemoveRowCommand,
3893
- SheetTableRemoveColCommand
4155
+ SheetTableRemoveColCommand,
4156
+ SheetTableRemoveColumnAtCommand
3894
4157
  ].forEach((m) => this._commandService.registerCommand(m));
3895
4158
  }
3896
4159
  };
@@ -3917,8 +4180,11 @@ exports.SetSheetTableFilterCommand = SetSheetTableFilterCommand;
3917
4180
  exports.SetSheetTableFilterMutation = SetSheetTableFilterMutation;
3918
4181
  exports.SetSheetTableMutation = SetSheetTableMutation;
3919
4182
  exports.SheetTableInsertColCommand = SheetTableInsertColCommand;
4183
+ exports.SheetTableInsertColumnAtCommand = SheetTableInsertColumnAtCommand;
4184
+ exports.SheetTableInsertRowAtCommand = SheetTableInsertRowAtCommand;
3920
4185
  exports.SheetTableInsertRowCommand = SheetTableInsertRowCommand;
3921
4186
  exports.SheetTableRemoveColCommand = SheetTableRemoveColCommand;
4187
+ exports.SheetTableRemoveColumnAtCommand = SheetTableRemoveColumnAtCommand;
3922
4188
  exports.SheetTableRemoveRowCommand = SheetTableRemoveRowCommand;
3923
4189
  Object.defineProperty(exports, 'SheetTableService', {
3924
4190
  enumerable: true,
@@ -3953,6 +4219,8 @@ Object.defineProperty(exports, 'UniverSheetsTablePlugin', {
3953
4219
  }
3954
4220
  });
3955
4221
  exports.customEmptyThemeWithBorderStyle = customEmptyThemeWithBorderStyle;
4222
+ exports.getExistingNamesSet = getExistingNamesSet;
3956
4223
  exports.isConditionFilter = isConditionFilter;
3957
4224
  exports.isManualTableFilter = isManualTableFilter;
3958
- exports.processStyleWithBorderStyle = processStyleWithBorderStyle;
4225
+ exports.processStyleWithBorderStyle = processStyleWithBorderStyle;
4226
+ exports.validateSheetTableName = validateSheetTableName;
package/lib/es/index.js CHANGED
@@ -247,8 +247,8 @@ const tableDefaultThemeStyleArr = [
247
247
  [[
248
248
  "#6280F9",
249
249
  "#FFFFFF",
250
- "#BAC6F8",
251
- "#D2DAFA"
250
+ "#EEF2FF",
251
+ "#DCE4FF"
252
252
  ], ["#fff"]],
253
253
  [[
254
254
  "#16BDCA",
@@ -1838,7 +1838,8 @@ let TableManager = class TableManager extends Disposable {
1838
1838
  }
1839
1839
  } else if (newRange.endColumn > oldRange.endColumn) {
1840
1840
  const diff = newRange.endColumn - oldRange.endColumn;
1841
- for (let i = 0; i < diff; i++) table.insertColumn(oldRange.endColumn, new TableColumn(generateRandomId(), getColumnName(table.getColumnsCount() + 1, "Column")));
1841
+ const columnPrefix = this._localeService.t("sheets-table.columnPrefix");
1842
+ for (let i = 0; i < diff; i++) table.insertColumn(oldRange.endColumn, new TableColumn(generateRandomId(), getColumnName(table.getColumnsCount() + 1, columnPrefix)));
1842
1843
  }
1843
1844
  table.setRange(newRange);
1844
1845
  this._tableRangeChanged$.next({
@@ -2304,6 +2305,37 @@ const RemoveTableThemeCommand = {
2304
2305
  }
2305
2306
  };
2306
2307
 
2308
+ //#endregion
2309
+ //#region src/util/table-name.ts
2310
+ /**
2311
+ * Copyright 2023-present DreamNum Co., Ltd.
2312
+ *
2313
+ * Licensed under the Apache License, Version 2.0 (the "License");
2314
+ * you may not use this file except in compliance with the License.
2315
+ * You may obtain a copy of the License at
2316
+ *
2317
+ * http://www.apache.org/licenses/LICENSE-2.0
2318
+ *
2319
+ * Unless required by applicable law or agreed to in writing, software
2320
+ * distributed under the License is distributed on an "AS IS" BASIS,
2321
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2322
+ * See the License for the specific language governing permissions and
2323
+ * limitations under the License.
2324
+ */
2325
+ function validateSheetTableName(name, existingNamesSet) {
2326
+ const trimmedName = name.trim();
2327
+ if (!trimmedName) return {
2328
+ valid: false,
2329
+ reason: "empty"
2330
+ };
2331
+ const normalizedExistingNames = new Set(Array.from(existingNamesSet, (item) => item.toLowerCase()));
2332
+ if (!customNameCharacterCheck(trimmedName.toLowerCase(), normalizedExistingNames)) return {
2333
+ valid: false,
2334
+ reason: "invalid"
2335
+ };
2336
+ return { valid: true };
2337
+ }
2338
+
2307
2339
  //#endregion
2308
2340
  //#region src/commands/commands/set-sheet-table.command.ts
2309
2341
  const SetSheetTableCommand = {
@@ -2324,7 +2356,7 @@ const SetSheetTableCommand = {
2324
2356
  definedNamesService: accessor.get(IDefinedNamesService)
2325
2357
  });
2326
2358
  if (name) {
2327
- if (!customNameCharacterCheck(name.toLowerCase(), existingNamesSet)) {
2359
+ if (!validateSheetTableName(name, existingNamesSet).valid) {
2328
2360
  accessor.get(ILogService).warn(localeService.t("sheets-table.tableNameError"));
2329
2361
  return false;
2330
2362
  }
@@ -2677,6 +2709,17 @@ SheetsTableController = __decorate([
2677
2709
 
2678
2710
  //#endregion
2679
2711
  //#region src/commands/commands/sheet-table-row-col.command.ts
2712
+ function executeTableMutationSequence(accessor, unitId, redos, undos) {
2713
+ if (sequenceExecute(redos, accessor.get(ICommandService)).result) {
2714
+ accessor.get(IUndoRedoService).pushUndoRedo({
2715
+ unitID: unitId,
2716
+ undoMutations: undos,
2717
+ redoMutations: redos
2718
+ });
2719
+ return true;
2720
+ }
2721
+ return false;
2722
+ }
2680
2723
  const SheetTableInsertRowCommand = {
2681
2724
  id: "sheet.command.table-insert-row",
2682
2725
  type: CommandType.COMMAND,
@@ -2791,6 +2834,70 @@ const SheetTableInsertRowCommand = {
2791
2834
  return false;
2792
2835
  }
2793
2836
  };
2837
+ const SheetTableInsertRowAtCommand = {
2838
+ id: "sheet.command.table-insert-row-at",
2839
+ type: CommandType.COMMAND,
2840
+ handler: (accessor, params) => {
2841
+ if (!params) return false;
2842
+ const { unitId, subUnitId, tableId, index, count = 1 } = params;
2843
+ if (count <= 0) return false;
2844
+ const target = getSheetCommandTarget(accessor.get(IUniverInstanceService), {
2845
+ unitId,
2846
+ subUnitId
2847
+ });
2848
+ if (!target) return false;
2849
+ const table = accessor.get(TableManager).getTableById(unitId, tableId);
2850
+ if (!table || table.getSubunitId() !== subUnitId) return false;
2851
+ const oldRange = table.getRange();
2852
+ if (index <= oldRange.startRow || index > oldRange.endRow + 1) return false;
2853
+ const redos = [{
2854
+ id: SetSheetTableMutation.id,
2855
+ params: {
2856
+ unitId,
2857
+ subUnitId,
2858
+ tableId,
2859
+ config: { updateRange: { newRange: {
2860
+ ...oldRange,
2861
+ endRow: oldRange.endRow + count
2862
+ } } }
2863
+ }
2864
+ }];
2865
+ const undos = [{
2866
+ id: SetSheetTableMutation.id,
2867
+ params: {
2868
+ unitId,
2869
+ subUnitId,
2870
+ tableId,
2871
+ config: { updateRange: { newRange: { ...oldRange } } }
2872
+ }
2873
+ }];
2874
+ const rowContentIndex = target.worksheet.getCellMatrix().getDataRange().endRow;
2875
+ const moveRangeMutations = getMoveRangeUndoRedoMutations(accessor, {
2876
+ unitId,
2877
+ subUnitId,
2878
+ range: {
2879
+ startRow: index,
2880
+ endRow: rowContentIndex,
2881
+ startColumn: oldRange.startColumn,
2882
+ endColumn: oldRange.endColumn
2883
+ }
2884
+ }, {
2885
+ unitId,
2886
+ subUnitId,
2887
+ range: {
2888
+ startRow: index + count,
2889
+ endRow: rowContentIndex + count,
2890
+ startColumn: oldRange.startColumn,
2891
+ endColumn: oldRange.endColumn
2892
+ }
2893
+ });
2894
+ if (moveRangeMutations) {
2895
+ redos.push(...moveRangeMutations.redos);
2896
+ undos.push(...moveRangeMutations.undos);
2897
+ }
2898
+ return executeTableMutationSequence(accessor, unitId, redos, undos);
2899
+ }
2900
+ };
2794
2901
  const SheetTableInsertColCommand = {
2795
2902
  id: "sheet.command.table-insert-col",
2796
2903
  type: CommandType.COMMAND,
@@ -2918,6 +3025,159 @@ const SheetTableInsertColCommand = {
2918
3025
  return false;
2919
3026
  }
2920
3027
  };
3028
+ const SheetTableInsertColumnAtCommand = {
3029
+ id: "sheet.command.table-insert-column-at",
3030
+ type: CommandType.COMMAND,
3031
+ handler: (accessor, params) => {
3032
+ if (!params) return false;
3033
+ const { unitId, subUnitId, tableId, index, count = 1 } = params;
3034
+ if (count <= 0) return false;
3035
+ const target = getSheetCommandTarget(accessor.get(IUniverInstanceService), {
3036
+ unitId,
3037
+ subUnitId
3038
+ });
3039
+ if (!target) return false;
3040
+ const table = accessor.get(TableManager).getTableById(unitId, tableId);
3041
+ if (!table || table.getSubunitId() !== subUnitId) return false;
3042
+ const oldRange = table.getRange();
3043
+ if (index < oldRange.startColumn || index > oldRange.endColumn + 1) return false;
3044
+ const redos = [{
3045
+ id: SetSheetTableMutation.id,
3046
+ params: {
3047
+ unitId,
3048
+ subUnitId,
3049
+ tableId,
3050
+ config: { rowColOperation: {
3051
+ operationType: "insert",
3052
+ rowColType: "column",
3053
+ index,
3054
+ count
3055
+ } }
3056
+ }
3057
+ }];
3058
+ const undos = [{
3059
+ id: SetSheetTableMutation.id,
3060
+ params: {
3061
+ unitId,
3062
+ subUnitId,
3063
+ tableId,
3064
+ config: { rowColOperation: {
3065
+ operationType: "delete",
3066
+ rowColType: "column",
3067
+ index,
3068
+ count
3069
+ } }
3070
+ }
3071
+ }];
3072
+ const colContentIndex = target.worksheet.getCellMatrix().getDataRange().endColumn;
3073
+ if (index <= colContentIndex) {
3074
+ const moveRangeMutations = getMoveRangeUndoRedoMutations(accessor, {
3075
+ unitId,
3076
+ subUnitId,
3077
+ range: {
3078
+ startRow: oldRange.startRow,
3079
+ endRow: oldRange.endRow,
3080
+ startColumn: index,
3081
+ endColumn: colContentIndex
3082
+ }
3083
+ }, {
3084
+ unitId,
3085
+ subUnitId,
3086
+ range: {
3087
+ startRow: oldRange.startRow,
3088
+ endRow: oldRange.endRow,
3089
+ startColumn: index + count,
3090
+ endColumn: colContentIndex + count
3091
+ }
3092
+ });
3093
+ if (moveRangeMutations) {
3094
+ redos.push(...moveRangeMutations.redos);
3095
+ undos.push(...moveRangeMutations.undos);
3096
+ }
3097
+ }
3098
+ return executeTableMutationSequence(accessor, unitId, redos, undos);
3099
+ }
3100
+ };
3101
+ const SheetTableRemoveColumnAtCommand = {
3102
+ id: "sheet.command.table-remove-column-at",
3103
+ type: CommandType.COMMAND,
3104
+ handler: (accessor, params) => {
3105
+ if (!params) return false;
3106
+ const { unitId, subUnitId, tableId, index, count = 1 } = params;
3107
+ if (count <= 0) return false;
3108
+ const target = getSheetCommandTarget(accessor.get(IUniverInstanceService), {
3109
+ unitId,
3110
+ subUnitId
3111
+ });
3112
+ if (!target) return false;
3113
+ const table = accessor.get(TableManager).getTableById(unitId, tableId);
3114
+ if (!table || table.getSubunitId() !== subUnitId) return false;
3115
+ const oldRange = table.getRange();
3116
+ if (index < oldRange.startColumn || index + count - 1 > oldRange.endColumn || count >= oldRange.endColumn - oldRange.startColumn + 1) return false;
3117
+ const columns = [];
3118
+ const gap = index - oldRange.startColumn;
3119
+ for (let i = 0; i < count; i++) {
3120
+ const column = table.getTableInfo().columns[gap + i];
3121
+ if (column) columns.push(column);
3122
+ }
3123
+ const redos = [{
3124
+ id: SetSheetTableMutation.id,
3125
+ params: {
3126
+ unitId,
3127
+ subUnitId,
3128
+ tableId,
3129
+ config: { rowColOperation: {
3130
+ operationType: "delete",
3131
+ rowColType: "column",
3132
+ index,
3133
+ count
3134
+ } }
3135
+ }
3136
+ }];
3137
+ const undos = [{
3138
+ id: SetSheetTableMutation.id,
3139
+ params: {
3140
+ unitId,
3141
+ subUnitId,
3142
+ tableId,
3143
+ config: { rowColOperation: {
3144
+ operationType: "insert",
3145
+ rowColType: "column",
3146
+ index,
3147
+ count,
3148
+ columnsJson: columns
3149
+ } }
3150
+ }
3151
+ }];
3152
+ const colContentIndex = target.worksheet.getCellMatrix().getDataRange().endColumn;
3153
+ if (index + count <= colContentIndex) {
3154
+ const moveRangeMutations = getMoveRangeUndoRedoMutations(accessor, {
3155
+ unitId,
3156
+ subUnitId,
3157
+ range: {
3158
+ startRow: oldRange.startRow,
3159
+ endRow: oldRange.endRow,
3160
+ startColumn: index + count,
3161
+ endColumn: colContentIndex
3162
+ }
3163
+ }, {
3164
+ unitId,
3165
+ subUnitId,
3166
+ range: {
3167
+ startRow: oldRange.startRow,
3168
+ endRow: oldRange.endRow,
3169
+ startColumn: index,
3170
+ endColumn: colContentIndex - count
3171
+ }
3172
+ });
3173
+ if (moveRangeMutations) {
3174
+ redos.push(...moveRangeMutations.redos);
3175
+ undos.push(...moveRangeMutations.undos);
3176
+ }
3177
+ }
3178
+ return executeTableMutationSequence(accessor, unitId, redos, undos);
3179
+ }
3180
+ };
2921
3181
  const SheetTableRemoveRowCommand = {
2922
3182
  id: "sheet.command.table-remove-row",
2923
3183
  type: CommandType.COMMAND,
@@ -3083,7 +3343,7 @@ const SheetTableRemoveColCommand = {
3083
3343
  //#endregion
3084
3344
  //#region package.json
3085
3345
  var name = "@univerjs/sheets-table";
3086
- var version = "0.22.1";
3346
+ var version = "0.23.0-insiders.20260522-e8f2a3b";
3087
3347
 
3088
3348
  //#endregion
3089
3349
  //#region src/controllers/sheet-table-formula.controller.ts
@@ -3888,8 +4148,11 @@ let UniverSheetsTablePlugin = class UniverSheetsTablePlugin extends Plugin {
3888
4148
  RemoveTableThemeCommand,
3889
4149
  SheetTableInsertRowCommand,
3890
4150
  SheetTableInsertColCommand,
4151
+ SheetTableInsertRowAtCommand,
4152
+ SheetTableInsertColumnAtCommand,
3891
4153
  SheetTableRemoveRowCommand,
3892
- SheetTableRemoveColCommand
4154
+ SheetTableRemoveColCommand,
4155
+ SheetTableRemoveColumnAtCommand
3893
4156
  ].forEach((m) => this._commandService.registerCommand(m));
3894
4157
  }
3895
4158
  };
@@ -3904,4 +4167,4 @@ UniverSheetsTablePlugin = __decorate([
3904
4167
  ], UniverSheetsTablePlugin);
3905
4168
 
3906
4169
  //#endregion
3907
- export { AddSheetTableCommand, AddSheetTableMutation, AddTableThemeCommand, DeleteSheetTableCommand, DeleteSheetTableMutation, RemoveTableThemeCommand, SHEET_TABLE_CUSTOM_THEME_PREFIX, SetSheetTableCommand, SetSheetTableFilterCommand, SetSheetTableFilterMutation, SetSheetTableMutation, SheetTableInsertColCommand, SheetTableInsertRowCommand, SheetTableRemoveColCommand, SheetTableRemoveRowCommand, SheetTableService, SheetsTableButtonStateEnum, SheetsTableController, SheetsTableSortStateEnum, TableColumnDataTypeEnum, TableColumnFilterTypeEnum, TableConditionTypeEnum, TableDateCompareTypeEnum, TableManager, TableNumberCompareTypeEnum, TableStringCompareTypeEnum, UniverSheetsTablePlugin, customEmptyThemeWithBorderStyle, isConditionFilter, isManualTableFilter, processStyleWithBorderStyle };
4170
+ export { AddSheetTableCommand, AddSheetTableMutation, AddTableThemeCommand, DeleteSheetTableCommand, DeleteSheetTableMutation, RemoveTableThemeCommand, SHEET_TABLE_CUSTOM_THEME_PREFIX, SetSheetTableCommand, SetSheetTableFilterCommand, SetSheetTableFilterMutation, SetSheetTableMutation, SheetTableInsertColCommand, SheetTableInsertColumnAtCommand, SheetTableInsertRowAtCommand, SheetTableInsertRowCommand, SheetTableRemoveColCommand, SheetTableRemoveColumnAtCommand, SheetTableRemoveRowCommand, SheetTableService, SheetsTableButtonStateEnum, SheetsTableController, SheetsTableSortStateEnum, TableColumnDataTypeEnum, TableColumnFilterTypeEnum, TableConditionTypeEnum, TableDateCompareTypeEnum, TableManager, TableNumberCompareTypeEnum, TableStringCompareTypeEnum, UniverSheetsTablePlugin, customEmptyThemeWithBorderStyle, getExistingNamesSet, isConditionFilter, isManualTableFilter, processStyleWithBorderStyle, validateSheetTableName };