@officesdk/editor-sdk-core 0.0.0-alpha.8 → 0.0.1

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 (112) hide show
  1. package/cjs/docs/comments.js +3 -0
  2. package/cjs/docs/discuss.js +3 -0
  3. package/cjs/docs/index.js +1 -1
  4. package/cjs/docs/outline.js +3 -0
  5. package/cjs/docs/sdk.js +1 -1
  6. package/cjs/docs/sidebar.js +3 -0
  7. package/cjs/docs/theme.js +3 -0
  8. package/cjs/docx/sdk.js +1 -1
  9. package/cjs/docx/theme.js +1 -1
  10. package/cjs/form/sdk.js +1 -1
  11. package/cjs/form/ui.js +1 -1
  12. package/cjs/presentation/index.js +1 -1
  13. package/cjs/presentation/sdk.js +1 -1
  14. package/cjs/presentation/slide-theme.js +3 -0
  15. package/cjs/presentation/theme.js +1 -1
  16. package/cjs/shared/attachment.js +11 -1
  17. package/cjs/shared/editor.js +1 -1
  18. package/cjs/shared/file-picker.js +1 -1
  19. package/cjs/shared/fonts.js +16 -1
  20. package/cjs/shared/history.js +1 -1
  21. package/cjs/shared/http.js +1 -1
  22. package/cjs/shared/i18n.js +1 -1
  23. package/cjs/shared/index.js +4 -2
  24. package/cjs/shared/spell-check.js +3 -0
  25. package/cjs/shared/theme/base-types.js +1 -1
  26. package/cjs/shared/theme/components/dropdown.js +1 -1
  27. package/cjs/shared/theme/components/index.js +2 -1
  28. package/cjs/shared/theme/components/input.js +1 -1
  29. package/cjs/shared/theme/components/menu.js +3 -0
  30. package/cjs/shared/theme/components/slider.js +1 -1
  31. package/cjs/shared/theme/components/tab.js +1 -1
  32. package/cjs/shared/theme/components/toast.js +1 -1
  33. package/cjs/shared/theme/components/toolbar-button.js +1 -1
  34. package/cjs/shared/theme/components/tooltip.js +1 -1
  35. package/cjs/shared/theme/index.js +1 -1
  36. package/cjs/shared/toolbar.js +1 -1
  37. package/cjs/shared/version.js +1 -1
  38. package/cjs/sheet/form.js +1 -1
  39. package/cjs/sheet/history.js +1 -1
  40. package/cjs/sheet/index.js +1 -1
  41. package/cjs/sheet/render.js +1 -1
  42. package/cjs/sheet/sdk.js +1 -1
  43. package/cjs/sheet/sheet-tab.js +1 -1
  44. package/cjs/table/field.js +1 -1
  45. package/cjs/table/history.js +1 -1
  46. package/cjs/table/index.js +1 -1
  47. package/cjs/table/record.js +3 -0
  48. package/cjs/table/sdk.js +1 -1
  49. package/cjs/table/snapshot.js +1 -1
  50. package/cjs/table/view.js +1 -1
  51. package/esm/docs/comments.js +2 -0
  52. package/esm/docs/discuss.js +2 -0
  53. package/esm/docs/index.js +1 -1
  54. package/esm/docs/outline.js +2 -0
  55. package/esm/docs/sdk.js +1 -1
  56. package/esm/docs/sidebar.js +2 -0
  57. package/esm/docs/theme.js +2 -0
  58. package/esm/docx/sdk.js +1 -1
  59. package/esm/docx/theme.js +1 -1
  60. package/esm/form/sdk.js +1 -1
  61. package/esm/form/ui.js +1 -1
  62. package/esm/presentation/index.js +1 -1
  63. package/esm/presentation/sdk.js +1 -1
  64. package/esm/presentation/slide-theme.js +2 -0
  65. package/esm/presentation/theme.js +1 -1
  66. package/esm/shared/attachment.js +10 -2
  67. package/esm/shared/editor.js +1 -1
  68. package/esm/shared/file-picker.js +1 -1
  69. package/esm/shared/fonts.js +15 -2
  70. package/esm/shared/history.js +1 -1
  71. package/esm/shared/http.js +1 -1
  72. package/esm/shared/i18n.js +1 -1
  73. package/esm/shared/index.js +2 -1
  74. package/esm/shared/spell-check.js +2 -0
  75. package/esm/shared/theme/base-types.js +1 -1
  76. package/esm/shared/theme/components/dropdown.js +1 -1
  77. package/esm/shared/theme/components/index.js +2 -1
  78. package/esm/shared/theme/components/input.js +1 -1
  79. package/esm/shared/theme/components/menu.js +2 -0
  80. package/esm/shared/theme/components/slider.js +1 -1
  81. package/esm/shared/theme/components/tab.js +1 -1
  82. package/esm/shared/theme/components/toast.js +1 -1
  83. package/esm/shared/theme/components/toolbar-button.js +1 -1
  84. package/esm/shared/theme/components/tooltip.js +1 -1
  85. package/esm/shared/theme/index.js +1 -1
  86. package/esm/shared/toolbar.js +1 -1
  87. package/esm/shared/version.js +1 -1
  88. package/esm/sheet/form.js +1 -1
  89. package/esm/sheet/history.js +1 -1
  90. package/esm/sheet/index.js +1 -1
  91. package/esm/sheet/render.js +1 -1
  92. package/esm/sheet/sdk.js +1 -1
  93. package/esm/sheet/sheet-tab.js +1 -1
  94. package/esm/table/field.js +1 -1
  95. package/esm/table/history.js +1 -1
  96. package/esm/table/index.js +1 -1
  97. package/esm/table/record.js +2 -0
  98. package/esm/table/sdk.js +1 -1
  99. package/esm/table/snapshot.js +1 -1
  100. package/esm/table/view.js +1 -1
  101. package/package.json +1 -1
  102. package/types/combine.d.ts +975 -115
  103. package/types/diagram.d.ts +520 -82
  104. package/types/docs.d.ts +718 -78
  105. package/types/docx.d.ts +522 -84
  106. package/types/form.d.ts +529 -89
  107. package/types/mindmap.d.ts +520 -82
  108. package/types/pdf.d.ts +520 -82
  109. package/types/presentation.d.ts +599 -89
  110. package/types/shared.d.ts +520 -82
  111. package/types/sheet.d.ts +579 -105
  112. package/types/table.d.ts +632 -82
