@univerjs/ui 0.22.1 → 0.23.0-insiders.20260522-ee0b0a4

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
@@ -2319,6 +2319,7 @@ let MenuManagerService = class MenuManagerService extends _univerjs_core.Disposa
2319
2319
  key,
2320
2320
  order: value.order,
2321
2321
  title: value.title,
2322
+ contextual: value.contextual,
2322
2323
  quickLayout: value.quickLayout
2323
2324
  };
2324
2325
  if (value.menuItemFactory) {
@@ -2950,6 +2951,7 @@ function RectPopup(props) {
2950
2951
  window.removeEventListener("contextmenu", handleContextMenu);
2951
2952
  };
2952
2953
  }, [contextMenuFn]);
2954
+ const dir = (0, _wendellhu_redi_react_bindings.useObservable)((0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService).direction$);
2953
2955
  const ele = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [mask && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2954
2956
  "data-u-comp": "rect-popup-mask",
2955
2957
  className: "univer-fixed univer-inset-0 univer-z-[100]",
@@ -2958,6 +2960,7 @@ function RectPopup(props) {
2958
2960
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
2959
2961
  "data-u-comp": "rect-popup",
2960
2962
  ref: nodeRef,
2963
+ dir,
2961
2964
  className: (0, _univerjs_design.clsx)("univer-pointer-events-auto univer-fixed univer-left-[-9999px] univer-top-[-9999px] univer-z-[1020]", {
2962
2965
  "univer-hidden": hidden,
2963
2966
  "univer-animate-in univer-fade-in-70": !hidden
@@ -3078,11 +3081,29 @@ let DesktopRibbonService = class DesktopRibbonService extends _univerjs_core.Dis
3078
3081
  _defineProperty(this, "collapsedIds$", this._collapsedIds$.asObservable());
3079
3082
  _defineProperty(this, "_fakeToolbarVisible$", new rxjs.BehaviorSubject(false));
3080
3083
  _defineProperty(this, "fakeToolbarVisible$", this._fakeToolbarVisible$.asObservable());
3084
+ _defineProperty(this, "_visibleContextualTabs", /* @__PURE__ */ new Set());
3085
+ _defineProperty(this, "_contextualTabs", /* @__PURE__ */ new Set());
3086
+ _defineProperty(this, "_lastNonContextualActivatedTab", "ribbon.start");
3081
3087
  this._initRibbonSubscription();
3082
3088
  }
3083
3089
  setActivatedTab(tab) {
3090
+ if (!this._isContextualTab(tab)) this._lastNonContextualActivatedTab = tab;
3084
3091
  this._activatedTab$.next(tab);
3085
3092
  }
3093
+ showContextualTab(tab, options) {
3094
+ this._visibleContextualTabs.add(tab);
3095
+ this._updateRibbon();
3096
+ if (options === null || options === void 0 ? void 0 : options.activate) this.setActivatedTab(tab);
3097
+ }
3098
+ hideContextualTab(tab) {
3099
+ if (!this._visibleContextualTabs.delete(tab)) return;
3100
+ this._updateRibbon();
3101
+ }
3102
+ hideAllContextualTabs() {
3103
+ if (this._visibleContextualTabs.size === 0) return;
3104
+ this._visibleContextualTabs.clear();
3105
+ this._updateRibbon();
3106
+ }
3086
3107
  setCollapsedIds(ids) {
3087
3108
  this._collapsedIds$.next(ids);
3088
3109
  }
@@ -3095,7 +3116,7 @@ let DesktopRibbonService = class DesktopRibbonService extends _univerjs_core.Dis
3095
3116
  }));
3096
3117
  }
3097
3118
  _updateRibbon() {
3098
- const ribbon = this._menuManagerService.getMenuByPositionKey("ribbon");
3119
+ const ribbon = this._filterContextualTabs(this._menuManagerService.getMenuByPositionKey("ribbon"));
3099
3120
  const hiddenObservableMap = [];
3100
3121
  const hiddenKeyMap = [];
3101
3122
  for (const group of ribbon) if (group.children) {
@@ -3108,7 +3129,7 @@ let DesktopRibbonService = class DesktopRibbonService extends _univerjs_core.Dis
3108
3129
  }
3109
3130
  }
3110
3131
  if (hiddenObservableMap.length === 0) {
3111
- this._ribbon$.next(ribbon);
3132
+ this._setRibbon(ribbon);
3112
3133
  return;
3113
3134
  }
