aldehyde 0.2.494 → 0.2.495
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/controls/icon-selector/icon/phonenode-menu-icon/iconfont.css +63 -63
- package/lib/draw-canvas-edit/components/asset-bar/index.less +35 -35
- package/lib/draw-canvas-edit/components/main-header/index.less +23 -23
- package/lib/layout2/page.d.ts +2 -1
- package/lib/layout2/page.d.ts.map +1 -1
- package/lib/layout2/page.js +19 -8
- package/lib/layout2/page.js.map +1 -1
- package/lib/layout2/type/layout-type.d.ts +1 -0
- package/lib/layout2/type/layout-type.d.ts.map +1 -1
- package/lib/lowcode-components/base-table/index.less +61 -61
- package/lib/lowcode-components/base-text/index.less +19 -19
- package/lib/lowcode-components/data-number/index.less +10 -10
- package/lib/lowcode-components/date-time/index.less +4 -4
- package/lib/lowcode-components/four-angle-glow-border/index.less +49 -49
- package/lib/lowcode-components/lowcode-view/component/font/FontGlobal.css +26 -26
- package/lib/lowcode-components/lowcode-view/component/screen-fit/index.less +13 -13
- package/lib/lowcode-components/text-scroller/index.less +28 -28
- package/lib/module/ltmpl-table.d.ts +7 -0
- package/lib/module/ltmpl-table.d.ts.map +1 -1
- package/lib/module/ltmpl-table.js +12 -16
- package/lib/module/ltmpl-table.js.map +1 -1
- package/lib/routable/dtmpl-route.d.ts.map +1 -1
- package/lib/routable/dtmpl-route.js +8 -2
- package/lib/routable/dtmpl-route.js.map +1 -1
- package/lib/routable/import-route.d.ts.map +1 -1
- package/lib/routable/import-route.js +9 -1
- package/lib/routable/import-route.js.map +1 -1
- package/lib/routable/ltmpl-route.d.ts.map +1 -1
- package/lib/routable/ltmpl-route.js +13 -6
- package/lib/routable/ltmpl-route.js.map +1 -1
- package/lib/routable/splitview-ltmpl-route.d.ts.map +1 -1
- package/lib/routable/splitview-ltmpl-route.js +11 -10
- package/lib/routable/splitview-ltmpl-route.js.map +1 -1
- package/lib/routable/ttmpl-route.d.ts.map +1 -1
- package/lib/routable/ttmpl-route.js +9 -2
- package/lib/routable/ttmpl-route.js.map +1 -1
- package/lib/table/act-table.d.ts +1 -0
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +31 -9
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/page-chart.js +1 -1
- package/lib/table/page-chart.js.map +1 -1
- package/lib/table/row-table.d.ts +6 -0
- package/lib/table/row-table.d.ts.map +1 -1
- package/lib/table/row-table.js +21 -6
- package/lib/table/row-table.js.map +1 -1
- package/lib/tmpl/interface.d.ts +1 -0
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tree/act-tree.d.ts +1 -0
- package/lib/tree/act-tree.d.ts.map +1 -1
- package/lib/tree/act-tree.js +6 -7
- package/lib/tree/act-tree.js.map +1 -1
- package/lib/tree/tree-utils.d.ts +1 -1
- package/lib/tree/tree-utils.d.ts.map +1 -1
- package/lib/tree/tree-utils.js +4 -4
- package/lib/tree/tree-utils.js.map +1 -1
- package/lib/units/index.d.ts +4 -0
- package/lib/units/index.d.ts.map +1 -1
- package/lib/units/index.js +10 -3
- package/lib/units/index.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/controls/icon-selector/icon/phonenode-menu-icon/iconfont.css +63 -63
- package/src/aldehyde/controls/icon-selector/icon/phonenode-menu-icon/iconfont.json +93 -93
- package/src/aldehyde/draw-canvas-edit/components/asset-bar/index.less +35 -35
- package/src/aldehyde/draw-canvas-edit/components/asset-bar/index.tsx +110 -110
- package/src/aldehyde/draw-canvas-edit/components/main-header/index.less +23 -23
- package/src/aldehyde/draw-canvas-edit/components/main-header/index.tsx +263 -263
- package/src/aldehyde/draw-canvas-edit/components/render/draws/index.ts +7 -7
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/base-graph.ts +241 -241
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/circle.ts +699 -699
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/curve.ts +500 -500
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/index.ts +5 -5
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/line.ts +493 -493
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/rect.ts +680 -680
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/drag-handlers.ts +68 -68
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/graph-handlers.ts +113 -113
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/index.ts +9 -9
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/key-move-handlers.ts +49 -49
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/link-handlers.ts +45 -45
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/shutcut-handlers.ts +45 -45
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/text-handlers.ts +81 -81
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/zoom-handlers.ts +59 -59
- package/src/aldehyde/draw-canvas-edit/components/render/tools/align-tool.ts +89 -89
- package/src/aldehyde/draw-canvas-edit/components/render/tools/asset-tool.ts +154 -154
- package/src/aldehyde/draw-canvas-edit/components/render/tools/link-tool.ts +222 -222
- package/src/aldehyde/draw-canvas-edit/components/render/tools/z-index-tool.ts +224 -224
- package/src/aldehyde/draw-canvas-edit/components/render/utils/a-star.ts +116 -116
- package/src/aldehyde/draw-canvas-edit/components/render/utils/bezier-scene-func.ts +72 -72
- package/src/aldehyde/draw-canvas-edit/components/setting-form/imag-upload.tsx +119 -119
- package/src/aldehyde/layout2/page.tsx +17 -9
- package/src/aldehyde/layout2/type/layout-type.ts +1 -0
- package/src/aldehyde/layout4/imgs/user.svg +26 -26
- package/src/aldehyde/lowcode-components/base-color-block/index.tsx +31 -31
- package/src/aldehyde/lowcode-components/base-table/index.less +61 -61
- package/src/aldehyde/lowcode-components/base-text/index.less +19 -19
- package/src/aldehyde/lowcode-components/data-number/index.less +10 -10
- package/src/aldehyde/lowcode-components/date-time/index.less +4 -4
- package/src/aldehyde/lowcode-components/date-time/index.tsx +64 -64
- package/src/aldehyde/lowcode-components/four-angle-glow-border/index.less +49 -49
- package/src/aldehyde/lowcode-components/four-angle-glow-border/index.tsx +53 -53
- package/src/aldehyde/lowcode-components/lowcode-view/component/abstract-controller.ts +64 -64
- package/src/aldehyde/lowcode-components/lowcode-view/component/abstract-definition.ts +77 -77
- package/src/aldehyde/lowcode-components/lowcode-view/component/abstract-designer-loader.ts +36 -36
- package/src/aldehyde/lowcode-components/lowcode-view/component/component-container.tsx +91 -91
- package/src/aldehyde/lowcode-components/lowcode-view/component/font/FontGlobal.css +26 -26
- package/src/aldehyde/lowcode-components/lowcode-view/component/group-layer/controller.ts +36 -36
- package/src/aldehyde/lowcode-components/lowcode-view/component/group-layer/definition.ts +53 -53
- package/src/aldehyde/lowcode-components/lowcode-view/component/group-layer/index.tsx +15 -15
- package/src/aldehyde/lowcode-components/lowcode-view/component/layer-builder.tsx +98 -98
- package/src/aldehyde/lowcode-components/lowcode-view/component/screen-fit/index.less +13 -13
- package/src/aldehyde/lowcode-components/lowcode-view/component/screen-fit/index.tsx +121 -121
- package/src/aldehyde/lowcode-components/placeholder-component/index.tsx +81 -81
- package/src/aldehyde/lowcode-components/text-scroller/index.less +28 -28
- package/src/aldehyde/lowcode-components/text-scroller/index.tsx +173 -173
- package/src/aldehyde/module/ltmpl-table.tsx +14 -15
- package/src/aldehyde/routable/dtmpl-route.tsx +14 -8
- package/src/aldehyde/routable/import-route.tsx +12 -5
- package/src/aldehyde/routable/ltmpl-route.tsx +14 -9
- package/src/aldehyde/routable/splitview-ltmpl-route.tsx +11 -8
- package/src/aldehyde/routable/ttmpl-route.tsx +13 -8
- package/src/aldehyde/table/act-table.tsx +28 -9
- package/src/aldehyde/table/page-chart.tsx +1 -1
- package/src/aldehyde/table/row-table.tsx +29 -6
- package/src/aldehyde/tmpl/interface.tsx +1 -0
- package/src/aldehyde/tree/act-tree.tsx +8 -6
- package/src/aldehyde/tree/tree-utils.tsx +4 -4
- package/src/aldehyde/units/index.tsx +11 -3
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import Konva from 'konva';
|
|
2
|
-
|
|
3
|
-
function rotatePoint(x1: number, y1: number, x2: number, y2: number, angleInDegrees: number) {
|
|
4
|
-
const radians = angleInDegrees * (Math.PI / 180);
|
|
5
|
-
const cosTheta = Math.cos(radians);
|
|
6
|
-
const sinTheta = Math.sin(radians);
|
|
7
|
-
|
|
8
|
-
// Translate point (x2, y2) to be relative to (x1, y1)
|
|
9
|
-
const x = x2 - x1;
|
|
10
|
-
const y = y2 - y1;
|
|
11
|
-
|
|
12
|
-
// Rotate point
|
|
13
|
-
const xPrime = cosTheta * x - sinTheta * y;
|
|
14
|
-
const yPrime = sinTheta * x + cosTheta * y;
|
|
15
|
-
|
|
16
|
-
// Translate back
|
|
17
|
-
const xNew = xPrime + x1;
|
|
18
|
-
const yNew = yPrime + y1;
|
|
19
|
-
|
|
20
|
-
return { x: xNew, y: yNew };
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function drawPointer(ctx: Konva.Context, shape: Konva.Shape, startX: number, startY: number, ctrlX: number, ctrlY: number) {
|
|
24
|
-
const x2 = startX + 12;
|
|
25
|
-
const y2 = startY - 6;
|
|
26
|
-
const x3 = startX + 12;
|
|
27
|
-
const y3 = startY + 6;
|
|
28
|
-
const angle = (Math.atan2(ctrlY - startY, ctrlX - startX) * 180) / Math.PI;
|
|
29
|
-
const p2 = rotatePoint(startX, startY, x2, y2, angle);
|
|
30
|
-
const p3 = rotatePoint(startX, startY, x3, y3, angle);
|
|
31
|
-
ctx.beginPath();
|
|
32
|
-
ctx.moveTo(startX, startY);
|
|
33
|
-
ctx.lineTo(p2.x, p2.y);
|
|
34
|
-
ctx.lineTo(p3.x, p3.y);
|
|
35
|
-
ctx.lineTo(startX, startY);
|
|
36
|
-
ctx.lineTo(p2.x, p2.y);
|
|
37
|
-
ctx.strokeShape(shape);
|
|
38
|
-
ctx.fillShape(shape);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function BezierSceneFunc(ctx: Konva.Context, shape: Konva.Shape) {
|
|
42
|
-
if (shape instanceof Konva.Arrow) {
|
|
43
|
-
const ps = shape.points();
|
|
44
|
-
if (ps.length / 2 === 4) {
|
|
45
|
-
// 三次
|
|
46
|
-
ctx.beginPath();
|
|
47
|
-
ctx.moveTo(ps[0], ps[1]);
|
|
48
|
-
ctx.bezierCurveTo(ps[2], ps[3], ps[4], ps[5], ps[6], ps[7]);
|
|
49
|
-
ctx.strokeShape(shape);
|
|
50
|
-
ctx.closePath();
|
|
51
|
-
shape.pointerAtBeginning() && drawPointer(ctx, shape, ps[0], ps[1], ps[2], ps[3]);
|
|
52
|
-
shape.pointerAtEnding() && drawPointer(ctx, shape, ps[6], ps[7], ps[4], ps[5]);
|
|
53
|
-
} else if (ps.length / 2 === 3) {
|
|
54
|
-
// 二次
|
|
55
|
-
ctx.beginPath();
|
|
56
|
-
ctx.moveTo(ps[0], ps[1]);
|
|
57
|
-
ctx.quadraticCurveTo(ps[2], ps[3], ps[4], ps[5]);
|
|
58
|
-
ctx.strokeShape(shape);
|
|
59
|
-
ctx.closePath();
|
|
60
|
-
shape.pointerAtBeginning() && drawPointer(ctx, shape, ps[0], ps[1], ps[2], ps[3]);
|
|
61
|
-
shape.pointerAtEnding() && drawPointer(ctx, shape, ps[4], ps[5], ps[2], ps[3]);
|
|
62
|
-
} else {
|
|
63
|
-
// 直线
|
|
64
|
-
ctx.beginPath();
|
|
65
|
-
ctx.moveTo(ps[0], ps[1]);
|
|
66
|
-
ctx.lineTo(ps[2], ps[3]);
|
|
67
|
-
ctx.strokeShape(shape);
|
|
68
|
-
ctx.closePath();
|
|
69
|
-
shape.pointerAtBeginning() && drawPointer(ctx, shape, ps[0], ps[1], ps[2], ps[3]);
|
|
70
|
-
shape.pointerAtEnding() && drawPointer(ctx, shape, ps[2], ps[3], ps[0], ps[1]);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
1
|
+
import Konva from 'konva';
|
|
2
|
+
|
|
3
|
+
function rotatePoint(x1: number, y1: number, x2: number, y2: number, angleInDegrees: number) {
|
|
4
|
+
const radians = angleInDegrees * (Math.PI / 180);
|
|
5
|
+
const cosTheta = Math.cos(radians);
|
|
6
|
+
const sinTheta = Math.sin(radians);
|
|
7
|
+
|
|
8
|
+
// Translate point (x2, y2) to be relative to (x1, y1)
|
|
9
|
+
const x = x2 - x1;
|
|
10
|
+
const y = y2 - y1;
|
|
11
|
+
|
|
12
|
+
// Rotate point
|
|
13
|
+
const xPrime = cosTheta * x - sinTheta * y;
|
|
14
|
+
const yPrime = sinTheta * x + cosTheta * y;
|
|
15
|
+
|
|
16
|
+
// Translate back
|
|
17
|
+
const xNew = xPrime + x1;
|
|
18
|
+
const yNew = yPrime + y1;
|
|
19
|
+
|
|
20
|
+
return { x: xNew, y: yNew };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function drawPointer(ctx: Konva.Context, shape: Konva.Shape, startX: number, startY: number, ctrlX: number, ctrlY: number) {
|
|
24
|
+
const x2 = startX + 12;
|
|
25
|
+
const y2 = startY - 6;
|
|
26
|
+
const x3 = startX + 12;
|
|
27
|
+
const y3 = startY + 6;
|
|
28
|
+
const angle = (Math.atan2(ctrlY - startY, ctrlX - startX) * 180) / Math.PI;
|
|
29
|
+
const p2 = rotatePoint(startX, startY, x2, y2, angle);
|
|
30
|
+
const p3 = rotatePoint(startX, startY, x3, y3, angle);
|
|
31
|
+
ctx.beginPath();
|
|
32
|
+
ctx.moveTo(startX, startY);
|
|
33
|
+
ctx.lineTo(p2.x, p2.y);
|
|
34
|
+
ctx.lineTo(p3.x, p3.y);
|
|
35
|
+
ctx.lineTo(startX, startY);
|
|
36
|
+
ctx.lineTo(p2.x, p2.y);
|
|
37
|
+
ctx.strokeShape(shape);
|
|
38
|
+
ctx.fillShape(shape);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function BezierSceneFunc(ctx: Konva.Context, shape: Konva.Shape) {
|
|
42
|
+
if (shape instanceof Konva.Arrow) {
|
|
43
|
+
const ps = shape.points();
|
|
44
|
+
if (ps.length / 2 === 4) {
|
|
45
|
+
// 三次
|
|
46
|
+
ctx.beginPath();
|
|
47
|
+
ctx.moveTo(ps[0], ps[1]);
|
|
48
|
+
ctx.bezierCurveTo(ps[2], ps[3], ps[4], ps[5], ps[6], ps[7]);
|
|
49
|
+
ctx.strokeShape(shape);
|
|
50
|
+
ctx.closePath();
|
|
51
|
+
shape.pointerAtBeginning() && drawPointer(ctx, shape, ps[0], ps[1], ps[2], ps[3]);
|
|
52
|
+
shape.pointerAtEnding() && drawPointer(ctx, shape, ps[6], ps[7], ps[4], ps[5]);
|
|
53
|
+
} else if (ps.length / 2 === 3) {
|
|
54
|
+
// 二次
|
|
55
|
+
ctx.beginPath();
|
|
56
|
+
ctx.moveTo(ps[0], ps[1]);
|
|
57
|
+
ctx.quadraticCurveTo(ps[2], ps[3], ps[4], ps[5]);
|
|
58
|
+
ctx.strokeShape(shape);
|
|
59
|
+
ctx.closePath();
|
|
60
|
+
shape.pointerAtBeginning() && drawPointer(ctx, shape, ps[0], ps[1], ps[2], ps[3]);
|
|
61
|
+
shape.pointerAtEnding() && drawPointer(ctx, shape, ps[4], ps[5], ps[2], ps[3]);
|
|
62
|
+
} else {
|
|
63
|
+
// 直线
|
|
64
|
+
ctx.beginPath();
|
|
65
|
+
ctx.moveTo(ps[0], ps[1]);
|
|
66
|
+
ctx.lineTo(ps[2], ps[3]);
|
|
67
|
+
ctx.strokeShape(shape);
|
|
68
|
+
ctx.closePath();
|
|
69
|
+
shape.pointerAtBeginning() && drawPointer(ctx, shape, ps[0], ps[1], ps[2], ps[3]);
|
|
70
|
+
shape.pointerAtEnding() && drawPointer(ctx, shape, ps[2], ps[3], ps[0], ps[1]);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
73
|
}
|
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
2
|
-
import { Upload as AntdUpLoad, UploadFile, message } from "antd";
|
|
3
|
-
import { RcFile } from "antd/es/upload";
|
|
4
|
-
import { PlusOutlined } from "@ant-design/icons";
|
|
5
|
-
import { HydrocarbonService, Superagent, ProgramConfig } from "../../../index";
|
|
6
|
-
import { fileUpload } from "../../constant";
|
|
7
|
-
import { useLocale } from "../../../locale/useLocale";
|
|
8
|
-
|
|
9
|
-
const { sourceId, serverKey } = fileUpload;
|
|
10
|
-
|
|
11
|
-
// 本地文件上传,处理url
|
|
12
|
-
const handleImgUrl = (basePath: string) => {
|
|
13
|
-
if (basePath.startsWith("http")) {
|
|
14
|
-
return basePath;
|
|
15
|
-
}
|
|
16
|
-
const url = encodeURI(ProgramConfig.joinPath(
|
|
17
|
-
ProgramConfig.joinPath(ProgramConfig.api(), "/v3/files"),
|
|
18
|
-
basePath
|
|
19
|
-
)) +
|
|
20
|
-
`?@token=${ProgramConfig.hydrocarbonToken()}&@programToken=${ProgramConfig.programCode(serverKey)}&@applicationToken=${ProgramConfig.applicationCode(serverKey)}`;
|
|
21
|
-
return url;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const fileInfo = {
|
|
25
|
-
uid: '-1',
|
|
26
|
-
name: 'image.png',
|
|
27
|
-
status: 'done',
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export interface CommonFilePath {
|
|
31
|
-
fileName?: string;
|
|
32
|
-
contentType?: string;//文件类型
|
|
33
|
-
path?: string;
|
|
34
|
-
iconPath?: string;
|
|
35
|
-
valid?: string;
|
|
36
|
-
baseType?: string;
|
|
37
|
-
basePath?: string;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export interface UploadProps {
|
|
42
|
-
accept?: string;
|
|
43
|
-
size?: number;
|
|
44
|
-
onChange?: (data: { src: string, code: string }) => void;
|
|
45
|
-
value?: { src: string, code: string };
|
|
46
|
-
recordCode?: string; // 当前画面关联数据code,用于图片命名区分
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const ImageUpload: React.FC<UploadProps> = (props) => {
|
|
50
|
-
const { onChange, accept, size, recordCode, value } = props;
|
|
51
|
-
const [fileList, setFileList] = useState([]);
|
|
52
|
-
const [imgCode, setImgCode] = useState<string>(); // 本地图片code
|
|
53
|
-
const { translate } = useLocale();
|
|
54
|
-
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
setFileList(value?.src ? [{ ...fileInfo, url: handleImgUrl(value?.src) }] : []);
|
|
57
|
-
setImgCode(value?.code);
|
|
58
|
-
}, [value]);
|
|
59
|
-
|
|
60
|
-
const beforeUpload = async (file: RcFile) => {
|
|
61
|
-
if (size && file.size > size * 1024 * 1024) {
|
|
62
|
-
message.warning(translate("${文件大小不能超过}") + `${size}M`);
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const handleChange = async (info) => {
|
|
69
|
-
if (info.file.status == "done") {
|
|
70
|
-
const fileKey = info.file.response.fileKey;
|
|
71
|
-
const fileName = info.file.name;
|
|
72
|
-
const data = { valid: "new", fileKey, fileName };
|
|
73
|
-
const result = { 描述: `${recordCode || ""}-${fileName}`, 文件: JSON.stringify(data) };
|
|
74
|
-
const { code } = await HydrocarbonService.postMstrucDtmplData(serverKey, sourceId, result, message);
|
|
75
|
-
setImgCode(code);
|
|
76
|
-
const imgData = await HydrocarbonService.requestMstrucDtmplData(serverKey, sourceId, code, null);
|
|
77
|
-
const basePath = JSON.parse(imgData.fieldMap["文件"] || "{}").base?.path;
|
|
78
|
-
if (basePath) {
|
|
79
|
-
const url = handleImgUrl(basePath);
|
|
80
|
-
setFileList([{ ...info.file, url }]);
|
|
81
|
-
// onChange?.(url);
|
|
82
|
-
onChange?.({ src: basePath, code });
|
|
83
|
-
} else {
|
|
84
|
-
setFileList([...info.fileList]);
|
|
85
|
-
}
|
|
86
|
-
} else {
|
|
87
|
-
setFileList([...info.fileList]);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const handleDelete = async () => {
|
|
92
|
-
await HydrocarbonService.deleteByCode(serverKey, sourceId, [imgCode]);
|
|
93
|
-
setFileList([]);
|
|
94
|
-
onChange?.(null);
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
return (
|
|
98
|
-
<AntdUpLoad
|
|
99
|
-
action={(file) => HydrocarbonService.postFileAction(serverKey, file)}
|
|
100
|
-
headers={Superagent.getHeaderObj(serverKey)}
|
|
101
|
-
name={'file'}
|
|
102
|
-
beforeUpload={beforeUpload}
|
|
103
|
-
listType={'picture-card'}
|
|
104
|
-
fileList={fileList?.length ? fileList as Array<UploadFile> : undefined}
|
|
105
|
-
accept={accept}
|
|
106
|
-
onChange={handleChange}
|
|
107
|
-
onRemove={handleDelete}
|
|
108
|
-
onPreview={() => window.open(fileList[0].url)}
|
|
109
|
-
styles={{ root: { overflow: "hidden" } }}
|
|
110
|
-
>
|
|
111
|
-
{fileList.length > 0 ? null : <div className={'upload-btn'}>
|
|
112
|
-
<PlusOutlined />
|
|
113
|
-
<div style={{ marginTop: 8 }}>{translate("${上传图片}")}</div>
|
|
114
|
-
</div>}
|
|
115
|
-
</AntdUpLoad>
|
|
116
|
-
)
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
export default ImageUpload;
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { Upload as AntdUpLoad, UploadFile, message } from "antd";
|
|
3
|
+
import { RcFile } from "antd/es/upload";
|
|
4
|
+
import { PlusOutlined } from "@ant-design/icons";
|
|
5
|
+
import { HydrocarbonService, Superagent, ProgramConfig } from "../../../index";
|
|
6
|
+
import { fileUpload } from "../../constant";
|
|
7
|
+
import { useLocale } from "../../../locale/useLocale";
|
|
8
|
+
|
|
9
|
+
const { sourceId, serverKey } = fileUpload;
|
|
10
|
+
|
|
11
|
+
// 本地文件上传,处理url
|
|
12
|
+
const handleImgUrl = (basePath: string) => {
|
|
13
|
+
if (basePath.startsWith("http")) {
|
|
14
|
+
return basePath;
|
|
15
|
+
}
|
|
16
|
+
const url = encodeURI(ProgramConfig.joinPath(
|
|
17
|
+
ProgramConfig.joinPath(ProgramConfig.api(), "/v3/files"),
|
|
18
|
+
basePath
|
|
19
|
+
)) +
|
|
20
|
+
`?@token=${ProgramConfig.hydrocarbonToken()}&@programToken=${ProgramConfig.programCode(serverKey)}&@applicationToken=${ProgramConfig.applicationCode(serverKey)}`;
|
|
21
|
+
return url;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const fileInfo = {
|
|
25
|
+
uid: '-1',
|
|
26
|
+
name: 'image.png',
|
|
27
|
+
status: 'done',
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export interface CommonFilePath {
|
|
31
|
+
fileName?: string;
|
|
32
|
+
contentType?: string;//文件类型
|
|
33
|
+
path?: string;
|
|
34
|
+
iconPath?: string;
|
|
35
|
+
valid?: string;
|
|
36
|
+
baseType?: string;
|
|
37
|
+
basePath?: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
export interface UploadProps {
|
|
42
|
+
accept?: string;
|
|
43
|
+
size?: number;
|
|
44
|
+
onChange?: (data: { src: string, code: string }) => void;
|
|
45
|
+
value?: { src: string, code: string };
|
|
46
|
+
recordCode?: string; // 当前画面关联数据code,用于图片命名区分
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const ImageUpload: React.FC<UploadProps> = (props) => {
|
|
50
|
+
const { onChange, accept, size, recordCode, value } = props;
|
|
51
|
+
const [fileList, setFileList] = useState([]);
|
|
52
|
+
const [imgCode, setImgCode] = useState<string>(); // 本地图片code
|
|
53
|
+
const { translate } = useLocale();
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
setFileList(value?.src ? [{ ...fileInfo, url: handleImgUrl(value?.src) }] : []);
|
|
57
|
+
setImgCode(value?.code);
|
|
58
|
+
}, [value]);
|
|
59
|
+
|
|
60
|
+
const beforeUpload = async (file: RcFile) => {
|
|
61
|
+
if (size && file.size > size * 1024 * 1024) {
|
|
62
|
+
message.warning(translate("${文件大小不能超过}") + `${size}M`);
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const handleChange = async (info) => {
|
|
69
|
+
if (info.file.status == "done") {
|
|
70
|
+
const fileKey = info.file.response.fileKey;
|
|
71
|
+
const fileName = info.file.name;
|
|
72
|
+
const data = { valid: "new", fileKey, fileName };
|
|
73
|
+
const result = { 描述: `${recordCode || ""}-${fileName}`, 文件: JSON.stringify(data) };
|
|
74
|
+
const { code } = await HydrocarbonService.postMstrucDtmplData(serverKey, sourceId, result, message);
|
|
75
|
+
setImgCode(code);
|
|
76
|
+
const imgData = await HydrocarbonService.requestMstrucDtmplData(serverKey, sourceId, code, null);
|
|
77
|
+
const basePath = JSON.parse(imgData.fieldMap["文件"] || "{}").base?.path;
|
|
78
|
+
if (basePath) {
|
|
79
|
+
const url = handleImgUrl(basePath);
|
|
80
|
+
setFileList([{ ...info.file, url }]);
|
|
81
|
+
// onChange?.(url);
|
|
82
|
+
onChange?.({ src: basePath, code });
|
|
83
|
+
} else {
|
|
84
|
+
setFileList([...info.fileList]);
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
setFileList([...info.fileList]);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const handleDelete = async () => {
|
|
92
|
+
await HydrocarbonService.deleteByCode(serverKey, sourceId, [imgCode]);
|
|
93
|
+
setFileList([]);
|
|
94
|
+
onChange?.(null);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<AntdUpLoad
|
|
99
|
+
action={(file) => HydrocarbonService.postFileAction(serverKey, file)}
|
|
100
|
+
headers={Superagent.getHeaderObj(serverKey)}
|
|
101
|
+
name={'file'}
|
|
102
|
+
beforeUpload={beforeUpload}
|
|
103
|
+
listType={'picture-card'}
|
|
104
|
+
fileList={fileList?.length ? fileList as Array<UploadFile> : undefined}
|
|
105
|
+
accept={accept}
|
|
106
|
+
onChange={handleChange}
|
|
107
|
+
onRemove={handleDelete}
|
|
108
|
+
onPreview={() => window.open(fileList[0].url)}
|
|
109
|
+
styles={{ root: { overflow: "hidden" } }}
|
|
110
|
+
>
|
|
111
|
+
{fileList.length > 0 ? null : <div className={'upload-btn'}>
|
|
112
|
+
<PlusOutlined />
|
|
113
|
+
<div style={{ marginTop: 8 }}>{translate("${上传图片}")}</div>
|
|
114
|
+
</div>}
|
|
115
|
+
</AntdUpLoad>
|
|
116
|
+
)
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export default ImageUpload;
|
|
@@ -67,14 +67,16 @@ export const handleMenuItemUrl = (
|
|
|
67
67
|
dragDropPageId?: string,
|
|
68
68
|
fullScreen?: boolean,
|
|
69
69
|
version?: string, // 版本路由 v2/v3
|
|
70
|
+
serverKey?: string, // serverKey:跨项目菜单使用
|
|
70
71
|
) => {
|
|
71
72
|
if (customPath) return `${fullScreen ? "" : `${version}/`}page/${id}/${customPath}?menuId=${id}`;
|
|
72
73
|
if (dragDropPageId) {
|
|
73
|
-
return `${fullScreen ? "" : `${version}/`}ddpage/${id}/${dragDropPageId}?menuId=${id}`;
|
|
74
|
+
return `${fullScreen ? "" : `${version}/`}ddpage/${id}/${dragDropPageId}?menuId=${id}${serverKey ? `&serverKey=${serverKey}` : ""}`;
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
const queryParam = { ...query };
|
|
77
78
|
queryParam["menuId"] = id;
|
|
79
|
+
if (serverKey) queryParam["serverKey"] = serverKey;
|
|
78
80
|
|
|
79
81
|
let routePath = "",
|
|
80
82
|
operator = "";
|
|
@@ -130,8 +132,9 @@ export const handleMenuItemUrl = (
|
|
|
130
132
|
.join("&")}`;
|
|
131
133
|
};
|
|
132
134
|
|
|
133
|
-
const handleMenuRes = (menuList: MenuConfigAPIType["blocks"], version: string): MenuType[] => {
|
|
135
|
+
const handleMenuRes = (menuList: MenuConfigAPIType["blocks"], version: string): { menuList: MenuType[], crossProjectCode: { [key: string]: string } } => {
|
|
134
136
|
const retList: MenuType[] = [];
|
|
137
|
+
const crossProjectCode = {};
|
|
135
138
|
|
|
136
139
|
menuList.sort((a, b) => {
|
|
137
140
|
const aOrder = Number(a.order);
|
|
@@ -154,27 +157,30 @@ const handleMenuRes = (menuList: MenuConfigAPIType["blocks"], version: string):
|
|
|
154
157
|
fullScreen,
|
|
155
158
|
icon,
|
|
156
159
|
themeColor,
|
|
157
|
-
funcDescription
|
|
160
|
+
funcDescription, targetProgram
|
|
158
161
|
} of menuList) {
|
|
159
162
|
if (!(hiddenOnDisabled === true && disabled === true)) {
|
|
163
|
+
const { menuList: childMenuList, crossProjectCode: childCrossProjectCode } = items?.length ? handleMenuRes(items, version) : {};
|
|
160
164
|
const menu: MenuType = {
|
|
161
165
|
id,
|
|
162
166
|
label: title,
|
|
163
167
|
disabled: disabled === undefined ? false : disabled,
|
|
164
|
-
url: handleMenuItemUrl(id, pageType, defaultCriteriaValue, customPath, dragDropPageId, fullScreen, version),
|
|
168
|
+
url: handleMenuItemUrl(id, pageType, defaultCriteriaValue, customPath, dragDropPageId, fullScreen, version, targetProgram ? `cp_${id}` : ""),
|
|
165
169
|
linkTarget,
|
|
166
|
-
children:
|
|
170
|
+
children: childMenuList || [],
|
|
167
171
|
icon,
|
|
168
172
|
themeColor,
|
|
169
173
|
funcDescription,
|
|
170
174
|
dragDropPageId,
|
|
171
|
-
customPath
|
|
175
|
+
customPath,
|
|
176
|
+
targetProgram
|
|
172
177
|
};
|
|
173
178
|
retList.push(menu);
|
|
179
|
+
if (targetProgram) crossProjectCode[`cp_${id}`] = targetProgram;
|
|
180
|
+
Object.assign(crossProjectCode, childCrossProjectCode);
|
|
174
181
|
}
|
|
175
182
|
}
|
|
176
|
-
|
|
177
|
-
return retList;
|
|
183
|
+
return { menuList: retList, crossProjectCode };
|
|
178
184
|
};
|
|
179
185
|
|
|
180
186
|
|
|
@@ -187,7 +193,9 @@ export const getMenuConfig = async (version = "v2"): Promise<{
|
|
|
187
193
|
const res = await HcserviceV3.requestBlocks("", "");
|
|
188
194
|
let menuList: MenuType[] = [];
|
|
189
195
|
if (res?.blocks) {
|
|
190
|
-
|
|
196
|
+
const menuRes = handleMenuRes(res.blocks, version);
|
|
197
|
+
menuList = menuRes.menuList;
|
|
198
|
+
Units.setCrossProjectCode(menuRes.crossProjectCode);
|
|
191
199
|
}
|
|
192
200
|
let tmp = {};
|
|
193
201
|
menuList.forEach((menu: MenuType) => {
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<svg width="75px" height="50px" viewBox="0 0 75 50" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
-
<title>编组 28@2x</title>
|
|
4
|
-
<defs>
|
|
5
|
-
<linearGradient x1="56.7868058%" y1="100%" x2="56.7868058%" y2="0%" id="linearGradient-1">
|
|
6
|
-
<stop stop-color="#90DCFE" offset="0%"></stop>
|
|
7
|
-
<stop stop-color="#141F34" offset="100%"></stop>
|
|
8
|
-
</linearGradient>
|
|
9
|
-
<radialGradient cx="50%" cy="30.3951181%" fx="50%" fy="30.3951181%" r="135.534427%" gradientTransform="translate(0.500000,0.303951),scale(0.171272,1.000000),rotate(90.000000),scale(1.000000,2.145743),translate(-0.500000,-0.303951)" id="radialGradient-2">
|
|
10
|
-
<stop stop-color="#ACF4F7" offset="0%"></stop>
|
|
11
|
-
<stop stop-color="#96EEF2" stop-opacity="0.600017604" offset="75.2832594%"></stop>
|
|
12
|
-
<stop stop-color="#74E5EB" stop-opacity="0" offset="100%"></stop>
|
|
13
|
-
</radialGradient>
|
|
14
|
-
</defs>
|
|
15
|
-
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
16
|
-
<g id="2025-02-28-西安航天-导航" transform="translate(-1816.000000, -11.000000)">
|
|
17
|
-
<g id="编组-28" transform="translate(1816.900000, 11.000000)">
|
|
18
|
-
<rect id="矩形" fill="url(#linearGradient-1)" opacity="0.586283366" x="0" y="0" width="74" height="46" rx="23"></rect>
|
|
19
|
-
<path d="M52,44.0516405 L52,46.0516405 L40.137,46.0516405 L37,49.1897883 L33.862,46.0516405 L22,46.0516405 L22,44.0516405 L52,44.0516405 Z" id="形状结合" fill="url(#radialGradient-2)" fill-rule="nonzero"></path>
|
|
20
|
-
<g id="账号中心-账号管理" transform="translate(22.939298, 9.939298)" fill="#FFFFFF" fill-rule="nonzero">
|
|
21
|
-
<rect id="矩形" opacity="0" x="0" y="0" width="28.121403" height="28.121403"></rect>
|
|
22
|
-
<path d="M14.6998318,15.2110976 C16.6171677,14.0607015 17.8954283,12.0155285 17.8954283,9.71468147 C17.8954283,6.13560131 14.9554784,3.19565143 11.3763982,3.19565143 C7.79731808,3.19565143 4.60169411,6.13557384 4.60169411,9.71465401 C4.60169411,12.0155011 5.87992722,14.0607015 7.79729061,15.211125 C4.34604749,16.4893581 1.91736339,19.8128191 1.91736339,23.7753555 C1.91736339,24.4144858 2.42865664,24.925779 3.06778692,24.925779 C3.70691721,24.925779 4.21821045,24.4144858 4.21821045,23.775383 C4.21821045,19.9406287 7.41383441,16.7450322 11.2485612,16.7450322 C15.2110976,16.7450322 18.278912,19.9406287 18.278912,23.775383 C18.278912,24.4144858 18.7902052,24.925779 19.429308,24.925779 C20.0684108,24.925779 20.579759,24.4144858 20.579759,23.775383 C20.579759,19.9406287 18.1510749,16.6171952 14.6998043,15.211125 L14.6998318,15.2110976 Z M11.2485612,14.0607015 C8.81990456,14.0607015 6.90251371,12.1433381 6.90251371,9.71465401 C6.90251371,7.28596991 8.81990456,5.36863398 11.2485612,5.36863398 C13.6772178,5.36863398 15.5946087,7.28599737 15.5946087,9.71465401 C15.5946087,12.1433106 13.6772178,14.0607015 11.2485612,14.0607015 Z M20.9632152,9.45900739 L25.1814257,9.45900739 C25.8205559,9.45900739 26.2040396,8.94771414 26.2040396,8.4364209 C26.2040396,7.79729061 25.6927464,7.41383441 25.1814257,7.41383441 L20.9632152,7.41383441 C20.3241124,7.41383441 19.9406287,7.92512766 19.9406287,8.4364209 C19.8128191,8.94771414 20.3241124,9.45900739 20.9632152,9.45900739 Z M25.1814257,11.3763982 L19.8128191,11.3763982 C19.1736889,11.3763982 18.7902052,11.8876915 18.7902052,12.3989847 C18.7902052,13.038115 19.3014984,13.4215712 19.8128191,13.4215712 L25.1814257,13.4215712 C25.8205559,13.4215712 26.2040396,12.910278 26.2040396,12.3989847 C26.2040396,11.8876915 25.6927464,11.3763982 25.1814257,11.3763982 Z M25.1814257,15.4667717 L20.9632152,15.4667717 C20.3241124,15.4667717 19.9406287,15.9780649 19.9406287,16.4893581 C19.9406287,17.1284884 20.451922,17.5119721 20.9632152,17.5119721 L25.1814257,17.5119721 C25.8205559,17.5119721 26.2040396,17.0006788 26.2040396,16.4893581 C26.2040396,15.9780374 25.6927464,15.4667717 25.1814257,15.4667717 Z" id="形状"></path>
|
|
23
|
-
</g>
|
|
24
|
-
</g>
|
|
25
|
-
</g>
|
|
26
|
-
</g>
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="75px" height="50px" viewBox="0 0 75 50" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>编组 28@2x</title>
|
|
4
|
+
<defs>
|
|
5
|
+
<linearGradient x1="56.7868058%" y1="100%" x2="56.7868058%" y2="0%" id="linearGradient-1">
|
|
6
|
+
<stop stop-color="#90DCFE" offset="0%"></stop>
|
|
7
|
+
<stop stop-color="#141F34" offset="100%"></stop>
|
|
8
|
+
</linearGradient>
|
|
9
|
+
<radialGradient cx="50%" cy="30.3951181%" fx="50%" fy="30.3951181%" r="135.534427%" gradientTransform="translate(0.500000,0.303951),scale(0.171272,1.000000),rotate(90.000000),scale(1.000000,2.145743),translate(-0.500000,-0.303951)" id="radialGradient-2">
|
|
10
|
+
<stop stop-color="#ACF4F7" offset="0%"></stop>
|
|
11
|
+
<stop stop-color="#96EEF2" stop-opacity="0.600017604" offset="75.2832594%"></stop>
|
|
12
|
+
<stop stop-color="#74E5EB" stop-opacity="0" offset="100%"></stop>
|
|
13
|
+
</radialGradient>
|
|
14
|
+
</defs>
|
|
15
|
+
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
16
|
+
<g id="2025-02-28-西安航天-导航" transform="translate(-1816.000000, -11.000000)">
|
|
17
|
+
<g id="编组-28" transform="translate(1816.900000, 11.000000)">
|
|
18
|
+
<rect id="矩形" fill="url(#linearGradient-1)" opacity="0.586283366" x="0" y="0" width="74" height="46" rx="23"></rect>
|
|
19
|
+
<path d="M52,44.0516405 L52,46.0516405 L40.137,46.0516405 L37,49.1897883 L33.862,46.0516405 L22,46.0516405 L22,44.0516405 L52,44.0516405 Z" id="形状结合" fill="url(#radialGradient-2)" fill-rule="nonzero"></path>
|
|
20
|
+
<g id="账号中心-账号管理" transform="translate(22.939298, 9.939298)" fill="#FFFFFF" fill-rule="nonzero">
|
|
21
|
+
<rect id="矩形" opacity="0" x="0" y="0" width="28.121403" height="28.121403"></rect>
|
|
22
|
+
<path d="M14.6998318,15.2110976 C16.6171677,14.0607015 17.8954283,12.0155285 17.8954283,9.71468147 C17.8954283,6.13560131 14.9554784,3.19565143 11.3763982,3.19565143 C7.79731808,3.19565143 4.60169411,6.13557384 4.60169411,9.71465401 C4.60169411,12.0155011 5.87992722,14.0607015 7.79729061,15.211125 C4.34604749,16.4893581 1.91736339,19.8128191 1.91736339,23.7753555 C1.91736339,24.4144858 2.42865664,24.925779 3.06778692,24.925779 C3.70691721,24.925779 4.21821045,24.4144858 4.21821045,23.775383 C4.21821045,19.9406287 7.41383441,16.7450322 11.2485612,16.7450322 C15.2110976,16.7450322 18.278912,19.9406287 18.278912,23.775383 C18.278912,24.4144858 18.7902052,24.925779 19.429308,24.925779 C20.0684108,24.925779 20.579759,24.4144858 20.579759,23.775383 C20.579759,19.9406287 18.1510749,16.6171952 14.6998043,15.211125 L14.6998318,15.2110976 Z M11.2485612,14.0607015 C8.81990456,14.0607015 6.90251371,12.1433381 6.90251371,9.71465401 C6.90251371,7.28596991 8.81990456,5.36863398 11.2485612,5.36863398 C13.6772178,5.36863398 15.5946087,7.28599737 15.5946087,9.71465401 C15.5946087,12.1433106 13.6772178,14.0607015 11.2485612,14.0607015 Z M20.9632152,9.45900739 L25.1814257,9.45900739 C25.8205559,9.45900739 26.2040396,8.94771414 26.2040396,8.4364209 C26.2040396,7.79729061 25.6927464,7.41383441 25.1814257,7.41383441 L20.9632152,7.41383441 C20.3241124,7.41383441 19.9406287,7.92512766 19.9406287,8.4364209 C19.8128191,8.94771414 20.3241124,9.45900739 20.9632152,9.45900739 Z M25.1814257,11.3763982 L19.8128191,11.3763982 C19.1736889,11.3763982 18.7902052,11.8876915 18.7902052,12.3989847 C18.7902052,13.038115 19.3014984,13.4215712 19.8128191,13.4215712 L25.1814257,13.4215712 C25.8205559,13.4215712 26.2040396,12.910278 26.2040396,12.3989847 C26.2040396,11.8876915 25.6927464,11.3763982 25.1814257,11.3763982 Z M25.1814257,15.4667717 L20.9632152,15.4667717 C20.3241124,15.4667717 19.9406287,15.9780649 19.9406287,16.4893581 C19.9406287,17.1284884 20.451922,17.5119721 20.9632152,17.5119721 L25.1814257,17.5119721 C25.8205559,17.5119721 26.2040396,17.0006788 26.2040396,16.4893581 C26.2040396,15.9780374 25.6927464,15.4667717 25.1814257,15.4667717 Z" id="形状"></path>
|
|
23
|
+
</g>
|
|
24
|
+
</g>
|
|
25
|
+
</g>
|
|
26
|
+
</g>
|
|
27
27
|
</svg>
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import React, { ForwardedRef, forwardRef, useImperativeHandle, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
export interface BaseColorBlockComponentStyle {
|
|
4
|
-
borderRadius?: number;
|
|
5
|
-
borderWidth?: number;
|
|
6
|
-
borderColor?: string;
|
|
7
|
-
borderStyle?: string;
|
|
8
|
-
background?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface BaseColorBlockComponentProps {
|
|
12
|
-
style?: BaseColorBlockComponentStyle;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface BaseColorBlockComponentRef {
|
|
16
|
-
updateConfig: (newConfig: BaseColorBlockComponentProps) => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const BaseColorBlockComponent = forwardRef((props: BaseColorBlockComponentProps, ref: ForwardedRef<BaseColorBlockComponentRef>) => {
|
|
20
|
-
const [config, setConfig] = useState<BaseColorBlockComponentProps>({ ...props });
|
|
21
|
-
|
|
22
|
-
useImperativeHandle(ref, () => ({
|
|
23
|
-
updateConfig: (newConfig) => setConfig({ ...newConfig }),
|
|
24
|
-
}));
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<div style={{ ...{ height: '100%', display: 'flex' }, ...(config?.style || {}) }} />
|
|
29
|
-
);
|
|
30
|
-
});
|
|
31
|
-
|
|
1
|
+
import React, { ForwardedRef, forwardRef, useImperativeHandle, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface BaseColorBlockComponentStyle {
|
|
4
|
+
borderRadius?: number;
|
|
5
|
+
borderWidth?: number;
|
|
6
|
+
borderColor?: string;
|
|
7
|
+
borderStyle?: string;
|
|
8
|
+
background?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface BaseColorBlockComponentProps {
|
|
12
|
+
style?: BaseColorBlockComponentStyle;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface BaseColorBlockComponentRef {
|
|
16
|
+
updateConfig: (newConfig: BaseColorBlockComponentProps) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const BaseColorBlockComponent = forwardRef((props: BaseColorBlockComponentProps, ref: ForwardedRef<BaseColorBlockComponentRef>) => {
|
|
20
|
+
const [config, setConfig] = useState<BaseColorBlockComponentProps>({ ...props });
|
|
21
|
+
|
|
22
|
+
useImperativeHandle(ref, () => ({
|
|
23
|
+
updateConfig: (newConfig) => setConfig({ ...newConfig }),
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div style={{ ...{ height: '100%', display: 'flex' }, ...(config?.style || {}) }} />
|
|
29
|
+
);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
32
|
export default BaseColorBlockComponent;
|