@zgfe/modules-attribution 1.0.1-alpha.1 → 1.0.1-alpha.13
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/components/option/index.js +8 -4
- package/es/components/option/types.d.ts +1 -0
- package/es/components/searchTime/index.js +2 -1
- package/es/components/tableList/index.js +9 -3
- package/es/components/title/index.js +1 -1
- package/es/modules/content/index.js +46 -17
- package/es/modules/content/utils.d.ts +0 -6
- package/es/modules/content/utils.js +0 -163
- package/es/modules/home/demo/create.js +1 -1
- package/es/modules/home/demo/edit.js +105 -122
- package/es/modules/home/demo/index.js +1 -1
- package/es/modules/home/demo/scene.js +1 -1
- package/es/modules/home/index.js +5 -17
- package/es/modules/searchPanel/components/attributableEvents.js +102 -23
- package/es/modules/searchPanel/components/targetEvent.js +25 -14
- package/es/modules/searchPanel/index.d.ts +1 -1
- package/es/modules/searchPanel/index.js +56 -21
- package/es/modules/searchPanel/types.d.ts +14 -3
- package/es/modules/searchPanel/utils.d.ts +5 -1
- package/es/modules/searchPanel/utils.js +21 -7
- package/package.json +2 -2
|
@@ -7,7 +7,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
7
7
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
8
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
9
9
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
10
|
-
import React, { useContext, useEffect, useState } from 'react';
|
|
10
|
+
import React, { useContext, useEffect, useState, useImperativeHandle } from 'react';
|
|
11
11
|
import { IconFont, BizGlobalDataContext } from '@zgfe/business-lib';
|
|
12
12
|
import { Button, Form, Skeleton, Tooltip, Checkbox, Select, InputNumber } from 'antd';
|
|
13
13
|
import SearchContent from './components/index';
|
|
@@ -19,12 +19,12 @@ import { initTarget } from '../../constants/initData';
|
|
|
19
19
|
import { searchFields } from '../../constants/fields';
|
|
20
20
|
import { AttributableContext } from '../../types';
|
|
21
21
|
export var classPrefix = 'mi-left-form';
|
|
22
|
-
var SearchPanel = function
|
|
22
|
+
var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
23
23
|
var defaultValue = props.defaultValue;
|
|
24
|
+
console.log('SearchPanel', defaultValue);
|
|
24
25
|
var _useContext = useContext(AttributableContext),
|
|
25
26
|
buttonDisable = _useContext.buttonDisable,
|
|
26
27
|
setButtonDisable = _useContext.setButtonDisable;
|
|
27
|
-
console.log('defaultValue', defaultValue);
|
|
28
28
|
var _Form$useForm = Form.useForm(),
|
|
29
29
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
30
30
|
form = _Form$useForm2[0];
|
|
@@ -46,7 +46,7 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
46
46
|
setEventIdList = _useState8[1];
|
|
47
47
|
var _useContext2 = useContext(BizGlobalDataContext),
|
|
48
48
|
eventGroupList = _useContext2.eventGroupList;
|
|
49
|
-
var _useState9 = useState(
|
|
49
|
+
var _useState9 = useState(0),
|
|
50
50
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
51
51
|
windowCnt = _useState10[0],
|
|
52
52
|
setWindowCnt = _useState10[1];
|
|
@@ -58,10 +58,17 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
58
58
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
59
59
|
attrTargetCount = _useState14[0],
|
|
60
60
|
setAttrTargetCount = _useState14[1];
|
|
61
|
-
var _useState15 = useState(
|
|
61
|
+
var _useState15 = useState({}),
|
|
62
62
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
63
63
|
attrSourceCount = _useState16[0],
|
|
64
64
|
setAttrSourceCount = _useState16[1];
|
|
65
|
+
var _useState17 = useState({}),
|
|
66
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
67
|
+
mincePropCount = _useState18[0],
|
|
68
|
+
setMincePropCount = _useState18[1];
|
|
69
|
+
useEffect(function () {
|
|
70
|
+
console.log('判断提交按钮是否可点击-1234444', mincePropCount);
|
|
71
|
+
}, [mincePropCount]);
|
|
65
72
|
useEffect(function () {
|
|
66
73
|
if (defaultValue) {
|
|
67
74
|
var data = defaultValue;
|
|
@@ -73,12 +80,32 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
73
80
|
eList.push(target.eventId);
|
|
74
81
|
}
|
|
75
82
|
});
|
|
83
|
+
console.log('初始化11', eList);
|
|
76
84
|
setEventIdList(eList);
|
|
85
|
+
if (defaultValue.windowType !== undefined) {
|
|
86
|
+
setOtherEvent(defaultValue.otherEvent);
|
|
87
|
+
setWindowCnt(defaultValue.windowCnt);
|
|
88
|
+
setwindowTypeUnit(defaultValue.windowType);
|
|
89
|
+
defaultValue.windowCnt == 0 ? setWindowType(1) : setWindowType(2);
|
|
90
|
+
}
|
|
91
|
+
var _attrCount = {};
|
|
92
|
+
var _sourceCount = {};
|
|
93
|
+
data.sourceFilters.map(function (item) {
|
|
94
|
+
if (item.propfilters != undefined) {
|
|
95
|
+
_attrCount[item.eventId] = 1;
|
|
96
|
+
}
|
|
97
|
+
if (item.filters != undefined) {
|
|
98
|
+
_sourceCount[item.eventId] = item.filters.conditions.length;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
setMincePropCount(_attrCount);
|
|
102
|
+
setAttrSourceCount(_sourceCount);
|
|
77
103
|
}
|
|
78
104
|
setLoading(false);
|
|
79
105
|
}, []);
|
|
80
106
|
var onChange = function onChange(_changedValues, allValues) {
|
|
81
107
|
console.log(666, allValues);
|
|
108
|
+
setFormData(allValues);
|
|
82
109
|
var data = _.cloneDeep(allValues);
|
|
83
110
|
if (_changedValues.targetFilters) {
|
|
84
111
|
var eList = [];
|
|
@@ -97,18 +124,13 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
97
124
|
var targetData = targetChangeCallback(data, eList, eventGroupList);
|
|
98
125
|
form.setFieldsValue(targetData);
|
|
99
126
|
}
|
|
100
|
-
setButtonDisable(submitButtonDisableHandle(allValues, attrSourceCount, attrTargetCount));
|
|
127
|
+
setButtonDisable(submitButtonDisableHandle(allValues, attrSourceCount, attrTargetCount, mincePropCount));
|
|
101
128
|
};
|
|
102
129
|
var attrChange = function attrChange(e) {
|
|
103
130
|
var reason = form.getFieldValue('reason');
|
|
104
131
|
console.log('细分属性变化:', e, reason);
|
|
105
132
|
};
|
|
106
|
-
var
|
|
107
|
-
_useState18 = _slicedToArray(_useState17, 2),
|
|
108
|
-
verify = _useState18[0],
|
|
109
|
-
setVerify = _useState18[1];
|
|
110
|
-
var onFinish = function onFinish() {
|
|
111
|
-
setVerify(true);
|
|
133
|
+
var onFinish = function onFinish(isFetchRequest) {
|
|
112
134
|
form.validateFields().then(function (res) {
|
|
113
135
|
if (verifyHandle(res)) {
|
|
114
136
|
console.log('表单检验通过', res);
|
|
@@ -117,19 +139,25 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
117
139
|
res.windowType = windowType === 1 ? 'day' : windowTypeUnit;
|
|
118
140
|
var finalData = removeEmptyValue(res);
|
|
119
141
|
console.log(123123, finalData);
|
|
120
|
-
props.onChange(finalData);
|
|
142
|
+
props.onChange(finalData, isFetchRequest);
|
|
121
143
|
}
|
|
122
144
|
}).catch(function (e) {
|
|
123
145
|
console.log('表单检验失败', e);
|
|
124
146
|
});
|
|
125
147
|
};
|
|
148
|
+
useImperativeHandle(ref, function () {
|
|
149
|
+
return {
|
|
150
|
+
onGetSearchData: function onGetSearchData() {
|
|
151
|
+
onFinish(false);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
});
|
|
126
155
|
var otherEventChange = function otherEventChange(e) {
|
|
127
156
|
setOtherEvent(e.target.checked);
|
|
128
157
|
};
|
|
129
158
|
var onReset = function onReset() {
|
|
130
159
|
setButtonDisable(true);
|
|
131
160
|
form.resetFields();
|
|
132
|
-
setVerify(false);
|
|
133
161
|
setWindowType(1);
|
|
134
162
|
};
|
|
135
163
|
var _useState19 = useState(1),
|
|
@@ -193,12 +221,15 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
193
221
|
enableDelete: fields.length > 1,
|
|
194
222
|
eventIdList: eventIdList,
|
|
195
223
|
allValues: formData,
|
|
196
|
-
verify: verify,
|
|
197
224
|
onDelete: function onDelete() {
|
|
198
225
|
return remove(index);
|
|
199
226
|
},
|
|
200
227
|
setAttrTargetCount: setAttrTargetCount,
|
|
201
|
-
setAttrSourceCount: setAttrSourceCount
|
|
228
|
+
setAttrSourceCount: setAttrSourceCount,
|
|
229
|
+
setMincePropCount: setMincePropCount,
|
|
230
|
+
attrSourceCount: attrSourceCount,
|
|
231
|
+
mincePropCount: mincePropCount,
|
|
232
|
+
formData: formData
|
|
202
233
|
}));
|
|
203
234
|
}), fields.length < item.max && /*#__PURE__*/React.createElement("div", {
|
|
204
235
|
className: "".concat(classPrefix, "-add"),
|
|
@@ -213,6 +244,7 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
213
244
|
}), /*#__PURE__*/React.createElement("div", {
|
|
214
245
|
className: "".concat(classPrefix, "-otherEvent")
|
|
215
246
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
247
|
+
checked: otherEvent,
|
|
216
248
|
onChange: otherEventChange
|
|
217
249
|
}, "\u4E5F\u8BA1\u7B97\u5176\u4ED6\u8F6C\u5316\u4E8B\u4EF6"), /*#__PURE__*/React.createElement(Tooltip, {
|
|
218
250
|
placement: "right",
|
|
@@ -268,7 +300,8 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
268
300
|
width: 208
|
|
269
301
|
},
|
|
270
302
|
onChange: function onChange(e) {
|
|
271
|
-
|
|
303
|
+
setWindowType(e);
|
|
304
|
+
e === 1 ? setWindowCnt(0) : setWindowCnt(1);
|
|
272
305
|
},
|
|
273
306
|
options: [{
|
|
274
307
|
value: 1,
|
|
@@ -282,12 +315,12 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
282
315
|
style: {
|
|
283
316
|
width: 80
|
|
284
317
|
},
|
|
285
|
-
|
|
318
|
+
value: windowCnt,
|
|
286
319
|
onChange: function onChange(e) {
|
|
287
320
|
return setWindowCnt(e);
|
|
288
321
|
}
|
|
289
322
|
}), /*#__PURE__*/React.createElement(Select, {
|
|
290
|
-
|
|
323
|
+
value: windowTypeUnit,
|
|
291
324
|
style: {
|
|
292
325
|
width: 80
|
|
293
326
|
},
|
|
@@ -310,7 +343,9 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
310
343
|
className: "".concat(buttonDisable ? 'disable' : ''),
|
|
311
344
|
disabled: buttonDisable,
|
|
312
345
|
type: "primary",
|
|
313
|
-
onClick:
|
|
346
|
+
onClick: function onClick() {
|
|
347
|
+
return onFinish();
|
|
348
|
+
}
|
|
314
349
|
}, "\u63D0\u4EA4")))));
|
|
315
|
-
};
|
|
350
|
+
});
|
|
316
351
|
export default SearchPanel;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare namespace SearchPanelTypes {
|
|
2
2
|
interface Props {
|
|
3
3
|
defaultValue?: any;
|
|
4
|
-
onChange: (values: any) => void;
|
|
4
|
+
onChange: (values: any, isFetchRequest?: boolean | undefined) => void;
|
|
5
5
|
}
|
|
6
6
|
interface FieldProp {
|
|
7
7
|
key: string;
|
|
@@ -22,10 +22,21 @@ export declare namespace SearchPanelTypes {
|
|
|
22
22
|
eventIdList?: number[];
|
|
23
23
|
showOverview?: boolean;
|
|
24
24
|
onChange?: (data: any) => void;
|
|
25
|
-
onDelete
|
|
25
|
+
onDelete: () => void;
|
|
26
26
|
attrChange?: (data: any) => void;
|
|
27
|
-
|
|
27
|
+
formData: any;
|
|
28
28
|
setAttrTargetCount: Function;
|
|
29
29
|
setAttrSourceCount: Function;
|
|
30
|
+
attrSourceCount: {
|
|
31
|
+
[x: number]: number;
|
|
32
|
+
};
|
|
33
|
+
setMincePropCount: Function;
|
|
34
|
+
mincePropCount: {
|
|
35
|
+
[x: number]: number;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
interface bizAttributeSelectorValueProp {
|
|
39
|
+
id?: number;
|
|
40
|
+
propCategory?: string;
|
|
30
41
|
}
|
|
31
42
|
}
|
|
@@ -2,4 +2,8 @@ import { SearchData } from '../../types';
|
|
|
2
2
|
export declare function removeEmptyValue(source: SearchData): any;
|
|
3
3
|
export declare function verifyHandle(data: SearchData): boolean;
|
|
4
4
|
export declare function targetChangeCallback(data: SearchData, eList: number[], eventGroupList: any): SearchData;
|
|
5
|
-
export declare function submitButtonDisableHandle(data: SearchData, attrSourceCount:
|
|
5
|
+
export declare function submitButtonDisableHandle(data: SearchData, attrSourceCount: {
|
|
6
|
+
[x: number]: number;
|
|
7
|
+
}, attrTargetCount: number, mincePropCount: {
|
|
8
|
+
[x: number]: number;
|
|
9
|
+
}): boolean;
|
|
@@ -92,32 +92,46 @@ export function targetChangeCallback(data, eList, eventGroupList) {
|
|
|
92
92
|
}
|
|
93
93
|
return data;
|
|
94
94
|
}
|
|
95
|
-
var buttonDisable = function buttonDisable(data, type, count) {
|
|
95
|
+
var buttonDisable = function buttonDisable(data, type, count, mincePropCount) {
|
|
96
96
|
var flag = false;
|
|
97
97
|
data[type].map(function (item) {
|
|
98
98
|
item === undefined ? flag = true : null;
|
|
99
99
|
if (item !== undefined) {
|
|
100
100
|
var _item$filters;
|
|
101
101
|
(item === null || item === void 0 ? void 0 : item.eventId) === -100 ? flag = true : null;
|
|
102
|
-
|
|
102
|
+
if (type === 'targetFilters') {
|
|
103
|
+
item.filters === undefined && count != 0 ? flag = true : null;
|
|
104
|
+
} else {
|
|
105
|
+
item.filters === undefined && Object.keys(count).length > 0 && count[item.eventId] !== undefined ? flag = true : null;
|
|
106
|
+
if (mincePropCount != undefined) {
|
|
107
|
+
item.propfilters === undefined && Object.keys(mincePropCount).length > 0 && mincePropCount[item.eventId] !== undefined ? flag = true : null;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
103
110
|
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) {
|
|
104
|
-
var _item$filters2
|
|
111
|
+
var _item$filters2;
|
|
105
112
|
(_item$filters2 = item.filters) === null || _item$filters2 === void 0 ? void 0 : _item$filters2.conditions.map(function (_item) {
|
|
106
113
|
var _item$values;
|
|
107
114
|
_item.values && ((_item$values = _item.values) === null || _item$values === void 0 ? void 0 : _item$values.length) <= 0 ? flag = true : null;
|
|
108
115
|
});
|
|
109
|
-
(
|
|
116
|
+
if (type === 'targetFilters') {
|
|
117
|
+
var _item$filters3;
|
|
118
|
+
((_item$filters3 = item.filters) === null || _item$filters3 === void 0 ? void 0 : _item$filters3.conditions.length) != count ? flag = true : null;
|
|
119
|
+
} else {
|
|
120
|
+
var _item$filters4;
|
|
121
|
+
console.log('问题排查', item, count);
|
|
122
|
+
((_item$filters4 = item.filters) === null || _item$filters4 === void 0 ? void 0 : _item$filters4.conditions.length) != count[item.eventId] ? flag = true : null;
|
|
123
|
+
}
|
|
110
124
|
}
|
|
111
125
|
}
|
|
112
126
|
});
|
|
113
127
|
return flag;
|
|
114
128
|
};
|
|
115
|
-
export function submitButtonDisableHandle(data, attrSourceCount, attrTargetCount) {
|
|
129
|
+
export function submitButtonDisableHandle(data, attrSourceCount, attrTargetCount, mincePropCount) {
|
|
116
130
|
var flag = false;
|
|
117
131
|
data.attributionType === undefined ? flag = true : null;
|
|
118
|
-
buttonDisable(data, 'sourceFilters', attrSourceCount) ? flag = true : null;
|
|
132
|
+
buttonDisable(data, 'sourceFilters', attrSourceCount, mincePropCount) ? flag = true : null;
|
|
119
133
|
buttonDisable(data, 'targetFilters', attrTargetCount) ? flag = true : null;
|
|
120
|
-
console.log('判断提交按钮是否可点击',
|
|
134
|
+
console.log('判断提交按钮是否可点击', mincePropCount, flag, data);
|
|
121
135
|
return flag;
|
|
122
136
|
}
|
|
123
137
|
var judgeAttrInEvents = function judgeAttrInEvents(elds, attrId, eventGroupList) {
|
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.13",
|
|
4
4
|
"module": "es/index.js",
|
|
5
5
|
"typings": "es/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -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": "66b7cbd54d401cbcdb4d496683427c71ae3ee102"
|
|
54
54
|
}
|