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

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 (92) hide show
  1. package/lib/cjs/index.js +1306 -854
  2. package/lib/cjs/locale/ar-SA.js +45 -0
  3. package/lib/cjs/locale/ca-ES.js +45 -0
  4. package/lib/cjs/locale/de-DE.js +45 -0
  5. package/lib/cjs/locale/en-US.js +45 -0
  6. package/lib/cjs/locale/es-ES.js +45 -0
  7. package/lib/cjs/locale/fa-IR.js +45 -0
  8. package/lib/cjs/locale/fr-FR.js +45 -0
  9. package/lib/cjs/locale/id-ID.js +45 -0
  10. package/lib/cjs/locale/it-IT.js +45 -0
  11. package/lib/cjs/locale/ja-JP.js +45 -0
  12. package/lib/cjs/locale/ko-KR.js +45 -0
  13. package/lib/cjs/locale/pl-PL.js +45 -0
  14. package/lib/cjs/locale/pt-BR.js +45 -0
  15. package/lib/cjs/locale/ru-RU.js +45 -0
  16. package/lib/cjs/locale/sk-SK.js +45 -0
  17. package/lib/cjs/locale/vi-VN.js +45 -0
  18. package/lib/cjs/locale/zh-CN.js +45 -0
  19. package/lib/cjs/locale/zh-HK.js +45 -0
  20. package/lib/cjs/locale/zh-TW.js +45 -0
  21. package/lib/es/index.js +1300 -856
  22. package/lib/es/locale/ar-SA.js +45 -0
  23. package/lib/es/locale/ca-ES.js +45 -0
  24. package/lib/es/locale/de-DE.js +45 -0
  25. package/lib/es/locale/en-US.js +45 -0
  26. package/lib/es/locale/es-ES.js +45 -0
  27. package/lib/es/locale/fa-IR.js +45 -0
  28. package/lib/es/locale/fr-FR.js +45 -0
  29. package/lib/es/locale/id-ID.js +45 -0
  30. package/lib/es/locale/it-IT.js +45 -0
  31. package/lib/es/locale/ja-JP.js +45 -0
  32. package/lib/es/locale/ko-KR.js +45 -0
  33. package/lib/es/locale/pl-PL.js +45 -0
  34. package/lib/es/locale/pt-BR.js +45 -0
  35. package/lib/es/locale/ru-RU.js +45 -0
  36. package/lib/es/locale/sk-SK.js +45 -0
  37. package/lib/es/locale/vi-VN.js +45 -0
  38. package/lib/es/locale/zh-CN.js +45 -0
  39. package/lib/es/locale/zh-HK.js +45 -0
  40. package/lib/es/locale/zh-TW.js +45 -0
  41. package/lib/index.css +299 -0
  42. package/lib/index.js +1300 -856
  43. package/lib/locale/ar-SA.js +45 -0
  44. package/lib/locale/ca-ES.js +45 -0
  45. package/lib/locale/de-DE.js +45 -0
  46. package/lib/locale/en-US.js +45 -0
  47. package/lib/locale/es-ES.js +45 -0
  48. package/lib/locale/fa-IR.js +45 -0
  49. package/lib/locale/fr-FR.js +45 -0
  50. package/lib/locale/id-ID.js +45 -0
  51. package/lib/locale/it-IT.js +45 -0
  52. package/lib/locale/ja-JP.js +45 -0
  53. package/lib/locale/ko-KR.js +45 -0
  54. package/lib/locale/pl-PL.js +45 -0
  55. package/lib/locale/pt-BR.js +45 -0
  56. package/lib/locale/ru-RU.js +45 -0
  57. package/lib/locale/sk-SK.js +45 -0
  58. package/lib/locale/vi-VN.js +45 -0
  59. package/lib/locale/zh-CN.js +45 -0
  60. package/lib/locale/zh-HK.js +45 -0
  61. package/lib/locale/zh-TW.js +45 -0
  62. package/lib/types/controllers/image-update.controller.d.ts +2 -2
  63. package/lib/types/index.d.ts +6 -1
  64. package/lib/types/locale/en-US.d.ts +45 -0
  65. package/lib/types/services/drawing-render.service.d.ts +10 -4
  66. package/lib/types/views/image-popup-menu/ImagePopupMenu.d.ts +11 -3
  67. package/lib/types/views/object-list-panel/ObjectListPanelBase.d.ts +101 -0
  68. package/lib/types/views/object-list-panel/object-list-panel-layer.d.ts +21 -0
  69. package/lib/types/views/panel/DrawingCommonPanel.d.ts +1 -1
  70. package/lib/types/views/panel/DrawingTransform.d.ts +1 -1
  71. package/lib/types/views/panel/ImageCropper.d.ts +1 -1
  72. package/lib/umd/index.js +7 -1
  73. package/lib/umd/locale/ar-SA.js +1 -1
  74. package/lib/umd/locale/ca-ES.js +1 -1
  75. package/lib/umd/locale/de-DE.js +1 -1
  76. package/lib/umd/locale/en-US.js +1 -1
  77. package/lib/umd/locale/es-ES.js +1 -1
  78. package/lib/umd/locale/fa-IR.js +1 -1
  79. package/lib/umd/locale/fr-FR.js +1 -1
  80. package/lib/umd/locale/id-ID.js +1 -1
  81. package/lib/umd/locale/it-IT.js +1 -1
  82. package/lib/umd/locale/ja-JP.js +1 -1
  83. package/lib/umd/locale/ko-KR.js +1 -1
  84. package/lib/umd/locale/pl-PL.js +1 -1
  85. package/lib/umd/locale/pt-BR.js +1 -1
  86. package/lib/umd/locale/ru-RU.js +1 -1
  87. package/lib/umd/locale/sk-SK.js +1 -1
  88. package/lib/umd/locale/vi-VN.js +1 -1
  89. package/lib/umd/locale/zh-CN.js +1 -1
  90. package/lib/umd/locale/zh-HK.js +1 -1
  91. package/lib/umd/locale/zh-TW.js +1 -1
  92. package/package.json +10 -10
