@univerjs/drawing-ui 1.0.0-alpha.8 → 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/lib/cjs/index.js +142 -108
  2. package/lib/cjs/locale/ar-SA.js +1 -19
  3. package/lib/cjs/locale/ca-ES.js +1 -19
  4. package/lib/cjs/locale/de-DE.js +1 -19
  5. package/lib/cjs/locale/en-US.js +1 -19
  6. package/lib/cjs/locale/es-ES.js +1 -19
  7. package/lib/cjs/locale/fa-IR.js +1 -19
  8. package/lib/cjs/locale/fr-FR.js +1 -19
  9. package/lib/cjs/locale/id-ID.js +1 -19
  10. package/lib/cjs/locale/it-IT.js +1 -19
  11. package/lib/cjs/locale/ja-JP.js +1 -19
  12. package/lib/cjs/locale/ko-KR.js +1 -19
  13. package/lib/cjs/locale/pl-PL.js +1 -19
  14. package/lib/cjs/locale/pt-BR.js +1 -19
  15. package/lib/cjs/locale/ru-RU.js +1 -19
  16. package/lib/cjs/locale/sk-SK.js +1 -19
  17. package/lib/cjs/locale/vi-VN.js +1 -19
  18. package/lib/cjs/locale/zh-CN.js +1 -19
  19. package/lib/cjs/locale/zh-HK.js +1 -19
  20. package/lib/cjs/locale/zh-TW.js +1 -19
  21. package/lib/es/index.js +145 -111
  22. package/lib/es/locale/ar-SA.js +1 -19
  23. package/lib/es/locale/ca-ES.js +1 -19
  24. package/lib/es/locale/de-DE.js +1 -19
  25. package/lib/es/locale/en-US.js +1 -19
  26. package/lib/es/locale/es-ES.js +1 -19
  27. package/lib/es/locale/fa-IR.js +1 -19
  28. package/lib/es/locale/fr-FR.js +1 -19
  29. package/lib/es/locale/id-ID.js +1 -19
  30. package/lib/es/locale/it-IT.js +1 -19
  31. package/lib/es/locale/ja-JP.js +1 -19
  32. package/lib/es/locale/ko-KR.js +1 -19
  33. package/lib/es/locale/pl-PL.js +1 -19
  34. package/lib/es/locale/pt-BR.js +1 -19
  35. package/lib/es/locale/ru-RU.js +1 -19
  36. package/lib/es/locale/sk-SK.js +1 -19
  37. package/lib/es/locale/vi-VN.js +1 -19
  38. package/lib/es/locale/zh-CN.js +1 -19
  39. package/lib/es/locale/zh-HK.js +1 -19
  40. package/lib/es/locale/zh-TW.js +1 -19
  41. package/lib/index.css +28 -10
  42. package/lib/index.js +145 -111
  43. package/lib/locale/ar-SA.js +1 -19
  44. package/lib/locale/ca-ES.js +1 -19
  45. package/lib/locale/de-DE.js +1 -19
  46. package/lib/locale/en-US.js +1 -19
  47. package/lib/locale/es-ES.js +1 -19
  48. package/lib/locale/fa-IR.js +1 -19
  49. package/lib/locale/fr-FR.js +1 -19
  50. package/lib/locale/id-ID.js +1 -19
  51. package/lib/locale/it-IT.js +1 -19
  52. package/lib/locale/ja-JP.js +1 -19
  53. package/lib/locale/ko-KR.js +1 -19
  54. package/lib/locale/pl-PL.js +1 -19
  55. package/lib/locale/pt-BR.js +1 -19
  56. package/lib/locale/ru-RU.js +1 -19
  57. package/lib/locale/sk-SK.js +1 -19
  58. package/lib/locale/vi-VN.js +1 -19
  59. package/lib/locale/zh-CN.js +1 -19
  60. package/lib/locale/zh-HK.js +1 -19
  61. package/lib/locale/zh-TW.js +1 -19
  62. package/lib/types/commands/operations/image-crop.operation.d.ts +4 -2
  63. package/lib/types/controllers/image-cropper.controller.d.ts +10 -2
  64. package/lib/types/locale/en-US.d.ts +0 -18
  65. package/lib/types/views/image-popup-menu/ImagePopupMenu.d.ts +1 -0
  66. package/lib/umd/index.js +2 -2
  67. package/lib/umd/locale/ar-SA.js +1 -1
  68. package/lib/umd/locale/ca-ES.js +1 -1
  69. package/lib/umd/locale/de-DE.js +1 -1
  70. package/lib/umd/locale/en-US.js +1 -1
  71. package/lib/umd/locale/es-ES.js +1 -1
  72. package/lib/umd/locale/fa-IR.js +1 -1
  73. package/lib/umd/locale/fr-FR.js +1 -1
  74. package/lib/umd/locale/id-ID.js +1 -1
  75. package/lib/umd/locale/it-IT.js +1 -1
  76. package/lib/umd/locale/ja-JP.js +1 -1
  77. package/lib/umd/locale/ko-KR.js +1 -1
  78. package/lib/umd/locale/pl-PL.js +1 -1
  79. package/lib/umd/locale/pt-BR.js +1 -1
  80. package/lib/umd/locale/ru-RU.js +1 -1
  81. package/lib/umd/locale/sk-SK.js +1 -1
  82. package/lib/umd/locale/vi-VN.js +1 -1
  83. package/lib/umd/locale/zh-CN.js +1 -1
  84. package/lib/umd/locale/zh-HK.js +1 -1
  85. package/lib/umd/locale/zh-TW.js +1 -1
  86. package/package.json +9 -9
