@zgfe/business-lib 1.0.0-beta.6 → 1.0.3

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 (283) hide show
  1. package/es/analysisLayout/demo/index.js +4 -1
  2. package/es/analysisLayout/index.d.ts +1 -28
  3. package/es/analysisLayout/index.js +38 -48
  4. package/es/analysisLayout/index.less +1 -1
  5. package/es/assets/styles/chunks.less +143 -0
  6. package/es/assets/styles/inner.less +3 -0
  7. package/es/assets/styles/resetAntd.less +398 -0
  8. package/es/assets/styles/variable.less +21 -0
  9. package/es/assets/theme.d.ts +5 -0
  10. package/es/assets/theme.js +4 -0
  11. package/es/attrConditions/components/operateList.d.ts +8 -0
  12. package/es/attrConditions/components/operateList.js +83 -0
  13. package/es/attrConditions/components/stringList.d.ts +9 -0
  14. package/es/attrConditions/components/stringList.js +168 -0
  15. package/es/attrConditions/components/valuesList.d.ts +10 -0
  16. package/es/attrConditions/components/valuesList.js +188 -0
  17. package/es/{attributeSelector/demo/multi.d.ts → attrConditions/demo/group.d.ts} +0 -0
  18. package/es/attrConditions/demo/group.js +82 -0
  19. package/es/{globalAttributes → attrConditions}/demo/index.d.ts +0 -0
  20. package/es/{datePicker/demo/form.js → attrConditions/demo/index.js} +43 -23
  21. package/es/attrConditions/group.d.ts +5 -0
  22. package/es/attrConditions/group.js +183 -0
  23. package/es/attrConditions/index.d.ts +6 -0
  24. package/es/attrConditions/index.js +160 -0
  25. package/es/attrConditions/styles/group.less +49 -0
  26. package/es/attrConditions/styles/index.less +94 -0
  27. package/es/attrConditions/types.d.ts +63 -0
  28. package/es/attrConditions/types.js +19 -0
  29. package/es/attrConditions/utils/operates.d.ts +16 -0
  30. package/es/attrConditions/utils/operates.js +67 -0
  31. package/es/attributeSelector/demo/index.d.ts +3 -0
  32. package/es/attributeSelector/demo/{singleForm.js → index.js} +42 -44
  33. package/es/attributeSelector/index.d.ts +4 -111
  34. package/es/attributeSelector/index.js +88 -543
  35. package/es/attributeSelector/listPanel.d.ts +4 -0
  36. package/es/attributeSelector/listPanel.js +208 -0
  37. package/es/attributeSelector/option.d.ts +15 -0
  38. package/es/attributeSelector/option.js +53 -0
  39. package/es/attributeSelector/styles/index.less +100 -0
  40. package/es/attributeSelector/types.d.ts +79 -0
  41. package/es/attributeSelector/types.js +15 -0
  42. package/es/attributeSelector/util.d.ts +7 -0
  43. package/es/attributeSelector/util.js +69 -0
  44. package/es/chart/demo/pie.js +1 -0
  45. package/es/chart/index.d.ts +2 -96
  46. package/es/chart/index.js +28 -35
  47. package/es/chart/styles/index.less +50 -0
  48. package/es/chart/types.d.ts +46 -0
  49. package/es/chart/{type.js → types.js} +0 -0
  50. package/es/chart/util/{chartConfig.d.ts → chartOptionConfig.d.ts} +4 -35
  51. package/es/chart/util/{chartConfig.js → chartOptionConfig.js} +45 -111
  52. package/es/chart/util/formatData.d.ts +3 -7
  53. package/es/chart/util/formatData.js +47 -26
  54. package/es/chart/util/formatOption.d.ts +2 -1
  55. package/es/chart/util/formatOption.js +22 -9
  56. package/es/chart/util/mapUtil.d.ts +3 -3
  57. package/es/chart/util/mapUtil.js +9 -19
  58. package/es/commonStyle/icon.less +116 -112
  59. package/es/commonStyle/select.less +1 -1
  60. package/es/commonStyle/theme.less +520 -473
  61. package/es/components/iconFont.js +4 -2
  62. package/es/context/index.d.ts +16 -0
  63. package/es/context/index.js +3 -0
  64. package/es/datePicker/datePicker.d.ts +10 -0
  65. package/es/datePicker/datePicker.js +115 -0
  66. package/es/datePicker/demo/index.d.ts +1 -0
  67. package/es/datePicker/demo/index.js +9 -2
  68. package/es/datePicker/index.d.ts +4 -27
  69. package/es/datePicker/index.js +72 -148
  70. package/es/datePicker/styles/index.less +48 -0
  71. package/es/datePicker/types.d.ts +24 -0
  72. package/es/{eventSelector/type.js → datePicker/types.js} +0 -0
  73. package/es/datePicker/utils.d.ts +6 -0
  74. package/es/datePicker/utils.js +70 -0
  75. package/es/dialog/components/itemNode.d.ts +10 -0
  76. package/es/dialog/components/itemNode.js +109 -0
  77. package/es/dialog/components/list.d.ts +3 -13
  78. package/es/dialog/components/list.js +15 -12
  79. package/es/dialog/components/selectToInput.d.ts +4 -48
  80. package/es/dialog/components/selectToInput.js +74 -80
  81. package/es/dialog/components/styles/handle.less +39 -0
  82. package/es/dialog/components/styles/list.less +60 -0
  83. package/es/dialog/components/styles/tab.less +55 -0
  84. package/es/dialog/components/tab.d.ts +3 -7
  85. package/es/dialog/components/tab.js +57 -19
  86. package/es/dialog/data/{chart.d.ts → data.d.ts} +9 -0
  87. package/es/dialog/data/{chart.js → data.js} +11 -0
  88. package/es/dialog/demo/index.d.ts +23 -0
  89. package/es/dialog/demo/index.js +34 -3
  90. package/es/dialog/demo/index2.js +14 -2
  91. package/es/dialog/index.d.ts +4 -97
  92. package/es/dialog/index.js +54 -109
  93. package/es/dialog/styles/index.less +11 -0
  94. package/es/dialog/types.d.ts +77 -0
  95. package/es/{targetConditionGroup/type.js → dialog/types.js} +0 -0
  96. package/es/eventSelector/demo/index.js +26 -44
  97. package/es/eventSelector/index.d.ts +4 -30
  98. package/es/eventSelector/index.js +90 -416
  99. package/es/eventSelector/listPanel.d.ts +4 -0
  100. package/es/eventSelector/listPanel.js +197 -0
  101. package/es/eventSelector/option.d.ts +17 -0
  102. package/es/eventSelector/option.js +54 -0
  103. package/es/eventSelector/styles/index.less +77 -0
  104. package/es/eventSelector/types.d.ts +31 -0
  105. package/es/eventSelector/types.js +1 -0
  106. package/es/index.d.ts +14 -11
  107. package/es/index.js +9 -11
  108. package/es/{attributeSelector/data → mock}/env.d.ts +0 -0
  109. package/es/{attributeSelector/data → mock}/env.js +0 -0
  110. package/es/{attributeSelector/data → mock}/event.d.ts +0 -0
  111. package/es/{attributeSelector/data → mock}/event.js +0 -0
  112. package/es/{attributeSelector/data → mock}/user.d.ts +0 -0
  113. package/es/{attributeSelector/data → mock}/user.js +0 -0
  114. package/es/{multipleSelector → searchInput}/demo/index.d.ts +0 -0
  115. package/es/searchInput/demo/index.js +5 -0
  116. package/es/searchInput/index.d.ts +8 -0
  117. package/es/searchInput/index.js +31 -0
  118. package/es/{attributeSelector/demo/multiForm.d.ts → select/demo/group.d.ts} +0 -0
  119. package/es/{globalAttributes/demo/index.js → select/demo/group.js} +49 -31
  120. package/es/select/demo/index.js +49 -21
  121. package/es/{attributeSelector/demo/single.d.ts → select/demo/multiple.d.ts} +0 -0
  122. package/es/{multipleSelector/demo/index.js → select/demo/multiple.js} +55 -12
  123. package/es/select/handle.d.ts +5 -0
  124. package/es/select/handle.js +119 -0
  125. package/es/select/index.d.ts +4 -49
  126. package/es/select/index.js +168 -122
  127. package/es/select/option.d.ts +4 -0
  128. package/es/select/option.js +59 -0
  129. package/es/select/overlay.d.ts +4 -0
  130. package/es/select/overlay.js +154 -0
  131. package/es/select/styles/handle.less +111 -0
  132. package/es/select/styles/index.less +99 -0
  133. package/es/select/types.d.ts +65 -0
  134. package/es/select/types.js +1 -0
  135. package/es/table/demo/data/table.js +1 -1
  136. package/es/table/demo/index.d.ts +1 -1
  137. package/es/table/demo/index.js +9 -8
  138. package/es/table/demo/index3.js +9 -18
  139. package/es/table/index.d.ts +4 -30
  140. package/es/table/index.js +30 -26
  141. package/es/table/styles/index.less +5 -0
  142. package/es/table/type.d.ts +10 -0
  143. package/es/table/type.js +1 -0
  144. package/es/targetConditionGroup/components/targetDimension.d.ts +8 -0
  145. package/es/targetConditionGroup/components/targetDimension.js +153 -0
  146. package/es/targetConditionGroup/data/operates.d.ts +8 -24
  147. package/es/targetConditionGroup/data/operates.js +26 -69
  148. package/es/targetConditionGroup/demo/group.d.ts +1 -0
  149. package/es/targetConditionGroup/demo/group.js +108 -23
  150. package/es/targetConditionGroup/demo/index.js +34 -34
  151. package/es/targetConditionGroup/demo/styles/index.less +29 -0
  152. package/es/targetConditionGroup/index.d.ts +4 -57
  153. package/es/targetConditionGroup/index.js +177 -274
  154. package/es/targetConditionGroup/styles/index.less +25 -0
  155. package/es/targetConditionGroup/types.d.ts +32 -0
  156. package/es/targetConditionGroup/types.js +1 -0
  157. package/es/targetSelector/demo/index.d.ts +1 -0
  158. package/es/targetSelector/demo/index.js +29 -71
  159. package/es/targetSelector/editBox.d.ts +8 -0
  160. package/es/targetSelector/{components/BizEventNameEditBox.js → editBox.js} +49 -24
  161. package/es/targetSelector/index.d.ts +5 -55
  162. package/es/targetSelector/index.js +103 -214
  163. package/es/targetSelector/optionIcon.d.ts +9 -0
  164. package/es/targetSelector/optionIcon.js +24 -0
  165. package/es/targetSelector/optionMenu.d.ts +7 -0
  166. package/es/targetSelector/optionMenu.js +38 -0
  167. package/es/targetSelector/styles/index.less +88 -0
  168. package/es/targetSelector/types.d.ts +18 -0
  169. package/es/targetSelector/types.js +1 -0
  170. package/es/userCondition/conditionTypeList.d.ts +10 -0
  171. package/es/userCondition/conditionTypeList.js +43 -0
  172. package/es/userCondition/conditionWrap.d.ts +7 -0
  173. package/es/userCondition/conditionWrap.js +18 -0
  174. package/es/userCondition/conditions/eventCondition.d.ts +8 -0
  175. package/es/userCondition/conditions/eventCondition.js +104 -0
  176. package/es/userCondition/conditions/periodCondition.d.ts +11 -0
  177. package/es/userCondition/conditions/periodCondition.js +156 -0
  178. package/es/userCondition/conditions/propCondition.d.ts +11 -0
  179. package/es/userCondition/conditions/propCondition.js +147 -0
  180. package/es/userCondition/conditions/runTimesCondition.d.ts +9 -0
  181. package/es/userCondition/conditions/runTimesCondition.js +78 -0
  182. package/es/userCondition/conditions/styles/eventCondition.less +49 -0
  183. package/es/userCondition/conditions/styles/periodCondition.less +14 -0
  184. package/es/userCondition/conditions/styles/propCondition.less +36 -0
  185. package/es/userCondition/conditions/styles/runTimesCondition.less +16 -0
  186. package/es/{attributeSelector/demo/singleForm.d.ts → userCondition/demo/index.d.ts} +0 -0
  187. package/es/userCondition/demo/index.js +97 -0
  188. package/es/userCondition/index.d.ts +7 -0
  189. package/es/userCondition/index.js +146 -0
  190. package/es/userCondition/orConditions.d.ts +5 -0
  191. package/es/userCondition/orConditions.js +202 -0
  192. package/es/userCondition/relationLabel.d.ts +6 -0
  193. package/es/userCondition/relationLabel.js +12 -0
  194. package/es/userCondition/styles/conditionTypeList.less +31 -0
  195. package/es/userCondition/styles/conditionWrap.less +14 -0
  196. package/es/userCondition/styles/index.less +13 -0
  197. package/es/userCondition/styles/orConditions.less +16 -0
  198. package/es/userCondition/styles/relationLabel.less +18 -0
  199. package/es/userCondition/types.d.ts +79 -0
  200. package/es/userCondition/types.js +1 -0
  201. package/es/userCondition/util.d.ts +2 -0
  202. package/es/userCondition/util.js +54 -0
  203. package/es/{datePicker/demo/form.d.ts → userGroup/demo/group.d.ts} +0 -0
  204. package/es/{targetConditionGroup/demo/form.js → userGroup/demo/group.js} +68 -72
  205. package/es/userGroup/demo/index.d.ts +0 -1
  206. package/es/userGroup/demo/index.js +5 -62
  207. package/es/userGroup/index.d.ts +3 -77
  208. package/es/userGroup/index.js +60 -108
  209. package/es/userGroup/styles/index.less +20 -0
  210. package/es/userGroup/types.d.ts +15 -0
  211. package/es/userGroup/types.js +1 -0
  212. package/es/utils/ajax.js +5 -20
  213. package/es/utils/type.d.ts +42 -44
  214. package/es/utils/util.d.ts +1 -35
  215. package/es/utils/util.js +27 -57
  216. package/package.json +11 -4
  217. package/es/attributeSelector/demo/multi.js +0 -39
  218. package/es/attributeSelector/demo/multiForm.js +0 -64
  219. package/es/attributeSelector/demo/single.js +0 -43
  220. package/es/attributeSelector/group.d.ts +0 -31
  221. package/es/attributeSelector/group.js +0 -225
  222. package/es/attributeSelector/index.less +0 -172
  223. package/es/chart/index.less +0 -38
  224. package/es/chart/style/circle.svg +0 -4
  225. package/es/chart/type.d.ts +0 -22
  226. package/es/datePicker/data.d.ts +0 -9
  227. package/es/datePicker/data.js +0 -65
  228. package/es/datePicker/index.less +0 -364
  229. package/es/dialog/components/style/list.less +0 -59
  230. package/es/dialog/components/style/tab.less +0 -61
  231. package/es/dialog/style/index.less +0 -86
  232. package/es/eventSelector/demo/form.d.ts +0 -2
  233. package/es/eventSelector/demo/form.js +0 -89
  234. package/es/eventSelector/demo/nodata.d.ts +0 -2
  235. package/es/eventSelector/demo/nodata.js +0 -13
  236. package/es/eventSelector/index.less +0 -121
  237. package/es/eventSelector/type.d.ts +0 -41
  238. package/es/globalAttributes/demo/data/env.d.ts +0 -11
  239. package/es/globalAttributes/demo/data/env.js +0 -181
  240. package/es/globalAttributes/demo/data/event.d.ts +0 -237
  241. package/es/globalAttributes/demo/data/event.js +0 -3483
  242. package/es/globalAttributes/demo/data/user.d.ts +0 -22
  243. package/es/globalAttributes/demo/data/user.js +0 -218
  244. package/es/globalAttributes/index.d.ts +0 -47
  245. package/es/globalAttributes/index.js +0 -112
  246. package/es/multipleSelector/index.d.ts +0 -36
  247. package/es/multipleSelector/index.js +0 -131
  248. package/es/multipleSelector/index.less +0 -136
  249. package/es/table/demo/index.less +0 -8
  250. package/es/table/index.less +0 -139
  251. package/es/targetConditionGroup/components/conditionGroup.d.ts +0 -30
  252. package/es/targetConditionGroup/components/conditionGroup.js +0 -112
  253. package/es/targetConditionGroup/components/conditionItem.d.ts +0 -47
  254. package/es/targetConditionGroup/components/conditionItem.js +0 -232
  255. package/es/targetConditionGroup/components/style/group.less +0 -47
  256. package/es/targetConditionGroup/components/style/index.less +0 -16
  257. package/es/targetConditionGroup/demo/data/env.d.ts +0 -11
  258. package/es/targetConditionGroup/demo/data/env.js +0 -181
  259. package/es/targetConditionGroup/demo/data/event.d.ts +0 -237
  260. package/es/targetConditionGroup/demo/data/event.js +0 -3483
  261. package/es/targetConditionGroup/demo/data/user.d.ts +0 -22
  262. package/es/targetConditionGroup/demo/data/user.js +0 -218
  263. package/es/targetConditionGroup/demo/form.d.ts +0 -2
  264. package/es/targetConditionGroup/demo/item.d.ts +0 -2
  265. package/es/targetConditionGroup/demo/item.js +0 -5
  266. package/es/targetConditionGroup/group.d.ts +0 -56
  267. package/es/targetConditionGroup/group.js +0 -204
  268. package/es/targetConditionGroup/index.less +0 -76
  269. package/es/targetConditionGroup/type.d.ts +0 -95
  270. package/es/targetSelector/components/BizCascadeBox.d.ts +0 -34
  271. package/es/targetSelector/components/BizCascadeBox.js +0 -213
  272. package/es/targetSelector/components/BizEventNameEditBox.d.ts +0 -20
  273. package/es/targetSelector/demo/form.d.ts +0 -2
  274. package/es/targetSelector/demo/form.js +0 -133
  275. package/es/targetSelector/demo/nodata.d.ts +0 -2
  276. package/es/targetSelector/demo/nodata.js +0 -13
  277. package/es/targetSelector/index.less +0 -28
  278. package/es/userGroup/demo/cluster.d.ts +0 -3
  279. package/es/userGroup/demo/cluster.js +0 -102
  280. package/es/userGroup/demo/index.less +0 -3
  281. package/es/userGroup/index.less +0 -2
  282. package/es/userGroup/userCluster.d.ts +0 -63
  283. package/es/userGroup/userCluster.js +0 -255