package/lib/es/index.js CHANGED
@@ -1,12 +1,12 @@
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 { DRAWING_GROUPABLE_TYPES, IDrawingManagerService, IImageIoService, ImageSourceType as ImageSourceType$1, SetDrawingSelectedOperation, getDrawingShapeKeyByDrawingSearch, isGroupableDrawingType, resolveDrawingRotateEnabled } from "@univerjs/drawing";
1
+ import { ArrangeTypeEnum, BooleanNumber, CommandType, Disposable, DrawingTypeEnum, ICommandService, IConfigService, IImageIoService, IURLImageService, IUniverInstanceService, ImageSourceType, Inject, Injector, LocaleService, Plugin, PositionedObjectLayoutType, UniverInstanceType, checkIfMove, debounce, generateRandomId, merge, toDisposable } from "@univerjs/core";
2
+ import { DRAWING_GROUPABLE_TYPES, IDrawingManagerService, 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
- import { AutofillDoubleIcon, BottomIcon, CreateCopyIcon, CropIcon, DeleteIcon, DocSettingIcon, GroupIcon, MoreDownIcon, MoveDownIcon, MoveUpIcon, TextWrapShapeIcon, TopmostIcon, UngroupIcon } from "@univerjs/icons";
5
4
  import { ComponentManager, ContextMenuGroup, ContextMenuPosition, IDialogService, IGalleryService, IMenuManagerService, IMessageService, IconManager, MenuItemType, useDependency, useObservable } from "@univerjs/ui";
6
- import { Button, Checkbox, Dropdown, DropdownMenu, InputNumber, MessageType, Select, Separator, Tooltip, borderClassName, clsx } from "@univerjs/design";
7
- import { useEffect, useRef, useState } from "react";
5
+ import { BehaviorSubject, Observable, bufferTime, filter, map, merge as merge$1, of, switchMap } from "rxjs";
6
+ import { ArrowDownIcon, ArrowUpIcon, AutofillDoubleIcon, BottomIcon, ChartIcon, CreateCopyIcon, CropIcon, DeleteIcon, DocSettingIcon, EyeIcon, EyelashIcon, GroupIcon, LocateFixedIcon, LockIcon, MoreDownIcon, MoreRightIcon, MoveDownIcon, MoveUpIcon, TextWrapShapeIcon, TopmostIcon, UngroupIcon } from "@univerjs/icons";
7
+ import { Button, Checkbox, Dropdown, DropdownMenu, Input, InputNumber, MessageType, Select, Separator, Tooltip, borderClassName, clsx } from "@univerjs/design";
8
+ import { useEffect, useMemo, useRef, useState } from "react";
8
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
- import { BehaviorSubject, Observable, bufferTime, filter, map, of, switchMap } from "rxjs";
10
10
 
11
11
  //#region src/commands/operations/drawing-align.operation.ts
12
12
  /**
@@ -360,269 +360,280 @@ function getCurrentUnitInfo(currentUniverService, propUnitId) {
360
360
  }
361
361
 
362
362
  //#endregion
363
- //#region package.json
364
- var name = "@univerjs/drawing-ui";
365
- var version = "1.0.0-alpha.2";
366
-
367
- //#endregion
368
- //#region src/config/config.ts
369
- const DRAWING_UI_PLUGIN_CONFIG_KEY = "drawing-ui.config";
370
- const configSymbol = Symbol(DRAWING_UI_PLUGIN_CONFIG_KEY);
371
- const defaultPluginConfig = {};
372
-
373
- //#endregion
374
- //#region src/views/image-popup-menu/component-name.ts
375
- /**
376
- * Copyright 2023-present DreamNum Co., Ltd.
377
- *
378
- * Licensed under the Apache License, Version 2.0 (the "License");
379
- * you may not use this file except in compliance with the License.
380
- * You may obtain a copy of the License at
381
- *
382
- * http://www.apache.org/licenses/LICENSE-2.0
383
- *
384
- * Unless required by applicable law or agreed to in writing, software
385
- * distributed under the License is distributed on an "AS IS" BASIS,
386
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
387
- * See the License for the specific language governing permissions and
388
- * limitations under the License.
389
- */
390
- const COMPONENT_IMAGE_POPUP_MENU = "COMPONENT_IMAGE_POPUP_MENU";
391
-
392
- //#endregion
393
- //#region src/views/image-popup-menu/ImagePopupMenu.tsx
394
- function ImagePopupMenu(props) {
395
- var _popup$extraProps, _popup$extraProps2;
396
- const { popup } = props;
397
- const menuItems = popup === null || popup === void 0 || (_popup$extraProps = popup.extraProps) === null || _popup$extraProps === void 0 ? void 0 : _popup$extraProps.menuItems;
398
- if (!menuItems) return null;
399
- if (((_popup$extraProps2 = popup.extraProps) === null || _popup$extraProps2 === void 0 ? void 0 : _popup$extraProps2.variant) === "doc-floating-toolbar" && popup.extraProps.unitId && popup.extraProps.subUnitId && popup.extraProps.drawingId) return /* @__PURE__ */ jsx(DocImageFloatingToolbar, {
400
- menuItems,
401
- unitId: popup.extraProps.unitId,
402
- subUnitId: popup.extraProps.subUnitId,
403
- drawingId: popup.extraProps.drawingId
363
+ //#region src/menu/align.menu.ts
364
+ const getMenuStateByDrawingFocusChangedObservable$$1 = (accessor) => {
365
+ const drawingManagerService = accessor.get(IDrawingManagerService);
366
+ return new Observable((subscriber) => {
367
+ const update = (drawings) => {
368
+ if (!drawings || drawings.length === 0) return subscriber.next(true);
369
+ if (drawings.length < 2) return subscriber.next(true);
370
+ subscriber.next(false);
371
+ };
372
+ const subscription = drawingManagerService.focus$.subscribe((drawings) => {
373
+ if (!drawings || drawings.length === 0) return subscriber.next(true);
374
+ update(drawings);
375
+ });
376
+ update(drawingManagerService.getFocusDrawings());
377
+ return () => subscription.unsubscribe();
404
378
  });
405
- const commandService = useDependency(ICommandService);
406
- const localeService = useDependency(LocaleService);
407
- const [visible, setVisible] = useState(false);
408
- const [isHovered, setHovered] = useState(false);
409
- const handleMouseEnter = () => {
410
- setHovered(true);
379
+ };
380
+ const DRAWING_ALIGN_CONTEXT_MENU_ID = "contextMenu.drawing-align";
381
+ function DrawingAlignContextMenuItemFactory(accessor) {
382
+ return {
383
+ id: DRAWING_ALIGN_CONTEXT_MENU_ID,
384
+ type: MenuItemType.SUBITEMS,
385
+ icon: "HorizontallyIcon",
386
+ title: "drawing-ui.image-panel.align.title",
387
+ hidden$: getMenuStateByDrawingFocusChangedObservable$$1(accessor)
411
388
  };
412
- const handleMouseLeave = () => {
413
- setHovered(false);
389
+ }
390
+ function SetDrawingAlignLeftMenuItemFactory() {
391
+ return {
392
+ id: SetDrawingAlignLeftOperation.id,
393
+ type: MenuItemType.BUTTON,
394
+ icon: "LeftJustifyingIcon",
395
+ title: "drawing-ui.image-panel.align.left"
414
396
  };
415
- const onVisibleChange = (visible) => {
416
- setVisible(visible);
397
+ }
398
+ function SetDrawingAlignCenterMenuItemFactory() {
399
+ return {
400
+ id: SetDrawingAlignCenterOperation.id,
401
+ type: MenuItemType.BUTTON,
402
+ icon: "HorizontallyIcon",
403
+ title: "drawing-ui.image-panel.align.center"
417
404
  };
418
- const handleClick = (item) => {
419
- commandService.executeCommand(item.commandId, item.commandParams);
420
- setVisible(false);
405
+ }
406
+ function SetDrawingAlignRightMenuItemFactory() {
407
+ return {
408
+ id: SetDrawingAlignRightOperation.id,
409
+ type: MenuItemType.BUTTON,
410
+ icon: "RightJustifyingIcon",
411
+ title: "drawing-ui.image-panel.align.right"
421
412
  };
422
- const showMore = visible || isHovered;
423
- return /* @__PURE__ */ jsx("div", {
424
- onMouseEnter: handleMouseEnter,
425
- onMouseLeave: handleMouseLeave,
426
- children: /* @__PURE__ */ jsx(DropdownMenu, {
427
- align: "start",
428
- items: menuItems.map((item) => ({
429
- type: "item",
430
- children: localeService.t(item.label),
431
- disabled: item.disable,
432
- onSelect: () => handleClick(item)
433
- })),
434
- open: visible,
435
- onOpenChange: onVisibleChange,
436
- children: /* @__PURE__ */ jsxs("div", {
437
- className: clsx("univer-flex univer-items-center univer-gap-2 univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-800", borderClassName, {
438
- "univer-bg-gray-100 dark:!univer-bg-gray-800": visible,
439
- "univer-bg-white dark:!univer-bg-gray-900": !visible
440
- }),
441
- children: [/* @__PURE__ */ jsx(AutofillDoubleIcon, { className: "univer-fill-primary-600 univer-text-gray-900 dark:!univer-text-white" }), showMore && /* @__PURE__ */ jsx(MoreDownIcon, { className: "dark:!univer-text-white" })]
442
- })
443
- })
444
- });
445
413
  }
446
- const UPDATE_DOC_DRAWING_WRAPPING_STYLE_COMMAND_ID = "doc.command.update-doc-drawing-wrapping-style";
447
- function getWrappingStyle(documentDataModel, drawingId) {
448
- var _documentDataModel$ge;
449
- const drawing = documentDataModel === null || documentDataModel === void 0 || (_documentDataModel$ge = documentDataModel.getSnapshot().drawings) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge[drawingId];
450
- if (!drawing) return "inline";
451
- if (drawing.layoutType === PositionedObjectLayoutType.WRAP_NONE) return drawing.behindDoc === BooleanNumber.TRUE ? "behindText" : "inFrontOfText";
452
- if (drawing.layoutType === PositionedObjectLayoutType.WRAP_SQUARE) return "wrapSquare";
453
- if (drawing.layoutType === PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM) return "wrapTopAndBottom";
454
- return "inline";
414
+ function SetDrawingAlignTopMenuItemFactory() {
415
+ return {
416
+ id: SetDrawingAlignTopOperation.id,
417
+ type: MenuItemType.BUTTON,
418
+ icon: "AlignTopIcon",
419
+ title: "drawing-ui.image-panel.align.top"
420
+ };
455
421
  }
456
- function ToolbarGroup(props) {
457
- return /* @__PURE__ */ jsx("div", {
458
- className: "univer-flex univer-h-7 univer-items-center univer-gap-1 univer-px-1",
459
- children: props.children
460
- });
422
+ function SetDrawingAlignMiddleMenuItemFactory() {
423
+ return {
424
+ id: SetDrawingAlignMiddleOperation.id,
425
+ type: MenuItemType.BUTTON,
426
+ icon: "VerticalCenterIcon",
427
+ title: "drawing-ui.image-panel.align.middle"
428
+ };
461
429
  }
462
- function ToolbarButton(props) {
463
- return /* @__PURE__ */ jsx(Tooltip, {
464
- title: props.title,
465
- placement: "bottom",
466
- children: /* @__PURE__ */ jsx("button", {
467
- type: "button",
468
- disabled: props.disabled,
469
- onClick: props.onClick,
470
- className: clsx("univer-flex univer-h-6 univer-w-6 univer-items-center univer-justify-center univer-rounded-md univer-border-none univer-bg-transparent univer-p-0 univer-text-sm univer-text-gray-700 univer-transition-colors hover:univer-bg-gray-100 disabled:univer-cursor-not-allowed disabled:univer-opacity-40 dark:!univer-text-gray-100 dark:hover:!univer-bg-gray-700", { "univer-bg-gray-100 univer-text-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-primary-300": props.active }),
471
- children: props.children
472
- })
473
- });
430
+ function SetDrawingAlignBottomMenuItemFactory() {
431
+ return {
432
+ id: SetDrawingAlignBottomOperation.id,
433
+ type: MenuItemType.BUTTON,
434
+ icon: "AlignBottomIcon",
435
+ title: "drawing-ui.image-panel.align.bottom"
436
+ };
474
437
  }
475
- function ToolbarDropdownButton(props) {
476
- var _props$options$find;
477
- const [open, setOpen] = useState(false);
478
- const activeOption = (_props$options$find = props.options.find((option) => option.value === props.value)) !== null && _props$options$find !== void 0 ? _props$options$find : props.options[0];
479
- return /* @__PURE__ */ jsx(Dropdown, {
480
- open,
481
- onOpenChange: setOpen,
482
- overlay: /* @__PURE__ */ jsx("div", {
483
- className: "univer-min-w-32 univer-rounded-lg univer-border univer-border-solid univer-border-gray-200 univer-bg-white univer-p-1 univer-shadow-lg dark:!univer-border-gray-700 dark:!univer-bg-gray-900",
484
- children: props.options.map((option) => /* @__PURE__ */ jsxs("button", {
485
- type: "button",
486
- onClick: () => {
487
- props.onChange(option.value);
488
- setOpen(false);
489
- },
490
- className: clsx("univer-flex univer-h-8 univer-w-full univer-items-center univer-gap-2 univer-rounded-md univer-border-none univer-bg-transparent univer-px-2 univer-text-left univer-text-sm univer-text-gray-700 univer-transition-colors hover:univer-bg-gray-100 dark:!univer-text-gray-100 dark:hover:!univer-bg-gray-800", { "univer-bg-primary-50 univer-text-primary-600 dark:!univer-bg-gray-800 dark:!univer-text-primary-300": option.value === props.value }),
491
- children: [/* @__PURE__ */ jsx("span", {
492
- className: "univer-flex univer-size-4 univer-items-center univer-justify-center",
493
- children: option.icon
494
- }), /* @__PURE__ */ jsx("span", {
495
- className: "univer-flex-1",
496
- children: option.label
497
- })]
498
- }, option.value))
499
- }),
500
- children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Tooltip, {
501
- title: props.title,
502
- placement: "bottom",
503
- children: /* @__PURE__ */ jsxs("button", {
504
- type: "button",
505
- className: clsx("univer-flex univer-h-6 univer-min-w-9 univer-items-center univer-justify-center univer-gap-1 univer-rounded-md univer-border-none univer-bg-transparent univer-px-1.5 univer-text-sm univer-text-gray-700 univer-transition-colors hover:univer-bg-gray-100 dark:!univer-text-gray-100 dark:hover:!univer-bg-gray-700", { "univer-bg-gray-100 univer-text-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-primary-300": open }),
506
- children: [activeOption.icon, /* @__PURE__ */ jsx(MoreDownIcon, { className: "univer-text-xs" })]
507
- })
508
- }) })
509
- });
438
+ function SetDrawingAlignHorizonMenuItemFactory() {
439
+ return {
440
+ id: SetDrawingAlignHorizonOperation.id,
441
+ type: MenuItemType.BUTTON,
442
+ icon: "HorizontallyIcon",
443
+ title: "drawing-ui.image-panel.align.horizon"
444
+ };
510
445
  }
511
- function DocImageFloatingToolbar(props) {
512
- var _univerInstanceServic, _wrappingStyleOptions, _wrappingStyleOptions2;
513
- const commandService = useDependency(ICommandService);
514
- const localeService = useDependency(LocaleService);
515
- const documentDataModel = (_univerInstanceServic = useDependency(IUniverInstanceService).getUnit(props.unitId, UniverInstanceType.UNIVER_DOC)) !== null && _univerInstanceServic !== void 0 ? _univerInstanceServic : void 0;
516
- const [wrappingStyle, setWrappingStyle] = useState(() => getWrappingStyle(documentDataModel, props.drawingId));
517
- const [hidden, setHidden] = useState(false);
518
- const getMenuItem = (label) => props.menuItems.find((item) => item.label === label);
519
- const editItem = getMenuItem("drawing-ui.image-popup.edit");
520
- const cropItem = getMenuItem("drawing-ui.image-popup.crop");
521
- const deleteItem = getMenuItem("drawing-ui.image-popup.delete");
522
- const wrappingStyleOptions = [
523
- {
524
- label: localeService.t("drawing-ui.image-text-wrap.inline"),
525
- value: "inline",
526
- icon: /* @__PURE__ */ jsx(TextWrapShapeIcon, {})
527
- },
528
- {
529
- label: localeService.t("drawing-ui.image-text-wrap.square"),
530
- value: "wrapSquare",
531
- icon: /* @__PURE__ */ jsx(TextWrapShapeIcon, {})
532
- },
533
- {
534
- label: localeService.t("drawing-ui.image-text-wrap.topAndBottom"),
535
- value: "wrapTopAndBottom",
536
- icon: /* @__PURE__ */ jsx(TextWrapShapeIcon, {})
537
- },
538
- {
539
- label: localeService.t("drawing-ui.image-text-wrap.behindText"),
540
- value: "behindText",
541
- icon: /* @__PURE__ */ jsx(TextWrapShapeIcon, {})
542
- },
543
- {
544
- label: localeService.t("drawing-ui.image-text-wrap.inFrontText"),
545
- value: "inFrontOfText",
546
- icon: /* @__PURE__ */ jsx(TextWrapShapeIcon, {})
547
- }
548
- ];
549
- const executeMenuItem = (item) => {
550
- if (!item || item.disable) return;
551
- commandService.executeCommand(item.commandId, item.commandParams);
446
+ function SetDrawingAlignVerticalMenuItemFactory() {
447
+ return {
448
+ id: SetDrawingAlignVerticalOperation.id,
449
+ type: MenuItemType.BUTTON,
450
+ icon: "VerticalCenterIcon",
451
+ title: "drawing-ui.image-panel.align.vertical"
552
452
  };
553
- const updateWrappingStyle = (value) => {
554
- setWrappingStyle(value);
555
- commandService.executeCommand(UPDATE_DOC_DRAWING_WRAPPING_STYLE_COMMAND_ID, {
556
- unitId: props.unitId,
557
- subUnitId: props.subUnitId,
558
- drawings: [{
559
- unitId: props.unitId,
560
- subUnitId: props.subUnitId,
561
- drawingId: props.drawingId
562
- }],
563
- wrappingStyle: value
564
- });
565
- };
566
- if (hidden) return null;
567
- return /* @__PURE__ */ jsxs("div", {
568
- "data-u-comp": "doc-image-floating-toolbar",
569
- onMouseDown: (event) => {
570
- event.stopPropagation();
571
- event.preventDefault();
572
- },
573
- className: clsx("univer-box-border univer-flex univer-items-center univer-rounded univer-bg-white univer-px-1 univer-py-1 univer-shadow-sm dark:!univer-border-gray-700 dark:!univer-bg-gray-900", borderClassName),
574
- children: [
575
- /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(ToolbarDropdownButton, {
576
- title: (_wrappingStyleOptions = (_wrappingStyleOptions2 = wrappingStyleOptions.find((option) => option.value === wrappingStyle)) === null || _wrappingStyleOptions2 === void 0 ? void 0 : _wrappingStyleOptions2.label) !== null && _wrappingStyleOptions !== void 0 ? _wrappingStyleOptions : localeService.t("drawing-ui.image-text-wrap.inline"),
577
- value: wrappingStyle,
578
- options: wrappingStyleOptions,
579
- onChange: updateWrappingStyle
580
- }) }),
581
- /* @__PURE__ */ jsx(Separator, { orientation: "vertical" }),
582
- /* @__PURE__ */ jsxs(ToolbarGroup, { children: [/* @__PURE__ */ jsx(ToolbarButton, {
583
- title: editItem ? localeService.t(editItem.label) : localeService.t("drawing-ui.image-popup.edit"),
584
- disabled: !editItem || editItem.disable,
585
- onClick: () => {
586
- setHidden(true);
587
- executeMenuItem(editItem);
588
- },
589
- children: /* @__PURE__ */ jsx(DocSettingIcon, {})
590
- }), /* @__PURE__ */ jsx(ToolbarButton, {
591
- title: cropItem ? localeService.t(cropItem.label) : localeService.t("drawing-ui.image-popup.crop"),
592
- disabled: !cropItem || cropItem.disable,
593
- onClick: () => executeMenuItem(cropItem),
594
- children: /* @__PURE__ */ jsx(CropIcon, {})
595
- })] }),
596
- /* @__PURE__ */ jsx(Separator, { orientation: "vertical" }),
597
- /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(ToolbarButton, {
598
- title: deleteItem ? localeService.t(deleteItem.label) : localeService.t("drawing-ui.image-popup.delete"),
599
- disabled: !deleteItem || deleteItem.disable,
600
- onClick: () => executeMenuItem(deleteItem),
601
- children: /* @__PURE__ */ jsx(DeleteIcon, {})
602
- }) })
603
- ]
604
- });
605
453
  }
606
454
 
607
455
  //#endregion
608
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
609
- function __decorateParam(paramIndex, decorator) {
610
- return function(target, key) {
611
- decorator(target, key, paramIndex);
456
+ //#region src/menu/arrange.menu.ts
457
+ const DRAWING_ARRANGE_CONTEXT_MENU_ID = "contextMenu.drawing-arrange";
458
+ function DrawingArrangeContextMenuItemFactory() {
459
+ return {
460
+ id: DRAWING_ARRANGE_CONTEXT_MENU_ID,
461
+ type: MenuItemType.SUBITEMS,
462
+ icon: "TopmostIcon",
463
+ title: "drawing-ui.image-panel.arrange.title"
464
+ };
465
+ }
466
+ function SetDrawingArrangeFrontMenuItemFactory() {
467
+ return {
468
+ id: SetDrawingArrangeFrontOperation.id,
469
+ type: MenuItemType.BUTTON,
470
+ icon: "TopmostIcon",
471
+ title: "drawing-ui.image-panel.arrange.front"
472
+ };
473
+ }
474
+ function SetDrawingArrangeForwardMenuItemFactory() {
475
+ return {
476
+ id: SetDrawingArrangeForwardOperation.id,
477
+ type: MenuItemType.BUTTON,
478
+ icon: "MoveUpIcon",
479
+ title: "drawing-ui.image-panel.arrange.forward"
480
+ };
481
+ }
482
+ function SetDrawingArrangeBackMenuItemFactory() {
483
+ return {
484
+ id: SetDrawingArrangeBackOperation.id,
485
+ type: MenuItemType.BUTTON,
486
+ icon: "BottomIcon",
487
+ title: "drawing-ui.image-panel.arrange.back"
488
+ };
489
+ }
490
+ function SetDrawingArrangeBackwardMenuItemFactory() {
491
+ return {
492
+ id: SetDrawingArrangeBackwardOperation.id,
493
+ type: MenuItemType.BUTTON,
494
+ icon: "MoveDownIcon",
495
+ title: "drawing-ui.image-panel.arrange.backward"
612
496
  };
613
497
  }
614
498
 
615
499
  //#endregion
616
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
617
- function __decorate(decorators, target, key, desc) {
618
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
619
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
620
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
621
- return c > 3 && r && Object.defineProperty(target, key, r), r;
500
+ //#region src/menu/group.menu.ts
501
+ function getMenuStateByDrawingFocusChangedObservable$(accessor, type) {
502
+ const drawingManagerService = accessor.get(IDrawingManagerService);
503
+ return new Observable((subscriber) => {
504
+ const update = (drawings) => {
505
+ if (!drawings || drawings.length === 0) return subscriber.next(true);
506
+ if (type === "group") {
507
+ if (drawings.length < 2) return subscriber.next(true);
508
+ if (!drawings.every((drawing) => isGroupableDrawingType(drawing.drawingType))) return subscriber.next(true);
509
+ } else if (type === "unGroup") {
510
+ if (drawings.filter((drawing) => drawing.drawingType === DrawingTypeEnum.DRAWING_GROUP).length === 0) return subscriber.next(true);
511
+ } else if (!drawings.every((drawing) => isGroupableDrawingType(drawing.drawingType))) return subscriber.next(true);
512
+ subscriber.next(false);
513
+ };
514
+ const subscription = drawingManagerService.focus$.subscribe((drawings) => {
515
+ if (!drawings || drawings.length === 0) return subscriber.next(true);
516
+ update(drawings);
517
+ });
518
+ update(drawingManagerService.getFocusDrawings());
519
+ return () => subscription.unsubscribe();
520
+ });
521
+ }
522
+ const DRAWING_GROUP_CONTEXT_MENU_ID = "contextMenu.drawing-group";
523
+ function DrawingGroupContextMenuItemFactory(accessor) {
524
+ return {
525
+ id: DRAWING_GROUP_CONTEXT_MENU_ID,
526
+ type: MenuItemType.SUBITEMS,
527
+ icon: "GroupIcon",
528
+ title: "drawing-ui.image-panel.group.title",
529
+ hidden$: getMenuStateByDrawingFocusChangedObservable$(accessor)
530
+ };
531
+ }
532
+ function SetDrawingGroupMenuItemFactory(accessor) {
533
+ return {
534
+ id: SetDrawingGroupOperation.id,
535
+ type: MenuItemType.BUTTON,
536
+ icon: "GroupIcon",
537
+ title: "drawing-ui.image-panel.group.group",
538
+ disabled$: getMenuStateByDrawingFocusChangedObservable$(accessor, "group")
539
+ };
540
+ }
541
+ function CancelDrawingGroupMenuItemFactory(accessor) {
542
+ return {
543
+ id: CancelDrawingGroupOperation.id,
544
+ type: MenuItemType.BUTTON,
545
+ icon: "UngroupIcon",
546
+ title: "drawing-ui.image-panel.group.unGroup",
547
+ disabled$: getMenuStateByDrawingFocusChangedObservable$(accessor, "unGroup")
548
+ };
622
549
  }
623
550
 
624
551
  //#endregion
625
- //#region src/controllers/components.controller.ts
552
+ //#region src/menu/schema.ts
553
+ const menuSchema = { [ContextMenuPosition.DRAWING]: { [ContextMenuGroup.OTHERS]: {
554
+ [DRAWING_GROUP_CONTEXT_MENU_ID]: {
555
+ order: 1,
556
+ menuItemFactory: DrawingGroupContextMenuItemFactory,
557
+ [SetDrawingGroupOperation.id]: {
558
+ order: 0,
559
+ menuItemFactory: SetDrawingGroupMenuItemFactory
560
+ },
561
+ [CancelDrawingGroupOperation.id]: {
562
+ order: 1,
563
+ menuItemFactory: CancelDrawingGroupMenuItemFactory
564
+ }
565
+ },
566
+ [DRAWING_ARRANGE_CONTEXT_MENU_ID]: {
567
+ order: 2,
568
+ menuItemFactory: DrawingArrangeContextMenuItemFactory,
569
+ [SetDrawingArrangeFrontOperation.id]: {
570
+ order: 0,
571
+ menuItemFactory: SetDrawingArrangeFrontMenuItemFactory
572
+ },
573
+ [SetDrawingArrangeForwardOperation.id]: {
574
+ order: 1,
575
+ menuItemFactory: SetDrawingArrangeForwardMenuItemFactory
576
+ },
577
+ [SetDrawingArrangeBackOperation.id]: {
578
+ order: 2,
579
+ menuItemFactory: SetDrawingArrangeBackMenuItemFactory
580
+ },
581
+ [SetDrawingArrangeBackwardOperation.id]: {
582
+ order: 3,
583
+ menuItemFactory: SetDrawingArrangeBackwardMenuItemFactory
584
+ }
585
+ },
586
+ [DRAWING_ALIGN_CONTEXT_MENU_ID]: {
587
+ order: 3,
588
+ menuItemFactory: DrawingAlignContextMenuItemFactory,
589
+ [SetDrawingAlignLeftOperation.id]: {
590
+ order: 0,
591
+ menuItemFactory: SetDrawingAlignLeftMenuItemFactory
592
+ },
593
+ [SetDrawingAlignCenterOperation.id]: {
594
+ order: 1,
595
+ menuItemFactory: SetDrawingAlignCenterMenuItemFactory
596
+ },
597
+ [SetDrawingAlignRightOperation.id]: {
598
+ order: 2,
599
+ menuItemFactory: SetDrawingAlignRightMenuItemFactory
600
+ },
601
+ [SetDrawingAlignTopOperation.id]: {
602
+ order: 3,
603
+ menuItemFactory: SetDrawingAlignTopMenuItemFactory
604
+ },
605
+ [SetDrawingAlignMiddleOperation.id]: {
606
+ order: 4,
607
+ menuItemFactory: SetDrawingAlignMiddleMenuItemFactory
608
+ },
609
+ [SetDrawingAlignBottomOperation.id]: {
610
+ order: 5,
611
+ menuItemFactory: SetDrawingAlignBottomMenuItemFactory
612
+ },
613
+ [SetDrawingAlignHorizonOperation.id]: {
614
+ order: 6,
615
+ menuItemFactory: SetDrawingAlignHorizonMenuItemFactory
616
+ },
617
+ [SetDrawingAlignVerticalOperation.id]: {
618
+ order: 7,
619
+ menuItemFactory: SetDrawingAlignVerticalMenuItemFactory
620
+ }
621
+ }
622
+ } } };
623
+
624
+ //#endregion
625
+ //#region package.json
626
+ var name = "@univerjs/drawing-ui";
627
+ var version = "1.0.0-alpha.4";
628
+
629
+ //#endregion
630
+ //#region src/config/config.ts
631
+ const DRAWING_UI_PLUGIN_CONFIG_KEY = "drawing-ui.config";
632
+ const configSymbol = Symbol(DRAWING_UI_PLUGIN_CONFIG_KEY);
633
+ const defaultPluginConfig = {};
634
+
635
+ //#endregion
636
+ //#region src/views/image-popup-menu/component-name.ts
626
637
  /**
627
638
  * Copyright 2023-present DreamNum Co., Ltd.
628
639
  *
@@ -638,97 +649,382 @@ function __decorate(decorators, target, key, desc) {
638
649
  * See the License for the specific language governing permissions and
639
650
  * limitations under the License.
640
651
  */
641
- let ComponentsController = class ComponentsController extends Disposable {
642
- constructor(_componentManager, _iconManager) {
643
- super();
644
- this._componentManager = _componentManager;
645
- this._iconManager = _iconManager;
646
- this._registerComponents();
647
- this._registerIcons();
648
- }
649
- _registerComponents() {
650
- [[COMPONENT_IMAGE_POPUP_MENU, ImagePopupMenu]].forEach(([key, component]) => {
651
- this.disposeWithMe(this._componentManager.register(key, component));
652
- });
653
- }
654
- _registerIcons() {
655
- this.disposeWithMe(this._iconManager.register({
656
- BottomIcon,
657
- GroupIcon,
658
- MoveDownIcon,
659
- MoveUpIcon,
660
- TopmostIcon,
661
- UngroupIcon
662
- }));
663
- }
664
- };
665
- ComponentsController = __decorate([__decorateParam(0, Inject(ComponentManager)), __decorateParam(1, Inject(IconManager))], ComponentsController);
666
-
667
- //#endregion
668
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
669
- function _typeof(o) {
670
- "@babel/helpers - typeof";
671
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
672
- return typeof o;
673
- } : function(o) {
674
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
675
- }, _typeof(o);
676
- }
677
-
678
- //#endregion
679
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
680
- function toPrimitive(t, r) {
681
- if ("object" != _typeof(t) || !t) return t;
682
- var e = t[Symbol.toPrimitive];
683
- if (void 0 !== e) {
684
- var i = e.call(t, r || "default");
685
- if ("object" != _typeof(i)) return i;
686
- throw new TypeError("@@toPrimitive must return a primitive value.");
687
- }
688
- return ("string" === r ? String : Number)(t);
689
- }
652
+ const COMPONENT_IMAGE_POPUP_MENU = "COMPONENT_IMAGE_POPUP_MENU";
690
653
 
691
654
  //#endregion
692
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
693
- function toPropertyKey(t) {
694
- var i = toPrimitive(t, "string");
695
- return "symbol" == _typeof(i) ? i : i + "";
655
+ //#region src/views/image-popup-menu/ImagePopupMenu.tsx
656
+ function ImagePopupMenu(props) {
657
+ var _popup$extraProps, _popup$extraProps2, _popup$extraProps3;
658
+ const { popup } = props;
659
+ const menuItems = popup === null || popup === void 0 || (_popup$extraProps = popup.extraProps) === null || _popup$extraProps === void 0 ? void 0 : _popup$extraProps.menuItems;
660
+ const commandService = useDependency(ICommandService);
661
+ const localeService = useDependency(LocaleService);
662
+ const [visible, setVisible] = useState(false);
663
+ const [isHovered, setIsHovered] = useState(false);
664
+ if (!menuItems) return null;
665
+ if (((_popup$extraProps2 = popup.extraProps) === null || _popup$extraProps2 === void 0 ? void 0 : _popup$extraProps2.variant) === "doc-floating-toolbar" && popup.extraProps.unitId && popup.extraProps.subUnitId && popup.extraProps.drawingId) return /* @__PURE__ */ jsx(DocImageFloatingToolbar, {
666
+ menuItems,
667
+ unitId: popup.extraProps.unitId,
668
+ subUnitId: popup.extraProps.subUnitId,
669
+ drawingId: popup.extraProps.drawingId
670
+ });
671
+ if (((_popup$extraProps3 = popup.extraProps) === null || _popup$extraProps3 === void 0 ? void 0 : _popup$extraProps3.variant) === "doc-chart-floating-toolbar") return /* @__PURE__ */ jsx(DocChartFloatingToolbar, { menuItems });
672
+ const handleMouseEnter = () => {
673
+ setIsHovered(true);
674
+ };
675
+ const handleMouseLeave = () => {
676
+ setIsHovered(false);
677
+ };
678
+ const onVisibleChange = (visible) => {
679
+ setVisible(visible);
680
+ };
681
+ const handleClick = (item) => {
682
+ commandService.executeCommand(item.commandId, item.commandParams);
683
+ setVisible(false);
684
+ };
685
+ const showMore = visible || isHovered;
686
+ return /* @__PURE__ */ jsx("div", {
687
+ onMouseEnter: handleMouseEnter,
688
+ onMouseLeave: handleMouseLeave,
689
+ children: /* @__PURE__ */ jsx(DropdownMenu, {
690
+ align: "start",
691
+ items: menuItems.map((item) => ({
692
+ type: "item",
693
+ children: localeService.t(item.label),
694
+ disabled: item.disable,
695
+ onSelect: () => handleClick(item)
696
+ })),
697
+ open: visible,
698
+ onOpenChange: onVisibleChange,
699
+ children: /* @__PURE__ */ jsxs("div", {
700
+ className: clsx("univer-flex univer-items-center univer-gap-2 univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-800", borderClassName, {
701
+ "univer-bg-gray-100 dark:!univer-bg-gray-800": visible,
702
+ "univer-bg-white dark:!univer-bg-gray-900": !visible
703
+ }),
704
+ children: [/* @__PURE__ */ jsx(AutofillDoubleIcon, { className: "univer-fill-primary-600 univer-text-gray-900 dark:!univer-text-white" }), showMore && /* @__PURE__ */ jsx(MoreDownIcon, { className: "dark:!univer-text-white" })]
705
+ })
706
+ })
707
+ });
708
+ }
709
+ const UPDATE_DOC_DRAWING_WRAPPING_STYLE_COMMAND_ID = "doc.command.update-doc-drawing-wrapping-style";
710
+ function getWrappingStyle(documentDataModel, drawingId) {
711
+ var _documentDataModel$ge;
712
+ const drawing = documentDataModel === null || documentDataModel === void 0 || (_documentDataModel$ge = documentDataModel.getSnapshot().drawings) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge[drawingId];
713
+ if (!drawing) return "inline";
714
+ if (drawing.layoutType === PositionedObjectLayoutType.WRAP_NONE) return drawing.behindDoc === BooleanNumber.TRUE ? "behindText" : "inFrontOfText";
715
+ if (drawing.layoutType === PositionedObjectLayoutType.WRAP_SQUARE) return "wrapSquare";
716
+ if (drawing.layoutType === PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM) return "wrapTopAndBottom";
717
+ return "inline";
718
+ }
719
+ function ToolbarGroup(props) {
720
+ return /* @__PURE__ */ jsx("div", {
721
+ className: "univer-flex univer-h-7 univer-items-center univer-gap-1 univer-px-1",
722
+ children: props.children
723
+ });
724
+ }
725
+ function ToolbarButton(props) {
726
+ return /* @__PURE__ */ jsx(Tooltip, {
727
+ title: useDependency(LocaleService).t(props.titleKey),
728
+ placement: "bottom",
729
+ children: /* @__PURE__ */ jsx("button", {
730
+ type: "button",
731
+ disabled: props.disabled,
732
+ onClick: props.onClick,
733
+ className: clsx("univer-flex univer-h-6 univer-w-6 univer-items-center univer-justify-center univer-rounded-md univer-border-none univer-bg-transparent univer-p-0 univer-text-sm univer-text-gray-700 univer-transition-colors hover:univer-bg-gray-100 disabled:univer-cursor-not-allowed disabled:univer-opacity-40 dark:!univer-text-gray-100 dark:hover:!univer-bg-gray-700", { "univer-bg-gray-100 univer-text-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-primary-300": props.active }),
734
+ children: props.children
735
+ })
736
+ });
737
+ }
738
+ function ToolbarDropdownButton(props) {
739
+ var _props$options$find;
740
+ const [open, setOpen] = useState(false);
741
+ const activeOption = (_props$options$find = props.options.find((option) => option.value === props.value)) !== null && _props$options$find !== void 0 ? _props$options$find : props.options[0];
742
+ return /* @__PURE__ */ jsx(Dropdown, {
743
+ open,
744
+ onOpenChange: setOpen,
745
+ overlay: /* @__PURE__ */ jsx("div", {
746
+ className: "univer-min-w-32 univer-rounded-lg univer-border univer-border-solid univer-border-gray-200 univer-bg-white univer-p-1 univer-shadow-lg dark:!univer-border-gray-700 dark:!univer-bg-gray-900",
747
+ children: props.options.map((option) => /* @__PURE__ */ jsxs("button", {
748
+ type: "button",
749
+ onClick: () => {
750
+ props.onChange(option.value);
751
+ setOpen(false);
752
+ },
753
+ className: clsx("univer-flex univer-h-8 univer-w-full univer-items-center univer-gap-2 univer-rounded-md univer-border-none univer-bg-transparent univer-px-2 univer-text-left univer-text-sm univer-text-gray-700 univer-transition-colors hover:univer-bg-gray-100 dark:!univer-text-gray-100 dark:hover:!univer-bg-gray-800", { "univer-bg-primary-50 univer-text-primary-600 dark:!univer-bg-gray-800 dark:!univer-text-primary-300": option.value === props.value }),
754
+ children: [/* @__PURE__ */ jsx("span", {
755
+ className: "univer-flex univer-size-4 univer-items-center univer-justify-center",
756
+ children: option.icon
757
+ }), /* @__PURE__ */ jsx("span", {
758
+ className: "univer-flex-1",
759
+ children: option.label
760
+ })]
761
+ }, option.value))
762
+ }),
763
+ children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Tooltip, {
764
+ title: props.title,
765
+ placement: "bottom",
766
+ children: /* @__PURE__ */ jsxs("button", {
767
+ type: "button",
768
+ className: clsx("univer-flex univer-h-6 univer-min-w-9 univer-items-center univer-justify-center univer-gap-1 univer-rounded-md univer-border-none univer-bg-transparent univer-px-1.5 univer-text-sm univer-text-gray-700 univer-transition-colors hover:univer-bg-gray-100 dark:!univer-text-gray-100 dark:hover:!univer-bg-gray-700", { "univer-bg-gray-100 univer-text-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-primary-300": open }),
769
+ children: [activeOption.icon, /* @__PURE__ */ jsx(MoreDownIcon, { className: "univer-text-xs" })]
770
+ })
771
+ }) })
772
+ });
773
+ }
774
+ function DocImageFloatingToolbar(props) {
775
+ var _univerInstanceServic, _wrappingStyleOptions, _wrappingStyleOptions2;
776
+ const commandService = useDependency(ICommandService);
777
+ const iconManager = useDependency(IconManager);
778
+ const localeService = useDependency(LocaleService);
779
+ const documentDataModel = (_univerInstanceServic = useDependency(IUniverInstanceService).getUnit(props.unitId, UniverInstanceType.UNIVER_DOC)) !== null && _univerInstanceServic !== void 0 ? _univerInstanceServic : void 0;
780
+ const [wrappingStyle, setWrappingStyle] = useState(() => getWrappingStyle(documentDataModel, props.drawingId));
781
+ const [hidden, setHidden] = useState(false);
782
+ const actionItems = props.menuItems.filter((item) => item.type !== "select" && item.icon).sort((a, b) => a.index - b.index);
783
+ const wrappingStyleOptions = [
784
+ {
785
+ label: localeService.t("drawing-ui.image-text-wrap.inline"),
786
+ value: "inline",
787
+ icon: /* @__PURE__ */ jsx(TextWrapShapeIcon, {})
788
+ },
789
+ {
790
+ label: localeService.t("drawing-ui.image-text-wrap.square"),
791
+ value: "wrapSquare",
792
+ icon: /* @__PURE__ */ jsx(TextWrapShapeIcon, {})
793
+ },
794
+ {
795
+ label: localeService.t("drawing-ui.image-text-wrap.topAndBottom"),
796
+ value: "wrapTopAndBottom",
797
+ icon: /* @__PURE__ */ jsx(TextWrapShapeIcon, {})
798
+ },
799
+ {
800
+ label: localeService.t("drawing-ui.image-text-wrap.behindText"),
801
+ value: "behindText",
802
+ icon: /* @__PURE__ */ jsx(TextWrapShapeIcon, {})
803
+ },
804
+ {
805
+ label: localeService.t("drawing-ui.image-text-wrap.inFrontText"),
806
+ value: "inFrontOfText",
807
+ icon: /* @__PURE__ */ jsx(TextWrapShapeIcon, {})
808
+ }
809
+ ];
810
+ const executeMenuItem = (item) => {
811
+ if (!item || item.disable) return;
812
+ if (item.hideOnClick) setHidden(true);
813
+ commandService.executeCommand(item.commandId, item.commandParams);
814
+ };
815
+ const updateWrappingStyle = (value) => {
816
+ setWrappingStyle(value);
817
+ commandService.executeCommand(UPDATE_DOC_DRAWING_WRAPPING_STYLE_COMMAND_ID, {
818
+ unitId: props.unitId,
819
+ subUnitId: props.subUnitId,
820
+ drawings: [{
821
+ unitId: props.unitId,
822
+ subUnitId: props.subUnitId,
823
+ drawingId: props.drawingId
824
+ }],
825
+ wrappingStyle: value
826
+ });
827
+ };
828
+ if (hidden) return null;
829
+ return /* @__PURE__ */ jsxs("div", {
830
+ "data-u-comp": "doc-image-floating-toolbar",
831
+ onMouseDown: (event) => {
832
+ event.stopPropagation();
833
+ event.preventDefault();
834
+ },
835
+ className: clsx("univer-box-border univer-flex univer-items-center univer-rounded univer-bg-white univer-px-1 univer-py-1 univer-shadow-sm dark:!univer-border-gray-700 dark:!univer-bg-gray-900", borderClassName),
836
+ children: [/* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(ToolbarDropdownButton, {
837
+ title: (_wrappingStyleOptions = (_wrappingStyleOptions2 = wrappingStyleOptions.find((option) => option.value === wrappingStyle)) === null || _wrappingStyleOptions2 === void 0 ? void 0 : _wrappingStyleOptions2.label) !== null && _wrappingStyleOptions !== void 0 ? _wrappingStyleOptions : localeService.t("drawing-ui.image-text-wrap.inline"),
838
+ value: wrappingStyle,
839
+ options: wrappingStyleOptions,
840
+ onChange: updateWrappingStyle
841
+ }) }), actionItems.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Separator, { orientation: "vertical" }), /* @__PURE__ */ jsx(ToolbarGroup, { children: actionItems.map((item) => {
842
+ const Icon = iconManager.get(item.icon);
843
+ return /* @__PURE__ */ jsx(ToolbarButton, {
844
+ titleKey: item.label,
845
+ disabled: item.disable,
846
+ onClick: () => executeMenuItem(item),
847
+ children: /* @__PURE__ */ jsx(Icon, {})
848
+ }, `${item.commandId}-${item.index}`);
849
+ }) })] })]
850
+ });
851
+ }
852
+ function DocChartFloatingToolbar(props) {
853
+ var _chartTypeItem$option, _ref, _chartTypeItem$value, _chartTypeOptions$;
854
+ const commandService = useDependency(ICommandService);
855
+ const iconManager = useDependency(IconManager);
856
+ const localeService = useDependency(LocaleService);
857
+ const [hidden, setHidden] = useState(false);
858
+ const chartTypeItem = props.menuItems.find((item) => item.type === "select");
859
+ const actionItems = props.menuItems.filter((item) => item.type !== "select" && item.icon).sort((a, b) => a.index - b.index);
860
+ const chartTypeOptions = ((_chartTypeItem$option = chartTypeItem === null || chartTypeItem === void 0 ? void 0 : chartTypeItem.options) !== null && _chartTypeItem$option !== void 0 ? _chartTypeItem$option : []).map((option) => ({
861
+ label: String(option.label),
862
+ value: option.value,
863
+ icon: /* @__PURE__ */ jsx(ChartIcon, {})
864
+ }));
865
+ const executeMenuItem = (item) => {
866
+ if (!item || item.disable) return;
867
+ if (item.hideOnClick) setHidden(true);
868
+ commandService.executeCommand(item.commandId, item.commandParams);
869
+ };
870
+ if (hidden) return null;
871
+ return /* @__PURE__ */ jsxs("div", {
872
+ "data-u-comp": "doc-chart-floating-toolbar",
873
+ onMouseDown: (event) => {
874
+ event.stopPropagation();
875
+ event.preventDefault();
876
+ },
877
+ className: clsx("univer-box-border univer-flex univer-items-center univer-rounded univer-bg-white univer-px-1 univer-py-1 univer-shadow-sm dark:!univer-border-gray-700 dark:!univer-bg-gray-900", borderClassName),
878
+ children: [chartTypeItem && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(ToolbarDropdownButton, {
879
+ title: localeService.t(chartTypeItem.label),
880
+ value: (_ref = (_chartTypeItem$value = chartTypeItem.value) !== null && _chartTypeItem$value !== void 0 ? _chartTypeItem$value : (_chartTypeOptions$ = chartTypeOptions[0]) === null || _chartTypeOptions$ === void 0 ? void 0 : _chartTypeOptions$.value) !== null && _ref !== void 0 ? _ref : "",
881
+ options: chartTypeOptions,
882
+ onChange: (value) => {
883
+ if (!chartTypeItem.disable) {
884
+ var _chartTypeItem$comman;
885
+ commandService.executeCommand(chartTypeItem.commandId, (_chartTypeItem$comman = chartTypeItem.commandParamsFactory) === null || _chartTypeItem$comman === void 0 ? void 0 : _chartTypeItem$comman.call(chartTypeItem, value));
886
+ }
887
+ }
888
+ }) }), actionItems.length > 0 && /* @__PURE__ */ jsx(Separator, { orientation: "vertical" })] }), actionItems.length > 0 && /* @__PURE__ */ jsx(ToolbarGroup, { children: actionItems.map((item) => {
889
+ const Icon = iconManager.get(item.icon);
890
+ return /* @__PURE__ */ jsx(ToolbarButton, {
891
+ titleKey: item.label,
892
+ disabled: item.disable,
893
+ onClick: () => executeMenuItem(item),
894
+ children: /* @__PURE__ */ jsx(Icon, {})
895
+ }, `${item.commandId}-${item.index}`);
896
+ }) })]
897
+ });
696
898
  }
