@univerjs/docs-ui 1.0.0-rc.0 → 1.0.0

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 (178) hide show
  1. package/README.md +27 -0
  2. package/lib/cjs/index.js +27388 -23213
  3. package/lib/cjs/locale/ar-SA.js +28 -1
  4. package/lib/cjs/locale/ca-ES.js +28 -1
  5. package/lib/cjs/locale/de-DE.js +28 -1
  6. package/lib/cjs/locale/en-US.js +28 -1
  7. package/lib/cjs/locale/es-ES.js +28 -1
  8. package/lib/cjs/locale/fa-IR.js +28 -1
  9. package/lib/cjs/locale/fr-FR.js +28 -1
  10. package/lib/cjs/locale/id-ID.js +28 -1
  11. package/lib/cjs/locale/it-IT.js +28 -1
  12. package/lib/cjs/locale/ja-JP.js +28 -1
  13. package/lib/cjs/locale/ko-KR.js +28 -1
  14. package/lib/cjs/locale/pl-PL.js +28 -1
  15. package/lib/cjs/locale/pt-BR.js +28 -1
  16. package/lib/cjs/locale/ru-RU.js +28 -1
  17. package/lib/cjs/locale/sk-SK.js +28 -1
  18. package/lib/cjs/locale/vi-VN.js +28 -1
  19. package/lib/cjs/locale/zh-CN.js +28 -1
  20. package/lib/cjs/locale/zh-HK.js +28 -1
  21. package/lib/cjs/locale/zh-TW.js +28 -1
  22. package/lib/es/index.js +26448 -22297
  23. package/lib/es/locale/ar-SA.js +28 -0
  24. package/lib/es/locale/ca-ES.js +28 -0
  25. package/lib/es/locale/de-DE.js +28 -0
  26. package/lib/es/locale/en-US.js +28 -0
  27. package/lib/es/locale/es-ES.js +28 -0
  28. package/lib/es/locale/fa-IR.js +28 -0
  29. package/lib/es/locale/fr-FR.js +28 -0
  30. package/lib/es/locale/id-ID.js +28 -0
  31. package/lib/es/locale/it-IT.js +28 -0
  32. package/lib/es/locale/ja-JP.js +28 -0
  33. package/lib/es/locale/ko-KR.js +28 -0
  34. package/lib/es/locale/pl-PL.js +28 -0
  35. package/lib/es/locale/pt-BR.js +28 -0
  36. package/lib/es/locale/ru-RU.js +28 -0
  37. package/lib/es/locale/sk-SK.js +28 -0
  38. package/lib/es/locale/vi-VN.js +28 -0
  39. package/lib/es/locale/zh-CN.js +28 -0
  40. package/lib/es/locale/zh-HK.js +28 -0
  41. package/lib/es/locale/zh-TW.js +28 -0
  42. package/lib/index.css +322 -84
  43. package/lib/index.js +26448 -22297
  44. package/lib/locale/ar-SA.js +28 -0
  45. package/lib/locale/ca-ES.js +28 -0
  46. package/lib/locale/de-DE.js +28 -0
  47. package/lib/locale/en-US.js +28 -0
  48. package/lib/locale/es-ES.js +28 -0
  49. package/lib/locale/fa-IR.js +28 -0
  50. package/lib/locale/fr-FR.js +28 -0
  51. package/lib/locale/id-ID.js +28 -0
  52. package/lib/locale/it-IT.js +28 -0
  53. package/lib/locale/ja-JP.js +28 -0
  54. package/lib/locale/ko-KR.js +28 -0
  55. package/lib/locale/pl-PL.js +28 -0
  56. package/lib/locale/pt-BR.js +28 -0
  57. package/lib/locale/ru-RU.js +28 -0
  58. package/lib/locale/sk-SK.js +28 -0
  59. package/lib/locale/vi-VN.js +28 -0
  60. package/lib/locale/zh-CN.js +28 -0
  61. package/lib/locale/zh-HK.js +28 -0
  62. package/lib/locale/zh-TW.js +28 -0
  63. package/lib/types/basics/paragraph.d.ts +4 -1
  64. package/lib/types/basics/transform-position.d.ts +18 -0
  65. package/lib/types/commands/commands/clipboard.command.d.ts +9 -2
  66. package/lib/types/commands/commands/clipboard.inner.command.d.ts +1 -1
  67. package/lib/types/commands/commands/core-editing.command.d.ts +58 -0
  68. package/lib/types/commands/commands/doc-select-all.command.d.ts +1 -0
  69. package/lib/types/commands/commands/format-painter.command.d.ts +33 -0
  70. package/lib/types/commands/commands/table/doc-table-delete.command.d.ts +1 -0
  71. package/lib/types/components/const.d.ts +16 -0
  72. package/lib/types/components/doc-page-render-component.d.ts +21 -0
  73. package/lib/types/components/editor/utils.d.ts +22 -0
  74. package/lib/types/components/float-toolbar/FloatToolbar.d.ts +20 -0
  75. package/lib/types/components/float-toolbar/FloatToolbar.stories.d.ts +22 -0
  76. package/lib/types/components/list-type-picker/Picker.d.ts +30 -0
  77. package/lib/types/components/list-type-picker/index.d.ts +18 -0
  78. package/lib/types/components/paragraph-menu/index.d.ts +41 -0
  79. package/lib/types/components/side-menu/SideMenu.stories.d.ts +31 -0
  80. package/lib/types/components/side-menu/index.d.ts +41 -0
  81. package/lib/types/config/config.d.ts +2 -0
  82. package/lib/types/consts/mobile-context.d.ts +17 -0
  83. package/lib/types/controllers/doc-header-footer.controller.d.ts +3 -6
  84. package/lib/types/controllers/doc-move-cursor.controller.d.ts +1 -0
  85. package/lib/types/controllers/doc-ui.controller.d.ts +36 -0
  86. package/lib/types/controllers/format-painter.controller.d.ts +23 -0
  87. package/lib/types/controllers/mobile/components.controller.d.ts +25 -0
  88. package/lib/types/controllers/mobile/ui.controller.d.ts +29 -0
  89. package/lib/types/controllers/render-controllers/back-scroll.render-controller.d.ts +4 -3
  90. package/lib/types/controllers/render-controllers/doc-paragraph-placeholder.render-controller.d.ts +4 -3
  91. package/lib/types/controllers/render-controllers/doc-paste-options.render-controller.d.ts +27 -0
  92. package/lib/types/controllers/render-controllers/doc-selection-render.controller.d.ts +2 -0
  93. package/lib/types/controllers/render-controllers/doc-selection-render.util.d.ts +21 -0
  94. package/lib/types/controllers/render-controllers/doc.render-controller.d.ts +19 -5
  95. package/lib/types/controllers/render-controllers/format-painter.render-controller.d.ts +23 -0
  96. package/lib/types/controllers/render-controllers/mobile/back-scroll.render-controller.d.ts +30 -0
  97. package/lib/types/controllers/render-controllers/mobile/doc-pinch-zoom.d.ts +51 -0
  98. package/lib/types/controllers/render-controllers/mobile/doc-selection-render.controller.d.ts +73 -0
  99. package/lib/types/controllers/render-controllers/mobile/doc.render-controller.d.ts +36 -0
  100. package/lib/types/controllers/render-controllers/mobile/zoom.render-controller.d.ts +30 -0
  101. package/lib/types/controllers/render-controllers/zoom.render-controller.d.ts +8 -6
  102. package/lib/types/facade/f-univer.d.ts +52 -0
  103. package/lib/types/index.d.ts +10 -1
  104. package/lib/types/locale/en-US.d.ts +30 -0
  105. package/lib/types/menu/context-menu.d.ts +3 -0
  106. package/lib/types/menu/mobile-schema.d.ts +17 -0
  107. package/lib/types/mobile-plugin.d.ts +36 -0
  108. package/lib/types/services/clipboard/clipboard.service.d.ts +53 -20
  109. package/lib/types/services/clipboard/paste-options.d.ts +33 -0
  110. package/lib/types/services/doc-content-insert.service.d.ts +28 -0
  111. package/lib/types/services/doc-contextual-ribbon.service.d.ts +29 -0
  112. package/lib/types/services/doc-event-manager.service.d.ts +3 -0
  113. package/lib/types/services/doc-mobile-element-menu.service.d.ts +44 -0
  114. package/lib/types/services/doc-page-layout.service.d.ts +3 -0
  115. package/lib/types/services/doc-paragraph-menu.service.d.ts +3 -2
  116. package/lib/types/services/doc-popup-manager.service.d.ts +1 -0
  117. package/lib/types/services/doc-state-change-manager.service.d.ts +50 -0
  118. package/lib/types/services/doc-view-scale.d.ts +1 -1
  119. package/lib/types/services/editor/editor-manager.service.d.ts +2 -0
  120. package/lib/types/services/editor/editor-runtime-config.d.ts +24 -0
  121. package/lib/types/services/editor/editor.d.ts +9 -0
  122. package/lib/types/services/float-menu.service.d.ts +12 -4
  123. package/lib/types/services/mobile/doc-selection-render.service.d.ts +60 -0
  124. package/lib/types/services/mobile/doc-view-scale.d.ts +19 -0
  125. package/lib/types/services/mobile/float-menu.service.d.ts +20 -0
  126. package/lib/types/services/mobile/mobile-text-selection-visuals.d.ts +32 -0
  127. package/lib/types/services/selection/convert-text-range.d.ts +7 -0
  128. package/lib/types/services/selection/doc-selection-render.service.d.ts +38 -21
  129. package/lib/types/types/delete-direction.d.ts +19 -0
  130. package/lib/types/views/DocPasteOptions.d.ts +17 -0
  131. package/lib/types/views/Icon.d.ts +0 -3
  132. package/lib/types/views/PageSettings.d.ts +5 -1
  133. package/lib/types/views/ParagraphMenu.d.ts +1 -2
  134. package/lib/types/views/RichTextEditor.d.ts +20 -1
  135. package/lib/types/views/SideMenu.d.ts +1 -0
  136. package/lib/types/views/doc-statistics/DocPageStatus.d.ts +30 -0
  137. package/lib/types/views/float-toolbar/FloatToolbar.d.ts +1 -0
  138. package/lib/types/views/header-footer/content-cover.d.ts +30 -0
  139. package/lib/types/views/header-footer/panel/DocHeaderFooterOptions.d.ts +4 -0
  140. package/lib/types/views/header-footer/panel/DocHeaderFooterPanel.d.ts +2 -1
  141. package/lib/types/views/header-footer/panel/use-header-footer-options.d.ts +25 -0
  142. package/lib/types/views/mobile/MobileDocCanvasViewport.d.ts +20 -0
  143. package/lib/types/views/mobile/MobileDocPasteOptions.d.ts +21 -0
  144. package/lib/types/views/mobile/MobileDocSettings.d.ts +20 -0
  145. package/lib/types/views/mobile-doc-toolbar/MobileDocToolbar.d.ts +30 -0
  146. package/lib/types/views/mobile-element-menu/MobileDocElementMenu.d.ts +25 -0
  147. package/lib/types/views/mobile-rich-text-editor/MobileRichTextEditor.d.ts +33 -0
  148. package/lib/types/views/page-settings/index.d.ts +39 -0
  149. package/lib/types/views/paragraph-setting/Setting.d.ts +30 -1
  150. package/lib/types/views/paragraph-setting/hook/utils.d.ts +4 -0
  151. package/lib/types/views/paragraph-setting/index.d.ts +2 -1
  152. package/lib/types/views/rich-text-editor/hooks/use-editor.d.ts +8 -0
  153. package/lib/types/views/rich-text-editor/hooks/use-resize.d.ts +2 -1
  154. package/lib/types/views/rich-text-editor/index.d.ts +40 -0
  155. package/lib/types/views/section-setting/Setting.d.ts +12 -1
  156. package/lib/types/views/section-setting/index.d.ts +2 -1
  157. package/lib/types/views/side-menu/index.d.ts +16 -0
  158. package/lib/umd/index.js +19 -18
  159. package/lib/umd/locale/ar-SA.js +1 -1
  160. package/lib/umd/locale/ca-ES.js +1 -1
  161. package/lib/umd/locale/de-DE.js +1 -1
  162. package/lib/umd/locale/en-US.js +1 -1
  163. package/lib/umd/locale/es-ES.js +1 -1
  164. package/lib/umd/locale/fa-IR.js +1 -1
  165. package/lib/umd/locale/fr-FR.js +1 -1
  166. package/lib/umd/locale/id-ID.js +1 -1
  167. package/lib/umd/locale/it-IT.js +1 -1
  168. package/lib/umd/locale/ja-JP.js +1 -1
  169. package/lib/umd/locale/ko-KR.js +1 -1
  170. package/lib/umd/locale/pl-PL.js +1 -1
  171. package/lib/umd/locale/pt-BR.js +1 -1
  172. package/lib/umd/locale/ru-RU.js +1 -1
  173. package/lib/umd/locale/sk-SK.js +1 -1
  174. package/lib/umd/locale/vi-VN.js +1 -1
  175. package/lib/umd/locale/zh-CN.js +1 -1
  176. package/lib/umd/locale/zh-HK.js +1 -1
  177. package/lib/umd/locale/zh-TW.js +1 -1
  178. package/package.json +13 -12
