@univerjs/core 0.1.12 → 0.1.13

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.
Files changed (50) hide show
  1. package/lib/cjs/index.js +9 -9
  2. package/lib/es/index.js +5370 -3723
  3. package/lib/types/docs/data-model/document-data-model.d.ts +10 -12
  4. package/lib/types/docs/data-model/json-x/json-x.d.ts +38 -0
  5. package/lib/types/{shared/permission/index.d.ts → docs/data-model/subdocument.d.ts} +1 -12
  6. package/lib/types/docs/data-model/text-x/__tests__/common.spec.d.ts +16 -0
  7. package/lib/types/docs/data-model/text-x/__tests__/invert.spec.d.ts +16 -0
  8. package/lib/types/docs/data-model/text-x/action-iterator.d.ts +1 -1
  9. package/lib/types/docs/data-model/{action-types.d.ts → text-x/action-types.d.ts} +4 -2
  10. package/lib/types/docs/data-model/{apply-utils → text-x/apply-utils}/common.d.ts +1 -1
  11. package/lib/types/docs/data-model/{apply-utils → text-x/apply-utils}/delete-apply.d.ts +1 -1
  12. package/lib/types/docs/data-model/{apply-utils → text-x/apply-utils}/insert-apply.d.ts +1 -1
  13. package/lib/types/docs/data-model/{apply-utils → text-x/apply-utils}/update-apply.d.ts +2 -2
  14. package/lib/types/docs/data-model/text-x/apply.d.ts +4 -0
  15. package/lib/types/docs/data-model/text-x/text-x.d.ts +10 -2
  16. package/lib/types/docs/data-model/text-x/utils.d.ts +2 -2
  17. package/lib/types/index.d.ts +13 -5
  18. package/lib/types/observer/__tests__/observable.spec.d.ts +16 -0
  19. package/lib/types/observer/observable.d.ts +1 -20
  20. package/lib/types/services/__test__/index.d.ts +18 -0
  21. package/lib/types/services/__test__/permission.spec.d.ts +16 -0
  22. package/lib/types/services/authz-io/authz-io-local.service.d.ts +30 -0
  23. package/lib/types/services/authz-io/type.d.ts +20 -0
  24. package/lib/types/services/context/context.d.ts +4 -0
  25. package/lib/types/services/permission/permission.service.d.ts +12 -24
  26. package/lib/types/services/permission/type.d.ts +43 -0
  27. package/lib/types/services/user-manager/const.d.ts +4 -0
  28. package/lib/types/services/{permission → user-manager}/index.d.ts +1 -3
  29. package/lib/types/services/user-manager/user-manager.service.d.ts +7 -4
  30. package/lib/types/shared/check-if-move.d.ts +6 -0
  31. package/lib/types/shared/index.d.ts +2 -1
  32. package/lib/types/shared/rectangle.d.ts +12 -0
  33. package/lib/types/{services/floating-object/floating-object-interfaces.d.ts → shared/shape.d.ts} +5 -6
  34. package/lib/types/sheets/sheet-snapshot-utils.d.ts +2 -2
  35. package/lib/types/sheets/workbook.d.ts +6 -3
  36. package/lib/types/slides/slide-model.d.ts +1 -1
  37. package/lib/types/types/enum/index.d.ts +1 -1
  38. package/lib/types/types/enum/prst-geom-type.d.ts +118 -0
  39. package/lib/types/types/interfaces/i-cell-data.d.ts +1 -0
  40. package/lib/types/types/interfaces/i-cell-validation-data.d.ts +1 -0
  41. package/lib/types/types/interfaces/i-document-data.d.ts +56 -6
  42. package/lib/types/types/interfaces/i-slide-data.d.ts +3 -3
  43. package/lib/umd/index.js +8 -8
  44. package/package.json +6 -6
  45. package/lib/types/services/floating-object/floating-object-manager.service.d.ts +0 -82
  46. package/lib/types/services/permission/permission-point.d.ts +0 -9
  47. package/lib/types/services/permission/univer.permission.service.d.ts +0 -12
  48. package/lib/types/types/enum/shape-type.d.ts +0 -160
  49. /package/lib/types/docs/data-model/{__tests__/apply-utils.spec.d.ts → json-x/__tests__/json-x.spec.d.ts} +0 -0
  50. /package/lib/types/docs/data-model/{__tests__/common.spec.d.ts → text-x/__tests__/apply-utils.spec.d.ts} +0 -0