3114
3135
  (0, rxjs.combineLatest)(hiddenObservableMap).pipe((0, rxjs_operators.startWith)(new Array(hiddenObservableMap.length).fill(false))).subscribe((hiddenMap) => {
@@ -3151,9 +3172,29 @@ let DesktopRibbonService = class DesktopRibbonService extends _univerjs_core.Dis
3151
3172
  return (_item$children2 = item.children) === null || _item$children2 === void 0 ? void 0 : _item$children2.length;
3152
3173
  })) newRibbon.push(newGroup);
3153
3174
  }
3154
- this._ribbon$.next(newRibbon);
3175
+ this._setRibbon(newRibbon);
3155
3176
  }).unsubscribe();
3156
3177
  }
3178
+ _filterContextualTabs(ribbon) {
3179
+ this._contextualTabs.clear();
3180
+ ribbon.forEach((group) => {
3181
+ if (group.contextual) this._contextualTabs.add(group.key);
3182
+ });
3183
+ return ribbon.filter((group) => !group.contextual || this._visibleContextualTabs.has(group.key));
3184
+ }
3185
+ _setRibbon(ribbon) {
3186
+ const activatedTab = this._activatedTab$.getValue();
3187
+ const activeGroup = ribbon.find((group) => group.key === activatedTab);
3188
+ if (!activeGroup && this._contextualTabs.has(activatedTab)) {
3189
+ var _ref, _ribbon$find;
3190
+ const fallbackTab = (_ref = (_ribbon$find = ribbon.find((group) => group.key === this._lastNonContextualActivatedTab && !group.contextual)) !== null && _ribbon$find !== void 0 ? _ribbon$find : ribbon.find((group) => group.key === "ribbon.start")) !== null && _ref !== void 0 ? _ref : ribbon[0];
3191
+ if (fallbackTab) this._activatedTab$.next(fallbackTab.key);
3192
+ } else if (activeGroup && !activeGroup.contextual) this._lastNonContextualActivatedTab = activeGroup.key;
3193
+ this._ribbon$.next(ribbon);
3194
+ }
3195
+ _isContextualTab(tab) {
3196
+ return this._contextualTabs.has(tab) || this._ribbon$.getValue().some((group) => group.key === tab && group.contextual);
3197
+ }
3157
3198
  };
3158
3199
  DesktopRibbonService = __decorate([__decorateParam(0, IMenuManagerService), __decorateParam(1, _univerjs_core.IUniverInstanceService)], DesktopRibbonService);
3159
3200
 
