@univerjs/drawing-ui 1.0.0-alpha.7 → 1.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -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.7";
628
+ var version = "1.0.0-beta.0";
631
629
 
632
630
  //#endregion
633
631
  //#region src/config/config.ts
@@ -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,9 +737,8 @@ 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,
@@ -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);
@@ -837,14 +834,14 @@ function DocImageFloatingToolbar(props) {
837
834
  },
838
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),
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,14 +850,14 @@ 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) => ({
860
+ const chartTypeOptions = ((chartTypeItem === null || chartTypeItem === void 0 ? void 0 : chartTypeItem.options) ?? []).map((option) => ({
864
861
  label: String(option.label),
865
862
  value: option.value,
866
863
  icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.ChartIcon, {})
@@ -880,7 +877,7 @@ function DocChartFloatingToolbar(props) {
880
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),
881
878
  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
879
  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 : "",
880
+ value: chartTypeItem.value ?? ((_chartTypeOptions$ = chartTypeOptions[0]) === null || _chartTypeOptions$ === void 0 ? void 0 : _chartTypeOptions$.value) ?? "",
884
881
  options: chartTypeOptions,
885
882
  onChange: (value) => {
886
883
  if (!chartTypeItem.disable) {
@@ -891,7 +888,7 @@ function DocChartFloatingToolbar(props) {
891
888
  }) }), 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
889
  const Icon = iconManager.get(item.icon);
893
890
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
894
- titleKey: item.label,
891
+ title: localeService.t(item.label),
895
892
  disabled: item.disable,
896
893
  onClick: () => executeMenuItem(item),
897
894
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {})
@@ -901,7 +898,7 @@ function DocChartFloatingToolbar(props) {
901
898
  }
902
899
 
903
900
  //#endregion
904
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
901
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
905
902
  function __decorateParam(paramIndex, decorator) {
906
903
  return function(target, key) {
907
904
  decorator(target, key, paramIndex);
@@ -909,7 +906,7 @@ function __decorateParam(paramIndex, decorator) {
909
906
  }
910
907
 
911
908
  //#endregion
912
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
909
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
913
910
  function __decorate(decorators, target, key, desc) {
914
911
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
915
912
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -964,7 +961,7 @@ let ComponentsController = class ComponentsController extends _univerjs_core.Dis
964
961
  ComponentsController = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_ui.ComponentManager)), __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_ui.IconManager))], ComponentsController);
965
962
 
966
963
  //#endregion