@@ -12,10 +12,22 @@ export declare class Rectangle {
12
12
  static contains(src: IRange, target: IRange): boolean;
13
13
  static realContain(src: IRange, target: IRange): boolean;
14
14
  static union(...ranges: IRange[]): IRange;
15
+ static realUnion(...ranges: IRange[]): IRange;
15
16
  static getRelativeRange: (range: IRange, originRange: IRange) => IRange;
16
17
  static getPositionRange: (relativeRange: IRange, originRange: IRange, absoluteRange?: IRange) => IRange;
17
18
  static moveHorizontal: (range: IRange, step?: number, length?: number) => IRange;
18
19
  static moveVertical: (range: IRange, step?: number, length?: number) => IRange;
19
20
  static moveOffset: (range: IRange, offsetX: number, offsetY: number) => IRange;
20
21
  static subtract(range1: IRange, range2: IRange): IRange[];
22
+ static hasIntersectionBetweenTwoBounds(rect1: {
23
+ left: number;
24
+ top: number;
25
+ right: number;
26
+ bottom: number;
27
+ }, rect2: {
28
+ left: number;
29
+ top: number;
30
+ right: number;
31
+ bottom: number;
32
+ }): boolean;
21
33
  }
@@ -25,10 +25,9 @@ export interface IOffset {
25
25
  left?: number;
26
26
  top?: number;
27
27
  }
