@zgfe/business-lib 1.0.0-beta.5 → 1.0.3-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (281) 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 -109
  34. package/es/attributeSelector/index.js +88 -528
  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/bar.js +2 -1
  45. package/es/chart/demo/pie.js +1 -0
  46. package/es/chart/index.d.ts +2 -80
  47. package/es/chart/index.js +34 -29
  48. package/es/chart/styles/index.less +50 -0
  49. package/es/chart/types.d.ts +46 -0
  50. package/es/chart/{type.js → types.js} +0 -0
  51. package/es/chart/util/{chartConfig.d.ts → chartOptionConfig.d.ts} +4 -35
  52. package/es/chart/util/{chartConfig.js → chartOptionConfig.js} +46 -109
  53. package/es/chart/util/formatData.d.ts +3 -7
  54. package/es/chart/util/formatData.js +47 -26
  55. package/es/chart/util/formatOption.d.ts +2 -1
  56. package/es/chart/util/formatOption.js +22 -9
  57. package/es/chart/util/mapUtil.d.ts +3 -3
  58. package/es/chart/util/mapUtil.js +9 -19
  59. package/es/commonStyle/icon.less +130 -110
  60. package/es/commonStyle/select.less +1 -1
  61. package/es/commonStyle/theme.less +520 -470
  62. package/es/components/iconFont.js +4 -2
  63. package/es/context/index.d.ts +16 -0
  64. package/es/context/index.js +3 -0
  65. package/es/datePicker/datePicker.d.ts +10 -0
  66. package/es/datePicker/datePicker.js +115 -0
  67. package/es/datePicker/demo/index.d.ts +1 -0
  68. package/es/datePicker/demo/index.js +9 -2
  69. package/es/datePicker/index.d.ts +4 -27
  70. package/es/datePicker/index.js +72 -148
  71. package/es/datePicker/styles/index.less +48 -0
  72. package/es/datePicker/types.d.ts +24 -0
  73. package/es/{eventSelector/type.js → datePicker/types.js} +0 -0
  74. package/es/datePicker/utils.d.ts +6 -0
  75. package/es/datePicker/utils.js +70 -0
  76. package/es/dialog/components/itemNode.d.ts +10 -0
  77. package/es/dialog/components/itemNode.js +109 -0
  78. package/es/dialog/components/list.d.ts +3 -13
  79. package/es/dialog/components/list.js +15 -12
  80. package/es/dialog/components/selectToInput.d.ts +4 -48
  81. package/es/dialog/components/selectToInput.js +74 -80
  82. package/es/dialog/components/styles/handle.less +39 -0
  83. package/es/dialog/components/styles/list.less +60 -0
  84. package/es/dialog/components/styles/tab.less +55 -0
  85. package/es/dialog/components/tab.d.ts +3 -7
  86. package/es/dialog/components/tab.js +57 -19
  87. package/es/dialog/data/{chart.d.ts → data.d.ts} +9 -0
  88. package/es/dialog/data/{chart.js → data.js} +11 -0
  89. package/es/dialog/demo/index.d.ts +23 -0
  90. package/es/dialog/demo/index.js +34 -3
  91. package/es/dialog/demo/index2.js +14 -2
  92. package/es/dialog/index.d.ts +4 -97
  93. package/es/dialog/index.js +64 -115
  94. package/es/dialog/styles/index.less +11 -0
  95. package/es/dialog/types.d.ts +77 -0
  96. package/es/{targetConditionGroup/type.js → dialog/types.js} +0 -0
  97. package/es/eventSelector/demo/index.js +26 -44
  98. package/es/eventSelector/index.d.ts +4 -25
  99. package/es/eventSelector/index.js +91 -338
  100. package/es/eventSelector/listPanel.d.ts +4 -0
  101. package/es/eventSelector/listPanel.js +197 -0
  102. package/es/eventSelector/option.d.ts +17 -0
  103. package/es/eventSelector/option.js +54 -0
  104. package/es/eventSelector/styles/index.less +77 -0
  105. package/es/eventSelector/types.d.ts +31 -0
  106. package/es/eventSelector/types.js +1 -0
  107. package/es/index.d.ts +13 -10
  108. package/es/index.js +8 -10
  109. package/es/{attributeSelector/data → mock}/env.d.ts +0 -0
  110. package/es/{attributeSelector/data → mock}/env.js +0 -0
  111. package/es/{attributeSelector/data → mock}/event.d.ts +0 -0
  112. package/es/{attributeSelector/data → mock}/event.js +0 -0
  113. package/es/{attributeSelector/data → mock}/user.d.ts +0 -0
  114. package/es/{attributeSelector/data → mock}/user.js +0 -0
  115. package/es/searchInput/index.d.ts +8 -0
  116. package/es/searchInput/index.js +31 -0
  117. package/es/{attributeSelector/demo/multiForm.d.ts → select/demo/group.d.ts} +0 -0
  118. package/es/{globalAttributes/demo/index.js → select/demo/group.js} +49 -31
  119. package/es/select/demo/index.js +49 -21
  120. package/es/{attributeSelector/demo/single.d.ts → select/demo/multiple.d.ts} +0 -0
  121. package/es/{multipleSelector/demo/index.js → select/demo/multiple.js} +55 -12
  122. package/es/select/handle.d.ts +5 -0
  123. package/es/select/handle.js +119 -0
  124. package/es/select/index.d.ts +4 -49
  125. package/es/select/index.js +168 -122
  126. package/es/select/option.d.ts +4 -0
  127. package/es/select/option.js +59 -0
  128. package/es/select/overlay.d.ts +4 -0
  129. package/es/select/overlay.js +154 -0
  130. package/es/select/styles/handle.less +111 -0
  131. package/es/select/styles/index.less +99 -0
  132. package/es/select/types.d.ts +65 -0
  133. package/es/select/types.js +1 -0
  134. package/es/table/demo/data/table.js +1 -1
  135. package/es/table/demo/index.d.ts +1 -1
  136. package/es/table/demo/index.js +9 -8
  137. package/es/table/demo/index3.js +9 -18
  138. package/es/table/index.d.ts +4 -30
  139. package/es/table/index.js +30 -26
  140. package/es/table/styles/index.less +5 -0
  141. package/es/table/type.d.ts +10 -0
  142. package/es/table/type.js +1 -0
  143. package/es/targetConditionGroup/components/targetDimension.d.ts +8 -0
  144. package/es/targetConditionGroup/components/targetDimension.js +153 -0
  145. package/es/targetConditionGroup/data/operates.d.ts +8 -24
  146. package/es/targetConditionGroup/data/operates.js +26 -69
  147. package/es/targetConditionGroup/demo/group.d.ts +3 -0
  148. package/es/targetConditionGroup/demo/group.js +127 -0
  149. package/es/targetConditionGroup/demo/index.js +41 -51
  150. package/es/targetConditionGroup/demo/styles/index.less +29 -0
  151. package/es/targetConditionGroup/index.d.ts +4 -51
  152. package/es/targetConditionGroup/index.js +190 -222
  153. package/es/targetConditionGroup/styles/index.less +25 -0
  154. package/es/targetConditionGroup/types.d.ts +32 -0
  155. package/es/targetConditionGroup/types.js +1 -0
  156. package/es/targetSelector/demo/index.d.ts +1 -0
  157. package/es/targetSelector/demo/index.js +29 -71
  158. package/es/targetSelector/editBox.d.ts +8 -0
  159. package/es/targetSelector/{components/BizEventNameEditBox.js → editBox.js} +49 -24
  160. package/es/targetSelector/index.d.ts +5 -39
  161. package/es/targetSelector/index.js +104 -169
  162. package/es/targetSelector/optionIcon.d.ts +9 -0
  163. package/es/targetSelector/optionIcon.js +24 -0
  164. package/es/targetSelector/optionMenu.d.ts +7 -0
  165. package/es/targetSelector/optionMenu.js +38 -0
  166. package/es/targetSelector/styles/index.less +88 -0
  167. package/es/targetSelector/types.d.ts +18 -0
  168. package/es/targetSelector/types.js +1 -0
  169. package/es/userCondition/conditionTypeList.d.ts +10 -0
  170. package/es/userCondition/conditionTypeList.js +43 -0
  171. package/es/userCondition/conditionWrap.d.ts +7 -0
  172. package/es/userCondition/conditionWrap.js +18 -0
  173. package/es/userCondition/conditions/eventCondition.d.ts +8 -0
  174. package/es/userCondition/conditions/eventCondition.js +104 -0
  175. package/es/userCondition/conditions/periodCondition.d.ts +11 -0
  176. package/es/userCondition/conditions/periodCondition.js +156 -0
  177. package/es/userCondition/conditions/propCondition.d.ts +11 -0
  178. package/es/userCondition/conditions/propCondition.js +147 -0
  179. package/es/userCondition/conditions/runTimesCondition.d.ts +9 -0
  180. package/es/userCondition/conditions/runTimesCondition.js +78 -0
  181. package/es/userCondition/conditions/styles/eventCondition.less +49 -0
  182. package/es/userCondition/conditions/styles/periodCondition.less +14 -0
  183. package/es/userCondition/conditions/styles/propCondition.less +36 -0
  184. package/es/userCondition/conditions/styles/runTimesCondition.less +16 -0
  185. package/es/{multipleSelector → userCondition}/demo/index.d.ts +0 -0
  186. package/es/userCondition/demo/index.js +97 -0
  187. package/es/userCondition/index.d.ts +7 -0
  188. package/es/userCondition/index.js +146 -0
  189. package/es/userCondition/orConditions.d.ts +5 -0
  190. package/es/userCondition/orConditions.js +202 -0
  191. package/es/userCondition/relationLabel.d.ts +6 -0
  192. package/es/userCondition/relationLabel.js +12 -0
  193. package/es/userCondition/styles/conditionTypeList.less +31 -0
  194. package/es/userCondition/styles/conditionWrap.less +14 -0
  195. package/es/userCondition/styles/index.less +13 -0
  196. package/es/userCondition/styles/orConditions.less +16 -0
  197. package/es/userCondition/styles/relationLabel.less +18 -0
  198. package/es/userCondition/types.d.ts +79 -0
  199. package/es/userCondition/types.js +1 -0
  200. package/es/userCondition/util.d.ts +2 -0
  201. package/es/userCondition/util.js +54 -0
  202. package/es/{attributeSelector/demo/singleForm.d.ts → userGroup/demo/group.d.ts} +0 -0
  203. package/es/{targetConditionGroup/demo/form.js → userGroup/demo/group.js} +68 -72
  204. package/es/userGroup/demo/index.d.ts +0 -1
  205. package/es/userGroup/demo/index.js +5 -62
  206. package/es/userGroup/index.d.ts +3 -77
  207. package/es/userGroup/index.js +60 -108
  208. package/es/userGroup/styles/index.less +20 -0
  209. package/es/userGroup/types.d.ts +15 -0
  210. package/es/userGroup/types.js +1 -0
  211. package/es/utils/ajax.js +5 -20
  212. package/es/utils/type.d.ts +42 -44
  213. package/es/utils/util.d.ts +1 -35
  214. package/es/utils/util.js +27 -57
  215. package/package.json +11 -4
  216. package/es/attributeSelector/demo/multi.js +0 -39
  217. package/es/attributeSelector/demo/multiForm.js +0 -64
  218. package/es/attributeSelector/demo/single.js +0 -43
  219. package/es/attributeSelector/group.d.ts +0 -31
  220. package/es/attributeSelector/group.js +0 -225
  221. package/es/attributeSelector/index.less +0 -172
  222. package/es/chart/index.less +0 -38
  223. package/es/chart/style/circle.svg +0 -4
  224. package/es/chart/type.d.ts +0 -22
  225. package/es/datePicker/data.d.ts +0 -9
  226. package/es/datePicker/data.js +0 -65
  227. package/es/datePicker/demo/form.d.ts +0 -2
  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 -84
  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 -46
  245. package/es/globalAttributes/index.js +0 -117
  246. package/es/multipleSelector/index.d.ts +0 -36
  247. package/es/multipleSelector/index.js +0 -103
  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 -111
  253. package/es/targetConditionGroup/components/conditionItem.d.ts +0 -47
  254. package/es/targetConditionGroup/components/conditionItem.js +0 -259
  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/index.less +0 -64
  267. package/es/targetConditionGroup/type.d.ts +0 -50
  268. package/es/targetSelector/components/BizCascadeBox.d.ts +0 -34
  269. package/es/targetSelector/components/BizCascadeBox.js +0 -213
  270. package/es/targetSelector/components/BizEventNameEditBox.d.ts +0 -20
  271. package/es/targetSelector/demo/form.d.ts +0 -2
  272. package/es/targetSelector/demo/form.js +0 -133
  273. package/es/targetSelector/demo/nodata.d.ts +0 -2
  274. package/es/targetSelector/demo/nodata.js +0 -13
  275. package/es/targetSelector/index.less +0 -28
  276. package/es/userGroup/demo/cluster.d.ts +0 -3
  277. package/es/userGroup/demo/cluster.js +0 -102
  278. package/es/userGroup/demo/index.less +0 -3
  279. package/es/userGroup/index.less +0 -2
  280. package/es/userGroup/userCluster.d.ts +0 -63
  281. package/es/userGroup/userCluster.js +0 -255
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { AttributeSelect } from '../../attributeSelector/types';
3
+ declare const ValuesList: React.FC<{
4
+ attr?: AttributeSelect.Value;
5
+ operate?: string;
6
+ defaultValue?: string[];
7
+ includeToday?: boolean;
8
+ onChange?: (value: string[]) => void;
9
+ }>;
10
+ export default ValuesList;
@@ -0,0 +1,188 @@
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 { DatePicker, Input } from 'antd';
14
+ import locale from 'antd/es/date-picker/locale/zh_CN';
15
+ import moment from 'moment';
16
+ import React, { useEffect, useState } from 'react';
17
+ import { classPrefix } from '..';
18
+ import { PropCategory, PropType } from '../../attributeSelector/types';
19
+ import IconFont from '../../components/iconFont';
20
+ import BizSelect from '../../select';
21
+ import { OperateTypes } from '../types';
22
+ import { propSubtype } from '../utils/operates';
23
+ import StringList from './stringList';
24
+ var RangePicker = DatePicker.RangePicker;
25
+
26
+ var ValuesList = function ValuesList(props) {
27
+ var attr = props.attr,
28
+ defaultValue = props.defaultValue,
29
+ operate = props.operate,
30
+ includeToday = props.includeToday;
31
+ var initValue = [moment().subtract(1, 'weeks').format('YYYY-MM-DD'), moment().subtract(includeToday ? 0 : 1, 'days').format('YYYY-MM-DD')];
32
+
33
+ var _useState = useState(),
34
+ _useState2 = _slicedToArray(_useState, 2),
35
+ current = _useState2[0],
36
+ setCurrent = _useState2[1];
37
+
38
+ var _useState3 = useState('1'),
39
+ _useState4 = _slicedToArray(_useState3, 2),
40
+ unit = _useState4[0],
41
+ setUnit = _useState4[1];
42
+
43
+ var _useState5 = useState(true),
44
+ _useState6 = _slicedToArray(_useState5, 2),
45
+ ready = _useState6[0],
46
+ setReady = _useState6[1];
47
+
48
+ useEffect(function () {
49
+ if (defaultValue) {
50
+ if ((attr === null || attr === void 0 ? void 0 : attr.propCategory) === 'userProp' && (attr === null || attr === void 0 ? void 0 : attr.subtype) === 2) {
51
+ var num = String(parseFloat(defaultValue[0]) / getUnitCount(defaultValue[1]));
52
+ setCurrent([num, defaultValue[1]]);
53
+ } else {
54
+ setCurrent(defaultValue);
55
+ }
56
+ }
57
+
58
+ setReady(false);
59
+ }, []);
60
+ useEffect(function () {
61
+ if (operate === OperateTypes.Absolute || operate === OperateTypes.Relative) {
62
+ var data = operate === OperateTypes.Absolute ? initValue : ['30', '1'];
63
+ onChange(data);
64
+ }
65
+ }, [operate]);
66
+ useEffect(function () {
67
+ if (!ready && (attr === null || attr === void 0 ? void 0 : attr.type) !== PropType.DATE) {
68
+ onChange([]);
69
+ setCurrent([]);
70
+ }
71
+ }, [attr]);
72
+
73
+ var onChange = function onChange(data) {
74
+ setCurrent(data);
75
+ if (props.onChange) props.onChange(data);
76
+ };
77
+
78
+ var onChangeRange = function onChangeRange() {
79
+ onChange(arguments.length <= 1 ? undefined : arguments[1]);
80
+ };
81
+
82
+ var onChangeDate = function onChangeDate(e) {
83
+ var data = [e.target.value, '1'];
84
+ onChange(data);
85
+ };
86
+
87
+ var onChangeNumber = function onChangeNumber(e) {
88
+ var data = [e.target.value];
89
+
90
+ if ((attr === null || attr === void 0 ? void 0 : attr.propCategory) === PropCategory.UserProp && (attr === null || attr === void 0 ? void 0 : attr.subtype) === 2) {
91
+ var num = String(parseFloat(e.target.value) * getUnitCount(unit));
92
+ data = [num, unit];
93
+ setCurrent([e.target.value, unit]);
94
+ } else {
95
+ setCurrent(data);
96
+ }
97
+
98
+ if (props.onChange) props.onChange(data);
99
+ };
100
+
101
+ var onChangeUnit = function onChangeUnit(data) {
102
+ setUnit(data.value);
103
+
104
+ if (current && current[0]) {
105
+ var num = String(parseFloat(current[0]) * getUnitCount(data.value));
106
+ if (props.onChange) props.onChange([num, data.value]);
107
+ }
108
+ };
109
+
110
+ var getUnitCount = function getUnitCount(value) {
111
+ return value === '1' ? 3600 : value === '2' ? 60 : 1;
112
+ };
113
+
114
+ var disabledDate = function disabledDate(current) {
115
+ return current && current > moment().endOf('day');
116
+ };
117
+
118
+ if (!attr || !operate || ready) {
119
+ return /*#__PURE__*/React.createElement(BizSelect, {
120
+ disable: true,
121
+ className: "".concat(classPrefix, "-multi-select"),
122
+ theme: "secondary",
123
+ size: "base",
124
+ options: []
125
+ });
126
+ }
127
+
128
+ if (attr.type === PropType.STRING) {
129
+ return /*#__PURE__*/React.createElement(StringList, {
130
+ attr: attr,
131
+ operate: operate,
132
+ value: current,
133
+ onChange: onChange
134
+ });
135
+ } else if (attr.type === PropType.NUMBER) {
136
+ var numberAfter = /*#__PURE__*/React.createElement(BizSelect, {
137
+ defaultValue: {
138
+ value: current && ['1', '2', '3'].includes(current[1]) ? current[1] : unit
139
+ },
140
+ keyField: "value",
141
+ labelField: "label",
142
+ theme: "secondary",
143
+ className: "".concat(classPrefix, "-input-select"),
144
+ onChange: onChangeUnit,
145
+ options: propSubtype
146
+ });
147
+ return /*#__PURE__*/React.createElement(Input, {
148
+ className: "".concat(classPrefix, "-input"),
149
+ value: current && current.length ? current[0] : '',
150
+ placeholder: "\u8BF7\u8F93\u5165",
151
+ type: "number",
152
+ onChange: onChangeNumber,
153
+ addonAfter: attr.propCategory === 'userProp' && attr.subtype === 1 ? '%' : attr.propCategory === 'userProp' && attr.subtype === 2 ? numberAfter : null
154
+ });
155
+ } else {
156
+ if (operate === OperateTypes.Absolute) {
157
+ return /*#__PURE__*/React.createElement(RangePicker, {
158
+ value: [moment(current[0], 'YYYY-MM-DD'), moment(current[1], 'YYYY-MM-DD')],
159
+ allowClear: false,
160
+ className: "".concat(classPrefix, "-date"),
161
+ inputReadOnly: true,
162
+ locale: locale,
163
+ disabledDate: disabledDate,
164
+ placement: 'bottomRight',
165
+ separator: '至',
166
+ suffixIcon: /*#__PURE__*/React.createElement(IconFont, {
167
+ type: 'icon-shijian1'
168
+ }),
169
+ format: 'YYYY-MM-DD',
170
+ onChange: onChangeRange
171
+ });
172
+ } else {
173
+ return /*#__PURE__*/React.createElement(Input, {
174
+ className: "".concat(classPrefix, "-input"),
175
+ value: current && current[0] ? current[0] : 30,
176
+ placeholder: "\u8BF7\u8F93\u5165",
177
+ type: "number",
178
+ addonAfter: "\u5929",
179
+ onChange: onChangeDate
180
+ });
181
+ }
182
+ }
183
+ };
184
+
185
+ ValuesList.defaultProps = {
186
+ includeToday: false
187
+ };
188
+ export default ValuesList;
@@ -0,0 +1,82 @@
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, { useRef, useState } from 'react';
14
+ import { BizGlobalDataContext, BizConditionGroup, convertAttributeData } from '@zgfe/business-lib';
15
+ import eventData from '../../mock/event';
16
+ import envData from '../../mock/env';
17
+ import userData from '../../mock/user';
18
+ import { Button } from 'antd';
19
+ var conditions = [{
20
+ propCategory: 'userProp',
21
+ type: 2,
22
+ operation: 'gt',
23
+ values: ['25200', '1'],
24
+ attrName: 'duration',
25
+ category: 'fixed',
26
+ subtype: 2
27
+ }, {
28
+ propCategory: 'eventProp',
29
+ type: 1,
30
+ operation: 'equal',
31
+ values: ['Safari', 'Apple WebKit'],
32
+ attrId: 30183426
33
+ }];
34
+ export default (function () {
35
+ var _useState = useState({
36
+ relation: 'and',
37
+ conditions: conditions
38
+ }),
39
+ _useState2 = _slicedToArray(_useState, 2),
40
+ data = _useState2[0],
41
+ setData = _useState2[1];
42
+
43
+ var store = convertAttributeData({
44
+ eventList: eventData,
45
+ userPropList: userData,
46
+ envPropList: envData
47
+ });
48
+
49
+ var _useState3 = useState(conditions.length),
50
+ _useState4 = _slicedToArray(_useState3, 2),
51
+ count = _useState4[0],
52
+ setCount = _useState4[1];
53
+
54
+ var conditionRef = useRef(null);
55
+
56
+ var onChange = function onChange(value) {
57
+ setData(value);
58
+ };
59
+
60
+ var onClick = function onClick() {
61
+ conditionRef.current.add();
62
+ };
63
+
64
+ return /*#__PURE__*/React.createElement(BizGlobalDataContext.Provider, {
65
+ value: {
66
+ eventGroupList: store.eventGroupList,
67
+ userPropList: store.userPropList,
68
+ eventEnvList: store.envPropList,
69
+ currentApp: {
70
+ appId: 35510,
71
+ platform: 0
72
+ }
73
+ }
74
+ }, /*#__PURE__*/React.createElement(BizConditionGroup, {
75
+ ref: conditionRef,
76
+ value: data,
77
+ onChange: onChange,
78
+ onConditionsCount: setCount
79
+ }), /*#__PURE__*/React.createElement("br", null), count < 3 && /*#__PURE__*/React.createElement(Button, {
80
+ onClick: onClick
81
+ }, "\u6DFB\u52A0"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("p", null, "\u5F53\u524D\u503C\uFF1A", JSON.stringify(data)));
82
+ });
@@ -11,43 +11,63 @@ 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 { Button, Form } from 'antd';
15
- import { BizDatePicker } from '@zgfe/business-lib';
14
+ import { BizGlobalDataContext, BizConditionItem, convertAttributeData } from '@zgfe/business-lib';
15
+ import eventData from '../../mock/event';
16
+ import envData from '../../mock/env';
17
+ import userData from '../../mock/user';
18
+ import { Form } from 'antd';
16
19
  export default (function () {
17
20
  var _Form$useForm = Form.useForm(),
18
21
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
19
22
  form = _Form$useForm2[0];
20
23
 
21
24
  var _useState = useState({
22
- time: {}
25
+ condition: {
26
+ propCategory: 'userProp',
27
+ type: 2,
28
+ operation: 'lt',
29
+ values: ['25200', '1'],
30
+ subtype: 2,
31
+ attrName: 'duration',
32
+ category: 'fixed'
33
+ }
23
34
  }),
24
35
  _useState2 = _slicedToArray(_useState, 2),
25
36
  formData = _useState2[0],
26
37
  setFormData = _useState2[1];
27
38
 
28
- var onFinish = function onFinish(values) {
29
- setFormData(values);
30
- };
39
+ var store = convertAttributeData({
40
+ eventList: eventData,
41
+ userPropList: userData,
42
+ envPropList: envData
43
+ });
31
44
 
32
- var onFinishFailed = function onFinishFailed(errorInfo) {
33
- console.log('Failed:', errorInfo);
45
+ var onChange = function onChange() {
46
+ setFormData(arguments.length <= 1 ? undefined : arguments[1]);
34
47
  };
35
48
 
36
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Form, {
49
+ return /*#__PURE__*/React.createElement(BizGlobalDataContext.Provider, {
50
+ value: {
51
+ eventGroupList: store.eventGroupList,
52
+ userPropList: store.userPropList,
53
+ eventEnvList: store.envPropList,
54
+ currentApp: {
55
+ appId: 35510,
56
+ platform: 0
57
+ }
58
+ }
59
+ }, /*#__PURE__*/React.createElement(Form, {
37
60
  form: form,
38
- onFinish: onFinish,
39
- onFinishFailed: onFinishFailed,
40
- initialValues: formData
61
+ initialValues: formData,
62
+ onValuesChange: onChange
41
63
  }, /*#__PURE__*/React.createElement(Form.Item, {
42
- label: "",
43
- name: "time"
44
- }, /*#__PURE__*/React.createElement(BizDatePicker, null)), /*#__PURE__*/React.createElement(Form.Item, {
45
- wrapperCol: {
46
- offset: 8,
47
- span: 16
48
- }
49
- }, /*#__PURE__*/React.createElement(Button, {
50
- type: "primary",
51
- htmlType: "submit"
52
- }, "Submit"))), /*#__PURE__*/React.createElement("p", null, JSON.stringify(formData)));
64
+ name: "condition"
65
+ }, /*#__PURE__*/React.createElement(BizConditionItem, {
66
+ eventIdList: [24143016, 24256188, 24095076],
67
+ enableEventProp: true,
68
+ disableItemList: [{
69
+ name: 'is_anonymous',
70
+ propCategory: 'userProp'
71
+ }]
72
+ }))), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("p", null, "\u5F53\u524Dform\u503C\uFF1A", JSON.stringify(formData)));
53
73
  });
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { AttrConditionTypes } from './types';
3
+ import './styles/group.less';
4
+ declare const _default: React.ForwardRefExoticComponent<AttrConditionTypes.GroupProp & React.RefAttributes<any>>;
5
+ export default _default;
@@ -0,0 +1,183 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+
7
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
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, useImperativeHandle, useState } from 'react';
22
+ import BizConditionItem from './index';
23
+ import './styles/group.less';
24
+ import _ from 'lodash';
25
+ import { Skeleton } from 'antd';
26
+
27
+ var BizConditionGroup = function BizConditionGroup(props, ref) {
28
+ var eventIdList = props.eventIdList,
29
+ enableDelete = props.enableDelete,
30
+ enableEventProp = props.enableEventProp,
31
+ enableUserProp = props.enableUserProp,
32
+ enableEnvProp = props.enableEnvProp,
33
+ disableItemList = props.disableItemList,
34
+ onConditionsCount = props.onConditionsCount;
35
+
36
+ var _useState = useState('and'),
37
+ _useState2 = _slicedToArray(_useState, 2),
38
+ relation = _useState2[0],
39
+ setRelation = _useState2[1];
40
+
41
+ var _useState3 = useState([]),
42
+ _useState4 = _slicedToArray(_useState3, 2),
43
+ conditions = _useState4[0],
44
+ setConditions = _useState4[1];
45
+
46
+ var _useState5 = useState(true),
47
+ _useState6 = _slicedToArray(_useState5, 2),
48
+ ready = _useState6[0],
49
+ setReady = _useState6[1];
50
+
51
+ var classPrefix = 'biz-condition';
52
+ useEffect(function () {
53
+ var data = props.defaultValue || props.value;
54
+
55
+ if (data) {
56
+ if (data.relation) setRelation(data.relation);
57
+
58
+ if (data.conditions) {
59
+ setConditions(function () {
60
+ return addKeyToGroup(data.conditions);
61
+ });
62
+ }
63
+ }
64
+
65
+ setReady(false);
66
+ }, []);
67
+ useImperativeHandle(ref, function () {
68
+ return {
69
+ add: function add() {
70
+ onConditionsCount && onConditionsCount(conditions.length + 1);
71
+ setConditions(function (conditions) {
72
+ conditions.push({
73
+ key: Math.random()
74
+ });
75
+ return _toConsumableArray(conditions);
76
+ });
77
+ }
78
+ };
79
+ });
80
+
81
+ var addKeyToGroup = function addKeyToGroup(data) {
82
+ return data.map(function (item) {
83
+ return {
84
+ key: Math.random(),
85
+ data: item
86
+ };
87
+ });
88
+ };
89
+
90
+ var removeKeyToGroup = function removeKeyToGroup(data) {
91
+ var group = [];
92
+ data.forEach(function (item) {
93
+ if (item.data) group.push(item.data);
94
+ });
95
+ return group;
96
+ };
97
+
98
+ var onClickRelation = function onClickRelation(e) {
99
+ e.stopPropagation();
100
+ var data = e.target.innerText === '且' ? 'and' : 'or';
101
+ setRelation(data);
102
+
103
+ if (props.onChange) {
104
+ var group = removeKeyToGroup(conditions);
105
+ props.onChange({
106
+ relation: data,
107
+ conditions: group
108
+ });
109
+ }
110
+ };
111
+
112
+ var _onChange = function onChange(data, index) {
113
+ var conditionArr = _.cloneDeep(conditions);
114
+
115
+ conditionArr[index].data = data;
116
+ setConditions(conditionArr);
117
+ onConditionsCount && onConditionsCount(conditionArr.length);
118
+
119
+ if (props.onChange) {
120
+ var group = removeKeyToGroup(conditionArr);
121
+ props.onChange({
122
+ relation: relation,
123
+ conditions: group
124
+ });
125
+ }
126
+ };
127
+
128
+ var _onDelete = function onDelete(index) {
129
+ var conditionArr = _.cloneDeep(conditions);
130
+
131
+ conditionArr.splice(index, 1);
132
+ setConditions(conditionArr);
133
+ onConditionsCount && onConditionsCount(conditionArr.length);
134
+
135
+ if (props.onChange) {
136
+ var group = removeKeyToGroup(conditionArr);
137
+ props.onChange({
138
+ relation: relation,
139
+ conditions: group
140
+ });
141
+ }
142
+ };
143
+
144
+ return /*#__PURE__*/React.createElement("div", {
145
+ className: classPrefix
146
+ }, /*#__PURE__*/React.createElement(Skeleton, {
147
+ loading: ready,
148
+ active: true,
149
+ paragraph: {
150
+ rows: 2
151
+ }
152
+ }, /*#__PURE__*/React.createElement("div", {
153
+ className: "".concat(classPrefix, "-group-handle")
154
+ }, conditions.length > 1 && /*#__PURE__*/React.createElement("div", {
155
+ className: "".concat(classPrefix, "-group-operate"),
156
+ onClick: onClickRelation
157
+ }, /*#__PURE__*/React.createElement("div", {
158
+ className: "".concat(classPrefix, "-group-operate-text ").concat(relation === 'and' ? 'active' : '')
159
+ }, "\u4E14"), /*#__PURE__*/React.createElement("div", {
160
+ className: "".concat(classPrefix, "-group-operate-text ").concat(relation === 'or' ? 'active' : '')
161
+ }, "\u6216"))), /*#__PURE__*/React.createElement("div", {
162
+ className: "".concat(classPrefix, "-item-container")
163
+ }, conditions.map(function (item, index) {
164
+ return /*#__PURE__*/React.createElement(BizConditionItem, {
165
+ key: item.key,
166
+ value: item.data,
167
+ eventIdList: eventIdList,
168
+ enableDelete: enableDelete,
169
+ enableEventProp: enableEventProp,
170
+ enableUserProp: enableUserProp,
171
+ enableEnvProp: enableEnvProp,
172
+ disableItemList: disableItemList,
173
+ onChange: function onChange(data) {
174
+ return _onChange(data, index);
175
+ },
176
+ onDelete: function onDelete() {
177
+ return _onDelete(index);
178
+ }
179
+ });
180
+ }))));
181
+ };
182
+
183
+ export default /*#__PURE__*/React.forwardRef(BizConditionGroup);
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import './styles/index.less';
3
+ import { AttrConditionTypes } from './types';
4
+ export declare const classPrefix = "biz-condition-item";
5
+ declare const BizConditionItem: React.FC<AttrConditionTypes.ItemProp>;
6
+ export default BizConditionItem;