@zgfe/business-lib 1.1.35 → 1.1.36
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/assets/styles/resetAntd.less +36 -12
- package/es/attrConditions/utils/operates.d.ts +50 -0
- package/es/attrConditions/utils/operates.js +126 -0
- package/es/constants/apis.d.ts +5 -0
- package/es/constants/apis.js +6 -1
- package/es/context/index.d.ts +2 -0
- package/es/userCondition/conditionTypeList.js +27 -7
- package/es/userCondition/conditions/business/operatorCondition.d.ts +11 -0
- package/es/userCondition/conditions/business/operatorCondition.js +181 -0
- package/es/userCondition/conditions/business/paramsCondition.d.ts +9 -0
- package/es/userCondition/conditions/business/paramsCondition.js +79 -0
- package/es/userCondition/conditions/businessCondition.d.ts +5 -0
- package/es/userCondition/conditions/businessCondition.js +252 -0
- package/es/userCondition/conditions/cdpCondition.js +1 -1
- package/es/userCondition/conditions/constants.d.ts +1 -0
- package/es/userCondition/conditions/constants.js +2 -1
- package/es/userCondition/conditions/dataAttribute.d.ts +10 -0
- package/es/userCondition/conditions/dataAttribute.js +251 -0
- package/es/userCondition/conditions/eventCondition.js +83 -2
- package/es/userCondition/conditions/order/runPeriodCondition.d.ts +11 -0
- package/es/userCondition/conditions/order/runPeriodCondition.js +142 -0
- package/es/userCondition/conditions/order/runTimesCondition.d.ts +11 -0
- package/es/userCondition/conditions/order/runTimesCondition.js +112 -0
- package/es/userCondition/conditions/textDesc.d.ts +1 -1
- package/es/userCondition/conditions/textDesc.js +160 -2
- package/es/userCondition/conditions/timeDimension.d.ts +10 -0
- package/es/userCondition/conditions/timeDimension.js +150 -0
- package/es/userCondition/demo/business.d.ts +3 -0
- package/es/userCondition/demo/business.js +71 -0
- package/es/userCondition/index.js +14 -2
- package/es/userCondition/orConditions.js +22 -2
- package/es/userCondition/types.d.ts +71 -5
- package/es/userCondition/types.js +8 -1
- package/es/userCondition/util.d.ts +1 -1
- package/es/userCondition/util.js +33 -0
- package/es/utils/ajax.js +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
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; }
|
|
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
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
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; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import React, { useState } from 'react';
|
|
14
|
+
import BizSelect from '../../select';
|
|
15
|
+
import './styles/runTimesCondition.less';
|
|
16
|
+
import { classPrefix } from '..';
|
|
17
|
+
import { timeDimensionType, skyTimeOperatorType, weekTimeOperatorType, monthTimeOperatorType, timeValuesType, weekValuesType, monthValuesType } from '../../attrConditions/utils/operates';
|
|
18
|
+
import RunTimesCondition from './order/runTimesCondition';
|
|
19
|
+
var TimeDimension = function TimeDimension(props) {
|
|
20
|
+
var _condition$timeDimens, _condition$timeDimens3, _condition$timeDimens4, _condition$timeDimens5, _condition$timeDimens6, _condition$timeDimens7, _condition$timeDimens8, _condition$timeDimens9, _condition$timeDimens10, _condition$timeDimens11, _condition$timeDimens12, _condition$timeDimens13;
|
|
21
|
+
var onChange = props.onChange,
|
|
22
|
+
condition = props.condition,
|
|
23
|
+
index = props.index;
|
|
24
|
+
var _useState = useState({
|
|
25
|
+
name: '每天',
|
|
26
|
+
value: 1
|
|
27
|
+
}),
|
|
28
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
+
setTimeDimensionTypeList = _useState2[1];
|
|
30
|
+
var list = [];
|
|
31
|
+
var valuesList = [];
|
|
32
|
+
switch (condition === null || condition === void 0 ? void 0 : (_condition$timeDimens = condition.timeDimensions[index]) === null || _condition$timeDimens === void 0 ? void 0 : _condition$timeDimens.timeDimension) {
|
|
33
|
+
case 1:
|
|
34
|
+
list = skyTimeOperatorType;
|
|
35
|
+
valuesList = timeValuesType;
|
|
36
|
+
break;
|
|
37
|
+
case 2:
|
|
38
|
+
list = weekTimeOperatorType;
|
|
39
|
+
valuesList = weekValuesType;
|
|
40
|
+
break;
|
|
41
|
+
default:
|
|
42
|
+
list = monthTimeOperatorType;
|
|
43
|
+
valuesList = monthValuesType;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
var _useState3 = useState(list),
|
|
47
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
48
|
+
timeOperatorTypeList = _useState4[0],
|
|
49
|
+
setTimeOperatorTypeList = _useState4[1];
|
|
50
|
+
var _useState5 = useState(valuesList),
|
|
51
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
52
|
+
timeValuesTypeList = _useState6[0],
|
|
53
|
+
setTimeValuesTypeList = _useState6[1];
|
|
54
|
+
var onTimeDimensionTypeChange = function onTimeDimensionTypeChange(operate) {
|
|
55
|
+
setTimeDimensionTypeList(operate);
|
|
56
|
+
switch (operate.value) {
|
|
57
|
+
case 1:
|
|
58
|
+
setTimeValuesTypeList(timeValuesType);
|
|
59
|
+
setTimeOperatorTypeList(skyTimeOperatorType);
|
|
60
|
+
break;
|
|
61
|
+
case 2:
|
|
62
|
+
setTimeValuesTypeList(weekValuesType);
|
|
63
|
+
setTimeOperatorTypeList(weekTimeOperatorType);
|
|
64
|
+
break;
|
|
65
|
+
default:
|
|
66
|
+
setTimeValuesTypeList(monthValuesType);
|
|
67
|
+
setTimeOperatorTypeList(monthTimeOperatorType);
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
condition.timeDimensions[index].timeDimension = operate.value;
|
|
71
|
+
onChange(_objectSpread({}, condition));
|
|
72
|
+
};
|
|
73
|
+
var onTimeOperatorTypeChange = function onTimeOperatorTypeChange(operate) {
|
|
74
|
+
var _condition$timeDimens2;
|
|
75
|
+
condition.timeDimensions[index].timeValues = [(_condition$timeDimens2 = condition.timeDimensions[index]) === null || _condition$timeDimens2 === void 0 ? void 0 : _condition$timeDimens2.timeValues[0]];
|
|
76
|
+
condition.timeDimensions[index].timeOperator = operate.value;
|
|
77
|
+
onChange(_objectSpread({}, condition));
|
|
78
|
+
};
|
|
79
|
+
var onTimeValuesType0Change = function onTimeValuesType0Change(operate) {
|
|
80
|
+
condition.timeDimensions[index].timeValues[0] = operate.value;
|
|
81
|
+
onChange(_objectSpread({}, condition));
|
|
82
|
+
};
|
|
83
|
+
var onTimeValuesType1Change = function onTimeValuesType1Change(operate) {
|
|
84
|
+
condition.timeDimensions[index].timeValues[1] = operate.value;
|
|
85
|
+
onChange(_objectSpread({}, condition));
|
|
86
|
+
};
|
|
87
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: "".concat(classPrefix, "-runtimes-condition")
|
|
89
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: "".concat(classPrefix, "-period-condition-operator")
|
|
91
|
+
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
92
|
+
className: "".concat(classPrefix, "-select-condition"),
|
|
93
|
+
options: timeDimensionType,
|
|
94
|
+
labelField: "name",
|
|
95
|
+
keyField: "value",
|
|
96
|
+
overlayWidth: 80,
|
|
97
|
+
value: {
|
|
98
|
+
name: condition === null || condition === void 0 ? void 0 : (_condition$timeDimens3 = condition.timeDimensions[index]) === null || _condition$timeDimens3 === void 0 ? void 0 : _condition$timeDimens3.timeDimension,
|
|
99
|
+
value: condition === null || condition === void 0 ? void 0 : (_condition$timeDimens4 = condition.timeDimensions[index]) === null || _condition$timeDimens4 === void 0 ? void 0 : _condition$timeDimens4.timeDimension
|
|
100
|
+
},
|
|
101
|
+
onChange: onTimeDimensionTypeChange
|
|
102
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
103
|
+
className: "".concat(classPrefix, "-period-condition-operator")
|
|
104
|
+
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
105
|
+
className: "".concat(classPrefix, "-select-condition"),
|
|
106
|
+
options: timeOperatorTypeList,
|
|
107
|
+
labelField: "name",
|
|
108
|
+
keyField: "value",
|
|
109
|
+
overlayWidth: 120,
|
|
110
|
+
value: {
|
|
111
|
+
name: condition === null || condition === void 0 ? void 0 : (_condition$timeDimens5 = condition.timeDimensions[index]) === null || _condition$timeDimens5 === void 0 ? void 0 : _condition$timeDimens5.timeOperator,
|
|
112
|
+
value: condition === null || condition === void 0 ? void 0 : (_condition$timeDimens6 = condition.timeDimensions[index]) === null || _condition$timeDimens6 === void 0 ? void 0 : _condition$timeDimens6.timeOperator
|
|
113
|
+
},
|
|
114
|
+
onChange: onTimeOperatorTypeChange
|
|
115
|
+
})), (condition === null || condition === void 0 ? void 0 : (_condition$timeDimens7 = condition.timeDimensions[index]) === null || _condition$timeDimens7 === void 0 ? void 0 : _condition$timeDimens7.timeOperator) === 'in' || (condition === null || condition === void 0 ? void 0 : (_condition$timeDimens8 = condition.timeDimensions[index]) === null || _condition$timeDimens8 === void 0 ? void 0 : _condition$timeDimens8.timeOperator) === 'between' ? /*#__PURE__*/React.createElement("div", {
|
|
116
|
+
className: "".concat(classPrefix, "-period-condition-operator")
|
|
117
|
+
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
118
|
+
className: "".concat(classPrefix, "-select-condition"),
|
|
119
|
+
options: timeValuesTypeList,
|
|
120
|
+
labelField: "name",
|
|
121
|
+
keyField: "value",
|
|
122
|
+
overlayWidth: 120,
|
|
123
|
+
value: {
|
|
124
|
+
name: condition === null || condition === void 0 ? void 0 : (_condition$timeDimens9 = condition.timeDimensions[index]) === null || _condition$timeDimens9 === void 0 ? void 0 : _condition$timeDimens9.timeValues[0],
|
|
125
|
+
value: condition === null || condition === void 0 ? void 0 : (_condition$timeDimens10 = condition.timeDimensions[index]) === null || _condition$timeDimens10 === void 0 ? void 0 : _condition$timeDimens10.timeValues[0]
|
|
126
|
+
},
|
|
127
|
+
onChange: onTimeValuesType0Change
|
|
128
|
+
})) : null, (condition === null || condition === void 0 ? void 0 : (_condition$timeDimens11 = condition.timeDimensions[index]) === null || _condition$timeDimens11 === void 0 ? void 0 : _condition$timeDimens11.timeOperator) === 'between' ? /*#__PURE__*/React.createElement("div", {
|
|
129
|
+
className: "".concat(classPrefix, "-period-condition-operator")
|
|
130
|
+
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
131
|
+
className: "".concat(classPrefix, "-select-condition"),
|
|
132
|
+
options: timeValuesTypeList,
|
|
133
|
+
labelField: "name",
|
|
134
|
+
keyField: "value",
|
|
135
|
+
overlayWidth: 120,
|
|
136
|
+
value: {
|
|
137
|
+
name: condition === null || condition === void 0 ? void 0 : (_condition$timeDimens12 = condition.timeDimensions[index]) === null || _condition$timeDimens12 === void 0 ? void 0 : _condition$timeDimens12.timeValues[1],
|
|
138
|
+
value: condition === null || condition === void 0 ? void 0 : (_condition$timeDimens13 = condition.timeDimensions[index]) === null || _condition$timeDimens13 === void 0 ? void 0 : _condition$timeDimens13.timeValues[1]
|
|
139
|
+
},
|
|
140
|
+
onChange: onTimeValuesType1Change
|
|
141
|
+
})) : null, /*#__PURE__*/React.createElement("div", {
|
|
142
|
+
className: "".concat(classPrefix, "-period-condition-values")
|
|
143
|
+
}, /*#__PURE__*/React.createElement(RunTimesCondition, {
|
|
144
|
+
index: index,
|
|
145
|
+
dataId: props.dataId,
|
|
146
|
+
condition: condition,
|
|
147
|
+
onChange: onChange
|
|
148
|
+
}))));
|
|
149
|
+
};
|
|
150
|
+
export default TimeDimension;
|
|
@@ -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),
|
|
@@ -58,10 +64,10 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
58
64
|
var showTag = openTagCondition && (!menuNameMap || menuNameMap['userTags']);
|
|
59
65
|
var showCdp = openCdpCondition && (!menuNameMap || menuNameMap['dataset']);
|
|
60
66
|
var flag = false;
|
|
61
|
-
defaultValue.forEach(function (item) {
|
|
67
|
+
defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.forEach(function (item) {
|
|
62
68
|
var showItem = _toConsumableArray(item);
|
|
63
69
|
if (!(showTag && showCdp)) {
|
|
64
|
-
item.forEach(function (data, index) {
|
|
70
|
+
item === null || item === void 0 ? void 0 : item.forEach(function (data, index) {
|
|
65
71
|
if (data.dataset && !showCdp || data.labels && !showTag) {
|
|
66
72
|
showItem.splice(index, 1);
|
|
67
73
|
flag = true;
|
|
@@ -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';
|
|
@@ -23,6 +24,7 @@ import TagsCondition from './conditions/tagsCondition';
|
|
|
23
24
|
import { classPrefix } from '.';
|
|
24
25
|
import Text from './conditions/textDesc';
|
|
25
26
|
import CdpCondition from './conditions/cdpCondition';
|
|
27
|
+
import BusinessCondition from './conditions/businessCondition';
|
|
26
28
|
var OrConditions = function OrConditions(props) {
|
|
27
29
|
var _useContext = useContext(BizUserConditionContext),
|
|
28
30
|
orConditionNum = _useContext.orConditionNum,
|
|
@@ -116,6 +118,10 @@ var OrConditions = function OrConditions(props) {
|
|
|
116
118
|
data.condition.labels = newData;
|
|
117
119
|
} else if (type === 'cdp') {
|
|
118
120
|
data.condition.dataset = newData;
|
|
121
|
+
} else if (type === 'business') {
|
|
122
|
+
data.condition = newData;
|
|
123
|
+
} else if (type === 'order') {
|
|
124
|
+
data.condition = newData;
|
|
119
125
|
}
|
|
120
126
|
}
|
|
121
127
|
newValue.push(data.condition);
|
|
@@ -176,14 +182,14 @@ var OrConditions = function OrConditions(props) {
|
|
|
176
182
|
dataId: id,
|
|
177
183
|
onChange: onChangeAttrs
|
|
178
184
|
});
|
|
179
|
-
} else if (String(conditionData.eventId) ===
|
|
185
|
+
} else if (String(conditionData.eventId) === eventIdType.addTo) {
|
|
180
186
|
conditionDom = /*#__PURE__*/React.createElement(PeriodCondition, {
|
|
181
187
|
label: "\u65B0\u589E\u4E8E",
|
|
182
188
|
dataId: id,
|
|
183
189
|
onChange: onChangeRunPeriod,
|
|
184
190
|
runPeriod: conditionData.runPeriod
|
|
185
191
|
});
|
|
186
|
-
} else if (String(conditionData.eventId) ===
|
|
192
|
+
} else if (String(conditionData.eventId) === eventIdType.beActiveIn) {
|
|
187
193
|
conditionDom = /*#__PURE__*/React.createElement(PeriodCondition, {
|
|
188
194
|
label: "\u6D3B\u8DC3\u4E8E",
|
|
189
195
|
isRealTime: true,
|
|
@@ -191,6 +197,20 @@ var OrConditions = function OrConditions(props) {
|
|
|
191
197
|
onChange: onChangeRunPeriod,
|
|
192
198
|
runPeriod: conditionData.runPeriod
|
|
193
199
|
});
|
|
200
|
+
} else if (String(conditionData.eventId) === eventIdType.businessData) {
|
|
201
|
+
conditionDom = /*#__PURE__*/React.createElement(BusinessCondition, {
|
|
202
|
+
label: "\u4E1A\u52A1\u6570\u636E",
|
|
203
|
+
dataId: id,
|
|
204
|
+
onChange: onChangeEvent,
|
|
205
|
+
condition: condition
|
|
206
|
+
});
|
|
207
|
+
} else if (String(conditionData.eventId) === eventIdType.orderData) {
|
|
208
|
+
conditionDom = /*#__PURE__*/React.createElement(BusinessCondition, {
|
|
209
|
+
label: "\u8BA2\u5355\u6570\u636E",
|
|
210
|
+
dataId: id,
|
|
211
|
+
onChange: onChangeEvent,
|
|
212
|
+
condition: condition
|
|
213
|
+
});
|
|
194
214
|
} else if (util.isNumber(conditionData.eventId)) {
|
|
195
215
|
conditionDom = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EventCondition, {
|
|
196
216
|
dataId: id,
|
|
@@ -7,10 +7,18 @@ export interface RunPeriodI {
|
|
|
7
7
|
operator: 'relative' | 'unlimited_time' | 'join_time' | 'absolute';
|
|
8
8
|
values: string[];
|
|
9
9
|
}
|
|
10
|
+
export interface RunPeriodII {
|
|
11
|
+
operator: 'relative' | 'unlimited_time' | 'join_time' | 'absolute';
|
|
12
|
+
values: any[];
|
|
13
|
+
}
|
|
10
14
|
export interface RunTimesI {
|
|
11
|
-
operator: '>' | '=' | '<' | '>=' | '<=' | '>=' | 'not equal';
|
|
15
|
+
operator: '>' | '=' | '<' | '>=' | '<=' | '>=' | 'not equal' | 'between';
|
|
12
16
|
values: string[];
|
|
13
17
|
}
|
|
18
|
+
export interface RunTimesII {
|
|
19
|
+
operator: '>' | '=' | '<' | '>=' | '<=' | '>=' | 'not equal' | 'between';
|
|
20
|
+
values: any[];
|
|
21
|
+
}
|
|
14
22
|
export interface AllConditionBasePropsI<T> {
|
|
15
23
|
dataId: number;
|
|
16
24
|
onChange: (dataId: number, newData: T) => void;
|
|
@@ -23,8 +31,14 @@ export declare enum PropType {
|
|
|
23
31
|
NUMBER2 = "number",
|
|
24
32
|
DATE2 = "date"
|
|
25
33
|
}
|
|
34
|
+
export declare enum eventIdType {
|
|
35
|
+
addTo = "-3",
|
|
36
|
+
beActiveIn = "-4",
|
|
37
|
+
businessData = "-14",
|
|
38
|
+
orderData = "-13"
|
|
39
|
+
}
|
|
26
40
|
export declare namespace BizUserConditionT {
|
|
27
|
-
type ConditionType = 'add' | 'active' | 'event' | 'prop' | 'tag' | 'cdp';
|
|
41
|
+
type ConditionType = 'add' | 'active' | 'event' | 'prop' | 'tag' | 'cdp' | 'order' | 'business';
|
|
28
42
|
interface PropsI {
|
|
29
43
|
defaultValue: BizUserConditionT.Conditions;
|
|
30
44
|
onChange: (value: any[]) => void;
|
|
@@ -36,8 +50,20 @@ export declare namespace BizUserConditionT {
|
|
|
36
50
|
userTagsData?: UserTagsDataI[];
|
|
37
51
|
isRealTime?: boolean;
|
|
38
52
|
openCdpCondition?: boolean;
|
|
53
|
+
openBusinessDataCondition?: boolean;
|
|
54
|
+
openOrderDataCondition?: boolean;
|
|
55
|
+
openCondition?: boolean;
|
|
39
56
|
cdpTip?: string;
|
|
40
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
|
+
}
|
|
41
67
|
interface UserTagsDataI {
|
|
42
68
|
appId: number;
|
|
43
69
|
createTime: string;
|
|
@@ -71,8 +97,30 @@ export declare namespace BizUserConditionT {
|
|
|
71
97
|
category: 'fixed' | 'custom';
|
|
72
98
|
propCategory?: string;
|
|
73
99
|
}
|
|
100
|
+
interface AttrsCondition {
|
|
101
|
+
attrId: number;
|
|
102
|
+
attrName: string;
|
|
103
|
+
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'>;
|
|
104
|
+
params: string[];
|
|
105
|
+
attrType: 'cont-string' | 'cont-num' | 'cont-date';
|
|
106
|
+
category: 'fixed' | 'custom';
|
|
107
|
+
computeType: string;
|
|
108
|
+
}
|
|
109
|
+
interface paramsListCondition {
|
|
110
|
+
masterList: [];
|
|
111
|
+
bizDataAttrList: [];
|
|
112
|
+
paramsList: [];
|
|
113
|
+
}
|
|
114
|
+
interface TimeDimensionsCondition {
|
|
115
|
+
timeDimension: number;
|
|
116
|
+
timeOperator: string;
|
|
117
|
+
timeValues: number[];
|
|
118
|
+
frequencyOperator: string;
|
|
119
|
+
frequencyValues: any[];
|
|
120
|
+
}
|
|
74
121
|
interface EventCondition {
|
|
75
122
|
attrs: AttrCondition[];
|
|
123
|
+
timeDimensions: TimeDimensionsCondition[];
|
|
76
124
|
runTimes: RunTimesI;
|
|
77
125
|
runPeriod: RunPeriodI;
|
|
78
126
|
eventId: number;
|
|
@@ -83,6 +131,24 @@ export declare namespace BizUserConditionT {
|
|
|
83
131
|
runPeriod: RunPeriodI;
|
|
84
132
|
runTimes: RunTimesI;
|
|
85
133
|
}
|
|
134
|
+
interface BusinessCondition {
|
|
135
|
+
typeId: undefined;
|
|
136
|
+
typeName: undefined;
|
|
137
|
+
paramsList: paramsListCondition[];
|
|
138
|
+
attrs: AttrsCondition[];
|
|
139
|
+
timeDimensions: TimeDimensionsCondition[];
|
|
140
|
+
runTimes: RunTimesII;
|
|
141
|
+
runPeriod: RunPeriodII;
|
|
142
|
+
eventId: -14;
|
|
143
|
+
}
|
|
144
|
+
interface OrderCondition {
|
|
145
|
+
attrs: AttrsCondition[];
|
|
146
|
+
timeDimensions: TimeDimensionsCondition[];
|
|
147
|
+
paramsList: paramsListCondition[];
|
|
148
|
+
runTimes: RunTimesII;
|
|
149
|
+
runPeriod: RunPeriodII;
|
|
150
|
+
eventId: -13;
|
|
151
|
+
}
|
|
86
152
|
interface ActiveCondition {
|
|
87
153
|
eventId: '-4';
|
|
88
154
|
attrs: [];
|
|
@@ -126,15 +192,15 @@ export declare namespace BizUserConditionT {
|
|
|
126
192
|
interface CdpCondition {
|
|
127
193
|
dataset: (BizUserConditionT.CdpConditionDetail | undefined)[];
|
|
128
194
|
}
|
|
129
|
-
type Condition = EventCondition | AddCondition | ActiveCondition | PropCondition | TagsCondition | CdpCondition;
|
|
195
|
+
type Condition = EventCondition | AddCondition | ActiveCondition | PropCondition | TagsCondition | BusinessCondition | OrderCondition | CdpCondition;
|
|
130
196
|
type Conditions = Condition[][];
|
|
131
|
-
type OtherCondition = EventCondition | AddCondition | ActiveCondition | PropCondition;
|
|
197
|
+
type OtherCondition = EventCondition | AddCondition | ActiveCondition | PropCondition | BusinessCondition | OrderCondition;
|
|
132
198
|
interface ShowItemI {
|
|
133
199
|
id: number;
|
|
134
200
|
orConditions: Conditions[number];
|
|
135
201
|
}
|
|
136
202
|
type ShowListT = ShowItemI[];
|
|
137
|
-
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'> & {
|
|
138
204
|
envNameList: string[];
|
|
139
205
|
userPropsMap: {
|
|
140
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.EventCondition | BizUserConditionT.AddCondition | BizUserConditionT.ActiveCondition | BizUserConditionT.PropCondition | BizUserConditionT.CdpCondition;
|
|
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;
|
package/es/userCondition/util.js
CHANGED
|
@@ -40,6 +40,7 @@ export function buildCondition(type) {
|
|
|
40
40
|
operator: '>=',
|
|
41
41
|
values: ['1']
|
|
42
42
|
},
|
|
43
|
+
timeDimensions: [],
|
|
43
44
|
attrs: [],
|
|
44
45
|
runPeriod: {
|
|
45
46
|
operator: 'relative',
|
|
@@ -66,6 +67,38 @@ export function buildCondition(type) {
|
|
|
66
67
|
return {
|
|
67
68
|
dataset: [undefined]
|
|
68
69
|
};
|
|
70
|
+
case 'business':
|
|
71
|
+
return {
|
|
72
|
+
eventId: -14,
|
|
73
|
+
typeId: undefined,
|
|
74
|
+
typeName: undefined,
|
|
75
|
+
runTimes: {
|
|
76
|
+
operator: '>=',
|
|
77
|
+
values: [1]
|
|
78
|
+
},
|
|
79
|
+
attrs: [],
|
|
80
|
+
paramsList: [],
|
|
81
|
+
timeDimensions: [],
|
|
82
|
+
runPeriod: {
|
|
83
|
+
operator: 'relative',
|
|
84
|
+
values: [30, '0']
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
case 'order':
|
|
88
|
+
return {
|
|
89
|
+
eventId: -13,
|
|
90
|
+
runTimes: {
|
|
91
|
+
operator: '>=',
|
|
92
|
+
values: [1]
|
|
93
|
+
},
|
|
94
|
+
attrs: [],
|
|
95
|
+
paramsList: [],
|
|
96
|
+
timeDimensions: [],
|
|
97
|
+
runPeriod: {
|
|
98
|
+
operator: 'relative',
|
|
99
|
+
values: [30, '0']
|
|
100
|
+
}
|
|
101
|
+
};
|
|
69
102
|
}
|
|
70
103
|
}
|
|
71
104
|
export function transformNumberOperate(key) {
|
package/es/utils/ajax.js
CHANGED
|
@@ -63,6 +63,7 @@ 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;
|
|
66
67
|
} else if (new RegExp("".concat(ResponseStatus.noPermission)).test(apiResult.code)) {
|
|
67
68
|
window.location.href = '/webapp/app/noPermission';
|
|
68
69
|
throw new Error(apiResult.msg);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.36",
|
|
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": "b2e287ebcfeaa841e1f4e10bd9891e58f3223e95"
|
|
63
63
|
}
|