28
- export interface ITransformState extends IOffset, ISize, IScale {
29
- angle?: number;
30
- skewX?: number;
31
- skewY?: number;
32
- flipX?: boolean;
33
- flipY?: boolean;
28
+ export interface ISrcRect extends IOffset {
29
+ right?: number;
30
+ bottom?: number;
31
+ }
32
+ export interface IAbsoluteTransform extends ISize, IOffset, IScale {
34
33
  }
@@ -5,9 +5,9 @@ export declare const DEFAULT_WORKSHEET_ROW_COUNT = 1000;
5
5
  export declare const DEFAULT_WORKSHEET_COLUMN_COUNT_KEY = "DEFAULT_WORKSHEET_COLUMN_COUNT";
6
6
  export declare const DEFAULT_WORKSHEET_COLUMN_COUNT = 20;
7
7
  export declare const DEFAULT_WORKSHEET_ROW_HEIGHT_KEY = "DEFAULT_WORKSHEET_ROW_HEIGHT";
8
- export declare const DEFAULT_WORKSHEET_ROW_HEIGHT = 19;
8
+ export declare const DEFAULT_WORKSHEET_ROW_HEIGHT = 24;
9
9
  export declare const DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY = "DEFAULT_WORKSHEET_COLUMN_WIDTH";
10
- export declare const DEFAULT_WORKSHEET_COLUMN_WIDTH = 73;
10
+ export declare const DEFAULT_WORKSHEET_COLUMN_WIDTH = 88;
11
11
  export declare const DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY = "DEFAULT_WORKSHEET_ROW_TITLE_WIDTH";
12
12
  export declare const DEFAULT_WORKSHEET_ROW_TITLE_WIDTH = 46;
13
13
  export declare const DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY = "DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT";
@@ -1,3 +1,4 @@
1
+ import { Observable } from 'rxjs';
1
2
  import { ILogService } from '../services/log/log.service';
2
3
  import { Nullable } from '../shared';
3
4
  import { IGridRange, IRangeType, IWorkbookData, IWorksheetData } from '../types/interfaces';
@@ -13,12 +14,12 @@ export declare class Workbook extends UnitModel<IWorkbookData, UniverInstanceTyp
13
14
  private readonly _logService;
14
15
  type: UniverInstanceType.UNIVER_SHEET;
15
16
  private readonly _sheetCreated$;
16
- readonly sheetCreated$: import('rxjs').Observable<Worksheet>;
17
+ readonly sheetCreated$: Observable<Worksheet>;
17
18
  private readonly _sheetDisposed$;
18
- readonly sheetDisposed$: import('rxjs').Observable<Worksheet>;
19
+ readonly sheetDisposed$: Observable<Worksheet>;
19
20
  private readonly _activeSheet$;
20
21
  private get _activeSheet();
21
- readonly activeSheet$: import('rxjs').Observable<Nullable<Worksheet>>;
22
+ readonly activeSheet$: Observable<Nullable<Worksheet>>;
22
23
  /**
23
24
  * sheets list
24
25
  * @private
@@ -36,6 +37,8 @@ export declare class Workbook extends UnitModel<IWorkbookData, UniverInstanceTyp
36
37
  private _snapshot;
37
38
  private _unitId;
38
39
  private _count;
40
+ private readonly _name$;
41
+ readonly name$: Observable<string>;
39
42
  get name(): string;
40
43
  constructor(workbookData: Partial<IWorkbookData> | undefined, _logService: ILogService);
41
44
  dispose(): void;
@@ -18,6 +18,6 @@ export declare class SlideDataModel extends UnitModel<ISlideData, UniverInstance
18
18
  [elementId: string]: import('../types/interfaces').IPageElement;
19
19
  } | undefined;
20
20
  getElement(pageId: string, elementId: string): import('../types/interfaces').IPageElement | undefined;
21
- getPageSize(): import('..').ISize;
21
+ getPageSize(): import('../shared').ISize;
22
22
  addPage(): ISlidePage;
23
23
  }
@@ -26,7 +26,7 @@ export * from './interpolation-point-type';
26
26
  export * from './locale-type';
27
27
  export * from './protection-type';
28
28
  export * from './relative-date';
29
- export * from './shape-type';
30
29
  export * from './sheet-types';
31
30
  export * from './text-style';
32
31
  export * from './theme-color-type';
32
+ export * from './prst-geom-type';
@@ -0,0 +1,118 @@
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 declare enum BasicShapes {
17
+ Line = "line",
18
+ LineInv = "lineInv",
19
+ Triangle = "triangle",
20
+ RtTriangle = "rtTriangle",
21
+ Rect = "rect",
22
+ Diamond = "diamond",
23
+ Parallelogram = "parallelogram",
24
+ Trapezoid = "trapezoid",
25
+ NonIsocelesTrapezoid = "nonIsocelesTrapezoid",
26
+ Pentagon = "pentagon",
27
+ Hexagon = "hexagon",
28
+ Heptagon = "heptagon",
29
+ Octagon = "octagon",
30
+ Decagon = "decagon",
31
+ Dodecagon = "dodecagon",
32
+ Star4 = "star4",
33
+ Star5 = "star5",
34
+ Star6 = "star6",
35
+ Star7 = "star7",
36
+ Star8 = "star8",
37
+ Star10 = "star10",
38
+ Star12 = "star12",
39
+ Star16 = "star16",
40
+ Star24 = "star24",
41
+ Star32 = "star32",
42
+ RoundRect = "roundRect",
43
+ Round1Rect = "round1Rect",
44
+ Round2SameRect = "round2SameRect",
45
+ Round2DiagRect = "round2DiagRect",
46
+ Ellipse = "ellipse"
47
+ }
48
+ export declare enum ArrowsAndMarkersShapes {
49
+ RightArrow = "rightArrow",
50
+ LeftArrow = "leftArrow",
51
+ UpArrow = "upArrow",
52
+ DownArrow = "downArrow",
53
+ LeftRightArrow = "leftRightArrow",
54
+ UpDownArrow = "upDownArrow",
55
+ QuadArrow = "quadArrow",
56
+ LeftRightUpArrow = "leftRightUpArrow",
57
+ BentArrow = "bentArrow",
58
+ UturnArrow = "uturnArrow",
59
+ CircularArrow = "circularArrow",
60
+ NotchedRightArrow = "notchedRightArrow",
61
+ HomePlate = "homePlate",
62
+ Chevron = "chevron",
63
+ LeftCircularArrow = "leftCircularArrow",
64
+ LeftRightCircularArrow = "leftRightCircularArrow"
65
+ }
66
+ export declare enum OtherShapes {
67
+ Plaque = "plaque",
68
+ Can = "can",
69
+ Cube = "cube",
70
+ Bevel = "bevel",
71
+ Donut = "donut",
72
+ NoSmoking = "noSmoking",
73
+ BlockArc = "blockArc",
74
+ FoldedCorner = "foldedCorner"
75
+ }
76
+ export declare enum SpecialShapes {
77
+ SmileyFace = "smileyFace",
78
+ Heart = "heart",
79
+ LightningBolt = "lightningBolt",
80
+ Sun = "sun",
81
+ Moon = "moon",
82
+ Cloud = "cloud",
83
+ Arc = "arc",
84
+ Backpack = "backpack",
85
+ Frame = "frame",
86
+ HalfFrame = "halfFrame",
87
+ Corner = "corner",
88
+ Chord = "chord",
89
+ Pie = "pie",
90
+ Teardrop = "teardrop",
91
+ WedgeRectCallout = "wedgeRectCallout",
92
+ WedgeRRectCallout = "wedgeRRectCallout",
93
+ WedgeEllipseCallout = "wedgeEllipseCallout",
94
+ CloudCallout = "cloudCallout",
95
+ BorderCallout1 = "borderCallout1",
96
+ BorderCallout2 = "borderCallout2",
97
+ BorderCallout3 = "borderCallout3",
98
+ AccentCallout1 = "accentCallout1",
99
+ AccentCallout2 = "accentCallout2",
100
+ AccentCallout3 = "accentCallout3",
101
+ Callout1 = "callout1",
102
+ Callout2 = "callout2",
103
+ Callout3 = "callout3",
104
+ ActionButtonBackPrevious = "actionButtonBackPrevious",
105
+ ActionButtonEnd = "actionButtonEnd",
106
+ ActionButtonForwardNext = "actionButtonForwardNext",
107
+ ActionButtonHelp = "actionButtonHelp",
108
+ ActionButtonHome = "actionButtonHome",
109
+ ActionButtonInformation = "actionButtonInformation",
110
+ ActionButtonMovie = "actionButtonMovie",
111
+ ActionButtonReturn = "actionButtonReturn",
112
+ ActionButtonSound = "actionButtonSound"
113
+ }
114
+ /**
115
+ * 20.1.9.18 prstGeom (Preset geometry)
116
+ */
117
+ export type ShapeType = BasicShapes | ArrowsAndMarkersShapes | OtherShapes | SpecialShapes;
118
+ export type PresetGeometryType = ShapeType | 'custom';
@@ -47,6 +47,7 @@ export interface ICellMarks {
47
47
  tr?: ICellMarksStyle;
48
48
  bl?: ICellMarksStyle;
49
49
  br?: ICellMarksStyle;
50
+ isSkip?: boolean;
50
51
  }
51
52
  export interface ICellDataForSheetInterceptor extends ICellData {
52
53
  interceptorStyle?: Nullable<IStyleData>;
@@ -6,4 +6,5 @@ export interface ICellValidationData {
6
6
  validStatus: DataValidationStatus;
7
7
  rule: IDataValidationRule;
8
8
  validator: any;
9
+ isSkip?: boolean;
9
10
  }
@@ -1,4 +1,5 @@
1
- import { ISize } from '../../services/floating-object/floating-object-interfaces';
1
+ import { Nullable } from '../../common/type-util';
2
+ import { IAbsoluteTransform, ISize } from '../../shared/shape';
2
3
  import { BooleanNumber, CellValueType, HorizontalAlign, LocaleType, TextDirection, VerticalAlign, WrapStrategy } from '../enum';
3
4
  import { IExtraModelData } from './i-extra-model-data';
4
5
  import { IColorStyle, IStyleBase } from './i-style-data';
@@ -28,6 +29,7 @@ export interface IReferenceSource {
28
29
  headers?: IHeaders;
29
30
  lists?: ILists;
30
31
  drawings?: IDrawings;
32
+ drawingsOrder?: string[];
31
33
  }
32
34
  export interface IDocumentSettings {
33
35
  zoomRatio?: number;
@@ -54,7 +56,7 @@ export interface ILists {
54
56
  * Set of Drawings
55
57
  */
56
58
  export interface IDrawings {
57
- [objectId: string]: IDrawing;
59
+ [drawingId: string]: IDocDrawingBase;
58
60
  }
59
61
  /**
60
62
  * Set of IStyles
@@ -373,11 +375,11 @@ export interface IBullet {
373
375
  * 20.4.2.19 wrapTight (Tight Wrapping)
374
376
  * 20.4.2.20 wrapTopAndBottom (Top and Bottom Wrapping)
375
377
  */
376
- export interface IDrawing {
377
- objectId: string;
378
+ export interface IDocDrawingBase extends IDrawingParam {
379
+ drawingId: string;
378
380
  title: string;
379
381
  description: string;
380
- objectTransform: IObjectTransform;
382
+ docTransform: IDocDrawingPosition;
381
383
  layoutType: PositionedObjectLayoutType;
382
384
  behindDoc?: BooleanNumber;
383
385
  start?: number[];
@@ -412,7 +414,7 @@ export declare enum PositionedObjectLayoutType {
412
414
  /**
413
415
  * Properties of a draw object
414
416
  */
415
- export interface IObjectTransform {
417
+ export interface IDocDrawingPosition {
416
418
  size: ISize;
417
419
  positionH: IObjectPositionH;
418
420
  positionV: IObjectPositionV;
@@ -678,3 +680,51 @@ export declare enum PageOrientType {
678
680
  PORTRAIT = 0,
679
681
  LANDSCAPE = 1
680
682
  }
683
+ /** @deprecated */
684
+ export declare enum ArrangeTypeEnum {
685
+ forward = 0,
686
+ backward = 1,
687
+ front = 2,
688
+ back = 3
689
+ }
690
+ /** @deprecated */
691
+ export declare enum DrawingTypeEnum {
692
+ UNRECOGNIZED = -1,
693
+ DRAWING_IMAGE = 0,
694
+ DRAWING_SHAPE = 1,
695
+ DRAWING_CHART = 2,
696
+ DRAWING_TABLE = 3,
697
+ DRAWING_SMART_ART = 4,
698
+ DRAWING_VIDEO = 5,
699
+ DRAWING_GROUP = 6,
700
+ DRAWING_UNIT = 7,
701
+ DRAWING_DOM = 8
702
+ }
703
+ /** @deprecated */
704
+ export type DrawingType = DrawingTypeEnum | number;
705
+ /** @deprecated */
706
+ export interface IDrawingSpace {
707
+ unitId: string;
708
+ subUnitId: string;
709
+ }
710
+ /** @deprecated */
711
+ export interface IDrawingSearch extends IDrawingSpace {
712
+ drawingId: string;
713
+ }
714
+ /** @deprecated */
715
+ export interface IRotationSkewFlipTransform {
716
+ angle?: number;
717
+ skewX?: number;
718
+ skewY?: number;
719
+ flipX?: boolean;
720
+ flipY?: boolean;
721
+ }
722
+ /** @deprecated */
723
+ export interface ITransformState extends IAbsoluteTransform, IRotationSkewFlipTransform {
724
+ }
725
+ /** @deprecated */
726
+ export interface IDrawingParam extends IDrawingSearch {
727
+ drawingType: DrawingType;
728
+ transform?: Nullable<ITransformState>;
729
+ groupId?: string;
730
+ }
@@ -1,8 +1,8 @@
1
- import { ISize, ITransformState } from '../../services/floating-object/floating-object-interfaces';
1
+ import { ISize } from '../../shared/shape';
2
2
  import { IKeyType, Nullable } from '../../shared/types';
3
3
  import { LocaleType, ThemeColorType } from '../enum';
4
- import { ShapeType } from '../enum/shape-type';
5
- import { ICustomBlock, IDocumentData, ILists } from './i-document-data';
4
+ import { ShapeType } from '../enum/prst-geom-type';
5
+ import { ICustomBlock, IDocumentData, ILists, ITransformState } from './i-document-data';
6
6
  import { IExtraModelData } from './i-extra-model-data';
7
7
  import { IImageProperties } from './i-image-properties';
8
8
  import { IPlaceholder } from './i-placeholder';