@univerjs/core 0.2.6 → 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 (29) hide show
  1. package/lib/cjs/index.js +7 -7
  2. package/lib/es/index.js +1181 -209
  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 -3
  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/resource-manager/resource-manager.service.d.ts +4 -6
  19. package/lib/types/services/resource-manager/type.d.ts +8 -4
  20. package/lib/types/services/snapshot/snapshot-transform.d.ts +3 -0
  21. package/lib/types/shared/shape.d.ts +6 -0
  22. package/lib/types/shared/tools.d.ts +11 -0
  23. package/lib/types/sheets/workbook.d.ts +1 -0
  24. package/lib/types/slides/slide-model.d.ts +18 -3
  25. package/lib/types/types/interfaces/i-document-data-interceptor.d.ts +5 -1
  26. package/lib/types/types/interfaces/i-document-data.d.ts +93 -46
  27. package/lib/types/types/interfaces/i-workbook-data.d.ts +6 -5
  28. package/lib/umd/index.js +7 -7
  29. package/package.json +8 -5
@@ -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
  /**
@@ -144,7 +148,8 @@ export interface IListData {
144
148
  * Contains properties describing the look and feel of a list bullet at a given level of nesting.
145
149
  */
146
150
  export interface INestingLevel {
147
- paragraphProperties?: IParagraphProperties;
151
+ paragraphProperties?: IParagraphStyle;
152
+ paragraphTextStyle?: ITextStyle;
148
153
  bulletAlignment: BulletAlignment;
149
154
  glyphFormat: string;
150
155
  textStyle?: ITextStyle;
@@ -622,79 +627,120 @@ export declare enum TabStopAlignment {
622
627
  export interface IShading {
623
628
  backgroundColor: IColorStyle;
624
629
  }
625
- /**
626
- * Type of width
627
- */
628
- export declare enum WidthType {
629
- EVENLY_DISTRIBUTED = "0",
630
- 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;
631
665
  }
632
666
  /**
633
667
  * Properties of table
634
668
  */
635
669
  export interface ITable {
636
- startIndex: number;
637
- endIndex: number;
638
- rows: number;
639
- columns: number;
640
670
  tableRows: ITableRow[];
641
- tableStyle: WidthType;
642
- 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;
643
695
  }
644
696
  /**
645
697
  * Properties of row of table
646
698
  */
647
699
  export interface ITableRow {
648
- st: number;
649
- ed: number;
650
700
  tableCells: ITableCell[];
651
- tableRowStyle: ITableRowStyle;
652
- }
653
- /**
654
- * Properties of style table row
655
- */
656
- export interface ITableRowStyle {
657
- minRowHeight: number;
701
+ trHeight: ITableRowSize;
702
+ cantSplit?: BooleanNumber;
703
+ isFirstRow?: BooleanNumber;
704
+ repeatHeaderRow?: BooleanNumber;
658
705
  }
659
706
  /**
660
707
  * Properties of table cell
661
708
  */
662
709
  export interface ITableCell {
663
- tableCellStyle: ITableCellStyle;
664
- }
665
- /**
666
- * Properties of style of table cell
667
- */
668
- export interface ITableCellStyle {
669
- rowSpan: number;
670
- columnSpan: number;
671
- backgroundColor: IColorStyle;
672
- borderLeft: ITableCellBorder;
673
- borderRight: ITableCellBorder;
674
- borderTop: ITableCellBorder;
675
- borderBottom: ITableCellBorder;
676
- paddingLeft: number;
677
- paddingRight: number;
678
- paddingTop: number;
679
- paddingBottom: number;
680
- 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;
681
727
  }
682
728
  /**
683
729
  * Properties of cell border
684
730
  */
685
731
  export interface ITableCellBorder {
686
732
  color: IColorStyle;
687
- width: number;
733
+ width: INumberUnit;
688
734
  dashStyle: DashStyleType;
689
735
  }
690
736
  /**
691
737
  * The content alignments for a Shape or TableCell. The supported alignments correspond to predefined text anchoring types from the ECMA-376 standard.
692
738
  */
693
- export declare enum ContentAlignment {
739
+ export declare enum VerticalAlignmentType {
694
740
  CONTENT_ALIGNMENT_UNSPECIFIED = 0,// An unspecified content alignment. The content alignment is inherited from the parent if one exists.
695
- CONTENT_ALIGNMENT_UNSUPPORTED = 1,// An unsupported content alignment.
741
+ BOTH = 1,
696
742
  TOP = 2,// An alignment that aligns the content to the top of the content holder. Corresponds to ECMA-376 ST_TextAnchoringType 't'.
697
- 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'.
698
744
  BOTTOM = 4
699
745
  }
700
746
  /**
@@ -745,7 +791,8 @@ export declare enum NumberUnitType {
745
791
  POINT = 0,
746
792
  LINE = 1,
747
793
  CHARACTER = 2,
748
- PIXEL = 3
794
+ PIXEL = 3,
795
+ PERCENT = 4
749
796
  }
750
797
  export declare enum AlignTypeH {
751
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
  }