@univerjs/drawing-ui 1.0.0-alpha.0 → 1.0.0-alpha.2

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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ArrangeTypeEnum, BooleanNumber, CommandType, Disposable, DrawingTypeEnum, ICommandService, IConfigService, IURLImageService, IUniverInstanceService, ImageSourceType, Inject, Injector, LocaleService, Plugin, PositionedObjectLayoutType, UniverInstanceType, checkIfMove, debounce, generateRandomId, merge, toDisposable } from "@univerjs/core";
2
- import { IDrawingManagerService, IImageIoService, ImageSourceType as ImageSourceType$1, SetDrawingSelectedOperation, getDrawingShapeKeyByDrawingSearch } from "@univerjs/drawing";
2
+ import { DRAWING_GROUPABLE_TYPES, IDrawingManagerService, IImageIoService, ImageSourceType as ImageSourceType$1, SetDrawingSelectedOperation, getDrawingShapeKeyByDrawingSearch, isGroupableDrawingType, resolveDrawingRotateEnabled } from "@univerjs/drawing";
3
3
  import { CURSOR_TYPE, Canvas, DRAWING_OBJECT_LAYER_INDEX, DrawingGroupObject, Group, IRenderManagerService, Image, RENDER_CLASS_TYPE, Rect, Shape, Vector2, degToRad, getGroupState, precisionTo, transformObjectOutOfGroup } from "@univerjs/engine-render";
4
4
  import { AutofillDoubleIcon, BottomIcon, CreateCopyIcon, CropIcon, DeleteIcon, DocSettingIcon, GroupIcon, MoreDownIcon, MoveDownIcon, MoveUpIcon, TextWrapShapeIcon, TopmostIcon, UngroupIcon } from "@univerjs/icons";
5
5
  import { ComponentManager, ContextMenuGroup, ContextMenuPosition, IDialogService, IGalleryService, IMenuManagerService, IMessageService, IconManager, MenuItemType, useDependency, useObservable } from "@univerjs/ui";
