@zgfe/business-lib 1.1.34-alpha.19 → 1.1.34-alpha.20
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/userCondition/conditionTypeList.js +10 -7
- package/es/userCondition/conditions/businessCondition.d.ts +2 -6
- package/es/userCondition/demo/business.d.ts +3 -0
- package/es/userCondition/demo/business.js +71 -0
- package/es/userCondition/index.js +12 -0
- package/es/userCondition/orConditions.js +5 -4
- package/es/userCondition/types.d.ts +19 -1
- package/es/userCondition/types.js +8 -1
- package/es/userCondition/util.d.ts +1 -1
- package/package.json +1 -1
|
@@ -13,6 +13,9 @@ var ConditionTypeList = function ConditionTypeList(props) {
|
|
|
13
13
|
textMode = _useContext.textMode,
|
|
14
14
|
openTagCondition = _useContext.openTagCondition,
|
|
15
15
|
openCdpCondition = _useContext.openCdpCondition,
|
|
16
|
+
openBusinessDataCondition = _useContext.openBusinessDataCondition,
|
|
17
|
+
openOrderDataCondition = _useContext.openOrderDataCondition,
|
|
18
|
+
openCondition = _useContext.openCondition,
|
|
16
19
|
cdpTip = _useContext.cdpTip;
|
|
17
20
|
var _useContext2 = useContext(BizGlobalDataContext),
|
|
18
21
|
menuNameMap = _useContext2.menuNameMap,
|
|
@@ -24,7 +27,7 @@ var ConditionTypeList = function ConditionTypeList(props) {
|
|
|
24
27
|
className: "biz-user-condition-type-label"
|
|
25
28
|
}, label) : null, /*#__PURE__*/React.createElement("ul", {
|
|
26
29
|
className: "biz-user-condition-type-container"
|
|
27
|
-
}, /*#__PURE__*/React.createElement("li", {
|
|
30
|
+
}, openCondition ? /*#__PURE__*/React.createElement("li", {
|
|
28
31
|
className: "condition-type",
|
|
29
32
|
key: "event",
|
|
30
33
|
onClick: function onClick() {
|
|
@@ -32,7 +35,7 @@ var ConditionTypeList = function ConditionTypeList(props) {
|
|
|
32
35
|
}
|
|
33
36
|
}, /*#__PURE__*/React.createElement(Space, {
|
|
34
37
|
key: "event"
|
|
35
|
-
}, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u505A\u8FC7\uFF08\u6CA1\u505A\u8FC7\uFF09\u2026"))), /*#__PURE__*/React.createElement("li", {
|
|
38
|
+
}, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u505A\u8FC7\uFF08\u6CA1\u505A\u8FC7\uFF09\u2026"))) : null, openCondition ? /*#__PURE__*/React.createElement("li", {
|
|
36
39
|
className: "condition-type",
|
|
37
40
|
key: "add",
|
|
38
41
|
onClick: function onClick() {
|
|
@@ -40,7 +43,7 @@ var ConditionTypeList = function ConditionTypeList(props) {
|
|
|
40
43
|
}
|
|
41
44
|
}, /*#__PURE__*/React.createElement(Space, {
|
|
42
45
|
key: "add"
|
|
43
|
-
}, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u65B0\u589E\u4E8E"))), /*#__PURE__*/React.createElement("li", {
|
|
46
|
+
}, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u65B0\u589E\u4E8E"))) : null, openCondition ? /*#__PURE__*/React.createElement("li", {
|
|
44
47
|
className: "condition-type",
|
|
45
48
|
key: "active",
|
|
46
49
|
onClick: function onClick() {
|
|
@@ -48,7 +51,7 @@ var ConditionTypeList = function ConditionTypeList(props) {
|
|
|
48
51
|
}
|
|
49
52
|
}, /*#__PURE__*/React.createElement(Space, {
|
|
50
53
|
key: "active"
|
|
51
|
-
}, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u6D3B\u8DC3\u4E8E"))), /*#__PURE__*/React.createElement("li", {
|
|
54
|
+
}, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u6D3B\u8DC3\u4E8E"))) : null, openCondition ? /*#__PURE__*/React.createElement("li", {
|
|
52
55
|
className: "condition-type",
|
|
53
56
|
key: "prop",
|
|
54
57
|
onClick: function onClick() {
|
|
@@ -56,7 +59,7 @@ var ConditionTypeList = function ConditionTypeList(props) {
|
|
|
56
59
|
}
|
|
57
60
|
}, /*#__PURE__*/React.createElement(Space, {
|
|
58
61
|
key: "prop"
|
|
59
|
-
}, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u7528\u6237\u5C5E\u6027\u6EE1\u8DB3"))), openTagCondition && (!menuNameMap || menuNameMap['userTags']) ? /*#__PURE__*/React.createElement("li", {
|
|
62
|
+
}, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u7528\u6237\u5C5E\u6027\u6EE1\u8DB3"))) : null, openTagCondition && (!menuNameMap || menuNameMap['userTags']) ? /*#__PURE__*/React.createElement("li", {
|
|
60
63
|
className: "condition-type",
|
|
61
64
|
onClick: function onClick() {
|
|
62
65
|
return onAdd('tag');
|
|
@@ -70,7 +73,7 @@ var ConditionTypeList = function ConditionTypeList(props) {
|
|
|
70
73
|
title: cdpTip
|
|
71
74
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
72
75
|
type: "tishiicon"
|
|
73
|
-
})) : null)) : null,
|
|
76
|
+
})) : null)) : null, openBusinessDataCondition || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 0 || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 2 ? /*#__PURE__*/React.createElement("li", {
|
|
74
77
|
className: "condition-type",
|
|
75
78
|
key: "business",
|
|
76
79
|
onClick: function onClick() {
|
|
@@ -78,7 +81,7 @@ var ConditionTypeList = function ConditionTypeList(props) {
|
|
|
78
81
|
}
|
|
79
82
|
}, /*#__PURE__*/React.createElement(Space, {
|
|
80
83
|
key: "business"
|
|
81
|
-
}, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u4E1A\u52A1\u6570\u636E"))) : null,
|
|
84
|
+
}, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u4E1A\u52A1\u6570\u636E"))) : null, openOrderDataCondition || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 0 || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 2 ? /*#__PURE__*/React.createElement("li", {
|
|
82
85
|
className: "condition-type",
|
|
83
86
|
key: "order",
|
|
84
87
|
onClick: function onClick() {
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BizUserConditionT } from '../types';
|
|
3
3
|
import './styles/periodCondition.less';
|
|
4
|
-
|
|
5
|
-
condition: BizUserConditionT.BusinessCondition;
|
|
6
|
-
label?: string | React.ReactDOM;
|
|
7
|
-
}
|
|
8
|
-
declare const BusinessCondition: React.FC<BusinessConditionPropsI>;
|
|
4
|
+
declare const BusinessCondition: React.FC<BizUserConditionT.BusinessPropsI>;
|
|
9
5
|
export default BusinessCondition;
|
|
@@ -0,0 +1,71 @@
|
|
|
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, { useEffect, useMemo, useState } from 'react';
|
|
8
|
+
import eventData from '../../mock/event';
|
|
9
|
+
import envData from '../../mock/env';
|
|
10
|
+
import userData from '../../mock/user';
|
|
11
|
+
import { BizUserCondition, BizGlobalDataContext, convertAttributeData } from '@zgfe/business-lib';
|
|
12
|
+
import { conditions, tagList } from './mockData';
|
|
13
|
+
import '@zgfe/business-lib/es/assets/iconfont/iconfont.css';
|
|
14
|
+
var getTagList = Promise.resolve(tagList);
|
|
15
|
+
export default (function () {
|
|
16
|
+
var _useState = useState({
|
|
17
|
+
eventGroupList: [],
|
|
18
|
+
userPropList: [],
|
|
19
|
+
eventEnvList: []
|
|
20
|
+
}),
|
|
21
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
22
|
+
setStore = _useState2[1];
|
|
23
|
+
var _useState3 = useState([]),
|
|
24
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
25
|
+
userTagsData = _useState4[0],
|
|
26
|
+
setUserTagsData = _useState4[1];
|
|
27
|
+
var newStore = convertAttributeData({
|
|
28
|
+
eventList: eventData,
|
|
29
|
+
userPropList: userData,
|
|
30
|
+
envPropList: envData
|
|
31
|
+
});
|
|
32
|
+
useEffect(function () {
|
|
33
|
+
setStore(newStore);
|
|
34
|
+
}, []);
|
|
35
|
+
useEffect(function () {
|
|
36
|
+
getTagList.then(function (list) {
|
|
37
|
+
setUserTagsData(list);
|
|
38
|
+
});
|
|
39
|
+
}, []);
|
|
40
|
+
var defaultValue = useMemo(function () {
|
|
41
|
+
return conditions;
|
|
42
|
+
}, [conditions]);
|
|
43
|
+
function onChange(value) {
|
|
44
|
+
console.log('change:', JSON.parse(JSON.stringify(value)));
|
|
45
|
+
}
|
|
46
|
+
var descDom = /*#__PURE__*/React.createElement(BizUserCondition, {
|
|
47
|
+
openCondition: false,
|
|
48
|
+
defaultValue: defaultValue,
|
|
49
|
+
openBusinessDataCondition: true,
|
|
50
|
+
openOrderDataCondition: true,
|
|
51
|
+
onChange: onChange,
|
|
52
|
+
eventAttrNum: 3,
|
|
53
|
+
userTagsData: userTagsData,
|
|
54
|
+
isRealTime: true
|
|
55
|
+
});
|
|
56
|
+
return /*#__PURE__*/React.createElement(BizGlobalDataContext.Provider, {
|
|
57
|
+
value: {
|
|
58
|
+
eventGroupList: newStore.eventGroupList,
|
|
59
|
+
userPropList: newStore.userPropList,
|
|
60
|
+
eventEnvList: newStore.envPropList,
|
|
61
|
+
currentApp: {
|
|
62
|
+
appId: 181,
|
|
63
|
+
platform: 0
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
style: {
|
|
68
|
+
display: 'inline-block'
|
|
69
|
+
}
|
|
70
|
+
}, descDom));
|
|
71
|
+
});
|
|
@@ -26,6 +26,9 @@ export var BizUserConditionContext = /*#__PURE__*/createContext({
|
|
|
26
26
|
textMode: false,
|
|
27
27
|
openTagCondition: false,
|
|
28
28
|
openCdpCondition: false,
|
|
29
|
+
openBusinessDataCondition: false,
|
|
30
|
+
openOrderDataCondition: false,
|
|
31
|
+
openCondition: true,
|
|
29
32
|
userTagsData: [],
|
|
30
33
|
envNameList: [],
|
|
31
34
|
userPropsMap: {},
|
|
@@ -42,7 +45,10 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
42
45
|
defaultValue = props.defaultValue,
|
|
43
46
|
openTagCondition = props.openTagCondition,
|
|
44
47
|
openCdpCondition = props.openCdpCondition,
|
|
48
|
+
openBusinessDataCondition = props.openBusinessDataCondition,
|
|
49
|
+
openOrderDataCondition = props.openOrderDataCondition,
|
|
45
50
|
userTagsData = props.userTagsData,
|
|
51
|
+
openCondition = props.openCondition,
|
|
46
52
|
cdpTip = props.cdpTip;
|
|
47
53
|
var _useState = useState([]),
|
|
48
54
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -216,6 +222,9 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
216
222
|
textMode: props.textMode,
|
|
217
223
|
openTagCondition: openTagCondition,
|
|
218
224
|
openCdpCondition: openCdpCondition,
|
|
225
|
+
openCondition: openCondition,
|
|
226
|
+
openBusinessDataCondition: openBusinessDataCondition,
|
|
227
|
+
openOrderDataCondition: openOrderDataCondition,
|
|
219
228
|
cdpTip: cdpTip,
|
|
220
229
|
userTagsData: userTagsData !== null && userTagsData !== void 0 ? userTagsData : [],
|
|
221
230
|
isRealTime: props.isRealTime,
|
|
@@ -254,6 +263,9 @@ BizUserCondition.defaultProps = {
|
|
|
254
263
|
andConditionNum: 5,
|
|
255
264
|
textMode: false,
|
|
256
265
|
openTagCondition: false,
|
|
266
|
+
openBusinessDataCondition: false,
|
|
267
|
+
openOrderDataCondition: false,
|
|
268
|
+
openCondition: true,
|
|
257
269
|
userTagsData: [],
|
|
258
270
|
isRealTime: false
|
|
259
271
|
};
|
|
@@ -10,6 +10,7 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
11
|
import React, { useContext, useEffect, useState } from 'react';
|
|
12
12
|
import { BizUserConditionContext } from '.';
|
|
13
|
+
import { eventIdType } from './types';
|
|
13
14
|
import './styles/orConditions.less';
|
|
14
15
|
import { util } from '../utils';
|
|
15
16
|
import ConditionTypeList from './conditionTypeList';
|
|
@@ -181,14 +182,14 @@ var OrConditions = function OrConditions(props) {
|
|
|
181
182
|
dataId: id,
|
|
182
183
|
onChange: onChangeAttrs
|
|
183
184
|
});
|
|
184
|
-
} else if (String(conditionData.eventId) ===
|
|
185
|
+
} else if (String(conditionData.eventId) === eventIdType.addTo) {
|
|
185
186
|
conditionDom = /*#__PURE__*/React.createElement(PeriodCondition, {
|
|
186
187
|
label: "\u65B0\u589E\u4E8E",
|
|
187
188
|
dataId: id,
|
|
188
189
|
onChange: onChangeRunPeriod,
|
|
189
190
|
runPeriod: conditionData.runPeriod
|
|
190
191
|
});
|
|
191
|
-
} else if (String(conditionData.eventId) ===
|
|
192
|
+
} else if (String(conditionData.eventId) === eventIdType.beActiveIn) {
|
|
192
193
|
conditionDom = /*#__PURE__*/React.createElement(PeriodCondition, {
|
|
193
194
|
label: "\u6D3B\u8DC3\u4E8E",
|
|
194
195
|
isRealTime: true,
|
|
@@ -196,14 +197,14 @@ var OrConditions = function OrConditions(props) {
|
|
|
196
197
|
onChange: onChangeRunPeriod,
|
|
197
198
|
runPeriod: conditionData.runPeriod
|
|
198
199
|
});
|
|
199
|
-
} else if (String(conditionData.eventId) ===
|
|
200
|
+
} else if (String(conditionData.eventId) === eventIdType.businessData) {
|
|
200
201
|
conditionDom = /*#__PURE__*/React.createElement(BusinessCondition, {
|
|
201
202
|
label: "\u4E1A\u52A1\u6570\u636E",
|
|
202
203
|
dataId: id,
|
|
203
204
|
onChange: onChangeEvent,
|
|
204
205
|
condition: condition
|
|
205
206
|
});
|
|
206
|
-
} else if (String(conditionData.eventId) ===
|
|
207
|
+
} else if (String(conditionData.eventId) === eventIdType.orderData) {
|
|
207
208
|
conditionDom = /*#__PURE__*/React.createElement(BusinessCondition, {
|
|
208
209
|
label: "\u8BA2\u5355\u6570\u636E",
|
|
209
210
|
dataId: id,
|
|
@@ -31,6 +31,12 @@ export declare enum PropType {
|
|
|
31
31
|
NUMBER2 = "number",
|
|
32
32
|
DATE2 = "date"
|
|
33
33
|
}
|
|
34
|
+
export declare enum eventIdType {
|
|
35
|
+
addTo = "-3",
|
|
36
|
+
beActiveIn = "-4",
|
|
37
|
+
businessData = "-14",
|
|
38
|
+
orderData = "-13"
|
|
39
|
+
}
|
|
34
40
|
export declare namespace BizUserConditionT {
|
|
35
41
|
type ConditionType = 'add' | 'active' | 'event' | 'prop' | 'tag' | 'cdp' | 'order' | 'business';
|
|
36
42
|
interface PropsI {
|
|
@@ -44,8 +50,20 @@ export declare namespace BizUserConditionT {
|
|
|
44
50
|
userTagsData?: UserTagsDataI[];
|
|
45
51
|
isRealTime?: boolean;
|
|
46
52
|
openCdpCondition?: boolean;
|
|
53
|
+
openBusinessDataCondition?: boolean;
|
|
54
|
+
openOrderDataCondition?: boolean;
|
|
55
|
+
openCondition?: boolean;
|
|
47
56
|
cdpTip?: string;
|
|
48
57
|
}
|
|
58
|
+
interface BusinessPropsI {
|
|
59
|
+
dataId: number;
|
|
60
|
+
condition: BizUserConditionT.BusinessCondition;
|
|
61
|
+
openBusinessDataCondition?: boolean;
|
|
62
|
+
openOrderDataCondition?: boolean;
|
|
63
|
+
label?: string | React.ReactDOM;
|
|
64
|
+
index?: number;
|
|
65
|
+
onChange: (dataId: number, newData: any) => void;
|
|
66
|
+
}
|
|
49
67
|
interface UserTagsDataI {
|
|
50
68
|
appId: number;
|
|
51
69
|
createTime: string;
|
|
@@ -182,7 +200,7 @@ export declare namespace BizUserConditionT {
|
|
|
182
200
|
orConditions: Conditions[number];
|
|
183
201
|
}
|
|
184
202
|
type ShowListT = ShowItemI[];
|
|
185
|
-
type GlobalContext = Pick<BizUserConditionT.PropsI, 'orConditionNum' | 'eventAttrNum' | 'openTagCondition' | 'userTagsData' | 'openCdpCondition' | 'textMode' | 'isRealTime' | 'cdpTip'> & {
|
|
203
|
+
type GlobalContext = Pick<BizUserConditionT.PropsI, 'orConditionNum' | 'eventAttrNum' | 'openTagCondition' | 'userTagsData' | 'openCdpCondition' | 'openBusinessDataCondition' | 'openOrderDataCondition' | 'openCondition' | 'textMode' | 'isRealTime' | 'cdpTip'> & {
|
|
186
204
|
envNameList: string[];
|
|
187
205
|
userPropsMap: {
|
|
188
206
|
[key: string]: UserProp;
|
|
@@ -6,4 +6,11 @@ export var PropType;
|
|
|
6
6
|
PropType["STRING2"] = "string";
|
|
7
7
|
PropType["NUMBER2"] = "number";
|
|
8
8
|
PropType["DATE2"] = "date";
|
|
9
|
-
})(PropType || (PropType = {}));
|
|
9
|
+
})(PropType || (PropType = {}));
|
|
10
|
+
export var eventIdType;
|
|
11
|
+
(function (eventIdType) {
|
|
12
|
+
eventIdType["addTo"] = "-3";
|
|
13
|
+
eventIdType["beActiveIn"] = "-4";
|
|
14
|
+
eventIdType["businessData"] = "-14";
|
|
15
|
+
eventIdType["orderData"] = "-13";
|
|
16
|
+
})(eventIdType || (eventIdType = {}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GlobalContextProps } from '../context';
|
|
2
2
|
import type { BizUserConditionT, Unpacked } from './types';
|
|
3
|
-
export declare function buildCondition(type: BizUserConditionT.ConditionType): BizUserConditionT.
|
|
3
|
+
export declare function buildCondition(type: BizUserConditionT.ConditionType): BizUserConditionT.BusinessCondition | BizUserConditionT.EventCondition | BizUserConditionT.AddCondition | BizUserConditionT.OrderCondition | BizUserConditionT.ActiveCondition | BizUserConditionT.PropCondition | BizUserConditionT.CdpCondition;
|
|
4
4
|
export declare function transformNumberOperate(key: string, output?: boolean): string;
|
|
5
5
|
export declare function findEvent(eventId: number, eventGroupList: Unpacked<GlobalContextProps, 'eventGroupList'>): import("../attributeSelector/types").AnalysisEvent | null;
|
|
6
6
|
export declare function findPropAndEnv(name: string, list: Unpacked<GlobalContextProps, 'userPropList' | 'eventEnvList'>): import("../attributeSelector/types").UserProp | import("../attributeSelector/types").EnvProp | null;
|