@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
@@ -0,0 +1,29 @@
1
+ @import '../../../assets/styles/inner.less';
2
+
3
+ .biz-add-btn {
4
+ width: fit-content;
5
+ padding: 0 4px;
6
+ line-height: 20px;
7
+ background-color: #fff;
8
+ border-radius: 4px;
9
+
10
+ span {
11
+ margin-right: 5px;
12
+ }
13
+
14
+ &.disabled {
15
+ color: @disabled-color;
16
+ cursor: not-allowed;
17
+ span {
18
+ color: @disabled-color;
19
+ }
20
+ }
21
+
22
+ &:hover:not(.disabled) {
23
+ .__default-hover();
24
+
25
+ span {
26
+ color: @primary-color;
27
+ }
28
+ }
29
+ }
@@ -1,59 +1,6 @@
1
1
  import React from 'react';
2
- import { OptionType, TargetCondition } from './type';
3
- import './index.less';
4
- interface TargetConditionProps {
5
- /**
6
- * @description 默认值
7
- * @default {}
8
- */
9
- defaultValue?: TargetCondition;
10
- /**
11
- * @description 默认值
12
- * @default {}
13
- */
14
- value?: TargetCondition;
15
- /**
16
- * @description 数据化配置选项内容
17
- * @description.zh-CN
18
- * @default -
19
- */
20
- options?: OptionType;
21
- /**
22
- * @description 属性最多个数
23
- * @description.zh-CN
24
- * @default 3
25
- */
26
- max?: number;
27
- /**
28
- * @description 是否展示事件概览
29
- * @default true
30
- */
31
- showOverview?: boolean;
32
- className?: string;
33
- /**
34
- * @description 自定义指标下拉框 label、value 的字段
35
- * @description.zh-CN
36
- * @default { label: 'name', value: 'id', groupLabel: 'name', groupValue: 'id' }
37
- */
38
- fieldNames?: {
39
- label: string;
40
- value: string;
41
- groupLabel: string;
42
- groupValue: string;
43
- children: string;
44
- };
45
- /**
46
- * @description 指标删除回调
47
- * @description.zh-CN
48
- * @default
49
- */
50
- onDelete?: () => void;
51
- /**
52
- * @description 改变回调
53
- * @description.zh-CN
54
- * @default
55
- */
56
- onChange?: (data: TargetCondition) => void;
57
- }
58
- declare const BizTargetCondition: React.FC<TargetConditionProps>;
2
+ import { TargetConditionTypes } from './types';
3
+ import './styles/index.less';
4
+ export declare const classPrefix = "biz-target";
5
+ declare const BizTargetCondition: React.FC<TargetConditionTypes.Props>;
59
6
  export default BizTargetCondition;
@@ -1,19 +1,3 @@
1
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
2
-
3
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
-
5
- 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."); }
6
-
7
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8
-
9
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
-
11
- 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; }
12
-
13
- 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; }
14
-
15
- 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; }
16
-
17
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
18
2
 
19
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."); }
@@ -26,306 +10,225 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
26
10
 
27
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
28
12
 
29
- import React, { useEffect, useState } from 'react';
30
- import { BizTargetSelector, BizEventSelector, BizConditionGroup } from '..';
31
- import IconFont from '../components/iconFont';
32
- import { Dropdown, Menu } from 'antd';
33
- import { dimensionOperate } from './data/operates';
34
- import './index.less';
35
- import SubMenu from 'antd/lib/menu/SubMenu';
13
+ import React, { useEffect, useRef, useState } from 'react';
14
+ import BizTargetSelector from '../targetSelector';
15
+ import BizTargetDimension from './components/targetDimension';
16
+ import './styles/index.less';
17
+ import BizConditionGroup from '../attrConditions/group';
18
+ import { Skeleton } from 'antd';
19
+ import _ from 'lodash';
20
+ export var classPrefix = 'biz-target';
36
21
 
