@zgfe/modules-attribution 1.0.1-alpha.2 → 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/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 +110 -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 +114 -42
- 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 +103 -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 +25 -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,25 @@ 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;
|
|
23
|
+
console.log('SearchPanel', defaultValue);
|
|
24
24
|
var _useContext = useContext(AttributableContext),
|
|
25
25
|
buttonDisable = _useContext.buttonDisable,
|
|
26
26
|
setButtonDisable = _useContext.setButtonDisable;
|
|
27
|
-
|
|
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,102 +41,118 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
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
|
-
|
|
64
|
+
windowTypeUnit = _useState14[0],
|
|
65
|
+
setwindowTypeUnit = _useState14[1];
|
|
61
66
|
var _useState15 = useState(0),
|
|
62
67
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
attrTargetCount = _useState16[0],
|
|
69
|
+
setAttrTargetCount = _useState16[1];
|
|
70
|
+
var _useState17 = useState({}),
|
|
71
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
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
|
+
};
|
|
65
95
|
useEffect(function () {
|
|
66
96
|
if (defaultValue) {
|
|
67
97
|
var data = defaultValue;
|
|
68
|
-
console.log('初始化', data);
|
|
69
98
|
setFormData(data);
|
|
70
|
-
|
|
71
|
-
defaultValue.
|
|
72
|
-
|
|
73
|
-
|
|
99
|
+
setSelectEventIdList(defaultValue);
|
|
100
|
+
if (defaultValue.windowType !== undefined) {
|
|
101
|
+
setOtherEvent(defaultValue.otherEvent);
|
|
102
|
+
setWindowCnt(defaultValue.windowCnt);
|
|
103
|
+
setwindowTypeUnit(defaultValue.windowType);
|
|
104
|
+
defaultValue.windowCnt == -1 ? setWindowType(1) : setWindowType(2);
|
|
105
|
+
}
|
|
106
|
+
var _attrCount = {};
|
|
107
|
+
var _sourceCount = {};
|
|
108
|
+
data.sourceFilters.map(function (item) {
|
|
109
|
+
if (item.attributionSubdivision != undefined) {
|
|
110
|
+
_attrCount[item.eventId] = 1;
|
|
111
|
+
}
|
|
112
|
+
if (item.filters != undefined) {
|
|
113
|
+
_sourceCount[item.eventId] = item.filters.conditions.length;
|
|
74
114
|
}
|
|
75
115
|
});
|
|
76
|
-
|
|
116
|
+
setMincePropCount(_attrCount);
|
|
117
|
+
setAttrSourceCount(_sourceCount);
|
|
77
118
|
}
|
|
78
119
|
setLoading(false);
|
|
79
120
|
}, []);
|
|
80
121
|
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));
|
|
122
|
+
console.log('筛选值发生改变', _changedValues, allValues);
|
|
123
|
+
setFormData(allValues);
|
|
124
|
+
setSelectEventIdList(_.cloneDeep(allValues));
|
|
125
|
+
setButtonDisable(submitButtonDisableHandle(allValues, attrSourceCount, attrTargetCount, mincePropCount));
|
|
101
126
|
};
|
|
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);
|
|
127
|
+
var onFinish = function onFinish(isFetchRequest) {
|
|
112
128
|
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
|
-
}
|
|
129
|
+
res.otherEvent = otherEvent;
|
|
130
|
+
res.windowCnt = windowCnt;
|
|
131
|
+
res.windowType = windowType === 1 ? 'day' : windowTypeUnit;
|
|
132
|
+
props.onChange(res, isFetchRequest);
|
|
122
133
|
}).catch(function (e) {
|
|
123
134
|
console.log('表单检验失败', e);
|
|
124
135
|
});
|
|
125
136
|
};
|
|
137
|
+
useImperativeHandle(ref, function () {
|
|
138
|
+
return {
|
|
139
|
+
onGetSearchData: function onGetSearchData() {
|
|
140
|
+
onFinish(false);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
});
|
|
126
144
|
var otherEventChange = function otherEventChange(e) {
|
|
127
145
|
setOtherEvent(e.target.checked);
|
|
128
146
|
};
|
|
129
147
|
var onReset = function onReset() {
|
|
130
148
|
setButtonDisable(true);
|
|
131
149
|
form.resetFields();
|
|
132
|
-
setVerify(false);
|
|
133
150
|
setWindowType(1);
|
|
134
151
|
};
|
|
135
|
-
var
|
|
136
|
-
|
|
137
|
-
windowType =
|
|
138
|
-
setWindowType =
|
|
152
|
+
var _useState21 = useState(1),
|
|
153
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
154
|
+
windowType = _useState22[0],
|
|
155
|
+
setWindowType = _useState22[1];
|
|
139
156
|
return /*#__PURE__*/React.createElement("div", {
|
|
140
157
|
className: classPrefix
|
|
141
158
|
}, /*#__PURE__*/React.createElement(Skeleton, {
|
|
@@ -189,16 +206,17 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
189
206
|
}), /*#__PURE__*/React.createElement(SearchContent, {
|
|
190
207
|
type: item.type,
|
|
191
208
|
key: field.key,
|
|
192
|
-
attrChange: attrChange,
|
|
193
|
-
enableDelete: fields.length > 1,
|
|
194
209
|
eventIdList: eventIdList,
|
|
195
|
-
allValues: formData,
|
|
196
|
-
verify: verify,
|
|
197
210
|
onDelete: function onDelete() {
|
|
198
211
|
return remove(index);
|
|
199
212
|
},
|
|
200
213
|
setAttrTargetCount: setAttrTargetCount,
|
|
201
|
-
setAttrSourceCount: setAttrSourceCount
|
|
214
|
+
setAttrSourceCount: setAttrSourceCount,
|
|
215
|
+
setMincePropCount: setMincePropCount,
|
|
216
|
+
attrSourceCount: attrSourceCount,
|
|
217
|
+
mincePropCount: mincePropCount,
|
|
218
|
+
formData: formData,
|
|
219
|
+
selectList: selectList
|
|
202
220
|
}));
|
|
203
221
|
}), fields.length < item.max && /*#__PURE__*/React.createElement("div", {
|
|
204
222
|
className: "".concat(classPrefix, "-add"),
|
|
@@ -213,6 +231,7 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
213
231
|
}), /*#__PURE__*/React.createElement("div", {
|
|
214
232
|
className: "".concat(classPrefix, "-otherEvent")
|
|
215
233
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
234
|
+
checked: otherEvent,
|
|
216
235
|
onChange: otherEventChange
|
|
217
236
|
}, "\u4E5F\u8BA1\u7B97\u5176\u4ED6\u8F6C\u5316\u4E8B\u4EF6"), /*#__PURE__*/React.createElement(Tooltip, {
|
|
218
237
|
placement: "right",
|
|
@@ -268,7 +287,8 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
268
287
|
width: 208
|
|
269
288
|
},
|
|
270
289
|
onChange: function onChange(e) {
|
|
271
|
-
|
|
290
|
+
setWindowType(e);
|
|
291
|
+
e === 1 ? setWindowCnt(-1) : setWindowCnt(1);
|
|
272
292
|
},
|
|
273
293
|
options: [{
|
|
274
294
|
value: 1,
|
|
@@ -282,12 +302,13 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
282
302
|
style: {
|
|
283
303
|
width: 80
|
|
284
304
|
},
|
|
285
|
-
|
|
305
|
+
value: windowCnt,
|
|
286
306
|
onChange: function onChange(e) {
|
|
287
|
-
|
|
307
|
+
if (e !== null && e <= 0) return;
|
|
308
|
+
setWindowCnt(e);
|
|
288
309
|
}
|
|
289
310
|
}), /*#__PURE__*/React.createElement(Select, {
|
|
290
|
-
|
|
311
|
+
value: windowTypeUnit,
|
|
291
312
|
style: {
|
|
292
313
|
width: 80
|
|
293
314
|
},
|
|
@@ -310,7 +331,9 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
310
331
|
className: "".concat(buttonDisable ? 'disable' : ''),
|
|
311
332
|
disabled: buttonDisable,
|
|
312
333
|
type: "primary",
|
|
313
|
-
onClick:
|
|
334
|
+
onClick: function onClick() {
|
|
335
|
+
return onFinish(true);
|
|
336
|
+
}
|
|
314
337
|
}, "\u63D0\u4EA4")))));
|
|
315
|
-
};
|
|
338
|
+
});
|
|
316
339
|
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,31 @@
|
|
|
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
|
-
export interface SeriesProps {
|
|
35
|
-
names?: string[];
|
|
36
|
-
values: number[];
|
|
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?: PropfiltersProps | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface PropfiltersProps {
|
|
22
|
+
attrId: number | undefined;
|
|
23
|
+
propCategory: string | undefined;
|
|
24
|
+
type: string | undefined;
|
|
25
|
+
id?: number | undefined;
|
|
26
|
+
name?: string | undefined;
|
|
27
|
+
category?: string | undefined;
|
|
28
|
+
attrName?: string | undefined;
|
|
43
29
|
}
|
|
44
30
|
export interface TableDataHandleProps {
|
|
45
31
|
xAxis: string[];
|
|
@@ -47,6 +33,10 @@ export interface TableDataHandleProps {
|
|
|
47
33
|
values: string[];
|
|
48
34
|
}[];
|
|
49
35
|
}
|
|
36
|
+
export interface TableDataProps {
|
|
37
|
+
columns?: ColumnsProps[];
|
|
38
|
+
dataSource?: DataSourceProps[];
|
|
39
|
+
}
|
|
50
40
|
export interface DataSourceProps {
|
|
51
41
|
[x: string]: string;
|
|
52
42
|
}
|
|
@@ -55,8 +45,4 @@ export interface ColumnsProps {
|
|
|
55
45
|
title: string;
|
|
56
46
|
dataIndex: string;
|
|
57
47
|
}
|
|
58
|
-
export interface TableDataProps {
|
|
59
|
-
columns?: ColumnsProps[];
|
|
60
|
-
dataSource?: DataSourceProps[];
|
|
61
|
-
}
|
|
62
48
|
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.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
|
}
|
package/es/constants/chart.d.ts
DELETED