@univerjs/docs-drawing-ui 1.0.3 → 1.1.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.
- package/lib/cjs/index.js +1734 -1383
- package/lib/es/index.js +1735 -1384
- package/lib/index.js +1735 -1384
- package/lib/types/controllers/doc-drawing-transformer-update.controller.d.ts +1 -1
- package/lib/types/controllers/render-controllers/doc-drawing-anchor.render-controller.d.ts +32 -0
- package/lib/types/controllers/render-controllers/doc-drawing-transform-update.controller.d.ts +18 -5
- package/lib/types/utils/drawing-text-anchor.d.ts +24 -0
- package/lib/types/utils/drawing-wrapping-position.d.ts +34 -0
- package/lib/types/views/doc-image-panel/use-doc-drawing-position.d.ts +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +15 -15
|
@@ -46,11 +46,11 @@ export declare class DocDrawingTransformerController extends Disposable {
|
|
|
46
46
|
private _transformerCache;
|
|
47
47
|
private _anchorShape;
|
|
48
48
|
constructor(_commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _drawingManagerService: IDrawingManagerService, _renderManagerService: IRenderManagerService);
|
|
49
|
+
dispose(): void;
|
|
49
50
|
private _init;
|
|
50
51
|
private _listenDrawingFocus;
|
|
51
52
|
private _listenTransformerChange;
|
|
52
53
|
private _updateMultipleDrawingDocTransform;
|
|
53
|
-
private _updateDrawingAnchor;
|
|
54
54
|
private _updateInlineDrawingAnchor;
|
|
55
55
|
private _getInlineDrawingAnchor;
|
|
56
56
|
private _getDrawingAnchor;
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { DocumentDataModel } from '@univerjs/core';
|
|
17
|
+
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
18
|
+
import { Disposable, ThemeService } from '@univerjs/core';
|
|
19
|
+
import { DocSkeletonManagerService } from '@univerjs/docs';
|
|
20
|
+
import { DocSelectionRenderService } from '@univerjs/docs-ui';
|
|
21
|
+
import { IDrawingManagerService } from '@univerjs/drawing';
|
|
22
|
+
export declare class DocDrawingAnchorRenderController extends Disposable implements IRenderModule {
|
|
23
|
+
private readonly _context;
|
|
24
|
+
private readonly _skeletonManager;
|
|
25
|
+
private readonly _selectionRender;
|
|
26
|
+
private readonly _themeService;
|
|
27
|
+
private _stroke;
|
|
28
|
+
private _focused;
|
|
29
|
+
private readonly _markers;
|
|
30
|
+
constructor(_context: IRenderContext<DocumentDataModel>, drawingManager: IDrawingManagerService, _skeletonManager: DocSkeletonManagerService, _selectionRender: DocSelectionRenderService, _themeService: ThemeService);
|
|
31
|
+
private _updateMarkers;
|
|
32
|
+
}
|
package/lib/types/controllers/render-controllers/doc-drawing-transform-update.controller.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { DocumentDataModel, IDocDrawingBase, IDrawingParam, ITransformState } from '@univerjs/core';
|
|
17
|
-
import type { IDocsCustomBlockRenderViewport, IDocumentLayoutProgress,
|
|
17
|
+
import type { IDocsCustomBlockRenderViewport, IDocumentLayoutProgress, IDocumentSkeletonHeaderFooter, IDocumentSkeletonPage, IDocumentSkeletonRow, IDocumentSkeletonTable, IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
18
18
|
import { AlignTypeH, AlignTypeV, BooleanNumber, Disposable, ICommandService, IUniverInstanceService, LifecycleService, ObjectRelativeFromH, ObjectRelativeFromV, PositionedObjectLayoutType } from '@univerjs/core';
|
|
19
19
|
import { DocSkeletonManagerService } from '@univerjs/docs';
|
|
20
20
|
import { IEditorService } from '@univerjs/docs-ui';
|
|
@@ -38,7 +38,10 @@ interface IDrawingClipBounds {
|
|
|
38
38
|
width: number;
|
|
39
39
|
height: number;
|
|
40
40
|
}
|
|
41
|
-
type DrawingRefreshParam = Partial<IDrawingParam &
|
|
41
|
+
type DrawingRefreshParam = Partial<IDrawingParam> & {
|
|
42
|
+
behindText?: boolean;
|
|
43
|
+
customBlockRenderViewport?: IDrawingParamsWithBehindText['customBlockRenderViewport'];
|
|
44
|
+
};
|
|
42
45
|
export declare function shouldRefreshDocDrawingTransform(current: DrawingRefreshParam | null | undefined, next: DrawingRefreshParam): boolean;
|
|
43
46
|
/**
|
|
44
47
|
* Overlay drawings do not participate in text layout. While their skeleton
|
|
@@ -69,18 +72,22 @@ interface IDocumentDrawingPublicationNestedPage {
|
|
|
69
72
|
interface IDocumentDrawingPublicationPage extends IDocumentDrawingPublicationNestedPage {
|
|
70
73
|
headerId: string;
|
|
71
74
|
footerId: string;
|
|
75
|
+
headerLayoutKey?: number | string;
|
|
76
|
+
footerLayoutKey?: number | string;
|
|
72
77
|
pageWidth: number;
|
|
73
78
|
}
|
|
74
|
-
|
|
79
|
+
interface IDocumentDrawingPublicationSkeletonData {
|
|
75
80
|
pages: IDocumentDrawingPublicationPage[];
|
|
76
|
-
|
|
81
|
+
skeHeaders: ReadonlyMap<string, ReadonlyMap<number | string, IDocumentDrawingPublicationNestedPage>>;
|
|
82
|
+
skeFooters: ReadonlyMap<string, ReadonlyMap<number | string, IDocumentDrawingPublicationNestedPage>>;
|
|
83
|
+
}
|
|
77
84
|
export declare class DocDrawingPublicationTracker {
|
|
78
85
|
private _generation;
|
|
79
86
|
private _publishedPageCount;
|
|
80
87
|
private _drawingOccurrenceCount;
|
|
81
88
|
reset(): void;
|
|
82
89
|
shouldRefresh(skeleton: {
|
|
83
|
-
getSkeletonData: () =>
|
|
90
|
+
getSkeletonData: () => IDocumentDrawingPublicationSkeletonData | null | undefined | void;
|
|
84
91
|
}, progress: DocumentDrawingPublicationProgress): boolean;
|
|
85
92
|
}
|
|
86
93
|
export declare function getDocsDrawingPageClipBounds(config: {
|
|
@@ -106,6 +113,7 @@ export declare function getDocsPageRelativeDrawingLeft(config: {
|
|
|
106
113
|
positionH: {
|
|
107
114
|
align?: AlignTypeH;
|
|
108
115
|
posOffset?: number;
|
|
116
|
+
percent?: number;
|
|
109
117
|
relativeFrom?: ObjectRelativeFromH;
|
|
110
118
|
};
|
|
111
119
|
width: number;
|
|
@@ -115,6 +123,7 @@ export declare function getDocsPageRelativeDrawingTop(config: {
|
|
|
115
123
|
positionV: {
|
|
116
124
|
align?: AlignTypeV;
|
|
117
125
|
posOffset?: number;
|
|
126
|
+
percent?: number;
|
|
118
127
|
relativeFrom?: ObjectRelativeFromV;
|
|
119
128
|
};
|
|
120
129
|
height: number;
|
|
@@ -147,6 +156,8 @@ export declare class DocDrawingTransformUpdateController extends Disposable impl
|
|
|
147
156
|
private _lifecycleService;
|
|
148
157
|
private _liquid;
|
|
149
158
|
private _changesetDrawingRefreshScheduled;
|
|
159
|
+
private _pendingMultiDrawingSelection;
|
|
160
|
+
private _pendingMultiDrawingSelectionSubscription?;
|
|
150
161
|
private readonly _publicationTracker;
|
|
151
162
|
constructor(_context: IRenderContext<DocumentDataModel>, _docSkeletonManagerService: DocSkeletonManagerService, _commandService: ICommandService, _editorService: IEditorService, _drawingManagerService: IDrawingManagerService, _docRefreshDrawingsService: DocRefreshDrawingsService, _univerInstanceService: IUniverInstanceService, _lifecycleService: LifecycleService);
|
|
152
163
|
private _initialize;
|
|
@@ -161,6 +172,8 @@ export declare class DocDrawingTransformUpdateController extends Disposable impl
|
|
|
161
172
|
private _collectSegmentDrawingPositions;
|
|
162
173
|
private _getStaleNonMultiDrawings;
|
|
163
174
|
private _handleMultiDrawingsTransform;
|
|
175
|
+
private _clearPendingMultiDrawingSelection;
|
|
176
|
+
private _restoreMultiDrawingSelection;
|
|
164
177
|
private _calculateDrawingPosition;
|
|
165
178
|
private _collectDrawingPosition;
|
|
166
179
|
private _collectGroupChildren;
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { ISuccinctDocRangeParam } from '@univerjs/engine-render';
|
|
18
|
+
/** Locate the persisted object character without consulting the active text selection. */
|
|
19
|
+
export declare function findDrawingTextAnchor(snapshot: IDocumentData, drawingId: string): {
|
|
20
|
+
offset: number;
|
|
21
|
+
segmentId: string;
|
|
22
|
+
} | null;
|
|
23
|
+
/** Preserve keyboard/clipboard object ranges while replacing floating selection paint with an anchor icon. */
|
|
24
|
+
export declare function getDrawingTextRanges(snapshot: IDocumentData, drawingIds: string[]): ISuccinctDocRangeParam[];
|
|
@@ -0,0 +1,34 @@
|
|
|
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 { IDocDrawingPosition, IDocumentData, LocaleService } from '@univerjs/core';
|
|
17
|
+
import type { IDocumentSkeletonCached, IDocumentSkeletonDrawing, IDocumentSkeletonHeaderFooter, IDocumentSkeletonPage } from '@univerjs/engine-render';
|
|
18
|
+
import { ObjectRelativeFromH, ObjectRelativeFromV, PositionedObjectLayoutType } from '@univerjs/core';
|
|
19
|
+
import { DocumentEditArea } from '@univerjs/engine-render';
|
|
20
|
+
export interface IDrawingAnchorInPage {
|
|
21
|
+
skeDrawing: IDocumentSkeletonDrawing;
|
|
22
|
+
page: IDocumentSkeletonPage | IDocumentSkeletonHeaderFooter;
|
|
23
|
+
hostPage?: IDocumentSkeletonPage;
|
|
24
|
+
pageMarginTop: number;
|
|
25
|
+
pageMarginLeft: number;
|
|
26
|
+
}
|
|
27
|
+
export declare function findDrawingAnchor(unitId: string, drawingId: string, skeleton: IDocumentSkeletonCached, editArea: DocumentEditArea, currentDrawing?: IDocumentSkeletonDrawing['drawingOrigin']): IDrawingAnchorInPage | null;
|
|
28
|
+
/** Resolve a text-relative origin before committing a wrapping reference change. */
|
|
29
|
+
export declare function resolveDrawingWrappingPosition(anchor: IDrawingAnchorInPage, position: IDocDrawingPosition, snapshot: IDocumentData, localeService: LocaleService, editArea: DocumentEditArea): IDocDrawingPosition | null;
|
|
30
|
+
/** Preserve the rendered position when text wrapping or a positioning reference changes. */
|
|
31
|
+
export declare function getDrawingWrappingPosition(anchor: IDrawingAnchorInPage, layoutType: PositionedObjectLayoutType, relativeFromH?: ObjectRelativeFromH, relativeFromV?: ObjectRelativeFromV, offset?: {
|
|
32
|
+
left: number;
|
|
33
|
+
top: number;
|
|
34
|
+
}): IDocDrawingPosition;
|
|
@@ -37,7 +37,7 @@ export declare function useDocDrawingPosition(props: IDocDrawingPositionProps):
|
|
|
37
37
|
value: string;
|
|
38
38
|
disabled?: undefined;
|
|
39
39
|
})[];
|
|
40
|
-
handlePositionChange: (direction: "positionH" | "positionV", value: IObjectPositionH | IObjectPositionV) => void;
|
|
40
|
+
handlePositionChange: (direction: "positionH" | "positionV", value: IObjectPositionH | IObjectPositionV, positionH?: IObjectPositionH) => void;
|
|
41
41
|
handleHorizontalRelativeFromChange: (value: string) => void;
|
|
42
42
|
handleVerticalRelativeFromChange: (value: string) => void;
|
|
43
43
|
handleFollowTextMoveCheck: (val: string | number | boolean) => void;
|