@univerjs/ui 0.22.1 → 0.23.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 +206 -132
- package/lib/es/index.js +206 -132
- package/lib/index.js +206 -132
- package/lib/types/index.d.ts +1 -1
- package/lib/types/services/menu/menu-manager.service.d.ts +2 -0
- package/lib/types/services/ribbon/ribbon.service.d.ts +16 -0
- package/lib/umd/index.js +11 -11
- package/package.json +7 -7
- /package/lib/types/views/components/dom/{print.d.ts → Print.d.ts} +0 -0
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 { direction: dir } = (0, react.useContext)(_univerjs_design.ConfigContext);
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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",
|
|
@@ -4288,6 +4330,7 @@ function ContextMenuMenu(props) {
|
|
|
4288
4330
|
}
|
|
4289
4331
|
function ContextMenuMenuItem(props) {
|
|
4290
4332
|
const { menuKey, menuItem, submenuPortalContainer, onOptionSelect, maxMenuHeight } = props;
|
|
4333
|
+
const { direction } = (0, react.useContext)(_univerjs_design.ConfigContext);
|
|
4291
4334
|
const menuManagerService = (0, _wendellhu_redi_react_bindings.useDependency)(IMenuManagerService);
|
|
4292
4335
|
const disabled = (0, _wendellhu_redi_react_bindings.useObservable)(menuItem.disabled$, false);
|
|
4293
4336
|
const activated = (0, _wendellhu_redi_react_bindings.useObservable)(menuItem.activated$, false);
|
|
@@ -4439,6 +4482,7 @@ function ContextMenuMenuItem(props) {
|
|
|
4439
4482
|
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
4483
|
}), hasSubmenu && submenuVisible && (submenuPortalContainer ? (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4441
4484
|
ref: submenuElementRef,
|
|
4485
|
+
dir: direction,
|
|
4442
4486
|
["data-u-context-menu-submenu"]: "true",
|
|
4443
4487
|
className: "univer-z-[1080] univer-w-max univer-max-w-[calc(100vw-16px)]",
|
|
4444
4488
|
style: {
|
|
@@ -4730,6 +4774,7 @@ function GlobalZone() {
|
|
|
4730
4774
|
const [visible, setVisible] = (0, react.useState)(false);
|
|
4731
4775
|
const componentKey = (0, _wendellhu_redi_react_bindings.useObservable)(globalZoneService.componentKey$, globalZoneService.componentKey);
|
|
4732
4776
|
const componentManager = (0, _wendellhu_redi_react_bindings.useDependency)(ComponentManager);
|
|
4777
|
+
const { direction } = (0, react.useContext)(_univerjs_design.ConfigContext);
|
|
4733
4778
|
const Component = (0, react.useMemo)(() => {
|
|
4734
4779
|
const Component = componentManager.get(componentKey !== null && componentKey !== void 0 ? componentKey : "");
|
|
4735
4780
|
if (Component) return Component;
|
|
@@ -4744,6 +4789,7 @@ function GlobalZone() {
|
|
|
4744
4789
|
}, [globalZoneService.visible$]);
|
|
4745
4790
|
if (!visible) return null;
|
|
4746
4791
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
4792
|
+
dir: direction,
|
|
4747
4793
|
className: (0, _univerjs_design.clsx)("univer-absolute univer-bg-gray-100", {
|
|
4748
4794
|
"univer-hidden": !visible,
|
|
4749
4795
|
"univer-inset-0 univer-z-[100] univer-block univer-size-full": visible
|
|
@@ -4935,11 +4981,14 @@ function DesktopWorkbenchContent(props) {
|
|
|
4935
4981
|
if (contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
|
|
4936
4982
|
}, [onRendered]);
|
|
4937
4983
|
const [locale, setLocale] = (0, react.useState)(localeService.getLocales());
|
|
4984
|
+
const [direction, setDirection] = (0, react.useState)(localeService.getDirection());
|
|
4938
4985
|
const portalContainer = (0, react.useMemo)(() => document.createElement("div"), []);
|
|
4939
4986
|
(0, react.useEffect)(() => {
|
|
4940
4987
|
document.body.appendChild(portalContainer);
|
|
4941
4988
|
const subscriptions = [localeService.localeChanged$.subscribe(() => {
|
|
4942
4989
|
setLocale(localeService.getLocales());
|
|
4990
|
+
}), localeService.direction$.subscribe(() => {
|
|
4991
|
+
setDirection(localeService.getDirection());
|
|
4943
4992
|
})];
|
|
4944
4993
|
return () => {
|
|
4945
4994
|
subscriptions.forEach((subscription) => subscription.unsubscribe());
|
|
@@ -4950,76 +4999,83 @@ function DesktopWorkbenchContent(props) {
|
|
|
4950
4999
|
mountContainer,
|
|
4951
5000
|
portalContainer
|
|
4952
5001
|
]);
|
|
5002
|
+
(0, react.useEffect)(() => {
|
|
5003
|
+
portalContainer.dir = direction;
|
|
5004
|
+
}, [direction, portalContainer]);
|
|
4953
5005
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_univerjs_design.ConfigProvider, {
|
|
4954
5006
|
locale: locale === null || locale === void 0 ? void 0 : locale.design,
|
|
5007
|
+
direction,
|
|
4955
5008
|
mountContainer: portalContainer,
|
|
4956
|
-
children: [
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5009
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5010
|
+
"data-u-comp": "workbench-layout",
|
|
5011
|
+
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 }),
|
|
5012
|
+
tabIndex: -1,
|
|
5013
|
+
onBlur: (e) => e.stopPropagation(),
|
|
5014
|
+
onContextMenu: (e) => e.preventDefault(),
|
|
5015
|
+
dir: direction,
|
|
5016
|
+
children: [
|
|
5017
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5018
|
+
className: "univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",
|
|
5019
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: customHeaderComponents }, "custom-header")
|
|
5020
|
+
}),
|
|
5021
|
+
header && toolbar && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
|
|
5022
|
+
"data-u-comp": "headerbar",
|
|
5023
|
+
className: "univer-relative univer-z-10 univer-w-full univer-overflow-hidden",
|
|
5024
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, {
|
|
5025
|
+
components: toolbarComponents,
|
|
5026
|
+
sharedProps: {
|
|
5027
|
+
ribbonType,
|
|
5028
|
+
headerMenuComponents,
|
|
5029
|
+
headerMenu
|
|
5030
|
+
}
|
|
5031
|
+
}, "toolbar")
|
|
5032
|
+
}),
|
|
5033
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
5034
|
+
className: "univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",
|
|
5035
|
+
children: [
|
|
5036
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5037
|
+
className: "univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",
|
|
5038
|
+
children: [
|
|
5039
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
|
|
5040
|
+
"data-u-comp": "left-sidebar",
|
|
5041
|
+
className: "univer-h-full",
|
|
5042
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: leftSidebarComponents }, "left-sidebar")
|
|
5043
|
+
}),
|
|
5044
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
5045
|
+
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),
|
|
5046
|
+
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", {
|
|
5047
|
+
className: "univer-relative univer-overflow-hidden dark:!univer-bg-gray-900",
|
|
5048
|
+
ref: contentRef,
|
|
5049
|
+
"data-range-selector": true,
|
|
5050
|
+
onContextMenu: (e) => e.preventDefault(),
|
|
5051
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: contentComponents }, "content")
|
|
5052
|
+
})]
|
|
5053
|
+
}),
|
|
5054
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
|
|
5055
|
+
"data-u-comp": "right-sidebar",
|
|
5056
|
+
className: "univer-z-[100] univer-h-full",
|
|
5057
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sidebar, {})
|
|
5058
|
+
})
|
|
5059
|
+
]
|
|
5060
|
+
}),
|
|
5061
|
+
footer && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("footer", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, {
|
|
5062
|
+
components: footerComponents,
|
|
5063
|
+
sharedProps: { contextMenu }
|
|
5064
|
+
}, "footer") }),
|
|
5065
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ZenZone, {})
|
|
5066
|
+
]
|
|
5067
|
+
})
|
|
5068
|
+
]
|
|
5069
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5070
|
+
dir: direction,
|
|
5071
|
+
children: [
|
|
5072
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: globalComponents }, "global"),
|
|
5073
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(GlobalZone, {}),
|
|
5074
|
+
contextMenu && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DesktopContextMenu, {}),
|
|
5075
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FloatingContainer, {}),
|
|
5076
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { id: popupRootId })
|
|
5077
|
+
]
|
|
5078
|
+
})]
|
|
5023
5079
|
});
|
|
5024
5080
|
}
|
|
5025
5081
|
function FloatingContainer() {
|
|
@@ -5185,7 +5241,7 @@ const IUIController = (0, _univerjs_core.createIdentifier)("univer.ui.ui-control
|
|
|
5185
5241
|
//#endregion
|
|
5186
5242
|
//#region package.json
|
|
5187
5243
|
var name = "@univerjs/ui";
|
|
5188
|
-
var version = "0.
|
|
5244
|
+
var version = "0.23.0";
|
|
5189
5245
|
|
|
5190
5246
|
//#endregion
|
|
5191
5247
|
//#region src/views/components/ribbon/MobileRibbon.tsx
|
|
@@ -5682,7 +5738,7 @@ function MobileContextMenu() {
|
|
|
5682
5738
|
const commandService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ICommandService);
|
|
5683
5739
|
const layoutService = (0, _wendellhu_redi_react_bindings.useDependency)(ILayoutService);
|
|
5684
5740
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
5685
|
-
const { mountContainer } = (0, react.useContext)(_univerjs_design.ConfigContext);
|
|
5741
|
+
const { mountContainer, direction } = (0, react.useContext)(_univerjs_design.ConfigContext);
|
|
5686
5742
|
visibleRef.current = visible;
|
|
5687
5743
|
(0, react.useEffect)(() => {
|
|
5688
5744
|
const hostDisposable = contextMenuHostService.registerMenu(MOBILE_CONTEXT_MENU_HOST_ID, () => {
|
|
@@ -5721,6 +5777,7 @@ function MobileContextMenu() {
|
|
|
5721
5777
|
}, [localeService, menuType]);
|
|
5722
5778
|
if (!mountContainer || !visible) return null;
|
|
5723
5779
|
return (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5780
|
+
dir: direction,
|
|
5724
5781
|
className: "univer-fixed univer-inset-0 univer-z-[1080] univer-flex univer-items-end",
|
|
5725
5782
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
5726
5783
|
type: "button",
|
|
@@ -5797,6 +5854,7 @@ function MobileWorkbench(props) {
|
|
|
5797
5854
|
if (contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
|
|
5798
5855
|
}, [onRendered]);
|
|
5799
5856
|
const [locale, setLocale] = (0, react.useState)(localeService.getLocales());
|
|
5857
|
+
const [direction, setDirection] = (0, react.useState)(localeService.getDirection());
|
|
5800
5858
|
const portalContainer = (0, react.useMemo)(() => document.createElement("div"), []);
|
|
5801
5859
|
(0, react.useLayoutEffect)(() => {
|
|
5802
5860
|
const sub = themeService.currentTheme$.subscribe((theme) => {
|
|
@@ -5810,6 +5868,8 @@ function MobileWorkbench(props) {
|
|
|
5810
5868
|
document.body.appendChild(portalContainer);
|
|
5811
5869
|
const subscriptions = [localeService.localeChanged$.subscribe(() => {
|
|
5812
5870
|
setLocale(localeService.getLocales());
|
|
5871
|
+
}), localeService.direction$.subscribe(() => {
|
|
5872
|
+
setDirection(localeService.getDirection());
|
|
5813
5873
|
})];
|
|
5814
5874
|
return () => {
|
|
5815
5875
|
subscriptions.forEach((subscription) => subscription.unsubscribe());
|
|
@@ -5820,65 +5880,69 @@ function MobileWorkbench(props) {
|
|
|
5820
5880
|
mountContainer,
|
|
5821
5881
|
portalContainer
|
|
5822
5882
|
]);
|
|
5883
|
+
(0, react.useEffect)(() => {
|
|
5884
|
+
portalContainer.dir = direction;
|
|
5885
|
+
}, [direction, portalContainer]);
|
|
5823
5886
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_univerjs_design.ConfigProvider, {
|
|
5824
5887
|
locale: locale === null || locale === void 0 ? void 0 : locale.design,
|
|
5888
|
+
direction,
|
|
5825
5889
|
mountContainer: portalContainer,
|
|
5826
|
-
children: [
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
contextMenu && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileContextMenu, {})
|
|
5881
|
-
]
|
|
5890
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5891
|
+
"data-u-comp": "app-layout",
|
|
5892
|
+
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 }),
|
|
5893
|
+
tabIndex: -1,
|
|
5894
|
+
onBlur: (e) => e.stopPropagation(),
|
|
5895
|
+
onContextMenu: (e) => e.preventDefault(),
|
|
5896
|
+
dir: direction,
|
|
5897
|
+
children: [header && toolbar && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
|
|
5898
|
+
"data-u-comp": "headerbar",
|
|
5899
|
+
className: "univer-relative univer-z-10 univer-w-full univer-overflow-hidden",
|
|
5900
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, {
|
|
5901
|
+
components: toolbarComponents,
|
|
5902
|
+
sharedProps: {
|
|
5903
|
+
ribbonType,
|
|
5904
|
+
headerMenuComponents,
|
|
5905
|
+
headerMenu
|
|
5906
|
+
}
|
|
5907
|
+
}, "toolbar")
|
|
5908
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
5909
|
+
className: "univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",
|
|
5910
|
+
children: [
|
|
5911
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5912
|
+
className: "univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",
|
|
5913
|
+
children: [
|
|
5914
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
|
|
5915
|
+
className: "univer-h-full",
|
|
5916
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: leftSidebarComponents }, "left-sidebar")
|
|
5917
|
+
}),
|
|
5918
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
5919
|
+
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),
|
|
5920
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
|
|
5921
|
+
className: "univer-w-screen",
|
|
5922
|
+
children: header && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: headerComponents }, "header")
|
|
5923
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
5924
|
+
ref: contentRef,
|
|
5925
|
+
className: "univer-relative univer-overflow-hidden",
|
|
5926
|
+
"data-range-selector": true,
|
|
5927
|
+
onContextMenu: (e) => e.preventDefault(),
|
|
5928
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: contentComponents }, "content")
|
|
5929
|
+
})]
|
|
5930
|
+
}),
|
|
5931
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
|
|
5932
|
+
className: "univer-h-full",
|
|
5933
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sidebar, {})
|
|
5934
|
+
})
|
|
5935
|
+
]
|
|
5936
|
+
}),
|
|
5937
|
+
footer && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("footer", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: footerComponents }, "footer") }),
|
|
5938
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(GlobalZone, {}),
|
|
5939
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ZenZone, {})
|
|
5940
|
+
]
|
|
5941
|
+
})]
|
|
5942
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5943
|
+
dir: direction,
|
|
5944
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: globalComponents }, "global"), contextMenu && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileContextMenu, {})]
|
|
5945
|
+
})]
|
|
5882
5946
|
});
|
|
5883
5947
|
}
|
|
5884
5948
|
|
|
@@ -6769,7 +6833,12 @@ var DesktopLocalStorageService = class {
|
|
|
6769
6833
|
* limitations under the License.
|
|
6770
6834
|
*/
|
|
6771
6835
|
function MessageContainer() {
|
|
6772
|
-
|
|
6836
|
+
const darkMode = (0, _wendellhu_redi_react_bindings.useObservable)((0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ThemeService).darkMode$);
|
|
6837
|
+
const { direction } = (0, react.useContext)(_univerjs_design.ConfigContext);
|
|
6838
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Messager, {
|
|
6839
|
+
theme: darkMode ? "dark" : "light",
|
|
6840
|
+
dir: direction
|
|
6841
|
+
});
|
|
6773
6842
|
}
|
|
6774
6843
|
|
|
6775
6844
|
//#endregion
|
|
@@ -6808,7 +6877,12 @@ DesktopMessageService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject
|
|
|
6808
6877
|
//#endregion
|
|
6809
6878
|
//#region src/components/notification/Notification.tsx
|
|
6810
6879
|
function Notification() {
|
|
6811
|
-
|
|
6880
|
+
const darkMode = (0, _wendellhu_redi_react_bindings.useObservable)((0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ThemeService).darkMode$);
|
|
6881
|
+
const { direction } = (0, react.useContext)(_univerjs_design.ConfigContext);
|
|
6882
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Toaster, {
|
|
6883
|
+
theme: darkMode ? "dark" : "light",
|
|
6884
|
+
dir: direction
|
|
6885
|
+
});
|
|
6812
6886
|
}
|
|
6813
6887
|
const notification = { show: (options) => {
|
|
6814
6888
|
const { type = "message", title, content, duration, closable = true, position = "top-right" } = options;
|
|
@@ -7789,7 +7863,7 @@ function extractFontFamily(styleStr) {
|
|
|
7789
7863
|
}
|
|
7790
7864
|
|
|
7791
7865
|
//#endregion
|
|
7792
|
-
//#region src/views/components/dom/
|
|
7866
|
+
//#region src/views/components/dom/Print.tsx
|
|
7793
7867
|
const PrintFloatDomSingle = (0, react.memo)((props) => {
|
|
7794
7868
|
var _position$startY, _position$startX;
|
|
7795
7869
|
const { layer, id, position } = props;
|