@univerjs/docs-ui 0.1.17 → 0.2.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.
package/lib/index.css CHANGED
@@ -1 +1 @@
1
- .univer-docs-ui-canvas-background{position:relative;width:100%;height:100%;background:rgb(var(--grey-50));z-index:1;user-select:none;pointer-events:none}
1
+ .univer-docs-ui-canvas-background{position:relative;width:100%;height:100%;background:rgb(var(--grey-50));z-index:1;user-select:none;pointer-events:none}.univer-panel{padding-top:20px;font-size:var(--font-size-sm)}.univer-options-section{margin-top:10px;padding-bottom:10px}.univer-options-form-item{display:block;margin-bottom:5px}.univer-options-input{width:80%;margin-top:5px}.univer-options-margin-setting{display:flex}
@@ -24,6 +24,18 @@
24
24
  "alignLeft": "Align Left",
25
25
  "alignCenter": "Align Center",
26
26
  "alignRight": "Align Right",
27
- "alignJustify": "Justify"
27
+ "alignJustify": "Justify",
28
+ "headerFooter": "Header & Footer"
29
+ },
30
+ "headerFooter": {
31
+ "header": "Header",
32
+ "footer": "Footer",
33
+ "panel": "Header & Footer Settings",
34
+ "firstPageCheckBox": "Different first page",
35
+ "oddEvenCheckBox": "Different odd and even pages",
36
+ "headerTopMargin": "Header top margin(px)",
37
+ "footerBottomMargin": "Footer bottom margin(px)",
38
+ "closeHeaderFooter": "Close header & footer",
39
+ "disableText": "Header & footer settings are disabled"
28
40
  }
29
41
  }
@@ -24,6 +24,18 @@
24
24
  "alignLeft": "Выровнять по левому краю",
25
25
  "alignCenter": "Выровнять по центру",
26
26
  "alignRight": "Выровнять по правому краю",
27
- "alignJustify": "Выровнять по ширине"
27
+ "alignJustify": "Выровнять по ширине",
28
+ "headerFooter": "Header & Footer"
29
+ },
30
+ "headerFooter": {
31
+ "header": "Header",
32
+ "footer": "Footer",
33
+ "panel": "Header & Footer Settings",
34
+ "firstPageCheckBox": "Different first page",
35
+ "oddEvenCheckBox": "Different odd and even pages",
36
+ "headerTopMargin": "Header top margin(px)",
37
+ "footerBottomMargin": "Footer bottom margin(px)",
38
+ "closeHeaderFooter": "Close header & footer",
39
+ "disableText": "Header & footer settings are disabled"
28
40
  }
29
41
  }
@@ -24,6 +24,18 @@
24
24
  "alignLeft": "左对齐",
25
25
  "alignCenter": "居中对齐",
26
26
  "alignRight": "右对齐",
27
- "alignJustify": "两端对齐"
27
+ "alignJustify": "两端对齐",
28
+ "headerFooter": "页眉页脚"
29
+ },
30
+ "headerFooter": {
31
+ "header": "页眉",
32
+ "footer": "页脚",
33
+ "panel": "页眉页脚设置",
34
+ "firstPageCheckBox": "首页不同",
35
+ "oddEvenCheckBox": "奇偶页不同",
36
+ "headerTopMargin": "页眉顶端距离(px)",
37
+ "footerBottomMargin": "页脚底端距离(px)",
38
+ "closeHeaderFooter": "关闭页眉页脚",
39
+ "disableText": "页眉页脚设置不可用"
28
40
  }
29
41
  }