@@ -11,67 +11,33 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
11
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
12
 
13
13
  import React, { useState } from 'react';
14
- import { BizTargetSelector, BizEventSelector } from '@zgfe/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
- }];
14
+ import { BizTargetSelector, BizEventSelector, convertAttributeData, BizGlobalDataContext } from '@zgfe/business-lib';
15
+ import eventData from '../../mock/event';
16
+ import '@zgfe/business-lib/es/assets/styles/resetAntd.less';
66
17
 
67
18
  var EventDemo = function EventDemo() {
68
- var _useState = useState({}),
19
+ var store = convertAttributeData({
20
+ eventList: eventData
21
+ });
22
+
23
+ var _useState = useState({
24
+ alias: '别名',
25
+ value: {
26
+ group: {
27
+ id: 4199
28
+ },
29
+ event: {
30
+ id: 24220583,
31
+ name: '菜单导航'
32
+ }
33
+ }
34
+ }),
69
35
  _useState2 = _slicedToArray(_useState, 2),
70
- test = _useState2[0],
71
- setTest = _useState2[1];
36
+ value = _useState2[0],
37
+ setValue = _useState2[1];
72
38
 
73
39
  var handleChange = function handleChange(value) {
74
- setTest(value);
40
+ setValue(value);
75
41
  };
76
42
 
77
43
  var handleAdd = function handleAdd(data) {
@@ -82,24 +48,16 @@ var EventDemo = function EventDemo() {
82
48
  console.log('delete', data);
83
49
  };
84
50
 
85
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(BizTargetSelector, {
86
- defaultValue: {
87
- alias: '别名',
88
- option: 'xiasha2'
89
- },
51
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(BizGlobalDataContext.Provider, {
52
+ value: {
53
+ eventGroupList: store.eventGroupList
54
+ }
55
+ }, /*#__PURE__*/React.createElement(BizTargetSelector, {
56
+ defaultValue: value,
90
57
  onChange: handleChange,
91
58
  onAdd: handleAdd,
92
59
  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)));
60
+ }, /*#__PURE__*/React.createElement(BizEventSelector, null))), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("p", null, "\u5F53\u524D\u9009\u62E9\u7684\u6307\u6807\u4FE1\u606F\u662F\uFF1A", JSON.stringify(value)));
103
61
  };
