- finished new flow builder UI;

- fixed reset pass functionality;
This commit is contained in:
Vitalii Kiiko
2025-01-10 12:18:53 +01:00
parent a418548e45
commit f2f844d388
6 changed files with 138 additions and 164 deletions

View File

@@ -0,0 +1,54 @@
import React from 'react';
import { classNames } from 'primereact/utils';
import { Controller } from 'react-hook-form';
import { Password } from 'primereact/password';
const PasswordField = ({
fieldName,
label,
control,
errors,
defaultValue,
config = {},
infoText = null,
inputgroup = false,
icon = null,
placeholder = '',
disabled = false,
onBlurFn = () => {
}
}) => {
const input = <Controller
name={fieldName}
control={control}
defaultValue={defaultValue}
rules={config}
render={({ field, fieldState }) => (
<Password
id={field.name}
disabled={disabled}
{...field}
value={field.value ? field.value : ''}
onBlur={onBlurFn}
placeholder={placeholder}
className={classNames({ 'p-invalid': fieldState.invalid })}
toggleMask />
)}/>
return (
<>
<label htmlFor={fieldName} className={classNames({ 'p-error': errors[fieldName] })}>
{label}{config.required || config.isRequired ? <span className="appForm__field--required">*</span> : null}
</label>
{inputgroup
? <div className="p-inputgroup">
<span className="p-inputgroup-addon">
{icon}
</span>
{input}
</div>
: input}
{infoText ? <small>{infoText}</small> : null}
</>)
}
export default PasswordField;

View File

@@ -16,6 +16,7 @@ import Wysiwyg from './components/Wysiwyg';
import Checkboxes from './components/Checkboxes';
import Fileupload from './components/Fileupload';
import Table from './components/Table';
import PasswordField from './components/PasswordField';
const FormField = (props) => {
const fields = {
@@ -31,7 +32,8 @@ const FormField = (props) => {
radio: Radio,
wysiwyg: Wysiwyg,
checkboxes: Checkboxes,
table: Table
table: Table,
password: PasswordField
}
const Comp = !isNil(fields[props.type]) ? fields[props.type] : null;