@@ -0,0 +1,24 @@
1
+ import { ICommand, BooleanNumber } from '@univerjs/core';
2
+ import { HeaderFooterType } from '../../controllers/doc-header-footer.controller';
3
+
4
+ export interface IHeaderFooterProps {
5
+ marginHeader?: number;
6
+ marginFooter?: number;
7
+ useFirstPageHeaderFooter?: BooleanNumber;
8
+ evenAndOddHeaders?: BooleanNumber;
9
+ }
10
+ export interface ICoreHeaderFooterParams {
11
+ unitId: string;
12
+ createType?: HeaderFooterType;
13
+ segmentId?: string;
14
+ headerFooterProps?: IHeaderFooterProps;
15
+ }
16
+ export declare const CoreHeaderFooterCommandId = "doc.command.core-header-footer";
17
+ /**
18
+ * The command to update header and footer or create them.
19
+ */
20
+ export declare const CoreHeaderFooterCommand: ICommand<ICoreHeaderFooterParams>;
21
+ interface IOpenHeaderFooterPanelParams {
22
+ }
23
+ export declare const OpenHeaderFooterPanelCommand: ICommand<IOpenHeaderFooterPanelParams>;
24
+ export {};
@@ -0,0 +1,6 @@
1
+ import { ICommand } from '@univerjs/core';
2
+
3
+ export interface IUIComponentCommandParams {
4
+ value: string;
5
+ }
6
+ export declare const SidebarDocHeaderFooterPanelOperation: ICommand;
@@ -0,0 +1,35 @@
1
+ import { DocumentDataModel, Disposable, ICommandService, IUniverInstanceService, LocaleService } from '@univerjs/core';
2
+ import { IRenderContext, IRenderModule, IRenderManagerService, ITextSelectionRenderManager } from '@univerjs/engine-render';
3
+ import { ComponentManager, IEditorService } from '@univerjs/ui';
4
+ import { DocSkeletonManagerService } from '@univerjs/docs';
5
+
6
+ export declare enum HeaderFooterType {
7
+ FIRST_PAGE_HEADER = 0,
8
+ FIRST_PAGE_FOOTER = 1,
9
+ DEFAULT_HEADER = 2,
10
+ DEFAULT_FOOTER = 3,
11
+ EVEN_PAGE_HEADER = 4,
12
+ EVEN_PAGE_FOOTER = 5
13
+ }
14
+ export declare class DocHeaderFooterController extends Disposable implements IRenderModule {
15
+ private readonly _context;
16
+ private readonly _commandService;
17
+ private readonly _editorService;
18
+ private readonly _instanceSrv;
19
+ private readonly _renderManagerService;
20
+ private readonly _docSkeletonManagerService;
21
+ private readonly _textSelectionRenderManager;
22
+ private readonly _localeService;
23
+ private readonly _componentManager;
24
+ private _loadedMap;
25
+ constructor(_context: IRenderContext<DocumentDataModel>, _commandService: ICommandService, _editorService: IEditorService, _instanceSrv: IUniverInstanceService, _renderManagerService: IRenderManagerService, _docSkeletonManagerService: DocSkeletonManagerService, _textSelectionRenderManager: ITextSelectionRenderManager, _localeService: LocaleService, _componentManager: ComponentManager);
26
+ private _initialize;
27
+ private _registerCommands;
28
+ private _initCustomComponents;
29
+ private _init;
30
+ private _initialMain;
31
+ private _getTransformCoordForDocumentOffset;
32
+ private _drawHeaderFooterLabel;
33
+ private _isEditorReadOnly;
34
+ private _getDocDataModel;
35
+ }
@@ -10,6 +10,7 @@ export declare function SuperscriptMenuItemFactory(accessor: IAccessor): IMenuBu
10
10
  export declare function FontFamilySelectorMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<string>;
11
11
  export declare function FontSizeSelectorMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<number>;
12
12
  export declare function TextColorSelectorMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<string>;
13
+ export declare function HeaderFooterMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
13
14
  export declare function AlignLeftMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
14
15
  export declare function AlignCenterMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
15
16
  export declare function AlignRightMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
@@ -1,14 +1,18 @@
1
- import { DocumentDataModel, RxDisposable } from '@univerjs/core';
2
- import { DocSkeletonManagerService, TextSelectionManagerService } from '@univerjs/docs';
3
- import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
1
+ import { DocumentDataModel, ITextRange, Nullable, IUniverInstanceService, RxDisposable } from '@univerjs/core';
2
+ import { TextSelectionManagerService } from '@univerjs/docs';
3
+ import { INodePosition, IRenderContext, IRenderModule, IRenderManagerService } from '@univerjs/engine-render';
4
4
  import { IEditorService } from '@univerjs/ui';
5
5
 
6
6
  export declare class DocBackScrollRenderController extends RxDisposable implements IRenderModule {
7
7
  private readonly _context;
8
- private readonly _docSkeletonManagerService;
9
8
  private readonly _textSelectionManagerService;
10
9
  private readonly _editorService;
11
- constructor(_context: IRenderContext<DocumentDataModel>, _docSkeletonManagerService: DocSkeletonManagerService, _textSelectionManagerService: TextSelectionManagerService, _editorService: IEditorService);
10
+ private readonly _univerInstanceService;
11
+ private readonly _renderManagerService;
12
+ constructor(_context: IRenderContext<DocumentDataModel>, _textSelectionManagerService: TextSelectionManagerService, _editorService: IEditorService, _univerInstanceService: IUniverInstanceService, _renderManagerService: IRenderManagerService);
12
13
  private _init;
14
+ scrollToRange(unitId: string, range: ITextRange): void;
15
+ scrollToNode(unitId: string, startNodePosition: Nullable<INodePosition>): void;
13
16
  private _scrollToSelection;
17
+ private _getDocObject;
14
18
  }
