@zgfe/business-lib 1.0.27-adanalysis.0 → 1.0.27-adanalysis.2

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 (77) hide show
  1. package/es/addToPanel/index.js +33 -16
  2. package/es/assets/iconfont/demo_index.html +647 -3
  3. package/es/assets/iconfont/iconfont.css +115 -3
  4. package/es/assets/iconfont/iconfont.js +37 -33
  5. package/es/assets/iconfont/iconfont.json +196 -0
  6. package/es/assets/iconfont/iconfont.ttf +0 -0
  7. package/es/assets/iconfont/iconfont.woff +0 -0
  8. package/es/assets/iconfont/iconfont.woff2 +0 -0
  9. package/es/assets/styles/resetAntd.less +7 -2
  10. package/es/attrConditions/components/stringList.js +1 -1
  11. package/es/attrConditions/components/valuesList.js +7 -5
  12. package/es/attrConditions/group.js +4 -4
  13. package/es/attrConditions/types.d.ts +1 -0
  14. package/es/attributeSelector/styles/index.less +31 -2
  15. package/es/attributeSelector/util.js +9 -1
  16. package/es/chart/demo/bar.js +3 -4
  17. package/es/chart/demo/data/data.d.ts +7 -0
  18. package/es/chart/demo/data/data.js +10 -0
  19. package/es/chart/demo/data/data3.d.ts +0 -2
  20. package/es/chart/demo/data/data3.js +15 -574
  21. package/es/chart/demo/map.js +1 -2
  22. package/es/chart/index.js +2 -2
  23. package/es/chart/util/chartOptionConfig.d.ts +1 -54
  24. package/es/chart/util/chartOptionConfig.js +13 -7
  25. package/es/chart/util/formatData.js +2 -1
  26. package/es/chart/util/formatOption.js +7 -23
  27. package/es/chart/util/mapUtil.d.ts +2 -2
  28. package/es/chart/util/mapUtil.js +59 -75
  29. package/es/cycleTime/demo/disable.d.ts +2 -0
  30. package/es/cycleTime/demo/disable.js +17 -0
  31. package/es/cycleTime/index.d.ts +1 -0
  32. package/es/cycleTime/index.js +12 -5
  33. package/es/cycleTime/month.d.ts +1 -0
  34. package/es/cycleTime/month.js +6 -3
  35. package/es/cycleTime/styles/month.less +12 -0
  36. package/es/datePicker/utils.js +3 -0
  37. package/es/eventSelector/index.js +2 -2
  38. package/es/eventSelector/listPanel.js +20 -5
  39. package/es/eventSelector/types.d.ts +1 -1
  40. package/es/layout/analysisLayout/demo/index.js +5 -1
  41. package/es/layout/analysisLayout/index.js +5 -5
  42. package/es/layout/analysisLayout/index.less +0 -6
  43. package/es/select/demo/multiple.js +3 -2
  44. package/es/select/handle.js +50 -12
  45. package/es/select/index.js +44 -9
  46. package/es/select/overlay.d.ts +1 -1
  47. package/es/select/overlay.js +4 -5
  48. package/es/select/styles/handle.less +50 -28
  49. package/es/select/types.d.ts +6 -0
  50. package/es/targetConditionGroup/index.js +3 -1
  51. package/es/targetConditionGroup/types.d.ts +1 -0
  52. package/es/targetSelector/index.js +13 -0
  53. package/es/targetSelector/styles/index.less +1 -0
  54. package/es/userCondition/conditions/styles/eventCondition.less +1 -1
  55. package/es/userCondition/conditions/styles/tagsCondition.less +1 -1
  56. package/es/userCondition/conditions/tagsCondition.js +26 -13
  57. package/es/userCondition/conditions/textDesc.js +29 -8
  58. package/es/userCondition/demo/index.js +5 -228
  59. package/es/userCondition/demo/mockData.d.ts +85 -0
  60. package/es/userCondition/demo/mockData.js +546 -0
  61. package/es/userCondition/types.d.ts +21 -3
  62. package/es/userCondition/util.d.ts +23 -1
  63. package/es/userCondition/util.js +39 -5
  64. package/es/userTagsSelector/cascaderOverlay.js +132 -42
  65. package/es/userTagsSelector/demo/index.js +12 -5
  66. package/es/userTagsSelector/groups/groupOption.js +3 -2
  67. package/es/userTagsSelector/groups/index.js +18 -11
  68. package/es/userTagsSelector/groups/styles/option.less +6 -1
  69. package/es/userTagsSelector/index.js +17 -3
  70. package/es/userTagsSelector/multipleCheckPanel/checkOption.js +2 -1
  71. package/es/userTagsSelector/multipleCheckPanel/index.js +7 -16
  72. package/es/userTagsSelector/styles/cascaderOverlay.less +9 -4
  73. package/es/userTagsSelector/types.d.ts +1 -10
  74. package/es/userTagsSelector/util.d.ts +1 -1
  75. package/es/userTagsSelector/util.js +6 -2
  76. package/es/utils/ajax.js +5 -1
  77. package/package.json +3 -3
