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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/lib/cjs/index.js +115 -58
  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 +118 -61
  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 +32 -10
  42. package/lib/index.js +118 -61
  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 +11 -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 +8 -8
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
  };
@@ -625,7 +625,7 @@ const menuSchema = { [_univerjs_ui.ContextMenuPosition.DRAWING]: { [_univerjs_ui
625
625
  //#endregion
626
626
  //#region package.json
627
627
  var name = "@univerjs/drawing-ui";
628
- var version = "1.0.0-beta.0";
628
+ var version = "1.0.0-beta.2";
629
629
 
630
630
  //#endregion
631
631
  //#region src/config/config.ts
@@ -698,11 +698,11 @@ function ImagePopupMenu(props) {
698
698
  open: visible,
699
699
  onOpenChange: onVisibleChange,
700
700
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
701
- 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, {
702
702
  "univer-bg-gray-100 dark:!univer-bg-gray-800": visible,
703
- "univer-bg-white dark:!univer-bg-gray-900": !visible
703
+ "univer-bg-gray-0 dark:!univer-bg-gray-900": !visible
704
704
  }),
705
- 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" })]
706
706
  })
707
707
  })
708
708
  });
@@ -725,6 +725,7 @@ function ToolbarGroup(props) {
725
725
  }
726
726
  function ToolbarButton(props) {
727
727
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Tooltip, {
728
+ className: "univer-fill-mode-backwards univer-delay-100",
728
729
  title: props.title,
729
730
  placement: "bottom",
730
731
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
@@ -743,7 +744,7 @@ function ToolbarDropdownButton(props) {
743
744
  open,
744
745
  onOpenChange: setOpen,
745
746
  overlay: /* @__PURE__ */ (0, react_jsx_runtime.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
+ 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",
747
748
  children: props.options.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
748
749
  type: "button",
749
750
  onClick: () => {
@@ -761,6 +762,7 @@ function ToolbarDropdownButton(props) {
761
762
  }, option.value))
762
763
  }),
763
764
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Tooltip, {
765
+ className: "univer-fill-mode-backwards univer-delay-100",
764
766
  title: props.title,
765
767
  placement: "bottom",
766
768
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
@@ -832,7 +834,7 @@ function DocImageFloatingToolbar(props) {
832
834
  event.stopPropagation();
833
835
  event.preventDefault();
834
836
  },
835
- 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),
837
+ 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),
836
838
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarGroup, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarDropdownButton, {
837
839
  title: ((_wrappingStyleOptions = wrappingStyleOptions.find((option) => option.value === wrappingStyle)) === null || _wrappingStyleOptions === void 0 ? void 0 : _wrappingStyleOptions.label) ?? localeService.t("drawing-ui.image-text-wrap.inline"),
838
840
  value: wrappingStyle,
@@ -857,11 +859,14 @@ function DocChartFloatingToolbar(props) {
857
859
  const [hidden, setHidden] = (0, react.useState)(false);
858
860
  const chartTypeItem = props.menuItems.find((item) => item.type === "select");
859
861
  const actionItems = props.menuItems.filter((item) => item.type !== "select" && item.icon).sort((a, b) => a.index - b.index);
860
- const chartTypeOptions = ((chartTypeItem === null || chartTypeItem === void 0 ? void 0 : chartTypeItem.options) ?? []).map((option) => ({
861
- label: String(option.label),
862
- value: option.value,
863
- icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.ChartIcon, {})
864
- }));
862
+ const chartTypeOptions = ((chartTypeItem === null || chartTypeItem === void 0 ? void 0 : chartTypeItem.options) ?? []).map((option) => {
863
+ const Icon = option.icon ? iconManager.get(option.icon) : _univerjs_icons.ChartIcon;
864
+ return {
865
+ label: String(option.label),
866
+ value: option.value,
867
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {})
868
+ };
869
+ });
865
870
  const executeMenuItem = (item) => {
866
871
  if (!item || item.disable) return;
867
872
  if (item.hideOnClick) setHidden(true);
@@ -874,7 +879,7 @@ function DocChartFloatingToolbar(props) {
874
879
  event.stopPropagation();
875
880
  event.preventDefault();
876
881
  },
877
- 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),
882
+ 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),
878
883
  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, {
879
884
  title: localeService.t(chartTypeItem.label),
880
885
  value: chartTypeItem.value ?? ((_chartTypeOptions$ = chartTypeOptions[0]) === null || _chartTypeOptions$ === void 0 ? void 0 : _chartTypeOptions$.value) ?? "",
@@ -1954,7 +1959,7 @@ var ImageCropperObject = class extends _univerjs_engine_render.Shape {
1954
1959
  //#endregion
1955
1960
  //#region src/controllers/image-cropper.controller.ts
1956
1961
  let ImageCropperController = class ImageCropperController extends _univerjs_core.Disposable {
1957
- constructor(_commandService, _drawingManagerService, _renderManagerService, _univerInstanceService, _messageService, _localeService) {
1962
+ constructor(_commandService, _drawingManagerService, _renderManagerService, _univerInstanceService, _messageService, _localeService, _shortcutService, _layoutService) {
1958
1963
  super();
1959
1964
  this._commandService = _commandService;
1960
1965
  this._drawingManagerService = _drawingManagerService;
@@ -1962,7 +1967,14 @@ let ImageCropperController = class ImageCropperController extends _univerjs_core
1962
1967
  this._univerInstanceService = _univerInstanceService;
1963
1968
  this._messageService = _messageService;
1964
1969
  this._localeService = _localeService;
1970
+ this._shortcutService = _shortcutService;
1971
+ this._layoutService = _layoutService;
1965
1972
  _defineProperty(this, "_sceneListenerOnImageMap", /* @__PURE__ */ new WeakSet());
1973
+ _defineProperty(this, "_cropShortcutDisposables", new _univerjs_core.DisposableCollection());
1974
+ _defineProperty(this, "_cropSnapshots", /* @__PURE__ */ new WeakMap());
1975
+ _defineProperty(this, "_pendingCropSnapshot", null);
1976
+ _defineProperty(this, "_activeCropSession", null);
1977
+ this.disposeWithMe(this._cropShortcutDisposables);
1966
1978
  this._init();
1967
1979
  }
1968
1980
  _init() {
@@ -1997,12 +2009,17 @@ let ImageCropperController = class ImageCropperController extends _univerjs_core
1997
2009
  return;
1998
2010
  }
1999
2011
  if (imageShape == null) return;
2000
- this._updateCropperObject(cropType, imageShape);
2001
- this._commandService.executeCommand(OpenImageCropOperation.id, {
2002
- unitId,
2003
- subUnitId,
2004
- drawingId
2005
- });
2012
+ this._pendingCropSnapshot = this._captureCropSnapshot(imageShape);
2013
+ try {
2014
+ this._updateCropperObject(cropType, imageShape);
2015
+ this._commandService.syncExecuteCommand(OpenImageCropOperation.id, {
2016
+ unitId,
2017
+ subUnitId,
2018
+ drawingId
2019
+ });
2020
+ } finally {
2021
+ this._pendingCropSnapshot = null;
2022
+ }
2006
2023
  }));
2007
2024
  }
