@univerjs/ui 1.0.0-alpha.7 → 1.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +9 -41
- package/lib/cjs/index.js +373 -152
- package/lib/es/facade.js +11 -43
- package/lib/es/index.js +373 -155
- package/lib/facade.js +11 -43
- package/lib/index.css +48 -0
- package/lib/index.js +373 -155
- package/lib/types/facade/f-univer.d.ts +0 -8
- package/lib/types/facade/index.d.ts +0 -2
- package/lib/types/index.d.ts +2 -1
- package/lib/types/services/parts/parts.service.d.ts +3 -0
- package/lib/types/services/shortcut/shortcut.service.d.ts +17 -0
- package/lib/types/services/workbench/workbench.service.d.ts +30 -0
- package/lib/types/views/components/workbench-skeleton/WorkbenchSkeleton.d.ts +22 -0
- package/lib/types/views/emoji-picker/emoji-picker-utils.d.ts +1 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +16 -13
- package/package.json +7 -7
- package/lib/types/facade/f-hooks.d.ts +0 -63
package/lib/cjs/index.js
CHANGED
|
@@ -58,7 +58,7 @@ function getAttributeValue(target, name) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
//#endregion
|
|
61
|
-
//#region \0@oxc-project+runtime@0.
|
|
61
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
|
|
62
62
|
function _typeof(o) {
|
|
63
63
|
"@babel/helpers - typeof";
|
|
64
64
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -69,7 +69,7 @@ function _typeof(o) {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
//#endregion
|
|
72
|
-
//#region \0@oxc-project+runtime@0.
|
|
72
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
|
|
73
73
|
function toPrimitive(t, r) {
|
|
74
74
|
if ("object" != _typeof(t) || !t) return t;
|
|
75
75
|
var e = t[Symbol.toPrimitive];
|
|
@@ -82,14 +82,14 @@ function toPrimitive(t, r) {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
//#endregion
|
|
85
|
-
//#region \0@oxc-project+runtime@0.
|
|
85
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
|
|
86
86
|
function toPropertyKey(t) {
|
|
87
87
|
var i = toPrimitive(t, "string");
|
|
88
88
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
//#endregion
|
|
92
|
-
//#region \0@oxc-project+runtime@0.
|
|
92
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
|
|
93
93
|
function _defineProperty(e, r, t) {
|
|
94
94
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
95
95
|
value: t,
|
|
@@ -100,7 +100,7 @@ function _defineProperty(e, r, t) {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
//#endregion
|
|
103
|
-
//#region \0@oxc-project+runtime@0.
|
|
103
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
|
|
104
104
|
function __decorateParam(paramIndex, decorator) {
|
|
105
105
|
return function(target, key) {
|
|
106
106
|
decorator(target, key, paramIndex);
|
|
@@ -108,7 +108,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
//#endregion
|
|
111
|
-
//#region \0@oxc-project+runtime@0.
|
|
111
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
|
|
112
112
|
function __decorate(decorators, target, key, desc) {
|
|
113
113
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
114
114
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -860,6 +860,15 @@ var UIRuntimeScopeService = class extends _univerjs_core.Disposable {
|
|
|
860
860
|
//#endregion
|
|
861
861
|
//#region src/services/shortcut/shortcut.service.ts
|
|
862
862
|
/**
|
|
863
|
+
* Defines whether a Univer shortcut should yield to the browser's native behavior
|
|
864
|
+
* when the keyboard event originates from an editable text element.
|
|
865
|
+
*/
|
|
866
|
+
let NativeTextEditorShortcutBehavior = /* @__PURE__ */ function(NativeTextEditorShortcutBehavior) {
|
|
867
|
+
NativeTextEditorShortcutBehavior[NativeTextEditorShortcutBehavior["ALLOW_NATIVE"] = 0] = "ALLOW_NATIVE";
|
|
868
|
+
NativeTextEditorShortcutBehavior[NativeTextEditorShortcutBehavior["OVERRIDE_NATIVE"] = 1] = "OVERRIDE_NATIVE";
|
|
869
|
+
return NativeTextEditorShortcutBehavior;
|
|
870
|
+
}({});
|
|
871
|
+
/**
|
|
863
872
|
* The dependency injection identifier of the {@link IShortcutService}.
|
|
864
873
|
*/
|
|
865
874
|
const IShortcutService = (0, _univerjs_core.createIdentifier)("ui.shortcut.service");
|
|
@@ -950,17 +959,18 @@ let ShortcutService = class ShortcutService extends _univerjs_core.Disposable {
|
|
|
950
959
|
if (this._layoutService && !this._layoutService.checkElementInCurrentContainers(e.target)) return;
|
|
951
960
|
const binding = this._deriveBindingFromEvent(e);
|
|
952
961
|
if (binding === null) return;
|
|
953
|
-
if (this._shouldLetEmbedTextEditorHandleNativeShortcut(e, binding)) return;
|
|
954
962
|
const shortcuts = this._shortCutMapping.get(binding);
|
|
955
963
|
if (shortcuts === void 0) return;
|
|
956
964
|
const contextService = (_this$_getRuntimeServ3 = this._getRuntimeService(e, _univerjs_core.IContextService)) !== null && _this$_getRuntimeServ3 !== void 0 ? _this$_getRuntimeServ3 : this._contextService;
|
|
957
|
-
|
|
965
|
+
const candidateShortcut = Array.from(shortcuts).sort((s1, s2) => {
|
|
958
966
|
var _s2$priority, _s1$priority;
|
|
959
967
|
return ((_s2$priority = s2.priority) !== null && _s2$priority !== void 0 ? _s2$priority : 0) - ((_s1$priority = s1.priority) !== null && _s1$priority !== void 0 ? _s1$priority : 0);
|
|
960
968
|
}).find((s) => {
|
|
961
|
-
var _s$preconditions, _s$preconditions2;
|
|
962
|
-
return (_s$preconditions = (_s$preconditions2 = s.preconditions) === null || _s$preconditions2 === void 0 ? void 0 : _s$preconditions2.call(s, contextService)) !== null && _s$preconditions !== void 0 ? _s$preconditions : true;
|
|
969
|
+
var _s$eventPreconditions, _s$eventPreconditions2, _s$preconditions, _s$preconditions2;
|
|
970
|
+
return ((_s$eventPreconditions = (_s$eventPreconditions2 = s.eventPreconditions) === null || _s$eventPreconditions2 === void 0 ? void 0 : _s$eventPreconditions2.call(s, e)) !== null && _s$eventPreconditions !== void 0 ? _s$eventPreconditions : true) && ((_s$preconditions = (_s$preconditions2 = s.preconditions) === null || _s$preconditions2 === void 0 ? void 0 : _s$preconditions2.call(s, contextService)) !== null && _s$preconditions !== void 0 ? _s$preconditions : true);
|
|
963
971
|
});
|
|
972
|
+
if (this._shouldLetEmbedTextEditorHandleNativeShortcut(e, binding) && (candidateShortcut === null || candidateShortcut === void 0 ? void 0 : candidateShortcut.nativeTextEditorBehavior) !== 1) return;
|
|
973
|
+
return candidateShortcut;
|
|
964
974
|
}
|
|
965
975
|
_getBindingFromItem(item) {
|
|
966
976
|
if (this._platformService.isMac && item.mac) return item.mac;
|
|
@@ -1939,6 +1949,7 @@ var UIPartsService = class extends _univerjs_core.Disposable {
|
|
|
1939
1949
|
constructor(..._args) {
|
|
1940
1950
|
super(..._args);
|
|
1941
1951
|
_defineProperty(this, "_componentsByPart", /* @__PURE__ */ new Map());
|
|
1952
|
+
_defineProperty(this, "_disabledUIParts", /* @__PURE__ */ new Map());
|
|
1942
1953
|
_defineProperty(this, "_componentRegistered$", new rxjs.Subject());
|
|
1943
1954
|
_defineProperty(this, "componentRegistered$", this._componentRegistered$.asObservable());
|
|
1944
1955
|
_defineProperty(this, "_uiVisible", /* @__PURE__ */ new Map());
|
|
@@ -1948,20 +1959,55 @@ var UIPartsService = class extends _univerjs_core.Disposable {
|
|
|
1948
1959
|
dispose() {
|
|
1949
1960
|
super.dispose();
|
|
1950
1961
|
this._componentsByPart.clear();
|
|
1962
|
+
this._disabledUIParts.clear();
|
|
1951
1963
|
this._uiVisible.clear();
|
|
1952
1964
|
this._componentRegistered$.complete();
|
|
1953
1965
|
this._uiVisibleChange$.complete();
|
|
1954
1966
|
}
|
|
1955
1967
|
setUIVisible(part, visible) {
|
|
1968
|
+
const wasVisible = this.isUIVisible(part);
|
|
1956
1969
|
this._uiVisible.set(part, visible);
|
|
1957
|
-
this.
|
|
1970
|
+
const isVisible = this.isUIVisible(part);
|
|
1971
|
+
if (wasVisible !== isVisible) this._uiVisibleChange$.next({
|
|
1958
1972
|
ui: part,
|
|
1959
|
-
visible
|
|
1973
|
+
visible: isVisible
|
|
1960
1974
|
});
|
|
1961
1975
|
}
|
|
1962
1976
|
isUIVisible(part) {
|
|
1963
|
-
var _this$_uiVisible$get;
|
|
1964
|
-
return (_this$_uiVisible$get = this._uiVisible.get(part)) !== null && _this$_uiVisible$get !== void 0 ? _this$_uiVisible$get : true;
|
|
1977
|
+
var _this$_uiVisible$get, _this$_disabledUIPart;
|
|
1978
|
+
return ((_this$_uiVisible$get = this._uiVisible.get(part)) !== null && _this$_uiVisible$get !== void 0 ? _this$_uiVisible$get : true) && !((_this$_disabledUIPart = this._disabledUIParts.get(part)) === null || _this$_disabledUIPart === void 0 ? void 0 : _this$_disabledUIPart.size);
|
|
1979
|
+
}
|
|
1980
|
+
registerDisabledUIParts(parts, disabled$) {
|
|
1981
|
+
const uniqueParts = [...new Set(parts)];
|
|
1982
|
+
const registration = Symbol("disabled-ui-parts");
|
|
1983
|
+
let disabled = false;
|
|
1984
|
+
const update = (nextDisabled) => {
|
|
1985
|
+
if (disabled === nextDisabled) return;
|
|
1986
|
+
disabled = nextDisabled;
|
|
1987
|
+
uniqueParts.forEach((part) => {
|
|
1988
|
+
var _this$_disabledUIPart2;
|
|
1989
|
+
const wasVisible = this.isUIVisible(part);
|
|
1990
|
+
const registrations = (_this$_disabledUIPart2 = this._disabledUIParts.get(part)) !== null && _this$_disabledUIPart2 !== void 0 ? _this$_disabledUIPart2 : /* @__PURE__ */ new Set();
|
|
1991
|
+
if (disabled) {
|
|
1992
|
+
registrations.add(registration);
|
|
1993
|
+
this._disabledUIParts.set(part, registrations);
|
|
1994
|
+
} else {
|
|
1995
|
+
registrations.delete(registration);
|
|
1996
|
+
if (registrations.size === 0) this._disabledUIParts.delete(part);
|
|
1997
|
+
}
|
|
1998
|
+
const isVisible = this.isUIVisible(part);
|
|
1999
|
+
if (wasVisible !== isVisible) this._uiVisibleChange$.next({
|
|
2000
|
+
ui: part,
|
|
2001
|
+
visible: isVisible
|
|
2002
|
+
});
|
|
2003
|
+
});
|
|
2004
|
+
};
|
|
2005
|
+
const subscription = disabled$.subscribe(update);
|
|
2006
|
+
const disposable = (0, _univerjs_core.toDisposable)(() => {
|
|
2007
|
+
subscription.unsubscribe();
|
|
2008
|
+
update(false);
|
|
2009
|
+
});
|
|
2010
|
+
return this.disposeWithMe(disposable);
|
|
1965
2011
|
}
|
|
1966
2012
|
registerComponent(part, componentFactory) {
|
|
1967
2013
|
const componentType = componentFactory();
|
|
@@ -2719,24 +2765,21 @@ function placeRibbonGridItems(items) {
|
|
|
2719
2765
|
const occupied = /* @__PURE__ */ new Set();
|
|
2720
2766
|
const placements = /* @__PURE__ */ new Map();
|
|
2721
2767
|
const fallbackItems = [];
|
|
2722
|
-
let maxExplicitColumn = 0;
|
|
2723
2768
|
for (const item of items) {
|
|
2724
2769
|
var _layout$rowSpan, _layout$columnSpan, _layout$showLabel;
|
|
2725
2770
|
const layout = item.gridLayout;
|
|
2726
2771
|
if (!layout) {
|
|
2727
|
-
fallbackItems.push(item);
|
|
2772
|
+
fallbackItems.push({ item });
|
|
2728
2773
|
continue;
|
|
2729
2774
|
}
|
|
2730
2775
|
const rowSpan = (_layout$rowSpan = layout.rowSpan) !== null && _layout$rowSpan !== void 0 ? _layout$rowSpan : 1;
|
|
2731
2776
|
const columnSpan = (_layout$columnSpan = layout.columnSpan) !== null && _layout$columnSpan !== void 0 ? _layout$columnSpan : 1;
|
|
2732
2777
|
const cells = getCells(layout.row, layout.column, rowSpan, columnSpan);
|
|
2733
|
-
if (!(
|
|
2734
|
-
fallbackItems.push(item);
|
|
2778
|
+
if (!isValidGridGeometry(layout, rowSpan, cells)) {
|
|
2779
|
+
fallbackItems.push({ item });
|
|
2735
2780
|
continue;
|
|
2736
2781
|
}
|
|
2737
|
-
|
|
2738
|
-
maxExplicitColumn = Math.max(maxExplicitColumn, layout.column + columnSpan - 1);
|
|
2739
|
-
placements.set(item, {
|
|
2782
|
+
const placement = {
|
|
2740
2783
|
item,
|
|
2741
2784
|
row: layout.row,
|
|
2742
2785
|
column: layout.column,
|
|
@@ -2745,27 +2788,49 @@ function placeRibbonGridItems(items) {
|
|
|
2745
2788
|
showLabel: (_layout$showLabel = layout.showLabel) !== null && _layout$showLabel !== void 0 ? _layout$showLabel : false,
|
|
2746
2789
|
width: layout.width,
|
|
2747
2790
|
iconSize: layout.iconSize
|
|
2748
|
-
}
|
|
2791
|
+
};
|
|
2792
|
+
if (cells.some((cell) => occupied.has(cell))) {
|
|
2793
|
+
fallbackItems.push({
|
|
2794
|
+
item,
|
|
2795
|
+
layout: placement
|
|
2796
|
+
});
|
|
2797
|
+
continue;
|
|
2798
|
+
}
|
|
2799
|
+
cells.forEach((cell) => occupied.add(cell));
|
|
2800
|
+
placements.set(item, placement);
|
|
2749
2801
|
}
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2802
|
+
for (const { item, layout } of fallbackItems) {
|
|
2803
|
+
var _layout$rowSpan2, _layout$columnSpan2, _layout$showLabel2;
|
|
2804
|
+
const rowSpan = (_layout$rowSpan2 = layout === null || layout === void 0 ? void 0 : layout.rowSpan) !== null && _layout$rowSpan2 !== void 0 ? _layout$rowSpan2 : 1;
|
|
2805
|
+
const columnSpan = (_layout$columnSpan2 = layout === null || layout === void 0 ? void 0 : layout.columnSpan) !== null && _layout$columnSpan2 !== void 0 ? _layout$columnSpan2 : 1;
|
|
2806
|
+
const { row, column, cells } = findFirstAvailableCells(occupied, rowSpan, columnSpan);
|
|
2807
|
+
cells.forEach((cell) => occupied.add(cell));
|
|
2753
2808
|
placements.set(item, {
|
|
2754
2809
|
item,
|
|
2755
|
-
row
|
|
2756
|
-
column
|
|
2757
|
-
rowSpan
|
|
2758
|
-
columnSpan
|
|
2759
|
-
showLabel: false
|
|
2810
|
+
row,
|
|
2811
|
+
column,
|
|
2812
|
+
rowSpan,
|
|
2813
|
+
columnSpan,
|
|
2814
|
+
showLabel: (_layout$showLabel2 = layout === null || layout === void 0 ? void 0 : layout.showLabel) !== null && _layout$showLabel2 !== void 0 ? _layout$showLabel2 : false,
|
|
2815
|
+
width: layout === null || layout === void 0 ? void 0 : layout.width,
|
|
2816
|
+
iconSize: layout === null || layout === void 0 ? void 0 : layout.iconSize
|
|
2760
2817
|
});
|
|
2761
|
-
fallbackRow += 1;
|
|
2762
|
-
if (fallbackRow > RIBBON_GRID_ROWS) {
|
|
2763
|
-
fallbackRow = 1;
|
|
2764
|
-
fallbackColumn += 1;
|
|
2765
|
-
}
|
|
2766
2818
|
}
|
|
2767
2819
|
return items.map((item) => placements.get(item));
|
|
2768
2820
|
}
|
|
2821
|
+
function isValidGridGeometry(layout, rowSpan, cells) {
|
|
2822
|
+
return cells.length > 0 && layout.row + rowSpan - 1 <= RIBBON_GRID_ROWS && (layout.width === void 0 || Number.isFinite(layout.width) && layout.width > 0) && (layout.iconSize === void 0 || Number.isFinite(layout.iconSize) && layout.iconSize > 0);
|
|
2823
|
+
}
|
|
2824
|
+
function findFirstAvailableCells(occupied, rowSpan, columnSpan) {
|
|
2825
|
+
for (let column = 1;; column++) for (let row = 1; row + rowSpan - 1 <= RIBBON_GRID_ROWS; row++) {
|
|
2826
|
+
const cells = getCells(row, column, rowSpan, columnSpan);
|
|
2827
|
+
if (cells.every((cell) => !occupied.has(cell))) return {
|
|
2828
|
+
row,
|
|
2829
|
+
column,
|
|
2830
|
+
cells
|
|
2831
|
+
};
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2769
2834
|
function getCells(row, column, rowSpan, columnSpan) {
|
|
2770
2835
|
if (![
|
|
2771
2836
|
row,
|
|
@@ -3107,7 +3172,8 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
3107
3172
|
return menuItems.filter((item) => {
|
|
3108
3173
|
var _item$key;
|
|
3109
3174
|
if (!item.children) return !hiddenStates[item.key];
|
|
3110
|
-
|
|
3175
|
+
const itemKey = ((_item$key = item.key) === null || _item$key === void 0 ? void 0 : _item$key.toString()) || "";
|
|
3176
|
+
return !hiddenStates[itemKey];
|
|
3111
3177
|
});
|
|
3112
3178
|
}, [menuItems, hiddenStates]);
|
|
3113
3179
|
function handleVisibleChange(visible) {
|
|
@@ -3856,6 +3922,33 @@ var ThemeSwitcherService = class extends _univerjs_core.Disposable {
|
|
|
3856
3922
|
}
|
|
3857
3923
|
};
|
|
3858
3924
|
|
|
3925
|
+
//#endregion
|
|
3926
|
+
//#region src/services/workbench/workbench.service.ts
|
|
3927
|
+
const IWorkbenchService = (0, _univerjs_core.createIdentifier)("univer.ui.workbench.service");
|
|
3928
|
+
var WorkbenchService = class extends _univerjs_core.Disposable {
|
|
3929
|
+
constructor(..._args) {
|
|
3930
|
+
super(..._args);
|
|
3931
|
+
_defineProperty(this, "_tokens", /* @__PURE__ */ new Set());
|
|
3932
|
+
_defineProperty(this, "_skeletonVisible$", new rxjs.BehaviorSubject(false));
|
|
3933
|
+
_defineProperty(this, "skeletonVisible$", this._skeletonVisible$.asObservable());
|
|
3934
|
+
}
|
|
3935
|
+
acquireSkeleton() {
|
|
3936
|
+
const token = Symbol("workbench-skeleton");
|
|
3937
|
+
this._tokens.add(token);
|
|
3938
|
+
if (this._tokens.size === 1) this._skeletonVisible$.next(true);
|
|
3939
|
+
const disposable = (0, _univerjs_core.toDisposable)(() => {
|
|
3940
|
+
if (!this._tokens.delete(token) || this._tokens.size > 0) return;
|
|
3941
|
+
this._skeletonVisible$.next(false);
|
|
3942
|
+
});
|
|
3943
|
+
return this.disposeWithMe(disposable);
|
|
3944
|
+
}
|
|
3945
|
+
dispose() {
|
|
3946
|
+
super.dispose();
|
|
3947
|
+
this._tokens.clear();
|
|
3948
|
+
this._skeletonVisible$.complete();
|
|
3949
|
+
}
|
|
3950
|
+
};
|
|
3951
|
+
|
|
3859
3952
|
//#endregion
|
|
3860
3953
|
//#region src/services/contextmenu/contextmenu.service.ts
|
|
3861
3954
|
const IContextMenuService = (0, _univerjs_core.createIdentifier)("ui.contextmenu.service");
|
|
@@ -3966,10 +4059,10 @@ function useScrollYOverContainer(element, container) {
|
|
|
3966
4059
|
(0, react.useEffect)(() => {
|
|
3967
4060
|
if (!(0, _univerjs_design.isBrowser)() || !element || !container) return;
|
|
3968
4061
|
updater();
|
|
3969
|
-
const resizeObserver =
|
|
4062
|
+
const resizeObserver = new ResizeObserver(updater);
|
|
3970
4063
|
resizeObserver.observe(element);
|
|
3971
4064
|
return () => {
|
|
3972
|
-
resizeObserver.
|
|
4065
|
+
resizeObserver.disconnect();
|
|
3973
4066
|
};
|
|
3974
4067
|
}, [element, container]);
|
|
3975
4068
|
}
|
|
@@ -4148,11 +4241,12 @@ function QuickTileMenuItem(props) {
|
|
|
4148
4241
|
const activated = (0, _wendellhu_redi_react_bindings.useObservable)(menuItem === null || menuItem === void 0 ? void 0 : menuItem.activated$, false);
|
|
4149
4242
|
if (!menuItem || hidden) return null;
|
|
4150
4243
|
const Icon = menuItem.icon ? iconManager.get(menuItem.icon) : null;
|
|
4244
|
+
const active = resolveMenuItemActiveState(menuItem.id, activated, activeItemIds);
|
|
4151
4245
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
4152
4246
|
type: "button",
|
|
4153
4247
|
className: quickTileMenuButtonVariants({
|
|
4154
4248
|
disabled,
|
|
4155
|
-
active
|
|
4249
|
+
active
|
|
4156
4250
|
}),
|
|
4157
4251
|
disabled,
|
|
4158
4252
|
onClick: () => {
|
|
@@ -4925,9 +5019,10 @@ function ContextMenuMenuItem(props) {
|
|
|
4925
5019
|
const left = useLeft ? leftLeft : rightLeft;
|
|
4926
5020
|
setSubmenuPlacement(useLeft ? "left" : "right");
|
|
4927
5021
|
const maxTop = window.innerHeight - menuViewportPadding - submenuRect.height;
|
|
5022
|
+
const top = maxTop < menuViewportPadding ? menuViewportPadding : Math.min(Math.max(menuItemRect.top, menuViewportPadding), maxTop);
|
|
4928
5023
|
setSubmenuPosition({
|
|
4929
5024
|
left,
|
|
4930
|
-
top
|
|
5025
|
+
top
|
|
4931
5026
|
});
|
|
4932
5027
|
setSubmenuPositionReady(true);
|
|
4933
5028
|
};
|
|
@@ -4948,7 +5043,8 @@ function ContextMenuMenuItem(props) {
|
|
|
4948
5043
|
const hiddenById = menuItem.id != null && hiddenItemIds.includes(menuItem.id) || hiddenItemIds.includes(menuKey);
|
|
4949
5044
|
if (hidden || hiddenById) return null;
|
|
4950
5045
|
const onChange = (v) => {
|
|
4951
|
-
|
|
5046
|
+
const newValue = (0, _univerjs_core.isRealNum)(v) && typeof v === "string" ? Number.parseInt(v) : v;
|
|
5047
|
+
setInputValue(newValue);
|
|
4952
5048
|
};
|
|
4953
5049
|
const onSubmenuOptionSelect = (option) => {
|
|
4954
5050
|
onOptionSelect === null || onOptionSelect === void 0 || onOptionSelect(option);
|
|
@@ -5508,6 +5604,95 @@ function Sidebar() {
|
|
|
5508
5604
|
});
|
|
5509
5605
|
}
|
|
5510
5606
|
|
|
5607
|
+
//#endregion
|
|
5608
|
+
//#region src/views/components/workbench-skeleton/WorkbenchSkeleton.tsx
|
|
5609
|
+
function WorkbenchSkeleton({ darkMode, direction, overlay = false }) {
|
|
5610
|
+
const shimmerClassName = `
|
|
5611
|
+
univer-animate-pulse univer-bg-gray-100 motion-reduce:univer-animate-none
|
|
5612
|
+
dark:!univer-bg-gray-700
|
|
5613
|
+
`;
|
|
5614
|
+
const shimmerStyle = { animationDuration: "1.2s" };
|
|
5615
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5616
|
+
"aria-busy": "true",
|
|
5617
|
+
className: (0, _univerjs_design.clsx)("univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-overflow-hidden univer-bg-gray-50 dark:!univer-bg-gray-900", {
|
|
5618
|
+
"univer-absolute univer-inset-0 univer-z-50": overlay,
|
|
5619
|
+
"univer-dark": darkMode
|
|
5620
|
+
}),
|
|
5621
|
+
dir: direction,
|
|
5622
|
+
children: [
|
|
5623
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
|
|
5624
|
+
"data-u-comp": "workbench-skeleton-toolbar",
|
|
5625
|
+
className: "univer-flex univer-h-11 univer-shrink-0 univer-items-center univer-gap-2 univer-border-0 univer-border-b univer-border-solid univer-border-gray-200 univer-bg-white univer-px-4 dark:!univer-border-gray-700 dark:!univer-bg-gray-800",
|
|
5626
|
+
children: [
|
|
5627
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5628
|
+
"data-u-comp": "workbench-skeleton-shimmer",
|
|
5629
|
+
className: (0, _univerjs_design.clsx)(shimmerClassName, "univer-h-4 univer-w-24 univer-rounded"),
|
|
5630
|
+
style: shimmerStyle
|
|
5631
|
+
}),
|
|
5632
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5633
|
+
"data-u-comp": "workbench-skeleton-shimmer",
|
|
5634
|
+
className: (0, _univerjs_design.clsx)(shimmerClassName, "univer-ml-2 univer-size-6 univer-rounded"),
|
|
5635
|
+
style: shimmerStyle
|
|
5636
|
+
}),
|
|
5637
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5638
|
+
"data-u-comp": "workbench-skeleton-shimmer",
|
|
5639
|
+
className: (0, _univerjs_design.clsx)(shimmerClassName, "univer-size-6 univer-rounded"),
|
|
5640
|
+
style: shimmerStyle
|
|
5641
|
+
})
|
|
5642
|
+
]
|
|
5643
|
+
}),
|
|
5644
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("main", {
|
|
5645
|
+
"data-u-comp": "workbench-skeleton-content",
|
|
5646
|
+
className: "univer-flex univer-min-h-0 univer-min-w-0 univer-flex-1 univer-flex-col univer-gap-4 univer-p-4",
|
|
5647
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5648
|
+
"data-u-comp": "workbench-skeleton-shimmer",
|
|
5649
|
+
className: (0, _univerjs_design.clsx)(shimmerClassName, "univer-h-4 univer-w-1/3 univer-rounded"),
|
|
5650
|
+
style: shimmerStyle
|
|
5651
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5652
|
+
"data-u-comp": "workbench-skeleton-shimmer",
|
|
5653
|
+
className: (0, _univerjs_design.clsx)(shimmerClassName, "univer-flex-1 univer-rounded-md"),
|
|
5654
|
+
style: shimmerStyle
|
|
5655
|
+
})]
|
|
5656
|
+
}),
|
|
5657
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("footer", {
|
|
5658
|
+
"data-u-comp": "workbench-skeleton-footer",
|
|
5659
|
+
className: "univer-flex univer-h-10 univer-shrink-0 univer-items-center univer-justify-between univer-border-0 univer-border-t univer-border-solid univer-border-gray-200 univer-bg-white univer-px-4 dark:!univer-border-gray-700 dark:!univer-bg-gray-800",
|
|
5660
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5661
|
+
className: "univer-flex univer-items-center univer-gap-2",
|
|
5662
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5663
|
+
"data-u-comp": "workbench-skeleton-shimmer",
|
|
5664
|
+
className: (0, _univerjs_design.clsx)(shimmerClassName, "univer-size-5 univer-rounded"),
|
|
5665
|
+
style: shimmerStyle
|
|
5666
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5667
|
+
"data-u-comp": "workbench-skeleton-shimmer",
|
|
5668
|
+
className: (0, _univerjs_design.clsx)(shimmerClassName, "univer-h-5 univer-w-14 univer-rounded"),
|
|
5669
|
+
style: shimmerStyle
|
|
5670
|
+
})]
|
|
5671
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5672
|
+
className: "univer-flex univer-items-center univer-gap-2",
|
|
5673
|
+
children: [
|
|
5674
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5675
|
+
"data-u-comp": "workbench-skeleton-shimmer",
|
|
5676
|
+
className: (0, _univerjs_design.clsx)(shimmerClassName, "univer-size-5 univer-rounded"),
|
|
5677
|
+
style: shimmerStyle
|
|
5678
|
+
}),
|
|
5679
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5680
|
+
"data-u-comp": "workbench-skeleton-shimmer",
|
|
5681
|
+
className: (0, _univerjs_design.clsx)(shimmerClassName, "univer-h-2 univer-w-24 univer-rounded-full"),
|
|
5682
|
+
style: shimmerStyle
|
|
5683
|
+
}),
|
|
5684
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5685
|
+
"data-u-comp": "workbench-skeleton-shimmer",
|
|
5686
|
+
className: (0, _univerjs_design.clsx)(shimmerClassName, "univer-size-5 univer-rounded"),
|
|
5687
|
+
style: shimmerStyle
|
|
5688
|
+
})
|
|
5689
|
+
]
|
|
5690
|
+
})]
|
|
5691
|
+
})
|
|
5692
|
+
]
|
|
5693
|
+
});
|
|
5694
|
+
}
|
|
5695
|
+
|
|
5511
5696
|
//#endregion
|
|
5512
5697
|
//#region src/views/hooks/update-effect.ts
|
|
5513
5698
|
/**
|
|
@@ -5714,6 +5899,8 @@ function DesktopWorkbenchContent(props) {
|
|
|
5714
5899
|
var _uiConfig$popupRootId;
|
|
5715
5900
|
const { header = true, toolbar = true, footer = true, headerMenu = true, contextMenu = true, ribbonType = "classic", mountContainer, onRendered } = props;
|
|
5716
5901
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
5902
|
+
const lifecycleService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LifecycleService);
|
|
5903
|
+
const workbenchService = (0, _wendellhu_redi_react_bindings.useDependency)(IWorkbenchService);
|
|
5717
5904
|
const themeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ThemeService);
|
|
5718
5905
|
const themeSwitcherService = (0, _wendellhu_redi_react_bindings.useDependency)(ThemeSwitcherService);
|
|
5719
5906
|
const contentRef = (0, react.useRef)(null);
|
|
@@ -5726,6 +5913,9 @@ function DesktopWorkbenchContent(props) {
|
|
|
5726
5913
|
const leftSidebarComponents = useComponentsOfPart("left-sidebar");
|
|
5727
5914
|
const globalComponents = useComponentsOfPart("global");
|
|
5728
5915
|
const toolbarComponents = useComponentsOfPart("toolbar");
|
|
5916
|
+
const lifecycleStage = (0, _wendellhu_redi_react_bindings.useObservable)(lifecycleService.lifecycle$, lifecycleService.stage);
|
|
5917
|
+
const externalSkeletonVisible = (0, _wendellhu_redi_react_bindings.useObservable)(workbenchService.skeletonVisible$, void 0, true);
|
|
5918
|
+
const ready = lifecycleStage >= _univerjs_core.LifecycleStages.Ready;
|
|
5729
5919
|
const popupRootId = (_uiConfig$popupRootId = uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.popupRootId) !== null && _uiConfig$popupRootId !== void 0 ? _uiConfig$popupRootId : "univer-popup-portal";
|
|
5730
5920
|
(0, react.useLayoutEffect)(() => {
|
|
5731
5921
|
const sub = themeService.currentTheme$.subscribe((theme) => {
|
|
@@ -5741,8 +5931,8 @@ function DesktopWorkbenchContent(props) {
|
|
|
5741
5931
|
else document.documentElement.classList.remove("univer-dark");
|
|
5742
5932
|
}, [darkMode]);
|
|
5743
5933
|
(0, react.useEffect)(() => {
|
|
5744
|
-
if (contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
|
|
5745
|
-
}, [onRendered]);
|
|
5934
|
+
if (ready && contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
|
|
5935
|
+
}, [ready, onRendered]);
|
|
5746
5936
|
const locale = (0, _wendellhu_redi_react_bindings.useObservable)(() => localeService.localeChanged$.pipe((0, rxjs.map)(() => localeService.getLocales())), localeService.getLocales(), false, [localeService]);
|
|
5747
5937
|
const direction = (0, _wendellhu_redi_react_bindings.useObservable)(localeService.direction$, localeService.getDirection());
|
|
5748
5938
|
const portalContainer = (0, react.useMemo)(() => document.createElement("div"), []);
|
|
@@ -5760,61 +5950,68 @@ function DesktopWorkbenchContent(props) {
|
|
|
5760
5950
|
direction,
|
|
5761
5951
|
mountContainer: portalContainer,
|
|
5762
5952
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5763
|
-
"
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
className: "univer-
|
|
5790
|
-
children: [
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
className: "univer-relative univer-overflow-hidden dark:!univer-bg-gray-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5953
|
+
className: "univer-relative univer-h-full univer-min-h-0",
|
|
5954
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5955
|
+
"data-u-comp": "workbench-layout",
|
|
5956
|
+
className: (0, _univerjs_design.clsx)("univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800", { "univer-dark": darkMode }),
|
|
5957
|
+
tabIndex: -1,
|
|
5958
|
+
onBlur: (e) => e.stopPropagation(),
|
|
5959
|
+
onContextMenu: (e) => e.preventDefault(),
|
|
5960
|
+
dir: direction,
|
|
5961
|
+
children: [
|
|
5962
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5963
|
+
className: "univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",
|
|
5964
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: customHeaderComponents }, "custom-header")
|
|
5965
|
+
}),
|
|
5966
|
+
header && toolbar && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
|
|
5967
|
+
"data-u-comp": "headerbar",
|
|
5968
|
+
className: "univer-relative univer-z-10 univer-w-full univer-overflow-hidden",
|
|
5969
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, {
|
|
5970
|
+
components: toolbarComponents,
|
|
5971
|
+
sharedProps: {
|
|
5972
|
+
ribbonType,
|
|
5973
|
+
headerMenuComponents,
|
|
5974
|
+
headerMenu
|
|
5975
|
+
}
|
|
5976
|
+
}, "toolbar")
|
|
5977
|
+
}),
|
|
5978
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
5979
|
+
className: "univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",
|
|
5980
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5981
|
+
className: "univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",
|
|
5982
|
+
children: [
|
|
5983
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
|
|
5984
|
+
"data-u-comp": "left-sidebar",
|
|
5985
|
+
className: "univer-h-full",
|
|
5986
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: leftSidebarComponents }, "left-sidebar")
|
|
5987
|
+
}),
|
|
5988
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
5989
|
+
className: (0, _univerjs_design.clsx)("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800", _univerjs_design.borderBottomClassName),
|
|
5990
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", { children: header && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: headerComponents }, "header") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
5991
|
+
className: "univer-relative univer-overflow-hidden dark:!univer-bg-gray-900",
|
|
5992
|
+
ref: contentRef,
|
|
5993
|
+
"data-range-selector": true,
|
|
5994
|
+
onContextMenu: (e) => e.preventDefault(),
|
|
5995
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: contentComponents }, "content")
|
|
5996
|
+
})]
|
|
5997
|
+
}),
|
|
5998
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
|
|
5999
|
+
"data-u-comp": "right-sidebar",
|
|
6000
|
+
className: "univer-z-[100] univer-h-full",
|
|
6001
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sidebar, {})
|
|
6002
|
+
})
|
|
6003
|
+
]
|
|
6004
|
+
}), footer && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("footer", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, {
|
|
6005
|
+
components: footerComponents,
|
|
6006
|
+
sharedProps: { contextMenu }
|
|
6007
|
+
}, "footer") })]
|
|
6008
|
+
})
|
|
6009
|
+
]
|
|
6010
|
+
}), (!ready || externalSkeletonVisible) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WorkbenchSkeleton, {
|
|
6011
|
+
darkMode,
|
|
6012
|
+
direction,
|
|
6013
|
+
overlay: true
|
|
6014
|
+
})]
|
|
5818
6015
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5819
6016
|
dir: direction,
|
|
5820
6017
|
children: [
|
|
@@ -5859,6 +6056,9 @@ var SingleUnitUIController = class extends _univerjs_core.Disposable {
|
|
|
5859
6056
|
delete this._renderManagerService;
|
|
5860
6057
|
}
|
|
5861
6058
|
_bootstrapWorkbench() {
|
|
6059
|
+
var _this$_injector$get;
|
|
6060
|
+
const initialSkeleton = (_this$_injector$get = this._injector.get(IWorkbenchService, _univerjs_core.Quantity.OPTIONAL)) === null || _this$_injector$get === void 0 ? void 0 : _this$_injector$get.acquireSkeleton();
|
|
6061
|
+
if (initialSkeleton) this.disposeWithMe(initialSkeleton);
|
|
5862
6062
|
this.disposeWithMe(this.bootstrap(async (contentElement, containerElement) => {
|
|
5863
6063
|
if (this._layoutService) {
|
|
5864
6064
|
this.disposeWithMe(this._layoutService.registerRootContainerElement(containerElement));
|
|
@@ -5869,6 +6069,7 @@ var SingleUnitUIController = class extends _univerjs_core.Disposable {
|
|
|
5869
6069
|
this._renderTimeout = window.setTimeout(() => {
|
|
5870
6070
|
const allRenders = this._renderManagerService.getRenderAll();
|
|
5871
6071
|
for (const [key] of allRenders) if (this._changeRenderUnit(key, contentElement)) break;
|
|
6072
|
+
requestAnimationFrame(() => requestAnimationFrame(() => initialSkeleton === null || initialSkeleton === void 0 ? void 0 : initialSkeleton.dispose()));
|
|
5872
6073
|
this.disposeWithMe(this._instanceService.focused$.subscribe((unit) => {
|
|
5873
6074
|
if (unit) this._changeRenderUnit(unit, contentElement);
|
|
5874
6075
|
}));
|
|
@@ -5896,9 +6097,9 @@ var SingleUnitUIController = class extends _univerjs_core.Disposable {
|
|
|
5896
6097
|
var _this$_instanceServic2;
|
|
5897
6098
|
if (this._currentRenderId === rendererId) return false;
|
|
5898
6099
|
if ((_this$_instanceServic2 = this._instanceService.getUnitCreateOptions(rendererId)) === null || _this$_instanceServic2 === void 0 ? void 0 : _this$_instanceServic2.embeddedRender) return false;
|
|
5899
|
-
const renderer = this._renderManagerService.
|
|
6100
|
+
const renderer = this._renderManagerService.getRenderUnitById(rendererId);
|
|
5900
6101
|
if (!renderer || !renderer.unitId || (0, _univerjs_core.isInternalEditorID)(renderer.unitId)) return false;
|
|
5901
|
-
const currentRenderer = this._currentRenderId ? this._renderManagerService.
|
|
6102
|
+
const currentRenderer = this._currentRenderId ? this._renderManagerService.getRenderUnitById(this._currentRenderId) : null;
|
|
5902
6103
|
currentRenderer === null || currentRenderer === void 0 || currentRenderer.deactivate();
|
|
5903
6104
|
currentRenderer === null || currentRenderer === void 0 || currentRenderer.engine.unmount();
|
|
5904
6105
|
renderer.engine.mount(contentElement);
|
|
@@ -5970,7 +6171,7 @@ const IUIController = (0, _univerjs_core.createIdentifier)("univer.ui.ui-control
|
|
|
5970
6171
|
//#endregion
|
|
5971
6172
|
//#region package.json
|
|
5972
6173
|
var name = "@univerjs/ui";
|
|
5973
|
-
var version = "1.0.0-alpha.
|
|
6174
|
+
var version = "1.0.0-alpha.8";
|
|
5974
6175
|
|
|
5975
6176
|
//#endregion
|
|
5976
6177
|
//#region src/views/color-picker/interface.ts
|
|
@@ -6064,7 +6265,7 @@ function ShortcutPanel() {
|
|
|
6064
6265
|
if (!shortcutGroups.has(group)) shortcutGroups.set(group, []);
|
|
6065
6266
|
shortcutGroups.get(group).push(shortcutItem);
|
|
6066
6267
|
}
|
|
6067
|
-
|
|
6268
|
+
const toRender = Array.from(shortcutGroups.entries()).map(([name, items]) => {
|
|
6068
6269
|
const groupSequence = name.split("_")[0];
|
|
6069
6270
|
const localeKey = groupTitles.get(name);
|
|
6070
6271
|
return {
|
|
@@ -6072,7 +6273,8 @@ function ShortcutPanel() {
|
|
|
6072
6273
|
name: localeService.t(localeKey),
|
|
6073
6274
|
items: (0, _univerjs_core.dedupeBy)(items, (item) => item.title + item.shortcut)
|
|
6074
6275
|
};
|
|
6075
|
-
}).sort((a, b) => a.sequence - b.sequence)
|
|
6276
|
+
}).sort((a, b) => a.sequence - b.sequence);
|
|
6277
|
+
setShortcutItems(toRender);
|
|
6076
6278
|
}, [
|
|
6077
6279
|
shortcutService,
|
|
6078
6280
|
localeService,
|
|
@@ -22892,6 +23094,8 @@ function mountMobileWorkbench(injector, options, mountContainer, onRendered) {
|
|
|
22892
23094
|
function MobileWorkbench(props) {
|
|
22893
23095
|
const { header = true, toolbar = true, footer = true, headerMenu = true, ribbonType = "classic", contextMenu = true, mountContainer, onRendered } = props;
|
|
22894
23096
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
23097
|
+
const lifecycleService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LifecycleService);
|
|
23098
|
+
const workbenchService = (0, _wendellhu_redi_react_bindings.useDependency)(IWorkbenchService);
|
|
22895
23099
|
const themeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ThemeService);
|
|
22896
23100
|
const themeSwitcherService = (0, _wendellhu_redi_react_bindings.useDependency)(ThemeSwitcherService);
|
|
22897
23101
|
const contentRef = (0, react.useRef)(null);
|
|
@@ -22903,9 +23107,12 @@ function MobileWorkbench(props) {
|
|
|
22903
23107
|
const globalComponents = useComponentsOfPart("global");
|
|
22904
23108
|
const toolbarComponents = useComponentsOfPart("toolbar");
|
|
22905
23109
|
const darkMode = (0, _wendellhu_redi_react_bindings.useObservable)(themeService.darkMode$, themeService.darkMode);
|
|
23110
|
+
const lifecycleStage = (0, _wendellhu_redi_react_bindings.useObservable)(lifecycleService.lifecycle$, lifecycleService.stage);
|
|
23111
|
+
const externalSkeletonVisible = (0, _wendellhu_redi_react_bindings.useObservable)(workbenchService.skeletonVisible$, void 0, true);
|
|
23112
|
+
const ready = lifecycleStage >= _univerjs_core.LifecycleStages.Ready;
|
|
22906
23113
|
(0, react.useEffect)(() => {
|
|
22907
|
-
if (contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
|
|
22908
|
-
}, [onRendered]);
|
|
23114
|
+
if (ready && contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
|
|
23115
|
+
}, [ready, onRendered]);
|
|
22909
23116
|
const locale = (0, _wendellhu_redi_react_bindings.useObservable)(() => localeService.localeChanged$.pipe((0, rxjs.map)(() => localeService.getLocales())), localeService.getLocales(), false, [localeService]);
|
|
22910
23117
|
const direction = (0, _wendellhu_redi_react_bindings.useObservable)(localeService.direction$, localeService.getDirection());
|
|
22911
23118
|
const portalContainer = (0, react.useMemo)(() => document.createElement("div"), []);
|
|
@@ -22931,51 +23138,58 @@ function MobileWorkbench(props) {
|
|
|
22931
23138
|
direction,
|
|
22932
23139
|
mountContainer: portalContainer,
|
|
22933
23140
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
22934
|
-
"
|
|
22935
|
-
|
|
22936
|
-
|
|
22937
|
-
|
|
22938
|
-
|
|
22939
|
-
|
|
22940
|
-
|
|
22941
|
-
|
|
22942
|
-
|
|
22943
|
-
|
|
22944
|
-
|
|
22945
|
-
|
|
22946
|
-
|
|
22947
|
-
|
|
22948
|
-
|
|
22949
|
-
|
|
22950
|
-
|
|
22951
|
-
|
|
22952
|
-
|
|
22953
|
-
|
|
22954
|
-
className: "univer-
|
|
22955
|
-
children: [
|
|
22956
|
-
|
|
22957
|
-
|
|
22958
|
-
|
|
22959
|
-
|
|
22960
|
-
|
|
22961
|
-
|
|
22962
|
-
|
|
22963
|
-
className: "univer-
|
|
22964
|
-
children:
|
|
22965
|
-
|
|
22966
|
-
|
|
22967
|
-
|
|
22968
|
-
|
|
22969
|
-
|
|
22970
|
-
|
|
22971
|
-
|
|
22972
|
-
|
|
22973
|
-
|
|
22974
|
-
|
|
22975
|
-
|
|
22976
|
-
|
|
22977
|
-
|
|
22978
|
-
|
|
23141
|
+
className: "univer-relative univer-h-full univer-min-h-0",
|
|
23142
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
23143
|
+
"data-u-comp": "app-layout",
|
|
23144
|
+
className: (0, _univerjs_design.clsx)("univer-relative univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800", { "univer-dark": darkMode }),
|
|
23145
|
+
tabIndex: -1,
|
|
23146
|
+
onBlur: (e) => e.stopPropagation(),
|
|
23147
|
+
onContextMenu: (e) => e.preventDefault(),
|
|
23148
|
+
dir: direction,
|
|
23149
|
+
children: [header && toolbar && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
|
|
23150
|
+
"data-u-comp": "headerbar",
|
|
23151
|
+
className: "univer-relative univer-z-10 univer-w-full univer-overflow-hidden",
|
|
23152
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, {
|
|
23153
|
+
components: toolbarComponents,
|
|
23154
|
+
sharedProps: {
|
|
23155
|
+
ribbonType,
|
|
23156
|
+
headerMenuComponents,
|
|
23157
|
+
headerMenu
|
|
23158
|
+
}
|
|
23159
|
+
}, "toolbar")
|
|
23160
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
23161
|
+
className: "univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",
|
|
23162
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
23163
|
+
className: "univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",
|
|
23164
|
+
children: [
|
|
23165
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
|
|
23166
|
+
className: "univer-h-full",
|
|
23167
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: leftSidebarComponents }, "left-sidebar")
|
|
23168
|
+
}),
|
|
23169
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
23170
|
+
className: (0, _univerjs_design.clsx)("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800", _univerjs_design.borderBottomClassName),
|
|
23171
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
|
|
23172
|
+
className: "univer-w-screen",
|
|
23173
|
+
children: header && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: headerComponents }, "header")
|
|
23174
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
23175
|
+
ref: contentRef,
|
|
23176
|
+
className: "univer-relative univer-overflow-hidden",
|
|
23177
|
+
"data-range-selector": true,
|
|
23178
|
+
onContextMenu: (e) => e.preventDefault(),
|
|
23179
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: contentComponents }, "content")
|
|
23180
|
+
})]
|
|
23181
|
+
}),
|
|
23182
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
|
|
23183
|
+
className: "univer-h-full",
|
|
23184
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sidebar, {})
|
|
23185
|
+
})
|
|
23186
|
+
]
|
|
23187
|
+
}), footer && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("footer", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: footerComponents }, "footer") })]
|
|
23188
|
+
})]
|
|
23189
|
+
}), (!ready || externalSkeletonVisible) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WorkbenchSkeleton, {
|
|
23190
|
+
darkMode,
|
|
23191
|
+
direction,
|
|
23192
|
+
overlay: true
|
|
22979
23193
|
})]
|
|
22980
23194
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
22981
23195
|
dir: direction,
|
|
@@ -24189,6 +24403,7 @@ let UniverMobileUIPlugin = class UniverMobileUIPlugin extends _univerjs_core.Plu
|
|
|
24189
24403
|
[IconManager],
|
|
24190
24404
|
[ComponentsController],
|
|
24191
24405
|
[ThemeSwitcherService],
|
|
24406
|
+
[IWorkbenchService, { useClass: WorkbenchService }],
|
|
24192
24407
|
[ZIndexManager],
|
|
24193
24408
|
[ShortcutPanelService],
|
|
24194
24409
|
[IUIPartsService, { useClass: UIPartsService }],
|
|
@@ -24294,6 +24509,7 @@ let UniverUIPlugin = class UniverUIPlugin extends _univerjs_core.Plugin {
|
|
|
24294
24509
|
[ZIndexManager],
|
|
24295
24510
|
[ShortcutPanelService],
|
|
24296
24511
|
[IUIPartsService, { useClass: UIPartsService }],
|
|
24512
|
+
[IWorkbenchService, { useClass: WorkbenchService }],
|
|
24297
24513
|
[ILayoutService, { useClass: DesktopLayoutService }],
|
|
24298
24514
|
[IRibbonService, { useClass: DesktopRibbonService }],
|
|
24299
24515
|
[IRibbonOverrideService, { useClass: RibbonOverrideService }],
|
|
@@ -24523,8 +24739,10 @@ function handleStringToStyle($dom, cssStyle = "") {
|
|
|
24523
24739
|
else styleList.bl = 0;
|
|
24524
24740
|
else if (key === "font-style") if (value === "italic") styleList.it = 1;
|
|
24525
24741
|
else styleList.it = 0;
|
|
24526
|
-
else if (key === "font-family")
|
|
24527
|
-
|
|
24742
|
+
else if (key === "font-family") {
|
|
24743
|
+
const fontFamily = extractFontFamily(textTrim(originStr));
|
|
24744
|
+
styleList.ff = fontFamily;
|
|
24745
|
+
} else if (key === "font-size") {
|
|
24528
24746
|
let fs = Number.parseInt(value);
|
|
24529
24747
|
if (cssText.indexOf("vertical-align") > -1 && (cssText.indexOf("sub") > -1 || cssText.indexOf("sup") > -1)) fs *= 2;
|
|
24530
24748
|
if (value.indexOf("px") !== -1) fs = getPtFontSizeByPx(Number.parseInt(value, 10));
|
|
@@ -25325,6 +25543,7 @@ exports.ISidebarService = ISidebarService;
|
|
|
25325
25543
|
exports.IUIController = IUIController;
|
|
25326
25544
|
exports.IUIPartsService = IUIPartsService;
|
|
25327
25545
|
exports.IUIRuntimeScopeService = IUIRuntimeScopeService;
|
|
25546
|
+
exports.IWorkbenchService = IWorkbenchService;
|
|
25328
25547
|
Object.defineProperty(exports, 'IconManager', {
|
|
25329
25548
|
enumerable: true,
|
|
25330
25549
|
get: function () {
|
|
@@ -25343,6 +25562,7 @@ Object.defineProperty(exports, 'MenuManagerService', {
|
|
|
25343
25562
|
exports.MetaKeys = MetaKeys;
|
|
25344
25563
|
exports.MobileContextMenu = MobileContextMenu;
|
|
25345
25564
|
exports.MockMessageService = MockMessageService;
|
|
25565
|
+
exports.NativeTextEditorShortcutBehavior = NativeTextEditorShortcutBehavior;
|
|
25346
25566
|
exports.PLAIN_TEXT_CLIPBOARD_MIME_TYPE = PLAIN_TEXT_CLIPBOARD_MIME_TYPE;
|
|
25347
25567
|
exports.PasteCommand = PasteCommand;
|
|
25348
25568
|
exports.PlatformService = PlatformService;
|
|
@@ -25433,6 +25653,7 @@ Object.defineProperty(exports, 'WithDependency', {
|
|
|
25433
25653
|
return _wendellhu_redi_react_bindings.WithDependency;
|
|
25434
25654
|
}
|
|
25435
25655
|
});
|
|
25656
|
+
exports.WorkbenchService = WorkbenchService;
|
|
25436
25657
|
exports.ZIndexManager = ZIndexManager;
|
|
25437
25658
|
exports.ZoomInput = ZoomInput;
|
|
25438
25659
|
Object.defineProperty(exports, 'connectDependencies', {
|