coolcare-lite-scada-component 4.1.3 → 4.1.4-hangxin.2

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 (50) hide show
  1. package/README.md +31 -1
  2. package/es/components/BoxShadowPicker/index.less.d.ts +9 -9
  3. package/es/components/ColorPicker/util.js +4 -4
  4. package/es/components/DialogHistory/index.js +6 -23
  5. package/es/components/ECharts/index.js +30 -41
  6. package/es/components/Icon/index.js +4 -3
  7. package/es/components/Icon/scada.js +40 -0
  8. package/es/components/IconFont/index.js +1 -1
  9. package/es/components/ImageUploader/index.js +15 -7
  10. package/es/constant.js +2 -2
  11. package/es/element/BorderBox/util/typings.d.ts +9 -9
  12. package/es/element/Decoration/util/typings.d.ts +9 -9
  13. package/es/element/EleFan/Component.js +1 -1
  14. package/es/element/EleState/index.js +1 -1
  15. package/es/element/PipeNodes/NodeBL/index.js +1 -1
  16. package/es/element/PipeNodes/NodeBR/index.js +1 -1
  17. package/es/element/PipeNodes/NodeBottom/index.js +1 -1
  18. package/es/element/PipeNodes/NodeCenter/index.js +1 -1
  19. package/es/element/PipeNodes/NodeHorizontal/index.js +1 -1
  20. package/es/element/PipeNodes/NodeLeft/index.js +1 -1
  21. package/es/element/PipeNodes/NodeRight/index.js +1 -1
  22. package/es/element/PipeNodes/NodeTL/index.js +1 -1
  23. package/es/element/PipeNodes/NodeTR/index.js +1 -1
  24. package/es/element/PipeNodes/NodeTop/index.js +1 -1
  25. package/es/element/PipeNodes/NodeVertical/index.js +1 -1
  26. package/es/pages/display/components/Tools/index.js +1 -1
  27. package/es/pages/document.ejs +1 -1
  28. package/es/pages/editor/PanelLeft/BasicShapeList/listData.js +8 -8
  29. package/es/pages/editor/PanelLeft/BorderBoxEleList/index.less.d.ts +7 -7
  30. package/es/pages/editor/PanelLeft/DecorationEleList/index.less.d.ts +7 -7
  31. package/es/pages/editor/PanelLeft/GroupManageDialog/index.js +4 -4
  32. package/es/pages/editor/PanelLeft/MetaEleList/listData.js +11 -11
  33. package/es/pages/editor/PanelLeft/PipeEleList/listData.js +11 -11
  34. package/es/pages/editor/PanelLeft/PointCardEleList/listData.js +6 -6
  35. package/es/pages/editor/PanelLeft/RecommendEleList/listData.js +3 -3
  36. package/es/pages/editor/PanelLeft/index.js +3 -3
  37. package/es/pages/editor/PanelRight/index.less.d.ts +7 -7
  38. package/es/pages/editor/index.js +1 -1
  39. package/es/services/common/Uploader.js +2 -3
  40. package/es/services/common/typings.d.ts +15 -15
  41. package/es/services/master/typings.d.ts +362 -362
  42. package/es/services/product/typings.d.ts +1045 -1045
  43. package/es/services/project/typings.d.ts +1609 -1609
  44. package/es/services/request.js +7 -6
  45. package/es/shims.x6.d.ts +15 -15
  46. package/es/utils/cssStyle.js +4 -4
  47. package/es/utils/decomposeMatrix.js +5 -5
  48. package/es/utils/events.js +3 -3
  49. package/es/utils/index.js +34 -34
  50. package/package.json +1 -1
package/README.md CHANGED
@@ -14,8 +14,38 @@ Start the dev server,
14
14
  $ yarn start
