@univerjs/ui 0.21.1 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -10,7 +10,7 @@ import { map as map$1, scan as scan$1, startWith as startWith$1 } from "rxjs/ope
10
10
  import { createPortal } from "react-dom";
11
11
  import localforage from "localforage";
12
12
 
13
- //#region \0@oxc-project+runtime@0.124.0/helpers/typeof.js
13
+ //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
14
14
  function _typeof(o) {
15
15
  "@babel/helpers - typeof";
16
16
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -21,7 +21,7 @@ function _typeof(o) {
21
21
  }
22
22
 
23
23
  //#endregion
24
- //#region \0@oxc-project+runtime@0.124.0/helpers/toPrimitive.js
24
+ //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
25
25
  function toPrimitive(t, r) {
26
26
  if ("object" != _typeof(t) || !t) return t;
27
27
  var e = t[Symbol.toPrimitive];
@@ -34,14 +34,14 @@ function toPrimitive(t, r) {
34
34
  }
35
35
 
36
36
  //#endregion
37
- //#region \0@oxc-project+runtime@0.124.0/helpers/toPropertyKey.js
37
+ //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
38
38
  function toPropertyKey(t) {
39
39
  var i = toPrimitive(t, "string");
40
40
  return "symbol" == _typeof(i) ? i : i + "";
41
41
  }
42
42
 
43
43
  //#endregion
44
- //#region \0@oxc-project+runtime@0.124.0/helpers/defineProperty.js
44
+ //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
45
45
  function _defineProperty(e, r, t) {
46
46
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
47
47
  value: t,
@@ -765,7 +765,7 @@ const configSymbol = Symbol(UI_PLUGIN_CONFIG_KEY);
765
765
  const defaultPluginConfig = {};
766
766
 
767
767
  //#endregion
768
- //#region \0@oxc-project+runtime@0.124.0/helpers/decorateParam.js
768
+ //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
769
769
  function __decorateParam(paramIndex, decorator) {
770
770
  return function(target, key) {
771
771
  decorator(target, key, paramIndex);
@@ -773,7 +773,7 @@ function __decorateParam(paramIndex, decorator) {
773
773
  }
774
774
 
775
775
  //#endregion
776
- //#region \0@oxc-project+runtime@0.124.0/helpers/decorate.js
776
+ //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
777
777
  function __decorate(decorators, target, key, desc) {
778
778
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
779
779
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -1735,69 +1735,69 @@ let KeyCode = /* @__PURE__ */ function(KeyCode) {
1735
1735
  return KeyCode;
1736
1736
  }({});
1737
1737
  const KeyCodeToChar = {
1738
- [KeyCode.BACKSPACE]: "Backspace",
1739
- [KeyCode.TAB]: "Tab",
1740
- [KeyCode.ENTER]: "Enter",
1741
- [KeyCode.DELETE]: "Del",
1742
- [KeyCode.ESC]: "Esc",
1743
- [KeyCode.SPACE]: "Space",
1744
- [KeyCode.ARROW_LEFT]: "←",
1745
- [KeyCode.ARROW_RIGHT]: "→",
1746
- [KeyCode.ARROW_UP]: "↑",
1747
- [KeyCode.ARROW_DOWN]: "↓",
1748
- [KeyCode.Digit0]: "0",
1749
- [KeyCode.Digit1]: "1",
1750
- [KeyCode.Digit2]: "2",
1751
- [KeyCode.Digit3]: "3",
1752
- [KeyCode.Digit4]: "4",
1753
- [KeyCode.Digit5]: "5",
1754
- [KeyCode.Digit6]: "6",
1755
- [KeyCode.Digit7]: "7",
1756
- [KeyCode.Digit8]: "8",
1757
- [KeyCode.Digit9]: "9",
1758
- [KeyCode.A]: "A",
1759
- [KeyCode.B]: "B",
1760
- [KeyCode.C]: "C",
1761
- [KeyCode.D]: "D",
1762
- [KeyCode.E]: "E",
1763
- [KeyCode.F]: "F",
1764
- [KeyCode.G]: "G",
1765
- [KeyCode.H]: "H",
1766
- [KeyCode.I]: "I",
1767
- [KeyCode.J]: "J",
1768
- [KeyCode.K]: "K",
1769
- [KeyCode.L]: "L",
1770
- [KeyCode.M]: "M",
1771
- [KeyCode.N]: "N",
1772
- [KeyCode.O]: "O",
1773
- [KeyCode.P]: "P",
1774
- [KeyCode.Q]: "Q",
1775
- [KeyCode.R]: "R",
1776
- [KeyCode.S]: "S",
1777
- [KeyCode.T]: "T",
1778
- [KeyCode.U]: "U",
1779
- [KeyCode.V]: "V",
1780
- [KeyCode.W]: "W",
1781
- [KeyCode.X]: "X",
1782
- [KeyCode.Y]: "Y",
1783
- [KeyCode.Z]: "Z",
1784
- [KeyCode.F1]: "F1",
1785
- [KeyCode.F2]: "F2",
1786
- [KeyCode.F3]: "F3",
1787
- [KeyCode.F4]: "F4",
1788
- [KeyCode.F5]: "F5",
1789
- [KeyCode.F6]: "F6",
1790
- [KeyCode.F7]: "F7",
1791
- [KeyCode.F8]: "F8",
1792
- [KeyCode.F9]: "F9",
1793
- [KeyCode.F10]: "F10",
1794
- [KeyCode.F11]: "F11",
1795
- [KeyCode.F12]: "F12",
1796
- [KeyCode.MINUS]: "-",
1797
- [KeyCode.EQUAL]: "=",
1798
- [KeyCode.PERIOD]: ".",
1799
- [KeyCode.COMMA]: ",",
1800
- [KeyCode.BACK_SLASH]: "\\"
1738
+ [8]: "Backspace",
1739
+ [9]: "Tab",
1740
+ [13]: "Enter",
1741
+ [46]: "Del",
1742
+ [27]: "Esc",
1743
+ [32]: "Space",
1744
+ [37]: "←",
1745
+ [39]: "→",
1746
+ [38]: "↑",
1747
+ [40]: "↓",
1748
+ [48]: "0",
1749
+ [49]: "1",
1750
+ [50]: "2",
1751
+ [51]: "3",
1752
+ [52]: "4",
1753
+ [53]: "5",
1754
+ [54]: "6",
1755
+ [55]: "7",
1756
+ [56]: "8",
1757
+ [57]: "9",
1758
+ [65]: "A",
1759
+ [66]: "B",
1760
+ [67]: "C",
1761
+ [68]: "D",
1762
+ [69]: "E",
1763
+ [70]: "F",
1764
+ [71]: "G",
1765
+ [72]: "H",
1766
+ [73]: "I",
1767
+ [74]: "J",
1768
+ [75]: "K",
1769
+ [76]: "L",
1770
+ [77]: "M",
1771
+ [78]: "N",
1772
+ [79]: "O",
1773
+ [80]: "P",
1774
+ [81]: "Q",
1775
+ [82]: "R",
1776
+ [83]: "S",
1777
+ [84]: "T",
1778
+ [85]: "U",
1779
+ [86]: "V",
1780
+ [87]: "W",
1781
+ [88]: "X",
1782
+ [89]: "Y",
1783
+ [90]: "Z",
1784
+ [112]: "F1",
1785
+ [113]: "F2",
1786
+ [114]: "F3",
1787
+ [115]: "F4",
1788
+ [116]: "F5",
1789
+ [117]: "F6",
1790
+ [118]: "F7",
1791
+ [119]: "F8",
1792
+ [120]: "F9",
1793
+ [121]: "F10",
1794
+ [122]: "F11",
1795
+ [123]: "F12",
1796
+ [189]: "-",
1797
+ [187]: "=",
1798
+ [190]: ".",
1799
+ [188]: ",",
1800
+ [220]: "\\"
1801
1801
  };
1802
1802
  /** Define meta key numbers. */
1803
1803
  let MetaKeys = /* @__PURE__ */ function(MetaKeys) {
@@ -1905,10 +1905,10 @@ let ShortcutService = class ShortcutService extends Disposable {
1905
1905
  var _KeyCodeToChar;
1906
1906
  const binding = this._getBindingFromItem(shortcut);
1907
1907
  if (!binding) return null;
1908
- const ctrlKey = binding & MetaKeys.CTRL_COMMAND;
1909
- const shiftKey = binding & MetaKeys.SHIFT;
1910
- const altKey = binding & MetaKeys.ALT;
1911
- const macCtrl = binding & MetaKeys.MAC_CTRL;
1908
+ const ctrlKey = binding & 4096;
1909
+ const shiftKey = binding & 1024;
1910
+ const altKey = binding & 2048;
1911
+ const macCtrl = binding & 8192;
1912
1912
  const body = (_KeyCodeToChar = KeyCodeToChar[binding & 255]) !== null && _KeyCodeToChar !== void 0 ? _KeyCodeToChar : "<->";
1913
1913
  if (this._platformService.isMac) return `${ctrlKey ? "⌘+" : ""}${shiftKey ? "⇧+" : ""}${altKey ? "⌥+" : ""}${macCtrl ? "⌃+" : ""}${body}`;
1914
1914
  return `${ctrlKey ? "Ctrl+" : ""}${shiftKey ? "Shift+" : ""}${altKey ? "Alt+" : ""}${body}`;
@@ -1957,10 +1957,10 @@ let ShortcutService = class ShortcutService extends Disposable {
1957
1957
  _deriveBindingFromEvent(e) {
1958
1958
  const { shiftKey, metaKey, altKey, keyCode } = e;
1959
1959
  let binding = keyCode;
1960
- if (shiftKey) binding |= MetaKeys.SHIFT;
1961
- if (altKey) binding |= MetaKeys.ALT;
1962
- if (this._platformService.isMac ? metaKey : e.ctrlKey) binding |= MetaKeys.CTRL_COMMAND;
1963
- if (this._platformService.isMac && e.ctrlKey) binding |= MetaKeys.MAC_CTRL;
1960
+ if (shiftKey) binding |= 1024;
1961
+ if (altKey) binding |= 2048;
1962
+ if (this._platformService.isMac ? metaKey : e.ctrlKey) binding |= 4096;
1963
+ if (this._platformService.isMac && e.ctrlKey) binding |= 8192;
1964
1964
  return binding;
1965
1965
  }
1966
1966
  };
@@ -1983,14 +1983,14 @@ const CopyShortcutItem = {
1983
1983
  id: CopyCommand.id,
1984
1984
  description: "shortcut.copy",
1985
1985
  group: "1_common-edit",
1986
- binding: KeyCode.C | MetaKeys.CTRL_COMMAND,
1986
+ binding: 67 | 4096,
1987
1987
  preconditions: whenEditorFocused
1988
1988
  };
1989
1989
  const CutShortcutItem = {
1990
1990
  id: CutCommand.id,
1991
1991
  description: "shortcut.cut",
1992
1992
  group: "1_common-edit",
1993
- binding: KeyCode.X | MetaKeys.CTRL_COMMAND,
1993
+ binding: 88 | 4096,
1994
1994
  preconditions: whenEditorFocused
1995
1995
  };
1996
1996
  /**
@@ -2000,21 +2000,21 @@ const OnlyDisplayPasteShortcutItem = {
2000
2000
  id: PasteCommand.id,
2001
2001
  description: "shortcut.paste",
2002
2002
  group: "1_common-edit",
2003
- binding: KeyCode.V | MetaKeys.CTRL_COMMAND,
2003
+ binding: 86 | 4096,
2004
2004
  preconditions: () => false
2005
2005
  };
2006
2006
  const UndoShortcutItem = {
2007
2007
  id: UndoCommand.id,
2008
2008
  description: "shortcut.undo",
2009
2009
  group: "1_common-edit",
2010
- binding: KeyCode.Z | MetaKeys.CTRL_COMMAND,
2010
+ binding: 90 | 4096,
2011
2011
  preconditions: whenEditorFocusedButNotCellEditor
2012
2012
  };
2013
2013
  const RedoShortcutItem = {
2014
2014
  id: RedoCommand.id,
2015
2015
  description: "shortcut.redo",
2016
2016
  group: "1_common-edit",
2017
- binding: KeyCode.Y | MetaKeys.CTRL_COMMAND,
2017
+ binding: 89 | 4096,
2018
2018
  preconditions: whenEditorFocusedButNotCellEditor
2019
2019
  };
2020
2020
  let SharedController = class SharedController extends Disposable {
@@ -2147,102 +2147,102 @@ let MenuManagerService = class MenuManagerService extends Disposable {
2147
2147
  this._configService = _configService;
2148
2148
  _defineProperty(this, "menuChanged$", new Subject());
2149
2149
  _defineProperty(this, "_menu", {
2150
- [MenuManagerPosition.RIBBON]: {
2151
- [RibbonPosition.START]: {
2150
+ ["ribbon"]: {
2151
+ ["ribbon.start"]: {
2152
2152
  order: 0,
2153
- [RibbonStartGroup.HISTORY]: { order: 0 },
2154
- [RibbonStartGroup.FORMAT]: { order: 1 },
2155
- [RibbonStartGroup.LAYOUT]: { order: 2 },
2156
- [RibbonStartGroup.OTHERS]: { order: 3 }
2153
+ ["ribbon.start.history"]: { order: 0 },
2154
+ ["ribbon.start.format"]: { order: 1 },
2155
+ ["ribbon.start.layout"]: { order: 2 },
2156
+ ["ribbon.start.others"]: { order: 3 }
2157
2157
  },
2158
- [RibbonPosition.INSERT]: {
2158
+ ["ribbon.insert"]: {
2159
2159
  order: 1,
2160
- [RibbonInsertGroup.EDIT]: { order: 0 },
2161
- [RibbonInsertGroup.MEDIA]: { order: 1 },
2162
- [RibbonInsertGroup.OTHERS]: { order: 2 }
2160
+ ["ribbon.insert.edit"]: { order: 0 },
2161
+ ["ribbon.insert.media"]: { order: 1 },
2162
+ ["ribbon.insert.others"]: { order: 2 }
2163
2163
  },
2164
- [RibbonPosition.FORMULAS]: {
2164
+ ["ribbon.formulas"]: {
2165
2165
  order: 2,
2166
- [RibbonFormulasGroup.BASIC]: { order: 0 },
2167
- [RibbonFormulasGroup.OTHERS]: { order: 1 }
2166
+ ["ribbon.formulas.basic"]: { order: 0 },
2167
+ ["ribbon.formulas.others"]: { order: 1 }
2168
2168
  },
2169
- [RibbonPosition.DATA]: {
2169
+ ["ribbon.data"]: {
2170
2170
  order: 3,
2171
- [RibbonDataGroup.FORMULAS]: { order: 0 },
2172
- [RibbonDataGroup.RULES]: { order: 1 },
2173
- [RibbonDataGroup.ORGANIZATION]: { order: 2 },
2174
- [RibbonDataGroup.OTHERS]: { order: 3 }
2171
+ ["ribbon.data.formulas"]: { order: 0 },
2172
+ ["ribbon.data.rules"]: { order: 1 },
2173
+ ["ribbon.data.organization"]: { order: 2 },
2174
+ ["ribbon.data.others"]: { order: 3 }
2175
2175
  },
2176
- [RibbonPosition.VIEW]: {
2176
+ ["ribbon.view"]: {
2177
2177
  order: 4,
2178
- [RibbonViewGroup.DISPLAY]: { order: 0 },
2179
- [RibbonViewGroup.VISIBILITY]: { order: 0 },
2180
- [RibbonViewGroup.OTHERS]: { order: 0 }
2178
+ ["ribbon.view.display"]: { order: 0 },
2179
+ ["ribbon.view.Visibility"]: { order: 0 },
2180
+ ["ribbon.view.others"]: { order: 0 }
2181
2181
  },
2182
- [RibbonPosition.OTHERS]: {
2182
+ ["ribbon.others"]: {
2183
2183
  order: 5,
2184
- [RibbonOthersGroup.OTHERS]: { order: 0 }
2184
+ ["ribbon.others.others"]: { order: 0 }
2185
2185
  }
2186
2186
  },
2187
- [MenuManagerPosition.CONTEXT_MENU]: {
2188
- [ContextMenuPosition.MAIN_AREA]: {
2187
+ ["contextMenu"]: {
2188
+ ["contextMenu.mainArea"]: {
2189
2189
  order: 0,
2190
- [ContextMenuGroup.QUICK]: {
2190
+ ["contextMenu.quick"]: {
2191
2191
  order: -1,
2192
2192
  quickLayout: "icon"
2193
2193
  },
2194
- [ContextMenuGroup.FORMAT]: { order: 0 },
2195
- [ContextMenuGroup.LAYOUT]: { order: 1 },
2196
- [ContextMenuGroup.DATA]: { order: 2 },
2197
- [ContextMenuGroup.OTHERS]: { order: 3 }
2194
+ ["contextMenu.format"]: { order: 0 },
2195
+ ["contextMenu.layout"]: { order: 1 },
2196
+ ["contextMenu.data"]: { order: 2 },
2197
+ ["contextMenu.others"]: { order: 3 }
2198
2198
  },
2199
- [ContextMenuPosition.PARAGRAPH]: {
2199
+ ["contextMenu.paragraph"]: {
2200
2200
  order: 0,
2201
- [ContextMenuGroup.QUICK]: {
2201
+ ["contextMenu.quick"]: {
2202
2202
  order: -1,
2203
2203
  quickLayout: "icon"
2204
2204
  },
2205
- [ContextMenuGroup.FORMAT]: { order: 0 },
2206
- [ContextMenuGroup.LAYOUT]: { order: 1 },
2207
- [ContextMenuGroup.DATA]: { order: 2 },
2208
- [ContextMenuGroup.OTHERS]: { order: 3 }
2205
+ ["contextMenu.format"]: { order: 0 },
2206
+ ["contextMenu.layout"]: { order: 1 },
2207
+ ["contextMenu.data"]: { order: 2 },
2208
+ ["contextMenu.others"]: { order: 3 }
2209
2209
  },
2210
- [ContextMenuPosition.COL_HEADER]: {
2210
+ ["contextMenu.colHeader"]: {
2211
2211
  order: 1,
2212
- [ContextMenuGroup.QUICK]: {
2212
+ ["contextMenu.quick"]: {
2213
2213
  order: -1,
2214
2214
  quickLayout: "icon"
2215
2215
  },
2216
- [ContextMenuGroup.FORMAT]: { order: 0 },
2217
- [ContextMenuGroup.LAYOUT]: { order: 1 },
2218
- [ContextMenuGroup.DATA]: { order: 2 },
2219
- [ContextMenuGroup.OTHERS]: { order: 3 }
2216
+ ["contextMenu.format"]: { order: 0 },
2217
+ ["contextMenu.layout"]: { order: 1 },
2218
+ ["contextMenu.data"]: { order: 2 },
2219
+ ["contextMenu.others"]: { order: 3 }
2220
2220
  },
2221
- [ContextMenuPosition.ROW_HEADER]: {
2221
+ ["contextMenu.rowHeader"]: {
2222
2222
  order: 2,
2223
- [ContextMenuGroup.QUICK]: {
2223
+ ["contextMenu.quick"]: {
2224
2224
  order: -1,
2225
2225
  quickLayout: "icon"
2226
2226
  },
2227
- [ContextMenuGroup.FORMAT]: { order: 0 },
2228
- [ContextMenuGroup.LAYOUT]: { order: 1 },
2229
- [ContextMenuGroup.DATA]: { order: 2 },
2230
- [ContextMenuGroup.OTHERS]: { order: 3 }
2227
+ ["contextMenu.format"]: { order: 0 },
2228
+ ["contextMenu.layout"]: { order: 1 },
2229
+ ["contextMenu.data"]: { order: 2 },
2230
+ ["contextMenu.others"]: { order: 3 }
2231
2231
  },
2232
- [ContextMenuPosition.FOOTER_TABS]: {
2232
+ ["contextMenu.footerTabs"]: {
2233
2233
  order: 3,
2234
- [ContextMenuGroup.FORMAT]: { order: 0 },
2235
- [ContextMenuGroup.LAYOUT]: { order: 1 },
2236
- [ContextMenuGroup.DATA]: { order: 2 },
2237
- [ContextMenuGroup.OTHERS]: { order: 3 }
2234
+ ["contextMenu.format"]: { order: 0 },
2235
+ ["contextMenu.layout"]: { order: 1 },
2236
+ ["contextMenu.data"]: { order: 2 },
2237
+ ["contextMenu.others"]: { order: 3 }
2238
2238
  },
2239
- [ContextMenuPosition.FOOTER_MENU]: {
2239
+ ["contextMenu.footerMenu"]: {
2240
2240
  order: 4,
2241
- [ContextMenuGroup.OTHERS]: { order: 3 }
2241
+ ["contextMenu.others"]: { order: 3 }
2242
2242
  },
2243
- [ContextMenuPosition.DRAWING]: {
2243
+ ["contextMenu.drawing"]: {
2244
2244
  order: 5,
2245
- [ContextMenuGroup.OTHERS]: { order: 3 }
2245
+ ["contextMenu.others"]: { order: 3 }
2246
2246
  }
2247
2247
  }
2248
2248
  });
@@ -2414,7 +2414,7 @@ function ShortcutPanel() {
2414
2414
  //#region src/controllers/shortcut-display/shortcut-panel.controller.ts
2415
2415
  const ToggleShortcutPanelShortcut = {
2416
2416
  id: ToggleShortcutPanelOperation.id,
2417
- binding: MetaKeys.CTRL_COMMAND | KeyCode.BACK_SLASH,
2417
+ binding: 4096 | 220,
2418
2418
  description: "shortcut.shortcut-panel",
2419
2419
  group: "10_global-shortcut"
2420
2420
  };
@@ -2449,7 +2449,7 @@ let MenuItemType = /* @__PURE__ */ function(MenuItemType) {
2449
2449
  return MenuItemType;
2450
2450
  }({});
2451
2451
  function isMenuButtonSelectorItem(v) {
2452
- return v.type === MenuItemType.BUTTON_SELECTOR;
2452
+ return v.type === 2;
2453
2453
  }
2454
2454
 
2455
2455
  //#endregion
@@ -2464,7 +2464,7 @@ const undoRedoDisableFactory$ = (accessor, isUndo) => {
2464
2464
  function UndoMenuItemFactory(accessor) {
2465
2465
  return {
2466
2466
  id: UndoCommand.id,
2467
- type: MenuItemType.BUTTON,
2467
+ type: 0,
2468
2468
  icon: "UndoIcon",
2469
2469
  title: "Undo",
2470
2470
  tooltip: "toolbar.undo",
@@ -2474,7 +2474,7 @@ function UndoMenuItemFactory(accessor) {
2474
2474
  function RedoMenuItemFactory(accessor) {
2475
2475
  return {
2476
2476
  id: RedoCommand.id,
2477
- type: MenuItemType.BUTTON,
2477
+ type: 0,
2478
2478
  icon: "RedoIcon",
2479
2479
  title: "Redo",
2480
2480
  tooltip: "toolbar.redo",
@@ -2490,14 +2490,14 @@ function ShortcutPanelMenuItemFactory() {
2490
2490
  title: "toggle-shortcut-panel",
2491
2491
  tooltip: "toggle-shortcut-panel",
2492
2492
  icon: "ShortcutIcon",
2493
- type: MenuItemType.BUTTON
2493
+ type: 0
2494
2494
  };
2495
2495
  }
2496
2496
 
2497
2497
  //#endregion
2498
2498
  //#region src/menu/schema.ts
2499
2499
  const menuSchema = {
2500
- [RibbonStartGroup.HISTORY]: {
2500
+ ["ribbon.start.history"]: {
2501
2501
  [UndoCommand.id]: {
2502
2502
  order: 0,
2503
2503
  menuItemFactory: UndoMenuItemFactory
@@ -2507,7 +2507,7 @@ const menuSchema = {
2507
2507
  menuItemFactory: RedoMenuItemFactory
2508
2508
  }
2509
2509
  },
2510
- [RibbonStartGroup.OTHERS]: { [ToggleShortcutPanelOperation.id]: {
2510
+ ["ribbon.start.others"]: { [ToggleShortcutPanelOperation.id]: {
2511
2511
  order: 1,
2512
2512
  menuItemFactory: ShortcutPanelMenuItemFactory
2513
2513
  } }
@@ -3027,7 +3027,7 @@ let DesktopRibbonService = class DesktopRibbonService extends Disposable {
3027
3027
  this._univerInstanceService = _univerInstanceService;
3028
3028
  _defineProperty(this, "_ribbon$", new BehaviorSubject([]));
3029
3029
  _defineProperty(this, "ribbon$", this._ribbon$.asObservable());
3030
- _defineProperty(this, "_activatedTab$", new BehaviorSubject(RibbonPosition.START));
3030
+ _defineProperty(this, "_activatedTab$", new BehaviorSubject("ribbon.start"));
3031
3031
  _defineProperty(this, "activatedTab$", this._activatedTab$.asObservable());
3032
3032
  _defineProperty(this, "_collapsedIds$", new BehaviorSubject([]));
3033
3033
  _defineProperty(this, "collapsedIds$", this._collapsedIds$.asObservable());
@@ -3050,7 +3050,7 @@ let DesktopRibbonService = class DesktopRibbonService extends Disposable {
3050
3050
  }));
3051
3051
  }
3052
3052
  _updateRibbon() {
3053
- const ribbon = this._menuManagerService.getMenuByPositionKey(MenuManagerPosition.RIBBON);
3053
+ const ribbon = this._menuManagerService.getMenuByPositionKey("ribbon");
3054
3054
  const hiddenObservableMap = [];
3055
3055
  const hiddenKeyMap = [];
3056
3056
  for (const group of ribbon) if (group.children) {
@@ -3178,12 +3178,12 @@ function ClassicMenu({ ribbon, activatedTab, onSelectTab }) {
3178
3178
  //#endregion
3179
3179
  //#region src/views/components/ribbon/ribbon-menu/DefaultMenu.tsx
3180
3180
  const iconMap = {
3181
- [RibbonPosition.START]: HomeIcon,
3182
- [RibbonPosition.INSERT]: InsertIcon,
3183
- [RibbonPosition.FORMULAS]: FunctionIcon,
3184
- [RibbonPosition.DATA]: DatabaseIcon,
3185
- [RibbonPosition.VIEW]: EyeIcon,
3186
- [RibbonPosition.OTHERS]: MoreFunctionIcon
3181
+ ["ribbon.start"]: HomeIcon,
3182
+ ["ribbon.insert"]: InsertIcon,
3183
+ ["ribbon.formulas"]: FunctionIcon,
3184
+ ["ribbon.data"]: DatabaseIcon,
3185
+ ["ribbon.view"]: EyeIcon,
3186
+ ["ribbon.others"]: MoreFunctionIcon
3187
3187
  };
3188
3188
  function DefaultMenu({ ribbon, activatedTab, onSelectTab }) {
3189
3189
  const localeService = useDependency(LocaleService);
@@ -3614,9 +3614,9 @@ const ToolbarItem = forwardRef((props, ref) => {
3614
3614
  }
3615
3615
  function handleClick() {
3616
3616
  if (disabled) return;
3617
- if (menuType === MenuItemType.BUTTON_SELECTOR) executeCommand(bId, { value });
3617
+ if (menuType === 2) executeCommand(bId, { value });
3618
3618
  }
3619
- if (menuType === MenuItemType.BUTTON_SELECTOR) return /* @__PURE__ */ jsxs("div", {
3619
+ if (menuType === 2) return /* @__PURE__ */ jsxs("div", {
3620
3620
  "data-u-command": id,
3621
3621
  "data-disabled": disabled,
3622
3622
  className: clsx("univer-toolbar-button-selector-root univer-animate-in univer-fade-in univer-group univer-relative univer-flex univer-h-6 univer-cursor-pointer univer-items-center univer-rounded univer-pr-5 univer-text-sm univer-transition-colors hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700", {
@@ -3706,10 +3706,10 @@ const ToolbarItem = forwardRef((props, ref) => {
3706
3706
  }
3707
3707
  function renderItem() {
3708
3708
  switch (type) {
3709
- case MenuItemType.BUTTON_SELECTOR:
3710
- case MenuItemType.SELECTOR:
3711
- case MenuItemType.SUBITEMS: return renderSelectorType(type);
3712
- case MenuItemType.BUTTON:
3709
+ case 2:
3710
+ case 1:
3711
+ case 3: return renderSelectorType(type);
3712
+ case 0:
3713
3713
  default: return renderButtonType();
3714
3714
  }
3715
3715
  }
@@ -3730,13 +3730,13 @@ function Ribbon(props) {
3730
3730
  const containerRef = useRef(null);
3731
3731
  const toolbarItemRefs = useRef({});
3732
3732
  const ribbonData = useObservable(ribbonService.ribbon$, []);
3733
- const activatedTab = useObservable(ribbonService.activatedTab$, RibbonPosition.START);
3733
+ const activatedTab = useObservable(ribbonService.activatedTab$, "ribbon.start");
3734
3734
  const collapsedIds = useObservable(ribbonService.collapsedIds$, []);
3735
3735
  const fakeToolbarVisible = useObservable(ribbonService.fakeToolbarVisible$, false);
3736
3736
  const ribbon = useMemo(() => {
3737
3737
  if (ribbonType === "simple") {
3738
3738
  const simpleRibbon = [{
3739
- key: RibbonPosition.START,
3739
+ key: "ribbon.start",
3740
3740
  children: [],
3741
3741
  order: 0
3742
3742
  }];
@@ -4261,7 +4261,7 @@ function ContextMenuMenuItem(props) {
4261
4261
  const menuItemElementRef = useRef(null);
4262
4262
  const submenuElementRef = useRef(null);
4263
4263
  const selections = useMemo(() => {
4264
- if (menuItem.type !== MenuItemType.SELECTOR && menuItem.type !== MenuItemType.BUTTON_SELECTOR) return [];
4264
+ if (menuItem.type !== 1 && menuItem.type !== 2) return [];
4265
4265
  if (selectionsFromObservable) return selectionsFromObservable;
4266
4266
  return Array.isArray(selectorItem.selections) ? selectorItem.selections : [];
4267
4267
  }, [
@@ -4270,7 +4270,7 @@ function ContextMenuMenuItem(props) {
4270
4270
  selectorItem.selections
4271
4271
  ]);
4272
4272
  const subMenuItems = useMemo(() => {
4273
- if (menuItem.type !== MenuItemType.SUBITEMS || !menuItem.id) return [];
4273
+ if (menuItem.type !== 3 || !menuItem.id) return [];
4274
4274
  return menuManagerService.getMenuByPositionKey(menuItem.id);
4275
4275
  }, [
4276
4276
  menuItem.id,
@@ -4323,6 +4323,10 @@ function ContextMenuMenuItem(props) {
4323
4323
  const onChange = (v) => {
4324
4324
  setInputValue(isRealNum(v) && typeof v === "string" ? Number.parseInt(v) : v);
4325
4325
  };
4326
+ const onSubmenuOptionSelect = (option) => {
4327
+ onOptionSelect === null || onOptionSelect === void 0 || onOptionSelect(option);
4328
+ setSubmenuVisible(false);
4329
+ };
4326
4330
  const itemClassName = clsx("univer-relative univer-flex univer-min-h-8 univer-w-full univer-items-center univer-justify-between univer-gap-3 univer-rounded-md univer-border-none univer-bg-transparent univer-px-2 univer-text-left univer-text-sm dark:!univer-text-white", disabled ? "univer-cursor-not-allowed univer-opacity-60" : `
4327
4331
  univer-cursor-pointer
4328
4332
  hover:univer-bg-gray-50
@@ -4341,7 +4345,7 @@ function ContextMenuMenuItem(props) {
4341
4345
  onChange
4342
4346
  }), menuItem.shortcut && ` (${menuItem.shortcut})`]
4343
4347
  });
4344
- const canExecuteItem = menuItem.type === MenuItemType.BUTTON || menuItem.type === MenuItemType.BUTTON_SELECTOR;
4348
+ const canExecuteItem = menuItem.type === 0 || menuItem.type === 2;
4345
4349
  const renderAsContainer = isNonSelectableLabel(menuItem.label);
4346
4350
  const interactiveItemClassName = clsx(itemClassName, isNonHoverableLabel(menuItem.label) && `
4347
4351
  hover:univer-bg-transparent
@@ -4435,7 +4439,7 @@ function ContextMenuMenuItem(props) {
4435
4439
  label: option.label,
4436
4440
  icon: option.icon,
4437
4441
  onChange: (optionValue) => {
4438
- onOptionSelect === null || onOptionSelect === void 0 || onOptionSelect({
4442
+ onSubmenuOptionSelect === null || onSubmenuOptionSelect === void 0 || onSubmenuOptionSelect({
4439
4443
  ...option,
4440
4444
  value: optionValue,
4441
4445
  id: menuItem.id,
@@ -4450,7 +4454,7 @@ function ContextMenuMenuItem(props) {
4450
4454
  className: optionClassName,
4451
4455
  disabled: option.disabled,
4452
4456
  onClick: () => {
4453
- onOptionSelect === null || onOptionSelect === void 0 || onOptionSelect({
4457
+ onSubmenuOptionSelect === null || onSubmenuOptionSelect === void 0 || onSubmenuOptionSelect({
4454
4458
  ...option,
4455
4459
  id: menuItem.id,
4456
4460
  label: menuKey,
@@ -4467,7 +4471,7 @@ function ContextMenuMenuItem(props) {
4467
4471
  }), hasSubItemSubmenu && /* @__PURE__ */ jsx(ContextMenuMenu, {
4468
4472
  menuSchemas: subMenuItems,
4469
4473
  submenuPortalContainer,
4470
- onOptionSelect,
4474
+ onOptionSelect: onSubmenuOptionSelect,
4471
4475
  maxMenuHeight
4472
4476
  })]
4473
4477
  })
@@ -4854,14 +4858,14 @@ function DesktopWorkbenchContent(props) {
4854
4858
  const themeSwitcherService = useDependency(ThemeSwitcherService);
4855
4859
  const contentRef = useRef(null);
4856
4860
  const uiConfig = useDependency(IConfigService).getConfig(UI_PLUGIN_CONFIG_KEY);
4857
- const customHeaderComponents = useComponentsOfPart(BuiltInUIPart.CUSTOM_HEADER);
4858
- const footerComponents = useComponentsOfPart(BuiltInUIPart.FOOTER);
4859
- const headerComponents = useComponentsOfPart(BuiltInUIPart.HEADER);
4860
- const headerMenuComponents = useComponentsOfPart(BuiltInUIPart.HEADER_MENU);
4861
- const contentComponents = useComponentsOfPart(BuiltInUIPart.CONTENT);
4862
- const leftSidebarComponents = useComponentsOfPart(BuiltInUIPart.LEFT_SIDEBAR);
4863
- const globalComponents = useComponentsOfPart(BuiltInUIPart.GLOBAL);
4864
- const toolbarComponents = useComponentsOfPart(BuiltInUIPart.TOOLBAR);
4861
+ const customHeaderComponents = useComponentsOfPart("custom-header");
4862
+ const footerComponents = useComponentsOfPart("footer");
4863
+ const headerComponents = useComponentsOfPart("header");
4864
+ const headerMenuComponents = useComponentsOfPart("header-menu");
4865
+ const contentComponents = useComponentsOfPart("content");
4866
+ const leftSidebarComponents = useComponentsOfPart("left-sidebar");
4867
+ const globalComponents = useComponentsOfPart("global");
4868
+ const toolbarComponents = useComponentsOfPart("toolbar");
4865
4869
  const popupRootId = (_uiConfig$popupRootId = uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.popupRootId) !== null && _uiConfig$popupRootId !== void 0 ? _uiConfig$popupRootId : "univer-popup-portal";
4866
4870
  useLayoutEffect(() => {
4867
4871
  const sub = themeService.currentTheme$.subscribe((theme) => {
@@ -4975,7 +4979,7 @@ function DesktopWorkbenchContent(props) {
4975
4979
  }
4976
4980
  function FloatingContainer() {
4977
4981
  const { mountContainer } = useContext(ConfigContext);
4978
- return createPortal(/* @__PURE__ */ jsx(ComponentContainer, { components: useComponentsOfPart(BuiltInUIPart.FLOATING) }, "floating"), mountContainer);
4982
+ return createPortal(/* @__PURE__ */ jsx(ComponentContainer, { components: useComponentsOfPart("floating") }, "floating"), mountContainer);
4979
4983
  }
4980
4984
 
4981
4985
  //#endregion
@@ -5085,9 +5089,9 @@ let DesktopUIController = class DesktopUIController extends SingleUnitUIControll
5085
5089
  return bootstrap$1(this._injector, this._config, callback);
5086
5090
  }
5087
5091
  _initBuiltinComponents(uiPartsService) {
5088
- this.disposeWithMe(uiPartsService.registerComponent(BuiltInUIPart.FLOATING, () => connectInjector(CanvasPopup, this._injector)));
5089
- this.disposeWithMe(uiPartsService.registerComponent(BuiltInUIPart.CONTENT, () => connectInjector(FloatDom, this._injector)));
5090
- this.disposeWithMe(uiPartsService.registerComponent(BuiltInUIPart.TOOLBAR, () => connectInjector(Ribbon, this._injector)));
5092
+ this.disposeWithMe(uiPartsService.registerComponent("floating", () => connectInjector(CanvasPopup, this._injector)));
5093
+ this.disposeWithMe(uiPartsService.registerComponent("content", () => connectInjector(FloatDom, this._injector)));
5094
+ this.disposeWithMe(uiPartsService.registerComponent("toolbar", () => connectInjector(Ribbon, this._injector)));
5091
5095
  }
5092
5096
  };
5093
5097
  DesktopUIController = __decorate([
@@ -5136,7 +5140,7 @@ const IUIController = createIdentifier("univer.ui.ui-controller");
5136
5140
  //#endregion
5137
5141
  //#region package.json
5138
5142
  var name = "@univerjs/ui";
5139
- var version = "0.21.1";
5143
+ var version = "0.22.0";
5140
5144
 
5141
5145
  //#endregion
5142
5146
  //#region src/views/components/ribbon/MobileRibbon.tsx
@@ -5159,7 +5163,7 @@ function MobileRibbon(props) {
5159
5163
  const localeService = useDependency(LocaleService);
5160
5164
  const ribbonService = useDependency(IRibbonService);
5161
5165
  const ribbon = useObservable(ribbonService.ribbon$, []);
5162
- const activatedTab = useObservable(ribbonService.activatedTab$, RibbonPosition.START);
5166
+ const activatedTab = useObservable(ribbonService.activatedTab$, "ribbon.start");
5163
5167
  const activeIndex = useMemo(() => {
5164
5168
  const index = ribbon.findIndex((group) => group.key === activatedTab);
5165
5169
  return index === -1 ? 0 : index;
@@ -5515,7 +5519,7 @@ function useMobileSchemaInteraction(props) {
5515
5519
  const value = useObservable(menuItem === null || menuItem === void 0 ? void 0 : menuItem.value$);
5516
5520
  const selectionsFromObservable = useObservable(selectorItem && isObservable(selectorItem.selections) ? selectorItem.selections : void 0);
5517
5521
  const selections = useMemo(() => {
5518
- if (!selectorItem || (menuItem === null || menuItem === void 0 ? void 0 : menuItem.type) !== MenuItemType.SELECTOR && (menuItem === null || menuItem === void 0 ? void 0 : menuItem.type) !== MenuItemType.BUTTON_SELECTOR) return [];
5522
+ if (!selectorItem || (menuItem === null || menuItem === void 0 ? void 0 : menuItem.type) !== 1 && (menuItem === null || menuItem === void 0 ? void 0 : menuItem.type) !== 2) return [];
5519
5523
  if (selectionsFromObservable) return selectionsFromObservable;
5520
5524
  return Array.isArray(selectorItem.selections) ? selectorItem.selections : [];
5521
5525
  }, [
@@ -5524,7 +5528,7 @@ function useMobileSchemaInteraction(props) {
5524
5528
  selectorItem
5525
5529
  ]);
5526
5530
  const subMenuItems = useMemo(() => {
5527
- if (!menuItem || menuItem.type !== MenuItemType.SUBITEMS || !menuItem.id) return [];
5531
+ if (!menuItem || menuItem.type !== 3 || !menuItem.id) return [];
5528
5532
  return menuManagerService.getMenuByPositionKey(menuItem.id);
5529
5533
  }, [menuItem, menuManagerService]);
5530
5534
  if (!menuItem) return null;
@@ -5559,7 +5563,7 @@ function useMobileSchemaInteraction(props) {
5559
5563
  });
5560
5564
  return;
5561
5565
  }
5562
- if (menuItem.type !== MenuItemType.BUTTON && menuItem.type !== MenuItemType.BUTTON_SELECTOR) return;
5566
+ if (menuItem.type !== 0 && menuItem.type !== 2) return;
5563
5567
  const buttonItem = menuItem;
5564
5568
  onExecute === null || onExecute === void 0 || onExecute({
5565
5569
  commandId: buttonItem.commandId,
@@ -5665,8 +5669,8 @@ function MobileContextMenu() {
5665
5669
  }
5666
5670
  const sheetTitle = useMemo(() => {
5667
5671
  switch (menuType) {
5668
- case ContextMenuPosition.ROW_HEADER: return localeService.t("row");
5669
- case ContextMenuPosition.COL_HEADER: return localeService.t("column");
5672
+ case "contextMenu.rowHeader": return localeService.t("row");
5673
+ case "contextMenu.colHeader": return localeService.t("column");
5670
5674
  default: return "";
5671
5675
  }
5672
5676
  }, [localeService, menuType]);
@@ -5728,13 +5732,13 @@ function MobileWorkbench(props) {
5728
5732
  const themeService = useDependency(ThemeService);
5729
5733
  const themeSwitcherService = useDependency(ThemeSwitcherService);
5730
5734
  const contentRef = useRef(null);
5731
- const footerComponents = useComponentsOfPart(BuiltInUIPart.FOOTER);
5732
- const headerComponents = useComponentsOfPart(BuiltInUIPart.HEADER);
5733
- const headerMenuComponents = useComponentsOfPart(BuiltInUIPart.HEADER_MENU);
5734
- const contentComponents = useComponentsOfPart(BuiltInUIPart.CONTENT);
5735
- const leftSidebarComponents = useComponentsOfPart(BuiltInUIPart.LEFT_SIDEBAR);
5736
- const globalComponents = useComponentsOfPart(BuiltInUIPart.GLOBAL);
5737
- const toolbarComponents = useComponentsOfPart(BuiltInUIPart.TOOLBAR);
5735
+ const footerComponents = useComponentsOfPart("footer");
5736
+ const headerComponents = useComponentsOfPart("header");
5737
+ const headerMenuComponents = useComponentsOfPart("header-menu");
5738
+ const contentComponents = useComponentsOfPart("content");
5739
+ const leftSidebarComponents = useComponentsOfPart("left-sidebar");
5740
+ const globalComponents = useComponentsOfPart("global");
5741
+ const toolbarComponents = useComponentsOfPart("toolbar");
5738
5742
  const [darkMode, setDarkMode] = useState(false);
5739
5743
  useEffect(() => {
5740
5744
  const sub = themeService.darkMode$.subscribe((darkMode) => {
@@ -5865,9 +5869,9 @@ let MobileUIController = class MobileUIController extends SingleUnitUIController
5865
5869
  });
5866
5870
  }
5867
5871
  _initBuiltinComponents(uiPartsService) {
5868
- this.disposeWithMe(uiPartsService.registerComponent(BuiltInUIPart.CONTENT, () => connectInjector(CanvasPopup, this._injector)));
5869
- this.disposeWithMe(uiPartsService.registerComponent(BuiltInUIPart.CONTENT, () => connectInjector(FloatDom, this._injector)));
5870
- this.disposeWithMe(uiPartsService.registerComponent(BuiltInUIPart.TOOLBAR, () => connectInjector(MobileRibbon, this._injector)));
5872
+ this.disposeWithMe(uiPartsService.registerComponent("content", () => connectInjector(CanvasPopup, this._injector)));
5873
+ this.disposeWithMe(uiPartsService.registerComponent("content", () => connectInjector(FloatDom, this._injector)));
5874
+ this.disposeWithMe(uiPartsService.registerComponent("toolbar", () => connectInjector(MobileRibbon, this._injector)));
5871
5875
  }
5872
5876
  };
5873
5877
  MobileUIController = __decorate([
@@ -6445,7 +6449,7 @@ let DesktopConfirmService = class DesktopConfirmService extends Disposable {
6445
6449
  this.confirmOptions$.next([...this._confirmOptions]);
6446
6450
  }
6447
6451
  _initUIPart() {
6448
- this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.GLOBAL, () => connectInjector(ConfirmPart, this._injector)));
6452
+ this.disposeWithMe(this._uiPartsService.registerComponent("global", () => connectInjector(ConfirmPart, this._injector)));
6449
6453
  }
6450
6454
  };
6451
6455
  DesktopConfirmService = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, IUIPartsService)], DesktopConfirmService);
@@ -6532,7 +6536,7 @@ let DesktopDialogService = class DesktopDialogService extends Disposable {
6532
6536
  return this._dialogOptions$.asObservable();
6533
6537
  }
6534
6538
  _initUIPart() {
6535
- this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.GLOBAL, () => connectInjector(DialogPart, this._injector)));
6539
+ this.disposeWithMe(this._uiPartsService.registerComponent("global", () => connectInjector(DialogPart, this._injector)));
6536
6540
  }
6537
6541
  };
6538
6542
  DesktopDialogService = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, IUIPartsService)], DesktopDialogService);
@@ -6593,7 +6597,7 @@ let DesktopGalleryService = class DesktopGalleryService extends Disposable {
6593
6597
  });
6594
6598
  }
6595
6599
  _initUIPart() {
6596
- this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.GLOBAL, () => connectInjector(GalleryPart, this._injector)));
6600
+ this.disposeWithMe(this._uiPartsService.registerComponent("global", () => connectInjector(GalleryPart, this._injector)));
6597
6601
  }
6598
6602
  };
6599
6603
  DesktopGalleryService = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, IUIPartsService)], DesktopGalleryService);
@@ -6734,7 +6738,7 @@ let DesktopMessageService = class DesktopMessageService extends Disposable {
6734
6738
  this._initUIPart();
6735
6739
  }
6736
6740
  _initUIPart() {
6737
- this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.GLOBAL, () => connectInjector(MessageContainer, this._injector)));
6741
+ this.disposeWithMe(this._uiPartsService.registerComponent("global", () => connectInjector(MessageContainer, this._injector)));
6738
6742
  }
6739
6743
  dispose() {
6740
6744
  super.dispose();
@@ -6785,7 +6789,7 @@ let DesktopNotificationService = class DesktopNotificationService extends Dispos
6785
6789
  return toDisposable(() => {});
6786
6790
  }
6787
6791
  _initUIPart() {
6788
- this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.GLOBAL, () => connectInjector(Notification, this._injector)));
6792
+ this.disposeWithMe(this._uiPartsService.registerComponent("global", () => connectInjector(Notification, this._injector)));
6789
6793
  }
6790
6794
  };
6791
6795
  DesktopNotificationService = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, IUIPartsService)], DesktopNotificationService);