@univerjs/core 1.3.1 → 1.4.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.
Files changed (34) hide show
  1. package/lib/cjs/facade.js +15 -30
  2. package/lib/cjs/index.js +398 -577
  3. package/lib/es/facade.js +15 -30
  4. package/lib/es/index.js +398 -578
  5. package/lib/facade.js +15 -30
  6. package/lib/index.js +398 -578
  7. package/lib/types/bases/typedef.d.ts +25 -25
  8. package/lib/types/common/regexp/index.d.ts +4 -4
  9. package/lib/types/docs/data-model/paragraph-style.d.ts +5 -2
  10. package/lib/types/docs/data-model/preset-list-type.d.ts +8 -8
  11. package/lib/types/docs/data-model/rich-text-builder.d.ts +1 -1
  12. package/lib/types/docs/data-model/text-x/build-utils/custom-range.d.ts +1 -1
  13. package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +15 -13
  14. package/lib/types/docs/data-model/text-x/utils.d.ts +20 -20
  15. package/lib/types/index.d.ts +1 -0
  16. package/lib/types/services/lifecycle/lifecycle.d.ts +4 -4
  17. package/lib/types/services/resource-loader/type.d.ts +2 -2
  18. package/lib/types/services/user-manager/user-manager.service.d.ts +2 -2
  19. package/lib/types/shared/common.d.ts +1 -0
  20. package/lib/types/shared/r-tree.d.ts +3 -1
  21. package/lib/types/shared/sort-rules.d.ts +2 -2
  22. package/lib/types/sheets/sheet-skeleton.d.ts +12 -4
  23. package/lib/types/types/interfaces/i-document-data.d.ts +1 -5
  24. package/lib/types/types/interfaces/i-drawing.d.ts +3 -1
  25. package/lib/types/types/interfaces/index.d.ts +0 -3
  26. package/lib/types/univer.d.ts +1 -1
  27. package/lib/umd/facade.js +1 -1
  28. package/lib/umd/index.js +26 -26
  29. package/package.json +8 -8
  30. package/lib/types/slides/slide-data-model.d.ts +0 -27
  31. package/lib/types/types/enum/place-holder-type.d.ts +0 -34
  32. package/lib/types/types/interfaces/i-image-properties.d.ts +0 -34
  33. package/lib/types/types/interfaces/i-placeholder.d.ts +0 -21
  34. package/lib/types/types/interfaces/i-shape-properties.d.ts +0 -30
@@ -148,11 +148,11 @@ export type BaseDateHourCycle = 'h12' | 'h24';
148
148
  /** Where a Base conditional color is painted when its condition matches. */
149
149
  export declare const BaseConditionalColorTarget: {
150
150
  /** Paint only the cell in the rule's field. */
151
- readonly CELL: "cell";
151
+ readonly CELL: 'cell';
152
152
  /** Paint the complete record row. */
153
- readonly ROW: "row";
153
+ readonly ROW: 'row';
154
154
  /** Paint the rule's field column unconditionally; operator, operand, and date mode are ignored. */
155
- readonly COLUMN: "column";
155
+ readonly COLUMN: 'column';
156
156
  };
157
157
  export type BaseConditionalColorTarget = typeof BaseConditionalColorTarget[keyof typeof BaseConditionalColorTarget];
158
158
  /**
@@ -164,16 +164,16 @@ export type BaseConditionalColorTarget = typeof BaseConditionalColorTarget[keyof
164
164
  * before/after, and empty checks. Checkbox fields support equality only.
165
165
  */
166
166
  export declare const BaseConditionalColorOperator: {
167
- readonly IS: "is";
168
- readonly IS_NOT: "isNot";
169
- readonly CONTAINS: "contains";
170
- readonly NOT_CONTAINS: "notContains";
171
- readonly IS_EMPTY: "isEmpty";
172
- readonly IS_NOT_EMPTY: "isNotEmpty";
173
- readonly GREATER_THAN: "greaterThan";
174
- readonly LESS_THAN: "lessThan";
175
- readonly BEFORE: "before";
176
- readonly AFTER: "after";
167
+ readonly IS: 'is';
168
+ readonly IS_NOT: 'isNot';
169
+ readonly CONTAINS: 'contains';
170
+ readonly NOT_CONTAINS: 'notContains';
171
+ readonly IS_EMPTY: 'isEmpty';
172
+ readonly IS_NOT_EMPTY: 'isNotEmpty';
173
+ readonly GREATER_THAN: 'greaterThan';
174
+ readonly LESS_THAN: 'lessThan';
175
+ readonly BEFORE: 'before';
176
+ readonly AFTER: 'after';
177
177
  };
178
178
  export type BaseConditionalColorOperator = typeof BaseConditionalColorOperator[keyof typeof BaseConditionalColorOperator];
179
179
  /**
@@ -184,18 +184,18 @@ export type BaseConditionalColorOperator = typeof BaseConditionalColorOperator[k
184
184
  * dates after its end. Relative windows do not use an operand; `EXACT` does.
185
185
  */
186
186
  export declare const BaseConditionalDateMode: {
187
- readonly EXACT: "exact";
188
- readonly TODAY: "today";
189
- readonly TOMORROW: "tomorrow";
190
- readonly YESTERDAY: "yesterday";
191
- readonly THIS_WEEK: "thisWeek";
192
- readonly LAST_WEEK: "lastWeek";
193
- readonly THIS_MONTH: "thisMonth";
194
- readonly LAST_MONTH: "lastMonth";
195
- readonly PAST_7_DAYS: "past7";
196
- readonly NEXT_7_DAYS: "next7";
197
- readonly PAST_30_DAYS: "past30";
198
- readonly NEXT_30_DAYS: "next30";
187
+ readonly EXACT: 'exact';
188
+ readonly TODAY: 'today';
189
+ readonly TOMORROW: 'tomorrow';
190
+ readonly YESTERDAY: 'yesterday';
191
+ readonly THIS_WEEK: 'thisWeek';
192
+ readonly LAST_WEEK: 'lastWeek';
193
+ readonly THIS_MONTH: 'thisMonth';
194
+ readonly LAST_MONTH: 'lastMonth';
195
+ readonly PAST_7_DAYS: 'past7';
196
+ readonly NEXT_7_DAYS: 'next7';
197
+ readonly PAST_30_DAYS: 'past30';
198
+ readonly NEXT_30_DAYS: 'next30';
199
199
  };
200
200
  export type BaseConditionalDateMode = typeof BaseConditionalDateMode[keyof typeof BaseConditionalDateMode];
201
201
  /**
@@ -13,10 +13,10 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Charset } from './charset';
16
+ import { Charset, charset } from './charset';
17
17
  import { createFromWildcard, createLiteralRegExp, escapeRegExp } from './escape';
18
18
  import { createRegExpFromSafeFragment } from './factory';
19
- import { Or } from './or';
19
+ import { Or, or } from './or';
20
20
  /**
21
21
  * Namespace-style public API for regex helpers.
22
22
  *
@@ -28,8 +28,8 @@ import { Or } from './or';
28
28
  export declare const regexp: {
29
29
  Charset: typeof Charset;
30
30
  Or: typeof Or;
31
- charset: (...inputs: import("./charset").CharsetInput[]) => Charset;
32
- or: (...inputs: import("./or").OrInput[]) => Or;
31
+ charset: typeof charset;
32
+ or: typeof or;
33
33
  createRegExpFromSafeFragment: typeof createRegExpFromSafeFragment;
34
34
  escapeRegExp: typeof escapeRegExp;
35
35
  createLiteralRegExp: typeof createLiteralRegExp;
@@ -13,8 +13,9 @@
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';
17
- import type { IDocStyles, IDocumentStyle, IParagraphStyle } from '../../types/interfaces';
16
+ import type { Nullable } from '../../shared/types';
17
+ import type { IDocStyles, IDocumentData, IDocumentStyle, IParagraph, IParagraphStyle } from '../../types/interfaces/i-document-data';
18
+ import { BooleanNumber } from '../../types/enum/text-style';
18
19
  export interface IResolveDocumentParagraphStyleOptions {
19
20
  /** Exclude document-level outer spacing while retaining all other defaults. */
