@univerjs/core 0.2.3 → 0.2.4

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.
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
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
+ export {};
@@ -14,3 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export declare function isLegalUrl(url: string): boolean;
17
+ export declare function normalizeUrl(urlStr: string): string;
@@ -2,6 +2,7 @@ import { Nullable } from '../../shared';
2
2
  import { IDocumentBody, IDocumentData, IDocumentRenderConfig, IDocumentStyle, IDrawings } from '../../types/interfaces/i-document-data';
3
3
  import { IPaddingData } from '../../types/interfaces/i-style-data';
4
4
  import { UnitModel, UniverInstanceType } from '../../common/unit';
5
+ import { SliceBodyType } from './text-x/utils';
5
6
  import { JSONXActions } from './json-x/json-x';
6
7
 
7
8
  export declare const DEFAULT_DOC: {
@@ -53,7 +54,7 @@ export declare class DocumentDataModel extends DocumentDataModelSimple {
53
54
  getSelfOrHeaderFooterModel(segmentId?: string): DocumentDataModel;
54
55
  getUnitId(): string;
55
56
  apply(actions: JSONXActions): IDocumentData | undefined;
56
- sliceBody(startOffset: number, endOffset: number): Nullable<IDocumentBody>;
57
+ sliceBody(startOffset: number, endOffset: number, type?: SliceBodyType): Nullable<IDocumentBody>;
57
58
  private _initializeHeaderFooterModel;
58
59
  updateDocumentId(unitId: string): void;
59
60
  }
@@ -1,36 +1,10 @@
1
- import { BulletAlignment, GlyphType } from '../../types/interfaces/i-document-data';
1
+ import { IListData } from '../../types/interfaces/i-document-data';
2
2
 
3
3
  export declare enum PresetListType {
4
4
  BULLET_LIST = "BULLET_LIST",
5
5
  ORDER_LIST = "ORDER_LIST"
6
6
  }
7
7
  export declare const PRESET_LIST_TYPE: {
8
- BULLET_LIST: {
9
- listType: PresetListType;
10
- nestingLevel: {
11
- bulletAlignment: BulletAlignment;
12
- glyphFormat: string;
13
- textStyle: {
14
- fs: number;
15
- };
16
- startNumber: number;
17
- glyphSymbol: string;
18
- hanging: number;
19
- indentStart: number;
20
- }[];
21
- };
22
- ORDER_LIST: {
23
- listType: PresetListType;
24
- nestingLevel: {
25
- bulletAlignment: BulletAlignment;
26
- glyphFormat: string;
27
- textStyle: {
28
- fs: number;
29
- };
30
- startNumber: number;
31
- glyphType: GlyphType;
32
- hanging: number;
33
- indentStart: number;
34
- }[];
35
- };
8
+ BULLET_LIST: IListData;
9
+ ORDER_LIST: IListData;
36
10
  };
@@ -16,6 +16,7 @@ export declare class TextX {
16
16
  insert(len: number, body: IDocumentBody, segmentId?: string): this;
17
17
  retain(len: number, segmentId?: string, body?: IDocumentBody, coverType?: UpdateDocsAttributeType): this;
18
18
  delete(len: number, segmentId?: string): this;
19
+ empty(): this;
19
20
  serialize(): TextXAction[];
20
21
  push(...args: TextXAction[]): this;
21
22
  protected trimEndUselessRetainAction(): this;
@@ -2,7 +2,11 @@ import { UpdateDocsAttributeType } from '../../../shared/command-enum';
2
2
  import { ICustomDecoration, IDocumentBody } from '../../../types/interfaces/i-document-data';
3
3
  import { IRetainAction } from './action-types';
4
4
 
5
- export declare function getBodySlice(body: IDocumentBody, startOffset: number, endOffset: number, returnEmptyTextRun?: boolean): IDocumentBody;
5
+ export declare enum SliceBodyType {
6
+ copy = 0,
7
+ cut = 1
8
+ }
9
+ export declare function getBodySlice(body: IDocumentBody, startOffset: number, endOffset: number, returnEmptyTextRun?: boolean, type?: SliceBodyType): IDocumentBody;
6
10
  export declare function normalizeBody(body: IDocumentBody): IDocumentBody;
7
11
  export declare function getCustomRangeSlice(body: IDocumentBody, startOffset: number, endOffset: number): {
8
12
  customRanges: {
@@ -10,6 +14,7 @@ export declare function getCustomRangeSlice(body: IDocumentBody, startOffset: nu
10
14
  endIndex: number;
11
15
  rangeId: string;
12
16
  rangeType: import('../../../types/interfaces/i-document-data').CustomRangeType;
17
+ wholeEntity?: boolean;
13
18
  }[];
14
19
  leftOffset: number;
15
20
  rightOffset: number;
@@ -31,7 +31,7 @@ export * from './docs/data-model';
31
31
  export { TextXActionType, type TextXAction, type IDeleteAction, type IInsertAction, type IRetainAction, } from './docs/data-model/text-x/action-types';
32
32
  export { DataValidationRenderMode } from './types/enum/data-validation-render-mode';
33
33
  export { ActionIterator } from './docs/data-model/text-x/action-iterator';
34
- export { getBodySlice, composeBody } from './docs/data-model/text-x/utils';
34
+ export { getBodySlice, composeBody, SliceBodyType } from './docs/data-model/text-x/utils';
35
35
  export { TextX } from './docs/data-model/text-x/text-x';
36
36
  export type { TPriority } from './docs/data-model/text-x/text-x';
37
37
  export { JSONX, JSON1 } from './docs/data-model/json-x/json-x';
@@ -11,6 +11,7 @@ export declare class AuthzIoLocalService implements IAuthzIoService {
11
11
  private _userManagerService;
12
12
  private _permissionMap;
13
13
  constructor(_resourceManagerService: IResourceManagerService, _userManagerService: UserManagerService);
14
+ private _initDefaultUser;
14
15
  private _getRole;
15
16
  private _initSnapshot;
16
17
  create(config: ICreateRequest): Promise<string>;
@@ -39,4 +39,5 @@ export declare class UserManagerService {
39
39
  getUser<T extends IUser>(userId: string, callBack?: () => void): T | undefined;
40
40
  delete(userId: string): void;
41
41
  clear(): void;
42
+ list(): IUser[];
42
43
  }
@@ -26,4 +26,11 @@ export declare class RxDisposable extends Disposable implements IDisposable {
26
26
  protected dispose$: Subject<void>;
27
27
  dispose(): void;
28
28
  }
29
+ export declare class RCDisposable extends Disposable {
30
+ private readonly _rootDisposable;
31
+ private _ref;
32
+ constructor(_rootDisposable: IDisposable);
33
+ inc(): void;
34
+ dec(): void;
35
+ }
29
36
  export {};
@@ -9,6 +9,11 @@ export declare class Tools {
9
9
  static deleteBlank(value?: string): string | undefined;
10
10
  static getSystemType(): string;
11
11
  static getBrowserType(): string;
12
+ /**
13
+ * Use this method without `Tools`.
14
+ *
15
+ * @deprecated
16
+ */
12
17
  static generateRandomId(n?: number, alphabet?: string): string;
13
18
  static getClassName(instance: object): string;
14
19
  static deepMerge(target: any, ...sources: any[]): any;
@@ -37,6 +42,7 @@ export declare class Tools {
37
42
  static isAndroid(): boolean;
38
43
  static isIPhone(): boolean;
39
44
  static isLegalUrl(url: string): boolean;
45
+ static normalizeUrl(url: string): string;
40
46
  static itCount(count: number): Function;
41
47
  static hasLength(target: IArguments | any[] | string, length?: number): boolean;
42
48
  static capitalize(str: string): string;
@@ -108,3 +114,4 @@ export declare class Tools {
108
114
  static set(data: Record<string, any>, propertyPath: string, value: any): void;
109
115
  static clamp(value: number, min: number, max: number): number;
110
116
  }
117
+ export declare function generateRandomId(n?: number, alphabet?: string): string;
@@ -0,0 +1,10 @@
1
+ import { ICustomDecoration, ICustomRange } from './i-document-data';
2
+
3
+ export interface ICustomRangeForInterceptor extends ICustomRange {
4
+ active?: boolean;
5
+ show?: boolean;
6
+ }
7
+ export interface ICustomDecorationForInterceptor extends ICustomDecoration {
8
+ active?: boolean;
9
+ show?: boolean;
10
+ }
@@ -30,6 +30,7 @@ export interface IReferenceSource {
30
30
  lists?: ILists;
31
31
  drawings?: IDrawings;
32
32
  drawingsOrder?: string[];
33
+ headerFooterDrawingsOrder?: string[];
33
34
  }
34
35
  export interface IDocumentSettings {
35
36
  zoomRatio?: number;
@@ -99,6 +100,11 @@ export interface IDocumentBody {
99
100
  tables?: ITable[];
100
101
  customRanges?: ICustomRange[];
101
102
  customDecorations?: ICustomDecoration[];
103
+ /**
104
+ * for copy/paste, data of custom-range and other module
105
+ * it won't save to disk
106
+ */
107
+ payloads?: Record<string, string>;
102
108
  }
103
109
  export interface IDocStyle {
104
110
  name: string;
@@ -202,15 +208,14 @@ export interface ICustomRange {
202
208
  endIndex: number;
203
209
  rangeId: string;
204
210
  rangeType: CustomRangeType;
211
+ /**
212
+ * display as a whole-entity
213
+ */
214
+ wholeEntity?: boolean;
205
215
  }
206
- export interface ICustomRangeForInterceptor extends ICustomRange {
207
- active?: boolean;
208
- show?: boolean;
209
- }
210
- export interface ICustomDecorationForInterceptor extends ICustomDecoration {
211
- active?: boolean;
212
- show?: boolean;
213
- }
216
+ /**
217
+ * @deprecated
218
+ */
214
219
  export declare enum CustomRangeType {
215
220
  HYPERLINK = 0,
216
221
  FIELD = 1,// 17.16 Fields and Hyperlinks
@@ -218,7 +223,8 @@ export declare enum CustomRangeType {
218
223
  BOOKMARK = 3,
219
224
  COMMENT = 4,
220
225
  CUSTOM = 5,
221
- MENTION = 6
226
+ MENTION = 6,
227
+ UNI_FORMULA = 7
222
228
  }
223
229
  /**
224
230
  * Custom Block
@@ -271,9 +277,6 @@ export interface IDocStyleBase extends IMargin {
271
277
  renderConfig?: IDocumentRenderConfig;
272
278
  }
273
279
  export interface IDocumentLayout {
274
- charSpace?: number;
275
- linePitch?: number;
276
- gridType?: GridType;
277
280
  defaultTabStop?: number;
278
281
  characterSpacingControl?: characterSpacingControlType;
279
282
  paragraphLineGapDefault?: number;
@@ -317,6 +320,9 @@ export interface IDocumentRenderConfig {
317
320
  isRenderStyle?: BooleanNumber;
318
321
  }
319
322
  export interface ISectionBreakBase {
323
+ charSpace?: number;
324
+ linePitch?: number;
325
+ gridType?: GridType;
320
326
  columnProperties?: ISectionColumnProperties[];
321
327
  columnSeparatorType?: ColumnSeparatorType;
322
328
  contentDirection?: TextDirection;
@@ -458,9 +464,9 @@ export interface ITextStyle extends IStyleBase {
458
464
  sa?: number;
459
465
  }
460
466
  export interface IIndentStart {
461
- indentFirstLine?: INumberUnit | number;
462
- hanging?: INumberUnit | number;
463
- indentStart?: INumberUnit | number;
467
+ indentFirstLine?: INumberUnit;
468
+ hanging?: INumberUnit;
469
+ indentStart?: INumberUnit;
464
470
  tabStops?: ITabStop[];
465
471
  }
466
472
  /**
@@ -474,14 +480,14 @@ export interface IParagraphStyle extends IIndentStart {
474
480
  direction?: TextDirection;
475
481
  spacingRule?: SpacingRule;
476
482
  snapToGrid?: BooleanNumber;
477
- spaceAbove?: INumberUnit | number;
478
- spaceBelow?: INumberUnit | number;
483
+ spaceAbove?: INumberUnit;
484
+ spaceBelow?: INumberUnit;
479
485
  borderBetween?: IParagraphBorder;
480
486
  borderTop?: IParagraphBorder;
481
487
  borderBottom?: IParagraphBorder;
482
488
  borderLeft?: IParagraphBorder;
483
489
  borderRight?: IParagraphBorder;
484
- indentEnd?: INumberUnit | number;
490
+ indentEnd?: INumberUnit;
485
491
  keepLines?: BooleanNumber;
486
492
  keepNext?: BooleanNumber;
487
493
  wordWrap?: BooleanNumber;
@@ -639,7 +645,7 @@ export declare enum FontStyleType {
639
645
  }
640
646
  export interface INumberUnit {
641
647
  v: number;
642
- u: NumberUnitType;
648
+ u?: NumberUnitType;
643
649
  }
644
650
  export interface IObjectPositionH {
645
651
  relativeFrom: ObjectRelativeFromH;
@@ -676,14 +682,17 @@ export declare enum ObjectRelativeFromV {
676
682
  export declare enum NumberUnitType {
677
683
  POINT = 0,
678
684
  LINE = 1,
679
- CHARACTER = 2
685
+ CHARACTER = 2,
686
+ PIXEL = 3
680
687
  }
681
688
  export declare enum AlignTypeH {
682
689
  CENTER = 0,
683
690
  INSIDE = 1,
684
691
  LEFT = 2,
685
692
  OUTSIDE = 3,
686
- RIGHT = 4
693
+ RIGHT = 4,
694
+ BOTH = 5,
695
+ DISTRIBUTE = 6
687
696
  }
688
697
  export declare enum AlignTypeV {
689
698
  BOTTOM = 0,
@@ -750,5 +759,7 @@ export interface ITransformState extends IAbsoluteTransform, IRotationSkewFlipTr
750
759
  export interface IDrawingParam extends IDrawingSearch {
751
760
  drawingType: DrawingType;
752
761
  transform?: Nullable<ITransformState>;
762
+ transforms?: Nullable<ITransformState[]>;
763
+ isMultiTransform?: BooleanNumber;
753
764
  groupId?: string;
754
765
  }
@@ -31,7 +31,19 @@ export declare enum AbsoluteRefType {
31
31
  COLUMN = 2,
32
32
  ALL = 3
33
33
  }
34
- export interface IRowRange {
34
+ interface IRangeLocation {
35
+ /**
36
+ * Id of the Workbook the range belongs to.
37
+ * When this field is not defined, it should be considered as the range in the currently activated worksheet.
38
+ */
39
+ unitId?: string;
40
+ /**
41
+ * Id of the Worksheet the range belongs to.
42
+ * When this field is not defined, it should be considered as the range in the currently activated worksheet.
43
+ */
44
+ sheetId?: string;
45
+ }
46
+ export interface IRowRange extends IRangeLocation {
35
47
  /**
36
48
  * The start row (inclusive) of the range
37
49
  * startRow
@@ -43,7 +55,7 @@ export interface IRowRange {
43
55
  */
44
56
  endRow: number;
45
57
  }
46
- export interface IColumnRange {
58
+ export interface IColumnRange extends IRangeLocation {
47
59
  /**
48
60
  * The start column (inclusive) of the range
49
61
  * startColumn
@@ -193,3 +205,4 @@ export interface IRectLTRB {
193
205
  width?: number;
194
206
  height?: number;
195
207
  }
208
+ export {};
@@ -16,6 +16,7 @@
16
16
  export * from './i-cell-data';
17
17
  export * from './i-column-data';
18
18
  export * from './i-document-data';
19
+ export * from './i-document-data-interceptor';
19
20
  export * from './i-freeze';
20
21
  export * from './i-image-properties';
21
22
  export * from './i-placeholder';