@univerjs/core 0.2.6 → 0.2.8

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 (105) hide show
  1. package/lib/cjs/index.js +9 -9
  2. package/lib/es/index.js +2025 -244
  3. package/lib/types/common/const.d.ts +1 -1
  4. package/lib/types/common/equal.d.ts +0 -1
  5. package/lib/types/common/error.d.ts +18 -0
  6. package/lib/types/common/interceptor.d.ts +0 -1
  7. package/lib/types/common/unit.d.ts +3 -1
  8. package/lib/types/docs/data-model/document-data-model.d.ts +4 -4
  9. package/lib/types/docs/data-model/empty-snapshot.d.ts +0 -1
  10. package/lib/types/docs/data-model/json-x/json-x.d.ts +2 -2
  11. package/lib/types/docs/data-model/preset-list-type.d.ts +54 -5
  12. package/lib/types/docs/data-model/replacement.d.ts +0 -1
  13. package/lib/types/docs/data-model/text-x/__tests__/transform-position.spec.d.ts +16 -0
  14. package/lib/types/docs/data-model/text-x/__tests__/transform.spec.d.ts +16 -0
  15. package/lib/types/docs/data-model/text-x/action-iterator.d.ts +0 -1
  16. package/lib/types/docs/data-model/text-x/action-types.d.ts +0 -1
  17. package/lib/types/docs/data-model/text-x/apply-utils/common.d.ts +2 -3
  18. package/lib/types/docs/data-model/text-x/apply-utils/delete-apply.d.ts +0 -1
  19. package/lib/types/docs/data-model/text-x/apply-utils/insert-apply.d.ts +0 -1
  20. package/lib/types/docs/data-model/text-x/apply-utils/update-apply.d.ts +0 -1
  21. package/lib/types/docs/data-model/text-x/apply.d.ts +0 -1
  22. package/lib/types/docs/data-model/text-x/text-x.d.ts +31 -2
  23. package/lib/types/docs/data-model/text-x/transform-utils.d.ts +2 -0
  24. package/lib/types/docs/data-model/text-x/utils.d.ts +0 -1
  25. package/lib/types/docs/data-model/types.d.ts +12 -10
  26. package/lib/types/index.d.ts +2 -1
  27. package/lib/types/observer/observable.d.ts +0 -1
  28. package/lib/types/services/__tests__/index.d.ts +0 -1
  29. package/lib/types/services/authz-io/authz-io-local.service.d.ts +2 -3
  30. package/lib/types/services/authz-io/type.d.ts +0 -1
  31. package/lib/types/services/command/command.service.d.ts +0 -1
  32. package/lib/types/services/config/config.service.d.ts +0 -1
  33. package/lib/types/services/context/context.d.ts +3 -1
  34. package/lib/types/services/context/context.service.d.ts +0 -1
  35. package/lib/types/services/error/error.service.d.ts +0 -1
  36. package/lib/types/services/instance/instance.service.d.ts +18 -7
  37. package/lib/types/services/lifecycle/lifecycle.d.ts +0 -1
  38. package/lib/types/services/lifecycle/lifecycle.service.d.ts +0 -1
  39. package/lib/types/services/locale/locale.service.d.ts +0 -1
  40. package/lib/types/services/log/log.service.d.ts +0 -1
  41. package/lib/types/services/permission/permission.service.d.ts +0 -1
  42. package/lib/types/services/permission/type.d.ts +0 -1
  43. package/lib/types/services/plugin/plugin-override.d.ts +0 -1
  44. package/lib/types/services/plugin/plugin.d.ts +0 -1
  45. package/lib/types/services/plugin/plugin.service.d.ts +0 -1
  46. package/lib/types/services/resource-loader/resource-loader.service.d.ts +0 -1
  47. package/lib/types/services/resource-loader/type.d.ts +0 -1
  48. package/lib/types/services/resource-manager/resource-manager.service.d.ts +4 -7
  49. package/lib/types/services/resource-manager/type.d.ts +8 -5
  50. package/lib/types/services/snapshot/__tests__/snapshot-mock.d.ts +0 -1
  51. package/lib/types/services/snapshot/snapshot-server.service.d.ts +0 -1
  52. package/lib/types/services/snapshot/snapshot-transform.d.ts +3 -1
  53. package/lib/types/services/snapshot/snapshot-utils.d.ts +0 -1
  54. package/lib/types/services/theme/theme.service.d.ts +0 -1
  55. package/lib/types/services/undoredo/undoredo.service.d.ts +0 -1
  56. package/lib/types/services/user-manager/const.d.ts +0 -1
  57. package/lib/types/shared/after-init-apply.d.ts +0 -1
  58. package/lib/types/shared/check-if-move.d.ts +0 -1
  59. package/lib/types/shared/clipboard.d.ts +0 -1
  60. package/lib/types/shared/color/color.d.ts +0 -1
  61. package/lib/types/shared/common.d.ts +0 -1
  62. package/lib/types/shared/compare.d.ts +0 -1
  63. package/lib/types/shared/doc-tool.d.ts +0 -1
  64. package/lib/types/shared/index.d.ts +1 -0
  65. package/lib/types/shared/lifecycle.d.ts +0 -1
  66. package/lib/types/shared/lru/lru-map.d.ts +0 -1
  67. package/lib/types/shared/numfmt.d.ts +2 -0
  68. package/lib/types/shared/object-matrix-query.d.ts +0 -1
  69. package/lib/types/shared/object-matrix.d.ts +6 -1
  70. package/lib/types/shared/range.d.ts +0 -1
  71. package/lib/types/shared/rectangle.d.ts +0 -1
  72. package/lib/types/shared/rxjs.d.ts +0 -1
  73. package/lib/types/shared/shape.d.ts +6 -0
  74. package/lib/types/shared/tools.d.ts +11 -1
  75. package/lib/types/sheets/__tests__/create-core-test-bed.d.ts +0 -1
  76. package/lib/types/sheets/column-manager.d.ts +0 -1
  77. package/lib/types/sheets/empty-snapshot.d.ts +0 -1
  78. package/lib/types/sheets/range.d.ts +0 -1
  79. package/lib/types/sheets/row-manager.d.ts +0 -1
  80. package/lib/types/sheets/sheet-snapshot-utils.d.ts +0 -1
  81. package/lib/types/sheets/styles.d.ts +0 -1
  82. package/lib/types/sheets/view-model.d.ts +0 -1
  83. package/lib/types/sheets/workbook.d.ts +1 -1
  84. package/lib/types/sheets/worksheet.d.ts +0 -1
  85. package/lib/types/slides/slide-model.d.ts +18 -4
  86. package/lib/types/types/const/const.d.ts +1 -1
  87. package/lib/types/types/interfaces/i-cell-custom-render.d.ts +0 -1
  88. package/lib/types/types/interfaces/i-cell-data.d.ts +0 -1
  89. package/lib/types/types/interfaces/i-cell-validation-data.d.ts +0 -1
  90. package/lib/types/types/interfaces/i-column-data.d.ts +0 -1
  91. package/lib/types/types/interfaces/i-data-validation.d.ts +0 -1
  92. package/lib/types/types/interfaces/i-document-data-interceptor.d.ts +5 -2
  93. package/lib/types/types/interfaces/i-document-data.d.ts +93 -47
  94. package/lib/types/types/interfaces/i-placeholder.d.ts +0 -1
  95. package/lib/types/types/interfaces/i-row-data.d.ts +0 -1
  96. package/lib/types/types/interfaces/i-selection-data.d.ts +0 -1
  97. package/lib/types/types/interfaces/i-shape-properties.d.ts +0 -1
  98. package/lib/types/types/interfaces/i-slide-data.d.ts +0 -1
  99. package/lib/types/types/interfaces/i-style-data.d.ts +0 -1
  100. package/lib/types/types/interfaces/i-univer-data.d.ts +0 -1
  101. package/lib/types/types/interfaces/i-workbook-data.d.ts +6 -6
  102. package/lib/types/types/interfaces/i-worksheet-data.d.ts +0 -1
  103. package/lib/types/univer.d.ts +0 -1
  104. package/lib/umd/index.js +9 -9
  105. package/package.json +11 -7
