@univerjs/docs-ui 0.5.4 → 0.5.5-experimental.20250122-3362a4a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +23 -30
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/facade.js +61 -58
- package/lib/es/index.js +7679 -7808
- package/lib/es/locale/en-US.js +2 -2
- package/lib/es/locale/fa-IR.js +2 -2
- package/lib/es/locale/fr-FR.js +2 -2
- package/lib/es/locale/ru-RU.js +2 -2
- package/lib/es/locale/vi-VN.js +2 -2
- package/lib/es/locale/zh-CN.js +2 -2
- package/lib/es/locale/zh-TW.js +2 -2
- package/lib/index.css +1 -1
- package/lib/types/basics/custom-decoration-factory.d.ts +1 -0
- package/lib/types/basics/paragraph.d.ts +1 -1
- package/lib/types/commands/commands/replace-content.command.d.ts +1 -0
- package/lib/types/components/list-type-picker/picker.d.ts +3 -4
- package/lib/types/controllers/doc-container-ui-controller.d.ts +1 -1
- package/lib/types/controllers/render-controllers/doc-editor-bridge.controller.d.ts +0 -3
- package/lib/types/facade/f-document.d.ts +3 -0
- package/lib/types/index.d.ts +3 -2
- package/lib/types/services/editor/editor-manager.service.d.ts +5 -177
- package/lib/types/services/editor/editor.d.ts +15 -77
- package/lib/types/services/selection/doc-selection-render.service.d.ts +7 -10
- package/lib/types/views/count-bar/CountBar.d.ts +16 -2
- package/lib/types/views/count-bar/ZoomSlider.d.ts +16 -2
- package/lib/types/views/doc-container/DocContainer.d.ts +5 -5
- package/lib/types/views/doc-footer/DocFooter.d.ts +16 -2
- package/lib/types/views/header-footer/panel/DocHeaderFooterOptions.d.ts +16 -2
- package/lib/types/views/header-footer/panel/DocHeaderFooterPanel.d.ts +16 -2
- package/lib/types/views/paragraph-setting/Setting.d.ts +1 -2
- package/lib/types/views/paragraph-setting/index.d.ts +16 -2
- package/lib/types/views/rich-text-editor/hooks/index.d.ts +17 -0
- package/lib/types/views/rich-text-editor/hooks/useEditor.d.ts +11 -0
- package/lib/types/views/rich-text-editor/hooks/useKeyboardEvent.d.ts +10 -0
- package/lib/types/views/rich-text-editor/hooks/useLeftAndRightArrow.d.ts +3 -0
- package/lib/types/views/rich-text-editor/hooks/useOnChange.d.ts +3 -0
- package/lib/types/views/rich-text-editor/index.d.ts +22 -0
- package/lib/types/views/table/create/TableCreate.d.ts +16 -2
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +23 -30
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +10 -11
- package/LICENSE +0 -176
- package/lib/types/components/editor/TextEditor.d.ts +0 -36
- package/lib/types/components/range-selector/RangeSelector.d.ts +0 -24
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
|
|
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
|
+
*/
|
|
2
16
|
interface ICountBarProps {
|
|
3
17
|
changeRatio?: (ratio: string) => void;
|
|
4
18
|
onChange?: (value: string) => void;
|
|
5
19
|
}
|
|
6
|
-
export declare function CountBar(props: ICountBarProps):
|
|
20
|
+
export declare function CountBar(props: ICountBarProps): import("react/jsx-runtime").JSX.Element;
|
|
7
21
|
export {};
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 function ZoomSlider(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,8 +13,8 @@ export declare class DocContainer extends Component<IBaseDocContainerProps> {
|
|
|
13
13
|
leftContentTop: number;
|
|
14
14
|
rightBorderX: number;
|
|
15
15
|
rightBorderY: number;
|
|
16
|
-
splitLeftRef: React.RefObject<HTMLDivElement>;
|
|
17
|
-
contentRef: React.RefObject<HTMLDivElement>;
|
|
16
|
+
splitLeftRef: React.RefObject<HTMLDivElement | null>;
|
|
17
|
+
contentRef: React.RefObject<HTMLDivElement | null>;
|
|
18
18
|
constructor(props: IBaseDocContainerProps);
|
|
19
19
|
/**
|
|
20
20
|
* split mouse down
|
|
@@ -31,8 +31,8 @@ export declare class DocContainer extends Component<IBaseDocContainerProps> {
|
|
|
31
31
|
* @param e
|
|
32
32
|
*/
|
|
33
33
|
handleSplitBarMouseUp: (e: MouseEvent) => void;
|
|
34
|
-
getContentRef(): React.RefObject<HTMLDivElement>;
|
|
35
|
-
getSplitLeftRef(): React.RefObject<HTMLDivElement>;
|
|
34
|
+
getContentRef(): React.RefObject<HTMLDivElement | null>;
|
|
35
|
+
getSplitLeftRef(): React.RefObject<HTMLDivElement | null>;
|
|
36
36
|
/**
|
|
37
37
|
* Modify Dom Skin
|
|
38
38
|
*/
|
|
@@ -42,6 +42,6 @@ export declare class DocContainer extends Component<IBaseDocContainerProps> {
|
|
|
42
42
|
*
|
|
43
43
|
* @returns {void}
|
|
44
44
|
*/
|
|
45
|
-
render():
|
|
45
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
46
46
|
}
|
|
47
47
|
export {};
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 DocFooter: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
|
|
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
|
+
*/
|
|
2
16
|
export interface IDocHeaderFooterOptionsProps {
|
|
3
17
|
unitId: string;
|
|
4
18
|
}
|
|
5
|
-
export declare const DocHeaderFooterOptions: (props: IDocHeaderFooterOptionsProps) =>
|
|
19
|
+
export declare const DocHeaderFooterOptions: (props: IDocHeaderFooterOptionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 DocHeaderFooterPanel: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,5 +13,4 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
export declare function ParagraphSetting(): React.JSX.Element;
|
|
16
|
+
export declare function ParagraphSetting(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 function ParagraphSettingIndex(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
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 { type IKeyboardEventConfig, useKeyboardEvent } from './useKeyboardEvent';
|
|
17
|
+
export { useResize } from './useResize';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IDocumentData, Nullable } from '@univerjs/core';
|
|
2
|
+
import { RefObject } from 'react';
|
|
3
|
+
import { Editor } from '../../../services/editor/editor';
|
|
4
|
+
export interface IUseEditorProps {
|
|
5
|
+
editorId: string;
|
|
6
|
+
initialValue: Nullable<IDocumentData>;
|
|
7
|
+
container: RefObject<HTMLDivElement>;
|
|
8
|
+
autoFocus?: boolean;
|
|
9
|
+
isSingle?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function useEditor(opts: IUseEditorProps): Editor | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { KeyCode, MetaKeys } from '@univerjs/ui';
|
|
2
|
+
import { Editor } from '../../../services/editor/editor';
|
|
3
|
+
export interface IKeyboardEventConfig {
|
|
4
|
+
keyCodes: {
|
|
5
|
+
keyCode: KeyCode;
|
|
6
|
+
metaKey?: MetaKeys;
|
|
7
|
+
}[];
|
|
8
|
+
handler: (keyCode: KeyCode, metaKey?: MetaKeys) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function useKeyboardEvent(isNeed: boolean, config?: IKeyboardEventConfig, editor?: Editor): void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Editor } from '../../../services/editor/editor';
|
|
2
|
+
import { KeyCode, MetaKeys } from '@univerjs/ui';
|
|
3
|
+
export declare const useLeftAndRightArrow: (isNeed: boolean, selectingMode: boolean, editor?: Editor, onMoveInEditor?: (keyCode: KeyCode, metaKey?: MetaKeys) => void) => void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Editor } from '../../services/editor/editor';
|
|
2
|
+
import { IKeyboardEventConfig } from './hooks';
|
|
3
|
+
import { IDocumentData } from '@univerjs/core';
|
|
4
|
+
import { default as React } from 'react';
|
|
5
|
+
export interface IRichTextEditorProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
autoFocus?: boolean;
|
|
8
|
+
onFocusChange?: (isFocus: boolean) => void;
|
|
9
|
+
initialValue?: IDocumentData;
|
|
10
|
+
onClickOutside?: () => void;
|
|
11
|
+
keyboardEventConfig?: IKeyboardEventConfig;
|
|
12
|
+
moveCursor?: boolean;
|
|
13
|
+
style?: React.CSSProperties;
|
|
14
|
+
isSingle?: boolean;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
editorId?: string;
|
|
17
|
+
onHeightChange?: (height: number) => void;
|
|
18
|
+
onChange?: (data: IDocumentData) => void;
|
|
19
|
+
maxHeight?: number;
|
|
20
|
+
defaultHeight?: number;
|
|
21
|
+
}
|
|
22
|
+
export declare const RichTextEditor: React.ForwardRefExoticComponent<IRichTextEditorProps & React.RefAttributes<Editor>>;
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
|
|
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
|
+
*/
|
|
2
16
|
interface IDocCreateTableConfirmProps {
|
|
3
17
|
handleRowColChange: (rowCount: number, colCount: number) => void;
|
|
4
18
|
tableCreateParams: {
|
|
@@ -6,5 +20,5 @@ interface IDocCreateTableConfirmProps {
|
|
|
6
20
|
colCount: number;
|
|
7
21
|
};
|
|
8
22
|
}
|
|
9
|
-
export declare const DocCreateTableConfirm: ({ handleRowColChange, tableCreateParams, }: IDocCreateTableConfirmProps) =>
|
|
23
|
+
export declare const DocCreateTableConfirm: ({ handleRowColChange, tableCreateParams, }: IDocCreateTableConfirmProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
24
|
export {};
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(global,factory){typeof exports=="object"&&typeof module<"u"?factory(exports,require("@univerjs/core"),require("@univerjs/docs-ui"),require("@univerjs/engine-render")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/docs-ui","@univerjs/engine-render"],factory):(global=typeof globalThis<"u"?globalThis:global||self,factory(global.UniverDocsUiFacade={},global.UniverCore,global.UniverDocsUi,global.UniverEngineRender))})(this,function(exports2,core,docsUi,engineRender){"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);var _a;var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam");exports2.FDocument=(_a=class{constructor(_documentDataModel,_injector,_univerInstanceService,_commandService,_resourceManagerService,_renderManagerService){__publicField(this,"id");this._documentDataModel=_documentDataModel,this._injector=_injector,this._univerInstanceService=_univerInstanceService,this._commandService=_commandService,this._resourceManagerService=_resourceManagerService,this._renderManagerService=_renderManagerService,this.id=this._documentDataModel.getUnitId()}getId(){return this._documentDataModel.getUnitId()}getName(){return this.getSnapshot().title||""}getSnapshot(){const resources=this._resourceManagerService.getResourcesByType(this.id,core.UniverInstanceType.UNIVER_DOC),snapshot=this._documentDataModel.getSnapshot();return snapshot.resources=resources,snapshot}undo(){return this._univerInstanceService.focusUnit(this.id),this._commandService.executeCommand(core.UndoCommand.id)}redo(){return this._univerInstanceService.focusUnit(this.id),this._commandService.executeCommand(core.RedoCommand.id)}appendText(text){const unitId=this.id,{body}=this.getSnapshot();if(!body)throw new Error("The document body is empty");const lastPosition=body.dataStream.length-2,activeRange={startOffset:lastPosition,endOffset:lastPosition,collapsed:!0,segmentId:""},{segmentId}=activeRange;return this._commandService.executeCommand(docsUi.InsertCommand.id,{unitId,body:{dataStream:text},range:activeRange,segmentId})}setSelection(startOffset,endOffset){var _a2;const docSelectionRenderService=(_a2=this._renderManagerService.getRenderById(this.getId()))==null?void 0:_a2.with(docsUi.DocSelectionRenderService);docSelectionRenderService==null||docSelectionRenderService.removeAllRanges(),docSelectionRenderService==null||docSelectionRenderService.addDocRanges([{startOffset,endOffset,rangeType:core.DOC_RANGE_TYPE.TEXT}],!0)}},__name(_a,"FDocument"),_a),exports2.FDocument=__decorateClass([__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,core.IUniverInstanceService),__decorateParam(3,core.ICommandService),__decorateParam(4,core.IResourceManagerService),__decorateParam(5,engineRender.IRenderManagerService)],exports2.FDocument);const _FUniverDocsMixin=class _FUniverDocsMixin extends core.FUniver{createUniverDoc(data){const document=this._univerInstanceService.createUnit(core.UniverInstanceType.UNIVER_DOC,data);return this._injector.createInstance(exports2.FDocument,document)}getActiveDocument(){const document=this._univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_DOC);return document?this._injector.createInstance(exports2.FDocument,document):null}getUniverDoc(id){const document=this._univerInstanceService.getUniverDocInstance(id);return document?this._injector.createInstance(exports2.FDocument,document):null}};__name(_FUniverDocsMixin,"FUniverDocsMixin");let FUniverDocsMixin=_FUniverDocsMixin;core.FUniver.extend(FUniverDocsMixin),Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"})});
|