fix(#11793):show password option missing (#11834)

This commit is contained in:
Sachin Chaurasiya 2023-05-31 20:32:43 +05:30 committed by GitHub
parent 11c07ee8ab
commit b8726d15d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,41 @@
/*
* Copyright 2023 Collate.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { WidgetProps } from '@rjsf/utils';
import { Input } from 'antd';
import React, { FC } from 'react';
const PasswordWidget: FC<WidgetProps> = ({
onFocus,
onBlur,
onChange,
...rest
}) => {
return (
<Input.Password
autoComplete="off"
autoFocus={rest.autofocus}
disabled={rest.disabled}
id={rest.id}
name={rest.name}
placeholder={rest.placeholder}
readOnly={rest.readonly}
required={rest.required}
value={rest.value}
onBlur={() => onBlur(rest.id, rest.value)}
onChange={(e) => onChange(e.target.value)}
onFocus={() => onFocus(rest.id, rest.value)}
/>
);
};
export default PasswordWidget;

View File

@ -18,6 +18,7 @@ import classNames from 'classnames';
import { ArrayFieldTemplate } from 'components/JSONSchemaTemplate/ArrayFieldTemplate';
import DescriptionFieldTemplate from 'components/JSONSchemaTemplate/DescriptionFieldTemplate';
import { ObjectFieldTemplate } from 'components/JSONSchemaTemplate/ObjectFieldTemplate';
import PasswordWidget from 'components/JsonSchemaWidgets/PasswordWidget';
import { ServiceCategory } from 'enums/service.enum';
import { useAirflowStatus } from 'hooks/useAirflowStatus';
import { t } from 'i18next';
@ -125,6 +126,7 @@ const FormBuilder: FunctionComponent<Props> = ({
}}
transformErrors={transformErrors}
uiSchema={uiSchema}
widgets={{ PasswordWidget: PasswordWidget }}
onChange={handleFormChange}
onFocus={onFocus}
onSubmit={onSubmit}