coolcare-lite-scada-component 4.1.4 → 4.1.5

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/es/typings.d.ts CHANGED
@@ -1,223 +1,224 @@
1
- /* eslint-disable @typescript-eslint/consistent-type-imports */
2
- interface Window {
3
- /** 组态模式:分编辑和查看 */
4
- scadaMode: 'edit' | 'player';
5
- graph: import('@antv/x6').Graph; // https://stackoverflow.com/a/58375303
6
- echarts: any;
7
- /** 开发调试时用的 */
8
- $emitter: import('mitt').Emitter<any>;
9
- }
10
-
11
- declare const REACT_APP_ENV: 'dev' | 'prod' | 'staging' | string;
12
-
13
- /**
14
- * 编辑场景
15
- * * production: 指定单个产品
16
- * * device: 指定单个设备
17
- * * freedom: 自由选择设备,可选择当前账号下有权限的设备。
18
- */
19
- type EditScene = 'product' | 'device' | 'freedom';
20
-
21
- type EditorQuery =
22
- | {
23
- scene: 'product';
24
- /** scene = 'production' 时传 产品 id */
25
- productId: string;
26
- /** 产品版本号 */
27
- productVersionId: string;
28
- /** 组态类型:web | app */
29
- scadaType: '0' | '1';
30
- /** 来源 */
31
- from?: string;
32
- /** 公司 id */
33
- companyId: string;
34
- /** 项目 id */
35
- projectId?: string;
36
- }
37
- | {
38
- scene: 'device';
39
- /** 公司 id */
40
- companyId: string;
41
- /** 项目 id */
42
- projectId?: string;
43
- /** scene = 'device' 时传设备 id */
44
- deviceId: string;
45
- /** 组态类型:web | app */
46
- scadaType: '0' | '1';
47
- /** 来源 */
48
- from?: string;
49
- }
50
- | {
51
- scene: 'freedom';
52
- /** 组态 id */
53
- scadaId: string;
54
- /** 组态标题 */
55
- title: string;
56
- /** 来源 */
57
- from?: string;
58
- /** 公司 id */
59
- companyId: string;
60
- /** 项目 id */
61
- projectId?: string;
62
- // 权限
63
- premission?: string;
64
- };
65
-
66
- type PlayerQuery =
67
- | {
68
- /** 通过输入的环境名 env, 决定接口调用的地址,默认是 prod */
69
- env?: 'prod' | 'staging' | 'dev';
70
- /** 请求地址 */
71
- reqUrl?: string;
72
- /** 使用场景 */
73
- scene: 'product';
74
- /** scene = 'production' 时传 产品 id */
75
- productId: string;
76
- /** 产品版本号 */
77
- productVersionId: string;
78
- /** 组态类型:web | app */
79
- scadaType: '0' | '1';
80
- /** 开启 panning 选项来支持拖拽平移 */
81
- panningEnable?: 'true' | 'false';
82
- /** 缩放模式
83
- *
84
- * width: 等比缩放宽度铺满
85
- *
86
- * auto: 默认值,等比的情况下,尽量全屏铺满
87
- */
88
- zoomMode?: 'width' | 'auto';
89
- /** token */
90
- token?: string;
91
- /** 刷新token */
92
- xToken?: string;
93
- /** 公司 id */
94
- companyId: string;
95
- /** 项目 id */
96
- projectId?: string;
97
- }
98
- | {
99
- /** 通过输入的环境名 env, 决定接口调用的地址,默认是 prod */
100
- env?: 'prod' | 'staging' | 'dev';
101
- /** 请求地址 */
102
- reqUrl?: string;
103
- /** 使用场景 */
104
- scene: 'device';
105
- /** scene = 'device' 时传设备 id */
106
- deviceId: string;
107
- /** 组态类型:web | app */
108
- scadaType: '0' | '1';
109
- /** 开启 panning 选项来支持拖拽平移 */
110
- panningEnable?: 'true' | 'false';
111
- /** 缩放模式
112
- *
113
- * width: 等比缩放宽度铺满
114
- *
115
- * auto: 默认值,等比的情况下,尽量全屏铺满
116
- */
117
- zoomMode?: 'width' | 'auto';
118
- /** token */
119
- token?: string;
120
- /** 刷新token */
121
- xToken?: string;
122
- }
123
- | {
124
- /** 通过输入的环境名 env, 决定接口调用的地址,默认是 prod */
125
- env?: 'prod' | 'staging' | 'dev';
126
- /** 请求地址 */
127
- reqUrl?: string;
128
- /** 使用场景 */
129
- scene: 'freedom';
130
- /** 组态 id */
131
- scadaId: string;
132
- /** 公司 id */
133
- companyId: string;
134
- /** 开启 panning 选项来支持拖拽平移 */
135
- panningEnable?: 'true' | 'false';
136
- /** 缩放模式
137
- *
138
- * width: 等比缩放宽度铺满
139
- *
140
- * auto: 默认值,等比的情况下,尽量全屏铺满
141
- */
142
- zoomMode?: 'width' | 'auto';
143
- /** token */
144
- token?: string;
145
- /** 刷新token */
146
- xToken?: string;
147
- /** 项目 id */
148
- projectId?: string;
149
- /** 权限 */
150
- premission: string;
151
- };
152
-
153
- type WindowCommunicateMsg =
154
- | {
155
- event: 'product-scada-config-change';
156
- payload: {
157
- /** 组态配置 json 字符串 */
158
- data: string;
159
- productId: number;
160
- productVersionId?: number;
161
- scadaType: GatewayAPI.EProductConfigurationType;
162
- operationUserId?: number;
163
- configHasChanged?: boolean;
164
- configChangeLog?: string;
165
- };
166
- }
167
- | {
168
- // 通知 parent window 刷新当前设备组态
169
- event: 'device-scada-config-change';
170
- payload: {
171
- deviceId: number;
172
- operationUserId?: number;
173
- configHasChanged?: boolean;
174
- configChangeLog?: string;
175
- };
176
- }
177
- | {
178
- // 请求 parent window 发送产品组态配置
179
- event: 'request-product-scada-config';
180
- payload: {
181
- productId: number;
182
- productVersionId: number;
183
- scadaType: GatewayAPI.EProductConfigurationType;
184
- };
185
- }
186
- | {
187
- // parent window 发送产品组态配置到当前 window
188
- event: 'response-product-scada-config';
189
- /** 产品组态配置 */
190
- payload: any;
191
- };
192
-
193
- // #region 为 Object.keys 定义类型 start
194
- type ObjectKeys<T> = T extends Record<string, unknown>
195
- ? (keyof T)[]
196
- : T extends number
197
- ? []
198
- : T extends any[] | string
199
- ? string[]
200
- : never;
201
-
202
- declare const COOLCARE_LITE_SCADA_VERSION: string;
203
-
204
- interface ObjectConstructor {
205
- // eslint-disable-next-line @typescript-eslint/method-signature-style
206
- keys<T>(o: T): ObjectKeys<T>;
207
- }
208
- // #endregion 为 Object.keys 定义类型 end
209
-
210
- type NestedKeyOf<ObjectType extends Record<string, any>> = {
211
- [Key in keyof ObjectType & (string | number)]: ObjectType[Key] extends Record<
212
- string,
213
- unknown
214
- >
215
- ? `${Key}` | `${Key}.${NestedKeyOf<ObjectType[Key]>}`
216
- : `${Key}`;
217
- }[keyof ObjectType & (string | number)];
218
- type RequiredDeep<T> = T extends Record<string, unknown>
219
- ? {
220
- [key in keyof T]-?: RequiredDeep<T[key]>;
221
- }
222
- : T;
223
- type NodeDataPaths<T> = NestedKeyOf<RequiredDeep<T>>;
1
+ /* eslint-disable @typescript-eslint/consistent-type-imports */
2
+ interface Window {
3
+ /** 组态模式:分编辑和查看 */
4
+ scadaMode: 'edit' | 'player';
5
+ graph: import('@antv/x6').Graph; // https://stackoverflow.com/a/58375303
6
+ echarts: any;
7
+ /** 开发调试时用的 */
8
+ $emitter: import('mitt').Emitter<any>;
9
+ }
10
+
11
+ declare const REACT_APP_ENV: 'dev' | 'prod' | 'staging' | string;
12
+
13
+ /**
14
+ * 编辑场景
15
+ * * production: 指定单个产品
16
+ * * device: 指定单个设备
17
+ * * freedom: 自由选择设备,可选择当前账号下有权限的设备。
18
+ */
19
+ type EditScene = 'product' | 'device' | 'freedom';
20
+
21
+ type EditorQuery = { editor?: '2d' | '3d' } & (
22
+ | {
23
+ scene: 'product';
24
+ /** scene = 'production' 时传 产品 id */
25
+ productId: string;
26
+ /** 产品版本号 */
27
+ productVersionId: string;
28
+ /** 组态类型:web | app */
29
+ scadaType: '0' | '1';
30
+ /** 来源 */
31
+ from?: string;
32
+ /** 公司 id */
33
+ companyId: string;
34
+ /** 项目 id */
35
+ projectId?: string;
36
+ }
37
+ | {
38
+ scene: 'device';
39
+ /** 公司 id */
40
+ companyId: string;
41
+ /** 项目 id */
42
+ projectId?: string;
43
+ /** scene = 'device' 时传设备 id */
44
+ deviceId: string;
45
+ /** 组态类型:web | app */
46
+ scadaType: '0' | '1';
47
+ /** 来源 */
48
+ from?: string;
49
+ }
50
+ | {
51
+ scene: 'freedom';
52
+ /** 组态 id */
53
+ scadaId: string;
54
+ /** 组态标题 */
55
+ title: string;
56
+ /** 来源 */
57
+ from?: string;
58
+ /** 公司 id */
59
+ companyId: string;
60
+ /** 项目 id */
61
+ projectId?: string;
62
+ // 权限
63
+ premission?: string;
64
+ }
65
+ );
66
+
67
+ type PlayerQuery =
68
+ | {
69
+ /** 通过输入的环境名 env, 决定接口调用的地址,默认是 prod */
70
+ env?: 'prod' | 'staging' | 'dev';
71
+ /** 请求地址 */
72
+ reqUrl?: string;
73
+ /** 使用场景 */
74
+ scene: 'product';
75
+ /** scene = 'production' 时传 产品 id */
76
+ productId: string;
77
+ /** 产品版本号 */
78
+ productVersionId: string;
79
+ /** 组态类型:web | app */
80
+ scadaType: '0' | '1';
81
+ /** 开启 panning 选项来支持拖拽平移 */
82
+ panningEnable?: 'true' | 'false';
83
+ /** 缩放模式
84
+ *
85
+ * width: 等比缩放宽度铺满
86
+ *
87
+ * auto: 默认值,等比的情况下,尽量全屏铺满
88
+ */
89
+ zoomMode?: 'width' | 'auto';
90
+ /** token */
91
+ token?: string;
92
+ /** 刷新token */
93
+ xToken?: string;
94
+ /** 公司 id */
95
+ companyId: string;
96
+ /** 项目 id */
97
+ projectId?: string;
98
+ }
99
+ | {
100
+ /** 通过输入的环境名 env, 决定接口调用的地址,默认是 prod */
101
+ env?: 'prod' | 'staging' | 'dev';
102
+ /** 请求地址 */
103
+ reqUrl?: string;
104
+ /** 使用场景 */
105
+ scene: 'device';
106
+ /** scene = 'device' 时传设备 id */
107
+ deviceId: string;
108
+ /** 组态类型:web | app */
109
+ scadaType: '0' | '1';
110
+ /** 开启 panning 选项来支持拖拽平移 */
111
+ panningEnable?: 'true' | 'false';
112
+ /** 缩放模式
113
+ *
114
+ * width: 等比缩放宽度铺满
115
+ *
116
+ * auto: 默认值,等比的情况下,尽量全屏铺满
117
+ */
118
+ zoomMode?: 'width' | 'auto';
119
+ /** token */
120
+ token?: string;
121
+ /** 刷新token */
122
+ xToken?: string;
123
+ }
124
+ | {
125
+ /** 通过输入的环境名 env, 决定接口调用的地址,默认是 prod */
126
+ env?: 'prod' | 'staging' | 'dev';
127
+ /** 请求地址 */
128
+ reqUrl?: string;
129
+ /** 使用场景 */
130
+ scene: 'freedom';
131
+ /** 组态 id */
132
+ scadaId: string;
133
+ /** 公司 id */
134
+ companyId: string;
135
+ /** 开启 panning 选项来支持拖拽平移 */
136
+ panningEnable?: 'true' | 'false';
137
+ /** 缩放模式
138
+ *
139
+ * width: 等比缩放宽度铺满
140
+ *
141
+ * auto: 默认值,等比的情况下,尽量全屏铺满
142
+ */
143
+ zoomMode?: 'width' | 'auto';
144
+ /** token */
145
+ token?: string;
146
+ /** 刷新token */
147
+ xToken?: string;
148
+ /** 项目 id */
149
+ projectId?: string;
150
+ /** 权限 */
151
+ premission: string;
152
+ };
153
+
154
+ type WindowCommunicateMsg =
155
+ | {
156
+ event: 'product-scada-config-change';
157
+ payload: {
158
+ /** 组态配置 json 字符串 */
159
+ data: string;
160
+ productId: number;
161
+ productVersionId?: number;
162
+ scadaType: GatewayAPI.EProductConfigurationType;
163
+ operationUserId?: number;
164
+ configHasChanged?: boolean;
165
+ configChangeLog?: string;
166
+ };
167
+ }
168
+ | {
169
+ // 通知 parent window 刷新当前设备组态
170
+ event: 'device-scada-config-change';
171
+ payload: {
172
+ deviceId: number;
173
+ operationUserId?: number;
174
+ configHasChanged?: boolean;
175
+ configChangeLog?: string;
176
+ };
177
+ }
178
+ | {
179
+ // 请求 parent window 发送产品组态配置
180
+ event: 'request-product-scada-config';
181
+ payload: {
182
+ productId: number;
183
+ productVersionId: number;
184
+ scadaType: GatewayAPI.EProductConfigurationType;
185
+ };
186
+ }
187
+ | {
188
+ // parent window 发送产品组态配置到当前 window
189
+ event: 'response-product-scada-config';
190
+ /** 产品组态配置 */
191
+ payload: any;
192
+ };
193
+
194
+ // #region 为 Object.keys 定义类型 start
195
+ type ObjectKeys<T> = T extends Record<string, unknown>
196
+ ? (keyof T)[]
197
+ : T extends number
198
+ ? []
199
+ : T extends any[] | string
200
+ ? string[]
201
+ : never;
202
+
203
+ declare const COOLCARE_LITE_SCADA_VERSION: string;
204
+
205
+ interface ObjectConstructor {
206
+ // eslint-disable-next-line @typescript-eslint/method-signature-style
207
+ keys<T>(o: T): ObjectKeys<T>;
208
+ }
209
+ // #endregion 为 Object.keys 定义类型 end
210
+
211
+ type NestedKeyOf<ObjectType extends Record<string, any>> = {
212
+ [Key in keyof ObjectType & (string | number)]: ObjectType[Key] extends Record<
213
+ string,
214
+ unknown
215
+ >
216
+ ? `${Key}` | `${Key}.${NestedKeyOf<ObjectType[Key]>}`
217
+ : `${Key}`;
218
+ }[keyof ObjectType & (string | number)];
219
+ type RequiredDeep<T> = T extends Record<string, unknown>
220
+ ? {
221
+ [key in keyof T]-?: RequiredDeep<T[key]>;
222
+ }
223
+ : T;
224
+ type NodeDataPaths<T> = NestedKeyOf<RequiredDeep<T>>;
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "coolcare-lite-scada-component",
3
- "version": "4.1.4",
3
+ "version": "4.1.5",
4
4
  "scripts": {
5
5
  "start": "cross-env PORT=8000 UMI_ENV=prod umi dev",
6
- "build:prod": "cross-env UMI_ENV=prod umi build",
7
- "build:generalfushi": "cross-env UMI_ENV=prod REACT_APP_PLATFORM=generalfushi umi build",
8
- "build:yimin": "cross-env UMI_ENV=prod REACT_APP_PLATFORM=yimin umi build",
9
- "build:staging": "cross-env UMI_ENV=staging umi build",
6
+ "prepare:3d": "node scripts/build-scada.mjs studio",
7
+ "preview:3d": "node scripts/preview-scada.mjs",
8
+ "build:prod": "node scripts/build-scada.mjs prod",
9
+ "build:generalfushi": "node scripts/build-scada.mjs generalfushi",
10
+ "build:yimin": "node scripts/build-scada.mjs yimin",
11
+ "build:staging": "node scripts/build-scada.mjs staging",
12
+ "test:3d": "node scripts/test-scada.mjs",
10
13
  "build:component": "father build",
11
14
  "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
12
15
  "test": "umi-test",