697
899
 
698
900
  //#endregion
699
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
700
- function _defineProperty(e, r, t) {
701
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
702
- value: t,
703
- enumerable: !0,
704
- configurable: !0,
705
- writable: !0
706
- }) : e[r] = t, e;
901
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
902
+ function __decorateParam(paramIndex, decorator) {
903
+ return function(target, key) {
904
+ decorator(target, key, paramIndex);
905
+ };
707
906
  }
708
907
 
709
908
  //#endregion
710
- //#region src/services/drawing-image-clip.service.ts
711
- const IMAGE_CLIP_SHAPE_PICKER_COMPONENT = "sheet.image-clip.shape.picker.component";
909
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
910
+ function __decorate(decorators, target, key, desc) {
911
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
912
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
913
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
914
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
915
+ }
916
+
917
+ //#endregion
918
+ //#region src/controllers/components.controller.ts
712
919
  /**
713
- * Bridge service that enables shape-based image clipping.
714
- * This service lives in the open-source drawing-ui package and delegates
715
- * to a registered clip implementation (provided by pro engine-shape package).
920
+ * Copyright 2023-present DreamNum Co., Ltd.
716
921
  *
717
- * When no delegate is registered, applyShapeClip returns false and images render normally without shape clipping.
922
+ * Licensed under the Apache License, Version 2.0 (the "License");
923
+ * you may not use this file except in compliance with the License.
924
+ * You may obtain a copy of the License at
925
+ *
926
+ * http://www.apache.org/licenses/LICENSE-2.0
927
+ *
928
+ * Unless required by applicable law or agreed to in writing, software
929
+ * distributed under the License is distributed on an "AS IS" BASIS,
930
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
931
+ * See the License for the specific language governing permissions and
932
+ * limitations under the License.
718
933
  */