2008
2025
  _calculateSrcRectByRatio(left, top, width, height, numerator, denominator) {
@@ -2070,6 +2087,7 @@ let ImageCropperController = class ImageCropperController extends _univerjs_core
2070
2087
  if (command.id !== OpenImageCropOperation.id) return;
2071
2088
  const params = command.params;
2072
2089
  if (params == null) return;
2090
+ if (this._activeCropSession != null) this._commandService.syncExecuteCommand(CloseImageCropOperation.id, { isAuto: true });
2073
2091
  const { unitId, subUnitId, drawingId } = params;
2074
2092
  const renderObject = this._renderManagerService.getRenderUnitById(unitId);
2075
2093
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
@@ -2104,17 +2122,26 @@ let ImageCropperController = class ImageCropperController extends _univerjs_core
2104
2122
  prstGeom: imageShape.prstGeom,
2105
2123
  applyTransform: imageShape.calculateTransformWithSrcRect()
2106
2124
  });
2125
+ this._cropSnapshots.set(imageCropperObject, this._pendingCropSnapshot ?? this._captureCropSnapshot(imageShape));
2126
+ this._pendingCropSnapshot = null;
2107
2127
  scene.addObject(imageCropperObject, imageShape.getLayerIndex() + 1).attachTransformerTo(imageCropperObject);
2128
+ this._activeCropSession = {
2129
+ scene,
2130
+ imageShape,
2131
+ imageCropperObject
2132
+ };
2108
2133
  transformer === null || transformer === void 0 || transformer.createControlForCopper(imageCropperObject);
2109
2134
  this._addHoverForImageCopper(imageCropperObject);
