@univerjs/ui 1.0.0-alpha.2 → 1.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +2 -0
- package/lib/cjs/index.js +1174 -798
- package/lib/cjs/locale/ar-SA.js +11 -0
- package/lib/cjs/locale/ca-ES.js +11 -0
- package/lib/cjs/locale/de-DE.js +11 -0
- package/lib/cjs/locale/en-US.js +11 -0
- package/lib/cjs/locale/es-ES.js +11 -0
- package/lib/cjs/locale/fa-IR.js +11 -0
- package/lib/cjs/locale/fr-FR.js +11 -0
- package/lib/cjs/locale/id-ID.js +11 -0
- package/lib/cjs/locale/it-IT.js +11 -0
- package/lib/cjs/locale/ja-JP.js +11 -0
- package/lib/cjs/locale/ko-KR.js +11 -0
- package/lib/cjs/locale/pl-PL.js +11 -0
- package/lib/cjs/locale/pt-BR.js +11 -0
- package/lib/cjs/locale/ru-RU.js +11 -0
- package/lib/cjs/locale/sk-SK.js +11 -0
- package/lib/cjs/locale/vi-VN.js +11 -0
- package/lib/cjs/locale/zh-CN.js +11 -0
- package/lib/cjs/locale/zh-HK.js +11 -0
- package/lib/cjs/locale/zh-TW.js +11 -0
- package/lib/es/facade.js +2 -0
- package/lib/es/index.js +1168 -803
- package/lib/es/locale/ar-SA.js +11 -0
- package/lib/es/locale/ca-ES.js +11 -0
- package/lib/es/locale/de-DE.js +11 -0
- package/lib/es/locale/en-US.js +11 -0
- package/lib/es/locale/es-ES.js +11 -0
- package/lib/es/locale/fa-IR.js +11 -0
- package/lib/es/locale/fr-FR.js +11 -0
- package/lib/es/locale/id-ID.js +11 -0
- package/lib/es/locale/it-IT.js +11 -0
- package/lib/es/locale/ja-JP.js +11 -0
- package/lib/es/locale/ko-KR.js +11 -0
- package/lib/es/locale/pl-PL.js +11 -0
- package/lib/es/locale/pt-BR.js +11 -0
- package/lib/es/locale/ru-RU.js +11 -0
- package/lib/es/locale/sk-SK.js +11 -0
- package/lib/es/locale/vi-VN.js +11 -0
- package/lib/es/locale/zh-CN.js +11 -0
- package/lib/es/locale/zh-HK.js +11 -0
- package/lib/es/locale/zh-TW.js +11 -0
- package/lib/facade.js +2 -0
- package/lib/index.css +5 -12
- package/lib/index.js +1168 -803
- package/lib/locale/ar-SA.js +11 -0
- package/lib/locale/ca-ES.js +11 -0
- package/lib/locale/de-DE.js +11 -0
- package/lib/locale/en-US.js +11 -0
- package/lib/locale/es-ES.js +11 -0
- package/lib/locale/fa-IR.js +11 -0
- package/lib/locale/fr-FR.js +11 -0
- package/lib/locale/id-ID.js +11 -0
- package/lib/locale/it-IT.js +11 -0
- package/lib/locale/ja-JP.js +11 -0
- package/lib/locale/ko-KR.js +11 -0
- package/lib/locale/pl-PL.js +11 -0
- package/lib/locale/pt-BR.js +11 -0
- package/lib/locale/ru-RU.js +11 -0
- package/lib/locale/sk-SK.js +11 -0
- package/lib/locale/vi-VN.js +11 -0
- package/lib/locale/zh-CN.js +11 -0
- package/lib/locale/zh-HK.js +11 -0
- package/lib/locale/zh-TW.js +11 -0
- package/lib/types/commands/operations/toggle-fullscreen.operation.d.ts +17 -0
- package/lib/types/controllers/ui/ui-desktop.controller.d.ts +1 -3
- package/lib/types/controllers/ui/ui-mobile.controller.d.ts +1 -3
- package/lib/types/facade/f-menu-builder.d.ts +2 -0
- package/lib/types/index.d.ts +8 -3
- package/lib/types/locale/en-US.d.ts +13 -0
- package/lib/types/services/before-close/before-close.service.d.ts +3 -2
- package/lib/types/services/contextmenu/contextmenu.service.d.ts +6 -3
- package/lib/types/services/dom/canvas-dom-layer.service.d.ts +52 -1
- package/lib/types/services/menu/menu-manager.service.d.ts +1 -0
- package/lib/types/services/menu/menu.d.ts +3 -2
- package/lib/types/services/menu/types.d.ts +1 -0
- package/lib/types/services/popup/canvas-popup.service.d.ts +5 -1
- package/lib/types/services/ribbon/ribbon-override.service.d.ts +42 -0
- package/lib/types/services/runtime-scope/ui-runtime-scope.service.d.ts +32 -0
- package/lib/types/services/shortcut/shortcut.service.d.ts +2 -1
- package/lib/types/utils/embed-boundary.d.ts +23 -0
- package/lib/types/utils/index.d.ts +1 -0
- package/lib/types/views/components/context-menu/AnchoredContextMenu.d.ts +4 -0
- package/lib/types/views/components/context-menu/ContextMenuPanel.d.ts +4 -0
- package/lib/types/views/components/dom/FloatDom.d.ts +12 -1
- package/lib/types/views/components/dom/Print.d.ts +1 -1
- package/lib/types/views/components/dom/float-dom-layout.d.ts +35 -0
- package/lib/types/views/components/ribbon/Ribbon.d.ts +2 -0
- package/lib/types/views/components/ribbon/TooltipButtonWrapper.d.ts +6 -1
- package/lib/types/views/emoji-picker/emoji-picker-utils.d.ts +1 -1
- package/lib/types/views/index.d.ts +1 -1
- package/lib/types/views/menu/mobile/MobileMenu.d.ts +2 -0
- package/lib/types/views/slider/ZoomInput.d.ts +25 -0
- package/lib/types/views/slider/index.d.ts +1 -0
- package/lib/umd/index.js +15 -22
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +9 -9
package/lib/cjs/index.js
CHANGED
|
@@ -10,6 +10,47 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
10
10
|
let react_dom = require("react-dom");
|
|
11
11
|
let _univerjs_icons = require("@univerjs/icons");
|
|
12
12
|
|
|
13
|
+
//#region src/utils/embed-boundary.ts
|
|
14
|
+
/**
|
|
15
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
16
|
+
*
|
|
17
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
18
|
+
* you may not use this file except in compliance with the License.
|
|
19
|
+
* You may obtain a copy of the License at
|
|
20
|
+
*
|
|
21
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
+
*
|
|
23
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
24
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
25
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26
|
+
* See the License for the specific language governing permissions and
|
|
27
|
+
* limitations under the License.
|
|
28
|
+
*/
|
|
29
|
+
const EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE = "data-embed-interaction-boundary-owner";
|
|
30
|
+
function getEmbedBoundaryOwner(target) {
|
|
31
|
+
var _ref, _getAttributeValue;
|
|
32
|
+
if (!hasClosest(target)) return;
|
|
33
|
+
const ownerElement = target.closest(`[${EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE}]`);
|
|
34
|
+
return (_ref = (_getAttributeValue = getAttributeValue(target, "data-embed-interaction-boundary-owner")) !== null && _getAttributeValue !== void 0 ? _getAttributeValue : getAttributeValue(ownerElement, "data-embed-interaction-boundary-owner")) !== null && _ref !== void 0 ? _ref : void 0;
|
|
35
|
+
}
|
|
36
|
+
function isEmbedBoundaryTarget(target) {
|
|
37
|
+
return hasClosest(target) && target.closest(`[${"data-embed-interaction-boundary-owner"}]`) != null;
|
|
38
|
+
}
|
|
39
|
+
function keepInteractionInsideSameEmbedBoundary(event) {
|
|
40
|
+
const owner = getEmbedBoundaryOwner(event.currentTarget);
|
|
41
|
+
if (!owner) return;
|
|
42
|
+
if (getEmbedBoundaryOwner(event.target) === owner) event.preventDefault();
|
|
43
|
+
}
|
|
44
|
+
function hasClosest(target) {
|
|
45
|
+
return !!target && typeof target.closest === "function";
|
|
46
|
+
}
|
|
47
|
+
function getAttributeValue(target, name) {
|
|
48
|
+
var _getAttribute$call;
|
|
49
|
+
const getAttribute = target === null || target === void 0 ? void 0 : target.getAttribute;
|
|
50
|
+
return typeof getAttribute === "function" ? (_getAttribute$call = getAttribute.call(target, name)) !== null && _getAttribute$call !== void 0 ? _getAttribute$call : void 0 : void 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
13
54
|
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
|
|
14
55
|
function _typeof(o) {
|
|
15
56
|
"@babel/helpers - typeof";
|
|
@@ -51,6 +92,157 @@ function _defineProperty(e, r, t) {
|
|
|
51
92
|
}) : e[r] = t, e;
|
|
52
93
|
}
|
|
53
94
|
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
|
|
97
|
+
function __decorateParam(paramIndex, decorator) {
|
|
98
|
+
return function(target, key) {
|
|
99
|
+
decorator(target, key, paramIndex);
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
|
|
105
|
+
function __decorate(decorators, target, key, desc) {
|
|
106
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
107
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
108
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
109
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/services/layout/layout.service.ts
|
|
114
|
+
const FOCUSING_UNIVER = "FOCUSING_UNIVER";
|
|
115
|
+
const givingBackFocusElements = [
|
|
116
|
+
"app-layout",
|
|
117
|
+
"button",
|
|
118
|
+
"sheet-bar-append-button",
|
|
119
|
+
"render-canvas",
|
|
120
|
+
"workbench-layout"
|
|
121
|
+
];
|
|
122
|
+
const ILayoutService = (0, _univerjs_core.createIdentifier)("ui.layout-service");
|
|
123
|
+
let DesktopLayoutService = class DesktopLayoutService extends _univerjs_core.Disposable {
|
|
124
|
+
get isFocused() {
|
|
125
|
+
return this._isFocused;
|
|
126
|
+
}
|
|
127
|
+
constructor(_contextService, _univerInstanceService) {
|
|
128
|
+
super();
|
|
129
|
+
this._contextService = _contextService;
|
|
130
|
+
this._univerInstanceService = _univerInstanceService;
|
|
131
|
+
_defineProperty(this, "_rootContainerElement", null);
|
|
132
|
+
_defineProperty(this, "_isFocused", false);
|
|
133
|
+
_defineProperty(this, "_focusHandlers", /* @__PURE__ */ new Map());
|
|
134
|
+
_defineProperty(this, "_contentElements", []);
|
|
135
|
+
_defineProperty(this, "_allContainers", []);
|
|
136
|
+
this._initUniverFocusListener();
|
|
137
|
+
this._initEditorStatus();
|
|
138
|
+
}
|
|
139
|
+
get rootContainerElement() {
|
|
140
|
+
return this._rootContainerElement;
|
|
141
|
+
}
|
|
142
|
+
focus() {
|
|
143
|
+
const currentFocused = this._univerInstanceService.getFocusedUnit();
|
|
144
|
+
if (!currentFocused) return;
|
|
145
|
+
let handler;
|
|
146
|
+
if (currentFocused instanceof _univerjs_core.Workbook) handler = this._focusHandlers.get(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
147
|
+
else if (currentFocused instanceof _univerjs_core.DocumentDataModel) handler = this._focusHandlers.get(_univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
148
|
+
else if ((currentFocused === null || currentFocused === void 0 ? void 0 : currentFocused.type) === _univerjs_core.UniverInstanceType.UNIVER_SLIDE) handler = this._focusHandlers.get(_univerjs_core.UniverInstanceType.UNIVER_SLIDE);
|
|
149
|
+
if (handler) handler(currentFocused.getUnitId());
|
|
150
|
+
}
|
|
151
|
+
registerFocusHandler(type, handler) {
|
|
152
|
+
if (this._focusHandlers.has(type)) throw new Error(`[DesktopLayoutService]: handler of type ${type} bas been registered!`);
|
|
153
|
+
this._focusHandlers.set(type, handler);
|
|
154
|
+
return (0, _univerjs_core.toDisposable)(() => this._focusHandlers.delete(type));
|
|
155
|
+
}
|
|
156
|
+
registerContentElement(container) {
|
|
157
|
+
if (this._contentElements.indexOf(container) === -1) {
|
|
158
|
+
this._contentElements.push(container);
|
|
159
|
+
return (0, _univerjs_core.toDisposable)(() => (0, _univerjs_core.remove)(this._contentElements, container));
|
|
160
|
+
}
|
|
161
|
+
throw new Error("[DesktopLayoutService]: content container already registered!");
|
|
162
|
+
}
|
|
163
|
+
getContentElement() {
|
|
164
|
+
return this._contentElements[0];
|
|
165
|
+
}
|
|
166
|
+
registerRootContainerElement(container) {
|
|
167
|
+
if (this._rootContainerElement) throw new Error("[DesktopLayoutService]: root container already registered!");
|
|
168
|
+
this._rootContainerElement = container;
|
|
169
|
+
const dis = this.registerContainerElement(container);
|
|
170
|
+
return (0, _univerjs_core.toDisposable)(() => {
|
|
171
|
+
this._rootContainerElement = null;
|
|
172
|
+
dis.dispose();
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
registerContainerElement(container) {
|
|
176
|
+
if (this._allContainers.indexOf(container) === -1) {
|
|
177
|
+
this._allContainers.push(container);
|
|
178
|
+
return (0, _univerjs_core.toDisposable)(() => (0, _univerjs_core.remove)(this._allContainers, container));
|
|
179
|
+
}
|
|
180
|
+
throw new Error("[LayoutService]: container already registered!");
|
|
181
|
+
}
|
|
182
|
+
checkElementInCurrentContainers(element) {
|
|
183
|
+
return this._allContainers.some((container) => container.contains(element));
|
|
184
|
+
}
|
|
185
|
+
checkContentIsFocused() {
|
|
186
|
+
return this._contentElements.some((contentEl) => contentEl === document.activeElement || contentEl.contains(document.activeElement));
|
|
187
|
+
}
|
|
188
|
+
_initUniverFocusListener() {
|
|
189
|
+
this.disposeWithMe((0, rxjs.fromEvent)(window, "focusin").subscribe((event) => {
|
|
190
|
+
var _this$_rootContainerE;
|
|
191
|
+
const target = event.target;
|
|
192
|
+
if (((_this$_rootContainerE = this._rootContainerElement) === null || _this$_rootContainerE === void 0 ? void 0 : _this$_rootContainerE.contains(target)) && givingBackFocusElements.some((item) => target.dataset.uComp === item) && !isEmbedBoundaryTarget(target)) {
|
|
193
|
+
queueMicrotask(() => {
|
|
194
|
+
const targetUnitId = getFocusUnitIdFromElement(target);
|
|
195
|
+
if (targetUnitId && this._univerInstanceService.getUnit(targetUnitId)) this._univerInstanceService.focusUnit(targetUnitId);
|
|
196
|
+
this.focus();
|
|
197
|
+
this._isFocused = true;
|
|
198
|
+
this._contextService.setContextValue(FOCUSING_UNIVER, this._isFocused);
|
|
199
|
+
this._contextService.setContextValue(_univerjs_core.FOCUSING_UNIVER_EDITOR, getFocusingUniverEditorStatus());
|
|
200
|
+
});
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (target && this.checkElementInCurrentContainers(target)) this._isFocused = true;
|
|
204
|
+
else this._isFocused = false;
|
|
205
|
+
this._contextService.setContextValue(FOCUSING_UNIVER, this._isFocused);
|
|
206
|
+
this._contextService.setContextValue(_univerjs_core.FOCUSING_UNIVER_EDITOR, getFocusingUniverEditorStatus());
|
|
207
|
+
}));
|
|
208
|
+
}
|
|
209
|
+
_initEditorStatus() {
|
|
210
|
+
this._contextService.setContextValue(_univerjs_core.FOCUSING_UNIVER_EDITOR, getFocusingUniverEditorStatus());
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
DesktopLayoutService = __decorate([__decorateParam(0, _univerjs_core.IContextService), __decorateParam(1, _univerjs_core.IUniverInstanceService)], DesktopLayoutService);
|
|
214
|
+
function getFocusingUniverEditorStatus() {
|
|
215
|
+
var _document$activeEleme;
|
|
216
|
+
return ((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.dataset.uComp) === "editor";
|
|
217
|
+
}
|
|
218
|
+
function getFocusUnitIdFromElement(target) {
|
|
219
|
+
return target.dataset.uUnitId;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
//#endregion
|
|
223
|
+
//#region src/commands/operations/toggle-fullscreen.operation.ts
|
|
224
|
+
const ToggleFullscreenOperation = {
|
|
225
|
+
id: "base-ui.operation.toggle-fullscreen",
|
|
226
|
+
type: _univerjs_core.CommandType.OPERATION,
|
|
227
|
+
handler: (accessor) => {
|
|
228
|
+
const root = accessor.get(ILayoutService).rootContainerElement;
|
|
229
|
+
if (!root) return false;
|
|
230
|
+
const document = root.ownerDocument;
|
|
231
|
+
try {
|
|
232
|
+
if (document.fullscreenElement) {
|
|
233
|
+
if (!document.exitFullscreen) return false;
|
|
234
|
+
document.exitFullscreen().catch(() => {});
|
|
235
|
+
} else {
|
|
236
|
+
if (!root.requestFullscreen) return false;
|
|
237
|
+
root.requestFullscreen().catch(() => {});
|
|
238
|
+
}
|
|
239
|
+
return true;
|
|
240
|
+
} catch {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
|
|
54
246
|
//#endregion
|
|
55
247
|
//#region src/services/shortcut/shortcut-panel.service.ts
|
|
56
248
|
/**
|
|
@@ -118,23 +310,6 @@ const ToggleShortcutPanelOperation = {
|
|
|
118
310
|
}
|
|
119
311
|
};
|
|
120
312
|
|
|
121
|
-
//#endregion
|
|
122
|
-
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
|
|
123
|
-
function __decorateParam(paramIndex, decorator) {
|
|
124
|
-
return function(target, key) {
|
|
125
|
-
decorator(target, key, paramIndex);
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
//#endregion
|
|
130
|
-
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
|
|
131
|
-
function __decorate(decorators, target, key, desc) {
|
|
132
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
133
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
134
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
135
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
313
|
//#endregion
|
|
139
314
|
//#region src/common/component-manager.ts
|
|
140
315
|
let ComponentManager = class ComponentManager extends _univerjs_core.Disposable {
|
|
@@ -625,106 +800,6 @@ function fromGlobalEvent(type, listener, options) {
|
|
|
625
800
|
return (0, _univerjs_core.toDisposable)(() => window.removeEventListener(type, listener, options));
|
|
626
801
|
}
|
|
627
802
|
|
|
628
|
-
//#endregion
|
|
629
|
-
//#region src/services/layout/layout.service.ts
|
|
630
|
-
const FOCUSING_UNIVER = "FOCUSING_UNIVER";
|
|
631
|
-
const givingBackFocusElements = [
|
|
632
|
-
"app-layout",
|
|
633
|
-
"button",
|
|
634
|
-
"sheet-bar-append-button",
|
|
635
|
-
"render-canvas",
|
|
636
|
-
"workbench-layout"
|
|
637
|
-
];
|
|
638
|
-
const ILayoutService = (0, _univerjs_core.createIdentifier)("ui.layout-service");
|
|
639
|
-
let DesktopLayoutService = class DesktopLayoutService extends _univerjs_core.Disposable {
|
|
640
|
-
get isFocused() {
|
|
641
|
-
return this._isFocused;
|
|
642
|
-
}
|
|
643
|
-
constructor(_contextService, _univerInstanceService) {
|
|
644
|
-
super();
|
|
645
|
-
this._contextService = _contextService;
|
|
646
|
-
this._univerInstanceService = _univerInstanceService;
|
|
647
|
-
_defineProperty(this, "_rootContainerElement", null);
|
|
648
|
-
_defineProperty(this, "_isFocused", false);
|
|
649
|
-
_defineProperty(this, "_focusHandlers", /* @__PURE__ */ new Map());
|
|
650
|
-
_defineProperty(this, "_contentElements", []);
|
|
651
|
-
_defineProperty(this, "_allContainers", []);
|
|
652
|
-
this._initUniverFocusListener();
|
|
653
|
-
this._initEditorStatus();
|
|
654
|
-
}
|
|
655
|
-
get rootContainerElement() {
|
|
656
|
-
return this._rootContainerElement;
|
|
657
|
-
}
|
|
658
|
-
focus() {
|
|
659
|
-
const currentFocused = this._univerInstanceService.getFocusedUnit();
|
|
660
|
-
if (!currentFocused) return;
|
|
661
|
-
let handler;
|
|
662
|
-
if (currentFocused instanceof _univerjs_core.Workbook) handler = this._focusHandlers.get(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
663
|
-
else if (currentFocused instanceof _univerjs_core.DocumentDataModel) handler = this._focusHandlers.get(_univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
664
|
-
else if ((currentFocused === null || currentFocused === void 0 ? void 0 : currentFocused.type) === _univerjs_core.UniverInstanceType.UNIVER_SLIDE) handler = this._focusHandlers.get(_univerjs_core.UniverInstanceType.UNIVER_SLIDE);
|
|
665
|
-
if (handler) handler(currentFocused.getUnitId());
|
|
666
|
-
}
|
|
667
|
-
registerFocusHandler(type, handler) {
|
|
668
|
-
if (this._focusHandlers.has(type)) throw new Error(`[DesktopLayoutService]: handler of type ${type} bas been registered!`);
|
|
669
|
-
this._focusHandlers.set(type, handler);
|
|
670
|
-
return (0, _univerjs_core.toDisposable)(() => this._focusHandlers.delete(type));
|
|
671
|
-
}
|
|
672
|
-
registerContentElement(container) {
|
|
673
|
-
if (this._contentElements.indexOf(container) === -1) {
|
|
674
|
-
this._contentElements.push(container);
|
|
675
|
-
return (0, _univerjs_core.toDisposable)(() => (0, _univerjs_core.remove)(this._contentElements, container));
|
|
676
|
-
}
|
|
677
|
-
throw new Error("[DesktopLayoutService]: content container already registered!");
|
|
678
|
-
}
|
|
679
|
-
getContentElement() {
|
|
680
|
-
return this._contentElements[0];
|
|
681
|
-
}
|
|
682
|
-
registerRootContainerElement(container) {
|
|
683
|
-
if (this._rootContainerElement) throw new Error("[DesktopLayoutService]: root container already registered!");
|
|
684
|
-
this._rootContainerElement = container;
|
|
685
|
-
const dis = this.registerContainerElement(container);
|
|
686
|
-
return (0, _univerjs_core.toDisposable)(() => {
|
|
687
|
-
this._rootContainerElement = null;
|
|
688
|
-
dis.dispose();
|
|
689
|
-
});
|
|
690
|
-
}
|
|
691
|
-
registerContainerElement(container) {
|
|
692
|
-
if (this._allContainers.indexOf(container) === -1) {
|
|
693
|
-
this._allContainers.push(container);
|
|
694
|
-
return (0, _univerjs_core.toDisposable)(() => (0, _univerjs_core.remove)(this._allContainers, container));
|
|
695
|
-
}
|
|
696
|
-
throw new Error("[LayoutService]: container already registered!");
|
|
697
|
-
}
|
|
698
|
-
checkElementInCurrentContainers(element) {
|
|
699
|
-
return this._allContainers.some((container) => container.contains(element));
|
|
700
|
-
}
|
|
701
|
-
checkContentIsFocused() {
|
|
702
|
-
return this._contentElements.some((contentEl) => contentEl === document.activeElement || contentEl.contains(document.activeElement));
|
|
703
|
-
}
|
|
704
|
-
_initUniverFocusListener() {
|
|
705
|
-
this.disposeWithMe((0, rxjs.fromEvent)(window, "focusin").subscribe((event) => {
|
|
706
|
-
var _this$_rootContainerE;
|
|
707
|
-
const target = event.target;
|
|
708
|
-
if (((_this$_rootContainerE = this._rootContainerElement) === null || _this$_rootContainerE === void 0 ? void 0 : _this$_rootContainerE.contains(target)) && givingBackFocusElements.some((item) => target.dataset.uComp === item)) {
|
|
709
|
-
queueMicrotask(() => this.focus());
|
|
710
|
-
return;
|
|
711
|
-
}
|
|
712
|
-
if (target && this.checkElementInCurrentContainers(target)) this._isFocused = true;
|
|
713
|
-
else this._isFocused = false;
|
|
714
|
-
this._contextService.setContextValue(FOCUSING_UNIVER, this._isFocused);
|
|
715
|
-
this._contextService.setContextValue(_univerjs_core.FOCUSING_UNIVER_EDITOR, getFocusingUniverEditorStatus());
|
|
716
|
-
}));
|
|
717
|
-
}
|
|
718
|
-
_initEditorStatus() {
|
|
719
|
-
this._contextService.setContextValue(_univerjs_core.FOCUSING_UNIVER_EDITOR, getFocusingUniverEditorStatus());
|
|
720
|
-
}
|
|
721
|
-
};
|
|
722
|
-
DesktopLayoutService = __decorate([__decorateParam(0, _univerjs_core.IContextService), __decorateParam(1, _univerjs_core.IUniverInstanceService)], DesktopLayoutService);
|
|
723
|
-
function getFocusingUniverEditorStatus() {
|
|
724
|
-
var _document$activeEleme;
|
|
725
|
-
return ((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.dataset.uComp) === "editor";
|
|
726
|
-
}
|
|
727
|
-
|
|
728
803
|
//#endregion
|
|
729
804
|
//#region src/services/platform/platform.service.ts
|
|
730
805
|
/**
|
|
@@ -845,6 +920,7 @@ let ShortcutService = class ShortcutService extends _univerjs_core.Disposable {
|
|
|
845
920
|
if (this._layoutService && !this._layoutService.checkElementInCurrentContainers(e.target)) return;
|
|
846
921
|
const binding = this._deriveBindingFromEvent(e);
|
|
847
922
|
if (binding === null) return;
|
|
923
|
+
if (this._shouldLetEmbedTextEditorHandleNativeShortcut(e, binding)) return;
|
|
848
924
|
const shortcuts = this._shortCutMapping.get(binding);
|
|
849
925
|
if (shortcuts === void 0) return;
|
|
850
926
|
return Array.from(shortcuts).sort((s1, s2) => {
|
|
@@ -870,6 +946,12 @@ let ShortcutService = class ShortcutService extends _univerjs_core.Disposable {
|
|
|
870
946
|
if (this._platformService.isMac && e.ctrlKey) binding |= 8192;
|
|
871
947
|
return binding;
|
|
872
948
|
}
|
|
949
|
+
_shouldLetEmbedTextEditorHandleNativeShortcut(e, binding) {
|
|
950
|
+
if (binding !== (65 | 4096)) return false;
|
|
951
|
+
const target = e.target;
|
|
952
|
+
if (!(target instanceof HTMLElement)) return false;
|
|
953
|
+
return (target.isContentEditable || target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) && isEmbedBoundaryTarget(target);
|
|
954
|
+
}
|
|
873
955
|
};
|
|
874
956
|
ShortcutService = __decorate([
|
|
875
957
|
__decorateParam(0, _univerjs_core.ICommandService),
|
|
@@ -941,6 +1023,7 @@ let SharedController = class SharedController extends _univerjs_core.Disposable
|
|
|
941
1023
|
this._registerShortcuts();
|
|
942
1024
|
}
|
|
943
1025
|
_registerCommands() {
|
|
1026
|
+
this.disposeWithMe(this._commandService.registerCommand(ToggleFullscreenOperation));
|
|
944
1027
|
[
|
|
945
1028
|
CutCommand,
|
|
946
1029
|
CopyCommand,
|
|
@@ -995,6 +1078,7 @@ let RibbonStartGroup = /* @__PURE__ */ function(RibbonStartGroup) {
|
|
|
995
1078
|
}({});
|
|
996
1079
|
let RibbonInsertGroup = /* @__PURE__ */ function(RibbonInsertGroup) {
|
|
997
1080
|
RibbonInsertGroup["EDIT"] = "ribbon.insert.edit";
|
|
1081
|
+
RibbonInsertGroup["CELL"] = "ribbon.insert.cell";
|
|
998
1082
|
RibbonInsertGroup["MEDIA"] = "ribbon.insert.media";
|
|
999
1083
|
RibbonInsertGroup["OTHERS"] = "ribbon.insert.others";
|
|
1000
1084
|
return RibbonInsertGroup;
|
|
@@ -1051,8 +1135,9 @@ let ContextMenuGroup = /* @__PURE__ */ function(ContextMenuGroup) {
|
|
|
1051
1135
|
|
|
1052
1136
|
//#endregion
|
|
1053
1137
|
//#region src/services/menu/menu-manager.service.ts
|
|
1138
|
+
var _MenuManagerService;
|
|
1054
1139
|
const IMenuManagerService = (0, _univerjs_core.createIdentifier)("univer.menu-manager-service");
|
|
1055
|
-
let MenuManagerService = class MenuManagerService extends _univerjs_core.Disposable {
|
|
1140
|
+
let MenuManagerService = _MenuManagerService = class MenuManagerService extends _univerjs_core.Disposable {
|
|
1056
1141
|
constructor(_injector, _configService) {
|
|
1057
1142
|
super();
|
|
1058
1143
|
this._injector = _injector;
|
|
@@ -1073,7 +1158,8 @@ let MenuManagerService = class MenuManagerService extends _univerjs_core.Disposa
|
|
|
1073
1158
|
title: "ui.ribbon.insert",
|
|
1074
1159
|
["ribbon.insert.edit"]: { order: 0 },
|
|
1075
1160
|
["ribbon.insert.media"]: { order: 1 },
|
|
1076
|
-
["ribbon.insert.
|
|
1161
|
+
["ribbon.insert.cell"]: { order: 2 },
|
|
1162
|
+
["ribbon.insert.others"]: { order: 3 }
|
|
1077
1163
|
},
|
|
1078
1164
|
["ribbon.formulas"]: {
|
|
1079
1165
|
order: 2,
|
|
@@ -1186,6 +1272,21 @@ let MenuManagerService = class MenuManagerService extends _univerjs_core.Disposa
|
|
|
1186
1272
|
this._menu = (0, _univerjs_core.merge)({}, this._menu, source);
|
|
1187
1273
|
this.menuChanged$.next();
|
|
1188
1274
|
}
|
|
1275
|
+
createScoped(injector) {
|
|
1276
|
+
const root = this;
|
|
1277
|
+
const createScopedBuilder = () => {
|
|
1278
|
+
const service = new _MenuManagerService(injector, root._configService);
|
|
1279
|
+
service._menu = root._menu;
|
|
1280
|
+
return service;
|
|
1281
|
+
};
|
|
1282
|
+
return {
|
|
1283
|
+
menuChanged$: root.menuChanged$,
|
|
1284
|
+
mergeMenu: (source, target) => root.mergeMenu(source, target),
|
|
1285
|
+
appendRootMenu: (source) => root.appendRootMenu(source),
|
|
1286
|
+
getMenuByPositionKey: (position) => createScopedBuilder().getMenuByPositionKey(position),
|
|
1287
|
+
getFlatMenuByPositionKey: (position) => createScopedBuilder().getFlatMenuByPositionKey(position)
|
|
1288
|
+
};
|
|
1289
|
+
}
|
|
1189
1290
|
_buildMenuSchema(data) {
|
|
1190
1291
|
const result = [];
|
|
1191
1292
|
for (const [key, value] of Object.entries(data)) {
|
|
@@ -1225,6 +1326,7 @@ let MenuManagerService = class MenuManagerService extends _univerjs_core.Disposa
|
|
|
1225
1326
|
* @returns Menu schema array or empty array if not found
|
|
1226
1327
|
*/
|
|
1227
1328
|
getMenuByPositionKey(key) {
|
|
1329
|
+
var _findKey;
|
|
1228
1330
|
const findKey = (obj) => {
|
|
1229
1331
|
if (key in obj) return this._buildMenuSchema(obj[key]);
|
|
1230
1332
|
for (const k in obj) {
|
|
@@ -1235,7 +1337,7 @@ let MenuManagerService = class MenuManagerService extends _univerjs_core.Disposa
|
|
|
1235
1337
|
}
|
|
1236
1338
|
}
|
|
1237
1339
|
};
|
|
1238
|
-
return findKey(this._menu);
|
|
1340
|
+
return (_findKey = findKey(this._menu)) !== null && _findKey !== void 0 ? _findKey : [];
|
|
1239
1341
|
}
|
|
1240
1342
|
/**
|
|
1241
1343
|
* Get flat menu schema by position key
|
|
@@ -1257,7 +1359,7 @@ let MenuManagerService = class MenuManagerService extends _univerjs_core.Disposa
|
|
|
1257
1359
|
return flatMenuItems(menu);
|
|
1258
1360
|
}
|
|
1259
1361
|
};
|
|
1260
|
-
MenuManagerService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), __decorateParam(1, _univerjs_core.IConfigService)], MenuManagerService);
|
|
1362
|
+
MenuManagerService = _MenuManagerService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), __decorateParam(1, _univerjs_core.IConfigService)], MenuManagerService);
|
|
1261
1363
|
function normalizeMenuOrder(order) {
|
|
1262
1364
|
return order !== null && order !== void 0 ? order : 0;
|
|
1263
1365
|
}
|
|
@@ -1334,11 +1436,14 @@ const undoRedoDisableFactory$ = (accessor, isUndo) => {
|
|
|
1334
1436
|
return undoDisable || contextService.getContextValue(_univerjs_core.EDITOR_ACTIVATED) || contextService.getContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR);
|
|
1335
1437
|
}));
|
|
1336
1438
|
};
|
|
1439
|
+
const rtlIconFactory$ = (accessor, ltrIcon, rtlIcon) => {
|
|
1440
|
+
return accessor.get(_univerjs_core.LocaleService).direction$.pipe((0, rxjs_operators.map)((direction) => direction === "rtl" ? rtlIcon : ltrIcon));
|
|
1441
|
+
};
|
|
1337
1442
|
function UndoMenuItemFactory(accessor) {
|
|
1338
1443
|
return {
|
|
1339
1444
|
id: _univerjs_core.UndoCommand.id,
|
|
1340
1445
|
type: 0,
|
|
1341
|
-
icon: "UndoIcon",
|
|
1446
|
+
icon: rtlIconFactory$(accessor, "UndoIcon", "RedoIcon"),
|
|
1342
1447
|
title: "ui.shortcut.undo",
|
|
1343
1448
|
tooltip: "ui.shortcut.undo",
|
|
1344
1449
|
disabled$: undoRedoDisableFactory$(accessor, true)
|
|
@@ -1348,7 +1453,7 @@ function RedoMenuItemFactory(accessor) {
|
|
|
1348
1453
|
return {
|
|
1349
1454
|
id: _univerjs_core.RedoCommand.id,
|
|
1350
1455
|
type: 0,
|
|
1351
|
-
icon: "RedoIcon",
|
|
1456
|
+
icon: rtlIconFactory$(accessor, "RedoIcon", "UndoIcon"),
|
|
1352
1457
|
title: "ui.shortcut.redo",
|
|
1353
1458
|
tooltip: "ui.shortcut.redo",
|
|
1354
1459
|
disabled$: undoRedoDisableFactory$(accessor, false)
|
|
@@ -1469,8 +1574,15 @@ function useObservableRef(observable, defaultValue) {
|
|
|
1469
1574
|
|
|
1470
1575
|
//#endregion
|
|
1471
1576
|
//#region src/services/dom/canvas-dom-layer.service.ts
|
|
1472
|
-
|
|
1473
|
-
|
|
1577
|
+
function shouldForwardFloatDomEvents(layer) {
|
|
1578
|
+
return layer.eventPassThrough !== false;
|
|
1579
|
+
}
|
|
1580
|
+
function shouldRenderFloatDomLayer(layer, currentUnitId) {
|
|
1581
|
+
return layer.unitId === currentUnitId || layer.preserveOnFocusChange === true;
|
|
1582
|
+
}
|
|
1583
|
+
var CanvasFloatDomService = class extends _univerjs_core.Disposable {
|
|
1584
|
+
constructor(..._args) {
|
|
1585
|
+
super(..._args);
|
|
1474
1586
|
_defineProperty(this, "_domLayerMap", /* @__PURE__ */ new Map());
|
|
1475
1587
|
_defineProperty(this, "_domLayers$", new rxjs.BehaviorSubject([]));
|
|
1476
1588
|
_defineProperty(this, "domLayers$", this._domLayers$.asObservable());
|
|
@@ -1501,68 +1613,147 @@ var CanvasFloatDomService = class {
|
|
|
1501
1613
|
this._domLayerMap.clear();
|
|
1502
1614
|
this._notice();
|
|
1503
1615
|
}
|
|
1616
|
+
dispose() {
|
|
1617
|
+
this._domLayerMap.clear();
|
|
1618
|
+
this._domLayers$.next([]);
|
|
1619
|
+
this._domLayers$.complete();
|
|
1620
|
+
super.dispose();
|
|
1621
|
+
}
|
|
1622
|
+
};
|
|
1623
|
+
var CanvasFloatDomPreviewService = class extends _univerjs_core.Disposable {
|
|
1624
|
+
constructor(..._args2) {
|
|
1625
|
+
super(..._args2);
|
|
1626
|
+
_defineProperty(this, "previewUpdated$", new rxjs.Subject());
|
|
1627
|
+
_defineProperty(this, "previewRequested$", new rxjs.Subject());
|
|
1628
|
+
_defineProperty(this, "_previewMap", /* @__PURE__ */ new Map());
|
|
1629
|
+
_defineProperty(this, "_requestMap", /* @__PURE__ */ new Map());
|
|
1630
|
+
}
|
|
1631
|
+
getPreview(id) {
|
|
1632
|
+
return this._previewMap.get(id);
|
|
1633
|
+
}
|
|
1634
|
+
getPendingRequests() {
|
|
1635
|
+
return Array.from(this._requestMap.values());
|
|
1636
|
+
}
|
|
1637
|
+
setPreview(preview) {
|
|
1638
|
+
this._previewMap.set(preview.id, preview);
|
|
1639
|
+
this._requestMap.delete(preview.id);
|
|
1640
|
+
this.previewUpdated$.next(preview);
|
|
1641
|
+
}
|
|
1642
|
+
removePreview(id) {
|
|
1643
|
+
this._previewMap.delete(id);
|
|
1644
|
+
this._requestMap.delete(id);
|
|
1645
|
+
}
|
|
1646
|
+
requestPreview(request) {
|
|
1647
|
+
this._requestMap.set(request.id, request);
|
|
1648
|
+
this.previewRequested$.next(request);
|
|
1649
|
+
}
|
|
1650
|
+
dispose() {
|
|
1651
|
+
this._previewMap.clear();
|
|
1652
|
+
this._requestMap.clear();
|
|
1653
|
+
this.previewUpdated$.complete();
|
|
1654
|
+
this.previewRequested$.complete();
|
|
1655
|
+
super.dispose();
|
|
1656
|
+
}
|
|
1504
1657
|
};
|
|
1505
1658
|
|
|
1659
|
+
//#endregion
|
|
1660
|
+
//#region src/views/components/dom/float-dom-layout.ts
|
|
1661
|
+
const LEGACY_WRAPPER_INSET = 2;
|
|
1662
|
+
const LEGACY_CONTENT_INSET = 4;
|
|
1663
|
+
function resolveFloatDomLayout(position, contentBox) {
|
|
1664
|
+
var _contentBox$wrapperIn, _contentBox$contentIn, _position$opacity;
|
|
1665
|
+
const wrapperInset = (_contentBox$wrapperIn = contentBox === null || contentBox === void 0 ? void 0 : contentBox.wrapperInset) !== null && _contentBox$wrapperIn !== void 0 ? _contentBox$wrapperIn : LEGACY_WRAPPER_INSET;
|
|
1666
|
+
const contentInset = (_contentBox$contentIn = contentBox === null || contentBox === void 0 ? void 0 : contentBox.contentInset) !== null && _contentBox$contentIn !== void 0 ? _contentBox$contentIn : LEGACY_CONTENT_INSET;
|
|
1667
|
+
return {
|
|
1668
|
+
wrapper: {
|
|
1669
|
+
top: position.startY,
|
|
1670
|
+
left: position.startX,
|
|
1671
|
+
width: Math.max(position.endX - position.startX - wrapperInset, 0),
|
|
1672
|
+
height: Math.max(position.endY - position.startY - wrapperInset, 0),
|
|
1673
|
+
transform: `rotate(${position.rotate}deg)`,
|
|
1674
|
+
opacity: (_position$opacity = position.opacity) !== null && _position$opacity !== void 0 ? _position$opacity : 1
|
|
1675
|
+
},
|
|
1676
|
+
inner: {
|
|
1677
|
+
width: position.width - contentInset,
|
|
1678
|
+
height: position.height - contentInset,
|
|
1679
|
+
left: position.absolute.left ? 0 : "auto",
|
|
1680
|
+
top: position.absolute.top ? 0 : "auto",
|
|
1681
|
+
right: position.absolute.left ? "auto" : 0,
|
|
1682
|
+
bottom: position.absolute.top ? "auto" : 0
|
|
1683
|
+
}
|
|
1684
|
+
};
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1506
1687
|
//#endregion
|
|
1507
1688
|
//#region src/views/components/dom/FloatDom.tsx
|
|
1689
|
+
function applyFloatDomLayout(wrapper, inner, layout) {
|
|
1690
|
+
const { wrapper: wrapperLayout, inner: innerLayout } = layout;
|
|
1691
|
+
const wrapperStyle = wrapper.style;
|
|
1692
|
+
wrapperStyle.top = `${wrapperLayout.top}px`;
|
|
1693
|
+
wrapperStyle.left = `${wrapperLayout.left}px`;
|
|
1694
|
+
wrapperStyle.width = `${wrapperLayout.width}px`;
|
|
1695
|
+
wrapperStyle.height = `${wrapperLayout.height}px`;
|
|
1696
|
+
wrapperStyle.transform = wrapperLayout.transform;
|
|
1697
|
+
wrapperStyle.opacity = `${wrapperLayout.opacity}`;
|
|
1698
|
+
const innerStyle = inner.style;
|
|
1699
|
+
innerStyle.width = `${innerLayout.width}px`;
|
|
1700
|
+
innerStyle.height = `${innerLayout.height}px`;
|
|
1701
|
+
innerStyle.left = innerLayout.left === "auto" ? "auto" : `${innerLayout.left}px`;
|
|
1702
|
+
innerStyle.top = innerLayout.top === "auto" ? "auto" : `${innerLayout.top}px`;
|
|
1703
|
+
innerStyle.right = innerLayout.right === "auto" ? "auto" : `${innerLayout.right}px`;
|
|
1704
|
+
innerStyle.bottom = innerLayout.bottom === "auto" ? "auto" : `${innerLayout.bottom}px`;
|
|
1705
|
+
}
|
|
1508
1706
|
const FloatDomSingle = (0, react.memo)((props) => {
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1707
|
+
const { layer } = props;
|
|
1708
|
+
return typeof layer.componentKey === "string" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RegisteredFloatDomSingle, {
|
|
1709
|
+
...props,
|
|
1710
|
+
componentKey: layer.componentKey
|
|
1711
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FloatDomSingleContent, {
|
|
1712
|
+
...props,
|
|
1713
|
+
Component: layer.componentKey
|
|
1714
|
+
});
|
|
1715
|
+
});
|
|
1716
|
+
function RegisteredFloatDomSingle(props) {
|
|
1717
|
+
const componentManager = (0, _wendellhu_redi_react_bindings.useDependency)(ComponentManager);
|
|
1718
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FloatDomSingleContent, {
|
|
1719
|
+
...props,
|
|
1720
|
+
Component: componentManager.get(props.componentKey)
|
|
1721
|
+
});
|
|
1722
|
+
}
|
|
1723
|
+
function FloatDomSingleContent(props) {
|
|
1724
|
+
var _layer$contentBox, _layer$contentBox2;
|
|
1725
|
+
const { layer, id, Component } = props;
|
|
1512
1726
|
const univerInstanceService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
1513
1727
|
const position = (0, _wendellhu_redi_react_bindings.useObservable)((0, react.useMemo)(() => layer.position$.pipe((0, rxjs.first)()), [layer.position$]));
|
|
1514
1728
|
const domRef = (0, react.useRef)(null);
|
|
1515
1729
|
const innerDomRef = (0, react.useRef)(null);
|
|
1516
|
-
const transformRef = (0, react.useRef)(`transform: rotate(${position === null || position === void 0 ? void 0 : position.rotate}deg) translate(${position === null || position === void 0 ? void 0 : position.startX}px, ${position === null || position === void 0 ? void 0 : position.startY}px)`);
|
|
1517
|
-
const topRef = (0, react.useRef)((_position$startY = position === null || position === void 0 ? void 0 : position.startY) !== null && _position$startY !== void 0 ? _position$startY : 0);
|
|
1518
|
-
const leftRef = (0, react.useRef)((_position$startX = position === null || position === void 0 ? void 0 : position.startX) !== null && _position$startX !== void 0 ? _position$startX : 0);
|
|
1519
|
-
const innerStyle = (0, react.useRef)({});
|
|
1520
|
-
const Component = typeof layer.componentKey === "string" ? (0, _wendellhu_redi_react_bindings.useDependency)(ComponentManager).get(layer.componentKey) : layer.componentKey;
|
|
1521
1730
|
const layerProps = (0, react.useMemo)(() => ({
|
|
1522
1731
|
data: layer.data,
|
|
1523
|
-
...layer.props
|
|
1524
|
-
|
|
1732
|
+
...layer.props,
|
|
1733
|
+
hostFloatDomLayout$: layer.position$
|
|
1734
|
+
}), [
|
|
1735
|
+
layer.data,
|
|
1736
|
+
layer.position$,
|
|
1737
|
+
layer.props
|
|
1738
|
+
]);
|
|
1739
|
+
const floatDomOverflow = resolveFloatDomOverflow(layerProps);
|
|
1740
|
+
const wrapperInset = (_layer$contentBox = layer.contentBox) === null || _layer$contentBox === void 0 ? void 0 : _layer$contentBox.wrapperInset;
|
|
1741
|
+
const contentInset = (_layer$contentBox2 = layer.contentBox) === null || _layer$contentBox2 === void 0 ? void 0 : _layer$contentBox2.contentInset;
|
|
1525
1742
|
(0, react.useEffect)(() => {
|
|
1526
1743
|
const subscription = layer.position$.subscribe((position) => {
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
var _position$opacity;
|
|
1532
|
-
domRef.current.style.transform = transformRef.current;
|
|
1533
|
-
domRef.current.style.top = `${topRef.current}px`;
|
|
1534
|
-
domRef.current.style.left = `${leftRef.current}px`;
|
|
1535
|
-
domRef.current.style.opacity = `${(_position$opacity = position.opacity) !== null && _position$opacity !== void 0 ? _position$opacity : 1}`;
|
|
1536
|
-
}
|
|
1537
|
-
});
|
|
1538
|
-
const sizeSubscription = size$.subscribe((size) => {
|
|
1539
|
-
if (domRef.current) {
|
|
1540
|
-
domRef.current.style.width = `${Math.max(size.endX - size.startX - 2, 0)}px`;
|
|
1541
|
-
domRef.current.style.height = `${Math.max(size.endY - size.startY - 2, 0)}px`;
|
|
1542
|
-
}
|
|
1543
|
-
if (innerDomRef.current) {
|
|
1544
|
-
const style = {
|
|
1545
|
-
width: `${size.width - 4}px`,
|
|
1546
|
-
height: `${size.height - 4}px`,
|
|
1547
|
-
left: `${size.absolute.left ? 0 : "auto"}`,
|
|
1548
|
-
top: `${size.absolute.top ? 0 : "auto"}`,
|
|
1549
|
-
right: `${size.absolute.left ? "auto" : 0}`,
|
|
1550
|
-
bottom: `${size.absolute.top ? "auto" : 0}`
|
|
1551
|
-
};
|
|
1552
|
-
innerDomRef.current.style.width = style.width;
|
|
1553
|
-
innerDomRef.current.style.height = style.height;
|
|
1554
|
-
innerDomRef.current.style.left = style.left;
|
|
1555
|
-
innerDomRef.current.style.top = style.top;
|
|
1556
|
-
innerDomRef.current.style.right = style.right;
|
|
1557
|
-
innerDomRef.current.style.bottom = style.bottom;
|
|
1558
|
-
innerStyle.current = style;
|
|
1559
|
-
}
|
|
1744
|
+
if (domRef.current && innerDomRef.current) applyFloatDomLayout(domRef.current, innerDomRef.current, resolveFloatDomLayout(position, {
|
|
1745
|
+
wrapperInset,
|
|
1746
|
+
contentInset
|
|
1747
|
+
}));
|
|
1560
1748
|
});
|
|
1561
1749
|
return () => {
|
|
1562
1750
|
subscription.unsubscribe();
|
|
1563
|
-
sizeSubscription.unsubscribe();
|
|
1564
1751
|
};
|
|
1565
|
-
}, [
|
|
1752
|
+
}, [
|
|
1753
|
+
contentInset,
|
|
1754
|
+
layer.position$,
|
|
1755
|
+
wrapperInset
|
|
1756
|
+
]);
|
|
1566
1757
|
const instance = univerInstanceService.getUnit(layer.unitId);
|
|
1567
1758
|
const docDisabled = instance instanceof _univerjs_core.DocumentDataModel ? instance.getDisabled() : void 0;
|
|
1568
1759
|
const component = (0, react.useMemo)(() => Component ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
|
|
@@ -1576,47 +1767,44 @@ const FloatDomSingle = (0, react.memo)((props) => {
|
|
|
1576
1767
|
}
|
|
1577
1768
|
}) : null, [Component, layerProps]);
|
|
1578
1769
|
if (!position) return null;
|
|
1770
|
+
const layout = resolveFloatDomLayout(position, layer.contentBox);
|
|
1579
1771
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1580
1772
|
ref: domRef,
|
|
1581
|
-
className: "univer-z-10",
|
|
1773
|
+
className: "univer-absolute univer-z-10 univer-origin-center",
|
|
1582
1774
|
style: {
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
left: leftRef.current,
|
|
1586
|
-
width: Math.max(position.endX - position.startX - 2, 0),
|
|
1587
|
-
height: Math.max(position.endY - position.startY - 2, 0),
|
|
1588
|
-
transform: transformRef.current,
|
|
1589
|
-
overflow: "hidden",
|
|
1590
|
-
transformOrigin: "center center"
|
|
1775
|
+
...layout.wrapper,
|
|
1776
|
+
overflow: floatDomOverflow.outerOverflow
|
|
1591
1777
|
},
|
|
1592
1778
|
onPointerMove: (e) => {
|
|
1593
|
-
layer.onPointerMove(e.nativeEvent);
|
|
1779
|
+
if (shouldForwardFloatDomEvents(layer)) layer.onPointerMove(e.nativeEvent);
|
|
1594
1780
|
},
|
|
1595
1781
|
onPointerDown: (e) => {
|
|
1596
|
-
layer.onPointerDown(e.nativeEvent);
|
|
1782
|
+
if (shouldForwardFloatDomEvents(layer)) layer.onPointerDown(e.nativeEvent);
|
|
1597
1783
|
},
|
|
1598
1784
|
onPointerUp: (e) => {
|
|
1599
|
-
layer.onPointerUp(e.nativeEvent);
|
|
1785
|
+
if (shouldForwardFloatDomEvents(layer)) layer.onPointerUp(e.nativeEvent);
|
|
1600
1786
|
},
|
|
1601
1787
|
onWheel: (e) => {
|
|
1602
|
-
layer.onWheel(e.nativeEvent);
|
|
1788
|
+
if (shouldForwardFloatDomEvents(layer)) layer.onWheel(e.nativeEvent);
|
|
1603
1789
|
},
|
|
1604
1790
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1605
1791
|
id,
|
|
1606
1792
|
ref: innerDomRef,
|
|
1607
1793
|
className: "univer-absolute univer-overflow-hidden",
|
|
1608
|
-
style: {
|
|
1794
|
+
style: {
|
|
1795
|
+
...layout.inner,
|
|
1796
|
+
overflow: floatDomOverflow.innerOverflow
|
|
1797
|
+
},
|
|
1609
1798
|
children: component
|
|
1610
1799
|
})
|
|
1611
1800
|
});
|
|
1612
|
-
}
|
|
1801
|
+
}
|
|
1613
1802
|
const FloatDom = ({ unitId }) => {
|
|
1614
1803
|
var _layers$filter;
|
|
1615
1804
|
const instanceService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
1616
1805
|
const layers = (0, _wendellhu_redi_react_bindings.useObservable)((0, _wendellhu_redi_react_bindings.useDependency)(CanvasFloatDomService).domLayers$);
|
|
1617
|
-
const
|
|
1618
|
-
|
|
1619
|
-
return layers === null || layers === void 0 || (_layers$filter = layers.filter((layer) => layer[1].unitId === currentUnitId)) === null || _layers$filter === void 0 ? void 0 : _layers$filter.map((layer) => {
|
|
1806
|
+
const currentUnitId = resolveFloatDomCurrentUnitId(unitId, (0, _wendellhu_redi_react_bindings.useObservable)(instanceService.focused$));
|
|
1807
|
+
return layers === null || layers === void 0 || (_layers$filter = layers.filter((layer) => shouldRenderFloatDomLayer(layer[1], currentUnitId))) === null || _layers$filter === void 0 ? void 0 : _layers$filter.map((layer) => {
|
|
1620
1808
|
var _layer$1$domId;
|
|
1621
1809
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FloatDomSingle, {
|
|
1622
1810
|
id: (_layer$1$domId = layer[1].domId) !== null && _layer$1$domId !== void 0 ? _layer$1$domId : layer[0],
|
|
@@ -1624,6 +1812,27 @@ const FloatDom = ({ unitId }) => {
|
|
|
1624
1812
|
}, layer[0]);
|
|
1625
1813
|
});
|
|
1626
1814
|
};
|
|
1815
|
+
function resolveFloatDomCurrentUnitId(unitId, focusedUnit) {
|
|
1816
|
+
if (typeof unitId === "string") return unitId;
|
|
1817
|
+
if (typeof focusedUnit === "string") return focusedUnit;
|
|
1818
|
+
if (focusedUnit != null && typeof focusedUnit === "object" && "getUnitId" in focusedUnit && typeof focusedUnit.getUnitId === "function") {
|
|
1819
|
+
const focusedUnitId = focusedUnit.getUnitId();
|
|
1820
|
+
return typeof focusedUnitId === "string" ? focusedUnitId : null;
|
|
1821
|
+
}
|
|
1822
|
+
return null;
|
|
1823
|
+
}
|
|
1824
|
+
function resolveFloatDomOverflow(props) {
|
|
1825
|
+
var _viewport$bleedWidth;
|
|
1826
|
+
const viewport = props.customBlockRenderViewport;
|
|
1827
|
+
if (!(Number.isFinite(viewport === null || viewport === void 0 ? void 0 : viewport.bleedWidth) && ((_viewport$bleedWidth = viewport === null || viewport === void 0 ? void 0 : viewport.bleedWidth) !== null && _viewport$bleedWidth !== void 0 ? _viewport$bleedWidth : 0) > 0)) return {
|
|
1828
|
+
outerOverflow: "hidden",
|
|
1829
|
+
innerOverflow: "hidden"
|
|
1830
|
+
};
|
|
1831
|
+
return {
|
|
1832
|
+
outerOverflow: "visible",
|
|
1833
|
+
innerOverflow: "visible"
|
|
1834
|
+
};
|
|
1835
|
+
}
|
|
1627
1836
|
|
|
1628
1837
|
//#endregion
|
|
1629
1838
|
//#region src/services/popup/canvas-popup.service.ts
|
|
@@ -1858,7 +2067,6 @@ RectPopup.useContext = () => (0, react.useContext)(RectPopupContext);
|
|
|
1858
2067
|
//#endregion
|
|
1859
2068
|
//#region src/views/components/popup/CanvasPopup.tsx
|
|
1860
2069
|
const SingleCanvasPopup = ({ popup, children }) => {
|
|
1861
|
-
const [hidden, setHidden] = (0, react.useState)(false);
|
|
1862
2070
|
const anchorRect$ = (0, react.useMemo)(() => popup.anchorRect$.pipe((0, rxjs.throttleTime)(0, rxjs.animationFrameScheduler), (0, rxjs.map)((anchorRect) => {
|
|
1863
2071
|
var _popup$offset;
|
|
1864
2072
|
const { bottom, left, right, top } = anchorRect;
|
|
@@ -1879,26 +2087,21 @@ const SingleCanvasPopup = ({ popup, children }) => {
|
|
|
1879
2087
|
return (_popup$excludeRects$ = popup.excludeRects$) === null || _popup$excludeRects$ === void 0 ? void 0 : _popup$excludeRects$.pipe((0, rxjs.throttleTime)(0, rxjs.animationFrameScheduler));
|
|
1880
2088
|
}, [popup.excludeRects$]), popup.excludeRects);
|
|
1881
2089
|
const { canvasElement, hideOnInvisible = true, hiddenType = "destroy" } = popup;
|
|
1882
|
-
(0,
|
|
1883
|
-
|
|
1884
|
-
const
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
const
|
|
1888
|
-
const
|
|
1889
|
-
|
|
1890
|
-
const bufferX = Math.min(.5 * rectWidth, 10);
|
|
1891
|
-
return rectWithOffset.top >= hiddenRect.top - bufferY && rectWithOffset.bottom <= hiddenRect.bottom + bufferY && rectWithOffset.left >= hiddenRect.left - bufferX && rectWithOffset.right <= hiddenRect.right + bufferX;
|
|
1892
|
-
});
|
|
1893
|
-
if (rectWithOffset.bottom < top || rectWithOffset.top > bottom || rectWithOffset.right < left || rectWithOffset.left > right || isInHiddenRect) setHidden(true);
|
|
1894
|
-
else setHidden(false);
|
|
2090
|
+
const hidden = (0, _wendellhu_redi_react_bindings.useObservable)(hideOnInvisible ? () => (0, rxjs.combineLatest)([anchorRect$, hiddenRects$]).pipe((0, rxjs.map)(([rectWithOffset, hiddenRects]) => {
|
|
2091
|
+
const { top, left, bottom, right } = canvasElement.getBoundingClientRect();
|
|
2092
|
+
const rectHeight = rectWithOffset.bottom - rectWithOffset.top;
|
|
2093
|
+
const rectWidth = rectWithOffset.right - rectWithOffset.left;
|
|
2094
|
+
const isInHiddenRect = hiddenRects.some((hiddenRect) => {
|
|
2095
|
+
const bufferY = Math.min(.5 * rectHeight, 10);
|
|
2096
|
+
const bufferX = Math.min(.5 * rectWidth, 10);
|
|
2097
|
+
return rectWithOffset.top >= hiddenRect.top - bufferY && rectWithOffset.bottom <= hiddenRect.bottom + bufferY && rectWithOffset.left >= hiddenRect.left - bufferX && rectWithOffset.right <= hiddenRect.right + bufferX;
|
|
1895
2098
|
});
|
|
1896
|
-
return
|
|
1897
|
-
}, [
|
|
1898
|
-
canvasElement,
|
|
1899
|
-
hideOnInvisible,
|
|
2099
|
+
return rectWithOffset.bottom < top || rectWithOffset.top > bottom || rectWithOffset.right < left || rectWithOffset.left > right || isInHiddenRect;
|
|
2100
|
+
})) : null, false, false, [
|
|
1900
2101
|
anchorRect$,
|
|
1901
|
-
|
|
2102
|
+
canvasElement,
|
|
2103
|
+
hiddenRects$,
|
|
2104
|
+
hideOnInvisible
|
|
1902
2105
|
]);
|
|
1903
2106
|
if (hidden && hiddenType === "destroy") return null;
|
|
1904
2107
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RectPopup, {
|
|
@@ -1930,13 +2133,41 @@ function CanvasPopup() {
|
|
|
1930
2133
|
return (0, _wendellhu_redi_react_bindings.useObservable)(popupService.popups$, void 0, true).map((item) => {
|
|
1931
2134
|
const [key, popup] = item;
|
|
1932
2135
|
const Component = componentManager.get(popup.componentKey);
|
|
2136
|
+
const PopupComponent = Component && popup.connectorInjector ? (0, _wendellhu_redi_react_bindings.connectInjector)(Component, popup.connectorInjector) : Component;
|
|
1933
2137
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SingleCanvasPopup, {
|
|
1934
2138
|
popup,
|
|
1935
|
-
children:
|
|
2139
|
+
children: PopupComponent && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PopupComponent, { popup })
|
|
1936
2140
|
}, key);
|
|
1937
2141
|
});
|
|
1938
2142
|
}
|
|
1939
2143
|
|
|
2144
|
+
//#endregion
|
|
2145
|
+
//#region src/services/ribbon/ribbon-override.service.ts
|
|
2146
|
+
const IRibbonOverrideService = (0, _univerjs_core.createIdentifier)("univer.ribbon-override-service");
|
|
2147
|
+
var RibbonOverrideService = class extends _univerjs_core.Disposable {
|
|
2148
|
+
constructor(..._args) {
|
|
2149
|
+
super(..._args);
|
|
2150
|
+
_defineProperty(this, "_override$", new rxjs.BehaviorSubject(null));
|
|
2151
|
+
_defineProperty(this, "override$", this._override$.asObservable());
|
|
2152
|
+
}
|
|
2153
|
+
getOverride() {
|
|
2154
|
+
return this._override$.getValue();
|
|
2155
|
+
}
|
|
2156
|
+
activate(override) {
|
|
2157
|
+
this._override$.next(override);
|
|
2158
|
+
}
|
|
2159
|
+
clear(id) {
|
|
2160
|
+
const current = this.getOverride();
|
|
2161
|
+
if (!current) return;
|
|
2162
|
+
if (!id || current.id === id) this._override$.next(null);
|
|
2163
|
+
}
|
|
2164
|
+
dispose() {
|
|
2165
|
+
this._override$.next(null);
|
|
2166
|
+
this._override$.complete();
|
|
2167
|
+
super.dispose();
|
|
2168
|
+
}
|
|
2169
|
+
};
|
|
2170
|
+
|
|
1940
2171
|
//#endregion
|
|
1941
2172
|
//#region src/services/ribbon/ribbon.service.ts
|
|
1942
2173
|
const IRibbonService = (0, _univerjs_core.createIdentifier)("univer.ribbon-service");
|
|
@@ -2113,7 +2344,8 @@ function ComponentContainer(props) {
|
|
|
2113
2344
|
*/
|
|
2114
2345
|
function useComponentsOfPart(part, injector) {
|
|
2115
2346
|
var _injector$get;
|
|
2116
|
-
const
|
|
2347
|
+
const injectedUIPartsService = (0, _wendellhu_redi_react_bindings.useDependency)(IUIPartsService);
|
|
2348
|
+
const uiPartsService = (_injector$get = injector === null || injector === void 0 ? void 0 : injector.get(IUIPartsService)) !== null && _injector$get !== void 0 ? _injector$get : injectedUIPartsService;
|
|
2117
2349
|
const changeInfo = (0, _wendellhu_redi_react_bindings.useObservable)((0, react.useMemo)(() => uiPartsService.uiVisibleChange$.pipe((0, rxjs.filter)((ui) => ui.ui === part)), [part, uiPartsService]));
|
|
2118
2350
|
const updateCounterRef = (0, react.useRef)(0);
|
|
2119
2351
|
return (0, react.useMemo)(() => uiPartsService.isUIVisible(part) ? uiPartsService.getComponents(part) : /* @__PURE__ */ new Set(), [(0, _wendellhu_redi_react_bindings.useObservable)(() => uiPartsService.componentRegistered$.pipe((0, rxjs.filter)((key) => key === part), (0, rxjs.debounceTime)(200), (0, rxjs.map)(() => updateCounterRef.current += 1), (0, rxjs.startWith)(updateCounterRef.current += 1)), void 0, void 0, [
|
|
@@ -2290,33 +2522,14 @@ function CustomLabel(props) {
|
|
|
2290
2522
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
2291
2523
|
const componentManager = (0, _wendellhu_redi_react_bindings.useDependency)(ComponentManager);
|
|
2292
2524
|
const iconManager = (0, _wendellhu_redi_react_bindings.useDependency)(IconManager);
|
|
2293
|
-
const
|
|
2294
|
-
const
|
|
2525
|
+
const subscribedValue = (0, _wendellhu_redi_react_bindings.useObservable)(value$ !== null && value$ !== void 0 ? value$ : null, value);
|
|
2526
|
+
const subscribedIcon = (0, _wendellhu_redi_react_bindings.useObservable)((0, rxjs.isObservable)(icon) ? icon : null, "");
|
|
2527
|
+
const realIcon = (0, rxjs.isObservable)(icon) ? subscribedIcon : icon !== null && icon !== void 0 ? icon : "";
|
|
2295
2528
|
const nodes = [];
|
|
2296
2529
|
let index = 0;
|
|
2297
|
-
(0, react.useEffect)(() => {
|
|
2298
|
-
if (value$) {
|
|
2299
|
-
const subscription = value$.subscribe((v) => {
|
|
2300
|
-
setSubscribedValue(v);
|
|
2301
|
-
});
|
|
2302
|
-
return () => {
|
|
2303
|
-
subscription.unsubscribe();
|
|
2304
|
-
};
|
|
2305
|
-
}
|
|
2306
|
-
}, [value$]);
|
|
2307
2530
|
const realValue = (0, react.useMemo)(() => {
|
|
2308
2531
|
return value !== null && value !== void 0 ? value : subscribedValue;
|
|
2309
2532
|
}, [subscribedValue, value]);
|
|
2310
|
-
(0, react.useEffect)(() => {
|
|
2311
|
-
let subscription = null;
|
|
2312
|
-
if ((0, rxjs.isObservable)(icon)) subscription = icon.subscribe((v) => {
|
|
2313
|
-
setRealIcon(v);
|
|
2314
|
-
});
|
|
2315
|
-
else setRealIcon(icon !== null && icon !== void 0 ? icon : "");
|
|
2316
|
-
return () => {
|
|
2317
|
-
subscription === null || subscription === void 0 || subscription.unsubscribe();
|
|
2318
|
-
};
|
|
2319
|
-
}, [icon]);
|
|
2320
2533
|
const isValid = (0, react.useMemo)(() => {
|
|
2321
2534
|
if (realValue && typeof realValue === "string") return new _univerjs_core.ColorKit(realValue).isValid;
|
|
2322
2535
|
return false;
|
|
@@ -2361,6 +2574,7 @@ function CustomLabel(props) {
|
|
|
2361
2574
|
* @returns The menu item's status
|
|
2362
2575
|
*/
|
|
2363
2576
|
function useToolbarItemStatus(menuItem) {
|
|
2577
|
+
var _selectionsValue$2;
|
|
2364
2578
|
const { disabled$, hidden$, activated$, value$ } = menuItem;
|
|
2365
2579
|
let selectionsValue$;
|
|
2366
2580
|
if (isMenuButtonSelectorItem(menuItem)) {
|
|
@@ -2370,37 +2584,18 @@ function useToolbarItemStatus(menuItem) {
|
|
|
2370
2584
|
selectionsValue$ = selections === null || selections === void 0 || (_selections$ = selections[0]) === null || _selections$ === void 0 ? void 0 : _selections$.value$;
|
|
2371
2585
|
}
|
|
2372
2586
|
}
|
|
2373
|
-
const
|
|
2374
|
-
const
|
|
2375
|
-
const
|
|
2376
|
-
const [hidden, setHidden] = (0, react.useState)(false);
|
|
2377
|
-
const [selectionsValue, setSelectionsValue] = (0, react.useState)();
|
|
2378
|
-
(0, react.useEffect)(() => {
|
|
2379
|
-
const subscriptions = [];
|
|
2380
|
-
disabled$ && subscriptions.push(disabled$.subscribe((disabled) => setDisabled(disabled)));
|
|
2381
|
-
hidden$ && subscriptions.push(hidden$.subscribe((hidden) => setHidden(hidden)));
|
|
2382
|
-
activated$ && subscriptions.push(activated$.subscribe((activated) => setActivated(activated)));
|
|
2383
|
-
value$ && subscriptions.push(value$.subscribe((value) => {
|
|
2384
|
-
setValue(value);
|
|
2385
|
-
}));
|
|
2386
|
-
selectionsValue$ && subscriptions.push(selectionsValue$.subscribe((value) => {
|
|
2387
|
-
setSelectionsValue(value);
|
|
2388
|
-
setValue(value);
|
|
2389
|
-
}));
|
|
2390
|
-
return () => subscriptions.forEach((subscription) => subscription.unsubscribe());
|
|
2391
|
-
}, [
|
|
2392
|
-
activated$,
|
|
2393
|
-
disabled$,
|
|
2394
|
-
hidden$,
|
|
2395
|
-
value$,
|
|
2396
|
-
selectionsValue$
|
|
2397
|
-
]);
|
|
2587
|
+
const disabled = (0, _wendellhu_redi_react_bindings.useObservable)(disabled$ !== null && disabled$ !== void 0 ? disabled$ : null, false);
|
|
2588
|
+
const activated = (0, _wendellhu_redi_react_bindings.useObservable)(activated$ !== null && activated$ !== void 0 ? activated$ : null, false);
|
|
2589
|
+
const hidden = (0, _wendellhu_redi_react_bindings.useObservable)(hidden$ !== null && hidden$ !== void 0 ? hidden$ : null, false);
|
|
2398
2590
|
return {
|
|
2399
2591
|
disabled,
|
|
2400
|
-
value,
|
|
2592
|
+
value: (0, _wendellhu_redi_react_bindings.useObservable)((0, react.useMemo)(() => {
|
|
2593
|
+
var _selectionsValue$;
|
|
2594
|
+
return (0, rxjs.merge)(value$ !== null && value$ !== void 0 ? value$ : rxjs.EMPTY, (_selectionsValue$ = selectionsValue$) !== null && _selectionsValue$ !== void 0 ? _selectionsValue$ : rxjs.EMPTY);
|
|
2595
|
+
}, [selectionsValue$, value$])),
|
|
2401
2596
|
activated,
|
|
2402
2597
|
hidden,
|
|
2403
|
-
selectionsValue
|
|
2598
|
+
selectionsValue: (0, _wendellhu_redi_react_bindings.useObservable)((_selectionsValue$2 = selectionsValue$) !== null && _selectionsValue$2 !== void 0 ? _selectionsValue$2 : null)
|
|
2404
2599
|
};
|
|
2405
2600
|
}
|
|
2406
2601
|
function useToolbarShortcutDisplay({ id, commandId, shortcut }) {
|
|
@@ -2419,39 +2614,52 @@ const TooltipWrapperContext = (0, react.createContext)({
|
|
|
2419
2614
|
dropdownVisible: false,
|
|
2420
2615
|
setDropdownVisible: (_visible) => {}
|
|
2421
2616
|
});
|
|
2617
|
+
const ToolbarDropdownContext = (0, react.createContext)(null);
|
|
2618
|
+
function ToolbarDropdownProvider(props) {
|
|
2619
|
+
const [openDropdownKey, setOpenDropdownKey] = (0, react.useState)(null);
|
|
2620
|
+
const contextValue = (0, react.useMemo)(() => ({
|
|
2621
|
+
openDropdownKey,
|
|
2622
|
+
setOpenDropdownKey
|
|
2623
|
+
}), [openDropdownKey]);
|
|
2624
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarDropdownContext.Provider, {
|
|
2625
|
+
value: contextValue,
|
|
2626
|
+
children: props.children
|
|
2627
|
+
});
|
|
2628
|
+
}
|
|
2422
2629
|
const TooltipWrapper = (0, react.forwardRef)((props, ref) => {
|
|
2423
|
-
const { children, ...tooltipProps } = props;
|
|
2630
|
+
const { children, dropdownKey, ...tooltipProps } = props;
|
|
2424
2631
|
const spanRef = (0, react.useRef)(null);
|
|
2425
2632
|
const [tooltipVisible, setTooltipVisible] = (0, react.useState)(false);
|
|
2426
|
-
const [
|
|
2633
|
+
const [localDropdownVisible, setLocalDropdownVisible] = (0, react.useState)(false);
|
|
2634
|
+
const toolbarDropdownContext = (0, react.useContext)(ToolbarDropdownContext);
|
|
2635
|
+
const dropdownVisible = dropdownKey && toolbarDropdownContext ? toolbarDropdownContext.openDropdownKey === dropdownKey : localDropdownVisible;
|
|
2427
2636
|
function handleChangeTooltipVisible(visible) {
|
|
2428
2637
|
if (dropdownVisible) setTooltipVisible(false);
|
|
2429
2638
|
else setTooltipVisible(visible);
|
|
2430
2639
|
}
|
|
2431
|
-
|
|
2432
|
-
|
|
2640
|
+
const handleChangeDropdownVisible = (0, react.useCallback)((visible) => {
|
|
2641
|
+
if (dropdownKey && toolbarDropdownContext) toolbarDropdownContext.setOpenDropdownKey(visible ? dropdownKey : null);
|
|
2642
|
+
else setLocalDropdownVisible(visible);
|
|
2433
2643
|
setTooltipVisible(false);
|
|
2434
|
-
}
|
|
2644
|
+
}, [dropdownKey, toolbarDropdownContext]);
|
|
2435
2645
|
const contextValue = (0, react.useMemo)(() => ({
|
|
2436
2646
|
dropdownVisible,
|
|
2437
2647
|
setDropdownVisible: handleChangeDropdownVisible
|
|
2438
|
-
}), [dropdownVisible]);
|
|
2648
|
+
}), [dropdownVisible, handleChangeDropdownVisible]);
|
|
2439
2649
|
(0, react.useImperativeHandle)(ref, () => ({ el: spanRef.current }));
|
|
2650
|
+
const content = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2651
|
+
ref: spanRef,
|
|
2652
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipWrapperContext.Provider, {
|
|
2653
|
+
value: contextValue,
|
|
2654
|
+
children
|
|
2655
|
+
})
|
|
2656
|
+
});
|
|
2440
2657
|
return tooltipProps.title ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Tooltip, {
|
|
2441
2658
|
visible: tooltipVisible,
|
|
2442
2659
|
onVisibleChange: handleChangeTooltipVisible,
|
|
2443
2660
|
...tooltipProps,
|
|
2444
|
-
children:
|
|
2445
|
-
|
|
2446
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipWrapperContext.Provider, {
|
|
2447
|
-
value: contextValue,
|
|
2448
|
-
children
|
|
2449
|
-
})
|
|
2450
|
-
})
|
|
2451
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2452
|
-
ref: spanRef,
|
|
2453
|
-
children
|
|
2454
|
-
});
|
|
2661
|
+
children: content
|
|
2662
|
+
}) : content;
|
|
2455
2663
|
});
|
|
2456
2664
|
function DropdownWrapper(props) {
|
|
2457
2665
|
const { children, overlay, disabled, align = "start" } = props;
|
|
@@ -2479,9 +2687,8 @@ function DropdownMenuLabel({ icon, value, option, onOptionSelect }) {
|
|
|
2479
2687
|
var _option$label;
|
|
2480
2688
|
const onChange = (v) => {
|
|
2481
2689
|
onOptionSelect === null || onOptionSelect === void 0 || onOptionSelect({
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
commandId: option === null || option === void 0 ? void 0 : option.commandId
|
|
2690
|
+
...option,
|
|
2691
|
+
value: v
|
|
2485
2692
|
});
|
|
2486
2693
|
};
|
|
2487
2694
|
const hasCheckMark = typeof option.label === "string" || typeof option.label === "object" && ((_option$label = option.label) === null || _option$label === void 0 ? void 0 : _option$label.selectable) !== false;
|
|
@@ -2504,24 +2711,28 @@ function DropdownMenuLabel({ icon, value, option, onOptionSelect }) {
|
|
|
2504
2711
|
})]
|
|
2505
2712
|
});
|
|
2506
2713
|
}
|
|
2714
|
+
function getOptionKey(option) {
|
|
2715
|
+
var _ref, _ref2, _option$id, _option$label2;
|
|
2716
|
+
return String((_ref = (_ref2 = (_option$id = option.id) !== null && _option$id !== void 0 ? _option$id : option.commandId) !== null && _ref2 !== void 0 ? _ref2 : option.value) !== null && _ref !== void 0 ? _ref : typeof option.label === "string" ? option.label : (_option$label2 = option.label) === null || _option$label2 === void 0 ? void 0 : _option$label2.name);
|
|
2717
|
+
}
|
|
2507
2718
|
function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled, onOptionSelect }) {
|
|
2508
2719
|
const { dropdownVisible, setDropdownVisible } = (0, react.useContext)(TooltipWrapperContext);
|
|
2509
2720
|
const menuManagerService = (0, _wendellhu_redi_react_bindings.useDependency)(IMenuManagerService);
|
|
2510
|
-
const
|
|
2511
|
-
const
|
|
2512
|
-
(0, react.
|
|
2513
|
-
const
|
|
2514
|
-
|
|
2721
|
+
const resolveMenuItems = () => menuId ? menuManagerService.getMenuByPositionKey(menuId) : [];
|
|
2722
|
+
const menuItems = (0, _wendellhu_redi_react_bindings.useObservable)(() => menuManagerService.menuChanged$.pipe((0, rxjs.map)(resolveMenuItems), (0, rxjs.startWith)(resolveMenuItems())), resolveMenuItems(), false, [menuId, menuManagerService]);
|
|
2723
|
+
const hiddenStates = (0, _wendellhu_redi_react_bindings.useObservable)((0, react.useMemo)(() => {
|
|
2724
|
+
const itemStates = menuItems.map((item) => {
|
|
2725
|
+
var _item$item$hidden$, _item$item;
|
|
2726
|
+
return (item.children ? (0, rxjs.combineLatest)(item.children.map((subItem) => {
|
|
2727
|
+
var _subItem$item$hidden$, _subItem$item;
|
|
2728
|
+
return (_subItem$item$hidden$ = (_subItem$item = subItem.item) === null || _subItem$item === void 0 ? void 0 : _subItem$item.hidden$) !== null && _subItem$item$hidden$ !== void 0 ? _subItem$item$hidden$ : (0, rxjs.of)(false);
|
|
2729
|
+
})).pipe((0, rxjs.map)((hiddenValues) => hiddenValues.every(Boolean))) : (_item$item$hidden$ = (_item$item = item.item) === null || _item$item === void 0 ? void 0 : _item$item.hidden$) !== null && _item$item$hidden$ !== void 0 ? _item$item$hidden$ : (0, rxjs.of)(false)).pipe((0, rxjs.map)((hidden) => [String(item.key), hidden]));
|
|
2515
2730
|
});
|
|
2516
|
-
return () =>
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
}, [
|
|
2521
|
-
menuId,
|
|
2522
|
-
menuManagerService,
|
|
2523
|
-
menuVersion
|
|
2524
|
-
]);
|
|
2731
|
+
return itemStates.length ? (0, rxjs.merge)(...itemStates).pipe((0, rxjs.scan)((states, [key, hidden]) => ({
|
|
2732
|
+
...states,
|
|
2733
|
+
[key]: hidden
|
|
2734
|
+
}), {}), (0, rxjs.startWith)({})) : (0, rxjs.of)({});
|
|
2735
|
+
}, [menuItems]), {});
|
|
2525
2736
|
const filteredMenuItems = (0, react.useMemo)(() => {
|
|
2526
2737
|
return menuItems.filter((item) => {
|
|
2527
2738
|
var _item$key;
|
|
@@ -2532,58 +2743,28 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
2532
2743
|
function handleVisibleChange(visible) {
|
|
2533
2744
|
setDropdownVisible(visible);
|
|
2534
2745
|
}
|
|
2746
|
+
function handleEmbedBoundaryFocusOutside(event) {
|
|
2747
|
+
keepInteractionInsideSameEmbedBoundary(event);
|
|
2748
|
+
}
|
|
2535
2749
|
function handleOptionSelect(option) {
|
|
2536
2750
|
onOptionSelect(option);
|
|
2537
2751
|
setDropdownVisible(false);
|
|
2538
2752
|
}
|
|
2539
|
-
(0, react.useEffect)(() => {
|
|
2540
|
-
const subscriptions = [];
|
|
2541
|
-
menuItems.forEach((item) => {
|
|
2542
|
-
if (!item.children) {
|
|
2543
|
-
var _item$item;
|
|
2544
|
-
if ((_item$item = item.item) === null || _item$item === void 0 ? void 0 : _item$item.hidden$) {
|
|
2545
|
-
const sub = item.item.hidden$.subscribe((hidden) => {
|
|
2546
|
-
setHiddenStates((prev) => ({
|
|
2547
|
-
...prev,
|
|
2548
|
-
[item.key]: hidden
|
|
2549
|
-
}));
|
|
2550
|
-
});
|
|
2551
|
-
subscriptions.push(sub);
|
|
2552
|
-
}
|
|
2553
|
-
} else {
|
|
2554
|
-
const sub = (0, rxjs.combineLatest)(item.children.map((subItem) => {
|
|
2555
|
-
var _subItem$item$hidden$, _subItem$item;
|
|
2556
|
-
return (_subItem$item$hidden$ = (_subItem$item = subItem.item) === null || _subItem$item === void 0 ? void 0 : _subItem$item.hidden$) !== null && _subItem$item$hidden$ !== void 0 ? _subItem$item$hidden$ : (0, rxjs.of)(false);
|
|
2557
|
-
})).subscribe((hiddenValues) => {
|
|
2558
|
-
const isAllHidden = hiddenValues.every((hidden) => hidden === true);
|
|
2559
|
-
setHiddenStates((prev) => ({
|
|
2560
|
-
...prev,
|
|
2561
|
-
[item.key]: isAllHidden
|
|
2562
|
-
}));
|
|
2563
|
-
});
|
|
2564
|
-
subscriptions.push(sub);
|
|
2565
|
-
}
|
|
2566
|
-
});
|
|
2567
|
-
return () => {
|
|
2568
|
-
subscriptions.forEach((sub) => sub === null || sub === void 0 ? void 0 : sub.unsubscribe());
|
|
2569
|
-
setHiddenStates({});
|
|
2570
|
-
};
|
|
2571
|
-
}, [menuItems]);
|
|
2572
2753
|
if (slot) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownWrapper, {
|
|
2573
2754
|
disabled,
|
|
2574
|
-
overlay: options.map((option
|
|
2755
|
+
overlay: options.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownMenuLabel, {
|
|
2575
2756
|
value,
|
|
2576
2757
|
option,
|
|
2577
2758
|
onOptionSelect: handleOptionSelect
|
|
2578
|
-
},
|
|
2759
|
+
}, getOptionKey(option))),
|
|
2579
2760
|
children
|
|
2580
2761
|
});
|
|
2581
2762
|
if (options === null || options === void 0 ? void 0 : options.length) {
|
|
2582
2763
|
const items = options.map((option) => {
|
|
2583
|
-
var _option$
|
|
2764
|
+
var _option$label3;
|
|
2584
2765
|
return {
|
|
2585
2766
|
type: "item",
|
|
2586
|
-
className: (0, _univerjs_design.clsx)({ "focus:univer-bg-white": typeof option.label !== "string" && ((_option$
|
|
2767
|
+
className: (0, _univerjs_design.clsx)({ "focus:univer-bg-white": typeof option.label !== "string" && ((_option$label3 = option.label) === null || _option$label3 === void 0 ? void 0 : _option$label3.hoverable) === false }),
|
|
2587
2768
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownMenuLabel, {
|
|
2588
2769
|
icon: option.icon,
|
|
2589
2770
|
value,
|
|
@@ -2626,6 +2807,8 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
2626
2807
|
disabled,
|
|
2627
2808
|
open: dropdownVisible,
|
|
2628
2809
|
onOpenChange: handleVisibleChange,
|
|
2810
|
+
onFocusOutside: handleEmbedBoundaryFocusOutside,
|
|
2811
|
+
onInteractOutside: handleEmbedBoundaryFocusOutside,
|
|
2629
2812
|
children
|
|
2630
2813
|
});
|
|
2631
2814
|
} else {
|
|
@@ -2660,6 +2843,8 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
2660
2843
|
disabled,
|
|
2661
2844
|
open: dropdownVisible,
|
|
2662
2845
|
onOpenChange: handleVisibleChange,
|
|
2846
|
+
onFocusOutside: handleEmbedBoundaryFocusOutside,
|
|
2847
|
+
onInteractOutside: handleEmbedBoundaryFocusOutside,
|
|
2663
2848
|
children
|
|
2664
2849
|
});
|
|
2665
2850
|
}
|
|
@@ -2791,7 +2976,8 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
|
|
|
2791
2976
|
if (disabled) return;
|
|
2792
2977
|
let commandId = sId;
|
|
2793
2978
|
if (option.id) commandId = option.id;
|
|
2794
|
-
|
|
2979
|
+
const commandParams = typeof option.params === "function" ? option.params(option.value) : option.params;
|
|
2980
|
+
executeCommand(commandId, commandParams !== null && commandParams !== void 0 ? commandParams : { value: option.value });
|
|
2795
2981
|
}
|
|
2796
2982
|
function handleSelectionsValueChange(value) {
|
|
2797
2983
|
if (disabled) return;
|
|
@@ -2799,7 +2985,10 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
|
|
|
2799
2985
|
}
|
|
2800
2986
|
function handleClick() {
|
|
2801
2987
|
if (disabled) return;
|
|
2802
|
-
if (menuType === 2)
|
|
2988
|
+
if (menuType === 2) {
|
|
2989
|
+
const commandParams = typeof params === "function" ? params() : params;
|
|
2990
|
+
executeCommand(bId, commandParams !== null && commandParams !== void 0 ? commandParams : { value });
|
|
2991
|
+
}
|
|
2803
2992
|
}
|
|
2804
2993
|
if (menuType === 2) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2805
2994
|
"data-u-command": id,
|
|
@@ -2864,7 +3053,6 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
|
|
|
2864
3053
|
function renderButtonType() {
|
|
2865
3054
|
var _label$name;
|
|
2866
3055
|
const isCustomComponent = componentManager.get(typeof label === "string" ? label : (_label$name = label === null || label === void 0 ? void 0 : label.name) !== null && _label$name !== void 0 ? _label$name : "");
|
|
2867
|
-
const commandValue = (value !== null && value !== void 0 ? value : typeof params === "function") ? params() : params;
|
|
2868
3056
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
2869
3057
|
"data-u-command": id,
|
|
2870
3058
|
className: "univer-text-sm",
|
|
@@ -2873,7 +3061,8 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
|
|
|
2873
3061
|
disabled,
|
|
2874
3062
|
onClick: () => {
|
|
2875
3063
|
var _props$commandId;
|
|
2876
|
-
|
|
3064
|
+
const commandParams = typeof params === "function" ? params() : params;
|
|
3065
|
+
executeCommand((_props$commandId = props.commandId) !== null && _props$commandId !== void 0 ? _props$commandId : props.id, commandParams !== null && commandParams !== void 0 ? commandParams : typeof value === "undefined" ? void 0 : { value });
|
|
2877
3066
|
},
|
|
2878
3067
|
onDoubleClick: () => props.subId && executeCommand(props.subId),
|
|
2879
3068
|
children: isCustomComponent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, {
|
|
@@ -2896,6 +3085,7 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
|
|
|
2896
3085
|
ref,
|
|
2897
3086
|
title: tooltipTitle,
|
|
2898
3087
|
placement: "bottom",
|
|
3088
|
+
dropdownKey: id,
|
|
2899
3089
|
children: renderItem()
|
|
2900
3090
|
});
|
|
2901
3091
|
});
|
|
@@ -2903,15 +3093,20 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
|
|
|
2903
3093
|
//#endregion
|
|
2904
3094
|
//#region src/views/components/ribbon/Ribbon.tsx
|
|
2905
3095
|
function Ribbon(props) {
|
|
2906
|
-
|
|
2907
|
-
const
|
|
3096
|
+
var _ribbonOverride$ribbo;
|
|
3097
|
+
const { ribbonType, headerMenuComponents, headerMenu = true, toolbarOnly = false, headerClassName } = props;
|
|
3098
|
+
const defaultRibbonService = (0, _wendellhu_redi_react_bindings.useDependency)(IRibbonService);
|
|
3099
|
+
const ribbonOverrideService = (0, _wendellhu_redi_react_bindings.useDependency)(IRibbonOverrideService);
|
|
2908
3100
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
3101
|
+
const ribbonOverride = (0, _wendellhu_redi_react_bindings.useObservable)(ribbonOverrideService.override$, ribbonOverrideService.getOverride());
|
|
3102
|
+
const ribbonService = (_ribbonOverride$ribbo = ribbonOverride === null || ribbonOverride === void 0 ? void 0 : ribbonOverride.ribbonService) !== null && _ribbonOverride$ribbo !== void 0 ? _ribbonOverride$ribbo : defaultRibbonService;
|
|
2909
3103
|
const containerRef = (0, react.useRef)(null);
|
|
2910
3104
|
const toolbarItemRefs = (0, react.useRef)({});
|
|
2911
3105
|
const ribbonData = (0, _wendellhu_redi_react_bindings.useObservable)(ribbonService.ribbon$, []);
|
|
2912
3106
|
const activatedTab = (0, _wendellhu_redi_react_bindings.useObservable)(ribbonService.activatedTab$, "ribbon.start");
|
|
2913
3107
|
const collapsedIds = (0, _wendellhu_redi_react_bindings.useObservable)(ribbonService.collapsedIds$, []);
|
|
2914
3108
|
const fakeToolbarVisible = (0, _wendellhu_redi_react_bindings.useObservable)(ribbonService.fakeToolbarVisible$, false);
|
|
3109
|
+
const hideToolbar = (ribbonOverride === null || ribbonOverride === void 0 ? void 0 : ribbonOverride.hideToolbar) === true;
|
|
2915
3110
|
const ribbon = (0, react.useMemo)(() => {
|
|
2916
3111
|
if (ribbonType === "simple") {
|
|
2917
3112
|
const simpleRibbon = [{
|
|
@@ -2937,7 +3132,7 @@ function Ribbon(props) {
|
|
|
2937
3132
|
const handleSelectTab = (0, react.useCallback)((group) => {
|
|
2938
3133
|
toolbarItemRefs.current = {};
|
|
2939
3134
|
ribbonService.setActivatedTab(group.key);
|
|
2940
|
-
}, []);
|
|
3135
|
+
}, [ribbonService]);
|
|
2941
3136
|
const activeGroup = (0, react.useMemo)(() => {
|
|
2942
3137
|
var _ribbon$find$children, _ribbon$find2;
|
|
2943
3138
|
const allGroups = (_ribbon$find$children = (_ribbon$find2 = ribbon.find((group) => group.key === activatedTab)) === null || _ribbon$find2 === void 0 ? void 0 : _ribbon$find2.children) !== null && _ribbon$find$children !== void 0 ? _ribbon$find$children : [];
|
|
@@ -2965,6 +3160,13 @@ function Ribbon(props) {
|
|
|
2965
3160
|
activatedTab
|
|
2966
3161
|
]);
|
|
2967
3162
|
(0, react.useEffect)(() => {
|
|
3163
|
+
if (hideToolbar) {
|
|
3164
|
+
toolbarItemRefs.current = {};
|
|
3165
|
+
ribbonService.setCollapsedIds([]);
|
|
3166
|
+
ribbonService.setFakeToolbarVisible(false);
|
|
3167
|
+
return;
|
|
3168
|
+
}
|
|
3169
|
+
if (!containerRef.current) return;
|
|
2968
3170
|
let timer = null;
|
|
2969
3171
|
const observer = new ResizeObserver((0, _univerjs_core.throttle)((entries) => {
|
|
2970
3172
|
for (const entry of entries) {
|
|
@@ -2994,7 +3196,12 @@ function Ribbon(props) {
|
|
|
2994
3196
|
timer && cancelAnimationFrame(timer);
|
|
2995
3197
|
observer.disconnect();
|
|
2996
3198
|
};
|
|
2997
|
-
}, [
|
|
3199
|
+
}, [
|
|
3200
|
+
hideToolbar,
|
|
3201
|
+
ribbon,
|
|
3202
|
+
activatedTab,
|
|
3203
|
+
ribbonService
|
|
3204
|
+
]);
|
|
2998
3205
|
const fakeToolbar = (0, react.useMemo)(() => {
|
|
2999
3206
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3000
3207
|
"aria-hidden": "true",
|
|
@@ -3018,76 +3225,118 @@ function Ribbon(props) {
|
|
|
3018
3225
|
}) }, groupItem.key);
|
|
3019
3226
|
})
|
|
3020
3227
|
});
|
|
3021
|
-
}, [activeGroup.allGroups, fakeToolbarVisible]);
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
activatedTab,
|
|
3043
|
-
onSelectTab: handleSelectTab
|
|
3044
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3045
|
-
"data-u-comp": "ribbon-toolbar",
|
|
3046
|
-
ref: containerRef,
|
|
3047
|
-
className: (0, _univerjs_design.clsx)("univer-flex univer-overflow-hidden rtl:univer-divide-x-reverse", _univerjs_design.divideXClassName, { "univer-justify-center": ribbonType === "classic" }),
|
|
3048
|
-
role: "toolbar",
|
|
3049
|
-
"aria-label": localeService.t(activatedTabTitle),
|
|
3050
|
-
children: [activeGroup.visibleGroups.map((groupItem) => {
|
|
3051
|
-
var _groupItem$children3, _groupItem$children4;
|
|
3052
|
-
return (((_groupItem$children3 = groupItem.children) === null || _groupItem$children3 === void 0 ? void 0 : _groupItem$children3.length) || groupItem.item) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Fragment, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3053
|
-
className: "univer-grid univer-shrink-0 univer-grid-flow-col univer-gap-2 univer-px-2 empty:univer-hidden",
|
|
3054
|
-
children: groupItem.children && ((_groupItem$children4 = groupItem.children) === null || _groupItem$children4 === void 0 ? void 0 : _groupItem$children4.map((child) => child.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarItem, { ...child.item }, child.key)))
|
|
3055
|
-
}) }, groupItem.key);
|
|
3056
|
-
}), collapsedIds.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3057
|
-
"data-u-comp": "ribbon-toolbar-more",
|
|
3058
|
-
className: "univer-pl-2 rtl:univer-pr-2",
|
|
3059
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
|
|
3060
|
-
collisionPadding: {
|
|
3061
|
-
right: 12,
|
|
3062
|
-
left: 12
|
|
3063
|
-
},
|
|
3064
|
-
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
3065
|
-
overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3066
|
-
className: "univer-box-border univer-grid univer-max-w-[--radix-popper-available-width] univer-gap-2 univer-p-2",
|
|
3067
|
-
children: activeGroup.hiddenGroups.map((groupItem) => {
|
|
3068
|
-
var _groupItem$children5;
|
|
3069
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3070
|
-
className: "univer-flex univer-items-center univer-gap-2",
|
|
3071
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3072
|
-
className: "univer-flex univer-flex-wrap univer-gap-2",
|
|
3073
|
-
children: groupItem.children ? (_groupItem$children5 = groupItem.children) === null || _groupItem$children5 === void 0 ? void 0 : _groupItem$children5.map((child) => child.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarItem, { ...child.item }, child.key)) : groupItem.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarItem, { ...groupItem.item }, groupItem.key)
|
|
3074
|
-
})
|
|
3075
|
-
}, groupItem.key);
|
|
3076
|
-
})
|
|
3077
|
-
}),
|
|
3078
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3079
|
-
type: "button",
|
|
3080
|
-
className: toolbarButtonClassName,
|
|
3081
|
-
"aria-label": localeService.t("ui.ribbon.more"),
|
|
3082
|
-
"aria-haspopup": "true",
|
|
3083
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreVerticalIcon, {})
|
|
3228
|
+
}, [activeGroup.allGroups, fakeToolbarVisible]);
|
|
3229
|
+
const embedRibbonOverrideAttributes = ribbonOverride ? {
|
|
3230
|
+
"data-embed-ribbon-override": "true",
|
|
3231
|
+
"data-embed-id": ribbonOverride.id
|
|
3232
|
+
} : {};
|
|
3233
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RibbonOverrideRuntimeProvider, {
|
|
3234
|
+
override: ribbonOverride,
|
|
3235
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
3236
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3237
|
+
"data-u-comp": "ribbon-header-menu",
|
|
3238
|
+
...embedRibbonOverrideAttributes,
|
|
3239
|
+
className: (0, _univerjs_design.clsx)("univer-relative univer-select-none", headerClassName, {
|
|
3240
|
+
"univer-hidden": toolbarOnly,
|
|
3241
|
+
"univer-h-9": !toolbarOnly && (ribbonType === "classic" || headerMenuComponents && headerMenuComponents.size > 0)
|
|
3242
|
+
}),
|
|
3243
|
+
children: [
|
|
3244
|
+
!toolbarOnly && (ribbonOverride === null || ribbonOverride === void 0 ? void 0 : ribbonOverride.placeholderTitle) && ribbon.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3245
|
+
className: (0, _univerjs_design.clsx)("univer-flex univer-h-9 univer-items-end univer-px-3", { "univer-justify-center": hideToolbar }),
|
|
3246
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3247
|
+
className: "univer-relative univer-inline-flex univer-h-8 univer-items-center univer-justify-center univer-rounded-t univer-bg-primary-50 univer-px-3 univer-text-sm univer-font-medium univer-text-primary-600",
|
|
3248
|
+
children: ribbonOverride.placeholderTitle
|
|
3084
3249
|
})
|
|
3250
|
+
}),
|
|
3251
|
+
!toolbarOnly && ribbonType === "classic" && ribbon.length >= 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ClassicMenu, {
|
|
3252
|
+
ribbon,
|
|
3253
|
+
activatedTab,
|
|
3254
|
+
onSelectTab: handleSelectTab
|
|
3255
|
+
}),
|
|
3256
|
+
headerMenu && headerMenuComponents && headerMenuComponents.size > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3257
|
+
className: "univer-absolute univer-right-2 univer-top-0 univer-flex univer-h-full univer-flex-row univer-items-center univer-gap-2 rtl:univer-left-2 rtl:univer-right-auto [&>*]:univer-inline-flex [&>*]:univer-h-6 [&>*]:univer-items-center [&>*]:univer-rounded [&>*]:univer-px-1 [&>*]:univer-transition-colors hover:[&>*]:univer-bg-gray-100",
|
|
3258
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: headerMenuComponents })
|
|
3085
3259
|
})
|
|
3260
|
+
]
|
|
3261
|
+
}),
|
|
3262
|
+
!hideToolbar && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3263
|
+
...embedRibbonOverrideAttributes,
|
|
3264
|
+
className: (0, _univerjs_design.clsx)("univer-box-border univer-grid univer-h-10 univer-grid-flow-col univer-items-center univer-px-3 univer-text-sm", {
|
|
3265
|
+
"univer-grid-cols-[1fr] univer-justify-center": ribbonType === "classic" || ribbon.length === 1,
|
|
3266
|
+
"univer-grid-cols-[auto,1fr]": ribbon.length > 1 && ribbonType !== "classic"
|
|
3267
|
+
}, _univerjs_design.borderBottomClassName),
|
|
3268
|
+
children: [ribbonType === "collapsed" && ribbon.length >= 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefaultMenu, {
|
|
3269
|
+
ribbon,
|
|
3270
|
+
activatedTab,
|
|
3271
|
+
onSelectTab: handleSelectTab
|
|
3272
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3273
|
+
"data-u-comp": "ribbon-toolbar",
|
|
3274
|
+
ref: containerRef,
|
|
3275
|
+
className: (0, _univerjs_design.clsx)("univer-flex univer-overflow-hidden", _univerjs_design.divideXClassName, { "univer-justify-center": ribbonType === "classic" }),
|
|
3276
|
+
role: "toolbar",
|
|
3277
|
+
"aria-label": localeService.t(activatedTabTitle),
|
|
3278
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ToolbarDropdownProvider, { children: [activeGroup.visibleGroups.map((groupItem) => {
|
|
3279
|
+
var _groupItem$children3, _groupItem$children4;
|
|
3280
|
+
return (((_groupItem$children3 = groupItem.children) === null || _groupItem$children3 === void 0 ? void 0 : _groupItem$children3.length) || groupItem.item) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Fragment, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3281
|
+
className: "univer-grid univer-shrink-0 univer-grid-flow-col univer-gap-2 univer-px-2 empty:univer-hidden",
|
|
3282
|
+
children: groupItem.children && ((_groupItem$children4 = groupItem.children) === null || _groupItem$children4 === void 0 ? void 0 : _groupItem$children4.map((child) => child.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarItem, { ...child.item }, child.key)))
|
|
3283
|
+
}) }, groupItem.key);
|
|
3284
|
+
}), collapsedIds.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3285
|
+
className: "univer-pl-2 rtl:univer-pr-2",
|
|
3286
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
|
|
3287
|
+
collisionPadding: {
|
|
3288
|
+
right: 12,
|
|
3289
|
+
left: 12
|
|
3290
|
+
},
|
|
3291
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
3292
|
+
overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3293
|
+
className: "univer-box-border univer-grid univer-max-w-[--radix-popper-available-width] univer-gap-2 univer-p-2",
|
|
3294
|
+
children: activeGroup.hiddenGroups.map((groupItem) => {
|
|
3295
|
+
var _groupItem$children5;
|
|
3296
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3297
|
+
className: "univer-flex univer-items-center univer-gap-2",
|
|
3298
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3299
|
+
className: "univer-flex univer-flex-wrap univer-gap-2",
|
|
3300
|
+
children: groupItem.children ? (_groupItem$children5 = groupItem.children) === null || _groupItem$children5 === void 0 ? void 0 : _groupItem$children5.map((child) => child.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarItem, { ...child.item }, child.key)) : groupItem.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarItem, { ...groupItem.item }, groupItem.key)
|
|
3301
|
+
})
|
|
3302
|
+
}, groupItem.key);
|
|
3303
|
+
})
|
|
3304
|
+
}),
|
|
3305
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3306
|
+
type: "button",
|
|
3307
|
+
className: toolbarButtonClassName,
|
|
3308
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreVerticalIcon, {})
|
|
3309
|
+
})
|
|
3310
|
+
})
|
|
3311
|
+
})] }, activatedTab)
|
|
3086
3312
|
})]
|
|
3087
|
-
})
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3313
|
+
}),
|
|
3314
|
+
fakeToolbar
|
|
3315
|
+
] })
|
|
3316
|
+
});
|
|
3317
|
+
}
|
|
3318
|
+
function RibbonOverrideRuntimeProvider(props) {
|
|
3319
|
+
var _override$portalConta;
|
|
3320
|
+
const { override, children } = props;
|
|
3321
|
+
const config = (0, react.useContext)(_univerjs_design.ConfigContext);
|
|
3322
|
+
const injector = override === null || override === void 0 ? void 0 : override.injector;
|
|
3323
|
+
const ConnectedRibbonOverrideConfigProvider = (0, react.useMemo)(() => injector ? (0, _wendellhu_redi_react_bindings.connectInjector)(RibbonOverrideConfigProvider, injector) : null, [injector]);
|
|
3324
|
+
if (!override || !ConnectedRibbonOverrideConfigProvider) return children;
|
|
3325
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConnectedRibbonOverrideConfigProvider, {
|
|
3326
|
+
locale: config.locale,
|
|
3327
|
+
direction: config.direction,
|
|
3328
|
+
mountContainer: (_override$portalConta = override.portalContainer) !== null && _override$portalConta !== void 0 ? _override$portalConta : config.mountContainer,
|
|
3329
|
+
children
|
|
3330
|
+
});
|
|
3331
|
+
}
|
|
3332
|
+
function RibbonOverrideConfigProvider(props) {
|
|
3333
|
+
const { children, locale, direction, mountContainer } = props;
|
|
3334
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.ConfigProvider, {
|
|
3335
|
+
locale,
|
|
3336
|
+
direction,
|
|
3337
|
+
mountContainer,
|
|
3338
|
+
children
|
|
3339
|
+
});
|
|
3091
3340
|
}
|
|
3092
3341
|
|
|
3093
3342
|
//#endregion
|
|
@@ -3143,11 +3392,11 @@ var ContextMenuService = class extends _univerjs_core.Disposable {
|
|
|
3143
3392
|
enable() {
|
|
3144
3393
|
this.disabled = false;
|
|
3145
3394
|
}
|
|
3146
|
-
triggerContextMenu(event, menuType) {
|
|
3395
|
+
triggerContextMenu(event, menuType, context) {
|
|
3147
3396
|
var _this$_currentHandler3;
|
|
3148
3397
|
event.stopPropagation();
|
|
3149
3398
|
if (this.disabled) return;
|
|
3150
|
-
(_this$_currentHandler3 = this._currentHandler) === null || _this$_currentHandler3 === void 0 || _this$_currentHandler3.handleContextMenu(event, menuType);
|
|
3399
|
+
(_this$_currentHandler3 = this._currentHandler) === null || _this$_currentHandler3 === void 0 || _this$_currentHandler3.handleContextMenu(event, menuType, context);
|
|
3151
3400
|
}
|
|
3152
3401
|
hideContextMenu() {
|
|
3153
3402
|
var _this$_currentHandler4;
|
|
@@ -3160,6 +3409,25 @@ var ContextMenuService = class extends _univerjs_core.Disposable {
|
|
|
3160
3409
|
}
|
|
3161
3410
|
};
|
|
3162
3411
|
|
|
3412
|
+
//#endregion
|
|
3413
|
+
//#region src/services/runtime-scope/ui-runtime-scope.service.ts
|
|
3414
|
+
const IUIRuntimeScopeService = (0, _univerjs_core.createIdentifier)("ui.runtime-scope.service");
|
|
3415
|
+
var UIRuntimeScopeService = class extends _univerjs_core.Disposable {
|
|
3416
|
+
constructor(..._args) {
|
|
3417
|
+
super(..._args);
|
|
3418
|
+
_defineProperty(this, "_scopes", /* @__PURE__ */ new Map());
|
|
3419
|
+
}
|
|
3420
|
+
register(scope) {
|
|
3421
|
+
this._scopes.set(scope.unitId, scope);
|
|
3422
|
+
return (0, _univerjs_core.toDisposable)(() => {
|
|
3423
|
+
if (this._scopes.get(scope.unitId) === scope) this._scopes.delete(scope.unitId);
|
|
3424
|
+
});
|
|
3425
|
+
}
|
|
3426
|
+
get(unitId) {
|
|
3427
|
+
return unitId ? this._scopes.get(unitId) : void 0;
|
|
3428
|
+
}
|
|
3429
|
+
};
|
|
3430
|
+
|
|
3163
3431
|
//#endregion
|
|
3164
3432
|
//#region src/services/contextmenu/contextmenu-host.service.ts
|
|
3165
3433
|
const IContextMenuHostService = (0, _univerjs_core.createIdentifier)("ui.contextmenu.host.service");
|
|
@@ -3371,6 +3639,7 @@ function DesignTinyMenuGroup({ items, columns, sizeVariant = "default", layoutVa
|
|
|
3371
3639
|
//#endregion
|
|
3372
3640
|
//#region src/views/menu/desktop/TinyMenuGroup.tsx
|
|
3373
3641
|
const EMPTY_HIDDEN_ITEM_IDS = [];
|
|
3642
|
+
const EMPTY_TINY_MENU_CHILDREN = [];
|
|
3374
3643
|
const quickTileMenuButtonVariants = (0, _univerjs_design.cva)("univer-relative univer-box-border univer-flex univer-size-12 univer-w-full univer-appearance-none univer-flex-col univer-items-center univer-justify-center univer-gap-0.5 univer-rounded-lg univer-border-none univer-bg-white univer-p-0 univer-font-medium univer-text-gray-700 univer-outline-none univer-transition-all focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600 focus-visible:univer-ring-offset-0 dark:!univer-bg-gray-700 dark:!univer-text-gray-100", {
|
|
3375
3644
|
variants: {
|
|
3376
3645
|
disabled: {
|
|
@@ -3438,52 +3707,24 @@ function QuickTileMenuItem(props) {
|
|
|
3438
3707
|
});
|
|
3439
3708
|
}
|
|
3440
3709
|
function UITinyMenuGroup(props) {
|
|
3710
|
+
var _item$children;
|
|
3441
3711
|
const { item, activeItemIds, hiddenItemIds = EMPTY_HIDDEN_ITEM_IDS, hoverSuppressed, columns, sizeVariant = "default", layoutVariant = "default", onOptionSelect } = props;
|
|
3442
|
-
const [activeItems, setActiveItems] = (0, react.useState)([]);
|
|
3443
|
-
const [hiddenItems, setHiddenItems] = (0, react.useState)([]);
|
|
3444
3712
|
const iconManager = (0, _wendellhu_redi_react_bindings.useDependency)(IconManager);
|
|
3445
3713
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
3446
|
-
(
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
});
|
|
3458
|
-
return () => {
|
|
3459
|
-
subscription.unsubscribe();
|
|
3460
|
-
observables.forEach((observable) => {
|
|
3461
|
-
observable.complete();
|
|
3462
|
-
});
|
|
3463
|
-
};
|
|
3464
|
-
}, [item]);
|
|
3465
|
-
(0, react.useEffect)(() => {
|
|
3466
|
-
const { children } = item;
|
|
3467
|
-
if (!children) return;
|
|
3468
|
-
const observables = children.map((child) => {
|
|
3469
|
-
var _child$item$hidden$, _child$item3;
|
|
3470
|
-
return (0, _univerjs_core.convertObservableToBehaviorSubject)((_child$item$hidden$ = (_child$item3 = child.item) === null || _child$item3 === void 0 ? void 0 : _child$item3.hidden$) !== null && _child$item$hidden$ !== void 0 ? _child$item$hidden$ : (0, rxjs.of)(false), false);
|
|
3471
|
-
});
|
|
3472
|
-
const subscription = (0, rxjs.combineLatest)(observables).subscribe((hiddenArr) => {
|
|
3473
|
-
const hiddenItems = [];
|
|
3474
|
-
for (let index = 0; index < hiddenArr.length; index++) if (hiddenArr[index]) hiddenItems.push(getTinyMenuChildStateKey(children[index]));
|
|
3475
|
-
setHiddenItems(hiddenItems);
|
|
3476
|
-
});
|
|
3477
|
-
return () => {
|
|
3478
|
-
subscription.unsubscribe();
|
|
3479
|
-
observables.forEach((observable) => {
|
|
3480
|
-
observable.complete();
|
|
3481
|
-
});
|
|
3482
|
-
};
|
|
3483
|
-
}, [item]);
|
|
3714
|
+
const children = (_item$children = item.children) !== null && _item$children !== void 0 ? _item$children : EMPTY_TINY_MENU_CHILDREN;
|
|
3715
|
+
const activeItems$ = (0, react.useMemo)(() => children.length ? (0, rxjs.combineLatest)(children.map((child) => {
|
|
3716
|
+
var _child$item$activated, _child$item2;
|
|
3717
|
+
return ((_child$item$activated = (_child$item2 = child.item) === null || _child$item2 === void 0 ? void 0 : _child$item2.activated$) !== null && _child$item$activated !== void 0 ? _child$item$activated : (0, rxjs.of)(false)).pipe((0, rxjs.startWith)(false));
|
|
3718
|
+
})).pipe((0, rxjs.map)((states) => children.flatMap((child, index) => states[index] ? [getTinyMenuChildStateKey(child)] : []))) : (0, rxjs.of)([]), [children]);
|
|
3719
|
+
const hiddenItems$ = (0, react.useMemo)(() => children.length ? (0, rxjs.combineLatest)(children.map((child) => {
|
|
3720
|
+
var _child$item$hidden$, _child$item3;
|
|
3721
|
+
return ((_child$item$hidden$ = (_child$item3 = child.item) === null || _child$item3 === void 0 ? void 0 : _child$item3.hidden$) !== null && _child$item$hidden$ !== void 0 ? _child$item$hidden$ : (0, rxjs.of)(false)).pipe((0, rxjs.startWith)(false));
|
|
3722
|
+
})).pipe((0, rxjs.map)((states) => children.flatMap((child, index) => states[index] ? [getTinyMenuChildStateKey(child)] : []))) : (0, rxjs.of)([]), [children]);
|
|
3723
|
+
const activeItems = (0, _wendellhu_redi_react_bindings.useObservable)(activeItems$, []);
|
|
3724
|
+
const hiddenItems = (0, _wendellhu_redi_react_bindings.useObservable)(hiddenItems$, []);
|
|
3484
3725
|
const visibleChildren = (0, react.useMemo)(() => {
|
|
3485
|
-
var _item$
|
|
3486
|
-
return getVisibleTinyMenuChildren((_item$
|
|
3726
|
+
var _item$children2;
|
|
3727
|
+
return getVisibleTinyMenuChildren((_item$children2 = item.children) !== null && _item$children2 !== void 0 ? _item$children2 : [], [...hiddenItems, ...hiddenItemIds]);
|
|
3487
3728
|
}, [
|
|
3488
3729
|
hiddenItemIds,
|
|
3489
3730
|
hiddenItems,
|
|
@@ -3522,9 +3763,9 @@ function UITinyMenuGroup(props) {
|
|
|
3522
3763
|
});
|
|
3523
3764
|
}
|
|
3524
3765
|
function UIQuickTileMenuGroup(props) {
|
|
3525
|
-
var _item$
|
|
3766
|
+
var _item$children3;
|
|
3526
3767
|
const { item, activeItemIds, hiddenItemIds = EMPTY_HIDDEN_ITEM_IDS, onOptionSelect } = props;
|
|
3527
|
-
if (!((_item$
|
|
3768
|
+
if (!((_item$children3 = item.children) === null || _item$children3 === void 0 ? void 0 : _item$children3.length)) return null;
|
|
3528
3769
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3529
3770
|
className: "univer-item-center univer-grid univer-grid-cols-3 univer-gap-1.5 univer-py-1",
|
|
3530
3771
|
children: getVisibleTinyMenuChildren(item.children, hiddenItemIds).map((menuSchema) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuickTileMenuItem, {
|
|
@@ -3864,9 +4105,11 @@ function getContextMenuSubmenuPanelClassName(sizeVariant) {
|
|
|
3864
4105
|
}
|
|
3865
4106
|
function ContextMenuPanel(props) {
|
|
3866
4107
|
var _layoutService$rootCo, _layoutService$rootCo2;
|
|
3867
|
-
const { menuType, menuSessionVersion = 0, className, activeItemIds, hiddenItemIds, sizeVariant = "default", autoFocus, autoFocusTarget = "first-item", suppressHoverUntilPointerMove = false, onCancel, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect } = props;
|
|
3868
|
-
const
|
|
3869
|
-
const
|
|
4108
|
+
const { menuType, menuManagerService: providedMenuManagerService, layoutService: providedLayoutService, menuSessionVersion = 0, className, activeItemIds, hiddenItemIds, sizeVariant = "default", autoFocus, autoFocusTarget = "first-item", suppressHoverUntilPointerMove = false, onCancel, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect } = props;
|
|
4109
|
+
const rootMenuManagerService = (0, _wendellhu_redi_react_bindings.useDependency)(IMenuManagerService);
|
|
4110
|
+
const rootLayoutService = (0, _wendellhu_redi_react_bindings.useDependency)(ILayoutService);
|
|
4111
|
+
const menuManagerService = providedMenuManagerService !== null && providedMenuManagerService !== void 0 ? providedMenuManagerService : rootMenuManagerService;
|
|
4112
|
+
const layoutService = providedLayoutService !== null && providedLayoutService !== void 0 ? providedLayoutService : rootLayoutService;
|
|
3870
4113
|
const [menuElement, setMenuElement] = (0, react.useState)(null);
|
|
3871
4114
|
const [maxMenuHeight, setMaxMenuHeight] = (0, react.useState)(() => {
|
|
3872
4115
|
if (typeof window === "undefined") return 240;
|
|
@@ -3969,6 +4212,7 @@ function ContextMenuPanel(props) {
|
|
|
3969
4212
|
onWheel: (event) => event.stopPropagation(),
|
|
3970
4213
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContextMenuMenu, {
|
|
3971
4214
|
menuSchemas: menuItems,
|
|
4215
|
+
menuManagerService,
|
|
3972
4216
|
menuSessionVersion,
|
|
3973
4217
|
submenuPortalContainer,
|
|
3974
4218
|
rootMenuElement: menuElement,
|
|
@@ -3984,7 +4228,7 @@ function ContextMenuPanel(props) {
|
|
|
3984
4228
|
});
|
|
3985
4229
|
}
|
|
3986
4230
|
function ContextMenuMenu(props) {
|
|
3987
|
-
const { menuSchemas, menuSessionVersion, submenuPortalContainer, rootMenuElement, activeItemIds, hiddenItemIds, hoverSuppressed, sizeVariant, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect, maxMenuHeight } = props;
|
|
4231
|
+
const { menuSchemas, menuManagerService, menuSessionVersion, submenuPortalContainer, rootMenuElement, activeItemIds, hiddenItemIds, hoverSuppressed, sizeVariant, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect, maxMenuHeight } = props;
|
|
3988
4232
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
3989
4233
|
const hiddenGroupStates = useContextGroupHiddenStates$1(menuSchemas);
|
|
3990
4234
|
const [activeSubmenuKey, setActiveSubmenuKey] = (0, react.useState)(null);
|
|
@@ -4030,6 +4274,7 @@ function ContextMenuMenu(props) {
|
|
|
4030
4274
|
if (menuSchema.item) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContextMenuMenuItem, {
|
|
4031
4275
|
menuKey: menuSchema.key,
|
|
4032
4276
|
menuItem: menuSchema.item,
|
|
4277
|
+
menuManagerService,
|
|
4033
4278
|
menuSessionVersion,
|
|
4034
4279
|
submenuPortalContainer,
|
|
4035
4280
|
rootMenuElement,
|
|
@@ -4050,6 +4295,7 @@ function ContextMenuMenu(props) {
|
|
|
4050
4295
|
children: menuSchema.children.map((childSchema) => childSchema.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContextMenuMenuItem, {
|
|
4051
4296
|
menuKey: childSchema.key,
|
|
4052
4297
|
menuItem: childSchema.item,
|
|
4298
|
+
menuManagerService,
|
|
4053
4299
|
menuSessionVersion,
|
|
4054
4300
|
submenuPortalContainer,
|
|
4055
4301
|
rootMenuElement,
|
|
@@ -4071,6 +4317,7 @@ function ContextMenuMenu(props) {
|
|
|
4071
4317
|
children: [titleNode, menuSchema.children.map((childSchema) => childSchema.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContextMenuMenuItem, {
|
|
4072
4318
|
menuKey: childSchema.key,
|
|
4073
4319
|
menuItem: childSchema.item,
|
|
4320
|
+
menuManagerService,
|
|
4074
4321
|
menuSessionVersion,
|
|
4075
4322
|
submenuPortalContainer,
|
|
4076
4323
|
rootMenuElement,
|
|
@@ -4099,6 +4346,7 @@ function ContextMenuMenu(props) {
|
|
|
4099
4346
|
children: [titleContent, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContextMenuMenuItem, {
|
|
4100
4347
|
menuKey: `${menuSchema.key}-header-action`,
|
|
4101
4348
|
menuItem: menuSchema.headerActionItem,
|
|
4349
|
+
menuManagerService,
|
|
4102
4350
|
menuSessionVersion,
|
|
4103
4351
|
submenuPortalContainer,
|
|
4104
4352
|
rootMenuElement,
|
|
@@ -4119,10 +4367,9 @@ function ContextMenuMenu(props) {
|
|
|
4119
4367
|
}
|
|
4120
4368
|
}
|
|
4121
4369
|
function ContextMenuMenuItem(props) {
|
|
4122
|
-
const { menuKey, menuItem, menuSessionVersion, submenuPortalContainer, rootMenuElement, maxMenuHeight, activeSubmenuKey, setActiveSubmenuKey, activeItemIds, hiddenItemIds = [], hoverSuppressed = false, compact = false, headerAction = false, sizeVariant, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect } = props;
|
|
4370
|
+
const { menuKey, menuItem, menuManagerService, menuSessionVersion, submenuPortalContainer, rootMenuElement, maxMenuHeight, activeSubmenuKey, setActiveSubmenuKey, activeItemIds, hiddenItemIds = [], hoverSuppressed = false, compact = false, headerAction = false, sizeVariant, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect } = props;
|
|
4123
4371
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
4124
4372
|
const direction = (0, _wendellhu_redi_react_bindings.useObservable)(localeService.direction$);
|
|
4125
|
-
const menuManagerService = (0, _wendellhu_redi_react_bindings.useDependency)(IMenuManagerService);
|
|
4126
4373
|
const disabled = (0, _wendellhu_redi_react_bindings.useObservable)(menuItem.disabled$, false);
|
|
4127
4374
|
const activated = (0, _wendellhu_redi_react_bindings.useObservable)(menuItem.activated$, false);
|
|
4128
4375
|
const hidden = (0, _wendellhu_redi_react_bindings.useObservable)(menuItem.hidden$, false);
|
|
@@ -4254,6 +4501,7 @@ function ContextMenuMenuItem(props) {
|
|
|
4254
4501
|
});
|
|
4255
4502
|
const canExecuteItem = menuItem.type === 0 || menuItem.type === 2;
|
|
4256
4503
|
const renderAsContainer = isNonSelectableLabel(menuItem.label);
|
|
4504
|
+
const SubmenuAffordanceIcon = direction === "rtl" ? _univerjs_icons.MoreLeftIcon : _univerjs_icons.MoreRightIcon;
|
|
4257
4505
|
const interactiveItemClassName = (0, _univerjs_design.clsx)(itemClassName, isNonHoverableLabel(menuItem.label) && "hover:univer-bg-transparent dark:hover:!univer-bg-transparent");
|
|
4258
4506
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4259
4507
|
ref: menuItemElementRef,
|
|
@@ -4282,7 +4530,7 @@ function ContextMenuMenuItem(props) {
|
|
|
4282
4530
|
children: [renderAsContainer ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4283
4531
|
className: interactiveItemClassName,
|
|
4284
4532
|
"aria-disabled": disabled,
|
|
4285
|
-
children: [contentNode, hasSubmenu && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
4533
|
+
children: [contentNode, hasSubmenu && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SubmenuAffordanceIcon, { className: `
|
|
4286
4534
|
${sizeVariant === "paragraph-t" ? "univer-size-4" : "univer-size-3.5"}
|
|
4287
4535
|
univer-text-gray-400
|
|
4288
4536
|
dark:!univer-text-gray-200
|
|
@@ -4325,7 +4573,7 @@ function ContextMenuMenuItem(props) {
|
|
|
4325
4573
|
label: menuKey
|
|
4326
4574
|
});
|
|
4327
4575
|
},
|
|
4328
|
-
children: [contentNode, hasSubmenu && !compact && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
4576
|
+
children: [contentNode, hasSubmenu && !compact && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SubmenuAffordanceIcon, { className: `
|
|
4329
4577
|
${sizeVariant === "paragraph-t" ? "univer-size-4" : "univer-size-3.5"}
|
|
4330
4578
|
univer-text-gray-400
|
|
4331
4579
|
dark:!univer-text-gray-200
|
|
@@ -4333,7 +4581,7 @@ function ContextMenuMenuItem(props) {
|
|
|
4333
4581
|
}), hasSubmenu && submenuVisible && (submenuPortalContainer ? (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4334
4582
|
ref: submenuElementRef,
|
|
4335
4583
|
dir: direction,
|
|
4336
|
-
|
|
4584
|
+
"data-u-context-menu-submenu": "true",
|
|
4337
4585
|
className: "univer-z-[1080] univer-w-max univer-max-w-[calc(100vw-16px)]",
|
|
4338
4586
|
style: {
|
|
4339
4587
|
position: "fixed",
|
|
@@ -4372,7 +4620,7 @@ function ContextMenuMenuItem(props) {
|
|
|
4372
4620
|
const optionSelected = typeof inputValue !== "undefined" && String(inputValue) === String(option.value);
|
|
4373
4621
|
const optionSelectable = !isNonSelectableLabel(option.label);
|
|
4374
4622
|
const optionHoverable = !isNonHoverableLabel(option.label);
|
|
4375
|
-
const optionClassName = (0, _univerjs_design.clsx)(sizeVariant === "paragraph-t" ? "univer-relative univer-box-border univer-flex univer-min-h-10 univer-w-full univer-items-center univer-rounded-lg univer-border-none univer-bg-transparent univer-px-3 univer-text-left univer-text-base dark:!univer-text-white" : "univer-relative univer-box-border univer-flex univer-min-h-8 univer-w-full univer-items-center univer-rounded-md univer-border-none univer-bg-transparent univer-px-2 univer-text-left univer-text-sm dark:!univer-text-white", option.disabled ? "univer-cursor-not-allowed univer-opacity-60" : optionHoverable && "univer-cursor-pointer hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-600");
|
|
4623
|
+
const optionClassName = (0, _univerjs_design.clsx)(optionSelectable ? sizeVariant === "paragraph-t" ? "univer-relative univer-box-border univer-flex univer-min-h-10 univer-w-full univer-items-center univer-rounded-lg univer-border-none univer-bg-transparent univer-px-3 univer-text-left univer-text-base dark:!univer-text-white" : "univer-relative univer-box-border univer-flex univer-min-h-8 univer-w-full univer-items-center univer-rounded-md univer-border-none univer-bg-transparent univer-px-2 univer-text-left univer-text-sm dark:!univer-text-white" : "univer-relative univer-box-border univer-block univer-w-full univer-border-none univer-bg-transparent univer-p-0", option.disabled ? "univer-cursor-not-allowed univer-opacity-60" : optionHoverable && "univer-cursor-pointer hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-600");
|
|
4376
4624
|
const optionContentNode = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [optionSelectable && optionSelected && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.CheckMarkIcon, { className: (0, _univerjs_design.clsx)("univer-absolute univer-left-0 univer-text-primary-600", sizeVariant === "paragraph-t" ? "univer-size-5" : "univer-size-4") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4377
4625
|
className: (0, _univerjs_design.clsx)(getContextMenuContentClassName(sizeVariant), optionSelectable && optionSelected && "univer-pl-4"),
|
|
4378
4626
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, {
|
|
@@ -4414,6 +4662,7 @@ function ContextMenuMenuItem(props) {
|
|
|
4414
4662
|
})
|
|
4415
4663
|
}), hasSubItemSubmenu && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContextMenuMenu, {
|
|
4416
4664
|
menuSchemas: subMenuItems,
|
|
4665
|
+
menuManagerService,
|
|
4417
4666
|
menuSessionVersion,
|
|
4418
4667
|
submenuPortalContainer,
|
|
4419
4668
|
rootMenuElement,
|
|
@@ -4431,34 +4680,26 @@ function ContextMenuMenuItem(props) {
|
|
|
4431
4680
|
});
|
|
4432
4681
|
}
|
|
4433
4682
|
function useContextGroupHiddenStates$1(menuSchemas) {
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
if (!((_menuSchema$children3 = menuSchema.children) === null || _menuSchema$children3 === void 0 ? void 0 : _menuSchema$children3.length)) return null;
|
|
4439
|
-
return (0, rxjs.combineLatest)(menuSchema.children.map((childSchema) => {
|
|
4683
|
+
return (0, _wendellhu_redi_react_bindings.useObservable)((0, react.useMemo)(() => {
|
|
4684
|
+
const groupStates = menuSchemas.flatMap((menuSchema) => {
|
|
4685
|
+
var _menuSchema$children$, _menuSchema$children3;
|
|
4686
|
+
const hiddenObservables = (_menuSchema$children$ = (_menuSchema$children3 = menuSchema.children) === null || _menuSchema$children3 === void 0 ? void 0 : _menuSchema$children3.map((childSchema) => {
|
|
4440
4687
|
var _childSchema$item$hid, _childSchema$item;
|
|
4441
4688
|
return (_childSchema$item$hid = (_childSchema$item = childSchema.item) === null || _childSchema$item === void 0 ? void 0 : _childSchema$item.hidden$) !== null && _childSchema$item$hid !== void 0 ? _childSchema$item$hid : (0, rxjs.of)(false);
|
|
4442
|
-
}))
|
|
4443
|
-
|
|
4444
|
-
setHiddenStates((state) => ({
|
|
4445
|
-
...state,
|
|
4446
|
-
[menuSchema.key]: isAllHidden
|
|
4447
|
-
}));
|
|
4448
|
-
});
|
|
4689
|
+
})) !== null && _menuSchema$children$ !== void 0 ? _menuSchema$children$ : [];
|
|
4690
|
+
return hiddenObservables.length ? [(0, rxjs.combineLatest)(hiddenObservables).pipe((0, rxjs.map)((values) => [menuSchema.key, values.every(Boolean)]))] : [];
|
|
4449
4691
|
});
|
|
4450
|
-
return () => {
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
};
|
|
4454
|
-
}, [menuSchemas]);
|
|
4455
|
-
return hiddenStates;
|
|
4692
|
+
return groupStates.length ? (0, rxjs.merge)(...groupStates).pipe((0, rxjs.scan)((states, [key, hidden]) => ({
|
|
4693
|
+
...states,
|
|
4694
|
+
[key]: hidden
|
|
4695
|
+
}), {}), (0, rxjs.startWith)({})) : (0, rxjs.of)({});
|
|
4696
|
+
}, [menuSchemas]), {});
|
|
4456
4697
|
}
|
|
4457
4698
|
|
|
4458
4699
|
//#endregion
|
|
4459
4700
|
//#region src/views/components/context-menu/AnchoredContextMenu.tsx
|
|
4460
4701
|
function AnchoredContextMenu(props) {
|
|
4461
|
-
const { hostId, visible, anchorRect, menuType, anchorVertical = "bottom", menuOffset = 0, onRequestClose, onOptionSelect } = props;
|
|
4702
|
+
const { hostId, visible, anchorRect, menuType, anchorVertical = "bottom", menuOffset = 0, menuManagerService, layoutService, onRequestClose, onOptionSelect } = props;
|
|
4462
4703
|
const contentRef = (0, react.useRef)(null);
|
|
4463
4704
|
const contextMenuHostService = (0, _wendellhu_redi_react_bindings.useDependency)(IContextMenuHostService);
|
|
4464
4705
|
const onRequestCloseRef = (0, react.useRef)(onRequestClose);
|
|
@@ -4547,6 +4788,8 @@ function AnchoredContextMenu(props) {
|
|
|
4547
4788
|
ref: contentRef,
|
|
4548
4789
|
children: menuType && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContextMenuPanel, {
|
|
4549
4790
|
menuType,
|
|
4791
|
+
menuManagerService,
|
|
4792
|
+
layoutService,
|
|
4550
4793
|
menuSessionVersion: menuSessionVersionRef.current,
|
|
4551
4794
|
onOptionSelect
|
|
4552
4795
|
})
|
|
@@ -4561,10 +4804,13 @@ function DesktopContextMenu() {
|
|
|
4561
4804
|
const [visible, setVisible] = (0, react.useState)(false);
|
|
4562
4805
|
const [menuType, setMenuType] = (0, react.useState)("");
|
|
4563
4806
|
const [anchorRect, setAnchorRect] = (0, react.useState)(null);
|
|
4807
|
+
const [menuContext, setMenuContext] = (0, react.useState)();
|
|
4564
4808
|
const visibleRef = (0, react.useRef)(visible);
|
|
4565
4809
|
const contextMenuService = (0, _wendellhu_redi_react_bindings.useDependency)(IContextMenuService);
|
|
4566
4810
|
const commandService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ICommandService);
|
|
4567
|
-
const
|
|
4811
|
+
const layoutService = (0, _wendellhu_redi_react_bindings.useDependency)(ILayoutService);
|
|
4812
|
+
const menuManagerService = (0, _wendellhu_redi_react_bindings.useDependency)(IMenuManagerService);
|
|
4813
|
+
const runtimeScopeService = (0, _wendellhu_redi_react_bindings.useDependency)(IUIRuntimeScopeService);
|
|
4568
4814
|
visibleRef.current = visible;
|
|
4569
4815
|
(0, react.useEffect)(() => {
|
|
4570
4816
|
const disposables = contextMenuService.registerContextMenuHandler({
|
|
@@ -4581,10 +4827,11 @@ function DesktopContextMenu() {
|
|
|
4581
4827
|
};
|
|
4582
4828
|
}, [contextMenuService]);
|
|
4583
4829
|
/** A function to open context menu with given position and menu type. */
|
|
4584
|
-
function handleContextMenu(event, menuType) {
|
|
4830
|
+
function handleContextMenu(event, menuType, context) {
|
|
4585
4831
|
setVisible(false);
|
|
4586
4832
|
requestAnimationFrame(() => {
|
|
4587
4833
|
setMenuType(menuType);
|
|
4834
|
+
setMenuContext(context);
|
|
4588
4835
|
setAnchorRect({
|
|
4589
4836
|
left: event.clientX,
|
|
4590
4837
|
top: event.clientY,
|
|
@@ -4596,18 +4843,24 @@ function DesktopContextMenu() {
|
|
|
4596
4843
|
function handleClose() {
|
|
4597
4844
|
setVisible(false);
|
|
4598
4845
|
}
|
|
4846
|
+
const activeScope = runtimeScopeService.get(menuContext === null || menuContext === void 0 ? void 0 : menuContext.unitId);
|
|
4847
|
+
const activeMenuManagerService = (activeScope === null || activeScope === void 0 ? void 0 : activeScope.has(IMenuManagerService)) ? activeScope.get(IMenuManagerService) : menuManagerService;
|
|
4848
|
+
const activeCommandService = (activeScope === null || activeScope === void 0 ? void 0 : activeScope.has(_univerjs_core.ICommandService)) ? activeScope.get(_univerjs_core.ICommandService) : commandService;
|
|
4849
|
+
const activeLayoutService = (activeScope === null || activeScope === void 0 ? void 0 : activeScope.has(ILayoutService)) ? activeScope.get(ILayoutService) : layoutService;
|
|
4599
4850
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnchoredContextMenu, {
|
|
4600
4851
|
hostId: DESKTOP_CONTEXT_MENU_HOST_ID,
|
|
4601
4852
|
visible,
|
|
4602
4853
|
anchorRect,
|
|
4603
4854
|
menuType,
|
|
4855
|
+
menuManagerService: activeMenuManagerService,
|
|
4856
|
+
layoutService: activeLayoutService,
|
|
4604
4857
|
onRequestClose: handleClose,
|
|
4605
4858
|
onOptionSelect: (params) => {
|
|
4606
4859
|
const { label: id, commandId, value } = params;
|
|
4607
4860
|
const rawParams = typeof params.params === "function" ? params.params() : params.params;
|
|
4608
4861
|
const commandParams = typeof rawParams === "undefined" ? { value } : rawParams;
|
|
4609
|
-
if (
|
|
4610
|
-
|
|
4862
|
+
if (activeCommandService) activeCommandService.executeCommand(commandId !== null && commandId !== void 0 ? commandId : id, commandParams);
|
|
4863
|
+
activeLayoutService.focus();
|
|
4611
4864
|
handleClose();
|
|
4612
4865
|
}
|
|
4613
4866
|
});
|
|
@@ -4618,6 +4871,7 @@ function DesktopContextMenu() {
|
|
|
4618
4871
|
const MIN_SIDEBAR_WIDTH = 280;
|
|
4619
4872
|
const MAX_SIDEBAR_WIDTH = 800;
|
|
4620
4873
|
function Sidebar() {
|
|
4874
|
+
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
4621
4875
|
const sidebarService = (0, _wendellhu_redi_react_bindings.useDependency)(ISidebarService);
|
|
4622
4876
|
const sidebarOptions = (0, _wendellhu_redi_react_bindings.useObservable)(sidebarService.sidebarOptions$);
|
|
4623
4877
|
const scrollRef = (0, react.useRef)(null);
|
|
@@ -4724,7 +4978,7 @@ function Sidebar() {
|
|
|
4724
4978
|
"data-u-comp": "sidebar",
|
|
4725
4979
|
role: "complementary",
|
|
4726
4980
|
"aria-expanded": !!(options === null || options === void 0 ? void 0 : options.visible),
|
|
4727
|
-
"aria-label": "
|
|
4981
|
+
"aria-label": localeService.t("ui.sidebar.panel"),
|
|
4728
4982
|
className: (0, _univerjs_design.clsx)("univer-relative univer-h-full univer-flex-shrink-0 univer-bg-white univer-text-gray-900 dark:!univer-bg-gray-900 dark:!univer-text-white", {
|
|
4729
4983
|
"univer-w-96 univer-translate-x-0": options === null || options === void 0 ? void 0 : options.visible,
|
|
4730
4984
|
"univer-w-0 univer-translate-x-full": !(options === null || options === void 0 ? void 0 : options.visible)
|
|
@@ -4735,7 +4989,7 @@ function Sidebar() {
|
|
|
4735
4989
|
onMouseDown: handleResizeMouseDown,
|
|
4736
4990
|
role: "separator",
|
|
4737
4991
|
"aria-orientation": "vertical",
|
|
4738
|
-
"aria-label": "
|
|
4992
|
+
"aria-label": localeService.t("ui.sidebar.resize"),
|
|
4739
4993
|
tabIndex: 0,
|
|
4740
4994
|
onKeyDown: (e) => {
|
|
4741
4995
|
if (!sidebarRef.current) return;
|
|
@@ -4764,7 +5018,7 @@ function Sidebar() {
|
|
|
4764
5018
|
type: "button",
|
|
4765
5019
|
className: "focus:univer-ring-primary-500/50 univer-cursor-pointer univer-appearance-none univer-rounded-sm univer-border-none univer-bg-transparent univer-p-0 univer-text-gray-500 focus:univer-outline-none focus:univer-ring-2 dark:!univer-text-gray-300",
|
|
4766
5020
|
onClick: handleClose,
|
|
4767
|
-
"aria-label": "
|
|
5021
|
+
"aria-label": localeService.t("ui.sidebar.close"),
|
|
4768
5022
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.CloseIcon, {})
|
|
4769
5023
|
})]
|
|
4770
5024
|
}),
|
|
@@ -5009,39 +5263,23 @@ function DesktopWorkbenchContent(props) {
|
|
|
5009
5263
|
sub.unsubscribe();
|
|
5010
5264
|
};
|
|
5011
5265
|
}, []);
|
|
5012
|
-
const
|
|
5266
|
+
const darkMode = (0, _wendellhu_redi_react_bindings.useObservable)(themeService.darkMode$, themeService.darkMode);
|
|
5013
5267
|
(0, react.useLayoutEffect)(() => {
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
else document.documentElement.classList.remove("univer-dark");
|
|
5018
|
-
});
|
|
5019
|
-
return () => {
|
|
5020
|
-
sub.unsubscribe();
|
|
5021
|
-
};
|
|
5022
|
-
}, []);
|
|
5268
|
+
if (darkMode) document.documentElement.classList.add("univer-dark");
|
|
5269
|
+
else document.documentElement.classList.remove("univer-dark");
|
|
5270
|
+
}, [darkMode]);
|
|
5023
5271
|
(0, react.useEffect)(() => {
|
|
5024
5272
|
if (contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
|
|
5025
5273
|
}, [onRendered]);
|
|
5026
|
-
const
|
|
5027
|
-
const
|
|
5274
|
+
const locale = (0, _wendellhu_redi_react_bindings.useObservable)(() => localeService.localeChanged$.pipe((0, rxjs.map)(() => localeService.getLocales())), localeService.getLocales(), false, [localeService]);
|
|
5275
|
+
const direction = (0, _wendellhu_redi_react_bindings.useObservable)(localeService.direction$, localeService.getDirection());
|
|
5028
5276
|
const portalContainer = (0, react.useMemo)(() => document.createElement("div"), []);
|
|
5029
5277
|
(0, react.useEffect)(() => {
|
|
5030
5278
|
document.body.appendChild(portalContainer);
|
|
5031
|
-
const subscriptions = [localeService.localeChanged$.subscribe(() => {
|
|
5032
|
-
setLocale(localeService.getLocales());
|
|
5033
|
-
}), localeService.direction$.subscribe(() => {
|
|
5034
|
-
setDirection(localeService.getDirection());
|
|
5035
|
-
})];
|
|
5036
5279
|
return () => {
|
|
5037
|
-
subscriptions.forEach((subscription) => subscription.unsubscribe());
|
|
5038
5280
|
document.body.removeChild(portalContainer);
|
|
5039
5281
|
};
|
|
5040
|
-
}, [
|
|
5041
|
-
localeService,
|
|
5042
|
-
mountContainer,
|
|
5043
|
-
portalContainer
|
|
5044
|
-
]);
|
|
5282
|
+
}, [mountContainer, portalContainer]);
|
|
5045
5283
|
(0, react.useEffect)(() => {
|
|
5046
5284
|
portalContainer.dir = direction;
|
|
5047
5285
|
}, [direction, portalContainer]);
|
|
@@ -5183,7 +5421,9 @@ var SingleUnitUIController = class extends _univerjs_core.Disposable {
|
|
|
5183
5421
|
}));
|
|
5184
5422
|
}
|
|
5185
5423
|
_changeRenderUnit(rendererId, contentElement) {
|
|
5424
|
+
var _this$_instanceServic2;
|
|
5186
5425
|
if (this._currentRenderId === rendererId) return false;
|
|
5426
|
+
if ((_this$_instanceServic2 = this._instanceService.getUnitCreateOptions(rendererId)) === null || _this$_instanceServic2 === void 0 ? void 0 : _this$_instanceServic2.embeddedRender) return false;
|
|
5187
5427
|
const renderer = this._renderManagerService.getRenderById(rendererId);
|
|
5188
5428
|
if (!renderer || !renderer.unitId || (0, _univerjs_core.isInternalEditorID)(renderer.unitId)) return false;
|
|
5189
5429
|
const currentRenderer = this._currentRenderId ? this._renderManagerService.getRenderById(this._currentRenderId) : null;
|
|
@@ -5199,17 +5439,15 @@ var SingleUnitUIController = class extends _univerjs_core.Disposable {
|
|
|
5199
5439
|
//#endregion
|
|
5200
5440
|
//#region src/controllers/ui/ui-desktop.controller.ts
|
|
5201
5441
|
let DesktopUIController = class DesktopUIController extends SingleUnitUIController {
|
|
5202
|
-
constructor(_config, injector, lifecycleService, renderManagerService, layoutService, instanceService, menuManagerService, uiPartsService
|
|
5442
|
+
constructor(_config, injector, lifecycleService, renderManagerService, layoutService, instanceService, menuManagerService, uiPartsService) {
|
|
5203
5443
|
super(injector, instanceService, layoutService, lifecycleService, renderManagerService);
|
|
5204
5444
|
this._config = _config;
|
|
5205
|
-
this._componentManager = _componentManager;
|
|
5206
5445
|
menuManagerService.mergeMenu(menuSchema);
|
|
5207
5446
|
this._initBuiltinComponents(uiPartsService);
|
|
5208
5447
|
this._bootstrapWorkbench();
|
|
5209
5448
|
}
|
|
5210
5449
|
dispose() {
|
|
5211
5450
|
super.dispose();
|
|
5212
|
-
this._componentManager.dispose();
|
|
5213
5451
|
}
|
|
5214
5452
|
bootstrap(callback) {
|
|
5215
5453
|
return bootstrap$1(this._injector, this._config, callback);
|
|
@@ -5227,8 +5465,7 @@ DesktopUIController = __decorate([
|
|
|
5227
5465
|
__decorateParam(4, ILayoutService),
|
|
5228
5466
|
__decorateParam(5, _univerjs_core.IUniverInstanceService),
|
|
5229
5467
|
__decorateParam(6, IMenuManagerService),
|
|
5230
|
-
__decorateParam(7, IUIPartsService)
|
|
5231
|
-
__decorateParam(8, (0, _univerjs_core.Inject)(ComponentManager))
|
|
5468
|
+
__decorateParam(7, IUIPartsService)
|
|
5232
5469
|
], DesktopUIController);
|
|
5233
5470
|
function bootstrap$1(injector, options, callback) {
|
|
5234
5471
|
let mountContainer;
|
|
@@ -5261,7 +5498,7 @@ const IUIController = (0, _univerjs_core.createIdentifier)("univer.ui.ui-control
|
|
|
5261
5498
|
//#endregion
|
|
5262
5499
|
//#region package.json
|
|
5263
5500
|
var name = "@univerjs/ui";
|
|
5264
|
-
var version = "1.0.0-alpha.
|
|
5501
|
+
var version = "1.0.0-alpha.4";
|
|
5265
5502
|
|
|
5266
5503
|
//#endregion
|
|
5267
5504
|
//#region src/views/color-picker/interface.ts
|
|
@@ -20291,15 +20528,13 @@ function EmojiPicker(props) {
|
|
|
20291
20528
|
children: [
|
|
20292
20529
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
20293
20530
|
className: "univer-flex univer-items-center univer-gap-1 univer-px-3 univer-pb-2 univer-pt-3",
|
|
20294
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.
|
|
20295
|
-
|
|
20296
|
-
|
|
20297
|
-
|
|
20298
|
-
|
|
20299
|
-
|
|
20300
|
-
|
|
20301
|
-
onChange: setQuery
|
|
20302
|
-
})]
|
|
20531
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
|
|
20532
|
+
"aria-label": localeService.t("ui.emojiPicker.search"),
|
|
20533
|
+
placeholder: localeService.t("ui.emojiPicker.search"),
|
|
20534
|
+
className: "univer-min-w-0 univer-flex-1",
|
|
20535
|
+
value: query,
|
|
20536
|
+
onChange: setQuery,
|
|
20537
|
+
slot: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.SearchIcon, { className: "univer-size-4 univer-text-gray-500 dark:!univer-text-gray-400" })
|
|
20303
20538
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
20304
20539
|
type: "button",
|
|
20305
20540
|
"aria-label": localeService.t("ui.emojiPicker.random"),
|
|
@@ -20333,12 +20568,12 @@ function EmojiPicker(props) {
|
|
|
20333
20568
|
className: (0, _univerjs_design.clsx)("univer-flex univer-h-10 univer-shrink-0 univer-items-center univer-border-gray-200 univer-px-2.5 dark:!univer-border-gray-600 [&_svg]:univer-size-5", _univerjs_design.borderTopClassName),
|
|
20334
20569
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CategoryButton, {
|
|
20335
20570
|
selected: !isSearching && activeTab === "recent",
|
|
20336
|
-
|
|
20571
|
+
titleKey: "ui.emojiPicker.recents",
|
|
20337
20572
|
onClick: () => scrollToSection("recent"),
|
|
20338
20573
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.RecentIcon, {})
|
|
20339
20574
|
}), EMOJI_CATEGORIES.map((category) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CategoryButton, {
|
|
20340
20575
|
selected: !isSearching && activeTab === category.key,
|
|
20341
|
-
|
|
20576
|
+
titleKey: category.titleKey,
|
|
20342
20577
|
onClick: () => scrollToSection(category.key),
|
|
20343
20578
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CategoryIcon, { category: category.key })
|
|
20344
20579
|
}, category.key))]
|
|
@@ -20379,11 +20614,12 @@ function EmojiGrid(props) {
|
|
|
20379
20614
|
});
|
|
20380
20615
|
}
|
|
20381
20616
|
function CategoryButton(props) {
|
|
20617
|
+
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
20382
20618
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
20383
20619
|
type: "button",
|
|
20384
|
-
"aria-label": props.
|
|
20620
|
+
"aria-label": localeService.t(props.titleKey),
|
|
20385
20621
|
"aria-selected": props.selected,
|
|
20386
|
-
title: props.
|
|
20622
|
+
title: localeService.t(props.titleKey),
|
|
20387
20623
|
className: (0, _univerjs_design.clsx)("univer-flex univer-h-[30px] univer-flex-1 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-lg univer-border-0 univer-bg-transparent univer-p-0 univer-text-gray-500 dark:!univer-text-gray-400", props.selected ? "univer-bg-primary-50 univer-text-primary-500 dark:!univer-bg-gray-800 dark:!univer-text-primary-400" : "hover:univer-bg-gray-50 hover:univer-text-gray-700 dark:hover:!univer-bg-gray-800 dark:hover:!univer-text-gray-300"),
|
|
20388
20624
|
onClick: props.onClick,
|
|
20389
20625
|
children: props.children
|
|
@@ -20416,72 +20652,207 @@ function CategoryIcon(props) {
|
|
|
20416
20652
|
//#region src/services/font.service.ts
|
|
20417
20653
|
const IFontService = (0, _univerjs_core.createIdentifier)("univer.font-service");
|
|
20418
20654
|
const DEFAULT_FONT_LIST = [
|
|
20419
|
-
|
|
20420
|
-
|
|
20421
|
-
|
|
20422
|
-
|
|
20423
|
-
|
|
20424
|
-
|
|
20425
|
-
|
|
20426
|
-
|
|
20427
|
-
|
|
20428
|
-
|
|
20429
|
-
|
|
20430
|
-
|
|
20431
|
-
|
|
20432
|
-
|
|
20433
|
-
|
|
20434
|
-
|
|
20435
|
-
|
|
20436
|
-
|
|
20437
|
-
|
|
20438
|
-
|
|
20439
|
-
|
|
20440
|
-
|
|
20441
|
-
|
|
20442
|
-
|
|
20443
|
-
|
|
20444
|
-
|
|
20445
|
-
|
|
20446
|
-
|
|
20447
|
-
|
|
20448
|
-
|
|
20449
|
-
|
|
20450
|
-
|
|
20451
|
-
|
|
20452
|
-
|
|
20453
|
-
|
|
20454
|
-
|
|
20455
|
-
|
|
20456
|
-
|
|
20457
|
-
|
|
20458
|
-
|
|
20459
|
-
|
|
20460
|
-
|
|
20461
|
-
|
|
20462
|
-
|
|
20463
|
-
|
|
20464
|
-
|
|
20465
|
-
|
|
20466
|
-
|
|
20467
|
-
|
|
20468
|
-
|
|
20469
|
-
|
|
20470
|
-
|
|
20471
|
-
|
|
20472
|
-
|
|
20473
|
-
|
|
20474
|
-
|
|
20475
|
-
|
|
20476
|
-
|
|
20477
|
-
|
|
20478
|
-
|
|
20479
|
-
|
|
20480
|
-
|
|
20481
|
-
|
|
20482
|
-
|
|
20483
|
-
|
|
20484
|
-
|
|
20655
|
+
"宋体",
|
|
20656
|
+
"Arial",
|
|
20657
|
+
"Baskerville",
|
|
20658
|
+
"Comic Sans MS",
|
|
20659
|
+
"Courier New",
|
|
20660
|
+
"Helvetica",
|
|
20661
|
+
"Times New Roman",
|
|
20662
|
+
"Verdana",
|
|
20663
|
+
"Apple LiGothic",
|
|
20664
|
+
"Apple LiSung",
|
|
20665
|
+
"Hei",
|
|
20666
|
+
"Kai",
|
|
20667
|
+
"LiHei Pro",
|
|
20668
|
+
"LiSong Pro",
|
|
20669
|
+
"STFangsong",
|
|
20670
|
+
"STHeiti",
|
|
20671
|
+
"STKaiti",
|
|
20672
|
+
"STSong",
|
|
20673
|
+
"报隶-繁",
|
|
20674
|
+
"报隶-简",
|
|
20675
|
+
"冬青黑体简体中文",
|
|
20676
|
+
"黑体-繁",
|
|
20677
|
+
"黑体-简",
|
|
20678
|
+
"华文仿宋",
|
|
20679
|
+
"华文楷体",
|
|
20680
|
+
"华文宋体",
|
|
20681
|
+
"楷体-繁",
|
|
20682
|
+
"楷体-简",
|
|
20683
|
+
"兰亭黑-繁",
|
|
20684
|
+
"兰亭黑-简",
|
|
20685
|
+
"隶变-繁",
|
|
20686
|
+
"隶变-简",
|
|
20687
|
+
"凌慧体-繁",
|
|
20688
|
+
"凌慧体-简",
|
|
20689
|
+
"翩翩体-繁",
|
|
20690
|
+
"翩翩体-简",
|
|
20691
|
+
"苹方-繁",
|
|
20692
|
+
"苹方-港",
|
|
20693
|
+
"苹方-简",
|
|
20694
|
+
"手札体-繁",
|
|
20695
|
+
"手札体-简",
|
|
20696
|
+
"宋体-繁",
|
|
20697
|
+
"宋体-简",
|
|
20698
|
+
"娃娃体-繁",
|
|
20699
|
+
"娃娃体-简",
|
|
20700
|
+
"魏碑-繁",
|
|
20701
|
+
"魏碑-简",
|
|
20702
|
+
"行楷-繁",
|
|
20703
|
+
"行楷-简",
|
|
20704
|
+
"雅痞-繁",
|
|
20705
|
+
"雅痞-简",
|
|
20706
|
+
"圆体-繁",
|
|
20707
|
+
"圆体-简",
|
|
20708
|
+
"Arial Black",
|
|
20709
|
+
"Big Caslon",
|
|
20710
|
+
"Courier",
|
|
20711
|
+
"Didot",
|
|
20712
|
+
"Futura",
|
|
20713
|
+
"Georgia",
|
|
20714
|
+
"Helvetica Neue",
|
|
20715
|
+
"Optima",
|
|
20716
|
+
"Times",
|
|
20717
|
+
"Tahoma",
|
|
20718
|
+
"BIZ UDGothic",
|
|
20719
|
+
"BIZ UDMincho",
|
|
20720
|
+
"Hiragino Maru Gothic Pro",
|
|
20721
|
+
"Hiragino Maru Gothic ProN",
|
|
20722
|
+
"Hiragino Mincho Pro",
|
|
20723
|
+
"Hiragino Mincho ProN",
|
|
20724
|
+
"Hiragino Sans",
|
|
20725
|
+
"Klee",
|
|
20726
|
+
"Osaka",
|
|
20727
|
+
"Toppan Bunkyu Gothic",
|
|
20728
|
+
"Toppan Bunkyu Midashi Gothic",
|
|
20729
|
+
"Toppan Bunkyu Midashi Mincho",
|
|
20730
|
+
"Toppan Bunkyu Mincho",
|
|
20731
|
+
"Tsukushi A Round Gothic",
|
|
20732
|
+
"Tsukushi B Round Gothic",
|
|
20733
|
+
"YuKyokasho",
|
|
20734
|
+
"YuKyokasho Yoko",
|
|
20735
|
+
"YuMincho +36p Kana",
|
|
20736
|
+
"American Typewriter",
|
|
20737
|
+
"Andale Mono",
|
|
20738
|
+
"Apple Chancery",
|
|
20739
|
+
"Apple SD Gothic Neo",
|
|
20740
|
+
"Apple Symbols",
|
|
20741
|
+
"AppleGothic",
|
|
20742
|
+
"AppleMyungjo",
|
|
20743
|
+
"Arial Unicode MS",
|
|
20744
|
+
"Athelas",
|
|
20745
|
+
"Avenir",
|
|
20746
|
+
"Avenir Next",
|
|
20747
|
+
"Avenir Next Condensed",
|
|
20748
|
+
"Ayuthaya",
|
|
20749
|
+
"Bangla MN",
|
|
20750
|
+
"Bangla Sangam MN",
|
|
20751
|
+
"Bauhaus 93",
|
|
20752
|
+
"Bodoni 72",
|
|
20753
|
+
"Bodoni 72 Oldstyle",
|
|
20754
|
+
"Bodoni 72 Smallcaps",
|
|
20755
|
+
"Bodoni Ornaments",
|
|
20756
|
+
"Bookshelf Symbol 7",
|
|
20757
|
+
"Bradley Hand",
|
|
20758
|
+
"Chalkboard",
|
|
20759
|
+
"Chalkboard SE",
|
|
20760
|
+
"Chalkduster",
|
|
20761
|
+
"Charter",
|
|
20762
|
+
"Cochin",
|
|
20763
|
+
"Copperplate",
|
|
20764
|
+
"Devanagari Sangam MN",
|
|
20765
|
+
"Din Alternate",
|
|
20766
|
+
"Euphemia UCAS",
|
|
20767
|
+
"Galvji",
|
|
20768
|
+
"Geneva",
|
|
20769
|
+
"Gill Sans",
|
|
20770
|
+
"Gujarati Sangam MN",
|
|
20771
|
+
"GungSeo",
|
|
20772
|
+
"Gurmukhi MN",
|
|
20773
|
+
"Gurmukhi Sangam MN",
|
|
20774
|
+
"HeadLineA",
|
|
20775
|
+
"Herculanum",
|
|
20776
|
+
"Hiragino Kaku Gothic Pro",
|
|
20777
|
+
"Hiragino Kaku Gothic ProN",
|
|
20778
|
+
"Hiragino Kaku Gothic Std",
|
|
20779
|
+
"Hiragino Kaku Gothic StdN",
|
|
20780
|
+
"Hoefler Text",
|
|
20781
|
+
"Impact",
|
|
20782
|
+
"InaiMathi",
|
|
20783
|
+
"Iowan Old Style",
|
|
20784
|
+
"Kannada MN",
|
|
20785
|
+
"Kannada Sangam MN",
|
|
20786
|
+
"Kefa",
|
|
20787
|
+
"Khmer MN",
|
|
20788
|
+
"Khmer Sangam MN",
|
|
20789
|
+
"Kohinoor Bangla",
|
|
20790
|
+
"Kohinoor Devanagari",
|
|
20791
|
+
"Kohinoor Telugu",
|
|
20792
|
+
"Krungthep",
|
|
20793
|
+
"Lao MN",
|
|
20794
|
+
"Lao Sangam MN",
|
|
20795
|
+
"Lucida Grande",
|
|
20796
|
+
"Luminari",
|
|
20797
|
+
"Malayalam MN",
|
|
20798
|
+
"Malayalam Sangam MN",
|
|
20799
|
+
"Marion",
|
|
20800
|
+
"Marker Felt",
|
|
20801
|
+
"Menlo",
|
|
20802
|
+
"Microsoft Sans Serif",
|
|
20803
|
+
"Modern No. 20",
|
|
20804
|
+
"Monaco",
|
|
20805
|
+
"Mukta Mahee",
|
|
20806
|
+
"Nanum Brush Script",
|
|
20807
|
+
"Nanum Gothic",
|
|
20808
|
+
"Nanum Myeongjo",
|
|
20809
|
+
"Nanum Pen Script",
|
|
20810
|
+
"Noteworthy",
|
|
20811
|
+
"Oriya MN",
|
|
20812
|
+
"Oriya Sangam MN",
|
|
20813
|
+
"Palatino",
|
|
20814
|
+
"Papyrus",
|
|
20815
|
+
"PCMyungjo",
|
|
20816
|
+
"Phosphate",
|
|
20817
|
+
"PilGi",
|
|
20818
|
+
"Plantagenet Cherokee",
|
|
20819
|
+
"PT Mono",
|
|
20820
|
+
"PT Sans",
|
|
20821
|
+
"PT Sans Caption",
|
|
20822
|
+
"PT Serif",
|
|
20823
|
+
"PT Serif Caption",
|
|
20824
|
+
"Rockwell",
|
|
20825
|
+
"Sathu",
|
|
20826
|
+
"Savoye LET",
|
|
20827
|
+
"Seravek",
|
|
20828
|
+
"Shree Devanagari 714",
|
|
20829
|
+
"SignPainter",
|
|
20830
|
+
"Silom",
|
|
20831
|
+
"Sinhala MN",
|
|
20832
|
+
"Sinhala Sangam MN",
|
|
20833
|
+
"Skia",
|
|
20834
|
+
"Snell Roundhand",
|
|
20835
|
+
"STIXGeneral",
|
|
20836
|
+
"Sukhumvit Set",
|
|
20837
|
+
"Superclarendon",
|
|
20838
|
+
"Tamil MN",
|
|
20839
|
+
"Tamil Sangam MN",
|
|
20840
|
+
"Telugu MN",
|
|
20841
|
+
"Telugu Sangam MN",
|
|
20842
|
+
"Trattatello",
|
|
20843
|
+
"Trebuchet MS",
|
|
20844
|
+
"Webdings",
|
|
20845
|
+
"Wingdings",
|
|
20846
|
+
"Wingdings 2",
|
|
20847
|
+
"Wingdings 3",
|
|
20848
|
+
"YuGothic",
|
|
20849
|
+
"YuGothic Light",
|
|
20850
|
+
"YuGothic Medium",
|
|
20851
|
+
"Zapfino"
|
|
20852
|
+
].map((value) => ({
|
|
20853
|
+
value,
|
|
20854
|
+
label: value
|
|
20855
|
+
}));
|
|
20485
20856
|
let FontService = class FontService {
|
|
20486
20857
|
constructor(_configService) {
|
|
20487
20858
|
this._configService = _configService;
|
|
@@ -20564,17 +20935,8 @@ FontService = __decorate([__decorateParam(0, _univerjs_core.IConfigService)], Fo
|
|
|
20564
20935
|
//#region src/views/font-family/use-font-list.ts
|
|
20565
20936
|
function useFontList() {
|
|
20566
20937
|
const fontService = (0, _wendellhu_redi_react_bindings.useDependency)(IFontService);
|
|
20567
|
-
const [fonts, setFonts] = (0, react.useState)(() => fontService.getFonts());
|
|
20568
|
-
(0, react.useEffect)(() => {
|
|
20569
|
-
const subscription = fontService.fonts$.subscribe((fonts) => {
|
|
20570
|
-
setFonts(fonts);
|
|
20571
|
-
});
|
|
20572
|
-
return () => {
|
|
20573
|
-
subscription.unsubscribe();
|
|
20574
|
-
};
|
|
20575
|
-
}, [fontService]);
|
|
20576
20938
|
return {
|
|
20577
|
-
fonts,
|
|
20939
|
+
fonts: (0, _wendellhu_redi_react_bindings.useObservable)(fontService.fonts$, fontService.getFonts()),
|
|
20578
20940
|
fontService
|
|
20579
20941
|
};
|
|
20580
20942
|
}
|
|
@@ -20653,11 +21015,13 @@ const FontFamily = ({ className, disabled: disabledProp, value, disabled$, onCha
|
|
|
20653
21015
|
const FONT_FAMILY_ITEM_COMPONENT = "UI_FONT_FAMILY_ITEM_COMPONENT";
|
|
20654
21016
|
const FontFamilyItem = ({ value, onChange }) => {
|
|
20655
21017
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
21018
|
+
const direction = (0, _wendellhu_redi_react_bindings.useObservable)(localeService.direction$, localeService.getDirection());
|
|
20656
21019
|
const { fonts, fontService } = useFontList();
|
|
20657
21020
|
function handleSelectFont(nextValue) {
|
|
20658
21021
|
onChange(nextValue);
|
|
20659
21022
|
}
|
|
20660
21023
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
21024
|
+
dir: direction,
|
|
20661
21025
|
className: "univer-m-0 univer-list-none univer-p-0 univer-text-sm",
|
|
20662
21026
|
style: { fontFamily: value },
|
|
20663
21027
|
children: fonts.map((font) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
@@ -20677,6 +21041,8 @@ const FontFamilyItem = ({ value, onChange }) => {
|
|
|
20677
21041
|
//#region src/views/font-family/FontFamilyDropdown.tsx
|
|
20678
21042
|
function FontFamilyDropdown(props) {
|
|
20679
21043
|
const { value, onChange, ariaLabel, className, disabled: disabledProp, disabled$, inputClassName, popupClassName, popupDataComponent, title, onMouseDown, onPointerDown } = props;
|
|
21044
|
+
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
21045
|
+
const direction = (0, _wendellhu_redi_react_bindings.useObservable)(localeService.direction$, localeService.getDirection());
|
|
20680
21046
|
const disabledObservableValue = (0, _wendellhu_redi_react_bindings.useObservable)(disabled$);
|
|
20681
21047
|
const disabled = Boolean(disabledProp || disabledObservableValue);
|
|
20682
21048
|
const [open, setOpen] = (0, react.useState)(false);
|
|
@@ -20690,6 +21056,7 @@ function FontFamilyDropdown(props) {
|
|
|
20690
21056
|
open,
|
|
20691
21057
|
onOpenChange: setOpen,
|
|
20692
21058
|
overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21059
|
+
dir: direction,
|
|
20693
21060
|
className: (0, _univerjs_design.clsx)("univer-max-h-72 univer-min-w-44 univer-overflow-y-auto univer-rounded-lg univer-border univer-border-solid univer-border-gray-200 univer-bg-white univer-p-1 univer-shadow-lg dark:!univer-border-gray-700 dark:!univer-bg-gray-900", popupClassName),
|
|
20694
21061
|
...popupDataAttributes,
|
|
20695
21062
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FontFamilyItem, {
|
|
@@ -20701,6 +21068,7 @@ function FontFamilyDropdown(props) {
|
|
|
20701
21068
|
"aria-disabled": disabled,
|
|
20702
21069
|
"aria-expanded": open,
|
|
20703
21070
|
"aria-label": ariaLabel,
|
|
21071
|
+
dir: direction,
|
|
20704
21072
|
className: (0, _univerjs_design.clsx)("univer-flex univer-h-6 univer-min-w-0 univer-cursor-default univer-items-center univer-justify-between univer-gap-1 univer-rounded-md univer-px-1.5 univer-text-sm univer-text-gray-900 hover:univer-bg-gray-100 dark:!univer-text-gray-100 dark:hover:!univer-bg-gray-700", { "univer-cursor-not-allowed univer-opacity-60": disabled }, className),
|
|
20705
21073
|
role: "combobox",
|
|
20706
21074
|
tabIndex: disabled ? -1 : 0,
|
|
@@ -20865,6 +21233,97 @@ const HeadingItem = (props) => {
|
|
|
20865
21233
|
};
|
|
20866
21234
|
const HEADING_ITEM_COMPONENT = "UI_COMPONENT_HEADING_ITEM";
|
|
20867
21235
|
|
|
21236
|
+
//#endregion
|
|
21237
|
+
//#region src/views/slider/ZoomInput.tsx
|
|
21238
|
+
function ZoomInput(props) {
|
|
21239
|
+
const iconManager = (0, _wendellhu_redi_react_bindings.useDependency)(IconManager);
|
|
21240
|
+
const { value = 100, min = 0, max = 400, shortcuts, disabled = false, className, onChange } = props;
|
|
21241
|
+
const isEditingRef = (0, react.useRef)(false);
|
|
21242
|
+
const [listVisible, setListVisible] = (0, react.useState)(false);
|
|
21243
|
+
const [inputValue, setInputValue] = (0, react.useState)(() => `${value}%`);
|
|
21244
|
+
(0, react.useEffect)(() => {
|
|
21245
|
+
if (!isEditingRef.current) setInputValue(`${value}%`);
|
|
21246
|
+
}, [value]);
|
|
21247
|
+
function clampValue(value) {
|
|
21248
|
+
return Math.min(Math.max(value, min), max);
|
|
21249
|
+
}
|
|
21250
|
+
function handleSelect(value) {
|
|
21251
|
+
if (disabled) return;
|
|
21252
|
+
setListVisible(false);
|
|
21253
|
+
onChange === null || onChange === void 0 || onChange(value);
|
|
21254
|
+
}
|
|
21255
|
+
function parseInput(rawValue) {
|
|
21256
|
+
const normalizedValue = rawValue.trim().replace(/%$/, "").trim();
|
|
21257
|
+
if (normalizedValue === "") return null;
|
|
21258
|
+
const parsedValue = Number(normalizedValue);
|
|
21259
|
+
if (!Number.isFinite(parsedValue)) return null;
|
|
21260
|
+
return Math.round(clampValue(parsedValue));
|
|
21261
|
+
}
|
|
21262
|
+
function handleFocus() {
|
|
21263
|
+
if (disabled) return;
|
|
21264
|
+
isEditingRef.current = true;
|
|
21265
|
+
setInputValue(String(value));
|
|
21266
|
+
}
|
|
21267
|
+
function commitInput() {
|
|
21268
|
+
if (disabled || !isEditingRef.current) return;
|
|
21269
|
+
const parsedValue = parseInput(inputValue);
|
|
21270
|
+
isEditingRef.current = false;
|
|
21271
|
+
if (parsedValue == null) {
|
|
21272
|
+
setInputValue(`${value}%`);
|
|
21273
|
+
return;
|
|
21274
|
+
}
|
|
21275
|
+
setInputValue(`${parsedValue}%`);
|
|
21276
|
+
if (parsedValue !== value) onChange === null || onChange === void 0 || onChange(parsedValue);
|
|
21277
|
+
}
|
|
21278
|
+
function handleKeyDown(e) {
|
|
21279
|
+
e.stopPropagation();
|
|
21280
|
+
if (e.key === "Enter") {
|
|
21281
|
+
e.preventDefault();
|
|
21282
|
+
commitInput();
|
|
21283
|
+
e.currentTarget.blur();
|
|
21284
|
+
}
|
|
21285
|
+
}
|
|
21286
|
+
const items = [{
|
|
21287
|
+
type: "radio",
|
|
21288
|
+
value: value.toString(),
|
|
21289
|
+
options: shortcuts.map((item) => ({
|
|
21290
|
+
value: item.toString(),
|
|
21291
|
+
label: `${item}%`
|
|
21292
|
+
})),
|
|
21293
|
+
onSelect: (value) => handleSelect(+value)
|
|
21294
|
+
}];
|
|
21295
|
+
const MoreDownIcon = iconManager.get("MoreDownIcon");
|
|
21296
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21297
|
+
className: (0, _univerjs_design.clsx)("univer-flex univer-h-6 univer-w-[68px] univer-flex-shrink-0 univer-items-center univer-overflow-hidden univer-rounded-md univer-border univer-border-gray-200 univer-bg-white dark:!univer-border-gray-600 dark:!univer-bg-gray-800", className, { "univer-opacity-60": disabled }),
|
|
21298
|
+
onClick: (e) => e.stopPropagation(),
|
|
21299
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
|
|
21300
|
+
className: "univer-box-border univer-h-6 univer-w-[52px] univer-border-none univer-bg-transparent [&_input:focus]:!univer-ring-0 [&_input]:univer-h-6 [&_input]:univer-w-[52px] [&_input]:univer-border-none [&_input]:!univer-bg-transparent [&_input]:univer-px-1 [&_input]:univer-text-center [&_input]:univer-text-xs [&_input]:univer-tabular-nums",
|
|
21301
|
+
inputClass: "univer-w-[52px]",
|
|
21302
|
+
size: "mini",
|
|
21303
|
+
value: inputValue,
|
|
21304
|
+
disabled,
|
|
21305
|
+
type: "text",
|
|
21306
|
+
onChange: setInputValue,
|
|
21307
|
+
onFocus: handleFocus,
|
|
21308
|
+
onBlur: commitInput,
|
|
21309
|
+
onKeyDown: handleKeyDown
|
|
21310
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.DropdownMenu, {
|
|
21311
|
+
align: "end",
|
|
21312
|
+
items,
|
|
21313
|
+
open: listVisible,
|
|
21314
|
+
disabled,
|
|
21315
|
+
onOpenChange: setListVisible,
|
|
21316
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
21317
|
+
className: "univer-h-6 univer-w-4 univer-rounded-none univer-p-0",
|
|
21318
|
+
size: "small",
|
|
21319
|
+
variant: "text",
|
|
21320
|
+
disabled,
|
|
21321
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MoreDownIcon, { className: "univer-size-3 univer-text-gray-500 dark:!univer-text-gray-300" })
|
|
21322
|
+
})
|
|
21323
|
+
})]
|
|
21324
|
+
});
|
|
21325
|
+
}
|
|
21326
|
+
|
|
20868
21327
|
//#endregion
|
|
20869
21328
|
//#region src/views/slider/Slider.tsx
|
|
20870
21329
|
const SLIDER_WIDTH = 116;
|
|
@@ -20879,18 +21338,12 @@ function Slider(props) {
|
|
|
20879
21338
|
const { value, min = 0, max = 400, disabled = false, resetPoint = 100, shortcuts, onChange } = props;
|
|
20880
21339
|
const isRtl = (0, _wendellhu_redi_react_bindings.useObservable)(localeService.direction$, localeService.getDirection()) === "rtl";
|
|
20881
21340
|
const sliderInnerRailRef = (0, react.useRef)(null);
|
|
20882
|
-
const isEditingZoomRef = (0, react.useRef)(false);
|
|
20883
21341
|
const dragValueRef = (0, react.useRef)(value);
|
|
20884
21342
|
const pendingDragValueRef = (0, react.useRef)(null);
|
|
20885
21343
|
const lastCommittedDragValueRef = (0, react.useRef)(value);
|
|
20886
21344
|
const dragCommitTimerRef = (0, react.useRef)(null);
|
|
20887
|
-
const [zoomListVisible, setZoomListVisible] = (0, react.useState)(false);
|
|
20888
21345
|
const [isDragging, setIsDragging] = (0, react.useState)(false);
|
|
20889
21346
|
const [dragValue, setDragValue] = (0, react.useState)(value);
|
|
20890
|
-
const [zoomInputValue, setZoomInputValue] = (0, react.useState)(() => `${value}%`);
|
|
20891
|
-
(0, react.useEffect)(() => {
|
|
20892
|
-
if (!isEditingZoomRef.current) setZoomInputValue(`${value}%`);
|
|
20893
|
-
}, [value]);
|
|
20894
21347
|
(0, react.useEffect)(() => () => {
|
|
20895
21348
|
clearDragCommitTimer();
|
|
20896
21349
|
}, []);
|
|
@@ -20989,61 +21442,11 @@ function Slider(props) {
|
|
|
20989
21442
|
window.addEventListener("pointerup", onPointerUp);
|
|
20990
21443
|
window.addEventListener("pointerout", onPointerOut);
|
|
20991
21444
|
}
|
|
20992
|
-
function handleSelectZoomLevel(value) {
|
|
20993
|
-
if (disabled) return;
|
|
20994
|
-
setZoomListVisible(false);
|
|
20995
|
-
onChange && onChange(value);
|
|
20996
|
-
}
|
|
20997
|
-
function parseExactZoomInput(rawValue) {
|
|
20998
|
-
const normalizedValue = rawValue.trim().replace(/%$/, "").trim();
|
|
20999
|
-
if (normalizedValue === "") return null;
|
|
21000
|
-
const parsedValue = Number(normalizedValue);
|
|
21001
|
-
if (!Number.isFinite(parsedValue)) return null;
|
|
21002
|
-
return Math.round(clampValue(parsedValue));
|
|
21003
|
-
}
|
|
21004
|
-
function handleExactZoomFocus() {
|
|
21005
|
-
if (disabled) return;
|
|
21006
|
-
isEditingZoomRef.current = true;
|
|
21007
|
-
setZoomInputValue(String(value));
|
|
21008
|
-
}
|
|
21009
|
-
function commitExactZoomInput() {
|
|
21010
|
-
if (disabled) return;
|
|
21011
|
-
if (!isEditingZoomRef.current) return;
|
|
21012
|
-
const parsedValue = parseExactZoomInput(zoomInputValue);
|
|
21013
|
-
isEditingZoomRef.current = false;
|
|
21014
|
-
if (parsedValue == null) {
|
|
21015
|
-
setZoomInputValue(`${value}%`);
|
|
21016
|
-
return;
|
|
21017
|
-
}
|
|
21018
|
-
setZoomInputValue(`${parsedValue}%`);
|
|
21019
|
-
if (parsedValue !== value) onChange && onChange(parsedValue);
|
|
21020
|
-
}
|
|
21021
|
-
function handleExactZoomChange(value) {
|
|
21022
|
-
setZoomInputValue(value);
|
|
21023
|
-
}
|
|
21024
|
-
function handleInputKeyDown(e) {
|
|
21025
|
-
e.stopPropagation();
|
|
21026
|
-
if (e.key === "Enter") {
|
|
21027
|
-
e.preventDefault();
|
|
21028
|
-
commitExactZoomInput();
|
|
21029
|
-
e.currentTarget.blur();
|
|
21030
|
-
}
|
|
21031
|
-
}
|
|
21032
|
-
const items = [{
|
|
21033
|
-
type: "radio",
|
|
21034
|
-
value: value.toString(),
|
|
21035
|
-
options: shortcuts.map((item) => ({
|
|
21036
|
-
value: item.toString(),
|
|
21037
|
-
label: `${item}%`
|
|
21038
|
-
})),
|
|
21039
|
-
onSelect: (value) => handleSelectZoomLevel(+value)
|
|
21040
|
-
}];
|
|
21041
21445
|
const visualValue = isDragging ? dragValue : value;
|
|
21042
21446
|
const sliderOffset = Math.min(Math.max((_getSliderOffset = getSliderOffset(visualValue)) !== null && _getSliderOffset !== void 0 ? _getSliderOffset : 0, 0), 100);
|
|
21043
21447
|
const handleOffset = isRtl ? 100 - sliderOffset : sliderOffset;
|
|
21044
21448
|
const ReduceIcon = iconManager.get("ReduceIcon");
|
|
21045
21449
|
const IncreaseIcon = iconManager.get("IncreaseIcon");
|
|
21046
|
-
const MoreDownIcon = iconManager.get("MoreDownIcon");
|
|
21047
21450
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21048
21451
|
className: (0, _univerjs_design.clsx)("univer-flex univer-select-none univer-items-center univer-gap-1.5", { "univer-cursor-not-allowed": disabled }),
|
|
21049
21452
|
children: [
|
|
@@ -21101,33 +21504,13 @@ function Slider(props) {
|
|
|
21101
21504
|
onClick: () => handleStep(10),
|
|
21102
21505
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IncreaseIcon, { className: "univer-text-gray-500" })
|
|
21103
21506
|
}),
|
|
21104
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
21105
|
-
|
|
21106
|
-
|
|
21107
|
-
|
|
21108
|
-
|
|
21109
|
-
|
|
21110
|
-
|
|
21111
|
-
disabled,
|
|
21112
|
-
type: "text",
|
|
21113
|
-
onChange: handleExactZoomChange,
|
|
21114
|
-
onFocus: handleExactZoomFocus,
|
|
21115
|
-
onBlur: commitExactZoomInput,
|
|
21116
|
-
onKeyDown: handleInputKeyDown
|
|
21117
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.DropdownMenu, {
|
|
21118
|
-
align: "end",
|
|
21119
|
-
items,
|
|
21120
|
-
open: zoomListVisible,
|
|
21121
|
-
disabled,
|
|
21122
|
-
onOpenChange: setZoomListVisible,
|
|
21123
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
21124
|
-
className: "univer-h-6 univer-w-4 univer-rounded-none univer-p-0",
|
|
21125
|
-
size: "small",
|
|
21126
|
-
variant: "text",
|
|
21127
|
-
disabled,
|
|
21128
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MoreDownIcon, { className: "univer-size-3 univer-text-gray-500 dark:!univer-text-gray-300" })
|
|
21129
|
-
})
|
|
21130
|
-
})]
|
|
21507
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ZoomInput, {
|
|
21508
|
+
value,
|
|
21509
|
+
min,
|
|
21510
|
+
max,
|
|
21511
|
+
shortcuts,
|
|
21512
|
+
disabled,
|
|
21513
|
+
onChange
|
|
21131
21514
|
})
|
|
21132
21515
|
]
|
|
21133
21516
|
});
|
|
@@ -21160,11 +21543,13 @@ let ComponentsController = class ComponentsController extends _univerjs_core.Dis
|
|
|
21160
21543
|
}
|
|
21161
21544
|
_registerIcons() {
|
|
21162
21545
|
this.disposeWithMe(this._iconManager.register({
|
|
21546
|
+
ExpandIcon: _univerjs_icons.ExpandIcon,
|
|
21163
21547
|
IncreaseIcon: _univerjs_icons.IncreaseIcon,
|
|
21164
21548
|
MoreDownIcon: _univerjs_icons.MoreDownIcon,
|
|
21165
21549
|
RedoIcon: _univerjs_icons.RedoIcon,
|
|
21166
21550
|
ReduceIcon: _univerjs_icons.ReduceIcon,
|
|
21167
21551
|
ShortcutIcon: _univerjs_icons.ShortcutIcon,
|
|
21552
|
+
ShrinkIcon: _univerjs_icons.ShrinkIcon,
|
|
21168
21553
|
UndoIcon: _univerjs_icons.UndoIcon
|
|
21169
21554
|
}));
|
|
21170
21555
|
}
|
|
@@ -21188,14 +21573,6 @@ ComponentsController = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)
|
|
|
21188
21573
|
//#endregion
|
|
21189
21574
|
//#region src/views/components/ribbon/MobileRibbon.tsx
|
|
21190
21575
|
const toolbarScrollOffset = 168;
|
|
21191
|
-
const nestedControlResetClassName = `
|
|
21192
|
-
[&_button]:!univer-m-0 [&_button]:!univer-appearance-none [&_button]:!univer-border-0
|
|
21193
|
-
[&_button]:!univer-bg-transparent [&_button]:!univer-p-0 [&_button]:!univer-leading-none
|
|
21194
|
-
[&_button]:!univer-outline-none
|
|
21195
|
-
[&_input]:!univer-m-0 [&_input]:!univer-appearance-none [&_input]:!univer-border-0
|
|
21196
|
-
[&_input]:!univer-bg-transparent [&_input]:!univer-p-0 [&_input]:!univer-leading-none
|
|
21197
|
-
[&_input]:!univer-outline-none
|
|
21198
|
-
`;
|
|
21199
21576
|
function MobileRibbon(props) {
|
|
21200
21577
|
var _activeGroup$children;
|
|
21201
21578
|
const { headerMenuComponents, headerMenu = true } = props;
|
|
@@ -21263,7 +21640,7 @@ function MobileRibbon(props) {
|
|
|
21263
21640
|
type: "button",
|
|
21264
21641
|
className: (0, _univerjs_design.clsx)(_univerjs_design.resetButtonClassName, "univer-size-7 univer-rounded-md univer-text-gray-500 univer-transition-colors hover:univer-bg-gray-100 active:univer-bg-gray-200 dark:!univer-text-gray-300 dark:hover:!univer-bg-gray-700 dark:active:!univer-bg-gray-600", { "univer-opacity-40": activeIndex === 0 }),
|
|
21265
21642
|
disabled: activeIndex === 0,
|
|
21266
|
-
"aria-label": "
|
|
21643
|
+
"aria-label": localeService.t("ui.navigation.previous"),
|
|
21267
21644
|
onClick: () => selectTab(activeIndex - 1),
|
|
21268
21645
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreLeftIcon, { className: "univer-rotate-180 univer-text-sm" })
|
|
21269
21646
|
})
|
|
@@ -21300,7 +21677,7 @@ function MobileRibbon(props) {
|
|
|
21300
21677
|
dark:active:!univer-bg-gray-600
|
|
21301
21678
|
`, { "univer-opacity-40": activeIndex >= ribbon.length - 1 }),
|
|
21302
21679
|
disabled: activeIndex >= ribbon.length - 1,
|
|
21303
|
-
"aria-label": "
|
|
21680
|
+
"aria-label": localeService.t("ui.navigation.next"),
|
|
21304
21681
|
onClick: () => selectTab(activeIndex + 1),
|
|
21305
21682
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreRightIcon, { className: "univer-text-sm" })
|
|
21306
21683
|
}), hasHeaderMenu && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -21320,7 +21697,7 @@ function MobileRibbon(props) {
|
|
|
21320
21697
|
dark:!univer-text-gray-300
|
|
21321
21698
|
`, { "univer-opacity-30": !canScrollLeft }),
|
|
21322
21699
|
disabled: !canScrollLeft,
|
|
21323
|
-
"aria-label": "
|
|
21700
|
+
"aria-label": localeService.t("ui.navigation.previous"),
|
|
21324
21701
|
onClick: () => scrollToolbar("left"),
|
|
21325
21702
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreLeftIcon, { className: "univer-text-sm" })
|
|
21326
21703
|
}),
|
|
@@ -21335,7 +21712,7 @@ function MobileRibbon(props) {
|
|
|
21335
21712
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21336
21713
|
className: (0, _univerjs_design.clsx)("univer-flex univer-shrink-0 univer-items-center univer-gap-0.5 univer-pr-1.5 rtl:univer-pl-1.5 rtl:univer-pr-0", { [_univerjs_design.borderRightClassName]: groupIndex !== activeGroups.length - 1 }),
|
|
21337
21714
|
children: groupItems.map((child) => child.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21338
|
-
className: (0, _univerjs_design.clsx)("[&_button]:!univer-font-inherit univer-flex univer-h-8 univer-shrink-0 univer-items-center univer-rounded-md [&_*]:univer-box-border [&_.univer-custom-label]:univer-text-sm [&_.univer-custom-label]:univer-leading-none [&_.univer-toolbar-button-selector-main]:!univer-h-8 [&_.univer-toolbar-button-selector-main]:!univer-rounded-none [&_.univer-toolbar-button-selector-main]:!univer-rounded-l-md [&_.univer-toolbar-button-selector-main]:!univer-px-1.5 [&_.univer-toolbar-button-selector-root]:!univer-h-8 [&_.univer-toolbar-button-selector-root]:univer-overflow-hidden [&_.univer-toolbar-button-selector-root]:!univer-rounded-md [&_.univer-toolbar-button-selector-root]:!univer-pr-0 [&_.univer-toolbar-button-selector-trigger]:!univer-static [&_.univer-toolbar-button-selector-trigger]:!univer-h-8 [&_.univer-toolbar-button-selector-trigger]:!univer-w-6 [&_.univer-toolbar-button-selector-trigger]:!univer-rounded-none [&_.univer-toolbar-button-selector-trigger]:!univer-rounded-r-md [&_.univer-toolbar-selector-root]:!univer-h-8 [&_.univer-toolbar-selector-root]:!univer-gap-1 [&_.univer-toolbar-selector-root]:!univer-rounded-md [&_.univer-toolbar-selector-root]:!univer-px-1.5 [&_.univer-toolbar-selector-trigger]:!univer-pl-0.5 [&_.univer-tooltip]:univer-inline-flex [&_.univer-tooltip]:univer-h-full [&_.univer-tooltip]:univer-items-center [&_[data-u-command]]:!univer-h-8 [&_[data-u-command]]:!univer-min-h-8 [&_[data-u-command]]:!univer-rounded-md [&_[data-u-command]]:!univer-px-1.5 [&_button]:!univer-h-8 [&_button]:!univer-min-w-8 [&_button]:!univer-rounded-md [&_button]:!univer-px-1.5"
|
|
21715
|
+
className: (0, _univerjs_design.clsx)("[&_button]:!univer-font-inherit univer-flex univer-h-8 univer-shrink-0 univer-items-center univer-rounded-md [&_*]:univer-box-border [&_.univer-custom-label]:univer-text-sm [&_.univer-custom-label]:univer-leading-none [&_.univer-toolbar-button-selector-main]:!univer-h-8 [&_.univer-toolbar-button-selector-main]:!univer-rounded-none [&_.univer-toolbar-button-selector-main]:!univer-rounded-l-md [&_.univer-toolbar-button-selector-main]:!univer-px-1.5 [&_.univer-toolbar-button-selector-root]:!univer-h-8 [&_.univer-toolbar-button-selector-root]:univer-overflow-hidden [&_.univer-toolbar-button-selector-root]:!univer-rounded-md [&_.univer-toolbar-button-selector-root]:!univer-pr-0 [&_.univer-toolbar-button-selector-trigger]:!univer-static [&_.univer-toolbar-button-selector-trigger]:!univer-h-8 [&_.univer-toolbar-button-selector-trigger]:!univer-w-6 [&_.univer-toolbar-button-selector-trigger]:!univer-rounded-none [&_.univer-toolbar-button-selector-trigger]:!univer-rounded-r-md [&_.univer-toolbar-selector-root]:!univer-h-8 [&_.univer-toolbar-selector-root]:!univer-gap-1 [&_.univer-toolbar-selector-root]:!univer-rounded-md [&_.univer-toolbar-selector-root]:!univer-px-1.5 [&_.univer-toolbar-selector-trigger]:!univer-pl-0.5 [&_.univer-tooltip]:univer-inline-flex [&_.univer-tooltip]:univer-h-full [&_.univer-tooltip]:univer-items-center [&_[data-u-command]]:!univer-h-8 [&_[data-u-command]]:!univer-min-h-8 [&_[data-u-command]]:!univer-rounded-md [&_[data-u-command]]:!univer-px-1.5 [&_button]:!univer-m-0 [&_button]:!univer-h-8 [&_button]:!univer-min-w-8 [&_button]:!univer-appearance-none [&_button]:!univer-rounded-md [&_button]:!univer-border-0 [&_button]:!univer-bg-transparent [&_button]:!univer-p-0 [&_button]:!univer-px-1.5 [&_button]:!univer-leading-none [&_button]:!univer-outline-none [&_input]:!univer-m-0 [&_input]:!univer-appearance-none [&_input]:!univer-border-0 [&_input]:!univer-bg-transparent [&_input]:!univer-p-0 [&_input]:!univer-leading-none [&_input]:!univer-outline-none"),
|
|
21339
21716
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarItem, { ...child.item })
|
|
21340
21717
|
}, child.key))
|
|
21341
21718
|
}, groupItem.key);
|
|
@@ -21349,7 +21726,7 @@ function MobileRibbon(props) {
|
|
|
21349
21726
|
dark:!univer-text-gray-300
|
|
21350
21727
|
`, { "univer-opacity-30": !canScrollRight }),
|
|
21351
21728
|
disabled: !canScrollRight,
|
|
21352
|
-
"aria-label": "
|
|
21729
|
+
"aria-label": localeService.t("ui.navigation.next"),
|
|
21353
21730
|
onClick: () => scrollToolbar("right"),
|
|
21354
21731
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreRightIcon, { className: "univer-text-sm" })
|
|
21355
21732
|
})
|
|
@@ -21362,8 +21739,10 @@ function MobileRibbon(props) {
|
|
|
21362
21739
|
//#region src/views/menu/mobile/MobileMenu.tsx
|
|
21363
21740
|
function MobileMenu(props) {
|
|
21364
21741
|
var _viewStack;
|
|
21365
|
-
const { menuType, onOptionSelect, schemas: providedSchemas } = props;
|
|
21366
|
-
const
|
|
21742
|
+
const { menuType, onOptionSelect, schemas: providedSchemas, menuManagerService: providedMenuManagerService } = props;
|
|
21743
|
+
const rootMenuManagerService = (0, _wendellhu_redi_react_bindings.useDependency)(IMenuManagerService);
|
|
21744
|
+
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
21745
|
+
const menuManagerService = providedMenuManagerService !== null && providedMenuManagerService !== void 0 ? providedMenuManagerService : rootMenuManagerService;
|
|
21367
21746
|
const [viewStack, setViewStack] = (0, react.useState)([]);
|
|
21368
21747
|
const menuSchemas = (0, react.useMemo)(() => {
|
|
21369
21748
|
if (providedSchemas) return providedSchemas;
|
|
@@ -21391,7 +21770,7 @@ function MobileMenu(props) {
|
|
|
21391
21770
|
children: [
|
|
21392
21771
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
21393
21772
|
type: "button",
|
|
21394
|
-
"aria-label": "
|
|
21773
|
+
"aria-label": localeService.t("ui.navigation.back"),
|
|
21395
21774
|
className: "univer-flex univer-size-8 univer-appearance-none univer-items-center univer-justify-center univer-rounded-full univer-border-0 univer-bg-transparent univer-p-0 univer-text-gray-700 hover:univer-bg-gray-100 active:univer-bg-gray-200",
|
|
21396
21775
|
onClick: closeView,
|
|
21397
21776
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreLeftIcon, { className: "univer-text-base" })
|
|
@@ -21411,6 +21790,7 @@ function MobileMenu(props) {
|
|
|
21411
21790
|
className: "univer-overflow-hidden univer-rounded-2xl univer-bg-white",
|
|
21412
21791
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileSchemaList, {
|
|
21413
21792
|
schemas: (currentView === null || currentView === void 0 ? void 0 : currentView.kind) === "schema" ? currentView.schemas : menuSchemas,
|
|
21793
|
+
menuManagerService,
|
|
21414
21794
|
menuType,
|
|
21415
21795
|
onExecute: onOptionSelect,
|
|
21416
21796
|
onOpenView: openView
|
|
@@ -21429,7 +21809,7 @@ function MobileMenu(props) {
|
|
|
21429
21809
|
});
|
|
21430
21810
|
}
|
|
21431
21811
|
function MobileSchemaList(props) {
|
|
21432
|
-
const { schemas, menuType, onExecute, onOpenView } = props;
|
|
21812
|
+
const { schemas, menuManagerService, menuType, onExecute, onOpenView } = props;
|
|
21433
21813
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
21434
21814
|
const hiddenGroupStates = useContextGroupHiddenStates(schemas);
|
|
21435
21815
|
const visibleSchemas = (0, react.useMemo)(() => {
|
|
@@ -21443,6 +21823,7 @@ function MobileSchemaList(props) {
|
|
|
21443
21823
|
var _schema$children2;
|
|
21444
21824
|
if (schema.item) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileSchemaRow, {
|
|
21445
21825
|
schema,
|
|
21826
|
+
menuManagerService,
|
|
21446
21827
|
menuType,
|
|
21447
21828
|
onExecute,
|
|
21448
21829
|
onOpenView,
|
|
@@ -21456,6 +21837,7 @@ function MobileSchemaList(props) {
|
|
|
21456
21837
|
children: localeService.t(schema.title)
|
|
21457
21838
|
}), schema.children.map((childSchema, childIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileSchemaRow, {
|
|
21458
21839
|
schema: childSchema,
|
|
21840
|
+
menuManagerService,
|
|
21459
21841
|
menuType,
|
|
21460
21842
|
onExecute,
|
|
21461
21843
|
onOpenView,
|
|
@@ -21465,9 +21847,10 @@ function MobileSchemaList(props) {
|
|
|
21465
21847
|
}) });
|
|
21466
21848
|
}
|
|
21467
21849
|
function MobileSchemaRow(props) {
|
|
21468
|
-
const { schema, menuType, onExecute, onOpenView, bordered } = props;
|
|
21850
|
+
const { schema, menuManagerService, menuType, onExecute, onOpenView, bordered } = props;
|
|
21469
21851
|
const interaction = useMobileSchemaInteraction({
|
|
21470
21852
|
schema,
|
|
21853
|
+
menuManagerService,
|
|
21471
21854
|
menuType,
|
|
21472
21855
|
onOpenView
|
|
21473
21856
|
});
|
|
@@ -21542,8 +21925,7 @@ function MobileSelectionOptionRow(props) {
|
|
|
21542
21925
|
}
|
|
21543
21926
|
function useMobileSchemaInteraction(props) {
|
|
21544
21927
|
var _schema$children3;
|
|
21545
|
-
const { schema, menuType, onOpenView } = props;
|
|
21546
|
-
const menuManagerService = (0, _wendellhu_redi_react_bindings.useDependency)(IMenuManagerService);
|
|
21928
|
+
const { schema, menuManagerService, menuType, onOpenView } = props;
|
|
21547
21929
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
21548
21930
|
const menuItem = schema.item;
|
|
21549
21931
|
const selectorItem = menuItem;
|
|
@@ -21624,30 +22006,20 @@ function getMenuSchemaTitle(schema, localeService) {
|
|
|
21624
22006
|
return schema.key;
|
|
21625
22007
|
}
|
|
21626
22008
|
function useContextGroupHiddenStates(menuSchemas) {
|
|
21627
|
-
|
|
21628
|
-
|
|
21629
|
-
const subscriptions = menuSchemas.map((menuSchema) => {
|
|
22009
|
+
return (0, _wendellhu_redi_react_bindings.useObservable)((0, react.useMemo)(() => {
|
|
22010
|
+
const groupStates = menuSchemas.flatMap((menuSchema) => {
|
|
21630
22011
|
var _menuSchema$children;
|
|
21631
|
-
|
|
21632
|
-
const hiddenObservables = getLeafItemSchemas(menuSchema.children).map((childSchema) => {
|
|
22012
|
+
const hiddenObservables = ((_menuSchema$children = menuSchema.children) === null || _menuSchema$children === void 0 ? void 0 : _menuSchema$children.length) ? getLeafItemSchemas(menuSchema.children).map((childSchema) => {
|
|
21633
22013
|
var _childSchema$item$hid, _childSchema$item;
|
|
21634
22014
|
return (_childSchema$item$hid = (_childSchema$item = childSchema.item) === null || _childSchema$item === void 0 ? void 0 : _childSchema$item.hidden$) !== null && _childSchema$item$hid !== void 0 ? _childSchema$item$hid : (0, rxjs.of)(false);
|
|
21635
|
-
});
|
|
21636
|
-
|
|
21637
|
-
return (0, rxjs.combineLatest)(hiddenObservables).subscribe((hiddenValues) => {
|
|
21638
|
-
const isAllHidden = hiddenValues.every((hidden) => hidden === true);
|
|
21639
|
-
setHiddenStates((state) => ({
|
|
21640
|
-
...state,
|
|
21641
|
-
[menuSchema.key]: isAllHidden
|
|
21642
|
-
}));
|
|
21643
|
-
});
|
|
22015
|
+
}) : [];
|
|
22016
|
+
return hiddenObservables.length ? [(0, rxjs.combineLatest)(hiddenObservables).pipe((0, rxjs.map)((values) => [menuSchema.key, values.every(Boolean)]))] : [];
|
|
21644
22017
|
});
|
|
21645
|
-
return () => {
|
|
21646
|
-
|
|
21647
|
-
|
|
21648
|
-
};
|
|
21649
|
-
}, [menuSchemas]);
|
|
21650
|
-
return hiddenStates;
|
|
22018
|
+
return groupStates.length ? (0, rxjs.merge)(...groupStates).pipe((0, rxjs_operators.scan)((states, [key, hidden]) => ({
|
|
22019
|
+
...states,
|
|
22020
|
+
[key]: hidden
|
|
22021
|
+
}), {}), (0, rxjs_operators.startWith)({})) : (0, rxjs.of)({});
|
|
22022
|
+
}, [menuSchemas]), {});
|
|
21651
22023
|
}
|
|
21652
22024
|
function getLeafItemSchemas(schemas) {
|
|
21653
22025
|
return schemas.reduce((acc, schema) => {
|
|
@@ -21664,11 +22036,14 @@ const MOBILE_CONTEXT_MENU_HOST_ID = "mobile-context-menu";
|
|
|
21664
22036
|
function MobileContextMenu() {
|
|
21665
22037
|
const [visible, setVisible] = (0, react.useState)(false);
|
|
21666
22038
|
const [menuType, setMenuType] = (0, react.useState)("");
|
|
22039
|
+
const [menuContext, setMenuContext] = (0, react.useState)();
|
|
21667
22040
|
const visibleRef = (0, react.useRef)(visible);
|
|
21668
22041
|
const contextMenuHostService = (0, _wendellhu_redi_react_bindings.useDependency)(IContextMenuHostService);
|
|
21669
22042
|
const contextMenuService = (0, _wendellhu_redi_react_bindings.useDependency)(IContextMenuService);
|
|
21670
22043
|
const commandService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ICommandService);
|
|
21671
22044
|
const layoutService = (0, _wendellhu_redi_react_bindings.useDependency)(ILayoutService);
|
|
22045
|
+
const menuManagerService = (0, _wendellhu_redi_react_bindings.useDependency)(IMenuManagerService);
|
|
22046
|
+
const runtimeScopeService = (0, _wendellhu_redi_react_bindings.useDependency)(IUIRuntimeScopeService);
|
|
21672
22047
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
21673
22048
|
const direction = (0, _wendellhu_redi_react_bindings.useObservable)(localeService.direction$);
|
|
21674
22049
|
const { mountContainer } = (0, react.useContext)(_univerjs_design.ConfigContext);
|
|
@@ -21692,9 +22067,10 @@ function MobileContextMenu() {
|
|
|
21692
22067
|
contextMenuHostService.deactivateMenu(MOBILE_CONTEXT_MENU_HOST_ID);
|
|
21693
22068
|
};
|
|
21694
22069
|
}, [contextMenuHostService, contextMenuService]);
|
|
21695
|
-
function handleContextMenu(_event, nextMenuType) {
|
|
22070
|
+
function handleContextMenu(_event, nextMenuType, context) {
|
|
21696
22071
|
contextMenuHostService.activateMenu(MOBILE_CONTEXT_MENU_HOST_ID);
|
|
21697
22072
|
setMenuType(nextMenuType);
|
|
22073
|
+
setMenuContext(context);
|
|
21698
22074
|
setVisible(true);
|
|
21699
22075
|
}
|
|
21700
22076
|
function handleClose() {
|
|
@@ -21709,6 +22085,23 @@ function MobileContextMenu() {
|
|
|
21709
22085
|
}
|
|
21710
22086
|
}, [localeService, menuType]);
|
|
21711
22087
|
if (!mountContainer || !visible) return null;
|
|
22088
|
+
const activeScope = runtimeScopeService.get(menuContext === null || menuContext === void 0 ? void 0 : menuContext.unitId);
|
|
22089
|
+
const activeCommandService = (activeScope === null || activeScope === void 0 ? void 0 : activeScope.has(_univerjs_core.ICommandService)) ? activeScope.get(_univerjs_core.ICommandService) : commandService;
|
|
22090
|
+
const activeLayoutService = (activeScope === null || activeScope === void 0 ? void 0 : activeScope.has(ILayoutService)) ? activeScope.get(ILayoutService) : layoutService;
|
|
22091
|
+
const menu = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileMenu, {
|
|
22092
|
+
menuType,
|
|
22093
|
+
menuManagerService: (activeScope === null || activeScope === void 0 ? void 0 : activeScope.has(IMenuManagerService)) ? activeScope.get(IMenuManagerService) : menuManagerService,
|
|
22094
|
+
onOptionSelect: (params) => {
|
|
22095
|
+
var _ref, _params$commandId;
|
|
22096
|
+
const commandId = (_ref = (_params$commandId = params.commandId) !== null && _params$commandId !== void 0 ? _params$commandId : params.id) !== null && _ref !== void 0 ? _ref : params.label;
|
|
22097
|
+
const fallbackParams = typeof params.params === "function" ? params.params() : params.params;
|
|
22098
|
+
const commandParams = typeof params.value === "undefined" ? fallbackParams : { value: params.value };
|
|
22099
|
+
if (!commandId) return;
|
|
22100
|
+
activeLayoutService.focus();
|
|
22101
|
+
activeCommandService.executeCommand(commandId, commandParams);
|
|
22102
|
+
handleClose();
|
|
22103
|
+
}
|
|
22104
|
+
});
|
|
21712
22105
|
return (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21713
22106
|
dir: direction,
|
|
21714
22107
|
className: "univer-fixed univer-inset-0 univer-z-[1080] univer-flex univer-items-end",
|
|
@@ -21742,19 +22135,7 @@ function MobileContextMenu() {
|
|
|
21742
22135
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.CloseIcon, { className: "univer-size-4 univer-text-current" })
|
|
21743
22136
|
})]
|
|
21744
22137
|
})]
|
|
21745
|
-
}), menuType &&
|
|
21746
|
-
menuType,
|
|
21747
|
-
onOptionSelect: (params) => {
|
|
21748
|
-
var _ref, _params$commandId;
|
|
21749
|
-
const commandId = (_ref = (_params$commandId = params.commandId) !== null && _params$commandId !== void 0 ? _params$commandId : params.id) !== null && _ref !== void 0 ? _ref : params.label;
|
|
21750
|
-
const fallbackParams = typeof params.params === "function" ? params.params() : params.params;
|
|
21751
|
-
const commandParams = typeof params.value === "undefined" ? fallbackParams : { value: params.value };
|
|
21752
|
-
if (!commandId) return;
|
|
21753
|
-
layoutService.focus();
|
|
21754
|
-
commandService.executeCommand(commandId, commandParams);
|
|
21755
|
-
handleClose();
|
|
21756
|
-
}
|
|
21757
|
-
})]
|
|
22138
|
+
}), menuType && menu]
|
|
21758
22139
|
})]
|
|
21759
22140
|
}), mountContainer);
|
|
21760
22141
|
}
|
|
@@ -21781,20 +22162,12 @@ function MobileWorkbench(props) {
|
|
|
21781
22162
|
const leftSidebarComponents = useComponentsOfPart("left-sidebar");
|
|
21782
22163
|
const globalComponents = useComponentsOfPart("global");
|
|
21783
22164
|
const toolbarComponents = useComponentsOfPart("toolbar");
|
|
21784
|
-
const
|
|
21785
|
-
(0, react.useEffect)(() => {
|
|
21786
|
-
const sub = themeService.darkMode$.subscribe((darkMode) => {
|
|
21787
|
-
setDarkMode(darkMode);
|
|
21788
|
-
});
|
|
21789
|
-
return () => {
|
|
21790
|
-
sub.unsubscribe();
|
|
21791
|
-
};
|
|
21792
|
-
}, []);
|
|
22165
|
+
const darkMode = (0, _wendellhu_redi_react_bindings.useObservable)(themeService.darkMode$, themeService.darkMode);
|
|
21793
22166
|
(0, react.useEffect)(() => {
|
|
21794
22167
|
if (contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
|
|
21795
22168
|
}, [onRendered]);
|
|
21796
|
-
const
|
|
21797
|
-
const
|
|
22169
|
+
const locale = (0, _wendellhu_redi_react_bindings.useObservable)(() => localeService.localeChanged$.pipe((0, rxjs.map)(() => localeService.getLocales())), localeService.getLocales(), false, [localeService]);
|
|
22170
|
+
const direction = (0, _wendellhu_redi_react_bindings.useObservable)(localeService.direction$, localeService.getDirection());
|
|
21798
22171
|
const portalContainer = (0, react.useMemo)(() => document.createElement("div"), []);
|
|
21799
22172
|
(0, react.useLayoutEffect)(() => {
|
|
21800
22173
|
const sub = themeService.currentTheme$.subscribe((theme) => {
|
|
@@ -21806,20 +22179,10 @@ function MobileWorkbench(props) {
|
|
|
21806
22179
|
}, []);
|
|
21807
22180
|
(0, react.useEffect)(() => {
|
|
21808
22181
|
document.body.appendChild(portalContainer);
|
|
21809
|
-
const subscriptions = [localeService.localeChanged$.subscribe(() => {
|
|
21810
|
-
setLocale(localeService.getLocales());
|
|
21811
|
-
}), localeService.direction$.subscribe(() => {
|
|
21812
|
-
setDirection(localeService.getDirection());
|
|
21813
|
-
})];
|
|
21814
22182
|
return () => {
|
|
21815
|
-
subscriptions.forEach((subscription) => subscription.unsubscribe());
|
|
21816
22183
|
document.body.removeChild(portalContainer);
|
|
21817
22184
|
};
|
|
21818
|
-
}, [
|
|
21819
|
-
localeService,
|
|
21820
|
-
mountContainer,
|
|
21821
|
-
portalContainer
|
|
21822
|
-
]);
|
|
22185
|
+
}, [mountContainer, portalContainer]);
|
|
21823
22186
|
(0, react.useEffect)(() => {
|
|
21824
22187
|
portalContainer.dir = direction;
|
|
21825
22188
|
}, [direction, portalContainer]);
|
|
@@ -21884,17 +22247,15 @@ function MobileWorkbench(props) {
|
|
|
21884
22247
|
//#endregion
|
|
21885
22248
|
//#region src/controllers/ui/ui-mobile.controller.ts
|
|
21886
22249
|
let MobileUIController = class MobileUIController extends SingleUnitUIController {
|
|
21887
|
-
constructor(_config, injector, lifecycleService, renderManagerService, layoutService, instanceService, menuManagerService, uiPartsService
|
|
22250
|
+
constructor(_config, injector, lifecycleService, renderManagerService, layoutService, instanceService, menuManagerService, uiPartsService) {
|
|
21888
22251
|
super(injector, instanceService, layoutService, lifecycleService, renderManagerService);
|
|
21889
22252
|
this._config = _config;
|
|
21890
|
-
this._componentManager = _componentManager;
|
|
21891
22253
|
menuManagerService.mergeMenu(menuSchema);
|
|
21892
22254
|
this._initBuiltinComponents(uiPartsService);
|
|
21893
22255
|
this._bootstrapWorkbench();
|
|
21894
22256
|
}
|
|
21895
22257
|
dispose() {
|
|
21896
22258
|
super.dispose();
|
|
21897
|
-
this._componentManager.dispose();
|
|
21898
22259
|
}
|
|
21899
22260
|
bootstrap(callback) {
|
|
21900
22261
|
return bootstrap(this._injector, this._config, callback);
|
|
@@ -21912,8 +22273,7 @@ MobileUIController = __decorate([
|
|
|
21912
22273
|
__decorateParam(4, ILayoutService),
|
|
21913
22274
|
__decorateParam(5, _univerjs_core.IUniverInstanceService),
|
|
21914
22275
|
__decorateParam(6, IMenuManagerService),
|
|
21915
|
-
__decorateParam(7, IUIPartsService)
|
|
21916
|
-
__decorateParam(8, (0, _univerjs_core.Inject)(ComponentManager))
|
|
22276
|
+
__decorateParam(7, IUIPartsService)
|
|
21917
22277
|
], MobileUIController);
|
|
21918
22278
|
function bootstrap(injector, options, callback) {
|
|
21919
22279
|
let mountContainer;
|
|
@@ -21947,9 +22307,10 @@ const INotificationService = (0, _univerjs_core.createIdentifier)("ui.notificati
|
|
|
21947
22307
|
//#region src/services/before-close/before-close.service.ts
|
|
21948
22308
|
const IBeforeCloseService = (0, _univerjs_core.createIdentifier)("univer.ui.before-close-service");
|
|
21949
22309
|
let DesktopBeforeCloseService = class DesktopBeforeCloseService extends _univerjs_core.Disposable {
|
|
21950
|
-
constructor(_notificationService) {
|
|
22310
|
+
constructor(_notificationService, _localeService) {
|
|
21951
22311
|
super();
|
|
21952
22312
|
this._notificationService = _notificationService;
|
|
22313
|
+
this._localeService = _localeService;
|
|
21953
22314
|
_defineProperty(this, "_beforeUnloadCallbacks", []);
|
|
21954
22315
|
_defineProperty(this, "_onCloseCallbacks", []);
|
|
21955
22316
|
_defineProperty(this, "_beforeUnloadHandler", void 0);
|
|
@@ -21960,7 +22321,7 @@ let DesktopBeforeCloseService = class DesktopBeforeCloseService extends _univerj
|
|
|
21960
22321
|
if (message) {
|
|
21961
22322
|
this._notificationService.show({
|
|
21962
22323
|
type: "error",
|
|
21963
|
-
title: "
|
|
22324
|
+
title: this._localeService.t("ui.beforeClose.title"),
|
|
21964
22325
|
content: message
|
|
21965
22326
|
});
|
|
21966
22327
|
if (typeof event === "undefined") event = window.event;
|
|
@@ -21997,7 +22358,7 @@ let DesktopBeforeCloseService = class DesktopBeforeCloseService extends _univerj
|
|
|
21997
22358
|
window.addEventListener("unload", this._unloadHandler);
|
|
21998
22359
|
}
|
|
21999
22360
|
};
|
|
22000
|
-
DesktopBeforeCloseService = __decorate([__decorateParam(0, INotificationService)], DesktopBeforeCloseService);
|
|
22361
|
+
DesktopBeforeCloseService = __decorate([__decorateParam(0, INotificationService), __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService))], DesktopBeforeCloseService);
|
|
22001
22362
|
|
|
22002
22363
|
//#endregion
|
|
22003
22364
|
//#region src/utils/html.ts
|
|
@@ -22430,17 +22791,7 @@ const ContextConfirm = (props) => {
|
|
|
22430
22791
|
});
|
|
22431
22792
|
};
|
|
22432
22793
|
function ConfirmPart() {
|
|
22433
|
-
const
|
|
22434
|
-
const [confirmOptions, setConfirmOptions] = (0, react.useState)([]);
|
|
22435
|
-
(0, react.useEffect)(() => {
|
|
22436
|
-
const subscription = confirmService.confirmOptions$.subscribe((options) => {
|
|
22437
|
-
setConfirmOptions(options);
|
|
22438
|
-
});
|
|
22439
|
-
return () => {
|
|
22440
|
-
subscription.unsubscribe();
|
|
22441
|
-
};
|
|
22442
|
-
}, []);
|
|
22443
|
-
const props = confirmOptions.map((options) => {
|
|
22794
|
+
const props = (0, _wendellhu_redi_react_bindings.useObservable)((0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.IConfirmService).confirmOptions$, []).map((options) => {
|
|
22444
22795
|
const { children, title, ...restProps } = options;
|
|
22445
22796
|
const confirmProps = restProps;
|
|
22446
22797
|
for (const key of ["children", "title"]) {
|
|
@@ -22517,14 +22868,7 @@ const IDialogService = (0, _univerjs_core.createIdentifier)("univer.ui.dialog-se
|
|
|
22517
22868
|
//#endregion
|
|
22518
22869
|
//#region src/views/components/dialog-part/DialogPart.tsx
|
|
22519
22870
|
function DialogPart() {
|
|
22520
|
-
const
|
|
22521
|
-
const [dialogOptions, setDialogOptions] = (0, react.useState)([]);
|
|
22522
|
-
(0, react.useEffect)(() => {
|
|
22523
|
-
const subscription = dialogService.getDialogs$().subscribe((options) => {
|
|
22524
|
-
setDialogOptions(options);
|
|
22525
|
-
});
|
|
22526
|
-
return () => subscription.unsubscribe();
|
|
22527
|
-
}, []);
|
|
22871
|
+
const dialogOptions = (0, _wendellhu_redi_react_bindings.useObservable)((0, _wendellhu_redi_react_bindings.useDependency)(IDialogService).getDialogs$(), []);
|
|
22528
22872
|
const attrs = (0, react.useMemo)(() => dialogOptions.map((options) => {
|
|
22529
22873
|
const { children, title, footer, ...restProps } = options;
|
|
22530
22874
|
const dialogProps = restProps;
|
|
@@ -23119,6 +23463,7 @@ let UniverMobileUIPlugin = class UniverMobileUIPlugin extends _univerjs_core.Plu
|
|
|
23119
23463
|
[IMenuManagerService, { useClass: MenuManagerService }],
|
|
23120
23464
|
[IContextMenuHostService, { useClass: ContextMenuHostService }],
|
|
23121
23465
|
[IContextMenuService, { useClass: ContextMenuService }],
|
|
23466
|
+
[IUIRuntimeScopeService, { useClass: UIRuntimeScopeService }],
|
|
23122
23467
|
[IClipboardInterfaceService, {
|
|
23123
23468
|
useClass: BrowserClipboardService,
|
|
23124
23469
|
lazy: true
|
|
@@ -23156,6 +23501,7 @@ let UniverMobileUIPlugin = class UniverMobileUIPlugin extends _univerjs_core.Plu
|
|
|
23156
23501
|
[ICanvasPopupService, { useClass: CanvasPopupService }],
|
|
23157
23502
|
[IFontService, { useClass: FontService }],
|
|
23158
23503
|
[CanvasFloatDomService],
|
|
23504
|
+
[CanvasFloatDomPreviewService],
|
|
23159
23505
|
[IUIController, {
|
|
23160
23506
|
useFactory: (injector) => injector.createInstance(MobileUIController, this._config),
|
|
23161
23507
|
deps: [_univerjs_core.Injector]
|
|
@@ -23213,11 +23559,13 @@ let UniverUIPlugin = class UniverUIPlugin extends _univerjs_core.Plugin {
|
|
|
23213
23559
|
[IUIPartsService, { useClass: UIPartsService }],
|
|
23214
23560
|
[ILayoutService, { useClass: DesktopLayoutService }],
|
|
23215
23561
|
[IRibbonService, { useClass: DesktopRibbonService }],
|
|
23562
|
+
[IRibbonOverrideService, { useClass: RibbonOverrideService }],
|
|
23216
23563
|
[IShortcutService, { useClass: ShortcutService }],
|
|
23217
23564
|
[IPlatformService, { useClass: PlatformService }],
|
|
23218
23565
|
[IMenuManagerService, { useClass: MenuManagerService }],
|
|
23219
23566
|
[IContextMenuHostService, { useClass: ContextMenuHostService }],
|
|
23220
23567
|
[IContextMenuService, { useClass: ContextMenuService }],
|
|
23568
|
+
[IUIRuntimeScopeService, { useClass: UIRuntimeScopeService }],
|
|
23221
23569
|
[IClipboardInterfaceService, {
|
|
23222
23570
|
useClass: BrowserClipboardService,
|
|
23223
23571
|
lazy: true
|
|
@@ -23255,6 +23603,7 @@ let UniverUIPlugin = class UniverUIPlugin extends _univerjs_core.Plugin {
|
|
|
23255
23603
|
[ICanvasPopupService, { useClass: CanvasPopupService }],
|
|
23256
23604
|
[IFontService, { useClass: FontService }],
|
|
23257
23605
|
[CanvasFloatDomService],
|
|
23606
|
+
[CanvasFloatDomPreviewService],
|
|
23258
23607
|
[IUIController, {
|
|
23259
23608
|
useFactory: (injector) => injector.createInstance(DesktopUIController, this._config),
|
|
23260
23609
|
deps: [_univerjs_core.Injector]
|
|
@@ -23924,15 +24273,31 @@ function extractFontFamily(styleStr) {
|
|
|
23924
24273
|
//#endregion
|
|
23925
24274
|
//#region src/views/components/dom/Print.tsx
|
|
23926
24275
|
const PrintFloatDomSingle = (0, react.memo)((props) => {
|
|
24276
|
+
const { layer } = props;
|
|
24277
|
+
return typeof layer.componentKey === "string" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RegisteredPrintFloatDomSingle, {
|
|
24278
|
+
...props,
|
|
24279
|
+
componentKey: layer.componentKey
|
|
24280
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrintFloatDomSingleContent, {
|
|
24281
|
+
...props,
|
|
24282
|
+
Component: layer.componentKey
|
|
24283
|
+
});
|
|
24284
|
+
});
|
|
24285
|
+
function RegisteredPrintFloatDomSingle(props) {
|
|
24286
|
+
const componentManager = (0, _wendellhu_redi_react_bindings.useDependency)(ComponentManager);
|
|
24287
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrintFloatDomSingleContent, {
|
|
24288
|
+
...props,
|
|
24289
|
+
Component: componentManager.get(props.componentKey)
|
|
24290
|
+
});
|
|
24291
|
+
}
|
|
24292
|
+
function PrintFloatDomSingleContent(props) {
|
|
23927
24293
|
var _position$startY, _position$startX;
|
|
23928
|
-
const { layer, id, position } = props;
|
|
24294
|
+
const { layer, id, position, Component } = props;
|
|
23929
24295
|
const univerInstanceService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
23930
24296
|
const domRef = (0, react.useRef)(null);
|
|
23931
24297
|
const innerDomRef = (0, react.useRef)(null);
|
|
23932
24298
|
const transformRef = (0, react.useRef)(`transform: rotate(${position === null || position === void 0 ? void 0 : position.rotate}deg) translate(${position === null || position === void 0 ? void 0 : position.startX}px, ${position === null || position === void 0 ? void 0 : position.startY}px)`);
|
|
23933
24299
|
const topRef = (0, react.useRef)((_position$startY = position === null || position === void 0 ? void 0 : position.startY) !== null && _position$startY !== void 0 ? _position$startY : 0);
|
|
23934
24300
|
const leftRef = (0, react.useRef)((_position$startX = position === null || position === void 0 ? void 0 : position.startX) !== null && _position$startX !== void 0 ? _position$startX : 0);
|
|
23935
|
-
const Component = typeof layer.componentKey === "string" ? (0, _wendellhu_redi_react_bindings.useDependency)(ComponentManager).get(layer.componentKey) : layer.componentKey;
|
|
23936
24301
|
const layerProps = (0, react.useMemo)(() => ({
|
|
23937
24302
|
data: layer.data,
|
|
23938
24303
|
...layer.props
|
|
@@ -23968,16 +24333,16 @@ const PrintFloatDomSingle = (0, react.memo)((props) => {
|
|
|
23968
24333
|
transform: transformRef.current
|
|
23969
24334
|
},
|
|
23970
24335
|
onPointerMove: (e) => {
|
|
23971
|
-
layer.onPointerMove(e.nativeEvent);
|
|
24336
|
+
if (shouldForwardFloatDomEvents(layer)) layer.onPointerMove(e.nativeEvent);
|
|
23972
24337
|
},
|
|
23973
24338
|
onPointerDown: (e) => {
|
|
23974
|
-
layer.onPointerDown(e.nativeEvent);
|
|
24339
|
+
if (shouldForwardFloatDomEvents(layer)) layer.onPointerDown(e.nativeEvent);
|
|
23975
24340
|
},
|
|
23976
24341
|
onPointerUp: (e) => {
|
|
23977
|
-
layer.onPointerUp(e.nativeEvent);
|
|
24342
|
+
if (shouldForwardFloatDomEvents(layer)) layer.onPointerUp(e.nativeEvent);
|
|
23978
24343
|
},
|
|
23979
24344
|
onWheel: (e) => {
|
|
23980
|
-
layer.onWheel(e.nativeEvent);
|
|
24345
|
+
if (shouldForwardFloatDomEvents(layer)) layer.onWheel(e.nativeEvent);
|
|
23981
24346
|
},
|
|
23982
24347
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
23983
24348
|
ref: innerDomRef,
|
|
@@ -23987,7 +24352,7 @@ const PrintFloatDomSingle = (0, react.memo)((props) => {
|
|
|
23987
24352
|
children: component
|
|
23988
24353
|
})
|
|
23989
24354
|
});
|
|
23990
|
-
}
|
|
24355
|
+
}
|
|
23991
24356
|
|
|
23992
24357
|
//#endregion
|
|
23993
24358
|
//#region src/views/progress-bar/ProgressBar.tsx
|
|
@@ -24082,6 +24447,7 @@ Object.defineProperty(exports, 'BrowserClipboardService', {
|
|
|
24082
24447
|
exports.BuiltInUIPart = BuiltInUIPart;
|
|
24083
24448
|
exports.COLOR_PICKER_COMPONENT = COLOR_PICKER_COMPONENT;
|
|
24084
24449
|
exports.COMMON_LABEL_COMPONENT = COMMON_LABEL_COMPONENT;
|
|
24450
|
+
exports.CanvasFloatDomPreviewService = CanvasFloatDomPreviewService;
|
|
24085
24451
|
exports.CanvasFloatDomService = CanvasFloatDomService;
|
|
24086
24452
|
exports.CanvasPopup = CanvasPopup;
|
|
24087
24453
|
exports.CanvasPopupService = CanvasPopupService;
|
|
@@ -24162,6 +24528,7 @@ Object.defineProperty(exports, 'DesktopUIController', {
|
|
|
24162
24528
|
return DesktopUIController;
|
|
24163
24529
|
}
|
|
24164
24530
|
});
|
|
24531
|
+
exports.EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE = EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE;
|
|
24165
24532
|
exports.EMOJI_CATEGORIES = EMOJI_CATEGORIES;
|
|
24166
24533
|
exports.EMOJI_PICKER_COMPONENT = EMOJI_PICKER_COMPONENT;
|
|
24167
24534
|
exports.EMOJI_RECENT_LIMIT = EMOJI_RECENT_LIMIT;
|
|
@@ -24212,11 +24579,13 @@ exports.IMenuManagerService = IMenuManagerService;
|
|
|
24212
24579
|
exports.IMessageService = IMessageService;
|
|
24213
24580
|
exports.INotificationService = INotificationService;
|
|
24214
24581
|
exports.IPlatformService = IPlatformService;
|
|
24582
|
+
exports.IRibbonOverrideService = IRibbonOverrideService;
|
|
24215
24583
|
exports.IRibbonService = IRibbonService;
|
|
24216
24584
|
exports.IShortcutService = IShortcutService;
|
|
24217
24585
|
exports.ISidebarService = ISidebarService;
|
|
24218
24586
|
exports.IUIController = IUIController;
|
|
24219
24587
|
exports.IUIPartsService = IUIPartsService;
|
|
24588
|
+
exports.IUIRuntimeScopeService = IUIRuntimeScopeService;
|
|
24220
24589
|
Object.defineProperty(exports, 'IconManager', {
|
|
24221
24590
|
enumerable: true,
|
|
24222
24591
|
get: function () {
|
|
@@ -24265,6 +24634,7 @@ exports.RibbonDataGroup = RibbonDataGroup;
|
|
|
24265
24634
|
exports.RibbonFormulasGroup = RibbonFormulasGroup;
|
|
24266
24635
|
exports.RibbonInsertGroup = RibbonInsertGroup;
|
|
24267
24636
|
exports.RibbonOthersGroup = RibbonOthersGroup;
|
|
24637
|
+
exports.RibbonOverrideService = RibbonOverrideService;
|
|
24268
24638
|
exports.RibbonPosition = RibbonPosition;
|
|
24269
24639
|
exports.RibbonStartGroup = RibbonStartGroup;
|
|
24270
24640
|
exports.RibbonViewGroup = RibbonViewGroup;
|
|
@@ -24293,11 +24663,13 @@ exports.SingleCanvasPopup = SingleCanvasPopup;
|
|
|
24293
24663
|
exports.SingleUnitUIController = SingleUnitUIController;
|
|
24294
24664
|
exports.Slider = Slider;
|
|
24295
24665
|
exports.ThemeSwitcherService = ThemeSwitcherService;
|
|
24666
|
+
exports.ToggleFullscreenOperation = ToggleFullscreenOperation;
|
|
24296
24667
|
exports.ToggleShortcutPanelOperation = ToggleShortcutPanelOperation;
|
|
24297
24668
|
exports.ToolbarButton = ToolbarButton;
|
|
24298
24669
|
exports.ToolbarItem = ToolbarItem;
|
|
24299
24670
|
exports.UIMenuSchema = menuSchema;
|
|
24300
24671
|
exports.UIPartsService = UIPartsService;
|
|
24672
|
+
exports.UIRuntimeScopeService = UIRuntimeScopeService;
|
|
24301
24673
|
exports.UI_PLUGIN_CONFIG_KEY = UI_PLUGIN_CONFIG_KEY;
|
|
24302
24674
|
exports.UNI_DISABLE_CHANGING_FOCUS_KEY = UNI_DISABLE_CHANGING_FOCUS_KEY;
|
|
24303
24675
|
exports.UndoShortcutItem = UndoShortcutItem;
|
|
@@ -24320,6 +24692,7 @@ Object.defineProperty(exports, 'WithDependency', {
|
|
|
24320
24692
|
}
|
|
24321
24693
|
});
|
|
24322
24694
|
exports.ZIndexManager = ZIndexManager;
|
|
24695
|
+
exports.ZoomInput = ZoomInput;
|
|
24323
24696
|
Object.defineProperty(exports, 'connectDependencies', {
|
|
24324
24697
|
enumerable: true,
|
|
24325
24698
|
get: function () {
|
|
@@ -24334,6 +24707,7 @@ Object.defineProperty(exports, 'connectInjector', {
|
|
|
24334
24707
|
});
|
|
24335
24708
|
exports.getAllEmojis = getAllEmojis;
|
|
24336
24709
|
exports.getDefaultRecentEmojis = getDefaultRecentEmojis;
|
|
24710
|
+
exports.getEmbedBoundaryOwner = getEmbedBoundaryOwner;
|
|
24337
24711
|
exports.getEmojiLocaleData = getEmojiLocaleData;
|
|
24338
24712
|
exports.getHeaderFooterMenuHiddenObservable = getHeaderFooterMenuHiddenObservable;
|
|
24339
24713
|
exports.getLocalizedEmojiTitle = getLocalizedEmojiTitle;
|
|
@@ -24348,6 +24722,8 @@ exports.handleTableColgroup = handleTableColgroup;
|
|
|
24348
24722
|
exports.handleTableMergeData = handleTableMergeData;
|
|
24349
24723
|
exports.handleTableRowGroup = handleTableRowGroup;
|
|
24350
24724
|
exports.imageMimeTypeSet = imageMimeTypeSet;
|
|
24725
|
+
exports.isEmbedBoundaryTarget = isEmbedBoundaryTarget;
|
|
24726
|
+
exports.keepInteractionInsideSameEmbedBoundary = keepInteractionInsideSameEmbedBoundary;
|
|
24351
24727
|
exports.mergeMenuConfigs = mergeMenuConfigs;
|
|
24352
24728
|
exports.parseHtmlDocument = parseHtmlDocument;
|
|
24353
24729
|
exports.parseHtmlFragment = parseHtmlFragment;
|