aldehyde 0.2.453 → 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/controls/action/utils.d.ts.map +1 -1
- package/lib/controls/action/utils.js +2 -1
- package/lib/controls/action/utils.js.map +1 -1
- 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/controls/action/utils.tsx +65 -64
- 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
|
@@ -12,14 +12,14 @@ import Units from "../../units";
|
|
|
12
12
|
|
|
13
13
|
export default class ActionUtils {
|
|
14
14
|
static isShow(
|
|
15
|
-
|
|
15
|
+
preposes: FieldConfig[],
|
|
16
16
|
data: DtmplData[] | object[],
|
|
17
17
|
formRef: RefObject<FormInstance>
|
|
18
18
|
) {
|
|
19
19
|
|
|
20
|
-
if(!preposes || preposes.length<=0){
|
|
20
|
+
if (!preposes || preposes.length <= 0) {
|
|
21
21
|
return true;
|
|
22
|
-
} else{
|
|
22
|
+
} else {
|
|
23
23
|
return this.isMatch(preposes, data, formRef?.current, null);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -92,29 +92,29 @@ export default class ActionUtils {
|
|
|
92
92
|
let value;
|
|
93
93
|
let defualtValue;
|
|
94
94
|
for (let fieldConfig of fieldConfigs) {
|
|
95
|
-
defualtValue=this.transValue(fieldConfig.defaultValue,fieldConfig.controlType);
|
|
95
|
+
defualtValue = this.transValue(fieldConfig.defaultValue, fieldConfig.controlType);
|
|
96
96
|
if (d["fieldMap"]) {
|
|
97
97
|
let fieldId = dtmplConfig
|
|
98
98
|
? TmplConfigAnalysis.getFieldId(dtmplConfig, fieldConfig.mstrucId)
|
|
99
99
|
: fieldConfig.id;
|
|
100
|
-
value=this.transValue(d["fieldMap"][fieldId],fieldConfig.controlType);
|
|
100
|
+
value = this.transValue(d["fieldMap"][fieldId], fieldConfig.controlType);
|
|
101
101
|
if (
|
|
102
102
|
!this.comparator(
|
|
103
103
|
fieldConfig.comparator,
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
value,
|
|
105
|
+
defualtValue
|
|
106
106
|
)
|
|
107
107
|
) {
|
|
108
108
|
isMatch = false;
|
|
109
109
|
break;
|
|
110
110
|
}
|
|
111
111
|
} else {
|
|
112
|
-
value=this.transValue(d[fieldConfig.id],fieldConfig.controlType);
|
|
112
|
+
value = this.transValue(d[fieldConfig.id], fieldConfig.controlType);
|
|
113
113
|
if (
|
|
114
114
|
!this.comparator(
|
|
115
115
|
fieldConfig.comparator,
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
value,
|
|
117
|
+
defualtValue
|
|
118
118
|
)
|
|
119
119
|
) {
|
|
120
120
|
isMatch = false;
|
|
@@ -127,10 +127,10 @@ export default class ActionUtils {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
static transValue(
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
value: string,
|
|
131
|
+
itemType: string
|
|
132
132
|
) {
|
|
133
|
-
return Units.configParamTrans(value,itemType);
|
|
133
|
+
return Units.configParamTrans(value, itemType);
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
static comparator(
|
|
@@ -139,8 +139,8 @@ export default class ActionUtils {
|
|
|
139
139
|
defaultValue: string
|
|
140
140
|
) {
|
|
141
141
|
let dvs: string[];
|
|
142
|
-
let value=val
|
|
143
|
-
if (
|
|
142
|
+
let value = val;
|
|
143
|
+
if (defaultValue && defaultValue.indexOf("@R@") <= 0 && val && val.indexOf && val.indexOf("@R@") > 0) {
|
|
144
144
|
let vs = val.split("@R@");
|
|
145
145
|
value = vs[1];
|
|
146
146
|
}
|
|
@@ -148,11 +148,11 @@ export default class ActionUtils {
|
|
|
148
148
|
if (!comparator) {
|
|
149
149
|
comparator = "equals";
|
|
150
150
|
}
|
|
151
|
-
|
|
152
|
-
if(comparator=="none1"){
|
|
153
|
-
return !value || value=="";
|
|
154
|
-
}else if(comparator=="none1n"){
|
|
155
|
-
return value && value!="";
|
|
151
|
+
|
|
152
|
+
if (comparator == "none1") {
|
|
153
|
+
return !value || value == "";
|
|
154
|
+
} else if (comparator == "none1n") {
|
|
155
|
+
return value && value != "";
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
if (!defaultValue) {
|
|
@@ -160,7 +160,8 @@ export default class ActionUtils {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
if (!value && value != "0") {
|
|
163
|
-
|
|
163
|
+
// 无数据:不包含任一(空数据算不包含),其余条件空数据不符合
|
|
164
|
+
return comparator === "exclude" ? true : false;
|
|
164
165
|
}
|
|
165
166
|
let vals;
|
|
166
167
|
switch (comparator) {
|
|
@@ -168,10 +169,10 @@ export default class ActionUtils {
|
|
|
168
169
|
return value.includes(defaultValue);
|
|
169
170
|
case "equal":
|
|
170
171
|
case "equals":
|
|
171
|
-
return this.isEqual(value,defaultValue);
|
|
172
|
+
return this.isEqual(value, defaultValue);
|
|
172
173
|
case "exclude":
|
|
173
|
-
dvs=this.toArray(defaultValue);
|
|
174
|
-
vals=this.toArray(value);
|
|
174
|
+
dvs = this.toArray(defaultValue);
|
|
175
|
+
vals = this.toArray(value);
|
|
175
176
|
for (let i = 0; i < dvs.length; i++) {
|
|
176
177
|
for (let j = 0; j < vals.length; j++) {
|
|
177
178
|
if (dvs[i] == vals[j]) {
|
|
@@ -182,8 +183,8 @@ export default class ActionUtils {
|
|
|
182
183
|
return true;
|
|
183
184
|
case "includeOne":
|
|
184
185
|
case "include_anyone":
|
|
185
|
-
dvs=this.toArray(defaultValue);
|
|
186
|
-
vals=this.toArray(value);
|
|
186
|
+
dvs = this.toArray(defaultValue);
|
|
187
|
+
vals = this.toArray(value);
|
|
187
188
|
for (let i = 0; i < dvs.length; i++) {
|
|
188
189
|
for (let j = 0; j < vals.length; j++) {
|
|
189
190
|
if (dvs[i] === vals[j]) {
|
|
@@ -194,10 +195,10 @@ export default class ActionUtils {
|
|
|
194
195
|
return false;
|
|
195
196
|
|
|
196
197
|
case "include_all":
|
|
197
|
-
dvs=this.toArray(defaultValue);
|
|
198
|
-
vals=this.toArray(value);
|
|
199
|
-
let count=0;
|
|
200
|
-
let targetCount=dvs.length;
|
|
198
|
+
dvs = this.toArray(defaultValue);
|
|
199
|
+
vals = this.toArray(value);
|
|
200
|
+
let count = 0;
|
|
201
|
+
let targetCount = dvs.length;
|
|
201
202
|
for (let i = 0; i < dvs.length; i++) {
|
|
202
203
|
for (let j = 0; j < vals.length; j++) {
|
|
203
204
|
if (dvs[i] == vals[j]) {
|
|
@@ -206,38 +207,38 @@ export default class ActionUtils {
|
|
|
206
207
|
}
|
|
207
208
|
}
|
|
208
209
|
}
|
|
209
|
-
return targetCount<=count;
|
|
210
|
+
return targetCount <= count;
|
|
210
211
|
case "Greater":
|
|
211
212
|
case "greater":
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
if (!isNaN(Number(value)) && !isNaN(Number(defaultValue))) {
|
|
214
|
+
return Number(value) > Number(defaultValue);
|
|
215
|
+
} else {
|
|
216
|
+
return value > defaultValue;
|
|
217
|
+
}
|
|
217
218
|
case "Less":
|
|
218
219
|
case "less":
|
|
219
|
-
if(!isNaN(Number(value)) && !isNaN(Number(defaultValue))){
|
|
220
|
+
if (!isNaN(Number(value)) && !isNaN(Number(defaultValue))) {
|
|
220
221
|
return Number(value) < Number(defaultValue);
|
|
221
|
-
}else{
|
|
222
|
+
} else {
|
|
222
223
|
return value < defaultValue;
|
|
223
224
|
}
|
|
224
225
|
case "noGreater":
|
|
225
226
|
case "nogreater":
|
|
226
|
-
if(!isNaN(Number(value)) && !isNaN(Number(defaultValue))){
|
|
227
|
+
if (!isNaN(Number(value)) && !isNaN(Number(defaultValue))) {
|
|
227
228
|
return Number(value) <= Number(defaultValue);
|
|
228
|
-
}else{
|
|
229
|
-
return value<=defaultValue;
|
|
229
|
+
} else {
|
|
230
|
+
return value <= defaultValue;
|
|
230
231
|
}
|
|
231
232
|
case "noLess":
|
|
232
233
|
case "noless":
|
|
233
|
-
if(!isNaN(Number(value)) && !isNaN(Number(defaultValue))){
|
|
234
|
+
if (!isNaN(Number(value)) && !isNaN(Number(defaultValue))) {
|
|
234
235
|
return Number(value) >= Number(defaultValue);
|
|
235
|
-
}else{
|
|
236
|
-
return value>=defaultValue;
|
|
236
|
+
} else {
|
|
237
|
+
return value >= defaultValue;
|
|
237
238
|
}
|
|
238
239
|
case "unequal":
|
|
239
240
|
case "unequals":
|
|
240
|
-
return !this.isEqual(value,defaultValue);
|
|
241
|
+
return !this.isEqual(value, defaultValue);
|
|
241
242
|
default:
|
|
242
243
|
message.error(
|
|
243
244
|
"暂不支持的比较关系:" + comparator + ";请联系管理员添加。",
|
|
@@ -247,41 +248,41 @@ export default class ActionUtils {
|
|
|
247
248
|
}
|
|
248
249
|
}
|
|
249
250
|
|
|
250
|
-
static isEqual(value,defaultValue){
|
|
251
|
+
static isEqual(value, defaultValue) {
|
|
251
252
|
|
|
252
|
-
if(defaultValue=="是"||defaultValue=="否" || defaultValue=="true" || defaultValue=="false"){
|
|
253
|
-
if(value=="true" || value=="是"
|
|
254
|
-
if(defaultValue=="是" || defaultValue=="true"){
|
|
253
|
+
if (defaultValue == "是" || defaultValue == "否" || defaultValue == "true" || defaultValue == "false") {
|
|
254
|
+
if (value == "true" || value == "是") {
|
|
255
|
+
if (defaultValue == "是" || defaultValue == "true") {
|
|
255
256
|
return true;
|
|
256
|
-
}else{
|
|
257
|
+
} else {
|
|
257
258
|
return false;
|
|
258
259
|
}
|
|
259
|
-
}else if(value=="false" || value=="否"
|
|
260
|
-
if(defaultValue=="否" || defaultValue=="false"){
|
|
260
|
+
} else if (value == "false" || value == "否") {
|
|
261
|
+
if (defaultValue == "否" || defaultValue == "false") {
|
|
261
262
|
return true;
|
|
262
|
-
}else{
|
|
263
|
+
} else {
|
|
263
264
|
return false;
|
|
264
265
|
}
|
|
265
|
-
}else{
|
|
266
|
+
} else {
|
|
266
267
|
return false;
|
|
267
268
|
}
|
|
268
|
-
}else{
|
|
269
|
-
if(!isNaN(Number(value)) && !isNaN(Number(defaultValue))){
|
|
269
|
+
} else {
|
|
270
|
+
if (!isNaN(Number(value)) && !isNaN(Number(defaultValue))) {
|
|
270
271
|
return Number(value) == Number(defaultValue);
|
|
271
|
-
}else{
|
|
272
|
-
return value==defaultValue;
|
|
272
|
+
} else {
|
|
273
|
+
return value == defaultValue;
|
|
273
274
|
}
|
|
274
275
|
}
|
|
275
276
|
}
|
|
276
277
|
|
|
277
|
-
static toArray(value){
|
|
278
|
+
static toArray(value) {
|
|
278
279
|
let val;
|
|
279
|
-
if(typeof value == "string"){
|
|
280
|
+
if (typeof value == "string") {
|
|
280
281
|
val = value.split(",");
|
|
281
|
-
} else if(Array.isArray(value)){
|
|
282
|
-
val= value;
|
|
283
|
-
}else{
|
|
284
|
-
val= [value];
|
|
282
|
+
} else if (Array.isArray(value)) {
|
|
283
|
+
val = value;
|
|
284
|
+
} else {
|
|
285
|
+
val = [value];
|
|
285
286
|
}
|
|
286
287
|
return val;
|
|
287
288
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { CSSProperties } from "react";
|
|
1
|
+
import React, { CSSProperties, useEffect, useState, useRef } from "react";
|
|
2
2
|
import { Badge, Dropdown, Menu, Button } from "antd";
|
|
3
3
|
import { BellOutlined } from "@ant-design/icons";
|
|
4
4
|
import "antd/dist/reset.css";
|
|
@@ -6,6 +6,7 @@ import { Level2Menu } from "../../tmpl/interface";
|
|
|
6
6
|
import HcserviceV3 from "../../tmpl/hcservice-v3";
|
|
7
7
|
import { NavLink } from "react-router-dom";
|
|
8
8
|
import HCDataSource from "../../tmpl/hc-data-source";
|
|
9
|
+
import WebSocket from "../../tmpl/web-socket";
|
|
9
10
|
import Units from "../../units";
|
|
10
11
|
import "./message-bar.less";
|
|
11
12
|
|
|
@@ -20,61 +21,51 @@ interface MessageBar {
|
|
|
20
21
|
count: number;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class L2MenuMessageBar extends React.PureComponent<
|
|
29
|
-
L2MenuMessageBarProps,
|
|
30
|
-
L2MenuMessageBarState
|
|
31
|
-
> {
|
|
32
|
-
state = {
|
|
33
|
-
messageBars: undefined,
|
|
34
|
-
anyState: false,
|
|
35
|
-
};
|
|
36
|
-
static defaultProps = {
|
|
37
|
-
backgroudColor: "#4a5f74",
|
|
38
|
-
};
|
|
24
|
+
const Index = (props: L2MenuMessageBarProps) => {
|
|
25
|
+
const { backgroudColor, style = {}, version = "v2" } = props;
|
|
26
|
+
const [messageBars, setMessageBars] = useState<MessageBar[]>([]);
|
|
27
|
+
const wsRef = useRef(undefined); // 实时数据websocket连接
|
|
28
|
+
const subscribeRef = useRef(undefined); // 实时数据订阅
|
|
39
29
|
|
|
40
|
-
async
|
|
30
|
+
const getMessageBars = async () => {
|
|
41
31
|
let l2Menus = await HCDataSource.fastMenu("MessageBar");
|
|
42
|
-
const
|
|
43
|
-
|
|
32
|
+
const temArr: MessageBar[] = [];
|
|
44
33
|
if (l2Menus) {
|
|
45
34
|
for (const item of l2Menus) {
|
|
46
35
|
if (item.disabled) {
|
|
47
36
|
continue;
|
|
48
37
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
count: 0,
|
|
52
|
-
};
|
|
53
|
-
let that = this;
|
|
54
|
-
setInterval(async () => {
|
|
55
|
-
let count = await HcserviceV3.requestLtmplCount(null, item.id);
|
|
56
|
-
messageBar.count = count;
|
|
57
|
-
this.setState({
|
|
58
|
-
anyState: !this.state.anyState,
|
|
59
|
-
});
|
|
60
|
-
}, 60000);
|
|
38
|
+
|
|
39
|
+
const messageBar: MessageBar = { l2Menu: item, count: 0 };
|
|
61
40
|
let count = await HcserviceV3.requestLtmplCount(null, item.id);
|
|
62
41
|
messageBar.count = count;
|
|
63
|
-
|
|
42
|
+
temArr.push(messageBar);
|
|
64
43
|
}
|
|
65
44
|
}
|
|
45
|
+
setMessageBars(temArr);
|
|
46
|
+
if (temArr?.length) getWebSocketMessageBar();
|
|
47
|
+
}
|
|
66
48
|
|
|
67
|
-
|
|
68
|
-
|
|
49
|
+
// 订阅消息数据
|
|
50
|
+
const getWebSocketMessageBar = async () => {
|
|
51
|
+
if (subscribeRef.current) { subscribeRef.current.unsubscribe(); }
|
|
52
|
+
wsRef.current = WebSocket.getInstance("v3/kk-ws");
|
|
53
|
+
subscribeRef.current = await wsRef.current.subscribe("/user/queue/bar-messages", {}, (data) => {
|
|
54
|
+
const temData = data?.message?.[0] || {};
|
|
55
|
+
setMessageBars(val => val.map(r => r.l2Menu.id === temData.menuId ? { ...r, count: temData.count } : r));
|
|
69
56
|
});
|
|
70
57
|
}
|
|
71
58
|
|
|
72
|
-
|
|
73
|
-
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
getMessageBars();
|
|
61
|
+
return () => {
|
|
62
|
+
if (subscribeRef.current) { subscribeRef.current.unsubscribe(); }
|
|
63
|
+
}
|
|
64
|
+
}, []);
|
|
65
|
+
|
|
66
|
+
const renderMessageBar = () => {
|
|
74
67
|
let total: number = 0;
|
|
75
|
-
const syyy: CSSProperties = {
|
|
76
|
-
"--message-bar-backgroupd": backgroudColor,
|
|
77
|
-
} as CSSProperties;
|
|
68
|
+
const syyy: CSSProperties = { "--message-bar-backgroupd": backgroudColor } as CSSProperties;
|
|
78
69
|
const menu = (
|
|
79
70
|
<Menu key={1}>
|
|
80
71
|
{messageBars.map((messageBar, index) => {
|
|
@@ -83,11 +74,7 @@ class L2MenuMessageBar extends React.PureComponent<
|
|
|
83
74
|
}
|
|
84
75
|
let defaultCriteriaData = "";
|
|
85
76
|
if (messageBar.l2Menu.defaultCriteriaValue) {
|
|
86
|
-
defaultCriteriaData =
|
|
87
|
-
"&" +
|
|
88
|
-
Units.transQueryParamsToStr(
|
|
89
|
-
messageBar.l2Menu.defaultCriteriaValue
|
|
90
|
-
);
|
|
77
|
+
defaultCriteriaData = "&" + Units.transQueryParamsToStr(messageBar.l2Menu.defaultCriteriaValue);
|
|
91
78
|
}
|
|
92
79
|
return (
|
|
93
80
|
<Menu.Item key={index}>
|
|
@@ -107,16 +94,15 @@ class L2MenuMessageBar extends React.PureComponent<
|
|
|
107
94
|
})}
|
|
108
95
|
</Menu>
|
|
109
96
|
);
|
|
110
|
-
|
|
111
|
-
if (!messageBars || messageBars.length == 0) {
|
|
97
|
+
if (!messageBars?.length) {
|
|
112
98
|
return;
|
|
113
|
-
}
|
|
99
|
+
}
|
|
100
|
+
if (messageBars.length == 1) {
|
|
114
101
|
let messageBar = messageBars[0];
|
|
115
102
|
const l2Menu = messageBar.l2Menu;
|
|
116
103
|
let defaultCriteriaData = "";
|
|
117
104
|
if (l2Menu.defaultCriteriaValue) {
|
|
118
|
-
defaultCriteriaData =
|
|
119
|
-
"&" + Units.transQueryParamsToStr(l2Menu.defaultCriteriaValue);
|
|
105
|
+
defaultCriteriaData = "&" + Units.transQueryParamsToStr(l2Menu.defaultCriteriaValue);
|
|
120
106
|
}
|
|
121
107
|
return (
|
|
122
108
|
<div style={syyy}>
|
|
@@ -151,13 +137,7 @@ class L2MenuMessageBar extends React.PureComponent<
|
|
|
151
137
|
return (
|
|
152
138
|
<Dropdown overlay={menu} placement="bottomCenter">
|
|
153
139
|
<div style={syyy}>
|
|
154
|
-
<Badge
|
|
155
|
-
count={total}
|
|
156
|
-
size="small"
|
|
157
|
-
overflowCount={99}
|
|
158
|
-
offset={[6, 0]}
|
|
159
|
-
className="ripple-dot"
|
|
160
|
-
>
|
|
140
|
+
<Badge size="small" count={total} overflowCount={99} offset={[6, -2]} className="ripple-dot">
|
|
161
141
|
<Button
|
|
162
142
|
icon={<BellOutlined />}
|
|
163
143
|
shape="default"
|
|
@@ -179,10 +159,7 @@ class L2MenuMessageBar extends React.PureComponent<
|
|
|
179
159
|
}
|
|
180
160
|
};
|
|
181
161
|
|
|
182
|
-
|
|
183
|
-
const { messageBars } = this.state;
|
|
184
|
-
return <>{messageBars ? this.renderMessageBar(messageBars) : ""}</>;
|
|
185
|
-
}
|
|
162
|
+
return messageBars?.length ? renderMessageBar() : "";
|
|
186
163
|
}
|
|
187
164
|
|
|
188
|
-
export default
|
|
165
|
+
export default Index;
|
|
@@ -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
|
}));
|