aldehyde 0.2.515 → 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/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/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,122 +1,122 @@
|
|
|
1
|
-
/* eslint-disable no-unused-expressions */
|
|
2
|
-
import React, { ReactNode, useEffect, useRef, useState } from 'react'
|
|
3
|
-
import debounce from "lodash/debounce";
|
|
4
|
-
import './index.less';
|
|
5
|
-
import { AdaptationType } from "../../interface";
|
|
6
|
-
|
|
7
|
-
interface ScreenFitProps {
|
|
8
|
-
children?: ReactNode,
|
|
9
|
-
width: number | string,
|
|
10
|
-
height: number | string,
|
|
11
|
-
bodyOverflowHidden?: boolean,
|
|
12
|
-
delay?: number,
|
|
13
|
-
mode?: AdaptationType,
|
|
14
|
-
scaleChange?: (xScale: number, yScale: number) => void,
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export default function ScreenFit(props: ScreenFitProps) {
|
|
19
|
-
const { width, height, bodyOverflowHidden = true, delay = 200, scaleChange } = props
|
|
20
|
-
let bodyOverflow: string
|
|
21
|
-
const elRef = useRef<HTMLDivElement>(null);
|
|
22
|
-
const canvasRef = useRef(null);
|
|
23
|
-
const [size, setSize] = useState({ width, height, originalHeight: 0, originalWidth: 0 })
|
|
24
|
-
|
|
25
|
-
let observer: ResizeObserver;
|
|
26
|
-
|
|
27
|
-
function updateSize() {
|
|
28
|
-
if (size.width && size.height) {
|
|
29
|
-
elRef.current.style.width = `${size.width}px`
|
|
30
|
-
elRef.current.style.height = `${size.height}px`
|
|
31
|
-
} else {
|
|
32
|
-
elRef.current.style.width = `${size.originalWidth}px`
|
|
33
|
-
elRef.current.style.height = `${size.originalHeight}px`
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function updateScale() {
|
|
38
|
-
// 获取真实视口尺寸
|
|
39
|
-
const currentWidth = canvasRef.current?.clientWidth || 0;
|
|
40
|
-
const currentHeight = canvasRef.current?.clientHeight || 0;
|
|
41
|
-
// 获取大屏最终的宽高
|
|
42
|
-
const realWidth = size.width || size.originalWidth;
|
|
43
|
-
const realHeight = size.height || size.originalHeight;
|
|
44
|
-
// 计算缩放比例
|
|
45
|
-
const widthScale = currentWidth / +realWidth;
|
|
46
|
-
const heightScale = currentHeight / +realHeight;
|
|
47
|
-
switch (props.mode) {
|
|
48
|
-
case 'full-screen':
|
|
49
|
-
// 若要铺满全屏,则按照各自比例缩放
|
|
50
|
-
elRef.current.style.transform = `scale(${widthScale},${heightScale})`;
|
|
51
|
-
scaleChange?.(widthScale, heightScale);
|
|
52
|
-
break;
|
|
53
|
-
case 'full-x':
|
|
54
|
-
elRef.current.style.transform = `scale(${widthScale})`;
|
|
55
|
-
canvasRef.current.style.height = `${Number(realHeight) * widthScale}px`;
|
|
56
|
-
scaleChange?.(widthScale, widthScale);
|
|
57
|
-
break;
|
|
58
|
-
case 'full-y':
|
|
59
|
-
elRef.current.style.transform = `scale(${heightScale})`;
|
|
60
|
-
canvasRef.current.style.width = `${Number(realWidth) * heightScale}px`;
|
|
61
|
-
scaleChange?.(heightScale, heightScale);
|
|
62
|
-
if (currentWidth > (+realWidth * heightScale)) {
|
|
63
|
-
elRef.current.style.margin = `0px ${(currentWidth - +realWidth * heightScale) / 2}px`;
|
|
64
|
-
} else {
|
|
65
|
-
elRef.current.style.margin = "0px";
|
|
66
|
-
}
|
|
67
|
-
break;
|
|
68
|
-
default:
|
|
69
|
-
// 按照宽高最小比例进行缩放
|
|
70
|
-
const scale = Math.min(widthScale, heightScale);
|
|
71
|
-
elRef.current.style.transform = `scale(${scale},${scale})`;
|
|
72
|
-
const domWidth = elRef.current.clientWidth;
|
|
73
|
-
const domHeight = elRef.current.clientHeight;
|
|
74
|
-
const mx = Math.max((currentWidth - domWidth * scale) / 2, 0);
|
|
75
|
-
const my = Math.max((currentHeight - domHeight * scale) / 2, 0);
|
|
76
|
-
elRef.current.style.margin = `${my}px ${mx}px`;
|
|
77
|
-
scaleChange?.(scale, scale);
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const onResize = debounce(() => {
|
|
83
|
-
if (!elRef.current && !canvasRef.current) return;
|
|
84
|
-
updateSize();
|
|
85
|
-
updateScale();
|
|
86
|
-
}, delay)
|
|
87
|
-
|
|
88
|
-
function initState() {
|
|
89
|
-
if (bodyOverflowHidden) {
|
|
90
|
-
bodyOverflow = document.body.style.overflow;
|
|
91
|
-
document.body.style.overflow = 'hidden';
|
|
92
|
-
}
|
|
93
|
-
observer = new ResizeObserver(() => onResize());
|
|
94
|
-
observer.observe(canvasRef.current);
|
|
95
|
-
setSize({
|
|
96
|
-
...size,
|
|
97
|
-
originalWidth: window.screen.width,
|
|
98
|
-
originalHeight: window.screen.height
|
|
99
|
-
})
|
|
100
|
-
updateSize();
|
|
101
|
-
updateScale();
|
|
102
|
-
window.addEventListener('resize', onResize);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
useEffect(() => {
|
|
106
|
-
initState();
|
|
107
|
-
return () => {
|
|
108
|
-
observer.disconnect();
|
|
109
|
-
window.removeEventListener('resize', onResize);
|
|
110
|
-
if (bodyOverflowHidden)
|
|
111
|
-
document.body.style.overflow = bodyOverflow;
|
|
112
|
-
}
|
|
113
|
-
}, [])
|
|
114
|
-
|
|
115
|
-
return (
|
|
116
|
-
<div ref={canvasRef} className={'react-screen-box'} >
|
|
117
|
-
<div className={'screen-wrapper'} ref={elRef}>
|
|
118
|
-
{props.children}
|
|
119
|
-
</div>
|
|
120
|
-
</div>
|
|
121
|
-
)
|
|
1
|
+
/* eslint-disable no-unused-expressions */
|
|
2
|
+
import React, { ReactNode, useEffect, useRef, useState } from 'react'
|
|
3
|
+
import debounce from "lodash/debounce";
|
|
4
|
+
import './index.less';
|
|
5
|
+
import { AdaptationType } from "../../interface";
|
|
6
|
+
|
|
7
|
+
interface ScreenFitProps {
|
|
8
|
+
children?: ReactNode,
|
|
9
|
+
width: number | string,
|
|
10
|
+
height: number | string,
|
|
11
|
+
bodyOverflowHidden?: boolean,
|
|
12
|
+
delay?: number,
|
|
13
|
+
mode?: AdaptationType,
|
|
14
|
+
scaleChange?: (xScale: number, yScale: number) => void,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export default function ScreenFit(props: ScreenFitProps) {
|
|
19
|
+
const { width, height, bodyOverflowHidden = true, delay = 200, scaleChange } = props
|
|
20
|
+
let bodyOverflow: string
|
|
21
|
+
const elRef = useRef<HTMLDivElement>(null);
|
|
22
|
+
const canvasRef = useRef(null);
|
|
23
|
+
const [size, setSize] = useState({ width, height, originalHeight: 0, originalWidth: 0 })
|
|
24
|
+
|
|
25
|
+
let observer: ResizeObserver;
|
|
26
|
+
|
|
27
|
+
function updateSize() {
|
|
28
|
+
if (size.width && size.height) {
|
|
29
|
+
elRef.current.style.width = `${size.width}px`
|
|
30
|
+
elRef.current.style.height = `${size.height}px`
|
|
31
|
+
} else {
|
|
32
|
+
elRef.current.style.width = `${size.originalWidth}px`
|
|
33
|
+
elRef.current.style.height = `${size.originalHeight}px`
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function updateScale() {
|
|
38
|
+
// 获取真实视口尺寸
|
|
39
|
+
const currentWidth = canvasRef.current?.clientWidth || 0;
|
|
40
|
+
const currentHeight = canvasRef.current?.clientHeight || 0;
|
|
41
|
+
// 获取大屏最终的宽高
|
|
42
|
+
const realWidth = size.width || size.originalWidth;
|
|
43
|
+
const realHeight = size.height || size.originalHeight;
|
|
44
|
+
// 计算缩放比例
|
|
45
|
+
const widthScale = currentWidth / +realWidth;
|
|
46
|
+
const heightScale = currentHeight / +realHeight;
|
|
47
|
+
switch (props.mode) {
|
|
48
|
+
case 'full-screen':
|
|
49
|
+
// 若要铺满全屏,则按照各自比例缩放
|
|
50
|
+
elRef.current.style.transform = `scale(${widthScale},${heightScale})`;
|
|
51
|
+
scaleChange?.(widthScale, heightScale);
|
|
52
|
+
break;
|
|
53
|
+
case 'full-x':
|
|
54
|
+
elRef.current.style.transform = `scale(${widthScale})`;
|
|
55
|
+
canvasRef.current.style.height = `${Number(realHeight) * widthScale}px`;
|
|
56
|
+
scaleChange?.(widthScale, widthScale);
|
|
57
|
+
break;
|
|
58
|
+
case 'full-y':
|
|
59
|
+
elRef.current.style.transform = `scale(${heightScale})`;
|
|
60
|
+
canvasRef.current.style.width = `${Number(realWidth) * heightScale}px`;
|
|
61
|
+
scaleChange?.(heightScale, heightScale);
|
|
62
|
+
if (currentWidth > (+realWidth * heightScale)) {
|
|
63
|
+
elRef.current.style.margin = `0px ${(currentWidth - +realWidth * heightScale) / 2}px`;
|
|
64
|
+
} else {
|
|
65
|
+
elRef.current.style.margin = "0px";
|
|
66
|
+
}
|
|
67
|
+
break;
|
|
68
|
+
default:
|
|
69
|
+
// 按照宽高最小比例进行缩放
|
|
70
|
+
const scale = Math.min(widthScale, heightScale);
|
|
71
|
+
elRef.current.style.transform = `scale(${scale},${scale})`;
|
|
72
|
+
const domWidth = elRef.current.clientWidth;
|
|
73
|
+
const domHeight = elRef.current.clientHeight;
|
|
74
|
+
const mx = Math.max((currentWidth - domWidth * scale) / 2, 0);
|
|
75
|
+
const my = Math.max((currentHeight - domHeight * scale) / 2, 0);
|
|
76
|
+
elRef.current.style.margin = `${my}px ${mx}px`;
|
|
77
|
+
scaleChange?.(scale, scale);
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const onResize = debounce(() => {
|
|
83
|
+
if (!elRef.current && !canvasRef.current) return;
|
|
84
|
+
updateSize();
|
|
85
|
+
updateScale();
|
|
86
|
+
}, delay)
|
|
87
|
+
|
|
88
|
+
function initState() {
|
|
89
|
+
if (bodyOverflowHidden) {
|
|
90
|
+
bodyOverflow = document.body.style.overflow;
|
|
91
|
+
document.body.style.overflow = 'hidden';
|
|
92
|
+
}
|
|
93
|
+
observer = new ResizeObserver(() => onResize());
|
|
94
|
+
observer.observe(canvasRef.current);
|
|
95
|
+
setSize({
|
|
96
|
+
...size,
|
|
97
|
+
originalWidth: window.screen.width,
|
|
98
|
+
originalHeight: window.screen.height
|
|
99
|
+
})
|
|
100
|
+
updateSize();
|
|
101
|
+
updateScale();
|
|
102
|
+
window.addEventListener('resize', onResize);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
initState();
|
|
107
|
+
return () => {
|
|
108
|
+
observer.disconnect();
|
|
109
|
+
window.removeEventListener('resize', onResize);
|
|
110
|
+
if (bodyOverflowHidden)
|
|
111
|
+
document.body.style.overflow = bodyOverflow;
|
|
112
|
+
}
|
|
113
|
+
}, [])
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<div ref={canvasRef} className={'react-screen-box'} >
|
|
117
|
+
<div className={'screen-wrapper'} ref={elRef}>
|
|
118
|
+
{props.children}
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
)
|
|
122
122
|
}
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
import React, { ForwardedRef, forwardRef, useMemo, useImperativeHandle, useState } from 'react';
|
|
3
|
-
import Units from "../../units/index";
|
|
4
|
-
import { useLocale } from "../../locale/useLocale";
|
|
5
|
-
|
|
6
|
-
const defStyle = {
|
|
7
|
-
color: '#9a9a9a',
|
|
8
|
-
height: '100%',
|
|
9
|
-
display: 'flex',
|
|
10
|
-
justifyContent: 'center',
|
|
11
|
-
alignItems: 'center',
|
|
12
|
-
border: '1px solid #9a9a9a',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export interface ComponentProps {
|
|
16
|
-
style: { key: string; compsIds?: string[]; },
|
|
17
|
-
isDesignMode?: boolean; // 是否编辑模式
|
|
18
|
-
initSearchParams?: { [key: string]: any }; // 全局初始化外部参数,例:传参包含设备id,则在查询时带上设备id
|
|
19
|
-
setSearchParams: (data: any) => void;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface CompImageonentRef {
|
|
23
|
-
updateConfig: (newConfig: ComponentProps) => void;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const PlaceholderComponent = forwardRef((props: ComponentProps, ref: ForwardedRef<CompImageonentRef>) => {
|
|
27
|
-
const { isDesignMode, setSearchParams, style } = props;
|
|
28
|
-
const { translate } = useLocale();
|
|
29
|
-
const [key, setKey] = useState<string>(style?.key);
|
|
30
|
-
const [initSearchParams, setInitSearchParams] = useState<{ [key: string]: any }>();
|
|
31
|
-
const [compsIds, setCompsIds] = useState<string[]>(style?.compsIds || []);
|
|
32
|
-
|
|
33
|
-
useImperativeHandle(ref, () => ({
|
|
34
|
-
updateConfig: (newConfig) => {
|
|
35
|
-
setKey(newConfig.style?.key);
|
|
36
|
-
setInitSearchParams(newConfig.initSearchParams || {});
|
|
37
|
-
setCompsIds(newConfig.style?.compsIds || []);
|
|
38
|
-
},
|
|
39
|
-
}));
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const handleParams = (params: { [key: string]: any }) => {
|
|
43
|
-
if (!compsIds?.length) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
setSearchParams(val => {
|
|
47
|
-
const temObj = {};
|
|
48
|
-
for (const compId of compsIds) {
|
|
49
|
-
if (val[compId]) { // 全局搜索参数中存在当前组件的搜索参数,则合并
|
|
50
|
-
val[compId] = { ...val[compId], ...params }
|
|
51
|
-
} else {
|
|
52
|
-
temObj[compId] = params;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
return { ...val, ...temObj };
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const renderComponent = useMemo(() => {
|
|
61
|
-
const temComponent = Units.getCustomComponent(key);
|
|
62
|
-
if (temComponent) {
|
|
63
|
-
return React.createElement(temComponent, { params: initSearchParams, handleParams });
|
|
64
|
-
}
|
|
65
|
-
return <div style={defStyle}>{translate("${没有找到自定义组件}")}</div>;
|
|
66
|
-
}, [key, initSearchParams]);
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<div style={{ width: '100%', height: '100%' }}>
|
|
70
|
-
{isDesignMode || !key ?
|
|
71
|
-
<div style={defStyle}>
|
|
72
|
-
<div>{translate("${占位组件}")}</div>
|
|
73
|
-
</div> :
|
|
74
|
-
<div style={{ width: '100%', height: '100%', overflow: "auto" }}>
|
|
75
|
-
{renderComponent}
|
|
76
|
-
</div>
|
|
77
|
-
}
|
|
78
|
-
</div>
|
|
79
|
-
);
|
|
80
|
-
});
|
|
81
|
-
|
|
1
|
+
|
|
2
|
+
import React, { ForwardedRef, forwardRef, useMemo, useImperativeHandle, useState } from 'react';
|
|
3
|
+
import Units from "../../units/index";
|
|
4
|
+
import { useLocale } from "../../locale/useLocale";
|
|
5
|
+
|
|
6
|
+
const defStyle = {
|
|
7
|
+
color: '#9a9a9a',
|
|
8
|
+
height: '100%',
|
|
9
|
+
display: 'flex',
|
|
10
|
+
justifyContent: 'center',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
border: '1px solid #9a9a9a',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export interface ComponentProps {
|
|
16
|
+
style: { key: string; compsIds?: string[]; },
|
|
17
|
+
isDesignMode?: boolean; // 是否编辑模式
|
|
18
|
+
initSearchParams?: { [key: string]: any }; // 全局初始化外部参数,例:传参包含设备id,则在查询时带上设备id
|
|
19
|
+
setSearchParams: (data: any) => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface CompImageonentRef {
|
|
23
|
+
updateConfig: (newConfig: ComponentProps) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const PlaceholderComponent = forwardRef((props: ComponentProps, ref: ForwardedRef<CompImageonentRef>) => {
|
|
27
|
+
const { isDesignMode, setSearchParams, style } = props;
|
|
28
|
+
const { translate } = useLocale();
|
|
29
|
+
const [key, setKey] = useState<string>(style?.key);
|
|
30
|
+
const [initSearchParams, setInitSearchParams] = useState<{ [key: string]: any }>();
|
|
31
|
+
const [compsIds, setCompsIds] = useState<string[]>(style?.compsIds || []);
|
|
32
|
+
|
|
33
|
+
useImperativeHandle(ref, () => ({
|
|
34
|
+
updateConfig: (newConfig) => {
|
|
35
|
+
setKey(newConfig.style?.key);
|
|
36
|
+
setInitSearchParams(newConfig.initSearchParams || {});
|
|
37
|
+
setCompsIds(newConfig.style?.compsIds || []);
|
|
38
|
+
},
|
|
39
|
+
}));
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
const handleParams = (params: { [key: string]: any }) => {
|
|
43
|
+
if (!compsIds?.length) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
setSearchParams(val => {
|
|
47
|
+
const temObj = {};
|
|
48
|
+
for (const compId of compsIds) {
|
|
49
|
+
if (val[compId]) { // 全局搜索参数中存在当前组件的搜索参数,则合并
|
|
50
|
+
val[compId] = { ...val[compId], ...params }
|
|
51
|
+
} else {
|
|
52
|
+
temObj[compId] = params;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
return { ...val, ...temObj };
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
const renderComponent = useMemo(() => {
|
|
61
|
+
const temComponent = Units.getCustomComponent(key);
|
|
62
|
+
if (temComponent) {
|
|
63
|
+
return React.createElement(temComponent, { params: initSearchParams, handleParams });
|
|
64
|
+
}
|
|
65
|
+
return <div style={defStyle}>{translate("${没有找到自定义组件}")}</div>;
|
|
66
|
+
}, [key, initSearchParams]);
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<div style={{ width: '100%', height: '100%' }}>
|
|
70
|
+
{isDesignMode || !key ?
|
|
71
|
+
<div style={defStyle}>
|
|
72
|
+
<div>{translate("${占位组件}")}</div>
|
|
73
|
+
</div> :
|
|
74
|
+
<div style={{ width: '100%', height: '100%', overflow: "auto" }}>
|
|
75
|
+
{renderComponent}
|
|
76
|
+
</div>
|
|
77
|
+
}
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
82
|
export default PlaceholderComponent;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
.text-scroller-container {
|
|
2
|
-
--speed: 10s;
|
|
3
|
-
--container-width: 320px;
|
|
4
|
-
|
|
5
|
-
width: 100%;
|
|
6
|
-
height: 100%;
|
|
7
|
-
overflow: hidden;
|
|
8
|
-
white-space: nowrap;
|
|
9
|
-
position: relative;
|
|
10
|
-
|
|
11
|
-
.text-scroller {
|
|
12
|
-
height: inherit;
|
|
13
|
-
position: absolute;
|
|
14
|
-
color: white;
|
|
15
|
-
animation: scrollText var(--speed) linear infinite;
|
|
16
|
-
display: flex;
|
|
17
|
-
align-items: center;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@keyframes scrollText {
|
|
21
|
-
0% {
|
|
22
|
-
transform: translateX(var(--container-width));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
100% {
|
|
26
|
-
transform: translateX(-100%);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
1
|
+
.text-scroller-container {
|
|
2
|
+
--speed: 10s;
|
|
3
|
+
--container-width: 320px;
|
|
4
|
+
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
white-space: nowrap;
|
|
9
|
+
position: relative;
|
|
10
|
+
|
|
11
|
+
.text-scroller {
|
|
12
|
+
height: inherit;
|
|
13
|
+
position: absolute;
|
|
14
|
+
color: white;
|
|
15
|
+
animation: scrollText var(--speed) linear infinite;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@keyframes scrollText {
|
|
21
|
+
0% {
|
|
22
|
+
transform: translateX(var(--container-width));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
100% {
|
|
26
|
+
transform: translateX(-100%);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
29
|
}
|