@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/cjs/index.js
CHANGED
|
@@ -11,7 +11,7 @@ let react_dom = require("react-dom");
|
|
|
11
11
|
let _univerjs_icons = require("@univerjs/icons");
|
|
12
12
|
let _univerjs_protocol = require("@univerjs/protocol");
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
// src/utils/embed-boundary.ts
|
|
15
15
|
/**
|
|
16
16
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
17
17
|
*
|
|
@@ -55,8 +55,7 @@ function getAttributeValue(target, name) {
|
|
|
55
55
|
return typeof getAttribute === "function" ? getAttribute.call(target, name) ?? void 0 : void 0;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
|
|
58
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/typeof.js
|
|
60
59
|
function _typeof(o) {
|
|
61
60
|
"@babel/helpers - typeof";
|
|
62
61
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -66,28 +65,25 @@ function _typeof(o) {
|
|
|
66
65
|
}, _typeof(o);
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
function toPrimitive(t, r) {
|
|
68
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/toPrimitive.js
|
|
69
|
+
function toPrimitive(t, e) {
|
|
72
70
|
if ("object" != _typeof(t) || !t) return t;
|
|
73
|
-
var
|
|
74
|
-
if (void 0 !==
|
|
75
|
-
var i =
|
|
71
|
+
var r;
|
|
72
|
+
if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
|
|
73
|
+
var i = r.call(t, e || "default");
|
|
76
74
|
if ("object" != _typeof(i)) return i;
|
|
77
75
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
78
76
|
}
|
|
79
|
-
return ("string" ===
|
|
77
|
+
return ("string" === e ? String : Number)(t);
|
|
80
78
|
}
|
|
81
79
|
|
|
82
|
-
|
|
83
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
|
|
80
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/toPropertyKey.js
|
|
84
81
|
function toPropertyKey(t) {
|
|
85
82
|
var i = toPrimitive(t, "string");
|
|
86
83
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
87
84
|
}
|
|
88
85
|
|
|
89
|
-
|
|
90
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
86
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/defineProperty.js
|
|
91
87
|
function _defineProperty(e, r, t) {
|
|
92
88
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
93
89
|
value: t,
|
|
@@ -97,16 +93,14 @@ function _defineProperty(e, r, t) {
|
|
|
97
93
|
}) : e[r] = t, e;
|
|
98
94
|
}
|
|
99
95
|
|
|
100
|
-
|
|
101
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
|
|
96
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/decorateParam.js
|
|
102
97
|
function __decorateParam(paramIndex, decorator) {
|
|
103
98
|
return function(target, key) {
|
|
104
99
|
decorator(target, key, paramIndex);
|
|
105
100
|
};
|
|
106
101
|
}
|
|
107
102
|
|
|
108
|
-
|
|
109
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
103
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/decorate.js
|
|
110
104
|
function __decorate(decorators, target, key, desc) {
|
|
111
105
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
112
106
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -114,12 +108,10 @@ function __decorate(decorators, target, key, desc) {
|
|
|
114
108
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
115
109
|
}
|
|
116
110
|
|
|
117
|
-
|
|
118
|
-
//#region src/services/layout/layout.service.ts
|
|
111
|
+
// src/services/layout/layout.service.ts
|
|
119
112
|
const FOCUSING_UNIVER = "FOCUSING_UNIVER";
|
|
120
113
|
const givingBackFocusElements = [
|
|
121
114
|
"app-layout",
|
|
122
|
-
"button",
|
|
123
115
|
"sheet-bar-append-button",
|
|
124
116
|
"render-canvas",
|
|
125
117
|
"workbench-layout"
|
|
@@ -224,8 +216,7 @@ function getFocusUnitIdFromElement(target) {
|
|
|
224
216
|
return target.dataset.uUnitId;
|
|
225
217
|
}
|
|
226
218
|
|
|
227
|
-
|
|
228
|
-
//#region src/commands/operations/toggle-fullscreen.operation.ts
|
|
219
|
+
// src/commands/operations/toggle-fullscreen.operation.ts
|
|
229
220
|
const ToggleFullscreenOperation = {
|
|
230
221
|
id: "base-ui.operation.toggle-fullscreen",
|
|
231
222
|
type: _univerjs_core.CommandType.OPERATION,
|
|
@@ -248,8 +239,7 @@ const ToggleFullscreenOperation = {
|
|
|
248
239
|
}
|
|
249
240
|
};
|
|
250
241
|
|
|
251
|
-
|
|
252
|
-
//#region src/services/shortcut/shortcut-panel.service.ts
|
|
242
|
+
// src/services/shortcut/shortcut-panel.service.ts
|
|
253
243
|
/**
|
|
254
244
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
255
245
|
*
|
|
@@ -287,13 +277,11 @@ var ShortcutPanelService = class extends _univerjs_core.Disposable {
|
|
|
287
277
|
}
|
|
288
278
|
};
|
|
289
279
|
|
|
290
|
-
|
|
291
|
-
//#region src/services/sidebar/sidebar.service.ts
|
|
280
|
+
// src/services/sidebar/sidebar.service.ts
|
|
292
281
|
const ILeftSidebarService = (0, _univerjs_core.createIdentifier)("ui.left-sidebar.service");
|
|
293
282
|
const ISidebarService = (0, _univerjs_core.createIdentifier)("ui.sidebar.service");
|
|
294
283
|
|
|
295
|
-
|
|
296
|
-
//#region src/commands/operations/toggle-shortcut-panel.operation.ts
|
|
284
|
+
// src/commands/operations/toggle-shortcut-panel.operation.ts
|
|
297
285
|
const ShortcutPanelComponentName = "ShortcutPanel";
|
|
298
286
|
const ToggleShortcutPanelOperation = {
|
|
299
287
|
id: "base-ui.operation.toggle-shortcut-panel",
|
|
@@ -316,8 +304,7 @@ const ToggleShortcutPanelOperation = {
|
|
|
316
304
|
}
|
|
317
305
|
};
|
|
318
306
|
|
|
319
|
-
|
|
320
|
-
//#region src/common/component-manager.ts
|
|
307
|
+
// src/common/component-manager.ts
|
|
321
308
|
let ComponentManager = class ComponentManager extends _univerjs_core.Disposable {
|
|
322
309
|
constructor(_logService) {
|
|
323
310
|
super();
|
|
@@ -383,8 +370,7 @@ let ComponentManager = class ComponentManager extends _univerjs_core.Disposable
|
|
|
383
370
|
};
|
|
384
371
|
ComponentManager = __decorate([__decorateParam(0, (0, _univerjs_core.Optional)(_univerjs_core.ILogService))], ComponentManager);
|
|
385
372
|
|
|
386
|
-
|
|
387
|
-
//#region src/common/icon-manager.ts
|
|
373
|
+
// src/common/icon-manager.ts
|
|
388
374
|
const EmptyIcon = () => null;
|
|
389
375
|
let IconManager = class IconManager extends _univerjs_core.Disposable {
|
|
390
376
|
constructor(_logService) {
|
|
@@ -440,8 +426,7 @@ let IconManager = class IconManager extends _univerjs_core.Disposable {
|
|
|
440
426
|
};
|
|
441
427
|
IconManager = __decorate([__decorateParam(0, _univerjs_core.ILogService)], IconManager);
|
|
442
428
|
|
|
443
|
-
|
|
444
|
-
//#region src/common/z-index-manager.ts
|
|
429
|
+
// src/common/z-index-manager.ts
|
|
445
430
|
/**
|
|
446
431
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
447
432
|
*
|
|
@@ -479,8 +464,7 @@ var ZIndexManager = class {
|
|
|
479
464
|
}
|
|
480
465
|
};
|
|
481
466
|
|
|
482
|
-
|
|
483
|
-
//#region src/common/menu-hidden-observable.ts
|
|
467
|
+
// src/common/menu-hidden-observable.ts
|
|
484
468
|
function getMenuHiddenObservable(accessor, targetUniverType, matchUnitId, needHideUnitId) {
|
|
485
469
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
486
470
|
const getUnitType = (unitId) => _univerjs_core.SHEET_EDITOR_UNITS.includes(unitId) ? _univerjs_core.UniverInstanceType.UNIVER_SHEET : univerInstanceService.getUnitType(unitId);
|
|
@@ -522,8 +506,7 @@ function getHeaderFooterMenuHiddenObservable(accessor) {
|
|
|
522
506
|
});
|
|
523
507
|
}
|
|
524
508
|
|
|
525
|
-
|
|
526
|
-
//#region src/common/menu-merge-configs.ts
|
|
509
|
+
// src/common/menu-merge-configs.ts
|
|
527
510
|
function mergeMenuConfigs(baseConfig, additionalConfig) {
|
|
528
511
|
if (!additionalConfig || !baseConfig) return baseConfig;
|
|
529
512
|
[
|
|
@@ -552,8 +535,7 @@ function updateReactiveProperty(baseConfig, key, value) {
|
|
|
552
535
|
}
|
|
553
536
|
}
|
|
554
537
|
|
|
555
|
-
|
|
556
|
-
//#region src/services/menu/menu.ts
|
|
538
|
+
// src/services/menu/menu.ts
|
|
557
539
|
let MenuItemType = /* @__PURE__ */ function(MenuItemType) {
|
|
558
540
|
/** Button style menu item. */
|
|
559
541
|
MenuItemType[MenuItemType["BUTTON"] = 0] = "BUTTON";
|
|
@@ -569,8 +551,7 @@ function isMenuButtonSelectorItem(v) {
|
|
|
569
551
|
return v.type === 2;
|
|
570
552
|
}
|
|
571
553
|
|
|
572
|
-
|
|
573
|
-
//#region src/services/workbench/workbench.service.ts
|
|
554
|
+
// src/services/workbench/workbench.service.ts
|
|
574
555
|
const IWorkbenchService = (0, _univerjs_core.createIdentifier)("univer.ui.workbench.service");
|
|
575
556
|
let WorkbenchService = class WorkbenchService extends _univerjs_core.Disposable {
|
|
576
557
|
constructor(univerInstanceService) {
|
|
@@ -625,8 +606,7 @@ function isWorkbenchRootUnit(unitId, options) {
|
|
|
625
606
|
return !(0, _univerjs_core.isInternalEditorID)(unitId) && !(options === null || options === void 0 ? void 0 : options.skipAutoRender) && !(options === null || options === void 0 ? void 0 : options.embeddedRender);
|
|
626
607
|
}
|
|
627
608
|
|
|
628
|
-
|
|
629
|
-
//#region src/common/object-permission-menu.ts
|
|
609
|
+
// src/common/object-permission-menu.ts
|
|
630
610
|
function objectPermissionMenuItemFactory(accessor, id, unitType, objectType) {
|
|
631
611
|
const instances = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
632
612
|
const state$ = (0, rxjs.combineLatest)([accessor.get(IWorkbenchService).rootUnitType$, instances.getCurrentTypeOfUnit$(unitType)]).pipe((0, rxjs.switchMap)(([rootType, model]) => {
|
|
@@ -660,14 +640,12 @@ function objectPermissionMenuItemFactory(accessor, id, unitType, objectType) {
|
|
|
660
640
|
};
|
|
661
641
|
}
|
|
662
642
|
|
|
663
|
-
|
|
664
|
-
//#region src/config/config.ts
|
|
643
|
+
// src/config/config.ts
|
|
665
644
|
const UI_PLUGIN_CONFIG_KEY = "ui.config";
|
|
666
645
|
const configSymbol = Symbol(UI_PLUGIN_CONFIG_KEY);
|
|
667
646
|
const defaultPluginConfig = {};
|
|
668
647
|
|
|
669
|
-
|
|
670
|
-
//#region src/const.ts
|
|
648
|
+
// src/const.ts
|
|
671
649
|
/**
|
|
672
650
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
673
651
|
*
|
|
@@ -689,12 +667,10 @@ const defaultPluginConfig = {};
|
|
|
689
667
|
const UNI_DISABLE_CHANGING_FOCUS_KEY = "UNI_DISABLE_CHANGING_FOCUS";
|
|
690
668
|
const MOBILE_UI_MODE = "MOBILE_UI_MODE";
|
|
691
669
|
|
|
692
|
-
|
|
693
|
-
//#region src/services/message/message.service.ts
|
|
670
|
+
// src/services/message/message.service.ts
|
|
694
671
|
const IMessageService = (0, _univerjs_core.createIdentifier)("ui.message.service");
|
|
695
672
|
|
|
696
|
-
|
|
697
|
-
//#region src/controllers/error/error.controller.ts
|
|
673
|
+
// src/controllers/error/error.controller.ts
|
|
698
674
|
const PERMISSION_MESSAGE_ID = "ui.permission-denied";
|
|
699
675
|
const PERMISSION_MESSAGE_DURATION = 3e3;
|
|
700
676
|
let ErrorController = class ErrorController extends _univerjs_core.Disposable {
|
|
@@ -739,8 +715,7 @@ ErrorController = __decorate([
|
|
|
739
715
|
__decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService))
|
|
740
716
|
], ErrorController);
|
|
741
717
|
|
|
742
|
-
|
|
743
|
-
//#region src/services/clipboard/clipboard.command.ts
|
|
718
|
+
// src/services/clipboard/clipboard.command.ts
|
|
744
719
|
const CopyCommandName = "univer.command.copy";
|
|
745
720
|
const CopyCommand = {
|
|
746
721
|
id: CopyCommandName,
|
|
@@ -773,8 +748,7 @@ const PasteCommand = {
|
|
|
773
748
|
};
|
|
774
749
|
const SheetPasteShortKeyCommandName = "sheet.command.paste-by-short-key";
|
|
775
750
|
|
|
776
|
-
|
|
777
|
-
//#region src/services/shortcut/keycode.ts
|
|
751
|
+
// src/services/shortcut/keycode.ts
|
|
778
752
|
/**
|
|
779
753
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
780
754
|
*
|
|
@@ -944,15 +918,13 @@ let MetaKeys = /* @__PURE__ */ function(MetaKeys) {
|
|
|
944
918
|
return MetaKeys;
|
|
945
919
|
}({});
|
|
946
920
|
|
|
947
|
-
|
|
948
|
-
//#region src/common/lifecycle.ts
|
|
921
|
+
// src/common/lifecycle.ts
|
|
949
922
|
function fromGlobalEvent(type, listener, options) {
|
|
950
923
|
window.addEventListener(type, listener, options);
|
|
951
924
|
return (0, _univerjs_core.toDisposable)(() => window.removeEventListener(type, listener, options));
|
|
952
925
|
}
|
|
953
926
|
|
|
954
|
-
|
|
955
|
-
//#region src/services/platform/platform.service.ts
|
|
927
|
+
// src/services/platform/platform.service.ts
|
|
956
928
|
/**
|
|
957
929
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
958
930
|
*
|
|
@@ -981,8 +953,7 @@ var PlatformService = class {
|
|
|
981
953
|
}
|
|
982
954
|
};
|
|
983
955
|
|
|
984
|
-
|
|
985
|
-
//#region src/services/runtime-scope/ui-runtime-scope.service.ts
|
|
956
|
+
// src/services/runtime-scope/ui-runtime-scope.service.ts
|
|
986
957
|
const IUIRuntimeScopeService = (0, _univerjs_core.createIdentifier)("ui.runtime-scope.service");
|
|
987
958
|
var UIRuntimeScopeService = class extends _univerjs_core.Disposable {
|
|
988
959
|
constructor(..._args) {
|
|
@@ -1000,8 +971,7 @@ var UIRuntimeScopeService = class extends _univerjs_core.Disposable {
|
|
|
1000
971
|
}
|
|
1001
972
|
};
|
|
1002
973
|
|
|
1003
|
-
|
|
1004
|
-
//#region src/services/shortcut/shortcut.service.ts
|
|
974
|
+
// src/services/shortcut/shortcut.service.ts
|
|
1005
975
|
const MENU_NAVIGATION_KEYS = /* @__PURE__ */ new Set([
|
|
1006
976
|
13,
|
|
1007
977
|
32,
|
|
@@ -1111,6 +1081,7 @@ let ShortcutService = class ShortcutService extends _univerjs_core.Disposable {
|
|
|
1111
1081
|
}
|
|
1112
1082
|
dispatch(e) {
|
|
1113
1083
|
if (e.isComposing) return;
|
|
1084
|
+
if (!e.ctrlKey && !e.metaKey && !e.altKey && e.target instanceof HTMLButtonElement && (e.key === "Enter" || e.key === " " || e.key === "Tab")) return;
|
|
1114
1085
|
if (e.target instanceof HTMLInputElement && e.target.closest("[data-u-command]")) return;
|
|
1115
1086
|
if (!e.ctrlKey && !e.metaKey && !e.altKey && MENU_NAVIGATION_KEYS.has(e.keyCode) && e.target instanceof HTMLElement && (e.target.matches("button[data-u-command], [data-u-command][role=\"button\"], [data-embed-floating-menu=\"true\"] button, [data-u-command] input") || e.target.closest("[role=\"menu\"]"))) return;
|
|
1116
1087
|
if (this._forceEscapeCount > 0 || this._forceDisabled) return;
|
|
@@ -1162,8 +1133,7 @@ ShortcutService = __decorate([
|
|
|
1162
1133
|
__decorateParam(4, (0, _univerjs_core.Optional)(ILayoutService))
|
|
1163
1134
|
], ShortcutService);
|
|
1164
1135
|
|
|
1165
|
-
|
|
1166
|
-
//#region src/controllers/shared-shortcut.controller.ts
|
|
1136
|
+
// src/controllers/shared-shortcut.controller.ts
|
|
1167
1137
|
function whenEditorFocused(contextService) {
|
|
1168
1138
|
return contextService.getContextValue(_univerjs_core.FOCUSING_UNIVER_EDITOR);
|
|
1169
1139
|
}
|
|
@@ -1257,8 +1227,7 @@ let SharedController = class SharedController extends _univerjs_core.Disposable
|
|
|
1257
1227
|
};
|
|
1258
1228
|
SharedController = __decorate([__decorateParam(0, IShortcutService), __decorateParam(1, _univerjs_core.ICommandService)], SharedController);
|
|
1259
1229
|
|
|
1260
|
-
|
|
1261
|
-
//#region src/services/menu/types.ts
|
|
1230
|
+
// src/services/menu/types.ts
|
|
1262
1231
|
/**
|
|
1263
1232
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
1264
1233
|
*
|
|
@@ -1360,8 +1329,7 @@ let ContextMenuGroup = /* @__PURE__ */ function(ContextMenuGroup) {
|
|
|
1360
1329
|
return ContextMenuGroup;
|
|
1361
1330
|
}({});
|
|
1362
1331
|
|
|
1363
|
-
|
|
1364
|
-
//#region src/services/menu/menu-manager.service.ts
|
|
1332
|
+
// src/services/menu/menu-manager.service.ts
|
|
1365
1333
|
var _MenuManagerService;
|
|
1366
1334
|
const IMenuManagerService = (0, _univerjs_core.createIdentifier)("univer.menu-manager-service");
|
|
1367
1335
|
let MenuManagerService = _MenuManagerService = class MenuManagerService extends _univerjs_core.Disposable {
|
|
@@ -1679,8 +1647,7 @@ function mergeMenuSchemaNode(target, source) {
|
|
|
1679
1647
|
return result;
|
|
1680
1648
|
}
|
|
1681
1649
|
|
|
1682
|
-
|
|
1683
|
-
//#region src/controllers/shortcut-display/shortcut-panel.controller.ts
|
|
1650
|
+
// src/controllers/shortcut-display/shortcut-panel.controller.ts
|
|
1684
1651
|
const ToggleShortcutPanelShortcut = {
|
|
1685
1652
|
id: ToggleShortcutPanelOperation.id,
|
|
1686
1653
|
binding: 4096 | 220,
|
|
@@ -1702,12 +1669,10 @@ ShortcutPanelController = __decorate([
|
|
|
1702
1669
|
__decorateParam(2, _univerjs_core.ICommandService)
|
|
1703
1670
|
], ShortcutPanelController);
|
|
1704
1671
|
|
|
1705
|
-
|
|
1706
|
-
//#region src/services/dialog/dialog.service.ts
|
|
1672
|
+
// src/services/dialog/dialog.service.ts
|
|
1707
1673
|
const IDialogService = (0, _univerjs_core.createIdentifier)("univer.ui.dialog-service");
|
|
1708
1674
|
|
|
1709
|
-
|
|
1710
|
-
//#region src/services/ribbon/ribbon.service.ts
|
|
1675
|
+
// src/services/ribbon/ribbon.service.ts
|
|
1711
1676
|
const IRibbonService = (0, _univerjs_core.createIdentifier)("univer.ribbon-service");
|
|
1712
1677
|
function isSameHiddenMap(previous, current) {
|
|
1713
1678
|
return previous.length === current.length && previous.every((hidden, index) => hidden === current[index]);
|
|
@@ -1871,12 +1836,44 @@ let DesktopRibbonService = class DesktopRibbonService extends _univerjs_core.Dis
|
|
|
1871
1836
|
};
|
|
1872
1837
|
DesktopRibbonService = __decorate([__decorateParam(0, IMenuManagerService), __decorateParam(1, _univerjs_core.IUniverInstanceService)], DesktopRibbonService);
|
|
1873
1838
|
|
|
1874
|
-
|
|
1875
|
-
//#region src/utils/di.ts
|
|
1839
|
+
// src/utils/di.ts
|
|
1876
1840
|
function unwrap(o) {
|
|
1877
1841
|
if (typeof o === "function") return o();
|
|
1878
1842
|
return o;
|
|
1879
1843
|
}
|
|
1844
|
+
function useObservable(observable, defaultValue, shouldHaveSyncValue, deps) {
|
|
1845
|
+
if (typeof observable === "function" && !deps) throw new Error("Expected deps to be provided when observable is a function!");
|
|
1846
|
+
const dependencies = deps ?? [observable];
|
|
1847
|
+
const stateRef = (0, react.useRef)(void 0);
|
|
1848
|
+
const previous = stateRef.current;
|
|
1849
|
+
if (!previous || dependencies.length !== previous.dependencies.length || dependencies.some((value, index) => !Object.is(value, previous.dependencies[index]))) {
|
|
1850
|
+
var _state$source;
|
|
1851
|
+
const state = {
|
|
1852
|
+
dependencies: [...dependencies],
|
|
1853
|
+
source: observable ? unwrap(observable) : null,
|
|
1854
|
+
value: observable && previous ? previous.value : defaultValue,
|
|
1855
|
+
hasSyncValue: false
|
|
1856
|
+
};
|
|
1857
|
+
const subscription = (_state$source = state.source) === null || _state$source === void 0 ? void 0 : _state$source.subscribe((value) => {
|
|
1858
|
+
state.value = value;
|
|
1859
|
+
state.hasSyncValue = true;
|
|
1860
|
+
});
|
|
1861
|
+
subscription === null || subscription === void 0 || subscription.unsubscribe();
|
|
1862
|
+
stateRef.current = state;
|
|
1863
|
+
}
|
|
1864
|
+
const state = stateRef.current;
|
|
1865
|
+
const [, refresh] = (0, react.useReducer)((revision) => revision + 1, 0);
|
|
1866
|
+
(0, react.useLayoutEffect)(() => {
|
|
1867
|
+
var _state$source2;
|
|
1868
|
+
const subscription = (_state$source2 = state.source) === null || _state$source2 === void 0 ? void 0 : _state$source2.subscribe((value) => {
|
|
1869
|
+
state.value = value;
|
|
1870
|
+
refresh();
|
|
1871
|
+
});
|
|
1872
|
+
return () => subscription === null || subscription === void 0 ? void 0 : subscription.unsubscribe();
|
|
1873
|
+
}, [state]);
|
|
1874
|
+
if (shouldHaveSyncValue && !state.hasSyncValue) throw new Error("Expected a synchronous value from the observable.");
|
|
1875
|
+
return state.value;
|
|
1876
|
+
}
|
|
1880
1877
|
function useObservableRef(observable, defaultValue) {
|
|
1881
1878
|
const ref = (0, react.useRef)(defaultValue);
|
|
1882
1879
|
(0, react.useEffect)(() => {
|
|
@@ -1890,8 +1887,7 @@ function useObservableRef(observable, defaultValue) {
|
|
|
1890
1887
|
return ref;
|
|
1891
1888
|
}
|
|
1892
1889
|
|
|
1893
|
-
|
|
1894
|
-
//#region src/views/components/feature-search/FeatureSearch.tsx
|
|
1890
|
+
// src/views/components/feature-search/FeatureSearch.tsx
|
|
1895
1891
|
/**
|
|
1896
1892
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
1897
1893
|
*
|
|
@@ -2017,7 +2013,7 @@ function FeatureSearch() {
|
|
|
2017
2013
|
menuManagerService,
|
|
2018
2014
|
ribbonService
|
|
2019
2015
|
]);
|
|
2020
|
-
const items =
|
|
2016
|
+
const items = useObservable(items$, []);
|
|
2021
2017
|
async function execute(item) {
|
|
2022
2018
|
layoutService.focus();
|
|
2023
2019
|
if (await commandService.executeCommand(item.commandId, item.getParams())) dialogService.close(FEATURE_SEARCH_DIALOG_ID);
|
|
@@ -2057,8 +2053,7 @@ function FeatureSearch() {
|
|
|
2057
2053
|
});
|
|
2058
2054
|
}
|
|
2059
2055
|
|
|
2060
|
-
|
|
2061
|
-
//#region src/commands/operations/open-feature-search.operation.ts
|
|
2056
|
+
// src/commands/operations/open-feature-search.operation.ts
|
|
2062
2057
|
const OpenFeatureSearchOperation = {
|
|
2063
2058
|
id: "ui.operation.open-feature-search",
|
|
2064
2059
|
type: _univerjs_core.CommandType.OPERATION,
|
|
@@ -2076,8 +2071,7 @@ const OpenFeatureSearchOperation = {
|
|
|
2076
2071
|
}
|
|
2077
2072
|
};
|
|
2078
2073
|
|
|
2079
|
-
|
|
2080
|
-
//#region src/services/format-painter/format-painter-canvas.ts
|
|
2074
|
+
// src/services/format-painter/format-painter-canvas.ts
|
|
2081
2075
|
const FORMAT_PAINTER_CURSOR_CSS = `
|
|
2082
2076
|
/* Keep the brush visible while the render engine updates its usual object/text cursors. */
|
|
2083
2077
|
canvas[data-format-painter="available"] {
|
|
@@ -2155,8 +2149,7 @@ function bindFormatPainterCanvas(canvas, session, options) {
|
|
|
2155
2149
|
} };
|
|
2156
2150
|
}
|
|
2157
2151
|
|
|
2158
|
-
|
|
2159
|
-
//#region src/services/format-painter/format-painter-session.service.ts
|
|
2152
|
+
// src/services/format-painter/format-painter-session.service.ts
|
|
2160
2153
|
/** One local interaction session; domain commands retain ownership of persisted formatting. */
|
|
2161
2154
|
var FormatPainterSessionService = class extends _univerjs_core.Disposable {
|
|
2162
2155
|
constructor(..._args) {
|
|
@@ -2263,8 +2256,7 @@ var FormatPainterSessionService = class extends _univerjs_core.Disposable {
|
|
|
2263
2256
|
}
|
|
2264
2257
|
};
|
|
2265
2258
|
|
|
2266
|
-
|
|
2267
|
-
//#region src/controllers/format-painter.controller.ts
|
|
2259
|
+
// src/controllers/format-painter.controller.ts
|
|
2268
2260
|
const ActivateFormatPainterOperation = {
|
|
2269
2261
|
id: "ui.operation.activate-format-painter",
|
|
2270
2262
|
type: _univerjs_core.CommandType.OPERATION,
|
|
@@ -2330,8 +2322,7 @@ FormatPainterController = __decorate([
|
|
|
2330
2322
|
__decorateParam(3, _univerjs_core.IUniverInstanceService)
|
|
2331
2323
|
], FormatPainterController);
|
|
2332
2324
|
|
|
2333
|
-
|
|
2334
|
-
//#region src/menu/feature-search.menu.ts
|
|
2325
|
+
// src/menu/feature-search.menu.ts
|
|
2335
2326
|
function FeatureSearchMenuItemFactory() {
|
|
2336
2327
|
return {
|
|
2337
2328
|
id: OpenFeatureSearchOperation.id,
|
|
@@ -2342,8 +2333,7 @@ function FeatureSearchMenuItemFactory() {
|
|
|
2342
2333
|
};
|
|
2343
2334
|
}
|
|
2344
2335
|
|
|
2345
|
-
|
|
2346
|
-
//#region src/menu/format-painter.menu.ts
|
|
2336
|
+
// src/menu/format-painter.menu.ts
|
|
2347
2337
|
function FormatPainterMenuItemFactory(accessor) {
|
|
2348
2338
|
const session = accessor.get(FormatPainterSessionService);
|
|
2349
2339
|
return {
|
|
@@ -2369,8 +2359,7 @@ function ClearFormattingMenuItemFactory(accessor) {
|
|
|
2369
2359
|
};
|
|
2370
2360
|
}
|
|
2371
2361
|
|
|
2372
|
-
|
|
2373
|
-
//#region src/menu/history.menu.ts
|
|
2362
|
+
// src/menu/history.menu.ts
|
|
2374
2363
|
const undoRedoDisableFactory$ = (accessor, isUndo) => {
|
|
2375
2364
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
2376
2365
|
const contextService = accessor.get(_univerjs_core.IContextService);
|
|
@@ -2402,10 +2391,14 @@ function RedoMenuItemFactory(accessor) {
|
|
|
2402
2391
|
};
|
|
2403
2392
|
}
|
|
2404
2393
|
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2394
|
+
// src/menu/shortcut-panel.menu.ts
|
|
2395
|
+
function ShortcutPanelMenuItemFactory(accessor) {
|
|
2396
|
+
const sidebarService = accessor.get(ISidebarService);
|
|
2408
2397
|
return {
|
|
2398
|
+
activated$: (0, rxjs.defer)(() => sidebarService.sidebarOptions$.pipe((0, rxjs.startWith)(sidebarService.options), (0, rxjs.map)((options) => {
|
|
2399
|
+
var _options$children;
|
|
2400
|
+
return options.visible === true && ((_options$children = options.children) === null || _options$children === void 0 ? void 0 : _options$children.label) === "ShortcutPanel";
|
|
2401
|
+
}), (0, rxjs.distinctUntilChanged)())),
|
|
2409
2402
|
id: ToggleShortcutPanelOperation.id,
|
|
2410
2403
|
title: "ui.toggle-shortcut-panel",
|
|
2411
2404
|
tooltip: "ui.toggle-shortcut-panel",
|
|
@@ -2414,8 +2407,7 @@ function ShortcutPanelMenuItemFactory() {
|
|
|
2414
2407
|
};
|
|
2415
2408
|
}
|
|
2416
2409
|
|
|
2417
|
-
|
|
2418
|
-
//#region src/menu/schema.ts
|
|
2410
|
+
// src/menu/schema.ts
|
|
2419
2411
|
const menuSchema = {
|
|
2420
2412
|
["ribbon.start.history"]: {
|
|
2421
2413
|
[ActivateFormatPainterOperation.id]: {
|
|
@@ -2467,8 +2459,7 @@ const menuSchema = {
|
|
|
2467
2459
|
}
|
|
2468
2460
|
};
|
|
2469
2461
|
|
|
2470
|
-
|
|
2471
|
-
//#region src/services/parts/parts.service.ts
|
|
2462
|
+
// src/services/parts/parts.service.ts
|
|
2472
2463
|
let BuiltInUIPart = /* @__PURE__ */ function(BuiltInUIPart) {
|
|
2473
2464
|
BuiltInUIPart["GLOBAL"] = "global";
|
|
2474
2465
|
BuiltInUIPart["HEADER"] = "header";
|
|
@@ -2564,8 +2555,7 @@ var UIPartsService = class extends _univerjs_core.Disposable {
|
|
|
2564
2555
|
}
|
|
2565
2556
|
};
|
|
2566
2557
|
|
|
2567
|
-
|
|
2568
|
-
//#region src/services/dom/canvas-dom-layer.service.ts
|
|
2558
|
+
// src/services/dom/canvas-dom-layer.service.ts
|
|
2569
2559
|
function shouldForwardFloatDomEvents(layer) {
|
|
2570
2560
|
return layer.eventPassThrough !== false;
|
|
2571
2561
|
}
|
|
@@ -2664,8 +2654,52 @@ var CanvasFloatDomPreviewService = class extends _univerjs_core.Disposable {
|
|
|
2664
2654
|
}
|
|
2665
2655
|
};
|
|
2666
2656
|
|
|
2667
|
-
|
|
2668
|
-
|
|
2657
|
+
// src/views/hooks/prevent-browser-zoom.ts
|
|
2658
|
+
/**
|
|
2659
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2660
|
+
*
|
|
2661
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2662
|
+
* you may not use this file except in compliance with the License.
|
|
2663
|
+
* You may obtain a copy of the License at
|
|
2664
|
+
*
|
|
2665
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2666
|
+
*
|
|
2667
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2668
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2669
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2670
|
+
* See the License for the specific language governing permissions and
|
|
2671
|
+
* limitations under the License.
|
|
2672
|
+
*/
|
|
2673
|
+
function preventBrowserZoomInContainers(containers) {
|
|
2674
|
+
const uniqueContainers = new Set(containers);
|
|
2675
|
+
const handleWheel = (event) => {
|
|
2676
|
+
if (event.ctrlKey || event.metaKey) event.preventDefault();
|
|
2677
|
+
};
|
|
2678
|
+
const handleGesture = (event) => event.preventDefault();
|
|
2679
|
+
uniqueContainers.forEach((container) => {
|
|
2680
|
+
container.addEventListener("wheel", handleWheel, {
|
|
2681
|
+
capture: true,
|
|
2682
|
+
passive: false
|
|
2683
|
+
});
|
|
2684
|
+
container.addEventListener("gesturestart", handleGesture, {
|
|
2685
|
+
capture: true,
|
|
2686
|
+
passive: false
|
|
2687
|
+
});
|
|
2688
|
+
container.addEventListener("gesturechange", handleGesture, {
|
|
2689
|
+
capture: true,
|
|
2690
|
+
passive: false
|
|
2691
|
+
});
|
|
2692
|
+
});
|
|
2693
|
+
return () => {
|
|
2694
|
+
uniqueContainers.forEach((container) => {
|
|
2695
|
+
container.removeEventListener("wheel", handleWheel, true);
|
|
2696
|
+
container.removeEventListener("gesturestart", handleGesture, true);
|
|
2697
|
+
container.removeEventListener("gesturechange", handleGesture, true);
|
|
2698
|
+
});
|
|
2699
|
+
};
|
|
2700
|
+
}
|
|
2701
|
+
|
|
2702
|
+
// src/views/components/dom/float-dom-layout.ts
|
|
2669
2703
|
const LEGACY_WRAPPER_INSET = 2;
|
|
2670
2704
|
const LEGACY_CONTENT_INSET = 4;
|
|
2671
2705
|
function resolveFloatDomLayout(position, contentBox) {
|
|
@@ -2691,8 +2725,7 @@ function resolveFloatDomLayout(position, contentBox) {
|
|
|
2691
2725
|
};
|
|
2692
2726
|
}
|
|
2693
2727
|
|
|
2694
|
-
|
|
2695
|
-
//#region src/views/components/dom/FloatDom.tsx
|
|
2728
|
+
// src/views/components/dom/FloatDom.tsx
|
|
2696
2729
|
function applyFloatDomLayout(wrapper, inner, layout) {
|
|
2697
2730
|
const { wrapper: wrapperLayout, inner: innerLayout } = layout;
|
|
2698
2731
|
const wrapperStyle = wrapper.style;
|
|
@@ -2731,7 +2764,7 @@ function FloatDomSingleContent(props) {
|
|
|
2731
2764
|
var _layer$contentBox, _layer$contentBox2;
|
|
2732
2765
|
const { layer, id, Component } = props;
|
|
2733
2766
|
const univerInstanceService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
2734
|
-
const position =
|
|
2767
|
+
const position = useObservable((0, react.useMemo)(() => layer.position$.pipe((0, rxjs.first)()), [layer.position$]));
|
|
2735
2768
|
const domRef = (0, react.useRef)(null);
|
|
2736
2769
|
const innerDomRef = (0, react.useRef)(null);
|
|
2737
2770
|
const layerProps = (0, react.useMemo)(() => ({
|
|
@@ -2747,6 +2780,13 @@ function FloatDomSingleContent(props) {
|
|
|
2747
2780
|
const wrapperInset = (_layer$contentBox = layer.contentBox) === null || _layer$contentBox === void 0 ? void 0 : _layer$contentBox.wrapperInset;
|
|
2748
2781
|
const contentInset = (_layer$contentBox2 = layer.contentBox) === null || _layer$contentBox2 === void 0 ? void 0 : _layer$contentBox2.contentInset;
|
|
2749
2782
|
const forwardEvents = shouldForwardFloatDomEvents(layer);
|
|
2783
|
+
(0, react.useEffect)(() => {
|
|
2784
|
+
if (forwardEvents && layer.preventBrowserZoom && domRef.current) return preventBrowserZoomInContainers([domRef.current]);
|
|
2785
|
+
}, [
|
|
2786
|
+
forwardEvents,
|
|
2787
|
+
layer.preventBrowserZoom,
|
|
2788
|
+
position
|
|
2789
|
+
]);
|
|
2750
2790
|
(0, react.useEffect)(() => {
|
|
2751
2791
|
const subscription = layer.position$.subscribe((position) => {
|
|
2752
2792
|
if (domRef.current && innerDomRef.current) applyFloatDomLayout(domRef.current, innerDomRef.current, resolveFloatDomLayout(position, {
|
|
@@ -2762,6 +2802,48 @@ function FloatDomSingleContent(props) {
|
|
|
2762
2802
|
layer.position$,
|
|
2763
2803
|
wrapperInset
|
|
2764
2804
|
]);
|
|
2805
|
+
const eventHandlers = (0, react.useMemo)(() => ({
|
|
2806
|
+
wheel: (event) => layer.onWheel(event),
|
|
2807
|
+
pointermove: (event) => layer.onPointerMove(event),
|
|
2808
|
+
pointerdown: (event) => {
|
|
2809
|
+
layer.onPointerDown(event);
|
|
2810
|
+
if (event.target instanceof Element && event.target.isConnected) {
|
|
2811
|
+
var _event$target$setPoin, _event$target;
|
|
2812
|
+
(_event$target$setPoin = (_event$target = event.target).setPointerCapture) === null || _event$target$setPoin === void 0 || _event$target$setPoin.call(_event$target, event.pointerId);
|
|
2813
|
+
}
|
|
2814
|
+
},
|
|
2815
|
+
pointerup: (event) => {
|
|
2816
|
+
try {
|
|
2817
|
+
layer.onPointerUp(event);
|
|
2818
|
+
} finally {
|
|
2819
|
+
var _event$target$hasPoin, _event$target2;
|
|
2820
|
+
if (event.target instanceof Element && ((_event$target$hasPoin = (_event$target2 = event.target).hasPointerCapture) === null || _event$target$hasPoin === void 0 ? void 0 : _event$target$hasPoin.call(_event$target2, event.pointerId))) {
|
|
2821
|
+
var _event$target$release, _event$target3;
|
|
2822
|
+
(_event$target$release = (_event$target3 = event.target).releasePointerCapture) === null || _event$target$release === void 0 || _event$target$release.call(_event$target3, event.pointerId);
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
}
|
|
2826
|
+
}), [layer]);
|
|
2827
|
+
(0, react.useEffect)(() => {
|
|
2828
|
+
const wrapper = domRef.current;
|
|
2829
|
+
if (!forwardEvents || !wrapper || !layer.eventOptions) return;
|
|
2830
|
+
const cleanups = [];
|
|
2831
|
+
const bindEvent = (eventName) => {
|
|
2832
|
+
var _layer$eventOptions;
|
|
2833
|
+
const options = (_layer$eventOptions = layer.eventOptions) === null || _layer$eventOptions === void 0 ? void 0 : _layer$eventOptions[eventName];
|
|
2834
|
+
if (options === void 0) return;
|
|
2835
|
+
const listener = eventHandlers[eventName];
|
|
2836
|
+
wrapper.addEventListener(eventName, listener, options);
|
|
2837
|
+
cleanups.push(() => wrapper.removeEventListener(eventName, listener, options.capture));
|
|
2838
|
+
};
|
|
2839
|
+
for (const eventName of Object.keys(layer.eventOptions)) bindEvent(eventName);
|
|
2840
|
+
return () => cleanups.forEach((cleanup) => cleanup());
|
|
2841
|
+
}, [
|
|
2842
|
+
forwardEvents,
|
|
2843
|
+
eventHandlers,
|
|
2844
|
+
layer.eventOptions,
|
|
2845
|
+
position
|
|
2846
|
+
]);
|
|
2765
2847
|
const instance = univerInstanceService.getUnit(layer.unitId);
|
|
2766
2848
|
const docDisabled = instance instanceof _univerjs_core.DocumentDataModel ? instance.getDisabled() : void 0;
|
|
2767
2849
|
const component = (0, react.useMemo)(() => Component ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
|
|
@@ -2784,44 +2866,24 @@ function FloatDomSingleContent(props) {
|
|
|
2784
2866
|
overflow: floatDomOverflow.outerOverflow,
|
|
2785
2867
|
touchAction: forwardEvents ? "none" : void 0
|
|
2786
2868
|
},
|
|
2787
|
-
|
|
2788
|
-
|
|
2869
|
+
onWheel: (event) => {
|
|
2870
|
+
var _layer$eventOptions2;
|
|
2871
|
+
if (forwardEvents && ((_layer$eventOptions2 = layer.eventOptions) === null || _layer$eventOptions2 === void 0 ? void 0 : _layer$eventOptions2.wheel) === void 0) eventHandlers.wheel(event.nativeEvent);
|
|
2789
2872
|
},
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
var _e$target$setPointerC, _e$target;
|
|
2794
|
-
(_e$target$setPointerC = (_e$target = e.target).setPointerCapture) === null || _e$target$setPointerC === void 0 || _e$target$setPointerC.call(_e$target, e.pointerId);
|
|
2795
|
-
}
|
|
2796
|
-
layer.onPointerDown(e.nativeEvent);
|
|
2797
|
-
}
|
|
2873
|
+
onPointerMove: (event) => {
|
|
2874
|
+
var _layer$eventOptions3;
|
|
2875
|
+
if (forwardEvents && ((_layer$eventOptions3 = layer.eventOptions) === null || _layer$eventOptions3 === void 0 ? void 0 : _layer$eventOptions3.pointermove) === void 0) eventHandlers.pointermove(event.nativeEvent);
|
|
2798
2876
|
},
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
layer.onPointerUp(e.nativeEvent);
|
|
2803
|
-
} finally {
|
|
2804
|
-
var _e$target$hasPointerC, _e$target2;
|
|
2805
|
-
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))) {
|
|
2806
|
-
var _e$target$releasePoin, _e$target3;
|
|
2807
|
-
(_e$target$releasePoin = (_e$target3 = e.target).releasePointerCapture) === null || _e$target$releasePoin === void 0 || _e$target$releasePoin.call(_e$target3, e.pointerId);
|
|
2808
|
-
}
|
|
2809
|
-
}
|
|
2877
|
+
onPointerDown: (event) => {
|
|
2878
|
+
var _layer$eventOptions4;
|
|
2879
|
+
if (forwardEvents && ((_layer$eventOptions4 = layer.eventOptions) === null || _layer$eventOptions4 === void 0 ? void 0 : _layer$eventOptions4.pointerdown) === void 0) eventHandlers.pointerdown(event.nativeEvent);
|
|
2810
2880
|
},
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
layer.onPointerUp(e.nativeEvent);
|
|
2815
|
-
} finally {
|
|
2816
|
-
var _e$target$hasPointerC2, _e$target4;
|
|
2817
|
-
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))) {
|
|
2818
|
-
var _e$target$releasePoin2, _e$target5;
|
|
2819
|
-
(_e$target$releasePoin2 = (_e$target5 = e.target).releasePointerCapture) === null || _e$target$releasePoin2 === void 0 || _e$target$releasePoin2.call(_e$target5, e.pointerId);
|
|
2820
|
-
}
|
|
2821
|
-
}
|
|
2881
|
+
onPointerUp: (event) => {
|
|
2882
|
+
var _layer$eventOptions5;
|
|
2883
|
+
if (forwardEvents && ((_layer$eventOptions5 = layer.eventOptions) === null || _layer$eventOptions5 === void 0 ? void 0 : _layer$eventOptions5.pointerup) === void 0) eventHandlers.pointerup(event.nativeEvent);
|
|
2822
2884
|
},
|
|
2823
|
-
|
|
2824
|
-
if (forwardEvents)
|
|
2885
|
+
onPointerCancel: (event) => {
|
|
2886
|
+
if (forwardEvents) eventHandlers.pointerup(event.nativeEvent);
|
|
2825
2887
|
},
|
|
2826
2888
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2827
2889
|
id,
|
|
@@ -2838,8 +2900,8 @@ function FloatDomSingleContent(props) {
|
|
|
2838
2900
|
const FloatDom = ({ unitId }) => {
|
|
2839
2901
|
const instanceService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
2840
2902
|
const domLayerService = (0, _wendellhu_redi_react_bindings.useDependency)(CanvasFloatDomService);
|
|
2841
|
-
const layers =
|
|
2842
|
-
const currentUnitId = resolveFloatDomCurrentUnitId(unitId,
|
|
2903
|
+
const layers = useObservable(domLayerService.domLayers$);
|
|
2904
|
+
const currentUnitId = resolveFloatDomCurrentUnitId(unitId, useObservable(instanceService.focused$));
|
|
2843
2905
|
(0, react.useEffect)(() => {
|
|
2844
2906
|
if (typeof unitId !== "string") return;
|
|
2845
2907
|
const disposable = domLayerService.registerScopedRenderRoot(unitId);
|
|
@@ -2872,8 +2934,7 @@ function resolveFloatDomOverflow(props) {
|
|
|
2872
2934
|
};
|
|
2873
2935
|
}
|
|
2874
2936
|
|
|
2875
|
-
|
|
2876
|
-
//#region src/services/popup/canvas-popup.service.ts
|
|
2937
|
+
// src/services/popup/canvas-popup.service.ts
|
|
2877
2938
|
const ICanvasPopupService = (0, _univerjs_core.createIdentifier)("ui.popup.service");
|
|
2878
2939
|
var CanvasPopupService = class extends _univerjs_core.Disposable {
|
|
2879
2940
|
constructor(..._args) {
|
|
@@ -2919,8 +2980,7 @@ var CanvasPopupService = class extends _univerjs_core.Disposable {
|
|
|
2919
2980
|
}
|
|
2920
2981
|
};
|
|
2921
2982
|
|
|
2922
|
-
|
|
2923
|
-
//#region src/views/hooks/event.ts
|
|
2983
|
+
// src/views/hooks/event.ts
|
|
2924
2984
|
/**
|
|
2925
2985
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2926
2986
|
*
|
|
@@ -2945,8 +3005,7 @@ function useEvent(func) {
|
|
|
2945
3005
|
}), []);
|
|
2946
3006
|
}
|
|
2947
3007
|
|
|
2948
|
-
|
|
2949
|
-
//#region src/views/components/popup/RectPopup.tsx
|
|
3008
|
+
// src/views/components/popup/RectPopup.tsx
|
|
2950
3009
|
const RectPopupContext = (0, react.createContext)({ current: void 0 });
|
|
2951
3010
|
const RectPopupDirectionContext = (0, react.createContext)("vertical");
|
|
2952
3011
|
/** The popup should have a minimum edge to the boundary. */
|
|
@@ -3109,7 +3168,7 @@ function RectPopup(props) {
|
|
|
3109
3168
|
};
|
|
3110
3169
|
}, [contextMenuFn]);
|
|
3111
3170
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
3112
|
-
const dir =
|
|
3171
|
+
const dir = useObservable(localeService.direction$);
|
|
3113
3172
|
const ele = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [mask && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3114
3173
|
"data-u-comp": "rect-popup-mask",
|
|
3115
3174
|
className: "univer-fixed univer-inset-0 univer-z-[100]",
|
|
@@ -3145,8 +3204,7 @@ RectPopup.calcPopupPosition = calcPopupPosition;
|
|
|
3145
3204
|
RectPopup.useContext = () => (0, react.useContext)(RectPopupContext);
|
|
3146
3205
|
RectPopup.useDirection = () => (0, react.useContext)(RectPopupDirectionContext);
|
|
3147
3206
|
|
|
3148
|
-
|
|
3149
|
-
//#region src/views/components/popup/CanvasPopup.tsx
|
|
3207
|
+
// src/views/components/popup/CanvasPopup.tsx
|
|
3150
3208
|
const SingleCanvasPopup = ({ popup, children }) => {
|
|
3151
3209
|
const anchorRect$ = (0, react.useMemo)(() => popup.anchorRect$.pipe((0, rxjs.throttleTime)(0, rxjs.animationFrameScheduler), (0, rxjs.map)((anchorRect) => {
|
|
3152
3210
|
const { bottom, left, right, top } = anchorRect;
|
|
@@ -3168,7 +3226,7 @@ const SingleCanvasPopup = ({ popup, children }) => {
|
|
|
3168
3226
|
}, [popup.excludeRects$]);
|
|
3169
3227
|
const excludeRectsRef = useObservableRef(excludeRects$, popup.excludeRects);
|
|
3170
3228
|
const { boundaryInsets, canvasElement, constrainToCanvas = false, hideOnInvisible = true, hiddenType = "destroy" } = popup;
|
|
3171
|
-
const hidden =
|
|
3229
|
+
const hidden = useObservable(hideOnInvisible ? () => (0, rxjs.combineLatest)([anchorRect$, hiddenRects$]).pipe((0, rxjs.map)(([rectWithOffset, hiddenRects]) => {
|
|
3172
3230
|
const { top, left, bottom, right } = canvasElement.getBoundingClientRect();
|
|
3173
3231
|
const insetTop = constrainToCanvas ? (boundaryInsets === null || boundaryInsets === void 0 ? void 0 : boundaryInsets.top) ?? 0 : 0;
|
|
3174
3232
|
const insetLeft = constrainToCanvas ? (boundaryInsets === null || boundaryInsets === void 0 ? void 0 : boundaryInsets.left) ?? 0 : 0;
|
|
@@ -3215,7 +3273,7 @@ const SingleCanvasPopup = ({ popup, children }) => {
|
|
|
3215
3273
|
};
|
|
3216
3274
|
function CanvasPopup() {
|
|
3217
3275
|
const popupService = (0, _wendellhu_redi_react_bindings.useDependency)(ICanvasPopupService);
|
|
3218
|
-
return
|
|
3276
|
+
return useObservable(popupService.popups$, void 0, true).map(([key, popup]) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SingleCanvasPopup, {
|
|
3219
3277
|
popup,
|
|
3220
3278
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CanvasPopupContent, { popup })
|
|
3221
3279
|
}, key));
|
|
@@ -3231,8 +3289,7 @@ function CanvasPopupContent({ popup }) {
|
|
|
3231
3289
|
}) : content;
|
|
3232
3290
|
}
|
|
3233
3291
|
|
|
3234
|
-
|
|
3235
|
-
//#region src/services/ribbon/ribbon-override.service.ts
|
|
3292
|
+
// src/services/ribbon/ribbon-override.service.ts
|
|
3236
3293
|
const IRibbonOverrideService = (0, _univerjs_core.createIdentifier)("univer.ribbon-override-service");
|
|
3237
3294
|
var RibbonOverrideService = class extends _univerjs_core.Disposable {
|
|
3238
3295
|
constructor(..._args) {
|
|
@@ -3258,8 +3315,7 @@ var RibbonOverrideService = class extends _univerjs_core.Disposable {
|
|
|
3258
3315
|
}
|
|
3259
3316
|
};
|
|
3260
3317
|
|
|
3261
|
-
|
|
3262
|
-
//#region src/views/components/ComponentContainer.tsx
|
|
3318
|
+
// src/views/components/ComponentContainer.tsx
|
|
3263
3319
|
function ComponentContainer(props) {
|
|
3264
3320
|
const { components, fallback, sharedProps } = props;
|
|
3265
3321
|
if (!components || components.size === 0) return fallback ?? null;
|
|
@@ -3281,9 +3337,9 @@ function useComponentsOfPart(part, injector) {
|
|
|
3281
3337
|
const injectedUIPartsService = (0, _wendellhu_redi_react_bindings.useDependency)(IUIPartsService);
|
|
3282
3338
|
const uiPartsService = (injector === null || injector === void 0 ? void 0 : injector.get(IUIPartsService)) ?? injectedUIPartsService;
|
|
3283
3339
|
const uiVisibleChange$ = (0, react.useMemo)(() => uiPartsService.uiVisibleChange$.pipe((0, rxjs.filter)((ui) => ui.ui === part)), [part, uiPartsService]);
|
|
3284
|
-
const changeInfo =
|
|
3340
|
+
const changeInfo = useObservable(uiVisibleChange$);
|
|
3285
3341
|
const updateCounterRef = (0, react.useRef)(0);
|
|
3286
|
-
const componentPartUpdateCount =
|
|
3342
|
+
const componentPartUpdateCount = useObservable(() => uiPartsService.componentRegistered$.pipe((0, rxjs.filter)((key) => key === part), (0, rxjs.debounceTime)(200), (0, rxjs.map)(() => updateCounterRef.current += 1), (0, rxjs.startWith)(updateCounterRef.current += 1)), void 0, void 0, [
|
|
3287
3343
|
uiPartsService,
|
|
3288
3344
|
part,
|
|
3289
3345
|
changeInfo
|
|
@@ -3291,8 +3347,37 @@ function useComponentsOfPart(part, injector) {
|
|
|
3291
3347
|
return (0, react.useMemo)(() => uiPartsService.isUIVisible(part) ? uiPartsService.getComponents(part) : /* @__PURE__ */ new Set(), [componentPartUpdateCount]);
|
|
3292
3348
|
}
|
|
3293
3349
|
|
|
3294
|
-
|
|
3295
|
-
|
|
3350
|
+
// src/views/components/ribbon/ribbon-menu/use-ribbon-tabs.ts
|
|
3351
|
+
function useRibbonTabs(ribbon, onSelectTab) {
|
|
3352
|
+
const { direction } = (0, react.useContext)(_univerjs_design.ConfigContext);
|
|
3353
|
+
return (event) => {
|
|
3354
|
+
const tabs = Array.from(event.currentTarget.querySelectorAll("[role=\"tab\"]"));
|
|
3355
|
+
const index = tabs.indexOf(event.target);
|
|
3356
|
+
if (index < 0) return;
|
|
3357
|
+
let next;
|
|
3358
|
+
switch (event.key) {
|
|
3359
|
+
case "Home":
|
|
3360
|
+
next = 0;
|
|
3361
|
+
break;
|
|
3362
|
+
case "End":
|
|
3363
|
+
next = tabs.length - 1;
|
|
3364
|
+
break;
|
|
3365
|
+
case "ArrowLeft":
|
|
3366
|
+
next = (index + (direction === "rtl" ? 1 : -1) + tabs.length) % tabs.length;
|
|
3367
|
+
break;
|
|
3368
|
+
case "ArrowRight":
|
|
3369
|
+
next = (index + (direction === "rtl" ? -1 : 1) + tabs.length) % tabs.length;
|
|
3370
|
+
break;
|
|
3371
|
+
default: return;
|
|
3372
|
+
}
|
|
3373
|
+
event.preventDefault();
|
|
3374
|
+
event.stopPropagation();
|
|
3375
|
+
tabs[next].focus();
|
|
3376
|
+
onSelectTab(ribbon[next]);
|
|
3377
|
+
};
|
|
3378
|
+
}
|
|
3379
|
+
|
|
3380
|
+
// src/views/components/ribbon/ribbon-menu/ClassicMenu.tsx
|
|
3296
3381
|
/**
|
|
3297
3382
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3298
3383
|
*
|
|
@@ -3310,15 +3395,18 @@ function useComponentsOfPart(part, injector) {
|
|
|
3310
3395
|
*/
|
|
3311
3396
|
function ClassicMenu({ ribbon, activatedTab, onSelectTab }) {
|
|
3312
3397
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
3398
|
+
const handleKeyDown = useRibbonTabs(ribbon, onSelectTab);
|
|
3313
3399
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3314
3400
|
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",
|
|
3315
3401
|
role: "tablist",
|
|
3402
|
+
onKeyDown: handleKeyDown,
|
|
3316
3403
|
children: ribbon.map((group) => {
|
|
3317
3404
|
const isActive = activatedTab === group.key;
|
|
3318
3405
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3319
3406
|
type: "button",
|
|
3320
3407
|
role: "tab",
|
|
3321
3408
|
"aria-selected": isActive,
|
|
3409
|
+
tabIndex: isActive ? 0 : -1,
|
|
3322
3410
|
title: localeService.t(group.title || group.key),
|
|
3323
3411
|
onClick: () => onSelectTab(group),
|
|
3324
3412
|
className: (0, _univerjs_design.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"),
|
|
@@ -3328,8 +3416,7 @@ function ClassicMenu({ ribbon, activatedTab, onSelectTab }) {
|
|
|
3328
3416
|
});
|
|
3329
3417
|
}
|
|
3330
3418
|
|
|
3331
|
-
|
|
3332
|
-
//#region src/views/components/ribbon/ribbon-menu/DefaultMenu.tsx
|
|
3419
|
+
// src/views/components/ribbon/ribbon-menu/DefaultMenu.tsx
|
|
3333
3420
|
const iconMap = {
|
|
3334
3421
|
["ribbon.start"]: _univerjs_icons.HomeIcon,
|
|
3335
3422
|
["ribbon.insert"]: _univerjs_icons.InsertIcon,
|
|
@@ -3391,15 +3478,31 @@ function DefaultMenu({ ribbon, activatedTab, onSelectTab }) {
|
|
|
3391
3478
|
});
|
|
3392
3479
|
}
|
|
3393
3480
|
|
|
3394
|
-
|
|
3395
|
-
|
|
3481
|
+
// src/views/components/ribbon/ribbon-menu/RibbonGridMenu.tsx
|
|
3482
|
+
/**
|
|
3483
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3484
|
+
*
|
|
3485
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3486
|
+
* you may not use this file except in compliance with the License.
|
|
3487
|
+
* You may obtain a copy of the License at
|
|
3488
|
+
*
|
|
3489
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3490
|
+
*
|
|
3491
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3492
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3493
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3494
|
+
* See the License for the specific language governing permissions and
|
|
3495
|
+
* limitations under the License.
|
|
3496
|
+
*/
|
|
3396
3497
|
function RibbonGridMenu({ ribbon, activatedTab, onSelectTab }) {
|
|
3397
3498
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
3499
|
+
const handleKeyDown = useRibbonTabs(ribbon, onSelectTab);
|
|
3398
3500
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3399
3501
|
"data-testid": "ribbon-grid-menu",
|
|
3400
3502
|
"data-u-comp": "ribbon-grid-menu",
|
|
3401
3503
|
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",
|
|
3402
3504
|
role: "tablist",
|
|
3505
|
+
onKeyDown: handleKeyDown,
|
|
3403
3506
|
children: ribbon.map((group) => {
|
|
3404
3507
|
const isActive = activatedTab === group.key;
|
|
3405
3508
|
const title = localeService.t(group.title || group.key);
|
|
@@ -3407,6 +3510,7 @@ function RibbonGridMenu({ ribbon, activatedTab, onSelectTab }) {
|
|
|
3407
3510
|
type: "button",
|
|
3408
3511
|
role: "tab",
|
|
3409
3512
|
"aria-selected": isActive,
|
|
3513
|
+
tabIndex: isActive ? 0 : -1,
|
|
3410
3514
|
title,
|
|
3411
3515
|
onClick: () => onSelectTab(group),
|
|
3412
3516
|
className: (0, _univerjs_design.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"),
|
|
@@ -3416,8 +3520,7 @@ function RibbonGridMenu({ ribbon, activatedTab, onSelectTab }) {
|
|
|
3416
3520
|
});
|
|
3417
3521
|
}
|
|
3418
3522
|
|
|
3419
|
-
|
|
3420
|
-
//#region src/views/components/ribbon/ribbon-grid-layout.ts
|
|
3523
|
+
// src/views/components/ribbon/ribbon-grid-layout.ts
|
|
3421
3524
|
const RIBBON_GRID_ROWS = 2;
|
|
3422
3525
|
function placeRibbonGridItems(items) {
|
|
3423
3526
|
const occupied = /* @__PURE__ */ new Set();
|
|
@@ -3445,6 +3548,7 @@ function placeRibbonGridItems(items) {
|
|
|
3445
3548
|
columnSpan,
|
|
3446
3549
|
showLabel: layout.showLabel ?? false,
|
|
3447
3550
|
width: layout.width,
|
|
3551
|
+
minWidth: layout.minWidth,
|
|
3448
3552
|
iconSize: layout.iconSize
|
|
3449
3553
|
};
|
|
3450
3554
|
if (cells.some((cell) => occupied.has(cell))) {
|
|
@@ -3470,13 +3574,25 @@ function placeRibbonGridItems(items) {
|
|
|
3470
3574
|
columnSpan,
|
|
3471
3575
|
showLabel: (layout === null || layout === void 0 ? void 0 : layout.showLabel) ?? false,
|
|
3472
3576
|
width: layout === null || layout === void 0 ? void 0 : layout.width,
|
|
3577
|
+
minWidth: layout === null || layout === void 0 ? void 0 : layout.minWidth,
|
|
3473
3578
|
iconSize: layout === null || layout === void 0 ? void 0 : layout.iconSize
|
|
3474
3579
|
});
|
|
3475
3580
|
}
|
|
3476
|
-
return items.map((item) => placements.get(item));
|
|
3581
|
+
return items.map((item) => placements.get(item)).sort((a, b) => a.row - b.row || a.column - b.column);
|
|
3477
3582
|
}
|
|
3478
3583
|
function isValidGridGeometry(layout, rowSpan, cells) {
|
|
3479
|
-
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);
|
|
3584
|
+
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);
|
|
3585
|
+
}
|
|
3586
|
+
function groupRibbonOverflowItems(items) {
|
|
3587
|
+
const placements = placeRibbonGridItems(items);
|
|
3588
|
+
const groups = [];
|
|
3589
|
+
placements.forEach((placement, index) => {
|
|
3590
|
+
var _placement$item$item, _previous$item$item;
|
|
3591
|
+
const previous = placements[index - 1];
|
|
3592
|
+
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([]);
|
|
3593
|
+
groups[groups.length - 1].push(placement.item);
|
|
3594
|
+
});
|
|
3595
|
+
return groups;
|
|
3480
3596
|
}
|
|
3481
3597
|
function findFirstAvailableCells(occupied, rowSpan, columnSpan) {
|
|
3482
3598
|
for (let column = 1;; column++) for (let row = 1; row + rowSpan - 1 <= RIBBON_GRID_ROWS; row++) {
|
|
@@ -3500,8 +3616,108 @@ function getCells(row, column, rowSpan, columnSpan) {
|
|
|
3500
3616
|
return cells;
|
|
3501
3617
|
}
|
|
3502
3618
|
|
|
3503
|
-
|
|
3504
|
-
|
|
3619
|
+
// src/services/contextmenu/contextmenu-host.service.ts
|
|
3620
|
+
const IContextMenuHostService = (0, _univerjs_core.createIdentifier)("ui.contextmenu.host.service");
|
|
3621
|
+
var ContextMenuHostService = class extends _univerjs_core.Disposable {
|
|
3622
|
+
constructor(..._args) {
|
|
3623
|
+
super(..._args);
|
|
3624
|
+
_defineProperty(this, "_menuMap", /* @__PURE__ */ new Map());
|
|
3625
|
+
_defineProperty(this, "_activeMenuId$", new rxjs.BehaviorSubject(null));
|
|
3626
|
+
_defineProperty(this, "_suspensions", /* @__PURE__ */ new Set());
|
|
3627
|
+
_defineProperty(this, "_revision", 0);
|
|
3628
|
+
_defineProperty(this, "activeMenuId$", this._activeMenuId$.asObservable());
|
|
3629
|
+
}
|
|
3630
|
+
get activeMenuId() {
|
|
3631
|
+
return this._activeMenuId$.value;
|
|
3632
|
+
}
|
|
3633
|
+
get revision() {
|
|
3634
|
+
return this._revision;
|
|
3635
|
+
}
|
|
3636
|
+
get suspended() {
|
|
3637
|
+
return this._disposed || this._suspensions.size > 0;
|
|
3638
|
+
}
|
|
3639
|
+
registerMenu(menuId, hide) {
|
|
3640
|
+
this.ensureNotDisposed();
|
|
3641
|
+
this._menuMap.set(menuId, hide);
|
|
3642
|
+
return (0, _univerjs_core.toDisposable)(() => {
|
|
3643
|
+
this._menuMap.delete(menuId);
|
|
3644
|
+
if (this.activeMenuId === menuId) this._activeMenuId$.next(null);
|
|
3645
|
+
});
|
|
3646
|
+
}
|
|
3647
|
+
activateMenu(menuId) {
|
|
3648
|
+
if (this.suspended) return;
|
|
3649
|
+
this.hideActiveMenu(menuId);
|
|
3650
|
+
this._activeMenuId$.next(menuId);
|
|
3651
|
+
}
|
|
3652
|
+
deactivateMenu(menuId) {
|
|
3653
|
+
if (this.activeMenuId === menuId) this._activeMenuId$.next(null);
|
|
3654
|
+
}
|
|
3655
|
+
hideActiveMenu(exceptMenuId) {
|
|
3656
|
+
const activeMenuId = this.activeMenuId;
|
|
3657
|
+
if (!activeMenuId || activeMenuId === exceptMenuId) return;
|
|
3658
|
+
const hide = this._menuMap.get(activeMenuId);
|
|
3659
|
+
this._activeMenuId$.next(null);
|
|
3660
|
+
hide === null || hide === void 0 || hide(true);
|
|
3661
|
+
}
|
|
3662
|
+
closeAll() {
|
|
3663
|
+
++this._revision;
|
|
3664
|
+
this._activeMenuId$.next(null);
|
|
3665
|
+
Array.from(this._menuMap.values()).forEach((hide) => hide(false));
|
|
3666
|
+
}
|
|
3667
|
+
suspend() {
|
|
3668
|
+
this.ensureNotDisposed();
|
|
3669
|
+
const token = Symbol("menu-suspension");
|
|
3670
|
+
this._suspensions.add(token);
|
|
3671
|
+
try {
|
|
3672
|
+
this.closeAll();
|
|
3673
|
+
} catch (error) {
|
|
3674
|
+
this._suspensions.delete(token);
|
|
3675
|
+
throw error;
|
|
3676
|
+
}
|
|
3677
|
+
return (0, _univerjs_core.toDisposable)(() => this._suspensions.delete(token));
|
|
3678
|
+
}
|
|
3679
|
+
dispose() {
|
|
3680
|
+
if (this._disposed) return;
|
|
3681
|
+
super.dispose();
|
|
3682
|
+
try {
|
|
3683
|
+
this.closeAll();
|
|
3684
|
+
} finally {
|
|
3685
|
+
this._menuMap.clear();
|
|
3686
|
+
this._suspensions.clear();
|
|
3687
|
+
this._activeMenuId$.complete();
|
|
3688
|
+
}
|
|
3689
|
+
}
|
|
3690
|
+
};
|
|
3691
|
+
|
|
3692
|
+
// src/utils/use-menu-host.ts
|
|
3693
|
+
/**
|
|
3694
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3695
|
+
*
|
|
3696
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3697
|
+
* you may not use this file except in compliance with the License.
|
|
3698
|
+
* You may obtain a copy of the License at
|
|
3699
|
+
*
|
|
3700
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3701
|
+
*
|
|
3702
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3703
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3704
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3705
|
+
* See the License for the specific language governing permissions and
|
|
3706
|
+
* limitations under the License.
|
|
3707
|
+
*/
|
|
3708
|
+
function useMenuHost(onClose) {
|
|
3709
|
+
const service = (0, _wendellhu_redi_react_bindings.useDependency)(IContextMenuHostService);
|
|
3710
|
+
const callbackRef = (0, react.useRef)(onClose);
|
|
3711
|
+
callbackRef.current = onClose;
|
|
3712
|
+
(0, react.useEffect)(() => {
|
|
3713
|
+
const registration = service.registerMenu(Symbol("menu"), () => callbackRef.current());
|
|
3714
|
+
if (service.suspended) callbackRef.current();
|
|
3715
|
+
return () => registration.dispose();
|
|
3716
|
+
}, [service]);
|
|
3717
|
+
return service;
|
|
3718
|
+
}
|
|
3719
|
+
|
|
3720
|
+
// src/views/components/ribbon/ToolbarButton.tsx
|
|
3505
3721
|
/**
|
|
3506
3722
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3507
3723
|
*
|
|
@@ -3523,7 +3739,8 @@ univer-justify-center univer-rounded univer-border-none univer-bg-transparent un
|
|
|
3523
3739
|
univer-text-gray-900 univer-outline-none univer-transition-colors univer-animate-in univer-fade-in
|
|
3524
3740
|
dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-700 dark:disabled:!univer-text-gray-600
|
|
3525
3741
|
disabled:univer-cursor-not-allowed disabled:univer-text-gray-300 disabled:hover:univer-bg-transparent
|
|
3526
|
-
hover:univer-bg-gray-100 whitespace-nowrap univer-w-max
|
|
3742
|
+
hover:univer-bg-gray-100 univer-whitespace-nowrap univer-w-max
|
|
3743
|
+
focus-visible:univer-ring-2 focus-visible:univer-ring-inset focus-visible:univer-ring-primary-600
|
|
3527
3744
|
[&_svg]:univer-shrink-0
|
|
3528
3745
|
`;
|
|
3529
3746
|
const toolbarButtonVariants = (0, _univerjs_design.cva)(toolbarButtonClassName, {
|
|
@@ -3577,8 +3794,7 @@ function ToolbarButton(props) {
|
|
|
3577
3794
|
});
|
|
3578
3795
|
}
|
|
3579
3796
|
|
|
3580
|
-
|
|
3581
|
-
//#region src/views/custom-label/CustomLabel.tsx
|
|
3797
|
+
// src/views/custom-label/CustomLabel.tsx
|
|
3582
3798
|
/**
|
|
3583
3799
|
* The component to render toolbar item label and menu item label.
|
|
3584
3800
|
* @param props
|
|
@@ -3588,9 +3804,9 @@ function CustomLabel(props) {
|
|
|
3588
3804
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
3589
3805
|
const componentManager = (0, _wendellhu_redi_react_bindings.useDependency)(ComponentManager);
|
|
3590
3806
|
const iconManager = (0, _wendellhu_redi_react_bindings.useDependency)(IconManager);
|
|
3591
|
-
const subscribedValue =
|
|
3807
|
+
const subscribedValue = useObservable(value$ ?? null, value);
|
|
3592
3808
|
const observableIcon = (0, rxjs.isObservable)(icon) ? icon : null;
|
|
3593
|
-
const subscribedIcon =
|
|
3809
|
+
const subscribedIcon = useObservable(observableIcon, "");
|
|
3594
3810
|
const realIcon = (0, rxjs.isObservable)(icon) ? subscribedIcon : icon ?? "";
|
|
3595
3811
|
const nodes = [];
|
|
3596
3812
|
let index = 0;
|
|
@@ -3638,8 +3854,7 @@ function CustomLabel(props) {
|
|
|
3638
3854
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: nodes });
|
|
3639
3855
|
}
|
|
3640
3856
|
|
|
3641
|
-
|
|
3642
|
-
//#region src/views/components/ribbon/hook.ts
|
|
3857
|
+
// src/views/components/ribbon/hook.ts
|
|
3643
3858
|
/**
|
|
3644
3859
|
* Subscribe to a menu item's status change and return the latest status.
|
|
3645
3860
|
* @param menuItem The menu item
|
|
@@ -3655,16 +3870,16 @@ function useToolbarItemStatus(menuItem) {
|
|
|
3655
3870
|
selectionsValue$ = selections === null || selections === void 0 || (_selections$ = selections[0]) === null || _selections$ === void 0 ? void 0 : _selections$.value$;
|
|
3656
3871
|
}
|
|
3657
3872
|
}
|
|
3658
|
-
const disabled =
|
|
3659
|
-
const activated =
|
|
3660
|
-
const hidden =
|
|
3873
|
+
const disabled = useObservable(disabled$ ?? null, false);
|
|
3874
|
+
const activated = useObservable(activated$ ?? null, false);
|
|
3875
|
+
const hidden = useObservable(hidden$ ?? null, false);
|
|
3661
3876
|
const valueObservable = (0, react.useMemo)(() => (0, rxjs.merge)(value$ ?? rxjs.EMPTY, selectionsValue$ ?? rxjs.EMPTY), [selectionsValue$, value$]);
|
|
3662
3877
|
return {
|
|
3663
3878
|
disabled,
|
|
3664
|
-
value:
|
|
3879
|
+
value: useObservable(valueObservable),
|
|
3665
3880
|
activated,
|
|
3666
3881
|
hidden,
|
|
3667
|
-
selectionsValue:
|
|
3882
|
+
selectionsValue: useObservable(selectionsValue$ ?? null)
|
|
3668
3883
|
};
|
|
3669
3884
|
}
|
|
3670
3885
|
function useToolbarShortcutDisplay({ id, commandId, shortcut }) {
|
|
@@ -3675,11 +3890,10 @@ function useToolbarShortcutDisplay({ id, commandId, shortcut }) {
|
|
|
3675
3890
|
shortcutService,
|
|
3676
3891
|
shortcutCommandId
|
|
3677
3892
|
]);
|
|
3678
|
-
return
|
|
3893
|
+
return useObservable(shortcut$, null, true);
|
|
3679
3894
|
}
|
|
3680
3895
|
|
|
3681
|
-
|
|
3682
|
-
//#region src/services/font.service.ts
|
|
3896
|
+
// src/services/font.service.ts
|
|
3683
3897
|
const IFontService = (0, _univerjs_core.createIdentifier)("univer.font-service");
|
|
3684
3898
|
let FontCategory = /* @__PURE__ */ function(FontCategory) {
|
|
3685
3899
|
FontCategory["SANS_SERIF"] = "sans-serif";
|
|
@@ -3970,22 +4184,20 @@ let FontService = class FontService {
|
|
|
3970
4184
|
};
|
|
3971
4185
|
FontService = __decorate([__decorateParam(0, _univerjs_core.IConfigService)], FontService);
|
|
3972
4186
|
|
|
3973
|
-
|
|
3974
|
-
//#region src/views/font-family/use-font-list.ts
|
|
4187
|
+
// src/views/font-family/use-font-list.ts
|
|
3975
4188
|
function useFontList() {
|
|
3976
4189
|
const fontService = (0, _wendellhu_redi_react_bindings.useDependency)(IFontService);
|
|
3977
4190
|
return {
|
|
3978
|
-
fonts:
|
|
4191
|
+
fonts: useObservable(fontService.fonts$, fontService.getFonts()),
|
|
3979
4192
|
fontService
|
|
3980
4193
|
};
|
|
3981
4194
|
}
|
|
3982
4195
|
|
|
3983
|
-
|
|
3984
|
-
//#region src/views/font-family/FontFamilyItem.tsx
|
|
4196
|
+
// src/views/font-family/FontFamilyItem.tsx
|
|
3985
4197
|
const FONT_FAMILY_ITEM_COMPONENT = "UI_FONT_FAMILY_ITEM_COMPONENT";
|
|
3986
4198
|
const FontFamilyItem = ({ value, onChange }) => {
|
|
3987
4199
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
3988
|
-
const direction =
|
|
4200
|
+
const direction = useObservable(localeService.direction$, localeService.getDirection());
|
|
3989
4201
|
const { fonts, fontService } = useFontList();
|
|
3990
4202
|
function handleSelectFont(nextValue) {
|
|
3991
4203
|
onChange(nextValue);
|
|
@@ -4007,12 +4219,20 @@ const FontFamilyItem = ({ value, onChange }) => {
|
|
|
4007
4219
|
});
|
|
4008
4220
|
};
|
|
4009
4221
|
|
|
4010
|
-
|
|
4011
|
-
//#region src/views/components/ribbon/TooltipButtonWrapper.tsx
|
|
4222
|
+
// src/views/components/ribbon/TooltipButtonWrapper.tsx
|
|
4012
4223
|
const TooltipWrapperContext = (0, react.createContext)({
|
|
4013
4224
|
dropdownVisible: false,
|
|
4014
|
-
setDropdownVisible: (_visible) => {}
|
|
4225
|
+
setDropdownVisible: (_visible) => {},
|
|
4226
|
+
restoreTriggerFocus: (_event) => {}
|
|
4015
4227
|
});
|
|
4228
|
+
function ToolbarDropdownButton(props) {
|
|
4229
|
+
const { dropdownVisible } = (0, react.useContext)(TooltipWrapperContext);
|
|
4230
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
4231
|
+
...props,
|
|
4232
|
+
type: "button",
|
|
4233
|
+
"aria-expanded": dropdownVisible
|
|
4234
|
+
});
|
|
4235
|
+
}
|
|
4016
4236
|
const ToolbarDropdownContext = (0, react.createContext)(null);
|
|
4017
4237
|
/**
|
|
4018
4238
|
* Keeps toolbar tooltips controlled while a related popup opens and closes.
|
|
@@ -4047,17 +4267,56 @@ function ToolbarDropdownProvider(props) {
|
|
|
4047
4267
|
const TooltipWrapper = (0, react.forwardRef)((props, ref) => {
|
|
4048
4268
|
const { children, dropdownKey, ...tooltipProps } = props;
|
|
4049
4269
|
const spanRef = (0, react.useRef)(null);
|
|
4270
|
+
const triggerFocusRef = (0, react.useRef)(null);
|
|
4050
4271
|
const [localDropdownVisible, setLocalDropdownVisible] = (0, react.useState)(false);
|
|
4051
4272
|
const toolbarDropdownContext = (0, react.useContext)(ToolbarDropdownContext);
|
|
4052
4273
|
const dropdownVisible = dropdownKey && toolbarDropdownContext ? toolbarDropdownContext.openDropdownKey === dropdownKey : localDropdownVisible;
|
|
4274
|
+
const menuHost = useMenuHost(() => {
|
|
4275
|
+
if (dropdownVisible) {
|
|
4276
|
+
triggerFocusRef.current = null;
|
|
4277
|
+
if (dropdownKey && toolbarDropdownContext) toolbarDropdownContext.setOpenDropdownKey(null);
|
|
4278
|
+
else setLocalDropdownVisible(false);
|
|
4279
|
+
}
|
|
4280
|
+
});
|
|
4281
|
+
const openRevisionRef = (0, react.useRef)(menuHost.revision);
|
|
4053
4282
|
const handleChangeDropdownVisible = (0, react.useCallback)((visible) => {
|
|
4283
|
+
if (visible) {
|
|
4284
|
+
var _spanRef$current, _spanRef$current2;
|
|
4285
|
+
if (menuHost.suspended) return;
|
|
4286
|
+
openRevisionRef.current = menuHost.revision;
|
|
4287
|
+
const active = (_spanRef$current = spanRef.current) === null || _spanRef$current === void 0 ? void 0 : _spanRef$current.ownerDocument.activeElement;
|
|
4288
|
+
triggerFocusRef.current = active instanceof HTMLElement && ((_spanRef$current2 = spanRef.current) === null || _spanRef$current2 === void 0 ? void 0 : _spanRef$current2.contains(active)) ? active : null;
|
|
4289
|
+
}
|
|
4054
4290
|
if (dropdownKey && toolbarDropdownContext) toolbarDropdownContext.setOpenDropdownKey(visible ? dropdownKey : null);
|
|
4055
4291
|
else setLocalDropdownVisible(visible);
|
|
4056
|
-
}, [
|
|
4292
|
+
}, [
|
|
4293
|
+
dropdownKey,
|
|
4294
|
+
toolbarDropdownContext,
|
|
4295
|
+
menuHost
|
|
4296
|
+
]);
|
|
4297
|
+
const restoreTriggerFocus = (0, react.useCallback)((event) => {
|
|
4298
|
+
if (openRevisionRef.current !== menuHost.revision || menuHost.suspended) {
|
|
4299
|
+
event.preventDefault();
|
|
4300
|
+
return;
|
|
4301
|
+
}
|
|
4302
|
+
const trigger = triggerFocusRef.current;
|
|
4303
|
+
triggerFocusRef.current = null;
|
|
4304
|
+
if (!(trigger === null || trigger === void 0 ? void 0 : trigger.isConnected)) return;
|
|
4305
|
+
const active = trigger.ownerDocument.activeElement;
|
|
4306
|
+
if (active === trigger.ownerDocument.body || event.target instanceof HTMLElement && event.target.contains(active)) {
|
|
4307
|
+
event.preventDefault();
|
|
4308
|
+
trigger.focus({ preventScroll: true });
|
|
4309
|
+
}
|
|
4310
|
+
}, [menuHost]);
|
|
4057
4311
|
const contextValue = (0, react.useMemo)(() => ({
|
|
4058
4312
|
dropdownVisible,
|
|
4059
|
-
setDropdownVisible: handleChangeDropdownVisible
|
|
4060
|
-
|
|
4313
|
+
setDropdownVisible: handleChangeDropdownVisible,
|
|
4314
|
+
restoreTriggerFocus
|
|
4315
|
+
}), [
|
|
4316
|
+
dropdownVisible,
|
|
4317
|
+
handleChangeDropdownVisible,
|
|
4318
|
+
restoreTriggerFocus
|
|
4319
|
+
]);
|
|
4061
4320
|
(0, react.useImperativeHandle)(ref, () => ({ el: spanRef.current }));
|
|
4062
4321
|
const content = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4063
4322
|
ref: spanRef,
|
|
@@ -4075,7 +4334,7 @@ const TooltipWrapper = (0, react.forwardRef)((props, ref) => {
|
|
|
4075
4334
|
function DropdownWrapper(props) {
|
|
4076
4335
|
const { children, overlay, disabled, align, dropdownComponent: DropdownComponent = _univerjs_design.Dropdown } = props;
|
|
4077
4336
|
const { direction } = (0, react.useContext)(_univerjs_design.ConfigContext);
|
|
4078
|
-
const { dropdownVisible, setDropdownVisible } = (0, react.useContext)(TooltipWrapperContext);
|
|
4337
|
+
const { dropdownVisible, setDropdownVisible, restoreTriggerFocus } = (0, react.useContext)(TooltipWrapperContext);
|
|
4079
4338
|
const triggerRef = (0, react.useRef)(null);
|
|
4080
4339
|
const overlayRef = (0, react.useRef)(null);
|
|
4081
4340
|
(0, react.useEffect)(() => {
|
|
@@ -4112,6 +4371,7 @@ function DropdownWrapper(props) {
|
|
|
4112
4371
|
disabled,
|
|
4113
4372
|
open: dropdownVisible,
|
|
4114
4373
|
onOpenChange: handleVisibleChange,
|
|
4374
|
+
onCloseAutoFocus: restoreTriggerFocus,
|
|
4115
4375
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4116
4376
|
ref: triggerRef,
|
|
4117
4377
|
className: "univer-h-full",
|
|
@@ -4153,7 +4413,9 @@ function DropdownMenuLabel({ icon, value, option, preserveStrokeWidth, onOptionS
|
|
|
4153
4413
|
});
|
|
4154
4414
|
}
|
|
4155
4415
|
function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled, preserveStrokeWidth, onOptionSelect, dropdownComponent, dropdownMenuComponent: DropdownMenuComponent = _univerjs_design.DropdownMenu }) {
|
|
4156
|
-
const { dropdownVisible, setDropdownVisible } = (0, react.useContext)(TooltipWrapperContext);
|
|
4416
|
+
const { dropdownVisible, setDropdownVisible, restoreTriggerFocus } = (0, react.useContext)(TooltipWrapperContext);
|
|
4417
|
+
const menuHost = (0, _wendellhu_redi_react_bindings.useDependency)(IContextMenuHostService);
|
|
4418
|
+
const openRevisionRef = (0, react.useRef)(menuHost.revision);
|
|
4157
4419
|
const shortcutService = (0, _wendellhu_redi_react_bindings.useDependency)(IShortcutService);
|
|
4158
4420
|
const contextService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.IContextService);
|
|
4159
4421
|
const instanceService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
@@ -4201,7 +4463,7 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
4201
4463
|
]);
|
|
4202
4464
|
const menuManagerService = (0, _wendellhu_redi_react_bindings.useDependency)(IMenuManagerService);
|
|
4203
4465
|
const resolveMenuItems = () => menuId ? menuManagerService.getMenuByPositionKey(menuId) : [];
|
|
4204
|
-
const menuItems =
|
|
4466
|
+
const menuItems = useObservable(() => menuManagerService.menuChanged$.pipe((0, rxjs.map)(resolveMenuItems), (0, rxjs.startWith)(resolveMenuItems())), resolveMenuItems(), false, [menuId, menuManagerService]);
|
|
4205
4467
|
const hiddenStates$ = (0, react.useMemo)(() => {
|
|
4206
4468
|
const itemStates = menuItems.map((item) => {
|
|
4207
4469
|
var _item$item;
|
|
@@ -4215,7 +4477,7 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
4215
4477
|
[key]: hidden
|
|
4216
4478
|
}), {}), (0, rxjs.startWith)({})) : (0, rxjs.of)({});
|
|
4217
4479
|
}, [menuItems]);
|
|
4218
|
-
const hiddenStates =
|
|
4480
|
+
const hiddenStates = useObservable(hiddenStates$, {});
|
|
4219
4481
|
const filteredMenuItems = (0, react.useMemo)(() => {
|
|
4220
4482
|
return menuItems.filter((item) => {
|
|
4221
4483
|
var _item$key;
|
|
@@ -4227,6 +4489,8 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
4227
4489
|
function handleVisibleChange(visible) {
|
|
4228
4490
|
if (visible) {
|
|
4229
4491
|
var _workbook$getActiveSh;
|
|
4492
|
+
if (menuHost.suspended) return;
|
|
4493
|
+
openRevisionRef.current = menuHost.revision;
|
|
4230
4494
|
const element = document.activeElement;
|
|
4231
4495
|
const workbook = contextService.getContextValue(_univerjs_core.FOCUSING_SHEET) ? instanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET) : null;
|
|
4232
4496
|
const sheetId = workbook === null || workbook === void 0 || (_workbook$getActiveSh = workbook.getActiveSheet()) === null || _workbook$getActiveSh === void 0 ? void 0 : _workbook$getActiveSh.getSheetId();
|
|
@@ -4247,6 +4511,10 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
4247
4511
|
function handleCloseAutoFocus(event) {
|
|
4248
4512
|
const editorFocus = editorFocusRef.current;
|
|
4249
4513
|
editorFocusRef.current = null;
|
|
4514
|
+
if (openRevisionRef.current !== menuHost.revision || menuHost.suspended) {
|
|
4515
|
+
event.preventDefault();
|
|
4516
|
+
return;
|
|
4517
|
+
}
|
|
4250
4518
|
if (sheetTargetRef.current && !sheetTargetRef.current.valid) {
|
|
4251
4519
|
event.preventDefault();
|
|
4252
4520
|
const activeElement = document.activeElement;
|
|
@@ -4254,6 +4522,10 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
4254
4522
|
if (activeElement === document.body || focusInClosingMenu) layoutService.focus();
|
|
4255
4523
|
return;
|
|
4256
4524
|
}
|
|
4525
|
+
if (!editorFocus) {
|
|
4526
|
+
restoreTriggerFocus(event);
|
|
4527
|
+
return;
|
|
4528
|
+
}
|
|
4257
4529
|
if (!(editorFocus === null || editorFocus === void 0 ? void 0 : editorFocus.element.isConnected) || getEmbedBoundaryOwner(editorFocus.element) !== editorFocus.owner) return;
|
|
4258
4530
|
const activeElement = editorFocus.element.ownerDocument.activeElement;
|
|
4259
4531
|
const focusInClosingMenu = event.target instanceof HTMLElement && event.target.contains(activeElement);
|
|
@@ -4421,17 +4693,16 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
4421
4693
|
}
|
|
4422
4694
|
}
|
|
4423
4695
|
|
|
4424
|
-
|
|
4425
|
-
//#region src/views/components/ribbon/ToolbarItem.tsx
|
|
4696
|
+
// src/views/components/ribbon/ToolbarItem.tsx
|
|
4426
4697
|
const toolbarDisabledClassName = "univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:!univer-text-gray-600";
|
|
4427
|
-
const toolbarButtonSelectorRootVariants = (0, _univerjs_design.cva)("univer-toolbar-button-selector-root univer-animate-in univer-fade-in univer-group univer-relative univer-flex univer-h-
|
|
4698
|
+
const toolbarButtonSelectorRootVariants = (0, _univerjs_design.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", {
|
|
4428
4699
|
variants: { disabled: {
|
|
4429
4700
|
true: toolbarDisabledClassName,
|
|
4430
4701
|
false: "univer-text-gray-900 dark:!univer-text-gray-0"
|
|
4431
4702
|
} },
|
|
4432
4703
|
defaultVariants: { disabled: false }
|
|
4433
4704
|
});
|
|
4434
|
-
const toolbarButtonSelectorMainVariants = (0, _univerjs_design.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", {
|
|
4705
|
+
const toolbarButtonSelectorMainVariants = (0, _univerjs_design.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", {
|
|
4435
4706
|
variants: {
|
|
4436
4707
|
active: {
|
|
4437
4708
|
true: "univer-bg-gray-200 dark:!univer-bg-gray-500",
|
|
@@ -4452,7 +4723,7 @@ const toolbarButtonSelectorMainVariants = (0, _univerjs_design.cva)("univer-tool
|
|
|
4452
4723
|
disabled: false
|
|
4453
4724
|
}
|
|
4454
4725
|
});
|
|
4455
|
-
const toolbarButtonSelectorTriggerVariants = (0, _univerjs_design.cva)("univer-toolbar-button-selector-trigger univer-absolute univer-right-0 univer-top-0 univer-box-border univer-flex univer-h-
|
|
4726
|
+
const toolbarButtonSelectorTriggerVariants = (0, _univerjs_design.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", {
|
|
4456
4727
|
variants: {
|
|
4457
4728
|
disabled: {
|
|
4458
4729
|
true: toolbarDisabledClassName,
|
|
@@ -4473,7 +4744,7 @@ const toolbarButtonSelectorTriggerVariants = (0, _univerjs_design.cva)("univer-t
|
|
|
4473
4744
|
active: false
|
|
4474
4745
|
}
|
|
4475
4746
|
});
|
|
4476
|
-
const toolbarSelectorRootVariants = (0, _univerjs_design.cva)("univer-toolbar-selector-root univer-animate-in univer-fade-in univer-relative univer-flex univer-h-
|
|
4747
|
+
const toolbarSelectorRootVariants = (0, _univerjs_design.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", {
|
|
4477
4748
|
variants: {
|
|
4478
4749
|
disabled: {
|
|
4479
4750
|
true: toolbarDisabledClassName,
|
|
@@ -4528,7 +4799,7 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
|
|
|
4528
4799
|
subscribe.next(selections);
|
|
4529
4800
|
});
|
|
4530
4801
|
}, [selections]);
|
|
4531
|
-
const options =
|
|
4802
|
+
const options = useObservable(selections$);
|
|
4532
4803
|
const icon$ = (0, react.useMemo)(() => {
|
|
4533
4804
|
if ((0, rxjs.isObservable)(icon)) return icon;
|
|
4534
4805
|
else return new rxjs.Observable((subscribe) => {
|
|
@@ -4541,13 +4812,14 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
|
|
|
4541
4812
|
options,
|
|
4542
4813
|
value
|
|
4543
4814
|
]);
|
|
4544
|
-
const iconToDisplay =
|
|
4815
|
+
const iconToDisplay = useObservable(icon$, void 0, true);
|
|
4545
4816
|
function renderSelectorType(menuType) {
|
|
4546
4817
|
const selectionsCommandId = props.selectionsCommandId;
|
|
4547
4818
|
const bId = commandId ?? id;
|
|
4548
4819
|
const sId = selectionsCommandId ?? commandId ?? id;
|
|
4549
4820
|
const customLabelName = typeof label === "string" ? label : (label === null || label === void 0 ? void 0 : label.name) ?? "";
|
|
4550
4821
|
const hasCustomLabel = Boolean(componentManager.get(customLabelName));
|
|
4822
|
+
const SelectorTrigger = hasCustomLabel ? ToolbarDropdownButton : "div";
|
|
4551
4823
|
let titleToDisplay = grid ? showLabel ? gridLabel : large ? void 0 : title : title;
|
|
4552
4824
|
if (overflow) titleToDisplay = hasCustomLabel || iconToDisplay && !showLabel ? void 0 : gridLabel;
|
|
4553
4825
|
const selectorAriaLabel = tooltip ? localeService.t(tooltip) : typeof title === "string" ? localeService.t(title) : void 0;
|
|
@@ -4660,12 +4932,15 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
|
|
|
4660
4932
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4661
4933
|
className: (0, _univerjs_design.clsx)(toolbarSelectorTriggerVariants({ disabled }), "univer-h-4 univer-justify-center univer-gap-0.5"),
|
|
4662
4934
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, {
|
|
4935
|
+
ariaLabel: selectorAriaLabel,
|
|
4663
4936
|
title: titleToDisplay,
|
|
4664
4937
|
value,
|
|
4665
4938
|
label,
|
|
4666
4939
|
onChange: handleSelectionsValueChange
|
|
4667
4940
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, { preserveStrokeWidth })]
|
|
4668
4941
|
})] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, {
|
|
4942
|
+
ariaLabel: selectorAriaLabel,
|
|
4943
|
+
className: fullWidth && hasCustomLabel ? "!univer-w-auto univer-min-w-0 univer-flex-1" : void 0,
|
|
4669
4944
|
icon: iconToDisplay,
|
|
4670
4945
|
iconSize,
|
|
4671
4946
|
preserveStrokeWidth,
|
|
@@ -4673,8 +4948,11 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
|
|
|
4673
4948
|
value,
|
|
4674
4949
|
label,
|
|
4675
4950
|
onChange: handleSelectionsValueChange
|
|
4676
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
4677
|
-
|
|
4951
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectorTrigger, {
|
|
4952
|
+
disabled: hasCustomLabel ? disabled : void 0,
|
|
4953
|
+
"aria-label": hasCustomLabel ? selectorAriaLabel : void 0,
|
|
4954
|
+
"aria-haspopup": hasCustomLabel ? slot ? "dialog" : "menu" : void 0,
|
|
4955
|
+
className: (0, _univerjs_design.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"),
|
|
4678
4956
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, { preserveStrokeWidth })
|
|
4679
4957
|
})] })
|
|
4680
4958
|
})
|
|
@@ -4683,7 +4961,7 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
|
|
|
4683
4961
|
function renderButtonType() {
|
|
4684
4962
|
const isCustomComponent = componentManager.get(typeof label === "string" ? label : (label === null || label === void 0 ? void 0 : label.name) ?? "");
|
|
4685
4963
|
const buttonAriaLabel = tooltip ? localeService.t(tooltip) : typeof title === "string" ? localeService.t(title) : void 0;
|
|
4686
|
-
const buttonClassName = (0, _univerjs_design.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");
|
|
4964
|
+
const buttonClassName = (0, _univerjs_design.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");
|
|
4687
4965
|
const buttonStyle = grid && large ? {
|
|
4688
4966
|
textAlign: "center",
|
|
4689
4967
|
whiteSpace: "normal"
|
|
@@ -4748,8 +5026,7 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
|
|
|
4748
5026
|
});
|
|
4749
5027
|
});
|
|
4750
5028
|
|
|
4751
|
-
|
|
4752
|
-
//#region src/views/components/ribbon/RibbonOverflow.tsx
|
|
5029
|
+
// src/views/components/ribbon/RibbonOverflow.tsx
|
|
4753
5030
|
/**
|
|
4754
5031
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
4755
5032
|
*
|
|
@@ -4767,38 +5044,20 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
|
|
|
4767
5044
|
*/
|
|
4768
5045
|
function RibbonOverflow({ groups, grid = false }) {
|
|
4769
5046
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
4770
|
-
const dialogService = (0, _wendellhu_redi_react_bindings.useDependency)(IDialogService);
|
|
4771
|
-
const sidebarService = (0, _wendellhu_redi_react_bindings.useDependency)(ISidebarService);
|
|
4772
5047
|
const { direction } = (0, react.useContext)(_univerjs_design.ConfigContext);
|
|
4773
5048
|
const [openedGroups, setOpenedGroups] = (0, react.useState)(null);
|
|
4774
5049
|
const open = openedGroups === groups;
|
|
4775
5050
|
const keyboardRef = (0, react.useRef)(false);
|
|
4776
5051
|
const restoreFocusRef = (0, react.useRef)(true);
|
|
4777
5052
|
const label = localeService.t("ui.ribbon.more");
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
setOpenedGroups(null);
|
|
4783
|
-
};
|
|
4784
|
-
const sidebar = sidebarService.sidebarOptions$.subscribe((options) => {
|
|
4785
|
-
if (options.visible) closeForPanel();
|
|
4786
|
-
});
|
|
4787
|
-
const dialogs = dialogService.getDialogs$().subscribe((options) => {
|
|
4788
|
-
if (options.some((dialog) => dialog.open)) closeForPanel();
|
|
4789
|
-
});
|
|
4790
|
-
return () => {
|
|
4791
|
-
sidebar.unsubscribe();
|
|
4792
|
-
dialogs.unsubscribe();
|
|
4793
|
-
};
|
|
4794
|
-
}, [
|
|
4795
|
-
open,
|
|
4796
|
-
dialogService,
|
|
4797
|
-
sidebarService
|
|
4798
|
-
]);
|
|
5053
|
+
const menuHost = useMenuHost(() => {
|
|
5054
|
+
restoreFocusRef.current = false;
|
|
5055
|
+
setOpenedGroups(null);
|
|
5056
|
+
});
|
|
4799
5057
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
|
|
4800
5058
|
open,
|
|
4801
5059
|
onOpenChange: (visible) => {
|
|
5060
|
+
if (visible && menuHost.suspended) return;
|
|
4802
5061
|
if (visible) restoreFocusRef.current = true;
|
|
4803
5062
|
setOpenedGroups(visible ? groups : null);
|
|
4804
5063
|
},
|
|
@@ -4826,21 +5085,24 @@ function RibbonOverflow({ groups, grid = false }) {
|
|
|
4826
5085
|
children: localeService.t(group.title)
|
|
4827
5086
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4828
5087
|
className: "univer-flex univer-flex-wrap univer-items-center univer-gap-1",
|
|
4829
|
-
children: (group.children ?? [group]).map((
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
5088
|
+
children: (grid ? groupRibbonOverflowItems(group.children ?? [group]) : [group.children ?? [group]]).filter((items) => items.length > 0).map((items) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5089
|
+
className: "univer-flex univer-max-w-full univer-flex-wrap univer-items-center univer-gap-1",
|
|
5090
|
+
children: items.map((child) => {
|
|
5091
|
+
var _child$gridLayout, _child$gridLayout2, _child$gridLayout3;
|
|
5092
|
+
return child.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5093
|
+
className: "univer-min-w-0 univer-max-w-full [&>span]:univer-block [&>span]:univer-h-full",
|
|
5094
|
+
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 },
|
|
5095
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarItem, {
|
|
5096
|
+
...child.item,
|
|
5097
|
+
grid: true,
|
|
5098
|
+
showLabel: (_child$gridLayout3 = child.gridLayout) === null || _child$gridLayout3 === void 0 ? void 0 : _child$gridLayout3.showLabel,
|
|
5099
|
+
fullWidth: true,
|
|
5100
|
+
overflow: true,
|
|
5101
|
+
preserveStrokeWidth: true
|
|
5102
|
+
})
|
|
5103
|
+
}, child.key);
|
|
5104
|
+
})
|
|
5105
|
+
}, items[0].key))
|
|
4844
5106
|
})]
|
|
4845
5107
|
}, group.key))
|
|
4846
5108
|
}) }),
|
|
@@ -4868,8 +5130,7 @@ function RibbonOverflow({ groups, grid = false }) {
|
|
|
4868
5130
|
});
|
|
4869
5131
|
}
|
|
4870
5132
|
|
|
4871
|
-
|
|
4872
|
-
//#region src/views/components/ribbon/RibbonGrid.tsx
|
|
5133
|
+
// src/views/components/ribbon/RibbonGrid.tsx
|
|
4873
5134
|
function RibbonGrid({ groups, title, className, ...props }) {
|
|
4874
5135
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
4875
5136
|
const containerRef = (0, react.useRef)(null);
|
|
@@ -4880,14 +5141,22 @@ function RibbonGrid({ groups, title, className, ...props }) {
|
|
|
4880
5141
|
const container = containerRef.current;
|
|
4881
5142
|
if (!container) return;
|
|
4882
5143
|
const measure = () => {
|
|
4883
|
-
var _moreRef$current;
|
|
4884
5144
|
const style = getComputedStyle(container);
|
|
4885
|
-
const availableWidth =
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
5145
|
+
const availableWidth = Number.parseFloat(style.width) - [
|
|
5146
|
+
style.paddingLeft,
|
|
5147
|
+
style.paddingRight,
|
|
5148
|
+
style.borderLeftWidth,
|
|
5149
|
+
style.borderRightWidth
|
|
5150
|
+
].reduce((sum, width) => sum + Number.parseFloat(width || "0"), 0);
|
|
5151
|
+
const getWidth = (element) => element ? Number.parseFloat(getComputedStyle(element).width) || 0 : 0;
|
|
5152
|
+
const getWidths = () => groups.map((group) => getWidth(groupsRef.current.get(group.key)));
|
|
5153
|
+
container.style.setProperty("--ribbon-grid-density", "0");
|
|
5154
|
+
let widths = getWidths();
|
|
5155
|
+
if (widths.reduce((sum, width) => sum + width, 0) > availableWidth) {
|
|
5156
|
+
container.style.setProperty("--ribbon-grid-density", "1");
|
|
5157
|
+
widths = getWidths();
|
|
5158
|
+
}
|
|
5159
|
+
const limit = widths.reduce((sum, width) => sum + width, 0) <= availableWidth ? availableWidth : availableWidth - getWidth(moreRef.current);
|
|
4891
5160
|
let used = 0;
|
|
4892
5161
|
let count = 0;
|
|
4893
5162
|
for (const width of widths) {
|
|
@@ -4897,6 +5166,7 @@ function RibbonGrid({ groups, title, className, ...props }) {
|
|
|
4897
5166
|
}
|
|
4898
5167
|
setVisibleGroupCount(count);
|
|
4899
5168
|
};
|
|
5169
|
+
measure();
|
|
4900
5170
|
const observer = new ResizeObserver(measure);
|
|
4901
5171
|
observer.observe(container);
|
|
4902
5172
|
groupsRef.current.forEach((element) => observer.observe(element));
|
|
@@ -4924,16 +5194,18 @@ function RibbonGrid({ groups, title, className, ...props }) {
|
|
|
4924
5194
|
"data-u-comp": "ribbon-grid-group",
|
|
4925
5195
|
"data-group-key": group.key,
|
|
4926
5196
|
"aria-hidden": index >= visibleGroupCount || void 0,
|
|
5197
|
+
style: { paddingInline: "calc(8px - 2px * var(--ribbon-grid-density, 0))" },
|
|
4927
5198
|
className: (0, _univerjs_design.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"),
|
|
4928
5199
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4929
5200
|
"data-testid": "ribbon-grid-group-grid",
|
|
4930
|
-
className: "univer-grid univer-min-h-0 univer-flex-1 univer-grid-flow-col univer-grid-rows-[repeat(2,1.
|
|
5201
|
+
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",
|
|
5202
|
+
style: { columnGap: "calc(8px - 4px * var(--ribbon-grid-density, 0))" },
|
|
4931
5203
|
children: placements.map((placement) => placement.item.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4932
5204
|
className: (0, _univerjs_design.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"),
|
|
4933
5205
|
style: {
|
|
4934
5206
|
gridRow: `${placement.row} / span ${placement.rowSpan}`,
|
|
4935
5207
|
gridColumn: `${placement.column} / span ${placement.columnSpan}`,
|
|
4936
|
-
width: placement.width
|
|
5208
|
+
width: placement.minWidth === void 0 ? placement.width : `calc(${placement.width}px - ${placement.width - placement.minWidth}px * var(--ribbon-grid-density, 0))`
|
|
4937
5209
|
},
|
|
4938
5210
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarItem, {
|
|
4939
5211
|
...placement.item.item,
|
|
@@ -4964,22 +5236,21 @@ function RibbonGrid({ groups, title, className, ...props }) {
|
|
|
4964
5236
|
});
|
|
4965
5237
|
}
|
|
4966
5238
|
|
|
4967
|
-
|
|
4968
|
-
//#region src/views/components/ribbon/Ribbon.tsx
|
|
5239
|
+
// src/views/components/ribbon/Ribbon.tsx
|
|
4969
5240
|
function Ribbon(props) {
|
|
4970
5241
|
const { ribbonType, headerMenuComponents, headerMenu = true, toolbarOnly = false, headerClassName } = props;
|
|
4971
5242
|
const defaultRibbonService = (0, _wendellhu_redi_react_bindings.useDependency)(IRibbonService);
|
|
4972
5243
|
const ribbonOverrideService = (0, _wendellhu_redi_react_bindings.useDependency)(IRibbonOverrideService);
|
|
4973
5244
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
4974
|
-
const ribbonOverride =
|
|
5245
|
+
const ribbonOverride = useObservable(ribbonOverrideService.override$, ribbonOverrideService.getOverride());
|
|
4975
5246
|
const ribbonService = (ribbonOverride === null || ribbonOverride === void 0 ? void 0 : ribbonOverride.ribbonService) ?? defaultRibbonService;
|
|
4976
5247
|
const containerRef = (0, react.useRef)(null);
|
|
4977
5248
|
const availableWidthRef = (0, react.useRef)(0);
|
|
4978
5249
|
const toolbarItemsRef = (0, react.useRef)({});
|
|
4979
|
-
const ribbonData =
|
|
4980
|
-
const activatedTab =
|
|
4981
|
-
const collapsedIds =
|
|
4982
|
-
const fakeToolbarVisible =
|
|
5250
|
+
const ribbonData = useObservable(ribbonService.ribbon$, []);
|
|
5251
|
+
const activatedTab = useObservable(ribbonService.activatedTab$, "ribbon.start");
|
|
5252
|
+
const collapsedIds = useObservable(ribbonService.collapsedIds$, []);
|
|
5253
|
+
const fakeToolbarVisible = useObservable(ribbonService.fakeToolbarVisible$, false);
|
|
4983
5254
|
const hideToolbar = (ribbonOverride === null || ribbonOverride === void 0 ? void 0 : ribbonOverride.hideToolbar) === true;
|
|
4984
5255
|
const ribbon = (0, react.useMemo)(() => {
|
|
4985
5256
|
if (ribbonType === "simple") {
|
|
@@ -5064,7 +5335,7 @@ function Ribbon(props) {
|
|
|
5064
5335
|
const fakeToolbar = (0, react.useMemo)(() => {
|
|
5065
5336
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5066
5337
|
"aria-hidden": "true",
|
|
5067
|
-
className: (0, _univerjs_design.clsx)("univer-invisible univer-absolute -univer-left-[99999] -univer-top-[99999] univer-box-border univer-flex univer-h-10 univer-min-w-min univer-items-center univer-px-3 univer-opacity-0", { "univer-hidden": !fakeToolbarVisible }, _univerjs_design.divideXClassName, _univerjs_design.borderBottomClassName),
|
|
5338
|
+
className: (0, _univerjs_design.clsx)("univer-invisible univer-absolute -univer-left-[99999] -univer-top-[99999] univer-box-border univer-flex univer-h-10 univer-min-w-min univer-items-center univer-px-3 univer-opacity-0 rtl:univer-divide-x-reverse", { "univer-hidden": !fakeToolbarVisible }, _univerjs_design.divideXClassName, _univerjs_design.borderBottomClassName),
|
|
5068
5339
|
children: activeGroup.allGroups.map((groupItem, index) => {
|
|
5069
5340
|
var _groupItem$children, _groupItem$children2;
|
|
5070
5341
|
return (((_groupItem$children = groupItem.children) === null || _groupItem$children === void 0 ? void 0 : _groupItem$children.length) || groupItem.item) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Fragment, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -5164,7 +5435,7 @@ function Ribbon(props) {
|
|
|
5164
5435
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5165
5436
|
"data-u-comp": "ribbon-toolbar",
|
|
5166
5437
|
ref: containerRef,
|
|
5167
|
-
className: (0, _univerjs_design.clsx)("univer-flex univer-overflow-hidden", _univerjs_design.divideXClassName, { "univer-justify-center": ribbonType === "classic" }),
|
|
5438
|
+
className: (0, _univerjs_design.clsx)("univer-flex univer-overflow-hidden rtl:univer-divide-x-reverse", _univerjs_design.divideXClassName, { "univer-justify-center": ribbonType === "classic" }),
|
|
5168
5439
|
role: "toolbar",
|
|
5169
5440
|
"aria-label": localeService.t(activatedTabTitle),
|
|
5170
5441
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ToolbarDropdownProvider, { children: [activeGroup.visibleGroups.map((groupItem) => {
|
|
@@ -5177,7 +5448,7 @@ function Ribbon(props) {
|
|
|
5177
5448
|
}, child.key)))
|
|
5178
5449
|
}) }, groupItem.key);
|
|
5179
5450
|
}), collapsedIds.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5180
|
-
className: "univer-pl-2 rtl:univer-pr-2",
|
|
5451
|
+
className: "univer-pl-2 rtl:univer-pl-0 rtl:univer-pr-2",
|
|
5181
5452
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RibbonOverflow, { groups: activeGroup.hiddenGroups })
|
|
5182
5453
|
})] }, effectiveActivatedTab)
|
|
5183
5454
|
})]
|
|
@@ -5212,8 +5483,7 @@ function RibbonOverrideConfigProvider(props) {
|
|
|
5212
5483
|
});
|
|
5213
5484
|
}
|
|
5214
5485
|
|
|
5215
|
-
|
|
5216
|
-
//#region src/services/theme-switcher/theme-switcher.service.ts
|
|
5486
|
+
// src/services/theme-switcher/theme-switcher.service.ts
|
|
5217
5487
|
var ThemeSwitcherService = class extends _univerjs_core.Disposable {
|
|
5218
5488
|
constructor(..._args) {
|
|
5219
5489
|
super(..._args);
|
|
@@ -5246,8 +5516,7 @@ var ThemeSwitcherService = class extends _univerjs_core.Disposable {
|
|
|
5246
5516
|
}
|
|
5247
5517
|
};
|
|
5248
5518
|
|
|
5249
|
-
|
|
5250
|
-
//#region src/services/contextmenu/contextmenu.service.ts
|
|
5519
|
+
// src/services/contextmenu/contextmenu.service.ts
|
|
5251
5520
|
const IContextMenuService = (0, _univerjs_core.createIdentifier)("ui.contextmenu.service");
|
|
5252
5521
|
var ContextMenuService = class extends _univerjs_core.Disposable {
|
|
5253
5522
|
constructor(..._args) {
|
|
@@ -5282,94 +5551,7 @@ var ContextMenuService = class extends _univerjs_core.Disposable {
|
|
|
5282
5551
|
}
|
|
5283
5552
|
};
|
|
5284
5553
|
|
|
5285
|
-
|
|
5286
|
-
//#region src/services/contextmenu/contextmenu-host.service.ts
|
|
5287
|
-
const IContextMenuHostService = (0, _univerjs_core.createIdentifier)("ui.contextmenu.host.service");
|
|
5288
|
-
var ContextMenuHostService = class extends _univerjs_core.Disposable {
|
|
5289
|
-
constructor(..._args) {
|
|
5290
|
-
super(..._args);
|
|
5291
|
-
_defineProperty(this, "_menuMap", /* @__PURE__ */ new Map());
|
|
5292
|
-
_defineProperty(this, "_activeMenuId$", new rxjs.BehaviorSubject(null));
|
|
5293
|
-
_defineProperty(this, "activeMenuId$", this._activeMenuId$.asObservable());
|
|
5294
|
-
}
|
|
5295
|
-
get activeMenuId() {
|
|
5296
|
-
return this._activeMenuId$.value;
|
|
5297
|
-
}
|
|
5298
|
-
registerMenu(menuId, hide) {
|
|
5299
|
-
this._menuMap.set(menuId, hide);
|
|
5300
|
-
return (0, _univerjs_core.toDisposable)(() => {
|
|
5301
|
-
this._menuMap.delete(menuId);
|
|
5302
|
-
if (this.activeMenuId === menuId) this._activeMenuId$.next(null);
|
|
5303
|
-
});
|
|
5304
|
-
}
|
|
5305
|
-
activateMenu(menuId) {
|
|
5306
|
-
this.hideActiveMenu(menuId);
|
|
5307
|
-
this._activeMenuId$.next(menuId);
|
|
5308
|
-
}
|
|
5309
|
-
deactivateMenu(menuId) {
|
|
5310
|
-
if (this.activeMenuId === menuId) this._activeMenuId$.next(null);
|
|
5311
|
-
}
|
|
5312
|
-
hideActiveMenu(exceptMenuId) {
|
|
5313
|
-
const activeMenuId = this.activeMenuId;
|
|
5314
|
-
if (!activeMenuId || activeMenuId === exceptMenuId) return;
|
|
5315
|
-
const hide = this._menuMap.get(activeMenuId);
|
|
5316
|
-
this._activeMenuId$.next(null);
|
|
5317
|
-
hide === null || hide === void 0 || hide();
|
|
5318
|
-
}
|
|
5319
|
-
dispose() {
|
|
5320
|
-
this._activeMenuId$.complete();
|
|
5321
|
-
super.dispose();
|
|
5322
|
-
}
|
|
5323
|
-
};
|
|
5324
|
-
|
|
5325
|
-
//#endregion
|
|
5326
|
-
//#region src/views/hooks/prevent-browser-zoom.ts
|
|
5327
|
-
/**
|
|
5328
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5329
|
-
*
|
|
5330
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5331
|
-
* you may not use this file except in compliance with the License.
|
|
5332
|
-
* You may obtain a copy of the License at
|
|
5333
|
-
*
|
|
5334
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5335
|
-
*
|
|
5336
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
5337
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5338
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5339
|
-
* See the License for the specific language governing permissions and
|
|
5340
|
-
* limitations under the License.
|
|
5341
|
-
*/
|
|
5342
|
-
function preventBrowserZoomInContainers(containers) {
|
|
5343
|
-
const uniqueContainers = new Set(containers);
|
|
5344
|
-
const handleWheel = (event) => {
|
|
5345
|
-
if (event.ctrlKey || event.metaKey) event.preventDefault();
|
|
5346
|
-
};
|
|
5347
|
-
const handleGesture = (event) => event.preventDefault();
|
|
5348
|
-
uniqueContainers.forEach((container) => {
|
|
5349
|
-
container.addEventListener("wheel", handleWheel, {
|
|
5350
|
-
capture: true,
|
|
5351
|
-
passive: false
|
|
5352
|
-
});
|
|
5353
|
-
container.addEventListener("gesturestart", handleGesture, {
|
|
5354
|
-
capture: true,
|
|
5355
|
-
passive: false
|
|
5356
|
-
});
|
|
5357
|
-
container.addEventListener("gesturechange", handleGesture, {
|
|
5358
|
-
capture: true,
|
|
5359
|
-
passive: false
|
|
5360
|
-
});
|
|
5361
|
-
});
|
|
5362
|
-
return () => {
|
|
5363
|
-
uniqueContainers.forEach((container) => {
|
|
5364
|
-
container.removeEventListener("wheel", handleWheel, true);
|
|
5365
|
-
container.removeEventListener("gesturestart", handleGesture, true);
|
|
5366
|
-
container.removeEventListener("gesturechange", handleGesture, true);
|
|
5367
|
-
});
|
|
5368
|
-
};
|
|
5369
|
-
}
|
|
5370
|
-
|
|
5371
|
-
//#endregion
|
|
5372
|
-
//#region src/views/menu/desktop/DesignTinyMenuGroup.tsx
|
|
5554
|
+
// src/views/menu/desktop/DesignTinyMenuGroup.tsx
|
|
5373
5555
|
/**
|
|
5374
5556
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5375
5557
|
*
|
|
@@ -5496,8 +5678,7 @@ function DesignTinyMenuGroup({ items, columns, sizeVariant = "default", layoutVa
|
|
|
5496
5678
|
});
|
|
5497
5679
|
}
|
|
5498
5680
|
|
|
5499
|
-
|
|
5500
|
-
//#region src/views/menu/desktop/TinyMenuGroup.tsx
|
|
5681
|
+
// src/views/menu/desktop/TinyMenuGroup.tsx
|
|
5501
5682
|
/**
|
|
5502
5683
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5503
5684
|
*
|
|
@@ -5548,11 +5729,12 @@ function QuickTileMenuItem(props) {
|
|
|
5548
5729
|
const iconManager = (0, _wendellhu_redi_react_bindings.useDependency)(IconManager);
|
|
5549
5730
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
5550
5731
|
const menuItem = menuSchema.item;
|
|
5551
|
-
const disabled =
|
|
5552
|
-
const hidden =
|
|
5553
|
-
const activated =
|
|
5732
|
+
const disabled = useObservable(menuItem === null || menuItem === void 0 ? void 0 : menuItem.disabled$, false);
|
|
5733
|
+
const hidden = useObservable(menuItem === null || menuItem === void 0 ? void 0 : menuItem.hidden$, false);
|
|
5734
|
+
const activated = useObservable(menuItem === null || menuItem === void 0 ? void 0 : menuItem.activated$, false);
|
|
5554
5735
|
if (!menuItem || hidden) return null;
|
|
5555
|
-
const
|
|
5736
|
+
const { icon } = menuItem;
|
|
5737
|
+
const Icon = icon ? iconManager.get(icon) : null;
|
|
5556
5738
|
const active = resolveMenuItemActiveState(menuItem.id, activated, activeItemIds);
|
|
5557
5739
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
5558
5740
|
type: "button",
|
|
@@ -5594,8 +5776,8 @@ function UITinyMenuGroup(props) {
|
|
|
5594
5776
|
var _child$item3;
|
|
5595
5777
|
return (((_child$item3 = child.item) === null || _child$item3 === void 0 ? void 0 : _child$item3.hidden$) ?? (0, rxjs.of)(false)).pipe((0, rxjs.startWith)(false));
|
|
5596
5778
|
})).pipe((0, rxjs.map)((states) => children.flatMap((child, index) => states[index] ? [getTinyMenuChildStateKey(child)] : []))) : (0, rxjs.of)([]), [children]);
|
|
5597
|
-
const activeItems =
|
|
5598
|
-
const hiddenItems =
|
|
5779
|
+
const activeItems = useObservable(activeItems$, []);
|
|
5780
|
+
const hiddenItems = useObservable(hiddenItems$, []);
|
|
5599
5781
|
const visibleChildren = (0, react.useMemo)(() => getVisibleTinyMenuChildren(item.children ?? [], [...hiddenItems, ...hiddenItemIds]), [
|
|
5600
5782
|
hiddenItemIds,
|
|
5601
5783
|
hiddenItems,
|
|
@@ -5603,27 +5785,28 @@ function UITinyMenuGroup(props) {
|
|
|
5603
5785
|
]);
|
|
5604
5786
|
if (!item.children) return null;
|
|
5605
5787
|
const items = visibleChildren.map((child) => {
|
|
5606
|
-
var _child$
|
|
5607
|
-
const
|
|
5788
|
+
var _child$item11, _child$item12, _child$item13;
|
|
5789
|
+
const { icon } = child.item ?? {};
|
|
5790
|
+
const Icon = icon ? iconManager.get(icon) : void 0;
|
|
5608
5791
|
if (!Icon) return null;
|
|
5609
5792
|
return {
|
|
5610
5793
|
key: child.key,
|
|
5611
5794
|
onClick: () => {
|
|
5612
|
-
var _child$item5, _child$item6, _child$item7, _child$item8, _child$item9, _child$item10
|
|
5795
|
+
var _child$item4, _child$item5, _child$item6, _child$item7, _child$item8, _child$item9, _child$item10;
|
|
5613
5796
|
onOptionSelect === null || onOptionSelect === void 0 || onOptionSelect({
|
|
5614
|
-
label: ((_child$
|
|
5615
|
-
commandId: (_child$
|
|
5616
|
-
id: (_child$
|
|
5617
|
-
params: (_child$
|
|
5618
|
-
value: (_child$
|
|
5619
|
-
tooltip: ((_child$
|
|
5797
|
+
label: ((_child$item4 = child.item) === null || _child$item4 === void 0 ? void 0 : _child$item4.id) ?? child.key,
|
|
5798
|
+
commandId: (_child$item5 = child.item) === null || _child$item5 === void 0 ? void 0 : _child$item5.commandId,
|
|
5799
|
+
id: (_child$item6 = child.item) === null || _child$item6 === void 0 ? void 0 : _child$item6.id,
|
|
5800
|
+
params: (_child$item7 = child.item) === null || _child$item7 === void 0 ? void 0 : _child$item7.params,
|
|
5801
|
+
value: (_child$item8 = child.item) === null || _child$item8 === void 0 ? void 0 : _child$item8.value,
|
|
5802
|
+
tooltip: ((_child$item9 = child.item) === null || _child$item9 === void 0 ? void 0 : _child$item9.tooltip) && localeService.t((_child$item10 = child.item) === null || _child$item10 === void 0 ? void 0 : _child$item10.tooltip)
|
|
5620
5803
|
});
|
|
5621
5804
|
},
|
|
5622
5805
|
className: "",
|
|
5623
|
-
iconClassName:
|
|
5806
|
+
iconClassName: icon === "TextTypeIcon" ? sizeVariant === "paragraph-t" ? "!univer-size-4" : "!univer-size-3.5" : void 0,
|
|
5624
5807
|
Icon,
|
|
5625
|
-
active: resolveMenuItemActiveState((_child$
|
|
5626
|
-
tooltip: ((_child$
|
|
5808
|
+
active: resolveMenuItemActiveState((_child$item11 = child.item) === null || _child$item11 === void 0 ? void 0 : _child$item11.id, activeItems.includes(((_child$item12 = child.item) === null || _child$item12 === void 0 ? void 0 : _child$item12.id) ?? ""), activeItemIds),
|
|
5809
|
+
tooltip: ((_child$item13 = child.item) === null || _child$item13 === void 0 ? void 0 : _child$item13.tooltip) ? localeService.t(child.item.tooltip) : void 0
|
|
5627
5810
|
};
|
|
5628
5811
|
}).filter((child) => child != null);
|
|
5629
5812
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DesignTinyMenuGroup, {
|
|
@@ -5648,8 +5831,7 @@ function UIQuickTileMenuGroup(props) {
|
|
|
5648
5831
|
});
|
|
5649
5832
|
}
|
|
5650
5833
|
|
|
5651
|
-
|
|
5652
|
-
//#region src/views/components/context-menu/ContextMenuPanel.tsx
|
|
5834
|
+
// src/views/components/context-menu/ContextMenuPanel.tsx
|
|
5653
5835
|
const menuViewportPadding = 8;
|
|
5654
5836
|
const submenuOverlapOffset = 2;
|
|
5655
5837
|
const submenuVisualGap = 20;
|
|
@@ -5747,7 +5929,7 @@ const contextMenuSubmenuPanelVariants = (0, _univerjs_design.cva)("univer-overfl
|
|
|
5747
5929
|
} },
|
|
5748
5930
|
defaultVariants: { sizeVariant: "default" }
|
|
5749
5931
|
});
|
|
5750
|
-
const contextMenuItemVariants = (0, _univerjs_design.cva)("univer-relative univer-flex univer-border-none univer-bg-transparent univer-text-left univer-text-gray-900 dark:!univer-text-gray-0", {
|
|
5932
|
+
const contextMenuItemVariants = (0, _univerjs_design.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", {
|
|
5751
5933
|
variants: {
|
|
5752
5934
|
sizeVariant: {
|
|
5753
5935
|
default: "",
|
|
@@ -5760,7 +5942,11 @@ const contextMenuItemVariants = (0, _univerjs_design.cva)("univer-relative unive
|
|
|
5760
5942
|
},
|
|
5761
5943
|
disabled: {
|
|
5762
5944
|
true: "univer-cursor-not-allowed univer-opacity-60",
|
|
5763
|
-
false: "univer-cursor-pointer focus:univer-
|
|
5945
|
+
false: "univer-cursor-pointer focus:univer-outline-none focus-visible:univer-ring-2 focus-visible:univer-ring-inset focus-visible:univer-ring-primary-500"
|
|
5946
|
+
},
|
|
5947
|
+
submenuOpen: {
|
|
5948
|
+
true: "univer-bg-gray-50 dark:!univer-bg-gray-600",
|
|
5949
|
+
false: ""
|
|
5764
5950
|
},
|
|
5765
5951
|
hoverSuppressed: {
|
|
5766
5952
|
true: "",
|
|
@@ -5994,7 +6180,7 @@ function ContextMenuPanel(props) {
|
|
|
5994
6180
|
});
|
|
5995
6181
|
const [hoverSuppressed, setHoverSuppressed] = (0, react.useState)(suppressHoverUntilPointerMove);
|
|
5996
6182
|
const menuSchemaVersion$ = (0, react.useMemo)(() => menuManagerService.menuChanged$.pipe((0, rxjs.startWith)(void 0), (0, rxjs.scan)((version) => version + 1, 0)), [menuManagerService]);
|
|
5997
|
-
const menuSchemaVersion =
|
|
6183
|
+
const menuSchemaVersion = useObservable(menuSchemaVersion$, 0);
|
|
5998
6184
|
const menuItems = (0, react.useMemo)(() => menuType ? menuManagerService.getMenuByPositionKey(menuType) : [], [
|
|
5999
6185
|
menuManagerService,
|
|
6000
6186
|
menuType,
|
|
@@ -6050,7 +6236,7 @@ function ContextMenuPanel(props) {
|
|
|
6050
6236
|
if (!focusableButtons.length) return;
|
|
6051
6237
|
event.preventDefault();
|
|
6052
6238
|
event.stopPropagation();
|
|
6053
|
-
const activeIndex = focusableButtons.findIndex((button) => button
|
|
6239
|
+
const activeIndex = focusableButtons.findIndex((button) => button.contains(activeElement ?? null));
|
|
6054
6240
|
if (event.key === "Enter") {
|
|
6055
6241
|
const button = activeIndex >= 0 ? focusableButtons[activeIndex] : getFirstMenuButtonByVisualOrder(focusableButtons);
|
|
6056
6242
|
if (!button) return;
|
|
@@ -6085,7 +6271,7 @@ function ContextMenuPanel(props) {
|
|
|
6085
6271
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6086
6272
|
ref: setMenuElement,
|
|
6087
6273
|
tabIndex: -1,
|
|
6088
|
-
className: (0, _univerjs_design.clsx)(getContextMenuPanelClassName(sizeVariant), _univerjs_design.borderClassName, _univerjs_design.scrollbarClassName, hoverSuppressed && "univer-
|
|
6274
|
+
className: (0, _univerjs_design.clsx)(getContextMenuPanelClassName(sizeVariant), _univerjs_design.borderClassName, _univerjs_design.scrollbarClassName, hoverSuppressed && "[&_button:hover:not(:focus)]:!univer-bg-transparent", className),
|
|
6089
6275
|
style: { maxHeight: maxMenuHeight },
|
|
6090
6276
|
onKeyDown: handleKeyDown,
|
|
6091
6277
|
onPointerMove: () => {
|
|
@@ -6115,6 +6301,7 @@ function ContextMenuMenu(props) {
|
|
|
6115
6301
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
6116
6302
|
const hiddenGroupStates = useContextGroupHiddenStates$1(menuSchemas);
|
|
6117
6303
|
const [activeSubmenuKey, setActiveSubmenuKey] = (0, react.useState)(null);
|
|
6304
|
+
const pointerGraceRef = (0, react.useRef)(null);
|
|
6118
6305
|
const visibleSchemas = (0, react.useMemo)(() => {
|
|
6119
6306
|
return menuSchemas.filter((item) => {
|
|
6120
6307
|
if (!hasRenderableContextMenuSchema(item)) return false;
|
|
@@ -6166,6 +6353,7 @@ function ContextMenuMenu(props) {
|
|
|
6166
6353
|
rootMenuElement,
|
|
6167
6354
|
activeSubmenuKey,
|
|
6168
6355
|
setActiveSubmenuKey,
|
|
6356
|
+
pointerGraceRef,
|
|
6169
6357
|
onOptionSelect,
|
|
6170
6358
|
maxMenuHeight,
|
|
6171
6359
|
hiddenItemIds,
|
|
@@ -6187,6 +6375,7 @@ function ContextMenuMenu(props) {
|
|
|
6187
6375
|
rootMenuElement,
|
|
6188
6376
|
activeSubmenuKey,
|
|
6189
6377
|
setActiveSubmenuKey,
|
|
6378
|
+
pointerGraceRef,
|
|
6190
6379
|
activeItemIds,
|
|
6191
6380
|
hiddenItemIds,
|
|
6192
6381
|
hoverSuppressed,
|
|
@@ -6209,6 +6398,7 @@ function ContextMenuMenu(props) {
|
|
|
6209
6398
|
rootMenuElement,
|
|
6210
6399
|
activeSubmenuKey,
|
|
6211
6400
|
setActiveSubmenuKey,
|
|
6401
|
+
pointerGraceRef,
|
|
6212
6402
|
activeItemIds,
|
|
6213
6403
|
hiddenItemIds,
|
|
6214
6404
|
hoverSuppressed,
|
|
@@ -6238,6 +6428,7 @@ function ContextMenuMenu(props) {
|
|
|
6238
6428
|
rootMenuElement,
|
|
6239
6429
|
activeSubmenuKey,
|
|
6240
6430
|
setActiveSubmenuKey,
|
|
6431
|
+
pointerGraceRef,
|
|
6241
6432
|
activeItemIds,
|
|
6242
6433
|
hiddenItemIds,
|
|
6243
6434
|
hoverSuppressed,
|
|
@@ -6253,15 +6444,15 @@ function ContextMenuMenu(props) {
|
|
|
6253
6444
|
}
|
|
6254
6445
|
}
|
|
6255
6446
|
function ContextMenuMenuItem(props) {
|
|
6256
|
-
const { menuKey, menuItem, menuManagerService, menuSessionVersion, submenuPortalContainer, rootMenuElement, maxMenuHeight, activeSubmenuKey, setActiveSubmenuKey, activeItemIds, hiddenItemIds = [], hoverSuppressed = false, compact = false, headerAction = false, sizeVariant, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect } = props;
|
|
6447
|
+
const { menuKey, menuItem, menuManagerService, menuSessionVersion, submenuPortalContainer, rootMenuElement, maxMenuHeight, activeSubmenuKey, setActiveSubmenuKey, pointerGraceRef, activeItemIds, hiddenItemIds = [], hoverSuppressed = false, compact = false, headerAction = false, sizeVariant, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect } = props;
|
|
6257
6448
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
6258
|
-
const direction =
|
|
6259
|
-
const disabled =
|
|
6260
|
-
const activated =
|
|
6261
|
-
const hidden =
|
|
6262
|
-
const value =
|
|
6449
|
+
const direction = useObservable(localeService.direction$);
|
|
6450
|
+
const disabled = useObservable(menuItem.disabled$, false);
|
|
6451
|
+
const activated = useObservable(menuItem.activated$, false);
|
|
6452
|
+
const hidden = useObservable(menuItem.hidden$, false);
|
|
6453
|
+
const value = useObservable(menuItem.value$);
|
|
6263
6454
|
const selectorItem = menuItem;
|
|
6264
|
-
const selectionsFromObservable =
|
|
6455
|
+
const selectionsFromObservable = useObservable((0, rxjs.isObservable)(selectorItem.selections) ? selectorItem.selections : void 0);
|
|
6265
6456
|
const [inputValue, setInputValue] = (0, react.useState)(value);
|
|
6266
6457
|
const [submenuPosition, setSubmenuPosition] = (0, react.useState)({
|
|
6267
6458
|
left: 0,
|
|
@@ -6272,8 +6463,10 @@ function ContextMenuMenuItem(props) {
|
|
|
6272
6463
|
const [keyboardSubmenuFocusRequested, setKeyboardSubmenuFocusRequested] = (0, react.useState)(false);
|
|
6273
6464
|
const menuItemElementRef = (0, react.useRef)(null);
|
|
6274
6465
|
const menuButtonRef = (0, react.useRef)(null);
|
|
6466
|
+
const mouseDownOnInputRef = (0, react.useRef)(false);
|
|
6275
6467
|
const submenuElementRef = (0, react.useRef)(null);
|
|
6276
6468
|
const submenuCloseTimerRef = (0, react.useRef)(null);
|
|
6469
|
+
const pendingHoverActionRef = (0, react.useRef)(null);
|
|
6277
6470
|
const submenuId = (0, react.useId)();
|
|
6278
6471
|
const selections = (0, react.useMemo)(() => {
|
|
6279
6472
|
if (menuItem.type !== 1 && menuItem.type !== 2) return [];
|
|
@@ -6299,10 +6492,14 @@ function ContextMenuMenuItem(props) {
|
|
|
6299
6492
|
const submenuVisible = hasSubmenu && activeSubmenuKey === menuKey;
|
|
6300
6493
|
const selectionsCommandId = selectorItem.selectionsCommandId;
|
|
6301
6494
|
const clearSubmenuCloseTimer = (0, react.useCallback)(() => {
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6495
|
+
var _pointerGraceRef$curr;
|
|
6496
|
+
if (submenuCloseTimerRef.current != null) {
|
|
6497
|
+
clearTimeout(submenuCloseTimerRef.current);
|
|
6498
|
+
submenuCloseTimerRef.current = null;
|
|
6499
|
+
}
|
|
6500
|
+
pendingHoverActionRef.current = null;
|
|
6501
|
+
if (((_pointerGraceRef$curr = pointerGraceRef.current) === null || _pointerGraceRef$curr === void 0 ? void 0 : _pointerGraceRef$curr.menuKey) === menuKey) pointerGraceRef.current = null;
|
|
6502
|
+
}, [menuKey, pointerGraceRef]);
|
|
6306
6503
|
const closeSubmenu = (0, react.useCallback)(() => {
|
|
6307
6504
|
clearSubmenuCloseTimer();
|
|
6308
6505
|
setActiveSubmenuKey((currentKey) => currentKey === menuKey ? null : currentKey);
|
|
@@ -6315,8 +6512,10 @@ function ContextMenuMenuItem(props) {
|
|
|
6315
6512
|
clearSubmenuCloseTimer();
|
|
6316
6513
|
submenuCloseTimerRef.current = setTimeout(() => {
|
|
6317
6514
|
var _submenuElementRef$cu;
|
|
6318
|
-
|
|
6319
|
-
|
|
6515
|
+
const pendingHoverAction = pendingHoverActionRef.current;
|
|
6516
|
+
clearSubmenuCloseTimer();
|
|
6517
|
+
if (pendingHoverAction) pendingHoverAction();
|
|
6518
|
+
else if (!((_submenuElementRef$cu = submenuElementRef.current) === null || _submenuElementRef$cu === void 0 ? void 0 : _submenuElementRef$cu.contains(document.activeElement))) closeSubmenu();
|
|
6320
6519
|
}, 500);
|
|
6321
6520
|
}, [clearSubmenuCloseTimer, closeSubmenu]);
|
|
6322
6521
|
(0, react.useEffect)(() => {
|
|
@@ -6324,8 +6523,12 @@ function ContextMenuMenuItem(props) {
|
|
|
6324
6523
|
}, [value]);
|
|
6325
6524
|
(0, react.useEffect)(() => () => clearSubmenuCloseTimer(), [clearSubmenuCloseTimer]);
|
|
6326
6525
|
(0, react.useEffect)(() => {
|
|
6327
|
-
if (disabled) closeSubmenu();
|
|
6328
|
-
}, [
|
|
6526
|
+
if (disabled || !submenuVisible) closeSubmenu();
|
|
6527
|
+
}, [
|
|
6528
|
+
closeSubmenu,
|
|
6529
|
+
disabled,
|
|
6530
|
+
submenuVisible
|
|
6531
|
+
]);
|
|
6329
6532
|
(0, react.useEffect)(() => {
|
|
6330
6533
|
const submenuElement = submenuElementRef.current;
|
|
6331
6534
|
if (!submenuVisible || !submenuElement) return;
|
|
@@ -6395,11 +6598,27 @@ function ContextMenuMenuItem(props) {
|
|
|
6395
6598
|
clearSubmenuCloseTimer();
|
|
6396
6599
|
setActiveSubmenuKey((currentKey) => currentKey === menuKey ? null : currentKey);
|
|
6397
6600
|
};
|
|
6601
|
+
const onPointerHover = (event) => {
|
|
6602
|
+
if (hoverSuppressed || hasSubmenu && disabled) return;
|
|
6603
|
+
const applyHover = () => {
|
|
6604
|
+
clearSubmenuCloseTimer();
|
|
6605
|
+
setKeyboardSubmenuFocusRequested(false);
|
|
6606
|
+
setActiveSubmenuKey(hasSubmenu ? menuKey : null);
|
|
6607
|
+
};
|
|
6608
|
+
const pointerGrace = pointerGraceRef.current;
|
|
6609
|
+
if (pointerGrace && pointerGrace.menuKey !== menuKey && pointerGrace.contains(event)) {
|
|
6610
|
+
pointerGrace.deferHover(applyHover);
|
|
6611
|
+
return;
|
|
6612
|
+
}
|
|
6613
|
+
pointerGrace === null || pointerGrace === void 0 || pointerGrace.cancel();
|
|
6614
|
+
applyHover();
|
|
6615
|
+
};
|
|
6398
6616
|
const itemClassName = contextMenuItemVariants({
|
|
6399
6617
|
sizeVariant,
|
|
6400
6618
|
variant: compact ? headerAction ? "compactHeaderAction" : "compact" : "default",
|
|
6401
6619
|
disabled,
|
|
6402
|
-
hoverSuppressed,
|
|
6620
|
+
hoverSuppressed: hoverSuppressed || activeSubmenuKey !== null && !submenuVisible,
|
|
6621
|
+
submenuOpen: submenuVisible,
|
|
6403
6622
|
active: resolveMenuItemActiveState(menuItem.id, activated, activeItemIds)
|
|
6404
6623
|
});
|
|
6405
6624
|
const contentNode = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
@@ -6419,27 +6638,38 @@ function ContextMenuMenuItem(props) {
|
|
|
6419
6638
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6420
6639
|
ref: menuItemElementRef,
|
|
6421
6640
|
className: "univer-relative",
|
|
6422
|
-
onMouseEnter:
|
|
6423
|
-
|
|
6424
|
-
if (hasSubmenu && !disabled && !hoverSuppressed) {
|
|
6425
|
-
setKeyboardSubmenuFocusRequested(false);
|
|
6426
|
-
setSubmenuPositionReady(false);
|
|
6427
|
-
setActiveSubmenuKey(menuKey);
|
|
6428
|
-
return;
|
|
6429
|
-
}
|
|
6430
|
-
if (!hasSubmenu && !hoverSuppressed) setActiveSubmenuKey(null);
|
|
6431
|
-
},
|
|
6641
|
+
onMouseEnter: onPointerHover,
|
|
6642
|
+
onMouseMove: onPointerHover,
|
|
6432
6643
|
onMouseLeave: (event) => {
|
|
6433
|
-
if (
|
|
6434
|
-
var _submenuElementRef$cu3, _submenuElementRef$cu4;
|
|
6644
|
+
if (submenuVisible) {
|
|
6645
|
+
var _submenuElementRef$cu3, _submenuElementRef$cu4, _submenuElementRef$cu5;
|
|
6435
6646
|
if ((_submenuElementRef$cu3 = submenuElementRef.current) === null || _submenuElementRef$cu3 === void 0 ? void 0 : _submenuElementRef$cu3.contains(document.activeElement)) return;
|
|
6436
|
-
const nextTarget = event.relatedTarget;
|
|
6647
|
+
const nextTarget = event.relatedTarget instanceof Node ? event.relatedTarget : null;
|
|
6437
6648
|
if (nextTarget && ((_submenuElementRef$cu4 = submenuElementRef.current) === null || _submenuElementRef$cu4 === void 0 ? void 0 : _submenuElementRef$cu4.contains(nextTarget))) return;
|
|
6438
6649
|
if (isContextMenuPointerLeaveTarget(nextTarget, menuItemElementRef.current, rootMenuElement)) {
|
|
6439
6650
|
closeSubmenu();
|
|
6440
6651
|
return;
|
|
6441
6652
|
}
|
|
6442
6653
|
scheduleSubmenuClose();
|
|
6654
|
+
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();
|
|
6655
|
+
if (submenuRect) {
|
|
6656
|
+
const { clientX: originX, clientY: originY } = event;
|
|
6657
|
+
const edgeX = submenuPlacement === "right" ? submenuRect.left : submenuRect.right;
|
|
6658
|
+
pointerGraceRef.current = {
|
|
6659
|
+
menuKey,
|
|
6660
|
+
contains: ({ clientX, clientY }) => {
|
|
6661
|
+
const progress = (clientX - originX) / (edgeX - originX);
|
|
6662
|
+
return progress >= 0 && progress <= 1 && clientY >= originY + (submenuRect.top - originY) * progress && clientY <= originY + (submenuRect.bottom - originY) * progress;
|
|
6663
|
+
},
|
|
6664
|
+
deferHover: (action) => {
|
|
6665
|
+
pendingHoverActionRef.current = action;
|
|
6666
|
+
},
|
|
6667
|
+
cancel: clearSubmenuCloseTimer
|
|
6668
|
+
};
|
|
6669
|
+
}
|
|
6670
|
+
} else {
|
|
6671
|
+
var _pointerGraceRef$curr2;
|
|
6672
|
+
(_pointerGraceRef$curr2 = pointerGraceRef.current) === null || _pointerGraceRef$curr2 === void 0 || _pointerGraceRef$curr2.deferHover(null);
|
|
6443
6673
|
}
|
|
6444
6674
|
},
|
|
6445
6675
|
children: [renderAsContainer ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -6459,29 +6689,35 @@ function ContextMenuMenuItem(props) {
|
|
|
6459
6689
|
"aria-haspopup": hasSubmenu ? "menu" : void 0,
|
|
6460
6690
|
"aria-expanded": hasSubmenu ? submenuVisible : void 0,
|
|
6461
6691
|
"aria-controls": hasSubmenu ? submenuId : void 0,
|
|
6692
|
+
onMouseDownCapture: (event) => {
|
|
6693
|
+
mouseDownOnInputRef.current = event.target instanceof HTMLInputElement;
|
|
6694
|
+
},
|
|
6462
6695
|
onKeyDown: (event) => {
|
|
6696
|
+
var _pointerGraceRef$curr3;
|
|
6463
6697
|
const openDirection = direction === "rtl" ? "ArrowLeft" : "ArrowRight";
|
|
6464
6698
|
if (!hasSubmenu || event.key !== openDirection) return;
|
|
6465
6699
|
event.preventDefault();
|
|
6466
6700
|
event.stopPropagation();
|
|
6701
|
+
(_pointerGraceRef$curr3 = pointerGraceRef.current) === null || _pointerGraceRef$curr3 === void 0 || _pointerGraceRef$curr3.cancel();
|
|
6467
6702
|
clearSubmenuCloseTimer();
|
|
6468
6703
|
setKeyboardSubmenuFocusRequested(true);
|
|
6469
|
-
setSubmenuPositionReady(false);
|
|
6470
6704
|
setActiveSubmenuKey(menuKey);
|
|
6471
6705
|
},
|
|
6472
6706
|
onClick: (event) => {
|
|
6707
|
+
var _pointerGraceRef$curr4;
|
|
6708
|
+
if (event.detail > 0 && mouseDownOnInputRef.current) return;
|
|
6709
|
+
(_pointerGraceRef$curr4 = pointerGraceRef.current) === null || _pointerGraceRef$curr4 === void 0 || _pointerGraceRef$curr4.cancel();
|
|
6473
6710
|
clearSubmenuCloseTimer();
|
|
6474
6711
|
if (hasSubmenu) {
|
|
6475
6712
|
if (headerAction) {
|
|
6476
6713
|
setKeyboardSubmenuFocusRequested(event.detail === 0);
|
|
6477
|
-
setSubmenuPositionReady(false);
|
|
6478
6714
|
setActiveSubmenuKey(menuKey);
|
|
6479
6715
|
return;
|
|
6480
6716
|
}
|
|
6481
6717
|
if (canExecuteItem) {
|
|
6482
6718
|
const item = menuItem;
|
|
6483
6719
|
onOptionSelect === null || onOptionSelect === void 0 || onOptionSelect({
|
|
6484
|
-
commandId: item.commandId,
|
|
6720
|
+
commandId: item.commandId ?? item.id,
|
|
6485
6721
|
params: item.params,
|
|
6486
6722
|
value: inputValue,
|
|
6487
6723
|
id: item.id,
|
|
@@ -6490,14 +6726,13 @@ function ContextMenuMenuItem(props) {
|
|
|
6490
6726
|
return;
|
|
6491
6727
|
}
|
|
6492
6728
|
setKeyboardSubmenuFocusRequested(event.detail === 0);
|
|
6493
|
-
setSubmenuPositionReady(false);
|
|
6494
6729
|
setActiveSubmenuKey(menuKey);
|
|
6495
6730
|
return;
|
|
6496
6731
|
}
|
|
6497
6732
|
if (!canExecuteItem) return;
|
|
6498
6733
|
const item = menuItem;
|
|
6499
6734
|
onOptionSelect === null || onOptionSelect === void 0 || onOptionSelect({
|
|
6500
|
-
commandId: item.commandId,
|
|
6735
|
+
commandId: item.commandId ?? item.id,
|
|
6501
6736
|
params: item.params,
|
|
6502
6737
|
value: inputValue,
|
|
6503
6738
|
id: item.id,
|
|
@@ -6530,9 +6765,9 @@ function ContextMenuMenuItem(props) {
|
|
|
6530
6765
|
onMenuPointerEnter === null || onMenuPointerEnter === void 0 || onMenuPointerEnter();
|
|
6531
6766
|
},
|
|
6532
6767
|
onMouseLeave: (event) => {
|
|
6533
|
-
var _submenuElementRef$
|
|
6534
|
-
if ((_submenuElementRef$
|
|
6535
|
-
const nextTarget = event.relatedTarget;
|
|
6768
|
+
var _submenuElementRef$cu6, _menuItemElementRef$c;
|
|
6769
|
+
if ((_submenuElementRef$cu6 = submenuElementRef.current) === null || _submenuElementRef$cu6 === void 0 ? void 0 : _submenuElementRef$cu6.contains(document.activeElement)) return;
|
|
6770
|
+
const nextTarget = event.relatedTarget instanceof Node ? event.relatedTarget : null;
|
|
6536
6771
|
if (nextTarget && ((_menuItemElementRef$c = menuItemElementRef.current) === null || _menuItemElementRef$c === void 0 ? void 0 : _menuItemElementRef$c.contains(nextTarget))) return;
|
|
6537
6772
|
if (isContextMenuPointerLeaveTarget(nextTarget, menuItemElementRef.current, rootMenuElement)) {
|
|
6538
6773
|
closeSubmenu();
|
|
@@ -6561,7 +6796,7 @@ function ContextMenuMenuItem(props) {
|
|
|
6561
6796
|
const optionSelected = typeof inputValue !== "undefined" && String(inputValue) === String(option.value);
|
|
6562
6797
|
const optionSelectable = !isNonSelectableLabel(option.label);
|
|
6563
6798
|
const optionHoverable = !isNonHoverableLabel(option.label);
|
|
6564
|
-
const optionClassName = (0, _univerjs_design.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");
|
|
6799
|
+
const optionClassName = (0, _univerjs_design.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");
|
|
6565
6800
|
const optionContentNode = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [optionSelectable && optionSelected && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.CheckMarkIcon, { className: (0, _univerjs_design.clsx)("univer-absolute univer-left-0 univer-text-primary-600", sizeVariant === "paragraph-t" ? "univer-size-5" : "univer-size-4") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6566
6801
|
className: (0, _univerjs_design.clsx)(getContextMenuContentClassName(sizeVariant), optionSelectable && optionSelected && "univer-pl-4"),
|
|
6567
6802
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, {
|
|
@@ -6633,11 +6868,25 @@ function useContextGroupHiddenStates$1(menuSchemas) {
|
|
|
6633
6868
|
[key]: hidden
|
|
6634
6869
|
}), {}), (0, rxjs.startWith)({})) : (0, rxjs.of)({});
|
|
6635
6870
|
}, [menuSchemas]);
|
|
6636
|
-
return
|
|
6871
|
+
return useObservable(hiddenStates$, {});
|
|
6637
6872
|
}
|
|
6638
6873
|
|
|
6639
|
-
|
|
6640
|
-
|
|
6874
|
+
// src/views/components/context-menu/AnchoredContextMenu.tsx
|
|
6875
|
+
/**
|
|
6876
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
6877
|
+
*
|
|
6878
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6879
|
+
* you may not use this file except in compliance with the License.
|
|
6880
|
+
* You may obtain a copy of the License at
|
|
6881
|
+
*
|
|
6882
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6883
|
+
*
|
|
6884
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
6885
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6886
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6887
|
+
* See the License for the specific language governing permissions and
|
|
6888
|
+
* limitations under the License.
|
|
6889
|
+
*/
|
|
6641
6890
|
function AnchoredContextMenu(props) {
|
|
6642
6891
|
const { hostId, visible, anchorRect, menuType, anchorVertical = "bottom", autoFocus, menuOffset = 0, menuManagerService, layoutService, onRequestClose, onOptionSelect } = props;
|
|
6643
6892
|
const contentRef = (0, react.useRef)(null);
|
|
@@ -6654,8 +6903,9 @@ function AnchoredContextMenu(props) {
|
|
|
6654
6903
|
visibleRef.current = visible;
|
|
6655
6904
|
menuTypeRef.current = menuType;
|
|
6656
6905
|
(0, react.useEffect)(() => {
|
|
6657
|
-
const disposable = contextMenuHostService.registerMenu(hostId, () => {
|
|
6658
|
-
|
|
6906
|
+
const disposable = contextMenuHostService.registerMenu(hostId, (restoreFocus) => {
|
|
6907
|
+
if (!restoreFocus) focusReturnTargetRef.current = null;
|
|
6908
|
+
if (visibleRef.current) onRequestCloseRef.current();
|
|
6659
6909
|
});
|
|
6660
6910
|
return () => {
|
|
6661
6911
|
disposable.dispose();
|
|
@@ -6666,6 +6916,11 @@ function AnchoredContextMenu(props) {
|
|
|
6666
6916
|
var _contentRef$current3, _contentRef$current4;
|
|
6667
6917
|
if (visible) {
|
|
6668
6918
|
var _contentRef$current, _contentRef$current2, _ownerDocument$defaul;
|
|
6919
|
+
if (contextMenuHostService.suspended) {
|
|
6920
|
+
focusReturnTargetRef.current = null;
|
|
6921
|
+
onRequestCloseRef.current();
|
|
6922
|
+
return;
|
|
6923
|
+
}
|
|
6669
6924
|
const ownerDocument = ((_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.ownerDocument) ?? document;
|
|
6670
6925
|
const activeElement = ownerDocument.activeElement;
|
|
6671
6926
|
const isFocusInMenu = activeElement !== null && (((_contentRef$current2 = contentRef.current) === null || _contentRef$current2 === void 0 ? void 0 : _contentRef$current2.contains(activeElement)) || !!activeElement.closest(`[${"data-u-context-menu-submenu"}]`));
|
|
@@ -6733,7 +6988,7 @@ function AnchoredContextMenu(props) {
|
|
|
6733
6988
|
menuOffset
|
|
6734
6989
|
]);
|
|
6735
6990
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Popup, {
|
|
6736
|
-
visible: visible && !!anchorRect,
|
|
6991
|
+
visible: visible && !!anchorRect && !contextMenuHostService.suspended,
|
|
6737
6992
|
offset,
|
|
6738
6993
|
overflowVisible: true,
|
|
6739
6994
|
placementY: anchorVertical === "top" ? "above" : "below",
|
|
@@ -6752,11 +7007,27 @@ function AnchoredContextMenu(props) {
|
|
|
6752
7007
|
});
|
|
6753
7008
|
}
|
|
6754
7009
|
|
|
6755
|
-
|
|
6756
|
-
|
|
7010
|
+
// src/views/components/context-menu/ContextMenu.tsx
|
|
7011
|
+
/**
|
|
7012
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
7013
|
+
*
|
|
7014
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7015
|
+
* you may not use this file except in compliance with the License.
|
|
7016
|
+
* You may obtain a copy of the License at
|
|
7017
|
+
*
|
|
7018
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7019
|
+
*
|
|
7020
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7021
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
7022
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7023
|
+
* See the License for the specific language governing permissions and
|
|
7024
|
+
* limitations under the License.
|
|
7025
|
+
*/
|
|
6757
7026
|
const DESKTOP_CONTEXT_MENU_HOST_ID = "desktop-context-menu";
|
|
6758
7027
|
function DesktopContextMenu() {
|
|
6759
7028
|
const [visible, setVisible] = (0, react.useState)(false);
|
|
7029
|
+
const pendingOpenRef = (0, react.useRef)(null);
|
|
7030
|
+
const menuHost = (0, _wendellhu_redi_react_bindings.useDependency)(IContextMenuHostService);
|
|
6760
7031
|
const [menuType, setMenuType] = (0, react.useState)("");
|
|
6761
7032
|
const [anchorRect, setAnchorRect] = (0, react.useState)(null);
|
|
6762
7033
|
const [menuContext, setMenuContext] = (0, react.useState)();
|
|
@@ -6779,12 +7050,17 @@ function DesktopContextMenu() {
|
|
|
6779
7050
|
});
|
|
6780
7051
|
return () => {
|
|
6781
7052
|
disposables.dispose();
|
|
7053
|
+
if (pendingOpenRef.current !== null) cancelAnimationFrame(pendingOpenRef.current);
|
|
6782
7054
|
};
|
|
6783
7055
|
}, [contextMenuService]);
|
|
6784
7056
|
/** A function to open context menu with given position and menu type. */
|
|
6785
7057
|
function handleContextMenu(event, menuType, context) {
|
|
6786
|
-
|
|
6787
|
-
|
|
7058
|
+
handleClose();
|
|
7059
|
+
if (menuHost.suspended) return;
|
|
7060
|
+
const revision = menuHost.revision;
|
|
7061
|
+
pendingOpenRef.current = requestAnimationFrame(() => {
|
|
7062
|
+
pendingOpenRef.current = null;
|
|
7063
|
+
if (menuHost.suspended || revision !== menuHost.revision) return;
|
|
6788
7064
|
setMenuType(menuType);
|
|
6789
7065
|
setMenuContext(context);
|
|
6790
7066
|
setAnchorRect({
|
|
@@ -6796,6 +7072,10 @@ function DesktopContextMenu() {
|
|
|
6796
7072
|
});
|
|
6797
7073
|
}
|
|
6798
7074
|
function handleClose() {
|
|
7075
|
+
if (pendingOpenRef.current !== null) {
|
|
7076
|
+
cancelAnimationFrame(pendingOpenRef.current);
|
|
7077
|
+
pendingOpenRef.current = null;
|
|
7078
|
+
}
|
|
6799
7079
|
setVisible(false);
|
|
6800
7080
|
}
|
|
6801
7081
|
const activeScope = runtimeScopeService.get(menuContext === null || menuContext === void 0 ? void 0 : menuContext.unitId);
|
|
@@ -6815,15 +7095,15 @@ function DesktopContextMenu() {
|
|
|
6815
7095
|
const { label: id, commandId, value } = params;
|
|
6816
7096
|
const rawParams = typeof params.params === "function" ? params.params() : params.params;
|
|
6817
7097
|
const commandParams = typeof rawParams === "undefined" ? { value } : rawParams;
|
|
7098
|
+
const revision = menuHost.revision;
|
|
6818
7099
|
if (activeCommandService) activeCommandService.executeCommand(commandId ?? id, commandParams);
|
|
6819
|
-
activeLayoutService.focus();
|
|
7100
|
+
if (revision === menuHost.revision && !menuHost.suspended) activeLayoutService.focus();
|
|
6820
7101
|
handleClose();
|
|
6821
7102
|
}
|
|
6822
7103
|
});
|
|
6823
7104
|
}
|
|
6824
7105
|
|
|
6825
|
-
|
|
6826
|
-
//#region src/views/components/sidebar/Sidebar.tsx
|
|
7106
|
+
// src/views/components/sidebar/Sidebar.tsx
|
|
6827
7107
|
function renderSidebarOptions(options) {
|
|
6828
7108
|
if (!options) return null;
|
|
6829
7109
|
const { children, footer, header, ...rest } = options;
|
|
@@ -6844,7 +7124,7 @@ const MAX_SIDEBAR_WIDTH = 800;
|
|
|
6844
7124
|
function Sidebar() {
|
|
6845
7125
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
6846
7126
|
const sidebarService = (0, _wendellhu_redi_react_bindings.useDependency)(ISidebarService);
|
|
6847
|
-
const sidebarOptions =
|
|
7127
|
+
const sidebarOptions = useObservable(sidebarService.sidebarOptions$);
|
|
6848
7128
|
const scrollRef = (0, react.useRef)(null);
|
|
6849
7129
|
const sidebarRef = (0, react.useRef)(null);
|
|
6850
7130
|
const closeButtonRef = (0, react.useRef)(null);
|
|
@@ -6998,7 +7278,7 @@ function Sidebar() {
|
|
|
6998
7278
|
})]
|
|
6999
7279
|
}),
|
|
7000
7280
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
7001
|
-
className: "univer-box-border univer-min-w-0 univer-cursor-default univer-px-4",
|
|
7281
|
+
className: "univer-box-border univer-min-w-0 univer-cursor-default univer-px-4 univer-pb-4",
|
|
7002
7282
|
children: options === null || options === void 0 ? void 0 : options.children
|
|
7003
7283
|
}),
|
|
7004
7284
|
(options === null || options === void 0 ? void 0 : options.footer) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("footer", {
|
|
@@ -7010,8 +7290,7 @@ function Sidebar() {
|
|
|
7010
7290
|
});
|
|
7011
7291
|
}
|
|
7012
7292
|
|
|
7013
|
-
|
|
7014
|
-
//#region src/views/components/workbench-skeleton/WorkbenchSkeleton.tsx
|
|
7293
|
+
// src/views/components/workbench-skeleton/WorkbenchSkeleton.tsx
|
|
7015
7294
|
function WorkbenchSkeleton({ darkMode, direction, overlay = false }) {
|
|
7016
7295
|
const shimmerClassName = `
|
|
7017
7296
|
univer-animate-pulse univer-bg-gray-100 motion-reduce:univer-animate-none
|
|
@@ -7099,8 +7378,7 @@ function WorkbenchSkeleton({ darkMode, direction, overlay = false }) {
|
|
|
7099
7378
|
});
|
|
7100
7379
|
}
|
|
7101
7380
|
|
|
7102
|
-
|
|
7103
|
-
//#region src/views/hooks/layout.ts
|
|
7381
|
+
// src/views/hooks/layout.ts
|
|
7104
7382
|
/**
|
|
7105
7383
|
* These hooks are used for browser layout
|
|
7106
7384
|
* Prefer to client-side
|
|
@@ -7142,11 +7420,10 @@ function useScrollYOverContainer(element, container) {
|
|
|
7142
7420
|
}
|
|
7143
7421
|
function useConfigValue(configKey) {
|
|
7144
7422
|
const configService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.IConfigService);
|
|
7145
|
-
return
|
|
7423
|
+
return useObservable((0, react.useMemo)(() => configService.subscribeConfigValue$(configKey), [configService]), configService.getConfig(configKey));
|
|
7146
7424
|
}
|
|
7147
7425
|
|
|
7148
|
-
|
|
7149
|
-
//#region src/views/hooks/update-effect.ts
|
|
7426
|
+
// src/views/hooks/update-effect.ts
|
|
7150
7427
|
/**
|
|
7151
7428
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
7152
7429
|
*
|
|
@@ -7170,8 +7447,7 @@ const useUpdateEffect = (effect, deps) => {
|
|
|
7170
7447
|
}, deps);
|
|
7171
7448
|
};
|
|
7172
7449
|
|
|
7173
|
-
|
|
7174
|
-
//#region src/views/hooks/use-click-out-side.ts
|
|
7450
|
+
// src/views/hooks/use-click-out-side.ts
|
|
7175
7451
|
function useClickOutSide(ref, opts) {
|
|
7176
7452
|
const handler = useEvent(opts.handler);
|
|
7177
7453
|
(0, react.useEffect)(() => {
|
|
@@ -7185,8 +7461,7 @@ function useClickOutSide(ref, opts) {
|
|
|
7185
7461
|
}, [handler, ref]);
|
|
7186
7462
|
}
|
|
7187
7463
|
|
|
7188
|
-
|
|
7189
|
-
//#region src/views/hooks/use-debounce.ts
|
|
7464
|
+
// src/views/hooks/use-debounce.ts
|
|
7190
7465
|
/**
|
|
7191
7466
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
7192
7467
|
*
|
|
@@ -7212,8 +7487,7 @@ function useDebounceFn(fn, delay = 300) {
|
|
|
7212
7487
|
}, [fn, delay]);
|
|
7213
7488
|
}
|
|
7214
7489
|
|
|
7215
|
-
|
|
7216
|
-
//#region src/views/hooks/virtual-list.ts
|
|
7490
|
+
// src/views/hooks/virtual-list.ts
|
|
7217
7491
|
const isNumber = (value) => typeof value === "number";
|
|
7218
7492
|
function useLatest(value) {
|
|
7219
7493
|
const ref = (0, react.useRef)(value);
|
|
@@ -7343,8 +7617,7 @@ const useVirtualList = (list, options) => {
|
|
|
7343
7617
|
}];
|
|
7344
7618
|
};
|
|
7345
7619
|
|
|
7346
|
-
|
|
7347
|
-
//#region src/views/workbench/Workbench.tsx
|
|
7620
|
+
// src/views/workbench/Workbench.tsx
|
|
7348
7621
|
function DesktopWorkbench(props) {
|
|
7349
7622
|
const uiConfig = useConfigValue(UI_PLUGIN_CONFIG_KEY);
|
|
7350
7623
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DesktopWorkbenchContent, {
|
|
@@ -7377,8 +7650,8 @@ function DesktopWorkbenchContent(props) {
|
|
|
7377
7650
|
const leftSidebarComponents = useComponentsOfPart("left-sidebar");
|
|
7378
7651
|
const globalComponents = useComponentsOfPart("global");
|
|
7379
7652
|
const toolbarComponents = useComponentsOfPart("toolbar");
|
|
7380
|
-
const lifecycleStage =
|
|
7381
|
-
const externalSkeletonVisible =
|
|
7653
|
+
const lifecycleStage = useObservable(lifecycleService.lifecycle$, lifecycleService.stage);
|
|
7654
|
+
const externalSkeletonVisible = useObservable(workbenchService.skeletonVisible$, void 0, true);
|
|
7382
7655
|
const ready = lifecycleStage >= _univerjs_core.LifecycleStages.Ready;
|
|
7383
7656
|
const popupRootId = (uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.popupRootId) ?? "univer-popup-portal";
|
|
7384
7657
|
(0, react.useLayoutEffect)(() => {
|
|
@@ -7389,7 +7662,7 @@ function DesktopWorkbenchContent(props) {
|
|
|
7389
7662
|
sub.unsubscribe();
|
|
7390
7663
|
};
|
|
7391
7664
|
}, []);
|
|
7392
|
-
const darkMode =
|
|
7665
|
+
const darkMode = useObservable(themeService.darkMode$, themeService.darkMode);
|
|
7393
7666
|
(0, react.useLayoutEffect)(() => {
|
|
7394
7667
|
if (darkMode) document.documentElement.classList.add("univer-dark");
|
|
7395
7668
|
else document.documentElement.classList.remove("univer-dark");
|
|
@@ -7397,8 +7670,8 @@ function DesktopWorkbenchContent(props) {
|
|
|
7397
7670
|
(0, react.useEffect)(() => {
|
|
7398
7671
|
if (ready && contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
|
|
7399
7672
|
}, [ready, onRendered]);
|
|
7400
|
-
const locale =
|
|
7401
|
-
const direction =
|
|
7673
|
+
const locale = useObservable(() => localeService.localeChanged$.pipe((0, rxjs.map)(() => localeService.getLocales())), localeService.getLocales(), false, [localeService]);
|
|
7674
|
+
const direction = useObservable(localeService.direction$, localeService.getDirection());
|
|
7402
7675
|
const portalContainer = (0, react.useMemo)(() => document.createElement("div"), []);
|
|
7403
7676
|
(0, react.useEffect)(() => {
|
|
7404
7677
|
document.body.appendChild(portalContainer);
|
|
@@ -7493,8 +7766,7 @@ function FloatingContainer() {
|
|
|
7493
7766
|
return (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: floatingComponents }, "floating"), mountContainer);
|
|
7494
7767
|
}
|
|
7495
7768
|
|
|
7496
|
-
|
|
7497
|
-
//#region src/controllers/ui/ui-shared.controller.ts
|
|
7769
|
+
// src/controllers/ui/ui-shared.controller.ts
|
|
7498
7770
|
const STEADY_TIMEOUT = 3e3;
|
|
7499
7771
|
/**
|
|
7500
7772
|
* @ignore
|
|
@@ -7576,8 +7848,7 @@ var SingleUnitUIController = class extends _univerjs_core.Disposable {
|
|
|
7576
7848
|
}
|
|
7577
7849
|
};
|
|
7578
7850
|
|
|
7579
|
-
|
|
7580
|
-
//#region src/controllers/ui/ui-desktop.controller.ts
|
|
7851
|
+
// src/controllers/ui/ui-desktop.controller.ts
|
|
7581
7852
|
let DesktopUIController = class DesktopUIController extends SingleUnitUIController {
|
|
7582
7853
|
constructor(_config, injector, lifecycleService, renderManagerService, layoutService, instanceService, menuManagerService, uiPartsService) {
|
|
7583
7854
|
super(injector, instanceService, layoutService, lifecycleService, renderManagerService);
|
|
@@ -7631,17 +7902,14 @@ function createContainer$1(id) {
|
|
|
7631
7902
|
return element;
|
|
7632
7903
|
}
|
|
7633
7904
|
|
|
7634
|
-
|
|
7635
|
-
//#region src/controllers/ui/ui.controller.ts
|
|
7905
|
+
// src/controllers/ui/ui.controller.ts
|
|
7636
7906
|
const IUIController = (0, _univerjs_core.createIdentifier)("univer.ui.ui-controller");
|
|
7637
7907
|
|
|
7638
|
-
|
|
7639
|
-
//#region package.json
|
|
7908
|
+
// package.json
|
|
7640
7909
|
var name = "@univerjs/ui";
|
|
7641
|
-
var version = "1.
|
|
7910
|
+
var version = "1.5.0";
|
|
7642
7911
|
|
|
7643
|
-
|
|
7644
|
-
//#region src/views/color-picker/interface.ts
|
|
7912
|
+
// src/views/color-picker/interface.ts
|
|
7645
7913
|
/**
|
|
7646
7914
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
7647
7915
|
*
|
|
@@ -7659,8 +7927,7 @@ var version = "1.3.1";
|
|
|
7659
7927
|
*/
|
|
7660
7928
|
const COLOR_PICKER_COMPONENT = "UI_COLOR_PICKER_COMPONENT";
|
|
7661
7929
|
|
|
7662
|
-
|
|
7663
|
-
//#region src/views/CommonLabel.tsx
|
|
7930
|
+
// src/views/CommonLabel.tsx
|
|
7664
7931
|
/**
|
|
7665
7932
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
7666
7933
|
*
|
|
@@ -7691,8 +7958,7 @@ const CommonLabel = (props) => {
|
|
|
7691
7958
|
};
|
|
7692
7959
|
const COMMON_LABEL_COMPONENT = "UI_PLUGIN_COMMON_LABEL_COMPONENT";
|
|
7693
7960
|
|
|
7694
|
-
|
|
7695
|
-
//#region src/views/emoji-picker/emojis.generated.ts
|
|
7961
|
+
// src/views/emoji-picker/emojis.generated.ts
|
|
7696
7962
|
const emojis = {
|
|
7697
7963
|
"frequent": [
|
|
7698
7964
|
{
|
|
@@ -23112,8 +23378,7 @@ const emojis = {
|
|
|
23112
23378
|
]
|
|
23113
23379
|
};
|
|
23114
23380
|
|
|
23115
|
-
|
|
23116
|
-
//#region src/views/emoji-picker/emoji-picker-utils.ts
|
|
23381
|
+
// src/views/emoji-picker/emoji-picker-utils.ts
|
|
23117
23382
|
const EMOJI_SKIN_TONES = [
|
|
23118
23383
|
"",
|
|
23119
23384
|
"🏻",
|
|
@@ -23278,8 +23543,7 @@ function getEmojiFamilies() {
|
|
|
23278
23543
|
return EMOJI_CATEGORIES.flatMap((category) => emojis[category.key]);
|
|
23279
23544
|
}
|
|
23280
23545
|
|
|
23281
|
-
|
|
23282
|
-
//#region src/views/emoji-picker/EmojiPicker.tsx
|
|
23546
|
+
// src/views/emoji-picker/EmojiPicker.tsx
|
|
23283
23547
|
const EMOJI_PICKER_COMPONENT = "ui.emoji-picker";
|
|
23284
23548
|
const RECENTS_STORAGE_KEY = "univer.ui.recent-emojis";
|
|
23285
23549
|
const SKIN_TONE_STORAGE_KEY = "univer.ui.emoji-skin-tone";
|
|
@@ -23294,7 +23558,7 @@ function EmojiPicker(props) {
|
|
|
23294
23558
|
const extraProps = (_props$popup = props.popup) === null || _props$popup === void 0 ? void 0 : _props$popup.extraProps;
|
|
23295
23559
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
23296
23560
|
const localStorageService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ILocalStorageService);
|
|
23297
|
-
const currentLocale =
|
|
23561
|
+
const currentLocale = useObservable(localeService.currentLocale$, localeService.getCurrentLocale());
|
|
23298
23562
|
const scrollRef = (0, react.useRef)(void 0);
|
|
23299
23563
|
const pendingSectionRef = (0, react.useRef)(null);
|
|
23300
23564
|
const skinToneChangedRef = (0, react.useRef)(false);
|
|
@@ -23671,8 +23935,7 @@ function CategoryIcon(props) {
|
|
|
23671
23935
|
}
|
|
23672
23936
|
}
|
|
23673
23937
|
|
|
23674
|
-
|
|
23675
|
-
//#region src/views/emoji-picker/MobileEmojiPicker.tsx
|
|
23938
|
+
// src/views/emoji-picker/MobileEmojiPicker.tsx
|
|
23676
23939
|
function MobileEmojiPicker(props) {
|
|
23677
23940
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EmojiPicker, {
|
|
23678
23941
|
...props,
|
|
@@ -23680,11 +23943,10 @@ function MobileEmojiPicker(props) {
|
|
|
23680
23943
|
});
|
|
23681
23944
|
}
|
|
23682
23945
|
|
|
23683
|
-
|
|
23684
|
-
//#region src/views/font-family/FontFamily.tsx
|
|
23946
|
+
// src/views/font-family/FontFamily.tsx
|
|
23685
23947
|
const FONT_FAMILY_COMPONENT = "UI_FONT_FAMILY_COMPONENT";
|
|
23686
|
-
const FontFamily = ({ className, disabled: disabledProp, value, disabled$, onChange }) => {
|
|
23687
|
-
const disabledObservableValue =
|
|
23948
|
+
const FontFamily = ({ className, disabled: disabledProp, value, disabled$, onChange, ariaLabel }) => {
|
|
23949
|
+
const disabledObservableValue = useObservable(disabled$);
|
|
23688
23950
|
const disabled = Boolean(disabledProp || disabledObservableValue);
|
|
23689
23951
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
23690
23952
|
const { fonts } = useFontList();
|
|
@@ -23743,7 +24005,8 @@ const FontFamily = ({ className, disabled: disabledProp, value, disabled$, onCha
|
|
|
23743
24005
|
className: (0, _univerjs_design.clsx)("univer-w-32 univer-truncate univer-text-sm", className),
|
|
23744
24006
|
style: { fontFamily: value },
|
|
23745
24007
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
23746
|
-
|
|
24008
|
+
"aria-label": ariaLabel,
|
|
24009
|
+
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",
|
|
23747
24010
|
type: "text",
|
|
23748
24011
|
value: inputValue,
|
|
23749
24012
|
onPointerDown: (event) => event.stopPropagation(),
|
|
@@ -23755,11 +24018,10 @@ const FontFamily = ({ className, disabled: disabledProp, value, disabled$, onCha
|
|
|
23755
24018
|
});
|
|
23756
24019
|
};
|
|
23757
24020
|
|
|
23758
|
-
|
|
23759
|
-
//#region src/views/font-size/FontSize.tsx
|
|
24021
|
+
// src/views/font-size/FontSize.tsx
|
|
23760
24022
|
const FontSize = (props) => {
|
|
23761
|
-
const { value, min, max, onChange, disabled
|
|
23762
|
-
const disabled =
|
|
24023
|
+
const { value, min, max, onChange, disabled$, ariaLabel } = props;
|
|
24024
|
+
const disabled = useObservable(disabled$);
|
|
23763
24025
|
const [draft, setDraft] = (0, react.useState)(null);
|
|
23764
24026
|
const inputValue = draft !== null && draft.source === value ? draft.value : Number(value ?? 0);
|
|
23765
24027
|
if (draft !== null && draft.source !== value) setDraft(null);
|
|
@@ -23787,6 +24049,7 @@ const FontSize = (props) => {
|
|
|
23787
24049
|
className: "univer-h-6 univer-w-7 univer-text-sm",
|
|
23788
24050
|
onPointerDown: (event) => event.stopPropagation(),
|
|
23789
24051
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
|
|
24052
|
+
"aria-label": ariaLabel,
|
|
23790
24053
|
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",
|
|
23791
24054
|
value: inputValue,
|
|
23792
24055
|
controls: false,
|
|
@@ -23798,8 +24061,7 @@ const FontSize = (props) => {
|
|
|
23798
24061
|
});
|
|
23799
24062
|
};
|
|
23800
24063
|
|
|
23801
|
-
|
|
23802
|
-
//#region src/views/font-size/interface.ts
|
|
24064
|
+
// src/views/font-size/interface.ts
|
|
23803
24065
|
const FONT_SIZE_LIST = [
|
|
23804
24066
|
{
|
|
23805
24067
|
label: "9",
|
|
@@ -23898,8 +24160,7 @@ const HEADING_LIST = [
|
|
|
23898
24160
|
];
|
|
23899
24161
|
const FONT_SIZE_COMPONENT = "UI_FONT_SIZE_COMPONENT";
|
|
23900
24162
|
|
|
23901
|
-
|
|
23902
|
-
//#region src/views/HeadingItem.tsx
|
|
24163
|
+
// src/views/HeadingItem.tsx
|
|
23903
24164
|
const HeadingItem = (props) => {
|
|
23904
24165
|
var _style$cl;
|
|
23905
24166
|
const { value, text } = props;
|
|
@@ -23916,8 +24177,7 @@ const HeadingItem = (props) => {
|
|
|
23916
24177
|
};
|
|
23917
24178
|
const HEADING_ITEM_COMPONENT = "UI_COMPONENT_HEADING_ITEM";
|
|
23918
24179
|
|
|
23919
|
-
|
|
23920
|
-
//#region src/views/symbol-picker/symbols.ts
|
|
24180
|
+
// src/views/symbol-picker/symbols.ts
|
|
23921
24181
|
const SYMBOL_CATEGORIES = [
|
|
23922
24182
|
{
|
|
23923
24183
|
key: "mathematics",
|
|
@@ -24089,14 +24349,13 @@ const SYMBOL_CATEGORIES = [
|
|
|
24089
24349
|
}
|
|
24090
24350
|
];
|
|
24091
24351
|
|
|
24092
|
-
|
|
24093
|
-
//#region src/views/symbol-picker/SymbolPicker.tsx
|
|
24352
|
+
// src/views/symbol-picker/SymbolPicker.tsx
|
|
24094
24353
|
const SYMBOL_PICKER_COMPONENT = "ui.symbol-picker";
|
|
24095
24354
|
function SymbolPicker(props) {
|
|
24096
24355
|
var _props$popup;
|
|
24097
24356
|
const extraProps = (_props$popup = props.popup) === null || _props$popup === void 0 ? void 0 : _props$popup.extraProps;
|
|
24098
24357
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
24099
|
-
|
|
24358
|
+
useObservable(localeService.currentLocale$, localeService.getCurrentLocale());
|
|
24100
24359
|
const [activeSymbol, setActiveSymbol] = (0, react.useState)(extraProps === null || extraProps === void 0 ? void 0 : extraProps.activeSymbol);
|
|
24101
24360
|
const handleSelect = (symbol) => {
|
|
24102
24361
|
var _props$onChange, _extraProps$onSelect;
|
|
@@ -24145,8 +24404,7 @@ function SymbolSection(props) {
|
|
|
24145
24404
|
});
|
|
24146
24405
|
}
|
|
24147
24406
|
|
|
24148
|
-
|
|
24149
|
-
//#region src/controllers/mobile/components.controller.ts
|
|
24407
|
+
// src/controllers/mobile/components.controller.ts
|
|
24150
24408
|
/**
|
|
24151
24409
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
24152
24410
|
*
|
|
@@ -24199,8 +24457,7 @@ let MobileComponentsController = class MobileComponentsController extends _unive
|
|
|
24199
24457
|
};
|
|
24200
24458
|
MobileComponentsController = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(ComponentManager)), __decorateParam(1, (0, _univerjs_core.Inject)(IconManager))], MobileComponentsController);
|
|
24201
24459
|
|
|
24202
|
-
|
|
24203
|
-
//#region src/menu/mobile-schema.ts
|
|
24460
|
+
// src/menu/mobile-schema.ts
|
|
24204
24461
|
const mobileMenuSchema = { ["ribbon.start.history"]: {
|
|
24205
24462
|
[_univerjs_core.UndoCommand.id]: {
|
|
24206
24463
|
order: 0,
|
|
@@ -24222,8 +24479,7 @@ const mobileMenuSchema = { ["ribbon.start.history"]: {
|
|
|
24222
24479
|
}
|
|
24223
24480
|
} };
|
|
24224
24481
|
|
|
24225
|
-
|
|
24226
|
-
//#region src/views/components/ribbon/MobileToolbarItem.tsx
|
|
24482
|
+
// src/views/components/ribbon/MobileToolbarItem.tsx
|
|
24227
24483
|
const MobileToolbarItem = (0, react.forwardRef)((props, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarItem, {
|
|
24228
24484
|
...props,
|
|
24229
24485
|
ref,
|
|
@@ -24234,16 +24490,15 @@ const MobileToolbarItem = (0, react.forwardRef)((props, ref) => /* @__PURE__ */
|
|
|
24234
24490
|
dropdownMenuComponent: _univerjs_design.MobileDropdownMenu
|
|
24235
24491
|
}));
|
|
24236
24492
|
|
|
24237
|
-
|
|
24238
|
-
//#region src/views/components/ribbon/MobileRibbon.tsx
|
|
24493
|
+
// src/views/components/ribbon/MobileRibbon.tsx
|
|
24239
24494
|
const toolbarScrollOffset = 168;
|
|
24240
24495
|
function MobileRibbon(props) {
|
|
24241
24496
|
const { headerMenuComponents, headerMenu = true } = props;
|
|
24242
24497
|
const ribbonService = (0, _wendellhu_redi_react_bindings.useDependency)(IRibbonService);
|
|
24243
24498
|
const workbenchService = (0, _wendellhu_redi_react_bindings.useDependency)(IWorkbenchService);
|
|
24244
|
-
const ribbon =
|
|
24245
|
-
const activatedTab =
|
|
24246
|
-
const rootUnitType =
|
|
24499
|
+
const ribbon = useObservable(ribbonService.ribbon$, []);
|
|
24500
|
+
const activatedTab = useObservable(ribbonService.activatedTab$, "ribbon.start");
|
|
24501
|
+
const rootUnitType = useObservable(workbenchService.rootUnitType$, null, true);
|
|
24247
24502
|
if (rootUnitType === _univerjs_core.UniverInstanceType.UNIVER_SHEET || rootUnitType === _univerjs_core.UniverInstanceType.UNIVER_DOC) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileCompactTopBar, {
|
|
24248
24503
|
ribbon,
|
|
24249
24504
|
headerMenu,
|
|
@@ -24435,6 +24690,7 @@ function MobileCompactTopBar(props) {
|
|
|
24435
24690
|
const { headerMenuComponents, headerMenu = true, ribbon } = props;
|
|
24436
24691
|
const [moreOpen, setMoreOpen] = (0, react.useState)(false);
|
|
24437
24692
|
const moreTriggerRef = (0, react.useRef)(null);
|
|
24693
|
+
const menuHost = useMenuHost(() => setMoreOpen(false));
|
|
24438
24694
|
const { mountContainer } = (0, react.useContext)(_univerjs_design.ConfigContext);
|
|
24439
24695
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
24440
24696
|
const startGroup = ribbon.find((group) => group.key === "ribbon.start");
|
|
@@ -24462,8 +24718,7 @@ function MobileCompactTopBar(props) {
|
|
|
24462
24718
|
right: Math.max(12, viewportWidth - ((triggerRect === null || triggerRect === void 0 ? void 0 : triggerRect.right) ?? viewportWidth))
|
|
24463
24719
|
},
|
|
24464
24720
|
children: moreItems.map((schema) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
24465
|
-
className: "univer-w-full [&>span]:univer-block [&>span]:univer-w-full [&_button]:!univer-
|
|
24466
|
-
onClick: () => setMoreOpen(false),
|
|
24721
|
+
className: "univer-w-full [&>span]:univer-block [&>span]:univer-w-full [&_button]:!univer-w-full [&_button]:!univer-justify-start [&_button]:!univer-gap-3 [&_button]:!univer-rounded-xl [&_button]:!univer-px-4",
|
|
24467
24722
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileToolbarItem, {
|
|
24468
24723
|
...schema.item,
|
|
24469
24724
|
grid: true,
|
|
@@ -24477,7 +24732,7 @@ function MobileCompactTopBar(props) {
|
|
|
24477
24732
|
className: (0, _univerjs_design.clsx)("univer-flex univer-h-12 univer-items-center univer-justify-end univer-gap-1 univer-bg-gray-0 univer-px-3 dark:!univer-bg-gray-800", _univerjs_design.borderBottomClassName),
|
|
24478
24733
|
children: [
|
|
24479
24734
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
24480
|
-
className: "univer-flex univer-items-center univer-gap-1 [&_button]:!univer-min-
|
|
24735
|
+
className: "univer-flex univer-items-center univer-gap-1 [&_button]:!univer-min-w-10 [&_button]:!univer-rounded-lg [&_button_svg]:!univer-size-5",
|
|
24481
24736
|
children: items.map((schema) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileToolbarItem, { ...schema.item }, schema.key))
|
|
24482
24737
|
}),
|
|
24483
24738
|
moreItems.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
@@ -24487,7 +24742,9 @@ function MobileCompactTopBar(props) {
|
|
|
24487
24742
|
"aria-label": localeService.t("ui.ribbon.more"),
|
|
24488
24743
|
"aria-expanded": moreOpen,
|
|
24489
24744
|
className: (0, _univerjs_design.clsx)(_univerjs_design.resetButtonClassName, "univer-flex univer-size-10 univer-items-center univer-justify-center univer-rounded-lg univer-text-gray-700 univer-transition-colors active:univer-bg-gray-100 dark:!univer-text-gray-200 dark:active:!univer-bg-gray-700"),
|
|
24490
|
-
onClick: () =>
|
|
24745
|
+
onClick: () => {
|
|
24746
|
+
if (!menuHost.suspended) setMoreOpen((open) => !open);
|
|
24747
|
+
},
|
|
24491
24748
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreHorizontalIcon, {
|
|
24492
24749
|
className: "univer-size-5",
|
|
24493
24750
|
preserveStrokeWidth: true
|
|
@@ -24501,8 +24758,7 @@ function MobileCompactTopBar(props) {
|
|
|
24501
24758
|
}), moreMenu] });
|
|
24502
24759
|
}
|
|
24503
24760
|
|
|
24504
|
-
|
|
24505
|
-
//#region src/views/menu/mobile/MobileMenu.tsx
|
|
24761
|
+
// src/views/menu/mobile/MobileMenu.tsx
|
|
24506
24762
|
function MobileMenu(props) {
|
|
24507
24763
|
var _props$schemas;
|
|
24508
24764
|
const schemaKey = ((_props$schemas = props.schemas) === null || _props$schemas === void 0 ? void 0 : _props$schemas.map((schema) => schema.key).join("|")) ?? "";
|
|
@@ -24517,7 +24773,7 @@ function MobileMenuContent(props) {
|
|
|
24517
24773
|
const menuSchemaVersion$ = (0, react.useMemo)(() => {
|
|
24518
24774
|
return menuManagerService.menuChanged$.pipe((0, rxjs_operators.scan)((version) => version + 1, 0), (0, rxjs_operators.startWith)(0));
|
|
24519
24775
|
}, [menuManagerService]);
|
|
24520
|
-
|
|
24776
|
+
useObservable(menuSchemaVersion$, 0);
|
|
24521
24777
|
const menuSchemas = providedSchemas ?? (menuType ? menuManagerService.getMenuByPositionKey(menuType) : []);
|
|
24522
24778
|
const currentView = viewStack[viewStack.length - 1] ?? null;
|
|
24523
24779
|
const closeView = (0, react.useCallback)(() => setViewStack((stack) => stack.slice(0, -1)), []);
|
|
@@ -24689,8 +24945,8 @@ function MobileContextMenuItem(props) {
|
|
|
24689
24945
|
}
|
|
24690
24946
|
function MobileContextMenuOption(props) {
|
|
24691
24947
|
const { option, menuKey, menuItem, currentValue, inheritedDisabled$, onExecute } = props;
|
|
24692
|
-
const inheritedDisabled =
|
|
24693
|
-
const observableValue =
|
|
24948
|
+
const inheritedDisabled = useObservable(inheritedDisabled$, false);
|
|
24949
|
+
const observableValue = useObservable(option.value$);
|
|
24694
24950
|
const displayValue = option.value ?? observableValue;
|
|
24695
24951
|
const disabled = inheritedDisabled || Boolean(option.disabled);
|
|
24696
24952
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
@@ -24874,7 +25130,7 @@ function MobileSchemaRow(props) {
|
|
|
24874
25130
|
}
|
|
24875
25131
|
function MobileSelectionOptionsView(props) {
|
|
24876
25132
|
const { options, menuKey, menuItem, currentValue, inheritedDisabled$, onExecute } = props;
|
|
24877
|
-
const inheritedDisabled =
|
|
25133
|
+
const inheritedDisabled = useObservable(inheritedDisabled$, false);
|
|
24878
25134
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: options.map((option, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileSelectionOptionRow, {
|
|
24879
25135
|
option,
|
|
24880
25136
|
menuKey,
|
|
@@ -24888,7 +25144,7 @@ function MobileSelectionOptionsView(props) {
|
|
|
24888
25144
|
function MobileSelectionOptionRow(props) {
|
|
24889
25145
|
const { option, menuKey, menuItem, currentValue, disabled, bordered, onExecute } = props;
|
|
24890
25146
|
const componentManager = (0, _wendellhu_redi_react_bindings.useDependency)(ComponentManager);
|
|
24891
|
-
const optionValue =
|
|
25147
|
+
const optionValue = useObservable(option.value$);
|
|
24892
25148
|
const displayValue = option.value ?? optionValue;
|
|
24893
25149
|
const selected = displayValue === currentValue;
|
|
24894
25150
|
const optionDisabled = disabled || Boolean(option.disabled);
|
|
@@ -24948,14 +25204,14 @@ function useMobileSchemaInteraction(props) {
|
|
|
24948
25204
|
const sources = [inheritedDisabled$, menuItem === null || menuItem === void 0 ? void 0 : menuItem.disabled$].filter((source) => Boolean(source));
|
|
24949
25205
|
return sources.length ? (0, rxjs.combineLatest)(sources.map((source) => source.pipe((0, rxjs_operators.startWith)(false)))).pipe((0, rxjs.map)((states) => states.some(Boolean))) : void 0;
|
|
24950
25206
|
}, [inheritedDisabled$, menuItem === null || menuItem === void 0 ? void 0 : menuItem.disabled$]);
|
|
24951
|
-
const disabled =
|
|
24952
|
-
const hidden =
|
|
24953
|
-
const activated =
|
|
24954
|
-
const value =
|
|
24955
|
-
const selectionsFromObservable =
|
|
25207
|
+
const disabled = useObservable(disabled$, false);
|
|
25208
|
+
const hidden = useObservable(menuItem === null || menuItem === void 0 ? void 0 : menuItem.hidden$, false);
|
|
25209
|
+
const activated = useObservable(menuItem === null || menuItem === void 0 ? void 0 : menuItem.activated$, false);
|
|
25210
|
+
const value = useObservable(menuItem === null || menuItem === void 0 ? void 0 : menuItem.value$);
|
|
25211
|
+
const selectionsFromObservable = useObservable(selectorItem && (0, rxjs.isObservable)(selectorItem.selections) ? selectorItem.selections : void 0);
|
|
24956
25212
|
const schemaChildren = (0, react.useMemo)(() => schema.children ?? [], [schema.children]);
|
|
24957
25213
|
const visibleSchemaChildren$ = (0, react.useMemo)(() => getVisibleSchemaCount$(schemaChildren), [schemaChildren]);
|
|
24958
|
-
const visibleSchemaChildren =
|
|
25214
|
+
const visibleSchemaChildren = useObservable(visibleSchemaChildren$, schemaChildren.length);
|
|
24959
25215
|
const selections = (0, react.useMemo)(() => {
|
|
24960
25216
|
if (!selectorItem || (menuItem === null || menuItem === void 0 ? void 0 : menuItem.type) !== 1 && (menuItem === null || menuItem === void 0 ? void 0 : menuItem.type) !== 2) return [];
|
|
24961
25217
|
if (selectionsFromObservable) return selectionsFromObservable;
|
|
@@ -25063,7 +25319,7 @@ function useContextGroupHiddenStates(menuSchemas) {
|
|
|
25063
25319
|
[key]: hidden
|
|
25064
25320
|
}), {}), (0, rxjs_operators.startWith)({})) : (0, rxjs.of)({});
|
|
25065
25321
|
}, [menuSchemas]);
|
|
25066
|
-
return
|
|
25322
|
+
return useObservable(hiddenStates$, {});
|
|
25067
25323
|
}
|
|
25068
25324
|
function getLeafItemSchemas(schemas) {
|
|
25069
25325
|
return schemas.reduce((acc, schema) => {
|
|
@@ -25074,8 +25330,7 @@ function getLeafItemSchemas(schemas) {
|
|
|
25074
25330
|
}, []);
|
|
25075
25331
|
}
|
|
25076
25332
|
|
|
25077
|
-
|
|
25078
|
-
//#region src/views/mobile-workbench/MobileCanvasLayout.tsx
|
|
25333
|
+
// src/views/mobile-workbench/MobileCanvasLayout.tsx
|
|
25079
25334
|
const MobileCanvasLayoutContext = (0, react.createContext)(null);
|
|
25080
25335
|
function MobileCanvasLayoutProvider({ children }) {
|
|
25081
25336
|
const [panels, setPanels] = (0, react.useState)([]);
|
|
@@ -25248,8 +25503,7 @@ function useMobileCanvasViewport(options) {
|
|
|
25248
25503
|
]);
|
|
25249
25504
|
}
|
|
25250
25505
|
|
|
25251
|
-
|
|
25252
|
-
//#region src/views/components/mobile-drawer/MobileDrawerCoordinator.tsx
|
|
25506
|
+
// src/views/components/mobile-drawer/MobileDrawerCoordinator.tsx
|
|
25253
25507
|
const MobileDrawerCoordinatorContext = (0, react.createContext)(null);
|
|
25254
25508
|
function MobileDrawerCoordinatorProvider(props) {
|
|
25255
25509
|
const entriesRef = (0, react.useRef)([]);
|
|
@@ -25297,14 +25551,14 @@ function MobileDrawerCoordinatorProvider(props) {
|
|
|
25297
25551
|
});
|
|
25298
25552
|
}
|
|
25299
25553
|
|
|
25300
|
-
|
|
25301
|
-
//#region src/views/components/mobile-drawer/MobileDrawer.tsx
|
|
25554
|
+
// src/views/components/mobile-drawer/MobileDrawer.tsx
|
|
25302
25555
|
function assignDrawerRef(ref, element) {
|
|
25303
25556
|
if (typeof ref === "function") ref(element);
|
|
25304
25557
|
else if (ref) ref.current = element;
|
|
25305
25558
|
}
|
|
25306
25559
|
const MOBILE_DRAWER_COMPACT_PERCENT = 40;
|
|
25307
25560
|
const MOBILE_DRAWER_EXPANDED_PERCENT = 80;
|
|
25561
|
+
const MOBILE_DIALOG_MAX_PERCENT = 60;
|
|
25308
25562
|
const MobileDrawerLayoutContext = (0, react.createContext)("modal");
|
|
25309
25563
|
function resolveMobileDrawerRelease(params) {
|
|
25310
25564
|
const { snap, deltaY, durationMs, percent } = params;
|
|
@@ -25316,7 +25570,7 @@ function resolveMobileDrawerRelease(params) {
|
|
|
25316
25570
|
}
|
|
25317
25571
|
function MobileDrawer(props) {
|
|
25318
25572
|
var _globalThis$CSS;
|
|
25319
|
-
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;
|
|
25573
|
+
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;
|
|
25320
25574
|
const coordinator = (0, react.useContext)(MobileDrawerCoordinatorContext);
|
|
25321
25575
|
const registerDrawer = coordinator === null || coordinator === void 0 ? void 0 : coordinator.register;
|
|
25322
25576
|
const unregisterDrawer = coordinator === null || coordinator === void 0 ? void 0 : coordinator.unregister;
|
|
@@ -25359,6 +25613,7 @@ function MobileDrawer(props) {
|
|
|
25359
25613
|
const dragRef = (0, react.useRef)(null);
|
|
25360
25614
|
const drawerPercent = dragPercent ?? (snap === "compact" ? MOBILE_DRAWER_COMPACT_PERCENT : MOBILE_DRAWER_EXPANDED_PERCENT);
|
|
25361
25615
|
const keyboardLayout = (0, _univerjs_design.useMobileKeyboardViewportLayout)(panelElementRef);
|
|
25616
|
+
const contentMaxHeight = keyboardLayout ? `min(${MOBILE_DIALOG_MAX_PERCENT}${viewportHeightUnit}, ${keyboardLayout.availableHeight}px)` : `${MOBILE_DIALOG_MAX_PERCENT}${viewportHeightUnit}`;
|
|
25362
25617
|
(0, react.useLayoutEffect)(() => {
|
|
25363
25618
|
if (!registerDrawer || !unregisterDrawer) return;
|
|
25364
25619
|
registerDrawer(drawerId, openMode, () => onCloseRef.current());
|
|
@@ -25464,15 +25719,17 @@ function MobileDrawer(props) {
|
|
|
25464
25719
|
"aria-label": ariaLabel,
|
|
25465
25720
|
"data-u-comp": componentName,
|
|
25466
25721
|
"data-snap": snap,
|
|
25467
|
-
className: (0, _univerjs_design.clsx)("univer-absolute univer-inset-x-0 univer-bottom-0 univer-z-20 univer-flex univer-flex-col univer-overflow-hidden univer-rounded-t-[24px] univer-bg-gray-50 univer-shadow-2xl univer-transition-[height] univer-duration-200 dark:!univer-bg-gray-900
|
|
25722
|
+
className: (0, _univerjs_design.clsx)("univer-absolute univer-inset-x-0 univer-bottom-0 univer-z-20 univer-flex univer-flex-col univer-overflow-hidden univer-rounded-t-[24px] univer-bg-gray-50 univer-shadow-2xl univer-transition-[height] univer-duration-200 dark:!univer-bg-gray-900", "univer-pointer-events-auto", dragPercent != null && "!univer-transition-none", panelClassName),
|
|
25468
25723
|
style: {
|
|
25469
|
-
height: `${drawerPercent}${viewportHeightUnit}`,
|
|
25724
|
+
height: autoHeight ? "auto" : `${drawerPercent}${viewportHeightUnit}`,
|
|
25725
|
+
maxHeight: autoHeight ? contentMaxHeight : void 0,
|
|
25726
|
+
bottom: autoHeight ? keyboardLayout === null || keyboardLayout === void 0 ? void 0 : keyboardLayout.bottom : void 0,
|
|
25470
25727
|
paddingBottom: "env(safe-area-inset-bottom, 0px)"
|
|
25471
25728
|
},
|
|
25472
25729
|
children: [
|
|
25473
25730
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25474
|
-
className: "univer-relative univer-flex univer-
|
|
25475
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
25731
|
+
className: (0, _univerjs_design.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"),
|
|
25732
|
+
children: [!autoHeight && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
25476
25733
|
type: "button",
|
|
25477
25734
|
"aria-label": snap === "compact" ? expandLabel : collapseLabel,
|
|
25478
25735
|
className: (0, _univerjs_design.clsx)(_univerjs_design.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"),
|
|
@@ -25497,8 +25754,8 @@ function MobileDrawer(props) {
|
|
|
25497
25754
|
}),
|
|
25498
25755
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
25499
25756
|
ref: contentRef,
|
|
25500
|
-
className: (0, _univerjs_design.clsx)("univer-
|
|
25501
|
-
style: { paddingBottom: keyboardLayout ? `calc(0.75rem + ${keyboardLayout.bottom}px)` : void 0 },
|
|
25757
|
+
className: (0, _univerjs_design.clsx)("univer-overflow-y-auto univer-overflow-x-hidden univer-p-3", autoHeight ? "univer-min-h-0 univer-flex-initial" : "univer-flex-1", _univerjs_design.scrollbarClassName, contentClassName),
|
|
25758
|
+
style: { paddingBottom: !autoHeight && keyboardLayout ? `calc(0.75rem + ${keyboardLayout.bottom}px)` : void 0 },
|
|
25502
25759
|
children
|
|
25503
25760
|
}),
|
|
25504
25761
|
footer
|
|
@@ -25508,8 +25765,7 @@ function MobileDrawer(props) {
|
|
|
25508
25765
|
});
|
|
25509
25766
|
}
|
|
25510
25767
|
|
|
25511
|
-
|
|
25512
|
-
//#region src/views/menu/mobile/MobileMenuDrawer.tsx
|
|
25768
|
+
// src/views/menu/mobile/MobileMenuDrawer.tsx
|
|
25513
25769
|
function MobileMenuDrawer(props) {
|
|
25514
25770
|
if (!props.visible) return null;
|
|
25515
25771
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileMenuDrawerContent, { ...props });
|
|
@@ -25520,7 +25776,7 @@ function MobileMenuDrawerContent(props) {
|
|
|
25520
25776
|
const [drawerSnap, setDrawerSnap] = (0, react.useState)("compact");
|
|
25521
25777
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
25522
25778
|
const rootMenuManagerService = (0, _wendellhu_redi_react_bindings.useDependency)(IMenuManagerService);
|
|
25523
|
-
const direction =
|
|
25779
|
+
const direction = useObservable(localeService.direction$);
|
|
25524
25780
|
const { mountContainer } = (0, react.useContext)(_univerjs_design.ConfigContext);
|
|
25525
25781
|
const layerRef = (0, react.useRef)(null);
|
|
25526
25782
|
if (!mountContainer) return null;
|
|
@@ -25582,8 +25838,7 @@ function MobileMenuDrawerContent(props) {
|
|
|
25582
25838
|
}), mountContainer);
|
|
25583
25839
|
}
|
|
25584
25840
|
|
|
25585
|
-
|
|
25586
|
-
//#region src/views/components/context-menu/MobileContextMenu.tsx
|
|
25841
|
+
// src/views/components/context-menu/MobileContextMenu.tsx
|
|
25587
25842
|
const MOBILE_CONTEXT_MENU_HOST_ID = "mobile-context-menu";
|
|
25588
25843
|
const MOBILE_CONTEXT_MENU_POINTER_SIZE = 8;
|
|
25589
25844
|
const MOBILE_CONTEXT_MENU_POINTER_EDGE_GAP = 12;
|
|
@@ -25620,6 +25875,7 @@ function MobileContextMenu() {
|
|
|
25620
25875
|
const isFloatingContextMenu = shouldUseFloatingMobileContextMenu(menuType, menuContext);
|
|
25621
25876
|
visibleRef.current = visible;
|
|
25622
25877
|
const handleContextMenu = (0, react.useCallback)((event, nextMenuType, context) => {
|
|
25878
|
+
if (contextMenuHostService.suspended) return;
|
|
25623
25879
|
contextMenuHostService.activateMenu(MOBILE_CONTEXT_MENU_HOST_ID);
|
|
25624
25880
|
setMenuType(nextMenuType);
|
|
25625
25881
|
setMenuContext(context);
|
|
@@ -25770,12 +26026,11 @@ function MobileContextMenu() {
|
|
|
25770
26026
|
});
|
|
25771
26027
|
}
|
|
25772
26028
|
|
|
25773
|
-
|
|
25774
|
-
//#region src/views/components/sidebar/MobileSidebar.tsx
|
|
26029
|
+
// src/views/components/sidebar/MobileSidebar.tsx
|
|
25775
26030
|
function MobileSidebar() {
|
|
25776
26031
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
25777
26032
|
const sidebarService = (0, _wendellhu_redi_react_bindings.useDependency)(ISidebarService);
|
|
25778
|
-
const sidebarOptions =
|
|
26033
|
+
const sidebarOptions = useObservable(sidebarService.sidebarOptions$);
|
|
25779
26034
|
const layerRef = (0, react.useRef)(null);
|
|
25780
26035
|
const scrollRef = (0, react.useRef)(null);
|
|
25781
26036
|
const closeButtonRef = (0, react.useRef)(null);
|
|
@@ -25853,8 +26108,7 @@ function MobileSidebar() {
|
|
|
25853
26108
|
});
|
|
25854
26109
|
}
|
|
25855
26110
|
|
|
25856
|
-
|
|
25857
|
-
//#region src/views/mobile-workbench/mobile-keyboard-inset-context.ts
|
|
26111
|
+
// src/views/mobile-workbench/mobile-keyboard-inset-context.ts
|
|
25858
26112
|
/**
|
|
25859
26113
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
25860
26114
|
*
|
|
@@ -25872,8 +26126,7 @@ function MobileSidebar() {
|
|
|
25872
26126
|
*/
|
|
25873
26127
|
const MobileKeyboardInsetContext = (0, react.createContext)(0);
|
|
25874
26128
|
|
|
25875
|
-
|
|
25876
|
-
//#region src/views/mobile-workbench/MobileWorkbench.tsx
|
|
26129
|
+
// src/views/mobile-workbench/MobileWorkbench.tsx
|
|
25877
26130
|
const MOBILE_KEYBOARD_THRESHOLD = 80;
|
|
25878
26131
|
function resolveMobileKeyboardInset(stableHeight, visibleBottom, baselineInset) {
|
|
25879
26132
|
const keyboardInset = Math.max(0, Math.round(stableHeight - visibleBottom) - baselineInset);
|
|
@@ -25909,15 +26162,15 @@ function MobileWorkbench(props) {
|
|
|
25909
26162
|
const leftSidebarComponents = useComponentsOfPart("left-sidebar");
|
|
25910
26163
|
const globalComponents = useComponentsOfPart("global");
|
|
25911
26164
|
const toolbarComponents = useComponentsOfPart("toolbar");
|
|
25912
|
-
const darkMode =
|
|
25913
|
-
const lifecycleStage =
|
|
25914
|
-
const externalSkeletonVisible =
|
|
26165
|
+
const darkMode = useObservable(themeService.darkMode$, themeService.darkMode);
|
|
26166
|
+
const lifecycleStage = useObservable(lifecycleService.lifecycle$, lifecycleService.stage);
|
|
26167
|
+
const externalSkeletonVisible = useObservable(workbenchService.skeletonVisible$, void 0, true);
|
|
25915
26168
|
const ready = lifecycleStage >= _univerjs_core.LifecycleStages.Ready;
|
|
25916
26169
|
(0, react.useEffect)(() => {
|
|
25917
26170
|
if (ready && contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
|
|
25918
26171
|
}, [ready, onRendered]);
|
|
25919
|
-
const locale =
|
|
25920
|
-
const direction =
|
|
26172
|
+
const locale = useObservable(() => localeService.localeChanged$.pipe((0, rxjs.map)(() => localeService.getLocales())), localeService.getLocales(), false, [localeService]);
|
|
26173
|
+
const direction = useObservable(localeService.direction$, localeService.getDirection());
|
|
25921
26174
|
const portalContainer = (0, react.useMemo)(() => document.createElement("div"), []);
|
|
25922
26175
|
(0, react.useLayoutEffect)(() => {
|
|
25923
26176
|
const sub = themeService.currentTheme$.subscribe((theme) => {
|
|
@@ -26115,8 +26368,7 @@ function MobileWorkbench(props) {
|
|
|
26115
26368
|
});
|
|
26116
26369
|
}
|
|
26117
26370
|
|
|
26118
|
-
|
|
26119
|
-
//#region src/controllers/ui/ui-mobile.controller.ts
|
|
26371
|
+
// src/controllers/ui/ui-mobile.controller.ts
|
|
26120
26372
|
let MobileUIController = class MobileUIController extends SingleUnitUIController {
|
|
26121
26373
|
constructor(_config, injector, lifecycleService, renderManagerService, layoutService, instanceService, menuManagerService, uiPartsService) {
|
|
26122
26374
|
super(injector, instanceService, layoutService, lifecycleService, renderManagerService);
|
|
@@ -26170,12 +26422,10 @@ function createContainer(id) {
|
|
|
26170
26422
|
return element;
|
|
26171
26423
|
}
|
|
26172
26424
|
|
|
26173
|
-
|
|
26174
|
-
//#region src/services/notification/notification.service.ts
|
|
26425
|
+
// src/services/notification/notification.service.ts
|
|
26175
26426
|
const INotificationService = (0, _univerjs_core.createIdentifier)("ui.notification.service");
|
|
26176
26427
|
|
|
26177
|
-
|
|
26178
|
-
//#region src/services/before-close/before-close.service.ts
|
|
26428
|
+
// src/services/before-close/before-close.service.ts
|
|
26179
26429
|
const IBeforeCloseService = (0, _univerjs_core.createIdentifier)("univer.ui.before-close-service");
|
|
26180
26430
|
let DesktopBeforeCloseService = class DesktopBeforeCloseService extends _univerjs_core.Disposable {
|
|
26181
26431
|
constructor(_notificationService, _localeService) {
|
|
@@ -26231,8 +26481,7 @@ let DesktopBeforeCloseService = class DesktopBeforeCloseService extends _univerj
|
|
|
26231
26481
|
};
|
|
26232
26482
|
DesktopBeforeCloseService = __decorate([__decorateParam(0, INotificationService), __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService))], DesktopBeforeCloseService);
|
|
26233
26483
|
|
|
26234
|
-
|
|
26235
|
-
//#region src/utils/html.ts
|
|
26484
|
+
// src/utils/html.ts
|
|
26236
26485
|
function sanitizeParsedHtml(root, options) {
|
|
26237
26486
|
root.querySelectorAll(options.strippedSelector).forEach((element) => element.remove());
|
|
26238
26487
|
root.querySelectorAll("*").forEach((element) => {
|
|
@@ -26250,8 +26499,7 @@ function parseHtmlDocument(html, options) {
|
|
|
26250
26499
|
return doc;
|
|
26251
26500
|
}
|
|
26252
26501
|
|
|
26253
|
-
|
|
26254
|
-
//#region src/services/clipboard/clipboard-utils.ts
|
|
26502
|
+
// src/services/clipboard/clipboard-utils.ts
|
|
26255
26503
|
/**
|
|
26256
26504
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
26257
26505
|
*
|
|
@@ -26277,8 +26525,7 @@ function supportClipboardAPI() {
|
|
|
26277
26525
|
return typeof navigator.clipboard !== "undefined" && typeof navigator.clipboard.readText !== "undefined";
|
|
26278
26526
|
}
|
|
26279
26527
|
|
|
26280
|
-
|
|
26281
|
-
//#region src/services/clipboard/clipboard-interface.service.ts
|
|
26528
|
+
// src/services/clipboard/clipboard-interface.service.ts
|
|
26282
26529
|
const PLAIN_TEXT_CLIPBOARD_MIME_TYPE = "text/plain";
|
|
26283
26530
|
const HTML_CLIPBOARD_MIME_TYPE = "text/html";
|
|
26284
26531
|
const FILE_PNG_CLIPBOARD_MIME_TYPE = "image/png";
|
|
@@ -26629,8 +26876,7 @@ function select(element) {
|
|
|
26629
26876
|
return selection.toString();
|
|
26630
26877
|
}
|
|
26631
26878
|
|
|
26632
|
-
|
|
26633
|
-
//#region src/views/components/confirm-part/MobileConfirmPart.tsx
|
|
26879
|
+
// src/views/components/confirm-part/MobileConfirmPart.tsx
|
|
26634
26880
|
function MobileContextConfirm(props) {
|
|
26635
26881
|
const { children, onClose, onConfirm } = props;
|
|
26636
26882
|
const [hooks] = (0, react.useState)({});
|
|
@@ -26662,7 +26908,7 @@ function MobileContextConfirm(props) {
|
|
|
26662
26908
|
}
|
|
26663
26909
|
function MobileConfirmPart() {
|
|
26664
26910
|
const confirmService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.IConfirmService);
|
|
26665
|
-
return
|
|
26911
|
+
return useObservable(confirmService.confirmOptions$, []).map((options) => {
|
|
26666
26912
|
const { children, title, ...restProps } = options;
|
|
26667
26913
|
const confirmProps = restProps;
|
|
26668
26914
|
for (const key of ["children", "title"]) {
|
|
@@ -26677,8 +26923,7 @@ function MobileConfirmPart() {
|
|
|
26677
26923
|
}, options.id));
|
|
26678
26924
|
}
|
|
26679
26925
|
|
|
26680
|
-
|
|
26681
|
-
//#region src/services/confirm/mobile-confirm.service.ts
|
|
26926
|
+
// src/services/confirm/mobile-confirm.service.ts
|
|
26682
26927
|
let MobileConfirmService = class MobileConfirmService extends _univerjs_core.Disposable {
|
|
26683
26928
|
constructor(_injector, uiPartsService) {
|
|
26684
26929
|
super();
|
|
@@ -26732,8 +26977,7 @@ let MobileConfirmService = class MobileConfirmService extends _univerjs_core.Dis
|
|
|
26732
26977
|
};
|
|
26733
26978
|
MobileConfirmService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), __decorateParam(1, IUIPartsService)], MobileConfirmService);
|
|
26734
26979
|
|
|
26735
|
-
|
|
26736
|
-
//#region src/views/components/dialog-part/MobileDialogPart.tsx
|
|
26980
|
+
// src/views/components/dialog-part/MobileDialogPart.tsx
|
|
26737
26981
|
function toMobileDialogOptions(options) {
|
|
26738
26982
|
const { children, title, footer, ...rest } = options;
|
|
26739
26983
|
return {
|
|
@@ -26747,7 +26991,7 @@ function MobileDialogPart() {
|
|
|
26747
26991
|
const dialogService = (0, _wendellhu_redi_react_bindings.useDependency)(IDialogService);
|
|
26748
26992
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
26749
26993
|
const { locale } = (0, react.useContext)(_univerjs_design.ConfigContext);
|
|
26750
|
-
const dialogOptions =
|
|
26994
|
+
const dialogOptions = useObservable(dialogService.getDialogs$(), []);
|
|
26751
26995
|
const options = (0, react.useMemo)(() => {
|
|
26752
26996
|
const activeDialogs = dialogOptions.filter((item) => item.open !== false);
|
|
26753
26997
|
const active = activeDialogs[activeDialogs.length - 1];
|
|
@@ -26760,10 +27004,12 @@ function MobileDialogPart() {
|
|
|
26760
27004
|
const defaultSnap = options.layout === "canvas" ? "compact" : "expanded";
|
|
26761
27005
|
const footer = options.footer ?? (options.showOk || options.showCancel ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [options.showCancel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
26762
27006
|
onClick: options.onCancel,
|
|
27007
|
+
size: "middle",
|
|
26763
27008
|
children: locale === null || locale === void 0 ? void 0 : locale.Confirm.cancel
|
|
26764
27009
|
}), options.showOk && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
26765
27010
|
variant: "primary",
|
|
26766
27011
|
onClick: options.onOk,
|
|
27012
|
+
size: "middle",
|
|
26767
27013
|
children: locale === null || locale === void 0 ? void 0 : locale.Confirm.confirm
|
|
26768
27014
|
})] }) : null);
|
|
26769
27015
|
const close = () => {
|
|
@@ -26794,6 +27040,7 @@ function MobileDialogPart() {
|
|
|
26794
27040
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileDrawer, {
|
|
26795
27041
|
layerRef,
|
|
26796
27042
|
layout: options.layout,
|
|
27043
|
+
autoHeight: options.layout !== "canvas",
|
|
26797
27044
|
componentName: "mobile-dialog-drawer",
|
|
26798
27045
|
snap: (snapOverride === null || snapOverride === void 0 ? void 0 : snapOverride.id) === options.id ? snapOverride.snap : defaultSnap,
|
|
26799
27046
|
expandLabel: localeService.t("ui.sidebar.resize"),
|
|
@@ -26828,8 +27075,7 @@ function MobileDialogPart() {
|
|
|
26828
27075
|
});
|
|
26829
27076
|
}
|
|
26830
27077
|
|
|
26831
|
-
|
|
26832
|
-
//#region src/views/components/dialog-part/DialogPart.tsx
|
|
27078
|
+
// src/views/components/dialog-part/DialogPart.tsx
|
|
26833
27079
|
function DialogItem(props) {
|
|
26834
27080
|
const dialogRef = (0, react.useRef)(null);
|
|
26835
27081
|
const openRef = (0, react.useRef)(false);
|
|
@@ -26865,7 +27111,7 @@ function DialogItem(props) {
|
|
|
26865
27111
|
}
|
|
26866
27112
|
function DialogPart() {
|
|
26867
27113
|
const dialogService = (0, _wendellhu_redi_react_bindings.useDependency)(IDialogService);
|
|
26868
|
-
const dialogOptions =
|
|
27114
|
+
const dialogOptions = useObservable(dialogService.getDialogs$(), []);
|
|
26869
27115
|
const attrs = (0, react.useMemo)(() => dialogOptions.map((options) => {
|
|
26870
27116
|
const { children, title, footer, ...restProps } = options;
|
|
26871
27117
|
const dialogProps = restProps;
|
|
@@ -26886,13 +27132,13 @@ function DialogPart() {
|
|
|
26886
27132
|
return attrs === null || attrs === void 0 ? void 0 : attrs.map((options) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogItem, { ...options }, options.id));
|
|
26887
27133
|
}
|
|
26888
27134
|
|
|
26889
|
-
|
|
26890
|
-
//#region src/services/dialog/desktop-dialog.service.ts
|
|
27135
|
+
// src/services/dialog/desktop-dialog.service.ts
|
|
26891
27136
|
let DesktopDialogService = class DesktopDialogService extends _univerjs_core.Disposable {
|
|
26892
|
-
constructor(_injector, _uiPartsService) {
|
|
27137
|
+
constructor(_injector, _uiPartsService, _menuHostService) {
|
|
26893
27138
|
super();
|
|
26894
27139
|
this._injector = _injector;
|
|
26895
27140
|
this._uiPartsService = _uiPartsService;
|
|
27141
|
+
this._menuHostService = _menuHostService;
|
|
26896
27142
|
_defineProperty(this, "_dialogOptions", []);
|
|
26897
27143
|
_defineProperty(this, "_dialogOptions$", new rxjs.Subject());
|
|
26898
27144
|
this._initUIPart();
|
|
@@ -26903,7 +27149,9 @@ let DesktopDialogService = class DesktopDialogService extends _univerjs_core.Dis
|
|
|
26903
27149
|
this._dialogOptions$.complete();
|
|
26904
27150
|
}
|
|
26905
27151
|
open(option) {
|
|
26906
|
-
|
|
27152
|
+
const existingDialog = this._dialogOptions.find((item) => item.id === option.id);
|
|
27153
|
+
if (!(existingDialog === null || existingDialog === void 0 ? void 0 : existingDialog.open)) this._menuHostService.closeAll();
|
|
27154
|
+
if (existingDialog) this._dialogOptions = this._dialogOptions.map((item) => ({
|
|
26907
27155
|
...item.id === option.id ? option : item,
|
|
26908
27156
|
open: item.id === option.id ? true : item.open
|
|
26909
27157
|
}));
|
|
@@ -26939,10 +27187,13 @@ let DesktopDialogService = class DesktopDialogService extends _univerjs_core.Dis
|
|
|
26939
27187
|
this.disposeWithMe(this._uiPartsService.registerComponent("global", () => (0, _wendellhu_redi_react_bindings.connectInjector)(DialogPart, this._injector)));
|
|
26940
27188
|
}
|
|
26941
27189
|
};
|
|
26942
|
-
DesktopDialogService = __decorate([
|
|
27190
|
+
DesktopDialogService = __decorate([
|
|
27191
|
+
__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
27192
|
+
__decorateParam(1, IUIPartsService),
|
|
27193
|
+
__decorateParam(2, IContextMenuHostService)
|
|
27194
|
+
], DesktopDialogService);
|
|
26943
27195
|
|
|
26944
|
-
|
|
26945
|
-
//#region src/services/dialog/mobile-dialog.service.ts
|
|
27196
|
+
// src/services/dialog/mobile-dialog.service.ts
|
|
26946
27197
|
/**
|
|
26947
27198
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
26948
27199
|
*
|
|
@@ -26959,8 +27210,8 @@ DesktopDialogService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)
|
|
|
26959
27210
|
* limitations under the License.
|
|
26960
27211
|
*/
|
|
26961
27212
|
let MobileDialogService = class MobileDialogService extends DesktopDialogService {
|
|
26962
|
-
constructor(injector, uiPartsService) {
|
|
26963
|
-
super(injector, uiPartsService);
|
|
27213
|
+
constructor(injector, uiPartsService, menuHostService) {
|
|
27214
|
+
super(injector, uiPartsService, menuHostService);
|
|
26964
27215
|
}
|
|
26965
27216
|
close(id) {
|
|
26966
27217
|
const dialog = this._dialogOptions.find((item) => item.id === id);
|
|
@@ -26971,14 +27222,16 @@ let MobileDialogService = class MobileDialogService extends DesktopDialogService
|
|
|
26971
27222
|
this.disposeWithMe(this._uiPartsService.registerComponent("global", () => (0, _wendellhu_redi_react_bindings.connectInjector)(MobileDialogPart, this._injector)));
|
|
26972
27223
|
}
|
|
26973
27224
|
};
|
|
26974
|
-
MobileDialogService = __decorate([
|
|
27225
|
+
MobileDialogService = __decorate([
|
|
27226
|
+
__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
27227
|
+
__decorateParam(1, IUIPartsService),
|
|
27228
|
+
__decorateParam(2, IContextMenuHostService)
|
|
27229
|
+
], MobileDialogService);
|
|
26975
27230
|
|
|
26976
|
-
|
|
26977
|
-
//#region src/services/gallery/gallery.service.ts
|
|
27231
|
+
// src/services/gallery/gallery.service.ts
|
|
26978
27232
|
const IGalleryService = (0, _univerjs_core.createIdentifier)("univer.ui.gallery-service");
|
|
26979
27233
|
|
|
26980
|
-
|
|
26981
|
-
//#region src/views/components/gallery-part/GalleryPart.tsx
|
|
27234
|
+
// src/views/components/gallery-part/GalleryPart.tsx
|
|
26982
27235
|
/**
|
|
26983
27236
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
26984
27237
|
*
|
|
@@ -26996,13 +27249,12 @@ const IGalleryService = (0, _univerjs_core.createIdentifier)("univer.ui.gallery-
|
|
|
26996
27249
|
*/
|
|
26997
27250
|
function GalleryPart() {
|
|
26998
27251
|
const galleryService = (0, _wendellhu_redi_react_bindings.useDependency)(IGalleryService);
|
|
26999
|
-
const gallery =
|
|
27252
|
+
const gallery = useObservable(galleryService.gallery$);
|
|
27000
27253
|
if (!gallery) return null;
|
|
27001
27254
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Gallery, { ...gallery });
|
|
27002
27255
|
}
|
|
27003
27256
|
|
|
27004
|
-
|
|
27005
|
-
//#region src/services/gallery/desktop-gallery.service.ts
|
|
27257
|
+
// src/services/gallery/desktop-gallery.service.ts
|
|
27006
27258
|
let DesktopGalleryService = class DesktopGalleryService extends _univerjs_core.Disposable {
|
|
27007
27259
|
constructor(_injector, _uiPartsService) {
|
|
27008
27260
|
super();
|
|
@@ -27035,8 +27287,7 @@ let DesktopGalleryService = class DesktopGalleryService extends _univerjs_core.D
|
|
|
27035
27287
|
};
|
|
27036
27288
|
DesktopGalleryService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), __decorateParam(1, IUIPartsService)], DesktopGalleryService);
|
|
27037
27289
|
|
|
27038
|
-
|
|
27039
|
-
//#region src/services/local-file/desktop-local-file.service.ts
|
|
27290
|
+
// src/services/local-file/desktop-local-file.service.ts
|
|
27040
27291
|
var DesktopLocalFileService = class extends _univerjs_core.Disposable {
|
|
27041
27292
|
openFile(options) {
|
|
27042
27293
|
return new Promise((resolve) => {
|
|
@@ -27059,8 +27310,7 @@ var DesktopLocalFileService = class extends _univerjs_core.Disposable {
|
|
|
27059
27310
|
}
|
|
27060
27311
|
};
|
|
27061
27312
|
|
|
27062
|
-
|
|
27063
|
-
//#region src/services/local-file/local-file.service.ts
|
|
27313
|
+
// src/services/local-file/local-file.service.ts
|
|
27064
27314
|
/**
|
|
27065
27315
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
27066
27316
|
*
|
|
@@ -27081,8 +27331,7 @@ var DesktopLocalFileService = class extends _univerjs_core.Disposable {
|
|
|
27081
27331
|
*/
|
|
27082
27332
|
const ILocalFileService = (0, _univerjs_core.createIdentifier)("univer-ui.local-file.service");
|
|
27083
27333
|
|
|
27084
|
-
|
|
27085
|
-
//#region src/utils/storage-driver.ts
|
|
27334
|
+
// src/utils/storage-driver.ts
|
|
27086
27335
|
/**
|
|
27087
27336
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
27088
27337
|
*
|
|
@@ -27300,8 +27549,7 @@ function createDriver() {
|
|
|
27300
27549
|
}
|
|
27301
27550
|
const browserStorage = createDriver();
|
|
27302
27551
|
|
|
27303
|
-
|
|
27304
|
-
//#region src/services/local-storage/local-storage.service.ts
|
|
27552
|
+
// src/services/local-storage/local-storage.service.ts
|
|
27305
27553
|
var DesktopLocalStorageService = class {
|
|
27306
27554
|
getItem(key) {
|
|
27307
27555
|
return browserStorage.getItem(key);
|
|
@@ -27326,8 +27574,7 @@ var DesktopLocalStorageService = class {
|
|
|
27326
27574
|
}
|
|
27327
27575
|
};
|
|
27328
27576
|
|
|
27329
|
-
|
|
27330
|
-
//#region src/views/message/MessageContainer.tsx
|
|
27577
|
+
// src/views/message/MessageContainer.tsx
|
|
27331
27578
|
/**
|
|
27332
27579
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
27333
27580
|
*
|
|
@@ -27346,16 +27593,15 @@ var DesktopLocalStorageService = class {
|
|
|
27346
27593
|
function MessageContainer() {
|
|
27347
27594
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
27348
27595
|
const themeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ThemeService);
|
|
27349
|
-
const darkMode =
|
|
27350
|
-
const direction =
|
|
27596
|
+
const darkMode = useObservable(themeService.darkMode$);
|
|
27597
|
+
const direction = useObservable(localeService.direction$);
|
|
27351
27598
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Messager, {
|
|
27352
27599
|
theme: darkMode ? "dark" : "light",
|
|
27353
27600
|
dir: direction
|
|
27354
27601
|
});
|
|
27355
27602
|
}
|
|
27356
27603
|
|
|
27357
|
-
|
|
27358
|
-
//#region src/services/message/desktop-message.service.ts
|
|
27604
|
+
// src/services/message/desktop-message.service.ts
|
|
27359
27605
|
let messageId = 0;
|
|
27360
27606
|
let DesktopMessageService = class DesktopMessageService extends _univerjs_core.Disposable {
|
|
27361
27607
|
constructor(_injector, _uiPartsService) {
|
|
@@ -27387,13 +27633,12 @@ let DesktopMessageService = class DesktopMessageService extends _univerjs_core.D
|
|
|
27387
27633
|
};
|
|
27388
27634
|
DesktopMessageService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), __decorateParam(1, IUIPartsService)], DesktopMessageService);
|
|
27389
27635
|
|
|
27390
|
-
|
|
27391
|
-
//#region src/views/notification/Notification.tsx
|
|
27636
|
+
// src/views/notification/Notification.tsx
|
|
27392
27637
|
function Notification() {
|
|
27393
27638
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
27394
27639
|
const themeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ThemeService);
|
|
27395
|
-
const darkMode =
|
|
27396
|
-
const direction =
|
|
27640
|
+
const darkMode = useObservable(themeService.darkMode$);
|
|
27641
|
+
const direction = useObservable(localeService.direction$);
|
|
27397
27642
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Toaster, {
|
|
27398
27643
|
theme: darkMode ? "dark" : "light",
|
|
27399
27644
|
dir: direction
|
|
@@ -27415,8 +27660,7 @@ const notification = {
|
|
|
27415
27660
|
dismiss: (id) => _univerjs_design.toast.dismiss(id)
|
|
27416
27661
|
};
|
|
27417
27662
|
|
|
27418
|
-
|
|
27419
|
-
//#region src/services/notification/desktop-notification.service.ts
|
|
27663
|
+
// src/services/notification/desktop-notification.service.ts
|
|
27420
27664
|
let DesktopNotificationService = class DesktopNotificationService extends _univerjs_core.Disposable {
|
|
27421
27665
|
constructor(_injector, _uiPartsService) {
|
|
27422
27666
|
super();
|
|
@@ -27434,8 +27678,7 @@ let DesktopNotificationService = class DesktopNotificationService extends _unive
|
|
|
27434
27678
|
};
|
|
27435
27679
|
DesktopNotificationService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), __decorateParam(1, IUIPartsService)], DesktopNotificationService);
|
|
27436
27680
|
|
|
27437
|
-
|
|
27438
|
-
//#region src/services/presence/unit-presence-ui-adapter.service.ts
|
|
27681
|
+
// src/services/presence/unit-presence-ui-adapter.service.ts
|
|
27439
27682
|
const IUnitPresenceUIAdapterRegistry = (0, _univerjs_core.createIdentifier)("ui.unit-presence-adapter-registry");
|
|
27440
27683
|
const EMPTY_ADAPTERS = Object.freeze([]);
|
|
27441
27684
|
var UnitPresenceUIAdapterRegistry = class extends _univerjs_core.Disposable {
|
|
@@ -27471,11 +27714,11 @@ var UnitPresenceUIAdapterRegistry = class extends _univerjs_core.Disposable {
|
|
|
27471
27714
|
}
|
|
27472
27715
|
};
|
|
27473
27716
|
|
|
27474
|
-
|
|
27475
|
-
|
|
27476
|
-
|
|
27477
|
-
|
|
27478
|
-
|
|
27717
|
+
// src/services/sidebar/desktop-sidebar.service.ts
|
|
27718
|
+
let DesktopSidebarService = class DesktopSidebarService extends _univerjs_core.Disposable {
|
|
27719
|
+
constructor(_menuHostService) {
|
|
27720
|
+
super();
|
|
27721
|
+
this._menuHostService = _menuHostService;
|
|
27479
27722
|
_defineProperty(this, "_sidebarOptions", {});
|
|
27480
27723
|
_defineProperty(this, "sidebarOptions$", new rxjs.Subject());
|
|
27481
27724
|
_defineProperty(this, "scrollEvent$", new rxjs.Subject());
|
|
@@ -27508,6 +27751,7 @@ var DesktopSidebarService = class extends _univerjs_core.Disposable {
|
|
|
27508
27751
|
}
|
|
27509
27752
|
}
|
|
27510
27753
|
open(params) {
|
|
27754
|
+
this._menuHostService.closeAll();
|
|
27511
27755
|
this._sidebarOptions = {
|
|
27512
27756
|
...params,
|
|
27513
27757
|
id: params.id,
|
|
@@ -27541,9 +27785,9 @@ var DesktopSidebarService = class extends _univerjs_core.Disposable {
|
|
|
27541
27785
|
this._container = element;
|
|
27542
27786
|
}
|
|
27543
27787
|
};
|
|
27788
|
+
DesktopSidebarService = __decorate([__decorateParam(0, IContextMenuHostService)], DesktopSidebarService);
|
|
27544
27789
|
|
|
27545
|
-
|
|
27546
|
-
//#region src/services/undo-redo/undo-redo-group.service.ts
|
|
27790
|
+
// src/services/undo-redo/undo-redo-group.service.ts
|
|
27547
27791
|
/**
|
|
27548
27792
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
27549
27793
|
*
|
|
@@ -27597,8 +27841,22 @@ let UndoRedoGroupService = class UndoRedoGroupService {
|
|
|
27597
27841
|
};
|
|
27598
27842
|
UndoRedoGroupService = __decorate([__decorateParam(0, _univerjs_core.IUndoRedoService)], UndoRedoGroupService);
|
|
27599
27843
|
|
|
27600
|
-
|
|
27601
|
-
|
|
27844
|
+
// src/mobile-plugin.ts
|
|
27845
|
+
/**
|
|
27846
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
27847
|
+
*
|
|
27848
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
27849
|
+
* you may not use this file except in compliance with the License.
|
|
27850
|
+
* You may obtain a copy of the License at
|
|
27851
|
+
*
|
|
27852
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
27853
|
+
*
|
|
27854
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
27855
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
27856
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
27857
|
+
* See the License for the specific language governing permissions and
|
|
27858
|
+
* limitations under the License.
|
|
27859
|
+
*/
|
|
27602
27860
|
const DISABLE_AUTO_FOCUS_KEY$1 = "DISABLE_AUTO_FOCUS";
|
|
27603
27861
|
let UniverMobileUIPlugin = class UniverMobileUIPlugin extends _univerjs_core.Plugin {
|
|
27604
27862
|
constructor(_config = defaultPluginConfig, _contextService, _injector, _configService) {
|
|
@@ -27699,8 +27957,7 @@ UniverMobileUIPlugin = __decorate([
|
|
|
27699
27957
|
__decorateParam(3, _univerjs_core.IConfigService)
|
|
27700
27958
|
], UniverMobileUIPlugin);
|
|
27701
27959
|
|
|
27702
|
-
|
|
27703
|
-
//#region src/views/components/shortcut-panel/ShortcutPanel.tsx
|
|
27960
|
+
// src/views/components/shortcut-panel/ShortcutPanel.tsx
|
|
27704
27961
|
/**
|
|
27705
27962
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
27706
27963
|
*
|
|
@@ -27722,7 +27979,7 @@ UniverMobileUIPlugin = __decorate([
|
|
|
27722
27979
|
function ShortcutPanel() {
|
|
27723
27980
|
const shortcutService = (0, _wendellhu_redi_react_bindings.useDependency)(IShortcutService);
|
|
27724
27981
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
27725
|
-
const currentLocale =
|
|
27982
|
+
const currentLocale = useObservable(localeService.currentLocale$);
|
|
27726
27983
|
const [shortcutItems, setShortcutItems] = (0, react.useState)([]);
|
|
27727
27984
|
const updateShortcuts = (0, react.useCallback)(() => {
|
|
27728
27985
|
const shortcutGroups = /* @__PURE__ */ new Map();
|
|
@@ -27778,13 +28035,12 @@ function ShortcutPanel() {
|
|
|
27778
28035
|
});
|
|
27779
28036
|
}
|
|
27780
28037
|
|
|
27781
|
-
|
|
27782
|
-
//#region src/views/font-family/FontFamilyDropdown.tsx
|
|
28038
|
+
// src/views/font-family/FontFamilyDropdown.tsx
|
|
27783
28039
|
function FontFamilyDropdown(props) {
|
|
27784
28040
|
const { value, onChange, ariaLabel, className, disabled: disabledProp, disabled$, inputClassName, popupClassName, popupDataComponent, title, onMouseDown, onPointerDown } = props;
|
|
27785
28041
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
27786
|
-
const direction =
|
|
27787
|
-
const disabledObservableValue =
|
|
28042
|
+
const direction = useObservable(localeService.direction$, localeService.getDirection());
|
|
28043
|
+
const disabledObservableValue = useObservable(disabled$);
|
|
27788
28044
|
const disabled = Boolean(disabledProp || disabledObservableValue);
|
|
27789
28045
|
const [open, setOpen] = (0, react.useState)(false);
|
|
27790
28046
|
const popupDataAttributes = popupDataComponent ? { "data-u-comp": popupDataComponent } : void 0;
|
|
@@ -27826,8 +28082,7 @@ function FontFamilyDropdown(props) {
|
|
|
27826
28082
|
});
|
|
27827
28083
|
}
|
|
27828
28084
|
|
|
27829
|
-
|
|
27830
|
-
//#region src/views/slider/ZoomInput.tsx
|
|
28085
|
+
// src/views/slider/ZoomInput.tsx
|
|
27831
28086
|
function ZoomInput(props) {
|
|
27832
28087
|
const iconManager = (0, _wendellhu_redi_react_bindings.useDependency)(IconManager);
|
|
27833
28088
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
@@ -27920,8 +28175,7 @@ function ZoomInput(props) {
|
|
|
27920
28175
|
});
|
|
27921
28176
|
}
|
|
27922
28177
|
|
|
27923
|
-
|
|
27924
|
-
//#region src/views/slider/Slider.tsx
|
|
28178
|
+
// src/views/slider/Slider.tsx
|
|
27925
28179
|
const SLIDER_WIDTH = 116;
|
|
27926
28180
|
const DRAG_COMMIT_INTERVAL = 50;
|
|
27927
28181
|
/**
|
|
@@ -27931,7 +28185,7 @@ function Slider(props) {
|
|
|
27931
28185
|
const iconManager = (0, _wendellhu_redi_react_bindings.useDependency)(IconManager);
|
|
27932
28186
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
27933
28187
|
const { value, min = 0, max = 400, disabled = false, resetPoint = 100, shortcuts, onChange } = props;
|
|
27934
|
-
const isRtl =
|
|
28188
|
+
const isRtl = useObservable(localeService.direction$, localeService.getDirection()) === "rtl";
|
|
27935
28189
|
const sliderInnerRailRef = (0, react.useRef)(null);
|
|
27936
28190
|
const dragValueRef = (0, react.useRef)(value);
|
|
27937
28191
|
const pendingDragValueRef = (0, react.useRef)(null);
|
|
@@ -28151,8 +28405,7 @@ function Slider(props) {
|
|
|
28151
28405
|
});
|
|
28152
28406
|
}
|
|
28153
28407
|
|
|
28154
|
-
|
|
28155
|
-
//#region src/views/object-permission/ObjectPermissionMembers.tsx
|
|
28408
|
+
// src/views/object-permission/ObjectPermissionMembers.tsx
|
|
28156
28409
|
function ObjectPermissionMembers({ unitId, value, disabled, onChange }) {
|
|
28157
28410
|
var _authz$getCfgEnableOb;
|
|
28158
28411
|
const locale = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
@@ -28301,8 +28554,7 @@ function ObjectPermissionMembers({ unitId, value, disabled, onChange }) {
|
|
|
28301
28554
|
});
|
|
28302
28555
|
}
|
|
28303
28556
|
|
|
28304
|
-
|
|
28305
|
-
//#region src/views/object-permission/ObjectPermissionButton.tsx
|
|
28557
|
+
// src/views/object-permission/ObjectPermissionButton.tsx
|
|
28306
28558
|
const OBJECT_PERMISSION_DIALOG = "ui.object-permission-dialog";
|
|
28307
28559
|
/** Mount outside transient toolbars and context menus, retaining the original target until close. */
|
|
28308
28560
|
function openObjectPermissionDialog(accessor, props) {
|
|
@@ -28330,7 +28582,7 @@ function openObjectPermissionDialog(accessor, props) {
|
|
|
28330
28582
|
function ObjectPermissionButton(props) {
|
|
28331
28583
|
const permissions = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ObjectPermissionService);
|
|
28332
28584
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
28333
|
-
|
|
28585
|
+
useObservable(permissions.changed$, 0);
|
|
28334
28586
|
const [open, setOpen] = (0, react.useState)(false);
|
|
28335
28587
|
if (!permissions.supports(props.target)) return null;
|
|
28336
28588
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.StateIconButton, {
|
|
@@ -28356,9 +28608,9 @@ function ObjectPermissionDialog({ target, name, commandId, actions = DEFAULT_ACT
|
|
|
28356
28608
|
const commandService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ICommandService);
|
|
28357
28609
|
const instances = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
28358
28610
|
const users = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.UserManagerService);
|
|
28359
|
-
const currentUser =
|
|
28611
|
+
const currentUser = useObservable(users.currentUser$, users.getCurrentUser());
|
|
28360
28612
|
const [policy, setPolicy] = (0, react.useState)(null);
|
|
28361
|
-
|
|
28613
|
+
useObservable(permissions.changed$, 0);
|
|
28362
28614
|
const canView = permissions.canView(target);
|
|
28363
28615
|
const [canManage, setCanManage] = (0, react.useState)(false);
|
|
28364
28616
|
const [canDelete, setCanDelete] = (0, react.useState)(false);
|
|
@@ -28599,8 +28851,7 @@ function ObjectPermissionDialog({ target, name, commandId, actions = DEFAULT_ACT
|
|
|
28599
28851
|
});
|
|
28600
28852
|
}
|
|
28601
28853
|
|
|
28602
|
-
|
|
28603
|
-
//#region src/views/object-permission/ObjectPermissionPanel.tsx
|
|
28854
|
+
// src/views/object-permission/ObjectPermissionPanel.tsx
|
|
28604
28855
|
const OBJECT_PERMISSION_PANEL = "ui.object-permission-panel";
|
|
28605
28856
|
function openObjectPermissionPanel(accessor, props) {
|
|
28606
28857
|
if (!accessor.get(_univerjs_core.ObjectPermissionService).canView(props.target)) return false;
|
|
@@ -28623,7 +28874,7 @@ function ObjectPermissionPanelButton(props) {
|
|
|
28623
28874
|
const permissions = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ObjectPermissionService);
|
|
28624
28875
|
const accessor = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.Injector);
|
|
28625
28876
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
28626
|
-
|
|
28877
|
+
useObservable(permissions.changed$, 0);
|
|
28627
28878
|
if (!permissions.supports(props.target)) return null;
|
|
28628
28879
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
28629
28880
|
variant: "ghost",
|
|
@@ -28642,7 +28893,7 @@ function ObjectPermissionPanel({ unitId, getTargets, expandable }) {
|
|
|
28642
28893
|
const [query, setQuery] = (0, react.useState)("");
|
|
28643
28894
|
const [expanded, setExpanded] = (0, react.useState)(false);
|
|
28644
28895
|
const [limit, setLimit] = (0, react.useState)(50);
|
|
28645
|
-
|
|
28896
|
+
useObservable(permissions.changed$, 0);
|
|
28646
28897
|
const instances = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
28647
28898
|
const sidebar = (0, _wendellhu_redi_react_bindings.useDependency)(ISidebarService);
|
|
28648
28899
|
(0, react.useEffect)(() => {
|
|
@@ -28694,7 +28945,7 @@ function ObjectPermissionPanel({ unitId, getTargets, expandable }) {
|
|
|
28694
28945
|
});
|
|
28695
28946
|
}
|
|
28696
28947
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
28697
|
-
className: "univer-flex univer-h-full univer-flex-col univer-gap-3 univer-
|
|
28948
|
+
className: "univer-box-border univer-flex univer-h-0 univer-min-h-full univer-flex-col univer-gap-3 univer-pt-4",
|
|
28698
28949
|
children: [
|
|
28699
28950
|
expandable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
28700
28951
|
"aria-expanded": expanded,
|
|
@@ -28711,7 +28962,7 @@ function ObjectPermissionPanel({ unitId, getTargets, expandable }) {
|
|
|
28711
28962
|
"aria-label": localeService.t("ui.objectPermission.search")
|
|
28712
28963
|
}),
|
|
28713
28964
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
28714
|
-
className: "univer-flex-1 univer-overflow-auto",
|
|
28965
|
+
className: "univer-min-h-0 univer-flex-1 univer-overflow-auto univer-pb-4",
|
|
28715
28966
|
children: [
|
|
28716
28967
|
items.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
28717
28968
|
className: "univer-flex univer-items-center univer-gap-2 univer-py-2",
|
|
@@ -28732,8 +28983,7 @@ function ObjectPermissionPanel({ unitId, getTargets, expandable }) {
|
|
|
28732
28983
|
});
|
|
28733
28984
|
}
|
|
28734
28985
|
|
|
28735
|
-
|
|
28736
|
-
//#region src/controllers/components.controller.ts
|
|
28986
|
+
// src/controllers/components.controller.ts
|
|
28737
28987
|
/**
|
|
28738
28988
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
28739
28989
|
*
|
|
@@ -28795,8 +29045,7 @@ let ComponentsController = class ComponentsController extends _univerjs_core.Dis
|
|
|
28795
29045
|
};
|
|
28796
29046
|
ComponentsController = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(ComponentManager)), __decorateParam(1, (0, _univerjs_core.Inject)(IconManager))], ComponentsController);
|
|
28797
29047
|
|
|
28798
|
-
|
|
28799
|
-
//#region src/controllers/feature-search/feature-search.controller.ts
|
|
29048
|
+
// src/controllers/feature-search/feature-search.controller.ts
|
|
28800
29049
|
const FeatureSearchShortcut = {
|
|
28801
29050
|
id: OpenFeatureSearchOperation.id,
|
|
28802
29051
|
binding: 4096 | 1024 | 80,
|
|
@@ -28813,8 +29062,7 @@ let FeatureSearchController = class FeatureSearchController extends _univerjs_co
|
|
|
28813
29062
|
};
|
|
28814
29063
|
FeatureSearchController = __decorate([__decorateParam(0, _univerjs_core.ICommandService), __decorateParam(1, IShortcutService)], FeatureSearchController);
|
|
28815
29064
|
|
|
28816
|
-
|
|
28817
|
-
//#region src/views/components/confirm-part/ConfirmPart.tsx
|
|
29065
|
+
// src/views/components/confirm-part/ConfirmPart.tsx
|
|
28818
29066
|
const ContextConfirm = (props) => {
|
|
28819
29067
|
const { children, onClose, onConfirm } = props;
|
|
28820
29068
|
const [hooks] = (0, react.useState)({});
|
|
@@ -28846,7 +29094,7 @@ const ContextConfirm = (props) => {
|
|
|
28846
29094
|
};
|
|
28847
29095
|
function ConfirmPart() {
|
|
28848
29096
|
const confirmService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.IConfirmService);
|
|
28849
|
-
const props =
|
|
29097
|
+
const props = useObservable(confirmService.confirmOptions$, []).map((options) => {
|
|
28850
29098
|
const { children, title, ...restProps } = options;
|
|
28851
29099
|
const confirmProps = restProps;
|
|
28852
29100
|
for (const key of ["children", "title"]) {
|
|
@@ -28862,8 +29110,7 @@ function ConfirmPart() {
|
|
|
28862
29110
|
}, index));
|
|
28863
29111
|
}
|
|
28864
29112
|
|
|
28865
|
-
|
|
28866
|
-
//#region src/services/confirm/desktop-confirm.service.ts
|
|
29113
|
+
// src/services/confirm/desktop-confirm.service.ts
|
|
28867
29114
|
let DesktopConfirmService = class DesktopConfirmService extends _univerjs_core.Disposable {
|
|
28868
29115
|
constructor(_injector, _uiPartsService) {
|
|
28869
29116
|
super();
|
|
@@ -28916,8 +29163,22 @@ let DesktopConfirmService = class DesktopConfirmService extends _univerjs_core.D
|
|
|
28916
29163
|
};
|
|
28917
29164
|
DesktopConfirmService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), __decorateParam(1, IUIPartsService)], DesktopConfirmService);
|
|
28918
29165
|
|
|
28919
|
-
|
|
28920
|
-
|
|
29166
|
+
// src/plugin.ts
|
|
29167
|
+
/**
|
|
29168
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
29169
|
+
*
|
|
29170
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
29171
|
+
* you may not use this file except in compliance with the License.
|
|
29172
|
+
* You may obtain a copy of the License at
|
|
29173
|
+
*
|
|
29174
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
29175
|
+
*
|
|
29176
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
29177
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
29178
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
29179
|
+
* See the License for the specific language governing permissions and
|
|
29180
|
+
* limitations under the License.
|
|
29181
|
+
*/
|
|
28921
29182
|
const DISABLE_AUTO_FOCUS_KEY = "DISABLE_AUTO_FOCUS";
|
|
28922
29183
|
let UniverUIPlugin = class UniverUIPlugin extends _univerjs_core.Plugin {
|
|
28923
29184
|
constructor(_config = defaultPluginConfig, _contextService, _injector, _configService) {
|
|
@@ -29025,8 +29286,7 @@ UniverUIPlugin = __decorate([
|
|
|
29025
29286
|
__decorateParam(3, _univerjs_core.IConfigService)
|
|
29026
29287
|
], UniverUIPlugin);
|
|
29027
29288
|
|
|
29028
|
-
|
|
29029
|
-
//#region src/services/message/__tests__/mock-message.service.ts
|
|
29289
|
+
// src/services/message/__tests__/mock-message.service.ts
|
|
29030
29290
|
/**
|
|
29031
29291
|
* This is a mocked message service for testing purposes.
|
|
29032
29292
|
*
|
|
@@ -29042,8 +29302,7 @@ var MockMessageService = class {
|
|
|
29042
29302
|
getContainer() {}
|
|
29043
29303
|
};
|
|
29044
29304
|
|
|
29045
|
-
|
|
29046
|
-
//#region src/services/sidebar/hooks/use-sidebar-click.ts
|
|
29305
|
+
// src/services/sidebar/hooks/use-sidebar-click.ts
|
|
29047
29306
|
/**
|
|
29048
29307
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
29049
29308
|
*
|
|
@@ -29074,8 +29333,7 @@ const useSidebarClick = (cb) => {
|
|
|
29074
29333
|
}, [cb, container]);
|
|
29075
29334
|
};
|
|
29076
29335
|
|
|
29077
|
-
|
|
29078
|
-
//#region src/utils/util.ts
|
|
29336
|
+
// src/utils/util.ts
|
|
29079
29337
|
/**
|
|
29080
29338
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
29081
29339
|
*
|
|
@@ -29096,8 +29354,7 @@ function textTrim(x) {
|
|
|
29096
29354
|
return x.replace(/^\s+|\s+$/gm, "");
|
|
29097
29355
|
}
|
|
29098
29356
|
|
|
29099
|
-
|
|
29100
|
-
//#region src/utils/cell.ts
|
|
29357
|
+
// src/utils/cell.ts
|
|
29101
29358
|
const PX_TO_PT_RATIO = .75;
|
|
29102
29359
|
const MAX_FONT_SIZE = 78;
|
|
29103
29360
|
const MIN_FONT_SIZE = 9;
|
|
@@ -29668,8 +29925,7 @@ function extractFontFamily(styleStr) {
|
|
|
29668
29925
|
return matches ? (matches[1] || matches[2] || matches[3]).trim() : null;
|
|
29669
29926
|
}
|
|
29670
29927
|
|
|
29671
|
-
|
|
29672
|
-
//#region src/utils/mobile-canvas-gesture.ts
|
|
29928
|
+
// src/utils/mobile-canvas-gesture.ts
|
|
29673
29929
|
/** Routes touch browsing separately from the canvas's existing object manipulation. */
|
|
29674
29930
|
var MobileCanvasGesture = class extends _univerjs_core.Disposable {
|
|
29675
29931
|
constructor(_canvas, _options) {
|
|
@@ -29883,8 +30139,7 @@ var MobileCanvasGesture = class extends _univerjs_core.Disposable {
|
|
|
29883
30139
|
}
|
|
29884
30140
|
};
|
|
29885
30141
|
|
|
29886
|
-
|
|
29887
|
-
//#region src/views/components/dom/Print.tsx
|
|
30142
|
+
// src/views/components/dom/Print.tsx
|
|
29888
30143
|
const PrintFloatDomSingle = (0, react.memo)((props) => {
|
|
29889
30144
|
const { layer } = props;
|
|
29890
30145
|
return typeof layer.componentKey === "string" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RegisteredPrintFloatDomSingle, {
|
|
@@ -29966,8 +30221,7 @@ function PrintFloatDomSingleContent(props) {
|
|
|
29966
30221
|
});
|
|
29967
30222
|
}
|
|
29968
30223
|
|
|
29969
|
-
|
|
29970
|
-
//#region src/views/components/hover-track/HoverTrack.tsx
|
|
30224
|
+
// src/views/components/hover-track/HoverTrack.tsx
|
|
29971
30225
|
const HOVER_TRACK_HOST_CLASS_NAME = "univer-group/hover-track";
|
|
29972
30226
|
const HOVER_TRACK_MASK = "linear-gradient(currentColor 0 0) content-box, linear-gradient(currentColor 0 0)";
|
|
29973
30227
|
const HOVER_TRACK_MASK_STYLE = {
|
|
@@ -29986,8 +30240,7 @@ function HoverTrack(props) {
|
|
|
29986
30240
|
});
|
|
29987
30241
|
}
|
|
29988
30242
|
|
|
29989
|
-
|
|
29990
|
-
//#region src/views/components/mobile-zoom-indicator/mobile-zoom-indicator.ts
|
|
30243
|
+
// src/views/components/mobile-zoom-indicator/mobile-zoom-indicator.ts
|
|
29991
30244
|
/**
|
|
29992
30245
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
29993
30246
|
*
|
|
@@ -30065,27 +30318,41 @@ var MobileZoomIndicator = class extends _univerjs_core.Disposable {
|
|
|
30065
30318
|
}
|
|
30066
30319
|
};
|
|
30067
30320
|
|
|
30068
|
-
|
|
30069
|
-
|
|
30321
|
+
// src/views/font-family/MobileFontFamilyDropdown.tsx
|
|
30322
|
+
/**
|
|
30323
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
30324
|
+
*
|
|
30325
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
30326
|
+
* you may not use this file except in compliance with the License.
|
|
30327
|
+
* You may obtain a copy of the License at
|
|
30328
|
+
*
|
|
30329
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
30330
|
+
*
|
|
30331
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
30332
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
30333
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
30334
|
+
* See the License for the specific language governing permissions and
|
|
30335
|
+
* limitations under the License.
|
|
30336
|
+
*/
|
|
30070
30337
|
function MobileFontFamilyDropdown(props) {
|
|
30071
30338
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
30072
|
-
const disabled =
|
|
30339
|
+
const disabled = useObservable(props.disabled$);
|
|
30073
30340
|
const { fonts } = useFontList();
|
|
30074
30341
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.MobileSelect, {
|
|
30075
30342
|
"aria-label": props.ariaLabel,
|
|
30076
|
-
className: (0, _univerjs_design.clsx)("univer-
|
|
30343
|
+
className: (0, _univerjs_design.clsx)("univer-w-full univer-min-w-0", props.className),
|
|
30077
30344
|
value: props.value,
|
|
30078
30345
|
disabled: !!(props.disabled || disabled),
|
|
30079
30346
|
options: fonts.map((font) => ({
|
|
30080
30347
|
value: font.value,
|
|
30081
30348
|
label: localeService.t(font.label)
|
|
30082
30349
|
})),
|
|
30083
|
-
onChange: props.onChange
|
|
30350
|
+
onChange: props.onChange,
|
|
30351
|
+
size: "small"
|
|
30084
30352
|
});
|
|
30085
30353
|
}
|
|
30086
30354
|
|
|
30087
|
-
|
|
30088
|
-
//#region src/views/progress-bar/ProgressBar.tsx
|
|
30355
|
+
// src/views/progress-bar/ProgressBar.tsx
|
|
30089
30356
|
/**
|
|
30090
30357
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
30091
30358
|
*
|
|
@@ -30173,7 +30440,6 @@ function ProgressBar(props) {
|
|
|
30173
30440
|
});
|
|
30174
30441
|
}
|
|
30175
30442
|
|
|
30176
|
-
//#endregion
|
|
30177
30443
|
exports.AnchoredContextMenu = AnchoredContextMenu;
|
|
30178
30444
|
Object.defineProperty(exports, "BrowserClipboardService", {
|
|
30179
30445
|
enumerable: true,
|
|
@@ -30258,7 +30524,12 @@ Object.defineProperty(exports, "DesktopRibbonService", {
|
|
|
30258
30524
|
return DesktopRibbonService;
|
|
30259
30525
|
}
|
|
30260
30526
|
});
|
|
30261
|
-
exports
|
|
30527
|
+
Object.defineProperty(exports, "DesktopSidebarService", {
|
|
30528
|
+
enumerable: true,
|
|
30529
|
+
get: function () {
|
|
30530
|
+
return DesktopSidebarService;
|
|
30531
|
+
}
|
|
30532
|
+
});
|
|
30262
30533
|
Object.defineProperty(exports, "DesktopUIController", {
|
|
30263
30534
|
enumerable: true,
|
|
30264
30535
|
get: function () {
|
|
@@ -30537,12 +30808,7 @@ Object.defineProperty(exports, "useInjector", {
|
|
|
30537
30808
|
});
|
|
30538
30809
|
exports.useMobileCanvasPanel = useMobileCanvasPanel;
|
|
30539
30810
|
exports.useMobileCanvasViewport = useMobileCanvasViewport;
|
|
30540
|
-
|
|
30541
|
-
enumerable: true,
|
|
30542
|
-
get: function () {
|
|
30543
|
-
return _wendellhu_redi_react_bindings.useObservable;
|
|
30544
|
-
}
|
|
30545
|
-
});
|
|
30811
|
+
exports.useObservable = useObservable;
|
|
30546
30812
|
exports.useObservableRef = useObservableRef;
|
|
30547
30813
|
exports.useScrollYOverContainer = useScrollYOverContainer;
|
|
30548
30814
|
exports.useSidebarClick = useSidebarClick;
|