@zgfe/modules-attribution 1.0.1-alpha.29 → 1.0.1-alpha.31

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.
@@ -42,7 +42,8 @@ var SearchTime = function SearchTime(props) {
42
42
  className: classPrefix
43
43
  }, /*#__PURE__*/React.createElement(BizDatePicker, {
44
44
  value: time,
45
- onChange: onChangeTime
45
+ onChange: onChangeTime,
46
+ selectRange: 365
46
47
  }));
47
48
  };
48
49
  export default SearchTime;
@@ -3,121 +3,102 @@ import { DemoWrapper, setGlobalConfig } from '@zgfe/business-lib';
3
3
  import { AttributionHome } from '@zgfe/modules-attribution';
4
4
  import { requestConfig } from '../../../utils/ajaxConfig';
5
5
  var defaultValue = {
6
- id: 1426,
7
- name: '999',
8
- type: 0,
9
- enlarged: 0,
10
- panelId: 438,
11
- panelType: 'edit',
12
6
  data: {
13
- "app_id": 21,
7
+ "app_id": 331,
14
8
  "module": "attribution",
15
9
  "targetFilters": [{
16
- "eventId": 6078,
17
- "eventName": "埋点事件-11",
10
+ "eventId": 4024,
11
+ "eventName": "收入",
18
12
  "filters": {
19
13
  "relation": "and",
20
14
  "conditions": [{
21
- "attrId": 139498,
15
+ "attrId": 31331,
22
16
  "propCategory": "eventProp",
23
17
  "type": 2,
24
18
  "operator": "gt",
25
- "values": ["99"],
19
+ "values": ["88"],
26
20
  "dimensionSub": "event_attr",
27
- "label": "商品总价",
28
- "attrName": "商品总价"
21
+ "label": "price",
22
+ "attrName": "price"
29
23
  }, {
30
- "attrId": 139372,
24
+ "attrId": 31328,
31
25
  "propCategory": "eventProp",
32
- "type": 1,
33
- "operator": "equal",
34
- "values": ["12"],
26
+ "type": 2,
27
+ "operator": "gt",
28
+ "values": ["99"],
35
29
  "dimensionSub": "event_attr",
36
- "label": "机身宽度",
37
- "attrName": "机身宽度"
30
+ "label": "total",
31
+ "attrName": "total"
38
32
  }]
39
33
  }
40
34
  }],
41
35
  "sourceFilters": [{
42
- "eventId": 6090,
43
- "eventName": "间隔事件-01",
36
+ "eventId": 4023,
37
+ "eventName": "查看商品",
44
38
  "filters": {
45
39
  "relation": "and",
46
40
  "conditions": [{
47
- "attrId": 139498,
41
+ "attrId": 31321,
48
42
  "propCategory": "eventProp",
49
43
  "type": 2,
50
44
  "operator": "gt",
51
- "values": ["11"],
45
+ "values": ["77"],
52
46
  "dimensionSub": "event_attr",
53
- "label": "商品总价",
54
- "attrName": "商品总价"
47
+ "label": "商品价格",
48
+ "attrName": "商品价格"
55
49
  }, {
56
- "attrId": 139488,
50
+ "attrId": 31332,
57
51
  "propCategory": "eventProp",
58
- "type": 2,
59
- "operator": "gt",
60
- "values": ["77"],
52
+ "type": 1,
53
+ "operator": "equal",
54
+ "values": ["移动电话"],
61
55
  "dimensionSub": "event_attr",
62
- "label": "商品单价",
63
- "attrName": "商品单价"
56
+ "label": "商品类型",
57
+ "attrName": "商品类型"
64
58
  }]
65
59
  },
66
60
  "attributionSubdivision": {
67
- relation: "and",
68
- conditions: {
61
+ "relation": "and",
62
+ "conditions": {
69
63
  "propCategory": "eventProp",
70
64
  "type": 1,
71
- "attrId": 139499
65
+ "attrId": 31332
72
66
  }
73
67
  }
74
68
  }, {
75
- "eventId": 6088,
76
- "eventName": "间隔事件-02",
69
+ "eventId": 4026,
70
+ "eventName": "加购商品",
77
71
  "filters": {
78
72
  "relation": "and",
79
73
  "conditions": [{
80
- "attrId": 139494,
74
+ "attrId": 31334,
81
75
  "propCategory": "eventProp",
82
76
  "type": 2,
83
77
  "operator": "gt",
84
- "values": ["22"],
78
+ "values": ["66"],
85
79
  "dimensionSub": "event_attr",
86
- "label": "商品总价",
87
- "attrName": "商品总价"
80
+ "label": "商品价格",
81
+ "attrName": "商品价格"
88
82
  }, {
89
- "attrId": 139493,
83
+ "attrId": 31336,
90
84
  "propCategory": "eventProp",
91
- "type": 2,
92
- "operator": "gt",
93
- "values": ["33"],
85
+ "type": 1,
86
+ "operator": "equal",
87
+ "values": ["移动电话"],
94
88
  "dimensionSub": "event_attr",
95
- "label": "商品单价",
96
- "attrName": "商品单价"
89
+ "label": "商品类型",
90
+ "attrName": "商品类型"
97
91
  }]
98
92
  },
99
93
  "attributionSubdivision": {
100
- relation: "and",
101
- conditions: {
94
+ "relation": "and",
95
+ "conditions": {
102
96
  "propCategory": "eventProp",
103
97
  "type": 1,
104
- "attrId": 139490
98
+ "attrId": 31329
105
99
  }
106
100
  }
107
101
  }],
108
- "globalFilters": {
109
- "relation": "and",
110
- "conditions": [{
111
- "attrId": 139300,
112
- "propCategory": "eventProp",
113
- "type": 2,
114
- "operator": "gt",
115
- "values": ["87"],
116
- "dimensionSub": "event_attr",
117
- "label": "商品价格",
118
- "attrName": "商品价格"
119
- }]
120
- },
121
102
  "attributionType": 3,
122
103
  "otherEvent": true,
123
104
  "windowCnt": 2,
@@ -125,12 +106,11 @@ var defaultValue = {
125
106
  "time": {
126
107
  "unit": "day",
127
108
  "relative": [14, 0],
128
- "begin": "2023-05-17",
129
- "end": "2023-05-31"
109
+ "begin": "2023-05-29",
110
+ "end": "2023-06-12"
130
111
  },
131
112
  "chartType": "grid"
132
- },
133
- chosen_data: []
113
+ }
134
114
  };
135
115
  export default (function () {
136
116
  useEffect(function () {
@@ -141,7 +121,7 @@ export default (function () {
141
121
  };
142
122
  return /*#__PURE__*/React.createElement(DemoWrapper, {
143
123
  needMeta: true,
144
- defaultApp: 21
124
+ defaultApp: 331
145
125
  }, /*#__PURE__*/React.createElement(AttributionHome, {
146
126
  defaultValue: defaultValue,
147
127
  afterEditTarget: afterEditTarget
@@ -140,6 +140,10 @@ var AttributableEvents = function AttributableEvents(props) {
140
140
  }, 0);
141
141
  };
142
142
  var onMinceProp = function onMinceProp() {
143
+ console.log('attrSelectShow', attrSelectShow);
144
+ if (attrSelectShow) {
145
+ return;
146
+ }
143
147
  if (ReasonData !== undefined || bizEventSelectorDefaultValue !== undefined) {
144
148
  setAttrSelectShow(true);
145
149
  setButtonDisable(true);
@@ -4,6 +4,7 @@ declare const GlobalAttribute: React.FC<{
4
4
  value?: AttrConditionTypes.GroupValue;
5
5
  max?: number;
6
6
  eventIdList?: number[];
7
+ setAttrGlobalCount: Function;
7
8
  onChange?: (val: any) => void;
8
9
  }>;
9
10
  export default GlobalAttribute;
@@ -9,7 +9,8 @@ import React, { useEffect, useRef, useState } from 'react';
9
9
  var GlobalAttribute = function GlobalAttribute(props) {
10
10
  var classPrefix = 'mi-left-form';
11
11
  var max = props.max,
12
- onChange = props.onChange;
12
+ onChange = props.onChange,
13
+ setAttrGlobalCount = props.setAttrGlobalCount;
13
14
  var conditionRef = useRef(null);
14
15
  var _useState = useState(0),
15
16
  _useState2 = _slicedToArray(_useState, 2),
@@ -35,9 +36,13 @@ var GlobalAttribute = function GlobalAttribute(props) {
35
36
  if (props.eventIdList[0] === -100) return;
36
37
  conditionRef.current.add();
37
38
  };
39
+ useEffect(function () {
40
+ setAttrGlobalCount(count);
41
+ }, [count]);
38
42
  return /*#__PURE__*/React.createElement("div", null, props.eventIdList && props.eventIdList[0] === -100 ? '' : /*#__PURE__*/React.createElement(BizAttrConditionGroup, {
39
43
  ref: conditionRef,
40
44
  value: props.value,
45
+ onlyAnd: true,
41
46
  enableEventProp: true,
42
47
  enableDelete: true,
43
48
  eventIdList: props.eventIdList,
@@ -15,7 +15,7 @@ import SearchContent from './components/index';
15
15
  import GlobalAttribute from './components/globalAttribute';
16
16
  import './styles/index.less';
17
17
  import _ from 'lodash';
18
- import { targetChangeCallback, submitButtonDisableHandle } from './utils';
18
+ import { targetChangeCallback, operableOrNotHandle } from './utils';
19
19
  import { searchFields } from '../../constants/fields';
20
20
  import { AttributableContext } from '../../types';
21
21
  export var classPrefix = 'mi-left-form';
@@ -77,6 +77,10 @@ var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
77
77
  _useState20 = _slicedToArray(_useState19, 2),
78
78
  mincePropCount = _useState20[0],
79
79
  setMincePropCount = _useState20[1];
80
+ var _useState21 = useState(0),
81
+ _useState22 = _slicedToArray(_useState21, 2),
82
+ attrGlobalCount = _useState22[0],
83
+ setAttrGlobalCount = _useState22[1];
80
84
  var getSelectEventIdList = function getSelectEventIdList(data, type, eList) {
81
85
  if (data[type]) {
82
86
  data[type].forEach(function (target) {
@@ -94,13 +98,14 @@ var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
94
98
  setEventIdList(_eList);
95
99
  setSelectList(eList);
96
100
  };
97
- var _useState21 = useState(false),
98
- _useState22 = _slicedToArray(_useState21, 2),
99
- reset = _useState22[0],
100
- setReset = _useState22[1];
101
+ var _useState23 = useState(false),
102
+ _useState24 = _slicedToArray(_useState23, 2),
103
+ reset = _useState24[0],
104
+ setReset = _useState24[1];
101
105
  useEffect(function () {
102
106
  if (defaultValue && reset !== null) {
103
107
  var data = defaultValue;
108
+ console.log('初始化', data);
104
109
  if (reset) {
105
110
  data = {
106
111
  targetFilters: initTarget,
@@ -134,8 +139,12 @@ var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
134
139
  var onChange = function onChange(_changedValues, allValues) {
135
140
  setFormData(allValues);
136
141
  setSelectEventIdList(_.cloneDeep(allValues));
137
- setButtonDisable(submitButtonDisableHandle(allValues, attrSourceCount, attrTargetCount, mincePropCount));
138
142
  };
143
+ useEffect(function () {
144
+ if (formData) {
145
+ setButtonDisable(operableOrNotHandle(formData, attrSourceCount, attrTargetCount, mincePropCount, attrGlobalCount));
146
+ }
147
+ }, [formData, attrSourceCount, attrTargetCount, mincePropCount, attrGlobalCount]);
139
148
  var onFinish = function onFinish(isFetchRequest) {
140
149
  form.validateFields().then(function (res) {
141
150
  res.otherEvent = otherEvent;
@@ -166,10 +175,10 @@ var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
166
175
  setWindowType(1);
167
176
  setOtherEvent(false);
168
177
  };
169
- var _useState23 = useState(1),
170
- _useState24 = _slicedToArray(_useState23, 2),
171
- windowType = _useState24[0],
172
- setWindowType = _useState24[1];
178
+ var _useState25 = useState(1),
179
+ _useState26 = _slicedToArray(_useState25, 2),
180
+ windowType = _useState26[0],
181
+ setWindowType = _useState26[1];
173
182
  return /*#__PURE__*/React.createElement("div", {
174
183
  className: classPrefix
175
184
  }, /*#__PURE__*/React.createElement(Skeleton, {
@@ -194,7 +203,8 @@ var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
194
203
  name: item.name
195
204
  }, /*#__PURE__*/React.createElement(GlobalAttribute, {
196
205
  max: item.max,
197
- eventIdList: eventIdList
206
+ eventIdList: eventIdList,
207
+ setAttrGlobalCount: setAttrGlobalCount
198
208
  })));
199
209
  }
200
210
  return /*#__PURE__*/React.createElement(Form.List, {
@@ -322,6 +332,7 @@ var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
322
332
  value: windowCnt,
323
333
  min: 1,
324
334
  max: 365,
335
+ precision: 0,
325
336
  onChange: function onChange(e) {
326
337
  setWindowCnt(Number(e));
327
338
  }
@@ -1,8 +1,8 @@
1
1
  import { SearchValueProps } from '../../types';
2
2
  import { EventSelectTypes } from '@zgfe/business-lib/es/eventSelector/types';
3
3
  export declare function targetChangeCallback(data: SearchValueProps, eList: number[], eventGroupList: EventSelectTypes.Value[]): SearchValueProps;
4
- export declare function submitButtonDisableHandle(data: SearchValueProps, attrSourceCount: {
4
+ export declare function operableOrNotHandle(data: SearchValueProps, attrSourceCount: {
5
5
  [x: number]: number;
6
6
  }, attrTargetCount: number, mincePropCount: {
7
7
  [x: number]: number;
8
- }): boolean;
8
+ }, attrGlobalCount: number): boolean;
@@ -38,14 +38,18 @@ var judgeAttrInEvents = function judgeAttrInEvents(elds, attrId, eventGroupList)
38
38
  });
39
39
  return flag;
40
40
  };
41
- export function submitButtonDisableHandle(data, attrSourceCount, attrTargetCount, mincePropCount) {
41
+ export function operableOrNotHandle(data, attrSourceCount, attrTargetCount, mincePropCount, attrGlobalCount) {
42
42
  var flag = false;
43
43
  data.attributionType === undefined ? flag = true : null;
44
- buttonDisable(data, 'sourceFilters', attrSourceCount, mincePropCount) ? flag = true : null;
45
- buttonDisable(data, 'targetFilters', attrTargetCount) ? flag = true : null;
44
+ if (subsetHandle(data, 'sourceFilters', attrSourceCount, mincePropCount)) flag = true;
45
+ if (subsetHandle(data, 'targetFilters', attrTargetCount)) flag = true;
46
+ if (attrGlobalCount && data.globalFilters === undefined) flag = true;
47
+ if (data.globalFilters && conditionsHandle('globalFilters', data.globalFilters, attrGlobalCount, 0)) {
48
+ flag = true;
49
+ }
46
50
  return flag;
47
51
  }
48
- var buttonDisable = function buttonDisable(data, type, count, mincePropCount) {
52
+ var subsetHandle = function subsetHandle(data, type, count, mincePropCount) {
49
53
  var flag = false;
50
54
  data[type].map(function (item) {
51
55
  item === undefined ? flag = true : null;
@@ -61,22 +65,24 @@ var buttonDisable = function buttonDisable(data, type, count, mincePropCount) {
61
65
  }
62
66
  }
63
67
  if ((item === null || item === void 0 ? void 0 : item.filters) && ((_item$filters = item.filters) === null || _item$filters === void 0 ? void 0 : _item$filters.conditions.length) > 0) {
64
- var _item$filters2;
65
- (_item$filters2 = item.filters) === null || _item$filters2 === void 0 ? void 0 : _item$filters2.conditions.map(function (_item) {
66
- if (_item.operator !== 'is null' && _item.operator !== 'is not null') {
67
- var _item$values;
68
- _item.values && ((_item$values = _item.values) === null || _item$values === void 0 ? void 0 : _item$values.length) <= 0 ? flag = true : null;
69
- }
70
- });
71
- if (type === 'targetFilters') {
72
- var _item$filters3;
73
- ((_item$filters3 = item.filters) === null || _item$filters3 === void 0 ? void 0 : _item$filters3.conditions.length) != count ? flag = true : null;
74
- } else {
75
- var _item$filters4;
76
- ((_item$filters4 = item.filters) === null || _item$filters4 === void 0 ? void 0 : _item$filters4.conditions.length) != count[item.eventId] ? flag = true : null;
77
- }
68
+ flag = conditionsHandle(type, item.filters, count, item.eventId);
78
69
  }
79
70
  }
80
71
  });
81
72
  return flag;
73
+ };
74
+ var conditionsHandle = function conditionsHandle(type, data, count, eventId) {
75
+ var flag = false;
76
+ data.conditions.map(function (_item) {
77
+ if (_item.operator !== 'is null' && _item.operator !== 'is not null') {
78
+ var _item$values;
79
+ _item.values && ((_item$values = _item.values) === null || _item$values === void 0 ? void 0 : _item$values.length) <= 0 ? flag = true : null;
80
+ }
81
+ });
82
+ if (type === 'targetFilters' || type === 'globalFilters') {
83
+ data.conditions.length != count ? flag = true : null;
84
+ } else {
85
+ data.conditions.length != count[eventId] ? flag = true : null;
86
+ }
87
+ return flag;
82
88
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-attribution",
3
- "version": "1.0.1-alpha.29",
3
+ "version": "1.0.1-alpha.31",
4
4
  "module": "es/index.js",
5
5
  "typings": "es/index.d.ts",
6
6
  "files": [
@@ -37,7 +37,7 @@
37
37
  "@types/lodash": "^4.14.191",
38
38
  "@umijs/fabric": "^2.8.1",
39
39
  "@umijs/test": "^3.0.5",
40
- "@zgfe/business-lib": "1.1.41-attribution.7",
40
+ "@zgfe/business-lib": "1.1.41-attribution.8",
41
41
  "antd": "^4.22.6",
42
42
  "dumi": "^1.1.0",
43
43
  "echarts": "^5.3.2",
@@ -50,5 +50,5 @@
50
50
  "react": "^16.12.0 || ^17.0.0",
51
51
  "yorkie": "^2.0.0"
52
52
  },
53
- "gitHead": "a81e8298a86e15554b7b057e78fb92d7000ee0e6"
53
+ "gitHead": "6e8a5d0c3cfddc86db0f1928ac2f670afa6e0974"
54
54
  }