@zgfe/business-lib 1.1.41-alpha.0 → 1.1.41-attribution.3
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/addToScene/index.js +1 -1
- package/es/attrCondition/demo/group.d.ts +2 -0
- package/es/attrCondition/demo/group.js +25 -0
- package/es/attrCondition/demo/index.d.ts +2 -0
- package/es/attrCondition/demo/index.js +16 -0
- package/es/attrCondition/group.d.ts +4 -0
- package/es/attrCondition/group.js +59 -0
- package/es/attrCondition/index.d.ts +5 -0
- package/es/attrCondition/index.js +66 -0
- package/es/attrCondition/styles/index.less +61 -0
- package/es/attrCondition/useAttrCondition.d.ts +13 -0
- package/es/attrCondition/useAttrCondition.js +91 -0
- package/es/attrCondition/useConditionGroup.d.ts +10 -0
- package/es/attrCondition/useConditionGroup.js +127 -0
- package/es/attrConditions/group.js +11 -118
- package/es/attrConditions/index.js +13 -79
- package/es/attributeSelector/listPanel.js +2 -1
- package/es/constants/apis.js +1 -1
- package/es/context/index.d.ts +0 -4
- package/es/demoWrapper/content.js +6 -6
- package/es/demoWrapper/index.js +3 -2
- package/es/eventSelector/demo/index.js +2 -1
- package/es/eventSelector/index.js +2 -1
- package/es/eventSelector/listPanel.js +14 -3
- package/es/eventSelector/option.d.ts +1 -0
- package/es/eventSelector/option.js +4 -2
- package/es/eventSelector/styles/index.less +6 -0
- package/es/eventSelector/types.d.ts +2 -0
- package/es/index.d.ts +3 -1
- package/es/index.js +3 -1
- package/es/utils/ajax.js +1 -3
- package/package.json +2 -2
package/es/addToScene/index.js
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import { BizAttrConditionGroup, DemoWrapper } from '@zgfe/business-lib';
|
|
3
|
+
import { Button } from 'antd';
|
|
4
|
+
export default (function () {
|
|
5
|
+
var groupRef = useRef(null);
|
|
6
|
+
return /*#__PURE__*/React.createElement(DemoWrapper, {
|
|
7
|
+
needMeta: true
|
|
8
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
9
|
+
style: {
|
|
10
|
+
padding: '16px',
|
|
11
|
+
background: '#fff'
|
|
12
|
+
}
|
|
13
|
+
}, /*#__PURE__*/React.createElement(BizAttrConditionGroup, {
|
|
14
|
+
ref: groupRef,
|
|
15
|
+
enableDelete: true
|
|
16
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
17
|
+
style: {
|
|
18
|
+
marginTop: '16px'
|
|
19
|
+
}
|
|
20
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
21
|
+
onClick: function onClick() {
|
|
22
|
+
groupRef.current.add();
|
|
23
|
+
}
|
|
24
|
+
}, "\u6DFB\u52A0\u6761\u4EF6"))));
|
|
25
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BizAttrCondition, DemoWrapper } from '@zgfe/business-lib';
|
|
3
|
+
export default (function () {
|
|
4
|
+
return /*#__PURE__*/React.createElement(DemoWrapper, {
|
|
5
|
+
needMeta: true
|
|
6
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
7
|
+
style: {
|
|
8
|
+
padding: '16px',
|
|
9
|
+
background: '#fff'
|
|
10
|
+
}
|
|
11
|
+
}, /*#__PURE__*/React.createElement(BizAttrCondition, {
|
|
12
|
+
onChange: function onChange(condition) {
|
|
13
|
+
console.log(condition);
|
|
14
|
+
}
|
|
15
|
+
})));
|
|
16
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import useConditionGroup from './useConditionGroup';
|
|
3
|
+
import { Skeleton, Space } from 'antd';
|
|
4
|
+
import BizAttrCondition from '.';
|
|
5
|
+
var BizAttrConditionGroup = function BizAttrConditionGroup(props, ref) {
|
|
6
|
+
var eventIdList = props.eventIdList,
|
|
7
|
+
enableDelete = props.enableDelete,
|
|
8
|
+
enableEventProp = props.enableEventProp,
|
|
9
|
+
enableUserProp = props.enableUserProp,
|
|
10
|
+
enableEnvProp = props.enableEnvProp,
|
|
11
|
+
disableItemList = props.disableItemList;
|
|
12
|
+
var _useConditionGroup = useConditionGroup(props, ref),
|
|
13
|
+
loading = _useConditionGroup.loading,
|
|
14
|
+
conditions = _useConditionGroup.conditions,
|
|
15
|
+
_onChange = _useConditionGroup.onChange,
|
|
16
|
+
onClickRelation = _useConditionGroup.onClickRelation,
|
|
17
|
+
_onDelete = _useConditionGroup.onDelete,
|
|
18
|
+
relation = _useConditionGroup.relation;
|
|
19
|
+
var classPrefix = 'biz-attr-condition-group';
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: classPrefix
|
|
22
|
+
}, /*#__PURE__*/React.createElement(Skeleton, {
|
|
23
|
+
loading: loading,
|
|
24
|
+
active: true,
|
|
25
|
+
paragraph: {
|
|
26
|
+
rows: 2
|
|
27
|
+
}
|
|
28
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
className: "".concat(classPrefix, "-handle")
|
|
30
|
+
}, conditions.length > 1 && /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
className: "".concat(classPrefix, "-operate"),
|
|
32
|
+
onClick: onClickRelation
|
|
33
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: "".concat(classPrefix, "-operate-text ").concat(relation === 'and' || props.onlyAnd ? 'active' : '')
|
|
35
|
+
}, "\u4E14"), !props.onlyAnd && /*#__PURE__*/React.createElement("div", {
|
|
36
|
+
className: "".concat(classPrefix, "-operate-text ").concat(relation === 'or' ? 'active' : '')
|
|
37
|
+
}, "\u6216"))), /*#__PURE__*/React.createElement(Space, {
|
|
38
|
+
className: "".concat(classPrefix, "-container"),
|
|
39
|
+
direction: "vertical"
|
|
40
|
+
}, conditions.map(function (item, index) {
|
|
41
|
+
return /*#__PURE__*/React.createElement(BizAttrCondition, {
|
|
42
|
+
key: item.key,
|
|
43
|
+
value: item.data,
|
|
44
|
+
eventIdList: eventIdList,
|
|
45
|
+
enableDelete: enableDelete,
|
|
46
|
+
enableEventProp: enableEventProp,
|
|
47
|
+
enableUserProp: enableUserProp,
|
|
48
|
+
enableEnvProp: enableEnvProp,
|
|
49
|
+
disableItemList: disableItemList,
|
|
50
|
+
onChange: function onChange(data) {
|
|
51
|
+
return _onChange(data, index);
|
|
52
|
+
},
|
|
53
|
+
onDelete: function onDelete() {
|
|
54
|
+
return _onDelete(index);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}))));
|
|
58
|
+
};
|
|
59
|
+
export default /*#__PURE__*/React.forwardRef(BizAttrConditionGroup);
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Skeleton, Space } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import BizAttributeSelector from '../attributeSelector';
|
|
4
|
+
import BizOperateList from '../attrConditions/components/operateList';
|
|
5
|
+
import ValuesList from '../attrConditions/components/valuesList';
|
|
6
|
+
import useAttrCondition from './useAttrCondition';
|
|
7
|
+
import './styles/index.less';
|
|
8
|
+
import IconFont from '../icon/iconFont';
|
|
9
|
+
var classPrefix = 'biz-attr-condition';
|
|
10
|
+
var BizAttrCondition = function BizAttrCondition(props) {
|
|
11
|
+
var eventIdList = props.eventIdList,
|
|
12
|
+
enableDelete = props.enableDelete,
|
|
13
|
+
enableEventProp = props.enableEventProp,
|
|
14
|
+
enableUserProp = props.enableUserProp,
|
|
15
|
+
enableEnvProp = props.enableEnvProp,
|
|
16
|
+
disableItemList = props.disableItemList,
|
|
17
|
+
theme = props.theme;
|
|
18
|
+
var _useAttrCondition = useAttrCondition(props),
|
|
19
|
+
loading = _useAttrCondition.loading,
|
|
20
|
+
attr = _useAttrCondition.attr,
|
|
21
|
+
operate = _useAttrCondition.operate,
|
|
22
|
+
values = _useAttrCondition.values,
|
|
23
|
+
onChangeAttr = _useAttrCondition.onChangeAttr,
|
|
24
|
+
onChangeOperate = _useAttrCondition.onChangeOperate,
|
|
25
|
+
onChangeValues = _useAttrCondition.onChangeValues,
|
|
26
|
+
onDelete = _useAttrCondition.onDelete;
|
|
27
|
+
return /*#__PURE__*/React.createElement(Space, {
|
|
28
|
+
className: classPrefix
|
|
29
|
+
}, !loading ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BizAttributeSelector, {
|
|
30
|
+
value: attr,
|
|
31
|
+
eventIdList: eventIdList,
|
|
32
|
+
enableEventProp: enableEventProp,
|
|
33
|
+
enableUserProp: enableUserProp,
|
|
34
|
+
enableEnvProp: enableEnvProp,
|
|
35
|
+
disableItemList: disableItemList,
|
|
36
|
+
onChange: onChangeAttr,
|
|
37
|
+
theme: theme,
|
|
38
|
+
destroyPopupOnHide: props.destroyPopupOnHide
|
|
39
|
+
}), /*#__PURE__*/React.createElement(BizOperateList, {
|
|
40
|
+
theme: theme,
|
|
41
|
+
attr: attr,
|
|
42
|
+
defaultValue: operate,
|
|
43
|
+
onChange: onChangeOperate
|
|
44
|
+
}), /*#__PURE__*/React.createElement(ValuesList, {
|
|
45
|
+
attr: attr,
|
|
46
|
+
operate: operate,
|
|
47
|
+
defaultValue: values,
|
|
48
|
+
onChange: onChangeValues,
|
|
49
|
+
theme: theme
|
|
50
|
+
}), enableDelete && /*#__PURE__*/React.createElement(IconFont, {
|
|
51
|
+
type: "qingchu",
|
|
52
|
+
className: "".concat(classPrefix, "-btn-del"),
|
|
53
|
+
onClick: onDelete
|
|
54
|
+
})) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Skeleton.Input, {
|
|
55
|
+
active: true
|
|
56
|
+
}), /*#__PURE__*/React.createElement(Skeleton.Input, {
|
|
57
|
+
active: true
|
|
58
|
+
}), /*#__PURE__*/React.createElement(Skeleton.Input, {
|
|
59
|
+
active: true
|
|
60
|
+
})));
|
|
61
|
+
};
|
|
62
|
+
BizAttrCondition.defaultProps = {
|
|
63
|
+
border: false,
|
|
64
|
+
theme: ''
|
|
65
|
+
};
|
|
66
|
+
export default BizAttrCondition;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
@import '../../assets/styles/inner.less';
|
|
2
|
+
.biz-attr-condition {
|
|
3
|
+
&-btn-del {
|
|
4
|
+
color: #9aa1a9;
|
|
5
|
+
&:hover {
|
|
6
|
+
color: @error-color;
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
.biz-attr-select-handle {
|
|
11
|
+
width: 184px;
|
|
12
|
+
padding: 0;
|
|
13
|
+
border: none;
|
|
14
|
+
}
|
|
15
|
+
.ant-space-item:nth-of-type(3) {
|
|
16
|
+
width: 184px;
|
|
17
|
+
}
|
|
18
|
+
&-group {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: row;
|
|
21
|
+
&-container {
|
|
22
|
+
flex: 1;
|
|
23
|
+
}
|
|
24
|
+
&-handle {
|
|
25
|
+
position: relative;
|
|
26
|
+
width: 1px;
|
|
27
|
+
margin-right: 16px;
|
|
28
|
+
margin-left: 8px;
|
|
29
|
+
background: @border-color-base;
|
|
30
|
+
}
|
|
31
|
+
&-operate {
|
|
32
|
+
position: absolute;
|
|
33
|
+
top: 50%;
|
|
34
|
+
left: 50%;
|
|
35
|
+
width: 16px;
|
|
36
|
+
transform: translate(-50%, -50%);
|
|
37
|
+
}
|
|
38
|
+
&-operate-text {
|
|
39
|
+
width: 16px;
|
|
40
|
+
height: 16px;
|
|
41
|
+
font-size: 12px;
|
|
42
|
+
line-height: 16px;
|
|
43
|
+
text-align: center;
|
|
44
|
+
|
|
45
|
+
.__default-hover();
|
|
46
|
+
|
|
47
|
+
&:first-child {
|
|
48
|
+
border-radius: @border-radius-sx @border-radius-sx 0px 0px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&:last-child {
|
|
52
|
+
border-radius: 0px 0px @border-radius-sx @border-radius-sx;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&.active {
|
|
56
|
+
color: #fff;
|
|
57
|
+
background: @primary-color;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AttrConditionTypes } from '../attrConditions/types';
|
|
2
|
+
import { AttributeSelect } from '../attributeSelector/types';
|
|
3
|
+
declare const useAttrCondition: (props: AttrConditionTypes.ItemProp) => {
|
|
4
|
+
attr: AttributeSelect.Value | undefined;
|
|
5
|
+
operate: import("../attrConditions/types").OperateTypes | undefined;
|
|
6
|
+
values: string[] | undefined;
|
|
7
|
+
loading: boolean;
|
|
8
|
+
onDelete: () => void;
|
|
9
|
+
onChangeAttr: (attrData: AttributeSelect.Value) => void;
|
|
10
|
+
onChangeOperate: (data: any) => void;
|
|
11
|
+
onChangeValues: (data: any) => void;
|
|
12
|
+
};
|
|
13
|
+
export default useAttrCondition;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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
|
+
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; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { useEffect, useState } from 'react';
|
|
8
|
+
import { PropCategory } from '../attributeSelector/types';
|
|
9
|
+
import { getCondition } from '../attrConditions';
|
|
10
|
+
var useAttrCondition = function useAttrCondition(props) {
|
|
11
|
+
var _props$defaultValue, _props$value, _props$defaultValue2, _props$value2;
|
|
12
|
+
var _useState = useState(),
|
|
13
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
14
|
+
attr = _useState2[0],
|
|
15
|
+
setAttr = _useState2[1];
|
|
16
|
+
var _useState3 = useState(((_props$defaultValue = props.defaultValue) === null || _props$defaultValue === void 0 ? void 0 : _props$defaultValue.operator) || ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.operator)),
|
|
17
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
18
|
+
operate = _useState4[0],
|
|
19
|
+
setOperate = _useState4[1];
|
|
20
|
+
var _useState5 = useState(((_props$defaultValue2 = props.defaultValue) === null || _props$defaultValue2 === void 0 ? void 0 : _props$defaultValue2.values) || ((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.values)),
|
|
21
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
22
|
+
values = _useState6[0],
|
|
23
|
+
setValues = _useState6[1];
|
|
24
|
+
var _useState7 = useState(true),
|
|
25
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
26
|
+
loading = _useState8[0],
|
|
27
|
+
setLoading = _useState8[1];
|
|
28
|
+
useEffect(function () {
|
|
29
|
+
var data = props.defaultValue || props.value;
|
|
30
|
+
if (data) {
|
|
31
|
+
var attrData;
|
|
32
|
+
if (data.propCategory === PropCategory.EventProp) {
|
|
33
|
+
if (data.attrId) {
|
|
34
|
+
attrData = {
|
|
35
|
+
id: data.attrId,
|
|
36
|
+
propCategory: data.propCategory,
|
|
37
|
+
type: data.type,
|
|
38
|
+
key: data.attrId,
|
|
39
|
+
label: data.label,
|
|
40
|
+
dimensionSub: data.dimensionSub || 'event_attr'
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
} else if (data.propCategory === PropCategory.UserProp || data.propCategory === PropCategory.EnvProp) {
|
|
44
|
+
if (data.attrName) {
|
|
45
|
+
var aId = data.attrId || 0;
|
|
46
|
+
attrData = {
|
|
47
|
+
id: aId,
|
|
48
|
+
name: data.attrName,
|
|
49
|
+
propCategory: data.propCategory,
|
|
50
|
+
type: data.type,
|
|
51
|
+
category: data.category,
|
|
52
|
+
key: "".concat(data.propCategory, "-").concat(data.dimensionSub || data.attrName, "-").concat(aId),
|
|
53
|
+
subtype: data.subtype,
|
|
54
|
+
dimensionSub: data.dimensionSub || data.attrName
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
setAttr(attrData);
|
|
59
|
+
}
|
|
60
|
+
setLoading(false);
|
|
61
|
+
}, []);
|
|
62
|
+
var onDelete = function onDelete() {
|
|
63
|
+
if (props.onDelete) props.onDelete();
|
|
64
|
+
};
|
|
65
|
+
useEffect(function () {
|
|
66
|
+
if (props.onChange) {
|
|
67
|
+
if (!attr) return;
|
|
68
|
+
props.onChange(getCondition(attr, operate, values));
|
|
69
|
+
}
|
|
70
|
+
}, [attr, operate, values]);
|
|
71
|
+
var onChangeAttr = function onChangeAttr(attrData) {
|
|
72
|
+
setAttr(attrData);
|
|
73
|
+
};
|
|
74
|
+
var onChangeOperate = function onChangeOperate(data) {
|
|
75
|
+
setOperate(data);
|
|
76
|
+
};
|
|
77
|
+
var onChangeValues = function onChangeValues(data) {
|
|
78
|
+
setValues(data);
|
|
79
|
+
};
|
|
80
|
+
return {
|
|
81
|
+
attr: attr,
|
|
82
|
+
operate: operate,
|
|
83
|
+
values: values,
|
|
84
|
+
loading: loading,
|
|
85
|
+
onDelete: onDelete,
|
|
86
|
+
onChangeAttr: onChangeAttr,
|
|
87
|
+
onChangeOperate: onChangeOperate,
|
|
88
|
+
onChangeValues: onChangeValues
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
export default useAttrCondition;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AttrConditionTypes } from '../attrConditions/types';
|
|
2
|
+
declare const useConditionGroup: (props: AttrConditionTypes.GroupProp, ref: React.ForwardedRef<any>) => {
|
|
3
|
+
relation: "and" | "or";
|
|
4
|
+
conditions: AttrConditionTypes.GroupAddKey[];
|
|
5
|
+
loading: boolean;
|
|
6
|
+
onClickRelation: (e: any) => void;
|
|
7
|
+
onChange: (data: AttrConditionTypes.ItemValue, index: number) => void;
|
|
8
|
+
onDelete: (index: number) => void;
|
|
9
|
+
};
|
|
10
|
+
export default useConditionGroup;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
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."); }
|
|
3
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
4
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
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."); }
|
|
7
|
+
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
|
+
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; }
|
|
9
|
+
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; } }
|
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
import { useState, useEffect, useImperativeHandle } from 'react';
|
|
12
|
+
import _ from 'lodash';
|
|
13
|
+
var useConditionGroup = function useConditionGroup(props, ref) {
|
|
14
|
+
var onConditionsCount = props.onConditionsCount;
|
|
15
|
+
var _useState = useState('and'),
|
|
16
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
17
|
+
relation = _useState2[0],
|
|
18
|
+
setRelation = _useState2[1];
|
|
19
|
+
var _useState3 = useState([]),
|
|
20
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
21
|
+
conditions = _useState4[0],
|
|
22
|
+
setConditions = _useState4[1];
|
|
23
|
+
var _useState5 = useState(true),
|
|
24
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
25
|
+
loading = _useState6[0],
|
|
26
|
+
setLoading = _useState6[1];
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
var data = props.defaultValue || props.value;
|
|
29
|
+
if (data) {
|
|
30
|
+
if (data.relation) setRelation(props.onlyAnd ? 'and' : data.relation);
|
|
31
|
+
if (data.conditions) {
|
|
32
|
+
setConditions(function () {
|
|
33
|
+
return addKeyToGroup(data.conditions);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
setLoading(false);
|
|
38
|
+
}, []);
|
|
39
|
+
useImperativeHandle(ref, function () {
|
|
40
|
+
return {
|
|
41
|
+
add: function add() {
|
|
42
|
+
onConditionsCount && onConditionsCount(conditions.length + 1);
|
|
43
|
+
setConditions(function (conditions) {
|
|
44
|
+
conditions.push({
|
|
45
|
+
key: Math.random()
|
|
46
|
+
});
|
|
47
|
+
return _toConsumableArray(conditions);
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
setValue: function setValue(data) {
|
|
51
|
+
if (data) {
|
|
52
|
+
if (data.relation) setRelation(props.onlyAnd ? 'and' : data.relation);
|
|
53
|
+
if (data.conditions) {
|
|
54
|
+
setConditions(function () {
|
|
55
|
+
return addKeyToGroup(data.conditions);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
setRelation('and');
|
|
60
|
+
setConditions([]);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
var addKeyToGroup = function addKeyToGroup(data) {
|
|
66
|
+
return data.map(function (item) {
|
|
67
|
+
return {
|
|
68
|
+
key: Math.random(),
|
|
69
|
+
data: item
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
var removeKeyToGroup = function removeKeyToGroup(data) {
|
|
74
|
+
var group = [];
|
|
75
|
+
data.forEach(function (item) {
|
|
76
|
+
if (item.data) group.push(item.data);
|
|
77
|
+
});
|
|
78
|
+
return group;
|
|
79
|
+
};
|
|
80
|
+
var onClickRelation = function onClickRelation(e) {
|
|
81
|
+
e.stopPropagation();
|
|
82
|
+
var data = e.target.innerText === '且' ? 'and' : 'or';
|
|
83
|
+
setRelation(data);
|
|
84
|
+
if (props.onChange) {
|
|
85
|
+
var group = removeKeyToGroup(conditions);
|
|
86
|
+
props.onChange({
|
|
87
|
+
relation: data,
|
|
88
|
+
conditions: group
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
var onChange = function onChange(data, index) {
|
|
93
|
+
var conditionArr = _.cloneDeep(conditions);
|
|
94
|
+
conditionArr[index].data = data;
|
|
95
|
+
setConditions(conditionArr);
|
|
96
|
+
onConditionsCount && onConditionsCount(conditionArr.length);
|
|
97
|
+
if (props.onChange) {
|
|
98
|
+
var group = removeKeyToGroup(conditionArr);
|
|
99
|
+
props.onChange({
|
|
100
|
+
relation: relation,
|
|
101
|
+
conditions: group
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
var onDelete = function onDelete(index) {
|
|
106
|
+
var conditionArr = _.cloneDeep(conditions);
|
|
107
|
+
conditionArr.splice(index, 1);
|
|
108
|
+
setConditions(conditionArr);
|
|
109
|
+
onConditionsCount && onConditionsCount(conditionArr.length);
|
|
110
|
+
if (props.onChange) {
|
|
111
|
+
var group = removeKeyToGroup(conditionArr);
|
|
112
|
+
props.onChange({
|
|
113
|
+
relation: relation,
|
|
114
|
+
conditions: group
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
return {
|
|
119
|
+
relation: relation,
|
|
120
|
+
conditions: conditions,
|
|
121
|
+
loading: loading,
|
|
122
|
+
onClickRelation: onClickRelation,
|
|
123
|
+
onChange: onChange,
|
|
124
|
+
onDelete: onDelete
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
export default useConditionGroup;
|
|
@@ -1,134 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
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."); }
|
|
3
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
4
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
5
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
-
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."); }
|
|
7
|
-
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
|
-
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; }
|
|
9
|
-
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; } }
|
|
10
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
-
import React, { useEffect, useImperativeHandle, useState } from 'react';
|
|
1
|
+
import React from 'react';
|
|
12
2
|
import BizConditionItem from './index';
|
|
13
3
|
import './styles/group.less';
|
|
14
|
-
import _ from 'lodash';
|
|
15
4
|
import { Skeleton } from 'antd';
|
|
5
|
+
import useConditionGroup from '../attrCondition/useConditionGroup';
|
|
16
6
|
var BizConditionGroup = function BizConditionGroup(props, ref) {
|
|
17
7
|
var eventIdList = props.eventIdList,
|
|
18
8
|
enableDelete = props.enableDelete,
|
|
19
9
|
enableEventProp = props.enableEventProp,
|
|
20
10
|
enableUserProp = props.enableUserProp,
|
|
21
11
|
enableEnvProp = props.enableEnvProp,
|
|
22
|
-
disableItemList = props.disableItemList
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
conditions = _useState4[0],
|
|
31
|
-
setConditions = _useState4[1];
|
|
32
|
-
var _useState5 = useState(true),
|
|
33
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
34
|
-
ready = _useState6[0],
|
|
35
|
-
setReady = _useState6[1];
|
|
12
|
+
disableItemList = props.disableItemList;
|
|
13
|
+
var _useConditionGroup = useConditionGroup(props, ref),
|
|
14
|
+
loading = _useConditionGroup.loading,
|
|
15
|
+
conditions = _useConditionGroup.conditions,
|
|
16
|
+
_onChange = _useConditionGroup.onChange,
|
|
17
|
+
onClickRelation = _useConditionGroup.onClickRelation,
|
|
18
|
+
_onDelete = _useConditionGroup.onDelete,
|
|
19
|
+
relation = _useConditionGroup.relation;
|
|
36
20
|
var classPrefix = 'biz-condition';
|
|
37
|
-
useEffect(function () {
|
|
38
|
-
var data = props.defaultValue || props.value;
|
|
39
|
-
if (data) {
|
|
40
|
-
if (data.relation) setRelation(props.onlyAnd ? 'and' : data.relation);
|
|
41
|
-
if (data.conditions) {
|
|
42
|
-
setConditions(function () {
|
|
43
|
-
return addKeyToGroup(data.conditions);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
setReady(false);
|
|
48
|
-
}, []);
|
|
49
|
-
useImperativeHandle(ref, function () {
|
|
50
|
-
return {
|
|
51
|
-
add: function add() {
|
|
52
|
-
onConditionsCount && onConditionsCount(conditions.length + 1);
|
|
53
|
-
setConditions(function (conditions) {
|
|
54
|
-
conditions.push({
|
|
55
|
-
key: Math.random()
|
|
56
|
-
});
|
|
57
|
-
return _toConsumableArray(conditions);
|
|
58
|
-
});
|
|
59
|
-
},
|
|
60
|
-
setValue: function setValue(data) {
|
|
61
|
-
if (data) {
|
|
62
|
-
if (data.relation) setRelation(props.onlyAnd ? 'and' : data.relation);
|
|
63
|
-
if (data.conditions) {
|
|
64
|
-
setConditions(function () {
|
|
65
|
-
return addKeyToGroup(data.conditions);
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
} else {
|
|
69
|
-
setRelation('and');
|
|
70
|
-
setConditions([]);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
});
|
|
75
|
-
var addKeyToGroup = function addKeyToGroup(data) {
|
|
76
|
-
return data.map(function (item) {
|
|
77
|
-
return {
|
|
78
|
-
key: Math.random(),
|
|
79
|
-
data: item
|
|
80
|
-
};
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
var removeKeyToGroup = function removeKeyToGroup(data) {
|
|
84
|
-
var group = [];
|
|
85
|
-
data.forEach(function (item) {
|
|
86
|
-
if (item.data) group.push(item.data);
|
|
87
|
-
});
|
|
88
|
-
return group;
|
|
89
|
-
};
|
|
90
|
-
var onClickRelation = function onClickRelation(e) {
|
|
91
|
-
e.stopPropagation();
|
|
92
|
-
var data = e.target.innerText === '且' ? 'and' : 'or';
|
|
93
|
-
setRelation(data);
|
|
94
|
-
if (props.onChange) {
|
|
95
|
-
var group = removeKeyToGroup(conditions);
|
|
96
|
-
props.onChange({
|
|
97
|
-
relation: data,
|
|
98
|
-
conditions: group
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
var _onChange = function onChange(data, index) {
|
|
103
|
-
var conditionArr = _.cloneDeep(conditions);
|
|
104
|
-
conditionArr[index].data = data;
|
|
105
|
-
setConditions(conditionArr);
|
|
106
|
-
onConditionsCount && onConditionsCount(conditionArr.length);
|
|
107
|
-
if (props.onChange) {
|
|
108
|
-
var group = removeKeyToGroup(conditionArr);
|
|
109
|
-
props.onChange({
|
|
110
|
-
relation: relation,
|
|
111
|
-
conditions: group
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
var _onDelete = function onDelete(index) {
|
|
116
|
-
var conditionArr = _.cloneDeep(conditions);
|
|
117
|
-
conditionArr.splice(index, 1);
|
|
118
|
-
setConditions(conditionArr);
|
|
119
|
-
onConditionsCount && onConditionsCount(conditionArr.length);
|
|
120
|
-
if (props.onChange) {
|
|
121
|
-
var group = removeKeyToGroup(conditionArr);
|
|
122
|
-
props.onChange({
|
|
123
|
-
relation: relation,
|
|
124
|
-
conditions: group
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
21
|
return /*#__PURE__*/React.createElement("div", {
|
|
129
22
|
className: classPrefix
|
|
130
23
|
}, /*#__PURE__*/React.createElement(Skeleton, {
|
|
131
|
-
loading:
|
|
24
|
+
loading: loading,
|
|
132
25
|
active: true,
|
|
133
26
|
paragraph: {
|
|
134
27
|
rows: 2
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
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."); }
|
|
3
|
-
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
|
-
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; }
|
|
5
|
-
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; } }
|
|
6
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import React, { useEffect, useState } from 'react';
|
|
1
|
+
import React from 'react';
|
|
8
2
|
import BizAttributeSelector from '../attributeSelector';
|
|
9
3
|
import { PropCategory } from '../attributeSelector/types';
|
|
10
4
|
import './styles/index.less';
|
|
11
5
|
import BizOperateList from './components/operateList';
|
|
12
6
|
import ValuesList from './components/valuesList';
|
|
13
7
|
import { Skeleton } from 'antd';
|
|
8
|
+
import useAttrCondition from '../attrCondition/useAttrCondition';
|
|
14
9
|
export var classPrefix = 'biz-condition-item';
|
|
15
10
|
export function getCondition(attr, operate, values) {
|
|
16
11
|
if (!attr) return;
|
|
@@ -35,9 +30,7 @@ export function getCondition(attr, operate, values) {
|
|
|
35
30
|
return responseData;
|
|
36
31
|
}
|
|
37
32
|
var BizConditionItem = function BizConditionItem(props) {
|
|
38
|
-
var
|
|
39
|
-
var defaultValue = props.defaultValue,
|
|
40
|
-
eventIdList = props.eventIdList,
|
|
33
|
+
var eventIdList = props.eventIdList,
|
|
41
34
|
enableDelete = props.enableDelete,
|
|
42
35
|
enableEventProp = props.enableEventProp,
|
|
43
36
|
enableUserProp = props.enableUserProp,
|
|
@@ -45,78 +38,19 @@ var BizConditionItem = function BizConditionItem(props) {
|
|
|
45
38
|
disableItemList = props.disableItemList,
|
|
46
39
|
border = props.border,
|
|
47
40
|
theme = props.theme;
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
attr =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
58
|
-
values = _useState6[0],
|
|
59
|
-
setValues = _useState6[1];
|
|
60
|
-
var _useState7 = useState(true),
|
|
61
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
62
|
-
ready = _useState8[0],
|
|
63
|
-
setReady = _useState8[1];
|
|
64
|
-
useEffect(function () {
|
|
65
|
-
var data = defaultValue || props.value;
|
|
66
|
-
if (data) {
|
|
67
|
-
var attrData;
|
|
68
|
-
if (data.propCategory === PropCategory.EventProp) {
|
|
69
|
-
if (data.attrId) {
|
|
70
|
-
attrData = {
|
|
71
|
-
id: data.attrId,
|
|
72
|
-
propCategory: data.propCategory,
|
|
73
|
-
type: data.type,
|
|
74
|
-
key: data.attrId,
|
|
75
|
-
label: data.label,
|
|
76
|
-
dimensionSub: data.dimensionSub || 'event_attr'
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
} else if (data.propCategory === PropCategory.UserProp || data.propCategory === PropCategory.EnvProp) {
|
|
80
|
-
if (data.attrName) {
|
|
81
|
-
var aId = data.attrId || 0;
|
|
82
|
-
attrData = {
|
|
83
|
-
id: aId,
|
|
84
|
-
name: data.attrName,
|
|
85
|
-
propCategory: data.propCategory,
|
|
86
|
-
type: data.type,
|
|
87
|
-
category: data.category,
|
|
88
|
-
key: "".concat(data.propCategory, "-").concat(data.dimensionSub || data.attrName, "-").concat(aId),
|
|
89
|
-
subtype: data.subtype,
|
|
90
|
-
dimensionSub: data.dimensionSub || data.attrName
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
setAttr(attrData);
|
|
95
|
-
}
|
|
96
|
-
setReady(false);
|
|
97
|
-
}, []);
|
|
98
|
-
var onDelete = function onDelete() {
|
|
99
|
-
if (props.onDelete) props.onDelete();
|
|
100
|
-
};
|
|
101
|
-
useEffect(function () {
|
|
102
|
-
if (props.onChange) {
|
|
103
|
-
if (!attr) return;
|
|
104
|
-
props.onChange(getCondition(attr, operate, values));
|
|
105
|
-
}
|
|
106
|
-
}, [attr, operate, values]);
|
|
107
|
-
var onChangeAttr = function onChangeAttr(attrData) {
|
|
108
|
-
setAttr(attrData);
|
|
109
|
-
};
|
|
110
|
-
var onChangeOperate = function onChangeOperate(data) {
|
|
111
|
-
setOperate(data);
|
|
112
|
-
};
|
|
113
|
-
var onChangeValues = function onChangeValues(data) {
|
|
114
|
-
setValues(data);
|
|
115
|
-
};
|
|
41
|
+
var _useAttrCondition = useAttrCondition(props),
|
|
42
|
+
loading = _useAttrCondition.loading,
|
|
43
|
+
attr = _useAttrCondition.attr,
|
|
44
|
+
operate = _useAttrCondition.operate,
|
|
45
|
+
values = _useAttrCondition.values,
|
|
46
|
+
onChangeAttr = _useAttrCondition.onChangeAttr,
|
|
47
|
+
onChangeOperate = _useAttrCondition.onChangeOperate,
|
|
48
|
+
onChangeValues = _useAttrCondition.onChangeValues,
|
|
49
|
+
onDelete = _useAttrCondition.onDelete;
|
|
116
50
|
return /*#__PURE__*/React.createElement("div", {
|
|
117
51
|
className: [classPrefix, border ? 'border' : ''].join(' ')
|
|
118
52
|
}, /*#__PURE__*/React.createElement(Skeleton, {
|
|
119
|
-
loading:
|
|
53
|
+
loading: loading,
|
|
120
54
|
active: true,
|
|
121
55
|
paragraph: {
|
|
122
56
|
rows: 2
|
|
@@ -113,7 +113,8 @@ var AttrListPanel = function AttrListPanel(props) {
|
|
|
113
113
|
var showList = function () {
|
|
114
114
|
var list = [];
|
|
115
115
|
optionList.map(function (group) {
|
|
116
|
-
|
|
116
|
+
var _group$children;
|
|
117
|
+
if (!((_group$children = group.children) === null || _group$children === void 0 ? void 0 : _group$children.length)) return;
|
|
117
118
|
var head = /*#__PURE__*/React.createElement(Option, {
|
|
118
119
|
group: group,
|
|
119
120
|
key: group.key
|
package/es/constants/apis.js
CHANGED
package/es/context/index.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ export interface UserInfo {
|
|
|
12
12
|
companyId: number;
|
|
13
13
|
serviceType: number;
|
|
14
14
|
companyName: string;
|
|
15
|
-
isAdmin?: boolean;
|
|
16
15
|
}
|
|
17
16
|
export interface Menu {
|
|
18
17
|
helpUrl: string;
|
|
@@ -41,9 +40,6 @@ export interface GlobalContextProps {
|
|
|
41
40
|
routes?: any;
|
|
42
41
|
envs?: Record<string, any>;
|
|
43
42
|
system?: string;
|
|
44
|
-
funPermissions?: any;
|
|
45
|
-
menusName?: any;
|
|
46
|
-
getMenuRouterByName?: (name: string) => string;
|
|
47
43
|
}
|
|
48
44
|
declare const BizGlobalDataContext: import("react").Context<GlobalContextProps>;
|
|
49
45
|
export default BizGlobalDataContext;
|
|
@@ -109,16 +109,16 @@ var DemoContent = function DemoContent(_ref3) {
|
|
|
109
109
|
}, [loadEvent, loadEnv, loadUsers, loadUserGroups]);
|
|
110
110
|
function loadUserGroup() {
|
|
111
111
|
setLoadUserGroups(true);
|
|
112
|
-
ajax('/
|
|
112
|
+
ajax('/zg/web/v2/userGroup/getAll', {
|
|
113
113
|
method: 'post',
|
|
114
|
-
|
|
114
|
+
data: {
|
|
115
115
|
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.id,
|
|
116
116
|
platform: 0,
|
|
117
117
|
includeDefault: true,
|
|
118
118
|
includeToday: true
|
|
119
119
|
}
|
|
120
120
|
}).then(function (res) {
|
|
121
|
-
setUserGroups(res.
|
|
121
|
+
setUserGroups(res.data);
|
|
122
122
|
setLoadUserGroups(false);
|
|
123
123
|
});
|
|
124
124
|
}
|
|
@@ -151,14 +151,14 @@ var DemoContent = function DemoContent(_ref3) {
|
|
|
151
151
|
}
|
|
152
152
|
function loadEnvList() {
|
|
153
153
|
setLoadEnv(true);
|
|
154
|
-
ajax('/
|
|
154
|
+
ajax('/zg/web/v2/appusergroup/getEventEnvData', {
|
|
155
155
|
method: 'post',
|
|
156
|
-
|
|
156
|
+
data: {
|
|
157
157
|
app_id: currentApp === null || currentApp === void 0 ? void 0 : currentApp.id,
|
|
158
158
|
platform: 0
|
|
159
159
|
}
|
|
160
160
|
}).then(function (res) {
|
|
161
|
-
setEnvList(res.
|
|
161
|
+
setEnvList(res.data.eventEnv);
|
|
162
162
|
setLoadEnv(false);
|
|
163
163
|
});
|
|
164
164
|
}
|
package/es/demoWrapper/index.js
CHANGED
|
@@ -36,8 +36,9 @@ var DemoWrapper = function DemoWrapper(_ref) {
|
|
|
36
36
|
getCurrentUser();
|
|
37
37
|
}, []);
|
|
38
38
|
function getCurrentUser() {
|
|
39
|
-
request('/
|
|
40
|
-
|
|
39
|
+
request('/zg/web/v2/user/getUserInfo').then(function (res) {
|
|
40
|
+
var _res$data;
|
|
41
|
+
if (res === null || (res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.ret) === '-1') setNotLogin(true);
|
|
41
42
|
}).catch(function (err) {
|
|
42
43
|
console.error('获取用户信息失败', err);
|
|
43
44
|
}).finally(function () {
|
|
@@ -42,7 +42,8 @@ var EventDemo = function EventDemo() {
|
|
|
42
42
|
showBuiltInTarget: true,
|
|
43
43
|
defaultValue: value,
|
|
44
44
|
alias: "\u522B\u540D",
|
|
45
|
-
onChange: onChange
|
|
45
|
+
onChange: onChange,
|
|
46
|
+
selectList: [24143017, 24256188, 24256187]
|
|
46
47
|
})), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("p", null, "\u5F53\u524D\u9009\u62E9\u7684\u4E8B\u4EF6\u662F\uFF1A", JSON.stringify(value))));
|
|
47
48
|
};
|
|
48
49
|
export default (function () {
|
|
@@ -108,7 +108,8 @@ var BizEventSelector = function BizEventSelector(props) {
|
|
|
108
108
|
onChange: onChange,
|
|
109
109
|
showOverview: showAllEvent,
|
|
110
110
|
showBuiltInTarget: props.showBuiltInTarget,
|
|
111
|
-
defaultSelectAble: defaultSelectAble
|
|
111
|
+
defaultSelectAble: defaultSelectAble,
|
|
112
|
+
selectList: props.selectList
|
|
112
113
|
});
|
|
113
114
|
},
|
|
114
115
|
trigger: ['click'],
|
|
@@ -31,6 +31,9 @@ var EventListPanel = function EventListPanel(props) {
|
|
|
31
31
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
32
32
|
groupList = _useState4[0],
|
|
33
33
|
setGroupList = _useState4[1];
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
console.log('groupList', groupList, props.selectList);
|
|
36
|
+
}, [groupList]);
|
|
34
37
|
var _useState5 = useState(),
|
|
35
38
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
36
39
|
currentGroup = _useState6[0],
|
|
@@ -171,6 +174,7 @@ var EventListPanel = function EventListPanel(props) {
|
|
|
171
174
|
searchValue: searchValue,
|
|
172
175
|
currentGroup: currentGroup,
|
|
173
176
|
currentValue: currentValue,
|
|
177
|
+
selectList: props.selectList,
|
|
174
178
|
onClick: onClickEvent
|
|
175
179
|
}))));
|
|
176
180
|
};
|
|
@@ -180,7 +184,8 @@ var InfiniteScrollList = function InfiniteScrollList(_ref) {
|
|
|
180
184
|
searchValue = _ref.searchValue,
|
|
181
185
|
currentGroup = _ref.currentGroup,
|
|
182
186
|
currentValue = _ref.currentValue,
|
|
183
|
-
onClick = _ref.onClick
|
|
187
|
+
onClick = _ref.onClick,
|
|
188
|
+
selectList = _ref.selectList;
|
|
184
189
|
var _useState11 = useState([]),
|
|
185
190
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
186
191
|
showList = _useState12[0],
|
|
@@ -216,11 +221,17 @@ var InfiniteScrollList = function InfiniteScrollList(_ref) {
|
|
|
216
221
|
className: "".concat(classPrefix, "-event-item-wrap"),
|
|
217
222
|
key: Math.random()
|
|
218
223
|
}, showList.map(function (e) {
|
|
219
|
-
var _currentValue$event2;
|
|
224
|
+
var _currentValue$event2, _currentValue$event3;
|
|
225
|
+
var _disable = false;
|
|
226
|
+
console.log(666, e, selectList, selectList === null || selectList === void 0 ? void 0 : selectList.indexOf(e.id));
|
|
227
|
+
if ((selectList === null || selectList === void 0 ? void 0 : selectList.indexOf(e.id)) !== -1 && (currentValue === null || currentValue === void 0 ? void 0 : (_currentValue$event2 = currentValue.event) === null || _currentValue$event2 === void 0 ? void 0 : _currentValue$event2.id) !== e.id) {
|
|
228
|
+
_disable = true;
|
|
229
|
+
}
|
|
220
230
|
return /*#__PURE__*/React.createElement(EventListOption, {
|
|
221
231
|
label: e.alias || e.name,
|
|
222
232
|
key: "".concat(currentGroup === null || currentGroup === void 0 ? void 0 : currentGroup.id, "-").concat(e.id),
|
|
223
|
-
checked: (currentValue === null || currentValue === void 0 ? void 0 : (_currentValue$
|
|
233
|
+
checked: (currentValue === null || currentValue === void 0 ? void 0 : (_currentValue$event3 = currentValue.event) === null || _currentValue$event3 === void 0 ? void 0 : _currentValue$event3.id) === e.id,
|
|
234
|
+
disable: _disable,
|
|
224
235
|
highlight: {
|
|
225
236
|
enable: true,
|
|
226
237
|
text: searchValue
|
|
@@ -10,8 +10,10 @@ var EventListOption = function EventListOption(props) {
|
|
|
10
10
|
checked = props.checked,
|
|
11
11
|
highlight = props.highlight,
|
|
12
12
|
onClick = props.onClick,
|
|
13
|
-
data = props.data
|
|
13
|
+
data = props.data,
|
|
14
|
+
disable = props.disable;
|
|
14
15
|
var _onClick = function _onClick() {
|
|
16
|
+
if (disable) return;
|
|
15
17
|
if (onClick) onClick(data);
|
|
16
18
|
};
|
|
17
19
|
function getLabel(label) {
|
|
@@ -28,7 +30,7 @@ var EventListOption = function EventListOption(props) {
|
|
|
28
30
|
});
|
|
29
31
|
}
|
|
30
32
|
return /*#__PURE__*/React.createElement("div", {
|
|
31
|
-
className: "".concat(classPrefix, "-option ").concat(checked ? 'active' : ''),
|
|
33
|
+
className: "".concat(classPrefix, "-option ").concat(checked ? 'active' : '', " ").concat(disable ? 'disable' : ''),
|
|
32
34
|
onClick: _onClick
|
|
33
35
|
}, /*#__PURE__*/React.createElement("div", {
|
|
34
36
|
className: "".concat(classPrefix, "-option-label"),
|
|
@@ -30,6 +30,7 @@ export declare namespace EventSelectTypes {
|
|
|
30
30
|
size?: SizeType;
|
|
31
31
|
destroyPopupOnHide?: boolean;
|
|
32
32
|
onChange?: (val: Value) => void;
|
|
33
|
+
selectList?: number[];
|
|
33
34
|
}
|
|
34
35
|
interface DropdownProps {
|
|
35
36
|
value?: Value;
|
|
@@ -37,5 +38,6 @@ export declare namespace EventSelectTypes {
|
|
|
37
38
|
showBuiltInTarget?: boolean;
|
|
38
39
|
defaultSelectAble?: boolean;
|
|
39
40
|
onChange?: (value: Value, isOverview?: boolean) => void;
|
|
41
|
+
selectList?: number[];
|
|
40
42
|
}
|
|
41
43
|
}
|
package/es/index.d.ts
CHANGED
|
@@ -30,7 +30,9 @@ import BizDetailLayout from './layout/detail';
|
|
|
30
30
|
import BizLoginForm from './loginForm';
|
|
31
31
|
import DemoWrapper from './demoWrapper';
|
|
32
32
|
import SocketClient from './socket';
|
|
33
|
-
|
|
33
|
+
import BizAttrCondition from './attrCondition';
|
|
34
|
+
import BizAttrConditionGroup from './attrCondition/group';
|
|
35
|
+
export { BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizDetailLayout, BizUserGroup, IconFont, ColorIcon, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetCondition, BizDatePicker, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig, };
|
|
34
36
|
export type { UserGroupTypes } from './userGroup/types';
|
|
35
37
|
export type { BizSelectTypes } from './select/types';
|
|
36
38
|
export type { AttributeSelect } from './attributeSelector/types';
|
package/es/index.js
CHANGED
|
@@ -29,4 +29,6 @@ import BizDetailLayout from './layout/detail';
|
|
|
29
29
|
import BizLoginForm from './loginForm';
|
|
30
30
|
import DemoWrapper from './demoWrapper';
|
|
31
31
|
import SocketClient from './socket';
|
|
32
|
-
|
|
32
|
+
import BizAttrCondition from './attrCondition';
|
|
33
|
+
import BizAttrConditionGroup from './attrCondition/group';
|
|
34
|
+
export { BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizDetailLayout, BizUserGroup, IconFont, ColorIcon, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetCondition, BizDatePicker, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig };
|
package/es/utils/ajax.js
CHANGED
|
@@ -63,10 +63,8 @@ export function responseErrorHandler(url, apiResult, errorTitle, notifyType) {
|
|
|
63
63
|
flag = true;
|
|
64
64
|
} else if (new RegExp("".concat(ResponseStatus.notLogin)).test(apiResult.code)) {
|
|
65
65
|
message = '账户未登录或登录已失效';
|
|
66
|
-
window.location.href = '/webapp/app/login?destination=' + window.location.href;
|
|
67
66
|
} else if (new RegExp("".concat(ResponseStatus.noPermission)).test(apiResult.code)) {
|
|
68
|
-
|
|
69
|
-
throw new Error(apiResult.msg);
|
|
67
|
+
message = '账户没有权限';
|
|
70
68
|
}
|
|
71
69
|
if (!flag) {
|
|
72
70
|
message = apiResult.msg || message;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.1.41-
|
|
3
|
+
"version": "1.1.41-attribution.3",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"react": "^16.12.0 || ^17.0.0",
|
|
60
60
|
"yorkie": "^2.0.0"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "3887d8decfcf38b3702580350f5b54bb4a96ef68"
|
|
63
63
|
}
|