@univerjs/sheets-table 0.23.0 → 0.24.0-insiders.20260527-b1d726f
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 +468 -80
- package/lib/cjs/locale/ar-SA.js +10 -0
- package/lib/cjs/locale/ca-ES.js +10 -0
- package/lib/cjs/locale/de-DE.js +10 -0
- package/lib/cjs/locale/en-US.js +25 -0
- package/lib/cjs/locale/es-ES.js +10 -0
- package/lib/cjs/locale/fa-IR.js +10 -0
- package/lib/cjs/locale/fr-FR.js +10 -0
- package/lib/cjs/locale/id-ID.js +10 -0
- package/lib/cjs/locale/it-IT.js +10 -0
- package/lib/cjs/locale/ja-JP.js +10 -0
- package/lib/cjs/locale/ko-KR.js +10 -0
- package/lib/cjs/locale/pl-PL.js +10 -0
- package/lib/cjs/locale/pt-BR.js +10 -0
- package/lib/cjs/locale/ru-RU.js +10 -0
- package/lib/cjs/locale/sk-SK.js +10 -0
- package/lib/cjs/locale/vi-VN.js +10 -0
- package/lib/cjs/locale/zh-CN.js +10 -0
- package/lib/cjs/locale/zh-HK.js +10 -0
- package/lib/cjs/locale/zh-TW.js +10 -0
- package/lib/es/index.js +463 -80
- package/lib/es/locale/ar-SA.js +9 -0
- package/lib/es/locale/ca-ES.js +9 -0
- package/lib/es/locale/de-DE.js +9 -0
- package/lib/es/locale/en-US.js +24 -0
- package/lib/es/locale/es-ES.js +9 -0
- package/lib/es/locale/fa-IR.js +9 -0
- package/lib/es/locale/fr-FR.js +9 -0
- package/lib/es/locale/id-ID.js +9 -0
- package/lib/es/locale/it-IT.js +9 -0
- package/lib/es/locale/ja-JP.js +9 -0
- package/lib/es/locale/ko-KR.js +9 -0
- package/lib/es/locale/pl-PL.js +9 -0
- package/lib/es/locale/pt-BR.js +9 -0
- package/lib/es/locale/ru-RU.js +9 -0
- package/lib/es/locale/sk-SK.js +9 -0
- package/lib/es/locale/vi-VN.js +9 -0
- package/lib/es/locale/zh-CN.js +9 -0
- package/lib/es/locale/zh-HK.js +9 -0
- package/lib/es/locale/zh-TW.js +9 -0
- package/lib/index.js +463 -80
- package/lib/locale/ar-SA.js +9 -0
- package/lib/locale/ca-ES.js +9 -0
- package/lib/locale/de-DE.js +9 -0
- package/lib/locale/en-US.js +24 -0
- package/lib/locale/es-ES.js +9 -0
- package/lib/locale/fa-IR.js +9 -0
- package/lib/locale/fr-FR.js +9 -0
- package/lib/locale/id-ID.js +9 -0
- package/lib/locale/it-IT.js +9 -0
- package/lib/locale/ja-JP.js +9 -0
- package/lib/locale/ko-KR.js +9 -0
- package/lib/locale/pl-PL.js +9 -0
- package/lib/locale/pt-BR.js +9 -0
- package/lib/locale/ru-RU.js +9 -0
- package/lib/locale/sk-SK.js +9 -0
- package/lib/locale/vi-VN.js +9 -0
- package/lib/locale/zh-CN.js +9 -0
- package/lib/locale/zh-HK.js +9 -0
- package/lib/locale/zh-TW.js +9 -0
- package/lib/types/commands/commands/set-sheet-table.command.d.ts +1 -0
- package/lib/types/commands/commands/sheet-table-row-col.command.d.ts +7 -0
- package/lib/types/controllers/sheet-table-ref-range.controller.d.ts +3 -0
- package/lib/types/index.d.ts +5 -3
- package/lib/types/locale/ar-SA.d.ts +18 -0
- package/lib/types/locale/ca-ES.d.ts +18 -0
- package/lib/types/locale/de-DE.d.ts +18 -0
- package/lib/types/locale/en-US.d.ts +23 -0
- package/lib/types/locale/es-ES.d.ts +18 -0
- package/lib/types/locale/fa-IR.d.ts +18 -0
- package/lib/types/locale/fr-FR.d.ts +18 -0
- package/lib/types/locale/id-ID.d.ts +18 -0
- package/lib/types/locale/it-IT.d.ts +18 -0
- package/lib/types/locale/ja-JP.d.ts +18 -0
- package/lib/types/locale/ko-KR.d.ts +18 -0
- package/lib/types/locale/pl-PL.d.ts +18 -0
- package/lib/types/locale/pt-BR.d.ts +18 -0
- package/lib/types/locale/ru-RU.d.ts +18 -0
- package/lib/types/locale/sk-SK.d.ts +18 -0
- package/lib/types/locale/vi-VN.d.ts +18 -0
- package/lib/types/locale/zh-CN.d.ts +18 -0
- package/lib/types/locale/zh-HK.d.ts +18 -0
- package/lib/types/locale/zh-TW.d.ts +18 -0
- package/lib/types/util/table-name.d.ts +21 -0
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/ar-SA.js +1 -0
- package/lib/umd/locale/ca-ES.js +1 -0
- package/lib/umd/locale/de-DE.js +1 -0
- package/lib/umd/locale/en-US.js +1 -0
- package/lib/umd/locale/es-ES.js +1 -0
- package/lib/umd/locale/fa-IR.js +1 -0
- package/lib/umd/locale/fr-FR.js +1 -0
- package/lib/umd/locale/id-ID.js +1 -0
- package/lib/umd/locale/it-IT.js +1 -0
- package/lib/umd/locale/ja-JP.js +1 -0
- package/lib/umd/locale/ko-KR.js +1 -0
- package/lib/umd/locale/pl-PL.js +1 -0
- package/lib/umd/locale/pt-BR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -0
- package/lib/umd/locale/sk-SK.js +1 -0
- package/lib/umd/locale/vi-VN.js +1 -0
- package/lib/umd/locale/zh-CN.js +1 -0
- package/lib/umd/locale/zh-HK.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -0
- package/package.json +12 -5
- package/LICENSE +0 -176
- /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
|
-
"#
|
|
252
|
-
"#
|
|
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
|
-
|
|
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({
|
|
@@ -1966,7 +1967,7 @@ let TableManager = class TableManager extends _univerjs_core.Disposable {
|
|
|
1966
1967
|
TableManager = __decorate([__decorateParam(0, _univerjs_core.IUniverInstanceService), __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService))], TableManager);
|
|
1967
1968
|
|
|
1968
1969
|
//#endregion
|
|
1969
|
-
//#region src/services/table
|
|
1970
|
+
//#region src/services/table.service.ts
|
|
1970
1971
|
let SheetTableService = class SheetTableService extends _univerjs_core.Disposable {
|
|
1971
1972
|
constructor(_tableManager) {
|
|
1972
1973
|
super();
|
|
@@ -2177,6 +2178,7 @@ const DeleteSheetTableCommand = {
|
|
|
2177
2178
|
id: "sheet.command.delete-table",
|
|
2178
2179
|
type: _univerjs_core.CommandType.COMMAND,
|
|
2179
2180
|
handler: (accessor, params) => {
|
|
2181
|
+
var _interceptorCommands$, _interceptorCommands$2;
|
|
2180
2182
|
if (!params) return false;
|
|
2181
2183
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
2182
2184
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
@@ -2190,10 +2192,20 @@ const DeleteSheetTableCommand = {
|
|
|
2190
2192
|
logService.error("[TableManager]: Table not found");
|
|
2191
2193
|
return false;
|
|
2192
2194
|
}
|
|
2195
|
+
const interceptorCommands = accessor.get(_univerjs_sheets.SheetInterceptorService).onCommandExecute({
|
|
2196
|
+
id: DeleteSheetTableCommand.id,
|
|
2197
|
+
params: {
|
|
2198
|
+
...params,
|
|
2199
|
+
tableName: tableConfig.name
|
|
2200
|
+
}
|
|
2201
|
+
});
|
|
2202
|
+
redos.push(...(_interceptorCommands$ = interceptorCommands.preRedos) !== null && _interceptorCommands$ !== void 0 ? _interceptorCommands$ : []);
|
|
2193
2203
|
redos.push({
|
|
2194
2204
|
id: DeleteSheetTableMutation.id,
|
|
2195
2205
|
params: { ...params }
|
|
2196
2206
|
});
|
|
2207
|
+
redos.push(...interceptorCommands.redos);
|
|
2208
|
+
undos.push(...(_interceptorCommands$2 = interceptorCommands.preUndos) !== null && _interceptorCommands$2 !== void 0 ? _interceptorCommands$2 : []);
|
|
2197
2209
|
undos.push({
|
|
2198
2210
|
id: AddSheetTableMutation.id,
|
|
2199
2211
|
params: {
|
|
@@ -2205,6 +2217,7 @@ const DeleteSheetTableCommand = {
|
|
|
2205
2217
|
options: tableConfig.options
|
|
2206
2218
|
}
|
|
2207
2219
|
});
|
|
2220
|
+
undos.push(...interceptorCommands.undos);
|
|
2208
2221
|
if ((0, _univerjs_core.sequenceExecute)(redos, commandService).result) {
|
|
2209
2222
|
undoRedoService.pushUndoRedo({
|
|
2210
2223
|
unitID: params.unitId,
|
|
@@ -2305,12 +2318,44 @@ const RemoveTableThemeCommand = {
|
|
|
2305
2318
|
}
|
|
2306
2319
|
};
|
|
2307
2320
|
|
|
2321
|
+
//#endregion
|
|
2322
|
+
//#region src/util/table-name.ts
|
|
2323
|
+
/**
|
|
2324
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2325
|
+
*
|
|
2326
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2327
|
+
* you may not use this file except in compliance with the License.
|
|
2328
|
+
* You may obtain a copy of the License at
|
|
2329
|
+
*
|
|
2330
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2331
|
+
*
|
|
2332
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2333
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2334
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2335
|
+
* See the License for the specific language governing permissions and
|
|
2336
|
+
* limitations under the License.
|
|
2337
|
+
*/
|
|
2338
|
+
function validateSheetTableName(name, existingNamesSet) {
|
|
2339
|
+
const trimmedName = name.trim();
|
|
2340
|
+
if (!trimmedName) return {
|
|
2341
|
+
valid: false,
|
|
2342
|
+
reason: "empty"
|
|
2343
|
+
};
|
|
2344
|
+
const normalizedExistingNames = new Set(Array.from(existingNamesSet, (item) => item.toLowerCase()));
|
|
2345
|
+
if (!(0, _univerjs_core.customNameCharacterCheck)(trimmedName.toLowerCase(), normalizedExistingNames)) return {
|
|
2346
|
+
valid: false,
|
|
2347
|
+
reason: "invalid"
|
|
2348
|
+
};
|
|
2349
|
+
return { valid: true };
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2308
2352
|
//#endregion
|
|
2309
2353
|
//#region src/commands/commands/set-sheet-table.command.ts
|
|
2310
2354
|
const SetSheetTableCommand = {
|
|
2311
2355
|
id: "sheet.command.set-table-config",
|
|
2312
2356
|
type: _univerjs_core.CommandType.COMMAND,
|
|
2313
2357
|
handler: (accessor, params) => {
|
|
2358
|
+
var _interceptorCommands$, _interceptorCommands$2;
|
|
2314
2359
|
if (!params) return false;
|
|
2315
2360
|
const { unitId, tableId, name, updateRange, rowColOperation, theme } = params;
|
|
2316
2361
|
const tableManager = accessor.get(TableManager);
|
|
@@ -2325,7 +2370,7 @@ const SetSheetTableCommand = {
|
|
|
2325
2370
|
definedNamesService: accessor.get(_univerjs_engine_formula.IDefinedNamesService)
|
|
2326
2371
|
});
|
|
2327
2372
|
if (name) {
|
|
2328
|
-
if (!(
|
|
2373
|
+
if (!validateSheetTableName(name, existingNamesSet).valid) {
|
|
2329
2374
|
accessor.get(_univerjs_core.ILogService).warn(localeService.t("sheets-table.tableNameError"));
|
|
2330
2375
|
return false;
|
|
2331
2376
|
}
|
|
@@ -2355,22 +2400,43 @@ const SetSheetTableCommand = {
|
|
|
2355
2400
|
tableId,
|
|
2356
2401
|
config: newTableConfig
|
|
2357
2402
|
};
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
}
|
|
2370
|
-
|
|
2403
|
+
const undoParams = {
|
|
2404
|
+
unitId,
|
|
2405
|
+
subUnitId: table.getSubunitId(),
|
|
2406
|
+
tableId,
|
|
2407
|
+
config: oldTableConfig
|
|
2408
|
+
};
|
|
2409
|
+
const interceptorCommands = accessor.get(_univerjs_sheets.SheetInterceptorService).onCommandExecute({
|
|
2410
|
+
id: SetSheetTableCommand.id,
|
|
2411
|
+
params: {
|
|
2412
|
+
...params,
|
|
2413
|
+
oldTableName: oldTableConfig.name
|
|
2414
|
+
}
|
|
2415
|
+
});
|
|
2416
|
+
const redos = [
|
|
2417
|
+
...(_interceptorCommands$ = interceptorCommands.preRedos) !== null && _interceptorCommands$ !== void 0 ? _interceptorCommands$ : [],
|
|
2418
|
+
{
|
|
2371
2419
|
id: SetSheetTableMutation.id,
|
|
2372
2420
|
params: redoParams
|
|
2373
|
-
}
|
|
2421
|
+
},
|
|
2422
|
+
...interceptorCommands.redos
|
|
2423
|
+
];
|
|
2424
|
+
const undos = [
|
|
2425
|
+
...(_interceptorCommands$2 = interceptorCommands.preUndos) !== null && _interceptorCommands$2 !== void 0 ? _interceptorCommands$2 : [],
|
|
2426
|
+
{
|
|
2427
|
+
id: SetSheetTableMutation.id,
|
|
2428
|
+
params: undoParams
|
|
2429
|
+
},
|
|
2430
|
+
...interceptorCommands.undos
|
|
2431
|
+
];
|
|
2432
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
2433
|
+
redos.forEach((mutation) => {
|
|
2434
|
+
commandService.executeCommand(mutation.id, mutation.params);
|
|
2435
|
+
});
|
|
2436
|
+
accessor.get(_univerjs_core.IUndoRedoService).pushUndoRedo({
|
|
2437
|
+
unitID: unitId,
|
|
2438
|
+
undoMutations: undos,
|
|
2439
|
+
redoMutations: redos
|
|
2374
2440
|
});
|
|
2375
2441
|
return true;
|
|
2376
2442
|
}
|
|
@@ -2678,6 +2744,17 @@ SheetsTableController = __decorate([
|
|
|
2678
2744
|
|
|
2679
2745
|
//#endregion
|
|
2680
2746
|
//#region src/commands/commands/sheet-table-row-col.command.ts
|
|
2747
|
+
function executeTableMutationSequence(accessor, unitId, redos, undos) {
|
|
2748
|
+
if ((0, _univerjs_core.sequenceExecute)(redos, accessor.get(_univerjs_core.ICommandService)).result) {
|
|
2749
|
+
accessor.get(_univerjs_core.IUndoRedoService).pushUndoRedo({
|
|
2750
|
+
unitID: unitId,
|
|
2751
|
+
undoMutations: undos,
|
|
2752
|
+
redoMutations: redos
|
|
2753
|
+
});
|
|
2754
|
+
return true;
|
|
2755
|
+
}
|
|
2756
|
+
return false;
|
|
2757
|
+
}
|
|
2681
2758
|
const SheetTableInsertRowCommand = {
|
|
2682
2759
|
id: "sheet.command.table-insert-row",
|
|
2683
2760
|
type: _univerjs_core.CommandType.COMMAND,
|
|
@@ -2792,6 +2869,70 @@ const SheetTableInsertRowCommand = {
|
|
|
2792
2869
|
return false;
|
|
2793
2870
|
}
|
|
2794
2871
|
};
|
|
2872
|
+
const SheetTableInsertRowAtCommand = {
|
|
2873
|
+
id: "sheet.command.table-insert-row-at",
|
|
2874
|
+
type: _univerjs_core.CommandType.COMMAND,
|
|
2875
|
+
handler: (accessor, params) => {
|
|
2876
|
+
if (!params) return false;
|
|
2877
|
+
const { unitId, subUnitId, tableId, index, count = 1 } = params;
|
|
2878
|
+
if (count <= 0) return false;
|
|
2879
|
+
const target = (0, _univerjs_sheets.getSheetCommandTarget)(accessor.get(_univerjs_core.IUniverInstanceService), {
|
|
2880
|
+
unitId,
|
|
2881
|
+
subUnitId
|
|
2882
|
+
});
|
|
2883
|
+
if (!target) return false;
|
|
2884
|
+
const table = accessor.get(TableManager).getTableById(unitId, tableId);
|
|
2885
|
+
if (!table || table.getSubunitId() !== subUnitId) return false;
|
|
2886
|
+
const oldRange = table.getRange();
|
|
2887
|
+
if (index <= oldRange.startRow || index > oldRange.endRow + 1) return false;
|
|
2888
|
+
const redos = [{
|
|
2889
|
+
id: SetSheetTableMutation.id,
|
|
2890
|
+
params: {
|
|
2891
|
+
unitId,
|
|
2892
|
+
subUnitId,
|
|
2893
|
+
tableId,
|
|
2894
|
+
config: { updateRange: { newRange: {
|
|
2895
|
+
...oldRange,
|
|
2896
|
+
endRow: oldRange.endRow + count
|
|
2897
|
+
} } }
|
|
2898
|
+
}
|
|
2899
|
+
}];
|
|
2900
|
+
const undos = [{
|
|
2901
|
+
id: SetSheetTableMutation.id,
|
|
2902
|
+
params: {
|
|
2903
|
+
unitId,
|
|
2904
|
+
subUnitId,
|
|
2905
|
+
tableId,
|
|
2906
|
+
config: { updateRange: { newRange: { ...oldRange } } }
|
|
2907
|
+
}
|
|
2908
|
+
}];
|
|
2909
|
+
const rowContentIndex = target.worksheet.getCellMatrix().getDataRange().endRow;
|
|
2910
|
+
const moveRangeMutations = (0, _univerjs_sheets.getMoveRangeUndoRedoMutations)(accessor, {
|
|
2911
|
+
unitId,
|
|
2912
|
+
subUnitId,
|
|
2913
|
+
range: {
|
|
2914
|
+
startRow: index,
|
|
2915
|
+
endRow: rowContentIndex,
|
|
2916
|
+
startColumn: oldRange.startColumn,
|
|
2917
|
+
endColumn: oldRange.endColumn
|
|
2918
|
+
}
|
|
2919
|
+
}, {
|
|
2920
|
+
unitId,
|
|
2921
|
+
subUnitId,
|
|
2922
|
+
range: {
|
|
2923
|
+
startRow: index + count,
|
|
2924
|
+
endRow: rowContentIndex + count,
|
|
2925
|
+
startColumn: oldRange.startColumn,
|
|
2926
|
+
endColumn: oldRange.endColumn
|
|
2927
|
+
}
|
|
2928
|
+
});
|
|
2929
|
+
if (moveRangeMutations) {
|
|
2930
|
+
redos.push(...moveRangeMutations.redos);
|
|
2931
|
+
undos.push(...moveRangeMutations.undos);
|
|
2932
|
+
}
|
|
2933
|
+
return executeTableMutationSequence(accessor, unitId, redos, undos);
|
|
2934
|
+
}
|
|
2935
|
+
};
|
|
2795
2936
|
const SheetTableInsertColCommand = {
|
|
2796
2937
|
id: "sheet.command.table-insert-col",
|
|
2797
2938
|
type: _univerjs_core.CommandType.COMMAND,
|
|
@@ -2919,6 +3060,177 @@ const SheetTableInsertColCommand = {
|
|
|
2919
3060
|
return false;
|
|
2920
3061
|
}
|
|
2921
3062
|
};
|
|
3063
|
+
const SheetTableInsertColumnAtCommand = {
|
|
3064
|
+
id: "sheet.command.table-insert-column-at",
|
|
3065
|
+
type: _univerjs_core.CommandType.COMMAND,
|
|
3066
|
+
handler: (accessor, params) => {
|
|
3067
|
+
if (!params) return false;
|
|
3068
|
+
const { unitId, subUnitId, tableId, index, count = 1 } = params;
|
|
3069
|
+
if (count <= 0) return false;
|
|
3070
|
+
const target = (0, _univerjs_sheets.getSheetCommandTarget)(accessor.get(_univerjs_core.IUniverInstanceService), {
|
|
3071
|
+
unitId,
|
|
3072
|
+
subUnitId
|
|
3073
|
+
});
|
|
3074
|
+
if (!target) return false;
|
|
3075
|
+
const table = accessor.get(TableManager).getTableById(unitId, tableId);
|
|
3076
|
+
if (!table || table.getSubunitId() !== subUnitId) return false;
|
|
3077
|
+
const oldRange = table.getRange();
|
|
3078
|
+
if (index < oldRange.startColumn || index > oldRange.endColumn + 1) return false;
|
|
3079
|
+
const redos = [{
|
|
3080
|
+
id: SetSheetTableMutation.id,
|
|
3081
|
+
params: {
|
|
3082
|
+
unitId,
|
|
3083
|
+
subUnitId,
|
|
3084
|
+
tableId,
|
|
3085
|
+
config: { rowColOperation: {
|
|
3086
|
+
operationType: "insert",
|
|
3087
|
+
rowColType: "column",
|
|
3088
|
+
index,
|
|
3089
|
+
count
|
|
3090
|
+
} }
|
|
3091
|
+
}
|
|
3092
|
+
}];
|
|
3093
|
+
const undos = [{
|
|
3094
|
+
id: SetSheetTableMutation.id,
|
|
3095
|
+
params: {
|
|
3096
|
+
unitId,
|
|
3097
|
+
subUnitId,
|
|
3098
|
+
tableId,
|
|
3099
|
+
config: { rowColOperation: {
|
|
3100
|
+
operationType: "delete",
|
|
3101
|
+
rowColType: "column",
|
|
3102
|
+
index,
|
|
3103
|
+
count
|
|
3104
|
+
} }
|
|
3105
|
+
}
|
|
3106
|
+
}];
|
|
3107
|
+
const colContentIndex = target.worksheet.getCellMatrix().getDataRange().endColumn;
|
|
3108
|
+
if (index <= colContentIndex) {
|
|
3109
|
+
const moveRangeMutations = (0, _univerjs_sheets.getMoveRangeUndoRedoMutations)(accessor, {
|
|
3110
|
+
unitId,
|
|
3111
|
+
subUnitId,
|
|
3112
|
+
range: {
|
|
3113
|
+
startRow: oldRange.startRow,
|
|
3114
|
+
endRow: oldRange.endRow,
|
|
3115
|
+
startColumn: index,
|
|
3116
|
+
endColumn: colContentIndex
|
|
3117
|
+
}
|
|
3118
|
+
}, {
|
|
3119
|
+
unitId,
|
|
3120
|
+
subUnitId,
|
|
3121
|
+
range: {
|
|
3122
|
+
startRow: oldRange.startRow,
|
|
3123
|
+
endRow: oldRange.endRow,
|
|
3124
|
+
startColumn: index + count,
|
|
3125
|
+
endColumn: colContentIndex + count
|
|
3126
|
+
}
|
|
3127
|
+
});
|
|
3128
|
+
if (moveRangeMutations) {
|
|
3129
|
+
redos.push(...moveRangeMutations.redos);
|
|
3130
|
+
undos.push(...moveRangeMutations.undos);
|
|
3131
|
+
}
|
|
3132
|
+
}
|
|
3133
|
+
return executeTableMutationSequence(accessor, unitId, redos, undos);
|
|
3134
|
+
}
|
|
3135
|
+
};
|
|
3136
|
+
const SheetTableRemoveColumnAtCommand = {
|
|
3137
|
+
id: "sheet.command.table-remove-column-at",
|
|
3138
|
+
type: _univerjs_core.CommandType.COMMAND,
|
|
3139
|
+
handler: (accessor, params) => {
|
|
3140
|
+
var _interceptorCommands$, _interceptorCommands$2;
|
|
3141
|
+
if (!params) return false;
|
|
3142
|
+
const { unitId, subUnitId, tableId, index, count = 1 } = params;
|
|
3143
|
+
if (count <= 0) return false;
|
|
3144
|
+
const target = (0, _univerjs_sheets.getSheetCommandTarget)(accessor.get(_univerjs_core.IUniverInstanceService), {
|
|
3145
|
+
unitId,
|
|
3146
|
+
subUnitId
|
|
3147
|
+
});
|
|
3148
|
+
if (!target) return false;
|
|
3149
|
+
const table = accessor.get(TableManager).getTableById(unitId, tableId);
|
|
3150
|
+
if (!table || table.getSubunitId() !== subUnitId) return false;
|
|
3151
|
+
const oldRange = table.getRange();
|
|
3152
|
+
if (index < oldRange.startColumn || index + count - 1 > oldRange.endColumn || count >= oldRange.endColumn - oldRange.startColumn + 1) return false;
|
|
3153
|
+
const tableInfo = table.getTableInfo();
|
|
3154
|
+
const columns = [];
|
|
3155
|
+
const gap = index - oldRange.startColumn;
|
|
3156
|
+
for (let i = 0; i < count; i++) {
|
|
3157
|
+
const column = tableInfo.columns[gap + i];
|
|
3158
|
+
if (column) columns.push(column);
|
|
3159
|
+
}
|
|
3160
|
+
const interceptorCommands = accessor.get(_univerjs_sheets.SheetInterceptorService).onCommandExecute({
|
|
3161
|
+
id: SheetTableRemoveColumnAtCommand.id,
|
|
3162
|
+
params: {
|
|
3163
|
+
...params,
|
|
3164
|
+
tableName: tableInfo.name,
|
|
3165
|
+
removedColumnNames: columns.map((column) => column.displayName)
|
|
3166
|
+
}
|
|
3167
|
+
});
|
|
3168
|
+
const redos = [
|
|
3169
|
+
...(_interceptorCommands$ = interceptorCommands.preRedos) !== null && _interceptorCommands$ !== void 0 ? _interceptorCommands$ : [],
|
|
3170
|
+
{
|
|
3171
|
+
id: SetSheetTableMutation.id,
|
|
3172
|
+
params: {
|
|
3173
|
+
unitId,
|
|
3174
|
+
subUnitId,
|
|
3175
|
+
tableId,
|
|
3176
|
+
config: { rowColOperation: {
|
|
3177
|
+
operationType: "delete",
|
|
3178
|
+
rowColType: "column",
|
|
3179
|
+
index,
|
|
3180
|
+
count
|
|
3181
|
+
} }
|
|
3182
|
+
}
|
|
3183
|
+
},
|
|
3184
|
+
...interceptorCommands.redos
|
|
3185
|
+
];
|
|
3186
|
+
const undos = [
|
|
3187
|
+
...(_interceptorCommands$2 = interceptorCommands.preUndos) !== null && _interceptorCommands$2 !== void 0 ? _interceptorCommands$2 : [],
|
|
3188
|
+
{
|
|
3189
|
+
id: SetSheetTableMutation.id,
|
|
3190
|
+
params: {
|
|
3191
|
+
unitId,
|
|
3192
|
+
subUnitId,
|
|
3193
|
+
tableId,
|
|
3194
|
+
config: { rowColOperation: {
|
|
3195
|
+
operationType: "insert",
|
|
3196
|
+
rowColType: "column",
|
|
3197
|
+
index,
|
|
3198
|
+
count,
|
|
3199
|
+
columnsJson: columns
|
|
3200
|
+
} }
|
|
3201
|
+
}
|
|
3202
|
+
},
|
|
3203
|
+
...interceptorCommands.undos
|
|
3204
|
+
];
|
|
3205
|
+
const colContentIndex = target.worksheet.getCellMatrix().getDataRange().endColumn;
|
|
3206
|
+
if (index + count <= colContentIndex) {
|
|
3207
|
+
const moveRangeMutations = (0, _univerjs_sheets.getMoveRangeUndoRedoMutations)(accessor, {
|
|
3208
|
+
unitId,
|
|
3209
|
+
subUnitId,
|
|
3210
|
+
range: {
|
|
3211
|
+
startRow: oldRange.startRow,
|
|
3212
|
+
endRow: oldRange.endRow,
|
|
3213
|
+
startColumn: index + count,
|
|
3214
|
+
endColumn: colContentIndex
|
|
3215
|
+
}
|
|
3216
|
+
}, {
|
|
3217
|
+
unitId,
|
|
3218
|
+
subUnitId,
|
|
3219
|
+
range: {
|
|
3220
|
+
startRow: oldRange.startRow,
|
|
3221
|
+
endRow: oldRange.endRow,
|
|
3222
|
+
startColumn: index,
|
|
3223
|
+
endColumn: colContentIndex - count
|
|
3224
|
+
}
|
|
3225
|
+
});
|
|
3226
|
+
if (moveRangeMutations) {
|
|
3227
|
+
redos.push(...moveRangeMutations.redos);
|
|
3228
|
+
undos.push(...moveRangeMutations.undos);
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3231
|
+
return executeTableMutationSequence(accessor, unitId, redos, undos);
|
|
3232
|
+
}
|
|
3233
|
+
};
|
|
2922
3234
|
const SheetTableRemoveRowCommand = {
|
|
2923
3235
|
id: "sheet.command.table-remove-row",
|
|
2924
3236
|
type: _univerjs_core.CommandType.COMMAND,
|
|
@@ -2996,6 +3308,7 @@ const SheetTableRemoveColCommand = {
|
|
|
2996
3308
|
id: "sheet.command.table-remove-col",
|
|
2997
3309
|
type: _univerjs_core.CommandType.COMMAND,
|
|
2998
3310
|
handler: (accessor, params) => {
|
|
3311
|
+
var _interceptorCommands$3, _interceptorCommands$4;
|
|
2999
3312
|
if (!params) return false;
|
|
3000
3313
|
const target = (0, _univerjs_sheets.getSheetCommandTarget)(accessor.get(_univerjs_core.IUniverInstanceService), params);
|
|
3001
3314
|
if (!target) return false;
|
|
@@ -3024,12 +3337,24 @@ const SheetTableRemoveColCommand = {
|
|
|
3024
3337
|
} }
|
|
3025
3338
|
}
|
|
3026
3339
|
});
|
|
3340
|
+
const tableInfo = table.getTableInfo();
|
|
3027
3341
|
const columns = [];
|
|
3028
3342
|
const gap = range.startColumn - oldRange.startColumn;
|
|
3029
3343
|
for (let i = 0; i < removeColCount; i++) {
|
|
3030
|
-
const column =
|
|
3344
|
+
const column = tableInfo.columns[gap + i];
|
|
3031
3345
|
if (column) columns.push(column);
|
|
3032
3346
|
}
|
|
3347
|
+
const interceptorCommands = accessor.get(_univerjs_sheets.SheetInterceptorService).onCommandExecute({
|
|
3348
|
+
id: SheetTableRemoveColCommand.id,
|
|
3349
|
+
params: {
|
|
3350
|
+
...params,
|
|
3351
|
+
tableName: tableInfo.name,
|
|
3352
|
+
removedColumnNames: columns.map((column) => column.displayName)
|
|
3353
|
+
}
|
|
3354
|
+
});
|
|
3355
|
+
redos.unshift(...(_interceptorCommands$3 = interceptorCommands.preRedos) !== null && _interceptorCommands$3 !== void 0 ? _interceptorCommands$3 : []);
|
|
3356
|
+
redos.push(...interceptorCommands.redos);
|
|
3357
|
+
undos.unshift(...(_interceptorCommands$4 = interceptorCommands.preUndos) !== null && _interceptorCommands$4 !== void 0 ? _interceptorCommands$4 : []);
|
|
3033
3358
|
undos.push({
|
|
3034
3359
|
id: SetSheetTableMutation.id,
|
|
3035
3360
|
params: {
|
|
@@ -3045,6 +3370,7 @@ const SheetTableRemoveColCommand = {
|
|
|
3045
3370
|
} }
|
|
3046
3371
|
}
|
|
3047
3372
|
});
|
|
3373
|
+
undos.push(...interceptorCommands.undos);
|
|
3048
3374
|
const colContentIndex = target.worksheet.getCellMatrix().getDataRange().endColumn;
|
|
3049
3375
|
const moveRangeMutations = (0, _univerjs_sheets.getMoveRangeUndoRedoMutations)(accessor, {
|
|
3050
3376
|
unitId,
|
|
@@ -3084,7 +3410,7 @@ const SheetTableRemoveColCommand = {
|
|
|
3084
3410
|
//#endregion
|
|
3085
3411
|
//#region package.json
|
|
3086
3412
|
var name = "@univerjs/sheets-table";
|
|
3087
|
-
var version = "0.
|
|
3413
|
+
var version = "0.24.0-insiders.20260527-b1d726f";
|
|
3088
3414
|
|
|
3089
3415
|
//#endregion
|
|
3090
3416
|
//#region src/controllers/sheet-table-formula.controller.ts
|
|
@@ -3123,10 +3449,10 @@ let SheetTableFormulaController = class SheetTableFormulaController extends _uni
|
|
|
3123
3449
|
});
|
|
3124
3450
|
const table = this._tableManager.getTableById(unitId, tableId);
|
|
3125
3451
|
if (!table) return;
|
|
3126
|
-
this._updateSuperTable(unitId, table);
|
|
3452
|
+
this._updateSuperTable(unitId, table, oldTableName);
|
|
3127
3453
|
}));
|
|
3128
3454
|
}
|
|
3129
|
-
_updateSuperTable(unitId, table) {
|
|
3455
|
+
_updateSuperTable(unitId, table, oldTableName) {
|
|
3130
3456
|
const tableInfo = table.getTableInfo();
|
|
3131
3457
|
const name = tableInfo.name;
|
|
3132
3458
|
const columns = tableInfo.columns;
|
|
@@ -3137,6 +3463,7 @@ let SheetTableFormulaController = class SheetTableFormulaController extends _uni
|
|
|
3137
3463
|
this._commandService.executeCommand(_univerjs_engine_formula.SetSuperTableMutation.id, {
|
|
3138
3464
|
unitId,
|
|
3139
3465
|
tableName: name,
|
|
3466
|
+
oldTableName,
|
|
3140
3467
|
reference: {
|
|
3141
3468
|
range: tableInfo.range,
|
|
3142
3469
|
sheetId: tableInfo.subUnitId,
|
|
@@ -3197,6 +3524,8 @@ SheetTableRangeController = __decorate([__decorateParam(0, (0, _univerjs_core.In
|
|
|
3197
3524
|
|
|
3198
3525
|
//#endregion
|
|
3199
3526
|
//#region src/controllers/sheet-table-ref-range.controller.ts
|
|
3527
|
+
const SHEET_TABLE_REMOVE_COL_COMMAND_ID = "sheet.command.table-remove-col";
|
|
3528
|
+
const DELETE_SHEET_TABLE_COMMAND_ID = "sheet.command.delete-table";
|
|
3200
3529
|
let SheetTableRefRangeController = class SheetTableRefRangeController extends _univerjs_core.Disposable {
|
|
3201
3530
|
constructor(_commandService, _refRangeService, _univerInstanceService, _injector, _sheetInterceptorService, _tableManager, _localeService) {
|
|
3202
3531
|
super();
|
|
@@ -3212,20 +3541,23 @@ let SheetTableRefRangeController = class SheetTableRefRangeController extends _u
|
|
|
3212
3541
|
}
|
|
3213
3542
|
_initCommandInterceptor() {
|
|
3214
3543
|
const self = this;
|
|
3215
|
-
this._sheetInterceptorService.interceptCommand({
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3544
|
+
this._sheetInterceptorService.interceptCommand({
|
|
3545
|
+
priority: -1,
|
|
3546
|
+
getMutations(commandInfo) {
|
|
3547
|
+
const defaultReturn = {
|
|
3548
|
+
redos: [],
|
|
3549
|
+
undos: []
|
|
3550
|
+
};
|
|
3551
|
+
const { id, params } = commandInfo;
|
|
3552
|
+
switch (id) {
|
|
3553
|
+
case _univerjs_sheets.InsertRowCommand.id: return self._generateTableMutationWithInsertRow(params);
|
|
3554
|
+
case _univerjs_sheets.InsertColCommand.id: return self._generateTableMutationWithInsertCol(params);
|
|
3555
|
+
case _univerjs_sheets.RemoveRowCommand.id: return self._generateTableMutationWithRemoveRow(params);
|
|
3556
|
+
case _univerjs_sheets.RemoveColCommand.id: return self._generateTableMutationWithRemoveCol(params);
|
|
3557
|
+
}
|
|
3558
|
+
return defaultReturn;
|
|
3226
3559
|
}
|
|
3227
|
-
|
|
3228
|
-
} });
|
|
3560
|
+
});
|
|
3229
3561
|
}
|
|
3230
3562
|
_generateTableMutationWithInsertRow(insertParams) {
|
|
3231
3563
|
const undos = [];
|
|
@@ -3454,6 +3786,18 @@ let SheetTableRefRangeController = class SheetTableRefRangeController extends _u
|
|
|
3454
3786
|
const tableRange = table.getRange();
|
|
3455
3787
|
if (_univerjs_core.Rectangle.intersects(tableRange, range)) {
|
|
3456
3788
|
if (range.startColumn <= tableRange.startColumn && range.endColumn >= tableRange.endColumn) {
|
|
3789
|
+
var _formulaMutations$pre, _formulaMutations$pre2;
|
|
3790
|
+
const tableInfo = table.getTableInfo();
|
|
3791
|
+
const formulaMutations = this._sheetInterceptorService.onCommandExecute({
|
|
3792
|
+
id: DELETE_SHEET_TABLE_COMMAND_ID,
|
|
3793
|
+
params: {
|
|
3794
|
+
unitId,
|
|
3795
|
+
subUnitId,
|
|
3796
|
+
tableId: table.getId(),
|
|
3797
|
+
tableName: tableInfo.name
|
|
3798
|
+
}
|
|
3799
|
+
});
|
|
3800
|
+
preRedos.push(...(_formulaMutations$pre = formulaMutations.preRedos) !== null && _formulaMutations$pre !== void 0 ? _formulaMutations$pre : [], ...formulaMutations.redos);
|
|
3457
3801
|
preRedos.push({
|
|
3458
3802
|
id: DeleteSheetTableMutation.id,
|
|
3459
3803
|
params: {
|
|
@@ -3486,7 +3830,9 @@ let SheetTableRefRangeController = class SheetTableRefRangeController extends _u
|
|
|
3486
3830
|
options: tableJson.options
|
|
3487
3831
|
}
|
|
3488
3832
|
});
|
|
3833
|
+
undos.push(...(_formulaMutations$pre2 = formulaMutations.preUndos) !== null && _formulaMutations$pre2 !== void 0 ? _formulaMutations$pre2 : [], ...formulaMutations.undos);
|
|
3489
3834
|
} else if (range.startColumn <= tableRange.startColumn && range.endColumn >= tableRange.startColumn) {
|
|
3835
|
+
const tableJson = table.toJSON();
|
|
3490
3836
|
const removeColumnCount = range.endColumn - tableRange.startColumn + 1;
|
|
3491
3837
|
redos.push({
|
|
3492
3838
|
id: SetSheetTableMutation.id,
|
|
@@ -3507,22 +3853,18 @@ let SheetTableRefRangeController = class SheetTableRefRangeController extends _u
|
|
|
3507
3853
|
const column = table.getTableColumnByIndex(i);
|
|
3508
3854
|
if (column) columns.push(column.toJSON());
|
|
3509
3855
|
}
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
index: tableRange.startColumn,
|
|
3520
|
-
count: removeColumnCount,
|
|
3521
|
-
columnsJson: columns
|
|
3522
|
-
} }
|
|
3523
|
-
}
|
|
3856
|
+
preUndos.push(this._getDeleteTableMutation(unitId, subUnitId, table.getId()));
|
|
3857
|
+
undos.push(this._getAddTableMutation(unitId, subUnitId, tableJson));
|
|
3858
|
+
this._appendTableColumnFormulaMutations(redos, undos, {
|
|
3859
|
+
unitId,
|
|
3860
|
+
subUnitId,
|
|
3861
|
+
tableId: table.getId(),
|
|
3862
|
+
tableName: table.getTableInfo().name,
|
|
3863
|
+
range,
|
|
3864
|
+
columns
|
|
3524
3865
|
});
|
|
3525
3866
|
} else if (range.startColumn > tableRange.startColumn && range.endColumn > tableRange.endColumn) {
|
|
3867
|
+
const tableJson = table.toJSON();
|
|
3526
3868
|
const removeColumnCount = tableRange.endColumn - range.startColumn + 1;
|
|
3527
3869
|
redos.push({
|
|
3528
3870
|
id: SetSheetTableMutation.id,
|
|
@@ -3544,22 +3886,18 @@ let SheetTableRefRangeController = class SheetTableRefRangeController extends _u
|
|
|
3544
3886
|
const column = table.getTableColumnByIndex(i + gap);
|
|
3545
3887
|
if (column) columns.push(column.toJSON());
|
|
3546
3888
|
}
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
index: range.startColumn,
|
|
3557
|
-
count: removeColCount,
|
|
3558
|
-
columnsJson: columns
|
|
3559
|
-
} }
|
|
3560
|
-
}
|
|
3889
|
+
preUndos.push(this._getDeleteTableMutation(unitId, subUnitId, table.getId()));
|
|
3890
|
+
undos.push(this._getAddTableMutation(unitId, subUnitId, tableJson));
|
|
3891
|
+
this._appendTableColumnFormulaMutations(redos, undos, {
|
|
3892
|
+
unitId,
|
|
3893
|
+
subUnitId,
|
|
3894
|
+
tableId: table.getId(),
|
|
3895
|
+
tableName: table.getTableInfo().name,
|
|
3896
|
+
range,
|
|
3897
|
+
columns
|
|
3561
3898
|
});
|
|
3562
3899
|
} else if (range.startColumn > tableRange.startColumn && range.endColumn <= tableRange.endColumn) {
|
|
3900
|
+
const tableJson = table.toJSON();
|
|
3563
3901
|
redos.push({
|
|
3564
3902
|
id: SetSheetTableMutation.id,
|
|
3565
3903
|
params: {
|
|
@@ -3580,20 +3918,15 @@ let SheetTableRefRangeController = class SheetTableRefRangeController extends _u
|
|
|
3580
3918
|
const column = table.getTableColumnByIndex(i + gap);
|
|
3581
3919
|
if (column) columns.push(column.toJSON());
|
|
3582
3920
|
}
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
index: range.startColumn,
|
|
3593
|
-
count: removeColCount,
|
|
3594
|
-
columnsJson: columns
|
|
3595
|
-
} }
|
|
3596
|
-
}
|
|
3921
|
+
preUndos.push(this._getDeleteTableMutation(unitId, subUnitId, table.getId()));
|
|
3922
|
+
undos.push(this._getAddTableMutation(unitId, subUnitId, tableJson));
|
|
3923
|
+
this._appendTableColumnFormulaMutations(redos, undos, {
|
|
3924
|
+
unitId,
|
|
3925
|
+
subUnitId,
|
|
3926
|
+
tableId: table.getId(),
|
|
3927
|
+
tableName: table.getTableInfo().name,
|
|
3928
|
+
range,
|
|
3929
|
+
columns
|
|
3597
3930
|
});
|
|
3598
3931
|
}
|
|
3599
3932
|
}
|
|
@@ -3605,6 +3938,53 @@ let SheetTableRefRangeController = class SheetTableRefRangeController extends _u
|
|
|
3605
3938
|
preUndos
|
|
3606
3939
|
};
|
|
3607
3940
|
}
|
|
3941
|
+
_getDeleteTableMutation(unitId, subUnitId, tableId) {
|
|
3942
|
+
return {
|
|
3943
|
+
id: DeleteSheetTableMutation.id,
|
|
3944
|
+
params: {
|
|
3945
|
+
unitId,
|
|
3946
|
+
subUnitId,
|
|
3947
|
+
tableId
|
|
3948
|
+
}
|
|
3949
|
+
};
|
|
3950
|
+
}
|
|
3951
|
+
_getAddTableMutation(unitId, subUnitId, tableJson) {
|
|
3952
|
+
const header = tableJson.columns.map((column) => column.displayName);
|
|
3953
|
+
return {
|
|
3954
|
+
id: AddSheetTableMutation.id,
|
|
3955
|
+
params: {
|
|
3956
|
+
unitId,
|
|
3957
|
+
subUnitId,
|
|
3958
|
+
tableId: tableJson.id,
|
|
3959
|
+
name: tableJson.name,
|
|
3960
|
+
header,
|
|
3961
|
+
range: tableJson.range,
|
|
3962
|
+
options: {
|
|
3963
|
+
...tableJson.options,
|
|
3964
|
+
columns: tableJson.columns,
|
|
3965
|
+
filters: tableJson.filters.tableColumnFilterList
|
|
3966
|
+
}
|
|
3967
|
+
}
|
|
3968
|
+
};
|
|
3969
|
+
}
|
|
3970
|
+
_appendTableColumnFormulaMutations(redos, undos, info) {
|
|
3971
|
+
var _formulaMutations$pre3, _formulaMutations$pre4;
|
|
3972
|
+
const removedColumnNames = info.columns.map((column) => column.displayName);
|
|
3973
|
+
if (!removedColumnNames.length) return;
|
|
3974
|
+
const formulaMutations = this._sheetInterceptorService.onCommandExecute({
|
|
3975
|
+
id: SHEET_TABLE_REMOVE_COL_COMMAND_ID,
|
|
3976
|
+
params: {
|
|
3977
|
+
unitId: info.unitId,
|
|
3978
|
+
subUnitId: info.subUnitId,
|
|
3979
|
+
tableId: info.tableId,
|
|
3980
|
+
tableName: info.tableName,
|
|
3981
|
+
range: info.range,
|
|
3982
|
+
removedColumnNames
|
|
3983
|
+
}
|
|
3984
|
+
});
|
|
3985
|
+
redos.splice(Math.max(redos.length - 1, 0), 0, ...(_formulaMutations$pre3 = formulaMutations.preRedos) !== null && _formulaMutations$pre3 !== void 0 ? _formulaMutations$pre3 : [], ...formulaMutations.redos);
|
|
3986
|
+
undos.push(...(_formulaMutations$pre4 = formulaMutations.preUndos) !== null && _formulaMutations$pre4 !== void 0 ? _formulaMutations$pre4 : [], ...formulaMutations.undos);
|
|
3987
|
+
}
|
|
3608
3988
|
_initCommandListener() {
|
|
3609
3989
|
this._commandService.onCommandExecuted((commandInfo) => {
|
|
3610
3990
|
if (commandInfo.id === _univerjs_sheets.InsertRowMutation.id) {
|
|
@@ -3889,8 +4269,11 @@ let UniverSheetsTablePlugin = class UniverSheetsTablePlugin extends _univerjs_co
|
|
|
3889
4269
|
RemoveTableThemeCommand,
|
|
3890
4270
|
SheetTableInsertRowCommand,
|
|
3891
4271
|
SheetTableInsertColCommand,
|
|
4272
|
+
SheetTableInsertRowAtCommand,
|
|
4273
|
+
SheetTableInsertColumnAtCommand,
|
|
3892
4274
|
SheetTableRemoveRowCommand,
|
|
3893
|
-
SheetTableRemoveColCommand
|
|
4275
|
+
SheetTableRemoveColCommand,
|
|
4276
|
+
SheetTableRemoveColumnAtCommand
|
|
3894
4277
|
].forEach((m) => this._commandService.registerCommand(m));
|
|
3895
4278
|
}
|
|
3896
4279
|
};
|
|
@@ -3917,8 +4300,11 @@ exports.SetSheetTableFilterCommand = SetSheetTableFilterCommand;
|
|
|
3917
4300
|
exports.SetSheetTableFilterMutation = SetSheetTableFilterMutation;
|
|
3918
4301
|
exports.SetSheetTableMutation = SetSheetTableMutation;
|
|
3919
4302
|
exports.SheetTableInsertColCommand = SheetTableInsertColCommand;
|
|
4303
|
+
exports.SheetTableInsertColumnAtCommand = SheetTableInsertColumnAtCommand;
|
|
4304
|
+
exports.SheetTableInsertRowAtCommand = SheetTableInsertRowAtCommand;
|
|
3920
4305
|
exports.SheetTableInsertRowCommand = SheetTableInsertRowCommand;
|
|
3921
4306
|
exports.SheetTableRemoveColCommand = SheetTableRemoveColCommand;
|
|
4307
|
+
exports.SheetTableRemoveColumnAtCommand = SheetTableRemoveColumnAtCommand;
|
|
3922
4308
|
exports.SheetTableRemoveRowCommand = SheetTableRemoveRowCommand;
|
|
3923
4309
|
Object.defineProperty(exports, 'SheetTableService', {
|
|
3924
4310
|
enumerable: true,
|
|
@@ -3953,6 +4339,8 @@ Object.defineProperty(exports, 'UniverSheetsTablePlugin', {
|
|
|
3953
4339
|
}
|
|
3954
4340
|
});
|
|
3955
4341
|
exports.customEmptyThemeWithBorderStyle = customEmptyThemeWithBorderStyle;
|
|
4342
|
+
exports.getExistingNamesSet = getExistingNamesSet;
|
|
3956
4343
|
exports.isConditionFilter = isConditionFilter;
|
|
3957
4344
|
exports.isManualTableFilter = isManualTableFilter;
|
|
3958
|
-
exports.processStyleWithBorderStyle = processStyleWithBorderStyle;
|
|
4345
|
+
exports.processStyleWithBorderStyle = processStyleWithBorderStyle;
|
|
4346
|
+
exports.validateSheetTableName = validateSheetTableName;
|