@zgfe/business-lib 1.1.27 → 1.1.29-visual.0

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 (135) 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.js +0 -2
  11. package/es/assets/demo/input.js +5 -12
  12. package/es/assets/iconfont/iconfont.js +10 -17
  13. package/es/assets/theme.js +0 -1
  14. package/es/attrConditions/components/operateList.js +10 -27
  15. package/es/attrConditions/components/stringList.js +69 -98
  16. package/es/attrConditions/components/valuesList.js +14 -40
  17. package/es/attrConditions/demo/group.js +11 -23
  18. package/es/attrConditions/demo/index.js +17 -26
  19. package/es/attrConditions/group.js +17 -48
  20. package/es/attrConditions/index.js +22 -49
  21. package/es/attrConditions/types.js +0 -1
  22. package/es/attributeSelector/demo/disable.js +8 -16
  23. package/es/attributeSelector/demo/index.js +8 -17
  24. package/es/attributeSelector/index.js +22 -45
  25. package/es/attributeSelector/listPanel.js +18 -46
  26. package/es/attributeSelector/option.js +3 -13
  27. package/es/attributeSelector/types.js +0 -5
  28. package/es/attributeSelector/util.js +0 -3
  29. package/es/chart/demo/index.js +5 -14
  30. package/es/chart/index.js +30 -44
  31. package/es/chart/util/chartOptionConfig.d.ts +3 -3
  32. package/es/chart/util/chartOptionConfig.js +13 -37
  33. package/es/chart/util/data/china.js +1 -4
  34. package/es/chart/util/formatData.d.ts +2 -2
  35. package/es/chart/util/formatData.js +0 -5
  36. package/es/chart/util/formatOption.js +0 -13
  37. package/es/chart/util/mapUtil.js +5 -26
  38. package/es/config.js +0 -2
  39. package/es/cycleTime/demo/disable.js +0 -1
  40. package/es/cycleTime/index.js +19 -46
  41. package/es/cycleTime/month.js +8 -27
  42. package/es/datePicker/datePicker.js +5 -23
  43. package/es/datePicker/demo/customType.js +13 -22
  44. package/es/datePicker/demo/day.js +13 -22
  45. package/es/datePicker/demo/index.js +12 -21
  46. package/es/datePicker/index.js +18 -41
  47. package/es/datePicker/utils.js +0 -7
  48. package/es/demoWrapper/content.js +31 -56
  49. package/es/demoWrapper/head.js +9 -23
  50. package/es/demoWrapper/index.js +14 -30
  51. package/es/dialog/demo/index.js +5 -12
  52. package/es/dialog/index.js +4 -6
  53. package/es/dnd/demo/data.js +19 -28
  54. package/es/dnd/demo/handle.js +19 -28
  55. package/es/dnd/index.js +21 -45
  56. package/es/dnd/item.js +10 -30
  57. package/es/eventSelector/demo/index.js +12 -23
  58. package/es/eventSelector/index.js +14 -42
  59. package/es/eventSelector/listPanel.js +27 -61
  60. package/es/eventSelector/option.js +6 -11
  61. package/es/icon/iconFont.js +7 -13
  62. package/es/index.d.ts +2 -1
  63. package/es/index.js +2 -1
  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 -59
  78. package/es/select/option.js +10 -30
  79. package/es/select/overlay.js +25 -62
  80. package/es/socket/demo/demo.d.ts +2 -0
  81. package/es/socket/demo/demo.js +51 -0
  82. package/es/socket/demo/index.less +4 -0
  83. package/es/socket/index.d.ts +27 -0
  84. package/es/socket/index.js +217 -0
  85. package/es/socket/types.d.ts +27 -0
  86. package/es/socket/types.js +18 -0
  87. package/es/table/demo/data/table.js +0 -2
  88. package/es/table/demo/index.js +13 -39
  89. package/es/table/demo/index2.js +5 -15
  90. package/es/table/demo/index3.js +7 -28
  91. package/es/table/index.js +14 -33
  92. package/es/targetConditionGroup/components/targetDimension.js +12 -38
  93. package/es/targetConditionGroup/demo/group.js +21 -36
  94. package/es/targetConditionGroup/demo/index.js +5 -13
  95. package/es/targetConditionGroup/index.js +31 -84
  96. package/es/targetSelector/demo/index.js +15 -28
  97. package/es/targetSelector/editBox.js +5 -20
  98. package/es/targetSelector/index.js +15 -36
  99. package/es/targetSelector/optionIcon.js +1 -5
  100. package/es/targetSelector/optionMenu.js +0 -3
  101. package/es/userCondition/conditionTypeList.js +7 -12
  102. package/es/userCondition/conditionWrap.js +0 -2
  103. package/es/userCondition/conditions/cdpCondition.js +51 -97
  104. package/es/userCondition/conditions/eventCondition.js +6 -16
  105. package/es/userCondition/conditions/periodCondition.js +8 -26
  106. package/es/userCondition/conditions/propCondition.js +29 -61
  107. package/es/userCondition/conditions/runTimesCondition.js +5 -10
  108. package/es/userCondition/conditions/tagsCondition.d.ts +1 -1
  109. package/es/userCondition/conditions/tagsCondition.js +15 -33
  110. package/es/userCondition/conditions/textDesc.js +16 -67
  111. package/es/userCondition/demo/index.js +11 -21
  112. package/es/userCondition/index.js +51 -91
  113. package/es/userCondition/orConditions.js +11 -48
  114. package/es/userCondition/relationLabel.js +1 -4
  115. package/es/userCondition/types.d.ts +1 -1
  116. package/es/userCondition/types.js +0 -1
  117. package/es/userCondition/util.js +4 -13
  118. package/es/userGroup/demo/group.js +14 -23
  119. package/es/userGroup/demo/index.js +5 -15
  120. package/es/userGroup/index.js +12 -30
  121. package/es/userTagsSelector/cascaderOverlay.js +19 -51
  122. package/es/userTagsSelector/components/search/index.js +0 -2
  123. package/es/userTagsSelector/demo/index.js +0 -3
  124. package/es/userTagsSelector/groups/groupOption.js +6 -8
  125. package/es/userTagsSelector/groups/index.js +15 -30
  126. package/es/userTagsSelector/index.js +17 -35
  127. package/es/userTagsSelector/multipleCheckPanel/checkOption.js +3 -6
  128. package/es/userTagsSelector/multipleCheckPanel/index.js +8 -21
  129. package/es/userTagsSelector/util.js +0 -2
  130. package/es/utils/ajax.js +45 -71
  131. package/es/utils/base64.js +3 -22
  132. package/es/utils/type.d.ts +1 -1
  133. package/es/utils/type.js +4 -7
  134. package/es/utils/util.js +0 -16
  135. package/package.json +2 -2
