@univerjs/docs-ui 1.0.0-rc.0 → 1.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 (159) 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/commands/commands/clipboard.command.d.ts +9 -2
  65. package/lib/types/commands/commands/clipboard.inner.command.d.ts +1 -1
  66. package/lib/types/commands/commands/doc-select-all.command.d.ts +1 -0
  67. package/lib/types/commands/commands/format-painter.command.d.ts +33 -0
  68. package/lib/types/commands/commands/table/doc-table-delete.command.d.ts +1 -0
  69. package/lib/types/components/doc-page-render-component.d.ts +21 -0
  70. package/lib/types/config/config.d.ts +2 -0
  71. package/lib/types/consts/mobile-context.d.ts +17 -0
  72. package/lib/types/controllers/doc-header-footer.controller.d.ts +3 -6
  73. package/lib/types/controllers/doc-move-cursor.controller.d.ts +1 -0
  74. package/lib/types/controllers/format-painter.controller.d.ts +23 -0
  75. package/lib/types/controllers/mobile/components.controller.d.ts +25 -0
  76. package/lib/types/controllers/mobile/ui.controller.d.ts +29 -0
  77. package/lib/types/controllers/render-controllers/back-scroll.render-controller.d.ts +4 -3
  78. package/lib/types/controllers/render-controllers/doc-paragraph-placeholder.render-controller.d.ts +4 -3
  79. package/lib/types/controllers/render-controllers/doc-paste-options.render-controller.d.ts +27 -0
  80. package/lib/types/controllers/render-controllers/doc-selection-render.controller.d.ts +2 -0
  81. package/lib/types/controllers/render-controllers/doc-selection-render.util.d.ts +21 -0
  82. package/lib/types/controllers/render-controllers/doc.render-controller.d.ts +19 -5
  83. package/lib/types/controllers/render-controllers/format-painter.render-controller.d.ts +23 -0
  84. package/lib/types/controllers/render-controllers/mobile/back-scroll.render-controller.d.ts +30 -0
  85. package/lib/types/controllers/render-controllers/mobile/doc-pinch-zoom.d.ts +51 -0
  86. package/lib/types/controllers/render-controllers/mobile/doc-selection-render.controller.d.ts +73 -0
  87. package/lib/types/controllers/render-controllers/mobile/doc.render-controller.d.ts +36 -0
  88. package/lib/types/controllers/render-controllers/mobile/zoom.render-controller.d.ts +30 -0
  89. package/lib/types/controllers/render-controllers/zoom.render-controller.d.ts +8 -6
  90. package/lib/types/index.d.ts +10 -1
  91. package/lib/types/locale/en-US.d.ts +30 -0
  92. package/lib/types/menu/context-menu.d.ts +3 -0
  93. package/lib/types/menu/mobile-schema.d.ts +17 -0
  94. package/lib/types/mobile-plugin.d.ts +36 -0
  95. package/lib/types/services/clipboard/clipboard.service.d.ts +53 -20
  96. package/lib/types/services/clipboard/paste-options.d.ts +33 -0
  97. package/lib/types/services/doc-contextual-ribbon.service.d.ts +29 -0
  98. package/lib/types/services/doc-event-manager.service.d.ts +3 -0
  99. package/lib/types/services/doc-mobile-element-menu.service.d.ts +44 -0
  100. package/lib/types/services/doc-page-layout.service.d.ts +3 -0
  101. package/lib/types/services/doc-paragraph-menu.service.d.ts +3 -2
  102. package/lib/types/services/doc-popup-manager.service.d.ts +1 -0
  103. package/lib/types/services/doc-view-scale.d.ts +1 -1
  104. package/lib/types/services/editor/editor-manager.service.d.ts +2 -0
  105. package/lib/types/services/editor/editor-runtime-config.d.ts +24 -0
  106. package/lib/types/services/editor/editor.d.ts +9 -0
  107. package/lib/types/services/float-menu.service.d.ts +12 -4
  108. package/lib/types/services/mobile/doc-selection-render.service.d.ts +60 -0
  109. package/lib/types/services/mobile/doc-view-scale.d.ts +19 -0
  110. package/lib/types/services/mobile/float-menu.service.d.ts +20 -0
  111. package/lib/types/services/mobile/mobile-text-selection-visuals.d.ts +32 -0
  112. package/lib/types/services/selection/convert-text-range.d.ts +7 -0
  113. package/lib/types/services/selection/doc-selection-render.service.d.ts +38 -21
  114. package/lib/types/views/DocPasteOptions.d.ts +17 -0
  115. package/lib/types/views/Icon.d.ts +0 -3
  116. package/lib/types/views/PageSettings.d.ts +5 -1
  117. package/lib/types/views/ParagraphMenu.d.ts +1 -2
  118. package/lib/types/views/RichTextEditor.d.ts +20 -1
  119. package/lib/types/views/SideMenu.d.ts +1 -0
  120. package/lib/types/views/doc-statistics/DocPageStatus.d.ts +30 -0
  121. package/lib/types/views/float-toolbar/FloatToolbar.d.ts +1 -0
  122. package/lib/types/views/header-footer/content-cover.d.ts +30 -0
  123. package/lib/types/views/header-footer/panel/DocHeaderFooterOptions.d.ts +4 -0
  124. package/lib/types/views/header-footer/panel/DocHeaderFooterPanel.d.ts +2 -1
  125. package/lib/types/views/header-footer/panel/use-header-footer-options.d.ts +25 -0
  126. package/lib/types/views/mobile/MobileDocCanvasViewport.d.ts +20 -0
  127. package/lib/types/views/mobile/MobileDocPasteOptions.d.ts +21 -0
  128. package/lib/types/views/mobile/MobileDocSettings.d.ts +20 -0
  129. package/lib/types/views/mobile-doc-toolbar/MobileDocToolbar.d.ts +30 -0
  130. package/lib/types/views/mobile-element-menu/MobileDocElementMenu.d.ts +25 -0
  131. package/lib/types/views/mobile-rich-text-editor/MobileRichTextEditor.d.ts +33 -0
  132. package/lib/types/views/paragraph-setting/Setting.d.ts +30 -1
  133. package/lib/types/views/paragraph-setting/hook/utils.d.ts +4 -0
  134. package/lib/types/views/paragraph-setting/index.d.ts +2 -1
  135. package/lib/types/views/rich-text-editor/hooks/use-editor.d.ts +8 -0
  136. package/lib/types/views/rich-text-editor/hooks/use-resize.d.ts +2 -1
  137. package/lib/types/views/section-setting/Setting.d.ts +12 -1
  138. package/lib/types/views/section-setting/index.d.ts +2 -1
  139. package/lib/umd/index.js +19 -18
  140. package/lib/umd/locale/ar-SA.js +1 -1
  141. package/lib/umd/locale/ca-ES.js +1 -1
  142. package/lib/umd/locale/de-DE.js +1 -1
  143. package/lib/umd/locale/en-US.js +1 -1
  144. package/lib/umd/locale/es-ES.js +1 -1
  145. package/lib/umd/locale/fa-IR.js +1 -1
  146. package/lib/umd/locale/fr-FR.js +1 -1
  147. package/lib/umd/locale/id-ID.js +1 -1
  148. package/lib/umd/locale/it-IT.js +1 -1
  149. package/lib/umd/locale/ja-JP.js +1 -1
  150. package/lib/umd/locale/ko-KR.js +1 -1
  151. package/lib/umd/locale/pl-PL.js +1 -1
  152. package/lib/umd/locale/pt-BR.js +1 -1
  153. package/lib/umd/locale/ru-RU.js +1 -1
  154. package/lib/umd/locale/sk-SK.js +1 -1
  155. package/lib/umd/locale/vi-VN.js +1 -1
  156. package/lib/umd/locale/zh-CN.js +1 -1
  157. package/lib/umd/locale/zh-HK.js +1 -1
  158. package/lib/umd/locale/zh-TW.js +1 -1
  159. package/package.json +13 -12
