/
githubmirror
/
material-ui
Обзор
Документация
Войти
/
githubmirror
/
material-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
packages/mui-material/src/InputBase/utils.js
34 строки
1 KB
Marija Najdova
[core] Rename directories to match the new package names (#28185)
06 сен 2021, 22:22
Не верифицирован
06 сен 2021, 22:22
49b3469
Код
Авторство
О чём код?
// Supports determination of isControlled(). // Controlled input accepts its current value as a prop. // // @see https://facebook.github.io/react/docs/forms.html#controlled-components // @param value // @returns {boolean} true if string (including '') or number (including zero) export function hasValue(value) { return value != null && !(Array.isArray(value) && value.length === 0); } // Determine if field is empty or filled. // Response determines if label is presented above field or as placeholder. // // @param obj // @param SSR // @returns {boolean} False when not present or empty string. // True when any number or string with length. export function isFilled(obj, SSR = false) { return ( obj && ((hasValue(obj.value) && obj.value !== '') || (SSR && hasValue(obj.defaultValue) && obj.defaultValue !== '')) ); } // Determine if an Input is adorned on start. // It's corresponding to the left with LTR. // // @param obj // @returns {boolean} False when no adornments. // True when adorned at the start. export function isAdornedStart(obj) { return obj.startAdornment; }