@@ -3,7 +3,6 @@ import { IAbsoluteTransform, ISize } from '../../shared/shape';
3
3
  import { BooleanNumber, CellValueType, HorizontalAlign, LocaleType, TextDirection, VerticalAlign, WrapStrategy } from '../enum';
4
4
  import { IExtraModelData } from './i-extra-model-data';
5
5
  import { IColorStyle, IStyleBase } from './i-style-data';
6
-
7
6
  /**
8
7
  * Properties of document
9
8
  */
@@ -25,6 +24,7 @@ export interface IDocumentData extends IReferenceSource, IExtraModelData {
25
24
  disabled?: boolean;
26
25
  }
27
26
  export interface IReferenceSource {
27
+ tableSource?: ITables;
28
28
  footers?: IFooters;
29
29
  headers?: IHeaders;
30
30
  lists?: ILists;
@@ -47,6 +47,9 @@ export interface IHeaders {
47
47
  export interface IFooters {
48
48
  [footerId: string]: IFooterData;
49
49
  }
50
+ export interface ITables {
51
+ [tableId: string]: ITable;
52
+ }
50
53
  /**
51
54
  * Set of lists
52
55
  */
@@ -97,7 +100,7 @@ export interface IDocumentBody {
97
100
  paragraphs?: IParagraph[];
98
101
  sectionBreaks?: ISectionBreak[];
99
102
  customBlocks?: ICustomBlock[];
100
- tables?: ITable[];
103
+ tables?: ICustomTable[];
101
104
  customRanges?: ICustomRange[];
102
105
  customDecorations?: ICustomDecoration[];
103
106
  /**
@@ -144,7 +147,8 @@ export interface IListData {
144
147
  * Contains properties describing the look and feel of a list bullet at a given level of nesting.
145
148
  */
146
149
  export interface INestingLevel {
147
- paragraphProperties?: IParagraphProperties;
150
+ paragraphProperties?: IParagraphStyle;
151
+ paragraphTextStyle?: ITextStyle;
148
152
  bulletAlignment: BulletAlignment;
149
153
  glyphFormat: string;
150
154
  textStyle?: ITextStyle;
@@ -622,79 +626,120 @@ export declare enum TabStopAlignment {
622
626
  export interface IShading {
623
627
  backgroundColor: IColorStyle;
624
628
  }
625
- /**
626
- * Type of width
627
- */
628
- export declare enum WidthType {
629
- EVENLY_DISTRIBUTED = "0",
630
- FIXED_WIDTH = "1"
629
+ export interface IDistFromText {
630
+ distT: number;
631
+ distB: number;
632
+ distL: number;
633
+ distR: number;
634
+ }
635
+ export interface ITableAnchor {
636
+ positionH: IObjectPositionH;
637
+ positionV: IObjectPositionV;
638
+ }
639
+ export declare enum TableSizeType {
640
+ UNSPECIFIED = 0,
641
+ SPECIFIED = 1
642
+ }
643
+ export interface IWidthInTableSize {
644
+ type: TableSizeType;
645
+ width: INumberUnit;
646
+ }
647
+ export declare enum TableAlignmentType {
648
+ START = 0,
649
+ CENTER = 1,
650
+ END = 2
651
+ }
652
+ export declare enum TableLayoutType {
653
+ AUTO_FIT = 0,
654
+ FIXED = 1
655
+ }
656
+ export declare enum TableTextWrapType {
657
+ NONE = 0,
658
+ WRAP = 1
659
+ }
660
+ export interface ICustomTable {
661
+ startIndex: number;
662
+ endIndex: number;
663
+ tableId: string;
631
664
  }
632
665
  /**
633
666
  * Properties of table
634
667
  */
635
668
  export interface ITable {
636
- startIndex: number;
637
- endIndex: number;
638
- rows: number;
639
- columns: number;
640
669
  tableRows: ITableRow[];
641
- tableStyle: WidthType;
642
- width: number;
670
+ tableColumns: ITableColumn[];
671
+ align: TableAlignmentType;
672
+ indent: INumberUnit;
673
+ textWrap: TableTextWrapType;
674
+ position: ITableAnchor;
675
+ dist: IDistFromText;
676
+ size: IWidthInTableSize;
677
+ tableId: string;
678
+ cellMargin?: ITableCellMargin;
679
+ layout?: TableLayoutType;
680
+ overlap?: BooleanNumber;
681
+ description?: string;
682
+ }
683
+ export declare enum TableCellHeightRule {
684
+ AUTO = 0,
685
+ AT_LEAST = 1,
686
+ EXACT = 2
687
+ }
688
+ export interface ITableColumn {
689
+ size: IWidthInTableSize;
690
+ }
691
+ export interface ITableRowSize {
692
+ val: INumberUnit;
693
+ hRule: TableCellHeightRule;
643
694
  }
644
695
  /**
645
696
  * Properties of row of table
646
697
  */
647
698
  export interface ITableRow {
648
- st: number;
649
- ed: number;
650
699
  tableCells: ITableCell[];
651
- tableRowStyle: ITableRowStyle;
652
- }
653
- /**
654
- * Properties of style table row
655
- */
656
- export interface ITableRowStyle {
657
- minRowHeight: number;
700
+ trHeight: ITableRowSize;
701
+ cantSplit?: BooleanNumber;
702
+ isFirstRow?: BooleanNumber;
703
+ repeatHeaderRow?: BooleanNumber;
658
704
  }
659
705
  /**
660
706
  * Properties of table cell
661
707
  */
662
708
  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;
709
+ margin?: ITableCellMargin;
710
+ rowSpan?: number;
711
+ columnSpan?: number;
712
+ backgroundColor?: IColorStyle;
713
+ borderLeft?: ITableCellBorder;
714
+ borderRight?: ITableCellBorder;
715
+ borderTop?: ITableCellBorder;
716
+ borderBottom?: ITableCellBorder;
717
+ size?: IWidthInTableSize;
718
+ tcFitText?: BooleanNumber;
719
+ vAlign?: VerticalAlignmentType;
720
+ }
721
+ export interface ITableCellMargin {
722
+ start: INumberUnit;
723
+ end: INumberUnit;
724
+ top: INumberUnit;
725
+ bottom: INumberUnit;
681
726
  }
682
727
  /**
683
728
  * Properties of cell border
684
729
  */
685
730
  export interface ITableCellBorder {
686
731
  color: IColorStyle;
687
- width: number;
732
+ width: INumberUnit;
688
733
  dashStyle: DashStyleType;
689
734
  }
690
735
  /**
691
736
  * The content alignments for a Shape or TableCell. The supported alignments correspond to predefined text anchoring types from the ECMA-376 standard.
692
737
  */
693
- export declare enum ContentAlignment {
738
+ export declare enum VerticalAlignmentType {
694
739
  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.
740
+ BOTH = 1,
696
741
  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'.
742
+ CENTER = 3,// An alignment that aligns the content to the middle of the content holder. Corresponds to ECMA-376 ST_TextAnchoringType 'ctr'.
698
743
  BOTTOM = 4
699
744
  }
700
745
  /**
@@ -745,7 +790,8 @@ export declare enum NumberUnitType {
745
790
  POINT = 0,
746
791
  LINE = 1,
747
792
  CHARACTER = 2,
748
- PIXEL = 3
793
+ PIXEL = 3,
794
+ PERCENT = 4
749
795
  }
750
796
  export declare enum AlignTypeH {
751
797
  CENTER = 0,
@@ -1,5 +1,4 @@
1
1
  import { PlaceholderType } from '../enum/place-holder-type';
2
-
3
2
  export interface IPlaceholder {
4
3
  type: PlaceholderType;
5
4
  index: number;
@@ -1,5 +1,4 @@
1
1
  import { BooleanNumber } from '../enum';
2
-
3
2
  /**
4
3
  * Properties of row data
5
4
  */
@@ -1,6 +1,5 @@
1
1
  import { Nullable } from '../../shared/types';
2
2
  import { IRange } from './i-range';
3
-
4
3
  /**
5
4
  * Properties of selection data
6
5
  */
@@ -1,6 +1,5 @@
1
1
  import { BorderStyleTypes } from '../enum/border-style-types';
2
2
  import { IColorStyle } from './i-style-data';
3
-
4
3
  /**
5
4
  * ShapeProperties
6
5
  */
@@ -9,7 +9,6 @@ import { IPlaceholder } from './i-placeholder';
9
9
  import { IShapeProperties } from './i-shape-properties';
10
10
  import { IColorStyle, IStyleBase, IStyleData } from './i-style-data';
11
11
  import { IWorksheetData } from './i-worksheet-data';
12
-
13
12
  export interface ISlideData extends IReferenceSource, IExtraModelData {
14
13
  id: string;
15
14
  locale?: LocaleType;
@@ -2,7 +2,6 @@ import { Nullable } from '../../shared/types';
2
2
  import { BorderStyleTypes } from '../enum/border-style-types';
3
3
  import { BaselineOffset, BooleanNumber, HorizontalAlign, TextDecoration, TextDirection, VerticalAlign, WrapStrategy } from '../enum/text-style';
4
4
  import { ThemeColorType } from '../enum/theme-color-type';
5
-
6
5
  /**
7
6
  * Properties of text decoration
8
7
  */
@@ -3,7 +3,6 @@ import { DependencyOverride } from '../../services/plugin/plugin-override';
3
3
  import { IStyleSheet } from '../../services/theme/theme.service';
4
4
  import { ILocales } from '../../shared/locale';
5
5
  import { LocaleType } from '../enum';
6
-
7
6
  export interface IUniverData {
8
7
  theme: IStyleSheet;
9
8
  locale: LocaleType;
@@ -3,7 +3,11 @@ import { LocaleType } from '../enum';
3
3
  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
+ export type Resources = Array<{
7
+ id?: string;
8
+ name: string;
9
+ data: string;
10
+ }>;
7
11
  /**
8
12
  * Properties of a workbook's configuration
9
13
  */
@@ -31,9 +35,5 @@ export interface IWorkbookData extends IExtraModelData {
31
35
  sheets: {
32
36
  [sheetId: string]: Partial<IWorksheetData>;
33
37
  };
34
- resources?: Array<{
35
- id?: string;
36
- name: string;
37
- data: string;
38
- }>;
38
+ resources?: Resources;
39
39
  }
@@ -5,7 +5,6 @@ import { IColumnData } from './i-column-data';
5
5
  import { IFreeze } from './i-freeze';
6
6
  import { IRange, IRangeType } from './i-range';
7
7
  import { IRowData } from './i-row-data';
8
-
9
8
  /**
10
9
  * Snapshot of a worksheet.
11
10
  */
@@ -6,7 +6,6 @@ import { LocaleType } from './types/enum/locale-type';
6
6
  import { IDocumentData, ISlideData, IUniverData, IWorkbookData } from './types/interfaces';
7
7
  import { UnitModel, UnitType } from './common/unit';
8
8
  import { Plugin, PluginCtor } from './services/plugin/plugin';
9
-
10
9
  export declare class Univer {
11
10
  private _startedTypes;
12
11
  private _injector;