assui 3.2.103 → 3.2.104
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.
|
@@ -14,7 +14,6 @@ export interface ComplexValSelectProps<T> extends Omit<SelectProps, 'value' | 'o
|
|
|
14
14
|
value?: T;
|
|
15
15
|
onChange?: (val: T, opt?: ComplexValSelectOptionType[]) => void;
|
|
16
16
|
options?: ComplexValSelectOptionType[];
|
|
17
|
-
maxLength?: number;
|
|
18
17
|
}
|
|
19
18
|
declare const ComplexValSelect: React.ForwardRefExoticComponent<ComplexValSelectProps<ComplexValSelectValueType> & React.RefAttributes<unknown>>;
|
|
20
19
|
export default ComplexValSelect;
|
|
@@ -77,7 +77,6 @@ var ComplexValSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
77
77
|
value = _a[0],
|
|
78
78
|
setValue = _a[1];
|
|
79
79
|
var options = props.options,
|
|
80
|
-
maxLength = props.maxLength,
|
|
81
80
|
onSelect = props.onSelect;
|
|
82
81
|
var selectRef = React.useRef(null);
|
|
83
82
|
React.useImperativeHandle(ref, function () {
|
|
@@ -86,19 +85,6 @@ var ComplexValSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
86
85
|
// 判断是否需要将optionValue转为JSON字符串
|
|
87
86
|
var isReferenceTypeVal = isReferenceTypeOption(options);
|
|
88
87
|
var finalOptions = isReferenceTypeVal ? _formatOptions(options) : options;
|
|
89
|
-
var disabledOptions = React.useMemo(function () {
|
|
90
|
-
if ((value === null || value === void 0 ? void 0 : value.length) === maxLength) {
|
|
91
|
-
return finalOptions === null || finalOptions === void 0 ? void 0 : finalOptions.map(function (item) {
|
|
92
|
-
if (value.includes(item.value)) {
|
|
93
|
-
return item;
|
|
94
|
-
}
|
|
95
|
-
return __assign(__assign({}, item), {
|
|
96
|
-
disabled: true
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
return finalOptions;
|
|
101
|
-
}, [finalOptions, value, maxLength]);
|
|
102
88
|
var handleChange = function handleChange(val) {
|
|
103
89
|
var nextVal = val && isReferenceTypeVal ? JSON.parse(val) : val;
|
|
104
90
|
setValue(nextVal, options);
|
|
@@ -115,7 +101,7 @@ var ComplexValSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
115
101
|
className: classNames('complex-val-select', props === null || props === void 0 ? void 0 : props.className),
|
|
116
102
|
suffixIcon: /*#__PURE__*/React.createElement(ArrowDownOutlined, null),
|
|
117
103
|
value: value && isReferenceTypeVal ? JSON.stringify(value) : value,
|
|
118
|
-
options:
|
|
104
|
+
options: finalOptions,
|
|
119
105
|
onChange: handleChange,
|
|
120
106
|
onSelect: handleSelect
|
|
121
107
|
}, omit(props, ['value', 'onChange', 'options', 'onSelect', 'className'])));
|
|
@@ -14,7 +14,6 @@ export interface ComplexValSelectProps<T> extends Omit<SelectProps, 'value' | 'o
|
|
|
14
14
|
value?: T;
|
|
15
15
|
onChange?: (val: T, opt?: ComplexValSelectOptionType[]) => void;
|
|
16
16
|
options?: ComplexValSelectOptionType[];
|
|
17
|
-
maxLength?: number;
|
|
18
17
|
}
|
|
19
18
|
declare const ComplexValSelect: React.ForwardRefExoticComponent<ComplexValSelectProps<ComplexValSelectValueType> & React.RefAttributes<unknown>>;
|
|
20
19
|
export default ComplexValSelect;
|
|
@@ -120,7 +120,6 @@ var ComplexValSelect = React.forwardRef(function (props, ref) {
|
|
|
120
120
|
value = _a[0],
|
|
121
121
|
setValue = _a[1];
|
|
122
122
|
var options = props.options,
|
|
123
|
-
maxLength = props.maxLength,
|
|
124
123
|
onSelect = props.onSelect;
|
|
125
124
|
var selectRef = React.useRef(null);
|
|
126
125
|
React.useImperativeHandle(ref, function () {
|
|
@@ -129,19 +128,6 @@ var ComplexValSelect = React.forwardRef(function (props, ref) {
|
|
|
129
128
|
// 判断是否需要将optionValue转为JSON字符串
|
|
130
129
|
var isReferenceTypeVal = (0, exports.isReferenceTypeOption)(options);
|
|
131
130
|
var finalOptions = isReferenceTypeVal ? _formatOptions(options) : options;
|
|
132
|
-
var disabledOptions = React.useMemo(function () {
|
|
133
|
-
if ((value === null || value === void 0 ? void 0 : value.length) === maxLength) {
|
|
134
|
-
return finalOptions === null || finalOptions === void 0 ? void 0 : finalOptions.map(function (item) {
|
|
135
|
-
if (value.includes(item.value)) {
|
|
136
|
-
return item;
|
|
137
|
-
}
|
|
138
|
-
return __assign(__assign({}, item), {
|
|
139
|
-
disabled: true
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
return finalOptions;
|
|
144
|
-
}, [finalOptions, value, maxLength]);
|
|
145
131
|
var handleChange = function handleChange(val) {
|
|
146
132
|
var nextVal = val && isReferenceTypeVal ? JSON.parse(val) : val;
|
|
147
133
|
setValue(nextVal, options);
|
|
@@ -158,7 +144,7 @@ var ComplexValSelect = React.forwardRef(function (props, ref) {
|
|
|
158
144
|
className: (0, classnames_1["default"])('complex-val-select', props === null || props === void 0 ? void 0 : props.className),
|
|
159
145
|
suffixIcon: React.createElement(ArrowDownOutlined_1["default"], null),
|
|
160
146
|
value: value && isReferenceTypeVal ? JSON.stringify(value) : value,
|
|
161
|
-
options:
|
|
147
|
+
options: finalOptions,
|
|
162
148
|
onChange: handleChange,
|
|
163
149
|
onSelect: handleSelect
|
|
164
150
|
}, (0, omit_1["default"])(props, ['value', 'onChange', 'options', 'onSelect', 'className'])));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "assui",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.104",
|
|
4
4
|
"description": "react ui library",
|
|
5
5
|
"author": "jason <usochen@gmail.com>",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"node": ">=10.0.0"
|
|
88
88
|
},
|
|
89
89
|
"license": "MIT",
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "7b20a8b82d138441be884c67db67205bf516e380"
|
|
91
91
|
}
|