2110
2135
  imageShape.openRenderByCropper();
2111
2136
  transformer === null || transformer === void 0 || transformer.refreshControls();
2112
2137
  imageCropperObject.makeDirty(true);
2138
+ this._registerCropShortcuts();
2113
2139
  this._commandService.syncExecuteCommand(_univerjs_drawing.SetDrawingSelectedOperation.id, [{
2114
2140
  unitId,
2115
2141
  subUnitId,
2116
2142
  drawingId
2117
2143
  }]);
2144
+ this._layoutService.focus();
2118
2145
  }));
2119
2146
  }
2120
2147
  _searchCropObject(scene) {
@@ -2124,39 +2151,40 @@ let ImageCropperController = class ImageCropperController extends _univerjs_core
2124
2151
  _initCloseCrop() {
2125
2152
  this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
2126
2153
  if (command.id !== CloseImageCropOperation.id) return;
2127
- const currentUnit = this._univerInstanceService.getFocusedUnit();
2128
- if (currentUnit == null) return;
2129
- const unitId = currentUnit.getUnitId();
2130
- const renderObject = this._renderManagerService.getRenderUnitById(unitId);
2131
- const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
2132
- if (scene == null) return true;
2133
- const imageCropperObject = this._searchCropObject(scene);
2134
- if (imageCropperObject == null) return;
2135
- const imageShape = this._getApplyObjectByCropObject(imageCropperObject);
2136
- if (imageShape == null) return;
2154
+ const cropSession = this._activeCropSession;
2155
+ if (cropSession == null) return;
2156
+ const { scene, imageShape, imageCropperObject } = cropSession;
2137
2157
  const transformer = scene.getTransformerByCreate();
2138
2158
  transformer.detachFrom(imageCropperObject);
2139
2159
  transformer.clearCopperControl();
2140
- const srcRect = this._getSrcRectByTransformState(imageShape, imageCropperObject);
2141
- const drawingParam = this._drawingManagerService.getDrawingOKey(imageShape.oKey);
2142
- if (drawingParam != null) {
2143
- const { left, top, height, width } = imageCropperObject;
2144
- this._drawingManagerService.featurePluginUpdateNotification([{
2145
- ...drawingParam,
2146
- transform: {
2147
- ...drawingParam.transform,
2148
- left,
2149
- top,
2150
- height,
2151
- width
2152
- },
2153
- srcRect: srcRect.srcRectAngle
2154
- }]);
2160
+ const params = command.params;
2161
+ if (params === null || params === void 0 ? void 0 : params.isCancel) this._restoreCropSnapshot(imageShape, imageCropperObject);
2162
+ else {
2163
+ const srcRect = this._getSrcRectByTransformState(imageShape, imageCropperObject);
2164
+ const drawingParam = this._drawingManagerService.getDrawingOKey(imageShape.oKey);
2165
+ if (drawingParam != null) {
2166
+ const { left, top, height, width } = imageCropperObject;
2167
+ this._drawingManagerService.featurePluginUpdateNotification([{
2168
+ ...drawingParam,
2169
+ transform: {
2170
+ ...drawingParam.transform,
2171
+ left,
2172
+ top,
2173
+ height,
2174
+ width
2175
+ },
2176
+ srcRect: srcRect.srcRectAngle
2177
+ }]);
2178
+ }
2179
+ imageShape.setSrcRect({ ...srcRect.srcRectAngle });
2155
2180
  }
2156
- imageShape.setSrcRect({ ...srcRect.srcRectAngle });
2157
2181
  imageShape.closeRenderByCropper();
2158
2182
  imageShape.makeDirty(true);
2159
- imageCropperObject === null || imageCropperObject === void 0 || imageCropperObject.dispose();
2183
+ transformer.refreshControls();
2184
+ this._cropSnapshots.delete(imageCropperObject);
2185
+ imageCropperObject.dispose();
2186
+ this._activeCropSession = null;
2187
+ this._cropShortcutDisposables.dispose();
2160
2188
  }));
2161
2189
  const sheetUnit$ = this._univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).pipe((0, rxjs.switchMap)((workbook) => workbook ? workbook.activeSheet$ : (0, rxjs.of)(null)));
