@zgfe/business-lib 1.1.34-alpha.6 → 1.1.34-alpha.8
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 +2 -2
- package/es/userCondition/conditions/businessCondition.js +1 -0
- package/es/userCondition/conditions/textDesc.d.ts +1 -1
- package/es/userCondition/conditions/textDesc.js +159 -1
- package/es/userCondition/orConditions.js +4 -0
- package/es/userCondition/types.d.ts +3 -2
- package/es/userCondition/util.js +1 -0
- package/package.json +1 -1
|
@@ -71,7 +71,7 @@ var ConditionTypeList = function ConditionTypeList(props) {
|
|
|
71
71
|
title: cdpTip
|
|
72
72
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
73
73
|
type: "tishiicon"
|
|
74
|
-
})) : null)) : null, (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 0 || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 2 ? /*#__PURE__*/React.createElement("li", {
|
|
74
|
+
})) : null)) : null, !currentUser || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 0 || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 2 ? /*#__PURE__*/React.createElement("li", {
|
|
75
75
|
className: "condition-type",
|
|
76
76
|
key: "business",
|
|
77
77
|
onClick: function onClick() {
|
|
@@ -79,7 +79,7 @@ var ConditionTypeList = function ConditionTypeList(props) {
|
|
|
79
79
|
}
|
|
80
80
|
}, /*#__PURE__*/React.createElement(Space, {
|
|
81
81
|
key: "business"
|
|
82
|
-
}, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u4E1A\u52A1\u6570\u636E"))) : null, (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 0 || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 2 ? /*#__PURE__*/React.createElement("li", {
|
|
82
|
+
}, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u4E1A\u52A1\u6570\u636E"))) : null, !currentUser || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 0 || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 2 ? /*#__PURE__*/React.createElement("li", {
|
|
83
83
|
className: "condition-type",
|
|
84
84
|
key: "order",
|
|
85
85
|
onClick: function onClick() {
|
|
@@ -261,6 +261,7 @@ var BusinessCondition = function BusinessCondition(props) {
|
|
|
261
261
|
}
|
|
262
262
|
function onServiceAttributeChange(operate) {
|
|
263
263
|
condition.typeId = operate === null || operate === void 0 ? void 0 : operate.value;
|
|
264
|
+
condition.typeName = operate === null || operate === void 0 ? void 0 : operate.name;
|
|
264
265
|
onChange(_objectSpread({}, condition));
|
|
265
266
|
setServiceAttribute(operate);
|
|
266
267
|
}
|
|
@@ -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 | BizUserConditionT.CdpCondition;
|
|
5
|
+
condition: BizUserConditionT.ActiveCondition | BizUserConditionT.AddCondition | BizUserConditionT.PropCondition | BizUserConditionT.EventCondition | BizUserConditionT.TagsCondition | BizUserConditionT.CdpCondition | BizUserConditionT.OrderCondition | BizUserConditionT.BusinessCondition;
|
|
6
6
|
showOrDesc: boolean;
|
|
7
7
|
}
|
|
8
8
|
declare const Text: React.FC<TextProps>;
|
|
@@ -13,6 +13,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
13
13
|
import _ from 'lodash';
|
|
14
14
|
import React, { useContext, useMemo } from 'react';
|
|
15
15
|
import { BizUserConditionContext, classPrefix } from '..';
|
|
16
|
+
import { monthTimeOperatorType, monthValuesType, skyTimeOperatorType, timeDimensionType, timeValuesType, typeList, weekTimeOperatorType, weekValuesType, orderTypeList, computeTypeList, stringOperate } from '../../attrConditions/utils/operates';
|
|
16
17
|
import BizGlobalDataContext from '../../context';
|
|
17
18
|
import { findEvent, findPropAndEnv, buildSelectLayer } from '../util';
|
|
18
19
|
import { durationHandler, operatorMap } from './constants';
|
|
@@ -36,6 +37,7 @@ var Text = function Text(props) {
|
|
|
36
37
|
return renderCdp(condition);
|
|
37
38
|
}
|
|
38
39
|
var data = condition;
|
|
40
|
+
console.log(77773333, data, props);
|
|
39
41
|
if (String(data.eventId) === '-4') {
|
|
40
42
|
return renderPeriod({
|
|
41
43
|
before: '活跃于'
|
|
@@ -49,6 +51,12 @@ var Text = function Text(props) {
|
|
|
49
51
|
if (data.eventId === undefined) {
|
|
50
52
|
return renderProps(data.attrs[0], 'user');
|
|
51
53
|
}
|
|
54
|
+
if (String(data.eventId) === '-13') {
|
|
55
|
+
return renderOrder(data);
|
|
56
|
+
}
|
|
57
|
+
if (String(data.eventId) === '-14') {
|
|
58
|
+
return renderBusiness(data);
|
|
59
|
+
}
|
|
52
60
|
if (data.eventId) {
|
|
53
61
|
return renderEvent(data);
|
|
54
62
|
}
|
|
@@ -103,6 +111,7 @@ var Text = function Text(props) {
|
|
|
103
111
|
}
|
|
104
112
|
var period = renderPeriod(periodLabel, condition.runPeriod, true);
|
|
105
113
|
var runtimes = renderRuntimes(condition.runTimes);
|
|
114
|
+
var timeDimensions = renderTimeDimensions(condition.timeDimensions);
|
|
106
115
|
var attrs = renderAttrs(event, condition.attrs);
|
|
107
116
|
return /*#__PURE__*/React.createElement("span", {
|
|
108
117
|
style: {
|
|
@@ -111,7 +120,87 @@ var Text = function Text(props) {
|
|
|
111
120
|
}
|
|
112
121
|
}, period, /*#__PURE__*/React.createElement("span", {
|
|
113
122
|
className: "".concat(classPrefix, "-text-desc-value")
|
|
114
|
-
}, event.alias || event.name), attrs, runtimes);
|
|
123
|
+
}, event.alias || event.name), attrs, timeDimensions, runtimes);
|
|
124
|
+
}
|
|
125
|
+
function renderOrder(condition) {
|
|
126
|
+
var periodLabel = {};
|
|
127
|
+
if (condition.runPeriod.operator === 'join_time') {
|
|
128
|
+
periodLabel.before = '在新增后';
|
|
129
|
+
periodLabel.after = '天内';
|
|
130
|
+
}
|
|
131
|
+
if (condition.runPeriod.operator === 'relative' || condition.runPeriod.operator === 'absolute') {
|
|
132
|
+
periodLabel.before = '在';
|
|
133
|
+
}
|
|
134
|
+
var period = renderPeriod(periodLabel, condition.runPeriod, true);
|
|
135
|
+
var frequencyValues = renderFrequencyValues(condition.runTimes.values, condition.runTimes.operator, '次数');
|
|
136
|
+
var timeDimensions = renderTimeDimensions(condition.timeDimensions);
|
|
137
|
+
var property = renderProperty(condition.attrs, '订单属性');
|
|
138
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
139
|
+
style: {
|
|
140
|
+
backgroundColor: '#fffeeb',
|
|
141
|
+
padding: '6px 7px'
|
|
142
|
+
}
|
|
143
|
+
}, "\u8BA2\u5355\u6570\u636E ", period, timeDimensions, property, frequencyValues);
|
|
144
|
+
}
|
|
145
|
+
function renderBusiness(condition) {
|
|
146
|
+
var periodLabel = {};
|
|
147
|
+
if (condition.runPeriod.operator === 'join_time') {
|
|
148
|
+
periodLabel.before = '在新增后';
|
|
149
|
+
periodLabel.after = '天内';
|
|
150
|
+
}
|
|
151
|
+
if (condition.runPeriod.operator === 'relative' || condition.runPeriod.operator === 'absolute') {
|
|
152
|
+
periodLabel.before = '在';
|
|
153
|
+
}
|
|
154
|
+
var period = renderPeriod(periodLabel, condition.runPeriod, true);
|
|
155
|
+
var frequencyValues = renderFrequencyValues(condition.runTimes.values, condition.runTimes.operator, '次数');
|
|
156
|
+
var timeDimensions = renderTimeDimensions(condition.timeDimensions);
|
|
157
|
+
var property = renderProperty(condition.attrs, '业务属性');
|
|
158
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
159
|
+
style: {
|
|
160
|
+
backgroundColor: '#fffeeb',
|
|
161
|
+
padding: '6px 7px'
|
|
162
|
+
}
|
|
163
|
+
}, condition.typeName, period, timeDimensions, property, frequencyValues);
|
|
164
|
+
}
|
|
165
|
+
function renderProperty(attrs, label) {
|
|
166
|
+
var attrsDom = [];
|
|
167
|
+
attrs.forEach(function (item, i) {
|
|
168
|
+
var attrTypeList = [];
|
|
169
|
+
var operateList = [];
|
|
170
|
+
switch (item.attrType) {
|
|
171
|
+
case 'cont-string':
|
|
172
|
+
attrTypeList = typeList['cont-string'];
|
|
173
|
+
operateList = stringOperate;
|
|
174
|
+
break;
|
|
175
|
+
case 'cont-num':
|
|
176
|
+
attrTypeList = computeTypeList;
|
|
177
|
+
operateList = typeList['cont-num'];
|
|
178
|
+
break;
|
|
179
|
+
default:
|
|
180
|
+
attrTypeList = typeList['cont-date'];
|
|
181
|
+
operateList = typeList['cont-date'];
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
var orderType = orderTypeList.filter(function (v) {
|
|
185
|
+
return v.value === item.orderType;
|
|
186
|
+
});
|
|
187
|
+
var attrType = attrTypeList.filter(function (v) {
|
|
188
|
+
return v.value === (item.attrType === 'cont-num' ? item.computeType : item.operator);
|
|
189
|
+
});
|
|
190
|
+
var operator = operateList.filter(function (v) {
|
|
191
|
+
return v.value === item.computeType;
|
|
192
|
+
});
|
|
193
|
+
var frequencyValues = renderFrequencyValues(item.params, item.operator, item.attrType === 'cont-date' && item.operator !== 'absolute' ? '天数' : item.operator === 'absolute' ? '日期' : '');
|
|
194
|
+
if (label) {
|
|
195
|
+
var _orderType$, _attrType$, _operator$;
|
|
196
|
+
var dom = /*#__PURE__*/React.createElement("span", {
|
|
197
|
+
key: i
|
|
198
|
+
}, /*#__PURE__*/React.createElement("span", null, (_orderType$ = orderType[0]) === null || _orderType$ === void 0 ? void 0 : _orderType$.name), /*#__PURE__*/React.createElement("span", null, item.attrName), /*#__PURE__*/React.createElement("span", null, (_attrType$ = attrType[0]) === null || _attrType$ === void 0 ? void 0 : _attrType$.name), /*#__PURE__*/React.createElement("span", null, (_operator$ = operator[0]) === null || _operator$ === void 0 ? void 0 : _operator$.name), /*#__PURE__*/React.createElement("span", null, frequencyValues), i !== attrs.length - 1 ? ',' : '');
|
|
199
|
+
attrsDom.push(dom);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
if (!attrsDom.length) return null;
|
|
203
|
+
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", null, "\uFF08"), label, ":", attrsDom, /*#__PURE__*/React.createElement("span", null, "\uFF09"));
|
|
115
204
|
}
|
|
116
205
|
function renderAttrs(event, attrs) {
|
|
117
206
|
var attrsDom = [];
|
|
@@ -145,6 +234,75 @@ var Text = function Text(props) {
|
|
|
145
234
|
className: "".concat(classPrefix, "-text-desc-value")
|
|
146
235
|
}, runTimes.values[0]));
|
|
147
236
|
}
|
|
237
|
+
function renderFrequencyValues(frequencyValues, frequencyOperator, frequency) {
|
|
238
|
+
var _frequencyOperatorLis;
|
|
239
|
+
var frequencyValuesDom = [];
|
|
240
|
+
var frequencyOperatorList = typeList['cont-num'].filter(function (v) {
|
|
241
|
+
return v.value === frequencyOperator;
|
|
242
|
+
});
|
|
243
|
+
frequencyValues.forEach(function (item, i) {
|
|
244
|
+
var dom = /*#__PURE__*/React.createElement("span", {
|
|
245
|
+
key: i
|
|
246
|
+
}, /*#__PURE__*/React.createElement("span", null, item, i !== frequencyValues.length - 1 ? '到' : ''));
|
|
247
|
+
frequencyValuesDom.push(dom);
|
|
248
|
+
});
|
|
249
|
+
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", {
|
|
250
|
+
className: "".concat(classPrefix, "-text-desc-value")
|
|
251
|
+
}, frequency), /*#__PURE__*/React.createElement("span", {
|
|
252
|
+
className: "".concat(classPrefix, "-text-desc-value")
|
|
253
|
+
}, (_frequencyOperatorLis = frequencyOperatorList[0]) === null || _frequencyOperatorLis === void 0 ? void 0 : _frequencyOperatorLis.name), /*#__PURE__*/React.createElement("span", {
|
|
254
|
+
className: "".concat(classPrefix, "-text-desc-value")
|
|
255
|
+
}, frequencyValuesDom));
|
|
256
|
+
}
|
|
257
|
+
function renderTimeDimensions(timeDimensions) {
|
|
258
|
+
var timeDimensionsDom = [];
|
|
259
|
+
timeDimensions.forEach(function (item, i) {
|
|
260
|
+
var _label$, _operatorTypeList$;
|
|
261
|
+
var label = [];
|
|
262
|
+
var list = [];
|
|
263
|
+
var valuesList = [];
|
|
264
|
+
switch (item.timeDimension) {
|
|
265
|
+
case 1:
|
|
266
|
+
list = skyTimeOperatorType;
|
|
267
|
+
valuesList = timeValuesType;
|
|
268
|
+
break;
|
|
269
|
+
case 2:
|
|
270
|
+
list = weekTimeOperatorType;
|
|
271
|
+
valuesList = weekValuesType;
|
|
272
|
+
break;
|
|
273
|
+
default:
|
|
274
|
+
list = monthTimeOperatorType;
|
|
275
|
+
valuesList = monthValuesType;
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
label = timeDimensionType.filter(function (v) {
|
|
279
|
+
return v.value === item.timeDimension;
|
|
280
|
+
});
|
|
281
|
+
var operatorTypeList = list.filter(function (v) {
|
|
282
|
+
return v.value === item.timeOperator;
|
|
283
|
+
});
|
|
284
|
+
var itemTimeValuesDom = [];
|
|
285
|
+
if (item.timeValues.length > 0) {
|
|
286
|
+
item.timeValues.forEach(function (_v, vIndex) {
|
|
287
|
+
var _valuesTypeList$;
|
|
288
|
+
var valuesTypeList = valuesList.filter(function (v) {
|
|
289
|
+
return v.value === _v;
|
|
290
|
+
});
|
|
291
|
+
var dom = /*#__PURE__*/React.createElement("span", {
|
|
292
|
+
key: vIndex
|
|
293
|
+
}, /*#__PURE__*/React.createElement("span", null, (_valuesTypeList$ = valuesTypeList[0]) === null || _valuesTypeList$ === void 0 ? void 0 : _valuesTypeList$.name, vIndex !== item.timeValues.length - 1 ? '到' : ''));
|
|
294
|
+
itemTimeValuesDom.push(dom);
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
var frequencyValues = renderFrequencyValues(item.frequencyValues, item.frequencyOperator, '次数');
|
|
298
|
+
var dom = /*#__PURE__*/React.createElement("span", {
|
|
299
|
+
key: i
|
|
300
|
+
}, /*#__PURE__*/React.createElement("span", null, (_label$ = label[0]) === null || _label$ === void 0 ? void 0 : _label$.name, (_operatorTypeList$ = operatorTypeList[0]) === null || _operatorTypeList$ === void 0 ? void 0 : _operatorTypeList$.name, itemTimeValuesDom, frequencyValues, i !== timeDimensions.length - 1 ? ',' : ''));
|
|
301
|
+
timeDimensionsDom.push(dom);
|
|
302
|
+
});
|
|
303
|
+
if (!timeDimensionsDom.length) return null;
|
|
304
|
+
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", null, "\uFF08"), "\u65F6\u95F4\u7EF4\u5EA6: ", timeDimensionsDom, /*#__PURE__*/React.createElement("span", null, "\uFF09"));
|
|
305
|
+
}
|
|
148
306
|
function renderTags(condition) {
|
|
149
307
|
var labels = condition.labels;
|
|
150
308
|
return /*#__PURE__*/React.createElement("span", {
|
|
@@ -117,6 +117,10 @@ var OrConditions = function OrConditions(props) {
|
|
|
117
117
|
data.condition.labels = newData;
|
|
118
118
|
} else if (type === 'cdp') {
|
|
119
119
|
data.condition.dataset = newData;
|
|
120
|
+
} else if (type === 'business') {
|
|
121
|
+
data.condition = newData;
|
|
122
|
+
} else if (type === 'order') {
|
|
123
|
+
data.condition = newData;
|
|
120
124
|
}
|
|
121
125
|
}
|
|
122
126
|
newValue.push(data.condition);
|
|
@@ -110,6 +110,7 @@ export declare namespace BizUserConditionT {
|
|
|
110
110
|
}
|
|
111
111
|
interface BusinessCondition {
|
|
112
112
|
typeId: undefined;
|
|
113
|
+
typeName: undefined;
|
|
113
114
|
attrs: AttrsCondition[];
|
|
114
115
|
timeDimensions: TimeDimensionsCondition[];
|
|
115
116
|
runTimes: RunTimesII;
|
|
@@ -166,9 +167,9 @@ export declare namespace BizUserConditionT {
|
|
|
166
167
|
interface CdpCondition {
|
|
167
168
|
dataset: (BizUserConditionT.CdpConditionDetail | undefined)[];
|
|
168
169
|
}
|
|
169
|
-
type Condition = EventCondition | AddCondition | ActiveCondition | PropCondition | TagsCondition | BusinessCondition | CdpCondition;
|
|
170
|
+
type Condition = EventCondition | AddCondition | ActiveCondition | PropCondition | TagsCondition | BusinessCondition | OrderCondition | CdpCondition;
|
|
170
171
|
type Conditions = Condition[][];
|
|
171
|
-
type OtherCondition = EventCondition | AddCondition | ActiveCondition | PropCondition;
|
|
172
|
+
type OtherCondition = EventCondition | AddCondition | ActiveCondition | PropCondition | BusinessCondition | OrderCondition;
|
|
172
173
|
interface ShowItemI {
|
|
173
174
|
id: number;
|
|
174
175
|
orConditions: Conditions[number];
|
package/es/userCondition/util.js
CHANGED