@univerjs/sheets 1.2.0 → 1.3.0
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 +132 -39
- package/lib/es/index.js +133 -40
- package/lib/index.js +133 -40
- package/lib/types/models/range-theme-model.d.ts +4 -2
- package/lib/umd/index.js +2 -2
- package/package.json +8 -8
package/lib/es/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AUTO_HEIGHT_FOR_MERGED_CELLS, BORDER_KEYS, BORDER_STYLE_KEYS, BooleanNumber, BorderStyleTypes, BorderType, BuildTextUtils, COLOR_STYLE_KEYS, CellModeEnum, CellValueType, CommandType, CustomCommandExecutionError, DependentOn, Dimension, Direction, Disposable, DisposableCollection, DocumentDataModel, ErrorService, FontItalic, FontWeight, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, ILogService, IPermissionService, IResourceManagerService, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, IUndoRedoService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, InterceptorManager, LRUMap, LocaleService, MAX_COLUMN_COUNT, MAX_ROW_COUNT, ObjectMatrix, Optional, PADDING_KEYS, PermissionStatus, Plugin, RANGE_TYPE, RTree, Range, Rectangle, RxDisposable, SHEET_TEXT_LINE_GAP, STYLE_KEYS, Styles, TEXT_DECORATION_KEYS, TEXT_ROTATION_KEYS, TextX, Tools, UniverInstanceType, UserManagerService, WorksheetHiddenState, WrapStrategy, cellToRange, cloneWorksheetData, composeInterceptors, concatMatrixArray, createIdentifier, createInterceptorKey, createRowColIter, generateRandomId, getArrayLength, getIntersectRange, getNumfmtLocaleTag, getNumfmtParseValueFilter, isBooleanString, isDefaultFormat, isFormulaId, isFormulaString, isICellData, isRealNum, isSafeNumeric, isTextFormat, mapObjectMatrix, merge, mergeIntervals, mergeOverrideWithDependencies, mergeWorksheetSnapshotWithDefault, moveMatrixArray, moveRangeByOffset, normalizeTextRuns, normalizeWorkbookCalculationSettings, numfmt, regexp, registerDependencies, remove, selectionToArray, sequenceExecute, sliceMatrixArray, spliceArray, throttle, toDisposable, touchDependencies, willLoseNumericPrecision } from "@univerjs/core";
|
|
1
|
+
import { AUTO_HEIGHT_FOR_MERGED_CELLS, BORDER_KEYS, BORDER_STYLE_KEYS, BooleanNumber, BorderStyleTypes, BorderType, BuildTextUtils, COLOR_STYLE_KEYS, CellModeEnum, CellValueType, CommandType, CustomCommandExecutionError, DependentOn, Dimension, Direction, Disposable, DisposableCollection, DocumentDataModel, ErrorService, FontItalic, FontWeight, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, ILogService, IPermissionService, IResourceManagerService, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, IUndoRedoService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, InterceptorManager, LRUMap, LocaleService, MAX_COLUMN_COUNT, MAX_ROW_COUNT, ObjectMatrix, Optional, PADDING_KEYS, PermissionStatus, Plugin, RANGE_TYPE, RTree, Range, Rectangle, RxDisposable, SHEET_TEXT_LINE_GAP, STYLE_KEYS, Styles, TEXT_DECORATION_KEYS, TEXT_ROTATION_KEYS, TextX, Tools, UniverInstanceType, UserManagerService, WorksheetHiddenState, WrapStrategy, cellToRange, cloneWorksheetData, composeInterceptors, concatMatrixArray, createIdentifier, createInterceptorKey, createRowColIter, generateRandomId, getArrayLength, getIntersectRange, getNumfmtLocaleTag, getNumfmtParseValueFilter, isBooleanString, isDefaultFormat, isFormulaId, isFormulaString, isICellData, isRealNum, isSafeNumeric, isTextFormat, isValidColumnDimensions, isValidRowDimensions, isValidSheetDimension, mapObjectMatrix, merge, mergeIntervals, mergeOverrideWithDependencies, mergeWorksheetSnapshotWithDefault, moveMatrixArray, moveRangeByOffset, normalizeTextRuns, normalizeWorkbookCalculationSettings, numfmt, regexp, registerDependencies, remove, selectionToArray, sequenceExecute, sliceMatrixArray, spliceArray, throttle, toDisposable, touchDependencies, willLoseNumericPrecision } from "@univerjs/core";
|
|
2
|
+
import { FormulaDataModel, IDefinedNamesService, IFunctionService, ISheetRowFilteredService, LexerTreeBuilder, RemoveDefinedNameMutation, SetDefinedNameMutation, SetDefinedNameMutationFactory, SetFormulaCalculationResultMutation, UniverFormulaEnginePlugin, deserializeRangeWithSheetWithCache, handleNumfmtInCell, handleRefStringInfo, isReferenceStringWithEffectiveColumn, matchToken, normalizeFormulaUnitName, operatorToken, sequenceNodeType, stripErrorMargin } from "@univerjs/engine-formula";
|
|
2
3
|
import { BehaviorSubject, Subject, distinctUntilChanged, filter, map, merge as merge$1, of, share, shareReplay, skip, switchMap, take, takeUntil } from "rxjs";
|
|
3
|
-
import { FormulaDataModel, IDefinedNamesService, IFunctionService, LexerTreeBuilder, RemoveDefinedNameMutation, SetDefinedNameMutation, SetDefinedNameMutationFactory, SetFormulaCalculationResultMutation, UniverFormulaEnginePlugin, deserializeRangeWithSheetWithCache, handleNumfmtInCell, handleRefStringInfo, isReferenceStringWithEffectiveColumn, matchToken, normalizeFormulaUnitName, operatorToken, sequenceNodeType, stripErrorMargin } from "@univerjs/engine-formula";
|
|
4
4
|
import { SpreadsheetSkeleton, cjk, precisionTo } from "@univerjs/engine-render";
|
|
5
5
|
import { UnitAction, UnitObject } from "@univerjs/protocol";
|
|
6
6
|
import { filter as filter$1, map as map$1, takeUntil as takeUntil$1 } from "rxjs/operators";
|
|
@@ -1200,11 +1200,12 @@ var ZebraCrossingCache = class {
|
|
|
1200
1200
|
//#region src/models/range-theme-model.ts
|
|
1201
1201
|
const SHEET_RANGE_THEME_MODEL_PLUGIN = "SHEET_RANGE_THEME_MODEL_PLUGIN";
|
|
1202
1202
|
let SheetRangeThemeModel = class SheetRangeThemeModel extends Disposable {
|
|
1203
|
-
constructor(_sheetInterceptorService, _resourceManagerService, _univerInstanceService) {
|
|
1203
|
+
constructor(_sheetInterceptorService, _resourceManagerService, _univerInstanceService, _sheetRowFilteredService) {
|
|
1204
1204
|
super();
|
|
1205
1205
|
this._sheetInterceptorService = _sheetInterceptorService;
|
|
1206
1206
|
this._resourceManagerService = _resourceManagerService;
|
|
1207
1207
|
this._univerInstanceService = _univerInstanceService;
|
|
1208
|
+
this._sheetRowFilteredService = _sheetRowFilteredService;
|
|
1208
1209
|
_defineProperty(this, "_rangeThemeStyleMap", /* @__PURE__ */ new Map());
|
|
1209
1210
|
_defineProperty(this, "_rangeThemeStyleRuleMap", /* @__PURE__ */ new Map());
|
|
1210
1211
|
_defineProperty(this, "_rTreeCollection", /* @__PURE__ */ new Map());
|
|
@@ -1259,8 +1260,11 @@ let SheetRangeThemeModel = class SheetRangeThemeModel extends Disposable {
|
|
|
1259
1260
|
if (sheet) {
|
|
1260
1261
|
const rowCount = sheet.getRowCount();
|
|
1261
1262
|
const rowManager = sheet.getRowManager();
|
|
1262
|
-
for (let i =
|
|
1263
|
-
else
|
|
1263
|
+
for (let i = 0; i < rowCount; i++) if (!sheet.getRowVisible(i)) set.add(i);
|
|
1264
|
+
else {
|
|
1265
|
+
var _this$_sheetRowFilter;
|
|
1266
|
+
if (rowManager.getRowHeight(i) === 0 || ((_this$_sheetRowFilter = this._sheetRowFilteredService) === null || _this$_sheetRowFilter === void 0 ? void 0 : _this$_sheetRowFilter.getRowFiltered(unitId, subUnitId, i))) set.add(i);
|
|
1267
|
+
}
|
|
1264
1268
|
}
|
|
1265
1269
|
}
|
|
1266
1270
|
}
|
|
@@ -1426,8 +1430,11 @@ let SheetRangeThemeModel = class SheetRangeThemeModel extends Disposable {
|
|
|
1426
1430
|
const offsetRow = row - rangeInfo.range.startRow;
|
|
1427
1431
|
const offsetCol = col - rangeInfo.range.startColumn;
|
|
1428
1432
|
const theme = this.getRangeThemeStyle(unitId, themeName);
|
|
1433
|
+
let lastVisibleRow = rangeInfo.range.endRow;
|
|
1434
|
+
const hiddenRows = this._getSheetRowVisibleFuncSet(unitId, subUnitId);
|
|
1435
|
+
while (lastVisibleRow >= rangeInfo.range.startRow && hiddenRows.has(lastVisibleRow)) lastVisibleRow--;
|
|
1429
1436
|
const isToggled = this._ensureZebraCrossingCache(unitId, subUnitId, themes[0]).getIsToggled(row);
|
|
1430
|
-
if (theme) return theme.getStyle(offsetRow, offsetCol, row ===
|
|
1437
|
+
if (theme) return theme.getStyle(offsetRow, offsetCol, row === lastVisibleRow, col === rangeInfo.range.endColumn, isToggled);
|
|
1431
1438
|
}
|
|
1432
1439
|
}
|
|
1433
1440
|
}
|
|
@@ -1526,7 +1533,8 @@ let SheetRangeThemeModel = class SheetRangeThemeModel extends Disposable {
|
|
|
1526
1533
|
SheetRangeThemeModel = __decorate([
|
|
1527
1534
|
__decorateParam(0, Inject(SheetInterceptorService)),
|
|
1528
1535
|
__decorateParam(1, Inject(IResourceManagerService)),
|
|
1529
|
-
__decorateParam(2, Inject(IUniverInstanceService))
|
|
1536
|
+
__decorateParam(2, Inject(IUniverInstanceService)),
|
|
1537
|
+
__decorateParam(3, Optional(ISheetRowFilteredService))
|
|
1530
1538
|
], SheetRangeThemeModel);
|
|
1531
1539
|
|
|
1532
1540
|
//#endregion
|
|
@@ -1606,6 +1614,7 @@ const InsertRowMutation = {
|
|
|
1606
1614
|
const { worksheet } = target;
|
|
1607
1615
|
const rowManager = worksheet.getRowManager();
|
|
1608
1616
|
const { range, rowInfo } = params;
|
|
1617
|
+
if (rowInfo && !Object.values(rowInfo).every(isValidRowDimensions)) return false;
|
|
1609
1618
|
const { startRow, endRow } = range;
|
|
1610
1619
|
rowManager.insertRowsWithData(startRow, endRow, rowInfo);
|
|
1611
1620
|
const insertedRowCount = endRow - startRow + 1;
|
|
@@ -1631,6 +1640,7 @@ const InsertColMutation = {
|
|
|
1631
1640
|
const { worksheet } = target;
|
|
1632
1641
|
const columnManager = worksheet.getColumnManager();
|
|
1633
1642
|
const { range, colInfo } = params;
|
|
1643
|
+
if (colInfo && !Object.values(colInfo).every(isValidColumnDimensions)) return false;
|
|
1634
1644
|
const { startColumn, endColumn } = range;
|
|
1635
1645
|
columnManager.insertColumnsWithData(startColumn, endColumn, colInfo);
|
|
1636
1646
|
const insertedColumnCount = endColumn - startColumn + 1;
|
|
@@ -1965,6 +1975,7 @@ const SetColDataMutation = {
|
|
|
1965
1975
|
type: CommandType.MUTATION,
|
|
1966
1976
|
handler: (accessor, params) => {
|
|
1967
1977
|
const { columnData } = params;
|
|
1978
|
+
if (!Object.values(columnData).every(isValidColumnDimensions)) return false;
|
|
1968
1979
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
1969
1980
|
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
1970
1981
|
if (!target) return false;
|
|
@@ -2406,7 +2417,10 @@ const overwriteCellPropertiesSet = /* @__PURE__ */ new Set([
|
|
|
2406
2417
|
"fd"
|
|
2407
2418
|
]);
|
|
2408
2419
|
function mergeCellData(newValue, oldValue, styles, isOverrideStyle = false) {
|
|
2409
|
-
|
|
2420
|
+
var _previousStyle$n, _styles$getStyleByCel;
|
|
2421
|
+
const canPreserveValue = newValue.v === void 0 && newValue.t === void 0 && oldValue.t != null;
|
|
2422
|
+
const previousStyle = canPreserveValue ? styles.getStyleByCell(oldValue) : void 0;
|
|
2423
|
+
const type = canPreserveValue ? oldValue.t : getCellType(styles, newValue, oldValue);
|
|
2410
2424
|
Object.keys(newValue).forEach((key) => {
|
|
2411
2425
|
const cellPropertyKey = key;
|
|
2412
2426
|
if (overwriteCellPropertiesSet.has(cellPropertyKey)) {
|
|
@@ -2423,9 +2437,14 @@ function mergeCellData(newValue, oldValue, styles, isOverrideStyle = false) {
|
|
|
2423
2437
|
delete oldValue.ft;
|
|
2424
2438
|
delete oldValue.fd;
|
|
2425
2439
|
}
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2440
|
+
const numberFormatChanged = canPreserveValue && (previousStyle === null || previousStyle === void 0 || (_previousStyle$n = previousStyle.n) === null || _previousStyle$n === void 0 ? void 0 : _previousStyle$n.pattern) !== ((_styles$getStyleByCel = styles.getStyleByCell(oldValue)) === null || _styles$getStyleByCel === void 0 || (_styles$getStyleByCel = _styles$getStyleByCel.n) === null || _styles$getStyleByCel === void 0 ? void 0 : _styles$getStyleByCel.pattern);
|
|
2441
|
+
if (oldValue.v !== void 0 && (!canPreserveValue || numberFormatChanged)) {
|
|
2442
|
+
const nextType = numberFormatChanged ? getCellType(styles, newValue, {
|
|
2443
|
+
...oldValue,
|
|
2444
|
+
s: previousStyle
|
|
2445
|
+
}) : type;
|
|
2446
|
+
oldValue.t = nextType;
|
|
2447
|
+
oldValue.v = getCellValue(nextType, oldValue);
|
|
2429
2448
|
}
|
|
2430
2449
|
if (oldValue.v === null) {
|
|
2431
2450
|
delete oldValue.t;
|
|
@@ -2472,6 +2491,7 @@ const SetRowDataMutation = {
|
|
|
2472
2491
|
type: CommandType.MUTATION,
|
|
2473
2492
|
handler: (accessor, params) => {
|
|
2474
2493
|
const { rowData } = params;
|
|
2494
|
+
if (!Object.values(rowData).every(isValidRowDimensions)) return false;
|
|
2475
2495
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
2476
2496
|
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
2477
2497
|
if (!target) return false;
|
|
@@ -2576,6 +2596,8 @@ const SetWorksheetColWidthMutation = {
|
|
|
2576
2596
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
2577
2597
|
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
2578
2598
|
if (!target) return false;
|
|
2599
|
+
const dimensions = params.colWidth;
|
|
2600
|
+
if (typeof dimensions === "number" ? !isValidSheetDimension(dimensions) : dimensions == null || typeof dimensions !== "object" || Object.values(dimensions).some((value) => value != null && !isValidSheetDimension(value))) return false;
|
|
2579
2601
|
const { worksheet } = target;
|
|
2580
2602
|
const manager = worksheet.getColumnManager();
|
|
2581
2603
|
const ranges = params.ranges;
|
|
@@ -2720,6 +2742,8 @@ const SetWorksheetRowHeightMutation = {
|
|
|
2720
2742
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
2721
2743
|
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
2722
2744
|
if (!target) return false;
|
|
2745
|
+
const dimensions = params.rowHeight;
|
|
2746
|
+
if (typeof dimensions === "number" ? !isValidSheetDimension(dimensions) : dimensions == null || typeof dimensions !== "object" || Object.values(dimensions).some((value) => value != null && !isValidSheetDimension(value))) return false;
|
|
2723
2747
|
const { worksheet } = target;
|
|
2724
2748
|
const manager = worksheet.getRowManager();
|
|
2725
2749
|
for (const { startRow, endRow } of ranges) for (let rowIndex = startRow; rowIndex <= endRow; rowIndex++) if (typeof rowHeight === "number") manager.setRowHeight(rowIndex, rowHeight);
|
|
@@ -2749,6 +2773,7 @@ const SetWorksheetRowAutoHeightMutation = {
|
|
|
2749
2773
|
type: CommandType.MUTATION,
|
|
2750
2774
|
handler: (accessor, params) => {
|
|
2751
2775
|
const { rowsAutoHeightInfo } = params;
|
|
2776
|
+
if (rowsAutoHeightInfo.some(({ autoHeight }) => autoHeight != null && !isValidSheetDimension(autoHeight))) return false;
|
|
2752
2777
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
2753
2778
|
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
2754
2779
|
if (!target) return false;
|
|
@@ -13675,10 +13700,36 @@ const SetSpecificColsVisibleCommand = {
|
|
|
13675
13700
|
});
|
|
13676
13701
|
if (!target) return false;
|
|
13677
13702
|
const { worksheet } = target;
|
|
13703
|
+
const zeroWidthRanges = [];
|
|
13704
|
+
for (const range of ranges) for (let column = range.startColumn; column <= range.endColumn; column++) if (worksheet.getColVisible(column) && worksheet.getColumnWidth(column) === 0) zeroWidthRanges.push({
|
|
13705
|
+
...range,
|
|
13706
|
+
startColumn: column,
|
|
13707
|
+
endColumn: column
|
|
13708
|
+
});
|
|
13709
|
+
const widthRanges = Rectangle.mergeRanges(zeroWidthRanges);
|
|
13710
|
+
const visibilityRanges = widthRanges.length ? getHiddenColRanges(worksheet, ranges) : ranges;
|
|
13711
|
+
const widthRedos = [];
|
|
13712
|
+
const widthUndos = [];
|
|
13713
|
+
if (widthRanges.length) {
|
|
13714
|
+
const widthParams = {
|
|
13715
|
+
unitId,
|
|
13716
|
+
subUnitId,
|
|
13717
|
+
ranges: widthRanges,
|
|
13718
|
+
colWidth: worksheet.getConfig().defaultColumnWidth
|
|
13719
|
+
};
|
|
13720
|
+
widthRedos.push({
|
|
13721
|
+
id: SetWorksheetColWidthMutation.id,
|
|
13722
|
+
params: widthParams
|
|
13723
|
+
});
|
|
13724
|
+
widthUndos.push({
|
|
13725
|
+
id: SetWorksheetColWidthMutation.id,
|
|
13726
|
+
params: SetWorksheetColWidthMutationFactory(widthParams, worksheet)
|
|
13727
|
+
});
|
|
13728
|
+
}
|
|
13678
13729
|
const redoMutationParams = {
|
|
13679
13730
|
unitId,
|
|
13680
13731
|
subUnitId,
|
|
13681
|
-
ranges
|
|
13732
|
+
ranges: visibilityRanges
|
|
13682
13733
|
};
|
|
13683
13734
|
const setSelectionOperationParams = {
|
|
13684
13735
|
unitId,
|
|
@@ -13700,13 +13751,23 @@ const SetSpecificColsVisibleCommand = {
|
|
|
13700
13751
|
style: null
|
|
13701
13752
|
}))
|
|
13702
13753
|
};
|
|
13703
|
-
const
|
|
13754
|
+
const visibilityRedos = visibilityRanges.length ? [{
|
|
13704
13755
|
id: SetColVisibleMutation.id,
|
|
13705
13756
|
params: redoMutationParams
|
|
13706
|
-
}
|
|
13707
|
-
|
|
13708
|
-
|
|
13709
|
-
|
|
13757
|
+
}] : [];
|
|
13758
|
+
const visibilityUndos = visibilityRanges.length ? [{
|
|
13759
|
+
id: SetColHiddenMutation.id,
|
|
13760
|
+
params: undoMutationParams
|
|
13761
|
+
}] : [];
|
|
13762
|
+
const result = sequenceExecute([
|
|
13763
|
+
...visibilityRedos,
|
|
13764
|
+
...widthRedos,
|
|
13765
|
+
{
|
|
13766
|
+
id: SetSelectionsOperation.id,
|
|
13767
|
+
params: setSelectionOperationParams
|
|
13768
|
+
}
|
|
13769
|
+
], commandService);
|
|
13770
|
+
if (!result.result) return false;
|
|
13710
13771
|
const intercepted = sheetInterceptorService.onCommandExecute({
|
|
13711
13772
|
id: SetSpecificColsVisibleCommand.id,
|
|
13712
13773
|
params
|
|
@@ -13721,10 +13782,8 @@ const SetSpecificColsVisibleCommand = {
|
|
|
13721
13782
|
accessor.get(IUndoRedoService).pushUndoRedo({
|
|
13722
13783
|
unitID: unitId,
|
|
13723
13784
|
undoMutations: [
|
|
13724
|
-
|
|
13725
|
-
|
|
13726
|
-
params: undoMutationParams
|
|
13727
|
-
},
|
|
13785
|
+
...widthUndos,
|
|
13786
|
+
...visibilityUndos,
|
|
13728
13787
|
{
|
|
13729
13788
|
id: SetSelectionsOperation.id,
|
|
13730
13789
|
params: undoSetSelectionsOperationParams
|
|
@@ -13734,10 +13793,8 @@ const SetSpecificColsVisibleCommand = {
|
|
|
13734
13793
|
],
|
|
13735
13794
|
redoMutations: [
|
|
13736
13795
|
...intercepted.preRedos ?? [],
|
|
13737
|
-
|
|
13738
|
-
|
|
13739
|
-
params: redoMutationParams
|
|
13740
|
-
},
|
|
13796
|
+
...visibilityRedos,
|
|
13797
|
+
...widthRedos,
|
|
13741
13798
|
{
|
|
13742
13799
|
id: SetSelectionsOperation.id,
|
|
13743
13800
|
params: setSelectionOperationParams
|
|
@@ -14407,10 +14464,36 @@ const SetSpecificRowsVisibleCommand = {
|
|
|
14407
14464
|
});
|
|
14408
14465
|
if (!target) return false;
|
|
14409
14466
|
const { worksheet } = target;
|
|
14467
|
+
const zeroHeightRanges = [];
|
|
14468
|
+
for (const range of ranges) for (let row = range.startRow; row <= range.endRow; row++) if (worksheet.getRowVisible(row) && worksheet.getRowHeight(row) === 0) zeroHeightRanges.push({
|
|
14469
|
+
...range,
|
|
14470
|
+
startRow: row,
|
|
14471
|
+
endRow: row
|
|
14472
|
+
});
|
|
14473
|
+
const heightRanges = Rectangle.mergeRanges(zeroHeightRanges);
|
|
14474
|
+
const visibilityRanges = heightRanges.length ? getHiddenRowRanges(worksheet, ranges) : ranges;
|
|
14475
|
+
const heightRedos = [];
|
|
14476
|
+
const heightUndos = [];
|
|
14477
|
+
if (heightRanges.length) {
|
|
14478
|
+
const heightParams = {
|
|
14479
|
+
unitId,
|
|
14480
|
+
subUnitId,
|
|
14481
|
+
ranges: heightRanges,
|
|
14482
|
+
rowHeight: worksheet.getConfig().defaultRowHeight
|
|
14483
|
+
};
|
|
14484
|
+
heightRedos.push({
|
|
14485
|
+
id: SetWorksheetRowHeightMutation.id,
|
|
14486
|
+
params: heightParams
|
|
14487
|
+
});
|
|
14488
|
+
heightUndos.push({
|
|
14489
|
+
id: SetWorksheetRowHeightMutation.id,
|
|
14490
|
+
params: SetWorksheetRowHeightMutationFactory(heightParams, worksheet)
|
|
14491
|
+
});
|
|
14492
|
+
}
|
|
14410
14493
|
const redoMutationParams = {
|
|
14411
14494
|
unitId,
|
|
14412
14495
|
subUnitId,
|
|
14413
|
-
ranges
|
|
14496
|
+
ranges: visibilityRanges
|
|
14414
14497
|
};
|
|
14415
14498
|
const setSelectionOperationParams = {
|
|
14416
14499
|
unitId,
|
|
@@ -14432,13 +14515,23 @@ const SetSpecificRowsVisibleCommand = {
|
|
|
14432
14515
|
style: null
|
|
14433
14516
|
}))
|
|
14434
14517
|
};
|
|
14435
|
-
const
|
|
14518
|
+
const visibilityRedos = visibilityRanges.length ? [{
|
|
14436
14519
|
id: SetRowVisibleMutation.id,
|
|
14437
14520
|
params: redoMutationParams
|
|
14438
|
-
}
|
|
14439
|
-
|
|
14440
|
-
|
|
14441
|
-
|
|
14521
|
+
}] : [];
|
|
14522
|
+
const visibilityUndos = visibilityRanges.length ? [{
|
|
14523
|
+
id: SetRowHiddenMutation.id,
|
|
14524
|
+
params: undoMutationParams
|
|
14525
|
+
}] : [];
|
|
14526
|
+
const result = sequenceExecute([
|
|
14527
|
+
...visibilityRedos,
|
|
14528
|
+
...heightRedos,
|
|
14529
|
+
{
|
|
14530
|
+
id: SetSelectionsOperation.id,
|
|
14531
|
+
params: setSelectionOperationParams
|
|
14532
|
+
}
|
|
14533
|
+
], commandService);
|
|
14534
|
+
if (!result.result) return false;
|
|
14442
14535
|
const intercepted = sheetInterceptorService.onCommandExecute({
|
|
14443
14536
|
id: SetSpecificRowsVisibleCommand.id,
|
|
14444
14537
|
params
|
|
@@ -14454,10 +14547,8 @@ const SetSpecificRowsVisibleCommand = {
|
|
|
14454
14547
|
unitID: unitId,
|
|
14455
14548
|
undoMutations: [
|
|
14456
14549
|
...intercepted.preUndos ?? [],
|
|
14457
|
-
|
|
14458
|
-
|
|
14459
|
-
params: undoMutationParams
|
|
14460
|
-
},
|
|
14550
|
+
...heightUndos,
|
|
14551
|
+
...visibilityUndos,
|
|
14461
14552
|
{
|
|
14462
14553
|
id: SetSelectionsOperation.id,
|
|
14463
14554
|
params: undoSetSelectionsOperationParams
|
|
@@ -14467,10 +14558,8 @@ const SetSpecificRowsVisibleCommand = {
|
|
|
14467
14558
|
],
|
|
14468
14559
|
redoMutations: [
|
|
14469
14560
|
...intercepted.preRedos ?? [],
|
|
14470
|
-
|
|
14471
|
-
|
|
14472
|
-
params: redoMutationParams
|
|
14473
|
-
},
|
|
14561
|
+
...visibilityRedos,
|
|
14562
|
+
...heightRedos,
|
|
14474
14563
|
{
|
|
14475
14564
|
id: SetSelectionsOperation.id,
|
|
14476
14565
|
params: setSelectionOperationParams
|
|
@@ -14881,6 +14970,7 @@ const DeltaColumnWidthCommand = {
|
|
|
14881
14970
|
const { worksheet, unitId, subUnitId } = target;
|
|
14882
14971
|
const { anchorCol, deltaX } = params;
|
|
14883
14972
|
const destColumnWidth = worksheet.getColumnWidth(anchorCol) + deltaX;
|
|
14973
|
+
if (!isValidSheetDimension(destColumnWidth)) return false;
|
|
14884
14974
|
const isAllSheetRange = selections.length === 1 && selections[0].range.rangeType === RANGE_TYPE.ALL;
|
|
14885
14975
|
const colSelections = selections.filter((s) => s.range.rangeType === RANGE_TYPE.COLUMN);
|
|
14886
14976
|
const rangeType = isAllSheetRange ? RANGE_TYPE.ALL : colSelections.some(({ range }) => {
|
|
@@ -14976,6 +15066,7 @@ const SetColWidthCommand = {
|
|
|
14976
15066
|
id: "sheet.command.set-worksheet-col-width",
|
|
14977
15067
|
handler: (accessor, params) => {
|
|
14978
15068
|
var _params$ranges, _selectionManagerServ;
|
|
15069
|
+
if (!isValidSheetDimension(params === null || params === void 0 ? void 0 : params.value)) return false;
|
|
14979
15070
|
const selectionManagerService = accessor.get(SheetsSelectionsService);
|
|
14980
15071
|
const commandService = accessor.get(ICommandService);
|
|
14981
15072
|
const undoRedoService = accessor.get(IUndoRedoService);
|
|
@@ -16636,6 +16727,7 @@ const DeltaRowHeightCommand = {
|
|
|
16636
16727
|
const { worksheet, subUnitId, unitId } = target;
|
|
16637
16728
|
const { anchorRow, deltaY } = params;
|
|
16638
16729
|
const destRowHeight = worksheet.getRowHeight(anchorRow) + deltaY;
|
|
16730
|
+
if (!isValidSheetDimension(destRowHeight)) return false;
|
|
16639
16731
|
const isAllSheetRange = selections.length === 1 && selections[0].range.rangeType === RANGE_TYPE.ALL;
|
|
16640
16732
|
const rowSelections = selections.filter((s) => s.range.rangeType === RANGE_TYPE.ROW);
|
|
16641
16733
|
const rangeType = isAllSheetRange ? RANGE_TYPE.ALL : rowSelections.some(({ range }) => {
|
|
@@ -16740,6 +16832,7 @@ const SetRowHeightCommand = {
|
|
|
16740
16832
|
id: "sheet.command.set-row-height",
|
|
16741
16833
|
handler: (accessor, params) => {
|
|
16742
16834
|
var _params$ranges, _selectionManagerServ;
|
|
16835
|
+
if (!isValidSheetDimension(params === null || params === void 0 ? void 0 : params.value)) return false;
|
|
16743
16836
|
const selectionManagerService = accessor.get(SheetsSelectionsService);
|
|
16744
16837
|
const commandService = accessor.get(ICommandService);
|
|
16745
16838
|
const undoRedoService = accessor.get(IUndoRedoService);
|
|
@@ -19644,7 +19737,7 @@ RangeProtectionCache = __decorate([
|
|
|
19644
19737
|
//#endregion
|
|
19645
19738
|
//#region package.json
|
|
19646
19739
|
var name = "@univerjs/sheets";
|
|
19647
|
-
var version = "1.
|
|
19740
|
+
var version = "1.3.0";
|
|
19648
19741
|
|
|
19649
19742
|
//#endregion
|
|
19650
19743
|
//#region src/controllers/active-worksheet.controller.ts
|