@zgfe/business-lib 1.0.1-beta.0 → 1.0.5

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.
Files changed (61) hide show
  1. package/es/analysisLayout/index.js +11 -9
  2. package/es/attrConditions/components/stringList.js +1 -0
  3. package/es/attrConditions/components/valuesList.js +4 -2
  4. package/es/attrConditions/group.js +1 -2
  5. package/es/attributeSelector/index.js +6 -4
  6. package/es/attributeSelector/listPanel.js +11 -9
  7. package/es/chart/index.js +12 -10
  8. package/es/components/iconFont.d.ts +4 -1
  9. package/es/components/iconFont.js +8 -4
  10. package/es/dialog/components/itemNode.d.ts +1 -0
  11. package/es/dialog/components/itemNode.js +15 -13
  12. package/es/dialog/components/list.js +7 -5
  13. package/es/dialog/components/selectToInput.js +8 -6
  14. package/es/dialog/index.js +14 -11
  15. package/es/dialog/types.d.ts +1 -1
  16. package/es/eventSelector/listPanel.js +4 -2
  17. package/es/index.d.ts +3 -1
  18. package/es/index.js +3 -1
  19. package/es/searchInput/demo/index.d.ts +2 -0
  20. package/es/searchInput/demo/index.js +5 -0
  21. package/es/select/handle.d.ts +2 -2
  22. package/es/select/handle.js +8 -8
  23. package/es/select/index.js +6 -4
  24. package/es/table/index.js +12 -10
  25. package/es/targetConditionGroup/index.js +5 -2
  26. package/es/targetSelector/index.js +6 -4
  27. package/es/userCondition/conditionTypeList.d.ts +10 -0
  28. package/es/userCondition/conditionTypeList.js +43 -0
  29. package/es/userCondition/conditionWrap.d.ts +7 -0
  30. package/es/userCondition/conditionWrap.js +18 -0
  31. package/es/userCondition/conditions/eventCondition.d.ts +8 -0
  32. package/es/userCondition/conditions/eventCondition.js +104 -0
  33. package/es/userCondition/conditions/periodCondition.d.ts +11 -0
  34. package/es/userCondition/conditions/periodCondition.js +156 -0
  35. package/es/userCondition/conditions/propCondition.d.ts +5 -0
  36. package/es/userCondition/conditions/propCondition.js +198 -0
  37. package/es/userCondition/conditions/runTimesCondition.d.ts +9 -0
  38. package/es/userCondition/conditions/runTimesCondition.js +78 -0
  39. package/es/userCondition/conditions/styles/eventCondition.less +49 -0
  40. package/es/userCondition/conditions/styles/periodCondition.less +14 -0
  41. package/es/userCondition/conditions/styles/propCondition.less +36 -0
  42. package/es/userCondition/conditions/styles/runTimesCondition.less +16 -0
  43. package/es/userCondition/demo/index.d.ts +2 -0
  44. package/es/userCondition/demo/index.js +73 -0
  45. package/es/userCondition/index.d.ts +7 -0
  46. package/es/userCondition/index.js +143 -0
  47. package/es/userCondition/orConditions.d.ts +5 -0
  48. package/es/userCondition/orConditions.js +202 -0
  49. package/es/userCondition/relationLabel.d.ts +6 -0
  50. package/es/userCondition/relationLabel.js +12 -0
  51. package/es/userCondition/styles/conditionTypeList.less +31 -0
  52. package/es/userCondition/styles/conditionWrap.less +14 -0
  53. package/es/userCondition/styles/index.less +13 -0
  54. package/es/userCondition/styles/orConditions.less +16 -0
  55. package/es/userCondition/styles/relationLabel.less +18 -0
  56. package/es/userCondition/types.d.ts +96 -0
  57. package/es/userCondition/types.js +1 -0
  58. package/es/userCondition/util.d.ts +3 -0
  59. package/es/userCondition/util.js +73 -0
  60. package/es/userGroup/index.js +6 -4
  61. package/package.json +2 -2