@@ -3244,7 +3285,8 @@ function DefaultMenu({ ribbon, activatedTab, onSelectTab }) {
3244
3285
  overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3245
3286
  className: "univer-grid univer-gap-1 univer-px-2 univer-py-1",
3246
3287
  children: ribbon.map((group) => {
3247
- const Icon = iconMap[group.key];
3288
+ var _iconMap;
3289
+ const Icon = (_iconMap = iconMap[group.key]) !== null && _iconMap !== void 0 ? _iconMap : _univerjs_icons.MoreFunctionIcon;
3248
3290
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
3249
3291
  "data-u-comp": "ribbon-group-btn",
3250
3292
  className: "univer-box-border univer-flex univer-cursor-pointer univer-items-center univer-gap-2.5 univer-rounded-lg univer-px-2 univer-py-1.5 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",
@@ -3468,9 +3510,20 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
3468
3510
  const { dropdownVisible, setDropdownVisible } = (0, react.useContext)(TooltipWrapperContext);
3469
3511
  const menuManagerService = (0, _wendellhu_redi_react_bindings.useDependency)(IMenuManagerService);
3470
3512
  const [hiddenStates, setHiddenStates] = (0, react.useState)({});
3513
+ const [menuVersion, setMenuVersion] = (0, react.useState)(0);
3514
+ (0, react.useEffect)(() => {
3515
+ const subscription = menuManagerService.menuChanged$.subscribe(() => {
3516
+ setMenuVersion((version) => version + 1);
3517
+ });
3518
+ return () => subscription.unsubscribe();
3519
+ }, [menuManagerService]);
3471
3520
  const menuItems = (0, react.useMemo)(() => {
3472
3521
  return menuId ? menuManagerService.getMenuByPositionKey(menuId) : [];
3473
- }, [menuId]);
3522
+ }, [
3523
+ menuId,
3524
+ menuManagerService,
3525
+ menuVersion
3526
+ ]);
3474
3527
  const filteredMenuItems = (0, react.useMemo)(() => {
3475
3528
  return menuItems.filter((item) => {
3476
3529
  var _item$key;
@@ -4234,6 +4287,7 @@ function ContextMenuPanel(props) {
4234
4287
  onWheel: (event) => event.stopPropagation(),
4235
4288
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContextMenuMenu, {
4236
4289
  menuSchemas: menuItems,
4290
+ menuSessionVersion,
4237
4291
  submenuPortalContainer,
4238
4292
  onOptionSelect,
4239
4293
  maxMenuHeight
@@ -4241,7 +4295,7 @@ function ContextMenuPanel(props) {
4241
4295
  });
4242
4296
  }
4243
4297
  function ContextMenuMenu(props) {
4244
- const { menuSchemas, submenuPortalContainer, onOptionSelect, maxMenuHeight } = props;
4298
+ const { menuSchemas, menuSessionVersion, submenuPortalContainer, onOptionSelect, maxMenuHeight } = props;
4245
4299
  const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
4246
4300
  const hiddenGroupStates = useContextGroupHiddenStates$1(menuSchemas);
4247
4301
  const visibleSchemas = (0, react.useMemo)(() => {
@@ -4256,6 +4310,7 @@ function ContextMenuMenu(props) {
4256
4310
  if (menuSchema.item) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContextMenuMenuItem, {
4257
4311
  menuKey: menuSchema.key,
4258
4312
  menuItem: menuSchema.item,
4313
+ menuSessionVersion,
4259
4314
  submenuPortalContainer,
4260
4315
  onOptionSelect,
4261
4316
  maxMenuHeight
@@ -4279,6 +4334,7 @@ function ContextMenuMenu(props) {
4279
4334
  }), menuSchema.children.map((childSchema) => childSchema.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContextMenuMenuItem, {
4280
4335
  menuKey: childSchema.key,
4281
4336
  menuItem: childSchema.item,
4337
+ menuSessionVersion,
4282
4338
  submenuPortalContainer,
4283
4339
  onOptionSelect,
4284
4340
  maxMenuHeight
@@ -4287,7 +4343,8 @@ function ContextMenuMenu(props) {
4287
4343
  }) });
4288
4344
  }
4289
4345
  function ContextMenuMenuItem(props) {
4290
- const { menuKey, menuItem, submenuPortalContainer, onOptionSelect, maxMenuHeight } = props;
4346
+ const { menuKey, menuItem, menuSessionVersion, submenuPortalContainer, onOptionSelect, maxMenuHeight } = props;
4347
+ const direction = (0, _wendellhu_redi_react_bindings.useObservable)((0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService).direction$);
4291
4348
  const menuManagerService = (0, _wendellhu_redi_react_bindings.useDependency)(IMenuManagerService);
4292
4349
  const disabled = (0, _wendellhu_redi_react_bindings.useObservable)(menuItem.disabled$, false);
4293
4350
  const activated = (0, _wendellhu_redi_react_bindings.useObservable)(menuItem.activated$, false);
@@ -4320,7 +4377,8 @@ function ContextMenuMenuItem(props) {
4320
4377
  }, [
4321
4378
  menuItem.id,
4322
4379
  menuItem.type,
4323
- menuManagerService
4380
+ menuManagerService,
4381
+ menuSessionVersion
4324
4382
  ]);
4325
4383
  const hasSelectionSubmenu = selections.length > 0;
4326
4384
  const hasSubItemSubmenu = subMenuItems.length > 0;
@@ -4439,6 +4497,7 @@ function ContextMenuMenuItem(props) {
4439
4497
  children: [contentNode, hasSubmenu && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreIcon, { className: "univer-size-3.5 univer-text-gray-400 dark:!univer-text-gray-200" })]
4440
4498
  }), hasSubmenu && submenuVisible && (submenuPortalContainer ? (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4441
4499
  ref: submenuElementRef,
4500
+ dir: direction,
4442
4501
  ["data-u-context-menu-submenu"]: "true",
4443
4502
  className: "univer-z-[1080] univer-w-max univer-max-w-[calc(100vw-16px)]",
4444
4503
  style: {
@@ -4515,6 +4574,7 @@ function ContextMenuMenuItem(props) {
4515
4574
  })
4516
4575
  }), hasSubItemSubmenu && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContextMenuMenu, {
4517
4576
  menuSchemas: subMenuItems,
4577
+ menuSessionVersion,
4518
4578
  submenuPortalContainer,
4519
4579
  onOptionSelect: onSubmenuOptionSelect,
4520
4580
  maxMenuHeight
@@ -4704,54 +4764,6 @@ function DesktopContextMenu() {
4704
4764
  });
4705
4765
  }
4706
4766
 
4707
- //#endregion
4708
- //#region src/services/global-zone/global-zone.service.ts
4709
- const IGlobalZoneService = (0, _univerjs_core.createIdentifier)("univer.global-zone-service");
4710
-
4711
- //#endregion
4712
- //#region src/views/components/global-zone/GlobalZone.tsx
4713
- /**
4714
- * Copyright 2023-present DreamNum Co., Ltd.
4715
- *
4716
- * Licensed under the Apache License, Version 2.0 (the "License");
4717
- * you may not use this file except in compliance with the License.
4718
- * You may obtain a copy of the License at
4719
- *
4720
- * http://www.apache.org/licenses/LICENSE-2.0
4721
- *
4722
- * Unless required by applicable law or agreed to in writing, software
4723
- * distributed under the License is distributed on an "AS IS" BASIS,
4724
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4725
- * See the License for the specific language governing permissions and
4726
- * limitations under the License.
4727
- */
4728
- function GlobalZone() {
4729
- const globalZoneService = (0, _wendellhu_redi_react_bindings.useDependency)(IGlobalZoneService);
4730
- const [visible, setVisible] = (0, react.useState)(false);
4731
- const componentKey = (0, _wendellhu_redi_react_bindings.useObservable)(globalZoneService.componentKey$, globalZoneService.componentKey);
4732
- const componentManager = (0, _wendellhu_redi_react_bindings.useDependency)(ComponentManager);
4733
- const Component = (0, react.useMemo)(() => {
4734
- const Component = componentManager.get(componentKey !== null && componentKey !== void 0 ? componentKey : "");
4735
- if (Component) return Component;
4736
- }, [componentKey, componentManager]);
4737
- (0, react.useEffect)(() => {
4738
- const subscription = globalZoneService.visible$.subscribe((val) => {
4739
- setVisible(val);
4740
- });
4741
- return () => {
4742
- subscription.unsubscribe();
4743
- };
4744
- }, [globalZoneService.visible$]);
4745
- if (!visible) return null;
4746
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
4747
- className: (0, _univerjs_design.clsx)("univer-absolute univer-bg-gray-100", {
4748
- "univer-hidden": !visible,
4749
- "univer-inset-0 univer-z-[100] univer-block univer-size-full": visible
4750
- }),
4751
- children: Component && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {})
4752
- });
4753
- }
4754
-
4755
4767
  //#endregion
4756
4768
  //#region src/views/components/sidebar/Sidebar.tsx
4757
4769
  function Sidebar() {
@@ -4935,11 +4947,14 @@ function DesktopWorkbenchContent(props) {
4935
4947
  if (contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
4936
4948
  }, [onRendered]);
4937
4949
  const [locale, setLocale] = (0, react.useState)(localeService.getLocales());
4950
+ const [direction, setDirection] = (0, react.useState)(localeService.getDirection());
4938
4951
  const portalContainer = (0, react.useMemo)(() => document.createElement("div"), []);
4939
4952
  (0, react.useEffect)(() => {
4940
4953
  document.body.appendChild(portalContainer);
4941
4954
  const subscriptions = [localeService.localeChanged$.subscribe(() => {
4942
4955
  setLocale(localeService.getLocales());
4956
+ }), localeService.direction$.subscribe(() => {
4957
+ setDirection(localeService.getDirection());
4943
4958
  })];
4944
4959
  return () => {
4945
4960
  subscriptions.forEach((subscription) => subscription.unsubscribe());
@@ -4950,76 +4965,82 @@ function DesktopWorkbenchContent(props) {
4950
4965
  mountContainer,
4951
4966
  portalContainer
4952
4967
  ]);
4968
+ (0, react.useEffect)(() => {
4969
+ portalContainer.dir = direction;
4970
+ }, [direction, portalContainer]);
4953
4971
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_univerjs_design.ConfigProvider, {
4954
4972
  locale: locale === null || locale === void 0 ? void 0 : locale.design,
4973
+ direction,
4955
4974
  mountContainer: portalContainer,
4956
- children: [
4957
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4958
- "data-u-comp": "workbench-layout",
4959
- className: (0, _univerjs_design.clsx)("univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800", { "univer-dark": darkMode }),
4960
- tabIndex: -1,
4961
- onBlur: (e) => e.stopPropagation(),
4962
- onContextMenu: (e) => e.preventDefault(),
4963
- children: [
4964
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4965
- className: "univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",
4966
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: customHeaderComponents }, "custom-header")
4967
- }),
4968
- header && toolbar && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
4969
- "data-u-comp": "headerbar",
4970
- className: "univer-relative univer-z-10 univer-w-full univer-overflow-hidden",
4971
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, {
4972
- components: toolbarComponents,
4973
- sharedProps: {
4974
- ribbonType,
4975
- headerMenuComponents,
4976
- headerMenu
4977
- }
4978
- }, "toolbar")
4979
- }),
4980
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
4981
- className: "univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",
4982
- children: [
4983
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4984
- className: "univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",
4985
- children: [
4986
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
4987
- "data-u-comp": "left-sidebar",
4988
- className: "univer-h-full",
4989
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: leftSidebarComponents }, "left-sidebar")
4990
- }),
4991
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
4992
- className: (0, _univerjs_design.clsx)("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800", _univerjs_design.borderBottomClassName),
4993
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", { children: header && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: headerComponents }, "header") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
4994
- className: "univer-relative univer-overflow-hidden dark:!univer-bg-gray-900",
4995
- ref: contentRef,
4996
- "data-range-selector": true,
4997
- onContextMenu: (e) => e.preventDefault(),
4998
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: contentComponents }, "content")
4999
- })]
5000
- }),
5001
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
5002
- "data-u-comp": "right-sidebar",
5003
- className: "univer-z-[100] univer-h-full",
5004
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sidebar, {})
5005
- })
5006
- ]
5007
- }),
5008
- footer && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("footer", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, {
5009
- components: footerComponents,
5010
- sharedProps: { contextMenu }
5011
- }, "footer") }),
5012
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ZenZone, {})
5013
- ]
5014
- })
5015
- ]
5016
- }),
5017
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: globalComponents }, "global"),
5018
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GlobalZone, {}),
5019
- contextMenu && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DesktopContextMenu, {}),
5020
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FloatingContainer, {}),
5021
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { id: popupRootId })
5022
- ]
4975
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4976
+ "data-u-comp": "workbench-layout",
4977
+ className: (0, _univerjs_design.clsx)("univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800", { "univer-dark": darkMode }),
4978
+ tabIndex: -1,
4979
+ onBlur: (e) => e.stopPropagation(),
4980
+ onContextMenu: (e) => e.preventDefault(),
4981
+ dir: direction,
4982
+ children: [
4983
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4984
+ className: "univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",
4985
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: customHeaderComponents }, "custom-header")
4986
+ }),
4987
+ header && toolbar && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
4988
+ "data-u-comp": "headerbar",
4989
+ className: "univer-relative univer-z-10 univer-w-full univer-overflow-hidden",
4990
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, {
4991
+ components: toolbarComponents,
4992
+ sharedProps: {
4993
+ ribbonType,
4994
+ headerMenuComponents,
4995
+ headerMenu
4996
+ }
4997
+ }, "toolbar")
4998
+ }),
4999
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
5000
+ className: "univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",
5001
+ children: [
5002
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5003
+ className: "univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",
5004
+ children: [
5005
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
5006
+ "data-u-comp": "left-sidebar",
5007
+ className: "univer-h-full",
5008
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: leftSidebarComponents }, "left-sidebar")
5009
+ }),
5010
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
5011
+ className: (0, _univerjs_design.clsx)("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800", _univerjs_design.borderBottomClassName),
5012
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", { children: header && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: headerComponents }, "header") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
5013
+ className: "univer-relative univer-overflow-hidden dark:!univer-bg-gray-900",
5014
+ ref: contentRef,
5015
+ "data-range-selector": true,
5016
+ onContextMenu: (e) => e.preventDefault(),
5017
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: contentComponents }, "content")
5018
+ })]
5019
+ }),
5020
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
5021
+ "data-u-comp": "right-sidebar",
5022
+ className: "univer-z-[100] univer-h-full",
5023
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sidebar, {})
5024
+ })
5025
+ ]
5026
+ }),
5027
+ footer && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("footer", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, {
5028
+ components: footerComponents,
5029
+ sharedProps: { contextMenu }
5030
+ }, "footer") }),
5031
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ZenZone, {})
5032
+ ]
5033
+ })
5034
+ ]
5035
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5036
+ dir: direction,
5037
+ children: [
5038
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: globalComponents }, "global"),
5039
+ contextMenu && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DesktopContextMenu, {}),
5040
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FloatingContainer, {}),
5041
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { id: popupRootId })
5042
+ ]
5043
+ })]
5023
5044
  });