package/lib/cjs/index.js CHANGED
@@ -237,21 +237,21 @@ const CancelDrawingGroupOperation = {
237
237
  const OpenImageCropOperation = {
238
238
  id: "sheet.operation.open-image-crop",
239
239
  type: _univerjs_core.CommandType.OPERATION,
240
- handler: (accessor, params) => {
240
+ handler: (_accessor, _params) => {
241
241
  return true;
242
242
  }
243
243
  };
244
244
  const CloseImageCropOperation = {
245
245
  id: "sheet.operation.close-image-crop",
246
246
  type: _univerjs_core.CommandType.OPERATION,
247
- handler: (accessor, params) => {
247
+ handler: (_accessor, _params) => {
248
248
  return true;
249
249
  }
250
250
  };
251
251
  const AutoImageCropOperation = {
252
252
  id: "sheet.operation.Auto-image-crop",
253
253
  type: _univerjs_core.CommandType.OPERATION,
254
- handler: (accessor, params) => {
254
+ handler: (_accessor, _params) => {
255
255
  return true;
256
256
  }
257
257
  };
@@ -272,19 +272,17 @@ function isKnownDrawingUINonRotatableType(drawingType) {
272
272
  return drawingType === _univerjs_core.DrawingTypeEnum.DRAWING_CHART;
273
273
  }
274
274
  function resolveDrawingUIRotateEnabled(drawing, options = {}) {
275
- var _options$isKnownNonRo;
276
275
  return (0, _univerjs_drawing.resolveDrawingRotateEnabled)(drawing, {
277
276
  ...options,
278
- isKnownNonRotatableType: (_options$isKnownNonRo = options.isKnownNonRotatableType) !== null && _options$isKnownNonRo !== void 0 ? _options$isKnownNonRo : isKnownDrawingUINonRotatableType
277
+ isKnownNonRotatableType: options.isKnownNonRotatableType ?? isKnownDrawingUINonRotatableType
279
278
  });
280
279
  }
281
280
 
282
281
  //#endregion
283
282
  //#region src/controllers/utils.ts
284
283
  function getDrawingRenderObject(scene, drawingSearch) {
285
- var _scene$getObjectInclu;
286
284
  const key = (0, _univerjs_drawing.getDrawingShapeKeyByDrawingSearch)(drawingSearch);
287
- return (_scene$getObjectInclu = scene.getObjectIncludeInGroup(key)) !== null && _scene$getObjectInclu !== void 0 ? _scene$getObjectInclu : null;
285
+ return scene.getObjectIncludeInGroup(key) ?? null;
288
286
  }
289
287
  function disposeDrawingRenderObject(scene, drawingSearch) {
290
288
  const object = getDrawingRenderObject(scene, drawingSearch);
@@ -627,7 +625,7 @@ const menuSchema = { [_univerjs_ui.ContextMenuPosition.DRAWING]: { [_univerjs_ui
627
625
  //#endregion
628
626
  //#region package.json
629
627
  var name = "@univerjs/drawing-ui";
630
- var version = "1.0.0-alpha.8";
628
+ var version = "1.0.0-beta.1";
631
629
 
632
630
  //#endregion
633
631
  //#region src/config/config.ts
@@ -700,11 +698,11 @@ function ImagePopupMenu(props) {
700
698
  open: visible,
701
699
  onOpenChange: onVisibleChange,
702
700
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
703
- className: (0, _univerjs_design.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", _univerjs_design.borderClassName, {
701
+ className: (0, _univerjs_design.clsx)("univer-flex univer-items-center univer-gap-2 univer-rounded univer-p-1 univer-text-gray-900 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-800", _univerjs_design.borderClassName, {
704
702
  "univer-bg-gray-100 dark:!univer-bg-gray-800": visible,
705
- "univer-bg-white dark:!univer-bg-gray-900": !visible
703
+ "univer-bg-gray-0 dark:!univer-bg-gray-900": !visible
706
704
  }),
707
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.AutofillDoubleIcon, { className: "univer-fill-primary-600 univer-text-gray-900 dark:!univer-text-white" }), showMore && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, { className: "dark:!univer-text-white" })]
705
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.AutofillDoubleIcon, { className: "univer-fill-primary-600 univer-text-gray-900 dark:!univer-text-gray-0" }), showMore && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, { className: "dark:!univer-text-gray-0" })]
708
706
  })
709
707
  })
710
708
  });
@@ -727,7 +725,7 @@ function ToolbarGroup(props) {
727
725
  }
728
726
  function ToolbarButton(props) {
729
727
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Tooltip, {
730
- title: (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService).t(props.titleKey),
728
+ title: props.title,
731
729
  placement: "bottom",
732
730
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
733
731
  type: "button",
@@ -739,14 +737,13 @@ function ToolbarButton(props) {
739
737
  });
740
738
  }
741
739
  function ToolbarDropdownButton(props) {
742
- var _props$options$find;
743
740
  const [open, setOpen] = (0, react.useState)(false);
744
- 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];
741
+ const activeOption = props.options.find((option) => option.value === props.value) ?? props.options[0];
745
742
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
746
743
  open,
747
744
  onOpenChange: setOpen,
748
745
  overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
749
- 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",
746
+ className: "univer-min-w-32 univer-rounded-lg univer-border univer-border-solid univer-border-gray-200 univer-bg-gray-0 univer-p-1 univer-shadow-lg dark:!univer-border-gray-700 dark:!univer-bg-gray-900",
750
747
  children: props.options.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
751
748
  type: "button",
752
749
  onClick: () => {
@@ -775,11 +772,11 @@ function ToolbarDropdownButton(props) {
775
772
  });
776
773
  }
777
774
  function DocImageFloatingToolbar(props) {
778
- var _univerInstanceServic, _wrappingStyleOptions, _wrappingStyleOptions2;
775
+ var _wrappingStyleOptions;
779
776
  const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
780
777
  const iconManager = (0, _univerjs_ui.useDependency)(_univerjs_ui.IconManager);
781
778
  const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
782
- const documentDataModel = (_univerInstanceServic = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService).getUnit(props.unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC)) !== null && _univerInstanceServic !== void 0 ? _univerInstanceServic : void 0;
779
+ const documentDataModel = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService).getUnit(props.unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC) ?? void 0;
783
780
  const [wrappingStyle, setWrappingStyle] = (0, react.useState)(() => getWrappingStyle(documentDataModel, props.drawingId));