2162
2190
  this.disposeWithMe(sheetUnit$.subscribe(() => {
@@ -2172,6 +2200,33 @@ let ImageCropperController = class ImageCropperController extends _univerjs_core
2172
2200
  if (applyObject == null) return null;
2173
2201
  return applyObject;
2174
2202
  }
2203
+ _captureCropSnapshot(imageShape) {
2204
+ return {
2205
+ transform: imageShape.getState(),
2206
+ srcRect: imageShape.srcRect == null ? imageShape.srcRect : { ...imageShape.srcRect }
2207
+ };
2208
+ }
2209
+ _restoreCropSnapshot(imageShape, imageCropperObject) {
2210
+ const snapshot = this._cropSnapshots.get(imageCropperObject);
2211
+ if (snapshot) {
2212
+ imageShape.transformByStateCloseCropper(snapshot.transform);
2213
+ imageShape.setSrcRect(snapshot.srcRect);
2214
+ }
2215
+ }
2216
+ _registerCropShortcuts() {
2217
+ this._cropShortcutDisposables.dispose();
2218
+ this._cropShortcutDisposables.add(this._shortcutService.registerShortcut({
2219
+ id: CloseImageCropOperation.id,
2220
+ binding: _univerjs_ui.KeyCode.ENTER,
2221
+ priority: 1e3
2222
+ }));
2223
+ this._cropShortcutDisposables.add(this._shortcutService.registerShortcut({
2224
+ id: CloseImageCropOperation.id,
2225
+ binding: _univerjs_ui.KeyCode.ESC,
2226
+ priority: 1e3,
2227
+ staticParameters: { isCancel: true }
2228
+ }));
2229
+ }
2175
2230
  _addListenerOnImage(scene) {
2176
2231
  const transformer = scene.getTransformerByCreate();
2177
2232
  let startTransform = null;
@@ -2224,8 +2279,8 @@ let ImageCropperController = class ImageCropperController extends _univerjs_core
2224
2279
  }));
2225
2280
  }
2226
2281
  _getSrcRectByTransformState(applyObject, imageCropperObject) {
2227
- const { left, top, height, width, strokeWidth, angle: copperAngle } = imageCropperObject;
2228
- const { left: applyLeft, top: applyTop, width: applyWidth, height: applyHeight, angle: applyAngle, strokeWidth: applyStrokeWidth } = applyObject;
2282
+ const { left, top, height, width } = imageCropperObject;
2283
+ const { left: applyLeft, top: applyTop, width: applyWidth, height: applyHeight, angle: applyAngle } = applyObject;
2229
2284
  const newLeft = left - applyLeft;
2230
2285
  const newTop = top - applyTop;
2231
2286
  const srcRect = {
@@ -2261,7 +2316,9 @@ ImageCropperController = __decorate([
2261
2316
  __decorateParam(2, _univerjs_engine_render.IRenderManagerService),
2262
2317
  __decorateParam(3, _univerjs_core.IUniverInstanceService),
2263
2318
  __decorateParam(4, _univerjs_ui.IMessageService),
2264
- __decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService))
2319
+ __decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService)),
2320
+ __decorateParam(6, _univerjs_ui.IShortcutService),
2321
+ __decorateParam(7, _univerjs_ui.ILayoutService)
2265
2322
  ], ImageCropperController);
2266
2323
 
2267
2324
  //#endregion
@@ -2747,7 +2804,7 @@ function ObjectListPanelBase(props) {
2747
2804
  ["locked", labels.filterLocked]
2748
2805
  ].map(([mode, label]) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2749
2806
  type: "button",
2750
- 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"),
2807
+ 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"),
2751
2808
  "aria-pressed": filterMode === mode,
2752
2809
  onClick: () => setFilterMode(mode),
2753
2810
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -2777,7 +2834,7 @@ function ObjectListPanelBase(props) {
2777
2834
  children: [
2778
2835
  section.id ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2779
2836
  className: "univer-flex univer-size-4 univer-shrink-0 univer-items-center univer-justify-center",
2780
- children: sectionCollapsed ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreRightIcon, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, {})
2837
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, { className: (0, _univerjs_design.clsx)({ "-univer-rotate-90 rtl:univer-rotate-90": sectionCollapsed }) })
2781
2838
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "univer-size-4 univer-shrink-0" }),
2782
2839
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2783
2840
  className: "univer-min-w-0 univer-flex-1 univer-truncate univer-text-left",
@@ -2886,11 +2943,11 @@ function ObjectListRow(props) {
2886
2943
  event.stopPropagation();
2887
2944
  onToggleExpanded();
2888
2945
  },