5024
5045
  }
5025
5046
  function FloatingContainer() {
@@ -5185,7 +5206,7 @@ const IUIController = (0, _univerjs_core.createIdentifier)("univer.ui.ui-control
5185
5206
  //#endregion
5186
5207
  //#region package.json
5187
5208
  var name = "@univerjs/ui";
5188
- var version = "0.22.1";
5209
+ var version = "0.23.0-insiders.20260522-ee0b0a4";
5189
5210
 
5190
5211
  //#endregion
5191
5212
  //#region src/views/components/ribbon/MobileRibbon.tsx
@@ -5682,6 +5703,7 @@ function MobileContextMenu() {
5682
5703
  const commandService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ICommandService);
5683
5704
  const layoutService = (0, _wendellhu_redi_react_bindings.useDependency)(ILayoutService);
5684
5705
  const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
5706
+ const direction = (0, _wendellhu_redi_react_bindings.useObservable)(localeService.direction$);
5685
5707
  const { mountContainer } = (0, react.useContext)(_univerjs_design.ConfigContext);
5686
5708
  visibleRef.current = visible;
5687
5709
  (0, react.useEffect)(() => {
@@ -5721,6 +5743,7 @@ function MobileContextMenu() {
5721
5743
  }, [localeService, menuType]);
5722
5744
  if (!mountContainer || !visible) return null;
5723
5745
  return (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5746
+ dir: direction,
5724
5747
  className: "univer-fixed univer-inset-0 univer-z-[1080] univer-flex univer-items-end",
5725
5748
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5726
5749
  type: "button",
@@ -5797,6 +5820,7 @@ function MobileWorkbench(props) {
5797
5820
  if (contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
5798
5821
  }, [onRendered]);
5799
5822
  const [locale, setLocale] = (0, react.useState)(localeService.getLocales());
5823
+ const [direction, setDirection] = (0, react.useState)(localeService.getDirection());
5800
5824
  const portalContainer = (0, react.useMemo)(() => document.createElement("div"), []);
5801
5825
  (0, react.useLayoutEffect)(() => {
5802
5826
  const sub = themeService.currentTheme$.subscribe((theme) => {
@@ -5810,6 +5834,8 @@ function MobileWorkbench(props) {
5810
5834
  document.body.appendChild(portalContainer);
5811
5835
  const subscriptions = [localeService.localeChanged$.subscribe(() => {
5812
5836
  setLocale(localeService.getLocales());
5837
+ }), localeService.direction$.subscribe(() => {
5838
+ setDirection(localeService.getDirection());
5813
5839
  })];
5814
5840
  return () => {
5815
5841
  subscriptions.forEach((subscription) => subscription.unsubscribe());
@@ -5820,65 +5846,68 @@ function MobileWorkbench(props) {
5820
5846
  mountContainer,
5821
5847
  portalContainer
5822
5848
  ]);
5849
+ (0, react.useEffect)(() => {
5850
+ portalContainer.dir = direction;
5851
+ }, [direction, portalContainer]);
5823
5852
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_univerjs_design.ConfigProvider, {
5824
5853
  locale: locale === null || locale === void 0 ? void 0 : locale.design,
5854
+ direction,
5825
5855
  mountContainer: portalContainer,
5826
- children: [
5827
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5828
- "data-u-comp": "app-layout",
5829
- className: (0, _univerjs_design.clsx)("univer-relative univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800", { "univer-dark": darkMode }),
5830
- tabIndex: -1,
5831
- onBlur: (e) => e.stopPropagation(),
5832
- onContextMenu: (e) => e.preventDefault(),
5833
- children: [header && toolbar && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
5834
- "data-u-comp": "headerbar",
5835
- className: "univer-relative univer-z-10 univer-w-full univer-overflow-hidden",
5836
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, {
5837
- components: toolbarComponents,
5838
- sharedProps: {
5839
- ribbonType,
5840
- headerMenuComponents,
5841
- headerMenu
5842
- }
5843
- }, "toolbar")
5844
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
5845
- className: "univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",
5846
- children: [
5847
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5848
- className: "univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",
5849
- children: [
5850
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
5851
- className: "univer-h-full",
5852
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: leftSidebarComponents }, "left-sidebar")
5853
- }),
5854
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
5855
- className: (0, _univerjs_design.clsx)("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800", _univerjs_design.borderBottomClassName),
5856
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
5857
- className: "univer-w-screen",
5858
- children: header && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: headerComponents }, "header")
5859
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
5860
- ref: contentRef,
5861
- className: "univer-relative univer-overflow-hidden",
5862
- "data-range-selector": true,
5863
- onContextMenu: (e) => e.preventDefault(),
5864
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: contentComponents }, "content")
5865
- })]
5866
- }),
5867
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
5868
- className: "univer-h-full",
5869
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sidebar, {})
5870
- })
5871
- ]
5872
- }),
5873
- footer && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("footer", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: footerComponents }, "footer") }),
5874
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GlobalZone, {}),
5875
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ZenZone, {})
5876
- ]
5877
- })]
5878
- }),
5879
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: globalComponents }, "global"),
5880
- contextMenu && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileContextMenu, {})
5881
- ]
5856
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5857
+ "data-u-comp": "app-layout",
5858
+ className: (0, _univerjs_design.clsx)("univer-relative univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800", { "univer-dark": darkMode }),
5859
+ tabIndex: -1,
5860
+ onBlur: (e) => e.stopPropagation(),
5861
+ onContextMenu: (e) => e.preventDefault(),
5862
+ dir: direction,
5863
+ children: [header && toolbar && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
5864
+ "data-u-comp": "headerbar",
5865
+ className: "univer-relative univer-z-10 univer-w-full univer-overflow-hidden",
5866
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, {
5867
+ components: toolbarComponents,
5868
+ sharedProps: {
5869
+ ribbonType,
5870
+ headerMenuComponents,
5871
+ headerMenu
5872
+ }
5873
+ }, "toolbar")
5874
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
5875
+ className: "univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",
5876
+ children: [
5877
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5878
+ className: "univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",
5879
+ children: [
5880
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
5881
+ className: "univer-h-full",
5882
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: leftSidebarComponents }, "left-sidebar")
5883
+ }),
5884
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
5885
+ className: (0, _univerjs_design.clsx)("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800", _univerjs_design.borderBottomClassName),
5886
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
5887
+ className: "univer-w-screen",
5888
+ children: header && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: headerComponents }, "header")
5889
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
5890
+ ref: contentRef,
5891
+ className: "univer-relative univer-overflow-hidden",
5892
+ "data-range-selector": true,
5893
+ onContextMenu: (e) => e.preventDefault(),
5894
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: contentComponents }, "content")
5895
+ })]
5896
+ }),
5897
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
5898
+ className: "univer-h-full",
5899
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sidebar, {})
5900
+ })
5901
+ ]
5902
+ }),
5903
+ footer && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("footer", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: footerComponents }, "footer") }),
5904
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ZenZone, {})
5905
+ ]
5906
+ })]
5907
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5908
+ dir: direction,
5909
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: globalComponents }, "global"), contextMenu && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileContextMenu, {})]
5910
+ })]
5882
5911
  });