@@ -131,15 +131,13 @@ const SetDrawingArrangeBackwardOperation = {
131
131
  //#endregion
132
132
  //#region src/commands/operations/drawing-group.operation.ts
133
133
  /**
134
- * Now only support grouping images, shapes, and groups.
134
+ * Now only support grouping images, shapes, charts, and groups.
135
135
  */
136
- const DRAWING_GROUP_TYPES = [
137
- DrawingTypeEnum.DRAWING_IMAGE,
138
- DrawingTypeEnum.DRAWING_SHAPE,
139
- DrawingTypeEnum.DRAWING_GROUP
140
- ];
136
+ const DRAWING_GROUP_TYPES = DRAWING_GROUPABLE_TYPES;
141
137
  /**
142
- * Group the selected drawings into a new group. The selected drawings must be of type image, shape, or group, and there must be at least 2 drawings selected.
138
+ * Group the selected drawings into a new group. The selected drawings must be
139
+ * of type image, shape, chart, or group, and there must be at least 2 drawings
140
+ * selected.
143
141
  */
144
142
  const SetDrawingGroupOperation = {
145
143
  id: "drawing.operation.set-drawing-group",
@@ -148,7 +146,7 @@ const SetDrawingGroupOperation = {
148
146
  const drawingManagerService = accessor.get(IDrawingManagerService);
149
147
  const drawings = params.drawings || drawingManagerService.getFocusDrawings();
150
148
  if (drawings.length < 2) return false;
151
- if (!drawings.every((drawing) => DRAWING_GROUP_TYPES.includes(drawing.drawingType))) return false;
149
+ if (!drawings.every((drawing) => isGroupableDrawingType(drawing.drawingType))) return false;
152
150
  const { unitId, subUnitId } = drawings[0];
153
151
  const groupId = generateRandomId(10);
154
152
  const groupTransform = getGroupState(0, 0, drawings.map((o) => o.transform || {}));
@@ -170,11 +168,12 @@ const SetDrawingGroupOperation = {
170
168
  left: 0,
171
169
  top: 0
172
170
  };
173
- const { unitId, subUnitId, drawingId } = drawing;
171
+ const { unitId, subUnitId, drawingId, drawingType } = drawing;
174
172
  return {
175
173
  unitId,
176
174
  subUnitId,
177
175
  drawingId,
176
+ drawingType,
178
177
  transform: { ...transform },
179
178
  groupId
180
179
  };
@@ -266,8 +265,48 @@ const ImageResetSizeOperation = {
266
265
  }
267
266
  };
268
267
 
268
+ //#endregion
269
+ //#region src/utils/rotate-enabled.ts
270
+ function isKnownDrawingUINonRotatableType(drawingType) {
271
+ return drawingType === DrawingTypeEnum.DRAWING_CHART;
272
+ }
273
+ function resolveDrawingUIRotateEnabled(drawing, options = {}) {
274
+ var _options$isKnownNonRo;
275
+ return resolveDrawingRotateEnabled(drawing, {
276
+ ...options,
277
+ isKnownNonRotatableType: (_options$isKnownNonRo = options.isKnownNonRotatableType) !== null && _options$isKnownNonRo !== void 0 ? _options$isKnownNonRo : isKnownDrawingUINonRotatableType
278
+ });
279
+ }
280
+
269
281
  //#endregion
270
282
  //#region src/controllers/utils.ts
283
+ function getDrawingRenderObject(scene, drawingSearch) {
284
+ var _scene$getObjectInclu;
285
+ const key = getDrawingShapeKeyByDrawingSearch(drawingSearch);
286
+ return (_scene$getObjectInclu = scene.getObjectIncludeInGroup(key)) !== null && _scene$getObjectInclu !== void 0 ? _scene$getObjectInclu : null;
287
+ }
288
+ function disposeDrawingRenderObject(scene, drawingSearch) {
289
+ const object = getDrawingRenderObject(scene, drawingSearch);
290
+ if (object == null) return false;
291
+ object.dispose();
292
+ return true;
293
+ }
294
+ function getRenderObjectForDrawing(scene, drawing) {
295
+ return getDrawingRenderObject(scene, drawing);
296
+ }
297
+ function syncGroupRotateEnabled(group, groupParam, scene, drawingManagerService, children) {
298
+ const rotateEnabled = resolveDrawingUIRotateEnabled(groupParam, {
299
+ getChildren: (drawing) => {
300
+ if (children && drawing.drawingId === groupParam.drawingId && drawing.unitId === groupParam.unitId && drawing.subUnitId === groupParam.subUnitId) return children;
301
+ return drawingManagerService.getDrawingsByGroup(drawing);
302
+ },
303
+ getRenderObject: (drawing) => getRenderObjectForDrawing(scene, drawing)
304
+ });
305
+ group.transformerConfig = {
306
+ ...group.transformerConfig,
307
+ rotateEnabled
308
+ };
309
+ }
271
310
  function insertGroupObject(objectParam, object, scene, drawingManagerService) {
272
311
  const groupParam = drawingManagerService.getDrawingByParam(objectParam);
273
312
  if (groupParam == null) return;
@@ -278,11 +317,13 @@ function insertGroupObject(objectParam, object, scene, drawingManagerService) {
278
317
  const objects = groupObject.getObjects();
279
318
  for (const obj of objects) if (obj.oKey === object.oKey) return;
280
319
  groupObject.addObject(object);
320
+ syncGroupRotateEnabled(groupObject, groupParam, scene, drawingManagerService);
281
321
  return;
282
322
  }
283
323
  const group = new DrawingGroupObject(groupKey);
284
324
  scene.addObject(group, DRAWING_OBJECT_LAYER_INDEX).attachTransformerTo(group);
285
325
  group.addObject(object);
326
+ syncGroupRotateEnabled(group, groupParam, scene, drawingManagerService);
286
327
  const { transform, groupBaseBound } = groupParam;
287
328
  if (groupBaseBound) group.setBaseBound(groupBaseBound);
288
329
  if (groupParam.groupId) {
@@ -321,7 +362,7 @@ function getCurrentUnitInfo(currentUniverService, propUnitId) {
321
362
  //#endregion
322
363
  //#region package.json
323
364
  var name = "@univerjs/drawing-ui";
324
- var version = "1.0.0-alpha.0";
365
+ var version = "1.0.0-alpha.2";
325
366
 
326
367
  //#endregion
327
368
  //#region src/config/config.ts
@@ -733,6 +774,7 @@ let DrawingRenderService = class DrawingRenderService {
733
774
  }
734
775
  async renderImages(imageParam, scene) {
735
776
  const { transform: singleTransform, drawingType, source, imageSourceType, srcRect, prstGeom, groupId, unitId, subUnitId, drawingId, isMultiTransform, transforms: multiTransforms, adjustValues, hidden } = imageParam;
777
+ const { docxHeaderFooterDrawing, layoutType } = imageParam;
736
778
  if (drawingType !== DrawingTypeEnum.DRAWING_IMAGE) return;
737
779
  if (!this._drawingManagerService.getDrawingVisible()) return;
738
780
  if (this._univerInstanceService.getUnitType(unitId) === UniverInstanceType.UNIVER_SHEET && subUnitId !== this._getActiveSheetId()) return;
@@ -793,7 +835,8 @@ let DrawingRenderService = class DrawingRenderService {
793
835
  imageConfig.url = source;
794
836
  shouldBeCache = true;
795
837
  }
796
- if (hidden) imageConfig.visible = false;
838
+ const shouldWaitForInlineTransform = docxHeaderFooterDrawing === true && layoutType === PositionedObjectLayoutType.INLINE;
839
+ if (hidden || shouldWaitForInlineTransform) imageConfig.visible = false;
797
840
  if (scene.getObject(imageShapeKey)) continue;
798
841
  imageConfig.printable = true;
799
842
  const image = new Image(imageShapeKey, imageConfig);
@@ -940,16 +983,18 @@ function getUpdateParams(objects, drawingManagerService) {
940
983
 
941
984
  //#endregion
942
985
  //#region src/controllers/drawing-update.controller.ts
986
+ function hasRefreshMetadata(refreshParam) {
987
+ return "hidden" in refreshParam || "behindText" in refreshParam;
988
+ }
943
989
  function syncDrawingHiddenState(shape, drawingParam) {
944
990
  if (!("hidden" in drawingParam)) return;
945
991
  drawingParam.hidden === true ? shape.hide() : shape.show();
946
992
  }
947
993
  function mergeRefreshMetadata(drawingParam, refreshParam) {
948
- const metadata = refreshParam;
949
- if (!("hidden" in metadata) && !("behindText" in metadata)) return drawingParam;
994
+ if (!hasRefreshMetadata(refreshParam)) return drawingParam;
950
995
  return {
951
996
  ...drawingParam,
952
- ...metadata
997
+ ...refreshParam
953
998
  };
954
999
  }
955
1000
  let DrawingUpdateController = class DrawingUpdateController extends Disposable {
@@ -1056,6 +1101,7 @@ let DrawingUpdateController = class DrawingUpdateController extends Disposable {
1056
1101
  }));
1057
1102
  scene.addObject(group, DRAWING_OBJECT_LAYER_INDEX).attachTransformerTo(group);
1058
1103
  group.addObjects(...objects);
1104
+ syncGroupRotateEnabled(group, parent, scene, this._drawingManagerService, children);
1059
1105
  if (parent.groupBaseBound) group.setBaseBound(parent.groupBaseBound);
1060
1106
  if (parent.groupId) {
1061
1107
  group.isInGroup = true;
@@ -1268,15 +1314,12 @@ let DrawingUpdateController = class DrawingUpdateController extends Disposable {
1268
1314
  const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
1269
1315
  if (renderObject == null) return;
1270
1316
  const { scene } = renderObject;
1271
- const drawingShapeKey = getDrawingShapeKeyByDrawingSearch({
1317
+ if (disposeDrawingRenderObject(scene, {
1272
1318
  unitId,
1273
1319
  subUnitId,
1274
1320
  drawingId
1275
- });
1276
- const drawingShapes = scene.fuzzyMathObjects(drawingShapeKey, true);
1277
- if (drawingShapes.length > 0) {
1321
+ })) {
1278
1322
  var _scene$getTransformer;
1279
- for (const drawingShape of drawingShapes) drawingShape.dispose();
1280
1323
  (_scene$getTransformer = scene.getTransformer()) === null || _scene$getTransformer === void 0 || _scene$getTransformer.clearSelectedObjects();
1281
1324
  }
1282
1325
  });
@@ -1337,7 +1380,7 @@ let DrawingUpdateController = class DrawingUpdateController extends Disposable {
1337
1380
  subUnitId,
1338
1381
  drawingId
1339
1382
  });
1340
- const drawingShape = scene.getObject(drawingShapeKey);
1383
+ const drawingShape = scene.getObjectIncludeInGroup(drawingShapeKey);
1341
1384
  const drawingParamWithRefreshMetadata = mergeRefreshMetadata(drawingParam, param);
1342
1385
  if (drawingShape == null) {
1343
1386
  if (drawingParamWithRefreshMetadata.hidden === true) return true;
@@ -2218,10 +2261,10 @@ function getMenuStateByDrawingFocusChangedObservable$(accessor, type) {
2218
2261
  if (!drawings || drawings.length === 0) return subscriber.next(true);
2219
2262
  if (type === "group") {
2220
2263
  if (drawings.length < 2) return subscriber.next(true);
2221
- if (!drawings.every((drawing) => DRAWING_GROUP_TYPES.includes(drawing.drawingType))) return subscriber.next(true);
2264
+ if (!drawings.every((drawing) => isGroupableDrawingType(drawing.drawingType))) return subscriber.next(true);
2222
2265
  } else if (type === "unGroup") {
2223
2266
  if (drawings.filter((drawing) => drawing.drawingType === DrawingTypeEnum.DRAWING_GROUP).length === 0) return subscriber.next(true);
2224
- } else if (!drawings.every((drawing) => DRAWING_GROUP_TYPES.includes(drawing.drawingType))) return subscriber.next(true);
2267
+ } else if (!drawings.every((drawing) => isGroupableDrawingType(drawing.drawingType))) return subscriber.next(true);
2225
2268
  subscriber.next(false);
2226
2269
  };
2227
2270
  const subscription = drawingManagerService.focus$.subscribe((drawings) => {
@@ -2641,6 +2684,29 @@ const DrawingGroup = (props) => {
2641
2684
  //#region src/utils/config.ts
2642
2685
  const RANGE_DRAWING_ROTATION_LIMIT = [-360, 360];
2643
2686
 
2687
+ //#endregion
2688
+ //#region src/views/panel/drawing-transform-rotation.ts
2689
+ function isDrawingTransformRotationDisabled(rotateEnabled) {
2690
+ return !rotateEnabled;
2691
+ }
2692
+ function createDrawingTransformRotationChangeHandler(options) {
2693
+ return (val) => {
2694
+ if (isDrawingTransformRotationDisabled(options.rotateEnabled)) return;
2695
+ if (val == null) return;
2696
+ const { unitId, subUnitId, drawingId, drawingType } = options.drawingParam;
2697
+ const updateParam = {
2698
+ unitId,
2699
+ subUnitId,
2700
+ drawingId,
2701
+ drawingType,
2702
+ transform: { angle: val }
2703
+ };
2704
+ options.setRotation(val);
2705
+ options.emitUpdate([updateParam]);
2706
+ options.notifyChange();
2707
+ };
2708
+ }
2709
+
2644
2710
  //#endregion
2645
2711
  //#region src/views/panel/DrawingTransform.tsx
2646
2712
  const INPUT_DEBOUNCE_TIME = 300;
@@ -2668,6 +2734,8 @@ const DrawingTransform = (props) => {
2668
2734
  const [yPosition, setYPosition] = useState(originY);
2669
2735
  const [rotation, setRotation] = useState(originRotation);
2670
2736
  const [lockRatio, setLockRatio] = useState(transformer.keepRatio);
2737
+ const rotateEnabled = resolveDrawingUIRotateEnabled(drawingParam, { getChildren: (drawing) => drawingManagerService.getDrawingsByGroup(drawing) });
2738
+ const rotationDisabled = isDrawingTransformRotationDisabled(rotateEnabled);
2671
2739
  const checkMoveBoundary = (left, top, width, height) => {
2672
2740
  const { width: topSceneWidth, height: topSceneHeight } = topScene;
2673
2741
  const { ancestorLeft, ancestorTop } = scene;
@@ -2808,19 +2876,18 @@ const DrawingTransform = (props) => {
2808
2876
  drawingManagerService.featurePluginUpdateNotification([updateParam]);
2809
2877
  transformer.refreshControls().changeNotification();
2810
2878
  }, INPUT_DEBOUNCE_TIME);
2811
- const handleRotationChange = (val) => {
2812
- if (val == null) return;
2813
- const updateParam = {
2879
+ const handleRotationChange = createDrawingTransformRotationChangeHandler({
2880
+ rotateEnabled,
2881
+ drawingParam: {
2814
2882
  unitId,
2815
2883
  subUnitId,
2816
2884
  drawingId,
2817
- drawingType,
2818
- transform: { angle: val }
2819
- };
2820
- setRotation(val);
2821
- drawingManagerService.featurePluginUpdateNotification([updateParam]);
2822
- transformer.refreshControls().changeNotification();
2823
- };
2885
+ drawingType
2886
+ },
2887
+ setRotation,
2888
+ emitUpdate: (updateParams) => drawingManagerService.featurePluginUpdateNotification(updateParams),
2889
+ notifyChange: () => transformer.refreshControls().changeNotification()
2890
+ });
2824
2891
  const handleLockRatioChange = (val) => {
2825
2892
  setLockRatio(val);
2826
2893
  transformer.keepRatio = val;
@@ -2882,6 +2949,7 @@ const DrawingTransform = (props) => {
2882
2949
  value: rotation,
2883
2950
  min: RANGE_DRAWING_ROTATION_LIMIT[0],
2884
2951
  max: RANGE_DRAWING_ROTATION_LIMIT[1],
2952
+ disabled: rotationDisabled,
2885
2953
  onChange: handleRotationChange
2886
2954
  })] })
2887
2955
  ]
@@ -3126,4 +3194,4 @@ const DrawingCommonPanel = (props) => {
3126
3194
  };
3127
3195
 
3128
3196
  //#endregion
3129
- export { AutoImageCropOperation, COMPONENT_IMAGE_POPUP_MENU, CancelDrawingGroupOperation, CloseImageCropOperation, DRAWING_GROUP_TYPES, DrawingCommonPanel, DrawingImageClipService, DrawingRenderService, IMAGE_CLIP_SHAPE_PICKER_COMPONENT, ImageCropperObject, ImageResetSizeOperation, OpenImageCropOperation, SetDrawingAlignOperation, SetDrawingArrangeOperation, SetDrawingGroupOperation, UniverDrawingUIPlugin, getCurrentUnitInfo, getUpdateParams, insertGroupObject };
3197
+ export { AutoImageCropOperation, COMPONENT_IMAGE_POPUP_MENU, CancelDrawingGroupOperation, CloseImageCropOperation, DRAWING_GROUP_TYPES, DrawingCommonPanel, DrawingImageClipService, DrawingRenderService, IMAGE_CLIP_SHAPE_PICKER_COMPONENT, ImageCropperObject, ImageResetSizeOperation, OpenImageCropOperation, SetDrawingAlignOperation, SetDrawingArrangeOperation, SetDrawingGroupOperation, UniverDrawingUIPlugin, disposeDrawingRenderObject, getCurrentUnitInfo, getDrawingRenderObject, getUpdateParams, insertGroupObject };
@@ -16,14 +16,16 @@
16
16
  import type { IDrawingParam, IOperation } from '@univerjs/core';
17
17
  import { DrawingTypeEnum } from '@univerjs/core';
18
18
  /**
19
- * Now only support grouping images, shapes, and groups.
19
+ * Now only support grouping images, shapes, charts, and groups.
20
20
  */
21
- export declare const DRAWING_GROUP_TYPES: DrawingTypeEnum[];
21
+ export declare const DRAWING_GROUP_TYPES: readonly [DrawingTypeEnum.DRAWING_IMAGE, DrawingTypeEnum.DRAWING_SHAPE, DrawingTypeEnum.DRAWING_CHART, DrawingTypeEnum.DRAWING_GROUP];
22
22
  export interface IDrawingGroupOperationParams {
23
23
  drawings?: IDrawingParam[];
24
24
  }
25
25
  /**
26
- * Group the selected drawings into a new group. The selected drawings must be of type image, shape, or group, and there must be at least 2 drawings selected.
26
+ * Group the selected drawings into a new group. The selected drawings must be
27
+ * of type image, shape, chart, or group, and there must be at least 2 drawings
28
+ * selected.
27
29
  */
28
30
  export declare const SetDrawingGroupOperation: IOperation<IDrawingGroupOperationParams>;
29
31
  export interface ICancelDrawingGroupOperationParams {
@@ -13,10 +13,14 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { IDrawingSearch, IUniverInstanceService, Nullable } from '@univerjs/core';
16
+ import type { IDrawingParam, IDrawingSearch, IUniverInstanceService, Nullable } from '@univerjs/core';
17
17
  import type { IDrawingManagerService } from '@univerjs/drawing';
18
18
  import type { BaseObject, Scene } from '@univerjs/engine-render';
19
19
  import { UniverInstanceType } from '@univerjs/core';
20
+ import { Group } from '@univerjs/engine-render';
21
+ export declare function getDrawingRenderObject(scene: Scene, drawingSearch: IDrawingSearch): BaseObject | null;
22
+ export declare function disposeDrawingRenderObject(scene: Scene, drawingSearch: IDrawingSearch): boolean;
23
+ export declare function syncGroupRotateEnabled(group: Group, groupParam: IDrawingParam, scene: Scene, drawingManagerService: IDrawingManagerService, children?: readonly IDrawingParam[]): void;
20
24
  export declare function insertGroupObject(objectParam: IDrawingSearch, object: BaseObject, scene: Scene, drawingManagerService: IDrawingManagerService): void;
21
25
  export declare function getCurrentUnitInfo(currentUniverService: IUniverInstanceService, propUnitId?: string): {
22
26
  unitId: string;
@@ -22,7 +22,7 @@ export type { ICancelDrawingGroupOperationParams, IDrawingGroupOperationParams,
22
22
  export { AutoImageCropOperation, CloseImageCropOperation, OpenImageCropOperation, } from './commands/operations/image-crop.operation';
23
23
  export { ImageResetSizeOperation } from './commands/operations/image-reset-size.operation';
24
24
  export type { IUniverDrawingUIConfig } from './config/config';
25
- export { getCurrentUnitInfo, insertGroupObject } from './controllers/utils';
25
+ export { disposeDrawingRenderObject, getCurrentUnitInfo, getDrawingRenderObject, insertGroupObject } from './controllers/utils';
26
26
  export { UniverDrawingUIPlugin } from './plugin';
27
27
  export { DrawingImageClipService, IMAGE_CLIP_SHAPE_PICKER_COMPONENT } from './services/drawing-image-clip.service';
28
28
  export type { ImageShapeClipDelegate } from './services/drawing-image-clip.service';
@@ -23,6 +23,7 @@ import { IGalleryService } from '@univerjs/ui';
23
23
  import { DrawingImageClipService } from './drawing-image-clip.service';
24
24
  type IDrawingParamWithBehindText = (Partial<IDrawingParam> | Partial<IImageData>) & {
25
25
  behindText?: boolean | BooleanNumber;
26
+ docxHeaderFooterDrawing?: boolean;
26
27
  };
27
28
  export declare const DOC_DRAWING_BEHIND_TEXT_LAYER_INDEX = 1;
28
29
  export declare function getDrawingRenderLayerIndex(param: IDrawingParamWithBehindText): number;
@@ -0,0 +1,19 @@
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 { DrawingType, IDrawingParam } from '@univerjs/core';
17
+ import type { IDrawingRotateEnabledResolverOptions } from '@univerjs/drawing';
18
+ export declare function isKnownDrawingUINonRotatableType(drawingType: DrawingType): boolean;
19
+ export declare function resolveDrawingUIRotateEnabled(drawing: IDrawingParam, options?: IDrawingRotateEnabledResolverOptions): boolean;
@@ -13,8 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import type { LocaleKey } from '../../locale/types';
16
17
  export interface IImagePopupMenuItem {
17
- label: string;
18
+ label: LocaleKey;
18
19
  index: number;
19
20
  commandId: string;
20
21
  commandParams?: object;
@@ -0,0 +1,26 @@
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 { IDrawingParam } from '@univerjs/core';
17
+ interface IDrawingTransformRotationChangeHandlerOptions {
18
+ rotateEnabled: boolean;
19
+ drawingParam: Pick<IDrawingParam, 'unitId' | 'subUnitId' | 'drawingId' | 'drawingType'>;
20
+ setRotation: (rotation: number) => void;
21
+ emitUpdate: (updateParams: IDrawingParam[]) => void;
22
+ notifyChange: () => void;
23
+ }
24
+ export declare function isDrawingTransformRotationDisabled(rotateEnabled: boolean): boolean;
25
+ export declare function createDrawingTransformRotationChangeHandler(options: IDrawingTransformRotationChangeHandlerOptions): (val: number | null) => void;
26
+ export {};