@univerjs/core 0.20.0 → 0.20.1

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.
@@ -25,6 +25,11 @@ export declare class AuthzIoLocalService implements IAuthzIoService {
25
25
  private _userManagerService;
26
26
  private _permissionMap;
27
27
  private _permissionOverrides;
28
+ /**
29
+ * Whether the document owner inherits permissions for all protected ranges.
30
+ * If true, the document owner cannot be selected when specifying user edits for a protected range, and the document owner will have edit permissions for all protected ranges by default.
31
+ */
32
+ private _cfgEnableObjInherit;
28
33
  constructor(_resourceManagerService: IResourceManagerService, _userManagerService: UserManagerService);
29
34
  private _initDefaultUser;
30
35
  private _getRole;
@@ -62,4 +67,6 @@ export declare class AuthzIoLocalService implements IAuthzIoService {
62
67
  updateCollaborator(): Promise<void>;
63
68
  createCollaborator(): Promise<void>;
64
69
  putCollaborators(config: IPutCollaboratorsRequest): Promise<void>;
70
+ setCfgEnableObjInherit(enabled: boolean): void;
71
+ getCfgEnableObjInherit(): boolean;
65
72
  }
@@ -30,5 +30,7 @@ export interface IAuthzIoService {
30
30
  deleteCollaborator(config: IDeleteCollaboratorRequest, context?: ILogContext): Promise<void>;
31
31
  createCollaborator(config: ICreateCollaboratorRequest, context?: ILogContext): Promise<void>;
32
32
  putCollaborators(config: IPutCollaboratorsRequest, context?: ILogContext): Promise<void>;
33
+ setCfgEnableObjInherit?(enabled: boolean): void;
34
+ getCfgEnableObjInherit?(): boolean;
33
35
  }
34
36
  export declare const IAuthzIoService: import("@wendellhu/redi").IdentifierDecorator<IAuthzIoService>;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ type DateKitCoreUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
17
+ export type DateKitUnitType = DateKitCoreUnit | 'milliseconds' | 'ms' | 'seconds' | 's' | 'minutes' | 'm' | 'hours' | 'h' | 'days' | 'd' | 'weeks' | 'w' | 'months' | 'M' | 'years' | 'y';
18
+ export type DateKitInput = Date | number | string | IDateKit | null | undefined;
19
+ export interface IDateKit {
20
+ isValid(): boolean;
21
+ format(template?: string): string;
22
+ valueOf(): number;
23
+ toDate(): Date;
24
+ add(value: number, unit?: DateKitUnitType): IDateKit;
25
+ subtract(value: number, unit?: DateKitUnitType): IDateKit;
26
+ startOf(unit: DateKitUnitType): IDateKit;
27
+ endOf(unit: DateKitUnitType): IDateKit;
28
+ utc(): IDateKit;
29
+ local(): IDateKit;
30
+ weekday(): number;
31
+ weekday(value: number): IDateKit;
32
+ week(): number;
33
+ week(value: number): IDateKit;
34
+ }
35
+ export type DateKit = IDateKit;
36
+ export type OpUnitType = DateKitUnitType;
37
+ interface IDateKitStatic {
38
+ (input?: DateKitInput): IDateKit;
39
+ utc: (input?: DateKitInput) => IDateKit;
40
+ isDateKit: (value: unknown) => value is IDateKit;
41
+ unix: (timestamp: number) => IDateKit;
42
+ }
43
+ export declare const dateKit: IDateKitStatic;
44
+ export {};
@@ -21,7 +21,8 @@ export { ColorKit, COLORS, type IRgbColor, RGB_PAREN, RGBA_PAREN } from './color
21
21
  export * from './command-enum';
22
22
  export * from './common';
23
23
  export * from './compare';
24
- export * from './dayjs';
24
+ export type { DateKit, DateKitInput, DateKitUnitType, OpUnitType } from './date-kit';
25
+ export { dateKit } from './date-kit';
25
26
  export * from './doc-tool';
26
27
  export * from './generate';
27
28
  export * from './hash-algorithm';
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { IStyleData } from '../types/interfaces';
17
- import type { IKeyValue, Nullable } from './types';
17
+ import type { Nullable } from './types';
18
18
  /**
19
19
  * Universal tool library
20
20
  */
@@ -48,7 +48,7 @@ export declare class Tools {
48
48
  * @param obj
49
49
  * @returns
50
50
  */
51
- static removeNull(value: IKeyValue): object;
51
+ static removeNull(value: Record<string, any>): object;
52
52
  static numToWord(x: number): string;
53
53
  /**
54
54
  * Column subscript letter to number
@@ -71,7 +71,7 @@ export declare class Tools {
71
71
  * @param extendJson
72
72
  * @returns
73
73
  */
74
- static commonExtend<T>(originJson: IKeyValue, extendJson: IKeyValue): T;
74
+ static commonExtend<T>(originJson: Record<string, any>, extendJson: Record<string, any>): T;
75
75
  static hasIntersectionBetweenTwoRanges(range1Start: number, range1End: number, range2Start: number, range2End: number): boolean;
76
76
  static isStartValidPosition(name: string): boolean;
77
77
  static isValidParameter(name: string): boolean;
@@ -17,22 +17,6 @@
17
17
  * @ignore
18
18
  */
19
19
  export type Nullable<T> = T | null | undefined | void;
20
- /**
21
- * Key value object
22
- *
23
- * @ignore
24
- * @deprecated As it has
25
- */
26
- export interface IKeyValue {
27
- [key: string]: any;
28
- }
29
- /**
30
- * @ignore
31
- * @deprecated, use {@link Record} instead.
32
- */
33
- export interface IKeyType<T> {
34
- [key: string]: T;
35
- }
36
20
  export type DeepReadonly<T> = {
37
21
  readonly [P in keyof T]: DeepReadonly<T[P]>;
38
22
  };
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { Nullable } from '../shared';
16
+ import type { IObjectArrayPrimitiveType, Nullable } from '../shared';
17
17
  import type { IDocumentData, IDocumentRenderConfig, IPaddingData } from '../types/interfaces';
18
18
  import type { Styles } from './styles';
19
19
  import type { ICellData, ICellInfo, ICellWithCoord, IPosition, IRange, ISelectionCell, IWorksheetData } from './typedef';
@@ -27,6 +27,40 @@ import { ObjectMatrix } from '../shared';
27
27
  import { ImageCacheMap } from '../shared/cache/image-cache';
28
28
  import { Skeleton } from '../skeleton';
29
29
  import { HorizontalAlign } from '../types/enum';
30
+ /**
31
+ * Configuration for a single gap (visual separator between rows or columns).
32
+ * The gap area is rendered with a background color and diagonal stripes.
33
+ */
34
+ export interface IGapItem {
35
+ /** Gap size in pixels */
36
+ size: number;
37
+ /** Background color of the gap area. Falls back to ISheetGapConfig.defaultBackgroundColor. */
38
+ color?: string;
39
+ /** Diagonal stripe color. Falls back to ISheetGapConfig.defaultStripeColor. */
40
+ stripeColor?: string;
41
+ }
42
+ /**
43
+ * Configuration for row/column gaps in a sheet.
44
+ * Gaps are visual-only separators that do not affect the data model.
45
+ * They are stored as runtime configuration and are not persisted.
46
+ */
47
+ export interface ISheetGapConfig {
48
+ /** Row gaps. Key is the row index; gap appears BEFORE that row. */
49
+ rowGaps?: IObjectArrayPrimitiveType<IGapItem>;
50
+ /** Column gaps. Key is the column index; gap appears BEFORE that column. */
51
+ colGaps?: IObjectArrayPrimitiveType<IGapItem>;
52
+ /** Default diagonal stripe color (theme primary). Used when gap items don't specify stripeColor. */
53
+ defaultStripeColor?: string;
54
+ /** Default background color (lighter primary). Used when gap items don't specify color. */
55
+ defaultBackgroundColor?: string;
56
+ }
57
+ /**
58
+ * Optional gap size getter for coordinate calculation functions.
59
+ */
60
+ export interface IGapSizeGetter {
61
+ row: (r: number) => number;
62
+ col: (c: number) => number;
63
+ }
30
64
  export interface IGetRowColByPosOptions {
31
65
  closeFirst?: boolean;
32
66
  /**
@@ -74,6 +108,10 @@ export declare class SheetSkeleton extends Skeleton {
74
108
  private _columnWidthAccumulation;
75
109
  private _marginTop;
76
110
  private _marginLeft;
111
+ /**
112
+ * Runtime gap configuration for visual row/column separators.
113
+ */
114
+ private _gapConfig;
77
115
  /** Scale of Scene */
78
116
  protected _scaleX: number;
79
117
  protected _scaleY: number;
@@ -100,6 +138,35 @@ export declare class SheetSkeleton extends Skeleton {
100
138
  get rowHeaderWidthAndMarginLeft(): number;
101
139
  get columnHeaderHeightAndMarginTop(): number;
102
140
  get imageCacheMap(): ImageCacheMap;
141
+ get gapConfig(): ISheetGapConfig;
142
+ /**
143
+ * Set runtime gap configuration for visual row/column separators.
144
+ * This triggers a recalculation of the layout (accumulation arrays, etc.).
145
+ */
146
+ setGapConfig(config: ISheetGapConfig): void;
147
+ private _fillDefaultGapThemeColors;
148
+ /**
149
+ * Get the gap size (in px) BEFORE the given row.
150
+ */
151
+ getRowGapSize(row: number): number;
152
+ /**
153
+ * Get the gap size (in px) BEFORE the given column.
154
+ */
155
+ getColGapSize(col: number): number;
156
+ /**
157
+ * Returns a gap size getter object for use with coordinate utility functions.
158
+ */
159
+ getGapSizeGetter(): IGapSizeGetter | undefined;
160
+ /**
161
+ * Check if a Y position (in sheet content coordinates) falls within a row gap.
162
+ * @returns The row index that the gap precedes, or -1 if not in a gap.
163
+ */
164
+ getRowGapAtPosition(y: number): number;
165
+ /**
166
+ * Check if an X position (in sheet content coordinates) falls within a column gap.
167
+ * @returns The column index that the gap precedes, or -1 if not in a gap.
168
+ */
169
+ getColGapAtPosition(x: number): number;
103
170
  private _generateRowMatrixCache;
104
171
  /**
105
172
  * Calc columnWidthAccumulation by columnData
@@ -233,18 +300,21 @@ export declare class SheetSkeleton extends Skeleton {
233
300
  * @param column
234
301
  * @param rowHeightAccumulation
235
302
  * @param columnWidthAccumulation
303
+ * @param rowGapSize Gap size (px) BEFORE this row. The cell startY is shifted by this amount.
304
+ * @param colGapSize Gap size (px) BEFORE this column. The cell startX is shifted by this amount.
236
305
  */
237
- export declare function getCellCoordByIndexSimple(row: number, column: number, rowHeightAccumulation: number[], columnWidthAccumulation: number[]): IPosition;
306
+ export declare function getCellCoordByIndexSimple(row: number, column: number, rowHeightAccumulation: number[], columnWidthAccumulation: number[], rowGapSize?: number, colGapSize?: number): IPosition;
238
307
  /**
239
308
  * @description Get the cell position information of the specified row and column, including the position of the cell and the merge info
240
309
  * @param {number} row The row index of the cell
241
310
  * @param {number} column The column index of the cell
242
311
  * @param {number[]} rowHeightAccumulation The accumulated height of each row
243
312
  * @param {number[]} columnWidthAccumulation The accumulated width of each column
244
- * @param {ICellInfo} mergeData The merge information of the cell
313
+ * @param {ICellInfo} mergeDataInfo The merge information of the cell
314
+ * @param {IGapSizeGetter} gapSizeGetter Optional getter for gap sizes before specific rows/columns
245
315
  * @returns {ICellWithCoord} The cell position information of the specified row and column, including the position information of the cell and the merge information of the cell
246
316
  */
247
- export declare function getCellWithCoordByIndexCore(row: number, column: number, rowHeightAccumulation: number[], columnWidthAccumulation: number[], mergeDataInfo: Nullable<ICellInfo>): ICellWithCoord;
317
+ export declare function getCellWithCoordByIndexCore(row: number, column: number, rowHeightAccumulation: number[], columnWidthAccumulation: number[], mergeDataInfo: Nullable<ICellInfo>, gapSizeGetter?: IGapSizeGetter): ICellWithCoord;
248
318
  /**
249
319
  * Get x in sheet coordinate. Already handled scrolling and zooming.
250
320
  * @param offsetX Offset value from PointerEvent in canvas element.
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { IKeyType, Nullable } from '../shared';
16
+ import type { Nullable } from '../shared';
17
17
  import type { IStyleData } from '../types/interfaces';
18
18
  import type { ICellDataForSheetInterceptor } from './typedef';
19
19
  /**
@@ -23,7 +23,7 @@ import type { ICellDataForSheetInterceptor } from './typedef';
23
23
  export declare class Styles {
24
24
  private _styles;
25
25
  private _cacheMap;
26
- constructor(styles?: IKeyType<Nullable<IStyleData>>);
26
+ constructor(styles?: Record<string, Nullable<IStyleData>>);
27
27
  each(callback: (value: [string, Nullable<IStyleData>], index: number, array: Array<[string, Nullable<IStyleData>]>) => void): this;
28
28
  search(data: IStyleData, styleObject: string): string;
29
29
  get(id: string | Nullable<IStyleData>): Nullable<IStyleData>;
@@ -31,7 +31,7 @@ export declare class Styles {
31
31
  setValue(data: Nullable<IStyleData>): Nullable<string>;
32
32
  addCustomStyle(id: string, data: Nullable<IStyleData>): void;
33
33
  remove(id: string): void;
34
- toJSON(): IKeyType<Nullable<IStyleData>>;
34
+ toJSON(): Record<string, Nullable<IStyleData>>;
35
35
  getStyleByCell(cell: Nullable<ICellDataForSheetInterceptor>): Nullable<IStyleData>;
36
36
  private _generateCacheMap;
37
37
  private _getExistingStyleId;
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { ISize } from '../../shared/shape';
17
- import type { IKeyType, Nullable } from '../../shared/types';
17
+ import type { Nullable } from '../../shared/types';
18
18
  import type { IWorksheetData } from '../../sheets/typedef';
19
19
  import type { LocaleType, ThemeColorType } from '../enum';
20
20
  import type { ShapeType } from '../enum/prst-geom-type';
@@ -114,7 +114,7 @@ export interface IPageElement {
114
114
  /** @deprecated */
115
115
  spreadsheet?: {
116
116
  worksheet: IWorksheetData;
117
- styles: IKeyType<Nullable<IStyleData>>;
117
+ styles: Record<string, Nullable<IStyleData>>;
118
118
  };
119
119
  /** @deprecated */
120
120
  document?: IDocumentData;