@univerjs/sheets-drawing-ui 0.4.0-alpha.0 → 0.4.0-alpha.2

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 CHANGED
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import { CommandType, ICommandService, IUndoRedoService, LocaleService, IUniverInstanceService, useDependency, Inject, Injector, IContextService, RxDisposable, UniverInstanceType, connectInjector, toDisposable, FOCUSING_COMMON_DRAWINGS, Disposable, Direction, FOCUSING_FX_BAR_EDITOR, EDITOR_ACTIVATED, Tools, UserManagerService, IPermissionService, Rectangle, DrawingTypeEnum as DrawingTypeEnum$1, DisposableCollection, generateRandomId, DependentOn, Plugin, registerDependencies, touchDependencies, IConfigService } from "@univerjs/core";
5
+ import { CommandType, ICommandService, IUndoRedoService, LocaleService, IUniverInstanceService, useDependency, Inject, Injector, IContextService, RxDisposable, UniverInstanceType, connectInjector, toDisposable, FOCUSING_COMMON_DRAWINGS, Disposable, Direction, FOCUSING_FX_BAR_EDITOR, EDITOR_ACTIVATED, Tools, UserManagerService, IPermissionService, Rectangle, DisposableCollection, generateRandomId, DependentOn, Plugin, registerDependencies, touchDependencies, IConfigService } from "@univerjs/core";
6
6
  import { IDrawingManagerService, IImageIoService, DrawingTypeEnum, ArrangeTypeEnum, DRAWING_IMAGE_ALLOW_IMAGE_LIST, DRAWING_IMAGE_COUNT_LIMIT, ImageUploadStatusType, DRAWING_IMAGE_ALLOW_SIZE, getImageSize, DRAWING_IMAGE_WIDTH_LIMIT, DRAWING_IMAGE_HEIGHT_LIMIT, getDrawingShapeKeyByDrawingSearch, UniverDrawingPlugin } from "@univerjs/drawing";
7
7
  import { ImageCropperObject, COMPONENT_IMAGE_POPUP_MENU, OpenImageCropOperation, ImageResetSizeOperation, DrawingCommonPanel, DrawingRenderService, UniverDrawingUIPlugin } from "@univerjs/drawing-ui";
8
8
  import { IRenderManagerService, precisionTo, getGroupState, transformObjectOutOfGroup, RENDER_CLASS_TYPE, Rect, DRAWING_OBJECT_LAYER_INDEX, SHEET_VIEWPORT_KEY } from "@univerjs/engine-render";