20
21
  excludeDocumentOuterSpacing?: boolean;
@@ -26,3 +27,5 @@ export interface IResolveDocumentParagraphStyleOptions {
26
27
  paragraphStyleId?: string;
27
28
  }
28
29
  export declare function resolveDocumentParagraphStyle(documentStyle: Nullable<IDocumentStyle>, paragraphStyle: Nullable<IParagraphStyle>, options?: IResolveDocumentParagraphStyleOptions): IParagraphStyle;
30
+ /** Resolves word splitting without materializing inherited defaults in the snapshot. */
31
+ export declare function resolveDocumentParagraphWordWrap(document: IDocumentData, paragraph?: IParagraph): BooleanNumber;
@@ -78,12 +78,12 @@ export declare enum PresetListType {
78
78
  }
79
79
  export declare const PRESET_LIST_TYPE: Record<string, IListData>;
80
80
  export declare const QuickListTypeMap: {
81
- "1.": PresetListType;
82
- "a)": PresetListType;
83
- "a.": PresetListType;
84
- "i.": PresetListType;
85
- "A.": PresetListType;
86
- "I.": PresetListType;
87
- "01.": PresetListType;
88
- "*": PresetListType;
81
+ [QuickListType.ORDER_LIST_QUICK_1]: PresetListType;
82
+ [QuickListType.ORDER_LIST_QUICK_2]: PresetListType;
83
+ [QuickListType.ORDER_LIST_QUICK_3]: PresetListType;
84
+ [QuickListType.ORDER_LIST_QUICK_4]: PresetListType;
85
+ [QuickListType.ORDER_LIST_QUICK_5]: PresetListType;
86
+ [QuickListType.ORDER_LIST_QUICK_6]: PresetListType;
87
+ [QuickListType.ORDER_LIST_QUICK_7]: PresetListType;
88
+ [QuickListType.BULLET_LIST]: PresetListType;
89
89
  };