package/types/docs.d.ts CHANGED
@@ -7,6 +7,46 @@ export declare abstract class AbstractedDocsSDK extends EditorSDK {
7
7
  * 文档选区接口
8
8
  */
9
9
  abstract get selection(): DocsSelection;
10
+ /**
11
+ * 文档大纲接口
12
+ */
13
+ abstract get outline(): DocsOutline;
14
+ /**
15
+ * 文档侧边栏接口
16
+ */
17
+ abstract get sidebar(): DocsSidebar;
18
+ /**
19
+ * 文档评论接口
20
+ */
21
+ abstract get comments(): DocsComments | undefined;
22
+ /**
23
+ * 文档演示接口
24
+ */
25
+ abstract get presentation(): EditorPresentation;
26
+ /**
27
+ * 监听标题的变化
28
+ * @param listener 在内部标题被修改时触发 listener 回调
29
+ * @returns 返回一个取消监听的函数
30
+ */
31
+ abstract addTitleChangeListener(listener: (newTitle: string) => void): () => void;
32
+ /**
33
+ * 修改标题
34
+ */
35
+ abstract setTitle(title: string): void;
36
+ }
37
+
38
+ /**
39
+ * 编辑文件检查器
40
+ */
41
+ export declare abstract class AbstractedEditorFileChecker {
42
+ /**
43
+ * 检查文件是否符合限制
44
+ * @param files
45
+ * @returns 返回符合的files
46
+ */
47
+ check?: (files: EditorPickedFile[], options?: {
48
+ type: 'image' | 'video' | 'audio' | 'attachment';
49
+ }) => EditorPickedFile[];
10
50
  }
11
51
 