104
62
 
105
63
  export default (function () {
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ declare const BizEventNameEditBox: React.FC<{
3
+ defaultValue?: string;
4
+ disabled?: string;
5
+ onCancel: () => void;
6
+ onChange: (alias: string) => void;
7
+ }>;
8
+ export default BizEventNameEditBox;
@@ -10,16 +10,15 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
10
10
 
11
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
12
 
13
- import { Input } from 'antd';
14
- import React, { useEffect, useRef, useState } from 'react';
13
+ import { Button, Input, message } from 'antd';
14
+ import React, { useEffect, useMemo, useRef, useState } from 'react';
15
+ import { classPrefix } from '.';
16
+ import IconFont from '../components/iconFont';
15
17
 
16
18
  var BizEventNameEditBox = function BizEventNameEditBox(props) {
17
- var defaultValue = props.defaultValue,
18
- onCancel = props.onCancel,
19
- onChange = props.onChange;
20
19
  var inputRef = useRef(null);
21
20
 
22
- var _useState = useState(defaultValue || ''),
21
+ var _useState = useState(props.defaultValue || ''),
23
22
  _useState2 = _slicedToArray(_useState, 2),
24
23
  alias = _useState2[0],
25
24
  setAlias = _useState2[1];
@@ -29,29 +28,55 @@ var BizEventNameEditBox = function BizEventNameEditBox(props) {
29
28
  cursor: 'end'
30
29
  });
31
30
  }, []);
