@univerjs/sheets 0.15.0-insiders.20251227-c108ce3 → 0.15.0-insiders.20260107-3441c7a
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/facade.js +1 -1
- package/lib/cjs/index.js +3 -3
- package/lib/es/facade.js +891 -845
- package/lib/es/index.js +1470 -1433
- package/lib/facade.js +891 -845
- package/lib/index.js +1470 -1433
- package/lib/types/commands/commands/add-worksheet-merge.command.d.ts +18 -4
- package/lib/types/commands/commands/set-range-custom-metadata.command.d.ts +14 -0
- package/lib/types/commands/commands/set-tab-color.command.d.ts +2 -1
- package/lib/types/facade/f-range.d.ts +37 -7
- package/lib/types/index.d.ts +2 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +3 -3
- package/package.json +6 -6
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { IAccessor, ICellData, ICommand, IMutationInfo, Injector, IRange, Nullable, Worksheet, Dimension, ObjectMatrix } from '@univerjs/core';
|
|
2
|
-
|
|
2
|
+
import { ISheetCommandSharedParams } from '../utils/interface';
|
|
3
|
+
export interface IAddMergeCommandParams extends ISheetCommandSharedParams {
|
|
3
4
|
value?: Dimension.ROWS | Dimension.COLUMNS;
|
|
4
5
|
selections: IRange[];
|
|
5
|
-
unitId: string;
|
|
6
|
-
subUnitId: string;
|
|
7
6
|
defaultMerge?: boolean;
|
|
8
7
|
}
|
|
9
8
|
export declare enum MergeType {
|
|
@@ -11,6 +10,21 @@ export declare enum MergeType {
|
|
|
11
10
|
MergeVertical = "mergeVertical",
|
|
12
11
|
MergeHorizontal = "mergeHorizontal"
|
|
13
12
|
}
|
|
13
|
+
export interface IMergeCellsUtilOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Whether to use the default merge behavior when there are existing cell contents in the merge ranges.
|
|
16
|
+
* If true, only the value in the upper left cell is retained.
|
|
17
|
+
* If false, a confirm dialog will be shown to the user.
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
defaultMerge?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Whether to force merge even if there are existing merged cells that overlap with the new merge ranges.
|
|
23
|
+
* If true, the overlapping merged cells will be removed before performing the new merge.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
isForceMerge?: boolean;
|
|
27
|
+
}
|
|
14
28
|
export declare function getClearContentMutationParamsForRanges(accessor: IAccessor, unitId: string, worksheet: Worksheet, ranges: IRange[]): {
|
|
15
29
|
undos: IMutationInfo[];
|
|
16
30
|
redos: IMutationInfo[];
|
|
@@ -20,5 +34,5 @@ export declare const AddWorksheetMergeCommand: ICommand;
|
|
|
20
34
|
export declare const AddWorksheetMergeAllCommand: ICommand;
|
|
21
35
|
export declare const AddWorksheetMergeVerticalCommand: ICommand;
|
|
22
36
|
export declare const AddWorksheetMergeHorizontalCommand: ICommand;
|
|
23
|
-
export declare function addMergeCellsUtil(injector: Injector, unitId: string, subUnitId: string, ranges: IRange[],
|
|
37
|
+
export declare function addMergeCellsUtil(injector: Injector, unitId: string, subUnitId: string, ranges: IRange[], options?: IMergeCellsUtilOptions): void;
|
|
24
38
|
export declare function getMergeableSelectionsByType(type: MergeType, selections: Nullable<IRange[]>): Nullable<IRange[]>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CustomData, ICommand, IRange } from '@univerjs/core';
|
|
2
|
+
import { ISheetCommandSharedParams } from '../utils/interface';
|
|
3
|
+
interface ICustomMetadata {
|
|
4
|
+
custom: CustomData;
|
|
5
|
+
}
|
|
6
|
+
export interface ISetRangeCustomMetadataCommandParams extends Partial<ISheetCommandSharedParams> {
|
|
7
|
+
range: IRange;
|
|
8
|
+
customMetadata: ICustomMetadata | ICustomMetadata[][];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The command to set custom metadata for a range of cells, and not support undo/redo.
|
|
12
|
+
*/
|
|
13
|
+
export declare const SetRangeCustomMetadataCommand: ICommand;
|
|
14
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ICommand } from '@univerjs/core';
|
|
2
|
-
|
|
2
|
+
import { ISheetCommandSharedParams } from '../utils/interface';
|
|
3
|
+
export interface ISetTabColorCommandParams extends Partial<ISheetCommandSharedParams> {
|
|
3
4
|
value: string;
|
|
4
5
|
}
|
|
5
6
|
export declare const SetTabColorCommand: ICommand;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbsoluteRefType, BorderStyleTypes, BorderType, CellValue, CustomData, ICellData, IDocumentData, IObjectMatrixPrimitiveType, IRange, IStyleData, Nullable, Workbook, Worksheet, Dimension, ICommandService, Injector, RichTextValue, TextStyleValue, WrapStrategy } from '@univerjs/core';
|
|
2
|
-
import { SplitDelimiterEnum } from '@univerjs/sheets';
|
|
2
|
+
import { IMergeCellsUtilOptions, SplitDelimiterEnum } from '@univerjs/sheets';
|
|
3
3
|
import { IFacadeClearOptions } from './f-worksheet';
|
|
4
4
|
import { FHorizontalAlignment, FVerticalAlignment } from './utils';
|
|
5
5
|
import { FBaseInitialable } from '@univerjs/core/facade';
|
|
@@ -971,7 +971,9 @@ export declare class FRange extends FBaseInitialable {
|
|
|
971
971
|
setFontColor(color: string | null): this;
|
|
972
972
|
/**
|
|
973
973
|
* Merge cells in a range into one merged cell
|
|
974
|
-
* @param {
|
|
974
|
+
* @param {IMergeCellsUtilOptions} [options] - The options for merging cells.
|
|
975
|
+
* @param {boolean} [options.defaultMerge] - If true, only the value in the upper left cell is retained. If false, a confirm dialog will be shown to the user. Default is true.
|
|
976
|
+
* @param {boolean} [options.isForceMerge] - If true, the overlapping merged cells will be removed before performing the new merge. Default is false.
|
|
975
977
|
* @returns {FRange} This range, for chaining
|
|
976
978
|
* @example
|
|
977
979
|
* ```ts
|
|
@@ -981,11 +983,21 @@ export declare class FRange extends FBaseInitialable {
|
|
|
981
983
|
* fRange.merge();
|
|
982
984
|
* console.log(fRange.isMerged());
|
|
983
985
|
* ```
|
|
986
|
+
*
|
|
987
|
+
* ```ts
|
|
988
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
989
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
990
|
+
* const fRange = fWorksheet.getRange('B1:C2');
|
|
991
|
+
* // Assume A1:B2 is already merged.
|
|
992
|
+
* fRange.merge({ isForceMerge: true });
|
|
993
|
+
* ```
|
|
984
994
|
*/
|
|
985
|
-
merge(
|
|
995
|
+
merge(options?: IMergeCellsUtilOptions): FRange;
|
|
986
996
|
/**
|
|
987
997
|
* Merges cells in a range horizontally.
|
|
988
|
-
* @param {
|
|
998
|
+
* @param {IMergeCellsUtilOptions} [options] - The options for merging cells.
|
|
999
|
+
* @param {boolean} [options.defaultMerge] - If true, only the value in the upper left cell is retained. If false, a confirm dialog will be shown to the user. Default is true.
|
|
1000
|
+
* @param {boolean} [options.isForceMerge] - If true, the overlapping merged cells will be removed before performing the new merge. Default is false.
|
|
989
1001
|
* @returns {FRange} This range, for chaining
|
|
990
1002
|
* @example
|
|
991
1003
|
* ```ts
|
|
@@ -1000,11 +1012,21 @@ export declare class FRange extends FBaseInitialable {
|
|
|
1000
1012
|
* console.log(item.getA1Notation());
|
|
1001
1013
|
* });
|
|
1002
1014
|
* ```
|
|
1015
|
+
*
|
|
1016
|
+
* ```ts
|
|
1017
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1018
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
1019
|
+
* const fRange = fWorksheet.getRange('B1:C2');
|
|
1020
|
+
* // Assume A1:B2 is already merged.
|
|
1021
|
+
* fRange.mergeAcross({ isForceMerge: true });
|
|
1022
|
+
* ```
|
|
1003
1023
|
*/
|
|
1004
|
-
mergeAcross(
|
|
1024
|
+
mergeAcross(options?: IMergeCellsUtilOptions): FRange;
|
|
1005
1025
|
/**
|
|
1006
1026
|
* Merges cells in a range vertically.
|
|
1007
|
-
* @param {
|
|
1027
|
+
* @param {IMergeCellsUtilOptions} [options] - The options for merging cells.
|
|
1028
|
+
* @param {boolean} [options.defaultMerge] - If true, only the value in the upper left cell is retained. If false, a confirm dialog will be shown to the user. Default is true.
|
|
1029
|
+
* @param {boolean} [options.isForceMerge] - If true, the overlapping merged cells will be removed before performing the new merge. Default is false.
|
|
1008
1030
|
* @returns {FRange} This range, for chaining
|
|
1009
1031
|
* @example
|
|
1010
1032
|
* ```ts
|
|
@@ -1019,8 +1041,16 @@ export declare class FRange extends FBaseInitialable {
|
|
|
1019
1041
|
* console.log(item.getA1Notation());
|
|
1020
1042
|
* });
|
|
1021
1043
|
* ```
|
|
1044
|
+
*
|
|
1045
|
+
* ```ts
|
|
1046
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1047
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
1048
|
+
* const fRange = fWorksheet.getRange('B1:C2');
|
|
1049
|
+
* // Assume A1:B2 is already merged.
|
|
1050
|
+
* fRange.mergeVertically({ isForceMerge: true });
|
|
1051
|
+
* ```
|
|
1022
1052
|
*/
|
|
1023
|
-
mergeVertically(
|
|
1053
|
+
mergeVertically(options?: IMergeCellsUtilOptions): FRange;
|
|
1024
1054
|
/**
|
|
1025
1055
|
* Returns true if cells in the current range overlap a merged cell.
|
|
1026
1056
|
* @returns {boolean} is overlap with a merged cell
|
package/lib/types/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export { SplitDelimiterEnum, splitRangeText } from './basics/split-range-text';
|
|
|
24
24
|
export { findFirstNonEmptyCell } from './basics/utils';
|
|
25
25
|
export { generateNullCell, generateNullCellValue, getVisibleRanges, rangeToDiscreteRange } from './basics/utils';
|
|
26
26
|
export { AddRangeProtectionCommand, type IAddRangeProtectionCommandParams } from './commands/commands/add-range-protection.command';
|
|
27
|
-
export { addMergeCellsUtil, AddWorksheetMergeAllCommand, AddWorksheetMergeCommand, AddWorksheetMergeHorizontalCommand, AddWorksheetMergeVerticalCommand, getClearContentMutationParamForRange, getClearContentMutationParamsForRanges, } from './commands/commands/add-worksheet-merge.command';
|
|
27
|
+
export { addMergeCellsUtil, AddWorksheetMergeAllCommand, AddWorksheetMergeCommand, AddWorksheetMergeHorizontalCommand, AddWorksheetMergeVerticalCommand, getClearContentMutationParamForRange, getClearContentMutationParamsForRanges, type IMergeCellsUtilOptions, } from './commands/commands/add-worksheet-merge.command';
|
|
28
28
|
export { AddWorksheetProtectionCommand } from './commands/commands/add-worksheet-protection.command';
|
|
29
29
|
export { SetWorksheetRangeThemeStyleCommand } from './commands/commands/add-worksheet-range-theme.command';
|
|
30
30
|
export { AppendRowCommand, type IAppendRowCommandParams } from './commands/commands/append-row.command';
|
|
@@ -60,6 +60,7 @@ export { type ICancelFrozenCommandParams, type ISetFrozenCommandParams } from '.
|
|
|
60
60
|
export { CancelFrozenCommand, SetFrozenCommand } from './commands/commands/set-frozen.command';
|
|
61
61
|
export { type ISetGridlinesColorCommandParams, SetGridlinesColorCommand } from './commands/commands/set-gridlines-color.command';
|
|
62
62
|
export { SetProtectionCommand } from './commands/commands/set-protection.command';
|
|
63
|
+
export { type ISetRangeCustomMetadataCommandParams, SetRangeCustomMetadataCommand } from './commands/commands/set-range-custom-metadata.command';
|
|
63
64
|
export { type ISetRangeValuesCommandParams, SetRangeValuesCommand } from './commands/commands/set-range-values.command';
|
|
64
65
|
export { type ISetRowDataCommandParams, SetRowDataCommand } from './commands/commands/set-row-data.command';
|
|
65
66
|
export { type ISetSpecificRowsVisibleCommandParams, SetRowHiddenCommand, SetSelectedRowsVisibleCommand, SetSpecificRowsVisibleCommand, } from './commands/commands/set-row-visible.command';
|