@zgfe/modules-attribution 1.0.1-alpha.19 → 1.0.1-alpha.21
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/modules/home/demo/edit.js +2 -2
- package/es/modules/searchPanel/components/attributableEvents.js +10 -7
- package/es/modules/searchPanel/components/globalAttribute.js +1 -1
- package/es/modules/searchPanel/components/targetEvent.js +6 -3
- package/es/modules/searchPanel/index.js +53 -48
- package/es/modules/searchPanel/types.d.ts +1 -0
- package/es/modules/searchPanel/utils.js +6 -4
- package/es/types.d.ts +1 -1
- package/package.json +3 -3
|
@@ -63,7 +63,7 @@ var defaultValue = {
|
|
|
63
63
|
"attrName": "商品单价"
|
|
64
64
|
}]
|
|
65
65
|
},
|
|
66
|
-
"
|
|
66
|
+
"attributionSubdivision": {
|
|
67
67
|
"propCategory": "eventProp",
|
|
68
68
|
"type": 1,
|
|
69
69
|
"attrId": 139499
|
|
@@ -93,7 +93,7 @@ var defaultValue = {
|
|
|
93
93
|
"attrName": "商品单价"
|
|
94
94
|
}]
|
|
95
95
|
},
|
|
96
|
-
"
|
|
96
|
+
"attributionSubdivision": {
|
|
97
97
|
"propCategory": "eventProp",
|
|
98
98
|
"type": 1,
|
|
99
99
|
"attrId": 139490
|
|
@@ -17,6 +17,7 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
17
17
|
setAttrSourceCount = props.setAttrSourceCount,
|
|
18
18
|
formData = props.formData,
|
|
19
19
|
eventIdList = props.eventIdList,
|
|
20
|
+
selectList = props.selectList,
|
|
20
21
|
onDelete = props.onDelete;
|
|
21
22
|
var _useContext = useContext(AttributableContext),
|
|
22
23
|
setButtonDisable = _useContext.setButtonDisable;
|
|
@@ -72,14 +73,14 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
72
73
|
}
|
|
73
74
|
});
|
|
74
75
|
setFilters(value.filters);
|
|
75
|
-
setMinceAttr(value.
|
|
76
|
+
setMinceAttr(value.attributionSubdivision);
|
|
76
77
|
if (eventIdList && eventIdList.length >= 0) {
|
|
77
78
|
setEventId(eventIdList[0]);
|
|
78
79
|
}
|
|
79
|
-
if (value.
|
|
80
|
+
if (value.attributionSubdivision) {
|
|
80
81
|
setBizAttributeSelectorValue({
|
|
81
|
-
id: value.
|
|
82
|
-
propCategory: value.
|
|
82
|
+
id: value.attributionSubdivision.attrId,
|
|
83
|
+
propCategory: value.attributionSubdivision.propCategory
|
|
83
84
|
});
|
|
84
85
|
setAttrSelectShow(true);
|
|
85
86
|
}
|
|
@@ -180,7 +181,7 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
180
181
|
eventId: event === null || event === void 0 ? void 0 : event.id,
|
|
181
182
|
eventName: (event === null || event === void 0 ? void 0 : event.alias) || (event === null || event === void 0 ? void 0 : event.name),
|
|
182
183
|
filters: filterData,
|
|
183
|
-
|
|
184
|
+
attributionSubdivision: minceAttr
|
|
184
185
|
};
|
|
185
186
|
props.onChange(data);
|
|
186
187
|
}
|
|
@@ -190,11 +191,13 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
190
191
|
}, /*#__PURE__*/React.createElement("div", {
|
|
191
192
|
className: "select-and-attr"
|
|
192
193
|
}, /*#__PURE__*/React.createElement(BizEventSelector, {
|
|
193
|
-
|
|
194
|
+
showAllEvent: false,
|
|
195
|
+
showBuiltInTarget: false,
|
|
194
196
|
popupContainer: false,
|
|
195
197
|
defaultSelectAble: false,
|
|
196
198
|
onChange: onChangeReason,
|
|
197
|
-
defaultValue: bizEventSelectorDefaultValue
|
|
199
|
+
defaultValue: bizEventSelectorDefaultValue,
|
|
200
|
+
selectList: selectList
|
|
198
201
|
}), attrSelectShow && /*#__PURE__*/React.createElement(BizAttributeSelector, {
|
|
199
202
|
enableEventProp: true,
|
|
200
203
|
enableUserProp: true,
|
|
@@ -44,7 +44,7 @@ var GlobalAttribute = function GlobalAttribute(props) {
|
|
|
44
44
|
onChange: onChange,
|
|
45
45
|
onConditionsCount: setCount
|
|
46
46
|
}), count < max && /*#__PURE__*/React.createElement("div", {
|
|
47
|
-
className: "".concat(classPrefix, "-add ").concat(props.eventIdList
|
|
47
|
+
className: "".concat(classPrefix, "-add ").concat(props.eventIdList && props.eventIdList.length <= 0 ? 'disabled' : ''),
|
|
48
48
|
onClick: onAdd
|
|
49
49
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
50
50
|
className: "".concat(classPrefix, "-add-icon"),
|
|
@@ -11,7 +11,8 @@ import { Select, Tooltip, message } from 'antd';
|
|
|
11
11
|
var TargetEvent = function TargetEvent(props) {
|
|
12
12
|
var value = props.value,
|
|
13
13
|
setAttrTargetCount = props.setAttrTargetCount,
|
|
14
|
-
eventIdList = props.eventIdList
|
|
14
|
+
eventIdList = props.eventIdList,
|
|
15
|
+
selectList = props.selectList;
|
|
15
16
|
var _useState = useState(),
|
|
16
17
|
_useState2 = _slicedToArray(_useState, 2),
|
|
17
18
|
targetData = _useState2[0],
|
|
@@ -111,11 +112,13 @@ var TargetEvent = function TargetEvent(props) {
|
|
|
111
112
|
}, /*#__PURE__*/React.createElement("div", {
|
|
112
113
|
className: "selector-content"
|
|
113
114
|
}, /*#__PURE__*/React.createElement(BizEventSelector, {
|
|
114
|
-
|
|
115
|
+
showAllEvent: false,
|
|
116
|
+
showBuiltInTarget: false,
|
|
115
117
|
popupContainer: false,
|
|
116
118
|
defaultSelectAble: false,
|
|
117
119
|
defaultValue: bizEventSelectorDefaultValue,
|
|
118
|
-
onChange: onChangeTarget
|
|
120
|
+
onChange: onChangeTarget,
|
|
121
|
+
selectList: selectList
|
|
119
122
|
}), /*#__PURE__*/React.createElement(Select, {
|
|
120
123
|
defaultValue: 1,
|
|
121
124
|
style: {
|
|
@@ -15,7 +15,6 @@ import GlobalAttribute from './components/globalAttribute';
|
|
|
15
15
|
import './styles/index.less';
|
|
16
16
|
import _ from 'lodash';
|
|
17
17
|
import { targetChangeCallback, submitButtonDisableHandle } from './utils';
|
|
18
|
-
import { initTarget } from '../../constants/initData';
|
|
19
18
|
import { searchFields } from '../../constants/fields';
|
|
20
19
|
import { AttributableContext } from '../../types';
|
|
21
20
|
export var classPrefix = 'mi-left-form';
|
|
@@ -25,6 +24,8 @@ var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
25
24
|
var _useContext = useContext(AttributableContext),
|
|
26
25
|
buttonDisable = _useContext.buttonDisable,
|
|
27
26
|
setButtonDisable = _useContext.setButtonDisable;
|
|
27
|
+
var _useContext2 = useContext(BizGlobalDataContext),
|
|
28
|
+
eventGroupList = _useContext2.eventGroupList;
|
|
28
29
|
var _Form$useForm = Form.useForm(),
|
|
29
30
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
30
31
|
form = _Form$useForm2[0];
|
|
@@ -40,43 +41,62 @@ var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
40
41
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
41
42
|
formData = _useState6[0],
|
|
42
43
|
setFormData = _useState6[1];
|
|
43
|
-
var _useState7 = useState([
|
|
44
|
+
var _useState7 = useState([]),
|
|
44
45
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
45
46
|
eventIdList = _useState8[0],
|
|
46
47
|
setEventIdList = _useState8[1];
|
|
47
|
-
var
|
|
48
|
-
eventGroupList = _useContext2.eventGroupList;
|
|
49
|
-
var _useState9 = useState(-1),
|
|
48
|
+
var _useState9 = useState([]),
|
|
50
49
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
selectList = _useState10[0],
|
|
51
|
+
setSelectList = _useState10[1];
|
|
52
|
+
useEffect(function () {
|
|
53
|
+
if (formData) {
|
|
54
|
+
var targetData = targetChangeCallback(formData, eventIdList, eventGroupList);
|
|
55
|
+
form.setFieldsValue(targetData);
|
|
56
|
+
}
|
|
57
|
+
}, [eventIdList, formData]);
|
|
58
|
+
var _useState11 = useState(-1),
|
|
54
59
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
var _useState13 = useState(
|
|
60
|
+
windowCnt = _useState12[0],
|
|
61
|
+
setWindowCnt = _useState12[1];
|
|
62
|
+
var _useState13 = useState('day'),
|
|
58
63
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var _useState15 = useState(
|
|
64
|
+
windowTypeUnit = _useState14[0],
|
|
65
|
+
setwindowTypeUnit = _useState14[1];
|
|
66
|
+
var _useState15 = useState(0),
|
|
62
67
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
attrTargetCount = _useState16[0],
|
|
69
|
+
setAttrTargetCount = _useState16[1];
|
|
65
70
|
var _useState17 = useState({}),
|
|
66
71
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
attrSourceCount = _useState18[0],
|
|
73
|
+
setAttrSourceCount = _useState18[1];
|
|
74
|
+
var _useState19 = useState({}),
|
|
75
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
76
|
+
mincePropCount = _useState20[0],
|
|
77
|
+
setMincePropCount = _useState20[1];
|
|
78
|
+
var getSelectEventIdList = function getSelectEventIdList(data, type, eList) {
|
|
79
|
+
if (data[type]) {
|
|
80
|
+
data[type].forEach(function (target) {
|
|
81
|
+
if (target && target.eventId && target.eventId !== -100) {
|
|
82
|
+
eList.push(target.eventId);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return eList;
|
|
87
|
+
};
|
|
88
|
+
var setSelectEventIdList = function setSelectEventIdList(data) {
|
|
89
|
+
var eList = [];
|
|
90
|
+
var _eList = _.cloneDeep(getSelectEventIdList(data, 'targetFilters', eList));
|
|
91
|
+
getSelectEventIdList(data, 'sourceFilters', eList);
|
|
92
|
+
setEventIdList(_eList);
|
|
93
|
+
setSelectList(eList);
|
|
94
|
+
};
|
|
69
95
|
useEffect(function () {
|
|
70
96
|
if (defaultValue) {
|
|
71
97
|
var data = defaultValue;
|
|
72
98
|
setFormData(data);
|
|
73
|
-
|
|
74
|
-
defaultValue.targetFilters.forEach(function (target) {
|
|
75
|
-
if (target && target.eventId) {
|
|
76
|
-
eList.push(target.eventId);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
setEventIdList(eList);
|
|
99
|
+
setSelectEventIdList(defaultValue);
|
|
80
100
|
if (defaultValue.windowType !== undefined) {
|
|
81
101
|
setOtherEvent(defaultValue.otherEvent);
|
|
82
102
|
setWindowCnt(defaultValue.windowCnt);
|
|
@@ -86,7 +106,7 @@ var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
86
106
|
var _attrCount = {};
|
|
87
107
|
var _sourceCount = {};
|
|
88
108
|
data.sourceFilters.map(function (item) {
|
|
89
|
-
if (item.
|
|
109
|
+
if (item.attributionSubdivision != undefined) {
|
|
90
110
|
_attrCount[item.eventId] = 1;
|
|
91
111
|
}
|
|
92
112
|
if (item.filters != undefined) {
|
|
@@ -101,23 +121,7 @@ var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
101
121
|
var onChange = function onChange(_changedValues, allValues) {
|
|
102
122
|
console.log('筛选值发生改变', _changedValues, allValues);
|
|
103
123
|
setFormData(allValues);
|
|
104
|
-
|
|
105
|
-
if (_changedValues.targetFilters) {
|
|
106
|
-
var eList = [];
|
|
107
|
-
if (allValues.targetFilters.length) {
|
|
108
|
-
allValues.targetFilters.forEach(function (target) {
|
|
109
|
-
if (target && target.eventId) {
|
|
110
|
-
eList.push(target.eventId);
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
} else {
|
|
114
|
-
data.targetFilters = initTarget;
|
|
115
|
-
eList = [-100];
|
|
116
|
-
}
|
|
117
|
-
setEventIdList(eList);
|
|
118
|
-
var targetData = targetChangeCallback(data, eList, eventGroupList);
|
|
119
|
-
form.setFieldsValue(targetData);
|
|
120
|
-
}
|
|
124
|
+
setSelectEventIdList(_.cloneDeep(allValues));
|
|
121
125
|
setButtonDisable(submitButtonDisableHandle(allValues, attrSourceCount, attrTargetCount, mincePropCount));
|
|
122
126
|
};
|
|
123
127
|
var onFinish = function onFinish(isFetchRequest) {
|
|
@@ -145,10 +149,10 @@ var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
145
149
|
form.resetFields();
|
|
146
150
|
setWindowType(1);
|
|
147
151
|
};
|
|
148
|
-
var
|
|
149
|
-
|
|
150
|
-
windowType =
|
|
151
|
-
setWindowType =
|
|
152
|
+
var _useState21 = useState(1),
|
|
153
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
154
|
+
windowType = _useState22[0],
|
|
155
|
+
setWindowType = _useState22[1];
|
|
152
156
|
return /*#__PURE__*/React.createElement("div", {
|
|
153
157
|
className: classPrefix
|
|
154
158
|
}, /*#__PURE__*/React.createElement(Skeleton, {
|
|
@@ -211,7 +215,8 @@ var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
211
215
|
setMincePropCount: setMincePropCount,
|
|
212
216
|
attrSourceCount: attrSourceCount,
|
|
213
217
|
mincePropCount: mincePropCount,
|
|
214
|
-
formData: formData
|
|
218
|
+
formData: formData,
|
|
219
|
+
selectList: selectList
|
|
215
220
|
}));
|
|
216
221
|
}), fields.length < item.max && /*#__PURE__*/React.createElement("div", {
|
|
217
222
|
className: "".concat(classPrefix, "-add"),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function targetChangeCallback(data, eList, eventGroupList) {
|
|
2
|
-
if (eList
|
|
2
|
+
if (eList.length <= 0) {
|
|
3
3
|
data.globalFilters = undefined;
|
|
4
4
|
} else {
|
|
5
5
|
if (data.globalFilters && data.globalFilters.conditions) {
|
|
@@ -57,14 +57,16 @@ var buttonDisable = function buttonDisable(data, type, count, mincePropCount) {
|
|
|
57
57
|
} else {
|
|
58
58
|
item.filters === undefined && Object.keys(count).length > 0 && count[item.eventId] !== undefined ? flag = true : null;
|
|
59
59
|
if (mincePropCount != undefined) {
|
|
60
|
-
item.
|
|
60
|
+
item.attributionSubdivision === undefined && Object.keys(mincePropCount).length > 0 && mincePropCount[item.eventId] !== undefined ? flag = true : null;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
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
64
|
var _item$filters2;
|
|
65
65
|
(_item$filters2 = item.filters) === null || _item$filters2 === void 0 ? void 0 : _item$filters2.conditions.map(function (_item) {
|
|
66
|
-
|
|
67
|
-
|
|
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
|
+
}
|
|
68
70
|
});
|
|
69
71
|
if (type === 'targetFilters') {
|
|
70
72
|
var _item$filters3;
|
package/es/types.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface FiltersProps {
|
|
|
16
16
|
eventId: number;
|
|
17
17
|
eventName: string;
|
|
18
18
|
filters?: AttrConditionTypes.GroupValue | undefined;
|
|
19
|
-
|
|
19
|
+
attributionSubdivision?: PropfiltersProps | undefined;
|
|
20
20
|
}
|
|
21
21
|
export interface PropfiltersProps {
|
|
22
22
|
attrId: number | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/modules-attribution",
|
|
3
|
-
"version": "1.0.1-alpha.
|
|
3
|
+
"version": "1.0.1-alpha.21",
|
|
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.
|
|
40
|
+
"@zgfe/business-lib": "1.1.41-attribution.4",
|
|
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": "
|
|
53
|
+
"gitHead": "996f95a27a25d2365836ab5a3533ee33fb8a14b6"
|
|
54
54
|
}
|