@zgfe/business-lib 1.0.0-beta.1

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 (178) hide show
  1. package/README.md +12 -0
  2. package/es/analysisLayout/demo/index.d.ts +3 -0
  3. package/es/analysisLayout/demo/index.js +30 -0
  4. package/es/analysisLayout/demo/index.less +12 -0
  5. package/es/analysisLayout/index.d.ts +13 -0
  6. package/es/analysisLayout/index.js +153 -0
  7. package/es/analysisLayout/index.less +115 -0
  8. package/es/attributeSelector/data/env.d.ts +11 -0
  9. package/es/attributeSelector/data/env.js +181 -0
  10. package/es/attributeSelector/data/event.d.ts +237 -0
  11. package/es/attributeSelector/data/event.js +3483 -0
  12. package/es/attributeSelector/data/user.d.ts +22 -0
  13. package/es/attributeSelector/data/user.js +218 -0
  14. package/es/attributeSelector/demo/multi.d.ts +2 -0
  15. package/es/attributeSelector/demo/multi.js +39 -0
  16. package/es/attributeSelector/demo/multiForm.d.ts +2 -0
  17. package/es/attributeSelector/demo/multiForm.js +64 -0
  18. package/es/attributeSelector/demo/single.d.ts +2 -0
  19. package/es/attributeSelector/demo/single.js +43 -0
  20. package/es/attributeSelector/demo/singleForm.d.ts +2 -0
  21. package/es/attributeSelector/demo/singleForm.js +66 -0
  22. package/es/attributeSelector/group.d.ts +31 -0
  23. package/es/attributeSelector/group.js +225 -0
  24. package/es/attributeSelector/index.d.ts +110 -0
  25. package/es/attributeSelector/index.js +578 -0
  26. package/es/attributeSelector/index.less +172 -0
  27. package/es/chart/chartConfig.d.ts +28 -0
  28. package/es/chart/chartConfig.js +256 -0
  29. package/es/chart/color.d.ts +1 -0
  30. package/es/chart/color.js +1 -0
  31. package/es/chart/demo/bar.d.ts +2 -0
  32. package/es/chart/demo/bar.js +19 -0
  33. package/es/chart/demo/data.d.ts +11 -0
  34. package/es/chart/demo/data.js +37 -0
  35. package/es/chart/demo/index.d.ts +2 -0
  36. package/es/chart/demo/index.js +9 -0
  37. package/es/chart/demo/pie.d.ts +2 -0
  38. package/es/chart/demo/pie.js +30 -0
  39. package/es/chart/index.d.ts +63 -0
  40. package/es/chart/index.js +76 -0
  41. package/es/chart/index.less +38 -0
  42. package/es/chart/style/circle.svg +4 -0
  43. package/es/commonStyle/icon.less +147 -0
  44. package/es/commonStyle/index.less +171 -0
  45. package/es/commonStyle/select.less +101 -0
  46. package/es/commonStyle/theme.less +432 -0
  47. package/es/commonStyle/variable.less +124 -0
  48. package/es/datePicker/data.d.ts +9 -0
  49. package/es/datePicker/data.js +65 -0
  50. package/es/datePicker/demo/form.d.ts +2 -0
  51. package/es/datePicker/demo/form.js +53 -0
  52. package/es/datePicker/demo/index.d.ts +2 -0
  53. package/es/datePicker/demo/index.js +30 -0
  54. package/es/datePicker/index.d.ts +29 -0
  55. package/es/datePicker/index.js +207 -0
  56. package/es/datePicker/index.less +388 -0
  57. package/es/dialog/components/list.d.ts +15 -0
  58. package/es/dialog/components/list.js +57 -0
  59. package/es/dialog/components/selectToInput.d.ts +43 -0
  60. package/es/dialog/components/selectToInput.js +107 -0
  61. package/es/dialog/components/style/list.less +59 -0
  62. package/es/dialog/components/style/tab.less +61 -0
  63. package/es/dialog/components/tab.d.ts +9 -0
  64. package/es/dialog/components/tab.js +50 -0
  65. package/es/dialog/data/chart.d.ts +11 -0
  66. package/es/dialog/data/chart.js +62 -0
  67. package/es/dialog/demo/index.d.ts +2 -0
  68. package/es/dialog/demo/index.js +122 -0
  69. package/es/dialog/demo/index2.d.ts +2 -0
  70. package/es/dialog/demo/index2.js +79 -0
  71. package/es/dialog/demo/index3.d.ts +2 -0
  72. package/es/dialog/demo/index3.js +61 -0
  73. package/es/dialog/index.d.ts +68 -0
  74. package/es/dialog/index.js +188 -0
  75. package/es/dialog/style/index.less +70 -0
  76. package/es/eventSelector/cascade.less +120 -0
  77. package/es/eventSelector/demo/form.d.ts +2 -0
  78. package/es/eventSelector/demo/form.js +89 -0
  79. package/es/eventSelector/demo/index.d.ts +2 -0
  80. package/es/eventSelector/demo/index.js +69 -0
  81. package/es/eventSelector/demo/nodata.d.ts +2 -0
  82. package/es/eventSelector/demo/nodata.js +13 -0
  83. package/es/eventSelector/index.d.ts +27 -0
  84. package/es/eventSelector/index.js +390 -0
  85. package/es/eventSelector/type.d.ts +41 -0
  86. package/es/eventSelector/type.js +1 -0
  87. package/es/globalAttributes/demo/data/env.d.ts +11 -0
  88. package/es/globalAttributes/demo/data/env.js +181 -0
  89. package/es/globalAttributes/demo/data/event.d.ts +237 -0
  90. package/es/globalAttributes/demo/data/event.js +3483 -0
  91. package/es/globalAttributes/demo/data/user.d.ts +22 -0
  92. package/es/globalAttributes/demo/data/user.js +218 -0
  93. package/es/globalAttributes/demo/index.d.ts +2 -0
  94. package/es/globalAttributes/demo/index.js +50 -0
  95. package/es/globalAttributes/index.d.ts +46 -0
  96. package/es/globalAttributes/index.js +116 -0
  97. package/es/index.d.ts +23 -0
  98. package/es/index.js +25 -0
  99. package/es/multipleSelector/demo/index.d.ts +2 -0
  100. package/es/multipleSelector/demo/index.js +35 -0
  101. package/es/multipleSelector/index.d.ts +36 -0
  102. package/es/multipleSelector/index.js +109 -0
  103. package/es/multipleSelector/index.less +138 -0
  104. package/es/select/demo/index.d.ts +2 -0
  105. package/es/select/demo/index.js +22 -0
  106. package/es/select/index.d.ts +42 -0
  107. package/es/select/index.js +142 -0
  108. package/es/table/demo/data/color.d.ts +1 -0
  109. package/es/table/demo/data/color.js +1 -0
  110. package/es/table/demo/data/data.d.ts +11 -0
  111. package/es/table/demo/data/data.js +37 -0
  112. package/es/table/demo/data/table.d.ts +4 -0
  113. package/es/table/demo/data/table.js +37 -0
  114. package/es/table/demo/index.d.ts +3 -0
  115. package/es/table/demo/index.js +171 -0
  116. package/es/table/demo/index.less +8 -0
  117. package/es/table/demo/index2.d.ts +2 -0
  118. package/es/table/demo/index2.js +9 -0
  119. package/es/table/index.d.ts +32 -0
  120. package/es/table/index.js +80 -0
  121. package/es/table/index.less +102 -0
  122. package/es/targetConditionGroup/components/conditionGroup.d.ts +30 -0
  123. package/es/targetConditionGroup/components/conditionGroup.js +111 -0
  124. package/es/targetConditionGroup/components/conditionItem.d.ts +47 -0
  125. package/es/targetConditionGroup/components/conditionItem.js +259 -0
  126. package/es/targetConditionGroup/components/style/group.less +47 -0
  127. package/es/targetConditionGroup/components/style/index.less +16 -0
  128. package/es/targetConditionGroup/data/operates.d.ts +36 -0
  129. package/es/targetConditionGroup/data/operates.js +98 -0
  130. package/es/targetConditionGroup/demo/data/env.d.ts +11 -0
  131. package/es/targetConditionGroup/demo/data/env.js +181 -0
  132. package/es/targetConditionGroup/demo/data/event.d.ts +237 -0
  133. package/es/targetConditionGroup/demo/data/event.js +3483 -0
  134. package/es/targetConditionGroup/demo/data/user.d.ts +22 -0
  135. package/es/targetConditionGroup/demo/data/user.js +218 -0
  136. package/es/targetConditionGroup/demo/form.d.ts +2 -0
  137. package/es/targetConditionGroup/demo/form.js +96 -0
  138. package/es/targetConditionGroup/demo/index.d.ts +2 -0
  139. package/es/targetConditionGroup/demo/index.js +73 -0
  140. package/es/targetConditionGroup/demo/item.d.ts +2 -0
  141. package/es/targetConditionGroup/demo/item.js +5 -0
  142. package/es/targetConditionGroup/index.d.ts +53 -0
  143. package/es/targetConditionGroup/index.js +265 -0
  144. package/es/targetConditionGroup/index.less +65 -0
  145. package/es/targetConditionGroup/type.d.ts +50 -0
  146. package/es/targetConditionGroup/type.js +1 -0
  147. package/es/targetSelector/components/BizCascadeBox.d.ts +34 -0
  148. package/es/targetSelector/components/BizCascadeBox.js +213 -0
  149. package/es/targetSelector/components/BizEventNameEditBox.d.ts +20 -0
  150. package/es/targetSelector/components/BizEventNameEditBox.js +57 -0
  151. package/es/targetSelector/demo/form.d.ts +2 -0
  152. package/es/targetSelector/demo/form.js +133 -0
  153. package/es/targetSelector/demo/index.d.ts +2 -0
  154. package/es/targetSelector/demo/index.js +107 -0
  155. package/es/targetSelector/demo/nodata.d.ts +2 -0
  156. package/es/targetSelector/demo/nodata.js +13 -0
  157. package/es/targetSelector/index.d.ts +40 -0
  158. package/es/targetSelector/index.js +204 -0
  159. package/es/targetSelector/index.less +53 -0
  160. package/es/userGroup/demo/cluster.d.ts +3 -0
  161. package/es/userGroup/demo/cluster.js +102 -0
  162. package/es/userGroup/demo/index.d.ts +3 -0
  163. package/es/userGroup/demo/index.js +115 -0
  164. package/es/userGroup/demo/index.less +3 -0
  165. package/es/userGroup/index.d.ts +79 -0
  166. package/es/userGroup/index.js +134 -0
  167. package/es/userGroup/index.less +2 -0
  168. package/es/userGroup/userCluster.d.ts +63 -0
  169. package/es/userGroup/userCluster.js +254 -0
  170. package/es/utils/ajax.d.ts +7 -0
  171. package/es/utils/ajax.js +139 -0
  172. package/es/utils/index.d.ts +3 -0
  173. package/es/utils/index.js +3 -0
  174. package/es/utils/type.d.ts +54 -0
  175. package/es/utils/type.js +1 -0
  176. package/es/utils/util.d.ts +67 -0
  177. package/es/utils/util.js +204 -0
  178. package/package.json +55 -0
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { BizEventSelector } from 'business-lib';
3
+ var optionGroup = [];
4
+
5
+ var EventDemo = function EventDemo() {
6
+ return /*#__PURE__*/React.createElement(BizEventSelector, {
7
+ options: optionGroup
8
+ });
9
+ };
10
+
11
+ export default (function () {
12
+ return /*#__PURE__*/React.createElement(EventDemo, null);
13
+ });
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import './cascade.less';
3
+ import { FormProps, Event } from './type';
4
+ interface EventBoxProps extends FormProps {
5
+ /**
6
+ * @description 默认的选中项
7
+ * @default -
8
+ */
9
+ defaultValue?: string | number | Event;
10
+ /**
11
+ * @description 指定选中项
12
+ * @default -
13
+ */
14
+ value?: string | number | Event;
15
+ /**
16
+ * @description 别名
17
+ * @default -
18
+ */
19
+ aliasName?: string;
20
+ /**
21
+ * @description 选择完成后的回调
22
+ * @default -
23
+ */
24
+ onChange?: (value1: string | number | object, value2: string | number | object) => void;
25
+ }
26
+ declare const BizEventSelector: React.FC<EventBoxProps>;
27
+ export default BizEventSelector;
@@ -0,0 +1,390 @@
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
+ 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
+
7
+ 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); }
8
+
9
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
10
+
11
+ 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."); }
12
+
13
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
14
+
15
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
16
+
17
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
18
+
19
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
20
+
21
+ 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."); }
22
+
23
+ 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); }
24
+
25
+ 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; }
26
+
27
+ 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; }
28
+
29
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
30
+
31
+ /**
32
+ * 事件下拉框
33
+ */
34
+ import { Input, List, Skeleton } from 'antd';
35
+ import React, { useContext, useEffect, useRef, useState } from 'react';
36
+ import './cascade.less';
37
+ import InfiniteScroll from 'react-infinite-scroll-component';
38
+ import { BizGlobalDataContext, IconFont } from '..';
39
+ import { util } from '../utils';
40
+
41
+ var BizEventSelector = function BizEventSelector(props) {
42
+ var aliasName = props.aliasName,
43
+ _props$options = props.options,
44
+ options = _props$options === void 0 ? [] : _props$options,
45
+ defaultValue = props.defaultValue,
46
+ value = props.value,
47
+ _props$fieldNames = props.fieldNames,
48
+ fieldNames = _props$fieldNames === void 0 ? {
49
+ label: 'name',
50
+ value: 'id',
51
+ groupLabel: 'name',
52
+ groupValue: 'id',
53
+ children: 'children'
54
+ } : _props$fieldNames,
55
+ _props$responseType = props.responseType,
56
+ responseType = _props$responseType === void 0 ? 'id' : _props$responseType,
57
+ _props$placeholder = props.placeholder,
58
+ placeholder = _props$placeholder === void 0 ? '请选择' : _props$placeholder,
59
+ onChange = props.onChange; // 是否显示下拉框
60
+
61
+ var _useState = useState(false),
62
+ _useState2 = _slicedToArray(_useState, 2),
63
+ showDropdown = _useState2[0],
64
+ setShowDropdown = _useState2[1]; // 分组(下拉框第一列)信息,用于存储hover的信息,(事件搜索后)
65
+
66
+
67
+ var _useState3 = useState({}),
68
+ _useState4 = _slicedToArray(_useState3, 2),
69
+ group = _useState4[0],
70
+ setGroup = _useState4[1]; // 分组(下拉框第一列)信息, 原始信息
71
+
72
+
73
+ var _useState5 = useState({}),
74
+ _useState6 = _slicedToArray(_useState5, 2),
75
+ group2 = _useState6[0],
76
+ setGroup2 = _useState6[1]; // group的children数量
77
+
78
+
79
+ var _useState7 = useState(0),
80
+ _useState8 = _slicedToArray(_useState7, 2),
81
+ eventCount = _useState8[0],
82
+ setEventCount = _useState8[1]; // 选中值(下拉框第二列)选中信息
83
+
84
+
85
+ var _useState9 = useState({}),
86
+ _useState10 = _slicedToArray(_useState9, 2),
87
+ event = _useState10[0],
88
+ setEvent = _useState10[1]; // 搜索框是否是聚焦状态
89
+
90
+
91
+ var _useState11 = useState(false),
92
+ _useState12 = _slicedToArray(_useState11, 2),
93
+ focused = _useState12[0],
94
+ setFocused = _useState12[1]; // 第二列数据 虚拟滚动,每次滚动10条
95
+
96
+
97
+ var _useState13 = useState([]),
98
+ _useState14 = _slicedToArray(_useState13, 2),
99
+ eventData = _useState14[0],
100
+ setEventData = _useState14[1]; // 搜索值
101
+
102
+
103
+ var _useState15 = useState(''),
104
+ _useState16 = _slicedToArray(_useState15, 2),
105
+ searchValue = _useState16[0],
106
+ setSearchValue = _useState16[1]; // 选中值
107
+ // const [eventValue, setEventValue] = useState<Event>()
108
+
109
+
110
+ var pagesize = 9;
111
+ var cascadeRef = useRef(null);
112
+
113
+ var _useContext = useContext(BizGlobalDataContext),
114
+ eventMeta = _useContext.eventMeta;
115
+
116
+ var _useState17 = useState(options || eventMeta),
117
+ _useState18 = _slicedToArray(_useState17, 2),
118
+ eventOptions = _useState18[0],
119
+ setEventOptions = _useState18[1];
120
+
121
+ var _useState19 = useState(aliasName),
122
+ _useState20 = _slicedToArray(_useState19, 2),
123
+ alias = _useState20[0],
124
+ setAlias = _useState20[1];
125
+
126
+ useEffect(function () {
127
+ setAlias(function () {
128
+ return aliasName;
129
+ });
130
+ }, [aliasName]); // 初始赋值
131
+
132
+ useEffect(function () {
133
+ var initValue = function initValue() {
134
+ // 所有的option
135
+ var firstGroup = {};
136
+ firstGroup[fieldNames.groupLabel] = '整体概览';
137
+ firstGroup[fieldNames.groupValue] = 'all';
138
+ firstGroup[fieldNames.children] = [];
139
+
140
+ var _iterator = _createForOfIteratorHelper(options),
141
+ _step;
142
+
143
+ try {
144
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
145
+ var option = _step.value;
146
+ var children = option[fieldNames.children] || [];
147
+
148
+ var _iterator2 = _createForOfIteratorHelper(children),
149
+ _step2;
150
+
151
+ try {
152
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
153
+ var _event = _step2.value;
154
+ firstGroup[fieldNames.children].push(_event);
155
+ }
156
+ } catch (err) {
157
+ _iterator2.e(err);
158
+ } finally {
159
+ _iterator2.f();
160
+ }
161
+ }
162
+ } catch (err) {
163
+ _iterator.e(err);
164
+ } finally {
165
+ _iterator.f();
166
+ }
167
+
168
+ setEventOptions(function (option) {
169
+ return [firstGroup].concat(_toConsumableArray(option));
170
+ });
171
+ setGroup(firstGroup);
172
+ setGroup2(firstGroup);
173
+ };
174
+
175
+ if (options && options.length > 0) {
176
+ initValue();
177
+ } // 添加点击事件监听,隐藏下拉框
178
+
179
+
180
+ var handleClick = function handleClick(e) {
181
+ if (!cascadeRef.current || !cascadeRef.current.contains(e.target)) {
182
+ setShowDropdown(false);
183
+ }
184
+ };
185
+
186
+ document.addEventListener('click', handleClick);
187
+ return function () {
188
+ document.removeEventListener('click', handleClick);
189
+ };
190
+ }, []); // 监听传入值改变
191
+
192
+ useEffect(function () {
193
+ var inValue = defaultValue || value;
194
+ if (!inValue || inValue === {}) return;
195
+ var id = _typeof(inValue) === 'object' ? inValue[fieldNames.value] : inValue;
196
+ if (event && event[fieldNames.value] === id) return;
197
+
198
+ var _iterator3 = _createForOfIteratorHelper(options),
199
+ _step3;
200
+
201
+ try {
202
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
203
+ var option = _step3.value;
204
+ var children = option[fieldNames.children] || [];
205
+
206
+ var _iterator4 = _createForOfIteratorHelper(children),
207
+ _step4;
208
+
209
+ try {
210
+ var _loop = function _loop() {
211
+ var event = _step4.value;
212
+
213
+ if (event[fieldNames.value] == id) {
214
+ setEvent(function () {
215
+ return _objectSpread({}, event);
216
+ });
217
+ }
218
+ };
219
+
220
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
221
+ _loop();
222
+ }
223
+ } catch (err) {
224
+ _iterator4.e(err);
225
+ } finally {
226
+ _iterator4.f();
227
+ }
228
+ }
229
+ } catch (err) {
230
+ _iterator3.e(err);
231
+ } finally {
232
+ _iterator3.f();
233
+ }
234
+ }, [defaultValue, value]); // 更改group后,事件列表响应
235
+
236
+ useEffect(function () {
237
+ var arr = [],
238
+ size = 0;
239
+
240
+ if (group && group[fieldNames.children]) {
241
+ var _group$fieldNames$chi;
242
+
243
+ arr = (_group$fieldNames$chi = group[fieldNames.children]) === null || _group$fieldNames$chi === void 0 ? void 0 : _group$fieldNames$chi.slice(0, pagesize);
244
+ size = group[fieldNames.children].length;
245
+ }
246
+
247
+ setEventData(arr);
248
+ setEventCount(size);
249
+ }, [group]); // 初始化搜索框
250
+
251
+ useEffect(function () {
252
+ setSearchValue(function () {
253
+ return '';
254
+ });
255
+ }, [showDropdown]); // 搜索结果
256
+
257
+ useEffect(function () {
258
+ if (!showDropdown) return;
259
+ var arr = group2[fieldNames.children] && group2[fieldNames.children].filter(function (item) {
260
+ return item[fieldNames.label] && JSON.stringify(item[fieldNames.label]).toLowerCase().indexOf(searchValue.toLowerCase()) > -1;
261
+ });
262
+ setGroup(function (group) {
263
+ group[fieldNames.children] = arr;
264
+ return _objectSpread({}, group);
265
+ });
266
+ }, [searchValue, group2, showDropdown]); // 加载更多
267
+
268
+ var loadMoreData = function loadMoreData() {
269
+ var _group$fieldNames$chi2;
270
+
271
+ var arr = group[fieldNames.children] ? (_group$fieldNames$chi2 = group[fieldNames.children]) === null || _group$fieldNames$chi2 === void 0 ? void 0 : _group$fieldNames$chi2.slice(eventData.length, eventData.length + pagesize) : [];
272
+ setEventData([].concat(_toConsumableArray(eventData), _toConsumableArray(arr)));
273
+ };
274
+
275
+ var setHeighLight = function setHeighLight(value) {
276
+ if (!searchValue) return value; // const num = value.indexOf(searchValue)
277
+ // const c = num > -1 ? value.substr(num, searchValue.length) : ''
278
+ // console.log(num,c)
279
+
280
+ var val = "<span style=\"color:#FF6600;\">".concat(searchValue, "</span>");
281
+ var regS = new RegExp(searchValue, 'gi');
282
+ console.log('regS', regS, searchValue, val);
283
+ return value.replace(regS, val);
284
+ };
285
+
286
+ return /*#__PURE__*/React.createElement("div", {
287
+ className: "biz-select-cotainer biz-select-hover",
288
+ ref: cascadeRef
289
+ }, /*#__PURE__*/React.createElement("div", {
290
+ className: "biz-select-content",
291
+ onClick: function onClick() {
292
+ setShowDropdown(function (status) {
293
+ return !status;
294
+ });
295
+ }
296
+ }, /*#__PURE__*/React.createElement("div", {
297
+ className: "biz-input"
298
+ }, event[fieldNames.label] ? event[fieldNames.label] : /*#__PURE__*/React.createElement("span", {
299
+ className: "biz-placeholder"
300
+ }, placeholder), /*#__PURE__*/React.createElement("span", null, alias && alias !== '' && "(".concat(alias, ")"))), /*#__PURE__*/React.createElement(IconFont, {
301
+ className: "biz-select-zhankai",
302
+ type: 'icon-xiangxia'
303
+ })), options && options.length ? /*#__PURE__*/React.createElement("div", {
304
+ className: "biz-dropdown-cascade ".concat(showDropdown && 'biz-flex')
305
+ }, /*#__PURE__*/React.createElement("div", {
306
+ className: "biz-dropdown-menu"
307
+ }, eventOptions.map(function (menu, index) {
308
+ var _menu$fieldNames$chil;
309
+
310
+ return /*#__PURE__*/React.createElement("div", {
311
+ className: "biz-dropdown-item ".concat(menu[fieldNames.groupValue] === group[fieldNames.groupValue] && 'box-hover'),
312
+ key: menu[fieldNames.groupValue],
313
+ onMouseEnter: function onMouseEnter(e) {
314
+ e.stopPropagation();
315
+ setGroup(function () {
316
+ return _objectSpread({}, menu);
317
+ });
318
+ setGroup2(function () {
319
+ return _objectSpread({}, menu);
320
+ });
321
+ }
322
+ }, /*#__PURE__*/React.createElement("span", null, menu[fieldNames.groupLabel]), /*#__PURE__*/React.createElement("span", {
323
+ className: "biz-count"
324
+ }, (_menu$fieldNames$chil = menu[fieldNames.children]) === null || _menu$fieldNames$chil === void 0 ? void 0 : _menu$fieldNames$chil.length));
325
+ })), /*#__PURE__*/React.createElement("div", {
326
+ className: "biz-dropdown-content"
327
+ }, /*#__PURE__*/React.createElement(Input, {
328
+ className: "biz-search-box",
329
+ prefix: /*#__PURE__*/React.createElement(IconFont, {
330
+ className: "biz-icon",
331
+ type: "icon-sousuo"
332
+ }),
333
+ allowClear: {
334
+ clearIcon: /*#__PURE__*/React.createElement(IconFont, {
335
+ className: "biz-icon",
336
+ type: 'icon-qingchu'
337
+ })
338
+ },
339
+ value: searchValue,
340
+ placeholder: "\u641C\u7D22\u57CB\u70B9\u4E8B\u4EF6",
341
+ onChange: function onChange(e) {
342
+ setSearchValue(e.target.value);
343
+ }
344
+ }), /*#__PURE__*/React.createElement("div", {
345
+ className: "biz-dropdown-box",
346
+ id: "scrollableDiv"
347
+ }, /*#__PURE__*/React.createElement(InfiniteScroll, {
348
+ dataLength: eventData.length,
349
+ next: loadMoreData,
350
+ hasMore: eventData.length < eventCount,
351
+ loader: /*#__PURE__*/React.createElement(Skeleton, {
352
+ paragraph: {
353
+ rows: 1
354
+ },
355
+ active: true
356
+ }),
357
+ scrollableTarget: "scrollableDiv"
358
+ }, /*#__PURE__*/React.createElement(List, {
359
+ dataSource: eventData,
360
+ renderItem: function renderItem(item) {
361
+ return /*#__PURE__*/React.createElement(List.Item, {
362
+ key: item[fieldNames.value],
363
+ className: "biz-dropdown-item ".concat(item[fieldNames.value] === event[fieldNames.value] && 'box-active'),
364
+ onClick: function onClick(e) {
365
+ e.stopPropagation();
366
+ setEvent(function () {
367
+ return _objectSpread({}, item);
368
+ });
369
+ setShowDropdown(false);
370
+
371
+ if (onChange) {
372
+ if (responseType === 'id') {
373
+ onChange(item[fieldNames.value], item);
374
+ } else {
375
+ onChange(item, item[fieldNames.value]);
376
+ }
377
+ }
378
+ }
379
+ }, /*#__PURE__*/React.createElement("div", {
380
+ dangerouslySetInnerHTML: {
381
+ __html: util.setHighLight(item[fieldNames.label], searchValue)
382
+ }
383
+ }));
384
+ }
385
+ })))), ")") : showDropdown && /*#__PURE__*/React.createElement("div", {
386
+ className: "biz-select-nodata"
387
+ }, "\u6682\u65E0\u6570\u636E"));
388
+ };
389
+
390
+ export default BizEventSelector;
@@ -0,0 +1,41 @@
1
+ export interface Option {
2
+ groupValue?: string | number;
3
+ groupLabel?: string | number;
4
+ children?: Event[];
5
+ [prop: string]: any;
6
+ }
7
+ export interface Event {
8
+ value?: string | number;
9
+ label?: string | number;
10
+ [prop: string]: any;
11
+ }
12
+ export interface FormProps {
13
+ /**
14
+ * @description 可选项数据源
15
+ * @default -
16
+ */
17
+ options: Option[];
18
+ /**
19
+ * @description 输入框占位文本
20
+ * @default 请选择
21
+ */
22
+ placeholder?: string;
23
+ /**
24
+ * @description 返回数据类型
25
+ * @description.zh-CN id | object
26
+ * @default id
27
+ */
28
+ responseType?: string;
29
+ /**
30
+ * @description 自定义节点 label、value 的字段
31
+ * @description.zh-CN
32
+ * @default { label: 'name', value: 'id', groupLabel: 'name', groupValue: 'id' }
33
+ */
34
+ fieldNames?: {
35
+ label: string;
36
+ value: string;
37
+ groupLabel: string;
38
+ groupValue: string;
39
+ children: string;
40
+ };
41
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ declare const _default: {
2
+ dimension_sub: string;
3
+ value_dict: boolean;
4
+ name: string;
5
+ id: number;
6
+ text: string;
7
+ category: string;
8
+ type: number;
9
+ alias_name: null;
10
+ }[];
11
+ export default _default;
@@ -0,0 +1,181 @@
1
+ export default [{
2
+ dimension_sub: 'browser_brand',
3
+ value_dict: false,
4
+ name: 'browser_brand',
5
+ id: 0,
6
+ text: '浏览器品牌',
7
+ category: 'fixed',
8
+ type: 1,
9
+ alias_name: null
10
+ }, {
11
+ dimension_sub: 'browser_version',
12
+ value_dict: false,
13
+ name: 'browser_version',
14
+ id: 0,
15
+ text: '浏览器版本',
16
+ category: 'fixed',
17
+ type: 2,
18
+ alias_name: null
19
+ }, {
20
+ dimension_sub: 'website',
21
+ value_dict: false,
22
+ name: 'website',
23
+ id: 0,
24
+ text: '来源域名',
25
+ category: 'fixed',
26
+ type: 1,
27
+ alias_name: null
28
+ }, {
29
+ dimension_sub: 'platform',
30
+ value_dict: false,
31
+ name: 'platform',
32
+ id: 0,
33
+ text: '平台',
34
+ category: 'fixed',
35
+ type: 1,
36
+ alias_name: null
37
+ }, {
38
+ dimension_sub: 'referer_url',
39
+ value_dict: false,
40
+ name: 'referer_url',
41
+ id: 0,
42
+ text: '来源URL',
43
+ category: 'fixed',
44
+ type: 1,
45
+ alias_name: null
46
+ }, {
47
+ dimension_sub: 'current_url',
48
+ value_dict: false,
49
+ name: 'current_url',
50
+ id: 0,
51
+ text: '当前URL',
52
+ category: 'fixed',
53
+ type: 1,
54
+ alias_name: null
55
+ }, {
56
+ dimension_sub: 'country',
57
+ value_dict: false,
58
+ name: 'country',
59
+ id: 0,
60
+ text: '国家',
61
+ category: 'fixed',
62
+ type: 1,
63
+ alias_name: null
64
+ }, {
65
+ dimension_sub: 'area',
66
+ value_dict: false,
67
+ name: 'area',
68
+ id: 0,
69
+ text: '省份',
70
+ category: 'fixed',
71
+ type: 1,
72
+ alias_name: null
73
+ }, {
74
+ dimension_sub: 'city',
75
+ value_dict: false,
76
+ name: 'city',
77
+ id: 0,
78
+ text: '城市',
79
+ category: 'fixed',
80
+ type: 1,
81
+ alias_name: null
82
+ }, {
83
+ dimension_sub: 'os',
84
+ value_dict: false,
85
+ name: 'os',
86
+ id: 0,
87
+ text: '操作系统',
88
+ category: 'fixed',
89
+ type: 1,
90
+ alias_name: null
91
+ }, {
92
+ dimension_sub: 'ov',
93
+ value_dict: false,
94
+ name: 'ov',
95
+ id: 0,
96
+ text: '系统版本',
97
+ category: 'fixed',
98
+ type: 2,
99
+ alias_name: null
100
+ }, {
101
+ dimension_sub: 'resolution_h',
102
+ value_dict: false,
103
+ name: 'resolution_h',
104
+ id: 0,
105
+ text: '屏幕高度',
106
+ category: 'fixed',
107
+ type: 2,
108
+ alias_name: null
109
+ }, {
110
+ dimension_sub: 'resolution_l',
111
+ value_dict: false,
112
+ name: 'resolution_l',
113
+ id: 0,
114
+ text: '屏幕宽度',
115
+ category: 'fixed',
116
+ type: 2,
117
+ alias_name: null
118
+ }, {
119
+ dimension_sub: 'first_referer_url',
120
+ value_dict: false,
121
+ name: 'first_referer_url',
122
+ id: 0,
123
+ text: '初始来源URL',
124
+ category: 'fixed',
125
+ type: 1,
126
+ alias_name: null
127
+ }, {
128
+ dimension_sub: 'ip',
129
+ value_dict: false,
130
+ name: 'ip',
131
+ id: 0,
132
+ text: 'IP',
133
+ category: 'fixed',
134
+ type: 1,
135
+ alias_name: null
136
+ }, {
137
+ dimension_sub: 'utm_source',
138
+ value_dict: false,
139
+ name: 'utm_source',
140
+ id: 0,
141
+ text: 'utm_source',
142
+ category: 'fixed',
143
+ type: 1,
144
+ alias_name: null
145
+ }, {
146
+ dimension_sub: 'utm_medium',
147
+ value_dict: false,
148
+ name: 'utm_medium',
149
+ id: 0,
150
+ text: 'utm_medium',
151
+ category: 'fixed',
152
+ type: 1,
153
+ alias_name: null
154
+ }, {
155
+ dimension_sub: 'utm_campaign',
156
+ value_dict: false,
157
+ name: 'utm_campaign',
158
+ id: 0,
159
+ text: 'utm_campaign',
160
+ category: 'fixed',
161
+ type: 1,
162
+ alias_name: null
163
+ }, {
164
+ dimension_sub: 'utm_content',
165
+ value_dict: false,
166
+ name: 'utm_content',
167
+ id: 0,
168
+ text: 'utm_content',
169
+ category: 'fixed',
170
+ type: 1,
171
+ alias_name: null
172
+ }, {
173
+ dimension_sub: 'utm_term',
174
+ value_dict: false,
175
+ name: 'utm_term',
176
+ id: 0,
177
+ text: 'utm_term',
178
+ category: 'fixed',
179
+ type: 1,
180
+ alias_name: null
181
+ }];