@univerjs/core 0.2.5 → 0.2.7

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 (33) hide show
  1. package/lib/cjs/index.js +10 -10
  2. package/lib/es/index.js +8406 -7042
  3. package/lib/types/common/const.d.ts +1 -1
  4. package/lib/types/common/error.d.ts +18 -0
  5. package/lib/types/common/unit.d.ts +3 -0
  6. package/lib/types/docs/data-model/document-data-model.d.ts +4 -0
  7. package/lib/types/docs/data-model/json-x/json-x.d.ts +2 -1
  8. package/lib/types/docs/data-model/preset-list-type.d.ts +54 -4
  9. package/lib/types/docs/data-model/text-x/__tests__/transform-position.spec.d.ts +16 -0
  10. package/lib/types/docs/data-model/text-x/__tests__/transform.spec.d.ts +16 -0
  11. package/lib/types/docs/data-model/text-x/apply-utils/common.d.ts +2 -2
  12. package/lib/types/docs/data-model/text-x/text-x.d.ts +31 -1
  13. package/lib/types/docs/data-model/text-x/transform-utils.d.ts +3 -0
  14. package/lib/types/docs/data-model/types.d.ts +12 -10
  15. package/lib/types/index.d.ts +2 -1
  16. package/lib/types/services/context/context.d.ts +3 -1
  17. package/lib/types/services/instance/instance.service.d.ts +18 -6
  18. package/lib/types/services/plugin/plugin.d.ts +1 -1
  19. package/lib/types/services/plugin/plugin.service.d.ts +1 -0
  20. package/lib/types/services/resource-manager/resource-manager.service.d.ts +4 -6
  21. package/lib/types/services/resource-manager/type.d.ts +8 -4
  22. package/lib/types/services/snapshot/snapshot-transform.d.ts +3 -0
  23. package/lib/types/services/snapshot/snapshot-utils.d.ts +2 -2
  24. package/lib/types/shared/shape.d.ts +6 -0
  25. package/lib/types/shared/tools.d.ts +11 -0
  26. package/lib/types/sheets/workbook.d.ts +1 -0
  27. package/lib/types/slides/slide-model.d.ts +24 -2
  28. package/lib/types/types/enum/text-style.d.ts +3 -1
  29. package/lib/types/types/interfaces/i-document-data-interceptor.d.ts +5 -1
  30. package/lib/types/types/interfaces/i-document-data.d.ts +166 -57
  31. package/lib/types/types/interfaces/i-workbook-data.d.ts +6 -5
  32. package/lib/umd/index.js +10 -10
  33. package/package.json +10 -7
@@ -25,6 +25,7 @@ export interface IDocumentData extends IReferenceSource, IExtraModelData {
25
25
  disabled?: boolean;
26
26
  }