37
22
  var BizTargetCondition = function BizTargetCondition(props) {
38
- var _props$defaultValue = props.defaultValue,
39
- defaultValue = _props$defaultValue === void 0 ? {} : _props$defaultValue,
40
- _props$value = props.value,
41
- value = _props$value === void 0 ? {} : _props$value,
42
- options = props.options,
43
- _props$max = props.max,
44
- max = _props$max === void 0 ? 3 : _props$max,
45
- className = props.className,
46
- _props$showOverview = props.showOverview,
47
- showOverview = _props$showOverview === void 0 ? true : _props$showOverview,
48
- _props$fieldNames = props.fieldNames,
49
- fieldNames = _props$fieldNames === void 0 ? {
50
- label: 'event_name',
51
- value: 'event_id',
52
- groupLabel: 'groupName',
53
- groupValue: 'groupId',
54
- children: 'eventList'
55
- } : _props$fieldNames,
56
- onChange = props.onChange,
57
- onDelete = props.onDelete;
58
-
59
- var _useState = useState({}),
23
+ var _targetData$value2, _targetData$value2$ev, _targetData$value3, _targetData$value3$ev, _targetData$value4, _targetData$value4$ev, _targetData$value5, _targetData$value5$ev;
24
+
25
+ var max = props.max;
26
+
27
+ var _useState = useState(),
60
28
  _useState2 = _slicedToArray(_useState, 2),
61
- currentTarget = _useState2[0],
62
- setCurrentTarget = _useState2[1];
29
+ targetData = _useState2[0],
30
+ setTargetData = _useState2[1];
63
31
 
64
- var _useState3 = useState(),
32
+ var _useState3 = useState({
33
+ analysisIndex: 'number'
34
+ }),
65
35
  _useState4 = _slicedToArray(_useState3, 2),
66
- eventGroupId = _useState4[0],
67
- setEventGroupId = _useState4[1];
36
+ dimension = _useState4[0],
37
+ setDimension = _useState4[1];
68
38
 
69
- var _useState5 = useState({}),
39
+ var _useState5 = useState(),
70
40
  _useState6 = _slicedToArray(_useState5, 2),
71
- targetData = _useState6[0],
72
- setTargetData = _useState6[1];
41
+ filters = _useState6[0],
42
+ setFilters = _useState6[1];
73
43
 
74
- var _useState7 = useState({}),
44
+ var _useState7 = useState(true),
75
45
  _useState8 = _slicedToArray(_useState7, 2),
76
- attrsData = _useState8[0],
77
- setAttrsData = _useState8[1];
46
+ enableAdd = _useState8[0],
47
+ setEnableAdd = _useState8[1];
78
48
 
79
- var _useState9 = useState(dimensionOperate[0]),
49
+ var _useState9 = useState(true),
80
50
  _useState10 = _slicedToArray(_useState9, 2),
81
- dimension = _useState10[0],
82
- setDimension = _useState10[1]; // 禁止筛选
51
+ enableDelete = _useState10[0],
52
+ setEnableDelete = _useState10[1];
83
53
 
84
-
85
- var _useState11 = useState(false),
54
+ var _useState11 = useState(0),
86
55
  _useState12 = _slicedToArray(_useState11, 2),
87
- addDisable = _useState12[0],
88
- setAddDisable = _useState12[1];
56
+ count = _useState12[0],
57
+ setCount = _useState12[1];
89
58
 
90
- var _useState13 = useState(false),
59
+ var _useState13 = useState(true),
91
60
  _useState14 = _slicedToArray(_useState13, 2),
92
- noDelete = _useState14[0],
93
- setNoDelete = _useState14[1];
61
+ isAdd = _useState14[0],
62
+ setIsAdd = _useState14[1];
63
+
64
+ var conditionRef = useRef(null);
94
65
 
95
- var _useState15 = useState(showOverview),
66
+ var _useState15 = useState(true),
96
67
  _useState16 = _slicedToArray(_useState15, 2),
97
- showAll = _useState16[0],
98
- setShowAll = _useState16[1];
68
+ ready = _useState16[0],
69
+ setReady = _useState16[1];
99
70
 
100
71
  useEffect(function () {
101
- var attrData = Object.keys(defaultValue).length > 0 ? defaultValue : value;
72
+ var value = props.defaultValue || props.value;
102
73
 
103
- if (JSON.stringify(currentTarget) !== JSON.stringify(attrData)) {
104
- setCurrentTarget(function () {
105
- return _objectSpread({}, attrData);
106
- });
74
+ if (value) {
75
+ var _value$filters;
76
+
77
+ setTargetData(formateTargetValue(value));
78
+ setDimension(value.analysisDimension);
79
+ setFilters(value.filters);
80
+
81
+ if ((_value$filters = value.filters) === null || _value$filters === void 0 ? void 0 : _value$filters.conditions) {
82
+ setCount(value.filters.conditions.length);
83
+ }
107
84
  }
108
- }, [defaultValue, value]);
109
- useEffect(function () {
110
- setShowAll(function () {
111
- return showOverview;
112
- });
113
- }, [showOverview]);
85
+
86
+ setReady(false);
87
+ }, []);
114
88
  useEffect(function () {
115
- var alias = currentTarget.alias,
116
- eventId = currentTarget.eventId,
117
- eventGroupId = currentTarget.eventGroupId,
118
- analysisIndex = currentTarget.analysisIndex,
119
- filters = currentTarget.filters;
120
- var arr = []; // 属性组添加key
121
-
122
- if (filters && filters.conditions) {
123
- arr = filters.conditions.map(function (item) {
124
- var attrId = Math.random().toString();
125
- return _objectSpread({
126
- key: attrId
127
- }, item);
128
- });
129
- }
89
+ if (targetData === null || targetData === void 0 ? void 0 : targetData.value) {
90
+ var _targetData$value$eve;
130
91
 
131
- var relation = filters && filters.relation || '';
132
- var filterData = {
133
- relation: relation,
134
- conditions: _toConsumableArray(arr)
135
- };
136
-
137
- if (JSON.stringify(filterData) !== JSON.stringify(attrsData)) {
138
- setAttrsData(function () {
139
- return _objectSpread({}, filterData);
140
- });
141
- } // 维度赋值
142
-
143
-
144
- if (analysisIndex && analysisIndex !== dimension.value) {
145
- var getDefault = function getDefault(data) {
146
- var _iterator = _createForOfIteratorHelper(data),
147
- _step;
148
-
149
- try {
150
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
151
- var _value = _step.value;
152
-
153
- if (_value.value === analysisIndex) {
154
- return _value;
155
- }
156
- }
157
- } catch (err) {
158
- _iterator.e(err);
159
- } finally {
160
- _iterator.f();
161
- }
92
+ var canAdd = true,
93
+ canDelete = true;
162
94
 
163
- return data[0];
164
- };
95
+ if (((_targetData$value$eve = targetData.value.event) === null || _targetData$value$eve === void 0 ? void 0 : _targetData$value$eve.id) === -100) {
96
+ var _targetData$value$gro;
165
97
 
166
- var data = getDefault(dimensionOperate);
167
- setDimension(function () {
168
- return _objectSpread({}, data);
169
- });
170
- } // 事件下拉赋值
98
+ canAdd = false;
99
+ setFilters(undefined);
171
100
 
101
+ if (!((_targetData$value$gro = targetData.value.group) === null || _targetData$value$gro === void 0 ? void 0 : _targetData$value$gro.id)) {
102
+ canDelete = false;
103
+ }
104
+ } else {
105
+ canAdd = count < max;
106
+ }
172
107
 
108
+ setEnableAdd(canAdd);
109
+ setEnableDelete(canDelete);
110
+ } else {
111
+ setEnableAdd(false);
112
+ }
113
+ }, [targetData === null || targetData === void 0 ? void 0 : targetData.value, count]);
114
+
115
+ var formateTargetValue = function formateTargetValue(data) {
173
116
  var target = {};
174
117
 
175
- if (alias) {
176
- target.alias = alias;
118
+ if (data.alias) {
119
+ if (data.eventName && data.eventName === data.alias) {
120
+ target.alias = '';
121
+ } else {
122
+ target.alias = data.alias;
123
+ }
177
124
  }
178
125
 
179
- if (eventId) {
180
- // 事件概览时id为-1,此时有事件的分组
181
- target.option = eventId < 0 ? "".concat(eventId, ",").concat(eventGroupId || -2) : eventId;
182
- target.eventId = eventId;
183
- target.eventGroupId = eventGroupId;
184
- setAddDisable(function () {
185
- return eventId < 0;
186
- });
187
- var flag = !!(eventGroupId && eventGroupId < 0);
188
- setNoDelete(function () {
189
- return eventId < 0 && flag;
190
- });
126
+ if (data.eventId) {
127
+ target.value = {
128
+ event: {
129
+ id: data.eventId,
130
+ name: data.eventName
131
+ }
132
+ };
133
+
134
+ if (data.eventGroupId) {
135
+ target.value.group = {
136
+ id: data.eventGroupId
137
+ };
138
+ }
191
139
  }
192
140
 
193
- if (JSON.stringify(targetData) !== JSON.stringify(target)) {
194
- setTargetData(function () {
195
- return target;
196
- });
141
+ return target;
142
+ };
143
+
144
+ var onChangeTarget = function onChangeTarget(target) {
145
+ var _target$value, _target$value$event, _targetData$value, _targetData$value$eve2;
146
+
147
+ setTargetData(target);
148
+
149
+ var filterData = _.cloneDeep(filters);
150
+
151
+ if (((_target$value = target.value) === null || _target$value === void 0 ? void 0 : (_target$value$event = _target$value.event) === null || _target$value$event === void 0 ? void 0 : _target$value$event.id) !== (targetData === null || targetData === void 0 ? void 0 : (_targetData$value = targetData.value) === null || _targetData$value === void 0 ? void 0 : (_targetData$value$eve2 = _targetData$value.event) === null || _targetData$value$eve2 === void 0 ? void 0 : _targetData$value$eve2.id)) {
152
+ filterData = undefined;
153
+ setFilters(undefined);
154
+ setIsAdd(false);
155
+ setCount(0);
197
156
  }
198
- }, [currentTarget]);
199
-
200
- var _onChange = function _onChange(target, attr) {
201
- var dimensionData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : dimension;
202
- var attrArray = attr.conditions ? attr.conditions.map(function (item) {
203
- delete item.key;
204
- return item;
205
- }) : [];
206
- var option = target.option;
207
- var eArr = String(option).split(',');
208
- onChange && onChange({
209
- type: 'event',
210
- eventId: eArr[0],
211
- eventGroupId: eArr[1] || '',
212
- alias: target.alias,
213
- analysisIndex: dimensionData.value || '',
214
- filters: {
215
- relation: attr.relation,
216
- conditions: _toConsumableArray(attrArray)
217
- }
218
- });
157
+
158
+ onChange(dimension, target, filterData);
219
159
  };
220
160
 
221
- var _onDimensionClick = function _onDimensionClick(data) {
222
- setDimension(function () {
223
- return _objectSpread({}, data);
224
- });
161
+ var onChangeDimension = function onChangeDimension(data) {
162
+ onChange(data, targetData, filters);
163
+ };
164
+
165
+ var onChangeFilters = function onChangeFilters(data) {
166
+ setFilters(data);
167
+ onChange(dimension, targetData, data);
168
+ };
169
+
170
+ var onChange = function onChange(analysisDimension, target, filterDatas) {
171
+ if (props.onChange) {
172
+ var _target$value$event2, _target$value$event3, _target$value$event4, _target$value$event5, _target$value$group;
173
+
174
+ if (!target || !target.value || !((_target$value$event2 = target.value.event) === null || _target$value$event2 === void 0 ? void 0 : _target$value$event2.id)) return;
175
+ var data = {
176
+ type: 'event',
177
+ alias: (target === null || target === void 0 ? void 0 : target.alias) || ((_target$value$event3 = target.value.event) === null || _target$value$event3 === void 0 ? void 0 : _target$value$event3.name) || '',
178
+ eventId: (_target$value$event4 = target.value.event) === null || _target$value$event4 === void 0 ? void 0 : _target$value$event4.id,
179
+ eventName: (_target$value$event5 = target.value.event) === null || _target$value$event5 === void 0 ? void 0 : _target$value$event5.name,
180
+ eventGroupId: (_target$value$group = target.value.group) === null || _target$value$group === void 0 ? void 0 : _target$value$group.id,
181
+ analysisDimension: analysisDimension,
182
+ filters: filterDatas
183
+ };
184
+ props.onChange(data);
185
+ }
186
+ };
225
187
 
226
- _onChange(targetData, attrsData, data);
188
+ var onAdd = function onAdd() {
189
+ setIsAdd(true);
190
+ setTimeout(function () {
191
+ conditionRef.current.add();
192
+ }, 0);
193
+ };
194
+
195
+ var onDelete = function onDelete() {
196
+ if (props.onDelete) props.onDelete();
227
197
  };
228
198
 
229
199
  return /*#__PURE__*/React.createElement("div", {
230
- className: className
200
+ className: classPrefix
201
+ }, /*#__PURE__*/React.createElement(Skeleton, {
202
+ loading: ready,
203
+ active: true,
204
+ paragraph: {
205
+ rows: 1
206
+ }
231
207
  }, /*#__PURE__*/React.createElement("div", {
232
- className: "biz-target-condition-container"
208
+ className: "".concat(classPrefix, "-content")
233
209
  }, /*#__PURE__*/React.createElement(BizTargetSelector, {
234
- defaultValue: targetData,
235
- addDisable: addDisable,
236
- delDisable: noDelete,
237
- showOverview: showAll,
238
- onChange: function onChange(data) {
239
- setTargetData(function () {
240
- return _objectSpread({}, data);
241
- });
242
-
243
- if (data.option != targetData.option) {
244
- // 选择了事件概览,不能筛选
245
- var eid = String(data.option).split(',')[0];
246
- setAddDisable(function () {
247
- return parseFloat(eid) < 0;
248
- }); // 切换了事件,属性清空
249
-
250
- setAttrsData(function () {
251
- return {};
252
- });
253
-
254
- _onChange(data, {});
255
- } else {
256
- // 切换别名
257
- _onChange(data, _objectSpread({}, attrsData));
258
- }
259
- },
260
- onAdd: function onAdd() {
261
- if (attrsData.conditions && attrsData.conditions.length >= max) {
262
- return;
263
- } else {
264
- setAttrsData(function (data) {
265
- var item = {
266
- key: Math.random().toString()
267
- };
268
-
269
- if (!data.conditions) {
270
- data.conditions = [item];
271
- } else {
272
- data.conditions.push(item);
273
- }
274
-
275
- return _objectSpread({}, data);
276
- });
277
- }
278
- },
279
- onDelete: onDelete
280
- }, /*#__PURE__*/React.createElement(BizEventSelector, {
281
- fieldNames: fieldNames,
282
- options: (options === null || options === void 0 ? void 0 : options.eventOption) || []
283
- })), /*#__PURE__*/React.createElement(Dropdown, {
284
- overlayClassName: "biz-dropdown-selector",
285
- placement: "bottom",
286
- overlay: /*#__PURE__*/React.createElement(Menu, null, dimensionOperate.map(function (item) {
287
- if (item.children) {
288
- return /*#__PURE__*/React.createElement(SubMenu, {
289
- key: item.name,
290
- title: item.name
291
- }, item.children.map(function (sub) {
292
- return /*#__PURE__*/React.createElement(Menu.Item, {
293
- className: dimension.value === sub.value ? 'box-active' : '',
294
- key: sub.value,
295
- onClick: function onClick() {
296
- _onDimensionClick(sub);
297
- }
298
- }, sub.name);
299
- }));
300
- }
301
-
302
- return /*#__PURE__*/React.createElement(Menu.Item, {
303
- className: dimension.value === item.value ? 'box-active' : '',
304
- key: item.value,
305
- onClick: function onClick() {
306
- _onDimensionClick(item);
307
- }
308
- }, item.name);
309
- }))
310
- }, /*#__PURE__*/React.createElement("div", {
311
- className: "biz-select-cotainer biz-select-dimision"
312
- }, /*#__PURE__*/React.createElement("div", {
313
- className: "biz-select-content"
314
- }, dimension.name || '', /*#__PURE__*/React.createElement(IconFont, {
315
- className: "biz-select-zhankai",
316
- type: 'icon-xiangxia'
317
- }))))), /*#__PURE__*/React.createElement(BizConditionGroup, {
318
- defaultValue: attrsData,
319
- options: options === null || options === void 0 ? void 0 : options.attrOption,
320
- eventId: targetData.option,
321
- onChange: function onChange(data) {
322
- setAttrsData(function () {
323
- return _objectSpread({}, data);
324
- });
325
-
326
- _onChange(targetData, data);
327
- }
328
- }));
210
+ value: targetData,
211
+ enableAdd: enableAdd,
212
+ enableDelete: enableDelete,
213
+ onAdd: onAdd,
214
+ onDelete: onDelete,
215
+ onChange: onChangeTarget
216
+ }, props.children), /*#__PURE__*/React.createElement(BizTargetDimension, {
217
+ eventId: (targetData === null || targetData === void 0 ? void 0 : (_targetData$value2 = targetData.value) === null || _targetData$value2 === void 0 ? void 0 : (_targetData$value2$ev = _targetData$value2.event) === null || _targetData$value2$ev === void 0 ? void 0 : _targetData$value2$ev.id) ? targetData === null || targetData === void 0 ? void 0 : (_targetData$value3 = targetData.value) === null || _targetData$value3 === void 0 ? void 0 : (_targetData$value3$ev = _targetData$value3.event) === null || _targetData$value3$ev === void 0 ? void 0 : _targetData$value3$ev.id : undefined,
218
+ value: dimension,
219
+ onChange: onChangeDimension
220
+ })), (filters || isAdd) && /*#__PURE__*/React.createElement(BizConditionGroup, {
221
+ ref: conditionRef,
222
+ value: filters,
223
+ enableEventProp: true,
224
+ enableDelete: true,
225
+ eventIdList: (targetData === null || targetData === void 0 ? void 0 : (_targetData$value4 = targetData.value) === null || _targetData$value4 === void 0 ? void 0 : (_targetData$value4$ev = _targetData$value4.event) === null || _targetData$value4$ev === void 0 ? void 0 : _targetData$value4$ev.id) ? [targetData === null || targetData === void 0 ? void 0 : (_targetData$value5 = targetData.value) === null || _targetData$value5 === void 0 ? void 0 : (_targetData$value5$ev = _targetData$value5.event) === null || _targetData$value5$ev === void 0 ? void 0 : _targetData$value5$ev.id] : undefined,
226
+ onChange: onChangeFilters,
227
+ onConditionsCount: setCount
228
+ })));
329
229
  };
