@zgfe/business-lib 1.0.24-alpha.6 → 1.0.24-tags4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/userCondition/conditions/tagsCondition.js +17 -12
- package/es/userCondition/conditions/textDesc.js +3 -3
- package/es/userCondition/demo/index.js +6 -228
- package/es/userCondition/demo/mockData.d.ts +33 -0
- package/es/userCondition/demo/mockData.js +208 -0
- package/es/userCondition/types.d.ts +20 -2
- package/es/userCondition/util.d.ts +20 -1
- package/es/userCondition/util.js +38 -5
- package/es/userTagsSelector/cascaderOverlay.js +132 -42
- package/es/userTagsSelector/demo/index.js +13 -6
- package/es/userTagsSelector/groups/groupOption.js +1 -1
- package/es/userTagsSelector/groups/index.js +19 -11
- package/es/userTagsSelector/groups/styles/option.less +6 -1
- package/es/userTagsSelector/index.js +17 -3
- package/es/userTagsSelector/multipleCheckPanel/index.js +4 -14
- package/es/userTagsSelector/styles/cascaderOverlay.less +9 -4
- package/es/userTagsSelector/types.d.ts +1 -10
- package/package.json +2 -2
|
@@ -16,13 +16,13 @@ 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 {
|
|
25
|
+
import { buildSelectLayer, buildTagsGroup } from '../util';
|
|
26
26
|
var options = [{
|
|
27
27
|
value: 'equal',
|
|
28
28
|
text: '是'
|
|
@@ -45,6 +45,10 @@ var TagsCondition = function TagsCondition(props) {
|
|
|
45
45
|
_useState2 = _slicedToArray(_useState, 1),
|
|
46
46
|
defaultValues = _useState2[0];
|
|
47
47
|
|
|
48
|
+
var tagGroupList = useMemo(function () {
|
|
49
|
+
return buildTagsGroup(userTagsData || []);
|
|
50
|
+
}, [userTagsData]);
|
|
51
|
+
|
|
48
52
|
function onOperatorChange(operator) {
|
|
49
53
|
onChange(dataId, _objectSpread(_objectSpread({}, labels), {}, {
|
|
50
54
|
operator: operator.value
|
|
@@ -52,8 +56,9 @@ var TagsCondition = function TagsCondition(props) {
|
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
function onTagsChange(data) {
|
|
59
|
+
console.log(data);
|
|
55
60
|
var values = data.map(function (item) {
|
|
56
|
-
return item[
|
|
61
|
+
return item[2].layerLabelId;
|
|
57
62
|
});
|
|
58
63
|
onChange(dataId, _objectSpread(_objectSpread({}, labels), {}, {
|
|
59
64
|
values: values
|
|
@@ -62,12 +67,12 @@ var TagsCondition = function TagsCondition(props) {
|
|
|
62
67
|
|
|
63
68
|
function buildDefaultValues() {
|
|
64
69
|
var values = [];
|
|
65
|
-
var findTag =
|
|
70
|
+
var findTag = buildSelectLayer(userTagsData);
|
|
66
71
|
labels.values.forEach(function (id) {
|
|
67
|
-
var
|
|
72
|
+
var selectValue = findTag(id);
|
|
68
73
|
|
|
69
|
-
if (
|
|
70
|
-
values.push(
|
|
74
|
+
if (selectValue) {
|
|
75
|
+
values.push(selectValue);
|
|
71
76
|
}
|
|
72
77
|
});
|
|
73
78
|
return values;
|
|
@@ -92,11 +97,11 @@ var TagsCondition = function TagsCondition(props) {
|
|
|
92
97
|
className: "".concat(classPrefix, "-tags-condition-value")
|
|
93
98
|
}, /*#__PURE__*/React.createElement(BizUserTagsSelect, {
|
|
94
99
|
defaultValue: defaultValues,
|
|
95
|
-
data:
|
|
96
|
-
childFields: ['children'],
|
|
97
|
-
keyFields: ['labelGroup', '
|
|
98
|
-
labelFields: ['labelGroup', 'labelName'],
|
|
99
|
-
valueFields: ['labelGroup', '
|
|
100
|
+
data: tagGroupList,
|
|
101
|
+
childFields: ['children', 'layers'],
|
|
102
|
+
keyFields: ['labelGroup', 'id', 'layerLabelId'],
|
|
103
|
+
labelFields: ['labelGroup', 'labelName', 'layerLabelName'],
|
|
104
|
+
valueFields: ['labelGroup', 'labelName', 'layerLabelId'],
|
|
100
105
|
onChange: onTagsChange,
|
|
101
106
|
destroyPopupOnHide: true
|
|
102
107
|
})), /*#__PURE__*/React.createElement("div", {
|
|
@@ -7,7 +7,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
7
7
|
import React, { useContext, useMemo } from 'react';
|
|
8
8
|
import { BizUserConditionContext, classPrefix } from '..';
|
|
9
9
|
import BizGlobalDataContext from '../../context';
|
|
10
|
-
import { findEvent, findPropAndEnv,
|
|
10
|
+
import { findEvent, findPropAndEnv, buildSelectLayer } from '../util';
|
|
11
11
|
import { durationHandler, operatorMap } from './constants';
|
|
12
12
|
import './styles/textDesc.less';
|
|
13
13
|
|
|
@@ -181,7 +181,7 @@ var Text = function Text(props) {
|
|
|
181
181
|
style: {
|
|
182
182
|
margin: '0 4px'
|
|
183
183
|
}
|
|
184
|
-
}, "\u6216") : null, /*#__PURE__*/React.createElement("span", null, tag && tag.labelName));
|
|
184
|
+
}, "\u6216") : null, /*#__PURE__*/React.createElement("span", null, tag && tag[1].labelName + ':' + tag[2].layerLabelName));
|
|
185
185
|
}), /*#__PURE__*/React.createElement("span", null, ")")));
|
|
186
186
|
}
|
|
187
187
|
|
|
@@ -231,7 +231,7 @@ var Text = function Text(props) {
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
var findTag = useMemo(function () {
|
|
234
|
-
return
|
|
234
|
+
return buildSelectLayer(userTagsData);
|
|
235
235
|
}, [userTagsData]);
|
|
236
236
|
return /*#__PURE__*/React.createElement("span", {
|
|
237
237
|
className: "".concat(classPrefix, "-text-desc")
|
|
@@ -15,216 +15,8 @@ import eventData from '../../mock/event';
|
|
|
15
15
|
import envData from '../../mock/env';
|
|
16
16
|
import userData from '../../mock/user';
|
|
17
17
|
import { BizUserCondition, BizGlobalDataContext, convertAttributeData } from '@zgfe/business-lib';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
createTime: '2022-07-05T13:48:51',
|
|
21
|
-
del: 0,
|
|
22
|
-
id: 286,
|
|
23
|
-
isInner: 0,
|
|
24
|
-
isStartup: 0,
|
|
25
|
-
labelGroup: '行为标签',
|
|
26
|
-
labelId: 66284406603776,
|
|
27
|
-
labelName: 'test8(新增)',
|
|
28
|
-
labelStatus: 1,
|
|
29
|
-
updateTime: '2022-07-05T13:48:51'
|
|
30
|
-
}, {
|
|
31
|
-
appId: 51,
|
|
32
|
-
createTime: '2022-07-05T13:47:38',
|
|
33
|
-
del: 0,
|
|
34
|
-
id: 285,
|
|
35
|
-
isInner: 0,
|
|
36
|
-
isStartup: 0,
|
|
37
|
-
labelGroup: '预测标签',
|
|
38
|
-
labelId: 66283215683584,
|
|
39
|
-
labelName: 'test7(新增)',
|
|
40
|
-
labelStatus: 1,
|
|
41
|
-
updateTime: '2022-07-05T13:47:38'
|
|
42
|
-
}, {
|
|
43
|
-
appId: 51,
|
|
44
|
-
createTime: '2022-07-05T13:47:10',
|
|
45
|
-
del: 0,
|
|
46
|
-
id: 284,
|
|
47
|
-
isInner: 0,
|
|
48
|
-
isStartup: 0,
|
|
49
|
-
labelGroup: '其他标签',
|
|
50
|
-
labelId: 66282747314176,
|
|
51
|
-
labelName: 'test6(新增)',
|
|
52
|
-
labelStatus: 1,
|
|
53
|
-
updateTime: '2022-07-05T13:47:10'
|
|
54
|
-
}, {
|
|
55
|
-
appId: 51,
|
|
56
|
-
createTime: '2022-07-05T13:44:20',
|
|
57
|
-
del: 0,
|
|
58
|
-
id: 283,
|
|
59
|
-
isInner: 0,
|
|
60
|
-
isStartup: 0,
|
|
61
|
-
labelGroup: '其他标签',
|
|
62
|
-
labelId: 66279963361280,
|
|
63
|
-
labelName: 'test5(新增)',
|
|
64
|
-
labelStatus: 1,
|
|
65
|
-
updateTime: '2022-07-05T13:44:20'
|
|
66
|
-
}, {
|
|
67
|
-
appId: 51,
|
|
68
|
-
createTime: '2022-07-05T13:43:08',
|
|
69
|
-
del: 0,
|
|
70
|
-
id: 282,
|
|
71
|
-
isInner: 0,
|
|
72
|
-
isStartup: 0,
|
|
73
|
-
labelGroup: '活跃标签',
|
|
74
|
-
labelId: 66278784057344,
|
|
75
|
-
labelName: 'test3(新增)',
|
|
76
|
-
labelStatus: 1,
|
|
77
|
-
updateTime: '2022-07-05T13:43:08'
|
|
78
|
-
}, {
|
|
79
|
-
appId: 51,
|
|
80
|
-
createTime: '2022-07-05T13:42:44',
|
|
81
|
-
del: 0,
|
|
82
|
-
id: 281,
|
|
83
|
-
isInner: 0,
|
|
84
|
-
isStartup: 0,
|
|
85
|
-
labelGroup: '其他标签',
|
|
86
|
-
labelId: 66278393724928,
|
|
87
|
-
labelName: 'test2(新增)',
|
|
88
|
-
labelStatus: 1,
|
|
89
|
-
updateTime: '2022-07-05T13:42:44'
|
|
90
|
-
}, {
|
|
91
|
-
appId: 51,
|
|
92
|
-
createTime: '2022-07-05T13:42:30',
|
|
93
|
-
del: 0,
|
|
94
|
-
id: 280,
|
|
95
|
-
isInner: 0,
|
|
96
|
-
isStartup: 0,
|
|
97
|
-
labelGroup: '预测标签',
|
|
98
|
-
labelId: 66278158696448,
|
|
99
|
-
labelName: 'test1(新增)',
|
|
100
|
-
labelStatus: 1,
|
|
101
|
-
updateTime: '2022-07-05T13:42:30'
|
|
102
|
-
}, {
|
|
103
|
-
appId: 51,
|
|
104
|
-
createTime: '2022-06-21T15:04:24',
|
|
105
|
-
del: 0,
|
|
106
|
-
id: 277,
|
|
107
|
-
isInner: 0,
|
|
108
|
-
isStartup: 0,
|
|
109
|
-
labelGroup: '活跃标签',
|
|
110
|
-
labelId: 46540583010304,
|
|
111
|
-
labelName: '匿名用户',
|
|
112
|
-
labelStatus: 0,
|
|
113
|
-
updateTime: '2022-06-21T15:04:24'
|
|
114
|
-
}, {
|
|
115
|
-
appId: 51,
|
|
116
|
-
createTime: '2022-06-10T11:10:52',
|
|
117
|
-
del: 0,
|
|
118
|
-
id: 197,
|
|
119
|
-
isInner: 0,
|
|
120
|
-
isStartup: 0,
|
|
121
|
-
labelGroup: '活跃标签',
|
|
122
|
-
labelId: 77384417755136,
|
|
123
|
-
labelName: '手动更新1',
|
|
124
|
-
labelStatus: 0,
|
|
125
|
-
updateTime: '2022-06-10T11:32:31'
|
|
126
|
-
}, {
|
|
127
|
-
appId: 51,
|
|
128
|
-
createTime: '2022-06-10T11:10:36',
|
|
129
|
-
del: 0,
|
|
130
|
-
id: 196,
|
|
131
|
-
isInner: 0,
|
|
132
|
-
isStartup: 0,
|
|
133
|
-
labelGroup: '活跃标签',
|
|
134
|
-
labelId: 77383474429952,
|
|
135
|
-
labelName: '自动更新修改',
|
|
136
|
-
labelStatus: 0,
|
|
137
|
-
updateTime: '2022-06-10T11:11:13'
|
|
138
|
-
}, {
|
|
139
|
-
appId: 51,
|
|
140
|
-
createTime: '2022-06-10T10:49:57',
|
|
141
|
-
del: 0,
|
|
142
|
-
id: 191,
|
|
143
|
-
isInner: 0,
|
|
144
|
-
isStartup: 0,
|
|
145
|
-
labelGroup: '基本标签',
|
|
146
|
-
labelId: 77388914425856,
|
|
147
|
-
labelName: '一般价值',
|
|
148
|
-
labelStatus: 0,
|
|
149
|
-
updateTime: '2022-06-10T10:49:57'
|
|
150
|
-
}]);
|
|
151
|
-
var data = {
|
|
152
|
-
json: [[{
|
|
153
|
-
eventId: -4,
|
|
154
|
-
attrs: [],
|
|
155
|
-
runPeriod: {
|
|
156
|
-
operator: 'relative',
|
|
157
|
-
values: ['30', '1']
|
|
158
|
-
},
|
|
159
|
-
runTimes: {
|
|
160
|
-
operator: '>=',
|
|
161
|
-
values: ['1']
|
|
162
|
-
}
|
|
163
|
-
}, {
|
|
164
|
-
eventId: -3,
|
|
165
|
-
attrs: [],
|
|
166
|
-
runPeriod: {
|
|
167
|
-
operator: 'absolute',
|
|
168
|
-
values: ['2022-07-13', '2022-07-19']
|
|
169
|
-
},
|
|
170
|
-
runTimes: {
|
|
171
|
-
operator: '>=',
|
|
172
|
-
values: ['1']
|
|
173
|
-
}
|
|
174
|
-
}], [{
|
|
175
|
-
attrs: [{
|
|
176
|
-
attrId: 0,
|
|
177
|
-
attrName: 'zg_id',
|
|
178
|
-
operator: '>',
|
|
179
|
-
params: ['20'],
|
|
180
|
-
attrType: 'cont-num',
|
|
181
|
-
category: 'fixed'
|
|
182
|
-
}]
|
|
183
|
-
}, {
|
|
184
|
-
attrs: [{
|
|
185
|
-
attrId: 0,
|
|
186
|
-
attrName: 'app_user_id',
|
|
187
|
-
operator: 'equal',
|
|
188
|
-
params: ['20'],
|
|
189
|
-
attrType: 'cont-string',
|
|
190
|
-
category: 'fixed'
|
|
191
|
-
}]
|
|
192
|
-
}], [{
|
|
193
|
-
attrs: [{
|
|
194
|
-
attrId: 0,
|
|
195
|
-
attrName: 'duration',
|
|
196
|
-
operator: 'not equal',
|
|
197
|
-
params: [1198800, '1'],
|
|
198
|
-
attrType: 'cont-num',
|
|
199
|
-
category: 'fixed'
|
|
200
|
-
}]
|
|
201
|
-
}, {
|
|
202
|
-
eventId: 24143017,
|
|
203
|
-
runTimes: {
|
|
204
|
-
operator: '>=',
|
|
205
|
-
values: ['1']
|
|
206
|
-
},
|
|
207
|
-
attrs: [{
|
|
208
|
-
attrId: 0,
|
|
209
|
-
attrName: 'resolution_l',
|
|
210
|
-
category: 'fixed',
|
|
211
|
-
operator: '>',
|
|
212
|
-
params: ['10'],
|
|
213
|
-
attrType: 'cont-num'
|
|
214
|
-
}, {
|
|
215
|
-
attrId: 30183430,
|
|
216
|
-
attrName: '扫码场景描述',
|
|
217
|
-
category: 'custom',
|
|
218
|
-
operator: 'equal',
|
|
219
|
-
params: ['Microsoft Edge', 'Safari', 'Apple WebKit'],
|
|
220
|
-
attrType: 'cont-string'
|
|
221
|
-
}],
|
|
222
|
-
runPeriod: {
|
|
223
|
-
operator: 'relative',
|
|
224
|
-
values: ['30', '0']
|
|
225
|
-
}
|
|
226
|
-
}]]
|
|
227
|
-
};
|
|
18
|
+
import { conditions, tagList } from './mockData';
|
|
19
|
+
var getTagList = Promise.resolve(tagList);
|
|
228
20
|
export default (function () {
|
|
229
21
|
var _useState = useState({
|
|
230
22
|
eventGroupList: [],
|
|
@@ -248,34 +40,20 @@ export default (function () {
|
|
|
248
40
|
setStore(newStore);
|
|
249
41
|
}, []);
|
|
250
42
|
useEffect(function () {
|
|
251
|
-
var tagsMap = {};
|
|
252
43
|
getTagList.then(function (list) {
|
|
253
|
-
|
|
254
|
-
list.forEach(function (item) {
|
|
255
|
-
var labelGroup = item.labelGroup;
|
|
256
|
-
|
|
257
|
-
if (tagsMap[labelGroup]) {
|
|
258
|
-
tagsMap[labelGroup].push(item);
|
|
259
|
-
} else {
|
|
260
|
-
tagsMap[labelGroup] = [item];
|
|
261
|
-
data.push({
|
|
262
|
-
labelGroup: labelGroup,
|
|
263
|
-
children: tagsMap[labelGroup]
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
setUserTagsData(data);
|
|
44
|
+
setUserTagsData(list);
|
|
268
45
|
});
|
|
269
46
|
}, []);
|
|
270
47
|
var defaultValue = useMemo(function () {
|
|
271
|
-
return
|
|
272
|
-
}, [
|
|
48
|
+
return conditions;
|
|
49
|
+
}, [conditions]);
|
|
273
50
|
|
|
274
51
|
function onChange(value) {
|
|
275
52
|
console.log(JSON.stringify(value));
|
|
276
53
|
}
|
|
277
54
|
|
|
278
55
|
var descDom = /*#__PURE__*/React.createElement(BizUserCondition, {
|
|
56
|
+
textMode: true,
|
|
279
57
|
defaultValue: defaultValue,
|
|
280
58
|
onChange: onChange,
|
|
281
59
|
eventAttrNum: 3,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const tagList: {
|
|
2
|
+
dataStatus: number;
|
|
3
|
+
id: number;
|
|
4
|
+
labelGroup: string;
|
|
5
|
+
labelName: string;
|
|
6
|
+
labelRemark: string;
|
|
7
|
+
labelType: number;
|
|
8
|
+
layers: {
|
|
9
|
+
layerCondition: {
|
|
10
|
+
eventId: string;
|
|
11
|
+
runPeriod: {
|
|
12
|
+
values: string[];
|
|
13
|
+
operator: string;
|
|
14
|
+
};
|
|
15
|
+
runTimes: {
|
|
16
|
+
values: string[];
|
|
17
|
+
operator: string;
|
|
18
|
+
};
|
|
19
|
+
attrs: never[];
|
|
20
|
+
}[][];
|
|
21
|
+
layerLabelId: number;
|
|
22
|
+
layerLabelName: string;
|
|
23
|
+
layerRemark: string;
|
|
24
|
+
sequence: number;
|
|
25
|
+
}[];
|
|
26
|
+
}[];
|
|
27
|
+
export declare const conditions: {
|
|
28
|
+
attrs: never[];
|
|
29
|
+
labels: {
|
|
30
|
+
operator: string;
|
|
31
|
+
values: number[];
|
|
32
|
+
};
|
|
33
|
+
}[][];
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
export var tagList = [{
|
|
2
|
+
dataStatus: 1,
|
|
3
|
+
id: 30,
|
|
4
|
+
labelGroup: '预测标签',
|
|
5
|
+
labelName: 'test3',
|
|
6
|
+
labelRemark: '',
|
|
7
|
+
labelType: 0,
|
|
8
|
+
layers: [{
|
|
9
|
+
layerCondition: [[{
|
|
10
|
+
eventId: '-3',
|
|
11
|
+
runPeriod: {
|
|
12
|
+
values: ['30', '0'],
|
|
13
|
+
operator: 'relative'
|
|
14
|
+
},
|
|
15
|
+
runTimes: {
|
|
16
|
+
values: ['1'],
|
|
17
|
+
operator: '>='
|
|
18
|
+
},
|
|
19
|
+
attrs: []
|
|
20
|
+
}]],
|
|
21
|
+
layerLabelId: 130079277498373,
|
|
22
|
+
layerLabelName: '分层6',
|
|
23
|
+
layerRemark: '',
|
|
24
|
+
sequence: 6
|
|
25
|
+
}, {
|
|
26
|
+
layerCondition: [[{
|
|
27
|
+
eventId: '-3',
|
|
28
|
+
runPeriod: {
|
|
29
|
+
values: ['30', '0'],
|
|
30
|
+
operator: 'relative'
|
|
31
|
+
},
|
|
32
|
+
runTimes: {
|
|
33
|
+
values: ['1'],
|
|
34
|
+
operator: '>='
|
|
35
|
+
},
|
|
36
|
+
attrs: []
|
|
37
|
+
}]],
|
|
38
|
+
layerLabelId: 130079277498372,
|
|
39
|
+
layerLabelName: '分层5',
|
|
40
|
+
layerRemark: '',
|
|
41
|
+
sequence: 5
|
|
42
|
+
}, {
|
|
43
|
+
layerCondition: [[{
|
|
44
|
+
eventId: '-3',
|
|
45
|
+
runPeriod: {
|
|
46
|
+
values: ['30', '0'],
|
|
47
|
+
operator: 'relative'
|
|
48
|
+
},
|
|
49
|
+
runTimes: {
|
|
50
|
+
values: ['1'],
|
|
51
|
+
operator: '>='
|
|
52
|
+
},
|
|
53
|
+
attrs: []
|
|
54
|
+
}]],
|
|
55
|
+
layerLabelId: 130079277498371,
|
|
56
|
+
layerLabelName: '分层4',
|
|
57
|
+
layerRemark: '',
|
|
58
|
+
sequence: 4
|
|
59
|
+
}, {
|
|
60
|
+
layerCondition: [[{
|
|
61
|
+
eventId: '-3',
|
|
62
|
+
runPeriod: {
|
|
63
|
+
values: ['30', '0'],
|
|
64
|
+
operator: 'relative'
|
|
65
|
+
},
|
|
66
|
+
runTimes: {
|
|
67
|
+
values: ['1'],
|
|
68
|
+
operator: '>='
|
|
69
|
+
},
|
|
70
|
+
attrs: []
|
|
71
|
+
}]],
|
|
72
|
+
layerLabelId: 130079277498370,
|
|
73
|
+
layerLabelName: '分层3',
|
|
74
|
+
layerRemark: '',
|
|
75
|
+
sequence: 3
|
|
76
|
+
}, {
|
|
77
|
+
layerCondition: [[{
|
|
78
|
+
eventId: '-3',
|
|
79
|
+
runPeriod: {
|
|
80
|
+
values: ['30', '0'],
|
|
81
|
+
operator: 'relative'
|
|
82
|
+
},
|
|
83
|
+
runTimes: {
|
|
84
|
+
values: ['1'],
|
|
85
|
+
operator: '>='
|
|
86
|
+
},
|
|
87
|
+
attrs: []
|
|
88
|
+
}]],
|
|
89
|
+
layerLabelId: 130079277498369,
|
|
90
|
+
layerLabelName: '分层2',
|
|
91
|
+
layerRemark: '',
|
|
92
|
+
sequence: 2
|
|
93
|
+
}, {
|
|
94
|
+
layerCondition: [[{
|
|
95
|
+
eventId: '-3',
|
|
96
|
+
runPeriod: {
|
|
97
|
+
values: ['30', '0'],
|
|
98
|
+
operator: 'relative'
|
|
99
|
+
},
|
|
100
|
+
runTimes: {
|
|
101
|
+
values: ['1'],
|
|
102
|
+
operator: '>='
|
|
103
|
+
},
|
|
104
|
+
attrs: []
|
|
105
|
+
}]],
|
|
106
|
+
layerLabelId: 130079277498368,
|
|
107
|
+
layerLabelName: '分层1',
|
|
108
|
+
layerRemark: '',
|
|
109
|
+
sequence: 1
|
|
110
|
+
}]
|
|
111
|
+
}, {
|
|
112
|
+
dataStatus: 1,
|
|
113
|
+
id: 29,
|
|
114
|
+
labelGroup: '活跃标签',
|
|
115
|
+
labelName: 'test2',
|
|
116
|
+
labelRemark: '',
|
|
117
|
+
labelType: 0,
|
|
118
|
+
layers: [{
|
|
119
|
+
layerCondition: [[{
|
|
120
|
+
eventId: '-4',
|
|
121
|
+
runPeriod: {
|
|
122
|
+
values: ['30', '0'],
|
|
123
|
+
operator: 'relative'
|
|
124
|
+
},
|
|
125
|
+
runTimes: {
|
|
126
|
+
values: ['1'],
|
|
127
|
+
operator: '>='
|
|
128
|
+
},
|
|
129
|
+
attrs: []
|
|
130
|
+
}]],
|
|
131
|
+
layerLabelId: 130078364041218,
|
|
132
|
+
layerLabelName: '分层3',
|
|
133
|
+
layerRemark: '',
|
|
134
|
+
sequence: 3
|
|
135
|
+
}, {
|
|
136
|
+
layerCondition: [[{
|
|
137
|
+
eventId: '-4',
|
|
138
|
+
runPeriod: {
|
|
139
|
+
values: ['30', '0'],
|
|
140
|
+
operator: 'relative'
|
|
141
|
+
},
|
|
142
|
+
runTimes: {
|
|
143
|
+
values: ['1'],
|
|
144
|
+
operator: '>='
|
|
145
|
+
},
|
|
146
|
+
attrs: []
|
|
147
|
+
}]],
|
|
148
|
+
layerLabelId: 130078364041217,
|
|
149
|
+
layerLabelName: '分层2',
|
|
150
|
+
layerRemark: '',
|
|
151
|
+
sequence: 2
|
|
152
|
+
}, {
|
|
153
|
+
layerCondition: [[{
|
|
154
|
+
eventId: '-3',
|
|
155
|
+
runPeriod: {
|
|
156
|
+
values: ['30', '0'],
|
|
157
|
+
operator: 'relative'
|
|
158
|
+
},
|
|
159
|
+
runTimes: {
|
|
160
|
+
values: ['1'],
|
|
161
|
+
operator: '>='
|
|
162
|
+
},
|
|
163
|
+
attrs: []
|
|
164
|
+
}]],
|
|
165
|
+
layerLabelId: 130078364041216,
|
|
166
|
+
layerLabelName: '分层1',
|
|
167
|
+
layerRemark: '',
|
|
168
|
+
sequence: 1
|
|
169
|
+
}]
|
|
170
|
+
}, {
|
|
171
|
+
dataStatus: 1,
|
|
172
|
+
id: 28,
|
|
173
|
+
labelGroup: '基本标签',
|
|
174
|
+
labelName: 'test1',
|
|
175
|
+
labelRemark: '',
|
|
176
|
+
labelType: 0,
|
|
177
|
+
layers: [{
|
|
178
|
+
layerCondition: [[{
|
|
179
|
+
eventId: '-3',
|
|
180
|
+
runPeriod: {
|
|
181
|
+
values: ['30', '0'],
|
|
182
|
+
operator: 'relative'
|
|
183
|
+
},
|
|
184
|
+
runTimes: {
|
|
185
|
+
values: ['1'],
|
|
186
|
+
operator: '>='
|
|
187
|
+
},
|
|
188
|
+
attrs: []
|
|
189
|
+
}]],
|
|
190
|
+
layerLabelId: 130003289636864,
|
|
191
|
+
layerLabelName: '分层1',
|
|
192
|
+
layerRemark: '',
|
|
193
|
+
sequence: 1
|
|
194
|
+
}]
|
|
195
|
+
}];
|
|
196
|
+
export var conditions = [[{
|
|
197
|
+
attrs: [],
|
|
198
|
+
labels: {
|
|
199
|
+
operator: 'equal',
|
|
200
|
+
values: [130003289636864, 130078364041218, 130078364041217, 130078364041216]
|
|
201
|
+
}
|
|
202
|
+
}, {
|
|
203
|
+
attrs: [],
|
|
204
|
+
labels: {
|
|
205
|
+
operator: 'not equal',
|
|
206
|
+
values: [130078364041218, 130078364041217]
|
|
207
|
+
}
|
|
208
|
+
}]];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { UserProp } from '../attributeSelector/types';
|
|
3
|
-
import { TagI } from './../userTagsSelector/types';
|
|
4
3
|
export declare type Unpacked<T, U extends keyof T> = Required<T> extends {
|
|
5
4
|
[key in U]: infer R;
|
|
6
5
|
} ? R : never;
|
|
@@ -30,8 +29,27 @@ export declare namespace BizUserConditionT {
|
|
|
30
29
|
isRealTime?: boolean;
|
|
31
30
|
}
|
|
32
31
|
interface UserTagsDataI {
|
|
32
|
+
appId: number;
|
|
33
|
+
createTime: string;
|
|
34
|
+
updateTime: string;
|
|
35
|
+
del: number;
|
|
33
36
|
labelGroup: string;
|
|
34
|
-
|
|
37
|
+
id: number;
|
|
38
|
+
labelName: string;
|
|
39
|
+
labelStatus: number;
|
|
40
|
+
labelType: number;
|
|
41
|
+
remark: string;
|
|
42
|
+
creator: string;
|
|
43
|
+
userAmount: number;
|
|
44
|
+
layerNum: number;
|
|
45
|
+
endProcessTime: string;
|
|
46
|
+
layers: {
|
|
47
|
+
layerLabelId: number;
|
|
48
|
+
layerLabelName: string;
|
|
49
|
+
layerRemark: string;
|
|
50
|
+
layerCondition: any[][];
|
|
51
|
+
sequence: number;
|
|
52
|
+
}[];
|
|
35
53
|
}
|
|
36
54
|
interface AttrCondition {
|
|
37
55
|
attrId: number;
|
|
@@ -4,4 +4,23 @@ export declare function buildCondition(type: BizUserConditionT.ConditionType): B
|
|
|
4
4
|
export declare function transformNumberOperate(key: string, output?: boolean): string;
|
|
5
5
|
export declare function findEvent(eventId: number, eventGroupList: Unpacked<GlobalContextProps, 'eventGroupList'>): import("../attributeSelector/types").AnalysisEvent | null;
|
|
6
6
|
export declare function findPropAndEnv(name: string, list: Unpacked<GlobalContextProps, 'userPropList' | 'eventEnvList'>): import("../attributeSelector/types").UserProp | import("../attributeSelector/types").EnvProp | null;
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function buildSelectLayer(data: BizUserConditionT.UserTagsDataI[]): (layerLabelId: number) => ({
|
|
8
|
+
labelGroup: string;
|
|
9
|
+
labelName?: undefined;
|
|
10
|
+
layerLabelId?: undefined;
|
|
11
|
+
layerLabelName?: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
labelName: string;
|
|
14
|
+
labelGroup?: undefined;
|
|
15
|
+
layerLabelId?: undefined;
|
|
16
|
+
layerLabelName?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
layerLabelId: number;
|
|
19
|
+
layerLabelName: string;
|
|
20
|
+
labelGroup?: undefined;
|
|
21
|
+
labelName?: undefined;
|
|
22
|
+
})[] | null;
|
|
23
|
+
export declare function buildTagsGroup(list: BizUserConditionT.UserTagsDataI[]): {
|
|
24
|
+
labelGroup: string;
|
|
25
|
+
children: BizUserConditionT.UserTagsDataI[];
|
|
26
|
+
}[];
|
package/es/userCondition/util.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
1
7
|
export function buildCondition(type) {
|
|
2
8
|
switch (type) {
|
|
3
9
|
case 'add':
|
|
@@ -99,17 +105,44 @@ export function findPropAndEnv(name, list) {
|
|
|
99
105
|
|
|
100
106
|
return null;
|
|
101
107
|
}
|
|
102
|
-
export function
|
|
103
|
-
return function (
|
|
108
|
+
export function buildSelectLayer(data) {
|
|
109
|
+
return function (layerLabelId) {
|
|
104
110
|
var i = -1;
|
|
105
111
|
var j = data.findIndex(function (item) {
|
|
106
|
-
i = item.
|
|
107
|
-
return
|
|
112
|
+
i = item.layers.findIndex(function (layer) {
|
|
113
|
+
return layer.layerLabelId === layerLabelId;
|
|
108
114
|
});
|
|
109
115
|
if (i < 0) return false;
|
|
110
116
|
return true;
|
|
111
117
|
});
|
|
112
118
|
if (j < 0) return null;
|
|
113
|
-
return
|
|
119
|
+
return [{
|
|
120
|
+
labelGroup: data[j].labelGroup
|
|
121
|
+
}, {
|
|
122
|
+
labelName: data[j].labelName
|
|
123
|
+
}, {
|
|
124
|
+
layerLabelId: data[j].layers[i].layerLabelId,
|
|
125
|
+
layerLabelName: data[j].layers[i].layerLabelName
|
|
126
|
+
}];
|
|
114
127
|
};
|
|
128
|
+
}
|
|
129
|
+
export function buildTagsGroup(list) {
|
|
130
|
+
var groupOrder = ['基本标签', '活跃标签', '行为标签', '预测标签', '其他标签'];
|
|
131
|
+
var groupsMap = {};
|
|
132
|
+
var options = [];
|
|
133
|
+
list.forEach(function (label) {
|
|
134
|
+
if (Object.hasOwn(groupsMap, label.labelGroup)) {
|
|
135
|
+
groupsMap[label.labelGroup].children.push(_objectSpread({}, label));
|
|
136
|
+
} else {
|
|
137
|
+
var group = {
|
|
138
|
+
labelGroup: label.labelGroup,
|
|
139
|
+
children: [_objectSpread({}, label)]
|
|
140
|
+
};
|
|
141
|
+
groupsMap[label.labelGroup] = group;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
groupOrder.map(function (group) {
|
|
145
|
+
groupsMap[group] && options.push(groupsMap[group]);
|
|
146
|
+
});
|
|
147
|
+
return options;
|
|
115
148
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
|
|
1
5
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
6
|
|
|
3
7
|
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,6 +10,8 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
6
10
|
|
|
7
11
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
12
|
|
|
13
|
+
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; }
|
|
14
|
+
|
|
9
15
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
16
|
|
|
11
17
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -18,49 +24,77 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
18
24
|
|
|
19
25
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
26
|
|
|
21
|
-
import React from 'react';
|
|
27
|
+
import React, { useRef } from 'react';
|
|
22
28
|
import { useState } from 'react';
|
|
23
29
|
import { classPrefix } from '.';
|
|
24
30
|
import './styles/cascaderOverlay.less';
|
|
25
31
|
import Groups from './groups/index';
|
|
26
32
|
import MultipleCheckPanel from './multipleCheckPanel';
|
|
27
|
-
import { getFieldFactory } from './util';
|
|
33
|
+
import { filterFactory, getFieldFactory } from './util';
|
|
28
34
|
import _ from 'lodash';
|
|
35
|
+
import Search from './components/search';
|
|
29
36
|
|
|
30
37
|
var CascaderOverlay = function CascaderOverlay(props) {
|
|
31
|
-
var
|
|
32
|
-
currentValue = props.currentValue,
|
|
38
|
+
var currentValue = props.currentValue,
|
|
33
39
|
labelFields = props.labelFields,
|
|
34
40
|
keyFields = props.keyFields,
|
|
35
41
|
valueFields = props.valueFields,
|
|
36
42
|
childFields = props.childFields;
|
|
43
|
+
var timer = useRef(null);
|
|
37
44
|
|
|
38
|
-
var _useState = useState(
|
|
39
|
-
var initPath = [];
|
|
40
|
-
var curr = data[0];
|
|
41
|
-
var getChildField = getFieldFactory(childFields);
|
|
42
|
-
|
|
43
|
-
while (curr) {
|
|
44
|
-
initPath.push(curr);
|
|
45
|
-
curr = curr[getChildField()];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
initPath.pop();
|
|
49
|
-
return initPath;
|
|
50
|
-
}),
|
|
45
|
+
var _useState = useState(props.data || []),
|
|
51
46
|
_useState2 = _slicedToArray(_useState, 2),
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
data = _useState2[0],
|
|
48
|
+
setData = _useState2[1];
|
|
49
|
+
|
|
50
|
+
var _useState3 = useState(initPath(data)),
|
|
51
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
52
|
+
currentPath = _useState4[0],
|
|
53
|
+
setCurrentPath = _useState4[1];
|
|
54
|
+
|
|
55
|
+
var _useState5 = useState(''),
|
|
56
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
57
|
+
highlightText = _useState6[0],
|
|
58
|
+
setHighlightText = _useState6[1];
|
|
59
|
+
|
|
60
|
+
function initPath(data) {
|
|
61
|
+
return function () {
|
|
62
|
+
var path = [];
|
|
63
|
+
var curr = data[0];
|
|
64
|
+
var getChildField = getFieldFactory(childFields);
|
|
65
|
+
|
|
66
|
+
while (curr) {
|
|
67
|
+
path.push(curr);
|
|
68
|
+
var childField = getChildField();
|
|
69
|
+
|
|
70
|
+
if (_.isArray(curr[childField])) {
|
|
71
|
+
curr = curr[childField].length ? curr[childField][0] : null;
|
|
72
|
+
} else {
|
|
73
|
+
curr = curr[childField];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
path.pop();
|
|
78
|
+
return path;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
54
81
|
|
|
55
82
|
function onActive(data, level) {
|
|
56
83
|
var currIndex = level;
|
|
57
84
|
var getChildField = getFieldFactory(childFields.slice(currIndex).length ? childFields.slice(currIndex) : childFields.slice(-1));
|
|
58
85
|
var curr = data;
|
|
59
|
-
var newPath = currentPath.slice();
|
|
86
|
+
var newPath = currentPath.slice(0, level + 1);
|
|
60
87
|
|
|
61
88
|
while (curr) {
|
|
62
89
|
newPath[currIndex] = curr;
|
|
63
|
-
|
|
90
|
+
var childField = getChildField();
|
|
91
|
+
|
|
92
|
+
if (_.isArray(curr[childField])) {
|
|
93
|
+
curr = curr[childField].length ? curr[childField][0] : null;
|
|
94
|
+
} else {
|
|
95
|
+
curr = curr[childField];
|
|
96
|
+
}
|
|
97
|
+
|
|
64
98
|
currIndex++;
|
|
65
99
|
}
|
|
66
100
|
|
|
@@ -70,8 +104,13 @@ var CascaderOverlay = function CascaderOverlay(props) {
|
|
|
70
104
|
|
|
71
105
|
function onCheck(data) {
|
|
72
106
|
var getVabelField = getFieldFactory(valueFields);
|
|
107
|
+
var getLabelField = getFieldFactory(labelFields);
|
|
73
108
|
var newValue = currentPath.map(function (item) {
|
|
74
|
-
|
|
109
|
+
var _ref;
|
|
110
|
+
|
|
111
|
+
var labelField = getLabelField();
|
|
112
|
+
var valueField = getVabelField();
|
|
113
|
+
return _ref = {}, _defineProperty(_ref, labelField, item[labelField]), _defineProperty(_ref, valueField, item[valueField]), _ref;
|
|
75
114
|
}).concat(data);
|
|
76
115
|
props.onChange([].concat(_toConsumableArray(currentValue), [newValue]));
|
|
77
116
|
}
|
|
@@ -85,30 +124,81 @@ var CascaderOverlay = function CascaderOverlay(props) {
|
|
|
85
124
|
props.onChange(newValues);
|
|
86
125
|
}
|
|
87
126
|
|
|
127
|
+
function onSearch(val) {
|
|
128
|
+
timer.current && clearTimeout(timer.current);
|
|
129
|
+
timer.current = setTimeout(function () {
|
|
130
|
+
var _labelFields$, _props$data;
|
|
131
|
+
|
|
132
|
+
var res = [];
|
|
133
|
+
var filter = filterFactory((_labelFields$ = labelFields[1]) !== null && _labelFields$ !== void 0 ? _labelFields$ : labelFields[0], val);
|
|
134
|
+
(_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.forEach(function (item) {
|
|
135
|
+
var searchList = item[childFields[0]].filter(filter);
|
|
136
|
+
|
|
137
|
+
if (searchList.length) {
|
|
138
|
+
res.push(_objectSpread(_objectSpread({}, item), {}, _defineProperty({}, childFields[0], item[childFields[0]].filter(filter))));
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
setData(res);
|
|
142
|
+
setCurrentPath(initPath(res));
|
|
143
|
+
setHighlightText(val);
|
|
144
|
+
}, 300);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function render() {
|
|
148
|
+
if (!data.length) return /*#__PURE__*/React.createElement("div", {
|
|
149
|
+
style: {
|
|
150
|
+
padding: 8,
|
|
151
|
+
width: 596
|
|
152
|
+
}
|
|
153
|
+
}, "\u6682\u65E0\u6570\u636E");
|
|
154
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
155
|
+
className: "".concat(classPrefix, "-overlay-groups")
|
|
156
|
+
}, /*#__PURE__*/React.createElement(Groups, {
|
|
157
|
+
key: 0,
|
|
158
|
+
currentValue: currentValue,
|
|
159
|
+
valueField: valueFields[0],
|
|
160
|
+
keyField: keyFields[0],
|
|
161
|
+
childField: childFields[0],
|
|
162
|
+
labelField: labelFields[0],
|
|
163
|
+
data: data,
|
|
164
|
+
onActive: onActive,
|
|
165
|
+
level: 0
|
|
166
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
167
|
+
className: "".concat(classPrefix, "-overlay-groups")
|
|
168
|
+
}, /*#__PURE__*/React.createElement(Groups, {
|
|
169
|
+
currentValue: currentValue,
|
|
170
|
+
valueField: valueFields[1],
|
|
171
|
+
keyField: keyFields[1],
|
|
172
|
+
childField: childFields[1],
|
|
173
|
+
labelField: labelFields[1],
|
|
174
|
+
data: currentPath[0] ? currentPath[0][childFields[0]] : [],
|
|
175
|
+
onActive: onActive,
|
|
176
|
+
highlightText: highlightText,
|
|
177
|
+
level: 1
|
|
178
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
179
|
+
className: "".concat(classPrefix, "-overlay-selections")
|
|
180
|
+
}, /*#__PURE__*/React.createElement(MultipleCheckPanel, {
|
|
181
|
+
valueField: valueFields[2],
|
|
182
|
+
onCheck: onCheck,
|
|
183
|
+
onUncheck: onUncheck,
|
|
184
|
+
currentValue: currentValue,
|
|
185
|
+
level: 2,
|
|
186
|
+
labelField: labelFields[2],
|
|
187
|
+
data: currentPath[1] ? currentPath[1][childFields[1]] : []
|
|
188
|
+
})));
|
|
189
|
+
}
|
|
190
|
+
|
|
88
191
|
return /*#__PURE__*/React.createElement("div", {
|
|
89
192
|
className: "".concat(classPrefix, "-overlay")
|
|
90
193
|
}, /*#__PURE__*/React.createElement("div", {
|
|
91
|
-
className: "".concat(classPrefix, "-overlay-
|
|
92
|
-
}, /*#__PURE__*/React.createElement(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
childField: childFields[0],
|
|
97
|
-
labelField: labelFields[0],
|
|
98
|
-
data: data,
|
|
99
|
-
onActive: onActive,
|
|
100
|
-
level: 0
|
|
194
|
+
className: "".concat(classPrefix, "-overlay-search")
|
|
195
|
+
}, /*#__PURE__*/React.createElement(Search, {
|
|
196
|
+
show: true,
|
|
197
|
+
onChange: onSearch,
|
|
198
|
+
placeholder: "\u641C\u7D22\u6807\u7B7E\u540D\u79F0"
|
|
101
199
|
})), /*#__PURE__*/React.createElement("div", {
|
|
102
|
-
className: "".concat(classPrefix, "-overlay-
|
|
103
|
-
},
|
|
104
|
-
valueField: valueFields[1],
|
|
105
|
-
onCheck: onCheck,
|
|
106
|
-
onUncheck: onUncheck,
|
|
107
|
-
currentValue: currentValue,
|
|
108
|
-
level: 1,
|
|
109
|
-
labelField: labelFields[1],
|
|
110
|
-
data: currentPath[0][childFields[0]]
|
|
111
|
-
})));
|
|
200
|
+
className: "".concat(classPrefix, "-overlay-panel")
|
|
201
|
+
}, render()));
|
|
112
202
|
};
|
|
113
203
|
|
|
114
204
|
export default CascaderOverlay;
|
|
@@ -18,11 +18,18 @@ var data = [{
|
|
|
18
18
|
}];
|
|
19
19
|
var defaultValue = [];
|
|
20
20
|
data.forEach(function (item) {
|
|
21
|
-
item.children = Array(
|
|
21
|
+
item.children = Array(10 * Math.random() >> 0).fill(1).map(function (_child, _index) {
|
|
22
22
|
var id = Math.random();
|
|
23
23
|
var tag = {
|
|
24
24
|
id: id,
|
|
25
|
-
labelName: '标签' + id + id + id + id
|
|
25
|
+
labelName: '标签' + id + id + id + id,
|
|
26
|
+
layers: Array(5 * Math.random() >> 0).fill(1).map(function (_item, i) {
|
|
27
|
+
var layer = {
|
|
28
|
+
layerLabelId: Math.random(),
|
|
29
|
+
layerLabelName: '分层' + i
|
|
30
|
+
};
|
|
31
|
+
return layer;
|
|
32
|
+
})
|
|
26
33
|
};
|
|
27
34
|
|
|
28
35
|
if (id < 0.6 && defaultValue.length < 20) {
|
|
@@ -38,11 +45,11 @@ export default (function () {
|
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
return /*#__PURE__*/React.createElement(BizUserTagsSelect, {
|
|
41
|
-
childFields: ['children'],
|
|
48
|
+
childFields: ['children', 'layers'],
|
|
42
49
|
data: data,
|
|
43
|
-
keyFields: ['labelGroup', 'id'],
|
|
44
|
-
labelFields: ['labelGroup', 'labelName'],
|
|
45
|
-
valueFields: ['labelGroup', '
|
|
50
|
+
keyFields: ['labelGroup', 'id', 'id'],
|
|
51
|
+
labelFields: ['labelGroup', 'labelName', 'layerLabelName'],
|
|
52
|
+
valueFields: ['labelGroup', 'labelName', 'id'],
|
|
46
53
|
onChange: onChange
|
|
47
54
|
});
|
|
48
55
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import { Badge } from 'antd';
|
|
3
3
|
import { classPrefix } from '..';
|
|
4
|
-
import theme from '../../assets/theme.js';
|
|
4
|
+
import { theme } from '../../assets/theme.js';
|
|
5
5
|
import './styles/option.less';
|
|
6
6
|
import { util } from '../../utils';
|
|
7
7
|
var GroupOption = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
|
|
1
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
4
|
|
|
3
5
|
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,7 +12,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
10
12
|
|
|
11
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
14
|
|
|
13
|
-
import React, { useMemo } from 'react';
|
|
15
|
+
import React, { useEffect, useMemo } from 'react';
|
|
14
16
|
import VirtualList from 'rc-virtual-list';
|
|
15
17
|
import { classPrefix } from '../';
|
|
16
18
|
import GroupOption from './groupOption';
|
|
@@ -33,11 +35,21 @@ var Groups = function Groups(props) {
|
|
|
33
35
|
searchValue = _useState2[0],
|
|
34
36
|
setSearchValue = _useState2[1];
|
|
35
37
|
|
|
36
|
-
var _useState3 = useState(data[0][valueField]),
|
|
38
|
+
var _useState3 = useState(data.length ? data[0][valueField] : null),
|
|
37
39
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
38
40
|
active = _useState4[0],
|
|
39
41
|
setActive = _useState4[1];
|
|
40
42
|
|
|
43
|
+
var searchFilter = useMemo(function () {
|
|
44
|
+
return filterFactory(labelField, searchValue);
|
|
45
|
+
}, [labelField, searchValue]);
|
|
46
|
+
var isChecked = useMemo(function () {
|
|
47
|
+
return isCheckedFactory(currentValue, level);
|
|
48
|
+
}, [currentValue, level]);
|
|
49
|
+
useEffect(function () {
|
|
50
|
+
if (data.length) setActive(data[0][valueField]);
|
|
51
|
+
}, [data]);
|
|
52
|
+
|
|
41
53
|
function _onClick(i) {
|
|
42
54
|
setActive(data[i][valueField]);
|
|
43
55
|
props.onActive(data[i], level);
|
|
@@ -47,12 +59,6 @@ var Groups = function Groups(props) {
|
|
|
47
59
|
setSearchValue(val);
|
|
48
60
|
}
|
|
49
61
|
|
|
50
|
-
var searchFilter = useMemo(function () {
|
|
51
|
-
return filterFactory(labelField, searchValue);
|
|
52
|
-
}, [labelField, searchValue]);
|
|
53
|
-
var isChecked = useMemo(function () {
|
|
54
|
-
return isCheckedFactory(currentValue, level);
|
|
55
|
-
}, [currentValue, level]);
|
|
56
62
|
if (!data.length) return /*#__PURE__*/React.createElement("span", null, "\u6682\u65E0\u6570\u636E");
|
|
57
63
|
return /*#__PURE__*/React.createElement("div", {
|
|
58
64
|
className: "".concat(classPrefix, "-groups-panel")
|
|
@@ -61,19 +67,21 @@ var Groups = function Groups(props) {
|
|
|
61
67
|
onChange: onSearch
|
|
62
68
|
}), /*#__PURE__*/React.createElement(VirtualList, {
|
|
63
69
|
data: searchable ? data.filter(searchFilter) : data,
|
|
64
|
-
height:
|
|
70
|
+
height: 360,
|
|
65
71
|
itemKey: keyField
|
|
66
72
|
}, function (item, index) {
|
|
73
|
+
var _isChecked, _props$highlightText;
|
|
74
|
+
|
|
67
75
|
return /*#__PURE__*/React.createElement(GroupOption, {
|
|
68
76
|
onClick: function onClick() {
|
|
69
77
|
return _onClick(index);
|
|
70
78
|
},
|
|
71
79
|
actived: item[valueField] === active,
|
|
72
|
-
checked: isChecked(item[valueField]),
|
|
80
|
+
checked: isChecked((_isChecked = {}, _defineProperty(_isChecked, valueField, item[valueField]), _defineProperty(_isChecked, labelField, item[labelField]), _isChecked)),
|
|
73
81
|
count: item[childField].length,
|
|
74
82
|
label: item[labelField],
|
|
75
83
|
value: item[valueField],
|
|
76
|
-
highlightText: searchValue
|
|
84
|
+
highlightText: (_props$highlightText = props.highlightText) !== null && _props$highlightText !== void 0 ? _props$highlightText : searchValue
|
|
77
85
|
});
|
|
78
86
|
}));
|
|
79
87
|
};
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
&.active {
|
|
40
|
-
color: #fff;
|
|
40
|
+
color: #fff !important;
|
|
41
41
|
background: @primary-color;
|
|
42
42
|
.biz-user-tags-selector-group-option-count {
|
|
43
43
|
.ant-badge-count {
|
|
@@ -45,6 +45,11 @@
|
|
|
45
45
|
background: @primary-color;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
+
.biz-user-tags-selector-group-option-label {
|
|
49
|
+
* {
|
|
50
|
+
color: #fff !important;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
48
53
|
}
|
|
49
54
|
}
|
|
50
55
|
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
1
7
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
8
|
|
|
3
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."); }
|
|
@@ -40,7 +46,14 @@ var UserTagsSelect = function UserTagsSelect(props) {
|
|
|
40
46
|
|
|
41
47
|
var handleValue = useMemo(function () {
|
|
42
48
|
return currentValue.map(function (item) {
|
|
43
|
-
|
|
49
|
+
var last = item[item.length - 1];
|
|
50
|
+
var pre = item[item.length - 2];
|
|
51
|
+
|
|
52
|
+
var res = _objectSpread(_objectSpread({}, last), {}, {
|
|
53
|
+
handleText: "".concat(pre[labelFields[labelFields.length - 2]], "\uFF1A").concat(last[labelFields[labelFields.length - 1]])
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return res;
|
|
44
57
|
});
|
|
45
58
|
}, [currentValue]);
|
|
46
59
|
|
|
@@ -51,7 +64,8 @@ var UserTagsSelect = function UserTagsSelect(props) {
|
|
|
51
64
|
function onDelete(data) {
|
|
52
65
|
var current = currentValue.slice();
|
|
53
66
|
var index = current.findIndex(function (item) {
|
|
54
|
-
|
|
67
|
+
var keyField = keyFields[keyFields.length - 1];
|
|
68
|
+
return _.isEqual(item.slice().pop()[keyField], data[keyField]);
|
|
55
69
|
});
|
|
56
70
|
current.splice(index, 1);
|
|
57
71
|
props.onChange && props.onChange(current);
|
|
@@ -97,7 +111,7 @@ var UserTagsSelect = function UserTagsSelect(props) {
|
|
|
97
111
|
}, /*#__PURE__*/React.createElement(SelectHandle, {
|
|
98
112
|
border: false,
|
|
99
113
|
value: handleValue,
|
|
100
|
-
labelField:
|
|
114
|
+
labelField: "handleText",
|
|
101
115
|
multiple: true,
|
|
102
116
|
size: "middle",
|
|
103
117
|
placeholder: "\u9009\u62E9\u6807\u7B7E",
|
|
@@ -13,7 +13,6 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
13
13
|
import React, { useMemo, useState } from 'react';
|
|
14
14
|
import { classPrefix } from '..';
|
|
15
15
|
import VirtualList from 'rc-virtual-list';
|
|
16
|
-
import Search from '../components/search';
|
|
17
16
|
import CheckOption from './checkOption';
|
|
18
17
|
import { filterFactory, isCheckedFactory } from '../util';
|
|
19
18
|
|
|
@@ -24,13 +23,8 @@ var MultipleCheckPanel = function MultipleCheckPanel(props) {
|
|
|
24
23
|
currentValue = props.currentValue;
|
|
25
24
|
|
|
26
25
|
var _useState = useState(''),
|
|
27
|
-
_useState2 = _slicedToArray(_useState,
|
|
28
|
-
searchValue = _useState2[0]
|
|
29
|
-
setSearchValue = _useState2[1];
|
|
30
|
-
|
|
31
|
-
function onSearch(val) {
|
|
32
|
-
setSearchValue(val);
|
|
33
|
-
}
|
|
26
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
27
|
+
searchValue = _useState2[0];
|
|
34
28
|
|
|
35
29
|
var searchFilter = useMemo(function () {
|
|
36
30
|
return filterFactory(labelField, searchValue);
|
|
@@ -50,15 +44,11 @@ var MultipleCheckPanel = function MultipleCheckPanel(props) {
|
|
|
50
44
|
if (!data.length) return /*#__PURE__*/React.createElement("span", null, "\u6682\u65E0\u6570\u636E");
|
|
51
45
|
return /*#__PURE__*/React.createElement("div", {
|
|
52
46
|
className: "".concat(classPrefix, "-check-panel")
|
|
53
|
-
}, /*#__PURE__*/React.createElement(
|
|
54
|
-
show: true,
|
|
55
|
-
onChange: onSearch,
|
|
56
|
-
placeholder: "\u641C\u7D22\u6807\u7B7E\u540D\u79F0"
|
|
57
|
-
}), /*#__PURE__*/React.createElement(VirtualList, {
|
|
47
|
+
}, /*#__PURE__*/React.createElement(VirtualList, {
|
|
58
48
|
data: data.filter(searchFilter),
|
|
59
49
|
itemHeight: 48,
|
|
60
50
|
itemKey: labelField,
|
|
61
|
-
height:
|
|
51
|
+
height: 360
|
|
62
52
|
}, function (item, index) {
|
|
63
53
|
var checked = isChecked(item);
|
|
64
54
|
return /*#__PURE__*/React.createElement(CheckOption, {
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
@import '../../assets/styles/inner.less';
|
|
2
2
|
.biz-user-tags-selector {
|
|
3
3
|
&-overlay {
|
|
4
|
-
display: flex;
|
|
5
|
-
width: 651px;
|
|
6
4
|
max-height: 425px;
|
|
7
5
|
background-color: #fff;
|
|
8
6
|
border-radius: @border-radius-normal;
|
|
9
7
|
box-shadow: @box-shadow-base;
|
|
8
|
+
&-search {
|
|
9
|
+
height: 48px;
|
|
10
|
+
padding: @margin-xs @margin-xs 0;
|
|
11
|
+
}
|
|
12
|
+
&-panel {
|
|
13
|
+
display: flex;
|
|
14
|
+
}
|
|
10
15
|
&-groups {
|
|
11
|
-
width:
|
|
16
|
+
width: 204px;
|
|
12
17
|
padding: @margin-xs;
|
|
13
18
|
border-right: 1px solid @border-color-base;
|
|
14
19
|
}
|
|
15
20
|
&-selections {
|
|
16
|
-
|
|
21
|
+
width: 204px;
|
|
17
22
|
min-width: 0;
|
|
18
23
|
padding: @padding-xs;
|
|
19
24
|
}
|
|
@@ -29,6 +29,7 @@ export declare namespace UserTagsSelectorTypes {
|
|
|
29
29
|
searchable?: boolean;
|
|
30
30
|
level: number;
|
|
31
31
|
currentValue: any[];
|
|
32
|
+
highlightText?: string;
|
|
32
33
|
}
|
|
33
34
|
interface GroupOption {
|
|
34
35
|
actived: boolean;
|
|
@@ -55,13 +56,3 @@ export declare namespace UserTagsSelectorTypes {
|
|
|
55
56
|
disabled: boolean;
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
|
-
export interface TagI {
|
|
59
|
-
appId: number;
|
|
60
|
-
createTime: string;
|
|
61
|
-
updateTime: string;
|
|
62
|
-
del: number;
|
|
63
|
-
labelGroup: string;
|
|
64
|
-
labelId: number;
|
|
65
|
-
labelName: string;
|
|
66
|
-
labelStatus: number;
|
|
67
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.0.24-
|
|
3
|
+
"version": "1.0.24-tags4.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"react": "^16.12.0 || ^17.0.0",
|
|
59
59
|
"yorkie": "^2.0.0"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "20ecccabf92786b84ed14a56dd75d8ac2fdea6b2"
|
|
62
62
|
}
|