aldehyde 0.2.514 → 0.2.516
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/direct-file-view/index.d.ts +1 -1
- package/lib/controls/icon-selector/icon/phonenode-menu-icon/iconfont.css +99 -99
- package/lib/detail/button/cquery-button-bar.d.ts +1 -1
- package/lib/detail/rightbar/index.d.ts +1 -1
- package/lib/draw-canvas-edit/components/asset-bar/index.js +3 -3
- package/lib/draw-canvas-edit/components/asset-bar/index.js.map +1 -1
- 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/form/field-group-form.d.ts +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/layout/menu/l2menu-message-bar.d.ts +1 -1
- package/lib/layout2/page.d.ts.map +1 -1
- package/lib/layout2/page.js +3 -0
- package/lib/layout2/page.js.map +1 -1
- package/lib/layout3/css/main.less +17 -17
- package/lib/layout4/css/main.less +18 -17
- package/lib/locale/LocaleProvider.d.ts.map +1 -1
- package/lib/locale/LocaleProvider.js +4 -2
- package/lib/locale/LocaleProvider.js.map +1 -1
- package/lib/lowcode-components/base-table/index.less +61 -61
- 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/group-layer/index.d.ts +1 -1
- 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/index.less +6 -0
- package/lib/module/ltmpl-table.d.ts +3 -0
- package/lib/module/ltmpl-table.d.ts.map +1 -1
- package/lib/module/ltmpl-table.js +2 -2
- package/lib/module/ltmpl-table.js.map +1 -1
- package/lib/module/ttmpl-table.d.ts +41 -0
- package/lib/module/ttmpl-table.d.ts.map +1 -0
- package/lib/module/ttmpl-table.js +188 -0
- package/lib/module/ttmpl-table.js.map +1 -0
- package/lib/routable/index.less +6 -0
- package/lib/routable/ttmpl-table-route.d.ts +12 -0
- package/lib/routable/ttmpl-table-route.d.ts.map +1 -0
- package/lib/routable/ttmpl-table-route.js +283 -0
- package/lib/routable/ttmpl-table-route.js.map +1 -0
- package/lib/table/act-table.d.ts +11 -3
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +2 -2
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/column/column-builder.d.ts.map +1 -1
- package/lib/table/column/column-builder.js +7 -3
- package/lib/table/column/column-builder.js.map +1 -1
- package/lib/table/index.css +2 -2
- package/lib/table/l2-act-table.d.ts +1 -1
- package/lib/table/page-chart.d.ts +1 -1
- package/lib/table/pagination.d.ts +1 -0
- package/lib/table/pagination.d.ts.map +1 -1
- package/lib/table/pagination.js +5 -4
- package/lib/table/pagination.js.map +1 -1
- package/lib/table/query-table.d.ts +2 -0
- package/lib/table/query-table.d.ts.map +1 -1
- package/lib/table/query-table.js +10 -6
- package/lib/table/query-table.js.map +1 -1
- package/lib/table/relation-table.d.ts +2 -2
- package/lib/tmpl/hc-data-source.d.ts +2 -1
- package/lib/tmpl/hc-data-source.d.ts.map +1 -1
- package/lib/tmpl/hc-data-source.js +12 -0
- package/lib/tmpl/hc-data-source.js.map +1 -1
- package/lib/tmpl/hcservice-v3.d.ts +1 -0
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +12 -0
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/interface.d.ts +16 -1
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/lib/welcome/components/page-card.d.ts +1 -1
- package/package.json +4 -2
- package/src/aldehyde/controls/icon-selector/icon/phonenode-menu-icon/iconfont.css +99 -99
- package/src/aldehyde/controls/icon-selector/icon/phonenode-menu-icon/iconfont.json +156 -156
- 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/index.tsx +3 -1
- package/src/aldehyde/layout2/page.tsx +3 -0
- package/src/aldehyde/layout3/css/main.less +17 -17
- package/src/aldehyde/layout4/css/main.less +18 -17
- package/src/aldehyde/layout4/imgs/user.svg +26 -26
- package/src/aldehyde/locale/LocaleProvider.tsx +4 -2
- 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/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 +144 -144
- 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/index.less +6 -0
- package/src/aldehyde/module/ltmpl-table.tsx +8 -1
- package/src/aldehyde/module/ttmpl-table.tsx +349 -0
- package/src/aldehyde/routable/index.less +6 -0
- package/src/aldehyde/routable/ttmpl-table-route.tsx +390 -0
- package/src/aldehyde/table/act-table.tsx +9 -1
- package/src/aldehyde/table/column/column-builder.tsx +5 -3
- package/src/aldehyde/table/index.css +2 -2
- package/src/aldehyde/table/pagination.tsx +11 -9
- package/src/aldehyde/table/query-table.tsx +13 -4
- package/src/aldehyde/tmpl/hc-data-source.tsx +12 -0
- package/src/aldehyde/tmpl/hcservice-v3.tsx +11 -0
- package/src/aldehyde/tmpl/interface.tsx +14 -2
|
@@ -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;
|
package/src/aldehyde/index.tsx
CHANGED
|
@@ -51,6 +51,7 @@ import ImportRoute from "./routable/import-route";
|
|
|
51
51
|
// import("./routable/import-route"), {fallback: Loading});
|
|
52
52
|
import LtmplRoute from "./routable/ltmpl-route";
|
|
53
53
|
import TtmplRoute from "./routable/ttmpl-route";
|
|
54
|
+
import TtmplTableRoute from "./routable/ttmpl-table-route";
|
|
54
55
|
// const LtmplRoute = loadable(() =>
|
|
55
56
|
// import("./routable/ltmpl-route"), {fallback: Loading});
|
|
56
57
|
import DtmplViewCard from "./module/dtmpl-view-card";
|
|
@@ -216,5 +217,6 @@ export {
|
|
|
216
217
|
NavigationTree,
|
|
217
218
|
Edit2D,
|
|
218
219
|
View2D,
|
|
219
|
-
TtmplTree
|
|
220
|
+
TtmplTree,
|
|
221
|
+
TtmplTableRoute
|
|
220
222
|
};
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
.v3-antd-table {
|
|
2
|
+
.ant-table-css-var {
|
|
3
|
+
--ant-table-border-color: #15325b;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.ant-table {
|
|
7
|
+
background: transparent;
|
|
8
|
+
scrollbar-color: var(--ant-table-header-bg) transparent;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.ant-table-tbody .ant-table-cell {
|
|
12
|
+
background: var(--ant-color-bg-base) !important;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
1
16
|
.v3-main {
|
|
2
17
|
width: 100%;
|
|
3
18
|
height: 100%;
|
|
@@ -55,11 +70,11 @@
|
|
|
55
70
|
|
|
56
71
|
.ant-table-tbody,
|
|
57
72
|
.ant-table-summary {
|
|
58
|
-
.ant-table-cell:has(.xiaoji) {
|
|
73
|
+
.ant-table-cell:not(.ant-table-expanded-row > .ant-table-cell):has(.xiaoji) {
|
|
59
74
|
background-color: var(--color-5) !important;
|
|
60
75
|
}
|
|
61
76
|
|
|
62
|
-
.ant-table-cell:has(.heji) {
|
|
77
|
+
.ant-table-cell:not(.ant-table-expanded-row > .ant-table-cell):has(.heji) {
|
|
63
78
|
background-color: var(--color-7) !important;
|
|
64
79
|
}
|
|
65
80
|
|
|
@@ -105,21 +120,6 @@
|
|
|
105
120
|
}
|
|
106
121
|
}
|
|
107
122
|
|
|
108
|
-
.v3-antd-table {
|
|
109
|
-
.ant-table-css-var {
|
|
110
|
-
--ant-table-border-color: #15325b;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.ant-table {
|
|
114
|
-
background: transparent;
|
|
115
|
-
scrollbar-color: var(--ant-table-header-bg) transparent;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.ant-table-tbody .ant-table-cell {
|
|
119
|
-
background: var(--ant-color-bg-base) !important;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
123
|
.v3-antd-drawer,
|
|
124
124
|
.v3-antd-modal {
|
|
125
125
|
.ant-table-css-var {
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
.v4-antd-table {
|
|
2
|
+
.ant-table-css-var {
|
|
3
|
+
--ant-table-border-color: #15325b;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.ant-table {
|
|
7
|
+
background: transparent;
|
|
8
|
+
scrollbar-color: var(--ant-table-header-bg) transparent;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.ant-table-tbody .ant-table-cell {
|
|
12
|
+
background: var(--ant-color-bg-base) !important;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
1
16
|
.v4-main {
|
|
2
17
|
width: 100%;
|
|
3
18
|
height: 100%;
|
|
@@ -47,11 +62,12 @@
|
|
|
47
62
|
|
|
48
63
|
.ant-table-tbody,
|
|
49
64
|
.ant-table-summary {
|
|
50
|
-
|
|
65
|
+
|
|
66
|
+
.ant-table-cell:not(.ant-table-expanded-row > .ant-table-cell):has(.xiaoji) {
|
|
51
67
|
background-color: var(--color-5) !important;
|
|
52
68
|
}
|
|
53
69
|
|
|
54
|
-
.ant-table-cell:has(.heji) {
|
|
70
|
+
.ant-table-cell:not(.ant-table-expanded-row > .ant-table-cell):has(.heji) {
|
|
55
71
|
background-color: var(--color-8) !important;
|
|
56
72
|
}
|
|
57
73
|
|
|
@@ -98,21 +114,6 @@
|
|
|
98
114
|
}
|
|
99
115
|
}
|
|
100
116
|
|
|
101
|
-
.v4-antd-table {
|
|
102
|
-
.ant-table-css-var {
|
|
103
|
-
--ant-table-border-color: #15325b;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.ant-table {
|
|
107
|
-
background: transparent;
|
|
108
|
-
scrollbar-color: var(--ant-table-header-bg) transparent;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.ant-table-tbody .ant-table-cell {
|
|
112
|
-
background: var(--ant-color-bg-base) !important;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
117
|
.v4-antd-drawer,
|
|
117
118
|
.v4-antd-modal {
|
|
118
119
|
.ant-table-css-var {
|
|
@@ -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>
|
|
@@ -158,10 +158,12 @@ export const LocaleProvider = (props: Props) => {
|
|
|
158
158
|
}, [languages?.length]);
|
|
159
159
|
|
|
160
160
|
useEffect(() => {
|
|
161
|
-
if ("defaultLanguage" in props && !locale) { // 判断props是否传参defaultLanguage
|
|
161
|
+
if ("defaultLanguage" in props && defaultLanguage && !locale) { // 判断props是否传参defaultLanguage
|
|
162
162
|
setLocale(defaultLanguage); // 存在defaultLanguage且无本地缓存,设置defaultLanguage
|
|
163
163
|
} else {
|
|
164
|
-
|
|
164
|
+
// 当前浏览器语言环境不在可用多语言中,默认使用中文
|
|
165
|
+
const temLanguage = languages.find(r => r === navigatorLanguage);
|
|
166
|
+
setLocale(localeStorageLang || getLangWithLangMp(temLanguage || "zh"));
|
|
165
167
|
}
|
|
166
168
|
}, [defaultLanguage]);
|
|
167
169
|
|