@@ -1,6 +1,6 @@
1
1
  import { DocumentDataModel, ICommandService, IConfigService, RxDisposable } from '@univerjs/core';
2
2
  import { DocSkeletonManagerService } from '@univerjs/docs';
3
- import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
3
+ import { IRenderContext, IRenderModule, IRenderManagerService } from '@univerjs/engine-render';
4
4
  import { IEditorService } from '@univerjs/ui';
5
5
 
6
6
  export declare class DocRenderController extends RxDisposable implements IRenderModule {
@@ -9,7 +9,9 @@ export declare class DocRenderController extends RxDisposable implements IRender
9
9
  private readonly _docSkeletonManagerService;
10
10
  private readonly _configService;
11
11
  private readonly _editorService;
12
- constructor(_context: IRenderContext<DocumentDataModel>, _commandService: ICommandService, _docSkeletonManagerService: DocSkeletonManagerService, _configService: IConfigService, _editorService: IEditorService);
12
+ private readonly _renderManagerService;
13
+ constructor(_context: IRenderContext<DocumentDataModel>, _commandService: ICommandService, _docSkeletonManagerService: DocSkeletonManagerService, _configService: IConfigService, _editorService: IEditorService, _renderManagerService: IRenderManagerService);
14
+ reRender(unitId: string): void;
13
15
  private _addNewRender;
14
16
  private _addComponent;
15
17
  private _initRenderRefresh;
@@ -16,6 +16,7 @@ export declare class DocTextSelectionRenderController extends Disposable impleme
16
16
  private _initialize;
17
17
  private _init;
18
18
  private _initialMain;
19
+ private _getTransformCoordForDocumentOffset;
19
20
  private _isEditorReadOnly;
20
21
  private _setEditorFocus;
21
22
  private _commandExecutedListener;
@@ -13,6 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ export { whenDocAndEditorFocused } from './shortcuts/utils';
17
+ export { IDocClipboardService } from './services/clipboard/clipboard.service';
18
+ export { DocBackScrollRenderController } from './controllers/render-controllers/back-scroll.render-controller';
16
19
  export * from './basics';
17
20
  export * from './docs-ui-plugin';
18
21
  export { DocRenderController } from './controllers/render-controllers/doc.render-controller';
@@ -20,3 +23,4 @@ export * from './services';
20
23
  export { DocsRenderService } from './services/docs-render.service';
21
24
  export { DocCanvasPopManagerService } from './services/doc-popup-manager.service';
22
25
  export { docDrawingPositionToTransform, transformToDocDrawingPosition } from './basics/transform-position';
26
+ export { DocCopyCommand, DocCutCommand, DocPasteCommand } from './commands/commands/clipboard.command';
@@ -40,6 +40,18 @@ declare const locale: {
40
40
  alignCenter: string;
41
41
  alignRight: string;
42
42
  alignJustify: string;
43
+ headerFooter: string;
44
+ };
45
+ headerFooter: {
46
+ header: string;
47
+ footer: string;
48
+ panel: string;
49
+ firstPageCheckBox: string;
50
+ oddEvenCheckBox: string;
51
+ headerTopMargin: string;
52
+ footerBottomMargin: string;
53
+ closeHeaderFooter: string;
54
+ disableText: string;
43
55
  };
44
56
  };
45
57
  export default locale;
@@ -1,4 +1,4 @@
1
- import { Disposable, ICommandService, ILogService, IUniverInstanceService } from '@univerjs/core';
1
+ import { IDocumentBody, Disposable, ICommandService, ILogService, IUniverInstanceService } from '@univerjs/core';
2
2
  import { IClipboardInterfaceService } from '@univerjs/ui';
3
3
  import { IDisposable } from '@wendellhu/redi';
4
4
  import { TextSelectionManagerService } from '@univerjs/docs';