31
+ var aliasStatus = useMemo(function () {
32
+ var reg = new RegExp("^[0-9A-Za-z\u4E00-\u9FA5]+$");
33
+ return reg.test(alias) || alias === '';
34
+ }, [alias]);
35
+
36
+ var onClick = function onClick() {
37
+ if (aliasStatus) {
38
+ if (props.disabled && props.disabled === alias) {
39
+ message.error('不能与事件名相同!');
40
+ return;
41
+ }
42
+
43
+ props.onChange && props.onChange(alias);
44
+ }
45
+ };
46
+
47
+ var onCancel = function onCancel() {
48
+ props.onCancel && props.onCancel();
49
+ };
50
+
51
+ var onChange = function onChange(e) {
52
+ setAlias(e.target.value);
53
+ };
54
+
32
55
  return /*#__PURE__*/React.createElement("div", {
33
- className: "biz-edit-pop-modal"
34
- }, /*#__PURE__*/React.createElement("div", {
35
- className: "biz-search active"
56
+ className: "".concat(classPrefix, "-modal")
36
57
  }, /*#__PURE__*/React.createElement(Input, {
37
- className: "biz-search-box",
38
58
  placeholder: "\u8F93\u5165\u522B\u540D",
39
59
  ref: inputRef,
40
60
  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")));
61
+ maxLength: 15,
62
+ allowClear: {
63
+ clearIcon: /*#__PURE__*/React.createElement(IconFont, {
64
+ className: "biz-icon",
65
+ type: 'icon-qingchu'
66
+ })
67
+ },
68
+ onChange: onChange
69
+ }), /*#__PURE__*/React.createElement("div", {
70
+ className: "".concat(classPrefix, "-tip ").concat(!aliasStatus ? classPrefix + '-error' : '')
71
+ }, "\u8BF7\u8F93\u5165\u6570\u5B57\u3001\u5B57\u6BCD\u6216\u6C49\u5B57"), /*#__PURE__*/React.createElement("div", {
72
+ className: "".concat(classPrefix, "-footer")
73
+ }, /*#__PURE__*/React.createElement(Button, {
74
+ onClick: onCancel,
75
+ type: "text"
76
+ }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
77
+ onClick: onClick,
78
+ type: "primary"
79
+ }, "\u786E\u5B9A")));
55
80
  };
