@zgfe/business-lib 1.0.16 → 1.0.18-esfix.1
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/chunks.less +3 -4
- package/es/assets/styles/resetAntd.less +46 -19
- package/es/assets/theme.js +1 -1
- package/es/attrConditions/components/operateList.d.ts +1 -0
- package/es/attrConditions/components/operateList.js +2 -2
- package/es/attrConditions/components/stringList.d.ts +1 -0
- package/es/attrConditions/components/stringList.js +67 -45
- package/es/attrConditions/components/valuesList.d.ts +1 -0
- package/es/attrConditions/components/valuesList.js +5 -4
- package/es/attrConditions/demo/index.js +7 -8
- package/es/attrConditions/index.js +14 -4
- package/es/attrConditions/styles/index.less +5 -4
- package/es/attrConditions/types.d.ts +3 -0
- package/es/attrConditions/utils/operates.js +2 -2
- package/es/attributeSelector/index.js +8 -4
- package/es/attributeSelector/listPanel.js +32 -19
- package/es/attributeSelector/styles/index.less +3 -3
- package/es/attributeSelector/types.d.ts +7 -0
- package/es/attributeSelector/types.js +8 -1
- package/es/attributeSelector/util.js +3 -2
- package/es/eventSelector/index.js +10 -4
- package/es/eventSelector/listPanel.js +2 -0
- package/es/eventSelector/styles/index.less +5 -5
- package/es/eventSelector/types.d.ts +4 -0
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/mock/event.js +214 -0
- package/es/select/demo/children.d.ts +2 -0
- package/es/select/demo/children.js +81 -0
- package/es/select/demo/customLabel.d.ts +2 -0
- package/es/select/demo/customLabel.js +23 -0
- package/es/select/demo/index.js +10 -4
- package/es/select/demo/multiple.js +10 -3
- package/es/select/handle.js +10 -8
- package/es/select/index.d.ts +2 -2
- package/es/select/index.js +12 -30
- package/es/select/option.js +8 -2
- package/es/select/overlay.js +31 -4
- package/es/select/styles/handle.less +29 -13
- package/es/select/types.d.ts +6 -3
- package/es/userCondition/conditionTypeList.js +29 -6
- package/es/userCondition/conditionWrap.js +4 -2
- package/es/userCondition/conditions/constants.d.ts +24 -0
- package/es/userCondition/conditions/constants.js +41 -0
- package/es/userCondition/conditions/eventCondition.js +13 -4
- package/es/userCondition/conditions/periodCondition.js +21 -10
- package/es/userCondition/conditions/propCondition.js +25 -6
- package/es/userCondition/conditions/runTimesCondition.js +2 -2
- package/es/userCondition/conditions/styles/eventCondition.less +9 -7
- package/es/userCondition/conditions/styles/periodCondition.less +12 -0
- package/es/userCondition/conditions/styles/propCondition.less +11 -3
- package/es/userCondition/conditions/styles/runTimesCondition.less +3 -0
- package/es/userCondition/conditions/styles/tagsCondition.less +20 -0
- package/es/userCondition/conditions/styles/textDesc.less +17 -0
- package/es/userCondition/conditions/tagsCondition.d.ts +9 -0
- package/es/userCondition/conditions/tagsCondition.js +107 -0
- package/es/userCondition/conditions/textDesc.d.ts +9 -0
- package/es/userCondition/conditions/textDesc.js +241 -0
- package/es/userCondition/demo/index.js +260 -31
- package/es/userCondition/index.d.ts +1 -1
- package/es/userCondition/index.js +52 -10
- package/es/userCondition/orConditions.js +69 -28
- package/es/userCondition/relationLabel.js +6 -1
- package/es/userCondition/styles/conditionTypeList.less +1 -1
- package/es/userCondition/styles/conditionWrap.less +3 -0
- package/es/userCondition/styles/index.less +21 -1
- package/es/userCondition/styles/orConditions.less +20 -2
- package/es/userCondition/styles/relationLabel.less +5 -4
- package/es/userCondition/types.d.ts +28 -2
- package/es/userCondition/util.d.ts +5 -1
- package/es/userCondition/util.js +42 -0
- package/es/userTagsSelector/cascaderOverlay.d.ts +5 -0
- package/es/userTagsSelector/cascaderOverlay.js +114 -0
- package/es/userTagsSelector/components/search/index.d.ts +8 -0
- package/es/userTagsSelector/components/search/index.js +16 -0
- package/es/userTagsSelector/components/search/index.less +6 -0
- package/es/userTagsSelector/context.d.ts +3 -0
- package/es/userTagsSelector/context.js +2 -0
- package/es/userTagsSelector/demo/index.d.ts +2 -0
- package/es/userTagsSelector/demo/index.js +48 -0
- package/es/userTagsSelector/groups/groupOption.d.ts +5 -0
- package/es/userTagsSelector/groups/groupOption.js +42 -0
- package/es/userTagsSelector/groups/index.d.ts +4 -0
- package/es/userTagsSelector/groups/index.js +86 -0
- package/es/userTagsSelector/groups/styles/index.less +0 -0
- package/es/userTagsSelector/groups/styles/option.less +50 -0
- package/es/userTagsSelector/index.d.ts +6 -0
- package/es/userTagsSelector/index.js +110 -0
- package/es/userTagsSelector/multipleCheckPanel/checkOption.d.ts +5 -0
- package/es/userTagsSelector/multipleCheckPanel/checkOption.js +45 -0
- package/es/userTagsSelector/multipleCheckPanel/index.d.ts +4 -0
- package/es/userTagsSelector/multipleCheckPanel/index.js +80 -0
- package/es/userTagsSelector/multipleCheckPanel/styles/index.less +0 -0
- package/es/userTagsSelector/multipleCheckPanel/styles/option.less +40 -0
- package/es/userTagsSelector/styles/cascaderOverlay.less +27 -0
- package/es/userTagsSelector/styles/index.less +10 -0
- package/es/userTagsSelector/types.d.ts +67 -0
- package/es/userTagsSelector/types.js +1 -0
- package/es/userTagsSelector/util.d.ts +4 -0
- package/es/userTagsSelector/util.js +38 -0
- package/es/utils/type.d.ts +2 -2
- package/package.json +6 -7
package/es/select/index.js
CHANGED
|
@@ -64,7 +64,7 @@ var BizSelect = function BizSelect(props) {
|
|
|
64
64
|
useEffect(function () {
|
|
65
65
|
var _boxRef$current;
|
|
66
66
|
|
|
67
|
-
setWidth(((_boxRef$current = boxRef.current) === null || _boxRef$current === void 0 ? void 0 : _boxRef$current.width) || 200);
|
|
67
|
+
setWidth((boxRef === null || boxRef === void 0 ? void 0 : (_boxRef$current = boxRef.current) === null || _boxRef$current === void 0 ? void 0 : _boxRef$current.width) || 200);
|
|
68
68
|
|
|
69
69
|
if (props.defaultValue) {
|
|
70
70
|
setCurrent(getValue(props.defaultValue));
|
|
@@ -132,41 +132,21 @@ var BizSelect = function BizSelect(props) {
|
|
|
132
132
|
if (props.onChange) props.onChange(data);
|
|
133
133
|
};
|
|
134
134
|
|
|
135
|
-
var onCreate = function onCreate(val) {
|
|
136
|
-
var _newItem;
|
|
137
|
-
|
|
138
|
-
var data = _.cloneDeep(current) || [];
|
|
139
|
-
var newItem = (_newItem = {}, _defineProperty(_newItem, keyField, val), _defineProperty(_newItem, labelField, val), _newItem);
|
|
140
|
-
var flag = false;
|
|
141
|
-
current === null || current === void 0 ? void 0 : current.forEach(function (item) {
|
|
142
|
-
if (item[labelField] === val) {
|
|
143
|
-
flag = true;
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
setSearchValue('');
|
|
148
|
-
|
|
149
|
-
if (!flag) {
|
|
150
|
-
newItem = getCheckedData(newItem);
|
|
151
|
-
data.push(newItem);
|
|
152
|
-
setCurrent(data);
|
|
153
|
-
if (props.onChange) props.onChange(data);
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
|
|
157
135
|
var onChange = function onChange(option) {
|
|
158
136
|
setCurrent(option);
|
|
159
137
|
setSearchValue('');
|
|
160
138
|
|
|
161
139
|
if (!props.multiple) {
|
|
162
|
-
|
|
140
|
+
onVisibleChange(false);
|
|
163
141
|
}
|
|
164
142
|
|
|
165
143
|
if (props.onChange) props.onChange(option);
|
|
166
144
|
};
|
|
167
145
|
|
|
168
146
|
var onVisibleChange = function onVisibleChange(flag) {
|
|
147
|
+
setSearchValue('');
|
|
169
148
|
setVisible(flag);
|
|
149
|
+
props.onVisibleChange && props.onVisibleChange(flag);
|
|
170
150
|
};
|
|
171
151
|
|
|
172
152
|
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
@@ -178,7 +158,7 @@ var BizSelect = function BizSelect(props) {
|
|
|
178
158
|
onChange: onChange
|
|
179
159
|
})),
|
|
180
160
|
disabled: props.disable,
|
|
181
|
-
destroyPopupOnHide:
|
|
161
|
+
destroyPopupOnHide: props.destroyPopupOnHide,
|
|
182
162
|
overlayStyle: {
|
|
183
163
|
minWidth: minDropdownWidth || 0,
|
|
184
164
|
width: overlayWidth || width
|
|
@@ -193,7 +173,7 @@ var BizSelect = function BizSelect(props) {
|
|
|
193
173
|
className: "".concat(classPrefix, "-handle ").concat(props.className ? props.className : ''),
|
|
194
174
|
ref: selectRef,
|
|
195
175
|
id: selectId
|
|
196
|
-
}, /*#__PURE__*/React.createElement(SelectHandle, {
|
|
176
|
+
}, props.children ? props.children : /*#__PURE__*/React.createElement(SelectHandle, {
|
|
197
177
|
ref: boxRef,
|
|
198
178
|
value: current,
|
|
199
179
|
labelField: labelField,
|
|
@@ -201,19 +181,21 @@ var BizSelect = function BizSelect(props) {
|
|
|
201
181
|
keyField: keyField,
|
|
202
182
|
disable: props.disable,
|
|
203
183
|
multiple: props.multiple,
|
|
204
|
-
enableCreate: props.enableCreate,
|
|
205
184
|
theme: props.theme,
|
|
206
185
|
size: props.size,
|
|
207
186
|
border: props.border,
|
|
208
187
|
onDelete: onDelete,
|
|
209
|
-
onSearch:
|
|
210
|
-
|
|
188
|
+
onSearch: function onSearch(v) {
|
|
189
|
+
setSearchValue(v);
|
|
190
|
+
if (props.onSearch) props.onSearch(v);
|
|
191
|
+
}
|
|
211
192
|
})));
|
|
212
193
|
};
|
|
213
194
|
|
|
214
195
|
BizSelect.defaultProps = {
|
|
215
196
|
labelField: 'label',
|
|
216
197
|
keyField: 'id',
|
|
217
|
-
popupContainer: true
|
|
198
|
+
popupContainer: true,
|
|
199
|
+
destroyPopupOnHide: true
|
|
218
200
|
};
|
|
219
201
|
export default BizSelect;
|
package/es/select/option.js
CHANGED
|
@@ -8,7 +8,8 @@ var SelectOption = function SelectOption(props) {
|
|
|
8
8
|
group = props.group,
|
|
9
9
|
checked = props.checked,
|
|
10
10
|
disabled = props.disabled,
|
|
11
|
-
multiple = props.multiple
|
|
11
|
+
multiple = props.multiple,
|
|
12
|
+
customLabel = props.customLabel;
|
|
12
13
|
|
|
13
14
|
function onClick() {
|
|
14
15
|
if (disabled) return;
|
|
@@ -29,6 +30,11 @@ var SelectOption = function SelectOption(props) {
|
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
function renderLabel(option) {
|
|
34
|
+
var dom = getLabel(option[props.labelField]);
|
|
35
|
+
return customLabel ? customLabel(dom, option) : dom;
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
if (group) {
|
|
33
39
|
return /*#__PURE__*/React.createElement("div", {
|
|
34
40
|
className: "".concat(classPrefix, "-group")
|
|
@@ -51,7 +57,7 @@ var SelectOption = function SelectOption(props) {
|
|
|
51
57
|
className: "".concat(classPrefix, "-option-icon")
|
|
52
58
|
}, option === null || option === void 0 ? void 0 : option.icon), /*#__PURE__*/React.createElement("span", {
|
|
53
59
|
className: "".concat(classPrefix, "-option-label")
|
|
54
|
-
},
|
|
60
|
+
}, renderLabel(option)), !disabled && /*#__PURE__*/React.createElement("span", {
|
|
55
61
|
className: "".concat(classPrefix, "-option-btn")
|
|
56
62
|
}, props.extra && props.extra(option)));
|
|
57
63
|
};
|
package/es/select/overlay.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
|
|
1
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
4
|
|
|
3
5
|
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."); }
|
|
@@ -25,7 +27,8 @@ var SelectOverlay = function SelectOverlay(props) {
|
|
|
25
27
|
multiple = props.multiple,
|
|
26
28
|
disableItemList = props.disableItemList,
|
|
27
29
|
dropdownExtra = props.dropdownExtra,
|
|
28
|
-
loading = props.loading
|
|
30
|
+
loading = props.loading,
|
|
31
|
+
customLabel = props.customLabel;
|
|
29
32
|
|
|
30
33
|
var _useState = useState(),
|
|
31
34
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -96,11 +99,23 @@ var SelectOverlay = function SelectOverlay(props) {
|
|
|
96
99
|
|
|
97
100
|
function getOptionDom(data, ids) {
|
|
98
101
|
var optionsDom = [];
|
|
99
|
-
|
|
102
|
+
|
|
103
|
+
var list = _.cloneDeep(data);
|
|
104
|
+
|
|
105
|
+
if (props.enableCreate && searchValue) {
|
|
106
|
+
var _list$push;
|
|
107
|
+
|
|
108
|
+
list.push((_list$push = {}, _defineProperty(_list$push, props.keyField, searchValue), _defineProperty(_list$push, props.labelField, searchValue), _defineProperty(_list$push, "isTemp", true), _list$push));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
var tempOption = null;
|
|
112
|
+
var useTemp = true;
|
|
113
|
+
list.forEach(function (option) {
|
|
100
114
|
if (searchValue && !new RegExp(searchValue, 'i').test(option[labelField])) return;
|
|
115
|
+
if (searchValue && searchValue === option[labelField] && !option.isTemp) useTemp = false;
|
|
101
116
|
var disabled = false;
|
|
102
117
|
disableItemList === null || disableItemList === void 0 ? void 0 : disableItemList.forEach(function (item) {
|
|
103
|
-
if (item[keyField] === option[keyField]
|
|
118
|
+
if (item[keyField] === option[keyField]) {
|
|
104
119
|
disabled = true;
|
|
105
120
|
}
|
|
106
121
|
});
|
|
@@ -116,10 +131,22 @@ var SelectOverlay = function SelectOverlay(props) {
|
|
|
116
131
|
multiple: multiple,
|
|
117
132
|
onClick: onClick,
|
|
118
133
|
disabled: disabled,
|
|
119
|
-
key: option[keyField] || String(Math.random())
|
|
134
|
+
key: option[keyField] || String(Math.random()),
|
|
135
|
+
customLabel: customLabel
|
|
120
136
|
});
|
|
137
|
+
|
|
138
|
+
if (option.isTemp) {
|
|
139
|
+
tempOption = dom;
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
121
143
|
optionsDom.push(dom);
|
|
122
144
|
});
|
|
145
|
+
|
|
146
|
+
if (useTemp) {
|
|
147
|
+
optionsDom.push(tempOption);
|
|
148
|
+
}
|
|
149
|
+
|
|
123
150
|
return optionsDom;
|
|
124
151
|
}
|
|
125
152
|
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
height: auto;
|
|
46
46
|
min-height: @height-lg;
|
|
47
47
|
overflow: visible;
|
|
48
|
-
|
|
48
|
+
line-height: 1;
|
|
49
49
|
&.sm {
|
|
50
50
|
height: auto;
|
|
51
51
|
min-height: @height-sm;
|
|
@@ -69,6 +69,12 @@
|
|
|
69
69
|
box-shadow: none;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
+
&-temp {
|
|
73
|
+
position: absolute;
|
|
74
|
+
top: -999999999999999px;
|
|
75
|
+
padding: 0 @padding-sm;
|
|
76
|
+
font-size: @font-size-base;
|
|
77
|
+
}
|
|
72
78
|
|
|
73
79
|
&-single-input {
|
|
74
80
|
.__default-overflow();
|
|
@@ -87,19 +93,29 @@
|
|
|
87
93
|
font-size: @font-size-lg;
|
|
88
94
|
transform: translateY(-50%);
|
|
89
95
|
}
|
|
96
|
+
&-input {
|
|
97
|
+
#biz-select-handle-tag {
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
margin: 2px 4px 2px 0;
|
|
101
|
+
padding: 0 4px;
|
|
102
|
+
padding-top: 1px;
|
|
103
|
+
padding-bottom: 1px;
|
|
104
|
+
background: none;
|
|
105
|
+
border-color: #cacdd4;
|
|
106
|
+
border-radius: @border-radius-small;
|
|
107
|
+
&-label {
|
|
108
|
+
min-width: 0;
|
|
109
|
+
max-width: 100px;
|
|
110
|
+
overflow: hidden;
|
|
111
|
+
text-overflow: ellipsis;
|
|
112
|
+
}
|
|
113
|
+
&:hover {
|
|
114
|
+
.__default-hover();
|
|
90
115
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
margin: 2px 4px 2px 0;
|
|
95
|
-
background: none;
|
|
96
|
-
border-color: #cacdd4;
|
|
97
|
-
|
|
98
|
-
&:hover {
|
|
99
|
-
.__default-hover();
|
|
100
|
-
|
|
101
|
-
.anticon {
|
|
102
|
-
color: @primary-color;
|
|
116
|
+
.anticon {
|
|
117
|
+
color: @primary-color;
|
|
118
|
+
}
|
|
103
119
|
}
|
|
104
120
|
}
|
|
105
121
|
}
|
package/es/select/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare namespace BizSelectTypes {
|
|
|
6
6
|
}
|
|
7
7
|
interface Option {
|
|
8
8
|
icon?: ReactNode;
|
|
9
|
-
[otherProp: string]: any;
|
|
9
|
+
[otherProp: string | symbol | number]: any;
|
|
10
10
|
}
|
|
11
11
|
interface Props {
|
|
12
12
|
disable?: boolean;
|
|
@@ -34,6 +34,10 @@ export declare namespace BizSelectTypes {
|
|
|
34
34
|
notFound?: string | ReactNode;
|
|
35
35
|
loading?: boolean;
|
|
36
36
|
onChange?: (val: Option) => void;
|
|
37
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
38
|
+
destroyPopupOnHide?: boolean;
|
|
39
|
+
customLabel?: (node: ReactNode, option: Option) => ReactNode;
|
|
40
|
+
onSearch?: (val: string) => void;
|
|
37
41
|
}
|
|
38
42
|
interface OverlayProps {
|
|
39
43
|
option?: Option;
|
|
@@ -49,6 +53,7 @@ export declare namespace BizSelectTypes {
|
|
|
49
53
|
labelField?: string;
|
|
50
54
|
extra?: (option: Option) => ReactNode;
|
|
51
55
|
onClick?: (option: Option) => void;
|
|
56
|
+
customLabel?: (node: ReactNode, option: Option) => ReactNode;
|
|
52
57
|
}
|
|
53
58
|
}
|
|
54
59
|
export interface HandlerTypes {
|
|
@@ -56,7 +61,6 @@ export interface HandlerTypes {
|
|
|
56
61
|
placeholder?: string;
|
|
57
62
|
value?: BizSelectTypes.Option | BizSelectTypes.Option[];
|
|
58
63
|
multiple?: boolean;
|
|
59
|
-
enableCreate?: boolean;
|
|
60
64
|
labelField?: string;
|
|
61
65
|
keyField?: string | number;
|
|
62
66
|
disable?: boolean;
|
|
@@ -65,5 +69,4 @@ export interface HandlerTypes {
|
|
|
65
69
|
border?: boolean;
|
|
66
70
|
onDelete?: (data: BizSelectTypes.Option) => void;
|
|
67
71
|
onSearch?: (val: string) => void;
|
|
68
|
-
onCreate?: (val: string) => void;
|
|
69
72
|
}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
2
|
import { Space } from 'antd';
|
|
3
3
|
import { PlusOutlined } from '@ant-design/icons';
|
|
4
4
|
import './styles/conditionTypeList.less';
|
|
5
|
+
import { BizUserConditionContext } from '.';
|
|
5
6
|
|
|
6
7
|
var ConditionTypeList = function ConditionTypeList(props) {
|
|
7
8
|
var onAdd = props.onAdd,
|
|
8
9
|
label = props.label,
|
|
9
10
|
show = props.show;
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
var _useContext = useContext(BizUserConditionContext),
|
|
13
|
+
textMode = _useContext.textMode,
|
|
14
|
+
openTagCondition = _useContext.openTagCondition;
|
|
15
|
+
|
|
16
|
+
if (!show || textMode) return null;
|
|
11
17
|
return /*#__PURE__*/React.createElement("div", {
|
|
12
18
|
className: "biz-user-condition-type-list"
|
|
13
19
|
}, label ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -16,25 +22,42 @@ var ConditionTypeList = function ConditionTypeList(props) {
|
|
|
16
22
|
className: "biz-user-condition-type-container"
|
|
17
23
|
}, /*#__PURE__*/React.createElement("li", {
|
|
18
24
|
className: "condition-type",
|
|
25
|
+
key: "event",
|
|
19
26
|
onClick: function onClick() {
|
|
20
27
|
return onAdd('event');
|
|
21
28
|
}
|
|
22
|
-
}, /*#__PURE__*/React.createElement(Space,
|
|
29
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
30
|
+
key: "event"
|
|
31
|
+
}, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u505A\u8FC7\uFF08\u6CA1\u505A\u8FC7\uFF09\u2026"))), /*#__PURE__*/React.createElement("li", {
|
|
23
32
|
className: "condition-type",
|
|
33
|
+
key: "add",
|
|
24
34
|
onClick: function onClick() {
|
|
25
35
|
return onAdd('add');
|
|
26
36
|
}
|
|
27
|
-
}, /*#__PURE__*/React.createElement(Space,
|
|
37
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
38
|
+
key: "add"
|
|
39
|
+
}, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u65B0\u589E\u4E8E"))), /*#__PURE__*/React.createElement("li", {
|
|
28
40
|
className: "condition-type",
|
|
41
|
+
key: "active",
|
|
29
42
|
onClick: function onClick() {
|
|
30
43
|
return onAdd('active');
|
|
31
44
|
}
|
|
32
|
-
}, /*#__PURE__*/React.createElement(Space,
|
|
45
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
46
|
+
key: "active"
|
|
47
|
+
}, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u6D3B\u8DC3\u4E8E"))), /*#__PURE__*/React.createElement("li", {
|
|
33
48
|
className: "condition-type",
|
|
49
|
+
key: "prop",
|
|
34
50
|
onClick: function onClick() {
|
|
35
51
|
return onAdd('prop');
|
|
36
52
|
}
|
|
37
|
-
}, /*#__PURE__*/React.createElement(Space,
|
|
53
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
54
|
+
key: "prop"
|
|
55
|
+
}, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u7528\u6237\u5C5E\u6027\u6EE1\u8DB3"))), openTagCondition ? /*#__PURE__*/React.createElement("li", {
|
|
56
|
+
className: "condition-type",
|
|
57
|
+
onClick: function onClick() {
|
|
58
|
+
return onAdd('tag');
|
|
59
|
+
}
|
|
60
|
+
}, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u7528\u6237\u6807\u7B7E"))) : null));
|
|
38
61
|
};
|
|
39
62
|
|
|
40
63
|
ConditionTypeList.defaultProps = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import IconFont from '../icon/iconFont';
|
|
3
3
|
import './styles/conditionWrap.less';
|
|
4
4
|
|
|
5
5
|
var ConditionWrap = function ConditionWrap(props) {
|
|
@@ -12,7 +12,9 @@ var ConditionWrap = function ConditionWrap(props) {
|
|
|
12
12
|
onClick: function onClick() {
|
|
13
13
|
return props.onDelte();
|
|
14
14
|
}
|
|
15
|
-
}, /*#__PURE__*/React.createElement(
|
|
15
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
16
|
+
type: "qingchu"
|
|
17
|
+
})));
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
export default ConditionWrap;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const operatorMap: {
|
|
2
|
+
relative: string;
|
|
3
|
+
absolute: string;
|
|
4
|
+
unlimited_time: string;
|
|
5
|
+
join_time: string;
|
|
6
|
+
'is not null': string;
|
|
7
|
+
'is null': string;
|
|
8
|
+
'not contains': string;
|
|
9
|
+
contains: string;
|
|
10
|
+
equal: string;
|
|
11
|
+
'not equal': string;
|
|
12
|
+
'begin with': string;
|
|
13
|
+
'not begin with': string;
|
|
14
|
+
'end with': string;
|
|
15
|
+
'not end with': string;
|
|
16
|
+
'=': string;
|
|
17
|
+
'<': string;
|
|
18
|
+
'>': string;
|
|
19
|
+
'>=': string;
|
|
20
|
+
'<=': string;
|
|
21
|
+
};
|
|
22
|
+
export declare const durationHandler: {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export var operatorMap = {
|
|
2
|
+
relative: '最近',
|
|
3
|
+
absolute: '固定时段',
|
|
4
|
+
unlimited_time: '任意时间',
|
|
5
|
+
join_time: '新增后',
|
|
6
|
+
'is not null': '不是空值',
|
|
7
|
+
'is null': '是空值',
|
|
8
|
+
'not contains': '不包含',
|
|
9
|
+
contains: '包含',
|
|
10
|
+
equal: '是',
|
|
11
|
+
'not equal': '不是',
|
|
12
|
+
'begin with': '开头是',
|
|
13
|
+
'not begin with': '开头不是',
|
|
14
|
+
'end with': '结尾是',
|
|
15
|
+
'not end with': '结尾不是',
|
|
16
|
+
'=': '=',
|
|
17
|
+
'<': '<',
|
|
18
|
+
'>': '>',
|
|
19
|
+
'>=': '≥',
|
|
20
|
+
'<=': '≤'
|
|
21
|
+
};
|
|
22
|
+
export var durationHandler = {
|
|
23
|
+
1: {
|
|
24
|
+
unit: '时',
|
|
25
|
+
format: function format(s) {
|
|
26
|
+
return Number(s) / 3600;
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
2: {
|
|
30
|
+
unit: '分',
|
|
31
|
+
format: function format(s) {
|
|
32
|
+
return Number(s) / 60;
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
3: {
|
|
36
|
+
unit: '秒',
|
|
37
|
+
format: function format(s) {
|
|
38
|
+
return s;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
@@ -4,16 +4,19 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
|
-
import React from 'react';
|
|
7
|
+
import React, { useContext } from 'react';
|
|
8
8
|
import { RightOutlined } from '@ant-design/icons';
|
|
9
9
|
import BizEventSelector from '../../eventSelector';
|
|
10
10
|
import RunTimesCondition from './runTimesCondition';
|
|
11
11
|
import PeriodCondition from './periodCondition';
|
|
12
12
|
import PropCondition from './propCondition';
|
|
13
13
|
import './styles/eventCondition.less';
|
|
14
|
-
import { classPrefix } from '..';
|
|
14
|
+
import { BizUserConditionContext, classPrefix } from '..';
|
|
15
15
|
|
|
16
16
|
var EventCondition = function EventCondition(props) {
|
|
17
|
+
var _useContext = useContext(BizUserConditionContext),
|
|
18
|
+
isRealTime = _useContext.isRealTime;
|
|
19
|
+
|
|
17
20
|
var condition = props.condition,
|
|
18
21
|
dataId = props.dataId;
|
|
19
22
|
|
|
@@ -70,7 +73,12 @@ var EventCondition = function EventCondition(props) {
|
|
|
70
73
|
id: condition.eventId
|
|
71
74
|
}
|
|
72
75
|
},
|
|
73
|
-
onChange: onEventChange
|
|
76
|
+
onChange: onEventChange,
|
|
77
|
+
border: false,
|
|
78
|
+
theme: "normal",
|
|
79
|
+
placeholder: "\u9009\u62E9\u4E00\u4E2A\u4E8B\u4EF6",
|
|
80
|
+
destroyPopupOnHide: true,
|
|
81
|
+
defaultSelectAble: false
|
|
74
82
|
})), /*#__PURE__*/React.createElement("div", {
|
|
75
83
|
className: "".concat(classPrefix, "-event-condition-expand-attr"),
|
|
76
84
|
onClick: onAddAttr
|
|
@@ -97,7 +105,8 @@ var EventCondition = function EventCondition(props) {
|
|
|
97
105
|
dataId: dataId,
|
|
98
106
|
runPeriod: condition.runPeriod,
|
|
99
107
|
onChange: onPeriodChange,
|
|
100
|
-
isEvent: true
|
|
108
|
+
isEvent: true,
|
|
109
|
+
isRealTime: isRealTime
|
|
101
110
|
})))));
|
|
102
111
|
};
|
|
103
112
|
|
|
@@ -4,19 +4,14 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
|
-
import React from 'react';
|
|
7
|
+
import React, { useMemo } from 'react';
|
|
8
8
|
import BizSelect from '../../select';
|
|
9
9
|
import { Input, DatePicker, Checkbox } from 'antd';
|
|
10
10
|
import moment from 'moment';
|
|
11
11
|
import './styles/periodCondition.less';
|
|
12
12
|
import { classPrefix } from '..';
|
|
13
|
+
import { operatorMap } from './constants';
|
|
13
14
|
var RangePicker = DatePicker.RangePicker;
|
|
14
|
-
var operatorMap = {
|
|
15
|
-
relative: '最近',
|
|
16
|
-
absolute: '固定时段',
|
|
17
|
-
unlimited_time: '任意时间',
|
|
18
|
-
join_time: '新增后'
|
|
19
|
-
};
|
|
20
15
|
|
|
21
16
|
var PeriodCondition = function PeriodCondition(props) {
|
|
22
17
|
var dataId = props.dataId,
|
|
@@ -36,11 +31,21 @@ var PeriodCondition = function PeriodCondition(props) {
|
|
|
36
31
|
text: '任意时间',
|
|
37
32
|
value: 'unlimited_time'
|
|
38
33
|
}, {
|
|
39
|
-
text: '
|
|
34
|
+
text: '新增后*',
|
|
40
35
|
value: 'join_time'
|
|
41
36
|
}]);
|
|
42
37
|
}
|
|
43
38
|
|
|
39
|
+
var unit = useMemo(function () {
|
|
40
|
+
if (runPeriod.operator === 'absolute' || runPeriod.operator === 'unlimited_time') {
|
|
41
|
+
return '';
|
|
42
|
+
} else if (runPeriod.operator === 'relative') {
|
|
43
|
+
return '天';
|
|
44
|
+
} else if (runPeriod.operator === 'join_time') {
|
|
45
|
+
return '天内';
|
|
46
|
+
}
|
|
47
|
+
}, [runPeriod.operator]);
|
|
48
|
+
|
|
44
49
|
function onChange(data) {
|
|
45
50
|
props.onChange(dataId, data);
|
|
46
51
|
}
|
|
@@ -113,6 +118,7 @@ var PeriodCondition = function PeriodCondition(props) {
|
|
|
113
118
|
|
|
114
119
|
if (operator === 'absolute') {
|
|
115
120
|
return /*#__PURE__*/React.createElement(RangePicker, {
|
|
121
|
+
size: "large",
|
|
116
122
|
defaultValue: [moment(values[0]), moment(values[1])],
|
|
117
123
|
onChange: onDateChange,
|
|
118
124
|
allowClear: false
|
|
@@ -127,7 +133,12 @@ var PeriodCondition = function PeriodCondition(props) {
|
|
|
127
133
|
}, label) : null, /*#__PURE__*/React.createElement("div", {
|
|
128
134
|
className: "".concat(classPrefix, "-period-condition-operator")
|
|
129
135
|
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
130
|
-
|
|
136
|
+
dropdownExtra: isEvent ? /*#__PURE__*/React.createElement("div", {
|
|
137
|
+
style: {
|
|
138
|
+
lineHeight: '29px'
|
|
139
|
+
}
|
|
140
|
+
}, "*\u7528\u6237\u65B0\u589E\u6570\u636E\u4E3A\u6BCF\u65E5\u51CC\u6668\u751F\u6210") : null,
|
|
141
|
+
overlayWidth: isEvent ? 210 : 114,
|
|
131
142
|
options: options,
|
|
132
143
|
labelField: "text",
|
|
133
144
|
keyField: "value",
|
|
@@ -140,7 +151,7 @@ var PeriodCondition = function PeriodCondition(props) {
|
|
|
140
151
|
className: "".concat(classPrefix, "-period-condition-values")
|
|
141
152
|
}, renderValues()), /*#__PURE__*/React.createElement("div", {
|
|
142
153
|
className: "".concat(classPrefix, "-period-condition-unit")
|
|
143
|
-
},
|
|
154
|
+
}, unit), props.isRealTime && runPeriod.operator === 'relative' ? /*#__PURE__*/React.createElement("div", {
|
|
144
155
|
className: "".concat(classPrefix, "-period-condition-today")
|
|
145
156
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
146
157
|
checked: runPeriod.values[1] === '1',
|
|
@@ -31,6 +31,7 @@ import './styles/propCondition.less';
|
|
|
31
31
|
import { useContext } from 'react';
|
|
32
32
|
import { BizUserConditionContext, classPrefix } from '..';
|
|
33
33
|
import { transformNumberOperate } from '../util';
|
|
34
|
+
import { PropType } from '../../attributeSelector/types';
|
|
34
35
|
var numAttrTypeMap = {
|
|
35
36
|
1: 'cont-string',
|
|
36
37
|
2: 'cont-num',
|
|
@@ -44,12 +45,17 @@ var attrNumTypeMap = {
|
|
|
44
45
|
|
|
45
46
|
var PropCondition = function PropCondition(props) {
|
|
46
47
|
var _useContext = useContext(BizUserConditionContext),
|
|
47
|
-
|
|
48
|
+
envNameList = _useContext.envNameList,
|
|
49
|
+
userPropsMap = _useContext.userPropsMap;
|
|
50
|
+
|
|
51
|
+
var _useContext2 = useContext(BizUserConditionContext),
|
|
52
|
+
eventAttrNum = _useContext2.eventAttrNum;
|
|
48
53
|
|
|
49
54
|
var isEvent = props.isEvent,
|
|
50
55
|
label = props.label,
|
|
51
56
|
attrs = props.attrs,
|
|
52
|
-
dataId = props.dataId
|
|
57
|
+
dataId = props.dataId,
|
|
58
|
+
eventId = props.eventId;
|
|
53
59
|
|
|
54
60
|
var _useState = useState([]),
|
|
55
61
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -97,8 +103,8 @@ var PropCondition = function PropCondition(props) {
|
|
|
97
103
|
var newAttr = {
|
|
98
104
|
attrName: attrName,
|
|
99
105
|
attrId: attrId,
|
|
100
|
-
category: category,
|
|
101
|
-
operator: transformNumberOperate(operator),
|
|
106
|
+
category: category || 'custom',
|
|
107
|
+
operator: type === PropType.NUMBER ? transformNumberOperate(operator) : operator,
|
|
102
108
|
params: values,
|
|
103
109
|
attrType: numAttrTypeMap[type]
|
|
104
110
|
};
|
|
@@ -130,7 +136,9 @@ var PropCondition = function PropCondition(props) {
|
|
|
130
136
|
|
|
131
137
|
function getPropCategory(attrName) {
|
|
132
138
|
if (!isEvent) return 'userProp';
|
|
133
|
-
|
|
139
|
+
if (attrName === undefined) return 'eventProp';
|
|
140
|
+
if (envNameList.includes(attrName)) return 'envProp';
|
|
141
|
+
return 'eventProp';
|
|
134
142
|
}
|
|
135
143
|
|
|
136
144
|
function renderAttr(item, i) {
|
|
@@ -154,6 +162,14 @@ var PropCondition = function PropCondition(props) {
|
|
|
154
162
|
type: attrNumTypeMap[attrType]
|
|
155
163
|
};
|
|
156
164
|
attrId && (props.defaultValue.attrId = attrId);
|
|
165
|
+
|
|
166
|
+
if (userPropsMap[attrName] && userPropsMap[attrName].subtype) {
|
|
167
|
+
props.defaultValue.subtype = userPropsMap[attrName].subtype;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (isEvent) {
|
|
172
|
+
props.eventIdList = [eventId];
|
|
157
173
|
}
|
|
158
174
|
|
|
159
175
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -171,7 +187,10 @@ var PropCondition = function PropCondition(props) {
|
|
|
171
187
|
onDelete: function onDelete() {
|
|
172
188
|
return onRemoveAttr(i);
|
|
173
189
|
},
|
|
174
|
-
enableDelete: isEvent
|
|
190
|
+
enableDelete: isEvent,
|
|
191
|
+
border: false,
|
|
192
|
+
destroyPopupOnHide: true,
|
|
193
|
+
theme: "normal"
|
|
175
194
|
}, props))));
|
|
176
195
|
}
|
|
177
196
|
|