@zgfe/business-lib 1.0.14 → 1.0.15-user.1
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/assets/styles/chunks.less +3 -4
- package/es/assets/styles/resetAntd.less +36 -1
- package/es/attrConditions/components/operateList.d.ts +1 -0
- package/es/attrConditions/components/operateList.js +2 -2
- package/es/attrConditions/components/stringList.d.ts +1 -0
- package/es/attrConditions/components/stringList.js +2 -2
- package/es/attrConditions/components/valuesList.d.ts +1 -0
- package/es/attrConditions/components/valuesList.js +5 -4
- package/es/attrConditions/demo/index.js +7 -8
- package/es/attrConditions/index.js +14 -4
- package/es/attrConditions/styles/index.less +3 -2
- package/es/attrConditions/types.d.ts +3 -0
- package/es/attrConditions/utils/operates.js +2 -2
- package/es/attributeSelector/index.js +8 -4
- package/es/attributeSelector/listPanel.js +32 -19
- package/es/attributeSelector/styles/index.less +3 -3
- package/es/attributeSelector/types.d.ts +7 -0
- package/es/attributeSelector/types.js +8 -1
- package/es/attributeSelector/util.js +3 -2
- package/es/eventSelector/demo/index.js +11 -2
- package/es/eventSelector/index.js +40 -7
- package/es/eventSelector/listPanel.js +37 -22
- package/es/eventSelector/styles/index.less +5 -3
- package/es/eventSelector/types.d.ts +7 -1
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/mock/event.js +214 -0
- package/es/select/demo/children.d.ts +2 -0
- package/es/select/demo/children.js +81 -0
- package/es/select/demo/index.js +10 -4
- package/es/select/demo/multiple.js +10 -3
- package/es/select/handle.js +4 -2
- package/es/select/index.d.ts +2 -2
- package/es/select/index.js +14 -7
- package/es/select/overlay.js +1 -1
- package/es/select/styles/handle.less +22 -13
- package/es/select/types.d.ts +3 -1
- package/es/userCondition/conditionTypeList.js +14 -3
- package/es/userCondition/conditionWrap.js +4 -2
- package/es/userCondition/conditions/constants.d.ts +21 -0
- package/es/userCondition/conditions/constants.js +21 -0
- package/es/userCondition/conditions/eventCondition.js +13 -4
- package/es/userCondition/conditions/periodCondition.js +20 -10
- package/es/userCondition/conditions/propCondition.js +28 -8
- package/es/userCondition/conditions/runTimesCondition.js +2 -2
- package/es/userCondition/conditions/styles/eventCondition.less +7 -5
- package/es/userCondition/conditions/styles/propCondition.less +3 -3
- package/es/userCondition/conditions/styles/tagsCondition.less +18 -0
- package/es/userCondition/conditions/styles/textDesc.less +17 -0
- package/es/userCondition/conditions/tagsCondition.d.ts +9 -0
- package/es/userCondition/conditions/tagsCondition.js +107 -0
- package/es/userCondition/conditions/textDesc.d.ts +9 -0
- package/es/userCondition/conditions/textDesc.js +197 -0
- package/es/userCondition/demo/index.js +200 -31
- package/es/userCondition/index.d.ts +1 -1
- package/es/userCondition/index.js +31 -10
- package/es/userCondition/orConditions.js +64 -17
- package/es/userCondition/relationLabel.js +6 -1
- package/es/userCondition/styles/conditionTypeList.less +1 -1
- package/es/userCondition/styles/conditionWrap.less +3 -0
- package/es/userCondition/styles/index.less +19 -0
- package/es/userCondition/styles/orConditions.less +13 -0
- package/es/userCondition/types.d.ts +21 -2
- package/es/userCondition/util.d.ts +5 -1
- package/es/userCondition/util.js +42 -0
- package/es/userTagsSelector/cascaderOverlay.d.ts +5 -0
- package/es/userTagsSelector/cascaderOverlay.js +114 -0
- package/es/userTagsSelector/components/search/index.d.ts +8 -0
- package/es/userTagsSelector/components/search/index.js +16 -0
- package/es/userTagsSelector/components/search/index.less +6 -0
- package/es/userTagsSelector/context.d.ts +3 -0
- package/es/userTagsSelector/context.js +2 -0
- package/es/userTagsSelector/demo/index.d.ts +2 -0
- package/es/userTagsSelector/demo/index.js +48 -0
- package/es/userTagsSelector/groups/groupOption.d.ts +5 -0
- package/es/userTagsSelector/groups/groupOption.js +42 -0
- package/es/userTagsSelector/groups/index.d.ts +4 -0
- package/es/userTagsSelector/groups/index.js +86 -0
- package/es/userTagsSelector/groups/styles/index.less +0 -0
- package/es/userTagsSelector/groups/styles/option.less +50 -0
- package/es/userTagsSelector/index.d.ts +6 -0
- package/es/userTagsSelector/index.js +110 -0
- package/es/userTagsSelector/multipleCheckPanel/checkOption.d.ts +5 -0
- package/es/userTagsSelector/multipleCheckPanel/checkOption.js +45 -0
- package/es/userTagsSelector/multipleCheckPanel/index.d.ts +4 -0
- package/es/userTagsSelector/multipleCheckPanel/index.js +80 -0
- package/es/userTagsSelector/multipleCheckPanel/styles/index.less +0 -0
- package/es/userTagsSelector/multipleCheckPanel/styles/option.less +39 -0
- package/es/userTagsSelector/styles/cascaderOverlay.less +27 -0
- package/es/userTagsSelector/styles/index.less +10 -0
- package/es/userTagsSelector/types.d.ts +67 -0
- package/es/userTagsSelector/types.js +1 -0
- package/es/userTagsSelector/util.d.ts +4 -0
- package/es/userTagsSelector/util.js +38 -0
- package/es/utils/type.d.ts +2 -2
- package/package.json +4 -2
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import React, { useContext, useMemo } from 'react';
|
|
2
|
+
import { BizUserConditionContext, classPrefix } from '..';
|
|
3
|
+
import BizGlobalDataContext from '../../context';
|
|
4
|
+
import { findEvent, findPropAndEnv, findTagFactory } from '../util';
|
|
5
|
+
import { operatorMap } from './constants';
|
|
6
|
+
import './styles/textDesc.less';
|
|
7
|
+
|
|
8
|
+
var Text = function Text(props) {
|
|
9
|
+
var condition = props.condition,
|
|
10
|
+
showOrDesc = props.showOrDesc;
|
|
11
|
+
|
|
12
|
+
var _useContext = useContext(BizGlobalDataContext),
|
|
13
|
+
eventGroupList = _useContext.eventGroupList,
|
|
14
|
+
userPropList = _useContext.userPropList,
|
|
15
|
+
eventEnvList = _useContext.eventEnvList;
|
|
16
|
+
|
|
17
|
+
var _useContext2 = useContext(BizUserConditionContext),
|
|
18
|
+
userTagsData = _useContext2.userTagsData;
|
|
19
|
+
|
|
20
|
+
function render() {
|
|
21
|
+
if (condition.labels) {
|
|
22
|
+
return renderTags(condition);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (condition.eventId === '-4') {
|
|
26
|
+
return renderPeriod({
|
|
27
|
+
before: '活跃于'
|
|
28
|
+
}, condition.runPeriod);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (condition.eventId === '-3') {
|
|
32
|
+
return renderPeriod({
|
|
33
|
+
before: '新增于'
|
|
34
|
+
}, condition.runPeriod);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (condition.eventId === undefined) {
|
|
38
|
+
return renderProps(condition.attrs[0], 'user');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (condition.eventId) {
|
|
42
|
+
return renderEvent(condition);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function renderPeriod(label, period, isEvent) {
|
|
47
|
+
var _label$after;
|
|
48
|
+
|
|
49
|
+
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 : '天'));
|
|
50
|
+
|
|
51
|
+
if (period.operator === 'unlimited_time') {
|
|
52
|
+
return /*#__PURE__*/React.createElement("span", null, "\u5728\u4EFB\u610F\u65F6\u95F4\u5185");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (period.operator === 'absolute') {
|
|
56
|
+
valuesDom = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
57
|
+
className: "".concat(classPrefix, "-text-desc-value")
|
|
58
|
+
}, period.values[0]), /*#__PURE__*/React.createElement("span", null, "\u5230"), /*#__PURE__*/React.createElement("span", {
|
|
59
|
+
className: "".concat(classPrefix, "-text-desc-value")
|
|
60
|
+
}, period.values[1]));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
64
|
+
style: !isEvent ? {
|
|
65
|
+
backgroundColor: '#effcff',
|
|
66
|
+
padding: '6px 7px'
|
|
67
|
+
} : {}
|
|
68
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
69
|
+
className: "label"
|
|
70
|
+
}, label.before), /*#__PURE__*/React.createElement("span", null, operatorMap[period.operator]), valuesDom);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function renderProps(attr, type) {
|
|
74
|
+
var data = null;
|
|
75
|
+
|
|
76
|
+
if (type === 'user') {
|
|
77
|
+
var _data;
|
|
78
|
+
|
|
79
|
+
data = findPropAndEnv(attr.attrName, userPropList !== null && userPropList !== void 0 ? userPropList : []);
|
|
80
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
81
|
+
style: {
|
|
82
|
+
backgroundColor: '#effcff',
|
|
83
|
+
padding: '6px 7px'
|
|
84
|
+
}
|
|
85
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
86
|
+
className: "".concat(classPrefix, "-text-desc-label")
|
|
87
|
+
}, (_data = data) === null || _data === void 0 ? void 0 : _data.label), /*#__PURE__*/React.createElement("span", {
|
|
88
|
+
className: "".concat(classPrefix, "-text-desc-operator")
|
|
89
|
+
}, operatorMap[attr.operator]), /*#__PURE__*/React.createElement("span", {
|
|
90
|
+
className: "".concat(classPrefix, "-text-desc-value")
|
|
91
|
+
}, attr.params.map(function (param, i) {
|
|
92
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, i > 0 ? /*#__PURE__*/React.createElement("span", null, "\u6216") : null, /*#__PURE__*/React.createElement("span", null, param));
|
|
93
|
+
})));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function renderEvent(condition) {
|
|
98
|
+
var event = findEvent(condition.eventId, eventGroupList !== null && eventGroupList !== void 0 ? eventGroupList : []);
|
|
99
|
+
if (!event) return null;
|
|
100
|
+
var periodLabel = {};
|
|
101
|
+
|
|
102
|
+
if (condition.runPeriod.operator === 'join_time') {
|
|
103
|
+
periodLabel.before = '在新增后';
|
|
104
|
+
periodLabel.after = '天内';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (condition.runPeriod.operator === 'relative' || condition.runPeriod.operator === 'absolute') {
|
|
108
|
+
periodLabel.before = '在';
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
var period = renderPeriod(periodLabel, condition.runPeriod, true);
|
|
112
|
+
var runtimes = renderRuntimes(condition.runTimes);
|
|
113
|
+
var attrs = renderAttrs(event, condition.attrs);
|
|
114
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
115
|
+
style: {
|
|
116
|
+
backgroundColor: '#fffeeb',
|
|
117
|
+
padding: '6px 7px'
|
|
118
|
+
}
|
|
119
|
+
}, period, /*#__PURE__*/React.createElement("span", {
|
|
120
|
+
className: "".concat(classPrefix, "-text-desc-value")
|
|
121
|
+
}, event.name), attrs, runtimes);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function renderAttrs(event, attrs) {
|
|
125
|
+
var attrsDom = [];
|
|
126
|
+
attrs.forEach(function (attr, i) {
|
|
127
|
+
var index = event.attrList.findIndex(function (item) {
|
|
128
|
+
return item.id === attr.attrId;
|
|
129
|
+
});
|
|
130
|
+
var label = '';
|
|
131
|
+
|
|
132
|
+
if (index >= 0) {
|
|
133
|
+
label = event === null || event === void 0 ? void 0 : event.attrList[index].label;
|
|
134
|
+
} else if (eventEnvList) {
|
|
135
|
+
var env = findPropAndEnv(attr.attrName, eventEnvList);
|
|
136
|
+
label = env ? env.label : '';
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (label) {
|
|
140
|
+
var dom = /*#__PURE__*/React.createElement("span", {
|
|
141
|
+
key: i
|
|
142
|
+
}, /*#__PURE__*/React.createElement("span", null, label), /*#__PURE__*/React.createElement("span", null, operatorMap[attr.operator]), /*#__PURE__*/React.createElement("span", null, attr.params.map(function (param, i) {
|
|
143
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
144
|
+
key: i
|
|
145
|
+
}, i > 0 ? '或' : '', param);
|
|
146
|
+
})), /*#__PURE__*/React.createElement("span", null, i !== attrs.length - 1 ? ',' : ''));
|
|
147
|
+
attrsDom.push(dom);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
if (!attrsDom.length) return null;
|
|
151
|
+
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", null, "\uFF08"), attrsDom, /*#__PURE__*/React.createElement("span", null, "\uFF09"));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function renderRuntimes(runTimes) {
|
|
155
|
+
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", {
|
|
156
|
+
className: "".concat(classPrefix, "-text-desc-value")
|
|
157
|
+
}, "\u6B21\u6570"), /*#__PURE__*/React.createElement("span", {
|
|
158
|
+
className: "".concat(classPrefix, "-text-desc-value")
|
|
159
|
+
}, runTimes.operator), /*#__PURE__*/React.createElement("span", {
|
|
160
|
+
className: "".concat(classPrefix, "-text-desc-value")
|
|
161
|
+
}, runTimes.values[0]));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function renderTags(condition) {
|
|
165
|
+
var labels = condition.labels;
|
|
166
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
167
|
+
style: {
|
|
168
|
+
backgroundColor: '#effcff',
|
|
169
|
+
padding: '6px 7px'
|
|
170
|
+
}
|
|
171
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
172
|
+
className: "label"
|
|
173
|
+
}, /*#__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", {
|
|
174
|
+
className: "".concat(classPrefix, "-text-desc-value")
|
|
175
|
+
}, /*#__PURE__*/React.createElement("span", null, "("), labels.values.map(function (id, index) {
|
|
176
|
+
var tag = findTag(id);
|
|
177
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
178
|
+
key: id
|
|
179
|
+
}, index >= 1 ? /*#__PURE__*/React.createElement("span", {
|
|
180
|
+
style: {
|
|
181
|
+
margin: '0 4px'
|
|
182
|
+
}
|
|
183
|
+
}, "\u6216") : null, /*#__PURE__*/React.createElement("span", null, tag && tag.labelName));
|
|
184
|
+
}), /*#__PURE__*/React.createElement("span", null, ")")));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
var findTag = useMemo(function () {
|
|
188
|
+
return findTagFactory(userTagsData);
|
|
189
|
+
}, [userTagsData]);
|
|
190
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
191
|
+
className: "".concat(classPrefix, "-text-desc")
|
|
192
|
+
}, showOrDesc ? /*#__PURE__*/React.createElement("span", {
|
|
193
|
+
className: "".concat(classPrefix, "-text-desc-or")
|
|
194
|
+
}, "\u6216\u8005") : null, render());
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export default Text;
|
|
@@ -10,11 +10,162 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
10
10
|
|
|
11
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
12
|
|
|
13
|
-
import React, { useEffect, useState } from 'react';
|
|
13
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
14
14
|
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
|
+
var getTagList = Promise.resolve([{
|
|
19
|
+
appId: 51,
|
|
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
|
+
attrs: [],
|
|
154
|
+
labels: {
|
|
155
|
+
operator: 'equal',
|
|
156
|
+
values: [77388914425856, 77383474429952, 77384417755136]
|
|
157
|
+
}
|
|
158
|
+
}], [{
|
|
159
|
+
attrs: [{
|
|
160
|
+
attrId: 114,
|
|
161
|
+
attrName: 'name',
|
|
162
|
+
category: 'custom',
|
|
163
|
+
operator: 'equal',
|
|
164
|
+
params: ['Safari', 'Microsoft Edge'],
|
|
165
|
+
attrType: 'cont-string'
|
|
166
|
+
}]
|
|
167
|
+
}]]
|
|
168
|
+
};
|
|
18
169
|
export default (function () {
|
|
19
170
|
var _useState = useState({
|
|
20
171
|
eventGroupList: [],
|
|
@@ -24,6 +175,11 @@ export default (function () {
|
|
|
24
175
|
_useState2 = _slicedToArray(_useState, 2),
|
|
25
176
|
setStore = _useState2[1];
|
|
26
177
|
|
|
178
|
+
var _useState3 = useState([]),
|
|
179
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
180
|
+
userTagsData = _useState4[0],
|
|
181
|
+
setUserTagsData = _useState4[1];
|
|
182
|
+
|
|
27
183
|
var newStore = convertAttributeData({
|
|
28
184
|
eventList: eventData,
|
|
29
185
|
userPropList: userData,
|
|
@@ -32,42 +188,55 @@ export default (function () {
|
|
|
32
188
|
useEffect(function () {
|
|
33
189
|
setStore(newStore);
|
|
34
190
|
}, []);
|
|
191
|
+
useEffect(function () {
|
|
192
|
+
var tagsMap = {};
|
|
193
|
+
getTagList.then(function (list) {
|
|
194
|
+
var data = [];
|
|
195
|
+
list.forEach(function (item) {
|
|
196
|
+
var labelGroup = item.labelGroup;
|
|
197
|
+
|
|
198
|
+
if (tagsMap[labelGroup]) {
|
|
199
|
+
tagsMap[labelGroup].push(item);
|
|
200
|
+
} else {
|
|
201
|
+
tagsMap[labelGroup] = [item];
|
|
202
|
+
data.push({
|
|
203
|
+
labelGroup: labelGroup,
|
|
204
|
+
children: tagsMap[labelGroup]
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
setUserTagsData(data);
|
|
209
|
+
});
|
|
210
|
+
}, []);
|
|
211
|
+
var defaultValue = useMemo(function () {
|
|
212
|
+
return data.json;
|
|
213
|
+
}, [data]);
|
|
35
214
|
|
|
36
|
-
function onChange(
|
|
37
|
-
console.log(JSON.stringify(
|
|
215
|
+
function onChange(value) {
|
|
216
|
+
console.log(JSON.stringify(value));
|
|
38
217
|
}
|
|
39
218
|
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
operator: '=',
|
|
49
|
-
params: ['Apple WebKit', 'Unknown'],
|
|
50
|
-
attrType: 'cont-string'
|
|
51
|
-
}, {
|
|
52
|
-
attrId: 5461057,
|
|
53
|
-
operator: '>',
|
|
54
|
-
params: ['123'],
|
|
55
|
-
attrType: 'cont-num'
|
|
56
|
-
}],
|
|
57
|
-
runPeriod: {
|
|
58
|
-
operator: 'relative',
|
|
59
|
-
values: ['30', '0']
|
|
60
|
-
}
|
|
61
|
-
}]];
|
|
219
|
+
var descDom = /*#__PURE__*/React.createElement(BizUserCondition, {
|
|
220
|
+
defaultValue: defaultValue,
|
|
221
|
+
onChange: onChange,
|
|
222
|
+
eventAttrNum: 3,
|
|
223
|
+
openTagCondition: true,
|
|
224
|
+
userTagsData: userTagsData,
|
|
225
|
+
isRealTime: true
|
|
226
|
+
});
|
|
62
227
|
return /*#__PURE__*/React.createElement(BizGlobalDataContext.Provider, {
|
|
63
228
|
value: {
|
|
64
229
|
eventGroupList: newStore.eventGroupList,
|
|
65
230
|
userPropList: newStore.userPropList,
|
|
66
|
-
eventEnvList: newStore.envPropList
|
|
231
|
+
eventEnvList: newStore.envPropList,
|
|
232
|
+
currentApp: {
|
|
233
|
+
appId: 160,
|
|
234
|
+
platform: 0
|
|
235
|
+
}
|
|
67
236
|
}
|
|
68
|
-
}, /*#__PURE__*/React.createElement(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}));
|
|
237
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
238
|
+
style: {
|
|
239
|
+
display: 'inline-block'
|
|
240
|
+
}
|
|
241
|
+
}, descDom));
|
|
73
242
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BizUserConditionT } from './types';
|
|
3
3
|
import './styles/index.less';
|
|
4
|
-
export declare const BizUserConditionContext: React.Context<Pick<BizUserConditionT.PropsI, "
|
|
4
|
+
export declare const BizUserConditionContext: React.Context<Pick<BizUserConditionT.PropsI, "textMode" | "openTagCondition" | "orConditionNum" | "eventAttrNum" | "userTagsData" | "isRealTime">>;
|
|
5
5
|
export declare const classPrefix = "biz-user-condition";
|
|
6
6
|
declare const BizUserCondition: React.FC<BizUserConditionT.PropsI>;
|
|
7
7
|
export default BizUserCondition;
|
|
@@ -24,15 +24,21 @@ import RelationLabel from './relationLabel';
|
|
|
24
24
|
import OrConditions from './orConditions';
|
|
25
25
|
import './styles/index.less';
|
|
26
26
|
import { buildCondition } from './util';
|
|
27
|
+
import _ from 'lodash';
|
|
27
28
|
export var BizUserConditionContext = /*#__PURE__*/createContext({
|
|
28
29
|
orConditionNum: 2,
|
|
29
|
-
eventAttrNum: 1
|
|
30
|
+
eventAttrNum: 1,
|
|
31
|
+
textMode: false,
|
|
32
|
+
openTagCondition: false,
|
|
33
|
+
userTagsData: []
|
|
30
34
|
});
|
|
31
35
|
export var classPrefix = 'biz-user-condition';
|
|
32
36
|
|
|
33
37
|
var BizUserCondition = function BizUserCondition(props) {
|
|
34
38
|
var andConditionNum = props.andConditionNum,
|
|
35
|
-
defaultValue = props.defaultValue
|
|
39
|
+
defaultValue = props.defaultValue,
|
|
40
|
+
openTagCondition = props.openTagCondition,
|
|
41
|
+
userTagsData = props.userTagsData;
|
|
36
42
|
|
|
37
43
|
var _useState = useState([]),
|
|
38
44
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -44,7 +50,13 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
44
50
|
dataList = _useState4[0],
|
|
45
51
|
setDataList = _useState4[1];
|
|
46
52
|
|
|
47
|
-
var _useState5 = useState(
|
|
53
|
+
var _useState5 = useState(function () {
|
|
54
|
+
if (defaultValue) {
|
|
55
|
+
return _.cloneDeep(defaultValue);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return [];
|
|
59
|
+
}),
|
|
48
60
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
49
61
|
value = _useState6[0],
|
|
50
62
|
setValue = _useState6[1];
|
|
@@ -55,7 +67,7 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
55
67
|
|
|
56
68
|
function initShowList() {
|
|
57
69
|
var showList = [];
|
|
58
|
-
|
|
70
|
+
value.forEach(function (item) {
|
|
59
71
|
showList.push({
|
|
60
72
|
id: Math.random(),
|
|
61
73
|
orConditions: item
|
|
@@ -112,7 +124,11 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
112
124
|
return /*#__PURE__*/React.createElement(BizUserConditionContext.Provider, {
|
|
113
125
|
value: {
|
|
114
126
|
orConditionNum: props.orConditionNum || 2,
|
|
115
|
-
eventAttrNum: props.eventAttrNum || 1
|
|
127
|
+
eventAttrNum: props.eventAttrNum || 1,
|
|
128
|
+
textMode: props.textMode,
|
|
129
|
+
openTagCondition: openTagCondition,
|
|
130
|
+
userTagsData: userTagsData !== null && userTagsData !== void 0 ? userTagsData : [],
|
|
131
|
+
isRealTime: props.isRealTime
|
|
116
132
|
}
|
|
117
133
|
}, /*#__PURE__*/React.createElement("div", {
|
|
118
134
|
className: classPrefix
|
|
@@ -121,15 +137,16 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
121
137
|
}, /*#__PURE__*/React.createElement(RelationLabel, {
|
|
122
138
|
show: value.length >= 2
|
|
123
139
|
}, "\u4E14"), showList.length ? /*#__PURE__*/React.createElement("div", {
|
|
124
|
-
className: "".concat(classPrefix, "-and-conditions-wrap")
|
|
125
|
-
}, showList.map(function (item) {
|
|
126
|
-
return /*#__PURE__*/React.createElement(OrConditions, {
|
|
140
|
+
className: ["".concat(classPrefix, "-and-conditions-wrap"), props.textMode ? 'text-mode' : ''].join(' ')
|
|
141
|
+
}, showList.map(function (item, i) {
|
|
142
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(OrConditions, {
|
|
143
|
+
showAndDesc: i > 0,
|
|
127
144
|
orConditions: item.orConditions,
|
|
128
145
|
key: item.id,
|
|
129
146
|
onChange: function onChange(data) {
|
|
130
147
|
_onChange(item.id, data);
|
|
131
148
|
}
|
|
132
|
-
});
|
|
149
|
+
}));
|
|
133
150
|
})) : null), /*#__PURE__*/React.createElement(ConditionTypeList, {
|
|
134
151
|
show: value.length < andConditionNum,
|
|
135
152
|
label: "\u4E14",
|
|
@@ -138,6 +155,10 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
138
155
|
};
|
|
139
156
|
|
|
140
157
|
BizUserCondition.defaultProps = {
|
|
141
|
-
andConditionNum: 5
|
|
158
|
+
andConditionNum: 5,
|
|
159
|
+
textMode: false,
|
|
160
|
+
openTagCondition: false,
|
|
161
|
+
userTagsData: [],
|
|
162
|
+
isRealTime: false
|
|
142
163
|
};
|
|
143
164
|
export default BizUserCondition;
|