56
81
 
57
82
  export default BizEventNameEditBox;
@@ -1,56 +1,6 @@
1
- import React, { ReactNode } from 'react';
2
- import './index.less';
3
- interface ValueType {
4
- alias?: string;
5
- option?: object | string | number;
6
- showAll?: boolean;
7
- }
8
- interface EventBoxProps {
9
- /**
10
- * @description 默认的选中项
11
- * @default -
12
- */
13
- defaultValue?: ValueType;
14
- /**
15
- * @description 指定选中项
16
- * @default -
17
- */
18
- value?: ValueType;
19
- /**
20
- * @description 内嵌组件
21
- * @default -
22
- */
23
- children?: ReactNode;
24
- /**
25
- * @describe 是否禁止筛选
26
- * @default false
27
- */
28
- addDisable?: boolean;
29
- /**
30
- * @describe 是否禁止删除
31
- * @default false
32
- */
33
- delDisable?: boolean;
34
- /**
35
- * @description 是否展示事件概览
36
- * @default true
37
- */
38
- showOverview?: boolean;
39
- /**
40
- * @description 添加筛选的回调
41
- * @default -
42
- */
43
- onAdd?: (value: string | number | object) => void;
44
- /**
45
- * @description 删除的回调
46
- * @default -
47
- */
48
- onDelete?: () => void;
49
- /**
50
- * @description 选择完成后的回调
51
- * @default -
52
- */
53
- onChange: (data: ValueType) => void;
54
- }
55
- declare const BizTargetSelector: React.FC<EventBoxProps>;
1
+ import React from 'react';
2
+ import './styles/index.less';
3
+ import { TargetSelectTypes } from './types';
4
+ export declare const classPrefix = "biz-target-select";
5
+ declare const BizTargetSelector: React.FC<TargetSelectTypes.Props>;
56
6
  export default BizTargetSelector;
