@zgfe/business-lib 1.0.0-beta.6 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/analysisLayout/demo/index.js +4 -1
- package/es/analysisLayout/index.d.ts +1 -28
- package/es/analysisLayout/index.js +38 -48
- package/es/analysisLayout/index.less +1 -1
- package/es/assets/styles/chunks.less +143 -0
- package/es/assets/styles/inner.less +3 -0
- package/es/assets/styles/resetAntd.less +398 -0
- package/es/assets/styles/variable.less +21 -0
- package/es/assets/theme.d.ts +5 -0
- package/es/assets/theme.js +4 -0
- package/es/attrConditions/components/operateList.d.ts +8 -0
- package/es/attrConditions/components/operateList.js +83 -0
- package/es/attrConditions/components/stringList.d.ts +9 -0
- package/es/attrConditions/components/stringList.js +168 -0
- package/es/attrConditions/components/valuesList.d.ts +10 -0
- package/es/attrConditions/components/valuesList.js +188 -0
- package/es/{attributeSelector/demo/multi.d.ts → attrConditions/demo/group.d.ts} +0 -0
- package/es/attrConditions/demo/group.js +82 -0
- package/es/{globalAttributes → attrConditions}/demo/index.d.ts +0 -0
- package/es/{datePicker/demo/form.js → attrConditions/demo/index.js} +43 -23
- package/es/attrConditions/group.d.ts +5 -0
- package/es/attrConditions/group.js +183 -0
- package/es/attrConditions/index.d.ts +6 -0
- package/es/attrConditions/index.js +160 -0
- package/es/attrConditions/styles/group.less +49 -0
- package/es/attrConditions/styles/index.less +94 -0
- package/es/attrConditions/types.d.ts +63 -0
- package/es/attrConditions/types.js +19 -0
- package/es/attrConditions/utils/operates.d.ts +16 -0
- package/es/attrConditions/utils/operates.js +67 -0
- package/es/attributeSelector/demo/index.d.ts +3 -0
- package/es/attributeSelector/demo/{singleForm.js → index.js} +42 -44
- package/es/attributeSelector/index.d.ts +4 -111
- package/es/attributeSelector/index.js +88 -543
- package/es/attributeSelector/listPanel.d.ts +4 -0
- package/es/attributeSelector/listPanel.js +208 -0
- package/es/attributeSelector/option.d.ts +15 -0
- package/es/attributeSelector/option.js +53 -0
- package/es/attributeSelector/styles/index.less +100 -0
- package/es/attributeSelector/types.d.ts +79 -0
- package/es/attributeSelector/types.js +15 -0
- package/es/attributeSelector/util.d.ts +7 -0
- package/es/attributeSelector/util.js +69 -0
- package/es/chart/demo/pie.js +1 -0
- package/es/chart/index.d.ts +2 -96
- package/es/chart/index.js +28 -35
- package/es/chart/styles/index.less +50 -0
- package/es/chart/types.d.ts +46 -0
- package/es/chart/{type.js → types.js} +0 -0
- package/es/chart/util/{chartConfig.d.ts → chartOptionConfig.d.ts} +4 -35
- package/es/chart/util/{chartConfig.js → chartOptionConfig.js} +45 -111
- package/es/chart/util/formatData.d.ts +3 -7
- package/es/chart/util/formatData.js +47 -26
- package/es/chart/util/formatOption.d.ts +2 -1
- package/es/chart/util/formatOption.js +22 -9
- package/es/chart/util/mapUtil.d.ts +3 -3
- package/es/chart/util/mapUtil.js +9 -19
- package/es/commonStyle/icon.less +116 -112
- package/es/commonStyle/select.less +1 -1
- package/es/commonStyle/theme.less +520 -473
- package/es/components/iconFont.js +4 -2
- package/es/context/index.d.ts +16 -0
- package/es/context/index.js +3 -0
- package/es/datePicker/datePicker.d.ts +10 -0
- package/es/datePicker/datePicker.js +115 -0
- package/es/datePicker/demo/index.d.ts +1 -0
- package/es/datePicker/demo/index.js +9 -2
- package/es/datePicker/index.d.ts +4 -27
- package/es/datePicker/index.js +72 -148
- package/es/datePicker/styles/index.less +48 -0
- package/es/datePicker/types.d.ts +24 -0
- package/es/{eventSelector/type.js → datePicker/types.js} +0 -0
- package/es/datePicker/utils.d.ts +6 -0
- package/es/datePicker/utils.js +70 -0
- package/es/dialog/components/itemNode.d.ts +10 -0
- package/es/dialog/components/itemNode.js +109 -0
- package/es/dialog/components/list.d.ts +3 -13
- package/es/dialog/components/list.js +15 -12
- package/es/dialog/components/selectToInput.d.ts +4 -48
- package/es/dialog/components/selectToInput.js +74 -80
- package/es/dialog/components/styles/handle.less +39 -0
- package/es/dialog/components/styles/list.less +60 -0
- package/es/dialog/components/styles/tab.less +55 -0
- package/es/dialog/components/tab.d.ts +3 -7
- package/es/dialog/components/tab.js +57 -19
- package/es/dialog/data/{chart.d.ts → data.d.ts} +9 -0
- package/es/dialog/data/{chart.js → data.js} +11 -0
- package/es/dialog/demo/index.d.ts +23 -0
- package/es/dialog/demo/index.js +34 -3
- package/es/dialog/demo/index2.js +14 -2
- package/es/dialog/index.d.ts +4 -97
- package/es/dialog/index.js +54 -109
- package/es/dialog/styles/index.less +11 -0
- package/es/dialog/types.d.ts +77 -0
- package/es/{targetConditionGroup/type.js → dialog/types.js} +0 -0
- package/es/eventSelector/demo/index.js +26 -44
- package/es/eventSelector/index.d.ts +4 -30
- package/es/eventSelector/index.js +90 -416
- package/es/eventSelector/listPanel.d.ts +4 -0
- package/es/eventSelector/listPanel.js +197 -0
- package/es/eventSelector/option.d.ts +17 -0
- package/es/eventSelector/option.js +54 -0
- package/es/eventSelector/styles/index.less +77 -0
- package/es/eventSelector/types.d.ts +31 -0
- package/es/eventSelector/types.js +1 -0
- package/es/index.d.ts +14 -11
- package/es/index.js +9 -11
- package/es/{attributeSelector/data → mock}/env.d.ts +0 -0
- package/es/{attributeSelector/data → mock}/env.js +0 -0
- package/es/{attributeSelector/data → mock}/event.d.ts +0 -0
- package/es/{attributeSelector/data → mock}/event.js +0 -0
- package/es/{attributeSelector/data → mock}/user.d.ts +0 -0
- package/es/{attributeSelector/data → mock}/user.js +0 -0
- package/es/{multipleSelector → searchInput}/demo/index.d.ts +0 -0
- package/es/searchInput/demo/index.js +5 -0
- package/es/searchInput/index.d.ts +8 -0
- package/es/searchInput/index.js +31 -0
- package/es/{attributeSelector/demo/multiForm.d.ts → select/demo/group.d.ts} +0 -0
- package/es/{globalAttributes/demo/index.js → select/demo/group.js} +49 -31
- package/es/select/demo/index.js +49 -21
- package/es/{attributeSelector/demo/single.d.ts → select/demo/multiple.d.ts} +0 -0
- package/es/{multipleSelector/demo/index.js → select/demo/multiple.js} +55 -12
- package/es/select/handle.d.ts +5 -0
- package/es/select/handle.js +119 -0
- package/es/select/index.d.ts +4 -49
- package/es/select/index.js +168 -122
- package/es/select/option.d.ts +4 -0
- package/es/select/option.js +59 -0
- package/es/select/overlay.d.ts +4 -0
- package/es/select/overlay.js +154 -0
- package/es/select/styles/handle.less +111 -0
- package/es/select/styles/index.less +99 -0
- package/es/select/types.d.ts +65 -0
- package/es/select/types.js +1 -0
- package/es/table/demo/data/table.js +1 -1
- package/es/table/demo/index.d.ts +1 -1
- package/es/table/demo/index.js +9 -8
- package/es/table/demo/index3.js +9 -18
- package/es/table/index.d.ts +4 -30
- package/es/table/index.js +30 -26
- package/es/table/styles/index.less +5 -0
- package/es/table/type.d.ts +10 -0
- package/es/table/type.js +1 -0
- package/es/targetConditionGroup/components/targetDimension.d.ts +8 -0
- package/es/targetConditionGroup/components/targetDimension.js +153 -0
- package/es/targetConditionGroup/data/operates.d.ts +8 -24
- package/es/targetConditionGroup/data/operates.js +26 -69
- package/es/targetConditionGroup/demo/group.d.ts +1 -0
- package/es/targetConditionGroup/demo/group.js +108 -23
- package/es/targetConditionGroup/demo/index.js +34 -34
- package/es/targetConditionGroup/demo/styles/index.less +29 -0
- package/es/targetConditionGroup/index.d.ts +4 -57
- package/es/targetConditionGroup/index.js +177 -274
- package/es/targetConditionGroup/styles/index.less +25 -0
- package/es/targetConditionGroup/types.d.ts +32 -0
- package/es/targetConditionGroup/types.js +1 -0
- package/es/targetSelector/demo/index.d.ts +1 -0
- package/es/targetSelector/demo/index.js +29 -71
- package/es/targetSelector/editBox.d.ts +8 -0
- package/es/targetSelector/{components/BizEventNameEditBox.js → editBox.js} +49 -24
- package/es/targetSelector/index.d.ts +5 -55
- package/es/targetSelector/index.js +103 -214
- package/es/targetSelector/optionIcon.d.ts +9 -0
- package/es/targetSelector/optionIcon.js +24 -0
- package/es/targetSelector/optionMenu.d.ts +7 -0
- package/es/targetSelector/optionMenu.js +38 -0
- package/es/targetSelector/styles/index.less +88 -0
- package/es/targetSelector/types.d.ts +18 -0
- package/es/targetSelector/types.js +1 -0
- package/es/userCondition/conditionTypeList.d.ts +10 -0
- package/es/userCondition/conditionTypeList.js +43 -0
- package/es/userCondition/conditionWrap.d.ts +7 -0
- package/es/userCondition/conditionWrap.js +18 -0
- package/es/userCondition/conditions/eventCondition.d.ts +8 -0
- package/es/userCondition/conditions/eventCondition.js +104 -0
- package/es/userCondition/conditions/periodCondition.d.ts +11 -0
- package/es/userCondition/conditions/periodCondition.js +156 -0
- package/es/userCondition/conditions/propCondition.d.ts +11 -0
- package/es/userCondition/conditions/propCondition.js +147 -0
- package/es/userCondition/conditions/runTimesCondition.d.ts +9 -0
- package/es/userCondition/conditions/runTimesCondition.js +78 -0
- package/es/userCondition/conditions/styles/eventCondition.less +49 -0
- package/es/userCondition/conditions/styles/periodCondition.less +14 -0
- package/es/userCondition/conditions/styles/propCondition.less +36 -0
- package/es/userCondition/conditions/styles/runTimesCondition.less +16 -0
- package/es/{attributeSelector/demo/singleForm.d.ts → userCondition/demo/index.d.ts} +0 -0
- package/es/userCondition/demo/index.js +97 -0
- package/es/userCondition/index.d.ts +7 -0
- package/es/userCondition/index.js +146 -0
- package/es/userCondition/orConditions.d.ts +5 -0
- package/es/userCondition/orConditions.js +202 -0
- package/es/userCondition/relationLabel.d.ts +6 -0
- package/es/userCondition/relationLabel.js +12 -0
- package/es/userCondition/styles/conditionTypeList.less +31 -0
- package/es/userCondition/styles/conditionWrap.less +14 -0
- package/es/userCondition/styles/index.less +13 -0
- package/es/userCondition/styles/orConditions.less +16 -0
- package/es/userCondition/styles/relationLabel.less +18 -0
- package/es/userCondition/types.d.ts +79 -0
- package/es/userCondition/types.js +1 -0
- package/es/userCondition/util.d.ts +2 -0
- package/es/userCondition/util.js +54 -0
- package/es/{datePicker/demo/form.d.ts → userGroup/demo/group.d.ts} +0 -0
- package/es/{targetConditionGroup/demo/form.js → userGroup/demo/group.js} +68 -72
- package/es/userGroup/demo/index.d.ts +0 -1
- package/es/userGroup/demo/index.js +5 -62
- package/es/userGroup/index.d.ts +3 -77
- package/es/userGroup/index.js +60 -108
- package/es/userGroup/styles/index.less +20 -0
- package/es/userGroup/types.d.ts +15 -0
- package/es/userGroup/types.js +1 -0
- package/es/utils/ajax.js +5 -20
- package/es/utils/type.d.ts +42 -44
- package/es/utils/util.d.ts +1 -35
- package/es/utils/util.js +27 -57
- package/package.json +11 -4
- package/es/attributeSelector/demo/multi.js +0 -39
- package/es/attributeSelector/demo/multiForm.js +0 -64
- package/es/attributeSelector/demo/single.js +0 -43
- package/es/attributeSelector/group.d.ts +0 -31
- package/es/attributeSelector/group.js +0 -225
- package/es/attributeSelector/index.less +0 -172
- package/es/chart/index.less +0 -38
- package/es/chart/style/circle.svg +0 -4
- package/es/chart/type.d.ts +0 -22
- package/es/datePicker/data.d.ts +0 -9
- package/es/datePicker/data.js +0 -65
- package/es/datePicker/index.less +0 -364
- package/es/dialog/components/style/list.less +0 -59
- package/es/dialog/components/style/tab.less +0 -61
- package/es/dialog/style/index.less +0 -86
- package/es/eventSelector/demo/form.d.ts +0 -2
- package/es/eventSelector/demo/form.js +0 -89
- package/es/eventSelector/demo/nodata.d.ts +0 -2
- package/es/eventSelector/demo/nodata.js +0 -13
- package/es/eventSelector/index.less +0 -121
- package/es/eventSelector/type.d.ts +0 -41
- package/es/globalAttributes/demo/data/env.d.ts +0 -11
- package/es/globalAttributes/demo/data/env.js +0 -181
- package/es/globalAttributes/demo/data/event.d.ts +0 -237
- package/es/globalAttributes/demo/data/event.js +0 -3483
- package/es/globalAttributes/demo/data/user.d.ts +0 -22
- package/es/globalAttributes/demo/data/user.js +0 -218
- package/es/globalAttributes/index.d.ts +0 -47
- package/es/globalAttributes/index.js +0 -112
- package/es/multipleSelector/index.d.ts +0 -36
- package/es/multipleSelector/index.js +0 -131
- package/es/multipleSelector/index.less +0 -136
- package/es/table/demo/index.less +0 -8
- package/es/table/index.less +0 -139
- package/es/targetConditionGroup/components/conditionGroup.d.ts +0 -30
- package/es/targetConditionGroup/components/conditionGroup.js +0 -112
- package/es/targetConditionGroup/components/conditionItem.d.ts +0 -47
- package/es/targetConditionGroup/components/conditionItem.js +0 -232
- package/es/targetConditionGroup/components/style/group.less +0 -47
- package/es/targetConditionGroup/components/style/index.less +0 -16
- package/es/targetConditionGroup/demo/data/env.d.ts +0 -11
- package/es/targetConditionGroup/demo/data/env.js +0 -181
- package/es/targetConditionGroup/demo/data/event.d.ts +0 -237
- package/es/targetConditionGroup/demo/data/event.js +0 -3483
- package/es/targetConditionGroup/demo/data/user.d.ts +0 -22
- package/es/targetConditionGroup/demo/data/user.js +0 -218
- package/es/targetConditionGroup/demo/form.d.ts +0 -2
- package/es/targetConditionGroup/demo/item.d.ts +0 -2
- package/es/targetConditionGroup/demo/item.js +0 -5
- package/es/targetConditionGroup/group.d.ts +0 -56
- package/es/targetConditionGroup/group.js +0 -204
- package/es/targetConditionGroup/index.less +0 -76
- package/es/targetConditionGroup/type.d.ts +0 -95
- package/es/targetSelector/components/BizCascadeBox.d.ts +0 -34
- package/es/targetSelector/components/BizCascadeBox.js +0 -213
- package/es/targetSelector/components/BizEventNameEditBox.d.ts +0 -20
- package/es/targetSelector/demo/form.d.ts +0 -2
- package/es/targetSelector/demo/form.js +0 -133
- package/es/targetSelector/demo/nodata.d.ts +0 -2
- package/es/targetSelector/demo/nodata.js +0 -13
- package/es/targetSelector/index.less +0 -28
- package/es/userGroup/demo/cluster.d.ts +0 -3
- package/es/userGroup/demo/cluster.js +0 -102
- package/es/userGroup/demo/index.less +0 -3
- package/es/userGroup/index.less +0 -2
- package/es/userGroup/userCluster.d.ts +0 -63
- package/es/userGroup/userCluster.js +0 -255
|
@@ -0,0 +1,147 @@
|
|
|
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
|
+
|
|
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 _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); }
|
|
12
|
+
|
|
13
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
14
|
+
|
|
15
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
16
|
+
|
|
17
|
+
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; }
|
|
18
|
+
|
|
19
|
+
import React from 'react';
|
|
20
|
+
import { PlusOutlined } from '@ant-design/icons';
|
|
21
|
+
import BizConditionItem from '../../attrConditions';
|
|
22
|
+
import './styles/propCondition.less';
|
|
23
|
+
import { useContext } from 'react';
|
|
24
|
+
import { BizUserConditionContext, classPrefix } from '..';
|
|
25
|
+
var numAttrTypeMap = {
|
|
26
|
+
1: 'cont-string',
|
|
27
|
+
2: 'cont-num',
|
|
28
|
+
3: 'cont-date'
|
|
29
|
+
};
|
|
30
|
+
var attrNumTypeMap = {
|
|
31
|
+
'cont-string': 1,
|
|
32
|
+
'cont-num': 2,
|
|
33
|
+
'cont-date': 3
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
var PropCondition = function PropCondition(props) {
|
|
37
|
+
var _useContext = useContext(BizUserConditionContext),
|
|
38
|
+
eventAttrNum = _useContext.eventAttrNum;
|
|
39
|
+
|
|
40
|
+
var isEvent = props.isEvent,
|
|
41
|
+
label = props.label,
|
|
42
|
+
attrs = props.attrs,
|
|
43
|
+
dataId = props.dataId;
|
|
44
|
+
|
|
45
|
+
function _onChange(data, i) {
|
|
46
|
+
var attrName = data.attrName,
|
|
47
|
+
attrId = data.attrId,
|
|
48
|
+
category = data.category,
|
|
49
|
+
type = data.type,
|
|
50
|
+
operation = data.operation,
|
|
51
|
+
values = data.values;
|
|
52
|
+
|
|
53
|
+
var newAttrs = _toConsumableArray(attrs);
|
|
54
|
+
|
|
55
|
+
var newAttr = {
|
|
56
|
+
attrName: attrName,
|
|
57
|
+
attrId: attrId,
|
|
58
|
+
category: category,
|
|
59
|
+
operator: operation,
|
|
60
|
+
params: values,
|
|
61
|
+
attrType: numAttrTypeMap[type]
|
|
62
|
+
};
|
|
63
|
+
newAttrs[i] = newAttr;
|
|
64
|
+
props.onChange(dataId, newAttrs);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function onAddAttr() {
|
|
68
|
+
props.onChange(dataId, [].concat(_toConsumableArray(attrs), [{
|
|
69
|
+
attrId: 0
|
|
70
|
+
}]));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function onRemoveAttr(i) {
|
|
74
|
+
var newAttrs = _toConsumableArray(attrs);
|
|
75
|
+
|
|
76
|
+
newAttrs.splice(i, 1);
|
|
77
|
+
props.onChange(dataId, newAttrs);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function getPropCategory(attrName) {
|
|
81
|
+
if (!isEvent) return 'userProp';
|
|
82
|
+
return attrName === undefined ? 'eventProp' : 'envProp';
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function renderAttr(attr, i) {
|
|
86
|
+
var attrId = attr.attrId,
|
|
87
|
+
attrName = attr.attrName,
|
|
88
|
+
category = attr.category,
|
|
89
|
+
operator = attr.operator,
|
|
90
|
+
params = attr.params,
|
|
91
|
+
attrType = attr.attrType;
|
|
92
|
+
console.log(attrType);
|
|
93
|
+
var props = {};
|
|
94
|
+
|
|
95
|
+
if ((attrName || attrId) && operator) {
|
|
96
|
+
props.value = {
|
|
97
|
+
attrName: attrName,
|
|
98
|
+
category: category || 'custom',
|
|
99
|
+
operation: operator,
|
|
100
|
+
values: params || [],
|
|
101
|
+
propCategory: getPropCategory(attrName),
|
|
102
|
+
type: attrNumTypeMap[attrType]
|
|
103
|
+
};
|
|
104
|
+
props.key = attrName || attrId;
|
|
105
|
+
attrId && (props.value.attrId = attrId);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
console.log(props);
|
|
109
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
110
|
+
className: "".concat(classPrefix, "-prop-condition-attr"),
|
|
111
|
+
key: attrName || attrId || Math.random()
|
|
112
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
113
|
+
className: "".concat(classPrefix, "-prop-condition-item-wrap")
|
|
114
|
+
}, /*#__PURE__*/React.createElement(BizConditionItem, _objectSpread({
|
|
115
|
+
onChange: function onChange(data) {
|
|
116
|
+
return _onChange(data, i);
|
|
117
|
+
},
|
|
118
|
+
enableUserProp: !isEvent,
|
|
119
|
+
enableEnvProp: isEvent,
|
|
120
|
+
enableEventProp: isEvent,
|
|
121
|
+
onDelete: function onDelete() {
|
|
122
|
+
return onRemoveAttr(i);
|
|
123
|
+
},
|
|
124
|
+
enableDelete: isEvent
|
|
125
|
+
}, props))));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
129
|
+
className: "".concat(classPrefix, "-prop-condition")
|
|
130
|
+
}, label ? /*#__PURE__*/React.createElement("div", {
|
|
131
|
+
className: "".concat(classPrefix, "-prop-condition-label")
|
|
132
|
+
}, label) : null, /*#__PURE__*/React.createElement("div", {
|
|
133
|
+
className: "".concat(classPrefix, "-prop-condition-attrs")
|
|
134
|
+
}, attrs.map(function (attr, i) {
|
|
135
|
+
return renderAttr(attr, i);
|
|
136
|
+
})), attrs.length < eventAttrNum && isEvent ? /*#__PURE__*/React.createElement("div", {
|
|
137
|
+
className: "".concat(classPrefix, "-prop-condition-add")
|
|
138
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
139
|
+
className: "".concat(classPrefix, "-prop-add-btn"),
|
|
140
|
+
onClick: onAddAttr
|
|
141
|
+
}, /*#__PURE__*/React.createElement(PlusOutlined, null))) : null);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
PropCondition.defaultProps = {
|
|
145
|
+
isEvent: false
|
|
146
|
+
};
|
|
147
|
+
export default PropCondition;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RunTimesI } from '../types';
|
|
3
|
+
import './styles/runTimesCondition.less';
|
|
4
|
+
export interface RunTimesConditionPropsI {
|
|
5
|
+
runTimes: RunTimesI;
|
|
6
|
+
onChange: (data: RunTimesI) => void;
|
|
7
|
+
}
|
|
8
|
+
declare const RunTimesCondition: React.FC<RunTimesConditionPropsI>;
|
|
9
|
+
export default RunTimesCondition;
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { Input, Tooltip, Space } from 'antd';
|
|
9
|
+
import { InfoCircleOutlined } from '@ant-design/icons';
|
|
10
|
+
import BizSelect from '../../select';
|
|
11
|
+
import './styles/runTimesCondition.less';
|
|
12
|
+
import { classPrefix } from '..';
|
|
13
|
+
var options = [{
|
|
14
|
+
value: '>',
|
|
15
|
+
text: '>'
|
|
16
|
+
}, {
|
|
17
|
+
value: '=',
|
|
18
|
+
text: '='
|
|
19
|
+
}, {
|
|
20
|
+
value: '<',
|
|
21
|
+
text: '<'
|
|
22
|
+
}, {
|
|
23
|
+
value: '>=',
|
|
24
|
+
text: '>='
|
|
25
|
+
}, {
|
|
26
|
+
value: '<=',
|
|
27
|
+
text: '<='
|
|
28
|
+
}, {
|
|
29
|
+
value: 'not equal',
|
|
30
|
+
text: '≠'
|
|
31
|
+
}];
|
|
32
|
+
|
|
33
|
+
var RunTimesCondition = function RunTimesCondition(props) {
|
|
34
|
+
var runTimes = props.runTimes,
|
|
35
|
+
onChange = props.onChange;
|
|
36
|
+
|
|
37
|
+
function onOperatorChange(data) {
|
|
38
|
+
onChange(_objectSpread(_objectSpread({}, runTimes), {}, {
|
|
39
|
+
operator: data.value
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function onValueChange(e) {
|
|
44
|
+
var value = e.target.value;
|
|
45
|
+
onChange(_objectSpread(_objectSpread({}, runTimes), {}, {
|
|
46
|
+
values: [value]
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: "".concat(classPrefix, "-runtimes-condition")
|
|
52
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: "".concat(classPrefix, "-runtimes-condition-operator")
|
|
54
|
+
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
55
|
+
options: options,
|
|
56
|
+
labelField: "text",
|
|
57
|
+
keyField: "value",
|
|
58
|
+
value: {
|
|
59
|
+
value: runTimes.operator,
|
|
60
|
+
text: runTimes.operator === 'not equal' ? '≠' : runTimes.operator
|
|
61
|
+
},
|
|
62
|
+
onChange: onOperatorChange
|
|
63
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
className: "".concat(classPrefix, "-runtimes-condition-value")
|
|
65
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
66
|
+
size: "large",
|
|
67
|
+
value: runTimes.values[0],
|
|
68
|
+
onChange: onValueChange
|
|
69
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
70
|
+
className: "".concat(classPrefix, "-runtimes-condition-unit")
|
|
71
|
+
}, /*#__PURE__*/React.createElement(Space, null, "\u6B21", /*#__PURE__*/React.createElement(Tooltip, {
|
|
72
|
+
title: "\u89E6\u53D1\u6B21\u6570\u4E3A0\u7B49\u540C\u4E8E\u6CA1\u6709\u89E6\u53D1"
|
|
73
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
74
|
+
className: "".concat(classPrefix, "-runtimes-tip")
|
|
75
|
+
}, /*#__PURE__*/React.createElement(InfoCircleOutlined, null))))));
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export default RunTimesCondition;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
@import '../../../assets/styles/variable.less';
|
|
2
|
+
.biz-user-condition-event-condition {
|
|
3
|
+
display: flex;
|
|
4
|
+
&-left {
|
|
5
|
+
display: flex;
|
|
6
|
+
}
|
|
7
|
+
&-right {
|
|
8
|
+
flex: 1;
|
|
9
|
+
}
|
|
10
|
+
.biz-user-condition-event {
|
|
11
|
+
width: 355px;
|
|
12
|
+
.biz-event-select-handle {
|
|
13
|
+
border-top-right-radius: 0;
|
|
14
|
+
border-bottom-right-radius: 0;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
&-times-period-wrap {
|
|
18
|
+
display: flex;
|
|
19
|
+
}
|
|
20
|
+
&-expand-attr {
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
width: 30px;
|
|
25
|
+
height: 42px;
|
|
26
|
+
margin-right: @margin-xs;
|
|
27
|
+
border: 1px solid @border-color-base;
|
|
28
|
+
border-left: none;
|
|
29
|
+
border-radius: @border-radius-small;
|
|
30
|
+
border-top-left-radius: 0;
|
|
31
|
+
border-bottom-left-radius: 0;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
}
|
|
34
|
+
&-attrs {
|
|
35
|
+
flex: 1;
|
|
36
|
+
width: 100%;
|
|
37
|
+
// margin-right: @margin-xs;
|
|
38
|
+
margin-bottom: @margin-xs;
|
|
39
|
+
}
|
|
40
|
+
&-label {
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
height: 42px;
|
|
44
|
+
margin-right: @margin-xs;
|
|
45
|
+
}
|
|
46
|
+
&-runtimes {
|
|
47
|
+
margin-right: @margin-xs;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
@import '../../../assets//styles/variable.less';
|
|
2
|
+
.biz-user-condition-prop-condition {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-wrap: wrap;
|
|
5
|
+
align-items: center;
|
|
6
|
+
&-label {
|
|
7
|
+
margin-right: @margin-xs;
|
|
8
|
+
}
|
|
9
|
+
&-attrs {
|
|
10
|
+
flex: 1;
|
|
11
|
+
.biz-user-condition-prop-condition-attr {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
&:nth-child(n + 2) {
|
|
15
|
+
margin-top: @margin-xs;
|
|
16
|
+
}
|
|
17
|
+
.biz-user-condition-prop-condition-item-wrap {
|
|
18
|
+
flex: 1;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
&-add {
|
|
23
|
+
width: 100%;
|
|
24
|
+
margin-top: @margin-xss;
|
|
25
|
+
.biz-user-condition-prop-add-btn {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
width: 30px;
|
|
30
|
+
height: 30px;
|
|
31
|
+
border: 1px solid @border-color-base;
|
|
32
|
+
border-radius: @border-radius-sx;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@import '../../../assets/styles/variable.less';
|
|
2
|
+
.biz-user-condition-runtimes-condition {
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
&-label {
|
|
6
|
+
margin-right: @margin-xs;
|
|
7
|
+
}
|
|
8
|
+
&-operator,
|
|
9
|
+
&-value {
|
|
10
|
+
width: 58px;
|
|
11
|
+
margin-right: @margin-xs;
|
|
12
|
+
}
|
|
13
|
+
.biz-user-condition-runtimes-tip {
|
|
14
|
+
color: @primary-color;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
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."); }
|
|
4
|
+
|
|
5
|
+
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); }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
13
|
+
import React, { useEffect, useState } from 'react';
|
|
14
|
+
import eventData from '../../mock/event';
|
|
15
|
+
import envData from '../../mock/env';
|
|
16
|
+
import userData from '../../mock/user';
|
|
17
|
+
import { BizUserCondition, BizGlobalDataContext, convertAttributeData } from '@zgfe/business-lib';
|
|
18
|
+
export default (function () {
|
|
19
|
+
var _useState = useState({
|
|
20
|
+
eventGroupList: [],
|
|
21
|
+
userPropList: [],
|
|
22
|
+
eventEnvList: []
|
|
23
|
+
}),
|
|
24
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
25
|
+
setStore = _useState2[1];
|
|
26
|
+
|
|
27
|
+
var newStore = convertAttributeData({
|
|
28
|
+
eventList: eventData,
|
|
29
|
+
userPropList: userData,
|
|
30
|
+
envPropList: envData
|
|
31
|
+
});
|
|
32
|
+
useEffect(function () {
|
|
33
|
+
setStore(newStore);
|
|
34
|
+
}, []);
|
|
35
|
+
|
|
36
|
+
function onChange(data) {
|
|
37
|
+
console.log(JSON.stringify(data));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var defaultValue = [[{
|
|
41
|
+
attrs: [{
|
|
42
|
+
attrName: 'is_anonymous',
|
|
43
|
+
category: 'fixed',
|
|
44
|
+
operator: 'equal',
|
|
45
|
+
params: ['Safari', 'Apple WebKit', 'Unknown', 'Mobile Safari', 'BlackBerry', 'Microsoft Edge Mobile'],
|
|
46
|
+
attrType: 'cont-string'
|
|
47
|
+
}]
|
|
48
|
+
}, {
|
|
49
|
+
eventId: 24143017,
|
|
50
|
+
runTimes: {
|
|
51
|
+
operator: '>=',
|
|
52
|
+
values: ['1']
|
|
53
|
+
},
|
|
54
|
+
attrs: [{
|
|
55
|
+
attrId: 30183430,
|
|
56
|
+
operator: 'equal',
|
|
57
|
+
params: ['Safari', 'Mobile Safari', 'BlackBerry', 'Unknown'],
|
|
58
|
+
attrType: 'cont-string'
|
|
59
|
+
}],
|
|
60
|
+
runPeriod: {
|
|
61
|
+
operator: 'relative',
|
|
62
|
+
values: ['30', '0']
|
|
63
|
+
}
|
|
64
|
+
}], [{
|
|
65
|
+
eventId: '-3',
|
|
66
|
+
runPeriod: {
|
|
67
|
+
operator: 'relative',
|
|
68
|
+
values: ['30', '0']
|
|
69
|
+
},
|
|
70
|
+
runTimes: {
|
|
71
|
+
operator: '>=',
|
|
72
|
+
values: ['1']
|
|
73
|
+
},
|
|
74
|
+
attrs: []
|
|
75
|
+
}, {
|
|
76
|
+
eventId: '-4',
|
|
77
|
+
runPeriod: {
|
|
78
|
+
operator: 'relative',
|
|
79
|
+
values: ['30', '1']
|
|
80
|
+
},
|
|
81
|
+
runTimes: {
|
|
82
|
+
operator: '>=',
|
|
83
|
+
values: ['1']
|
|
84
|
+
},
|
|
85
|
+
attrs: []
|
|
86
|
+
}]];
|
|
87
|
+
return /*#__PURE__*/React.createElement(BizGlobalDataContext.Provider, {
|
|
88
|
+
value: {
|
|
89
|
+
eventGroupList: newStore.eventGroupList,
|
|
90
|
+
userPropList: newStore.userPropList,
|
|
91
|
+
eventEnvList: newStore.envPropList
|
|
92
|
+
}
|
|
93
|
+
}, /*#__PURE__*/React.createElement(BizUserCondition, {
|
|
94
|
+
defaultValue: defaultValue,
|
|
95
|
+
onChange: onChange
|
|
96
|
+
}));
|
|
97
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BizUserConditionT } from './types';
|
|
3
|
+
import './styles/index.less';
|
|
4
|
+
export declare const BizUserConditionContext: React.Context<Pick<BizUserConditionT.PropsI, "eventAttrNum" | "orConditionNum">>;
|
|
5
|
+
export declare const classPrefix = "biz-user-condition";
|
|
6
|
+
declare const BizUserCondition: React.FC<BizUserConditionT.PropsI>;
|
|
7
|
+
export default BizUserCondition;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
|
|
3
|
+
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."); }
|
|
4
|
+
|
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
+
|
|
7
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
|
+
|
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
|
|
11
|
+
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."); }
|
|
12
|
+
|
|
13
|
+
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); }
|
|
14
|
+
|
|
15
|
+
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; }
|
|
16
|
+
|
|
17
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
18
|
+
|
|
19
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
+
|
|
21
|
+
import React, { createContext, useEffect, useState } from 'react';
|
|
22
|
+
import ConditionTypeList from './conditionTypeList';
|
|
23
|
+
import RelationLabel from './relationLabel';
|
|
24
|
+
import OrConditions from './orConditions';
|
|
25
|
+
import './styles/index.less';
|
|
26
|
+
import { buildCondition } from './util';
|
|
27
|
+
export var BizUserConditionContext = /*#__PURE__*/createContext({
|
|
28
|
+
orConditionNum: 2,
|
|
29
|
+
eventAttrNum: 1
|
|
30
|
+
});
|
|
31
|
+
export var classPrefix = 'biz-user-condition';
|
|
32
|
+
|
|
33
|
+
var BizUserCondition = function BizUserCondition(props) {
|
|
34
|
+
var andConditionNum = props.andConditionNum,
|
|
35
|
+
defaultValue = props.defaultValue;
|
|
36
|
+
|
|
37
|
+
var _useState = useState([]),
|
|
38
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
+
showList = _useState2[0],
|
|
40
|
+
setShowList = _useState2[1];
|
|
41
|
+
|
|
42
|
+
var _useState3 = useState([]),
|
|
43
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
44
|
+
dataList = _useState4[0],
|
|
45
|
+
setDataList = _useState4[1];
|
|
46
|
+
|
|
47
|
+
var _useState5 = useState(defaultValue || []),
|
|
48
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
49
|
+
value = _useState6[0],
|
|
50
|
+
setValue = _useState6[1];
|
|
51
|
+
|
|
52
|
+
useEffect(function () {
|
|
53
|
+
if (props.defaultValue) {
|
|
54
|
+
setValue(props.defaultValue);
|
|
55
|
+
initShowList();
|
|
56
|
+
}
|
|
57
|
+
}, [props.defaultValue]);
|
|
58
|
+
|
|
59
|
+
function initShowList() {
|
|
60
|
+
var showList = [];
|
|
61
|
+
defaultValue.forEach(function (item) {
|
|
62
|
+
showList.push({
|
|
63
|
+
id: Math.random(),
|
|
64
|
+
orConditions: item
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
setShowList(showList);
|
|
68
|
+
setDataList(showList);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function onAdd(type) {
|
|
72
|
+
var condition = buildCondition(type);
|
|
73
|
+
var newValue = [].concat(_toConsumableArray(value), [[condition]]);
|
|
74
|
+
setValue(newValue);
|
|
75
|
+
var newData = {
|
|
76
|
+
id: Math.random(),
|
|
77
|
+
orConditions: [condition]
|
|
78
|
+
};
|
|
79
|
+
setShowList([].concat(_toConsumableArray(showList), [newData]));
|
|
80
|
+
setDataList([].concat(_toConsumableArray(dataList), [newData]));
|
|
81
|
+
props.onChange(newValue);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function _onChange(id, newData) {
|
|
85
|
+
var newValue = [];
|
|
86
|
+
var newDataList = [];
|
|
87
|
+
dataList.forEach(function (item) {
|
|
88
|
+
if (item.id === id) {
|
|
89
|
+
if (newData.length) {
|
|
90
|
+
newValue.push(newData);
|
|
91
|
+
newDataList.push({
|
|
92
|
+
id: item.id,
|
|
93
|
+
orConditions: newData
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
newValue.push(item.orConditions);
|
|
98
|
+
newDataList.push(item);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
if (newData.length === 0) {
|
|
103
|
+
var index = showList.findIndex(function (item) {
|
|
104
|
+
return item.id === id;
|
|
105
|
+
});
|
|
106
|
+
showList.splice(index, 1);
|
|
107
|
+
setShowList(_toConsumableArray(showList));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
setValue(newValue);
|
|
111
|
+
setDataList(newDataList);
|
|
112
|
+
props.onChange(newValue);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return /*#__PURE__*/React.createElement(BizUserConditionContext.Provider, {
|
|
116
|
+
value: {
|
|
117
|
+
orConditionNum: props.orConditionNum || 2,
|
|
118
|
+
eventAttrNum: props.eventAttrNum || 1
|
|
119
|
+
}
|
|
120
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
121
|
+
className: classPrefix
|
|
122
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
123
|
+
className: "".concat(classPrefix, "-conditions-content")
|
|
124
|
+
}, /*#__PURE__*/React.createElement(RelationLabel, {
|
|
125
|
+
show: value.length >= 2
|
|
126
|
+
}, "\u4E14"), showList.length ? /*#__PURE__*/React.createElement("div", {
|
|
127
|
+
className: "".concat(classPrefix, "-and-conditions-wrap")
|
|
128
|
+
}, showList.map(function (item) {
|
|
129
|
+
return /*#__PURE__*/React.createElement(OrConditions, {
|
|
130
|
+
orConditions: item.orConditions,
|
|
131
|
+
key: item.id,
|
|
132
|
+
onChange: function onChange(data) {
|
|
133
|
+
_onChange(item.id, data);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
})) : null), /*#__PURE__*/React.createElement(ConditionTypeList, {
|
|
137
|
+
show: value.length < andConditionNum,
|
|
138
|
+
label: "\u4E14",
|
|
139
|
+
onAdd: onAdd
|
|
140
|
+
})));
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
BizUserCondition.defaultProps = {
|
|
144
|
+
andConditionNum: 5
|
|
145
|
+
};
|
|
146
|
+
export default BizUserCondition;
|