@univerjs/ui 0.2.10 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +9 -9
- package/lib/es/index.js +1036 -757
- package/lib/locale/en-US.json +3 -3
- package/lib/locale/ru-RU.json +3 -3
- package/lib/locale/vi-VN.json +3 -3
- package/lib/locale/zh-CN.json +3 -3
- package/lib/locale/zh-TW.json +3 -3
- package/lib/types/components/menu/desktop/Menu.d.ts +2 -2
- package/lib/types/controllers/config.schema.d.ts +12 -0
- package/lib/types/controllers/menus/menu.schema.d.ts +2 -0
- package/lib/types/controllers/shared-shortcut.controller.d.ts +2 -8
- package/lib/types/controllers/shortcut-display/shortcut-panel.controller.d.ts +3 -4
- package/lib/types/controllers/ui/ui-desktop.controller.d.ts +7 -4
- package/lib/types/controllers/ui/ui-mobile.controller.d.ts +6 -2
- package/lib/types/controllers/ui/ui.controller.d.ts +15 -9
- package/lib/types/index.d.ts +10 -5
- package/lib/types/locale/zh-CN.d.ts +2 -2
- package/lib/types/mobile-ui-plugin.d.ts +2 -2
- package/lib/types/services/menu/menu-manager.service.d.ts +44 -0
- package/lib/types/services/menu/menu.d.ts +11 -9
- package/lib/types/services/menu/menu.service.d.ts +8 -2
- package/lib/types/services/menu/types.d.ts +64 -0
- package/lib/types/ui-plugin.d.ts +5 -4
- package/lib/types/views/components/ribbon/Ribbon.d.ts +6 -0
- package/lib/types/views/components/{doc-bars → ribbon}/ToolbarItem.d.ts +4 -1
- package/lib/types/views/components/ribbon/TooltipButtonWrapper.d.ts +4 -0
- package/lib/types/views/components/{doc-bars → ribbon}/hook.d.ts +0 -8
- package/lib/umd/index.js +6 -6
- package/package.json +14 -14
- package/lib/types/views/components/doc-bars/Toolbar.d.ts +0 -8
- /package/lib/types/views/components/{doc-bars → ribbon}/Button/ToolbarButton.d.ts +0 -0
package/lib/es/index.js
CHANGED
|
@@ -6,16 +6,16 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
6
6
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
7
7
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
8
8
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
9
|
-
import { toDisposable, IUniverInstanceService, DocumentFlavor, useDependency, LocaleService, ColorKit, CommandType, DEFAULT_STYLES, Disposable, EDITOR_ACTIVATED, FOCUSING_EDITOR_STANDALONE, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, FOCUSING_EDITOR_INPUT_FORMULA, UniverInstanceType, DEFAULT_EMPTY_DOCUMENT_VALUE, VerticalAlign, HorizontalAlign, Inject, createIdentifier, IContextService, Workbook, DocumentDataModel, SlideDataModel, remove, FOCUSING_UNIVER_EDITOR, OnLifecycle, LifecycleStages, Optional, ICommandService,
|
|
10
|
-
import { Observable, isObservable, Subject, fromEvent,
|
|
9
|
+
import { toDisposable, IUniverInstanceService, DocumentFlavor, useDependency, LocaleService, ColorKit, CommandType, DEFAULT_STYLES, Disposable, EDITOR_ACTIVATED, FOCUSING_EDITOR_STANDALONE, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, FOCUSING_EDITOR_INPUT_FORMULA, UniverInstanceType, DEFAULT_EMPTY_DOCUMENT_VALUE, VerticalAlign, HorizontalAlign, Inject, createIdentifier, IContextService, Workbook, DocumentDataModel, SlideDataModel, remove, FOCUSING_UNIVER_EDITOR, OnLifecycle, LifecycleStages, Optional, ICommandService, UndoCommand, RedoCommand, runOnLifecycle, Tools, Injector, IConfigService, isRealNum, useInjector, ILogService, ThemeService, IUndoRedoService, connectInjector, LifecycleService, isInternalEditorID, ErrorService, Plugin, mergeOverrideWithDependencies, ILocalStorageService, DependentOn, useObservable as useObservable$2, BaselineOffset, getBorderStyleType, BorderStyleTypes, debounce } from "@univerjs/core";
|
|
10
|
+
import { Observable, isObservable, Subject, fromEvent, BehaviorSubject, throttleTime, animationFrameScheduler, filter, debounceTime, map, startWith, switchMap, combineLatest, distinctUntilChanged } from "rxjs";
|
|
11
11
|
import * as React from "react";
|
|
12
|
-
import React__default, { forwardRef, useRef, createElement, cloneElement, useEffect, useMemo, useState, useCallback, memo, useContext, version as version$1, isValidElement, useLayoutEffect } from "react";
|
|
12
|
+
import React__default, { forwardRef, useRef, createElement, cloneElement, useEffect, useMemo, useState, useCallback, memo, createContext, useContext, version as version$1, isValidElement, useLayoutEffect } from "react";
|
|
13
13
|
import { IRenderManagerService, ITextSelectionRenderManager, UniverRenderEnginePlugin, ptToPx } from "@univerjs/engine-render";
|
|
14
14
|
import { operatorToken, isReferenceStrings, LexerTreeBuilder, serializeRange, serializeRangeWithSheet, serializeRangeWithSpreadsheet, isReferenceStringWithEffectiveColumn, getRangeWithRefsString } from "@univerjs/engine-formula";
|
|
15
|
-
import { map } from "rxjs/operators";
|
|
16
15
|
import ReactDOM$1, { createPortal } from "react-dom";
|
|
17
16
|
import { InputNumber, resizeObserverCtor, RectPopup, Menu as Menu$1, MenuItemGroup, MenuItem as MenuItem$1, SubMenu, Popup, Tooltip, Dropdown, defaultTheme, themeInstance, ConfigProvider, ConfigContext, Confirm, Dialog, Message, MessageType, Button, Input } from "@univerjs/design";
|
|
18
17
|
import clsx$1, { clsx as clsx$2 } from "clsx";
|
|
18
|
+
import { map as map$1 } from "rxjs/operators";
|
|
19
19
|
import { useObservable as useObservable$1 } from "@univerjs/ui";
|
|
20
20
|
var __assign = function() {
|
|
21
21
|
return __assign = Object.assign || function(t2) {
|
|
@@ -46,15 +46,15 @@ function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
|
|
|
46
46
|
var attrs = __assign({}, node.attrs);
|
|
47
47
|
extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
|
|
48
48
|
var defIds = runtimeProps.defIds;
|
|
49
|
-
return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(
|
|
50
|
-
var key =
|
|
49
|
+
return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a19) {
|
|
50
|
+
var key = _a19[0], value = _a19[1];
|
|
51
51
|
typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
|
|
52
52
|
})), attrs;
|
|
53
53
|
}
|
|
54
54
|
__name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
|
|
55
55
|
function replaceRuntimeIdsInDefs(node, runtimeProps) {
|
|
56
|
-
var
|
|
57
|
-
return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((
|
|
56
|
+
var _a19, defIds = runtimeProps.defIds;
|
|
57
|
+
return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a19 = node.children) === null || _a19 === void 0) && _a19.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
|
|
58
58
|
return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
|
|
59
59
|
}) }) : node;
|
|
60
60
|
}
|
|
@@ -1261,9 +1261,9 @@ const uiPluginSheetsFontFamily = "univer-ui-plugin-sheets-font-family", uiPlugin
|
|
|
1261
1261
|
}, [value]);
|
|
1262
1262
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$g.uiPluginSheetsFontFamily, style: { fontFamily: value }, children: viewValue });
|
|
1263
1263
|
}, "FontFamily"), FontFamilyItem = /* @__PURE__ */ __name((props) => {
|
|
1264
|
-
var
|
|
1264
|
+
var _a19;
|
|
1265
1265
|
const { value } = props, localeService = useDependency(LocaleService);
|
|
1266
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: styles$g.uiPluginSheetsFontFamilyItem, style: { fontFamily: value }, children: localeService.t(`fontFamily.${((
|
|
1266
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: styles$g.uiPluginSheetsFontFamilyItem, style: { fontFamily: value }, children: localeService.t(`fontFamily.${((_a19 = `${value}`) != null ? _a19 : "").replace(/\s/g, "")}`) });
|
|
1267
1267
|
}, "FontFamilyItem"), FONT_FAMILY_LIST = [
|
|
1268
1268
|
{
|
|
1269
1269
|
value: "Arial"
|
|
@@ -1555,15 +1555,82 @@ const useVirtualList = /* @__PURE__ */ __name((list, options) => {
|
|
|
1555
1555
|
preconditions: /* @__PURE__ */ __name(() => !1, "preconditions"),
|
|
1556
1556
|
handler: /* @__PURE__ */ __name(async () => !0, "handler")
|
|
1557
1557
|
};
|
|
1558
|
+
var KeyCode$1 = /* @__PURE__ */ ((KeyCode2) => (KeyCode2[KeyCode2.UNKNOWN = 0] = "UNKNOWN", KeyCode2[KeyCode2.BACKSPACE = 8] = "BACKSPACE", KeyCode2[KeyCode2.TAB = 9] = "TAB", KeyCode2[KeyCode2.ENTER = 13] = "ENTER", KeyCode2[KeyCode2.SHIFT = 16] = "SHIFT", KeyCode2[KeyCode2.CTRL = 17] = "CTRL", KeyCode2[KeyCode2.ESC = 27] = "ESC", KeyCode2[KeyCode2.SPACE = 32] = "SPACE", KeyCode2[KeyCode2.ARROW_LEFT = 37] = "ARROW_LEFT", KeyCode2[KeyCode2.ARROW_UP = 38] = "ARROW_UP", KeyCode2[KeyCode2.ARROW_RIGHT = 39] = "ARROW_RIGHT", KeyCode2[KeyCode2.ARROW_DOWN = 40] = "ARROW_DOWN", KeyCode2[KeyCode2.INSERT = 45] = "INSERT", KeyCode2[KeyCode2.DELETE = 46] = "DELETE", KeyCode2[KeyCode2.Digit0 = 48] = "Digit0", KeyCode2[KeyCode2.Digit1 = 49] = "Digit1", KeyCode2[KeyCode2.Digit2 = 50] = "Digit2", KeyCode2[KeyCode2.Digit3 = 51] = "Digit3", KeyCode2[KeyCode2.Digit4 = 52] = "Digit4", KeyCode2[KeyCode2.Digit5 = 53] = "Digit5", KeyCode2[KeyCode2.Digit6 = 54] = "Digit6", KeyCode2[KeyCode2.Digit7 = 55] = "Digit7", KeyCode2[KeyCode2.Digit8 = 56] = "Digit8", KeyCode2[KeyCode2.Digit9 = 57] = "Digit9", KeyCode2[KeyCode2.A = 65] = "A", KeyCode2[KeyCode2.B = 66] = "B", KeyCode2[KeyCode2.C = 67] = "C", KeyCode2[KeyCode2.D = 68] = "D", KeyCode2[KeyCode2.E = 69] = "E", KeyCode2[KeyCode2.F = 70] = "F", KeyCode2[KeyCode2.G = 71] = "G", KeyCode2[KeyCode2.H = 72] = "H", KeyCode2[KeyCode2.I = 73] = "I", KeyCode2[KeyCode2.J = 74] = "J", KeyCode2[KeyCode2.K = 75] = "K", KeyCode2[KeyCode2.L = 76] = "L", KeyCode2[KeyCode2.M = 77] = "M", KeyCode2[KeyCode2.N = 78] = "N", KeyCode2[KeyCode2.O = 79] = "O", KeyCode2[KeyCode2.P = 80] = "P", KeyCode2[KeyCode2.Q = 81] = "Q", KeyCode2[KeyCode2.R = 82] = "R", KeyCode2[KeyCode2.S = 83] = "S", KeyCode2[KeyCode2.T = 84] = "T", KeyCode2[KeyCode2.U = 85] = "U", KeyCode2[KeyCode2.V = 86] = "V", KeyCode2[KeyCode2.W = 87] = "W", KeyCode2[KeyCode2.X = 88] = "X", KeyCode2[KeyCode2.Y = 89] = "Y", KeyCode2[KeyCode2.Z = 90] = "Z", KeyCode2[KeyCode2.F1 = 112] = "F1", KeyCode2[KeyCode2.F2 = 113] = "F2", KeyCode2[KeyCode2.F3 = 114] = "F3", KeyCode2[KeyCode2.F4 = 115] = "F4", KeyCode2[KeyCode2.F5 = 116] = "F5", KeyCode2[KeyCode2.F6 = 117] = "F6", KeyCode2[KeyCode2.F7 = 118] = "F7", KeyCode2[KeyCode2.F8 = 119] = "F8", KeyCode2[KeyCode2.F9 = 120] = "F9", KeyCode2[KeyCode2.F10 = 121] = "F10", KeyCode2[KeyCode2.F11 = 122] = "F11", KeyCode2[KeyCode2.F12 = 123] = "F12", KeyCode2[KeyCode2.NUM_LOCK = 144] = "NUM_LOCK", KeyCode2[KeyCode2.SCROLL_LOCK = 145] = "SCROLL_LOCK", KeyCode2[KeyCode2.EQUAL = 187] = "EQUAL", KeyCode2[KeyCode2.COMMA = 188] = "COMMA", KeyCode2[KeyCode2.MINUS = 189] = "MINUS", KeyCode2[KeyCode2.PERIOD = 190] = "PERIOD", KeyCode2[KeyCode2.BACK_SLASH = 220] = "BACK_SLASH", KeyCode2))(KeyCode$1 || {});
|
|
1559
|
+
const KeyCodeToChar = {
|
|
1560
|
+
8: "Backspace",
|
|
1561
|
+
9: "Tab",
|
|
1562
|
+
13: "Enter",
|
|
1563
|
+
46: "Del",
|
|
1564
|
+
27: "Esc",
|
|
1565
|
+
32: "Space",
|
|
1566
|
+
37: "←",
|
|
1567
|
+
39: "→",
|
|
1568
|
+
38: "↑",
|
|
1569
|
+
40: "↓",
|
|
1570
|
+
48: "0",
|
|
1571
|
+
49: "1",
|
|
1572
|
+
50: "2",
|
|
1573
|
+
51: "3",
|
|
1574
|
+
52: "4",
|
|
1575
|
+
53: "5",
|
|
1576
|
+
54: "6",
|
|
1577
|
+
55: "7",
|
|
1578
|
+
56: "8",
|
|
1579
|
+
57: "9",
|
|
1580
|
+
65: "A",
|
|
1581
|
+
66: "B",
|
|
1582
|
+
67: "C",
|
|
1583
|
+
68: "D",
|
|
1584
|
+
69: "E",
|
|
1585
|
+
70: "F",
|
|
1586
|
+
71: "G",
|
|
1587
|
+
72: "H",
|
|
1588
|
+
73: "I",
|
|
1589
|
+
74: "J",
|
|
1590
|
+
75: "K",
|
|
1591
|
+
76: "L",
|
|
1592
|
+
77: "M",
|
|
1593
|
+
78: "N",
|
|
1594
|
+
79: "O",
|
|
1595
|
+
80: "P",
|
|
1596
|
+
81: "Q",
|
|
1597
|
+
82: "R",
|
|
1598
|
+
83: "S",
|
|
1599
|
+
84: "T",
|
|
1600
|
+
85: "U",
|
|
1601
|
+
86: "V",
|
|
1602
|
+
87: "W",
|
|
1603
|
+
88: "X",
|
|
1604
|
+
89: "Y",
|
|
1605
|
+
90: "Z",
|
|
1606
|
+
112: "F1",
|
|
1607
|
+
113: "F2",
|
|
1608
|
+
114: "F3",
|
|
1609
|
+
115: "F4",
|
|
1610
|
+
116: "F5",
|
|
1611
|
+
117: "F6",
|
|
1612
|
+
118: "F7",
|
|
1613
|
+
119: "F8",
|
|
1614
|
+
120: "F9",
|
|
1615
|
+
121: "F10",
|
|
1616
|
+
122: "F11",
|
|
1617
|
+
123: "F12",
|
|
1618
|
+
189: "-",
|
|
1619
|
+
187: "=",
|
|
1620
|
+
190: ".",
|
|
1621
|
+
188: ",",
|
|
1622
|
+
220: "\\"
|
|
1623
|
+
};
|
|
1624
|
+
var MetaKeys = /* @__PURE__ */ ((MetaKeys2) => (MetaKeys2[MetaKeys2.SHIFT = 1024] = "SHIFT", MetaKeys2[MetaKeys2.ALT = 2048] = "ALT", MetaKeys2[MetaKeys2.CTRL_COMMAND = 4096] = "CTRL_COMMAND", MetaKeys2[MetaKeys2.MAC_CTRL = 8192] = "MAC_CTRL", MetaKeys2))(MetaKeys || {});
|
|
1558
1625
|
function fromGlobalEvent(type, listener, options) {
|
|
1559
1626
|
return window.addEventListener(type, listener, options), toDisposable(() => window.removeEventListener(type, listener, options));
|
|
1560
1627
|
}
|
|
1561
1628
|
__name(fromGlobalEvent, "fromGlobalEvent");
|
|
1562
|
-
var __defProp$
|
|
1563
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
1629
|
+
var __defProp$i = Object.defineProperty, __getOwnPropDesc$i = Object.getOwnPropertyDescriptor, __decorateClass$i = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
1630
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$i(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1564
1631
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
1565
|
-
return kind && result && __defProp$
|
|
1566
|
-
}, "__decorateClass$
|
|
1632
|
+
return kind && result && __defProp$i(target, key, result), result;
|
|
1633
|
+
}, "__decorateClass$i"), __decorateParam$i = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$i");
|
|
1567
1634
|
const _Editor = class _Editor {
|
|
1568
1635
|
constructor(_param) {
|
|
1569
1636
|
__publicField(this, "_focus", !1);
|
|
@@ -1640,8 +1707,8 @@ const _Editor = class _Editor {
|
|
|
1640
1707
|
return this._param.isFormulaEditor === !0;
|
|
1641
1708
|
}
|
|
1642
1709
|
getValue() {
|
|
1643
|
-
var
|
|
1644
|
-
return (((
|
|
1710
|
+
var _a19;
|
|
1711
|
+
return (((_a19 = this._param.documentDataModel.getBody()) == null ? void 0 : _a19.dataStream) || "").replace(/\r\n/g, "").replace(/\n/g, "").replace(/\n/g, "");
|
|
1645
1712
|
}
|
|
1646
1713
|
getBody() {
|
|
1647
1714
|
return this._param.documentDataModel.getBody();
|
|
@@ -1653,8 +1720,8 @@ const _Editor = class _Editor {
|
|
|
1653
1720
|
};
|
|
1654
1721
|
}
|
|
1655
1722
|
verticalAlign() {
|
|
1656
|
-
var
|
|
1657
|
-
const documentDataModel = (
|
|
1723
|
+
var _a19, _b2;
|
|
1724
|
+
const documentDataModel = (_a19 = this._param) == null ? void 0 : _a19.documentDataModel;
|
|
1658
1725
|
if (documentDataModel == null)
|
|
1659
1726
|
return;
|
|
1660
1727
|
const { width, height } = this._param.editorDom.getBoundingClientRect();
|
|
@@ -1672,12 +1739,12 @@ const _Editor = class _Editor {
|
|
|
1672
1739
|
}), documentDataModel.updateDocumentDataPageSize(void 0, void 0);
|
|
1673
1740
|
}
|
|
1674
1741
|
updateCanvasStyle() {
|
|
1675
|
-
var
|
|
1742
|
+
var _a19;
|
|
1676
1743
|
const documentDataModel = this._param.documentDataModel;
|
|
1677
1744
|
if (documentDataModel == null)
|
|
1678
1745
|
return;
|
|
1679
1746
|
const documentStyle = {};
|
|
1680
|
-
(
|
|
1747
|
+
(_a19 = this._param.canvasStyle) != null && _a19.fontSize && (documentStyle.textStyle == null && (documentStyle.textStyle = {}), documentStyle.textStyle.fs = this._param.canvasStyle.fontSize), documentDataModel.updateDocumentStyle(documentStyle);
|
|
1681
1748
|
}
|
|
1682
1749
|
};
|
|
1683
1750
|
__name(_Editor, "Editor");
|
|
@@ -1764,7 +1831,7 @@ let EditorService = (_b = class extends Disposable {
|
|
|
1764
1831
|
editor.setFocus(!1);
|
|
1765
1832
|
}), this._focusStyle$.next(), this._blur$.next(null);
|
|
1766
1833
|
}
|
|
1767
|
-
focus(editorUnitId = ((
|
|
1834
|
+
focus(editorUnitId = ((_a19) => (_a19 = this._univerInstanceService.getCurrentUniverDocInstance()) == null ? void 0 : _a19.getUnitId())()) {
|
|
1768
1835
|
if (editorUnitId == null)
|
|
1769
1836
|
return;
|
|
1770
1837
|
const editor = this.getEditor(editorUnitId);
|
|
@@ -1821,8 +1888,8 @@ let EditorService = (_b = class extends Disposable {
|
|
|
1821
1888
|
editor != null && (editor.verticalAlign(), this._resize$.next(unitId));
|
|
1822
1889
|
}
|
|
1823
1890
|
isVisible(id) {
|
|
1824
|
-
var
|
|
1825
|
-
return (
|
|
1891
|
+
var _a19;
|
|
1892
|
+
return (_a19 = this.getEditor(id)) == null ? void 0 : _a19.isVisible();
|
|
1826
1893
|
}
|
|
1827
1894
|
setOperationSheetUnitId(unitId) {
|
|
1828
1895
|
this._currentSheetUnitId = unitId;
|
|
@@ -1837,8 +1904,8 @@ let EditorService = (_b = class extends Disposable {
|
|
|
1837
1904
|
return this._currentSheetSubUnitId;
|
|
1838
1905
|
}
|
|
1839
1906
|
register(config, container) {
|
|
1840
|
-
var
|
|
1841
|
-
const { initialSnapshot, editorUnitId, canvasStyle = {} } = config, documentDataModel = (
|
|
1907
|
+
var _a19, _b2, _c, _d, _e;
|
|
1908
|
+
const { initialSnapshot, editorUnitId, canvasStyle = {} } = config, documentDataModel = (_a19 = this._univerInstanceService.getUnit(editorUnitId, UniverInstanceType.UNIVER_DOC)) != null ? _a19 : this._univerInstanceService.createUnit(
|
|
1842
1909
|
UniverInstanceType.UNIVER_DOC,
|
|
1843
1910
|
initialSnapshot || this._getBlank(editorUnitId),
|
|
1844
1911
|
{ makeCurrent: !1 }
|
|
@@ -1915,18 +1982,18 @@ let EditorService = (_b = class extends Disposable {
|
|
|
1915
1982
|
};
|
|
1916
1983
|
}
|
|
1917
1984
|
}, __name(_b, "EditorService"), _b);
|
|
1918
|
-
EditorService = __decorateClass$
|
|
1919
|
-
__decorateParam$
|
|
1920
|
-
__decorateParam$
|
|
1921
|
-
__decorateParam$
|
|
1922
|
-
__decorateParam$
|
|
1985
|
+
EditorService = __decorateClass$i([
|
|
1986
|
+
__decorateParam$i(0, IUniverInstanceService),
|
|
1987
|
+
__decorateParam$i(1, IRenderManagerService),
|
|
1988
|
+
__decorateParam$i(2, Inject(LexerTreeBuilder)),
|
|
1989
|
+
__decorateParam$i(3, IContextService)
|
|
1923
1990
|
], EditorService);
|
|
1924
1991
|
const IEditorService = createIdentifier("univer.editor.service");
|
|
1925
|
-
var __defProp$
|
|
1926
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
1992
|
+
var __defProp$h = Object.defineProperty, __getOwnPropDesc$h = Object.getOwnPropertyDescriptor, __decorateClass$h = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
1993
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1927
1994
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
1928
|
-
return kind && result && __defProp$
|
|
1929
|
-
}, "__decorateClass$
|
|
1995
|
+
return kind && result && __defProp$h(target, key, result), result;
|
|
1996
|
+
}, "__decorateClass$h"), __decorateParam$h = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$h");
|
|
1930
1997
|
const FOCUSING_UNIVER = "FOCUSING_UNIVER", givingBackFocusElements = [
|
|
1931
1998
|
"univer-app-layout",
|
|
1932
1999
|
"univer-toolbar-btn",
|
|
@@ -2022,15 +2089,15 @@ let DesktopLayoutService = (_a = class extends Disposable {
|
|
|
2022
2089
|
focusEditor && focusEditor.isSheetEditor() !== !0 && this._editorService.blur();
|
|
2023
2090
|
}
|
|
2024
2091
|
}, __name(_a, "DesktopLayoutService"), _a);
|
|
2025
|
-
DesktopLayoutService = __decorateClass$
|
|
2092
|
+
DesktopLayoutService = __decorateClass$h([
|
|
2026
2093
|
OnLifecycle(LifecycleStages.Ready, ILayoutService),
|
|
2027
|
-
__decorateParam$
|
|
2028
|
-
__decorateParam$
|
|
2029
|
-
__decorateParam$
|
|
2094
|
+
__decorateParam$h(0, IContextService),
|
|
2095
|
+
__decorateParam$h(1, IUniverInstanceService),
|
|
2096
|
+
__decorateParam$h(2, IEditorService)
|
|
2030
2097
|
], DesktopLayoutService);
|
|
2031
2098
|
function getFocusingUniverEditorStatus() {
|
|
2032
|
-
var
|
|
2033
|
-
return !!((
|
|
2099
|
+
var _a19;
|
|
2100
|
+
return !!((_a19 = document.activeElement) != null && _a19.classList.contains("univer-editor"));
|
|
2034
2101
|
}
|
|
2035
2102
|
__name(getFocusingUniverEditorStatus, "getFocusingUniverEditorStatus");
|
|
2036
2103
|
const IPlatformService = createIdentifier("ui.platform.service"), _PlatformService = class _PlatformService {
|
|
@@ -2046,77 +2113,11 @@ const IPlatformService = createIdentifier("ui.platform.service"), _PlatformServi
|
|
|
2046
2113
|
};
|
|
2047
2114
|
__name(_PlatformService, "PlatformService");
|
|
2048
2115
|
let PlatformService = _PlatformService;
|
|
2049
|
-
var
|
|
2050
|
-
|
|
2051
|
-
8: "Backspace",
|
|
2052
|
-
9: "Tab",
|
|
2053
|
-
13: "Enter",
|
|
2054
|
-
46: "Del",
|
|
2055
|
-
27: "Esc",
|
|
2056
|
-
32: "Space",
|
|
2057
|
-
37: "←",
|
|
2058
|
-
39: "→",
|
|
2059
|
-
38: "↑",
|
|
2060
|
-
40: "↓",
|
|
2061
|
-
48: "0",
|
|
2062
|
-
49: "1",
|
|
2063
|
-
50: "2",
|
|
2064
|
-
51: "3",
|
|
2065
|
-
52: "4",
|
|
2066
|
-
53: "5",
|
|
2067
|
-
54: "6",
|
|
2068
|
-
55: "7",
|
|
2069
|
-
56: "8",
|
|
2070
|
-
57: "9",
|
|
2071
|
-
65: "A",
|
|
2072
|
-
66: "B",
|
|
2073
|
-
67: "C",
|
|
2074
|
-
68: "D",
|
|
2075
|
-
69: "E",
|
|
2076
|
-
70: "F",
|
|
2077
|
-
71: "G",
|
|
2078
|
-
72: "H",
|
|
2079
|
-
73: "I",
|
|
2080
|
-
74: "J",
|
|
2081
|
-
75: "K",
|
|
2082
|
-
76: "L",
|
|
2083
|
-
77: "M",
|
|
2084
|
-
78: "N",
|
|
2085
|
-
79: "O",
|
|
2086
|
-
80: "P",
|
|
2087
|
-
81: "Q",
|
|
2088
|
-
82: "R",
|
|
2089
|
-
83: "S",
|
|
2090
|
-
84: "T",
|
|
2091
|
-
85: "U",
|
|
2092
|
-
86: "V",
|
|
2093
|
-
87: "W",
|
|
2094
|
-
88: "X",
|
|
2095
|
-
89: "Y",
|
|
2096
|
-
90: "Z",
|
|
2097
|
-
112: "F1",
|
|
2098
|
-
113: "F2",
|
|
2099
|
-
114: "F3",
|
|
2100
|
-
115: "F4",
|
|
2101
|
-
116: "F5",
|
|
2102
|
-
117: "F6",
|
|
2103
|
-
118: "F7",
|
|
2104
|
-
119: "F8",
|
|
2105
|
-
120: "F9",
|
|
2106
|
-
121: "F10",
|
|
2107
|
-
122: "F11",
|
|
2108
|
-
123: "F12",
|
|
2109
|
-
189: "-",
|
|
2110
|
-
187: "=",
|
|
2111
|
-
190: ".",
|
|
2112
|
-
188: ",",
|
|
2113
|
-
220: "\\"
|
|
2114
|
-
};
|
|
2115
|
-
var MetaKeys = /* @__PURE__ */ ((MetaKeys2) => (MetaKeys2[MetaKeys2.SHIFT = 1024] = "SHIFT", MetaKeys2[MetaKeys2.ALT = 2048] = "ALT", MetaKeys2[MetaKeys2.CTRL_COMMAND = 4096] = "CTRL_COMMAND", MetaKeys2[MetaKeys2.MAC_CTRL = 8192] = "MAC_CTRL", MetaKeys2))(MetaKeys || {}), __defProp$f = Object.defineProperty, __getOwnPropDesc$f = Object.getOwnPropertyDescriptor, __decorateClass$f = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2116
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2116
|
+
var __defProp$g = Object.defineProperty, __getOwnPropDesc$g = Object.getOwnPropertyDescriptor, __decorateClass$g = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2117
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2117
2118
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2118
|
-
return kind && result && __defProp$
|
|
2119
|
-
}, "__decorateClass$
|
|
2119
|
+
return kind && result && __defProp$g(target, key, result), result;
|
|
2120
|
+
}, "__decorateClass$g"), __decorateParam$g = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$g");
|
|
2120
2121
|
const IShortcutService = createIdentifier("ui.shortcut.service");
|
|
2121
2122
|
var _a2;
|
|
2122
2123
|
let ShortcutService = (_a2 = class extends Disposable {
|
|
@@ -2143,8 +2144,8 @@ let ShortcutService = (_a2 = class extends Disposable {
|
|
|
2143
2144
|
bindingSet ? bindingSet.add(shortcut) : this._shortCutMapping.set(binding, /* @__PURE__ */ new Set([shortcut]));
|
|
2144
2145
|
const commandID = shortcut.id, commandIDSet = this._commandIDMapping.get(commandID);
|
|
2145
2146
|
return commandIDSet ? commandIDSet.add(shortcut) : this._commandIDMapping.set(commandID, /* @__PURE__ */ new Set([shortcut])), this._emitShortcutChanged(), toDisposable(() => {
|
|
2146
|
-
var
|
|
2147
|
-
(
|
|
2147
|
+
var _a19, _b2, _c, _d;
|
|
2148
|
+
(_a19 = this._shortCutMapping.get(binding)) == null || _a19.delete(shortcut), ((_b2 = this._shortCutMapping.get(binding)) == null ? void 0 : _b2.size) === 0 && this._shortCutMapping.delete(binding), (_c = this._commandIDMapping.get(commandID)) == null || _c.delete(shortcut), ((_d = this._commandIDMapping.get(commandID)) == null ? void 0 : _d.size) === 0 && this._commandIDMapping.delete(commandID), this._emitShortcutChanged();
|
|
2148
2149
|
});
|
|
2149
2150
|
}
|
|
2150
2151
|
getShortcutDisplayOfCommand(id) {
|
|
@@ -2152,8 +2153,8 @@ let ShortcutService = (_a2 = class extends Disposable {
|
|
|
2152
2153
|
return set ? this.getShortcutDisplay(set.values().next().value) : null;
|
|
2153
2154
|
}
|
|
2154
2155
|
getShortcutDisplay(shortcut) {
|
|
2155
|
-
var
|
|
2156
|
-
const binding = this._getBindingFromItem(shortcut), ctrlKey = binding & MetaKeys.CTRL_COMMAND, shiftKey = binding & MetaKeys.SHIFT, altKey = binding & MetaKeys.ALT, macCtrl = binding & MetaKeys.MAC_CTRL, body = (
|
|
2156
|
+
var _a19;
|
|
2157
|
+
const binding = this._getBindingFromItem(shortcut), ctrlKey = binding & MetaKeys.CTRL_COMMAND, shiftKey = binding & MetaKeys.SHIFT, altKey = binding & MetaKeys.ALT, macCtrl = binding & MetaKeys.MAC_CTRL, body = (_a19 = KeyCodeToChar[binding & 255]) != null ? _a19 : "<->";
|
|
2157
2158
|
return this._platformService.isMac ? `${ctrlKey ? "⌘" : ""}${shiftKey ? "⇧" : ""}${altKey ? "⌥" : ""}${macCtrl ? "⌃" : ""}${body}` : `${ctrlKey ? "Ctrl+" : ""}${shiftKey ? "Shift+" : ""}${altKey ? "Alt+" : ""}${body}`;
|
|
2158
2159
|
}
|
|
2159
2160
|
_emitShortcutChanged() {
|
|
@@ -2175,11 +2176,11 @@ let ShortcutService = (_a2 = class extends Disposable {
|
|
|
2175
2176
|
if (shortcuts === void 0)
|
|
2176
2177
|
return !1;
|
|
2177
2178
|
const shouldTrigger = Array.from(shortcuts).sort((s1, s2) => {
|
|
2178
|
-
var
|
|
2179
|
-
return ((
|
|
2179
|
+
var _a19, _b2;
|
|
2180
|
+
return ((_a19 = s2.priority) != null ? _a19 : 0) - ((_b2 = s1.priority) != null ? _b2 : 0);
|
|
2180
2181
|
}).find((s) => {
|
|
2181
|
-
var
|
|
2182
|
-
return (_b2 = (
|
|
2182
|
+
var _a19, _b2;
|
|
2183
|
+
return (_b2 = (_a19 = s.preconditions) == null ? void 0 : _a19.call(s, this._contextService)) != null ? _b2 : !0;
|
|
2183
2184
|
});
|
|
2184
2185
|
return shouldTrigger ? (this._commandService.executeCommand(shouldTrigger.id, shouldTrigger.staticParameters), !0) : !1;
|
|
2185
2186
|
}
|
|
@@ -2187,171 +2188,27 @@ let ShortcutService = (_a2 = class extends Disposable {
|
|
|
2187
2188
|
return this._platformService.isMac && item.mac ? item.mac : this._platformService.isWindows && item.win ? item.win : this._platformService.isLinux && item.linux ? item.linux : item.binding;
|
|
2188
2189
|
}
|
|
2189
2190
|
_deriveBindingFromEvent(e2) {
|
|
2190
|
-
const { shiftKey, metaKey, altKey, keyCode } = e2;
|
|
2191
|
-
let binding = keyCode;
|
|
2192
|
-
return shiftKey && (binding |= MetaKeys.SHIFT), altKey && (binding |= MetaKeys.ALT), (this._platformService.isMac ? metaKey : e2.ctrlKey) && (binding |= MetaKeys.CTRL_COMMAND), this._platformService.isMac && e2.ctrlKey && (binding |= MetaKeys.MAC_CTRL), binding;
|
|
2193
|
-
}
|
|
2194
|
-
}, __name(_a2, "ShortcutService"), _a2);
|
|
2195
|
-
ShortcutService = __decorateClass$
|
|
2196
|
-
__decorateParam$
|
|
2197
|
-
__decorateParam$
|
|
2198
|
-
__decorateParam$
|
|
2199
|
-
__decorateParam$
|
|
2200
|
-
], ShortcutService);
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
__name(mergeMenuConfigs, "mergeMenuConfigs");
|
|
2209
|
-
function updateReactiveProperty(baseConfig, key, value) {
|
|
2210
|
-
if (value !== void 0 && baseConfig[key]) {
|
|
2211
|
-
const subject$ = baseConfig[key].pipe(
|
|
2212
|
-
switchMap(() => new BehaviorSubject(value))
|
|
2213
|
-
);
|
|
2214
|
-
baseConfig[key] = subject$;
|
|
2215
|
-
}
|
|
2216
|
-
}
|
|
2217
|
-
__name(updateReactiveProperty, "updateReactiveProperty");
|
|
2218
|
-
var __defProp$e = Object.defineProperty, __getOwnPropDesc$e = Object.getOwnPropertyDescriptor, __decorateClass$e = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2219
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2220
|
-
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2221
|
-
return kind && result && __defProp$e(target, key, result), result;
|
|
2222
|
-
}, "__decorateClass$e"), __decorateParam$e = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$e");
|
|
2223
|
-
const IMenuService = createIdentifier("univer.menu-service");
|
|
2224
|
-
var _a3;
|
|
2225
|
-
let MenuService = (_a3 = class extends Disposable {
|
|
2226
|
-
constructor(_shortcutService) {
|
|
2227
|
-
super();
|
|
2228
|
-
/** @deprecated */
|
|
2229
|
-
__publicField(this, "_menuItemMap", /* @__PURE__ */ new Map());
|
|
2230
|
-
/** @deprecated */
|
|
2231
|
-
__publicField(this, "_menuByPositions", /* @__PURE__ */ new Map());
|
|
2232
|
-
/** @deprecated */
|
|
2233
|
-
__publicField(this, "_menuConfigs", /* @__PURE__ */ new Map());
|
|
2234
|
-
__publicField(this, "_menuChanged$", new BehaviorSubject(void 0));
|
|
2235
|
-
__publicField(this, "menuChanged$", this._menuChanged$.asObservable());
|
|
2236
|
-
this._shortcutService = _shortcutService;
|
|
2237
|
-
}
|
|
2238
|
-
dispose() {
|
|
2239
|
-
this._menuItemMap.clear(), this._menuChanged$.complete();
|
|
2240
|
-
}
|
|
2241
|
-
/** @deprecated */
|
|
2242
|
-
addMenuItem(item, config) {
|
|
2243
|
-
if (this._menuItemMap.has(item.id))
|
|
2244
|
-
throw new Error(`Menu item with the same id ${item.id} has already been added!`);
|
|
2245
|
-
const menuItemConfig = config == null ? void 0 : config[item.id];
|
|
2246
|
-
return this._menuItemMap.set(item.id, mergeMenuConfigs(item, menuItemConfig)), Array.isArray(item.positions) ? item.positions.forEach((menu) => this._appendMenuToPosition(item, menu)) : this._appendMenuToPosition(item, item.positions), this._menuChanged$.next(), toDisposable(() => {
|
|
2247
|
-
if (this._menuItemMap.delete(item.id), Array.isArray(item.positions))
|
|
2248
|
-
item.positions.forEach((menu) => {
|
|
2249
|
-
const menus = this._menuByPositions.get(menu);
|
|
2250
|
-
if (!menus)
|
|
2251
|
-
return;
|
|
2252
|
-
const index = menus.findIndex((m2) => m2[0] === item.id);
|
|
2253
|
-
index > -1 && menus.splice(index, 1);
|
|
2254
|
-
});
|
|
2255
|
-
else {
|
|
2256
|
-
const menus = this._menuByPositions.get(item.positions);
|
|
2257
|
-
if (!menus)
|
|
2258
|
-
return;
|
|
2259
|
-
const index = menus.findIndex((m2) => m2[0] === item.id);
|
|
2260
|
-
index > -1 && menus.splice(index, 1);
|
|
2261
|
-
}
|
|
2262
|
-
this._menuChanged$.next();
|
|
2263
|
-
});
|
|
2264
|
-
}
|
|
2265
|
-
/** @deprecated */
|
|
2266
|
-
getMenuItems(positions) {
|
|
2267
|
-
if (this._menuByPositions.has(positions)) {
|
|
2268
|
-
const menuItems = this._menuByPositions.get(positions);
|
|
2269
|
-
if (menuItems)
|
|
2270
|
-
return [...menuItems.values()].map((menu) => this._getDisplayMenuItems(menu[1]));
|
|
2271
|
-
}
|
|
2272
|
-
return [];
|
|
2273
|
-
}
|
|
2274
|
-
/** @deprecated */
|
|
2275
|
-
setMenuItem(item) {
|
|
2276
|
-
this._menuItemMap.set(item.id, item), Array.isArray(item.positions) ? item.positions.forEach((menu) => this._updateMenuItems(item, menu)) : this._updateMenuItems(item, item.positions), this._menuChanged$.next();
|
|
2277
|
-
}
|
|
2278
|
-
/** @deprecated */
|
|
2279
|
-
getMenuItem(id) {
|
|
2280
|
-
return this._menuItemMap.has(id) ? this._menuItemMap.get(id) : null;
|
|
2281
|
-
}
|
|
2282
|
-
/** @deprecated */
|
|
2283
|
-
setMenuConfigs(id, config) {
|
|
2284
|
-
this._menuConfigs.set(id, config);
|
|
2285
|
-
}
|
|
2286
|
-
/** @deprecated */
|
|
2287
|
-
getMenuConfig(id) {
|
|
2288
|
-
return this._menuConfigs.has(id) ? this._menuConfigs.get(id) : null;
|
|
2289
|
-
}
|
|
2290
|
-
/** @deprecated */
|
|
2291
|
-
_getDisplayMenuItems(menuItem) {
|
|
2292
|
-
const shortcut = this._shortcutService.getShortcutDisplayOfCommand(menuItem.id);
|
|
2293
|
-
return shortcut ? {
|
|
2294
|
-
...menuItem,
|
|
2295
|
-
shortcut
|
|
2296
|
-
} : menuItem;
|
|
2297
|
-
}
|
|
2298
|
-
/** @deprecated */
|
|
2299
|
-
_appendMenuToPosition(menu, position) {
|
|
2300
|
-
this._menuByPositions.has(position) || this._menuByPositions.set(position, []);
|
|
2301
|
-
const menuList = this._menuByPositions.get(position);
|
|
2302
|
-
if (menuList.findIndex((m2) => m2[0] === menu.id) > -1)
|
|
2303
|
-
throw new Error(`Menu item with the same id ${menu.id} has already been added!`);
|
|
2304
|
-
menuList.push([menu.id, menu]);
|
|
2305
|
-
}
|
|
2306
|
-
/** @deprecated */
|
|
2307
|
-
_updateMenuItems(menu, position) {
|
|
2308
|
-
this._menuByPositions.has(position) || this._menuByPositions.set(position, []);
|
|
2309
|
-
const menuList = this._menuByPositions.get(position), index = menuList.findIndex((m2) => m2[0] === menu.id);
|
|
2310
|
-
index > -1 ? menuList[index] = [menu.id, menu] : menuList.push([menu.id, menu]);
|
|
2311
|
-
}
|
|
2312
|
-
}, __name(_a3, "MenuService"), _a3);
|
|
2313
|
-
MenuService = __decorateClass$e([
|
|
2314
|
-
__decorateParam$e(0, IShortcutService)
|
|
2315
|
-
], MenuService);
|
|
2316
|
-
const SetEditorResizeOperation = {
|
|
2317
|
-
id: "sheet.operation.set-editor-resize",
|
|
2318
|
-
type: CommandType.OPERATION,
|
|
2319
|
-
handler: /* @__PURE__ */ __name((accessor, params) => !0, "handler")
|
|
2320
|
-
};
|
|
2321
|
-
var MenuPosition = /* @__PURE__ */ ((MenuPosition2) => (MenuPosition2.VOID = "void", MenuPosition2.TOOLBAR_START = "uiToolbar.start", MenuPosition2.TOOLBAR_INSERT = "uiToolbar.insert", MenuPosition2.TOOLBAR_FORMULAS = "uiToolbar.formulas", MenuPosition2.TOOLBAR_DATA = "uiToolbar.data", MenuPosition2.TOOLBAR_VIEW = "uiToolbar.view", MenuPosition2.TOOLBAR_OTHERS = "uiToolbar.others", MenuPosition2.CONTEXT_MENU = "contextMenu", MenuPosition2.FOOTER = "footer", MenuPosition2))(MenuPosition || {}), MenuGroup = /* @__PURE__ */ ((MenuGroup2) => (MenuGroup2[MenuGroup2.TOOLBAR_HISTORY = 0] = "TOOLBAR_HISTORY", MenuGroup2[MenuGroup2.TOOLBAR_FORMAT = 1] = "TOOLBAR_FORMAT", MenuGroup2[MenuGroup2.TOOLBAR_LAYOUT = 2] = "TOOLBAR_LAYOUT", MenuGroup2[MenuGroup2.TOOLBAR_FORMULAS_INSERT = 3] = "TOOLBAR_FORMULAS_INSERT", MenuGroup2[MenuGroup2.TOOLBAR_FORMULAS_VIEW = 4] = "TOOLBAR_FORMULAS_VIEW", MenuGroup2[MenuGroup2.TOOLBAR_FILE = 5] = "TOOLBAR_FILE", MenuGroup2[MenuGroup2.TOOLBAR_OTHERS = 6] = "TOOLBAR_OTHERS", MenuGroup2[MenuGroup2.CONTEXT_MENU_FORMAT = 7] = "CONTEXT_MENU_FORMAT", MenuGroup2[MenuGroup2.CONTEXT_MENU_LAYOUT = 8] = "CONTEXT_MENU_LAYOUT", MenuGroup2[MenuGroup2.CONTEXT_MENU_DATA = 9] = "CONTEXT_MENU_DATA", MenuGroup2[MenuGroup2.CONTEXT_MENU_OTHERS = 10] = "CONTEXT_MENU_OTHERS", MenuGroup2))(MenuGroup || {}), MenuItemType = /* @__PURE__ */ ((MenuItemType2) => (MenuItemType2[MenuItemType2.BUTTON = 0] = "BUTTON", MenuItemType2[MenuItemType2.SELECTOR = 1] = "SELECTOR", MenuItemType2[MenuItemType2.BUTTON_SELECTOR = 2] = "BUTTON_SELECTOR", MenuItemType2[MenuItemType2.SUBITEMS = 3] = "SUBITEMS", MenuItemType2))(MenuItemType || {});
|
|
2322
|
-
function UndoMenuItemFactory(accessor) {
|
|
2323
|
-
const undoRedoService = accessor.get(IUndoRedoService);
|
|
2324
|
-
return {
|
|
2325
|
-
id: UndoCommand.id,
|
|
2326
|
-
group: MenuGroup.TOOLBAR_HISTORY,
|
|
2327
|
-
type: MenuItemType.BUTTON,
|
|
2328
|
-
icon: "UndoSingle",
|
|
2329
|
-
title: "Undo",
|
|
2330
|
-
tooltip: "toolbar.undo",
|
|
2331
|
-
positions: [MenuPosition.TOOLBAR_START],
|
|
2332
|
-
disabled$: undoRedoService.undoRedoStatus$.pipe(map((v2) => v2.undos <= 0))
|
|
2333
|
-
};
|
|
2334
|
-
}
|
|
2335
|
-
__name(UndoMenuItemFactory, "UndoMenuItemFactory");
|
|
2336
|
-
function RedoMenuItemFactory(accessor) {
|
|
2337
|
-
const undoRedoService = accessor.get(IUndoRedoService);
|
|
2338
|
-
return {
|
|
2339
|
-
id: RedoCommand.id,
|
|
2340
|
-
group: MenuGroup.TOOLBAR_HISTORY,
|
|
2341
|
-
type: MenuItemType.BUTTON,
|
|
2342
|
-
icon: "RedoSingle",
|
|
2343
|
-
title: "Redo",
|
|
2344
|
-
tooltip: "toolbar.redo",
|
|
2345
|
-
positions: [MenuPosition.TOOLBAR_START],
|
|
2346
|
-
disabled$: undoRedoService.undoRedoStatus$.pipe(map((v2) => v2.redos <= 0))
|
|
2347
|
-
};
|
|
2348
|
-
}
|
|
2349
|
-
__name(RedoMenuItemFactory, "RedoMenuItemFactory");
|
|
2350
|
-
var __defProp$d = Object.defineProperty, __getOwnPropDesc$d = Object.getOwnPropertyDescriptor, __decorateClass$d = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2351
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2191
|
+
const { shiftKey, metaKey, altKey, keyCode } = e2;
|
|
2192
|
+
let binding = keyCode;
|
|
2193
|
+
return shiftKey && (binding |= MetaKeys.SHIFT), altKey && (binding |= MetaKeys.ALT), (this._platformService.isMac ? metaKey : e2.ctrlKey) && (binding |= MetaKeys.CTRL_COMMAND), this._platformService.isMac && e2.ctrlKey && (binding |= MetaKeys.MAC_CTRL), binding;
|
|
2194
|
+
}
|
|
2195
|
+
}, __name(_a2, "ShortcutService"), _a2);
|
|
2196
|
+
ShortcutService = __decorateClass$g([
|
|
2197
|
+
__decorateParam$g(0, ICommandService),
|
|
2198
|
+
__decorateParam$g(1, IPlatformService),
|
|
2199
|
+
__decorateParam$g(2, IContextService),
|
|
2200
|
+
__decorateParam$g(3, Optional(ILayoutService))
|
|
2201
|
+
], ShortcutService);
|
|
2202
|
+
const SetEditorResizeOperation = {
|
|
2203
|
+
id: "sheet.operation.set-editor-resize",
|
|
2204
|
+
type: CommandType.OPERATION,
|
|
2205
|
+
handler: /* @__PURE__ */ __name((accessor, params) => !0, "handler")
|
|
2206
|
+
};
|
|
2207
|
+
var __defProp$f = Object.defineProperty, __getOwnPropDesc$f = Object.getOwnPropertyDescriptor, __decorateClass$f = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2208
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2352
2209
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2353
|
-
return kind && result && __defProp$
|
|
2354
|
-
}, "__decorateClass$
|
|
2210
|
+
return kind && result && __defProp$f(target, key, result), result;
|
|
2211
|
+
}, "__decorateClass$f"), __decorateParam$f = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$f");
|
|
2355
2212
|
function whenEditorFocused(contextService) {
|
|
2356
2213
|
return contextService.getContextValue(FOCUSING_UNIVER_EDITOR);
|
|
2357
2214
|
}
|
|
@@ -2387,20 +2244,13 @@ const CopyShortcutItem = {
|
|
|
2387
2244
|
binding: KeyCode$1.Y | MetaKeys.CTRL_COMMAND,
|
|
2388
2245
|
preconditions: whenEditorFocused
|
|
2389
2246
|
};
|
|
2390
|
-
var
|
|
2391
|
-
let SharedController = (
|
|
2392
|
-
constructor(
|
|
2393
|
-
super(), this.
|
|
2247
|
+
var _a3;
|
|
2248
|
+
let SharedController = (_a3 = class extends Disposable {
|
|
2249
|
+
constructor(_shortcutService, _commandService) {
|
|
2250
|
+
super(), this._shortcutService = _shortcutService, this._commandService = _commandService, this.initialize();
|
|
2394
2251
|
}
|
|
2395
2252
|
initialize() {
|
|
2396
|
-
this._registerCommands(), this._registerShortcuts()
|
|
2397
|
-
}
|
|
2398
|
-
_registerMenus() {
|
|
2399
|
-
var _a18, _b2;
|
|
2400
|
-
const menu = (_b2 = (_a18 = this._config) == null ? void 0 : _a18.menu) != null ? _b2 : {};
|
|
2401
|
-
[UndoMenuItemFactory, RedoMenuItemFactory].forEach((factory) => {
|
|
2402
|
-
this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(factory), menu));
|
|
2403
|
-
});
|
|
2253
|
+
this._registerCommands(), this._registerShortcuts();
|
|
2404
2254
|
}
|
|
2405
2255
|
_registerCommands() {
|
|
2406
2256
|
[CutCommand, CopyCommand, PasteCommand, SetEditorResizeOperation].forEach(
|
|
@@ -2411,17 +2261,14 @@ let SharedController = (_a4 = class extends Disposable {
|
|
|
2411
2261
|
const shortcutItems = [UndoShortcutItem, RedoShortcutItem];
|
|
2412
2262
|
shortcutItems.push(CutShortcutItem, CopyShortcutItem, OnlyDisplayPasteShortcutItem), shortcutItems.forEach((shortcut) => this.disposeWithMe(this._shortcutService.registerShortcut(shortcut)));
|
|
2413
2263
|
}
|
|
2414
|
-
}, __name(
|
|
2415
|
-
SharedController = __decorateClass$
|
|
2264
|
+
}, __name(_a3, "SharedController"), _a3);
|
|
2265
|
+
SharedController = __decorateClass$f([
|
|
2416
2266
|
OnLifecycle(LifecycleStages.Ready, SharedController),
|
|
2417
|
-
__decorateParam$
|
|
2418
|
-
__decorateParam$
|
|
2419
|
-
__decorateParam$d(3, IShortcutService),
|
|
2420
|
-
__decorateParam$d(4, ICommandService)
|
|
2267
|
+
__decorateParam$f(0, IShortcutService),
|
|
2268
|
+
__decorateParam$f(1, ICommandService)
|
|
2421
2269
|
], SharedController);
|
|
2422
2270
|
const IUIController = createIdentifier("univer.ui.ui-controller");
|
|
2423
2271
|
runOnLifecycle(LifecycleStages.Ready, IUIController);
|
|
2424
|
-
const UI_CONFIG_KEY = "UNIVER_UI_CONFIG_KEY";
|
|
2425
2272
|
var render$1 = {}, interopRequireWildcard = { exports: {} }, _typeof$1 = { exports: {} };
|
|
2426
2273
|
(function(module) {
|
|
2427
2274
|
function _typeof3(o) {
|
|
@@ -3013,8 +2860,8 @@ __name(_CanvasPopupService, "CanvasPopupService");
|
|
|
3013
2860
|
let CanvasPopupService = _CanvasPopupService;
|
|
3014
2861
|
const SingleCanvasPopup = /* @__PURE__ */ __name(({ popup, children }) => {
|
|
3015
2862
|
const [hidden, setHidden] = useState(!1), anchorRect$ = useMemo(() => popup.anchorRect$.pipe(throttleTime(0, animationFrameScheduler)), [popup.anchorRect$]), excludeRects$ = useMemo(() => {
|
|
3016
|
-
var
|
|
3017
|
-
return (
|
|
2863
|
+
var _a19;
|
|
2864
|
+
return (_a19 = popup.excludeRects$) == null ? void 0 : _a19.pipe(throttleTime(0, animationFrameScheduler));
|
|
3018
2865
|
}, [popup.excludeRects$]), anchorRect = useObservable(anchorRect$, popup.anchorRect), excludeRects = useObservable(excludeRects$, popup.excludeRects), { offset, canvasElement, hideOnInvisible = !0 } = popup, rectWithOffset = useMemo(() => {
|
|
3019
2866
|
if (!anchorRect)
|
|
3020
2867
|
return null;
|
|
@@ -3134,8 +2981,8 @@ const floatDomWrapper = "univer-float-dom-wrapper", floatDom = "univer-float-dom
|
|
|
3134
2981
|
}
|
|
3135
2982
|
) : null;
|
|
3136
2983
|
}), FloatDom = /* @__PURE__ */ __name(({ unitId }) => {
|
|
3137
|
-
var
|
|
3138
|
-
const instanceService = useDependency(IUniverInstanceService), domLayerService = useDependency(CanvasFloatDomService), layers = useObservable(domLayerService.domLayers$), currentUnitId = unitId || ((
|
|
2984
|
+
var _a19, _b2;
|
|
2985
|
+
const instanceService = useDependency(IUniverInstanceService), domLayerService = useDependency(CanvasFloatDomService), layers = useObservable(domLayerService.domLayers$), currentUnitId = unitId || ((_a19 = instanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _a19.getUnitId());
|
|
3139
2986
|
return (_b2 = layers == null ? void 0 : layers.filter((layer) => layer[1].unitId === currentUnitId)) == null ? void 0 : _b2.map((layer) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3140
2987
|
FloatDomSingle,
|
|
3141
2988
|
{
|
|
@@ -3148,18 +2995,18 @@ const floatDomWrapper = "univer-float-dom-wrapper", floatDom = "univer-float-dom
|
|
|
3148
2995
|
function ComponentContainer(props) {
|
|
3149
2996
|
const { components, fallback, sharedProps } = props;
|
|
3150
2997
|
return !components || components.size === 0 ? fallback != null ? fallback : null : Array.from(components.values()).map((component, index) => {
|
|
3151
|
-
var
|
|
3152
|
-
return React__default.createElement(component, { key: `${(
|
|
2998
|
+
var _a19;
|
|
2999
|
+
return React__default.createElement(component, { key: `${(_a19 = component.displayName) != null ? _a19 : index}`, ...sharedProps });
|
|
3153
3000
|
});
|
|
3154
3001
|
}
|
|
3155
3002
|
__name(ComponentContainer, "ComponentContainer");
|
|
3156
3003
|
function useComponentsOfPart(part, injector) {
|
|
3157
|
-
var
|
|
3158
|
-
const uiPartsService = (
|
|
3004
|
+
var _a19;
|
|
3005
|
+
const uiPartsService = (_a19 = injector == null ? void 0 : injector.get(IUIPartsService)) != null ? _a19 : useDependency(IUIPartsService), updateCounterRef = useRef(0), componentPartUpdateCount = useObservable(
|
|
3159
3006
|
() => uiPartsService.componentRegistered$.pipe(
|
|
3160
3007
|
filter((key) => key === part),
|
|
3161
3008
|
debounceTime(200),
|
|
3162
|
-
map
|
|
3009
|
+
map(() => updateCounterRef.current += 1),
|
|
3163
3010
|
startWith(updateCounterRef.current += 1)
|
|
3164
3011
|
// trigger update when subscribe
|
|
3165
3012
|
),
|
|
@@ -3170,6 +3017,236 @@ function useComponentsOfPart(part, injector) {
|
|
|
3170
3017
|
return useMemo(() => uiPartsService.getComponents(part), [componentPartUpdateCount]);
|
|
3171
3018
|
}
|
|
3172
3019
|
__name(useComponentsOfPart, "useComponentsOfPart");
|
|
3020
|
+
var MenuManagerPosition = /* @__PURE__ */ ((MenuManagerPosition2) => (MenuManagerPosition2.RIBBON = "ribbon", MenuManagerPosition2.CONTEXT_MENU = "contextMenu", MenuManagerPosition2))(MenuManagerPosition || {}), RibbonPosition = /* @__PURE__ */ ((RibbonPosition2) => (RibbonPosition2.START = "ribbon.start", RibbonPosition2.INSERT = "ribbon.insert", RibbonPosition2.FORMULAS = "ribbon.formulas", RibbonPosition2.DATA = "ribbon.data", RibbonPosition2.VIEW = "ribbon.view", RibbonPosition2.OTHERS = "ribbon.others", RibbonPosition2))(RibbonPosition || {}), RibbonStartGroup = /* @__PURE__ */ ((RibbonStartGroup2) => (RibbonStartGroup2.HISTORY = "ribbon.start.history", RibbonStartGroup2.FORMAT = "ribbon.start.format", RibbonStartGroup2.LAYOUT = "ribbon.start.layout", RibbonStartGroup2.FORMULAS_INSERT = "ribbon.start.insert", RibbonStartGroup2.FORMULAS_VIEW = "ribbon.start.view", RibbonStartGroup2.FILE = "ribbon.start.file", RibbonStartGroup2.OTHERS = "ribbon.start.others", RibbonStartGroup2))(RibbonStartGroup || {}), RibbonInsertGroup = /* @__PURE__ */ ((RibbonInsertGroup2) => (RibbonInsertGroup2.OTHERS = "ribbon.insert.others", RibbonInsertGroup2))(RibbonInsertGroup || {}), RibbonFormulasGroup = /* @__PURE__ */ ((RibbonFormulasGroup2) => (RibbonFormulasGroup2.OTHERS = "ribbon.formulas.others", RibbonFormulasGroup2))(RibbonFormulasGroup || {}), RibbonDataGroup = /* @__PURE__ */ ((RibbonDataGroup2) => (RibbonDataGroup2.OTHERS = "ribbon.data.others", RibbonDataGroup2))(RibbonDataGroup || {}), RibbonViewGroup = /* @__PURE__ */ ((RibbonViewGroup2) => (RibbonViewGroup2.OTHERS = "ribbon.view.others", RibbonViewGroup2))(RibbonViewGroup || {}), RibbonOthersGroup = /* @__PURE__ */ ((RibbonOthersGroup2) => (RibbonOthersGroup2.OTHERS = "ribbon.others.others", RibbonOthersGroup2))(RibbonOthersGroup || {}), ContextMenuPosition = /* @__PURE__ */ ((ContextMenuPosition2) => (ContextMenuPosition2.MAIN_AREA = "contextMenu.mainArea", ContextMenuPosition2.COL_HEADER = "contextMenu.colHeader", ContextMenuPosition2.ROW_HEADER = "contextMenu.rowHeader", ContextMenuPosition2.FOOTER_TABS = "contextMenu.footerTabs", ContextMenuPosition2.FOOTER_MENU = "contextMenu.footerMenu", ContextMenuPosition2))(ContextMenuPosition || {}), ContextMenuGroup = /* @__PURE__ */ ((ContextMenuGroup2) => (ContextMenuGroup2.FORMAT = "contextMenu.format", ContextMenuGroup2.LAYOUT = "contextMenu.layout", ContextMenuGroup2.DATA = "contextMenu.data", ContextMenuGroup2.OTHERS = "contextMenu.others", ContextMenuGroup2))(ContextMenuGroup || {}), MenuPosition = ((MenuPosition2) => (MenuPosition2.VOID = "void", MenuPosition2[MenuPosition2.TOOLBAR_START = RibbonPosition.START] = "TOOLBAR_START", MenuPosition2[MenuPosition2.TOOLBAR_INSERT = RibbonPosition.INSERT] = "TOOLBAR_INSERT", MenuPosition2[MenuPosition2.TOOLBAR_FORMULAS = RibbonPosition.FORMULAS] = "TOOLBAR_FORMULAS", MenuPosition2[MenuPosition2.TOOLBAR_DATA = RibbonPosition.DATA] = "TOOLBAR_DATA", MenuPosition2[MenuPosition2.TOOLBAR_VIEW = RibbonPosition.VIEW] = "TOOLBAR_VIEW", MenuPosition2[MenuPosition2.TOOLBAR_OTHERS = RibbonPosition.OTHERS] = "TOOLBAR_OTHERS", MenuPosition2[MenuPosition2.CONTEXT_MENU = ContextMenuPosition.MAIN_AREA] = "CONTEXT_MENU", MenuPosition2.FOOTER = "footer", MenuPosition2))(MenuPosition || {}), MenuGroup = /* @__PURE__ */ ((MenuGroup2) => (MenuGroup2[MenuGroup2.TOOLBAR_HISTORY = 0] = "TOOLBAR_HISTORY", MenuGroup2[MenuGroup2.TOOLBAR_FORMAT = 1] = "TOOLBAR_FORMAT", MenuGroup2[MenuGroup2.TOOLBAR_LAYOUT = 2] = "TOOLBAR_LAYOUT", MenuGroup2[MenuGroup2.TOOLBAR_FORMULAS_INSERT = 3] = "TOOLBAR_FORMULAS_INSERT", MenuGroup2[MenuGroup2.TOOLBAR_FORMULAS_VIEW = 4] = "TOOLBAR_FORMULAS_VIEW", MenuGroup2[MenuGroup2.TOOLBAR_FILE = 5] = "TOOLBAR_FILE", MenuGroup2[MenuGroup2.TOOLBAR_OTHERS = 6] = "TOOLBAR_OTHERS", MenuGroup2[MenuGroup2.CONTEXT_MENU_FORMAT = 7] = "CONTEXT_MENU_FORMAT", MenuGroup2[MenuGroup2.CONTEXT_MENU_LAYOUT = 8] = "CONTEXT_MENU_LAYOUT", MenuGroup2[MenuGroup2.CONTEXT_MENU_DATA = 9] = "CONTEXT_MENU_DATA", MenuGroup2[MenuGroup2.CONTEXT_MENU_OTHERS = 10] = "CONTEXT_MENU_OTHERS", MenuGroup2))(MenuGroup || {}), MenuItemType = /* @__PURE__ */ ((MenuItemType2) => (MenuItemType2[MenuItemType2.BUTTON = 0] = "BUTTON", MenuItemType2[MenuItemType2.SELECTOR = 1] = "SELECTOR", MenuItemType2[MenuItemType2.BUTTON_SELECTOR = 2] = "BUTTON_SELECTOR", MenuItemType2[MenuItemType2.SUBITEMS = 3] = "SUBITEMS", MenuItemType2))(MenuItemType || {});
|
|
3021
|
+
function mergeMenuConfigs(baseConfig, additionalConfig) {
|
|
3022
|
+
return !additionalConfig || !baseConfig || (["group", "type", "icon", "title", "tooltip", "positions"].forEach((prop) => {
|
|
3023
|
+
additionalConfig[prop] !== void 0 && (baseConfig[prop] = additionalConfig[prop]);
|
|
3024
|
+
}), ["hidden", "disabled", "activated"].forEach((prop) => {
|
|
3025
|
+
updateReactiveProperty(baseConfig, `${prop}$`, additionalConfig[prop]);
|
|
3026
|
+
})), baseConfig;
|
|
3027
|
+
}
|
|
3028
|
+
__name(mergeMenuConfigs, "mergeMenuConfigs");
|
|
3029
|
+
function updateReactiveProperty(baseConfig, key, value) {
|
|
3030
|
+
if (value !== void 0)
|
|
3031
|
+
if (baseConfig[key]) {
|
|
3032
|
+
const subject$ = baseConfig[key].pipe(
|
|
3033
|
+
switchMap(() => new BehaviorSubject(value))
|
|
3034
|
+
);
|
|
3035
|
+
baseConfig[key] = subject$;
|
|
3036
|
+
} else
|
|
3037
|
+
baseConfig[key] = new Observable((subscriber) => {
|
|
3038
|
+
subscriber.next(value);
|
|
3039
|
+
});
|
|
3040
|
+
}
|
|
3041
|
+
__name(updateReactiveProperty, "updateReactiveProperty");
|
|
3042
|
+
var __defProp$e = Object.defineProperty, __getOwnPropDesc$e = Object.getOwnPropertyDescriptor, __decorateClass$e = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
3043
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
3044
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
3045
|
+
return kind && result && __defProp$e(target, key, result), result;
|
|
3046
|
+
}, "__decorateClass$e"), __decorateParam$e = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$e");
|
|
3047
|
+
const IMenuManagerService = createIdentifier("univer.menu-manager-service");
|
|
3048
|
+
var _a4;
|
|
3049
|
+
let MenuManagerService = (_a4 = class extends Disposable {
|
|
3050
|
+
constructor(_injector, _configService) {
|
|
3051
|
+
super();
|
|
3052
|
+
__publicField(this, "menuChanged$", new Subject());
|
|
3053
|
+
__publicField(this, "_menu", {
|
|
3054
|
+
[MenuManagerPosition.RIBBON]: {
|
|
3055
|
+
[RibbonPosition.START]: {
|
|
3056
|
+
order: 0,
|
|
3057
|
+
[RibbonStartGroup.HISTORY]: {
|
|
3058
|
+
order: 0
|
|
3059
|
+
},
|
|
3060
|
+
[RibbonStartGroup.FORMAT]: {
|
|
3061
|
+
order: 1
|
|
3062
|
+
},
|
|
3063
|
+
[RibbonStartGroup.LAYOUT]: {
|
|
3064
|
+
order: 2
|
|
3065
|
+
},
|
|
3066
|
+
[RibbonStartGroup.FORMULAS_INSERT]: {
|
|
3067
|
+
order: 3
|
|
3068
|
+
},
|
|
3069
|
+
[RibbonStartGroup.FORMULAS_VIEW]: {
|
|
3070
|
+
order: 4
|
|
3071
|
+
},
|
|
3072
|
+
[RibbonStartGroup.FILE]: {
|
|
3073
|
+
order: 5
|
|
3074
|
+
},
|
|
3075
|
+
[RibbonStartGroup.OTHERS]: {
|
|
3076
|
+
order: 6
|
|
3077
|
+
}
|
|
3078
|
+
},
|
|
3079
|
+
[RibbonPosition.INSERT]: {
|
|
3080
|
+
order: 1,
|
|
3081
|
+
[RibbonInsertGroup.OTHERS]: {
|
|
3082
|
+
order: 0
|
|
3083
|
+
}
|
|
3084
|
+
},
|
|
3085
|
+
[RibbonPosition.FORMULAS]: {
|
|
3086
|
+
order: 2,
|
|
3087
|
+
[RibbonFormulasGroup.OTHERS]: {
|
|
3088
|
+
order: 0
|
|
3089
|
+
}
|
|
3090
|
+
},
|
|
3091
|
+
[RibbonPosition.DATA]: {
|
|
3092
|
+
order: 3,
|
|
3093
|
+
[RibbonDataGroup.OTHERS]: {
|
|
3094
|
+
order: 0
|
|
3095
|
+
}
|
|
3096
|
+
},
|
|
3097
|
+
[RibbonPosition.VIEW]: {
|
|
3098
|
+
order: 4,
|
|
3099
|
+
[RibbonViewGroup.OTHERS]: {
|
|
3100
|
+
order: 0
|
|
3101
|
+
}
|
|
3102
|
+
},
|
|
3103
|
+
[RibbonPosition.OTHERS]: {
|
|
3104
|
+
order: 5,
|
|
3105
|
+
[RibbonOthersGroup.OTHERS]: {
|
|
3106
|
+
order: 0
|
|
3107
|
+
}
|
|
3108
|
+
}
|
|
3109
|
+
},
|
|
3110
|
+
[MenuManagerPosition.CONTEXT_MENU]: {
|
|
3111
|
+
[ContextMenuPosition.MAIN_AREA]: {
|
|
3112
|
+
order: 0,
|
|
3113
|
+
[ContextMenuGroup.FORMAT]: {
|
|
3114
|
+
order: 0
|
|
3115
|
+
},
|
|
3116
|
+
[ContextMenuGroup.LAYOUT]: {
|
|
3117
|
+
order: 1
|
|
3118
|
+
},
|
|
3119
|
+
[ContextMenuGroup.DATA]: {
|
|
3120
|
+
order: 2
|
|
3121
|
+
},
|
|
3122
|
+
[ContextMenuGroup.OTHERS]: {
|
|
3123
|
+
order: 3
|
|
3124
|
+
}
|
|
3125
|
+
},
|
|
3126
|
+
[ContextMenuPosition.COL_HEADER]: {
|
|
3127
|
+
order: 1,
|
|
3128
|
+
[ContextMenuGroup.FORMAT]: {
|
|
3129
|
+
order: 0
|
|
3130
|
+
},
|
|
3131
|
+
[ContextMenuGroup.LAYOUT]: {
|
|
3132
|
+
order: 1
|
|
3133
|
+
},
|
|
3134
|
+
[ContextMenuGroup.DATA]: {
|
|
3135
|
+
order: 2
|
|
3136
|
+
},
|
|
3137
|
+
[ContextMenuGroup.OTHERS]: {
|
|
3138
|
+
order: 3
|
|
3139
|
+
}
|
|
3140
|
+
},
|
|
3141
|
+
[ContextMenuPosition.ROW_HEADER]: {
|
|
3142
|
+
order: 2,
|
|
3143
|
+
[ContextMenuGroup.FORMAT]: {
|
|
3144
|
+
order: 0
|
|
3145
|
+
},
|
|
3146
|
+
[ContextMenuGroup.LAYOUT]: {
|
|
3147
|
+
order: 1
|
|
3148
|
+
},
|
|
3149
|
+
[ContextMenuGroup.DATA]: {
|
|
3150
|
+
order: 2
|
|
3151
|
+
},
|
|
3152
|
+
[ContextMenuGroup.OTHERS]: {
|
|
3153
|
+
order: 3
|
|
3154
|
+
}
|
|
3155
|
+
},
|
|
3156
|
+
[ContextMenuPosition.FOOTER_TABS]: {
|
|
3157
|
+
order: 3,
|
|
3158
|
+
[ContextMenuGroup.FORMAT]: {
|
|
3159
|
+
order: 0
|
|
3160
|
+
},
|
|
3161
|
+
[ContextMenuGroup.LAYOUT]: {
|
|
3162
|
+
order: 1
|
|
3163
|
+
},
|
|
3164
|
+
[ContextMenuGroup.DATA]: {
|
|
3165
|
+
order: 2
|
|
3166
|
+
},
|
|
3167
|
+
[ContextMenuGroup.OTHERS]: {
|
|
3168
|
+
order: 3
|
|
3169
|
+
}
|
|
3170
|
+
},
|
|
3171
|
+
[ContextMenuPosition.FOOTER_MENU]: {
|
|
3172
|
+
order: 4,
|
|
3173
|
+
[ContextMenuGroup.OTHERS]: {
|
|
3174
|
+
order: 3
|
|
3175
|
+
}
|
|
3176
|
+
}
|
|
3177
|
+
}
|
|
3178
|
+
});
|
|
3179
|
+
this._injector = _injector, this._configService = _configService;
|
|
3180
|
+
}
|
|
3181
|
+
dispose() {
|
|
3182
|
+
this.menuChanged$.complete();
|
|
3183
|
+
}
|
|
3184
|
+
/**
|
|
3185
|
+
* Merge source menu to target menu recursively
|
|
3186
|
+
* @param source
|
|
3187
|
+
* @param target default is root menu
|
|
3188
|
+
*/
|
|
3189
|
+
mergeMenu(source, target) {
|
|
3190
|
+
const _target = target != null ? target : this._menu;
|
|
3191
|
+
for (const [key, value] of Object.entries(_target))
|
|
3192
|
+
if (key in source) {
|
|
3193
|
+
const _key = key;
|
|
3194
|
+
Tools.deepMerge(_target[_key], source[_key]), this.menuChanged$.next();
|
|
3195
|
+
} else
|
|
3196
|
+
this.mergeMenu(source, value);
|
|
3197
|
+
}
|
|
3198
|
+
appendRootMenu(source) {
|
|
3199
|
+
Tools.deepMerge(this._menu, source), this.menuChanged$.next();
|
|
3200
|
+
}
|
|
3201
|
+
_buildMenuSchema(data) {
|
|
3202
|
+
const result = [];
|
|
3203
|
+
for (const [key, value] of Object.entries(data)) {
|
|
3204
|
+
const menuItem = {
|
|
3205
|
+
key,
|
|
3206
|
+
order: value.order
|
|
3207
|
+
};
|
|
3208
|
+
if (value.menuItemFactory) {
|
|
3209
|
+
const item = this._injector.invoke(value.menuItemFactory);
|
|
3210
|
+
if (item) {
|
|
3211
|
+
const menuItemConfig = this._configService.getConfig("menu");
|
|
3212
|
+
if (menuItemConfig && item.id in menuItemConfig) {
|
|
3213
|
+
const _key = item.id;
|
|
3214
|
+
menuItem.item = mergeMenuConfigs(item, menuItemConfig[_key]);
|
|
3215
|
+
} else
|
|
3216
|
+
menuItem.item = item;
|
|
3217
|
+
}
|
|
3218
|
+
}
|
|
3219
|
+
const children = this._buildMenuSchema(value);
|
|
3220
|
+
children.length > 0 && (menuItem.children = children.sort((a, b2) => a.order - b2.order)), (menuItem.item || menuItem.children) && result.push(menuItem);
|
|
3221
|
+
}
|
|
3222
|
+
return result;
|
|
3223
|
+
}
|
|
3224
|
+
/**
|
|
3225
|
+
* Get menu schema by position key
|
|
3226
|
+
* @param key
|
|
3227
|
+
* @returns Menu schema array or empty array if not found
|
|
3228
|
+
*/
|
|
3229
|
+
getMenuByPositionKey(key) {
|
|
3230
|
+
const findKey = /* @__PURE__ */ __name((obj) => {
|
|
3231
|
+
if (key in obj)
|
|
3232
|
+
return this._buildMenuSchema(obj[key]);
|
|
3233
|
+
for (const k2 in obj) {
|
|
3234
|
+
if (k2 === key)
|
|
3235
|
+
return this._buildMenuSchema(obj[k2]);
|
|
3236
|
+
if (typeof obj[k2] == "object") {
|
|
3237
|
+
const result = findKey(obj[k2]);
|
|
3238
|
+
if (result)
|
|
3239
|
+
return result;
|
|
3240
|
+
}
|
|
3241
|
+
}
|
|
3242
|
+
}, "findKey");
|
|
3243
|
+
return findKey(this._menu);
|
|
3244
|
+
}
|
|
3245
|
+
}, __name(_a4, "MenuManagerService"), _a4);
|
|
3246
|
+
MenuManagerService = __decorateClass$e([
|
|
3247
|
+
__decorateParam$e(0, Inject(Injector)),
|
|
3248
|
+
__decorateParam$e(1, IConfigService)
|
|
3249
|
+
], MenuManagerService);
|
|
3173
3250
|
const menuItemNoHover = "univer-menu-item-no-hover", menuItemActive = "univer-menu-item-active", menuItemActivated = "univer-menu-item-activated", menuItemContent = "univer-menu-item-content", menuItemSelectable = "univer-menu-item-selectable", menuItemSelectableIcon = "univer-menu-item-selectable-icon", menuItemMoreIcon = "univer-menu-item-more-icon", styles$d = {
|
|
3174
3251
|
menuItemNoHover,
|
|
3175
3252
|
menuItemActive,
|
|
@@ -3180,66 +3257,40 @@ const menuItemNoHover = "univer-menu-item-no-hover", menuItemActive = "univer-me
|
|
|
3180
3257
|
menuItemMoreIcon
|
|
3181
3258
|
};
|
|
3182
3259
|
function MenuWrapper(props) {
|
|
3183
|
-
const { menuType, onOptionSelect } = props,
|
|
3260
|
+
const { menuType, onOptionSelect } = props, menuManagerService = useDependency(IMenuManagerService);
|
|
3184
3261
|
if (!menuType)
|
|
3185
3262
|
return null;
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
});
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
{}
|
|
3210
|
-
)
|
|
3211
|
-
), filteredGroup = useMemo(() => filterData(group), [group]);
|
|
3212
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: filteredGroup.map(
|
|
3213
|
-
(groupItem) => Object.keys(groupItem).map((groupKey) => /* @__PURE__ */ jsxRuntimeExports.jsx(MenuItemGroup, { eventKey: groupKey, children: groupItem[groupKey].map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3214
|
-
MenuItem,
|
|
3215
|
-
{
|
|
3216
|
-
menuItem: item,
|
|
3217
|
-
onClick: /* @__PURE__ */ __name((object) => {
|
|
3218
|
-
onOptionSelect == null || onOptionSelect({ value: "", label: item.id, ...object });
|
|
3219
|
-
}, "onClick")
|
|
3220
|
-
},
|
|
3221
|
-
item.id
|
|
3222
|
-
)) }, groupKey))
|
|
3223
|
-
) });
|
|
3224
|
-
}
|
|
3225
|
-
return menuService.getMenuItems(menuType).map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3226
|
-
MenuItem,
|
|
3227
|
-
{
|
|
3228
|
-
menuItem: item,
|
|
3229
|
-
onClick: /* @__PURE__ */ __name((object) => {
|
|
3230
|
-
onOptionSelect == null || onOptionSelect({ value: "", label: item.id, ...object });
|
|
3231
|
-
}, "onClick")
|
|
3232
|
-
},
|
|
3233
|
-
item.id
|
|
3234
|
-
));
|
|
3263
|
+
const menuItems = menuManagerService.getMenuByPositionKey(menuType);
|
|
3264
|
+
return menuItems && menuItems.map((item) => {
|
|
3265
|
+
var _a19;
|
|
3266
|
+
return item.item ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3267
|
+
MenuItem,
|
|
3268
|
+
{
|
|
3269
|
+
menuItem: item.item,
|
|
3270
|
+
onClick: /* @__PURE__ */ __name((object) => {
|
|
3271
|
+
onOptionSelect == null || onOptionSelect({ value: "", label: item.key, ...object });
|
|
3272
|
+
}, "onClick")
|
|
3273
|
+
},
|
|
3274
|
+
item.key
|
|
3275
|
+
) : (_a19 = item.children) != null && _a19.length ? /* @__PURE__ */ jsxRuntimeExports.jsx(MenuItemGroup, { eventKey: item.key, children: item.children.map((child) => child.item && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3276
|
+
MenuItem,
|
|
3277
|
+
{
|
|
3278
|
+
menuItem: child.item,
|
|
3279
|
+
onClick: /* @__PURE__ */ __name((object) => {
|
|
3280
|
+
onOptionSelect == null || onOptionSelect({ value: "", label: child.key, ...object });
|
|
3281
|
+
}, "onClick")
|
|
3282
|
+
},
|
|
3283
|
+
child.key
|
|
3284
|
+
)) }, item.key) : null;
|
|
3285
|
+
});
|
|
3235
3286
|
}
|
|
3236
3287
|
__name(MenuWrapper, "MenuWrapper");
|
|
3237
3288
|
function MenuOptionsWrapper(props) {
|
|
3238
|
-
var
|
|
3289
|
+
var _a19;
|
|
3239
3290
|
const { options, value, onOptionSelect, parentKey } = props;
|
|
3240
|
-
return (
|
|
3241
|
-
var
|
|
3242
|
-
const key = `${parentKey}-${(
|
|
3291
|
+
return (_a19 = options == null ? void 0 : options.map((option, index) => {
|
|
3292
|
+
var _a20, _b2, _c;
|
|
3293
|
+
const key = `${parentKey}-${(_a20 = option.label) != null ? _a20 : option.id}-${index}`, onChange = /* @__PURE__ */ __name((v2) => {
|
|
3243
3294
|
onOptionSelect == null || onOptionSelect({ value: v2, label: option == null ? void 0 : option.label, commandId: option == null ? void 0 : option.commandId });
|
|
3244
3295
|
}, "onChange"), handleClick = /* @__PURE__ */ __name(() => {
|
|
3245
3296
|
typeof option.value > "u" || onOptionSelect == null || onOptionSelect({
|
|
@@ -3269,7 +3320,7 @@ function MenuOptionsWrapper(props) {
|
|
|
3269
3320
|
]
|
|
3270
3321
|
}
|
|
3271
3322
|
) }, key);
|
|
3272
|
-
})) != null ?
|
|
3323
|
+
})) != null ? _a19 : null;
|
|
3273
3324
|
}
|
|
3274
3325
|
__name(MenuOptionsWrapper, "MenuOptionsWrapper");
|
|
3275
3326
|
const Menu = /* @__PURE__ */ __name((props) => {
|
|
@@ -3287,7 +3338,7 @@ const Menu = /* @__PURE__ */ __name((props) => {
|
|
|
3287
3338
|
);
|
|
3288
3339
|
}, "Menu");
|
|
3289
3340
|
function MenuItem({ menuItem, onClick }) {
|
|
3290
|
-
const
|
|
3341
|
+
const menuManagerService = useDependency(IMenuManagerService), disabled = useObservable(menuItem.disabled$, !1), activated = useObservable(menuItem.activated$, !1), hidden = useObservable(menuItem.hidden$, !1), value = useObservable(menuItem.value$), item = menuItem, selectionsFromObservable = useObservable(isObservable(item.selections) ? item.selections : void 0), [inputValue, setInputValue] = useState(value);
|
|
3291
3342
|
if (hidden)
|
|
3292
3343
|
return null;
|
|
3293
3344
|
const onChange = /* @__PURE__ */ __name((v2) => {
|
|
@@ -3311,8 +3362,8 @@ function MenuItem({ menuItem, onClick }) {
|
|
|
3311
3362
|
item2.id
|
|
3312
3363
|
);
|
|
3313
3364
|
}, "renderButtonType"), renderSelectorType = /* @__PURE__ */ __name(() => {
|
|
3314
|
-
var
|
|
3315
|
-
const selections = (
|
|
3365
|
+
var _a19;
|
|
3366
|
+
const selections = (_a19 = selectionsFromObservable != null ? selectionsFromObservable : item.selections) != null ? _a19 : [];
|
|
3316
3367
|
return selections.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3317
3368
|
SubMenu,
|
|
3318
3369
|
{
|
|
@@ -3358,7 +3409,7 @@ function MenuItem({ menuItem, onClick }) {
|
|
|
3358
3409
|
),
|
|
3359
3410
|
item.shortcut && ` (${item.shortcut})`
|
|
3360
3411
|
] }) }, item.id);
|
|
3361
|
-
}, "renderSelectorType"), subMenuItems = menuItem.id ?
|
|
3412
|
+
}, "renderSelectorType"), subMenuItems = menuItem.id ? menuManagerService.getMenuByPositionKey(menuItem.id) : [], renderSubItemsType = /* @__PURE__ */ __name(() => {
|
|
3362
3413
|
const item2 = menuItem;
|
|
3363
3414
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3364
3415
|
SubMenu,
|
|
@@ -3386,8 +3437,8 @@ const IContextMenuService = createIdentifier("ui.contextmenu.service"), _Context
|
|
|
3386
3437
|
__publicField(this, "disabled", !1);
|
|
3387
3438
|
}
|
|
3388
3439
|
get visible() {
|
|
3389
|
-
var
|
|
3390
|
-
return (_b2 = (
|
|
3440
|
+
var _a19, _b2;
|
|
3441
|
+
return (_b2 = (_a19 = this._currentHandler) == null ? void 0 : _a19.visible) != null ? _b2 : !1;
|
|
3391
3442
|
}
|
|
3392
3443
|
disable() {
|
|
3393
3444
|
this.disabled = !0;
|
|
@@ -3396,12 +3447,12 @@ const IContextMenuService = createIdentifier("ui.contextmenu.service"), _Context
|
|
|
3396
3447
|
this.disabled = !1;
|
|
3397
3448
|
}
|
|
3398
3449
|
triggerContextMenu(event, menuType) {
|
|
3399
|
-
var
|
|
3400
|
-
event.stopPropagation(), !this.disabled && ((
|
|
3450
|
+
var _a19;
|
|
3451
|
+
event.stopPropagation(), !this.disabled && ((_a19 = this._currentHandler) == null || _a19.handleContextMenu(event, menuType));
|
|
3401
3452
|
}
|
|
3402
3453
|
hideContextMenu() {
|
|
3403
|
-
var
|
|
3404
|
-
(
|
|
3454
|
+
var _a19;
|
|
3455
|
+
(_a19 = this._currentHandler) == null || _a19.hideContextMenu();
|
|
3405
3456
|
}
|
|
3406
3457
|
registerContextMenuHandler(handler) {
|
|
3407
3458
|
if (this._currentHandler)
|
|
@@ -3440,7 +3491,7 @@ function DesktopContextMenu() {
|
|
|
3440
3491
|
return __name(handleClose, "handleClose"), /* @__PURE__ */ jsxRuntimeExports.jsx(Popup, { visible, offset, children: /* @__PURE__ */ jsxRuntimeExports.jsx("section", { ref: contentRef, children: menuType && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3441
3492
|
Menu,
|
|
3442
3493
|
{
|
|
3443
|
-
menuType
|
|
3494
|
+
menuType,
|
|
3444
3495
|
onOptionSelect: /* @__PURE__ */ __name((params) => {
|
|
3445
3496
|
const { label: id, commandId, value } = params;
|
|
3446
3497
|
commandService && commandService.executeCommand(commandId != null ? commandId : id, { value }), injector.get(ITextSelectionRenderManager).focus(), setVisible(!1);
|
|
@@ -3496,29 +3547,139 @@ function ToolbarButton(props) {
|
|
|
3496
3547
|
);
|
|
3497
3548
|
}
|
|
3498
3549
|
__name(ToolbarButton, "ToolbarButton");
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
}
|
|
3550
|
+
var __defProp$d = Object.defineProperty, __getOwnPropDesc$d = Object.getOwnPropertyDescriptor, __decorateClass$d = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
3551
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
3552
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
3553
|
+
return kind && result && __defProp$d(target, key, result), result;
|
|
3554
|
+
}, "__decorateClass$d"), __decorateParam$d = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$d");
|
|
3555
|
+
const IMenuService = createIdentifier("univer.menu-service");
|
|
3556
|
+
var _a5;
|
|
3557
|
+
let MenuService = (_a5 = class extends Disposable {
|
|
3558
|
+
constructor(_shortcutService, _menuManagerService, _logService) {
|
|
3559
|
+
super();
|
|
3560
|
+
/** @deprecated */
|
|
3561
|
+
__publicField(this, "_menuItemMap", /* @__PURE__ */ new Map());
|
|
3562
|
+
/** @deprecated */
|
|
3563
|
+
__publicField(this, "_menuByPositions", /* @__PURE__ */ new Map());
|
|
3564
|
+
/** @deprecated */
|
|
3565
|
+
__publicField(this, "_menuConfigs", /* @__PURE__ */ new Map());
|
|
3566
|
+
__publicField(this, "_menuChanged$", new BehaviorSubject(void 0));
|
|
3567
|
+
__publicField(this, "menuChanged$", this._menuChanged$.asObservable());
|
|
3568
|
+
this._shortcutService = _shortcutService, this._menuManagerService = _menuManagerService, this._logService = _logService;
|
|
3569
|
+
}
|
|
3570
|
+
dispose() {
|
|
3571
|
+
this._menuItemMap.clear(), this._menuChanged$.complete();
|
|
3572
|
+
}
|
|
3573
|
+
/** @deprecated */
|
|
3574
|
+
addMenuItem(item, config) {
|
|
3575
|
+
if (this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."), this._menuItemMap.has(item.id))
|
|
3576
|
+
throw new Error(`Menu item with the same id ${item.id} has already been added!`);
|
|
3577
|
+
const menuItemConfig = config == null ? void 0 : config[item.id];
|
|
3578
|
+
return this._menuItemMap.set(item.id, mergeMenuConfigs(item, menuItemConfig)), Array.isArray(item.positions) ? item.positions.forEach((menu) => this._appendMenuToPosition(item, menu)) : item.positions && this._appendMenuToPosition(item, item.positions), [
|
|
3579
|
+
MenuPosition.TOOLBAR_START,
|
|
3580
|
+
MenuPosition.TOOLBAR_INSERT,
|
|
3581
|
+
MenuPosition.TOOLBAR_FORMULAS,
|
|
3582
|
+
MenuPosition.TOOLBAR_DATA,
|
|
3583
|
+
MenuPosition.TOOLBAR_VIEW,
|
|
3584
|
+
MenuPosition.TOOLBAR_OTHERS,
|
|
3585
|
+
MenuPosition.CONTEXT_MENU
|
|
3586
|
+
].forEach((position) => {
|
|
3587
|
+
position !== MenuPosition.CONTEXT_MENU ? this.getMenuItems(position).forEach((menu) => {
|
|
3588
|
+
var _a19;
|
|
3589
|
+
this._menuManagerService.mergeMenu({
|
|
3590
|
+
[position]: {
|
|
3591
|
+
[(_a19 = menu.group) != null ? _a19 : RibbonOthersGroup.OTHERS]: {
|
|
3592
|
+
[menu.id]: {
|
|
3593
|
+
menuItemFactory: /* @__PURE__ */ __name(() => menu, "menuItemFactory")
|
|
3594
|
+
}
|
|
3595
|
+
}
|
|
3596
|
+
}
|
|
3597
|
+
});
|
|
3598
|
+
}) : this.getMenuItems(position).forEach((menu) => {
|
|
3599
|
+
var _a19;
|
|
3600
|
+
this._menuManagerService.mergeMenu({
|
|
3601
|
+
[position]: {
|
|
3602
|
+
[(_a19 = menu.group) != null ? _a19 : ContextMenuGroup.OTHERS]: {
|
|
3603
|
+
[menu.id]: {
|
|
3604
|
+
menuItemFactory: /* @__PURE__ */ __name(() => menu, "menuItemFactory")
|
|
3605
|
+
}
|
|
3606
|
+
}
|
|
3607
|
+
}
|
|
3608
|
+
});
|
|
3609
|
+
});
|
|
3610
|
+
}), this._menuChanged$.next(), toDisposable(() => {
|
|
3611
|
+
if (this._menuItemMap.delete(item.id), Array.isArray(item.positions))
|
|
3612
|
+
item.positions.forEach((menu) => {
|
|
3613
|
+
const menus = this._menuByPositions.get(menu);
|
|
3614
|
+
if (!menus)
|
|
3615
|
+
return;
|
|
3616
|
+
const index = menus.findIndex((m2) => m2[0] === item.id);
|
|
3617
|
+
index > -1 && menus.splice(index, 1);
|
|
3618
|
+
});
|
|
3619
|
+
else if (item.positions) {
|
|
3620
|
+
const menus = this._menuByPositions.get(item.positions);
|
|
3621
|
+
if (!menus)
|
|
3622
|
+
return;
|
|
3623
|
+
const index = menus.findIndex((m2) => m2[0] === item.id);
|
|
3624
|
+
index > -1 && menus.splice(index, 1);
|
|
3625
|
+
}
|
|
3626
|
+
this._menuChanged$.next();
|
|
3627
|
+
});
|
|
3628
|
+
}
|
|
3629
|
+
/** @deprecated */
|
|
3630
|
+
getMenuItems(positions) {
|
|
3631
|
+
if (this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."), this._menuByPositions.has(positions)) {
|
|
3632
|
+
const menuItems = this._menuByPositions.get(positions);
|
|
3633
|
+
if (menuItems)
|
|
3634
|
+
return [...menuItems.values()].map((menu) => this._getDisplayMenuItems(menu[1]));
|
|
3635
|
+
}
|
|
3636
|
+
return [];
|
|
3637
|
+
}
|
|
3638
|
+
/** @deprecated */
|
|
3639
|
+
setMenuItem(item) {
|
|
3640
|
+
this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."), this._menuItemMap.set(item.id, item), Array.isArray(item.positions) ? item.positions.forEach((menu) => this._updateMenuItems(item, menu)) : item.positions && this._updateMenuItems(item, item.positions), this._menuChanged$.next();
|
|
3641
|
+
}
|
|
3642
|
+
/** @deprecated */
|
|
3643
|
+
getMenuItem(id) {
|
|
3644
|
+
return this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."), this._menuItemMap.has(id) ? this._menuItemMap.get(id) : null;
|
|
3645
|
+
}
|
|
3646
|
+
/** @deprecated */
|
|
3647
|
+
setMenuConfigs(id, config) {
|
|
3648
|
+
this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."), this._menuConfigs.set(id, config);
|
|
3649
|
+
}
|
|
3650
|
+
/** @deprecated */
|
|
3651
|
+
getMenuConfig(id) {
|
|
3652
|
+
return this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."), this._menuConfigs.has(id) ? this._menuConfigs.get(id) : null;
|
|
3653
|
+
}
|
|
3654
|
+
/** @deprecated */
|
|
3655
|
+
_getDisplayMenuItems(menuItem) {
|
|
3656
|
+
this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead.");
|
|
3657
|
+
const shortcut = this._shortcutService.getShortcutDisplayOfCommand(menuItem.id);
|
|
3658
|
+
return shortcut ? {
|
|
3659
|
+
...menuItem,
|
|
3660
|
+
shortcut
|
|
3661
|
+
} : menuItem;
|
|
3662
|
+
}
|
|
3663
|
+
/** @deprecated */
|
|
3664
|
+
_appendMenuToPosition(menu, position) {
|
|
3665
|
+
this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."), this._menuByPositions.has(position) || this._menuByPositions.set(position, []);
|
|
3666
|
+
const menuList = this._menuByPositions.get(position);
|
|
3667
|
+
if (menuList.findIndex((m2) => m2[0] === menu.id) > -1)
|
|
3668
|
+
throw new Error(`Menu item with the same id ${menu.id} has already been added!`);
|
|
3669
|
+
menuList.push([menu.id, menu]);
|
|
3670
|
+
}
|
|
3671
|
+
/** @deprecated */
|
|
3672
|
+
_updateMenuItems(menu, position) {
|
|
3673
|
+
this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."), this._menuByPositions.has(position) || this._menuByPositions.set(position, []);
|
|
3674
|
+
const menuList = this._menuByPositions.get(position), index = menuList.findIndex((m2) => m2[0] === menu.id);
|
|
3675
|
+
index > -1 ? menuList[index] = [menu.id, menu] : menuList.push([menu.id, menu]);
|
|
3676
|
+
}
|
|
3677
|
+
}, __name(_a5, "MenuService"), _a5);
|
|
3678
|
+
MenuService = __decorateClass$d([
|
|
3679
|
+
__decorateParam$d(0, IShortcutService),
|
|
3680
|
+
__decorateParam$d(1, IMenuManagerService),
|
|
3681
|
+
__decorateParam$d(2, ILogService)
|
|
3682
|
+
], MenuService);
|
|
3522
3683
|
function useSimpleToolbarGroups(category) {
|
|
3523
3684
|
const menuService = useDependency(IMenuService), [visibleItems, setVisibleItems] = useState([]);
|
|
3524
3685
|
return useEffect(() => {
|
|
@@ -3533,13 +3694,13 @@ __name(useSimpleToolbarGroups, "useSimpleToolbarGroups");
|
|
|
3533
3694
|
function useToolbarGroups(categories, initCategory) {
|
|
3534
3695
|
const menuService = useDependency(IMenuService), [category, setCategory] = useState(initCategory != null ? initCategory : MenuPosition.TOOLBAR_START), [groups, setGroups] = useState([]), [visibleItems, setVisibleItems] = useState([]);
|
|
3535
3696
|
useEffect(() => {
|
|
3536
|
-
var
|
|
3537
|
-
const activeItems = (_b2 = (
|
|
3697
|
+
var _a19, _b2;
|
|
3698
|
+
const activeItems = (_b2 = (_a19 = groups.find((g2) => g2.name === category)) == null ? void 0 : _a19.menuItems) != null ? _b2 : [], s = combineLatest(
|
|
3538
3699
|
activeItems.map((item) => {
|
|
3539
|
-
var
|
|
3540
|
-
return (
|
|
3700
|
+
var _a20;
|
|
3701
|
+
return (_a20 = item.hidden$) != null ? _a20 : new Observable((observer) => observer.next(!1));
|
|
3541
3702
|
})
|
|
3542
|
-
).pipe(map
|
|
3703
|
+
).pipe(map((hiddenValues) => activeItems.filter((_, index) => !hiddenValues[index]))).subscribe((items) => setVisibleItems(items));
|
|
3543
3704
|
return () => s.unsubscribe();
|
|
3544
3705
|
}, [groups, category]), useEffect(() => {
|
|
3545
3706
|
const s = menuService.menuChanged$.subscribe(() => {
|
|
@@ -3553,11 +3714,11 @@ function useToolbarGroups(categories, initCategory) {
|
|
|
3553
3714
|
return () => s.unsubscribe();
|
|
3554
3715
|
}, [menuService, category, categories]);
|
|
3555
3716
|
const groupsByKey = useMemo(() => {
|
|
3556
|
-
var
|
|
3557
|
-
return (_b2 = (
|
|
3717
|
+
var _a19, _b2;
|
|
3718
|
+
return (_b2 = (_a19 = groups.find((g2) => g2.name === category)) == null ? void 0 : _a19.menuItems.reduce(
|
|
3558
3719
|
(acc, item) => {
|
|
3559
|
-
var
|
|
3560
|
-
const key = (
|
|
3720
|
+
var _a20;
|
|
3721
|
+
const key = (_a20 = item.group) != null ? _a20 : MenuGroup.TOOLBAR_OTHERS;
|
|
3561
3722
|
return acc[key] || (acc[key] = []), acc[key].push(item), acc;
|
|
3562
3723
|
},
|
|
3563
3724
|
{}
|
|
@@ -3574,69 +3735,91 @@ function useToolbarGroups(categories, initCategory) {
|
|
|
3574
3735
|
__name(useToolbarGroups, "useToolbarGroups");
|
|
3575
3736
|
function useToolbarItemStatus(menuItem) {
|
|
3576
3737
|
const { disabled$, hidden$, activated$, value$ } = menuItem, [value, setValue] = useState(), [disabled, setDisabled] = useState(!1), [activated, setActivated] = useState(!1), [hidden, setHidden] = useState(!1);
|
|
3577
|
-
return useEffect(() => {
|
|
3578
|
-
const subscriptions = [];
|
|
3579
|
-
return disabled$ && subscriptions.push(disabled$.subscribe((disabled2) => setDisabled(disabled2))), hidden$ && subscriptions.push(hidden$.subscribe((hidden2) => setHidden(hidden2))), activated$ && subscriptions.push(activated$.subscribe((activated2) => setActivated(activated2))), value$ && subscriptions.push(value$.subscribe((value2) => setValue(value2))), () => subscriptions.forEach((subscription) => subscription.unsubscribe());
|
|
3580
|
-
}, [activated$, disabled$, hidden$, value$]), { disabled, value, activated, hidden };
|
|
3581
|
-
}
|
|
3582
|
-
__name(useToolbarItemStatus, "useToolbarItemStatus");
|
|
3583
|
-
function useToolbarCollapseObserver(visibleItems) {
|
|
3584
|
-
const toolbarItemRefs = useRef({}), toolbarRef = useRef(null), [collapsedId, setCollapsedId] = useState([]);
|
|
3585
|
-
return useEffect(() => {
|
|
3586
|
-
function resize() {
|
|
3587
|
-
var _a18, _b2;
|
|
3588
|
-
const wrapperWidth = (_b2 = (_a18 = toolbarRef.current) == null ? void 0 : _a18.clientWidth) != null ? _b2 : 0;
|
|
3589
|
-
let GAP = 0;
|
|
3590
|
-
if (toolbarRef.current) {
|
|
3591
|
-
const gapValue = Number.parseInt(getComputedStyle(toolbarRef.current.firstElementChild).gap, 10);
|
|
3592
|
-
GAP = Number.isNaN(gapValue) ? 0 : gapValue;
|
|
3593
|
-
}
|
|
3594
|
-
const itemWidths = Object.entries(toolbarItemRefs.current).filter(([_, ref]) => ref.el && ref.key && visibleItems.find((item) => item.id === ref.key)).map(([_, ref]) => {
|
|
3595
|
-
var _a19;
|
|
3596
|
-
return {
|
|
3597
|
-
key: ref.key,
|
|
3598
|
-
width: ((_a19 = ref.el) == null ? void 0 : _a19.clientWidth) + GAP
|
|
3599
|
-
};
|
|
3600
|
-
}), collapsedId2 = [];
|
|
3601
|
-
let currentWidth = 182;
|
|
3602
|
-
for (const item of itemWidths)
|
|
3603
|
-
currentWidth += item.width, currentWidth > wrapperWidth && collapsedId2.push(item.key);
|
|
3604
|
-
setCollapsedId(collapsedId2);
|
|
3605
|
-
}
|
|
3606
|
-
__name(resize, "resize"), resize();
|
|
3607
|
-
const observer = new ResizeObserver(() => resize()), toolbarDom = toolbarRef.current;
|
|
3608
|
-
return toolbarDom && observer.observe(toolbarDom), () => {
|
|
3609
|
-
toolbarDom && observer.unobserve(toolbarDom);
|
|
3610
|
-
};
|
|
3611
|
-
}, [visibleItems]), {
|
|
3612
|
-
toolbarRef,
|
|
3613
|
-
toolbarItemRefs,
|
|
3614
|
-
collapsedId
|
|
3615
|
-
};
|
|
3738
|
+
return useEffect(() => {
|
|
3739
|
+
const subscriptions = [];
|
|
3740
|
+
return disabled$ && subscriptions.push(disabled$.subscribe((disabled2) => setDisabled(disabled2))), hidden$ && subscriptions.push(hidden$.subscribe((hidden2) => setHidden(hidden2))), activated$ && subscriptions.push(activated$.subscribe((activated2) => setActivated(activated2))), value$ && subscriptions.push(value$.subscribe((value2) => setValue(value2))), () => subscriptions.forEach((subscription) => subscription.unsubscribe());
|
|
3741
|
+
}, [activated$, disabled$, hidden$, value$]), { disabled, value, activated, hidden };
|
|
3616
3742
|
}
|
|
3617
|
-
__name(
|
|
3618
|
-
const
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
}, "
|
|
3743
|
+
__name(useToolbarItemStatus, "useToolbarItemStatus");
|
|
3744
|
+
const TooltipWrapperContext = createContext({
|
|
3745
|
+
dropdownVisible: !1,
|
|
3746
|
+
setDropdownVisible: /* @__PURE__ */ __name((_visible) => {
|
|
3747
|
+
}, "setDropdownVisible")
|
|
3748
|
+
}), TooltipWrapper = forwardRef((props, ref) => {
|
|
3749
|
+
const { children, ...tooltipProps } = props, [tooltipVisible, setTooltipVisible] = useState(!1), [dropdownVisible, setDropdownVisible] = useState(!1);
|
|
3750
|
+
function handleChangeTooltipVisible(visible) {
|
|
3751
|
+
setTooltipVisible(dropdownVisible ? !1 : visible);
|
|
3752
|
+
}
|
|
3753
|
+
__name(handleChangeTooltipVisible, "handleChangeTooltipVisible");
|
|
3754
|
+
function handleChangeDropdownVisible(visible) {
|
|
3755
|
+
setDropdownVisible(visible), setTooltipVisible(!1);
|
|
3756
|
+
}
|
|
3757
|
+
__name(handleChangeDropdownVisible, "handleChangeDropdownVisible");
|
|
3758
|
+
const contextValue = useMemo(() => ({
|
|
3759
|
+
dropdownVisible,
|
|
3760
|
+
setDropdownVisible: handleChangeDropdownVisible
|
|
3761
|
+
}), [dropdownVisible]);
|
|
3762
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3763
|
+
Tooltip,
|
|
3764
|
+
{
|
|
3765
|
+
ref,
|
|
3766
|
+
...tooltipProps,
|
|
3767
|
+
visible: tooltipVisible,
|
|
3768
|
+
onVisibleChange: handleChangeTooltipVisible,
|
|
3769
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipWrapperContext.Provider, { value: contextValue, children }) })
|
|
3770
|
+
}
|
|
3771
|
+
);
|
|
3772
|
+
});
|
|
3773
|
+
function DropdownWrapper(props) {
|
|
3774
|
+
const { children, ...dropdownProps } = props, { setDropdownVisible } = useContext(TooltipWrapperContext);
|
|
3622
3775
|
function handleVisibleChange(visible) {
|
|
3623
|
-
|
|
3624
|
-
}
|
|
3625
|
-
__name(handleVisibleChange, "handleVisibleChange");
|
|
3626
|
-
function handleDropdownVisibleChange(visible) {
|
|
3627
|
-
setDropdownVisible(visible), visible || setTooltipVisible(!1);
|
|
3776
|
+
setDropdownVisible(visible);
|
|
3628
3777
|
}
|
|
3629
|
-
__name(
|
|
3630
|
-
|
|
3778
|
+
return __name(handleVisibleChange, "handleVisibleChange"), /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3779
|
+
Dropdown,
|
|
3780
|
+
{
|
|
3781
|
+
onVisibleChange: handleVisibleChange,
|
|
3782
|
+
...dropdownProps,
|
|
3783
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { onClick: /* @__PURE__ */ __name((e2) => e2.stopPropagation(), "onClick"), children })
|
|
3784
|
+
}
|
|
3785
|
+
);
|
|
3786
|
+
}
|
|
3787
|
+
__name(DropdownWrapper, "DropdownWrapper");
|
|
3788
|
+
const headerbar = "univer-headerbar", headerMenu = "univer-header-menu", menubar = "univer-menubar", menubarItem = "univer-menubar-item", menubarItemActive = "univer-menubar-item-active", toolbar = "univer-toolbar", toolbarContainer = "univer-toolbar-container", toolbarMore = "univer-toolbar-more", toolbarMoreContainer = "univer-toolbar-more-container", toolbarGroup = "univer-toolbar-group", toolbarItemSelectButton = "univer-toolbar-item-select-button", toolbarItemSelectButtonDisabled = "univer-toolbar-item-select-button-disabled", toolbarItemSelectButtonActivated = "univer-toolbar-item-select-button-activated", toolbarItemSelectButtonLabel = "univer-toolbar-item-select-button-label", toolbarItemSelectButtonArrow = "univer-toolbar-item-select-button-arrow", toolbarItemSelect = "univer-toolbar-item-select", toolbarItemSelectDisabled = "univer-toolbar-item-select-disabled", toolbarItemSelectActivated = "univer-toolbar-item-select-activated", toolbarItemSelectArrow = "univer-toolbar-item-select-arrow", toolbarItemSelectArrowDisabled = "univer-toolbar-item-select-arrow-disabled", toolbarItemSelectArrowActivated = "univer-toolbar-item-select-arrow-activated", styles$b = {
|
|
3789
|
+
headerbar,
|
|
3790
|
+
headerMenu,
|
|
3791
|
+
menubar,
|
|
3792
|
+
menubarItem,
|
|
3793
|
+
menubarItemActive,
|
|
3794
|
+
toolbar,
|
|
3795
|
+
toolbarContainer,
|
|
3796
|
+
toolbarMore,
|
|
3797
|
+
toolbarMoreContainer,
|
|
3798
|
+
toolbarGroup,
|
|
3799
|
+
toolbarItemSelectButton,
|
|
3800
|
+
toolbarItemSelectButtonDisabled,
|
|
3801
|
+
toolbarItemSelectButtonActivated,
|
|
3802
|
+
toolbarItemSelectButtonLabel,
|
|
3803
|
+
toolbarItemSelectButtonArrow,
|
|
3804
|
+
toolbarItemSelect,
|
|
3805
|
+
toolbarItemSelectDisabled,
|
|
3806
|
+
toolbarItemSelectActivated,
|
|
3807
|
+
toolbarItemSelectArrow,
|
|
3808
|
+
toolbarItemSelectArrowDisabled,
|
|
3809
|
+
toolbarItemSelectArrowActivated
|
|
3810
|
+
}, ToolbarItem = forwardRef((props, ref) => {
|
|
3811
|
+
const { align } = props, localeService = useDependency(LocaleService), commandService = useDependency(ICommandService), layoutService = useDependency(ILayoutService), componentManager = useDependency(ComponentManager), { value, hidden, disabled, activated } = useToolbarItemStatus(props), executeCommand = /* @__PURE__ */ __name((commandId2, params) => {
|
|
3812
|
+
layoutService.focus(), commandService.executeCommand(commandId2, params);
|
|
3813
|
+
}, "executeCommand"), { tooltip, shortcut, icon, title, label, id, commandId } = props, tooltipTitle = localeService.t(tooltip != null ? tooltip : "") + (shortcut ? ` (${shortcut})` : ""), { selections } = props, selections$ = useMemo(() => isObservable(selections) ? selections : new Observable((subscribe) => {
|
|
3631
3814
|
subscribe.next(selections);
|
|
3632
3815
|
}), [selections]), options = useObservable(selections$), icon$ = useMemo(() => isObservable(icon) ? icon : new Observable((subscribe) => {
|
|
3633
|
-
var
|
|
3634
|
-
const v2 = (_b2 = (
|
|
3816
|
+
var _a19, _b2;
|
|
3817
|
+
const v2 = (_b2 = (_a19 = options == null ? void 0 : options.find((o) => o.value === value)) == null ? void 0 : _a19.icon) != null ? _b2 : icon;
|
|
3635
3818
|
subscribe.next(v2);
|
|
3636
3819
|
}), [icon, options, value]), iconToDisplay = useObservable(icon$, void 0, !0);
|
|
3637
3820
|
function renderSelectorType(menuType) {
|
|
3638
|
-
var
|
|
3639
|
-
const selectionsCommandId = props.selectionsCommandId, bId = commandId != null ? commandId : id, sId = (
|
|
3821
|
+
var _a19;
|
|
3822
|
+
const selectionsCommandId = props.selectionsCommandId, bId = commandId != null ? commandId : id, sId = (_a19 = selectionsCommandId != null ? selectionsCommandId : commandId) != null ? _a19 : id;
|
|
3640
3823
|
function handleSelect(option) {
|
|
3641
3824
|
if (disabled) return;
|
|
3642
3825
|
let commandId2 = sId;
|
|
@@ -3650,111 +3833,120 @@ const ToolbarItem = forwardRef((props, ref) => {
|
|
|
3650
3833
|
function handleClick() {
|
|
3651
3834
|
disabled || menuType === MenuItemType.BUTTON_SELECTOR && executeCommand(bId, { value });
|
|
3652
3835
|
}
|
|
3653
|
-
return __name(handleClick, "handleClick"), menuType === MenuItemType.BUTTON_SELECTOR ? (
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
"
|
|
3663
|
-
|
|
3664
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$b.toolbarItemSelectButtonLabel, onClick: handleClick, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3665
|
-
CustomLabel,
|
|
3666
|
-
{
|
|
3667
|
-
icon: iconToDisplay,
|
|
3668
|
-
title,
|
|
3669
|
-
value,
|
|
3670
|
-
label,
|
|
3671
|
-
onChange: handleSelectionsValueChange
|
|
3672
|
-
}
|
|
3673
|
-
) }),
|
|
3674
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3675
|
-
Dropdown,
|
|
3676
|
-
{
|
|
3677
|
-
overlay: /* @__PURE__ */ jsxRuntimeExports.jsx(Menu, { overViewport: "scroll", menuType: id, options, onOptionSelect: handleSelect, value }),
|
|
3678
|
-
onVisibleChange: handleDropdownVisibleChange,
|
|
3679
|
-
disabled,
|
|
3680
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3681
|
-
"div",
|
|
3682
|
-
{
|
|
3683
|
-
className: clsx$1(styles$b.toolbarItemSelectButtonArrow, {
|
|
3684
|
-
[styles$b.toolbarItemSelectButtonArrowDisabled]: disabled,
|
|
3685
|
-
[styles$b.toolbarItemSelectButtonArrowActivated]: activated
|
|
3686
|
-
}),
|
|
3687
|
-
"data-disabled": disabled,
|
|
3688
|
-
onClick: /* @__PURE__ */ __name((e2) => e2.stopPropagation(), "onClick"),
|
|
3689
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(MoreDownSingle, {})
|
|
3690
|
-
}
|
|
3691
|
-
)
|
|
3692
|
-
}
|
|
3693
|
-
)
|
|
3694
|
-
]
|
|
3695
|
-
}
|
|
3696
|
-
)
|
|
3697
|
-
) : (
|
|
3698
|
-
// Selector
|
|
3699
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3700
|
-
Dropdown,
|
|
3701
|
-
{
|
|
3702
|
-
overlay: /* @__PURE__ */ jsxRuntimeExports.jsx(Menu, { overViewport: "scroll", menuType: id, options, onOptionSelect: handleSelect, value }),
|
|
3703
|
-
onVisibleChange: handleDropdownVisibleChange,
|
|
3704
|
-
disabled,
|
|
3705
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
3706
|
-
"div",
|
|
3836
|
+
return __name(handleClick, "handleClick"), menuType === MenuItemType.BUTTON_SELECTOR ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
3837
|
+
"div",
|
|
3838
|
+
{
|
|
3839
|
+
className: clsx$1(styles$b.toolbarItemSelectButton, {
|
|
3840
|
+
[styles$b.toolbarItemSelectButtonDisabled]: disabled,
|
|
3841
|
+
[styles$b.toolbarItemSelectButtonActivated]: activated
|
|
3842
|
+
}),
|
|
3843
|
+
"data-disabled": disabled,
|
|
3844
|
+
children: [
|
|
3845
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$b.toolbarItemSelectButtonLabel, onClick: handleClick, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3846
|
+
CustomLabel,
|
|
3707
3847
|
{
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3848
|
+
icon: iconToDisplay,
|
|
3849
|
+
title,
|
|
3850
|
+
value,
|
|
3851
|
+
label,
|
|
3852
|
+
onChange: handleSelectionsValueChange
|
|
3853
|
+
}
|
|
3854
|
+
) }),
|
|
3855
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3856
|
+
DropdownWrapper,
|
|
3857
|
+
{
|
|
3858
|
+
align: align != null ? align : {
|
|
3859
|
+
targetOffset: [32, -12]
|
|
3860
|
+
},
|
|
3861
|
+
overlay: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3862
|
+
Menu,
|
|
3863
|
+
{
|
|
3864
|
+
overViewport: "scroll",
|
|
3865
|
+
menuType: id,
|
|
3866
|
+
options,
|
|
3867
|
+
onOptionSelect: handleSelect,
|
|
3868
|
+
value
|
|
3869
|
+
}
|
|
3870
|
+
),
|
|
3871
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3872
|
+
"div",
|
|
3873
|
+
{
|
|
3874
|
+
className: clsx$1(styles$b.toolbarItemSelectButtonArrow, {
|
|
3875
|
+
[styles$b.toolbarItemSelectButtonArrowDisabled]: disabled,
|
|
3876
|
+
[styles$b.toolbarItemSelectButtonArrowActivated]: activated
|
|
3877
|
+
}),
|
|
3878
|
+
"data-disabled": disabled,
|
|
3879
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(MoreDownSingle, { style: { height: "100%" } })
|
|
3880
|
+
}
|
|
3881
|
+
)
|
|
3734
3882
|
}
|
|
3735
3883
|
)
|
|
3736
|
-
|
|
3737
|
-
|
|
3884
|
+
]
|
|
3885
|
+
}
|
|
3886
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3887
|
+
DropdownWrapper,
|
|
3888
|
+
{
|
|
3889
|
+
overlay: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3890
|
+
Menu,
|
|
3891
|
+
{
|
|
3892
|
+
overViewport: "scroll",
|
|
3893
|
+
menuType: id,
|
|
3894
|
+
options,
|
|
3895
|
+
onOptionSelect: handleSelect,
|
|
3896
|
+
value
|
|
3897
|
+
}
|
|
3898
|
+
),
|
|
3899
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
3900
|
+
"div",
|
|
3901
|
+
{
|
|
3902
|
+
className: clsx$1(styles$b.toolbarItemSelect, {
|
|
3903
|
+
[styles$b.toolbarItemSelectDisabled]: disabled,
|
|
3904
|
+
[styles$b.toolbarItemSelectActivated]: activated
|
|
3905
|
+
}),
|
|
3906
|
+
children: [
|
|
3907
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3908
|
+
CustomLabel,
|
|
3909
|
+
{
|
|
3910
|
+
icon: iconToDisplay,
|
|
3911
|
+
title,
|
|
3912
|
+
value,
|
|
3913
|
+
label,
|
|
3914
|
+
onChange: handleSelectionsValueChange
|
|
3915
|
+
}
|
|
3916
|
+
),
|
|
3917
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3918
|
+
"div",
|
|
3919
|
+
{
|
|
3920
|
+
className: clsx$1(styles$b.toolbarItemSelectArrow, {
|
|
3921
|
+
[styles$b.toolbarItemSelectArrowDisabled]: disabled
|
|
3922
|
+
}),
|
|
3923
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(MoreDownSingle, {})
|
|
3924
|
+
}
|
|
3925
|
+
)
|
|
3926
|
+
]
|
|
3927
|
+
}
|
|
3928
|
+
)
|
|
3929
|
+
}
|
|
3738
3930
|
);
|
|
3739
3931
|
}
|
|
3740
3932
|
__name(renderSelectorType, "renderSelectorType");
|
|
3741
3933
|
function renderButtonType() {
|
|
3742
|
-
var
|
|
3743
|
-
const isCustomComponent = componentManager.get(typeof label == "string" ? label : (
|
|
3744
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3934
|
+
var _a19;
|
|
3935
|
+
const isCustomComponent = componentManager.get(typeof label == "string" ? label : (_a19 = label == null ? void 0 : label.name) != null ? _a19 : "");
|
|
3936
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3745
3937
|
ToolbarButton,
|
|
3746
3938
|
{
|
|
3747
3939
|
className: styles$b.toolbarItemTextButton,
|
|
3748
3940
|
active: activated,
|
|
3749
3941
|
disabled,
|
|
3750
3942
|
onClick: /* @__PURE__ */ __name(() => {
|
|
3751
|
-
var
|
|
3752
|
-
return executeCommand((
|
|
3943
|
+
var _a20;
|
|
3944
|
+
return executeCommand((_a20 = props.commandId) != null ? _a20 : props.id);
|
|
3753
3945
|
}, "onClick"),
|
|
3754
3946
|
onDoubleClick: /* @__PURE__ */ __name(() => props.subId && executeCommand(props.subId), "onDoubleClick"),
|
|
3755
3947
|
children: isCustomComponent ? /* @__PURE__ */ jsxRuntimeExports.jsx(CustomLabel, { title, value, label }) : /* @__PURE__ */ jsxRuntimeExports.jsx(CustomLabel, { icon })
|
|
3756
3948
|
}
|
|
3757
|
-
);
|
|
3949
|
+
) });
|
|
3758
3950
|
}
|
|
3759
3951
|
__name(renderButtonType, "renderButtonType");
|
|
3760
3952
|
function renderItem() {
|
|
@@ -3768,91 +3960,115 @@ const ToolbarItem = forwardRef((props, ref) => {
|
|
|
3768
3960
|
return renderButtonType();
|
|
3769
3961
|
}
|
|
3770
3962
|
}
|
|
3771
|
-
return __name(renderItem, "renderItem"), hidden
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: renderItem() })
|
|
3963
|
+
return __name(renderItem, "renderItem"), !hidden && /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipWrapper, { ref, title: tooltipTitle, placement: "bottom", children: renderItem() });
|
|
3964
|
+
});
|
|
3965
|
+
function Ribbon(props) {
|
|
3966
|
+
const { headerMenuComponents } = props, menuManagerService = useDependency(IMenuManagerService), localeService = useDependency(LocaleService), toolbarRef = useRef(null), toolbarItemRefs = useRef({}), [ribbon, setRibbon] = useState([]), [category, setCategory] = useState(RibbonPosition.START), [collapsedIds, setCollapsedIds] = useState([]);
|
|
3967
|
+
useEffect(() => {
|
|
3968
|
+
function getRibbon() {
|
|
3969
|
+
const ribbon2 = menuManagerService.getMenuByPositionKey(MenuManagerPosition.RIBBON);
|
|
3970
|
+
setRibbon(ribbon2);
|
|
3780
3971
|
}
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3972
|
+
__name(getRibbon, "getRibbon"), getRibbon();
|
|
3973
|
+
const subscription = menuManagerService.menuChanged$.subscribe(getRibbon);
|
|
3974
|
+
return () => {
|
|
3975
|
+
subscription.unsubscribe();
|
|
3976
|
+
};
|
|
3977
|
+
}, [menuManagerService]), useEffect(() => {
|
|
3978
|
+
const observer = new ResizeObserver((entries) => {
|
|
3979
|
+
const toolbarWidth = entries[0].target.clientWidth, toolbarItems = Object.values(toolbarItemRefs.current), collapsedIds2 = [];
|
|
3980
|
+
let totalWidth = 90;
|
|
3981
|
+
for (const { el, key } of toolbarItems)
|
|
3982
|
+
el && (totalWidth += el.clientWidth + 8, totalWidth > toolbarWidth && collapsedIds2.push(key));
|
|
3983
|
+
setCollapsedIds(collapsedIds2);
|
|
3984
|
+
});
|
|
3985
|
+
return toolbarRef.current && observer.observe(toolbarRef.current), () => {
|
|
3986
|
+
observer.disconnect();
|
|
3987
|
+
};
|
|
3988
|
+
}, [ribbon]);
|
|
3989
|
+
const hasHeaderMenu = useMemo(() => headerMenuComponents && headerMenuComponents.size > 0 || ribbon.length > 1, [headerMenuComponents, ribbon]), activeGroup = useMemo(() => {
|
|
3990
|
+
var _a19, _b2;
|
|
3991
|
+
const allGroups = (_b2 = (_a19 = ribbon.find((group) => group.key === category)) == null ? void 0 : _a19.children) != null ? _b2 : [], visibleGroups = [], hiddenGroups = [];
|
|
3992
|
+
for (const item of allGroups)
|
|
3993
|
+
if (item.children) {
|
|
3994
|
+
const visibleChildren = item.children.filter((child) => !collapsedIds.includes(child.key));
|
|
3995
|
+
visibleGroups.push({ ...item, children: visibleChildren }), visibleChildren.length < item.children.length && hiddenGroups.push({ ...item, children: item.children.filter((child) => collapsedIds.includes(child.key)) });
|
|
3996
|
+
}
|
|
3997
|
+
return {
|
|
3998
|
+
allGroups,
|
|
3999
|
+
visibleGroups,
|
|
4000
|
+
hiddenGroups
|
|
4001
|
+
};
|
|
4002
|
+
}, [ribbon, category, collapsedIds]);
|
|
3792
4003
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
3793
|
-
hasHeaderMenu
|
|
3794
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$b.menubar, children:
|
|
4004
|
+
hasHeaderMenu && /* @__PURE__ */ jsxRuntimeExports.jsxs("header", { className: styles$b.headerbar, children: [
|
|
4005
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$b.menubar, children: ribbon.length > 1 && ribbon.map((group) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3795
4006
|
"a",
|
|
3796
4007
|
{
|
|
3797
4008
|
className: clsx$1(styles$b.menubarItem, {
|
|
3798
|
-
[styles$b.menubarItemActive]:
|
|
4009
|
+
[styles$b.menubarItemActive]: group.key === category
|
|
3799
4010
|
}),
|
|
3800
4011
|
onClick: /* @__PURE__ */ __name(() => {
|
|
3801
|
-
setCategory(
|
|
4012
|
+
setCategory(group.key);
|
|
3802
4013
|
}, "onClick"),
|
|
3803
|
-
children: localeService.t(
|
|
4014
|
+
children: localeService.t(group.key)
|
|
3804
4015
|
},
|
|
3805
|
-
|
|
4016
|
+
group.key
|
|
3806
4017
|
)) }),
|
|
3807
4018
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$b.headerMenu, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ComponentContainer, { components: headerMenuComponents }) })
|
|
3808
|
-
] })
|
|
3809
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
4019
|
+
] }),
|
|
4020
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("section", { role: "ribbon", className: styles$b.toolbar, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$b.toolbarContainer, children: [
|
|
4021
|
+
activeGroup.visibleGroups.map((groupItem) => {
|
|
4022
|
+
var _a19, _b2;
|
|
4023
|
+
return (((_a19 = groupItem.children) == null ? void 0 : _a19.length) || groupItem.item) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$b.toolbarGroup, children: groupItem.children ? (_b2 = groupItem.children) == null ? void 0 : _b2.map((child) => child.item && /* @__PURE__ */ jsxRuntimeExports.jsx(ToolbarItem, { ...child.item }, child.key)) : groupItem.item && /* @__PURE__ */ jsxRuntimeExports.jsx(ToolbarItem, { ...groupItem.item }, groupItem.key) }, groupItem.key);
|
|
4024
|
+
}),
|
|
4025
|
+
collapsedIds.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipWrapper, { title: localeService.t("ribbon.more"), placement: "bottom", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4026
|
+
DropdownWrapper,
|
|
3815
4027
|
{
|
|
3816
4028
|
forceRender: !0,
|
|
3817
|
-
className: styles$b.
|
|
3818
|
-
|
|
3819
|
-
(
|
|
3820
|
-
|
|
3821
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4029
|
+
overlay: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$b.toolbarMoreContainer, children: activeGroup.hiddenGroups.map((groupItem) => {
|
|
4030
|
+
var _a19;
|
|
4031
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$b.toolbarGroup, children: groupItem.children ? (_a19 = groupItem.children) == null ? void 0 : _a19.map((child) => child.item && /* @__PURE__ */ jsxRuntimeExports.jsx(ToolbarItem, { ...child.item }, child.key)) : groupItem.item && /* @__PURE__ */ jsxRuntimeExports.jsx(ToolbarItem, { ...groupItem.item }, groupItem.key) }, groupItem.key);
|
|
4032
|
+
}) }),
|
|
4033
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(ToolbarButton, { className: styles$b.toolbarItemTextButton, children: /* @__PURE__ */ jsxRuntimeExports.jsx(MoreFunctionSingle, {}) })
|
|
3822
4034
|
}
|
|
3823
|
-
) })
|
|
4035
|
+
) })
|
|
3824
4036
|
] }) }),
|
|
3825
4037
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3826
4038
|
"div",
|
|
3827
4039
|
{
|
|
4040
|
+
ref: toolbarRef,
|
|
3828
4041
|
className: styles$b.toolbarContainer,
|
|
3829
4042
|
style: {
|
|
3830
4043
|
position: "absolute",
|
|
3831
4044
|
top: -9999,
|
|
3832
4045
|
left: -9999,
|
|
3833
4046
|
opacity: 0
|
|
4047
|
+
// top: 0,
|
|
4048
|
+
// left: 0,
|
|
4049
|
+
// opacity: 1,
|
|
3834
4050
|
},
|
|
3835
|
-
children:
|
|
3836
|
-
|
|
3837
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4051
|
+
children: activeGroup.allGroups.map((groupItem) => {
|
|
4052
|
+
var _a19;
|
|
4053
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$b.toolbarGroup, children: (_a19 = groupItem.children) == null ? void 0 : _a19.map((child) => child.item && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3838
4054
|
ToolbarItem,
|
|
3839
4055
|
{
|
|
3840
4056
|
ref: /* @__PURE__ */ __name((ref) => {
|
|
3841
|
-
toolbarItemRefs.current[
|
|
4057
|
+
toolbarItemRefs.current[child.key] = {
|
|
3842
4058
|
el: ref == null ? void 0 : ref.nativeElement,
|
|
3843
|
-
key:
|
|
4059
|
+
key: child.key
|
|
3844
4060
|
};
|
|
3845
4061
|
}, "ref"),
|
|
3846
|
-
...
|
|
4062
|
+
...child.item
|
|
3847
4063
|
},
|
|
3848
|
-
|
|
3849
|
-
)
|
|
3850
|
-
|
|
4064
|
+
child.key
|
|
4065
|
+
)) }, groupItem.key);
|
|
4066
|
+
})
|
|
3851
4067
|
}
|
|
3852
4068
|
)
|
|
3853
4069
|
] });
|
|
3854
4070
|
}
|
|
3855
|
-
__name(
|
|
4071
|
+
__name(Ribbon, "Ribbon");
|
|
3856
4072
|
const ILeftSidebarService = createIdentifier("ui.left-sidebar.service"), ISidebarService = createIdentifier("ui.sidebar.service"), sidebar = "univer-sidebar", sidebarOpen = "univer-sidebar-open", sidebarContainer = "univer-sidebar-container", sidebarHeader = "univer-sidebar-header", sidebarHeaderClose = "univer-sidebar-header-close", sidebarBody = "univer-sidebar-body", sidebarFooter = "univer-sidebar-footer", styles$a = {
|
|
3857
4073
|
sidebar,
|
|
3858
4074
|
sidebarOpen,
|
|
@@ -3888,12 +4104,12 @@ function Sidebar() {
|
|
|
3888
4104
|
[styles$a.sidebarOpen]: options == null ? void 0 : options.visible
|
|
3889
4105
|
}), width = useMemo(() => options != null && options.visible ? typeof options.width == "number" ? `${options.width}px` : options.width : 0, [options]);
|
|
3890
4106
|
function handleClose() {
|
|
3891
|
-
var
|
|
4107
|
+
var _a19;
|
|
3892
4108
|
const options2 = {
|
|
3893
4109
|
...sidebarOptions,
|
|
3894
4110
|
visible: !1
|
|
3895
4111
|
};
|
|
3896
|
-
sidebarService.sidebarOptions$.next(options2), (
|
|
4112
|
+
sidebarService.sidebarOptions$.next(options2), (_a19 = options2 == null ? void 0 : options2.onClose) == null || _a19.call(options2);
|
|
3897
4113
|
}
|
|
3898
4114
|
return __name(handleClose, "handleClose"), /* @__PURE__ */ jsxRuntimeExports.jsx("section", { className: _className, style: { width }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: styles$a.sidebarContainer, ref: scrollRef, children: [
|
|
3899
4115
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("header", { className: styles$a.sidebarHeader, children: [
|
|
@@ -3996,7 +4212,7 @@ function DesktopWorkbench(props) {
|
|
|
3996
4212
|
};
|
|
3997
4213
|
}, [localeService, messageService, mountContainer, portalContainer, themeService.currentTheme$]), /* @__PURE__ */ jsxRuntimeExports.jsxs(ConfigProvider, { locale: locale == null ? void 0 : locale.design, mountContainer: portalContainer, children: [
|
|
3998
4214
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$7.workbenchLayout, tabIndex: -1, onBlur: /* @__PURE__ */ __name((e2) => e2.stopPropagation(), "onBlur"), children: [
|
|
3999
|
-
header && toolbar2 && /* @__PURE__ */ jsxRuntimeExports.jsx("header", { className: styles$7.workbenchContainerHeader, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4215
|
+
header && toolbar2 && /* @__PURE__ */ jsxRuntimeExports.jsx("header", { className: styles$7.workbenchContainerHeader, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Ribbon, { headerMenuComponents }) }),
|
|
4000
4216
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: styles$7.workbenchContainer, children: [
|
|
4001
4217
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$7.workbenchContainerWrapper, children: [
|
|
4002
4218
|
/* @__PURE__ */ jsxRuntimeExports.jsx("aside", { className: styles$7.workbenchContainerLeftSidebar, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ComponentContainer, { components: leftSidebarComponents }, "left-sidebar") }),
|
|
@@ -4031,22 +4247,112 @@ function FloatingContainer() {
|
|
|
4031
4247
|
return createPortal(/* @__PURE__ */ jsxRuntimeExports.jsx(ComponentContainer, { components: floatingComponents }, "floating"), mountContainer);
|
|
4032
4248
|
}
|
|
4033
4249
|
__name(FloatingContainer, "FloatingContainer");
|
|
4250
|
+
const _ShortcutPanelService = class _ShortcutPanelService extends Disposable {
|
|
4251
|
+
constructor() {
|
|
4252
|
+
super(...arguments);
|
|
4253
|
+
__publicField(this, "_open$", new BehaviorSubject(!1));
|
|
4254
|
+
__publicField(this, "open$", this._open$.pipe(distinctUntilChanged()));
|
|
4255
|
+
}
|
|
4256
|
+
get isOpen() {
|
|
4257
|
+
return this._open$.getValue();
|
|
4258
|
+
}
|
|
4259
|
+
dispose() {
|
|
4260
|
+
super.dispose(), this._open$.next(!1), this._open$.complete();
|
|
4261
|
+
}
|
|
4262
|
+
open() {
|
|
4263
|
+
this._open$.next(!0);
|
|
4264
|
+
}
|
|
4265
|
+
close() {
|
|
4266
|
+
this._open$.next(!1);
|
|
4267
|
+
}
|
|
4268
|
+
};
|
|
4269
|
+
__name(_ShortcutPanelService, "ShortcutPanelService");
|
|
4270
|
+
let ShortcutPanelService = _ShortcutPanelService;
|
|
4271
|
+
const ShortcutPanelComponentName = "ShortcutPanel", ToggleShortcutPanelOperation = {
|
|
4272
|
+
id: "base-ui.operation.toggle-shortcut-panel",
|
|
4273
|
+
type: CommandType.OPERATION,
|
|
4274
|
+
handler: /* @__PURE__ */ __name((accessor) => {
|
|
4275
|
+
const shortcutPanelService = accessor.get(ShortcutPanelService), sidebarService = accessor.get(ISidebarService);
|
|
4276
|
+
return shortcutPanelService.isOpen ? (shortcutPanelService.close(), sidebarService.close()) : (shortcutPanelService.open(), sidebarService.open({
|
|
4277
|
+
header: { title: "shortcut-panel.title" },
|
|
4278
|
+
children: { label: ShortcutPanelComponentName }
|
|
4279
|
+
})), !0;
|
|
4280
|
+
}, "handler")
|
|
4281
|
+
};
|
|
4282
|
+
function ShortcutPanelMenuItemFactory(accessor) {
|
|
4283
|
+
return {
|
|
4284
|
+
id: ToggleShortcutPanelOperation.id,
|
|
4285
|
+
title: "toggle-shortcut-panel",
|
|
4286
|
+
tooltip: "toggle-shortcut-panel",
|
|
4287
|
+
icon: "KeyboardSingle",
|
|
4288
|
+
type: MenuItemType.BUTTON,
|
|
4289
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET)
|
|
4290
|
+
// disabled$: getCurrentSheetDisabled$(accessor),
|
|
4291
|
+
};
|
|
4292
|
+
}
|
|
4293
|
+
__name(ShortcutPanelMenuItemFactory, "ShortcutPanelMenuItemFactory");
|
|
4294
|
+
function UndoMenuItemFactory(accessor) {
|
|
4295
|
+
const undoRedoService = accessor.get(IUndoRedoService);
|
|
4296
|
+
return {
|
|
4297
|
+
id: UndoCommand.id,
|
|
4298
|
+
type: MenuItemType.BUTTON,
|
|
4299
|
+
icon: "UndoSingle",
|
|
4300
|
+
title: "Undo",
|
|
4301
|
+
tooltip: "toolbar.undo",
|
|
4302
|
+
disabled$: undoRedoService.undoRedoStatus$.pipe(map$1((v2) => v2.undos <= 0))
|
|
4303
|
+
};
|
|
4304
|
+
}
|
|
4305
|
+
__name(UndoMenuItemFactory, "UndoMenuItemFactory");
|
|
4306
|
+
function RedoMenuItemFactory(accessor) {
|
|
4307
|
+
const undoRedoService = accessor.get(IUndoRedoService);
|
|
4308
|
+
return {
|
|
4309
|
+
id: RedoCommand.id,
|
|
4310
|
+
type: MenuItemType.BUTTON,
|
|
4311
|
+
icon: "RedoSingle",
|
|
4312
|
+
title: "Redo",
|
|
4313
|
+
tooltip: "toolbar.redo",
|
|
4314
|
+
disabled$: undoRedoService.undoRedoStatus$.pipe(map$1((v2) => v2.redos <= 0))
|
|
4315
|
+
};
|
|
4316
|
+
}
|
|
4317
|
+
__name(RedoMenuItemFactory, "RedoMenuItemFactory");
|
|
4318
|
+
const menuSchema = {
|
|
4319
|
+
[RibbonStartGroup.HISTORY]: {
|
|
4320
|
+
[UndoCommand.id]: {
|
|
4321
|
+
order: 0,
|
|
4322
|
+
menuItemFactory: UndoMenuItemFactory
|
|
4323
|
+
},
|
|
4324
|
+
[RedoCommand.id]: {
|
|
4325
|
+
order: 1,
|
|
4326
|
+
menuItemFactory: RedoMenuItemFactory
|
|
4327
|
+
}
|
|
4328
|
+
},
|
|
4329
|
+
[RibbonStartGroup.OTHERS]: {
|
|
4330
|
+
[ToggleShortcutPanelOperation.id]: {
|
|
4331
|
+
order: 99,
|
|
4332
|
+
menuItemFactory: ShortcutPanelMenuItemFactory
|
|
4333
|
+
}
|
|
4334
|
+
}
|
|
4335
|
+
};
|
|
4034
4336
|
var __defProp$c = Object.defineProperty, __getOwnPropDesc$c = Object.getOwnPropertyDescriptor, __decorateClass$c = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
4035
4337
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4036
4338
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
4037
4339
|
return kind && result && __defProp$c(target, key, result), result;
|
|
4038
4340
|
}, "__decorateClass$c"), __decorateParam$c = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$c");
|
|
4039
4341
|
const STEADY_TIMEOUT$1 = 3e3;
|
|
4040
|
-
var
|
|
4041
|
-
let DesktopUIController = (
|
|
4042
|
-
constructor(_config, _renderManagerService, _instanceSrv, _injector, _lifecycleService, _uiPartsService,
|
|
4342
|
+
var _a6;
|
|
4343
|
+
let DesktopUIController = (_a6 = class extends Disposable {
|
|
4344
|
+
constructor(_config, _renderManagerService, _instanceSrv, _injector, _lifecycleService, _uiPartsService, _menuManagerService, _layoutService) {
|
|
4043
4345
|
super();
|
|
4044
4346
|
__publicField(this, "_steadyTimeout");
|
|
4045
|
-
|
|
4347
|
+
__publicField(this, "_renderTimeout");
|
|
4348
|
+
this._config = _config, this._renderManagerService = _renderManagerService, this._instanceSrv = _instanceSrv, this._injector = _injector, this._lifecycleService = _lifecycleService, this._uiPartsService = _uiPartsService, this._menuManagerService = _menuManagerService, this._layoutService = _layoutService, this._initBuiltinComponents(), this._initMenus(), Promise.resolve().then(() => this._bootstrapWorkbench());
|
|
4349
|
+
}
|
|
4350
|
+
_initMenus() {
|
|
4351
|
+
this._menuManagerService.mergeMenu(menuSchema);
|
|
4046
4352
|
}
|
|
4047
4353
|
_bootstrapWorkbench() {
|
|
4048
|
-
this.disposeWithMe(this._instanceSrv.unitDisposed$.subscribe(() => {
|
|
4049
|
-
clearTimeout(this._steadyTimeout);
|
|
4354
|
+
this.disposeWithMe(this._instanceSrv.unitDisposed$.subscribe((_unit) => {
|
|
4355
|
+
clearTimeout(this._renderTimeout), clearTimeout(this._steadyTimeout);
|
|
4050
4356
|
})), this.disposeWithMe(
|
|
4051
4357
|
bootstrap$1(this._injector, this._config, (contentElement, containerElement) => {
|
|
4052
4358
|
this._layoutService && (this.disposeWithMe(this._layoutService.registerRootContainerElement(containerElement)), this.disposeWithMe(this._layoutService.registerContentElement(contentElement))), this._renderManagerService.currentRender$.subscribe((renderId) => {
|
|
@@ -4055,11 +4361,13 @@ let DesktopUIController = (_a5 = class extends Disposable {
|
|
|
4055
4361
|
if (!render2.unitId || isInternalEditorID(render2.unitId)) return;
|
|
4056
4362
|
render2.engine.setContainer(contentElement);
|
|
4057
4363
|
}
|
|
4058
|
-
}), setTimeout(() => {
|
|
4364
|
+
}), this._renderTimeout = setTimeout(() => {
|
|
4059
4365
|
const allRenders = this._renderManagerService.getRenderAll();
|
|
4060
4366
|
for (const [key, render2] of allRenders)
|
|
4061
4367
|
isInternalEditorID(key) || !render2.isRenderUnit || render2.engine.setContainer(contentElement);
|
|
4062
|
-
this._lifecycleService.stage = LifecycleStages.Rendered, this._steadyTimeout = setTimeout(() =>
|
|
4368
|
+
this._lifecycleService.stage = LifecycleStages.Rendered, this._steadyTimeout = setTimeout(() => {
|
|
4369
|
+
this._lifecycleService.stage = LifecycleStages.Steady;
|
|
4370
|
+
}, STEADY_TIMEOUT$1);
|
|
4063
4371
|
}, 300);
|
|
4064
4372
|
})
|
|
4065
4373
|
);
|
|
@@ -4067,7 +4375,7 @@ let DesktopUIController = (_a5 = class extends Disposable {
|
|
|
4067
4375
|
_initBuiltinComponents() {
|
|
4068
4376
|
this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.FLOATING, () => connectInjector(CanvasPopup, this._injector))), this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.CONTENT, () => connectInjector(FloatDom, this._injector)));
|
|
4069
4377
|
}
|
|
4070
|
-
}, __name(
|
|
4378
|
+
}, __name(_a6, "DesktopUIController"), _a6);
|
|
4071
4379
|
DesktopUIController = __decorateClass$c([
|
|
4072
4380
|
OnLifecycle(LifecycleStages.Ready, DesktopUIController),
|
|
4073
4381
|
__decorateParam$c(1, IRenderManagerService),
|
|
@@ -4075,7 +4383,7 @@ DesktopUIController = __decorateClass$c([
|
|
|
4075
4383
|
__decorateParam$c(3, Inject(Injector)),
|
|
4076
4384
|
__decorateParam$c(4, Inject(LifecycleService)),
|
|
4077
4385
|
__decorateParam$c(5, IUIPartsService),
|
|
4078
|
-
__decorateParam$c(6,
|
|
4386
|
+
__decorateParam$c(6, IMenuManagerService),
|
|
4079
4387
|
__decorateParam$c(7, Optional(ILayoutService))
|
|
4080
4388
|
], DesktopUIController);
|
|
4081
4389
|
function bootstrap$1(injector, options, callback) {
|
|
@@ -4116,8 +4424,8 @@ var __defProp$b = Object.defineProperty, __getOwnPropDesc$b = Object.getOwnPrope
|
|
|
4116
4424
|
return kind && result && __defProp$b(target, key, result), result;
|
|
4117
4425
|
}, "__decorateClass$b"), __decorateParam$b = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$b");
|
|
4118
4426
|
const IBeforeCloseService = createIdentifier("univer.ui.before-close-service");
|
|
4119
|
-
var
|
|
4120
|
-
let DesktopBeforeCloseService = (
|
|
4427
|
+
var _a7;
|
|
4428
|
+
let DesktopBeforeCloseService = (_a7 = class {
|
|
4121
4429
|
constructor(_notificationService) {
|
|
4122
4430
|
__publicField(this, "_beforeUnloadCallbacks", []);
|
|
4123
4431
|
__publicField(this, "_onCloseCallbacks", []);
|
|
@@ -4152,7 +4460,7 @@ let DesktopBeforeCloseService = (_a6 = class {
|
|
|
4152
4460
|
this._onCloseCallbacks.forEach((callback) => callback());
|
|
4153
4461
|
});
|
|
4154
4462
|
}
|
|
4155
|
-
}, __name(
|
|
4463
|
+
}, __name(_a7, "DesktopBeforeCloseService"), _a7);
|
|
4156
4464
|
DesktopBeforeCloseService = __decorateClass$b([
|
|
4157
4465
|
__decorateParam$b(0, INotificationService)
|
|
4158
4466
|
], DesktopBeforeCloseService);
|
|
@@ -4168,8 +4476,8 @@ var __defProp$a = Object.defineProperty, __getOwnPropDesc$a = Object.getOwnPrope
|
|
|
4168
4476
|
const PLAIN_TEXT_CLIPBOARD_MIME_TYPE = "text/plain", HTML_CLIPBOARD_MIME_TYPE = "text/html", IClipboardInterfaceService = createIdentifier(
|
|
4169
4477
|
"univer.clipboard-interface-service"
|
|
4170
4478
|
);
|
|
4171
|
-
var
|
|
4172
|
-
let BrowserClipboardService = (
|
|
4479
|
+
var _a8;
|
|
4480
|
+
let BrowserClipboardService = (_a8 = class extends Disposable {
|
|
4173
4481
|
constructor(_localeService, _logService, _notificationService) {
|
|
4174
4482
|
super(), this._localeService = _localeService, this._logService = _logService, this._notificationService = _notificationService;
|
|
4175
4483
|
}
|
|
@@ -4236,14 +4544,14 @@ let BrowserClipboardService = (_a7 = class extends Disposable {
|
|
|
4236
4544
|
}
|
|
4237
4545
|
}
|
|
4238
4546
|
_showClipboardAuthenticationNotification() {
|
|
4239
|
-
var
|
|
4240
|
-
(
|
|
4547
|
+
var _a19;
|
|
4548
|
+
(_a19 = this._notificationService) == null || _a19.show({
|
|
4241
4549
|
type: "warning",
|
|
4242
4550
|
title: this._localeService.t("clipboard.authentication.title"),
|
|
4243
4551
|
content: this._localeService.t("clipboard.authentication.content")
|
|
4244
4552
|
});
|
|
4245
4553
|
}
|
|
4246
|
-
}, __name(
|
|
4554
|
+
}, __name(_a8, "BrowserClipboardService"), _a8);
|
|
4247
4555
|
BrowserClipboardService = __decorateClass$a([
|
|
4248
4556
|
__decorateParam$a(0, Inject(LocaleService)),
|
|
4249
4557
|
__decorateParam$a(1, ILogService),
|
|
@@ -4300,8 +4608,8 @@ var __defProp$9 = Object.defineProperty, __getOwnPropDesc$9 = Object.getOwnPrope
|
|
|
4300
4608
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4301
4609
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
4302
4610
|
return kind && result && __defProp$9(target, key, result), result;
|
|
4303
|
-
}, "__decorateClass$9"), __decorateParam$9 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$9"),
|
|
4304
|
-
let DesktopConfirmService = (
|
|
4611
|
+
}, "__decorateClass$9"), __decorateParam$9 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$9"), _a9;
|
|
4612
|
+
let DesktopConfirmService = (_a9 = class extends Disposable {
|
|
4305
4613
|
constructor(_injector, _uiPartsService) {
|
|
4306
4614
|
super();
|
|
4307
4615
|
__publicField(this, "_confirmOptions", []);
|
|
@@ -4343,7 +4651,7 @@ let DesktopConfirmService = (_a8 = class extends Disposable {
|
|
|
4343
4651
|
this._uiPartsService.registerComponent(BuiltInUIPart.GLOBAL, () => connectInjector(ConfirmPart, this._injector))
|
|
4344
4652
|
);
|
|
4345
4653
|
}
|
|
4346
|
-
}, __name(
|
|
4654
|
+
}, __name(_a9, "DesktopConfirmService"), _a9);
|
|
4347
4655
|
DesktopConfirmService = __decorateClass$9([
|
|
4348
4656
|
__decorateParam$9(0, Inject(Injector)),
|
|
4349
4657
|
__decorateParam$9(1, IUIPartsService)
|
|
@@ -4372,8 +4680,8 @@ var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPrope
|
|
|
4372
4680
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4373
4681
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
4374
4682
|
return kind && result && __defProp$8(target, key, result), result;
|
|
4375
|
-
}, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$8"),
|
|
4376
|
-
let DesktopDialogService = (
|
|
4683
|
+
}, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$8"), _a10;
|
|
4684
|
+
let DesktopDialogService = (_a10 = class extends Disposable {
|
|
4377
4685
|
constructor(_injector, _uiPartsService) {
|
|
4378
4686
|
super();
|
|
4379
4687
|
__publicField(this, "_dialogOptions", []);
|
|
@@ -4415,7 +4723,7 @@ let DesktopDialogService = (_a9 = class extends Disposable {
|
|
|
4415
4723
|
this._uiPartsService.registerComponent(BuiltInUIPart.GLOBAL, () => connectInjector(DialogPart, this._injector))
|
|
4416
4724
|
);
|
|
4417
4725
|
}
|
|
4418
|
-
}, __name(
|
|
4726
|
+
}, __name(_a10, "DesktopDialogService"), _a10);
|
|
4419
4727
|
DesktopDialogService = __decorateClass$8([
|
|
4420
4728
|
__decorateParam$8(0, Inject(Injector)),
|
|
4421
4729
|
__decorateParam$8(1, IUIPartsService)
|
|
@@ -4427,8 +4735,8 @@ const _DesktopMessageService = class _DesktopMessageService {
|
|
|
4427
4735
|
__publicField(this, "_message");
|
|
4428
4736
|
}
|
|
4429
4737
|
dispose() {
|
|
4430
|
-
var
|
|
4431
|
-
(
|
|
4738
|
+
var _a19;
|
|
4739
|
+
(_a19 = this._message) == null || _a19.dispose();
|
|
4432
4740
|
}
|
|
4433
4741
|
setContainer(container) {
|
|
4434
4742
|
this._message || (this._portalContainer = container, this._message = new Message(container));
|
|
@@ -6225,7 +6533,7 @@ function Notification() {
|
|
|
6225
6533
|
}), observerRef = useRef(notificationObserver);
|
|
6226
6534
|
return useEffect(() => {
|
|
6227
6535
|
const subscription = observerRef.current.subscribe((options) => {
|
|
6228
|
-
var
|
|
6536
|
+
var _a19, _b2, _c;
|
|
6229
6537
|
api.open({
|
|
6230
6538
|
content: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6231
6539
|
PureContent,
|
|
@@ -6237,7 +6545,7 @@ function Notification() {
|
|
|
6237
6545
|
}
|
|
6238
6546
|
),
|
|
6239
6547
|
key: options.key,
|
|
6240
|
-
placement: (
|
|
6548
|
+
placement: (_a19 = options.placement) != null ? _a19 : "topRight",
|
|
6241
6549
|
duration: (_b2 = options.duration) != null ? _b2 : 4.5,
|
|
6242
6550
|
closable: (_c = options.closable) != null ? _c : !0
|
|
6243
6551
|
});
|
|
@@ -6257,8 +6565,8 @@ var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPrope
|
|
|
6257
6565
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6258
6566
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
6259
6567
|
return kind && result && __defProp$7(target, key, result), result;
|
|
6260
|
-
}, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"),
|
|
6261
|
-
let DesktopNotificationService = (
|
|
6568
|
+
}, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"), _a11;
|
|
6569
|
+
let DesktopNotificationService = (_a11 = class extends Disposable {
|
|
6262
6570
|
constructor(_injector, _uiPartsService) {
|
|
6263
6571
|
super(), this._injector = _injector, this._uiPartsService = _uiPartsService, this._initUIPart();
|
|
6264
6572
|
}
|
|
@@ -6269,7 +6577,7 @@ let DesktopNotificationService = (_a10 = class extends Disposable {
|
|
|
6269
6577
|
_initUIPart() {
|
|
6270
6578
|
this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.GLOBAL, () => connectInjector(Notification, this._injector)));
|
|
6271
6579
|
}
|
|
6272
|
-
}, __name(
|
|
6580
|
+
}, __name(_a11, "DesktopNotificationService"), _a11);
|
|
6273
6581
|
DesktopNotificationService = __decorateClass$7([
|
|
6274
6582
|
__decorateParam$7(0, Inject(Injector)),
|
|
6275
6583
|
__decorateParam$7(1, IUIPartsService)
|
|
@@ -6278,8 +6586,8 @@ var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPrope
|
|
|
6278
6586
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6279
6587
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
6280
6588
|
return kind && result && __defProp$6(target, key, result), result;
|
|
6281
|
-
}, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"),
|
|
6282
|
-
let DesktopGlobalZoneService = (
|
|
6589
|
+
}, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"), _a12;
|
|
6590
|
+
let DesktopGlobalZoneService = (_a12 = class {
|
|
6283
6591
|
constructor(_componentManager) {
|
|
6284
6592
|
__publicField(this, "visible$", new Subject());
|
|
6285
6593
|
__publicField(this, "componentKey$", new Subject());
|
|
@@ -6300,7 +6608,7 @@ let DesktopGlobalZoneService = (_a11 = class {
|
|
|
6300
6608
|
close() {
|
|
6301
6609
|
this.visible$.next(!1);
|
|
6302
6610
|
}
|
|
6303
|
-
}, __name(
|
|
6611
|
+
}, __name(_a12, "DesktopGlobalZoneService"), _a12);
|
|
6304
6612
|
DesktopGlobalZoneService = __decorateClass$6([
|
|
6305
6613
|
__decorateParam$6(0, Inject(ComponentManager))
|
|
6306
6614
|
], DesktopGlobalZoneService);
|
|
@@ -6338,8 +6646,8 @@ var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPrope
|
|
|
6338
6646
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6339
6647
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
6340
6648
|
return kind && result && __defProp$5(target, key, result), result;
|
|
6341
|
-
}, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"),
|
|
6342
|
-
let ErrorController = (
|
|
6649
|
+
}, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), _a13;
|
|
6650
|
+
let ErrorController = (_a13 = class extends Disposable {
|
|
6343
6651
|
constructor(_errorService, _messageService) {
|
|
6344
6652
|
super(), this._errorService = _errorService, this._messageService = _messageService, this.disposeWithMe(
|
|
6345
6653
|
toDisposable(
|
|
@@ -6352,44 +6660,13 @@ let ErrorController = (_a12 = class extends Disposable {
|
|
|
6352
6660
|
)
|
|
6353
6661
|
);
|
|
6354
6662
|
}
|
|
6355
|
-
}, __name(
|
|
6663
|
+
}, __name(_a13, "ErrorController"), _a13);
|
|
6356
6664
|
ErrorController = __decorateClass$5([
|
|
6357
6665
|
OnLifecycle(LifecycleStages.Starting, ErrorController),
|
|
6358
6666
|
__decorateParam$5(0, Inject(ErrorService)),
|
|
6359
6667
|
__decorateParam$5(1, IMessageService)
|
|
6360
6668
|
], ErrorController);
|
|
6361
|
-
const
|
|
6362
|
-
constructor() {
|
|
6363
|
-
super(...arguments);
|
|
6364
|
-
__publicField(this, "_open$", new BehaviorSubject(!1));
|
|
6365
|
-
__publicField(this, "open$", this._open$.pipe(distinctUntilChanged()));
|
|
6366
|
-
}
|
|
6367
|
-
get isOpen() {
|
|
6368
|
-
return this._open$.getValue();
|
|
6369
|
-
}
|
|
6370
|
-
dispose() {
|
|
6371
|
-
super.dispose(), this._open$.next(!1), this._open$.complete();
|
|
6372
|
-
}
|
|
6373
|
-
open() {
|
|
6374
|
-
this._open$.next(!0);
|
|
6375
|
-
}
|
|
6376
|
-
close() {
|
|
6377
|
-
this._open$.next(!1);
|
|
6378
|
-
}
|
|
6379
|
-
};
|
|
6380
|
-
__name(_ShortcutPanelService, "ShortcutPanelService");
|
|
6381
|
-
let ShortcutPanelService = _ShortcutPanelService;
|
|
6382
|
-
const ShortcutPanelComponentName = "ShortcutPanel", ToggleShortcutPanelOperation = {
|
|
6383
|
-
id: "base-ui.operation.toggle-shortcut-panel",
|
|
6384
|
-
type: CommandType.OPERATION,
|
|
6385
|
-
handler: /* @__PURE__ */ __name((accessor) => {
|
|
6386
|
-
const shortcutPanelService = accessor.get(ShortcutPanelService), sidebarService = accessor.get(ISidebarService);
|
|
6387
|
-
return shortcutPanelService.isOpen ? (shortcutPanelService.close(), sidebarService.close()) : (shortcutPanelService.open(), sidebarService.open({
|
|
6388
|
-
header: { title: "shortcut-panel.title" },
|
|
6389
|
-
children: { label: ShortcutPanelComponentName }
|
|
6390
|
-
})), !0;
|
|
6391
|
-
}, "handler")
|
|
6392
|
-
}, shortcutPanelGroupTitle = "univer-shortcut-panel-group-title", shortcutPanelItem = "univer-shortcut-panel-item", shortcutPanelItemTitle = "univer-shortcut-panel-item-title", shortcutPanelItemShortcut = "univer-shortcut-panel-item-shortcut", styles$5 = {
|
|
6669
|
+
const shortcutPanelGroupTitle = "univer-shortcut-panel-group-title", shortcutPanelItem = "univer-shortcut-panel-item", shortcutPanelItemTitle = "univer-shortcut-panel-item-title", shortcutPanelItemShortcut = "univer-shortcut-panel-item-shortcut", styles$5 = {
|
|
6393
6670
|
shortcutPanelGroupTitle,
|
|
6394
6671
|
shortcutPanelItem,
|
|
6395
6672
|
shortcutPanelItemTitle,
|
|
@@ -6397,11 +6674,11 @@ const ShortcutPanelComponentName = "ShortcutPanel", ToggleShortcutPanelOperation
|
|
|
6397
6674
|
};
|
|
6398
6675
|
function ShortcutPanel() {
|
|
6399
6676
|
const shortcutService = useDependency(IShortcutService), localeService = useDependency(LocaleService), currentLocale = useObservable$1(localeService.currentLocale$), [shortcutItems, setShortcutItems] = React__default.useState([]), updateShortcuts = useCallback(() => {
|
|
6400
|
-
var
|
|
6677
|
+
var _a19;
|
|
6401
6678
|
const shortcutGroups = /* @__PURE__ */ new Map(), shortcuts = shortcutService.getAllShortcuts().filter((item) => !!item.group);
|
|
6402
6679
|
for (const shortcut of shortcuts) {
|
|
6403
6680
|
const group = shortcut.group, shortcutItem = {
|
|
6404
|
-
title: localeService.t((
|
|
6681
|
+
title: localeService.t((_a19 = shortcut.description) != null ? _a19 : shortcut.id),
|
|
6405
6682
|
shortcut: shortcutService.getShortcutDisplay(shortcut)
|
|
6406
6683
|
};
|
|
6407
6684
|
if (!/\d+_[a-zA-Z0-9]/.test(group))
|
|
@@ -6431,19 +6708,6 @@ function ShortcutPanel() {
|
|
|
6431
6708
|
] }, group.name)) });
|
|
6432
6709
|
}
|
|
6433
6710
|
__name(ShortcutPanel, "ShortcutPanel");
|
|
6434
|
-
function ShortcutPanelMenuItemFactory(accessor) {
|
|
6435
|
-
return {
|
|
6436
|
-
id: ToggleShortcutPanelOperation.id,
|
|
6437
|
-
title: "toggle-shortcut-panel",
|
|
6438
|
-
tooltip: "toggle-shortcut-panel",
|
|
6439
|
-
icon: "KeyboardSingle",
|
|
6440
|
-
type: MenuItemType.BUTTON,
|
|
6441
|
-
positions: [MenuPosition.TOOLBAR_START],
|
|
6442
|
-
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET)
|
|
6443
|
-
// disabled$: getCurrentSheetDisabled$(accessor),
|
|
6444
|
-
};
|
|
6445
|
-
}
|
|
6446
|
-
__name(ShortcutPanelMenuItemFactory, "ShortcutPanelMenuItemFactory");
|
|
6447
6711
|
var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
6448
6712
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6449
6713
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
@@ -6455,21 +6719,19 @@ const ToggleShortcutPanelShortcut = {
|
|
|
6455
6719
|
description: "shortcut.shortcut-panel",
|
|
6456
6720
|
group: "10_global-shortcut"
|
|
6457
6721
|
};
|
|
6458
|
-
var
|
|
6459
|
-
let ShortcutPanelController = (
|
|
6460
|
-
constructor(
|
|
6461
|
-
super(), this.
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
}
|
|
6465
|
-
}, __name(_a13, "ShortcutPanelController"), _a13);
|
|
6722
|
+
var _a14;
|
|
6723
|
+
let ShortcutPanelController = (_a14 = class extends Disposable {
|
|
6724
|
+
constructor(injector, componentManager, shortcutService, _menuManagerService, commandService) {
|
|
6725
|
+
super(), this._menuManagerService = _menuManagerService, this.disposeWithMe(componentManager.register(ShortcutPanelComponentName, ShortcutPanel)), this.disposeWithMe(commandService.registerCommand(ToggleShortcutPanelOperation)), this.disposeWithMe(shortcutService.registerShortcut(ToggleShortcutPanelShortcut));
|
|
6726
|
+
}
|
|
6727
|
+
}, __name(_a14, "ShortcutPanelController"), _a14);
|
|
6466
6728
|
ShortcutPanelController = __decorateClass$4([
|
|
6467
6729
|
OnLifecycle(LifecycleStages.Steady, ShortcutPanelController),
|
|
6468
|
-
__decorateParam$4(
|
|
6469
|
-
__decorateParam$4(
|
|
6470
|
-
__decorateParam$4(
|
|
6471
|
-
__decorateParam$4(
|
|
6472
|
-
__decorateParam$4(
|
|
6730
|
+
__decorateParam$4(0, Inject(Injector)),
|
|
6731
|
+
__decorateParam$4(1, Inject(ComponentManager)),
|
|
6732
|
+
__decorateParam$4(2, IShortcutService),
|
|
6733
|
+
__decorateParam$4(3, IMenuManagerService),
|
|
6734
|
+
__decorateParam$4(4, ICommandService)
|
|
6473
6735
|
], ShortcutPanelController);
|
|
6474
6736
|
function commonjsRequire(path) {
|
|
6475
6737
|
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
@@ -8031,8 +8293,8 @@ var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPrope
|
|
|
8031
8293
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8032
8294
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
8033
8295
|
return kind && result && __defProp$3(target, key, result), result;
|
|
8034
|
-
}, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"),
|
|
8035
|
-
let DesktopZenZoneService = (
|
|
8296
|
+
}, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a15;
|
|
8297
|
+
let DesktopZenZoneService = (_a15 = class {
|
|
8036
8298
|
constructor(_componentManager) {
|
|
8037
8299
|
__publicField(this, "visible$", new Subject());
|
|
8038
8300
|
__publicField(this, "componentKey$", new Subject());
|
|
@@ -8053,7 +8315,7 @@ let DesktopZenZoneService = (_a14 = class {
|
|
|
8053
8315
|
close() {
|
|
8054
8316
|
this._visible = !1, this.visible$.next(!1);
|
|
8055
8317
|
}
|
|
8056
|
-
}, __name(
|
|
8318
|
+
}, __name(_a15, "DesktopZenZoneService"), _a15);
|
|
8057
8319
|
DesktopZenZoneService = __decorateClass$3([
|
|
8058
8320
|
__decorateParam$3(0, Inject(ComponentManager))
|
|
8059
8321
|
], DesktopZenZoneService);
|
|
@@ -8131,17 +8393,19 @@ __name(_ProgressService, "ProgressService");
|
|
|
8131
8393
|
let ProgressService = _ProgressService;
|
|
8132
8394
|
const IProgressService = createIdentifier(
|
|
8133
8395
|
"univer.progress.service"
|
|
8134
|
-
);
|
|
8396
|
+
), PLUGIN_CONFIG_KEY = "ui.config", defaultPluginConfig = {};
|
|
8135
8397
|
var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __defNormalProp$1 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp$1"), __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
8136
8398
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8137
8399
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
8138
8400
|
return kind && result && __defProp$2(target, key, result), result;
|
|
8139
8401
|
}, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), __publicField$1 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp$1(obj, key + "", value), "__publicField$1");
|
|
8140
8402
|
const UNIVER_UI_PLUGIN_NAME = "UNIVER_UI_PLUGIN", DISABLE_AUTO_FOCUS_KEY = "DISABLE_AUTO_FOCUS";
|
|
8141
|
-
var
|
|
8142
|
-
let UniverUIPlugin = (
|
|
8143
|
-
constructor(_config =
|
|
8144
|
-
super(), this._config = _config, this._contextService = _contextService, this._injector = _injector, this.
|
|
8403
|
+
var _a16;
|
|
8404
|
+
let UniverUIPlugin = (_a16 = class extends Plugin {
|
|
8405
|
+
constructor(_config = defaultPluginConfig, _contextService, _injector, _configService) {
|
|
8406
|
+
super(), this._config = _config, this._contextService = _contextService, this._injector = _injector, this._configService = _configService;
|
|
8407
|
+
const { menu, ...rest } = this._config;
|
|
8408
|
+
rest.disableAutoFocus && this._contextService.setContextValue(DISABLE_AUTO_FOCUS_KEY, !0), menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
|
|
8145
8409
|
}
|
|
8146
8410
|
onStarting() {
|
|
8147
8411
|
mergeOverrideWithDependencies([
|
|
@@ -8153,6 +8417,7 @@ let UniverUIPlugin = (_a15 = class extends Plugin {
|
|
|
8153
8417
|
[IShortcutService, { useClass: ShortcutService }],
|
|
8154
8418
|
[IPlatformService, { useClass: PlatformService }],
|
|
8155
8419
|
[IMenuService, { useClass: MenuService }],
|
|
8420
|
+
[IMenuManagerService, { useClass: MenuManagerService }],
|
|
8156
8421
|
[IContextMenuService, { useClass: ContextMenuService }],
|
|
8157
8422
|
[IClipboardInterfaceService, { useClass: BrowserClipboardService, lazy: !0 }],
|
|
8158
8423
|
[INotificationService, { useClass: DesktopNotificationService, lazy: !0 }],
|
|
@@ -8176,21 +8441,18 @@ let UniverUIPlugin = (_a15 = class extends Plugin {
|
|
|
8176
8441
|
deps: [Injector]
|
|
8177
8442
|
}
|
|
8178
8443
|
],
|
|
8179
|
-
[SharedController,
|
|
8180
|
-
useFactory: /* @__PURE__ */ __name(() => this._injector.createInstance(SharedController, this._config), "useFactory")
|
|
8181
|
-
}],
|
|
8444
|
+
[SharedController],
|
|
8182
8445
|
[ErrorController],
|
|
8183
|
-
[ShortcutPanelController
|
|
8184
|
-
useFactory: /* @__PURE__ */ __name(() => this._injector.createInstance(ShortcutPanelController, this._config), "useFactory")
|
|
8185
|
-
}]
|
|
8446
|
+
[ShortcutPanelController]
|
|
8186
8447
|
], this._config.override).forEach((dependency) => this._injector.add(dependency));
|
|
8187
8448
|
}
|
|
8188
|
-
}, __name(
|
|
8449
|
+
}, __name(_a16, "UniverUIPlugin"), _a16);
|
|
8189
8450
|
__publicField$1(UniverUIPlugin, "pluginName", UNIVER_UI_PLUGIN_NAME);
|
|
8190
8451
|
UniverUIPlugin = __decorateClass$2([
|
|
8191
8452
|
DependentOn(UniverRenderEnginePlugin),
|
|
8192
8453
|
__decorateParam$2(1, IContextService),
|
|
8193
|
-
__decorateParam$2(2, Inject(Injector))
|
|
8454
|
+
__decorateParam$2(2, Inject(Injector)),
|
|
8455
|
+
__decorateParam$2(3, IConfigService)
|
|
8194
8456
|
], UniverUIPlugin);
|
|
8195
8457
|
const appLayout = "univer-app-layout", appHeader = "univer-app-header", appContainer = "univer-app-container", appContainerHeader = "univer-app-container-header", appContainerWrapper = "univer-app-container-wrapper", appContainerContent = "univer-app-container-content", appContainerCanvas = "univer-app-container-canvas", appContainerLeftSidebar = "univer-app-container-left-sidebar", appContainerSidebar = "univer-app-container-sidebar", styles$4 = {
|
|
8196
8458
|
appLayout,
|
|
@@ -8207,10 +8469,16 @@ const appLayout = "univer-app-layout", appHeader = "univer-app-header", appConta
|
|
|
8207
8469
|
mobileMenuItem
|
|
8208
8470
|
};
|
|
8209
8471
|
function MobileMenu(props) {
|
|
8210
|
-
const { menuType, onOptionSelect } = props,
|
|
8472
|
+
const { menuType, onOptionSelect } = props, menuManagerService = useDependency(IMenuManagerService);
|
|
8211
8473
|
if (!menuType)
|
|
8212
8474
|
return null;
|
|
8213
|
-
const flattedMenuItems =
|
|
8475
|
+
const flattedMenuItems = useMemo(() => {
|
|
8476
|
+
const menuItems = menuManagerService.getMenuByPositionKey(menuType);
|
|
8477
|
+
function flatMenuItems(items) {
|
|
8478
|
+
return items.reduce((acc, item) => item.children ? [...acc, ...flatMenuItems(item.children)] : [...acc, item], []);
|
|
8479
|
+
}
|
|
8480
|
+
return __name(flatMenuItems, "flatMenuItems"), flatMenuItems(menuItems);
|
|
8481
|
+
}, [menuType]);
|
|
8214
8482
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8215
8483
|
"div",
|
|
8216
8484
|
{
|
|
@@ -8218,13 +8486,13 @@ function MobileMenu(props) {
|
|
|
8218
8486
|
style: {
|
|
8219
8487
|
gridTemplateColumns: `repeat(${Math.min(2, flattedMenuItems.length)}, 48px)`
|
|
8220
8488
|
},
|
|
8221
|
-
children: flattedMenuItems.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8489
|
+
children: flattedMenuItems.map((item) => item.item && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8222
8490
|
MobileMenuItem,
|
|
8223
8491
|
{
|
|
8224
|
-
menuItem: item,
|
|
8225
|
-
onClick: /* @__PURE__ */ __name((object) => onOptionSelect == null ? void 0 : onOptionSelect({ value: "", label: item.
|
|
8492
|
+
menuItem: item.item,
|
|
8493
|
+
onClick: /* @__PURE__ */ __name((object) => onOptionSelect == null ? void 0 : onOptionSelect({ value: "", label: item.key, ...object }), "onClick")
|
|
8226
8494
|
},
|
|
8227
|
-
item.
|
|
8495
|
+
item.key
|
|
8228
8496
|
))
|
|
8229
8497
|
}
|
|
8230
8498
|
);
|
|
@@ -8278,7 +8546,7 @@ function MobileContextMenu() {
|
|
|
8278
8546
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8279
8547
|
MobileMenu,
|
|
8280
8548
|
{
|
|
8281
|
-
menuType
|
|
8549
|
+
menuType,
|
|
8282
8550
|
onOptionSelect: /* @__PURE__ */ __name((params) => {
|
|
8283
8551
|
const { label: id, value, commandId } = params;
|
|
8284
8552
|
commandService && commandService.executeCommand(commandId != null ? commandId : id, { value }), setVisible(!1);
|
|
@@ -8353,10 +8621,13 @@ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPrope
|
|
|
8353
8621
|
return kind && result && __defProp$1(target, key, result), result;
|
|
8354
8622
|
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1");
|
|
8355
8623
|
const STEADY_TIMEOUT = 3e3;
|
|
8356
|
-
var
|
|
8357
|
-
let MobileUIController = (
|
|
8358
|
-
constructor(_config, _instanceService, _renderManagerService, _injector, _lifecycleService, _uiPartsService, _layoutService) {
|
|
8359
|
-
super(), this._config = _config, this._instanceService = _instanceService, this._renderManagerService = _renderManagerService, this._injector = _injector, this._lifecycleService = _lifecycleService, this._uiPartsService = _uiPartsService, this._layoutService = _layoutService, this._initBuiltinComponents(), Promise.resolve().then(() => this._bootstrapWorkbench());
|
|
8624
|
+
var _a17;
|
|
8625
|
+
let MobileUIController = (_a17 = class extends Disposable {
|
|
8626
|
+
constructor(_config, _instanceService, _renderManagerService, _injector, _lifecycleService, _uiPartsService, _menuManagerService, _layoutService) {
|
|
8627
|
+
super(), this._config = _config, this._instanceService = _instanceService, this._renderManagerService = _renderManagerService, this._injector = _injector, this._lifecycleService = _lifecycleService, this._uiPartsService = _uiPartsService, this._menuManagerService = _menuManagerService, this._layoutService = _layoutService, this._initBuiltinComponents(), Promise.resolve().then(() => this._bootstrapWorkbench());
|
|
8628
|
+
}
|
|
8629
|
+
_initMenus() {
|
|
8630
|
+
this._menuManagerService.mergeMenu(menuSchema);
|
|
8360
8631
|
}
|
|
8361
8632
|
_bootstrapWorkbench() {
|
|
8362
8633
|
this.disposeWithMe(
|
|
@@ -8368,8 +8639,8 @@ let MobileUIController = (_a16 = class extends Disposable {
|
|
|
8368
8639
|
render2.engine.setContainer(canvasElement);
|
|
8369
8640
|
}
|
|
8370
8641
|
}), setTimeout(() => {
|
|
8371
|
-
var
|
|
8372
|
-
const engine = (
|
|
8642
|
+
var _a19;
|
|
8643
|
+
const engine = (_a19 = this._renderManagerService.getFirst()) == null ? void 0 : _a19.engine;
|
|
8373
8644
|
engine == null || engine.setContainer(canvasElement), this._lifecycleService.stage = LifecycleStages.Rendered, setTimeout(() => this._lifecycleService.stage = LifecycleStages.Steady, STEADY_TIMEOUT);
|
|
8374
8645
|
}, 300);
|
|
8375
8646
|
})
|
|
@@ -8378,14 +8649,15 @@ let MobileUIController = (_a16 = class extends Disposable {
|
|
|
8378
8649
|
_initBuiltinComponents() {
|
|
8379
8650
|
this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.CONTENT, () => connectInjector(CanvasPopup, this._injector))), this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.CONTENT, () => connectInjector(FloatDom, this._injector)));
|
|
8380
8651
|
}
|
|
8381
|
-
}, __name(
|
|
8652
|
+
}, __name(_a17, "MobileUIController"), _a17);
|
|
8382
8653
|
MobileUIController = __decorateClass$1([
|
|
8383
8654
|
__decorateParam$1(1, IUniverInstanceService),
|
|
8384
8655
|
__decorateParam$1(2, IRenderManagerService),
|
|
8385
8656
|
__decorateParam$1(3, Inject(Injector)),
|
|
8386
8657
|
__decorateParam$1(4, Inject(LifecycleService)),
|
|
8387
8658
|
__decorateParam$1(5, IUIPartsService),
|
|
8388
|
-
__decorateParam$1(6,
|
|
8659
|
+
__decorateParam$1(6, IMenuManagerService),
|
|
8660
|
+
__decorateParam$1(7, Optional(ILayoutService))
|
|
8389
8661
|
], MobileUIController);
|
|
8390
8662
|
function bootstrap(injector, options, callback) {
|
|
8391
8663
|
let mountContainer;
|
|
@@ -8424,8 +8696,8 @@ var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnProperty
|
|
|
8424
8696
|
return kind && result && __defProp2(target, key, result), result;
|
|
8425
8697
|
}, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), __publicField2 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp2(obj, key + "", value), "__publicField");
|
|
8426
8698
|
const UNIVER_MOBILE_UI_PLUGIN_NAME = "UNIVER_MOBILE_UI_PLUGIN";
|
|
8427
|
-
var
|
|
8428
|
-
let UniverMobileUIPlugin = (
|
|
8699
|
+
var _a18;
|
|
8700
|
+
let UniverMobileUIPlugin = (_a18 = class extends Plugin {
|
|
8429
8701
|
constructor(_config, _injector) {
|
|
8430
8702
|
super(), this._config = _config, this._injector = _injector;
|
|
8431
8703
|
}
|
|
@@ -8440,6 +8712,7 @@ let UniverMobileUIPlugin = (_a17 = class extends Plugin {
|
|
|
8440
8712
|
[IShortcutService, { useClass: ShortcutService }],
|
|
8441
8713
|
[IPlatformService, { useClass: PlatformService }],
|
|
8442
8714
|
[IMenuService, { useClass: MenuService }],
|
|
8715
|
+
[IMenuManagerService, { useClass: MenuManagerService }],
|
|
8443
8716
|
[IContextMenuService, { useClass: ContextMenuService }],
|
|
8444
8717
|
[IClipboardInterfaceService, { useClass: BrowserClipboardService, lazy: !0 }],
|
|
8445
8718
|
[INotificationService, { useClass: DesktopNotificationService, lazy: !0 }],
|
|
@@ -8464,16 +8737,11 @@ let UniverMobileUIPlugin = (_a17 = class extends Plugin {
|
|
|
8464
8737
|
deps: [Injector]
|
|
8465
8738
|
}
|
|
8466
8739
|
],
|
|
8467
|
-
[
|
|
8468
|
-
SharedController,
|
|
8469
|
-
{
|
|
8470
|
-
useFactory: /* @__PURE__ */ __name(() => this._injector.createInstance(SharedController, this._config), "useFactory")
|
|
8471
|
-
}
|
|
8472
|
-
],
|
|
8740
|
+
[SharedController],
|
|
8473
8741
|
[ErrorController]
|
|
8474
8742
|
], this._config.override).forEach((dependency) => this._injector.add(dependency));
|
|
8475
8743
|
}
|
|
8476
|
-
}, __name(
|
|
8744
|
+
}, __name(_a18, "UniverMobileUIPlugin"), _a18);
|
|
8477
8745
|
__publicField2(UniverMobileUIPlugin, "pluginName", UNIVER_MOBILE_UI_PLUGIN_NAME);
|
|
8478
8746
|
UniverMobileUIPlugin = __decorateClass([
|
|
8479
8747
|
DependentOn(UniverRenderEnginePlugin),
|
|
@@ -8494,7 +8762,7 @@ function isElementVisible(element2) {
|
|
|
8494
8762
|
__name(isElementVisible, "isElementVisible");
|
|
8495
8763
|
const PX_TO_PT_RATIO = 0.75, MAX_FONT_SIZE = 78, MIN_FONT_SIZE = 9, DEFAULT_BACKGROUND_COLOR_RGBA = "rgba(0,0,0,0)", DEFAULT_BACKGROUND_COLOR_RGB = "rgb(0,0,0)";
|
|
8496
8764
|
function handleDomToJson($dom) {
|
|
8497
|
-
var
|
|
8765
|
+
var _a19;
|
|
8498
8766
|
let nodeList = $dom.childNodes;
|
|
8499
8767
|
if (nodeList.length === 0)
|
|
8500
8768
|
return $dom.textContent;
|
|
@@ -8506,7 +8774,7 @@ function handleDomToJson($dom) {
|
|
|
8506
8774
|
`;
|
|
8507
8775
|
for (let i = 0; i < nodeList.length; i++) {
|
|
8508
8776
|
let span = nodeList[`${i}`], str;
|
|
8509
|
-
span.nodeName === "#text" ? (str = (
|
|
8777
|
+
span.nodeName === "#text" ? (str = (_a19 = span.textContent) != null ? _a19 : "", span = span.parentElement) : str = span.innerText;
|
|
8510
8778
|
const textStyle = handleStringToStyle(span);
|
|
8511
8779
|
splitSpanText(str).forEach((item) => {
|
|
8512
8780
|
const length = item.length;
|
|
@@ -8531,8 +8799,8 @@ function handleDomToJson($dom) {
|
|
|
8531
8799
|
}
|
|
8532
8800
|
__name(handleDomToJson, "handleDomToJson");
|
|
8533
8801
|
function handleStringToStyle($dom, cssStyle = "") {
|
|
8534
|
-
var
|
|
8535
|
-
let cssText = (_b2 = (
|
|
8802
|
+
var _a19, _b2;
|
|
8803
|
+
let cssText = (_b2 = (_a19 = $dom == null ? void 0 : $dom.style) == null ? void 0 : _a19.cssText) != null ? _b2 : "";
|
|
8536
8804
|
if (cssText += cssStyle, cssText = cssText.replace(/[\r\n]+/g, ""), cssText.length === 0)
|
|
8537
8805
|
return {};
|
|
8538
8806
|
const cssTextArray = cssText.split(";"), styleList = {}, borderInfo = {
|
|
@@ -8542,7 +8810,7 @@ function handleStringToStyle($dom, cssStyle = "") {
|
|
|
8542
8810
|
l: ""
|
|
8543
8811
|
};
|
|
8544
8812
|
return cssTextArray.forEach((originStr) => {
|
|
8545
|
-
var
|
|
8813
|
+
var _a20;
|
|
8546
8814
|
const s = originStr.toLowerCase(), key = textTrim(s.substr(0, s.indexOf(":"))), value = textTrim(s.substr(s.indexOf(":") + 1));
|
|
8547
8815
|
if (key === "font-weight")
|
|
8548
8816
|
value === "bold" || value === "700" ? styleList.bl = 1 : styleList.bl = 0;
|
|
@@ -8580,7 +8848,7 @@ function handleStringToStyle($dom, cssStyle = "") {
|
|
|
8580
8848
|
else if (key === "text-decoration-style")
|
|
8581
8849
|
styleList.hasOwnProperty("ul") && (styleList.ul || (styleList.ul = { s: 1, t: Number(value) }), styleList.ul.t = Number(value)), styleList.hasOwnProperty("st") && (styleList.st || (styleList.st = { s: 1, t: Number(value) }), styleList.st.t = Number(value)), styleList.hasOwnProperty("ol") && (styleList.ol || (styleList.ol = { s: 1, t: Number(value) }), styleList.ol.t = Number(value));
|
|
8582
8850
|
else if (key === "text-decoration" || key === "univer-strike") {
|
|
8583
|
-
const lineValue = (
|
|
8851
|
+
const lineValue = (_a20 = value.split(" ")) == null ? void 0 : _a20[0];
|
|
8584
8852
|
lineValue === "underline" ? (styleList.ul || (styleList.ul = { s: 1 }), styleList.ul.s = 1) : lineValue === "line-through" ? (styleList.st || (styleList.st = { s: 1 }), styleList.st.s = 1) : lineValue === "overline" && (styleList.ol || (styleList.ol = { s: 1 }), styleList.ol.s = 1);
|
|
8585
8853
|
}
|
|
8586
8854
|
if (key === "univer-underline" && (styleList.ul = {
|
|
@@ -8788,7 +9056,7 @@ function handelTableToJson(table) {
|
|
|
8788
9056
|
return trs.forEach((item) => {
|
|
8789
9057
|
let c2 = 0;
|
|
8790
9058
|
item.querySelectorAll("td").forEach((td) => {
|
|
8791
|
-
var
|
|
9059
|
+
var _a19, _b2;
|
|
8792
9060
|
const cell = {};
|
|
8793
9061
|
if (td.querySelectorAll("span").length || td.querySelectorAll("font").length) {
|
|
8794
9062
|
const spanStyle = handleDomToJson(td);
|
|
@@ -8802,7 +9070,7 @@ function handelTableToJson(table) {
|
|
|
8802
9070
|
if (c2 !== colLen) {
|
|
8803
9071
|
if (data[r][c2] == null) {
|
|
8804
9072
|
data[r][c2] = cell;
|
|
8805
|
-
const rowSpan = (
|
|
9073
|
+
const rowSpan = (_a19 = Number(td.getAttribute("rowSpan"))) != null ? _a19 : 1, colSpan = (_b2 = Number(td.getAttribute("colSpan"))) != null ? _b2 : 1;
|
|
8806
9074
|
if (rowSpan > 1 || colSpan > 1) {
|
|
8807
9075
|
const first = { rs: +rowSpan - 1, cs: +colSpan - 1, r, c: c2 };
|
|
8808
9076
|
data[r][c2].mc = first;
|
|
@@ -8853,11 +9121,11 @@ function handleTableMergeData(data, selection) {
|
|
|
8853
9121
|
}
|
|
8854
9122
|
__name(handleTableMergeData, "handleTableMergeData");
|
|
8855
9123
|
function handelExcelToJson(html) {
|
|
8856
|
-
var
|
|
9124
|
+
var _a19;
|
|
8857
9125
|
let data = [];
|
|
8858
9126
|
const content = document.createElement("html");
|
|
8859
9127
|
content.innerHTML = html;
|
|
8860
|
-
const styleText = (
|
|
9128
|
+
const styleText = (_a19 = content.querySelector("style")) == null ? void 0 : _a19.innerText;
|
|
8861
9129
|
if (!styleText) return;
|
|
8862
9130
|
const excelStyle = getStyles(styleText);
|
|
8863
9131
|
if (data = new Array(content.querySelectorAll("table tr").length), !data.length) return [];
|
|
@@ -8874,7 +9142,7 @@ function handelExcelToJson(html) {
|
|
|
8874
9142
|
return trs.forEach((item) => {
|
|
8875
9143
|
let c2 = 0;
|
|
8876
9144
|
item.querySelectorAll("td").forEach((td) => {
|
|
8877
|
-
var
|
|
9145
|
+
var _a20, _b2;
|
|
8878
9146
|
const cell = {};
|
|
8879
9147
|
if (td.querySelectorAll("span").length || td.querySelectorAll("font").length) {
|
|
8880
9148
|
const spanStyle = handleDomToJson(td);
|
|
@@ -8891,7 +9159,7 @@ function handelExcelToJson(html) {
|
|
|
8891
9159
|
if (c2 !== colLen) {
|
|
8892
9160
|
if (data[r][c2] == null) {
|
|
8893
9161
|
data[r][c2] = cell;
|
|
8894
|
-
const rowSpan = (
|
|
9162
|
+
const rowSpan = (_a20 = Number(td.getAttribute("rowSpan"))) != null ? _a20 : 1, colSpan = (_b2 = Number(td.getAttribute("colSpan"))) != null ? _b2 : 1;
|
|
8895
9163
|
if (rowSpan > 1 || colSpan > 1) {
|
|
8896
9164
|
const first = { rs: +rowSpan - 1, cs: +colSpan - 1, r, c: c2 };
|
|
8897
9165
|
data[r][c2].mc = first;
|
|
@@ -9171,8 +9439,8 @@ function RangeSelector(props) {
|
|
|
9171
9439
|
}
|
|
9172
9440
|
__name(handleAddRange, "handleAddRange");
|
|
9173
9441
|
function getSheetIdByName(name) {
|
|
9174
|
-
var
|
|
9175
|
-
return ((_b2 = (
|
|
9442
|
+
var _a19, _b2;
|
|
9443
|
+
return ((_b2 = (_a19 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _a19.getSheetBySheetName(name)) == null ? void 0 : _b2.getSheetId()) || "";
|
|
9176
9444
|
}
|
|
9177
9445
|
__name(getSheetIdByName, "getSheetIdByName");
|
|
9178
9446
|
function handleTextValueChange(value2) {
|
|
@@ -9283,6 +9551,8 @@ export {
|
|
|
9283
9551
|
ComponentContainer,
|
|
9284
9552
|
ComponentManager,
|
|
9285
9553
|
DesktopContextMenu as ContextMenu,
|
|
9554
|
+
ContextMenuGroup,
|
|
9555
|
+
ContextMenuPosition,
|
|
9286
9556
|
ContextMenuService,
|
|
9287
9557
|
CopyCommand,
|
|
9288
9558
|
CopyShortcutItem,
|
|
@@ -9324,6 +9594,7 @@ export {
|
|
|
9324
9594
|
IGlobalZoneService,
|
|
9325
9595
|
ILayoutService,
|
|
9326
9596
|
ILeftSidebarService,
|
|
9597
|
+
IMenuManagerService,
|
|
9327
9598
|
IMenuService,
|
|
9328
9599
|
IMessageService,
|
|
9329
9600
|
INotificationService,
|
|
@@ -9339,6 +9610,8 @@ export {
|
|
|
9339
9610
|
Menu,
|
|
9340
9611
|
MenuGroup,
|
|
9341
9612
|
MenuItemType,
|
|
9613
|
+
MenuManagerPosition,
|
|
9614
|
+
MenuManagerService,
|
|
9342
9615
|
MenuPosition,
|
|
9343
9616
|
MenuService,
|
|
9344
9617
|
MetaKeys,
|
|
@@ -9351,6 +9624,14 @@ export {
|
|
|
9351
9624
|
RangeSelector,
|
|
9352
9625
|
RangeSelectorService,
|
|
9353
9626
|
RedoShortcutItem,
|
|
9627
|
+
Ribbon,
|
|
9628
|
+
RibbonDataGroup,
|
|
9629
|
+
RibbonFormulasGroup,
|
|
9630
|
+
RibbonInsertGroup,
|
|
9631
|
+
RibbonOthersGroup,
|
|
9632
|
+
RibbonPosition,
|
|
9633
|
+
RibbonStartGroup,
|
|
9634
|
+
RibbonViewGroup,
|
|
9354
9635
|
SetEditorResizeOperation,
|
|
9355
9636
|
SharedController,
|
|
9356
9637
|
ShortcutPanelController,
|
|
@@ -9359,11 +9640,9 @@ export {
|
|
|
9359
9640
|
Sidebar,
|
|
9360
9641
|
TextEditor,
|
|
9361
9642
|
ToggleShortcutPanelOperation,
|
|
9362
|
-
Toolbar,
|
|
9363
9643
|
ToolbarButton,
|
|
9364
9644
|
ToolbarItem,
|
|
9365
9645
|
UIPartsService,
|
|
9366
|
-
UI_CONFIG_KEY,
|
|
9367
9646
|
UNIVER_UI_PLUGIN_NAME,
|
|
9368
9647
|
UNI_DISABLE_CHANGING_FOCUS_KEY,
|
|
9369
9648
|
UndoShortcutItem,
|
|
@@ -9384,6 +9663,7 @@ export {
|
|
|
9384
9663
|
handleTableMergeData,
|
|
9385
9664
|
handleTableRowGroup,
|
|
9386
9665
|
isElementVisible,
|
|
9666
|
+
menuSchema,
|
|
9387
9667
|
mergeMenuConfigs,
|
|
9388
9668
|
splitSpanText,
|
|
9389
9669
|
t$1 as t,
|
|
@@ -9393,7 +9673,6 @@ export {
|
|
|
9393
9673
|
useObservable,
|
|
9394
9674
|
useScrollYOverContainer,
|
|
9395
9675
|
useSimpleToolbarGroups,
|
|
9396
|
-
useToolbarCollapseObserver,
|
|
9397
9676
|
useToolbarGroups,
|
|
9398
9677
|
useToolbarItemStatus,
|
|
9399
9678
|
useVirtualList
|