719
- var DrawingImageClipService = class extends Disposable {
720
- constructor() {
934
+ let ComponentsController = class ComponentsController extends Disposable {
935
+ constructor(_componentManager, _iconManager) {
721
936
  super();
722
- _defineProperty(this, "_clipDelegate", null);
723
- _defineProperty(this, "_canUseShapeClip$", new BehaviorSubject(false));
724
- _defineProperty(this, "canUseShapeClip$", this._canUseShapeClip$.asObservable());
937
+ this._componentManager = _componentManager;
938
+ this._iconManager = _iconManager;
939
+ this._registerComponents();
940
+ this._registerIcons();
725
941
  }
726
- setCanUseShapeClip(canUse) {
727
- this._canUseShapeClip$.next(canUse);
942
+ _registerComponents() {
943
+ [[COMPONENT_IMAGE_POPUP_MENU, ImagePopupMenu]].forEach(([key, component]) => {
944
+ this.disposeWithMe(this._componentManager.register(key, component));
945
+ });
728
946
  }
729
- /**
730
- * Register a clip delegate that knows how to build shape clip paths.
731
- * Typically called by the pro-side plugin with a ShapeModel-based implementation.
947
+ _registerIcons() {
948
+ this.disposeWithMe(this._iconManager.register({
949
+ BottomIcon,
950
+ DrawingCropIcon: CropIcon,
951
+ DrawingDeleteIcon: DeleteIcon,
952
+ DrawingEditIcon: DocSettingIcon,
953
+ GroupIcon,
954
+ MoveDownIcon,
955
+ MoveUpIcon,
956
+ TopmostIcon,
957
+ UngroupIcon
958
+ }));
959
+ }
960
+ };
961
+ ComponentsController = __decorate([__decorateParam(0, Inject(ComponentManager)), __decorateParam(1, Inject(IconManager))], ComponentsController);
962
+
963
+ //#endregion
964
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
965
+ function _typeof(o) {
966
+ "@babel/helpers - typeof";
967
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
968
+ return typeof o;
969
+ } : function(o) {
970
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
971
+ }, _typeof(o);
972
+ }
973
+
974
+ //#endregion
975
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
976
+ function toPrimitive(t, r) {
977
+ if ("object" != _typeof(t) || !t) return t;
978
+ var e = t[Symbol.toPrimitive];
979
+ if (void 0 !== e) {
980
+ var i = e.call(t, r || "default");
981
+ if ("object" != _typeof(i)) return i;
982
+ throw new TypeError("@@toPrimitive must return a primitive value.");
983
+ }
984
+ return ("string" === r ? String : Number)(t);
985
+ }
986
+
987
+ //#endregion
988
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
989
+ function toPropertyKey(t) {
990
+ var i = toPrimitive(t, "string");
991
+ return "symbol" == _typeof(i) ? i : i + "";
992
+ }
993
+
994
+ //#endregion
995
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
996
+ function _defineProperty(e, r, t) {
997
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
998
+ value: t,
999
+ enumerable: !0,
1000
+ configurable: !0,
1001
+ writable: !0
1002
+ }) : e[r] = t, e;
1003
+ }
1004
+
1005
+ //#endregion
1006
+ //#region src/services/drawing-image-clip.service.ts
1007
+ const IMAGE_CLIP_SHAPE_PICKER_COMPONENT = "sheet.image-clip.shape.picker.component";
1008
+ /**
1009
+ * Bridge service that enables shape-based image clipping.
1010
+ * This service lives in the open-source drawing-ui package and delegates
1011
+ * to a registered clip implementation (provided by pro engine-shape package).
1012
+ *
1013
+ * When no delegate is registered, applyShapeClip returns false and images render normally without shape clipping.
1014
+ */
1015
+ var DrawingImageClipService = class extends Disposable {
1016
+ constructor() {
1017
+ super();
1018
+ _defineProperty(this, "_clipDelegate", null);
1019
+ _defineProperty(this, "_canUseShapeClip$", new BehaviorSubject(false));
1020
+ _defineProperty(this, "canUseShapeClip$", this._canUseShapeClip$.asObservable());
1021
+ }
1022
+ setCanUseShapeClip(canUse) {
1023
+ this._canUseShapeClip$.next(canUse);
1024
+ }
1025
+ /**
1026
+ * Register a clip delegate that knows how to build shape clip paths.
1027
+ * Typically called by the pro-side plugin with a ShapeModel-based implementation.
732
1028
  * @returns IDisposable to unregister the delegate
733
1029
  */
734
1030
  registerClipDelegate(delegate) {
@@ -752,7 +1048,7 @@ var DrawingImageClipService = class extends Disposable {
752
1048
  //#region src/services/drawing-render.service.ts
753
1049
  const DOC_DRAWING_BEHIND_TEXT_LAYER_INDEX = 1;
754
1050
  function getDrawingRenderLayerIndex(param) {
755
- return param.behindText === true || param.behindText === BooleanNumber.TRUE ? 1 : DRAWING_OBJECT_LAYER_INDEX;
1051
+ return param.behindText === true || param.behindText === BooleanNumber.TRUE || param.layoutType === PositionedObjectLayoutType.WRAP_NONE && param.behindDoc === BooleanNumber.TRUE ? 1 : DRAWING_OBJECT_LAYER_INDEX;
756
1052
  }
757
1053
  function ensureDrawingRenderLayer(scene, object, param) {
758
1054
  const layerIndex = getDrawingRenderLayerIndex(param);
@@ -772,12 +1068,12 @@ let DrawingRenderService = class DrawingRenderService {
772
1068
  this._univerInstanceService = _univerInstanceService;
773
1069
  this._drawingImageClipService = _drawingImageClipService;
774
1070
  }
775
- async renderImages(imageParam, scene) {
1071
+ async renderImages(imageParam, scene, options) {
776
1072
  const { transform: singleTransform, drawingType, source, imageSourceType, srcRect, prstGeom, groupId, unitId, subUnitId, drawingId, isMultiTransform, transforms: multiTransforms, adjustValues, hidden } = imageParam;
777
1073
  const { docxHeaderFooterDrawing, layoutType } = imageParam;
778
1074
  if (drawingType !== DrawingTypeEnum.DRAWING_IMAGE) return;
779
1075
  if (!this._drawingManagerService.getDrawingVisible()) return;
780
- if (this._univerInstanceService.getUnitType(unitId) === UniverInstanceType.UNIVER_SHEET && subUnitId !== this._getActiveSheetId()) return;
1076
+ if (!(options === null || options === void 0 ? void 0 : options.allowInactiveSheet) && this._univerInstanceService.getUnitType(unitId) === UniverInstanceType.UNIVER_SHEET && subUnitId !== this._getActiveSheetId()) return;
781
1077
  if (singleTransform == null) return;
782
1078
  const transforms = isMultiTransform && multiTransforms ? multiTransforms : [singleTransform];
783
1079
  const images = [];
@@ -817,13 +1113,13 @@ let DrawingRenderService = class DrawingRenderService {
817
1113
  const imageNativeCache = this._imageIoService.getImageSourceCache(source, imageSourceType);
818
1114
  let shouldBeCache = false;
819
1115
  if (isRenderableImageCache(imageNativeCache)) imageConfig.image = imageNativeCache;
820
- else if (imageSourceType === ImageSourceType$1.UUID) try {
1116
+ else if (imageSourceType === ImageSourceType.UUID) try {
821
1117
  imageConfig.url = await this._imageIoService.getImage(source);
822
1118
  } catch (error) {
823
1119
  console.error(error);
824
1120
  continue;
825
1121
  }
826
- else if (imageSourceType === ImageSourceType$1.URL) {
1122
+ else if (imageSourceType === ImageSourceType.URL) {
827
1123
  try {
828
1124
  imageConfig.url = await this._urlImageService.getImage(source);
829
1125
  } catch (error) {
@@ -911,11 +1207,11 @@ let DrawingRenderService = class DrawingRenderService {
911
1207
  }
912
1208
  return rects;
913
1209
  }
914
- renderDrawing(param, scene) {
1210
+ renderDrawing(param, scene, options) {
915
1211
  const drawingParam = this._drawingManagerService.getDrawingByParam(param);
916
1212
  if (drawingParam == null) return;
917
1213
  switch (drawingParam.drawingType) {
918
- case DrawingTypeEnum.DRAWING_IMAGE: return this.renderImages(drawingParam, scene);
1214
+ case DrawingTypeEnum.DRAWING_IMAGE: return this.renderImages(drawingParam, scene, options);
919
1215
  default:
920
1216
  }
921
1217
  }
@@ -984,12 +1280,24 @@ function getUpdateParams(objects, drawingManagerService) {
984
1280
  //#endregion
985
1281
  //#region src/controllers/drawing-update.controller.ts
986
1282
  function hasRefreshMetadata(refreshParam) {
987
- return "hidden" in refreshParam || "behindText" in refreshParam;
1283
+ return "hidden" in refreshParam || "behindText" in refreshParam || "selectable" in refreshParam;
988
1284
  }
989
1285
  function syncDrawingHiddenState(shape, drawingParam) {
990
1286
  if (!("hidden" in drawingParam)) return;
991
1287
  drawingParam.hidden === true ? shape.hide() : shape.show();
992
1288
  }
1289
+ function syncDrawingSelectableState(shape, drawingParam, scene, drawingManagerService) {
1290
+ var _scene$getTransformer;
1291
+ const previousDrawing = drawingManagerService.getOldDrawingByParam(drawingParam);
1292
+ if (!("selectable" in drawingParam) && (!previousDrawing || !("selectable" in previousDrawing))) return;
1293
+ const selectable = drawingParam.selectable !== false;
1294
+ shape.evented = selectable;
1295
+ if (selectable) return;
1296
+ (_scene$getTransformer = scene.getTransformer()) === null || _scene$getTransformer === void 0 || _scene$getTransformer.clearControlByIds([shape.oKey]);
1297
+ const focusedDrawings = drawingManagerService.getFocusDrawings();
1298
+ const remainingDrawings = focusedDrawings.filter(({ unitId, subUnitId, drawingId }) => unitId !== drawingParam.unitId || subUnitId !== drawingParam.subUnitId || drawingId !== drawingParam.drawingId);
1299
+ if (remainingDrawings.length !== focusedDrawings.length) drawingManagerService.focusDrawing(remainingDrawings);
1300
+ }
993
1301
  function mergeRefreshMetadata(drawingParam, refreshParam) {
994
1302
  if (!hasRefreshMetadata(refreshParam)) return drawingParam;
995
1303
  return {
@@ -1319,8 +1627,8 @@ let DrawingUpdateController = class DrawingUpdateController extends Disposable {
1319
1627
  subUnitId,
1320
1628
  drawingId
1321
1629
  })) {
1322
- var _scene$getTransformer;
1323
- (_scene$getTransformer = scene.getTransformer()) === null || _scene$getTransformer === void 0 || _scene$getTransformer.clearSelectedObjects();
1630
+ var _scene$getTransformer2;
1631
+ (_scene$getTransformer2 = scene.getTransformer()) === null || _scene$getTransformer2 === void 0 || _scene$getTransformer2.clearSelectedObjects();
1324
1632
  }
1325
1633
  });
1326
1634
  }));
@@ -1328,7 +1636,7 @@ let DrawingUpdateController = class DrawingUpdateController extends Disposable {
1328
1636
  _drawingUpdateListener() {
1329
1637
  this.disposeWithMe(this._drawingManagerService.update$.subscribe((params) => {
1330
1638
  params.forEach((param) => {
1331
- var _setClipBounds, _scene$getTransformer2;
1639
+ var _setClipBounds, _scene$getTransformer3;
1332
1640
  const { unitId, subUnitId, drawingId } = param;
1333
1641
  const drawingParam = this._drawingManagerService.getDrawingByParam(param);
1334
1642
  if (drawingParam == null) return;
@@ -1343,7 +1651,7 @@ let DrawingUpdateController = class DrawingUpdateController extends Disposable {
1343
1651
  subUnitId,
1344
1652
  drawingId
1345
1653
  });
1346
- const drawingShape = scene.getObject(drawingShapeKey);
1654
+ const drawingShape = scene.getObjectIncludeInGroup(drawingShapeKey);
1347
1655
  if (drawingShape == null) return true;
1348
1656
  drawingShape.transformByState({
1349
1657
  left,
@@ -1358,8 +1666,9 @@ let DrawingUpdateController = class DrawingUpdateController extends Disposable {
1358
1666
  });
1359
1667
  (_setClipBounds = drawingShape.setClipBounds) === null || _setClipBounds === void 0 || _setClipBounds.call(drawingShape, transform.clipBounds);
1360
1668
  syncDrawingHiddenState(drawingShape, drawingParam);
1669
+ syncDrawingSelectableState(drawingShape, drawingParam, scene, this._drawingManagerService);
1361
1670
  ensureDrawingRenderLayer(scene, drawingShape, drawingParam);
1362
- (_scene$getTransformer2 = scene.getTransformer()) === null || _scene$getTransformer2 === void 0 || _scene$getTransformer2.debounceRefreshControls();
1671
+ (_scene$getTransformer3 = scene.getTransformer()) === null || _scene$getTransformer3 === void 0 || _scene$getTransformer3.debounceRefreshControls();
1363
1672
  });
1364
1673
  }));
1365
1674
  }
@@ -1405,6 +1714,7 @@ let DrawingUpdateController = class DrawingUpdateController extends Disposable {
1405
1714
  });
1406
1715
  (_setClipBounds2 = drawingShape.setClipBounds) === null || _setClipBounds2 === void 0 || _setClipBounds2.call(drawingShape, transform.clipBounds);
1407
1716
  syncDrawingHiddenState(drawingShape, drawingParamWithRefreshMetadata);
1717
+ syncDrawingSelectableState(drawingShape, drawingParamWithRefreshMetadata, scene, this._drawingManagerService);
1408
1718
  ensureDrawingRenderLayer(scene, drawingShape, drawingParamWithRefreshMetadata);
1409
1719
  });
1410
1720
  }));
@@ -1421,7 +1731,7 @@ let DrawingUpdateController = class DrawingUpdateController extends Disposable {
1421
1731
  subUnitId,
1422
1732
  drawingId
1423
1733
  });
1424
- const drawingShape = scene.getObject(drawingShapeKey);
1734
+ const drawingShape = scene.getObjectIncludeInGroup(drawingShapeKey);
1425
1735
  if (drawingShape == null) return true;
1426
1736
  if (visible) drawingShape.show();
1427
1737
  else drawingShape.hide();
@@ -1980,402 +2290,141 @@ let ImageUpdateController = class ImageUpdateController extends Disposable {
1980
2290
  this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
1981
2291
  if (command.id === ImageResetSizeOperation.id) {
1982
2292
  const params = command.params;
1983
- if (params == null) return;
1984
- this._resetImageSize(params);
1985
- }
1986
- }));
1987
- }
1988
- _getSceneAndTransformerByDrawingSearch(unitId) {
1989
- if (unitId == null) return;
1990
- const renderObject = this._renderManagerService.getRenderById(unitId);
1991
- const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
1992
- if (scene == null) return null;
1993
- return {
1994
- scene,
1995
- transformer: scene.getTransformerByCreate()
1996
- };
1997
- }
1998
- _resetImageSize(params) {
1999
- const updateParams = [];
2000
- const sceneList = [];
2001
- params.forEach((param) => {
2002
- const { unitId, subUnitId, drawingId } = param;
2003
- const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
2004
- if (renderObject == null) return;
2005
- const { scene } = renderObject;
2006
- const imageShapeKey = getDrawingShapeKeyByDrawingSearch({
2007
- unitId,
2008
- subUnitId,
2009
- drawingId
2010
- });
2011
- const imageShape = scene.getObject(imageShapeKey);
2012
- if (imageShape == null) return true;
2013
- const imageData = this._drawingManagerService.getDrawingByParam(param);
2014
- if (imageData == null) return true;
2015
- if (imageData.drawingType !== DrawingTypeEnum.DRAWING_IMAGE) return;
2016
- imageShape.resetSize();
2017
- const { width, height } = imageShape.getNativeSize();
2018
- if (sceneList.includes(scene) === false) sceneList.push(scene);
2019
- updateParams.push({
2020
- ...imageData,
2021
- transform: {
2022
- ...imageData.transform,
2023
- height,
2024
- width,
2025
- angle: 0
2026
- },
2027
- srcRect: null,
2028
- prstGeom: null
2029
- });
2030
- });
2031
- this._drawingManagerService.featurePluginUpdateNotification(updateParams);
2032
- sceneList.forEach((scene) => {
2033
- scene.getTransformerByCreate().refreshControls().changeNotification();
2034
- });
2035
- this._commandService.syncExecuteCommand(SetDrawingSelectedOperation.id, params);
2036
- }
2037
- _drawingAddListener() {
2038
- this.disposeWithMe(this._drawingManagerService.add$.pipe(bufferTime(33), filter((batches) => batches.length > 0), map((batches) => batches.flat()), map((items) => {
2039
- const map = /* @__PURE__ */ new Map();
2040
- for (const it of items) map.set(`${it.unitId}|${it.subUnitId}|${it.drawingId}`, it);
2041
- return [...map.values()];
2042
- }), filter((items) => items.length > 0)).subscribe((uniqueParams) => {
2043
- this._insertImages(uniqueParams);
2044
- }));
2045
- }
2046
- _insertImages(params) {
2047
- params.forEach(async (param) => {
2048
- var _getCurrentUnitInfo;
2049
- const { unitId, subUnitId } = param;
2050
- const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
2051
- const currentSubUnitId = (_getCurrentUnitInfo = getCurrentUnitInfo(this._currentUniverService, unitId)) === null || _getCurrentUnitInfo === void 0 ? void 0 : _getCurrentUnitInfo.subUnitId;
2052
- if (renderObject == null || currentSubUnitId !== subUnitId) return;
2053
- const imageParam = this._drawingManagerService.getDrawingByParam(param);
2054
- if (imageParam == null) return;
2055
- const images = await this._drawingRenderService.renderImages(imageParam, renderObject.scene);
2056
- this._drawingManagerService.refreshTransform([imageParam]);
2057
- if (images == null || images.length === 0) return;
2058
- for (const image of images) {
2059
- this._addHoverForImage(image);
2060
- this._addDialogForImage(image);
2061
- }
2062
- });
2063
- }
2064
- _imageUpdateListener() {
2065
- this.disposeWithMe(this._drawingManagerService.update$.subscribe((params) => {
2066
- params.forEach((param) => {
2067
- var _setClipBounds;
2068
- const { unitId, subUnitId, drawingId } = param;
2069
- const drawingParam = this._drawingManagerService.getDrawingByParam(param);
2070
- if (drawingParam == null) return;
2071
- const { transform, drawingType, srcRect, prstGeom, source, imageSourceType } = drawingParam;
2072
- if (drawingType !== DrawingTypeEnum.DRAWING_IMAGE) return;
2073
- const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
2074
- if (renderObject == null) return;
2075
- const { scene, transformer } = renderObject;
2076
- if (transform == null) return true;
2077
- const drawingShapeKey = getDrawingShapeKeyByDrawingSearch({
2078
- unitId,
2079
- subUnitId,
2080
- drawingId
2081
- });
2082
- const imageShape = scene.getObject(drawingShapeKey);
2083
- if (imageShape == null) return true;
2084
- imageShape.transformByState(transform);
2085
- (_setClipBounds = imageShape.setClipBounds) === null || _setClipBounds === void 0 || _setClipBounds.call(imageShape, transform.clipBounds);
2086
- ensureDrawingRenderLayer(scene, imageShape, drawingParam);
2087
- imageShape.setSrcRect(srcRect);
2088
- imageShape.setPrstGeom(prstGeom);
2089
- if (source != null && source.length > 0 && (imageSourceType === ImageSourceType.BASE64 || imageSourceType === ImageSourceType.URL)) imageShape.changeSource(source);
2090
- });
2091
- }));
2092
- }
2093
- _addHoverForImage(o) {
2094
- this.disposeWithMe(toDisposable(o.onPointerEnter$.subscribeEvent(() => {
2095
- o.cursor = CURSOR_TYPE.GRAB;
2096
- })));
2097
- this.disposeWithMe(toDisposable(o.onPointerLeave$.subscribeEvent(() => {
2098
- o.cursor = CURSOR_TYPE.DEFAULT;
2099
- })));
2100
- }
2101
- _addDialogForImage(o) {
2102
- this.disposeWithMe(toDisposable(o.onDblclick$.subscribeEvent(() => {
2103
- const dialogId = `${o.oKey}-viewer-dialog`;
2104
- this._drawingRenderService.previewImage(dialogId, o.getNative().src, o.getNativeSize().width, o.getNativeSize().height);
2105
- })));
2106
- }
2107
- };
2108
- ImageUpdateController = __decorate([
2109
- __decorateParam(0, ICommandService),
2110
- __decorateParam(1, IRenderManagerService),
2111
- __decorateParam(2, IDrawingManagerService),
2112
- __decorateParam(3, IDialogService),
2113
- __decorateParam(4, IImageIoService),
2114
- __decorateParam(5, IUniverInstanceService),
2115
- __decorateParam(6, Inject(DrawingRenderService))
2116
- ], ImageUpdateController);
2117
-
2118
- //#endregion
2119
- //#region src/menu/align.menu.ts
2120
- const getMenuStateByDrawingFocusChangedObservable$$1 = (accessor) => {
2121
- const drawingManagerService = accessor.get(IDrawingManagerService);
2122
- return new Observable((subscriber) => {
2123
- const update = (drawings) => {
2124
- if (!drawings || drawings.length === 0) return subscriber.next(true);
2125
- if (drawings.length < 2) return subscriber.next(true);
2126
- subscriber.next(false);
2127
- };
2128
- const subscription = drawingManagerService.focus$.subscribe((drawings) => {
2129
- if (!drawings || drawings.length === 0) return subscriber.next(true);
2130
- update(drawings);
2131
- });
2132
- update(drawingManagerService.getFocusDrawings());
2133
- return () => subscription.unsubscribe();
2134
- });
2135
- };
2136
- const DRAWING_ALIGN_CONTEXT_MENU_ID = "contextMenu.drawing-align";
2137
- function DrawingAlignContextMenuItemFactory(accessor) {
2138
- return {
2139
- id: DRAWING_ALIGN_CONTEXT_MENU_ID,
2140
- type: MenuItemType.SUBITEMS,
2141
- icon: "HorizontallyIcon",
2142
- title: "drawing-ui.image-panel.align.title",
2143
- hidden$: getMenuStateByDrawingFocusChangedObservable$$1(accessor)
2144
- };
2145
- }
2146
- function SetDrawingAlignLeftMenuItemFactory() {
2147
- return {
2148
- id: SetDrawingAlignLeftOperation.id,
2149
- type: MenuItemType.BUTTON,
2150
- icon: "LeftJustifyingIcon",
2151
- title: "drawing-ui.image-panel.align.left"
2152
- };
2153
- }
2154
- function SetDrawingAlignCenterMenuItemFactory() {
2155
- return {
2156
- id: SetDrawingAlignCenterOperation.id,
2157
- type: MenuItemType.BUTTON,
2158
- icon: "HorizontallyIcon",
2159
- title: "drawing-ui.image-panel.align.center"
2160
- };
2161
- }
2162
- function SetDrawingAlignRightMenuItemFactory() {
2163
- return {
2164
- id: SetDrawingAlignRightOperation.id,
2165
- type: MenuItemType.BUTTON,
2166
- icon: "RightJustifyingIcon",
2167
- title: "drawing-ui.image-panel.align.right"
2168
- };
2169
- }
2170
- function SetDrawingAlignTopMenuItemFactory() {
2171
- return {
2172
- id: SetDrawingAlignTopOperation.id,
2173
- type: MenuItemType.BUTTON,
2174
- icon: "AlignTopIcon",
2175
- title: "drawing-ui.image-panel.align.top"
2176
- };
2177
- }
2178
- function SetDrawingAlignMiddleMenuItemFactory() {
2179
- return {
2180
- id: SetDrawingAlignMiddleOperation.id,
2181
- type: MenuItemType.BUTTON,
2182
- icon: "VerticalCenterIcon",
2183
- title: "drawing-ui.image-panel.align.middle"
2184
- };
2185
- }
2186
- function SetDrawingAlignBottomMenuItemFactory() {
2187
- return {
2188
- id: SetDrawingAlignBottomOperation.id,
2189
- type: MenuItemType.BUTTON,
2190
- icon: "AlignBottomIcon",
2191
- title: "drawing-ui.image-panel.align.bottom"
2192
- };
2193
- }
2194
- function SetDrawingAlignHorizonMenuItemFactory() {
2195
- return {
2196
- id: SetDrawingAlignHorizonOperation.id,
2197
- type: MenuItemType.BUTTON,
2198
- icon: "HorizontallyIcon",
2199
- title: "drawing-ui.image-panel.align.horizon"
2200
- };
2201
- }
2202
- function SetDrawingAlignVerticalMenuItemFactory() {
2203
- return {
2204
- id: SetDrawingAlignVerticalOperation.id,
2205
- type: MenuItemType.BUTTON,
2206
- icon: "VerticalCenterIcon",
2207
- title: "drawing-ui.image-panel.align.vertical"
2208
- };
2209
- }
2210
-
2211
- //#endregion
2212
- //#region src/menu/arrange.menu.ts
2213
- const DRAWING_ARRANGE_CONTEXT_MENU_ID = "contextMenu.drawing-arrange";
2214
- function DrawingArrangeContextMenuItemFactory() {
2215
- return {
2216
- id: DRAWING_ARRANGE_CONTEXT_MENU_ID,
2217
- type: MenuItemType.SUBITEMS,
2218
- icon: "TopmostIcon",
2219
- title: "drawing-ui.image-panel.arrange.title"
2220
- };
2221
- }
2222
- function SetDrawingArrangeFrontMenuItemFactory() {
2223
- return {
2224
- id: SetDrawingArrangeFrontOperation.id,
2225
- type: MenuItemType.BUTTON,
2226
- icon: "TopmostIcon",
2227
- title: "drawing-ui.image-panel.arrange.front"
2228
- };
2229
- }
2230
- function SetDrawingArrangeForwardMenuItemFactory() {
2231
- return {
2232
- id: SetDrawingArrangeForwardOperation.id,
2233
- type: MenuItemType.BUTTON,
2234
- icon: "MoveUpIcon",
2235
- title: "drawing-ui.image-panel.arrange.forward"
2236
- };
2237
- }
2238
- function SetDrawingArrangeBackMenuItemFactory() {
2239
- return {
2240
- id: SetDrawingArrangeBackOperation.id,
2241
- type: MenuItemType.BUTTON,
2242
- icon: "BottomIcon",
2243
- title: "drawing-ui.image-panel.arrange.back"
2244
- };
2245
- }
2246
- function SetDrawingArrangeBackwardMenuItemFactory() {
2247
- return {
2248
- id: SetDrawingArrangeBackwardOperation.id,
2249
- type: MenuItemType.BUTTON,
2250
- icon: "MoveDownIcon",
2251
- title: "drawing-ui.image-panel.arrange.backward"
2252
- };
2253
- }
2254
-
2255
- //#endregion
2256
- //#region src/menu/group.menu.ts
2257
- function getMenuStateByDrawingFocusChangedObservable$(accessor, type) {
2258
- const drawingManagerService = accessor.get(IDrawingManagerService);
2259
- return new Observable((subscriber) => {
2260
- const update = (drawings) => {
2261
- if (!drawings || drawings.length === 0) return subscriber.next(true);
2262
- if (type === "group") {
2263
- if (drawings.length < 2) return subscriber.next(true);
2264
- if (!drawings.every((drawing) => isGroupableDrawingType(drawing.drawingType))) return subscriber.next(true);
2265
- } else if (type === "unGroup") {
2266
- if (drawings.filter((drawing) => drawing.drawingType === DrawingTypeEnum.DRAWING_GROUP).length === 0) return subscriber.next(true);
2267
- } else if (!drawings.every((drawing) => isGroupableDrawingType(drawing.drawingType))) return subscriber.next(true);
2268
- subscriber.next(false);
2269
- };
2270
- const subscription = drawingManagerService.focus$.subscribe((drawings) => {
2271
- if (!drawings || drawings.length === 0) return subscriber.next(true);
2272
- update(drawings);
2273
- });
2274
- update(drawingManagerService.getFocusDrawings());
2275
- return () => subscription.unsubscribe();
2276
- });
2277
- }
2278
- const DRAWING_GROUP_CONTEXT_MENU_ID = "contextMenu.drawing-group";
2279
- function DrawingGroupContextMenuItemFactory(accessor) {
2280
- return {
2281
- id: DRAWING_GROUP_CONTEXT_MENU_ID,
2282
- type: MenuItemType.SUBITEMS,
2283
- icon: "GroupIcon",
2284
- title: "drawing-ui.image-panel.group.title",
2285
- hidden$: getMenuStateByDrawingFocusChangedObservable$(accessor)
2286
- };
2287
- }
2288
- function SetDrawingGroupMenuItemFactory(accessor) {
2289
- return {
2290
- id: SetDrawingGroupOperation.id,
2291
- type: MenuItemType.BUTTON,
2292
- icon: "GroupIcon",
2293
- title: "drawing-ui.image-panel.group.group",
2294
- disabled$: getMenuStateByDrawingFocusChangedObservable$(accessor, "group")
2295
- };
2296
- }
2297
- function CancelDrawingGroupMenuItemFactory(accessor) {
2298
- return {
2299
- id: CancelDrawingGroupOperation.id,
2300
- type: MenuItemType.BUTTON,
2301
- icon: "UngroupIcon",
2302
- title: "drawing-ui.image-panel.group.unGroup",
2303
- disabled$: getMenuStateByDrawingFocusChangedObservable$(accessor, "unGroup")
2304
- };
2305
- }
2306
-
2307
- //#endregion
2308
- //#region src/menu/schema.ts
2309
- const menuSchema = { [ContextMenuPosition.DRAWING]: { [ContextMenuGroup.OTHERS]: {
2310
- [DRAWING_GROUP_CONTEXT_MENU_ID]: {
2311
- order: 1,
2312
- menuItemFactory: DrawingGroupContextMenuItemFactory,
2313
- [SetDrawingGroupOperation.id]: {
2314
- order: 0,
2315
- menuItemFactory: SetDrawingGroupMenuItemFactory
2316
- },
2317
- [CancelDrawingGroupOperation.id]: {
2318
- order: 1,
2319
- menuItemFactory: CancelDrawingGroupMenuItemFactory
2320
- }
2321
- },
2322
- [DRAWING_ARRANGE_CONTEXT_MENU_ID]: {
2323
- order: 2,
2324
- menuItemFactory: DrawingArrangeContextMenuItemFactory,
2325
- [SetDrawingArrangeFrontOperation.id]: {
2326
- order: 0,
2327
- menuItemFactory: SetDrawingArrangeFrontMenuItemFactory
2328
- },
2329
- [SetDrawingArrangeForwardOperation.id]: {
2330
- order: 1,
2331
- menuItemFactory: SetDrawingArrangeForwardMenuItemFactory
2332
- },
2333
- [SetDrawingArrangeBackOperation.id]: {
2334
- order: 2,
2335
- menuItemFactory: SetDrawingArrangeBackMenuItemFactory
2336
- },
2337
- [SetDrawingArrangeBackwardOperation.id]: {
2338
- order: 3,
2339
- menuItemFactory: SetDrawingArrangeBackwardMenuItemFactory
2340
- }
2341
- },
2342
- [DRAWING_ALIGN_CONTEXT_MENU_ID]: {
2343
- order: 3,
2344
- menuItemFactory: DrawingAlignContextMenuItemFactory,
2345
- [SetDrawingAlignLeftOperation.id]: {
2346
- order: 0,
2347
- menuItemFactory: SetDrawingAlignLeftMenuItemFactory
2348
- },
2349
- [SetDrawingAlignCenterOperation.id]: {
2350
- order: 1,
2351
- menuItemFactory: SetDrawingAlignCenterMenuItemFactory
2352
- },
2353
- [SetDrawingAlignRightOperation.id]: {
2354
- order: 2,
2355
- menuItemFactory: SetDrawingAlignRightMenuItemFactory
2356
- },
2357
- [SetDrawingAlignTopOperation.id]: {
2358
- order: 3,
2359
- menuItemFactory: SetDrawingAlignTopMenuItemFactory
2360
- },
2361
- [SetDrawingAlignMiddleOperation.id]: {
2362
- order: 4,
2363
- menuItemFactory: SetDrawingAlignMiddleMenuItemFactory
2364
- },
2365
- [SetDrawingAlignBottomOperation.id]: {
2366
- order: 5,
2367
- menuItemFactory: SetDrawingAlignBottomMenuItemFactory
2368
- },
2369
- [SetDrawingAlignHorizonOperation.id]: {
2370
- order: 6,
2371
- menuItemFactory: SetDrawingAlignHorizonMenuItemFactory
2372
- },
2373
- [SetDrawingAlignVerticalOperation.id]: {
2374
- order: 7,
2375
- menuItemFactory: SetDrawingAlignVerticalMenuItemFactory
2376
- }
2293
+ if (params == null) return;
2294
+ this._resetImageSize(params);
2295
+ }
2296
+ }));
2377
2297
  }