@@ -1,11 +1,3 @@
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
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
2
 
11
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."); }
@@ -18,232 +10,129 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
18
10
 
19
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
12
 
21
- import React, { useEffect, useRef, useState } from 'react';
22
- import BizEventNameEditBox from './components/BizEventNameEditBox';
23
- import IconFont from '../components/iconFont';
24
- import { Dropdown, Menu, Tooltip } from 'antd';
25
- import './index.less';
13
+ import React, { useEffect, useState } from 'react';
14
+ import BizEventNameEditBox from './editBox';
15
+ import { Dropdown } from 'antd';
16
+ import './styles/index.less';
17
+ import BizTargetOptionIcon from './optionIcon';
18
+ import BizTargetOptionMenu from './optionMenu';
19
+ export var classPrefix = 'biz-target-select';
26
20
 
27
21
  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
- _props$showOverview = props.showOverview,
36
- showOverview = _props$showOverview === void 0 ? true : _props$showOverview,
37
- children = props.children,
38
- _props$addDisable = props.addDisable,
39
- addDisable = _props$addDisable === void 0 ? false : _props$addDisable,
40
- _props$delDisable = props.delDisable,
41
- delDisable = _props$delDisable === void 0 ? false : _props$delDisable;
42
-
43
- var _useState = useState(false),
22
+ var _targetData$event;
23
+
24
+ var enableAdd = props.enableAdd,
25
+ enableDelete = props.enableDelete;
26
+
27
+ var _useState = useState(''),
44
28
  _useState2 = _slicedToArray(_useState, 2),
45
- showEditModal = _useState2[0],
46
- setShowEditModal = _useState2[1];
29
+ alias = _useState2[0],
30
+ setAlias = _useState2[1];
47
31
 
48
32
  var _useState3 = useState(),
49
33
  _useState4 = _slicedToArray(_useState3, 2),
50
- defaultData = _useState4[0],
51
- setDefaultData = _useState4[1];
34
+ targetData = _useState4[0],
35
+ setTargetData = _useState4[1];
52
36
 
53
- var _useState5 = useState(''),
37
+ var _useState5 = useState(false),
54
38
  _useState6 = _slicedToArray(_useState5, 2),
55
- alias = _useState6[0],
56
- setAlias = _useState6[1];
57
-
58
- var _useState7 = useState(showOverview),
59
- _useState8 = _slicedToArray(_useState7, 2),
60
- showAll = _useState8[0],
61
- setShowAll = _useState8[1];
62
-
63
- var editModalRef = useRef(null);
64
- var editMenuRef = useRef(null); // 禁止删除,禁止筛选
65
-
66
- var _useState9 = useState(false),
67
- _useState10 = _slicedToArray(_useState9, 2),
68
- noAdd = _useState10[0],
69
- setNoAdd = _useState10[1];
70
-
71
- var _useState11 = useState(false),
72
- _useState12 = _slicedToArray(_useState11, 2),
73
- noDelete = _useState12[0],
74
- setNoDelete = _useState12[1]; // 更多操作
75
-
76
-
77
- var menu = /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(Menu.Item, {
78
- key: "1"
79
- }, /*#__PURE__*/React.createElement("div", {
80
- className: "biz-menu-item-edit",
81
- ref: editMenuRef,
82
- onClick: function onClick(e) {
83
- e.stopPropagation();
84
- e.nativeEvent.stopImmediatePropagation();
85
- setShowEditModal(true);
86
- }
87
- }, /*#__PURE__*/React.createElement(IconFont, {
88
- className: "ant-dropdown-menu-item-icon",
89
- type: 'icon-bianji'
90
- }), "\u7F16\u8F91\u522B\u540D")), /*#__PURE__*/React.createElement(Menu.Divider, null), /*#__PURE__*/React.createElement(Menu.Item, {
91
- key: "2",
92
- disabled: noAdd,
93
- onClick: function onClick() {
94
- return _onAdd();
95
- },
96
- icon: /*#__PURE__*/React.createElement(IconFont, {
97
- className: "",
98
- type: 'icon-shaixuan'
99
- })
100
- }, "\u6DFB\u52A0\u7B5B\u9009"), /*#__PURE__*/React.createElement(Menu.Item, {
101
- key: "3",
102
- disabled: noDelete,
103
- onClick: function onClick() {
104
- return _onDelete();
105
- },
106
- icon: /*#__PURE__*/React.createElement(IconFont, {
107
- className: "",
108
- type: 'icon-shanchu'
109
- })
110
- }, "\u5220\u9664\u6307\u6807"));
111
-
112
- var _onAdd = function _onAdd() {
113
- if (!defaultData) return;
114
- onAdd && onAdd(defaultData);
115
- };
116
-
117
- var _onDelete = function _onDelete() {
118
- onDelete && onDelete();
119
- }; // 初始化
120
-
39
+ showEditModal = _useState6[0],
40
+ setShowEditModal = _useState6[1];
121
41
 
