@zgfe/business-lib 1.0.30-user.1 → 1.0.30-user.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/userCondition/conditionTypeList.js +1 -1
- package/es/userCondition/conditions/cdpCondition.js +49 -24
- package/es/userCondition/demo/mockData.d.ts +2 -13
- package/es/userCondition/demo/mockData.js +4 -35
- package/es/userCondition/index.js +18 -4
- package/es/userCondition/types.d.ts +6 -3
- package/es/userCondition/types.js +6 -3
- package/package.json +2 -2
|
@@ -62,7 +62,7 @@ var ConditionTypeList = function ConditionTypeList(props) {
|
|
|
62
62
|
onClick: function onClick() {
|
|
63
63
|
return onAdd('tag');
|
|
64
64
|
}
|
|
65
|
-
}, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u7528\u6237\u6807\u7B7E"))) : null, openCdpCondition && (!menuNameMap || menuNameMap['
|
|
65
|
+
}, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u7528\u6237\u6807\u7B7E"))) : null, openCdpCondition && (!menuNameMap || menuNameMap['dataset']) ? /*#__PURE__*/React.createElement("li", {
|
|
66
66
|
className: "condition-type",
|
|
67
67
|
onClick: function onClick() {
|
|
68
68
|
return onAdd('cdp');
|
|
@@ -52,30 +52,35 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
52
52
|
dataset = _useState2[0],
|
|
53
53
|
setDataset = _useState2[1];
|
|
54
54
|
|
|
55
|
-
var _useState3 = useState(),
|
|
55
|
+
var _useState3 = useState(false),
|
|
56
56
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
loading = _useState4[0],
|
|
58
|
+
setLoading = _useState4[1];
|
|
59
59
|
|
|
60
60
|
var _useState5 = useState(),
|
|
61
61
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
field = _useState6[0],
|
|
63
|
+
setField = _useState6[1];
|
|
64
64
|
|
|
65
65
|
var _useState7 = useState(),
|
|
66
66
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
operator = _useState8[0],
|
|
68
|
+
setOperator = _useState8[1];
|
|
69
69
|
|
|
70
|
-
var _useState9 = useState(
|
|
70
|
+
var _useState9 = useState(),
|
|
71
71
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
fieldValue = _useState10[0],
|
|
73
|
+
setFieldValue = _useState10[1];
|
|
74
74
|
|
|
75
|
-
var _useState11 = useState(
|
|
75
|
+
var _useState11 = useState([]),
|
|
76
76
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
fieldList = _useState12[0],
|
|
78
|
+
setFieldList = _useState12[1];
|
|
79
|
+
|
|
80
|
+
var _useState13 = useState(true),
|
|
81
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
82
|
+
isFirst = _useState14[0],
|
|
83
|
+
setIsFirst = _useState14[1];
|
|
79
84
|
|
|
80
85
|
useEffect(function () {
|
|
81
86
|
if (!props.value) {
|
|
@@ -122,7 +127,7 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
122
127
|
fieldName: field === null || field === void 0 ? void 0 : field.name,
|
|
123
128
|
fieldType: field === null || field === void 0 ? void 0 : field.type,
|
|
124
129
|
webType: field === null || field === void 0 ? void 0 : field.webType,
|
|
125
|
-
paramType: field === null || field === void 0 ? void 0 : field.webType,
|
|
130
|
+
paramType: getType(field === null || field === void 0 ? void 0 : field.webType),
|
|
126
131
|
operator: operator === null || operator === void 0 ? void 0 : operator.value,
|
|
127
132
|
params: fieldValue
|
|
128
133
|
});
|
|
@@ -132,12 +137,29 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
132
137
|
if (['absolute', 'relative', 'is null', 'is not null'].includes(operator === null || operator === void 0 ? void 0 : operator.value)) setFieldValue([]);
|
|
133
138
|
}, [operator]);
|
|
134
139
|
|
|
140
|
+
var getType = function getType(type) {
|
|
141
|
+
if (!type) return;
|
|
142
|
+
|
|
143
|
+
if (type === PropType.STRING2) {
|
|
144
|
+
return PropType.STRING;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (type === PropType.NUMBER2) {
|
|
148
|
+
return PropType.NUMBER;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (type === PropType.DATE2) {
|
|
152
|
+
return PropType.DATE;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
135
156
|
var onDatasetChange = function onDatasetChange(datasetId) {
|
|
136
157
|
if (!datasetId) {
|
|
137
158
|
setFieldList([]);
|
|
138
159
|
return;
|
|
139
160
|
}
|
|
140
161
|
|
|
162
|
+
setLoading(true);
|
|
141
163
|
request(Apis.queryDatasetDetail, {
|
|
142
164
|
method: 'post',
|
|
143
165
|
data: {
|
|
@@ -146,9 +168,11 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
146
168
|
datasetId: datasetId
|
|
147
169
|
}
|
|
148
170
|
}).then(function (result) {
|
|
171
|
+
setLoading(false);
|
|
149
172
|
setFieldList(result.data || []);
|
|
150
173
|
}).catch(function (e) {
|
|
151
174
|
console.error(e);
|
|
175
|
+
setLoading(false);
|
|
152
176
|
setFieldList([]);
|
|
153
177
|
});
|
|
154
178
|
};
|
|
@@ -177,15 +201,15 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
177
201
|
var list = [];
|
|
178
202
|
|
|
179
203
|
switch (type) {
|
|
180
|
-
case PropType.
|
|
204
|
+
case PropType.DATE2:
|
|
181
205
|
list = dateOperate;
|
|
182
206
|
break;
|
|
183
207
|
|
|
184
|
-
case PropType.
|
|
208
|
+
case PropType.NUMBER2:
|
|
185
209
|
list = numberOperate;
|
|
186
210
|
break;
|
|
187
211
|
|
|
188
|
-
case PropType.
|
|
212
|
+
case PropType.STRING2:
|
|
189
213
|
list = stringOperate;
|
|
190
214
|
break;
|
|
191
215
|
|
|
@@ -211,7 +235,7 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
211
235
|
onChange: onOperateChange
|
|
212
236
|
}), function () {
|
|
213
237
|
switch (field.webType) {
|
|
214
|
-
case PropType.
|
|
238
|
+
case PropType.DATE2:
|
|
215
239
|
if ((operator === null || operator === void 0 ? void 0 : operator.value) === 'absolute') return /*#__PURE__*/React.createElement(DatePicker.RangePicker, {
|
|
216
240
|
className: "".concat(classPrefix, "-value date"),
|
|
217
241
|
format: 'YYYY-MM-DD',
|
|
@@ -237,7 +261,7 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
237
261
|
suffix: "\u5929"
|
|
238
262
|
});
|
|
239
263
|
|
|
240
|
-
case PropType.
|
|
264
|
+
case PropType.STRING2:
|
|
241
265
|
if (['is null', 'is not null'].includes(operator === null || operator === void 0 ? void 0 : operator.value)) return null;
|
|
242
266
|
return /*#__PURE__*/React.createElement(Input, {
|
|
243
267
|
className: "".concat(classPrefix, "-value"),
|
|
@@ -248,7 +272,7 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
248
272
|
}
|
|
249
273
|
});
|
|
250
274
|
|
|
251
|
-
case PropType.
|
|
275
|
+
case PropType.NUMBER2:
|
|
252
276
|
return /*#__PURE__*/React.createElement(Input, {
|
|
253
277
|
type: "number",
|
|
254
278
|
className: "".concat(classPrefix, "-value"),
|
|
@@ -281,6 +305,7 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
281
305
|
labelField: "name",
|
|
282
306
|
keyField: "name",
|
|
283
307
|
value: field,
|
|
308
|
+
loading: loading,
|
|
284
309
|
onChange: onFieldChange
|
|
285
310
|
}), renderByType()) : null);
|
|
286
311
|
};
|
|
@@ -290,10 +315,10 @@ var CdpCondition = function CdpCondition(props) {
|
|
|
290
315
|
defaultValue = props.defaultValue,
|
|
291
316
|
onChange = props.onChange;
|
|
292
317
|
|
|
293
|
-
var
|
|
294
|
-
|
|
295
|
-
cdpConditions =
|
|
296
|
-
setCdpConditions =
|
|
318
|
+
var _useState15 = useState([undefined]),
|
|
319
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
320
|
+
cdpConditions = _useState16[0],
|
|
321
|
+
setCdpConditions = _useState16[1];
|
|
297
322
|
|
|
298
323
|
useEffect(function () {
|
|
299
324
|
if (defaultValue && defaultValue.dataset) {
|
|
@@ -73,17 +73,7 @@ export declare const tagList: ({
|
|
|
73
73
|
}[];
|
|
74
74
|
startProcessTime: string;
|
|
75
75
|
})[];
|
|
76
|
-
export declare const conditions:
|
|
77
|
-
attrs: {
|
|
78
|
-
attrId: number;
|
|
79
|
-
attrName: string;
|
|
80
|
-
category: string;
|
|
81
|
-
operator: string;
|
|
82
|
-
params: string[];
|
|
83
|
-
attrType: string;
|
|
84
|
-
}[];
|
|
85
|
-
dataset?: undefined;
|
|
86
|
-
} | {
|
|
76
|
+
export declare const conditions: {
|
|
87
77
|
dataset: {
|
|
88
78
|
datasetId: number;
|
|
89
79
|
datasetTable: string;
|
|
@@ -94,8 +84,7 @@ export declare const conditions: ({
|
|
|
94
84
|
operator: string;
|
|
95
85
|
params: string[];
|
|
96
86
|
}[];
|
|
97
|
-
|
|
98
|
-
})[][];
|
|
87
|
+
}[][];
|
|
99
88
|
export declare const datasetList: {
|
|
100
89
|
id: number;
|
|
101
90
|
datasetName: string;
|
|
@@ -535,46 +535,15 @@ export var tagList = [{
|
|
|
535
535
|
startProcessTime: '2022-09-06T21:08:28'
|
|
536
536
|
}];
|
|
537
537
|
export var conditions = [[{
|
|
538
|
-
attrs: [{
|
|
539
|
-
attrId: 0,
|
|
540
|
-
attrName: 'last_visit_time',
|
|
541
|
-
category: 'fixed',
|
|
542
|
-
operator: 'absolute',
|
|
543
|
-
params: ['2022-09-07', '2022-09-08'],
|
|
544
|
-
attrType: 'cont-date'
|
|
545
|
-
}]
|
|
546
|
-
}, {
|
|
547
|
-
dataset: [{
|
|
548
|
-
datasetId: 12,
|
|
549
|
-
datasetTable: 'table_2',
|
|
550
|
-
fieldName: 'b_id',
|
|
551
|
-
fieldType: 'bigint',
|
|
552
|
-
webType: 'string',
|
|
553
|
-
paramType: 'string',
|
|
554
|
-
operator: 'equal',
|
|
555
|
-
params: ['88']
|
|
556
|
-
}]
|
|
557
|
-
}], [{
|
|
558
538
|
dataset: [{
|
|
559
|
-
datasetId:
|
|
560
|
-
datasetTable: '
|
|
539
|
+
datasetId: 174,
|
|
540
|
+
datasetTable: '181e55e003bc25945698fdb2e65d3c2193d',
|
|
561
541
|
fieldName: 'a_id',
|
|
562
542
|
fieldType: 'bigint',
|
|
563
543
|
webType: 'number',
|
|
564
544
|
paramType: 'number',
|
|
565
|
-
operator: '
|
|
566
|
-
params: ['
|
|
567
|
-
}]
|
|
568
|
-
}, {
|
|
569
|
-
dataset: [{
|
|
570
|
-
datasetId: 16,
|
|
571
|
-
datasetTable: 'table_4',
|
|
572
|
-
fieldName: 'b_id',
|
|
573
|
-
fieldType: 'bigint',
|
|
574
|
-
webType: 'string',
|
|
575
|
-
paramType: 'string',
|
|
576
|
-
operator: 'is not null',
|
|
577
|
-
params: []
|
|
545
|
+
operator: 'gt',
|
|
546
|
+
params: ['111']
|
|
578
547
|
}]
|
|
579
548
|
}]];
|
|
580
549
|
export var datasetList = [{
|
|
@@ -29,6 +29,7 @@ import BizGlobalDataContext from '../context';
|
|
|
29
29
|
import IconFont from '../icon/iconFont';
|
|
30
30
|
import request from '../utils/ajax';
|
|
31
31
|
import Apis from '../constants/apis';
|
|
32
|
+
import { Spin } from 'antd';
|
|
32
33
|
export var BizUserConditionContext = /*#__PURE__*/createContext({
|
|
33
34
|
orConditionNum: 2,
|
|
34
35
|
eventAttrNum: 1,
|
|
@@ -76,10 +77,15 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
76
77
|
value = _useState6[0],
|
|
77
78
|
setValue = _useState6[1];
|
|
78
79
|
|
|
79
|
-
var _useState7 = useState(
|
|
80
|
+
var _useState7 = useState(true),
|
|
80
81
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
loading = _useState8[0],
|
|
83
|
+
setLoading = _useState8[1];
|
|
84
|
+
|
|
85
|
+
var _useState9 = useState([]),
|
|
86
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
87
|
+
dataset = _useState10[0],
|
|
88
|
+
setDataset = _useState10[1];
|
|
83
89
|
|
|
84
90
|
var envNameList = useMemo(function () {
|
|
85
91
|
return eventEnvList ? eventEnvList.map(function (env) {
|
|
@@ -96,8 +102,10 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
96
102
|
useEffect(function () {
|
|
97
103
|
initShowList();
|
|
98
104
|
|
|
99
|
-
if (props.openCdpCondition && (!menuNameMap || menuNameMap['
|
|
105
|
+
if (props.openCdpCondition && (!menuNameMap || menuNameMap['dataset'])) {
|
|
100
106
|
getDatasetList();
|
|
107
|
+
} else {
|
|
108
|
+
setLoading(false);
|
|
101
109
|
}
|
|
102
110
|
}, []);
|
|
103
111
|
|
|
@@ -166,12 +174,18 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
166
174
|
}
|
|
167
175
|
}).then(function (result) {
|
|
168
176
|
setDataset(result.data || []);
|
|
177
|
+
setLoading(false);
|
|
169
178
|
}).catch(function (e) {
|
|
170
179
|
console.error(e);
|
|
171
180
|
setDataset([]);
|
|
181
|
+
setLoading(false);
|
|
172
182
|
});
|
|
173
183
|
}
|
|
174
184
|
|
|
185
|
+
if (loading) {
|
|
186
|
+
return /*#__PURE__*/React.createElement(Spin, null);
|
|
187
|
+
}
|
|
188
|
+
|
|
175
189
|
return /*#__PURE__*/React.createElement(BizUserConditionContext.Provider, {
|
|
176
190
|
value: {
|
|
177
191
|
orConditionNum: props.orConditionNum || 2,
|
|
@@ -16,9 +16,12 @@ export interface AllConditionBasePropsI<T> {
|
|
|
16
16
|
onChange: (dataId: number, newData: T) => void;
|
|
17
17
|
}
|
|
18
18
|
export declare enum PropType {
|
|
19
|
-
STRING = "string",
|
|
20
|
-
NUMBER = "
|
|
21
|
-
DATE = "date"
|
|
19
|
+
STRING = "cont-string",
|
|
20
|
+
NUMBER = "cont-num",
|
|
21
|
+
DATE = "cont-date",
|
|
22
|
+
STRING2 = "string",
|
|
23
|
+
NUMBER2 = "number",
|
|
24
|
+
DATE2 = "date"
|
|
22
25
|
}
|
|
23
26
|
export declare namespace BizUserConditionT {
|
|
24
27
|
type ConditionType = 'add' | 'active' | 'event' | 'prop' | 'tag' | 'cdp';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export var PropType;
|
|
2
2
|
|
|
3
3
|
(function (PropType) {
|
|
4
|
-
PropType["STRING"] = "string";
|
|
5
|
-
PropType["NUMBER"] = "
|
|
6
|
-
PropType["DATE"] = "date";
|
|
4
|
+
PropType["STRING"] = "cont-string";
|
|
5
|
+
PropType["NUMBER"] = "cont-num";
|
|
6
|
+
PropType["DATE"] = "cont-date";
|
|
7
|
+
PropType["STRING2"] = "string";
|
|
8
|
+
PropType["NUMBER2"] = "number";
|
|
9
|
+
PropType["DATE2"] = "date";
|
|
7
10
|
})(PropType || (PropType = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.0.30-user.
|
|
3
|
+
"version": "1.0.30-user.3",
|
|
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": "eaa12ea299f24b2fbb4f33437c89e28c2df32903"
|
|
62
62
|
}
|