2378
- } } };
2298
+ _getSceneAndTransformerByDrawingSearch(unitId) {
2299
+ if (unitId == null) return;
2300
+ const renderObject = this._renderManagerService.getRenderById(unitId);
2301
+ const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
2302
+ if (scene == null) return null;
2303
+ return {
2304
+ scene,
2305
+ transformer: scene.getTransformerByCreate()
2306
+ };
2307
+ }
2308
+ _resetImageSize(params) {
2309
+ const updateParams = [];
2310
+ const sceneList = [];
2311
+ params.forEach((param) => {
2312
+ const { unitId, subUnitId, drawingId } = param;
2313
+ const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
2314
+ if (renderObject == null) return;
2315
+ const { scene } = renderObject;
2316
+ const imageShapeKey = getDrawingShapeKeyByDrawingSearch({
2317
+ unitId,
2318
+ subUnitId,
2319
+ drawingId
2320
+ });
2321
+ const imageShape = scene.getObject(imageShapeKey);
2322
+ if (imageShape == null) return true;
2323
+ const imageData = this._drawingManagerService.getDrawingByParam(param);
2324
+ if (imageData == null) return true;
2325
+ if (imageData.drawingType !== DrawingTypeEnum.DRAWING_IMAGE) return;
2326
+ imageShape.resetSize();
2327
+ const { width, height } = imageShape.getNativeSize();
2328
+ if (sceneList.includes(scene) === false) sceneList.push(scene);
2329
+ updateParams.push({
2330
+ ...imageData,
2331
+ transform: {
2332
+ ...imageData.transform,
2333
+ height,
2334
+ width,
2335
+ angle: 0
2336
+ },
2337
+ srcRect: null,
2338
+ prstGeom: null
2339
+ });
2340
+ });
2341
+ this._drawingManagerService.featurePluginUpdateNotification(updateParams);
2342
+ sceneList.forEach((scene) => {
2343
+ scene.getTransformerByCreate().refreshControls().changeNotification();
2344
+ });
2345
+ this._commandService.syncExecuteCommand(SetDrawingSelectedOperation.id, params);
2346
+ }
2347
+ _drawingAddListener() {
2348
+ this.disposeWithMe(this._drawingManagerService.add$.pipe(bufferTime(33), filter((batches) => batches.length > 0), map((batches) => batches.flat()), map((items) => {
2349
+ const map = /* @__PURE__ */ new Map();
2350
+ for (const it of items) map.set(`${it.unitId}|${it.subUnitId}|${it.drawingId}`, it);
2351
+ return [...map.values()];
2352
+ }), filter((items) => items.length > 0)).subscribe((uniqueParams) => {
2353
+ this._insertImages(uniqueParams);
2354
+ }));
2355
+ }
2356
+ _insertImages(params) {
2357
+ params.forEach(async (param) => {
2358
+ var _getCurrentUnitInfo;
2359
+ const { unitId, subUnitId } = param;
2360
+ const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
2361
+ const currentSubUnitId = (_getCurrentUnitInfo = getCurrentUnitInfo(this._currentUniverService, unitId)) === null || _getCurrentUnitInfo === void 0 ? void 0 : _getCurrentUnitInfo.subUnitId;
2362
+ if (renderObject == null || currentSubUnitId !== subUnitId) return;
2363
+ const imageParam = this._drawingManagerService.getDrawingByParam(param);
2364
+ if (imageParam == null) return;
2365
+ const images = await this._drawingRenderService.renderImages(imageParam, renderObject.scene);
2366
+ const currentImageParam = this._drawingManagerService.getDrawingByParam(param);
2367
+ if (currentImageParam) this._drawingManagerService.refreshTransform([currentImageParam]);
2368
+ if (images == null || images.length === 0) return;
2369
+ for (const image of images) {
2370
+ this._addHoverForImage(image);
2371
+ this._addDialogForImage(image);
2372
+ }
2373
+ });
2374
+ }
2375
+ _imageUpdateListener() {
2376
+ this.disposeWithMe(this._drawingManagerService.update$.subscribe((params) => {
2377
+ params.forEach((param) => {
2378
+ var _setClipBounds;
2379
+ const { unitId, subUnitId, drawingId } = param;
2380
+ const drawingParam = this._drawingManagerService.getDrawingByParam(param);
2381
+ if (drawingParam == null) return;
2382
+ const { transform, drawingType, srcRect, prstGeom, source, imageSourceType } = drawingParam;
2383
+ if (drawingType !== DrawingTypeEnum.DRAWING_IMAGE) return;
2384
+ const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
2385
+ if (renderObject == null) return;
2386
+ const { scene, transformer } = renderObject;
2387
+ if (transform == null) return true;
2388
+ const drawingShapeKey = getDrawingShapeKeyByDrawingSearch({
2389
+ unitId,
2390
+ subUnitId,
2391
+ drawingId
2392
+ });
2393
+ const imageShape = scene.getObject(drawingShapeKey);
2394
+ if (imageShape == null) return true;
2395
+ imageShape.transformByState(transform);
2396
+ (_setClipBounds = imageShape.setClipBounds) === null || _setClipBounds === void 0 || _setClipBounds.call(imageShape, transform.clipBounds);
2397
+ ensureDrawingRenderLayer(scene, imageShape, drawingParam);
2398
+ imageShape.setSrcRect(srcRect);
2399
+ imageShape.setPrstGeom(prstGeom);
2400
+ if (source != null && source.length > 0 && (imageSourceType === ImageSourceType.BASE64 || imageSourceType === ImageSourceType.URL)) imageShape.changeSource(source);
2401
+ });
2402
+ }));
2403
+ }
2404
+ _addHoverForImage(o) {
2405
+ this.disposeWithMe(toDisposable(o.onPointerEnter$.subscribeEvent(() => {
2406
+ o.cursor = CURSOR_TYPE.GRAB;
2407
+ })));
2408
+ this.disposeWithMe(toDisposable(o.onPointerLeave$.subscribeEvent(() => {
2409
+ o.cursor = CURSOR_TYPE.DEFAULT;
2410
+ })));
2411
+ }
2412
+ _addDialogForImage(o) {
2413
+ this.disposeWithMe(toDisposable(o.onDblclick$.subscribeEvent(() => {
2414
+ const dialogId = `${o.oKey}-viewer-dialog`;
2415
+ this._drawingRenderService.previewImage(dialogId, o.getNative().src, o.getNativeSize().width, o.getNativeSize().height);
2416
+ })));
2417
+ }
2418
+ };
2419
+ ImageUpdateController = __decorate([
2420
+ __decorateParam(0, ICommandService),
2421
+ __decorateParam(1, IRenderManagerService),
2422
+ __decorateParam(2, IDrawingManagerService),
2423
+ __decorateParam(3, IDialogService),
2424
+ __decorateParam(4, IImageIoService),
2425
+ __decorateParam(5, IUniverInstanceService),
2426
+ __decorateParam(6, Inject(DrawingRenderService))
2427
+ ], ImageUpdateController);
2379
2428
 