@@ -13,7 +13,6 @@ import { takeUntil, combineLatest, map, filter, distinctUntilChanged, Subject, B
13
13
  import { getSheetCommandTarget, SheetsSelectionsService, WorkbookEditablePermission, WorksheetEditPermission, RangeProtectionPermissionEditPoint, WorkbookViewPermission, WorksheetViewPermission, InsertRowCommand, InsertColCommand, RemoveRowCommand, RemoveColCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, DeltaRowHeightCommand, SetRowHeightCommand, DeltaColumnWidthCommand, SetColWidthCommand, SetRowHiddenCommand, SetSpecificRowsVisibleCommand, SetSpecificColsVisibleCommand, SetColHiddenCommand, MoveColsCommand, MoveRowsCommand, MoveRangeCommand, SetRowVisibleMutation, SetRowHiddenMutation, SetColVisibleMutation, SetColHiddenMutation, SetWorksheetRowHeightMutation, SetWorksheetColWidthMutation, SheetInterceptorService, SetWorksheetActiveOperation, SetFrozenMutation } from "@univerjs/sheets";
14
14
  import React, { useEffect, forwardRef, useRef, createElement, useState } from "react";
15
15
  import { MessageType, RadioGroup, Radio } from "@univerjs/design";
16
- import clsx from "clsx";
17
16
  const PLUGIN_CONFIG_KEY = "sheets-drawing-ui.config", defaultPluginConfig = {}, ClearSheetDrawingTransformerOperation = {
18
17
  id: "sheet.operation.clear-drawing-transformer",
19
18
  type: CommandType.MUTATION,
@@ -805,7 +804,23 @@ const imageCommonPanel = "univer-image-common-panel", imageCommonPanelGrid = "un
805
804
  imageCommonPanelInput,
806
805
  sheetImageMenu,
807
806
  sheetImageMenuInput
808
- }, SheetDrawingAnchor = /* @__PURE__ */ __name((props) => {
807
+ };
808
+ function r(e) {
809
+ var t, f, n = "";
810
+ if (typeof e == "string" || typeof e == "number") n += e;
811
+ else if (typeof e == "object") if (Array.isArray(e)) {
812
+ var o = e.length;
813
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
814
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
815
+ return n;
816
+ }
817
+ __name(r, "r");
818
+ function clsx() {
819
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
820
+ return n;
821
+ }
822
+ __name(clsx, "clsx");
823
+ const SheetDrawingAnchor = /* @__PURE__ */ __name((props) => {
809
824
  var _a11;
810
825
  const commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), drawingManagerService = useDependency(IDrawingManagerService), renderManagerService = useDependency(IRenderManagerService), { drawings } = props, drawingParam = drawings[0];
811
826
  if (drawingParam == null)
@@ -2213,7 +2228,7 @@ let SheetCanvasFloatDomManagerService = (_a9 = class extends Disposable {
2213
2228
  if (!skeleton)
2214
2229
  return;
2215
2230
  const { transform, drawingType, data } = floatDomParam;
2216
- if (drawingType !== DrawingTypeEnum$1.DRAWING_DOM)
2231
+ if (drawingType !== DrawingTypeEnum.DRAWING_DOM && drawingType !== DrawingTypeEnum.DRAWING_CHART)
2217
2232
  return;
2218
2233
  const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
2219
2234
  if (renderObject == null)
@@ -2232,7 +2247,9 @@ let SheetCanvasFloatDomManagerService = (_a9 = class extends Disposable {
2232
2247
  width,
2233
2248
  height,
2234
2249
  zIndex: this._drawingManagerService.getDrawingOrder(unitId, subUnitId).length - 1
2235
- }, rect = new Rect(rectShapeKey, imageConfig);
2250
+ };
2251
+ drawingType === DrawingTypeEnum.DRAWING_CHART && (imageConfig.fill = "white", imageConfig.rotateEnabled = !1);
2252
+ const rect = new Rect(rectShapeKey, imageConfig);
2236
2253
  scene.addObject(rect, DRAWING_OBJECT_LAYER_INDEX), floatDomParam.allowTransform !== !1 && scene.attachTransformerTo(rect);
2237
2254
  const map2 = this._ensureMap(unitId, subUnitId), disposableCollection = new DisposableCollection(), initPosition = calcPosition(rect, renderObject.renderObject, skeleton.skeleton, target.worksheet), position$ = new BehaviorSubject(initPosition), info = {
2238
2255
  dispose: disposableCollection,
@@ -2336,7 +2353,7 @@ let SheetCanvasFloatDomManagerService = (_a9 = class extends Disposable {
2336
2353
  this._drawingManagerService.update$.subscribe((params) => {
2337
2354
  params.forEach((data) => {
2338
2355
  const sheetDrawing = this._drawingManagerService.getDrawingByParam(data);
2339
- if (!sheetDrawing || sheetDrawing.drawingType !== DrawingTypeEnum$1.DRAWING_DOM)
2356
+ if (!sheetDrawing || sheetDrawing.drawingType !== DrawingTypeEnum.DRAWING_DOM && sheetDrawing.drawingType !== DrawingTypeEnum.DRAWING_CHART)
2340
2357
  return;
2341
2358
  const newValue = {
2342
2359
  ...sheetDrawing.transform
@@ -2370,7 +2387,7 @@ let SheetCanvasFloatDomManagerService = (_a9 = class extends Disposable {
2370
2387
  unitId,
2371
2388
  subUnitId,
2372
2389
  drawingId: id,
2373
- drawingType: DrawingTypeEnum$1.DRAWING_DOM,
2390
+ drawingType: layer.type || DrawingTypeEnum.DRAWING_DOM,
2374
2391
  componentKey,
2375
2392
  sheetTransform,
2376
2393
  transform: {
@@ -1,6 +1,6 @@
1
1
  import { IDisposable, IPosition, ITransformState, Serializable, Worksheet, Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
2
2
  import { IBoundRectNoAngle, Scene, SpreadsheetSkeleton, IRenderManagerService } from '@univerjs/engine-render';
3
- import { IDrawingManagerService } from '@univerjs/drawing';
3
+ import { DrawingTypeEnum, IDrawingManagerService } from '@univerjs/drawing';
4
4
  import { ISheetDrawingService } from '@univerjs/sheets-drawing';
5
5
  import { CanvasFloatDomService } from '@univerjs/ui';
6
6
  export interface ICanvasFloatDom {
@@ -29,6 +29,10 @@ export interface ICanvasFloatDom {
29
29
  * data of component, will save to snapshot, json-like data
30
30
  */
31
31
  data?: Serializable;
32
+ /**
33
+ * the float-dom type
34
+ */
35
+ type?: DrawingTypeEnum;
32
36
  }
33
37
  export declare function transformBound2DOMBound(originBound: IBoundRectNoAngle, scene: Scene, skeleton: SpreadsheetSkeleton, worksheet: Worksheet): {
34
38
  absolute: {