122
42
  useEffect(function () {
123
- var handleClick = function handleClick(e) {
124
- if (!editModalRef.current || !editModalRef.current.contains(e.target)) {
125
- setShowEditModal(false);
126
- }
127
- };
128
-
129
- document.addEventListener('click', handleClick, false);
130
- return function () {
131
- document.removeEventListener('click', handleClick, false);
132
- };
43
+ if (!props.defaultValue) return;
44
+ setAlias(props.defaultValue.alias || '');
45
+ setTargetData(props.defaultValue.value);
133
46
  }, []);
134
47
  useEffect(function () {
135
- setShowAll(function () {
136
- return showOverview;
137
- });
138
- }, [showOverview]);
139
- useEffect(function () {
140
- var inValue = defaultValue.option || value.option;
141
- var inAlias = defaultValue.alias || value.alias;
142
-
143
- if (JSON.stringify(inValue) !== JSON.stringify(defaultData)) {
144
- setDefaultData(function () {
145
- if (_typeof(inValue) === 'object') {
146
- return _objectSpread({}, inValue);
147
- } else {
148
- return inValue;
149
- }
150
- });
151
- }
48
+ if (!props.value) return;
49
+ setAlias(props.value.alias || '');
50
+ setTargetData(props.value.value || undefined);
51
+ }, [props.value]);
152
52
 