@@ -8,6 +8,7 @@ export interface IClipboardPropertyItem {
8
8
  export interface IDocClipboardHook {
9
9
  onCopyProperty?(start: number, end: number): IClipboardPropertyItem;
10
10
  onCopyContent?(start: number, end: number): string;
11
+ onBeforePaste?: (body: IDocumentBody) => IDocumentBody;
11
12
  }
12
13
  export interface IDocClipboardService {
13
14
  copy(): Promise<boolean>;
@@ -0,0 +1,27 @@
1
+ import { IUniverInstanceService } from '@univerjs/core';
2
+ import { BaseObject, IRenderManagerService, ITextRangeWithStyle } from '@univerjs/engine-render';
3
+
4
+ export interface IDocMarkSelectionService {
5
+ addShape(selection: ITextRangeWithStyle, zIndex?: number): string | null;
6
+ removeShape(id: string): void;
7
+ removeAllShapes(): void;
8
+ refreshShapes(): void;
9
+ getShapeMap(): Map<string, IDocMarkSelectionInfo>;
10
+ }
11
+ export interface IDocMarkSelectionInfo {
12
+ control: BaseObject[] | null;
13
+ unitId: string;
14
+ selection: ITextRangeWithStyle;
15
+ zIndex: number;
16
+ }
17
+ export declare class DocMarkSelectionService implements IDocMarkSelectionService {
18
+ private readonly _univerInstanceService;
19
+ private readonly _renderManagerService;
20
+ private _shapeMap;
21
+ constructor(_univerInstanceService: IUniverInstanceService, _renderManagerService: IRenderManagerService);
22
+ addShape(selection: ITextRangeWithStyle, zIndex?: number): string | null;
23
+ removeShape(id: string): void;
24
+ removeAllShapes(): void;
25
+ refreshShapes(): void;
26
+ getShapeMap(): Map<string, IDocMarkSelectionInfo>;
27
+ }
@@ -1,4 +1,4 @@
1
- import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
1
+ import { ITextRange, Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
2
2
  import { IRenderManagerService, BaseObject, IBoundRectNoAngle, Scene } from '@univerjs/engine-render';
3
3
  import { IPopup, ICanvasPopupService } from '@univerjs/ui';
4
4
  import { IDisposable } from '@wendellhu/redi';
@@ -19,6 +19,7 @@ export declare class DocCanvasPopManagerService extends Disposable {
19
19
  private readonly _commandService;
20
20
  constructor(_globalPopupManagerService: ICanvasPopupService, _renderManagerService: IRenderManagerService, _univerInstanceService: IUniverInstanceService, _commandService: ICommandService);
21
21
  private _createObjectPositionObserver;
22
+ private _createRangePositionObserver;
22
23
  /**
23
24
  * attach a popup to canvas object
24
25
  * @param targetObject target canvas object
@@ -26,4 +27,5 @@ export declare class DocCanvasPopManagerService extends Disposable {
26
27
  * @returns disposable
27
28
  */
28
29
  attachPopupToObject(targetObject: BaseObject, popup: IDocCanvasPopup): IDisposable;
30
+ attachPopupToRange(range: ITextRange, popup: IDocCanvasPopup): IDisposable;
29
31
  }
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+
3
+ export interface IDocHeaderFooterOptionsProps {
4
+ unitId: string;
5
+ }
6
+ export declare const DocHeaderFooterOptions: (props: IDocHeaderFooterOptionsProps) => React.JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+
3
+ export declare const DocHeaderFooterPanel: () => React.JSX.Element;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
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 COMPONENT_DOC_HEADER_FOOTER_PANEL = "COMPONENT_DOC_HEADER_FOOTER_PANEL";
@@ -0,0 +1,20 @@
1
+ import { IShapeProps, UniverRenderingContext, Shape } from '@univerjs/engine-render';
2
+
3
+ export declare const COLLAB_CURSOR_LABEL_HEIGHT = 18;
4
+ export declare const COLLAB_CURSOR_LABEL_MAX_WIDTH = 200;
5
+ export declare const COLLAB_CURSOR_LABEL_TEXT_PADDING_LR = 6;
6
+ export declare const COLLAB_CURSOR_LABEL_TEXT_PADDING_TB = 4;
7
+ export interface ITextBubbleShapeProps extends IShapeProps {
8
+ color: string;
9
+ text: string;
10
+ }
11
+ /**
12
+ * Render a single collaborated cursor on the canvas.
13
+ */
14
+ export declare class TextBubbleShape<T extends ITextBubbleShapeProps = ITextBubbleShapeProps> extends Shape<T> {
15
+ color: string;
16
+ text: string;
17
+ constructor(key: string, props: T);
18
+ static drawWith(ctx: CanvasRenderingContext2D, props: ITextBubbleShapeProps): void;
19
+ protected _draw(ctx: UniverRenderingContext): void;
20
+ }