@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,57 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
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
+
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
13
+ import { Input } from 'antd';
14
+ import React, { useEffect, useRef, useState } from 'react';
15
+
16
+ var BizEventNameEditBox = function BizEventNameEditBox(props) {
17
+ var defaultValue = props.defaultValue,
18
+ onCancel = props.onCancel,
19
+ onChange = props.onChange;
20
+ var inputRef = useRef(null);
21
+
22
+ var _useState = useState(defaultValue || ''),
23
+ _useState2 = _slicedToArray(_useState, 2),
24
+ alias = _useState2[0],
25
+ setAlias = _useState2[1];
26
+
27
+ useEffect(function () {
28
+ inputRef.current.focus({
29
+ cursor: 'end'
30
+ });
31
+ }, []);
32
+ return /*#__PURE__*/React.createElement("div", {
33
+ className: "biz-edit-pop-modal"
34
+ }, /*#__PURE__*/React.createElement("div", {
35
+ className: "biz-search active"
36
+ }, /*#__PURE__*/React.createElement(Input, {
37
+ className: "biz-search-box",
38
+ placeholder: "\u8F93\u5165\u522B\u540D",
39
+ ref: inputRef,
40
+ value: alias,
41
+ onChange: function onChange(e) {
42
+ setAlias(e.target.value);
43
+ }
44
+ })), /*#__PURE__*/React.createElement("div", {
45
+ className: "biz-modal-footer"
46
+ }, /*#__PURE__*/React.createElement("div", {
47
+ className: "biz-btn biz-btn-primary",
48
+ onClick: function onClick() {
49
+ onChange(alias);
50
+ }
51
+ }, "\u786E\u5B9A"), /*#__PURE__*/React.createElement("div", {
52
+ className: "biz-btn biz-btn-text",
53
+ onClick: onCancel
54
+ }, "\u53D6\u6D88")));
55
+ };
56
+
57
+ export default BizEventNameEditBox;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => JSX.Element;
2
+ export default _default;
@@ -0,0 +1,133 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
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
+
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
13
+ import { Button, Form } from 'antd';
14
+ import React, { useState } from 'react';
15
+ import { BizTargetSelector, BizEventSelector } from 'business-lib';
16
+ var cascadeOptions = [{
17
+ value: 1,
18
+ label: '整体',
19
+ children: [{
20
+ value: 'xihu',
21
+ label: 'West Lake'
22
+ }, {
23
+ value: 'xiasha',
24
+ label: 'Xia Sha'
25
+ }]
26
+ }, {
27
+ value: 2,
28
+ label: '分组',
29
+ children: [{
30
+ value: 'xihu2',
31
+ label: 'West Lake2'
32
+ }, {
33
+ value: 'xiasha2',
34
+ label: 'Xia Sha2j'
35
+ }, {
36
+ value: 'xihu21',
37
+ label: 'West Lake2h'
38
+ }, {
39
+ value: 'xiasha21',
40
+ label: 'Xia Sha2'
41
+ }, {
42
+ value: 'xihu22',
43
+ label: 'West Lake2m'
44
+ }, {
45
+ value: 'xiasha22',
46
+ label: 'Xia Sha2n'
47
+ }, {
48
+ value: 'xihu27',
49
+ label: 'West Lake2b'
50
+ }, {
51
+ value: 'xiasha82',
52
+ label: 'Xia Sha2v'
53
+ }, {
54
+ value: 'xihu23',
55
+ label: 'West Lake2c'
56
+ }, {
57
+ value: 'xiasha23',
58
+ label: 'Xia Sha2z'
59
+ }, {
60
+ value: 'xihu24',
61
+ label: 'West Lake22x'
62
+ }, {
63
+ value: 'xiasha24',
64
+ label: 'Xia Sha2a'
65
+ }]
66
+ }];
67
+
68
+ var EventDemo = function EventDemo() {
69
+ var _Form$useForm = Form.useForm(),
70
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
71
+ form = _Form$useForm2[0];
72
+
73
+ var _useState = useState(''),
74
+ _useState2 = _slicedToArray(_useState, 2),
75
+ formData = _useState2[0],
76
+ setFormData = _useState2[1];
77
+
78
+ var onFinish = function onFinish(values) {
79
+ setFormData(JSON.stringify(values));
80
+ };
81
+
82
+ var onFinishFailed = function onFinishFailed(errorInfo) {
83
+ console.log('Failed:', errorInfo);
84
+ };
85
+
86
+ var handleAdd = function handleAdd(data) {
87
+ console.log('add', data);
88
+ };
89
+
90
+ var handleDelete = function handleDelete(data) {
91
+ console.log('delete', data);
92
+ };
93
+
94
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Form, {
95
+ form: form,
96
+ onFinish: onFinish,
97
+ onFinishFailed: onFinishFailed,
98
+ initialValues: {
99
+ target: {
100
+ aliasName: '别名',
101
+ option: 'xiasha2'
102
+ }
103
+ }
104
+ }, /*#__PURE__*/React.createElement(Form.Item, {
105
+ label: "\u6307\u6807",
106
+ name: "target"
107
+ }, /*#__PURE__*/React.createElement(BizTargetSelector, {
108
+ onAdd: handleAdd,
109
+ onDelete: handleDelete
110
+ }, /*#__PURE__*/React.createElement(BizEventSelector, {
111
+ responseType: 'object',
112
+ fieldNames: {
113
+ label: 'label',
114
+ value: 'value',
115
+ groupLabel: 'label',
116
+ groupValue: 'value',
117
+ children: 'children'
118
+ },
119
+ options: cascadeOptions
120
+ }))), /*#__PURE__*/React.createElement(Form.Item, {
121
+ wrapperCol: {
122
+ offset: 8,
123
+ span: 16
124
+ }
125
+ }, /*#__PURE__*/React.createElement(Button, {
126
+ type: "primary",
127
+ htmlType: "submit"
128
+ }, "Submit"))), /*#__PURE__*/React.createElement("p", null, formData));
129
+ };
130
+
131
+ export default (function () {
132
+ return /*#__PURE__*/React.createElement(EventDemo, null);
133
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: () => JSX.Element;
2
+ export default _default;
@@ -0,0 +1,107 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
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
+
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
13
+ import React, { useState } from 'react';
14
+ import { BizTargetSelector, BizEventSelector } from 'business-lib';
15
+ var cascadeOptions = [{
16
+ value: 1,
17
+ label: '整体',
18
+ children: [{
19
+ value: 'xihu',
20
+ label: 'West Lake'
21
+ }, {
22
+ value: 'xiasha',
23
+ label: 'Xia Sha'
24
+ }]
25
+ }, {
26
+ value: 2,
27
+ label: '分组',
28
+ children: [{
29
+ value: 'xihu2',
30
+ label: 'West Lake2'
31
+ }, {
32
+ value: 'xiasha2',
33
+ label: 'Xia Sha2j'
34
+ }, {
35
+ value: 'xihu21',
36
+ label: 'West Lake2h'
37
+ }, {
38
+ value: 'xiasha21',
39
+ label: 'Xia Sha2'
40
+ }, {
41
+ value: 'xihu22',
42
+ label: 'West Lake2m'
43
+ }, {
44
+ value: 'xiasha22',
45
+ label: 'Xia Sha2n'
46
+ }, {
47
+ value: 'xihu27',
48
+ label: 'West Lake2b'
49
+ }, {
50
+ value: 'xiasha82',
51
+ label: 'Xia Sha2v'
52
+ }, {
53
+ value: 'xihu23',
54
+ label: 'West Lake2c'
55
+ }, {
56
+ value: 'xiasha23',
57
+ label: 'Xia Sha2z'
58
+ }, {
59
+ value: 'xihu24',
60
+ label: 'West Lake22x'
61
+ }, {
62
+ value: 'xiasha24',
63
+ label: 'Xia Sha2a'
64
+ }]
65
+ }];
66
+
67
+ var EventDemo = function EventDemo() {
68
+ var _useState = useState({}),
69
+ _useState2 = _slicedToArray(_useState, 2),
70
+ test = _useState2[0],
71
+ setTest = _useState2[1];
72
+
73
+ var handleChange = function handleChange(value) {
74
+ setTest(value);
75
+ };
76
+
77
+ var handleAdd = function handleAdd(data) {
78
+ console.log('add', data);
79
+ };
80
+
81
+ var handleDelete = function handleDelete(data) {
82
+ console.log('delete', data);
83
+ };
84
+
85
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(BizTargetSelector, {
86
+ defaultValue: {
87
+ aliasName: '别名',
88
+ option: 'xiasha2'
89
+ },
90
+ onChange: handleChange,
91
+ onAdd: handleAdd,
92
+ onDelete: handleDelete
93
+ }, /*#__PURE__*/React.createElement(BizEventSelector, {
94
+ fieldNames: {
95
+ label: 'label',
96
+ value: 'value',
97
+ groupLabel: 'label',
98
+ groupValue: 'value',
99
+ children: 'children'
100
+ },
101
+ options: cascadeOptions
102
+ })), /*#__PURE__*/React.createElement("p", null, "\u5F53\u524D\u9009\u62E9\u7684\u6307\u6807\u4FE1\u606F\u662F\uFF1A", JSON.stringify(test)));
103
+ };
104
+
105
+ export default (function () {
106
+ return /*#__PURE__*/React.createElement(EventDemo, null);
107
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: () => JSX.Element;
2
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { BizTargetSelector, BizEventSelector } from 'business-lib';
3
+ var optionGroup = [];
4
+
5
+ var EventDemo = function EventDemo() {
6
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(BizTargetSelector, null, /*#__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,40 @@
1
+ import React, { ReactNode } from 'react';
2
+ import './index.less';
3
+ interface ValueType {
4
+ aliasName?: string;
5
+ option?: object | string | number;
6
+ }
7
+ interface EventBoxProps {
8
+ /**
9
+ * @description 默认的选中项
10
+ * @default -
11
+ */
12
+ defaultValue?: ValueType;
13
+ /**
14
+ * @description 指定选中项
15
+ * @default -
16
+ */
17
+ value?: ValueType;
18
+ /**
19
+ * @description 内嵌组件
20
+ * @default -
21
+ */
22
+ children?: ReactNode;
23
+ /**
24
+ * @description 添加筛选的回调
25
+ * @default -
26
+ */
27
+ onAdd?: (value: string | number | object) => void;
28
+ /**
29
+ * @description 删除的回调
30
+ * @default -
31
+ */
32
+ onDelete?: () => void;
33
+ /**
34
+ * @description 选择完成后的回调
35
+ * @default -
36
+ */
37
+ onChange: (data: ValueType) => void;
38
+ }
39
+ declare const BizTargetSelector: React.FC<EventBoxProps>;
40
+ export default BizTargetSelector;
@@ -0,0 +1,204 @@
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
+
11
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
+
13
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
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
+
19
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
+
21
+ import React, { useEffect, useRef, useState } from 'react';
22
+ import BizEventNameEditBox from './components/BizEventNameEditBox';
23
+ import { IconFont } from '..';
24
+ import { Dropdown, Menu, Tooltip } from 'antd';
25
+ import './index.less';
26
+
27
+ var BizTargetSelector = function BizTargetSelector(props) {
28
+ var _props$defaultValue = props.defaultValue,
29
+ defaultValue = _props$defaultValue === void 0 ? {} : _props$defaultValue,
30
+ _props$value = props.value,
31
+ value = _props$value === void 0 ? {} : _props$value,
32
+ _onChange = props.onChange,
33
+ onAdd = props.onAdd,
34
+ onDelete = props.onDelete,
35
+ children = props.children;
36
+
37
+ var _useState = useState(false),
38
+ _useState2 = _slicedToArray(_useState, 2),
39
+ showEditModal = _useState2[0],
40
+ setShowEditModal = _useState2[1];
41
+
42
+ var _useState3 = useState(),
43
+ _useState4 = _slicedToArray(_useState3, 2),
44
+ defaultData = _useState4[0],
45
+ setDefaultData = _useState4[1];
46
+
47
+ var _useState5 = useState(defaultValue.aliasName || value.aliasName || ''),
48
+ _useState6 = _slicedToArray(_useState5, 2),
49
+ alias = _useState6[0],
50
+ setAlias = _useState6[1];
51
+
52
+ var editModalRef = useRef(null);
53
+ var editMenuRef = useRef(null); // 更多操作
54
+
55
+ var menu = /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(Menu.Item, {
56
+ key: "1"
57
+ }, /*#__PURE__*/React.createElement("div", {
58
+ className: "biz-menu-item-edit",
59
+ ref: editMenuRef,
60
+ onClick: function onClick(e) {
61
+ e.stopPropagation();
62
+ e.nativeEvent.stopImmediatePropagation();
63
+ setShowEditModal(true);
64
+ }
65
+ }, /*#__PURE__*/React.createElement(IconFont, {
66
+ className: "ant-dropdown-menu-item-icon",
67
+ type: 'icon-bianji'
68
+ }), "\u7F16\u8F91\u522B\u540D")), /*#__PURE__*/React.createElement(Menu.Divider, null), /*#__PURE__*/React.createElement(Menu.Item, {
69
+ key: "2",
70
+ onClick: function onClick() {
71
+ return _onAdd();
72
+ },
73
+ icon: /*#__PURE__*/React.createElement(IconFont, {
74
+ className: "",
75
+ type: 'icon-shaixuan'
76
+ })
77
+ }, "\u6DFB\u52A0\u7B5B\u9009"), /*#__PURE__*/React.createElement(Menu.Item, {
78
+ key: "3",
79
+ onClick: function onClick() {
80
+ return _onDelete();
81
+ },
82
+ icon: /*#__PURE__*/React.createElement(IconFont, {
83
+ className: "",
84
+ type: 'icon-shanchu'
85
+ })
86
+ }, "\u5220\u9664\u6307\u6807"));
87
+
88
+ var _onAdd = function _onAdd() {
89
+ if (!defaultData) return;
90
+ onAdd && onAdd(defaultData);
91
+ };
92
+
93
+ var _onDelete = function _onDelete() {
94
+ onDelete && onDelete();
95
+ }; // 初始化
96
+
97
+
98
+ useEffect(function () {
99
+ var handleClick = function handleClick(e) {
100
+ if (!editModalRef.current || !editModalRef.current.contains(e.target)) {
101
+ setShowEditModal(false);
102
+ }
103
+ };
104
+
105
+ document.addEventListener('click', handleClick, false);
106
+ return function () {
107
+ document.removeEventListener('click', handleClick, false);
108
+ };
109
+ }, []);
110
+ useEffect(function () {
111
+ var inValue = defaultValue.option || value.option;
112
+ var inAlias = defaultValue.aliasName || value.aliasName;
113
+ console.log('value>>>', inValue);
114
+
115
+ if (JSON.stringify(inValue) !== JSON.stringify(defaultData)) {
116
+ setDefaultData(function () {
117
+ if (_typeof(inValue) === 'object') {
118
+ return _objectSpread({}, inValue);
119
+ } else {
120
+ return inValue;
121
+ }
122
+ });
123
+ }
124
+
125
+ if (inAlias !== alias) {
126
+ setAlias(function () {
127
+ return inAlias || '';
128
+ });
129
+ }
130
+ }, [defaultValue, value]);
131
+ return /*#__PURE__*/React.createElement("div", {
132
+ className: "biz-select-cotainer biz-target-container",
133
+ tabIndex: 0
134
+ }, /*#__PURE__*/React.cloneElement(children, {
135
+ aliasName: alias,
136
+ defaultValue: defaultData,
137
+ onChange: function onChange(data) {
138
+ _onChange && _onChange({
139
+ aliasName: alias,
140
+ option: data
141
+ });
142
+ }
143
+ }), /*#__PURE__*/React.createElement("div", {
144
+ className: "biz-options"
145
+ }, /*#__PURE__*/React.createElement("div", {
146
+ className: "biz-option-icon",
147
+ onClick: _onAdd
148
+ }, /*#__PURE__*/React.createElement(Tooltip, {
149
+ title: function title() {
150
+ return '添加筛选';
151
+ },
152
+ color: "#242541",
153
+ key: 'delete'
154
+ }, /*#__PURE__*/React.createElement(IconFont, {
155
+ className: "",
156
+ type: 'icon-shaixuan'
157
+ }))), /*#__PURE__*/React.createElement("div", {
158
+ className: "biz-option-icon biz-option-icon-delete",
159
+ onClick: _onDelete
160
+ }, /*#__PURE__*/React.createElement(Tooltip, {
161
+ title: function title() {
162
+ return '删除';
163
+ },
164
+ color: "#242541",
165
+ key: 'delete'
166
+ }, /*#__PURE__*/React.createElement(IconFont, {
167
+ className: "",
168
+ type: 'icon-qingchu'
169
+ }))), defaultData && /*#__PURE__*/React.createElement(Dropdown, {
170
+ overlay: menu,
171
+ overlayClassName: "large",
172
+ trigger: ['click']
173
+ }, /*#__PURE__*/React.createElement("div", {
174
+ className: "biz-option-icon"
175
+ }, /*#__PURE__*/React.createElement(Tooltip, {
176
+ title: function title() {
177
+ return '编辑别名、筛选、删除';
178
+ },
179
+ color: "#242541",
180
+ key: 'delete'
181
+ }, /*#__PURE__*/React.createElement(IconFont, {
182
+ type: 'icon-gengduocaozuo1'
183
+ }))))), showEditModal && /*#__PURE__*/React.createElement("div", {
184
+ className: "biz-edit-modal",
185
+ ref: editModalRef
186
+ }, /*#__PURE__*/React.createElement(BizEventNameEditBox, {
187
+ defaultValue: alias,
188
+ onCancel: function onCancel() {
189
+ return setShowEditModal(false);
190
+ },
191
+ onChange: function onChange(value) {
192
+ setAlias(function () {
193
+ return value;
194
+ });
195
+ setShowEditModal(false);
196
+ _onChange && _onChange({
197
+ aliasName: value,
198
+ option: defaultData
199
+ });
200
+ }
201
+ })));
202
+ };
203
+
204
+ export default BizTargetSelector;
@@ -0,0 +1,53 @@
1
+ @import '../commonStyle/icon.less';
2
+ @import '../commonStyle/index.less';
3
+
4
+ // .ant-dropdown-menu {
5
+ // width: 200px;
6
+ // padding: 8px;
7
+ // background: #ffffff;
8
+ // border-radius: 10px;
9
+ // box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
10
+ // }
11
+
12
+ // .ant-dropdown-menu-item {
13
+ // padding: 14px 8px;
14
+ // line-height: 20px;
15
+ // border-radius: 10px;
16
+
17
+ // &:not(.box-active):hover {
18
+ // .box-hover();
19
+ // }
20
+ // &.box-active:hover {
21
+ // .box-active();
22
+ // }
23
+ // .ant-dropdown-menu-item-icon {
24
+ // margin-right: 15px;
25
+ // font-size: @iconSize;
26
+ // }
27
+ // }
28
+
29
+ .biz-placeholder {
30
+ color: #9797af;
31
+ }
32
+
33
+ .biz-menu-item-edit {
34
+ width: 100%;
35
+ height: 100%;
36
+ .ant-dropdown-menu-item-icon {
37
+ margin-right: 15px;
38
+ font-size: @iconSize;
39
+ }
40
+ }
41
+ .biz-target-container {
42
+ .biz-select-cotainer {
43
+ margin-bottom: 0;
44
+ padding: 0;
45
+ border: none;
46
+ }
47
+ .ant-form {
48
+ flex: 1;
49
+ .ant-form-item {
50
+ margin-bottom: 0;
51
+ }
52
+ }
53
+ }
@@ -0,0 +1,3 @@
1
+ import './index.less';
2
+ declare const _default: () => JSX.Element;
3
+ export default _default;