@@ -1346,10 +1346,10 @@ export declare class RichTextValue {
1346
1346
  * ```
1347
1347
  */
1348
1348
  getTextRuns(): {
1349
- ts: TextStyleValue | null;
1350
1349
  st: number;
1351
1350
  ed: number;
1352
1351
  sId?: string;
1352
+ ts: TextStyleValue | null;
1353
1353
  }[];
1354
1354
  /**
1355
1355
  * Gets the links of the current RichTextValue instance
@@ -26,12 +26,12 @@ import type { CustomRangeType, ICustomRange, IDocumentBody } from '../../../../t
26
26
  export declare function isIntersecting(line1Start: number, line1End: number, line2Start: number, line2End: number): boolean;
27
27
  export declare function getCustomRangesInterestsWithSelection(range: ITextRange, customRanges: ICustomRange[]): ICustomRange<Record<string, any>>[];
28
28
  export declare function copyCustomRange(range: ICustomRange): {
29
- rangeId: string;
30
29
  startIndex: number;
31
30
  endIndex: number;
32
31
  rangeType: CustomRangeType | number;
33
32
  wholeEntity?: boolean;
34
33
  properties?: Record<string, any> | undefined;
34
+ rangeId: string;
35
35
  };
36
36
  export declare function excludePointsFromRange(range: [number, number], points: number[]): [number, number][];
37
37
  export declare function getIntersectingCustomRanges(startIndex: number, endIndex: number, customRanges: ICustomRange[], rangeType?: CustomRangeType): {
@@ -15,9 +15,11 @@
15
15
  */
16
16
  import { addCustomDecorationTextX, deleteCustomDecorationTextX } from './custom-decoration';
17
17
  import { copyCustomRange, getCustomRangesInterestsWithSelection, isIntersecting } from './custom-range';
18
- import { removeDrawingReferences } from './drawings';
18
+ import { addDrawing, removeDrawingReferences } from './drawings';
19
+ import { changeParagraphBulletNestLevel, setParagraphBullet, setParagraphStyle, switchParagraphBullet, toggleChecklistParagraph } from './paragraph';
20
+ import { fromPlainText, getPlainText, isEmptyDocument } from './parse';
19
21
  import { getParagraphsInRange, getParagraphsInRanges, isSegmentIntersects, makeSelection, normalizeSelection, transformParagraphs } from './selection';
20
- import { addCustomRangeTextX, deleteCustomRangeTextX, deleteSelectionTextX, retainSelectionTextX } from './text-x-utils';
22
+ import { addCustomRangeTextX, deleteCustomRangeTextX, deleteSelectionTextX, replaceSelectionTextRuns, replaceSelectionTextX, retainSelectionTextX } from './text-x-utils';
21
23
  export declare class BuildTextUtils {
22
24
  static customRange: {
23
25
  add: typeof addCustomRangeTextX;
@@ -31,11 +33,11 @@ export declare class BuildTextUtils {
31
33
  delete: typeof deleteCustomDecorationTextX;
32
34
  };
33
35
  static selection: {
34
- replace: (params: import("./text-x-utils").IReplaceSelectionTextXParams) => false | import("../text-x").TextX;
36
+ replace: typeof replaceSelectionTextX;
35
37
  makeSelection: typeof makeSelection;
36
38
  normalizeSelection: typeof normalizeSelection;
37
39
  delete: typeof deleteSelectionTextX;
38
- replaceTextRuns: (params: import("./text-x-utils").IReplaceSelectionTextRunsParams) => false | import("../text-x").TextX;
40
+ replaceTextRuns: typeof replaceSelectionTextRuns;
39
41
  retain: typeof retainSelectionTextX;
40
42
  };
41
43
  static range: {
@@ -44,19 +46,19 @@ export declare class BuildTextUtils {
44
46
  getParagraphsInRanges: typeof getParagraphsInRanges;
45
47
  };
46
48
  static transform: {
47
- getPlainText: (dataStream: string) => string;
48
- fromPlainText: (text: string) => import("../../../..").IDocumentBody;
49
- isEmptyDocument: (dataStream?: string) => boolean;
49
+ getPlainText: typeof getPlainText;
50
+ fromPlainText: typeof fromPlainText;
51
+ isEmptyDocument: typeof isEmptyDocument;
50
52
  };
51
53
  static paragraph: {
52
54
  bullet: {
53
- set: (params: import("./paragraph").ISetParagraphBulletParams) => false | import("../text-x").TextX;
54
- switch: (params: import("./paragraph").ISwitchParagraphBulletParams) => import("../text-x").TextX;
55
- toggleChecklist: (params: import("./paragraph").IToggleChecklistParagraphParams) => false | import("../text-x").TextX;
56
- changeNestLevel: (params: import("./paragraph").IChangeParagraphBulletNestLevelParams) => import("../text-x").TextX;
55
+ set: typeof setParagraphBullet;
56
+ switch: typeof switchParagraphBullet;
57
+ toggleChecklist: typeof toggleChecklistParagraph;
58
+ changeNestLevel: typeof changeParagraphBulletNestLevel;
57
59
  };
58
60
  style: {
59
- set: (params: import("./paragraph").ISetParagraphStyleParams) => import("../text-x").TextX;
61
+ set: typeof setParagraphStyle;
60
62
  };
61
63
  util: {
62
64
  transform: typeof transformParagraphs;
@@ -65,7 +67,7 @@ export declare class BuildTextUtils {
65
67
  };
66
68
  };
67
69
  static drawing: {
68
- add: (param: import("./drawings").IAddDrawingParam) => false | import("ot-json1").JSONOp;
70
+ add: typeof addDrawing;
69
71
  remove: typeof removeDrawingReferences;
70
72
  };
71
73
  }
@@ -29,14 +29,13 @@ export declare enum SliceStructuralRangeMode {
29
29
  }
30
30
  export declare function getTextRunSlice(body: IDocumentBody, startOffset: number, endOffset: number, returnEmptyTextRuns?: boolean): ITextRun[] | undefined;
31
31
  export declare function getTableSlice(body: IDocumentBody, startOffset: number, endOffset: number, mode?: SliceStructuralRangeMode): {
32
+ tableId: string;
32
33
  startIndex: number;
33
34
  endIndex: number;
34
- tableId: string;
35
35
  }[];
36
36
  export declare function getBlockRangeSlice(body: IDocumentBody, startOffset: number, endOffset: number, mode?: SliceStructuralRangeMode): IDocumentBlockRange[];
37
37
  export declare function getColumnGroupSlice(body: IDocumentBody, startOffset: number, endOffset: number, mode?: SliceStructuralRangeMode): ICustomColumnGroup[];
38
38
  export declare function getParagraphsSlice(body: IDocumentBody, startOffset: number, endOffset: number, type?: SliceBodyType): {
39
- startIndex: number;
40
39
  paragraphId: string;
41
40
  headingCollapsed?: boolean;
42
41
  styleId?: string;
@@ -44,10 +43,21 @@ export declare function getParagraphsSlice(body: IDocumentBody, startOffset: num
44
43
  bullet?: import("../../..").IBullet;
45
44
  sourceBullet?: import("../../..").IBullet | null;
46
45
  directBullet?: import("../../..").IBullet | null;
46
+ startIndex: number;
47
47
  }[] | undefined;
48
48
  export declare function getSectionBreakSlice(body: IDocumentBody, startOffset: number, endOffset: number): {
49
- startIndex: number;
50
- sectionId: string;
49
+ marginTop?: number;
50
+ marginBottom?: number;
51
+ marginRight?: number;
52
+ marginLeft?: number;
53
+ defaultHeaderId?: string;
54
+ defaultFooterId?: string;
55
+ evenPageHeaderId?: string;
56
+ evenPageFooterId?: string;
57
+ firstPageHeaderId?: string;
58
+ firstPageFooterId?: string;
59
+ useFirstPageHeaderFooter?: import("../../..").BooleanNumber;
60
+ evenAndOddHeaders?: import("../../..").BooleanNumber;
51
61
  pageBorders?: import("../../..").IPageBorders;
52
62
  pageNumberStart?: number;
53
63
  pageSize?: import("../../..").ISize;
@@ -56,10 +66,6 @@ export declare function getSectionBreakSlice(body: IDocumentBody, startOffset: n
56
66
  marginHeader?: number;
57
67
  marginFooter?: number;
58
68
  renderConfig?: import("../../..").IDocumentRenderConfig;
59
- marginTop?: number;
60
- marginBottom?: number;
61
- marginRight?: number;
62
- marginLeft?: number;
63
69
  noteProperties?: import("../../..").INoteProperties;
64
70
  suppressEndnotes?: boolean;
65
71
  charSpace?: number;
@@ -71,23 +77,17 @@ export declare function getSectionBreakSlice(body: IDocumentBody, startOffset: n
71
77
  sectionType?: import("../../..").SectionType;
72
78
  sectionTypeNext?: import("../../..").SectionType;
73
79
  textDirection?: import("../../..").TextDirectionType;
74
- defaultHeaderId?: string;
75
- defaultFooterId?: string;
76
- evenPageHeaderId?: string;
77
- evenPageFooterId?: string;
78
- firstPageHeaderId?: string;
79
- firstPageFooterId?: string;
80
- useFirstPageHeaderFooter?: import("../../..").BooleanNumber;
81
- evenAndOddHeaders?: import("../../..").BooleanNumber;
80
+ sectionId: string;
81
+ startIndex: number;
82
82
  }[] | undefined;
83
83
  export declare function getCustomBlockSlice(body: IDocumentBody, startOffset: number, endOffset: number): {
84
- startIndex: number;
85
84
  blockType?: import("../../..").BlockType;
86
85
  blockId: string;
87
- noteType?: "footnote" | "endnote" | "separator" | "continuationSeparator";
86
+ noteType?: 'footnote' | 'endnote' | 'separator' | 'continuationSeparator';
88
87
  noteId?: string;
89
88
  docxRawXml?: string;
90
89
  docxExportTs?: import("../../..").ITextStyle;
90
+ startIndex: number;
91
91
  }[] | undefined;
92
92
  export declare function getBodySlice(body: IDocumentBody, startOffset: number, endOffset: number, returnEmptyArray?: boolean, type?: SliceBodyType, structuralRangeMode?: SliceStructuralRangeMode): IDocumentBody;
93
93
  export declare function getBodySliceForTextXAction(body: IDocumentBody, startOffset: number, endOffset: number, returnEmptyArray?: boolean, type?: SliceBodyType): IDocumentBody;
@@ -99,12 +99,12 @@ export declare function getCustomRangeSlice(body: IDocumentBody, startOffset: nu
99
99
  rightOffset?: undefined;
100
100
  } | {
101
101
  customRanges: {
102
- startIndex: number;
103
- endIndex: number;
104
102
  rangeId: string;
105
103
  rangeType: CustomRangeType | number;
106
104
  wholeEntity?: boolean;
107
105
  properties?: Record<string, any> | undefined;
106
+ startIndex: number;
107
+ endIndex: number;
108
108
  }[];
109
109
  leftOffset: number;
110
110
  rightOffset: number;
@@ -42,6 +42,7 @@ export { mergeSets } from './common/set';
42
42
  export { UnitModel, UniverInstanceType } from './common/unit';
43
43
  export { isSafeUrl, normalizeUrl, resolveWithBasePath } from './common/url';
44
44
  export * from './docs';
45
+ export { resolveDocumentParagraphWordWrap } from './docs/data-model/paragraph-style';
45
46
  export { getSdtBindingKey, getSdtBindingValue } from './docs/sdt-binding';
46
47
  export { EventState, EventSubject, fromEventSubject } from './observer/observable';
47
48
  export type { IEventObserver } from './observer/observable';
@@ -36,8 +36,8 @@ export declare enum LifecycleStages {
36
36
  Steady = 3
37
37
  }
38
38
  export declare const LifecycleNameMap: {
39
- 0: string;
40
- 1: string;
41
- 2: string;
42
- 3: string;
39
+ [LifecycleStages.Starting]: string;
40
+ [LifecycleStages.Ready]: string;
41
+ [LifecycleStages.Rendered]: string;
42
+ [LifecycleStages.Steady]: string;
43
43
  };
@@ -16,7 +16,7 @@
16
16
  import type { IResources } from '../resource-manager/type';
17
17
  export declare const IResourceLoaderService: import("@wendellhu/redi").IdentifierDecorator<IResourceLoaderService>;
18
18
  export interface IResourceLoaderService {
19
- saveUnit<T = object>(unitId: string): T & {
19
+ saveUnit<T = object>(unitId: string): (T & {
20
20
  resources: IResources;
21
- } | null;
21
+ }) | null;
22
22
  }
@@ -23,10 +23,10 @@ export declare class UserManagerService extends Disposable {
23
23
  private _model;
24
24
  private _userChange$;
25
25
  userChange$: import("rxjs").Observable<{
26
- type: "add" | "delete";
26
+ type: 'add' | 'delete';
27
27
  user: IUser;
28
28
  } | {
29
- type: "clear";
29
+ type: 'clear';
30
30
  }>;
31
31
  private _currentUser$;
32
32
  /**
@@ -59,6 +59,7 @@ export declare function isValidRange(range: IRange, worksheet?: Worksheet): bool
59
59
  export declare function cellToRange(row: number, col: number): IRange;
60
60
  /**
61
61
  * Covert cell value to cell data.
62
+ * A formula or content value also clears the shared formula id of the cell it replaces.
62
63
  * @param {CellValue | ICellData} value - The cell value.
63
64
  * @returns {ICellData} The cell data.
64
65
  */
@@ -14,8 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { BBox } from 'rbush';
17
- import type { IUnitRange } from '../sheets/typedef';
18
17
  import RBush from 'rbush';
18
+ import type { IUnitRange } from '../sheets/typedef';
19
19
  type StringOrNumber = string | number;
20
20
  export interface IRTreeItem extends IUnitRange {
21
21
  id: StringOrNumber;
@@ -56,6 +56,8 @@ export declare class RTree {
56
56
  private _removeRTreeItem;
57
57
  remove(search: IRTreeItem): void;
58
58
  bulkRemove(searchList: IRTreeItem[]): void;
59
+ private _bulkRemoveFromSheet;
60
+ private _removeSparseRanges;
59
61
  clear(): void;
60
62
  toJSON(): IRTreeData;
61
63
  fromJSON(data: IRTreeData): void;
@@ -13,8 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare function sortRules(oa: any, ob: any): 0 | 1 | -1;
17
- export declare function sortRulesByDesc(oa: any, ob: any): 0 | 1 | -1;
16
+ export declare function sortRules(oa: any, ob: any): -1 | 0 | 1;
17
+ export declare function sortRulesByDesc(oa: any, ob: any): -1 | 0 | 1;
18
18
  /**
19
19
  *
20
20
  * @param key compare key
@@ -13,8 +13,10 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { IObjectArrayPrimitiveType, Nullable } from '../shared';
17
- import type { IDocumentData, IDocumentRenderConfig, IPaddingData } from '../types/interfaces';
16
+ import type { IObjectArrayPrimitiveType } from '../shared/object-matrix';
17
+ import type { Nullable } from '../shared/types';
18
+ import type { IDocumentData, IDocumentRenderConfig } from '../types/interfaces/i-document-data';
19
+ import type { IPaddingData } from '../types/interfaces/i-style-data';
18
20
  import type { Styles } from './styles';
19
21
  import type { ICellData, ICellInfo, ICellWithCoord, IPosition, IRange, ISelectionCell, IWorksheetData } from './typedef';
20
22
  import type { Worksheet } from './worksheet';
@@ -23,10 +25,10 @@ import { DocumentDataModel } from '../docs/data-model/document-data-model';
23
25
  import { IConfigService } from '../services/config/config.service';
24
26
  import { IContextService } from '../services/context/context.service';
25
27
  import { LocaleService } from '../services/locale/locale.service';
26
- import { ObjectMatrix } from '../shared';
27
28
  import { ImageCacheMap } from '../shared/cache/image-cache';
29
+ import { ObjectMatrix } from '../shared/object-matrix';
28
30
  import { Skeleton } from '../skeleton';
29
- import { HorizontalAlign } from '../types/enum';
31
+ import { HorizontalAlign } from '../types/enum/text-style';
30
32
  /**
31
33
  * Configuration for a single gap (visual separator between rows or columns).
32
34
  * The gap area is rendered with a background color and diagonal stripes.
@@ -258,6 +260,8 @@ export declare class SheetSkeleton extends Skeleton {
258
260
  * @param scaleX render scene scale x-axis, scene.getAncestorScale
259
261
  * @param scaleY render scene scale y-axis, scene.getAncestorScale
260
262
  * @param scrollXY render viewportScroll {x, y}
263
+ * @param scrollXY.x horizontal scroll offset
264
+ * @param scrollXY.y vertical scroll offset
261
265
  * @param options {IGetRowColByPosOptions}
262
266
  * @returns {ICellWithCoord} Selection data with coordinates
263
267
  */
@@ -326,6 +330,8 @@ export declare function getCellWithCoordByIndexCore(row: number, column: number,
326
330
  * @param offsetX Offset value from PointerEvent in canvas element.
327
331
  * @param scaleX from scene.getAncestorScale
328
332
  * @param scrollXY Scroll value of viewport
333
+ * @param scrollXY.x horizontal scroll offset
334
+ * @param scrollXY.y vertical scroll offset
329
335
  * @returns {number} x in sheet coordinate.
330
336
  */
331
337
  export declare function getTransformOffsetX(offsetX: number, scaleX: number, scrollXY: {
@@ -336,6 +342,8 @@ export declare function getTransformOffsetX(offsetX: number, scaleX: number, scr
336
342
  * @param offsetY
337
343
  * @param scaleY
338
344
  * @param scrollXY
345
+ * @param scrollXY.x horizontal scroll offset
346
+ * @param scrollXY.y vertical scroll offset
339
347
  */
340
348
  export declare function getTransformOffsetY(offsetY: number, scaleY: number, scrollXY: {
341
349
  x: number;
@@ -902,11 +902,6 @@ export interface IDocDrawingPosition {
902
902
  /** Vertical flip persisted with the document drawing transform. */
903
903
  flipY?: boolean;
904
904
  }
905
- /**
906
- * ChartProperties
907
- */
908
- export interface IChartProperties {
909
- }
910
905
  /**
911
906
  * Properties of text style
912
907
  */
@@ -1086,6 +1081,7 @@ export interface IParagraphProperties extends IIndentStart {
1086
1081
  * OOXML: 17.3.1.23 `pageBreakBefore`.
1087
1082
  */
1088
1083
  pageBreakBefore?: BooleanNumber;
1084
+ /** Allow words to split across lines. Absent inherits; DOCX w:wordWrap uses the inverse value. */
1089
1085
  wordWrap?: BooleanNumber;
1090
1086
  /**
1091
1087
  * Avoids leaving a single measured first or last line on a separate page
@@ -92,7 +92,9 @@ export declare enum DrawingTypeEnum {
92
92
  /**
93
93
  * Spreadsheet Timeline control.
94
94
  */
95
- DRAWING_TIMELINE = 11
95
+ DRAWING_TIMELINE = 11,
96
+ /** Independent Office attachment; its preview image is separate from its original file. */
97
+ DRAWING_OLE = 12
96
98
  }
97
99
  export type DrawingType = DrawingTypeEnum | number;
98
100
  export interface IDrawingSpace {
@@ -16,9 +16,6 @@
16
16
  export * from './i-document-data';
17
17
  export * from './i-document-data-interceptor';
18
18
  export * from './i-drawing';
19
- export * from './i-image-properties';
20
19
  export * from './i-mention';
21
20
  export * from './i-need-check-disposable';
22
- export * from './i-placeholder';
23
- export * from './i-shape-properties';
24
21
  export * from './i-style-data';
@@ -19,7 +19,7 @@ import type { UnitModel } from './common/unit';
19
19
  import type { LogLevel } from './services/log/log.service';
20
20
  import type { DependencyOverride } from './services/plugin/plugin-override';
21
21
  import type { Plugin, PluginCtor } from './services/plugin/plugin.service';
22
- import type { ILocales } from './shared';
22
+ import type { ILocales } from './shared/locale';
23
23
  import type { LocaleType } from './types/enum/locale-type';
24
24
  import { Injector } from './common/di';
25
25
  import { UniverInstanceType } from './common/unit';
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverCoreFacade={},e.UniverCore))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=class extends t.Disposable{static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{t!==`constructor`&&(this.prototype[t]=e.prototype[t])}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}};let r=Symbol(`initializers`),i=Symbol(`manualInit`);var a=class extends t.Disposable{constructor(e){if(super(),this._injector=e,this.constructor[i])return;let t=Object.getPrototypeOf(this)[r];t&&t.forEach(t=>{t.apply(this,[e])})}_initialize(e,...t){}_runInitializers(...e){let t=Object.getPrototypeOf(this)[r];t!=null&&t.length&&t.forEach(t=>t.apply(this,e))}static _enableManualInit(){this[i]=!0}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{if(t===`_initialize`){let t=this.prototype[r];t||(t=[],this.prototype[r]=t),t.push(e.prototype._initialize)}else if(t!==`constructor`){let n=Object.getOwnPropertyDescriptor(e.prototype,t);n?Object.defineProperty(this.prototype,t,n):this.prototype[t]=e.prototype[t]}}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}};function o(e,t){return function(n,r){t(n,r,e)}}function s(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var c;let l=c=class extends n{constructor(e,t){super(),this._blob=e,this._injector=t}copyBlob(){return this._injector.createInstance(c,this._blob)}getAs(e){let t=this.copyBlob();return t.setContentType(e),t}getDataAsString(e){return this._blob===null?Promise.resolve(``):e===void 0?this._blob.text():new Promise((t,n)=>{this._blob.arrayBuffer().then(n=>{t(new TextDecoder(e).decode(n))}).catch(e=>{n(/* @__PURE__ */ Error(`Failed to read Blob as ArrayBuffer: ${e.message}`))})})}getBytes(){return this._blob?this._blob.arrayBuffer().then(e=>new Uint8Array(e)):Promise.reject(/* @__PURE__ */ Error(`Blob is undefined or null.`))}setBytes(e){return this._blob=new Blob([e.buffer]),this}setDataFromString(e,t){let n=new Blob([e],{type:t??`text/plain`});return this._blob=n,this}getContentType(){var e;return(e=this._blob)==null?void 0:e.type}setContentType(e){var t;return this._blob=(t=this._blob)==null?void 0:t.slice(0,this._blob.size,e),this}};l=c=s([o(1,(0,t.Inject)(t.Injector))],l);function u(e){"@babel/helpers - typeof";return u=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},u(e)}function d(e,t){if(u(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(u(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function f(e){var t=d(e,`string`);return u(t)==`symbol`?t:t+``}function p(e,t,n){return(t=f(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var m=class e{get FormulaType(){return t.FormulaType}get WorksheetHiddenState(){return t.WorksheetHiddenState}static get(){if(this._instance)return this._instance;let t=new e;return this._instance=t,t}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{t!==`constructor`&&(this.prototype[t]=e.prototype[t])}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}constructor(){for(let t in e.prototype)this[t]=e.prototype[t]}get AbsoluteRefType(){return t.AbsoluteRefType}get UniverInstanceType(){return t.UniverInstanceType}get LifecycleStages(){return t.LifecycleStages}get DataValidationType(){return t.DataValidationType}get DataValidationErrorStyle(){return t.DataValidationErrorStyle}get DataValidationRenderMode(){return t.DataValidationRenderMode}get DataValidationOperator(){return t.DataValidationOperator}get DataValidationStatus(){return t.DataValidationStatus}get CommandType(){return t.CommandType}get BaselineOffset(){return t.BaselineOffset}get BooleanNumber(){return t.BooleanNumber}get HorizontalAlign(){return t.HorizontalAlign}get NamedStyleType(){return t.NamedStyleType}get SpacingRule(){return t.SpacingRule}get NumberUnitType(){return t.NumberUnitType}get PresetListType(){return t.PresetListType}get TextDecoration(){return t.TextDecoration}get TextDirection(){return t.TextDirection}get VerticalAlign(){return t.VerticalAlign}get WrapStrategy(){return t.WrapStrategy}get BorderType(){return t.BorderType}get BorderStyleTypes(){return t.BorderStyleTypes}get AutoFillSeries(){return t.AutoFillSeries}get ColorType(){return t.ColorType}get CommonHideTypes(){return t.CommonHideTypes}get CopyPasteType(){return t.CopyPasteType}get DeleteDirection(){return t.DeleteDirection}get DeveloperMetadataVisibility(){return t.DeveloperMetadataVisibility}get Dimension(){return t.Dimension}get Direction(){return t.Direction}get InterpolationPointType(){return t.InterpolationPointType}get LocaleType(){return t.LocaleType}get MentionType(){return t.MentionType}get ProtectionType(){return t.ProtectionType}get RelativeDate(){return t.RelativeDate}get SheetTypes(){return t.SheetTypes}get ThemeColorType(){return t.ThemeColorType}get ImageSourceType(){return t.ImageSourceType}};p(m,`_instance`,void 0);var h=class e{static get(){if(this._instance)return this._instance;let t=new e;return this._instance=t,t}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{t!==`constructor`&&(this.prototype[t]=e.prototype[t])}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}constructor(){for(let t in e.prototype)this[t]=e.prototype[t]}get DocCreated(){return`DocCreated`}get DocDisposed(){return`DocDisposed`}get LifeCycleChanged(){return`LifeCycleChanged`}get Redo(){return`Redo`}get Undo(){return`Undo`}get BeforeRedo(){return`BeforeRedo`}get BeforeUndo(){return`BeforeUndo`}get CommandExecuted(){return`CommandExecuted`}get BeforeCommandExecute(){return`BeforeCommandExecute`}};p(h,`_instance`,void 0);let g=class extends a{constructor(e,t){super(t),this.doc=e}};g=s([o(1,(0,t.Inject)(t.Injector))],g);var _=class{constructor(){p(this,`_eventRegistry`,/* @__PURE__ */ new Map),p(this,`_eventHandlerMap`,/* @__PURE__ */ new Map),p(this,`_eventHandlerRegisted`,/* @__PURE__ */ new Map)}_ensureEventRegistry(e){return this._eventRegistry.has(e)||this._eventRegistry.set(e,new t.Registry),this._eventRegistry.get(e)}registerEventHandler(e,n){let r=this._eventHandlerMap.get(e);return r?r.add(n):this._eventHandlerMap.set(e,/* @__PURE__ */ new Set([n])),this._ensureEventRegistry(e).getData().length&&this._initEventHandler(e),(0,t.toDisposable)(()=>{var t,r,i;(t=this._eventHandlerMap.get(e))==null||t.delete(n),(r=this._eventHandlerRegisted.get(e))==null||(r=r.get(n))==null||r.dispose(),(i=this._eventHandlerRegisted.get(e))==null||i.delete(n)})}removeEvent(e,t){let n=this._ensureEventRegistry(e);if(n.delete(t),n.getData().length===0){let t=this._eventHandlerRegisted.get(e);t==null||t.forEach(e=>e.dispose()),this._eventHandlerRegisted.delete(e)}}_initEventHandler(e){let n=this._eventHandlerRegisted.get(e),r=this._eventHandlerMap.get(e);r&&(!n||n.size===0)&&(n=/* @__PURE__ */ new Map,this._eventHandlerRegisted.set(e,n),r==null||r.forEach(e=>{n==null||n.set(e,(0,t.toDisposable)(e()))}))}addEvent(e,n){return this._ensureEventRegistry(e).add(n),this._initEventHandler(e),(0,t.toDisposable)(()=>this.removeEvent(e,n))}fireEvent(e,t){var n;return(n=this._eventRegistry.get(e))==null||n.getData().forEach(e=>{e(t)}),t.cancel}};let v=class extends n{constructor(e,t){super(),this._injector=e,this._userManagerService=t}getCurrentUser(){return this._userManagerService.getCurrentUser()}};v=s([o(0,(0,t.Inject)(t.Injector)),o(1,(0,t.Inject)(t.UserManagerService))],v);var y=class e{static get(){if(this._instance)return this._instance;let t=new e;return this._instance=t,t}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{t!==`constructor`&&(this.prototype[t]=e.prototype[t])}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}get rectangle(){return t.Rectangle}get numfmt(){return t.numfmt}get tools(){return t.Tools}};p(y,`_instance`,void 0);var b;let x=Symbol(`initializers`),S=b=class extends t.Disposable{static newAPI(e){return(e instanceof t.Univer?e.__getInjector():e).createInstance(b)}_initialize(e){}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{if(t===`_initialize`){let n=this.prototype[x];n||(n=[],this.prototype[x]=n),n.push(Reflect.get(e.prototype,t))}else t!==`constructor`&&Reflect.set(this.prototype,t,Reflect.get(e.prototype,t))}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&Reflect.set(this,t,Reflect.get(e,t))})}constructor(e,n,r,i){super(),this._injector=e,this._commandService=n,this._univerInstanceService=r,this._lifecycleService=i,p(this,`_eventRegistry`,new _),p(this,`registerEventHandler`,(e,t)=>this._eventRegistry.registerEventHandler(e,t)),this.disposeWithMe(this.registerEventHandler(this.Event.LifeCycleChanged,()=>(0,t.toDisposable)(this._lifecycleService.lifecycle$.subscribe(e=>{this.fireEvent(this.Event.LifeCycleChanged,{stage:e})})))),this._initUnitEvent(this._injector),this._initBeforeCommandEvent(this._injector),this._initCommandEvent(this._injector),this._injector.onDispose(()=>{this.dispose()});let a=Object.getPrototypeOf(this)[x];a&&a.forEach(e=>{e.call(this,this._injector)})}_initCommandEvent(e){let n=e.get(t.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.Redo,()=>n.onCommandExecuted(e=>{let{id:n,type:r,params:i}=e;if(e.id===t.RedoCommand.id){let e={id:n,type:r,params:i};this.fireEvent(this.Event.Redo,e)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.Undo,()=>n.onCommandExecuted(e=>{let{id:n,type:r,params:i}=e;if(e.id===t.UndoCommand.id){let e={id:n,type:r,params:i};this.fireEvent(this.Event.Undo,e)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.CommandExecuted,()=>n.onCommandExecuted((e,n)=>{let{id:r,type:i,params:a}=e;if(e.id!==t.RedoCommand.id&&e.id!==t.UndoCommand.id){let e={id:r,type:i,params:a,options:n};this.fireEvent(this.Event.CommandExecuted,e)}})))}_initBeforeCommandEvent(e){let n=e.get(t.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.BeforeRedo,()=>n.beforeCommandExecuted(e=>{let{id:n,type:r,params:i}=e;if(e.id===t.RedoCommand.id){let e={id:n,type:r,params:i};if(this.fireEvent(this.Event.BeforeRedo,e),e.cancel)throw new t.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeUndo,()=>n.beforeCommandExecuted(e=>{let{id:n,type:r,params:i}=e;if(e.id===t.UndoCommand.id){let e={id:n,type:r,params:i};if(this.fireEvent(this.Event.BeforeUndo,e),e.cancel)throw new t.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeCommandExecute,()=>n.beforeCommandExecuted((e,n)=>{let{id:r,type:i,params:a}=e;if(e.id!==t.RedoCommand.id&&e.id!==t.UndoCommand.id){let e={id:r,type:i,params:a,options:n};if(this.fireEvent(this.Event.BeforeCommandExecute,e),e.cancel)throw new t.CanceledError}})))}_initUnitEvent(e){let n=e.get(t.IUniverInstanceService);this.disposeWithMe(this.registerEventHandler(this.Event.DocDisposed,()=>n.unitDisposed$.subscribe(e=>{e.type===t.UniverInstanceType.UNIVER_DOC&&this.fireEvent(this.Event.DocDisposed,{unitId:e.getUnitId(),unitType:e.type,snapshot:e.getSnapshot()})}))),this.disposeWithMe(this.registerEventHandler(this.Event.DocCreated,()=>n.unitAdded$.subscribe(n=>{let{unit:r}=n;if(r.type===t.UniverInstanceType.UNIVER_DOC){let t=r,n=e.createInstance(g,t);this.fireEvent(this.Event.DocCreated,{unitId:r.getUnitId(),type:r.type,doc:n,unit:n})}})))}disposeUnit(e){return this._univerInstanceService.disposeUnit(e)}getCurrentLifecycleStage(){return this._injector.get(t.LifecycleService).stage}undo(){return this._commandService.executeCommand(t.UndoCommand.id)}redo(){return this._commandService.executeCommand(t.RedoCommand.id)}setTheme(e){this._injector.get(t.ThemeService).setTheme(e)}getCurrentTheme(){return this._injector.get(t.ThemeService).getCurrentTheme()}isDarkMode(){return this._injector.get(t.ThemeService).darkMode}toggleDarkMode(e){this._injector.get(t.ThemeService).setDarkMode(e)}loadLocales(e,n){this._injector.get(t.LocaleService).load({[e]:n})}setLocale(e){this._injector.get(t.LocaleService).setLocale(e)}setRegion(e){this._injector.get(t.RegionService).setRegion(e)}getCurrentRegion(){return this._injector.get(t.RegionService).getCurrentRegion()}setDirection(e){this._injector.get(t.LocaleService).setDirection(e)}getCurrentLocale(){return this._injector.get(t.LocaleService).getCurrentLocale()}getLocales(){return this._injector.get(t.LocaleService).getLocales()}executeCommand(e,t,n){return this._commandService.executeCommand(e,t,n)}syncExecuteCommand(e,t,n){return this._commandService.syncExecuteCommand(e,t,n)}get Enum(){return m.get()}get Event(){return h.get()}get Util(){return y.get()}addEvent(e,t){if(!e||!t)throw Error(`Cannot add empty event`);return this._eventRegistry.addEvent(e,t)}fireEvent(e,t){return this._eventRegistry.fireEvent(e,t)}getUserManager(){return this._injector.createInstance(v)}newBlob(){return this._injector.createInstance(l,null)}newRichText(){return t.RichTextBuilder.create()}newRichTextFromDocumentData(e){return t.RichTextBuilder.create(e)}newRichTextValue(e){return t.RichTextValue.create(e)}newParagraphStyle(e){return t.ParagraphStyleBuilder.create(e)}newParagraphStyleValue(e){return t.ParagraphStyleValue.create(e)}newTextStyle(e){return t.TextStyleBuilder.create(e)}newTextStyleValue(e){return t.TextStyleValue.create(e)}newTextDecoration(e){return new t.TextDecorationBuilder(e)}};S=b=s([o(0,(0,t.Inject)(t.Injector)),o(1,t.ICommandService),o(2,t.IUniverInstanceService),o(3,(0,t.Inject)(t.LifecycleService))],S),e.FBase=n,e.FBaseInitialable=a,Object.defineProperty(e,"FBlob",{enumerable:!0,get:function(){return l}}),e.FEnum=m,e.FEventName=h,Object.defineProperty(e,"FUniver",{enumerable:!0,get:function(){return S}}),e.FUtil=y});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverCoreFacade={},e.UniverCore))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=class extends t.Disposable{static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{t!==`constructor`&&(this.prototype[t]=e.prototype[t])}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}};let r=Symbol(`initializers`),i=Symbol(`manualInit`);var a=class extends t.Disposable{constructor(e){if(super(),this._injector=e,this.constructor[i])return;let t=Object.getPrototypeOf(this)[r];t&&t.forEach(t=>{t.apply(this,[e])})}_initialize(e,...t){}_runInitializers(...e){let t=Object.getPrototypeOf(this)[r];t!=null&&t.length&&t.forEach(t=>t.apply(this,e))}static _enableManualInit(){this[i]=!0}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{if(t===`_initialize`){let t=this.prototype[r];t||(t=[],this.prototype[r]=t),t.push(e.prototype._initialize)}else if(t!==`constructor`){let n=Object.getOwnPropertyDescriptor(e.prototype,t);n?Object.defineProperty(this.prototype,t,n):this.prototype[t]=e.prototype[t]}}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}};function o(e,t){return function(n,r){t(n,r,e)}}function s(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var c;let l=c=class extends n{constructor(e,t){super(),this._blob=e,this._injector=t}copyBlob(){return this._injector.createInstance(c,this._blob)}getAs(e){let t=this.copyBlob();return t.setContentType(e),t}getDataAsString(e){return this._blob===null?Promise.resolve(``):e===void 0?this._blob.text():new Promise((t,n)=>{this._blob.arrayBuffer().then(n=>{t(new TextDecoder(e).decode(n))}).catch(e=>{n(/* @__PURE__ */ Error(`Failed to read Blob as ArrayBuffer: ${e.message}`))})})}getBytes(){return this._blob?this._blob.arrayBuffer().then(e=>new Uint8Array(e)):Promise.reject(/* @__PURE__ */ Error(`Blob is undefined or null.`))}setBytes(e){return this._blob=new Blob([e.buffer]),this}setDataFromString(e,t){let n=new Blob([e],{type:t??`text/plain`});return this._blob=n,this}getContentType(){var e;return(e=this._blob)==null?void 0:e.type}setContentType(e){var t;return this._blob=(t=this._blob)==null?void 0:t.slice(0,this._blob.size,e),this}};l=c=s([o(1,(0,t.Inject)(t.Injector))],l);function u(e){"@babel/helpers - typeof";return u=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},u(e)}function d(e,t){if(u(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(u(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function f(e){var t=d(e,`string`);return u(t)==`symbol`?t:t+``}function p(e,t,n){return(t=f(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var m=class e{get FormulaType(){return t.FormulaType}get WorksheetHiddenState(){return t.WorksheetHiddenState}static get(){if(this._instance)return this._instance;let t=new e;return this._instance=t,t}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{t!==`constructor`&&(this.prototype[t]=e.prototype[t])}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}constructor(){for(let t in e.prototype)this[t]=e.prototype[t]}get AbsoluteRefType(){return t.AbsoluteRefType}get UniverInstanceType(){return t.UniverInstanceType}get LifecycleStages(){return t.LifecycleStages}get DataValidationType(){return t.DataValidationType}get DataValidationErrorStyle(){return t.DataValidationErrorStyle}get DataValidationRenderMode(){return t.DataValidationRenderMode}get DataValidationOperator(){return t.DataValidationOperator}get DataValidationStatus(){return t.DataValidationStatus}get CommandType(){return t.CommandType}get BaselineOffset(){return t.BaselineOffset}get BooleanNumber(){return t.BooleanNumber}get HorizontalAlign(){return t.HorizontalAlign}get NamedStyleType(){return t.NamedStyleType}get SpacingRule(){return t.SpacingRule}get NumberUnitType(){return t.NumberUnitType}get PresetListType(){return t.PresetListType}get TextDecoration(){return t.TextDecoration}get TextDirection(){return t.TextDirection}get VerticalAlign(){return t.VerticalAlign}get WrapStrategy(){return t.WrapStrategy}get BorderType(){return t.BorderType}get BorderStyleTypes(){return t.BorderStyleTypes}get AutoFillSeries(){return t.AutoFillSeries}get ColorType(){return t.ColorType}get CommonHideTypes(){return t.CommonHideTypes}get CopyPasteType(){return t.CopyPasteType}get DeleteDirection(){return t.DeleteDirection}get DeveloperMetadataVisibility(){return t.DeveloperMetadataVisibility}get Dimension(){return t.Dimension}get Direction(){return t.Direction}get InterpolationPointType(){return t.InterpolationPointType}get LocaleType(){return t.LocaleType}get MentionType(){return t.MentionType}get ProtectionType(){return t.ProtectionType}get RelativeDate(){return t.RelativeDate}get SheetTypes(){return t.SheetTypes}get ThemeColorType(){return t.ThemeColorType}get ImageSourceType(){return t.ImageSourceType}};p(m,`_instance`,void 0);var h=class e{static get(){if(this._instance)return this._instance;let t=new e;return this._instance=t,t}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{t!==`constructor`&&(this.prototype[t]=e.prototype[t])}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}constructor(){for(let t in e.prototype)this[t]=e.prototype[t]}get DocCreated(){return`DocCreated`}get DocDisposed(){return`DocDisposed`}get LifeCycleChanged(){return`LifeCycleChanged`}get Redo(){return`Redo`}get Undo(){return`Undo`}get BeforeRedo(){return`BeforeRedo`}get BeforeUndo(){return`BeforeUndo`}get CommandExecuted(){return`CommandExecuted`}get BeforeCommandExecute(){return`BeforeCommandExecute`}};p(h,`_instance`,void 0);let g=class extends a{constructor(e,t){super(t),this.doc=e}};g=s([o(1,(0,t.Inject)(t.Injector))],g);var _=class{constructor(){p(this,`_eventRegistry`,/* @__PURE__ */ new Map),p(this,`_eventHandlerMap`,/* @__PURE__ */ new Map),p(this,`_eventHandlerRegisted`,/* @__PURE__ */ new Map)}_ensureEventRegistry(e){return this._eventRegistry.has(e)||this._eventRegistry.set(e,new t.Registry),this._eventRegistry.get(e)}registerEventHandler(e,n){let r=this._eventHandlerMap.get(e);return r?r.add(n):this._eventHandlerMap.set(e,/* @__PURE__ */ new Set([n])),this._ensureEventRegistry(e).getData().length&&this._initEventHandler(e),(0,t.toDisposable)(()=>{var t,r,i;(t=this._eventHandlerMap.get(e))==null||t.delete(n),(r=this._eventHandlerRegisted.get(e))==null||(r=r.get(n))==null||r.dispose(),(i=this._eventHandlerRegisted.get(e))==null||i.delete(n)})}removeEvent(e,t){let n=this._ensureEventRegistry(e);if(n.delete(t),n.getData().length===0){let t=this._eventHandlerRegisted.get(e);t==null||t.forEach(e=>e.dispose()),this._eventHandlerRegisted.delete(e)}}_initEventHandler(e){let n=this._eventHandlerRegisted.get(e),r=this._eventHandlerMap.get(e);r&&(n&&n.size!==0||(n=/* @__PURE__ */ new Map,this._eventHandlerRegisted.set(e,n),r==null||r.forEach(e=>{n==null||n.set(e,(0,t.toDisposable)(e()))})))}addEvent(e,n){return this._ensureEventRegistry(e).add(n),this._initEventHandler(e),(0,t.toDisposable)(()=>this.removeEvent(e,n))}fireEvent(e,t){var n;return(n=this._eventRegistry.get(e))==null||n.getData().forEach(e=>{e(t)}),t.cancel}};let v=class extends n{constructor(e,t){super(),this._injector=e,this._userManagerService=t}getCurrentUser(){return this._userManagerService.getCurrentUser()}};v=s([o(0,(0,t.Inject)(t.Injector)),o(1,(0,t.Inject)(t.UserManagerService))],v);var y=class e{static get(){if(this._instance)return this._instance;let t=new e;return this._instance=t,t}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{t!==`constructor`&&(this.prototype[t]=e.prototype[t])}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}get rectangle(){return t.Rectangle}get numfmt(){return t.numfmt}get tools(){return t.Tools}};p(y,`_instance`,void 0);var b;let x=Symbol(`initializers`),S=b=class extends t.Disposable{static newAPI(e){return(e instanceof t.Univer?e.__getInjector():e).createInstance(b)}_initialize(e){}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{if(t===`_initialize`){let n=this.prototype[x];n||(n=[],this.prototype[x]=n),n.push(Reflect.get(e.prototype,t))}else t!==`constructor`&&Reflect.set(this.prototype,t,Reflect.get(e.prototype,t))}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&Reflect.set(this,t,Reflect.get(e,t))})}constructor(e,n,r,i){super(),this._injector=e,this._commandService=n,this._univerInstanceService=r,this._lifecycleService=i,p(this,`_eventRegistry`,new _),p(this,`registerEventHandler`,(e,t)=>this._eventRegistry.registerEventHandler(e,t)),this.disposeWithMe(this.registerEventHandler(this.Event.LifeCycleChanged,()=>(0,t.toDisposable)(this._lifecycleService.lifecycle$.subscribe(e=>{this.fireEvent(this.Event.LifeCycleChanged,{stage:e})})))),this._initUnitEvent(this._injector),this._initBeforeCommandEvent(this._injector),this._initCommandEvent(this._injector),this._injector.onDispose(()=>{this.dispose()});let a=Object.getPrototypeOf(this)[x];a&&a.forEach(e=>{e.call(this,this._injector)})}_initCommandEvent(e){let n=e.get(t.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.Redo,()=>n.onCommandExecuted(e=>{let{id:n,type:r,params:i}=e;if(e.id===t.RedoCommand.id){let e={id:n,type:r,params:i};this.fireEvent(this.Event.Redo,e)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.Undo,()=>n.onCommandExecuted(e=>{let{id:n,type:r,params:i}=e;if(e.id===t.UndoCommand.id){let e={id:n,type:r,params:i};this.fireEvent(this.Event.Undo,e)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.CommandExecuted,()=>n.onCommandExecuted((e,n)=>{let{id:r,type:i,params:a}=e;if(e.id!==t.RedoCommand.id&&e.id!==t.UndoCommand.id){let e={id:r,type:i,params:a,options:n};this.fireEvent(this.Event.CommandExecuted,e)}})))}_initBeforeCommandEvent(e){let n=e.get(t.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.BeforeRedo,()=>n.beforeCommandExecuted(e=>{let{id:n,type:r,params:i}=e;if(e.id===t.RedoCommand.id){let e={id:n,type:r,params:i};if(this.fireEvent(this.Event.BeforeRedo,e),e.cancel)throw new t.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeUndo,()=>n.beforeCommandExecuted(e=>{let{id:n,type:r,params:i}=e;if(e.id===t.UndoCommand.id){let e={id:n,type:r,params:i};if(this.fireEvent(this.Event.BeforeUndo,e),e.cancel)throw new t.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeCommandExecute,()=>n.beforeCommandExecuted((e,n)=>{let{id:r,type:i,params:a}=e;if(e.id!==t.RedoCommand.id&&e.id!==t.UndoCommand.id){let e={id:r,type:i,params:a,options:n};if(this.fireEvent(this.Event.BeforeCommandExecute,e),e.cancel)throw new t.CanceledError}})))}_initUnitEvent(e){let n=e.get(t.IUniverInstanceService);this.disposeWithMe(this.registerEventHandler(this.Event.DocDisposed,()=>n.unitDisposed$.subscribe(e=>{e.type===t.UniverInstanceType.UNIVER_DOC&&this.fireEvent(this.Event.DocDisposed,{unitId:e.getUnitId(),unitType:e.type,snapshot:e.getSnapshot()})}))),this.disposeWithMe(this.registerEventHandler(this.Event.DocCreated,()=>n.unitAdded$.subscribe(n=>{let{unit:r}=n;if(r.type===t.UniverInstanceType.UNIVER_DOC){let t=r,n=e.createInstance(g,t);this.fireEvent(this.Event.DocCreated,{unitId:r.getUnitId(),type:r.type,doc:n,unit:n})}})))}disposeUnit(e){return this._univerInstanceService.disposeUnit(e)}getCurrentLifecycleStage(){return this._injector.get(t.LifecycleService).stage}undo(){return this._commandService.executeCommand(t.UndoCommand.id)}redo(){return this._commandService.executeCommand(t.RedoCommand.id)}setTheme(e){this._injector.get(t.ThemeService).setTheme(e)}getCurrentTheme(){return this._injector.get(t.ThemeService).getCurrentTheme()}isDarkMode(){return this._injector.get(t.ThemeService).darkMode}toggleDarkMode(e){this._injector.get(t.ThemeService).setDarkMode(e)}loadLocales(e,n){this._injector.get(t.LocaleService).load({[e]:n})}setLocale(e){this._injector.get(t.LocaleService).setLocale(e)}setRegion(e){this._injector.get(t.RegionService).setRegion(e)}getCurrentRegion(){return this._injector.get(t.RegionService).getCurrentRegion()}setDirection(e){this._injector.get(t.LocaleService).setDirection(e)}getCurrentLocale(){return this._injector.get(t.LocaleService).getCurrentLocale()}getLocales(){return this._injector.get(t.LocaleService).getLocales()}executeCommand(e,t,n){return this._commandService.executeCommand(e,t,n)}syncExecuteCommand(e,t,n){return this._commandService.syncExecuteCommand(e,t,n)}get Enum(){return m.get()}get Event(){return h.get()}get Util(){return y.get()}addEvent(e,t){if(!e||!t)throw Error(`Cannot add empty event`);return this._eventRegistry.addEvent(e,t)}fireEvent(e,t){return this._eventRegistry.fireEvent(e,t)}getUserManager(){return this._injector.createInstance(v)}newBlob(){return this._injector.createInstance(l,null)}newRichText(){return t.RichTextBuilder.create()}newRichTextFromDocumentData(e){return t.RichTextBuilder.create(e)}newRichTextValue(e){return t.RichTextValue.create(e)}newParagraphStyle(e){return t.ParagraphStyleBuilder.create(e)}newParagraphStyleValue(e){return t.ParagraphStyleValue.create(e)}newTextStyle(e){return t.TextStyleBuilder.create(e)}newTextStyleValue(e){return t.TextStyleValue.create(e)}newTextDecoration(e){return new t.TextDecorationBuilder(e)}};S=b=s([o(0,(0,t.Inject)(t.Injector)),o(1,t.ICommandService),o(2,t.IUniverInstanceService),o(3,(0,t.Inject)(t.LifecycleService))],S),e.FBase=n,e.FBaseInitialable=a,Object.defineProperty(e,"FBlob",{enumerable:!0,get:function(){return l}}),e.FEnum=m,e.FEventName=h,Object.defineProperty(e,"FUniver",{enumerable:!0,get:function(){return S}}),e.FUtil=y});