@zgfe/business-lib 1.1.34-alpha.6 → 1.1.34-alpha.7

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.
@@ -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,9 @@ 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
+ }
52
57
  if (data.eventId) {
53
58
  return renderEvent(data);
54
59
  }
@@ -103,6 +108,7 @@ var Text = function Text(props) {
103
108
  }
104
109
  var period = renderPeriod(periodLabel, condition.runPeriod, true);
105
110
  var runtimes = renderRuntimes(condition.runTimes);
111
+ var timeDimensions = renderTimeDimensions(condition.timeDimensions);
106
112
  var attrs = renderAttrs(event, condition.attrs);
107
113
  return /*#__PURE__*/React.createElement("span", {
108
114
  style: {
@@ -111,7 +117,67 @@ var Text = function Text(props) {
111
117
  }
112
118
  }, period, /*#__PURE__*/React.createElement("span", {
113
119
  className: "".concat(classPrefix, "-text-desc-value")
114
- }, event.alias || event.name), attrs, runtimes);
120
+ }, event.alias || event.name), attrs, timeDimensions, runtimes);
121
+ }
122
+ function renderOrder(condition) {
123
+ var periodLabel = {};
124
+ if (condition.runPeriod.operator === 'join_time') {
125
+ periodLabel.before = '在新增后';
126
+ periodLabel.after = '天内';
127
+ }
128
+ if (condition.runPeriod.operator === 'relative' || condition.runPeriod.operator === 'absolute') {
129
+ periodLabel.before = '在';
130
+ }
131
+ var period = renderPeriod(periodLabel, condition.runPeriod, true);
132
+ var frequencyValues = renderFrequencyValues(condition.runTimes.values, condition.runTimes.operator, '次数');
133
+ var timeDimensions = renderTimeDimensions(condition.timeDimensions);
134
+ var property = renderProperty(condition.attrs, '订单属性');
135
+ return /*#__PURE__*/React.createElement("span", {
136
+ style: {
137
+ backgroundColor: '#fffeeb',
138
+ padding: '6px 7px'
139
+ }
140
+ }, "\u8BA2\u5355\u6570\u636E ", period, timeDimensions, "\u8BA2\u5355\u5C5E\u6027 ", property, frequencyValues);
141
+ }
142
+ function renderProperty(attrs, label) {
143
+ var attrsDom = [];
144
+ attrs.forEach(function (item, i) {
145
+ var attrTypeList = [];
146
+ var operateList = [];
147
+ switch (item.attrType) {
148
+ case 'cont-string':
149
+ attrTypeList = typeList['cont-string'];
150
+ operateList = stringOperate;
151
+ break;
152
+ case 'cont-num':
153
+ attrTypeList = computeTypeList;
154
+ operateList = typeList['cont-num'];
155
+ break;
156
+ default:
157
+ attrTypeList = typeList['cont-date'];
158
+ operateList = typeList['cont-date'];
159
+ break;
160
+ }
161
+ var orderType = orderTypeList.filter(function (v) {
162
+ return v.value === item.orderType;
163
+ });
164
+ var attrType = attrTypeList.filter(function (v) {
165
+ return v.value === (item.attrType === 'cont-num' ? item.computeType : item.operator);
166
+ });
167
+ var operator = operateList.filter(function (v) {
168
+ return v.value === item.computeType;
169
+ });
170
+ var frequencyValues = renderFrequencyValues(item.params, item.operator, item.attrType === 'cont-date' ? '天数' : '');
171
+ if (label) {
172
+ var _orderType$, _attrType$, _operator$;
173
+ var dom = /*#__PURE__*/React.createElement("span", {
174
+ key: i
175
+ }, /*#__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 ? ',' : '');
176
+ attrsDom.push(dom);
177
+ }
178
+ });
179
+ if (!attrsDom.length) return null;
180
+ return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", null, "\uFF08"), attrsDom, /*#__PURE__*/React.createElement("span", null, "\uFF09"));
115
181
  }
116
182
  function renderAttrs(event, attrs) {
117
183
  var attrsDom = [];
@@ -145,6 +211,75 @@ var Text = function Text(props) {
145
211
  className: "".concat(classPrefix, "-text-desc-value")
146
212
  }, runTimes.values[0]));
147
213
  }
214
+ function renderFrequencyValues(frequencyValues, frequencyOperator, frequency) {
215
+ var _frequencyOperatorLis;
216
+ var frequencyValuesDom = [];
217
+ var frequencyOperatorList = typeList['cont-num'].filter(function (v) {
218
+ return v.value === frequencyOperator;
219
+ });
220
+ frequencyValues.forEach(function (item, i) {
221
+ var dom = /*#__PURE__*/React.createElement("span", {
222
+ key: i
223
+ }, /*#__PURE__*/React.createElement("span", null, item, i !== frequencyValues.length - 1 ? '到' : ''));
224
+ frequencyValuesDom.push(dom);
225
+ });
226
+ return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", {
227
+ className: "".concat(classPrefix, "-text-desc-value")
228
+ }, frequency), /*#__PURE__*/React.createElement("span", {
229
+ className: "".concat(classPrefix, "-text-desc-value")
230
+ }, (_frequencyOperatorLis = frequencyOperatorList[0]) === null || _frequencyOperatorLis === void 0 ? void 0 : _frequencyOperatorLis.name), /*#__PURE__*/React.createElement("span", {
231
+ className: "".concat(classPrefix, "-text-desc-value")
232
+ }, frequencyValuesDom));
233
+ }
234
+ function renderTimeDimensions(timeDimensions) {
235
+ var timeDimensionsDom = [];
236
+ timeDimensions.forEach(function (item, i) {
237
+ var _label$, _operatorTypeList$;
238
+ var label = [];
239
+ var list = [];
240
+ var valuesList = [];
241
+ switch (item.timeDimension) {
242
+ case 1:
243
+ list = skyTimeOperatorType;
244
+ valuesList = timeValuesType;
245
+ break;
246
+ case 2:
247
+ list = weekTimeOperatorType;
248
+ valuesList = weekValuesType;
249
+ break;
250
+ default:
251
+ list = monthTimeOperatorType;
252
+ valuesList = monthValuesType;
253
+ break;
254
+ }
255
+ label = timeDimensionType.filter(function (v) {
256
+ return v.value === item.timeDimension;
257
+ });
258
+ var operatorTypeList = list.filter(function (v) {
259
+ return v.value === item.timeOperator;
260
+ });
261
+ var itemTimeValuesDom = [];
262
+ if (item.timeValues.length > 0) {
263
+ item.timeValues.forEach(function (_v, vIndex) {
264
+ var _valuesTypeList$;
265
+ var valuesTypeList = valuesList.filter(function (v) {
266
+ return v.value === _v;
267
+ });
268
+ var dom = /*#__PURE__*/React.createElement("span", {
269
+ key: vIndex
270
+ }, /*#__PURE__*/React.createElement("span", null, (_valuesTypeList$ = valuesTypeList[0]) === null || _valuesTypeList$ === void 0 ? void 0 : _valuesTypeList$.name, vIndex !== item.timeValues.length - 1 ? '到' : ''));
271
+ itemTimeValuesDom.push(dom);
272
+ });
273
+ }
274
+ var frequencyValues = renderFrequencyValues(item.frequencyValues, item.frequencyOperator, '次数');
275
+ var dom = /*#__PURE__*/React.createElement("span", {
276
+ key: i
277
+ }, /*#__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 ? ',' : ''));
278
+ timeDimensionsDom.push(dom);
279
+ });
280
+ if (!timeDimensionsDom.length) return null;
281
+ return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", null, "\uFF08"), "\u65F6\u95F4\u7EF4\u5EA6: ", timeDimensionsDom, /*#__PURE__*/React.createElement("span", null, "\uFF09"));
282
+ }
148
283
  function renderTags(condition) {
149
284
  var labels = condition.labels;
150
285
  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];
@@ -71,6 +71,7 @@ export function buildCondition(type) {
71
71
  return {
72
72
  eventId: -14,
73
73
  typeId: undefined,
74
+ typeName: undefined,
74
75
  runTimes: {
75
76
  operator: '>=',
76
77
  values: [1]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.1.34-alpha.6",
3
+ "version": "1.1.34-alpha.7",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",