@@ -1,27 +1,18 @@
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
  var _excluded = ["overlayWidth", "minDropdownWidth", "labelField", "keyField"];
2
-
3
3
  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; }
4
-
5
4
  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; }
6
-
7
- 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; }
8
-
5
+ 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; }
6
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
+ 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); }
9
8
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
-
11
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."); }
12
-
13
10
  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
-
11
+ 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; }
12
+ 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
13
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
-
21
14
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
22
-
23
15
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
24
-
25
16
  import { Dropdown } from 'antd';
26
17
  import React, { useEffect, useRef, useState } from 'react';
27
18
  import SelectHandle from './handle';
@@ -29,58 +20,46 @@ import SelectOverlay from './overlay';
29
20
  import './styles/index.less';
30
21
  import _ from 'lodash';
31
22
  export var classPrefix = 'biz-select';
32
-
33
23
  var BizSelect = function BizSelect(props) {
34
24
  var _boxRef$current3;
35
-
36
25
  var overlayWidth = props.overlayWidth,
37
- minDropdownWidth = props.minDropdownWidth,
38
- labelField = props.labelField,
39
- keyField = props.keyField,
40
- res = _objectWithoutProperties(props, _excluded);
41
-
26
+ minDropdownWidth = props.minDropdownWidth,
27
+ labelField = props.labelField,
28
+ keyField = props.keyField,
29
+ res = _objectWithoutProperties(props, _excluded);
42
30
  var _useState = useState(),
43
- _useState2 = _slicedToArray(_useState, 2),
44
- current = _useState2[0],
45
- setCurrent = _useState2[1];
46
-
31
+ _useState2 = _slicedToArray(_useState, 2),
32
+ current = _useState2[0],
33
+ setCurrent = _useState2[1];
47
34
  var _useState3 = useState(''),
48
- _useState4 = _slicedToArray(_useState3, 2),
49
- searchValue = _useState4[0],
50
- setSearchValue = _useState4[1];
51
-
35
+ _useState4 = _slicedToArray(_useState3, 2),
36
+ searchValue = _useState4[0],
37
+ setSearchValue = _useState4[1];
52
38
  var _useState5 = useState(false),
53
- _useState6 = _slicedToArray(_useState5, 2),
54
- visible = _useState6[0],
55
- setVisible = _useState6[1];
56
-
39
+ _useState6 = _slicedToArray(_useState5, 2),
40
+ visible = _useState6[0],
41
+ setVisible = _useState6[1];
57
42
  var selectRef = useRef(null);
58
43
  var overlayRef = useRef(null);
59
44
  var boxRef = useRef(null);
60
45
  var selectId = Math.random().toString();
61
-
62
46
  var _useState7 = useState(200),
63
- _useState8 = _slicedToArray(_useState7, 2),
64
- width = _useState8[0],
65
- setWidth = _useState8[1];
66
-
47
+ _useState8 = _slicedToArray(_useState7, 2),
48
+ width = _useState8[0],
49
+ setWidth = _useState8[1];
67
50
  useEffect(function () {
68
51
  if (props.defaultValue) {
69
52
  setCurrent(getValue(props.defaultValue));
70
53
  }
71
-
72
54
  var handleClick = function handleClick(e) {
73
55
  var _selectRef$current, _overlayRef$current, _boxRef$current;
74
-
75
56
  var clicked = (_selectRef$current = selectRef.current) === null || _selectRef$current === void 0 ? void 0 : _selectRef$current.contains(e.target);
76
57
  var overlayClicked = (_overlayRef$current = overlayRef.current) === null || _overlayRef$current === void 0 ? void 0 : _overlayRef$current.contains(e.target);
77
58
  (_boxRef$current = boxRef.current) === null || _boxRef$current === void 0 ? void 0 : _boxRef$current.create(clicked, overlayClicked);
78
-
79
59
  if (!clicked && !props.enableCreate || overlayClicked) {
80
60
  setSearchValue('');
81
61
  }
82
62
  };
83
-
84
63
  window.addEventListener('click', handleClick);
85
64
  return function () {
86
65
  window.removeEventListener('click', handleClick);
@@ -88,14 +67,12 @@ var BizSelect = function BizSelect(props) {
88
67
  }, []);
89
68
  useEffect(function () {
90
69
  var _boxRef$current2;
91
-
92
70
  setWidth((boxRef === null || boxRef === void 0 ? void 0 : (_boxRef$current2 = boxRef.current) === null || _boxRef$current2 === void 0 ? void 0 : _boxRef$current2.width) || 200);
93
71
  }, [boxRef === null || boxRef === void 0 ? void 0 : (_boxRef$current3 = boxRef.current) === null || _boxRef$current3 === void 0 ? void 0 : _boxRef$current3.width]);
94
72
  useEffect(function () {
95
73
  if (!props.value) return;
96
74
  setCurrent(getValue(props.value));
97
75
  }, [props.value, props.options]);
98
-
99
76
  var getValue = function getValue(data) {
100
77
  if (props.multiple) {
101
78
  var result = [];
@@ -107,7 +84,6 @@ var BizSelect = function BizSelect(props) {
107
84
  return getCheckedData(data);
108
85
  }
109
86
  };
110
-
111
87
  var getCheckedData = function getCheckedData(data) {
112
88
  var result = data;
113
89
  props.options.forEach(function (option) {
@@ -123,10 +99,8 @@ var BizSelect = function BizSelect(props) {
123
99
  });
124
100
  return result;
125
101
  };
126
-
127
102
  var onDelete = function onDelete(option) {
128
103
  var data = _.cloneDeep(current);
129
-
130
104
  data.forEach(function (item, index) {
131
105
  if (item[keyField] === option[keyField]) {
132
106
  data.splice(index, 1);
@@ -136,29 +110,22 @@ var BizSelect = function BizSelect(props) {
136
110
  setCurrent(data);
137
111
  if (props.onChange) props.onChange(data);
138
112
  };
139
-
140
113
  var onChange = function onChange(option) {
141
114
  setCurrent(option);
142
115
  setSearchValue('');
143
-
144
116
  if (!props.multiple) {
145
117
  onVisibleChange(false);
146
118
  }
147
-
148
119
  if (props.onChange) props.onChange(option);
149
120
  };
150
-
151
121
  var onVisibleChange = function onVisibleChange(flag) {
152
122
  setSearchValue('');
153
123
  setVisible(flag);
154
124
  props.onVisibleChange && props.onVisibleChange(flag);
155
125
  };
156
-
157
126
  var onCreate = function onCreate(val) {
158
127
  var _data;
159
-
160
128
  if (!props.enableCreate) return;
161
-
162
129
  if (current) {
163
130
  var flag = true;
164
131
  current.forEach(function (item) {
@@ -168,7 +135,6 @@ var BizSelect = function BizSelect(props) {
168
135
  });
169
136
  if (!flag) return;
170
137
  }
171
-
172
138
  var data = (_data = {}, _defineProperty(_data, keyField, val), _defineProperty(_data, labelField, val), _data);
173
139
  var originData = current || [];
174
140
  originData.push(data);
@@ -176,11 +142,9 @@ var BizSelect = function BizSelect(props) {
176
142
  setSearchValue('');
177
143
  if (props.onChange) props.onChange(originData);
178
144
  };
179
-
180
145
  var onVisible = function onVisible() {
181
146
  setVisible(true);
182
147
  };
183
-
184
148
  return /*#__PURE__*/React.createElement(Dropdown, {
185
149
  overlay: /*#__PURE__*/React.createElement(SelectOverlay, _objectSpread(_objectSpread({}, res), {}, {
186
150
  value: current,
@@ -230,7 +194,6 @@ var BizSelect = function BizSelect(props) {
230
194
  disableItemList: props.disableItemList
231
195
  })));
232
196
  };
233
-
234
197
  BizSelect.defaultProps = {
235
198
  labelField: 'label',
236
199
  keyField: 'id',
@@ -1,15 +1,9 @@
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 { Tooltip } from 'antd';
14
8
  import React, { useEffect, useMemo, useRef, useState } from 'react';
15
9
  import { classPrefix } from '.';
@@ -20,18 +14,14 @@ export var SelectAll = function SelectAll(props) {
20
14
  var size = props.type === 'group' ? props.options.reduce(function (sum, item) {
21
15
  return sum + item.children.length || 0;
22
16
  }, 0) : props.options.length;
23
-
24
17
  if (props.value && props.value.length) {
25
18
  return props.value.length < size ? 1 : 2;
26
19
  }
27
-
28
20
  return 0;
29
21
  }, [props.value, props.options, props.type]);
30
-
31
22
  var onClick = function onClick() {
32
23
  props.onChange && props.onChange(checkCode === 2 ? false : true);
33
24
  };
34
-
35
25
  return /*#__PURE__*/React.createElement("div", {
36
26
  className: "".concat(classPrefix, "-option ").concat(classPrefix, "-option-multiple ").concat(classPrefix, "-option-all").concat(checkCode === 2 ? ' active' : ''),
37
27
  onClick: onClick
@@ -45,34 +35,28 @@ export var SelectAll = function SelectAll(props) {
45
35
  className: "".concat(classPrefix, "-checkbox-indeterminate")
46
36
  }) : null, "\u5168\u9009");
47
37
  };
48
-
49
38
  var SelectOption = function SelectOption(props) {
50
39
  var option = props.option,
51
- group = props.group,
52
- checked = props.checked,
53
- disabled = props.disabled,
54
- multiple = props.multiple,
55
- customLabel = props.customLabel;
40
+ group = props.group,
41
+ checked = props.checked,
42
+ disabled = props.disabled,
43
+ multiple = props.multiple,
44
+ customLabel = props.customLabel;
56
45
  var optionRef = useRef(null);
57
-
58
46
  var _useState = useState(false),
59
- _useState2 = _slicedToArray(_useState, 2),
60
- isOverflow = _useState2[0],
61
- setIsOverflow = _useState2[1];
62
-
47
+ _useState2 = _slicedToArray(_useState, 2),
48
+ isOverflow = _useState2[0],
49
+ setIsOverflow = _useState2[1];
63
50
  useEffect(function () {
64
51
  var _optionRef$current, _optionRef$current2;
65
-
66
52
  var clientWidth = (_optionRef$current = optionRef.current) === null || _optionRef$current === void 0 ? void 0 : _optionRef$current.clientWidth;
67
53
  var scrollWidth = (_optionRef$current2 = optionRef.current) === null || _optionRef$current2 === void 0 ? void 0 : _optionRef$current2.scrollWidth;
68
54
  setIsOverflow(clientWidth < scrollWidth);
69
55
  }, []);
70
-
71
56
  function onClick() {
72
57
  if (disabled) return;
73
58
  if (props.onClick) props.onClick(option);
74
59
  }
75
-
76
60
  function getLabel(label) {
77
61
  if (!props.highlight || !props.highlight.enable || !props.highlight.text) return label;
78
62
  var text = props.highlight.text;
@@ -86,12 +70,10 @@ var SelectOption = function SelectOption(props) {
86
70
  }, text);
87
71
  });
88
72
  }
89
-
90
73
  function renderLabel(option) {
91
74
  var dom = getLabel(option[props.labelField]);
92
75
  return customLabel ? customLabel(dom, option) : dom;
93
76
  }
94
-
95
77
  if (group) {
96
78
  return /*#__PURE__*/React.createElement("div", {
97
79
  className: "".concat(classPrefix, "-group")
@@ -99,7 +81,6 @@ var SelectOption = function SelectOption(props) {
99
81
  className: "".concat(classPrefix, "-split")
100
82
  }), /*#__PURE__*/React.createElement("span", null, group.name));
101
83
  }
102
-
103
84
  return /*#__PURE__*/React.createElement(Tooltip, {
104
85
  placement: "rightBottom",
105
86
  title: isOverflow ? option[props.labelField] : null,
@@ -122,5 +103,4 @@ var SelectOption = function SelectOption(props) {
122
103
  className: "".concat(classPrefix, "-option-btn")
123
104
  }, props.extra && props.extra(option))));
124
105
  };
125
-
126
106
  export default SelectOption;
@@ -1,25 +1,17 @@
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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
-
3
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
-
5
4
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
-
7
5
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
8
-
9
- 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; }
10
-
6
+ 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; }
7
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
8
+ 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); }
11
9
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
-
13
10
  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."); }
14
-
15
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); }
16
-
17
- 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; }
18
-
19
- 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; }
20
-
12
+ 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; }
13
+ 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; } }
21
14
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22
-
23
15
  import React, { useEffect, useState } from 'react';
