@univerjs/sheets-ui 0.15.0 → 0.15.1-insiders.20260117-8ce4a01
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 +38 -16
- package/lib/es/index.js +11594 -11298
- package/lib/index.css +1 -1
- package/lib/index.js +11594 -11298
- package/lib/types/consts/mobile-context.d.ts +25 -0
- package/lib/types/controllers/clipboard/clipboard.controller.d.ts +2 -0
- package/lib/types/controllers/menu/menu.d.ts +2 -0
- package/lib/types/controllers/render-controllers/mobile/mobile-scroll.render-controller.d.ts +18 -4
- package/lib/types/index.d.ts +1 -1
- package/lib/types/services/canvas-pop-manager.service.d.ts +8 -0
- package/lib/types/services/clipboard/clipboard.service.d.ts +7 -0
- package/lib/types/services/clipboard/copy-content-cache.d.ts +3 -0
- package/lib/types/services/clipboard/type.d.ts +1 -1
- package/lib/types/services/clipboard/usm-to-html/convertor.d.ts +1 -1
- package/lib/types/services/selection/mobile-selection-render.service.d.ts +8 -2
- package/lib/types/views/dropdown/list-dropdown/index.d.ts +1 -0
- package/lib/umd/index.js +38 -16
- package/package.json +14 -14
- package/LICENSE +0 -176
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
/**
|
|
17
|
+
* Context key indicating that pinch-to-zoom gesture is in progress on mobile.
|
|
18
|
+
* Used to prevent selection operations during pinch zoom.
|
|
19
|
+
*/
|
|
20
|
+
export declare const MOBILE_PINCH_ZOOMING = "MOBILE_PINCH_ZOOMING";
|
|
21
|
+
/**
|
|
22
|
+
* Context key indicating that selection is being expanded on mobile (dragging fill controls).
|
|
23
|
+
* Used to prevent scroll/inertia/zoom operations during selection expansion.
|
|
24
|
+
*/
|
|
25
|
+
export declare const MOBILE_EXPANDING_SELECTION = "MOBILE_EXPANDING_SELECTION";
|
|
@@ -22,6 +22,8 @@ export declare class SheetClipboardController extends RxDisposable {
|
|
|
22
22
|
private _init;
|
|
23
23
|
private _initCopyingHooks;
|
|
24
24
|
private _initPastingHook;
|
|
25
|
+
private _initPastingRowsHook;
|
|
26
|
+
private _initPastingColumnsHook;
|
|
25
27
|
private _generateDocumentDataModelSnapshot;
|
|
26
28
|
private _onPastePlainText;
|
|
27
29
|
private _onPasteCells;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IAccessor, HorizontalAlign, VerticalAlign, WrapStrategy } from '@univerjs/core';
|
|
2
2
|
import { IMenuButtonItem, IMenuSelectorItem } from '@univerjs/ui';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
3
4
|
export declare enum SheetMenuPosition {
|
|
4
5
|
ROW_HEADER_CONTEXT_MENU = "ROW_HEADER_CONTEXT_MENU",
|
|
5
6
|
COL_HEADER_CONTEXT_MENU = "COL_HEADER_CONTEXT_MENU",
|
|
@@ -44,6 +45,7 @@ export declare const TEXT_ROTATE_CHILDREN: ({
|
|
|
44
45
|
value: string;
|
|
45
46
|
})[];
|
|
46
47
|
export declare function TextRotateMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<number | string>;
|
|
48
|
+
export declare function menuClipboardDisabledObservable(injector: IAccessor): Observable<boolean>;
|
|
47
49
|
export declare function CopyMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
|
|
48
50
|
export declare function CutMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
|
|
49
51
|
export declare function PasteMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
|
package/lib/types/controllers/render-controllers/mobile/mobile-scroll.render-controller.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IRange, Workbook, Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
1
|
+
import { IRange, Workbook, Disposable, ICommandService, IContextService, IUniverInstanceService } from '@univerjs/core';
|
|
2
2
|
import { IRenderContext, IRenderModule, IRenderManagerService } from '@univerjs/engine-render';
|
|
3
3
|
import { SheetsSelectionsService } from '@univerjs/sheets';
|
|
4
4
|
import { SheetScrollManagerService } from '../../../services/scroll-manager.service';
|
|
@@ -14,7 +14,8 @@ export declare class MobileSheetsScrollRenderController extends Disposable imple
|
|
|
14
14
|
private readonly _selectionManagerService;
|
|
15
15
|
private readonly _scrollManagerService;
|
|
16
16
|
protected readonly _univerInstanceService: IUniverInstanceService;
|
|
17
|
-
|
|
17
|
+
private readonly _contextService;
|
|
18
|
+
constructor(_context: IRenderContext<Workbook>, _sheetSkeletonManagerService: SheetSkeletonManagerService, _commandService: ICommandService, _renderManagerService: IRenderManagerService, _selectionManagerService: SheetsSelectionsService, _scrollManagerService: SheetScrollManagerService, _univerInstanceService: IUniverInstanceService, _contextService: IContextService);
|
|
18
19
|
scrollToRange(range: IRange): boolean;
|
|
19
20
|
private _init;
|
|
20
21
|
private _initCommandListener;
|
|
@@ -23,12 +24,25 @@ export declare class MobileSheetsScrollRenderController extends Disposable imple
|
|
|
23
24
|
private _initScrollEventListener;
|
|
24
25
|
private _initSkeletonListener;
|
|
25
26
|
/**
|
|
26
|
-
* for mobile
|
|
27
|
+
* for mobile - iOS-like smooth inertia scrolling
|
|
28
|
+
* Uses native touch events for better mobile experience while keeping onPointerDown$ as trigger
|
|
29
|
+
* to avoid interfering with header events
|
|
27
30
|
*/
|
|
28
31
|
private _initPointerScrollEvent;
|
|
32
|
+
/**
|
|
33
|
+
* Create zoom indicator overlay element
|
|
34
|
+
*/
|
|
35
|
+
private _createZoomIndicator;
|
|
36
|
+
/**
|
|
37
|
+
* Show zoom indicator with percentage
|
|
38
|
+
*/
|
|
39
|
+
private _showZoomIndicator;
|
|
40
|
+
/**
|
|
41
|
+
* Hide zoom indicator with fade out
|
|
42
|
+
*/
|
|
43
|
+
private _hideZoomIndicator;
|
|
29
44
|
private _updateSceneSize;
|
|
30
45
|
private _getSheetObject;
|
|
31
|
-
private _scrollToSelectionByDirection;
|
|
32
46
|
private _scrollToSelection;
|
|
33
47
|
private _getViewportBounding;
|
|
34
48
|
private _scrollToCell;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ export { EMBEDDING_FORMULA_EDITOR, isEmbeddingFormulaEditor } from './controller
|
|
|
64
64
|
export { isRangeSelector, RANGE_SELECTOR_SYMBOLS } from './controllers/editor/utils/is-range-selector';
|
|
65
65
|
export { HoverRenderController } from './controllers/hover-render.controller';
|
|
66
66
|
export { menuSchema as SheetsUIMenuSchema } from './controllers/menu.schema';
|
|
67
|
-
export { COPY_SPECIAL_MENU_ID, PASTE_SPECIAL_MENU_ID, SheetMenuPosition } from './controllers/menu/menu';
|
|
67
|
+
export { COPY_SPECIAL_MENU_ID, menuClipboardDisabledObservable, PASTE_SPECIAL_MENU_ID, SheetMenuPosition } from './controllers/menu/menu';
|
|
68
68
|
export { deriveStateFromActiveSheet$, getCurrentExclusiveRangeInterest$, getCurrentRangeDisable$, getObservableWithExclusiveRange$ } from './controllers/menu/menu-util';
|
|
69
69
|
export { SheetPermissionCheckUIController } from './controllers/permission/sheet-permission-check-ui.controller';
|
|
70
70
|
export { HeaderFreezeRenderController } from './controllers/render-controllers/freeze.render-controller';
|
|
@@ -25,6 +25,7 @@ export declare class SheetCanvasPopManagerService extends Disposable {
|
|
|
25
25
|
private readonly _refSelectionsService;
|
|
26
26
|
private readonly _selectionManagerService;
|
|
27
27
|
private _popupMenuFeatureMap;
|
|
28
|
+
private _popupMenuOffsetMap;
|
|
28
29
|
constructor(_globalPopupManagerService: ICanvasPopupService, _renderManagerService: IRenderManagerService, _univerInstanceService: IUniverInstanceService, _refRangeService: RefRangeService, _commandService: ICommandService, _refSelectionsService: ISheetSelectionRenderService, _selectionManagerService: SheetsSelectionsService);
|
|
29
30
|
private _isSelectionMoving;
|
|
30
31
|
private _initMoving;
|
|
@@ -32,6 +33,13 @@ export declare class SheetCanvasPopManagerService extends Disposable {
|
|
|
32
33
|
* Register a feature menu callback for a specific drawing type.such as image, chart, etc.
|
|
33
34
|
*/
|
|
34
35
|
registerFeatureMenu(type: DrawingTypeEnum, getPopupMenuCallBack: getPopupMenuItemCallback): void;
|
|
36
|
+
/**
|
|
37
|
+
* Register a feature menu offset for a specific drawing type.
|
|
38
|
+
* @param {DrawingTypeEnum} type the drawing type
|
|
39
|
+
* @param offsetX The offset x
|
|
40
|
+
* @param offsetY The offset y
|
|
41
|
+
*/
|
|
42
|
+
registerFeatureMenuOffset(type: DrawingTypeEnum, offsetX: number, offsetY: number): void;
|
|
35
43
|
/**
|
|
36
44
|
* Get the feature menu by drawing type, the function should be called when a drawing element need trigger popup menu, so the unitId, subUnitId, drawingId should be provided.
|
|
37
45
|
* @param {string} unitId the unit id
|
|
@@ -13,6 +13,8 @@ export declare const PREDEFINED_HOOK_NAME_COPY: {
|
|
|
13
13
|
};
|
|
14
14
|
export declare const PREDEFINED_HOOK_NAME_PASTE: {
|
|
15
15
|
readonly DEFAULT_PASTE: "default-paste";
|
|
16
|
+
readonly DEFAULT_PASTE_ROWS: "default-paste-rows";
|
|
17
|
+
readonly DEFAULT_PASTE_COLUMNS: "default-paste-columns";
|
|
16
18
|
readonly SPECIAL_PASTE_VALUE: "special-paste-value";
|
|
17
19
|
readonly SPECIAL_PASTE_FORMAT: "special-paste-format";
|
|
18
20
|
readonly SPECIAL_PASTE_COL_WIDTH: "special-paste-col-width";
|
|
@@ -21,6 +23,8 @@ export declare const PREDEFINED_HOOK_NAME_PASTE: {
|
|
|
21
23
|
};
|
|
22
24
|
export declare const PREDEFINED_HOOK_NAME: {
|
|
23
25
|
readonly DEFAULT_PASTE: "default-paste";
|
|
26
|
+
readonly DEFAULT_PASTE_ROWS: "default-paste-rows";
|
|
27
|
+
readonly DEFAULT_PASTE_COLUMNS: "default-paste-columns";
|
|
24
28
|
readonly SPECIAL_PASTE_VALUE: "special-paste-value";
|
|
25
29
|
readonly SPECIAL_PASTE_FORMAT: "special-paste-format";
|
|
26
30
|
readonly SPECIAL_PASTE_COL_WIDTH: "special-paste-col-width";
|
|
@@ -46,6 +50,7 @@ export interface ISheetClipboardService {
|
|
|
46
50
|
copy(options?: ICopyOptions): Promise<boolean>;
|
|
47
51
|
cut(): Promise<boolean>;
|
|
48
52
|
paste(item: ClipboardItem, pasteType?: string): Promise<boolean>;
|
|
53
|
+
pasteByCopyId(copyId: string, pasteType?: string): Promise<boolean>;
|
|
49
54
|
legacyPaste(html?: string, text?: string, files?: File[]): Promise<boolean>;
|
|
50
55
|
rePasteWithPasteType(type: IPasteHookKeyType): boolean;
|
|
51
56
|
disposePasteOptionsCache(): void;
|
|
@@ -91,6 +96,7 @@ export declare class SheetClipboardService extends Disposable implements ISheetC
|
|
|
91
96
|
copy(options?: ICopyOptions): Promise<boolean>;
|
|
92
97
|
cut(): Promise<boolean>;
|
|
93
98
|
paste(item: ClipboardItem, pasteType?: "default-paste"): Promise<boolean>;
|
|
99
|
+
pasteByCopyId(copyId: string, pasteType?: "default-paste"): Promise<boolean>;
|
|
94
100
|
legacyPaste(html?: string, text?: string, files?: File[]): Promise<boolean>;
|
|
95
101
|
rePasteWithPasteType(type: IPasteHookKeyType): boolean;
|
|
96
102
|
updatePasteOptionsCache(cache: IPasteOptionCache | null): void;
|
|
@@ -106,6 +112,7 @@ export declare class SheetClipboardService extends Disposable implements ISheetC
|
|
|
106
112
|
private _pasteExternal;
|
|
107
113
|
private _pasteInternal;
|
|
108
114
|
private _pasteUSM;
|
|
115
|
+
private _getPastedRangeAutoHeightMutation;
|
|
109
116
|
private _getSetSelectionOperation;
|
|
110
117
|
private _getPastingTarget;
|
|
111
118
|
/**
|
|
@@ -12,10 +12,13 @@ export declare function genId(): string;
|
|
|
12
12
|
export declare function extractId(html: string): string | null;
|
|
13
13
|
export declare class CopyContentCache {
|
|
14
14
|
private _cache;
|
|
15
|
+
private readonly _lastCopyId$;
|
|
16
|
+
readonly lastCopyId$: import('rxjs').Observable<string | null>;
|
|
15
17
|
set(id: string, clipboardData: ICopyContentCacheData): void;
|
|
16
18
|
get(id: string): ICopyContentCacheData | undefined;
|
|
17
19
|
del(id: string): void;
|
|
18
20
|
clear(): void;
|
|
19
21
|
clearWithUnitId(unitId: string): void;
|
|
22
|
+
getLastCopyId(): string | null;
|
|
20
23
|
}
|
|
21
24
|
export declare const copyContentCache: CopyContentCache;
|
|
@@ -149,7 +149,7 @@ export interface ISheetClipboardHook {
|
|
|
149
149
|
* @param payload
|
|
150
150
|
* @returns undo and redo mutations
|
|
151
151
|
*/
|
|
152
|
-
onPasteRows?(pasteTo: ISheetDiscreteRangeLocation
|
|
152
|
+
onPasteRows?(pasteTo: ISheetDiscreteRangeLocation): {
|
|
153
153
|
undos: IMutationInfo[];
|
|
154
154
|
redos: IMutationInfo[];
|
|
155
155
|
};
|
|
@@ -5,5 +5,5 @@ export declare class USMToHtmlService {
|
|
|
5
5
|
convert(matrix: ObjectMatrix<ICellData & {
|
|
6
6
|
rowSpan?: number | undefined;
|
|
7
7
|
colSpan?: number | undefined;
|
|
8
|
-
}>, range: IDiscreteRange, hooks: ISheetClipboardHook[]): string;
|
|
8
|
+
}>, range: IDiscreteRange, hooks: ISheetClipboardHook[], copyId?: string): string;
|
|
9
9
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Workbook, ICommandService, IContextService, ILogService, Injector, RANGE_TYPE, ThemeService } from '@univerjs/core';
|
|
2
|
-
import { IMouseEvent, IPointerEvent, IRenderContext, IRenderModule, Scene, SpreadsheetSkeleton, Viewport } from '@univerjs/engine-render';
|
|
1
|
+
import { Nullable, Workbook, ICommandService, IContextService, ILogService, Injector, RANGE_TYPE, ThemeService } from '@univerjs/core';
|
|
2
|
+
import { IMouseEvent, IPointerEvent, IRenderContext, IRenderModule, Scene, SpreadsheetSkeleton, Viewport, ScrollTimerType } from '@univerjs/engine-render';
|
|
3
3
|
import { ISelectionWithStyle, SheetsSelectionsService } from '@univerjs/sheets';
|
|
4
4
|
import { IShortcutService } from '@univerjs/ui';
|
|
5
5
|
import { SheetScrollManagerService } from '../scroll-manager.service';
|
|
@@ -25,6 +25,7 @@ export declare class MobileSheetsSelectionRenderService extends BaseSelectionRen
|
|
|
25
25
|
_expandingSelection: boolean;
|
|
26
26
|
protected _selectionControls: MobileSelectionControl[];
|
|
27
27
|
expandingControlMode: ExpandingControl;
|
|
28
|
+
private _anchorCellForExpanding;
|
|
28
29
|
constructor(_context: IRenderContext<Workbook>, injector: Injector, themeService: ThemeService, shortcutService: IShortcutService, selectionManagerService: SheetsSelectionsService, sheetSkeletonManagerService: SheetSkeletonManagerService, _logService: ILogService, _commandService: ICommandService, _contextService: IContextService, _scrollManagerService: SheetScrollManagerService);
|
|
29
30
|
private _init;
|
|
30
31
|
private _initSkeletonChangeListener;
|
|
@@ -56,6 +57,11 @@ export declare class MobileSheetsSelectionRenderService extends BaseSelectionRen
|
|
|
56
57
|
getSelectionControls(): MobileSelectionControl[];
|
|
57
58
|
private _fillControlPointerDownHandler;
|
|
58
59
|
private _changeCurrCellWhenControlPointerDown;
|
|
60
|
+
/**
|
|
61
|
+
* Override base class method to add pinch zoom check.
|
|
62
|
+
* When pinch zooming, we should not process pointer move events for selection.
|
|
63
|
+
*/
|
|
64
|
+
protected _setupPointerMoveListener(viewportMain: Nullable<Viewport>, activeSelectionControl: MobileSelectionControl, rangeType: RANGE_TYPE, scrollTimerType: ScrollTimerType | undefined, moveStartPosX: number, moveStartPosY: number): void;
|
|
59
65
|
/**
|
|
60
66
|
* Not same as _moving in PC (base selection render service)
|
|
61
67
|
* The diff is
|