@zgfe/modules-attribution 1.0.1-alpha.2 → 1.0.1-alpha.23
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 +12 -5
- package/es/components/option/types.d.ts +3 -6
- package/es/components/searchTime/index.js +0 -1
- package/es/components/tableList/index.d.ts +2 -2
- package/es/components/tableList/index.js +9 -3
- package/es/components/title/index.js +7 -6
- package/es/constants/apis.d.ts +0 -4
- package/es/constants/apis.js +0 -4
- package/es/constants/fields.d.ts +0 -139
- package/es/constants/fields.js +1 -148
- package/es/constants/index.d.ts +2 -4
- package/es/constants/index.js +2 -4
- package/es/modules/content/index.d.ts +3 -3
- package/es/modules/content/index.js +41 -22
- package/es/modules/content/types.d.ts +3 -3
- package/es/modules/content/utils.d.ts +0 -6
- package/es/modules/content/utils.js +0 -163
- package/es/modules/home/demo/create.js +5 -35
- package/es/modules/home/demo/edit.js +116 -157
- package/es/modules/home/demo/index.js +4 -36
- package/es/modules/home/demo/scene.js +5 -35
- package/es/modules/home/index.d.ts +2 -2
- package/es/modules/home/index.js +14 -31
- package/es/modules/home/styles/index.less +2 -1
- package/es/modules/home/types.d.ts +1 -5
- package/es/modules/searchPanel/components/attributableEvents.js +122 -47
- package/es/modules/searchPanel/components/globalAttribute.d.ts +2 -1
- package/es/modules/searchPanel/components/globalAttribute.js +1 -2
- package/es/modules/searchPanel/components/targetEvent.js +33 -26
- package/es/modules/searchPanel/index.d.ts +1 -1
- package/es/modules/searchPanel/index.js +102 -80
- package/es/modules/searchPanel/types.d.ts +26 -11
- package/es/modules/searchPanel/utils.d.ts +8 -5
- package/es/modules/searchPanel/utils.js +44 -101
- package/es/types.d.ts +28 -39
- package/package.json +3 -3
- package/es/constants/chart.d.ts +0 -2
- package/es/constants/chart.js +0 -24
- package/es/constants/color.d.ts +0 -1
- package/es/constants/color.js +0 -1
- package/es/modules/searchPanel/demo/index.d.ts +0 -2
- package/es/modules/searchPanel/demo/index.js +0 -28
- package/es/utils/transfer.d.ts +0 -65
- package/es/utils/transfer.js +0 -173
|
@@ -7,24 +7,24 @@ 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';
|
|
14
14
|
import GlobalAttribute from './components/globalAttribute';
|
|
15
15
|
import './styles/index.less';
|
|
16
16
|
import _ from 'lodash';
|
|
17
|
-
import { targetChangeCallback, submitButtonDisableHandle
|
|
18
|
-
import { initTarget } from '../../constants/initData';
|
|
17
|
+
import { targetChangeCallback, submitButtonDisableHandle } from './utils';
|
|
19
18
|
import { searchFields } from '../../constants/fields';
|
|
20
19
|
import { AttributableContext } from '../../types';
|
|
21
20
|
export var classPrefix = 'mi-left-form';
|
|
22
|
-
var SearchPanel = function
|
|
21
|
+
var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
23
22
|
var defaultValue = props.defaultValue;
|
|
24
23
|
var _useContext = useContext(AttributableContext),
|
|
25
24
|
buttonDisable = _useContext.buttonDisable,
|
|
26
25
|
setButtonDisable = _useContext.setButtonDisable;
|
|
27
|
-
|
|
26
|
+
var _useContext2 = useContext(BizGlobalDataContext),
|
|
27
|
+
eventGroupList = _useContext2.eventGroupList;
|
|
28
28
|
var _Form$useForm = Form.useForm(),
|
|
29
29
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
30
30
|
form = _Form$useForm2[0];
|
|
@@ -40,102 +40,118 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
40
40
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
41
41
|
formData = _useState6[0],
|
|
42
42
|
setFormData = _useState6[1];
|
|
43
|
-
var _useState7 = useState([
|
|
43
|
+
var _useState7 = useState([]),
|
|
44
44
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
45
45
|
eventIdList = _useState8[0],
|
|
46
46
|
setEventIdList = _useState8[1];
|
|
47
|
-
var
|
|
48
|
-
eventGroupList = _useContext2.eventGroupList;
|
|
49
|
-
var _useState9 = useState(1),
|
|
47
|
+
var _useState9 = useState([]),
|
|
50
48
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
selectList = _useState10[0],
|
|
50
|
+
setSelectList = _useState10[1];
|
|
51
|
+
useEffect(function () {
|
|
52
|
+
if (formData) {
|
|
53
|
+
var targetData = targetChangeCallback(formData, eventIdList, eventGroupList);
|
|
54
|
+
form.setFieldsValue(targetData);
|
|
55
|
+
}
|
|
56
|
+
}, [eventIdList, formData]);
|
|
57
|
+
var _useState11 = useState(-1),
|
|
54
58
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
var _useState13 = useState(
|
|
59
|
+
windowCnt = _useState12[0],
|
|
60
|
+
setWindowCnt = _useState12[1];
|
|
61
|
+
var _useState13 = useState('day'),
|
|
58
62
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
windowTypeUnit = _useState14[0],
|
|
64
|
+
setwindowTypeUnit = _useState14[1];
|
|
61
65
|
var _useState15 = useState(0),
|
|
62
66
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
attrTargetCount = _useState16[0],
|
|
68
|
+
setAttrTargetCount = _useState16[1];
|
|
69
|
+
var _useState17 = useState({}),
|
|
70
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
71
|
+
attrSourceCount = _useState18[0],
|
|
72
|
+
setAttrSourceCount = _useState18[1];
|
|
73
|
+
var _useState19 = useState({}),
|
|
74
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
75
|
+
mincePropCount = _useState20[0],
|
|
76
|
+
setMincePropCount = _useState20[1];
|
|
77
|
+
var getSelectEventIdList = function getSelectEventIdList(data, type, eList) {
|
|
78
|
+
if (data[type]) {
|
|
79
|
+
data[type].forEach(function (target) {
|
|
80
|
+
if (target && target.eventId && target.eventId !== -100) {
|
|
81
|
+
eList.push(target.eventId);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return eList;
|
|
86
|
+
};
|
|
87
|
+
var setSelectEventIdList = function setSelectEventIdList(data) {
|
|
88
|
+
var eList = [];
|
|
89
|
+
var _eList = _.cloneDeep(getSelectEventIdList(data, 'targetFilters', eList));
|
|
90
|
+
getSelectEventIdList(data, 'sourceFilters', eList);
|
|
91
|
+
setEventIdList(_eList);
|
|
92
|
+
setSelectList(eList);
|
|
93
|
+
};
|
|
65
94
|
useEffect(function () {
|
|
66
95
|
if (defaultValue) {
|
|
67
96
|
var data = defaultValue;
|
|
68
|
-
console.log('初始化', data);
|
|
69
97
|
setFormData(data);
|
|
70
|
-
|
|
71
|
-
defaultValue.
|
|
72
|
-
|
|
73
|
-
|
|
98
|
+
setSelectEventIdList(defaultValue);
|
|
99
|
+
if (defaultValue.windowType !== undefined) {
|
|
100
|
+
setOtherEvent(defaultValue.otherEvent);
|
|
101
|
+
setWindowCnt(defaultValue.windowCnt);
|
|
102
|
+
setwindowTypeUnit(defaultValue.windowType);
|
|
103
|
+
defaultValue.windowCnt == -1 ? setWindowType(1) : setWindowType(2);
|
|
104
|
+
}
|
|
105
|
+
var _attrCount = {};
|
|
106
|
+
var _sourceCount = {};
|
|
107
|
+
data.sourceFilters.map(function (item) {
|
|
108
|
+
if (item.attributionSubdivision != undefined) {
|
|
109
|
+
_attrCount[item.eventId] = 1;
|
|
110
|
+
}
|
|
111
|
+
if (item.filters != undefined) {
|
|
112
|
+
_sourceCount[item.eventId] = item.filters.conditions.length;
|
|
74
113
|
}
|
|
75
114
|
});
|
|
76
|
-
|
|
115
|
+
setMincePropCount(_attrCount);
|
|
116
|
+
setAttrSourceCount(_sourceCount);
|
|
77
117
|
}
|
|
78
118
|
setLoading(false);
|
|
79
119
|
}, []);
|
|
80
120
|
var onChange = function onChange(_changedValues, allValues) {
|
|
81
|
-
console.log(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (allValues.targetFilters.length) {
|
|
86
|
-
allValues.targetFilters.forEach(function (target) {
|
|
87
|
-
if (target && target.eventId) {
|
|
88
|
-
eList.push(target.eventId);
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
} else {
|
|
92
|
-
data.targetFilters = initTarget;
|
|
93
|
-
eList = [-100];
|
|
94
|
-
}
|
|
95
|
-
console.log('999', eList);
|
|
96
|
-
setEventIdList(eList);
|
|
97
|
-
var targetData = targetChangeCallback(data, eList, eventGroupList);
|
|
98
|
-
form.setFieldsValue(targetData);
|
|
99
|
-
}
|
|
100
|
-
setButtonDisable(submitButtonDisableHandle(allValues, attrSourceCount, attrTargetCount));
|
|
121
|
+
console.log('筛选值发生改变', _changedValues, allValues);
|
|
122
|
+
setFormData(allValues);
|
|
123
|
+
setSelectEventIdList(_.cloneDeep(allValues));
|
|
124
|
+
setButtonDisable(submitButtonDisableHandle(allValues, attrSourceCount, attrTargetCount, mincePropCount));
|
|
101
125
|
};
|
|
102
|
-
var
|
|
103
|
-
var reason = form.getFieldValue('reason');
|
|
104
|
-
console.log('细分属性变化:', e, reason);
|
|
105
|
-
};
|
|
106
|
-
var _useState17 = useState(false),
|
|
107
|
-
_useState18 = _slicedToArray(_useState17, 2),
|
|
108
|
-
verify = _useState18[0],
|
|
109
|
-
setVerify = _useState18[1];
|
|
110
|
-
var onFinish = function onFinish() {
|
|
111
|
-
setVerify(true);
|
|
126
|
+
var onFinish = function onFinish(isFetchRequest) {
|
|
112
127
|
form.validateFields().then(function (res) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
res.windowType = windowType === 1 ? 'day' : windowTypeUnit;
|
|
118
|
-
var finalData = removeEmptyValue(res);
|
|
119
|
-
console.log(123123, finalData);
|
|
120
|
-
props.onChange(finalData);
|
|
121
|
-
}
|
|
128
|
+
res.otherEvent = otherEvent;
|
|
129
|
+
res.windowCnt = windowCnt;
|
|
130
|
+
res.windowType = windowType === 1 ? 'day' : windowTypeUnit;
|
|
131
|
+
props.onChange(res, isFetchRequest);
|
|
122
132
|
}).catch(function (e) {
|
|
123
133
|
console.log('表单检验失败', e);
|
|
124
134
|
});
|
|
125
135
|
};
|
|
136
|
+
useImperativeHandle(ref, function () {
|
|
137
|
+
return {
|
|
138
|
+
onGetSearchData: function onGetSearchData() {
|
|
139
|
+
onFinish(false);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
});
|
|
126
143
|
var otherEventChange = function otherEventChange(e) {
|
|
127
144
|
setOtherEvent(e.target.checked);
|
|
128
145
|
};
|
|
129
146
|
var onReset = function onReset() {
|
|
130
147
|
setButtonDisable(true);
|
|
131
148
|
form.resetFields();
|
|
132
|
-
setVerify(false);
|
|
133
149
|
setWindowType(1);
|
|
134
150
|
};
|
|
135
|
-
var
|
|
136
|
-
|
|
137
|
-
windowType =
|
|
138
|
-
setWindowType =
|
|
151
|
+
var _useState21 = useState(1),
|
|
152
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
153
|
+
windowType = _useState22[0],
|
|
154
|
+
setWindowType = _useState22[1];
|
|
139
155
|
return /*#__PURE__*/React.createElement("div", {
|
|
140
156
|
className: classPrefix
|
|
141
157
|
}, /*#__PURE__*/React.createElement(Skeleton, {
|
|
@@ -189,16 +205,17 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
189
205
|
}), /*#__PURE__*/React.createElement(SearchContent, {
|
|
190
206
|
type: item.type,
|
|
191
207
|
key: field.key,
|
|
192
|
-
attrChange: attrChange,
|
|
193
|
-
enableDelete: fields.length > 1,
|
|
194
208
|
eventIdList: eventIdList,
|
|
195
|
-
allValues: formData,
|
|
196
|
-
verify: verify,
|
|
197
209
|
onDelete: function onDelete() {
|
|
198
210
|
return remove(index);
|
|
199
211
|
},
|
|
200
212
|
setAttrTargetCount: setAttrTargetCount,
|
|
201
|
-
setAttrSourceCount: setAttrSourceCount
|
|
213
|
+
setAttrSourceCount: setAttrSourceCount,
|
|
214
|
+
setMincePropCount: setMincePropCount,
|
|
215
|
+
attrSourceCount: attrSourceCount,
|
|
216
|
+
mincePropCount: mincePropCount,
|
|
217
|
+
formData: formData,
|
|
218
|
+
selectList: selectList
|
|
202
219
|
}));
|
|
203
220
|
}), fields.length < item.max && /*#__PURE__*/React.createElement("div", {
|
|
204
221
|
className: "".concat(classPrefix, "-add"),
|
|
@@ -213,6 +230,7 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
213
230
|
}), /*#__PURE__*/React.createElement("div", {
|
|
214
231
|
className: "".concat(classPrefix, "-otherEvent")
|
|
215
232
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
233
|
+
checked: otherEvent,
|
|
216
234
|
onChange: otherEventChange
|
|
217
235
|
}, "\u4E5F\u8BA1\u7B97\u5176\u4ED6\u8F6C\u5316\u4E8B\u4EF6"), /*#__PURE__*/React.createElement(Tooltip, {
|
|
218
236
|
placement: "right",
|
|
@@ -268,7 +286,8 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
268
286
|
width: 208
|
|
269
287
|
},
|
|
270
288
|
onChange: function onChange(e) {
|
|
271
|
-
|
|
289
|
+
setWindowType(e);
|
|
290
|
+
e === 1 ? setWindowCnt(-1) : setWindowCnt(1);
|
|
272
291
|
},
|
|
273
292
|
options: [{
|
|
274
293
|
value: 1,
|
|
@@ -282,12 +301,13 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
282
301
|
style: {
|
|
283
302
|
width: 80
|
|
284
303
|
},
|
|
285
|
-
|
|
304
|
+
value: windowCnt,
|
|
286
305
|
onChange: function onChange(e) {
|
|
287
|
-
|
|
306
|
+
if (e !== null && e <= 0) return;
|
|
307
|
+
setWindowCnt(e);
|
|
288
308
|
}
|
|
289
309
|
}), /*#__PURE__*/React.createElement(Select, {
|
|
290
|
-
|
|
310
|
+
value: windowTypeUnit,
|
|
291
311
|
style: {
|
|
292
312
|
width: 80
|
|
293
313
|
},
|
|
@@ -310,7 +330,9 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
310
330
|
className: "".concat(buttonDisable ? 'disable' : ''),
|
|
311
331
|
disabled: buttonDisable,
|
|
312
332
|
type: "primary",
|
|
313
|
-
onClick:
|
|
333
|
+
onClick: function onClick() {
|
|
334
|
+
return onFinish(true);
|
|
335
|
+
}
|
|
314
336
|
}, "\u63D0\u4EA4")))));
|
|
315
|
-
};
|
|
337
|
+
});
|
|
316
338
|
export default SearchPanel;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { SearchValueProps, FiltersProps } from '../../types';
|
|
1
2
|
export declare namespace SearchPanelTypes {
|
|
2
3
|
interface Props {
|
|
3
|
-
defaultValue?:
|
|
4
|
-
onChange: (values:
|
|
4
|
+
defaultValue?: SearchValueProps;
|
|
5
|
+
onChange: (values: SearchValueProps, isFetchRequest: boolean) => void;
|
|
5
6
|
}
|
|
6
7
|
interface FieldProp {
|
|
7
8
|
key: string;
|
|
@@ -10,22 +11,36 @@ export declare namespace SearchPanelTypes {
|
|
|
10
11
|
label: string;
|
|
11
12
|
max: number;
|
|
12
13
|
addLabel: string;
|
|
13
|
-
options?: any[];
|
|
14
14
|
tips?: string;
|
|
15
15
|
required?: boolean;
|
|
16
16
|
}
|
|
17
17
|
interface PanelProp {
|
|
18
18
|
type: string;
|
|
19
|
-
value?:
|
|
20
|
-
allValues?: any;
|
|
21
|
-
enableDelete: boolean;
|
|
19
|
+
value?: FiltersProps;
|
|
22
20
|
eventIdList?: number[];
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
attrChange?: (data: any) => void;
|
|
27
|
-
verify: boolean;
|
|
21
|
+
onChange?: (data: FiltersProps) => void;
|
|
22
|
+
onDelete: () => void;
|
|
23
|
+
formData: SearchValueProps;
|
|
28
24
|
setAttrTargetCount: Function;
|
|
29
25
|
setAttrSourceCount: Function;
|
|
26
|
+
attrSourceCount: {
|
|
27
|
+
[x: number]: number;
|
|
28
|
+
};
|
|
29
|
+
setMincePropCount: Function;
|
|
30
|
+
mincePropCount: {
|
|
31
|
+
[x: number]: number;
|
|
32
|
+
};
|
|
33
|
+
selectList?: number[];
|
|
34
|
+
}
|
|
35
|
+
interface bizAttributeSelectorValueProp {
|
|
36
|
+
id?: number;
|
|
37
|
+
propCategory?: string;
|
|
38
|
+
}
|
|
39
|
+
interface targetDataProp {
|
|
40
|
+
event?: {
|
|
41
|
+
id: number;
|
|
42
|
+
name: string;
|
|
43
|
+
alias?: string;
|
|
44
|
+
};
|
|
30
45
|
}
|
|
31
46
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
5
|
-
|
|
1
|
+
import { SearchValueProps } from '../../types';
|
|
2
|
+
import { EventSelectTypes } from '@zgfe/business-lib/es/eventSelector/types';
|
|
3
|
+
export declare function targetChangeCallback(data: SearchValueProps, eList: number[], eventGroupList: EventSelectTypes.Value[]): SearchValueProps;
|
|
4
|
+
export declare function submitButtonDisableHandle(data: SearchValueProps, attrSourceCount: {
|
|
5
|
+
[x: number]: number;
|
|
6
|
+
}, attrTargetCount: number, mincePropCount: {
|
|
7
|
+
[x: number]: number;
|
|
8
|
+
}): boolean;
|
|
@@ -1,87 +1,16 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
export function removeEmptyValue(source) {
|
|
3
|
-
var data = _.cloneDeep(source);
|
|
4
|
-
var getValue = function getValue(formData) {
|
|
5
|
-
if (!formData) return formData;
|
|
6
|
-
var newData = [];
|
|
7
|
-
formData.forEach(function (item) {
|
|
8
|
-
if (item) {
|
|
9
|
-
if (item.filters) {
|
|
10
|
-
var conditions = getConditionList(item.filters.conditions);
|
|
11
|
-
if (conditions) {
|
|
12
|
-
item.filters.conditions = conditions;
|
|
13
|
-
} else {
|
|
14
|
-
item.filters = undefined;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
newData.push(item);
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
if (newData.length) return newData.length ? newData : undefined;
|
|
21
|
-
};
|
|
22
|
-
data.targetFilters = getValue(data.targetFilters)[0];
|
|
23
|
-
data.sourceFilters = getValue(data.sourceFilters);
|
|
24
|
-
if (data.globalFilters) {
|
|
25
|
-
var conditions = getConditionList(data.globalFilters.conditions);
|
|
26
|
-
if (conditions) {
|
|
27
|
-
data.globalFilters.conditions = conditions;
|
|
28
|
-
} else {
|
|
29
|
-
data.globalFilters = undefined;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return data;
|
|
33
|
-
}
|
|
34
|
-
export function verifyHandle(data) {
|
|
35
|
-
console.log('判断表单校验是否通过', data);
|
|
36
|
-
var targetFilters = data.targetFilters,
|
|
37
|
-
sourceFilters = data.sourceFilters;
|
|
38
|
-
var _verify = true;
|
|
39
|
-
targetFilters.map(function (item) {
|
|
40
|
-
if (item.eventId === -100 || item === undefined) _verify = false;
|
|
41
|
-
});
|
|
42
|
-
sourceFilters.map(function (item) {
|
|
43
|
-
if (item.eventId === -100 || item === undefined) _verify = false;
|
|
44
|
-
});
|
|
45
|
-
return _verify;
|
|
46
|
-
}
|
|
47
|
-
var OperateTypes;
|
|
48
|
-
(function (OperateTypes) {
|
|
49
|
-
OperateTypes["IsNull"] = "is null";
|
|
50
|
-
OperateTypes["IsNotNull"] = "is not null";
|
|
51
|
-
})(OperateTypes || (OperateTypes = {}));
|
|
52
|
-
function getConditionList(condition) {
|
|
53
|
-
if (!condition) return;
|
|
54
|
-
var conditionList = [];
|
|
55
|
-
condition.forEach(function (item) {
|
|
56
|
-
if (!item.attrId && !item.attrName) return;
|
|
57
|
-
if (!item.values || !item.values.length) {
|
|
58
|
-
if (item.operator === OperateTypes.IsNotNull || item.operator === OperateTypes.IsNull) {
|
|
59
|
-
conditionList.push(item);
|
|
60
|
-
}
|
|
61
|
-
} else {
|
|
62
|
-
conditionList.push(item);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
return conditionList.length ? conditionList : undefined;
|
|
66
|
-
}
|
|
67
1
|
export function targetChangeCallback(data, eList, eventGroupList) {
|
|
68
|
-
if (eList
|
|
2
|
+
if (eList.length <= 0) {
|
|
69
3
|
data.globalFilters = undefined;
|
|
70
4
|
} else {
|
|
71
5
|
if (data.globalFilters && data.globalFilters.conditions) {
|
|
72
|
-
var
|
|
73
|
-
flag = true;
|
|
6
|
+
var flag = true;
|
|
74
7
|
data.globalFilters.conditions.forEach(function (condition) {
|
|
75
8
|
if (condition) {
|
|
76
9
|
if (condition.propCategory === 'eventProp' && condition.attrId) {
|
|
77
10
|
var hasExit = judgeAttrInEvents(eList, condition.attrId, eventGroupList);
|
|
78
|
-
if (hasExit) {
|
|
79
|
-
newFilters.push(condition);
|
|
80
|
-
} else {
|
|
11
|
+
if (!hasExit) {
|
|
81
12
|
flag = false;
|
|
82
13
|
}
|
|
83
|
-
} else {
|
|
84
|
-
newFilters.push(condition);
|
|
85
14
|
}
|
|
86
15
|
}
|
|
87
16
|
});
|
|
@@ -92,48 +21,62 @@ export function targetChangeCallback(data, eList, eventGroupList) {
|
|
|
92
21
|
}
|
|
93
22
|
return data;
|
|
94
23
|
}
|
|
95
|
-
var
|
|
24
|
+
var judgeAttrInEvents = function judgeAttrInEvents(elds, attrId, eventGroupList) {
|
|
96
25
|
var flag = false;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
var _item$values;
|
|
107
|
-
_item.values && ((_item$values = _item.values) === null || _item$values === void 0 ? void 0 : _item$values.length) <= 0 ? flag = true : null;
|
|
26
|
+
if (!eventGroupList) return false;
|
|
27
|
+
eventGroupList.forEach(function (group) {
|
|
28
|
+
group.eventList.forEach(function (event) {
|
|
29
|
+
if (elds.includes(event.id)) {
|
|
30
|
+
event.attrList.forEach(function (attr) {
|
|
31
|
+
if (attr.id === attrId) {
|
|
32
|
+
flag = true;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
108
35
|
});
|
|
109
|
-
((_item$filters3 = item.filters) === null || _item$filters3 === void 0 ? void 0 : _item$filters3.conditions.length) != count ? flag = true : null;
|
|
110
36
|
}
|
|
111
|
-
}
|
|
37
|
+
});
|
|
112
38
|
});
|
|
113
39
|
return flag;
|
|
114
40
|
};
|
|
115
|
-
export function submitButtonDisableHandle(data, attrSourceCount, attrTargetCount) {
|
|
41
|
+
export function submitButtonDisableHandle(data, attrSourceCount, attrTargetCount, mincePropCount) {
|
|
116
42
|
var flag = false;
|
|
117
43
|
data.attributionType === undefined ? flag = true : null;
|
|
118
|
-
buttonDisable(data, 'sourceFilters', attrSourceCount) ? flag = true : null;
|
|
44
|
+
buttonDisable(data, 'sourceFilters', attrSourceCount, mincePropCount) ? flag = true : null;
|
|
119
45
|
buttonDisable(data, 'targetFilters', attrTargetCount) ? flag = true : null;
|
|
120
|
-
console.log('判断提交按钮是否可点击', attrSourceCount, flag, data);
|
|
121
46
|
return flag;
|
|
122
47
|
}
|
|
123
|
-
var
|
|
48
|
+
var buttonDisable = function buttonDisable(data, type, count, mincePropCount) {
|
|
124
49
|
var flag = false;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
50
|
+
data[type].map(function (item) {
|
|
51
|
+
item === undefined ? flag = true : null;
|
|
52
|
+
if (item !== undefined) {
|
|
53
|
+
var _item$filters;
|
|
54
|
+
(item === null || item === void 0 ? void 0 : item.eventId) === -100 ? flag = true : null;
|
|
55
|
+
if (type === 'targetFilters') {
|
|
56
|
+
item.filters === undefined && count != 0 ? flag = true : null;
|
|
57
|
+
} else {
|
|
58
|
+
item.filters === undefined && Object.keys(count).length > 0 && count[item.eventId] !== undefined ? flag = true : null;
|
|
59
|
+
if (mincePropCount != undefined) {
|
|
60
|
+
item.attributionSubdivision === undefined && Object.keys(mincePropCount).length > 0 && mincePropCount[item.eventId] !== undefined ? flag = true : null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
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
|
+
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;
|
|
133
69
|
}
|
|
134
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
|
+
}
|
|
135
78
|
}
|
|
136
|
-
}
|
|
79
|
+
}
|
|
137
80
|
});
|
|
138
81
|
return flag;
|
|
139
82
|
};
|
package/es/types.d.ts
CHANGED
|
@@ -1,45 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AttrConditionTypes } from '@zgfe/business-lib';
|
|
2
3
|
import { DatePickerTypes } from '@zgfe/business-lib/es/datePicker/types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
sourceFilters?: Array<TargetConditionTypes.Value>;
|
|
4
|
+
export interface SearchValueProps {
|
|
5
|
+
targetFilters: Array<FiltersProps>;
|
|
6
|
+
sourceFilters: Array<FiltersProps>;
|
|
7
7
|
globalFilters?: AttrConditionTypes.GroupValue;
|
|
8
8
|
globalDimensions?: Array<AttrConditionTypes.ItemValue>;
|
|
9
9
|
time?: DatePickerTypes.Value;
|
|
10
10
|
otherEvent?: boolean;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
targetFilters: Array<TargetConditionTypes.Value>;
|
|
14
|
-
sourceFilters: Array<TargetConditionTypes.Value>;
|
|
15
|
-
globalFilters?: AttrConditionTypes.GroupValue;
|
|
16
|
-
time?: DatePickerTypes.Value;
|
|
11
|
+
windowCnt?: number;
|
|
12
|
+
windowType?: 'hour' | 'day';
|
|
17
13
|
attributionType?: number;
|
|
18
|
-
otherEvent?: boolean;
|
|
19
14
|
}
|
|
20
|
-
export interface
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
export interface
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
index?: string;
|
|
38
|
-
duration?: TableChildrenProps[];
|
|
39
|
-
}
|
|
40
|
-
export interface TableChildrenProps {
|
|
41
|
-
name: string;
|
|
42
|
-
values: number[];
|
|
15
|
+
export interface FiltersProps {
|
|
16
|
+
eventId: number;
|
|
17
|
+
eventName: string;
|
|
18
|
+
filters?: AttrConditionTypes.GroupValue | undefined;
|
|
19
|
+
attributionSubdivision?: AttributionSubdivisionProps | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface AttributionSubdivisionProps {
|
|
22
|
+
relation: 'and' | 'or';
|
|
23
|
+
conditions: {
|
|
24
|
+
attrId: number | undefined;
|
|
25
|
+
propCategory: string | undefined;
|
|
26
|
+
type: string | undefined;
|
|
27
|
+
id?: number | undefined;
|
|
28
|
+
name?: string | undefined;
|
|
29
|
+
category?: string | undefined;
|
|
30
|
+
attrName?: string | undefined;
|
|
31
|
+
};
|
|
43
32
|
}
|
|
44
33
|
export interface TableDataHandleProps {
|
|
45
34
|
xAxis: string[];
|
|
@@ -47,6 +36,10 @@ export interface TableDataHandleProps {
|
|
|
47
36
|
values: string[];
|
|
48
37
|
}[];
|
|
49
38
|
}
|
|
39
|
+
export interface TableDataProps {
|
|
40
|
+
columns?: ColumnsProps[];
|
|
41
|
+
dataSource?: DataSourceProps[];
|
|
42
|
+
}
|
|
50
43
|
export interface DataSourceProps {
|
|
51
44
|
[x: string]: string;
|
|
52
45
|
}
|
|
@@ -55,8 +48,4 @@ export interface ColumnsProps {
|
|
|
55
48
|
title: string;
|
|
56
49
|
dataIndex: string;
|
|
57
50
|
}
|
|
58
|
-
export interface TableDataProps {
|
|
59
|
-
columns?: ColumnsProps[];
|
|
60
|
-
dataSource?: DataSourceProps[];
|
|
61
|
-
}
|
|
62
51
|
export declare const AttributableContext: import("react").Context<any>;
|
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.23",
|
|
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": "29c789967da8b0268c0d9e70e481252935120876"
|
|
54
54
|
}
|
package/es/constants/chart.d.ts
DELETED