@zgfe/business-lib 1.1.29-visual.9 → 1.1.29
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/addToPanel/components/addPanel.js +21 -8
- package/es/addToPanel/components/radioGroup.js +3 -1
- package/es/addToPanel/components/styleList.js +22 -5
- package/es/addToPanel/demo/edit.js +12 -5
- package/es/addToPanel/demo/index.js +12 -5
- package/es/addToPanel/index.js +58 -21
- package/es/addToScene/addGroup.js +4 -0
- package/es/addToScene/demo/index.js +12 -5
- package/es/addToScene/index.js +40 -13
- package/es/assets/demo/index.js +2 -0
- package/es/assets/demo/input.js +12 -5
- package/es/assets/iconfont/iconfont.js +17 -10
- package/es/assets/theme.js +1 -0
- package/es/attrConditions/components/operateList.js +27 -10
- package/es/attrConditions/components/stringList.js +97 -68
- package/es/attrConditions/components/valuesList.js +40 -14
- package/es/attrConditions/demo/group.js +23 -11
- package/es/attrConditions/demo/index.js +26 -17
- package/es/attrConditions/group.js +48 -17
- package/es/attrConditions/index.js +49 -22
- package/es/attrConditions/types.js +1 -0
- package/es/attributeSelector/demo/disable.js +16 -8
- package/es/attributeSelector/demo/index.js +17 -8
- package/es/attributeSelector/index.js +45 -22
- package/es/attributeSelector/listPanel.js +46 -18
- package/es/attributeSelector/option.js +13 -3
- package/es/attributeSelector/types.js +5 -0
- package/es/attributeSelector/util.js +3 -0
- package/es/chart/demo/index.js +14 -5
- package/es/chart/index.js +44 -30
- package/es/chart/util/chartOptionConfig.d.ts +3 -3
- package/es/chart/util/chartOptionConfig.js +37 -13
- package/es/chart/util/data/china.js +4 -1
- package/es/chart/util/formatData.d.ts +2 -2
- package/es/chart/util/formatData.js +5 -0
- package/es/chart/util/formatOption.js +13 -0
- package/es/chart/util/mapUtil.js +26 -5
- package/es/config.js +2 -0
- package/es/constants/apis.d.ts +0 -1
- package/es/constants/apis.js +1 -2
- package/es/cycleTime/demo/disable.js +1 -0
- package/es/cycleTime/index.js +46 -19
- package/es/cycleTime/month.js +27 -8
- package/es/datePicker/datePicker.js +23 -5
- package/es/datePicker/demo/customType.js +22 -13
- package/es/datePicker/demo/day.js +22 -13
- package/es/datePicker/demo/index.js +21 -12
- package/es/datePicker/index.js +41 -18
- package/es/datePicker/utils.js +7 -0
- package/es/demoWrapper/content.d.ts +1 -2
- package/es/demoWrapper/content.js +64 -42
- package/es/demoWrapper/demo/index.js +4 -5
- package/es/demoWrapper/head.d.ts +1 -3
- package/es/demoWrapper/head.js +27 -25
- package/es/demoWrapper/index.js +36 -28
- package/es/dialog/demo/index.js +12 -5
- package/es/dialog/index.js +6 -4
- package/es/dnd/demo/data.js +28 -19
- package/es/dnd/demo/handle.js +28 -19
- package/es/dnd/index.js +45 -21
- package/es/dnd/item.js +30 -10
- package/es/eventSelector/demo/index.js +23 -12
- package/es/eventSelector/index.js +42 -14
- package/es/eventSelector/listPanel.js +73 -31
- package/es/eventSelector/option.js +11 -6
- package/es/icon/iconFont.js +13 -7
- package/es/index.d.ts +1 -2
- package/es/index.js +1 -2
- package/es/layout/analysisLayout/demo/index.js +6 -0
- package/es/layout/analysisLayout/index.d.ts +1 -1
- package/es/layout/analysisLayout/index.js +34 -16
- package/es/layout/detail/index.js +3 -1
- package/es/loginForm/index.js +18 -7
- package/es/searchInput/index.js +7 -2
- package/es/select/demo/children.js +16 -8
- package/es/select/demo/customLabel.js +2 -0
- package/es/select/demo/group.js +17 -8
- package/es/select/demo/index.js +19 -11
- package/es/select/demo/loading.js +18 -8
- package/es/select/demo/multiple.js +16 -8
- package/es/select/handle.js +34 -14
- package/es/select/index.js +59 -22
- package/es/select/option.js +30 -10
- package/es/select/overlay.js +62 -25
- package/es/table/demo/data/table.js +2 -0
- package/es/table/demo/index.js +39 -13
- package/es/table/demo/index2.js +15 -5
- package/es/table/demo/index3.js +28 -7
- package/es/table/index.js +33 -14
- package/es/targetConditionGroup/components/targetDimension.js +38 -12
- package/es/targetConditionGroup/demo/group.js +36 -21
- package/es/targetConditionGroup/demo/index.js +13 -5
- package/es/targetConditionGroup/index.js +84 -31
- package/es/targetSelector/demo/index.js +28 -15
- package/es/targetSelector/editBox.js +20 -5
- package/es/targetSelector/index.js +36 -15
- package/es/targetSelector/optionIcon.js +5 -1
- package/es/targetSelector/optionMenu.js +3 -0
- package/es/userCondition/conditionTypeList.js +12 -7
- package/es/userCondition/conditionWrap.js +2 -0
- package/es/userCondition/conditions/cdpCondition.js +97 -51
- package/es/userCondition/conditions/eventCondition.js +16 -6
- package/es/userCondition/conditions/periodCondition.js +26 -8
- package/es/userCondition/conditions/propCondition.js +61 -29
- package/es/userCondition/conditions/runTimesCondition.js +10 -5
- package/es/userCondition/conditions/tagsCondition.d.ts +1 -1
- package/es/userCondition/conditions/tagsCondition.js +33 -15
- package/es/userCondition/conditions/textDesc.js +67 -16
- package/es/userCondition/demo/index.js +21 -11
- package/es/userCondition/index.js +91 -51
- package/es/userCondition/orConditions.js +48 -11
- package/es/userCondition/relationLabel.js +4 -1
- package/es/userCondition/types.d.ts +1 -1
- package/es/userCondition/types.js +1 -0
- package/es/userCondition/util.js +13 -4
- package/es/userGroup/demo/group.js +23 -14
- package/es/userGroup/demo/index.js +15 -5
- package/es/userGroup/index.js +30 -12
- package/es/userTagsSelector/cascaderOverlay.js +51 -19
- package/es/userTagsSelector/components/search/index.js +2 -0
- package/es/userTagsSelector/demo/index.js +3 -0
- package/es/userTagsSelector/groups/groupOption.js +8 -6
- package/es/userTagsSelector/groups/index.js +30 -15
- package/es/userTagsSelector/index.js +35 -17
- package/es/userTagsSelector/multipleCheckPanel/checkOption.js +6 -3
- package/es/userTagsSelector/multipleCheckPanel/index.js +21 -8
- package/es/userTagsSelector/util.js +2 -0
- package/es/utils/ajax.js +71 -45
- package/es/utils/base64.js +22 -3
- package/es/utils/type.d.ts +1 -1
- package/es/utils/type.js +7 -4
- package/es/utils/util.js +16 -0
- package/package.json +2 -2
- package/es/socket/demo/demo.d.ts +0 -2
- package/es/socket/demo/demo.js +0 -139
- package/es/socket/demo/index.less +0 -27
- package/es/socket/index.d.ts +0 -31
- package/es/socket/index.js +0 -278
- package/es/socket/types.d.ts +0 -37
- package/es/socket/types.js +0 -26
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
2
3
|
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."); }
|
|
4
|
+
|
|
3
5
|
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); }
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
+
|
|
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
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
6
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
7
13
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
8
14
|
import eventData from '../../mock/event';
|
|
9
15
|
import envData from '../../mock/env';
|
|
@@ -14,16 +20,18 @@ import '@zgfe/business-lib/es/assets/iconfont/iconfont.css';
|
|
|
14
20
|
var getTagList = Promise.resolve(tagList);
|
|
15
21
|
export default (function () {
|
|
16
22
|
var _useState = useState({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
eventGroupList: [],
|
|
24
|
+
userPropList: [],
|
|
25
|
+
eventEnvList: []
|
|
26
|
+
}),
|
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
+
setStore = _useState2[1];
|
|
29
|
+
|
|
23
30
|
var _useState3 = useState([]),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
32
|
+
userTagsData = _useState4[0],
|
|
33
|
+
setUserTagsData = _useState4[1];
|
|
34
|
+
|
|
27
35
|
var newStore = convertAttributeData({
|
|
28
36
|
eventList: eventData,
|
|
29
37
|
userPropList: userData,
|
|
@@ -40,9 +48,11 @@ export default (function () {
|
|
|
40
48
|
var defaultValue = useMemo(function () {
|
|
41
49
|
return conditions;
|
|
42
50
|
}, [conditions]);
|
|
51
|
+
|
|
43
52
|
function onChange(value) {
|
|
44
53
|
console.log('change:', JSON.parse(JSON.stringify(value)));
|
|
45
54
|
}
|
|
55
|
+
|
|
46
56
|
var descDom = /*#__PURE__*/React.createElement(BizUserCondition, {
|
|
47
57
|
defaultValue: defaultValue,
|
|
48
58
|
onChange: onChange,
|
|
@@ -1,14 +1,25 @@
|
|
|
1
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; } } }; }
|
|
2
|
+
|
|
2
3
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
|
+
|
|
3
5
|
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."); }
|
|
6
|
+
|
|
4
7
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
+
|
|
5
9
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
|
|
6
11
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
|
|
7
13
|
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."); }
|
|
14
|
+
|
|
8
15
|
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); }
|
|
9
|
-
|
|
10
|
-
function
|
|
16
|
+
|
|
17
|
+
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; }
|
|
18
|
+
|
|
19
|
+
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; }
|
|
20
|
+
|
|
11
21
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
22
|
+
|
|
12
23
|
import React, { createContext, useContext, useEffect, useMemo, useState } from 'react';
|
|
13
24
|
import ConditionTypeList from './conditionTypeList';
|
|
14
25
|
import RelationLabel from './relationLabel';
|
|
@@ -32,63 +43,76 @@ export var BizUserConditionContext = /*#__PURE__*/createContext({
|
|
|
32
43
|
datasetList: []
|
|
33
44
|
});
|
|
34
45
|
export var classPrefix = 'biz-user-condition';
|
|
46
|
+
|
|
35
47
|
var BizUserCondition = function BizUserCondition(props) {
|
|
36
48
|
var _useContext = useContext(BizGlobalDataContext),
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
49
|
+
eventEnvList = _useContext.eventEnvList,
|
|
50
|
+
userPropList = _useContext.userPropList,
|
|
51
|
+
menuNameMap = _useContext.menuNameMap,
|
|
52
|
+
currentApp = _useContext.currentApp;
|
|
53
|
+
|
|
41
54
|
var andConditionNum = props.andConditionNum,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
55
|
+
defaultValue = props.defaultValue,
|
|
56
|
+
openTagCondition = props.openTagCondition,
|
|
57
|
+
openCdpCondition = props.openCdpCondition,
|
|
58
|
+
userTagsData = props.userTagsData,
|
|
59
|
+
cdpTip = props.cdpTip;
|
|
60
|
+
|
|
47
61
|
var _useState = useState([]),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
62
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
63
|
+
showList = _useState2[0],
|
|
64
|
+
setShowList = _useState2[1];
|
|
65
|
+
|
|
51
66
|
var _useState3 = useState([]),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
67
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
68
|
+
dataList = _useState4[0],
|
|
69
|
+
setDataList = _useState4[1];
|
|
70
|
+
|
|
55
71
|
var _useState5 = useState(function () {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
props.onChange(list);
|
|
72
|
+
var list = [];
|
|
73
|
+
|
|
74
|
+
if (defaultValue) {
|
|
75
|
+
var showTag = openTagCondition && (!menuNameMap || menuNameMap['userTags']);
|
|
76
|
+
var showCdp = openCdpCondition && (!menuNameMap || menuNameMap['dataset']);
|
|
77
|
+
var flag = false;
|
|
78
|
+
defaultValue.forEach(function (item) {
|
|
79
|
+
var showItem = _toConsumableArray(item);
|
|
80
|
+
|
|
81
|
+
if (!(showTag && showCdp)) {
|
|
82
|
+
item.forEach(function (data, index) {
|
|
83
|
+
if (data.dataset && !showCdp || data.labels && !showTag) {
|
|
84
|
+
showItem.splice(index, 1);
|
|
85
|
+
flag = true;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (showItem.length > 0) {
|
|
91
|
+
list.push(showItem);
|
|
77
92
|
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
if (flag) {
|
|
96
|
+
props.onChange(list);
|
|
78
97
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return list;
|
|
101
|
+
}),
|
|
102
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
103
|
+
value = _useState6[0],
|
|
104
|
+
setValue = _useState6[1];
|
|
105
|
+
|
|
84
106
|
var _useState7 = useState(true),
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
107
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
108
|
+
loading = _useState8[0],
|
|
109
|
+
setLoading = _useState8[1];
|
|
110
|
+
|
|
88
111
|
var _useState9 = useState([]),
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
112
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
113
|
+
dataset = _useState10[0],
|
|
114
|
+
setDataset = _useState10[1];
|
|
115
|
+
|
|
92
116
|
var envNameList = useMemo(function () {
|
|
93
117
|
return eventEnvList ? eventEnvList.map(function (env) {
|
|
94
118
|
return env.name;
|
|
@@ -103,6 +127,7 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
103
127
|
}, [userPropList]);
|
|
104
128
|
useEffect(function () {
|
|
105
129
|
initShowList();
|
|
130
|
+
|
|
106
131
|
if (props.openCdpCondition && (!menuNameMap || menuNameMap['dataset'])) {
|
|
107
132
|
getDatasetList();
|
|
108
133
|
} else {
|
|
@@ -111,16 +136,21 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
111
136
|
}, []);
|
|
112
137
|
var haveCdpValues = useMemo(function () {
|
|
113
138
|
var flag = false;
|
|
139
|
+
|
|
114
140
|
var _iterator = _createForOfIteratorHelper(value),
|
|
115
|
-
|
|
141
|
+
_step;
|
|
142
|
+
|
|
116
143
|
try {
|
|
117
144
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
118
145
|
var condition = _step.value;
|
|
146
|
+
|
|
119
147
|
var _iterator2 = _createForOfIteratorHelper(condition),
|
|
120
|
-
|
|
148
|
+
_step2;
|
|
149
|
+
|
|
121
150
|
try {
|
|
122
151
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
123
152
|
var item = _step2.value;
|
|
153
|
+
|
|
124
154
|
if (item.dataset) {
|
|
125
155
|
flag = true;
|
|
126
156
|
break;
|
|
@@ -137,8 +167,10 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
137
167
|
} finally {
|
|
138
168
|
_iterator.f();
|
|
139
169
|
}
|
|
170
|
+
|
|
140
171
|
return flag;
|
|
141
172
|
}, [value]);
|
|
173
|
+
|
|
142
174
|
function initShowList() {
|
|
143
175
|
var showList = [];
|
|
144
176
|
value.forEach(function (item) {
|
|
@@ -150,6 +182,7 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
150
182
|
setShowList(showList);
|
|
151
183
|
setDataList(showList);
|
|
152
184
|
}
|
|
185
|
+
|
|
153
186
|
function onAdd(type) {
|
|
154
187
|
var condition = buildCondition(type);
|
|
155
188
|
var newValue = [].concat(_toConsumableArray(value), [[condition]]);
|
|
@@ -162,6 +195,7 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
162
195
|
setDataList([].concat(_toConsumableArray(dataList), [newData]));
|
|
163
196
|
props.onChange(newValue);
|
|
164
197
|
}
|
|
198
|
+
|
|
165
199
|
function _onChange(id, newData) {
|
|
166
200
|
var newValue = [];
|
|
167
201
|
var newDataList = [];
|
|
@@ -179,6 +213,7 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
179
213
|
newDataList.push(item);
|
|
180
214
|
}
|
|
181
215
|
});
|
|
216
|
+
|
|
182
217
|
if (newData.length === 0) {
|
|
183
218
|
var index = showList.findIndex(function (item) {
|
|
184
219
|
return item.id === id;
|
|
@@ -186,10 +221,12 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
186
221
|
showList.splice(index, 1);
|
|
187
222
|
setShowList(_toConsumableArray(showList));
|
|
188
223
|
}
|
|
224
|
+
|
|
189
225
|
setValue(newValue);
|
|
190
226
|
setDataList(newDataList);
|
|
191
227
|
props.onChange && props.onChange(newValue);
|
|
192
228
|
}
|
|
229
|
+
|
|
193
230
|
function getDatasetList() {
|
|
194
231
|
request(Apis.queryDatasetList, {
|
|
195
232
|
method: 'post',
|
|
@@ -206,9 +243,11 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
206
243
|
setLoading(false);
|
|
207
244
|
});
|
|
208
245
|
}
|
|
246
|
+
|
|
209
247
|
if (loading) {
|
|
210
248
|
return /*#__PURE__*/React.createElement(Spin, null);
|
|
211
249
|
}
|
|
250
|
+
|
|
212
251
|
return /*#__PURE__*/React.createElement(BizUserConditionContext.Provider, {
|
|
213
252
|
value: {
|
|
214
253
|
orConditionNum: props.orConditionNum || 2,
|
|
@@ -250,6 +289,7 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
250
289
|
type: "tishiicon"
|
|
251
290
|
}), "\u660E\u7EC6\u8868\u4E2D\u9700\u5B58\u5728\u300Capp_user_id\u300D\u6761\u4EF6\u65B9\u53EF\u751F\u6548\u3002") : null));
|
|
252
291
|
};
|
|
292
|
+
|
|
253
293
|
BizUserCondition.defaultProps = {
|
|
254
294
|
andConditionNum: 5,
|
|
255
295
|
textMode: false,
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
|
|
2
3
|
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."); }
|
|
4
|
+
|
|
3
5
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
+
|
|
4
7
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
|
+
|
|
5
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
|
|
6
11
|
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."); }
|
|
12
|
+
|
|
7
13
|
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); }
|
|
8
|
-
|
|
9
|
-
function
|
|
14
|
+
|
|
15
|
+
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; }
|
|
16
|
+
|
|
17
|
+
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; }
|
|
18
|
+
|
|
10
19
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
+
|
|
11
21
|
import React, { useContext, useEffect, useState } from 'react';
|
|
12
22
|
import { BizUserConditionContext } from '.';
|
|
13
23
|
import './styles/orConditions.less';
|
|
@@ -23,23 +33,28 @@ import TagsCondition from './conditions/tagsCondition';
|
|
|
23
33
|
import { classPrefix } from '.';
|
|
24
34
|
import Text from './conditions/textDesc';
|
|
25
35
|
import CdpCondition from './conditions/cdpCondition';
|
|
36
|
+
|
|
26
37
|
var OrConditions = function OrConditions(props) {
|
|
27
38
|
var _useContext = useContext(BizUserConditionContext),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
39
|
+
orConditionNum = _useContext.orConditionNum,
|
|
40
|
+
textMode = _useContext.textMode,
|
|
41
|
+
openTagCondition = _useContext.openTagCondition,
|
|
42
|
+
openCdpCondition = _useContext.openCdpCondition;
|
|
43
|
+
|
|
32
44
|
var orConditions = props.orConditions,
|
|
33
|
-
|
|
45
|
+
showAndDesc = props.showAndDesc;
|
|
46
|
+
|
|
34
47
|
var _useState = useState([]),
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
49
|
+
showList = _useState2[0],
|
|
50
|
+
setShowList = _useState2[1];
|
|
51
|
+
|
|
38
52
|
useEffect(function () {
|
|
39
53
|
if (orConditions) {
|
|
40
54
|
initShowList();
|
|
41
55
|
}
|
|
42
56
|
}, [orConditions]);
|
|
57
|
+
|
|
43
58
|
function initShowList() {
|
|
44
59
|
var showList = [];
|
|
45
60
|
orConditions.forEach(function (condition) {
|
|
@@ -51,6 +66,7 @@ var OrConditions = function OrConditions(props) {
|
|
|
51
66
|
});
|
|
52
67
|
setShowList(showList);
|
|
53
68
|
}
|
|
69
|
+
|
|
54
70
|
function onAdd(type) {
|
|
55
71
|
var condition = buildCondition(type);
|
|
56
72
|
var newData = {
|
|
@@ -63,45 +79,54 @@ var OrConditions = function OrConditions(props) {
|
|
|
63
79
|
setShowList([].concat(_toConsumableArray(showList), [newData]));
|
|
64
80
|
props.onChange(newValue);
|
|
65
81
|
}
|
|
82
|
+
|
|
66
83
|
function onChangeRunPeriod(id, newData) {
|
|
67
84
|
var newValue = [];
|
|
68
85
|
showList.forEach(function (data) {
|
|
69
86
|
if (id === data.id) {
|
|
70
87
|
data.condition.runPeriod = newData;
|
|
71
88
|
}
|
|
89
|
+
|
|
72
90
|
newValue.push(data.condition);
|
|
73
91
|
});
|
|
74
92
|
setShowList(_toConsumableArray(showList));
|
|
75
93
|
props.onChange(newValue);
|
|
76
94
|
}
|
|
95
|
+
|
|
77
96
|
function onChangeAttrs(id, newAttrs) {
|
|
78
97
|
var newValue = [];
|
|
79
98
|
showList.forEach(function (data) {
|
|
80
99
|
if (id === data.id) {
|
|
81
100
|
data.condition.attrs = newAttrs;
|
|
82
101
|
}
|
|
102
|
+
|
|
83
103
|
newValue.push(data.condition);
|
|
84
104
|
});
|
|
85
105
|
setShowList(_toConsumableArray(showList));
|
|
86
106
|
props.onChange(newValue);
|
|
87
107
|
}
|
|
108
|
+
|
|
88
109
|
function onChangeEvent(id, newEvnet) {
|
|
89
110
|
var newValue = [];
|
|
90
111
|
showList.forEach(function (data) {
|
|
91
112
|
if (id === data.id) {
|
|
92
113
|
data.condition = newEvnet;
|
|
93
114
|
}
|
|
115
|
+
|
|
94
116
|
newValue.push(data.condition);
|
|
95
117
|
});
|
|
96
118
|
setShowList(_toConsumableArray(showList));
|
|
97
119
|
props.onChange(newValue);
|
|
98
120
|
}
|
|
121
|
+
|
|
99
122
|
function onChangeTags(id, newTags) {
|
|
100
123
|
changeData('tag', id, newTags);
|
|
101
124
|
}
|
|
125
|
+
|
|
102
126
|
function onChangeCdp(id, newCdp) {
|
|
103
127
|
changeData('cdp', id, newCdp);
|
|
104
128
|
}
|
|
129
|
+
|
|
105
130
|
function changeData(type, id, newData) {
|
|
106
131
|
var newValue = [];
|
|
107
132
|
showList.forEach(function (data) {
|
|
@@ -118,23 +143,28 @@ var OrConditions = function OrConditions(props) {
|
|
|
118
143
|
data.condition.dataset = newData;
|
|
119
144
|
}
|
|
120
145
|
}
|
|
146
|
+
|
|
121
147
|
newValue.push(data.condition);
|
|
122
148
|
});
|
|
123
149
|
setShowList(_toConsumableArray(showList));
|
|
124
150
|
props.onChange(newValue);
|
|
125
151
|
}
|
|
152
|
+
|
|
126
153
|
function onDelete(id) {
|
|
127
154
|
var index = showList.findIndex(function (item) {
|
|
128
155
|
return item.id === id;
|
|
129
156
|
});
|
|
130
157
|
showList.splice(index, 1);
|
|
158
|
+
|
|
131
159
|
var newList = _toConsumableArray(showList);
|
|
160
|
+
|
|
132
161
|
setShowList(newList);
|
|
133
162
|
var newValue = newList.map(function (item) {
|
|
134
163
|
return item.condition;
|
|
135
164
|
});
|
|
136
165
|
props.onChange(newValue);
|
|
137
166
|
}
|
|
167
|
+
|
|
138
168
|
if (textMode) {
|
|
139
169
|
return /*#__PURE__*/React.createElement(React.Fragment, null, textMode && showAndDesc ? /*#__PURE__*/React.createElement("span", {
|
|
140
170
|
className: "".concat(classPrefix, "-and-desc")
|
|
@@ -142,10 +172,12 @@ var OrConditions = function OrConditions(props) {
|
|
|
142
172
|
return renderCondition(item, i);
|
|
143
173
|
}), /*#__PURE__*/React.createElement("span", null, ")"));
|
|
144
174
|
}
|
|
175
|
+
|
|
145
176
|
function renderCondition(data, i) {
|
|
146
177
|
var condition = data.condition,
|
|
147
|
-
|
|
178
|
+
id = data.id;
|
|
148
179
|
var conditionDom = null;
|
|
180
|
+
|
|
149
181
|
if (textMode) {
|
|
150
182
|
return /*#__PURE__*/React.createElement(Text, {
|
|
151
183
|
showOrDesc: i > 0,
|
|
@@ -153,6 +185,7 @@ var OrConditions = function OrConditions(props) {
|
|
|
153
185
|
condition: condition
|
|
154
186
|
});
|
|
155
187
|
}
|
|
188
|
+
|
|
156
189
|
if (condition.labels) {
|
|
157
190
|
if (!openTagCondition) return null;
|
|
158
191
|
conditionDom = /*#__PURE__*/React.createElement(TagsCondition, {
|
|
@@ -169,6 +202,7 @@ var OrConditions = function OrConditions(props) {
|
|
|
169
202
|
});
|
|
170
203
|
} else {
|
|
171
204
|
var conditionData = condition;
|
|
205
|
+
|
|
172
206
|
if (conditionData.eventId === undefined) {
|
|
173
207
|
conditionDom = /*#__PURE__*/React.createElement(PropCondition, {
|
|
174
208
|
label: "\u5C5E\u6027",
|
|
@@ -199,6 +233,7 @@ var OrConditions = function OrConditions(props) {
|
|
|
199
233
|
}));
|
|
200
234
|
}
|
|
201
235
|
}
|
|
236
|
+
|
|
202
237
|
return /*#__PURE__*/React.createElement(ConditionWrap, {
|
|
203
238
|
key: id,
|
|
204
239
|
onDelte: function onDelte() {
|
|
@@ -206,6 +241,7 @@ var OrConditions = function OrConditions(props) {
|
|
|
206
241
|
}
|
|
207
242
|
}, conditionDom);
|
|
208
243
|
}
|
|
244
|
+
|
|
209
245
|
return /*#__PURE__*/React.createElement("div", {
|
|
210
246
|
className: ["".concat(classPrefix, "-or"),, textMode ? 'text-mode' : ''].join(' ')
|
|
211
247
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -222,4 +258,5 @@ var OrConditions = function OrConditions(props) {
|
|
|
222
258
|
show: showList.length < orConditionNum
|
|
223
259
|
}));
|
|
224
260
|
};
|
|
261
|
+
|
|
225
262
|
export default OrConditions;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { BizUserConditionContext } from '.';
|
|
3
3
|
import './styles/relationLabel.less';
|
|
4
|
+
|
|
4
5
|
var RelationLabel = function RelationLabel(props) {
|
|
5
6
|
var _useContext = useContext(BizUserConditionContext),
|
|
6
|
-
|
|
7
|
+
textMode = _useContext.textMode;
|
|
8
|
+
|
|
7
9
|
if (textMode) return null;
|
|
8
10
|
return /*#__PURE__*/React.createElement("div", {
|
|
9
11
|
className: "biz-user-condition-relation"
|
|
@@ -11,4 +13,5 @@ var RelationLabel = function RelationLabel(props) {
|
|
|
11
13
|
className: "biz-user-condition-relation-label"
|
|
12
14
|
}, props.children) : null);
|
|
13
15
|
};
|
|
16
|
+
|
|
14
17
|
export default RelationLabel;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { UserProp } from '../attributeSelector/types';
|
|
3
|
-
export type Unpacked<T, U extends keyof T> = Required<T> extends {
|
|
3
|
+
export declare type Unpacked<T, U extends keyof T> = Required<T> extends {
|
|
4
4
|
[key in U]: infer R;
|
|
5
5
|
} ? R : never;
|
|
6
6
|
export interface RunPeriodI {
|
package/es/userCondition/util.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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
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
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
|
|
6
|
-
|
|
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
7
|
export function buildCondition(type) {
|
|
8
8
|
switch (type) {
|
|
9
9
|
case 'add':
|
|
@@ -20,6 +20,7 @@ export function buildCondition(type) {
|
|
|
20
20
|
attrs: []
|
|
21
21
|
};
|
|
22
22
|
return condition;
|
|
23
|
+
|
|
23
24
|
case 'active':
|
|
24
25
|
return {
|
|
25
26
|
eventId: '-4',
|
|
@@ -33,6 +34,7 @@ export function buildCondition(type) {
|
|
|
33
34
|
},
|
|
34
35
|
attrs: []
|
|
35
36
|
};
|
|
37
|
+
|
|
36
38
|
case 'event':
|
|
37
39
|
return {
|
|
38
40
|
eventId: 0,
|
|
@@ -46,6 +48,7 @@ export function buildCondition(type) {
|
|
|
46
48
|
values: ['30', '0']
|
|
47
49
|
}
|
|
48
50
|
};
|
|
51
|
+
|
|
49
52
|
case 'prop':
|
|
50
53
|
return {
|
|
51
54
|
eventId: undefined,
|
|
@@ -53,6 +56,7 @@ export function buildCondition(type) {
|
|
|
53
56
|
attrId: 0
|
|
54
57
|
}]
|
|
55
58
|
};
|
|
59
|
+
|
|
56
60
|
case 'tag':
|
|
57
61
|
return {
|
|
58
62
|
attrs: [],
|
|
@@ -62,6 +66,7 @@ export function buildCondition(type) {
|
|
|
62
66
|
},
|
|
63
67
|
eventId: undefined
|
|
64
68
|
};
|
|
69
|
+
|
|
65
70
|
case 'cdp':
|
|
66
71
|
return {
|
|
67
72
|
dataset: [undefined]
|
|
@@ -90,16 +95,19 @@ export function transformNumberOperate(key) {
|
|
|
90
95
|
export function findEvent(eventId, eventGroupList) {
|
|
91
96
|
for (var i = 0; i < eventGroupList.length; i++) {
|
|
92
97
|
var eventList = eventGroupList[i].eventList;
|
|
98
|
+
|
|
93
99
|
for (var j = 0; j < eventList.length; j++) {
|
|
94
100
|
if (eventList[j].id === eventId) return eventList[j];
|
|
95
101
|
}
|
|
96
102
|
}
|
|
103
|
+
|
|
97
104
|
return null;
|
|
98
105
|
}
|
|
99
106
|
export function findPropAndEnv(name, list) {
|
|
100
107
|
for (var i = 0; i < list.length; i++) {
|
|
101
108
|
if (list[i].name === name) return list[i];
|
|
102
109
|
}
|
|
110
|
+
|
|
103
111
|
return null;
|
|
104
112
|
}
|
|
105
113
|
export function buildSelectLayer(data) {
|
|
@@ -129,6 +137,7 @@ export function buildTagsGroup(list) {
|
|
|
129
137
|
list.forEach(function (label) {
|
|
130
138
|
if (!label.sequence) return;
|
|
131
139
|
var index = label.sequence - 1;
|
|
140
|
+
|
|
132
141
|
if (options[index]) {
|
|
133
142
|
options[index].children.push(label);
|
|
134
143
|
} else {
|