5883
5912
  }
5884
5913
 
@@ -6647,37 +6676,6 @@ let DesktopGalleryService = class DesktopGalleryService extends _univerjs_core.D
6647
6676
  };
6648
6677
  DesktopGalleryService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), __decorateParam(1, IUIPartsService)], DesktopGalleryService);
6649
6678
 
6650
- //#endregion
6651
- //#region src/services/global-zone/desktop-global-zone.service.ts
6652
- let DesktopGlobalZoneService = class DesktopGlobalZoneService {
6653
- constructor(_componentManager) {
6654
- this._componentManager = _componentManager;
6655
- _defineProperty(this, "visible$", new rxjs.Subject());
6656
- _defineProperty(this, "componentKey$", new rxjs.Subject());
6657
- _defineProperty(this, "_componentKey", "");
6658
- }
6659
- get componentKey() {
6660
- return this._componentKey;
6661
- }
6662
- set(key, component) {
6663
- this._componentManager.register(key, component);
6664
- this.componentKey$.next(key);
6665
- this._componentKey = key;
6666
- return (0, _univerjs_core.toDisposable)(() => {
6667
- this._componentManager.delete(key);
6668
- this.visible$.complete();
6669
- this.componentKey$.complete();
6670
- });
6671
- }
6672
- open() {
6673
- this.visible$.next(true);
6674
- }
6675
- close() {
6676
- this.visible$.next(false);
6677
- }
6678
- };
6679
- DesktopGlobalZoneService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(ComponentManager))], DesktopGlobalZoneService);
6680
-
6681
6679
  //#endregion