@@ -15,7 +15,8 @@
15
15
  */
16
16
  import type { DocumentDataModel, Nullable } from '@univerjs/core';
17
17
  import type { IDocSelectionInnerParam, IMouseEvent, INodePosition, IPointerEvent, IRenderContext, IRenderModule, ISuccinctDocRangeParam, ITextRangeWithStyle } from '@univerjs/engine-render';
18
- import { ILogService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
18
+ import type { RectRange } from './rect-range';
19
+ import { IContextService, ILogService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
19
20
  import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
20
21
  import { ILayoutService } from '@univerjs/ui';
21
22
  import { IDocEmbedInteractionBoundaryService, IDocEmbedRuntimeFocusCoordinator } from '../doc-embed-integration.service';
@@ -27,9 +28,10 @@ export interface IEditorInputConfig {
27
28
  rangeList?: ITextRangeWithStyle[];
28
29
  }
29
30
  export declare class DocSelectionRenderService extends RxDisposable implements IRenderModule {
30
- private readonly _context;
31
+ protected readonly _context: IRenderContext<DocumentDataModel>;
31
32
  private readonly _layoutService;
32
33
  private readonly _logService;
34
+ private readonly _contextService;
33
35
  private readonly _univerInstanceService;
34
36
  private readonly _docSkeletonManagerService;
35
37
  private readonly _docSelectionManagerService;
@@ -54,22 +56,24 @@ export declare class DocSelectionRenderService extends RxDisposable implements I
54
56
  readonly onPaste$: import("rxjs").Observable<IEditorInputConfig>;
55
57
  private readonly _textSelectionInner$;
56
58
  readonly textSelectionInner$: import("rxjs").Observable<Nullable<IDocSelectionInnerParam>>;
59
+ private readonly _movingSelection$;
60
+ readonly movingSelection$: import("rxjs").Observable<IDocSelectionInnerParam>;
57
61
  private readonly _onFocus$;
58
62
  readonly onFocus$: import("rxjs").Observable<IEditorInputConfig>;
59
63
  private readonly _onBlur$;
60
64
  readonly onBlur$: import("rxjs").Observable<IEditorInputConfig>;
61
65
  private readonly _onPointerDown$;
62
66
  readonly onPointerDown$: import("rxjs").Observable<void>;
63
- private _container;
67
+ protected _container: HTMLDivElement;
64
68
  private _inputParent;
65
69
  private _input;
66
70
  private _scrollTimers;
67
- private _rangeList;
68
- private _rangeListCache;
71
+ protected _rangeList: TextRange[];
72
+ protected _rangeListCache: TextRange[];
69
73
  private _rectRangeList;
70
- private _rectRangeListCache;
71
- private _anchorNodePosition;
72
- private _focusNodePosition;
74
+ protected _rectRangeListCache: RectRange[];
75
+ protected _anchorNodePosition: Nullable<INodePosition>;
76
+ protected _focusNodePosition: Nullable<INodePosition>;
73
77
  private _currentSegmentId;
74
78
  private _currentSegmentPage;
75
79
  private readonly _segmentContext$;
@@ -78,7 +82,7 @@ export declare class DocSelectionRenderService extends RxDisposable implements I
78
82
  segmentPage: number;
79
83
  }>;
80
84
  private _selectionStyle;
81
- private _onPointerEvent;
85
+ protected _onPointerEvent: boolean;
82
86
  private _viewPortObserverMap;
83
87
  private _isIMEInputApply;
84
88
  private _scenePointerMoveSubs;
@@ -88,9 +92,10 @@ export declare class DocSelectionRenderService extends RxDisposable implements I
88
92
  get hasPendingSelection(): boolean;
89
93
  get isOnPointerEvent(): boolean;
90
94
  get isFocusing(): boolean;
95
+ get isEditing(): boolean;
91
96
  get canFocusing(): boolean;
92
97
  cancelPointerSelection(): void;
93
- constructor(_context: IRenderContext<DocumentDataModel>, _layoutService: ILayoutService, _logService: ILogService, _univerInstanceService: IUniverInstanceService, _docSkeletonManagerService: DocSkeletonManagerService, _docSelectionManagerService: DocSelectionManagerService, _embedInteractionBoundaryService?: IDocEmbedInteractionBoundaryService | undefined, _embedRuntimeFocusCoordinator?: IDocEmbedRuntimeFocusCoordinator | undefined);
98
+ constructor(_context: IRenderContext<DocumentDataModel>, _layoutService: ILayoutService, _logService: ILogService, _contextService: IContextService, _univerInstanceService: IUniverInstanceService, _docSkeletonManagerService: DocSkeletonManagerService, _docSelectionManagerService: DocSelectionManagerService, _embedInteractionBoundaryService?: IDocEmbedInteractionBoundaryService | undefined, _embedRuntimeFocusCoordinator?: IDocEmbedRuntimeFocusCoordinator | undefined);
94
99
  private _listenCurrentUnitChange;
95
100
  get activeViewPort(): import("@univerjs/engine-render").Viewport;
96
101
  setSegment(id: string): void;
@@ -109,21 +114,27 @@ export declare class DocSelectionRenderService extends RxDisposable implements I
109
114
  addDocRanges(ranges: ISuccinctDocRangeParam[], isEditing?: boolean, options?: {
110
115
  [key: string]: boolean;
111
116
  }, replace?: boolean): boolean;
112
- setCursorManually(evtOffsetX: number, evtOffsetY: number): void;
117
+ setCursorManually(evtOffsetX: number, evtOffsetY: number, isEditing?: boolean, shouldFocusInput?: boolean, options?: {
118
+ strict?: boolean;
119
+ }): void;
113
120
  sync(): void;
114
121
  setInputPosition(x: number, y: number): void;
115
122
  activate(x: number, y: number, force?: boolean): void;
116
- private _positionInput;
123
+ protected _positionInput(x: number, y: number): void;
117
124
  hasFocus(): boolean;
118
125
  focus(): void;
119
126
  blur(): void;
120
127
  deactivate(): void;
121
- __handleDblClick(evt: IPointerEvent | IMouseEvent): void;
128
+ __handleDblClick(evt: IPointerEvent | IMouseEvent, isEditing?: boolean, shouldFocusInput?: boolean): void;
122
129
  __handleTripleClick(evt: IPointerEvent | IMouseEvent): void;
123
- __onPointDown(evt: IPointerEvent | IMouseEvent): void;
130
+ __onPointDown(evt: IPointerEvent | IMouseEvent, shouldFocusInput?: boolean): void;
124
131
  private _clearUnresolvedSelection;
132
+ enterEditing(): boolean;
133
+ exitEditing(): void;
125
134
  removeAllRanges(): void;
126
135
  getActiveTextRange(): TextRange | undefined;
136
+ protected _setEditing(isEditing: boolean): void;
137
+ protected _emitCurrentSelection(isEditing: boolean): void;
127
138
  private _disposeScrollTimers;
128
139
  private _setSystemHighlightColorToStyle;
129
140
  private _getAllTextRanges;
@@ -131,18 +142,18 @@ export declare class DocSelectionRenderService extends RxDisposable implements I
131
142
  getAllTextRanges(): ITextRangeWithStyle[];
132
143
  getAllRectRanges(): import("@univerjs/engine-render").IRectRangeWithStyle[];
133
144
  private _getActiveRange;
134
- private _getActiveRangeInstance;
145
+ protected _getActiveRangeInstance(): TextRange | undefined;
135
146
  dispose(): void;
136
147
  private _initDOM;
137
148
  private _registerContainer;
138
149
  private _initInput;
139
- private _ensureHostContainer;
150
+ protected _ensureHostContainer(): void;
140
151
  private _getOwnerDocument;
141
152
  private _getNodePosition;
142
153
  private _interactTextRanges;
143
154
  private _interactRectRanges;
144
155
  private _removeAllRanges;
145
- private _removeAllCacheRanges;
156
+ protected _removeAllCacheRanges(): void;
146
157
  private _removeAllTextRanges;
147
158
  private _removeAllRectRanges;
148
159
  private _removeAllCollapsedTextRanges;
@@ -150,15 +161,18 @@ export declare class DocSelectionRenderService extends RxDisposable implements I
150
161
  private _deactivateAllTextRanges;
151
162
  private _deactivateAllRectRanges;
152
163
  private _addTextRangesToCache;
153
- private _addTextRange;
164
+ protected _addTextRange(textRange: TextRange): void;
154
165
  private _addRectRangesToCache;
155
- private _addRectRanges;
166
+ protected _addRectRanges(rectRanges: RectRange[]): void;
156
167
  private _createTextRangeByAnchorPosition;
157
168
  private _updateActiveRangePosition;
158
169
  private _isEmpty;
159
170
  private _getCanvasOffset;
160
- private _updateInputPosition;
161
- private _tryMoving;
171
+ protected _updateInputPosition({ forceFocus, preserveFocus }?: {
172
+ forceFocus?: boolean | undefined;
173
+ preserveFocus?: boolean | undefined;
174
+ }): void;
175
+ protected _tryMoving(moveOffsetX: number, moveOffsetY: number): void;
162
176
  private _moving;
163
177
  private _hasVisibleSelectionRanges;
164
178
  private _shouldSnapBackwardFocusToGlyphStart;
@@ -167,6 +181,9 @@ export declare class DocSelectionRenderService extends RxDisposable implements I
167
181
  __attachScrollEvent(): void;
168
182
  private _initInputEvents;
169
183
  private _refreshMissingInputRange;
184
+ protected _handleInputFocus(event: Event): void;
185
+ protected _handleInputBlur(event: Event): void;
186
+ protected _emitInputBlur(event: Event): void;
170
187
  private _eventHandle;
171
188
  private _shouldSuppressHostHiddenEditorEvent;
172
189
  private _stopEmbedOwnedEditorShortcutPropagation;
@@ -0,0 +1,17 @@
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 const DOC_PASTE_OPTIONS_COMPONENT = "docs-ui.paste-options";
17
+ export declare function DocPasteOptions(): import("react").JSX.Element | null;
@@ -17,9 +17,6 @@ import type { IconType, IIconProps } from '@univerjs/ui';
17
17
  type ColorSwatchIconProps = IIconProps & {
18
18
  color: string;
19
19
  };
20
- export declare function TitleTypeIcon({ className, style, onClick }: IIconProps): import("react").JSX.Element;
21
- export declare function SubtitleTypeIcon({ className, style, onClick }: IIconProps): import("react").JSX.Element;
22
- export declare function TextColorSwatchIcon({ className, style, onClick, color }: ColorSwatchIconProps): import("react").JSX.Element;
23
20
  export declare function BackgroundColorSwatchIcon({ className, style, onClick, color }: ColorSwatchIconProps): import("react").JSX.Element;
24
21
  export declare function HeaderTextColorIcon({ className, style, onClick, extend }: IIconProps): import("react").JSX.Element;
25
22
  export declare function DefaultTextColorIcon({ className, style, onClick }: IIconProps): import("react").JSX.Element;
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import type { IConfirmChildrenProps } from '@univerjs/ui';
17
17
  import { DocumentFlavor, ModernDocumentWidthMode, PageOrientType } from '@univerjs/core';
18
+ import { InputNumber, Select } from '@univerjs/design';
18
19
  export interface IPageSettingsProps {
19
20
  onClose: () => void;
20
21
  onConfirm: (settings: IPageSettings) => void;
@@ -35,5 +36,8 @@ export interface IPageSettings {
35
36
  height: number;
36
37
  };
37
38
  }
38
- export declare function PageSettings(props: IConfirmChildrenProps): import("react").JSX.Element;
39
+ export declare function PageSettings(props: IConfirmChildrenProps & {
40
+ InputNumberComponent?: typeof InputNumber;
41
+ SelectComponent?: typeof Select;
42
+ }): import("react").JSX.Element;
39
43
  export declare const PAGE_SETTING_COMPONENT_ID = "docs.component.page-setting";
@@ -22,7 +22,6 @@ import type { IMutiPageParagraphBound } from '../services/doc-event-manager.serv
22
22
  import type { IDocBlockMenuTarget } from '../services/doc-paragraph-menu.service';
23
23
  import { NamedStyleType } from '@univerjs/core';
24
24
  import { DocBlockMoveValidatorService } from '@univerjs/docs';
25
- import { ILayoutService } from '@univerjs/ui';
26
25
  import { DocParagraphMenuService } from '../services/doc-paragraph-menu.service';
27
26
  export declare function getParagraphMenuPopupDirection(anchorLeft: number, menuWidth?: number, viewportPadding?: number, options?: {
28
27
  anchorRight?: number;
@@ -69,7 +68,7 @@ export declare function unwrapBlockRangeBody(documentBody: IDocumentBody, blockR
69
68
  export declare function buildUnwrapBlockRangeActions(previousBody: IDocumentBody, nextBody: IDocumentBody, blockRange: IDocumentBlockRange): JSONXActions | null;
70
69
  export declare function getParagraphFormattingRange(target: IDocBlockMenuTarget | null | undefined, paragraph?: IMutiPageParagraphBound | null): ITextRangeWithStyle | null;
71
70
  export declare function getParagraphMenuCommandTargetRange(commandId: string | undefined, targetRange?: ITextRangeWithStyle | null, formattingRange?: ITextRangeWithStyle | null): ITextRangeWithStyle | null | undefined;
72
- export declare function finishParagraphMenuCommand(docParagraphMenuService: Pick<DocParagraphMenuService, 'hideParagraphMenu'> | null | undefined, layoutService: Pick<ILayoutService, 'focus'>, hideMenu: () => void): void;
71
+ export declare function finishParagraphMenuCommand(docParagraphMenuService: Pick<DocParagraphMenuService, 'hideParagraphMenu'> | null | undefined, hideMenu: () => void): void;
73
72
  export declare function getBlockRangeClipboardTargetRange(commandId: string, target: IDocBlockMenuTarget | null | undefined, paragraph?: IMutiPageParagraphBound | null | void): ITextRangeWithStyle | null;
74
73
  export declare const ParagraphMenu: ({ popup }: {
75
74
  popup: IPopup;
@@ -16,8 +16,11 @@
16
16
  import type { IDocumentData } from '@univerjs/core';
17
17
  import type { CSSProperties, ReactNode, RefObject } from 'react';
18
18
  import type { Editor, IEditorCanvasStyle } from '../services/editor/editor';
19
- import type { IKeyboardEventConfig } from './rich-text-editor/hooks';
19
+ import type { IEditorRuntimeConfig } from '../services/editor/editor-runtime-config';
20
+ import type { IKeyboardEventConfig } from './rich-text-editor/hooks/use-keyboard-event';
20
21
  export interface IRichTextEditorProps {
22
+ /** Instance-only layout and interaction settings, never persisted in the document. */
23
+ renderConfig?: IEditorRuntimeConfig;
21
24
  className?: string;
22
25
  autoFocus?: boolean;
23
26
  onFocusChange?: (isFocus: boolean, newValue?: string) => void;
@@ -25,6 +28,22 @@ export interface IRichTextEditorProps {
25
28
  onClickOutside?: () => void;
26
29
  /** Keep the globally focused unit on the editor's host while this editor receives input focus. */
27
30
  preserveHostFocus?: boolean;
31
+ /** Let the host own engine sizing, including a fixed backing-store ratio. */
32
+ cancelDefaultResizeListener?: boolean;
33
+ /** Fixed canvas backing-store ratio used with a host-managed layout. */
34
+ pixelRatio?: number;
35
+ /** Use an untransformed layout size when the editor DOM is displayed through a CSS transform. */
36
+ layoutSize?: Readonly<Pick<DOMRectReadOnly, 'width' | 'height'>>;
37
+ /** Keep document reflow independent from an oversized host-managed canvas. */
38
+ documentLayoutSize?: Readonly<Pick<DOMRectReadOnly, 'width' | 'height'>>;
39
+ /** Keep the editor viewport anchored while a host expands it to fit content. */
40
+ autoScroll?: boolean;
41
+ /** Let the editor create scrollbars when its content exceeds the current layout size. */
42
+ autoScrollbar?: boolean;
43
+ /** Publish transient drag ranges to the host. Defaults to false. */
44
+ emitSelectionWhileDragging?: boolean;
45
+ /** Keep host keyboard handlers active for non-collapsed selections. Defaults to false. */
46
+ keyboardEventsOnSelection?: boolean;
28
47
  keyboardEventConfig?: IKeyboardEventConfig;
29
48
  moveCursor?: boolean;
30
49
  style?: CSSProperties;
@@ -21,6 +21,7 @@ export interface ISideMenuItem {
21
21
  isTitle?: boolean;
22
22
  }
23
23
  export interface ISideMenuProps {
24
+ label: string;
24
25
  menus?: ISideMenuItem[];
25
26
  onClick?: (menu: ISideMenuItem) => void;
26
27
  className?: string;
@@ -0,0 +1,30 @@
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 { IDocumentLayoutProgress, IDocumentSkeletonPage } from '@univerjs/engine-render';
17
+ type PageGeometry = Pick<IDocumentSkeletonPage, 'isLayoutPlaceholder' | 'isMaterializationPlaceholder' | 'pageHeight' | 'pageWidth'>;
18
+ type LayoutProgress = Pick<IDocumentLayoutProgress, 'complete' | 'publishedPageCount'>;
19
+ interface IDocPageStatus {
20
+ currentPage: number | null;
21
+ totalPages: number | null;
22
+ dragTooltip: {
23
+ left: number;
24
+ page: number;
25
+ top: number;
26
+ } | null;
27
+ }
28
+ export declare function resolveDocPageStatus(pages: Readonly<PageGeometry[]>, viewportCenter: number, pageGap: number, vertical: boolean, progress?: LayoutProgress | null): Pick<IDocPageStatus, 'currentPage' | 'totalPages'>;
29
+ export declare function DocPageStatus(): import("react").JSX.Element | null;
30
+ export {};
@@ -20,6 +20,7 @@ interface IFloatToolbarProps {
20
20
  popup?: {
21
21
  extraProps?: {
22
22
  onDismiss?: () => void;
23
+ onMount?: () => () => void;
23
24
  };
24
25
  };
25
26
  }
@@ -0,0 +1,30 @@
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 { Documents, IViewportInfo, Scene, UniverRenderingContext } from '@univerjs/engine-render';
17
+ import { BaseObject } from '@univerjs/engine-render';
18
+ /** A paint-only overlay. It never participates in hit testing or selection. */
19
+ export declare class HeaderFooterContentCover extends BaseObject {
20
+ private readonly _documents;
21
+ private readonly _scene;
22
+ color: string;
23
+ constructor(key: string, _documents: Documents, _scene: Scene);
24
+ render(ctx: UniverRenderingContext, viewport?: IViewportInfo): void;
25
+ private _collectStoryBounds;
26
+ private _collectDrawingBounds;
27
+ private _transformBounds;
28
+ private _appendClipped;
29
+ private _collectTextAndTables;
30
+ }
@@ -13,7 +13,11 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import type { ComponentType } from 'react';
16
17
  export interface IDocHeaderFooterOptionsProps {
17
18
  unitId: string;
19
+ ContentComponent?: ComponentType<{
20
+ unitId: string;
21
+ }>;
18
22
  }
19
23
  export declare const DocHeaderFooterOptions: (props: IDocHeaderFooterOptionsProps) => import("react").JSX.Element;
@@ -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 const DocHeaderFooterPanel: () => import("react").JSX.Element;
16
+ import type { IDocHeaderFooterOptionsProps } from './DocHeaderFooterOptions';
17
+ export declare const DocHeaderFooterPanel: (props: Pick<IDocHeaderFooterOptionsProps, "ContentComponent">) => import("react").JSX.Element;
@@ -0,0 +1,25 @@
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 { IHeaderFooterProps } from '@univerjs/docs';
17
+ export declare function useHeaderFooterOptions(unitId: string): {
18
+ canLinkToPrevious: boolean;
19
+ linkedToPrevious: boolean;
20
+ options: IHeaderFooterProps;
21
+ handleLinkToPreviousChange: (linked: boolean) => Promise<void>;
22
+ handleCheckboxChange: (val: boolean, type: "useFirstPageHeaderFooter" | "evenAndOddHeaders") => void;
23
+ handleMarginChange: (val: number, type: "marginHeader" | "marginFooter") => Promise<void>;
24
+ closeHeaderFooter: () => void;
25
+ };
@@ -0,0 +1,20 @@
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 { RefObject } from 'react';
17
+ export declare function MobileDocCanvasViewport({ containerRef, canvasRef }: {
18
+ containerRef: RefObject<HTMLElement | null>;
19
+ canvasRef: RefObject<HTMLElement | null>;
20
+ }): null;
@@ -0,0 +1,21 @@
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 { IPopupWithExtraProps } from '@univerjs/ui';
17
+ export declare function MobileDocPasteOptions({ popup }: {
18
+ popup: IPopupWithExtraProps<{
19
+ unitId: string;
20
+ }>;
21
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,20 @@
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 { IConfirmChildrenProps } from '@univerjs/ui';
17
+ export declare function MobilePageSettings(props: IConfirmChildrenProps): import("react").JSX.Element;
18
+ export declare function MobileParagraphSettings(): import("react").JSX.Element;
19
+ export declare function MobileSectionSettings(): import("react").JSX.Element;
20
+ export declare function MobileHeaderFooterPanel(): import("react").JSX.Element;
@@ -0,0 +1,30 @@
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 { IMenuSchema, IValueOption } from '@univerjs/ui';
17
+ import { IMenuManagerService } from '@univerjs/ui';
18
+ interface IMobileDocMenuSchemas {
19
+ insert: IMenuSchema[];
20
+ format: IMenuSchema[];
21
+ more: IMenuSchema[];
22
+ }
23
+ export declare function getMobileDocMenuSchemas(menuManagerService: IMenuManagerService): IMobileDocMenuSchemas;
24
+ export declare function getMobileDocMenuCommand(option: IValueOption): {
25
+ commandId: string;
26
+ params?: Record<string, unknown>;
27
+ } | null;
28
+ export declare function MobileDocEditDoneButton(): import("react").JSX.Element | null;
29
+ export declare function MobileDocToolbar(): import("react").JSX.Element | null;
30
+ export {};
@@ -0,0 +1,25 @@
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 { IPopupWithExtraProps } from '@univerjs/ui';
17
+ export declare const MOBILE_DOC_ELEMENT_MENU = "docs-ui.mobile-element-menu";
18
+ export interface IMobileDocElementMenuProps {
19
+ onEdit: () => unknown;
20
+ onDelete: () => unknown;
21
+ }
22
+ export declare function MobileDocElementMenu(props: IMobileDocElementMenuProps): import("react").JSX.Element;
23
+ export declare function MobileDocElementMenuPopup({ popup }: {
24
+ popup: IPopupWithExtraProps<IMobileDocElementMenuProps>;
25
+ }): import("react").JSX.Element;
@@ -0,0 +1,33 @@
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 { IRichTextEditorProps } from '../RichTextEditor';
17
+ interface IMobileRichTextEditorProps extends Pick<IRichTextEditorProps, 'initialValue' | 'editorId' | 'autoFocus' | 'canvasStyle' | 'keyboardEventConfig' | 'onChange'> {
18
+ editorId: string;
19
+ expanded: boolean;
20
+ onExpandedChange: (expanded: boolean) => void;
21
+ onCancel: () => void;
22
+ onConfirm: () => void;
23
+ labels: {
24
+ title: string;
25
+ cancel: string;
26
+ confirm: string;
27
+ expand: string;
28
+ collapse: string;
29
+ };
30
+ }
31
+ /** Compact object text input; expanding keeps the same document editor mounted. */
32
+ export declare function MobileRichTextEditor(props: IMobileRichTextEditorProps): import("react").JSX.Element;
33
+ export {};
@@ -13,4 +13,33 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare function ParagraphSetting(): import("react").JSX.Element;
16
+ import type { ComponentType, ReactNode } from 'react';
17
+ import { Select } from '@univerjs/design';
18
+ declare const ParagraphSettingRow: (props: {
19
+ label: string;
20
+ unit?: string;
21
+ children: ReactNode;
22
+ }) => import("react").JSX.Element;
23
+ declare const AutoFocusInputNumber: (props: {
24
+ value: number;
25
+ onChange: (v: number) => Promise<unknown>;
26
+ className?: string;
27
+ min?: number;
28
+ max?: number;
29
+ step?: number;
30
+ precision?: number;
31
+ }) => import("react").JSX.Element;
32
+ export interface IParagraphSettingProps {
33
+ RowComponent?: typeof ParagraphSettingRow;
34
+ NumberComponent?: typeof AutoFocusInputNumber;
35
+ SelectComponent?: typeof Select;
36
+ AlignmentButtonComponent?: ComponentType<IParagraphAlignmentButtonProps>;
37
+ }
38
+ export interface IParagraphAlignmentButtonProps {
39
+ label: string;
40
+ selected: boolean;
41
+ onClick: () => void;
42
+ children: ReactNode;
43
+ }
44
+ export declare function ParagraphSetting({ RowComponent, NumberComponent, SelectComponent, AlignmentButtonComponent, }: IParagraphSettingProps): import("react").JSX.Element;
45
+ export {};
@@ -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 {};