784
781
  const [hidden, setHidden] = (0, react.useState)(false);
785
782
  const actionItems = props.menuItems.filter((item) => item.type !== "select" && item.icon).sort((a, b) => a.index - b.index);
@@ -835,16 +832,16 @@ function DocImageFloatingToolbar(props) {
835
832
  event.stopPropagation();
836
833
  event.preventDefault();
837
834
  },
838
- className: (0, _univerjs_design.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", _univerjs_design.borderClassName),
835
+ className: (0, _univerjs_design.clsx)("univer-box-border univer-flex univer-items-center univer-rounded univer-bg-gray-0 univer-px-1 univer-py-1 univer-shadow-sm dark:!univer-border-gray-700 dark:!univer-bg-gray-900", _univerjs_design.borderClassName),
839
836
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarGroup, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarDropdownButton, {
840
- 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"),
837
+ title: ((_wrappingStyleOptions = wrappingStyleOptions.find((option) => option.value === wrappingStyle)) === null || _wrappingStyleOptions === void 0 ? void 0 : _wrappingStyleOptions.label) ?? localeService.t("drawing-ui.image-text-wrap.inline"),
841
838
  value: wrappingStyle,
842
839
  options: wrappingStyleOptions,
843
840
  onChange: updateWrappingStyle
844
841
  }) }), actionItems.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Separator, { orientation: "vertical" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarGroup, { children: actionItems.map((item) => {
845
842
  const Icon = iconManager.get(item.icon);
846
843
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
847
- titleKey: item.label,
844
+ title: localeService.t(item.label),
848
845
  disabled: item.disable,
849
846
  onClick: () => executeMenuItem(item),
850
847
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {})
@@ -853,18 +850,21 @@ function DocImageFloatingToolbar(props) {
853
850
  });
854
851
  }
855
852
  function DocChartFloatingToolbar(props) {
856
- var _chartTypeItem$option, _ref, _chartTypeItem$value, _chartTypeOptions$;
853
+ var _chartTypeOptions$;
857
854
  const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
858
855
  const iconManager = (0, _univerjs_ui.useDependency)(_univerjs_ui.IconManager);
859
856
  const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
860
857
  const [hidden, setHidden] = (0, react.useState)(false);
861
858
  const chartTypeItem = props.menuItems.find((item) => item.type === "select");
862
859
  const actionItems = props.menuItems.filter((item) => item.type !== "select" && item.icon).sort((a, b) => a.index - b.index);
863
- const chartTypeOptions = ((_chartTypeItem$option = chartTypeItem === null || chartTypeItem === void 0 ? void 0 : chartTypeItem.options) !== null && _chartTypeItem$option !== void 0 ? _chartTypeItem$option : []).map((option) => ({
864
- label: String(option.label),
865
- value: option.value,
866
- icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.ChartIcon, {})
867
- }));
860
+ const chartTypeOptions = ((chartTypeItem === null || chartTypeItem === void 0 ? void 0 : chartTypeItem.options) ?? []).map((option) => {
861
+ const Icon = option.icon ? iconManager.get(option.icon) : _univerjs_icons.ChartIcon;
862
+ return {
863
+ label: String(option.label),
864
+ value: option.value,
865
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {})
866
+ };
867
+ });
868
868
  const executeMenuItem = (item) => {
869
869
  if (!item || item.disable) return;
870
870
  if (item.hideOnClick) setHidden(true);
@@ -877,10 +877,10 @@ function DocChartFloatingToolbar(props) {
877
877
  event.stopPropagation();
878
878
  event.preventDefault();
879
879
  },
880
- className: (0, _univerjs_design.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", _univerjs_design.borderClassName),
880
+ className: (0, _univerjs_design.clsx)("univer-box-border univer-flex univer-items-center univer-rounded univer-bg-gray-0 univer-px-1 univer-py-1 univer-shadow-sm dark:!univer-border-gray-700 dark:!univer-bg-gray-900", _univerjs_design.borderClassName),
881
881
  children: [chartTypeItem && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarGroup, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarDropdownButton, {
882
882
  title: localeService.t(chartTypeItem.label),
883
- 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 : "",
883
+ value: chartTypeItem.value ?? ((_chartTypeOptions$ = chartTypeOptions[0]) === null || _chartTypeOptions$ === void 0 ? void 0 : _chartTypeOptions$.value) ?? "",
884
884
  options: chartTypeOptions,
885
885
  onChange: (value) => {
886
886
  if (!chartTypeItem.disable) {
@@ -891,7 +891,7 @@ function DocChartFloatingToolbar(props) {
891
891
  }) }), actionItems.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Separator, { orientation: "vertical" })] }), actionItems.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarGroup, { children: actionItems.map((item) => {
892
892
  const Icon = iconManager.get(item.icon);
893
893
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
894
- titleKey: item.label,
894
+ title: localeService.t(item.label),
895
895
  disabled: item.disable,
896
896
  onClick: () => executeMenuItem(item),
897
897
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {})
@@ -1957,7 +1957,7 @@ var ImageCropperObject = class extends _univerjs_engine_render.Shape {
1957
1957
  //#endregion
1958
1958
  //#region src/controllers/image-cropper.controller.ts
1959
1959
  let ImageCropperController = class ImageCropperController extends _univerjs_core.Disposable {
1960
- constructor(_commandService, _drawingManagerService, _renderManagerService, _univerInstanceService, _messageService, _localeService) {
1960
+ constructor(_commandService, _drawingManagerService, _renderManagerService, _univerInstanceService, _messageService, _localeService, _shortcutService) {
1961
1961
  super();
1962
1962
  this._commandService = _commandService;
1963
1963
  this._drawingManagerService = _drawingManagerService;
@@ -1965,7 +1965,13 @@ let ImageCropperController = class ImageCropperController extends _univerjs_core
1965
1965
  this._univerInstanceService = _univerInstanceService;
1966
1966
  this._messageService = _messageService;
1967
1967
  this._localeService = _localeService;
1968
+ this._shortcutService = _shortcutService;
1968
1969
  _defineProperty(this, "_sceneListenerOnImageMap", /* @__PURE__ */ new WeakSet());
1970
+ _defineProperty(this, "_cropShortcutDisposables", new _univerjs_core.DisposableCollection());
1971
+ _defineProperty(this, "_cropSnapshots", /* @__PURE__ */ new WeakMap());
1972
+ _defineProperty(this, "_pendingCropSnapshot", null);
1973
+ _defineProperty(this, "_activeCropSession", null);
1974
+ this.disposeWithMe(this._cropShortcutDisposables);
1969
1975
  this._init();
1970
1976
  }
1971
1977
  _init() {
@@ -2000,12 +2006,17 @@ let ImageCropperController = class ImageCropperController extends _univerjs_core
2000
2006
  return;
2001
2007
  }
2002
2008
  if (imageShape == null) return;
2003
- this._updateCropperObject(cropType, imageShape);
2004
- this._commandService.executeCommand(OpenImageCropOperation.id, {
2005
- unitId,
2006
- subUnitId,
2007
- drawingId
2008
- });
2009
+ this._pendingCropSnapshot = this._captureCropSnapshot(imageShape);
2010
+ try {
2011
+ this._updateCropperObject(cropType, imageShape);
2012
+ this._commandService.syncExecuteCommand(OpenImageCropOperation.id, {
2013
+ unitId,
2014
+ subUnitId,
2015
+ drawingId
2016
+ });
2017
+ } finally {
2018
+ this._pendingCropSnapshot = null;
2019
+ }
2009
2020
  }));
2010
2021
  }
2011
2022
  _calculateSrcRectByRatio(left, top, width, height, numerator, denominator) {
@@ -2073,6 +2084,7 @@ let ImageCropperController = class ImageCropperController extends _univerjs_core
2073
2084
  if (command.id !== OpenImageCropOperation.id) return;
2074
2085
  const params = command.params;
2075
2086
  if (params == null) return;
2087
+ if (this._activeCropSession != null) this._commandService.syncExecuteCommand(CloseImageCropOperation.id, { isAuto: true });
2076
2088
  const { unitId, subUnitId, drawingId } = params;
2077
2089
  const renderObject = this._renderManagerService.getRenderUnitById(unitId);
2078
2090
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
@@ -2107,12 +2119,20 @@ let ImageCropperController = class ImageCropperController extends _univerjs_core
2107
2119
  prstGeom: imageShape.prstGeom,
2108
2120
  applyTransform: imageShape.calculateTransformWithSrcRect()
2109
2121
  });
