ab-ui-library 1.49.4 → 1.49.6
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.
|
@@ -126,7 +126,8 @@ var Select = function Select(props) {
|
|
|
126
126
|
labelAddons = props.labelAddons,
|
|
127
127
|
tooltipAddons = props.tooltipAddons,
|
|
128
128
|
renderOptions = props.renderOptions,
|
|
129
|
-
isAllowed = props.isAllowed
|
|
129
|
+
isAllowed = props.isAllowed,
|
|
130
|
+
defaultValue = props.defaultValue;
|
|
130
131
|
var scrollRef = useRef(null);
|
|
131
132
|
var inputRef = useRef(null);
|
|
132
133
|
var containerRef = useRef(null);
|
|
@@ -277,21 +278,31 @@ var Select = function Select(props) {
|
|
|
277
278
|
});
|
|
278
279
|
useHideOnResize(closeDropdown);
|
|
279
280
|
var rightIconOpenedProps = useMemo(function () {
|
|
280
|
-
return _objectSpread(
|
|
281
|
+
return _objectSpread({
|
|
281
282
|
className: 'cursor-pointer pointer-events-unset',
|
|
282
283
|
onClick: function onClick() {
|
|
283
284
|
return setIsOpen(false);
|
|
284
285
|
}
|
|
285
|
-
});
|
|
286
|
+
}, selectRightIconOpenedProps);
|
|
286
287
|
}, [selectRightIconOpenedProps]);
|
|
287
288
|
var rightIconProps = useMemo(function () {
|
|
288
|
-
return _objectSpread(
|
|
289
|
+
return _objectSpread({
|
|
289
290
|
className: 'cursor-pointer pointer-events-unset',
|
|
290
291
|
onClick: function onClick() {
|
|
291
292
|
return setIsOpen(true);
|
|
292
293
|
}
|
|
293
|
-
});
|
|
294
|
+
}, selectRightIconProps);
|
|
294
295
|
}, [selectRightIconProps]);
|
|
296
|
+
useEffect(function () {
|
|
297
|
+
if (defaultValue && isCreateOnOutsideClick) {
|
|
298
|
+
setSelectedOption({
|
|
299
|
+
label: defaultValue,
|
|
300
|
+
value: defaultValue
|
|
301
|
+
});
|
|
302
|
+
setSearchValue(defaultValue);
|
|
303
|
+
onItemSelect(defaultValue);
|
|
304
|
+
}
|
|
305
|
+
}, [defaultValue, isCreateOnOutsideClick]);
|
|
295
306
|
return /*#__PURE__*/React.createElement("div", {
|
|
296
307
|
"data-id": "".concat(dataId, "-content"),
|
|
297
308
|
className: classNames("select select--".concat(size), className, {
|
|
@@ -139,6 +139,7 @@ export interface TSingleSelectPropTypes extends IFormCompProps, TSelectBaseProps
|
|
|
139
139
|
floatValue: number | undefined;
|
|
140
140
|
}) => boolean;
|
|
141
141
|
renderOptions?: (props: IRenderOptionItemProps) => JSX.Element;
|
|
142
|
+
defaultValue?: string;
|
|
142
143
|
}
|
|
143
144
|
export type TSelectFooterPropTypes = {
|
|
144
145
|
checkboxInfo?: TCheckboxInfo;
|