@@ -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,14 @@
1
+ @import '../../../assets/styles/variable.less';
2
+ .biz-user-condition-period-condition {
3
+ display: flex;
4
+ align-items: center;
5
+ &-label,
6
+ &-operator,
7
+ &-values,
8
+ &-unit {
9
+ margin-right: @margin-xs;
10
+ }
11
+ &-operator {
12
+ width: 129px;
13
+ }
14
+ }
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: () => JSX.Element;
2
+ export default _default;
@@ -0,0 +1,73 @@
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
+ eventId: 7086293,
42
+ runTimes: {
43
+ operator: '>=',
44
+ values: ['1']
45
+ },
46
+ attrs: [{
47
+ attrId: 30183425,
48
+ operator: '=',
49
+ params: ['Apple WebKit', 'Unknown'],
50
+ attrType: 'cont-string'
51
+ }, {
52
+ attrId: 5461057,
53
+ operator: '>',
54
+ params: ['123'],
55
+ attrType: 'cont-num'
56
+ }],
57
+ runPeriod: {
58
+ operator: 'relative',
59
+ values: ['30', '0']
60
+ }
61
+ }]];
62
+ return /*#__PURE__*/React.createElement(BizGlobalDataContext.Provider, {
63
+ value: {
64
+ eventGroupList: newStore.eventGroupList,
65
+ userPropList: newStore.userPropList,
66
+ eventEnvList: newStore.envPropList
67
+ }
68
+ }, /*#__PURE__*/React.createElement(BizUserCondition, {
69
+ defaultValue: defaultValue,
70
+ onChange: onChange,
71
+ eventAttrNum: 3
72
+ }));
73
+ });
@@ -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,143 @@
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
+ initShowList();
54
+ }, []);
55
+
56
+ function initShowList() {
57
+ var showList = [];
58
+ defaultValue.forEach(function (item) {
59
+ showList.push({
60
+ id: Math.random(),
61
+ orConditions: item
62
+ });
63
+ });
64
+ setShowList(showList);
65
+ setDataList(showList);
66
+ }
67
+
68
+ function onAdd(type) {
69
+ var condition = buildCondition(type);
70
+ var newValue = [].concat(_toConsumableArray(value), [[condition]]);
71
+ setValue(newValue);
72
+ var newData = {
73
+ id: Math.random(),
74
+ orConditions: [condition]
75
+ };
76
+ setShowList([].concat(_toConsumableArray(showList), [newData]));
77
+ setDataList([].concat(_toConsumableArray(dataList), [newData]));
78
+ props.onChange(newValue);
79
+ }
80
+
81
+ function _onChange(id, newData) {
82
+ var newValue = [];
83
+ var newDataList = [];
84
+ dataList.forEach(function (item) {
85
+ if (item.id === id) {
86
+ if (newData.length) {
87
+ newValue.push(newData);
88
+ newDataList.push({
89
+ id: item.id,
90
+ orConditions: newData
91
+ });
92
+ }
93
+ } else {
94
+ newValue.push(item.orConditions);
95
+ newDataList.push(item);
96
+ }
97
+ });
98
+
99
+ if (newData.length === 0) {
100
+ var index = showList.findIndex(function (item) {
101
+ return item.id === id;
102
+ });
103
+ showList.splice(index, 1);
104
+ setShowList(_toConsumableArray(showList));
105
+ }
106
+
107
+ setValue(newValue);
108
+ setDataList(newDataList);
109
+ props.onChange(newValue);
110
+ }
111
+
112
+ return /*#__PURE__*/React.createElement(BizUserConditionContext.Provider, {
113
+ value: {
114
+ orConditionNum: props.orConditionNum || 2,
115
+ eventAttrNum: props.eventAttrNum || 1
116
+ }
117
+ }, /*#__PURE__*/React.createElement("div", {
118
+ className: classPrefix
119
+ }, /*#__PURE__*/React.createElement("div", {
120
+ className: "".concat(classPrefix, "-conditions-content")
121
+ }, /*#__PURE__*/React.createElement(RelationLabel, {
122
+ show: value.length >= 2
123
+ }, "\u4E14"), showList.length ? /*#__PURE__*/React.createElement("div", {
124
+ className: "".concat(classPrefix, "-and-conditions-wrap")
125
+ }, showList.map(function (item) {
126
+ return /*#__PURE__*/React.createElement(OrConditions, {
127
+ orConditions: item.orConditions,
128
+ key: item.id,
129
+ onChange: function onChange(data) {
130
+ _onChange(item.id, data);
131
+ }
132
+ });
133
+ })) : null), /*#__PURE__*/React.createElement(ConditionTypeList, {
134
+ show: value.length < andConditionNum,
135
+ label: "\u4E14",
136
+ onAdd: onAdd
137
+ })));
138
+ };
139
+
140
+ BizUserCondition.defaultProps = {
141
+ andConditionNum: 5
142
+ };
143
+ export default BizUserCondition;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { OrConditionsT } from './types';
3
+ import './styles/orConditions.less';
4
+ declare const OrConditions: React.FC<OrConditionsT.PropI>;
5
+ export default OrConditions;
@@ -0,0 +1,202 @@
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, { useContext, useEffect, useState } from 'react';
22
+ import { BizUserConditionContext } from '.';
23
+ import './styles/orConditions.less';
24
+ import { util } from '../utils';
25
+ import ConditionTypeList from './conditionTypeList';
26
+ import RelationLabel from './relationLabel';
27
+ import PeriodCondition from './conditions/periodCondition';
28
+ import { buildCondition } from './util';
29
+ import ConditionWrap from './conditionWrap';
30
+ import PropCondition from './conditions/propCondition';
31
+ import EventCondition from './conditions/eventCondition';
32
+ import { classPrefix } from '.';
33
+
34
+ var OrConditions = function OrConditions(props) {
35
+ var _useContext = useContext(BizUserConditionContext),
36
+ orConditionNum = _useContext.orConditionNum;
37
+
38
+ var orConditions = props.orConditions;
39
+
40
+ var _useState = useState([]),
41
+ _useState2 = _slicedToArray(_useState, 2),
42
+ showList = _useState2[0],
43
+ setShowList = _useState2[1];
44
+
45
+ var _useState3 = useState(orConditions),
46
+ _useState4 = _slicedToArray(_useState3, 2),
47
+ value = _useState4[0],
48
+ setValue = _useState4[1];
49
+
50
+ useEffect(function () {
51
+ if (orConditions) {
52
+ setValue(orConditions);
53
+ initShowList();
54
+ }
55
+ }, [orConditions]);
56
+
57
+ function initShowList() {
58
+ var showList = [];
59
+ orConditions.forEach(function (condition) {
60
+ var item = {
61
+ id: Math.random(),
62
+ condition: condition
63
+ };
64
+ showList.push(item);
65
+ });
66
+ setShowList(showList);
67
+ }
68
+
69
+ function onAdd(type) {
70
+ var condition = buildCondition(type);
71
+ var newData = {
72
+ id: Math.random(),
73
+ condition: condition
74
+ };
75
+ var newValue = [].concat(_toConsumableArray(value), [condition]);
76
+ setValue(newValue);
77
+ setShowList([].concat(_toConsumableArray(showList), [newData]));
78
+ props.onChange(newValue);
79
+ }
80
+
81
+ function onChangeRunPeriod(id, newData) {
82
+ var newValue = [];
83
+ showList.forEach(function (data) {
84
+ if (id === data.id) {
85
+ data.condition.runPeriod = newData;
86
+ }
87
+
88
+ newValue.push(data.condition);
89
+ });
90
+ setShowList(_toConsumableArray(showList));
91
+ props.onChange(newValue);
92
+ }
93
+
94
+ function onChangeAttrs(id, newAttrs) {
95
+ var newValue = [];
96
+ showList.forEach(function (data) {
97
+ if (id === data.id) {
98
+ data.condition.attrs = newAttrs;
99
+ }
100
+
101
+ newValue.push(data.condition);
102
+ });
103
+ setShowList(_toConsumableArray(showList));
104
+ props.onChange(newValue);
105
+ }
106
+
107
+ function onChangeEvent(id, newEvnet) {
108
+ var newValue = [];
109
+ showList.forEach(function (data) {
110
+ if (id === data.id) {
111
+ data.condition = newEvnet;
112
+ }
113
+
114
+ newValue.push(data.condition);
115
+ });
116
+ setShowList(_toConsumableArray(showList));
117
+ props.onChange(newValue);
118
+ }
119
+
120
+ function onDelete(id) {
121
+ var index = showList.findIndex(function (item) {
122
+ return item.id === id;
123
+ });
124
+ showList.splice(index, 1);
125
+
126
+ var newList = _toConsumableArray(showList);
127
+
128
+ setShowList(newList);
129
+ var newValue = newList.map(function (item) {
130
+ return item.condition;
131
+ });
132
+ setValue(newValue);
133
+ props.onChange(newValue);
134
+ }
135
+
136
+ function renderCondition(data) {
137
+ var condition = data.condition,
138
+ id = data.id;
139
+ var conditionDom = null;
140
+
141
+ if (condition.eventId === undefined) {
142
+ conditionDom = /*#__PURE__*/React.createElement(PropCondition, {
143
+ label: "\u5C5E\u6027",
144
+ attrs: condition.attrs,
145
+ dataId: id,
146
+ onChange: onChangeAttrs
147
+ });
148
+ }
149
+
150
+ if (condition.eventId === '-3') {
151
+ conditionDom = /*#__PURE__*/React.createElement(PeriodCondition, {
152
+ label: "\u65B0\u589E\u4E8E",
153
+ dataId: id,
154
+ onChange: onChangeRunPeriod,
155
+ runPeriod: condition.runPeriod
156
+ });
157
+ }
158
+
159
+ if (condition.eventId === '-4') {
160
+ conditionDom = /*#__PURE__*/React.createElement(PeriodCondition, {
161
+ label: "\u6D3B\u8DC3\u4E8E",
162
+ isRealTime: true,
163
+ dataId: id,
164
+ onChange: onChangeRunPeriod,
165
+ runPeriod: condition.runPeriod
166
+ });
167
+ }
168
+
169
+ if (util.isNumber(condition.eventId)) {
170
+ conditionDom = /*#__PURE__*/React.createElement(EventCondition, {
171
+ dataId: id,
172
+ onChange: onChangeEvent,
173
+ condition: condition
174
+ });
175
+ }
176
+
177
+ return /*#__PURE__*/React.createElement(ConditionWrap, {
178
+ key: id,
179
+ onDelte: function onDelte() {
180
+ return onDelete(id);
181
+ }
182
+ }, conditionDom);
183
+ }
184
+
185
+ return /*#__PURE__*/React.createElement("div", {
186
+ className: "".concat(classPrefix, "-or")
187
+ }, /*#__PURE__*/React.createElement("div", {
188
+ className: "".concat(classPrefix, "-or-content")
189
+ }, /*#__PURE__*/React.createElement(RelationLabel, {
190
+ show: showList.length >= 2
191
+ }, "\u6216"), /*#__PURE__*/React.createElement("div", {
192
+ className: "".concat(classPrefix, "-conditions")
193
+ }, showList.map(function (item) {
194
+ return renderCondition(item);
195
+ }))), /*#__PURE__*/React.createElement(ConditionTypeList, {
196
+ label: "\u6216",
197
+ onAdd: onAdd,
198
+ show: showList.length < orConditionNum
199
+ }));
200
+ };
201
+
202
+ export default OrConditions;
@@ -0,0 +1,6 @@
1
+ import React, { PropsWithChildren } from 'react';
2
+ import './styles/relationLabel.less';
3
+ declare const RelationLabel: React.FC<PropsWithChildren<{
4
+ show: boolean;
5
+ }>>;
6
+ export default RelationLabel;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import './styles/relationLabel.less';
3
+
4
+ var RelationLabel = function RelationLabel(props) {
5
+ return /*#__PURE__*/React.createElement("div", {
6
+ className: "biz-user-condition-relation"
7
+ }, props.show ? /*#__PURE__*/React.createElement("div", {
8
+ className: "biz-user-condition-relation-label"
9
+ }, props.children) : null);
10
+ };
11
+
12
+ export default RelationLabel;
@@ -0,0 +1,31 @@
1
+ @import '../../assets//styles//variable.less';
2
+ @import '../../commonStyle//variable.less';
3
+ .biz-user-condition-type-list {
4
+ display: flex;
5
+ align-items: center;
6
+ .biz-user-condition-type-label {
7
+ margin-right: 10px;
8
+ }
9
+ .biz-user-condition-type-container {
10
+ display: flex;
11
+ margin: 0;
12
+ padding: 0;
13
+ list-style: none;
14
+ .condition-type {
15
+ padding: @padding-xss 12px;
16
+ border: 1px solid @border-color-base;
17
+ border-radius: @border-radius-large;
18
+ cursor: pointer;
19
+ &:nth-child(n + 2) {
20
+ margin-left: @margin-md;
21
+ }
22
+ &:hover {
23
+ color: @themeColor;
24
+ background-color: @hoverBgColor;
25
+ }
26
+ &:active {
27
+ border-color: @themeColor;
28
+ }
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,14 @@
1
+ @import '../../assets//styles/variable.less';
2
+ .biz-user-condition-item-wrap {
3
+ display: flex;
4
+ justify-content: space-between;
5
+ width: 100%;
6
+ margin-bottom: @margin-xs;
7
+ .biz-user-condition-item {
8
+ flex: 1;
9
+ }
10
+ .biz-user-condition-item-delete {
11
+ margin-left: @margin-lg;
12
+ cursor: pointer;
13
+ }
14
+ }
@@ -0,0 +1,13 @@
1
+ @import '../../assets/styles/variable.less';
2
+ .biz-user-condition {
3
+ &-conditions-content {
4
+ display: flex;
5
+ .biz-user-condition-and-conditions-wrap {
6
+ flex: 1;
7
+ margin-bottom: @margin-md;
8
+ }
9
+ .biz-user-condition-and-conditions-empty {
10
+ margin-bottom: 0;
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,16 @@
1
+ @import '../../assets/styles/variable.less';
2
+ .biz-user-condition-or {
3
+ margin-bottom: @margin-md;
4
+ &-content {
5
+ display: flex;
6
+ width: 100%;
7
+ margin-bottom: @margin-md;
8
+ background: #ffffff;
9
+ border: 1px solid @border-color-base;
10
+ border-radius: @border-radius-small;
11
+ .biz-user-condition-conditions {
12
+ flex: 1;
13
+ padding: @padding-xs @padding-md 0 0;
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,18 @@
1
+ @import '../../commonStyle/variable.less';
2
+ .biz-user-condition-relation {
3
+ position: relative;
4
+ width: 2px;
5
+ margin-right: 30px;
6
+ background-color: @hoverBgColor;
7
+ &-label {
8
+ position: absolute;
9
+ top: 50%;
10
+ left: 50%;
11
+ width: 24px;
12
+ height: 24px;
13
+ line-height: 24px;
14
+ text-align: center;
15
+ background-color: @hoverBgColor;
16
+ transform: translate(-50%, -50%);
17
+ }
18
+ }