@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/es/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { ArrangeTypeEnum, BooleanNumber, CommandType, Disposable, DrawingTypeEnum, ICommandService, IConfigService, IImageIoService, IURLImageService, IUniverInstanceService, ImageSourceType, Inject, Injector, LocaleService, Plugin, PositionedObjectLayoutType, UniverInstanceType, checkIfMove, debounce, generateRandomId, merge, toDisposable } from "@univerjs/core";
2
- import { DRAWING_GROUPABLE_TYPES, IDrawingManagerService, SetDrawingSelectedOperation, getDrawingShapeKeyByDrawingSearch, isGroupableDrawingType, resolveDrawingRotateEnabled } from "@univerjs/drawing";
3
- import { CURSOR_TYPE, Canvas, DRAWING_OBJECT_LAYER_INDEX, DrawingGroupObject, Group, IRenderManagerService, Image, RENDER_CLASS_TYPE, Rect, Shape, Vector2, degToRad, getGroupState, precisionTo, transformObjectOutOfGroup } from "@univerjs/engine-render";
1
+ import { ArrangeTypeEnum, BooleanNumber, CommandType, DependentOn, Disposable, DrawingTypeEnum, ICommandService, IConfigService, IImageIoService, IURLImageService, IUniverInstanceService, ImageSourceType, Inject, Injector, LocaleService, Plugin, PositionedObjectLayoutType, UniverInstanceType, checkIfMove, debounce, generateRandomId, merge, toDisposable } from "@univerjs/core";
2
+ import { DRAWING_GROUPABLE_TYPES, IDrawingManagerService, SetDrawingSelectedOperation, UniverDrawingPlugin, getDrawingShapeKeyByDrawingSearch, isGroupableDrawingType, resolveDrawingRotateEnabled } from "@univerjs/drawing";
3
+ import { CURSOR_TYPE, Canvas, DRAWING_OBJECT_LAYER_INDEX, DrawingGroupObject, Group, IRenderManagerService, Image, RENDER_CLASS_TYPE, Rect, Shape, UniverRenderEnginePlugin, Vector2, degToRad, getGroupState, precisionTo, transformObjectOutOfGroup } from "@univerjs/engine-render";
4
4
  import { ComponentManager, ContextMenuGroup, ContextMenuPosition, IDialogService, IGalleryService, IMenuManagerService, IMessageService, IconManager, MenuItemType, useDependency, useObservable } from "@univerjs/ui";
5
5
  import { BehaviorSubject, Observable, bufferTime, filter, map, merge as merge$1, of, startWith, switchMap } from "rxjs";
6
6
  import { ArrowDownIcon, ArrowUpIcon, AutofillDoubleIcon, BottomIcon, ChartIcon, CreateCopyIcon, CropIcon, DeleteIcon, DocSettingIcon, EyeIcon, EyelashIcon, GroupIcon, LocateFixedIcon, LockIcon, MoreDownIcon, MoreRightIcon, MoveDownIcon, MoveUpIcon, TextWrapShapeIcon, TopmostIcon, UngroupIcon, UnlockIcon } from "@univerjs/icons";
@@ -271,19 +271,17 @@ function isKnownDrawingUINonRotatableType(drawingType) {
271
271
  return drawingType === DrawingTypeEnum.DRAWING_CHART;
272
272
  }
273
273
  function resolveDrawingUIRotateEnabled(drawing, options = {}) {
274
- var _options$isKnownNonRo;
275
274
  return resolveDrawingRotateEnabled(drawing, {
276
275
  ...options,
277
- isKnownNonRotatableType: (_options$isKnownNonRo = options.isKnownNonRotatableType) !== null && _options$isKnownNonRo !== void 0 ? _options$isKnownNonRo : isKnownDrawingUINonRotatableType
276
+ isKnownNonRotatableType: options.isKnownNonRotatableType ?? isKnownDrawingUINonRotatableType
278
277
  });
279
278
  }
280
279
 
281
280
  //#endregion
282
281
  //#region src/controllers/utils.ts
283
282
  function getDrawingRenderObject(scene, drawingSearch) {
284
- var _scene$getObjectInclu;
285
283
  const key = getDrawingShapeKeyByDrawingSearch(drawingSearch);
286
- return (_scene$getObjectInclu = scene.getObjectIncludeInGroup(key)) !== null && _scene$getObjectInclu !== void 0 ? _scene$getObjectInclu : null;
284
+ return scene.getObjectIncludeInGroup(key) ?? null;
287
285
  }