15
15
  ```
16
16
 
17
+ ## 航信部署与编辑入口
18
+
19
+ 运行 `yarn build:prod` 生成独立站点 `dist`。组件包构建 `yarn build:component`
20
+ 只用于业务系统内嵌播放器,不会生成独立编辑站点。
21
+
22
+ 编辑页使用 `/scada/editor`,兼容入口 `/scada/edito`;播放器使用 `/scada/player`。
23
+ 打开编辑页时需保留业务入口携带的查询参数(例如 `scene`、`scadaType`、设备或页面 ID)。
24
+ SCADA 图标已随 JS 打包,无需在 MinIO 上传 `cdn-asset/iconfont/scada.js`。
25
+ 图标源文件:`https://cdn-asset.oss-cn-shanghai.aliyuncs.com/iconfont/scada.js`。
26
+
27
+ 将独立站点部署到本项目的 Nginx 服务(端口 8200),并在外层网关主站的
28
+ `location /` 前配置 SCADA 转发。下面的上游域名需替换为实际服务地址:
29
+
30
+ ```nginx
31
+ location = /scada {
32
+ return 302 /scada/$is_args$args;
33
+ }
34
+ location ^~ /scada/ {
35
+ proxy_pass http://SCADA_SERVICE:8200;
36
+ proxy_set_header Host $host;
37
+ proxy_set_header X-Real-IP $remote_addr;
38
+ proxy_set_header X-Forwarded-Proto $scheme;
39
+ }
40
+ ```
41
+
42
+ 本项目 `nginx.conf` 同时支持网关保留或去掉 `/scada/` 前缀。
43
+ 验证编辑页以及 `/scada/umi.<hash>.js` 均返回 SCADA 的内容;若编辑页跳转到
44
+ SmartCare 登录页、HTML 加载的是根路径 `/umi.<hash>.js`,说明请求仍被主站接管,
45
+ 需要修正网关路由。修改本项目的前端路由不能替代这一步。
46
+
17
47
  ## 约定
18
48
 
19
49
  * 所有元件的 `name` 以 `el`开头。
20
50
 
21
- * player 页面不能使用 windicss, 因为要单独打包组件。
51
+ * player 页面不能使用 windicss, 因为要单独打包组件。
@@ -1,9 +1,9 @@
1
- // This file is automatically generated.
2
- // Please do not change this file!
3
- interface CssExports {
4
- 'box-shadow-picker-wrap': string;
5
- 'color-picker': string;
6
- 'input-label': string;
7
- }
8
- export const cssExports: CssExports;
9
- export default cssExports;
1
+ // This file is automatically generated.
2
+ // Please do not change this file!
3
+ interface CssExports {
4
+ 'box-shadow-picker-wrap': string;
5
+ 'color-picker': string;
6
+ 'input-label': string;
7
+ }
8
+ export const cssExports: CssExports;
9
+ export default cssExports;
@@ -1,7 +1,7 @@
1
- /**
2
- * 求 rgba 值的 hex 和 透明度
3
- * @param color
4
- * @returns
1
+ /**
2
+ * 求 rgba 值的 hex 和 透明度
3
+ * @param color
4
+ * @returns
5
5
  */
6
6
  export function rgbaToHex(color) {
7
7
  var opacity = '1';
@@ -295,6 +295,8 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
295
295
  indicatorNoList: indicatorNo,
296
296
  pointIdList: idList,
297
297
  interval: interval
298
+ }, {
299
+ timeout: 60000
298
300
  });
299
301
  case 5:
300
302
  res = _context2.v;
@@ -430,23 +432,6 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
430
432
  type: 'inside',
431
433
  xAxisIndex: 0,
432
434
  filterMode: 'empty'
433
- }, {
434
- id: 'history-y-axis-zoom',
435
- type: 'slider',
436
- orient: 'vertical',
437
- yAxisIndex: yAxisData.map(function (_, index) {
438
- return index;
439
- }),
440
- filterMode: 'none',
441
- right: 8,
442
- top: 50,
443
- bottom: 80,
444
- width: 18,
445
- start: 0,
446
- end: 100,
447
- showDataShadow: false,
448
- showDetail: false,
449
- brushSelect: false
450
435
  }],
451
436
  legend: {
452
437
  show: true,
@@ -667,8 +652,8 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
667
652
  height: '500px'
668
653
  },
