@zgfe/business-lib 1.0.0-beta.3 → 1.0.0-beta.6
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/analysisLayout/index.d.ts +28 -0
- package/es/analysisLayout/index.js +6 -2
- package/es/analysisLayout/index.less +10 -3
- package/es/attributeSelector/index.d.ts +4 -2
- package/es/attributeSelector/index.js +30 -15
- package/es/chart/demo/bar.js +2 -2
- package/es/chart/demo/data/data2.d.ts +8 -0
- package/es/chart/demo/data/data2.js +7 -0
- package/es/chart/demo/data/data3.d.ts +10 -0
- package/es/chart/demo/data/data3.js +584 -0
- package/es/chart/demo/map.d.ts +2 -0
- package/es/chart/demo/map.js +11 -0
- package/es/chart/index.d.ts +29 -9
- package/es/chart/index.js +30 -71
- package/es/chart/type.d.ts +22 -0
- package/es/chart/type.js +1 -0
- package/es/chart/{chartConfig.d.ts → util/chartConfig.d.ts} +68 -3
- package/es/chart/{chartConfig.js → util/chartConfig.js} +85 -11
- package/es/chart/{color.d.ts → util/color.d.ts} +0 -0
- package/es/chart/{color.js → util/color.js} +0 -0
- package/es/chart/util/data/china.js +530 -0
- package/es/chart/util/data/cityGeoCoord.d.ts +22553 -0
- package/es/chart/util/data/cityGeoCoord.js +22552 -0
- package/es/chart/util/data/provinceGeoCoord.d.ts +343 -0
- package/es/chart/util/data/provinceGeoCoord.js +9258 -0
- package/es/chart/util/formatData.d.ts +13 -0
- package/es/chart/util/formatData.js +56 -0
- package/es/chart/util/{format.d.ts → formatOption.d.ts} +2 -1
- package/es/chart/util/{format.js → formatOption.js} +31 -1
- package/es/chart/util/mapUtil.d.ts +8 -0
- package/es/chart/util/mapUtil.js +195 -0
- package/es/commonStyle/icon.less +19 -3
- package/es/commonStyle/theme.less +5 -2
- package/es/dialog/components/selectToInput.d.ts +10 -3
- package/es/dialog/components/selectToInput.js +75 -12
- package/es/dialog/demo/index.js +27 -20
- package/es/dialog/index.d.ts +34 -2
- package/es/dialog/index.js +129 -55
- package/es/dialog/style/index.less +11 -1
- package/es/eventSelector/index.d.ts +5 -0
- package/es/eventSelector/index.js +111 -32
- package/es/globalAttributes/index.d.ts +3 -2
- package/es/globalAttributes/index.js +18 -23
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/multipleSelector/index.js +32 -4
- package/es/select/demo/index.js +2 -1
- package/es/select/index.d.ts +9 -1
- package/es/select/index.js +4 -2
- package/es/table/demo/index2.js +45 -3
- package/es/table/demo/index3.d.ts +2 -0
- package/es/table/demo/index3.js +227 -0
- package/es/table/index.d.ts +1 -1
- package/es/targetConditionGroup/components/conditionGroup.d.ts +4 -4
- package/es/targetConditionGroup/components/conditionGroup.js +27 -26
- package/es/targetConditionGroup/components/conditionItem.d.ts +4 -4
- package/es/targetConditionGroup/components/conditionItem.js +81 -108
- package/es/targetConditionGroup/data/operates.js +5 -5
- package/es/targetConditionGroup/demo/group.d.ts +2 -0
- package/es/targetConditionGroup/demo/group.js +42 -0
- package/es/targetConditionGroup/demo/index.js +15 -25
- package/es/targetConditionGroup/group.d.ts +56 -0
- package/es/targetConditionGroup/group.js +204 -0
- package/es/targetConditionGroup/index.d.ts +6 -0
- package/es/targetConditionGroup/index.js +148 -83
- package/es/targetConditionGroup/index.less +12 -0
- package/es/targetConditionGroup/type.d.ts +47 -2
- package/es/targetSelector/demo/form.js +1 -1
- package/es/targetSelector/demo/index.js +1 -1
- package/es/targetSelector/index.d.ts +17 -1
- package/es/targetSelector/index.js +56 -10
- package/package.json +1 -1
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
7
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
8
|
+
|
|
9
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
10
|
+
|
|
11
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
|
|
13
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
14
|
+
|
|
15
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
16
|
+
|
|
17
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
|
+
|
|
19
|
+
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."); }
|
|
20
|
+
|
|
21
|
+
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); }
|
|
22
|
+
|
|
23
|
+
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; }
|
|
24
|
+
|
|
25
|
+
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; }
|
|
26
|
+
|
|
27
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
28
|
+
|
|
29
|
+
import React, { useEffect, useState } from 'react';
|
|
30
|
+
import BizTargetCondition from '.';
|
|
31
|
+
import IconFont from '../components/iconFont';
|
|
32
|
+
|
|
33
|
+
var BizTargetConditionGroup = function BizTargetConditionGroup(props) {
|
|
34
|
+
var defaultValue = props.defaultValue,
|
|
35
|
+
value = props.value,
|
|
36
|
+
_props$max = props.max,
|
|
37
|
+
max = _props$max === void 0 ? 10 : _props$max,
|
|
38
|
+
options = props.options,
|
|
39
|
+
_props$fieldNames = props.fieldNames,
|
|
40
|
+
fieldNames = _props$fieldNames === void 0 ? {
|
|
41
|
+
label: 'event_name',
|
|
42
|
+
value: 'event_id',
|
|
43
|
+
groupLabel: 'groupName',
|
|
44
|
+
groupValue: 'groupId',
|
|
45
|
+
children: 'eventList'
|
|
46
|
+
} : _props$fieldNames,
|
|
47
|
+
onChange = props.onChange,
|
|
48
|
+
onDelete = props.onDelete; // 初始值:所有分组-事件概览
|
|
49
|
+
|
|
50
|
+
var initData = {
|
|
51
|
+
eventId: -2,
|
|
52
|
+
eventGroupId: -2,
|
|
53
|
+
analysisIndex: 'number'
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
var _useState = useState([]),
|
|
57
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
58
|
+
conditionGroup = _useState2[0],
|
|
59
|
+
setConditionGroup = _useState2[1];
|
|
60
|
+
|
|
61
|
+
var _useState3 = useState(false),
|
|
62
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
63
|
+
isChange = _useState4[0],
|
|
64
|
+
setIsChange = _useState4[1];
|
|
65
|
+
|
|
66
|
+
var _useState5 = useState(true),
|
|
67
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
68
|
+
showOverview = _useState6[0],
|
|
69
|
+
setShowOverview = _useState6[1];
|
|
70
|
+
|
|
71
|
+
var _useState7 = useState(false),
|
|
72
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
73
|
+
cantClick = _useState8[0],
|
|
74
|
+
setCantClick = _useState8[1];
|
|
75
|
+
|
|
76
|
+
var getInitData = function getInitData() {
|
|
77
|
+
return [{
|
|
78
|
+
key: Math.random().toString(),
|
|
79
|
+
data: initData
|
|
80
|
+
}];
|
|
81
|
+
}; // 添加指标
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
var addGroup = function addGroup() {
|
|
85
|
+
var newData = {
|
|
86
|
+
key: Math.random().toString()
|
|
87
|
+
};
|
|
88
|
+
setIsChange(false);
|
|
89
|
+
setConditionGroup(function (group) {
|
|
90
|
+
return [].concat(_toConsumableArray(group), [newData]);
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
useEffect(function () {
|
|
95
|
+
// 初始化值
|
|
96
|
+
var data = defaultValue || value || [];
|
|
97
|
+
|
|
98
|
+
if (!data.length) {
|
|
99
|
+
setConditionGroup(function () {
|
|
100
|
+
return getInitData();
|
|
101
|
+
});
|
|
102
|
+
setCantClick(true);
|
|
103
|
+
setIsChange(true);
|
|
104
|
+
} else {
|
|
105
|
+
var result = [];
|
|
106
|
+
|
|
107
|
+
if (data) {
|
|
108
|
+
result = data.map(function (item) {
|
|
109
|
+
return {
|
|
110
|
+
key: Math.random().toString(),
|
|
111
|
+
data: item
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
setConditionGroup(result);
|
|
117
|
+
|
|
118
|
+
if (data[0].eventId && data[0].eventId < 0) {
|
|
119
|
+
setShowOverview(true);
|
|
120
|
+
setCantClick(true);
|
|
121
|
+
} else {
|
|
122
|
+
setCantClick(false);
|
|
123
|
+
setShowOverview(false);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}, [defaultValue, value]);
|
|
127
|
+
useEffect(function () {
|
|
128
|
+
if (!isChange) return;
|
|
129
|
+
var result = [];
|
|
130
|
+
|
|
131
|
+
var _iterator = _createForOfIteratorHelper(conditionGroup),
|
|
132
|
+
_step;
|
|
133
|
+
|
|
134
|
+
try {
|
|
135
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
136
|
+
var group = _step.value;
|
|
137
|
+
|
|
138
|
+
if (group.data) {
|
|
139
|
+
result.push(group.data);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
} catch (err) {
|
|
143
|
+
_iterator.e(err);
|
|
144
|
+
} finally {
|
|
145
|
+
_iterator.f();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
onChange && onChange(result); // 当选择非事件概览时,事件概览隐藏
|
|
149
|
+
// 选择事件概览时,不能再添加指标
|
|
150
|
+
|
|
151
|
+
if (result[0].eventId && result[0].eventId < 0) {
|
|
152
|
+
setShowOverview(true);
|
|
153
|
+
setCantClick(true);
|
|
154
|
+
} else {
|
|
155
|
+
setCantClick(false);
|
|
156
|
+
setShowOverview(false);
|
|
157
|
+
}
|
|
158
|
+
}, [conditionGroup]);
|
|
159
|
+
return /*#__PURE__*/React.createElement("div", null, conditionGroup.map(function (item, index) {
|
|
160
|
+
return /*#__PURE__*/React.createElement(BizTargetCondition, {
|
|
161
|
+
className: "biz-group-item",
|
|
162
|
+
key: item.key,
|
|
163
|
+
value: item.data,
|
|
164
|
+
options: options,
|
|
165
|
+
fieldNames: fieldNames,
|
|
166
|
+
showOverview: showOverview,
|
|
167
|
+
onChange: function onChange(data) {
|
|
168
|
+
setConditionGroup(function (group) {
|
|
169
|
+
group[index].data = _objectSpread({}, data);
|
|
170
|
+
return _toConsumableArray(group);
|
|
171
|
+
});
|
|
172
|
+
setIsChange(true); // onChange && onChange(data)
|
|
173
|
+
},
|
|
174
|
+
onDelete: function onDelete() {
|
|
175
|
+
if (conditionGroup.length <= 1) {
|
|
176
|
+
setConditionGroup(function () {
|
|
177
|
+
return getInitData();
|
|
178
|
+
});
|
|
179
|
+
} else {
|
|
180
|
+
setConditionGroup(function (group) {
|
|
181
|
+
group.splice(index, 1);
|
|
182
|
+
return _toConsumableArray(group);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
setIsChange(true);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}), conditionGroup.length < max && /*#__PURE__*/React.createElement("div", {
|
|
190
|
+
className: "biz-icon-add ".concat(cantClick ? 'biz-disabled' : ''),
|
|
191
|
+
onClick: function onClick() {
|
|
192
|
+
if (!cantClick) {
|
|
193
|
+
addGroup();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
197
|
+
className: "biz-icon",
|
|
198
|
+
type: 'icon-tianjia1'
|
|
199
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
200
|
+
className: "biz-icon-text"
|
|
201
|
+
}, "\u6DFB\u52A0\u6307\u6807")));
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export default BizTargetConditionGroup;
|
|
@@ -24,6 +24,12 @@ interface TargetConditionProps {
|
|
|
24
24
|
* @default 3
|
|
25
25
|
*/
|
|
26
26
|
max?: number;
|
|
27
|
+
/**
|
|
28
|
+
* @description 是否展示事件概览
|
|
29
|
+
* @default true
|
|
30
|
+
*/
|
|
31
|
+
showOverview?: boolean;
|
|
32
|
+
className?: string;
|
|
27
33
|
/**
|
|
28
34
|
* @description 自定义指标下拉框 label、value 的字段
|
|
29
35
|
* @description.zh-CN
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
-
|
|
5
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
1
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
6
2
|
|
|
7
3
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
4
|
|
|
@@ -12,8 +8,6 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
12
8
|
|
|
13
9
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
14
10
|
|
|
15
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
16
|
-
|
|
17
11
|
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; }
|
|
18
12
|
|
|
19
13
|
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; }
|
|
@@ -48,58 +42,106 @@ var BizTargetCondition = function BizTargetCondition(props) {
|
|
|
48
42
|
options = props.options,
|
|
49
43
|
_props$max = props.max,
|
|
50
44
|
max = _props$max === void 0 ? 3 : _props$max,
|
|
45
|
+
className = props.className,
|
|
46
|
+
_props$showOverview = props.showOverview,
|
|
47
|
+
showOverview = _props$showOverview === void 0 ? true : _props$showOverview,
|
|
51
48
|
_props$fieldNames = props.fieldNames,
|
|
52
49
|
fieldNames = _props$fieldNames === void 0 ? {
|
|
53
|
-
label: '
|
|
54
|
-
value: '
|
|
55
|
-
groupLabel: '
|
|
56
|
-
groupValue: '
|
|
57
|
-
children: '
|
|
50
|
+
label: 'event_name',
|
|
51
|
+
value: 'event_id',
|
|
52
|
+
groupLabel: 'groupName',
|
|
53
|
+
groupValue: 'groupId',
|
|
54
|
+
children: 'eventList'
|
|
58
55
|
} : _props$fieldNames,
|
|
59
56
|
onChange = props.onChange,
|
|
60
57
|
onDelete = props.onDelete;
|
|
61
58
|
|
|
62
59
|
var _useState = useState({}),
|
|
63
60
|
_useState2 = _slicedToArray(_useState, 2),
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
currentTarget = _useState2[0],
|
|
62
|
+
setCurrentTarget = _useState2[1];
|
|
66
63
|
|
|
67
|
-
var _useState3 = useState(
|
|
64
|
+
var _useState3 = useState(),
|
|
68
65
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
eventGroupId = _useState4[0],
|
|
67
|
+
setEventGroupId = _useState4[1];
|
|
71
68
|
|
|
72
|
-
var _useState5 = useState(
|
|
69
|
+
var _useState5 = useState({}),
|
|
73
70
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
targetData = _useState6[0],
|
|
72
|
+
setTargetData = _useState6[1];
|
|
73
|
+
|
|
74
|
+
var _useState7 = useState({}),
|
|
75
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
76
|
+
attrsData = _useState8[0],
|
|
77
|
+
setAttrsData = _useState8[1];
|
|
78
|
+
|
|
79
|
+
var _useState9 = useState(dimensionOperate[0]),
|
|
80
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
81
|
+
dimension = _useState10[0],
|
|
82
|
+
setDimension = _useState10[1]; // 禁止筛选
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
var _useState11 = useState(false),
|
|
86
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
87
|
+
addDisable = _useState12[0],
|
|
88
|
+
setAddDisable = _useState12[1];
|
|
89
|
+
|
|
90
|
+
var _useState13 = useState(false),
|
|
91
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
92
|
+
noDelete = _useState14[0],
|
|
93
|
+
setNoDelete = _useState14[1];
|
|
94
|
+
|
|
95
|
+
var _useState15 = useState(showOverview),
|
|
96
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
97
|
+
showAll = _useState16[0],
|
|
98
|
+
setShowAll = _useState16[1];
|
|
76
99
|
|
|
77
100
|
useEffect(function () {
|
|
78
101
|
var attrData = Object.keys(defaultValue).length > 0 ? defaultValue : value;
|
|
79
|
-
var attrs = attrData.attrs,
|
|
80
|
-
operator = attrData.operator,
|
|
81
|
-
eventId = attrData.eventId,
|
|
82
|
-
aliasName = attrData.aliasName,
|
|
83
|
-
dimension = attrData.dimension;
|
|
84
|
-
var arr = [];
|
|
85
|
-
|
|
86
|
-
if (attrs) {
|
|
87
|
-
arr = attrs.map(function (item) {
|
|
88
|
-
var data = _objectSpread({}, item);
|
|
89
102
|
|
|
103
|
+
if (JSON.stringify(currentTarget) !== JSON.stringify(attrData)) {
|
|
104
|
+
setCurrentTarget(function () {
|
|
105
|
+
return _objectSpread({}, attrData);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}, [defaultValue, value]);
|
|
109
|
+
useEffect(function () {
|
|
110
|
+
setShowAll(function () {
|
|
111
|
+
return showOverview;
|
|
112
|
+
});
|
|
113
|
+
}, [showOverview]);
|
|
114
|
+
useEffect(function () {
|
|
115
|
+
var alias = currentTarget.alias,
|
|
116
|
+
eventId = currentTarget.eventId,
|
|
117
|
+
eventGroupId = currentTarget.eventGroupId,
|
|
118
|
+
analysisIndex = currentTarget.analysisIndex,
|
|
119
|
+
filters = currentTarget.filters;
|
|
120
|
+
var arr = []; // 属性组添加key
|
|
121
|
+
|
|
122
|
+
if (filters && filters.conditions) {
|
|
123
|
+
arr = filters.conditions.map(function (item) {
|
|
90
124
|
var attrId = Math.random().toString();
|
|
91
|
-
return {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
};
|
|
125
|
+
return _objectSpread({
|
|
126
|
+
key: attrId
|
|
127
|
+
}, item);
|
|
95
128
|
});
|
|
96
|
-
} else {
|
|
97
|
-
arr = [{
|
|
98
|
-
attrId: Math.random().toString()
|
|
99
|
-
}];
|
|
100
129
|
}
|
|
101
130
|
|
|
102
|
-
|
|
131
|
+
var relation = filters && filters.relation || '';
|
|
132
|
+
var filterData = {
|
|
133
|
+
relation: relation,
|
|
134
|
+
conditions: _toConsumableArray(arr)
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
if (JSON.stringify(filterData) !== JSON.stringify(attrsData)) {
|
|
138
|
+
setAttrsData(function () {
|
|
139
|
+
return _objectSpread({}, filterData);
|
|
140
|
+
});
|
|
141
|
+
} // 维度赋值
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
if (analysisIndex && analysisIndex !== dimension.value) {
|
|
103
145
|
var getDefault = function getDefault(data) {
|
|
104
146
|
var _iterator = _createForOfIteratorHelper(data),
|
|
105
147
|
_step;
|
|
@@ -108,7 +150,7 @@ var BizTargetCondition = function BizTargetCondition(props) {
|
|
|
108
150
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
109
151
|
var _value = _step.value;
|
|
110
152
|
|
|
111
|
-
if (_value.value ===
|
|
153
|
+
if (_value.value === analysisIndex) {
|
|
112
154
|
return _value;
|
|
113
155
|
}
|
|
114
156
|
}
|
|
@@ -118,49 +160,62 @@ var BizTargetCondition = function BizTargetCondition(props) {
|
|
|
118
160
|
_iterator.f();
|
|
119
161
|
}
|
|
120
162
|
|
|
121
|
-
return
|
|
122
|
-
name: ''
|
|
123
|
-
};
|
|
163
|
+
return data[0];
|
|
124
164
|
};
|
|
125
165
|
|
|
126
|
-
var
|
|
127
|
-
|
|
166
|
+
var data = getDefault(dimensionOperate);
|
|
128
167
|
setDimension(function () {
|
|
129
|
-
return _objectSpread({},
|
|
168
|
+
return _objectSpread({}, data);
|
|
130
169
|
});
|
|
170
|
+
} // 事件下拉赋值
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
var target = {};
|
|
174
|
+
|
|
175
|
+
if (alias) {
|
|
176
|
+
target.alias = alias;
|
|
131
177
|
}
|
|
132
178
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
|
|
179
|
+
if (eventId) {
|
|
180
|
+
// 事件概览时id为-1,此时有事件的分组
|
|
181
|
+
target.option = eventId < 0 ? "".concat(eventId, ",").concat(eventGroupId || -2) : eventId;
|
|
182
|
+
target.eventId = eventId;
|
|
183
|
+
target.eventGroupId = eventGroupId;
|
|
184
|
+
setAddDisable(function () {
|
|
185
|
+
return eventId < 0;
|
|
186
|
+
});
|
|
187
|
+
var flag = !!(eventGroupId && eventGroupId < 0);
|
|
188
|
+
setNoDelete(function () {
|
|
189
|
+
return eventId < 0 && flag;
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (JSON.stringify(targetData) !== JSON.stringify(target)) {
|
|
194
|
+
setTargetData(function () {
|
|
195
|
+
return target;
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}, [currentTarget]);
|
|
147
199
|
|
|
148
200
|
var _onChange = function _onChange(target, attr) {
|
|
149
201
|
var dimensionData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : dimension;
|
|
150
|
-
var attrArray = attr.
|
|
151
|
-
|
|
202
|
+
var attrArray = attr.conditions ? attr.conditions.map(function (item) {
|
|
203
|
+
delete item.key;
|
|
204
|
+
return item;
|
|
152
205
|
}) : [];
|
|
153
|
-
var
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
206
|
+
var option = target.option;
|
|
207
|
+
var eArr = String(option).split(',');
|
|
208
|
+
onChange && onChange({
|
|
209
|
+
type: 'event',
|
|
210
|
+
eventId: eArr[0],
|
|
211
|
+
eventGroupId: eArr[1] || '',
|
|
212
|
+
alias: target.alias,
|
|
213
|
+
analysisIndex: dimensionData.value || '',
|
|
214
|
+
filters: {
|
|
215
|
+
relation: attr.relation,
|
|
216
|
+
conditions: _toConsumableArray(attrArray)
|
|
217
|
+
}
|
|
218
|
+
});
|
|
164
219
|
};
|
|
165
220
|
|
|
166
221
|
var _onDimensionClick = function _onDimensionClick(data) {
|
|
@@ -171,17 +226,27 @@ var BizTargetCondition = function BizTargetCondition(props) {
|
|
|
171
226
|
_onChange(targetData, attrsData, data);
|
|
172
227
|
};
|
|
173
228
|
|
|
174
|
-
return /*#__PURE__*/React.createElement("div",
|
|
229
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
230
|
+
className: className
|
|
231
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
175
232
|
className: "biz-target-condition-container"
|
|
176
233
|
}, /*#__PURE__*/React.createElement(BizTargetSelector, {
|
|
177
234
|
defaultValue: targetData,
|
|
235
|
+
addDisable: addDisable,
|
|
236
|
+
delDisable: noDelete,
|
|
237
|
+
showOverview: showAll,
|
|
178
238
|
onChange: function onChange(data) {
|
|
179
239
|
setTargetData(function () {
|
|
180
240
|
return _objectSpread({}, data);
|
|
181
241
|
});
|
|
182
242
|
|
|
183
243
|
if (data.option != targetData.option) {
|
|
184
|
-
//
|
|
244
|
+
// 选择了事件概览,不能筛选
|
|
245
|
+
var eid = String(data.option).split(',')[0];
|
|
246
|
+
setAddDisable(function () {
|
|
247
|
+
return parseFloat(eid) < 0;
|
|
248
|
+
}); // 切换了事件,属性清空
|
|
249
|
+
|
|
185
250
|
setAttrsData(function () {
|
|
186
251
|
return {};
|
|
187
252
|
});
|
|
@@ -193,18 +258,18 @@ var BizTargetCondition = function BizTargetCondition(props) {
|
|
|
193
258
|
}
|
|
194
259
|
},
|
|
195
260
|
onAdd: function onAdd() {
|
|
196
|
-
if (attrsData.
|
|
261
|
+
if (attrsData.conditions && attrsData.conditions.length >= max) {
|
|
197
262
|
return;
|
|
198
263
|
} else {
|
|
199
264
|
setAttrsData(function (data) {
|
|
200
|
-
var
|
|
201
|
-
|
|
202
|
-
}
|
|
265
|
+
var item = {
|
|
266
|
+
key: Math.random().toString()
|
|
267
|
+
};
|
|
203
268
|
|
|
204
|
-
if (!data.
|
|
205
|
-
data.
|
|
269
|
+
if (!data.conditions) {
|
|
270
|
+
data.conditions = [item];
|
|
206
271
|
} else {
|
|
207
|
-
data.
|
|
272
|
+
data.conditions.push(item);
|
|
208
273
|
}
|
|
209
274
|
|
|
210
275
|
return _objectSpread({}, data);
|
|
@@ -252,7 +317,7 @@ var BizTargetCondition = function BizTargetCondition(props) {
|
|
|
252
317
|
}))))), /*#__PURE__*/React.createElement(BizConditionGroup, {
|
|
253
318
|
defaultValue: attrsData,
|
|
254
319
|
options: options === null || options === void 0 ? void 0 : options.attrOption,
|
|
255
|
-
|
|
320
|
+
eventId: targetData.option,
|
|
256
321
|
onChange: function onChange(data) {
|
|
257
322
|
setAttrsData(function () {
|
|
258
323
|
return _objectSpread({}, data);
|
|
@@ -28,16 +28,61 @@ export interface OptionType {
|
|
|
28
28
|
eventOption?: Array<Option>;
|
|
29
29
|
attrOption?: Array<object>;
|
|
30
30
|
}
|
|
31
|
+
export interface AttrItem {
|
|
32
|
+
key?: string;
|
|
33
|
+
operation?: string;
|
|
34
|
+
/**
|
|
35
|
+
* 属性类型:事件属性、用户属性、环境属性
|
|
36
|
+
*/
|
|
37
|
+
type?: string;
|
|
38
|
+
/**
|
|
39
|
+
* 属性名称
|
|
40
|
+
*/
|
|
41
|
+
attrName?: string;
|
|
42
|
+
/**
|
|
43
|
+
* 属性id
|
|
44
|
+
*/
|
|
45
|
+
attrId?: string | number;
|
|
46
|
+
values?: Array<number | string>;
|
|
47
|
+
/**
|
|
48
|
+
* 1 string 2 number 3 date
|
|
49
|
+
*/
|
|
50
|
+
attrType?: number;
|
|
51
|
+
dimension_sub?: string;
|
|
52
|
+
dimensionId?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface AttrGroup {
|
|
55
|
+
relation?: string;
|
|
56
|
+
conditions?: Array<AttrItem>;
|
|
57
|
+
}
|
|
31
58
|
export interface TargetCondition {
|
|
32
|
-
|
|
59
|
+
type?: string;
|
|
60
|
+
alias?: string;
|
|
61
|
+
filters?: AttrGroup;
|
|
62
|
+
analysisIndex?: string | number;
|
|
33
63
|
eventId?: string | number;
|
|
64
|
+
eventGroupId?: string | number;
|
|
65
|
+
key?: string;
|
|
66
|
+
aliasName?: string;
|
|
34
67
|
operator?: string;
|
|
35
68
|
attrs?: Array<AttrType>;
|
|
36
69
|
dimension?: string | number;
|
|
37
70
|
}
|
|
71
|
+
export interface TargetConditionGroup {
|
|
72
|
+
/**
|
|
73
|
+
* 指标组
|
|
74
|
+
*/
|
|
75
|
+
target?: Array<TargetCondition>;
|
|
76
|
+
/**
|
|
77
|
+
* -1 整体事件概览、其他:指定事件分组概览
|
|
78
|
+
*/
|
|
79
|
+
eventGroupId?: number;
|
|
80
|
+
}
|
|
38
81
|
export interface TargetType {
|
|
39
|
-
|
|
82
|
+
alias?: string;
|
|
40
83
|
option?: string | number;
|
|
84
|
+
eventId?: string | number;
|
|
85
|
+
eventGroupId?: string | number;
|
|
41
86
|
}
|
|
42
87
|
export interface CurrentType {
|
|
43
88
|
operator?: string;
|
|
@@ -84,7 +84,7 @@ var EventDemo = function EventDemo() {
|
|
|
84
84
|
|
|
85
85
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(BizTargetSelector, {
|
|
86
86
|
defaultValue: {
|
|
87
|
-
|
|
87
|
+
alias: '别名',
|
|
88
88
|
option: 'xiasha2'
|
|
89
89
|
},
|
|
90
90
|
onChange: handleChange,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import './index.less';
|
|
3
3
|
interface ValueType {
|
|
4
|
-
|
|
4
|
+
alias?: string;
|
|
5
5
|
option?: object | string | number;
|
|
6
|
+
showAll?: boolean;
|
|
6
7
|
}
|
|
7
8
|
interface EventBoxProps {
|
|
8
9
|
/**
|
|
@@ -20,6 +21,21 @@ interface EventBoxProps {
|
|
|
20
21
|
* @default -
|
|
21
22
|
*/
|
|
22
23
|
children?: ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* @describe 是否禁止筛选
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
addDisable?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* @describe 是否禁止删除
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
delDisable?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* @description 是否展示事件概览
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
showOverview?: boolean;
|
|
23
39
|
/**
|
|
24
40
|
* @description 添加筛选的回调
|
|
25
41
|
* @default -
|