@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/index.js
CHANGED
|
@@ -2906,7 +2906,7 @@ function RectPopup(props) {
|
|
|
2906
2906
|
window.removeEventListener("contextmenu", handleContextMenu);
|
|
2907
2907
|
};
|
|
2908
2908
|
}, [contextMenuFn]);
|
|
2909
|
-
const
|
|
2909
|
+
const dir = useObservable(useDependency(LocaleService).direction$);
|
|
2910
2910
|
const ele = /* @__PURE__ */ jsxs(Fragment$1, { children: [mask && /* @__PURE__ */ jsx("div", {
|
|
2911
2911
|
"data-u-comp": "rect-popup-mask",
|
|
2912
2912
|
className: "univer-fixed univer-inset-0 univer-z-[100]",
|
|
@@ -3465,9 +3465,20 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
3465
3465
|
const { dropdownVisible, setDropdownVisible } = useContext(TooltipWrapperContext);
|
|
3466
3466
|
const menuManagerService = useDependency(IMenuManagerService);
|
|
3467
3467
|
const [hiddenStates, setHiddenStates] = useState({});
|
|
3468
|
+
const [menuVersion, setMenuVersion] = useState(0);
|
|
3469
|
+
useEffect(() => {
|
|
3470
|
+
const subscription = menuManagerService.menuChanged$.subscribe(() => {
|
|
3471
|
+
setMenuVersion((version) => version + 1);
|
|
3472
|
+
});
|
|
3473
|
+
return () => subscription.unsubscribe();
|
|
3474
|
+
}, [menuManagerService]);
|
|
3468
3475
|
const menuItems = useMemo(() => {
|
|
3469
3476
|
return menuId ? menuManagerService.getMenuByPositionKey(menuId) : [];
|
|
3470
|
-
}, [
|
|
3477
|
+
}, [
|
|
3478
|
+
menuId,
|
|
3479
|
+
menuManagerService,
|
|
3480
|
+
menuVersion
|
|
3481
|
+
]);
|
|
3471
3482
|
const filteredMenuItems = useMemo(() => {
|
|
3472
3483
|
return menuItems.filter((item) => {
|
|
3473
3484
|
var _item$key;
|
|
@@ -4231,6 +4242,7 @@ function ContextMenuPanel(props) {
|
|
|
4231
4242
|
onWheel: (event) => event.stopPropagation(),
|
|
4232
4243
|
children: /* @__PURE__ */ jsx(ContextMenuMenu, {
|
|
4233
4244
|
menuSchemas: menuItems,
|
|
4245
|
+
menuSessionVersion,
|
|
4234
4246
|
submenuPortalContainer,
|
|
4235
4247
|
onOptionSelect,
|
|
4236
4248
|
maxMenuHeight
|
|
@@ -4238,7 +4250,7 @@ function ContextMenuPanel(props) {
|
|
|
4238
4250
|
});
|
|
4239
4251
|
}
|
|
4240
4252
|
function ContextMenuMenu(props) {
|
|
4241
|
-
const { menuSchemas, submenuPortalContainer, onOptionSelect, maxMenuHeight } = props;
|
|
4253
|
+
const { menuSchemas, menuSessionVersion, submenuPortalContainer, onOptionSelect, maxMenuHeight } = props;
|
|
4242
4254
|
const localeService = useDependency(LocaleService);
|
|
4243
4255
|
const hiddenGroupStates = useContextGroupHiddenStates$1(menuSchemas);
|
|
4244
4256
|
const visibleSchemas = useMemo(() => {
|
|
@@ -4253,6 +4265,7 @@ function ContextMenuMenu(props) {
|
|
|
4253
4265
|
if (menuSchema.item) return /* @__PURE__ */ jsx(ContextMenuMenuItem, {
|
|
4254
4266
|
menuKey: menuSchema.key,
|
|
4255
4267
|
menuItem: menuSchema.item,
|
|
4268
|
+
menuSessionVersion,
|
|
4256
4269
|
submenuPortalContainer,
|
|
4257
4270
|
onOptionSelect,
|
|
4258
4271
|
maxMenuHeight
|
|
@@ -4276,6 +4289,7 @@ function ContextMenuMenu(props) {
|
|
|
4276
4289
|
}), menuSchema.children.map((childSchema) => childSchema.item && /* @__PURE__ */ jsx(ContextMenuMenuItem, {
|
|
4277
4290
|
menuKey: childSchema.key,
|
|
4278
4291
|
menuItem: childSchema.item,
|
|
4292
|
+
menuSessionVersion,
|
|
4279
4293
|
submenuPortalContainer,
|
|
4280
4294
|
onOptionSelect,
|
|
4281
4295
|
maxMenuHeight
|
|
@@ -4284,8 +4298,8 @@ function ContextMenuMenu(props) {
|
|
|
4284
4298
|
}) });
|
|
4285
4299
|
}
|
|
4286
4300
|
function ContextMenuMenuItem(props) {
|
|
4287
|
-
const { menuKey, menuItem, submenuPortalContainer, onOptionSelect, maxMenuHeight } = props;
|
|
4288
|
-
const
|
|
4301
|
+
const { menuKey, menuItem, menuSessionVersion, submenuPortalContainer, onOptionSelect, maxMenuHeight } = props;
|
|
4302
|
+
const direction = useObservable(useDependency(LocaleService).direction$);
|
|
4289
4303
|
const menuManagerService = useDependency(IMenuManagerService);
|
|
4290
4304
|
const disabled = useObservable(menuItem.disabled$, false);
|
|
4291
4305
|
const activated = useObservable(menuItem.activated$, false);
|
|
@@ -4318,7 +4332,8 @@ function ContextMenuMenuItem(props) {
|
|
|
4318
4332
|
}, [
|
|
4319
4333
|
menuItem.id,
|
|
4320
4334
|
menuItem.type,
|
|
4321
|
-
menuManagerService
|
|
4335
|
+
menuManagerService,
|
|
4336
|
+
menuSessionVersion
|
|
4322
4337
|
]);
|
|
4323
4338
|
const hasSelectionSubmenu = selections.length > 0;
|
|
4324
4339
|
const hasSubItemSubmenu = subMenuItems.length > 0;
|
|
@@ -4514,6 +4529,7 @@ function ContextMenuMenuItem(props) {
|
|
|
4514
4529
|
})
|
|
4515
4530
|
}), hasSubItemSubmenu && /* @__PURE__ */ jsx(ContextMenuMenu, {
|
|
4516
4531
|
menuSchemas: subMenuItems,
|
|
4532
|
+
menuSessionVersion,
|
|
4517
4533
|
submenuPortalContainer,
|
|
4518
4534
|
onOptionSelect: onSubmenuOptionSelect,
|
|
4519
4535
|
maxMenuHeight
|
|
@@ -4703,62 +4719,18 @@ function DesktopContextMenu() {
|
|
|
4703
4719
|
});
|
|
4704
4720
|
}
|
|
4705
4721
|
|
|
4706
|
-
//#endregion
|
|
4707
|
-
//#region src/services/global-zone/global-zone.service.ts
|
|
4708
|
-
const IGlobalZoneService = createIdentifier("univer.global-zone-service");
|
|
4709
|
-
|
|
4710
|
-
//#endregion
|
|
4711
|
-
//#region src/views/components/global-zone/GlobalZone.tsx
|
|
4712
|
-
/**
|
|
4713
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
4714
|
-
*
|
|
4715
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4716
|
-
* you may not use this file except in compliance with the License.
|
|
4717
|
-
* You may obtain a copy of the License at
|
|
4718
|
-
*
|
|
4719
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4720
|
-
*
|
|
4721
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
4722
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4723
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4724
|
-
* See the License for the specific language governing permissions and
|
|
4725
|
-
* limitations under the License.
|
|
4726
|
-
*/
|
|
4727
|
-
function GlobalZone() {
|
|
4728
|
-
const globalZoneService = useDependency(IGlobalZoneService);
|
|
4729
|
-
const [visible, setVisible] = useState(false);
|
|
4730
|
-
const componentKey = useObservable(globalZoneService.componentKey$, globalZoneService.componentKey);
|
|
4731
|
-
const componentManager = useDependency(ComponentManager);
|
|
4732
|
-
const { direction } = useContext(ConfigContext);
|
|
4733
|
-
const Component = useMemo(() => {
|
|
4734
|
-
const Component = componentManager.get(componentKey !== null && componentKey !== void 0 ? componentKey : "");
|
|
4735
|
-
if (Component) return Component;
|
|
4736
|
-
}, [componentKey, componentManager]);
|
|
4737
|
-
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__ */ jsx("section", {
|
|
4747
|
-
dir: direction,
|
|
4748
|
-
className: clsx("univer-absolute univer-bg-gray-100", {
|
|
4749
|
-
"univer-hidden": !visible,
|
|
4750
|
-
"univer-inset-0 univer-z-[100] univer-block univer-size-full": visible
|
|
4751
|
-
}),
|
|
4752
|
-
children: Component && /* @__PURE__ */ jsx(Component, {})
|
|
4753
|
-
});
|
|
4754
|
-
}
|
|
4755
|
-
|
|
4756
4722
|
//#endregion
|
|
4757
4723
|
//#region src/views/components/sidebar/Sidebar.tsx
|
|
4724
|
+
const MIN_SIDEBAR_WIDTH = 280;
|
|
4725
|
+
const MAX_SIDEBAR_WIDTH = 800;
|
|
4758
4726
|
function Sidebar() {
|
|
4759
4727
|
const sidebarService = useDependency(ISidebarService);
|
|
4760
4728
|
const sidebarOptions = useObservable(sidebarService.sidebarOptions$);
|
|
4761
4729
|
const scrollRef = useRef(null);
|
|
4730
|
+
const sidebarRef = useRef(null);
|
|
4731
|
+
const closeButtonRef = useRef(null);
|
|
4732
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
4733
|
+
const dragWidthRef = useRef(null);
|
|
4762
4734
|
const options = useMemo(() => {
|
|
4763
4735
|
if (!sidebarOptions) return null;
|
|
4764
4736
|
const copy = { ...sidebarOptions };
|
|
@@ -4769,12 +4741,59 @@ function Sidebar() {
|
|
|
4769
4741
|
]) {
|
|
4770
4742
|
const k = key;
|
|
4771
4743
|
if (sidebarOptions[k]) {
|
|
4772
|
-
const { key, ...props } = sidebarOptions[k];
|
|
4773
|
-
if (props) copy[k] = /* @__PURE__ */ jsx(CustomLabel, { ...props },
|
|
4744
|
+
const { key: itemKey, ...props } = sidebarOptions[k];
|
|
4745
|
+
if (props) copy[k] = /* @__PURE__ */ jsx(CustomLabel, { ...props }, itemKey);
|
|
4774
4746
|
}
|
|
4775
4747
|
}
|
|
4776
4748
|
return copy;
|
|
4777
4749
|
}, [sidebarOptions]);
|
|
4750
|
+
useEffect(() => {
|
|
4751
|
+
if ((options === null || options === void 0 ? void 0 : options.visible) && closeButtonRef.current) closeButtonRef.current.focus();
|
|
4752
|
+
}, [options === null || options === void 0 ? void 0 : options.visible]);
|
|
4753
|
+
useEffect(() => {
|
|
4754
|
+
const handleKeyDown = (e) => {
|
|
4755
|
+
if (e.key === "Escape" && sidebarService.visible) {
|
|
4756
|
+
e.stopPropagation();
|
|
4757
|
+
sidebarService.close();
|
|
4758
|
+
}
|
|
4759
|
+
};
|
|
4760
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
4761
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
4762
|
+
}, [sidebarService]);
|
|
4763
|
+
const handleResizeMouseDown = useCallback((e) => {
|
|
4764
|
+
e.preventDefault();
|
|
4765
|
+
e.stopPropagation();
|
|
4766
|
+
setIsDragging(true);
|
|
4767
|
+
document.body.style.cursor = "col-resize";
|
|
4768
|
+
document.body.style.userSelect = "none";
|
|
4769
|
+
}, []);
|
|
4770
|
+
useEffect(() => {
|
|
4771
|
+
if (!isDragging) {
|
|
4772
|
+
document.body.style.cursor = "";
|
|
4773
|
+
document.body.style.userSelect = "";
|
|
4774
|
+
return;
|
|
4775
|
+
}
|
|
4776
|
+
const handleMouseMove = (e) => {
|
|
4777
|
+
if (!sidebarRef.current) return;
|
|
4778
|
+
const newWidth = sidebarRef.current.getBoundingClientRect().right - e.clientX;
|
|
4779
|
+
const clampedWidth = Math.max(MIN_SIDEBAR_WIDTH, Math.min(newWidth, MAX_SIDEBAR_WIDTH));
|
|
4780
|
+
dragWidthRef.current = clampedWidth;
|
|
4781
|
+
sidebarRef.current.style.width = `${clampedWidth}px`;
|
|
4782
|
+
};
|
|
4783
|
+
const handleMouseUp = () => {
|
|
4784
|
+
setIsDragging(false);
|
|
4785
|
+
if (dragWidthRef.current != null) {
|
|
4786
|
+
sidebarService.setWidth(dragWidthRef.current);
|
|
4787
|
+
dragWidthRef.current = null;
|
|
4788
|
+
}
|
|
4789
|
+
};
|
|
4790
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
4791
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
4792
|
+
return () => {
|
|
4793
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
4794
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
4795
|
+
};
|
|
4796
|
+
}, [isDragging, sidebarService]);
|
|
4778
4797
|
useEffect(() => {
|
|
4779
4798
|
if (scrollRef.current) sidebarService.setContainer(scrollRef.current);
|
|
4780
4799
|
return () => {
|
|
@@ -4792,29 +4811,66 @@ function Sidebar() {
|
|
|
4792
4811
|
};
|
|
4793
4812
|
}, [sidebarService]);
|
|
4794
4813
|
const width = useMemo(() => {
|
|
4814
|
+
if (isDragging && dragWidthRef.current != null) return `${dragWidthRef.current}px`;
|
|
4795
4815
|
if (!(options === null || options === void 0 ? void 0 : options.visible)) return 0;
|
|
4816
|
+
const savedWidth = sidebarService.width;
|
|
4817
|
+
if (savedWidth) return `${savedWidth}px`;
|
|
4796
4818
|
if (typeof options.width === "number") return `${options.width}px`;
|
|
4797
4819
|
return options.width;
|
|
4798
|
-
}, [
|
|
4820
|
+
}, [
|
|
4821
|
+
isDragging,
|
|
4822
|
+
options,
|
|
4823
|
+
sidebarService
|
|
4824
|
+
]);
|
|
4799
4825
|
function handleClose() {
|
|
4800
4826
|
sidebarService.close(sidebarOptions === null || sidebarOptions === void 0 ? void 0 : sidebarOptions.id);
|
|
4801
4827
|
}
|
|
4802
|
-
return /* @__PURE__ */
|
|
4828
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
4829
|
+
ref: sidebarRef,
|
|
4803
4830
|
"data-u-comp": "sidebar",
|
|
4804
|
-
|
|
4831
|
+
role: "complementary",
|
|
4832
|
+
"aria-expanded": !!(options === null || options === void 0 ? void 0 : options.visible),
|
|
4833
|
+
"aria-label": "Sidebar panel",
|
|
4834
|
+
className: 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", {
|
|
4805
4835
|
"univer-w-96 univer-translate-x-0": options === null || options === void 0 ? void 0 : options.visible,
|
|
4806
4836
|
"univer-w-0 univer-translate-x-full": !(options === null || options === void 0 ? void 0 : options.visible)
|
|
4807
4837
|
}),
|
|
4808
|
-
style: { width },
|
|
4809
|
-
children: /* @__PURE__ */
|
|
4838
|
+
style: { width: isDragging ? void 0 : width },
|
|
4839
|
+
children: [(options === null || options === void 0 ? void 0 : options.visible) && /* @__PURE__ */ jsx("div", {
|
|
4840
|
+
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",
|
|
4841
|
+
onMouseDown: handleResizeMouseDown,
|
|
4842
|
+
role: "separator",
|
|
4843
|
+
"aria-orientation": "vertical",
|
|
4844
|
+
"aria-label": "Resize sidebar",
|
|
4845
|
+
tabIndex: 0,
|
|
4846
|
+
onKeyDown: (e) => {
|
|
4847
|
+
if (!sidebarRef.current) return;
|
|
4848
|
+
const currentWidth = sidebarRef.current.getBoundingClientRect().width;
|
|
4849
|
+
let newWidth = currentWidth;
|
|
4850
|
+
if (e.key === "ArrowLeft") {
|
|
4851
|
+
e.preventDefault();
|
|
4852
|
+
newWidth = Math.max(MIN_SIDEBAR_WIDTH, currentWidth - 20);
|
|
4853
|
+
} else if (e.key === "ArrowRight") {
|
|
4854
|
+
e.preventDefault();
|
|
4855
|
+
newWidth = Math.min(MAX_SIDEBAR_WIDTH, currentWidth + 20);
|
|
4856
|
+
}
|
|
4857
|
+
if (newWidth !== currentWidth) {
|
|
4858
|
+
sidebarRef.current.style.width = `${newWidth}px`;
|
|
4859
|
+
sidebarService.setWidth(newWidth);
|
|
4860
|
+
}
|
|
4861
|
+
}
|
|
4862
|
+
}), /* @__PURE__ */ jsxs("section", {
|
|
4810
4863
|
ref: scrollRef,
|
|
4811
4864
|
className: clsx("univer-box-border univer-grid univer-h-0 univer-min-h-full univer-grid-rows-[auto_1fr_auto] univer-overflow-y-auto", borderLeftBottomClassName, scrollbarClassName),
|
|
4812
4865
|
children: [
|
|
4813
4866
|
/* @__PURE__ */ jsxs("header", {
|
|
4814
4867
|
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",
|
|
4815
|
-
children: [options === null || options === void 0 ? void 0 : options.header, /* @__PURE__ */ jsx("
|
|
4816
|
-
|
|
4868
|
+
children: [options === null || options === void 0 ? void 0 : options.header, /* @__PURE__ */ jsx("button", {
|
|
4869
|
+
ref: closeButtonRef,
|
|
4870
|
+
type: "button",
|
|
4871
|
+
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",
|
|
4817
4872
|
onClick: handleClose,
|
|
4873
|
+
"aria-label": "Close sidebar",
|
|
4818
4874
|
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
4819
4875
|
})]
|
|
4820
4876
|
}),
|
|
@@ -4828,7 +4884,7 @@ function Sidebar() {
|
|
|
4828
4884
|
children: options.footer
|
|
4829
4885
|
})
|
|
4830
4886
|
]
|
|
4831
|
-
})
|
|
4887
|
+
})]
|
|
4832
4888
|
});
|
|
4833
4889
|
}
|
|
4834
4890
|
|
|
@@ -5025,7 +5081,6 @@ function DesktopWorkbenchContent(props) {
|
|
|
5025
5081
|
dir: direction,
|
|
5026
5082
|
children: [
|
|
5027
5083
|
/* @__PURE__ */ jsx(ComponentContainer, { components: globalComponents }, "global"),
|
|
5028
|
-
/* @__PURE__ */ jsx(GlobalZone, {}),
|
|
5029
5084
|
contextMenu && /* @__PURE__ */ jsx(DesktopContextMenu, {}),
|
|
5030
5085
|
/* @__PURE__ */ jsx(FloatingContainer, {}),
|
|
5031
5086
|
/* @__PURE__ */ jsx("div", { id: popupRootId })
|
|
@@ -5196,7 +5251,7 @@ const IUIController = createIdentifier("univer.ui.ui-controller");
|
|
|
5196
5251
|
//#endregion
|
|
5197
5252
|
//#region package.json
|
|
5198
5253
|
var name = "@univerjs/ui";
|
|
5199
|
-
var version = "0.
|
|
5254
|
+
var version = "0.24.0";
|
|
5200
5255
|
|
|
5201
5256
|
//#endregion
|
|
5202
5257
|
//#region src/views/components/ribbon/MobileRibbon.tsx
|
|
@@ -5693,7 +5748,8 @@ function MobileContextMenu() {
|
|
|
5693
5748
|
const commandService = useDependency(ICommandService);
|
|
5694
5749
|
const layoutService = useDependency(ILayoutService);
|
|
5695
5750
|
const localeService = useDependency(LocaleService);
|
|
5696
|
-
const
|
|
5751
|
+
const direction = useObservable(localeService.direction$);
|
|
5752
|
+
const { mountContainer } = useContext(ConfigContext);
|
|
5697
5753
|
visibleRef.current = visible;
|
|
5698
5754
|
useEffect(() => {
|
|
5699
5755
|
const hostDisposable = contextMenuHostService.registerMenu(MOBILE_CONTEXT_MENU_HOST_ID, () => {
|
|
@@ -5890,7 +5946,6 @@ function MobileWorkbench(props) {
|
|
|
5890
5946
|
]
|
|
5891
5947
|
}),
|
|
5892
5948
|
footer && /* @__PURE__ */ jsx("footer", { children: /* @__PURE__ */ jsx(ComponentContainer, { components: footerComponents }, "footer") }),
|
|
5893
|
-
/* @__PURE__ */ jsx(GlobalZone, {}),
|
|
5894
5949
|
/* @__PURE__ */ jsx(ZenZone, {})
|
|
5895
5950
|
]
|
|
5896
5951
|
})]
|
|
@@ -6666,37 +6721,6 @@ let DesktopGalleryService = class DesktopGalleryService extends Disposable {
|
|
|
6666
6721
|
};
|
|
6667
6722
|
DesktopGalleryService = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, IUIPartsService)], DesktopGalleryService);
|
|
6668
6723
|
|
|
6669
|
-
//#endregion
|
|
6670
|
-
//#region src/services/global-zone/desktop-global-zone.service.ts
|
|
6671
|
-
let DesktopGlobalZoneService = class DesktopGlobalZoneService {
|
|
6672
|
-
constructor(_componentManager) {
|
|
6673
|
-
this._componentManager = _componentManager;
|
|
6674
|
-
_defineProperty(this, "visible$", new Subject());
|
|
6675
|
-
_defineProperty(this, "componentKey$", new Subject());
|
|
6676
|
-
_defineProperty(this, "_componentKey", "");
|
|
6677
|
-
}
|
|
6678
|
-
get componentKey() {
|
|
6679
|
-
return this._componentKey;
|
|
6680
|
-
}
|
|
6681
|
-
set(key, component) {
|
|
6682
|
-
this._componentManager.register(key, component);
|
|
6683
|
-
this.componentKey$.next(key);
|
|
6684
|
-
this._componentKey = key;
|
|
6685
|
-
return toDisposable(() => {
|
|
6686
|
-
this._componentManager.delete(key);
|
|
6687
|
-
this.visible$.complete();
|
|
6688
|
-
this.componentKey$.complete();
|
|
6689
|
-
});
|
|
6690
|
-
}
|
|
6691
|
-
open() {
|
|
6692
|
-
this.visible$.next(true);
|
|
6693
|
-
}
|
|
6694
|
-
close() {
|
|
6695
|
-
this.visible$.next(false);
|
|
6696
|
-
}
|
|
6697
|
-
};
|
|
6698
|
-
DesktopGlobalZoneService = __decorate([__decorateParam(0, Inject(ComponentManager))], DesktopGlobalZoneService);
|
|
6699
|
-
|
|
6700
6724
|
//#endregion
|
|
6701
6725
|
//#region src/services/local-file/desktop-local-file.service.ts
|
|
6702
6726
|
var DesktopLocalFileService = class extends Disposable {
|
|
@@ -6788,8 +6812,9 @@ var DesktopLocalStorageService = class {
|
|
|
6788
6812
|
* limitations under the License.
|
|
6789
6813
|
*/
|
|
6790
6814
|
function MessageContainer() {
|
|
6815
|
+
const localeService = useDependency(LocaleService);
|
|
6791
6816
|
const darkMode = useObservable(useDependency(ThemeService).darkMode$);
|
|
6792
|
-
const
|
|
6817
|
+
const direction = useObservable(localeService.direction$);
|
|
6793
6818
|
return /* @__PURE__ */ jsx(Messager, {
|
|
6794
6819
|
theme: darkMode ? "dark" : "light",
|
|
6795
6820
|
dir: direction
|
|
@@ -6832,8 +6857,9 @@ DesktopMessageService = __decorate([__decorateParam(0, Inject(Injector)), __deco
|
|
|
6832
6857
|
//#endregion
|
|
6833
6858
|
//#region src/components/notification/Notification.tsx
|
|
6834
6859
|
function Notification() {
|
|
6860
|
+
const localeService = useDependency(LocaleService);
|
|
6835
6861
|
const darkMode = useObservable(useDependency(ThemeService).darkMode$);
|
|
6836
|
-
const
|
|
6862
|
+
const direction = useObservable(localeService.direction$);
|
|
6837
6863
|
return /* @__PURE__ */ jsx(Toaster, {
|
|
6838
6864
|
theme: darkMode ? "dark" : "light",
|
|
6839
6865
|
dir: direction
|
|
@@ -6878,6 +6904,7 @@ var DesktopSidebarService = class extends Disposable {
|
|
|
6878
6904
|
_defineProperty(this, "scrollEvent$", new Subject());
|
|
6879
6905
|
_defineProperty(this, "_container", void 0);
|
|
6880
6906
|
_defineProperty(this, "_openAnimationFrameId", null);
|
|
6907
|
+
_defineProperty(this, "_width", void 0);
|
|
6881
6908
|
}
|
|
6882
6909
|
get visible() {
|
|
6883
6910
|
return this._sidebarOptions.visible || false;
|
|
@@ -6885,6 +6912,12 @@ var DesktopSidebarService = class extends Disposable {
|
|
|
6885
6912
|
get options() {
|
|
6886
6913
|
return this._sidebarOptions;
|
|
6887
6914
|
}
|
|
6915
|
+
get width() {
|
|
6916
|
+
return this._width;
|
|
6917
|
+
}
|
|
6918
|
+
setWidth(value) {
|
|
6919
|
+
this._width = value;
|
|
6920
|
+
}
|
|
6888
6921
|
dispose() {
|
|
6889
6922
|
super.dispose();
|
|
6890
6923
|
this.close();
|
|
@@ -7037,10 +7070,6 @@ let UniverMobileUIPlugin = class UniverMobileUIPlugin extends Plugin {
|
|
|
7037
7070
|
useClass: DesktopZenZoneService,
|
|
7038
7071
|
lazy: true
|
|
7039
7072
|
}],
|
|
7040
|
-
[IGlobalZoneService, {
|
|
7041
|
-
useClass: DesktopGlobalZoneService,
|
|
7042
|
-
lazy: true
|
|
7043
|
-
}],
|
|
7044
7073
|
[IMessageService, {
|
|
7045
7074
|
useClass: DesktopMessageService,
|
|
7046
7075
|
lazy: true
|
|
@@ -7138,10 +7167,6 @@ let UniverUIPlugin = class UniverUIPlugin extends Plugin {
|
|
|
7138
7167
|
useClass: DesktopZenZoneService,
|
|
7139
7168
|
lazy: true
|
|
7140
7169
|
}],
|
|
7141
|
-
[IGlobalZoneService, {
|
|
7142
|
-
useClass: DesktopGlobalZoneService,
|
|
7143
|
-
lazy: true
|
|
7144
|
-
}],
|
|
7145
7170
|
[IMessageService, {
|
|
7146
7171
|
useClass: DesktopMessageService,
|
|
7147
7172
|
lazy: true
|
|
@@ -7886,4 +7911,4 @@ const PrintFloatDomSingle = memo((props) => {
|
|
|
7886
7911
|
});
|
|
7887
7912
|
|
|
7888
7913
|
//#endregion
|
|
7889
|
-
export { AnchoredContextMenu, BrowserClipboardService, BuiltInUIPart, COLOR_PICKER_COMPONENT, COMMON_LABEL_COMPONENT, CanvasFloatDomService, CanvasPopup, CanvasPopupService, CommonLabel, ComponentContainer, ComponentManager, DesktopContextMenu as ContextMenu, ContextMenuGroup, ContextMenuHostService, ContextMenuPanel, ContextMenuPosition, ContextMenuService, CopyCommand, CopyShortcutItem, CustomLabel, CutCommand, CutShortcutItem, DISABLE_AUTO_FOCUS_KEY, DesktopBeforeCloseService, DesktopConfirmService, DesktopDialogService, DesktopGalleryService,
|
|
7914
|
+
export { AnchoredContextMenu, BrowserClipboardService, BuiltInUIPart, COLOR_PICKER_COMPONENT, COMMON_LABEL_COMPONENT, CanvasFloatDomService, CanvasPopup, CanvasPopupService, CommonLabel, ComponentContainer, ComponentManager, DesktopContextMenu as ContextMenu, ContextMenuGroup, ContextMenuHostService, ContextMenuPanel, ContextMenuPosition, ContextMenuService, CopyCommand, CopyShortcutItem, CustomLabel, CutCommand, CutShortcutItem, DISABLE_AUTO_FOCUS_KEY, DesktopBeforeCloseService, DesktopConfirmService, DesktopDialogService, DesktopGalleryService, DesktopLayoutService, DesktopLocalFileService, DesktopLocalStorageService, DesktopMessageService, DesktopNotificationService, DesktopRibbonService, DesktopSidebarService, DesktopUIController, DesktopZenZoneService, ErrorController, FILE_PNG_CLIPBOARD_MIME_TYPE, FILE_SVG_XML_CLIPBOARD_MIME_TYPE, FILE__BMP_CLIPBOARD_MIME_TYPE, FILE__JPEG_CLIPBOARD_MIME_TYPE, FILE__WEBP_CLIPBOARD_MIME_TYPE, FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT, FONT_SIZE_COMPONENT, FONT_SIZE_LIST, FloatDom, FloatDomSingle, FontFamily, FontFamilyItem, FontSize, HEADING_ITEM_COMPONENT, HEADING_LIST, HTML_CLIPBOARD_MIME_TYPE, HeadingItem, IBeforeCloseService, ICanvasPopupService, IClipboardInterfaceService, IContextMenuHostService, IContextMenuService, IDialogService, IFontService, IGalleryService, ILayoutService, ILeftSidebarService, ILocalFileService, IMenuManagerService, IMessageService, INotificationService, IPlatformService, IRibbonService, IShortcutService, ISidebarService, IUIController, IUIPartsService, IZenZoneService, KeyCode, MenuItemType, MenuManagerPosition, MenuManagerService, MetaKeys, MobileContextMenu, MockMessageService, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, PasteCommand, PlatformService, PrintFloatDomSingle, ProgressBar, RectPopup, RediConsumer, RediContext, RediProvider, RedoShortcutItem, Ribbon, RibbonDataGroup, RibbonFormulasGroup, RibbonInsertGroup, RibbonOthersGroup, RibbonPosition, RibbonStartGroup, RibbonViewGroup, SharedController, SheetPasteShortKeyCommandName, ShortcutPanelController, ShortcutPanelService, ShortcutService, Sidebar, SingleCanvasPopup, SingleUnitUIController, Slider, ThemeSwitcherService, ToggleShortcutPanelOperation, ToolbarButton, ToolbarItem, menuSchema as UIMenuSchema, UIPartsService, UI_PLUGIN_CONFIG_KEY, UNI_DISABLE_CHANGING_FOCUS_KEY, UndoShortcutItem, UniverMobileUIPlugin, UniverUIPlugin, WithDependency, ZIndexManager, ZenZone, connectDependencies, connectInjector, getHeaderFooterMenuHiddenObservable, getMenuHiddenObservable, handelExcelToJson, handelTableToJson, handleDomToJson, handlePlainToJson, handleStringToStyle, handleTableColgroup, handleTableMergeData, handleTableRowGroup, imageMimeTypeSet, mergeMenuConfigs, parseHtmlDocument, parseHtmlFragment, sanitizeParsedHtml, splitSpanText, supportClipboardAPI, t, textTrim, useClickOutSide, useComponentsOfPart, useConfigValue, useDebounceFn, useDependency, useEvent, useInjector, useObservable, useObservableRef, useScrollYOverContainer, useSidebarClick, useToolbarItemStatus, useUpdateBinder, useUpdateEffect, useVirtualList };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -53,8 +53,6 @@ export { CanvasFloatDomService, type IFloatDom, type IFloatDomLayout } from './s
|
|
|
53
53
|
export { type IFontConfig, IFontService } from './services/font.service';
|
|
54
54
|
export { DesktopGalleryService } from './services/gallery/desktop-gallery.service';
|
|
55
55
|
export { IGalleryService } from './services/gallery/gallery.service';
|
|
56
|
-
export { DesktopGlobalZoneService } from './services/global-zone/desktop-global-zone.service';
|
|
57
|
-
export { IGlobalZoneService } from './services/global-zone/global-zone.service';
|
|
58
56
|
export { DesktopLayoutService, ILayoutService } from './services/layout/layout.service';
|
|
59
57
|
export { DesktopLocalFileService } from './services/local-file/desktop-local-file.service';
|
|
60
58
|
export { ILocalFileService, type IOpenFileOptions } from './services/local-file/local-file.service';
|
|
@@ -93,7 +91,6 @@ export { type IDialogPartMethodOptions } from './views/components/dialog-part/in
|
|
|
93
91
|
export { FloatDomSingle } from './views/components/dom/FloatDom';
|
|
94
92
|
export { FloatDom } from './views/components/dom/FloatDom';
|
|
95
93
|
export { PrintFloatDomSingle } from './views/components/dom/Print';
|
|
96
|
-
export { GlobalZone } from './views/components/global-zone/GlobalZone';
|
|
97
94
|
export { CanvasPopup, SingleCanvasPopup } from './views/components/popup/CanvasPopup';
|
|
98
95
|
export { RectPopup, type RectPopupDirection } from './views/components/popup/RectPopup';
|
|
99
96
|
export { useToolbarItemStatus } from './views/components/ribbon/hook';
|
|
@@ -24,8 +24,11 @@ export declare class DesktopSidebarService extends Disposable implements ISideba
|
|
|
24
24
|
readonly scrollEvent$: Subject<Event>;
|
|
25
25
|
private _container?;
|
|
26
26
|
private _openAnimationFrameId;
|
|
27
|
+
private _width?;
|
|
27
28
|
get visible(): boolean;
|
|
28
29
|
get options(): ISidebarMethodOptions;
|
|
30
|
+
get width(): number | undefined;
|
|
31
|
+
setWidth(value: number): void;
|
|
29
32
|
dispose(): void;
|
|
30
33
|
private _clearPendingOpenFrame;
|
|
31
34
|
open(params: ISidebarMethodOptions): IDisposable;
|
|
@@ -25,6 +25,8 @@ export interface ISidebarService {
|
|
|
25
25
|
get options(): ISidebarMethodOptions;
|
|
26
26
|
getContainer(): HTMLElement | undefined;
|
|
27
27
|
setContainer(element?: HTMLElement): void;
|
|
28
|
+
get width(): number | undefined;
|
|
29
|
+
setWidth(value: number): void;
|
|
28
30
|
}
|
|
29
31
|
export declare const ILeftSidebarService: import("@wendellhu/redi").IdentifierDecorator<ISidebarService>;
|
|
30
32
|
export declare const ISidebarService: import("@wendellhu/redi").IdentifierDecorator<ISidebarService>;
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(require(`@univerjs/core/facade`),require(`@univerjs/engine-render`),require(`@univerjs/ui`),require(`@univerjs/core`)):typeof define==`function`&&define.amd?define([`@univerjs/core/facade`,`@univerjs/engine-render`,`@univerjs/ui`,`@univerjs/core`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverCoreFacade,e.UniverEngineRender,e.UniverUi,e.UniverCore))})(this,function(e,t,n,r){function i(e){"@babel/helpers - typeof";return i=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},i(e)}function a(e,t){if(i(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(i(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function o(e){var t=a(e,`string`);return i(t)==`symbol`?t:t+``}function s(e,t,n){return(t=o(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){return function(n,r){t(n,r,e)}}function l(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var u=class extends e.FBase{appendTo(e){let t=typeof e==`string`?e.split(`|`):e,n=t.length,r={},i=r,a=this.__getSchema();t.forEach((e,t)=>{t===n-1?i[e]=a:i[e]={},i=i[e]}),this._menuManagerService.mergeMenu(r)}};let d=class extends u{constructor(e,t,i,a){super(),this._item=e,this._injector=t,this._commandService=i,this._menuManagerService=a,s(this,`_commandToRegister`,new Map),s(this,`_buildingSchema`,void 0);let o=typeof e.action==`string`?e.action:(0,r.generateRandomId)(12);o!==e.action&&this._commandToRegister.set(o,e.action),this._buildingSchema={menuItemFactory:()=>({id:e.id,type:n.MenuItemType.BUTTON,icon:e.icon,title:e.title,tooltip:e.tooltip,commandId:o})},e.order!==void 0&&(this._buildingSchema.order=e.order)}__getSchema(){return this._commandToRegister.forEach((e,t)=>{this._commandService.hasCommand(t)||this._commandService.registerCommand({id:t,type:r.CommandType.COMMAND,handler:e})}),{[this._item.id]:this._buildingSchema}}};s(d,`RibbonStartGroup`,n.RibbonStartGroup),s(d,`RibbonPosition`,n.RibbonPosition),s(d,`MenuManagerPosition`,n.MenuManagerPosition),d=l([c(1,(0,r.Inject)(r.Injector)),c(2,r.ICommandService),c(3,n.IMenuManagerService)],d);let f=class extends u{constructor(e,t,r){super(),this._item=e,this._injector=t,this._menuManagerService=r,s(this,`_menuByGroups`,[]),s(this,`_submenus`,[]),s(this,`_buildingSchema`,void 0),this._buildingSchema={menuItemFactory:()=>({id:e.id,type:n.MenuItemType.SUBITEMS,icon:e.icon,title:e.title,tooltip:e.tooltip})},e.order!==void 0&&(this._buildingSchema.order=e.order)}addSubmenu(e){return this._submenus.push(e),this}addSeparator(){return this._menuByGroups.push(this._submenus),this._submenus=[],this}__getSchema(){let e={};return this.addSeparator(),this._menuByGroups.forEach((t,n)=>{let r={};t.forEach(e=>{Object.assign(r,e.__getSchema())}),e[`${this._item.id}-group-${n}`]=r}),{[this._item.id]:Object.assign(this._buildingSchema,e)}}};f=l([c(1,(0,r.Inject)(r.Injector)),c(2,n.IMenuManagerService)],f);let p=class extends e.FBase{constructor(e,t,n,r){super(),this._injector=e,this._renderManagerService=t,this._univerInstanceService=n,this._shortcutService=r,s(this,`_forceDisableDisposable`,null)}enableShortcut(){var e;return(e=this._forceDisableDisposable)==null||e.dispose(),this._forceDisableDisposable=null,this}disableShortcut(){return this._forceDisableDisposable||(this._forceDisableDisposable=this._shortcutService.forceDisable()),this}triggerShortcut(e){let t=this._univerInstanceService.
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(require(`@univerjs/core/facade`),require(`@univerjs/engine-render`),require(`@univerjs/ui`),require(`@univerjs/core`)):typeof define==`function`&&define.amd?define([`@univerjs/core/facade`,`@univerjs/engine-render`,`@univerjs/ui`,`@univerjs/core`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverCoreFacade,e.UniverEngineRender,e.UniverUi,e.UniverCore))})(this,function(e,t,n,r){function i(e){"@babel/helpers - typeof";return i=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},i(e)}function a(e,t){if(i(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(i(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function o(e){var t=a(e,`string`);return i(t)==`symbol`?t:t+``}function s(e,t,n){return(t=o(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){return function(n,r){t(n,r,e)}}function l(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var u=class extends e.FBase{appendTo(e){let t=typeof e==`string`?e.split(`|`):e,n=t.length,r={},i=r,a=this.__getSchema();t.forEach((e,t)=>{t===n-1?i[e]=a:i[e]={},i=i[e]}),this._menuManagerService.mergeMenu(r)}};let d=class extends u{constructor(e,t,i,a){super(),this._item=e,this._injector=t,this._commandService=i,this._menuManagerService=a,s(this,`_commandToRegister`,new Map),s(this,`_buildingSchema`,void 0);let o=typeof e.action==`string`?e.action:(0,r.generateRandomId)(12);o!==e.action&&this._commandToRegister.set(o,e.action),this._buildingSchema={menuItemFactory:()=>({id:e.id,type:n.MenuItemType.BUTTON,icon:e.icon,title:e.title,tooltip:e.tooltip,commandId:o})},e.order!==void 0&&(this._buildingSchema.order=e.order)}__getSchema(){return this._commandToRegister.forEach((e,t)=>{this._commandService.hasCommand(t)||this._commandService.registerCommand({id:t,type:r.CommandType.COMMAND,handler:e})}),{[this._item.id]:this._buildingSchema}}};s(d,`RibbonStartGroup`,n.RibbonStartGroup),s(d,`RibbonPosition`,n.RibbonPosition),s(d,`MenuManagerPosition`,n.MenuManagerPosition),d=l([c(1,(0,r.Inject)(r.Injector)),c(2,r.ICommandService),c(3,n.IMenuManagerService)],d);let f=class extends u{constructor(e,t,r){super(),this._item=e,this._injector=t,this._menuManagerService=r,s(this,`_menuByGroups`,[]),s(this,`_submenus`,[]),s(this,`_buildingSchema`,void 0),this._buildingSchema={menuItemFactory:()=>({id:e.id,type:n.MenuItemType.SUBITEMS,icon:e.icon,title:e.title,tooltip:e.tooltip})},e.order!==void 0&&(this._buildingSchema.order=e.order)}addSubmenu(e){return this._submenus.push(e),this}addSeparator(){return this._menuByGroups.push(this._submenus),this._submenus=[],this}__getSchema(){let e={};return this.addSeparator(),this._menuByGroups.forEach((t,n)=>{let r={};t.forEach(e=>{Object.assign(r,e.__getSchema())}),e[`${this._item.id}-group-${n}`]=r}),{[this._item.id]:Object.assign(this._buildingSchema,e)}}};f=l([c(1,(0,r.Inject)(r.Injector)),c(2,n.IMenuManagerService)],f);let p=class extends e.FBase{constructor(e,t,n,r){super(),this._injector=e,this._renderManagerService=t,this._univerInstanceService=n,this._shortcutService=r,s(this,`_forceDisableDisposable`,null)}enableShortcut(){var e;return(e=this._forceDisableDisposable)==null||e.dispose(),this._forceDisableDisposable=null,this}disableShortcut(){return this._forceDisableDisposable||(this._forceDisableDisposable=this._shortcutService.forceDisable()),this}triggerShortcut(e){let t=this._univerInstanceService.getCurrentUnitOfType(r.UniverInstanceType.UNIVER_SHEET);if(!t)return;let n=this._renderManagerService.getRenderById(t.getUnitId());if(n)return n.engine.getCanvasElement().dispatchEvent(e),this._shortcutService.dispatch(e)}dispatchShortcutEvent(e){return this._shortcutService.dispatch(e)}};p=l([c(0,(0,r.Inject)(r.Injector)),c(1,(0,r.Inject)(t.IRenderManagerService)),c(2,r.IUniverInstanceService),c(3,n.IShortcutService)],p);var m=class extends e.FUniver{getURL(){return new URL(window.location.href)}getShortcut(){return this._injector.createInstance(p)}copy(){return this._commandService.executeCommand(n.CopyCommand.id)}paste(){return this._commandService.executeCommand(n.PasteCommand.id)}createMenu(e){return this._injector.createInstance(d,e)}createSubmenu(e){return this._injector.createInstance(f,e)}openSiderbar(e){return this._injector.get(n.ISidebarService).open(e)}openSidebar(e){return this.openSiderbar(e)}openDialog(e){let t=this._injector.get(n.IDialogService).open({...e,onClose:()=>{t.dispose()}});return t}getComponentManager(){return this._injector.get(n.ComponentManager)}showMessage(e){return this._injector.get(n.IMessageService).show(e),this}setUIVisible(e,t){return this._injector.get(n.IUIPartsService).setUIVisible(e,t),this}isUIVisible(e){return this._injector.get(n.IUIPartsService).isUIVisible(e)}registerUIPart(e,t){return this._injector.get(n.IUIPartsService).registerComponent(e,()=>(0,n.connectInjector)(t,this._injector))}registerComponent(e,t,r){let i=this._injector.get(n.ComponentManager);return this.disposeWithMe(i.register(e,t,r))}setCurrent(e){if(!this._injector.get(t.IRenderManagerService).getRenderById(e))throw Error(`Unit not found`);this._univerInstanceService.setCurrentUnitForType(e)}addFonts(e){let t=this._injector.get(n.IFontService);e.forEach(e=>{t.addFont(e)})}};e.FUniver.extend(m);var h=class extends e.FHooks{onBeforeCopy(e){return this._injector.get(r.ICommandService).beforeCommandExecuted(t=>{t.id===n.CopyCommand.id&&e()})}onCopy(e){return this._injector.get(r.ICommandService).onCommandExecuted(t=>{t.id===n.CopyCommand.id&&e()})}onBeforePaste(e){return this._injector.get(r.ICommandService).beforeCommandExecuted(t=>{t.id===n.PasteCommand.id&&e()})}onPaste(e){return this._injector.get(r.ICommandService).onCommandExecuted(t=>{(t.id===n.PasteCommand.id||t.id===n.SheetPasteShortKeyCommandName)&&e()})}};e.FHooks.extend(h);var g=class extends e.FEnum{get BuiltInUIPart(){return n.BuiltInUIPart}get KeyCode(){return n.KeyCode}};e.FEnum.extend(g)});
|