@zgfe/business-lib 1.0.0-beta.5 → 1.0.0-beta.6
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.
- package/es/attributeSelector/index.d.ts +4 -2
- package/es/attributeSelector/index.js +30 -15
- package/es/chart/demo/bar.js +2 -1
- package/es/chart/index.d.ts +16 -0
- package/es/chart/index.js +14 -2
- package/es/chart/util/chartConfig.d.ts +1 -1
- package/es/chart/util/chartConfig.js +11 -8
- package/es/commonStyle/icon.less +19 -3
- package/es/commonStyle/theme.less +5 -2
- package/es/dialog/index.js +11 -7
- package/es/dialog/style/index.less +3 -1
- package/es/eventSelector/index.d.ts +5 -0
- package/es/eventSelector/index.js +111 -32
- package/es/globalAttributes/index.d.ts +3 -2
- package/es/globalAttributes/index.js +18 -23
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/multipleSelector/index.js +32 -4
- package/es/targetConditionGroup/components/conditionGroup.d.ts +4 -4
- package/es/targetConditionGroup/components/conditionGroup.js +27 -26
- package/es/targetConditionGroup/components/conditionItem.d.ts +4 -4
- package/es/targetConditionGroup/components/conditionItem.js +81 -108
- package/es/targetConditionGroup/demo/group.d.ts +2 -0
- package/es/targetConditionGroup/demo/group.js +42 -0
- package/es/targetConditionGroup/demo/index.js +15 -25
- package/es/targetConditionGroup/group.d.ts +56 -0
- package/es/targetConditionGroup/group.js +204 -0
- package/es/targetConditionGroup/index.d.ts +6 -0
- package/es/targetConditionGroup/index.js +148 -83
- package/es/targetConditionGroup/index.less +12 -0
- package/es/targetConditionGroup/type.d.ts +47 -2
- package/es/targetSelector/demo/form.js +1 -1
- package/es/targetSelector/demo/index.js +1 -1
- package/es/targetSelector/index.d.ts +17 -1
- package/es/targetSelector/index.js +56 -10
- package/package.json +1 -1
|
@@ -45,6 +45,8 @@ var BizEventSelector = function BizEventSelector(props) {
|
|
|
45
45
|
options = _props$options === void 0 ? [] : _props$options,
|
|
46
46
|
defaultValue = props.defaultValue,
|
|
47
47
|
value = props.value,
|
|
48
|
+
_props$showAll = props.showAll,
|
|
49
|
+
showAll = _props$showAll === void 0 ? true : _props$showAll,
|
|
48
50
|
_props$fieldNames = props.fieldNames,
|
|
49
51
|
fieldNames = _props$fieldNames === void 0 ? {
|
|
50
52
|
label: 'name',
|
|
@@ -119,10 +121,15 @@ var BizEventSelector = function BizEventSelector(props) {
|
|
|
119
121
|
eventOptions = _useState18[0],
|
|
120
122
|
setEventOptions = _useState18[1];
|
|
121
123
|
|
|
122
|
-
var _useState19 = useState(
|
|
124
|
+
var _useState19 = useState(true),
|
|
123
125
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
showOverview = _useState20[0],
|
|
127
|
+
setShowOverview = _useState20[1];
|
|
128
|
+
|
|
129
|
+
var _useState21 = useState(aliasName),
|
|
130
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
131
|
+
alias = _useState22[0],
|
|
132
|
+
setAlias = _useState22[1];
|
|
126
133
|
|
|
127
134
|
useEffect(function () {
|
|
128
135
|
setAlias(function () {
|
|
@@ -134,8 +141,9 @@ var BizEventSelector = function BizEventSelector(props) {
|
|
|
134
141
|
var initValue = function initValue() {
|
|
135
142
|
// 所有的option
|
|
136
143
|
var firstGroup = {};
|
|
137
|
-
firstGroup[fieldNames.groupLabel] = '整体概览';
|
|
138
|
-
|
|
144
|
+
firstGroup[fieldNames.groupLabel] = '所有分组'; // firstGroup[fieldNames.groupLabel] = '整体概览';
|
|
145
|
+
|
|
146
|
+
firstGroup[fieldNames.groupValue] = -2;
|
|
139
147
|
firstGroup[fieldNames.children] = [];
|
|
140
148
|
|
|
141
149
|
var _iterator = _createForOfIteratorHelper(options),
|
|
@@ -166,11 +174,24 @@ var BizEventSelector = function BizEventSelector(props) {
|
|
|
166
174
|
_iterator.f();
|
|
167
175
|
}
|
|
168
176
|
|
|
169
|
-
|
|
170
|
-
|
|
177
|
+
var result = JSON.parse(JSON.stringify(eventOptions));
|
|
178
|
+
|
|
179
|
+
if (result.length > 1) {
|
|
180
|
+
result = [firstGroup].concat(_toConsumableArray(result));
|
|
181
|
+
} // // 丢弃事件分组不显示
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
var index = result.findIndex(function (group) {
|
|
185
|
+
return group.groupName === '丢弃事件';
|
|
171
186
|
});
|
|
172
|
-
|
|
173
|
-
|
|
187
|
+
if (index > -1) result.splice(index, 1);
|
|
188
|
+
setEventOptions(function (option) {
|
|
189
|
+
return _toConsumableArray(result); // return [firstGroup, ...option];
|
|
190
|
+
}); // setGroup(firstGroup);
|
|
191
|
+
// setGroup2(firstGroup);
|
|
192
|
+
|
|
193
|
+
setGroup(result[0]);
|
|
194
|
+
setGroup2(result[0]);
|
|
174
195
|
};
|
|
175
196
|
|
|
176
197
|
if (options && options.length > 0) {
|
|
@@ -195,42 +216,87 @@ var BizEventSelector = function BizEventSelector(props) {
|
|
|
195
216
|
if (!inValue || inValue === {}) return;
|
|
196
217
|
var id = _typeof(inValue) === 'object' ? inValue[fieldNames.value] : inValue;
|
|
197
218
|
if (event && event[fieldNames.value] === id) return;
|
|
219
|
+
var eid = id.split(',');
|
|
198
220
|
|
|
199
|
-
|
|
200
|
-
|
|
221
|
+
if (parseFloat(eid[0]) < 0) {
|
|
222
|
+
// 事件概览
|
|
223
|
+
if (eid[1] < 0) {
|
|
224
|
+
setEvent(function () {
|
|
225
|
+
var _ref;
|
|
201
226
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
227
|
+
return _ref = {}, _defineProperty(_ref, fieldNames.value, id), _defineProperty(_ref, fieldNames.label, '事件概览'), _ref;
|
|
228
|
+
});
|
|
229
|
+
setGroup(function () {
|
|
230
|
+
var _ref2;
|
|
206
231
|
|
|
207
|
-
|
|
208
|
-
|
|
232
|
+
return _ref2 = {}, _defineProperty(_ref2, fieldNames.groupLabel, '所有分组'), _defineProperty(_ref2, fieldNames.groupValue, -2), _ref2;
|
|
233
|
+
});
|
|
234
|
+
} else {
|
|
235
|
+
var _iterator3 = _createForOfIteratorHelper(eventOptions),
|
|
236
|
+
_step3;
|
|
209
237
|
|
|
210
238
|
try {
|
|
211
239
|
var _loop = function _loop() {
|
|
212
|
-
var
|
|
240
|
+
var option = _step3.value;
|
|
213
241
|
|
|
214
|
-
if (
|
|
215
|
-
|
|
216
|
-
|
|
242
|
+
if (option[fieldNames.groupValue] === eid[1]) {
|
|
243
|
+
setGroup(function () {
|
|
244
|
+
var _ref3;
|
|
245
|
+
|
|
246
|
+
return _ref3 = {}, _defineProperty(_ref3, fieldNames.groupLabel, option[fieldNames.groupLabel]), _defineProperty(_ref3, fieldNames.groupValue, option[fieldNames.groupValue]), _ref3;
|
|
217
247
|
});
|
|
248
|
+
return "break";
|
|
218
249
|
}
|
|
219
250
|
};
|
|
220
251
|
|
|
221
|
-
for (
|
|
222
|
-
_loop();
|
|
252
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
253
|
+
var _ret = _loop();
|
|
254
|
+
|
|
255
|
+
if (_ret === "break") break;
|
|
223
256
|
}
|
|
224
257
|
} catch (err) {
|
|
225
|
-
|
|
258
|
+
_iterator3.e(err);
|
|
226
259
|
} finally {
|
|
227
|
-
|
|
260
|
+
_iterator3.f();
|
|
228
261
|
}
|
|
229
262
|
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
263
|
+
} else {
|
|
264
|
+
var _iterator4 = _createForOfIteratorHelper(options),
|
|
265
|
+
_step4;
|
|
266
|
+
|
|
267
|
+
try {
|
|
268
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
269
|
+
var option = _step4.value;
|
|
270
|
+
var children = option[fieldNames.children] || [];
|
|
271
|
+
|
|
272
|
+
var _iterator5 = _createForOfIteratorHelper(children),
|
|
273
|
+
_step5;
|
|
274
|
+
|
|
275
|
+
try {
|
|
276
|
+
var _loop2 = function _loop2() {
|
|
277
|
+
var event = _step5.value;
|
|
278
|
+
|
|
279
|
+
if (event[fieldNames.value] == id) {
|
|
280
|
+
setEvent(function () {
|
|
281
|
+
return _objectSpread({}, event);
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
287
|
+
_loop2();
|
|
288
|
+
}
|
|
289
|
+
} catch (err) {
|
|
290
|
+
_iterator5.e(err);
|
|
291
|
+
} finally {
|
|
292
|
+
_iterator5.f();
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
} catch (err) {
|
|
296
|
+
_iterator4.e(err);
|
|
297
|
+
} finally {
|
|
298
|
+
_iterator4.f();
|
|
299
|
+
}
|
|
234
300
|
}
|
|
235
301
|
}, [defaultValue, value]); // 更改group后,事件列表响应
|
|
236
302
|
|
|
@@ -245,9 +311,20 @@ var BizEventSelector = function BizEventSelector(props) {
|
|
|
245
311
|
size = group[fieldNames.children].length;
|
|
246
312
|
}
|
|
247
313
|
|
|
314
|
+
if (showOverview) {
|
|
315
|
+
var _arr$unshift;
|
|
316
|
+
|
|
317
|
+
arr.unshift((_arr$unshift = {}, _defineProperty(_arr$unshift, fieldNames.value, "-2,".concat(group[fieldNames.groupValue])), _defineProperty(_arr$unshift, fieldNames.label, '事件概览'), _arr$unshift));
|
|
318
|
+
}
|
|
319
|
+
|
|
248
320
|
setEventData(arr);
|
|
249
321
|
setEventCount(size);
|
|
250
|
-
}, [group]);
|
|
322
|
+
}, [group]);
|
|
323
|
+
useEffect(function () {
|
|
324
|
+
setShowOverview(function () {
|
|
325
|
+
return showAll;
|
|
326
|
+
});
|
|
327
|
+
}, [showAll]); // 初始化搜索框
|
|
251
328
|
|
|
252
329
|
useEffect(function () {
|
|
253
330
|
setSearchValue(function () {
|
|
@@ -285,7 +362,7 @@ var BizEventSelector = function BizEventSelector(props) {
|
|
|
285
362
|
}
|
|
286
363
|
}, /*#__PURE__*/React.createElement("div", {
|
|
287
364
|
className: "biz-input"
|
|
288
|
-
}, event[fieldNames.label] ? event[fieldNames.label] : /*#__PURE__*/React.createElement("span", {
|
|
365
|
+
}, event[fieldNames.label] ? event[fieldNames.label] === '事件概览' ? "".concat(group[fieldNames.groupLabel], "/").concat(event[fieldNames.label]) : event[fieldNames.label] : /*#__PURE__*/React.createElement("span", {
|
|
289
366
|
className: "biz-placeholder"
|
|
290
367
|
}, placeholder), /*#__PURE__*/React.createElement("span", null, alias && alias !== '' && "(".concat(alias, ")"))), /*#__PURE__*/React.createElement(IconFont, {
|
|
291
368
|
className: "biz-select-zhankai",
|
|
@@ -299,7 +376,7 @@ var BizEventSelector = function BizEventSelector(props) {
|
|
|
299
376
|
|
|
300
377
|
return /*#__PURE__*/React.createElement("div", {
|
|
301
378
|
className: "biz-dropdown-item ".concat(menu[fieldNames.groupValue] === group[fieldNames.groupValue] && 'box-hover'),
|
|
302
|
-
key: menu[fieldNames.groupValue],
|
|
379
|
+
key: menu[fieldNames.groupValue] || 'key' + index,
|
|
303
380
|
onMouseEnter: function onMouseEnter(e) {
|
|
304
381
|
e.stopPropagation();
|
|
305
382
|
setGroup(function () {
|
|
@@ -359,6 +436,8 @@ var BizEventSelector = function BizEventSelector(props) {
|
|
|
359
436
|
setShowDropdown(false);
|
|
360
437
|
|
|
361
438
|
if (onChange) {
|
|
439
|
+
item.groupId = group[fieldNames.groupValue];
|
|
440
|
+
|
|
362
441
|
if (responseType === 'id') {
|
|
363
442
|
onChange(item[fieldNames.value], item);
|
|
364
443
|
} else {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { AttrGroup } from '../targetConditionGroup/type';
|
|
2
3
|
interface AttrType {
|
|
3
4
|
attrId?: string;
|
|
4
5
|
[props: string]: any;
|
|
@@ -12,12 +13,12 @@ interface GlobalAttributeProps {
|
|
|
12
13
|
* @description 默认值
|
|
13
14
|
* @default {}
|
|
14
15
|
*/
|
|
15
|
-
defaultValue?:
|
|
16
|
+
defaultValue?: AttrGroup;
|
|
16
17
|
/**
|
|
17
18
|
* @description 默认值
|
|
18
19
|
* @default {}
|
|
19
20
|
*/
|
|
20
|
-
value?:
|
|
21
|
+
value?: AttrGroup;
|
|
21
22
|
/**
|
|
22
23
|
* @description 数据化配置选项内容
|
|
23
24
|
* @description.zh-CN
|
|
@@ -35,7 +35,7 @@ var BizGlobalAttributes = function BizGlobalAttributes(props) {
|
|
|
35
35
|
value = _props$value === void 0 ? {} : _props$value,
|
|
36
36
|
options = props.options,
|
|
37
37
|
_props$max = props.max,
|
|
38
|
-
max = _props$max === void 0 ?
|
|
38
|
+
max = _props$max === void 0 ? 10 : _props$max,
|
|
39
39
|
eventIds = props.eventIds,
|
|
40
40
|
_onChange = props.onChange;
|
|
41
41
|
|
|
@@ -47,43 +47,38 @@ var BizGlobalAttributes = function BizGlobalAttributes(props) {
|
|
|
47
47
|
useEffect(function () {
|
|
48
48
|
var defaultAttrs = Object.keys(defaultValue).length > 0 ? defaultValue : value;
|
|
49
49
|
var arr = [];
|
|
50
|
-
var
|
|
51
|
-
|
|
50
|
+
var relation = defaultAttrs.relation,
|
|
51
|
+
conditions = defaultAttrs.conditions;
|
|
52
52
|
|
|
53
|
-
if (
|
|
54
|
-
arr =
|
|
53
|
+
if (conditions) {
|
|
54
|
+
arr = conditions.map(function (item) {
|
|
55
55
|
var data = _objectSpread({}, item);
|
|
56
56
|
|
|
57
57
|
var attrId = Math.random().toString();
|
|
58
|
-
return {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
};
|
|
58
|
+
return _objectSpread({
|
|
59
|
+
key: attrId
|
|
60
|
+
}, item); // return { attrId, data };
|
|
62
61
|
});
|
|
63
|
-
} else {
|
|
64
|
-
arr = [{
|
|
65
|
-
attrId: Math.random().toString()
|
|
66
|
-
}];
|
|
67
62
|
}
|
|
68
63
|
|
|
69
64
|
setAttrsData(function (data) {
|
|
70
65
|
return {
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
relation: relation,
|
|
67
|
+
conditions: _toConsumableArray(arr)
|
|
73
68
|
};
|
|
74
69
|
});
|
|
75
70
|
}, []);
|
|
76
71
|
|
|
77
72
|
var _addAttribute = function _addAttribute() {
|
|
78
73
|
setAttrsData(function (data) {
|
|
79
|
-
var
|
|
80
|
-
|
|
81
|
-
}
|
|
74
|
+
var item = {
|
|
75
|
+
key: Math.random().toString()
|
|
76
|
+
};
|
|
82
77
|
|
|
83
|
-
if (!data.
|
|
84
|
-
data.
|
|
78
|
+
if (!data.conditions) {
|
|
79
|
+
data.conditions = [item];
|
|
85
80
|
} else {
|
|
86
|
-
data.
|
|
81
|
+
data.conditions.push(item);
|
|
87
82
|
}
|
|
88
83
|
|
|
89
84
|
return _objectSpread({}, data);
|
|
@@ -93,14 +88,14 @@ var BizGlobalAttributes = function BizGlobalAttributes(props) {
|
|
|
93
88
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(BizConditionGroup, {
|
|
94
89
|
defaultValue: attrsData,
|
|
95
90
|
options: options,
|
|
96
|
-
|
|
91
|
+
eventId: eventIds,
|
|
97
92
|
onChange: function onChange(data) {
|
|
98
93
|
setAttrsData(function () {
|
|
99
94
|
return _objectSpread({}, data);
|
|
100
95
|
});
|
|
101
96
|
_onChange && _onChange(_objectSpread({}, data));
|
|
102
97
|
}
|
|
103
|
-
}), attrsData.
|
|
98
|
+
}), attrsData.conditions && attrsData.conditions.length < max && /*#__PURE__*/React.createElement("div", {
|
|
104
99
|
className: "biz-icon-add",
|
|
105
100
|
style: {
|
|
106
101
|
marginTop: '16px'
|
package/es/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import BizAttributeSelector from './attributeSelector';
|
|
|
9
9
|
import BizGroupSelect from './attributeSelector/group';
|
|
10
10
|
import BizMultipleSelector from './multipleSelector';
|
|
11
11
|
import BizTargetCondition from './targetConditionGroup';
|
|
12
|
+
import BizTargetConditionGroup from './targetConditionGroup/group';
|
|
12
13
|
import BizConditionGroup from './targetConditionGroup/components/conditionGroup';
|
|
13
14
|
import BizDatePicker from './datePicker';
|
|
14
15
|
import BizGlobalAttributes from './globalAttributes';
|
|
@@ -20,4 +21,4 @@ import IconFont from './components/iconFont';
|
|
|
20
21
|
import { util, ajax } from './utils';
|
|
21
22
|
import { GlobalContextProps } from './utils/type';
|
|
22
23
|
declare const BizGlobalDataContext: import("react").Context<GlobalContextProps>;
|
|
23
|
-
export { BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizUserGroup, BizUserCluster, IconFont, BizTargetSelector, BizEventSelector, BizGroupSelect, BizAttributeSelector, BizGlobalDataContext, BizMultipleSelector, BizTargetCondition, BizDatePicker, BizConditionGroup, BizGlobalAttributes, ajax, util, };
|
|
24
|
+
export { BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizUserGroup, BizUserCluster, IconFont, BizTargetSelector, BizEventSelector, BizGroupSelect, BizAttributeSelector, BizGlobalDataContext, BizMultipleSelector, BizTargetCondition, BizTargetConditionGroup, BizDatePicker, BizConditionGroup, BizGlobalAttributes, ajax, util, };
|
package/es/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { createContext } from 'react';
|
|
|
9
9
|
import BizGroupSelect from './attributeSelector/group';
|
|
10
10
|
import BizMultipleSelector from './multipleSelector';
|
|
11
11
|
import BizTargetCondition from './targetConditionGroup';
|
|
12
|
+
import BizTargetConditionGroup from './targetConditionGroup/group';
|
|
12
13
|
import BizConditionGroup from './targetConditionGroup/components/conditionGroup';
|
|
13
14
|
import BizDatePicker from './datePicker';
|
|
14
15
|
import BizGlobalAttributes from './globalAttributes';
|
|
@@ -19,4 +20,4 @@ import BizTable from './table';
|
|
|
19
20
|
import IconFont from './components/iconFont';
|
|
20
21
|
import { util, ajax } from './utils';
|
|
21
22
|
var BizGlobalDataContext = /*#__PURE__*/createContext({});
|
|
22
|
-
export { BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizUserGroup, BizUserCluster, IconFont, BizTargetSelector, BizEventSelector, BizGroupSelect, BizAttributeSelector, BizGlobalDataContext, BizMultipleSelector, BizTargetCondition, BizDatePicker, BizConditionGroup, BizGlobalAttributes, ajax, util };
|
|
23
|
+
export { BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizUserGroup, BizUserCluster, IconFont, BizTargetSelector, BizEventSelector, BizGroupSelect, BizAttributeSelector, BizGlobalDataContext, BizMultipleSelector, BizTargetCondition, BizTargetConditionGroup, BizDatePicker, BizConditionGroup, BizGlobalAttributes, ajax, util };
|
|
@@ -10,6 +10,14 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
10
10
|
|
|
11
11
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
12
12
|
|
|
13
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
14
|
+
|
|
15
|
+
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."); }
|
|
16
|
+
|
|
17
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
18
|
+
|
|
19
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
20
|
+
|
|
13
21
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
22
|
|
|
15
23
|
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."); }
|
|
@@ -22,7 +30,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
22
30
|
|
|
23
31
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
24
32
|
|
|
25
|
-
import React, { useState } from 'react';
|
|
33
|
+
import React, { useEffect, useState } from 'react';
|
|
26
34
|
import { Select } from 'antd';
|
|
27
35
|
import IconFont from '../components/iconFont';
|
|
28
36
|
import './index.less';
|
|
@@ -36,13 +44,28 @@ var BizMultipleSelector = function BizMultipleSelector(props) {
|
|
|
36
44
|
options = props.options,
|
|
37
45
|
_props$placeholder = props.placeholder,
|
|
38
46
|
placeholder = _props$placeholder === void 0 ? '请选择' : _props$placeholder,
|
|
39
|
-
|
|
47
|
+
_onChange = props.onChange; // 是否是聚焦状态
|
|
40
48
|
|
|
41
49
|
var _useState = useState(false),
|
|
42
50
|
_useState2 = _slicedToArray(_useState, 2),
|
|
43
51
|
focused = _useState2[0],
|
|
44
52
|
setFocused = _useState2[1];
|
|
45
53
|
|
|
54
|
+
var _useState3 = useState([]),
|
|
55
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
56
|
+
multiValue = _useState4[0],
|
|
57
|
+
setMultiValue = _useState4[1];
|
|
58
|
+
|
|
59
|
+
useEffect(function () {
|
|
60
|
+
var data = defaultValue || value || [];
|
|
61
|
+
|
|
62
|
+
if (JSON.stringify(data) !== JSON.stringify(multiValue)) {
|
|
63
|
+
setMultiValue(function () {
|
|
64
|
+
return _toConsumableArray(data);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}, [defaultValue, value]);
|
|
68
|
+
|
|
46
69
|
var tagRender = function tagRender(props) {
|
|
47
70
|
var label = props.label,
|
|
48
71
|
res = _objectWithoutProperties(props, _excluded);
|
|
@@ -69,10 +92,15 @@ var BizMultipleSelector = function BizMultipleSelector(props) {
|
|
|
69
92
|
width: '100%'
|
|
70
93
|
},
|
|
71
94
|
placeholder: placeholder,
|
|
72
|
-
|
|
95
|
+
value: multiValue,
|
|
73
96
|
menuItemSelectedIcon: null,
|
|
74
97
|
listHeight: 400,
|
|
75
|
-
onChange: onChange
|
|
98
|
+
onChange: function onChange(data) {
|
|
99
|
+
setMultiValue(function () {
|
|
100
|
+
return _toConsumableArray(data);
|
|
101
|
+
});
|
|
102
|
+
_onChange && _onChange(data);
|
|
103
|
+
},
|
|
76
104
|
optionLabelProp: "label",
|
|
77
105
|
tagRender: tagRender,
|
|
78
106
|
onFocus: function onFocus() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { AttrGroup } from '../type';
|
|
3
3
|
import './style/group.less';
|
|
4
4
|
interface ConditionGroupProps {
|
|
5
5
|
/**
|
|
@@ -7,7 +7,7 @@ interface ConditionGroupProps {
|
|
|
7
7
|
* @description.zh-CN
|
|
8
8
|
* @default
|
|
9
9
|
*/
|
|
10
|
-
defaultValue?:
|
|
10
|
+
defaultValue?: AttrGroup;
|
|
11
11
|
/**
|
|
12
12
|
* @description 属性配置项
|
|
13
13
|
* @description.zh-CN
|
|
@@ -18,13 +18,13 @@ interface ConditionGroupProps {
|
|
|
18
18
|
* @description 如果是事件属性,则传事件id,多个用逗号隔开
|
|
19
19
|
* @default -
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
eventId?: string | number;
|
|
22
22
|
/**
|
|
23
23
|
* @description 参数改变回调
|
|
24
24
|
* @description.zh-CN
|
|
25
25
|
* @default
|
|
26
26
|
*/
|
|
27
|
-
onChange?: (data:
|
|
27
|
+
onChange?: (data: AttrGroup) => void;
|
|
28
28
|
}
|
|
29
29
|
declare const BizConditionGroup: React.FC<ConditionGroupProps>;
|
|
30
30
|
export default BizConditionGroup;
|
|
@@ -32,44 +32,45 @@ import util from '../../utils/util';
|
|
|
32
32
|
var BizConditionGroup = function BizConditionGroup(props) {
|
|
33
33
|
var _props$defaultValue = props.defaultValue,
|
|
34
34
|
defaultValue = _props$defaultValue === void 0 ? {
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
relation: 'and',
|
|
36
|
+
conditions: []
|
|
37
37
|
} : _props$defaultValue,
|
|
38
38
|
options = props.options,
|
|
39
|
-
|
|
39
|
+
eventId = props.eventId,
|
|
40
40
|
_onChange = props.onChange;
|
|
41
41
|
|
|
42
|
-
var _useState = useState(
|
|
42
|
+
var _useState = useState([]),
|
|
43
43
|
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
conditions = _useState2[0],
|
|
45
|
+
setConditions = _useState2[1];
|
|
46
46
|
|
|
47
|
-
var _useState3 = useState(
|
|
47
|
+
var _useState3 = useState('and'),
|
|
48
48
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
49
49
|
operate = _useState4[0],
|
|
50
50
|
setOperate = _useState4[1];
|
|
51
51
|
|
|
52
52
|
useEffect(function () {
|
|
53
|
-
if (util.equal(
|
|
54
|
-
|
|
55
|
-
return defaultValue.
|
|
53
|
+
if (util.equal(conditions, defaultValue.conditions)) return;
|
|
54
|
+
setConditions(function () {
|
|
55
|
+
return defaultValue.conditions ? _toConsumableArray(defaultValue.conditions) : [];
|
|
56
56
|
});
|
|
57
|
+
setOperate(defaultValue.relation || 'and');
|
|
57
58
|
}, [defaultValue]);
|
|
58
59
|
return /*#__PURE__*/React.createElement("div", {
|
|
59
60
|
className: "biz-attr-group-container"
|
|
60
61
|
}, /*#__PURE__*/React.createElement("div", {
|
|
61
62
|
className: "biz-attr-group-operate"
|
|
62
|
-
},
|
|
63
|
+
}, conditions.length > 1 && /*#__PURE__*/React.createElement("div", {
|
|
63
64
|
className: "biz-attr-operate",
|
|
64
65
|
onClick: function onClick(e) {
|
|
65
66
|
e.stopPropagation();
|
|
66
|
-
var
|
|
67
|
+
var relation = e.target.innerText === '且' ? 'and' : 'or';
|
|
67
68
|
setOperate(function () {
|
|
68
|
-
return
|
|
69
|
+
return relation;
|
|
69
70
|
});
|
|
70
71
|
_onChange && _onChange({
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
relation: relation,
|
|
73
|
+
conditions: conditions
|
|
73
74
|
});
|
|
74
75
|
}
|
|
75
76
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -78,28 +79,28 @@ var BizConditionGroup = function BizConditionGroup(props) {
|
|
|
78
79
|
className: operate === 'or' ? 'active' : ''
|
|
79
80
|
}, "\u6216"))), /*#__PURE__*/React.createElement("div", {
|
|
80
81
|
className: "biz-attr-group-content"
|
|
81
|
-
},
|
|
82
|
+
}, conditions.map(function (item, index) {
|
|
82
83
|
return /*#__PURE__*/React.createElement(BizConditionItem, {
|
|
83
|
-
key: item.
|
|
84
|
+
key: item.key || index,
|
|
84
85
|
options: options,
|
|
85
|
-
|
|
86
|
-
defaultValue: item
|
|
86
|
+
eventId: eventId,
|
|
87
|
+
defaultValue: item,
|
|
87
88
|
onDelete: function onDelete() {
|
|
88
|
-
|
|
89
|
+
setConditions(function (data) {
|
|
89
90
|
data.splice(index, 1);
|
|
90
91
|
_onChange && _onChange({
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
relation: operate,
|
|
93
|
+
conditions: _toConsumableArray(data)
|
|
93
94
|
});
|
|
94
95
|
return _toConsumableArray(data);
|
|
95
96
|
});
|
|
96
97
|
},
|
|
97
98
|
onChange: function onChange(data) {
|
|
98
|
-
|
|
99
|
-
attr[index]
|
|
99
|
+
setConditions(function (attr) {
|
|
100
|
+
attr[index] = _objectSpread({}, data);
|
|
100
101
|
_onChange && _onChange({
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
relation: operate,
|
|
103
|
+
conditions: _toConsumableArray(attr)
|
|
103
104
|
});
|
|
104
105
|
return _toConsumableArray(attr);
|
|
105
106
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './style/index.less';
|
|
3
|
-
import {
|
|
3
|
+
import { AttrItem } from '../type';
|
|
4
4
|
import { EventMetaProps } from '../../utils/type';
|
|
5
5
|
interface ConditionItemProps {
|
|
6
6
|
/**
|
|
@@ -8,7 +8,7 @@ interface ConditionItemProps {
|
|
|
8
8
|
* @description.zh-CN
|
|
9
9
|
* @default -
|
|
10
10
|
*/
|
|
11
|
-
defaultValue?:
|
|
11
|
+
defaultValue?: AttrItem;
|
|
12
12
|
/**
|
|
13
13
|
* @description 属性的配置项
|
|
14
14
|
* @description.zh-CN
|
|
@@ -19,7 +19,7 @@ interface ConditionItemProps {
|
|
|
19
19
|
* @description 如果是事件属性,则传事件id,多个用逗号隔开
|
|
20
20
|
* @default -
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
eventId?: string | number;
|
|
23
23
|
/**
|
|
24
24
|
* @description 软件id
|
|
25
25
|
* @default -
|
|
@@ -35,7 +35,7 @@ interface ConditionItemProps {
|
|
|
35
35
|
* @description.zh-CN
|
|
36
36
|
* @default
|
|
37
37
|
*/
|
|
38
|
-
onChange?: (data:
|
|
38
|
+
onChange?: (data: AttrItem) => void;
|
|
39
39
|
/**
|
|
40
40
|
* @description 删除属性
|
|
41
41
|
* @description.zh-CN
|