@univerjs/sheets-drawing-ui 1.0.0-rc.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +542 -73
- package/lib/cjs/locale/ar-SA.js +5 -1
- package/lib/cjs/locale/ca-ES.js +5 -1
- package/lib/cjs/locale/de-DE.js +5 -1
- package/lib/cjs/locale/en-US.js +5 -1
- package/lib/cjs/locale/es-ES.js +5 -1
- package/lib/cjs/locale/fa-IR.js +5 -1
- package/lib/cjs/locale/fr-FR.js +5 -1
- package/lib/cjs/locale/id-ID.js +5 -1
- package/lib/cjs/locale/it-IT.js +5 -1
- package/lib/cjs/locale/ja-JP.js +5 -1
- package/lib/cjs/locale/ko-KR.js +5 -1
- package/lib/cjs/locale/pl-PL.js +5 -1
- package/lib/cjs/locale/pt-BR.js +5 -1
- package/lib/cjs/locale/ru-RU.js +5 -1
- package/lib/cjs/locale/sk-SK.js +5 -1
- package/lib/cjs/locale/vi-VN.js +5 -1
- package/lib/cjs/locale/zh-CN.js +5 -1
- package/lib/cjs/locale/zh-HK.js +5 -1
- package/lib/cjs/locale/zh-TW.js +5 -1
- package/lib/es/index.js +546 -79
- package/lib/es/locale/ar-SA.js +5 -0
- package/lib/es/locale/ca-ES.js +5 -0
- package/lib/es/locale/de-DE.js +5 -0
- package/lib/es/locale/en-US.js +5 -0
- package/lib/es/locale/es-ES.js +5 -0
- package/lib/es/locale/fa-IR.js +5 -0
- package/lib/es/locale/fr-FR.js +5 -0
- package/lib/es/locale/id-ID.js +5 -0
- package/lib/es/locale/it-IT.js +5 -0
- package/lib/es/locale/ja-JP.js +5 -0
- package/lib/es/locale/ko-KR.js +5 -0
- package/lib/es/locale/pl-PL.js +5 -0
- package/lib/es/locale/pt-BR.js +5 -0
- package/lib/es/locale/ru-RU.js +5 -0
- package/lib/es/locale/sk-SK.js +5 -0
- package/lib/es/locale/vi-VN.js +5 -0
- package/lib/es/locale/zh-CN.js +5 -0
- package/lib/es/locale/zh-HK.js +5 -0
- package/lib/es/locale/zh-TW.js +5 -0
- package/lib/index.js +546 -79
- package/lib/locale/ar-SA.js +5 -0
- package/lib/locale/ca-ES.js +5 -0
- package/lib/locale/de-DE.js +5 -0
- package/lib/locale/en-US.js +5 -0
- package/lib/locale/es-ES.js +5 -0
- package/lib/locale/fa-IR.js +5 -0
- package/lib/locale/fr-FR.js +5 -0
- package/lib/locale/id-ID.js +5 -0
- package/lib/locale/it-IT.js +5 -0
- package/lib/locale/ja-JP.js +5 -0
- package/lib/locale/ko-KR.js +5 -0
- package/lib/locale/pl-PL.js +5 -0
- package/lib/locale/pt-BR.js +5 -0
- package/lib/locale/ru-RU.js +5 -0
- package/lib/locale/sk-SK.js +5 -0
- package/lib/locale/vi-VN.js +5 -0
- package/lib/locale/zh-CN.js +5 -0
- package/lib/locale/zh-HK.js +5 -0
- package/lib/locale/zh-TW.js +5 -0
- package/lib/types/commands/commands/worksheet-background-image.command.d.ts +21 -0
- package/lib/types/controllers/render-controllers/worksheet-background.render-controller.d.ts +21 -0
- package/lib/types/controllers/sheet-drawing-copy-paste.controller.d.ts +2 -2
- package/lib/types/controllers/sheet-drawing-group-copy-paste.controller.d.ts +6 -1
- package/lib/types/controllers/sheet-drawing-transform-affected.controller.d.ts +55 -0
- package/lib/types/controllers/sheet-drawing-update.controller.d.ts +2 -1
- package/lib/types/controllers/sheet-drawing.controller.d.ts +29 -0
- package/lib/types/controllers/ui.controller.d.ts +2 -4
- package/lib/types/facade/f-range.d.ts +1 -1
- package/lib/types/facade/f-worksheet.d.ts +1 -1
- package/lib/types/index.d.ts +3 -0
- package/lib/types/locale/en-US.d.ts +5 -0
- package/lib/types/menu/mobile-schema.d.ts +17 -0
- package/lib/types/menu/mobile-sheet-drawing-menu.controller.d.ts +20 -0
- package/lib/types/menu/sheet-drawing-menu.controller.d.ts +20 -0
- package/lib/types/menu/worksheet-background-image.menu.d.ts +22 -0
- package/lib/types/utils/worksheet-background-image.d.ts +25 -0
- package/lib/types/views/background/worksheet-background-image.extension.d.ts +27 -0
- package/lib/types/views/printing-float-dom/index.d.ts +25 -0
- package/lib/umd/index.js +2 -2
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +16 -16
package/lib/es/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { BooleanNumber, BuildTextUtils, CommandType, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DependentOn, Direction, Disposable, DisposableCollection, DrawingTypeEnum, FOCUSING_COMMON_DRAWINGS, FOCUSING_FX_BAR_EDITOR, FOCUSING_PANEL_EDITOR, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_SHEET, ICommandService, IConfigService, IContextService, IImageIoService, IPermissionService, IURLImageService, IUndoRedoService, IUniverInstanceService, ImageSourceType, ImageUploadStatusType, Inject, Injector, InterceptorEffectEnum, LifecycleService, LifecycleStages, LocaleService, ObjectMatrix, Optional, Plugin, PositionedObjectLayoutType, RxDisposable, Tools, UniverInstanceType, UserManagerService, WrapTextType, createDocumentModelWithStyle, createIdentifier, fromEventSubject, generateRandomId, merge, mergeOverrideWithDependencies, registerDependencies, sequenceExecute, toDisposable, touchDependencies } from "@univerjs/core";
|
|
2
|
-
import { ClearSheetDrawingTransformerOperation, DrawingApplyType, ISheetDrawingService, InsertSheetDrawingCommand, RemoveSheetDrawingCommand, SetDrawingApplyMutation, SetDrawingArrangeCommand, SetSheetDrawingCommand, SetSheetDrawingPlacementCommand, SheetDrawingAnchorType, UniverSheetsDrawingPlugin, drawingPositionToTransform, getSheetDrawingPlacement, transformToAxisAlignPosition, transformToDrawingPosition } from "@univerjs/sheets-drawing";
|
|
3
|
-
import { CURSOR_TYPE, DEFAULT_TRANSFORMER_CONFIG, DRAWING_OBJECT_LAYER_INDEX, IRenderManagerService, Image, ObjectType, Rect, SHEET_VIEWPORT_KEY, UniverRenderEnginePlugin, Vector2, getCurrentTypeOfRenderer, getGroupState, transformObjectOutOfGroup } from "@univerjs/engine-render";
|
|
1
|
+
import { BooleanNumber, BuildTextUtils, CommandType, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DependentOn, Direction, Disposable, DisposableCollection, DrawingTypeEnum, FOCUSING_COMMON_DRAWINGS, FOCUSING_FX_BAR_EDITOR, FOCUSING_PANEL_EDITOR, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_SHEET, ICommandService, IConfigService, IContextService, IImageIoService, IPermissionService, IURLImageService, IUndoRedoService, IUniverInstanceService, ImageCacheMap, ImageSourceType, ImageUploadStatusType, Inject, Injector, InterceptorEffectEnum, LifecycleService, LifecycleStages, LocaleService, ObjectMatrix, Optional, Plugin, PositionedObjectLayoutType, RxDisposable, Tools, UniverInstanceType, UserManagerService, WrapTextType, createDocumentModelWithStyle, createIdentifier, fromEventSubject, generateRandomId, merge, mergeOverrideWithDependencies, registerDependencies, sequenceExecute, toDisposable, touchDependencies } from "@univerjs/core";
|
|
2
|
+
import { ClearSheetDrawingTransformerOperation, DrawingApplyType, ISheetDrawingService, InsertSheetDrawingCommand, RemoveSheetDrawingCommand, SetDrawingApplyMutation, SetDrawingArrangeCommand, SetSheetDrawingCommand, SetSheetDrawingPlacementCommand, SetWorksheetBackgroundImageCommand, SetWorksheetBackgroundImageMutation, SheetDrawingAnchorType, UniverSheetsDrawingPlugin, drawingPositionToTransform, getSheetDrawingPlacement, transformToAxisAlignPosition, transformToDrawingPosition } from "@univerjs/sheets-drawing";
|
|
3
|
+
import { CURSOR_TYPE, DEFAULT_TRANSFORMER_CONFIG, DRAWING_OBJECT_LAYER_INDEX, IRenderManagerService, Image, ObjectType, Rect, SHEET_EXTENSION_TYPE, SHEET_VIEWPORT_KEY, SheetExtension, UniverRenderEnginePlugin, Vector2, getCurrentTypeOfRenderer, getGroupState, transformObjectOutOfGroup } from "@univerjs/engine-render";
|
|
4
4
|
import { Button, Checkbox, CheckboxGroup, FormLayout, MessageType, MobileSelect, Radio, RadioGroup, Select, clsx, render, unmount } from "@univerjs/design";
|
|
5
5
|
import { buildDocTransform, docDrawingPositionToTransform } from "@univerjs/docs";
|
|
6
6
|
import { DRAWING_IMAGE_ALLOW_IMAGE_LIST, DRAWING_IMAGE_COUNT_LIMIT, DRAWING_IMAGE_HEIGHT_LIMIT, DRAWING_IMAGE_WIDTH_LIMIT, IDrawingManagerService, SetDrawingSelectedOperation, UniverDrawingPlugin, getDrawingImageAllowSize, getDrawingShapeKeyByDrawingSearch, getImageSize } from "@univerjs/drawing";
|
|
7
7
|
import { COMMAND_LISTENER_SKELETON_CHANGE, IAutoFillService, INTERCEPTOR_POINT, InterceptCellContentPriority, RangeProtectionPermissionEditPoint, SetFrozenMutation, SetRangeValuesCommand, SetSelectionsOperation, SetWorksheetActiveOperation, SetWorksheetRowAutoHeightMutation, SheetInterceptorService, SheetPermissionCheckController, SheetSkeletonService, SheetsSelectionsService, UniverSheetsPlugin, WorkbookEditablePermission, WorkbookViewPermission, WorksheetEditPermission, WorksheetViewPermission, attachRangeWithCoord, discreteRangeToRange, getSheetCommandTarget, isCellImage } from "@univerjs/sheets";
|
|
8
8
|
import { COPY_TYPE, EditingRenderController, HoverManagerService, IEditorBridgeService, ISheetClipboardService, ISheetSelectionRenderService, PREDEFINED_HOOK_NAME_PASTE, SetCellEditVisibleOperation, SetScrollOperation, SetZoomRatioOperation, SheetCanvasPopManagerService, SheetPrintInterceptorService, SheetSkeletonManagerService, UniverSheetsMobileUIPlugin, UniverSheetsUIPlugin, getCurrentRangeDisable$, useHighlightRange, virtualizeDiscreteRanges } from "@univerjs/sheets-ui";
|
|
9
|
-
import { CanvasFloatDomPreviewService, CanvasFloatDomService, ComponentManager, ContextMenuGroup, ContextMenuPosition, FloatingObjectToolbarPosition, IClipboardInterfaceService, IContextMenuService, IDialogService, ILayoutService, ILocalFileService, IMenuManagerService, IMessageService, IShortcutService, ISidebarService, KeyCode, MenuItemType, PrintFloatDomSingle, RibbonInsertGroup, UndoRedoGroupService, UniverMobileUIPlugin, connectInjector, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
|
|
9
|
+
import { CanvasFloatDomPreviewService, CanvasFloatDomService, ComponentManager, ContextMenuGroup, ContextMenuPosition, FloatingObjectToolbarPosition, IClipboardInterfaceService, IContextMenuService, IDialogService, ILayoutService, ILocalFileService, IMenuManagerService, IMessageService, IShortcutService, ISidebarService, KeyCode, MenuItemType, PrintFloatDomSingle, RibbonDataGroup, RibbonInsertGroup, RibbonPosition, RibbonViewGroup, UndoRedoGroupService, UniverMobileUIPlugin, connectInjector, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
|
|
10
10
|
import { COMPONENT_IMAGE_POPUP_MENU, COMPONENT_MOBILE_IMAGE_POPUP_MENU, DrawingCommonPanel, DrawingRenderService, ImageCropperObject, ImageResetSizeOperation, OpenImageCropOperation, UniverDrawingMobileUIPlugin, UniverDrawingUIPlugin, disposeDrawingRenderObject, insertGroupObject } from "@univerjs/drawing-ui";
|
|
11
|
-
import { BehaviorSubject, EMPTY, Subject, combineLatest, distinctUntilChanged, filter, map, of, switchMap, take, tap, throttleTime } from "rxjs";
|
|
11
|
+
import { BehaviorSubject, EMPTY, Observable, Subject, combineLatest, distinctUntilChanged, filter, map, of, switchMap, take, takeUntil, tap, throttleTime, timer } from "rxjs";
|
|
12
12
|
import { DocDrawingController, UniverDocsDrawingPlugin } from "@univerjs/docs-drawing";
|
|
13
13
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
14
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -287,7 +287,147 @@ const UngroupSheetDrawingCommand = {
|
|
|
287
287
|
};
|
|
288
288
|
|
|
289
289
|
//#endregion
|
|
290
|
-
//#region
|
|
290
|
+
//#region src/utils/worksheet-background-image.ts
|
|
291
|
+
/**
|
|
292
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
293
|
+
*
|
|
294
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
295
|
+
* you may not use this file except in compliance with the License.
|
|
296
|
+
* You may obtain a copy of the License at
|
|
297
|
+
*
|
|
298
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
299
|
+
*
|
|
300
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
301
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
302
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
303
|
+
* See the License for the specific language governing permissions and
|
|
304
|
+
* limitations under the License.
|
|
305
|
+
*/
|
|
306
|
+
const WORKSHEET_LAYOUT_DPI = 96;
|
|
307
|
+
const METERS_PER_INCH = .0254;
|
|
308
|
+
/**
|
|
309
|
+
* Excel tiles worksheet background images using their physical resolution,
|
|
310
|
+
* while Canvas tiles them using source pixels. Convert the source resolution
|
|
311
|
+
* to Univer's 96-DPI worksheet layout pixels.
|
|
312
|
+
*/
|
|
313
|
+
function getWorksheetBackgroundImageScale(source) {
|
|
314
|
+
const bytes = decodeBase64DataUri(source);
|
|
315
|
+
if (!bytes) return;
|
|
316
|
+
const pixelsPerMeter = readImagePixelsPerMeter(bytes);
|
|
317
|
+
if (!pixelsPerMeter) return;
|
|
318
|
+
const scaleX = WORKSHEET_LAYOUT_DPI / (pixelsPerMeter.x * METERS_PER_INCH);
|
|
319
|
+
const scaleY = WORKSHEET_LAYOUT_DPI / (pixelsPerMeter.y * METERS_PER_INCH);
|
|
320
|
+
if (!Number.isFinite(scaleX) || !Number.isFinite(scaleY)) return;
|
|
321
|
+
if (Math.abs(scaleX - 1) <= .001 && Math.abs(scaleY - 1) <= .001) return;
|
|
322
|
+
return {
|
|
323
|
+
scaleX,
|
|
324
|
+
scaleY
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
function decodeBase64DataUri(source) {
|
|
328
|
+
const separator = source.indexOf(",");
|
|
329
|
+
if (separator < 0 || !source.slice(0, separator).toLowerCase().includes(";base64")) return;
|
|
330
|
+
try {
|
|
331
|
+
const binary = globalThis.atob(source.slice(separator + 1));
|
|
332
|
+
const bytes = new Uint8Array(binary.length);
|
|
333
|
+
for (let index = 0; index < binary.length; index++) bytes[index] = binary.charCodeAt(index);
|
|
334
|
+
return bytes;
|
|
335
|
+
} catch {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
function readImagePixelsPerMeter(bytes) {
|
|
340
|
+
return readPngPixelsPerMeter(bytes) ?? readJpegPixelsPerMeter(bytes);
|
|
341
|
+
}
|
|
342
|
+
function readPngPixelsPerMeter(bytes) {
|
|
343
|
+
if (!hasBytes(bytes, 0, [
|
|
344
|
+
137,
|
|
345
|
+
80,
|
|
346
|
+
78,
|
|
347
|
+
71,
|
|
348
|
+
13,
|
|
349
|
+
10,
|
|
350
|
+
26,
|
|
351
|
+
10
|
|
352
|
+
])) return;
|
|
353
|
+
let offset = 8;
|
|
354
|
+
while (offset + 12 <= bytes.length) {
|
|
355
|
+
const length = readUint32Be(bytes, offset);
|
|
356
|
+
const typeOffset = offset + 4;
|
|
357
|
+
const dataOffset = offset + 8;
|
|
358
|
+
const dataEnd = dataOffset + length;
|
|
359
|
+
const nextOffset = dataEnd + 4;
|
|
360
|
+
if (nextOffset > bytes.length) return;
|
|
361
|
+
if (hasBytes(bytes, typeOffset, [
|
|
362
|
+
112,
|
|
363
|
+
72,
|
|
364
|
+
89,
|
|
365
|
+
115
|
|
366
|
+
])) {
|
|
367
|
+
if (length !== 9 || bytes[dataEnd - 1] !== 1) return;
|
|
368
|
+
const x = readUint32Be(bytes, dataOffset);
|
|
369
|
+
const y = readUint32Be(bytes, dataOffset + 4);
|
|
370
|
+
return x > 0 && y > 0 ? {
|
|
371
|
+
x,
|
|
372
|
+
y
|
|
373
|
+
} : void 0;
|
|
374
|
+
}
|
|
375
|
+
offset = nextOffset;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
function readJpegPixelsPerMeter(bytes) {
|
|
379
|
+
if (!hasBytes(bytes, 0, [255, 216])) return;
|
|
380
|
+
let offset = 2;
|
|
381
|
+
while (offset + 4 <= bytes.length) {
|
|
382
|
+
if (bytes[offset] !== 255) {
|
|
383
|
+
offset++;
|
|
384
|
+
continue;
|
|
385
|
+
}
|
|
386
|
+
while (offset < bytes.length && bytes[offset] === 255) offset++;
|
|
387
|
+
const marker = bytes[offset++];
|
|
388
|
+
if (marker == null) return;
|
|
389
|
+
if (marker === 216 || marker === 217 || marker === 1 || marker >= 208 && marker <= 215) continue;
|
|
390
|
+
const length = readUint16Be(bytes, offset);
|
|
391
|
+
if (length < 2) return;
|
|
392
|
+
const dataOffset = offset + 2;
|
|
393
|
+
const dataEnd = offset + length;
|
|
394
|
+
if (dataEnd > bytes.length) return;
|
|
395
|
+
if (marker === 224 && length >= 14 && hasBytes(bytes, dataOffset, [
|
|
396
|
+
74,
|
|
397
|
+
70,
|
|
398
|
+
73,
|
|
399
|
+
70,
|
|
400
|
+
0
|
|
401
|
+
])) {
|
|
402
|
+
const units = bytes[dataOffset + 7];
|
|
403
|
+
const xDensity = readUint16Be(bytes, dataOffset + 8);
|
|
404
|
+
const yDensity = readUint16Be(bytes, dataOffset + 10);
|
|
405
|
+
if (!xDensity || !yDensity) return;
|
|
406
|
+
if (units === 1) return {
|
|
407
|
+
x: Math.round(xDensity / METERS_PER_INCH),
|
|
408
|
+
y: Math.round(yDensity / METERS_PER_INCH)
|
|
409
|
+
};
|
|
410
|
+
if (units === 2) return {
|
|
411
|
+
x: xDensity * 100,
|
|
412
|
+
y: yDensity * 100
|
|
413
|
+
};
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
offset = dataEnd;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
function hasBytes(bytes, offset, expected) {
|
|
420
|
+
return expected.every((value, index) => bytes[offset + index] === value);
|
|
421
|
+
}
|
|
422
|
+
function readUint16Be(bytes, offset) {
|
|
423
|
+
return (bytes[offset] ?? 0) << 8 | (bytes[offset + 1] ?? 0);
|
|
424
|
+
}
|
|
425
|
+
function readUint32Be(bytes, offset) {
|
|
426
|
+
return ((bytes[offset] ?? 0) << 24 >>> 0 | (bytes[offset + 1] ?? 0) << 16 | (bytes[offset + 2] ?? 0) << 8 | (bytes[offset + 3] ?? 0)) >>> 0;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
|
|
291
431
|
function _typeof(o) {
|
|
292
432
|
"@babel/helpers - typeof";
|
|
293
433
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -298,7 +438,7 @@ function _typeof(o) {
|
|
|
298
438
|
}
|
|
299
439
|
|
|
300
440
|
//#endregion
|
|
301
|
-
//#region \0@oxc-project+runtime@0.
|
|
441
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
|
|
302
442
|
function toPrimitive(t, r) {
|
|
303
443
|
if ("object" != _typeof(t) || !t) return t;
|
|
304
444
|
var e = t[Symbol.toPrimitive];
|
|
@@ -311,14 +451,14 @@ function toPrimitive(t, r) {
|
|
|
311
451
|
}
|
|
312
452
|
|
|
313
453
|
//#endregion
|
|
314
|
-
//#region \0@oxc-project+runtime@0.
|
|
454
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
|
|
315
455
|
function toPropertyKey(t) {
|
|
316
456
|
var i = toPrimitive(t, "string");
|
|
317
457
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
318
458
|
}
|
|
319
459
|
|
|
320
460
|
//#endregion
|
|
321
|
-
//#region \0@oxc-project+runtime@0.
|
|
461
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
|
|
322
462
|
function _defineProperty(e, r, t) {
|
|
323
463
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
324
464
|
value: t,
|
|
@@ -329,7 +469,7 @@ function _defineProperty(e, r, t) {
|
|
|
329
469
|
}
|
|
330
470
|
|
|
331
471
|
//#endregion
|
|
332
|
-
//#region \0@oxc-project+runtime@0.
|
|
472
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateParam.js
|
|
333
473
|
function __decorateParam(paramIndex, decorator) {
|
|
334
474
|
return function(target, key) {
|
|
335
475
|
decorator(target, key, paramIndex);
|
|
@@ -337,7 +477,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
337
477
|
}
|
|
338
478
|
|
|
339
479
|
//#endregion
|
|
340
|
-
//#region \0@oxc-project+runtime@0.
|
|
480
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
|
|
341
481
|
function __decorate(decorators, target, key, desc) {
|
|
342
482
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
343
483
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -439,6 +579,44 @@ let SheetDrawingUpdateController = class SheetDrawingUpdateController extends Di
|
|
|
439
579
|
}
|
|
440
580
|
return false;
|
|
441
581
|
}
|
|
582
|
+
async setWorksheetBackgroundImage(files) {
|
|
583
|
+
const file = (files ?? await this._fileOpenerService.openFile({
|
|
584
|
+
multiple: false,
|
|
585
|
+
accept: DRAWING_IMAGE_ALLOW_IMAGE_LIST.map((image) => `.${image.replace("image/", "")}`).join(",")
|
|
586
|
+
}))[0];
|
|
587
|
+
if (!file) return false;
|
|
588
|
+
let imageParam;
|
|
589
|
+
try {
|
|
590
|
+
imageParam = await this._imageIoService.saveImage(file);
|
|
591
|
+
} catch (error) {
|
|
592
|
+
const type = error.message;
|
|
593
|
+
if (type === ImageUploadStatusType.ERROR_EXCEED_SIZE) this._messageService.show({
|
|
594
|
+
type: MessageType.Error,
|
|
595
|
+
content: this._localeService.t("sheets-drawing-ui.update-status.exceedMaxSize", String(getDrawingImageAllowSize() / 1048576))
|
|
596
|
+
});
|
|
597
|
+
else if (type === ImageUploadStatusType.ERROR_IMAGE_TYPE) this._messageService.show({
|
|
598
|
+
type: MessageType.Error,
|
|
599
|
+
content: this._localeService.t("sheets-drawing-ui.update-status.invalidImageType")
|
|
600
|
+
});
|
|
601
|
+
else if (type === ImageUploadStatusType.ERROR_IMAGE) this._messageService.show({
|
|
602
|
+
type: MessageType.Error,
|
|
603
|
+
content: this._localeService.t("sheets-drawing-ui.update-status.invalidImage")
|
|
604
|
+
});
|
|
605
|
+
return false;
|
|
606
|
+
}
|
|
607
|
+
if (!imageParam) return false;
|
|
608
|
+
const { unitId, subUnitId } = this._getUnitInfo();
|
|
609
|
+
const scale = getWorksheetBackgroundImageScale(imageParam.base64Cache || imageParam.source);
|
|
610
|
+
return this._commandService.executeCommand(SetWorksheetBackgroundImageCommand.id, {
|
|
611
|
+
unitId,
|
|
612
|
+
subUnitId,
|
|
613
|
+
backgroundImage: {
|
|
614
|
+
source: imageParam.source,
|
|
615
|
+
imageSourceType: imageParam.imageSourceType,
|
|
616
|
+
...scale
|
|
617
|
+
}
|
|
618
|
+
});
|
|
619
|
+
}
|
|
442
620
|
insertCellImageByFile(file, location) {
|
|
443
621
|
return this._insertCellImage(file, location);
|
|
444
622
|
}
|
|
@@ -450,7 +628,7 @@ let SheetDrawingUpdateController = class SheetDrawingUpdateController extends Di
|
|
|
450
628
|
const type = error.message;
|
|
451
629
|
if (type === ImageUploadStatusType.ERROR_EXCEED_SIZE) this._messageService.show({
|
|
452
630
|
type: MessageType.Error,
|
|
453
|
-
content: this._localeService.t("sheets-drawing-ui.update-status.exceedMaxSize", String(getDrawingImageAllowSize() /
|
|
631
|
+
content: this._localeService.t("sheets-drawing-ui.update-status.exceedMaxSize", String(getDrawingImageAllowSize() / 1048576))
|
|
454
632
|
});
|
|
455
633
|
else if (type === ImageUploadStatusType.ERROR_IMAGE_TYPE) this._messageService.show({
|
|
456
634
|
type: MessageType.Error,
|
|
@@ -504,7 +682,7 @@ let SheetDrawingUpdateController = class SheetDrawingUpdateController extends Di
|
|
|
504
682
|
const type = error.message;
|
|
505
683
|
if (type === ImageUploadStatusType.ERROR_EXCEED_SIZE) this._messageService.show({
|
|
506
684
|
type: MessageType.Error,
|
|
507
|
-
content: this._localeService.t("sheets-drawing-ui.update-status.exceedMaxSize", String(getDrawingImageAllowSize() /
|
|
685
|
+
content: this._localeService.t("sheets-drawing-ui.update-status.exceedMaxSize", String(getDrawingImageAllowSize() / 1048576))
|
|
508
686
|
});
|
|
509
687
|
else if (type === ImageUploadStatusType.ERROR_IMAGE_TYPE) this._messageService.show({
|
|
510
688
|
type: MessageType.Error,
|
|
@@ -1347,6 +1525,24 @@ const SaveCellImagesCommand = {
|
|
|
1347
1525
|
}
|
|
1348
1526
|
};
|
|
1349
1527
|
|
|
1528
|
+
//#endregion
|
|
1529
|
+
//#region src/commands/commands/worksheet-background-image.command.ts
|
|
1530
|
+
const AddWorksheetBackgroundImageCommand = {
|
|
1531
|
+
id: "sheet.command.add-worksheet-background-image",
|
|
1532
|
+
type: CommandType.COMMAND,
|
|
1533
|
+
handler: (accessor, params) => {
|
|
1534
|
+
var _getCurrentTypeOfRend;
|
|
1535
|
+
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
1536
|
+
const renderManagerService = accessor.get(IRenderManagerService);
|
|
1537
|
+
return ((_getCurrentTypeOfRend = getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_SHEET, univerInstanceService, renderManagerService)) === null || _getCurrentTypeOfRend === void 0 ? void 0 : _getCurrentTypeOfRend.with(SheetDrawingUpdateController).setWorksheetBackgroundImage(params === null || params === void 0 ? void 0 : params.files)) ?? false;
|
|
1538
|
+
}
|
|
1539
|
+
};
|
|
1540
|
+
const DeleteWorksheetBackgroundImageCommand = {
|
|
1541
|
+
id: "sheet.command.delete-worksheet-background-image",
|
|
1542
|
+
type: CommandType.COMMAND,
|
|
1543
|
+
handler: (accessor) => accessor.get(ICommandService).executeCommand(SetWorksheetBackgroundImageCommand.id, { backgroundImage: null })
|
|
1544
|
+
};
|
|
1545
|
+
|
|
1350
1546
|
//#endregion
|
|
1351
1547
|
//#region src/views/sheet-image-panel/component-name.ts
|
|
1352
1548
|
/**
|
|
@@ -1391,9 +1587,7 @@ const SidebarSheetDrawingOperation = {
|
|
|
1391
1587
|
width: 360
|
|
1392
1588
|
});
|
|
1393
1589
|
break;
|
|
1394
|
-
default:
|
|
1395
|
-
sidebarService.close(COMPONENT_SHEET_DRAWING_PANEL);
|
|
1396
|
-
break;
|
|
1590
|
+
default: sidebarService.close(COMPONENT_SHEET_DRAWING_PANEL);
|
|
1397
1591
|
}
|
|
1398
1592
|
return true;
|
|
1399
1593
|
}
|
|
@@ -1472,20 +1666,32 @@ let SheetsDrawingGroupCopyPasteController = class SheetsDrawingGroupCopyPasteCon
|
|
|
1472
1666
|
}
|
|
1473
1667
|
});
|
|
1474
1668
|
}
|
|
1475
|
-
registerFeaturePasteHook(hook) {
|
|
1476
|
-
|
|
1669
|
+
registerFeaturePasteHook(hook, options) {
|
|
1670
|
+
const entry = {
|
|
1671
|
+
hook,
|
|
1672
|
+
beforeDrawing: (options === null || options === void 0 ? void 0 : options.beforeDrawing) === true
|
|
1673
|
+
};
|
|
1674
|
+
this._featurePasteHooks.push(entry);
|
|
1675
|
+
return toDisposable(() => {
|
|
1676
|
+
const index = this._featurePasteHooks.indexOf(entry);
|
|
1677
|
+
if (index >= 0) this._featurePasteHooks.splice(index, 1);
|
|
1678
|
+
});
|
|
1477
1679
|
}
|
|
1478
|
-
_getGroupFeaturePasteMutations(params) {
|
|
1680
|
+
_getGroupFeaturePasteMutations(params, beforeDrawing) {
|
|
1479
1681
|
const redos = [];
|
|
1480
1682
|
const undos = [];
|
|
1481
|
-
|
|
1482
|
-
|
|
1683
|
+
let cancel = false;
|
|
1684
|
+
for (const entry of this._featurePasteHooks) {
|
|
1685
|
+
if (entry.beforeDrawing !== beforeDrawing) continue;
|
|
1686
|
+
const result = entry.hook(params);
|
|
1483
1687
|
redos.push(...result.redos);
|
|
1484
1688
|
undos.push(...result.undos);
|
|
1689
|
+
cancel = cancel || result.cancel === true;
|
|
1485
1690
|
}
|
|
1486
1691
|
return {
|
|
1487
1692
|
redos,
|
|
1488
|
-
undos
|
|
1693
|
+
undos,
|
|
1694
|
+
cancel
|
|
1489
1695
|
};
|
|
1490
1696
|
}
|
|
1491
1697
|
_generateGroupPasteMutations(pasteTo) {
|
|
@@ -1503,6 +1709,19 @@ let SheetsDrawingGroupCopyPasteController = class SheetsDrawingGroupCopyPasteCon
|
|
|
1503
1709
|
const origRootGroup = groupNestedParam.groups[groupNestedParam.groups.length - 1];
|
|
1504
1710
|
const { cloned, idMap } = cloneGroupParams(groupNestedParam);
|
|
1505
1711
|
const newRootGroupId = cloned.groups[cloned.groups.length - 1].drawingId;
|
|
1712
|
+
const featureParams = {
|
|
1713
|
+
fromUnitId: this._copyInfo.unitId,
|
|
1714
|
+
fromSubUnitId: this._copyInfo.subUnitId,
|
|
1715
|
+
toUnitId: unitId,
|
|
1716
|
+
toSubUnitId: subUnitId,
|
|
1717
|
+
idMap,
|
|
1718
|
+
cloned
|
|
1719
|
+
};
|
|
1720
|
+
const beforeDrawingMutations = this._getGroupFeaturePasteMutations(featureParams, true);
|
|
1721
|
+
if (beforeDrawingMutations.cancel) return {
|
|
1722
|
+
redos: [],
|
|
1723
|
+
undos: []
|
|
1724
|
+
};
|
|
1506
1725
|
const pasteRange = discreteRangeToRange(range);
|
|
1507
1726
|
const pasteRect = attachRangeWithCoord(pasteToSkeleton, {
|
|
1508
1727
|
startRow: pasteRange.startRow,
|
|
@@ -1539,7 +1758,12 @@ let SheetsDrawingGroupCopyPasteController = class SheetsDrawingGroupCopyPasteCon
|
|
|
1539
1758
|
};
|
|
1540
1759
|
})];
|
|
1541
1760
|
const { undo: removeOp, redo: insertOp, objects } = this._sheetDrawingService.getBatchAddOp(allDrawings);
|
|
1542
|
-
const
|
|
1761
|
+
const afterDrawingMutations = this._getGroupFeaturePasteMutations(featureParams, false);
|
|
1762
|
+
if (afterDrawingMutations.cancel) return {
|
|
1763
|
+
redos: [],
|
|
1764
|
+
undos: []
|
|
1765
|
+
};
|
|
1766
|
+
const drawingRedo = {
|
|
1543
1767
|
id: SetDrawingApplyMutation.id,
|
|
1544
1768
|
params: {
|
|
1545
1769
|
op: insertOp,
|
|
@@ -1548,8 +1772,8 @@ let SheetsDrawingGroupCopyPasteController = class SheetsDrawingGroupCopyPasteCon
|
|
|
1548
1772
|
objects,
|
|
1549
1773
|
type: DrawingApplyType.INSERT
|
|
1550
1774
|
}
|
|
1551
|
-
}
|
|
1552
|
-
const
|
|
1775
|
+
};
|
|
1776
|
+
const drawingUndo = {
|
|
1553
1777
|
id: SetDrawingApplyMutation.id,
|
|
1554
1778
|
params: {
|
|
1555
1779
|
op: removeOp,
|
|
@@ -1558,20 +1782,18 @@ let SheetsDrawingGroupCopyPasteController = class SheetsDrawingGroupCopyPasteCon
|
|
|
1558
1782
|
objects,
|
|
1559
1783
|
type: DrawingApplyType.REMOVE
|
|
1560
1784
|
}
|
|
1561
|
-
}
|
|
1562
|
-
const featureMutations = this._getGroupFeaturePasteMutations({
|
|
1563
|
-
fromUnitId: this._copyInfo.unitId,
|
|
1564
|
-
fromSubUnitId: this._copyInfo.subUnitId,
|
|
1565
|
-
toUnitId: unitId,
|
|
1566
|
-
toSubUnitId: subUnitId,
|
|
1567
|
-
idMap,
|
|
1568
|
-
cloned
|
|
1569
|
-
});
|
|
1570
|
-
redos.push(...featureMutations.redos);
|
|
1571
|
-
undos.push(...featureMutations.undos);
|
|
1785
|
+
};
|
|
1572
1786
|
return {
|
|
1573
|
-
redos
|
|
1574
|
-
|
|
1787
|
+
redos: [
|
|
1788
|
+
...beforeDrawingMutations.redos,
|
|
1789
|
+
drawingRedo,
|
|
1790
|
+
...afterDrawingMutations.redos
|
|
1791
|
+
],
|
|
1792
|
+
undos: [
|
|
1793
|
+
drawingUndo,
|
|
1794
|
+
...beforeDrawingMutations.undos,
|
|
1795
|
+
...afterDrawingMutations.undos
|
|
1796
|
+
]
|
|
1575
1797
|
};
|
|
1576
1798
|
}
|
|
1577
1799
|
dispose() {
|
|
@@ -2306,7 +2528,8 @@ let SheetCanvasFloatDomManagerService = _SheetCanvasFloatDomManagerService = cla
|
|
|
2306
2528
|
});
|
|
2307
2529
|
previewSubscription && disposableCollection.add(previewSubscription);
|
|
2308
2530
|
}
|
|
2309
|
-
const
|
|
2531
|
+
const initPosition = calcSheetFloatDomPosition(rect, renderObject.renderUnit.scene, skeleton.skeleton, target.worksheet);
|
|
2532
|
+
const position$ = new BehaviorSubject(initPosition);
|
|
2310
2533
|
const domId = `${SHEET_FLOAT_DOM_PREFIX}${generateRandomId(6)}`;
|
|
2311
2534
|
const shouldAutoMountRuntime = shouldAutoMountFloatDomRuntime(floatDomParam);
|
|
2312
2535
|
const shouldSyncEmbedRuntimeStage = isEmbedFloatDomData(floatDomParam);
|
|
@@ -2612,8 +2835,10 @@ let SheetCanvasFloatDomManagerService = _SheetCanvasFloatDomManagerService = cla
|
|
|
2612
2835
|
if (renderObject && sheetDrawing.drawingType !== DrawingTypeEnum.DRAWING_CHART) {
|
|
2613
2836
|
const { scene } = renderObject;
|
|
2614
2837
|
const floatDomInfo = this._domLayerInfoMap.get(data.drawingId);
|
|
2615
|
-
if (floatDomInfo === null || floatDomInfo === void 0 ? void 0 : floatDomInfo.rect)
|
|
2616
|
-
|
|
2838
|
+
if (floatDomInfo === null || floatDomInfo === void 0 ? void 0 : floatDomInfo.rect) {
|
|
2839
|
+
if (sheetDrawing.allowTransform === false) scene.detachTransformerFrom(floatDomInfo.rect);
|
|
2840
|
+
else scene.attachTransformerTo(floatDomInfo.rect);
|
|
2841
|
+
}
|
|
2617
2842
|
}
|
|
2618
2843
|
});
|
|
2619
2844
|
}));
|
|
@@ -2847,7 +3072,8 @@ let SheetCanvasFloatDomManagerService = _SheetCanvasFloatDomManagerService = cla
|
|
|
2847
3072
|
subUnitId,
|
|
2848
3073
|
id: drawingId
|
|
2849
3074
|
};
|
|
2850
|
-
const
|
|
3075
|
+
const initedPosition = calcSheetFloatDomPosition(domRect, renderObject.renderUnit.scene, skeletonParam.skeleton, target.worksheet, floatDomInfo);
|
|
3076
|
+
const position$ = new BehaviorSubject(initedPosition);
|
|
2851
3077
|
floatDomInfo.position$ = position$;
|
|
2852
3078
|
let floatDomCfg = {
|
|
2853
3079
|
position$,
|
|
@@ -2889,11 +3115,12 @@ let SheetCanvasFloatDomManagerService = _SheetCanvasFloatDomManagerService = cla
|
|
|
2889
3115
|
top: rangePosition.absolute.top
|
|
2890
3116
|
}
|
|
2891
3117
|
}, domAnchor);
|
|
2892
|
-
const
|
|
3118
|
+
const rectShapeKey = getDrawingShapeKeyByDrawingSearch({
|
|
2893
3119
|
unitId,
|
|
2894
3120
|
subUnitId,
|
|
2895
3121
|
drawingId
|
|
2896
|
-
})
|
|
3122
|
+
});
|
|
3123
|
+
const newRect = new Rect(rectShapeKey, {
|
|
2897
3124
|
left: calcOffsetPos.startX,
|
|
2898
3125
|
top: calcOffsetPos.startY,
|
|
2899
3126
|
width: domAnchor.width ?? newRangePos.width,
|
|
@@ -3022,13 +3249,14 @@ let SheetCanvasFloatDomManagerService = _SheetCanvasFloatDomManagerService = cla
|
|
|
3022
3249
|
top: rangePosition.absolute.top
|
|
3023
3250
|
}
|
|
3024
3251
|
}, domLayoutParam);
|
|
3025
|
-
const
|
|
3252
|
+
const headerRectConfig = {
|
|
3026
3253
|
left: calcOffsetPos.startX,
|
|
3027
3254
|
top: calcOffsetPos.startY,
|
|
3028
3255
|
width: calcOffsetPos.width,
|
|
3029
3256
|
height: calcOffsetPos.height,
|
|
3030
3257
|
zIndex: this._drawingManagerService.getDrawingOrder(unitId, subUnitId).length - 1
|
|
3031
|
-
}
|
|
3258
|
+
};
|
|
3259
|
+
const domRect = new Rect(rectShapeKey, headerRectConfig);
|
|
3032
3260
|
scene.addObject(domRect, DRAWING_OBJECT_LAYER_INDEX);
|
|
3033
3261
|
if (floatDomParam.allowTransform !== false) scene.attachTransformerTo(domRect);
|
|
3034
3262
|
const disposableCollection = new DisposableCollection();
|
|
@@ -3048,7 +3276,8 @@ let SheetCanvasFloatDomManagerService = _SheetCanvasFloatDomManagerService = cla
|
|
|
3048
3276
|
domAnchor: domLayoutParam,
|
|
3049
3277
|
scrollDirectionResponse: "HORIZONTAL"
|
|
3050
3278
|
};
|
|
3051
|
-
const
|
|
3279
|
+
const initedPosition = calcSheetFloatDomPosition(domRect, renderObject.renderUnit.scene, skeleton.skeleton, target.worksheet, floatDomInfo);
|
|
3280
|
+
const position$ = new BehaviorSubject(initedPosition);
|
|
3052
3281
|
floatDomInfo.position$ = position$;
|
|
3053
3282
|
let floatDomCfg = {
|
|
3054
3283
|
position$,
|
|
@@ -3094,11 +3323,12 @@ let SheetCanvasFloatDomManagerService = _SheetCanvasFloatDomManagerService = cla
|
|
|
3094
3323
|
top: rangePosition.absolute.top
|
|
3095
3324
|
}
|
|
3096
3325
|
}, domLayoutParam);
|
|
3097
|
-
const
|
|
3326
|
+
const rectShapeKey = getDrawingShapeKeyByDrawingSearch({
|
|
3098
3327
|
unitId,
|
|
3099
3328
|
subUnitId,
|
|
3100
3329
|
drawingId
|
|
3101
|
-
})
|
|
3330
|
+
});
|
|
3331
|
+
const newRect = new Rect(rectShapeKey, {
|
|
3102
3332
|
left: calcOffsetPos.startX,
|
|
3103
3333
|
top: 0,
|
|
3104
3334
|
width: domLayoutParam.width,
|
|
@@ -3373,6 +3603,64 @@ function SaveCellImagesMenuFactory(accessor) {
|
|
|
3373
3603
|
};
|
|
3374
3604
|
}
|
|
3375
3605
|
|
|
3606
|
+
//#endregion
|
|
3607
|
+
//#region src/menu/worksheet-background-image.menu.ts
|
|
3608
|
+
const WORKSHEET_BACKGROUND_IMAGE_MENU_ID = "sheet.menu.worksheet-background-image";
|
|
3609
|
+
function worksheetBackgroundImagePresent$(accessor) {
|
|
3610
|
+
const commandService = accessor.get(ICommandService);
|
|
3611
|
+
const instanceService = accessor.get(IUniverInstanceService);
|
|
3612
|
+
return new Observable((observer) => {
|
|
3613
|
+
const getValue = () => {
|
|
3614
|
+
const workbook = instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
3615
|
+
return !!(workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getConfig().backgroundImage);
|
|
3616
|
+
};
|
|
3617
|
+
const disposables = new DisposableCollection();
|
|
3618
|
+
disposables.add(commandService.onCommandExecuted((command) => {
|
|
3619
|
+
if (command.id === SetWorksheetBackgroundImageMutation.id || command.id === SetWorksheetActiveOperation.id) observer.next(getValue());
|
|
3620
|
+
}));
|
|
3621
|
+
disposables.add(instanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).subscribe(() => {
|
|
3622
|
+
observer.next(getValue());
|
|
3623
|
+
}));
|
|
3624
|
+
observer.next(getValue());
|
|
3625
|
+
return () => disposables.dispose();
|
|
3626
|
+
});
|
|
3627
|
+
}
|
|
3628
|
+
function worksheetBackgroundImagePermissionDisabled$(accessor) {
|
|
3629
|
+
return getCurrentRangeDisable$(accessor, {
|
|
3630
|
+
workbookTypes: [WorkbookEditablePermission],
|
|
3631
|
+
worksheetTypes: [WorksheetEditPermission]
|
|
3632
|
+
});
|
|
3633
|
+
}
|
|
3634
|
+
function WorksheetBackgroundImageMenuFactory(accessor) {
|
|
3635
|
+
return {
|
|
3636
|
+
id: WORKSHEET_BACKGROUND_IMAGE_MENU_ID,
|
|
3637
|
+
type: MenuItemType.SUBITEMS,
|
|
3638
|
+
icon: "AddImageIcon",
|
|
3639
|
+
tooltip: "sheets-drawing-ui.backgroundImage.title",
|
|
3640
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
3641
|
+
disabled$: worksheetBackgroundImagePermissionDisabled$(accessor)
|
|
3642
|
+
};
|
|
3643
|
+
}
|
|
3644
|
+
function AddWorksheetBackgroundImageMenuFactory(accessor) {
|
|
3645
|
+
return {
|
|
3646
|
+
id: AddWorksheetBackgroundImageCommand.id,
|
|
3647
|
+
type: MenuItemType.BUTTON,
|
|
3648
|
+
title: "sheets-drawing-ui.backgroundImage.add",
|
|
3649
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
3650
|
+
disabled$: worksheetBackgroundImagePermissionDisabled$(accessor)
|
|
3651
|
+
};
|
|
3652
|
+
}
|
|
3653
|
+
function DeleteWorksheetBackgroundImageMenuFactory(accessor) {
|
|
3654
|
+
const permissionDisabled$ = worksheetBackgroundImagePermissionDisabled$(accessor);
|
|
3655
|
+
return {
|
|
3656
|
+
id: DeleteWorksheetBackgroundImageCommand.id,
|
|
3657
|
+
type: MenuItemType.BUTTON,
|
|
3658
|
+
title: "sheets-drawing-ui.backgroundImage.delete",
|
|
3659
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
3660
|
+
disabled$: combineLatest([permissionDisabled$, worksheetBackgroundImagePresent$(accessor)]).pipe(map(([permissionDisabled, present]) => permissionDisabled || !present))
|
|
3661
|
+
};
|
|
3662
|
+
}
|
|
3663
|
+
|
|
3376
3664
|
//#endregion
|
|
3377
3665
|
//#region src/menu/schema.ts
|
|
3378
3666
|
const menuSchema = {
|
|
@@ -3394,6 +3682,24 @@ const menuSchema = {
|
|
|
3394
3682
|
menuItemFactory: UploadCellImageMenuFactory
|
|
3395
3683
|
}
|
|
3396
3684
|
} },
|
|
3685
|
+
[RibbonPosition.VIEW]: { [RibbonViewGroup.DISPLAY]: { [WORKSHEET_BACKGROUND_IMAGE_MENU_ID]: {
|
|
3686
|
+
order: .5,
|
|
3687
|
+
gridLayout: {
|
|
3688
|
+
row: 1,
|
|
3689
|
+
column: 2,
|
|
3690
|
+
rowSpan: 2,
|
|
3691
|
+
showLabel: true
|
|
3692
|
+
},
|
|
3693
|
+
menuItemFactory: WorksheetBackgroundImageMenuFactory,
|
|
3694
|
+
[AddWorksheetBackgroundImageCommand.id]: {
|
|
3695
|
+
order: 0,
|
|
3696
|
+
menuItemFactory: AddWorksheetBackgroundImageMenuFactory
|
|
3697
|
+
},
|
|
3698
|
+
[DeleteWorksheetBackgroundImageCommand.id]: {
|
|
3699
|
+
order: 1,
|
|
3700
|
+
menuItemFactory: DeleteWorksheetBackgroundImageMenuFactory
|
|
3701
|
+
}
|
|
3702
|
+
} } },
|
|
3397
3703
|
[ContextMenuPosition.MAIN_AREA]: { [ContextMenuGroup.OTHERS]: { [SaveCellImagesCommand.id]: {
|
|
3398
3704
|
order: 10,
|
|
3399
3705
|
menuItemFactory: SaveCellImagesMenuFactory
|
|
@@ -3411,7 +3717,7 @@ const menuSchema = {
|
|
|
3411
3717
|
//#endregion
|
|
3412
3718
|
//#region package.json
|
|
3413
3719
|
var name = "@univerjs/sheets-drawing-ui";
|
|
3414
|
-
var version = "1.0.0
|
|
3720
|
+
var version = "1.0.0";
|
|
3415
3721
|
|
|
3416
3722
|
//#endregion
|
|
3417
3723
|
//#region src/config/config.ts
|
|
@@ -3516,7 +3822,7 @@ function BatchSaveImagesDialog({ SelectComponent = Select } = {}) {
|
|
|
3516
3822
|
}));
|
|
3517
3823
|
}, [dataColumns]);
|
|
3518
3824
|
const [selectedColumn, setSelectedColumn] = useState(() => columnOptions.length > 0 ? columnOptions[0].value : "0");
|
|
3519
|
-
|
|
3825
|
+
const highlightRanges = useMemo(() => {
|
|
3520
3826
|
if (!fileNameParts.includes("columnValue") || !rowRange) return [];
|
|
3521
3827
|
const colIndex = Number(selectedColumn);
|
|
3522
3828
|
return [{
|
|
@@ -3529,7 +3835,8 @@ function BatchSaveImagesDialog({ SelectComponent = Select } = {}) {
|
|
|
3529
3835
|
fileNameParts,
|
|
3530
3836
|
selectedColumn,
|
|
3531
3837
|
rowRange
|
|
3532
|
-
])
|
|
3838
|
+
]);
|
|
3839
|
+
useHighlightRange(highlightRanges);
|
|
3533
3840
|
const handleFileNamePartsChange = useCallback((value) => {
|
|
3534
3841
|
if (value.length === 0) return;
|
|
3535
3842
|
setFileNameParts(value);
|
|
@@ -3654,7 +3961,8 @@ const SheetDrawingAnchor = (props) => {
|
|
|
3654
3961
|
const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
|
|
3655
3962
|
const transformer = scene === null || scene === void 0 ? void 0 : scene.getTransformerByCreate();
|
|
3656
3963
|
const [anchorShow, setAnchorShow] = useState(true);
|
|
3657
|
-
const
|
|
3964
|
+
const type = drawingParam ? getSheetDrawingPlacement(drawingParam).kind : SheetDrawingAnchorType.Position;
|
|
3965
|
+
const [value, setValue] = useState(type);
|
|
3658
3966
|
function getUpdateParams(objects, drawingManagerService) {
|
|
3659
3967
|
const params = [];
|
|
3660
3968
|
objects.forEach((object) => {
|
|
@@ -3936,6 +4244,70 @@ SheetsDrawingRenderController = __decorate([
|
|
|
3936
4244
|
__decorateParam(3, Inject(SheetSkeletonService))
|
|
3937
4245
|
], SheetsDrawingRenderController);
|
|
3938
4246
|
|
|
4247
|
+
//#endregion
|
|
4248
|
+
//#region src/views/background/worksheet-background-image.extension.ts
|
|
4249
|
+
const WORKSHEET_BACKGROUND_IMAGE_EXTENSION_KEY = "WorksheetBackgroundImageExtension";
|
|
4250
|
+
var WorksheetBackgroundImageExtension = class extends SheetExtension {
|
|
4251
|
+
constructor(injector, _requestRender) {
|
|
4252
|
+
super();
|
|
4253
|
+
this._requestRender = _requestRender;
|
|
4254
|
+
_defineProperty(this, "uKey", WORKSHEET_BACKGROUND_IMAGE_EXTENSION_KEY);
|
|
4255
|
+
_defineProperty(this, "type", SHEET_EXTENSION_TYPE.BACKGROUND);
|
|
4256
|
+
_defineProperty(this, "_imageCache", void 0);
|
|
4257
|
+
this._imageCache = new ImageCacheMap(injector);
|
|
4258
|
+
}
|
|
4259
|
+
draw(ctx, _parentScale, spreadsheetSkeleton, diffRanges, drawInfo) {
|
|
4260
|
+
const backgroundImage = spreadsheetSkeleton.worksheet.getConfig().backgroundImage;
|
|
4261
|
+
if (!backgroundImage) return;
|
|
4262
|
+
const image = this._imageCache.getImage(backgroundImage.imageSourceType, backgroundImage.source, this._requestRender, this._requestRender);
|
|
4263
|
+
if (!image || !image.complete || image.naturalWidth === 0 || image.getAttribute("data-error")) return;
|
|
4264
|
+
const pattern = ctx.createPattern(image, "repeat");
|
|
4265
|
+
if (!pattern) return;
|
|
4266
|
+
const scaleX = backgroundImage.scaleX ?? 1;
|
|
4267
|
+
const scaleY = backgroundImage.scaleY ?? 1;
|
|
4268
|
+
if (scaleX !== 1 || scaleY !== 1) pattern.setTransform({
|
|
4269
|
+
a: scaleX,
|
|
4270
|
+
d: scaleY
|
|
4271
|
+
});
|
|
4272
|
+
const ranges = diffRanges.length > 0 ? diffRanges : drawInfo.viewRanges;
|
|
4273
|
+
const { columnWidthAccumulation, rowHeightAccumulation } = spreadsheetSkeleton;
|
|
4274
|
+
if (!columnWidthAccumulation || !rowHeightAccumulation) return;
|
|
4275
|
+
ctx.save();
|
|
4276
|
+
ctx.fillStyle = pattern;
|
|
4277
|
+
ranges.forEach((range) => {
|
|
4278
|
+
const startX = range.startColumn > 0 ? columnWidthAccumulation[range.startColumn - 1] : 0;
|
|
4279
|
+
const startY = range.startRow > 0 ? rowHeightAccumulation[range.startRow - 1] : 0;
|
|
4280
|
+
const endX = columnWidthAccumulation[range.endColumn];
|
|
4281
|
+
const endY = rowHeightAccumulation[range.endRow];
|
|
4282
|
+
if (endX != null && endY != null) ctx.fillRect(startX, startY, endX - startX, endY - startY);
|
|
4283
|
+
});
|
|
4284
|
+
ctx.restore();
|
|
4285
|
+
}
|
|
4286
|
+
};
|
|
4287
|
+
|
|
4288
|
+
//#endregion
|
|
4289
|
+
//#region src/controllers/render-controllers/worksheet-background.render-controller.ts
|
|
4290
|
+
let WorksheetBackgroundRenderController = class WorksheetBackgroundRenderController extends Disposable {
|
|
4291
|
+
constructor(_context, commandService, injector) {
|
|
4292
|
+
super();
|
|
4293
|
+
this._context = _context;
|
|
4294
|
+
const spreadsheet = this._context.mainComponent;
|
|
4295
|
+
const extension = new WorksheetBackgroundImageExtension(injector, () => {
|
|
4296
|
+
spreadsheet.makeForceDirty(true);
|
|
4297
|
+
this._context.scene.makeDirty();
|
|
4298
|
+
});
|
|
4299
|
+
this.disposeWithMe(spreadsheet.register(extension));
|
|
4300
|
+
this.disposeWithMe(commandService.onCommandExecuted((command) => {
|
|
4301
|
+
const params = command.params;
|
|
4302
|
+
if (command.id === SetWorksheetBackgroundImageMutation.id && (params === null || params === void 0 ? void 0 : params.unitId) === this._context.unitId) {
|
|
4303
|
+
spreadsheet.makeForceDirty(true);
|
|
4304
|
+
this._context.scene.makeDirty();
|
|
4305
|
+
}
|
|
4306
|
+
}));
|
|
4307
|
+
}
|
|
4308
|
+
};
|
|
4309
|
+
WorksheetBackgroundRenderController = __decorate([__decorateParam(1, ICommandService), __decorateParam(2, Inject(Injector))], WorksheetBackgroundRenderController);
|
|
4310
|
+
|
|
3939
4311
|
//#endregion
|
|
3940
4312
|
//#region src/controllers/sheet-cell-image.controller.ts
|
|
3941
4313
|
function resizeImageByCell(injector, location, cell) {
|
|
@@ -4252,7 +4624,7 @@ const specialPastes = [
|
|
|
4252
4624
|
PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMAT,
|
|
4253
4625
|
PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMULA
|
|
4254
4626
|
];
|
|
4255
|
-
let SheetsDrawingCopyPasteController = class SheetsDrawingCopyPasteController extends
|
|
4627
|
+
let SheetsDrawingCopyPasteController = class SheetsDrawingCopyPasteController extends RxDisposable {
|
|
4256
4628
|
constructor(_sheetClipboardService, _renderManagerService, _sheetSkeletonService, _drawingService, _clipboardInterfaceService, _commandService) {
|
|
4257
4629
|
super();
|
|
4258
4630
|
this._sheetClipboardService = _sheetClipboardService;
|
|
@@ -4268,7 +4640,7 @@ let SheetsDrawingCopyPasteController = class SheetsDrawingCopyPasteController ex
|
|
|
4268
4640
|
return this._drawingService.getFocusDrawings();
|
|
4269
4641
|
}
|
|
4270
4642
|
_initCopyPaste() {
|
|
4271
|
-
this._sheetClipboardService.addClipboardHook({
|
|
4643
|
+
this.disposeWithMe(this._sheetClipboardService.addClipboardHook({
|
|
4272
4644
|
id: "SHEET_IMAGE_UI_PLUGIN",
|
|
4273
4645
|
onBeforeCopyFocusedObject: (unitId, _subUnitId, copyType) => {
|
|
4274
4646
|
this._copyInfo = null;
|
|
@@ -4282,12 +4654,12 @@ let SheetsDrawingCopyPasteController = class SheetsDrawingCopyPasteController ex
|
|
|
4282
4654
|
};
|
|
4283
4655
|
this._commandService.executeCommand(RemoveSheetDrawingCommand.id, params);
|
|
4284
4656
|
}
|
|
4285
|
-
|
|
4657
|
+
timer(200).pipe(takeUntil(this.dispose$)).subscribe(() => {
|
|
4286
4658
|
const dispose = focusDocument();
|
|
4287
4659
|
if (drawing.drawingType === DrawingTypeEnum.DRAWING_IMAGE && drawing.imageSourceType === ImageSourceType.BASE64) copyBase64ToClipboard(drawing.source);
|
|
4288
4660
|
else this._clipboardInterfaceService.writeText("");
|
|
4289
4661
|
dispose();
|
|
4290
|
-
}
|
|
4662
|
+
});
|
|
4291
4663
|
this._copyInfo = {
|
|
4292
4664
|
unitId: drawing.unitId,
|
|
4293
4665
|
subUnitId: drawing.subUnitId,
|
|
@@ -4372,7 +4744,7 @@ let SheetsDrawingCopyPasteController = class SheetsDrawingCopyPasteController ex
|
|
|
4372
4744
|
redos: []
|
|
4373
4745
|
};
|
|
4374
4746
|
}
|
|
4375
|
-
});
|
|
4747
|
+
}));
|
|
4376
4748
|
}
|
|
4377
4749
|
_createDrawingsCopyInfoByRange(unitId, subUnitId, range) {
|
|
4378
4750
|
const skeleton = this._sheetSkeletonService.getSkeleton(unitId, subUnitId);
|
|
@@ -4899,18 +5271,19 @@ function createPrintingFloatDom(info, scene, skeleton, worksheet) {
|
|
|
4899
5271
|
}
|
|
4900
5272
|
const PrintingFloatDom = (props) => {
|
|
4901
5273
|
const { floatDomInfos, scene, skeleton, worksheet } = props;
|
|
5274
|
+
const floatDomParams = useMemo(() => floatDomInfos.map((info) => createPrintingFloatDom(info, scene, skeleton, worksheet)), [
|
|
5275
|
+
floatDomInfos,
|
|
5276
|
+
scene,
|
|
5277
|
+
skeleton,
|
|
5278
|
+
worksheet
|
|
5279
|
+
]);
|
|
4902
5280
|
return /* @__PURE__ */ jsx("div", {
|
|
4903
5281
|
style: {
|
|
4904
5282
|
position: "absolute",
|
|
4905
5283
|
top: 0,
|
|
4906
5284
|
left: 0
|
|
4907
5285
|
},
|
|
4908
|
-
children:
|
|
4909
|
-
floatDomInfos,
|
|
4910
|
-
scene,
|
|
4911
|
-
skeleton,
|
|
4912
|
-
worksheet
|
|
4913
|
-
]).map(([id, floatDom]) => /* @__PURE__ */ jsx(PrintFloatDomSingle, {
|
|
5286
|
+
children: floatDomParams.map(([id, floatDom]) => /* @__PURE__ */ jsx(PrintFloatDomSingle, {
|
|
4914
5287
|
layer: floatDom,
|
|
4915
5288
|
id,
|
|
4916
5289
|
position: floatDom.position
|
|
@@ -4918,7 +5291,8 @@ const PrintingFloatDom = (props) => {
|
|
|
4918
5291
|
});
|
|
4919
5292
|
};
|
|
4920
5293
|
function mountPrintingFloatDom(props, root, injector) {
|
|
4921
|
-
|
|
5294
|
+
const PrintingFloatDomInjector = connectInjector(PrintingFloatDom, injector);
|
|
5295
|
+
render(/* @__PURE__ */ jsx(PrintingFloatDomInjector, { ...props }), root);
|
|
4922
5296
|
return () => unmount(root);
|
|
4923
5297
|
}
|
|
4924
5298
|
|
|
@@ -5236,9 +5610,8 @@ const DeleteDrawingsShortcutItem = {
|
|
|
5236
5610
|
* limitations under the License.
|
|
5237
5611
|
*/
|
|
5238
5612
|
let SheetDrawingUIController = class SheetDrawingUIController extends Disposable {
|
|
5239
|
-
constructor(
|
|
5613
|
+
constructor(_commandService, _shortcutService, _drawingManagerService, _sidebarService) {
|
|
5240
5614
|
super();
|
|
5241
|
-
this._menuManagerService = _menuManagerService;
|
|
5242
5615
|
this._commandService = _commandService;
|
|
5243
5616
|
this._shortcutService = _shortcutService;
|
|
5244
5617
|
this._drawingManagerService = _drawingManagerService;
|
|
@@ -5246,13 +5619,12 @@ let SheetDrawingUIController = class SheetDrawingUIController extends Disposable
|
|
|
5246
5619
|
this._init();
|
|
5247
5620
|
}
|
|
5248
5621
|
_initCustomComponents() {}
|
|
5249
|
-
_initMenus() {
|
|
5250
|
-
this._menuManagerService.mergeMenu(menuSchema);
|
|
5251
|
-
}
|
|
5252
5622
|
_initCommands() {
|
|
5253
5623
|
[
|
|
5254
5624
|
InsertFloatImageCommand,
|
|
5255
5625
|
InsertCellImageCommand,
|
|
5626
|
+
AddWorksheetBackgroundImageCommand,
|
|
5627
|
+
DeleteWorksheetBackgroundImageCommand,
|
|
5256
5628
|
SidebarSheetDrawingOperation,
|
|
5257
5629
|
EditSheetDrawingOperation,
|
|
5258
5630
|
GroupSheetDrawingCommand,
|
|
@@ -5284,17 +5656,15 @@ let SheetDrawingUIController = class SheetDrawingUIController extends Disposable
|
|
|
5284
5656
|
_init() {
|
|
5285
5657
|
this._initCommands();
|
|
5286
5658
|
this._initCustomComponents();
|
|
5287
|
-
this._initMenus();
|
|
5288
5659
|
this._initShortcuts();
|
|
5289
5660
|
this._initImagePanel();
|
|
5290
5661
|
}
|
|
5291
5662
|
};
|
|
5292
5663
|
SheetDrawingUIController = __decorate([
|
|
5293
|
-
__decorateParam(0,
|
|
5294
|
-
__decorateParam(1,
|
|
5295
|
-
__decorateParam(2,
|
|
5296
|
-
__decorateParam(3,
|
|
5297
|
-
__decorateParam(4, Inject(ISidebarService))
|
|
5664
|
+
__decorateParam(0, ICommandService),
|
|
5665
|
+
__decorateParam(1, IShortcutService),
|
|
5666
|
+
__decorateParam(2, IDrawingManagerService),
|
|
5667
|
+
__decorateParam(3, Inject(ISidebarService))
|
|
5298
5668
|
], SheetDrawingUIController);
|
|
5299
5669
|
|
|
5300
5670
|
//#endregion
|
|
@@ -5576,6 +5946,72 @@ MobileDrawingPopupMenuController = __decorate([
|
|
|
5576
5946
|
__decorateParam(11, ILayoutService)
|
|
5577
5947
|
], MobileDrawingPopupMenuController);
|
|
5578
5948
|
|
|
5949
|
+
//#endregion
|
|
5950
|
+
//#region src/menu/mobile-schema.ts
|
|
5951
|
+
const mobileMenuSchema = {
|
|
5952
|
+
[RibbonInsertGroup.MEDIA]: { [SHEETS_IMAGE_MENU_ID]: {
|
|
5953
|
+
order: 0,
|
|
5954
|
+
menuItemFactory: ImageMenuFactory,
|
|
5955
|
+
[InsertFloatImageCommand.id]: {
|
|
5956
|
+
order: 0,
|
|
5957
|
+
menuItemFactory: UploadFloatImageMenuFactory
|
|
5958
|
+
},
|
|
5959
|
+
[InsertCellImageCommand.id]: {
|
|
5960
|
+
order: 1,
|
|
5961
|
+
menuItemFactory: UploadCellImageMenuFactory
|
|
5962
|
+
}
|
|
5963
|
+
} },
|
|
5964
|
+
[RibbonDataGroup.ORGANIZATION]: { [WORKSHEET_BACKGROUND_IMAGE_MENU_ID]: {
|
|
5965
|
+
order: 22,
|
|
5966
|
+
menuItemFactory: WorksheetBackgroundImageMenuFactory,
|
|
5967
|
+
[AddWorksheetBackgroundImageCommand.id]: {
|
|
5968
|
+
order: 0,
|
|
5969
|
+
menuItemFactory: AddWorksheetBackgroundImageMenuFactory
|
|
5970
|
+
},
|
|
5971
|
+
[DeleteWorksheetBackgroundImageCommand.id]: {
|
|
5972
|
+
order: 1,
|
|
5973
|
+
menuItemFactory: DeleteWorksheetBackgroundImageMenuFactory
|
|
5974
|
+
}
|
|
5975
|
+
} },
|
|
5976
|
+
[ContextMenuPosition.MAIN_AREA]: { [ContextMenuGroup.OTHERS]: { [SaveCellImagesCommand.id]: {
|
|
5977
|
+
order: 10,
|
|
5978
|
+
menuItemFactory: SaveCellImagesMenuFactory
|
|
5979
|
+
} } },
|
|
5980
|
+
[ContextMenuPosition.COL_HEADER]: { [ContextMenuGroup.OTHERS]: { [SaveCellImagesCommand.id]: {
|
|
5981
|
+
order: 10,
|
|
5982
|
+
menuItemFactory: SaveCellImagesMenuFactory
|
|
5983
|
+
} } },
|
|
5984
|
+
[ContextMenuPosition.ROW_HEADER]: { [ContextMenuGroup.OTHERS]: { [SaveCellImagesCommand.id]: {
|
|
5985
|
+
order: 10,
|
|
5986
|
+
menuItemFactory: SaveCellImagesMenuFactory
|
|
5987
|
+
} } }
|
|
5988
|
+
};
|
|
5989
|
+
|
|
5990
|
+
//#endregion
|
|
5991
|
+
//#region src/menu/mobile-sheet-drawing-menu.controller.ts
|
|
5992
|
+
/**
|
|
5993
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5994
|
+
*
|
|
5995
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5996
|
+
* you may not use this file except in compliance with the License.
|
|
5997
|
+
* You may obtain a copy of the License at
|
|
5998
|
+
*
|
|
5999
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6000
|
+
*
|
|
6001
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
6002
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6003
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6004
|
+
* See the License for the specific language governing permissions and
|
|
6005
|
+
* limitations under the License.
|
|
6006
|
+
*/
|
|
6007
|
+
let MobileSheetDrawingMenuController = class MobileSheetDrawingMenuController extends Disposable {
|
|
6008
|
+
constructor(menuManagerService) {
|
|
6009
|
+
super();
|
|
6010
|
+
menuManagerService.mergeMenu(mobileMenuSchema);
|
|
6011
|
+
}
|
|
6012
|
+
};
|
|
6013
|
+
MobileSheetDrawingMenuController = __decorate([__decorateParam(0, IMenuManagerService)], MobileSheetDrawingMenuController);
|
|
6014
|
+
|
|
5579
6015
|
//#endregion
|
|
5580
6016
|
//#region src/services/sheet-drawing-hit-test.service.ts
|
|
5581
6017
|
let SheetDrawingHitTestService = class SheetDrawingHitTestService extends Disposable {
|
|
@@ -5706,6 +6142,7 @@ let UniverSheetsDrawingMobileUIPlugin = class UniverSheetsDrawingMobileUIPlugin
|
|
|
5706
6142
|
[SheetCanvasFloatDomManagerService],
|
|
5707
6143
|
[SheetDrawingHitTestService],
|
|
5708
6144
|
[SheetDrawingUIController],
|
|
6145
|
+
[MobileSheetDrawingMenuController],
|
|
5709
6146
|
[MobileDrawingPopupMenuController],
|
|
5710
6147
|
[SheetDrawingPrintingController],
|
|
5711
6148
|
[SheetDrawingPermissionController],
|
|
@@ -5735,6 +6172,7 @@ let UniverSheetsDrawingMobileUIPlugin = class UniverSheetsDrawingMobileUIPlugin
|
|
|
5735
6172
|
[SheetDrawingPermissionController],
|
|
5736
6173
|
[SheetDrawingPrintingController],
|
|
5737
6174
|
[SheetDrawingUIController],
|
|
6175
|
+
[MobileSheetDrawingMenuController],
|
|
5738
6176
|
[SheetCellImageController],
|
|
5739
6177
|
[SheetCellImageAutofillController]
|
|
5740
6178
|
]);
|
|
@@ -5748,7 +6186,8 @@ let UniverSheetsDrawingMobileUIPlugin = class UniverSheetsDrawingMobileUIPlugin
|
|
|
5748
6186
|
[SheetDrawingUpdateController],
|
|
5749
6187
|
[SheetDrawingActiveRenderController],
|
|
5750
6188
|
[SheetsDrawingRenderController],
|
|
5751
|
-
[SheetCellImageHoverRenderController]
|
|
6189
|
+
[SheetCellImageHoverRenderController],
|
|
6190
|
+
[WorksheetBackgroundRenderController]
|
|
5752
6191
|
].forEach((module) => {
|
|
5753
6192
|
this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, module));
|
|
5754
6193
|
});
|
|
@@ -6005,6 +6444,31 @@ DrawingPopupMenuController = __decorate([
|
|
|
6005
6444
|
__decorateParam(9, ICommandService)
|
|
6006
6445
|
], DrawingPopupMenuController);
|
|
6007
6446
|
|
|
6447
|
+
//#endregion
|
|
6448
|
+
//#region src/menu/sheet-drawing-menu.controller.ts
|
|
6449
|
+
/**
|
|
6450
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
6451
|
+
*
|
|
6452
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6453
|
+
* you may not use this file except in compliance with the License.
|
|
6454
|
+
* You may obtain a copy of the License at
|
|
6455
|
+
*
|
|
6456
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6457
|
+
*
|
|
6458
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
6459
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6460
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6461
|
+
* See the License for the specific language governing permissions and
|
|
6462
|
+
* limitations under the License.
|
|
6463
|
+
*/
|
|
6464
|
+
let SheetDrawingMenuController = class SheetDrawingMenuController extends Disposable {
|
|
6465
|
+
constructor(menuManagerService) {
|
|
6466
|
+
super();
|
|
6467
|
+
menuManagerService.mergeMenu(menuSchema);
|
|
6468
|
+
}
|
|
6469
|
+
};
|
|
6470
|
+
SheetDrawingMenuController = __decorate([__decorateParam(0, IMenuManagerService)], SheetDrawingMenuController);
|
|
6471
|
+
|
|
6008
6472
|
//#endregion
|
|
6009
6473
|
//#region src/plugin.ts
|
|
6010
6474
|
let UniverSheetsDrawingUIPlugin = class UniverSheetsDrawingUIPlugin extends Plugin {
|
|
@@ -6024,6 +6488,7 @@ let UniverSheetsDrawingUIPlugin = class UniverSheetsDrawingUIPlugin extends Plug
|
|
|
6024
6488
|
[SheetCanvasFloatDomManagerService],
|
|
6025
6489
|
[SheetDrawingHitTestService],
|
|
6026
6490
|
[SheetDrawingUIController],
|
|
6491
|
+
[SheetDrawingMenuController],
|
|
6027
6492
|
[DrawingPopupMenuController],
|
|
6028
6493
|
[SheetDrawingPrintingController],
|
|
6029
6494
|
[SheetDrawingPermissionController],
|
|
@@ -6052,6 +6517,7 @@ let UniverSheetsDrawingUIPlugin = class UniverSheetsDrawingUIPlugin extends Plug
|
|
|
6052
6517
|
[SheetDrawingPermissionController],
|
|
6053
6518
|
[SheetDrawingPrintingController],
|
|
6054
6519
|
[SheetDrawingUIController],
|
|
6520
|
+
[SheetDrawingMenuController],
|
|
6055
6521
|
[SheetCellImageController],
|
|
6056
6522
|
[SheetCellImageAutofillController]
|
|
6057
6523
|
]);
|
|
@@ -6065,7 +6531,8 @@ let UniverSheetsDrawingUIPlugin = class UniverSheetsDrawingUIPlugin extends Plug
|
|
|
6065
6531
|
[SheetDrawingUpdateController],
|
|
6066
6532
|
[SheetDrawingActiveRenderController],
|
|
6067
6533
|
[SheetsDrawingRenderController],
|
|
6068
|
-
[SheetCellImageHoverRenderController]
|
|
6534
|
+
[SheetCellImageHoverRenderController],
|
|
6535
|
+
[WorksheetBackgroundRenderController]
|
|
6069
6536
|
].forEach((m) => {
|
|
6070
6537
|
this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, m));
|
|
6071
6538
|
});
|
|
@@ -6083,4 +6550,4 @@ UniverSheetsDrawingUIPlugin = __decorate([
|
|
|
6083
6550
|
], UniverSheetsDrawingUIPlugin);
|
|
6084
6551
|
|
|
6085
6552
|
//#endregion
|
|
6086
|
-
export { BatchSaveImagesService, DeleteDrawingsCommand, DrawingContextMenuService, EditSheetDrawingOperation, FileNamePart, GroupSheetDrawingCommand, IBatchSaveImagesService, IDrawingContextMenuService, InsertFloatImageCommand, MoveDrawingsCommand, SHEETS_DRAWING_FLOATING_HOST_DEPENDENCIES, SHEETS_IMAGE_MENU_ID, SHEET_CHART_RENDER_OBJECT_CONFIG, SHEET_FLOAT_DOM_PREFIX, SaveCellImagesCommand, SheetCanvasFloatDomManagerService, SheetDrawingAnchor, SheetDrawingHitTestService, SheetDrawingUpdateController, SheetsDrawingGroupCopyPasteController, menuSchema as SheetsDrawingUIMenuSchema, SidebarSheetDrawingOperation, UngroupSheetDrawingCommand, UniverSheetsDrawingMobileUIPlugin, UniverSheetsDrawingUIPlugin, calcSheetFloatDomPosition, registerSheetsDrawingFloatingHostCapability };
|
|
6553
|
+
export { AddWorksheetBackgroundImageCommand, BatchSaveImagesService, DeleteDrawingsCommand, DeleteWorksheetBackgroundImageCommand, DrawingContextMenuService, EditSheetDrawingOperation, FileNamePart, GroupSheetDrawingCommand, IBatchSaveImagesService, IDrawingContextMenuService, InsertFloatImageCommand, MoveDrawingsCommand, SHEETS_DRAWING_FLOATING_HOST_DEPENDENCIES, SHEETS_IMAGE_MENU_ID, SHEET_CHART_RENDER_OBJECT_CONFIG, SHEET_FLOAT_DOM_PREFIX, SaveCellImagesCommand, SheetCanvasFloatDomManagerService, SheetDrawingAnchor, SheetDrawingHitTestService, SheetDrawingUpdateController, SheetsDrawingGroupCopyPasteController, menuSchema as SheetsDrawingUIMenuSchema, SidebarSheetDrawingOperation, UngroupSheetDrawingCommand, UniverSheetsDrawingMobileUIPlugin, UniverSheetsDrawingUIPlugin, calcSheetFloatDomPosition, registerSheetsDrawingFloatingHostCapability };
|