mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-04-30 13:11:37 +03:00
- client: add wrapper for input normalization on blur
This commit is contained in:
parent
3b9d758510
commit
600781bb80
3 changed files with 61 additions and 34 deletions
client/src/helpers
|
@ -373,3 +373,19 @@ export const getParamsForClientsSearch = (data, param) => {
|
|||
return acc;
|
||||
}, {});
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates onBlur handler that can normalize input if normalization function is specified
|
||||
*
|
||||
* @param {Object} event
|
||||
* @param {Object} event.target
|
||||
* @param {string} event.target.value
|
||||
* @param {Object} input
|
||||
* @param {function} input.onBlur
|
||||
* @param {function} [normalizeOnBlur]
|
||||
* @returns {function}
|
||||
*/
|
||||
export const createOnBlurHandler = (event, input, normalizeOnBlur) => (
|
||||
normalizeOnBlur
|
||||
? input.onBlur(normalizeOnBlur(event.target.value))
|
||||
: input.onBlur());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue