@univerjs/docs-ui 0.4.2-nightly.202411041606 → 0.4.2-nightly.202411061606
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/es/index.js +25 -37
- package/lib/umd/index.js +11 -11
- package/package.json +7 -7
package/lib/es/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import require$$0__default, { useState, useRef, useEffect, forwardRef, createEle
|
|
|
11
11
|
import { LexerTreeBuilder, operatorToken, isReferenceStrings, serializeRange, serializeRangeWithSheet, serializeRangeWithSpreadsheet, isReferenceStringWithEffectiveColumn, getRangeWithRefsString } from "@univerjs/engine-formula";
|
|
12
12
|
import { IRenderManagerService, DocumentEditArea, Shape, PageLayoutType, Vector2, Rect, Path, getCharSpaceApply, getNumberUnitValue, hasListGlyph, isIndentByGlyph, isFirstGlyph, getParagraphByGlyph, pixelToPt, ptToPixel, parseDataStreamToTree, Viewport, ScrollBar, Layer, Documents, DocBackground, DocumentSkeletonPageType, lineIterator, getLastLine, pxToNum, CURSOR_TYPE, TRANSFORM_CHANGE_OBSERVABLE_TYPE, UniverRenderEnginePlugin } from "@univerjs/engine-render";
|
|
13
13
|
import { Subject, merge, fromEvent, BehaviorSubject, combineLatest, Observable, map as map$1, takeUntil, distinctUntilChanged, filter as filter$1, throttleTime, switchMap, take, animationFrameScheduler } from "rxjs";
|
|
14
|
-
import { KeyCode, useEvent, ILayoutService, ComponentManager, ISidebarService, MetaKeys, IClipboardInterfaceService, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, HTML_CLIPBOARD_MIME_TYPE, CopyCommand, CutCommand, PasteCommand, IConfirmService, MenuItemType, getMenuHiddenObservable, FONT_FAMILY_LIST, FONT_SIZE_LIST,
|
|
14
|
+
import { KeyCode, useEvent, ILayoutService, ComponentManager, ISidebarService, MetaKeys, IClipboardInterfaceService, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, HTML_CLIPBOARD_MIME_TYPE, CopyCommand, CutCommand, PasteCommand, IConfirmService, MenuItemType, getMenuHiddenObservable, FONT_FAMILY_LIST, FONT_SIZE_LIST, RibbonStartGroup, ContextMenuPosition, ContextMenuGroup, FontFamily, FontFamilyItem, FontSize, BuiltInUIPart, IMenuManagerService, IUIPartsService, IShortcutService, ICanvasPopupService, IContextMenuService, SetEditorResizeOperation } from "@univerjs/ui";
|
|
15
15
|
import { filter, bufferTime, map } from "rxjs/operators";
|
|
16
16
|
import { Tooltip, Dialog, Button, Input, Checkbox, InputNumber, Slider, Select, ColorPicker } from "@univerjs/design";
|
|
17
17
|
var __defProp$r = Object.defineProperty, __getOwnPropDesc$r = Object.getOwnPropertyDescriptor, __decorateClass$r = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
@@ -5678,28 +5678,21 @@ function ParagraphSetting() {
|
|
|
5678
5678
|
] });
|
|
5679
5679
|
}
|
|
5680
5680
|
__name(ParagraphSetting, "ParagraphSetting");
|
|
5681
|
-
const isRangesEqual = /* @__PURE__ */ __name((oldRanges, ranges) => ranges.length === oldRanges.length && oldRanges.some((oldRange) => ranges.some((range) => range.startOffset === oldRange.startOffset && range.endOffset === oldRange.endOffset)), "isRangesEqual")
|
|
5682
|
-
const { startOffset: activeStart, endOffset: activeEnd } = oldRange, { startOffset: compareStart, endOffset: compareEnd } = range;
|
|
5683
|
-
return activeStart == null || activeEnd == null || compareStart == null || compareEnd == null ? !1 : activeStart <= compareEnd && activeEnd >= compareStart;
|
|
5684
|
-
})), "isRangesIntersection");
|
|
5681
|
+
const isRangesEqual = /* @__PURE__ */ __name((oldRanges, ranges) => ranges.length === oldRanges.length && oldRanges.some((oldRange) => ranges.some((range) => range.startOffset === oldRange.startOffset && range.endOffset === oldRange.endOffset)), "isRangesEqual");
|
|
5685
5682
|
function ParagraphSettingIndex() {
|
|
5686
|
-
const commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), currentLocale = useObservable(localeService.currentLocale$), [key, keySet] = useState(""), rangeRef = useRef([]);
|
|
5683
|
+
const commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), currentLocale = useObservable(localeService.currentLocale$), [key, keySet] = useState(""), debounceReset = useMemo(() => debounce(() => keySet(generateRandomId(4)), 300), []), rangeRef = useRef([]);
|
|
5687
5684
|
return useEffect(() => {
|
|
5688
5685
|
const dispose = commandService.onCommandExecuted((info) => {
|
|
5689
|
-
var _a28;
|
|
5690
5686
|
if (SetTextSelectionsOperation.id === info.id) {
|
|
5691
5687
|
const ranges = info.params.ranges;
|
|
5692
5688
|
isRangesEqual(ranges, rangeRef.current) || keySet(generateRandomId(4)), rangeRef.current = ranges;
|
|
5693
5689
|
}
|
|
5694
|
-
|
|
5695
|
-
const params = info.params, ranges = (_a28 = params.textRanges) != null ? _a28 : [];
|
|
5696
|
-
params.trigger !== DocParagraphSettingCommand.id && isRangesIntersection(ranges, rangeRef.current) && keySet(generateRandomId(4));
|
|
5697
|
-
}
|
|
5690
|
+
RichTextEditingMutation.id === info.id && info.params.trigger !== DocParagraphSettingCommand.id && debounceReset();
|
|
5698
5691
|
});
|
|
5699
5692
|
return () => dispose.dispose();
|
|
5700
|
-
}, []), useEffect(() => {
|
|
5693
|
+
}, [debounceReset]), useEffect(() => {
|
|
5701
5694
|
keySet(generateRandomId(4));
|
|
5702
|
-
}, [currentLocale]), /* @__PURE__ */ jsxRuntimeExports.jsx(ParagraphSetting, {}, key);
|
|
5695
|
+
}, [currentLocale]), useEffect(() => () => debounceReset.cancel(), [debounceReset]), /* @__PURE__ */ jsxRuntimeExports.jsx(ParagraphSetting, {}, key);
|
|
5703
5696
|
}
|
|
5704
5697
|
__name(ParagraphSettingIndex, "ParagraphSettingIndex");
|
|
5705
5698
|
var __defProp$m = Object.defineProperty, __getOwnPropDesc$m = Object.getOwnPropertyDescriptor, __decorateClass$m = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
@@ -5940,38 +5933,34 @@ function getInsertTableHiddenObservable(accessor) {
|
|
|
5940
5933
|
});
|
|
5941
5934
|
}
|
|
5942
5935
|
__name(getInsertTableHiddenObservable, "getInsertTableHiddenObservable");
|
|
5943
|
-
function
|
|
5936
|
+
function getHeaderFooterMenuHiddenObservable(accessor) {
|
|
5944
5937
|
const univerInstanceService = accessor.get(IUniverInstanceService), commandService = accessor.get(ICommandService);
|
|
5945
5938
|
return new Observable((subscriber) => {
|
|
5946
5939
|
const subscription0 = commandService.onCommandExecuted((command) => {
|
|
5947
|
-
if (command.id ===
|
|
5948
|
-
const
|
|
5949
|
-
if (
|
|
5940
|
+
if (command.id === RichTextEditingMutation.id) {
|
|
5941
|
+
const { unitId } = command.params, docDataModel2 = univerInstanceService.getUnit(unitId);
|
|
5942
|
+
if (docDataModel2 == null) {
|
|
5950
5943
|
subscriber.next(!0);
|
|
5951
5944
|
return;
|
|
5952
5945
|
}
|
|
5953
|
-
const documentStyle =
|
|
5946
|
+
const { documentStyle } = docDataModel2.getSnapshot();
|
|
5954
5947
|
subscriber.next((documentStyle == null ? void 0 : documentStyle.documentFlavor) !== DocumentFlavor.TRADITIONAL);
|
|
5955
5948
|
}
|
|
5956
5949
|
}), subscription = univerInstanceService.focused$.subscribe((unitId) => {
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
return subscriber.next(((_a28 = docDataModel.getSnapshot().documentStyle) == null ? void 0 : _a28.documentFlavor) !== DocumentFlavor.TRADITIONAL);
|
|
5968
|
-
});
|
|
5969
|
-
return () => {
|
|
5970
|
-
subscription.unsubscribe(), subscription0.dispose();
|
|
5950
|
+
if (unitId == null)
|
|
5951
|
+
return subscriber.next(!0);
|
|
5952
|
+
const docDataModel2 = univerInstanceService.getUniverDocInstance(unitId), documentFlavor2 = docDataModel2 == null ? void 0 : docDataModel2.getSnapshot().documentStyle.documentFlavor;
|
|
5953
|
+
subscriber.next(documentFlavor2 !== DocumentFlavor.TRADITIONAL);
|
|
5954
|
+
}), docDataModel = univerInstanceService.getCurrentUniverDocInstance();
|
|
5955
|
+
if (docDataModel == null)
|
|
5956
|
+
return subscriber.next(!0);
|
|
5957
|
+
const documentFlavor = docDataModel == null ? void 0 : docDataModel.getSnapshot().documentStyle.documentFlavor;
|
|
5958
|
+
return subscriber.next(documentFlavor !== DocumentFlavor.TRADITIONAL), () => {
|
|
5959
|
+
subscription0.dispose(), subscription.unsubscribe();
|
|
5971
5960
|
};
|
|
5972
5961
|
});
|
|
5973
5962
|
}
|
|
5974
|
-
__name(
|
|
5963
|
+
__name(getHeaderFooterMenuHiddenObservable, "getHeaderFooterMenuHiddenObservable");
|
|
5975
5964
|
function getTableDisabledObservable(accessor) {
|
|
5976
5965
|
const docSelectionManagerService = accessor.get(DocSelectionManagerService), univerInstanceService = accessor.get(IUniverInstanceService);
|
|
5977
5966
|
return new Observable((subscriber) => {
|
|
@@ -6317,8 +6306,7 @@ function HeaderFooterMenuItemFactory(accessor) {
|
|
|
6317
6306
|
type: MenuItemType.BUTTON,
|
|
6318
6307
|
icon: "HeaderFooterSingle",
|
|
6319
6308
|
tooltip: "toolbar.headerFooter",
|
|
6320
|
-
|
|
6321
|
-
hidden$: combineLatest(getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC), getHeaderFooterMenuHiddenObservable(accessor), (one, two) => one || two)
|
|
6309
|
+
hidden$: combineLatest(getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC, void 0, DOCS_ZEN_EDITOR_UNIT_ID_KEY), getHeaderFooterMenuHiddenObservable(accessor), (one, two) => one || two)
|
|
6322
6310
|
};
|
|
6323
6311
|
}
|
|
6324
6312
|
__name(HeaderFooterMenuItemFactory, "HeaderFooterMenuItemFactory");
|
|
@@ -6331,7 +6319,7 @@ function TableMenuFactory(accessor) {
|
|
|
6331
6319
|
tooltip: "toolbar.table.main",
|
|
6332
6320
|
disabled$: getTableDisabledObservable(accessor),
|
|
6333
6321
|
// Do not show header footer menu and insert table at zen mode.
|
|
6334
|
-
hidden$: combineLatest(getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC), getInsertTableHiddenObservable(accessor), (one, two) => one || two)
|
|
6322
|
+
hidden$: combineLatest(getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC, void 0, DOCS_ZEN_EDITOR_UNIT_ID_KEY), getInsertTableHiddenObservable(accessor), (one, two) => one || two)
|
|
6335
6323
|
};
|
|
6336
6324
|
}
|
|
6337
6325
|
__name(TableMenuFactory, "TableMenuFactory");
|
|
@@ -6542,7 +6530,7 @@ function DocSwitchModeMenuItemFactory(accessor) {
|
|
|
6542
6530
|
var _a28;
|
|
6543
6531
|
const subscription = commandService.onCommandExecuted((c) => {
|
|
6544
6532
|
var _a29;
|
|
6545
|
-
if (c.id ===
|
|
6533
|
+
if (c.id === RichTextEditingMutation.id) {
|
|
6546
6534
|
const instance2 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
|
|
6547
6535
|
subscriber.next(((_a29 = instance2 == null ? void 0 : instance2.getSnapshot()) == null ? void 0 : _a29.documentStyle.documentFlavor) === DocumentFlavor.MODERN);
|
|
6548
6536
|
}
|