153
- if (inAlias !== alias) {
154
- setAlias(function () {
155
- return inAlias || '';
156
- });
53
+ var onClickIcon = function onClickIcon(name) {
54
+ if (name === 'edit') {
55
+ setShowEditModal(true);
56
+ } else if (name === 'add') {
57
+ if (props.onAdd && enableAdd) {
58
+ props.onAdd({
59
+ alias: alias,
60
+ value: targetData
61
+ });
62
+ }
63
+ } else if (name === 'delete') {
64
+ if (props.onDelete && enableDelete) {
65
+ props.onDelete({
66
+ alias: alias,
67
+ value: targetData
68
+ });
69
+ }
157
70
  }
158
- }, [defaultValue, value]);
159
- useEffect(function () {
160
- setNoAdd(function () {
161
- return addDisable;
71
+ };
72
+
73
+ var onCancelEdit = function onCancelEdit() {
74
+ setShowEditModal(false);
75
+ };
76
+
77
+ var onChangeAlias = function onChangeAlias(value) {
78
+ setShowEditModal(false);
79
+ setAlias(value);
80
+ props.onChange && props.onChange({
81
+ alias: value,
82
+ value: targetData
162
83
  });
163
- }, [addDisable]);
164
- useEffect(function () {
165
- setNoDelete(function () {
166
- return delDisable;
84
+ };
85
+
86
+ var onChange = function onChange(value) {
87
+ setTargetData(value);
88
+ props.onChange && props.onChange({
89
+ alias: alias,
90
+ value: value
167
91
  });
168
- }, [delDisable]);
92
+ };
93
+
169
94
  return /*#__PURE__*/React.createElement("div", {
170
- className: "biz-select-cotainer biz-target-container",
171
- tabIndex: 0
172
- }, /*#__PURE__*/React.cloneElement(children, {
173
- aliasName: alias,
174
- defaultValue: defaultData,
175
- showAll: showAll,
176
- onChange: function onChange(data) {
177
- _onChange && _onChange({
178
- alias: alias,
179
- option: data
180
- });
181
- }
95
+ className: classPrefix
96
+ }, /*#__PURE__*/React.cloneElement(props.children, {
97
+ alias: alias,
98
+ value: targetData,
99
+ onChange: onChange
182
100
  }), /*#__PURE__*/React.createElement("div", {
183
- className: "biz-options"
184
- }, /*#__PURE__*/React.createElement("div", {
185
- className: "biz-option-icon ".concat(noAdd ? 'biz-disabled' : ''),
186
- onClick: function onClick() {
187
- if (!noAdd) {
188
- _onAdd();
189
- }
190
- }
191
- }, /*#__PURE__*/React.createElement(Tooltip, {
192
- title: function title() {
193
- return '添加筛选';
194
- },
195
- color: "#242541",
196
- key: 'delete'
197
- }, /*#__PURE__*/React.createElement(IconFont, {
198
- className: "",
199
- type: 'icon-shaixuan'
200
- }))), /*#__PURE__*/React.createElement("div", {
201
- className: "biz-option-icon biz-option-icon-delete ".concat(noDelete ? 'biz-disabled' : ''),
202
- onClick: function onClick() {
203
- return !noDelete && _onDelete();
204
- }
205
- }, /*#__PURE__*/React.createElement(Tooltip, {
206
- title: function title() {
207
- return '删除';
208
- },
209
- color: "#242541",
210
- key: 'delete'
211
- }, /*#__PURE__*/React.createElement(IconFont, {
212
- className: "",
213
- type: 'icon-qingchu'
214
- }))), defaultData && /*#__PURE__*/React.createElement(Dropdown, {
215
- overlay: menu,
216
- overlayClassName: "large",
101
+ className: "".concat(classPrefix, "-option-list")
102
+ }, /*#__PURE__*/React.createElement(BizTargetOptionIcon, {
103
+ name: "add",
104
+ icon: "icon-shaixuan",
105
+ title: "\u6DFB\u52A0\u7B5B\u9009",
106
+ enabled: enableAdd,
107
+ onClick: onClickIcon
108
+ }), /*#__PURE__*/React.createElement(BizTargetOptionIcon, {
109
+ name: "delete",
110
+ icon: "icon-qingchu",
111
+ title: "\u5220\u9664",
112
+ enabled: enableDelete,
113
+ onClick: onClickIcon
114
+ }), targetData && /*#__PURE__*/React.createElement(Dropdown, {
115
+ overlay: /*#__PURE__*/React.createElement(BizTargetOptionMenu, {
116
+ onClick: onClickIcon,
117
+ enableAdd: enableAdd,
118
+ enableDelete: enableDelete
119
+ }),
217
120
  trigger: ['click']
218
- }, /*#__PURE__*/React.createElement("div", {
219
- className: "biz-option-icon"
220
- }, /*#__PURE__*/React.createElement(Tooltip, {
221
- title: function title() {
222
- return '编辑别名、筛选、删除';
223
- },
224
- color: "#242541",
225
- key: 'delete'
226
- }, /*#__PURE__*/React.createElement(IconFont, {
227
- type: 'icon-gengduocaozuo1'
228
- }))))), showEditModal && /*#__PURE__*/React.createElement("div", {
229
- className: "biz-edit-modal",
230
- ref: editModalRef
231
- }, /*#__PURE__*/React.createElement(BizEventNameEditBox, {
121
+ }, /*#__PURE__*/React.createElement(BizTargetOptionIcon, {
122
+ name: "more",
123
+ icon: "icon-gengduocaozuo1",
124
+ title: "\u7F16\u8F91\u522B\u540D\u3001\u7B5B\u9009\u3001\u5220\u9664",
125
+ enabled: true
126
+ }))), showEditModal && /*#__PURE__*/React.createElement(BizEventNameEditBox, {
232
127
  defaultValue: alias,
233
- onCancel: function onCancel() {
234
- return setShowEditModal(false);
235
- },
236
- onChange: function onChange(value) {
237
- setAlias(function () {
238
- return value;
239
- });
240
- setShowEditModal(false);
241
- _onChange && _onChange({
242
- alias: value,
243
- option: defaultData
244
- });
245
- }
246
- })));
128
+ disabled: targetData === null || targetData === void 0 ? void 0 : (_targetData$event = targetData.event) === null || _targetData$event === void 0 ? void 0 : _targetData$event.name,
129
+ onCancel: onCancelEdit,
130
+ onChange: onChangeAlias
131
+ }));
247
132
  };
248
133
 
134
+ BizTargetSelector.defaultProps = {
135
+ enableAdd: true,
136
+ enableDelete: true
137
+ };
249
138
  export default BizTargetSelector;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ declare const BizTargetOptionIcon: React.FC<{
3
+ enabled?: boolean;
4
+ title?: string;
5
+ name: string;
6
+ icon: string;
7
+ onClick?: (name: string) => void;
8
+ }>;
9
+ export default BizTargetOptionIcon;
@@ -0,0 +1,24 @@
1
+ import { Tooltip } from 'antd';
2
+ import React from 'react';
3
+ import { classPrefix } from '.';
4
+ import IconFont from '../components/iconFont';
5
+
6
+ var BizTargetOptionIcon = function BizTargetOptionIcon(props) {
7
+ var enabled = props.enabled,
8
+ title = props.title;
9
+
10
+ var onClick = function onClick() {
11
+ if (props.onClick && enabled) props.onClick(props.name);
12
+ };
13
+
14
+ return /*#__PURE__*/React.createElement(Tooltip, {
15
+ title: title,
16
+ key: props.name
17
+ }, /*#__PURE__*/React.createElement(IconFont, {
18
+ className: "".concat(classPrefix, "-option-icon ").concat(enabled ? '' : 'disabled', " ").concat(props.name === 'delete' ? classPrefix + '-del-icon' : ''),
19
+ type: props.icon,
20
+ onClick: onClick
21
+ }));
22
+ };
23
+
24
+ export default BizTargetOptionIcon;