@zgfe/business-lib 1.1.29-visual.8 → 1.1.29

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 (140) hide show
  1. package/es/addToPanel/components/addPanel.js +21 -8
  2. package/es/addToPanel/components/radioGroup.js +3 -1
  3. package/es/addToPanel/components/styleList.js +22 -5
  4. package/es/addToPanel/demo/edit.js +12 -5
  5. package/es/addToPanel/demo/index.js +12 -5
  6. package/es/addToPanel/index.js +58 -21
  7. package/es/addToScene/addGroup.js +4 -0
  8. package/es/addToScene/demo/index.js +12 -5
  9. package/es/addToScene/index.js +40 -13
  10. package/es/assets/demo/index.js +2 -0
  11. package/es/assets/demo/input.js +12 -5
  12. package/es/assets/iconfont/iconfont.js +17 -10
  13. package/es/assets/theme.js +1 -0
  14. package/es/attrConditions/components/operateList.js +27 -10
  15. package/es/attrConditions/components/stringList.js +97 -68
  16. package/es/attrConditions/components/valuesList.js +40 -14
  17. package/es/attrConditions/demo/group.js +23 -11
  18. package/es/attrConditions/demo/index.js +26 -17
  19. package/es/attrConditions/group.js +48 -17
  20. package/es/attrConditions/index.js +49 -22
  21. package/es/attrConditions/types.js +1 -0
  22. package/es/attributeSelector/demo/disable.js +16 -8
  23. package/es/attributeSelector/demo/index.js +17 -8
  24. package/es/attributeSelector/index.js +45 -22
  25. package/es/attributeSelector/listPanel.js +46 -18
  26. package/es/attributeSelector/option.js +13 -3
  27. package/es/attributeSelector/types.js +5 -0
  28. package/es/attributeSelector/util.js +3 -0
  29. package/es/chart/demo/index.js +14 -5
  30. package/es/chart/index.js +44 -30
  31. package/es/chart/util/chartOptionConfig.d.ts +3 -3
  32. package/es/chart/util/chartOptionConfig.js +37 -13
  33. package/es/chart/util/data/china.js +4 -1
  34. package/es/chart/util/formatData.d.ts +2 -2
  35. package/es/chart/util/formatData.js +5 -0
  36. package/es/chart/util/formatOption.js +13 -0
  37. package/es/chart/util/mapUtil.js +26 -5
  38. package/es/config.js +2 -0
  39. package/es/constants/apis.d.ts +0 -1
  40. package/es/constants/apis.js +1 -2
  41. package/es/cycleTime/demo/disable.js +1 -0
  42. package/es/cycleTime/index.js +46 -19
  43. package/es/cycleTime/month.js +27 -8
  44. package/es/datePicker/datePicker.js +23 -5
  45. package/es/datePicker/demo/customType.js +22 -13
  46. package/es/datePicker/demo/day.js +22 -13
  47. package/es/datePicker/demo/index.js +21 -12
  48. package/es/datePicker/index.js +41 -18
  49. package/es/datePicker/utils.js +7 -0
  50. package/es/demoWrapper/content.d.ts +1 -2
  51. package/es/demoWrapper/content.js +64 -42
  52. package/es/demoWrapper/demo/index.js +4 -5
  53. package/es/demoWrapper/head.d.ts +1 -3
  54. package/es/demoWrapper/head.js +27 -25
  55. package/es/demoWrapper/index.js +36 -28
  56. package/es/dialog/demo/index.js +12 -5
  57. package/es/dialog/index.js +6 -4
  58. package/es/dnd/demo/data.js +28 -19
  59. package/es/dnd/demo/handle.js +28 -19
  60. package/es/dnd/index.js +45 -21
  61. package/es/dnd/item.js +30 -10
  62. package/es/eventSelector/demo/index.js +23 -12
  63. package/es/eventSelector/index.js +42 -14
  64. package/es/eventSelector/listPanel.js +73 -31
  65. package/es/eventSelector/option.js +11 -6
  66. package/es/icon/iconFont.js +13 -7
  67. package/es/index.d.ts +1 -2
  68. package/es/index.js +1 -2
  69. package/es/layout/analysisLayout/demo/index.js +6 -0
  70. package/es/layout/analysisLayout/index.d.ts +1 -1
  71. package/es/layout/analysisLayout/index.js +34 -16
  72. package/es/layout/detail/index.js +3 -1
  73. package/es/loginForm/index.js +18 -7
  74. package/es/searchInput/index.js +7 -2
  75. package/es/select/demo/children.js +16 -8
  76. package/es/select/demo/customLabel.js +2 -0
  77. package/es/select/demo/group.js +17 -8
  78. package/es/select/demo/index.js +19 -11
  79. package/es/select/demo/loading.js +18 -8
  80. package/es/select/demo/multiple.js +16 -8
  81. package/es/select/handle.js +34 -14
  82. package/es/select/index.js +59 -22
  83. package/es/select/option.js +30 -10
  84. package/es/select/overlay.js +62 -25
  85. package/es/table/demo/data/table.js +2 -0
  86. package/es/table/demo/index.js +39 -13
  87. package/es/table/demo/index2.js +15 -5
  88. package/es/table/demo/index3.js +28 -7
  89. package/es/table/index.js +33 -14
  90. package/es/targetConditionGroup/components/targetDimension.js +38 -12
  91. package/es/targetConditionGroup/demo/group.js +36 -21
  92. package/es/targetConditionGroup/demo/index.js +13 -5
  93. package/es/targetConditionGroup/index.js +84 -31
  94. package/es/targetSelector/demo/index.js +28 -15
  95. package/es/targetSelector/editBox.js +20 -5
  96. package/es/targetSelector/index.js +36 -15
  97. package/es/targetSelector/optionIcon.js +5 -1
  98. package/es/targetSelector/optionMenu.js +3 -0
  99. package/es/userCondition/conditionTypeList.js +12 -7
  100. package/es/userCondition/conditionWrap.js +2 -0
  101. package/es/userCondition/conditions/cdpCondition.js +97 -51
  102. package/es/userCondition/conditions/eventCondition.js +16 -6
  103. package/es/userCondition/conditions/periodCondition.js +26 -8
  104. package/es/userCondition/conditions/propCondition.js +61 -29
  105. package/es/userCondition/conditions/runTimesCondition.js +10 -5
  106. package/es/userCondition/conditions/tagsCondition.d.ts +1 -1
  107. package/es/userCondition/conditions/tagsCondition.js +33 -15
  108. package/es/userCondition/conditions/textDesc.js +67 -16
  109. package/es/userCondition/demo/index.js +21 -11
  110. package/es/userCondition/index.js +91 -51
  111. package/es/userCondition/orConditions.js +48 -11
  112. package/es/userCondition/relationLabel.js +4 -1
  113. package/es/userCondition/types.d.ts +1 -1
  114. package/es/userCondition/types.js +1 -0
  115. package/es/userCondition/util.js +13 -4
  116. package/es/userGroup/demo/group.js +23 -14
  117. package/es/userGroup/demo/index.js +15 -5
  118. package/es/userGroup/index.js +30 -12
  119. package/es/userTagsSelector/cascaderOverlay.js +51 -19
  120. package/es/userTagsSelector/components/search/index.js +2 -0
  121. package/es/userTagsSelector/demo/index.js +3 -0
  122. package/es/userTagsSelector/groups/groupOption.js +8 -6
  123. package/es/userTagsSelector/groups/index.js +30 -15
  124. package/es/userTagsSelector/index.js +35 -17
  125. package/es/userTagsSelector/multipleCheckPanel/checkOption.js +6 -3
  126. package/es/userTagsSelector/multipleCheckPanel/index.js +21 -8
  127. package/es/userTagsSelector/util.js +2 -0
  128. package/es/utils/ajax.js +71 -45
  129. package/es/utils/base64.js +22 -3
  130. package/es/utils/type.d.ts +1 -1
  131. package/es/utils/type.js +7 -4
  132. package/es/utils/util.js +16 -0
  133. package/package.json +2 -2
  134. package/es/socket/demo/demo.d.ts +0 -2
  135. package/es/socket/demo/demo.js +0 -139
  136. package/es/socket/demo/index.less +0 -27
  137. package/es/socket/index.d.ts +0 -31
  138. package/es/socket/index.js +0 -284
  139. package/es/socket/types.d.ts +0 -37
  140. package/es/socket/types.js +0 -26
