@univerjs/ui 1.4.0 → 1.5.1
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/README.md +7 -19
- package/lib/cjs/facade.js +11 -11
- package/lib/cjs/index.js +425 -201
- package/lib/es/facade.js +11 -11
- package/lib/es/index.js +419 -200
- package/lib/facade.js +11 -11
- package/lib/index.css +8 -28
- package/lib/index.js +419 -200
- package/lib/types/mobile-plugin.d.ts +1 -1
- package/lib/types/plugin.d.ts +1 -1
- package/lib/types/services/contextmenu/contextmenu-host.service.d.ts +15 -2
- package/lib/types/services/dialog/desktop-dialog.service.d.ts +5 -3
- package/lib/types/services/dialog/mobile-dialog.service.d.ts +2 -1
- package/lib/types/services/dom/canvas-dom-layer.service.d.ts +4 -0
- package/lib/types/services/sidebar/desktop-sidebar.service.d.ts +5 -2
- package/lib/types/utils/use-menu-host.d.ts +17 -0
- package/lib/types/views/object-permission/ObjectPermissionPanel.d.ts +1 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +19 -19
- package/package.json +9 -9
package/lib/cjs/index.js
CHANGED
|
@@ -55,7 +55,7 @@ function getAttributeValue(target, name) {
|
|
|
55
55
|
return typeof getAttribute === "function" ? getAttribute.call(target, name) ?? void 0 : void 0;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
// \0@oxc-project+runtime@0.
|
|
58
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/typeof.js
|
|
59
59
|
function _typeof(o) {
|
|
60
60
|
"@babel/helpers - typeof";
|
|
61
61
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -65,25 +65,25 @@ function _typeof(o) {
|
|
|
65
65
|
}, _typeof(o);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
// \0@oxc-project+runtime@0.
|
|
69
|
-
function toPrimitive(t,
|
|
68
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/toPrimitive.js
|
|
69
|
+
function toPrimitive(t, e) {
|
|
70
70
|
if ("object" != _typeof(t) || !t) return t;
|
|
71
|
-
var
|
|
72
|
-
if (void 0 !==
|
|
73
|
-
var i =
|
|
71
|
+
var r;
|
|
72
|
+
if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
|
|
73
|
+
var i = r.call(t, e || "default");
|
|
74
74
|
if ("object" != _typeof(i)) return i;
|
|
75
75
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
76
76
|
}
|
|
77
|
-
return ("string" ===
|
|
77
|
+
return ("string" === e ? String : Number)(t);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
// \0@oxc-project+runtime@0.
|
|
80
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/toPropertyKey.js
|
|
81
81
|
function toPropertyKey(t) {
|
|
82
82
|
var i = toPrimitive(t, "string");
|
|
83
83
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
// \0@oxc-project+runtime@0.
|
|
86
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/defineProperty.js
|
|
87
87
|
function _defineProperty(e, r, t) {
|
|
88
88
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
89
89
|
value: t,
|
|
@@ -93,14 +93,14 @@ function _defineProperty(e, r, t) {
|
|
|
93
93
|
}) : e[r] = t, e;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
// \0@oxc-project+runtime@0.
|
|
96
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/decorateParam.js
|
|
97
97
|
function __decorateParam(paramIndex, decorator) {
|
|
98
98
|
return function(target, key) {
|
|
99
99
|
decorator(target, key, paramIndex);
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
// \0@oxc-project+runtime@0.
|
|
103
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/decorate.js
|
|
104
104
|
function __decorate(decorators, target, key, desc) {
|
|
105
105
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
106
106
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -112,7 +112,6 @@ function __decorate(decorators, target, key, desc) {
|
|
|
112
112
|
const FOCUSING_UNIVER = "FOCUSING_UNIVER";
|
|
113
113
|
const givingBackFocusElements = [
|
|
114
114
|
"app-layout",
|
|
115
|
-
"button",
|
|
116
115
|
"sheet-bar-append-button",
|
|
117
116
|
"render-canvas",
|
|
118
117
|
"workbench-layout"
|
|
@@ -1082,6 +1081,7 @@ let ShortcutService = class ShortcutService extends _univerjs_core.Disposable {
|
|
|
1082
1081
|
}
|
|
1083
1082
|
dispatch(e) {
|
|
1084
1083
|
if (e.isComposing) return;
|
|
1084
|
+
if (!e.ctrlKey && !e.metaKey && !e.altKey && e.target instanceof HTMLButtonElement && (e.key === "Enter" || e.key === " " || e.key === "Tab")) return;
|
|
1085
1085
|
if (e.target instanceof HTMLInputElement && e.target.closest("[data-u-command]")) return;
|
|
1086
1086
|
if (!e.ctrlKey && !e.metaKey && !e.altKey && MENU_NAVIGATION_KEYS.has(e.keyCode) && e.target instanceof HTMLElement && (e.target.matches("button[data-u-command], [data-u-command][role=\"button\"], [data-embed-floating-menu=\"true\"] button, [data-u-command] input") || e.target.closest("[role=\"menu\"]"))) return;
|
|
1087
1087
|
if (this._forceEscapeCount > 0 || this._forceDisabled) return;
|
|
@@ -2654,6 +2654,51 @@ var CanvasFloatDomPreviewService = class extends _univerjs_core.Disposable {
|
|
|
2654
2654
|
}
|
|
2655
2655
|
};
|
|
2656
2656
|
|
|
2657
|
+
// src/views/hooks/prevent-browser-zoom.ts
|
|
2658
|
+
/**
|
|
2659
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2660
|
+
*
|
|
2661
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2662
|
+
* you may not use this file except in compliance with the License.
|
|
2663
|
+
* You may obtain a copy of the License at
|
|
2664
|
+
*
|
|
2665
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2666
|
+
*
|
|
2667
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2668
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2669
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2670
|
+
* See the License for the specific language governing permissions and
|
|
2671
|
+
* limitations under the License.
|
|
2672
|
+
*/
|
|
2673
|
+
function preventBrowserZoomInContainers(containers) {
|
|
2674
|
+
const uniqueContainers = new Set(containers);
|
|
2675
|
+
const handleWheel = (event) => {
|
|
2676
|
+
if (event.ctrlKey || event.metaKey) event.preventDefault();
|
|
2677
|
+
};
|
|
2678
|
+
const handleGesture = (event) => event.preventDefault();
|
|
2679
|
+
uniqueContainers.forEach((container) => {
|
|
2680
|
+
container.addEventListener("wheel", handleWheel, {
|
|
2681
|
+
capture: true,
|
|
2682
|
+
passive: false
|
|
2683
|
+
});
|
|
2684
|
+
container.addEventListener("gesturestart", handleGesture, {
|
|
2685
|
+
capture: true,
|
|
2686
|
+
passive: false
|
|
2687
|
+
});
|
|
2688
|
+
container.addEventListener("gesturechange", handleGesture, {
|
|
2689
|
+
capture: true,
|
|
2690
|
+
passive: false
|
|
2691
|
+
});
|
|
2692
|
+
});
|
|
2693
|
+
return () => {
|
|
2694
|
+
uniqueContainers.forEach((container) => {
|
|
2695
|
+
container.removeEventListener("wheel", handleWheel, true);
|
|
2696
|
+
container.removeEventListener("gesturestart", handleGesture, true);
|
|
2697
|
+
container.removeEventListener("gesturechange", handleGesture, true);
|
|
2698
|
+
});
|
|
2699
|
+
};
|
|
2700
|
+
}
|
|
2701
|
+
|
|
2657
2702
|
// src/views/components/dom/float-dom-layout.ts
|
|
2658
2703
|
const LEGACY_WRAPPER_INSET = 2;
|
|
2659
2704
|
const LEGACY_CONTENT_INSET = 4;
|
|
@@ -2735,6 +2780,13 @@ function FloatDomSingleContent(props) {
|
|
|
2735
2780
|
const wrapperInset = (_layer$contentBox = layer.contentBox) === null || _layer$contentBox === void 0 ? void 0 : _layer$contentBox.wrapperInset;
|
|
2736
2781
|
const contentInset = (_layer$contentBox2 = layer.contentBox) === null || _layer$contentBox2 === void 0 ? void 0 : _layer$contentBox2.contentInset;
|
|
2737
2782
|
const forwardEvents = shouldForwardFloatDomEvents(layer);
|
|
2783
|
+
(0, react.useEffect)(() => {
|
|
2784
|
+
if (forwardEvents && layer.preventBrowserZoom && domRef.current) return preventBrowserZoomInContainers([domRef.current]);
|
|
2785
|
+
}, [
|
|
2786
|
+
forwardEvents,
|
|
2787
|
+
layer.preventBrowserZoom,
|
|
2788
|
+
position
|
|
2789
|
+
]);
|
|
2738
2790
|
(0, react.useEffect)(() => {
|
|
2739
2791
|
const subscription = layer.position$.subscribe((position) => {
|
|
2740
2792
|
if (domRef.current && innerDomRef.current) applyFloatDomLayout(domRef.current, innerDomRef.current, resolveFloatDomLayout(position, {
|
|
@@ -2750,6 +2802,48 @@ function FloatDomSingleContent(props) {
|
|
|
2750
2802
|
layer.position$,
|
|
2751
2803
|
wrapperInset
|
|
2752
2804
|
]);
|
|
2805
|
+
const eventHandlers = (0, react.useMemo)(() => ({
|
|
2806
|
+
wheel: (event) => layer.onWheel(event),
|
|
2807
|
+
pointermove: (event) => layer.onPointerMove(event),
|
|
2808
|
+
pointerdown: (event) => {
|
|
2809
|
+
layer.onPointerDown(event);
|
|
2810
|
+
if (event.target instanceof Element && event.target.isConnected) {
|
|
2811
|
+
var _event$target$setPoin, _event$target;
|
|
2812
|
+
(_event$target$setPoin = (_event$target = event.target).setPointerCapture) === null || _event$target$setPoin === void 0 || _event$target$setPoin.call(_event$target, event.pointerId);
|
|
2813
|
+
}
|
|
2814
|
+
},
|
|
2815
|
+
pointerup: (event) => {
|
|
2816
|
+
try {
|
|
2817
|
+
layer.onPointerUp(event);
|
|
2818
|
+
} finally {
|
|
2819
|
+
var _event$target$hasPoin, _event$target2;
|
|
2820
|
+
if (event.target instanceof Element && ((_event$target$hasPoin = (_event$target2 = event.target).hasPointerCapture) === null || _event$target$hasPoin === void 0 ? void 0 : _event$target$hasPoin.call(_event$target2, event.pointerId))) {
|
|
2821
|
+
var _event$target$release, _event$target3;
|
|
2822
|
+
(_event$target$release = (_event$target3 = event.target).releasePointerCapture) === null || _event$target$release === void 0 || _event$target$release.call(_event$target3, event.pointerId);
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
}
|
|
2826
|
+
}), [layer]);
|
|
2827
|
+
(0, react.useEffect)(() => {
|
|
2828
|
+
const wrapper = domRef.current;
|
|
2829
|
+
if (!forwardEvents || !wrapper || !layer.eventOptions) return;
|
|
2830
|
+
const cleanups = [];
|
|
2831
|
+
const bindEvent = (eventName) => {
|
|
2832
|
+
var _layer$eventOptions;
|
|
2833
|
+
const options = (_layer$eventOptions = layer.eventOptions) === null || _layer$eventOptions === void 0 ? void 0 : _layer$eventOptions[eventName];
|
|
2834
|
+
if (options === void 0) return;
|
|
2835
|
+
const listener = eventHandlers[eventName];
|
|
2836
|
+
wrapper.addEventListener(eventName, listener, options);
|
|
2837
|
+
cleanups.push(() => wrapper.removeEventListener(eventName, listener, options.capture));
|
|
2838
|
+
};
|
|
2839
|
+
for (const eventName of Object.keys(layer.eventOptions)) bindEvent(eventName);
|
|
2840
|
+
return () => cleanups.forEach((cleanup) => cleanup());
|
|
2841
|
+
}, [
|
|
2842
|
+
forwardEvents,
|
|
2843
|
+
eventHandlers,
|
|
2844
|
+
layer.eventOptions,
|
|
2845
|
+
position
|
|
2846
|
+
]);
|
|
2753
2847
|
const instance = univerInstanceService.getUnit(layer.unitId);
|
|
2754
2848
|
const docDisabled = instance instanceof _univerjs_core.DocumentDataModel ? instance.getDisabled() : void 0;
|
|
2755
2849
|
const component = (0, react.useMemo)(() => Component ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
|
|
@@ -2772,44 +2866,24 @@ function FloatDomSingleContent(props) {
|
|
|
2772
2866
|
overflow: floatDomOverflow.outerOverflow,
|
|
2773
2867
|
touchAction: forwardEvents ? "none" : void 0
|
|
2774
2868
|
},
|
|
2775
|
-
|
|
2776
|
-
|
|
2869
|
+
onWheel: (event) => {
|
|
2870
|
+
var _layer$eventOptions2;
|
|
2871
|
+
if (forwardEvents && ((_layer$eventOptions2 = layer.eventOptions) === null || _layer$eventOptions2 === void 0 ? void 0 : _layer$eventOptions2.wheel) === void 0) eventHandlers.wheel(event.nativeEvent);
|
|
2777
2872
|
},
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
var _e$target$setPointerC, _e$target;
|
|
2782
|
-
(_e$target$setPointerC = (_e$target = e.target).setPointerCapture) === null || _e$target$setPointerC === void 0 || _e$target$setPointerC.call(_e$target, e.pointerId);
|
|
2783
|
-
}
|
|
2784
|
-
layer.onPointerDown(e.nativeEvent);
|
|
2785
|
-
}
|
|
2873
|
+
onPointerMove: (event) => {
|
|
2874
|
+
var _layer$eventOptions3;
|
|
2875
|
+
if (forwardEvents && ((_layer$eventOptions3 = layer.eventOptions) === null || _layer$eventOptions3 === void 0 ? void 0 : _layer$eventOptions3.pointermove) === void 0) eventHandlers.pointermove(event.nativeEvent);
|
|
2786
2876
|
},
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
layer.onPointerUp(e.nativeEvent);
|
|
2791
|
-
} finally {
|
|
2792
|
-
var _e$target$hasPointerC, _e$target2;
|
|
2793
|
-
if (e.target instanceof Element && ((_e$target$hasPointerC = (_e$target2 = e.target).hasPointerCapture) === null || _e$target$hasPointerC === void 0 ? void 0 : _e$target$hasPointerC.call(_e$target2, e.pointerId))) {
|
|
2794
|
-
var _e$target$releasePoin, _e$target3;
|
|
2795
|
-
(_e$target$releasePoin = (_e$target3 = e.target).releasePointerCapture) === null || _e$target$releasePoin === void 0 || _e$target$releasePoin.call(_e$target3, e.pointerId);
|
|
2796
|
-
}
|
|
2797
|
-
}
|
|
2877
|
+
onPointerDown: (event) => {
|
|
2878
|
+
var _layer$eventOptions4;
|
|
2879
|
+
if (forwardEvents && ((_layer$eventOptions4 = layer.eventOptions) === null || _layer$eventOptions4 === void 0 ? void 0 : _layer$eventOptions4.pointerdown) === void 0) eventHandlers.pointerdown(event.nativeEvent);
|
|
2798
2880
|
},
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
layer.onPointerUp(e.nativeEvent);
|
|
2803
|
-
} finally {
|
|
2804
|
-
var _e$target$hasPointerC2, _e$target4;
|
|
2805
|
-
if (e.target instanceof Element && ((_e$target$hasPointerC2 = (_e$target4 = e.target).hasPointerCapture) === null || _e$target$hasPointerC2 === void 0 ? void 0 : _e$target$hasPointerC2.call(_e$target4, e.pointerId))) {
|
|
2806
|
-
var _e$target$releasePoin2, _e$target5;
|
|
2807
|
-
(_e$target$releasePoin2 = (_e$target5 = e.target).releasePointerCapture) === null || _e$target$releasePoin2 === void 0 || _e$target$releasePoin2.call(_e$target5, e.pointerId);
|
|
2808
|
-
}
|
|
2809
|
-
}
|
|
2881
|
+
onPointerUp: (event) => {
|
|
2882
|
+
var _layer$eventOptions5;
|
|
2883
|
+
if (forwardEvents && ((_layer$eventOptions5 = layer.eventOptions) === null || _layer$eventOptions5 === void 0 ? void 0 : _layer$eventOptions5.pointerup) === void 0) eventHandlers.pointerup(event.nativeEvent);
|
|
2810
2884
|
},
|
|
2811
|
-
|
|
2812
|
-
if (forwardEvents)
|
|
2885
|
+
onPointerCancel: (event) => {
|
|
2886
|
+
if (forwardEvents) eventHandlers.pointerup(event.nativeEvent);
|
|
2813
2887
|
},
|
|
2814
2888
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2815
2889
|
id,
|
|
@@ -3542,6 +3616,107 @@ function getCells(row, column, rowSpan, columnSpan) {
|
|
|
3542
3616
|
return cells;
|
|
3543
3617
|
}
|
|
3544
3618
|
|
|
3619
|
+
// src/services/contextmenu/contextmenu-host.service.ts
|
|
3620
|
+
const IContextMenuHostService = (0, _univerjs_core.createIdentifier)("ui.contextmenu.host.service");
|
|
3621
|
+
var ContextMenuHostService = class extends _univerjs_core.Disposable {
|
|
3622
|
+
constructor(..._args) {
|
|
3623
|
+
super(..._args);
|
|
3624
|
+
_defineProperty(this, "_menuMap", /* @__PURE__ */ new Map());
|
|
3625
|
+
_defineProperty(this, "_activeMenuId$", new rxjs.BehaviorSubject(null));
|
|
3626
|
+
_defineProperty(this, "_suspensions", /* @__PURE__ */ new Set());
|
|
3627
|
+
_defineProperty(this, "_revision", 0);
|
|
3628
|
+
_defineProperty(this, "activeMenuId$", this._activeMenuId$.asObservable());
|
|
3629
|
+
}
|
|
3630
|
+
get activeMenuId() {
|
|
3631
|
+
return this._activeMenuId$.value;
|
|
3632
|
+
}
|
|
3633
|
+
get revision() {
|
|
3634
|
+
return this._revision;
|
|
3635
|
+
}
|
|
3636
|
+
get suspended() {
|
|
3637
|
+
return this._disposed || this._suspensions.size > 0;
|
|
3638
|
+
}
|
|
3639
|
+
registerMenu(menuId, hide) {
|
|
3640
|
+
this.ensureNotDisposed();
|
|
3641
|
+
this._menuMap.set(menuId, hide);
|
|
3642
|
+
return (0, _univerjs_core.toDisposable)(() => {
|
|
3643
|
+
this._menuMap.delete(menuId);
|
|
3644
|
+
if (this.activeMenuId === menuId) this._activeMenuId$.next(null);
|
|
3645
|
+
});
|
|
3646
|
+
}
|
|
3647
|
+
activateMenu(menuId) {
|
|
3648
|
+
if (this.suspended) return;
|
|
3649
|
+
this.hideActiveMenu(menuId);
|
|
3650
|
+
this._activeMenuId$.next(menuId);
|
|
3651
|
+
}
|
|
3652
|
+
deactivateMenu(menuId) {
|
|
3653
|
+
if (this.activeMenuId === menuId) this._activeMenuId$.next(null);
|
|
3654
|
+
}
|
|
3655
|
+
hideActiveMenu(exceptMenuId) {
|
|
3656
|
+
const activeMenuId = this.activeMenuId;
|
|
3657
|
+
if (!activeMenuId || activeMenuId === exceptMenuId) return;
|
|
3658
|
+
const hide = this._menuMap.get(activeMenuId);
|
|
3659
|
+
this._activeMenuId$.next(null);
|
|
3660
|
+
hide === null || hide === void 0 || hide(true);
|
|
3661
|
+
}
|
|
3662
|
+
closeAll() {
|
|
3663
|
+
++this._revision;
|
|
3664
|
+
this._activeMenuId$.next(null);
|
|
3665
|
+
Array.from(this._menuMap.values()).forEach((hide) => hide(false));
|
|
3666
|
+
}
|
|
3667
|
+
suspend() {
|
|
3668
|
+
this.ensureNotDisposed();
|
|
3669
|
+
const token = Symbol("menu-suspension");
|
|
3670
|
+
this._suspensions.add(token);
|
|
3671
|
+
try {
|
|
3672
|
+
this.closeAll();
|
|
3673
|
+
} catch (error) {
|
|
3674
|
+
this._suspensions.delete(token);
|
|
3675
|
+
throw error;
|
|
3676
|
+
}
|
|
3677
|
+
return (0, _univerjs_core.toDisposable)(() => this._suspensions.delete(token));
|
|
3678
|
+
}
|
|
3679
|
+
dispose() {
|
|
3680
|
+
if (this._disposed) return;
|
|
3681
|
+
super.dispose();
|
|
3682
|
+
try {
|
|
3683
|
+
this.closeAll();
|
|
3684
|
+
} finally {
|
|
3685
|
+
this._menuMap.clear();
|
|
3686
|
+
this._suspensions.clear();
|
|
3687
|
+
this._activeMenuId$.complete();
|
|
3688
|
+
}
|
|
3689
|
+
}
|
|
3690
|
+
};
|
|
3691
|
+
|
|
3692
|
+
// src/utils/use-menu-host.ts
|
|
3693
|
+
/**
|
|
3694
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3695
|
+
*
|
|
3696
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3697
|
+
* you may not use this file except in compliance with the License.
|
|
3698
|
+
* You may obtain a copy of the License at
|
|
3699
|
+
*
|
|
3700
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3701
|
+
*
|
|
3702
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3703
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3704
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3705
|
+
* See the License for the specific language governing permissions and
|
|
3706
|
+
* limitations under the License.
|
|
3707
|
+
*/
|
|
3708
|
+
function useMenuHost(onClose) {
|
|
3709
|
+
const service = (0, _wendellhu_redi_react_bindings.useDependency)(IContextMenuHostService);
|
|
3710
|
+
const callbackRef = (0, react.useRef)(onClose);
|
|
3711
|
+
callbackRef.current = onClose;
|
|
3712
|
+
(0, react.useEffect)(() => {
|
|
3713
|
+
const registration = service.registerMenu(Symbol("menu"), () => callbackRef.current());
|
|
3714
|
+
if (service.suspended) callbackRef.current();
|
|
3715
|
+
return () => registration.dispose();
|
|
3716
|
+
}, [service]);
|
|
3717
|
+
return service;
|
|
3718
|
+
}
|
|
3719
|
+
|
|
3545
3720
|
// src/views/components/ribbon/ToolbarButton.tsx
|
|
3546
3721
|
/**
|
|
3547
3722
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
@@ -4096,16 +4271,34 @@ const TooltipWrapper = (0, react.forwardRef)((props, ref) => {
|
|
|
4096
4271
|
const [localDropdownVisible, setLocalDropdownVisible] = (0, react.useState)(false);
|
|
4097
4272
|
const toolbarDropdownContext = (0, react.useContext)(ToolbarDropdownContext);
|
|
4098
4273
|
const dropdownVisible = dropdownKey && toolbarDropdownContext ? toolbarDropdownContext.openDropdownKey === dropdownKey : localDropdownVisible;
|
|
4274
|
+
const menuHost = useMenuHost(() => {
|
|
4275
|
+
if (dropdownVisible) {
|
|
4276
|
+
triggerFocusRef.current = null;
|
|
4277
|
+
if (dropdownKey && toolbarDropdownContext) toolbarDropdownContext.setOpenDropdownKey(null);
|
|
4278
|
+
else setLocalDropdownVisible(false);
|
|
4279
|
+
}
|
|
4280
|
+
});
|
|
4281
|
+
const openRevisionRef = (0, react.useRef)(menuHost.revision);
|
|
4099
4282
|
const handleChangeDropdownVisible = (0, react.useCallback)((visible) => {
|
|
4100
4283
|
if (visible) {
|
|
4101
4284
|
var _spanRef$current, _spanRef$current2;
|
|
4285
|
+
if (menuHost.suspended) return;
|
|
4286
|
+
openRevisionRef.current = menuHost.revision;
|
|
4102
4287
|
const active = (_spanRef$current = spanRef.current) === null || _spanRef$current === void 0 ? void 0 : _spanRef$current.ownerDocument.activeElement;
|
|
4103
4288
|
triggerFocusRef.current = active instanceof HTMLElement && ((_spanRef$current2 = spanRef.current) === null || _spanRef$current2 === void 0 ? void 0 : _spanRef$current2.contains(active)) ? active : null;
|
|
4104
4289
|
}
|
|
4105
4290
|
if (dropdownKey && toolbarDropdownContext) toolbarDropdownContext.setOpenDropdownKey(visible ? dropdownKey : null);
|
|
4106
4291
|
else setLocalDropdownVisible(visible);
|
|
4107
|
-
}, [
|
|
4292
|
+
}, [
|
|
4293
|
+
dropdownKey,
|
|
4294
|
+
toolbarDropdownContext,
|
|
4295
|
+
menuHost
|
|
4296
|
+
]);
|
|
4108
4297
|
const restoreTriggerFocus = (0, react.useCallback)((event) => {
|
|
4298
|
+
if (openRevisionRef.current !== menuHost.revision || menuHost.suspended) {
|
|
4299
|
+
event.preventDefault();
|
|
4300
|
+
return;
|
|
4301
|
+
}
|
|
4109
4302
|
const trigger = triggerFocusRef.current;
|
|
4110
4303
|
triggerFocusRef.current = null;
|
|
4111
4304
|
if (!(trigger === null || trigger === void 0 ? void 0 : trigger.isConnected)) return;
|
|
@@ -4114,7 +4307,7 @@ const TooltipWrapper = (0, react.forwardRef)((props, ref) => {
|
|
|
4114
4307
|
event.preventDefault();
|
|
4115
4308
|
trigger.focus({ preventScroll: true });
|
|
4116
4309
|
}
|
|
4117
|
-
}, []);
|
|
4310
|
+
}, [menuHost]);
|
|
4118
4311
|
const contextValue = (0, react.useMemo)(() => ({
|
|
4119
4312
|
dropdownVisible,
|
|
4120
4313
|
setDropdownVisible: handleChangeDropdownVisible,
|
|
@@ -4221,6 +4414,8 @@ function DropdownMenuLabel({ icon, value, option, preserveStrokeWidth, onOptionS
|
|
|
4221
4414
|
}
|
|
4222
4415
|
function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled, preserveStrokeWidth, onOptionSelect, dropdownComponent, dropdownMenuComponent: DropdownMenuComponent = _univerjs_design.DropdownMenu }) {
|
|
4223
4416
|
const { dropdownVisible, setDropdownVisible, restoreTriggerFocus } = (0, react.useContext)(TooltipWrapperContext);
|
|
4417
|
+
const menuHost = (0, _wendellhu_redi_react_bindings.useDependency)(IContextMenuHostService);
|
|
4418
|
+
const openRevisionRef = (0, react.useRef)(menuHost.revision);
|
|
4224
4419
|
const shortcutService = (0, _wendellhu_redi_react_bindings.useDependency)(IShortcutService);
|
|
4225
4420
|
const contextService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.IContextService);
|
|
4226
4421
|
const instanceService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
@@ -4294,6 +4489,8 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
4294
4489
|
function handleVisibleChange(visible) {
|
|
4295
4490
|
if (visible) {
|
|
4296
4491
|
var _workbook$getActiveSh;
|
|
4492
|
+
if (menuHost.suspended) return;
|
|
4493
|
+
openRevisionRef.current = menuHost.revision;
|
|
4297
4494
|
const element = document.activeElement;
|
|
4298
4495
|
const workbook = contextService.getContextValue(_univerjs_core.FOCUSING_SHEET) ? instanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET) : null;
|
|
4299
4496
|
const sheetId = workbook === null || workbook === void 0 || (_workbook$getActiveSh = workbook.getActiveSheet()) === null || _workbook$getActiveSh === void 0 ? void 0 : _workbook$getActiveSh.getSheetId();
|
|
@@ -4314,6 +4511,10 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
4314
4511
|
function handleCloseAutoFocus(event) {
|
|
4315
4512
|
const editorFocus = editorFocusRef.current;
|
|
4316
4513
|
editorFocusRef.current = null;
|
|
4514
|
+
if (openRevisionRef.current !== menuHost.revision || menuHost.suspended) {
|
|
4515
|
+
event.preventDefault();
|
|
4516
|
+
return;
|
|
4517
|
+
}
|
|
4317
4518
|
if (sheetTargetRef.current && !sheetTargetRef.current.valid) {
|
|
4318
4519
|
event.preventDefault();
|
|
4319
4520
|
const activeElement = document.activeElement;
|
|
@@ -4843,38 +5044,20 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
|
|
|
4843
5044
|
*/
|
|
4844
5045
|
function RibbonOverflow({ groups, grid = false }) {
|
|
4845
5046
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
4846
|
-
const dialogService = (0, _wendellhu_redi_react_bindings.useDependency)(IDialogService);
|
|
4847
|
-
const sidebarService = (0, _wendellhu_redi_react_bindings.useDependency)(ISidebarService);
|
|
4848
5047
|
const { direction } = (0, react.useContext)(_univerjs_design.ConfigContext);
|
|
4849
5048
|
const [openedGroups, setOpenedGroups] = (0, react.useState)(null);
|
|
4850
5049
|
const open = openedGroups === groups;
|
|
4851
5050
|
const keyboardRef = (0, react.useRef)(false);
|
|
4852
5051
|
const restoreFocusRef = (0, react.useRef)(true);
|
|
4853
5052
|
const label = localeService.t("ui.ribbon.more");
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
setOpenedGroups(null);
|
|
4859
|
-
};
|
|
4860
|
-
const sidebar = sidebarService.sidebarOptions$.subscribe((options) => {
|
|
4861
|
-
if (options.visible) closeForPanel();
|
|
4862
|
-
});
|
|
4863
|
-
const dialogs = dialogService.getDialogs$().subscribe((options) => {
|
|
4864
|
-
if (options.some((dialog) => dialog.open)) closeForPanel();
|
|
4865
|
-
});
|
|
4866
|
-
return () => {
|
|
4867
|
-
sidebar.unsubscribe();
|
|
4868
|
-
dialogs.unsubscribe();
|
|
4869
|
-
};
|
|
4870
|
-
}, [
|
|
4871
|
-
open,
|
|
4872
|
-
dialogService,
|
|
4873
|
-
sidebarService
|
|
4874
|
-
]);
|
|
5053
|
+
const menuHost = useMenuHost(() => {
|
|
5054
|
+
restoreFocusRef.current = false;
|
|
5055
|
+
setOpenedGroups(null);
|
|
5056
|
+
});
|
|
4875
5057
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
|
|
4876
5058
|
open,
|
|
4877
5059
|
onOpenChange: (visible) => {
|
|
5060
|
+
if (visible && menuHost.suspended) return;
|
|
4878
5061
|
if (visible) restoreFocusRef.current = true;
|
|
4879
5062
|
setOpenedGroups(visible ? groups : null);
|
|
4880
5063
|
},
|
|
@@ -5152,7 +5335,7 @@ function Ribbon(props) {
|
|
|
5152
5335
|
const fakeToolbar = (0, react.useMemo)(() => {
|
|
5153
5336
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5154
5337
|
"aria-hidden": "true",
|
|
5155
|
-
className: (0, _univerjs_design.clsx)("univer-invisible univer-absolute -univer-left-[99999] -univer-top-[99999] univer-box-border univer-flex univer-h-10 univer-min-w-min univer-items-center univer-px-3 univer-opacity-0", { "univer-hidden": !fakeToolbarVisible }, _univerjs_design.divideXClassName, _univerjs_design.borderBottomClassName),
|
|
5338
|
+
className: (0, _univerjs_design.clsx)("univer-invisible univer-absolute -univer-left-[99999] -univer-top-[99999] univer-box-border univer-flex univer-h-10 univer-min-w-min univer-items-center univer-px-3 univer-opacity-0 rtl:univer-divide-x-reverse", { "univer-hidden": !fakeToolbarVisible }, _univerjs_design.divideXClassName, _univerjs_design.borderBottomClassName),
|
|
5156
5339
|
children: activeGroup.allGroups.map((groupItem, index) => {
|
|
5157
5340
|
var _groupItem$children, _groupItem$children2;
|
|
5158
5341
|
return (((_groupItem$children = groupItem.children) === null || _groupItem$children === void 0 ? void 0 : _groupItem$children.length) || groupItem.item) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Fragment, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -5252,7 +5435,7 @@ function Ribbon(props) {
|
|
|
5252
5435
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5253
5436
|
"data-u-comp": "ribbon-toolbar",
|
|
5254
5437
|
ref: containerRef,
|
|
5255
|
-
className: (0, _univerjs_design.clsx)("univer-flex univer-overflow-hidden", _univerjs_design.divideXClassName, { "univer-justify-center": ribbonType === "classic" }),
|
|
5438
|
+
className: (0, _univerjs_design.clsx)("univer-flex univer-overflow-hidden rtl:univer-divide-x-reverse", _univerjs_design.divideXClassName, { "univer-justify-center": ribbonType === "classic" }),
|
|
5256
5439
|
role: "toolbar",
|
|
5257
5440
|
"aria-label": localeService.t(activatedTabTitle),
|
|
5258
5441
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ToolbarDropdownProvider, { children: [activeGroup.visibleGroups.map((groupItem) => {
|
|
@@ -5265,7 +5448,7 @@ function Ribbon(props) {
|
|
|
5265
5448
|
}, child.key)))
|
|
5266
5449
|
}) }, groupItem.key);
|
|
5267
5450
|
}), collapsedIds.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5268
|
-
className: "univer-pl-2 rtl:univer-pr-2",
|
|
5451
|
+
className: "univer-pl-2 rtl:univer-pl-0 rtl:univer-pr-2",
|
|
5269
5452
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RibbonOverflow, { groups: activeGroup.hiddenGroups })
|
|
5270
5453
|
})] }, effectiveActivatedTab)
|
|
5271
5454
|
})]
|
|
@@ -5368,90 +5551,6 @@ var ContextMenuService = class extends _univerjs_core.Disposable {
|
|
|
5368
5551
|
}
|
|
5369
5552
|
};
|
|
5370
5553
|
|
|
5371
|
-
// src/services/contextmenu/contextmenu-host.service.ts
|
|
5372
|
-
const IContextMenuHostService = (0, _univerjs_core.createIdentifier)("ui.contextmenu.host.service");
|
|
5373
|
-
var ContextMenuHostService = class extends _univerjs_core.Disposable {
|
|
5374
|
-
constructor(..._args) {
|
|
5375
|
-
super(..._args);
|
|
5376
|
-
_defineProperty(this, "_menuMap", /* @__PURE__ */ new Map());
|
|
5377
|
-
_defineProperty(this, "_activeMenuId$", new rxjs.BehaviorSubject(null));
|
|
5378
|
-
_defineProperty(this, "activeMenuId$", this._activeMenuId$.asObservable());
|
|
5379
|
-
}
|
|
5380
|
-
get activeMenuId() {
|
|
5381
|
-
return this._activeMenuId$.value;
|
|
5382
|
-
}
|
|
5383
|
-
registerMenu(menuId, hide) {
|
|
5384
|
-
this._menuMap.set(menuId, hide);
|
|
5385
|
-
return (0, _univerjs_core.toDisposable)(() => {
|
|
5386
|
-
this._menuMap.delete(menuId);
|
|
5387
|
-
if (this.activeMenuId === menuId) this._activeMenuId$.next(null);
|
|
5388
|
-
});
|
|
5389
|
-
}
|
|
5390
|
-
activateMenu(menuId) {
|
|
5391
|
-
this.hideActiveMenu(menuId);
|
|
5392
|
-
this._activeMenuId$.next(menuId);
|
|
5393
|
-
}
|
|
5394
|
-
deactivateMenu(menuId) {
|
|
5395
|
-
if (this.activeMenuId === menuId) this._activeMenuId$.next(null);
|
|
5396
|
-
}
|
|
5397
|
-
hideActiveMenu(exceptMenuId) {
|
|
5398
|
-
const activeMenuId = this.activeMenuId;
|
|
5399
|
-
if (!activeMenuId || activeMenuId === exceptMenuId) return;
|
|
5400
|
-
const hide = this._menuMap.get(activeMenuId);
|
|
5401
|
-
this._activeMenuId$.next(null);
|
|
5402
|
-
hide === null || hide === void 0 || hide();
|
|
5403
|
-
}
|
|
5404
|
-
dispose() {
|
|
5405
|
-
this._activeMenuId$.complete();
|
|
5406
|
-
super.dispose();
|
|
5407
|
-
}
|
|
5408
|
-
};
|
|
5409
|
-
|
|
5410
|
-
// src/views/hooks/prevent-browser-zoom.ts
|
|
5411
|
-
/**
|
|
5412
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5413
|
-
*
|
|
5414
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5415
|
-
* you may not use this file except in compliance with the License.
|
|
5416
|
-
* You may obtain a copy of the License at
|
|
5417
|
-
*
|
|
5418
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5419
|
-
*
|
|
5420
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
5421
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5422
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5423
|
-
* See the License for the specific language governing permissions and
|
|
5424
|
-
* limitations under the License.
|
|
5425
|
-
*/
|
|
5426
|
-
function preventBrowserZoomInContainers(containers) {
|
|
5427
|
-
const uniqueContainers = new Set(containers);
|
|
5428
|
-
const handleWheel = (event) => {
|
|
5429
|
-
if (event.ctrlKey || event.metaKey) event.preventDefault();
|
|
5430
|
-
};
|
|
5431
|
-
const handleGesture = (event) => event.preventDefault();
|
|
5432
|
-
uniqueContainers.forEach((container) => {
|
|
5433
|
-
container.addEventListener("wheel", handleWheel, {
|
|
5434
|
-
capture: true,
|
|
5435
|
-
passive: false
|
|
5436
|
-
});
|
|
5437
|
-
container.addEventListener("gesturestart", handleGesture, {
|
|
5438
|
-
capture: true,
|
|
5439
|
-
passive: false
|
|
5440
|
-
});
|
|
5441
|
-
container.addEventListener("gesturechange", handleGesture, {
|
|
5442
|
-
capture: true,
|
|
5443
|
-
passive: false
|
|
5444
|
-
});
|
|
5445
|
-
});
|
|
5446
|
-
return () => {
|
|
5447
|
-
uniqueContainers.forEach((container) => {
|
|
5448
|
-
container.removeEventListener("wheel", handleWheel, true);
|
|
5449
|
-
container.removeEventListener("gesturestart", handleGesture, true);
|
|
5450
|
-
container.removeEventListener("gesturechange", handleGesture, true);
|
|
5451
|
-
});
|
|
5452
|
-
};
|
|
5453
|
-
}
|
|
5454
|
-
|
|
5455
5554
|
// src/views/menu/desktop/DesignTinyMenuGroup.tsx
|
|
5456
5555
|
/**
|
|
5457
5556
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
@@ -5634,7 +5733,8 @@ function QuickTileMenuItem(props) {
|
|
|
5634
5733
|
const hidden = useObservable(menuItem === null || menuItem === void 0 ? void 0 : menuItem.hidden$, false);
|
|
5635
5734
|
const activated = useObservable(menuItem === null || menuItem === void 0 ? void 0 : menuItem.activated$, false);
|
|
5636
5735
|
if (!menuItem || hidden) return null;
|
|
5637
|
-
const
|
|
5736
|
+
const { icon } = menuItem;
|
|
5737
|
+
const Icon = icon ? iconManager.get(icon) : null;
|
|
5638
5738
|
const active = resolveMenuItemActiveState(menuItem.id, activated, activeItemIds);
|
|
5639
5739
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
5640
5740
|
type: "button",
|
|
@@ -5685,27 +5785,28 @@ function UITinyMenuGroup(props) {
|
|
|
5685
5785
|
]);
|
|
5686
5786
|
if (!item.children) return null;
|
|
5687
5787
|
const items = visibleChildren.map((child) => {
|
|
5688
|
-
var _child$
|
|
5689
|
-
const
|
|
5788
|
+
var _child$item11, _child$item12, _child$item13;
|
|
5789
|
+
const { icon } = child.item ?? {};
|
|
5790
|
+
const Icon = icon ? iconManager.get(icon) : void 0;
|
|
5690
5791
|
if (!Icon) return null;
|
|
5691
5792
|
return {
|
|
5692
5793
|
key: child.key,
|
|
5693
5794
|
onClick: () => {
|
|
5694
|
-
var _child$item5, _child$item6, _child$item7, _child$item8, _child$item9, _child$item10
|
|
5795
|
+
var _child$item4, _child$item5, _child$item6, _child$item7, _child$item8, _child$item9, _child$item10;
|
|
5695
5796
|
onOptionSelect === null || onOptionSelect === void 0 || onOptionSelect({
|
|
5696
|
-
label: ((_child$
|
|
5697
|
-
commandId: (_child$
|
|
5698
|
-
id: (_child$
|
|
5699
|
-
params: (_child$
|
|
5700
|
-
value: (_child$
|
|
5701
|
-
tooltip: ((_child$
|
|
5797
|
+
label: ((_child$item4 = child.item) === null || _child$item4 === void 0 ? void 0 : _child$item4.id) ?? child.key,
|
|
5798
|
+
commandId: (_child$item5 = child.item) === null || _child$item5 === void 0 ? void 0 : _child$item5.commandId,
|
|
5799
|
+
id: (_child$item6 = child.item) === null || _child$item6 === void 0 ? void 0 : _child$item6.id,
|
|
5800
|
+
params: (_child$item7 = child.item) === null || _child$item7 === void 0 ? void 0 : _child$item7.params,
|
|
5801
|
+
value: (_child$item8 = child.item) === null || _child$item8 === void 0 ? void 0 : _child$item8.value,
|
|
5802
|
+
tooltip: ((_child$item9 = child.item) === null || _child$item9 === void 0 ? void 0 : _child$item9.tooltip) && localeService.t((_child$item10 = child.item) === null || _child$item10 === void 0 ? void 0 : _child$item10.tooltip)
|
|
5702
5803
|
});
|
|
5703
5804
|
},
|
|
5704
5805
|
className: "",
|
|
5705
|
-
iconClassName:
|
|
5806
|
+
iconClassName: icon === "TextTypeIcon" ? sizeVariant === "paragraph-t" ? "!univer-size-4" : "!univer-size-3.5" : void 0,
|
|
5706
5807
|
Icon,
|
|
5707
|
-
active: resolveMenuItemActiveState((_child$
|
|
5708
|
-
tooltip: ((_child$
|
|
5808
|
+
active: resolveMenuItemActiveState((_child$item11 = child.item) === null || _child$item11 === void 0 ? void 0 : _child$item11.id, activeItems.includes(((_child$item12 = child.item) === null || _child$item12 === void 0 ? void 0 : _child$item12.id) ?? ""), activeItemIds),
|
|
5809
|
+
tooltip: ((_child$item13 = child.item) === null || _child$item13 === void 0 ? void 0 : _child$item13.tooltip) ? localeService.t(child.item.tooltip) : void 0
|
|
5709
5810
|
};
|
|
5710
5811
|
}).filter((child) => child != null);
|
|
5711
5812
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DesignTinyMenuGroup, {
|
|
@@ -6135,7 +6236,7 @@ function ContextMenuPanel(props) {
|
|
|
6135
6236
|
if (!focusableButtons.length) return;
|
|
6136
6237
|
event.preventDefault();
|
|
6137
6238
|
event.stopPropagation();
|
|
6138
|
-
const activeIndex = focusableButtons.findIndex((button) => button
|
|
6239
|
+
const activeIndex = focusableButtons.findIndex((button) => button.contains(activeElement ?? null));
|
|
6139
6240
|
if (event.key === "Enter") {
|
|
6140
6241
|
const button = activeIndex >= 0 ? focusableButtons[activeIndex] : getFirstMenuButtonByVisualOrder(focusableButtons);
|
|
6141
6242
|
if (!button) return;
|
|
@@ -6362,6 +6463,7 @@ function ContextMenuMenuItem(props) {
|
|
|
6362
6463
|
const [keyboardSubmenuFocusRequested, setKeyboardSubmenuFocusRequested] = (0, react.useState)(false);
|
|
6363
6464
|
const menuItemElementRef = (0, react.useRef)(null);
|
|
6364
6465
|
const menuButtonRef = (0, react.useRef)(null);
|
|
6466
|
+
const mouseDownOnInputRef = (0, react.useRef)(false);
|
|
6365
6467
|
const submenuElementRef = (0, react.useRef)(null);
|
|
6366
6468
|
const submenuCloseTimerRef = (0, react.useRef)(null);
|
|
6367
6469
|
const pendingHoverActionRef = (0, react.useRef)(null);
|
|
@@ -6587,6 +6689,9 @@ function ContextMenuMenuItem(props) {
|
|
|
6587
6689
|
"aria-haspopup": hasSubmenu ? "menu" : void 0,
|
|
6588
6690
|
"aria-expanded": hasSubmenu ? submenuVisible : void 0,
|
|
6589
6691
|
"aria-controls": hasSubmenu ? submenuId : void 0,
|
|
6692
|
+
onMouseDownCapture: (event) => {
|
|
6693
|
+
mouseDownOnInputRef.current = event.target instanceof HTMLInputElement;
|
|
6694
|
+
},
|
|
6590
6695
|
onKeyDown: (event) => {
|
|
6591
6696
|
var _pointerGraceRef$curr3;
|
|
6592
6697
|
const openDirection = direction === "rtl" ? "ArrowLeft" : "ArrowRight";
|
|
@@ -6600,6 +6705,7 @@ function ContextMenuMenuItem(props) {
|
|
|
6600
6705
|
},
|
|
6601
6706
|
onClick: (event) => {
|
|
6602
6707
|
var _pointerGraceRef$curr4;
|
|
6708
|
+
if (event.detail > 0 && mouseDownOnInputRef.current) return;
|
|
6603
6709
|
(_pointerGraceRef$curr4 = pointerGraceRef.current) === null || _pointerGraceRef$curr4 === void 0 || _pointerGraceRef$curr4.cancel();
|
|
6604
6710
|
clearSubmenuCloseTimer();
|
|
6605
6711
|
if (hasSubmenu) {
|
|
@@ -6611,7 +6717,7 @@ function ContextMenuMenuItem(props) {
|
|
|
6611
6717
|
if (canExecuteItem) {
|
|
6612
6718
|
const item = menuItem;
|
|
6613
6719
|
onOptionSelect === null || onOptionSelect === void 0 || onOptionSelect({
|
|
6614
|
-
commandId: item.commandId,
|
|
6720
|
+
commandId: item.commandId ?? item.id,
|
|
6615
6721
|
params: item.params,
|
|
6616
6722
|
value: inputValue,
|
|
6617
6723
|
id: item.id,
|
|
@@ -6626,7 +6732,7 @@ function ContextMenuMenuItem(props) {
|
|
|
6626
6732
|
if (!canExecuteItem) return;
|
|
6627
6733
|
const item = menuItem;
|
|
6628
6734
|
onOptionSelect === null || onOptionSelect === void 0 || onOptionSelect({
|
|
6629
|
-
commandId: item.commandId,
|
|
6735
|
+
commandId: item.commandId ?? item.id,
|
|
6630
6736
|
params: item.params,
|
|
6631
6737
|
value: inputValue,
|
|
6632
6738
|
id: item.id,
|
|
@@ -6766,6 +6872,21 @@ function useContextGroupHiddenStates$1(menuSchemas) {
|
|
|
6766
6872
|
}
|
|
6767
6873
|
|
|
6768
6874
|
// src/views/components/context-menu/AnchoredContextMenu.tsx
|
|
6875
|
+
/**
|
|
6876
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
6877
|
+
*
|
|
6878
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6879
|
+
* you may not use this file except in compliance with the License.
|
|
6880
|
+
* You may obtain a copy of the License at
|
|
6881
|
+
*
|
|
6882
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6883
|
+
*
|
|
6884
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
6885
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6886
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6887
|
+
* See the License for the specific language governing permissions and
|
|
6888
|
+
* limitations under the License.
|
|
6889
|
+
*/
|
|
6769
6890
|
function AnchoredContextMenu(props) {
|
|
6770
6891
|
const { hostId, visible, anchorRect, menuType, anchorVertical = "bottom", autoFocus, menuOffset = 0, menuManagerService, layoutService, onRequestClose, onOptionSelect } = props;
|
|
6771
6892
|
const contentRef = (0, react.useRef)(null);
|
|
@@ -6782,8 +6903,9 @@ function AnchoredContextMenu(props) {
|
|
|
6782
6903
|
visibleRef.current = visible;
|
|
6783
6904
|
menuTypeRef.current = menuType;
|
|
6784
6905
|
(0, react.useEffect)(() => {
|
|
6785
|
-
const disposable = contextMenuHostService.registerMenu(hostId, () => {
|
|
6786
|
-
|
|
6906
|
+
const disposable = contextMenuHostService.registerMenu(hostId, (restoreFocus) => {
|
|
6907
|
+
if (!restoreFocus) focusReturnTargetRef.current = null;
|
|
6908
|
+
if (visibleRef.current) onRequestCloseRef.current();
|
|
6787
6909
|
});
|
|
6788
6910
|
return () => {
|
|
6789
6911
|
disposable.dispose();
|
|
@@ -6794,6 +6916,11 @@ function AnchoredContextMenu(props) {
|
|
|
6794
6916
|
var _contentRef$current3, _contentRef$current4;
|
|
6795
6917
|
if (visible) {
|
|
6796
6918
|
var _contentRef$current, _contentRef$current2, _ownerDocument$defaul;
|
|
6919
|
+
if (contextMenuHostService.suspended) {
|
|
6920
|
+
focusReturnTargetRef.current = null;
|
|
6921
|
+
onRequestCloseRef.current();
|
|
6922
|
+
return;
|
|
6923
|
+
}
|
|
6797
6924
|
const ownerDocument = ((_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.ownerDocument) ?? document;
|
|
6798
6925
|
const activeElement = ownerDocument.activeElement;
|
|
6799
6926
|
const isFocusInMenu = activeElement !== null && (((_contentRef$current2 = contentRef.current) === null || _contentRef$current2 === void 0 ? void 0 : _contentRef$current2.contains(activeElement)) || !!activeElement.closest(`[${"data-u-context-menu-submenu"}]`));
|
|
@@ -6861,7 +6988,7 @@ function AnchoredContextMenu(props) {
|
|
|
6861
6988
|
menuOffset
|
|
6862
6989
|
]);
|
|
6863
6990
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Popup, {
|
|
6864
|
-
visible: visible && !!anchorRect,
|
|
6991
|
+
visible: visible && !!anchorRect && !contextMenuHostService.suspended,
|
|
6865
6992
|
offset,
|
|
6866
6993
|
overflowVisible: true,
|
|
6867
6994
|
placementY: anchorVertical === "top" ? "above" : "below",
|
|
@@ -6881,9 +7008,26 @@ function AnchoredContextMenu(props) {
|
|
|
6881
7008
|
}
|
|
6882
7009
|
|
|
6883
7010
|
// src/views/components/context-menu/ContextMenu.tsx
|
|
7011
|
+
/**
|
|
7012
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
7013
|
+
*
|
|
7014
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7015
|
+
* you may not use this file except in compliance with the License.
|
|
7016
|
+
* You may obtain a copy of the License at
|
|
7017
|
+
*
|
|
7018
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7019
|
+
*
|
|
7020
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7021
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
7022
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7023
|
+
* See the License for the specific language governing permissions and
|
|
7024
|
+
* limitations under the License.
|
|
7025
|
+
*/
|
|
6884
7026
|
const DESKTOP_CONTEXT_MENU_HOST_ID = "desktop-context-menu";
|
|
6885
7027
|
function DesktopContextMenu() {
|
|
6886
7028
|
const [visible, setVisible] = (0, react.useState)(false);
|
|
7029
|
+
const pendingOpenRef = (0, react.useRef)(null);
|
|
7030
|
+
const menuHost = (0, _wendellhu_redi_react_bindings.useDependency)(IContextMenuHostService);
|
|
6887
7031
|
const [menuType, setMenuType] = (0, react.useState)("");
|
|
6888
7032
|
const [anchorRect, setAnchorRect] = (0, react.useState)(null);
|
|
6889
7033
|
const [menuContext, setMenuContext] = (0, react.useState)();
|
|
@@ -6906,12 +7050,17 @@ function DesktopContextMenu() {
|
|
|
6906
7050
|
});
|
|
6907
7051
|
return () => {
|
|
6908
7052
|
disposables.dispose();
|
|
7053
|
+
if (pendingOpenRef.current !== null) cancelAnimationFrame(pendingOpenRef.current);
|
|
6909
7054
|
};
|
|
6910
7055
|
}, [contextMenuService]);
|
|
6911
7056
|
/** A function to open context menu with given position and menu type. */
|
|
6912
7057
|
function handleContextMenu(event, menuType, context) {
|
|
6913
|
-
|
|
6914
|
-
|
|
7058
|
+
handleClose();
|
|
7059
|
+
if (menuHost.suspended) return;
|
|
7060
|
+
const revision = menuHost.revision;
|
|
7061
|
+
pendingOpenRef.current = requestAnimationFrame(() => {
|
|
7062
|
+
pendingOpenRef.current = null;
|
|
7063
|
+
if (menuHost.suspended || revision !== menuHost.revision) return;
|
|
6915
7064
|
setMenuType(menuType);
|
|
6916
7065
|
setMenuContext(context);
|
|
6917
7066
|
setAnchorRect({
|
|
@@ -6923,6 +7072,10 @@ function DesktopContextMenu() {
|
|
|
6923
7072
|
});
|
|
6924
7073
|
}
|
|
6925
7074
|
function handleClose() {
|
|
7075
|
+
if (pendingOpenRef.current !== null) {
|
|
7076
|
+
cancelAnimationFrame(pendingOpenRef.current);
|
|
7077
|
+
pendingOpenRef.current = null;
|
|
7078
|
+
}
|
|
6926
7079
|
setVisible(false);
|
|
6927
7080
|
}
|
|
6928
7081
|
const activeScope = runtimeScopeService.get(menuContext === null || menuContext === void 0 ? void 0 : menuContext.unitId);
|
|
@@ -6942,8 +7095,9 @@ function DesktopContextMenu() {
|
|
|
6942
7095
|
const { label: id, commandId, value } = params;
|
|
6943
7096
|
const rawParams = typeof params.params === "function" ? params.params() : params.params;
|
|
6944
7097
|
const commandParams = typeof rawParams === "undefined" ? { value } : rawParams;
|
|
7098
|
+
const revision = menuHost.revision;
|
|
6945
7099
|
if (activeCommandService) activeCommandService.executeCommand(commandId ?? id, commandParams);
|
|
6946
|
-
activeLayoutService.focus();
|
|
7100
|
+
if (revision === menuHost.revision && !menuHost.suspended) activeLayoutService.focus();
|
|
6947
7101
|
handleClose();
|
|
6948
7102
|
}
|
|
6949
7103
|
});
|
|
@@ -7124,7 +7278,7 @@ function Sidebar() {
|
|
|
7124
7278
|
})]
|
|
7125
7279
|
}),
|
|
7126
7280
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
7127
|
-
className: "univer-box-border univer-min-w-0 univer-cursor-default univer-px-4",
|
|
7281
|
+
className: "univer-box-border univer-min-w-0 univer-cursor-default univer-px-4 univer-pb-4",
|
|
7128
7282
|
children: options === null || options === void 0 ? void 0 : options.children
|
|
7129
7283
|
}),
|
|
7130
7284
|
(options === null || options === void 0 ? void 0 : options.footer) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("footer", {
|
|
@@ -7753,7 +7907,7 @@ const IUIController = (0, _univerjs_core.createIdentifier)("univer.ui.ui-control
|
|
|
7753
7907
|
|
|
7754
7908
|
// package.json
|
|
7755
7909
|
var name = "@univerjs/ui";
|
|
7756
|
-
var version = "1.
|
|
7910
|
+
var version = "1.5.1";
|
|
7757
7911
|
|
|
7758
7912
|
// src/views/color-picker/interface.ts
|
|
7759
7913
|
/**
|
|
@@ -24536,6 +24690,7 @@ function MobileCompactTopBar(props) {
|
|
|
24536
24690
|
const { headerMenuComponents, headerMenu = true, ribbon } = props;
|
|
24537
24691
|
const [moreOpen, setMoreOpen] = (0, react.useState)(false);
|
|
24538
24692
|
const moreTriggerRef = (0, react.useRef)(null);
|
|
24693
|
+
const menuHost = useMenuHost(() => setMoreOpen(false));
|
|
24539
24694
|
const { mountContainer } = (0, react.useContext)(_univerjs_design.ConfigContext);
|
|
24540
24695
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
24541
24696
|
const startGroup = ribbon.find((group) => group.key === "ribbon.start");
|
|
@@ -24563,8 +24718,7 @@ function MobileCompactTopBar(props) {
|
|
|
24563
24718
|
right: Math.max(12, viewportWidth - ((triggerRect === null || triggerRect === void 0 ? void 0 : triggerRect.right) ?? viewportWidth))
|
|
24564
24719
|
},
|
|
24565
24720
|
children: moreItems.map((schema) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
24566
|
-
className: "univer-w-full [&>span]:univer-block [&>span]:univer-w-full [&_button]:!univer-
|
|
24567
|
-
onClick: () => setMoreOpen(false),
|
|
24721
|
+
className: "univer-w-full [&>span]:univer-block [&>span]:univer-w-full [&_button]:!univer-w-full [&_button]:!univer-justify-start [&_button]:!univer-gap-3 [&_button]:!univer-rounded-xl [&_button]:!univer-px-4",
|
|
24568
24722
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileToolbarItem, {
|
|
24569
24723
|
...schema.item,
|
|
24570
24724
|
grid: true,
|
|
@@ -24578,7 +24732,7 @@ function MobileCompactTopBar(props) {
|
|
|
24578
24732
|
className: (0, _univerjs_design.clsx)("univer-flex univer-h-12 univer-items-center univer-justify-end univer-gap-1 univer-bg-gray-0 univer-px-3 dark:!univer-bg-gray-800", _univerjs_design.borderBottomClassName),
|
|
24579
24733
|
children: [
|
|
24580
24734
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
24581
|
-
className: "univer-flex univer-items-center univer-gap-1 [&_button]:!univer-min-
|
|
24735
|
+
className: "univer-flex univer-items-center univer-gap-1 [&_button]:!univer-min-w-10 [&_button]:!univer-rounded-lg [&_button_svg]:!univer-size-5",
|
|
24582
24736
|
children: items.map((schema) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileToolbarItem, { ...schema.item }, schema.key))
|
|
24583
24737
|
}),
|
|
24584
24738
|
moreItems.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
@@ -24588,7 +24742,9 @@ function MobileCompactTopBar(props) {
|
|
|
24588
24742
|
"aria-label": localeService.t("ui.ribbon.more"),
|
|
24589
24743
|
"aria-expanded": moreOpen,
|
|
24590
24744
|
className: (0, _univerjs_design.clsx)(_univerjs_design.resetButtonClassName, "univer-flex univer-size-10 univer-items-center univer-justify-center univer-rounded-lg univer-text-gray-700 univer-transition-colors active:univer-bg-gray-100 dark:!univer-text-gray-200 dark:active:!univer-bg-gray-700"),
|
|
24591
|
-
onClick: () =>
|
|
24745
|
+
onClick: () => {
|
|
24746
|
+
if (!menuHost.suspended) setMoreOpen((open) => !open);
|
|
24747
|
+
},
|
|
24592
24748
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreHorizontalIcon, {
|
|
24593
24749
|
className: "univer-size-5",
|
|
24594
24750
|
preserveStrokeWidth: true
|
|
@@ -25563,7 +25719,7 @@ function MobileDrawer(props) {
|
|
|
25563
25719
|
"aria-label": ariaLabel,
|
|
25564
25720
|
"data-u-comp": componentName,
|
|
25565
25721
|
"data-snap": snap,
|
|
25566
|
-
className: (0, _univerjs_design.clsx)("univer-absolute univer-inset-x-0 univer-bottom-0 univer-z-20 univer-flex univer-flex-col univer-overflow-hidden univer-rounded-t-[24px] univer-bg-gray-50 univer-shadow-2xl univer-transition-[height] univer-duration-200 dark:!univer-bg-gray-900
|
|
25722
|
+
className: (0, _univerjs_design.clsx)("univer-absolute univer-inset-x-0 univer-bottom-0 univer-z-20 univer-flex univer-flex-col univer-overflow-hidden univer-rounded-t-[24px] univer-bg-gray-50 univer-shadow-2xl univer-transition-[height] univer-duration-200 dark:!univer-bg-gray-900", "univer-pointer-events-auto", dragPercent != null && "!univer-transition-none", panelClassName),
|
|
25567
25723
|
style: {
|
|
25568
25724
|
height: autoHeight ? "auto" : `${drawerPercent}${viewportHeightUnit}`,
|
|
25569
25725
|
maxHeight: autoHeight ? contentMaxHeight : void 0,
|
|
@@ -25719,6 +25875,7 @@ function MobileContextMenu() {
|
|
|
25719
25875
|
const isFloatingContextMenu = shouldUseFloatingMobileContextMenu(menuType, menuContext);
|
|
25720
25876
|
visibleRef.current = visible;
|
|
25721
25877
|
const handleContextMenu = (0, react.useCallback)((event, nextMenuType, context) => {
|
|
25878
|
+
if (contextMenuHostService.suspended) return;
|
|
25722
25879
|
contextMenuHostService.activateMenu(MOBILE_CONTEXT_MENU_HOST_ID);
|
|
25723
25880
|
setMenuType(nextMenuType);
|
|
25724
25881
|
setMenuContext(context);
|
|
@@ -26847,10 +27004,12 @@ function MobileDialogPart() {
|
|
|
26847
27004
|
const defaultSnap = options.layout === "canvas" ? "compact" : "expanded";
|
|
26848
27005
|
const footer = options.footer ?? (options.showOk || options.showCancel ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [options.showCancel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
26849
27006
|
onClick: options.onCancel,
|
|
27007
|
+
size: "middle",
|
|
26850
27008
|
children: locale === null || locale === void 0 ? void 0 : locale.Confirm.cancel
|
|
26851
27009
|
}), options.showOk && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
26852
27010
|
variant: "primary",
|
|
26853
27011
|
onClick: options.onOk,
|
|
27012
|
+
size: "middle",
|
|
26854
27013
|
children: locale === null || locale === void 0 ? void 0 : locale.Confirm.confirm
|
|
26855
27014
|
})] }) : null);
|
|
26856
27015
|
const close = () => {
|
|
@@ -26975,10 +27134,11 @@ function DialogPart() {
|
|
|
26975
27134
|
|
|
26976
27135
|
// src/services/dialog/desktop-dialog.service.ts
|
|
26977
27136
|
let DesktopDialogService = class DesktopDialogService extends _univerjs_core.Disposable {
|
|
26978
|
-
constructor(_injector, _uiPartsService) {
|
|
27137
|
+
constructor(_injector, _uiPartsService, _menuHostService) {
|
|
26979
27138
|
super();
|
|
26980
27139
|
this._injector = _injector;
|
|
26981
27140
|
this._uiPartsService = _uiPartsService;
|
|
27141
|
+
this._menuHostService = _menuHostService;
|
|
26982
27142
|
_defineProperty(this, "_dialogOptions", []);
|
|
26983
27143
|
_defineProperty(this, "_dialogOptions$", new rxjs.Subject());
|
|
26984
27144
|
this._initUIPart();
|
|
@@ -26989,7 +27149,9 @@ let DesktopDialogService = class DesktopDialogService extends _univerjs_core.Dis
|
|
|
26989
27149
|
this._dialogOptions$.complete();
|
|
26990
27150
|
}
|
|
26991
27151
|
open(option) {
|
|
26992
|
-
|
|
27152
|
+
const existingDialog = this._dialogOptions.find((item) => item.id === option.id);
|
|
27153
|
+
if (!(existingDialog === null || existingDialog === void 0 ? void 0 : existingDialog.open)) this._menuHostService.closeAll();
|
|
27154
|
+
if (existingDialog) this._dialogOptions = this._dialogOptions.map((item) => ({
|
|
26993
27155
|
...item.id === option.id ? option : item,
|
|
26994
27156
|
open: item.id === option.id ? true : item.open
|
|
26995
27157
|
}));
|
|
@@ -27025,7 +27187,11 @@ let DesktopDialogService = class DesktopDialogService extends _univerjs_core.Dis
|
|
|
27025
27187
|
this.disposeWithMe(this._uiPartsService.registerComponent("global", () => (0, _wendellhu_redi_react_bindings.connectInjector)(DialogPart, this._injector)));
|
|
27026
27188
|
}
|
|
27027
27189
|
};
|
|
27028
|
-
DesktopDialogService = __decorate([
|
|
27190
|
+
DesktopDialogService = __decorate([
|
|
27191
|
+
__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
27192
|
+
__decorateParam(1, IUIPartsService),
|
|
27193
|
+
__decorateParam(2, IContextMenuHostService)
|
|
27194
|
+
], DesktopDialogService);
|
|
27029
27195
|
|
|
27030
27196
|
// src/services/dialog/mobile-dialog.service.ts
|
|
27031
27197
|
/**
|
|
@@ -27044,8 +27210,8 @@ DesktopDialogService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)
|
|
|
27044
27210
|
* limitations under the License.
|
|
27045
27211
|
*/
|
|
27046
27212
|
let MobileDialogService = class MobileDialogService extends DesktopDialogService {
|
|
27047
|
-
constructor(injector, uiPartsService) {
|
|
27048
|
-
super(injector, uiPartsService);
|
|
27213
|
+
constructor(injector, uiPartsService, menuHostService) {
|
|
27214
|
+
super(injector, uiPartsService, menuHostService);
|
|
27049
27215
|
}
|
|
27050
27216
|
close(id) {
|
|
27051
27217
|
const dialog = this._dialogOptions.find((item) => item.id === id);
|
|
@@ -27056,7 +27222,11 @@ let MobileDialogService = class MobileDialogService extends DesktopDialogService
|
|
|
27056
27222
|
this.disposeWithMe(this._uiPartsService.registerComponent("global", () => (0, _wendellhu_redi_react_bindings.connectInjector)(MobileDialogPart, this._injector)));
|
|
27057
27223
|
}
|
|
27058
27224
|
};
|
|
27059
|
-
MobileDialogService = __decorate([
|
|
27225
|
+
MobileDialogService = __decorate([
|
|
27226
|
+
__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
27227
|
+
__decorateParam(1, IUIPartsService),
|
|
27228
|
+
__decorateParam(2, IContextMenuHostService)
|
|
27229
|
+
], MobileDialogService);
|
|
27060
27230
|
|
|
27061
27231
|
// src/services/gallery/gallery.service.ts
|
|
27062
27232
|
const IGalleryService = (0, _univerjs_core.createIdentifier)("univer.ui.gallery-service");
|
|
@@ -27545,9 +27715,10 @@ var UnitPresenceUIAdapterRegistry = class extends _univerjs_core.Disposable {
|
|
|
27545
27715
|
};
|
|
27546
27716
|
|
|
27547
27717
|
// src/services/sidebar/desktop-sidebar.service.ts
|
|
27548
|
-
|
|
27549
|
-
constructor(
|
|
27550
|
-
super(
|
|
27718
|
+
let DesktopSidebarService = class DesktopSidebarService extends _univerjs_core.Disposable {
|
|
27719
|
+
constructor(_menuHostService) {
|
|
27720
|
+
super();
|
|
27721
|
+
this._menuHostService = _menuHostService;
|
|
27551
27722
|
_defineProperty(this, "_sidebarOptions", {});
|
|
27552
27723
|
_defineProperty(this, "sidebarOptions$", new rxjs.Subject());
|
|
27553
27724
|
_defineProperty(this, "scrollEvent$", new rxjs.Subject());
|
|
@@ -27580,6 +27751,7 @@ var DesktopSidebarService = class extends _univerjs_core.Disposable {
|
|
|
27580
27751
|
}
|
|
27581
27752
|
}
|
|
27582
27753
|
open(params) {
|
|
27754
|
+
this._menuHostService.closeAll();
|
|
27583
27755
|
this._sidebarOptions = {
|
|
27584
27756
|
...params,
|
|
27585
27757
|
id: params.id,
|
|
@@ -27613,6 +27785,7 @@ var DesktopSidebarService = class extends _univerjs_core.Disposable {
|
|
|
27613
27785
|
this._container = element;
|
|
27614
27786
|
}
|
|
27615
27787
|
};
|
|
27788
|
+
DesktopSidebarService = __decorate([__decorateParam(0, IContextMenuHostService)], DesktopSidebarService);
|
|
27616
27789
|
|
|
27617
27790
|
// src/services/undo-redo/undo-redo-group.service.ts
|
|
27618
27791
|
/**
|
|
@@ -27669,6 +27842,21 @@ let UndoRedoGroupService = class UndoRedoGroupService {
|
|
|
27669
27842
|
UndoRedoGroupService = __decorate([__decorateParam(0, _univerjs_core.IUndoRedoService)], UndoRedoGroupService);
|
|
27670
27843
|
|
|
27671
27844
|
// src/mobile-plugin.ts
|
|
27845
|
+
/**
|
|
27846
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
27847
|
+
*
|
|
27848
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
27849
|
+
* you may not use this file except in compliance with the License.
|
|
27850
|
+
* You may obtain a copy of the License at
|
|
27851
|
+
*
|
|
27852
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
27853
|
+
*
|
|
27854
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
27855
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
27856
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
27857
|
+
* See the License for the specific language governing permissions and
|
|
27858
|
+
* limitations under the License.
|
|
27859
|
+
*/
|
|
27672
27860
|
const DISABLE_AUTO_FOCUS_KEY$1 = "DISABLE_AUTO_FOCUS";
|
|
27673
27861
|
let UniverMobileUIPlugin = class UniverMobileUIPlugin extends _univerjs_core.Plugin {
|
|
27674
27862
|
constructor(_config = defaultPluginConfig, _contextService, _injector, _configService) {
|
|
@@ -28757,7 +28945,7 @@ function ObjectPermissionPanel({ unitId, getTargets, expandable }) {
|
|
|
28757
28945
|
});
|
|
28758
28946
|
}
|
|
28759
28947
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
28760
|
-
className: "univer-flex univer-h-full univer-flex-col univer-gap-3 univer-
|
|
28948
|
+
className: "univer-box-border univer-flex univer-h-0 univer-min-h-full univer-flex-col univer-gap-3 univer-pt-4",
|
|
28761
28949
|
children: [
|
|
28762
28950
|
expandable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
28763
28951
|
"aria-expanded": expanded,
|
|
@@ -28774,7 +28962,7 @@ function ObjectPermissionPanel({ unitId, getTargets, expandable }) {
|
|
|
28774
28962
|
"aria-label": localeService.t("ui.objectPermission.search")
|
|
28775
28963
|
}),
|
|
28776
28964
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
28777
|
-
className: "univer-flex-1 univer-overflow-auto",
|
|
28965
|
+
className: "univer-min-h-0 univer-flex-1 univer-overflow-auto univer-pb-4",
|
|
28778
28966
|
children: [
|
|
28779
28967
|
items.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
28780
28968
|
className: "univer-flex univer-items-center univer-gap-2 univer-py-2",
|
|
@@ -28976,6 +29164,21 @@ let DesktopConfirmService = class DesktopConfirmService extends _univerjs_core.D
|
|
|
28976
29164
|
DesktopConfirmService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), __decorateParam(1, IUIPartsService)], DesktopConfirmService);
|
|
28977
29165
|
|
|
28978
29166
|
// src/plugin.ts
|
|
29167
|
+
/**
|
|
29168
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
29169
|
+
*
|
|
29170
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
29171
|
+
* you may not use this file except in compliance with the License.
|
|
29172
|
+
* You may obtain a copy of the License at
|
|
29173
|
+
*
|
|
29174
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
29175
|
+
*
|
|
29176
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
29177
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
29178
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
29179
|
+
* See the License for the specific language governing permissions and
|
|
29180
|
+
* limitations under the License.
|
|
29181
|
+
*/
|
|
28979
29182
|
const DISABLE_AUTO_FOCUS_KEY = "DISABLE_AUTO_FOCUS";
|
|
28980
29183
|
let UniverUIPlugin = class UniverUIPlugin extends _univerjs_core.Plugin {
|
|
28981
29184
|
constructor(_config = defaultPluginConfig, _contextService, _injector, _configService) {
|
|
@@ -30116,20 +30319,36 @@ var MobileZoomIndicator = class extends _univerjs_core.Disposable {
|
|
|
30116
30319
|
};
|
|
30117
30320
|
|
|
30118
30321
|
// src/views/font-family/MobileFontFamilyDropdown.tsx
|
|
30322
|
+
/**
|
|
30323
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
30324
|
+
*
|
|
30325
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
30326
|
+
* you may not use this file except in compliance with the License.
|
|
30327
|
+
* You may obtain a copy of the License at
|
|
30328
|
+
*
|
|
30329
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
30330
|
+
*
|
|
30331
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
30332
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
30333
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
30334
|
+
* See the License for the specific language governing permissions and
|
|
30335
|
+
* limitations under the License.
|
|
30336
|
+
*/
|
|
30119
30337
|
function MobileFontFamilyDropdown(props) {
|
|
30120
30338
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
30121
30339
|
const disabled = useObservable(props.disabled$);
|
|
30122
30340
|
const { fonts } = useFontList();
|
|
30123
30341
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.MobileSelect, {
|
|
30124
30342
|
"aria-label": props.ariaLabel,
|
|
30125
|
-
className: (0, _univerjs_design.clsx)("univer-
|
|
30343
|
+
className: (0, _univerjs_design.clsx)("univer-w-full univer-min-w-0", props.className),
|
|
30126
30344
|
value: props.value,
|
|
30127
30345
|
disabled: !!(props.disabled || disabled),
|
|
30128
30346
|
options: fonts.map((font) => ({
|
|
30129
30347
|
value: font.value,
|
|
30130
30348
|
label: localeService.t(font.label)
|
|
30131
30349
|
})),
|
|
30132
|
-
onChange: props.onChange
|
|
30350
|
+
onChange: props.onChange,
|
|
30351
|
+
size: "small"
|
|
30133
30352
|
});
|
|
30134
30353
|
}
|
|
30135
30354
|
|
|
@@ -30305,7 +30524,12 @@ Object.defineProperty(exports, "DesktopRibbonService", {
|
|
|
30305
30524
|
return DesktopRibbonService;
|
|
30306
30525
|
}
|
|
30307
30526
|
});
|
|
30308
|
-
exports
|
|
30527
|
+
Object.defineProperty(exports, "DesktopSidebarService", {
|
|
30528
|
+
enumerable: true,
|
|
30529
|
+
get: function () {
|
|
30530
|
+
return DesktopSidebarService;
|
|
30531
|
+
}
|
|
30532
|
+
});
|
|
30309
30533
|
Object.defineProperty(exports, "DesktopUIController", {
|
|
30310
30534
|
enumerable: true,
|
|
30311
30535
|
get: function () {
|