288
286
  function disposeDrawingRenderObject(scene, drawingSearch) {
289
287
  const object = getDrawingRenderObject(scene, drawingSearch);
@@ -626,7 +624,7 @@ const menuSchema = { [ContextMenuPosition.DRAWING]: { [ContextMenuGroup.OTHERS]:
626
624
  //#endregion
627
625
  //#region package.json
628
626
  var name = "@univerjs/drawing-ui";
629
- var version = "1.0.0-alpha.7";
627
+ var version = "1.0.0-beta.0";
630
628
 
631
629
  //#endregion
632
630
  //#region src/config/config.ts
@@ -726,7 +724,7 @@ function ToolbarGroup(props) {
726
724
  }
727
725
  function ToolbarButton(props) {
728
726
  return /* @__PURE__ */ jsx(Tooltip, {
729
- title: useDependency(LocaleService).t(props.titleKey),
727
+ title: props.title,
730
728
  placement: "bottom",
731
729
  children: /* @__PURE__ */ jsx("button", {
732
730
  type: "button",
@@ -738,9 +736,8 @@ function ToolbarButton(props) {
738
736
  });
739
737
  }
740
738
  function ToolbarDropdownButton(props) {
741
- var _props$options$find;
742
739
  const [open, setOpen] = useState(false);
743
- 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];
740
+ const activeOption = props.options.find((option) => option.value === props.value) ?? props.options[0];
744
741
  return /* @__PURE__ */ jsx(Dropdown, {
745
742
  open,
746
743
  onOpenChange: setOpen,
@@ -774,11 +771,11 @@ function ToolbarDropdownButton(props) {
774
771
  });
775
772
  }
776
773
  function DocImageFloatingToolbar(props) {
777
- var _univerInstanceServic, _wrappingStyleOptions, _wrappingStyleOptions2;
774
+ var _wrappingStyleOptions;
778
775
  const commandService = useDependency(ICommandService);
779
776
  const iconManager = useDependency(IconManager);
780
777
  const localeService = useDependency(LocaleService);
781
- const documentDataModel = (_univerInstanceServic = useDependency(IUniverInstanceService).getUnit(props.unitId, UniverInstanceType.UNIVER_DOC)) !== null && _univerInstanceServic !== void 0 ? _univerInstanceServic : void 0;
778
+ const documentDataModel = useDependency(IUniverInstanceService).getUnit(props.unitId, UniverInstanceType.UNIVER_DOC) ?? void 0;
782
779
  const [wrappingStyle, setWrappingStyle] = useState(() => getWrappingStyle(documentDataModel, props.drawingId));
783
780
  const [hidden, setHidden] = useState(false);
784
781
  const actionItems = props.menuItems.filter((item) => item.type !== "select" && item.icon).sort((a, b) => a.index - b.index);
@@ -836,14 +833,14 @@ function DocImageFloatingToolbar(props) {
836
833
  },
837
834
  className: clsx("univer-box-border univer-flex univer-items-center univer-rounded univer-bg-white univer-px-1 univer-py-1 univer-shadow-sm dark:!univer-border-gray-700 dark:!univer-bg-gray-900", borderClassName),
838
835
  children: [/* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(ToolbarDropdownButton, {
839
- 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"),
836
+ title: ((_wrappingStyleOptions = wrappingStyleOptions.find((option) => option.value === wrappingStyle)) === null || _wrappingStyleOptions === void 0 ? void 0 : _wrappingStyleOptions.label) ?? localeService.t("drawing-ui.image-text-wrap.inline"),
840
837
  value: wrappingStyle,
841
838
  options: wrappingStyleOptions,
842
839
  onChange: updateWrappingStyle
843
840
  }) }), actionItems.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Separator, { orientation: "vertical" }), /* @__PURE__ */ jsx(ToolbarGroup, { children: actionItems.map((item) => {
844
841
  const Icon = iconManager.get(item.icon);
845
842
  return /* @__PURE__ */ jsx(ToolbarButton, {
846
- titleKey: item.label,
843
+ title: localeService.t(item.label),
847
844
  disabled: item.disable,
848
845
  onClick: () => executeMenuItem(item),
849
846
  children: /* @__PURE__ */ jsx(Icon, {})
@@ -852,14 +849,14 @@ function DocImageFloatingToolbar(props) {
852
849
  });
853
850
  }
854
851
  function DocChartFloatingToolbar(props) {
855
- var _chartTypeItem$option, _ref, _chartTypeItem$value, _chartTypeOptions$;
852
+ var _chartTypeOptions$;
856
853
  const commandService = useDependency(ICommandService);
857
854
  const iconManager = useDependency(IconManager);
858
855
  const localeService = useDependency(LocaleService);
859
856
  const [hidden, setHidden] = useState(false);
860
857
  const chartTypeItem = props.menuItems.find((item) => item.type === "select");
861
858
  const actionItems = props.menuItems.filter((item) => item.type !== "select" && item.icon).sort((a, b) => a.index - b.index);
862
- const chartTypeOptions = ((_chartTypeItem$option = chartTypeItem === null || chartTypeItem === void 0 ? void 0 : chartTypeItem.options) !== null && _chartTypeItem$option !== void 0 ? _chartTypeItem$option : []).map((option) => ({
859
+ const chartTypeOptions = ((chartTypeItem === null || chartTypeItem === void 0 ? void 0 : chartTypeItem.options) ?? []).map((option) => ({
863
860
  label: String(option.label),
864
861
  value: option.value,
865
862
  icon: /* @__PURE__ */ jsx(ChartIcon, {})
@@ -879,7 +876,7 @@ function DocChartFloatingToolbar(props) {
879
876
  className: clsx("univer-box-border univer-flex univer-items-center univer-rounded univer-bg-white univer-px-1 univer-py-1 univer-shadow-sm dark:!univer-border-gray-700 dark:!univer-bg-gray-900", borderClassName),
880
877
  children: [chartTypeItem && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(ToolbarDropdownButton, {
881
878
  title: localeService.t(chartTypeItem.label),
882
- 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 : "",
879
+ value: chartTypeItem.value ?? ((_chartTypeOptions$ = chartTypeOptions[0]) === null || _chartTypeOptions$ === void 0 ? void 0 : _chartTypeOptions$.value) ?? "",
883
880
  options: chartTypeOptions,
884
881
  onChange: (value) => {
885
882
  if (!chartTypeItem.disable) {
@@ -890,7 +887,7 @@ function DocChartFloatingToolbar(props) {
890
887
  }) }), actionItems.length > 0 && /* @__PURE__ */ jsx(Separator, { orientation: "vertical" })] }), actionItems.length > 0 && /* @__PURE__ */ jsx(ToolbarGroup, { children: actionItems.map((item) => {
891
888
  const Icon = iconManager.get(item.icon);
892
889
  return /* @__PURE__ */ jsx(ToolbarButton, {
893
- titleKey: item.label,
890
+ title: localeService.t(item.label),
894
891
  disabled: item.disable,
895
892
  onClick: () => executeMenuItem(item),
896
893
  children: /* @__PURE__ */ jsx(Icon, {})
@@ -900,7 +897,7 @@ function DocChartFloatingToolbar(props) {
900
897
  }
901
898
 
902
899
  //#endregion
903
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
900
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
904
901
  function __decorateParam(paramIndex, decorator) {
905
902
  return function(target, key) {
906
903
  decorator(target, key, paramIndex);
@@ -908,7 +905,7 @@ function __decorateParam(paramIndex, decorator) {
908
905
  }
909
906
 
910
907
  //#endregion
911
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
908
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
912
909
  function __decorate(decorators, target, key, desc) {
913
910
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
914
911
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -963,7 +960,7 @@ let ComponentsController = class ComponentsController extends Disposable {
963
960
  ComponentsController = __decorate([__decorateParam(0, Inject(ComponentManager)), __decorateParam(1, Inject(IconManager))], ComponentsController);
964
961
 
965
962
  //#endregion
966
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
963
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
967
964
  function _typeof(o) {
968
965
  "@babel/helpers - typeof";
969
966
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -974,7 +971,7 @@ function _typeof(o) {
974
971
  }
975
972
 
976
973
  //#endregion
977
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
974
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
978
975
  function toPrimitive(t, r) {
979
976
  if ("object" != _typeof(t) || !t) return t;
980
977
  var e = t[Symbol.toPrimitive];
@@ -987,14 +984,14 @@ function toPrimitive(t, r) {
987
984
  }
988
985
 
989
986
  //#endregion
990
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
987
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
991
988
  function toPropertyKey(t) {
992
989
  var i = toPrimitive(t, "string");
993
990
  return "symbol" == _typeof(i) ? i : i + "";
994
991
  }
995
992
 
996
993
  //#endregion
997
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
994
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
998
995
  function _defineProperty(e, r, t) {
999
996
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
1000
997
  value: t,
@@ -1369,7 +1366,7 @@ let DrawingUpdateController = class DrawingUpdateController extends Disposable {
1369
1366
  }
1370
1367
  _getSceneAndTransformerByDrawingSearch(unitId) {
1371
1368
  if (unitId == null) return;
1372
- const renderObject = this._renderManagerService.getRenderById(unitId);
1369
+ const renderObject = this._renderManagerService.getRenderUnitById(unitId);
1373
1370
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
1374
1371
  if (scene == null) return null;
1375
1372
  return {
@@ -1981,7 +1978,7 @@ let ImageCropperController = class ImageCropperController extends Disposable {
1981
1978
  const drawingParams = this._drawingManagerService.getFocusDrawings();
1982
1979
  if (drawingParams.length !== 1) return;
1983
1980
  const { unitId, subUnitId, drawingId } = drawingParams[0];
1984
- const renderObject = this._renderManagerService.getRenderById(unitId);
1981
+ const renderObject = this._renderManagerService.getRenderUnitById(unitId);
1985
1982
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
1986
1983
  if (scene == null) return true;
1987
1984
  if (this._searchCropObject(scene) != null) this._commandService.syncExecuteCommand(CloseImageCropOperation.id, { isAuto: true });
@@ -2073,7 +2070,7 @@ let ImageCropperController = class ImageCropperController extends Disposable {
2073
2070
  const params = command.params;
2074
2071
  if (params == null) return;
2075
2072
  const { unitId, subUnitId, drawingId } = params;
2076
- const renderObject = this._renderManagerService.getRenderById(unitId);
2073
+ const renderObject = this._renderManagerService.getRenderUnitById(unitId);
2077
2074
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
2078
2075
  if (scene == null) return true;
2079
2076
  if (!this._sceneListenerOnImageMap.has(scene)) {
@@ -2129,7 +2126,7 @@ let ImageCropperController = class ImageCropperController extends Disposable {
2129
2126
  const currentUnit = this._univerInstanceService.getFocusedUnit();
2130
2127
  if (currentUnit == null) return;
2131
2128
  const unitId = currentUnit.getUnitId();
2132
- const renderObject = this._renderManagerService.getRenderById(unitId);
2129
+ const renderObject = this._renderManagerService.getRenderUnitById(unitId);
2133
2130
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
2134
2131
  if (scene == null) return true;
2135
2132
  const imageCropperObject = this._searchCropObject(scene);
@@ -2299,7 +2296,7 @@ let ImageUpdateController = class ImageUpdateController extends Disposable {
2299
2296
  }
2300
2297
  _getSceneAndTransformerByDrawingSearch(unitId) {
2301
2298
  if (unitId == null) return;
2302
- const renderObject = this._renderManagerService.getRenderById(unitId);
2299
+ const renderObject = this._renderManagerService.getRenderUnitById(unitId);
2303
2300
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
2304
2301
  if (scene == null) return null;
2305
2302
  return {
@@ -2534,7 +2531,11 @@ let UniverDrawingUIPlugin = class UniverDrawingUIPlugin extends Plugin {
2534
2531
  _defineProperty(UniverDrawingUIPlugin, "pluginName", "UNIVER_DRAWING_UI_PLUGIN");
2535
2532
  _defineProperty(UniverDrawingUIPlugin, "packageName", name);
2536
2533
  _defineProperty(UniverDrawingUIPlugin, "version", version);
2537
- UniverDrawingUIPlugin = __decorate([__decorateParam(1, Inject(Injector)), __decorateParam(2, IConfigService)], UniverDrawingUIPlugin);
2534
+ UniverDrawingUIPlugin = __decorate([
2535
+ DependentOn(UniverDrawingPlugin, UniverRenderEnginePlugin),
2536
+ __decorateParam(1, Inject(Injector)),
2537
+ __decorateParam(2, IConfigService)
2538
+ ], UniverDrawingUIPlugin);
2538
2539
 
2539
2540
  //#endregion
2540
2541
  //#region src/views/object-list-panel/object-list-panel-layer.ts
@@ -2600,21 +2601,17 @@ function normalizeText(value) {
2600
2601
  return value.trim();
2601
2602
  }
2602
2603
  function hasCapability(panelCapabilities, item, key, fallback = true) {
2603
- var _ref, _item$capabilities$ke, _item$capabilities;
2604
- 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;
2604
+ var _item$capabilities;
2605
+ 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;
2605
2606
  }
2606
2607
  function ObjectListPanelBase(props) {
2607
- var _selectedItem$canMove, _selectedItem$canMove2, _capabilities$reorder;
2608
2608
  const { items, selectedIds, allObjectIds, focusedId, labels, showHeader = true, capabilities, onSelect, onSetVisible, onCommitName, onCommitDescription, onMoveForward, onMoveBackward, onToggleExpanded, onToggleSelectable, onLocate, onReorder } = props;
2609
2609
  const selectedIdSet = useMemo(() => new Set(selectedIds), [selectedIds]);
2610
2610
  const [draggingId, setDraggingId] = useState(null);
2611
2611
  const [searchQuery, setSearchQuery] = useState("");
2612
2612
  const [filterMode, setFilterMode] = useState("all");
2613
2613
  const [collapsedSectionIds, setCollapsedSectionIds] = useState(() => /* @__PURE__ */ new Set());
2614
- const selectedItem = useMemo(() => {
2615
- var _ref2, _items$find;
2616
- 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;
2617
- }, [
2614
+ const selectedItem = useMemo(() => items.find((item) => item.id === focusedId) ?? items.find((item) => selectedIdSet.has(item.id)) ?? null, [
2618
2615
  focusedId,
2619
2616
  items,
2620
2617
  selectedIdSet
@@ -2622,11 +2619,10 @@ function ObjectListPanelBase(props) {
2622
2619
  const visibleItems = useMemo(() => {
2623
2620
  const normalizedQuery = normalizeText(searchQuery).toLocaleLowerCase();
2624
2621
  return items.filter((item) => {
2625
- var _item$description;
2626
2622
  if (filterMode === "hidden" && item.visible !== false) return false;
2627
2623
  if (filterMode === "locked" && item.selectable !== false) return false;
2628
2624
  if (!normalizedQuery) return true;
2629
- return item.name.toLocaleLowerCase().includes(normalizedQuery) || ((_item$description = item.description) !== null && _item$description !== void 0 ? _item$description : "").toLocaleLowerCase().includes(normalizedQuery);
2625
+ return item.name.toLocaleLowerCase().includes(normalizedQuery) || (item.description ?? "").toLocaleLowerCase().includes(normalizedQuery);
2630
2626
  });
2631
2627
  }, [
2632
2628
  filterMode,
@@ -2636,8 +2632,7 @@ function ObjectListPanelBase(props) {
2636
2632
  const visibleItemSections = useMemo(() => {
2637
2633
  const sectionMap = /* @__PURE__ */ new Map();
2638
2634
  visibleItems.forEach((item) => {
2639
- var _item$sectionId, _item$sectionTitle;
2640
- const sectionId = (_item$sectionId = item.sectionId) !== null && _item$sectionId !== void 0 ? _item$sectionId : "";
2635
+ const sectionId = item.sectionId ?? "";
2641
2636
  const existingSection = sectionMap.get(sectionId);
2642
2637
  if (existingSection) {
2643
2638
  existingSection.items.push(item);
@@ -2645,35 +2640,30 @@ function ObjectListPanelBase(props) {
2645
2640
  }
2646
2641
  sectionMap.set(sectionId, {
2647
2642
  id: sectionId,
2648
- title: (_item$sectionTitle = item.sectionTitle) !== null && _item$sectionTitle !== void 0 ? _item$sectionTitle : "",
2643
+ title: item.sectionTitle ?? "",
2649
2644
  items: [item]
2650
2645
  });
2651
2646
  });
2652
- return [...sectionMap.values()].sort((a, b) => {
2653
- var _sectionOrder$get, _sectionOrder$get2;
2654
- 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);
2655
- });
2647
+ return [...sectionMap.values()].sort((a, b) => (sectionOrder.get(a.id) ?? 3) - (sectionOrder.get(b.id) ?? 3));
2656
2648
  }, [visibleItems]);
2657
2649
  const showSectionHeaders = visibleItemSections.length > 1 || visibleItemSections.some((section) => section.id === "floating");
2658
- const allIds = useMemo(() => allObjectIds !== null && allObjectIds !== void 0 ? allObjectIds : items.map((item) => item.id), [allObjectIds, items]);
2650
+ const allIds = useMemo(() => allObjectIds ?? items.map((item) => item.id), [allObjectIds, items]);
2659
2651
  const selectedIndex = selectedItem ? items.findIndex((item) => item.id === selectedItem.id) : -1;
2660
- const canMoveForward = !!selectedItem && !!onMoveForward && !selectedItem.disabled && ((_selectedItem$canMove = selectedItem.canMoveForward) !== null && _selectedItem$canMove !== void 0 ? _selectedItem$canMove : selectedIndex > 0) && hasCapability(capabilities, selectedItem, "arrange");
2661
- 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");
2652
+ const canMoveForward = !!selectedItem && !!onMoveForward && !selectedItem.disabled && (selectedItem.canMoveForward ?? selectedIndex > 0) && hasCapability(capabilities, selectedItem, "arrange");
2653
+ const canMoveBackward = !!selectedItem && !!onMoveBackward && !selectedItem.disabled && (selectedItem.canMoveBackward ?? (selectedIndex >= 0 && selectedIndex < items.length - 1)) && hasCapability(capabilities, selectedItem, "arrange");
2662
2654
  const showArrangeControls = hasCapability(capabilities, selectedItem, "arrange") && (!!onMoveForward || !!onMoveBackward);
2663
2655
  const showLocateControl = !!onLocate && hasCapability(capabilities, selectedItem, "locate");
2664
- const canReorder = !!onReorder && ((_capabilities$reorder = capabilities === null || capabilities === void 0 ? void 0 : capabilities.reorder) !== null && _capabilities$reorder !== void 0 ? _capabilities$reorder : true);
2656
+ const canReorder = !!onReorder && ((capabilities === null || capabilities === void 0 ? void 0 : capabilities.reorder) ?? true);
2665
2657
  const findItem = (objectId) => {
2666
- var _items$find2;
2667
- return objectId ? (_items$find2 = items.find((item) => item.id === objectId)) !== null && _items$find2 !== void 0 ? _items$find2 : null : null;
2658
+ return objectId ? items.find((item) => item.id === objectId) ?? null : null;
2668
2659
  };
2669
2660
  const handleDrop = (targetId) => {
2670
- var _source$parentId, _target$parentId, _source$sectionId, _target$sectionId;
2671
2661
  const source = findItem(draggingId);
2672
2662
  const target = findItem(targetId);
2673
2663
  setDraggingId(null);
2674
2664
  if (!source || !target || source.id === target.id || source.disabled || target.disabled) return;
2675
- if (((_source$parentId = source.parentId) !== null && _source$parentId !== void 0 ? _source$parentId : "") !== ((_target$parentId = target.parentId) !== null && _target$parentId !== void 0 ? _target$parentId : "")) return;
2676
- if (((_source$sectionId = source.sectionId) !== null && _source$sectionId !== void 0 ? _source$sectionId : "") !== ((_target$sectionId = target.sectionId) !== null && _target$sectionId !== void 0 ? _target$sectionId : "")) return;
2665
+ if ((source.parentId ?? "") !== (target.parentId ?? "")) return;
2666
+ if ((source.sectionId ?? "") !== (target.sectionId ?? "")) return;
2677
2667
  if (source.canReorder === false || target.canReorder === false) return;
2678
2668
  onReorder === null || onReorder === void 0 || onReorder(source.id, target.id);
2679
2669
  };
@@ -2831,12 +2821,11 @@ function ObjectListPanelBase(props) {
2831
2821
  });
2832
2822
  }
2833
2823
  function ObjectListRow(props) {
2834
- var _item$level;
2835
2824
  const { item, selected, labels, showLock, showName, showVisible, draggable, dragging, onSelect, onToggleExpanded, onToggleVisible, onToggleSelectable, onCommitName, onDragStart, onDragEnd, onDrop } = props;
2836
2825
  const [draftName, setDraftName] = useState(item.name);
2837
2826
  const skipCommitOnBlurRef = useRef(false);
2838
2827
  const disabled = item.disabled === true;
2839
- const level = (_item$level = item.level) !== null && _item$level !== void 0 ? _item$level : 0;
2828
+ const level = item.level ?? 0;
2840
2829
  const locked = item.selectable === false;
2841
2830
  useEffect(() => {
2842
2831
  setDraftName(item.name);
@@ -2947,15 +2936,13 @@ function ObjectListRow(props) {
2947
2936
  });
2948
2937
  }
2949
2938
  function ObjectDetailsEditor(props) {
2950
- var _item$name, _item$description2;
2951
2939
  const { item, labels, showName, showDescription, onCommitName, onCommitDescription } = props;
2952
- const [draftName, setDraftName] = useState((_item$name = item === null || item === void 0 ? void 0 : item.name) !== null && _item$name !== void 0 ? _item$name : "");
2953
- const [draftDescription, setDraftDescription] = useState((_item$description2 = item === null || item === void 0 ? void 0 : item.description) !== null && _item$description2 !== void 0 ? _item$description2 : "");
2940
+ const [draftName, setDraftName] = useState((item === null || item === void 0 ? void 0 : item.name) ?? "");
2941
+ const [draftDescription, setDraftDescription] = useState((item === null || item === void 0 ? void 0 : item.description) ?? "");
2954
2942
  const disabled = (item === null || item === void 0 ? void 0 : item.disabled) === true;
2955
2943
  useEffect(() => {
2956
- var _item$name2, _item$description3;
2957
- setDraftName((_item$name2 = item === null || item === void 0 ? void 0 : item.name) !== null && _item$name2 !== void 0 ? _item$name2 : "");
2958
- setDraftDescription((_item$description3 = item === null || item === void 0 ? void 0 : item.description) !== null && _item$description3 !== void 0 ? _item$description3 : "");
2944
+ setDraftName((item === null || item === void 0 ? void 0 : item.name) ?? "");
2945
+ setDraftDescription((item === null || item === void 0 ? void 0 : item.description) ?? "");
2959
2946
  }, [
2960
2947
  item === null || item === void 0 ? void 0 : item.description,
2961
2948
  item === null || item === void 0 ? void 0 : item.id,
@@ -3003,8 +2990,7 @@ function ObjectDetailsEditor(props) {
3003
2990
  "aria-label": labels.description,
3004
2991
  onChange: (event) => setDraftDescription(event.currentTarget.value),
3005
2992
  onBlur: () => {
3006
- var _item$description4;
3007
- if (!disabled && normalizeText(draftDescription) !== ((_item$description4 = item.description) !== null && _item$description4 !== void 0 ? _item$description4 : "")) onCommitDescription(draftDescription);
2993
+ if (!disabled && normalizeText(draftDescription) !== (item.description ?? "")) onCommitDescription(draftDescription);
3008
2994
  }
3009
2995
  })]
3010
2996
  })
@@ -3155,7 +3141,7 @@ const DrawingGroup = (props) => {
3155
3141
  const GroupIcon = iconManager.get("GroupIcon");
3156
3142
  const UngroupIcon = iconManager.get("UngroupIcon");
3157
3143
  const drawingParam = drawings[0];
3158
- 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;
3144
+ 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;
3159
3145
  const { groupShow, groupBtnShow, ungroupBtnShow } = useObservable(transformer ? () => merge$1(transformer.clearControl$.pipe(filter((changeSelf) => changeSelf === true), map(() => ({
3160
3146
  groupShow: false,
3161
3147
  groupBtnShow: false,
@@ -3234,7 +3220,7 @@ const DrawingTransform = (props) => {
3234
3220
  var _renderManagerService, _scene$getEngine;
3235
3221
  const renderManagerService = useDependency(IRenderManagerService);
3236
3222
  const drawingParam = props.drawings[0];
3237
- const scene = drawingParam ? (_renderManagerService = renderManagerService.getRenderById(drawingParam.unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.scene : void 0;
3223
+ const scene = drawingParam ? (_renderManagerService = renderManagerService.getRenderUnitById(drawingParam.unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.scene : void 0;
3238
3224
  const topScene = scene === null || scene === void 0 || (_scene$getEngine = scene.getEngine()) === null || _scene$getEngine === void 0 ? void 0 : _scene$getEngine.activeScene;
3239
3225
  if (!(drawingParam === null || drawingParam === void 0 ? void 0 : drawingParam.transform) || !scene || !topScene) return null;
3240
3226
  return /* @__PURE__ */ jsx(DrawingTransformContent, { ...props });
@@ -3247,7 +3233,7 @@ function DrawingTransformContent(props) {
3247
3233
  const drawingParam = drawings[0];
3248
3234
  const transform = drawingParam.transform;
3249
3235
  const { unitId, subUnitId, drawingId, drawingType } = drawingParam;
3250
- const scene = renderManagerService.getRenderById(unitId).scene;
3236
+ const scene = renderManagerService.getRenderUnitById(unitId).scene;
3251
3237
  const topScene = scene.getEngine().activeScene;
3252
3238
  const transformer = scene.getTransformerByCreate();
3253
3239
  const { width: originWidth = 0, height: originHeight = 0, left: originX = 0, top: originY = 0, angle: originRotation = 0 } = transform;
@@ -3614,7 +3600,7 @@ const DrawingCommonPanel = (props) => {
3614
3600
  const localeService = useDependency(LocaleService);
3615
3601
  const { drawings, hasArrange = true, hasTransform = true, hasAlign = true, hasCropper = true, hasGroup = true } = props;
3616
3602
  const drawingParam = drawings[0];
3617
- const renderObject = drawingParam ? renderManagerService.getRenderById(drawingParam.unitId) : void 0;
3603
+ const renderObject = drawingParam ? renderManagerService.getRenderUnitById(drawingParam.unitId) : void 0;
3618
3604
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
3619
3605
  const transformer = scene === null || scene === void 0 ? void 0 : scene.getTransformerByCreate();
3620
3606
  const { arrangeShow, transformShow, alignShow, cropperShow, nullShow } = useObservable(() => merge$1(drawingManagerService.focus$.pipe(map(getPanelShowState)), ...transformer ? [transformer.clearControl$.pipe(filter((changeSelf) => changeSelf === true), map(() => getPanelShowState([]))), transformer.changeStart$.pipe(map((state) => getPanelShowState(getUpdateParams(state.objects, drawingManagerService))))] : []), getPanelShowState(drawings), false, [drawingManagerService, transformer]);
@@ -17,7 +17,7 @@ const locale = { "drawing-ui": {
17
17
  nameInput: "Nom de l'objet",
18
18
  description: "Description",
19
19
  descriptionPlaceholder: "Ajouter une description",
20
- details: "Details",
20
+ details: "Détails",
21
21
  locate: "Localiser",
22
22
  expand: "Développer",
23
23
  collapse: "Réduire",
@@ -88,22 +88,22 @@ const locale = { "drawing-ui": {
88
88
  null: "Нет выбранных объектов"
89
89
  },
90
90
  "image-text-wrap": {
91
- title: "Text Wrapping",
92
- wrappingStyle: "Wrapping Style",
93
- square: "Square",
94
- topAndBottom: "Top and Bottom",
95
- inline: "In line with text",
96
- behindText: "Behind text",
97
- inFrontText: "In front of text",
98
- wrapText: "Wrap text",
99
- bothSide: "Both sides",
100
- leftOnly: "Left only",
101
- rightOnly: "Right only",
102
- distanceFromText: "Distance from text",
103
- top: "Top(px)",
104
- left: "Left(px)",
105
- bottom: "Bottom(px)",
106
- right: "Right(px)"
91
+ title: "Обтекание текстом",
92
+ wrappingStyle: "Стиль обтекания",
93
+ square: "Вокруг рамки",
94
+ topAndBottom: "Сверху и снизу",
95
+ inline: "В тексте",
96
+ behindText: "За текстом",
97
+ inFrontText: "Перед текстом",
98
+ wrapText: "Обтекание",
99
+ bothSide: "С обеих сторон",
100
+ leftOnly: "Только слева",
101
+ rightOnly: "Только справа",
102
+ distanceFromText: "Расстояние от текста",
103
+ top: "Сверху (пкс)",
104
+ left: "Слева (пкс)",
105
+ bottom: "Снизу (пкс)",
106
+ right: "Справа (пкс)"
107
107
  },
108
108
  "image-popup": {
109
109
  replace: "Заменить",
@@ -88,22 +88,22 @@ const locale = { "drawing-ui": {
88
88
  null: "Không có đối tượng nào được chọn"
89
89
  },
90
90
  "image-text-wrap": {
91
- title: "Text Wrapping",
92
- wrappingStyle: "Wrapping Style",
93
- square: "Square",
94
- topAndBottom: "Top and Bottom",
95
- inline: "In line with text",
96
- behindText: "Behind text",
97
- inFrontText: "In front of text",
98
- wrapText: "Wrap text",
99
- bothSide: "Both sides",
100
- leftOnly: "Left only",
101
- rightOnly: "Right only",
102
- distanceFromText: "Distance from text",
103
- top: "Top(px)",
104
- left: "Left(px)",
105
- bottom: "Bottom(px)",
106
- right: "Right(px)"
91
+ title: "Bố cục văn bản",
92
+ wrappingStyle: "Kiểu bố cục",
93
+ square: "Vuông",
94
+ topAndBottom: "Trên dưới",
95
+ inline: "Cùng dòng với văn bản",
96
+ behindText: "Phía sau văn bản",
97
+ inFrontText: "Phía trước văn bản",
98
+ wrapText: "Bọc văn bản",
99
+ bothSide: "Cả hai bên",
100
+ leftOnly: "Chỉ bên trái",
101
+ rightOnly: "Chỉ bên phải",
102
+ distanceFromText: "Khoảng cách từ văn bản",
103
+ top: "Trên (px)",
104
+ left: "Trái (px)",
105
+ bottom: "Dưới (px)",
106
+ right: "Phải (px)"
107
107
  },
108
108
  "image-popup": {
109
109
  replace: "Thay thế",