967
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
964
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
968
965
  function _typeof(o) {
969
966
  "@babel/helpers - typeof";
970
967
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -975,7 +972,7 @@ function _typeof(o) {
975
972
  }
976
973
 
977
974
  //#endregion
978
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
975
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
979
976
  function toPrimitive(t, r) {
980
977
  if ("object" != _typeof(t) || !t) return t;
981
978
  var e = t[Symbol.toPrimitive];
@@ -988,14 +985,14 @@ function toPrimitive(t, r) {
988
985
  }
989
986
 
990
987
  //#endregion
991
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
988
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
992
989
  function toPropertyKey(t) {
993
990
  var i = toPrimitive(t, "string");
994
991
  return "symbol" == _typeof(i) ? i : i + "";
995
992
  }
996
993
 
997
994
  //#endregion
998
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
995
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
999
996
  function _defineProperty(e, r, t) {
1000
997
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
1001
998
  value: t,
@@ -1370,7 +1367,7 @@ let DrawingUpdateController = class DrawingUpdateController extends _univerjs_co
1370
1367
  }
1371
1368
  _getSceneAndTransformerByDrawingSearch(unitId) {
1372
1369
  if (unitId == null) return;
1373
- const renderObject = this._renderManagerService.getRenderById(unitId);
1370
+ const renderObject = this._renderManagerService.getRenderUnitById(unitId);
1374
1371
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
1375
1372
  if (scene == null) return null;
1376
1373
  return {
@@ -1982,7 +1979,7 @@ let ImageCropperController = class ImageCropperController extends _univerjs_core
1982
1979
  const drawingParams = this._drawingManagerService.getFocusDrawings();
1983
1980
  if (drawingParams.length !== 1) return;
1984
1981
  const { unitId, subUnitId, drawingId } = drawingParams[0];
1985
- const renderObject = this._renderManagerService.getRenderById(unitId);
1982
+ const renderObject = this._renderManagerService.getRenderUnitById(unitId);
1986
1983
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
1987
1984
  if (scene == null) return true;
1988
1985
  if (this._searchCropObject(scene) != null) this._commandService.syncExecuteCommand(CloseImageCropOperation.id, { isAuto: true });
@@ -2074,7 +2071,7 @@ let ImageCropperController = class ImageCropperController extends _univerjs_core
2074
2071
  const params = command.params;
2075
2072
  if (params == null) return;
2076
2073
  const { unitId, subUnitId, drawingId } = params;
2077
- const renderObject = this._renderManagerService.getRenderById(unitId);
2074
+ const renderObject = this._renderManagerService.getRenderUnitById(unitId);
2078
2075
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
2079
2076
  if (scene == null) return true;
2080
2077
  if (!this._sceneListenerOnImageMap.has(scene)) {
@@ -2130,7 +2127,7 @@ let ImageCropperController = class ImageCropperController extends _univerjs_core
2130
2127
  const currentUnit = this._univerInstanceService.getFocusedUnit();
2131
2128
  if (currentUnit == null) return;
2132
2129
  const unitId = currentUnit.getUnitId();
2133
- const renderObject = this._renderManagerService.getRenderById(unitId);
2130
+ const renderObject = this._renderManagerService.getRenderUnitById(unitId);
2134
2131
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
2135
2132
  if (scene == null) return true;
2136
2133
  const imageCropperObject = this._searchCropObject(scene);
@@ -2300,7 +2297,7 @@ let ImageUpdateController = class ImageUpdateController extends _univerjs_core.D
2300
2297
  }
2301
2298
  _getSceneAndTransformerByDrawingSearch(unitId) {
2302
2299
  if (unitId == null) return;
2303
- const renderObject = this._renderManagerService.getRenderById(unitId);
2300
+ const renderObject = this._renderManagerService.getRenderUnitById(unitId);
2304
2301
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
2305
2302
  if (scene == null) return null;
2306
2303
  return {
@@ -2535,7 +2532,11 @@ let UniverDrawingUIPlugin = class UniverDrawingUIPlugin extends _univerjs_core.P
2535
2532
  _defineProperty(UniverDrawingUIPlugin, "pluginName", "UNIVER_DRAWING_UI_PLUGIN");
2536
2533
  _defineProperty(UniverDrawingUIPlugin, "packageName", name);
2537
2534
  _defineProperty(UniverDrawingUIPlugin, "version", version);
2538
- UniverDrawingUIPlugin = __decorate([__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), __decorateParam(2, _univerjs_core.IConfigService)], UniverDrawingUIPlugin);
2535
+ UniverDrawingUIPlugin = __decorate([
2536
+ (0, _univerjs_core.DependentOn)(_univerjs_drawing.UniverDrawingPlugin, _univerjs_engine_render.UniverRenderEnginePlugin),
2537
+ __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
2538
+ __decorateParam(2, _univerjs_core.IConfigService)
2539
+ ], UniverDrawingUIPlugin);
2539
2540
 
2540
2541
  //#endregion
2541
2542
  //#region src/views/object-list-panel/object-list-panel-layer.ts
@@ -2601,21 +2602,17 @@ function normalizeText(value) {
2601
2602
  return value.trim();
2602
2603
  }
2603
2604
  function hasCapability(panelCapabilities, item, key, fallback = true) {
2604
- var _ref, _item$capabilities$ke, _item$capabilities;
2605
- 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;
2605
+ var _item$capabilities;
2606
+ 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;
2606
2607
  }
2607
2608
  function ObjectListPanelBase(props) {
2608
- var _selectedItem$canMove, _selectedItem$canMove2, _capabilities$reorder;
2609
2609
  const { items, selectedIds, allObjectIds, focusedId, labels, showHeader = true, capabilities, onSelect, onSetVisible, onCommitName, onCommitDescription, onMoveForward, onMoveBackward, onToggleExpanded, onToggleSelectable, onLocate, onReorder } = props;
2610
2610
  const selectedIdSet = (0, react.useMemo)(() => new Set(selectedIds), [selectedIds]);
2611
2611
  const [draggingId, setDraggingId] = (0, react.useState)(null);
2612
2612
  const [searchQuery, setSearchQuery] = (0, react.useState)("");
2613
2613
  const [filterMode, setFilterMode] = (0, react.useState)("all");
2614
2614
  const [collapsedSectionIds, setCollapsedSectionIds] = (0, react.useState)(() => /* @__PURE__ */ new Set());
2615
- const selectedItem = (0, react.useMemo)(() => {
2616
- var _ref2, _items$find;
2617
- 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;
2618
- }, [
2615
+ const selectedItem = (0, react.useMemo)(() => items.find((item) => item.id === focusedId) ?? items.find((item) => selectedIdSet.has(item.id)) ?? null, [
2619
2616
  focusedId,
2620
2617
  items,
2621
2618
  selectedIdSet
@@ -2623,11 +2620,10 @@ function ObjectListPanelBase(props) {
2623
2620
  const visibleItems = (0, react.useMemo)(() => {
2624
2621
  const normalizedQuery = normalizeText(searchQuery).toLocaleLowerCase();
2625
2622
  return items.filter((item) => {
2626
- var _item$description;
2627
2623
  if (filterMode === "hidden" && item.visible !== false) return false;
2628
2624
  if (filterMode === "locked" && item.selectable !== false) return false;
2629
2625
  if (!normalizedQuery) return true;
2630
- return item.name.toLocaleLowerCase().includes(normalizedQuery) || ((_item$description = item.description) !== null && _item$description !== void 0 ? _item$description : "").toLocaleLowerCase().includes(normalizedQuery);
2626
+ return item.name.toLocaleLowerCase().includes(normalizedQuery) || (item.description ?? "").toLocaleLowerCase().includes(normalizedQuery);
2631
2627
  });
2632
2628
  }, [
2633
2629
  filterMode,
@@ -2637,8 +2633,7 @@ function ObjectListPanelBase(props) {
2637
2633
  const visibleItemSections = (0, react.useMemo)(() => {
2638
2634
  const sectionMap = /* @__PURE__ */ new Map();
2639
2635
  visibleItems.forEach((item) => {
2640
- var _item$sectionId, _item$sectionTitle;
2641
- const sectionId = (_item$sectionId = item.sectionId) !== null && _item$sectionId !== void 0 ? _item$sectionId : "";
2636
+ const sectionId = item.sectionId ?? "";
2642
2637
  const existingSection = sectionMap.get(sectionId);
2643
2638
  if (existingSection) {
2644
2639
  existingSection.items.push(item);
@@ -2646,35 +2641,30 @@ function ObjectListPanelBase(props) {
2646
2641
  }
2647
2642
  sectionMap.set(sectionId, {
2648
2643
  id: sectionId,
2649
- title: (_item$sectionTitle = item.sectionTitle) !== null && _item$sectionTitle !== void 0 ? _item$sectionTitle : "",
2644
+ title: item.sectionTitle ?? "",
2650
2645
  items: [item]
2651
2646
  });
2652
2647
  });
2653
- return [...sectionMap.values()].sort((a, b) => {
2654
- var _sectionOrder$get, _sectionOrder$get2;
2655
- 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);
2656
- });
2648
+ return [...sectionMap.values()].sort((a, b) => (sectionOrder.get(a.id) ?? 3) - (sectionOrder.get(b.id) ?? 3));
2657
2649
  }, [visibleItems]);
2658
2650
  const showSectionHeaders = visibleItemSections.length > 1 || visibleItemSections.some((section) => section.id === "floating");
2659
- const allIds = (0, react.useMemo)(() => allObjectIds !== null && allObjectIds !== void 0 ? allObjectIds : items.map((item) => item.id), [allObjectIds, items]);
2651
+ const allIds = (0, react.useMemo)(() => allObjectIds ?? items.map((item) => item.id), [allObjectIds, items]);
2660
2652
  const selectedIndex = selectedItem ? items.findIndex((item) => item.id === selectedItem.id) : -1;
2661
- const canMoveForward = !!selectedItem && !!onMoveForward && !selectedItem.disabled && ((_selectedItem$canMove = selectedItem.canMoveForward) !== null && _selectedItem$canMove !== void 0 ? _selectedItem$canMove : selectedIndex > 0) && hasCapability(capabilities, selectedItem, "arrange");
2662
- 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");
2653
+ const canMoveForward = !!selectedItem && !!onMoveForward && !selectedItem.disabled && (selectedItem.canMoveForward ?? selectedIndex > 0) && hasCapability(capabilities, selectedItem, "arrange");
2654
+ const canMoveBackward = !!selectedItem && !!onMoveBackward && !selectedItem.disabled && (selectedItem.canMoveBackward ?? (selectedIndex >= 0 && selectedIndex < items.length - 1)) && hasCapability(capabilities, selectedItem, "arrange");
2663
2655
  const showArrangeControls = hasCapability(capabilities, selectedItem, "arrange") && (!!onMoveForward || !!onMoveBackward);
2664
2656
  const showLocateControl = !!onLocate && hasCapability(capabilities, selectedItem, "locate");
2665
- const canReorder = !!onReorder && ((_capabilities$reorder = capabilities === null || capabilities === void 0 ? void 0 : capabilities.reorder) !== null && _capabilities$reorder !== void 0 ? _capabilities$reorder : true);
2657
+ const canReorder = !!onReorder && ((capabilities === null || capabilities === void 0 ? void 0 : capabilities.reorder) ?? true);
2666
2658
  const findItem = (objectId) => {
2667
- var _items$find2;
2668
- return objectId ? (_items$find2 = items.find((item) => item.id === objectId)) !== null && _items$find2 !== void 0 ? _items$find2 : null : null;
2659
+ return objectId ? items.find((item) => item.id === objectId) ?? null : null;
2669
2660
  };
2670
2661
  const handleDrop = (targetId) => {
2671
- var _source$parentId, _target$parentId, _source$sectionId, _target$sectionId;
2672
2662
  const source = findItem(draggingId);
2673
2663
  const target = findItem(targetId);
2674
2664
  setDraggingId(null);
2675
2665
  if (!source || !target || source.id === target.id || source.disabled || target.disabled) return;
2676
- if (((_source$parentId = source.parentId) !== null && _source$parentId !== void 0 ? _source$parentId : "") !== ((_target$parentId = target.parentId) !== null && _target$parentId !== void 0 ? _target$parentId : "")) return;
2677
- if (((_source$sectionId = source.sectionId) !== null && _source$sectionId !== void 0 ? _source$sectionId : "") !== ((_target$sectionId = target.sectionId) !== null && _target$sectionId !== void 0 ? _target$sectionId : "")) return;
2666
+ if ((source.parentId ?? "") !== (target.parentId ?? "")) return;
2667
+ if ((source.sectionId ?? "") !== (target.sectionId ?? "")) return;
2678
2668
  if (source.canReorder === false || target.canReorder === false) return;
2679
2669
  onReorder === null || onReorder === void 0 || onReorder(source.id, target.id);
2680
2670
  };
@@ -2832,12 +2822,11 @@ function ObjectListPanelBase(props) {
2832
2822
  });
2833
2823
  }
2834
2824
  function ObjectListRow(props) {
2835
- var _item$level;
2836
2825
  const { item, selected, labels, showLock, showName, showVisible, draggable, dragging, onSelect, onToggleExpanded, onToggleVisible, onToggleSelectable, onCommitName, onDragStart, onDragEnd, onDrop } = props;
2837
2826
  const [draftName, setDraftName] = (0, react.useState)(item.name);
2838
2827
  const skipCommitOnBlurRef = (0, react.useRef)(false);
2839
2828
  const disabled = item.disabled === true;
2840
- const level = (_item$level = item.level) !== null && _item$level !== void 0 ? _item$level : 0;
2829
+ const level = item.level ?? 0;
2841
2830
  const locked = item.selectable === false;
2842
2831
  (0, react.useEffect)(() => {
2843
2832
  setDraftName(item.name);
@@ -2948,15 +2937,13 @@ function ObjectListRow(props) {
2948
2937
  });
2949
2938
  }
2950
2939
  function ObjectDetailsEditor(props) {
2951
- var _item$name, _item$description2;
2952
2940
  const { item, labels, showName, showDescription, onCommitName, onCommitDescription } = props;
2953
- const [draftName, setDraftName] = (0, react.useState)((_item$name = item === null || item === void 0 ? void 0 : item.name) !== null && _item$name !== void 0 ? _item$name : "");
2954
- const [draftDescription, setDraftDescription] = (0, react.useState)((_item$description2 = item === null || item === void 0 ? void 0 : item.description) !== null && _item$description2 !== void 0 ? _item$description2 : "");
2941
+ const [draftName, setDraftName] = (0, react.useState)((item === null || item === void 0 ? void 0 : item.name) ?? "");
2942
+ const [draftDescription, setDraftDescription] = (0, react.useState)((item === null || item === void 0 ? void 0 : item.description) ?? "");
2955
2943
  const disabled = (item === null || item === void 0 ? void 0 : item.disabled) === true;
2956
2944
  (0, react.useEffect)(() => {
2957
- var _item$name2, _item$description3;
2958
- setDraftName((_item$name2 = item === null || item === void 0 ? void 0 : item.name) !== null && _item$name2 !== void 0 ? _item$name2 : "");
2959
- setDraftDescription((_item$description3 = item === null || item === void 0 ? void 0 : item.description) !== null && _item$description3 !== void 0 ? _item$description3 : "");
2945
+ setDraftName((item === null || item === void 0 ? void 0 : item.name) ?? "");
2946
+ setDraftDescription((item === null || item === void 0 ? void 0 : item.description) ?? "");
2960
2947
  }, [
2961
2948
  item === null || item === void 0 ? void 0 : item.description,
2962
2949
  item === null || item === void 0 ? void 0 : item.id,
@@ -3004,8 +2991,7 @@ function ObjectDetailsEditor(props) {
3004
2991
  "aria-label": labels.description,
3005
2992
  onChange: (event) => setDraftDescription(event.currentTarget.value),
3006
2993
  onBlur: () => {
3007
- var _item$description4;
3008
- if (!disabled && normalizeText(draftDescription) !== ((_item$description4 = item.description) !== null && _item$description4 !== void 0 ? _item$description4 : "")) onCommitDescription(draftDescription);
2994
+ if (!disabled && normalizeText(draftDescription) !== (item.description ?? "")) onCommitDescription(draftDescription);
3009
2995
  }
3010
2996
  })]
3011
2997
  })
@@ -3156,7 +3142,7 @@ const DrawingGroup = (props) => {
3156
3142
  const GroupIcon = iconManager.get("GroupIcon");
3157
3143
  const UngroupIcon = iconManager.get("UngroupIcon");
3158
3144
  const drawingParam = drawings[0];
3159
- 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;
3145
+ const transformer = drawingParam ? (_renderManagerService = renderManagerService.getRenderUnitById(drawingParam.unitId)) === null || _renderManagerService === void 0 || (_renderManagerService = _renderManagerService.scene) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.getTransformerByCreate() : void 0;
3160
3146
  const { groupShow, groupBtnShow, ungroupBtnShow } = (0, _univerjs_ui.useObservable)(transformer ? () => (0, rxjs.merge)(transformer.clearControl$.pipe((0, rxjs.filter)((changeSelf) => changeSelf === true), (0, rxjs.map)(() => ({
3161
3147
  groupShow: false,
3162
3148
  groupBtnShow: false,
@@ -3235,7 +3221,7 @@ const DrawingTransform = (props) => {
3235
3221
  var _renderManagerService, _scene$getEngine;
3236
3222
  const renderManagerService = (0, _univerjs_ui.useDependency)(_univerjs_engine_render.IRenderManagerService);
3237
3223
  const drawingParam = props.drawings[0];
3238
- const scene = drawingParam ? (_renderManagerService = renderManagerService.getRenderById(drawingParam.unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.scene : void 0;
3224
+ const scene = drawingParam ? (_renderManagerService = renderManagerService.getRenderUnitById(drawingParam.unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.scene : void 0;
3239
3225
  const topScene = scene === null || scene === void 0 || (_scene$getEngine = scene.getEngine()) === null || _scene$getEngine === void 0 ? void 0 : _scene$getEngine.activeScene;
3240
3226
  if (!(drawingParam === null || drawingParam === void 0 ? void 0 : drawingParam.transform) || !scene || !topScene) return null;
3241
3227
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DrawingTransformContent, { ...props });
@@ -3248,7 +3234,7 @@ function DrawingTransformContent(props) {
3248
3234
  const drawingParam = drawings[0];
3249
3235
  const transform = drawingParam.transform;
3250
3236
  const { unitId, subUnitId, drawingId, drawingType } = drawingParam;
3251
- const scene = renderManagerService.getRenderById(unitId).scene;
3237
+ const scene = renderManagerService.getRenderUnitById(unitId).scene;
3252
3238
  const topScene = scene.getEngine().activeScene;
3253
3239
  const transformer = scene.getTransformerByCreate();
3254
3240
  const { width: originWidth = 0, height: originHeight = 0, left: originX = 0, top: originY = 0, angle: originRotation = 0 } = transform;
@@ -3615,7 +3601,7 @@ const DrawingCommonPanel = (props) => {
3615
3601
  const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
3616
3602
  const { drawings, hasArrange = true, hasTransform = true, hasAlign = true, hasCropper = true, hasGroup = true } = props;
3617
3603
  const drawingParam = drawings[0];
3618
- const renderObject = drawingParam ? renderManagerService.getRenderById(drawingParam.unitId) : void 0;
3604
+ const renderObject = drawingParam ? renderManagerService.getRenderUnitById(drawingParam.unitId) : void 0;
3619
3605
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
3620
3606
  const transformer = scene === null || scene === void 0 ? void 0 : scene.getTransformerByCreate();
3621
3607
  const { arrangeShow, transformShow, alignShow, cropperShow, nullShow } = (0, _univerjs_ui.useObservable)(() => (0, rxjs.merge)(drawingManagerService.focus$.pipe((0, rxjs.map)(getPanelShowState)), ...transformer ? [transformer.clearControl$.pipe((0, rxjs.filter)((changeSelf) => changeSelf === true), (0, rxjs.map)(() => getPanelShowState([]))), transformer.changeStart$.pipe((0, rxjs.map)((state) => getPanelShowState(getUpdateParams(state.objects, drawingManagerService))))] : []), getPanelShowState(drawings), false, [drawingManagerService, transformer]);
@@ -18,7 +18,7 @@ const locale = { "drawing-ui": {
18
18
  nameInput: "Nom de l'objet",
19
19
  description: "Description",
20
20
  descriptionPlaceholder: "Ajouter une description",
21
- details: "Details",
21
+ details: "Détails",
22
22
  locate: "Localiser",
23
23
  expand: "Développer",
24
24
  collapse: "Réduire",
@@ -89,22 +89,22 @@ const locale = { "drawing-ui": {
89
89
  null: "Нет выбранных объектов"
90
90
  },
91
91
  "image-text-wrap": {
92
- title: "Text Wrapping",
93
- wrappingStyle: "Wrapping Style",
94
- square: "Square",
95
- topAndBottom: "Top and Bottom",
96
- inline: "In line with text",
97
- behindText: "Behind text",
98
- inFrontText: "In front of text",
99
- wrapText: "Wrap text",
100
- bothSide: "Both sides",
101
- leftOnly: "Left only",
102
- rightOnly: "Right only",
103
- distanceFromText: "Distance from text",
104
- top: "Top(px)",
105
- left: "Left(px)",
106
- bottom: "Bottom(px)",
107
- right: "Right(px)"
92
+ title: "Обтекание текстом",
93
+ wrappingStyle: "Стиль обтекания",
94
+ square: "Вокруг рамки",
95
+ topAndBottom: "Сверху и снизу",
96
+ inline: "В тексте",
97
+ behindText: "За текстом",
98
+ inFrontText: "Перед текстом",
99
+ wrapText: "Обтекание",
100
+ bothSide: "С обеих сторон",
101
+ leftOnly: "Только слева",
102
+ rightOnly: "Только справа",
103
+ distanceFromText: "Расстояние от текста",
104
+ top: "Сверху (пкс)",
105
+ left: "Слева (пкс)",
106
+ bottom: "Снизу (пкс)",
107
+ right: "Справа (пкс)"
108
108
  },
109
109
  "image-popup": {
110
110
  replace: "Заменить",
@@ -89,22 +89,22 @@ const locale = { "drawing-ui": {
89
89
  null: "Không có đối tượng nào được chọn"
90
90
  },
91
91
  "image-text-wrap": {
92
- title: "Text Wrapping",
93
- wrappingStyle: "Wrapping Style",
94
- square: "Square",
95
- topAndBottom: "Top and Bottom",
96
- inline: "In line with text",
97
- behindText: "Behind text",
98
- inFrontText: "In front of text",
99
- wrapText: "Wrap text",
100
- bothSide: "Both sides",
101
- leftOnly: "Left only",
102
- rightOnly: "Right only",
103
- distanceFromText: "Distance from text",
104
- top: "Top(px)",
105
- left: "Left(px)",
106
- bottom: "Bottom(px)",
107
- right: "Right(px)"
92
+ title: "Bố cục văn bản",
93
+ wrappingStyle: "Kiểu bố cục",
94
+ square: "Vuông",
95
+ topAndBottom: "Trên dưới",
96
+ inline: "Cùng dòng với văn bản",
97
+ behindText: "Phía sau văn bản",
98
+ inFrontText: "Phía trước văn bản",
99
+ wrapText: "Bọc văn bản",
100
+ bothSide: "Cả hai bên",
101
+ leftOnly: "Chỉ bên trái",
102
+ rightOnly: "Chỉ bên phải",
103
+ distanceFromText: "Khoảng cách từ văn bản",
104
+ top: "Trên (px)",
105
+ left: "Trái (px)",
106
+ bottom: "Dưới (px)",
107
+ right: "Phải (px)"
108
108
  },
109
109
  "image-popup": {
110
110
  replace: "Thay thế",