2380
2429
  //#endregion
2381
2430
  //#region src/controllers/ui.controller.ts
@@ -2474,6 +2523,482 @@ _defineProperty(UniverDrawingUIPlugin, "packageName", name);
2474
2523
  _defineProperty(UniverDrawingUIPlugin, "version", version);
2475
2524
  UniverDrawingUIPlugin = __decorate([__decorateParam(1, Inject(Injector)), __decorateParam(2, IConfigService)], UniverDrawingUIPlugin);
2476
2525
 
2526
+ //#endregion
2527
+ //#region src/views/object-list-panel/object-list-panel-layer.ts
2528
+ const OBJECT_LIST_FLOATING_SECTION_ID = "floating";
2529
+ const OBJECT_LIST_CANVAS_SECTION_ID = "canvas";
2530
+ function isFloatingObjectListDrawingType(drawingType) {
2531
+ return drawingType === DrawingTypeEnum.DRAWING_CHART || drawingType === DrawingTypeEnum.DRAWING_DOM || drawingType === DrawingTypeEnum.DRAWING_UNIT;
2532
+ }
2533
+ function getObjectListPanelSectionIdForDrawingType(drawingType) {
2534
+ return isFloatingObjectListDrawingType(drawingType) ? OBJECT_LIST_FLOATING_SECTION_ID : OBJECT_LIST_CANVAS_SECTION_ID;
2535
+ }
2536
+
2537
+ //#endregion
2538
+ //#region src/views/object-list-panel/ObjectListPanelBase.tsx
2539
+ const objectListPanelLabelKeys = {
2540
+ title: "drawing-ui.objectListPanel.title",
2541
+ empty: "drawing-ui.objectListPanel.empty",
2542
+ showAll: "drawing-ui.objectListPanel.showAll",
2543
+ hideAll: "drawing-ui.objectListPanel.hideAll",
2544
+ moveForward: "drawing-ui.objectListPanel.moveForward",
2545
+ moveBackward: "drawing-ui.objectListPanel.moveBackward",
2546
+ close: "drawing-ui.objectListPanel.close",
2547
+ show: "drawing-ui.objectListPanel.show",
2548
+ hide: "drawing-ui.objectListPanel.hide",
2549
+ lock: "drawing-ui.objectListPanel.lock",
2550
+ unlock: "drawing-ui.objectListPanel.unlock",
2551
+ name: "drawing-ui.objectListPanel.name",
2552
+ nameInput: "drawing-ui.objectListPanel.nameInput",
2553
+ description: "drawing-ui.objectListPanel.description",
2554
+ descriptionPlaceholder: "drawing-ui.objectListPanel.descriptionPlaceholder",
2555
+ details: "drawing-ui.objectListPanel.details",
2556
+ noSelection: "drawing-ui.objectListPanel.noSelection",
2557
+ locate: "drawing-ui.objectListPanel.locate",
2558
+ expand: "drawing-ui.objectListPanel.expand",
2559
+ collapse: "drawing-ui.objectListPanel.collapse",
2560
+ dragToReorder: "drawing-ui.objectListPanel.dragToReorder",
2561
+ search: "drawing-ui.objectListPanel.search",
2562
+ filterAll: "drawing-ui.objectListPanel.filterAll",
2563
+ filterHidden: "drawing-ui.objectListPanel.filterHidden",
2564
+ filterLocked: "drawing-ui.objectListPanel.filterLocked",
2565
+ sectionCanvas: "drawing-ui.objectListPanel.sectionCanvas",
2566
+ sectionFloating: "drawing-ui.objectListPanel.sectionFloating"
2567
+ };
2568
+ function getObjectListPanelLabels(localeService) {
2569
+ return Object.fromEntries(Object.entries(objectListPanelLabelKeys).map(([labelKey, localeKey]) => [labelKey, localeService.t(localeKey)]));
2570
+ }
2571
+ function getObjectListPanelTypeName(localeService, typeName) {
2572
+ return localeService.t(`drawing-ui.objectListPanel.typeNames.${typeName}`);
2573
+ }
2574
+ const iconButtonClassName = `
2575
+ univer-flex univer-size-7 univer-shrink-0 univer-items-center univer-justify-center univer-rounded-md
2576
+ univer-border-0 univer-bg-transparent univer-p-0 univer-text-gray-500 univer-outline-none univer-transition-colors
2577
+ hover:univer-bg-gray-100 hover:univer-text-gray-900
2578
+ disabled:univer-cursor-not-allowed disabled:univer-opacity-40
2579
+ dark:!univer-text-gray-300 dark:hover:!univer-bg-gray-800 dark:hover:!univer-text-gray-100
2580
+ `;
2581
+ const sectionOrder = /* @__PURE__ */ new Map([
2582
+ [OBJECT_LIST_FLOATING_SECTION_ID, 0],
2583
+ [OBJECT_LIST_CANVAS_SECTION_ID, 1],
2584
+ ["", 2]
2585
+ ]);
2586
+ function normalizeText(value) {
2587
+ return value.trim();
2588
+ }
2589
+ function hasCapability(panelCapabilities, item, key, fallback = true) {
2590
+ var _ref, _item$capabilities$ke, _item$capabilities;
2591
+ return (_ref = (_item$capabilities$ke = item === null || item === void 0 || (_item$capabilities = item.capabilities) === null || _item$capabilities === void 0 ? void 0 : _item$capabilities[key]) !== null && _item$capabilities$ke !== void 0 ? _item$capabilities$ke : panelCapabilities === null || panelCapabilities === void 0 ? void 0 : panelCapabilities[key]) !== null && _ref !== void 0 ? _ref : fallback;
2592
+ }
2593
+ function ObjectListPanelBase(props) {
2594
+ var _selectedItem$canMove, _selectedItem$canMove2, _capabilities$reorder;
2595
+ const { items, selectedIds, allObjectIds, focusedId, labels, showHeader = true, capabilities, onSelect, onSetVisible, onCommitName, onCommitDescription, onMoveForward, onMoveBackward, onToggleExpanded, onToggleSelectable, onLocate, onReorder } = props;
2596
+ const selectedIdSet = useMemo(() => new Set(selectedIds), [selectedIds]);
2597
+ const [draggingId, setDraggingId] = useState(null);
2598
+ const [searchQuery, setSearchQuery] = useState("");
2599
+ const [filterMode, setFilterMode] = useState("all");
2600
+ const [collapsedSectionIds, setCollapsedSectionIds] = useState(() => /* @__PURE__ */ new Set());
2601
+ const selectedItem = useMemo(() => {
2602
+ var _ref2, _items$find;
2603
+ return (_ref2 = (_items$find = items.find((item) => item.id === focusedId)) !== null && _items$find !== void 0 ? _items$find : items.find((item) => selectedIdSet.has(item.id))) !== null && _ref2 !== void 0 ? _ref2 : null;
2604
+ }, [
2605
+ focusedId,
2606
+ items,
2607
+ selectedIdSet
2608
+ ]);
2609
+ const visibleItems = useMemo(() => {
2610
+ const normalizedQuery = normalizeText(searchQuery).toLocaleLowerCase();
2611
+ return items.filter((item) => {
2612
+ var _item$description;
2613
+ if (filterMode === "hidden" && item.visible !== false) return false;
2614
+ if (filterMode === "locked" && item.selectable !== false) return false;
2615
+ if (!normalizedQuery) return true;
2616
+ return item.name.toLocaleLowerCase().includes(normalizedQuery) || ((_item$description = item.description) !== null && _item$description !== void 0 ? _item$description : "").toLocaleLowerCase().includes(normalizedQuery);
2617
+ });
2618
+ }, [
2619
+ filterMode,
2620
+ items,
2621
+ searchQuery
2622
+ ]);
2623
+ const visibleItemSections = useMemo(() => {
2624
+ const sectionMap = /* @__PURE__ */ new Map();
2625
+ visibleItems.forEach((item) => {
2626
+ var _item$sectionId, _item$sectionTitle;
2627
+ const sectionId = (_item$sectionId = item.sectionId) !== null && _item$sectionId !== void 0 ? _item$sectionId : "";
2628
+ const existingSection = sectionMap.get(sectionId);
2629
+ if (existingSection) {
2630
+ existingSection.items.push(item);
2631
+ return;
2632
+ }
2633
+ sectionMap.set(sectionId, {
2634
+ id: sectionId,
2635
+ title: (_item$sectionTitle = item.sectionTitle) !== null && _item$sectionTitle !== void 0 ? _item$sectionTitle : "",
2636
+ items: [item]
2637
+ });
2638
+ });
2639
+ return [...sectionMap.values()].sort((a, b) => {
2640
+ var _sectionOrder$get, _sectionOrder$get2;
2641
+ return ((_sectionOrder$get = sectionOrder.get(a.id)) !== null && _sectionOrder$get !== void 0 ? _sectionOrder$get : 3) - ((_sectionOrder$get2 = sectionOrder.get(b.id)) !== null && _sectionOrder$get2 !== void 0 ? _sectionOrder$get2 : 3);
2642
+ });
2643
+ }, [visibleItems]);
2644
+ const showSectionHeaders = visibleItemSections.length > 1 || visibleItemSections.some((section) => section.id === "floating");
2645
+ const allIds = useMemo(() => allObjectIds !== null && allObjectIds !== void 0 ? allObjectIds : items.map((item) => item.id), [allObjectIds, items]);
2646
+ const selectedIndex = selectedItem ? items.findIndex((item) => item.id === selectedItem.id) : -1;
2647
+ const canMoveForward = !!selectedItem && !!onMoveForward && !selectedItem.disabled && ((_selectedItem$canMove = selectedItem.canMoveForward) !== null && _selectedItem$canMove !== void 0 ? _selectedItem$canMove : selectedIndex > 0) && hasCapability(capabilities, selectedItem, "arrange");
2648
+ const canMoveBackward = !!selectedItem && !!onMoveBackward && !selectedItem.disabled && ((_selectedItem$canMove2 = selectedItem.canMoveBackward) !== null && _selectedItem$canMove2 !== void 0 ? _selectedItem$canMove2 : selectedIndex >= 0 && selectedIndex < items.length - 1) && hasCapability(capabilities, selectedItem, "arrange");
2649
+ const showArrangeControls = hasCapability(capabilities, selectedItem, "arrange") && (!!onMoveForward || !!onMoveBackward);
2650
+ const showLocateControl = !!onLocate && hasCapability(capabilities, selectedItem, "locate");
2651
+ const canReorder = !!onReorder && ((_capabilities$reorder = capabilities === null || capabilities === void 0 ? void 0 : capabilities.reorder) !== null && _capabilities$reorder !== void 0 ? _capabilities$reorder : true);
2652
+ const findItem = (objectId) => {
2653
+ var _items$find2;
2654
+ return objectId ? (_items$find2 = items.find((item) => item.id === objectId)) !== null && _items$find2 !== void 0 ? _items$find2 : null : null;
2655
+ };
2656
+ const handleDrop = (targetId) => {
2657
+ var _source$parentId, _target$parentId, _source$sectionId, _target$sectionId;
2658
+ const source = findItem(draggingId);
2659
+ const target = findItem(targetId);
2660
+ setDraggingId(null);
2661
+ if (!source || !target || source.id === target.id || source.disabled || target.disabled) return;
2662
+ if (((_source$parentId = source.parentId) !== null && _source$parentId !== void 0 ? _source$parentId : "") !== ((_target$parentId = target.parentId) !== null && _target$parentId !== void 0 ? _target$parentId : "")) return;
2663
+ if (((_source$sectionId = source.sectionId) !== null && _source$sectionId !== void 0 ? _source$sectionId : "") !== ((_target$sectionId = target.sectionId) !== null && _target$sectionId !== void 0 ? _target$sectionId : "")) return;
2664
+ if (source.canReorder === false || target.canReorder === false) return;
2665
+ onReorder === null || onReorder === void 0 || onReorder(source.id, target.id);
2666
+ };
2667
+ const toggleSectionCollapsed = (sectionId) => {
2668
+ if (!sectionId) return;
2669
+ setCollapsedSectionIds((current) => {
2670
+ const next = new Set(current);
2671
+ if (next.has(sectionId)) next.delete(sectionId);
2672
+ else next.add(sectionId);
2673
+ return next;
2674
+ });
2675
+ };
2676
+ return /* @__PURE__ */ jsxs("div", {
2677
+ className: "univer-box-border univer-flex univer-size-full univer-min-w-0 univer-max-w-full univer-flex-col univer-gap-3 univer-overflow-hidden univer-text-gray-700 dark:!univer-text-gray-200",
2678
+ "data-drawing-object-list-panel": "true",
2679
+ children: [
2680
+ showHeader && /* @__PURE__ */ jsx("div", {
2681
+ className: "univer-flex univer-h-8 univer-shrink-0 univer-items-center univer-gap-2",
2682
+ children: /* @__PURE__ */ jsx("div", {
2683
+ className: "univer-min-w-0 univer-flex-1 univer-truncate univer-text-sm univer-font-semibold univer-text-gray-900 dark:!univer-text-gray-100",
2684
+ children: labels.title
2685
+ })
2686
+ }),
2687
+ /* @__PURE__ */ jsxs("div", {
2688
+ className: "univer-flex univer-min-w-0 univer-items-center univer-justify-between univer-gap-2",
2689
+ children: [/* @__PURE__ */ jsxs("div", {
2690
+ className: "univer-flex univer-min-w-0 univer-gap-2",
2691
+ children: [/* @__PURE__ */ jsx(Button, {
2692
+ size: "small",
2693
+ disabled: items.length === 0,
2694
+ onClick: () => onSetVisible(allIds, true),
2695
+ children: labels.showAll
2696
+ }), /* @__PURE__ */ jsx(Button, {
2697
+ size: "small",
2698
+ disabled: items.length === 0,
2699
+ onClick: () => onSetVisible(allIds, false),
2700
+ children: labels.hideAll
2701
+ })]
2702
+ }), /* @__PURE__ */ jsxs("div", {
2703
+ className: "univer-flex univer-shrink-0 univer-gap-1",
2704
+ children: [showLocateControl && /* @__PURE__ */ jsx("button", {
2705
+ type: "button",
2706
+ className: iconButtonClassName,
2707
+ title: labels.locate,
2708
+ "aria-label": labels.locate,
2709
+ disabled: !(selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.id),
2710
+ onClick: () => selectedItem && (onLocate === null || onLocate === void 0 ? void 0 : onLocate(selectedItem.id)),
2711
+ children: /* @__PURE__ */ jsx(LocateFixedIcon, {})
2712
+ }), showArrangeControls && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("button", {
2713
+ type: "button",
2714
+ className: iconButtonClassName,
2715
+ title: labels.moveForward,
2716
+ "aria-label": labels.moveForward,
2717
+ disabled: !canMoveForward,
2718
+ onClick: () => selectedItem && (onMoveForward === null || onMoveForward === void 0 ? void 0 : onMoveForward(selectedItem.id)),
2719
+ children: /* @__PURE__ */ jsx(ArrowUpIcon, {})
2720
+ }), /* @__PURE__ */ jsx("button", {
2721
+ type: "button",
2722
+ className: iconButtonClassName,
2723
+ title: labels.moveBackward,
2724
+ "aria-label": labels.moveBackward,
2725
+ disabled: !canMoveBackward,
2726
+ onClick: () => selectedItem && (onMoveBackward === null || onMoveBackward === void 0 ? void 0 : onMoveBackward(selectedItem.id)),
2727
+ children: /* @__PURE__ */ jsx(ArrowDownIcon, {})
2728
+ })] })]
2729
+ })]
2730
+ }),
2731
+ /* @__PURE__ */ jsxs("div", {
2732
+ className: "univer-flex univer-shrink-0 univer-flex-col univer-gap-2",
2733
+ children: [/* @__PURE__ */ jsx(Input, {
2734
+ value: searchQuery,
2735
+ "aria-label": labels.search,
2736
+ placeholder: labels.search,
2737
+ onChange: setSearchQuery
2738
+ }), /* @__PURE__ */ jsx("div", {
2739
+ className: "univer-flex univer-min-w-0 univer-gap-1",
2740
+ children: [
2741
+ ["all", labels.filterAll],
2742
+ ["hidden", labels.filterHidden],
2743
+ ["locked", labels.filterLocked]
2744
+ ].map(([mode, label]) => /* @__PURE__ */ jsx("button", {
2745
+ type: "button",
2746
+ className: clsx("univer-h-7 univer-min-w-0 univer-flex-1 univer-rounded-md univer-border univer-border-solid univer-px-2 univer-text-xs univer-outline-none univer-transition-colors dark:!univer-border-gray-700", filterMode === mode ? "dark:!univer-bg-primary-900/30 univer-border-primary-500 univer-bg-primary-50 univer-text-primary-600 dark:!univer-text-primary-200" : "univer-border-gray-200 univer-bg-white univer-text-gray-600 hover:univer-bg-gray-50 dark:!univer-bg-gray-900 dark:!univer-text-gray-300 dark:hover:!univer-bg-gray-800"),
2747
+ "aria-pressed": filterMode === mode,
2748
+ onClick: () => setFilterMode(mode),
2749
+ children: /* @__PURE__ */ jsx("span", {
2750
+ className: "univer-block univer-truncate",
2751
+ children: label
2752
+ })
2753
+ }, mode))
2754
+ })]
2755
+ }),
2756
+ /* @__PURE__ */ jsx("div", {
2757
+ className: "univer-min-h-0 univer-flex-1 univer-overflow-y-auto univer-overflow-x-hidden",
2758
+ children: visibleItems.length === 0 ? /* @__PURE__ */ jsx("div", {
2759
+ className: "univer-py-6 univer-text-center univer-text-sm univer-text-gray-500",
2760
+ children: labels.empty
2761
+ }) : /* @__PURE__ */ jsx("div", {
2762
+ className: "univer-flex univer-min-w-0 univer-flex-col univer-gap-0.5",
2763
+ children: visibleItemSections.map((section) => /* @__PURE__ */ jsxs("div", {
2764
+ className: "univer-flex univer-min-w-0 univer-flex-col univer-gap-0.5",
2765
+ children: [showSectionHeaders && section.title && (() => {
2766
+ const sectionCollapsed = !!section.id && collapsedSectionIds.has(section.id);
2767
+ return /* @__PURE__ */ jsxs("button", {
2768
+ type: "button",
2769
+ className: "univer-box-border univer-flex univer-h-7 univer-w-full univer-items-center univer-gap-1 univer-rounded-md univer-border-0 univer-bg-transparent univer-px-2 univer-pt-1 univer-text-xs univer-font-semibold univer-uppercase univer-text-gray-400 univer-outline-none hover:univer-bg-gray-50 hover:univer-text-gray-600 disabled:univer-cursor-default disabled:hover:univer-bg-transparent dark:!univer-text-gray-500 dark:hover:!univer-bg-gray-800 dark:hover:!univer-text-gray-300",
2770
+ "aria-label": sectionCollapsed ? labels.expand : labels.collapse,
2771
+ disabled: !section.id,
2772
+ onClick: () => toggleSectionCollapsed(section.id),
2773
+ children: [
2774
+ section.id ? /* @__PURE__ */ jsx("span", {
2775
+ className: "univer-flex univer-size-4 univer-shrink-0 univer-items-center univer-justify-center",
2776
+ children: sectionCollapsed ? /* @__PURE__ */ jsx(MoreRightIcon, {}) : /* @__PURE__ */ jsx(MoreDownIcon, {})
2777
+ }) : /* @__PURE__ */ jsx("span", { className: "univer-size-4 univer-shrink-0" }),
2778
+ /* @__PURE__ */ jsx("span", {
2779
+ className: "univer-min-w-0 univer-flex-1 univer-truncate univer-text-left",
2780
+ children: section.title
2781
+ }),
2782
+ /* @__PURE__ */ jsx("span", {
2783
+ className: "univer-shrink-0 univer-text-[10px] univer-font-medium univer-text-gray-400 dark:!univer-text-gray-500",
2784
+ children: section.items.length
2785
+ })
2786
+ ]
2787
+ });
2788
+ })(), (!section.id || !collapsedSectionIds.has(section.id)) && section.items.map((item) => /* @__PURE__ */ jsx(ObjectListRow, {
2789
+ item,
2790
+ selected: selectedIdSet.has(item.id),
2791
+ labels,
2792
+ showLock: !!onToggleSelectable && hasCapability(capabilities, item, "selectable"),
2793
+ showName: hasCapability(capabilities, item, "name"),
2794
+ showVisible: hasCapability(capabilities, item, "visible"),
2795
+ draggable: canReorder && hasCapability(capabilities, item, "reorder") && !item.disabled && item.canReorder !== false,
2796
+ dragging: draggingId === item.id,
2797
+ onSelect: (multiSelect) => onSelect(item.id, multiSelect),
2798
+ onToggleExpanded: () => onToggleExpanded === null || onToggleExpanded === void 0 ? void 0 : onToggleExpanded(item.id),
2799
+ onToggleVisible: () => onSetVisible([item.id], !item.visible),
2800
+ onToggleSelectable: () => onToggleSelectable === null || onToggleSelectable === void 0 ? void 0 : onToggleSelectable(item.id),
2801
+ onCommitName: (value) => onCommitName(item.id, value),
2802
+ onDragStart: () => setDraggingId(item.id),
2803
+ onDragEnd: () => setDraggingId(null),
2804
+ onDrop: () => handleDrop(item.id)
2805
+ }, item.id))]
2806
+ }, section.id || "default"))
2807
+ })
2808
+ }),
2809
+ /* @__PURE__ */ jsx(ObjectDetailsEditor, {
2810
+ item: selectedItem,
2811
+ labels,
2812
+ showName: hasCapability(capabilities, selectedItem, "name"),
2813
+ showDescription: hasCapability(capabilities, selectedItem, "description"),
2814
+ onCommitName: (value) => selectedItem && onCommitName(selectedItem.id, value),
2815
+ onCommitDescription: (value) => selectedItem && onCommitDescription(selectedItem.id, value)
2816
+ })
2817
+ ]
2818
+ });
2819
+ }
2820
+ function ObjectListRow(props) {
2821
+ var _item$level;
2822
+ const { item, selected, labels, showLock, showName, showVisible, draggable, dragging, onSelect, onToggleExpanded, onToggleVisible, onToggleSelectable, onCommitName, onDragStart, onDragEnd, onDrop } = props;
2823
+ const [draftName, setDraftName] = useState(item.name);
2824
+ const skipCommitOnBlurRef = useRef(false);
2825
+ const disabled = item.disabled === true;
2826
+ const level = (_item$level = item.level) !== null && _item$level !== void 0 ? _item$level : 0;
2827
+ const locked = item.selectable === false;
2828
+ useEffect(() => {
2829
+ setDraftName(item.name);
2830
+ }, [item.name]);
2831
+ const handleBlur = (event) => {
2832
+ if (disabled) return;
2833
+ if (skipCommitOnBlurRef.current) {
2834
+ skipCommitOnBlurRef.current = false;
2835
+ return;
2836
+ }
2837
+ if (event.currentTarget.value !== item.name) onCommitName(event.currentTarget.value);
2838
+ };
2839
+ const handleKeyDown = (event) => {
2840
+ if (event.key === "Enter") {
2841
+ event.currentTarget.blur();
2842
+ return;
2843
+ }
2844
+ if (event.key === "Escape") {
2845
+ skipCommitOnBlurRef.current = true;
2846
+ setDraftName(item.name);
2847
+ event.currentTarget.blur();
2848
+ }
2849
+ };
2850
+ return /* @__PURE__ */ jsxs("div", {
2851
+ className: clsx("univer-box-border univer-flex univer-h-8 univer-w-full univer-min-w-0 univer-max-w-full univer-items-center univer-gap-1.5 univer-overflow-hidden univer-rounded-md univer-pr-1.5 univer-transition-colors", !disabled && "hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-800", selected && "univer-bg-gray-100 dark:!univer-bg-gray-800", disabled && "univer-text-gray-400 dark:!univer-text-gray-500", dragging && "univer-opacity-50"),
2852
+ style: { paddingLeft: level * 14 + 4 },
2853
+ draggable,
2854
+ title: draggable ? labels.dragToReorder : void 0,
2855
+ onClick: disabled ? void 0 : (event) => onSelect(event.ctrlKey || event.metaKey),
2856
+ onDragStart: (event) => {
2857
+ if (!draggable) {
2858
+ event.preventDefault();
2859
+ return;
2860
+ }
2861
+ event.dataTransfer.effectAllowed = "move";
2862
+ event.dataTransfer.setData("text/plain", item.id);
2863
+ onDragStart();
2864
+ },
2865
+ onDragEnd,
2866
+ onDragOver: (event) => {
2867
+ if (draggable) {
2868
+ event.preventDefault();
2869
+ event.dataTransfer.dropEffect = "move";
2870
+ }
2871
+ },
2872
+ onDrop: (event) => {
2873
+ event.preventDefault();
2874
+ onDrop();
2875
+ },
2876
+ children: [
2877
+ item.isGroup ? /* @__PURE__ */ jsx("button", {
2878
+ type: "button",
2879
+ className: "univer-flex univer-size-5 univer-shrink-0 univer-items-center univer-justify-center univer-rounded univer-border-0 univer-bg-transparent univer-p-0 univer-text-gray-500 univer-outline-none univer-transition-transform hover:univer-bg-gray-100 hover:univer-text-gray-900 dark:!univer-text-gray-300 dark:hover:!univer-bg-gray-800 dark:hover:!univer-text-gray-100",
2880
+ title: item.expanded ? labels.collapse : labels.expand,
2881
+ "aria-label": item.expanded ? labels.collapse : labels.expand,
2882
+ onClick: (event) => {
2883
+ event.stopPropagation();
2884
+ onToggleExpanded();
2885
+ },
2886
+ children: item.expanded ? /* @__PURE__ */ jsx(MoreDownIcon, {}) : /* @__PURE__ */ jsx(MoreRightIcon, {})
2887
+ }) : /* @__PURE__ */ jsx("span", { className: "univer-size-5 univer-shrink-0" }),
2888
+ showName ? /* @__PURE__ */ jsx(Input, {
2889
+ className: clsx("univer-h-7 univer-w-0 univer-min-w-0 univer-flex-1", disabled && "univer-cursor-not-allowed"),
2890
+ inputClass: clsx("!univer-h-7 univer-min-w-0 univer-overflow-hidden univer-text-ellipsis univer-whitespace-nowrap !univer-rounded !univer-border-transparent !univer-bg-transparent !univer-px-1 univer-text-sm univer-text-gray-900 !univer-shadow-none focus:!univer-border-primary-500 focus:!univer-bg-white focus:!univer-ring-1 focus:!univer-ring-primary-100 disabled:!univer-bg-transparent disabled:univer-opacity-100 dark:!univer-text-gray-100 dark:focus:!univer-bg-gray-900 dark:focus:!univer-ring-primary-900", disabled && "univer-text-gray-400 dark:!univer-text-gray-500"),
2891
+ inputStyle: {
2892
+ maxWidth: "100%",
2893
+ boxSizing: "border-box"
2894
+ },
2895
+ value: draftName,
2896
+ disabled,
2897
+ "aria-label": labels.nameInput,
2898
+ onChange: setDraftName,
2899
+ onBlur: handleBlur,
2900
+ onKeyDown: handleKeyDown,
2901
+ onClick: (event) => {
2902
+ event.stopPropagation();
2903
+ if (!disabled) onSelect(event.ctrlKey || event.metaKey);
2904
+ }
2905
+ }, item.name) : /* @__PURE__ */ jsx("span", {
2906
+ className: "univer-min-w-0 univer-flex-1 univer-truncate univer-px-1 univer-text-sm",
2907
+ children: item.name
2908
+ }),
2909
+ showLock && /* @__PURE__ */ jsx("button", {
2910
+ type: "button",
2911
+ className: clsx(iconButtonClassName, !locked && "univer-opacity-70"),
2912
+ disabled,
2913
+ title: locked ? labels.unlock : labels.lock,
2914
+ "aria-label": locked ? labels.unlock : labels.lock,
2915
+ onClick: (event) => {
2916
+ event.stopPropagation();
2917
+ onToggleSelectable();
2918
+ },
2919
+ children: /* @__PURE__ */ jsx(LockIcon, {})
2920
+ }),
2921
+ showVisible && /* @__PURE__ */ jsx("button", {
2922
+ type: "button",
2923
+ className: iconButtonClassName,
2924
+ disabled,
2925
+ title: item.visible ? labels.hide : labels.show,
2926
+ "aria-label": item.visible ? labels.hide : labels.show,
2927
+ onClick: (event) => {
2928
+ event.stopPropagation();
2929
+ onToggleVisible();
2930
+ },
2931
+ children: item.visible ? /* @__PURE__ */ jsx(EyeIcon, {}) : /* @__PURE__ */ jsx(EyelashIcon, {})
2932
+ })
2933
+ ]
2934
+ });
2935
+ }
2936
+ function ObjectDetailsEditor(props) {
2937
+ var _item$name, _item$description2;
2938
+ const { item, labels, showName, showDescription, onCommitName, onCommitDescription } = props;
2939
+ const [draftName, setDraftName] = useState((_item$name = item === null || item === void 0 ? void 0 : item.name) !== null && _item$name !== void 0 ? _item$name : "");
2940
+ const [draftDescription, setDraftDescription] = useState((_item$description2 = item === null || item === void 0 ? void 0 : item.description) !== null && _item$description2 !== void 0 ? _item$description2 : "");
2941
+ const disabled = (item === null || item === void 0 ? void 0 : item.disabled) === true;
2942
+ useEffect(() => {
2943
+ var _item$name2, _item$description3;
2944
+ setDraftName((_item$name2 = item === null || item === void 0 ? void 0 : item.name) !== null && _item$name2 !== void 0 ? _item$name2 : "");
2945
+ setDraftDescription((_item$description3 = item === null || item === void 0 ? void 0 : item.description) !== null && _item$description3 !== void 0 ? _item$description3 : "");
2946
+ }, [
2947
+ item === null || item === void 0 ? void 0 : item.description,
2948
+ item === null || item === void 0 ? void 0 : item.id,
2949
+ item === null || item === void 0 ? void 0 : item.name
2950
+ ]);
2951
+ if (!item) return /* @__PURE__ */ jsx("div", {
2952
+ className: "univer-rounded-md univer-border univer-border-solid univer-border-gray-200 univer-p-3 univer-text-sm univer-text-gray-500 dark:!univer-border-gray-700 dark:!univer-text-gray-400",
2953
+ children: labels.noSelection
2954
+ });
2955
+ return /* @__PURE__ */ jsxs("div", {
2956
+ className: "univer-flex univer-shrink-0 univer-flex-col univer-gap-2 univer-border-0 univer-border-t univer-border-solid univer-border-gray-200 univer-pt-3 dark:!univer-border-gray-700",
2957
+ children: [
2958
+ /* @__PURE__ */ jsx("div", {
2959
+ className: "univer-text-xs univer-font-semibold univer-uppercase univer-text-gray-500 dark:!univer-text-gray-400",
2960
+ children: labels.details
2961
+ }),
2962
+ showName && /* @__PURE__ */ jsxs("label", {
2963
+ className: "univer-flex univer-flex-col univer-gap-1",
2964
+ children: [/* @__PURE__ */ jsx("span", {
2965
+ className: "univer-text-xs univer-text-gray-500 dark:!univer-text-gray-400",
2966
+ children: labels.name
2967
+ }), /* @__PURE__ */ jsx(Input, {
2968
+ value: draftName,
2969
+ "aria-label": labels.nameInput,
2970
+ disabled,
2971
+ onChange: setDraftName,
2972
+ onBlur: () => {
2973
+ if (!disabled && normalizeText(draftName) !== item.name) onCommitName(draftName);
2974
+ },
2975
+ onKeyDown: (event) => {
2976
+ if (event.key === "Enter") event.currentTarget.blur();
2977
+ }
2978
+ })]
2979
+ }),
2980
+ showDescription && /* @__PURE__ */ jsxs("label", {
2981
+ className: "univer-flex univer-flex-col univer-gap-1",
2982
+ children: [/* @__PURE__ */ jsx("span", {
2983
+ className: "univer-text-xs univer-text-gray-500 dark:!univer-text-gray-400",
2984
+ children: labels.description
2985
+ }), /* @__PURE__ */ jsx("textarea", {
2986
+ className: "univer-box-border univer-min-h-16 univer-w-full univer-resize-none univer-rounded-md univer-border univer-border-solid univer-border-gray-200 univer-bg-white univer-p-2 univer-text-sm univer-text-gray-900 univer-outline-none focus:univer-border-primary-500 focus:univer-ring-1 focus:univer-ring-primary-100 disabled:univer-cursor-not-allowed disabled:univer-opacity-70 dark:!univer-border-gray-700 dark:!univer-bg-gray-900 dark:!univer-text-gray-100 dark:focus:!univer-ring-primary-900",
2987
+ value: draftDescription,
2988
+ disabled,
2989
+ placeholder: labels.descriptionPlaceholder,
2990
+ "aria-label": labels.description,
2991
+ onChange: (event) => setDraftDescription(event.currentTarget.value),
2992
+ onBlur: () => {
2993
+ var _item$description4;
2994
+ if (!disabled && normalizeText(draftDescription) !== ((_item$description4 = item.description) !== null && _item$description4 !== void 0 ? _item$description4 : "")) onCommitDescription(draftDescription);
2995
+ }
2996
+ })]
2997
+ })
2998
+ ]
2999
+ });
3000
+ }
3001
+
2477
3002
  //#endregion
