@univerjs/drawing-ui 1.0.4 → 1.1.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 +53 -40
- package/lib/es/index.js +51 -38
- package/lib/index.css +0 -23
- package/lib/index.js +51 -38
- package/lib/umd/index.js +3 -3
- package/package.json +10 -10
package/lib/cjs/index.js
CHANGED
|
@@ -651,7 +651,7 @@ const menuSchema = { [_univerjs_ui.ContextMenuPosition.DRAWING]: { [_univerjs_ui
|
|
|
651
651
|
//#endregion
|
|
652
652
|
//#region package.json
|
|
653
653
|
var name = "@univerjs/drawing-ui";
|
|
654
|
-
var version = "1.0
|
|
654
|
+
var version = "1.1.0";
|
|
655
655
|
|
|
656
656
|
//#endregion
|
|
657
657
|
//#region src/config/config.ts
|
|
@@ -660,7 +660,7 @@ const configSymbol = Symbol(DRAWING_UI_PLUGIN_CONFIG_KEY);
|
|
|
660
660
|
const defaultPluginConfig = {};
|
|
661
661
|
|
|
662
662
|
//#endregion
|
|
663
|
-
//#region \0@oxc-project+runtime@0.
|
|
663
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
|
|
664
664
|
function _typeof(o) {
|
|
665
665
|
"@babel/helpers - typeof";
|
|
666
666
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -671,7 +671,7 @@ function _typeof(o) {
|
|
|
671
671
|
}
|
|
672
672
|
|
|
673
673
|
//#endregion
|
|
674
|
-
//#region \0@oxc-project+runtime@0.
|
|
674
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
|
|
675
675
|
function toPrimitive(t, r) {
|
|
676
676
|
if ("object" != _typeof(t) || !t) return t;
|
|
677
677
|
var e = t[Symbol.toPrimitive];
|
|
@@ -684,14 +684,14 @@ function toPrimitive(t, r) {
|
|
|
684
684
|
}
|
|
685
685
|
|
|
686
686
|
//#endregion
|
|
687
|
-
//#region \0@oxc-project+runtime@0.
|
|
687
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
|
|
688
688
|
function toPropertyKey(t) {
|
|
689
689
|
var i = toPrimitive(t, "string");
|
|
690
690
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
691
691
|
}
|
|
692
692
|
|
|
693
693
|
//#endregion
|
|
694
|
-
//#region \0@oxc-project+runtime@0.
|
|
694
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
695
695
|
function _defineProperty(e, r, t) {
|
|
696
696
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
697
697
|
value: t,
|
|
@@ -744,7 +744,7 @@ var DrawingImageClipService = class extends _univerjs_core.Disposable {
|
|
|
744
744
|
};
|
|
745
745
|
|
|
746
746
|
//#endregion
|
|
747
|
-
//#region \0@oxc-project+runtime@0.
|
|
747
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
|
|
748
748
|
function __decorateParam(paramIndex, decorator) {
|
|
749
749
|
return function(target, key) {
|
|
750
750
|
decorator(target, key, paramIndex);
|
|
@@ -752,7 +752,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
752
752
|
}
|
|
753
753
|
|
|
754
754
|
//#endregion
|
|
755
|
-
//#region \0@oxc-project+runtime@0.
|
|
755
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
756
756
|
function __decorate(decorators, target, key, desc) {
|
|
757
757
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
758
758
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1340,6 +1340,14 @@ let DrawingUpdateController = class DrawingUpdateController extends _univerjs_co
|
|
|
1340
1340
|
if (disposeDrawingRenderObject(scene, param)) {
|
|
1341
1341
|
var _scene$getTransformer2;
|
|
1342
1342
|
(_scene$getTransformer2 = scene.getTransformer()) === null || _scene$getTransformer2 === void 0 || _scene$getTransformer2.clearSelectedObjects();
|
|
1343
|
+
} else {
|
|
1344
|
+
const transformer = scene.getTransformer();
|
|
1345
|
+
const key = (0, _univerjs_drawing.getDrawingShapeKeyByDrawingSearch)(param);
|
|
1346
|
+
const selectedKeys = [...(transformer === null || transformer === void 0 ? void 0 : transformer.getSelectedObjectMap().keys()) ?? []].filter((selectedKey) => selectedKey === key || selectedKey.startsWith(`${key}#-#`));
|
|
1347
|
+
if (selectedKeys.length > 0) {
|
|
1348
|
+
if (selectedKeys.length === (transformer === null || transformer === void 0 ? void 0 : transformer.getSelectedObjectMap().size)) transformer.clearSelectedObjects();
|
|
1349
|
+
else transformer === null || transformer === void 0 || transformer.clearControlByIds(selectedKeys);
|
|
1350
|
+
}
|
|
1343
1351
|
}
|
|
1344
1352
|
});
|
|
1345
1353
|
}));
|
|
@@ -1386,7 +1394,6 @@ let DrawingUpdateController = class DrawingUpdateController extends _univerjs_co
|
|
|
1386
1394
|
_drawingRefreshListener() {
|
|
1387
1395
|
this.disposeWithMe(this._drawingManagerService.refreshTransform$.subscribe((params) => {
|
|
1388
1396
|
params.forEach((param) => {
|
|
1389
|
-
var _setClipBounds2;
|
|
1390
1397
|
const { unitId, subUnitId, drawingId } = param;
|
|
1391
1398
|
const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
|
|
1392
1399
|
if (renderObject == null) return;
|
|
@@ -1395,38 +1402,44 @@ let DrawingUpdateController = class DrawingUpdateController extends _univerjs_co
|
|
|
1395
1402
|
const { transform } = drawingParam;
|
|
1396
1403
|
const { scene } = renderObject;
|
|
1397
1404
|
if (transform == null) return true;
|
|
1398
|
-
const drawingShapeKey = (0, _univerjs_drawing.getDrawingShapeKeyByDrawingSearch)({
|
|
1399
|
-
unitId,
|
|
1400
|
-
subUnitId,
|
|
1401
|
-
drawingId
|
|
1402
|
-
});
|
|
1403
|
-
const drawingShape = scene.getObjectIncludeInGroup(drawingShapeKey);
|
|
1404
1405
|
const drawingParamWithRefreshMetadata = mergeRefreshMetadata(drawingParam, param);
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1406
|
+
const isMultiTransform = drawingParam.isMultiTransform === _univerjs_core.BooleanNumber.TRUE;
|
|
1407
|
+
const transforms = isMultiTransform ? drawingParam.transforms ?? [] : [transform];
|
|
1408
|
+
let hasMissingShape = false;
|
|
1409
|
+
transforms.forEach((instanceTransform, index) => {
|
|
1410
|
+
var _setClipBounds2;
|
|
1411
|
+
const drawingShapeKey = (0, _univerjs_drawing.getDrawingShapeKeyByDrawingSearch)({
|
|
1408
1412
|
unitId,
|
|
1409
1413
|
subUnitId,
|
|
1410
1414
|
drawingId
|
|
1411
|
-
}
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
top,
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1415
|
+
}, isMultiTransform ? index : void 0);
|
|
1416
|
+
const drawingShape = scene.getObjectIncludeInGroup(drawingShapeKey);
|
|
1417
|
+
if (drawingShape == null) {
|
|
1418
|
+
hasMissingShape = true;
|
|
1419
|
+
return;
|
|
1420
|
+
}
|
|
1421
|
+
const { left = 0, top = 0, width = 0, height = 0, angle = 0, flipX = false, flipY = false, skewX = 0, skewY = 0 } = instanceTransform;
|
|
1422
|
+
drawingShape.transformByState({
|
|
1423
|
+
left,
|
|
1424
|
+
top,
|
|
1425
|
+
width,
|
|
1426
|
+
height,
|
|
1427
|
+
angle,
|
|
1428
|
+
flipX,
|
|
1429
|
+
flipY,
|
|
1430
|
+
skewX,
|
|
1431
|
+
skewY
|
|
1432
|
+
});
|
|
1433
|
+
(_setClipBounds2 = drawingShape.setClipBounds) === null || _setClipBounds2 === void 0 || _setClipBounds2.call(drawingShape, instanceTransform.clipBounds);
|
|
1434
|
+
syncDrawingHiddenState(drawingShape, drawingParamWithRefreshMetadata);
|
|
1435
|
+
syncDrawingSelectableState(drawingShape, drawingParamWithRefreshMetadata, scene, this._drawingManagerService);
|
|
1436
|
+
ensureDrawingRenderLayer(scene, drawingShape, drawingParamWithRefreshMetadata);
|
|
1425
1437
|
});
|
|
1426
|
-
(
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1438
|
+
if (hasMissingShape && drawingParamWithRefreshMetadata.hidden !== true) this._drawingManagerService.addNotification([{
|
|
1439
|
+
unitId,
|
|
1440
|
+
subUnitId,
|
|
1441
|
+
drawingId
|
|
1442
|
+
}]);
|
|
1430
1443
|
});
|
|
1431
1444
|
}));
|
|
1432
1445
|
}
|
|
@@ -5268,8 +5281,8 @@ function ObjectDetailsEditor(props) {
|
|
|
5268
5281
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5269
5282
|
className: "univer-text-xs univer-text-gray-500 dark:!univer-text-gray-400",
|
|
5270
5283
|
children: labels.description
|
|
5271
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
5272
|
-
className: (0, _univerjs_design.clsx)(
|
|
5284
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Textarea, {
|
|
5285
|
+
className: (0, _univerjs_design.clsx)("univer-min-h-16 univer-resize-none univer-text-sm", descriptionClassName),
|
|
5273
5286
|
value: draftDescription,
|
|
5274
5287
|
disabled,
|
|
5275
5288
|
placeholder: labels.descriptionPlaceholder,
|
|
@@ -5630,7 +5643,7 @@ exports.CloseImageCropOperation = CloseImageCropOperation;
|
|
|
5630
5643
|
exports.DRAWING_GROUP_TYPES = DRAWING_GROUP_TYPES;
|
|
5631
5644
|
exports.DrawingCommonPanel = DrawingCommonPanel;
|
|
5632
5645
|
exports.DrawingImageClipService = DrawingImageClipService;
|
|
5633
|
-
Object.defineProperty(exports,
|
|
5646
|
+
Object.defineProperty(exports, "DrawingRenderService", {
|
|
5634
5647
|
enumerable: true,
|
|
5635
5648
|
get: function () {
|
|
5636
5649
|
return DrawingRenderService;
|
|
@@ -5648,13 +5661,13 @@ exports.OpenImageCropOperation = OpenImageCropOperation;
|
|
|
5648
5661
|
exports.SetDrawingAlignOperation = SetDrawingAlignOperation;
|
|
5649
5662
|
exports.SetDrawingArrangeOperation = SetDrawingArrangeOperation;
|
|
5650
5663
|
exports.SetDrawingGroupOperation = SetDrawingGroupOperation;
|
|
5651
|
-
Object.defineProperty(exports,
|
|
5664
|
+
Object.defineProperty(exports, "UniverDrawingMobileUIPlugin", {
|
|
5652
5665
|
enumerable: true,
|
|
5653
5666
|
get: function () {
|
|
5654
5667
|
return UniverDrawingMobileUIPlugin;
|
|
5655
5668
|
}
|
|
5656
5669
|
});
|
|
5657
|
-
Object.defineProperty(exports,
|
|
5670
|
+
Object.defineProperty(exports, "UniverDrawingUIPlugin", {
|
|
5658
5671
|
enumerable: true,
|
|
5659
5672
|
get: function () {
|
|
5660
5673
|
return UniverDrawingUIPlugin;
|
package/lib/es/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { CURSOR_TYPE, Canvas, DRAWING_OBJECT_LAYER_INDEX, DrawingGroupObject, Gr
|
|
|
4
4
|
import { BuiltInUIPart, ComponentManager, ContextMenuGroup, ContextMenuPosition, IDialogService, IGalleryService, ILayoutService, IMenuManagerService, IMessageService, IShortcutService, IUIPartsService, IconManager, KeyCode, MenuItemType, MobileMenu, connectInjector, useDependency, useObservable } from "@univerjs/ui";
|
|
5
5
|
import { BehaviorSubject, Observable, bufferTime, combineLatest, filter, map, merge as merge$1, of, startWith, switchMap } from "rxjs";
|
|
6
6
|
import { ArrowDownIcon, ArrowUpIcon, AutofillDoubleIcon, BottomIcon, ChartIcon, CheckMarkIcon, CloseIcon, CreateCopyIcon, CropIcon, DeleteIcon, DocSettingIcon, ExpandIcon, EyeIcon, EyelashIcon, GroupIcon, LocateFixedIcon, LockIcon, MoreDownIcon, MoveDownIcon, MoveUpIcon, TextWrapShapeIcon, TopmostIcon, UngroupIcon, UnlockIcon } from "@univerjs/icons";
|
|
7
|
-
import { Button, Checkbox, Dropdown, DropdownMenu, Input, InputNumber, MessageType, MobileActionRow, MobileSelect, Select, Separator, StateIconButton, Tooltip, borderClassName, clsx, render, unmount } from "@univerjs/design";
|
|
7
|
+
import { Button, Checkbox, Dropdown, DropdownMenu, Input, InputNumber, MessageType, MobileActionRow, MobileSelect, Select, Separator, StateIconButton, Textarea, Tooltip, borderClassName, clsx, render, unmount } from "@univerjs/design";
|
|
8
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { createElement, useEffect, useMemo, useRef, useState } from "react";
|
|
10
10
|
|
|
@@ -650,7 +650,7 @@ const menuSchema = { [ContextMenuPosition.DRAWING]: { [ContextMenuGroup.OTHERS]:
|
|
|
650
650
|
//#endregion
|
|
651
651
|
//#region package.json
|
|
652
652
|
var name = "@univerjs/drawing-ui";
|
|
653
|
-
var version = "1.0
|
|
653
|
+
var version = "1.1.0";
|
|
654
654
|
|
|
655
655
|
//#endregion
|
|
656
656
|
//#region src/config/config.ts
|
|
@@ -659,7 +659,7 @@ const configSymbol = Symbol(DRAWING_UI_PLUGIN_CONFIG_KEY);
|
|
|
659
659
|
const defaultPluginConfig = {};
|
|
660
660
|
|
|
661
661
|
//#endregion
|
|
662
|
-
//#region \0@oxc-project+runtime@0.
|
|
662
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
|
|
663
663
|
function _typeof(o) {
|
|
664
664
|
"@babel/helpers - typeof";
|
|
665
665
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -670,7 +670,7 @@ function _typeof(o) {
|
|
|
670
670
|
}
|
|
671
671
|
|
|
672
672
|
//#endregion
|
|
673
|
-
//#region \0@oxc-project+runtime@0.
|
|
673
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
|
|
674
674
|
function toPrimitive(t, r) {
|
|
675
675
|
if ("object" != _typeof(t) || !t) return t;
|
|
676
676
|
var e = t[Symbol.toPrimitive];
|
|
@@ -683,14 +683,14 @@ function toPrimitive(t, r) {
|
|
|
683
683
|
}
|
|
684
684
|
|
|
685
685
|
//#endregion
|
|
686
|
-
//#region \0@oxc-project+runtime@0.
|
|
686
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
|
|
687
687
|
function toPropertyKey(t) {
|
|
688
688
|
var i = toPrimitive(t, "string");
|
|
689
689
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
690
690
|
}
|
|
691
691
|
|
|
692
692
|
//#endregion
|
|
693
|
-
//#region \0@oxc-project+runtime@0.
|
|
693
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
694
694
|
function _defineProperty(e, r, t) {
|
|
695
695
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
696
696
|
value: t,
|
|
@@ -743,7 +743,7 @@ var DrawingImageClipService = class extends Disposable {
|
|
|
743
743
|
};
|
|
744
744
|
|
|
745
745
|
//#endregion
|
|
746
|
-
//#region \0@oxc-project+runtime@0.
|
|
746
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
|
|
747
747
|
function __decorateParam(paramIndex, decorator) {
|
|
748
748
|
return function(target, key) {
|
|
749
749
|
decorator(target, key, paramIndex);
|
|
@@ -751,7 +751,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
751
751
|
}
|
|
752
752
|
|
|
753
753
|
//#endregion
|
|
754
|
-
//#region \0@oxc-project+runtime@0.
|
|
754
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
755
755
|
function __decorate(decorators, target, key, desc) {
|
|
756
756
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
757
757
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1339,6 +1339,14 @@ let DrawingUpdateController = class DrawingUpdateController extends Disposable {
|
|
|
1339
1339
|
if (disposeDrawingRenderObject(scene, param)) {
|
|
1340
1340
|
var _scene$getTransformer2;
|
|
1341
1341
|
(_scene$getTransformer2 = scene.getTransformer()) === null || _scene$getTransformer2 === void 0 || _scene$getTransformer2.clearSelectedObjects();
|
|
1342
|
+
} else {
|
|
1343
|
+
const transformer = scene.getTransformer();
|
|
1344
|
+
const key = getDrawingShapeKeyByDrawingSearch(param);
|
|
1345
|
+
const selectedKeys = [...(transformer === null || transformer === void 0 ? void 0 : transformer.getSelectedObjectMap().keys()) ?? []].filter((selectedKey) => selectedKey === key || selectedKey.startsWith(`${key}#-#`));
|
|
1346
|
+
if (selectedKeys.length > 0) {
|
|
1347
|
+
if (selectedKeys.length === (transformer === null || transformer === void 0 ? void 0 : transformer.getSelectedObjectMap().size)) transformer.clearSelectedObjects();
|
|
1348
|
+
else transformer === null || transformer === void 0 || transformer.clearControlByIds(selectedKeys);
|
|
1349
|
+
}
|
|
1342
1350
|
}
|
|
1343
1351
|
});
|
|
1344
1352
|
}));
|
|
@@ -1385,7 +1393,6 @@ let DrawingUpdateController = class DrawingUpdateController extends Disposable {
|
|
|
1385
1393
|
_drawingRefreshListener() {
|
|
1386
1394
|
this.disposeWithMe(this._drawingManagerService.refreshTransform$.subscribe((params) => {
|
|
1387
1395
|
params.forEach((param) => {
|
|
1388
|
-
var _setClipBounds2;
|
|
1389
1396
|
const { unitId, subUnitId, drawingId } = param;
|
|
1390
1397
|
const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
|
|
1391
1398
|
if (renderObject == null) return;
|
|
@@ -1394,38 +1401,44 @@ let DrawingUpdateController = class DrawingUpdateController extends Disposable {
|
|
|
1394
1401
|
const { transform } = drawingParam;
|
|
1395
1402
|
const { scene } = renderObject;
|
|
1396
1403
|
if (transform == null) return true;
|
|
1397
|
-
const drawingShapeKey = getDrawingShapeKeyByDrawingSearch({
|
|
1398
|
-
unitId,
|
|
1399
|
-
subUnitId,
|
|
1400
|
-
drawingId
|
|
1401
|
-
});
|
|
1402
|
-
const drawingShape = scene.getObjectIncludeInGroup(drawingShapeKey);
|
|
1403
1404
|
const drawingParamWithRefreshMetadata = mergeRefreshMetadata(drawingParam, param);
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1405
|
+
const isMultiTransform = drawingParam.isMultiTransform === BooleanNumber.TRUE;
|
|
1406
|
+
const transforms = isMultiTransform ? drawingParam.transforms ?? [] : [transform];
|
|
1407
|
+
let hasMissingShape = false;
|
|
1408
|
+
transforms.forEach((instanceTransform, index) => {
|
|
1409
|
+
var _setClipBounds2;
|
|
1410
|
+
const drawingShapeKey = getDrawingShapeKeyByDrawingSearch({
|
|
1407
1411
|
unitId,
|
|
1408
1412
|
subUnitId,
|
|
1409
1413
|
drawingId
|
|
1410
|
-
}
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
top,
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1414
|
+
}, isMultiTransform ? index : void 0);
|
|
1415
|
+
const drawingShape = scene.getObjectIncludeInGroup(drawingShapeKey);
|
|
1416
|
+
if (drawingShape == null) {
|
|
1417
|
+
hasMissingShape = true;
|
|
1418
|
+
return;
|
|
1419
|
+
}
|
|
1420
|
+
const { left = 0, top = 0, width = 0, height = 0, angle = 0, flipX = false, flipY = false, skewX = 0, skewY = 0 } = instanceTransform;
|
|
1421
|
+
drawingShape.transformByState({
|
|
1422
|
+
left,
|
|
1423
|
+
top,
|
|
1424
|
+
width,
|
|
1425
|
+
height,
|
|
1426
|
+
angle,
|
|
1427
|
+
flipX,
|
|
1428
|
+
flipY,
|
|
1429
|
+
skewX,
|
|
1430
|
+
skewY
|
|
1431
|
+
});
|
|
1432
|
+
(_setClipBounds2 = drawingShape.setClipBounds) === null || _setClipBounds2 === void 0 || _setClipBounds2.call(drawingShape, instanceTransform.clipBounds);
|
|
1433
|
+
syncDrawingHiddenState(drawingShape, drawingParamWithRefreshMetadata);
|
|
1434
|
+
syncDrawingSelectableState(drawingShape, drawingParamWithRefreshMetadata, scene, this._drawingManagerService);
|
|
1435
|
+
ensureDrawingRenderLayer(scene, drawingShape, drawingParamWithRefreshMetadata);
|
|
1424
1436
|
});
|
|
1425
|
-
(
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1437
|
+
if (hasMissingShape && drawingParamWithRefreshMetadata.hidden !== true) this._drawingManagerService.addNotification([{
|
|
1438
|
+
unitId,
|
|
1439
|
+
subUnitId,
|
|
1440
|
+
drawingId
|
|
1441
|
+
}]);
|
|
1429
1442
|
});
|
|
1430
1443
|
}));
|
|
1431
1444
|
}
|
|
@@ -5267,8 +5280,8 @@ function ObjectDetailsEditor(props) {
|
|
|
5267
5280
|
children: [/* @__PURE__ */ jsx("span", {
|
|
5268
5281
|
className: "univer-text-xs univer-text-gray-500 dark:!univer-text-gray-400",
|
|
5269
5282
|
children: labels.description
|
|
5270
|
-
}), /* @__PURE__ */ jsx(
|
|
5271
|
-
className: clsx(
|
|
5283
|
+
}), /* @__PURE__ */ jsx(Textarea, {
|
|
5284
|
+
className: clsx("univer-min-h-16 univer-resize-none univer-text-sm", descriptionClassName),
|
|
5272
5285
|
value: draftDescription,
|
|
5273
5286
|
disabled,
|
|
5274
5287
|
placeholder: labels.descriptionPlaceholder,
|
package/lib/index.css
CHANGED
|
@@ -358,10 +358,6 @@
|
|
|
358
358
|
padding: .25rem;
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
-
.univer-p-2 {
|
|
362
|
-
padding: .5rem;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
361
|
.univer-p-3 {
|
|
366
362
|
padding: .75rem;
|
|
367
363
|
}
|
|
@@ -584,10 +580,6 @@
|
|
|
584
580
|
border-color: var(--univer-primary-500) !important;
|
|
585
581
|
}
|
|
586
582
|
|
|
587
|
-
.focus\:univer-border-primary-500:focus {
|
|
588
|
-
border-color: var(--univer-primary-500);
|
|
589
|
-
}
|
|
590
|
-
|
|
591
583
|
.focus\:\!univer-bg-gray-0:focus {
|
|
592
584
|
background-color: var(--univer-gray-0) !important;
|
|
593
585
|
}
|
|
@@ -599,21 +591,10 @@
|
|
|
599
591
|
box-shadow: var(--univer-tw-ring-offset-shadow), var(--univer-tw-ring-shadow), var(--univer-tw-shadow, 0 0 #0000) !important;
|
|
600
592
|
}
|
|
601
593
|
|
|
602
|
-
.focus\:univer-ring-1:focus {
|
|
603
|
-
--univer-tw-ring-offset-shadow: var(--univer-tw-ring-inset) 0 0 0 var(--univer-tw-ring-offset-width) var(--univer-tw-ring-offset-color);
|
|
604
|
-
--univer-tw-ring-shadow: var(--univer-tw-ring-inset) 0 0 0 calc(1px + var(--univer-tw-ring-offset-width)) var(--univer-tw-ring-color);
|
|
605
|
-
box-shadow: var(--univer-tw-ring-offset-shadow), var(--univer-tw-ring-shadow), 0 0 #0000;
|
|
606
|
-
box-shadow: var(--univer-tw-ring-offset-shadow), var(--univer-tw-ring-shadow), var(--univer-tw-shadow, 0 0 #0000);
|
|
607
|
-
}
|
|
608
|
-
|
|
609
594
|
.focus\:\!univer-ring-primary-100:focus {
|
|
610
595
|
--univer-tw-ring-color: var(--univer-primary-100) !important;
|
|
611
596
|
}
|
|
612
597
|
|
|
613
|
-
.focus\:univer-ring-primary-100:focus {
|
|
614
|
-
--univer-tw-ring-color: var(--univer-primary-100);
|
|
615
|
-
}
|
|
616
|
-
|
|
617
598
|
.active\:univer-scale-95:active {
|
|
618
599
|
--univer-tw-scale-x: .95;
|
|
619
600
|
--univer-tw-scale-y: .95;
|
|
@@ -649,10 +630,6 @@
|
|
|
649
630
|
opacity: .4;
|
|
650
631
|
}
|
|
651
632
|
|
|
652
|
-
.disabled\:univer-opacity-70:disabled {
|
|
653
|
-
opacity: .7;
|
|
654
|
-
}
|
|
655
|
-
|
|
656
633
|
@media (hover: hover) and (pointer: fine) {
|
|
657
634
|
.disabled\:hover\:univer-bg-transparent:hover:disabled {
|
|
658
635
|
background-color: #0000;
|
package/lib/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { CURSOR_TYPE, Canvas, DRAWING_OBJECT_LAYER_INDEX, DrawingGroupObject, Gr
|
|
|
4
4
|
import { BuiltInUIPart, ComponentManager, ContextMenuGroup, ContextMenuPosition, IDialogService, IGalleryService, ILayoutService, IMenuManagerService, IMessageService, IShortcutService, IUIPartsService, IconManager, KeyCode, MenuItemType, MobileMenu, connectInjector, useDependency, useObservable } from "@univerjs/ui";
|
|
5
5
|
import { BehaviorSubject, Observable, bufferTime, combineLatest, filter, map, merge as merge$1, of, startWith, switchMap } from "rxjs";
|
|
6
6
|
import { ArrowDownIcon, ArrowUpIcon, AutofillDoubleIcon, BottomIcon, ChartIcon, CheckMarkIcon, CloseIcon, CreateCopyIcon, CropIcon, DeleteIcon, DocSettingIcon, ExpandIcon, EyeIcon, EyelashIcon, GroupIcon, LocateFixedIcon, LockIcon, MoreDownIcon, MoveDownIcon, MoveUpIcon, TextWrapShapeIcon, TopmostIcon, UngroupIcon, UnlockIcon } from "@univerjs/icons";
|
|
7
|
-
import { Button, Checkbox, Dropdown, DropdownMenu, Input, InputNumber, MessageType, MobileActionRow, MobileSelect, Select, Separator, StateIconButton, Tooltip, borderClassName, clsx, render, unmount } from "@univerjs/design";
|
|
7
|
+
import { Button, Checkbox, Dropdown, DropdownMenu, Input, InputNumber, MessageType, MobileActionRow, MobileSelect, Select, Separator, StateIconButton, Textarea, Tooltip, borderClassName, clsx, render, unmount } from "@univerjs/design";
|
|
8
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { createElement, useEffect, useMemo, useRef, useState } from "react";
|
|
10
10
|
|
|
@@ -650,7 +650,7 @@ const menuSchema = { [ContextMenuPosition.DRAWING]: { [ContextMenuGroup.OTHERS]:
|
|
|
650
650
|
//#endregion
|
|
651
651
|
//#region package.json
|
|
652
652
|
var name = "@univerjs/drawing-ui";
|
|
653
|
-
var version = "1.0
|
|
653
|
+
var version = "1.1.0";
|
|
654
654
|
|
|
655
655
|
//#endregion
|
|
656
656
|
//#region src/config/config.ts
|
|
@@ -659,7 +659,7 @@ const configSymbol = Symbol(DRAWING_UI_PLUGIN_CONFIG_KEY);
|
|
|
659
659
|
const defaultPluginConfig = {};
|
|
660
660
|
|
|
661
661
|
//#endregion
|
|
662
|
-
//#region \0@oxc-project+runtime@0.
|
|
662
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
|
|
663
663
|
function _typeof(o) {
|
|
664
664
|
"@babel/helpers - typeof";
|
|
665
665
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -670,7 +670,7 @@ function _typeof(o) {
|
|
|
670
670
|
}
|
|
671
671
|
|
|
672
672
|
//#endregion
|
|
673
|
-
//#region \0@oxc-project+runtime@0.
|
|
673
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
|
|
674
674
|
function toPrimitive(t, r) {
|
|
675
675
|
if ("object" != _typeof(t) || !t) return t;
|
|
676
676
|
var e = t[Symbol.toPrimitive];
|
|
@@ -683,14 +683,14 @@ function toPrimitive(t, r) {
|
|
|
683
683
|
}
|
|
684
684
|
|
|
685
685
|
//#endregion
|
|
686
|
-
//#region \0@oxc-project+runtime@0.
|
|
686
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
|
|
687
687
|
function toPropertyKey(t) {
|
|
688
688
|
var i = toPrimitive(t, "string");
|
|
689
689
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
690
690
|
}
|
|
691
691
|
|
|
692
692
|
//#endregion
|
|
693
|
-
//#region \0@oxc-project+runtime@0.
|
|
693
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
694
694
|
function _defineProperty(e, r, t) {
|
|
695
695
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
696
696
|
value: t,
|
|
@@ -743,7 +743,7 @@ var DrawingImageClipService = class extends Disposable {
|
|
|
743
743
|
};
|
|
744
744
|
|
|
745
745
|
//#endregion
|
|
746
|
-
//#region \0@oxc-project+runtime@0.
|
|
746
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
|
|
747
747
|
function __decorateParam(paramIndex, decorator) {
|
|
748
748
|
return function(target, key) {
|
|
749
749
|
decorator(target, key, paramIndex);
|
|
@@ -751,7 +751,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
751
751
|
}
|
|
752
752
|
|
|
753
753
|
//#endregion
|
|
754
|
-
//#region \0@oxc-project+runtime@0.
|
|
754
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
755
755
|
function __decorate(decorators, target, key, desc) {
|
|
756
756
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
757
757
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1339,6 +1339,14 @@ let DrawingUpdateController = class DrawingUpdateController extends Disposable {
|
|
|
1339
1339
|
if (disposeDrawingRenderObject(scene, param)) {
|
|
1340
1340
|
var _scene$getTransformer2;
|
|
1341
1341
|
(_scene$getTransformer2 = scene.getTransformer()) === null || _scene$getTransformer2 === void 0 || _scene$getTransformer2.clearSelectedObjects();
|
|
1342
|
+
} else {
|
|
1343
|
+
const transformer = scene.getTransformer();
|
|
1344
|
+
const key = getDrawingShapeKeyByDrawingSearch(param);
|
|
1345
|
+
const selectedKeys = [...(transformer === null || transformer === void 0 ? void 0 : transformer.getSelectedObjectMap().keys()) ?? []].filter((selectedKey) => selectedKey === key || selectedKey.startsWith(`${key}#-#`));
|
|
1346
|
+
if (selectedKeys.length > 0) {
|
|
1347
|
+
if (selectedKeys.length === (transformer === null || transformer === void 0 ? void 0 : transformer.getSelectedObjectMap().size)) transformer.clearSelectedObjects();
|
|
1348
|
+
else transformer === null || transformer === void 0 || transformer.clearControlByIds(selectedKeys);
|
|
1349
|
+
}
|
|
1342
1350
|
}
|
|
1343
1351
|
});
|
|
1344
1352
|
}));
|
|
@@ -1385,7 +1393,6 @@ let DrawingUpdateController = class DrawingUpdateController extends Disposable {
|
|
|
1385
1393
|
_drawingRefreshListener() {
|
|
1386
1394
|
this.disposeWithMe(this._drawingManagerService.refreshTransform$.subscribe((params) => {
|
|
1387
1395
|
params.forEach((param) => {
|
|
1388
|
-
var _setClipBounds2;
|
|
1389
1396
|
const { unitId, subUnitId, drawingId } = param;
|
|
1390
1397
|
const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
|
|
1391
1398
|
if (renderObject == null) return;
|
|
@@ -1394,38 +1401,44 @@ let DrawingUpdateController = class DrawingUpdateController extends Disposable {
|
|
|
1394
1401
|
const { transform } = drawingParam;
|
|
1395
1402
|
const { scene } = renderObject;
|
|
1396
1403
|
if (transform == null) return true;
|
|
1397
|
-
const drawingShapeKey = getDrawingShapeKeyByDrawingSearch({
|
|
1398
|
-
unitId,
|
|
1399
|
-
subUnitId,
|
|
1400
|
-
drawingId
|
|
1401
|
-
});
|
|
1402
|
-
const drawingShape = scene.getObjectIncludeInGroup(drawingShapeKey);
|
|
1403
1404
|
const drawingParamWithRefreshMetadata = mergeRefreshMetadata(drawingParam, param);
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1405
|
+
const isMultiTransform = drawingParam.isMultiTransform === BooleanNumber.TRUE;
|
|
1406
|
+
const transforms = isMultiTransform ? drawingParam.transforms ?? [] : [transform];
|
|
1407
|
+
let hasMissingShape = false;
|
|
1408
|
+
transforms.forEach((instanceTransform, index) => {
|
|
1409
|
+
var _setClipBounds2;
|
|
1410
|
+
const drawingShapeKey = getDrawingShapeKeyByDrawingSearch({
|
|
1407
1411
|
unitId,
|
|
1408
1412
|
subUnitId,
|
|
1409
1413
|
drawingId
|
|
1410
|
-
}
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
top,
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1414
|
+
}, isMultiTransform ? index : void 0);
|
|
1415
|
+
const drawingShape = scene.getObjectIncludeInGroup(drawingShapeKey);
|
|
1416
|
+
if (drawingShape == null) {
|
|
1417
|
+
hasMissingShape = true;
|
|
1418
|
+
return;
|
|
1419
|
+
}
|
|
1420
|
+
const { left = 0, top = 0, width = 0, height = 0, angle = 0, flipX = false, flipY = false, skewX = 0, skewY = 0 } = instanceTransform;
|
|
1421
|
+
drawingShape.transformByState({
|
|
1422
|
+
left,
|
|
1423
|
+
top,
|
|
1424
|
+
width,
|
|
1425
|
+
height,
|
|
1426
|
+
angle,
|
|
1427
|
+
flipX,
|
|
1428
|
+
flipY,
|
|
1429
|
+
skewX,
|
|
1430
|
+
skewY
|
|
1431
|
+
});
|
|
1432
|
+
(_setClipBounds2 = drawingShape.setClipBounds) === null || _setClipBounds2 === void 0 || _setClipBounds2.call(drawingShape, instanceTransform.clipBounds);
|
|
1433
|
+
syncDrawingHiddenState(drawingShape, drawingParamWithRefreshMetadata);
|
|
1434
|
+
syncDrawingSelectableState(drawingShape, drawingParamWithRefreshMetadata, scene, this._drawingManagerService);
|
|
1435
|
+
ensureDrawingRenderLayer(scene, drawingShape, drawingParamWithRefreshMetadata);
|
|
1424
1436
|
});
|
|
1425
|
-
(
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1437
|
+
if (hasMissingShape && drawingParamWithRefreshMetadata.hidden !== true) this._drawingManagerService.addNotification([{
|
|
1438
|
+
unitId,
|
|
1439
|
+
subUnitId,
|
|
1440
|
+
drawingId
|
|
1441
|
+
}]);
|
|
1429
1442
|
});
|
|
1430
1443
|
}));
|
|
1431
1444
|
}
|
|
@@ -5267,8 +5280,8 @@ function ObjectDetailsEditor(props) {
|
|
|
5267
5280
|
children: [/* @__PURE__ */ jsx("span", {
|
|
5268
5281
|
className: "univer-text-xs univer-text-gray-500 dark:!univer-text-gray-400",
|
|
5269
5282
|
children: labels.description
|
|
5270
|
-
}), /* @__PURE__ */ jsx(
|
|
5271
|
-
className: clsx(
|
|
5283
|
+
}), /* @__PURE__ */ jsx(Textarea, {
|
|
5284
|
+
className: clsx("univer-min-h-16 univer-resize-none univer-text-sm", descriptionClassName),
|
|
5272
5285
|
value: draftDescription,
|
|
5273
5286
|
disabled,
|
|
5274
5287
|
placeholder: labels.descriptionPlaceholder,
|