@zgfe/business-lib 1.0.30-user.0 → 1.0.30-user.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/userCondition/conditions/cdpCondition.js +24 -8
- 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/es/userCondition/util.js +1 -1
- package/package.json +2 -2
|
@@ -122,7 +122,7 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
122
122
|
fieldName: field === null || field === void 0 ? void 0 : field.name,
|
|
123
123
|
fieldType: field === null || field === void 0 ? void 0 : field.type,
|
|
124
124
|
webType: field === null || field === void 0 ? void 0 : field.webType,
|
|
125
|
-
paramType: field === null || field === void 0 ? void 0 : field.webType,
|
|
125
|
+
paramType: getType(field === null || field === void 0 ? void 0 : field.webType),
|
|
126
126
|
operator: operator === null || operator === void 0 ? void 0 : operator.value,
|
|
127
127
|
params: fieldValue
|
|
128
128
|
});
|
|
@@ -132,6 +132,22 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
132
132
|
if (['absolute', 'relative', 'is null', 'is not null'].includes(operator === null || operator === void 0 ? void 0 : operator.value)) setFieldValue([]);
|
|
133
133
|
}, [operator]);
|
|
134
134
|
|
|
135
|
+
var getType = function getType(type) {
|
|
136
|
+
if (!type) return;
|
|
137
|
+
|
|
138
|
+
if (type === PropType.STRING2) {
|
|
139
|
+
return PropType.STRING;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (type === PropType.NUMBER2) {
|
|
143
|
+
return PropType.NUMBER;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (type === PropType.DATE2) {
|
|
147
|
+
return PropType.DATE;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
135
151
|
var onDatasetChange = function onDatasetChange(datasetId) {
|
|
136
152
|
if (!datasetId) {
|
|
137
153
|
setFieldList([]);
|
|
@@ -177,15 +193,15 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
177
193
|
var list = [];
|
|
178
194
|
|
|
179
195
|
switch (type) {
|
|
180
|
-
case PropType.
|
|
196
|
+
case PropType.DATE2:
|
|
181
197
|
list = dateOperate;
|
|
182
198
|
break;
|
|
183
199
|
|
|
184
|
-
case PropType.
|
|
200
|
+
case PropType.NUMBER2:
|
|
185
201
|
list = numberOperate;
|
|
186
202
|
break;
|
|
187
203
|
|
|
188
|
-
case PropType.
|
|
204
|
+
case PropType.STRING2:
|
|
189
205
|
list = stringOperate;
|
|
190
206
|
break;
|
|
191
207
|
|
|
@@ -211,7 +227,7 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
211
227
|
onChange: onOperateChange
|
|
212
228
|
}), function () {
|
|
213
229
|
switch (field.webType) {
|
|
214
|
-
case PropType.
|
|
230
|
+
case PropType.DATE2:
|
|
215
231
|
if ((operator === null || operator === void 0 ? void 0 : operator.value) === 'absolute') return /*#__PURE__*/React.createElement(DatePicker.RangePicker, {
|
|
216
232
|
className: "".concat(classPrefix, "-value date"),
|
|
217
233
|
format: 'YYYY-MM-DD',
|
|
@@ -237,7 +253,7 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
237
253
|
suffix: "\u5929"
|
|
238
254
|
});
|
|
239
255
|
|
|
240
|
-
case PropType.
|
|
256
|
+
case PropType.STRING2:
|
|
241
257
|
if (['is null', 'is not null'].includes(operator === null || operator === void 0 ? void 0 : operator.value)) return null;
|
|
242
258
|
return /*#__PURE__*/React.createElement(Input, {
|
|
243
259
|
className: "".concat(classPrefix, "-value"),
|
|
@@ -248,7 +264,7 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
248
264
|
}
|
|
249
265
|
});
|
|
250
266
|
|
|
251
|
-
case PropType.
|
|
267
|
+
case PropType.NUMBER2:
|
|
252
268
|
return /*#__PURE__*/React.createElement(Input, {
|
|
253
269
|
type: "number",
|
|
254
270
|
className: "".concat(classPrefix, "-value"),
|
|
@@ -297,7 +313,7 @@ var CdpCondition = function CdpCondition(props) {
|
|
|
297
313
|
|
|
298
314
|
useEffect(function () {
|
|
299
315
|
if (defaultValue && defaultValue.dataset) {
|
|
300
|
-
setCdpConditions(defaultValue.dataset
|
|
316
|
+
setCdpConditions(defaultValue.dataset);
|
|
301
317
|
}
|
|
302
318
|
}, []);
|
|
303
319
|
|
|
@@ -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/es/userCondition/util.js
CHANGED
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.2",
|
|
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": "86ed742788efaad89eeadfef7357ece4292ac5f7"
|
|
62
62
|
}
|