aldehyde 0.2.454 → 0.2.456

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.
Files changed (124) hide show
  1. package/lib/layout/menu/l2menu-message-bar.d.ts +2 -22
  2. package/lib/layout/menu/l2menu-message-bar.d.ts.map +1 -1
  3. package/lib/layout/menu/l2menu-message-bar.js +82 -89
  4. package/lib/layout/menu/l2menu-message-bar.js.map +1 -1
  5. package/lib/layout/menu/message-bar.less +5 -0
  6. package/lib/lowcode-components/bar-chart/index.d.ts.map +1 -1
  7. package/lib/lowcode-components/bar-chart/index.js +9 -0
  8. package/lib/lowcode-components/bar-chart/index.js.map +1 -1
  9. package/lib/lowcode-components/base-image/index.d.ts.map +1 -1
  10. package/lib/lowcode-components/base-image/index.js +8 -0
  11. package/lib/lowcode-components/base-image/index.js.map +1 -1
  12. package/lib/lowcode-components/base-map/index.d.ts.map +1 -1
  13. package/lib/lowcode-components/base-map/index.js +9 -0
  14. package/lib/lowcode-components/base-map/index.js.map +1 -1
  15. package/lib/lowcode-components/capsule-bar-chart/index.d.ts.map +1 -1
  16. package/lib/lowcode-components/capsule-bar-chart/index.js +9 -0
  17. package/lib/lowcode-components/capsule-bar-chart/index.js.map +1 -1
  18. package/lib/lowcode-components/carousel/index.d.ts.map +1 -1
  19. package/lib/lowcode-components/carousel/index.js +10 -0
  20. package/lib/lowcode-components/carousel/index.js.map +1 -1
  21. package/lib/lowcode-components/circular-progress-chart/index.d.ts.map +1 -1
  22. package/lib/lowcode-components/circular-progress-chart/index.js +10 -0
  23. package/lib/lowcode-components/circular-progress-chart/index.js.map +1 -1
  24. package/lib/lowcode-components/column-3d-chart/index.d.ts.map +1 -1
  25. package/lib/lowcode-components/column-3d-chart/index.js +9 -0
  26. package/lib/lowcode-components/column-3d-chart/index.js.map +1 -1
  27. package/lib/lowcode-components/column-chart/index.d.ts.map +1 -1
  28. package/lib/lowcode-components/column-chart/index.js +9 -0
  29. package/lib/lowcode-components/column-chart/index.js.map +1 -1
  30. package/lib/lowcode-components/data-number/index.d.ts.map +1 -1
  31. package/lib/lowcode-components/data-number/index.js +9 -0
  32. package/lib/lowcode-components/data-number/index.js.map +1 -1
  33. package/lib/lowcode-components/effectScatter-map/index.d.ts.map +1 -1
  34. package/lib/lowcode-components/effectScatter-map/index.js +9 -0
  35. package/lib/lowcode-components/effectScatter-map/index.js.map +1 -1
  36. package/lib/lowcode-components/effectScatter-map-3d/index.d.ts.map +1 -1
  37. package/lib/lowcode-components/effectScatter-map-3d/index.js +9 -0
  38. package/lib/lowcode-components/effectScatter-map-3d/index.js.map +1 -1
  39. package/lib/lowcode-components/gauge-chart/index.d.ts.map +1 -1
  40. package/lib/lowcode-components/gauge-chart/index.js +9 -0
  41. package/lib/lowcode-components/gauge-chart/index.js.map +1 -1
  42. package/lib/lowcode-components/line-bar-chart/index.d.ts.map +1 -1
  43. package/lib/lowcode-components/line-bar-chart/index.js +10 -0
  44. package/lib/lowcode-components/line-bar-chart/index.js.map +1 -1
  45. package/lib/lowcode-components/line-chart/index.d.ts.map +1 -1
  46. package/lib/lowcode-components/line-chart/index.js +10 -0
  47. package/lib/lowcode-components/line-chart/index.js.map +1 -1
  48. package/lib/lowcode-components/liquid-chart/index.d.ts.map +1 -1
  49. package/lib/lowcode-components/liquid-chart/index.js +9 -0
  50. package/lib/lowcode-components/liquid-chart/index.js.map +1 -1
  51. package/lib/lowcode-components/lowcode-view/component/abstract-definition.d.ts +2 -2
  52. package/lib/lowcode-components/lowcode-view/component/abstract-definition.d.ts.map +1 -1
  53. package/lib/lowcode-components/lowcode-view/component/component-container.js.map +1 -1
  54. package/lib/lowcode-components/lowcode-view/component/component-controller.d.ts +9 -2
  55. package/lib/lowcode-components/lowcode-view/component/component-controller.d.ts.map +1 -1
  56. package/lib/lowcode-components/lowcode-view/component/component-controller.js +40 -4
  57. package/lib/lowcode-components/lowcode-view/component/component-controller.js.map +1 -1
  58. package/lib/lowcode-components/lowcode-view/index.d.ts.map +1 -1
  59. package/lib/lowcode-components/lowcode-view/index.js +53 -8
  60. package/lib/lowcode-components/lowcode-view/index.js.map +1 -1
  61. package/lib/lowcode-components/pie-chart/index.d.ts.map +1 -1
  62. package/lib/lowcode-components/pie-chart/index.js +9 -0
  63. package/lib/lowcode-components/pie-chart/index.js.map +1 -1
  64. package/lib/lowcode-components/progress-chart/index.d.ts.map +1 -1
  65. package/lib/lowcode-components/progress-chart/index.js +9 -0
  66. package/lib/lowcode-components/progress-chart/index.js.map +1 -1
  67. package/lib/lowcode-components/stroke-animation/index.d.ts.map +1 -1
  68. package/lib/lowcode-components/stroke-animation/index.js +9 -0
  69. package/lib/lowcode-components/stroke-animation/index.js.map +1 -1
  70. package/lib/lowcode-components/text-scroller/index.d.ts.map +1 -1
  71. package/lib/lowcode-components/text-scroller/index.js +9 -0
  72. package/lib/lowcode-components/text-scroller/index.js.map +1 -1
  73. package/lib/table/column/column-builder.d.ts.map +1 -1
  74. package/lib/table/column/column-builder.js +12 -1
  75. package/lib/table/column/column-builder.js.map +1 -1
  76. package/lib/tmpl/hc-data-source.d.ts.map +1 -1
  77. package/lib/tmpl/hc-data-source.js +36 -8
  78. package/lib/tmpl/hc-data-source.js.map +1 -1
  79. package/lib/tmpl/hcservice-v3.d.ts +2 -4
  80. package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
  81. package/lib/tmpl/hcservice-v3.js +14 -2
  82. package/lib/tmpl/hcservice-v3.js.map +1 -1
  83. package/lib/tmpl/interface.d.ts +1 -0
  84. package/lib/tmpl/interface.d.ts.map +1 -1
  85. package/lib/tmpl/interface.js.map +1 -1
  86. package/lib/tmpl/web-socket.js +1 -1
  87. package/lib/tmpl/web-socket.js.map +1 -1
  88. package/package.json +1 -1
  89. package/src/aldehyde/layout/menu/l2menu-message-bar.tsx +39 -62
  90. package/src/aldehyde/layout/menu/message-bar.less +5 -0
  91. package/src/aldehyde/lowcode-components/bar-chart/index.tsx +10 -0
  92. package/src/aldehyde/lowcode-components/base-image/index.tsx +9 -0
  93. package/src/aldehyde/lowcode-components/base-map/index.tsx +10 -0
  94. package/src/aldehyde/lowcode-components/capsule-bar-chart/index.tsx +10 -0
  95. package/src/aldehyde/lowcode-components/carousel/index.tsx +11 -0
  96. package/src/aldehyde/lowcode-components/circular-progress-chart/index.tsx +10 -0
  97. package/src/aldehyde/lowcode-components/column-3d-chart/index.tsx +10 -0
  98. package/src/aldehyde/lowcode-components/column-chart/index.tsx +11 -0
  99. package/src/aldehyde/lowcode-components/data-number/index.tsx +10 -0
  100. package/src/aldehyde/lowcode-components/data.d.ts +1 -0
  101. package/src/aldehyde/lowcode-components/effectScatter-map/index.tsx +10 -0
  102. package/src/aldehyde/lowcode-components/effectScatter-map-3d/index.tsx +10 -0
  103. package/src/aldehyde/lowcode-components/gauge-chart/index.tsx +10 -0
  104. package/src/aldehyde/lowcode-components/line-bar-chart/index.tsx +11 -0
  105. package/src/aldehyde/lowcode-components/line-chart/index.tsx +11 -0
  106. package/src/aldehyde/lowcode-components/liquid-chart/index.tsx +10 -0
  107. package/src/aldehyde/lowcode-components/lowcode-view/component/abstract-definition.ts +2 -2
  108. package/src/aldehyde/lowcode-components/lowcode-view/component/component-container.tsx +3 -3
  109. package/src/aldehyde/lowcode-components/lowcode-view/component/component-controller.ts +42 -3
  110. package/src/aldehyde/lowcode-components/lowcode-view/index.tsx +55 -8
  111. package/src/aldehyde/lowcode-components/pie-chart/index.tsx +10 -0
  112. package/src/aldehyde/lowcode-components/progress-chart/index.tsx +10 -0
  113. package/src/aldehyde/lowcode-components/stroke-animation/index.tsx +10 -0
  114. package/src/aldehyde/lowcode-components/text-scroller/index.tsx +10 -0
  115. package/src/aldehyde/table/column/column-builder.tsx +10 -1
  116. package/src/aldehyde/tmpl/hc-data-source.tsx +34 -8
  117. package/src/aldehyde/tmpl/hcservice-v3.tsx +14 -1
  118. package/src/aldehyde/tmpl/interface.tsx +1 -0
  119. package/src/aldehyde/tmpl/web-socket.ts +1 -1
  120. package/lib/lowcode-components/lowcode-view/component/abstract-designer-controller.d.ts +0 -28
  121. package/lib/lowcode-components/lowcode-view/component/abstract-designer-controller.d.ts.map +0 -1
  122. package/lib/lowcode-components/lowcode-view/component/abstract-designer-controller.js +0 -49
  123. package/lib/lowcode-components/lowcode-view/component/abstract-designer-controller.js.map +0 -1
  124. package/src/aldehyde/lowcode-components/lowcode-view/component/abstract-designer-controller.ts +0 -56