2122
+ this._cropSnapshots.set(imageCropperObject, this._pendingCropSnapshot ?? this._captureCropSnapshot(imageShape));
2123
+ this._pendingCropSnapshot = null;
2110
2124
  scene.addObject(imageCropperObject, imageShape.getLayerIndex() + 1).attachTransformerTo(imageCropperObject);
2125
+ this._activeCropSession = {
2126
+ scene,
2127
+ imageShape,
2128
+ imageCropperObject
2129
+ };
2111
2130
  transformer === null || transformer === void 0 || transformer.createControlForCopper(imageCropperObject);
2112
2131
  this._addHoverForImageCopper(imageCropperObject);
2113
2132
  imageShape.openRenderByCropper();
2114
2133
  transformer === null || transformer === void 0 || transformer.refreshControls();
2115
2134
  imageCropperObject.makeDirty(true);
2135
+ this._registerCropShortcuts();
2116
2136
  this._commandService.syncExecuteCommand(_univerjs_drawing.SetDrawingSelectedOperation.id, [{
2117
2137
  unitId,
2118
2138
  subUnitId,
@@ -2127,39 +2147,40 @@ let ImageCropperController = class ImageCropperController extends _univerjs_core
2127
2147
  _initCloseCrop() {
2128
2148
  this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
2129
2149
  if (command.id !== CloseImageCropOperation.id) return;
2130
- const currentUnit = this._univerInstanceService.getFocusedUnit();
2131
- if (currentUnit == null) return;
2132
- const unitId = currentUnit.getUnitId();
2133
- const renderObject = this._renderManagerService.getRenderUnitById(unitId);
2134
- const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
2135
- if (scene == null) return true;
2136
- const imageCropperObject = this._searchCropObject(scene);
2137
- if (imageCropperObject == null) return;
2138
- const imageShape = this._getApplyObjectByCropObject(imageCropperObject);
2139
- if (imageShape == null) return;
2150
+ const cropSession = this._activeCropSession;
2151
+ if (cropSession == null) return;
2152
+ const { scene, imageShape, imageCropperObject } = cropSession;
2140
2153
  const transformer = scene.getTransformerByCreate();
2141
2154
  transformer.detachFrom(imageCropperObject);
2142
2155
  transformer.clearCopperControl();
2143
- const srcRect = this._getSrcRectByTransformState(imageShape, imageCropperObject);
2144
- const drawingParam = this._drawingManagerService.getDrawingOKey(imageShape.oKey);
2145
- if (drawingParam != null) {
2146
- const { left, top, height, width } = imageCropperObject;
2147
- this._drawingManagerService.featurePluginUpdateNotification([{
2148
- ...drawingParam,
2149
- transform: {
2150
- ...drawingParam.transform,
2151
- left,
2152
- top,
2153
- height,
2154
- width
2155
- },
2156
- srcRect: srcRect.srcRectAngle
2157
- }]);
2156
+ const params = command.params;
2157
+ if (params === null || params === void 0 ? void 0 : params.isCancel) this._restoreCropSnapshot(imageShape, imageCropperObject);
2158
+ else {
2159
+ const srcRect = this._getSrcRectByTransformState(imageShape, imageCropperObject);
2160
+ const drawingParam = this._drawingManagerService.getDrawingOKey(imageShape.oKey);
2161
+ if (drawingParam != null) {
2162
+ const { left, top, height, width } = imageCropperObject;
2163
+ this._drawingManagerService.featurePluginUpdateNotification([{
2164
+ ...drawingParam,
2165
+ transform: {
2166
+ ...drawingParam.transform,
2167
+ left,
2168
+ top,
2169
+ height,
2170
+ width
2171
+ },
2172
+ srcRect: srcRect.srcRectAngle
2173
+ }]);
2174
+ }
2175
+ imageShape.setSrcRect({ ...srcRect.srcRectAngle });
2158
2176
  }
2159
- imageShape.setSrcRect({ ...srcRect.srcRectAngle });
2160
2177
  imageShape.closeRenderByCropper();
2161
2178
  imageShape.makeDirty(true);
2162
- imageCropperObject === null || imageCropperObject === void 0 || imageCropperObject.dispose();
2179
+ transformer.refreshControls();
2180
+ this._cropSnapshots.delete(imageCropperObject);
2181
+ imageCropperObject.dispose();
2182
+ this._activeCropSession = null;
2183
+ this._cropShortcutDisposables.dispose();
2163
2184
  }));
2164
2185
  const sheetUnit$ = this._univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).pipe((0, rxjs.switchMap)((workbook) => workbook ? workbook.activeSheet$ : (0, rxjs.of)(null)));
2165
2186
  this.disposeWithMe(sheetUnit$.subscribe(() => {
@@ -2175,6 +2196,33 @@ let ImageCropperController = class ImageCropperController extends _univerjs_core
2175
2196
  if (applyObject == null) return null;
2176
2197
  return applyObject;
2177
2198
  }
2199
+ _captureCropSnapshot(imageShape) {
2200
+ return {
2201
+ transform: imageShape.getState(),
2202
+ srcRect: imageShape.srcRect == null ? imageShape.srcRect : { ...imageShape.srcRect }
2203
+ };
2204
+ }
2205
+ _restoreCropSnapshot(imageShape, imageCropperObject) {
2206
+ const snapshot = this._cropSnapshots.get(imageCropperObject);
2207
+ if (snapshot) {
2208
+ imageShape.transformByStateCloseCropper(snapshot.transform);
2209
+ imageShape.setSrcRect(snapshot.srcRect);
2210
+ }
2211
+ }
2212
+ _registerCropShortcuts() {
2213
+ this._cropShortcutDisposables.dispose();
2214
+ this._cropShortcutDisposables.add(this._shortcutService.registerShortcut({
2215
+ id: CloseImageCropOperation.id,
2216
+ binding: _univerjs_ui.KeyCode.ENTER,
2217
+ priority: 1e3
2218
+ }));
2219
+ this._cropShortcutDisposables.add(this._shortcutService.registerShortcut({
2220
+ id: CloseImageCropOperation.id,
2221
+ binding: _univerjs_ui.KeyCode.ESC,
2222
+ priority: 1e3,
2223
+ staticParameters: { isCancel: true }
2224
+ }));
2225
+ }
2178
2226
  _addListenerOnImage(scene) {
2179
2227
  const transformer = scene.getTransformerByCreate();
2180
2228
  let startTransform = null;
@@ -2227,8 +2275,8 @@ let ImageCropperController = class ImageCropperController extends _univerjs_core
2227
2275
  }));
2228
2276
  }
