diff --git a/webapp/packages/core-authentication/src/UserInfoResource.ts b/webapp/packages/core-authentication/src/UserInfoResource.ts index c7db9c9117..4f39ea584b 100644 --- a/webapp/packages/core-authentication/src/UserInfoResource.ts +++ b/webapp/packages/core-authentication/src/UserInfoResource.ts @@ -108,7 +108,7 @@ export class UserInfoResource extends CachedDataResource boolean; + geLayoutSize?: (property: ObjectPropertyInfo) => ILayoutSizeProps; onFocus?: (name: string) => void; } @@ -49,6 +50,7 @@ export const ObjectPropertyInfoForm = observer(function hideEmptyPlaceholder, canShowPassword, isSaved, + geLayoutSize, onFocus, ...rest }) { @@ -77,7 +79,7 @@ export const ObjectPropertyInfoForm = observer(function return ( ) => void; } -type ControlType = 'checkbox' | 'combobox' | 'link' | 'input' | 'textarea' | 'file'; - -function getControlTypeFor(property: ObjectPropertyInfo): ControlType { - const dataType = property.dataType?.toLowerCase(); - - if (dataType === 'boolean') { - return 'checkbox'; - } else if (property.validValues && property.validValues.length > 0) { - return 'combobox'; - } else if (property.features.includes('href')) { - return 'link'; - } else if (dataType === 'string' && property.length === 'MULTILINE') { - return 'textarea'; - } else if (property.features.includes('file')) { - return 'file'; - } - - return 'input'; -} - function getValue(value: any, controlType: ControlType) { const checkbox = controlType === 'checkbox'; @@ -87,15 +68,15 @@ export const RenderField = observer(function RenderField({ }) { const translate = useTranslate(); - const controltype = getControlTypeFor(property); + const controlType = getPropertyControlType(property); const password = property.features.includes('password'); - const value = getValue(property.value, controltype); - const defaultValue = getValue(property.defaultValue, controltype); + const value = getValue(property.value, controlType); + const defaultValue = getValue(property.defaultValue, controlType); const passwordSaved = showRememberTip && ((password && !!property.value) || saved); const description = passwordSaved ? translate('ui_processing_saved') : undefined; - if (controltype === 'file' && state) { + if (controlType === 'file' && state) { return ( (function RenderField({ ); } - if (controltype === 'link') { + if (controlType === 'link') { return ( @@ -133,7 +114,7 @@ export const RenderField = observer(function RenderField({ ); } - if (controltype === 'checkbox') { + if (controlType === 'checkbox') { if (state !== undefined) { return ( (function RenderField({ ); } - if (controltype === 'combobox') { + if (controlType === 'combobox') { if (state !== undefined) { return ( (function RenderField({ ); } - if (controltype === 'textarea') { + if (controlType === 'textarea') { if (state !== undefined) { return (