6682
6680
  //#region src/services/local-file/desktop-local-file.service.ts
6683
6681
  var DesktopLocalFileService = class extends _univerjs_core.Disposable {
@@ -6769,7 +6767,13 @@ var DesktopLocalStorageService = class {
6769
6767
  * limitations under the License.
6770
6768
  */
6771
6769
  function MessageContainer() {
6772
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Messager, { theme: (0, _wendellhu_redi_react_bindings.useObservable)((0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ThemeService).darkMode$) ? "dark" : "light" });
6770
+ const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
6771
+ const darkMode = (0, _wendellhu_redi_react_bindings.useObservable)((0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ThemeService).darkMode$);
6772
+ const direction = (0, _wendellhu_redi_react_bindings.useObservable)(localeService.direction$);
6773
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Messager, {
6774
+ theme: darkMode ? "dark" : "light",
6775
+ dir: direction
6776
+ });
6773
6777
  }
6774
6778
 
6775
6779
  //#endregion
@@ -6808,7 +6812,13 @@ DesktopMessageService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject
6808
6812
  //#endregion
6809
6813
  //#region src/components/notification/Notification.tsx
6810
6814
  function Notification() {
6811
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Toaster, { theme: (0, _wendellhu_redi_react_bindings.useObservable)((0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ThemeService).darkMode$) ? "dark" : "light" });
6815
+ const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
6816
+ const darkMode = (0, _wendellhu_redi_react_bindings.useObservable)((0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ThemeService).darkMode$);
6817
+ const direction = (0, _wendellhu_redi_react_bindings.useObservable)(localeService.direction$);
6818
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Toaster, {
6819
+ theme: darkMode ? "dark" : "light",
6820
+ dir: direction
6821
+ });
6812
6822
  }