27
27
  export interface IReferenceSource {
28
+ tableSource?: ITables;
28
29
  footers?: IFooters;
29
30
  headers?: IHeaders;
30
31
  lists?: ILists;
@@ -47,6 +48,9 @@ export interface IHeaders {
47
48
  export interface IFooters {
48
49
  [footerId: string]: IFooterData;
49
50
  }
51
+ export interface ITables {
52
+ [tableId: string]: ITable;
53
+ }
50
54
  /**
51
55
  * Set of lists
52
56
  */
@@ -97,7 +101,7 @@ export interface IDocumentBody {
97
101
  paragraphs?: IParagraph[];
98
102
  sectionBreaks?: ISectionBreak[];
99
103
  customBlocks?: ICustomBlock[];
100
- tables?: ITable[];
104
+ tables?: ICustomTable[];
101
105
  customRanges?: ICustomRange[];
102
106
  customDecorations?: ICustomDecoration[];
103
107
  /**
@@ -143,12 +147,14 @@ export interface IListData {
143
147
  /**
144
148
  * Contains properties describing the look and feel of a list bullet at a given level of nesting.
145
149
  */
146
- export interface INestingLevel extends IIndentStart {
150
+ export interface INestingLevel {
151
+ paragraphProperties?: IParagraphStyle;
152
+ paragraphTextStyle?: ITextStyle;
147
153
  bulletAlignment: BulletAlignment;
148
154
  glyphFormat: string;
149
- textStyle: ITextStyle;
155
+ textStyle?: ITextStyle;
150
156
  startNumber: number;
151
- glyphType?: GlyphType | string;
157
+ glyphType?: GlyphType;
152
158
  glyphSymbol?: string;
153
159
  }
154
160
  /**
@@ -163,14 +169,71 @@ export declare enum FollowNumberWithType {
163
169
  * An enumeration of the supported glyph types.
164
170
  */
165
171
  export declare enum GlyphType {
166
- GLYPH_TYPE_UNSPECIFIED = 0,// The glyph type is unspecified or unsupported.
172
+ BULLET = 0,// The glyph type is unspecified or unsupported.
167
173
  NONE = 1,// An empty string.
168
174
  DECIMAL = 2,// A number, like 1, 2, or 3.
169
- ZERO_DECIMAL = 3,// A number where single digit numbers are prefixed with a zero, like 01, 02, or 03. Numbers with more than one digit are not prefixed with a zero.
170
- UPPER_ALPHA = 4,// An uppercase letter, like A, B, or C.
171
- ALPHA = 5,// A lowercase letter, like a, b, or c.
175
+ DECIMAL_ZERO = 3,// A number where single digit numbers are prefixed with a zero, like 01, 02, or 03. Numbers with more than one digit are not prefixed with a zero.
176
+ UPPER_LETTER = 4,// An uppercase letter, like A, B, or C.
177
+ LOWER_LETTER = 5,// A lowercase letter, like a, b, or c.
172
178
  UPPER_ROMAN = 6,// An uppercase Roman numeral, like I, II, or III.
173
- ROMAN = 7
179
+ LOWER_ROMAN = 7,// A lowercase Roman numeral, like i, ii, or iii.
180
+ /**
181
+ * Not yet achieved, aligned with Excel's standards.
182
+ * 17.18.59 ST_NumberFormat (Numbering Format)
183
+ */
184
+ ORDINAL = 8,
185
+ CARDINAL_TEXT = 9,
186
+ ORDINAL_TEXT = 10,
187
+ HEX = 11,
188
+ CHICAGO = 12,
189
+ IDEOGRAPH_DIGITAL = 13,
190
+ JAPANESE_COUNTING = 14,
191
+ AIUEO = 15,
192
+ IROHA = 16,
193
+ DECIMAL_FULL_WIDTH = 17,
194
+ DECIMAL_HALF_WIDTH = 18,
195
+ JAPANESE_LEGAL = 19,
196
+ JAPANESE_DIGITAL_TEN_THOUSAND = 20,
197
+ DECIMAL_ENCLOSED_CIRCLE = 21,
198
+ DECIMAL_FULL_WIDTH2 = 22,
199
+ AIUEO_FULL_WIDTH = 23,
200
+ IROHA_FULL_WIDTH = 24,
201
+ GANADA = 25,
202
+ CHOSUNG = 26,
203
+ DECIMAL_ENCLOSED_FULLSTOP = 27,
204
+ DECIMAL_ENCLOSED_PAREN = 28,
205
+ DECIMAL_ENCLOSED_CIRCLE_CHINESE = 29,
206
+ IDEOGRAPH_ENCLOSED_CIRCLE = 30,
207
+ IDEOGRAPH_TRADITIONAL = 31,
208
+ IDEOGRAPH_ZODIAC = 32,
209
+ IDEOGRAPH_ZODIAC_TRADITIONAL = 33,
210
+ TAIWANESE_COUNTING = 34,
211
+ IDEOGRAPH_LEGAL_TRADITIONAL = 35,
212
+ TAIWANESE_COUNTING_THOUSAND = 36,
213
+ TAIWANESE_DIGITAL = 37,
214
+ CHINESE_COUNTING = 38,
215
+ CHINESE_LEGAL_SIMPLIFIED = 39,
216
+ CHINESE_COUNTING_THOUSAND = 40,
217
+ KOREAN_DIGITAL = 41,
218
+ KOREAN_COUNTING = 42,
219
+ KOREAN_LEGAL = 43,
220
+ KOREAN_DIGITAL2 = 44,
221
+ VIETNAMESE_COUNTING = 45,
222
+ RUSSIAN_LOWER = 46,
223
+ RUSSIAN_UPPER = 47,
224
+ NUMBER_IN_DASH = 48,
225
+ HEBREW1 = 49,
226
+ HEBREW2 = 50,
227
+ ARABIC_ALPHA = 51,
228
+ ARABIC_ABJAD = 52,
229
+ HINDI_VOWELS = 53,
230
+ HINDI_CONSONANTS = 54,
231
+ HINDI_NUMBERS = 55,
232
+ HINDI_COUNTING = 56,
233
+ THAI_LETTERS = 57,
234
+ THAI_NUMBERS = 58,
235
+ THAI_COUNTING = 59,
236
+ CUSTOM = 60
174
237
  }
175
238
  /**
176
239
  * The types of alignment for a bullet.
@@ -179,7 +242,8 @@ export declare enum BulletAlignment {
179
242
  BULLET_ALIGNMENT_UNSPECIFIED = 0,// The bullet alignment is unspecified.
180
243
  START = 1,// The bullet is aligned to the start of the space allotted for rendering the bullet. Left-aligned for LTR text, right-aligned otherwise.
181
244
  CENTER = 2,// The bullet is aligned to the center of the space allotted for rendering the bullet.
182
- END = 3
245
+ END = 3,// The bullet is aligned to the end of the space allotted for rendering the bullet. Right-aligned for LTR text, left-aligned otherwise.
246
+ BOTH = 4
183
247
  }
184
248
  export interface IMargin {
185
249
  marginTop?: number;
@@ -393,7 +457,7 @@ export interface IBullet {
393
457
  listType: string;
394
458
  listId: string;
395
459
  nestingLevel: number;
396
- textStyle: ITextStyle;
460
+ textStyle?: ITextStyle;
397
461
  }
398
462
  /**
399
463
  * Properties of Drawing
@@ -468,11 +532,15 @@ export interface IIndentStart {
468
532
  hanging?: INumberUnit;
469
533
  indentStart?: INumberUnit;
470
534
  tabStops?: ITabStop[];
535
+ indentEnd?: INumberUnit;
471
536
  }
472
537
  /**
473
538
  * Properties of paragraph style
474
539
  */
475
- export interface IParagraphStyle extends IIndentStart {
540
+ export interface IParagraphStyle extends IParagraphProperties {
541
+ textStyle?: ITextStyle;
542
+ }
543
+ export interface IParagraphProperties extends IIndentStart {
476
544
  headingId?: string;
477
545
  namedStyleType?: NamedStyleType;
478
546
  horizontalAlign?: HorizontalAlign;
@@ -487,7 +555,6 @@ export interface IParagraphStyle extends IIndentStart {
487
555
  borderBottom?: IParagraphBorder;
488
556
  borderLeft?: IParagraphBorder;
489
557
  borderRight?: IParagraphBorder;
490
- indentEnd?: INumberUnit;
491
558
  keepLines?: BooleanNumber;
492
559
  keepNext?: BooleanNumber;
493
560
  wordWrap?: BooleanNumber;
@@ -560,79 +627,120 @@ export declare enum TabStopAlignment {
560
627
  export interface IShading {
561
628
  backgroundColor: IColorStyle;
562
629
  }
563
- /**
564
- * Type of width
565
- */
566
- export declare enum WidthType {
567
- EVENLY_DISTRIBUTED = "0",
568
- FIXED_WIDTH = "1"
630
+ export interface IDistFromText {
631
+ distT: number;
632
+ distB: number;
633
+ distL: number;
634
+ distR: number;
635
+ }
636
+ export interface ITableAnchor {
637
+ positionH: IObjectPositionH;
638
+ positionV: IObjectPositionV;
639
+ }
640
+ export declare enum TableSizeType {
641
+ UNSPECIFIED = 0,
642
+ SPECIFIED = 1
643
+ }
644
+ export interface IWidthInTableSize {
645
+ type: TableSizeType;
646
+ width: INumberUnit;
647
+ }
648
+ export declare enum TableAlignmentType {
649
+ START = 0,
650
+ CENTER = 1,
651
+ END = 2
652
+ }
653
+ export declare enum TableLayoutType {
654
+ AUTO_FIT = 0,
655
+ FIXED = 1
656
+ }
657
+ export declare enum TableTextWrapType {
658
+ NONE = 0,
659
+ WRAP = 1
660
+ }
661
+ export interface ICustomTable {
662
+ startIndex: number;
663
+ endIndex: number;
664
+ tableId: string;
569
665
  }
570
666
  /**
571
667
  * Properties of table
572
668
  */
573
669
  export interface ITable {
574
- startIndex: number;
575
- endIndex: number;
576
- rows: number;
577
- columns: number;
578
670
  tableRows: ITableRow[];
579
- tableStyle: WidthType;
580
- width: number;
671
+ tableColumns: ITableColumn[];
672
+ align: TableAlignmentType;
673
+ indent: INumberUnit;
674
+ textWrap: TableTextWrapType;
675
+ position: ITableAnchor;
676
+ dist: IDistFromText;
677
+ size: IWidthInTableSize;
678
+ tableId: string;
679
+ cellMargin?: ITableCellMargin;
680
+ layout?: TableLayoutType;
681
+ overlap?: BooleanNumber;
682
+ description?: string;
683
+ }
684
+ export declare enum TableCellHeightRule {
685
+ AUTO = 0,
686
+ AT_LEAST = 1,
687
+ EXACT = 2
688
+ }
689
+ export interface ITableColumn {
690
+ size: IWidthInTableSize;
691
+ }
692
+ export interface ITableRowSize {
693
+ val: INumberUnit;
694
+ hRule: TableCellHeightRule;
581
695
  }
582
696
  /**
583
697
  * Properties of row of table
584
698
  */
585
699
  export interface ITableRow {
586
- st: number;
587
- ed: number;
588
700
  tableCells: ITableCell[];
589
- tableRowStyle: ITableRowStyle;
590
- }
591
- /**
592
- * Properties of style table row
593
- */
594
- export interface ITableRowStyle {
595
- minRowHeight: number;
701
+ trHeight: ITableRowSize;
702
+ cantSplit?: BooleanNumber;
703
+ isFirstRow?: BooleanNumber;
704
+ repeatHeaderRow?: BooleanNumber;
596
705
  }
597
706
  /**
598
707
  * Properties of table cell
599
708
  */
600
709
  export interface ITableCell {
601
- tableCellStyle: ITableCellStyle;
602
- }
603
- /**
604
- * Properties of style of table cell
605
- */
606
- export interface ITableCellStyle {
607
- rowSpan: number;
608
- columnSpan: number;
609
- backgroundColor: IColorStyle;
610
- borderLeft: ITableCellBorder;
611
- borderRight: ITableCellBorder;
612
- borderTop: ITableCellBorder;
613
- borderBottom: ITableCellBorder;
614
- paddingLeft: number;
615
- paddingRight: number;
616
- paddingTop: number;
617
- paddingBottom: number;
618
- contentAlignment: ContentAlignment;
710
+ margin?: ITableCellMargin;
711
+ rowSpan?: number;
712
+ columnSpan?: number;
713
+ backgroundColor?: IColorStyle;
714
+ borderLeft?: ITableCellBorder;
715
+ borderRight?: ITableCellBorder;
716
+ borderTop?: ITableCellBorder;
717
+ borderBottom?: ITableCellBorder;
718
+ size?: IWidthInTableSize;
719
+ tcFitText?: BooleanNumber;
720
+ vAlign?: VerticalAlignmentType;
721
+ }
722
+ export interface ITableCellMargin {
723
+ start: INumberUnit;
724
+ end: INumberUnit;
725
+ top: INumberUnit;
726
+ bottom: INumberUnit;
619
727
  }
620
728
  /**
621
729
  * Properties of cell border
622
730
  */
623
731
  export interface ITableCellBorder {
624
732
  color: IColorStyle;
625
- width: number;
733
+ width: INumberUnit;
626
734
  dashStyle: DashStyleType;
627
735
  }
628
736
  /**
629
737
  * The content alignments for a Shape or TableCell. The supported alignments correspond to predefined text anchoring types from the ECMA-376 standard.
630
738
  */
631
- export declare enum ContentAlignment {
739
+ export declare enum VerticalAlignmentType {
632
740
  CONTENT_ALIGNMENT_UNSPECIFIED = 0,// An unspecified content alignment. The content alignment is inherited from the parent if one exists.
633
- CONTENT_ALIGNMENT_UNSUPPORTED = 1,// An unsupported content alignment.
741
+ BOTH = 1,
634
742
  TOP = 2,// An alignment that aligns the content to the top of the content holder. Corresponds to ECMA-376 ST_TextAnchoringType 't'.
635
- MIDDLE = 3,// An alignment that aligns the content to the middle of the content holder. Corresponds to ECMA-376 ST_TextAnchoringType 'ctr'.
743
+ CENTER = 3,// An alignment that aligns the content to the middle of the content holder. Corresponds to ECMA-376 ST_TextAnchoringType 'ctr'.
636
744
  BOTTOM = 4
637
745
  }
638
746
  /**
@@ -683,7 +791,8 @@ export declare enum NumberUnitType {
683
791
  POINT = 0,
684
792
  LINE = 1,
685
793
  CHARACTER = 2,
686
- PIXEL = 3
794
+ PIXEL = 3,
795
+ PERCENT = 4
687
796
  }
688
797
  export declare enum AlignTypeH {
689
798
  CENTER = 0,
@@ -4,6 +4,11 @@ import { IExtraModelData } from './i-extra-model-data';
4
4
  import { IStyleData } from './i-style-data';
5
5
  import { IWorksheetData } from './i-worksheet-data';
6
6
 
7
+ export type Resources = Array<{
8
+ id?: string;
9
+ name: string;
10
+ data: string;
11
+ }>;
7
12
  /**
8
13
  * Properties of a workbook's configuration
9
14
  */
@@ -31,9 +36,5 @@ export interface IWorkbookData extends IExtraModelData {
31
36
  sheets: {
32
37
  [sheetId: string]: Partial<IWorksheetData>;
33
38
  };
34
- resources?: Array<{
35
- id?: string;
36
- name: string;
37
- data: string;
38
- }>;
39
+ resources?: Resources;
39
40
  }