2478
3003
  //#region src/views/panel/DrawingAlign.tsx
2479
3004
  const DrawingAlign = (props) => {
@@ -2560,15 +3085,7 @@ const DrawingArrange = (props) => {
2560
3085
  const MoveDownIcon = iconManager.get("MoveDownIcon");
2561
3086
  const TopmostIcon = iconManager.get("TopmostIcon");
2562
3087
  const BottomIcon = iconManager.get("BottomIcon");
2563
- const [drawings, setDrawings] = useState(focusDrawings);
2564
- useEffect(() => {
2565
- const focusDispose = drawingManagerService.focus$.subscribe((drawings) => {
2566
- setDrawings(drawings);
2567
- });
2568
- return () => {
2569
- focusDispose.unsubscribe();
2570
- };
2571
- }, []);
3088
+ const drawings = useObservable(() => drawingManagerService.focus$, focusDrawings, false, [drawingManagerService]);
2572
3089
  const onArrangeBtnClick = (arrangeType) => {
2573
3090
  commandService.syncExecuteCommand(SetDrawingArrangeOperation.id, {
2574
3091
  arrangeType,
@@ -2615,6 +3132,7 @@ const DrawingArrange = (props) => {
2615
3132
  //#endregion
2616
3133
  //#region src/views/panel/DrawingGroup.tsx
2617
3134
  const DrawingGroup = (props) => {
3135
+ var _renderManagerService;
2618
3136
  const localeService = useDependency(LocaleService);
2619
3137
  const renderManagerService = useDependency(IRenderManagerService);
2620
3138
  const drawingManagerService = useDependency(IDrawingManagerService);
@@ -2623,43 +3141,32 @@ const DrawingGroup = (props) => {
2623
3141
  const { hasGroup, drawings } = props;
2624
3142
  const GroupIcon = iconManager.get("GroupIcon");
2625
3143
  const UngroupIcon = iconManager.get("UngroupIcon");
2626
- const [groupShow, setGroupShow] = useState(false);
2627
- const [groupBtnShow, setGroupBtnShow] = useState(true);
2628
- const [ungroupBtnShow, setUngroupBtnShow] = useState(true);
3144
+ const drawingParam = drawings[0];
3145
+ const transformer = drawingParam ? (_renderManagerService = renderManagerService.getRenderById(drawingParam.unitId)) === null || _renderManagerService === void 0 || (_renderManagerService = _renderManagerService.scene) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.getTransformerByCreate() : void 0;
3146
+ const { groupShow, groupBtnShow, ungroupBtnShow } = useObservable(transformer ? () => merge$1(transformer.clearControl$.pipe(filter((changeSelf) => changeSelf === true), map(() => ({
3147
+ groupShow: false,
3148
+ groupBtnShow: false,
3149
+ ungroupBtnShow: false
3150
+ }))), transformer.changeStart$.pipe(map((state) => {
3151
+ const params = getUpdateParams(state.objects, drawingManagerService);
3152
+ const groupBtnShow = params.length > 1;
3153
+ const ungroupBtnShow = params.some((item) => (item === null || item === void 0 ? void 0 : item.drawingType) === DrawingTypeEnum.DRAWING_GROUP);
3154
+ return {
3155
+ groupShow: groupBtnShow || ungroupBtnShow,
3156
+ groupBtnShow,
3157
+ ungroupBtnShow
3158
+ };
3159
+ }))) : null, {
3160
+ groupShow: false,
3161
+ groupBtnShow: true,
3162
+ ungroupBtnShow: true
3163
+ }, false, [drawingManagerService, transformer]);
2629
3164
  const onGroupBtnClick = () => {
2630
3165
  commandService.syncExecuteCommand(SetDrawingGroupOperation.id, { drawings });
2631
3166
  };
2632
3167
  const onUngroupBtnClick = () => {
2633
3168
  commandService.syncExecuteCommand(CancelDrawingGroupOperation.id, { drawings });
2634
3169
  };
2635
- useEffect(() => {
2636
- const drawingParam = drawings[0];
2637
- if (drawingParam == null) return;
2638
- const { unitId } = drawingParam;
2639
- const renderObject = renderManagerService.getRenderById(unitId);
2640
- const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
2641
- if (scene == null) return;
2642
- const transformer = scene.getTransformerByCreate();
2643
- const onClearControlObserver = transformer.clearControl$.subscribe((changeSelf) => {
2644
- if (changeSelf === true) setGroupShow(false);
2645
- });
2646
- const onChangeStartObserver = transformer.changeStart$.subscribe((state) => {
2647
- const { objects } = state;
2648
- const params = getUpdateParams(objects, drawingManagerService);
2649
- const groupParams = params.filter((o) => (o === null || o === void 0 ? void 0 : o.drawingType) === DrawingTypeEnum.DRAWING_GROUP);
2650
- let groupBtnShow = false;
2651
- let ungroupBtnShow = false;
2652
- if (params.length > 1) groupBtnShow = true;
2653
- if (groupParams.length > 0) ungroupBtnShow = true;
2654
- setGroupShow(groupBtnShow || ungroupBtnShow);
2655
- setGroupBtnShow(groupBtnShow);
2656
- setUngroupBtnShow(ungroupBtnShow);
2657
- });
2658
- return () => {
2659
- onChangeStartObserver.unsubscribe();
2660
- onClearControlObserver.unsubscribe();
2661
- };
2662
- }, []);
2663
3170
  return /* @__PURE__ */ jsxs("div", {
2664
3171
  className: clsx("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", { "univer-hidden": hasGroup === true && groupShow === false || hasGroup === false }),
2665
3172
  children: [/* @__PURE__ */ jsx("header", {
@@ -2711,21 +3218,24 @@ function createDrawingTransformRotationChangeHandler(options) {
2711
3218
  //#region src/views/panel/DrawingTransform.tsx
2712
3219
  const INPUT_DEBOUNCE_TIME = 300;
2713
3220
  const DrawingTransform = (props) => {
2714
- var _scene$getEngine;
3221
+ var _renderManagerService, _scene$getEngine;
3222
+ const renderManagerService = useDependency(IRenderManagerService);
3223
+ const drawingParam = props.drawings[0];
3224
+ const scene = drawingParam ? (_renderManagerService = renderManagerService.getRenderById(drawingParam.unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.scene : void 0;
3225
+ const topScene = scene === null || scene === void 0 || (_scene$getEngine = scene.getEngine()) === null || _scene$getEngine === void 0 ? void 0 : _scene$getEngine.activeScene;
3226
+ if (!(drawingParam === null || drawingParam === void 0 ? void 0 : drawingParam.transform) || !scene || !topScene) return null;
3227
+ return /* @__PURE__ */ jsx(DrawingTransformContent, { ...props });
3228
+ };
3229
+ function DrawingTransformContent(props) {
2715
3230
  const localeService = useDependency(LocaleService);
2716
3231
  const drawingManagerService = useDependency(IDrawingManagerService);
2717
3232
  const renderManagerService = useDependency(IRenderManagerService);
2718
3233
  const { drawings, transformShow } = props;
2719
3234
  const drawingParam = drawings[0];
2720
- if (drawingParam == null) return;
2721
3235
  const transform = drawingParam.transform;
2722
- if (transform == null) return;
2723
3236
  const { unitId, subUnitId, drawingId, drawingType } = drawingParam;
2724
- const renderObject = renderManagerService.getRenderById(unitId);
2725
- const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
2726
- if (scene == null) return;
2727
- const topScene = (_scene$getEngine = scene.getEngine()) === null || _scene$getEngine === void 0 ? void 0 : _scene$getEngine.activeScene;
2728
- if (topScene == null) return;
3237
+ const scene = renderManagerService.getRenderById(unitId).scene;
3238
+ const topScene = scene.getEngine().activeScene;
2729
3239
  const transformer = scene.getTransformerByCreate();
2730
3240
  const { width: originWidth = 0, height: originHeight = 0, left: originX = 0, top: originY = 0, angle: originRotation = 0 } = transform;
2731
3241
  const [width, setWidth] = useState(originWidth);
@@ -2956,7 +3466,7 @@ const DrawingTransform = (props) => {
2956
3466
  })
2957
3467
  ]
2958
3468
  });
2959
- };
3469
+ }
2960
3470
 
2961
3471
  //#endregion
2962
3472
  //#region src/views/panel/ImageCropper.tsx
@@ -2967,7 +3477,7 @@ const ImageCropper = (props) => {
2967
3477
  const componentManager = useDependency(ComponentManager);
2968
3478
  const canUseShapeClip = useObservable(clipService.canUseShapeClip$, false);
2969
3479
  const { drawings, cropperShow } = props;
2970
- if (drawings[0] == null) return;
3480
+ const drawingParam = drawings[0];
2971
3481
  const [cropValue, setCropValue] = useState("0");
2972
3482
  const cropStateRef = useRef(false);
2973
3483
  const cropOptions = [
@@ -3023,6 +3533,7 @@ const ImageCropper = (props) => {
3023
3533
  onChangeStartObserver === null || onChangeStartObserver === void 0 || onChangeStartObserver.dispose();
3024
3534
  };
3025
3535
  }, []);
3536
+ if (drawingParam == null) return null;
3026
3537
  function handleCropChange(value) {
3027
3538
  setCropValue(value);
3028
3539
  if (cropStateRef.current) commandService.executeCommand(AutoImageCropOperation.id, { cropType: value });
@@ -3090,78 +3601,11 @@ const DrawingCommonPanel = (props) => {
3090
3601
  const localeService = useDependency(LocaleService);
3091
3602
  const { drawings, hasArrange = true, hasTransform = true, hasAlign = true, hasCropper = true, hasGroup = true } = props;
3092
3603
  const drawingParam = drawings[0];
3093
- if (drawingParam == null) return;
3094
- const { unitId } = drawingParam;
3095
- const renderObject = renderManagerService.getRenderById(unitId);
3604
+ const renderObject = drawingParam ? renderManagerService.getRenderById(drawingParam.unitId) : void 0;
3096
3605
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
3097
- if (scene == null) return;
3098
- const transformer = scene.getTransformerByCreate();
3099
- const initialShowState = getPanelShowState(drawings);
3100
- const [arrangeShow, setArrangeShow] = useState(initialShowState.arrangeShow);
3101
- const [transformShow, setTransformShow] = useState(initialShowState.transformShow);
3102
- const [alignShow, setAlignShow] = useState(initialShowState.alignShow);
3103
- const [cropperShow, setCropperShow] = useState(initialShowState.cropperShow);
3104
- const [nullShow, setNullShow] = useState(initialShowState.nullShow);
3105
- useEffect(() => {
3106
- const clearControlSub = transformer.clearControl$.subscribe((changeSelf) => {
3107
- if (changeSelf === true) {
3108
- setArrangeShow(false);
3109
- setTransformShow(false);
3110
- setAlignShow(false);
3111
- setCropperShow(false);
3112
- setNullShow(true);
3113
- }
3114
- });
3115
- const changeStartSub = transformer.changeStart$.subscribe((state) => {
3116
- const { objects } = state;
3117
- const params = getUpdateParams(objects, drawingManagerService);
3118
- if (params.length === 0) {
3119
- setArrangeShow(false);
3120
- setTransformShow(false);
3121
- setAlignShow(false);
3122
- setCropperShow(false);
3123
- setNullShow(true);
3124
- } else if (params.length === 1) {
3125
- setArrangeShow(true);
3126
- setTransformShow(true);
3127
- setAlignShow(false);
3128
- setCropperShow(true);
3129
- setNullShow(false);
3130
- } else {
3131
- setArrangeShow(true);
3132
- setTransformShow(false);
3133
- setAlignShow(true);
3134
- setCropperShow(false);
3135
- setNullShow(false);
3136
- }
3137
- });
3138
- const focusSub = drawingManagerService.focus$.subscribe((drawings) => {
3139
- if (drawings.length === 0) {
3140
- setArrangeShow(false);
3141
- setTransformShow(false);
3142
- setAlignShow(false);
3143
- setCropperShow(false);
3144
- setNullShow(true);
3145
- } else if (drawings.length === 1) {
3146
- setArrangeShow(true);
3147
- setTransformShow(true);
3148
- setAlignShow(false);
3149
- setCropperShow(true);
3150
- setNullShow(false);
3151
- } else {
3152
- setArrangeShow(true);
3153
- setTransformShow(false);
3154
- setAlignShow(true);
3155
- setCropperShow(false);
3156
- setNullShow(false);
3157
- }
3158
- });
3159
- return () => {
3160
- changeStartSub.unsubscribe();
3161
- clearControlSub.unsubscribe();
3162
- focusSub.unsubscribe();
3163
- };
3164
- }, []);
3606
+ const transformer = scene === null || scene === void 0 ? void 0 : scene.getTransformerByCreate();
3607
+ const { arrangeShow, transformShow, alignShow, cropperShow, nullShow } = useObservable(() => merge$1(drawingManagerService.focus$.pipe(map(getPanelShowState)), ...transformer ? [transformer.clearControl$.pipe(filter((changeSelf) => changeSelf === true), map(() => getPanelShowState([]))), transformer.changeStart$.pipe(map((state) => getPanelShowState(getUpdateParams(state.objects, drawingManagerService))))] : []), getPanelShowState(drawings), false, [drawingManagerService, transformer]);
3608
+ if (!drawingParam || !scene || !transformer) return null;
3165
3609
  return /* @__PURE__ */ jsxs(Fragment, { children: [
3166
3610
  /* @__PURE__ */ jsx("div", {
3167
3611
  className: clsx("univer-h-full", { "univer-hidden": !nullShow }),
@@ -3194,4 +3638,4 @@ const DrawingCommonPanel = (props) => {
3194
3638
  };
3195
3639
 
3196
3640
  //#endregion
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 };
3641
+ export { AutoImageCropOperation, COMPONENT_IMAGE_POPUP_MENU, CancelDrawingGroupOperation, CloseImageCropOperation, DRAWING_GROUP_TYPES, DrawingCommonPanel, DrawingImageClipService, DrawingRenderService, menuSchema as DrawingUIMenuSchema, IMAGE_CLIP_SHAPE_PICKER_COMPONENT, ImageCropperObject, ImageResetSizeOperation, OBJECT_LIST_CANVAS_SECTION_ID, OBJECT_LIST_FLOATING_SECTION_ID, ObjectListPanelBase, OpenImageCropOperation, SetDrawingAlignOperation, SetDrawingArrangeOperation, SetDrawingGroupOperation, UniverDrawingUIPlugin, disposeDrawingRenderObject, getCurrentUnitInfo, getDrawingRenderObject, getObjectListPanelLabels, getObjectListPanelSectionIdForDrawingType, getObjectListPanelTypeName, getUpdateParams, insertGroupObject, isFloatingObjectListDrawingType };