330
230
 
231
+ BizTargetCondition.defaultProps = {
232
+ max: 5
233
+ };
331
234
  export default BizTargetCondition;
@@ -0,0 +1,25 @@
1
+ @import '../../assets/styles/inner.less';
2
+
3
+ .biz-target {
4
+ &-content {
5
+ display: flex;
6
+ }
7
+
8
+ .biz-target-select {
9
+ flex: 1;
10
+ }
11
+
12
+ .biz-condition {
13
+ margin-top: 8px;
14
+ }
15
+
16
+ &-dimension {
17
+ width: 114px;
18
+ margin-left: 8px;
19
+ .__select-handle();
20
+ }
21
+ &-dropmenu,
22
+ &-submenu {
23
+ width: 120px;
24
+ }
25
+ }
@@ -0,0 +1,32 @@
1
+ import { ReactNode } from 'react';
2
+ import { AttrConditionTypes } from '../attrConditions/types';
3
+ export declare namespace TargetConditionTypes {
4
+ interface DimensionOptionItem {
5
+ label: string;
6
+ value: string;
7
+ }
8
+ interface DimensionOption extends DimensionOptionItem {
9
+ children?: DimensionOptionItem[];
10
+ }
11
+ interface DimensionValue {
12
+ analysisIndex: string;
13
+ analysisAttr?: string;
14
+ }
15
+ interface Value {
16
+ type: string;
17
+ alias: string;
18
+ filters?: AttrConditionTypes.GroupValue;
19
+ analysisDimension: DimensionValue;
20
+ eventId: number;
21
+ eventName?: string;
22
+ eventGroupId?: number;
23
+ }
24
+ interface Props {
25
+ defaultValue?: Value;
26
+ value?: Value;
27
+ max?: number;
28
+ children: ReactNode;
29
+ onChange?: (value: Value) => void;
30
+ onDelete?: (value?: Value) => void;
31
+ }
32
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,3 @@
1
+ import '@zgfe/business-lib/es/assets/styles/resetAntd.less';
1
2
  declare const _default: () => JSX.Element;
2
3
  export default _default;