@univerjs/ui 1.3.1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -19
- package/lib/cjs/facade.js +15 -26
- package/lib/cjs/index.js +973 -707
- package/lib/cjs/locale/ar-SA.js +2 -4
- package/lib/cjs/locale/ca-ES.js +2 -4
- package/lib/cjs/locale/de-DE.js +2 -4
- package/lib/cjs/locale/en-US.js +2 -4
- package/lib/cjs/locale/es-ES.js +2 -4
- package/lib/cjs/locale/fa-IR.js +2 -4
- package/lib/cjs/locale/fr-FR.js +2 -4
- package/lib/cjs/locale/id-ID.js +2 -4
- package/lib/cjs/locale/it-IT.js +2 -4
- package/lib/cjs/locale/ja-JP.js +2 -4
- package/lib/cjs/locale/ko-KR.js +2 -4
- package/lib/cjs/locale/pl-PL.js +2 -4
- package/lib/cjs/locale/pt-BR.js +2 -4
- package/lib/cjs/locale/ru-RU.js +2 -4
- package/lib/cjs/locale/sk-SK.js +2 -4
- package/lib/cjs/locale/vi-VN.js +2 -4
- package/lib/cjs/locale/zh-CN.js +2 -4
- package/lib/cjs/locale/zh-HK.js +2 -4
- package/lib/cjs/locale/zh-TW.js +2 -4
- package/lib/es/facade.js +15 -25
- package/lib/es/index.js +881 -615
- package/lib/es/locale/ar-SA.js +2 -4
- package/lib/es/locale/ca-ES.js +2 -4
- package/lib/es/locale/de-DE.js +2 -4
- package/lib/es/locale/en-US.js +2 -4
- package/lib/es/locale/es-ES.js +2 -4
- package/lib/es/locale/fa-IR.js +2 -4
- package/lib/es/locale/fr-FR.js +2 -4
- package/lib/es/locale/id-ID.js +2 -4
- package/lib/es/locale/it-IT.js +2 -4
- package/lib/es/locale/ja-JP.js +2 -4
- package/lib/es/locale/ko-KR.js +2 -4
- package/lib/es/locale/pl-PL.js +2 -4
- package/lib/es/locale/pt-BR.js +2 -4
- package/lib/es/locale/ru-RU.js +2 -4
- package/lib/es/locale/sk-SK.js +2 -4
- package/lib/es/locale/vi-VN.js +2 -4
- package/lib/es/locale/zh-CN.js +2 -4
- package/lib/es/locale/zh-HK.js +2 -4
- package/lib/es/locale/zh-TW.js +2 -4
- package/lib/facade.js +15 -25
- package/lib/index.css +57 -42
- package/lib/index.js +881 -615
- package/lib/locale/ar-SA.js +2 -4
- package/lib/locale/ca-ES.js +2 -4
- package/lib/locale/de-DE.js +2 -4
- package/lib/locale/en-US.js +2 -4
- package/lib/locale/es-ES.js +2 -4
- package/lib/locale/fa-IR.js +2 -4
- package/lib/locale/fr-FR.js +2 -4
- package/lib/locale/id-ID.js +2 -4
- package/lib/locale/it-IT.js +2 -4
- package/lib/locale/ja-JP.js +2 -4
- package/lib/locale/ko-KR.js +2 -4
- package/lib/locale/pl-PL.js +2 -4
- package/lib/locale/pt-BR.js +2 -4
- package/lib/locale/ru-RU.js +2 -4
- package/lib/locale/sk-SK.js +2 -4
- package/lib/locale/vi-VN.js +2 -4
- package/lib/locale/zh-CN.js +2 -4
- package/lib/locale/zh-HK.js +2 -4
- package/lib/locale/zh-TW.js +2 -4
- package/lib/types/menu/shortcut-panel.menu.d.ts +2 -1
- package/lib/types/mobile-plugin.d.ts +1 -1
- package/lib/types/plugin.d.ts +1 -1
- package/lib/types/services/contextmenu/contextmenu-host.service.d.ts +15 -2
- package/lib/types/services/dialog/desktop-dialog.service.d.ts +5 -3
- package/lib/types/services/dialog/mobile-dialog.service.d.ts +2 -1
- package/lib/types/services/dom/canvas-dom-layer.service.d.ts +4 -0
- package/lib/types/services/menu/menu-manager.service.d.ts +2 -0
- package/lib/types/services/menu/menu.d.ts +1 -0
- package/lib/types/services/sidebar/desktop-sidebar.service.d.ts +5 -2
- package/lib/types/utils/di.d.ts +6 -10
- package/lib/types/utils/use-menu-host.d.ts +17 -0
- package/lib/types/views/components/mobile-drawer/MobileDrawer.d.ts +1 -0
- package/lib/types/views/components/popup/RectPopup.d.ts +8 -6
- package/lib/types/views/components/ribbon/ToolbarButton.d.ts +3 -5
- package/lib/types/views/components/ribbon/TooltipButtonWrapper.d.ts +2 -1
- package/lib/types/views/components/ribbon/ribbon-grid-layout.d.ts +2 -0
- package/lib/types/views/components/ribbon/ribbon-menu/use-ribbon-tabs.d.ts +18 -0
- package/lib/types/views/custom-label/CustomLabel.d.ts +1 -0
- package/lib/types/views/emoji-picker/emoji-picker-utils.d.ts +2 -2
- package/lib/types/views/font-family/FontFamily.d.ts +1 -1
- package/lib/types/views/object-permission/ObjectPermissionPanel.d.ts +1 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +23 -22
- package/package.json +13 -13
package/lib/es/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { BaselineOffset, BorderStyleTypes, ColorKit, CommandType, DependentOn, Disposable, DocumentDataModel, DocumentFlavor, EDITOR_ACTIVATED, ErrorService, FOCUSING_FX_BAR_EDITOR, FOCUSING_SHEET, FOCUSING_UNIVER_EDITOR, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, ILocalStorageService, ILogService, IPermissionService, IUndoRedoService, IUniverInstanceService, Inject, Injector, LifecycleService, LifecycleStages, LifecycleUnreachableError, LocaleService, NAMED_STYLE_MAP, NamedStyleType, ObjectPermissionService, Optional, Plugin, Quantity, RedoCommand, SHEET_EDITOR_UNITS, ThemeService, Tools, UndoCommand, UniverInstanceType, UserManagerService, Workbook, createIdentifier, dedupeBy, generateRandomId, getBorderStyleType, isInternalEditorID, isRealNum, merge, mergeOverrideWithDependencies, registerDependencies, remove, throttle, toDisposable, touchDependencies } from "@univerjs/core";
|
|
2
|
-
import { BehaviorSubject, EMPTY, Observable, ReplaySubject, Subject, Subscription, animationFrameScheduler, combineLatest, debounceTime, distinctUntilChanged, filter, first, fromEvent, isObservable, map, merge as merge$1, of, scan, startWith, switchMap, throttleTime } from "rxjs";
|
|
3
|
-
import { Fragment, cloneElement, createContext, createElement, forwardRef, memo, useCallback, useContext, useDeferredValue, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { BehaviorSubject, EMPTY, Observable, ReplaySubject, Subject, Subscription, animationFrameScheduler, combineLatest, debounceTime, defer, distinctUntilChanged, filter, first, fromEvent, isObservable, map, merge as merge$1, of, scan, startWith, switchMap, throttleTime } from "rxjs";
|
|
3
|
+
import { Fragment, cloneElement, createContext, createElement, forwardRef, memo, useCallback, useContext, useDeferredValue, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
|
|
4
4
|
import { Avatar, Button, Checkbox, ColorPicker, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, ConfigContext, ConfigProvider, Confirm, Dialog, Dropdown, DropdownMenu, FormLayout, Gallery, HoverCard, Input, InputNumber, KBD, MessageType, Messager, MobileActionRowGroup, MobileColorPicker, MobileConfirm, MobileDropdown, MobileDropdownMenu, MobileOverlayContext, MobileSelect, Popup, Radio, RadioGroup, StateIconButton, Toaster, Tooltip, borderBottomClassName, borderClassName, borderLeftBottomClassName, borderRightClassName, borderTopClassName, clsx, cva, divideXClassName, divideYClassName, isBrowser, message, removeMessage, render, resetButtonClassName, revealFocusedElementInMobileViewport, scrollbarClassName, toast, unmount, useMobileKeyboardViewportLayout } from "@univerjs/design";
|
|
5
5
|
import { IRenderManagerService, UniverRenderEnginePlugin, ptToPx } from "@univerjs/engine-render";
|
|
6
6
|
import { distinctUntilChanged as distinctUntilChanged$1, map as map$1, scan as scan$1, startWith as startWith$1, switchMap as switchMap$1 } from "rxjs/operators";
|
|
7
|
-
import { RediConsumer, RediContext, RediProvider, WithDependency, connectDependencies, connectInjector, connectInjector as connectInjector$1, useDependency, useDependency as useDependency$1, useInjector,
|
|
7
|
+
import { RediConsumer, RediContext, RediProvider, WithDependency, connectDependencies, connectInjector, connectInjector as connectInjector$1, useDependency, useDependency as useDependency$1, useInjector, useUpdateBinder } from "@wendellhu/redi/react-bindings";
|
|
8
8
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { createPortal } from "react-dom";
|
|
10
10
|
import { ActivityIcon, BrushIcon, CheckMarkIcon, ClearFormatDoubleIcon, CloseIcon, DatabaseIcon, ExpandIcon, EyeIcon, FeatureSearchIcon, FoodsIcon, FunctionIcon, HomeIcon, IncreaseIcon, InfoIcon, InsertIcon, KeyboardIcon, MoreDownIcon, MoreHorizontalIcon, MoreLeftIcon, MoreRightIcon, MoreVerticalIcon, NatureIcon, ObjectsIcon, PeopleIcon, PlacesIcon, ProtectIcon, RandomIcon, RecentIcon, RedoIcon, ReduceIcon, SearchIcon, ShortcutIcon, ShrinkIcon, SymbolsIcon, UndoIcon } from "@univerjs/icons";
|
|
11
11
|
import { UnitAction, UnitObject, UnitRole } from "@univerjs/protocol";
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
// src/utils/embed-boundary.ts
|
|
14
14
|
/**
|
|
15
15
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
16
16
|
*
|
|
@@ -54,8 +54,7 @@ function getAttributeValue(target, name) {
|
|
|
54
54
|
return typeof getAttribute === "function" ? getAttribute.call(target, name) ?? void 0 : void 0;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
|
|
57
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/typeof.js
|
|
59
58
|
function _typeof(o) {
|
|
60
59
|
"@babel/helpers - typeof";
|
|
61
60
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -65,28 +64,25 @@ function _typeof(o) {
|
|
|
65
64
|
}, _typeof(o);
|
|
66
65
|
}
|
|
67
66
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
function toPrimitive(t, r) {
|
|
67
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/toPrimitive.js
|
|
68
|
+
function toPrimitive(t, e) {
|
|
71
69
|
if ("object" != _typeof(t) || !t) return t;
|
|
72
|
-
var
|
|
73
|
-
if (void 0 !==
|
|
74
|
-
var i =
|
|
70
|
+
var r;
|
|
71
|
+
if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
|
|
72
|
+
var i = r.call(t, e || "default");
|
|
75
73
|
if ("object" != _typeof(i)) return i;
|
|
76
74
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
77
75
|
}
|
|
78
|
-
return ("string" ===
|
|
76
|
+
return ("string" === e ? String : Number)(t);
|
|
79
77
|
}
|
|
80
78
|
|
|
81
|
-
|
|
82
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
|
|
79
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/toPropertyKey.js
|
|
83
80
|
function toPropertyKey(t) {
|
|
84
81
|
var i = toPrimitive(t, "string");
|
|
85
82
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
86
83
|
}
|
|
87
84
|
|
|
88
|
-
|
|
89
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
85
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/defineProperty.js
|
|
90
86
|
function _defineProperty(e, r, t) {
|
|
91
87
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
92
88
|
value: t,
|
|
@@ -96,16 +92,14 @@ function _defineProperty(e, r, t) {
|
|
|
96
92
|
}) : e[r] = t, e;
|
|
97
93
|
}
|
|
98
94
|
|
|
99
|
-
|
|
100
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
|
|
95
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/decorateParam.js
|
|
101
96
|
function __decorateParam(paramIndex, decorator) {
|
|
102
97
|
return function(target, key) {
|
|
103
98
|
decorator(target, key, paramIndex);
|
|
104
99
|
};
|
|
105
100
|
}
|
|
106
101
|
|
|
107
|
-
|
|
108
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
102
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/decorate.js
|
|
109
103
|
function __decorate(decorators, target, key, desc) {
|
|
110
104
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
111
105
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -113,12 +107,10 @@ function __decorate(decorators, target, key, desc) {
|
|
|
113
107
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
114
108
|
}
|
|
115
109
|
|
|
116
|
-
|
|
117
|
-
//#region src/services/layout/layout.service.ts
|
|
110
|
+
// src/services/layout/layout.service.ts
|
|
118
111
|
const FOCUSING_UNIVER = "FOCUSING_UNIVER";
|
|
119
112
|
const givingBackFocusElements = [
|
|
120
113
|
"app-layout",
|
|
121
|
-
"button",
|
|
122
114
|
"sheet-bar-append-button",
|
|
123
115
|
"render-canvas",
|
|
124
116
|
"workbench-layout"
|
|
@@ -223,8 +215,7 @@ function getFocusUnitIdFromElement(target) {
|
|
|
223
215
|
return target.dataset.uUnitId;
|
|
224
216
|
}
|
|
225
217
|
|
|
226
|
-
|
|
227
|
-
//#region src/commands/operations/toggle-fullscreen.operation.ts
|
|
218
|
+
// src/commands/operations/toggle-fullscreen.operation.ts
|
|
228
219
|
const ToggleFullscreenOperation = {
|
|
229
220
|
id: "base-ui.operation.toggle-fullscreen",
|
|
230
221
|
type: CommandType.OPERATION,
|
|
@@ -247,8 +238,7 @@ const ToggleFullscreenOperation = {
|
|
|
247
238
|
}
|
|
248
239
|
};
|
|
249
240
|
|
|
250
|
-
|
|
251
|
-
//#region src/services/shortcut/shortcut-panel.service.ts
|
|
241
|
+
// src/services/shortcut/shortcut-panel.service.ts
|
|
252
242
|
/**
|
|
253
243
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
254
244
|
*
|
|
@@ -286,13 +276,11 @@ var ShortcutPanelService = class extends Disposable {
|
|
|
286
276
|
}
|
|
287
277
|
};
|
|
288
278
|
|
|
289
|
-
|
|
290
|
-
//#region src/services/sidebar/sidebar.service.ts
|
|
279
|
+
// src/services/sidebar/sidebar.service.ts
|
|
291
280
|
const ILeftSidebarService = createIdentifier("ui.left-sidebar.service");
|
|
292
281
|
const ISidebarService = createIdentifier("ui.sidebar.service");
|
|
293
282
|
|
|
294
|
-
|
|
295
|
-
//#region src/commands/operations/toggle-shortcut-panel.operation.ts
|
|
283
|
+
// src/commands/operations/toggle-shortcut-panel.operation.ts
|
|
296
284
|
const ShortcutPanelComponentName = "ShortcutPanel";
|
|
297
285
|
const ToggleShortcutPanelOperation = {
|
|
298
286
|
id: "base-ui.operation.toggle-shortcut-panel",
|
|
@@ -315,8 +303,7 @@ const ToggleShortcutPanelOperation = {
|
|
|
315
303
|
}
|
|
316
304
|
};
|
|
317
305
|
|
|
318
|
-
|
|
319
|
-
//#region src/common/component-manager.ts
|
|
306
|
+
// src/common/component-manager.ts
|
|
320
307
|
let ComponentManager = class ComponentManager extends Disposable {
|
|
321
308
|
constructor(_logService) {
|
|
322
309
|
super();
|
|
@@ -382,8 +369,7 @@ let ComponentManager = class ComponentManager extends Disposable {
|
|
|
382
369
|
};
|
|
383
370
|
ComponentManager = __decorate([__decorateParam(0, Optional(ILogService))], ComponentManager);
|
|
384
371
|
|
|
385
|
-
|
|
386
|
-
//#region src/common/icon-manager.ts
|
|
372
|
+
// src/common/icon-manager.ts
|
|
387
373
|
const EmptyIcon = () => null;
|
|
388
374
|
let IconManager = class IconManager extends Disposable {
|
|
389
375
|
constructor(_logService) {
|
|
@@ -439,8 +425,7 @@ let IconManager = class IconManager extends Disposable {
|
|
|
439
425
|
};
|
|
440
426
|
IconManager = __decorate([__decorateParam(0, ILogService)], IconManager);
|
|
441
427
|
|
|
442
|
-
|
|
443
|
-
//#region src/common/z-index-manager.ts
|
|
428
|
+
// src/common/z-index-manager.ts
|
|
444
429
|
/**
|
|
445
430
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
446
431
|
*
|
|
@@ -478,8 +463,7 @@ var ZIndexManager = class {
|
|
|
478
463
|
}
|
|
479
464
|
};
|
|
480
465
|
|
|
481
|
-
|
|
482
|
-
//#region src/common/menu-hidden-observable.ts
|
|
466
|
+
// src/common/menu-hidden-observable.ts
|
|
483
467
|
function getMenuHiddenObservable(accessor, targetUniverType, matchUnitId, needHideUnitId) {
|
|
484
468
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
485
469
|
const getUnitType = (unitId) => SHEET_EDITOR_UNITS.includes(unitId) ? UniverInstanceType.UNIVER_SHEET : univerInstanceService.getUnitType(unitId);
|
|
@@ -521,8 +505,7 @@ function getHeaderFooterMenuHiddenObservable(accessor) {
|
|
|
521
505
|
});
|
|
522
506
|
}
|
|
523
507
|
|
|
524
|
-
|
|
525
|
-
//#region src/common/menu-merge-configs.ts
|
|
508
|
+
// src/common/menu-merge-configs.ts
|
|
526
509
|
function mergeMenuConfigs(baseConfig, additionalConfig) {
|
|
527
510
|
if (!additionalConfig || !baseConfig) return baseConfig;
|
|
528
511
|
[
|
|
@@ -551,8 +534,7 @@ function updateReactiveProperty(baseConfig, key, value) {
|
|
|
551
534
|
}
|
|
552
535
|
}
|
|
553
536
|
|
|
554
|
-
|
|
555
|
-
//#region src/services/menu/menu.ts
|
|
537
|
+
// src/services/menu/menu.ts
|
|
556
538
|
let MenuItemType = /* @__PURE__ */ function(MenuItemType) {
|
|
557
539
|
/** Button style menu item. */
|
|
558
540
|
MenuItemType[MenuItemType["BUTTON"] = 0] = "BUTTON";
|
|
@@ -568,8 +550,7 @@ function isMenuButtonSelectorItem(v) {
|
|
|
568
550
|
return v.type === 2;
|
|
569
551
|
}
|
|
570
552
|
|
|
571
|
-
|
|
572
|
-
//#region src/services/workbench/workbench.service.ts
|
|
553
|
+
// src/services/workbench/workbench.service.ts
|
|
573
554
|
const IWorkbenchService = createIdentifier("univer.ui.workbench.service");
|
|
574
555
|
let WorkbenchService = class WorkbenchService extends Disposable {
|
|
575
556
|
constructor(univerInstanceService) {
|
|
@@ -624,8 +605,7 @@ function isWorkbenchRootUnit(unitId, options) {
|
|
|
624
605
|
return !isInternalEditorID(unitId) && !(options === null || options === void 0 ? void 0 : options.skipAutoRender) && !(options === null || options === void 0 ? void 0 : options.embeddedRender);
|
|
625
606
|
}
|
|
626
607
|
|
|
627
|
-
|
|
628
|
-
//#region src/common/object-permission-menu.ts
|
|
608
|
+
// src/common/object-permission-menu.ts
|
|
629
609
|
function objectPermissionMenuItemFactory(accessor, id, unitType, objectType) {
|
|
630
610
|
const instances = accessor.get(IUniverInstanceService);
|
|
631
611
|
const state$ = combineLatest([accessor.get(IWorkbenchService).rootUnitType$, instances.getCurrentTypeOfUnit$(unitType)]).pipe(switchMap(([rootType, model]) => {
|
|
@@ -659,14 +639,12 @@ function objectPermissionMenuItemFactory(accessor, id, unitType, objectType) {
|
|
|
659
639
|
};
|
|
660
640
|
}
|
|
661
641
|
|
|
662
|
-
|
|
663
|
-
//#region src/config/config.ts
|
|
642
|
+
// src/config/config.ts
|
|
664
643
|
const UI_PLUGIN_CONFIG_KEY = "ui.config";
|
|
665
644
|
const configSymbol = Symbol(UI_PLUGIN_CONFIG_KEY);
|
|
666
645
|
const defaultPluginConfig = {};
|
|
667
646
|
|
|
668
|
-
|
|
669
|
-
//#region src/const.ts
|
|
647
|
+
// src/const.ts
|
|
670
648
|
/**
|
|
671
649
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
672
650
|
*
|
|
@@ -688,12 +666,10 @@ const defaultPluginConfig = {};
|
|
|
688
666
|
const UNI_DISABLE_CHANGING_FOCUS_KEY = "UNI_DISABLE_CHANGING_FOCUS";
|
|
689
667
|
const MOBILE_UI_MODE = "MOBILE_UI_MODE";
|
|
690
668
|
|
|
691
|
-
|
|
692
|
-
//#region src/services/message/message.service.ts
|
|
669
|
+
// src/services/message/message.service.ts
|
|
693
670
|
const IMessageService = createIdentifier("ui.message.service");
|
|
694
671
|
|
|
695
|
-
|
|
696
|
-
//#region src/controllers/error/error.controller.ts
|
|
672
|
+
// src/controllers/error/error.controller.ts
|
|
697
673
|
const PERMISSION_MESSAGE_ID = "ui.permission-denied";
|
|
698
674
|
const PERMISSION_MESSAGE_DURATION = 3e3;
|
|
699
675
|
let ErrorController = class ErrorController extends Disposable {
|
|
@@ -738,8 +714,7 @@ ErrorController = __decorate([
|
|
|
738
714
|
__decorateParam(3, Inject(LocaleService))
|
|
739
715
|
], ErrorController);
|
|
740
716
|
|
|
741
|
-
|
|
742
|
-
//#region src/services/clipboard/clipboard.command.ts
|
|
717
|
+
// src/services/clipboard/clipboard.command.ts
|
|
743
718
|
const CopyCommandName = "univer.command.copy";
|
|
744
719
|
const CopyCommand = {
|
|
745
720
|
id: CopyCommandName,
|
|
@@ -772,8 +747,7 @@ const PasteCommand = {
|
|
|
772
747
|
};
|
|
773
748
|
const SheetPasteShortKeyCommandName = "sheet.command.paste-by-short-key";
|
|
774
749
|
|
|
775
|
-
|
|
776
|
-
//#region src/services/shortcut/keycode.ts
|
|
750
|
+
// src/services/shortcut/keycode.ts
|
|
777
751
|
/**
|
|
778
752
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
779
753
|
*
|
|
@@ -943,15 +917,13 @@ let MetaKeys = /* @__PURE__ */ function(MetaKeys) {
|
|
|
943
917
|
return MetaKeys;
|
|
944
918
|
}({});
|
|
945
919
|
|
|
946
|
-
|
|
947
|
-
//#region src/common/lifecycle.ts
|
|
920
|
+
// src/common/lifecycle.ts
|
|
948
921
|
function fromGlobalEvent(type, listener, options) {
|
|
949
922
|
window.addEventListener(type, listener, options);
|
|
950
923
|
return toDisposable(() => window.removeEventListener(type, listener, options));
|
|
951
924
|
}
|
|
952
925
|
|
|
953
|
-
|
|
954
|
-
//#region src/services/platform/platform.service.ts
|
|
926
|
+
// src/services/platform/platform.service.ts
|
|
955
927
|
/**
|
|
956
928
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
957
929
|
*
|
|
@@ -980,8 +952,7 @@ var PlatformService = class {
|
|
|
980
952
|
}
|
|
981
953
|
};
|
|
982
954
|
|
|
983
|
-
|
|
984
|
-
//#region src/services/runtime-scope/ui-runtime-scope.service.ts
|
|
955
|
+
// src/services/runtime-scope/ui-runtime-scope.service.ts
|
|
985
956
|
const IUIRuntimeScopeService = createIdentifier("ui.runtime-scope.service");
|
|
986
957
|
var UIRuntimeScopeService = class extends Disposable {
|
|
987
958
|
constructor(..._args) {
|
|
@@ -999,8 +970,7 @@ var UIRuntimeScopeService = class extends Disposable {
|
|
|
999
970
|
}
|
|
1000
971
|
};
|
|
1001
972
|
|
|
1002
|
-
|
|
1003
|
-
//#region src/services/shortcut/shortcut.service.ts
|
|
973
|
+
// src/services/shortcut/shortcut.service.ts
|
|
1004
974
|
const MENU_NAVIGATION_KEYS = /* @__PURE__ */ new Set([
|
|
1005
975
|
13,
|
|
1006
976
|
32,
|
|
@@ -1110,6 +1080,7 @@ let ShortcutService = class ShortcutService extends Disposable {
|
|
|
1110
1080
|
}
|
|
1111
1081
|
dispatch(e) {
|
|
1112
1082
|
if (e.isComposing) return;
|
|
1083
|
+
if (!e.ctrlKey && !e.metaKey && !e.altKey && e.target instanceof HTMLButtonElement && (e.key === "Enter" || e.key === " " || e.key === "Tab")) return;
|
|
1113
1084
|
if (e.target instanceof HTMLInputElement && e.target.closest("[data-u-command]")) return;
|
|
1114
1085
|
if (!e.ctrlKey && !e.metaKey && !e.altKey && MENU_NAVIGATION_KEYS.has(e.keyCode) && e.target instanceof HTMLElement && (e.target.matches("button[data-u-command], [data-u-command][role=\"button\"], [data-embed-floating-menu=\"true\"] button, [data-u-command] input") || e.target.closest("[role=\"menu\"]"))) return;
|
|
1115
1086
|
if (this._forceEscapeCount > 0 || this._forceDisabled) return;
|
|
@@ -1161,8 +1132,7 @@ ShortcutService = __decorate([
|
|
|
1161
1132
|
__decorateParam(4, Optional(ILayoutService))
|
|
1162
1133
|
], ShortcutService);
|
|
1163
1134
|
|
|
1164
|
-
|
|
1165
|
-
//#region src/controllers/shared-shortcut.controller.ts
|
|
1135
|
+
// src/controllers/shared-shortcut.controller.ts
|
|
1166
1136
|
function whenEditorFocused(contextService) {
|
|
1167
1137
|
return contextService.getContextValue(FOCUSING_UNIVER_EDITOR);
|
|
1168
1138
|
}
|
|
@@ -1256,8 +1226,7 @@ let SharedController = class SharedController extends Disposable {
|
|
|
1256
1226
|
};
|
|
1257
1227
|
SharedController = __decorate([__decorateParam(0, IShortcutService), __decorateParam(1, ICommandService)], SharedController);
|
|
1258
1228
|
|
|
1259
|
-
|
|
1260
|
-
//#region src/services/menu/types.ts
|
|
1229
|
+
// src/services/menu/types.ts
|
|
1261
1230
|
/**
|
|
1262
1231
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
1263
1232
|
*
|
|
@@ -1359,8 +1328,7 @@ let ContextMenuGroup = /* @__PURE__ */ function(ContextMenuGroup) {
|
|
|
1359
1328
|
return ContextMenuGroup;
|
|
1360
1329
|
}({});
|
|
1361
1330
|
|
|
1362
|
-
|
|
1363
|
-
//#region src/services/menu/menu-manager.service.ts
|
|
1331
|
+
// src/services/menu/menu-manager.service.ts
|
|
1364
1332
|
var _MenuManagerService;
|
|
1365
1333
|
const IMenuManagerService = createIdentifier("univer.menu-manager-service");
|
|
1366
1334
|
let MenuManagerService = _MenuManagerService = class MenuManagerService extends Disposable {
|
|
@@ -1678,8 +1646,7 @@ function mergeMenuSchemaNode(target, source) {
|
|
|
1678
1646
|
return result;
|
|
1679
1647
|
}
|
|
1680
1648
|
|
|
1681
|
-
|
|
1682
|
-
//#region src/controllers/shortcut-display/shortcut-panel.controller.ts
|
|
1649
|
+
// src/controllers/shortcut-display/shortcut-panel.controller.ts
|
|
1683
1650
|
const ToggleShortcutPanelShortcut = {
|
|
1684
1651
|
id: ToggleShortcutPanelOperation.id,
|
|
1685
1652
|
binding: 4096 | 220,
|
|
@@ -1701,12 +1668,10 @@ ShortcutPanelController = __decorate([
|
|
|
1701
1668
|
__decorateParam(2, ICommandService)
|
|
1702
1669
|
], ShortcutPanelController);
|
|
1703
1670
|
|
|
1704
|
-
|
|
1705
|
-
//#region src/services/dialog/dialog.service.ts
|
|
1671
|
+
// src/services/dialog/dialog.service.ts
|
|
1706
1672
|
const IDialogService = createIdentifier("univer.ui.dialog-service");
|
|
1707
1673
|
|
|
1708
|
-
|
|
1709
|
-
//#region src/services/ribbon/ribbon.service.ts
|
|
1674
|
+
// src/services/ribbon/ribbon.service.ts
|
|
1710
1675
|
const IRibbonService = createIdentifier("univer.ribbon-service");
|
|
1711
1676
|
function isSameHiddenMap(previous, current) {
|
|
1712
1677
|
return previous.length === current.length && previous.every((hidden, index) => hidden === current[index]);
|
|
@@ -1870,12 +1835,44 @@ let DesktopRibbonService = class DesktopRibbonService extends Disposable {
|
|
|
1870
1835
|
};
|
|
1871
1836
|
DesktopRibbonService = __decorate([__decorateParam(0, IMenuManagerService), __decorateParam(1, IUniverInstanceService)], DesktopRibbonService);
|
|
1872
1837
|
|
|
1873
|
-
|
|
1874
|
-
//#region src/utils/di.ts
|
|
1838
|
+
// src/utils/di.ts
|
|
1875
1839
|
function unwrap(o) {
|
|
1876
1840
|
if (typeof o === "function") return o();
|
|
1877
1841
|
return o;
|
|
1878
1842
|
}
|
|
1843
|
+
function useObservable(observable, defaultValue, shouldHaveSyncValue, deps) {
|
|
1844
|
+
if (typeof observable === "function" && !deps) throw new Error("Expected deps to be provided when observable is a function!");
|
|
1845
|
+
const dependencies = deps ?? [observable];
|
|
1846
|
+
const stateRef = useRef(void 0);
|
|
1847
|
+
const previous = stateRef.current;
|
|
1848
|
+
if (!previous || dependencies.length !== previous.dependencies.length || dependencies.some((value, index) => !Object.is(value, previous.dependencies[index]))) {
|
|
1849
|
+
var _state$source;
|
|
1850
|
+
const state = {
|
|
1851
|
+
dependencies: [...dependencies],
|
|
1852
|
+
source: observable ? unwrap(observable) : null,
|
|
1853
|
+
value: observable && previous ? previous.value : defaultValue,
|
|
1854
|
+
hasSyncValue: false
|
|
1855
|
+
};
|
|
1856
|
+
const subscription = (_state$source = state.source) === null || _state$source === void 0 ? void 0 : _state$source.subscribe((value) => {
|
|
1857
|
+
state.value = value;
|
|
1858
|
+
state.hasSyncValue = true;
|
|
1859
|
+
});
|
|
1860
|
+
subscription === null || subscription === void 0 || subscription.unsubscribe();
|
|
1861
|
+
stateRef.current = state;
|
|
1862
|
+
}
|
|
1863
|
+
const state = stateRef.current;
|
|
1864
|
+
const [, refresh] = useReducer((revision) => revision + 1, 0);
|
|
1865
|
+
useLayoutEffect(() => {
|
|
1866
|
+
var _state$source2;
|
|
1867
|
+
const subscription = (_state$source2 = state.source) === null || _state$source2 === void 0 ? void 0 : _state$source2.subscribe((value) => {
|
|
1868
|
+
state.value = value;
|
|
1869
|
+
refresh();
|
|
1870
|
+
});
|
|
1871
|
+
return () => subscription === null || subscription === void 0 ? void 0 : subscription.unsubscribe();
|
|
1872
|
+
}, [state]);
|
|
1873
|
+
if (shouldHaveSyncValue && !state.hasSyncValue) throw new Error("Expected a synchronous value from the observable.");
|
|
1874
|
+
return state.value;
|
|
1875
|
+
}
|
|
1879
1876
|
function useObservableRef(observable, defaultValue) {
|
|
1880
1877
|
const ref = useRef(defaultValue);
|
|
1881
1878
|
useEffect(() => {
|
|
@@ -1889,8 +1886,7 @@ function useObservableRef(observable, defaultValue) {
|
|
|
1889
1886
|
return ref;
|
|
1890
1887
|
}
|
|
1891
1888
|
|
|
1892
|
-
|
|
1893
|
-
//#region src/views/components/feature-search/FeatureSearch.tsx
|
|
1889
|
+
// src/views/components/feature-search/FeatureSearch.tsx
|
|
1894
1890
|
/**
|
|
1895
1891
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
1896
1892
|
*
|
|
@@ -2056,8 +2052,7 @@ function FeatureSearch() {
|
|
|
2056
2052
|
});
|
|
2057
2053
|
}
|
|
2058
2054
|
|
|
2059
|
-
|
|
2060
|
-
//#region src/commands/operations/open-feature-search.operation.ts
|
|
2055
|
+
// src/commands/operations/open-feature-search.operation.ts
|
|
2061
2056
|
const OpenFeatureSearchOperation = {
|
|
2062
2057
|
id: "ui.operation.open-feature-search",
|
|
2063
2058
|
type: CommandType.OPERATION,
|
|
@@ -2075,8 +2070,7 @@ const OpenFeatureSearchOperation = {
|
|
|
2075
2070
|
}
|
|
2076
2071
|
};
|
|
2077
2072
|
|
|
2078
|
-
|
|
2079
|
-
//#region src/services/format-painter/format-painter-canvas.ts
|
|
2073
|
+
// src/services/format-painter/format-painter-canvas.ts
|
|
2080
2074
|
const FORMAT_PAINTER_CURSOR_CSS = `
|
|
2081
2075
|
/* Keep the brush visible while the render engine updates its usual object/text cursors. */
|
|
2082
2076
|
canvas[data-format-painter="available"] {
|
|
@@ -2154,8 +2148,7 @@ function bindFormatPainterCanvas(canvas, session, options) {
|
|
|
2154
2148
|
} };
|
|
2155
2149
|
}
|
|
2156
2150
|
|
|
2157
|
-
|
|
2158
|
-
//#region src/services/format-painter/format-painter-session.service.ts
|
|
2151
|
+
// src/services/format-painter/format-painter-session.service.ts
|
|
2159
2152
|
/** One local interaction session; domain commands retain ownership of persisted formatting. */
|
|
2160
2153
|
var FormatPainterSessionService = class extends Disposable {
|
|
2161
2154
|
constructor(..._args) {
|
|
@@ -2262,8 +2255,7 @@ var FormatPainterSessionService = class extends Disposable {
|
|
|
2262
2255
|
}
|
|
2263
2256
|
};
|
|
2264
2257
|
|
|
2265
|
-
|
|
2266
|
-
//#region src/controllers/format-painter.controller.ts
|
|
2258
|
+
// src/controllers/format-painter.controller.ts
|
|
2267
2259
|
const ActivateFormatPainterOperation = {
|
|
2268
2260
|
id: "ui.operation.activate-format-painter",
|
|
2269
2261
|
type: CommandType.OPERATION,
|
|
@@ -2329,8 +2321,7 @@ FormatPainterController = __decorate([
|
|
|
2329
2321
|
__decorateParam(3, IUniverInstanceService)
|
|
2330
2322
|
], FormatPainterController);
|
|
2331
2323
|
|
|
2332
|
-
|
|
2333
|
-
//#region src/menu/feature-search.menu.ts
|
|
2324
|
+
// src/menu/feature-search.menu.ts
|
|
2334
2325
|
function FeatureSearchMenuItemFactory() {
|
|
2335
2326
|
return {
|
|
2336
2327
|
id: OpenFeatureSearchOperation.id,
|
|
@@ -2341,8 +2332,7 @@ function FeatureSearchMenuItemFactory() {
|
|
|
2341
2332
|
};
|
|
2342
2333
|
}
|
|
2343
2334
|
|
|
2344
|
-
|
|
2345
|
-
//#region src/menu/format-painter.menu.ts
|
|
2335
|
+
// src/menu/format-painter.menu.ts
|
|
2346
2336
|
function FormatPainterMenuItemFactory(accessor) {
|
|
2347
2337
|
const session = accessor.get(FormatPainterSessionService);
|
|
2348
2338
|
return {
|
|
@@ -2368,8 +2358,7 @@ function ClearFormattingMenuItemFactory(accessor) {
|
|
|
2368
2358
|
};
|
|
2369
2359
|
}
|
|
2370
2360
|
|
|
2371
|
-
|
|
2372
|
-
//#region src/menu/history.menu.ts
|
|
2361
|
+
// src/menu/history.menu.ts
|
|
2373
2362
|
const undoRedoDisableFactory$ = (accessor, isUndo) => {
|
|
2374
2363
|
const undoRedoService = accessor.get(IUndoRedoService);
|
|
2375
2364
|
const contextService = accessor.get(IContextService);
|
|
@@ -2401,10 +2390,14 @@ function RedoMenuItemFactory(accessor) {
|
|
|
2401
2390
|
};
|
|
2402
2391
|
}
|
|
2403
2392
|
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2393
|
+
// src/menu/shortcut-panel.menu.ts
|
|
2394
|
+
function ShortcutPanelMenuItemFactory(accessor) {
|
|
2395
|
+
const sidebarService = accessor.get(ISidebarService);
|
|
2407
2396
|
return {
|
|
2397
|
+
activated$: defer(() => sidebarService.sidebarOptions$.pipe(startWith(sidebarService.options), map((options) => {
|
|
2398
|
+
var _options$children;
|
|
2399
|
+
return options.visible === true && ((_options$children = options.children) === null || _options$children === void 0 ? void 0 : _options$children.label) === "ShortcutPanel";
|
|
2400
|
+
}), distinctUntilChanged())),
|
|
2408
2401
|
id: ToggleShortcutPanelOperation.id,
|
|
2409
2402
|
title: "ui.toggle-shortcut-panel",
|
|
2410
2403
|
tooltip: "ui.toggle-shortcut-panel",
|
|
@@ -2413,8 +2406,7 @@ function ShortcutPanelMenuItemFactory() {
|
|
|
2413
2406
|
};
|
|
2414
2407
|
}
|
|
2415
2408
|
|
|
2416
|
-
|
|
2417
|
-
//#region src/menu/schema.ts
|
|
2409
|
+
// src/menu/schema.ts
|
|
2418
2410
|
const menuSchema = {
|
|
2419
2411
|
["ribbon.start.history"]: {
|
|
2420
2412
|
[ActivateFormatPainterOperation.id]: {
|
|
@@ -2466,8 +2458,7 @@ const menuSchema = {
|
|
|
2466
2458
|
}
|
|
2467
2459
|
};
|
|
2468
2460
|
|
|
2469
|
-
|
|
2470
|
-
//#region src/services/parts/parts.service.ts
|
|
2461
|
+
// src/services/parts/parts.service.ts
|
|
2471
2462
|
let BuiltInUIPart = /* @__PURE__ */ function(BuiltInUIPart) {
|
|
2472
2463
|
BuiltInUIPart["GLOBAL"] = "global";
|
|
2473
2464
|
BuiltInUIPart["HEADER"] = "header";
|
|
@@ -2563,8 +2554,7 @@ var UIPartsService = class extends Disposable {
|
|
|
2563
2554
|
}
|
|
2564
2555
|
};
|
|
2565
2556
|
|
|
2566
|
-
|
|
2567
|
-
//#region src/services/dom/canvas-dom-layer.service.ts
|
|
2557
|
+
// src/services/dom/canvas-dom-layer.service.ts
|
|
2568
2558
|
function shouldForwardFloatDomEvents(layer) {
|
|
2569
2559
|
return layer.eventPassThrough !== false;
|
|
2570
2560
|
}
|
|
@@ -2663,8 +2653,52 @@ var CanvasFloatDomPreviewService = class extends Disposable {
|
|
|
2663
2653
|
}
|
|
2664
2654
|
};
|
|
2665
2655
|
|
|
2666
|
-
|
|
2667
|
-
|
|
2656
|
+
// src/views/hooks/prevent-browser-zoom.ts
|
|
2657
|
+
/**
|
|
2658
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2659
|
+
*
|
|
2660
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2661
|
+
* you may not use this file except in compliance with the License.
|
|
2662
|
+
* You may obtain a copy of the License at
|
|
2663
|
+
*
|
|
2664
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2665
|
+
*
|
|
2666
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2667
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2668
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2669
|
+
* See the License for the specific language governing permissions and
|
|
2670
|
+
* limitations under the License.
|
|
2671
|
+
*/
|
|
2672
|
+
function preventBrowserZoomInContainers(containers) {
|
|
2673
|
+
const uniqueContainers = new Set(containers);
|
|
2674
|
+
const handleWheel = (event) => {
|
|
2675
|
+
if (event.ctrlKey || event.metaKey) event.preventDefault();
|
|
2676
|
+
};
|
|
2677
|
+
const handleGesture = (event) => event.preventDefault();
|
|
2678
|
+
uniqueContainers.forEach((container) => {
|
|
2679
|
+
container.addEventListener("wheel", handleWheel, {
|
|
2680
|
+
capture: true,
|
|
2681
|
+
passive: false
|
|
2682
|
+
});
|
|
2683
|
+
container.addEventListener("gesturestart", handleGesture, {
|
|
2684
|
+
capture: true,
|
|
2685
|
+
passive: false
|
|
2686
|
+
});
|
|
2687
|
+
container.addEventListener("gesturechange", handleGesture, {
|
|
2688
|
+
capture: true,
|
|
2689
|
+
passive: false
|
|
2690
|
+
});
|
|
2691
|
+
});
|
|
2692
|
+
return () => {
|
|
2693
|
+
uniqueContainers.forEach((container) => {
|
|
2694
|
+
container.removeEventListener("wheel", handleWheel, true);
|
|
2695
|
+
container.removeEventListener("gesturestart", handleGesture, true);
|
|
2696
|
+
container.removeEventListener("gesturechange", handleGesture, true);
|
|
2697
|
+
});
|
|
2698
|
+
};
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2701
|
+
// src/views/components/dom/float-dom-layout.ts
|
|
2668
2702
|
const LEGACY_WRAPPER_INSET = 2;
|
|
2669
2703
|
const LEGACY_CONTENT_INSET = 4;
|
|
2670
2704
|
function resolveFloatDomLayout(position, contentBox) {
|
|
@@ -2690,8 +2724,7 @@ function resolveFloatDomLayout(position, contentBox) {
|
|
|
2690
2724
|
};
|
|
2691
2725
|
}
|
|
2692
2726
|
|
|
2693
|
-
|
|
2694
|
-
//#region src/views/components/dom/FloatDom.tsx
|
|
2727
|
+
// src/views/components/dom/FloatDom.tsx
|
|
2695
2728
|
function applyFloatDomLayout(wrapper, inner, layout) {
|
|
2696
2729
|
const { wrapper: wrapperLayout, inner: innerLayout } = layout;
|
|
2697
2730
|
const wrapperStyle = wrapper.style;
|
|
@@ -2746,6 +2779,13 @@ function FloatDomSingleContent(props) {
|
|
|
2746
2779
|
const wrapperInset = (_layer$contentBox = layer.contentBox) === null || _layer$contentBox === void 0 ? void 0 : _layer$contentBox.wrapperInset;
|
|
2747
2780
|
const contentInset = (_layer$contentBox2 = layer.contentBox) === null || _layer$contentBox2 === void 0 ? void 0 : _layer$contentBox2.contentInset;
|
|
2748
2781
|
const forwardEvents = shouldForwardFloatDomEvents(layer);
|
|
2782
|
+
useEffect(() => {
|
|
2783
|
+
if (forwardEvents && layer.preventBrowserZoom && domRef.current) return preventBrowserZoomInContainers([domRef.current]);
|
|
2784
|
+
}, [
|
|
2785
|
+
forwardEvents,
|
|
2786
|
+
layer.preventBrowserZoom,
|
|
2787
|
+
position
|
|
2788
|
+
]);
|
|
2749
2789
|
useEffect(() => {
|
|
2750
2790
|
const subscription = layer.position$.subscribe((position) => {
|
|
2751
2791
|
if (domRef.current && innerDomRef.current) applyFloatDomLayout(domRef.current, innerDomRef.current, resolveFloatDomLayout(position, {
|
|
@@ -2761,6 +2801,48 @@ function FloatDomSingleContent(props) {
|
|
|
2761
2801
|
layer.position$,
|
|
2762
2802
|
wrapperInset
|
|
2763
2803
|
]);
|
|
2804
|
+
const eventHandlers = useMemo(() => ({
|
|
2805
|
+
wheel: (event) => layer.onWheel(event),
|
|
2806
|
+
pointermove: (event) => layer.onPointerMove(event),
|
|
2807
|
+
pointerdown: (event) => {
|
|
2808
|
+
layer.onPointerDown(event);
|
|
2809
|
+
if (event.target instanceof Element && event.target.isConnected) {
|
|
2810
|
+
var _event$target$setPoin, _event$target;
|
|
2811
|
+
(_event$target$setPoin = (_event$target = event.target).setPointerCapture) === null || _event$target$setPoin === void 0 || _event$target$setPoin.call(_event$target, event.pointerId);
|
|
2812
|
+
}
|
|
2813
|
+
},
|
|
2814
|
+
pointerup: (event) => {
|
|
2815
|
+
try {
|
|
2816
|
+
layer.onPointerUp(event);
|
|
2817
|
+
} finally {
|
|
2818
|
+
var _event$target$hasPoin, _event$target2;
|
|
2819
|
+
if (event.target instanceof Element && ((_event$target$hasPoin = (_event$target2 = event.target).hasPointerCapture) === null || _event$target$hasPoin === void 0 ? void 0 : _event$target$hasPoin.call(_event$target2, event.pointerId))) {
|
|
2820
|
+
var _event$target$release, _event$target3;
|
|
2821
|
+
(_event$target$release = (_event$target3 = event.target).releasePointerCapture) === null || _event$target$release === void 0 || _event$target$release.call(_event$target3, event.pointerId);
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
}), [layer]);
|
|
2826
|
+
useEffect(() => {
|
|
2827
|
+
const wrapper = domRef.current;
|
|
2828
|
+
if (!forwardEvents || !wrapper || !layer.eventOptions) return;
|
|
2829
|
+
const cleanups = [];
|
|
2830
|
+
const bindEvent = (eventName) => {
|
|
2831
|
+
var _layer$eventOptions;
|
|
2832
|
+
const options = (_layer$eventOptions = layer.eventOptions) === null || _layer$eventOptions === void 0 ? void 0 : _layer$eventOptions[eventName];
|
|
2833
|
+
if (options === void 0) return;
|
|
2834
|
+
const listener = eventHandlers[eventName];
|
|
2835
|
+
wrapper.addEventListener(eventName, listener, options);
|
|
2836
|
+
cleanups.push(() => wrapper.removeEventListener(eventName, listener, options.capture));
|
|
2837
|
+
};
|
|
2838
|
+
for (const eventName of Object.keys(layer.eventOptions)) bindEvent(eventName);
|
|
2839
|
+
return () => cleanups.forEach((cleanup) => cleanup());
|
|
2840
|
+
}, [
|
|
2841
|
+
forwardEvents,
|
|
2842
|
+
eventHandlers,
|
|
2843
|
+
layer.eventOptions,
|
|
2844
|
+
position
|
|
2845
|
+
]);
|
|
2764
2846
|
const instance = univerInstanceService.getUnit(layer.unitId);
|
|
2765
2847
|
const docDisabled = instance instanceof DocumentDataModel ? instance.getDisabled() : void 0;
|
|
2766
2848
|
const component = useMemo(() => Component ? /* @__PURE__ */ jsx(Component, {
|
|
@@ -2783,44 +2865,24 @@ function FloatDomSingleContent(props) {
|
|
|
2783
2865
|
overflow: floatDomOverflow.outerOverflow,
|
|
2784
2866
|
touchAction: forwardEvents ? "none" : void 0
|
|
2785
2867
|
},
|
|
2786
|
-
|
|
2787
|
-
|
|
2868
|
+
onWheel: (event) => {
|
|
2869
|
+
var _layer$eventOptions2;
|
|
2870
|
+
if (forwardEvents && ((_layer$eventOptions2 = layer.eventOptions) === null || _layer$eventOptions2 === void 0 ? void 0 : _layer$eventOptions2.wheel) === void 0) eventHandlers.wheel(event.nativeEvent);
|
|
2788
2871
|
},
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
var _e$target$setPointerC, _e$target;
|
|
2793
|
-
(_e$target$setPointerC = (_e$target = e.target).setPointerCapture) === null || _e$target$setPointerC === void 0 || _e$target$setPointerC.call(_e$target, e.pointerId);
|
|
2794
|
-
}
|
|
2795
|
-
layer.onPointerDown(e.nativeEvent);
|
|
2796
|
-
}
|
|
2872
|
+
onPointerMove: (event) => {
|
|
2873
|
+
var _layer$eventOptions3;
|
|
2874
|
+
if (forwardEvents && ((_layer$eventOptions3 = layer.eventOptions) === null || _layer$eventOptions3 === void 0 ? void 0 : _layer$eventOptions3.pointermove) === void 0) eventHandlers.pointermove(event.nativeEvent);
|
|
2797
2875
|
},
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
layer.onPointerUp(e.nativeEvent);
|
|
2802
|
-
} finally {
|
|
2803
|
-
var _e$target$hasPointerC, _e$target2;
|
|
2804
|
-
if (e.target instanceof Element && ((_e$target$hasPointerC = (_e$target2 = e.target).hasPointerCapture) === null || _e$target$hasPointerC === void 0 ? void 0 : _e$target$hasPointerC.call(_e$target2, e.pointerId))) {
|
|
2805
|
-
var _e$target$releasePoin, _e$target3;
|
|
2806
|
-
(_e$target$releasePoin = (_e$target3 = e.target).releasePointerCapture) === null || _e$target$releasePoin === void 0 || _e$target$releasePoin.call(_e$target3, e.pointerId);
|
|
2807
|
-
}
|
|
2808
|
-
}
|
|
2876
|
+
onPointerDown: (event) => {
|
|
2877
|
+
var _layer$eventOptions4;
|
|
2878
|
+
if (forwardEvents && ((_layer$eventOptions4 = layer.eventOptions) === null || _layer$eventOptions4 === void 0 ? void 0 : _layer$eventOptions4.pointerdown) === void 0) eventHandlers.pointerdown(event.nativeEvent);
|
|
2809
2879
|
},
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
layer.onPointerUp(e.nativeEvent);
|
|
2814
|
-
} finally {
|
|
2815
|
-
var _e$target$hasPointerC2, _e$target4;
|
|
2816
|
-
if (e.target instanceof Element && ((_e$target$hasPointerC2 = (_e$target4 = e.target).hasPointerCapture) === null || _e$target$hasPointerC2 === void 0 ? void 0 : _e$target$hasPointerC2.call(_e$target4, e.pointerId))) {
|
|
2817
|
-
var _e$target$releasePoin2, _e$target5;
|
|
2818
|
-
(_e$target$releasePoin2 = (_e$target5 = e.target).releasePointerCapture) === null || _e$target$releasePoin2 === void 0 || _e$target$releasePoin2.call(_e$target5, e.pointerId);
|
|
2819
|
-
}
|
|
2820
|
-
}
|
|
2880
|
+
onPointerUp: (event) => {
|
|
2881
|
+
var _layer$eventOptions5;
|
|
2882
|
+
if (forwardEvents && ((_layer$eventOptions5 = layer.eventOptions) === null || _layer$eventOptions5 === void 0 ? void 0 : _layer$eventOptions5.pointerup) === void 0) eventHandlers.pointerup(event.nativeEvent);
|
|
2821
2883
|
},
|
|
2822
|
-
|
|
2823
|
-
if (forwardEvents)
|
|
2884
|
+
onPointerCancel: (event) => {
|
|
2885
|
+
if (forwardEvents) eventHandlers.pointerup(event.nativeEvent);
|
|
2824
2886
|
},
|
|
2825
2887
|
children: /* @__PURE__ */ jsx("div", {
|
|
2826
2888
|
id,
|
|
@@ -2871,8 +2933,7 @@ function resolveFloatDomOverflow(props) {
|
|
|
2871
2933
|
};
|
|
2872
2934
|
}
|
|
2873
2935
|
|
|
2874
|
-
|
|
2875
|
-
//#region src/services/popup/canvas-popup.service.ts
|
|
2936
|
+
// src/services/popup/canvas-popup.service.ts
|
|
2876
2937
|
const ICanvasPopupService = createIdentifier("ui.popup.service");
|
|
2877
2938
|
var CanvasPopupService = class extends Disposable {
|
|
2878
2939
|
constructor(..._args) {
|
|
@@ -2918,8 +2979,7 @@ var CanvasPopupService = class extends Disposable {
|
|
|
2918
2979
|
}
|
|
2919
2980
|
};
|
|
2920
2981
|
|
|
2921
|
-
|
|
2922
|
-
//#region src/views/hooks/event.ts
|
|
2982
|
+
// src/views/hooks/event.ts
|
|
2923
2983
|
/**
|
|
2924
2984
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2925
2985
|
*
|
|
@@ -2944,8 +3004,7 @@ function useEvent(func) {
|
|
|
2944
3004
|
}), []);
|
|
2945
3005
|
}
|
|
2946
3006
|
|
|
2947
|
-
|
|
2948
|
-
//#region src/views/components/popup/RectPopup.tsx
|
|
3007
|
+
// src/views/components/popup/RectPopup.tsx
|
|
2949
3008
|
const RectPopupContext = createContext({ current: void 0 });
|
|
2950
3009
|
const RectPopupDirectionContext = createContext("vertical");
|
|
2951
3010
|
/** The popup should have a minimum edge to the boundary. */
|
|
@@ -3144,8 +3203,7 @@ RectPopup.calcPopupPosition = calcPopupPosition;
|
|
|
3144
3203
|
RectPopup.useContext = () => useContext(RectPopupContext);
|
|
3145
3204
|
RectPopup.useDirection = () => useContext(RectPopupDirectionContext);
|
|
3146
3205
|
|
|
3147
|
-
|
|
3148
|
-
//#region src/views/components/popup/CanvasPopup.tsx
|
|
3206
|
+
// src/views/components/popup/CanvasPopup.tsx
|
|
3149
3207
|
const SingleCanvasPopup = ({ popup, children }) => {
|
|
3150
3208
|
const anchorRect$ = useMemo(() => popup.anchorRect$.pipe(throttleTime(0, animationFrameScheduler), map((anchorRect) => {
|
|
3151
3209
|
const { bottom, left, right, top } = anchorRect;
|
|
@@ -3230,8 +3288,7 @@ function CanvasPopupContent({ popup }) {
|
|
|
3230
3288
|
}) : content;
|
|
3231
3289
|
}
|
|
3232
3290
|
|
|
3233
|
-
|
|
3234
|
-
//#region src/services/ribbon/ribbon-override.service.ts
|
|
3291
|
+
// src/services/ribbon/ribbon-override.service.ts
|
|
3235
3292
|
const IRibbonOverrideService = createIdentifier("univer.ribbon-override-service");
|
|
3236
3293
|
var RibbonOverrideService = class extends Disposable {
|
|
3237
3294
|
constructor(..._args) {
|
|
@@ -3257,8 +3314,7 @@ var RibbonOverrideService = class extends Disposable {
|
|
|
3257
3314
|
}
|
|
3258
3315
|
};
|
|
3259
3316
|
|
|
3260
|
-
|
|
3261
|
-
//#region src/views/components/ComponentContainer.tsx
|
|
3317
|
+
// src/views/components/ComponentContainer.tsx
|
|
3262
3318
|
function ComponentContainer(props) {
|
|
3263
3319
|
const { components, fallback, sharedProps } = props;
|
|
3264
3320
|
if (!components || components.size === 0) return fallback ?? null;
|
|
@@ -3290,8 +3346,37 @@ function useComponentsOfPart(part, injector) {
|
|
|
3290
3346
|
return useMemo(() => uiPartsService.isUIVisible(part) ? uiPartsService.getComponents(part) : /* @__PURE__ */ new Set(), [componentPartUpdateCount]);
|
|
3291
3347
|
}
|
|
3292
3348
|
|
|
3293
|
-
|
|
3294
|
-
|
|
3349
|
+
// src/views/components/ribbon/ribbon-menu/use-ribbon-tabs.ts
|
|
3350
|
+
function useRibbonTabs(ribbon, onSelectTab) {
|
|
3351
|
+
const { direction } = useContext(ConfigContext);
|
|
3352
|
+
return (event) => {
|
|
3353
|
+
const tabs = Array.from(event.currentTarget.querySelectorAll("[role=\"tab\"]"));
|
|
3354
|
+
const index = tabs.indexOf(event.target);
|
|
3355
|
+
if (index < 0) return;
|
|
3356
|
+
let next;
|
|
3357
|
+
switch (event.key) {
|
|
3358
|
+
case "Home":
|
|
3359
|
+
next = 0;
|
|
3360
|
+
break;
|
|
3361
|
+
case "End":
|
|
3362
|
+
next = tabs.length - 1;
|
|
3363
|
+
break;
|
|
3364
|
+
case "ArrowLeft":
|
|
3365
|
+
next = (index + (direction === "rtl" ? 1 : -1) + tabs.length) % tabs.length;
|
|
3366
|
+
break;
|
|
3367
|
+
case "ArrowRight":
|
|
3368
|
+
next = (index + (direction === "rtl" ? -1 : 1) + tabs.length) % tabs.length;
|
|
3369
|
+
break;
|
|
3370
|
+
default: return;
|
|
3371
|
+
}
|
|
3372
|
+
event.preventDefault();
|
|
3373
|
+
event.stopPropagation();
|
|
3374
|
+
tabs[next].focus();
|
|
3375
|
+
onSelectTab(ribbon[next]);
|
|
3376
|
+
};
|
|
3377
|
+
}
|
|
3378
|
+
|
|
3379
|
+
// src/views/components/ribbon/ribbon-menu/ClassicMenu.tsx
|
|
3295
3380
|
/**
|
|
3296
3381
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3297
3382
|
*
|
|
@@ -3309,15 +3394,18 @@ function useComponentsOfPart(part, injector) {
|
|
|
3309
3394
|
*/
|
|
3310
3395
|
function ClassicMenu({ ribbon, activatedTab, onSelectTab }) {
|
|
3311
3396
|
const localeService = useDependency(LocaleService);
|
|
3397
|
+
const handleKeyDown = useRibbonTabs(ribbon, onSelectTab);
|
|
3312
3398
|
return /* @__PURE__ */ jsx("div", {
|
|
3313
3399
|
className: "univer-flex univer-size-full univer-items-center univer-justify-center univer-gap-1 univer-overflow-x-auto univer-rounded-md univer-bg-gray-50 univer-px-3 dark:!univer-bg-gray-900",
|
|
3314
3400
|
role: "tablist",
|
|
3401
|
+
onKeyDown: handleKeyDown,
|
|
3315
3402
|
children: ribbon.map((group) => {
|
|
3316
3403
|
const isActive = activatedTab === group.key;
|
|
3317
3404
|
return /* @__PURE__ */ jsx("button", {
|
|
3318
3405
|
type: "button",
|
|
3319
3406
|
role: "tab",
|
|
3320
3407
|
"aria-selected": isActive,
|
|
3408
|
+
tabIndex: isActive ? 0 : -1,
|
|
3321
3409
|
title: localeService.t(group.title || group.key),
|
|
3322
3410
|
onClick: () => onSelectTab(group),
|
|
3323
3411
|
className: clsx("univer-flex univer-cursor-pointer univer-appearance-none univer-items-center univer-gap-1 univer-rounded-sm univer-border-none univer-px-2 univer-py-1 univer-text-sm univer-transition-colors focus:univer-outline-none focus:univer-ring-2 focus:univer-ring-primary-500 dark:focus:!univer-ring-primary-300", isActive ? "univer-bg-primary-50 univer-font-semibold univer-text-primary-600 univer-shadow-sm dark:!univer-bg-primary-900 dark:!univer-text-primary-300" : "univer-bg-transparent univer-text-gray-700 hover:univer-bg-gray-100 dark:!univer-text-gray-200 dark:hover:!univer-bg-gray-700"),
|
|
@@ -3327,8 +3415,7 @@ function ClassicMenu({ ribbon, activatedTab, onSelectTab }) {
|
|
|
3327
3415
|
});
|
|
3328
3416
|
}
|
|
3329
3417
|
|
|
3330
|
-
|
|
3331
|
-
//#region src/views/components/ribbon/ribbon-menu/DefaultMenu.tsx
|
|
3418
|
+
// src/views/components/ribbon/ribbon-menu/DefaultMenu.tsx
|
|
3332
3419
|
const iconMap = {
|
|
3333
3420
|
["ribbon.start"]: HomeIcon,
|
|
3334
3421
|
["ribbon.insert"]: InsertIcon,
|
|
@@ -3390,15 +3477,31 @@ function DefaultMenu({ ribbon, activatedTab, onSelectTab }) {
|
|
|
3390
3477
|
});
|
|
3391
3478
|
}
|
|
3392
3479
|
|
|
3393
|
-
|
|
3394
|
-
|
|
3480
|
+
// src/views/components/ribbon/ribbon-menu/RibbonGridMenu.tsx
|
|
3481
|
+
/**
|
|
3482
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3483
|
+
*
|
|
3484
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3485
|
+
* you may not use this file except in compliance with the License.
|
|
3486
|
+
* You may obtain a copy of the License at
|
|
3487
|
+
*
|
|
3488
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3489
|
+
*
|
|
3490
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3491
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3492
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3493
|
+
* See the License for the specific language governing permissions and
|
|
3494
|
+
* limitations under the License.
|
|
3495
|
+
*/
|
|
3395
3496
|
function RibbonGridMenu({ ribbon, activatedTab, onSelectTab }) {
|
|
3396
3497
|
const localeService = useDependency(LocaleService);
|
|
3498
|
+
const handleKeyDown = useRibbonTabs(ribbon, onSelectTab);
|
|
3397
3499
|
return /* @__PURE__ */ jsx("div", {
|
|
3398
3500
|
"data-testid": "ribbon-grid-menu",
|
|
3399
3501
|
"data-u-comp": "ribbon-grid-menu",
|
|
3400
3502
|
className: "univer-flex univer-h-full univer-items-end univer-justify-start univer-overflow-x-auto univer-bg-gray-50 univer-px-2 dark:!univer-bg-gray-900",
|
|
3401
3503
|
role: "tablist",
|
|
3504
|
+
onKeyDown: handleKeyDown,
|
|
3402
3505
|
children: ribbon.map((group) => {
|
|
3403
3506
|
const isActive = activatedTab === group.key;
|
|
3404
3507
|
const title = localeService.t(group.title || group.key);
|
|
@@ -3406,6 +3509,7 @@ function RibbonGridMenu({ ribbon, activatedTab, onSelectTab }) {
|
|
|
3406
3509
|
type: "button",
|
|
3407
3510
|
role: "tab",
|
|
3408
3511
|
"aria-selected": isActive,
|
|
3512
|
+
tabIndex: isActive ? 0 : -1,
|
|
3409
3513
|
title,
|
|
3410
3514
|
onClick: () => onSelectTab(group),
|
|
3411
3515
|
className: clsx("univer-relative univer-flex univer-h-8 univer-cursor-pointer univer-items-center univer-whitespace-nowrap univer-border-0 univer-border-b-[3px] univer-bg-transparent univer-px-3 univer-text-sm univer-font-semibold univer-text-gray-700 univer-transition-colors hover:univer-text-gray-900 focus-visible:univer-outline-none focus-visible:univer-ring-2 focus-visible:univer-ring-inset focus-visible:univer-ring-primary-500 dark:!univer-text-gray-200 dark:hover:!univer-text-gray-0", isActive ? "univer-border-primary-600 univer-text-primary-700 dark:!univer-text-primary-300" : "univer-border-transparent"),
|
|
@@ -3415,8 +3519,7 @@ function RibbonGridMenu({ ribbon, activatedTab, onSelectTab }) {
|
|
|
3415
3519
|
});
|
|
3416
3520
|
}
|
|
3417
3521
|
|
|
3418
|
-
|
|
3419
|
-
//#region src/views/components/ribbon/ribbon-grid-layout.ts
|
|
3522
|
+
// src/views/components/ribbon/ribbon-grid-layout.ts
|
|
3420
3523
|
const RIBBON_GRID_ROWS = 2;
|
|
3421
3524
|
function placeRibbonGridItems(items) {
|
|
3422
3525
|
const occupied = /* @__PURE__ */ new Set();
|
|
@@ -3444,6 +3547,7 @@ function placeRibbonGridItems(items) {
|
|
|
3444
3547
|
columnSpan,
|
|
3445
3548
|
showLabel: layout.showLabel ?? false,
|
|
3446
3549
|
width: layout.width,
|
|
3550
|
+
minWidth: layout.minWidth,
|
|
3447
3551
|
iconSize: layout.iconSize
|
|
3448
3552
|
};
|
|
3449
3553
|
if (cells.some((cell) => occupied.has(cell))) {
|
|
@@ -3469,13 +3573,25 @@ function placeRibbonGridItems(items) {
|
|
|
3469
3573
|
columnSpan,
|
|
3470
3574
|
showLabel: (layout === null || layout === void 0 ? void 0 : layout.showLabel) ?? false,
|
|
3471
3575
|
width: layout === null || layout === void 0 ? void 0 : layout.width,
|
|
3576
|
+
minWidth: layout === null || layout === void 0 ? void 0 : layout.minWidth,
|
|
3472
3577
|
iconSize: layout === null || layout === void 0 ? void 0 : layout.iconSize
|
|
3473
3578
|
});
|
|
3474
3579
|
}
|
|
3475
|
-
return items.map((item) => placements.get(item));
|
|
3580
|
+
return items.map((item) => placements.get(item)).sort((a, b) => a.row - b.row || a.column - b.column);
|
|
3476
3581
|
}
|
|
3477
3582
|
function isValidGridGeometry(layout, rowSpan, cells) {
|
|
3478
|
-
return cells.length > 0 && layout.row + rowSpan - 1 <= RIBBON_GRID_ROWS && (layout.width === void 0 || Number.isFinite(layout.width) && layout.width > 0) && (layout.iconSize === void 0 || Number.isFinite(layout.iconSize) && layout.iconSize > 0);
|
|
3583
|
+
return cells.length > 0 && layout.row + rowSpan - 1 <= RIBBON_GRID_ROWS && (layout.width === void 0 || Number.isFinite(layout.width) && layout.width > 0) && (layout.minWidth === void 0 || Number.isFinite(layout.minWidth) && layout.minWidth > 0 && layout.minWidth <= (layout.width ?? 0)) && (layout.iconSize === void 0 || Number.isFinite(layout.iconSize) && layout.iconSize > 0);
|
|
3584
|
+
}
|
|
3585
|
+
function groupRibbonOverflowItems(items) {
|
|
3586
|
+
const placements = placeRibbonGridItems(items);
|
|
3587
|
+
const groups = [];
|
|
3588
|
+
placements.forEach((placement, index) => {
|
|
3589
|
+
var _placement$item$item, _previous$item$item;
|
|
3590
|
+
const previous = placements[index - 1];
|
|
3591
|
+
if (!previous || placement.row !== previous.row || Boolean((_placement$item$item = placement.item.item) === null || _placement$item$item === void 0 ? void 0 : _placement$item$item.icon) !== Boolean((_previous$item$item = previous.item.item) === null || _previous$item$item === void 0 ? void 0 : _previous$item$item.icon)) groups.push([]);
|
|
3592
|
+
groups[groups.length - 1].push(placement.item);
|
|
3593
|
+
});
|
|
3594
|
+
return groups;
|
|
3479
3595
|
}
|
|
3480
3596
|
function findFirstAvailableCells(occupied, rowSpan, columnSpan) {
|
|
3481
3597
|
for (let column = 1;; column++) for (let row = 1; row + rowSpan - 1 <= RIBBON_GRID_ROWS; row++) {
|
|
@@ -3499,8 +3615,108 @@ function getCells(row, column, rowSpan, columnSpan) {
|
|
|
3499
3615
|
return cells;
|
|
3500
3616
|
}
|
|
3501
3617
|
|
|
3502
|
-
|
|
3503
|
-
|
|
3618
|
+
// src/services/contextmenu/contextmenu-host.service.ts
|
|
3619
|
+
const IContextMenuHostService = createIdentifier("ui.contextmenu.host.service");
|
|
3620
|
+
var ContextMenuHostService = class extends Disposable {
|
|
3621
|
+
constructor(..._args) {
|
|
3622
|
+
super(..._args);
|
|
3623
|
+
_defineProperty(this, "_menuMap", /* @__PURE__ */ new Map());
|
|
3624
|
+
_defineProperty(this, "_activeMenuId$", new BehaviorSubject(null));
|
|
3625
|
+
_defineProperty(this, "_suspensions", /* @__PURE__ */ new Set());
|
|
3626
|
+
_defineProperty(this, "_revision", 0);
|
|
3627
|
+
_defineProperty(this, "activeMenuId$", this._activeMenuId$.asObservable());
|
|
3628
|
+
}
|
|
3629
|
+
get activeMenuId() {
|
|
3630
|
+
return this._activeMenuId$.value;
|
|
3631
|
+
}
|
|
3632
|
+
get revision() {
|
|
3633
|
+
return this._revision;
|
|
3634
|
+
}
|
|
3635
|
+
get suspended() {
|
|
3636
|
+
return this._disposed || this._suspensions.size > 0;
|
|
3637
|
+
}
|
|
3638
|
+
registerMenu(menuId, hide) {
|
|
3639
|
+
this.ensureNotDisposed();
|
|
3640
|
+
this._menuMap.set(menuId, hide);
|
|
3641
|
+
return toDisposable(() => {
|
|
3642
|
+
this._menuMap.delete(menuId);
|
|
3643
|
+
if (this.activeMenuId === menuId) this._activeMenuId$.next(null);
|
|
3644
|
+
});
|
|
3645
|
+
}
|
|
3646
|
+
activateMenu(menuId) {
|
|
3647
|
+
if (this.suspended) return;
|
|
3648
|
+
this.hideActiveMenu(menuId);
|
|
3649
|
+
this._activeMenuId$.next(menuId);
|
|
3650
|
+
}
|
|
3651
|
+
deactivateMenu(menuId) {
|
|
3652
|
+
if (this.activeMenuId === menuId) this._activeMenuId$.next(null);
|
|
3653
|
+
}
|
|
3654
|
+
hideActiveMenu(exceptMenuId) {
|
|
3655
|
+
const activeMenuId = this.activeMenuId;
|
|
3656
|
+
if (!activeMenuId || activeMenuId === exceptMenuId) return;
|
|
3657
|
+
const hide = this._menuMap.get(activeMenuId);
|
|
3658
|
+
this._activeMenuId$.next(null);
|
|
3659
|
+
hide === null || hide === void 0 || hide(true);
|
|
3660
|
+
}
|
|
3661
|
+
closeAll() {
|
|
3662
|
+
++this._revision;
|
|
3663
|
+
this._activeMenuId$.next(null);
|
|
3664
|
+
Array.from(this._menuMap.values()).forEach((hide) => hide(false));
|
|
3665
|
+
}
|
|
3666
|
+
suspend() {
|
|
3667
|
+
this.ensureNotDisposed();
|
|
3668
|
+
const token = Symbol("menu-suspension");
|
|
3669
|
+
this._suspensions.add(token);
|
|
3670
|
+
try {
|
|
3671
|
+
this.closeAll();
|
|
3672
|
+
} catch (error) {
|
|
3673
|
+
this._suspensions.delete(token);
|
|
3674
|
+
throw error;
|
|
3675
|
+
}
|
|
3676
|
+
return toDisposable(() => this._suspensions.delete(token));
|
|
3677
|
+
}
|
|
3678
|
+
dispose() {
|
|
3679
|
+
if (this._disposed) return;
|
|
3680
|
+
super.dispose();
|
|
3681
|
+
try {
|
|
3682
|
+
this.closeAll();
|
|
3683
|
+
} finally {
|
|
3684
|
+
this._menuMap.clear();
|
|
3685
|
+
this._suspensions.clear();
|
|
3686
|
+
this._activeMenuId$.complete();
|
|
3687
|
+
}
|
|
3688
|
+
}
|
|
3689
|
+
};
|
|
3690
|
+
|
|
3691
|
+
// src/utils/use-menu-host.ts
|
|
3692
|
+
/**
|
|
3693
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3694
|
+
*
|
|
3695
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3696
|
+
* you may not use this file except in compliance with the License.
|
|
3697
|
+
* You may obtain a copy of the License at
|
|
3698
|
+
*
|
|
3699
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3700
|
+
*
|
|
3701
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3702
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3703
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3704
|
+
* See the License for the specific language governing permissions and
|
|
3705
|
+
* limitations under the License.
|
|
3706
|
+
*/
|
|
3707
|
+
function useMenuHost(onClose) {
|
|
3708
|
+
const service = useDependency(IContextMenuHostService);
|
|
3709
|
+
const callbackRef = useRef(onClose);
|
|
3710
|
+
callbackRef.current = onClose;
|
|
3711
|
+
useEffect(() => {
|
|
3712
|
+
const registration = service.registerMenu(Symbol("menu"), () => callbackRef.current());
|
|
3713
|
+
if (service.suspended) callbackRef.current();
|
|
3714
|
+
return () => registration.dispose();
|
|
3715
|
+
}, [service]);
|
|
3716
|
+
return service;
|
|
3717
|
+
}
|
|
3718
|
+
|
|
3719
|
+
// src/views/components/ribbon/ToolbarButton.tsx
|
|
3504
3720
|
/**
|
|
3505
3721
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3506
3722
|
*
|
|
@@ -3522,7 +3738,8 @@ univer-justify-center univer-rounded univer-border-none univer-bg-transparent un
|
|
|
3522
3738
|
univer-text-gray-900 univer-outline-none univer-transition-colors univer-animate-in univer-fade-in
|
|
3523
3739
|
dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-700 dark:disabled:!univer-text-gray-600
|
|
3524
3740
|
disabled:univer-cursor-not-allowed disabled:univer-text-gray-300 disabled:hover:univer-bg-transparent
|
|
3525
|
-
hover:univer-bg-gray-100 whitespace-nowrap univer-w-max
|
|
3741
|
+
hover:univer-bg-gray-100 univer-whitespace-nowrap univer-w-max
|
|
3742
|
+
focus-visible:univer-ring-2 focus-visible:univer-ring-inset focus-visible:univer-ring-primary-600
|
|
3526
3743
|
[&_svg]:univer-shrink-0
|
|
3527
3744
|
`;
|
|
3528
3745
|
const toolbarButtonVariants = cva(toolbarButtonClassName, {
|
|
@@ -3576,8 +3793,7 @@ function ToolbarButton(props) {
|
|
|
3576
3793
|
});
|
|
3577
3794
|
}
|
|
3578
3795
|
|
|
3579
|
-
|
|
3580
|
-
//#region src/views/custom-label/CustomLabel.tsx
|
|
3796
|
+
// src/views/custom-label/CustomLabel.tsx
|
|
3581
3797
|
/**
|
|
3582
3798
|
* The component to render toolbar item label and menu item label.
|
|
3583
3799
|
* @param props
|
|
@@ -3637,8 +3853,7 @@ function CustomLabel(props) {
|
|
|
3637
3853
|
return /* @__PURE__ */ jsx(Fragment$1, { children: nodes });
|
|
3638
3854
|
}
|
|
3639
3855
|
|
|
3640
|
-
|
|
3641
|
-
//#region src/views/components/ribbon/hook.ts
|
|
3856
|
+
// src/views/components/ribbon/hook.ts
|
|
3642
3857
|
/**
|
|
3643
3858
|
* Subscribe to a menu item's status change and return the latest status.
|
|
3644
3859
|
* @param menuItem The menu item
|
|
@@ -3677,8 +3892,7 @@ function useToolbarShortcutDisplay({ id, commandId, shortcut }) {
|
|
|
3677
3892
|
return useObservable(shortcut$, null, true);
|
|
3678
3893
|
}
|
|
3679
3894
|
|
|
3680
|
-
|
|
3681
|
-
//#region src/services/font.service.ts
|
|
3895
|
+
// src/services/font.service.ts
|
|
3682
3896
|
const IFontService = createIdentifier("univer.font-service");
|
|
3683
3897
|
let FontCategory = /* @__PURE__ */ function(FontCategory) {
|
|
3684
3898
|
FontCategory["SANS_SERIF"] = "sans-serif";
|
|
@@ -3969,8 +4183,7 @@ let FontService = class FontService {
|
|
|
3969
4183
|
};
|
|
3970
4184
|
FontService = __decorate([__decorateParam(0, IConfigService)], FontService);
|
|
3971
4185
|
|
|
3972
|
-
|
|
3973
|
-
//#region src/views/font-family/use-font-list.ts
|
|
4186
|
+
// src/views/font-family/use-font-list.ts
|
|
3974
4187
|
function useFontList() {
|
|
3975
4188
|
const fontService = useDependency(IFontService);
|
|
3976
4189
|
return {
|
|
@@ -3979,8 +4192,7 @@ function useFontList() {
|
|
|
3979
4192
|
};
|
|
3980
4193
|
}
|
|
3981
4194
|
|
|
3982
|
-
|
|
3983
|
-
//#region src/views/font-family/FontFamilyItem.tsx
|
|
4195
|
+
// src/views/font-family/FontFamilyItem.tsx
|
|
3984
4196
|
const FONT_FAMILY_ITEM_COMPONENT = "UI_FONT_FAMILY_ITEM_COMPONENT";
|
|
3985
4197
|
const FontFamilyItem = ({ value, onChange }) => {
|
|
3986
4198
|
const localeService = useDependency(LocaleService);
|
|
@@ -4006,12 +4218,20 @@ const FontFamilyItem = ({ value, onChange }) => {
|
|
|
4006
4218
|
});
|
|
4007
4219
|
};
|
|
4008
4220
|
|
|
4009
|
-
|
|
4010
|
-
//#region src/views/components/ribbon/TooltipButtonWrapper.tsx
|
|
4221
|
+
// src/views/components/ribbon/TooltipButtonWrapper.tsx
|
|
4011
4222
|
const TooltipWrapperContext = createContext({
|
|
4012
4223
|
dropdownVisible: false,
|
|
4013
|
-
setDropdownVisible: (_visible) => {}
|
|
4224
|
+
setDropdownVisible: (_visible) => {},
|
|
4225
|
+
restoreTriggerFocus: (_event) => {}
|
|
4014
4226
|
});
|
|
4227
|
+
function ToolbarDropdownButton(props) {
|
|
4228
|
+
const { dropdownVisible } = useContext(TooltipWrapperContext);
|
|
4229
|
+
return /* @__PURE__ */ jsx("button", {
|
|
4230
|
+
...props,
|
|
4231
|
+
type: "button",
|
|
4232
|
+
"aria-expanded": dropdownVisible
|
|
4233
|
+
});
|
|
4234
|
+
}
|
|
4015
4235
|
const ToolbarDropdownContext = createContext(null);
|
|
4016
4236
|
/**
|
|
4017
4237
|
* Keeps toolbar tooltips controlled while a related popup opens and closes.
|
|
@@ -4046,17 +4266,56 @@ function ToolbarDropdownProvider(props) {
|
|
|
4046
4266
|
const TooltipWrapper = forwardRef((props, ref) => {
|
|
4047
4267
|
const { children, dropdownKey, ...tooltipProps } = props;
|
|
4048
4268
|
const spanRef = useRef(null);
|
|
4269
|
+
const triggerFocusRef = useRef(null);
|
|
4049
4270
|
const [localDropdownVisible, setLocalDropdownVisible] = useState(false);
|
|
4050
4271
|
const toolbarDropdownContext = useContext(ToolbarDropdownContext);
|
|
4051
4272
|
const dropdownVisible = dropdownKey && toolbarDropdownContext ? toolbarDropdownContext.openDropdownKey === dropdownKey : localDropdownVisible;
|
|
4273
|
+
const menuHost = useMenuHost(() => {
|
|
4274
|
+
if (dropdownVisible) {
|
|
4275
|
+
triggerFocusRef.current = null;
|
|
4276
|
+
if (dropdownKey && toolbarDropdownContext) toolbarDropdownContext.setOpenDropdownKey(null);
|
|
4277
|
+
else setLocalDropdownVisible(false);
|
|
4278
|
+
}
|
|
4279
|
+
});
|
|
4280
|
+
const openRevisionRef = useRef(menuHost.revision);
|
|
4052
4281
|
const handleChangeDropdownVisible = useCallback((visible) => {
|
|
4282
|
+
if (visible) {
|
|
4283
|
+
var _spanRef$current, _spanRef$current2;
|
|
4284
|
+
if (menuHost.suspended) return;
|
|
4285
|
+
openRevisionRef.current = menuHost.revision;
|
|
4286
|
+
const active = (_spanRef$current = spanRef.current) === null || _spanRef$current === void 0 ? void 0 : _spanRef$current.ownerDocument.activeElement;
|
|
4287
|
+
triggerFocusRef.current = active instanceof HTMLElement && ((_spanRef$current2 = spanRef.current) === null || _spanRef$current2 === void 0 ? void 0 : _spanRef$current2.contains(active)) ? active : null;
|
|
4288
|
+
}
|
|
4053
4289
|
if (dropdownKey && toolbarDropdownContext) toolbarDropdownContext.setOpenDropdownKey(visible ? dropdownKey : null);
|
|
4054
4290
|
else setLocalDropdownVisible(visible);
|
|
4055
|
-
}, [
|
|
4291
|
+
}, [
|
|
4292
|
+
dropdownKey,
|
|
4293
|
+
toolbarDropdownContext,
|
|
4294
|
+
menuHost
|
|
4295
|
+
]);
|
|
4296
|
+
const restoreTriggerFocus = useCallback((event) => {
|
|
4297
|
+
if (openRevisionRef.current !== menuHost.revision || menuHost.suspended) {
|
|
4298
|
+
event.preventDefault();
|
|
4299
|
+
return;
|
|
4300
|
+
}
|
|
4301
|
+
const trigger = triggerFocusRef.current;
|
|
4302
|
+
triggerFocusRef.current = null;
|
|
4303
|
+
if (!(trigger === null || trigger === void 0 ? void 0 : trigger.isConnected)) return;
|
|
4304
|
+
const active = trigger.ownerDocument.activeElement;
|
|
4305
|
+
if (active === trigger.ownerDocument.body || event.target instanceof HTMLElement && event.target.contains(active)) {
|
|
4306
|
+
event.preventDefault();
|
|
4307
|
+
trigger.focus({ preventScroll: true });
|
|
4308
|
+
}
|
|
4309
|
+
}, [menuHost]);
|
|
4056
4310
|
const contextValue = useMemo(() => ({
|
|
4057
4311
|
dropdownVisible,
|
|
4058
|
-
setDropdownVisible: handleChangeDropdownVisible
|
|
4059
|
-
|
|
4312
|
+
setDropdownVisible: handleChangeDropdownVisible,
|
|
4313
|
+
restoreTriggerFocus
|
|
4314
|
+
}), [
|
|
4315
|
+
dropdownVisible,
|
|
4316
|
+
handleChangeDropdownVisible,
|
|
4317
|
+
restoreTriggerFocus
|
|
4318
|
+
]);
|
|
4060
4319
|
useImperativeHandle(ref, () => ({ el: spanRef.current }));
|
|
4061
4320
|
const content = /* @__PURE__ */ jsx("span", {
|
|
4062
4321
|
ref: spanRef,
|
|
@@ -4074,7 +4333,7 @@ const TooltipWrapper = forwardRef((props, ref) => {
|
|
|
4074
4333
|
function DropdownWrapper(props) {
|
|
4075
4334
|
const { children, overlay, disabled, align, dropdownComponent: DropdownComponent = Dropdown } = props;
|
|
4076
4335
|
const { direction } = useContext(ConfigContext);
|
|
4077
|
-
const { dropdownVisible, setDropdownVisible } = useContext(TooltipWrapperContext);
|
|
4336
|
+
const { dropdownVisible, setDropdownVisible, restoreTriggerFocus } = useContext(TooltipWrapperContext);
|
|
4078
4337
|
const triggerRef = useRef(null);
|
|
4079
4338
|
const overlayRef = useRef(null);
|
|
4080
4339
|
useEffect(() => {
|
|
@@ -4111,6 +4370,7 @@ function DropdownWrapper(props) {
|
|
|
4111
4370
|
disabled,
|
|
4112
4371
|
open: dropdownVisible,
|
|
4113
4372
|
onOpenChange: handleVisibleChange,
|
|
4373
|
+
onCloseAutoFocus: restoreTriggerFocus,
|
|
4114
4374
|
children: /* @__PURE__ */ jsx("div", {
|
|
4115
4375
|
ref: triggerRef,
|
|
4116
4376
|
className: "univer-h-full",
|
|
@@ -4152,7 +4412,9 @@ function DropdownMenuLabel({ icon, value, option, preserveStrokeWidth, onOptionS
|
|
|
4152
4412
|
});
|
|
4153
4413
|
}
|
|
4154
4414
|
function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled, preserveStrokeWidth, onOptionSelect, dropdownComponent, dropdownMenuComponent: DropdownMenuComponent = DropdownMenu }) {
|
|
4155
|
-
const { dropdownVisible, setDropdownVisible } = useContext(TooltipWrapperContext);
|
|
4415
|
+
const { dropdownVisible, setDropdownVisible, restoreTriggerFocus } = useContext(TooltipWrapperContext);
|
|
4416
|
+
const menuHost = useDependency(IContextMenuHostService);
|
|
4417
|
+
const openRevisionRef = useRef(menuHost.revision);
|
|
4156
4418
|
const shortcutService = useDependency(IShortcutService);
|
|
4157
4419
|
const contextService = useDependency(IContextService);
|
|
4158
4420
|
const instanceService = useDependency(IUniverInstanceService);
|
|
@@ -4226,6 +4488,8 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
4226
4488
|
function handleVisibleChange(visible) {
|
|
4227
4489
|
if (visible) {
|
|
4228
4490
|
var _workbook$getActiveSh;
|
|
4491
|
+
if (menuHost.suspended) return;
|
|
4492
|
+
openRevisionRef.current = menuHost.revision;
|
|
4229
4493
|
const element = document.activeElement;
|
|
4230
4494
|
const workbook = contextService.getContextValue(FOCUSING_SHEET) ? instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET) : null;
|
|
4231
4495
|
const sheetId = workbook === null || workbook === void 0 || (_workbook$getActiveSh = workbook.getActiveSheet()) === null || _workbook$getActiveSh === void 0 ? void 0 : _workbook$getActiveSh.getSheetId();
|
|
@@ -4246,6 +4510,10 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
4246
4510
|
function handleCloseAutoFocus(event) {
|
|
4247
4511
|
const editorFocus = editorFocusRef.current;
|
|
4248
4512
|
editorFocusRef.current = null;
|
|
4513
|
+
if (openRevisionRef.current !== menuHost.revision || menuHost.suspended) {
|
|
4514
|
+
event.preventDefault();
|
|
4515
|
+
return;
|
|
4516
|
+
}
|
|
4249
4517
|
if (sheetTargetRef.current && !sheetTargetRef.current.valid) {
|
|
4250
4518
|
event.preventDefault();
|
|
4251
4519
|
const activeElement = document.activeElement;
|
|
@@ -4253,6 +4521,10 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
4253
4521
|
if (activeElement === document.body || focusInClosingMenu) layoutService.focus();
|
|
4254
4522
|
return;
|
|
4255
4523
|
}
|
|
4524
|
+
if (!editorFocus) {
|
|
4525
|
+
restoreTriggerFocus(event);
|
|
4526
|
+
return;
|
|
4527
|
+
}
|
|
4256
4528
|
if (!(editorFocus === null || editorFocus === void 0 ? void 0 : editorFocus.element.isConnected) || getEmbedBoundaryOwner(editorFocus.element) !== editorFocus.owner) return;
|
|
4257
4529
|
const activeElement = editorFocus.element.ownerDocument.activeElement;
|
|
4258
4530
|
const focusInClosingMenu = event.target instanceof HTMLElement && event.target.contains(activeElement);
|
|
@@ -4420,17 +4692,16 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
4420
4692
|
}
|
|
4421
4693
|
}
|
|
4422
4694
|
|
|
4423
|
-
|
|
4424
|
-
//#region src/views/components/ribbon/ToolbarItem.tsx
|
|
4695
|
+
// src/views/components/ribbon/ToolbarItem.tsx
|
|
4425
4696
|
const toolbarDisabledClassName = "univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:!univer-text-gray-600";
|
|
4426
|
-
const toolbarButtonSelectorRootVariants = cva("univer-toolbar-button-selector-root univer-animate-in univer-fade-in univer-group univer-relative univer-flex univer-h-
|
|
4697
|
+
const toolbarButtonSelectorRootVariants = cva("univer-toolbar-button-selector-root univer-animate-in univer-fade-in univer-group univer-relative univer-flex univer-h-7 univer-cursor-pointer univer-items-center univer-rounded univer-pr-6 univer-text-sm univer-transition-colors hover:univer-bg-gray-100 rtl:univer-pl-6 rtl:univer-pr-0 dark:hover:!univer-bg-gray-700", {
|
|
4427
4698
|
variants: { disabled: {
|
|
4428
4699
|
true: toolbarDisabledClassName,
|
|
4429
4700
|
false: "univer-text-gray-900 dark:!univer-text-gray-0"
|
|
4430
4701
|
} },
|
|
4431
4702
|
defaultVariants: { disabled: false }
|
|
4432
4703
|
});
|
|
4433
|
-
const toolbarButtonSelectorMainVariants = cva("univer-toolbar-button-selector-main univer-relative univer-z-[1] univer-flex univer-h-full univer-items-center univer-rounded-l univer-px-1 univer-transition-colors hover:univer-bg-gray-200 rtl:univer-rounded-l-none rtl:univer-rounded-r dark:hover:!univer-bg-gray-600", {
|
|
4704
|
+
const toolbarButtonSelectorMainVariants = cva("univer-toolbar-button-selector-main univer-relative univer-z-[1] univer-flex univer-h-full univer-min-w-7 univer-items-center univer-justify-center univer-rounded-l univer-px-1 univer-transition-colors hover:univer-bg-gray-200 rtl:univer-rounded-l-none rtl:univer-rounded-r dark:hover:!univer-bg-gray-600", {
|
|
4434
4705
|
variants: {
|
|
4435
4706
|
active: {
|
|
4436
4707
|
true: "univer-bg-gray-200 dark:!univer-bg-gray-500",
|
|
@@ -4451,7 +4722,7 @@ const toolbarButtonSelectorMainVariants = cva("univer-toolbar-button-selector-ma
|
|
|
4451
4722
|
disabled: false
|
|
4452
4723
|
}
|
|
4453
4724
|
});
|
|
4454
|
-
const toolbarButtonSelectorTriggerVariants = cva("univer-toolbar-button-selector-trigger univer-absolute univer-right-0 univer-top-0 univer-box-border univer-flex univer-h-
|
|
4725
|
+
const toolbarButtonSelectorTriggerVariants = cva("univer-toolbar-button-selector-trigger univer-absolute univer-right-0 univer-top-0 univer-box-border univer-flex univer-h-7 univer-w-6 univer-items-center univer-justify-center univer-rounded-r univer-transition-colors hover:univer-bg-gray-200 rtl:univer-left-0 rtl:univer-right-auto rtl:univer-rounded-l rtl:univer-rounded-r-none dark:hover:!univer-bg-gray-600", {
|
|
4455
4726
|
variants: {
|
|
4456
4727
|
disabled: {
|
|
4457
4728
|
true: toolbarDisabledClassName,
|
|
@@ -4472,7 +4743,7 @@ const toolbarButtonSelectorTriggerVariants = cva("univer-toolbar-button-selector
|
|
|
4472
4743
|
active: false
|
|
4473
4744
|
}
|
|
4474
4745
|
});
|
|
4475
|
-
const toolbarSelectorRootVariants = cva("univer-toolbar-selector-root univer-animate-in univer-fade-in univer-relative univer-flex univer-h-
|
|
4746
|
+
const toolbarSelectorRootVariants = cva("univer-toolbar-selector-root univer-animate-in univer-fade-in univer-relative univer-flex univer-h-7 univer-cursor-pointer univer-items-center univer-gap-1 univer-whitespace-nowrap univer-rounded univer-px-1 univer-transition-colors focus-within:univer-ring-2 focus-within:univer-ring-inset focus-within:univer-ring-primary-600 hover:univer-bg-gray-100 focus-visible:univer-outline-none focus-visible:univer-ring-2 focus-visible:univer-ring-inset focus-visible:univer-ring-primary-600 dark:hover:!univer-bg-gray-700", {
|
|
4476
4747
|
variants: {
|
|
4477
4748
|
disabled: {
|
|
4478
4749
|
true: toolbarDisabledClassName,
|
|
@@ -4547,6 +4818,7 @@ const ToolbarItem = forwardRef((props, ref) => {
|
|
|
4547
4818
|
const sId = selectionsCommandId ?? commandId ?? id;
|
|
4548
4819
|
const customLabelName = typeof label === "string" ? label : (label === null || label === void 0 ? void 0 : label.name) ?? "";
|
|
4549
4820
|
const hasCustomLabel = Boolean(componentManager.get(customLabelName));
|
|
4821
|
+
const SelectorTrigger = hasCustomLabel ? ToolbarDropdownButton : "div";
|
|
4550
4822
|
let titleToDisplay = grid ? showLabel ? gridLabel : large ? void 0 : title : title;
|
|
4551
4823
|
if (overflow) titleToDisplay = hasCustomLabel || iconToDisplay && !showLabel ? void 0 : gridLabel;
|
|
4552
4824
|
const selectorAriaLabel = tooltip ? localeService.t(tooltip) : typeof title === "string" ? localeService.t(title) : void 0;
|
|
@@ -4659,12 +4931,15 @@ const ToolbarItem = forwardRef((props, ref) => {
|
|
|
4659
4931
|
}), /* @__PURE__ */ jsxs("div", {
|
|
4660
4932
|
className: clsx(toolbarSelectorTriggerVariants({ disabled }), "univer-h-4 univer-justify-center univer-gap-0.5"),
|
|
4661
4933
|
children: [/* @__PURE__ */ jsx(CustomLabel, {
|
|
4934
|
+
ariaLabel: selectorAriaLabel,
|
|
4662
4935
|
title: titleToDisplay,
|
|
4663
4936
|
value,
|
|
4664
4937
|
label,
|
|
4665
4938
|
onChange: handleSelectionsValueChange
|
|
4666
4939
|
}), /* @__PURE__ */ jsx(MoreDownIcon, { preserveStrokeWidth })]
|
|
4667
4940
|
})] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(CustomLabel, {
|
|
4941
|
+
ariaLabel: selectorAriaLabel,
|
|
4942
|
+
className: fullWidth && hasCustomLabel ? "!univer-w-auto univer-min-w-0 univer-flex-1" : void 0,
|
|
4668
4943
|
icon: iconToDisplay,
|
|
4669
4944
|
iconSize,
|
|
4670
4945
|
preserveStrokeWidth,
|
|
@@ -4672,8 +4947,11 @@ const ToolbarItem = forwardRef((props, ref) => {
|
|
|
4672
4947
|
value,
|
|
4673
4948
|
label,
|
|
4674
4949
|
onChange: handleSelectionsValueChange
|
|
4675
|
-
}), /* @__PURE__ */ jsx(
|
|
4676
|
-
|
|
4950
|
+
}), /* @__PURE__ */ jsx(SelectorTrigger, {
|
|
4951
|
+
disabled: hasCustomLabel ? disabled : void 0,
|
|
4952
|
+
"aria-label": hasCustomLabel ? selectorAriaLabel : void 0,
|
|
4953
|
+
"aria-haspopup": hasCustomLabel ? slot ? "dialog" : "menu" : void 0,
|
|
4954
|
+
className: clsx(toolbarSelectorTriggerVariants({ disabled }), { "univer-ml-auto rtl:univer-ml-0 rtl:univer-mr-auto": grid && !large && !icon }, "univer-w-6 univer-shrink-0 univer-justify-center", hasCustomLabel && "univer-h-7 univer-cursor-pointer univer-rounded univer-border-0 univer-bg-transparent univer-p-0 univer-text-inherit focus-visible:univer-outline-none focus-visible:univer-ring-2 focus-visible:univer-ring-inset focus-visible:univer-ring-primary-600"),
|
|
4677
4955
|
children: /* @__PURE__ */ jsx(MoreDownIcon, { preserveStrokeWidth })
|
|
4678
4956
|
})] })
|
|
4679
4957
|
})
|
|
@@ -4682,7 +4960,7 @@ const ToolbarItem = forwardRef((props, ref) => {
|
|
|
4682
4960
|
function renderButtonType() {
|
|
4683
4961
|
const isCustomComponent = componentManager.get(typeof label === "string" ? label : (label === null || label === void 0 ? void 0 : label.name) ?? "");
|
|
4684
4962
|
const buttonAriaLabel = tooltip ? localeService.t(tooltip) : typeof title === "string" ? localeService.t(title) : void 0;
|
|
4685
|
-
const buttonClassName = clsx(grid && !large && "[&>svg]:univer-size-4", grid && large ? "univer-h-full univer-min-w-14 univer-flex-col univer-gap-1 univer-px-1.5 univer-py-1 univer-text-xs [&>svg]:univer-size-6" : showLabel ? "univer-gap-1 univer-px-1.5 univer-text-sm" : "univer-text-sm", grid && fullWidth && isCustomComponent && "!univer-px-0", overflow && "!univer-h-auto univer-min-h-7 univer-w-full univer-justify-start univer-gap-1.5 univer-whitespace-normal univer-px-1.5 univer-py-1 univer-text-start univer-text-xs focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600");
|
|
4963
|
+
const buttonClassName = clsx(grid && !large && "univer-min-w-7 [&>svg]:univer-size-4", grid && large ? "univer-h-full univer-min-w-14 univer-flex-col univer-gap-1 univer-px-1.5 univer-py-1 univer-text-xs [&>svg]:univer-size-6" : showLabel ? "univer-gap-1 univer-px-1.5 univer-text-sm" : "univer-text-sm", grid && fullWidth && isCustomComponent && "!univer-px-0", overflow && "!univer-h-auto univer-min-h-7 univer-w-full univer-justify-start univer-gap-1.5 univer-whitespace-normal univer-px-1.5 univer-py-1 univer-text-start univer-text-xs focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600");
|
|
4686
4964
|
const buttonStyle = grid && large ? {
|
|
4687
4965
|
textAlign: "center",
|
|
4688
4966
|
whiteSpace: "normal"
|
|
@@ -4747,8 +5025,7 @@ const ToolbarItem = forwardRef((props, ref) => {
|
|
|
4747
5025
|
});
|
|
4748
5026
|
});
|
|
4749
5027
|
|
|
4750
|
-
|
|
4751
|
-
//#region src/views/components/ribbon/RibbonOverflow.tsx
|
|
5028
|
+
// src/views/components/ribbon/RibbonOverflow.tsx
|
|
4752
5029
|
/**
|
|
4753
5030
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
4754
5031
|
*
|
|
@@ -4766,38 +5043,20 @@ const ToolbarItem = forwardRef((props, ref) => {
|
|
|
4766
5043
|
*/
|
|
4767
5044
|
function RibbonOverflow({ groups, grid = false }) {
|
|
4768
5045
|
const localeService = useDependency(LocaleService);
|
|
4769
|
-
const dialogService = useDependency(IDialogService);
|
|
4770
|
-
const sidebarService = useDependency(ISidebarService);
|
|
4771
5046
|
const { direction } = useContext(ConfigContext);
|
|
4772
5047
|
const [openedGroups, setOpenedGroups] = useState(null);
|
|
4773
5048
|
const open = openedGroups === groups;
|
|
4774
5049
|
const keyboardRef = useRef(false);
|
|
4775
5050
|
const restoreFocusRef = useRef(true);
|
|
4776
5051
|
const label = localeService.t("ui.ribbon.more");
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
setOpenedGroups(null);
|
|
4782
|
-
};
|
|
4783
|
-
const sidebar = sidebarService.sidebarOptions$.subscribe((options) => {
|
|
4784
|
-
if (options.visible) closeForPanel();
|
|
4785
|
-
});
|
|
4786
|
-
const dialogs = dialogService.getDialogs$().subscribe((options) => {
|
|
4787
|
-
if (options.some((dialog) => dialog.open)) closeForPanel();
|
|
4788
|
-
});
|
|
4789
|
-
return () => {
|
|
4790
|
-
sidebar.unsubscribe();
|
|
4791
|
-
dialogs.unsubscribe();
|
|
4792
|
-
};
|
|
4793
|
-
}, [
|
|
4794
|
-
open,
|
|
4795
|
-
dialogService,
|
|
4796
|
-
sidebarService
|
|
4797
|
-
]);
|
|
5052
|
+
const menuHost = useMenuHost(() => {
|
|
5053
|
+
restoreFocusRef.current = false;
|
|
5054
|
+
setOpenedGroups(null);
|
|
5055
|
+
});
|
|
4798
5056
|
return /* @__PURE__ */ jsx(Dropdown, {
|
|
4799
5057
|
open,
|
|
4800
5058
|
onOpenChange: (visible) => {
|
|
5059
|
+
if (visible && menuHost.suspended) return;
|
|
4801
5060
|
if (visible) restoreFocusRef.current = true;
|
|
4802
5061
|
setOpenedGroups(visible ? groups : null);
|
|
4803
5062
|
},
|
|
@@ -4825,21 +5084,24 @@ function RibbonOverflow({ groups, grid = false }) {
|
|
|
4825
5084
|
children: localeService.t(group.title)
|
|
4826
5085
|
}), /* @__PURE__ */ jsx("div", {
|
|
4827
5086
|
className: "univer-flex univer-flex-wrap univer-items-center univer-gap-1",
|
|
4828
|
-
children: (group.children ?? [group]).map((
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
5087
|
+
children: (grid ? groupRibbonOverflowItems(group.children ?? [group]) : [group.children ?? [group]]).filter((items) => items.length > 0).map((items) => /* @__PURE__ */ jsx("div", {
|
|
5088
|
+
className: "univer-flex univer-max-w-full univer-flex-wrap univer-items-center univer-gap-1",
|
|
5089
|
+
children: items.map((child) => {
|
|
5090
|
+
var _child$gridLayout, _child$gridLayout2, _child$gridLayout3;
|
|
5091
|
+
return child.item && /* @__PURE__ */ jsx("div", {
|
|
5092
|
+
className: "univer-min-w-0 univer-max-w-full [&>span]:univer-block [&>span]:univer-h-full",
|
|
5093
|
+
style: { maxWidth: child.item.label && !child.item.icon ? ((_child$gridLayout = child.gridLayout) === null || _child$gridLayout === void 0 ? void 0 : _child$gridLayout.minWidth) ?? ((_child$gridLayout2 = child.gridLayout) === null || _child$gridLayout2 === void 0 ? void 0 : _child$gridLayout2.width) : void 0 },
|
|
5094
|
+
children: /* @__PURE__ */ jsx(ToolbarItem, {
|
|
5095
|
+
...child.item,
|
|
5096
|
+
grid: true,
|
|
5097
|
+
showLabel: (_child$gridLayout3 = child.gridLayout) === null || _child$gridLayout3 === void 0 ? void 0 : _child$gridLayout3.showLabel,
|
|
5098
|
+
fullWidth: true,
|
|
5099
|
+
overflow: true,
|
|
5100
|
+
preserveStrokeWidth: true
|
|
5101
|
+
})
|
|
5102
|
+
}, child.key);
|
|
5103
|
+
})
|
|
5104
|
+
}, items[0].key))
|
|
4843
5105
|
})]
|
|
4844
5106
|
}, group.key))
|
|
4845
5107
|
}) }),
|
|
@@ -4867,8 +5129,7 @@ function RibbonOverflow({ groups, grid = false }) {
|
|
|
4867
5129
|
});
|
|
4868
5130
|
}
|
|
4869
5131
|
|
|
4870
|
-
|
|
4871
|
-
//#region src/views/components/ribbon/RibbonGrid.tsx
|
|
5132
|
+
// src/views/components/ribbon/RibbonGrid.tsx
|
|
4872
5133
|
function RibbonGrid({ groups, title, className, ...props }) {
|
|
4873
5134
|
const localeService = useDependency(LocaleService);
|
|
4874
5135
|
const containerRef = useRef(null);
|
|
@@ -4879,14 +5140,22 @@ function RibbonGrid({ groups, title, className, ...props }) {
|
|
|
4879
5140
|
const container = containerRef.current;
|
|
4880
5141
|
if (!container) return;
|
|
4881
5142
|
const measure = () => {
|
|
4882
|
-
var _moreRef$current;
|
|
4883
5143
|
const style = getComputedStyle(container);
|
|
4884
|
-
const availableWidth =
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
5144
|
+
const availableWidth = Number.parseFloat(style.width) - [
|
|
5145
|
+
style.paddingLeft,
|
|
5146
|
+
style.paddingRight,
|
|
5147
|
+
style.borderLeftWidth,
|
|
5148
|
+
style.borderRightWidth
|
|
5149
|
+
].reduce((sum, width) => sum + Number.parseFloat(width || "0"), 0);
|
|
5150
|
+
const getWidth = (element) => element ? Number.parseFloat(getComputedStyle(element).width) || 0 : 0;
|
|
5151
|
+
const getWidths = () => groups.map((group) => getWidth(groupsRef.current.get(group.key)));
|
|
5152
|
+
container.style.setProperty("--ribbon-grid-density", "0");
|
|
5153
|
+
let widths = getWidths();
|
|
5154
|
+
if (widths.reduce((sum, width) => sum + width, 0) > availableWidth) {
|
|
5155
|
+
container.style.setProperty("--ribbon-grid-density", "1");
|
|
5156
|
+
widths = getWidths();
|
|
5157
|
+
}
|
|
5158
|
+
const limit = widths.reduce((sum, width) => sum + width, 0) <= availableWidth ? availableWidth : availableWidth - getWidth(moreRef.current);
|
|
4890
5159
|
let used = 0;
|
|
4891
5160
|
let count = 0;
|
|
4892
5161
|
for (const width of widths) {
|
|
@@ -4896,6 +5165,7 @@ function RibbonGrid({ groups, title, className, ...props }) {
|
|
|
4896
5165
|
}
|
|
4897
5166
|
setVisibleGroupCount(count);
|
|
4898
5167
|
};
|
|
5168
|
+
measure();
|
|
4899
5169
|
const observer = new ResizeObserver(measure);
|
|
4900
5170
|
observer.observe(container);
|
|
4901
5171
|
groupsRef.current.forEach((element) => observer.observe(element));
|
|
@@ -4923,16 +5193,18 @@ function RibbonGrid({ groups, title, className, ...props }) {
|
|
|
4923
5193
|
"data-u-comp": "ribbon-grid-group",
|
|
4924
5194
|
"data-group-key": group.key,
|
|
4925
5195
|
"aria-hidden": index >= visibleGroupCount || void 0,
|
|
5196
|
+
style: { paddingInline: "calc(8px - 2px * var(--ribbon-grid-density, 0))" },
|
|
4926
5197
|
className: clsx("univer-relative univer-box-border univer-flex univer-w-max univer-shrink-0 univer-flex-col univer-px-2", index >= visibleGroupCount && "univer-pointer-events-none univer-invisible univer-absolute"),
|
|
4927
5198
|
children: [/* @__PURE__ */ jsx("div", {
|
|
4928
5199
|
"data-testid": "ribbon-grid-group-grid",
|
|
4929
|
-
className: "univer-grid univer-min-h-0 univer-flex-1 univer-grid-flow-col univer-grid-rows-[repeat(2,1.
|
|
5200
|
+
className: "univer-grid univer-min-h-0 univer-flex-1 univer-grid-flow-col univer-grid-rows-[repeat(2,1.75rem)] univer-content-center univer-gap-y-0 univer-py-2 [&>div>span>span]:univer-h-full",
|
|
5201
|
+
style: { columnGap: "calc(8px - 4px * var(--ribbon-grid-density, 0))" },
|
|
4930
5202
|
children: placements.map((placement) => placement.item.item && /* @__PURE__ */ jsx("div", {
|
|
4931
5203
|
className: clsx("univer-flex univer-items-stretch [&>span>button]:univer-h-full [&>span]:univer-h-full", placement.width && "[&>span>span]:univer-w-full [&>span]:univer-w-full [&_[data-u-command]]:univer-w-full"),
|
|
4932
5204
|
style: {
|
|
4933
5205
|
gridRow: `${placement.row} / span ${placement.rowSpan}`,
|
|
4934
5206
|
gridColumn: `${placement.column} / span ${placement.columnSpan}`,
|
|
4935
|
-
width: placement.width
|
|
5207
|
+
width: placement.minWidth === void 0 ? placement.width : `calc(${placement.width}px - ${placement.width - placement.minWidth}px * var(--ribbon-grid-density, 0))`
|
|
4936
5208
|
},
|
|
4937
5209
|
children: /* @__PURE__ */ jsx(ToolbarItem, {
|
|
4938
5210
|
...placement.item.item,
|
|
@@ -4963,8 +5235,7 @@ function RibbonGrid({ groups, title, className, ...props }) {
|
|
|
4963
5235
|
});
|
|
4964
5236
|
}
|
|
4965
5237
|
|
|
4966
|
-
|
|
4967
|
-
//#region src/views/components/ribbon/Ribbon.tsx
|
|
5238
|
+
// src/views/components/ribbon/Ribbon.tsx
|
|
4968
5239
|
function Ribbon(props) {
|
|
4969
5240
|
const { ribbonType, headerMenuComponents, headerMenu = true, toolbarOnly = false, headerClassName } = props;
|
|
4970
5241
|
const defaultRibbonService = useDependency(IRibbonService);
|
|
@@ -5063,7 +5334,7 @@ function Ribbon(props) {
|
|
|
5063
5334
|
const fakeToolbar = useMemo(() => {
|
|
5064
5335
|
return /* @__PURE__ */ jsx("div", {
|
|
5065
5336
|
"aria-hidden": "true",
|
|
5066
|
-
className: clsx("univer-invisible univer-absolute -univer-left-[99999] -univer-top-[99999] univer-box-border univer-flex univer-h-10 univer-min-w-min univer-items-center univer-px-3 univer-opacity-0", { "univer-hidden": !fakeToolbarVisible }, divideXClassName, borderBottomClassName),
|
|
5337
|
+
className: clsx("univer-invisible univer-absolute -univer-left-[99999] -univer-top-[99999] univer-box-border univer-flex univer-h-10 univer-min-w-min univer-items-center univer-px-3 univer-opacity-0 rtl:univer-divide-x-reverse", { "univer-hidden": !fakeToolbarVisible }, divideXClassName, borderBottomClassName),
|
|
5067
5338
|
children: activeGroup.allGroups.map((groupItem, index) => {
|
|
5068
5339
|
var _groupItem$children, _groupItem$children2;
|
|
5069
5340
|
return (((_groupItem$children = groupItem.children) === null || _groupItem$children === void 0 ? void 0 : _groupItem$children.length) || groupItem.item) && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", {
|
|
@@ -5163,7 +5434,7 @@ function Ribbon(props) {
|
|
|
5163
5434
|
}), /* @__PURE__ */ jsx("div", {
|
|
5164
5435
|
"data-u-comp": "ribbon-toolbar",
|
|
5165
5436
|
ref: containerRef,
|
|
5166
|
-
className: clsx("univer-flex univer-overflow-hidden", divideXClassName, { "univer-justify-center": ribbonType === "classic" }),
|
|
5437
|
+
className: clsx("univer-flex univer-overflow-hidden rtl:univer-divide-x-reverse", divideXClassName, { "univer-justify-center": ribbonType === "classic" }),
|
|
5167
5438
|
role: "toolbar",
|
|
5168
5439
|
"aria-label": localeService.t(activatedTabTitle),
|
|
5169
5440
|
children: /* @__PURE__ */ jsxs(ToolbarDropdownProvider, { children: [activeGroup.visibleGroups.map((groupItem) => {
|
|
@@ -5176,7 +5447,7 @@ function Ribbon(props) {
|
|
|
5176
5447
|
}, child.key)))
|
|
5177
5448
|
}) }, groupItem.key);
|
|
5178
5449
|
}), collapsedIds.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
5179
|
-
className: "univer-pl-2 rtl:univer-pr-2",
|
|
5450
|
+
className: "univer-pl-2 rtl:univer-pl-0 rtl:univer-pr-2",
|
|
5180
5451
|
children: /* @__PURE__ */ jsx(RibbonOverflow, { groups: activeGroup.hiddenGroups })
|
|
5181
5452
|
})] }, effectiveActivatedTab)
|
|
5182
5453
|
})]
|
|
@@ -5211,8 +5482,7 @@ function RibbonOverrideConfigProvider(props) {
|
|
|
5211
5482
|
});
|
|
5212
5483
|
}
|
|
5213
5484
|
|
|
5214
|
-
|
|
5215
|
-
//#region src/services/theme-switcher/theme-switcher.service.ts
|
|
5485
|
+
// src/services/theme-switcher/theme-switcher.service.ts
|
|
5216
5486
|
var ThemeSwitcherService = class extends Disposable {
|
|
5217
5487
|
constructor(..._args) {
|
|
5218
5488
|
super(..._args);
|
|
@@ -5245,8 +5515,7 @@ var ThemeSwitcherService = class extends Disposable {
|
|
|
5245
5515
|
}
|
|
5246
5516
|
};
|
|
5247
5517
|
|
|
5248
|
-
|
|
5249
|
-
//#region src/services/contextmenu/contextmenu.service.ts
|
|
5518
|
+
// src/services/contextmenu/contextmenu.service.ts
|
|
5250
5519
|
const IContextMenuService = createIdentifier("ui.contextmenu.service");
|
|
5251
5520
|
var ContextMenuService = class extends Disposable {
|
|
5252
5521
|
constructor(..._args) {
|
|
@@ -5281,94 +5550,7 @@ var ContextMenuService = class extends Disposable {
|
|
|
5281
5550
|
}
|
|
5282
5551
|
};
|
|
5283
5552
|
|
|
5284
|
-
|
|
5285
|
-
//#region src/services/contextmenu/contextmenu-host.service.ts
|
|
5286
|
-
const IContextMenuHostService = createIdentifier("ui.contextmenu.host.service");
|
|
5287
|
-
var ContextMenuHostService = class extends Disposable {
|
|
5288
|
-
constructor(..._args) {
|
|
5289
|
-
super(..._args);
|
|
5290
|
-
_defineProperty(this, "_menuMap", /* @__PURE__ */ new Map());
|
|
5291
|
-
_defineProperty(this, "_activeMenuId$", new BehaviorSubject(null));
|
|
5292
|
-
_defineProperty(this, "activeMenuId$", this._activeMenuId$.asObservable());
|
|
5293
|
-
}
|
|
5294
|
-
get activeMenuId() {
|
|
5295
|
-
return this._activeMenuId$.value;
|
|
5296
|
-
}
|
|
5297
|
-
registerMenu(menuId, hide) {
|
|
5298
|
-
this._menuMap.set(menuId, hide);
|
|
5299
|
-
return toDisposable(() => {
|
|
5300
|
-
this._menuMap.delete(menuId);
|
|
5301
|
-
if (this.activeMenuId === menuId) this._activeMenuId$.next(null);
|
|
5302
|
-
});
|
|
5303
|
-
}
|
|
5304
|
-
activateMenu(menuId) {
|
|
5305
|
-
this.hideActiveMenu(menuId);
|
|
5306
|
-
this._activeMenuId$.next(menuId);
|
|
5307
|
-
}
|
|
5308
|
-
deactivateMenu(menuId) {
|
|
5309
|
-
if (this.activeMenuId === menuId) this._activeMenuId$.next(null);
|
|
5310
|
-
}
|
|
5311
|
-
hideActiveMenu(exceptMenuId) {
|
|
5312
|
-
const activeMenuId = this.activeMenuId;
|
|
5313
|
-
if (!activeMenuId || activeMenuId === exceptMenuId) return;
|
|
5314
|
-
const hide = this._menuMap.get(activeMenuId);
|
|
5315
|
-
this._activeMenuId$.next(null);
|
|
5316
|
-
hide === null || hide === void 0 || hide();
|
|
5317
|
-
}
|
|
5318
|
-
dispose() {
|
|
5319
|
-
this._activeMenuId$.complete();
|
|
5320
|
-
super.dispose();
|
|
5321
|
-
}
|
|
5322
|
-
};
|
|
5323
|
-
|
|
5324
|
-
//#endregion
|
|
5325
|
-
//#region src/views/hooks/prevent-browser-zoom.ts
|
|
5326
|
-
/**
|
|
5327
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5328
|
-
*
|
|
5329
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5330
|
-
* you may not use this file except in compliance with the License.
|
|
5331
|
-
* You may obtain a copy of the License at
|
|
5332
|
-
*
|
|
5333
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5334
|
-
*
|
|
5335
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
5336
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5337
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5338
|
-
* See the License for the specific language governing permissions and
|
|
5339
|
-
* limitations under the License.
|
|
5340
|
-
*/
|
|
5341
|
-
function preventBrowserZoomInContainers(containers) {
|
|
5342
|
-
const uniqueContainers = new Set(containers);
|
|
5343
|
-
const handleWheel = (event) => {
|
|
5344
|
-
if (event.ctrlKey || event.metaKey) event.preventDefault();
|
|
5345
|
-
};
|
|
5346
|
-
const handleGesture = (event) => event.preventDefault();
|
|
5347
|
-
uniqueContainers.forEach((container) => {
|
|
5348
|
-
container.addEventListener("wheel", handleWheel, {
|
|
5349
|
-
capture: true,
|
|
5350
|
-
passive: false
|
|
5351
|
-
});
|
|
5352
|
-
container.addEventListener("gesturestart", handleGesture, {
|
|
5353
|
-
capture: true,
|
|
5354
|
-
passive: false
|
|
5355
|
-
});
|
|
5356
|
-
container.addEventListener("gesturechange", handleGesture, {
|
|
5357
|
-
capture: true,
|
|
5358
|
-
passive: false
|
|
5359
|
-
});
|
|
5360
|
-
});
|
|
5361
|
-
return () => {
|
|
5362
|
-
uniqueContainers.forEach((container) => {
|
|
5363
|
-
container.removeEventListener("wheel", handleWheel, true);
|
|
5364
|
-
container.removeEventListener("gesturestart", handleGesture, true);
|
|
5365
|
-
container.removeEventListener("gesturechange", handleGesture, true);
|
|
5366
|
-
});
|
|
5367
|
-
};
|
|
5368
|
-
}
|
|
5369
|
-
|
|
5370
|
-
//#endregion
|
|
5371
|
-
//#region src/views/menu/desktop/DesignTinyMenuGroup.tsx
|
|
5553
|
+
// src/views/menu/desktop/DesignTinyMenuGroup.tsx
|
|
5372
5554
|
/**
|
|
5373
5555
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5374
5556
|
*
|
|
@@ -5495,8 +5677,7 @@ function DesignTinyMenuGroup({ items, columns, sizeVariant = "default", layoutVa
|
|
|
5495
5677
|
});
|
|
5496
5678
|
}
|
|
5497
5679
|
|
|
5498
|
-
|
|
5499
|
-
//#region src/views/menu/desktop/TinyMenuGroup.tsx
|
|
5680
|
+
// src/views/menu/desktop/TinyMenuGroup.tsx
|
|
5500
5681
|
/**
|
|
5501
5682
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5502
5683
|
*
|
|
@@ -5551,7 +5732,8 @@ function QuickTileMenuItem(props) {
|
|
|
5551
5732
|
const hidden = useObservable(menuItem === null || menuItem === void 0 ? void 0 : menuItem.hidden$, false);
|
|
5552
5733
|
const activated = useObservable(menuItem === null || menuItem === void 0 ? void 0 : menuItem.activated$, false);
|
|
5553
5734
|
if (!menuItem || hidden) return null;
|
|
5554
|
-
const
|
|
5735
|
+
const { icon } = menuItem;
|
|
5736
|
+
const Icon = icon ? iconManager.get(icon) : null;
|
|
5555
5737
|
const active = resolveMenuItemActiveState(menuItem.id, activated, activeItemIds);
|
|
5556
5738
|
return /* @__PURE__ */ jsxs("button", {
|
|
5557
5739
|
type: "button",
|
|
@@ -5602,27 +5784,28 @@ function UITinyMenuGroup(props) {
|
|
|
5602
5784
|
]);
|
|
5603
5785
|
if (!item.children) return null;
|
|
5604
5786
|
const items = visibleChildren.map((child) => {
|
|
5605
|
-
var _child$
|
|
5606
|
-
const
|
|
5787
|
+
var _child$item11, _child$item12, _child$item13;
|
|
5788
|
+
const { icon } = child.item ?? {};
|
|
5789
|
+
const Icon = icon ? iconManager.get(icon) : void 0;
|
|
5607
5790
|
if (!Icon) return null;
|
|
5608
5791
|
return {
|
|
5609
5792
|
key: child.key,
|
|
5610
5793
|
onClick: () => {
|
|
5611
|
-
var _child$item5, _child$item6, _child$item7, _child$item8, _child$item9, _child$item10
|
|
5794
|
+
var _child$item4, _child$item5, _child$item6, _child$item7, _child$item8, _child$item9, _child$item10;
|
|
5612
5795
|
onOptionSelect === null || onOptionSelect === void 0 || onOptionSelect({
|
|
5613
|
-
label: ((_child$
|
|
5614
|
-
commandId: (_child$
|
|
5615
|
-
id: (_child$
|
|
5616
|
-
params: (_child$
|
|
5617
|
-
value: (_child$
|
|
5618
|
-
tooltip: ((_child$
|
|
5796
|
+
label: ((_child$item4 = child.item) === null || _child$item4 === void 0 ? void 0 : _child$item4.id) ?? child.key,
|
|
5797
|
+
commandId: (_child$item5 = child.item) === null || _child$item5 === void 0 ? void 0 : _child$item5.commandId,
|
|
5798
|
+
id: (_child$item6 = child.item) === null || _child$item6 === void 0 ? void 0 : _child$item6.id,
|
|
5799
|
+
params: (_child$item7 = child.item) === null || _child$item7 === void 0 ? void 0 : _child$item7.params,
|
|
5800
|
+
value: (_child$item8 = child.item) === null || _child$item8 === void 0 ? void 0 : _child$item8.value,
|
|
5801
|
+
tooltip: ((_child$item9 = child.item) === null || _child$item9 === void 0 ? void 0 : _child$item9.tooltip) && localeService.t((_child$item10 = child.item) === null || _child$item10 === void 0 ? void 0 : _child$item10.tooltip)
|
|
5619
5802
|
});
|
|
5620
5803
|
},
|
|
5621
5804
|
className: "",
|
|
5622
|
-
iconClassName:
|
|
5805
|
+
iconClassName: icon === "TextTypeIcon" ? sizeVariant === "paragraph-t" ? "!univer-size-4" : "!univer-size-3.5" : void 0,
|
|
5623
5806
|
Icon,
|
|
5624
|
-
active: resolveMenuItemActiveState((_child$
|
|
5625
|
-
tooltip: ((_child$
|
|
5807
|
+
active: resolveMenuItemActiveState((_child$item11 = child.item) === null || _child$item11 === void 0 ? void 0 : _child$item11.id, activeItems.includes(((_child$item12 = child.item) === null || _child$item12 === void 0 ? void 0 : _child$item12.id) ?? ""), activeItemIds),
|
|
5808
|
+
tooltip: ((_child$item13 = child.item) === null || _child$item13 === void 0 ? void 0 : _child$item13.tooltip) ? localeService.t(child.item.tooltip) : void 0
|
|
5626
5809
|
};
|
|
5627
5810
|
}).filter((child) => child != null);
|
|
5628
5811
|
return /* @__PURE__ */ jsx(DesignTinyMenuGroup, {
|
|
@@ -5647,8 +5830,7 @@ function UIQuickTileMenuGroup(props) {
|
|
|
5647
5830
|
});
|
|
5648
5831
|
}
|
|
5649
5832
|
|
|
5650
|
-
|
|
5651
|
-
//#region src/views/components/context-menu/ContextMenuPanel.tsx
|
|
5833
|
+
// src/views/components/context-menu/ContextMenuPanel.tsx
|
|
5652
5834
|
const menuViewportPadding = 8;
|
|
5653
5835
|
const submenuOverlapOffset = 2;
|
|
5654
5836
|
const submenuVisualGap = 20;
|
|
@@ -5746,7 +5928,7 @@ const contextMenuSubmenuPanelVariants = cva("univer-overflow-y-auto univer-overs
|
|
|
5746
5928
|
} },
|
|
5747
5929
|
defaultVariants: { sizeVariant: "default" }
|
|
5748
5930
|
});
|
|
5749
|
-
const contextMenuItemVariants = cva("univer-relative univer-flex univer-border-none univer-bg-transparent univer-text-left univer-text-gray-900 dark:!univer-text-gray-0", {
|
|
5931
|
+
const contextMenuItemVariants = cva("univer-relative univer-flex univer-border-none univer-bg-transparent univer-text-left univer-text-gray-900 rtl:!univer-text-right dark:!univer-text-gray-0", {
|
|
5750
5932
|
variants: {
|
|
5751
5933
|
sizeVariant: {
|
|
5752
5934
|
default: "",
|
|
@@ -5759,7 +5941,11 @@ const contextMenuItemVariants = cva("univer-relative univer-flex univer-border-n
|
|
|
5759
5941
|
},
|
|
5760
5942
|
disabled: {
|
|
5761
5943
|
true: "univer-cursor-not-allowed univer-opacity-60",
|
|
5762
|
-
false: "univer-cursor-pointer focus:univer-
|
|
5944
|
+
false: "univer-cursor-pointer focus:univer-outline-none focus-visible:univer-ring-2 focus-visible:univer-ring-inset focus-visible:univer-ring-primary-500"
|
|
5945
|
+
},
|
|
5946
|
+
submenuOpen: {
|
|
5947
|
+
true: "univer-bg-gray-50 dark:!univer-bg-gray-600",
|
|
5948
|
+
false: ""
|
|
5763
5949
|
},
|
|
5764
5950
|
hoverSuppressed: {
|
|
5765
5951
|
true: "",
|
|
@@ -6049,7 +6235,7 @@ function ContextMenuPanel(props) {
|
|
|
6049
6235
|
if (!focusableButtons.length) return;
|
|
6050
6236
|
event.preventDefault();
|
|
6051
6237
|
event.stopPropagation();
|
|
6052
|
-
const activeIndex = focusableButtons.findIndex((button) => button
|
|
6238
|
+
const activeIndex = focusableButtons.findIndex((button) => button.contains(activeElement ?? null));
|
|
6053
6239
|
if (event.key === "Enter") {
|
|
6054
6240
|
const button = activeIndex >= 0 ? focusableButtons[activeIndex] : getFirstMenuButtonByVisualOrder(focusableButtons);
|
|
6055
6241
|
if (!button) return;
|
|
@@ -6084,7 +6270,7 @@ function ContextMenuPanel(props) {
|
|
|
6084
6270
|
return /* @__PURE__ */ jsx("div", {
|
|
6085
6271
|
ref: setMenuElement,
|
|
6086
6272
|
tabIndex: -1,
|
|
6087
|
-
className: clsx(getContextMenuPanelClassName(sizeVariant), borderClassName, scrollbarClassName, hoverSuppressed && "univer-
|
|
6273
|
+
className: clsx(getContextMenuPanelClassName(sizeVariant), borderClassName, scrollbarClassName, hoverSuppressed && "[&_button:hover:not(:focus)]:!univer-bg-transparent", className),
|
|
6088
6274
|
style: { maxHeight: maxMenuHeight },
|
|
6089
6275
|
onKeyDown: handleKeyDown,
|
|
6090
6276
|
onPointerMove: () => {
|
|
@@ -6114,6 +6300,7 @@ function ContextMenuMenu(props) {
|
|
|
6114
6300
|
const localeService = useDependency(LocaleService);
|
|
6115
6301
|
const hiddenGroupStates = useContextGroupHiddenStates$1(menuSchemas);
|
|
6116
6302
|
const [activeSubmenuKey, setActiveSubmenuKey] = useState(null);
|
|
6303
|
+
const pointerGraceRef = useRef(null);
|
|
6117
6304
|
const visibleSchemas = useMemo(() => {
|
|
6118
6305
|
return menuSchemas.filter((item) => {
|
|
6119
6306
|
if (!hasRenderableContextMenuSchema(item)) return false;
|
|
@@ -6165,6 +6352,7 @@ function ContextMenuMenu(props) {
|
|
|
6165
6352
|
rootMenuElement,
|
|
6166
6353
|
activeSubmenuKey,
|
|
6167
6354
|
setActiveSubmenuKey,
|
|
6355
|
+
pointerGraceRef,
|
|
6168
6356
|
onOptionSelect,
|
|
6169
6357
|
maxMenuHeight,
|
|
6170
6358
|
hiddenItemIds,
|
|
@@ -6186,6 +6374,7 @@ function ContextMenuMenu(props) {
|
|
|
6186
6374
|
rootMenuElement,
|
|
6187
6375
|
activeSubmenuKey,
|
|
6188
6376
|
setActiveSubmenuKey,
|
|
6377
|
+
pointerGraceRef,
|
|
6189
6378
|
activeItemIds,
|
|
6190
6379
|
hiddenItemIds,
|
|
6191
6380
|
hoverSuppressed,
|
|
@@ -6208,6 +6397,7 @@ function ContextMenuMenu(props) {
|
|
|
6208
6397
|
rootMenuElement,
|
|
6209
6398
|
activeSubmenuKey,
|
|
6210
6399
|
setActiveSubmenuKey,
|
|
6400
|
+
pointerGraceRef,
|
|
6211
6401
|
activeItemIds,
|
|
6212
6402
|
hiddenItemIds,
|
|
6213
6403
|
hoverSuppressed,
|
|
@@ -6237,6 +6427,7 @@ function ContextMenuMenu(props) {
|
|
|
6237
6427
|
rootMenuElement,
|
|
6238
6428
|
activeSubmenuKey,
|
|
6239
6429
|
setActiveSubmenuKey,
|
|
6430
|
+
pointerGraceRef,
|
|
6240
6431
|
activeItemIds,
|
|
6241
6432
|
hiddenItemIds,
|
|
6242
6433
|
hoverSuppressed,
|
|
@@ -6252,7 +6443,7 @@ function ContextMenuMenu(props) {
|
|
|
6252
6443
|
}
|
|
6253
6444
|
}
|
|
6254
6445
|
function ContextMenuMenuItem(props) {
|
|
6255
|
-
const { menuKey, menuItem, menuManagerService, menuSessionVersion, submenuPortalContainer, rootMenuElement, maxMenuHeight, activeSubmenuKey, setActiveSubmenuKey, activeItemIds, hiddenItemIds = [], hoverSuppressed = false, compact = false, headerAction = false, sizeVariant, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect } = props;
|
|
6446
|
+
const { menuKey, menuItem, menuManagerService, menuSessionVersion, submenuPortalContainer, rootMenuElement, maxMenuHeight, activeSubmenuKey, setActiveSubmenuKey, pointerGraceRef, activeItemIds, hiddenItemIds = [], hoverSuppressed = false, compact = false, headerAction = false, sizeVariant, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect } = props;
|
|
6256
6447
|
const localeService = useDependency(LocaleService);
|
|
6257
6448
|
const direction = useObservable(localeService.direction$);
|
|
6258
6449
|
const disabled = useObservable(menuItem.disabled$, false);
|
|
@@ -6271,8 +6462,10 @@ function ContextMenuMenuItem(props) {
|
|
|
6271
6462
|
const [keyboardSubmenuFocusRequested, setKeyboardSubmenuFocusRequested] = useState(false);
|
|
6272
6463
|
const menuItemElementRef = useRef(null);
|
|
6273
6464
|
const menuButtonRef = useRef(null);
|
|
6465
|
+
const mouseDownOnInputRef = useRef(false);
|
|
6274
6466
|
const submenuElementRef = useRef(null);
|
|
6275
6467
|
const submenuCloseTimerRef = useRef(null);
|
|
6468
|
+
const pendingHoverActionRef = useRef(null);
|
|
6276
6469
|
const submenuId = useId();
|
|
6277
6470
|
const selections = useMemo(() => {
|
|
6278
6471
|
if (menuItem.type !== 1 && menuItem.type !== 2) return [];
|
|
@@ -6298,10 +6491,14 @@ function ContextMenuMenuItem(props) {
|
|
|
6298
6491
|
const submenuVisible = hasSubmenu && activeSubmenuKey === menuKey;
|
|
6299
6492
|
const selectionsCommandId = selectorItem.selectionsCommandId;
|
|
6300
6493
|
const clearSubmenuCloseTimer = useCallback(() => {
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6494
|
+
var _pointerGraceRef$curr;
|
|
6495
|
+
if (submenuCloseTimerRef.current != null) {
|
|
6496
|
+
clearTimeout(submenuCloseTimerRef.current);
|
|
6497
|
+
submenuCloseTimerRef.current = null;
|
|
6498
|
+
}
|
|
6499
|
+
pendingHoverActionRef.current = null;
|
|
6500
|
+
if (((_pointerGraceRef$curr = pointerGraceRef.current) === null || _pointerGraceRef$curr === void 0 ? void 0 : _pointerGraceRef$curr.menuKey) === menuKey) pointerGraceRef.current = null;
|
|
6501
|
+
}, [menuKey, pointerGraceRef]);
|
|
6305
6502
|
const closeSubmenu = useCallback(() => {
|
|
6306
6503
|
clearSubmenuCloseTimer();
|
|
6307
6504
|
setActiveSubmenuKey((currentKey) => currentKey === menuKey ? null : currentKey);
|
|
@@ -6314,8 +6511,10 @@ function ContextMenuMenuItem(props) {
|
|
|
6314
6511
|
clearSubmenuCloseTimer();
|
|
6315
6512
|
submenuCloseTimerRef.current = setTimeout(() => {
|
|
6316
6513
|
var _submenuElementRef$cu;
|
|
6317
|
-
|
|
6318
|
-
|
|
6514
|
+
const pendingHoverAction = pendingHoverActionRef.current;
|
|
6515
|
+
clearSubmenuCloseTimer();
|
|
6516
|
+
if (pendingHoverAction) pendingHoverAction();
|
|
6517
|
+
else if (!((_submenuElementRef$cu = submenuElementRef.current) === null || _submenuElementRef$cu === void 0 ? void 0 : _submenuElementRef$cu.contains(document.activeElement))) closeSubmenu();
|
|
6319
6518
|
}, 500);
|
|
6320
6519
|
}, [clearSubmenuCloseTimer, closeSubmenu]);
|
|
6321
6520
|
useEffect(() => {
|
|
@@ -6323,8 +6522,12 @@ function ContextMenuMenuItem(props) {
|
|
|
6323
6522
|
}, [value]);
|
|
6324
6523
|
useEffect(() => () => clearSubmenuCloseTimer(), [clearSubmenuCloseTimer]);
|
|
6325
6524
|
useEffect(() => {
|
|
6326
|
-
if (disabled) closeSubmenu();
|
|
6327
|
-
}, [
|
|
6525
|
+
if (disabled || !submenuVisible) closeSubmenu();
|
|
6526
|
+
}, [
|
|
6527
|
+
closeSubmenu,
|
|
6528
|
+
disabled,
|
|
6529
|
+
submenuVisible
|
|
6530
|
+
]);
|
|
6328
6531
|
useEffect(() => {
|
|
6329
6532
|
const submenuElement = submenuElementRef.current;
|
|
6330
6533
|
if (!submenuVisible || !submenuElement) return;
|
|
@@ -6394,11 +6597,27 @@ function ContextMenuMenuItem(props) {
|
|
|
6394
6597
|
clearSubmenuCloseTimer();
|
|
6395
6598
|
setActiveSubmenuKey((currentKey) => currentKey === menuKey ? null : currentKey);
|
|
6396
6599
|
};
|
|
6600
|
+
const onPointerHover = (event) => {
|
|
6601
|
+
if (hoverSuppressed || hasSubmenu && disabled) return;
|
|
6602
|
+
const applyHover = () => {
|
|
6603
|
+
clearSubmenuCloseTimer();
|
|
6604
|
+
setKeyboardSubmenuFocusRequested(false);
|
|
6605
|
+
setActiveSubmenuKey(hasSubmenu ? menuKey : null);
|
|
6606
|
+
};
|
|
6607
|
+
const pointerGrace = pointerGraceRef.current;
|
|
6608
|
+
if (pointerGrace && pointerGrace.menuKey !== menuKey && pointerGrace.contains(event)) {
|
|
6609
|
+
pointerGrace.deferHover(applyHover);
|
|
6610
|
+
return;
|
|
6611
|
+
}
|
|
6612
|
+
pointerGrace === null || pointerGrace === void 0 || pointerGrace.cancel();
|
|
6613
|
+
applyHover();
|
|
6614
|
+
};
|
|
6397
6615
|
const itemClassName = contextMenuItemVariants({
|
|
6398
6616
|
sizeVariant,
|
|
6399
6617
|
variant: compact ? headerAction ? "compactHeaderAction" : "compact" : "default",
|
|
6400
6618
|
disabled,
|
|
6401
|
-
hoverSuppressed,
|
|
6619
|
+
hoverSuppressed: hoverSuppressed || activeSubmenuKey !== null && !submenuVisible,
|
|
6620
|
+
submenuOpen: submenuVisible,
|
|
6402
6621
|
active: resolveMenuItemActiveState(menuItem.id, activated, activeItemIds)
|
|
6403
6622
|
});
|
|
6404
6623
|
const contentNode = /* @__PURE__ */ jsxs("span", {
|
|
@@ -6418,27 +6637,38 @@ function ContextMenuMenuItem(props) {
|
|
|
6418
6637
|
return /* @__PURE__ */ jsxs("div", {
|
|
6419
6638
|
ref: menuItemElementRef,
|
|
6420
6639
|
className: "univer-relative",
|
|
6421
|
-
onMouseEnter:
|
|
6422
|
-
|
|
6423
|
-
if (hasSubmenu && !disabled && !hoverSuppressed) {
|
|
6424
|
-
setKeyboardSubmenuFocusRequested(false);
|
|
6425
|
-
setSubmenuPositionReady(false);
|
|
6426
|
-
setActiveSubmenuKey(menuKey);
|
|
6427
|
-
return;
|
|
6428
|
-
}
|
|
6429
|
-
if (!hasSubmenu && !hoverSuppressed) setActiveSubmenuKey(null);
|
|
6430
|
-
},
|
|
6640
|
+
onMouseEnter: onPointerHover,
|
|
6641
|
+
onMouseMove: onPointerHover,
|
|
6431
6642
|
onMouseLeave: (event) => {
|
|
6432
|
-
if (
|
|
6433
|
-
var _submenuElementRef$cu3, _submenuElementRef$cu4;
|
|
6643
|
+
if (submenuVisible) {
|
|
6644
|
+
var _submenuElementRef$cu3, _submenuElementRef$cu4, _submenuElementRef$cu5;
|
|
6434
6645
|
if ((_submenuElementRef$cu3 = submenuElementRef.current) === null || _submenuElementRef$cu3 === void 0 ? void 0 : _submenuElementRef$cu3.contains(document.activeElement)) return;
|
|
6435
|
-
const nextTarget = event.relatedTarget;
|
|
6646
|
+
const nextTarget = event.relatedTarget instanceof Node ? event.relatedTarget : null;
|
|
6436
6647
|
if (nextTarget && ((_submenuElementRef$cu4 = submenuElementRef.current) === null || _submenuElementRef$cu4 === void 0 ? void 0 : _submenuElementRef$cu4.contains(nextTarget))) return;
|
|
6437
6648
|
if (isContextMenuPointerLeaveTarget(nextTarget, menuItemElementRef.current, rootMenuElement)) {
|
|
6438
6649
|
closeSubmenu();
|
|
6439
6650
|
return;
|
|
6440
6651
|
}
|
|
6441
6652
|
scheduleSubmenuClose();
|
|
6653
|
+
const submenuRect = (_submenuElementRef$cu5 = submenuElementRef.current) === null || _submenuElementRef$cu5 === void 0 || (_submenuElementRef$cu5 = _submenuElementRef$cu5.firstElementChild) === null || _submenuElementRef$cu5 === void 0 ? void 0 : _submenuElementRef$cu5.getBoundingClientRect();
|
|
6654
|
+
if (submenuRect) {
|
|
6655
|
+
const { clientX: originX, clientY: originY } = event;
|
|
6656
|
+
const edgeX = submenuPlacement === "right" ? submenuRect.left : submenuRect.right;
|
|
6657
|
+
pointerGraceRef.current = {
|
|
6658
|
+
menuKey,
|
|
6659
|
+
contains: ({ clientX, clientY }) => {
|
|
6660
|
+
const progress = (clientX - originX) / (edgeX - originX);
|
|
6661
|
+
return progress >= 0 && progress <= 1 && clientY >= originY + (submenuRect.top - originY) * progress && clientY <= originY + (submenuRect.bottom - originY) * progress;
|
|
6662
|
+
},
|
|
6663
|
+
deferHover: (action) => {
|
|
6664
|
+
pendingHoverActionRef.current = action;
|
|
6665
|
+
},
|
|
6666
|
+
cancel: clearSubmenuCloseTimer
|
|
6667
|
+
};
|
|
6668
|
+
}
|
|
6669
|
+
} else {
|
|
6670
|
+
var _pointerGraceRef$curr2;
|
|
6671
|
+
(_pointerGraceRef$curr2 = pointerGraceRef.current) === null || _pointerGraceRef$curr2 === void 0 || _pointerGraceRef$curr2.deferHover(null);
|
|
6442
6672
|
}
|
|
6443
6673
|
},
|
|
6444
6674
|
children: [renderAsContainer ? /* @__PURE__ */ jsxs("div", {
|
|
@@ -6458,29 +6688,35 @@ function ContextMenuMenuItem(props) {
|
|
|
6458
6688
|
"aria-haspopup": hasSubmenu ? "menu" : void 0,
|
|
6459
6689
|
"aria-expanded": hasSubmenu ? submenuVisible : void 0,
|
|
6460
6690
|
"aria-controls": hasSubmenu ? submenuId : void 0,
|
|
6691
|
+
onMouseDownCapture: (event) => {
|
|
6692
|
+
mouseDownOnInputRef.current = event.target instanceof HTMLInputElement;
|
|
6693
|
+
},
|
|
6461
6694
|
onKeyDown: (event) => {
|
|
6695
|
+
var _pointerGraceRef$curr3;
|
|
6462
6696
|
const openDirection = direction === "rtl" ? "ArrowLeft" : "ArrowRight";
|
|
6463
6697
|
if (!hasSubmenu || event.key !== openDirection) return;
|
|
6464
6698
|
event.preventDefault();
|
|
6465
6699
|
event.stopPropagation();
|
|
6700
|
+
(_pointerGraceRef$curr3 = pointerGraceRef.current) === null || _pointerGraceRef$curr3 === void 0 || _pointerGraceRef$curr3.cancel();
|
|
6466
6701
|
clearSubmenuCloseTimer();
|
|
6467
6702
|
setKeyboardSubmenuFocusRequested(true);
|
|
6468
|
-
setSubmenuPositionReady(false);
|
|
6469
6703
|
setActiveSubmenuKey(menuKey);
|
|
6470
6704
|
},
|
|
6471
6705
|
onClick: (event) => {
|
|
6706
|
+
var _pointerGraceRef$curr4;
|
|
6707
|
+
if (event.detail > 0 && mouseDownOnInputRef.current) return;
|
|
6708
|
+
(_pointerGraceRef$curr4 = pointerGraceRef.current) === null || _pointerGraceRef$curr4 === void 0 || _pointerGraceRef$curr4.cancel();
|
|
6472
6709
|
clearSubmenuCloseTimer();
|
|
6473
6710
|
if (hasSubmenu) {
|
|
6474
6711
|
if (headerAction) {
|
|
6475
6712
|
setKeyboardSubmenuFocusRequested(event.detail === 0);
|
|
6476
|
-
setSubmenuPositionReady(false);
|
|
6477
6713
|
setActiveSubmenuKey(menuKey);
|
|
6478
6714
|
return;
|
|
6479
6715
|
}
|
|
6480
6716
|
if (canExecuteItem) {
|
|
6481
6717
|
const item = menuItem;
|
|
6482
6718
|
onOptionSelect === null || onOptionSelect === void 0 || onOptionSelect({
|
|
6483
|
-
commandId: item.commandId,
|
|
6719
|
+
commandId: item.commandId ?? item.id,
|
|
6484
6720
|
params: item.params,
|
|
6485
6721
|
value: inputValue,
|
|
6486
6722
|
id: item.id,
|
|
@@ -6489,14 +6725,13 @@ function ContextMenuMenuItem(props) {
|
|
|
6489
6725
|
return;
|
|
6490
6726
|
}
|
|
6491
6727
|
setKeyboardSubmenuFocusRequested(event.detail === 0);
|
|
6492
|
-
setSubmenuPositionReady(false);
|
|
6493
6728
|
setActiveSubmenuKey(menuKey);
|
|
6494
6729
|
return;
|
|
6495
6730
|
}
|
|
6496
6731
|
if (!canExecuteItem) return;
|
|
6497
6732
|
const item = menuItem;
|
|
6498
6733
|
onOptionSelect === null || onOptionSelect === void 0 || onOptionSelect({
|
|
6499
|
-
commandId: item.commandId,
|
|
6734
|
+
commandId: item.commandId ?? item.id,
|
|
6500
6735
|
params: item.params,
|
|
6501
6736
|
value: inputValue,
|
|
6502
6737
|
id: item.id,
|
|
@@ -6529,9 +6764,9 @@ function ContextMenuMenuItem(props) {
|
|
|
6529
6764
|
onMenuPointerEnter === null || onMenuPointerEnter === void 0 || onMenuPointerEnter();
|
|
6530
6765
|
},
|
|
6531
6766
|
onMouseLeave: (event) => {
|
|
6532
|
-
var _submenuElementRef$
|
|
6533
|
-
if ((_submenuElementRef$
|
|
6534
|
-
const nextTarget = event.relatedTarget;
|
|
6767
|
+
var _submenuElementRef$cu6, _menuItemElementRef$c;
|
|
6768
|
+
if ((_submenuElementRef$cu6 = submenuElementRef.current) === null || _submenuElementRef$cu6 === void 0 ? void 0 : _submenuElementRef$cu6.contains(document.activeElement)) return;
|
|
6769
|
+
const nextTarget = event.relatedTarget instanceof Node ? event.relatedTarget : null;
|
|
6535
6770
|
if (nextTarget && ((_menuItemElementRef$c = menuItemElementRef.current) === null || _menuItemElementRef$c === void 0 ? void 0 : _menuItemElementRef$c.contains(nextTarget))) return;
|
|
6536
6771
|
if (isContextMenuPointerLeaveTarget(nextTarget, menuItemElementRef.current, rootMenuElement)) {
|
|
6537
6772
|
closeSubmenu();
|
|
@@ -6560,7 +6795,7 @@ function ContextMenuMenuItem(props) {
|
|
|
6560
6795
|
const optionSelected = typeof inputValue !== "undefined" && String(inputValue) === String(option.value);
|
|
6561
6796
|
const optionSelectable = !isNonSelectableLabel(option.label);
|
|
6562
6797
|
const optionHoverable = !isNonHoverableLabel(option.label);
|
|
6563
|
-
const optionClassName = clsx("univer-text-gray-900 dark:!univer-text-gray-0", 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" : "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" : "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");
|
|
6798
|
+
const optionClassName = clsx("univer-text-gray-900 dark:!univer-text-gray-0", 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 rtl:!univer-text-right" : "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 rtl:!univer-text-right" : "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");
|
|
6564
6799
|
const optionContentNode = /* @__PURE__ */ jsxs(Fragment$1, { children: [optionSelectable && optionSelected && /* @__PURE__ */ jsx(CheckMarkIcon, { className: clsx("univer-absolute univer-left-0 univer-text-primary-600", sizeVariant === "paragraph-t" ? "univer-size-5" : "univer-size-4") }), /* @__PURE__ */ jsx("span", {
|
|
6565
6800
|
className: clsx(getContextMenuContentClassName(sizeVariant), optionSelectable && optionSelected && "univer-pl-4"),
|
|
6566
6801
|
children: /* @__PURE__ */ jsx(CustomLabel, {
|
|
@@ -6635,8 +6870,22 @@ function useContextGroupHiddenStates$1(menuSchemas) {
|
|
|
6635
6870
|
return useObservable(hiddenStates$, {});
|
|
6636
6871
|
}
|
|
6637
6872
|
|
|
6638
|
-
|
|
6639
|
-
|
|
6873
|
+
// src/views/components/context-menu/AnchoredContextMenu.tsx
|
|
6874
|
+
/**
|
|
6875
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
6876
|
+
*
|
|
6877
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6878
|
+
* you may not use this file except in compliance with the License.
|
|
6879
|
+
* You may obtain a copy of the License at
|
|
6880
|
+
*
|
|
6881
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6882
|
+
*
|
|
6883
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
6884
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6885
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6886
|
+
* See the License for the specific language governing permissions and
|
|
6887
|
+
* limitations under the License.
|
|
6888
|
+
*/
|
|
6640
6889
|
function AnchoredContextMenu(props) {
|
|
6641
6890
|
const { hostId, visible, anchorRect, menuType, anchorVertical = "bottom", autoFocus, menuOffset = 0, menuManagerService, layoutService, onRequestClose, onOptionSelect } = props;
|
|
6642
6891
|
const contentRef = useRef(null);
|
|
@@ -6653,8 +6902,9 @@ function AnchoredContextMenu(props) {
|
|
|
6653
6902
|
visibleRef.current = visible;
|
|
6654
6903
|
menuTypeRef.current = menuType;
|
|
6655
6904
|
useEffect(() => {
|
|
6656
|
-
const disposable = contextMenuHostService.registerMenu(hostId, () => {
|
|
6657
|
-
|
|
6905
|
+
const disposable = contextMenuHostService.registerMenu(hostId, (restoreFocus) => {
|
|
6906
|
+
if (!restoreFocus) focusReturnTargetRef.current = null;
|
|
6907
|
+
if (visibleRef.current) onRequestCloseRef.current();
|
|
6658
6908
|
});
|
|
6659
6909
|
return () => {
|
|
6660
6910
|
disposable.dispose();
|
|
@@ -6665,6 +6915,11 @@ function AnchoredContextMenu(props) {
|
|
|
6665
6915
|
var _contentRef$current3, _contentRef$current4;
|
|
6666
6916
|
if (visible) {
|
|
6667
6917
|
var _contentRef$current, _contentRef$current2, _ownerDocument$defaul;
|
|
6918
|
+
if (contextMenuHostService.suspended) {
|
|
6919
|
+
focusReturnTargetRef.current = null;
|
|
6920
|
+
onRequestCloseRef.current();
|
|
6921
|
+
return;
|
|
6922
|
+
}
|
|
6668
6923
|
const ownerDocument = ((_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.ownerDocument) ?? document;
|
|
6669
6924
|
const activeElement = ownerDocument.activeElement;
|
|
6670
6925
|
const isFocusInMenu = activeElement !== null && (((_contentRef$current2 = contentRef.current) === null || _contentRef$current2 === void 0 ? void 0 : _contentRef$current2.contains(activeElement)) || !!activeElement.closest(`[${"data-u-context-menu-submenu"}]`));
|
|
@@ -6732,7 +6987,7 @@ function AnchoredContextMenu(props) {
|
|
|
6732
6987
|
menuOffset
|
|
6733
6988
|
]);
|
|
6734
6989
|
return /* @__PURE__ */ jsx(Popup, {
|
|
6735
|
-
visible: visible && !!anchorRect,
|
|
6990
|
+
visible: visible && !!anchorRect && !contextMenuHostService.suspended,
|
|
6736
6991
|
offset,
|
|
6737
6992
|
overflowVisible: true,
|
|
6738
6993
|
placementY: anchorVertical === "top" ? "above" : "below",
|
|
@@ -6751,11 +7006,27 @@ function AnchoredContextMenu(props) {
|
|
|
6751
7006
|
});
|
|
6752
7007
|
}
|
|
6753
7008
|
|
|
6754
|
-
|
|
6755
|
-
|
|
7009
|
+
// src/views/components/context-menu/ContextMenu.tsx
|
|
7010
|
+
/**
|
|
7011
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
7012
|
+
*
|
|
7013
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7014
|
+
* you may not use this file except in compliance with the License.
|
|
7015
|
+
* You may obtain a copy of the License at
|
|
7016
|
+
*
|
|
7017
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7018
|
+
*
|
|
7019
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7020
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
7021
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7022
|
+
* See the License for the specific language governing permissions and
|
|
7023
|
+
* limitations under the License.
|
|
7024
|
+
*/
|
|
6756
7025
|
const DESKTOP_CONTEXT_MENU_HOST_ID = "desktop-context-menu";
|
|
6757
7026
|
function DesktopContextMenu() {
|
|
6758
7027
|
const [visible, setVisible] = useState(false);
|
|
7028
|
+
const pendingOpenRef = useRef(null);
|
|
7029
|
+
const menuHost = useDependency(IContextMenuHostService);
|
|
6759
7030
|
const [menuType, setMenuType] = useState("");
|
|
6760
7031
|
const [anchorRect, setAnchorRect] = useState(null);
|
|
6761
7032
|
const [menuContext, setMenuContext] = useState();
|
|
@@ -6778,12 +7049,17 @@ function DesktopContextMenu() {
|
|
|
6778
7049
|
});
|
|
6779
7050
|
return () => {
|
|
6780
7051
|
disposables.dispose();
|
|
7052
|
+
if (pendingOpenRef.current !== null) cancelAnimationFrame(pendingOpenRef.current);
|
|
6781
7053
|
};
|
|
6782
7054
|
}, [contextMenuService]);
|
|
6783
7055
|
/** A function to open context menu with given position and menu type. */
|
|
6784
7056
|
function handleContextMenu(event, menuType, context) {
|
|
6785
|
-
|
|
6786
|
-
|
|
7057
|
+
handleClose();
|
|
7058
|
+
if (menuHost.suspended) return;
|
|
7059
|
+
const revision = menuHost.revision;
|
|
7060
|
+
pendingOpenRef.current = requestAnimationFrame(() => {
|
|
7061
|
+
pendingOpenRef.current = null;
|
|
7062
|
+
if (menuHost.suspended || revision !== menuHost.revision) return;
|
|
6787
7063
|
setMenuType(menuType);
|
|
6788
7064
|
setMenuContext(context);
|
|
6789
7065
|
setAnchorRect({
|
|
@@ -6795,6 +7071,10 @@ function DesktopContextMenu() {
|
|
|
6795
7071
|
});
|
|
6796
7072
|
}
|
|
6797
7073
|
function handleClose() {
|
|
7074
|
+
if (pendingOpenRef.current !== null) {
|
|
7075
|
+
cancelAnimationFrame(pendingOpenRef.current);
|
|
7076
|
+
pendingOpenRef.current = null;
|
|
7077
|
+
}
|
|
6798
7078
|
setVisible(false);
|
|
6799
7079
|
}
|
|
6800
7080
|
const activeScope = runtimeScopeService.get(menuContext === null || menuContext === void 0 ? void 0 : menuContext.unitId);
|
|
@@ -6814,15 +7094,15 @@ function DesktopContextMenu() {
|
|
|
6814
7094
|
const { label: id, commandId, value } = params;
|
|
6815
7095
|
const rawParams = typeof params.params === "function" ? params.params() : params.params;
|
|
6816
7096
|
const commandParams = typeof rawParams === "undefined" ? { value } : rawParams;
|
|
7097
|
+
const revision = menuHost.revision;
|
|
6817
7098
|
if (activeCommandService) activeCommandService.executeCommand(commandId ?? id, commandParams);
|
|
6818
|
-
activeLayoutService.focus();
|
|
7099
|
+
if (revision === menuHost.revision && !menuHost.suspended) activeLayoutService.focus();
|
|
6819
7100
|
handleClose();
|
|
6820
7101
|
}
|
|
6821
7102
|
});
|
|
6822
7103
|
}
|
|
6823
7104
|
|
|
6824
|
-
|
|
6825
|
-
//#region src/views/components/sidebar/Sidebar.tsx
|
|
7105
|
+
// src/views/components/sidebar/Sidebar.tsx
|
|
6826
7106
|
function renderSidebarOptions(options) {
|
|
6827
7107
|
if (!options) return null;
|
|
6828
7108
|
const { children, footer, header, ...rest } = options;
|
|
@@ -6997,7 +7277,7 @@ function Sidebar() {
|
|
|
6997
7277
|
})]
|
|
6998
7278
|
}),
|
|
6999
7279
|
/* @__PURE__ */ jsx("section", {
|
|
7000
|
-
className: "univer-box-border univer-min-w-0 univer-cursor-default univer-px-4",
|
|
7280
|
+
className: "univer-box-border univer-min-w-0 univer-cursor-default univer-px-4 univer-pb-4",
|
|
7001
7281
|
children: options === null || options === void 0 ? void 0 : options.children
|
|
7002
7282
|
}),
|
|
7003
7283
|
(options === null || options === void 0 ? void 0 : options.footer) && /* @__PURE__ */ jsx("footer", {
|
|
@@ -7009,8 +7289,7 @@ function Sidebar() {
|
|
|
7009
7289
|
});
|
|
7010
7290
|
}
|
|
7011
7291
|
|
|
7012
|
-
|
|
7013
|
-
//#region src/views/components/workbench-skeleton/WorkbenchSkeleton.tsx
|
|
7292
|
+
// src/views/components/workbench-skeleton/WorkbenchSkeleton.tsx
|
|
7014
7293
|
function WorkbenchSkeleton({ darkMode, direction, overlay = false }) {
|
|
7015
7294
|
const shimmerClassName = `
|
|
7016
7295
|
univer-animate-pulse univer-bg-gray-100 motion-reduce:univer-animate-none
|
|
@@ -7098,8 +7377,7 @@ function WorkbenchSkeleton({ darkMode, direction, overlay = false }) {
|
|
|
7098
7377
|
});
|
|
7099
7378
|
}
|
|
7100
7379
|
|
|
7101
|
-
|
|
7102
|
-
//#region src/views/hooks/layout.ts
|
|
7380
|
+
// src/views/hooks/layout.ts
|
|
7103
7381
|
/**
|
|
7104
7382
|
* These hooks are used for browser layout
|
|
7105
7383
|
* Prefer to client-side
|
|
@@ -7144,8 +7422,7 @@ function useConfigValue(configKey) {
|
|
|
7144
7422
|
return useObservable(useMemo(() => configService.subscribeConfigValue$(configKey), [configService]), configService.getConfig(configKey));
|
|
7145
7423
|
}
|
|
7146
7424
|
|
|
7147
|
-
|
|
7148
|
-
//#region src/views/hooks/update-effect.ts
|
|
7425
|
+
// src/views/hooks/update-effect.ts
|
|
7149
7426
|
/**
|
|
7150
7427
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
7151
7428
|
*
|
|
@@ -7169,8 +7446,7 @@ const useUpdateEffect = (effect, deps) => {
|
|
|
7169
7446
|
}, deps);
|
|
7170
7447
|
};
|
|
7171
7448
|
|
|
7172
|
-
|
|
7173
|
-
//#region src/views/hooks/use-click-out-side.ts
|
|
7449
|
+
// src/views/hooks/use-click-out-side.ts
|
|
7174
7450
|
function useClickOutSide(ref, opts) {
|
|
7175
7451
|
const handler = useEvent(opts.handler);
|
|
7176
7452
|
useEffect(() => {
|
|
@@ -7184,8 +7460,7 @@ function useClickOutSide(ref, opts) {
|
|
|
7184
7460
|
}, [handler, ref]);
|
|
7185
7461
|
}
|
|
7186
7462
|
|
|
7187
|
-
|
|
7188
|
-
//#region src/views/hooks/use-debounce.ts
|
|
7463
|
+
// src/views/hooks/use-debounce.ts
|
|
7189
7464
|
/**
|
|
7190
7465
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
7191
7466
|
*
|
|
@@ -7211,8 +7486,7 @@ function useDebounceFn(fn, delay = 300) {
|
|
|
7211
7486
|
}, [fn, delay]);
|
|
7212
7487
|
}
|
|
7213
7488
|
|
|
7214
|
-
|
|
7215
|
-
//#region src/views/hooks/virtual-list.ts
|
|
7489
|
+
// src/views/hooks/virtual-list.ts
|
|
7216
7490
|
const isNumber = (value) => typeof value === "number";
|
|
7217
7491
|
function useLatest(value) {
|
|
7218
7492
|
const ref = useRef(value);
|
|
@@ -7342,8 +7616,7 @@ const useVirtualList = (list, options) => {
|
|
|
7342
7616
|
}];
|
|
7343
7617
|
};
|
|
7344
7618
|
|
|
7345
|
-
|
|
7346
|
-
//#region src/views/workbench/Workbench.tsx
|
|
7619
|
+
// src/views/workbench/Workbench.tsx
|
|
7347
7620
|
function DesktopWorkbench(props) {
|
|
7348
7621
|
const uiConfig = useConfigValue(UI_PLUGIN_CONFIG_KEY);
|
|
7349
7622
|
return /* @__PURE__ */ jsx(DesktopWorkbenchContent, {
|
|
@@ -7492,8 +7765,7 @@ function FloatingContainer() {
|
|
|
7492
7765
|
return createPortal(/* @__PURE__ */ jsx(ComponentContainer, { components: floatingComponents }, "floating"), mountContainer);
|
|
7493
7766
|
}
|
|
7494
7767
|
|
|
7495
|
-
|
|
7496
|
-
//#region src/controllers/ui/ui-shared.controller.ts
|
|
7768
|
+
// src/controllers/ui/ui-shared.controller.ts
|
|
7497
7769
|
const STEADY_TIMEOUT = 3e3;
|
|
7498
7770
|
/**
|
|
7499
7771
|
* @ignore
|
|
@@ -7575,8 +7847,7 @@ var SingleUnitUIController = class extends Disposable {
|
|
|
7575
7847
|
}
|
|
7576
7848
|
};
|
|
7577
7849
|
|
|
7578
|
-
|
|
7579
|
-
//#region src/controllers/ui/ui-desktop.controller.ts
|
|
7850
|
+
// src/controllers/ui/ui-desktop.controller.ts
|
|
7580
7851
|
let DesktopUIController = class DesktopUIController extends SingleUnitUIController {
|
|
7581
7852
|
constructor(_config, injector, lifecycleService, renderManagerService, layoutService, instanceService, menuManagerService, uiPartsService) {
|
|
7582
7853
|
super(injector, instanceService, layoutService, lifecycleService, renderManagerService);
|
|
@@ -7630,17 +7901,14 @@ function createContainer$1(id) {
|
|
|
7630
7901
|
return element;
|
|
7631
7902
|
}
|
|
7632
7903
|
|
|
7633
|
-
|
|
7634
|
-
//#region src/controllers/ui/ui.controller.ts
|
|
7904
|
+
// src/controllers/ui/ui.controller.ts
|
|
7635
7905
|
const IUIController = createIdentifier("univer.ui.ui-controller");
|
|
7636
7906
|
|
|
7637
|
-
|
|
7638
|
-
//#region package.json
|
|
7907
|
+
// package.json
|
|
7639
7908
|
var name = "@univerjs/ui";
|
|
7640
|
-
var version = "1.
|
|
7909
|
+
var version = "1.5.0";
|
|
7641
7910
|
|
|
7642
|
-
|
|
7643
|
-
//#region src/views/color-picker/interface.ts
|
|
7911
|
+
// src/views/color-picker/interface.ts
|
|
7644
7912
|
/**
|
|
7645
7913
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
7646
7914
|
*
|
|
@@ -7658,8 +7926,7 @@ var version = "1.3.1";
|
|
|
7658
7926
|
*/
|
|
7659
7927
|
const COLOR_PICKER_COMPONENT = "UI_COLOR_PICKER_COMPONENT";
|
|
7660
7928
|
|
|
7661
|
-
|
|
7662
|
-
//#region src/views/CommonLabel.tsx
|
|
7929
|
+
// src/views/CommonLabel.tsx
|
|
7663
7930
|
/**
|
|
7664
7931
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
7665
7932
|
*
|
|
@@ -7690,8 +7957,7 @@ const CommonLabel = (props) => {
|
|
|
7690
7957
|
};
|
|
7691
7958
|
const COMMON_LABEL_COMPONENT = "UI_PLUGIN_COMMON_LABEL_COMPONENT";
|
|
7692
7959
|
|
|
7693
|
-
|
|
7694
|
-
//#region src/views/emoji-picker/emojis.generated.ts
|
|
7960
|
+
// src/views/emoji-picker/emojis.generated.ts
|
|
7695
7961
|
const emojis = {
|
|
7696
7962
|
"frequent": [
|
|
7697
7963
|
{
|
|
@@ -23111,8 +23377,7 @@ const emojis = {
|
|
|
23111
23377
|
]
|
|
23112
23378
|
};
|
|
23113
23379
|
|
|
23114
|
-
|
|
23115
|
-
//#region src/views/emoji-picker/emoji-picker-utils.ts
|
|
23380
|
+
// src/views/emoji-picker/emoji-picker-utils.ts
|
|
23116
23381
|
const EMOJI_SKIN_TONES = [
|
|
23117
23382
|
"",
|
|
23118
23383
|
"🏻",
|
|
@@ -23277,8 +23542,7 @@ function getEmojiFamilies() {
|
|
|
23277
23542
|
return EMOJI_CATEGORIES.flatMap((category) => emojis[category.key]);
|
|
23278
23543
|
}
|
|
23279
23544
|
|
|
23280
|
-
|
|
23281
|
-
//#region src/views/emoji-picker/EmojiPicker.tsx
|
|
23545
|
+
// src/views/emoji-picker/EmojiPicker.tsx
|
|
23282
23546
|
const EMOJI_PICKER_COMPONENT = "ui.emoji-picker";
|
|
23283
23547
|
const RECENTS_STORAGE_KEY = "univer.ui.recent-emojis";
|
|
23284
23548
|
const SKIN_TONE_STORAGE_KEY = "univer.ui.emoji-skin-tone";
|
|
@@ -23670,8 +23934,7 @@ function CategoryIcon(props) {
|
|
|
23670
23934
|
}
|
|
23671
23935
|
}
|
|
23672
23936
|
|
|
23673
|
-
|
|
23674
|
-
//#region src/views/emoji-picker/MobileEmojiPicker.tsx
|
|
23937
|
+
// src/views/emoji-picker/MobileEmojiPicker.tsx
|
|
23675
23938
|
function MobileEmojiPicker(props) {
|
|
23676
23939
|
return /* @__PURE__ */ jsx(EmojiPicker, {
|
|
23677
23940
|
...props,
|
|
@@ -23679,10 +23942,9 @@ function MobileEmojiPicker(props) {
|
|
|
23679
23942
|
});
|
|
23680
23943
|
}
|
|
23681
23944
|
|
|
23682
|
-
|
|
23683
|
-
//#region src/views/font-family/FontFamily.tsx
|
|
23945
|
+
// src/views/font-family/FontFamily.tsx
|
|
23684
23946
|
const FONT_FAMILY_COMPONENT = "UI_FONT_FAMILY_COMPONENT";
|
|
23685
|
-
const FontFamily = ({ className, disabled: disabledProp, value, disabled$, onChange }) => {
|
|
23947
|
+
const FontFamily = ({ className, disabled: disabledProp, value, disabled$, onChange, ariaLabel }) => {
|
|
23686
23948
|
const disabledObservableValue = useObservable(disabled$);
|
|
23687
23949
|
const disabled = Boolean(disabledProp || disabledObservableValue);
|
|
23688
23950
|
const localeService = useDependency(LocaleService);
|
|
@@ -23742,7 +24004,8 @@ const FontFamily = ({ className, disabled: disabledProp, value, disabled$, onCha
|
|
|
23742
24004
|
className: clsx("univer-w-32 univer-truncate univer-text-sm", className),
|
|
23743
24005
|
style: { fontFamily: value },
|
|
23744
24006
|
children: /* @__PURE__ */ jsx("input", {
|
|
23745
|
-
|
|
24007
|
+
"aria-label": ariaLabel,
|
|
24008
|
+
className: "univer-block univer-h-6 univer-w-full univer-min-w-0 univer-border-none univer-bg-transparent univer-leading-6 univer-text-gray-900 focus:univer-outline-none dark:!univer-text-gray-0 [&_input:focus]:!univer-ring-0 [&_input]:univer-h-6 [&_input]:univer-w-7 [&_input]:univer-border-none [&_input]:!univer-bg-transparent [&_input]:univer-p-0 [&_input]:univer-text-sm",
|
|
23746
24009
|
type: "text",
|
|
23747
24010
|
value: inputValue,
|
|
23748
24011
|
onPointerDown: (event) => event.stopPropagation(),
|
|
@@ -23754,10 +24017,9 @@ const FontFamily = ({ className, disabled: disabledProp, value, disabled$, onCha
|
|
|
23754
24017
|
});
|
|
23755
24018
|
};
|
|
23756
24019
|
|
|
23757
|
-
|
|
23758
|
-
//#region src/views/font-size/FontSize.tsx
|
|
24020
|
+
// src/views/font-size/FontSize.tsx
|
|
23759
24021
|
const FontSize = (props) => {
|
|
23760
|
-
const { value, min, max, onChange, disabled
|
|
24022
|
+
const { value, min, max, onChange, disabled$, ariaLabel } = props;
|
|
23761
24023
|
const disabled = useObservable(disabled$);
|
|
23762
24024
|
const [draft, setDraft] = useState(null);
|
|
23763
24025
|
const inputValue = draft !== null && draft.source === value ? draft.value : Number(value ?? 0);
|
|
@@ -23786,6 +24048,7 @@ const FontSize = (props) => {
|
|
|
23786
24048
|
className: "univer-h-6 univer-w-7 univer-text-sm",
|
|
23787
24049
|
onPointerDown: (event) => event.stopPropagation(),
|
|
23788
24050
|
children: /* @__PURE__ */ jsx(InputNumber, {
|
|
24051
|
+
"aria-label": ariaLabel,
|
|
23789
24052
|
className: "univer-block univer-h-6 univer-border-none univer-bg-transparent univer-leading-6 [&_input:focus]:!univer-ring-0 [&_input]:univer-h-6 [&_input]:univer-w-7 [&_input]:univer-border-none [&_input]:!univer-bg-transparent [&_input]:univer-p-0 [&_input]:univer-text-sm",
|
|
23790
24053
|
value: inputValue,
|
|
23791
24054
|
controls: false,
|
|
@@ -23797,8 +24060,7 @@ const FontSize = (props) => {
|
|
|
23797
24060
|
});
|
|
23798
24061
|
};
|
|
23799
24062
|
|
|
23800
|
-
|
|
23801
|
-
//#region src/views/font-size/interface.ts
|
|
24063
|
+
// src/views/font-size/interface.ts
|
|
23802
24064
|
const FONT_SIZE_LIST = [
|
|
23803
24065
|
{
|
|
23804
24066
|
label: "9",
|
|
@@ -23897,8 +24159,7 @@ const HEADING_LIST = [
|
|
|
23897
24159
|
];
|
|
23898
24160
|
const FONT_SIZE_COMPONENT = "UI_FONT_SIZE_COMPONENT";
|
|
23899
24161
|
|
|
23900
|
-
|
|
23901
|
-
//#region src/views/HeadingItem.tsx
|
|
24162
|
+
// src/views/HeadingItem.tsx
|
|
23902
24163
|
const HeadingItem = (props) => {
|
|
23903
24164
|
var _style$cl;
|
|
23904
24165
|
const { value, text } = props;
|
|
@@ -23915,8 +24176,7 @@ const HeadingItem = (props) => {
|
|
|
23915
24176
|
};
|
|
23916
24177
|
const HEADING_ITEM_COMPONENT = "UI_COMPONENT_HEADING_ITEM";
|
|
23917
24178
|
|
|
23918
|
-
|
|
23919
|
-
//#region src/views/symbol-picker/symbols.ts
|
|
24179
|
+
// src/views/symbol-picker/symbols.ts
|
|
23920
24180
|
const SYMBOL_CATEGORIES = [
|
|
23921
24181
|
{
|
|
23922
24182
|
key: "mathematics",
|
|
@@ -24088,8 +24348,7 @@ const SYMBOL_CATEGORIES = [
|
|
|
24088
24348
|
}
|
|
24089
24349
|
];
|
|
24090
24350
|
|
|
24091
|
-
|
|
24092
|
-
//#region src/views/symbol-picker/SymbolPicker.tsx
|
|
24351
|
+
// src/views/symbol-picker/SymbolPicker.tsx
|
|
24093
24352
|
const SYMBOL_PICKER_COMPONENT = "ui.symbol-picker";
|
|
24094
24353
|
function SymbolPicker(props) {
|
|
24095
24354
|
var _props$popup;
|
|
@@ -24144,8 +24403,7 @@ function SymbolSection(props) {
|
|
|
24144
24403
|
});
|
|
24145
24404
|
}
|
|
24146
24405
|
|
|
24147
|
-
|
|
24148
|
-
//#region src/controllers/mobile/components.controller.ts
|
|
24406
|
+
// src/controllers/mobile/components.controller.ts
|
|
24149
24407
|
/**
|
|
24150
24408
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
24151
24409
|
*
|
|
@@ -24198,8 +24456,7 @@ let MobileComponentsController = class MobileComponentsController extends Dispos
|
|
|
24198
24456
|
};
|
|
24199
24457
|
MobileComponentsController = __decorate([__decorateParam(0, Inject(ComponentManager)), __decorateParam(1, Inject(IconManager))], MobileComponentsController);
|
|
24200
24458
|
|
|
24201
|
-
|
|
24202
|
-
//#region src/menu/mobile-schema.ts
|
|
24459
|
+
// src/menu/mobile-schema.ts
|
|
24203
24460
|
const mobileMenuSchema = { ["ribbon.start.history"]: {
|
|
24204
24461
|
[UndoCommand.id]: {
|
|
24205
24462
|
order: 0,
|
|
@@ -24221,8 +24478,7 @@ const mobileMenuSchema = { ["ribbon.start.history"]: {
|
|
|
24221
24478
|
}
|
|
24222
24479
|
} };
|
|
24223
24480
|
|
|
24224
|
-
|
|
24225
|
-
//#region src/views/components/ribbon/MobileToolbarItem.tsx
|
|
24481
|
+
// src/views/components/ribbon/MobileToolbarItem.tsx
|
|
24226
24482
|
const MobileToolbarItem = forwardRef((props, ref) => /* @__PURE__ */ jsx(ToolbarItem, {
|
|
24227
24483
|
...props,
|
|
24228
24484
|
ref,
|
|
@@ -24233,8 +24489,7 @@ const MobileToolbarItem = forwardRef((props, ref) => /* @__PURE__ */ jsx(Toolbar
|
|
|
24233
24489
|
dropdownMenuComponent: MobileDropdownMenu
|
|
24234
24490
|
}));
|
|
24235
24491
|
|
|
24236
|
-
|
|
24237
|
-
//#region src/views/components/ribbon/MobileRibbon.tsx
|
|
24492
|
+
// src/views/components/ribbon/MobileRibbon.tsx
|
|
24238
24493
|
const toolbarScrollOffset = 168;
|
|
24239
24494
|
function MobileRibbon(props) {
|
|
24240
24495
|
const { headerMenuComponents, headerMenu = true } = props;
|
|
@@ -24434,6 +24689,7 @@ function MobileCompactTopBar(props) {
|
|
|
24434
24689
|
const { headerMenuComponents, headerMenu = true, ribbon } = props;
|
|
24435
24690
|
const [moreOpen, setMoreOpen] = useState(false);
|
|
24436
24691
|
const moreTriggerRef = useRef(null);
|
|
24692
|
+
const menuHost = useMenuHost(() => setMoreOpen(false));
|
|
24437
24693
|
const { mountContainer } = useContext(ConfigContext);
|
|
24438
24694
|
const localeService = useDependency(LocaleService);
|
|
24439
24695
|
const startGroup = ribbon.find((group) => group.key === "ribbon.start");
|
|
@@ -24461,8 +24717,7 @@ function MobileCompactTopBar(props) {
|
|
|
24461
24717
|
right: Math.max(12, viewportWidth - ((triggerRect === null || triggerRect === void 0 ? void 0 : triggerRect.right) ?? viewportWidth))
|
|
24462
24718
|
},
|
|
24463
24719
|
children: moreItems.map((schema) => /* @__PURE__ */ jsx("div", {
|
|
24464
|
-
className: "univer-w-full [&>span]:univer-block [&>span]:univer-w-full [&_button]:!univer-
|
|
24465
|
-
onClick: () => setMoreOpen(false),
|
|
24720
|
+
className: "univer-w-full [&>span]:univer-block [&>span]:univer-w-full [&_button]:!univer-w-full [&_button]:!univer-justify-start [&_button]:!univer-gap-3 [&_button]:!univer-rounded-xl [&_button]:!univer-px-4",
|
|
24466
24721
|
children: /* @__PURE__ */ jsx(MobileToolbarItem, {
|
|
24467
24722
|
...schema.item,
|
|
24468
24723
|
grid: true,
|
|
@@ -24476,7 +24731,7 @@ function MobileCompactTopBar(props) {
|
|
|
24476
24731
|
className: clsx("univer-flex univer-h-12 univer-items-center univer-justify-end univer-gap-1 univer-bg-gray-0 univer-px-3 dark:!univer-bg-gray-800", borderBottomClassName),
|
|
24477
24732
|
children: [
|
|
24478
24733
|
/* @__PURE__ */ jsx("div", {
|
|
24479
|
-
className: "univer-flex univer-items-center univer-gap-1 [&_button]:!univer-min-
|
|
24734
|
+
className: "univer-flex univer-items-center univer-gap-1 [&_button]:!univer-min-w-10 [&_button]:!univer-rounded-lg [&_button_svg]:!univer-size-5",
|
|
24480
24735
|
children: items.map((schema) => /* @__PURE__ */ jsx(MobileToolbarItem, { ...schema.item }, schema.key))
|
|
24481
24736
|
}),
|
|
24482
24737
|
moreItems.length > 0 && /* @__PURE__ */ jsx("button", {
|
|
@@ -24486,7 +24741,9 @@ function MobileCompactTopBar(props) {
|
|
|
24486
24741
|
"aria-label": localeService.t("ui.ribbon.more"),
|
|
24487
24742
|
"aria-expanded": moreOpen,
|
|
24488
24743
|
className: clsx(resetButtonClassName, "univer-flex univer-size-10 univer-items-center univer-justify-center univer-rounded-lg univer-text-gray-700 univer-transition-colors active:univer-bg-gray-100 dark:!univer-text-gray-200 dark:active:!univer-bg-gray-700"),
|
|
24489
|
-
onClick: () =>
|
|
24744
|
+
onClick: () => {
|
|
24745
|
+
if (!menuHost.suspended) setMoreOpen((open) => !open);
|
|
24746
|
+
},
|
|
24490
24747
|
children: /* @__PURE__ */ jsx(MoreHorizontalIcon, {
|
|
24491
24748
|
className: "univer-size-5",
|
|
24492
24749
|
preserveStrokeWidth: true
|
|
@@ -24500,8 +24757,7 @@ function MobileCompactTopBar(props) {
|
|
|
24500
24757
|
}), moreMenu] });
|
|
24501
24758
|
}
|
|
24502
24759
|
|
|
24503
|
-
|
|
24504
|
-
//#region src/views/menu/mobile/MobileMenu.tsx
|
|
24760
|
+
// src/views/menu/mobile/MobileMenu.tsx
|
|
24505
24761
|
function MobileMenu(props) {
|
|
24506
24762
|
var _props$schemas;
|
|
24507
24763
|
const schemaKey = ((_props$schemas = props.schemas) === null || _props$schemas === void 0 ? void 0 : _props$schemas.map((schema) => schema.key).join("|")) ?? "";
|
|
@@ -25073,8 +25329,7 @@ function getLeafItemSchemas(schemas) {
|
|
|
25073
25329
|
}, []);
|
|
25074
25330
|
}
|
|
25075
25331
|
|
|
25076
|
-
|
|
25077
|
-
//#region src/views/mobile-workbench/MobileCanvasLayout.tsx
|
|
25332
|
+
// src/views/mobile-workbench/MobileCanvasLayout.tsx
|
|
25078
25333
|
const MobileCanvasLayoutContext = createContext(null);
|
|
25079
25334
|
function MobileCanvasLayoutProvider({ children }) {
|
|
25080
25335
|
const [panels, setPanels] = useState([]);
|
|
@@ -25247,8 +25502,7 @@ function useMobileCanvasViewport(options) {
|
|
|
25247
25502
|
]);
|
|
25248
25503
|
}
|
|
25249
25504
|
|
|
25250
|
-
|
|
25251
|
-
//#region src/views/components/mobile-drawer/MobileDrawerCoordinator.tsx
|
|
25505
|
+
// src/views/components/mobile-drawer/MobileDrawerCoordinator.tsx
|
|
25252
25506
|
const MobileDrawerCoordinatorContext = createContext(null);
|
|
25253
25507
|
function MobileDrawerCoordinatorProvider(props) {
|
|
25254
25508
|
const entriesRef = useRef([]);
|
|
@@ -25296,14 +25550,14 @@ function MobileDrawerCoordinatorProvider(props) {
|
|
|
25296
25550
|
});
|
|
25297
25551
|
}
|
|
25298
25552
|
|
|
25299
|
-
|
|
25300
|
-
//#region src/views/components/mobile-drawer/MobileDrawer.tsx
|
|
25553
|
+
// src/views/components/mobile-drawer/MobileDrawer.tsx
|
|
25301
25554
|
function assignDrawerRef(ref, element) {
|
|
25302
25555
|
if (typeof ref === "function") ref(element);
|
|
25303
25556
|
else if (ref) ref.current = element;
|
|
25304
25557
|
}
|
|
25305
25558
|
const MOBILE_DRAWER_COMPACT_PERCENT = 40;
|
|
25306
25559
|
const MOBILE_DRAWER_EXPANDED_PERCENT = 80;
|
|
25560
|
+
const MOBILE_DIALOG_MAX_PERCENT = 60;
|
|
25307
25561
|
const MobileDrawerLayoutContext = createContext("modal");
|
|
25308
25562
|
function resolveMobileDrawerRelease(params) {
|
|
25309
25563
|
const { snap, deltaY, durationMs, percent } = params;
|
|
@@ -25315,7 +25569,7 @@ function resolveMobileDrawerRelease(params) {
|
|
|
25315
25569
|
}
|
|
25316
25570
|
function MobileDrawer(props) {
|
|
25317
25571
|
var _globalThis$CSS;
|
|
25318
|
-
const { snap, expandLabel, collapseLabel, onSnapChange, onClose, children, header, floatingActions, componentName = "mobile-drawer", panelRef, contentRef, layerRef, openMode = "replace", panelClassName, contentClassName, footer, role, ariaLabel, layout: requestedLayout } = props;
|
|
25572
|
+
const { snap, expandLabel, collapseLabel, onSnapChange, onClose, children, header, floatingActions, componentName = "mobile-drawer", panelRef, contentRef, layerRef, openMode = "replace", panelClassName, contentClassName, footer, role, ariaLabel, layout: requestedLayout, autoHeight = false } = props;
|
|
25319
25573
|
const coordinator = useContext(MobileDrawerCoordinatorContext);
|
|
25320
25574
|
const registerDrawer = coordinator === null || coordinator === void 0 ? void 0 : coordinator.register;
|
|
25321
25575
|
const unregisterDrawer = coordinator === null || coordinator === void 0 ? void 0 : coordinator.unregister;
|
|
@@ -25358,6 +25612,7 @@ function MobileDrawer(props) {
|
|
|
25358
25612
|
const dragRef = useRef(null);
|
|
25359
25613
|
const drawerPercent = dragPercent ?? (snap === "compact" ? MOBILE_DRAWER_COMPACT_PERCENT : MOBILE_DRAWER_EXPANDED_PERCENT);
|
|
25360
25614
|
const keyboardLayout = useMobileKeyboardViewportLayout(panelElementRef);
|
|
25615
|
+
const contentMaxHeight = keyboardLayout ? `min(${MOBILE_DIALOG_MAX_PERCENT}${viewportHeightUnit}, ${keyboardLayout.availableHeight}px)` : `${MOBILE_DIALOG_MAX_PERCENT}${viewportHeightUnit}`;
|
|
25361
25616
|
useLayoutEffect(() => {
|
|
25362
25617
|
if (!registerDrawer || !unregisterDrawer) return;
|
|
25363
25618
|
registerDrawer(drawerId, openMode, () => onCloseRef.current());
|
|
@@ -25463,15 +25718,17 @@ function MobileDrawer(props) {
|
|
|
25463
25718
|
"aria-label": ariaLabel,
|
|
25464
25719
|
"data-u-comp": componentName,
|
|
25465
25720
|
"data-snap": snap,
|
|
25466
|
-
className: clsx("univer-absolute univer-inset-x-0 univer-bottom-0 univer-z-20 univer-flex univer-flex-col univer-overflow-hidden univer-rounded-t-[24px] univer-bg-gray-50 univer-shadow-2xl univer-transition-[height] univer-duration-200 dark:!univer-bg-gray-900
|
|
25721
|
+
className: clsx("univer-absolute univer-inset-x-0 univer-bottom-0 univer-z-20 univer-flex univer-flex-col univer-overflow-hidden univer-rounded-t-[24px] univer-bg-gray-50 univer-shadow-2xl univer-transition-[height] univer-duration-200 dark:!univer-bg-gray-900", "univer-pointer-events-auto", dragPercent != null && "!univer-transition-none", panelClassName),
|
|
25467
25722
|
style: {
|
|
25468
|
-
height: `${drawerPercent}${viewportHeightUnit}`,
|
|
25723
|
+
height: autoHeight ? "auto" : `${drawerPercent}${viewportHeightUnit}`,
|
|
25724
|
+
maxHeight: autoHeight ? contentMaxHeight : void 0,
|
|
25725
|
+
bottom: autoHeight ? keyboardLayout === null || keyboardLayout === void 0 ? void 0 : keyboardLayout.bottom : void 0,
|
|
25469
25726
|
paddingBottom: "env(safe-area-inset-bottom, 0px)"
|
|
25470
25727
|
},
|
|
25471
25728
|
children: [
|
|
25472
25729
|
/* @__PURE__ */ jsxs("div", {
|
|
25473
|
-
className: "univer-relative univer-flex univer-
|
|
25474
|
-
children: [/* @__PURE__ */ jsx("button", {
|
|
25730
|
+
className: clsx("univer-relative univer-flex univer-shrink-0 univer-items-end univer-bg-gray-0 dark:!univer-bg-gray-800", autoHeight ? "univer-h-12" : "univer-h-14"),
|
|
25731
|
+
children: [!autoHeight && /* @__PURE__ */ jsx("button", {
|
|
25475
25732
|
type: "button",
|
|
25476
25733
|
"aria-label": snap === "compact" ? expandLabel : collapseLabel,
|
|
25477
25734
|
className: clsx(resetButtonClassName, "univer-absolute univer-left-1/2 univer-top-0 univer-z-10 univer-flex univer-h-6 univer-w-16 -univer-translate-x-1/2 univer-touch-none univer-items-center univer-justify-center"),
|
|
@@ -25496,8 +25753,8 @@ function MobileDrawer(props) {
|
|
|
25496
25753
|
}),
|
|
25497
25754
|
/* @__PURE__ */ jsx("div", {
|
|
25498
25755
|
ref: contentRef,
|
|
25499
|
-
className: clsx("univer-
|
|
25500
|
-
style: { paddingBottom: keyboardLayout ? `calc(0.75rem + ${keyboardLayout.bottom}px)` : void 0 },
|
|
25756
|
+
className: clsx("univer-overflow-y-auto univer-overflow-x-hidden univer-p-3", autoHeight ? "univer-min-h-0 univer-flex-initial" : "univer-flex-1", scrollbarClassName, contentClassName),
|
|
25757
|
+
style: { paddingBottom: !autoHeight && keyboardLayout ? `calc(0.75rem + ${keyboardLayout.bottom}px)` : void 0 },
|
|
25501
25758
|
children
|
|
25502
25759
|
}),
|
|
25503
25760
|
footer
|
|
@@ -25507,8 +25764,7 @@ function MobileDrawer(props) {
|
|
|
25507
25764
|
});
|
|
25508
25765
|
}
|
|
25509
25766
|
|
|
25510
|
-
|
|
25511
|
-
//#region src/views/menu/mobile/MobileMenuDrawer.tsx
|
|
25767
|
+
// src/views/menu/mobile/MobileMenuDrawer.tsx
|
|
25512
25768
|
function MobileMenuDrawer(props) {
|
|
25513
25769
|
if (!props.visible) return null;
|
|
25514
25770
|
return /* @__PURE__ */ jsx(MobileMenuDrawerContent, { ...props });
|
|
@@ -25581,8 +25837,7 @@ function MobileMenuDrawerContent(props) {
|
|
|
25581
25837
|
}), mountContainer);
|
|
25582
25838
|
}
|
|
25583
25839
|
|
|
25584
|
-
|
|
25585
|
-
//#region src/views/components/context-menu/MobileContextMenu.tsx
|
|
25840
|
+
// src/views/components/context-menu/MobileContextMenu.tsx
|
|
25586
25841
|
const MOBILE_CONTEXT_MENU_HOST_ID = "mobile-context-menu";
|
|
25587
25842
|
const MOBILE_CONTEXT_MENU_POINTER_SIZE = 8;
|
|
25588
25843
|
const MOBILE_CONTEXT_MENU_POINTER_EDGE_GAP = 12;
|
|
@@ -25619,6 +25874,7 @@ function MobileContextMenu() {
|
|
|
25619
25874
|
const isFloatingContextMenu = shouldUseFloatingMobileContextMenu(menuType, menuContext);
|
|
25620
25875
|
visibleRef.current = visible;
|
|
25621
25876
|
const handleContextMenu = useCallback((event, nextMenuType, context) => {
|
|
25877
|
+
if (contextMenuHostService.suspended) return;
|
|
25622
25878
|
contextMenuHostService.activateMenu(MOBILE_CONTEXT_MENU_HOST_ID);
|
|
25623
25879
|
setMenuType(nextMenuType);
|
|
25624
25880
|
setMenuContext(context);
|
|
@@ -25769,8 +26025,7 @@ function MobileContextMenu() {
|
|
|
25769
26025
|
});
|
|
25770
26026
|
}
|
|
25771
26027
|
|
|
25772
|
-
|
|
25773
|
-
//#region src/views/components/sidebar/MobileSidebar.tsx
|
|
26028
|
+
// src/views/components/sidebar/MobileSidebar.tsx
|
|
25774
26029
|
function MobileSidebar() {
|
|
25775
26030
|
const localeService = useDependency(LocaleService);
|
|
25776
26031
|
const sidebarService = useDependency(ISidebarService);
|
|
@@ -25852,8 +26107,7 @@ function MobileSidebar() {
|
|
|
25852
26107
|
});
|
|
25853
26108
|
}
|
|
25854
26109
|
|
|
25855
|
-
|
|
25856
|
-
//#region src/views/mobile-workbench/mobile-keyboard-inset-context.ts
|
|
26110
|
+
// src/views/mobile-workbench/mobile-keyboard-inset-context.ts
|
|
25857
26111
|
/**
|
|
25858
26112
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
25859
26113
|
*
|
|
@@ -25871,8 +26125,7 @@ function MobileSidebar() {
|
|
|
25871
26125
|
*/
|
|
25872
26126
|
const MobileKeyboardInsetContext = createContext(0);
|
|
25873
26127
|
|
|
25874
|
-
|
|
25875
|
-
//#region src/views/mobile-workbench/MobileWorkbench.tsx
|
|
26128
|
+
// src/views/mobile-workbench/MobileWorkbench.tsx
|
|
25876
26129
|
const MOBILE_KEYBOARD_THRESHOLD = 80;
|
|
25877
26130
|
function resolveMobileKeyboardInset(stableHeight, visibleBottom, baselineInset) {
|
|
25878
26131
|
const keyboardInset = Math.max(0, Math.round(stableHeight - visibleBottom) - baselineInset);
|
|
@@ -25908,15 +26161,15 @@ function MobileWorkbench(props) {
|
|
|
25908
26161
|
const leftSidebarComponents = useComponentsOfPart("left-sidebar");
|
|
25909
26162
|
const globalComponents = useComponentsOfPart("global");
|
|
25910
26163
|
const toolbarComponents = useComponentsOfPart("toolbar");
|
|
25911
|
-
const darkMode = useObservable
|
|
25912
|
-
const lifecycleStage = useObservable
|
|
25913
|
-
const externalSkeletonVisible = useObservable
|
|
26164
|
+
const darkMode = useObservable(themeService.darkMode$, themeService.darkMode);
|
|
26165
|
+
const lifecycleStage = useObservable(lifecycleService.lifecycle$, lifecycleService.stage);
|
|
26166
|
+
const externalSkeletonVisible = useObservable(workbenchService.skeletonVisible$, void 0, true);
|
|
25914
26167
|
const ready = lifecycleStage >= LifecycleStages.Ready;
|
|
25915
26168
|
useEffect(() => {
|
|
25916
26169
|
if (ready && contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
|
|
25917
26170
|
}, [ready, onRendered]);
|
|
25918
|
-
const locale = useObservable
|
|
25919
|
-
const direction = useObservable
|
|
26171
|
+
const locale = useObservable(() => localeService.localeChanged$.pipe(map(() => localeService.getLocales())), localeService.getLocales(), false, [localeService]);
|
|
26172
|
+
const direction = useObservable(localeService.direction$, localeService.getDirection());
|
|
25920
26173
|
const portalContainer = useMemo(() => document.createElement("div"), []);
|
|
25921
26174
|
useLayoutEffect(() => {
|
|
25922
26175
|
const sub = themeService.currentTheme$.subscribe((theme) => {
|
|
@@ -26114,8 +26367,7 @@ function MobileWorkbench(props) {
|
|
|
26114
26367
|
});
|
|
26115
26368
|
}
|
|
26116
26369
|
|
|
26117
|
-
|
|
26118
|
-
//#region src/controllers/ui/ui-mobile.controller.ts
|
|
26370
|
+
// src/controllers/ui/ui-mobile.controller.ts
|
|
26119
26371
|
let MobileUIController = class MobileUIController extends SingleUnitUIController {
|
|
26120
26372
|
constructor(_config, injector, lifecycleService, renderManagerService, layoutService, instanceService, menuManagerService, uiPartsService) {
|
|
26121
26373
|
super(injector, instanceService, layoutService, lifecycleService, renderManagerService);
|
|
@@ -26169,12 +26421,10 @@ function createContainer(id) {
|
|
|
26169
26421
|
return element;
|
|
26170
26422
|
}
|
|
26171
26423
|
|
|
26172
|
-
|
|
26173
|
-
//#region src/services/notification/notification.service.ts
|
|
26424
|
+
// src/services/notification/notification.service.ts
|
|
26174
26425
|
const INotificationService = createIdentifier("ui.notification.service");
|
|
26175
26426
|
|
|
26176
|
-
|
|
26177
|
-
//#region src/services/before-close/before-close.service.ts
|
|
26427
|
+
// src/services/before-close/before-close.service.ts
|
|
26178
26428
|
const IBeforeCloseService = createIdentifier("univer.ui.before-close-service");
|
|
26179
26429
|
let DesktopBeforeCloseService = class DesktopBeforeCloseService extends Disposable {
|
|
26180
26430
|
constructor(_notificationService, _localeService) {
|
|
@@ -26230,8 +26480,7 @@ let DesktopBeforeCloseService = class DesktopBeforeCloseService extends Disposab
|
|
|
26230
26480
|
};
|
|
26231
26481
|
DesktopBeforeCloseService = __decorate([__decorateParam(0, INotificationService), __decorateParam(1, Inject(LocaleService))], DesktopBeforeCloseService);
|
|
26232
26482
|
|
|
26233
|
-
|
|
26234
|
-
//#region src/utils/html.ts
|
|
26483
|
+
// src/utils/html.ts
|
|
26235
26484
|
function sanitizeParsedHtml(root, options) {
|
|
26236
26485
|
root.querySelectorAll(options.strippedSelector).forEach((element) => element.remove());
|
|
26237
26486
|
root.querySelectorAll("*").forEach((element) => {
|
|
@@ -26249,8 +26498,7 @@ function parseHtmlDocument(html, options) {
|
|
|
26249
26498
|
return doc;
|
|
26250
26499
|
}
|
|
26251
26500
|
|
|
26252
|
-
|
|
26253
|
-
//#region src/services/clipboard/clipboard-utils.ts
|
|
26501
|
+
// src/services/clipboard/clipboard-utils.ts
|
|
26254
26502
|
/**
|
|
26255
26503
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
26256
26504
|
*
|
|
@@ -26276,8 +26524,7 @@ function supportClipboardAPI() {
|
|
|
26276
26524
|
return typeof navigator.clipboard !== "undefined" && typeof navigator.clipboard.readText !== "undefined";
|
|
26277
26525
|
}
|
|
26278
26526
|
|
|
26279
|
-
|
|
26280
|
-
//#region src/services/clipboard/clipboard-interface.service.ts
|
|
26527
|
+
// src/services/clipboard/clipboard-interface.service.ts
|
|
26281
26528
|
const PLAIN_TEXT_CLIPBOARD_MIME_TYPE = "text/plain";
|
|
26282
26529
|
const HTML_CLIPBOARD_MIME_TYPE = "text/html";
|
|
26283
26530
|
const FILE_PNG_CLIPBOARD_MIME_TYPE = "image/png";
|
|
@@ -26628,8 +26875,7 @@ function select(element) {
|
|
|
26628
26875
|
return selection.toString();
|
|
26629
26876
|
}
|
|
26630
26877
|
|
|
26631
|
-
|
|
26632
|
-
//#region src/views/components/confirm-part/MobileConfirmPart.tsx
|
|
26878
|
+
// src/views/components/confirm-part/MobileConfirmPart.tsx
|
|
26633
26879
|
function MobileContextConfirm(props) {
|
|
26634
26880
|
const { children, onClose, onConfirm } = props;
|
|
26635
26881
|
const [hooks] = useState({});
|
|
@@ -26676,8 +26922,7 @@ function MobileConfirmPart() {
|
|
|
26676
26922
|
}, options.id));
|
|
26677
26923
|
}
|
|
26678
26924
|
|
|
26679
|
-
|
|
26680
|
-
//#region src/services/confirm/mobile-confirm.service.ts
|
|
26925
|
+
// src/services/confirm/mobile-confirm.service.ts
|
|
26681
26926
|
let MobileConfirmService = class MobileConfirmService extends Disposable {
|
|
26682
26927
|
constructor(_injector, uiPartsService) {
|
|
26683
26928
|
super();
|
|
@@ -26731,8 +26976,7 @@ let MobileConfirmService = class MobileConfirmService extends Disposable {
|
|
|
26731
26976
|
};
|
|
26732
26977
|
MobileConfirmService = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, IUIPartsService)], MobileConfirmService);
|
|
26733
26978
|
|
|
26734
|
-
|
|
26735
|
-
//#region src/views/components/dialog-part/MobileDialogPart.tsx
|
|
26979
|
+
// src/views/components/dialog-part/MobileDialogPart.tsx
|
|
26736
26980
|
function toMobileDialogOptions(options) {
|
|
26737
26981
|
const { children, title, footer, ...rest } = options;
|
|
26738
26982
|
return {
|
|
@@ -26759,10 +27003,12 @@ function MobileDialogPart() {
|
|
|
26759
27003
|
const defaultSnap = options.layout === "canvas" ? "compact" : "expanded";
|
|
26760
27004
|
const footer = options.footer ?? (options.showOk || options.showCancel ? /* @__PURE__ */ jsxs(Fragment$1, { children: [options.showCancel && /* @__PURE__ */ jsx(Button, {
|
|
26761
27005
|
onClick: options.onCancel,
|
|
27006
|
+
size: "middle",
|
|
26762
27007
|
children: locale === null || locale === void 0 ? void 0 : locale.Confirm.cancel
|
|
26763
27008
|
}), options.showOk && /* @__PURE__ */ jsx(Button, {
|
|
26764
27009
|
variant: "primary",
|
|
26765
27010
|
onClick: options.onOk,
|
|
27011
|
+
size: "middle",
|
|
26766
27012
|
children: locale === null || locale === void 0 ? void 0 : locale.Confirm.confirm
|
|
26767
27013
|
})] }) : null);
|
|
26768
27014
|
const close = () => {
|
|
@@ -26793,6 +27039,7 @@ function MobileDialogPart() {
|
|
|
26793
27039
|
}), /* @__PURE__ */ jsx(MobileDrawer, {
|
|
26794
27040
|
layerRef,
|
|
26795
27041
|
layout: options.layout,
|
|
27042
|
+
autoHeight: options.layout !== "canvas",
|
|
26796
27043
|
componentName: "mobile-dialog-drawer",
|
|
26797
27044
|
snap: (snapOverride === null || snapOverride === void 0 ? void 0 : snapOverride.id) === options.id ? snapOverride.snap : defaultSnap,
|
|
26798
27045
|
expandLabel: localeService.t("ui.sidebar.resize"),
|
|
@@ -26827,8 +27074,7 @@ function MobileDialogPart() {
|
|
|
26827
27074
|
});
|
|
26828
27075
|
}
|
|
26829
27076
|
|
|
26830
|
-
|
|
26831
|
-
//#region src/views/components/dialog-part/DialogPart.tsx
|
|
27077
|
+
// src/views/components/dialog-part/DialogPart.tsx
|
|
26832
27078
|
function DialogItem(props) {
|
|
26833
27079
|
const dialogRef = useRef(null);
|
|
26834
27080
|
const openRef = useRef(false);
|
|
@@ -26885,13 +27131,13 @@ function DialogPart() {
|
|
|
26885
27131
|
return attrs === null || attrs === void 0 ? void 0 : attrs.map((options) => /* @__PURE__ */ jsx(DialogItem, { ...options }, options.id));
|
|
26886
27132
|
}
|
|
26887
27133
|
|
|
26888
|
-
|
|
26889
|
-
//#region src/services/dialog/desktop-dialog.service.ts
|
|
27134
|
+
// src/services/dialog/desktop-dialog.service.ts
|
|
26890
27135
|
let DesktopDialogService = class DesktopDialogService extends Disposable {
|
|
26891
|
-
constructor(_injector, _uiPartsService) {
|
|
27136
|
+
constructor(_injector, _uiPartsService, _menuHostService) {
|
|
26892
27137
|
super();
|
|
26893
27138
|
this._injector = _injector;
|
|
26894
27139
|
this._uiPartsService = _uiPartsService;
|
|
27140
|
+
this._menuHostService = _menuHostService;
|
|
26895
27141
|
_defineProperty(this, "_dialogOptions", []);
|
|
26896
27142
|
_defineProperty(this, "_dialogOptions$", new Subject());
|
|
26897
27143
|
this._initUIPart();
|
|
@@ -26902,7 +27148,9 @@ let DesktopDialogService = class DesktopDialogService extends Disposable {
|
|
|
26902
27148
|
this._dialogOptions$.complete();
|
|
26903
27149
|
}
|
|
26904
27150
|
open(option) {
|
|
26905
|
-
|
|
27151
|
+
const existingDialog = this._dialogOptions.find((item) => item.id === option.id);
|
|
27152
|
+
if (!(existingDialog === null || existingDialog === void 0 ? void 0 : existingDialog.open)) this._menuHostService.closeAll();
|
|
27153
|
+
if (existingDialog) this._dialogOptions = this._dialogOptions.map((item) => ({
|
|
26906
27154
|
...item.id === option.id ? option : item,
|
|
26907
27155
|
open: item.id === option.id ? true : item.open
|
|
26908
27156
|
}));
|
|
@@ -26938,10 +27186,13 @@ let DesktopDialogService = class DesktopDialogService extends Disposable {
|
|
|
26938
27186
|
this.disposeWithMe(this._uiPartsService.registerComponent("global", () => connectInjector(DialogPart, this._injector)));
|
|
26939
27187
|
}
|
|
26940
27188
|
};
|
|
26941
|
-
DesktopDialogService = __decorate([
|
|
27189
|
+
DesktopDialogService = __decorate([
|
|
27190
|
+
__decorateParam(0, Inject(Injector)),
|
|
27191
|
+
__decorateParam(1, IUIPartsService),
|
|
27192
|
+
__decorateParam(2, IContextMenuHostService)
|
|
27193
|
+
], DesktopDialogService);
|
|
26942
27194
|
|
|
26943
|
-
|
|
26944
|
-
//#region src/services/dialog/mobile-dialog.service.ts
|
|
27195
|
+
// src/services/dialog/mobile-dialog.service.ts
|
|
26945
27196
|
/**
|
|
26946
27197
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
26947
27198
|
*
|
|
@@ -26958,8 +27209,8 @@ DesktopDialogService = __decorate([__decorateParam(0, Inject(Injector)), __decor
|
|
|
26958
27209
|
* limitations under the License.
|
|
26959
27210
|
*/
|
|
26960
27211
|
let MobileDialogService = class MobileDialogService extends DesktopDialogService {
|
|
26961
|
-
constructor(injector, uiPartsService) {
|
|
26962
|
-
super(injector, uiPartsService);
|
|
27212
|
+
constructor(injector, uiPartsService, menuHostService) {
|
|
27213
|
+
super(injector, uiPartsService, menuHostService);
|
|
26963
27214
|
}
|
|
26964
27215
|
close(id) {
|
|
26965
27216
|
const dialog = this._dialogOptions.find((item) => item.id === id);
|
|
@@ -26970,14 +27221,16 @@ let MobileDialogService = class MobileDialogService extends DesktopDialogService
|
|
|
26970
27221
|
this.disposeWithMe(this._uiPartsService.registerComponent("global", () => connectInjector(MobileDialogPart, this._injector)));
|
|
26971
27222
|
}
|
|
26972
27223
|
};
|
|
26973
|
-
MobileDialogService = __decorate([
|
|
27224
|
+
MobileDialogService = __decorate([
|
|
27225
|
+
__decorateParam(0, Inject(Injector)),
|
|
27226
|
+
__decorateParam(1, IUIPartsService),
|
|
27227
|
+
__decorateParam(2, IContextMenuHostService)
|
|
27228
|
+
], MobileDialogService);
|
|
26974
27229
|
|
|
26975
|
-
|
|
26976
|
-
//#region src/services/gallery/gallery.service.ts
|
|
27230
|
+
// src/services/gallery/gallery.service.ts
|
|
26977
27231
|
const IGalleryService = createIdentifier("univer.ui.gallery-service");
|
|
26978
27232
|
|
|
26979
|
-
|
|
26980
|
-
//#region src/views/components/gallery-part/GalleryPart.tsx
|
|
27233
|
+
// src/views/components/gallery-part/GalleryPart.tsx
|
|
26981
27234
|
/**
|
|
26982
27235
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
26983
27236
|
*
|
|
@@ -27000,8 +27253,7 @@ function GalleryPart() {
|
|
|
27000
27253
|
return /* @__PURE__ */ jsx(Gallery, { ...gallery });
|
|
27001
27254
|
}
|
|
27002
27255
|
|
|
27003
|
-
|
|
27004
|
-
//#region src/services/gallery/desktop-gallery.service.ts
|
|
27256
|
+
// src/services/gallery/desktop-gallery.service.ts
|
|
27005
27257
|
let DesktopGalleryService = class DesktopGalleryService extends Disposable {
|
|
27006
27258
|
constructor(_injector, _uiPartsService) {
|
|
27007
27259
|
super();
|
|
@@ -27034,8 +27286,7 @@ let DesktopGalleryService = class DesktopGalleryService extends Disposable {
|
|
|
27034
27286
|
};
|
|
27035
27287
|
DesktopGalleryService = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, IUIPartsService)], DesktopGalleryService);
|
|
27036
27288
|
|
|
27037
|
-
|
|
27038
|
-
//#region src/services/local-file/desktop-local-file.service.ts
|
|
27289
|
+
// src/services/local-file/desktop-local-file.service.ts
|
|
27039
27290
|
var DesktopLocalFileService = class extends Disposable {
|
|
27040
27291
|
openFile(options) {
|
|
27041
27292
|
return new Promise((resolve) => {
|
|
@@ -27058,8 +27309,7 @@ var DesktopLocalFileService = class extends Disposable {
|
|
|
27058
27309
|
}
|
|
27059
27310
|
};
|
|
27060
27311
|
|
|
27061
|
-
|
|
27062
|
-
//#region src/services/local-file/local-file.service.ts
|
|
27312
|
+
// src/services/local-file/local-file.service.ts
|
|
27063
27313
|
/**
|
|
27064
27314
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
27065
27315
|
*
|
|
@@ -27080,8 +27330,7 @@ var DesktopLocalFileService = class extends Disposable {
|
|
|
27080
27330
|
*/
|
|
27081
27331
|
const ILocalFileService = createIdentifier("univer-ui.local-file.service");
|
|
27082
27332
|
|
|
27083
|
-
|
|
27084
|
-
//#region src/utils/storage-driver.ts
|
|
27333
|
+
// src/utils/storage-driver.ts
|
|
27085
27334
|
/**
|
|
27086
27335
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
27087
27336
|
*
|
|
@@ -27299,8 +27548,7 @@ function createDriver() {
|
|
|
27299
27548
|
}
|
|
27300
27549
|
const browserStorage = createDriver();
|
|
27301
27550
|
|
|
27302
|
-
|
|
27303
|
-
//#region src/services/local-storage/local-storage.service.ts
|
|
27551
|
+
// src/services/local-storage/local-storage.service.ts
|
|
27304
27552
|
var DesktopLocalStorageService = class {
|
|
27305
27553
|
getItem(key) {
|
|
27306
27554
|
return browserStorage.getItem(key);
|
|
@@ -27325,8 +27573,7 @@ var DesktopLocalStorageService = class {
|
|
|
27325
27573
|
}
|
|
27326
27574
|
};
|
|
27327
27575
|
|
|
27328
|
-
|
|
27329
|
-
//#region src/views/message/MessageContainer.tsx
|
|
27576
|
+
// src/views/message/MessageContainer.tsx
|
|
27330
27577
|
/**
|
|
27331
27578
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
27332
27579
|
*
|
|
@@ -27353,8 +27600,7 @@ function MessageContainer() {
|
|
|
27353
27600
|
});
|
|
27354
27601
|
}
|
|
27355
27602
|
|
|
27356
|
-
|
|
27357
|
-
//#region src/services/message/desktop-message.service.ts
|
|
27603
|
+
// src/services/message/desktop-message.service.ts
|
|
27358
27604
|
let messageId = 0;
|
|
27359
27605
|
let DesktopMessageService = class DesktopMessageService extends Disposable {
|
|
27360
27606
|
constructor(_injector, _uiPartsService) {
|
|
@@ -27386,8 +27632,7 @@ let DesktopMessageService = class DesktopMessageService extends Disposable {
|
|
|
27386
27632
|
};
|
|
27387
27633
|
DesktopMessageService = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, IUIPartsService)], DesktopMessageService);
|
|
27388
27634
|
|
|
27389
|
-
|
|
27390
|
-
//#region src/views/notification/Notification.tsx
|
|
27635
|
+
// src/views/notification/Notification.tsx
|
|
27391
27636
|
function Notification() {
|
|
27392
27637
|
const localeService = useDependency(LocaleService);
|
|
27393
27638
|
const themeService = useDependency(ThemeService);
|
|
@@ -27414,8 +27659,7 @@ const notification = {
|
|
|
27414
27659
|
dismiss: (id) => toast.dismiss(id)
|
|
27415
27660
|
};
|
|
27416
27661
|
|
|
27417
|
-
|
|
27418
|
-
//#region src/services/notification/desktop-notification.service.ts
|
|
27662
|
+
// src/services/notification/desktop-notification.service.ts
|
|
27419
27663
|
let DesktopNotificationService = class DesktopNotificationService extends Disposable {
|
|
27420
27664
|
constructor(_injector, _uiPartsService) {
|
|
27421
27665
|
super();
|
|
@@ -27433,8 +27677,7 @@ let DesktopNotificationService = class DesktopNotificationService extends Dispos
|
|
|
27433
27677
|
};
|
|
27434
27678
|
DesktopNotificationService = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, IUIPartsService)], DesktopNotificationService);
|
|
27435
27679
|
|
|
27436
|
-
|
|
27437
|
-
//#region src/services/presence/unit-presence-ui-adapter.service.ts
|
|
27680
|
+
// src/services/presence/unit-presence-ui-adapter.service.ts
|
|
27438
27681
|
const IUnitPresenceUIAdapterRegistry = createIdentifier("ui.unit-presence-adapter-registry");
|
|
27439
27682
|
const EMPTY_ADAPTERS = Object.freeze([]);
|
|
27440
27683
|
var UnitPresenceUIAdapterRegistry = class extends Disposable {
|
|
@@ -27470,11 +27713,11 @@ var UnitPresenceUIAdapterRegistry = class extends Disposable {
|
|
|
27470
27713
|
}
|
|
27471
27714
|
};
|
|
27472
27715
|
|
|
27473
|
-
|
|
27474
|
-
|
|
27475
|
-
|
|
27476
|
-
|
|
27477
|
-
|
|
27716
|
+
// src/services/sidebar/desktop-sidebar.service.ts
|
|
27717
|
+
let DesktopSidebarService = class DesktopSidebarService extends Disposable {
|
|
27718
|
+
constructor(_menuHostService) {
|
|
27719
|
+
super();
|
|
27720
|
+
this._menuHostService = _menuHostService;
|
|
27478
27721
|
_defineProperty(this, "_sidebarOptions", {});
|
|
27479
27722
|
_defineProperty(this, "sidebarOptions$", new Subject());
|
|
27480
27723
|
_defineProperty(this, "scrollEvent$", new Subject());
|
|
@@ -27507,6 +27750,7 @@ var DesktopSidebarService = class extends Disposable {
|
|
|
27507
27750
|
}
|
|
27508
27751
|
}
|
|
27509
27752
|
open(params) {
|
|
27753
|
+
this._menuHostService.closeAll();
|
|
27510
27754
|
this._sidebarOptions = {
|
|
27511
27755
|
...params,
|
|
27512
27756
|
id: params.id,
|
|
@@ -27540,9 +27784,9 @@ var DesktopSidebarService = class extends Disposable {
|
|
|
27540
27784
|
this._container = element;
|
|
27541
27785
|
}
|
|
27542
27786
|
};
|
|
27787
|
+
DesktopSidebarService = __decorate([__decorateParam(0, IContextMenuHostService)], DesktopSidebarService);
|
|
27543
27788
|
|
|
27544
|
-
|
|
27545
|
-
//#region src/services/undo-redo/undo-redo-group.service.ts
|
|
27789
|
+
// src/services/undo-redo/undo-redo-group.service.ts
|
|
27546
27790
|
/**
|
|
27547
27791
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
27548
27792
|
*
|
|
@@ -27596,8 +27840,22 @@ let UndoRedoGroupService = class UndoRedoGroupService {
|
|
|
27596
27840
|
};
|
|
27597
27841
|
UndoRedoGroupService = __decorate([__decorateParam(0, IUndoRedoService)], UndoRedoGroupService);
|
|
27598
27842
|
|
|
27599
|
-
|
|
27600
|
-
|
|
27843
|
+
// src/mobile-plugin.ts
|
|
27844
|
+
/**
|
|
27845
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
27846
|
+
*
|
|
27847
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
27848
|
+
* you may not use this file except in compliance with the License.
|
|
27849
|
+
* You may obtain a copy of the License at
|
|
27850
|
+
*
|
|
27851
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
27852
|
+
*
|
|
27853
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
27854
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
27855
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
27856
|
+
* See the License for the specific language governing permissions and
|
|
27857
|
+
* limitations under the License.
|
|
27858
|
+
*/
|
|
27601
27859
|
const DISABLE_AUTO_FOCUS_KEY$1 = "DISABLE_AUTO_FOCUS";
|
|
27602
27860
|
let UniverMobileUIPlugin = class UniverMobileUIPlugin extends Plugin {
|
|
27603
27861
|
constructor(_config = defaultPluginConfig, _contextService, _injector, _configService) {
|
|
@@ -27698,8 +27956,7 @@ UniverMobileUIPlugin = __decorate([
|
|
|
27698
27956
|
__decorateParam(3, IConfigService)
|
|
27699
27957
|
], UniverMobileUIPlugin);
|
|
27700
27958
|
|
|
27701
|
-
|
|
27702
|
-
//#region src/views/components/shortcut-panel/ShortcutPanel.tsx
|
|
27959
|
+
// src/views/components/shortcut-panel/ShortcutPanel.tsx
|
|
27703
27960
|
/**
|
|
27704
27961
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
27705
27962
|
*
|
|
@@ -27777,8 +28034,7 @@ function ShortcutPanel() {
|
|
|
27777
28034
|
});
|
|
27778
28035
|
}
|
|
27779
28036
|
|
|
27780
|
-
|
|
27781
|
-
//#region src/views/font-family/FontFamilyDropdown.tsx
|
|
28037
|
+
// src/views/font-family/FontFamilyDropdown.tsx
|
|
27782
28038
|
function FontFamilyDropdown(props) {
|
|
27783
28039
|
const { value, onChange, ariaLabel, className, disabled: disabledProp, disabled$, inputClassName, popupClassName, popupDataComponent, title, onMouseDown, onPointerDown } = props;
|
|
27784
28040
|
const localeService = useDependency(LocaleService);
|
|
@@ -27825,8 +28081,7 @@ function FontFamilyDropdown(props) {
|
|
|
27825
28081
|
});
|
|
27826
28082
|
}
|
|
27827
28083
|
|
|
27828
|
-
|
|
27829
|
-
//#region src/views/slider/ZoomInput.tsx
|
|
28084
|
+
// src/views/slider/ZoomInput.tsx
|
|
27830
28085
|
function ZoomInput(props) {
|
|
27831
28086
|
const iconManager = useDependency(IconManager);
|
|
27832
28087
|
const localeService = useDependency(LocaleService);
|
|
@@ -27919,8 +28174,7 @@ function ZoomInput(props) {
|
|
|
27919
28174
|
});
|
|
27920
28175
|
}
|
|
27921
28176
|
|
|
27922
|
-
|
|
27923
|
-
//#region src/views/slider/Slider.tsx
|
|
28177
|
+
// src/views/slider/Slider.tsx
|
|
27924
28178
|
const SLIDER_WIDTH = 116;
|
|
27925
28179
|
const DRAG_COMMIT_INTERVAL = 50;
|
|
27926
28180
|
/**
|
|
@@ -28150,8 +28404,7 @@ function Slider(props) {
|
|
|
28150
28404
|
});
|
|
28151
28405
|
}
|
|
28152
28406
|
|
|
28153
|
-
|
|
28154
|
-
//#region src/views/object-permission/ObjectPermissionMembers.tsx
|
|
28407
|
+
// src/views/object-permission/ObjectPermissionMembers.tsx
|
|
28155
28408
|
function ObjectPermissionMembers({ unitId, value, disabled, onChange }) {
|
|
28156
28409
|
var _authz$getCfgEnableOb;
|
|
28157
28410
|
const locale = useDependency(LocaleService);
|
|
@@ -28300,8 +28553,7 @@ function ObjectPermissionMembers({ unitId, value, disabled, onChange }) {
|
|
|
28300
28553
|
});
|
|
28301
28554
|
}
|
|
28302
28555
|
|
|
28303
|
-
|
|
28304
|
-
//#region src/views/object-permission/ObjectPermissionButton.tsx
|
|
28556
|
+
// src/views/object-permission/ObjectPermissionButton.tsx
|
|
28305
28557
|
const OBJECT_PERMISSION_DIALOG = "ui.object-permission-dialog";
|
|
28306
28558
|
/** Mount outside transient toolbars and context menus, retaining the original target until close. */
|
|
28307
28559
|
function openObjectPermissionDialog(accessor, props) {
|
|
@@ -28598,8 +28850,7 @@ function ObjectPermissionDialog({ target, name, commandId, actions = DEFAULT_ACT
|
|
|
28598
28850
|
});
|
|
28599
28851
|
}
|
|
28600
28852
|
|
|
28601
|
-
|
|
28602
|
-
//#region src/views/object-permission/ObjectPermissionPanel.tsx
|
|
28853
|
+
// src/views/object-permission/ObjectPermissionPanel.tsx
|
|
28603
28854
|
const OBJECT_PERMISSION_PANEL = "ui.object-permission-panel";
|
|
28604
28855
|
function openObjectPermissionPanel(accessor, props) {
|
|
28605
28856
|
if (!accessor.get(ObjectPermissionService).canView(props.target)) return false;
|
|
@@ -28693,7 +28944,7 @@ function ObjectPermissionPanel({ unitId, getTargets, expandable }) {
|
|
|
28693
28944
|
});
|
|
28694
28945
|
}
|
|
28695
28946
|
return /* @__PURE__ */ jsxs("div", {
|
|
28696
|
-
className: "univer-flex univer-h-full univer-flex-col univer-gap-3 univer-
|
|
28947
|
+
className: "univer-box-border univer-flex univer-h-0 univer-min-h-full univer-flex-col univer-gap-3 univer-pt-4",
|
|
28697
28948
|
children: [
|
|
28698
28949
|
expandable && /* @__PURE__ */ jsx(Button, {
|
|
28699
28950
|
"aria-expanded": expanded,
|
|
@@ -28710,7 +28961,7 @@ function ObjectPermissionPanel({ unitId, getTargets, expandable }) {
|
|
|
28710
28961
|
"aria-label": localeService.t("ui.objectPermission.search")
|
|
28711
28962
|
}),
|
|
28712
28963
|
/* @__PURE__ */ jsxs("div", {
|
|
28713
|
-
className: "univer-flex-1 univer-overflow-auto",
|
|
28964
|
+
className: "univer-min-h-0 univer-flex-1 univer-overflow-auto univer-pb-4",
|
|
28714
28965
|
children: [
|
|
28715
28966
|
items.map((item) => /* @__PURE__ */ jsxs("div", {
|
|
28716
28967
|
className: "univer-flex univer-items-center univer-gap-2 univer-py-2",
|
|
@@ -28731,8 +28982,7 @@ function ObjectPermissionPanel({ unitId, getTargets, expandable }) {
|
|
|
28731
28982
|
});
|
|
28732
28983
|
}
|
|
28733
28984
|
|
|
28734
|
-
|
|
28735
|
-
//#region src/controllers/components.controller.ts
|
|
28985
|
+
// src/controllers/components.controller.ts
|
|
28736
28986
|
/**
|
|
28737
28987
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
28738
28988
|
*
|
|
@@ -28794,8 +29044,7 @@ let ComponentsController = class ComponentsController extends Disposable {
|
|
|
28794
29044
|
};
|
|
28795
29045
|
ComponentsController = __decorate([__decorateParam(0, Inject(ComponentManager)), __decorateParam(1, Inject(IconManager))], ComponentsController);
|
|
28796
29046
|
|
|
28797
|
-
|
|
28798
|
-
//#region src/controllers/feature-search/feature-search.controller.ts
|
|
29047
|
+
// src/controllers/feature-search/feature-search.controller.ts
|
|
28799
29048
|
const FeatureSearchShortcut = {
|
|
28800
29049
|
id: OpenFeatureSearchOperation.id,
|
|
28801
29050
|
binding: 4096 | 1024 | 80,
|
|
@@ -28812,8 +29061,7 @@ let FeatureSearchController = class FeatureSearchController extends Disposable {
|
|
|
28812
29061
|
};
|
|
28813
29062
|
FeatureSearchController = __decorate([__decorateParam(0, ICommandService), __decorateParam(1, IShortcutService)], FeatureSearchController);
|
|
28814
29063
|
|
|
28815
|
-
|
|
28816
|
-
//#region src/views/components/confirm-part/ConfirmPart.tsx
|
|
29064
|
+
// src/views/components/confirm-part/ConfirmPart.tsx
|
|
28817
29065
|
const ContextConfirm = (props) => {
|
|
28818
29066
|
const { children, onClose, onConfirm } = props;
|
|
28819
29067
|
const [hooks] = useState({});
|
|
@@ -28861,8 +29109,7 @@ function ConfirmPart() {
|
|
|
28861
29109
|
}, index));
|
|
28862
29110
|
}
|
|
28863
29111
|
|
|
28864
|
-
|
|
28865
|
-
//#region src/services/confirm/desktop-confirm.service.ts
|
|
29112
|
+
// src/services/confirm/desktop-confirm.service.ts
|
|
28866
29113
|
let DesktopConfirmService = class DesktopConfirmService extends Disposable {
|
|
28867
29114
|
constructor(_injector, _uiPartsService) {
|
|
28868
29115
|
super();
|
|
@@ -28915,8 +29162,22 @@ let DesktopConfirmService = class DesktopConfirmService extends Disposable {
|
|
|
28915
29162
|
};
|
|
28916
29163
|
DesktopConfirmService = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, IUIPartsService)], DesktopConfirmService);
|
|
28917
29164
|
|
|
28918
|
-
|
|
28919
|
-
|
|
29165
|
+
// src/plugin.ts
|
|
29166
|
+
/**
|
|
29167
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
29168
|
+
*
|
|
29169
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
29170
|
+
* you may not use this file except in compliance with the License.
|
|
29171
|
+
* You may obtain a copy of the License at
|
|
29172
|
+
*
|
|
29173
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
29174
|
+
*
|
|
29175
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
29176
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
29177
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
29178
|
+
* See the License for the specific language governing permissions and
|
|
29179
|
+
* limitations under the License.
|
|
29180
|
+
*/
|
|
28920
29181
|
const DISABLE_AUTO_FOCUS_KEY = "DISABLE_AUTO_FOCUS";
|
|
28921
29182
|
let UniverUIPlugin = class UniverUIPlugin extends Plugin {
|
|
28922
29183
|
constructor(_config = defaultPluginConfig, _contextService, _injector, _configService) {
|
|
@@ -29024,8 +29285,7 @@ UniverUIPlugin = __decorate([
|
|
|
29024
29285
|
__decorateParam(3, IConfigService)
|
|
29025
29286
|
], UniverUIPlugin);
|
|
29026
29287
|
|
|
29027
|
-
|
|
29028
|
-
//#region src/services/message/__tests__/mock-message.service.ts
|
|
29288
|
+
// src/services/message/__tests__/mock-message.service.ts
|
|
29029
29289
|
/**
|
|
29030
29290
|
* This is a mocked message service for testing purposes.
|
|
29031
29291
|
*
|
|
@@ -29041,8 +29301,7 @@ var MockMessageService = class {
|
|
|
29041
29301
|
getContainer() {}
|
|
29042
29302
|
};
|
|
29043
29303
|
|
|
29044
|
-
|
|
29045
|
-
//#region src/services/sidebar/hooks/use-sidebar-click.ts
|
|
29304
|
+
// src/services/sidebar/hooks/use-sidebar-click.ts
|
|
29046
29305
|
/**
|
|
29047
29306
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
29048
29307
|
*
|
|
@@ -29073,8 +29332,7 @@ const useSidebarClick = (cb) => {
|
|
|
29073
29332
|
}, [cb, container]);
|
|
29074
29333
|
};
|
|
29075
29334
|
|
|
29076
|
-
|
|
29077
|
-
//#region src/utils/util.ts
|
|
29335
|
+
// src/utils/util.ts
|
|
29078
29336
|
/**
|
|
29079
29337
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
29080
29338
|
*
|
|
@@ -29095,8 +29353,7 @@ function textTrim(x) {
|
|
|
29095
29353
|
return x.replace(/^\s+|\s+$/gm, "");
|
|
29096
29354
|
}
|
|
29097
29355
|
|
|
29098
|
-
|
|
29099
|
-
//#region src/utils/cell.ts
|
|
29356
|
+
// src/utils/cell.ts
|
|
29100
29357
|
const PX_TO_PT_RATIO = .75;
|
|
29101
29358
|
const MAX_FONT_SIZE = 78;
|
|
29102
29359
|
const MIN_FONT_SIZE = 9;
|
|
@@ -29667,8 +29924,7 @@ function extractFontFamily(styleStr) {
|
|
|
29667
29924
|
return matches ? (matches[1] || matches[2] || matches[3]).trim() : null;
|
|
29668
29925
|
}
|
|
29669
29926
|
|
|
29670
|
-
|
|
29671
|
-
//#region src/utils/mobile-canvas-gesture.ts
|
|
29927
|
+
// src/utils/mobile-canvas-gesture.ts
|
|
29672
29928
|
/** Routes touch browsing separately from the canvas's existing object manipulation. */
|
|
29673
29929
|
var MobileCanvasGesture = class extends Disposable {
|
|
29674
29930
|
constructor(_canvas, _options) {
|
|
@@ -29882,8 +30138,7 @@ var MobileCanvasGesture = class extends Disposable {
|
|
|
29882
30138
|
}
|
|
29883
30139
|
};
|
|
29884
30140
|
|
|
29885
|
-
|
|
29886
|
-
//#region src/views/components/dom/Print.tsx
|
|
30141
|
+
// src/views/components/dom/Print.tsx
|
|
29887
30142
|
const PrintFloatDomSingle = memo((props) => {
|
|
29888
30143
|
const { layer } = props;
|
|
29889
30144
|
return typeof layer.componentKey === "string" ? /* @__PURE__ */ jsx(RegisteredPrintFloatDomSingle, {
|
|
@@ -29965,8 +30220,7 @@ function PrintFloatDomSingleContent(props) {
|
|
|
29965
30220
|
});
|
|
29966
30221
|
}
|
|
29967
30222
|
|
|
29968
|
-
|
|
29969
|
-
//#region src/views/components/hover-track/HoverTrack.tsx
|
|
30223
|
+
// src/views/components/hover-track/HoverTrack.tsx
|
|
29970
30224
|
const HOVER_TRACK_HOST_CLASS_NAME = "univer-group/hover-track";
|
|
29971
30225
|
const HOVER_TRACK_MASK = "linear-gradient(currentColor 0 0) content-box, linear-gradient(currentColor 0 0)";
|
|
29972
30226
|
const HOVER_TRACK_MASK_STYLE = {
|
|
@@ -29985,8 +30239,7 @@ function HoverTrack(props) {
|
|
|
29985
30239
|
});
|
|
29986
30240
|
}
|
|
29987
30241
|
|
|
29988
|
-
|
|
29989
|
-
//#region src/views/components/mobile-zoom-indicator/mobile-zoom-indicator.ts
|
|
30242
|
+
// src/views/components/mobile-zoom-indicator/mobile-zoom-indicator.ts
|
|
29990
30243
|
/**
|
|
29991
30244
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
29992
30245
|
*
|
|
@@ -30064,27 +30317,41 @@ var MobileZoomIndicator = class extends Disposable {
|
|
|
30064
30317
|
}
|
|
30065
30318
|
};
|
|
30066
30319
|
|
|
30067
|
-
|
|
30068
|
-
|
|
30320
|
+
// src/views/font-family/MobileFontFamilyDropdown.tsx
|
|
30321
|
+
/**
|
|
30322
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
30323
|
+
*
|
|
30324
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
30325
|
+
* you may not use this file except in compliance with the License.
|
|
30326
|
+
* You may obtain a copy of the License at
|
|
30327
|
+
*
|
|
30328
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
30329
|
+
*
|
|
30330
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
30331
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
30332
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
30333
|
+
* See the License for the specific language governing permissions and
|
|
30334
|
+
* limitations under the License.
|
|
30335
|
+
*/
|
|
30069
30336
|
function MobileFontFamilyDropdown(props) {
|
|
30070
30337
|
const localeService = useDependency(LocaleService);
|
|
30071
30338
|
const disabled = useObservable(props.disabled$);
|
|
30072
30339
|
const { fonts } = useFontList();
|
|
30073
30340
|
return /* @__PURE__ */ jsx(MobileSelect, {
|
|
30074
30341
|
"aria-label": props.ariaLabel,
|
|
30075
|
-
className: clsx("univer-
|
|
30342
|
+
className: clsx("univer-w-full univer-min-w-0", props.className),
|
|
30076
30343
|
value: props.value,
|
|
30077
30344
|
disabled: !!(props.disabled || disabled),
|
|
30078
30345
|
options: fonts.map((font) => ({
|
|
30079
30346
|
value: font.value,
|
|
30080
30347
|
label: localeService.t(font.label)
|
|
30081
30348
|
})),
|
|
30082
|
-
onChange: props.onChange
|
|
30349
|
+
onChange: props.onChange,
|
|
30350
|
+
size: "small"
|
|
30083
30351
|
});
|
|
30084
30352
|
}
|
|
30085
30353
|
|
|
30086
|
-
|
|
30087
|
-
//#region src/views/progress-bar/ProgressBar.tsx
|
|
30354
|
+
// src/views/progress-bar/ProgressBar.tsx
|
|
30088
30355
|
/**
|
|
30089
30356
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
30090
30357
|
*
|
|
@@ -30172,5 +30439,4 @@ function ProgressBar(props) {
|
|
|
30172
30439
|
});
|
|
30173
30440
|
}
|
|
30174
30441
|
|
|
30175
|
-
//#endregion
|
|
30176
30442
|
export { AnchoredContextMenu, BrowserClipboardService, BuiltInUIPart, COLOR_PICKER_COMPONENT, COMMON_LABEL_COMPONENT, CanvasFloatDomPreviewService, CanvasFloatDomService, CanvasPopup, CanvasPopupService, CommonLabel, ComponentContainer, ComponentManager, DesktopContextMenu as ContextMenu, ContextMenuGroup, ContextMenuHostService, ContextMenuPanel, ContextMenuPosition, ContextMenuService, CopyCommand, CopyShortcutItem, CustomLabel, CutCommand, CutShortcutItem, DISABLE_AUTO_FOCUS_KEY, DesktopBeforeCloseService, DesktopConfirmService, DesktopDialogService, DesktopGalleryService, DesktopLayoutService, DesktopLocalFileService, DesktopLocalStorageService, DesktopMessageService, DesktopNotificationService, DesktopRibbonService, DesktopSidebarService, DesktopUIController, EMBED_CHILD_UNIT_ID_ATTRIBUTE, EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE, EMOJI_CATEGORIES, EMOJI_PICKER_COMPONENT, EMOJI_RECENT_LIMIT, EmojiPicker, ErrorController, FILE_PNG_CLIPBOARD_MIME_TYPE, FILE_SVG_XML_CLIPBOARD_MIME_TYPE, FILE__BMP_CLIPBOARD_MIME_TYPE, FILE__JPEG_CLIPBOARD_MIME_TYPE, FILE__WEBP_CLIPBOARD_MIME_TYPE, FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT, FONT_SIZE_COMPONENT, FONT_SIZE_LIST, FloatDom, FloatDomSingle, FloatingObjectToolbarPosition, FontCategory, FontFamily, FontFamilyDropdown, FontFamilyItem, FontService, FontSize, FormatPainterSessionService, HEADING_ITEM_COMPONENT, HEADING_LIST, HOVER_TRACK_HOST_CLASS_NAME, HTML_CLIPBOARD_MIME_TYPE, HeadingItem, HoverTrack, IBeforeCloseService, ICanvasPopupService, IClipboardInterfaceService, IContextMenuHostService, IContextMenuService, IDialogService, IFontService, IGalleryService, ILayoutService, ILeftSidebarService, ILocalFileService, IMenuManagerService, IMessageService, INotificationService, IPlatformService, IRibbonOverrideService, IRibbonService, IShortcutService, ISidebarService, IUIController, IUIPartsService, IUIRuntimeScopeService, IUnitPresenceUIAdapterRegistry, IWorkbenchService, IconManager, KeyCode, MOBILE_UI_MODE, MenuItemType, MenuManagerPosition, MenuManagerService, MetaKeys, MobileCanvasGesture, MobileContextMenu, MobileDialogService, MobileDrawer, MobileFontFamilyDropdown, MobileKeyboardInsetContext, MobileMenu, MobileZoomIndicator, MockMessageService, NativeTextEditorShortcutBehavior, ObjectPermissionButton, ObjectPermissionPanelButton, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, PasteCommand, PlatformService, PrintFloatDomSingle, ProgressBar, RectPopup, RediConsumer, RediContext, RediProvider, RedoShortcutItem, Ribbon, RibbonDataGroup, RibbonFormulasGroup, RibbonInsertGroup, RibbonOthersGroup, RibbonOverrideService, RibbonPosition, RibbonStartGroup, RibbonViewGroup, SYMBOL_CATEGORIES, SYMBOL_PICKER_COMPONENT, SharedController, SheetPasteShortKeyCommandName, ShortcutPanelController, ShortcutPanelService, ShortcutService, Sidebar, SingleCanvasPopup, SingleUnitUIController, Slider, SymbolPicker, ThemeSwitcherService, ToggleFullscreenOperation, ToggleShortcutPanelOperation, ToolbarButton, ToolbarItem, menuSchema as UIMenuSchema, UIPartsService, UIRuntimeScopeService, UI_PLUGIN_CONFIG_KEY, UNI_DISABLE_CHANGING_FOCUS_KEY, UndoRedoGroupService, UndoShortcutItem, UnitPresenceUIAdapterRegistry, UniverMobileUIPlugin, UniverUIPlugin, WithDependency, WorkbenchService, ZIndexManager, ZoomInput, bindFormatPainterCanvas, connectDependencies, connectInjector, getAllEmojis, getDefaultRecentEmojis, getEmbedBoundaryOwner, getEmbedChildUnitId, getEmojiLocaleData, getHeaderFooterMenuHiddenObservable, getLocalizedEmojiTitle, getMenuHiddenObservable, getMobileCanvasPanDelta, getRandomEmoji, handelExcelToJson, handelTableToJson, handleDomToJson, handlePlainToJson, handleStringToStyle, handleTableColgroup, handleTableMergeData, handleTableRowGroup, imageMimeTypeSet, isEmbedBoundaryTarget, keepInteractionInsideSameEmbedBoundary, mergeMenuConfigs, objectPermissionMenuItemFactory, openObjectPermissionDialog, openObjectPermissionPanel, parseHtmlDocument, parseHtmlFragment, parseStoredRecentEmojis, preventBrowserZoomInContainers, promoteRecentEmoji, sanitizeParsedHtml, searchEmojis, splitSpanText, supportClipboardAPI, textTrim, useClickOutSide, useComponentsOfPart, useConfigValue, useDebounceFn, useDependency, useEvent, useInjector, useMobileCanvasPanel, useMobileCanvasViewport, useObservable, useObservableRef, useScrollYOverContainer, useSidebarClick, useToolbarItemStatus, useUpdateBinder, useUpdateEffect, useVirtualList };
|