12
52
  export declare abstract class AbstractedEditorFileUploader {
@@ -84,6 +124,12 @@ export declare interface BorderColors {
84
124
  disabled: string;
85
125
  }
86
126
 
127
+ export declare interface BorderConfig {
128
+ color?: string;
129
+ radius?: string;
130
+ width?: string;
131
+ }
132
+
87
133
  /** 圆角配置 */
88
134
  export declare interface BorderRadiusConfig {
89
135
  /** 无圆角 0px */
@@ -140,6 +186,8 @@ export declare interface ButtonBaseSizeStyles {
140
186
  borderRadius: string;
141
187
  /** 字重 */
142
188
  fontWeight: string | number;
189
+ /** 间距 */
190
+ gap?: string;
143
191
  }
144
192
 
145
193
  /** Button 完整配置 */
@@ -347,12 +395,16 @@ export declare interface CommonThemeConfig {
347
395
  radio: RadioConfig;
348
396
  /** 复选框 */
349
397
  checkbox: CheckboxConfig;
398
+ /** 下拉框 */
399
+ dropdown: DropdownConfig;
400
+ /** 下拉框按钮 */
401
+ dropdownButton: DropdownButtonConfig;
402
+ /** 菜单 */
403
+ menu: MenuConfig;
350
404
  /** 开关 */
351
405
  switch: SwitchConfig;
352
406
  /** 按钮 */
353
407
  button: ButtonConfig;
354
- /** 下拉框 */
355
- dropdown: DropdownConfig;
356
408
  /** 标签页 */
357
409
  tab: TabConfig;
358
410
  /** 滑块 */
@@ -420,6 +472,48 @@ export declare interface DecorateColors {
420
472
  april: string;
421
473
  }
422
474
 
475
+ /**
476
+ * Docs(轻文档)套件的卡点/权限检查结果最小形态。
477
+ *
478
+ * @remarks
479
+ * - 用于宿主(如 lizard-service-iframe-sdk)向 DocsSDK 透传 checkpoint 结果。
480
+ * - 当前粘贴长度限制仅需要 `authorized/noCheck/max`。
481
+ */
482
+ export declare interface DocsAttachLimitType {
483
+ authorized: boolean;
484
+ noCheck: boolean;
485
+ max?: number;
486
+ }
487
+
488
+ /**
489
+ * Docs(轻文档)套件的卡点/权限检查函数。
490
+ */
491
+ export declare type DocsCheckPermission = (key: string) => DocsAttachLimitType | null;
492
+
493
+ /**
494
+ * Docs(轻文档)评论接口
495
+ */
496
+ export declare interface DocsComments extends EditorComments {
497
+ /**
498
+ * 显示评论。show方法为默认的显示模式,可以调用showWithMode方法指定显示模式。
499
+ * @param type 显示模式,list表示评论列表,card表示评论卡片。
500
+ */
501
+ showWithMode: (type: 'list' | 'card') => void;
502
+ /**
503
+ * 隐藏评论
504
+ * @param type list表示评论列表,card表示评论卡片。
505
+ * 默认为list
506
+ */
507
+ hideWithMode: (type: 'list' | 'card') => void;
508
+ }
509
+
510
+ /**
511
+ * 文档讨论
512
+ */
513
+ export declare interface DocsDiscussOptions {
514
+ socket?: EditorSocket;
515
+ }
516
+
423
517
  /**
424
518
  * 文档信息配置项,用于显示在文档信息弹窗中的内容
425
519
  */
@@ -435,6 +529,55 @@ export declare interface DocsInfoOptions {
435
529
  name: string;
436
530
  }
437
531
 
532
+ /**
533
+ * Docs(轻文档)套件卡点限制配置。
534
+ *
535
+ * @remarks
536
+ * 由宿主环境注入,用于在运行时查询各卡点的限额/开关。
537
+ * 每个 getter 返回 `undefined` 表示使用内部默认值。
538
+ */
539
+ export declare interface DocsLimitationOptions {
540
+ /**
541
+ * 获取单次可粘贴的最大字符数(Character)。
542
+ * 返回 `undefined` 表示使用内部默认值(200000,即 20 万字符)。
543
+ */
544
+ getPasteLimitRdoc?: () => number | undefined;
545
+ /**
546
+ * 获取单次可粘贴的最大数据体积(Byte)。
547
+ * 返回 `undefined` 表示使用内部默认值(9437184,即 9 MB)。
548
+ */
549
+ getPasteLimit?: () => number | undefined;
550
+ /**
551
+ * 通知提醒功能是否可用。
552
+ * 返回 `undefined` 表示使用内部默认值(可用)。
553
+ */
554
+ getRdocNotification?: () => boolean | undefined;
555
+ /**
556
+ * 跟随模式功能是否可用。
557
+ * 返回 `undefined` 表示使用内部默认值(可用)。
558
+ */
559
+ getRdocFollowMode?: () => boolean | undefined;
560
+ /**
561
+ * 宽纸张功能是否可用。
562
+ * 返回 `undefined` 表示使用内部默认值(可用)。
563
+ */
564
+ getRdocWidePaper?: () => boolean | undefined;
565
+ }
566
+
567
+ /**
568
+ * Docs 大纲能力接口。
569
+ */
570
+ export declare interface DocsOutline {
571
+ /**
572
+ * 获取当前大纲面板是否打开。
573
+ */
574
+ getOpen: () => boolean;
575
+ /**
576
+ * 设置大纲面板开关状态。
577
+ */
578
+ setOpen: (isOpen: boolean) => void;
579
+ }
580
+
438
581
  /**
439
582
  * 区域(Range)
440
583
  * 区域对象,表示文档中的一个连续区域,每个 Range 对象包含起始字符位置和终止字符位置。
@@ -558,7 +701,7 @@ export declare interface DocsSDKOptions extends EditorOptions {
558
701
  /**
559
702
  * 纸张相关设置
560
703
  */
561
- pages: {
704
+ pages?: {
562
705
  width: 'standard' | 'wide' | 'full';
563
706
  };
564
707
  /**
@@ -570,14 +713,44 @@ export declare interface DocsSDKOptions extends EditorOptions {
570
713
  linespacing: string;
571
714
  size: string;
572
715
  };
716
+ fonts?: EditorFontsOptions;
573
717
  footer?: {
574
718
  logo?: string;
575
719
  viewsText?: string;
576
720
  };
721
+ /**
722
+ * UI主题相关设置
723
+ */
724
+ theme?: DocsThemeOptions;
725
+ /**
726
+ * 讨论设置
727
+ */
728
+ discuss?: DocsDiscussOptions;
729
+ /**
730
+ * 跟随模式设置
731
+ */
732
+ followMode?: EditorFollowModeOptions;
577
733
  /**
578
734
  * 错误处理回调
579
735
  */
580
736
  errorHandler?: (context: string, err: Error, extra?: Record<string, string>) => void;
737
+ /**
738
+ * Docs 套件的卡点/权限检查函数(可选)。
739
+ *
740
+ * @remarks
741
+ * - 由宿主环境提供(如 lizard-service-iframe-sdk 的 `createCheckPermission`)。
742
+ * - 用于实现 `paste_limit_rdoc` 等卡点能力(例如粘贴前长度限制)。
743
+ */
744
+ checkPermission?: DocsCheckPermission;
745
+ /**
746
+ * Docs 套件卡点限制配置。
747
+ *
748
+ * @remarks
749
+ * 由宿主环境注入,用于查询各卡点的限额/功能开关。
750
+ * 与 {@link EditorHistoryOptions.limitations | history.limitations}、
751
+ * {@link EditorVersionOptions.limitations | version.limitations} 保持一致的模式。
752
+ */
753
+ limitations?: DocsLimitationOptions;
581
754
  }
582
755
 
583
756
  /**
@@ -628,82 +801,120 @@ export declare interface DocsSelection {
628
801
  insertHtml: (html: string) => DocsRangeValue;
629
802
  }
630
803
 
631
- /** Dropdown 箭头图标配置 */
632
- export declare interface DropdownArrowIconConfig extends IconConfig {
633
- /** 展开状态旋转角度 */
634
- expandedRotateAngel: string;
804
+ /**
805
+ * Docs 侧边栏能力接口。
806
+ */
807
+ export declare interface DocsSidebar {
808
+ /**
809
+ * 打开侧边栏,可选指定默认 tab。
810
+ */
811
+ show: (tab?: string) => void;
812
+ /**
813
+ * 关闭侧边栏。
814
+ */
815
+ close: () => void;
816
+ /**
817
+ * 获取当前侧边栏状态。
818
+ */
819
+ getState: () => DocsSidebarState;
635
820
  }
636
821
 
637
- /** Dropdown 完整配置 */
638
- export declare interface DropdownConfig {
639
- /** 图标配置集合 */
640
- icons: DropdownIconsConfig;
641
- /** 普通下拉框(按钮触发器) */
642
- button: DropdownVariantStyles;
643
- /** 输入框下拉框(输入框触发器) */
644
- input: DropdownVariantStyles;
645
- /** 大尺寸配置 */
646
- large: DropdownSizeStyles;
822
+ /**
823
+ * Docs 侧边栏状态。
824
+ */
825
+ export declare interface DocsSidebarState {
826
+ visible: boolean;
827
+ selectedTab: string;
647
828
  }
648
829
 
649
- /** Dropdown 图标集合配置 */
650
- export declare interface DropdownIconsConfig {
651
- /** 下拉箭头图标 */
652
- arrow: DropdownArrowIconConfig;
653
- /** 选中图标 */
654
- check: IconConfig;
830
+ export declare interface DocsThemeExtensions {
831
+ /** 编辑器容器 */
832
+ container: {
833
+ background: string;
834
+ shadow: string;
835
+ };
836
+ /** 工具栏 */
837
+ toolbar: {
838
+ background: string;
839
+ shadow: string;
840
+ };
841
+ /** 面板背景色(历史面板、讨论面板等) */
842
+ drawer: {
843
+ background: string;
844
+ };
845
+ /** 预览组件背景色 */
846
+ previewer: {
847
+ background: string;
848
+ };
849
+ dropdown: {
850
+ align: 'left' | 'center' | 'right';
851
+ };
655
852
  }
656
853
 
657
- /** Dropdown 菜单项样式 */
658
- export declare interface DropdownMenuItemStyles extends Omit<BackgroundStateStyles, 'backgroundActive'> {
659
- /** 选中背景 */
660
- backgroundSelected: string;
661
- /** 文字颜色 */
662
- color: string;
663
- /** 禁用文字颜色 */
664
- colorDisabled: string;
665
- /** 菜单项内边距 */
666
- padding: string;
667
- }
854
+ /**
855
+ * Docs 完整主题配置
856
+ */
857
+ export declare type DocsThemeOptions = EditorThemeOptions<DocsThemeExtensions>;
668
858
 
669
- /** Dropdown 菜单容器样式 */
670
- export declare interface DropdownMenuStyles {
671
- /** 背景色 */
672
- background: string;
673
- /** 边框色 */
674
- borderColor: string;
675
- /** 圆角 */
676
- borderRadius: string;
677
- /** 内边距 */
678
- padding: string;
679
- /** 阴影 */
680
- boxShadow: string;
681
- /** 最大高度 */
682
- maxHeight: string;
859
+ /** Dropdown 按钮配置 */
860
+ export declare interface DropdownButtonConfig {
861
+ /** 颜色 */
862
+ color: StateStyles;
863
+ /** 背景 */
864
+ background: StateStyles;
865
+ /** 无边框背景 */
866
+ frameLessBackground: StateStyles;
867
+ /** 边框颜色 */
868
+ borderColor: StateStyles;
869
+ /** 图标 */
870
+ icon: {
871
+ size: IconSize;
872
+ /** 透明度 */
873
+ opacity: StateStyles;
874
+ };
875
+ /** 指示器 */
876
+ indicator: IconConfig & {
877
+ /** 旋转角度 */
878
+ rotate: string;
879
+ /** 透明度 */
880
+ opacity: StateStyles;
881
+ };
882
+ /** 尺寸 */
883
+ size: {
884
+ /** 大尺寸 */
885
+ large: DropdownButtonSizeStyles;
886
+ /** 中尺寸 */
887
+ medium: DropdownButtonSizeStyles;
888
+ /** 小尺寸 */
889
+ small: DropdownButtonSizeStyles;
890
+ };
683
891
  }
684
892
 
685
- /** Dropdown 尺寸配置 */
686
- export declare interface DropdownSizeStyles extends ButtonBaseSizeStyles {
687
- /** 图标尺寸 */
893
+ /** Dropdown 按钮尺寸 */
894
+ export declare interface DropdownButtonSizeStyles {
895
+ padding: string;
896
+ fontSize: string;
897
+ height: string;
898
+ gap: string;
899
+ borderRadius: string;
688
900
  iconSize: IconSize;
901
+ indicatorSize: IconSize;
689
902
  }
690
903
 
691
- /** Dropdown 触发器样式(按钮或输入框触发器) */
692
- export declare interface DropdownTriggerStyles extends BorderStateStyles, BackgroundStateStyles, ShadowStateStyles {
693
- /** 文字颜色 */
694
- color: string;
695
- /** 禁用文字颜色 */
696
- colorDisabled: string;
697
- }
698
-
699
- /** Dropdown 变体样式 */
700
- export declare interface DropdownVariantStyles {
701
- /** 触发器样式 */
702
- trigger: DropdownTriggerStyles;
703
- /** 菜单容器样式 */
704
- menu: DropdownMenuStyles;
705
- /** 菜单项样式 */
706
- menuItem: DropdownMenuItemStyles;
904
+ /**
905
+ * Dropdown 下拉框配置
906
+ */
907
+ export declare interface DropdownConfig {
908
+ /** 阴影 */
909
+ boxShadow: string;
910
+ /** 内边距 */
911
+ padding: string;
912
+ /** 圆角 */
913
+ borderRadius: string;
914
+ /** 边框 */
915
+ border: string;
916
+ /** 背景 */
917
+ background: string;
707
918
  }
708
919
 
709
920
  /**
@@ -922,6 +1133,10 @@ export declare interface EditorAttachmentOptions {
922
1133
  * 附件选择器
923
1134
  */
924
1135
  picker?: EditorFilePicker;
1136
+ /**
1137
+ * 文件检查器
1138
+ */
1139
+ checker?: AbstractedEditorFileChecker;
925
1140
  /**
926
1141
  * 附件上传器
927
1142
  */
@@ -1354,6 +1569,14 @@ export declare type EditorContextMenuOptions<TName extends string> = EditorMenuO
1354
1569
  */
1355
1570
  export declare type EditorCopyOptions = EditorLogicFeatureConfig;
1356
1571
 
1572
+ /**
1573
+ * 日期格式
1574
+ * - `YYYY/MM/DD` 年/月/日(简繁中文、韩语、日语默认)
1575
+ * - `MM/DD/YYYY` 月/日/年(英语默认)
1576
+ * - `DD/MM/YYYY` 日/月/年(其他语言默认)
1577
+ */
1578
+ export declare type EditorDateFormat = 'YYYY/MM/DD' | 'MM/DD/YYYY' | 'DD/MM/YYYY';
1579
+
1357
1580
  /**
1358
1581
  * 编辑器解密选项接口
1359
1582
  * 用于配置编辑器中需要解密的内容的相关选项
@@ -1531,11 +1754,31 @@ export declare interface EditorFilePicker {
1531
1754
  }
1532
1755
 
1533
1756
  export declare interface EditorFilePickerOpenOptions {
1757
+ /**
1758
+ * 文件类型限制
1759
+ */
1534
1760
  mimeTypes?: string[];
1761
+ /**
1762
+ * 最大文件尺寸限制
1763
+ */
1535
1764
  maxSize?: number;
1765
+ /**
1766
+ * 文件后缀限制
1767
+ */
1536
1768
  extensions?: string[];
1769
+ /**
1770
+ * 是否支持多选
1771
+ */
1537
1772
  multiple?: boolean;
1773
+ /**
1774
+ * 是否为选择文件夹
1775
+ */
1538
1776
  directory?: boolean;
1777
+ /**
1778
+ * 文件选择器接受的文件类型,如 'image/*' 表示接受所有图片文件
1779
+ * 如果指定了该配置,则不会再由extensions生成accept
1780
+ */
1781
+ accept?: string;
1539
1782
  }
1540
1783
 
1541
1784
  export declare interface EditorFollowMode {
@@ -1648,9 +1891,32 @@ export declare interface EditorFontsOptions {
1648
1891
  */
1649
1892
  list?: EditorFontsList;
1650
1893
  /**
1651
- * 是否只使用本地字体,如果为 true,则不会从服务器获取字体列表。
1894
+ * 字体列表中隐藏不可用的字体,包含外部传入的以及各套件内置的字体
1895
+ * 不可用的定义:非本地已安装且不支持下载
1896
+ */
1897
+ hideUnavailableFonts?: boolean;
1898
+ /**
1899
+ * 字体下载监听器注册函数,当字体状态发生变化时调用提供的回调函数。
1900
+ * 回调函数暂时没有参数,后续可以根据需要添加参数,例如提供变化的字体信息等。
1901
+ * @param listener
1902
+ * @returns
1652
1903
  */
1653
- useLocalFontsOnly?: boolean;
1904
+ registerFontLoadListener?: (listener: (options: FontLoadListenerOptions) => void) => void;
1905
+ /**
1906
+ * 下载字体的函数,接受字体族名称和一个可选的配置对象作为参数。
1907
+ * 配置对象可以包含以下回调函数:
1908
+ * - onProgress: 在下载过程中调用,提供下载进度(0 到 1 之间的数字)。
1909
+ * - onComplete: 在下载完成时调用。
1910
+ * - onError: 在下载过程中发生错误时调用,提供错误对象。
1911
+ * @param fontFamily
1912
+ * @param option
1913
+ * @returns
1914
+ */
1915
+ download?: (fontFamily: string, option?: {
1916
+ onProgress?: (progress: number) => void;
1917
+ onComplete?: () => void;
1918
+ onError?: (error: Error) => void;
1919
+ }) => void;
1654
1920
  }
1655
1921
 
1656
1922
  /**
@@ -1678,20 +1944,61 @@ export declare interface EditorHistory {
1678
1944
  hide: () => void;
1679
1945
  }
1680
1946
 
1681
- export declare type EditorHistoryOptions = EditorFeatureConfig;
1947
+ export declare interface EditorHistoryLimitations {
1948
+ /** 单个文件可还原的最近历史记录数量 */
1949
+ getHistoryLimitRevertNum?: () => number | undefined;
1950
+ /** 文件历史保留天数 */
1951
+ getHistoryLimitAllTime?: () => number | undefined;
1952
+ }
1953
+
1954
+ export declare type EditorHistoryOptions = EditorFeatureConfig & {
1955
+ limitations?: EditorHistoryLimitations;
1956
+ };
1682
1957
 
1683
1958
  /**
1684
1959
  * i18n 相关设置
1685
1960
  */
1686
1961
  export declare interface EditorI18nOptions {
1687
1962
  /**
1688
- * 语言,默认使用浏览器当前环境中的语言
1963
+ * 语言代码
1964
+ * 默认读取浏览器/设备语言并在支持的列表中匹配
1965
+ * 匹配规则:优先精确匹配,其次模糊匹配 language 部分,Fallback 为 en-US
1689
1966
  */
1690
- language?: string;
1967
+ language?: EditorLanguage;
1691
1968
  /**
1692
1969
  * 文本方向,默认根据语言自动适配
1693
1970
  */
1694
1971
  direction?: 'ltr' | 'rtl';
1972
+ /**
1973
+ * 时区设置(包含 ID、偏移量、标签)
1974
+ * 默认读取浏览器/设备时区,如无法匹配则根据语言推测
1975
+ * Fallback 为 { id: 'Europe/London', offset: 0, label: 'London' }
1976
+ */
1977
+ timezone?: EditorTimezoneInfo;
1978
+ /**
1979
+ * 日期格式
1980
+ * 默认根据语言自动匹配:
1981
+ * - 简繁中文、韩语、日语:YYYY/MM/DD
1982
+ * - 英语:MM/DD/YYYY
1983
+ * - 其他语言:DD/MM/YYYY
1984
+ * 用户手动设置后将保存并优先使用用户设置
1985
+ */
1986
+ dateFormat?: EditorDateFormat;
1987
+ /**
1988
+ * 时间格式
1989
+ * 默认使用 24 小时制
1990
+ * 注意:部分语言(如德语、法语、意大利语、俄语)不支持 12 小时制
1991
+ * 用户手动设置后将保存并优先使用用户设置
1992
+ */
1993
+ timeFormat?: EditorTimeFormat;
1994
+ /**
1995
+ * 周起始日
1996
+ * 默认根据语言自动匹配:
1997
+ * - 英语、阿拉伯语:星期日
1998
+ * - 其他语言:星期一
1999
+ * 用户手动设置后将保存并优先使用用户设置
2000
+ */
2001
+ weekStartDay?: EditorWeekStartDay;
1695
2002
  }
1696
2003
 
1697
2004
  export declare type EditorImageCropPoint = 'nw' | 'north' | 'ne' | 'west' | 'center' | 'east' | 'sw' | 'south' | 'se';
@@ -1736,6 +2043,27 @@ export declare interface EditorImportOptions {
1736
2043
  }>;
1737
2044
  }
1738
2045
 
2046
+ /**
2047
+ * 支持的语言代码
2048
+ * - `zh-CN` 简体中文
2049
+ * - `zh-TW` 繁体中文(含 zh-HK, zh-MO)
2050
+ * - `en-US` 英语
2051
+ * - `ja-JP` 日语
2052
+ * - `ko-KR` 韩语
2053
+ * - `es-ES` 西班牙语
2054
+ * - `pt-PT` 葡萄牙语
2055
+ * - `de-DE` 德语
2056
+ * - `fr-FR` 法语
2057
+ * - `it-IT` 意大利语
2058
+ * - `ru-RU` 俄语
2059
+ * - `id-ID` 印度尼西亚语
2060
+ * - `vi-VN` 越南语
2061
+ * - `th-TH` 泰语
2062
+ * - `ms-MY` 马来语
2063
+ * - `ar-SA` 阿拉伯语
2064
+ */
2065
+ export declare type EditorLanguage = 'zh-CN' | 'zh-TW' | 'en-US' | 'ja-JP' | 'ko-KR' | 'es-ES' | 'pt-PT' | 'de-DE' | 'fr-FR' | 'it-IT' | 'ru-RU' | 'id-ID' | 'vi-VN' | 'th-TH' | 'ms-MY' | 'ar-SA';
2066
+
1739
2067
  /**
1740
2068
  * 链接配置,抽象打开链接等操作
1741
2069
  */
@@ -2285,7 +2613,11 @@ export declare interface EditorOptions {
2285
2613
  /**
2286
2614
  * 编辑器主题相关设置
2287
2615
  */
2288
- theme: EditorThemeOptions;
2616
+ theme?: EditorThemeOptions;
2617
+ /**
2618
+ * 编辑器拼写检查相关设置
2619
+ */
2620
+ spellCheck?: EditorSpellCheckOptions;
2289
2621
  }
2290
2622
 
2291
2623
  /**
@@ -2605,6 +2937,49 @@ export declare interface EditorSocket {
2605
2937
  connected: boolean;
2606
2938
  }
2607
2939
 
2940
+ export declare interface EditorSpellCheckDictionaryFileConfig {
2941
+ /** 词典文件的 aff 文件路径 */
2942
+ aff: string;
2943
+ /** 词典文件的 dic 文件路径 */
2944
+ dic: string;
2945
+ }
2946
+
2947
+ /**
2948
+ * 拼写检查相关配置
2949
+ */
2950
+ export declare interface EditorSpellCheckOptions extends EditorFeatureConfig {
2951
+ /**
2952
+ * 拼写检查功能配置
2953
+ */
2954
+ spellCheck?: {
2955
+ /**
2956
+ * 拼写检查功能是否被禁用
2957
+ */
2958
+ disabled?: boolean;
2959
+ /**
2960
+ * 拼写检查所需要的字典文件 CDN 域名
2961
+ */
2962
+ dictionaryCDNHost?: string;
2963
+ /**
2964
+ * 自定义拼写检查词典, 用于覆盖内置的默认词典
2965
+ */
2966
+ customDictionary?: Partial<Record<EditorLanguage, EditorSpellCheckDictionaryFileConfig>>;
2967
+ };
2968
+ /**
2969
+ * 语法检查功能配置
2970
+ */
2971
+ grammarCheck?: {
2972
+ /**
2973
+ * 语法检查功能是否被禁用
2974
+ */
2975
+ disabled?: boolean;
2976
+ /**
2977
+ * 拼写检查API的URL,必须使用绝对路径
2978
+ */
2979
+ url?: string;
2980
+ };
2981
+ }
2982
+
2608
2983
  /**
2609
2984
  * 编辑器在 `standard` 模式下的权限模式
2610
2985
  * - `editor` 编辑模式
@@ -2747,6 +3122,59 @@ export declare interface EditorThemeOptions<TExtensions = object> extends Common
2747
3122
  extensions?: TExtensions;
2748
3123
  }
2749
3124
 
3125
+ /**
3126
+ * 时间格式
3127
+ * - `24h` 24 小时制(默认)
3128
+ * - `12h` 12 小时制(部分语言不支持)
3129
+ */
3130
+ export declare type EditorTimeFormat = '24h' | '12h';
3131
+
3132
+ /**
3133
+ * 支持的时区 IANA ID
3134
+ *
3135
+ * 覆盖范围: UTC-12 到 UTC+12,共 34 个全球主要城市时区
3136
+ *
3137
+ * 注意事项:
3138
+ * - 所有时区 ID 均为 IANA 时区数据库标准标识符
3139
+ * - Etc/GMT+12 表示 UTC-12(Etc/GMT 时区符号与 UTC 相反)
3140
+ * - 不包括已弃用或非标准时区标识符
3141
+ *
3142
+ * @see https://www.iana.org/time-zones
3143
+ */
3144
+ export declare type EditorTimezoneId = 'Etc/GMT+12' | 'Pacific/Pago_Pago' | 'Pacific/Honolulu' | 'America/Anchorage' | 'America/Los_Angeles' | 'America/Denver' | 'America/Mexico_City' | 'America/New_York' | 'America/Santiago' | 'America/Sao_Paulo' | 'Atlantic/South_Georgia' | 'Atlantic/Cape_Verde' | 'Europe/London' | 'Europe/Lisbon' | 'Europe/Paris' | 'Europe/Berlin' | 'Europe/Rome' | 'Europe/Madrid' | 'Africa/Cairo' | 'Europe/Moscow' | 'Asia/Riyadh' | 'Asia/Dubai' | 'Asia/Karachi' | 'Asia/Dhaka' | 'Asia/Bangkok' | 'Asia/Jakarta' | 'Asia/Ho_Chi_Minh' | 'Asia/Shanghai' | 'Asia/Kuala_Lumpur' | 'Asia/Tokyo' | 'Asia/Seoul' | 'Australia/Sydney' | 'Pacific/Guadalcanal' | 'Pacific/Auckland';
3145
+
3146
+ /**
3147
+ * 时区信息
3148
+ */
3149
+ export declare interface EditorTimezoneInfo {
3150
+ /**
3151
+ * IANA 时区 ID
3152
+ *
3153
+ * 标准的 IANA 时区数据库标识符
3154
+ *
3155
+ * @example 'Asia/Shanghai', 'America/New_York', 'Europe/London'
3156
+ */
3157
+ id: EditorTimezoneId;
3158
+ /**
3159
+ * UTC 偏移量(小时,标准时间)
3160
+ *
3161
+ * - 正数:东半球,如 `8` 表示 UTC+8(北京)
3162
+ * - 负数:西半球,如 `-5` 表示 UTC-5(纽约标准时间)
3163
+ * - 零:格林威治标准时间
3164
+ *
3165
+ * 注意:此值为标准时间,不包含夏令时调整
3166
+ */
3167
+ offset: number;
3168
+ /**
3169
+ * 时区标签(英文)
3170
+ *
3171
+ * 用于 UI 显示的城市或地区名称
3172
+ *
3173
+ * @example 'Shanghai', 'New York', 'London'
3174
+ */
3175
+ label: string;
3176
+ }
3177
+
2750
3178
  /**
2751
3179
  * 工具栏功能按钮配置(包括内置按钮和自定义按钮)
2752
3180
  */
@@ -2810,6 +3238,16 @@ export declare interface EditorToolbarOptions<TName extends string> {
2810
3238
  * 如果不配置则按照套件的默认方式挂载。
2811
3239
  */
2812
3240
  container?: HTMLElement;
3241
+ /**
3242
+ * 工具栏样式
3243
+ * 各套件可自行扩展,目前支持背景色配置
3244
+ */
3245
+ style?: {
3246
+ /**
3247
+ * 背景色
3248
+ */
3249
+ backgroundColor?: string;
3250
+ };
2813
3251
  }
2814
3252
 
2815
3253
  /**
@@ -3023,9 +3461,11 @@ export declare interface EditorUserOptions {
3023
3461
  export declare interface EditorVersion {
3024
3462
  /**
3025
3463
  * 保存版本
3026
- * @param name 版本名称
3464
+ * @param options 版本名称
3027
3465
  */
3028
- createRevision: (name?: string) => void;
3466
+ createRevision: (options?: string | {
3467
+ name: string;
3468
+ }) => void;
3029
3469
  /**
3030
3470
  * 显示版本(侧边栏或其他形式)
3031
3471
  * 区别于历史侧边栏,在应用表格里表现为打开历史侧边栏切换到版本 tab
@@ -3038,7 +3478,14 @@ export declare interface EditorVersion {
3038
3478
  hide?: () => void;
3039
3479
  }
3040
3480
 
3041
- export declare type EditorVersionOptions = EditorFeatureConfig;
3481
+ export declare interface EditorVersionLimitations {
3482
+ /** 单个文件可保存/还原的版本(快照)数量 */
3483
+ getHistoryLimitVersionNum?: () => number | undefined;
3484
+ }
3485
+
3486
+ export declare type EditorVersionOptions = EditorFeatureConfig & {
3487
+ limitations?: EditorVersionLimitations;
3488
+ };
3042
3489
 
3043
3490
  /**
3044
3491
  * 编辑器外部水印信息
@@ -3068,6 +3515,13 @@ export declare type EditorWatermarkResource = {
3068
3515
  url: string;
3069
3516
  };
3070
3517
 
3518
+ /**
3519
+ * 周起始日
3520
+ * - `sunday` 星期日(英语、阿拉伯语默认)
3521
+ * - `monday` 星期一(其他语言默认)
3522
+ */
3523
+ export declare type EditorWeekStartDay = 'sunday' | 'monday';
3524
+
3071
3525
  export declare interface FileLinkParams {
3072
3526
  /**
3073
3527
  * 文件guid
@@ -3139,6 +3593,35 @@ export declare interface FontFamilyConfig {
3139
3593
  base: string;
3140
3594
  }
3141
3595
 
3596
+ /**
3597
+ * 字体下载事件类型
3598
+ */
3599
+ export declare enum FontLoadEventType {
3600
+ DownloadStart = "downloadStart",
3601
+ DownloadProgress = "downloadProgress",
3602
+ DownloadComplete = "downloadComplete",
3603
+ DownloadError = "downloadError"
3604
+ }
3605
+
3606
+ /**
3607
+ * 字体下载事件监听器参数,根据事件类型提供不同的属性
3608
+ */
3609
+ export declare type FontLoadListenerOptions = {
3610
+ type: FontLoadEventType.DownloadStart;
3611
+ id: string;
3612
+ } | {
3613
+ type: FontLoadEventType.DownloadComplete;
3614
+ id: string;
3615
+ } | {
3616
+ type: FontLoadEventType.DownloadProgress;
3617
+ id: string;
3618
+ progress: number;
3619
+ } | {
3620
+ type: FontLoadEventType.DownloadError;
3621
+ id: string;
3622
+ error: Error;
3623
+ };
3624
+
3142
3625
  /** 字号配置 */
3143
3626
  export declare interface FontSizeConfig {
3144
3627
  /** 超小字号 */
@@ -3273,6 +3756,16 @@ export declare interface HTTPProxy {
3273
3756
  * @returns
3274
3757
  */
3275
3758
  create: (id: string) => Promise<HTTPProxy>;
3759
+ /**
3760
+ * 凭证更新器,用于套件内部主动发起更新凭证操作
3761
+ * 例如:页面可见性发生变化时,在pull请求发起之前
3762
+ */
3763
+ credentials?: {
3764
+ /**
3765
+ * 更新凭证
3766
+ */
3767
+ update: () => Promise<void>;
3768
+ };
3276
3769
  }
3277
3770
 
3278
3771
  /**
@@ -3472,6 +3965,8 @@ export declare interface InputStateColorStyles {
3472
3965
  textColorNormal: string;
3473
3966
  /** 禁用文字颜色 */
3474
3967
  textColorDisabled: string;
3968
+ /** 只读文字颜色 */
3969
+ textColorReadOnly: string;
3475
3970
  }
3476
3971
 
3477
3972
  /** Input 状态样式配置 */
@@ -3554,6 +4049,102 @@ export declare interface MentionInfo {
3554
4049
  top?: number;
3555
4050
  }
3556
4051
 
4052
+ /** 菜单配置 */
4053
+ export declare interface MenuConfig {
4054
+ /** 菜单项配置 */
4055
+ menuItem: MenuItemConfig;
4056
+ /** 子菜单 */
4057
+ subMenu: {
4058
+ /** 子菜单弹出位置偏移 */
4059
+ popupOffset: number[];
4060
+ };
4061
+ /** 边框 */
4062
+ border: BorderConfig;
4063
+ /** 阴影 */
4064
+ boxShadow: Pick<StateStyles, 'normal' | 'hover'>;
4065
+ /** 分割线 */
4066
+ divider: {
4067
+ background: string;
4068
+ height: string;
4069
+ margin: string;
4070
+ };
4071
+ /** 分组标题 */
4072
+ groupTitle: {
4073
+ fontSize: string;
4074
+ fontWeight: string;
4075
+ color: string;
4076
+ };
4077
+ }
4078
+
4079
+ /** 菜单项配置 */
4080
+ export declare interface MenuItemConfig {
4081
+ /** 背景 */
4082
+ background: {
4083
+ normal: string;
4084
+ hover: string;
4085
+ active: string;
4086
+ disabled: string;
4087
+ };
4088
+ /** 边框 */
4089
+ border: BorderConfig;
4090
+ /** 布局 */
4091
+ layout: {
4092
+ /** 内边距 */
4093
+ padding: string;
4094
+ /** 间距 */
4095
+ gap: string;
4096
+ };
4097
+ /** 图标 */
4098
+ icon: {
4099
+ size: IconSize;
4100
+ };
4101
+ /** 标签 */
4102
+ label: {
4103
+ /** 颜色 */
4104
+ color: StateStyles;
4105
+ };
4106
+ /** 描述文本 */
4107
+ description: {
4108
+ /** 颜色 */
4109
+ color: StateStyles;
4110
+ };
4111
+ /** 激活图标 */
4112
+ activeIcon: {
4113
+ url: string;
4114
+ };
4115
+ /** 下一级菜单图标 */
4116
+ nextLevelIcon: {
4117
+ url: string;
4118
+ };
4119
+ /** 尺寸 */
4120
+ size: {
4121
+ /** 小尺寸 */
4122
+ small: MenuItemSizeStyles;
4123
+ /** 中尺寸 */
4124
+ medium: MenuItemSizeStyles;
4125
+ /** 大尺寸 */
4126
+ large: MenuItemSizeStyles;
4127
+ };
4128
+ }
4129
+
4130
+ /** 菜单项尺寸样式 */
4131
+ export declare interface MenuItemSizeStyles {
4132
+ label: {
4133
+ fontSize: string;
4134
+ maxWidth: string;
4135
+ };
4136
+ description: {
4137
+ fontSize: string;
4138
+ maxWidth: string;
4139
+ };
4140
+ activeIcon: {
4141
+ size: IconSize;
4142
+ };
4143
+ nextLevelIcon: {
4144
+ size: IconSize;
4145
+ };
4146
+ }
4147
+
3557
4148
  /** 带透明度状态的图标配置 */
3558
4149
  export declare interface OpacityIconConfig extends IconConfig {
3559
4150
  /** 默认透明度 */
@@ -3801,6 +4392,7 @@ export declare interface SliderSizeStyles {
3801
4392
  thumbSize: string;
3802
4393
  /** 滑块偏移(距离边缘的间距) */
3803
4394
  thumbOffset: string;
4395
+ borderWidth: string;
3804
4396
  }
3805
4397
 
3806
4398
  /** Slider 滑块(圆点)样式 */
@@ -3815,6 +4407,8 @@ export declare interface SliderTrackStyles {
3815
4407
  backgroundDisabled: string;
3816
4408
  /** 已填充部分背景 */
3817
4409
  filledBackground: string;
4410
+ /** 已填充部分禁用状态背景 */
4411
+ filledBackgroundDisabled: string;
3818
4412
  /** 高度 */
3819
4413
  height: string;
3820
4414
  /** 宽度 */
@@ -3836,6 +4430,22 @@ export declare interface Speaker {
3836
4430
  avatar: string;
3837
4431
  }
3838
4432
 
4433
+ /** 通用状态样式 */
4434
+ export declare interface StateStyles {
4435
+ /** 默认颜色 */
4436
+ normal: string;
4437
+ /** 悬停文字颜色 */
4438
+ hover: string;
4439
+ /** 激活/聚焦文字颜色 */
4440
+ active: string;
4441
+ /** 禁用文字颜色 */
4442
+ disabled: string;
4443
+ /** 只读颜色 */
4444
+ readonly?: string;
4445
+ /** 错误颜色 */
4446
+ error?: string;
4447
+ }
4448
+
3839
4449
  /** Switch 完整配置 */
3840
4450
  export declare interface SwitchConfig {
3841
4451
  /** 关闭状态样式 */
@@ -3952,7 +4562,18 @@ export declare interface SyncStatusDelegation {
3952
4562
  /** Tab 完整配置 */
3953
4563
  export declare interface TabConfig {
3954
4564
  /** 线性标签页(仅下边框) */
3955
- line: TabVariantStyles;
4565
+ line: {
4566
+ backgroundColor: string;
4567
+ item: TabStateStyles & {
4568
+ /** 选中底部线条宽度/高度 */
4569
+ bottomActiveWidth: string;
4570
+ /** 选中底部线条圆角 */
4571
+ bottomActiveBorderRadius: string;
4572
+ /** 选中底部线条背景颜色 */
4573
+ bottomActiveBackgroundColor: string;
4574
+ };
4575
+ layout: TabLayoutStyles;
4576
+ };
3956
4577
  /** 面性标签页(带所有边框) */
3957
4578
  card: TabVariantStyles;
3958
4579
  /** 大尺寸配置 */
@@ -3976,8 +4597,10 @@ export declare interface TabStateStyles extends BackgroundStateStyles, BorderSta
3976
4597
  export declare interface TabVariantStyles {
3977
4598
  /** Tab 项状态样式 */
3978
4599
  item: TabStateStyles;
3979
- /** 布局样式 */
4600
+ /** 布局 */
3980
4601
  layout: TabLayoutStyles;
4602
+ /** tab条背景颜色 */
4603
+ backgroundColor: string;
3981
4604
  }
3982
4605
 
3983
4606
  /** Text Button 变体配置(在基础变体上扩展带背景色的引导样式) */
@@ -4058,6 +4681,10 @@ export declare interface ToastConfig extends ToastBaseStyles {
4058
4681
  error: ToastVariantStyles;
4059
4682
  /** 警告提示样式 */
4060
4683
  warn: ToastVariantStyles;
4684
+ /** 严重警告样式 */
4685
+ critical: ToastVariantStyles;
4686
+ /** 加载提示样式 */
4687
+ loading: ToastVariantStyles;
4061
4688
  /** 偏移量 */
4062
4689
  offset: {
4063
4690
  /** 垂直偏移量 */
@@ -4065,6 +4692,10 @@ export declare interface ToastConfig extends ToastBaseStyles {
4065
4692
  /** 水平偏移量 */
4066
4693
  horizontal: string;
4067
4694
  };
4695
+ /** 关闭按钮 */
4696
+ closeButton: {
4697
+ icon: Pick<IconConfig, 'url'>;
4698
+ };
4068
4699
  }
4069
4700
 
4070
4701
  /**
@@ -4136,6 +4767,11 @@ export declare interface ToastVariantStyles {
4136
4767
  borderColor: string;
4137
4768
  /** 图标配置 */
4138
4769
  icon: IconConfig;
4770
+ /** 消息 */
4771
+ message: {
4772
+ /** 颜色 */
4773
+ color: string;
4774
+ };
4139
4775
  }
4140
4776
 
4141
4777
  /** ToolbarButton 背景状态样式 */
@@ -4181,6 +4817,8 @@ export declare interface ToolbarButtonLayout {
4181
4817
  padding: string;
4182
4818
  /** 整体高度 */
4183
4819
  height: string;
4820
+ /** 整体圆角 */
4821
+ borderRadius: string;
4184
4822
  /** 内容布局 */
4185
4823
  content: {
4186
4824
  padding: string;
@@ -4275,6 +4913,8 @@ export declare interface TooltipStyleConfig {
4275
4913
  lineHeight: string;
4276
4914
  /** 字重 */
4277
4915
  fontWeight: number;
4916
+ /** 最大宽度 */
4917
+ maxWidth?: string;
4278
4918
  }
4279
4919
 
4280
4920
  /** Tooltip White 风格配置 */