@zgfe/business-lib 1.1.22 → 1.1.24

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