@zgfe/business-lib 1.1.12 → 1.1.13-y.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/attrConditions/demo/index.js +2 -0
- package/es/attrConditions/index.js +3 -1
- package/es/attrConditions/types.d.ts +2 -1
- package/es/attributeSelector/demo/index.js +3 -2
- package/es/attributeSelector/index.js +38 -7
- package/es/attributeSelector/listPanel.js +42 -1
- package/es/attributeSelector/types.d.ts +5 -4
- package/es/userCondition/types.d.ts +1 -1
- package/package.json +2 -2
|
@@ -47,6 +47,8 @@ export default (function () {
|
|
|
47
47
|
name: "condition"
|
|
48
48
|
}, /*#__PURE__*/React.createElement(BizConditionItem, {
|
|
49
49
|
enableEventProp: true,
|
|
50
|
+
showCommonAttr: true,
|
|
51
|
+
eventIdList: [3767, 3768],
|
|
50
52
|
disableItemList: [{
|
|
51
53
|
name: 'is_anonymous',
|
|
52
54
|
propCategory: 'userProp'
|
|
@@ -30,7 +30,8 @@ var BizConditionItem = function BizConditionItem(props) {
|
|
|
30
30
|
enableEnvProp = props.enableEnvProp,
|
|
31
31
|
disableItemList = props.disableItemList,
|
|
32
32
|
border = props.border,
|
|
33
|
-
theme = props.theme
|
|
33
|
+
theme = props.theme,
|
|
34
|
+
showCommonAttr = props.showCommonAttr;
|
|
34
35
|
|
|
35
36
|
var _useState = useState(),
|
|
36
37
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -145,6 +146,7 @@ var BizConditionItem = function BizConditionItem(props) {
|
|
|
145
146
|
}, /*#__PURE__*/React.createElement(BizAttributeSelector, {
|
|
146
147
|
value: attr,
|
|
147
148
|
eventIdList: eventIdList,
|
|
149
|
+
showCommonAttr: showCommonAttr,
|
|
148
150
|
enableDelete: enableDelete,
|
|
149
151
|
enableEventProp: enableEventProp,
|
|
150
152
|
enableUserProp: enableUserProp,
|
|
@@ -11,7 +11,7 @@ interface BasicAttrTypes {
|
|
|
11
11
|
export declare namespace AttrConditionTypes {
|
|
12
12
|
interface ItemValue {
|
|
13
13
|
subtype?: number;
|
|
14
|
-
attrId?: number;
|
|
14
|
+
attrId?: number | string;
|
|
15
15
|
attrName?: string;
|
|
16
16
|
label?: string;
|
|
17
17
|
type?: PropType;
|
|
@@ -32,6 +32,7 @@ export declare namespace AttrConditionTypes {
|
|
|
32
32
|
onDelete?: (value?: ItemValue) => void;
|
|
33
33
|
border?: boolean;
|
|
34
34
|
destroyPopupOnHide?: boolean;
|
|
35
|
+
showCommonAttr?: boolean;
|
|
35
36
|
}
|
|
36
37
|
interface GroupProp extends BasicAttrTypes {
|
|
37
38
|
defaultValue?: GroupValue;
|
|
@@ -19,7 +19,7 @@ import userData from './userData.js';
|
|
|
19
19
|
import convertAttributeData from '../util';
|
|
20
20
|
export default (function () {
|
|
21
21
|
var _useState = useState({
|
|
22
|
-
id:
|
|
22
|
+
id: '30183431,30183428',
|
|
23
23
|
propCategory: 'eventProp'
|
|
24
24
|
}),
|
|
25
25
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -45,7 +45,8 @@ export default (function () {
|
|
|
45
45
|
}, /*#__PURE__*/React.createElement(BizAttributeSelector, {
|
|
46
46
|
enableEventProp: true,
|
|
47
47
|
enableUserProp: true,
|
|
48
|
-
|
|
48
|
+
showCommonAttr: true,
|
|
49
|
+
eventIdList: [24143016, 24143017],
|
|
49
50
|
value: attribute,
|
|
50
51
|
onChange: onChange,
|
|
51
52
|
enableDelete: true,
|
|
@@ -4,6 +4,14 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
|
|
5
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
6
|
|
|
7
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
+
|
|
9
|
+
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."); }
|
|
10
|
+
|
|
11
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12
|
+
|
|
13
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
14
|
+
|
|
7
15
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
16
|
|
|
9
17
|
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."); }
|
|
@@ -16,18 +24,20 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
16
24
|
|
|
17
25
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
26
|
|
|
19
|
-
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
27
|
+
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
20
28
|
import './styles/index.less';
|
|
21
29
|
import { Dropdown, Tooltip } from 'antd';
|
|
22
30
|
import AttrListPanel from './listPanel';
|
|
23
31
|
import IconFont from '../icon/iconFont';
|
|
24
32
|
import { BizGlobalDataContext } from '..';
|
|
25
33
|
import SelectHandle from '../select/handle';
|
|
34
|
+
import _ from 'lodash';
|
|
26
35
|
|
|
27
36
|
var BizAttributeSelector = function BizAttributeSelector(props) {
|
|
28
37
|
var enableDelete = props.enableDelete,
|
|
29
38
|
placeholder = props.placeholder,
|
|
30
|
-
theme = props.theme
|
|
39
|
+
theme = props.theme,
|
|
40
|
+
eventIdList = props.eventIdList;
|
|
31
41
|
|
|
32
42
|
var _useState = useState(),
|
|
33
43
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -57,6 +67,17 @@ var BizAttributeSelector = function BizAttributeSelector(props) {
|
|
|
57
67
|
width = _useState8[0],
|
|
58
68
|
setWidth = _useState8[1];
|
|
59
69
|
|
|
70
|
+
var eventIdMap = useMemo(function () {
|
|
71
|
+
var eventIdMap = {};
|
|
72
|
+
var eventList = (eventGroupList || []).reduce(function (pre, group) {
|
|
73
|
+
return [].concat(_toConsumableArray(pre), _toConsumableArray(group.eventList));
|
|
74
|
+
}, []);
|
|
75
|
+
eventList.forEach(function (event) {
|
|
76
|
+
if (eventIdMap[event.id]) return;
|
|
77
|
+
eventIdMap[event.id] = event;
|
|
78
|
+
});
|
|
79
|
+
return eventIdMap;
|
|
80
|
+
}, [eventGroupList]);
|
|
60
81
|
useEffect(function () {
|
|
61
82
|
setWidth(boxRef.current.width || 284);
|
|
62
83
|
if (!props.defaultValue) return;
|
|
@@ -74,11 +95,21 @@ var BizAttributeSelector = function BizAttributeSelector(props) {
|
|
|
74
95
|
if (attr.name === param.name) res = attr;
|
|
75
96
|
});
|
|
76
97
|
} else if ((param === null || param === void 0 ? void 0 : param.propCategory) === 'eventProp') {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
98
|
+
eventIdList === null || eventIdList === void 0 ? void 0 : eventIdList.forEach(function (id) {
|
|
99
|
+
var event = eventIdMap[id];
|
|
100
|
+
if (!event) return;
|
|
101
|
+
event.attrList.forEach(function (attr) {
|
|
102
|
+
if (typeof param.id == 'string' && param.id.split(',').length > 1 && param.id.includes(attr.id.toString())) {
|
|
103
|
+
if (res) {
|
|
104
|
+
res.id += ",".concat(attr.id);
|
|
105
|
+
res.key += ",".concat(attr.key);
|
|
106
|
+
res.eventId += ",".concat(attr.eventId);
|
|
107
|
+
} else {
|
|
108
|
+
res = _.cloneDeep(attr);
|
|
109
|
+
}
|
|
110
|
+
} else if (attr.id === param.id) {
|
|
111
|
+
res = attr;
|
|
112
|
+
}
|
|
82
113
|
});
|
|
83
114
|
});
|
|
84
115
|
} else if ((param === null || param === void 0 ? void 0 : param.propCategory) === 'userProp') {
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
1
7
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
8
|
|
|
3
9
|
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."); }
|
|
@@ -33,7 +39,8 @@ var AttrListPanel = function AttrListPanel(props) {
|
|
|
33
39
|
enableEnvProp = props.enableEnvProp,
|
|
34
40
|
enableEventProp = props.enableEventProp,
|
|
35
41
|
enableUserProp = props.enableUserProp,
|
|
36
|
-
eventIdList = props.eventIdList
|
|
42
|
+
eventIdList = props.eventIdList,
|
|
43
|
+
showCommonAttr = props.showCommonAttr;
|
|
37
44
|
|
|
38
45
|
var _useState = useState(''),
|
|
39
46
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -89,9 +96,34 @@ var AttrListPanel = function AttrListPanel(props) {
|
|
|
89
96
|
|
|
90
97
|
if (enableEventProp) {
|
|
91
98
|
var hasAnchor = false;
|
|
99
|
+
var eventShareAttrObj = {};
|
|
100
|
+
var eventShareAttrList = [];
|
|
92
101
|
eventIdList === null || eventIdList === void 0 ? void 0 : eventIdList.forEach(function (id) {
|
|
93
102
|
var event = eventIdMap[id];
|
|
94
103
|
if (!event) return;
|
|
104
|
+
event.attrList.forEach(function (item) {
|
|
105
|
+
if (eventShareAttrObj[item.label]) {
|
|
106
|
+
var itemData = eventShareAttrObj[item.label];
|
|
107
|
+
itemData.frequency = itemData.frequency + 1;
|
|
108
|
+
itemData.id += ",".concat(item.id);
|
|
109
|
+
itemData.eventId += ",".concat(item.eventId);
|
|
110
|
+
itemData.key += ",".concat(item.key);
|
|
111
|
+
} else {
|
|
112
|
+
eventShareAttrObj[item.label] = _objectSpread(_objectSpread({}, item), {}, {
|
|
113
|
+
frequency: 1
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
if (Object.keys(eventShareAttrObj).length > 0) {
|
|
119
|
+
for (var key in eventShareAttrObj) {
|
|
120
|
+
if (eventShareAttrObj[key].frequency > 1) {
|
|
121
|
+
delete eventShareAttrObj[key].frequency;
|
|
122
|
+
eventShareAttrList.push(eventShareAttrObj[key]);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
95
127
|
var group = {
|
|
96
128
|
isEvent: true,
|
|
97
129
|
groupName: event.alias || event.name,
|
|
@@ -101,6 +133,15 @@ var AttrListPanel = function AttrListPanel(props) {
|
|
|
101
133
|
};
|
|
102
134
|
list.push(group);
|
|
103
135
|
});
|
|
136
|
+
|
|
137
|
+
if (eventShareAttrList.length > 0 && showCommonAttr) {
|
|
138
|
+
list.unshift({
|
|
139
|
+
groupName: '事件共有属性',
|
|
140
|
+
anchor: hasAnchor ? String(Math.random()) : anchor.event,
|
|
141
|
+
key: "event-".concat(Math.random()),
|
|
142
|
+
children: eventShareAttrList.slice()
|
|
143
|
+
});
|
|
144
|
+
}
|
|
104
145
|
}
|
|
105
146
|
|
|
106
147
|
if (enableUserProp) {
|
|
@@ -31,7 +31,7 @@ export interface EventGroup {
|
|
|
31
31
|
eventList: AnalysisEvent[];
|
|
32
32
|
}
|
|
33
33
|
export interface BasicProp {
|
|
34
|
-
id: number;
|
|
34
|
+
id: number | string;
|
|
35
35
|
label?: string;
|
|
36
36
|
alias?: string;
|
|
37
37
|
type?: PropType;
|
|
@@ -53,9 +53,9 @@ export interface EnvProp extends BasicProp {
|
|
|
53
53
|
key?: string;
|
|
54
54
|
}
|
|
55
55
|
export interface EventProp extends BasicProp {
|
|
56
|
-
eventId?: number;
|
|
56
|
+
eventId?: number | string;
|
|
57
57
|
propCategory: 'eventProp';
|
|
58
|
-
key?: number;
|
|
58
|
+
key?: number | string;
|
|
59
59
|
}
|
|
60
60
|
export interface PropGroups {
|
|
61
61
|
eventGroupList?: EventGroup[];
|
|
@@ -82,10 +82,11 @@ export declare namespace AttributeSelect {
|
|
|
82
82
|
theme?: string;
|
|
83
83
|
destroyPopupOnHide?: boolean;
|
|
84
84
|
size?: SizeType;
|
|
85
|
+
showCommonAttr?: boolean;
|
|
85
86
|
}
|
|
86
87
|
interface Option {
|
|
87
88
|
groupName: string;
|
|
88
|
-
isEvent
|
|
89
|
+
isEvent?: boolean;
|
|
89
90
|
key: string;
|
|
90
91
|
anchor: string;
|
|
91
92
|
children: Value[];
|
|
@@ -63,7 +63,7 @@ export declare namespace BizUserConditionT {
|
|
|
63
63
|
}[];
|
|
64
64
|
}
|
|
65
65
|
interface AttrCondition {
|
|
66
|
-
attrId: number;
|
|
66
|
+
attrId: number | string;
|
|
67
67
|
attrName: string;
|
|
68
68
|
operator: 'is not null' | 'is null' | 'not contains' | 'contains' | 'equal' | 'not equal' | 'begin with' | 'not begin with' | 'end with' | 'not end with' | Unpacked<RunTimesI, 'operator'>;
|
|
69
69
|
params: string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.13-y.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.12.0 || ^17.0.0",
|
|
61
61
|
"yorkie": "^2.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "0b36177aafd37255bd885d2958c92bf3138afed5"
|
|
64
64
|
}
|