2229
2277
  _getSrcRectByTransformState(applyObject, imageCropperObject) {
2230
- const { left, top, height, width, strokeWidth, angle: copperAngle } = imageCropperObject;
2231
- const { left: applyLeft, top: applyTop, width: applyWidth, height: applyHeight, angle: applyAngle, strokeWidth: applyStrokeWidth } = applyObject;
2278
+ const { left, top, height, width } = imageCropperObject;
2279
+ const { left: applyLeft, top: applyTop, width: applyWidth, height: applyHeight, angle: applyAngle } = applyObject;
2232
2280
  const newLeft = left - applyLeft;
2233
2281
  const newTop = top - applyTop;
2234
2282
  const srcRect = {
@@ -2264,7 +2312,8 @@ ImageCropperController = __decorate([
2264
2312
  __decorateParam(2, _univerjs_engine_render.IRenderManagerService),
2265
2313
  __decorateParam(3, _univerjs_core.IUniverInstanceService),
2266
2314
  __decorateParam(4, _univerjs_ui.IMessageService),
2267
- __decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService))
2315
+ __decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService)),
2316
+ __decorateParam(6, _univerjs_ui.IShortcutService)
2268
2317
  ], ImageCropperController);
2269
2318
 
2270
2319
  //#endregion
@@ -2536,7 +2585,7 @@ _defineProperty(UniverDrawingUIPlugin, "pluginName", "UNIVER_DRAWING_UI_PLUGIN")
2536
2585
  _defineProperty(UniverDrawingUIPlugin, "packageName", name);
2537
2586
  _defineProperty(UniverDrawingUIPlugin, "version", version);
2538
2587
  UniverDrawingUIPlugin = __decorate([
2539
- (0, _univerjs_core.DependentOn)(_univerjs_drawing.UniverDrawingPlugin, _univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_ui.UniverUIPlugin),
2588
+ (0, _univerjs_core.DependentOn)(_univerjs_drawing.UniverDrawingPlugin, _univerjs_engine_render.UniverRenderEnginePlugin),
2540
2589
  __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
2541
2590
  __decorateParam(2, _univerjs_core.IConfigService)
2542
2591
  ], UniverDrawingUIPlugin);
