@zgfe/business-lib 1.2.3-heyh.1 → 1.2.3-session.0
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/attrCondition/demo/group.js +28 -9
- package/es/attrCondition/demo/index.js +20 -0
- package/es/attrCondition/group.js +3 -1
- package/es/attrCondition/index.js +2 -1
- package/es/attrCondition/useAttrCondition.js +11 -0
- package/es/attrConditions/components/valuesList.js +3 -3
- package/es/attrConditions/group.js +3 -1
- package/es/attrConditions/index.js +7 -1
- package/es/attrConditions/types.d.ts +3 -2
- package/es/attributeSelector/demo/extra.d.ts +4 -0
- package/es/attributeSelector/demo/extra.js +80 -0
- package/es/attributeSelector/index.js +13 -3
- package/es/attributeSelector/listPanel.js +70 -24
- package/es/attributeSelector/styles/index.less +1 -0
- package/es/attributeSelector/types.d.ts +16 -3
- package/es/attributeSelector/types.js +1 -0
- package/es/eventSelector/demo/index.js +1 -2
- package/es/eventSelector/listPanel.js +31 -53
- package/es/select/demo/index.js +2 -1
- package/es/select/handle.js +6 -4
- package/es/select/index.js +1 -0
- package/es/select/types.d.ts +2 -0
- package/package.json +2 -2
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
import React, { useRef } from 'react';
|
|
2
2
|
import { BizAttrConditionGroup, DemoWrapper } from '@zgfe/business-lib';
|
|
3
3
|
import { Button } from 'antd';
|
|
4
|
+
var extraList = [{
|
|
5
|
+
type: 'sessionProp',
|
|
6
|
+
name: 'Session属性',
|
|
7
|
+
attrList: [{
|
|
8
|
+
id: 'sa_duration',
|
|
9
|
+
label: 'Session时长',
|
|
10
|
+
propCategory: 'extraProp',
|
|
11
|
+
key: 'extraProp-sa_duration',
|
|
12
|
+
type: 2,
|
|
13
|
+
subtype: 2
|
|
14
|
+
}, {
|
|
15
|
+
id: 'se_duration',
|
|
16
|
+
label: '事件使用时长',
|
|
17
|
+
propCategory: 'extraProp',
|
|
18
|
+
key: 'extraProp-se_duration',
|
|
19
|
+
type: 2,
|
|
20
|
+
subtype: 2
|
|
21
|
+
}]
|
|
22
|
+
}];
|
|
4
23
|
export default (function () {
|
|
5
24
|
var groupRef = useRef(null);
|
|
6
25
|
var filter = {
|
|
@@ -15,15 +34,14 @@ export default (function () {
|
|
|
15
34
|
operator: 'equal',
|
|
16
35
|
attrName: 'is_anonymous'
|
|
17
36
|
}, {
|
|
18
|
-
attrId:
|
|
19
|
-
propCategory: '
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
attrName: 'last_visit_time'
|
|
37
|
+
attrId: 'sa_duration',
|
|
38
|
+
propCategory: 'extraProp',
|
|
39
|
+
type: 2,
|
|
40
|
+
operator: 'gt',
|
|
41
|
+
values: ['158400', '1'],
|
|
42
|
+
label: 'Session时长',
|
|
43
|
+
attrName: 'Session时长',
|
|
44
|
+
subtype: 2
|
|
27
45
|
}],
|
|
28
46
|
relation: 'and'
|
|
29
47
|
};
|
|
@@ -38,6 +56,7 @@ export default (function () {
|
|
|
38
56
|
}, /*#__PURE__*/React.createElement(BizAttrConditionGroup, {
|
|
39
57
|
value: filter,
|
|
40
58
|
ref: groupRef,
|
|
59
|
+
extra: extraList,
|
|
41
60
|
enableDelete: true
|
|
42
61
|
}), /*#__PURE__*/React.createElement("div", {
|
|
43
62
|
style: {
|
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BizAttrCondition, DemoWrapper } from '@zgfe/business-lib';
|
|
3
|
+
var extraList = [{
|
|
4
|
+
type: 'sessionProp',
|
|
5
|
+
name: 'Session属性',
|
|
6
|
+
attrList: [{
|
|
7
|
+
id: 'sa_duration',
|
|
8
|
+
label: 'Session时长',
|
|
9
|
+
propCategory: 'extraProp',
|
|
10
|
+
key: 'extraProp-sa_duration',
|
|
11
|
+
type: 2,
|
|
12
|
+
subtype: 2
|
|
13
|
+
}, {
|
|
14
|
+
id: 'se_duration',
|
|
15
|
+
label: '事件使用时长',
|
|
16
|
+
propCategory: 'extraProp',
|
|
17
|
+
key: 'extraProp-se_duration',
|
|
18
|
+
type: 2,
|
|
19
|
+
subtype: 2
|
|
20
|
+
}]
|
|
21
|
+
}];
|
|
3
22
|
export default (function () {
|
|
4
23
|
return /*#__PURE__*/React.createElement(DemoWrapper, {
|
|
5
24
|
needMeta: true
|
|
@@ -9,6 +28,7 @@ export default (function () {
|
|
|
9
28
|
background: '#fff'
|
|
10
29
|
}
|
|
11
30
|
}, /*#__PURE__*/React.createElement(BizAttrCondition, {
|
|
31
|
+
extra: extraList,
|
|
12
32
|
onChange: function onChange(condition) {
|
|
13
33
|
console.log(condition);
|
|
14
34
|
}
|
|
@@ -9,7 +9,8 @@ var BizAttrConditionGroup = /*#__PURE__*/React.forwardRef(function (props, ref)
|
|
|
9
9
|
enableEventProp = props.enableEventProp,
|
|
10
10
|
enableUserProp = props.enableUserProp,
|
|
11
11
|
enableEnvProp = props.enableEnvProp,
|
|
12
|
-
disableItemList = props.disableItemList
|
|
12
|
+
disableItemList = props.disableItemList,
|
|
13
|
+
extra = props.extra;
|
|
13
14
|
var _useConditionGroup = useConditionGroup(props, ref),
|
|
14
15
|
loading = _useConditionGroup.loading,
|
|
15
16
|
conditions = _useConditionGroup.conditions,
|
|
@@ -52,6 +53,7 @@ var BizAttrConditionGroup = /*#__PURE__*/React.forwardRef(function (props, ref)
|
|
|
52
53
|
enableUserProp: enableUserProp,
|
|
53
54
|
enableEnvProp: enableEnvProp,
|
|
54
55
|
disableItemList: disableItemList,
|
|
56
|
+
extra: extra,
|
|
55
57
|
onChange: function onChange(data) {
|
|
56
58
|
return _onChange(data, index);
|
|
57
59
|
},
|
|
@@ -65,7 +65,8 @@ var BizAttrCondition = function BizAttrCondition(props) {
|
|
|
65
65
|
theme: theme,
|
|
66
66
|
destroyPopupOnHide: props.destroyPopupOnHide,
|
|
67
67
|
placeholder: "\u8BF7\u9009\u62E9\u5C5E\u6027",
|
|
68
|
-
status: isAttrError ? 'error' : ''
|
|
68
|
+
status: isAttrError ? 'error' : '',
|
|
69
|
+
extra: props.extra
|
|
69
70
|
}), isAttrError ? /*#__PURE__*/React.createElement("div", {
|
|
70
71
|
className: "".concat(classPrefix, "-error")
|
|
71
72
|
}, "\u5C5E\u6027\u4E0D\u53EF\u4E3A\u7A7A") : null), /*#__PURE__*/React.createElement(BizOperateList, {
|
|
@@ -55,6 +55,17 @@ var useAttrCondition = function useAttrCondition(props) {
|
|
|
55
55
|
dimensionSub: data.dimensionSub || data.attrName
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
+
} else if (data.propCategory === PropCategory.ExtraProp) {
|
|
59
|
+
if (data.attrId) {
|
|
60
|
+
attrData = {
|
|
61
|
+
id: data.attrId,
|
|
62
|
+
propCategory: data.propCategory,
|
|
63
|
+
type: data.type,
|
|
64
|
+
key: "".concat(data.propCategory, "-").concat(data.attrId),
|
|
65
|
+
label: data.attrNameStr || data.label,
|
|
66
|
+
subtype: data.subtype
|
|
67
|
+
};
|
|
68
|
+
}
|
|
58
69
|
}
|
|
59
70
|
setAttr(attrData);
|
|
60
71
|
}
|
|
@@ -37,7 +37,7 @@ var ValuesList = function ValuesList(props) {
|
|
|
37
37
|
setIsFirst = _useState6[1];
|
|
38
38
|
useEffect(function () {
|
|
39
39
|
if (defaultValue) {
|
|
40
|
-
if ((attr === null || attr === void 0 ? void 0 : attr.propCategory) ===
|
|
40
|
+
if (((attr === null || attr === void 0 ? void 0 : attr.propCategory) === PropCategory.UserProp || (attr === null || attr === void 0 ? void 0 : attr.propCategory) === PropCategory.ExtraProp) && (attr === null || attr === void 0 ? void 0 : attr.subtype) === 2) {
|
|
41
41
|
var num = String(parseFloat(defaultValue[0]) / getUnitCount(defaultValue[1]));
|
|
42
42
|
setCurrent([num, defaultValue[1]]);
|
|
43
43
|
} else {
|
|
@@ -72,7 +72,7 @@ var ValuesList = function ValuesList(props) {
|
|
|
72
72
|
};
|
|
73
73
|
var onChangeNumber = function onChangeNumber(e) {
|
|
74
74
|
var data = [e.target.value];
|
|
75
|
-
if ((attr === null || attr === void 0 ? void 0 : attr.propCategory) === PropCategory.UserProp && (attr === null || attr === void 0 ? void 0 : attr.subtype) === 2) {
|
|
75
|
+
if (((attr === null || attr === void 0 ? void 0 : attr.propCategory) === PropCategory.UserProp || (attr === null || attr === void 0 ? void 0 : attr.propCategory) === PropCategory.ExtraProp) && (attr === null || attr === void 0 ? void 0 : attr.subtype) === 2) {
|
|
76
76
|
var num = String(parseFloat(e.target.value) * getUnitCount(unit));
|
|
77
77
|
data = [num, unit];
|
|
78
78
|
setCurrent([e.target.value, unit]);
|
|
@@ -144,7 +144,7 @@ var ValuesList = function ValuesList(props) {
|
|
|
144
144
|
status: status,
|
|
145
145
|
onChange: onChangeNumber,
|
|
146
146
|
suffix: attr.propCategory === 'userProp' && attr.subtype === 1 ? '%' : null
|
|
147
|
-
}), attr.propCategory ===
|
|
147
|
+
}), (attr.propCategory === PropCategory.UserProp || attr.propCategory === PropCategory.ExtraProp) && attr.subtype === 2 && numberAfter);
|
|
148
148
|
} else {
|
|
149
149
|
if (operate === OperateTypes.Absolute) {
|
|
150
150
|
return /*#__PURE__*/React.createElement(RangePicker, {
|
|
@@ -9,7 +9,8 @@ var BizConditionGroup = function BizConditionGroup(props, ref) {
|
|
|
9
9
|
enableEventProp = props.enableEventProp,
|
|
10
10
|
enableUserProp = props.enableUserProp,
|
|
11
11
|
enableEnvProp = props.enableEnvProp,
|
|
12
|
-
disableItemList = props.disableItemList
|
|
12
|
+
disableItemList = props.disableItemList,
|
|
13
|
+
extra = props.extra;
|
|
13
14
|
var _useConditionGroup = useConditionGroup(props, ref),
|
|
14
15
|
loading = _useConditionGroup.loading,
|
|
15
16
|
conditions = _useConditionGroup.conditions,
|
|
@@ -47,6 +48,7 @@ var BizConditionGroup = function BizConditionGroup(props, ref) {
|
|
|
47
48
|
enableUserProp: enableUserProp,
|
|
48
49
|
enableEnvProp: enableEnvProp,
|
|
49
50
|
disableItemList: disableItemList,
|
|
51
|
+
extra: extra,
|
|
50
52
|
onChange: function onChange(data) {
|
|
51
53
|
return _onChange(data, index);
|
|
52
54
|
},
|
|
@@ -20,6 +20,11 @@ export function getCondition(attr, operate, values) {
|
|
|
20
20
|
};
|
|
21
21
|
if (attr.propCategory === PropCategory.EventProp) {
|
|
22
22
|
responseData.attrName = attr.label;
|
|
23
|
+
} else if (attr.propCategory === PropCategory.ExtraProp) {
|
|
24
|
+
responseData.attrName = attr.label;
|
|
25
|
+
if (attr.propCategory === PropCategory.ExtraProp && attr.subtype) {
|
|
26
|
+
responseData.subtype = attr.subtype;
|
|
27
|
+
}
|
|
23
28
|
} else {
|
|
24
29
|
responseData.attrName = attr.name;
|
|
25
30
|
responseData.category = attr.category;
|
|
@@ -68,7 +73,8 @@ var BizConditionItem = function BizConditionItem(props) {
|
|
|
68
73
|
return _onDelete(e);
|
|
69
74
|
},
|
|
70
75
|
theme: theme,
|
|
71
|
-
destroyPopupOnHide: props.destroyPopupOnHide
|
|
76
|
+
destroyPopupOnHide: props.destroyPopupOnHide,
|
|
77
|
+
extra: props.extra
|
|
72
78
|
}), /*#__PURE__*/React.createElement("div", {
|
|
73
79
|
className: "".concat(classPrefix, "-panel")
|
|
74
80
|
}, /*#__PURE__*/React.createElement(BizOperateList, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EnvProp, EventProp, PropType, UserProp } from '../attributeSelector/types';
|
|
1
|
+
import { AttributeSelect, EnvProp, EventProp, PropType, UserProp } from '../attributeSelector/types';
|
|
2
2
|
import { BizSelectTypes } from '../select/types';
|
|
3
3
|
interface BasicAttrTypes {
|
|
4
4
|
eventIdList?: number[];
|
|
@@ -8,6 +8,7 @@ interface BasicAttrTypes {
|
|
|
8
8
|
enableEnvProp?: boolean;
|
|
9
9
|
disableItemList?: (EventProp | UserProp | EnvProp)[];
|
|
10
10
|
theme?: BizSelectTypes.Props['theme'];
|
|
11
|
+
extra?: AttributeSelect.AttributeExtra[];
|
|
11
12
|
}
|
|
12
13
|
export declare namespace AttrConditionTypes {
|
|
13
14
|
interface ItemValue {
|
|
@@ -17,7 +18,7 @@ export declare namespace AttrConditionTypes {
|
|
|
17
18
|
label?: string;
|
|
18
19
|
attrNameStr?: string;
|
|
19
20
|
type?: PropType;
|
|
20
|
-
propCategory?: 'userProp' | 'eventProp' | 'envProp';
|
|
21
|
+
propCategory?: 'userProp' | 'eventProp' | 'envProp' | 'extraProp';
|
|
21
22
|
category?: 'fixed' | 'custom';
|
|
22
23
|
dimensionSub?: string;
|
|
23
24
|
operator?: OperateTypes;
|
|
@@ -0,0 +1,80 @@
|
|
|
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 React, { useState } from 'react';
|
|
8
|
+
import { BizAttributeSelector, BizGlobalDataContext } from '@zgfe/business-lib';
|
|
9
|
+
import '@zgfe/business-lib/es/assets/styles/resetAntd.less';
|
|
10
|
+
import eventData from '../../mock/event';
|
|
11
|
+
import envData from '../../mock/env';
|
|
12
|
+
import userData from './userData.js';
|
|
13
|
+
import convertAttributeData from '../util';
|
|
14
|
+
var extraList = [{
|
|
15
|
+
type: 'sessionProp',
|
|
16
|
+
name: 'Session属性',
|
|
17
|
+
attrList: [{
|
|
18
|
+
id: 'sa_duration',
|
|
19
|
+
label: 'Session时长',
|
|
20
|
+
propCategory: 'extraProp',
|
|
21
|
+
key: 'extraProp-sa_duration'
|
|
22
|
+
}, {
|
|
23
|
+
id: 'se_duration',
|
|
24
|
+
label: '事件使用时长',
|
|
25
|
+
propCategory: 'extraProp',
|
|
26
|
+
key: 'extraProp-se_duration'
|
|
27
|
+
}]
|
|
28
|
+
}, {
|
|
29
|
+
type: 'pageProp',
|
|
30
|
+
name: '页面属性',
|
|
31
|
+
attrList: [{
|
|
32
|
+
id: 'page_duration',
|
|
33
|
+
label: '页面访问时长',
|
|
34
|
+
propCategory: 'extraProp',
|
|
35
|
+
key: 'extraProp-page_duration'
|
|
36
|
+
}, {
|
|
37
|
+
id: 'click',
|
|
38
|
+
label: '页面点击次数',
|
|
39
|
+
propCategory: 'extraProp',
|
|
40
|
+
key: 'extraProp-click'
|
|
41
|
+
}]
|
|
42
|
+
}];
|
|
43
|
+
export default (function () {
|
|
44
|
+
var _useState = useState({
|
|
45
|
+
propCategory: 'extraProp',
|
|
46
|
+
key: 'extraProp-click',
|
|
47
|
+
id: 'page_duration'
|
|
48
|
+
}),
|
|
49
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
50
|
+
attribute = _useState2[0],
|
|
51
|
+
setAttribute = _useState2[1];
|
|
52
|
+
var store = convertAttributeData({
|
|
53
|
+
eventList: eventData,
|
|
54
|
+
userPropList: userData,
|
|
55
|
+
envPropList: envData
|
|
56
|
+
});
|
|
57
|
+
function onChange(val) {
|
|
58
|
+
setAttribute(val);
|
|
59
|
+
}
|
|
60
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", null, "\u9009\u62E9\u7684\u5C5E\u6027\u662F\uFF1A", JSON.stringify(attribute)), /*#__PURE__*/React.createElement(BizGlobalDataContext.Provider, {
|
|
61
|
+
value: {
|
|
62
|
+
eventGroupList: store.eventGroupList,
|
|
63
|
+
userPropList: store.userPropList,
|
|
64
|
+
eventEnvList: store.envPropList
|
|
65
|
+
}
|
|
66
|
+
}, /*#__PURE__*/React.createElement(BizAttributeSelector, {
|
|
67
|
+
enableEventProp: true,
|
|
68
|
+
enableUserProp: true,
|
|
69
|
+
eventIdList: [24143016],
|
|
70
|
+
value: attribute,
|
|
71
|
+
onChange: onChange,
|
|
72
|
+
enableDelete: true,
|
|
73
|
+
enableEnvProp: true,
|
|
74
|
+
extra: extraList,
|
|
75
|
+
disableItemList: [{
|
|
76
|
+
id: 'click',
|
|
77
|
+
propCategory: 'extraProp'
|
|
78
|
+
}]
|
|
79
|
+
})));
|
|
80
|
+
});
|
|
@@ -21,7 +21,8 @@ import _ from 'lodash';
|
|
|
21
21
|
var BizAttributeSelector = function BizAttributeSelector(props) {
|
|
22
22
|
var enableDelete = props.enableDelete,
|
|
23
23
|
placeholder = props.placeholder,
|
|
24
|
-
theme = props.theme
|
|
24
|
+
theme = props.theme,
|
|
25
|
+
extra = props.extra;
|
|
25
26
|
var _useState = useState(),
|
|
26
27
|
_useState2 = _slicedToArray(_useState, 2),
|
|
27
28
|
currentAttr = _useState2[0],
|
|
@@ -83,6 +84,16 @@ var BizAttributeSelector = function BizAttributeSelector(props) {
|
|
|
83
84
|
if (attr.name === param.name && attr.category === param.category) res = attr;
|
|
84
85
|
}
|
|
85
86
|
});
|
|
87
|
+
} else if ((param === null || param === void 0 ? void 0 : param.propCategory) === 'extraProp') {
|
|
88
|
+
extra === null || extra === void 0 ? void 0 : extra.forEach(function (item) {
|
|
89
|
+
item.attrList.forEach(function (attr) {
|
|
90
|
+
if (hasKey) {
|
|
91
|
+
if (attr.key === param.key) res = _.cloneDeep(attr);
|
|
92
|
+
} else {
|
|
93
|
+
if (attr.id === param.id) res = _.cloneDeep(attr);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
86
97
|
}
|
|
87
98
|
return res;
|
|
88
99
|
}
|
|
@@ -112,8 +123,7 @@ var BizAttributeSelector = function BizAttributeSelector(props) {
|
|
|
112
123
|
},
|
|
113
124
|
trigger: ['click'],
|
|
114
125
|
overlayStyle: {
|
|
115
|
-
minWidth: 284
|
|
116
|
-
width: width
|
|
126
|
+
minWidth: width < 284 ? 284 : width > 520 ? 520 : width
|
|
117
127
|
},
|
|
118
128
|
open: visible,
|
|
119
129
|
onOpenChange: onVisibleChange,
|
|
@@ -22,7 +22,8 @@ var AttrListPanel = function AttrListPanel(props) {
|
|
|
22
22
|
enableEventProp = props.enableEventProp,
|
|
23
23
|
enableUserProp = props.enableUserProp,
|
|
24
24
|
eventIdList = props.eventIdList,
|
|
25
|
-
funnelEventIdList = props.funnelEventIdList
|
|
25
|
+
funnelEventIdList = props.funnelEventIdList,
|
|
26
|
+
extra = props.extra;
|
|
26
27
|
var _useState = useState(''),
|
|
27
28
|
_useState2 = _slicedToArray(_useState, 2),
|
|
28
29
|
searchValue = _useState2[0],
|
|
@@ -57,18 +58,71 @@ var AttrListPanel = function AttrListPanel(props) {
|
|
|
57
58
|
item.key = "eventProp-".concat(item.id);
|
|
58
59
|
} else if (item.propCategory === 'userProp') {
|
|
59
60
|
item.key = "userProp-".concat(item.name);
|
|
61
|
+
} else if (item.propCategory === 'extraProp') {
|
|
62
|
+
item.key = "extraProp-".concat(item.id);
|
|
60
63
|
}
|
|
61
64
|
return item;
|
|
62
65
|
});
|
|
63
|
-
var
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
var _useState7 = useState({
|
|
67
|
+
container: "container-".concat(id)
|
|
68
|
+
}),
|
|
69
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
70
|
+
anchor = _useState8[0],
|
|
71
|
+
stAnchor = _useState8[1];
|
|
72
|
+
var _useState9 = useState([]),
|
|
73
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
74
|
+
anchorList = _useState10[0],
|
|
75
|
+
setAnchorList = _useState10[1];
|
|
76
|
+
useEffect(function () {
|
|
77
|
+
var data = {
|
|
78
|
+
container: "container-".concat(id),
|
|
79
|
+
event: "event".concat(id),
|
|
80
|
+
user: "user".concat(id),
|
|
81
|
+
env: "env".concat(id)
|
|
82
|
+
};
|
|
83
|
+
var list = [];
|
|
84
|
+
extra === null || extra === void 0 ? void 0 : extra.forEach(function (item) {
|
|
85
|
+
data[item.type] = "".concat(item.type).concat(id);
|
|
86
|
+
list.push({
|
|
87
|
+
id: "".concat(item.type).concat(id),
|
|
88
|
+
name: item.name
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
stAnchor(data);
|
|
92
|
+
if (enableEventProp) {
|
|
93
|
+
list.push({
|
|
94
|
+
id: data.event,
|
|
95
|
+
name: '事件属性'
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
if (enableUserProp) {
|
|
99
|
+
list.push({
|
|
100
|
+
id: data.user,
|
|
101
|
+
name: '用户属性'
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (enableEnvProp) {
|
|
105
|
+
list.push({
|
|
106
|
+
id: data.env,
|
|
107
|
+
name: '触发环境'
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
setAnchorList(list);
|
|
111
|
+
}, [id]);
|
|
69
112
|
var classPrefix = 'biz-attr-select';
|
|
70
113
|
useEffect(function () {
|
|
71
114
|
var list = [];
|
|
115
|
+
if (extra) {
|
|
116
|
+
extra.forEach(function (item) {
|
|
117
|
+
list.push({
|
|
118
|
+
isEvent: false,
|
|
119
|
+
groupName: item.name,
|
|
120
|
+
key: item.type,
|
|
121
|
+
anchor: anchor[item.type],
|
|
122
|
+
children: item.attrList
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
}
|
|
72
126
|
if (enableEventProp) {
|
|
73
127
|
if (props.showCommonProp) {
|
|
74
128
|
var group = {
|
|
@@ -145,7 +199,7 @@ var AttrListPanel = function AttrListPanel(props) {
|
|
|
145
199
|
});
|
|
146
200
|
}
|
|
147
201
|
setOptionList(list);
|
|
148
|
-
}, [eventIdMap, userPropList, eventEnvList, eventIdList, props.showCommonProp]);
|
|
202
|
+
}, [anchor, eventIdMap, userPropList, eventEnvList, eventIdList, props.showCommonProp]);
|
|
149
203
|
useEffect(function () {
|
|
150
204
|
setCurrentAttr(props.value);
|
|
151
205
|
}, [props.value]);
|
|
@@ -210,22 +264,14 @@ var AttrListPanel = function AttrListPanel(props) {
|
|
|
210
264
|
getContainer: function getContainer() {
|
|
211
265
|
return document.getElementById(anchor.container);
|
|
212
266
|
}
|
|
213
|
-
},
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
size: "small"
|
|
222
|
-
}, "\u7528\u6237\u5C5E\u6027")
|
|
223
|
-
}), enableEnvProp && /*#__PURE__*/React.createElement(Link, {
|
|
224
|
-
"data-type": 'event',
|
|
225
|
-
href: "#".concat(anchor.env),
|
|
226
|
-
title: /*#__PURE__*/React.createElement(Button, {
|
|
227
|
-
size: "small"
|
|
228
|
-
}, "\u89E6\u53D1\u73AF\u5883")
|
|
267
|
+
}, anchorList.map(function (item) {
|
|
268
|
+
return /*#__PURE__*/React.createElement(Link, {
|
|
269
|
+
key: item.id,
|
|
270
|
+
href: "#".concat(item.id),
|
|
271
|
+
title: /*#__PURE__*/React.createElement(Button, {
|
|
272
|
+
size: "small"
|
|
273
|
+
}, item.name)
|
|
274
|
+
});
|
|
229
275
|
}))) : null, /*#__PURE__*/React.createElement("div", {
|
|
230
276
|
id: anchor.container,
|
|
231
277
|
className: "".concat(classPrefix, "-container")
|
|
@@ -8,7 +8,8 @@ export declare enum PropType {
|
|
|
8
8
|
export declare enum PropCategory {
|
|
9
9
|
EventProp = "eventProp",
|
|
10
10
|
UserProp = "userProp",
|
|
11
|
-
EnvProp = "envProp"
|
|
11
|
+
EnvProp = "envProp",
|
|
12
|
+
ExtraProp = "extraProp"
|
|
12
13
|
}
|
|
13
14
|
export declare enum ShowStatus {
|
|
14
15
|
show = 0,
|
|
@@ -71,12 +72,12 @@ export interface PropGroups {
|
|
|
71
72
|
eventIdMap?: Record<number, AnalysisEvent>;
|
|
72
73
|
}
|
|
73
74
|
export declare namespace AttributeSelect {
|
|
74
|
-
type Value = EventProp | UserProp | EnvProp | null;
|
|
75
|
+
type Value = EventProp | UserProp | EnvProp | ExtraProp | null;
|
|
75
76
|
interface Props {
|
|
76
77
|
id?: string;
|
|
77
78
|
value?: Value;
|
|
78
79
|
defaultValue?: Value;
|
|
79
|
-
disableItemList?: (EventProp | UserProp | EnvProp)[];
|
|
80
|
+
disableItemList?: (EventProp | UserProp | EnvProp | ExtraProp)[];
|
|
80
81
|
enableDelete?: boolean;
|
|
81
82
|
placeholder?: string;
|
|
82
83
|
enableEventProp?: boolean;
|
|
@@ -93,6 +94,18 @@ export declare namespace AttributeSelect {
|
|
|
93
94
|
destroyPopupOnHide?: boolean;
|
|
94
95
|
size?: SizeType;
|
|
95
96
|
status?: string;
|
|
97
|
+
extra?: AttributeExtra[];
|
|
98
|
+
}
|
|
99
|
+
interface AttributeExtra {
|
|
100
|
+
type: string;
|
|
101
|
+
name: string;
|
|
102
|
+
attrList: ExtraProp[];
|
|
103
|
+
}
|
|
104
|
+
interface ExtraProp extends BasicProp {
|
|
105
|
+
propCategory: 'extraProp';
|
|
106
|
+
key?: number | string;
|
|
107
|
+
name?: string;
|
|
108
|
+
subtype?: number;
|
|
96
109
|
}
|
|
97
110
|
interface Option {
|
|
98
111
|
groupName: string;
|
|
@@ -9,6 +9,7 @@ export var PropCategory;
|
|
|
9
9
|
PropCategory["EventProp"] = "eventProp";
|
|
10
10
|
PropCategory["UserProp"] = "userProp";
|
|
11
11
|
PropCategory["EnvProp"] = "envProp";
|
|
12
|
+
PropCategory["ExtraProp"] = "extraProp";
|
|
12
13
|
})(PropCategory || (PropCategory = {}));
|
|
13
14
|
export var ShowStatus;
|
|
14
15
|
(function (ShowStatus) {
|
|
@@ -35,51 +35,30 @@ var EventListPanel = function EventListPanel(props) {
|
|
|
35
35
|
setSearchValue = _useState2[1];
|
|
36
36
|
var _useContext = useContext(BizGlobalDataContext),
|
|
37
37
|
eventGroupList = _useContext.eventGroupList;
|
|
38
|
-
var _useState3 = useState([]),
|
|
38
|
+
var _useState3 = useState(eventGroupList || []),
|
|
39
39
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (disableVirtualEventShow && eventGroupList) {
|
|
44
|
-
var _eventGroupList = _.cloneDeep(eventGroupList);
|
|
45
|
-
_eventGroupList && _eventGroupList.map(function (item) {
|
|
46
|
-
if (item.eventList.length > 0) {
|
|
47
|
-
item.eventList = item.eventList.filter(function (_item) {
|
|
48
|
-
return _item.owner !== 'zg_vtl';
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
setEventGroupListData(_eventGroupList);
|
|
53
|
-
setGroupList(_eventGroupList);
|
|
54
|
-
} else {
|
|
55
|
-
setEventGroupListData(eventGroupList || []);
|
|
56
|
-
setGroupList(eventGroupList || []);
|
|
57
|
-
}
|
|
58
|
-
}, [eventGroupList, disableVirtualEventShow]);
|
|
59
|
-
var _useState5 = useState([]),
|
|
40
|
+
groupList = _useState4[0],
|
|
41
|
+
setGroupList = _useState4[1];
|
|
42
|
+
var _useState5 = useState(),
|
|
60
43
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
var _useState7 = useState(),
|
|
44
|
+
currentGroup = _useState6[0],
|
|
45
|
+
setCurrentGroup = _useState6[1];
|
|
46
|
+
var _useState7 = useState([]),
|
|
64
47
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
var _useState9 = useState(
|
|
48
|
+
searchEventList = _useState8[0],
|
|
49
|
+
setSearchEventList = _useState8[1];
|
|
50
|
+
var _useState9 = useState(props.multiple ? props.value : undefined),
|
|
68
51
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
var _useState11 = useState(props.multiple ? props.value :
|
|
52
|
+
currentValue = _useState10[0],
|
|
53
|
+
setCurrentValue = _useState10[1];
|
|
54
|
+
var _useState11 = useState(props.multiple ? props.value || [] : []),
|
|
72
55
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
var _useState13 = useState(
|
|
56
|
+
checkedEventList = _useState12[0],
|
|
57
|
+
setCheckedEventList = _useState12[1];
|
|
58
|
+
var _useState13 = useState(false),
|
|
76
59
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
var _useState15 = useState(false),
|
|
80
|
-
_useState16 = _slicedToArray(_useState15, 2),
|
|
81
|
-
ready = _useState16[0],
|
|
82
|
-
setReady = _useState16[1];
|
|
60
|
+
ready = _useState14[0],
|
|
61
|
+
setReady = _useState14[1];
|
|
83
62
|
var scrollableId = 'scrollableDiv' + Math.random();
|
|
84
63
|
var overviewData = {
|
|
85
64
|
id: -100,
|
|
@@ -88,16 +67,15 @@ var EventListPanel = function EventListPanel(props) {
|
|
|
88
67
|
isOverview: true
|
|
89
68
|
};
|
|
90
69
|
useEffect(function () {
|
|
91
|
-
if (eventGroupListData.length <= 0) return;
|
|
92
70
|
var group = {
|
|
93
71
|
id: 0,
|
|
94
72
|
eventList: function () {
|
|
95
73
|
var list = [];
|
|
96
74
|
var listObj = {};
|
|
97
75
|
var markList = [];
|
|
98
|
-
|
|
76
|
+
eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.forEach(function (group) {
|
|
99
77
|
group.eventList.forEach(function (item) {
|
|
100
|
-
if (!listObj[item.id]) {
|
|
78
|
+
if (!listObj[item.id] && (disableVirtualEventShow ? item.owner !== 'zg_vtl' : true)) {
|
|
101
79
|
if (item.marked) {
|
|
102
80
|
markList.push(item);
|
|
103
81
|
} else {
|
|
@@ -122,7 +100,7 @@ var EventListPanel = function EventListPanel(props) {
|
|
|
122
100
|
result.forEach(function (group) {
|
|
123
101
|
var evtList = [];
|
|
124
102
|
group.eventList.forEach(function (event) {
|
|
125
|
-
if (disableVirtualEventShow) return;
|
|
103
|
+
if (disableVirtualEventShow && event.owner === 'zg_vtl') return;
|
|
126
104
|
if (props.filter(event)) {
|
|
127
105
|
evtList.push(event);
|
|
128
106
|
}
|
|
@@ -145,7 +123,7 @@ var EventListPanel = function EventListPanel(props) {
|
|
|
145
123
|
resultGroup = BuiltinIndicators;
|
|
146
124
|
} else {
|
|
147
125
|
var _currentGroup = group;
|
|
148
|
-
|
|
126
|
+
eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.forEach(function (eGroup) {
|
|
149
127
|
var _props$value2, _props$value2$group;
|
|
150
128
|
if (eGroup.id === ((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : (_props$value2$group = _props$value2.group) === null || _props$value2$group === void 0 ? void 0 : _props$value2$group.id)) {
|
|
151
129
|
_currentGroup = eGroup;
|
|
@@ -163,7 +141,7 @@ var EventListPanel = function EventListPanel(props) {
|
|
|
163
141
|
}
|
|
164
142
|
});
|
|
165
143
|
setReady(true);
|
|
166
|
-
}, [
|
|
144
|
+
}, []);
|
|
167
145
|
useChanged(function () {
|
|
168
146
|
if (props.multiple) {
|
|
169
147
|
setCheckedEventList(_.cloneDeep(props.value) || []);
|
|
@@ -174,7 +152,7 @@ var EventListPanel = function EventListPanel(props) {
|
|
|
174
152
|
useEffect(function () {
|
|
175
153
|
var list = [];
|
|
176
154
|
currentGroup === null || currentGroup === void 0 ? void 0 : currentGroup.eventList.forEach(function (event) {
|
|
177
|
-
if (searchValue && !new RegExp(_.escapeRegExp(searchValue), 'i').test(
|
|
155
|
+
if (searchValue && !new RegExp(_.escapeRegExp(searchValue), 'i').test(event.alias || event.name)) return;
|
|
178
156
|
list.push(event);
|
|
179
157
|
});
|
|
180
158
|
if (showOverview) list.unshift(overviewData);
|
|
@@ -293,14 +271,14 @@ export var InfiniteScrollList = function InfiniteScrollList(_ref) {
|
|
|
293
271
|
multiple = _ref.multiple,
|
|
294
272
|
maxEventCount = _ref.maxEventCount,
|
|
295
273
|
checkedIdList = _ref.checkedIdList;
|
|
274
|
+
var _useState15 = useState([]),
|
|
275
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
276
|
+
showList = _useState16[0],
|
|
277
|
+
setShowList = _useState16[1];
|
|
296
278
|
var _useState17 = useState([]),
|
|
297
279
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
var _useState19 = useState([]),
|
|
301
|
-
_useState20 = _slicedToArray(_useState19, 2),
|
|
302
|
-
canShowList = _useState20[0],
|
|
303
|
-
setCanShowList = _useState20[1];
|
|
280
|
+
canShowList = _useState18[0],
|
|
281
|
+
setCanShowList = _useState18[1];
|
|
304
282
|
useEffect(function () {
|
|
305
283
|
var data = searchEventList.filter(function (item) {
|
|
306
284
|
return item.eventHidden !== ShowStatus.hidden;
|
|
@@ -343,7 +321,7 @@ export var InfiniteScrollList = function InfiniteScrollList(_ref) {
|
|
|
343
321
|
_disable = true;
|
|
344
322
|
}
|
|
345
323
|
return /*#__PURE__*/React.createElement(EventListOption, {
|
|
346
|
-
label:
|
|
324
|
+
label: e.alias || e.name,
|
|
347
325
|
key: "".concat(groupId, "-").concat(e.id),
|
|
348
326
|
checked: multiple ? checkedIdList === null || checkedIdList === void 0 ? void 0 : checkedIdList.includes(e.id) : currentId === e.id,
|
|
349
327
|
disable: _disable,
|
package/es/select/demo/index.js
CHANGED
|
@@ -72,6 +72,7 @@ export default (function () {
|
|
|
72
72
|
theme: "secondary",
|
|
73
73
|
onChange: onChange,
|
|
74
74
|
disableItemList: disabledList,
|
|
75
|
-
dropdownExtra: /*#__PURE__*/React.createElement(Button, null, "+ \u6DFB\u52A0")
|
|
75
|
+
dropdownExtra: /*#__PURE__*/React.createElement(Button, null, "+ \u6DFB\u52A0"),
|
|
76
|
+
extraLabel: ' (别名)'
|
|
76
77
|
}), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("p", null, "\u5F53\u524D\u9009\u62E9\u7684\u503C\u662F\uFF1A", JSON.stringify(data)));
|
|
77
78
|
});
|
package/es/select/handle.js
CHANGED
|
@@ -17,7 +17,8 @@ var SelectHandle = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
17
17
|
keyField = props.keyField,
|
|
18
18
|
border = props.border,
|
|
19
19
|
showSelectIcon = props.showSelectIcon,
|
|
20
|
-
disable = props.disable
|
|
20
|
+
disable = props.disable,
|
|
21
|
+
extraLabel = props.extraLabel;
|
|
21
22
|
var classPrefix = 'biz-select-handle';
|
|
22
23
|
var _useState = useState(false),
|
|
23
24
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -145,7 +146,7 @@ var SelectHandle = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
145
146
|
return /*#__PURE__*/React.createElement("div", {
|
|
146
147
|
ref: handleRef,
|
|
147
148
|
className: "".concat(classPrefix, "-input ").concat(props.theme ? props.theme : '', "\n ").concat(props.disable ? 'disable' : '', " ").concat(focus ? 'active' : '', " \n ").concat(mergedStatus ? "".concat(classPrefix, "-status-").concat(mergedStatus) : '', "\n ").concat(border ? '' : 'borderless', " ").concat(props.size ? props.size : 'middle'),
|
|
148
|
-
title: props.label || (optionData === null || optionData === void 0 ? void 0 : optionData[aliasField || '']) || (optionData === null || optionData === void 0 ? void 0 : optionData[labelField])
|
|
149
|
+
title: "".concat(props.label || (optionData === null || optionData === void 0 ? void 0 : optionData[aliasField || '']) || (optionData === null || optionData === void 0 ? void 0 : optionData[labelField]) || '').concat(extraLabel)
|
|
149
150
|
}, /*#__PURE__*/React.createElement("span", {
|
|
150
151
|
className: "".concat(classPrefix, "-content")
|
|
151
152
|
}, /*#__PURE__*/React.createElement("span", {
|
|
@@ -154,7 +155,7 @@ var SelectHandle = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
154
155
|
className: "".concat(classPrefix, "-icon")
|
|
155
156
|
}, props.value.icon), props.children || props.label || (optionData === null || optionData === void 0 ? void 0 : optionData[aliasField || '']) || (optionData === null || optionData === void 0 ? void 0 : optionData[labelField]) || /*#__PURE__*/React.createElement("span", {
|
|
156
157
|
className: "".concat(classPrefix, "-holder")
|
|
157
|
-
}, placeholder || '请选择'))), /*#__PURE__*/React.createElement(IconFont, {
|
|
158
|
+
}, placeholder || '请选择'), extraLabel)), /*#__PURE__*/React.createElement(IconFont, {
|
|
158
159
|
className: "".concat(classPrefix, "-expand-icon").concat(props.open ? ' open' : ''),
|
|
159
160
|
type: 'xiangxia'
|
|
160
161
|
}));
|
|
@@ -163,6 +164,7 @@ SelectHandle.defaultProps = {
|
|
|
163
164
|
labelField: 'label',
|
|
164
165
|
keyField: 'id',
|
|
165
166
|
border: true,
|
|
166
|
-
showSelectIcon: true
|
|
167
|
+
showSelectIcon: true,
|
|
168
|
+
extraLabel: ''
|
|
167
169
|
};
|
|
168
170
|
export default SelectHandle;
|
package/es/select/index.js
CHANGED
package/es/select/types.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export declare namespace BizSelectTypes {
|
|
|
26
26
|
minDropdownWidth?: number;
|
|
27
27
|
options: Group[] | Option[];
|
|
28
28
|
extra?: (option: Option) => ReactNode;
|
|
29
|
+
extraLabel?: ReactNode;
|
|
29
30
|
dropdownExtra?: ReactNode;
|
|
30
31
|
enableSearch?: boolean;
|
|
31
32
|
enableCreate?: boolean;
|
|
@@ -75,6 +76,7 @@ export declare namespace BizSelectTypes {
|
|
|
75
76
|
}
|
|
76
77
|
export interface HandlerTypes {
|
|
77
78
|
label?: string;
|
|
79
|
+
extraLabel?: ReactNode;
|
|
78
80
|
children?: ReactNode;
|
|
79
81
|
placeholder?: string;
|
|
80
82
|
value?: BizSelectTypes.Option | BizSelectTypes.Option[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.2.3-
|
|
3
|
+
"version": "1.2.3-session.0",
|
|
4
4
|
"module": "es/index.js",
|
|
5
5
|
"typings": "es/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"react": "^16.12.0 || ^17.0.0",
|
|
56
56
|
"yorkie": "^2.0.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "606cac66fdf2ee6464434df5778c7873d1de4733",
|
|
59
59
|
"gitHooks": {
|
|
60
60
|
"pre-commit": "lint-staged"
|
|
61
61
|
}
|