@univerjs/core 1.0.0-alpha.2 → 1.0.0-alpha.4
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.
- package/lib/cjs/facade.js +85 -27
- package/lib/cjs/index.js +16381 -10924
- package/lib/es/facade.js +86 -28
- package/lib/es/index.js +16321 -10901
- package/lib/facade.js +86 -28
- package/lib/index.js +16321 -10901
- package/lib/types/bases/base-data-model.d.ts +4 -0
- package/lib/types/bases/empty-snapshot.d.ts +2 -1
- package/lib/types/bases/index.d.ts +3 -2
- package/lib/types/bases/typedef.d.ts +80 -67
- package/lib/types/common/regexp/charset.d.ts +63 -0
- package/lib/types/common/regexp/escape.d.ts +30 -0
- package/lib/types/common/regexp/factory.d.ts +16 -0
- package/lib/types/common/regexp/index.d.ts +37 -0
- package/lib/types/common/regexp/or.d.ts +57 -0
- package/lib/types/docs/data-model/empty-snapshot.d.ts +2 -1
- package/lib/types/docs/data-model/index.d.ts +21 -0
- package/lib/types/docs/data-model/paragraph-style.d.ts +22 -0
- package/lib/types/docs/data-model/preset-list-type.d.ts +19 -6
- package/lib/types/docs/data-model/rich-text-builder.d.ts +455 -1
- package/lib/types/docs/data-model/text-x/action-types.d.ts +1 -0
- package/lib/types/docs/data-model/text-x/apply-utils/common.d.ts +4 -1
- package/lib/types/docs/data-model/text-x/build-utils/data-stream-change.d.ts +28 -0
- package/lib/types/docs/data-model/text-x/build-utils/drawings.d.ts +2 -2
- package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +6 -0
- package/lib/types/docs/data-model/text-x/build-utils/paragraph.d.ts +4 -1
- package/lib/types/docs/data-model/text-x/build-utils/range-interval.d.ts +74 -0
- package/lib/types/docs/data-model/text-x/structure-validator.d.ts +31 -0
- package/lib/types/docs/data-model/text-x/utils.d.ts +12 -4
- package/lib/types/docs/index.d.ts +5 -0
- package/lib/types/docs/section-break-id.d.ts +19 -0
- package/lib/types/docs/section-header-footer.d.ts +32 -0
- package/lib/types/facade/f-enum.d.ts +40 -1
- package/lib/types/facade/f-hooks.d.ts +8 -0
- package/lib/types/facade/f-univer.d.ts +28 -27
- package/lib/types/index.d.ts +3 -32
- package/lib/types/services/authz-io/authz-io-local.service.d.ts +1 -1
- package/lib/types/services/instance/instance.service.d.ts +26 -0
- package/lib/types/services/resource-manager/type.d.ts +1 -1
- package/lib/types/shared/date-kit.d.ts +1 -0
- package/lib/types/shared/numfmt/api.d.ts +82 -0
- package/lib/types/shared/numfmt/clamp.d.ts +16 -0
- package/lib/types/shared/numfmt/code-to-locale.d.ts +16 -0
- package/lib/types/shared/numfmt/constants.d.ts +68 -0
- package/lib/types/shared/numfmt/dec-to-frac.d.ts +26 -0
- package/lib/types/shared/numfmt/decimal.d.ts +37 -0
- package/lib/types/shared/numfmt/format-info.d.ts +21 -0
- package/lib/types/shared/numfmt/format-number.d.ts +18 -0
- package/lib/types/shared/numfmt/general.d.ts +18 -0
- package/lib/types/shared/numfmt/index.d.ts +18 -0
- package/lib/types/shared/numfmt/locale.d.ts +89 -0
- package/lib/types/shared/numfmt/num-dec.d.ts +17 -0
- package/lib/types/shared/numfmt/number-props.d.ts +17 -0
- package/lib/types/shared/numfmt/options.d.ts +17 -0
- package/lib/types/shared/numfmt/pad.d.ts +22 -0
- package/lib/types/shared/numfmt/parse-format-section.d.ts +17 -0
- package/lib/types/shared/numfmt/parse-pattern.d.ts +18 -0
- package/lib/types/shared/numfmt/parse-value.d.ts +30 -0
- package/lib/types/shared/numfmt/round.d.ts +26 -0
- package/lib/types/shared/numfmt/run-part.d.ts +18 -0
- package/lib/types/shared/numfmt/serial-date.d.ts +32 -0
- package/lib/types/shared/numfmt/to-ymd.d.ts +20 -0
- package/lib/types/shared/numfmt/tokenize.d.ts +20 -0
- package/lib/types/shared/numfmt/types.d.ts +193 -0
- package/lib/types/shared/{numfmt.d.ts → numfmt/utils.d.ts} +3 -4
- package/lib/types/shared/tools.d.ts +0 -11
- package/lib/types/sheets/index.d.ts +26 -0
- package/lib/types/sheets/typedef.d.ts +2 -0
- package/lib/types/types/const/const.d.ts +0 -1
- package/lib/types/types/enum/locale-type.d.ts +9 -0
- package/lib/types/types/interfaces/i-document-data-interceptor.d.ts +1 -0
- package/lib/types/types/interfaces/i-document-data.d.ts +39 -2
- package/lib/types/types/interfaces/i-drawing.d.ts +25 -1
- package/lib/types/types/interfaces/i-style-data.d.ts +4 -6
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +21 -11
- package/package.json +5 -6
package/lib/es/facade.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbsoluteRefType, AutoFillSeries, BaselineOffset, BooleanNumber, BorderStyleTypes, BorderType, CanceledError, ColorType, CommandType, CommonHideTypes, CopyPasteType, DataValidationErrorStyle, DataValidationOperator, DataValidationRenderMode, DataValidationStatus, DataValidationType, DeleteDirection, DeveloperMetadataVisibility, Dimension, Direction, Disposable, HorizontalAlign, ICommandService, IUndoRedoService, IUniverInstanceService, Inject, Injector, InterpolationPointType, LifecycleService, LifecycleStages, LocaleService, LocaleType, MentionType, ParagraphStyleBuilder, ParagraphStyleValue, ProtectionType, Rectangle, RedoCommand, Registry, RelativeDate, RichTextBuilder, RichTextValue, SheetTypes, TextDecoration, TextDecorationBuilder, TextDirection, TextStyleBuilder, TextStyleValue, ThemeColorType, ThemeService, Tools, UndoCommand, Univer, UniverInstanceType, UserManagerService, VerticalAlign, WrapStrategy, numfmt, toDisposable } from "@univerjs/core";
|
|
1
|
+
import { AbsoluteRefType, AutoFillSeries, BaselineOffset, BooleanNumber, BorderStyleTypes, BorderType, CanceledError, ColorType, CommandType, CommonHideTypes, CopyPasteType, DataValidationErrorStyle, DataValidationOperator, DataValidationRenderMode, DataValidationStatus, DataValidationType, DeleteDirection, DeveloperMetadataVisibility, Dimension, Direction, Disposable, HorizontalAlign, ICommandService, IUndoRedoService, IUniverInstanceService, ImageSourceType, Inject, Injector, InterpolationPointType, LifecycleService, LifecycleStages, LocaleService, LocaleType, MentionType, NumberUnitType, ParagraphStyleBuilder, ParagraphStyleValue, PresetListType, ProtectionType, Rectangle, RedoCommand, Registry, RelativeDate, RichTextBuilder, RichTextValue, SheetTypes, SpacingRule, TextDecoration, TextDecorationBuilder, TextDirection, TextStyleBuilder, TextStyleValue, ThemeColorType, ThemeService, Tools, UndoCommand, Univer, UniverInstanceType, UserManagerService, VerticalAlign, WrapStrategy, numfmt, toDisposable } from "@univerjs/core";
|
|
2
2
|
import { filter } from "rxjs";
|
|
3
3
|
|
|
4
4
|
//#region src/facade/f-base.ts
|
|
@@ -428,6 +428,42 @@ var FEnum = class FEnum {
|
|
|
428
428
|
return HorizontalAlign;
|
|
429
429
|
}
|
|
430
430
|
/**
|
|
431
|
+
* Paragraph line-height interpretation modes
|
|
432
|
+
*
|
|
433
|
+
* @example
|
|
434
|
+
* ```ts
|
|
435
|
+
* console.log(univerAPI.Enum.SpacingRule.EXACT);
|
|
436
|
+
* ```
|
|
437
|
+
*/
|
|
438
|
+
get SpacingRule() {
|
|
439
|
+
return SpacingRule;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Units accepted by document lengths such as paragraph indentation and spacing
|
|
443
|
+
*
|
|
444
|
+
* Agent-facing rich-text helpers accept plain numbers as document points, so this enum is only needed when an
|
|
445
|
+
* explicit alternative unit is required.
|
|
446
|
+
*
|
|
447
|
+
* @example
|
|
448
|
+
* ```ts
|
|
449
|
+
* console.log(univerAPI.Enum.NumberUnitType.POINT);
|
|
450
|
+
* ```
|
|
451
|
+
*/
|
|
452
|
+
get NumberUnitType() {
|
|
453
|
+
return NumberUnitType;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Preset ordered, unordered, and checklist styles used by rich-text list items
|
|
457
|
+
*
|
|
458
|
+
* @example
|
|
459
|
+
* ```ts
|
|
460
|
+
* console.log(univerAPI.Enum.PresetListType.BULLET_LIST);
|
|
461
|
+
* ```
|
|
462
|
+
*/
|
|
463
|
+
get PresetListType() {
|
|
464
|
+
return PresetListType;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
431
467
|
* Different text decoration styles
|
|
432
468
|
*
|
|
433
469
|
* @example
|
|
@@ -658,6 +694,17 @@ var FEnum = class FEnum {
|
|
|
658
694
|
get ThemeColorType() {
|
|
659
695
|
return ThemeColorType;
|
|
660
696
|
}
|
|
697
|
+
/**
|
|
698
|
+
* Image source types
|
|
699
|
+
*
|
|
700
|
+
* @example
|
|
701
|
+
* ```ts
|
|
702
|
+
* console.log(univerAPI.Enum.ImageSourceType.URL);
|
|
703
|
+
* ```
|
|
704
|
+
*/
|
|
705
|
+
get ImageSourceType() {
|
|
706
|
+
return ImageSourceType;
|
|
707
|
+
}
|
|
661
708
|
};
|
|
662
709
|
_defineProperty(FEnum, "_instance", void 0);
|
|
663
710
|
|
|
@@ -853,6 +900,7 @@ let FHooks = class FHooks extends FBase {
|
|
|
853
900
|
}
|
|
854
901
|
/**
|
|
855
902
|
* @param callback
|
|
903
|
+
* @returns {IDisposable} A disposable used to remove the listener.
|
|
856
904
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
|
|
857
905
|
*/
|
|
858
906
|
onStarting(callback) {
|
|
@@ -860,6 +908,7 @@ let FHooks = class FHooks extends FBase {
|
|
|
860
908
|
}
|
|
861
909
|
/**
|
|
862
910
|
* @param callback
|
|
911
|
+
* @returns {IDisposable} A disposable used to remove the listener.
|
|
863
912
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
|
|
864
913
|
*/
|
|
865
914
|
onReady(callback) {
|
|
@@ -867,6 +916,7 @@ let FHooks = class FHooks extends FBase {
|
|
|
867
916
|
}
|
|
868
917
|
/**
|
|
869
918
|
* @param callback
|
|
919
|
+
* @returns {IDisposable} A disposable used to remove the listener.
|
|
870
920
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
|
|
871
921
|
*/
|
|
872
922
|
onRendered(callback) {
|
|
@@ -874,6 +924,7 @@ let FHooks = class FHooks extends FBase {
|
|
|
874
924
|
}
|
|
875
925
|
/**
|
|
876
926
|
* @param callback
|
|
927
|
+
* @returns {IDisposable} A disposable used to remove the listener.
|
|
877
928
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
|
|
878
929
|
*/
|
|
879
930
|
onSteady(callback) {
|
|
@@ -881,6 +932,7 @@ let FHooks = class FHooks extends FBase {
|
|
|
881
932
|
}
|
|
882
933
|
/**
|
|
883
934
|
* @param callback
|
|
935
|
+
* @returns {IDisposable} A disposable used to remove the listener.
|
|
884
936
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeUndo, (event) => {})` as instead
|
|
885
937
|
*/
|
|
886
938
|
onBeforeUndo(callback) {
|
|
@@ -893,6 +945,7 @@ let FHooks = class FHooks extends FBase {
|
|
|
893
945
|
}
|
|
894
946
|
/**
|
|
895
947
|
* @param callback
|
|
948
|
+
* @returns {IDisposable} A disposable used to remove the listener.
|
|
896
949
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.Undo, (event) => {})` as instead
|
|
897
950
|
*/
|
|
898
951
|
onUndo(callback) {
|
|
@@ -905,6 +958,7 @@ let FHooks = class FHooks extends FBase {
|
|
|
905
958
|
}
|
|
906
959
|
/**
|
|
907
960
|
* @param callback
|
|
961
|
+
* @returns {IDisposable} A disposable used to remove the listener.
|
|
908
962
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeRedo, (event) => {})` as instead
|
|
909
963
|
*/
|
|
910
964
|
onBeforeRedo(callback) {
|
|
@@ -917,6 +971,7 @@ let FHooks = class FHooks extends FBase {
|
|
|
917
971
|
}
|
|
918
972
|
/**
|
|
919
973
|
* @param callback
|
|
974
|
+
* @returns {IDisposable} A disposable used to remove the listener.
|
|
920
975
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.Redo, (event) => {})` as instead
|
|
921
976
|
*/
|
|
922
977
|
onRedo(callback) {
|
|
@@ -1536,50 +1591,53 @@ let FUniver = _FUniver = class FUniver extends Disposable {
|
|
|
1536
1591
|
}
|
|
1537
1592
|
/**
|
|
1538
1593
|
* Create a new rich text.
|
|
1539
|
-
* @param {IDocumentData} data
|
|
1540
1594
|
* @returns {RichTextBuilder} The new rich text instance
|
|
1541
1595
|
* @example
|
|
1542
1596
|
* ```ts
|
|
1543
|
-
* const richText = univerAPI.newRichText(
|
|
1544
|
-
*
|
|
1545
|
-
*
|
|
1546
|
-
*
|
|
1547
|
-
* range.setRichTextValueForCell(richText);
|
|
1597
|
+
* const richText = univerAPI.newRichText()
|
|
1598
|
+
* .align({ horizontal: univerAPI.Enum.HorizontalAlign.CENTER })
|
|
1599
|
+
* .text('Status: ')
|
|
1600
|
+
* .span('Ready', { bold: true, color: '#16a34a' });
|
|
1548
1601
|
* ```
|
|
1549
1602
|
*/
|
|
1550
|
-
newRichText(
|
|
1603
|
+
newRichText() {
|
|
1604
|
+
return RichTextBuilder.create();
|
|
1605
|
+
}
|
|
1606
|
+
/**
|
|
1607
|
+
* Create a rich-text builder from raw Univer document data.
|
|
1608
|
+
*
|
|
1609
|
+
* This is an advanced integration escape hatch for importers and adapters. Application and agent code should use
|
|
1610
|
+
* the fluent builder returned by `newRichText()`.
|
|
1611
|
+
*
|
|
1612
|
+
* @param data Raw Univer document data.
|
|
1613
|
+
* @returns A rich-text builder initialized with the supplied document data.
|
|
1614
|
+
* @advanced
|
|
1615
|
+
*/
|
|
1616
|
+
newRichTextFromDocumentData(data) {
|
|
1551
1617
|
return RichTextBuilder.create(data);
|
|
1552
1618
|
}
|
|
1553
1619
|
/**
|
|
1554
1620
|
* Create a new rich text value.
|
|
1555
|
-
*
|
|
1621
|
+
*
|
|
1622
|
+
* This is an advanced integration escape hatch for callers that already own Univer document data. Application and
|
|
1623
|
+
* agent code should prefer the fluent value returned by `newRichText()`.
|
|
1624
|
+
*
|
|
1625
|
+
* @param {IDocumentData} data The raw Univer document data.
|
|
1556
1626
|
* @returns {RichTextValue} The new rich text value instance
|
|
1557
|
-
* @
|
|
1558
|
-
* ```ts
|
|
1559
|
-
* const richTextValue = univerAPI.newRichTextValue({ body: { dataStream: 'Hello World\r\n' } });
|
|
1560
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
1561
|
-
* if (!fWorksheet) return;
|
|
1562
|
-
* const range = fWorksheet.getRange('A1');
|
|
1563
|
-
* range.setRichTextValueForCell(richTextValue);
|
|
1564
|
-
* ```
|
|
1627
|
+
* @advanced
|
|
1565
1628
|
*/
|
|
1566
1629
|
newRichTextValue(data) {
|
|
1567
1630
|
return RichTextValue.create(data);
|
|
1568
1631
|
}
|
|
1569
1632
|
/**
|
|
1570
1633
|
* Create a new paragraph style.
|
|
1571
|
-
*
|
|
1634
|
+
*
|
|
1635
|
+
* This is an advanced document-model API. Application and agent code should normally use
|
|
1636
|
+
* `newRichText().paragraph({ ... })`.
|
|
1637
|
+
*
|
|
1638
|
+
* @param {IParagraphStyle} style The paragraph style
|
|
1572
1639
|
* @returns {ParagraphStyleBuilder} The new paragraph style instance
|
|
1573
|
-
* @
|
|
1574
|
-
* ```ts
|
|
1575
|
-
* const richText = univerAPI.newRichText({ body: { dataStream: 'Hello World\r\n' } });
|
|
1576
|
-
* const paragraphStyle = univerAPI.newParagraphStyle({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
|
|
1577
|
-
* richText.insertParagraph(paragraphStyle);
|
|
1578
|
-
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
1579
|
-
* if (!fWorksheet) return;
|
|
1580
|
-
* const range = fWorksheet.getRange('A1');
|
|
1581
|
-
* range.setRichTextValueForCell(richText);
|
|
1582
|
-
* ```
|
|
1640
|
+
* @advanced
|
|
1583
1641
|
*/
|
|
1584
1642
|
newParagraphStyle(style) {
|
|
1585
1643
|
return ParagraphStyleBuilder.create(style);
|