@univerjs/ui 0.23.0 → 0.24.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/facade.js +1 -1
- package/lib/cjs/index.js +136 -119
- package/lib/es/facade.js +1 -1
- package/lib/es/index.js +137 -112
- package/lib/facade.js +1 -1
- package/lib/index.css +19 -0
- package/lib/index.js +137 -112
- package/lib/types/index.d.ts +0 -3
- package/lib/types/services/sidebar/desktop-sidebar.service.d.ts +3 -0
- package/lib/types/services/sidebar/sidebar.service.d.ts +2 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +32 -32
- package/package.json +7 -7
- package/lib/types/services/global-zone/desktop-global-zone.service.d.ts +0 -31
- package/lib/types/services/global-zone/global-zone.service.d.ts +0 -26
- package/lib/types/views/components/global-zone/GlobalZone.d.ts +0 -16
package/lib/cjs/facade.js
CHANGED
|
@@ -332,7 +332,7 @@ let FShortcut = class FShortcut extends _univerjs_core_facade.FBase {
|
|
|
332
332
|
* ```
|
|
333
333
|
*/
|
|
334
334
|
triggerShortcut(e) {
|
|
335
|
-
const workbook = this._univerInstanceService.
|
|
335
|
+
const workbook = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
336
336
|
if (!workbook) return;
|
|
337
337
|
const renderUnit = this._renderManagerService.getRenderById(workbook.getUnitId());
|
|
338
338
|
if (!renderUnit) return;
|
package/lib/cjs/index.js
CHANGED
|
@@ -2951,7 +2951,7 @@ function RectPopup(props) {
|
|
|
2951
2951
|
window.removeEventListener("contextmenu", handleContextMenu);
|
|
2952
2952
|
};
|
|
2953
2953
|
}, [contextMenuFn]);
|
|
2954
|
-
const
|
|
2954
|
+
const dir = (0, _wendellhu_redi_react_bindings.useObservable)((0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService).direction$);
|
|
2955
2955
|
const ele = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [mask && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2956
2956
|
"data-u-comp": "rect-popup-mask",
|
|
2957
2957
|
className: "univer-fixed univer-inset-0 univer-z-[100]",
|
|
@@ -3510,9 +3510,20 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
3510
3510
|
const { dropdownVisible, setDropdownVisible } = (0, react.useContext)(TooltipWrapperContext);
|
|
3511
3511
|
const menuManagerService = (0, _wendellhu_redi_react_bindings.useDependency)(IMenuManagerService);
|
|
3512
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]);
|
|
3513
3520
|
const menuItems = (0, react.useMemo)(() => {
|
|
3514
3521
|
return menuId ? menuManagerService.getMenuByPositionKey(menuId) : [];
|
|
3515
|
-
}, [
|
|
3522
|
+
}, [
|
|
3523
|
+
menuId,
|
|
3524
|
+
menuManagerService,
|
|
3525
|
+
menuVersion
|
|
3526
|
+
]);
|
|
3516
3527
|
const filteredMenuItems = (0, react.useMemo)(() => {
|
|
3517
3528
|
return menuItems.filter((item) => {
|
|
3518
3529
|
var _item$key;
|
|
@@ -4276,6 +4287,7 @@ function ContextMenuPanel(props) {
|
|
|
4276
4287
|
onWheel: (event) => event.stopPropagation(),
|
|
4277
4288
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContextMenuMenu, {
|
|
4278
4289
|
menuSchemas: menuItems,
|
|
4290
|
+
menuSessionVersion,
|
|
4279
4291
|
submenuPortalContainer,
|
|
4280
4292
|
onOptionSelect,
|
|
4281
4293
|
maxMenuHeight
|
|
@@ -4283,7 +4295,7 @@ function ContextMenuPanel(props) {
|
|
|
4283
4295
|
});
|
|
4284
4296
|
}
|
|
4285
4297
|
function ContextMenuMenu(props) {
|
|
4286
|
-
const { menuSchemas, submenuPortalContainer, onOptionSelect, maxMenuHeight } = props;
|
|
4298
|
+
const { menuSchemas, menuSessionVersion, submenuPortalContainer, onOptionSelect, maxMenuHeight } = props;
|
|
4287
4299
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
4288
4300
|
const hiddenGroupStates = useContextGroupHiddenStates$1(menuSchemas);
|
|
4289
4301
|
const visibleSchemas = (0, react.useMemo)(() => {
|
|
@@ -4298,6 +4310,7 @@ function ContextMenuMenu(props) {
|
|
|
4298
4310
|
if (menuSchema.item) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContextMenuMenuItem, {
|
|
4299
4311
|
menuKey: menuSchema.key,
|
|
4300
4312
|
menuItem: menuSchema.item,
|
|
4313
|
+
menuSessionVersion,
|
|
4301
4314
|
submenuPortalContainer,
|
|
4302
4315
|
onOptionSelect,
|
|
4303
4316
|
maxMenuHeight
|
|
@@ -4321,6 +4334,7 @@ function ContextMenuMenu(props) {
|
|
|
4321
4334
|
}), menuSchema.children.map((childSchema) => childSchema.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContextMenuMenuItem, {
|
|
4322
4335
|
menuKey: childSchema.key,
|
|
4323
4336
|
menuItem: childSchema.item,
|
|
4337
|
+
menuSessionVersion,
|
|
4324
4338
|
submenuPortalContainer,
|
|
4325
4339
|
onOptionSelect,
|
|
4326
4340
|
maxMenuHeight
|
|
@@ -4329,8 +4343,8 @@ function ContextMenuMenu(props) {
|
|
|
4329
4343
|
}) });
|
|
4330
4344
|
}
|
|
4331
4345
|
function ContextMenuMenuItem(props) {
|
|
4332
|
-
const { menuKey, menuItem, submenuPortalContainer, onOptionSelect, maxMenuHeight } = props;
|
|
4333
|
-
const
|
|
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$);
|
|
4334
4348
|
const menuManagerService = (0, _wendellhu_redi_react_bindings.useDependency)(IMenuManagerService);
|
|
4335
4349
|
const disabled = (0, _wendellhu_redi_react_bindings.useObservable)(menuItem.disabled$, false);
|
|
4336
4350
|
const activated = (0, _wendellhu_redi_react_bindings.useObservable)(menuItem.activated$, false);
|
|
@@ -4363,7 +4377,8 @@ function ContextMenuMenuItem(props) {
|
|
|
4363
4377
|
}, [
|
|
4364
4378
|
menuItem.id,
|
|
4365
4379
|
menuItem.type,
|
|
4366
|
-
menuManagerService
|
|
4380
|
+
menuManagerService,
|
|
4381
|
+
menuSessionVersion
|
|
4367
4382
|
]);
|
|
4368
4383
|
const hasSelectionSubmenu = selections.length > 0;
|
|
4369
4384
|
const hasSubItemSubmenu = subMenuItems.length > 0;
|
|
@@ -4559,6 +4574,7 @@ function ContextMenuMenuItem(props) {
|
|
|
4559
4574
|
})
|
|
4560
4575
|
}), hasSubItemSubmenu && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContextMenuMenu, {
|
|
4561
4576
|
menuSchemas: subMenuItems,
|
|
4577
|
+
menuSessionVersion,
|
|
4562
4578
|
submenuPortalContainer,
|
|
4563
4579
|
onOptionSelect: onSubmenuOptionSelect,
|
|
4564
4580
|
maxMenuHeight
|
|
@@ -4748,62 +4764,18 @@ function DesktopContextMenu() {
|
|
|
4748
4764
|
});
|
|
4749
4765
|
}
|
|
4750
4766
|
|
|
4751
|
-
//#endregion
|
|
4752
|
-
//#region src/services/global-zone/global-zone.service.ts
|
|
4753
|
-
const IGlobalZoneService = (0, _univerjs_core.createIdentifier)("univer.global-zone-service");
|
|
4754
|
-
|
|
4755
|
-
//#endregion
|
|
4756
|
-
//#region src/views/components/global-zone/GlobalZone.tsx
|
|
4757
|
-
/**
|
|
4758
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
4759
|
-
*
|
|
4760
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4761
|
-
* you may not use this file except in compliance with the License.
|
|
4762
|
-
* You may obtain a copy of the License at
|
|
4763
|
-
*
|
|
4764
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4765
|
-
*
|
|
4766
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
4767
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4768
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4769
|
-
* See the License for the specific language governing permissions and
|
|
4770
|
-
* limitations under the License.
|
|
4771
|
-
*/
|
|
4772
|
-
function GlobalZone() {
|
|
4773
|
-
const globalZoneService = (0, _wendellhu_redi_react_bindings.useDependency)(IGlobalZoneService);
|
|
4774
|
-
const [visible, setVisible] = (0, react.useState)(false);
|
|
4775
|
-
const componentKey = (0, _wendellhu_redi_react_bindings.useObservable)(globalZoneService.componentKey$, globalZoneService.componentKey);
|
|
4776
|
-
const componentManager = (0, _wendellhu_redi_react_bindings.useDependency)(ComponentManager);
|
|
4777
|
-
const { direction } = (0, react.useContext)(_univerjs_design.ConfigContext);
|
|
4778
|
-
const Component = (0, react.useMemo)(() => {
|
|
4779
|
-
const Component = componentManager.get(componentKey !== null && componentKey !== void 0 ? componentKey : "");
|
|
4780
|
-
if (Component) return Component;
|
|
4781
|
-
}, [componentKey, componentManager]);
|
|
4782
|
-
(0, react.useEffect)(() => {
|
|
4783
|
-
const subscription = globalZoneService.visible$.subscribe((val) => {
|
|
4784
|
-
setVisible(val);
|
|
4785
|
-
});
|
|
4786
|
-
return () => {
|
|
4787
|
-
subscription.unsubscribe();
|
|
4788
|
-
};
|
|
4789
|
-
}, [globalZoneService.visible$]);
|
|
4790
|
-
if (!visible) return null;
|
|
4791
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
4792
|
-
dir: direction,
|
|
4793
|
-
className: (0, _univerjs_design.clsx)("univer-absolute univer-bg-gray-100", {
|
|
4794
|
-
"univer-hidden": !visible,
|
|
4795
|
-
"univer-inset-0 univer-z-[100] univer-block univer-size-full": visible
|
|
4796
|
-
}),
|
|
4797
|
-
children: Component && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {})
|
|
4798
|
-
});
|
|
4799
|
-
}
|
|
4800
|
-
|
|
4801
4767
|
//#endregion
|
|
4802
4768
|
//#region src/views/components/sidebar/Sidebar.tsx
|
|
4769
|
+
const MIN_SIDEBAR_WIDTH = 280;
|
|
4770
|
+
const MAX_SIDEBAR_WIDTH = 800;
|
|
4803
4771
|
function Sidebar() {
|
|
4804
4772
|
const sidebarService = (0, _wendellhu_redi_react_bindings.useDependency)(ISidebarService);
|
|
4805
4773
|
const sidebarOptions = (0, _wendellhu_redi_react_bindings.useObservable)(sidebarService.sidebarOptions$);
|
|
4806
4774
|
const scrollRef = (0, react.useRef)(null);
|
|
4775
|
+
const sidebarRef = (0, react.useRef)(null);
|
|
4776
|
+
const closeButtonRef = (0, react.useRef)(null);
|
|
4777
|
+
const [isDragging, setIsDragging] = (0, react.useState)(false);
|
|
4778
|
+
const dragWidthRef = (0, react.useRef)(null);
|
|
4807
4779
|
const options = (0, react.useMemo)(() => {
|
|
4808
4780
|
if (!sidebarOptions) return null;
|
|
4809
4781
|
const copy = { ...sidebarOptions };
|
|
@@ -4814,12 +4786,59 @@ function Sidebar() {
|
|
|
4814
4786
|
]) {
|
|
4815
4787
|
const k = key;
|
|
4816
4788
|
if (sidebarOptions[k]) {
|
|
4817
|
-
const { key, ...props } = sidebarOptions[k];
|
|
4818
|
-
if (props) copy[k] = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, { ...props },
|
|
4789
|
+
const { key: itemKey, ...props } = sidebarOptions[k];
|
|
4790
|
+
if (props) copy[k] = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, { ...props }, itemKey);
|
|
4819
4791
|
}
|
|
4820
4792
|
}
|
|
4821
4793
|
return copy;
|
|
4822
4794
|
}, [sidebarOptions]);
|
|
4795
|
+
(0, react.useEffect)(() => {
|
|
4796
|
+
if ((options === null || options === void 0 ? void 0 : options.visible) && closeButtonRef.current) closeButtonRef.current.focus();
|
|
4797
|
+
}, [options === null || options === void 0 ? void 0 : options.visible]);
|
|
4798
|
+
(0, react.useEffect)(() => {
|
|
4799
|
+
const handleKeyDown = (e) => {
|
|
4800
|
+
if (e.key === "Escape" && sidebarService.visible) {
|
|
4801
|
+
e.stopPropagation();
|
|
4802
|
+
sidebarService.close();
|
|
4803
|
+
}
|
|
4804
|
+
};
|
|
4805
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
4806
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
4807
|
+
}, [sidebarService]);
|
|
4808
|
+
const handleResizeMouseDown = (0, react.useCallback)((e) => {
|
|
4809
|
+
e.preventDefault();
|
|
4810
|
+
e.stopPropagation();
|
|
4811
|
+
setIsDragging(true);
|
|
4812
|
+
document.body.style.cursor = "col-resize";
|
|
4813
|
+
document.body.style.userSelect = "none";
|
|
4814
|
+
}, []);
|
|
4815
|
+
(0, react.useEffect)(() => {
|
|
4816
|
+
if (!isDragging) {
|
|
4817
|
+
document.body.style.cursor = "";
|
|
4818
|
+
document.body.style.userSelect = "";
|
|
4819
|
+
return;
|
|
4820
|
+
}
|
|
4821
|
+
const handleMouseMove = (e) => {
|
|
4822
|
+
if (!sidebarRef.current) return;
|
|
4823
|
+
const newWidth = sidebarRef.current.getBoundingClientRect().right - e.clientX;
|
|
4824
|
+
const clampedWidth = Math.max(MIN_SIDEBAR_WIDTH, Math.min(newWidth, MAX_SIDEBAR_WIDTH));
|
|
4825
|
+
dragWidthRef.current = clampedWidth;
|
|
4826
|
+
sidebarRef.current.style.width = `${clampedWidth}px`;
|
|
4827
|
+
};
|
|
4828
|
+
const handleMouseUp = () => {
|
|
4829
|
+
setIsDragging(false);
|
|
4830
|
+
if (dragWidthRef.current != null) {
|
|
4831
|
+
sidebarService.setWidth(dragWidthRef.current);
|
|
4832
|
+
dragWidthRef.current = null;
|
|
4833
|
+
}
|
|
4834
|
+
};
|
|
4835
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
4836
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
4837
|
+
return () => {
|
|
4838
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
4839
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
4840
|
+
};
|
|
4841
|
+
}, [isDragging, sidebarService]);
|
|
4823
4842
|
(0, react.useEffect)(() => {
|
|
4824
4843
|
if (scrollRef.current) sidebarService.setContainer(scrollRef.current);
|
|
4825
4844
|
return () => {
|
|
@@ -4837,29 +4856,66 @@ function Sidebar() {
|
|
|
4837
4856
|
};
|
|
4838
4857
|
}, [sidebarService]);
|
|
4839
4858
|
const width = (0, react.useMemo)(() => {
|
|
4859
|
+
if (isDragging && dragWidthRef.current != null) return `${dragWidthRef.current}px`;
|
|
4840
4860
|
if (!(options === null || options === void 0 ? void 0 : options.visible)) return 0;
|
|
4861
|
+
const savedWidth = sidebarService.width;
|
|
4862
|
+
if (savedWidth) return `${savedWidth}px`;
|
|
4841
4863
|
if (typeof options.width === "number") return `${options.width}px`;
|
|
4842
4864
|
return options.width;
|
|
4843
|
-
}, [
|
|
4865
|
+
}, [
|
|
4866
|
+
isDragging,
|
|
4867
|
+
options,
|
|
4868
|
+
sidebarService
|
|
4869
|
+
]);
|
|
4844
4870
|
function handleClose() {
|
|
4845
4871
|
sidebarService.close(sidebarOptions === null || sidebarOptions === void 0 ? void 0 : sidebarOptions.id);
|
|
4846
4872
|
}
|
|
4847
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.
|
|
4873
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
4874
|
+
ref: sidebarRef,
|
|
4848
4875
|
"data-u-comp": "sidebar",
|
|
4849
|
-
|
|
4876
|
+
role: "complementary",
|
|
4877
|
+
"aria-expanded": !!(options === null || options === void 0 ? void 0 : options.visible),
|
|
4878
|
+
"aria-label": "Sidebar panel",
|
|
4879
|
+
className: (0, _univerjs_design.clsx)("univer-relative univer-h-full univer-flex-shrink-0 univer-bg-white univer-text-gray-900 dark:!univer-bg-gray-900 dark:!univer-text-white", {
|
|
4850
4880
|
"univer-w-96 univer-translate-x-0": options === null || options === void 0 ? void 0 : options.visible,
|
|
4851
4881
|
"univer-w-0 univer-translate-x-full": !(options === null || options === void 0 ? void 0 : options.visible)
|
|
4852
4882
|
}),
|
|
4853
|
-
style: { width },
|
|
4854
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.
|
|
4883
|
+
style: { width: isDragging ? void 0 : width },
|
|
4884
|
+
children: [(options === null || options === void 0 ? void 0 : options.visible) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4885
|
+
className: "hover:univer-bg-primary-500/30 active:univer-bg-primary-500/50 univer-absolute univer-left-0 univer-top-0 univer-z-20 univer-h-full univer-w-1 univer-cursor-col-resize univer-transition-colors",
|
|
4886
|
+
onMouseDown: handleResizeMouseDown,
|
|
4887
|
+
role: "separator",
|
|
4888
|
+
"aria-orientation": "vertical",
|
|
4889
|
+
"aria-label": "Resize sidebar",
|
|
4890
|
+
tabIndex: 0,
|
|
4891
|
+
onKeyDown: (e) => {
|
|
4892
|
+
if (!sidebarRef.current) return;
|
|
4893
|
+
const currentWidth = sidebarRef.current.getBoundingClientRect().width;
|
|
4894
|
+
let newWidth = currentWidth;
|
|
4895
|
+
if (e.key === "ArrowLeft") {
|
|
4896
|
+
e.preventDefault();
|
|
4897
|
+
newWidth = Math.max(MIN_SIDEBAR_WIDTH, currentWidth - 20);
|
|
4898
|
+
} else if (e.key === "ArrowRight") {
|
|
4899
|
+
e.preventDefault();
|
|
4900
|
+
newWidth = Math.min(MAX_SIDEBAR_WIDTH, currentWidth + 20);
|
|
4901
|
+
}
|
|
4902
|
+
if (newWidth !== currentWidth) {
|
|
4903
|
+
sidebarRef.current.style.width = `${newWidth}px`;
|
|
4904
|
+
sidebarService.setWidth(newWidth);
|
|
4905
|
+
}
|
|
4906
|
+
}
|
|
4907
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
4855
4908
|
ref: scrollRef,
|
|
4856
4909
|
className: (0, _univerjs_design.clsx)("univer-box-border univer-grid univer-h-0 univer-min-h-full univer-grid-rows-[auto_1fr_auto] univer-overflow-y-auto", _univerjs_design.borderLeftBottomClassName, _univerjs_design.scrollbarClassName),
|
|
4857
4910
|
children: [
|
|
4858
4911
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
|
|
4859
4912
|
className: "univer-sticky univer-top-0 univer-z-10 univer-box-border univer-flex univer-cursor-default univer-items-center univer-justify-between univer-bg-white univer-p-4 univer-pb-2 univer-text-base univer-font-medium univer-text-gray-800 dark:!univer-bg-gray-900 dark:!univer-text-white",
|
|
4860
|
-
children: [options === null || options === void 0 ? void 0 : options.header, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("
|
|
4861
|
-
|
|
4913
|
+
children: [options === null || options === void 0 ? void 0 : options.header, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
4914
|
+
ref: closeButtonRef,
|
|
4915
|
+
type: "button",
|
|
4916
|
+
className: "focus:univer-ring-primary-500/50 univer-cursor-pointer univer-appearance-none univer-rounded-sm univer-border-none univer-bg-transparent univer-p-0 univer-text-gray-500 focus:univer-outline-none focus:univer-ring-2 dark:!univer-text-gray-300",
|
|
4862
4917
|
onClick: handleClose,
|
|
4918
|
+
"aria-label": "Close sidebar",
|
|
4863
4919
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.CloseIcon, {})
|
|
4864
4920
|
})]
|
|
4865
4921
|
}),
|
|
@@ -4873,7 +4929,7 @@ function Sidebar() {
|
|
|
4873
4929
|
children: options.footer
|
|
4874
4930
|
})
|
|
4875
4931
|
]
|
|
4876
|
-
})
|
|
4932
|
+
})]
|
|
4877
4933
|
});
|
|
4878
4934
|
}
|
|
4879
4935
|
|
|
@@ -5070,7 +5126,6 @@ function DesktopWorkbenchContent(props) {
|
|
|
5070
5126
|
dir: direction,
|
|
5071
5127
|
children: [
|
|
5072
5128
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: globalComponents }, "global"),
|
|
5073
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(GlobalZone, {}),
|
|
5074
5129
|
contextMenu && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DesktopContextMenu, {}),
|
|
5075
5130
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FloatingContainer, {}),
|
|
5076
5131
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { id: popupRootId })
|
|
@@ -5241,7 +5296,7 @@ const IUIController = (0, _univerjs_core.createIdentifier)("univer.ui.ui-control
|
|
|
5241
5296
|
//#endregion
|
|
5242
5297
|
//#region package.json
|
|
5243
5298
|
var name = "@univerjs/ui";
|
|
5244
|
-
var version = "0.
|
|
5299
|
+
var version = "0.24.0";
|
|
5245
5300
|
|
|
5246
5301
|
//#endregion
|
|
5247
5302
|
//#region src/views/components/ribbon/MobileRibbon.tsx
|
|
@@ -5738,7 +5793,8 @@ function MobileContextMenu() {
|
|
|
5738
5793
|
const commandService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ICommandService);
|
|
5739
5794
|
const layoutService = (0, _wendellhu_redi_react_bindings.useDependency)(ILayoutService);
|
|
5740
5795
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
5741
|
-
const
|
|
5796
|
+
const direction = (0, _wendellhu_redi_react_bindings.useObservable)(localeService.direction$);
|
|
5797
|
+
const { mountContainer } = (0, react.useContext)(_univerjs_design.ConfigContext);
|
|
5742
5798
|
visibleRef.current = visible;
|
|
5743
5799
|
(0, react.useEffect)(() => {
|
|
5744
5800
|
const hostDisposable = contextMenuHostService.registerMenu(MOBILE_CONTEXT_MENU_HOST_ID, () => {
|
|
@@ -5935,7 +5991,6 @@ function MobileWorkbench(props) {
|
|
|
5935
5991
|
]
|
|
5936
5992
|
}),
|
|
5937
5993
|
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
5994
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ZenZone, {})
|
|
5940
5995
|
]
|
|
5941
5996
|
})]
|
|
@@ -6711,37 +6766,6 @@ let DesktopGalleryService = class DesktopGalleryService extends _univerjs_core.D
|
|
|
6711
6766
|
};
|
|
6712
6767
|
DesktopGalleryService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), __decorateParam(1, IUIPartsService)], DesktopGalleryService);
|
|
6713
6768
|
|
|
6714
|
-
//#endregion
|
|
6715
|
-
//#region src/services/global-zone/desktop-global-zone.service.ts
|
|
6716
|
-
let DesktopGlobalZoneService = class DesktopGlobalZoneService {
|
|
6717
|
-
constructor(_componentManager) {
|
|
6718
|
-
this._componentManager = _componentManager;
|
|
6719
|
-
_defineProperty(this, "visible$", new rxjs.Subject());
|
|
6720
|
-
_defineProperty(this, "componentKey$", new rxjs.Subject());
|
|
6721
|
-
_defineProperty(this, "_componentKey", "");
|
|
6722
|
-
}
|
|
6723
|
-
get componentKey() {
|
|
6724
|
-
return this._componentKey;
|
|
6725
|
-
}
|
|
6726
|
-
set(key, component) {
|
|
6727
|
-
this._componentManager.register(key, component);
|
|
6728
|
-
this.componentKey$.next(key);
|
|
6729
|
-
this._componentKey = key;
|
|
6730
|
-
return (0, _univerjs_core.toDisposable)(() => {
|
|
6731
|
-
this._componentManager.delete(key);
|
|
6732
|
-
this.visible$.complete();
|
|
6733
|
-
this.componentKey$.complete();
|
|
6734
|
-
});
|
|
6735
|
-
}
|
|
6736
|
-
open() {
|
|
6737
|
-
this.visible$.next(true);
|
|
6738
|
-
}
|
|
6739
|
-
close() {
|
|
6740
|
-
this.visible$.next(false);
|
|
6741
|
-
}
|
|
6742
|
-
};
|
|
6743
|
-
DesktopGlobalZoneService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(ComponentManager))], DesktopGlobalZoneService);
|
|
6744
|
-
|
|
6745
6769
|
//#endregion
|
|
6746
6770
|
//#region src/services/local-file/desktop-local-file.service.ts
|
|
6747
6771
|
var DesktopLocalFileService = class extends _univerjs_core.Disposable {
|
|
@@ -6833,8 +6857,9 @@ var DesktopLocalStorageService = class {
|
|
|
6833
6857
|
* limitations under the License.
|
|
6834
6858
|
*/
|
|
6835
6859
|
function MessageContainer() {
|
|
6860
|
+
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
6836
6861
|
const darkMode = (0, _wendellhu_redi_react_bindings.useObservable)((0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ThemeService).darkMode$);
|
|
6837
|
-
const
|
|
6862
|
+
const direction = (0, _wendellhu_redi_react_bindings.useObservable)(localeService.direction$);
|
|
6838
6863
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Messager, {
|
|
6839
6864
|
theme: darkMode ? "dark" : "light",
|
|
6840
6865
|
dir: direction
|
|
@@ -6877,8 +6902,9 @@ DesktopMessageService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject
|
|
|
6877
6902
|
//#endregion
|
|
6878
6903
|
//#region src/components/notification/Notification.tsx
|
|
6879
6904
|
function Notification() {
|
|
6905
|
+
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
6880
6906
|
const darkMode = (0, _wendellhu_redi_react_bindings.useObservable)((0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ThemeService).darkMode$);
|
|
6881
|
-
const
|
|
6907
|
+
const direction = (0, _wendellhu_redi_react_bindings.useObservable)(localeService.direction$);
|
|
6882
6908
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Toaster, {
|
|
6883
6909
|
theme: darkMode ? "dark" : "light",
|
|
6884
6910
|
dir: direction
|
|
@@ -6923,6 +6949,7 @@ var DesktopSidebarService = class extends _univerjs_core.Disposable {
|
|
|
6923
6949
|
_defineProperty(this, "scrollEvent$", new rxjs.Subject());
|
|
6924
6950
|
_defineProperty(this, "_container", void 0);
|
|
6925
6951
|
_defineProperty(this, "_openAnimationFrameId", null);
|
|
6952
|
+
_defineProperty(this, "_width", void 0);
|
|
6926
6953
|
}
|
|
6927
6954
|
get visible() {
|
|
6928
6955
|
return this._sidebarOptions.visible || false;
|
|
@@ -6930,6 +6957,12 @@ var DesktopSidebarService = class extends _univerjs_core.Disposable {
|
|
|
6930
6957
|
get options() {
|
|
6931
6958
|
return this._sidebarOptions;
|
|
6932
6959
|
}
|
|
6960
|
+
get width() {
|
|
6961
|
+
return this._width;
|
|
6962
|
+
}
|
|
6963
|
+
setWidth(value) {
|
|
6964
|
+
this._width = value;
|
|
6965
|
+
}
|
|
6933
6966
|
dispose() {
|
|
6934
6967
|
super.dispose();
|
|
6935
6968
|
this.close();
|
|
@@ -7082,10 +7115,6 @@ let UniverMobileUIPlugin = class UniverMobileUIPlugin extends _univerjs_core.Plu
|
|
|
7082
7115
|
useClass: DesktopZenZoneService,
|
|
7083
7116
|
lazy: true
|
|
7084
7117
|
}],
|
|
7085
|
-
[IGlobalZoneService, {
|
|
7086
|
-
useClass: DesktopGlobalZoneService,
|
|
7087
|
-
lazy: true
|
|
7088
|
-
}],
|
|
7089
7118
|
[IMessageService, {
|
|
7090
7119
|
useClass: DesktopMessageService,
|
|
7091
7120
|
lazy: true
|
|
@@ -7183,10 +7212,6 @@ let UniverUIPlugin = class UniverUIPlugin extends _univerjs_core.Plugin {
|
|
|
7183
7212
|
useClass: DesktopZenZoneService,
|
|
7184
7213
|
lazy: true
|
|
7185
7214
|
}],
|
|
7186
|
-
[IGlobalZoneService, {
|
|
7187
|
-
useClass: DesktopGlobalZoneService,
|
|
7188
|
-
lazy: true
|
|
7189
|
-
}],
|
|
7190
7215
|
[IMessageService, {
|
|
7191
7216
|
useClass: DesktopMessageService,
|
|
7192
7217
|
lazy: true
|
|
@@ -7983,12 +8008,6 @@ Object.defineProperty(exports, 'DesktopGalleryService', {
|
|
|
7983
8008
|
return DesktopGalleryService;
|
|
7984
8009
|
}
|
|
7985
8010
|
});
|
|
7986
|
-
Object.defineProperty(exports, 'DesktopGlobalZoneService', {
|
|
7987
|
-
enumerable: true,
|
|
7988
|
-
get: function () {
|
|
7989
|
-
return DesktopGlobalZoneService;
|
|
7990
|
-
}
|
|
7991
|
-
});
|
|
7992
8011
|
Object.defineProperty(exports, 'DesktopLayoutService', {
|
|
7993
8012
|
enumerable: true,
|
|
7994
8013
|
get: function () {
|
|
@@ -8048,7 +8067,6 @@ exports.FloatDomSingle = FloatDomSingle;
|
|
|
8048
8067
|
exports.FontFamily = FontFamily;
|
|
8049
8068
|
exports.FontFamilyItem = FontFamilyItem;
|
|
8050
8069
|
exports.FontSize = FontSize;
|
|
8051
|
-
exports.GlobalZone = GlobalZone;
|
|
8052
8070
|
exports.HEADING_ITEM_COMPONENT = HEADING_ITEM_COMPONENT;
|
|
8053
8071
|
exports.HEADING_LIST = HEADING_LIST;
|
|
8054
8072
|
exports.HTML_CLIPBOARD_MIME_TYPE = HTML_CLIPBOARD_MIME_TYPE;
|
|
@@ -8061,7 +8079,6 @@ exports.IContextMenuService = IContextMenuService;
|
|
|
8061
8079
|
exports.IDialogService = IDialogService;
|
|
8062
8080
|
exports.IFontService = IFontService;
|
|
8063
8081
|
exports.IGalleryService = IGalleryService;
|
|
8064
|
-
exports.IGlobalZoneService = IGlobalZoneService;
|
|
8065
8082
|
exports.ILayoutService = ILayoutService;
|
|
8066
8083
|
exports.ILeftSidebarService = ILeftSidebarService;
|
|
8067
8084
|
exports.ILocalFileService = ILocalFileService;
|
package/lib/es/facade.js
CHANGED
|
@@ -332,7 +332,7 @@ let FShortcut = class FShortcut extends FBase {
|
|
|
332
332
|
* ```
|
|
333
333
|
*/
|
|
334
334
|
triggerShortcut(e) {
|
|
335
|
-
const workbook = this._univerInstanceService.
|
|
335
|
+
const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
336
336
|
if (!workbook) return;
|
|
337
337
|
const renderUnit = this._renderManagerService.getRenderById(workbook.getUnitId());
|
|
338
338
|
if (!renderUnit) return;
|