aldehyde 0.2.527 → 0.2.528
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/entity-select/entity-select.d.ts.map +1 -1
- package/lib/controls/entity-select/entity-select.js +3 -3
- package/lib/controls/entity-select/entity-select.js.map +1 -1
- package/lib/controls/entity-select/index.css +6 -0
- package/lib/controls/icon-selector/icon/phonenode-menu-icon/iconfont.css +99 -99
- 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/icon/local-aliIcon/iconfont.js +1 -1
- package/lib/icon/local-aliIcon/iconfont.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/heatmap-chart/index.d.ts +42 -0
- package/lib/lowcode-components/heatmap-chart/index.d.ts.map +1 -0
- package/lib/lowcode-components/heatmap-chart/index.js +326 -0
- package/lib/lowcode-components/heatmap-chart/index.js.map +1 -0
- package/lib/lowcode-components/index.d.ts +2 -0
- package/lib/lowcode-components/index.d.ts.map +1 -1
- package/lib/lowcode-components/index.js +2 -1
- package/lib/lowcode-components/index.js.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/assets.d.ts.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/assets.js +8 -0
- package/lib/lowcode-components/lowcode-view/component/assets.js.map +1 -1
- 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/dtmpl-edit-card.d.ts.map +1 -1
- package/lib/module/dtmpl-edit-card.js +2 -6
- package/lib/module/dtmpl-edit-card.js.map +1 -1
- package/lib/module/dtmpl-edit-page.d.ts.map +1 -1
- package/lib/module/dtmpl-edit-page.js +2 -6
- package/lib/module/dtmpl-edit-page.js.map +1 -1
- package/lib/module/ttmpl-table.d.ts +3 -0
- package/lib/module/ttmpl-table.d.ts.map +1 -1
- package/lib/module/ttmpl-table.js +15 -8
- package/lib/module/ttmpl-table.js.map +1 -1
- package/lib/routable/ttmpl-table-route.d.ts.map +1 -1
- package/lib/routable/ttmpl-table-route.js +32 -7
- package/lib/routable/ttmpl-table-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 +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 +20 -4
- package/lib/table/column/column-builder.js.map +1 -1
- package/lib/table/relation-table.js +1 -1
- package/lib/table/relation-table.js.map +1 -1
- package/lib/tmpl/hc-data-source.d.ts +1 -0
- package/lib/tmpl/hc-data-source.d.ts.map +1 -1
- package/lib/tmpl/hc-data-source.js +11 -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 +7 -0
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/controls/entity-select/entity-select.tsx +4 -5
- package/src/aldehyde/controls/entity-select/index.css +6 -0
- 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/icon/local-aliIcon/iconfont.js +1 -1
- 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/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/heatmap-chart/index.tsx +362 -0
- package/src/aldehyde/lowcode-components/index.ts +4 -2
- 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/assets.ts +8 -0
- 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/dtmpl-edit-card.tsx +2 -6
- package/src/aldehyde/module/dtmpl-edit-page.tsx +2 -6
- package/src/aldehyde/module/ttmpl-table.tsx +25 -7
- package/src/aldehyde/routable/ttmpl-table-route.tsx +37 -7
- package/src/aldehyde/table/act-table.tsx +4 -2
- package/src/aldehyde/table/column/column-builder.tsx +30 -5
- package/src/aldehyde/table/relation-table.tsx +1 -1
- package/src/aldehyde/tmpl/hc-data-source.tsx +11 -0
- package/src/aldehyde/tmpl/hcservice-v3.tsx +11 -0
- package/src/aldehyde/tmpl/interface.tsx +3 -1
|
@@ -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
|
}
|
|
@@ -1,174 +1,174 @@
|
|
|
1
|
-
import React, { forwardRef, ForwardedRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
2
|
-
import './index.less';
|
|
3
|
-
import _ from "lodash";
|
|
4
|
-
import { useLocale } from "../../locale/useLocale";
|
|
5
|
-
import HydrocarbonService from "../../tmpl/hcservice-v3";
|
|
6
|
-
import { DataConfigProps } from "../data";
|
|
7
|
-
|
|
8
|
-
// 处理数据格式
|
|
9
|
-
const handleData = (data: { config: { [key: string]: string }, value: { [key: string]: any }[] }[]) => {
|
|
10
|
-
const temData = data?.[0]?.value?.[0]?.v1;
|
|
11
|
-
return temData;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface ComponentStyle {
|
|
15
|
-
speed?: number;
|
|
16
|
-
fontSize?: number;
|
|
17
|
-
color?: string;
|
|
18
|
-
fontFamily?: string;
|
|
19
|
-
fontWeight?: number;
|
|
20
|
-
defaultValue?: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface ComponentProps {
|
|
24
|
-
style?: ComponentStyle;
|
|
25
|
-
data?: DataConfigProps;
|
|
26
|
-
isDesignMode?: boolean; // 是否编辑模式
|
|
27
|
-
initSearchParams?: { [key: string]: any }; // 全局初始化外部参数,例:传参包含设备id,则在查询时带上设备id
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface ComponentRef {
|
|
31
|
-
updateConfig: (newConfig: ComponentProps) => void;
|
|
32
|
-
destroy: () => void;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>) => {
|
|
36
|
-
const { style, data: propsData, isDesignMode } = props;
|
|
37
|
-
const [config, setConfig] = useState<ComponentStyle>(style || {});
|
|
38
|
-
const [speed, setSpeed] = useState<number>(style?.speed || 5);
|
|
39
|
-
const [dataConfig, setDataConfig] = useState<DataConfigProps>({ ...propsData }); // 数据源配置
|
|
40
|
-
const [data, setData] = useState<string>('');
|
|
41
|
-
const [searchParams, setSearchParams] = useState<{ [key: string]: any }>();
|
|
42
|
-
const [initSearchParams, setInitSearchParams] = useState<{ [key: string]: any }>();
|
|
43
|
-
const textScrollerRef = useRef<HTMLDivElement>(null);
|
|
44
|
-
const textContainerRef = useRef<HTMLDivElement>(null);
|
|
45
|
-
const resizeObserverRef = useRef<ResizeObserver | null>(null);
|
|
46
|
-
const pollingIntervalRef = useRef<number | NodeJS.Timeout>(null);
|
|
47
|
-
const { translate } = useLocale();
|
|
48
|
-
|
|
49
|
-
const handleDestroy = () => {
|
|
50
|
-
resizeObserverRef.current && resizeObserverRef.current.disconnect();
|
|
51
|
-
pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
// 全局初始化请求数据处理
|
|
55
|
-
const handleInitData = (val: DataConfigProps) => {
|
|
56
|
-
if (val.sourceType === "sourceId" && val.isInit && val.initData) {
|
|
57
|
-
const { config, value } = val.initData;
|
|
58
|
-
const temData = handleData(value);
|
|
59
|
-
setData(temData);
|
|
60
|
-
if (config?.requestMode === "polling") {
|
|
61
|
-
pollingIntervalRef.current = setInterval(() => { getData() }, config?.pollingInterval || 60000);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// ws订阅数据更新
|
|
67
|
-
const handleWSData = (val: DataConfigProps) => {
|
|
68
|
-
if (val.sourceType === "sourceId" && val.wsData) {
|
|
69
|
-
const { value } = val.initData;
|
|
70
|
-
const temData = handleData(value);
|
|
71
|
-
setData(temData);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
useImperativeHandle(ref, () => ({
|
|
76
|
-
updateConfig: (newConfig) => {
|
|
77
|
-
const { style: newStyle, data: newDataConfig, initSearchParams: newISParams } = newConfig;
|
|
78
|
-
setConfig({ ...(newStyle || {}) });
|
|
79
|
-
setSpeed(newStyle?.speed || 5);
|
|
80
|
-
setDataConfig({ ...newDataConfig });
|
|
81
|
-
handleInitData(newDataConfig);
|
|
82
|
-
setSearchParams(newDataConfig.searchParams);
|
|
83
|
-
setInitSearchParams(newISParams);
|
|
84
|
-
handleWSData(newDataConfig);
|
|
85
|
-
},
|
|
86
|
-
destroy: handleDestroy,
|
|
87
|
-
}));
|
|
88
|
-
|
|
89
|
-
useEffect(() => {
|
|
90
|
-
if (textContainerRef.current) {
|
|
91
|
-
resizeObserverRef.current = new ResizeObserver(_.debounce((entries) => {
|
|
92
|
-
for (const entry of entries) {
|
|
93
|
-
const { width } = entry.contentRect;
|
|
94
|
-
textContainerRef.current.style.setProperty('--container-width', `${width}px`);
|
|
95
|
-
}
|
|
96
|
-
}, 100));
|
|
97
|
-
// 开始观察
|
|
98
|
-
resizeObserverRef.current.observe(textContainerRef.current);
|
|
99
|
-
}
|
|
100
|
-
return () => {
|
|
101
|
-
handleDestroy();
|
|
102
|
-
}
|
|
103
|
-
}, []);
|
|
104
|
-
|
|
105
|
-
useEffect(() => {
|
|
106
|
-
if (textContainerRef.current) {
|
|
107
|
-
textContainerRef.current.style.setProperty('--speed', `${speed || 5}s`);
|
|
108
|
-
}
|
|
109
|
-
}, [speed]);
|
|
110
|
-
|
|
111
|
-
// 请求数据
|
|
112
|
-
const getData = async (params?: object) => {
|
|
113
|
-
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId, params) || {};
|
|
114
|
-
const { config, value } = data || {};
|
|
115
|
-
const temData = handleData(value);
|
|
116
|
-
setData(temData);
|
|
117
|
-
return config;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
// 初始化请求数据
|
|
121
|
-
const getInitData = async (params?: object) => {
|
|
122
|
-
pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
|
|
123
|
-
const config = await getData(params);
|
|
124
|
-
if (config?.requestMode === "polling") {
|
|
125
|
-
pollingIntervalRef.current = setInterval(() => getData(params), config?.pollingInterval || 60000);
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
// 静态数据处理
|
|
130
|
-
useEffect(() => {
|
|
131
|
-
if (dataConfig?.sourceType === 'staticData') {
|
|
132
|
-
const { value } = dataConfig.staticData || {};
|
|
133
|
-
setData(value);
|
|
134
|
-
}
|
|
135
|
-
}, [dataConfig?.sourceType, dataConfig?.staticData]);
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* 数据源数据请求
|
|
139
|
-
* 1、编辑态不请求数据
|
|
140
|
-
*/
|
|
141
|
-
useEffect(() => {
|
|
142
|
-
if (!isDesignMode && dataConfig?.sourceType === 'sourceId' && dataConfig?.sourceId && !dataConfig?.isInit && dataConfig?.isDefRequest !== false) {
|
|
143
|
-
if (dataConfig?.isInitParams) { // 组件数据源接收外部参数
|
|
144
|
-
initSearchParams && getInitData(initSearchParams);
|
|
145
|
-
} else {
|
|
146
|
-
getInitData();
|
|
147
|
-
}
|
|
148
|
-
} else if (dataConfig?.sourceType === 'sourceId') {
|
|
149
|
-
setData("文本跑马灯");
|
|
150
|
-
}
|
|
151
|
-
}, [dataConfig?.sourceType, dataConfig?.sourceId, initSearchParams]);
|
|
152
|
-
|
|
153
|
-
// 搜索参数变化时重新请求数据
|
|
154
|
-
useEffect(() => {
|
|
155
|
-
if (searchParams) {
|
|
156
|
-
const params = { ...(initSearchParams || {}), ...searchParams };
|
|
157
|
-
if (dataConfig?.isInitParams) { // 数据源接收外部参数,则参数存在再请求
|
|
158
|
-
initSearchParams && getInitData(params);
|
|
159
|
-
} else {
|
|
160
|
-
getInitData(params);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}, [searchParams, initSearchParams]);
|
|
164
|
-
|
|
165
|
-
return (
|
|
166
|
-
<div className="text-scroller-container" ref={textContainerRef}>
|
|
167
|
-
<div className="text-scroller" style={{ ...config }} ref={textScrollerRef}>
|
|
168
|
-
{translate("${" + data + "}")}
|
|
169
|
-
</div>
|
|
170
|
-
</div>
|
|
171
|
-
);
|
|
172
|
-
});
|
|
173
|
-
|
|
1
|
+
import React, { forwardRef, ForwardedRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
import _ from "lodash";
|
|
4
|
+
import { useLocale } from "../../locale/useLocale";
|
|
5
|
+
import HydrocarbonService from "../../tmpl/hcservice-v3";
|
|
6
|
+
import { DataConfigProps } from "../data";
|
|
7
|
+
|
|
8
|
+
// 处理数据格式
|
|
9
|
+
const handleData = (data: { config: { [key: string]: string }, value: { [key: string]: any }[] }[]) => {
|
|
10
|
+
const temData = data?.[0]?.value?.[0]?.v1;
|
|
11
|
+
return temData;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface ComponentStyle {
|
|
15
|
+
speed?: number;
|
|
16
|
+
fontSize?: number;
|
|
17
|
+
color?: string;
|
|
18
|
+
fontFamily?: string;
|
|
19
|
+
fontWeight?: number;
|
|
20
|
+
defaultValue?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ComponentProps {
|
|
24
|
+
style?: ComponentStyle;
|
|
25
|
+
data?: DataConfigProps;
|
|
26
|
+
isDesignMode?: boolean; // 是否编辑模式
|
|
27
|
+
initSearchParams?: { [key: string]: any }; // 全局初始化外部参数,例:传参包含设备id,则在查询时带上设备id
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ComponentRef {
|
|
31
|
+
updateConfig: (newConfig: ComponentProps) => void;
|
|
32
|
+
destroy: () => void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>) => {
|
|
36
|
+
const { style, data: propsData, isDesignMode } = props;
|
|
37
|
+
const [config, setConfig] = useState<ComponentStyle>(style || {});
|
|
38
|
+
const [speed, setSpeed] = useState<number>(style?.speed || 5);
|
|
39
|
+
const [dataConfig, setDataConfig] = useState<DataConfigProps>({ ...propsData }); // 数据源配置
|
|
40
|
+
const [data, setData] = useState<string>('');
|
|
41
|
+
const [searchParams, setSearchParams] = useState<{ [key: string]: any }>();
|
|
42
|
+
const [initSearchParams, setInitSearchParams] = useState<{ [key: string]: any }>();
|
|
43
|
+
const textScrollerRef = useRef<HTMLDivElement>(null);
|
|
44
|
+
const textContainerRef = useRef<HTMLDivElement>(null);
|
|
45
|
+
const resizeObserverRef = useRef<ResizeObserver | null>(null);
|
|
46
|
+
const pollingIntervalRef = useRef<number | NodeJS.Timeout>(null);
|
|
47
|
+
const { translate } = useLocale();
|
|
48
|
+
|
|
49
|
+
const handleDestroy = () => {
|
|
50
|
+
resizeObserverRef.current && resizeObserverRef.current.disconnect();
|
|
51
|
+
pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// 全局初始化请求数据处理
|
|
55
|
+
const handleInitData = (val: DataConfigProps) => {
|
|
56
|
+
if (val.sourceType === "sourceId" && val.isInit && val.initData) {
|
|
57
|
+
const { config, value } = val.initData;
|
|
58
|
+
const temData = handleData(value);
|
|
59
|
+
setData(temData);
|
|
60
|
+
if (config?.requestMode === "polling") {
|
|
61
|
+
pollingIntervalRef.current = setInterval(() => { getData() }, config?.pollingInterval || 60000);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// ws订阅数据更新
|
|
67
|
+
const handleWSData = (val: DataConfigProps) => {
|
|
68
|
+
if (val.sourceType === "sourceId" && val.wsData) {
|
|
69
|
+
const { value } = val.initData;
|
|
70
|
+
const temData = handleData(value);
|
|
71
|
+
setData(temData);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
useImperativeHandle(ref, () => ({
|
|
76
|
+
updateConfig: (newConfig) => {
|
|
77
|
+
const { style: newStyle, data: newDataConfig, initSearchParams: newISParams } = newConfig;
|
|
78
|
+
setConfig({ ...(newStyle || {}) });
|
|
79
|
+
setSpeed(newStyle?.speed || 5);
|
|
80
|
+
setDataConfig({ ...newDataConfig });
|
|
81
|
+
handleInitData(newDataConfig);
|
|
82
|
+
setSearchParams(newDataConfig.searchParams);
|
|
83
|
+
setInitSearchParams(newISParams);
|
|
84
|
+
handleWSData(newDataConfig);
|
|
85
|
+
},
|
|
86
|
+
destroy: handleDestroy,
|
|
87
|
+
}));
|
|
88
|
+
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (textContainerRef.current) {
|
|
91
|
+
resizeObserverRef.current = new ResizeObserver(_.debounce((entries) => {
|
|
92
|
+
for (const entry of entries) {
|
|
93
|
+
const { width } = entry.contentRect;
|
|
94
|
+
textContainerRef.current.style.setProperty('--container-width', `${width}px`);
|
|
95
|
+
}
|
|
96
|
+
}, 100));
|
|
97
|
+
// 开始观察
|
|
98
|
+
resizeObserverRef.current.observe(textContainerRef.current);
|
|
99
|
+
}
|
|
100
|
+
return () => {
|
|
101
|
+
handleDestroy();
|
|
102
|
+
}
|
|
103
|
+
}, []);
|
|
104
|
+
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
if (textContainerRef.current) {
|
|
107
|
+
textContainerRef.current.style.setProperty('--speed', `${speed || 5}s`);
|
|
108
|
+
}
|
|
109
|
+
}, [speed]);
|
|
110
|
+
|
|
111
|
+
// 请求数据
|
|
112
|
+
const getData = async (params?: object) => {
|
|
113
|
+
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId, params) || {};
|
|
114
|
+
const { config, value } = data || {};
|
|
115
|
+
const temData = handleData(value);
|
|
116
|
+
setData(temData);
|
|
117
|
+
return config;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// 初始化请求数据
|
|
121
|
+
const getInitData = async (params?: object) => {
|
|
122
|
+
pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
|
|
123
|
+
const config = await getData(params);
|
|
124
|
+
if (config?.requestMode === "polling") {
|
|
125
|
+
pollingIntervalRef.current = setInterval(() => getData(params), config?.pollingInterval || 60000);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// 静态数据处理
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
if (dataConfig?.sourceType === 'staticData') {
|
|
132
|
+
const { value } = dataConfig.staticData || {};
|
|
133
|
+
setData(value);
|
|
134
|
+
}
|
|
135
|
+
}, [dataConfig?.sourceType, dataConfig?.staticData]);
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* 数据源数据请求
|
|
139
|
+
* 1、编辑态不请求数据
|
|
140
|
+
*/
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
if (!isDesignMode && dataConfig?.sourceType === 'sourceId' && dataConfig?.sourceId && !dataConfig?.isInit && dataConfig?.isDefRequest !== false) {
|
|
143
|
+
if (dataConfig?.isInitParams) { // 组件数据源接收外部参数
|
|
144
|
+
initSearchParams && getInitData(initSearchParams);
|
|
145
|
+
} else {
|
|
146
|
+
getInitData();
|
|
147
|
+
}
|
|
148
|
+
} else if (dataConfig?.sourceType === 'sourceId') {
|
|
149
|
+
setData("文本跑马灯");
|
|
150
|
+
}
|
|
151
|
+
}, [dataConfig?.sourceType, dataConfig?.sourceId, initSearchParams]);
|
|
152
|
+
|
|
153
|
+
// 搜索参数变化时重新请求数据
|
|
154
|
+
useEffect(() => {
|
|
155
|
+
if (searchParams) {
|
|
156
|
+
const params = { ...(initSearchParams || {}), ...searchParams };
|
|
157
|
+
if (dataConfig?.isInitParams) { // 数据源接收外部参数,则参数存在再请求
|
|
158
|
+
initSearchParams && getInitData(params);
|
|
159
|
+
} else {
|
|
160
|
+
getInitData(params);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}, [searchParams, initSearchParams]);
|
|
164
|
+
|
|
165
|
+
return (
|
|
166
|
+
<div className="text-scroller-container" ref={textContainerRef}>
|
|
167
|
+
<div className="text-scroller" style={{ ...config }} ref={textScrollerRef}>
|
|
168
|
+
{translate("${" + data + "}")}
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
);
|
|
172
|
+
});
|
|
173
|
+
|
|
174
174
|
export default Index;
|
|
@@ -79,7 +79,6 @@ export default class DtmplEditCard extends React.PureComponent<
|
|
|
79
79
|
if (prevProps.sourceId != this.props.sourceId || dtmplConfig == null || (!this.props.code && prevProps.code)) {
|
|
80
80
|
await this.loadConfigData();
|
|
81
81
|
} else if (prevProps.sourceId != this.props.sourceId || queryingCode != code || !dtmplData) {
|
|
82
|
-
await this.handleBuildInFuncFields(dtmplConfig);
|
|
83
82
|
//防止反复请求 code
|
|
84
83
|
if (code) {
|
|
85
84
|
await this.loadCodeData(dtmplConfig, code);
|
|
@@ -115,7 +114,6 @@ export default class DtmplEditCard extends React.PureComponent<
|
|
|
115
114
|
addTmplId
|
|
116
115
|
);
|
|
117
116
|
}
|
|
118
|
-
await this.handleBuildInFuncFields(dtmplConfig);
|
|
119
117
|
this.handleRelValueField(dtmplConfig);
|
|
120
118
|
if (dtmplConfig.entity) {
|
|
121
119
|
let dtmplData = dtmplConfig.entity;
|
|
@@ -125,12 +123,10 @@ export default class DtmplEditCard extends React.PureComponent<
|
|
|
125
123
|
} else {
|
|
126
124
|
this.setState({ queryingCode: code, dtmplData, dtmplConfig, loading: false });
|
|
127
125
|
}
|
|
126
|
+
setTimeout(() => this.handleBuildInFuncFields(dtmplConfig), 300);
|
|
128
127
|
} else {
|
|
129
128
|
await this.loadData(dtmplConfig);
|
|
130
|
-
this.setState({
|
|
131
|
-
dtmplConfig,
|
|
132
|
-
loading: false,
|
|
133
|
-
});
|
|
129
|
+
this.setState({ dtmplConfig, loading: false });
|
|
134
130
|
}
|
|
135
131
|
};
|
|
136
132
|
|
|
@@ -121,7 +121,6 @@ export default class DtmplEditPage extends React.PureComponent<
|
|
|
121
121
|
) {
|
|
122
122
|
await this.loadConfigData();
|
|
123
123
|
} else {
|
|
124
|
-
await this.handleBuildInFuncFields(dtmplConfig);
|
|
125
124
|
await this.loadData(dtmplConfig);
|
|
126
125
|
}
|
|
127
126
|
}
|
|
@@ -153,7 +152,6 @@ export default class DtmplEditPage extends React.PureComponent<
|
|
|
153
152
|
);
|
|
154
153
|
}
|
|
155
154
|
this.handleRelValueField(dtmplConfig);
|
|
156
|
-
await this.handleBuildInFuncFields(dtmplConfig);
|
|
157
155
|
// 直接复制
|
|
158
156
|
if (dtmplConfig?.entity && dtmplConfig?.entity?.code == code) {
|
|
159
157
|
let dtmplData = dtmplConfig.entity;
|
|
@@ -163,13 +161,11 @@ export default class DtmplEditPage extends React.PureComponent<
|
|
|
163
161
|
} else {
|
|
164
162
|
this.setState({ dtmplData, id: code, loading: false });
|
|
165
163
|
}
|
|
164
|
+
setTimeout(() => this.handleBuildInFuncFields(), 300);
|
|
166
165
|
} else {
|
|
167
166
|
await this.loadData(dtmplConfig);
|
|
168
167
|
}
|
|
169
|
-
this.setState({
|
|
170
|
-
dtmplConfig,
|
|
171
|
-
loading: false,
|
|
172
|
-
});
|
|
168
|
+
this.setState({ dtmplConfig, loading: false });
|
|
173
169
|
};
|
|
174
170
|
|
|
175
171
|
// 表单关联项secondCriterion处理start
|
|
@@ -48,6 +48,9 @@ export interface TtmplTableProps {
|
|
|
48
48
|
bordered?: boolean; // 表格是否显示边框
|
|
49
49
|
showHeader?: boolean; // 表格是否显示表头
|
|
50
50
|
ettmplConfig?: EttmplConfig; // 展开树配置
|
|
51
|
+
ettmplRootSourceId?: string; // 展开树配置根 sourceId
|
|
52
|
+
isRecursion?: boolean; // 是否递归
|
|
53
|
+
recursionSourceId?: string; // 递归 sourceId
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
const TtmplTable = (props: TtmplTableProps) => {
|
|
@@ -80,7 +83,8 @@ const TtmplTable = (props: TtmplTableProps) => {
|
|
|
80
83
|
hideOnSinglePage,
|
|
81
84
|
bordered,
|
|
82
85
|
showHeader,
|
|
83
|
-
ettmplConfig: pEttmplConfig
|
|
86
|
+
ettmplConfig: pEttmplConfig,
|
|
87
|
+
ettmplRootSourceId, isRecursion = false, recursionSourceId
|
|
84
88
|
} = props;
|
|
85
89
|
const { translate } = useContext(LocaleContext);
|
|
86
90
|
const [ltmplConfigRes, setLtmplConfigRes] = useState<LtmplConfigRes>();
|
|
@@ -99,6 +103,7 @@ const TtmplTable = (props: TtmplTableProps) => {
|
|
|
99
103
|
const [drawerSize, setDrawerSize] = useState<number | string>("92vw"); // 抽屉组件
|
|
100
104
|
const [isCopy, setIsCopy] = useState<boolean>(false); // 是否复制
|
|
101
105
|
const [ettmplConfig, setEttmplConfig] = useState<EttmplConfig>(pEttmplConfig); // 展开树配置
|
|
106
|
+
const [treeAddData, setTreeAddData] = useState<{ [key: string]: any }>(); // 展开树添加递归及关联关系配置
|
|
102
107
|
const { token } = useToken();
|
|
103
108
|
|
|
104
109
|
const toCriteriaData = (values: object) => {
|
|
@@ -113,11 +118,11 @@ const TtmplTable = (props: TtmplTableProps) => {
|
|
|
113
118
|
};
|
|
114
119
|
|
|
115
120
|
const loadLtmplConfig = async () => {
|
|
116
|
-
const res: LtmplConfigRes = await HCDataSource.requestLtmplConfig(serverKey, sourceId);
|
|
117
121
|
if (!pEttmplConfig) {
|
|
118
122
|
const ettmplConfig_: EttmplConfig = await HCDataSource.requestEttmplConfig(serverKey, sourceId);
|
|
119
123
|
setEttmplConfig(ettmplConfig_);
|
|
120
124
|
}
|
|
125
|
+
const res: LtmplConfigRes = await HCDataSource.requestEttmplLtmplConfig(serverKey, ettmplRootSourceId, isRecursion ? recursionSourceId : sourceId);
|
|
121
126
|
let criteriaData_: object;
|
|
122
127
|
let defCriteriaValue = {};
|
|
123
128
|
//提取 过滤条件的默认值
|
|
@@ -191,6 +196,14 @@ const TtmplTable = (props: TtmplTableProps) => {
|
|
|
191
196
|
}
|
|
192
197
|
};
|
|
193
198
|
|
|
199
|
+
|
|
200
|
+
// 展开树行操作添加按钮
|
|
201
|
+
const doAddRaction = (ractionId: string, mainCode: string) => {
|
|
202
|
+
setSelectedCode(null);
|
|
203
|
+
setShowDtmplEdit(true);
|
|
204
|
+
setTreeAddData({ ractionId, mainCode });
|
|
205
|
+
}
|
|
206
|
+
|
|
194
207
|
const doSearch = (params_?: object) => {
|
|
195
208
|
let params = { ...(criteriaData || {}), ...params_ };
|
|
196
209
|
//追加过滤条件,hiddenColIds,innerQueryKey
|
|
@@ -222,11 +235,14 @@ const TtmplTable = (props: TtmplTableProps) => {
|
|
|
222
235
|
|
|
223
236
|
// 嵌套表格配置
|
|
224
237
|
const expandedRowRender = (val: { [key: string]: any }) => {
|
|
225
|
-
const { subNodes, recursiveRatmplId } = ettmplConfig;
|
|
238
|
+
const { subNodes, recursiveRatmplId, sourceId: ettmplSourceId } = ettmplConfig;
|
|
226
239
|
return <div style={{ marginLeft: "24px", background: token.colorBgContainer }}>
|
|
227
240
|
{recursiveRatmplId ?
|
|
228
241
|
<TtmplTable
|
|
242
|
+
isRecursion={true}
|
|
243
|
+
recursionSourceId={ettmplSourceId}
|
|
229
244
|
ettmplConfig={ettmplConfig}
|
|
245
|
+
ettmplRootSourceId={ettmplRootSourceId}
|
|
230
246
|
hideOnSinglePage={true}
|
|
231
247
|
funcMode="simple"
|
|
232
248
|
serverKey={serverKey}
|
|
@@ -237,6 +253,7 @@ const TtmplTable = (props: TtmplTableProps) => {
|
|
|
237
253
|
{subNodes.length > 1 ? <h4 style={{ padding: "12px 0 0 12px" }}>{item.title}</h4> : ""}
|
|
238
254
|
<TtmplTable
|
|
239
255
|
ettmplConfig={item}
|
|
256
|
+
ettmplRootSourceId={ettmplRootSourceId}
|
|
240
257
|
hideOnSinglePage={true}
|
|
241
258
|
funcMode="simple"
|
|
242
259
|
serverKey={serverKey}
|
|
@@ -283,6 +300,7 @@ const TtmplTable = (props: TtmplTableProps) => {
|
|
|
283
300
|
showHeader={showHeader}
|
|
284
301
|
expandable={(subNodes?.length || recursiveRatmplId) ? { expandedRowRender } : undefined} // 嵌套表格
|
|
285
302
|
showEmpty={false}
|
|
303
|
+
doAddRaction={doAddRaction}
|
|
286
304
|
/>
|
|
287
305
|
{buttons.includes("detail") && showDtmplView ? (
|
|
288
306
|
<ModalDtmplView
|
|
@@ -301,8 +319,8 @@ const TtmplTable = (props: TtmplTableProps) => {
|
|
|
301
319
|
serverKey={serverKey}
|
|
302
320
|
open={showDtmplEdit}
|
|
303
321
|
onCancel={() => setShowDtmplEdit(false)}
|
|
304
|
-
sourceId={dtmplSourceId ? dtmplSourceId : sourceId}
|
|
305
|
-
mainCode={mainCode}
|
|
322
|
+
sourceId={treeAddData?.ractionId || (dtmplSourceId ? dtmplSourceId : sourceId)}
|
|
323
|
+
mainCode={treeAddData?.mainCode || mainCode}
|
|
306
324
|
code={selectedCode}
|
|
307
325
|
onOk={handleDtmplEdit}
|
|
308
326
|
isCopy={isCopy}
|
|
@@ -317,8 +335,8 @@ const TtmplTable = (props: TtmplTableProps) => {
|
|
|
317
335
|
setShowDtmplCustomEdit(false);
|
|
318
336
|
}}
|
|
319
337
|
customPath={customEditPagePath}
|
|
320
|
-
sourceId={sourceId}
|
|
321
|
-
mainCode={mainCode}
|
|
338
|
+
sourceId={treeAddData?.ractionId || sourceId}
|
|
339
|
+
mainCode={treeAddData?.mainCode || mainCode}
|
|
322
340
|
code={selectedCode}
|
|
323
341
|
isCopy={isCopy}
|
|
324
342
|
/>
|