@zgfe/business-lib 1.0.15-user.6 → 1.0.15-user.9
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/resetAntd.less +15 -8
- package/es/attrConditions/demo/index.js +9 -7
- package/es/attrConditions/styles/index.less +2 -2
- package/es/userCondition/conditions/constants.d.ts +3 -0
- package/es/userCondition/conditions/constants.js +25 -5
- package/es/userCondition/conditions/eventCondition.js +0 -1
- package/es/userCondition/conditions/periodCondition.js +1 -0
- package/es/userCondition/conditions/propCondition.js +9 -10
- package/es/userCondition/conditions/styles/eventCondition.less +1 -1
- package/es/userCondition/conditions/styles/periodCondition.less +8 -0
- package/es/userCondition/conditions/styles/propCondition.less +8 -0
- package/es/userCondition/conditions/textDesc.js +54 -20
- package/es/userCondition/demo/index.js +57 -31
- package/es/userCondition/index.d.ts +1 -1
- package/es/userCondition/index.js +24 -3
- package/es/userCondition/orConditions.js +1 -2
- package/es/userCondition/styles/orConditions.less +1 -1
- package/es/userCondition/styles/relationLabel.less +1 -1
- package/es/userCondition/types.d.ts +7 -0
- package/es/userTagsSelector/demo/index.js +1 -1
- package/es/userTagsSelector/multipleCheckPanel/styles/option.less +1 -0
- package/es/userTagsSelector/styles/cascaderOverlay.less +6 -6
- package/package.json +3 -3
|
@@ -144,6 +144,14 @@
|
|
|
144
144
|
.ant-picker-active-bar {
|
|
145
145
|
display: none !important;
|
|
146
146
|
}
|
|
147
|
+
|
|
148
|
+
&.ant-picker-range {
|
|
149
|
+
background-color: @background-color-base;
|
|
150
|
+
border: none;
|
|
151
|
+
&.ant-picker-large {
|
|
152
|
+
height: 40px;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
147
155
|
}
|
|
148
156
|
|
|
149
157
|
/*日历下拉框*/
|
|
@@ -298,14 +306,14 @@
|
|
|
298
306
|
|
|
299
307
|
.ant-modal-body {
|
|
300
308
|
max-height: 400px;
|
|
301
|
-
// &:not(:last-child) {
|
|
302
|
-
// padding-bottom: 0;
|
|
303
|
-
// }
|
|
304
309
|
max-height: 400px !important;
|
|
305
310
|
padding-top: @padding-xs !important;
|
|
306
|
-
padding-bottom: 0 !important;
|
|
311
|
+
// padding-bottom: 0 !important;
|
|
307
312
|
overflow: auto;
|
|
308
313
|
overflow: auto !important;
|
|
314
|
+
&:not(:last-child) {
|
|
315
|
+
padding-bottom: 0 !important;
|
|
316
|
+
}
|
|
309
317
|
}
|
|
310
318
|
}
|
|
311
319
|
|
|
@@ -375,10 +383,6 @@
|
|
|
375
383
|
&::before {
|
|
376
384
|
width: 0 !important;
|
|
377
385
|
}
|
|
378
|
-
|
|
379
|
-
&.ant-table-cell-fix-left-last {
|
|
380
|
-
border-right: 1px solid @border-color-base!important;
|
|
381
|
-
}
|
|
382
386
|
}
|
|
383
387
|
|
|
384
388
|
.ant-table-tbody {
|
|
@@ -480,3 +484,6 @@
|
|
|
480
484
|
.ant-message {
|
|
481
485
|
z-index: 99999 !important;
|
|
482
486
|
}
|
|
487
|
+
|
|
488
|
+
.ant-picker {
|
|
489
|
+
}
|
|
@@ -23,13 +23,15 @@ export default (function () {
|
|
|
23
23
|
|
|
24
24
|
var _useState = useState({
|
|
25
25
|
condition: {
|
|
26
|
-
attrId:
|
|
27
|
-
propCategory: '
|
|
28
|
-
type:
|
|
29
|
-
operator: '
|
|
30
|
-
values: ['
|
|
31
|
-
dimensionSub: '
|
|
32
|
-
attrName: '
|
|
26
|
+
attrId: 0,
|
|
27
|
+
propCategory: 'userProp',
|
|
28
|
+
type: 2,
|
|
29
|
+
operator: 'gt',
|
|
30
|
+
values: ['72000', '1'],
|
|
31
|
+
dimensionSub: 'duration',
|
|
32
|
+
attrName: 'duration',
|
|
33
|
+
category: 'fixed',
|
|
34
|
+
subtype: 2
|
|
33
35
|
}
|
|
34
36
|
}),
|
|
35
37
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -61,15 +61,15 @@
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
&-input {
|
|
64
|
+
flex: 1;
|
|
64
65
|
.ant-input-group-addon {
|
|
65
|
-
background-color: @background-color-gray !important;
|
|
66
|
+
// background-color: @background-color-gray !important;
|
|
66
67
|
border: none;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
&-select {
|
|
70
71
|
width: 60px;
|
|
71
72
|
border: none;
|
|
72
|
-
border-left: 1px solid @border-color-split;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -13,9 +13,29 @@ export var operatorMap = {
|
|
|
13
13
|
'not begin with': '开头不是',
|
|
14
14
|
'end with': '结尾是',
|
|
15
15
|
'not end with': '结尾不是',
|
|
16
|
-
'=': '',
|
|
17
|
-
'<': '',
|
|
18
|
-
'>': '',
|
|
19
|
-
'>=': '',
|
|
20
|
-
'<=': ''
|
|
16
|
+
'=': '=',
|
|
17
|
+
'<': '<',
|
|
18
|
+
'>': '>',
|
|
19
|
+
'>=': '≥',
|
|
20
|
+
'<=': '≤'
|
|
21
|
+
};
|
|
22
|
+
export var durationHandler = {
|
|
23
|
+
1: {
|
|
24
|
+
unit: '时',
|
|
25
|
+
format: function format(s) {
|
|
26
|
+
return Number(s) / 3600;
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
2: {
|
|
30
|
+
unit: '分',
|
|
31
|
+
format: function format(s) {
|
|
32
|
+
return Number(s) / 60;
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
3: {
|
|
36
|
+
unit: '秒',
|
|
37
|
+
format: function format(s) {
|
|
38
|
+
return s;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
21
41
|
};
|
|
@@ -118,6 +118,7 @@ var PeriodCondition = function PeriodCondition(props) {
|
|
|
118
118
|
|
|
119
119
|
if (operator === 'absolute') {
|
|
120
120
|
return /*#__PURE__*/React.createElement(RangePicker, {
|
|
121
|
+
size: "large",
|
|
121
122
|
defaultValue: [moment(values[0]), moment(values[1])],
|
|
122
123
|
onChange: onDateChange,
|
|
123
124
|
allowClear: false
|
|
@@ -24,7 +24,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
24
24
|
|
|
25
25
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
26
|
|
|
27
|
-
import React, { useEffect,
|
|
27
|
+
import React, { useEffect, useState } from 'react';
|
|
28
28
|
import { PlusOutlined } from '@ant-design/icons';
|
|
29
29
|
import BizConditionItem from '../../attrConditions';
|
|
30
30
|
import './styles/propCondition.less';
|
|
@@ -32,7 +32,6 @@ import { useContext } from 'react';
|
|
|
32
32
|
import { BizUserConditionContext, classPrefix } from '..';
|
|
33
33
|
import { transformNumberOperate } from '../util';
|
|
34
34
|
import { PropType } from '../../attributeSelector/types';
|
|
35
|
-
import BizGlobalDataContext from '../../context';
|
|
36
35
|
var numAttrTypeMap = {
|
|
37
36
|
1: 'cont-string',
|
|
38
37
|
2: 'cont-num',
|
|
@@ -45,8 +44,9 @@ var attrNumTypeMap = {
|
|
|
45
44
|
};
|
|
46
45
|
|
|
47
46
|
var PropCondition = function PropCondition(props) {
|
|
48
|
-
var _useContext = useContext(
|
|
49
|
-
|
|
47
|
+
var _useContext = useContext(BizUserConditionContext),
|
|
48
|
+
envNameList = _useContext.envNameList,
|
|
49
|
+
userPropsMap = _useContext.userPropsMap;
|
|
50
50
|
|
|
51
51
|
var _useContext2 = useContext(BizUserConditionContext),
|
|
52
52
|
eventAttrNum = _useContext2.eventAttrNum;
|
|
@@ -62,11 +62,6 @@ var PropCondition = function PropCondition(props) {
|
|
|
62
62
|
showList = _useState2[0],
|
|
63
63
|
setShowList = _useState2[1];
|
|
64
64
|
|
|
65
|
-
var envNames = useMemo(function () {
|
|
66
|
-
return eventEnvList ? eventEnvList.map(function (env) {
|
|
67
|
-
return env.name;
|
|
68
|
-
}) : [];
|
|
69
|
-
}, [eventEnvList]);
|
|
70
65
|
useEffect(function () {
|
|
71
66
|
buildDefault();
|
|
72
67
|
}, []);
|
|
@@ -142,7 +137,7 @@ var PropCondition = function PropCondition(props) {
|
|
|
142
137
|
function getPropCategory(attrName) {
|
|
143
138
|
if (!isEvent) return 'userProp';
|
|
144
139
|
if (attrName === undefined) return 'eventProp';
|
|
145
|
-
if (
|
|
140
|
+
if (envNameList.includes(attrName)) return 'envProp';
|
|
146
141
|
return 'eventProp';
|
|
147
142
|
}
|
|
148
143
|
|
|
@@ -167,6 +162,10 @@ var PropCondition = function PropCondition(props) {
|
|
|
167
162
|
type: attrNumTypeMap[attrType]
|
|
168
163
|
};
|
|
169
164
|
attrId && (props.defaultValue.attrId = attrId);
|
|
165
|
+
|
|
166
|
+
if (userPropsMap[attrName] && userPropsMap[attrName].subtype) {
|
|
167
|
+
props.defaultValue.subtype = userPropsMap[attrName].subtype;
|
|
168
|
+
}
|
|
170
169
|
}
|
|
171
170
|
|
|
172
171
|
if (isEvent) {
|
|
@@ -2,20 +2,23 @@ import React, { useContext, useMemo } from 'react';
|
|
|
2
2
|
import { BizUserConditionContext, classPrefix } from '..';
|
|
3
3
|
import BizGlobalDataContext from '../../context';
|
|
4
4
|
import { findEvent, findPropAndEnv, findTagFactory } from '../util';
|
|
5
|
-
import { operatorMap } from './constants';
|
|
5
|
+
import { durationHandler, operatorMap } from './constants';
|
|
6
6
|
import './styles/textDesc.less';
|
|
7
7
|
|
|
8
8
|
var Text = function Text(props) {
|
|
9
|
+
var _useContext = useContext(BizUserConditionContext),
|
|
10
|
+
userPropsMap = _useContext.userPropsMap;
|
|
11
|
+
|
|
9
12
|
var condition = props.condition,
|
|
10
13
|
showOrDesc = props.showOrDesc;
|
|
11
14
|
|
|
12
|
-
var
|
|
13
|
-
eventGroupList =
|
|
14
|
-
userPropList =
|
|
15
|
-
eventEnvList =
|
|
15
|
+
var _useContext2 = useContext(BizGlobalDataContext),
|
|
16
|
+
eventGroupList = _useContext2.eventGroupList,
|
|
17
|
+
userPropList = _useContext2.userPropList,
|
|
18
|
+
eventEnvList = _useContext2.eventEnvList;
|
|
16
19
|
|
|
17
|
-
var
|
|
18
|
-
userTagsData =
|
|
20
|
+
var _useContext3 = useContext(BizUserConditionContext),
|
|
21
|
+
userTagsData = _useContext3.userTagsData;
|
|
19
22
|
|
|
20
23
|
function render() {
|
|
21
24
|
if (condition.labels) {
|
|
@@ -67,7 +70,7 @@ var Text = function Text(props) {
|
|
|
67
70
|
} : {}
|
|
68
71
|
}, /*#__PURE__*/React.createElement("span", {
|
|
69
72
|
className: "label"
|
|
70
|
-
}, label.before), /*#__PURE__*/React.createElement("span", null,
|
|
73
|
+
}, label.before), period.operator === 'relative' ? /*#__PURE__*/React.createElement("span", null, "\u6700\u8FD1") : null, valuesDom);
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
function renderProps(attr, type) {
|
|
@@ -84,13 +87,7 @@ var Text = function Text(props) {
|
|
|
84
87
|
}
|
|
85
88
|
}, /*#__PURE__*/React.createElement("span", {
|
|
86
89
|
className: "".concat(classPrefix, "-text-desc-label")
|
|
87
|
-
}, (_data = data) === null || _data === void 0 ? void 0 : _data.label),
|
|
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
|
-
})));
|
|
90
|
+
}, (_data = data) === null || _data === void 0 ? void 0 : _data.label), renderPropValues(attr));
|
|
94
91
|
}
|
|
95
92
|
}
|
|
96
93
|
|
|
@@ -139,11 +136,7 @@ var Text = function Text(props) {
|
|
|
139
136
|
if (label) {
|
|
140
137
|
var dom = /*#__PURE__*/React.createElement("span", {
|
|
141
138
|
key: i
|
|
142
|
-
}, /*#__PURE__*/React.createElement("span", null, label), /*#__PURE__*/React.createElement("span", null,
|
|
143
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
144
|
-
key: i
|
|
145
|
-
}, i > 0 ? '或' : '', param);
|
|
146
|
-
})), /*#__PURE__*/React.createElement("span", null, i !== attrs.length - 1 ? ',' : ''));
|
|
139
|
+
}, /*#__PURE__*/React.createElement("span", null, label), /*#__PURE__*/React.createElement("span", null, renderPropValues(attr)), i !== attrs.length - 1 ? ',' : '');
|
|
147
140
|
attrsDom.push(dom);
|
|
148
141
|
}
|
|
149
142
|
});
|
|
@@ -184,6 +177,47 @@ var Text = function Text(props) {
|
|
|
184
177
|
}), /*#__PURE__*/React.createElement("span", null, ")")));
|
|
185
178
|
}
|
|
186
179
|
|
|
180
|
+
function renderPropValues(attr) {
|
|
181
|
+
if (attr.attrType === 'cont-date') {
|
|
182
|
+
return renderDateValues(attr.operator, attr.params);
|
|
183
|
+
} else if (attr.attrType === 'cont-num') {
|
|
184
|
+
return renderNumValues(attr);
|
|
185
|
+
} else if (attr.attrType === 'cont-string') {
|
|
186
|
+
return renderStringValues(attr);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function renderStringValues(attr) {
|
|
191
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
192
|
+
className: "".concat(classPrefix, "-text-desc-operator")
|
|
193
|
+
}, operatorMap[attr.operator]), /*#__PURE__*/React.createElement("span", {
|
|
194
|
+
className: "".concat(classPrefix, "-text-desc-value")
|
|
195
|
+
}, attr.params.map(function (param, i) {
|
|
196
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
197
|
+
key: param
|
|
198
|
+
}, i > 0 ? /*#__PURE__*/React.createElement("span", null, "\u6216") : null, /*#__PURE__*/React.createElement("span", null, param));
|
|
199
|
+
})));
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function renderNumValues(attr) {
|
|
203
|
+
if (userPropsMap[attr.attrName] && userPropsMap[attr.attrName].subtype === 2) {
|
|
204
|
+
var handler = durationHandler[attr.params[1]];
|
|
205
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, operatorMap[attr.operator]), /*#__PURE__*/React.createElement("span", null, handler.format(attr.params[0])), /*#__PURE__*/React.createElement("span", null, handler.unit));
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, operatorMap[attr.operator]), /*#__PURE__*/React.createElement("span", null, attr.params[0]));
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function renderDateValues(operator, params) {
|
|
212
|
+
if (operator === 'relative') {
|
|
213
|
+
return /*#__PURE__*/React.createElement("span", null, "\u4E3A\u6700\u8FD1".concat(params[0], "\u5929"));
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (operator === 'absolute') {
|
|
217
|
+
return /*#__PURE__*/React.createElement("span", null, "\u4E3A".concat(params[0], "\u5230").concat(params[1]));
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
187
221
|
var findTag = useMemo(function () {
|
|
188
222
|
return findTagFactory(userTagsData);
|
|
189
223
|
}, [userTagsData]);
|
|
@@ -150,54 +150,79 @@ var getTagList = Promise.resolve([{
|
|
|
150
150
|
}]);
|
|
151
151
|
var data = {
|
|
152
152
|
json: [[{
|
|
153
|
+
eventId: '-4',
|
|
154
|
+
attrs: [],
|
|
155
|
+
runPeriod: {
|
|
156
|
+
operator: 'relative',
|
|
157
|
+
values: ['30', '1']
|
|
158
|
+
},
|
|
159
|
+
runTimes: {
|
|
160
|
+
operator: '>=',
|
|
161
|
+
values: ['1']
|
|
162
|
+
}
|
|
163
|
+
}, {
|
|
164
|
+
eventId: '-3',
|
|
165
|
+
attrs: [],
|
|
166
|
+
runPeriod: {
|
|
167
|
+
operator: 'absolute',
|
|
168
|
+
values: ['2022-07-13', '2022-07-19']
|
|
169
|
+
},
|
|
170
|
+
runTimes: {
|
|
171
|
+
operator: '>=',
|
|
172
|
+
values: ['1']
|
|
173
|
+
}
|
|
174
|
+
}], [{
|
|
153
175
|
attrs: [{
|
|
154
|
-
attrId:
|
|
155
|
-
attrName: '
|
|
156
|
-
|
|
176
|
+
attrId: 0,
|
|
177
|
+
attrName: 'zg_id',
|
|
178
|
+
operator: '>',
|
|
179
|
+
params: ['20'],
|
|
180
|
+
attrType: 'cont-num',
|
|
181
|
+
category: 'fixed'
|
|
182
|
+
}]
|
|
183
|
+
}, {
|
|
184
|
+
attrs: [{
|
|
185
|
+
attrId: 0,
|
|
186
|
+
attrName: 'app_user_id',
|
|
157
187
|
operator: 'equal',
|
|
158
|
-
params: ['
|
|
159
|
-
attrType: 'cont-string'
|
|
188
|
+
params: ['20'],
|
|
189
|
+
attrType: 'cont-string',
|
|
190
|
+
category: 'fixed'
|
|
191
|
+
}]
|
|
192
|
+
}], [{
|
|
193
|
+
attrs: [{
|
|
194
|
+
attrId: 0,
|
|
195
|
+
attrName: 'duration',
|
|
196
|
+
operator: '>',
|
|
197
|
+
params: [1198800, '1'],
|
|
198
|
+
attrType: 'cont-num',
|
|
199
|
+
category: 'fixed'
|
|
160
200
|
}]
|
|
161
201
|
}, {
|
|
162
|
-
eventId:
|
|
202
|
+
eventId: 24143017,
|
|
163
203
|
runTimes: {
|
|
164
204
|
operator: '>=',
|
|
165
205
|
values: ['1']
|
|
166
206
|
},
|
|
167
207
|
attrs: [{
|
|
168
|
-
attrId:
|
|
169
|
-
attrName: '
|
|
208
|
+
attrId: 0,
|
|
209
|
+
attrName: 'resolution_l',
|
|
210
|
+
category: 'fixed',
|
|
211
|
+
operator: '>',
|
|
212
|
+
params: ['10'],
|
|
213
|
+
attrType: 'cont-num'
|
|
214
|
+
}, {
|
|
215
|
+
attrId: 30183430,
|
|
216
|
+
attrName: '扫码场景描述',
|
|
170
217
|
category: 'custom',
|
|
171
218
|
operator: 'equal',
|
|
172
|
-
params: ['
|
|
219
|
+
params: ['Microsoft Edge', 'Safari', 'Apple WebKit'],
|
|
173
220
|
attrType: 'cont-string'
|
|
174
221
|
}],
|
|
175
222
|
runPeriod: {
|
|
176
223
|
operator: 'relative',
|
|
177
224
|
values: ['30', '0']
|
|
178
225
|
}
|
|
179
|
-
}], [{
|
|
180
|
-
eventId: '-3',
|
|
181
|
-
runPeriod: {
|
|
182
|
-
operator: 'relative',
|
|
183
|
-
values: ['30', '0']
|
|
184
|
-
},
|
|
185
|
-
runTimes: {
|
|
186
|
-
operator: '>=',
|
|
187
|
-
values: ['1']
|
|
188
|
-
},
|
|
189
|
-
attrs: []
|
|
190
|
-
}, {
|
|
191
|
-
eventId: '-4',
|
|
192
|
-
runPeriod: {
|
|
193
|
-
operator: 'relative',
|
|
194
|
-
values: ['30', '1']
|
|
195
|
-
},
|
|
196
|
-
runTimes: {
|
|
197
|
-
operator: '>=',
|
|
198
|
-
values: ['1']
|
|
199
|
-
},
|
|
200
|
-
attrs: []
|
|
201
226
|
}]]
|
|
202
227
|
};
|
|
203
228
|
export default (function () {
|
|
@@ -251,6 +276,7 @@ export default (function () {
|
|
|
251
276
|
}
|
|
252
277
|
|
|
253
278
|
var descDom = /*#__PURE__*/React.createElement(BizUserCondition, {
|
|
279
|
+
textMode: true,
|
|
254
280
|
defaultValue: defaultValue,
|
|
255
281
|
onChange: onChange,
|
|
256
282
|
eventAttrNum: 3,
|
|
@@ -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<
|
|
4
|
+
export declare const BizUserConditionContext: React.Context<BizUserConditionT.GlobalContext>;
|
|
5
5
|
export declare const classPrefix = "biz-user-condition";
|
|
6
6
|
declare const BizUserCondition: React.FC<BizUserConditionT.PropsI>;
|
|
7
7
|
export default BizUserCondition;
|
|
@@ -18,23 +18,30 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
18
18
|
|
|
19
19
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
20
|
|
|
21
|
-
import React, { createContext, useEffect, useState } from 'react';
|
|
21
|
+
import React, { createContext, useContext, useEffect, useMemo, useState } from 'react';
|
|
22
22
|
import ConditionTypeList from './conditionTypeList';
|
|
23
23
|
import RelationLabel from './relationLabel';
|
|
24
24
|
import OrConditions from './orConditions';
|
|
25
25
|
import './styles/index.less';
|
|
26
26
|
import { buildCondition } from './util';
|
|
27
27
|
import _ from 'lodash';
|
|
28
|
+
import BizGlobalDataContext from '../context';
|
|
28
29
|
export var BizUserConditionContext = /*#__PURE__*/createContext({
|
|
29
30
|
orConditionNum: 2,
|
|
30
31
|
eventAttrNum: 1,
|
|
31
32
|
textMode: false,
|
|
32
33
|
openTagCondition: false,
|
|
33
|
-
userTagsData: []
|
|
34
|
+
userTagsData: [],
|
|
35
|
+
envNameList: [],
|
|
36
|
+
userPropsMap: {}
|
|
34
37
|
});
|
|
35
38
|
export var classPrefix = 'biz-user-condition';
|
|
36
39
|
|
|
37
40
|
var BizUserCondition = function BizUserCondition(props) {
|
|
41
|
+
var _useContext = useContext(BizGlobalDataContext),
|
|
42
|
+
eventEnvList = _useContext.eventEnvList,
|
|
43
|
+
userPropList = _useContext.userPropList;
|
|
44
|
+
|
|
38
45
|
var andConditionNum = props.andConditionNum,
|
|
39
46
|
defaultValue = props.defaultValue,
|
|
40
47
|
openTagCondition = props.openTagCondition,
|
|
@@ -61,6 +68,18 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
61
68
|
value = _useState6[0],
|
|
62
69
|
setValue = _useState6[1];
|
|
63
70
|
|
|
71
|
+
var envNameList = useMemo(function () {
|
|
72
|
+
return eventEnvList ? eventEnvList.map(function (env) {
|
|
73
|
+
return env.name;
|
|
74
|
+
}) : [];
|
|
75
|
+
}, [eventEnvList]);
|
|
76
|
+
var userPropsMap = useMemo(function () {
|
|
77
|
+
if (!userPropList) return {};
|
|
78
|
+
return userPropList.reduce(function (pre, curr) {
|
|
79
|
+
pre[curr.name] = curr;
|
|
80
|
+
return pre;
|
|
81
|
+
}, {});
|
|
82
|
+
}, [userPropList]);
|
|
64
83
|
useEffect(function () {
|
|
65
84
|
initShowList();
|
|
66
85
|
}, []);
|
|
@@ -128,7 +147,9 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
128
147
|
textMode: props.textMode,
|
|
129
148
|
openTagCondition: openTagCondition,
|
|
130
149
|
userTagsData: userTagsData !== null && userTagsData !== void 0 ? userTagsData : [],
|
|
131
|
-
isRealTime: props.isRealTime
|
|
150
|
+
isRealTime: props.isRealTime,
|
|
151
|
+
envNameList: envNameList,
|
|
152
|
+
userPropsMap: userPropsMap
|
|
132
153
|
}
|
|
133
154
|
}, /*#__PURE__*/React.createElement("div", {
|
|
134
155
|
className: classPrefix
|
|
@@ -123,7 +123,6 @@ var OrConditions = function OrConditions(props) {
|
|
|
123
123
|
|
|
124
124
|
function changeData(type, id, newData) {
|
|
125
125
|
var newValue = [];
|
|
126
|
-
console.log(type, id, newData);
|
|
127
126
|
showList.forEach(function (data) {
|
|
128
127
|
if (id === data.id) {
|
|
129
128
|
if (type === 'period') {
|
|
@@ -174,7 +173,7 @@ var OrConditions = function OrConditions(props) {
|
|
|
174
173
|
if (textMode) {
|
|
175
174
|
return /*#__PURE__*/React.createElement(Text, {
|
|
176
175
|
showOrDesc: i > 0,
|
|
177
|
-
key:
|
|
176
|
+
key: id,
|
|
178
177
|
condition: condition
|
|
179
178
|
});
|
|
180
179
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { UserProp } from '../attributeSelector/types';
|
|
2
3
|
import { TagI } from './../userTagsSelector/types';
|
|
3
4
|
export declare type Unpacked<T, U extends keyof T> = Required<T> extends {
|
|
4
5
|
[key in U]: infer R;
|
|
@@ -79,6 +80,12 @@ export declare namespace BizUserConditionT {
|
|
|
79
80
|
orConditions: Conditions[number];
|
|
80
81
|
}
|
|
81
82
|
type ShowListT = ShowItemI[];
|
|
83
|
+
type GlobalContext = Pick<BizUserConditionT.PropsI, 'orConditionNum' | 'eventAttrNum' | 'openTagCondition' | 'userTagsData' | 'textMode' | 'isRealTime'> & {
|
|
84
|
+
envNameList: string[];
|
|
85
|
+
userPropsMap: {
|
|
86
|
+
[key: string]: UserProp;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
82
89
|
}
|
|
83
90
|
export declare namespace OrConditionsT {
|
|
84
91
|
interface PropI {
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
min-width: 0;
|
|
18
18
|
padding: @padding-xs;
|
|
19
19
|
}
|
|
20
|
-
.rc-virtual-list-scrollbar {
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
.rc-virtual-list-scrollbar-thumb {
|
|
24
|
-
|
|
25
|
-
}
|
|
20
|
+
// .rc-virtual-list-scrollbar {
|
|
21
|
+
// display: block !important;
|
|
22
|
+
// }
|
|
23
|
+
// .rc-virtual-list-scrollbar-thumb {
|
|
24
|
+
// background-color: #cacdd4 !important;
|
|
25
|
+
// }
|
|
26
26
|
}
|
|
27
27
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.0.15-user.
|
|
3
|
+
"version": "1.0.15-user.9",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@types/qs": "^6.9.7",
|
|
54
54
|
"@umijs/fabric": "^2.8.1",
|
|
55
55
|
"@umijs/test": "^3.0.5",
|
|
56
|
-
"@zgfe/business-lib": "^1.0.15-user.
|
|
56
|
+
"@zgfe/business-lib": "^1.0.15-user.9",
|
|
57
57
|
"antd": "^4.19.2",
|
|
58
58
|
"dumi": "^1.1.0",
|
|
59
59
|
"father-build": "^1.17.2",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"prettier": "^2.2.1",
|
|
63
63
|
"yorkie": "^2.0.0"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "397deba111c31b3f71818d47a8f8e2431944d2d5"
|
|
66
66
|
}
|