2889
- children: item.expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreRightIcon, {})
2946
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, { className: (0, _univerjs_design.clsx)({ "-univer-rotate-90 rtl:univer-rotate-90": !item.expanded }) })
2890
2947
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "univer-size-5 univer-shrink-0" }),
2891
2948
  showName ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
2892
2949
  className: (0, _univerjs_design.clsx)("univer-h-7 univer-w-0 univer-min-w-0 univer-flex-1", disabled && "univer-cursor-not-allowed"),
2893
- 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"),
2950
+ 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"),
2894
2951
  inputStyle: {
2895
2952
  maxWidth: "100%",
2896
2953
  boxSizing: "border-box"
@@ -2984,7 +3041,7 @@ function ObjectDetailsEditor(props) {
2984
3041
  className: "univer-text-xs univer-text-gray-500 dark:!univer-text-gray-400",
2985
3042
  children: labels.description
2986
3043
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
2987
- 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",
3044
+ 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",
2988
3045
  value: draftDescription,
2989
3046
  disabled,
2990
3047
  placeholder: labels.descriptionPlaceholder,
@@ -3062,7 +3119,7 @@ const DrawingAlign = (props) => {
3062
3119
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3063
3120
  className: "univer-relative univer-mt-2.5 univer-flex univer-h-full",
3064
3121
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3065
- className: "univer-w-full univer-text-gray-900 dark:!univer-text-white",
3122
+ className: "univer-w-full univer-text-gray-900 dark:!univer-text-gray-0",
3066
3123
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Select, {
3067
3124
  value: alignValue,
3068
3125
  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
 
@@ -89,29 +89,11 @@ const locale = { "drawing-ui": {
89
89
  null: "Keine Objektauswahl"
90
90
  },
91
91
  "image-text-wrap": {
92
- title: "Textumbruch",
93
- wrappingStyle: "Umbruchstil",
94
92
  square: "Quadratisch",
95
93
  topAndBottom: "Oben und unten",
96
94
  inline: "Im Textfluss",
97
95
  behindText: "Hinter dem Text",
98
- inFrontText: "Vor dem Text",
99
- wrapText: "Text umbrechen",
100
- bothSide: "Beide Seiten",
101
- leftOnly: "Nur links",
102
- rightOnly: "Nur rechts",
103
- distanceFromText: "Abstand vom Text",
104
- top: "Oben(px)",
105
- left: "Links(px)",
106
- bottom: "Unten(px)",
107
- right: "Rechts(px)"
108
- },
109
- "image-popup": {
110
- replace: "Ersetzen",
111
- delete: "Löschen",
112
- edit: "Bearbeiten",
113
- crop: "Zuschneiden",
114
- reset: "Größe zurücksetzen"
96
+ inFrontText: "Vor dem Text"
115
97
  }
116
98
  } };
117
99
 
@@ -103,30 +103,12 @@ const locale = { "drawing-ui": {
103
103
  },
104
104
  null: "No Object Selection"
105
105
  },
106
- "image-popup": {
107
- replace: "Replace",
108
- delete: "Delete",
109
- edit: "Edit",
110
- crop: "Crop",
111
- reset: "Reset Size"
112
- },
113
106
  "image-text-wrap": {
114
- title: "Text Wrapping",
115
- wrappingStyle: "Wrapping Style",
116
107
  square: "Square",
117
108
  topAndBottom: "Top and Bottom",
118
109
  inline: "In line with text",
119
110
  behindText: "Behind text",
120
- inFrontText: "In front of text",
121
- wrapText: "Wrap text",
122
- bothSide: "Both sides",
123
- leftOnly: "Left only",
124
- rightOnly: "Right only",
125
- distanceFromText: "Distance from text",
126
- top: "Top(px)",
127
- left: "Left(px)",
128
- bottom: "Bottom(px)",
129
- right: "Right(px)"
111
+ inFrontText: "In front of text"
130
112
  }
131
113
  } };
132
114
 
@@ -89,29 +89,11 @@ const locale = { "drawing-ui": {
89
89
  null: "Ningún objeto seleccionado"
90
90
  },
91
91
  "image-text-wrap": {
92
- title: "Ajuste de texto",
93
- wrappingStyle: "Estilo de ajuste",
94
92
  square: "Cuadrado",
95
93
  topAndBottom: "Arriba y abajo",
96
94
  inline: "En línea con el texto",
97
95
  behindText: "Detrás del texto",
98
- inFrontText: "Delante del texto",
99
- wrapText: "Ajustar texto",
100
- bothSide: "Ambos lados",
101
- leftOnly: "Solo izquierda",
102
- rightOnly: "Solo derecha",
103
- distanceFromText: "Distancia del texto",
104
- top: "Arriba(px)",
105
- left: "Izquierda(px)",
106
- bottom: "Abajo(px)",
107
- right: "Derecha(px)"
108
- },
109
- "image-popup": {
110
- replace: "Reemplazar",
111
- delete: "Eliminar",
112
- edit: "Editar",
113
- crop: "Recortar",
114
- reset: "Restablecer tamaño"
96
+ inFrontText: "Delante del texto"
115
97
  }
116
98
  } };
