@zgfe/business-lib 1.1.2 → 1.1.3-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/constants/apis.d.ts +2 -0
- package/es/constants/apis.js +3 -1
- package/es/userCondition/conditionTypeList.js +8 -2
- package/es/userCondition/conditions/cdpCondition.d.ts +8 -0
- package/es/userCondition/conditions/cdpCondition.js +357 -0
- package/es/userCondition/conditions/constants.d.ts +4 -0
- package/es/userCondition/conditions/constants.js +5 -1
- package/es/userCondition/conditions/styles/cdpCondition.less +31 -0
- package/es/userCondition/conditions/textDesc.d.ts +1 -1
- package/es/userCondition/conditions/textDesc.js +60 -11
- package/es/userCondition/demo/index.d.ts +1 -0
- package/es/userCondition/demo/index.js +4 -2
- package/es/userCondition/demo/mockData.d.ts +18 -5
- package/es/userCondition/demo/mockData.js +45 -8
- package/es/userCondition/index.js +78 -8
- package/es/userCondition/orConditions.js +46 -27
- package/es/userCondition/styles/index.less +7 -0
- package/es/userCondition/types.d.ts +38 -3
- package/es/userCondition/types.js +10 -1
- package/es/userCondition/util.d.ts +1 -1
- package/es/userCondition/util.js +5 -0
- package/package.json +2 -2
package/es/constants/apis.d.ts
CHANGED
package/es/constants/apis.js
CHANGED
|
@@ -4,6 +4,8 @@ var Apis = {
|
|
|
4
4
|
esQuery: '/data/queryEsData.jsp',
|
|
5
5
|
addPanel: '/apppanel/addPanelElement.jsp',
|
|
6
6
|
updatePanelTarget: '/apppanel/updateElemet.jsp',
|
|
7
|
-
queryPanelGroup: '/apppanel/panels.jsp'
|
|
7
|
+
queryPanelGroup: '/apppanel/panels.jsp',
|
|
8
|
+
queryDatasetList: '/zg/web/cdp/inner/dataset/list',
|
|
9
|
+
queryDatasetDetail: '/zg/web/cdp/inner/dataset/detail'
|
|
8
10
|
};
|
|
9
11
|
export default Apis;
|
|
@@ -12,7 +12,8 @@ var ConditionTypeList = function ConditionTypeList(props) {
|
|
|
12
12
|
|
|
13
13
|
var _useContext = useContext(BizUserConditionContext),
|
|
14
14
|
textMode = _useContext.textMode,
|
|
15
|
-
openTagCondition = _useContext.openTagCondition
|
|
15
|
+
openTagCondition = _useContext.openTagCondition,
|
|
16
|
+
openCdpCondition = _useContext.openCdpCondition;
|
|
16
17
|
|
|
17
18
|
var _useContext2 = useContext(BizGlobalDataContext),
|
|
18
19
|
menuNameMap = _useContext2.menuNameMap;
|
|
@@ -61,7 +62,12 @@ var ConditionTypeList = function ConditionTypeList(props) {
|
|
|
61
62
|
onClick: function onClick() {
|
|
62
63
|
return onAdd('tag');
|
|
63
64
|
}
|
|
64
|
-
}, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u7528\u6237\u6807\u7B7E"))) : null)
|
|
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
|
+
className: "condition-type",
|
|
67
|
+
onClick: function onClick() {
|
|
68
|
+
return onAdd('cdp');
|
|
69
|
+
}
|
|
70
|
+
}, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u660E\u7EC6\u6570\u636E"))) : null));
|
|
65
71
|
};
|
|
66
72
|
|
|
67
73
|
ConditionTypeList.defaultProps = {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AllConditionBasePropsI, BizUserConditionT } from '../types';
|
|
3
|
+
import './styles/cdpCondition.less';
|
|
4
|
+
interface CdpConditionProps extends AllConditionBasePropsI<BizUserConditionT.CdpConditionDetail[]> {
|
|
5
|
+
defaultValue?: BizUserConditionT.CdpCondition;
|
|
6
|
+
}
|
|
7
|
+
declare const CdpCondition: React.FC<CdpConditionProps>;
|
|
8
|
+
export default CdpCondition;
|
|
@@ -0,0 +1,357 @@
|
|
|
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
|
+
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
|
|
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."); }
|
|
10
|
+
|
|
11
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
+
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
14
|
+
|
|
15
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
16
|
+
|
|
17
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
+
|
|
19
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
20
|
+
import BizSelect from '../../select';
|
|
21
|
+
import { PropType } from '../types';
|
|
22
|
+
import './styles/cdpCondition.less';
|
|
23
|
+
import _ from 'lodash';
|
|
24
|
+
import { dateOperate, numberOperate, stringOperate } from '../../attrConditions/utils/operates';
|
|
25
|
+
import { DatePicker, Input } from 'antd';
|
|
26
|
+
import moment from 'moment';
|
|
27
|
+
import { BizUserConditionContext } from '..';
|
|
28
|
+
import request from '../../utils/ajax';
|
|
29
|
+
import Apis from '../../constants/apis';
|
|
30
|
+
import BizGlobalDataContext from '../../context';
|
|
31
|
+
var classPrefix = 'biz-user-condition-cdp';
|
|
32
|
+
|
|
33
|
+
var CdpConditionItem = function CdpConditionItem(props) {
|
|
34
|
+
var _useContext = useContext(BizGlobalDataContext),
|
|
35
|
+
currentApp = _useContext.currentApp;
|
|
36
|
+
|
|
37
|
+
var _useContext2 = useContext(BizUserConditionContext),
|
|
38
|
+
_useContext2$datasetL = _useContext2.datasetList,
|
|
39
|
+
datasetList = _useContext2$datasetL === void 0 ? [] : _useContext2$datasetL;
|
|
40
|
+
|
|
41
|
+
var _useState = useState(function () {
|
|
42
|
+
if (props.value) {
|
|
43
|
+
return {
|
|
44
|
+
id: props.value.datasetId,
|
|
45
|
+
tableName: props.value.datasetTable
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return;
|
|
50
|
+
}),
|
|
51
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
52
|
+
dataset = _useState2[0],
|
|
53
|
+
setDataset = _useState2[1];
|
|
54
|
+
|
|
55
|
+
var _useState3 = useState(false),
|
|
56
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
57
|
+
loading = _useState4[0],
|
|
58
|
+
setLoading = _useState4[1];
|
|
59
|
+
|
|
60
|
+
var _useState5 = useState(),
|
|
61
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
62
|
+
field = _useState6[0],
|
|
63
|
+
setField = _useState6[1];
|
|
64
|
+
|
|
65
|
+
var _useState7 = useState(),
|
|
66
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
67
|
+
operator = _useState8[0],
|
|
68
|
+
setOperator = _useState8[1];
|
|
69
|
+
|
|
70
|
+
var _useState9 = useState(),
|
|
71
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
72
|
+
fieldValue = _useState10[0],
|
|
73
|
+
setFieldValue = _useState10[1];
|
|
74
|
+
|
|
75
|
+
var _useState11 = useState([]),
|
|
76
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
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];
|
|
84
|
+
|
|
85
|
+
useEffect(function () {
|
|
86
|
+
if (!props.value) {
|
|
87
|
+
setIsFirst(false);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
var _props$value = props.value,
|
|
92
|
+
datasetId = _props$value.datasetId,
|
|
93
|
+
datasetTable = _props$value.datasetTable,
|
|
94
|
+
datasetName = _props$value.datasetName,
|
|
95
|
+
fieldName = _props$value.fieldName,
|
|
96
|
+
fieldType = _props$value.fieldType,
|
|
97
|
+
webType = _props$value.webType,
|
|
98
|
+
operator = _props$value.operator,
|
|
99
|
+
params = _props$value.params;
|
|
100
|
+
setDataset({
|
|
101
|
+
id: datasetId,
|
|
102
|
+
tableName: datasetTable,
|
|
103
|
+
datasetName: datasetName
|
|
104
|
+
});
|
|
105
|
+
setField({
|
|
106
|
+
name: fieldName,
|
|
107
|
+
type: fieldType,
|
|
108
|
+
webType: webType
|
|
109
|
+
});
|
|
110
|
+
setOperator({
|
|
111
|
+
value: operator
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
if (params) {
|
|
115
|
+
setFieldValue(params);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
onDatasetChange(datasetId);
|
|
119
|
+
setTimeout(function () {
|
|
120
|
+
setIsFirst(false);
|
|
121
|
+
}, 0);
|
|
122
|
+
}, []);
|
|
123
|
+
useEffect(function () {
|
|
124
|
+
if (isFirst) return;
|
|
125
|
+
if (!dataset) return;
|
|
126
|
+
props.onChange({
|
|
127
|
+
datasetId: dataset.id,
|
|
128
|
+
datasetTable: dataset.tableName,
|
|
129
|
+
datasetName: dataset.datasetName,
|
|
130
|
+
fieldName: field === null || field === void 0 ? void 0 : field.name,
|
|
131
|
+
fieldType: field === null || field === void 0 ? void 0 : field.type,
|
|
132
|
+
webType: field === null || field === void 0 ? void 0 : field.webType,
|
|
133
|
+
paramType: getType(field === null || field === void 0 ? void 0 : field.webType),
|
|
134
|
+
operator: operator === null || operator === void 0 ? void 0 : operator.value,
|
|
135
|
+
params: fieldValue
|
|
136
|
+
});
|
|
137
|
+
}, [dataset, field, operator, fieldValue]);
|
|
138
|
+
useEffect(function () {
|
|
139
|
+
if (isFirst) return;
|
|
140
|
+
if (['absolute', 'relative', 'is null', 'is not null'].includes(operator === null || operator === void 0 ? void 0 : operator.value)) setFieldValue([]);
|
|
141
|
+
}, [operator]);
|
|
142
|
+
|
|
143
|
+
var getType = function getType(type) {
|
|
144
|
+
if (!type) return;
|
|
145
|
+
|
|
146
|
+
if (type === PropType.STRING2) {
|
|
147
|
+
return PropType.STRING;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (type === PropType.NUMBER2) {
|
|
151
|
+
return PropType.NUMBER;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (type === PropType.DATE2) {
|
|
155
|
+
return PropType.DATE;
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
var onDatasetChange = function onDatasetChange(datasetId) {
|
|
160
|
+
if (!datasetId) {
|
|
161
|
+
setFieldList([]);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
setLoading(true);
|
|
166
|
+
request(Apis.queryDatasetDetail, {
|
|
167
|
+
method: 'post',
|
|
168
|
+
data: {
|
|
169
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
170
|
+
platform: currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform,
|
|
171
|
+
datasetId: datasetId
|
|
172
|
+
}
|
|
173
|
+
}).then(function (result) {
|
|
174
|
+
setLoading(false);
|
|
175
|
+
setFieldList(result.data || []);
|
|
176
|
+
}).catch(function (e) {
|
|
177
|
+
console.error(e);
|
|
178
|
+
setLoading(false);
|
|
179
|
+
setFieldList([]);
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
var onTableChange = function onTableChange(data) {
|
|
184
|
+
setDataset(data);
|
|
185
|
+
setField({
|
|
186
|
+
name: undefined
|
|
187
|
+
});
|
|
188
|
+
setOperator(undefined);
|
|
189
|
+
setFieldValue([]);
|
|
190
|
+
onDatasetChange(data.id);
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
var onFieldChange = function onFieldChange(data) {
|
|
194
|
+
setField(data);
|
|
195
|
+
setOperator(getOptions(data.webType)[0]);
|
|
196
|
+
setFieldValue([]);
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
var onOperateChange = function onOperateChange(operate) {
|
|
200
|
+
setOperator(operate);
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
function getOptions(type) {
|
|
204
|
+
var list = [];
|
|
205
|
+
|
|
206
|
+
switch (type) {
|
|
207
|
+
case PropType.DATE2:
|
|
208
|
+
list = dateOperate;
|
|
209
|
+
break;
|
|
210
|
+
|
|
211
|
+
case PropType.NUMBER2:
|
|
212
|
+
list = numberOperate;
|
|
213
|
+
break;
|
|
214
|
+
|
|
215
|
+
case PropType.STRING2:
|
|
216
|
+
list = stringOperate;
|
|
217
|
+
break;
|
|
218
|
+
|
|
219
|
+
default:
|
|
220
|
+
list = [];
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return list;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function renderByType() {
|
|
227
|
+
if (!field || !field.name) return null;
|
|
228
|
+
var optionList = getOptions(field.webType);
|
|
229
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
230
|
+
className: "".concat(classPrefix, "-condition-group")
|
|
231
|
+
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
232
|
+
className: "".concat(classPrefix, "-select-condition"),
|
|
233
|
+
options: optionList,
|
|
234
|
+
labelField: "name",
|
|
235
|
+
keyField: "value",
|
|
236
|
+
overlayWidth: 96,
|
|
237
|
+
value: operator,
|
|
238
|
+
onChange: onOperateChange
|
|
239
|
+
}), function () {
|
|
240
|
+
switch (field.webType) {
|
|
241
|
+
case PropType.DATE2:
|
|
242
|
+
if ((operator === null || operator === void 0 ? void 0 : operator.value) === 'absolute') return /*#__PURE__*/React.createElement(DatePicker.RangePicker, {
|
|
243
|
+
className: "".concat(classPrefix, "-value date"),
|
|
244
|
+
format: 'YYYY-MM-DD',
|
|
245
|
+
defaultValue: function () {
|
|
246
|
+
if (_.isArray(fieldValue)) return fieldValue.map(function (d) {
|
|
247
|
+
return moment(d);
|
|
248
|
+
});
|
|
249
|
+
return undefined;
|
|
250
|
+
}(),
|
|
251
|
+
onChange: function onChange() {
|
|
252
|
+
setFieldValue(arguments.length <= 1 ? undefined : arguments[1]);
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
if ((operator === null || operator === void 0 ? void 0 : operator.value) === 'relative') return /*#__PURE__*/React.createElement(Input, {
|
|
256
|
+
key: "relative-date",
|
|
257
|
+
className: "".concat(classPrefix, "-value date"),
|
|
258
|
+
type: "number",
|
|
259
|
+
placeholder: "\u8BF7\u8F93\u5165",
|
|
260
|
+
defaultValue: fieldValue && fieldValue[0],
|
|
261
|
+
onChange: function onChange(e) {
|
|
262
|
+
e.persist();
|
|
263
|
+
setFieldValue([e.target.value]);
|
|
264
|
+
},
|
|
265
|
+
suffix: "\u5929"
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
case PropType.STRING2:
|
|
269
|
+
if (['is null', 'is not null'].includes(operator === null || operator === void 0 ? void 0 : operator.value)) return null;
|
|
270
|
+
return /*#__PURE__*/React.createElement(Input, {
|
|
271
|
+
className: "".concat(classPrefix, "-value"),
|
|
272
|
+
value: fieldValue && fieldValue[0],
|
|
273
|
+
placeholder: "\u8BF7\u8F93\u5165",
|
|
274
|
+
onChange: function onChange(e) {
|
|
275
|
+
e.persist();
|
|
276
|
+
setFieldValue([e.target.value]);
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
case PropType.NUMBER2:
|
|
281
|
+
return /*#__PURE__*/React.createElement(Input, {
|
|
282
|
+
type: "number",
|
|
283
|
+
className: "".concat(classPrefix, "-value"),
|
|
284
|
+
value: fieldValue && fieldValue[0],
|
|
285
|
+
placeholder: "\u8BF7\u8F93\u5165",
|
|
286
|
+
onChange: function onChange(e) {
|
|
287
|
+
e.persist();
|
|
288
|
+
setFieldValue([e.target.value]);
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}());
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
296
|
+
className: "".concat(classPrefix, "-content")
|
|
297
|
+
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
298
|
+
className: "".concat(classPrefix, "-select-dataset"),
|
|
299
|
+
options: datasetList,
|
|
300
|
+
placeholder: "\u9009\u62E9\u660E\u7EC6\u8868",
|
|
301
|
+
labelField: "datasetName",
|
|
302
|
+
keyField: "tableName",
|
|
303
|
+
value: dataset,
|
|
304
|
+
onChange: onTableChange
|
|
305
|
+
}), dataset ? /*#__PURE__*/React.createElement("div", {
|
|
306
|
+
className: "".concat(classPrefix, "-item")
|
|
307
|
+
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
308
|
+
className: "".concat(classPrefix, "-select-field"),
|
|
309
|
+
options: fieldList,
|
|
310
|
+
placeholder: "\u9009\u62E9\u5B57\u6BB5",
|
|
311
|
+
labelField: "name",
|
|
312
|
+
keyField: "name",
|
|
313
|
+
value: field,
|
|
314
|
+
loading: loading,
|
|
315
|
+
onChange: onFieldChange
|
|
316
|
+
}), renderByType()) : null);
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
var CdpCondition = function CdpCondition(props) {
|
|
320
|
+
var dataId = props.dataId,
|
|
321
|
+
defaultValue = props.defaultValue,
|
|
322
|
+
onChange = props.onChange;
|
|
323
|
+
|
|
324
|
+
var _useState15 = useState([undefined]),
|
|
325
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
326
|
+
cdpConditions = _useState16[0],
|
|
327
|
+
setCdpConditions = _useState16[1];
|
|
328
|
+
|
|
329
|
+
useEffect(function () {
|
|
330
|
+
if (defaultValue && defaultValue.dataset) {
|
|
331
|
+
setCdpConditions(defaultValue.dataset);
|
|
332
|
+
}
|
|
333
|
+
}, []);
|
|
334
|
+
|
|
335
|
+
var onChangeCondition = function onChangeCondition(condition, index) {
|
|
336
|
+
var resData = _.cloneDeep(cdpConditions);
|
|
337
|
+
|
|
338
|
+
resData[index] = _objectSpread({}, condition);
|
|
339
|
+
onChange(dataId, resData);
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
343
|
+
className: classPrefix
|
|
344
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
345
|
+
className: "".concat(classPrefix, "-label")
|
|
346
|
+
}, "\u660E\u7EC6\u6570\u636E"), cdpConditions.map(function (item, index) {
|
|
347
|
+
return /*#__PURE__*/React.createElement(CdpConditionItem, {
|
|
348
|
+
value: item,
|
|
349
|
+
key: (item === null || item === void 0 ? void 0 : item.fieldName) || index,
|
|
350
|
+
onChange: function onChange(data) {
|
|
351
|
+
return onChangeCondition(data, index);
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
}));
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
export default CdpCondition;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
@import '../../../assets/styles/variable.less';
|
|
2
|
+
|
|
3
|
+
.biz-user-condition-cdp {
|
|
4
|
+
display: flex;
|
|
5
|
+
|
|
6
|
+
&-content,
|
|
7
|
+
&-condition-group {
|
|
8
|
+
display: flex;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&-label {
|
|
12
|
+
margin-right: @margin-xs;
|
|
13
|
+
line-height: 32px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&-item {
|
|
17
|
+
display: flex;
|
|
18
|
+
margin-left: @margin-xs;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&-select-dataset {
|
|
22
|
+
width: 255px;
|
|
23
|
+
}
|
|
24
|
+
&-select-field {
|
|
25
|
+
width: 129px;
|
|
26
|
+
}
|
|
27
|
+
&-select-condition {
|
|
28
|
+
width: 96px;
|
|
29
|
+
margin: 0 @margin-xs;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { BizUserConditionT } from '../types';
|
|
3
3
|
import './styles/textDesc.less';
|
|
4
4
|
export interface TextProps {
|
|
5
|
-
condition: BizUserConditionT.ActiveCondition | BizUserConditionT.AddCondition | BizUserConditionT.PropCondition | BizUserConditionT.EventCondition | BizUserConditionT.TagsCondition;
|
|
5
|
+
condition: BizUserConditionT.ActiveCondition | BizUserConditionT.AddCondition | BizUserConditionT.PropCondition | BizUserConditionT.EventCondition | BizUserConditionT.TagsCondition | BizUserConditionT.CdpCondition;
|
|
6
6
|
showOrDesc: boolean;
|
|
7
7
|
}
|
|
8
8
|
declare const Text: React.FC<TextProps>;
|
|
@@ -40,30 +40,34 @@ var Text = function Text(props) {
|
|
|
40
40
|
userTagsData = _useContext3.userTagsData;
|
|
41
41
|
|
|
42
42
|
function render() {
|
|
43
|
-
|
|
43
|
+
if (condition.labels) {
|
|
44
|
+
return renderTags(condition);
|
|
45
|
+
}
|
|
44
46
|
|
|
45
|
-
if (
|
|
46
|
-
return
|
|
47
|
+
if (condition.dataset) {
|
|
48
|
+
return renderCdp(condition);
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
var data = condition;
|
|
52
|
+
|
|
53
|
+
if (String(data.eventId) === '-4') {
|
|
50
54
|
return renderPeriod({
|
|
51
55
|
before: '活跃于'
|
|
52
|
-
},
|
|
56
|
+
}, data.runPeriod);
|
|
53
57
|
}
|
|
54
58
|
|
|
55
|
-
if (String(
|
|
59
|
+
if (String(data.eventId) === '-3') {
|
|
56
60
|
return renderPeriod({
|
|
57
61
|
before: '新增于'
|
|
58
|
-
},
|
|
62
|
+
}, data.runPeriod);
|
|
59
63
|
}
|
|
60
64
|
|
|
61
|
-
if (
|
|
62
|
-
return renderProps(
|
|
65
|
+
if (data.eventId === undefined) {
|
|
66
|
+
return renderProps(data.attrs[0], 'user');
|
|
63
67
|
}
|
|
64
68
|
|
|
65
|
-
if (
|
|
66
|
-
return renderEvent(
|
|
69
|
+
if (data.eventId) {
|
|
70
|
+
return renderEvent(data);
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
|
|
@@ -206,6 +210,51 @@ var Text = function Text(props) {
|
|
|
206
210
|
}), /*#__PURE__*/React.createElement("span", null, ")")));
|
|
207
211
|
}
|
|
208
212
|
|
|
213
|
+
function renderCdp(condition) {
|
|
214
|
+
var dataset = condition.dataset;
|
|
215
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
216
|
+
style: {
|
|
217
|
+
backgroundColor: '#effcff',
|
|
218
|
+
padding: '6px 7px'
|
|
219
|
+
}
|
|
220
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
221
|
+
className: "".concat(classPrefix, "-text-desc-value")
|
|
222
|
+
}, /*#__PURE__*/React.createElement("span", null, "("), dataset.map(function (value) {
|
|
223
|
+
if (!value) return null;
|
|
224
|
+
var operator = value.operator,
|
|
225
|
+
_value$params = value.params,
|
|
226
|
+
params = _value$params === void 0 ? [] : _value$params;
|
|
227
|
+
var valuesDom = '';
|
|
228
|
+
|
|
229
|
+
var numOperatorMap = _objectSpread(_objectSpread({}, operatorMap), {}, {
|
|
230
|
+
'not equal': '≠'
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
if (value.webType === 'date') {
|
|
234
|
+
if (operator === 'relative') {
|
|
235
|
+
valuesDom = "\u4E3A\u6700\u8FD1".concat(params[0], "\u5929");
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (operator === 'absolute') {
|
|
239
|
+
valuesDom = "\u4E3A".concat(params[0], "\u5230").concat(params[1]);
|
|
240
|
+
}
|
|
241
|
+
} else {
|
|
242
|
+
if (operator) {
|
|
243
|
+
var operateTxt = numOperatorMap[operator];
|
|
244
|
+
valuesDom = operateTxt;
|
|
245
|
+
|
|
246
|
+
if (params && params[0]) {
|
|
247
|
+
valuesDom += params[0];
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
253
|
+
key: Math.random()
|
|
254
|
+
}, "".concat(value.datasetName, "\u4E2D").concat(value.fieldName).concat(valuesDom));
|
|
255
|
+
}), /*#__PURE__*/React.createElement("span", null, ")")));
|
|
256
|
+
}
|
|
257
|
+
|
|
209
258
|
function renderPropValues(attr) {
|
|
210
259
|
if (attr.attrType === 'cont-date') {
|
|
211
260
|
return renderDateValues(attr.operator, attr.params);
|
|
@@ -16,6 +16,7 @@ import envData from '../../mock/env';
|
|
|
16
16
|
import userData from '../../mock/user';
|
|
17
17
|
import { BizUserCondition, BizGlobalDataContext, convertAttributeData } from '@zgfe/business-lib';
|
|
18
18
|
import { conditions, tagList } from './mockData';
|
|
19
|
+
import '@zgfe/business-lib/es/assets/iconfont/iconfont.css';
|
|
19
20
|
var getTagList = Promise.resolve(tagList);
|
|
20
21
|
export default (function () {
|
|
21
22
|
var _useState = useState({
|
|
@@ -49,7 +50,7 @@ export default (function () {
|
|
|
49
50
|
}, [conditions]);
|
|
50
51
|
|
|
51
52
|
function onChange(value) {
|
|
52
|
-
console.log(JSON.stringify(value));
|
|
53
|
+
console.log('change:', JSON.stringify(value));
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
var descDom = /*#__PURE__*/React.createElement(BizUserCondition, {
|
|
@@ -57,6 +58,7 @@ export default (function () {
|
|
|
57
58
|
onChange: onChange,
|
|
58
59
|
eventAttrNum: 3,
|
|
59
60
|
openTagCondition: true,
|
|
61
|
+
openCdpCondition: true,
|
|
60
62
|
userTagsData: userTagsData,
|
|
61
63
|
isRealTime: true
|
|
62
64
|
});
|
|
@@ -66,7 +68,7 @@ export default (function () {
|
|
|
66
68
|
userPropList: newStore.userPropList,
|
|
67
69
|
eventEnvList: newStore.envPropList,
|
|
68
70
|
currentApp: {
|
|
69
|
-
appId:
|
|
71
|
+
appId: 181,
|
|
70
72
|
platform: 0
|
|
71
73
|
}
|
|
72
74
|
}
|
|
@@ -74,12 +74,25 @@ export declare const tagList: ({
|
|
|
74
74
|
startProcessTime: string;
|
|
75
75
|
})[];
|
|
76
76
|
export declare const conditions: {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
dataset: {
|
|
78
|
+
datasetId: number;
|
|
79
|
+
datasetTable: string;
|
|
80
|
+
datasetName: string;
|
|
81
|
+
fieldName: string;
|
|
82
|
+
fieldType: string;
|
|
83
|
+
webType: string;
|
|
84
|
+
paramType: string;
|
|
81
85
|
operator: string;
|
|
82
86
|
params: string[];
|
|
83
|
-
attrType: string;
|
|
84
87
|
}[];
|
|
85
88
|
}[][];
|
|
89
|
+
export declare const datasetList: {
|
|
90
|
+
id: number;
|
|
91
|
+
datasetName: string;
|
|
92
|
+
tableName: string;
|
|
93
|
+
}[];
|
|
94
|
+
export declare const datasetNames: {
|
|
95
|
+
name: string;
|
|
96
|
+
type: string;
|
|
97
|
+
webType: string;
|
|
98
|
+
}[];
|
|
@@ -535,12 +535,49 @@ export var tagList = [{
|
|
|
535
535
|
startProcessTime: '2022-09-06T21:08:28'
|
|
536
536
|
}];
|
|
537
537
|
export var conditions = [[{
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
538
|
+
dataset: [{
|
|
539
|
+
datasetId: 174,
|
|
540
|
+
datasetTable: '181e55e003bc25945698fdb2e65d3c2193d',
|
|
541
|
+
datasetName: 's6',
|
|
542
|
+
fieldName: 'a_id',
|
|
543
|
+
fieldType: 'bigint',
|
|
544
|
+
webType: 'number',
|
|
545
|
+
paramType: 'number',
|
|
546
|
+
operator: 'gt',
|
|
547
|
+
params: ['111']
|
|
545
548
|
}]
|
|
546
|
-
}]];
|
|
549
|
+
}]];
|
|
550
|
+
export var datasetList = [{
|
|
551
|
+
id: 12,
|
|
552
|
+
datasetName: '数据集2',
|
|
553
|
+
tableName: 'table_2'
|
|
554
|
+
}, {
|
|
555
|
+
id: 13,
|
|
556
|
+
datasetName: '数据集3',
|
|
557
|
+
tableName: 'table_3'
|
|
558
|
+
}, {
|
|
559
|
+
id: 16,
|
|
560
|
+
datasetName: '数据集4',
|
|
561
|
+
tableName: 'table_4'
|
|
562
|
+
}, {
|
|
563
|
+
id: 18,
|
|
564
|
+
datasetName: '数据集5',
|
|
565
|
+
tableName: 'table_5'
|
|
566
|
+
}];
|
|
567
|
+
export var datasetNames = [{
|
|
568
|
+
name: 'a_id',
|
|
569
|
+
type: 'bigint',
|
|
570
|
+
webType: 'number'
|
|
571
|
+
}, {
|
|
572
|
+
name: 'b_id',
|
|
573
|
+
type: 'bigint',
|
|
574
|
+
webType: 'string'
|
|
575
|
+
}, {
|
|
576
|
+
name: 'e_id',
|
|
577
|
+
type: 'bigint',
|
|
578
|
+
webType: 'date'
|
|
579
|
+
}, {
|
|
580
|
+
name: 'f_id',
|
|
581
|
+
type: 'bigint',
|
|
582
|
+
webType: 'number'
|
|
583
|
+
}];
|
|
@@ -26,25 +26,34 @@ import './styles/index.less';
|
|
|
26
26
|
import { buildCondition } from './util';
|
|
27
27
|
import _ from 'lodash';
|
|
28
28
|
import BizGlobalDataContext from '../context';
|
|
29
|
+
import IconFont from '../icon/iconFont';
|
|
30
|
+
import request from '../utils/ajax';
|
|
31
|
+
import Apis from '../constants/apis';
|
|
32
|
+
import { Spin } from 'antd';
|
|
29
33
|
export var BizUserConditionContext = /*#__PURE__*/createContext({
|
|
30
34
|
orConditionNum: 2,
|
|
31
35
|
eventAttrNum: 1,
|
|
32
36
|
textMode: false,
|
|
33
37
|
openTagCondition: false,
|
|
38
|
+
openCdpCondition: false,
|
|
34
39
|
userTagsData: [],
|
|
35
40
|
envNameList: [],
|
|
36
|
-
userPropsMap: {}
|
|
41
|
+
userPropsMap: {},
|
|
42
|
+
datasetList: []
|
|
37
43
|
});
|
|
38
44
|
export var classPrefix = 'biz-user-condition';
|
|
39
45
|
|
|
40
46
|
var BizUserCondition = function BizUserCondition(props) {
|
|
41
47
|
var _useContext = useContext(BizGlobalDataContext),
|
|
42
48
|
eventEnvList = _useContext.eventEnvList,
|
|
43
|
-
userPropList = _useContext.userPropList
|
|
49
|
+
userPropList = _useContext.userPropList,
|
|
50
|
+
menuNameMap = _useContext.menuNameMap,
|
|
51
|
+
currentApp = _useContext.currentApp;
|
|
44
52
|
|
|
45
53
|
var andConditionNum = props.andConditionNum,
|
|
46
54
|
defaultValue = props.defaultValue,
|
|
47
55
|
openTagCondition = props.openTagCondition,
|
|
56
|
+
openCdpCondition = props.openCdpCondition,
|
|
48
57
|
userTagsData = props.userTagsData;
|
|
49
58
|
|
|
50
59
|
var _useState = useState([]),
|
|
@@ -68,6 +77,16 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
68
77
|
value = _useState6[0],
|
|
69
78
|
setValue = _useState6[1];
|
|
70
79
|
|
|
80
|
+
var _useState7 = useState(true),
|
|
81
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
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];
|
|
89
|
+
|
|
71
90
|
var envNameList = useMemo(function () {
|
|
72
91
|
return eventEnvList ? eventEnvList.map(function (env) {
|
|
73
92
|
return env.name;
|
|
@@ -82,15 +101,39 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
82
101
|
}, [userPropList]);
|
|
83
102
|
useEffect(function () {
|
|
84
103
|
initShowList();
|
|
104
|
+
|
|
105
|
+
if (props.openCdpCondition && (!menuNameMap || menuNameMap['dataset'])) {
|
|
106
|
+
getDatasetList();
|
|
107
|
+
} else {
|
|
108
|
+
setLoading(false);
|
|
109
|
+
}
|
|
85
110
|
}, []);
|
|
86
111
|
|
|
87
112
|
function initShowList() {
|
|
88
113
|
var showList = [];
|
|
114
|
+
var showTag = openTagCondition && (!menuNameMap || menuNameMap['userTags']);
|
|
115
|
+
var showCdp = openCdpCondition && (!menuNameMap || menuNameMap['dataset']);
|
|
89
116
|
value.forEach(function (item) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
117
|
+
var showItem = _toConsumableArray(item);
|
|
118
|
+
|
|
119
|
+
if (!(showTag && showCdp)) {
|
|
120
|
+
item.forEach(function (data, index) {
|
|
121
|
+
if (data.dataset && !showCdp) {
|
|
122
|
+
showItem.splice(index, 1);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (data.labels && !showTag) {
|
|
126
|
+
showItem.splice(index, 1);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (showItem.length > 0) {
|
|
132
|
+
showList.push({
|
|
133
|
+
id: Math.random(),
|
|
134
|
+
orConditions: showItem
|
|
135
|
+
});
|
|
136
|
+
}
|
|
94
137
|
});
|
|
95
138
|
setShowList(showList);
|
|
96
139
|
setDataList(showList);
|
|
@@ -140,16 +183,39 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
140
183
|
props.onChange && props.onChange(newValue);
|
|
141
184
|
}
|
|
142
185
|
|
|
186
|
+
function getDatasetList() {
|
|
187
|
+
request(Apis.queryDatasetList, {
|
|
188
|
+
method: 'post',
|
|
189
|
+
data: {
|
|
190
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
191
|
+
platform: currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform
|
|
192
|
+
}
|
|
193
|
+
}).then(function (result) {
|
|
194
|
+
setDataset(result.data || []);
|
|
195
|
+
setLoading(false);
|
|
196
|
+
}).catch(function (e) {
|
|
197
|
+
console.error(e);
|
|
198
|
+
setDataset([]);
|
|
199
|
+
setLoading(false);
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (loading) {
|
|
204
|
+
return /*#__PURE__*/React.createElement(Spin, null);
|
|
205
|
+
}
|
|
206
|
+
|
|
143
207
|
return /*#__PURE__*/React.createElement(BizUserConditionContext.Provider, {
|
|
144
208
|
value: {
|
|
145
209
|
orConditionNum: props.orConditionNum || 2,
|
|
146
210
|
eventAttrNum: props.eventAttrNum || 1,
|
|
147
211
|
textMode: props.textMode,
|
|
148
212
|
openTagCondition: openTagCondition,
|
|
213
|
+
openCdpCondition: openCdpCondition,
|
|
149
214
|
userTagsData: userTagsData !== null && userTagsData !== void 0 ? userTagsData : [],
|
|
150
215
|
isRealTime: props.isRealTime,
|
|
151
216
|
envNameList: envNameList,
|
|
152
|
-
userPropsMap: userPropsMap
|
|
217
|
+
userPropsMap: userPropsMap,
|
|
218
|
+
datasetList: dataset
|
|
153
219
|
}
|
|
154
220
|
}, /*#__PURE__*/React.createElement("div", {
|
|
155
221
|
className: classPrefix
|
|
@@ -172,7 +238,11 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
172
238
|
show: value.length < andConditionNum,
|
|
173
239
|
label: "\u4E14",
|
|
174
240
|
onAdd: onAdd
|
|
175
|
-
}))
|
|
241
|
+
}), openCdpCondition && (!menuNameMap || menuNameMap['dataset']) ? /*#__PURE__*/React.createElement("div", {
|
|
242
|
+
className: "".concat(classPrefix, "-tip")
|
|
243
|
+
}, ' ', /*#__PURE__*/React.createElement(IconFont, {
|
|
244
|
+
type: "tishiicon"
|
|
245
|
+
}), "\u660E\u7EC6\u8868\u4E2D\u9700\u5B58\u5728\u300Cuser_id\u300D\u6761\u4EF6\u65B9\u53EF\u751F\u6548\u3002") : null));
|
|
176
246
|
};
|
|
177
247
|
|
|
178
248
|
BizUserCondition.defaultProps = {
|
|
@@ -32,12 +32,14 @@ import EventCondition from './conditions/eventCondition';
|
|
|
32
32
|
import TagsCondition from './conditions/tagsCondition';
|
|
33
33
|
import { classPrefix } from '.';
|
|
34
34
|
import Text from './conditions/textDesc';
|
|
35
|
+
import CdpCondition from './conditions/cdpCondition';
|
|
35
36
|
|
|
36
37
|
var OrConditions = function OrConditions(props) {
|
|
37
38
|
var _useContext = useContext(BizUserConditionContext),
|
|
38
39
|
orConditionNum = _useContext.orConditionNum,
|
|
39
40
|
textMode = _useContext.textMode,
|
|
40
|
-
openTagCondition = _useContext.openTagCondition
|
|
41
|
+
openTagCondition = _useContext.openTagCondition,
|
|
42
|
+
openCdpCondition = _useContext.openCdpCondition;
|
|
41
43
|
|
|
42
44
|
var orConditions = props.orConditions,
|
|
43
45
|
showAndDesc = props.showAndDesc;
|
|
@@ -121,6 +123,10 @@ var OrConditions = function OrConditions(props) {
|
|
|
121
123
|
changeData('tag', id, newTags);
|
|
122
124
|
}
|
|
123
125
|
|
|
126
|
+
function onChangeCdp(id, newCdp) {
|
|
127
|
+
changeData('cdp', id, newCdp);
|
|
128
|
+
}
|
|
129
|
+
|
|
124
130
|
function changeData(type, id, newData) {
|
|
125
131
|
var newValue = [];
|
|
126
132
|
showList.forEach(function (data) {
|
|
@@ -133,6 +139,8 @@ var OrConditions = function OrConditions(props) {
|
|
|
133
139
|
data.condition = newData;
|
|
134
140
|
} else if (type === 'tag') {
|
|
135
141
|
data.condition.labels = newData;
|
|
142
|
+
} else if (type === 'cdp') {
|
|
143
|
+
data.condition.dataset = newData;
|
|
136
144
|
}
|
|
137
145
|
}
|
|
138
146
|
|
|
@@ -185,34 +193,45 @@ var OrConditions = function OrConditions(props) {
|
|
|
185
193
|
dataId: id,
|
|
186
194
|
onChange: onChangeTags
|
|
187
195
|
});
|
|
188
|
-
} else if (condition.
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
196
|
+
} else if (condition.dataset) {
|
|
197
|
+
if (!openCdpCondition) return null;
|
|
198
|
+
conditionDom = /*#__PURE__*/React.createElement(CdpCondition, {
|
|
199
|
+
defaultValue: condition,
|
|
192
200
|
dataId: id,
|
|
193
|
-
onChange:
|
|
201
|
+
onChange: onChangeCdp
|
|
194
202
|
});
|
|
195
|
-
} else
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
203
|
+
} else {
|
|
204
|
+
var conditionData = condition;
|
|
205
|
+
|
|
206
|
+
if (conditionData.eventId === undefined) {
|
|
207
|
+
conditionDom = /*#__PURE__*/React.createElement(PropCondition, {
|
|
208
|
+
label: "\u5C5E\u6027",
|
|
209
|
+
attrs: conditionData.attrs,
|
|
210
|
+
dataId: id,
|
|
211
|
+
onChange: onChangeAttrs
|
|
212
|
+
});
|
|
213
|
+
} else if (String(conditionData.eventId) === '-3') {
|
|
214
|
+
conditionDom = /*#__PURE__*/React.createElement(PeriodCondition, {
|
|
215
|
+
label: "\u65B0\u589E\u4E8E",
|
|
216
|
+
dataId: id,
|
|
217
|
+
onChange: onChangeRunPeriod,
|
|
218
|
+
runPeriod: conditionData.runPeriod
|
|
219
|
+
});
|
|
220
|
+
} else if (String(conditionData.eventId) === '-4') {
|
|
221
|
+
conditionDom = /*#__PURE__*/React.createElement(PeriodCondition, {
|
|
222
|
+
label: "\u6D3B\u8DC3\u4E8E",
|
|
223
|
+
isRealTime: true,
|
|
224
|
+
dataId: id,
|
|
225
|
+
onChange: onChangeRunPeriod,
|
|
226
|
+
runPeriod: conditionData.runPeriod
|
|
227
|
+
});
|
|
228
|
+
} else if (util.isNumber(conditionData.eventId)) {
|
|
229
|
+
conditionDom = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EventCondition, {
|
|
230
|
+
dataId: id,
|
|
231
|
+
onChange: onChangeEvent,
|
|
232
|
+
condition: condition
|
|
233
|
+
}));
|
|
234
|
+
}
|
|
216
235
|
}
|
|
217
236
|
|
|
218
237
|
return /*#__PURE__*/React.createElement(ConditionWrap, {
|
|
@@ -15,8 +15,16 @@ export interface AllConditionBasePropsI<T> {
|
|
|
15
15
|
dataId: number;
|
|
16
16
|
onChange: (dataId: number, newData: T) => void;
|
|
17
17
|
}
|
|
18
|
+
export declare enum PropType {
|
|
19
|
+
STRING = "cont-string",
|
|
20
|
+
NUMBER = "cont-num",
|
|
21
|
+
DATE = "cont-date",
|
|
22
|
+
STRING2 = "string",
|
|
23
|
+
NUMBER2 = "number",
|
|
24
|
+
DATE2 = "date"
|
|
25
|
+
}
|
|
18
26
|
export declare namespace BizUserConditionT {
|
|
19
|
-
type ConditionType = 'add' | 'active' | 'event' | 'prop' | 'tag';
|
|
27
|
+
type ConditionType = 'add' | 'active' | 'event' | 'prop' | 'tag' | 'cdp';
|
|
20
28
|
interface PropsI {
|
|
21
29
|
defaultValue: BizUserConditionT.Conditions;
|
|
22
30
|
onChange: (value: any[]) => void;
|
|
@@ -27,6 +35,7 @@ export declare namespace BizUserConditionT {
|
|
|
27
35
|
openTagCondition?: boolean;
|
|
28
36
|
userTagsData?: UserTagsDataI[];
|
|
29
37
|
isRealTime?: boolean;
|
|
38
|
+
openCdpCondition?: boolean;
|
|
30
39
|
}
|
|
31
40
|
interface UserTagsDataI {
|
|
32
41
|
appId: number;
|
|
@@ -91,18 +100,44 @@ export declare namespace BizUserConditionT {
|
|
|
91
100
|
attrs: AttrCondition[];
|
|
92
101
|
eventId: undefined;
|
|
93
102
|
}
|
|
94
|
-
|
|
103
|
+
interface CdpDataSet {
|
|
104
|
+
id: number;
|
|
105
|
+
datasetName: string;
|
|
106
|
+
tableName: string;
|
|
107
|
+
}
|
|
108
|
+
interface CdpDataSetDetail {
|
|
109
|
+
name?: string;
|
|
110
|
+
type?: string;
|
|
111
|
+
webType?: PropType;
|
|
112
|
+
}
|
|
113
|
+
interface CdpConditionDetail {
|
|
114
|
+
datasetId?: number;
|
|
115
|
+
datasetTable?: string;
|
|
116
|
+
datasetName?: string;
|
|
117
|
+
fieldName?: string;
|
|
118
|
+
fieldType?: string;
|
|
119
|
+
webType?: PropType;
|
|
120
|
+
operator?: string;
|
|
121
|
+
params?: string[];
|
|
122
|
+
paramType?: PropType;
|
|
123
|
+
}
|
|
124
|
+
interface CdpCondition {
|
|
125
|
+
dataset: (BizUserConditionT.CdpConditionDetail | undefined)[];
|
|
126
|
+
}
|
|
127
|
+
type Condition = EventCondition | AddCondition | ActiveCondition | PropCondition | TagsCondition | CdpCondition;
|
|
95
128
|
type Conditions = Condition[][];
|
|
129
|
+
type OtherCondition = EventCondition | AddCondition | ActiveCondition | PropCondition;
|
|
96
130
|
interface ShowItemI {
|
|
97
131
|
id: number;
|
|
98
132
|
orConditions: Conditions[number];
|
|
99
133
|
}
|
|
100
134
|
type ShowListT = ShowItemI[];
|
|
101
|
-
type GlobalContext = Pick<BizUserConditionT.PropsI, 'orConditionNum' | 'eventAttrNum' | 'openTagCondition' | 'userTagsData' | 'textMode' | 'isRealTime'> & {
|
|
135
|
+
type GlobalContext = Pick<BizUserConditionT.PropsI, 'orConditionNum' | 'eventAttrNum' | 'openTagCondition' | 'userTagsData' | 'openCdpCondition' | 'textMode' | 'isRealTime'> & {
|
|
102
136
|
envNameList: string[];
|
|
103
137
|
userPropsMap: {
|
|
104
138
|
[key: string]: UserProp;
|
|
105
139
|
};
|
|
140
|
+
datasetList: CdpDataSet[];
|
|
106
141
|
};
|
|
107
142
|
}
|
|
108
143
|
export declare namespace OrConditionsT {
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
export
|
|
1
|
+
export var PropType;
|
|
2
|
+
|
|
3
|
+
(function (PropType) {
|
|
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";
|
|
10
|
+
})(PropType || (PropType = {}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GlobalContextProps } from '../context';
|
|
2
2
|
import type { BizUserConditionT, Unpacked } from './types';
|
|
3
|
-
export declare function buildCondition(type: BizUserConditionT.ConditionType): BizUserConditionT.EventCondition | BizUserConditionT.AddCondition | BizUserConditionT.ActiveCondition | BizUserConditionT.PropCondition;
|
|
3
|
+
export declare function buildCondition(type: BizUserConditionT.ConditionType): BizUserConditionT.EventCondition | BizUserConditionT.AddCondition | BizUserConditionT.ActiveCondition | BizUserConditionT.PropCondition | BizUserConditionT.CdpCondition;
|
|
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;
|
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.1.
|
|
3
|
+
"version": "1.1.3-user.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.12.0 || ^17.0.0",
|
|
61
61
|
"yorkie": "^2.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "513c2967ae788c511226f44e778f204eecd9086e"
|
|
64
64
|
}
|