@@ -21,6 +21,8 @@ export declare function resolveParagraphsForSettingPanel(paragraphs: IParagraph[
21
21
  paragraphId: string;
22
22
  styleId?: string;
23
23
  bullet?: import("@univerjs/core").IBullet;
24
+ sourceBullet?: import("@univerjs/core").IBullet | null;
25
+ directBullet?: import("@univerjs/core").IBullet | null;
24
26
  }[];
25
27
  export declare const useCurrentParagraph: () => import("@univerjs/core").IParagraphRange[] | {
26
28
  paragraphStyle: import("@univerjs/core").IParagraphStyle;
@@ -28,6 +30,8 @@ export declare const useCurrentParagraph: () => import("@univerjs/core").IParagr
28
30
  paragraphId: string;
29
31
  styleId?: string;
30
32
  bullet?: import("@univerjs/core").IBullet;
33
+ sourceBullet?: import("@univerjs/core").IBullet | null;
34
+ directBullet?: import("@univerjs/core").IBullet | null;
31
35
  }[];
32
36
  export declare const useFirstParagraphHorizontalAlign: (paragraph: IParagraph[], defaultValue: string) => readonly [string, (v: string) => Promise<boolean>];
33
37
  export declare const useFirstParagraphIndentStart: (paragraph: IParagraph[]) => readonly [number, (v: number) => Promise<boolean>];
@@ -13,4 +13,5 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare function ParagraphSettingIndex(): import("react").JSX.Element;
16
+ import type { IParagraphSettingProps } from './Setting';
17
+ export declare function ParagraphSettingIndex(props: IParagraphSettingProps): import("react").JSX.Element;
@@ -16,7 +16,10 @@
16
16
  import type { IDocumentData, Nullable } from '@univerjs/core';
17
17
  import type { RefObject } from 'react';
18
18
  import type { Editor, IEditorCanvasStyle } from '../../../services/editor/editor';
19
+ import type { IEditorRuntimeConfig } from '../../../services/editor/editor-runtime-config';
19
20
  export interface IUseEditorProps {
21
+ /** Instance-only layout and interaction settings, never persisted in the document. */
22
+ renderConfig?: IEditorRuntimeConfig;
20
23
  editorId: string;
21
24
  initialValue: Nullable<IDocumentData | string>;
22
25
  container: RefObject<HTMLDivElement>;
@@ -24,5 +27,10 @@ export interface IUseEditorProps {
24
27
  autoFocus?: boolean;
25
28
  isSingle?: boolean;
26
29
  canvasStyle?: IEditorCanvasStyle;
30
+ cancelDefaultResizeListener?: boolean;
31
+ disableBackScroll?: boolean;
32
+ documentLayoutSize?: Readonly<Pick<DOMRectReadOnly, 'width' | 'height'>>;
33
+ pixelRatio?: number;
34
+ emitSelectionWhileDragging?: boolean;
27
35
  }
28
36
  export declare function useEditor(opts: IUseEditorProps): Editor | undefined;
@@ -18,5 +18,6 @@ interface IUseResizeReturn {
18
18
  resize: () => void;
19
19
  checkScrollBar: () => void;
20
20
  }
21
- export declare const useResize: (editor?: Editor, isSingle?: boolean, autoScrollbar?: boolean, autoScroll?: boolean) => IUseResizeReturn;
21
+ export declare function resizeEditor(editor: Editor, isSingle: boolean, layoutSize?: Readonly<Pick<DOMRectReadOnly, 'width' | 'height'>>, pixelRatio?: number, documentLayoutSize?: Readonly<Pick<DOMRectReadOnly, 'width' | 'height'>>): void;
22
+ export declare const useResize: (editor?: Editor, isSingle?: boolean, autoScrollbar?: boolean, autoScroll?: boolean, layoutSize?: Readonly<Pick<DOMRectReadOnly, "width" | "height">>, pixelRatio?: number, documentLayoutSize?: Readonly<Pick<DOMRectReadOnly, "width" | "height">>) => IUseResizeReturn;
22
23
  export {};
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { IDocumentData } from '@univerjs/core';
17
+ import type { CSSProperties, ReactNode, RefObject } from 'react';
18
+ import type { Editor } from '../../services/editor/editor';
19
+ import type { IKeyboardEventConfig } from './hooks';
20
+ export interface IRichTextEditorProps {
21
+ className?: string;
22
+ autoFocus?: boolean;
23
+ onFocusChange?: (isFocus: boolean, newValue?: string) => void;
24
+ initialValue?: IDocumentData | string;
25
+ onClickOutside?: () => void;
26
+ keyboardEventConfig?: IKeyboardEventConfig;
27
+ moveCursor?: boolean;
28
+ style?: CSSProperties;
29
+ isSingle?: boolean;
30
+ placeholder?: string;
31
+ editorId?: string;
32
+ onHeightChange?: (height: number) => void;
33
+ onChange?: (data: IDocumentData, str: string) => void;
34
+ maxHeight?: number;
35
+ defaultHeight?: number;
36
+ icon?: ReactNode;
37
+ editorRef?: RefObject<Editor | null> | ((editor: Editor | null) => void);
38
+ noStyle?: boolean;
39
+ }
40
+ export declare const RichTextEditor: (props: IRichTextEditorProps) => import("react/jsx-runtime").JSX.Element;
@@ -13,4 +13,15 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare function SectionSetting(): import("react").JSX.Element | null;
16
+ import type { ComponentType, ReactNode } from 'react';
17
+ import { InputNumber, Select } from '@univerjs/design';
18
+ export interface ISectionSettingProps {
19
+ RowComponent?: ComponentType<{
20
+ label: ReactNode;
21
+ unit?: string;
22
+ children: ReactNode;
23
+ }>;
24
+ InputNumberComponent?: typeof InputNumber;
25
+ SelectComponent?: typeof Select;
26
+ }
27
+ export declare function SectionSetting({ RowComponent, InputNumberComponent, SelectComponent }: ISectionSettingProps): import("react").JSX.Element | null;
@@ -13,4 +13,5 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare function SectionSettingIndex(): import("react").JSX.Element;
16
+ import type { ISectionSettingProps } from './Setting';
17
+ export declare function SectionSettingIndex(props: ISectionSettingProps): import("react").JSX.Element;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export declare function DocSideMenu(): import("react/jsx-runtime").JSX.Element | null;