6813
6823
  const notification = { show: (options) => {
6814
6824
  const { type = "message", title, content, duration, closable = true, position = "top-right" } = options;
@@ -7008,10 +7018,6 @@ let UniverMobileUIPlugin = class UniverMobileUIPlugin extends _univerjs_core.Plu
7008
7018
  useClass: DesktopZenZoneService,
7009
7019
  lazy: true
7010
7020
  }],
7011
- [IGlobalZoneService, {
7012
- useClass: DesktopGlobalZoneService,
7013
- lazy: true
7014
- }],
7015
7021
  [IMessageService, {
7016
7022
  useClass: DesktopMessageService,
7017
7023
  lazy: true
@@ -7109,10 +7115,6 @@ let UniverUIPlugin = class UniverUIPlugin extends _univerjs_core.Plugin {
7109
7115
  useClass: DesktopZenZoneService,
7110
7116
  lazy: true
7111
7117
  }],
7112
- [IGlobalZoneService, {
7113
- useClass: DesktopGlobalZoneService,
7114
- lazy: true
7115
- }],
7116
7118
  [IMessageService, {
7117
7119
  useClass: DesktopMessageService,
7118
7120
  lazy: true
@@ -7789,7 +7791,7 @@ function extractFontFamily(styleStr) {
7789
7791
  }
7790
7792
 
7791
7793
  //#endregion
7792
- //#region src/views/components/dom/print.tsx
7794
+ //#region src/views/components/dom/Print.tsx
7793
7795
  const PrintFloatDomSingle = (0, react.memo)((props) => {
7794
7796
  var _position$startY, _position$startX;
7795
7797
  const { layer, id, position } = props;
@@ -7909,12 +7911,6 @@ Object.defineProperty(exports, 'DesktopGalleryService', {
7909
7911
  return DesktopGalleryService;
7910
7912
  }
7911
7913
  });
7912
- Object.defineProperty(exports, 'DesktopGlobalZoneService', {
7913
- enumerable: true,
7914
- get: function () {
7915
- return DesktopGlobalZoneService;
7916
- }
7917
- });
7918
7914
  Object.defineProperty(exports, 'DesktopLayoutService', {
7919
7915
  enumerable: true,
7920
7916
  get: function () {
@@ -7974,7 +7970,6 @@ exports.FloatDomSingle = FloatDomSingle;
7974
7970
  exports.FontFamily = FontFamily;
7975
7971
  exports.FontFamilyItem = FontFamilyItem;
7976
7972
  exports.FontSize = FontSize;
7977
- exports.GlobalZone = GlobalZone;
7978
7973
  exports.HEADING_ITEM_COMPONENT = HEADING_ITEM_COMPONENT;
7979
7974
  exports.HEADING_LIST = HEADING_LIST;
7980
7975
  exports.HTML_CLIPBOARD_MIME_TYPE = HTML_CLIPBOARD_MIME_TYPE;
@@ -7987,7 +7982,6 @@ exports.IContextMenuService = IContextMenuService;
7987
7982
  exports.IDialogService = IDialogService;
7988
7983
  exports.IFontService = IFontService;
7989
7984
  exports.IGalleryService = IGalleryService;
7990
- exports.IGlobalZoneService = IGlobalZoneService;
7991
7985
  exports.ILayoutService = ILayoutService;
7992
7986
  exports.ILeftSidebarService = ILeftSidebarService;
7993
7987
  exports.ILocalFileService = ILocalFileService;