aldehyde 0.2.454 → 0.2.455
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/layout/menu/l2menu-message-bar.d.ts +2 -22
- package/lib/layout/menu/l2menu-message-bar.d.ts.map +1 -1
- package/lib/layout/menu/l2menu-message-bar.js +82 -89
- package/lib/layout/menu/l2menu-message-bar.js.map +1 -1
- package/lib/layout/menu/message-bar.less +5 -0
- package/lib/lowcode-components/bar-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/bar-chart/index.js +9 -0
- package/lib/lowcode-components/bar-chart/index.js.map +1 -1
- package/lib/lowcode-components/base-image/index.d.ts.map +1 -1
- package/lib/lowcode-components/base-image/index.js +8 -0
- package/lib/lowcode-components/base-image/index.js.map +1 -1
- package/lib/lowcode-components/base-map/index.d.ts.map +1 -1
- package/lib/lowcode-components/base-map/index.js +9 -0
- package/lib/lowcode-components/base-map/index.js.map +1 -1
- package/lib/lowcode-components/capsule-bar-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/capsule-bar-chart/index.js +9 -0
- package/lib/lowcode-components/capsule-bar-chart/index.js.map +1 -1
- package/lib/lowcode-components/carousel/index.d.ts.map +1 -1
- package/lib/lowcode-components/carousel/index.js +10 -0
- package/lib/lowcode-components/carousel/index.js.map +1 -1
- package/lib/lowcode-components/circular-progress-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/circular-progress-chart/index.js +10 -0
- package/lib/lowcode-components/circular-progress-chart/index.js.map +1 -1
- package/lib/lowcode-components/column-3d-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/column-3d-chart/index.js +9 -0
- package/lib/lowcode-components/column-3d-chart/index.js.map +1 -1
- package/lib/lowcode-components/column-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/column-chart/index.js +9 -0
- package/lib/lowcode-components/column-chart/index.js.map +1 -1
- package/lib/lowcode-components/data-number/index.d.ts.map +1 -1
- package/lib/lowcode-components/data-number/index.js +9 -0
- package/lib/lowcode-components/data-number/index.js.map +1 -1
- package/lib/lowcode-components/effectScatter-map/index.d.ts.map +1 -1
- package/lib/lowcode-components/effectScatter-map/index.js +9 -0
- package/lib/lowcode-components/effectScatter-map/index.js.map +1 -1
- package/lib/lowcode-components/effectScatter-map-3d/index.d.ts.map +1 -1
- package/lib/lowcode-components/effectScatter-map-3d/index.js +9 -0
- package/lib/lowcode-components/effectScatter-map-3d/index.js.map +1 -1
- package/lib/lowcode-components/gauge-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/gauge-chart/index.js +9 -0
- package/lib/lowcode-components/gauge-chart/index.js.map +1 -1
- package/lib/lowcode-components/line-bar-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/line-bar-chart/index.js +10 -0
- package/lib/lowcode-components/line-bar-chart/index.js.map +1 -1
- package/lib/lowcode-components/line-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/line-chart/index.js +10 -0
- package/lib/lowcode-components/line-chart/index.js.map +1 -1
- package/lib/lowcode-components/liquid-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/liquid-chart/index.js +9 -0
- package/lib/lowcode-components/liquid-chart/index.js.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/abstract-definition.d.ts +2 -2
- package/lib/lowcode-components/lowcode-view/component/abstract-definition.d.ts.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/component-container.js.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/component-controller.d.ts +9 -2
- package/lib/lowcode-components/lowcode-view/component/component-controller.d.ts.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/component-controller.js +40 -4
- package/lib/lowcode-components/lowcode-view/component/component-controller.js.map +1 -1
- package/lib/lowcode-components/lowcode-view/index.d.ts.map +1 -1
- package/lib/lowcode-components/lowcode-view/index.js +53 -8
- package/lib/lowcode-components/lowcode-view/index.js.map +1 -1
- package/lib/lowcode-components/pie-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/pie-chart/index.js +9 -0
- package/lib/lowcode-components/pie-chart/index.js.map +1 -1
- package/lib/lowcode-components/progress-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/progress-chart/index.js +9 -0
- package/lib/lowcode-components/progress-chart/index.js.map +1 -1
- package/lib/lowcode-components/stroke-animation/index.d.ts.map +1 -1
- package/lib/lowcode-components/stroke-animation/index.js +9 -0
- package/lib/lowcode-components/stroke-animation/index.js.map +1 -1
- package/lib/lowcode-components/text-scroller/index.d.ts.map +1 -1
- package/lib/lowcode-components/text-scroller/index.js +9 -0
- package/lib/lowcode-components/text-scroller/index.js.map +1 -1
- package/lib/table/column/column-builder.d.ts.map +1 -1
- package/lib/table/column/column-builder.js +12 -1
- package/lib/table/column/column-builder.js.map +1 -1
- package/lib/tmpl/hcservice-v3.d.ts +2 -4
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +14 -2
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/interface.d.ts +1 -0
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/lib/tmpl/web-socket.js +1 -1
- package/lib/tmpl/web-socket.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/layout/menu/l2menu-message-bar.tsx +39 -62
- package/src/aldehyde/layout/menu/message-bar.less +5 -0
- package/src/aldehyde/lowcode-components/bar-chart/index.tsx +10 -0
- package/src/aldehyde/lowcode-components/base-image/index.tsx +9 -0
- package/src/aldehyde/lowcode-components/base-map/index.tsx +10 -0
- package/src/aldehyde/lowcode-components/capsule-bar-chart/index.tsx +10 -0
- package/src/aldehyde/lowcode-components/carousel/index.tsx +11 -0
- package/src/aldehyde/lowcode-components/circular-progress-chart/index.tsx +10 -0
- package/src/aldehyde/lowcode-components/column-3d-chart/index.tsx +10 -0
- package/src/aldehyde/lowcode-components/column-chart/index.tsx +11 -0
- package/src/aldehyde/lowcode-components/data-number/index.tsx +10 -0
- package/src/aldehyde/lowcode-components/data.d.ts +1 -0
- package/src/aldehyde/lowcode-components/effectScatter-map/index.tsx +10 -0
- package/src/aldehyde/lowcode-components/effectScatter-map-3d/index.tsx +10 -0
- package/src/aldehyde/lowcode-components/gauge-chart/index.tsx +10 -0
- package/src/aldehyde/lowcode-components/line-bar-chart/index.tsx +11 -0
- package/src/aldehyde/lowcode-components/line-chart/index.tsx +11 -0
- package/src/aldehyde/lowcode-components/liquid-chart/index.tsx +10 -0
- package/src/aldehyde/lowcode-components/lowcode-view/component/abstract-definition.ts +2 -2
- package/src/aldehyde/lowcode-components/lowcode-view/component/component-container.tsx +3 -3
- package/src/aldehyde/lowcode-components/lowcode-view/component/component-controller.ts +42 -3
- package/src/aldehyde/lowcode-components/lowcode-view/index.tsx +55 -8
- package/src/aldehyde/lowcode-components/pie-chart/index.tsx +10 -0
- package/src/aldehyde/lowcode-components/progress-chart/index.tsx +10 -0
- package/src/aldehyde/lowcode-components/stroke-animation/index.tsx +10 -0
- package/src/aldehyde/lowcode-components/text-scroller/index.tsx +10 -0
- package/src/aldehyde/table/column/column-builder.tsx +10 -1
- package/src/aldehyde/tmpl/hcservice-v3.tsx +14 -1
- package/src/aldehyde/tmpl/interface.tsx +1 -0
- package/src/aldehyde/tmpl/web-socket.ts +1 -1
- package/lib/lowcode-components/lowcode-view/component/abstract-designer-controller.d.ts +0 -28
- package/lib/lowcode-components/lowcode-view/component/abstract-designer-controller.d.ts.map +0 -1
- package/lib/lowcode-components/lowcode-view/component/abstract-designer-controller.js +0 -49
- package/lib/lowcode-components/lowcode-view/component/abstract-designer-controller.js.map +0 -1
- package/src/aldehyde/lowcode-components/lowcode-view/component/abstract-designer-controller.ts +0 -56
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
.ripple-dot .ant-badge-count {
|
|
2
2
|
overflow: revert;
|
|
3
3
|
box-shadow: none;
|
|
4
|
+
padding: 0 4px;
|
|
4
5
|
|
|
5
6
|
.ant-scroll-number-only {
|
|
6
7
|
display: flex;
|
|
@@ -13,6 +14,10 @@
|
|
|
13
14
|
height: 100%;
|
|
14
15
|
line-height: 12px;
|
|
15
16
|
}
|
|
17
|
+
|
|
18
|
+
bdi {
|
|
19
|
+
display: flex;
|
|
20
|
+
}
|
|
16
21
|
}
|
|
17
22
|
|
|
18
23
|
.ripple-dot .ant-badge-count::before {
|
|
@@ -125,6 +125,15 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
// ws订阅数据更新
|
|
129
|
+
const handleWSData = (val: DataConfigProps) => {
|
|
130
|
+
if (val.sourceType === "sourceId" && val.wsData) {
|
|
131
|
+
const { value } = val.initData;
|
|
132
|
+
const temData = handleData(value);
|
|
133
|
+
setData(temData);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
128
137
|
useImperativeHandle(ref, () => ({
|
|
129
138
|
updateConfig: (newConfig) => {
|
|
130
139
|
const { base, style: newStyle, data: newDataConfig, initSearchParams: newISParams } = newConfig;
|
|
@@ -135,6 +144,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
135
144
|
handleInitData(newDataConfig);
|
|
136
145
|
setSearchParams(newDataConfig.searchParams);
|
|
137
146
|
setInitSearchParams(newISParams);
|
|
147
|
+
handleWSData(newDataConfig);
|
|
138
148
|
},
|
|
139
149
|
destroy: handleDestroy,
|
|
140
150
|
}));
|
|
@@ -107,6 +107,14 @@ const BaseImageComponent = forwardRef((props: BaseImageComponentProps, ref: Forw
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
// ws订阅数据更新
|
|
111
|
+
const handleWSData = (val: DataConfigProps) => {
|
|
112
|
+
if (val.sourceType === "sourceId" && val.wsData) {
|
|
113
|
+
const { value } = val.initData;
|
|
114
|
+
handleDataImgSrc(value);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
110
118
|
useEffect(() => {
|
|
111
119
|
if (props) {
|
|
112
120
|
handleDefImgSrc(props.style || {});
|
|
@@ -121,6 +129,7 @@ const BaseImageComponent = forwardRef((props: BaseImageComponentProps, ref: Forw
|
|
|
121
129
|
setSearchParams(newDataConfig.searchParams);
|
|
122
130
|
setInitSearchParams(newISParams);
|
|
123
131
|
handleInitData(newDataConfig);
|
|
132
|
+
handleWSData(newDataConfig);
|
|
124
133
|
},
|
|
125
134
|
destroy: handleDestroy,
|
|
126
135
|
}));
|
|
@@ -130,6 +130,15 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
// ws订阅数据更新
|
|
134
|
+
const handleWSData = (val: DataConfigProps) => {
|
|
135
|
+
if (val.sourceType === "sourceId" && val.wsData) {
|
|
136
|
+
const { value } = val.initData;
|
|
137
|
+
const temData = handleData(value);
|
|
138
|
+
setData(temData);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
133
142
|
useImperativeHandle(ref, () => ({
|
|
134
143
|
updateConfig: (newConfig) => {
|
|
135
144
|
const { base, style: newStyle, data: newDataConfig, initSearchParams: newISParams } = newConfig;
|
|
@@ -139,6 +148,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
139
148
|
handleInitData(newDataConfig);
|
|
140
149
|
setSearchParams(newDataConfig.searchParams);
|
|
141
150
|
setInitSearchParams(newISParams);
|
|
151
|
+
handleWSData(newDataConfig);
|
|
142
152
|
},
|
|
143
153
|
destroy: handleDestroy,
|
|
144
154
|
}));
|
|
@@ -143,6 +143,15 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
// ws订阅数据更新
|
|
147
|
+
const handleWSData = (val: DataConfigProps) => {
|
|
148
|
+
if (val.sourceType === "sourceId" && val.wsData) {
|
|
149
|
+
const { value } = val.initData;
|
|
150
|
+
const temData = handleData(value);
|
|
151
|
+
setData(temData);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
146
155
|
useImperativeHandle(ref, () => ({
|
|
147
156
|
updateConfig: (newConfig) => {
|
|
148
157
|
const { base, style: newStyle, data: newDataConfig, initSearchParams: newISParams } = newConfig;
|
|
@@ -153,6 +162,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
153
162
|
handleInitData(newDataConfig);
|
|
154
163
|
setSearchParams(newDataConfig.searchParams);
|
|
155
164
|
setInitSearchParams(newISParams);
|
|
165
|
+
handleWSData(newDataConfig);
|
|
156
166
|
},
|
|
157
167
|
destroy: handleDestroy,
|
|
158
168
|
}));
|
|
@@ -126,6 +126,16 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
// ws订阅数据更新
|
|
130
|
+
const handleWSData = (val: DataConfigProps) => {
|
|
131
|
+
if (val.sourceType === "sourceId" && val.wsData) {
|
|
132
|
+
const { config, value } = val.initData;
|
|
133
|
+
const temVal = handleData(value);
|
|
134
|
+
const ossConfig = getOssConfig(config?.serverKey || defServerKey);
|
|
135
|
+
setData(temVal.map((r) => handleValue(r, ossConfig)).flat().filter(Boolean));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
129
139
|
useImperativeHandle(ref, () => ({
|
|
130
140
|
updateConfig: (newConfig) => { // 组件更新配置
|
|
131
141
|
const { base, style, data: newDataConfig, initSearchParams: newISParams } = newConfig;
|
|
@@ -135,6 +145,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
135
145
|
handleInitData(newDataConfig);
|
|
136
146
|
setSearchParams(newDataConfig.searchParams);
|
|
137
147
|
setInitSearchParams(newISParams);
|
|
148
|
+
handleWSData(newDataConfig);
|
|
138
149
|
},
|
|
139
150
|
destroy: handleDestroy,
|
|
140
151
|
}));
|
|
@@ -128,6 +128,15 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
// ws订阅数据更新
|
|
132
|
+
const handleWSData = (val: DataConfigProps) => {
|
|
133
|
+
if (val.sourceType === "sourceId" && val.wsData) {
|
|
134
|
+
const { value } = val.initData;
|
|
135
|
+
const temData = value?.[0]?.value?.[0]?.v1 || 0;
|
|
136
|
+
setData(temData * 100);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
131
140
|
useImperativeHandle(ref, () => ({
|
|
132
141
|
updateConfig: (newConfig) => {
|
|
133
142
|
const { base, style: newStyle, data: newDataConfig, initSearchParams: newISParams } = newConfig;
|
|
@@ -138,6 +147,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
138
147
|
handleInitData(newDataConfig);
|
|
139
148
|
setSearchParams(newDataConfig.searchParams);
|
|
140
149
|
setInitSearchParams(newISParams);
|
|
150
|
+
handleWSData(newDataConfig);
|
|
141
151
|
},
|
|
142
152
|
destroy: handleDestroy,
|
|
143
153
|
}));
|
|
@@ -179,6 +179,15 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
+
// ws订阅数据更新
|
|
183
|
+
const handleWSData = (val: DataConfigProps) => {
|
|
184
|
+
if (val.sourceType === "sourceId" && val.wsData) {
|
|
185
|
+
const { value } = val.initData;
|
|
186
|
+
const temData = handleData(value);
|
|
187
|
+
setData(temData);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
182
191
|
useImperativeHandle(ref, () => ({
|
|
183
192
|
updateConfig: (newConfig) => {
|
|
184
193
|
const { base, style: newStyle, data: newDataConfig, initSearchParams: newISParams } = newConfig;
|
|
@@ -189,6 +198,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
189
198
|
handleInitData(newDataConfig);
|
|
190
199
|
setSearchParams(newDataConfig.searchParams);
|
|
191
200
|
setInitSearchParams(newISParams);
|
|
201
|
+
handleWSData(newDataConfig);
|
|
192
202
|
},
|
|
193
203
|
destroy: handleDestroy,
|
|
194
204
|
}));
|
|
@@ -148,6 +148,16 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
+
|
|
152
|
+
// ws订阅数据更新
|
|
153
|
+
const handleWSData = (val: DataConfigProps) => {
|
|
154
|
+
if (val.sourceType === "sourceId" && val.wsData) {
|
|
155
|
+
const { value } = val.initData;
|
|
156
|
+
const temData = handleData(value);
|
|
157
|
+
setData(temData);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
151
161
|
useImperativeHandle(ref, () => ({
|
|
152
162
|
updateConfig: (newConfig) => {
|
|
153
163
|
const { base, style: newStyle, data: newDataConfig, initSearchParams: newISParams } = newConfig;
|
|
@@ -158,6 +168,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
158
168
|
handleInitData(newDataConfig);
|
|
159
169
|
setSearchParams(newDataConfig.searchParams);
|
|
160
170
|
setInitSearchParams(newISParams);
|
|
171
|
+
handleWSData(newDataConfig);
|
|
161
172
|
},
|
|
162
173
|
destroy: handleDestroy,
|
|
163
174
|
}));
|
|
@@ -110,6 +110,15 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
// ws订阅数据更新
|
|
114
|
+
const handleWSData = (val: DataConfigProps) => {
|
|
115
|
+
if (val.sourceType === "sourceId" && val.wsData) {
|
|
116
|
+
const { config, value } = val.wsData;
|
|
117
|
+
const temData = handleData(value, config?.defaultValue);
|
|
118
|
+
setData(temData);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
113
122
|
useImperativeHandle(ref, () => ({ // 暴露到外部func
|
|
114
123
|
updateConfig: (newConfig) => { // 组件更新配置
|
|
115
124
|
const { style: { defaultValue, enume: newEnume, ...style }, data: newDataConfig, initSearchParams: newISParams } = newConfig;
|
|
@@ -120,6 +129,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
120
129
|
handleInitData(newDataConfig);
|
|
121
130
|
setSearchParams(newDataConfig.searchParams);
|
|
122
131
|
setInitSearchParams(newISParams);
|
|
132
|
+
handleWSData(newDataConfig);
|
|
123
133
|
},
|
|
124
134
|
destroy: handleDestroy
|
|
125
135
|
}));
|
|
@@ -156,6 +156,15 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
+
// ws订阅数据更新
|
|
160
|
+
const handleWSData = (val: DataConfigProps) => {
|
|
161
|
+
if (val.sourceType === "sourceId" && val.wsData) {
|
|
162
|
+
const { value } = val.initData;
|
|
163
|
+
const temData = handleData(value);
|
|
164
|
+
setData(temData);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
159
168
|
useImperativeHandle(ref, () => ({
|
|
160
169
|
updateConfig: (newConfig) => {
|
|
161
170
|
const { base, style: newStyle, data: newDataConfig, initSearchParams: newISParams } = newConfig;
|
|
@@ -165,6 +174,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
165
174
|
handleInitData(newDataConfig);
|
|
166
175
|
setSearchParams(newDataConfig.searchParams);
|
|
167
176
|
setInitSearchParams(newISParams);
|
|
177
|
+
handleWSData(newDataConfig);
|
|
168
178
|
},
|
|
169
179
|
destroy: handleDestroy,
|
|
170
180
|
}));
|
|
@@ -238,6 +238,15 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
+
// ws订阅数据更新
|
|
242
|
+
const handleWSData = (val: DataConfigProps) => {
|
|
243
|
+
if (val.sourceType === "sourceId" && val.wsData) {
|
|
244
|
+
const { value } = val.initData;
|
|
245
|
+
const temData = handleData(value);
|
|
246
|
+
setData(temData);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
241
250
|
useImperativeHandle(ref, () => ({
|
|
242
251
|
updateConfig: (newConfig) => {
|
|
243
252
|
const { base, style: newStyle, data: newDataConfig, initSearchParams: newISParams } = newConfig;
|
|
@@ -247,6 +256,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
247
256
|
handleInitData(newDataConfig);
|
|
248
257
|
setSearchParams(newDataConfig.searchParams);
|
|
249
258
|
setInitSearchParams(newISParams);
|
|
259
|
+
handleWSData(newDataConfig);
|
|
250
260
|
},
|
|
251
261
|
destroy: handleDestroy,
|
|
252
262
|
}));
|
|
@@ -90,6 +90,15 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
// ws订阅数据更新
|
|
94
|
+
const handleWSData = (val: DataConfigProps) => {
|
|
95
|
+
if (val.sourceType === "sourceId" && val.wsData) {
|
|
96
|
+
const { value } = val.initData;
|
|
97
|
+
const temData = handleData(value);
|
|
98
|
+
setData(temData);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
93
102
|
useImperativeHandle(ref, () => ({
|
|
94
103
|
updateConfig: (newConfig) => {
|
|
95
104
|
const { base, style: newStyle, data: newDataConfig, initSearchParams: newISParams } = newConfig;
|
|
@@ -100,6 +109,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
100
109
|
handleInitData(newDataConfig);
|
|
101
110
|
setSearchParams(newDataConfig.searchParams);
|
|
102
111
|
setInitSearchParams(newISParams);
|
|
112
|
+
handleWSData(newDataConfig);
|
|
103
113
|
},
|
|
104
114
|
destroy: handleDestroy,
|
|
105
115
|
}));
|
|
@@ -141,6 +141,16 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
// ws订阅数据更新
|
|
145
|
+
const handleWSData = (val: DataConfigProps) => {
|
|
146
|
+
if (val.sourceType === "sourceId" && val.wsData) {
|
|
147
|
+
const { value } = val.initData;
|
|
148
|
+
const { nullSetZero } = config || {};
|
|
149
|
+
const temData = handleData(value, nullSetZero);
|
|
150
|
+
setData(temData);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
144
154
|
useImperativeHandle(ref, () => ({
|
|
145
155
|
updateConfig: (newConfig) => {
|
|
146
156
|
const { base, style: newStyle, data: newDataConfig, initSearchParams: newISParams } = newConfig;
|
|
@@ -151,6 +161,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
151
161
|
handleInitData(newDataConfig);
|
|
152
162
|
setSearchParams(newDataConfig.searchParams);
|
|
153
163
|
setInitSearchParams(newISParams);
|
|
164
|
+
handleWSData(newDataConfig);
|
|
154
165
|
},
|
|
155
166
|
destroy: handleDestroy,
|
|
156
167
|
}));
|
|
@@ -136,6 +136,16 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
// ws订阅数据更新
|
|
140
|
+
const handleWSData = (val: DataConfigProps) => {
|
|
141
|
+
if (val.sourceType === "sourceId" && val.wsData) {
|
|
142
|
+
const { value } = val.initData;
|
|
143
|
+
const { nullSetZero } = config || {};
|
|
144
|
+
const temData = handleData(value, nullSetZero);
|
|
145
|
+
setData(temData);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
139
149
|
useImperativeHandle(ref, () => ({
|
|
140
150
|
updateConfig: (newConfig) => {
|
|
141
151
|
const { base, style: newStyle, data: newDataConfig, initSearchParams: newISParams } = newConfig;
|
|
@@ -146,6 +156,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
146
156
|
handleInitData(newDataConfig);
|
|
147
157
|
setSearchParams(newDataConfig.searchParams);
|
|
148
158
|
setInitSearchParams(newISParams);
|
|
159
|
+
handleWSData(newDataConfig);
|
|
149
160
|
},
|
|
150
161
|
destroy: handleDestroy,
|
|
151
162
|
}));
|
|
@@ -106,6 +106,15 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
// ws订阅数据更新
|
|
110
|
+
const handleWSData = (val: DataConfigProps) => {
|
|
111
|
+
if (val.sourceType === "sourceId" && val.wsData) {
|
|
112
|
+
const { value } = val.initData;
|
|
113
|
+
const temData = handleData(value);
|
|
114
|
+
setData(temData);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
109
118
|
useImperativeHandle(ref, () => ({
|
|
110
119
|
updateConfig: (newConfig) => {
|
|
111
120
|
const { base, style: newStyle, data: newDataConfig, initSearchParams: newISParams } = newConfig;
|
|
@@ -116,6 +125,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
116
125
|
handleInitData(newDataConfig);
|
|
117
126
|
setSearchParams(newDataConfig.searchParams);
|
|
118
127
|
setInitSearchParams(newISParams);
|
|
128
|
+
handleWSData(newDataConfig);
|
|
119
129
|
},
|
|
120
130
|
destroy: handleDestroy,
|
|
121
131
|
}));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import AbstractController from "./abstract-controller";
|
|
2
2
|
import React, { ComponentType } from "react";
|
|
3
|
-
import
|
|
3
|
+
import ComponentController from "./component-controller";
|
|
4
4
|
|
|
5
5
|
export type ClazzTemplate<C> = new () => C | null;
|
|
6
6
|
|
|
7
7
|
export interface ActionInfo {
|
|
8
8
|
name: string;
|
|
9
9
|
id: string;
|
|
10
|
-
handler: (controller:
|
|
10
|
+
handler: (controller: ComponentController, params?: any) => void;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export interface ICategorize {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { memo, Suspense, useEffect, useRef, useState, useContext } from "react";
|
|
2
2
|
import Loading from "./loading";
|
|
3
3
|
import { ILayerItem, LayerManagerDataType } from "../interface";
|
|
4
|
-
import
|
|
4
|
+
import ComponentController from "./component-controller";
|
|
5
5
|
import abstractDesignerLoader from "./abstract-designer-loader";
|
|
6
6
|
import { useNavigate } from "react-router-dom";
|
|
7
7
|
import { ControllerContext } from "../index";
|
|
8
8
|
|
|
9
|
-
const registerProxy = (compId: string, controller:
|
|
9
|
+
const registerProxy = (compId: string, controller: ComponentController) => {
|
|
10
10
|
controller.changeData = new Proxy(controller.changeData, {
|
|
11
11
|
apply(target, thisArg, argus) {
|
|
12
12
|
return target.apply(thisArg, argus as any);
|
|
@@ -22,7 +22,7 @@ export interface ComponentContainerProps {
|
|
|
22
22
|
const ComponentContainer = memo((props: ComponentContainerProps) => {
|
|
23
23
|
const { layer, layerManager } = props;
|
|
24
24
|
const ref = useRef(null);
|
|
25
|
-
const [compController, setCompController] = useState<{ [key: string]:
|
|
25
|
+
const [compController, setCompController] = useState<{ [key: string]: ComponentController }>({});
|
|
26
26
|
const navigate = useNavigate();
|
|
27
27
|
const { setControllers, setSearchParams } = useContext(ControllerContext);
|
|
28
28
|
|
|
@@ -2,7 +2,8 @@ import { ComponentType, ClassType, createElement } from "react";
|
|
|
2
2
|
import { createRoot } from "react-dom/client";
|
|
3
3
|
import { message } from "antd";
|
|
4
4
|
import { UpdateOptions } from "./abstract-controller";
|
|
5
|
-
import
|
|
5
|
+
import AbstractController from "./abstract-controller";
|
|
6
|
+
import { ComponentBaseProps, IFilterConfigType } from "../interface";
|
|
6
7
|
|
|
7
8
|
const merge = (originalData: any, newData: any): any => {
|
|
8
9
|
if (!originalData && newData)
|
|
@@ -51,7 +52,7 @@ class ComponentUtil {
|
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
|
|
54
|
-
export class ComponentController extends
|
|
55
|
+
export class ComponentController extends AbstractController {
|
|
55
56
|
|
|
56
57
|
private componentNode: ComponentType; // 组件实例
|
|
57
58
|
private componentType: string; // 组件类型
|
|
@@ -88,6 +89,9 @@ export class ComponentController extends AbstractDesignerController {
|
|
|
88
89
|
|
|
89
90
|
|
|
90
91
|
changeData(data: any) {
|
|
92
|
+
if (!this.config) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
91
95
|
if (this.componentType === "BaseText" && typeof data !== 'string') { // 文本组件数据更新
|
|
92
96
|
message.warning('数据类型错误, 基础文本仅接受字符串类型的数据: ', data);
|
|
93
97
|
this.config.data.staticData = "";
|
|
@@ -108,8 +112,43 @@ export class ComponentController extends AbstractDesignerController {
|
|
|
108
112
|
this.instance?.updateConfig(this.config);
|
|
109
113
|
return;
|
|
110
114
|
}
|
|
115
|
+
if (data?.type === "wsData") { // ws组件订阅数据更新
|
|
116
|
+
this.config.data.wsData = data;
|
|
117
|
+
this.instance?.updateConfig(this.config);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
111
120
|
// 默认组件静态数据更新
|
|
112
121
|
this.config.data.staticData = data;
|
|
113
122
|
this.instance?.updateConfig(this.config);
|
|
114
123
|
}
|
|
115
|
-
|
|
124
|
+
|
|
125
|
+
// 更新组件数据
|
|
126
|
+
public loadComponentData({ type, data }: { type: string, data: any }): void {
|
|
127
|
+
switch (type) {
|
|
128
|
+
case "initData":
|
|
129
|
+
// 初始化数据加载逻辑
|
|
130
|
+
this.changeData({ ...data, type: "initData" });
|
|
131
|
+
break;
|
|
132
|
+
case "wsData": // 订阅数据更新
|
|
133
|
+
this.changeData({ ...data, type: "wsData" });
|
|
134
|
+
break;
|
|
135
|
+
default:
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// 设置滤镜效果
|
|
141
|
+
public updateFilter(filter: IFilterConfigType): void {
|
|
142
|
+
if (this.config && (this.config as ComponentBaseProps).filter)
|
|
143
|
+
(this.config as ComponentBaseProps)!.filter = filter;
|
|
144
|
+
if (!this.container)
|
|
145
|
+
return;
|
|
146
|
+
if (filter?.enable) {
|
|
147
|
+
this.container.style.filter = `blur(${filter.blur}px) brightness(${filter.brightness}) contrast(${filter.contrast}) opacity(${filter.opacity}) saturate(${filter.saturate}) hue-rotate(${filter.hueRotate}deg)`
|
|
148
|
+
} else {
|
|
149
|
+
this.container.style.filter = 'none';
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export default ComponentController;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { CSSProperties, useEffect, useState, createContext, useMemo } from 'react'
|
|
1
|
+
import React, { CSSProperties, useEffect, useState, createContext, useMemo, useRef } from 'react'
|
|
2
2
|
import { useParams } from 'react-router-dom';
|
|
3
3
|
import isEqual from "lodash/isEqual";
|
|
4
4
|
import chunk from "lodash/chunk";
|
|
@@ -8,6 +8,7 @@ import './component/font/FontGlobal.css';
|
|
|
8
8
|
import ScreenFit from "./component/screen-fit";
|
|
9
9
|
import { LayerManagerDataType, CanvasConfig, ILayerItem } from "./interface";
|
|
10
10
|
import HcserviceV3 from "../../tmpl/hcservice-v3";
|
|
11
|
+
import WebSocket from "../../tmpl/web-socket";
|
|
11
12
|
import abstractDesignerLoader from "./component/abstract-designer-loader";
|
|
12
13
|
import { merge } from "./component/util";
|
|
13
14
|
import ProgramConfig from ".././../units";
|
|
@@ -57,6 +58,8 @@ const viewHeight = {
|
|
|
57
58
|
v5: "calc(100vh - 88px)"
|
|
58
59
|
}
|
|
59
60
|
|
|
61
|
+
type DataSourceConfig = { sourceId: string, chartCode: string } & { [key: string]: any };
|
|
62
|
+
|
|
60
63
|
interface Props {
|
|
61
64
|
isFullScreen: boolean,
|
|
62
65
|
ddpageId?: string,
|
|
@@ -76,12 +79,17 @@ const LowcodeView = (props: Props) => {
|
|
|
76
79
|
const [controllers, setControllers] = useState<any>({});
|
|
77
80
|
const [searchParams, setSearchParams] = useState<any>({}); // 全局搜索参数,用于组件间通信
|
|
78
81
|
const { width, height, adaptationType, backgroundColor } = canvasConfig || {};
|
|
82
|
+
const wsRef = useRef(undefined); // 实时数据websocket连接
|
|
83
|
+
const subscribeRef = useRef(undefined); // 实时数据订阅
|
|
79
84
|
|
|
80
85
|
const backgroundImage = useMemo(() => handleImgUrl(canvasConfig?.backgroundImage), [canvasConfig]);
|
|
81
86
|
|
|
82
87
|
useEffect(() => {
|
|
83
88
|
//加载
|
|
84
89
|
abstractDesignerLoader.load();
|
|
90
|
+
return () => {
|
|
91
|
+
subscribeRef.current && subscribeRef.current.unsubscribe();
|
|
92
|
+
}
|
|
85
93
|
}, []);
|
|
86
94
|
|
|
87
95
|
// 获取画面数据
|
|
@@ -109,8 +117,8 @@ const LowcodeView = (props: Props) => {
|
|
|
109
117
|
setLayerManager({ ...layerManager, layerConfigs: { ...layerConfigs, ...temObj } });
|
|
110
118
|
};
|
|
111
119
|
|
|
112
|
-
//
|
|
113
|
-
const
|
|
120
|
+
// all(所有数据源组件)、init(初始化请求组件)
|
|
121
|
+
const handleDataSourceParams = () => {
|
|
114
122
|
const { elemConfigs } = layerManager;
|
|
115
123
|
const nodesIds = Object.keys(elemConfigs || {});
|
|
116
124
|
// publicParams 组件公共参数
|
|
@@ -123,14 +131,23 @@ const LowcodeView = (props: Props) => {
|
|
|
123
131
|
const dataSourceConfigs = nodesIds.reduce((total, next) => {
|
|
124
132
|
const { data: item = {}, base } = elemConfigs[next] || {};
|
|
125
133
|
const temParams = { ...publicParams, ...(initSearchParams?.[next] || {}) }; // 指定组件传参,指定传参可覆盖公共
|
|
126
|
-
if ((item.isInitParams || base.type === "PlaceholderComponent") && controllers[next]) {
|
|
134
|
+
if ((item.isInitParams || base.type === "PlaceholderComponent") && controllers[next]) { // 组件数据源接收外部参数,更新参数
|
|
127
135
|
controllers[next].changeData({ ...elemConfigs[next], initSearchParams: temParams, type: "initSearchParams" });
|
|
128
136
|
}
|
|
129
|
-
if (item.sourceType === "sourceId" && item.sourceId
|
|
130
|
-
|
|
137
|
+
if (item.sourceType === "sourceId" && item.sourceId) { // 整合初始化请求/ws请求参数
|
|
138
|
+
const itemConfig = { sourceId: item.sourceId, chartCode: next, ...(item.isInitParams ? temParams : {}) };
|
|
139
|
+
if (item.isInit) { // 初始化请求
|
|
140
|
+
total.initDataSource.push(itemConfig);
|
|
141
|
+
}
|
|
142
|
+
total.allDataSource.push(itemConfig);
|
|
131
143
|
}
|
|
132
144
|
return total;
|
|
133
|
-
}, []);
|
|
145
|
+
}, { allDataSource: [], initDataSource: [] });
|
|
146
|
+
return dataSourceConfigs;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// 获取初始化组件数据
|
|
150
|
+
const getInitComponentData = async (dataSourceConfigs: DataSourceConfig[]) => {
|
|
134
151
|
if (!dataSourceConfigs.length) return;
|
|
135
152
|
const temSourceConfigs = chunk(dataSourceConfigs, 10); // 每批处理10个组件数据
|
|
136
153
|
temSourceConfigs.forEach(i => {
|
|
@@ -145,12 +162,42 @@ const LowcodeView = (props: Props) => {
|
|
|
145
162
|
})
|
|
146
163
|
};
|
|
147
164
|
|
|
165
|
+
// 获取当前大屏数据源配置
|
|
166
|
+
const getCharWSConfig = async (dataSourceConfigs: DataSourceConfig[]) => {
|
|
167
|
+
if (!dataSourceConfigs.length) return;
|
|
168
|
+
const sourceIds = dataSourceConfigs.map(r => r.sourceId);
|
|
169
|
+
const res = await HcserviceV3.requestCharWSConfig(null, sourceIds);
|
|
170
|
+
const wsSourceIds = Object.keys(res?.config || {});
|
|
171
|
+
if (!wsSourceIds?.length) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
return dataSourceConfigs.filter(r => wsSourceIds.includes(r.sourceId));
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// 实时订阅组件数据
|
|
178
|
+
const webSocketComponentData = async (dataSourceConfigs: DataSourceConfig[]) => {
|
|
179
|
+
if (subscribeRef.current) { subscribeRef.current.unsubscribe(); }
|
|
180
|
+
const temArr = await getCharWSConfig(dataSourceConfigs);
|
|
181
|
+
if (!temArr?.length) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
wsRef.current = WebSocket.getInstance("v3/kk-ws");
|
|
185
|
+
// 订阅大屏数据
|
|
186
|
+
subscribeRef.current = await wsRef.current.subscribe(`/user/queue/chart-data/${ddpageId}`, { dataSourceConfigs: JSON.stringify(temArr) }, (data) => {
|
|
187
|
+
for (const item in data) { // 更新组件数据
|
|
188
|
+
controllers[item] && controllers[item].loadComponentData({ type: "wsData", data: data[item] || {} });
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
148
193
|
useEffect(() => {
|
|
149
194
|
const cKeys = Object.keys(controllers);
|
|
150
195
|
const leKeys = Object.values(layerManager?.elemConfigs || {}).filter(item => item.base?.type !== "group").map(item => item.id);
|
|
151
196
|
// 判断组件实例是否加载完成(组件实例是否存在且与配置数量相等)
|
|
152
197
|
if (cKeys.length && cKeys.length === leKeys.length) {
|
|
153
|
-
|
|
198
|
+
const { allDataSource, initDataSource } = handleDataSourceParams();
|
|
199
|
+
getInitComponentData(initDataSource); // 初始化请求
|
|
200
|
+
webSocketComponentData(allDataSource); // ws订阅数据
|
|
154
201
|
}
|
|
155
202
|
}, [controllers, initSearchParams]);
|
|
156
203
|
|
|
@@ -174,6 +174,15 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
// ws订阅数据更新
|
|
178
|
+
const handleWSData = (val: DataConfigProps) => {
|
|
179
|
+
if (val.sourceType === "sourceId" && val.wsData) {
|
|
180
|
+
const { value } = val.initData;
|
|
181
|
+
const temData = handleData(value);
|
|
182
|
+
setData(temData);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
177
186
|
useImperativeHandle(ref, () => ({
|
|
178
187
|
updateConfig: (newConfig) => {
|
|
179
188
|
const { base, style: newStyle, data: newDataConfig, initSearchParams: newISParams } = newConfig;
|
|
@@ -184,6 +193,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
184
193
|
handleInitData(newDataConfig);
|
|
185
194
|
setSearchParams(newDataConfig.searchParams);
|
|
186
195
|
setInitSearchParams(newISParams);
|
|
196
|
+
handleWSData(newDataConfig);
|
|
187
197
|
},
|
|
188
198
|
destroy: handleDestroy,
|
|
189
199
|
}));
|