- fixed login with spid fe issue;
- improved 'add user' form; - added new field 'paragraph';
This commit is contained in:
@@ -11,7 +11,7 @@ const BuilderElementProperLabel = ({ id, defaultLabel }) => {
|
||||
useEffect(() => {
|
||||
const element = head(elements.filter(o => o.id === id));
|
||||
const setting = head(element.settings.filter(o => o.name === 'label'));
|
||||
if (setting.value) {
|
||||
if (setting) {
|
||||
setLabel(setting.value);
|
||||
} else {
|
||||
setLabel(defaultLabel);
|
||||
|
||||
@@ -16,6 +16,7 @@ const ElementSetting = ({ setting, changeFn, updateDataFn }) => {
|
||||
step: __('Precisione decimale', 'gepafin'),
|
||||
options: __('Opzioni', 'gepafin'),
|
||||
mime: __('Tipo di file', 'gepafin'),
|
||||
text: __('Testo formattato', 'gepafin')
|
||||
}
|
||||
|
||||
return <div className="formElementSettings__field" key={setting.name}>
|
||||
|
||||
@@ -23,14 +23,14 @@ const BuilderElementSettings = ({ closeSettings }) => {
|
||||
const [validators, setValidators] = useState({});
|
||||
const textBasedValidatorFields = ['min', 'max', 'minLength', 'maxLength', 'pattern'];
|
||||
const customValidationOptions = [
|
||||
{value: 'isPIVA', label: 'isPIVA'},
|
||||
{value: 'isCodiceFiscale', label: 'isCodiceFiscale'},
|
||||
{value: 'isCAP', label: 'isCAP'},
|
||||
{value: 'isIBAN', label: 'isIBAN'},
|
||||
{value: 'isEmail', label: 'isEmail'},
|
||||
{value: 'isEmailPEC', label: 'isEmailPEC'},
|
||||
{value: 'isUrl', label: 'isUrl'},
|
||||
{value: 'isMarcaDaBollo', label: 'isMarcaDaBollo'}
|
||||
{ value: 'isPIVA', label: 'isPIVA' },
|
||||
{ value: 'isCodiceFiscale', label: 'isCodiceFiscale' },
|
||||
{ value: 'isCAP', label: 'isCAP' },
|
||||
{ value: 'isIBAN', label: 'isIBAN' },
|
||||
{ value: 'isEmail', label: 'isEmail' },
|
||||
{ value: 'isEmailPEC', label: 'isEmailPEC' },
|
||||
{ value: 'isUrl', label: 'isUrl' },
|
||||
{ value: 'isMarcaDaBollo', label: 'isMarcaDaBollo' }
|
||||
]
|
||||
|
||||
const onChange = (value, name) => {
|
||||
@@ -116,48 +116,49 @@ const BuilderElementSettings = ({ closeSettings }) => {
|
||||
updateDataFn={onUpdateOptions}/>)
|
||||
: null}
|
||||
</TabPanel>
|
||||
<TabPanel header={__('Validation', 'gepafin')}>
|
||||
{validators
|
||||
? Object.keys(validators).map((k) => <div
|
||||
className="formElementSettings__field" key={k}>
|
||||
{k === 'isRequired'
|
||||
? <div className="formElementSettings__field">
|
||||
<label htmlFor={k}>{__('Obligatorio?', 'gepafin')}</label>
|
||||
<InputSwitch
|
||||
checked={validators[k]}
|
||||
onChange={(e) => toggleRequired(e.value, k)}/>
|
||||
</div>
|
||||
: null}
|
||||
{textBasedValidatorFields.includes(k) || 'custom' === k
|
||||
? <div className="formElementSettings__field">
|
||||
<label htmlFor={`enable_${k}`}>{sprintf(__('Set %s', 'gepafin'), k)}</label>
|
||||
<InputSwitch
|
||||
checked={!isNil(validators[k])}
|
||||
onChange={(e) => showField(e.value, k)}/>
|
||||
</div>
|
||||
: null}
|
||||
{k === 'custom' && !isNil(validators[k])
|
||||
? <div className="formElementSettings__field">
|
||||
<label htmlFor={k}>{__('Personalizzato', 'gepafin')}</label>
|
||||
<Dropdown
|
||||
id={`enable_${k}`}
|
||||
value={validators[k]}
|
||||
onChange={(e) => onChangeValidator(e.value, k)}
|
||||
options={customValidationOptions}
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
placeholder={__('Scegli', 'gepafin')}/>
|
||||
</div>
|
||||
: null}
|
||||
{textBasedValidatorFields.includes(k) && !isNil(validators[k])
|
||||
? <div className="formElementSettings__field">
|
||||
<label htmlFor={k}>{k}</label>
|
||||
<InputText id={k} aria-describedby={`${k}-help`}
|
||||
value={validators[k]}
|
||||
onChange={(e) => onChangeValidator(e.target.value, k)}/>
|
||||
</div> : null}
|
||||
</div>) : null}
|
||||
</TabPanel>
|
||||
{!isEmpty(validators)
|
||||
? <TabPanel header={__('Validation', 'gepafin')}>
|
||||
{validators
|
||||
? Object.keys(validators).map((k) => <div
|
||||
className="formElementSettings__field" key={k}>
|
||||
{k === 'isRequired'
|
||||
? <div className="formElementSettings__field">
|
||||
<label htmlFor={k}>{__('Obligatorio?', 'gepafin')}</label>
|
||||
<InputSwitch
|
||||
checked={validators[k]}
|
||||
onChange={(e) => toggleRequired(e.value, k)}/>
|
||||
</div>
|
||||
: null}
|
||||
{textBasedValidatorFields.includes(k) || 'custom' === k
|
||||
? <div className="formElementSettings__field">
|
||||
<label htmlFor={`enable_${k}`}>{sprintf(__('Set %s', 'gepafin'), k)}</label>
|
||||
<InputSwitch
|
||||
checked={!isNil(validators[k])}
|
||||
onChange={(e) => showField(e.value, k)}/>
|
||||
</div>
|
||||
: null}
|
||||
{k === 'custom' && !isNil(validators[k])
|
||||
? <div className="formElementSettings__field">
|
||||
<label htmlFor={k}>{__('Personalizzato', 'gepafin')}</label>
|
||||
<Dropdown
|
||||
id={`enable_${k}`}
|
||||
value={validators[k]}
|
||||
onChange={(e) => onChangeValidator(e.value, k)}
|
||||
options={customValidationOptions}
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
placeholder={__('Scegli', 'gepafin')}/>
|
||||
</div>
|
||||
: null}
|
||||
{textBasedValidatorFields.includes(k) && !isNil(validators[k])
|
||||
? <div className="formElementSettings__field">
|
||||
<label htmlFor={k}>{k}</label>
|
||||
<InputText id={k} aria-describedby={`${k}-help`}
|
||||
value={validators[k]}
|
||||
onChange={(e) => onChangeValidator(e.target.value, k)}/>
|
||||
</div> : null}
|
||||
</div>) : null}
|
||||
</TabPanel> : null}
|
||||
</TabView>
|
||||
|
||||
<Button label={__('Salva', 'gepafin')} onClick={saveSettings}/>
|
||||
|
||||
Reference in New Issue
Block a user