24
16
  import { Spin } from 'antd';
25
17
  import BizSearchInput from '../searchInput';
@@ -28,31 +20,27 @@ import SelectOption, { SelectAll } from './option';
28
20
  import _ from 'lodash';
29
21
  var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
30
22
  var labelField = props.labelField,
31
- keyField = props.keyField,
32
- options = props.options,
33
- extra = props.extra,
34
- multiple = props.multiple,
35
- disableItemList = props.disableItemList,
36
- dropdownExtra = props.dropdownExtra,
37
- loading = props.loading,
38
- customLabel = props.customLabel,
39
- overlayClassName = props.overlayClassName;
40
-
23
+ keyField = props.keyField,
24
+ options = props.options,
25
+ extra = props.extra,
26
+ multiple = props.multiple,
27
+ disableItemList = props.disableItemList,
28
+ dropdownExtra = props.dropdownExtra,
29
+ loading = props.loading,
30
+ customLabel = props.customLabel,
31
+ overlayClassName = props.overlayClassName;
41
32
  var _useState = useState(),
42
- _useState2 = _slicedToArray(_useState, 2),
43
- searchValue = _useState2[0],
44
- setSearchValue = _useState2[1];
45
-
33
+ _useState2 = _slicedToArray(_useState, 2),
34
+ searchValue = _useState2[0],
35
+ setSearchValue = _useState2[1];
46
36
  var _useState3 = useState(),