669
654
  onEvents: {
670
- datazoom: function datazoom() {
671
- var _chart$current3, _chart$current3$getEc, _option$dataZoom, _xZoom$start, _xZoom$end;
655
+ datazoom: function datazoom(params) {
656
+ var _chart$current3, _chart$current3$getEc;
672
657
  // 获取当前 echarts 实例
673
658
  var myChart = chart === null || chart === void 0 ? void 0 : (_chart$current3 = chart.current) === null || _chart$current3 === void 0 ? void 0 : (_chart$current3$getEc = _chart$current3.getEchartsInstance) === null || _chart$current3$getEc === void 0 ? void 0 : _chart$current3$getEc.call(_chart$current3);
674
659
  if (!myChart) return;
@@ -676,10 +661,8 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
676
661
  // 获取当前配置
677
662
  var option = myChart.getOption();
678
663
  // 获取缩放范围
679
- // Y zoom also emits this event; statistics use the first X zoom control.
680
- var xZoom = (_option$dataZoom = option.dataZoom) === null || _option$dataZoom === void 0 ? void 0 : _option$dataZoom[0];
681
- var startValue = (_xZoom$start = xZoom === null || xZoom === void 0 ? void 0 : xZoom.start) !== null && _xZoom$start !== void 0 ? _xZoom$start : 0;
682
- var endValue = (_xZoom$end = xZoom === null || xZoom === void 0 ? void 0 : xZoom.end) !== null && _xZoom$end !== void 0 ? _xZoom$end : 100;
664
+ var startValue = params.start;
665
+ var endValue = params.end;
683
666
  if (startValue === 0 && endValue === 100) {
684
667
  setDataZoom(false);
685
668
  return;
@@ -9,8 +9,7 @@ import { useEffect, useRef, useImperativeHandle, forwardRef } from 'react';
9
9
  import { Spin } from 'antd';
10
10
  import { useSize } from 'ahooks';
11
11
  // 引入 echarts 核心模块,核心模块提供了 echarts 使用必须要的接口。
12
-
13
- import { useExternal } from 'ahooks';
12
+ import { init } from 'echarts';
14
13
  import styles from "./index.css";
15
14
  /** 默认的颜色组 */
16
15
  export var defaultColors = ['#1890FF', '#04C74C', '#FFCD00', '#253076', '#8F30E9', '#03C7C3'];
@@ -22,12 +21,6 @@ var EChartsComponent = function EChartsComponent(_ref, ref) {
22
21
  _ref$loading = _ref.loading,
23
22
  loading = _ref$loading === void 0 ? false : _ref$loading,
24
23
  onEvents = _ref.onEvents;
25
- var echartLoaderStatus = useExternal('https://cdn.sinocold.net/package/echarts/5.2.2/echarts.min.js', {
26
- type: 'js',
27
- js: {
28
- async: true
29
- }
30
- });
31
24
  var wrapRef = useRef(null);
32
25
  /** wrap size */
33
26
  var size = useSize(wrapRef);
@@ -42,52 +35,48 @@ var EChartsComponent = function EChartsComponent(_ref, ref) {
42
35
  };
43
36
  });
44
37
  useEffect(function () {
45
- if (wrapRef.current && echartLoaderStatus === 'ready') {
46
- // 初始化图表
47
- // @ts-ignore
48
- chartInstance.current = window.echarts.init(wrapRef.current);
49
- // 绑定事件
50
- if (onEvents && chartInstance.current) {
38
+ if (!wrapRef.current) return;
39
+ var instance = init(wrapRef.current);
40
+ chartInstance.current = instance;
41
+ return function () {
42
+ instance.dispose();
43
+ chartInstance.current = null;
44
+ };
45
+ }, []);
46
+ useEffect(function () {
47
+ var instance = chartInstance.current;
48
+ if (!instance || !onEvents) return;
49
+ Object.keys(onEvents).forEach(function (eventName) {
50
+ instance.on(eventName, onEvents[eventName]);
51
+ });
52
+ return function () {
53
+ if (!instance.isDisposed()) {
51
54
  Object.keys(onEvents).forEach(function (eventName) {
52
- var _chartInstance$curren;
53
- (_chartInstance$curren = chartInstance.current) === null || _chartInstance$curren === void 0 ? void 0 : _chartInstance$curren.on(eventName, onEvents[eventName]);
55
+ instance.off(eventName, onEvents[eventName]);
54
56
  });
55
57
  }
56
- // wrapRef.current.style.removeProperty('position')
57
- return function () {
58
- var _chartInstance$curren3;
59
- // 组件卸载时,调用 ECharts 的销毁函数
60
- Object.keys(onEvents).forEach(function (eventName) {
61
- var _chartInstance$curren2;
62
- (_chartInstance$curren2 = chartInstance.current) === null || _chartInstance$curren2 === void 0 ? void 0 : _chartInstance$curren2.off(eventName);
63
- });
64
- (_chartInstance$curren3 = chartInstance.current) === null || _chartInstance$curren3 === void 0 ? void 0 : _chartInstance$curren3.dispose();
65
- };
66
- }
67
- return function () {};
68
- }, [echartLoaderStatus]);
58
+ };
59
+ }, [onEvents]);
69
60
  useEffect(function () {
70
- var _chartInstance$curren4;
61
+ var _chartInstance$curren;
71
62
  // 在 wrap 大小改变后,resize 图表
72
- (_chartInstance$curren4 = chartInstance.current) === null || _chartInstance$curren4 === void 0 ? void 0 : _chartInstance$curren4.resize();
63
+ (_chartInstance$curren = chartInstance.current) === null || _chartInstance$curren === void 0 ? void 0 : _chartInstance$curren.resize();
73
64
  }, [size]);
74
65
  useEffect(function () {
66
+ var _chartInstance$curren2, _chartInstance$curren3;
75
67
  // 监听 props.option, 变更后重新渲染图表
76
68
  if (!option) {
77
69
  // throw new Error('need echarts option');
78
70
  console.warn('need echarts option');
79
71
  }
80
- if (echartLoaderStatus === 'ready') {
81
- var _chartInstance$curren5, _chartInstance$curren6;
82
- // setOption 之前先 clear 图表,要不图表可能还会显示上一次的样子
83
- (_chartInstance$curren5 = chartInstance.current) === null || _chartInstance$curren5 === void 0 ? void 0 : _chartInstance$curren5.clear();
84
- (_chartInstance$curren6 = chartInstance.current) === null || _chartInstance$curren6 === void 0 ? void 0 : _chartInstance$curren6.setOption(_objectSpread({
85
- color: defaultColors
86
- }, option));
87
- }
88
- }, [option, echartLoaderStatus]);
72
+ // setOption 之前先 clear 图表,要不图表可能还会显示上一次的样子
73
+ (_chartInstance$curren2 = chartInstance.current) === null || _chartInstance$curren2 === void 0 ? void 0 : _chartInstance$curren2.clear();
74
+ (_chartInstance$curren3 = chartInstance.current) === null || _chartInstance$curren3 === void 0 ? void 0 : _chartInstance$curren3.setOption(_objectSpread({
75
+ color: defaultColors
76
+ }, option));
77
+ }, [option]);
89
78
  return /*#__PURE__*/React.createElement(Spin, {
90
- spinning: loading || echartLoaderStatus === 'loading',
79
+ spinning: loading,
91
80
  delay: 200
92
81
  }, /*#__PURE__*/React.createElement("div", {
93
82
  id: id,
@@ -1,5 +1,6 @@
1
1
  import { createFromIconfontCN } from '@ant-design/icons';
2
- var MyIcon = createFromIconfontCN({
3
- scriptUrl: 'https://cdn-asset.oss-cn-shanghai.aliyuncs.com/iconfont/scada.js' // 在 iconfont.cn 上生成
4
- });
2
+ import "./scada.js";
3
+
4
+ // Bundle the symbols so both the editor and component consumers work offline.
5
+ var MyIcon = createFromIconfontCN({});
5
6
  export default MyIcon;