assui 3.1.42 → 3.1.44
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/label-condition-select-input/index.d.ts +2 -0
- package/es/label-condition-select-input/index.js +14 -3
- package/es/label-select/index.d.ts +2 -5
- package/es/label-select/index.js +8 -4
- package/lib/label-condition-select-input/index.d.ts +2 -0
- package/lib/label-condition-select-input/index.js +13 -2
- package/lib/label-select/index.d.ts +2 -5
- package/lib/label-select/index.js +8 -4
- package/package.json +2 -2
|
@@ -5,6 +5,7 @@ export declare enum InputTypeEnum {
|
|
|
5
5
|
CONDITION_INPUT = "conditionInput",
|
|
6
6
|
SELECT = "select"
|
|
7
7
|
}
|
|
8
|
+
declare type ChangeSelectType = typeof InputTypeEnum[keyof typeof InputTypeEnum];
|
|
8
9
|
declare type SelectOptionsType = {
|
|
9
10
|
value: number;
|
|
10
11
|
label: string;
|
|
@@ -27,6 +28,7 @@ export interface LabelConditionSelectInputProps {
|
|
|
27
28
|
conditionInputProps?: LabelConditionInputProps;
|
|
28
29
|
/** 联动selectProps */
|
|
29
30
|
conditionSelectProps?: LabelSelectProps;
|
|
31
|
+
onChangeSelectType?: (changeSelectType: ChangeSelectType, value?: ValueType) => void;
|
|
30
32
|
/** onChange */
|
|
31
33
|
onChange?: (value: ValueType) => void;
|
|
32
34
|
/** onBlur */
|
|
@@ -37,7 +37,7 @@ var __read = this && this.__read || function (o, n) {
|
|
|
37
37
|
import isNil from 'lodash/isNil';
|
|
38
38
|
import isEmpty from 'lodash/isEmpty';
|
|
39
39
|
import classNames from 'classnames';
|
|
40
|
-
import React, { useEffect, useState } from 'react';
|
|
40
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
41
41
|
import useControllableValue from "ahooks/es/useControllableValue";
|
|
42
42
|
import LabelConditionInput from '../label-condition-input';
|
|
43
43
|
import LabelSelect from '../label-select';
|
|
@@ -66,6 +66,7 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
66
66
|
inputType = _b === void 0 ? InputTypeEnum.CONDITION_INPUT : _b,
|
|
67
67
|
_c = props.optionsList,
|
|
68
68
|
optionsList = _c === void 0 ? [] : _c,
|
|
69
|
+
onChangeSelectType = props.onChangeSelectType,
|
|
69
70
|
label = props.label,
|
|
70
71
|
className = props.className,
|
|
71
72
|
onBlur = props.onBlur;
|
|
@@ -76,6 +77,7 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
76
77
|
var _e = __read(useState([]), 2),
|
|
77
78
|
subSelectOptions = _e[0],
|
|
78
79
|
setSubSelectOptions = _e[1];
|
|
80
|
+
var subSelectRef = useRef();
|
|
79
81
|
/** 子选择器是否多选 */
|
|
80
82
|
var isSubSelectMultiple = (conditionSelectProps === null || conditionSelectProps === void 0 ? void 0 : conditionSelectProps.mode) === 'multiple';
|
|
81
83
|
useEffect(function () {
|
|
@@ -101,6 +103,7 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
101
103
|
});
|
|
102
104
|
}
|
|
103
105
|
setSelectInputValue(finalSelectInputValue);
|
|
106
|
+
onChangeSelectType === null || onChangeSelectType === void 0 ? void 0 : onChangeSelectType(InputTypeEnum.SELECT, finalSelectInputValue);
|
|
104
107
|
if (isInput || isNil(selectValue)) {
|
|
105
108
|
setSubSelectOptions([]);
|
|
106
109
|
return;
|
|
@@ -114,10 +117,12 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
114
117
|
}
|
|
115
118
|
};
|
|
116
119
|
var onInputChange = function onInputChange(inputValue) {
|
|
117
|
-
|
|
120
|
+
var finalValue = {
|
|
118
121
|
selectValue: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
119
122
|
inputValue: inputValue
|
|
120
|
-
}
|
|
123
|
+
};
|
|
124
|
+
setSelectInputValue(finalValue);
|
|
125
|
+
onChangeSelectType === null || onChangeSelectType === void 0 ? void 0 : onChangeSelectType(InputTypeEnum.SELECT, finalValue);
|
|
121
126
|
};
|
|
122
127
|
var onTypeSelectChange = function onTypeSelectChange(inputValue) {
|
|
123
128
|
var finalSelectInputValue = {
|
|
@@ -130,6 +135,7 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
130
135
|
});
|
|
131
136
|
}
|
|
132
137
|
setSelectInputValue(finalSelectInputValue);
|
|
138
|
+
onChangeSelectType === null || onChangeSelectType === void 0 ? void 0 : onChangeSelectType(InputTypeEnum.CONDITION_INPUT, finalSelectInputValue);
|
|
133
139
|
};
|
|
134
140
|
/** 联级选择框失去焦点 */
|
|
135
141
|
var onLabelConditionSelectInputBlur = function onLabelConditionSelectInputBlur() {
|
|
@@ -166,9 +172,14 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
166
172
|
})) : /*#__PURE__*/React.createElement("div", {
|
|
167
173
|
className: "label-condition-select-second-select"
|
|
168
174
|
}, /*#__PURE__*/React.createElement(LabelSelect, __assign({}, conditionSelectProps, {
|
|
175
|
+
ref: subSelectRef,
|
|
169
176
|
onChange: onTypeSelectChange,
|
|
170
177
|
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.inputValue,
|
|
171
178
|
options: subSelectOptions,
|
|
179
|
+
onDeselect: function onDeselect() {
|
|
180
|
+
var _a;
|
|
181
|
+
(_a = subSelectRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
182
|
+
},
|
|
172
183
|
onBlur: onLabelConditionSelectInputBlur,
|
|
173
184
|
onClear: onTypeSelectClear
|
|
174
185
|
})));
|
|
@@ -5,8 +5,5 @@ export { Option };
|
|
|
5
5
|
export interface LabelSelectProps extends SelectProps {
|
|
6
6
|
label?: React.ReactNode;
|
|
7
7
|
}
|
|
8
|
-
declare const
|
|
9
|
-
|
|
10
|
-
Option: import("rc-select/lib/Option").OptionFC;
|
|
11
|
-
};
|
|
12
|
-
export default LabelSelect;
|
|
8
|
+
declare const ForwardRefLabelSelect: React.ForwardRefExoticComponent<LabelSelectProps & React.RefAttributes<unknown>>;
|
|
9
|
+
export default ForwardRefLabelSelect;
|
package/es/label-select/index.js
CHANGED
|
@@ -43,7 +43,7 @@ import ArrowDropDownFilled from "a-icons/es/ArrowDropDownFilled";
|
|
|
43
43
|
import omit from 'lodash/omit';
|
|
44
44
|
var Option = Select.Option;
|
|
45
45
|
export { Option };
|
|
46
|
-
var LabelSelect = function LabelSelect(props) {
|
|
46
|
+
var LabelSelect = function LabelSelect(props, ref) {
|
|
47
47
|
var className = props.className,
|
|
48
48
|
label = props.label;
|
|
49
49
|
var selectRef = React.useRef(null);
|
|
@@ -56,6 +56,9 @@ var LabelSelect = function LabelSelect(props) {
|
|
|
56
56
|
var _b = __read(useControllableValue(props), 2),
|
|
57
57
|
value = _b[0],
|
|
58
58
|
setValue = _b[1];
|
|
59
|
+
React.useImperativeHandle(ref, function () {
|
|
60
|
+
return selectRef.current;
|
|
61
|
+
});
|
|
59
62
|
var handleChange = function handleChange(nextValue) {
|
|
60
63
|
setValue(nextValue);
|
|
61
64
|
};
|
|
@@ -76,7 +79,7 @@ var LabelSelect = function LabelSelect(props) {
|
|
|
76
79
|
}, /*#__PURE__*/React.createElement(Select, __assign({
|
|
77
80
|
maxTagCount: 3,
|
|
78
81
|
showSearch: false
|
|
79
|
-
}, omit(props, ['open', 'onChange', 'className', 'label', 'setOpen']), {
|
|
82
|
+
}, omit(props, ['open', 'onChange', 'className', 'label', 'setOpen', 'isFocus']), {
|
|
80
83
|
open: open,
|
|
81
84
|
ref: selectRef,
|
|
82
85
|
size: "large",
|
|
@@ -89,5 +92,6 @@ var LabelSelect = function LabelSelect(props) {
|
|
|
89
92
|
onClick: handleLabelClick
|
|
90
93
|
}, label));
|
|
91
94
|
};
|
|
92
|
-
export default LabelSelect;
|
|
93
|
-
|
|
95
|
+
// export default LabelSelect;
|
|
96
|
+
var ForwardRefLabelSelect = /*#__PURE__*/React.forwardRef(LabelSelect);
|
|
97
|
+
export default ForwardRefLabelSelect;
|
|
@@ -5,6 +5,7 @@ export declare enum InputTypeEnum {
|
|
|
5
5
|
CONDITION_INPUT = "conditionInput",
|
|
6
6
|
SELECT = "select"
|
|
7
7
|
}
|
|
8
|
+
declare type ChangeSelectType = typeof InputTypeEnum[keyof typeof InputTypeEnum];
|
|
8
9
|
declare type SelectOptionsType = {
|
|
9
10
|
value: number;
|
|
10
11
|
label: string;
|
|
@@ -27,6 +28,7 @@ export interface LabelConditionSelectInputProps {
|
|
|
27
28
|
conditionInputProps?: LabelConditionInputProps;
|
|
28
29
|
/** 联动selectProps */
|
|
29
30
|
conditionSelectProps?: LabelSelectProps;
|
|
31
|
+
onChangeSelectType?: (changeSelectType: ChangeSelectType, value?: ValueType) => void;
|
|
30
32
|
/** onChange */
|
|
31
33
|
onChange?: (value: ValueType) => void;
|
|
32
34
|
/** onBlur */
|
|
@@ -110,6 +110,7 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
110
110
|
inputType = _b === void 0 ? InputTypeEnum.CONDITION_INPUT : _b,
|
|
111
111
|
_c = props.optionsList,
|
|
112
112
|
optionsList = _c === void 0 ? [] : _c,
|
|
113
|
+
onChangeSelectType = props.onChangeSelectType,
|
|
113
114
|
label = props.label,
|
|
114
115
|
className = props.className,
|
|
115
116
|
onBlur = props.onBlur;
|
|
@@ -120,6 +121,7 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
120
121
|
var _e = __read((0, react_1.useState)([]), 2),
|
|
121
122
|
subSelectOptions = _e[0],
|
|
122
123
|
setSubSelectOptions = _e[1];
|
|
124
|
+
var subSelectRef = (0, react_1.useRef)();
|
|
123
125
|
/** 子选择器是否多选 */
|
|
124
126
|
var isSubSelectMultiple = (conditionSelectProps === null || conditionSelectProps === void 0 ? void 0 : conditionSelectProps.mode) === 'multiple';
|
|
125
127
|
(0, react_1.useEffect)(function () {
|
|
@@ -145,6 +147,7 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
145
147
|
});
|
|
146
148
|
}
|
|
147
149
|
setSelectInputValue(finalSelectInputValue);
|
|
150
|
+
onChangeSelectType === null || onChangeSelectType === void 0 ? void 0 : onChangeSelectType(InputTypeEnum.SELECT, finalSelectInputValue);
|
|
148
151
|
if (isInput || (0, isNil_1["default"])(selectValue)) {
|
|
149
152
|
setSubSelectOptions([]);
|
|
150
153
|
return;
|
|
@@ -158,10 +161,12 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
158
161
|
}
|
|
159
162
|
};
|
|
160
163
|
var onInputChange = function onInputChange(inputValue) {
|
|
161
|
-
|
|
164
|
+
var finalValue = {
|
|
162
165
|
selectValue: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
163
166
|
inputValue: inputValue
|
|
164
|
-
}
|
|
167
|
+
};
|
|
168
|
+
setSelectInputValue(finalValue);
|
|
169
|
+
onChangeSelectType === null || onChangeSelectType === void 0 ? void 0 : onChangeSelectType(InputTypeEnum.SELECT, finalValue);
|
|
165
170
|
};
|
|
166
171
|
var onTypeSelectChange = function onTypeSelectChange(inputValue) {
|
|
167
172
|
var finalSelectInputValue = {
|
|
@@ -174,6 +179,7 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
174
179
|
});
|
|
175
180
|
}
|
|
176
181
|
setSelectInputValue(finalSelectInputValue);
|
|
182
|
+
onChangeSelectType === null || onChangeSelectType === void 0 ? void 0 : onChangeSelectType(InputTypeEnum.CONDITION_INPUT, finalSelectInputValue);
|
|
177
183
|
};
|
|
178
184
|
/** 联级选择框失去焦点 */
|
|
179
185
|
var onLabelConditionSelectInputBlur = function onLabelConditionSelectInputBlur() {
|
|
@@ -210,9 +216,14 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
210
216
|
})) : react_1["default"].createElement("div", {
|
|
211
217
|
className: "label-condition-select-second-select"
|
|
212
218
|
}, react_1["default"].createElement(label_select_1["default"], __assign({}, conditionSelectProps, {
|
|
219
|
+
ref: subSelectRef,
|
|
213
220
|
onChange: onTypeSelectChange,
|
|
214
221
|
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.inputValue,
|
|
215
222
|
options: subSelectOptions,
|
|
223
|
+
onDeselect: function onDeselect() {
|
|
224
|
+
var _a;
|
|
225
|
+
(_a = subSelectRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
226
|
+
},
|
|
216
227
|
onBlur: onLabelConditionSelectInputBlur,
|
|
217
228
|
onClear: onTypeSelectClear
|
|
218
229
|
})));
|
|
@@ -5,8 +5,5 @@ export { Option };
|
|
|
5
5
|
export interface LabelSelectProps extends SelectProps {
|
|
6
6
|
label?: React.ReactNode;
|
|
7
7
|
}
|
|
8
|
-
declare const
|
|
9
|
-
|
|
10
|
-
Option: import("rc-select/lib/Option").OptionFC;
|
|
11
|
-
};
|
|
12
|
-
export default LabelSelect;
|
|
8
|
+
declare const ForwardRefLabelSelect: React.ForwardRefExoticComponent<LabelSelectProps & React.RefAttributes<unknown>>;
|
|
9
|
+
export default ForwardRefLabelSelect;
|
|
@@ -54,7 +54,7 @@ var ArrowDropDownFilled_1 = __importDefault(require("a-icons/lib/ArrowDropDownFi
|
|
|
54
54
|
var omit_1 = __importDefault(require("lodash/omit"));
|
|
55
55
|
var Option = select_1["default"].Option;
|
|
56
56
|
exports.Option = Option;
|
|
57
|
-
var LabelSelect = function LabelSelect(props) {
|
|
57
|
+
var LabelSelect = function LabelSelect(props, ref) {
|
|
58
58
|
var className = props.className,
|
|
59
59
|
label = props.label;
|
|
60
60
|
var selectRef = react_1["default"].useRef(null);
|
|
@@ -67,6 +67,9 @@ var LabelSelect = function LabelSelect(props) {
|
|
|
67
67
|
var _b = __read((0, useControllableValue_1["default"])(props), 2),
|
|
68
68
|
value = _b[0],
|
|
69
69
|
setValue = _b[1];
|
|
70
|
+
react_1["default"].useImperativeHandle(ref, function () {
|
|
71
|
+
return selectRef.current;
|
|
72
|
+
});
|
|
70
73
|
var handleChange = function handleChange(nextValue) {
|
|
71
74
|
setValue(nextValue);
|
|
72
75
|
};
|
|
@@ -87,7 +90,7 @@ var LabelSelect = function LabelSelect(props) {
|
|
|
87
90
|
}, react_1["default"].createElement(select_1["default"], __assign({
|
|
88
91
|
maxTagCount: 3,
|
|
89
92
|
showSearch: false
|
|
90
|
-
}, (0, omit_1["default"])(props, ['open', 'onChange', 'className', 'label', 'setOpen']), {
|
|
93
|
+
}, (0, omit_1["default"])(props, ['open', 'onChange', 'className', 'label', 'setOpen', 'isFocus']), {
|
|
91
94
|
open: open,
|
|
92
95
|
ref: selectRef,
|
|
93
96
|
size: "large",
|
|
@@ -100,5 +103,6 @@ var LabelSelect = function LabelSelect(props) {
|
|
|
100
103
|
onClick: handleLabelClick
|
|
101
104
|
}, label));
|
|
102
105
|
};
|
|
103
|
-
|
|
104
|
-
|
|
106
|
+
// export default LabelSelect;
|
|
107
|
+
var ForwardRefLabelSelect = react_1["default"].forwardRef(LabelSelect);
|
|
108
|
+
exports["default"] = ForwardRefLabelSelect;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "assui",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.44",
|
|
4
4
|
"description": "react ui library",
|
|
5
5
|
"author": "jason <usochen@gmail.com>",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"node": ">=10.0.0"
|
|
81
81
|
},
|
|
82
82
|
"license": "MIT",
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "120c2d44fc5d61e94615369b3c4c948e0b4eae7c"
|
|
84
84
|
}
|