47
- _useState4 = _slicedToArray(_useState3, 2),
48
- current = _useState4[0],
49
- setCurrent = _useState4[1];
50
-
37
+ _useState4 = _slicedToArray(_useState3, 2),
38
+ current = _useState4[0],
39
+ setCurrent = _useState4[1];
51
40
  var _useState5 = useState([]),
52
- _useState6 = _slicedToArray(_useState5, 2),
53
- showList = _useState6[0],
54
- setShowList = _useState6[1];
55
-
41
+ _useState6 = _slicedToArray(_useState5, 2),
42
+ showList = _useState6[0],
43
+ setShowList = _useState6[1];
56
44
  useEffect(function () {
57
45
  if (props.value) setCurrent(props.value);
58
46
  }, [props.value]);
@@ -63,7 +51,6 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
63
51
  }, [props.searchValue]);
64
52
  useEffect(function () {
65
53
  var ids = [];
66
-
67
54
  if (current) {
68
55
  if (multiple) {
69
56
  if (current) {
@@ -75,10 +62,8 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
75
62
  ids = [current[keyField]];
76
63
  }
77
64
  }
78
-
79
65
  setShowList(function () {
80
66
  var list = [];
81
-
82
67
  if (props.type === 'group') {
83
68
  list = options.map(function (group) {
84
69
  var groupDom = /*#__PURE__*/React.createElement(SelectOption, {
@@ -92,7 +77,6 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
92
77
  } else {
93
78
  list = getOptionDom(options, ids);
94
79
  }
95
-
96
80
  if (options.length && !list.flat().length) {
97
81
  var dom = /*#__PURE__*/React.createElement("div", {
98
82
  className: "".concat(classPrefix, "-notfound"),
@@ -100,22 +84,16 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
100
84
  }, props.notFound ? props.notFound : '未找到匹配数据');
101
85
  list = [dom];
102
86
  }
103
-
104
87
  return list;
105
88
  });
106
89
  }, [searchValue, options, current]);
107
-
108
90
  function getOptionDom(data, ids) {
109
91
  var optionsDom = [];
110
-
111
92
  var list = _.cloneDeep(data);
112
-
113
93
  if (props.enableCreate && searchValue) {
114
94
  var _list$push;
115
-
116
95
  list.push((_list$push = {}, _defineProperty(_list$push, props.keyField, searchValue), _defineProperty(_list$push, props.labelField, searchValue), _defineProperty(_list$push, "isTemp", true), _list$push));
117
96
  }
118
-
119
97
  var tempOption = null;
120
98
  var useTemp = true;
121
99
  list.forEach(function (option) {
@@ -142,31 +120,25 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
142
120
  key: option[keyField] || String(Math.random()),
143
121
  customLabel: customLabel
144
122
  });
145
-
146
123
  if (option.isTemp) {
147
124
  tempOption = dom;
148
125
  return;
149
126
  }
150
-
151
127
  optionsDom.push(dom);
152
128
  });
153
-
154
129
  if (useTemp && tempOption) {
155
130
  optionsDom.push(tempOption);
156
131
  }
157
-
158
132
  return optionsDom;
159
133
  }
160
-
161
134
  function onClick(option) {
162
135
  var currentOption = _.cloneDeep(current);
163
-
164
136
  if (multiple) {
165
137
  if (!currentOption) {
166
138
  currentOption = [option];
167
139
  } else {
168
140
  var num = 0,
169
- flag = false;
141
+ flag = false;
170
142
  currentOption.forEach(function (item, i) {
171
143
  if (item[keyField] === option[keyField]) {
172
144
  flag = true;
@@ -174,7 +146,6 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
174
146
  return;
175
147
  }
176
148
  });
177
-
178
149
  if (flag) {
179
150
  currentOption.splice(num, 1);
180
151
  } else {
@@ -184,18 +155,14 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
184
155
  } else {
185
156
  currentOption = option;
186
157
  }
187
-
188
158
  setCurrent(currentOption);
189
159
  if (props.onChange) props.onChange(currentOption);
190
160
  }
191
-
192
161
  function onSearch(v) {
193
162
  setSearchValue(v);
194
163
  }
195
-
196
164
  function render() {
197
165
  if (loading) return /*#__PURE__*/React.createElement(Spin, null);
198
-
199
166
  if (showList && showList.length) {
200
167
  return showList;
201
168
  } else {
@@ -204,10 +171,8 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
204
171
  }, "\u6682\u65E0\u6570\u636E");
205
172
  }
206
173
  }
207
-
208
174
  var onCheckAllChange = function onCheckAllChange(checked) {
209
175
  var selectOptions = [];
210
-
211
176
  if (checked) {
212
177
  if (props.type === 'group') {
213
178
  props.options.forEach(function (item) {
@@ -219,11 +184,9 @@ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
219
184
  } else {
220
185
  selectOptions = disableItemList || [];
221
186
  }
222
-
223
187
  setCurrent(selectOptions);
224
188
  if (props.onChange) props.onChange(selectOptions);
225
189
  };
226
-
227
190
  return /*#__PURE__*/React.createElement("div", {
228
191
  className: "".concat(classPrefix, "-overlay ").concat(overlayClassName),
229
192
  ref: ref
@@ -0,0 +1,2 @@
1
+ declare const _default: () => JSX.Element;
2
+ export default _default;
@@ -0,0 +1,51 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
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."); }
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); }
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
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import React, { useEffect, useState } from 'react';
8
+ import { SocketClient } from '@zgfe/business-lib';
9
+ import { notification } from 'antd';
10
+ export default (function () {
11
+ var _useState = useState(),
12
+ _useState2 = _slicedToArray(_useState, 2),
13
+ client = _useState2[0],
14
+ setClient = _useState2[1];
15
+ useEffect(function () {
16
+ setClient(new SocketClient('wss://rt2.zhugeio.com/eventtracking/ws', {
17
+ id: 'eti8-4ilv-876r-1wr5',
18
+ origin: 1,
19
+ appId: '146',
20
+ programId: 'zgej-3det-9edb-dje3',
21
+ type: 3,
22
+ event: 'login',
23
+ payload: {
24
+ unionid: 'hjadfhdskji884bdfd',
25
+ username: 'zhangsan'
26
+ }
27
+ }));
28
+ }, []);
29
+ useEffect(function () {
30
+ if (!client) return;
31
+ client.onConnected(onConnected);
32
+ client.onError(onError);
33
+ }, [client]);
34
+ function onConnected() {
35
+ notification.success({
36
+ message: '连接成功'
37
+ });
38
+ client.emit('init', {
39
+ msg: '这是初始化信息'
40
+ });
41
+ client.on('init', function (data) {
42
+ console.log('init response', data);
43
+ });
44
+ }
45
+ function onError() {
46
+ notification.error({
47
+ message: '连接失败'
48
+ });
49
+ }
50
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
51
+ });
@@ -0,0 +1,4 @@
1
+ @import '../../assets/styles/inner.less';
2
+ .container {
3
+ border: 1px solid red;
4
+ }
@@ -0,0 +1,27 @@
1
+ import SocketClientTypes from './types';
2
+ declare class SocketClient {
3
+ private client?;
4
+ private url;
5
+ private params?;
6
+ private listeners;
7
+ private catch;
8
+ constructor(url: string, params?: Record<string, any>);
9
+ emit(event: string, payload: SocketClientTypes.Message['data']['payload']): void;
10
+ on(type: string, handle: SocketClientTypes.Handler): void;
11
+ onConnected(handle: SocketClientTypes.Handler): void;
12
+ onDisconnected(handle: SocketClientTypes.Handler): void;
13
+ onError(handle: SocketClientTypes.Handler): void;
14
+ private _onError;
15
+ private _onClose;
16
+ private _onOpen;
17
+ private onMessage;
18
+ private ping;
19
+ removeAllListeners(): void;
20
+ removeListener(event: string, handle?: SocketClientTypes.Handler): void;
21
+ private login;
22
+ open(url?: string, params?: Record<string, any>): void;
23
+ close(): void;
24
+ destroy(): void;
25
+ private log;
26
+ }
27
+ export default SocketClient;