From 641099d2e0843098729676f8b38b21e0304a4e9c Mon Sep 17 00:00:00 2001 From: edwardxiao Date: Fri, 11 Aug 2023 14:36:05 +0800 Subject: [PATCH] - `customStyleOptionListWrapper` for `` + # 4.9.8 - `classNameInputBoxItem` for `` diff --git a/docs/v4-doc.md b/docs/v4-doc.md index a1dc64b..a13bddb 100644 --- a/docs/v4-doc.md +++ b/docs/v4-doc.md @@ -351,6 +351,7 @@ import 'react-inputs-validation/lib/react-inputs-validation.min.css'; |customStyleSelect | Opt | Obj | | {} | |customStyleWrapper | Opt | Obj | | {} | |customStyleContainer | Opt | Obj | | {} | +|customStyleOptionListWrapper | Opt | Obj | | {} | |customStyleOptionListContainer | Opt | Obj | | {} | |customStyleOptionListItem | Opt | Obj | | {} | |**onBlur** |**Opt**|**Func** |**In order to validate the value on blur, you MUST provide a function, even if it is an empty function. Missing this, the validation on blur will not work.** |**none** | @@ -396,6 +397,7 @@ import 'react-inputs-validation/lib/react-inputs-validation.min.css'; customStyleSelect={{}} //Optional.[Object].Default: {}. customStyleWrapper={{}} //Optional.[Object].Default: {}. customStyleContainer={{}} //Optional.[Object].Default: {}. + customStyleOptionListWrapper={{}} //Optional.[Object].Default: {}. customStyleOptionListContainer={{}} //Optional.[Object].Default: {}. customStyleOptionListItem={{}} //Optional.[Object].Default: {}. onChange={(res, e) => { diff --git a/example/index.tsx b/example/index.tsx index 8347a70..fc158c7 100644 --- a/example/index.tsx +++ b/example/index.tsx @@ -1111,6 +1111,7 @@ const Index: React.FC = memo(({}) => { customStyleSelect={{}} // Optional.[Object].Default: {}. customStyleWrapper={{}} // Optional.[Object].Default: {}. customStyleContainer={{}} // Optional.[Object].Default: {}. + customStyleOptionListWrapper={{}} // Optional.[Object].Default: {}. customStyleOptionListContainer={{ maxHeight: '200px', overflow: 'auto', fontSize: '14px' }} // Optional.[Object].Default: {}. customStyleOptionListItem={{}} // Optional.[Object].Default: {}. onChange={(res, e) => { diff --git a/package.json b/package.json index bf96288..bd1080b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-inputs-validation", - "version": "4.9.8", + "version": "4.9.9", "description": "A react component for form inputs validation.", "main": "index.js", "types": "./lib/index.d.ts", diff --git a/src/js/Inputs/Select.tsx b/src/js/Inputs/Select.tsx index e5b0cb8..3e1903b 100644 --- a/src/js/Inputs/Select.tsx +++ b/src/js/Inputs/Select.tsx @@ -143,6 +143,7 @@ interface Props { customStyleWrapper?: React.CSSProperties; customStyleContainer?: React.CSSProperties; customStyleSelect?: React.CSSProperties; + customStyleOptionListWrapper?: React.CSSProperties; customStyleOptionListContainer?: React.CSSProperties; customStyleDropdownIcon?: React.CSSProperties; customStyleOptionListItem?: React.CSSProperties; @@ -176,6 +177,7 @@ const component: React.FC = ({ customStyleContainer = {}, customStyleSelect = {}, customStyleOptionListItem = {}, + customStyleOptionListWrapper = {}, customStyleOptionListContainer = {}, customStyleDropdownIcon = {}, validationOption = {}, @@ -264,12 +266,15 @@ const component: React.FC = ({ onClick(e); } }, []); - const handleOnChange = useCallback((item: object, e: React.MouseEvent) => { - if (disabled) { - return; - } - onChange && onChange(item, e); - }, [disabled]); + const handleOnChange = useCallback( + (item: object, e: React.MouseEvent) => { + if (disabled) { + return; + } + onChange && onChange(item, e); + }, + [disabled], + ); const check = useCallback(() => { const { name, check, locale, required, msgOnSuccess } = option; if (!check) { @@ -383,10 +388,13 @@ const component: React.FC = ({ } } }, []); - const handleOnItemClick = useCallback((item: object, e: React.MouseEvent) => { - handleOnChange(item, e); - stateKeyword[1](''); - }, [disabled]); + const handleOnItemClick = useCallback( + (item: object, e: React.MouseEvent) => { + handleOnChange(item, e); + stateKeyword[1](''); + }, + [disabled], + ); const handleOnItemMouseOver = useCallback((index: number) => { globalVariableCurrentFocus = index; addActive(); @@ -666,7 +674,7 @@ const component: React.FC = ({
{selectorHtml}
-
+
{showSearch && (
@@ -749,7 +757,16 @@ export const Option: React.FC = memo( onMouseOut(); }, []); return ( - + {item.icon && } {{item.name}}