@@ -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
- interface L2MenuMessageBarState {
24
- messageBars?: MessageBar[];
25
- anyState?: boolean;
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 componentDidMount() {
30
+ const getMessageBars = async () => {
41
31
  let l2Menus = await HCDataSource.fastMenu("MessageBar");
42
- const messageBars: MessageBar[] = [];
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
- const messageBar: MessageBar = {
50
- l2Menu: item,
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
- messageBars.push(messageBar);
42
+ temArr.push(messageBar);
64
43
  }
65
44
  }
45
+ setMessageBars(temArr);
46
+ if (temArr?.length) getWebSocketMessageBar();
47
+ }
66
48
 
67
- this.setState({
68
- messageBars,
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
- renderMessageBar = (messageBars: MessageBar[]) => {
73
- const { backgroudColor, style = {}, version = "v2" } = this.props;
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
- } else if (messageBars.length == 1) {
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
- render() {
183
- const { messageBars } = this.state;
184
- return <>{messageBars ? this.renderMessageBar(messageBars) : ""}</>;
185
- }
162
+ return messageBars?.length ? renderMessageBar() : "";
186
163
  }
187
164
 
188
- export default L2MenuMessageBar;
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
  }));
@@ -8,6 +8,7 @@ export interface DataConfigProps {
8
8
  searchParams?: { [key: string]: any };
9
9
  isInitParams?: boolean;
10
10
  isDefRequest?: boolean;
11
+ wsData?: any;
11
12
  }
12
13
 
13
14
  export interface OssConfig {
@@ -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 AbstractDesignerController from "./abstract-designer-controller";
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: AbstractDesignerController, params?: any) => void;
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 AbstractDesignerController from "./abstract-designer-controller";
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: AbstractDesignerController) => {
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]: AbstractDesignerController }>({});
25
+ const [compController, setCompController] = useState<{ [key: string]: ComponentController }>({});
26
26
  const navigate = useNavigate();
27
27
  const { setControllers, setSearchParams } = useContext(ControllerContext);
28
28