@@ -1,13 +1,23 @@
1
1
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+
2
3
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
3
5
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+
4
7
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
8
+
5
9
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
+
6
11
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
+
7
13
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
14
+
15
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
16
+
17
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
18
+
10
19
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
+
11
21
  import { Anchor, Button } from 'antd';
12
22
  import React, { useContext, useEffect, useMemo, useState } from 'react';
13
23
  import { BizGlobalDataContext } from '..';
@@ -15,29 +25,36 @@ import BizSearchInput from '../searchInput';
15
25
  import Option from './option';
16
26
  import _ from 'lodash';
17
27
  var Link = Anchor.Link;
28
+
18
29
  var AttrListPanel = function AttrListPanel(props) {
19
30
  var _props$disableItemLis;
31
+
20
32
  var id = props.id,
21
- enableEnvProp = props.enableEnvProp,
22
- enableEventProp = props.enableEventProp,
23
- enableUserProp = props.enableUserProp,
24
- eventIdList = props.eventIdList;
33
+ enableEnvProp = props.enableEnvProp,
34
+ enableEventProp = props.enableEventProp,
35
+ enableUserProp = props.enableUserProp,
36
+ eventIdList = props.eventIdList;
37
+
25
38
  var _useState = useState(''),
26
- _useState2 = _slicedToArray(_useState, 2),
27
- searchValue = _useState2[0],
28
- setSearchValue = _useState2[1];
39
+ _useState2 = _slicedToArray(_useState, 2),
40
+ searchValue = _useState2[0],
41
+ setSearchValue = _useState2[1];
42
+
29
43
  var _useContext = useContext(BizGlobalDataContext),
30
- eventGroupList = _useContext.eventGroupList,
31
- userPropList = _useContext.userPropList,
32
- eventEnvList = _useContext.eventEnvList;
44
+ eventGroupList = _useContext.eventGroupList,
45
+ userPropList = _useContext.userPropList,
46
+ eventEnvList = _useContext.eventEnvList;
47
+
33
48
  var _useState3 = useState([]),
34
- _useState4 = _slicedToArray(_useState3, 2),
35
- optionList = _useState4[0],
36
- setOptionList = _useState4[1];
49
+ _useState4 = _slicedToArray(_useState3, 2),
50
+ optionList = _useState4[0],
51
+ setOptionList = _useState4[1];
52
+
37
53
  var _useState5 = useState(),
38
- _useState6 = _slicedToArray(_useState5, 2),
39
- currentAttr = _useState6[0],
40
- setCurrentAttr = _useState6[1];
54
+ _useState6 = _slicedToArray(_useState5, 2),
55
+ currentAttr = _useState6[0],
56
+ setCurrentAttr = _useState6[1];
57
+
41
58
  var eventIdMap = useMemo(function () {
42
59
  var eventIdMap = {};
43
60
  var eventList = (eventGroupList || []).reduce(function (pre, group) {
@@ -57,6 +74,7 @@ var AttrListPanel = function AttrListPanel(props) {
57
74
  } else if (item.propCategory === 'userProp') {
58
75
  item.key = "userProp-".concat(item.name);
59
76
  }
77
+
60
78
  return item;
61
79
  });
62
80
  var anchor = {
@@ -68,6 +86,7 @@ var AttrListPanel = function AttrListPanel(props) {
68
86
  var classPrefix = 'biz-attr-select';
69
87
  useEffect(function () {
70
88
  var list = [];
89
+
71
90
  if (enableEventProp) {
72
91
  var hasAnchor = false;
73
92
  eventIdList === null || eventIdList === void 0 ? void 0 : eventIdList.forEach(function (id) {
@@ -83,6 +102,7 @@ var AttrListPanel = function AttrListPanel(props) {
83
102
  list.push(group);
84
103
  });
85
104
  }
105
+
86
106
  if (enableUserProp) {
87
107
  list.push({
88
108
  isEvent: false,
@@ -92,6 +112,7 @@ var AttrListPanel = function AttrListPanel(props) {
92
112
  children: userPropList
93
113
  });
94
114
  }
115
+
95
116
  if (enableEnvProp) {
96
117
  list.push({
97
118
  isEvent: false,
@@ -101,15 +122,18 @@ var AttrListPanel = function AttrListPanel(props) {
101
122
  children: eventEnvList
102
123
  });
103
124
  }
125
+
104
126
  setOptionList(list);
105
127
  }, [eventIdMap, userPropList, eventEnvList, eventIdList]);
106
128
  useEffect(function () {
107
129
  setCurrentAttr(props.value);
108
130
  }, [props.value]);
131
+
109
132
  function onClick(option) {
110
133
  setCurrentAttr(option);
111
134
  if (props.onChange) props.onChange(option);
112
135
  }
136
+
113
137
  var showList = function () {
114
138
  var list = [];
115
139
  optionList.map(function (group) {
@@ -125,6 +149,7 @@ var AttrListPanel = function AttrListPanel(props) {
125
149
  disableItemlist === null || disableItemlist === void 0 ? void 0 : disableItemlist.forEach(function (item) {
126
150
  if (item.key === option.key) disabled = true;
127
151
  });
152
+
128
153
  if (!(option === null || option === void 0 ? void 0 : option.isHidden)) {
129
154
  childList.push( /*#__PURE__*/React.createElement(Option, {
130
155
  option: option,
@@ -139,6 +164,7 @@ var AttrListPanel = function AttrListPanel(props) {
139
164
  }));
140
165
  }
141
166
  });
167
+
142
168
  if (childList.length) {
143
169
  list.push(head);
144
170
  list = list.concat(childList);
@@ -146,6 +172,7 @@ var AttrListPanel = function AttrListPanel(props) {
146
172
  });
147
173
  return list;
148
174
  }();
175
+
149
176
  if (!showList.length && !searchValue) return /*#__PURE__*/React.createElement("div", {
150
177
  className: "".concat(classPrefix, "-drowdown nodata")
151
178
  }, "\u6682\u65E0\u6570\u636E");
@@ -188,6 +215,7 @@ var AttrListPanel = function AttrListPanel(props) {
188
215
  className: "".concat(classPrefix, "-nodata")
189
216
  }, "\u6682\u65E0\u6570\u636E")));
190
217
  };
218
+
191
219
  AttrListPanel.defaultProps = {
192
220
  enableEnvProp: true,
193
221
  enableEventProp: false,
@@ -2,16 +2,19 @@ import React from 'react';
2
2
  import { IconFont } from '..';
3
3
  import { util } from '../utils';
4
4
  import { getIcon } from './util';
5
+
5
6
  var Option = function Option(props) {
6
7
  var option = props.option,
7
- group = props.group,
8
- checked = props.checked,
9
- disabled = props.disabled;
8
+ group = props.group,
9
+ checked = props.checked,
10
+ disabled = props.disabled;
10
11
  var classPrefix = 'biz-attr-select';
12
+
11
13
  function onClick() {
12
14
  if (disabled) return;
13
15
  if (props.onClick) props.onClick(option);
14
16
  }
17
+
15
18
  function getLabel(label) {
16
19
  if (!props.highlight || !props.highlight.enable || !props.highlight.text) return label;
17
20
  var text = props.highlight.text;
@@ -25,11 +28,14 @@ var Option = function Option(props) {
25
28
  }, text);
26
29
  });
27
30
  }
31
+
28
32
  function renderIcon(option) {
29
33
  var icon = '';
34
+
30
35
  if (option && option.name) {
31
36
  icon = getIcon(option.name);
32
37
  }
38
+
33
39
  if (icon) {
34
40
  return /*#__PURE__*/React.createElement(IconFont, {
35
41
  className: "".concat(classPrefix, "-option-icon"),
@@ -37,12 +43,14 @@ var Option = function Option(props) {
37
43
  type: icon
38
44
  });
39
45
  }
46
+
40
47
  icon = (option === null || option === void 0 ? void 0 : option.propCategory) === 'userProp' ? 'yonghushuxing' : (option === null || option === void 0 ? void 0 : option.propCategory) === 'eventProp' ? 'shijianshuxing1' : 'chufahuanjing';
41
48
  return /*#__PURE__*/React.createElement(IconFont, {
42
49
  className: "".concat(classPrefix, "-option-icon"),
43
50
  type: icon
44
51
  });
45
52
  }
53
+
46
54
  if (group) {
47
55
  return /*#__PURE__*/React.createElement("div", {
48
56
  id: group.anchor,
@@ -53,6 +61,7 @@ var Option = function Option(props) {
53
61
  title: group.isEvent ? "\u4E8B\u4EF6\u5C5E\u6027[".concat(group.groupName, "]") : group.groupName
54
62
  }, group.isEvent ? "\u4E8B\u4EF6\u5C5E\u6027[".concat(group.groupName, "]") : group.groupName));
55
63
  }
64
+
56
65
  return /*#__PURE__*/React.createElement("div", {
57
66
  className: "".concat(classPrefix, "-option ").concat(checked ? 'active' : '', " ").concat(disabled ? 'disabled' : ''),
58
67
  onClick: onClick
@@ -60,4 +69,5 @@ var Option = function Option(props) {
60
69
  title: (option === null || option === void 0 ? void 0 : option.alias) || (option === null || option === void 0 ? void 0 : option.label)
61
70
  }, getLabel((option === null || option === void 0 ? void 0 : option.alias) || (option === null || option === void 0 ? void 0 : option.label))));
62
71
  };
72
+
63
73
  export default Option;
@@ -1,16 +1,21 @@
1
1
  export var PropType;
2
+
2
3
  (function (PropType) {
3
4
  PropType[PropType["STRING"] = 1] = "STRING";
4
5
  PropType[PropType["NUMBER"] = 2] = "NUMBER";
5
6
  PropType[PropType["DATE"] = 3] = "DATE";
6
7
  })(PropType || (PropType = {}));
8
+
7
9
  export var PropCategory;
10
+
8
11
  (function (PropCategory) {
9
12
  PropCategory["EventProp"] = "eventProp";
10
13
  PropCategory["UserProp"] = "userProp";
11
14
  PropCategory["EnvProp"] = "envProp";
12
15
  })(PropCategory || (PropCategory = {}));
16
+
13
17
  export var ShowStatus;
18
+
14
19
  (function (ShowStatus) {
15
20
  ShowStatus[ShowStatus["show"] = 0] = "show";
16
21
  ShowStatus[ShowStatus["hidden"] = 1] = "hidden";
@@ -1,5 +1,6 @@
1
1
  export default function convertAttributeData(store) {
2
2
  var _store$eventList, _store$envPropList, _store$userPropList;
3
+
3
4
  var res = {
4
5
  envPropList: [],
5
6
  eventGroupList: [],
@@ -7,6 +8,7 @@ export default function convertAttributeData(store) {
7
8
  };
8
9
  (_store$eventList = store.eventList) === null || _store$eventList === void 0 ? void 0 : _store$eventList.forEach(function (group_) {
9
10
  var _res$eventGroupList;
11
+
10
12
  var group = {
11
13
  id: group_.groupId,
12
14
  name: group_.groupName,
@@ -39,6 +41,7 @@ export default function convertAttributeData(store) {
39
41
  eventHidden: e.event_hidden,
40
42
  marked: Boolean(e.mark_type)
41
43
  };
44
+
42
45
  if (event.marked) {
43
46
  markList.push(event);
44
47
  } else {
@@ -1,23 +1,32 @@
1
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
2
3
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
3
5
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
+
7
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
+
9
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
6
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
7
13
  import React, { useRef, useState } from 'react';
8
14
  import { BizChart } from '@zgfe/business-lib';
9
15
  import chartData from './data/data';
10
16
  import { Button, Image } from 'antd';
11
17
  export default (function () {
12
18
  var chartRef = useRef();
19
+
13
20
  var _useState = useState(),
14
- _useState2 = _slicedToArray(_useState, 2),
15
- chartImg = _useState2[0],
16
- setChartImg = _useState2[1];
21
+ _useState2 = _slicedToArray(_useState, 2),
22
+ chartImg = _useState2[0],
23
+ setChartImg = _useState2[1];
24
+
17
25
  var onClick = function onClick() {
18
26
  var url = chartRef.current.instance.getDataURL();
19
27
  setChartImg(url);
20
28
  };
29
+
21
30
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(BizChart, {
22
31
  data: chartData,
23
32
  type: "line",
package/es/chart/index.js CHANGED
@@ -1,15 +1,21 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
1
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
+
3
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+
5
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+
7
7
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+
8
9
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
+
9
11
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
12
+
13
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
14
+
15
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
16
+
12
17
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
+
13
19
  import React, { useEffect, useImperativeHandle, useState } from 'react';
14
20
  import ReactEChartsCore from 'echarts-for-react/lib/core';
15
21
  import * as echarts from 'echarts';
@@ -19,32 +25,35 @@ import { formatPieData, formatChartData } from './util/formatData';
19
25
  import './util/data/china.js';
20
26
  var BizChart = /*#__PURE__*/React.forwardRef(function (props, ref) {
21
27
  var type = props.type,
22
- data = props.data,
23
- showList = props.showList,
24
- option = props.option,
25
- userGroup = props.userGroup,
26
- showAll = props.showAll,
27
- reverseXAxis = props.reverseXAxis,
28
- isCity = props.isCity,
29
- xRotate = props.xRotate,
30
- yRotate = props.yRotate,
31
- seriesName = props.seriesName,
32
- colors = props.colors,
33
- tooltipFormatter = props.tooltipFormatter,
34
- xAxisFormatter = props.xAxisFormatter,
35
- yAxisFormatter = props.yAxisFormatter,
36
- legendFormatter = props.legendFormatter,
37
- valueUnit = props.valueUnit,
38
- legendPosition = props.legendPosition,
39
- legendOrient = props.legendOrient;
28
+ data = props.data,
29
+ showList = props.showList,
30
+ option = props.option,
31
+ userGroup = props.userGroup,
32
+ showAll = props.showAll,
33
+ reverseXAxis = props.reverseXAxis,
34
+ isCity = props.isCity,
35
+ xRotate = props.xRotate,
36
+ yRotate = props.yRotate,
37
+ seriesName = props.seriesName,
38
+ colors = props.colors,
39
+ tooltipFormatter = props.tooltipFormatter,
40
+ xAxisFormatter = props.xAxisFormatter,
41
+ yAxisFormatter = props.yAxisFormatter,
42
+ legendFormatter = props.legendFormatter,
43
+ valueUnit = props.valueUnit,
44
+ legendPosition = props.legendPosition,
45
+ legendOrient = props.legendOrient;
46
+
40
47
  var _useState = useState({}),
41
- _useState2 = _slicedToArray(_useState, 2),
42
- chartOption = _useState2[0],
43
- setChartOption = _useState2[1];
48
+ _useState2 = _slicedToArray(_useState, 2),
49
+ chartOption = _useState2[0],
50
+ setChartOption = _useState2[1];
51
+
44
52
  var _useState3 = useState(),
45
- _useState4 = _slicedToArray(_useState3, 2),
46
- instance = _useState4[0],
47
- setInstance = _useState4[1];
53
+ _useState4 = _slicedToArray(_useState3, 2),
54
+ instance = _useState4[0],
55
+ setInstance = _useState4[1];
56
+
48
57
  useEffect(function () {
49
58
  if (option) {
50
59
  setChartOption(function () {
@@ -52,13 +61,16 @@ var BizChart = /*#__PURE__*/React.forwardRef(function (props, ref) {
52
61
  });
53
62
  return;
54
63
  }
64
+
55
65
  var eOption = {};
56
66
  if (!data) return eOption;
67
+
57
68
  if (type === 'pie') {
58
69
  var rData = formatPieData(data, showAll, showList);
59
70
  eOption = getPieOption(rData, legendPosition, legendOrient, tooltipFormatter);
60
71
  } else if (type === 'line' || type === 'bar') {
61
72
  var _rData = formatChartData(data, showAll, showList, reverseXAxis, colors);
73
+
62
74
  eOption = getChartOption(type, _rData, legendPosition, legendOrient, valueUnit, xRotate, yRotate, tooltipFormatter, xAxisFormatter, yAxisFormatter, legendFormatter, reverseXAxis, seriesName);
63
75
  } else if (type === 'map') {
64
76
  var series = isCity ? citySeries(data) : provinceSeries(data);
@@ -66,9 +78,11 @@ var BizChart = /*#__PURE__*/React.forwardRef(function (props, ref) {
66
78
  var showVisualMap = !(userGroup && userGroup.split(',').length > 1);
67
79
  eOption = getMapOption(series, maxMin, showVisualMap, tooltipFormatter, isCity);
68
80
  }
81
+
69
82
  if (colors) {
70
83
  eOption.color = colors;
71
84
  }
85
+
72
86
  setChartOption(function () {
73
87
  return _objectSpread({}, eOption);
74
88
  });
@@ -2,7 +2,7 @@ import { GridComponentOption, TitleComponentOption, TooltipComponentOption } fro
2
2
  import { BarSeriesOption, LegendComponentOption, LineSeriesOption, PieSeriesOption, ToolboxComponentOption, XAXisOption, YAXisOption } from 'echarts/types/dist/shared';
3
3
  import '../styles/index.less';
4
4
  import { ChartTypes } from '../types';
5
- export type EChartsOption = echarts.ComposeOption<TitleComponentOption | ToolboxComponentOption | TooltipComponentOption | GridComponentOption | LegendComponentOption | LineSeriesOption | BarSeriesOption | PieSeriesOption>;
5
+ export declare type EChartsOption = echarts.ComposeOption<TitleComponentOption | ToolboxComponentOption | TooltipComponentOption | GridComponentOption | LegendComponentOption | LineSeriesOption | BarSeriesOption | PieSeriesOption>;
6
6
  export declare const baseConfig: EChartsOption;
7
7
  export declare const seriesConfig: any;
8
8
  export declare const legendConfig: LegendComponentOption;
@@ -16,9 +16,9 @@ export declare const gridConfig: {
16
16
  export declare const xAxisConfig: XAXisOption;
17
17
  export declare const yAxisConfig: YAXisOption;
18
18
  export declare const tooltipConfig: TooltipComponentOption;
19
- export declare const getChartOption: (chartType: string, data: ChartTypes.Value, legendPosition?: 'top' | 'bottom' | 'middle', legendOrient?: 'horizontal' | 'vertical', unit?: string, xRotate?: number, yRotate?: number, tooltipFormatter?: ((value: any) => string) | undefined, xAxisFormatter?: ((value: any) => string) | undefined, yAxisFormatter?: ((value: any) => string) | undefined, legendFormatter?: ((value: any) => string) | undefined, reverseXAxis?: boolean, seriesName?: string) => EChartsOption;
19
+ export declare const getChartOption: (chartType: string, data: ChartTypes.Value, legendPosition?: 'top' | 'bottom' | 'middle', legendOrient?: 'horizontal' | 'vertical', unit?: string | undefined, xRotate?: number, yRotate?: number, tooltipFormatter?: ((value: any) => string) | undefined, xAxisFormatter?: ((value: any) => string) | undefined, yAxisFormatter?: ((value: any) => string) | undefined, legendFormatter?: ((value: any) => string) | undefined, reverseXAxis?: boolean | undefined, seriesName?: string | undefined) => EChartsOption;
20
20
  export declare const getPieOption: (seriesData?: object[], legendPosition?: 'top' | 'bottom' | 'middle', legendOrient?: 'horizontal' | 'vertical', tooltipFormatter?: ((value: any) => string) | undefined) => EChartsOption;
21
21
  export declare const getMapOption: (seriesData: object[] | undefined, maxMinValue: {
22
22
  min: number;
23
23
  max: number;
24
- }, showVisualMap?: boolean, tooltipFormat?: ((value: any) => string) | undefined, isCity?: boolean) => any;
24
+ }, showVisualMap?: boolean, tooltipFormat?: ((value: any) => string) | undefined, isCity?: boolean | undefined) => any;
@@ -1,9 +1,9 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
1
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
+
3
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+
5
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+
7
7
  import { tooltipFormatterDefault, xAxisFormatterDefault, yAxisFormatterDefault, mapTooltipFormatter, legendFormatterDefault } from './formatOption';
8
8
  import { chartColors } from './color';
9
9
  import '../styles/index.less';
@@ -120,39 +120,49 @@ export var getChartOption = function getChartOption(chartType, data) {
120
120
  var legendFormatter = arguments.length > 10 ? arguments[10] : undefined;
121
121
  var reverseXAxis = arguments.length > 11 ? arguments[11] : undefined;
122
122
  var seriesName = arguments.length > 12 ? arguments[12] : undefined;
123
+
123
124
  var xAxis = JSON.parse(JSON.stringify(xAxisConfig)),
124
- tooltip = JSON.parse(JSON.stringify(tooltipConfig)),
125
- yAxis = _objectSpread({}, yAxisConfig),
126
- legend = _objectSpread({}, legendConfig),
127
- grid = _objectSpread({}, gridConfig),
128
- seriesItem = _objectSpread({}, seriesConfig);
125
+ tooltip = JSON.parse(JSON.stringify(tooltipConfig)),
126
+ yAxis = _objectSpread({}, yAxisConfig),
127
+ legend = _objectSpread({}, legendConfig),
128
+ grid = _objectSpread({}, gridConfig),
129
+ seriesItem = _objectSpread({}, seriesConfig);
130
+
129
131
  if (data.x_axis) {
130
132
  xAxis.data = data.x_axis;
131
133
  }
134
+
132
135
  xAxis.boundaryGap = chartType === 'bar';
133
136
  xAxis.axisLabel = xAxis.axisLabel || {
134
137
  rotate: 0
135
138
  };
136
139
  xAxis.axisLabel.rotate = xRotate;
140
+
137
141
  if (xAxisFormatter) {
138
142
  xAxis.axisLabel.formatter = xAxisFormatter;
139
143
  } else {
140
144
  xAxis.axisLabel.formatter = xAxisFormatterDefault;
141
145
  }
146
+
142
147
  yAxis.axisLabel = yAxis.axisLabel || {};
143
148
  yAxis.axisLabel.rotate = yRotate;
149
+
144
150
  if (yAxisFormatter) {
145
151
  yAxis.axisLabel.formatter = yAxisFormatter;
146
152
  } else {
147
153
  yAxis.axisLabel.formatter = yAxisFormatterDefault;
148
154
  }
155
+
149
156
  if (unit) {
150
157
  yAxis.name = unit;
151
158
  }
159
+
152
160
  var series = [];
161
+
153
162
  if (chartType === 'bar') {
154
163
  seriesItem.barMaxWidth = 40;
155
164
  }
165
+
156
166
  if (!reverseXAxis) {
157
167
  series = data.series.map(function (item) {
158
168
  return _objectSpread(_objectSpread(_objectSpread({}, item), seriesItem), {}, {
@@ -167,25 +177,31 @@ export var getChartOption = function getChartOption(chartType, data) {
167
177
  type: chartType
168
178
  })];
169
179
  }
180
+
170
181
  tooltip.axisPointer = tooltip.axisPointer || {};
171
182
  tooltip.axisPointer.type = chartType === 'bar' ? 'shadow' : 'line';
172
183
  tooltip.formatter = tooltipFormatter ? tooltipFormatter : tooltipFormatterDefault;
184
+
173
185
  if (legendPosition === 'top') {
174
186
  grid.top = series.length > 1 || series.length > 0 && series[0].name ? 45 : 10;
175
187
  } else if (legendPosition === 'bottom') {
176
188
  grid.bottom = series.length > 1 || series.length > 0 && series[0].name ? 45 : 0;
177
189
  }
190
+
178
191
  legend.top = legendPosition;
179
192
  legend.orient = legendOrient;
193
+
180
194
  if (legendOrient === 'vertical') {
181
195
  legend.left = 'left';
182
196
  legend.height = 'auto';
183
197
  legend.width = 50;
184
198
  grid.left = '10%';
185
199
  }
200
+
186
201
  if (chartType === 'line') {
187
202
  legend.icon = 'circle';
188
203
  }
204
+
189
205
  legend.formatter = legendFormatter ? legendFormatter : legendFormatterDefault;
190
206
  return _objectSpread(_objectSpread({}, baseConfig), {}, {
191
207
  legend: legend,
@@ -208,29 +224,35 @@ export var getPieOption = function getPieOption() {
208
224
  show: false
209
225
  }
210
226
  }];
227
+
211
228
  var tooltip = JSON.parse(JSON.stringify(tooltipConfig)),
212
- legend = _objectSpread({}, legendConfig),
213
- grid = _objectSpread({}, gridConfig);
229
+ legend = _objectSpread({}, legendConfig),
230
+ grid = _objectSpread({}, gridConfig);
231
+
214
232
  legend.top = legendPosition;
215
233
  legend.orient = legendOrient;
216
234
  legend.icon = 'circle';
235
+
217
236
  if (legendOrient === 'vertical') {
218
237
  legend.left = 'left';
219
238
  legend.height = 'auto';
220
239
  legend.width = 50;
221
240
  grid.left = '10%';
222
241
  }
242
+
223
243
  tooltip.trigger = 'item';
244
+
224
245
  if (tooltipFormatter) {
225
246
  tooltip.formatter = tooltipFormatter;
226
247
  } else {
227
248
  tooltip.formatter = function (params) {
228
249
  var name = params.name,
229
- value = params.value,
230
- color = params.color;
250
+ value = params.value,
251
+ color = params.color;
231
252
  return "<div class=\"biz-chart-tooltip-item\">\n <span class=\"biz-chart-tooltip-content\">\n <span class=\"biz-tooltip-marker\" style=\"background:".concat(color, "\"></span>").concat(name, "\n </span> \n <span class=\"biz-chart-tooltip-value\">").concat(value, "</span>\n </div>");
232
253
  };
233
254
  }
255
+
234
256
  return _objectSpread(_objectSpread({}, baseConfig), {}, {
235
257
  legend: legend,
236
258
  tooltip: tooltip,
@@ -291,6 +313,7 @@ export var getMapOption = function getMapOption() {
291
313
  },
292
314
  series: seriesData
293
315
  };
316
+
294
317
  if (isCity) {
295
318
  option.geo = {
296
319
  map: 'china',
@@ -300,5 +323,6 @@ export var getMapOption = function getMapOption() {
300
323
  bottom: 0
301
324
  };
302
325
  }
326
+
303
327
  return option;
304
328
  };
@@ -1,4 +1,5 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+
2
3
  /*
3
4
  * Licensed to the Apache Software Foundation (ASF) under one
4
5
  * or more contributor license agreements. See the NOTICE file
@@ -17,7 +18,6 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
17
18
  * specific language governing permissions and limitations
18
19
  * under the License.
19
20
  */
20
-
21
21
  (function (root, factory) {
22
22
  if (typeof define === 'function' && define.amd) {
23
23
  // AMD. Register as an anonymous module.
@@ -35,14 +35,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
35
35
  console && console.error && console.error(msg);
36
36
  }
37
37
  };
38
+
38
39
  if (!echarts) {
39
40
  log('ECharts is not Loaded');
40
41
  return;
41
42
  }
43
+
42
44
  if (!echarts.registerMap) {
43
45
  log('ECharts Map is not loaded');
44
46
  return;
45
47
  }
48
+
46
49
  echarts.registerMap('china', {
47
50
  type: 'FeatureCollection',
48
51
  features: [{