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