@@ -11,15 +11,19 @@ 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 { Input, Tag, Tooltip } from 'antd';
14
- import React, { useImperativeHandle, useMemo, useRef, useState } from 'react';
14
+ import { FormItemInputContext } from 'antd/es/form/context';
15
+ import React, { useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
15
16
  import IconFont from '../icon/iconFont';
16
17
  import './styles/handle.less';
17
18
  var SelectHandle = /*#__PURE__*/React.forwardRef(function (props, ref) {
19
+ var _props$value;
20
+
18
21
  var placeholder = props.placeholder,
19
22
  labelField = props.labelField,
20
23
  keyField = props.keyField,
21
- _props$border = props.border,
22
- border = _props$border === void 0 ? true : _props$border;
24
+ border = props.border,
25
+ showSelectIcon = props.showSelectIcon,
26
+ disable = props.disable;
23
27
  var classPrefix = 'biz-select-handle';
24
28
 
25
29
  var _useState = useState(false),
@@ -36,22 +40,38 @@ var SelectHandle = /*#__PURE__*/React.forwardRef(function (props, ref) {
36
40
  searchValue = _useState4[0],
37
41
  setSearchValue = _useState4[1];
38
42
 
43
+ var _useContext = useContext(FormItemInputContext),
44
+ contextStatus = _useContext.status;
45
+
46
+ var mergedStatus = props.status || contextStatus;
39
47
  useImperativeHandle(ref, function () {
40
48
  return {
41
- create: function create(flag) {
49
+ create: function create(flag, overlayClicked) {
42
50
  if (props.disable) return;
43
51
  setFocus(flag);
44
52
  if (!props.multiple) return;
45
53
 
46
54
  if (flag) {
47
55
  inputRef.current.focus();
56
+ } else {
57
+ if (overlayClicked) {
58
+ setSearchValue('');
59
+ } else {
60
+ if (searchValue && props.onCreate) {
61
+ props.onCreate(searchValue);
62
+ setSearchValue('');
63
+ }
64
+ }
48
65
  }
49
-
50
- setSearchValue('');
51
66
  },
52
67
  width: handleRef.current.clientWidth
53
68
  };
54
69
  });
70
+ useEffect(function () {
71
+ if (focus) {
72
+ props.onVisible && props.onVisible();
73
+ }
74
+ }, [focus]);
55
75
  var searchInputWidth = useMemo(function () {
56
76
  return textRef.current && searchValue ? textRef.current.offsetWidth : 3;
57
77
  }, [searchValue]);
@@ -66,6 +86,19 @@ var SelectHandle = /*#__PURE__*/React.forwardRef(function (props, ref) {
66
86
  if (props.onSearch) props.onSearch(value);
67
87
  };
68
88
 
89
+ var onKeyDown = function onKeyDown(e) {
90
+ if (e.keyCode === 13 && props.multiple) {
91
+ var value = e.target.value.trim();
92
+
93
+ if (value && props.onCreate) {
94
+ props.onCreate(value);
95
+ }
96
+
97
+ setFocus(false);
98
+ setSearchValue('');
99
+ }
100
+ };
101
+
69
102
  if (props.multiple) {
70
103
  return /*#__PURE__*/React.createElement("div", {
71
104
  ref: handleRef,
@@ -78,9 +111,9 @@ var SelectHandle = /*#__PURE__*/React.forwardRef(function (props, ref) {
78
111
  color: "#fff"
79
112
  }, /*#__PURE__*/React.createElement(Tag, {
80
113
  closable: true,
81
- id: "".concat(classPrefix, "-tag"),
114
+ className: "".concat(classPrefix, "-tag ").concat(disable ? 'disable' : ''),
82
115
  onClose: function onClose() {
83
- onDelete(item);
116
+ !disable && onDelete(item);
84
117
  }
85
118
  }, /*#__PURE__*/React.createElement("div", {
86
119
  className: "".concat(classPrefix, "-tag-label")
@@ -96,7 +129,8 @@ var SelectHandle = /*#__PURE__*/React.forwardRef(function (props, ref) {
96
129
  width: "".concat(searchInputWidth, "px")
97
130
  },
98
131
  value: searchValue,
99
- onChange: onSearch
132
+ onChange: onSearch,
133
+ onKeyDown: onKeyDown
100
134
  }), /*#__PURE__*/React.createElement("span", {
101
135
  className: "".concat(classPrefix, "-temp"),
102
136
  ref: textRef
@@ -105,11 +139,13 @@ var SelectHandle = /*#__PURE__*/React.forwardRef(function (props, ref) {
105
139
 
106
140
  return /*#__PURE__*/React.createElement("div", {
107
141
  ref: handleRef,
108
- className: "".concat(classPrefix, "-input ").concat(props.theme ? props.theme : '', "\n ").concat(props.disable ? 'disable' : '', " ").concat(focus ? 'active' : '', " \n ").concat(border ? '' : 'borderless', " ").concat(props.size ? props.size : 'middle'),
142
+ className: "".concat(classPrefix, "-input ").concat(props.theme ? props.theme : '', "\n ").concat(props.disable ? 'disable' : '', " ").concat(focus ? 'active' : '', " \n ").concat(mergedStatus ? "".concat(classPrefix, "-status-").concat(mergedStatus) : '', "\n ").concat(border ? '' : 'borderless', " ").concat(props.size ? props.size : 'middle'),
109
143
  title: props.label || props.value && props.value[labelField]
110
144
  }, /*#__PURE__*/React.createElement("span", {
111
145
  className: "".concat(classPrefix, "-content")
112
- }, props.label || props.value && props.value[labelField] || /*#__PURE__*/React.createElement("span", {
146
+ }, showSelectIcon && ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.icon) && /*#__PURE__*/React.createElement("span", {
147
+ className: "".concat(classPrefix, "-icon")
148
+ }, props.value.icon), props.label || props.value && props.value[labelField] || /*#__PURE__*/React.createElement("span", {
113
149
  className: "".concat(classPrefix, "-holder")
114
150
  }, placeholder || '请选择')), /*#__PURE__*/React.createElement(IconFont, {
115
151
  className: "".concat(classPrefix, "-expand-icon"),
@@ -118,6 +154,8 @@ var SelectHandle = /*#__PURE__*/React.forwardRef(function (props, ref) {
118
154
  });
119
155
  SelectHandle.defaultProps = {
120
156
  labelField: 'label',
121
- keyField: 'id'
157
+ keyField: 'id',
158
+ border: true,
159
+ showSelectIcon: true
122
160
  };
123
161
  export default SelectHandle;
@@ -31,6 +31,8 @@ import _ from 'lodash';
31
31
  export var classPrefix = 'biz-select';
32
32
 
33
33
  var BizSelect = function BizSelect(props) {
34
+ var _boxRef$current3;
35
+
34
36
  var overlayWidth = props.overlayWidth,
35
37
  minDropdownWidth = props.minDropdownWidth,
36
38
  labelField = props.labelField,
@@ -53,6 +55,7 @@ var BizSelect = function BizSelect(props) {
53
55
  setVisible = _useState6[1];
54
56
 
55
57
  var selectRef = useRef(null);
58
+ var overlayRef = useRef(null);
56
59
  var boxRef = useRef(null);
57
60
  var selectId = Math.random().toString();
58
61
 
@@ -62,21 +65,18 @@ var BizSelect = function BizSelect(props) {
62
65
  setWidth = _useState8[1];
63
66
 
64
67
  useEffect(function () {
65
- var _boxRef$current;
66
-
67
- setWidth((boxRef === null || boxRef === void 0 ? void 0 : (_boxRef$current = boxRef.current) === null || _boxRef$current === void 0 ? void 0 : _boxRef$current.width) || 200);
68
-
69
68
  if (props.defaultValue) {
70
69
  setCurrent(getValue(props.defaultValue));
71
70
  }
72
71
 
73
72
  var handleClick = function handleClick(e) {
74
- var _selectRef$current, _boxRef$current2;
73
+ var _selectRef$current, _overlayRef$current, _boxRef$current;
75
74
 
76
75
  var clicked = (_selectRef$current = selectRef.current) === null || _selectRef$current === void 0 ? void 0 : _selectRef$current.contains(e.target);
77
- (_boxRef$current2 = boxRef.current) === null || _boxRef$current2 === void 0 ? void 0 : _boxRef$current2.create(clicked);
76
+ var overlayClicked = (_overlayRef$current = overlayRef.current) === null || _overlayRef$current === void 0 ? void 0 : _overlayRef$current.contains(e.target);
77
+ (_boxRef$current = boxRef.current) === null || _boxRef$current === void 0 ? void 0 : _boxRef$current.create(clicked, overlayClicked);
78
78
 
79
- if (!clicked && !props.enableCreate) {
79
+ if (!clicked && !props.enableCreate || overlayClicked) {
80
80
  setSearchValue('');
81
81
  }
82
82
  };
@@ -86,6 +86,11 @@ var BizSelect = function BizSelect(props) {
86
86
  window.removeEventListener('click', handleClick);
87
87
  };
88
88
  }, []);
89
+ useEffect(function () {
90
+ var _boxRef$current2;
91
+
92
+ setWidth((boxRef === null || boxRef === void 0 ? void 0 : (_boxRef$current2 = boxRef.current) === null || _boxRef$current2 === void 0 ? void 0 : _boxRef$current2.width) || 200);
93
+ }, [boxRef === null || boxRef === void 0 ? void 0 : (_boxRef$current3 = boxRef.current) === null || _boxRef$current3 === void 0 ? void 0 : _boxRef$current3.width]);
89
94
  useEffect(function () {
90
95
  if (!props.value) return;
91
96
  setCurrent(getValue(props.value));
@@ -149,13 +154,39 @@ var BizSelect = function BizSelect(props) {
149
154
  props.onVisibleChange && props.onVisibleChange(flag);
150
155
  };
151
156
 
157
+ var onCreate = function onCreate(val) {
158
+ var _data;
159
+
160
+ if (current) {
161
+ var flag = true;
162
+ current.forEach(function (item) {
163
+ if (item[labelField] === val) {
164
+ flag = false;
165
+ }
166
+ });
167
+ if (!flag) return;
168
+ }
169
+
170
+ var data = (_data = {}, _defineProperty(_data, keyField, val), _defineProperty(_data, labelField, val), _data);
171
+ var originData = current || [];
172
+ originData.push(data);
173
+ setCurrent(originData);
174
+ setSearchValue('');
175
+ if (props.onChange) props.onChange(originData);
176
+ };
177
+
178
+ var onVisible = function onVisible() {
179
+ setVisible(true);
180
+ };
181
+
152
182
  return /*#__PURE__*/React.createElement(Dropdown, {
153
183
  overlay: /*#__PURE__*/React.createElement(SelectOverlay, _objectSpread(_objectSpread({}, res), {}, {
154
184
  value: current,
155
185
  labelField: labelField,
156
186
  keyField: keyField,
157
187
  searchValue: searchValue,
158
- onChange: onChange
188
+ onChange: onChange,
189
+ ref: overlayRef
159
190
  })),
160
191
  disabled: props.disable,
161
192
  destroyPopupOnHide: props.destroyPopupOnHide,
@@ -184,11 +215,15 @@ var BizSelect = function BizSelect(props) {
184
215
  theme: props.theme,
185
216
  size: props.size || 'middle',
186
217
  border: props.border,
218
+ showSelectIcon: props.showSelectIcon,
219
+ status: props.status,
187
220
  onDelete: onDelete,
188
221
  onSearch: function onSearch(v) {
189
222
  setSearchValue(v);
190
223
  if (props.onSearch) props.onSearch(v);
191
- }
224
+ },
225
+ onCreate: onCreate,
226
+ onVisible: onVisible
192
227
  })));
193
228
  };
194
229
 
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { BizSelectTypes } from './types';
3
- declare const SelectOverlay: React.FC<BizSelectTypes.Props>;
3
+ declare const SelectOverlay: React.ForwardRefExoticComponent<BizSelectTypes.Props & React.RefAttributes<any>>;
4
4
  export default SelectOverlay;
@@ -18,8 +18,7 @@ import BizSearchInput from '../searchInput';
18
18
  import { classPrefix } from './index';
19
19
  import SelectOption from './option';
20
20
  import _ from 'lodash';
21
-
22
- var SelectOverlay = function SelectOverlay(props) {
21
+ var SelectOverlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
23
22
  var labelField = props.labelField,
24
23
  keyField = props.keyField,
25
24
  options = props.options,
@@ -199,13 +198,13 @@ var SelectOverlay = function SelectOverlay(props) {
199
198
  }
200
199
 
201
200
  return /*#__PURE__*/React.createElement("div", {
202
- className: "".concat(classPrefix, "-overlay ").concat(overlayClassName)
201
+ className: "".concat(classPrefix, "-overlay ").concat(overlayClassName),
202
+ ref: ref
203
203
  }, props.enableSearch && !props.multiple && /*#__PURE__*/React.createElement(BizSearchInput, {
204
204
  className: "".concat(classPrefix, "-search"),
205
205
  onChange: onSearch
206
206
  }), dropdownExtra, /*#__PURE__*/React.createElement("div", {
207
207
  className: "".concat(classPrefix, "-list-panel")
208
208
  }, render()));
209
- };
210
-
209
+ });
211
210
  export default SelectOverlay;
@@ -56,6 +56,42 @@
56
56
  height: auto;
57
57
  min-height: @height-base;
58
58
  }
59
+ .biz-select-handle-tag {
60
+ display: flex;
61
+ align-items: center;
62
+ margin: 2px 4px 2px 0;
63
+ padding: 0 4px;
64
+ padding-top: 1px;
65
+ padding-bottom: 1px;
66
+ background: none;
67
+ border-color: #cacdd4;
68
+ border-radius: @border-radius-small;
69
+ &-label {
70
+ min-width: 0;
71
+ max-width: 100px;
72
+ overflow: hidden;
73
+ text-overflow: ellipsis;
74
+ }
75
+ &:not(.disable) {
76
+ &:hover {
77
+ .__default-hover();
78
+ .anticon {
79
+ color: @primary-color;
80
+ }
81
+ }
82
+ }
83
+ &.disable {
84
+ &:hover {
85
+ cursor: not-allowed;
86
+ .anticon-close {
87
+ cursor: not-allowed;
88
+ }
89
+ }
90
+ .biz-select-handle-tag-label {
91
+ color: @disabled-color !important;
92
+ }
93
+ }
94
+ }
59
95
  }
60
96
 
61
97
  &-search.ant-input {
@@ -67,7 +103,7 @@
67
103
 
68
104
  &:focus,
69
105
  &.active {
70
- box-shadow: none;
106
+ box-shadow: none !important;
71
107
  }
72
108
  }
73
109
  &-temp {
@@ -81,40 +117,15 @@
81
117
  color: @input-placeholder-color;
82
118
  }
83
119
  &-content {
120
+ display: flex;
84
121
  flex: 1;
122
+ align-items: center;
85
123
  .__default-overflow();
86
124
  }
87
125
  &-expand-icon {
88
126
  width: 14px;
89
127
  margin-left: 5px;
90
128
  }
91
- &-input {
92
- display: flex;
93
- #biz-select-handle-tag {
94
- display: flex;
95
- align-items: center;
96
- margin: 2px 4px 2px 0;
97
- padding: 0 4px;
98
- padding-top: 1px;
99
- padding-bottom: 1px;
100
- background: none;
101
- border-color: #cacdd4;
102
- border-radius: @border-radius-small;
103
- &-label {
104
- min-width: 0;
105
- max-width: 100px;
106
- overflow: hidden;
107
- text-overflow: ellipsis;
108
- }
109
- &:hover {
110
- .__default-hover();
111
-
112
- .anticon {
113
- color: @primary-color;
114
- }
115
- }
116
- }
117
- }
118
129
 
119
130
  &-tooltip {
120
131
  .ant-tooltip-inner {
@@ -122,4 +133,15 @@
122
133
  background-color: @white;
123
134
  }
124
135
  }
136
+
137
+ &-icon {
138
+ margin-right: @margin-xss;
139
+ }
140
+
141
+ &-status-error {
142
+ border-color: @error-color;
143
+ &.biz-select-handle-input:hover {
144
+ border-color: @error-color;
145
+ }
146
+ }
125
147
  }
@@ -34,7 +34,9 @@ export declare namespace BizSelectTypes {
34
34
  disableItemList?: Option[];
35
35
  searchValue?: string;
36
36
  notFound?: string | ReactNode;
37
+ showSelectIcon?: boolean;
37
38
  loading?: boolean;
39
+ status?: string;
38
40
  onChange?: (val: Option) => void;
39
41
  onVisibleChange?: (visible: boolean) => void;
40
42
  destroyPopupOnHide?: boolean;
@@ -69,6 +71,10 @@ export interface HandlerTypes {
69
71
  theme?: string;
70
72
  size?: SizeType;
71
73
  border?: boolean;
74
+ showSelectIcon?: boolean;
75
+ status?: string;
72
76
  onDelete?: (data: BizSelectTypes.Option) => void;
73
77
  onSearch?: (val: string) => void;
78
+ onCreate?: (val: string) => void;
79
+ onVisible?: () => void;
74
80
  }
@@ -211,7 +211,8 @@ var BizTargetCondition = function BizTargetCondition(props) {
211
211
  eventName: ((_target$value$event5 = target.value.event) === null || _target$value$event5 === void 0 ? void 0 : _target$value$event5.alias) || ((_target$value$event6 = target.value.event) === null || _target$value$event6 === void 0 ? void 0 : _target$value$event6.name),
212
212
  eventGroupId: (_target$value$group = target.value.group) === null || _target$value$group === void 0 ? void 0 : _target$value$group.id,
213
213
  analysisDimension: analysisDimension,
214
- filters: filterDatas
214
+ filters: filterDatas,
215
+ marked: target.value.event.marked
215
216
  };
216
217
  props.onChange(data);
217
218
  }
@@ -252,6 +253,7 @@ var BizTargetCondition = function BizTargetCondition(props) {
252
253
  })), (filters || isAdd) && /*#__PURE__*/React.createElement(BizConditionGroup, {
253
254
  ref: conditionRef,
254
255
  value: filters,
256
+ onlyAnd: props.onlyAnd,
255
257
  enableEventProp: true,
256
258
  enableDelete: true,
257
259
  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,
@@ -26,6 +26,7 @@ export declare namespace TargetConditionTypes {
26
26
  value?: Value;
27
27
  max?: number;
28
28
  children: ReactNode;
29
+ onlyAnd?: boolean;
29
30
  onChange?: (value: Value) => void;
30
31
  onDelete?: (value?: Value) => void;
31
32
  }
@@ -39,6 +39,11 @@ var BizTargetSelector = function BizTargetSelector(props) {
39
39
  showEditModal = _useState6[0],
40
40
  setShowEditModal = _useState6[1];
41
41
 
42
+ var _useState7 = useState(false),
43
+ _useState8 = _slicedToArray(_useState7, 2),
44
+ visible = _useState8[0],
45
+ setVisible = _useState8[1];
46
+
42
47
  useEffect(function () {
43
48
  if (!props.defaultValue) return;
44
49
  setAlias(props.defaultValue.alias || '');
@@ -51,6 +56,8 @@ var BizTargetSelector = function BizTargetSelector(props) {
51
56
  }, [props.value]);
52
57
 
53
58
  var onClickIcon = function onClickIcon(name) {
59
+ setVisible(false);
60
+
54
61
  if (name === 'edit') {
55
62
  setShowEditModal(true);
56
63
  } else if (name === 'add') {
@@ -91,6 +98,10 @@ var BizTargetSelector = function BizTargetSelector(props) {
91
98
  });
92
99
  };
93
100
 
101
+ var onVisibleChange = function onVisibleChange(flag) {
102
+ setVisible(flag);
103
+ };
104
+
94
105
  return /*#__PURE__*/React.createElement("div", {
95
106
  className: classPrefix
96
107
  }, /*#__PURE__*/React.cloneElement(props.children, {
@@ -112,6 +123,8 @@ var BizTargetSelector = function BizTargetSelector(props) {
112
123
  enabled: enableDelete,
113
124
  onClick: onClickIcon
114
125
  }), targetData && /*#__PURE__*/React.createElement(Dropdown, {
126
+ visible: visible,
127
+ onVisibleChange: onVisibleChange,
115
128
  overlay: /*#__PURE__*/React.createElement(BizTargetOptionMenu, {
116
129
  onClick: onClickIcon,
117
130
  enableAdd: enableAdd,
@@ -61,6 +61,7 @@
61
61
  }
62
62
  &-divider {
63
63
  height: 0;
64
+ margin: 8px;
64
65
  border-bottom: 1px solid @border-color-base;
65
66
  }
66
67
 
@@ -42,7 +42,7 @@
42
42
  display: flex;
43
43
  align-items: center;
44
44
  min-width: 28px;
45
- height: 42px;
45
+ height: 34px;
46
46
  margin-right: @margin-xs;
47
47
  }
48
48
  &-runtimes {
@@ -8,7 +8,7 @@
8
8
  margin-left: @margin-xs;
9
9
  }
10
10
  &-label {
11
- line-height: 40px;
11
+ line-height: 32px;
12
12
  }
13
13
  &-value {
14
14
  flex: 1;
@@ -16,13 +16,14 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
16
16
 
17
17
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
18
 
19
- import React, { useContext, useState } from 'react';
19
+ import React, { useContext, useMemo, useState } from 'react';
20
20
  import { BizUserConditionContext, classPrefix } from '..';
21
21
  import BizSelect from '../../select';
22
22
  import { operatorMap } from './constants';
23
23
  import BizUserTagsSelect from '../../userTagsSelector';
24
24
  import './styles/tagsCondition.less';
25
- import { findTagFactory } from '../util';
25
+ import { buildSelectLayer, buildTagsGroup } from '../util';
26
+ import _ from 'lodash';
26
27
  var options = [{
27
28
  value: 'equal',
28
29
  text: '是'
@@ -45,6 +46,10 @@ var TagsCondition = function TagsCondition(props) {
45
46
  _useState2 = _slicedToArray(_useState, 1),
46
47
  defaultValues = _useState2[0];
47
48
 
49
+ var tagGroupList = useMemo(function () {
50
+ return buildTagsGroup(userTagsData || []);
51
+ }, [userTagsData]);
52
+
48
53
  function onOperatorChange(operator) {
49
54
  onChange(dataId, _objectSpread(_objectSpread({}, labels), {}, {
50
55
  operator: operator.value
@@ -53,7 +58,7 @@ var TagsCondition = function TagsCondition(props) {
53
58
 
54
59
  function onTagsChange(data) {
55
60
  var values = data.map(function (item) {
56
- return item[1].labelId;
61
+ return "".concat(item[1].id, ":").concat(item[2].layerLabelId);
57
62
  });
58
63
  onChange(dataId, _objectSpread(_objectSpread({}, labels), {}, {
59
64
  values: values
@@ -62,12 +67,20 @@ var TagsCondition = function TagsCondition(props) {
62
67
 
63
68
  function buildDefaultValues() {
64
69
  var values = [];
65
- var findTag = findTagFactory(userTagsData);
66
- labels.values.forEach(function (id) {
67
- var tag = findTag(id);
70
+ var findTag = buildSelectLayer(userTagsData);
71
+ labels.values.forEach(function (value) {
72
+ if (_.isNumber(value)) {
73
+ return;
74
+ }
75
+
76
+ var _value$split = value.split(':'),
77
+ _value$split2 = _slicedToArray(_value$split, 2),
78
+ layerId = _value$split2[1];
79
+
80
+ var selectValue = findTag(Number(layerId));
68
81
 
69
- if (tag) {
70
- values.push([tag.labelGroup, tag]);
82
+ if (selectValue) {
83
+ values.push(selectValue);
71
84
  }
72
85
  });
73
86
  return values;
@@ -92,11 +105,11 @@ var TagsCondition = function TagsCondition(props) {
92
105
  className: "".concat(classPrefix, "-tags-condition-value")
93
106
  }, /*#__PURE__*/React.createElement(BizUserTagsSelect, {
94
107
  defaultValue: defaultValues,
95
- data: userTagsData,
96
- childFields: ['children'],
97
- keyFields: ['labelGroup', 'labelId'],
98
- labelFields: ['labelGroup', 'labelName'],
99
- valueFields: ['labelGroup', 'labelId'],
108
+ data: tagGroupList,
109
+ childFields: ['children', 'layers'],
110
+ keyFields: ['labelGroup', 'id', 'layerLabelId'],
111
+ labelFields: ['labelGroup', 'labelName', 'layerLabelName'],
112
+ valueFields: ['labelGroup', 'id', 'layerLabelId'],
100
113
  onChange: onTagsChange,
101
114
  destroyPopupOnHide: true
102
115
  })), /*#__PURE__*/React.createElement("div", {
@@ -4,10 +4,23 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
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
6
 
7
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+
9
+ 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."); }
10
+
11
+ 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); }
12
+
13
+ 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; }
14
+
15
+ 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; }
16
+
17
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
+
19
+ import _ from 'lodash';
7
20
  import React, { useContext, useMemo } from 'react';
8
21
  import { BizUserConditionContext, classPrefix } from '..';
9
22
  import BizGlobalDataContext from '../../context';
10
- import { findEvent, findPropAndEnv, findTagFactory } from '../util';
23
+ import { findEvent, findPropAndEnv, buildSelectLayer } from '../util';
11
24
  import { durationHandler, operatorMap } from './constants';
12
25
  import './styles/textDesc.less';
13
26
 
@@ -57,12 +70,12 @@ var Text = function Text(props) {
57
70
  function renderPeriod(label, period, isEvent) {
58
71
  var _label$after;
59
72
 
60
- var valuesDom = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, period.values[0]), /*#__PURE__*/React.createElement("span", null, (_label$after = label.after) !== null && _label$after !== void 0 ? _label$after : '天'));
61
-
62
73
  if (period.operator === 'unlimited_time') {
63
74
  return /*#__PURE__*/React.createElement("span", null, "\u5728\u4EFB\u610F\u65F6\u95F4\u5185");
64
75
  }
65
76
 
77
+ var valuesDom = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, period.values[0]), /*#__PURE__*/React.createElement("span", null, (_label$after = label.after) !== null && _label$after !== void 0 ? _label$after : '天'));
78
+
66
79
  if (period.operator === 'absolute') {
67
80
  valuesDom = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
68
81
  className: "".concat(classPrefix, "-text-desc-value")
@@ -173,15 +186,23 @@ var Text = function Text(props) {
173
186
  className: "label"
174
187
  }, /*#__PURE__*/React.createElement("b", null, "\u7528\u6237\u6807\u7B7E")), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("b", null, operatorMap[labels.operator])), /*#__PURE__*/React.createElement("span", {
175
188
  className: "".concat(classPrefix, "-text-desc-value")
176
- }, /*#__PURE__*/React.createElement("span", null, "("), labels.values.map(function (id, index) {
177
- var tag = findTag(id);
189
+ }, /*#__PURE__*/React.createElement("span", null, "("), labels.values.map(function (value, index) {
190
+ if (_.isNumber(value)) {
191
+ return null;
192
+ }
193
+
194
+ var _value$split = value.split(':'),
195
+ _value$split2 = _slicedToArray(_value$split, 2),
196
+ layerId = _value$split2[1];
197
+
198
+ var tag = findTag(Number(layerId));
178
199
  return /*#__PURE__*/React.createElement("span", {
179
- key: id
200
+ key: layerId
180
201
  }, index >= 1 ? /*#__PURE__*/React.createElement("span", {
181
202
  style: {
182
203
  margin: '0 4px'
183
204
  }
184
- }, "\u6216") : null, /*#__PURE__*/React.createElement("span", null, tag && tag.labelName));
205
+ }, "\u6216") : null, /*#__PURE__*/React.createElement("span", null, tag && tag[1].labelName + ':' + tag[2].layerLabelName));
185
206
  }), /*#__PURE__*/React.createElement("span", null, ")")));
186
207
  }
187
208
 
@@ -231,7 +252,7 @@ var Text = function Text(props) {
231
252
  }
232
253
 
233
254
  var findTag = useMemo(function () {
234
- return findTagFactory(userTagsData);
255
+ return buildSelectLayer(userTagsData);
235
256
  }, [userTagsData]);
236
257
  return /*#__PURE__*/React.createElement("span", {
237
258
  className: "".concat(classPrefix, "-text-desc")