@univerjs/ui 0.2.7 → 0.2.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/index.js +2 -2
- package/lib/es/index.js +119 -10
- package/lib/types/commands/operations/editor/set-editor-resize.operation.d.ts +0 -1
- package/lib/types/commands/operations/toggle-shortcut-panel.operation.d.ts +0 -1
- package/lib/types/common/component-manager.d.ts +0 -1
- package/lib/types/common/lifecycle.d.ts +0 -1
- package/lib/types/common/menu-hidden-observable.d.ts +0 -1
- package/lib/types/common/menu-merge-configs.d.ts +0 -1
- package/lib/types/components/custom-label/CustomLabel.d.ts +0 -1
- package/lib/types/components/editor/TextEditor.d.ts +0 -1
- package/lib/types/components/font-family/FontFamily.d.ts +0 -1
- package/lib/types/components/font-family/FontFamilyItem.d.ts +0 -1
- package/lib/types/components/font-family/interface.d.ts +0 -1
- package/lib/types/components/font-size/FontSize.d.ts +0 -1
- package/lib/types/components/font-size/interface.d.ts +0 -1
- package/lib/types/components/hooks/layout.d.ts +0 -1
- package/lib/types/components/hooks/locale.d.ts +0 -1
- package/lib/types/components/hooks/observable.d.ts +0 -1
- package/lib/types/components/hooks/virtual-list.d.ts +35 -0
- package/lib/types/components/menu/common/hook.d.ts +0 -1
- package/lib/types/components/menu/desktop/Menu.d.ts +0 -1
- package/lib/types/components/menu/mobile/MobileMenu.d.ts +0 -1
- package/lib/types/components/menu/mobile/MobileMenu.stories.d.ts +0 -1
- package/lib/types/components/notification/Notification.d.ts +0 -1
- package/lib/types/components/notification/Notification.stories.d.ts +0 -1
- package/lib/types/components/progress-bar/ProgressBar.d.ts +0 -1
- package/lib/types/components/range-selector/RangeSelector.d.ts +0 -1
- package/lib/types/controllers/error/error.controller.d.ts +0 -1
- package/lib/types/controllers/menus/menus.d.ts +0 -1
- package/lib/types/controllers/shared-shortcut.controller.d.ts +0 -1
- package/lib/types/controllers/shortcut-display/menu.d.ts +0 -1
- package/lib/types/controllers/shortcut-display/shortcut-panel.controller.d.ts +0 -1
- package/lib/types/controllers/ui/ui-desktop.controller.d.ts +0 -1
- package/lib/types/controllers/ui/ui-mobile.controller.d.ts +0 -1
- package/lib/types/controllers/ui/ui.controller.d.ts +0 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/locale/en-US.d.ts +0 -1
- package/lib/types/locale/ru-RU.d.ts +0 -1
- package/lib/types/locale/vi-VN.d.ts +0 -1
- package/lib/types/locale/zh-TW.d.ts +0 -1
- package/lib/types/mobile-ui-plugin.d.ts +0 -1
- package/lib/types/services/before-close/before-close.service.d.ts +0 -1
- package/lib/types/services/clipboard/clipboard-interface.service.d.ts +0 -1
- package/lib/types/services/clipboard/clipboard.command.d.ts +0 -1
- package/lib/types/services/confirm/confirm.service.d.ts +0 -1
- package/lib/types/services/confirm/desktop-confirm.service.d.ts +0 -1
- package/lib/types/services/contextmenu/contextmenu.service.d.ts +0 -1
- package/lib/types/services/dialog/desktop-dialog.service.d.ts +0 -1
- package/lib/types/services/dialog/dialog.service.d.ts +0 -1
- package/lib/types/services/dom/canvas-dom-layer.service.d.ts +0 -1
- package/lib/types/services/editor/editor.service.d.ts +0 -1
- package/lib/types/services/global-zone/desktop-global-zone.service.d.ts +0 -1
- package/lib/types/services/global-zone/global-zone.service.d.ts +0 -1
- package/lib/types/services/layout/layout.service.d.ts +0 -1
- package/lib/types/services/local-storage/local-storage.service.d.ts +0 -1
- package/lib/types/services/menu/menu.d.ts +0 -1
- package/lib/types/services/menu/menu.service.d.ts +1 -1
- package/lib/types/services/message/__testing__/mock-message.service.d.ts +0 -1
- package/lib/types/services/message/desktop-message.service.d.ts +0 -1
- package/lib/types/services/message/message.service.d.ts +0 -1
- package/lib/types/services/notification/desktop-notification.service.d.ts +0 -1
- package/lib/types/services/notification/notification.service.d.ts +0 -1
- package/lib/types/services/parts/parts.service.d.ts +0 -1
- package/lib/types/services/popup/canvas-popup.service.d.ts +2 -1
- package/lib/types/services/progress/progress.service.d.ts +0 -1
- package/lib/types/services/range-selector/range-selector.service.d.ts +0 -1
- package/lib/types/services/shortcut/shortcut-panel.service.d.ts +0 -1
- package/lib/types/services/shortcut/shortcut.service.d.ts +0 -1
- package/lib/types/services/sidebar/desktop-sidebar.service.d.ts +0 -1
- package/lib/types/services/sidebar/sidebar.service.d.ts +0 -1
- package/lib/types/services/zen-zone/desktop-zen-zone.service.d.ts +0 -1
- package/lib/types/services/zen-zone/zen-zone.service.d.ts +0 -1
- package/lib/types/ui-plugin.d.ts +0 -1
- package/lib/types/utils/cell.d.ts +0 -1
- package/lib/types/views/MobileApp.d.ts +0 -1
- package/lib/types/views/components/ComponentContainer.d.ts +0 -1
- package/lib/types/views/components/confirm-part/ConfirmPart.d.ts +0 -1
- package/lib/types/views/components/confirm-part/interface.d.ts +0 -1
- package/lib/types/views/components/context-menu/ContextMenu.d.ts +0 -1
- package/lib/types/views/components/context-menu/MobileContextMenu.d.ts +0 -1
- package/lib/types/views/components/dialog-part/DialogPart.d.ts +0 -1
- package/lib/types/views/components/dialog-part/interface.d.ts +0 -1
- package/lib/types/views/components/doc-bars/Button/ToolbarButton.d.ts +0 -1
- package/lib/types/views/components/doc-bars/Toolbar.d.ts +0 -1
- package/lib/types/views/components/doc-bars/ToolbarItem.d.ts +0 -1
- package/lib/types/views/components/doc-bars/hook.d.ts +0 -1
- package/lib/types/views/components/dom/FloatDom.d.ts +0 -1
- package/lib/types/views/components/global-zone/GlobalZone.d.ts +0 -1
- package/lib/types/views/components/popup/CanvasPopup.d.ts +0 -1
- package/lib/types/views/components/shortcut-panel/ShortcutPanel.d.ts +0 -1
- package/lib/types/views/components/sidebar/Sidebar.d.ts +0 -1
- package/lib/types/views/components/sidebar/interface.d.ts +0 -1
- package/lib/types/views/components/zen-zone/ZenZone.d.ts +0 -1
- package/lib/types/views/parts.d.ts +0 -1
- package/lib/types/views/workbench/Workbench.d.ts +0 -1
- package/lib/umd/index.js +2 -2
- package/package.json +14 -14
package/lib/es/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
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
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, IUndoRedoService, UndoCommand, RedoCommand, Injector, runOnLifecycle, Tools, isRealNum, useInjector, ThemeService, connectInjector, LifecycleService, IConfigService, isInternalEditorID, ILogService, ErrorService, Plugin, mergeOverrideWithDependencies, ILocalStorageService, DependentOn, makeArray, useObservable as useObservable$2, BaselineOffset, getBorderStyleType, BorderStyleTypes, debounce } from "@univerjs/core";
|
|
10
|
-
import { Observable, isObservable, Subject, fromEvent, switchMap, BehaviorSubject, filter, map as map$1, startWith, combineLatest, distinctUntilChanged } from "rxjs";
|
|
10
|
+
import { Observable, isObservable, Subject, fromEvent, switchMap, BehaviorSubject, throttleTime, filter, map as map$1, startWith, combineLatest, distinctUntilChanged } from "rxjs";
|
|
11
11
|
import * as React from "react";
|
|
12
12
|
import React__default, { forwardRef, useRef, createElement, cloneElement, useEffect, useMemo, useState, useCallback, memo, useContext, version as version$1, isValidElement, useLayoutEffect } from "react";
|
|
13
13
|
import { IRenderManagerService, ITextSelectionRenderManager, UniverRenderEnginePlugin, ptToPx } from "@univerjs/engine-render";
|
|
@@ -1417,7 +1417,87 @@ function t$1(localeService, key, ...args) {
|
|
|
1417
1417
|
return localeService.t(key);
|
|
1418
1418
|
}
|
|
1419
1419
|
__name(t$1, "t$1");
|
|
1420
|
-
const
|
|
1420
|
+
const isNumber = /* @__PURE__ */ __name((value) => typeof value == "number", "isNumber");
|
|
1421
|
+
function useLatest(value) {
|
|
1422
|
+
const ref = useRef(value);
|
|
1423
|
+
return ref.current = value, ref;
|
|
1424
|
+
}
|
|
1425
|
+
__name(useLatest, "useLatest");
|
|
1426
|
+
const useVirtualList = /* @__PURE__ */ __name((list, options) => {
|
|
1427
|
+
const { containerTarget, itemHeight, overscan = 5 } = options, itemHeightRef = useLatest(itemHeight), [size, setSize] = useState(null), scrollTriggerByScrollToFunc = useRef(!1), [targetList, setTargetList] = useState([]), [wrapperStyle, setWrapperStyle] = useState({ height: void 0, marginTop: void 0 }), getVisibleCount = /* @__PURE__ */ __name((containerHeight, fromIndex) => {
|
|
1428
|
+
if (typeof itemHeightRef.current == "number")
|
|
1429
|
+
return Math.ceil(containerHeight / itemHeightRef.current);
|
|
1430
|
+
let sum = 0, endIndex = 0;
|
|
1431
|
+
for (let i = fromIndex; i < list.length; i++) {
|
|
1432
|
+
const height = itemHeightRef.current(i, list[i]);
|
|
1433
|
+
if (sum += height, endIndex = i, sum >= containerHeight)
|
|
1434
|
+
break;
|
|
1435
|
+
}
|
|
1436
|
+
return endIndex - fromIndex;
|
|
1437
|
+
}, "getVisibleCount"), getOffset = /* @__PURE__ */ __name((scrollTop) => {
|
|
1438
|
+
if (isNumber(itemHeightRef.current))
|
|
1439
|
+
return Math.floor(scrollTop / itemHeightRef.current);
|
|
1440
|
+
let sum = 0, offset = 0;
|
|
1441
|
+
for (let i = 0; i < list.length; i++) {
|
|
1442
|
+
const height = itemHeightRef.current(i, list[i]);
|
|
1443
|
+
if (sum += height, sum >= scrollTop) {
|
|
1444
|
+
offset = i;
|
|
1445
|
+
break;
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
return offset + 1;
|
|
1449
|
+
}, "getOffset"), getDistanceTop = /* @__PURE__ */ __name((index) => typeof itemHeightRef.current == "number" ? index * itemHeightRef.current : list.slice(0, index).reduce((sum, _, i) => sum + itemHeightRef.current(i, list[i]), 0), "getDistanceTop"), totalHeight = useMemo(() => isNumber(itemHeightRef.current) ? list.length * itemHeightRef.current : list.reduce(
|
|
1450
|
+
(sum, _, index) => sum + itemHeightRef.current(index, list[index]),
|
|
1451
|
+
0
|
|
1452
|
+
), [list]), calculateRange = /* @__PURE__ */ __name(() => {
|
|
1453
|
+
const container = containerTarget.current;
|
|
1454
|
+
if (container) {
|
|
1455
|
+
const { scrollTop, clientHeight } = container, offset = getOffset(scrollTop), visibleCount = getVisibleCount(clientHeight, offset), start = Math.max(0, offset - overscan), end = Math.min(list.length, offset + visibleCount + overscan), offsetTop = getDistanceTop(start);
|
|
1456
|
+
setWrapperStyle({
|
|
1457
|
+
height: `${totalHeight - offsetTop}px`,
|
|
1458
|
+
marginTop: `${offsetTop}px`
|
|
1459
|
+
}), setTargetList(
|
|
1460
|
+
list.slice(start, end).map((ele, index) => ({
|
|
1461
|
+
data: ele,
|
|
1462
|
+
index: index + start
|
|
1463
|
+
}))
|
|
1464
|
+
);
|
|
1465
|
+
}
|
|
1466
|
+
}, "calculateRange");
|
|
1467
|
+
return useEffect(() => {
|
|
1468
|
+
if (containerTarget.current) {
|
|
1469
|
+
const getSize = /* @__PURE__ */ __name(() => {
|
|
1470
|
+
const width = containerTarget.current.clientWidth, height = containerTarget.current.clientHeight;
|
|
1471
|
+
(width !== (size == null ? void 0 : size.width) || height !== (size == null ? void 0 : size.height)) && setSize({ width, height });
|
|
1472
|
+
}, "getSize");
|
|
1473
|
+
getSize();
|
|
1474
|
+
const ob = new ResizeObserver(getSize);
|
|
1475
|
+
return ob.observe(containerTarget.current), () => {
|
|
1476
|
+
ob.disconnect();
|
|
1477
|
+
};
|
|
1478
|
+
}
|
|
1479
|
+
}, []), useEffect(() => {
|
|
1480
|
+
!(size != null && size.width) || !(size != null && size.height) || calculateRange();
|
|
1481
|
+
}, [size == null ? void 0 : size.width, size == null ? void 0 : size.height, list]), [
|
|
1482
|
+
targetList,
|
|
1483
|
+
{
|
|
1484
|
+
wrapperStyle,
|
|
1485
|
+
scrollTo: useEvent$1(/* @__PURE__ */ __name((index) => {
|
|
1486
|
+
const container = containerTarget.current;
|
|
1487
|
+
container && (scrollTriggerByScrollToFunc.current = !0, container.scrollTop = getDistanceTop(index), calculateRange());
|
|
1488
|
+
}, "scrollTo")),
|
|
1489
|
+
containerProps: {
|
|
1490
|
+
onScroll: /* @__PURE__ */ __name((e2) => {
|
|
1491
|
+
if (scrollTriggerByScrollToFunc.current) {
|
|
1492
|
+
scrollTriggerByScrollToFunc.current = !1;
|
|
1493
|
+
return;
|
|
1494
|
+
}
|
|
1495
|
+
e2.preventDefault(), calculateRange();
|
|
1496
|
+
}, "onScroll")
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
];
|
|
1500
|
+
}, "useVirtualList"), CopyCommandName = "univer.command.copy", CopyCommand = {
|
|
1421
1501
|
id: CopyCommandName,
|
|
1422
1502
|
name: CopyCommandName,
|
|
1423
1503
|
multi: !0,
|
|
@@ -2158,7 +2238,7 @@ let MenuService = (_a3 = class extends Disposable {
|
|
|
2158
2238
|
return [];
|
|
2159
2239
|
}
|
|
2160
2240
|
setMenuItem(item) {
|
|
2161
|
-
this._menuItemMap.set(item.id, item), this._menuChanged$.next();
|
|
2241
|
+
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();
|
|
2162
2242
|
}
|
|
2163
2243
|
getMenuItem(id) {
|
|
2164
2244
|
return this._menuItemMap.has(id) ? this._menuItemMap.get(id) : null;
|
|
@@ -2183,6 +2263,11 @@ let MenuService = (_a3 = class extends Disposable {
|
|
|
2183
2263
|
throw new Error(`Menu item with the same id ${menu.id} has already been added!`);
|
|
2184
2264
|
menuList.push([menu.id, menu]);
|
|
2185
2265
|
}
|
|
2266
|
+
_updateMenuItems(menu, position) {
|
|
2267
|
+
this._menuByPositions.has(position) || this._menuByPositions.set(position, []);
|
|
2268
|
+
const menuList = this._menuByPositions.get(position), index = menuList.findIndex((m2) => m2[0] === menu.id);
|
|
2269
|
+
index > -1 ? menuList[index] = [menu.id, menu] : menuList.push([menu.id, menu]);
|
|
2270
|
+
}
|
|
2186
2271
|
}, __name(_a3, "MenuService"), _a3);
|
|
2187
2272
|
MenuService = __decorateClass$e([
|
|
2188
2273
|
__decorateParam$e(0, IShortcutService)
|
|
@@ -2886,7 +2971,10 @@ const ICanvasPopupService = createIdentifier("ui.popup.service"), _CanvasPopupSe
|
|
|
2886
2971
|
__name(_CanvasPopupService, "CanvasPopupService");
|
|
2887
2972
|
let CanvasPopupService = _CanvasPopupService;
|
|
2888
2973
|
const SingleCanvasPopup = /* @__PURE__ */ __name(({ popup, children }) => {
|
|
2889
|
-
const
|
|
2974
|
+
const [hidden, setHidden] = useState(!1), anchorRect$ = useMemo(() => popup.anchorRect$.pipe(throttleTime(16)), [popup.anchorRect$]), excludeRects$ = useMemo(() => {
|
|
2975
|
+
var _a18;
|
|
2976
|
+
return (_a18 = popup.excludeRects$) == null ? void 0 : _a18.pipe(throttleTime(16));
|
|
2977
|
+
}, [popup.excludeRects$]), anchorRect = useObservable(anchorRect$, popup.anchorRect), excludeRects = useObservable(excludeRects$, popup.excludeRects), { bottom, left, right, top } = anchorRect, { offset, canvasElement, hideOnInvisible = !0 } = popup, rectWithOffset = useMemo(() => {
|
|
2890
2978
|
const [x = 0, y = 0] = offset != null ? offset : [];
|
|
2891
2979
|
return {
|
|
2892
2980
|
left: left - x,
|
|
@@ -2895,7 +2983,12 @@ const SingleCanvasPopup = /* @__PURE__ */ __name(({ popup, children }) => {
|
|
|
2895
2983
|
bottom: bottom + y
|
|
2896
2984
|
};
|
|
2897
2985
|
}, [bottom, left, right, top, offset]);
|
|
2898
|
-
return
|
|
2986
|
+
return useEffect(() => {
|
|
2987
|
+
if (!hideOnInvisible)
|
|
2988
|
+
return;
|
|
2989
|
+
const rect = canvasElement.getBoundingClientRect(), { top: top2, left: left2, bottom: bottom2, right: right2 } = rect;
|
|
2990
|
+
rectWithOffset.bottom < top2 || rectWithOffset.top > bottom2 || rectWithOffset.right < left2 || rectWithOffset.left > right2 ? setHidden(!0) : setHidden(!1);
|
|
2991
|
+
}, [rectWithOffset, canvasElement, hideOnInvisible]), hidden ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2899
2992
|
RectPopup,
|
|
2900
2993
|
{
|
|
2901
2994
|
anchorRect: rectWithOffset,
|
|
@@ -3046,6 +3139,19 @@ function MenuWrapper(props) {
|
|
|
3046
3139
|
if (!menuType)
|
|
3047
3140
|
return null;
|
|
3048
3141
|
if (Array.isArray(menuType)) {
|
|
3142
|
+
let filterData = /* @__PURE__ */ __name(function(data) {
|
|
3143
|
+
return data.map((group2) => {
|
|
3144
|
+
const filteredGroup2 = {};
|
|
3145
|
+
return Object.entries(group2).forEach(([key, items]) => {
|
|
3146
|
+
const hiddenObservables = items.map((item) => item.hidden$).filter((item) => !!item);
|
|
3147
|
+
combineLatest(hiddenObservables).pipe(
|
|
3148
|
+
map$1((hiddenValues) => hiddenValues.every((hidden) => hidden === !0))
|
|
3149
|
+
).subscribe((allHidden) => {
|
|
3150
|
+
allHidden || (filteredGroup2[key] = items);
|
|
3151
|
+
}).unsubscribe();
|
|
3152
|
+
}), filteredGroup2;
|
|
3153
|
+
}).filter((group2) => Object.keys(group2).length > 0);
|
|
3154
|
+
}, "filterData");
|
|
3049
3155
|
const group = menuType.map((type) => menuService.getMenuItems(type)).map(
|
|
3050
3156
|
(menuItems2) => menuItems2.reduce(
|
|
3051
3157
|
(acc, item) => {
|
|
@@ -3054,8 +3160,8 @@ function MenuWrapper(props) {
|
|
|
3054
3160
|
},
|
|
3055
3161
|
{}
|
|
3056
3162
|
)
|
|
3057
|
-
);
|
|
3058
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children:
|
|
3163
|
+
), filteredGroup = useMemo(() => filterData(group), [group]);
|
|
3164
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: filteredGroup.map(
|
|
3059
3165
|
(groupItem) => Object.keys(groupItem).map((groupKey) => /* @__PURE__ */ jsxRuntimeExports.jsx(MenuItemGroup, { eventKey: groupKey, children: groupItem[groupKey].map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3060
3166
|
MenuItem,
|
|
3061
3167
|
{
|
|
@@ -3115,7 +3221,7 @@ function MenuOptionsWrapper(props) {
|
|
|
3115
3221
|
]
|
|
3116
3222
|
}
|
|
3117
3223
|
) }, key);
|
|
3118
|
-
})) != null ? _a18 :
|
|
3224
|
+
})) != null ? _a18 : null;
|
|
3119
3225
|
}
|
|
3120
3226
|
__name(MenuOptionsWrapper, "MenuOptionsWrapper");
|
|
3121
3227
|
const Menu = /* @__PURE__ */ __name((props) => {
|
|
@@ -3522,6 +3628,7 @@ const ToolbarItem = forwardRef((props, ref) => {
|
|
|
3522
3628
|
[styles$b.toolbarItemSelectButtonArrowActivated]: activated
|
|
3523
3629
|
}),
|
|
3524
3630
|
"data-disabled": disabled,
|
|
3631
|
+
onClick: /* @__PURE__ */ __name((e2) => e2.stopPropagation(), "onClick"),
|
|
3525
3632
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(MoreDownSingle, {})
|
|
3526
3633
|
}
|
|
3527
3634
|
)
|
|
@@ -3545,6 +3652,7 @@ const ToolbarItem = forwardRef((props, ref) => {
|
|
|
3545
3652
|
[styles$b.toolbarItemSelectDisabled]: disabled,
|
|
3546
3653
|
[styles$b.toolbarItemSelectActivated]: activated
|
|
3547
3654
|
}),
|
|
3655
|
+
onClick: /* @__PURE__ */ __name((e2) => e2.stopPropagation(), "onClick"),
|
|
3548
3656
|
children: [
|
|
3549
3657
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3550
3658
|
CustomLabel,
|
|
@@ -3650,7 +3758,7 @@ function Toolbar(props) {
|
|
|
3650
3758
|
{
|
|
3651
3759
|
forceRender: !0,
|
|
3652
3760
|
className: styles$b.toolbarMore,
|
|
3653
|
-
overlay: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$b.toolbarMoreContainer,
|
|
3761
|
+
overlay: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$b.toolbarMoreContainer, children: Object.entries(groupsByKey).map(([key, item]) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$b.toolbarGroup, children: item.map(
|
|
3654
3762
|
(subItem) => collapsedId.includes(subItem.id) && /* @__PURE__ */ jsxRuntimeExports.jsx(ToolbarItem, { ...subItem }, subItem.id)
|
|
3655
3763
|
) }, key)) }),
|
|
3656
3764
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(ToolbarButton, { className: styles$b.toolbarItemTextButton, children: /* @__PURE__ */ jsxRuntimeExports.jsx(MoreFunctionSingle, {}) }) })
|
|
@@ -9217,5 +9325,6 @@ export {
|
|
|
9217
9325
|
useScrollYOverContainer,
|
|
9218
9326
|
useToolbarCollapseObserver,
|
|
9219
9327
|
useToolbarGroups,
|
|
9220
|
-
useToolbarItemStatus
|
|
9328
|
+
useToolbarItemStatus,
|
|
9329
|
+
useVirtualList
|
|
9221
9330
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { IDisposable } from '@univerjs/core';
|
|
2
|
-
|
|
3
2
|
export declare function fromGlobalEvent<K extends keyof WindowEventMap>(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, options?: boolean | AddEventListenerOptions): IDisposable;
|
|
4
3
|
export declare function fromEvent<K extends keyof HTMLElementEventMap>(target: HTMLElement, type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): IDisposable;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { IAccessor, UniverInstanceType } from '@univerjs/core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
|
|
4
3
|
export declare function getMenuHiddenObservable(accessor: IAccessor, targetUniverType: UniverInstanceType): Observable<boolean>;
|
|
5
4
|
export declare function getHeaderFooterMenuHiddenObservable(accessor: IAccessor): Observable<boolean>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { IDocumentData, Nullable } from '@univerjs/core';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
3
|
import { IEditorCanvasStyle } from '../../services/editor/editor.service';
|
|
4
|
-
|
|
5
4
|
type MyComponentProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
6
5
|
export interface ITextEditorProps {
|
|
7
6
|
id: string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Nullable } from '@univerjs/core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
|
|
4
3
|
type ObservableOrFn<T> = Observable<T> | (() => Observable<T>);
|
|
5
4
|
export declare function useObservable<T>(observable: ObservableOrFn<T>, defaultValue: T | undefined, shouldHaveSyncValue?: true): T;
|
|
6
5
|
export declare function useObservable<T>(observable: Nullable<ObservableOrFn<T>>, defaultValue: T): T;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
type ItemHeight<T> = (index: number, data: T) => number;
|
|
17
|
+
export interface IVirtualListOptions<T> {
|
|
18
|
+
containerTarget: React.RefObject<HTMLElement>;
|
|
19
|
+
itemHeight: number | ItemHeight<T>;
|
|
20
|
+
overscan?: number;
|
|
21
|
+
}
|
|
22
|
+
declare const useVirtualList: <T>(list: T[], options: IVirtualListOptions<T>) => readonly [{
|
|
23
|
+
index: number;
|
|
24
|
+
data: T;
|
|
25
|
+
}[], {
|
|
26
|
+
readonly wrapperStyle: {
|
|
27
|
+
height: string | undefined;
|
|
28
|
+
marginTop: string | undefined;
|
|
29
|
+
};
|
|
30
|
+
readonly scrollTo: (index: number) => void;
|
|
31
|
+
readonly containerProps: {
|
|
32
|
+
readonly onScroll: (e: React.UIEvent<HTMLElement, UIEvent>) => void;
|
|
33
|
+
};
|
|
34
|
+
}];
|
|
35
|
+
export { useVirtualList };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { IAccessor } from '@univerjs/core';
|
|
2
2
|
import { IMenuButtonItem } from '../../services/menu/menu';
|
|
3
|
-
|
|
4
3
|
export declare function UndoMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
|
|
5
4
|
export declare function RedoMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
|
|
@@ -2,7 +2,6 @@ import { Disposable, ICommandService, Injector } from '@univerjs/core';
|
|
|
2
2
|
import { IMenuService } from '../services/menu/menu.service';
|
|
3
3
|
import { IShortcutItem, IShortcutService } from '../services/shortcut/shortcut.service';
|
|
4
4
|
import { IUniverUIConfig } from './ui/ui.controller';
|
|
5
|
-
|
|
6
5
|
export declare const CopyShortcutItem: IShortcutItem;
|
|
7
6
|
export declare const CutShortcutItem: IShortcutItem;
|
|
8
7
|
/**
|
|
@@ -3,7 +3,6 @@ import { ComponentManager } from '../../common/component-manager';
|
|
|
3
3
|
import { IMenuService } from '../../services/menu/menu.service';
|
|
4
4
|
import { IShortcutService } from '../../services/shortcut/shortcut.service';
|
|
5
5
|
import { IUniverUIConfig } from '../ui/ui.controller';
|
|
6
|
-
|
|
7
6
|
/**
|
|
8
7
|
* This controller add a side panel to the application to display the shortcuts.
|
|
9
8
|
*/
|
|
@@ -3,7 +3,6 @@ import { IRenderManagerService } from '@univerjs/engine-render';
|
|
|
3
3
|
import { ILayoutService } from '../../services/layout/layout.service';
|
|
4
4
|
import { IUIPartsService } from '../../services/parts/parts.service';
|
|
5
5
|
import { IUniverUIConfig } from './ui.controller';
|
|
6
|
-
|
|
7
6
|
export declare class DesktopUIController extends Disposable {
|
|
8
7
|
private readonly _config;
|
|
9
8
|
private readonly _renderManagerService;
|
|
@@ -3,7 +3,6 @@ import { IRenderManagerService } from '@univerjs/engine-render';
|
|
|
3
3
|
import { ILayoutService } from '../../services/layout/layout.service';
|
|
4
4
|
import { IUIPartsService } from '../../services/parts/parts.service';
|
|
5
5
|
import { IUIController, IUniverUIConfig } from './ui.controller';
|
|
6
|
-
|
|
7
6
|
export declare class MobileUIController extends Disposable implements IUIController {
|
|
8
7
|
private readonly _config;
|
|
9
8
|
private readonly _instanceService;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export * from './components';
|
|
|
19
19
|
export { t } from './components/hooks/locale';
|
|
20
20
|
export { useObservable } from './components/hooks/observable';
|
|
21
21
|
export { useEvent } from './components/hooks/event';
|
|
22
|
+
export { useVirtualList } from './components/hooks/virtual-list';
|
|
22
23
|
export { CopyShortcutItem, CutShortcutItem, RedoShortcutItem, SharedController, UndoShortcutItem, } from './controllers/shared-shortcut.controller';
|
|
23
24
|
export { UI_CONFIG_KEY, IUIController, type IWorkbenchOptions, type IUniverUIConfig } from './controllers/ui/ui.controller';
|
|
24
25
|
export { DesktopUIController } from './controllers/ui/ui-desktop.controller';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Disposable, ILogService, LocaleService } from '@univerjs/core';
|
|
2
2
|
import { INotificationService } from '../notification/notification.service';
|
|
3
|
-
|
|
4
3
|
export declare const PLAIN_TEXT_CLIPBOARD_MIME_TYPE = "text/plain";
|
|
5
4
|
export declare const HTML_CLIPBOARD_MIME_TYPE = "text/html";
|
|
6
5
|
/**
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { IDisposable } from '@univerjs/core';
|
|
2
2
|
import { Subject } from 'rxjs';
|
|
3
3
|
import { IConfirmPartMethodOptions } from '../../views/components/confirm-part/interface';
|
|
4
|
-
|
|
5
4
|
export declare const IConfirmService: import('@univerjs/core').IdentifierDecorator<IConfirmService>;
|
|
6
5
|
export interface IConfirmService {
|
|
7
6
|
readonly confirmOptions$: Subject<IConfirmPartMethodOptions[]>;
|
|
@@ -3,7 +3,6 @@ import { Subject } from 'rxjs';
|
|
|
3
3
|
import { IConfirmPartMethodOptions } from '../../views/components/confirm-part/interface';
|
|
4
4
|
import { IUIPartsService } from '../parts/parts.service';
|
|
5
5
|
import { IConfirmService } from './confirm.service';
|
|
6
|
-
|
|
7
6
|
export declare class DesktopConfirmService extends Disposable implements IConfirmService {
|
|
8
7
|
protected readonly _injector: Injector;
|
|
9
8
|
protected readonly _uiPartsService: IUIPartsService;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Disposable, IDisposable } from '@univerjs/core';
|
|
2
2
|
import { IMouseEvent, IPointerEvent } from '@univerjs/engine-render';
|
|
3
|
-
|
|
4
3
|
export interface IContextMenuHandler {
|
|
5
4
|
/** A callback to open context menu with given position and menu type. */
|
|
6
5
|
handleContextMenu(event: IPointerEvent | IMouseEvent, menuType: string): void;
|
|
@@ -3,7 +3,6 @@ import { Subject } from 'rxjs';
|
|
|
3
3
|
import { IDialogPartMethodOptions } from '../../views/components/dialog-part/interface';
|
|
4
4
|
import { IUIPartsService } from '../parts/parts.service';
|
|
5
5
|
import { IDialogService } from './dialog.service';
|
|
6
|
-
|
|
7
6
|
export declare class DesktopDialogService extends Disposable implements IDialogService {
|
|
8
7
|
protected readonly _injector: Injector;
|
|
9
8
|
protected readonly _uiPartsService: IUIPartsService;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { IDisposable } from '@univerjs/core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { IDialogPartMethodOptions } from '../../views/components/dialog-part/interface';
|
|
4
|
-
|
|
5
4
|
export declare const IDialogService: import('@univerjs/core').IdentifierDecorator<IDialogService>;
|
|
6
5
|
export interface IDialogService {
|
|
7
6
|
open(params: IDialogPartMethodOptions): IDisposable;
|
|
@@ -2,7 +2,6 @@ import { DocumentDataModel, IDisposable, IDocumentBody, IDocumentData, IPosition
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { IRender, ISuccinctDocRangeParam, IRenderManagerService } from '@univerjs/engine-render';
|
|
4
4
|
import { LexerTreeBuilder } from '@univerjs/engine-formula';
|
|
5
|
-
|
|
6
5
|
export interface IEditorStateParam extends Partial<IPosition> {
|
|
7
6
|
visible?: boolean;
|
|
8
7
|
}
|