117
99
 
@@ -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: "بالا(px)",
105
- left: "چپ(px)",
106
- bottom: "پایین(px)",
107
- right: "راست(px)"
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: "Aucune sélection d'objet"
90
90
  },
91
91
  "image-text-wrap": {
92
- title: "Habillage du texte",
93
- wrappingStyle: "Style d'habillage",
94
92
  square: "Carré",
95
93
  topAndBottom: "Haut et bas",
96
94
  inline: "Aligné avec le texte",
97
95
  behindText: "Derrière le texte",
98
- inFrontText: "Devant le texte",
99
- wrapText: "Habiller le texte",
100
- bothSide: "Des deux côtés",
101
- leftOnly: "Seulement à gauche",
102
- rightOnly: "Seulement à droite",
103
- distanceFromText: "Distance du texte",
104
- top: "Haut(px)",
105
- left: "Gauche(px)",
106
- bottom: "Bas(px)",
107
- right: "Droite(px)"
108
- },
109
- "image-popup": {
110
- replace: "Remplacer",
111
- delete: "Supprimer",
112
- edit: "Modifier",
113
- crop: "Rogner",
114
- reset: "Réinitialiser la taille"
96
+ inFrontText: "Devant le texte"
115
97
  }
116
98
  } };
117
99
 
@@ -89,29 +89,11 @@ const locale = { "drawing-ui": {
89
89
  null: "Tidak Ada Objek yang Dipilih"
90
90
  },
91
91
  "image-text-wrap": {
92
- title: "Pembungkus Teks",
93
- wrappingStyle: "Gaya Pembungkus",
94
92
  square: "Kotak",
95
93
  topAndBottom: "Atas dan Bawah",
96
94
  inline: "Sejajar dengan teks",
97
95
  behindText: "Di belakang teks",
98
- inFrontText: "Di depan teks",
99
- wrapText: "Bungkus teks",
100
- bothSide: "Kedua sisi",
101
- leftOnly: "Kiri saja",
102
- rightOnly: "Kanan saja",
103
- distanceFromText: "Jarak dari teks",
104
- top: "Atas(px)",
105
- left: "Kiri(px)",
106
- bottom: "Bawah(px)",
107
- right: "Kanan(px)"
108
- },
109
- "image-popup": {
110
- replace: "Ganti",
111
- delete: "Hapus",
112
- edit: "Edit",
113
- crop: "Pangkas",
114
- reset: "Atur Ulang Ukuran"
96
+ inFrontText: "Di depan teks"
115
97
  }
116
98
  } };
117
99
 
@@ -89,29 +89,11 @@ const locale = { "drawing-ui": {
89
89
  null: "Nessun oggetto selezionato"
90
90
  },
91
91
  "image-text-wrap": {
92
- title: "Testo a capo",
93
- wrappingStyle: "Stile a capo",
94
92
  square: "Quadrato",
95
93
  topAndBottom: "Superiore e inferiore",
96
94
  inline: "In linea con il testo",
97
95
  behindText: "Dietro il testo",
98
- inFrontText: "Davanti al testo",
99
- wrapText: "Testo a capo",
100
- bothSide: "Entrambi i lati",
101
- leftOnly: "Solo sinistra",
102
- rightOnly: "Solo destra",
103
- distanceFromText: "Distanza dal testo",
104
- top: "Superiore(px)",
105
- left: "Sinistra(px)",
106
- bottom: "Inferiore(px)",
107
- right: "Destra(px)"
108
- },
109
- "image-popup": {
110
- replace: "Sostituisci",
111
- delete: "Elimina",
112
- edit: "Modifica",
113
- crop: "Ritaglia",
114
- reset: "Reimposta dimensione"
96
+ inFrontText: "Davanti al testo"
115
97
  }
116
98
  } };
117
99