@@ -2605,21 +2654,17 @@ function normalizeText(value) {
2605
2654
  return value.trim();
2606
2655
  }
2607
2656
  function hasCapability(panelCapabilities, item, key, fallback = true) {
2608
- var _ref, _item$capabilities$ke, _item$capabilities;
2609
- 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;
2657
+ var _item$capabilities;
2658
+ return (item === null || item === void 0 || (_item$capabilities = item.capabilities) === null || _item$capabilities === void 0 ? void 0 : _item$capabilities[key]) ?? (panelCapabilities === null || panelCapabilities === void 0 ? void 0 : panelCapabilities[key]) ?? fallback;
2610
2659
  }
2611
2660
  function ObjectListPanelBase(props) {
2612
- var _selectedItem$canMove, _selectedItem$canMove2, _capabilities$reorder;
2613
2661
  const { items, selectedIds, allObjectIds, focusedId, labels, showHeader = true, capabilities, onSelect, onSetVisible, onCommitName, onCommitDescription, onMoveForward, onMoveBackward, onToggleExpanded, onToggleSelectable, onLocate, onReorder } = props;
2614
2662
  const selectedIdSet = (0, react.useMemo)(() => new Set(selectedIds), [selectedIds]);
2615
2663
  const [draggingId, setDraggingId] = (0, react.useState)(null);
2616
2664
  const [searchQuery, setSearchQuery] = (0, react.useState)("");
2617
2665
  const [filterMode, setFilterMode] = (0, react.useState)("all");
2618
2666
  const [collapsedSectionIds, setCollapsedSectionIds] = (0, react.useState)(() => /* @__PURE__ */ new Set());
2619
- const selectedItem = (0, react.useMemo)(() => {
2620
- var _ref2, _items$find;
2621
- 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;
2622
- }, [
2667
+ const selectedItem = (0, react.useMemo)(() => items.find((item) => item.id === focusedId) ?? items.find((item) => selectedIdSet.has(item.id)) ?? null, [
2623
2668
  focusedId,
2624
2669
  items,
2625
2670
  selectedIdSet
@@ -2627,11 +2672,10 @@ function ObjectListPanelBase(props) {
2627
2672
  const visibleItems = (0, react.useMemo)(() => {
2628
2673
  const normalizedQuery = normalizeText(searchQuery).toLocaleLowerCase();
2629
2674
  return items.filter((item) => {
2630
- var _item$description;
2631
2675
  if (filterMode === "hidden" && item.visible !== false) return false;
2632
2676
  if (filterMode === "locked" && item.selectable !== false) return false;
2633
2677
  if (!normalizedQuery) return true;
2634
- return item.name.toLocaleLowerCase().includes(normalizedQuery) || ((_item$description = item.description) !== null && _item$description !== void 0 ? _item$description : "").toLocaleLowerCase().includes(normalizedQuery);
2678
+ return item.name.toLocaleLowerCase().includes(normalizedQuery) || (item.description ?? "").toLocaleLowerCase().includes(normalizedQuery);
2635
2679
  });
2636
2680
  }, [
2637
2681
  filterMode,
@@ -2641,8 +2685,7 @@ function ObjectListPanelBase(props) {
2641
2685
  const visibleItemSections = (0, react.useMemo)(() => {
2642
2686
  const sectionMap = /* @__PURE__ */ new Map();
2643
2687
  visibleItems.forEach((item) => {
2644
- var _item$sectionId, _item$sectionTitle;
2645
- const sectionId = (_item$sectionId = item.sectionId) !== null && _item$sectionId !== void 0 ? _item$sectionId : "";
2688
+ const sectionId = item.sectionId ?? "";
2646
2689
  const existingSection = sectionMap.get(sectionId);
2647
2690
  if (existingSection) {
2648
2691
  existingSection.items.push(item);
@@ -2650,35 +2693,30 @@ function ObjectListPanelBase(props) {
2650
2693
  }
2651
2694
  sectionMap.set(sectionId, {
2652
2695
  id: sectionId,
2653
- title: (_item$sectionTitle = item.sectionTitle) !== null && _item$sectionTitle !== void 0 ? _item$sectionTitle : "",
2696
+ title: item.sectionTitle ?? "",
2654
2697
  items: [item]
2655
2698
  });
2656
2699
  });
2657
- return [...sectionMap.values()].sort((a, b) => {
2658
- var _sectionOrder$get, _sectionOrder$get2;
2659
- 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);
2660
- });
2700
+ return [...sectionMap.values()].sort((a, b) => (sectionOrder.get(a.id) ?? 3) - (sectionOrder.get(b.id) ?? 3));
2661
2701
  }, [visibleItems]);
2662
2702
  const showSectionHeaders = visibleItemSections.length > 1 || visibleItemSections.some((section) => section.id === "floating");
2663
- const allIds = (0, react.useMemo)(() => allObjectIds !== null && allObjectIds !== void 0 ? allObjectIds : items.map((item) => item.id), [allObjectIds, items]);
2703
+ const allIds = (0, react.useMemo)(() => allObjectIds ?? items.map((item) => item.id), [allObjectIds, items]);
2664
2704
  const selectedIndex = selectedItem ? items.findIndex((item) => item.id === selectedItem.id) : -1;
2665
- const canMoveForward = !!selectedItem && !!onMoveForward && !selectedItem.disabled && ((_selectedItem$canMove = selectedItem.canMoveForward) !== null && _selectedItem$canMove !== void 0 ? _selectedItem$canMove : selectedIndex > 0) && hasCapability(capabilities, selectedItem, "arrange");
2666
- 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");
2705
+ const canMoveForward = !!selectedItem && !!onMoveForward && !selectedItem.disabled && (selectedItem.canMoveForward ?? selectedIndex > 0) && hasCapability(capabilities, selectedItem, "arrange");
2706
+ const canMoveBackward = !!selectedItem && !!onMoveBackward && !selectedItem.disabled && (selectedItem.canMoveBackward ?? (selectedIndex >= 0 && selectedIndex < items.length - 1)) && hasCapability(capabilities, selectedItem, "arrange");
2667
2707
  const showArrangeControls = hasCapability(capabilities, selectedItem, "arrange") && (!!onMoveForward || !!onMoveBackward);
2668
2708
  const showLocateControl = !!onLocate && hasCapability(capabilities, selectedItem, "locate");
2669
- const canReorder = !!onReorder && ((_capabilities$reorder = capabilities === null || capabilities === void 0 ? void 0 : capabilities.reorder) !== null && _capabilities$reorder !== void 0 ? _capabilities$reorder : true);
2709
+ const canReorder = !!onReorder && ((capabilities === null || capabilities === void 0 ? void 0 : capabilities.reorder) ?? true);
2670
2710
  const findItem = (objectId) => {
2671
- var _items$find2;
2672
- return objectId ? (_items$find2 = items.find((item) => item.id === objectId)) !== null && _items$find2 !== void 0 ? _items$find2 : null : null;
2711
+ return objectId ? items.find((item) => item.id === objectId) ?? null : null;
2673
2712
  };
2674
2713
  const handleDrop = (targetId) => {
2675
- var _source$parentId, _target$parentId, _source$sectionId, _target$sectionId;
2676
2714
  const source = findItem(draggingId);
2677
2715
  const target = findItem(targetId);
2678
2716
  setDraggingId(null);
2679
2717
  if (!source || !target || source.id === target.id || source.disabled || target.disabled) return;
2680
- if (((_source$parentId = source.parentId) !== null && _source$parentId !== void 0 ? _source$parentId : "") !== ((_target$parentId = target.parentId) !== null && _target$parentId !== void 0 ? _target$parentId : "")) return;
2681
- if (((_source$sectionId = source.sectionId) !== null && _source$sectionId !== void 0 ? _source$sectionId : "") !== ((_target$sectionId = target.sectionId) !== null && _target$sectionId !== void 0 ? _target$sectionId : "")) return;
2718
+ if ((source.parentId ?? "") !== (target.parentId ?? "")) return;
2719
+ if ((source.sectionId ?? "") !== (target.sectionId ?? "")) return;
2682
2720
  if (source.canReorder === false || target.canReorder === false) return;
2683
2721
  onReorder === null || onReorder === void 0 || onReorder(source.id, target.id);
2684
2722
  };
@@ -2761,7 +2799,7 @@ function ObjectListPanelBase(props) {
2761
2799
  ["locked", labels.filterLocked]
2762
2800
  ].map(([mode, label]) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2763
2801
  type: "button",
2764
- className: (0, _univerjs_design.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"),
2802
+ className: (0, _univerjs_design.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-gray-0 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"),
2765
2803
  "aria-pressed": filterMode === mode,
2766
2804
  onClick: () => setFilterMode(mode),
2767
2805
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -2791,7 +2829,7 @@ function ObjectListPanelBase(props) {
2791
2829
  children: [
2792
2830
  section.id ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2793
2831
  className: "univer-flex univer-size-4 univer-shrink-0 univer-items-center univer-justify-center",
2794
- children: sectionCollapsed ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreRightIcon, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, {})
2832
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, { className: (0, _univerjs_design.clsx)({ "-univer-rotate-90 rtl:univer-rotate-90": sectionCollapsed }) })
2795
2833
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "univer-size-4 univer-shrink-0" }),
2796
2834
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2797
2835
  className: "univer-min-w-0 univer-flex-1 univer-truncate univer-text-left",
@@ -2836,12 +2874,11 @@ function ObjectListPanelBase(props) {
2836
2874
  });
2837
2875
  }
2838
2876
  function ObjectListRow(props) {
2839
- var _item$level;
2840
2877
  const { item, selected, labels, showLock, showName, showVisible, draggable, dragging, onSelect, onToggleExpanded, onToggleVisible, onToggleSelectable, onCommitName, onDragStart, onDragEnd, onDrop } = props;
2841
2878
  const [draftName, setDraftName] = (0, react.useState)(item.name);
2842
2879
  const skipCommitOnBlurRef = (0, react.useRef)(false);
2843
2880
  const disabled = item.disabled === true;
2844
- const level = (_item$level = item.level) !== null && _item$level !== void 0 ? _item$level : 0;
2881
+ const level = item.level ?? 0;
2845
2882
  const locked = item.selectable === false;
2846
2883
  (0, react.useEffect)(() => {
2847
2884
  setDraftName(item.name);
@@ -2901,11 +2938,11 @@ function ObjectListRow(props) {
2901
2938
  event.stopPropagation();
2902
2939
  onToggleExpanded();
2903
2940
  },
2904
- children: item.expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreRightIcon, {})
2941
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, { className: (0, _univerjs_design.clsx)({ "-univer-rotate-90 rtl:univer-rotate-90": !item.expanded }) })
2905
2942
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "univer-size-5 univer-shrink-0" }),
2906
2943
  showName ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
2907
2944
  className: (0, _univerjs_design.clsx)("univer-h-7 univer-w-0 univer-min-w-0 univer-flex-1", disabled && "univer-cursor-not-allowed"),
2908
- inputClass: (0, _univerjs_design.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"),
2945
+ inputClass: (0, _univerjs_design.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-gray-0 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"),
2909
2946
  inputStyle: {
2910
2947
  maxWidth: "100%",
2911
2948
  boxSizing: "border-box"
@@ -2952,15 +2989,13 @@ function ObjectListRow(props) {
2952
2989
  });
2953
2990
  }
2954
2991
  function ObjectDetailsEditor(props) {
2955
- var _item$name, _item$description2;
2956
2992
  const { item, labels, showName, showDescription, onCommitName, onCommitDescription } = props;
2957
- const [draftName, setDraftName] = (0, react.useState)((_item$name = item === null || item === void 0 ? void 0 : item.name) !== null && _item$name !== void 0 ? _item$name : "");
2958
- const [draftDescription, setDraftDescription] = (0, react.useState)((_item$description2 = item === null || item === void 0 ? void 0 : item.description) !== null && _item$description2 !== void 0 ? _item$description2 : "");
2993
+ const [draftName, setDraftName] = (0, react.useState)((item === null || item === void 0 ? void 0 : item.name) ?? "");
2994
+ const [draftDescription, setDraftDescription] = (0, react.useState)((item === null || item === void 0 ? void 0 : item.description) ?? "");
2959
2995
  const disabled = (item === null || item === void 0 ? void 0 : item.disabled) === true;
2960
2996
  (0, react.useEffect)(() => {
2961
- var _item$name2, _item$description3;
2962
- setDraftName((_item$name2 = item === null || item === void 0 ? void 0 : item.name) !== null && _item$name2 !== void 0 ? _item$name2 : "");
2963
- setDraftDescription((_item$description3 = item === null || item === void 0 ? void 0 : item.description) !== null && _item$description3 !== void 0 ? _item$description3 : "");
2997
+ setDraftName((item === null || item === void 0 ? void 0 : item.name) ?? "");
2998
+ setDraftDescription((item === null || item === void 0 ? void 0 : item.description) ?? "");
2964
2999
  }, [
2965
3000
  item === null || item === void 0 ? void 0 : item.description,
2966
3001
  item === null || item === void 0 ? void 0 : item.id,
@@ -3001,15 +3036,14 @@ function ObjectDetailsEditor(props) {
3001
3036
  className: "univer-text-xs univer-text-gray-500 dark:!univer-text-gray-400",
3002
3037
  children: labels.description
3003
3038
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
3004
- 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",
3039
+ 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-gray-0 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",
3005
3040
  value: draftDescription,
3006
3041
  disabled,
3007
3042
  placeholder: labels.descriptionPlaceholder,
3008
3043
  "aria-label": labels.description,
3009
3044
  onChange: (event) => setDraftDescription(event.currentTarget.value),
3010
3045
  onBlur: () => {
3011
- var _item$description4;
3012
- if (!disabled && normalizeText(draftDescription) !== ((_item$description4 = item.description) !== null && _item$description4 !== void 0 ? _item$description4 : "")) onCommitDescription(draftDescription);
3046
+ if (!disabled && normalizeText(draftDescription) !== (item.description ?? "")) onCommitDescription(draftDescription);
3013
3047
  }
3014
3048
  })]
3015
3049
  })
@@ -3080,7 +3114,7 @@ const DrawingAlign = (props) => {
3080
3114
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3081
3115
  className: "univer-relative univer-mt-2.5 univer-flex univer-h-full",
3082
3116
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3083
- className: "univer-w-full univer-text-gray-900 dark:!univer-text-white",
3117
+ className: "univer-w-full univer-text-gray-900 dark:!univer-text-gray-0",
3084
3118
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Select, {
3085
3119
  value: alignValue,
3086
3120
  options: alignOptions,
@@ -89,29 +89,11 @@ const locale = { "drawing-ui": {
89
89
  null: "لا يوجد تحديد للكائن"
90
90
  },
91
91
  "image-text-wrap": {
92
- title: "التفاف النص",
93
- wrappingStyle: "نمط التفاف",
94
92
  square: "مربع",
95
93
  topAndBottom: "أعلى وأسفل",
96
94
  inline: "في نفس السطر مع النص",
97
95
  behindText: "خلف النص",
98
- inFrontText: "أمام النص",
99
- wrapText: "تفاف النص",
100
- bothSide: "كلا الجانبين",
101
- leftOnly: "يسار فقط",
102
- rightOnly: "يمين فقط",
103
- distanceFromText: "المسافة من النص",
104
- top: "أعلى(بكسل)",
105
- left: "يسار(بكسل)",
106
- bottom: "أسفل(بكسل)",
107
- right: "يمين(بكسل)"
108
- },
109
- "image-popup": {
110
- replace: "استبدال",
111
- delete: "حذف",
112
- edit: "تحرير",
113
- crop: "قص",
114
- reset: "إعادة تعيين الحجم"
96
+ inFrontText: "أمام النص"
115
97
  }
116
98
  } };
117
99
 
@@ -89,29 +89,11 @@ const locale = { "drawing-ui": {
89
89
  null: "Cap objecte seleccionat"
90
90
  },
91
91
  "image-text-wrap": {
92
- title: "Ajust del text",
93
- wrappingStyle: "Estil d'ajust",
94
92
  square: "Quadrat",
95
93
  topAndBottom: "A dalt i a baix",
96
94
  inline: "En línia amb el text",
97
95
  behindText: "Darrere del text",
98
- inFrontText: "Davant del text",
99
- wrapText: "Ajusta el text",
100
- bothSide: "Ambdós costats",
101
- leftOnly: "Només esquerra",
102
- rightOnly: "Només dreta",
103
- distanceFromText: "Distància del text",
104
- top: "A dalt(px)",
105
- left: "Esquerra(px)",
106
- bottom: "A baix(px)",
107
- right: "Dreta(px)"
108
- },
109
- "image-popup": {
110
- replace: "Reemplaça",
111
- delete: "Elimina",
112
- edit: "Edita",
113
- crop: "Retalla",
114
- reset: "Restableix la mida"
96
+ inFrontText: "Davant del text"
115
97
  }
116
98
  } };
117
99