@zgfe/modules-attribution 1.0.1
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/README.md +33 -0
- package/dist/esm/components/common/index.d.ts +6 -0
- package/dist/esm/components/common/index.js +21 -0
- package/dist/esm/components/common/styles/index.less +27 -0
- package/dist/esm/components/index.d.ts +6 -0
- package/dist/esm/components/index.js +6 -0
- package/dist/esm/components/option/index.d.ts +5 -0
- package/dist/esm/components/option/index.js +199 -0
- package/dist/esm/components/option/styles/index.less +17 -0
- package/dist/esm/components/option/types.d.ts +9 -0
- package/dist/esm/components/option/types.js +1 -0
- package/dist/esm/components/renderContent/index.d.ts +5 -0
- package/dist/esm/components/renderContent/index.js +92 -0
- package/dist/esm/components/renderContent/styles/index.less +21 -0
- package/dist/esm/components/renderContent/types.d.ts +15 -0
- package/dist/esm/components/renderContent/types.js +1 -0
- package/dist/esm/components/searchPanel/index.d.ts +5 -0
- package/dist/esm/components/searchPanel/index.js +122 -0
- package/dist/esm/components/searchPanel/styles/index.less +38 -0
- package/dist/esm/components/searchPanel/types.d.ts +10 -0
- package/dist/esm/components/searchPanel/types.js +1 -0
- package/dist/esm/components/showList/index.d.ts +10 -0
- package/dist/esm/components/showList/index.js +92 -0
- package/dist/esm/components/showList/listPanel.d.ts +9 -0
- package/dist/esm/components/showList/listPanel.js +118 -0
- package/dist/esm/components/showList/styles/index.less +75 -0
- package/dist/esm/components/showList/types.d.ts +9 -0
- package/dist/esm/components/showList/types.js +1 -0
- package/dist/esm/components/table/index.d.ts +5 -0
- package/dist/esm/components/table/index.js +194 -0
- package/dist/esm/components/table/styles/index.less +12 -0
- package/dist/esm/components/table/types.d.ts +11 -0
- package/dist/esm/components/table/types.js +1 -0
- package/dist/esm/components/title/index.d.ts +5 -0
- package/dist/esm/components/title/index.js +184 -0
- package/dist/esm/components/title/searchTitle.d.ts +7 -0
- package/dist/esm/components/title/searchTitle.js +47 -0
- package/dist/esm/components/title/styles/index.less +72 -0
- package/dist/esm/components/title/styles/search.less +27 -0
- package/dist/esm/components/title/types.d.ts +7 -0
- package/dist/esm/components/title/types.js +1 -0
- package/dist/esm/constants/apis.d.ts +9 -0
- package/dist/esm/constants/apis.js +9 -0
- package/dist/esm/constants/chart.d.ts +2 -0
- package/dist/esm/constants/chart.js +24 -0
- package/dist/esm/constants/color.d.ts +1 -0
- package/dist/esm/constants/color.js +1 -0
- package/dist/esm/constants/fields.d.ts +218 -0
- package/dist/esm/constants/fields.js +242 -0
- package/dist/esm/constants/index.d.ts +6 -0
- package/dist/esm/constants/index.js +6 -0
- package/dist/esm/constants/initData.d.ts +17 -0
- package/dist/esm/constants/initData.js +30 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/modules/content/index.d.ts +5 -0
- package/dist/esm/modules/content/index.js +218 -0
- package/dist/esm/modules/content/styles/index.less +7 -0
- package/dist/esm/modules/content/types.d.ts +8 -0
- package/dist/esm/modules/content/types.js +2 -0
- package/dist/esm/modules/content/utiles.d.ts +12 -0
- package/dist/esm/modules/content/utiles.js +231 -0
- package/dist/esm/modules/home/demo/create.d.ts +3 -0
- package/dist/esm/modules/home/demo/create.js +54 -0
- package/dist/esm/modules/home/demo/edit.d.ts +3 -0
- package/dist/esm/modules/home/demo/edit.js +80 -0
- package/dist/esm/modules/home/demo/index.d.ts +4 -0
- package/dist/esm/modules/home/demo/index.js +52 -0
- package/dist/esm/modules/home/demo/scene.d.ts +3 -0
- package/dist/esm/modules/home/demo/scene.js +74 -0
- package/dist/esm/modules/home/demo/styles/index.less +33 -0
- package/dist/esm/modules/home/index.d.ts +5 -0
- package/dist/esm/modules/home/index.js +172 -0
- package/dist/esm/modules/home/styles/index.less +37 -0
- package/dist/esm/modules/home/types.d.ts +19 -0
- package/dist/esm/modules/home/types.js +2 -0
- package/dist/esm/modules/leftPanel/components/globalAttribute.d.ts +8 -0
- package/dist/esm/modules/leftPanel/components/globalAttribute.js +64 -0
- package/dist/esm/modules/leftPanel/components/panel.d.ts +4 -0
- package/dist/esm/modules/leftPanel/components/panel.js +87 -0
- package/dist/esm/modules/leftPanel/demo/index.d.ts +3 -0
- package/dist/esm/modules/leftPanel/demo/index.js +28 -0
- package/dist/esm/modules/leftPanel/index.d.ts +6 -0
- package/dist/esm/modules/leftPanel/index.js +285 -0
- package/dist/esm/modules/leftPanel/styles/index.less +55 -0
- package/dist/esm/modules/leftPanel/types.d.ts +27 -0
- package/dist/esm/modules/leftPanel/types.js +2 -0
- package/dist/esm/modules/leftPanel/utils.d.ts +5 -0
- package/dist/esm/modules/leftPanel/utils.js +262 -0
- package/dist/esm/style/image/noData.png +0 -0
- package/dist/esm/style/image/ring.svg +9 -0
- package/dist/esm/style/index.less +47 -0
- package/dist/esm/style/theme.d.ts +15 -0
- package/dist/esm/style/theme.js +16 -0
- package/dist/esm/types.d.ts +46 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/utils/ajaxConfig.d.ts +8 -0
- package/dist/esm/utils/ajaxConfig.js +47 -0
- package/dist/esm/utils/base64.d.ts +23 -0
- package/dist/esm/utils/base64.js +132 -0
- package/dist/esm/utils/formData.d.ts +18 -0
- package/dist/esm/utils/formData.js +485 -0
- package/dist/esm/utils/transfer.d.ts +65 -0
- package/dist/esm/utils/transfer.js +206 -0
- package/dist/esm/utils/util.d.ts +32 -0
- package/dist/esm/utils/util.js +177 -0
- package/package.json +54 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
|
+
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; }
|
|
12
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
15
|
+
import { IconFont, BizGlobalDataContext } from '@zgfe/business-lib';
|
|
16
|
+
import { Form, Skeleton, Button } from 'antd';
|
|
17
|
+
import SearchPanel from "./components/panel";
|
|
18
|
+
import GlobalAttribute from "./components/globalAttribute";
|
|
19
|
+
import "./styles/index.less";
|
|
20
|
+
import _ from 'lodash';
|
|
21
|
+
import { formatSearchData, formValue, removeEmptyValue, targetChangeCallback } from "./utils";
|
|
22
|
+
import { initTarget } from "../../constants/initData";
|
|
23
|
+
import { searchFields } from "../../constants/fields";
|
|
24
|
+
export var classPrefix = 'mi-left-form';
|
|
25
|
+
var LeftPanel = function LeftPanel(props) {
|
|
26
|
+
var defaultValue = props.defaultValue;
|
|
27
|
+
// 是否是新增引起的变化
|
|
28
|
+
var _useState = useState(false),
|
|
29
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
30
|
+
isAdd = _useState2[0],
|
|
31
|
+
setIsAdd = _useState2[1];
|
|
32
|
+
|
|
33
|
+
// form 值
|
|
34
|
+
var _Form$useForm = Form.useForm(),
|
|
35
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
36
|
+
form = _Form$useForm2[0];
|
|
37
|
+
|
|
38
|
+
// 是否加载中
|
|
39
|
+
var _useState3 = useState(true),
|
|
40
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
41
|
+
loading = _useState4[0],
|
|
42
|
+
setLoading = _useState4[1];
|
|
43
|
+
|
|
44
|
+
// 筛选条件值
|
|
45
|
+
var _useState5 = useState(),
|
|
46
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
47
|
+
formData = _useState6[0],
|
|
48
|
+
setFormData = _useState6[1];
|
|
49
|
+
|
|
50
|
+
// 指标下拉列表中是否展示事件概览
|
|
51
|
+
var _useState7 = useState(true),
|
|
52
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
53
|
+
showOverview = _useState8[0],
|
|
54
|
+
setShowOverview = _useState8[1];
|
|
55
|
+
// 已选择的事件id列表
|
|
56
|
+
var _useState9 = useState([-100]),
|
|
57
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
58
|
+
eventIdList = _useState10[0],
|
|
59
|
+
setEventIdList = _useState10[1];
|
|
60
|
+
var _useContext = useContext(BizGlobalDataContext),
|
|
61
|
+
eventGroupList = _useContext.eventGroupList,
|
|
62
|
+
userGroupList = _useContext.userGroupList;
|
|
63
|
+
|
|
64
|
+
// 初始化
|
|
65
|
+
useEffect(function () {
|
|
66
|
+
if (defaultValue) {
|
|
67
|
+
var _defaultValue = _objectSpread(_objectSpread({}, defaultValue), {}, {
|
|
68
|
+
event: defaultValue.targets,
|
|
69
|
+
process: defaultValue.targets
|
|
70
|
+
});
|
|
71
|
+
var data = formValue(_defaultValue, userGroupList);
|
|
72
|
+
setFormData(data);
|
|
73
|
+
// 初始化事件id列表
|
|
74
|
+
var eList = [];
|
|
75
|
+
_defaultValue.targets.forEach(function (target) {
|
|
76
|
+
if (target && target.eventId) {
|
|
77
|
+
eList.push(target.eventId);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
setEventIdList(eList);
|
|
81
|
+
}
|
|
82
|
+
setLoading(false);
|
|
83
|
+
}, []);
|
|
84
|
+
|
|
85
|
+
// 点击表格中事件进入具体的事件查询
|
|
86
|
+
useEffect(function () {
|
|
87
|
+
var targets = props.targets;
|
|
88
|
+
if (!targets || !formData) return;
|
|
89
|
+
// 指标先清空再赋值(因为指标的赋值只有在初始化时才起作用)
|
|
90
|
+
var data = _.cloneDeep(formData);
|
|
91
|
+
data.globalFilters = undefined;
|
|
92
|
+
data.globalDimensions = undefined;
|
|
93
|
+
data.targets = targets;
|
|
94
|
+
var initData = _objectSpread(_objectSpread({}, formData), {}, {
|
|
95
|
+
targets: undefined,
|
|
96
|
+
event: undefined,
|
|
97
|
+
process: undefined
|
|
98
|
+
});
|
|
99
|
+
setFormData(initData);
|
|
100
|
+
setTimeout(function () {
|
|
101
|
+
form.setFieldsValue(data);
|
|
102
|
+
setFormData(data);
|
|
103
|
+
setEventIdList([targets[0].eventId]);
|
|
104
|
+
}, 0);
|
|
105
|
+
}, [props.targets]);
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* 表单项添加
|
|
109
|
+
* @param name 表单项名称
|
|
110
|
+
* @param callback onAdd回调
|
|
111
|
+
* @returns
|
|
112
|
+
*/
|
|
113
|
+
var onAdd = function onAdd(name, callback) {
|
|
114
|
+
var targets = form.getFieldValue('targets');
|
|
115
|
+
if (name === 'targets') {
|
|
116
|
+
if (targets[0].eventId === -100) {
|
|
117
|
+
setShowOverview(true);
|
|
118
|
+
return;
|
|
119
|
+
} else if (targets.length > 1 && !targets[targets.length - 1]) {
|
|
120
|
+
// 新增的指标还没有选择时,不允许新增
|
|
121
|
+
setShowOverview(false);
|
|
122
|
+
return;
|
|
123
|
+
} else {
|
|
124
|
+
setShowOverview(false);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (name === 'globalDimensions' && targets[0].eventId === -100) return;
|
|
128
|
+
setIsAdd(true);
|
|
129
|
+
setTimeout(function () {
|
|
130
|
+
callback();
|
|
131
|
+
}, 0);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* form list 删除
|
|
136
|
+
* 为了解决指标,多个时除了第一个其他的都没有值,删除第一个就会导致报错
|
|
137
|
+
* @param name form name
|
|
138
|
+
* @param index 位置
|
|
139
|
+
* @param callback remove
|
|
140
|
+
*/
|
|
141
|
+
var _onDelete = function onDelete(name, index, callback) {
|
|
142
|
+
if (name === 'targets') {
|
|
143
|
+
var targetValue = form.getFieldValue(name);
|
|
144
|
+
if (index === 0) {
|
|
145
|
+
var empty = [0];
|
|
146
|
+
for (var i = 1; i < targetValue.length; i++) {
|
|
147
|
+
if (!targetValue[i]) {
|
|
148
|
+
empty.push(i);
|
|
149
|
+
} else {
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
callback(empty);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
callback(index);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* 判断添加按钮是否显示
|
|
162
|
+
* @param name 当前form item的name
|
|
163
|
+
* @returns
|
|
164
|
+
*/
|
|
165
|
+
var onShowAddBtn = function onShowAddBtn(name) {
|
|
166
|
+
var targets = form.getFieldValue('targets');
|
|
167
|
+
if (name === 'targets' || name === 'globalDimensions') {
|
|
168
|
+
if (targets && targets[0].eventId === -100) {
|
|
169
|
+
return 'disabled';
|
|
170
|
+
}
|
|
171
|
+
if (name === 'targets') {
|
|
172
|
+
var length = targets.length;
|
|
173
|
+
if (length > 1 && !targets[length - 1]) {
|
|
174
|
+
return 'disabled';
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return '';
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* 筛选值发生改变
|
|
183
|
+
* @param _changedValues 当前表单项改变后的值
|
|
184
|
+
* @param allValues 当前表单值
|
|
185
|
+
* @returns
|
|
186
|
+
*/
|
|
187
|
+
var onChange = function onChange(_changedValues, allValues) {
|
|
188
|
+
// 是新增引起的变化则不请求接口
|
|
189
|
+
if (isAdd) {
|
|
190
|
+
setIsAdd(false);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
var data = _.cloneDeep(allValues);
|
|
194
|
+
if (_changedValues.targets) {
|
|
195
|
+
var eList = [];
|
|
196
|
+
if (allValues.targets.length) {
|
|
197
|
+
allValues.targets.forEach(function (target) {
|
|
198
|
+
if (target && target.eventId) {
|
|
199
|
+
eList.push(target.eventId);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
} else {
|
|
203
|
+
data.targets = initTarget;
|
|
204
|
+
eList = [-100];
|
|
205
|
+
}
|
|
206
|
+
setEventIdList(eList);
|
|
207
|
+
var targetData = targetChangeCallback(data, eList, eventGroupList);
|
|
208
|
+
form.setFieldsValue(targetData);
|
|
209
|
+
// 多于1个指标,不显示事件概览
|
|
210
|
+
setShowOverview(allValues.targets.length <= 1);
|
|
211
|
+
}
|
|
212
|
+
var finalData = removeEmptyValue(data);
|
|
213
|
+
setFormData(finalData);
|
|
214
|
+
props.onChange(formatSearchData(finalData));
|
|
215
|
+
};
|
|
216
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
217
|
+
className: classPrefix
|
|
218
|
+
}, /*#__PURE__*/React.createElement(Skeleton, {
|
|
219
|
+
loading: loading,
|
|
220
|
+
active: true,
|
|
221
|
+
paragraph: {
|
|
222
|
+
rows: 4
|
|
223
|
+
}
|
|
224
|
+
}, /*#__PURE__*/React.createElement(Form, {
|
|
225
|
+
form: form,
|
|
226
|
+
layout: "vertical",
|
|
227
|
+
initialValues: formData,
|
|
228
|
+
onValuesChange: onChange
|
|
229
|
+
}, searchFields.map(function (item) {
|
|
230
|
+
if (item.type === 'globalFilters') {
|
|
231
|
+
return /*#__PURE__*/React.createElement(Form.Item, {
|
|
232
|
+
key: item.key
|
|
233
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
234
|
+
className: "".concat(classPrefix, "-title")
|
|
235
|
+
}, item.label), /*#__PURE__*/React.createElement(Form.Item, {
|
|
236
|
+
className: "".concat(classPrefix, "-item"),
|
|
237
|
+
name: item.name
|
|
238
|
+
}, /*#__PURE__*/React.createElement(GlobalAttribute, {
|
|
239
|
+
max: item.max,
|
|
240
|
+
eventIdList: eventIdList
|
|
241
|
+
})));
|
|
242
|
+
}
|
|
243
|
+
return /*#__PURE__*/React.createElement(Form.List, {
|
|
244
|
+
name: item.name,
|
|
245
|
+
key: item.key
|
|
246
|
+
}, function (fields, _ref, index) {
|
|
247
|
+
var add = _ref.add,
|
|
248
|
+
remove = _ref.remove;
|
|
249
|
+
return /*#__PURE__*/React.createElement(Form.Item, {
|
|
250
|
+
className: item.type,
|
|
251
|
+
key: "".concat(item.key, "-item-").concat(index)
|
|
252
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
253
|
+
className: "".concat(classPrefix, "-title")
|
|
254
|
+
}, " ", item.label, " "), fields.map(function (field, index) {
|
|
255
|
+
return /*#__PURE__*/React.createElement(Form.Item, _extends({}, field, {
|
|
256
|
+
key: field.key,
|
|
257
|
+
className: "".concat(classPrefix, "-item")
|
|
258
|
+
}), /*#__PURE__*/React.createElement(SearchPanel, {
|
|
259
|
+
type: item.type,
|
|
260
|
+
showOverview: showOverview,
|
|
261
|
+
enableDelete: fields.length > 1,
|
|
262
|
+
eventIdList: eventIdList,
|
|
263
|
+
allValues: formData,
|
|
264
|
+
onDelete: function onDelete() {
|
|
265
|
+
return _onDelete(item.name, index, remove);
|
|
266
|
+
}
|
|
267
|
+
}));
|
|
268
|
+
}), fields.length < item.max && item.addLabel !== '' && /*#__PURE__*/React.createElement("div", {
|
|
269
|
+
className: "".concat(classPrefix, "-add ").concat(onShowAddBtn(item.name)),
|
|
270
|
+
onClick: function onClick() {
|
|
271
|
+
return onAdd(item.type, add);
|
|
272
|
+
}
|
|
273
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
274
|
+
className: "".concat(classPrefix, "-add-icon"),
|
|
275
|
+
type: "tianjia1"
|
|
276
|
+
}), item.addLabel));
|
|
277
|
+
});
|
|
278
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
279
|
+
type: "primary",
|
|
280
|
+
onClick: function onClick() {
|
|
281
|
+
return props.onChange(123);
|
|
282
|
+
}
|
|
283
|
+
}, "\u67E5\u8BE2")));
|
|
284
|
+
};
|
|
285
|
+
export default LeftPanel;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
@import '~@zgfe/business-lib/es/assets/styles/inner.less';
|
|
2
|
+
|
|
3
|
+
.mi-left-form {
|
|
4
|
+
.biz-target-dimension {
|
|
5
|
+
display: none;
|
|
6
|
+
}
|
|
7
|
+
.biz-event-select-list-panel {
|
|
8
|
+
position: fixed;
|
|
9
|
+
}
|
|
10
|
+
&-title.ant-form-item {
|
|
11
|
+
margin-bottom: 8px;
|
|
12
|
+
color: @text-color-secondary;
|
|
13
|
+
font-weight: 600;
|
|
14
|
+
.ant-form-item-control-input {
|
|
15
|
+
min-height: 20px;
|
|
16
|
+
.ant-form-item-control-input-content {
|
|
17
|
+
height: 20px;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&-item.ant-form-item {
|
|
23
|
+
margin-bottom: 8px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&-add {
|
|
27
|
+
width: fit-content;
|
|
28
|
+
height: 20px;
|
|
29
|
+
margin-top: 8px;
|
|
30
|
+
color: @text-color-secondary;
|
|
31
|
+
line-height: 20px;
|
|
32
|
+
border-radius: @border-radius-small;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
span {
|
|
35
|
+
margin-right: 4px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&:not(.disabled):hover {
|
|
39
|
+
.__default-hover();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&.disabled {
|
|
43
|
+
color: @disabled-color;
|
|
44
|
+
cursor: not-allowed;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.biz-condition-item-input {
|
|
49
|
+
border-color: transparent;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.ant-input-affix-wrapper > input.ant-input {
|
|
53
|
+
height: 100%;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TargetConditionTypes } from '@zgfe/business-lib';
|
|
2
|
+
export declare namespace LeftPanelTypes {
|
|
3
|
+
interface Props {
|
|
4
|
+
defaultValue?: any;
|
|
5
|
+
targets?: Array<TargetConditionTypes.Value>;
|
|
6
|
+
onChange: (values: any) => void;
|
|
7
|
+
}
|
|
8
|
+
interface FieldProp {
|
|
9
|
+
key: string;
|
|
10
|
+
type: string;
|
|
11
|
+
name: string;
|
|
12
|
+
label: string;
|
|
13
|
+
max: number;
|
|
14
|
+
addLabel: string;
|
|
15
|
+
options?: any[];
|
|
16
|
+
}
|
|
17
|
+
interface PanelProp {
|
|
18
|
+
type: string;
|
|
19
|
+
value?: any;
|
|
20
|
+
allValues?: any;
|
|
21
|
+
enableDelete: boolean;
|
|
22
|
+
eventIdList?: number[];
|
|
23
|
+
showOverview?: boolean;
|
|
24
|
+
onChange?: (data: any) => void;
|
|
25
|
+
onDelete?: () => void;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SearchData, SearchValue } from '../../types';
|
|
2
|
+
export declare function formValue(source: SearchValue, userGroupList: any): any;
|
|
3
|
+
export declare function formatSearchData(data: SearchData): SearchValue;
|
|
4
|
+
export declare function removeEmptyValue(source: SearchData): any;
|
|
5
|
+
export declare function targetChangeCallback(data: SearchData, eList: number[], eventGroupList: any): SearchData;
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { PropCategory } from '@zgfe/business-lib/es/attributeSelector/types';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
// 将传入的查询数据格式化为需要的form对象
|
|
4
|
+
export function formValue(source, userGroupList) {
|
|
5
|
+
var data = _.cloneDeep(source);
|
|
6
|
+
// 用户群变形
|
|
7
|
+
var result = [],
|
|
8
|
+
newDimensions = [];
|
|
9
|
+
if (data.userGroup) {
|
|
10
|
+
var userGroup = typeof data.userGroup === 'string' ? data.userGroup.split(',') : data.userGroup;
|
|
11
|
+
userGroup.map(function (group) {
|
|
12
|
+
var uid = typeof group === 'string' ? parseInt(group) : group;
|
|
13
|
+
userGroupList.forEach(function (user) {
|
|
14
|
+
if (user.id === uid) {
|
|
15
|
+
result.push(user);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
} else {
|
|
20
|
+
result = [userGroupList[0]];
|
|
21
|
+
}
|
|
22
|
+
data.userGroup = result;
|
|
23
|
+
// 格式化属性细分
|
|
24
|
+
if (data.globalDimensions) {
|
|
25
|
+
data.globalDimensions.forEach(function (item) {
|
|
26
|
+
if (item) {
|
|
27
|
+
if (item.propCategory === PropCategory.EventProp) {
|
|
28
|
+
if (item.attrId) {
|
|
29
|
+
newDimensions.push({
|
|
30
|
+
id: item.attrId,
|
|
31
|
+
propCategory: item.propCategory,
|
|
32
|
+
type: item.type,
|
|
33
|
+
key: item.attrId
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
} else if (item.propCategory === PropCategory.UserProp) {
|
|
37
|
+
if (item.attrName) {
|
|
38
|
+
newDimensions.push({
|
|
39
|
+
id: item.attrId || 0,
|
|
40
|
+
name: item.attrName,
|
|
41
|
+
propCategory: item.propCategory,
|
|
42
|
+
type: item.type,
|
|
43
|
+
category: item.category,
|
|
44
|
+
key: "".concat(item.propCategory, "-").concat(item.attrName),
|
|
45
|
+
subtype: item.subtype
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
} else if (item.propCategory === PropCategory.EnvProp) {
|
|
49
|
+
if (item.attrName) {
|
|
50
|
+
newDimensions.push({
|
|
51
|
+
id: item.attrId || 0,
|
|
52
|
+
name: item.attrName,
|
|
53
|
+
type: item.type,
|
|
54
|
+
category: item.category,
|
|
55
|
+
key: "".concat(item.propCategory, "-").concat(item.attrName),
|
|
56
|
+
propCategory: item.propCategory
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
data.globalDimensions = newDimensions;
|
|
64
|
+
return data;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 将form数据转为搜索值
|
|
69
|
+
* @param data form值
|
|
70
|
+
* @returns
|
|
71
|
+
*/
|
|
72
|
+
export function formatSearchData(data) {
|
|
73
|
+
var newData = {};
|
|
74
|
+
if (data.userGroup) {
|
|
75
|
+
var ids = [];
|
|
76
|
+
data.userGroup.forEach(function (group) {
|
|
77
|
+
if (group) {
|
|
78
|
+
ids.push(group.id);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
newData.userGroup = ids;
|
|
82
|
+
}
|
|
83
|
+
if (data.globalDimensions) {
|
|
84
|
+
var globalDimensions = [];
|
|
85
|
+
data.globalDimensions.forEach(function (item) {
|
|
86
|
+
if (!item) return;
|
|
87
|
+
var responseData = {
|
|
88
|
+
propCategory: item.propCategory,
|
|
89
|
+
type: item.type,
|
|
90
|
+
attrId: item.id || 0
|
|
91
|
+
};
|
|
92
|
+
if (item.propCategory === PropCategory.EventProp) {
|
|
93
|
+
responseData.attrName = item.label;
|
|
94
|
+
} else {
|
|
95
|
+
responseData.attrName = item.name;
|
|
96
|
+
responseData.category = item.category;
|
|
97
|
+
if (item.propCategory === PropCategory.UserProp && item.subtype) {
|
|
98
|
+
responseData.subtype = item.subtype;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
globalDimensions.push(responseData);
|
|
102
|
+
});
|
|
103
|
+
newData.globalDimensions = globalDimensions;
|
|
104
|
+
}
|
|
105
|
+
newData.targets = data.targets;
|
|
106
|
+
newData.globalFilters = data.globalFilters;
|
|
107
|
+
return newData;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* 去除数组中的undefined,以及筛选条件组件未选择完的条件
|
|
112
|
+
* @param source
|
|
113
|
+
* @returns
|
|
114
|
+
*/
|
|
115
|
+
export function removeEmptyValue(source) {
|
|
116
|
+
var data = _.cloneDeep(source);
|
|
117
|
+
var getValue = function getValue(formData) {
|
|
118
|
+
if (!formData) return formData;
|
|
119
|
+
var newData = [];
|
|
120
|
+
formData.forEach(function (item) {
|
|
121
|
+
if (item) {
|
|
122
|
+
if (item.filters) {
|
|
123
|
+
var conditions = getConditionList(item.filters.conditions);
|
|
124
|
+
if (conditions) {
|
|
125
|
+
item.filters.conditions = conditions;
|
|
126
|
+
} else {
|
|
127
|
+
item.filters = undefined;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
newData.push(item);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
if (newData.length) return newData.length ? newData : undefined;
|
|
134
|
+
};
|
|
135
|
+
data.targets = getValue(data.targets);
|
|
136
|
+
data.userGroup = getValue(data.userGroup);
|
|
137
|
+
data.globalDimensions = getValue(data.globalDimensions);
|
|
138
|
+
if (data.globalFilters) {
|
|
139
|
+
var conditions = getConditionList(data.globalFilters.conditions);
|
|
140
|
+
if (conditions) {
|
|
141
|
+
data.globalFilters.conditions = conditions;
|
|
142
|
+
} else {
|
|
143
|
+
data.globalFilters = undefined;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return data;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// 关系类型
|
|
150
|
+
var OperateTypes;
|
|
151
|
+
/**
|
|
152
|
+
* 筛选条件当未选择值时,不查询
|
|
153
|
+
* @param condition 筛选条件数组
|
|
154
|
+
* @returns
|
|
155
|
+
*/
|
|
156
|
+
(function (OperateTypes) {
|
|
157
|
+
OperateTypes["IsNull"] = "is null";
|
|
158
|
+
OperateTypes["IsNotNull"] = "is not null";
|
|
159
|
+
})(OperateTypes || (OperateTypes = {}));
|
|
160
|
+
function getConditionList(condition) {
|
|
161
|
+
if (!condition) return;
|
|
162
|
+
var conditionList = [];
|
|
163
|
+
condition.forEach(function (item) {
|
|
164
|
+
if (!item.attrId && !item.attrName) return;
|
|
165
|
+
if (!item.values || !item.values.length) {
|
|
166
|
+
if (item.operate === OperateTypes.IsNotNull || item.operate === OperateTypes.IsNull) {
|
|
167
|
+
conditionList.push(item);
|
|
168
|
+
}
|
|
169
|
+
} else {
|
|
170
|
+
conditionList.push(item);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
return conditionList.length ? conditionList : undefined;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* 指标发生改变,对全局属性和属性细分的数据影响
|
|
178
|
+
* @param data 表单数据
|
|
179
|
+
* @param eList 指标id列表
|
|
180
|
+
* @param eventGroupList 事件列表
|
|
181
|
+
* @returns
|
|
182
|
+
*/
|
|
183
|
+
export function targetChangeCallback(data, eList, eventGroupList) {
|
|
184
|
+
// 事件概览清空属性
|
|
185
|
+
if (eList[0] === -100) {
|
|
186
|
+
data.globalFilters = undefined;
|
|
187
|
+
data.globalDimensions = undefined;
|
|
188
|
+
} else {
|
|
189
|
+
if (data.globalFilters && data.globalFilters.conditions) {
|
|
190
|
+
var newFilters = [],
|
|
191
|
+
flag = true;
|
|
192
|
+
data.globalFilters.conditions.forEach(function (condition) {
|
|
193
|
+
if (condition) {
|
|
194
|
+
if (condition.propCategory === 'eventProp' && condition.attrId) {
|
|
195
|
+
// 事件属性
|
|
196
|
+
var hasExit = judgeAttrInEvents(eList, condition.attrId, eventGroupList);
|
|
197
|
+
if (hasExit) {
|
|
198
|
+
newFilters.push(condition);
|
|
199
|
+
} else {
|
|
200
|
+
flag = false;
|
|
201
|
+
}
|
|
202
|
+
} else {
|
|
203
|
+
newFilters.push(condition);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
// 有属性不在当前事件属性中,则清空
|
|
208
|
+
if (!flag) {
|
|
209
|
+
data.globalFilters = undefined;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (data.globalDimensions) {
|
|
213
|
+
var newDimensions = [],
|
|
214
|
+
_flag = true;
|
|
215
|
+
data.globalDimensions.forEach(function (condition) {
|
|
216
|
+
if (condition) {
|
|
217
|
+
if (condition.propCategory === 'eventProp') {
|
|
218
|
+
// 事件属性
|
|
219
|
+
var hasExit = condition.eventId ? eList.includes(condition.eventId) : judgeAttrInEvents(eList, condition.id, eventGroupList);
|
|
220
|
+
if (hasExit) {
|
|
221
|
+
newDimensions.push(condition);
|
|
222
|
+
} else {
|
|
223
|
+
_flag = false;
|
|
224
|
+
}
|
|
225
|
+
} else {
|
|
226
|
+
newDimensions.push(condition);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
// 有属性不在当前事件属性中
|
|
231
|
+
if (!_flag) {
|
|
232
|
+
data.globalDimensions = undefined;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return data;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* 判断属性是否在选择的事件中
|
|
241
|
+
* @param elds 指标id列表
|
|
242
|
+
* @param attrId 属性id
|
|
243
|
+
* @param eventGroupList 事件列表
|
|
244
|
+
* @returns
|
|
245
|
+
*/
|
|
246
|
+
var judgeAttrInEvents = function judgeAttrInEvents(elds, attrId, eventGroupList) {
|
|
247
|
+
var flag = false;
|
|
248
|
+
if (!eventGroupList) return false;
|
|
249
|
+
eventGroupList.forEach(function (group) {
|
|
250
|
+
group.eventList.forEach(function (event) {
|
|
251
|
+
if (elds.includes(event.id)) {
|
|
252
|
+
event.attrList.forEach(function (attr) {
|
|
253
|
+
if (attr.id === attrId) {
|
|
254
|
+
flag = true;
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
return flag;
|
|
262
|
+
};
|
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin: auto; background: rgb(255, 255, 255); display: block; shape-rendering: auto;" width="80px" height="80px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
|
|
3
|
+
<circle cx="50" cy="50" r="32" stroke-width="4" stroke="#165dff" stroke-dasharray="50.26548245743669 50.26548245743669" fill="none" stroke-linecap="round">
|
|
4
|
+
<animateTransform attributeName="transform" type="rotate" dur="1s" repeatCount="indefinite" keyTimes="0;1" values="0 50 50;360 50 50"></animateTransform>
|
|
5
|
+
</circle>
|
|
6
|
+
<circle cx="50" cy="50" r="27" stroke-width="4" stroke="#85adfc" stroke-dasharray="42.411500823462205 42.411500823462205" stroke-dashoffset="42.411500823462205" fill="none" stroke-linecap="round">
|
|
7
|
+
<animateTransform attributeName="transform" type="rotate" dur="1s" repeatCount="indefinite" keyTimes="0;1" values="0 50 50;-360 50 50"></animateTransform>
|
|
8
|
+
</circle>
|
|
9
|
+
<!-- [ldio] generated by https://loading.io/ --></svg>
|