nurseitaly-components 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/basic/SelectField/SelectFieldTheme.js +28 -0
- package/dist/basic/SelectField/SelectMultipleField.d.ts +1 -1
- package/dist/basic/SelectField/SelectMultipleField.js +18 -15
- package/dist/basic/SelectField/styles.scss +15 -0
- package/dist/basic/TextField/TextField.d.ts +3 -3
- package/dist/basic/TextField/TextField.js +48 -45
- package/dist/basic/TextField/styles.scss +4 -0
- package/dist/common/AppForm/AppForm.d.ts +4 -4
- package/dist/common/AppForm/AppForm.js +15 -15
- package/package.json +1 -1
|
@@ -39,6 +39,34 @@ export const selectFieldTheme = (outerTheme, { hasLabel = true, hasAddornments:
|
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
|
+
MuiSelect: {
|
|
43
|
+
styleOverrides: {
|
|
44
|
+
select: {
|
|
45
|
+
display: 'flex',
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
boxSizing: 'border-box',
|
|
48
|
+
minHeight: 'unset!important',
|
|
49
|
+
height: hasLabel ? '48px!important' : 'auto',
|
|
50
|
+
padding: hasLabel ? '21px 0px 4px!important' : '8px 16px!important',
|
|
51
|
+
fontSize: '16px',
|
|
52
|
+
fontWeight: '400',
|
|
53
|
+
lineHeight: '120%',
|
|
54
|
+
letterSpacing: '0px',
|
|
55
|
+
fontFamily: 'Work Sans, sans-serif',
|
|
56
|
+
whiteSpace: 'nowrap',
|
|
57
|
+
overflow: 'hidden',
|
|
58
|
+
textOverflow: 'ellipsis',
|
|
59
|
+
'&.MuiSelect-multiple': {
|
|
60
|
+
minHeight: 'unset!important',
|
|
61
|
+
height: hasLabel ? '48px!important' : 'auto',
|
|
62
|
+
padding: hasLabel ? '21px 0px 4px!important' : '8px 16px!important',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
icon: {
|
|
66
|
+
marginRight: hasAddorments ? '24px' : '0px',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
42
70
|
MuiInputLabel: {
|
|
43
71
|
styleOverrides: {
|
|
44
72
|
root: {
|
|
@@ -8,7 +8,7 @@ export type SelectItem = {
|
|
|
8
8
|
type DefaultEndAdornmentType = 'close' | 'info';
|
|
9
9
|
type Props<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues> = {
|
|
10
10
|
attr: string;
|
|
11
|
-
label
|
|
11
|
+
label?: string;
|
|
12
12
|
createdForm: UseFormReturn<TFieldValues, TContext, TTransformedValues>;
|
|
13
13
|
className?: string;
|
|
14
14
|
disabled?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */
|
|
3
|
-
import { FormControl, InputAdornment, InputLabel, MenuItem, Select, } from '@mui/material';
|
|
3
|
+
import { FilledInput, FormControl, InputAdornment, InputLabel, MenuItem, Select, } from '@mui/material';
|
|
4
4
|
import { ThemeProvider, useTheme } from '@mui/material/styles';
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import { useEffect, useState } from 'react';
|
|
@@ -52,7 +52,10 @@ export default function SelectMultipleField({ className, attr, label, createdFor
|
|
|
52
52
|
}
|
|
53
53
|
return _jsx("div", { className: "ds-end-adornments", children: adornments });
|
|
54
54
|
};
|
|
55
|
-
return (_jsx("div", { className: getClassNames, children: _jsx(Controller, { name: fieldName, control: createdForm.control, render: ({ field }) => (_jsxs(ThemeProvider, { theme: selectFieldTheme(outerTheme
|
|
55
|
+
return (_jsx("div", { className: getClassNames, children: _jsx(Controller, { name: fieldName, control: createdForm.control, render: ({ field }) => (_jsxs(ThemeProvider, { theme: selectFieldTheme(outerTheme, {
|
|
56
|
+
hasLabel: !!label,
|
|
57
|
+
hasAddornments: !!endAdornment,
|
|
58
|
+
}), children: [_jsxs(FormControl, { fullWidth: true, variant: "filled", disabled: disabled, children: [label && (_jsx(InputLabel, { htmlFor: `${attr}-select`, shrink: true, sx: {
|
|
56
59
|
color: disabled
|
|
57
60
|
? '#BEBFC1'
|
|
58
61
|
: hasError()
|
|
@@ -60,7 +63,7 @@ export default function SelectMultipleField({ className, attr, label, createdFor
|
|
|
60
63
|
: active
|
|
61
64
|
? '#1C83F4'
|
|
62
65
|
: '#000000',
|
|
63
|
-
}, children: `${label}${required ? ' *' : ''}` }), _jsxs(Select, { ...field, value: Array.isArray(field.value) ? field.value : [], multiple: true, fullWidth: true, displayEmpty: true, required: required, disabled: disabled, variant: "filled",
|
|
66
|
+
}, children: `${label}${required ? ' *' : ''}` })), _jsxs(Select, { ...field, id: `${attr}-select`, value: Array.isArray(field.value) ? field.value : [], multiple: true, fullWidth: true, displayEmpty: true, required: required, disabled: disabled, variant: "filled", onFocus: () => setFocus(true), onBlur: () => setFocus(false), onMouseOver: () => setMouseOver(true), onMouseOut: () => setMouseOver(false), onChange: (event) => {
|
|
64
67
|
let value = event.target.value;
|
|
65
68
|
if (Array.isArray(value) && value.includes('')) {
|
|
66
69
|
value = [];
|
|
@@ -81,18 +84,18 @@ export default function SelectMultipleField({ className, attr, label, createdFor
|
|
|
81
84
|
// while keeping the smart "flipping" logic active
|
|
82
85
|
variant: 'menu',
|
|
83
86
|
anchorReference: 'anchorEl',
|
|
84
|
-
}, sx: {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
87
|
+
}, input: _jsx(FilledInput, { endAdornment: showEndAdornment && (_jsx(InputAdornment, { position: "end", children: getEndAdornmentIcon(field.value) })), sx: {
|
|
88
|
+
borderColor: disabled
|
|
89
|
+
? '#BEBFC1'
|
|
90
|
+
: hasError()
|
|
91
|
+
? '#C6080A!important'
|
|
92
|
+
: active
|
|
93
|
+
? '#1C83F4!important'
|
|
94
|
+
: '#BEBFC1!important',
|
|
95
|
+
backgroundColor: disabled
|
|
96
|
+
? '#BEBFC1!important'
|
|
97
|
+
: '#FFFFFF!important',
|
|
98
|
+
} }), children: [_jsx(MenuItem, { value: "", sx: (theme) => ({
|
|
96
99
|
minHeight: theme.spacing(6),
|
|
97
100
|
}), children: placeholder || '\u00a0' }), options.map((option, idx) => (_jsx(MenuItem, { value: option.value, children: option.label }, idx.valueOf())))] })] }), title && !hasError() && _jsx("div", { className: "helper", children: title }), hasError() && (_jsx("div", { className: "helper error", children: String(createdForm.formState.errors[attr]?.message) }))] })) }) }));
|
|
98
101
|
}
|
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
width: 100%;
|
|
3
3
|
position: relative;
|
|
4
4
|
|
|
5
|
+
> .helper {
|
|
6
|
+
@include helper-small-1;
|
|
7
|
+
margin-top: 4px;
|
|
8
|
+
|
|
9
|
+
&.error {
|
|
10
|
+
color: var(--text-error);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.ds-end-adornments {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: 8px;
|
|
18
|
+
}
|
|
19
|
+
|
|
5
20
|
.ds-icon {
|
|
6
21
|
cursor: pointer;
|
|
7
22
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FieldValues, UseFormReturn } from
|
|
2
|
-
import
|
|
1
|
+
import { FieldValues, UseFormReturn } from "react-hook-form";
|
|
2
|
+
import "./styles.scss";
|
|
3
3
|
export type MaskFunction = (value: string, isBlur?: boolean) => string;
|
|
4
|
-
type DefaultEndAdornmentType =
|
|
4
|
+
type DefaultEndAdornmentType = "password" | "close" | "info";
|
|
5
5
|
type Props<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues> = {
|
|
6
6
|
attr: string;
|
|
7
7
|
label?: string;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return */
|
|
3
|
-
import { InputAdornment, TextField as MuiTextField } from
|
|
4
|
-
import { ThemeProvider, useTheme } from
|
|
5
|
-
import cx from
|
|
6
|
-
import { useEffect, useState } from
|
|
7
|
-
import { Controller } from
|
|
8
|
-
import Icon from
|
|
9
|
-
import Tooltip from
|
|
10
|
-
import { textFieldTheme } from
|
|
11
|
-
import { setCurrentInput } from
|
|
12
|
-
import
|
|
13
|
-
export default function TextField({ className, attr, label, createdForm, disabled, title, placeholder, multiline, maxChars, required, startAdornment, endAdornment, defaultEndAdornments = [
|
|
3
|
+
import { InputAdornment, TextField as MuiTextField } from "@mui/material";
|
|
4
|
+
import { ThemeProvider, useTheme } from "@mui/material/styles";
|
|
5
|
+
import cx from "classnames";
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
import { Controller, } from "react-hook-form";
|
|
8
|
+
import Icon from "../Icon";
|
|
9
|
+
import Tooltip from "../Tooltip";
|
|
10
|
+
import { textFieldTheme } from "./TextFieldTheme";
|
|
11
|
+
import { setCurrentInput } from "./inputRefManager";
|
|
12
|
+
import "./styles.scss";
|
|
13
|
+
export default function TextField({ className, attr, label, createdForm, disabled, title, placeholder, multiline, maxChars, required, startAdornment, endAdornment, defaultEndAdornments = ["close"], showEndAdornment = true, onChange, onFocus, onKeyDown, onRemove, onBlur, rows = 4, infoText, inputRef, width = "100%", height, mask, blurMask, }) {
|
|
14
14
|
const fieldName = attr;
|
|
15
15
|
const outerTheme = useTheme();
|
|
16
16
|
const [showPassword, setShowPassword] = useState(false);
|
|
@@ -23,15 +23,16 @@ export default function TextField({ className, attr, label, createdForm, disable
|
|
|
23
23
|
const effectiveHeight = height !== undefined
|
|
24
24
|
? height
|
|
25
25
|
: multiline
|
|
26
|
-
?
|
|
26
|
+
? "100%"
|
|
27
27
|
: hasLabel
|
|
28
|
-
?
|
|
28
|
+
? "48px"
|
|
29
29
|
: undefined;
|
|
30
|
-
const getClassNames = cx(
|
|
30
|
+
const getClassNames = cx("ds-input-text", className, {
|
|
31
31
|
disabled: disabled,
|
|
32
|
+
"ds-input-textarea": multiline,
|
|
32
33
|
});
|
|
33
34
|
const applyMask = (value, isBlur) => {
|
|
34
|
-
if (typeof value ===
|
|
35
|
+
if (typeof value === "string" && mask) {
|
|
35
36
|
return mask(value, isBlur);
|
|
36
37
|
}
|
|
37
38
|
return value;
|
|
@@ -41,7 +42,9 @@ export default function TextField({ className, attr, label, createdForm, disable
|
|
|
41
42
|
if (mask && currentValue) {
|
|
42
43
|
const masked = applyMask(currentValue);
|
|
43
44
|
if (masked !== currentValue) {
|
|
44
|
-
createdForm.setValue(fieldName, masked, {
|
|
45
|
+
createdForm.setValue(fieldName, masked, {
|
|
46
|
+
shouldValidate: false,
|
|
47
|
+
});
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
}, [attr, mask, createdForm, fieldName]);
|
|
@@ -49,19 +52,19 @@ export default function TextField({ className, attr, label, createdForm, disable
|
|
|
49
52
|
const adornments = [];
|
|
50
53
|
if (defaultEndAdornments.length > 0) {
|
|
51
54
|
// Check for password adornment
|
|
52
|
-
if (defaultEndAdornments.includes(
|
|
53
|
-
adornments.push(_jsx(Icon, { name: showPassword ?
|
|
55
|
+
if (defaultEndAdornments.includes("password")) {
|
|
56
|
+
adornments.push(_jsx(Icon, { name: showPassword ? "visibility_off" : "visibility", size: "small", onClick: () => setShowPassword(!showPassword), className: "pointer" }, "password"));
|
|
54
57
|
}
|
|
55
58
|
// Check for info adornment
|
|
56
|
-
if (defaultEndAdornments.includes(
|
|
59
|
+
if (defaultEndAdornments.includes("info") && infoText) {
|
|
57
60
|
const infoTextElement = (_jsx(Icon, { name: "info", size: "small", className: "icon-info pointer" }));
|
|
58
61
|
adornments.push(_jsx(Tooltip, { title: infoText, mode: "simple", children: _jsx("span", { children: infoTextElement }) }, "info"));
|
|
59
62
|
}
|
|
60
63
|
// Check for close adornment - show when value is not undefined and value is not equal to defaultValue
|
|
61
|
-
if (defaultEndAdornments.includes(
|
|
64
|
+
if (defaultEndAdornments.includes("close") &&
|
|
62
65
|
value !== undefined &&
|
|
63
66
|
onRemove) {
|
|
64
|
-
adornments.push(_jsx(Icon, { name: "close", size: "small", className: `${disabled ?
|
|
67
|
+
adornments.push(_jsx(Icon, { name: "close", size: "small", className: `${disabled ? "d-none" : ""} pointer`, onClick: () => onRemove && onRemove() }, "close"));
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
70
|
// Append custom endAdornments if provided
|
|
@@ -85,11 +88,11 @@ export default function TextField({ className, attr, label, createdForm, disable
|
|
|
85
88
|
setActive(false);
|
|
86
89
|
}
|
|
87
90
|
}, [focus, mouseOver]);
|
|
88
|
-
return (_jsx("div", { className: getClassNames, style: { width }, children: _jsx(Controller, { name: fieldName, control: createdForm.control, render: ({ field }) => (_jsxs(ThemeProvider, { theme: textFieldTheme(outerTheme, { hasLabel }), children: [_jsx(MuiTextField, { ...field, inputRef: inputRef, label: label, value: field.value ||
|
|
91
|
+
return (_jsx("div", { className: getClassNames, style: { width }, children: _jsx(Controller, { name: fieldName, control: createdForm.control, render: ({ field }) => (_jsxs(ThemeProvider, { theme: textFieldTheme(outerTheme, { hasLabel }), children: [_jsx(MuiTextField, { ...field, inputRef: inputRef, label: label, value: field.value || "", type: defaultEndAdornments.includes("password")
|
|
89
92
|
? showPassword
|
|
90
|
-
?
|
|
91
|
-
:
|
|
92
|
-
:
|
|
93
|
+
? "text"
|
|
94
|
+
: "password"
|
|
95
|
+
: "text", fullWidth: true, required: required, disabled: disabled, variant: "filled", placeholder: !focus ? placeholder : "", color: "error", multiline: multiline, minRows: rows, slotProps: {
|
|
93
96
|
...(hasLabel && {
|
|
94
97
|
inputLabel: {
|
|
95
98
|
shrink: true,
|
|
@@ -124,41 +127,41 @@ export default function TextField({ className, attr, label, createdForm, disable
|
|
|
124
127
|
onChange && onChange(attr, value);
|
|
125
128
|
}, sx: {
|
|
126
129
|
borderColor: disabled
|
|
127
|
-
?
|
|
130
|
+
? "#BEBFC1"
|
|
128
131
|
: hasError()
|
|
129
|
-
?
|
|
132
|
+
? "#C6080A"
|
|
130
133
|
: active
|
|
131
|
-
?
|
|
132
|
-
:
|
|
133
|
-
|
|
134
|
+
? "#1C83F4"
|
|
135
|
+
: "#BEBFC1",
|
|
136
|
+
".MuiInputLabel-root": {
|
|
134
137
|
color: disabled
|
|
135
|
-
?
|
|
138
|
+
? "#BEBFC1"
|
|
136
139
|
: hasError()
|
|
137
|
-
?
|
|
140
|
+
? "#C6080A"
|
|
138
141
|
: active
|
|
139
|
-
?
|
|
140
|
-
:
|
|
142
|
+
? "#1C83F4"
|
|
143
|
+
: "#000000",
|
|
141
144
|
},
|
|
142
|
-
|
|
143
|
-
paddingTop: hasLabel ?
|
|
144
|
-
paddingBottom:
|
|
145
|
+
"& .MuiInputBase-inputMultiline": {
|
|
146
|
+
paddingTop: hasLabel ? "24px" : "8px",
|
|
147
|
+
paddingBottom: "16px",
|
|
145
148
|
},
|
|
146
149
|
...(hasLabel &&
|
|
147
150
|
!multiline && {
|
|
148
|
-
|
|
149
|
-
paddingTop:
|
|
151
|
+
"& .MuiInputBase-input": {
|
|
152
|
+
paddingTop: "16px",
|
|
150
153
|
},
|
|
151
154
|
}),
|
|
152
|
-
|
|
153
|
-
paddingTop: multiline ?
|
|
155
|
+
"& .MuiInputAdornment-positionEnd": {
|
|
156
|
+
paddingTop: multiline ? "12px" : "0px",
|
|
154
157
|
},
|
|
155
158
|
...(effectiveHeight !== undefined && {
|
|
156
159
|
height: effectiveHeight,
|
|
157
160
|
}),
|
|
158
|
-
|
|
159
|
-
paddingTop: multiline ?
|
|
160
|
-
height: effectiveHeight !== undefined ?
|
|
161
|
-
alignItems: multiline ?
|
|
161
|
+
"& .MuiInputBase-root": {
|
|
162
|
+
paddingTop: multiline ? "12px" : hasLabel ? "4px" : "0px",
|
|
163
|
+
height: effectiveHeight !== undefined ? "100%" : "auto",
|
|
164
|
+
alignItems: multiline ? "flex-start" : "center",
|
|
162
165
|
},
|
|
163
166
|
} }), maxChars && (_jsxs("div", { className: "character-counter", children: [field.value?.length || 0, "/", maxChars] })), title && !hasError() && _jsx("div", { className: "helper", children: title }), hasError() && (_jsx("div", { className: "helper error", children: String(createdForm.formState.errors[attr]?.message) }))] })) }) }));
|
|
164
167
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FieldValues, UseFormReturn } from
|
|
2
|
-
import { SelectItem } from
|
|
3
|
-
import { AppFormField } from
|
|
4
|
-
import
|
|
1
|
+
import { FieldValues, UseFormReturn } from "react-hook-form";
|
|
2
|
+
import { SelectItem } from "../../basic";
|
|
3
|
+
import { AppFormField } from "./AppFormField";
|
|
4
|
+
import "./style.scss";
|
|
5
5
|
type Props<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues> = {
|
|
6
6
|
fields: AppFormField[];
|
|
7
7
|
form: UseFormReturn<TFieldValues, TContext, TTransformedValues>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { AsyncSelectField, CheckboxField, DatePickerField, SelectField, SelectMultipleField, SwitchField, TextField, } from
|
|
3
|
-
import FormColorField from
|
|
4
|
-
import { getFieldFlexStyle, groupFieldsIntoRows } from
|
|
5
|
-
import
|
|
2
|
+
import { AsyncSelectField, CheckboxField, DatePickerField, SelectField, SelectMultipleField, SwitchField, TextField, } from "../../basic";
|
|
3
|
+
import FormColorField from "./FormColorField";
|
|
4
|
+
import { getFieldFlexStyle, groupFieldsIntoRows } from "./groupFieldsIntoRows";
|
|
5
|
+
import "./style.scss";
|
|
6
6
|
const convertList = (values, labelAttr, valueAttr) => {
|
|
7
7
|
if (!values)
|
|
8
8
|
return [];
|
|
@@ -18,18 +18,18 @@ export default function AppForm({ fields, form, prefix, onChangeFunctions = {},
|
|
|
18
18
|
const getOptions = (attr) => {
|
|
19
19
|
if (!runtimeOptions[attr])
|
|
20
20
|
return undefined;
|
|
21
|
-
return convertList(runtimeOptions[attr],
|
|
21
|
+
return convertList(runtimeOptions[attr], "name", "uid");
|
|
22
22
|
};
|
|
23
23
|
const renderField = (field) => {
|
|
24
24
|
const name = prefix ? `${prefix}.${field.attr}` : field.attr;
|
|
25
25
|
const handleChange = getOnChangeFn(field.attr);
|
|
26
|
-
if (field.type ===
|
|
26
|
+
if (field.type === "autocomplete") {
|
|
27
27
|
const loadOptions = runtimeLoadOptions[field.attr];
|
|
28
28
|
if (!loadOptions)
|
|
29
29
|
return null;
|
|
30
30
|
return (_jsx(AsyncSelectField, { attr: name, label: field.name, createdForm: form, disabled: field.disabled, required: field.required, multiple: field.multiple, freeSolo: field.freeSolo, minQueryLength: field.minQueryLength, loadOptions: loadOptions, placeholder: field.title, noOptionsText: field.translation, onChange: (_attr, value) => handleChange?.(value) }, name));
|
|
31
31
|
}
|
|
32
|
-
if (field.type ===
|
|
32
|
+
if (field.type === "select") {
|
|
33
33
|
const selectOptions = getOptions(field.attr) || field.options || [];
|
|
34
34
|
const selectProps = {
|
|
35
35
|
attr: name,
|
|
@@ -46,24 +46,24 @@ export default function AppForm({ fields, form, prefix, onChangeFunctions = {},
|
|
|
46
46
|
}
|
|
47
47
|
return _jsx(SelectField, { ...selectProps }, name);
|
|
48
48
|
}
|
|
49
|
-
if (field.type ===
|
|
49
|
+
if (field.type === "check") {
|
|
50
50
|
return (_jsx(CheckboxField, { attr: name, label: field.name, createdForm: form, disabled: field.disabled }, name));
|
|
51
51
|
}
|
|
52
|
-
if (field.type ===
|
|
52
|
+
if (field.type === "switch") {
|
|
53
53
|
return (_jsx(SwitchField, { attr: name, label: field.name, createdForm: form, disabled: field.disabled, onChange: (value) => handleChange?.(value) }, name));
|
|
54
54
|
}
|
|
55
|
-
if (field.type ===
|
|
55
|
+
if (field.type === "datepicker") {
|
|
56
56
|
const handleBlur = getOnBlurFn(field.attr);
|
|
57
|
-
return (_jsx(DatePickerField, { attr: name, label: field.size ===
|
|
57
|
+
return (_jsx(DatePickerField, { attr: name, label: field.size === "small" ? undefined : field.name, createdForm: form, disabled: field.disabled, required: field.required, onChange: (_attr, value) => handleChange?.(value), onBlur: handleBlur, height: field.size === "small" ? "32px" : undefined }, name));
|
|
58
58
|
}
|
|
59
|
-
if (field.type ===
|
|
60
|
-
return (_jsx(TextField, { attr: name, label: field.name, createdForm: form, disabled: field.disabled, required: field.required, onChange: (value) => handleChange?.(value), multiline: true, rows: field.rows,
|
|
59
|
+
if (field.type === "textarea") {
|
|
60
|
+
return (_jsx(TextField, { attr: name, label: field.name, createdForm: form, disabled: field.disabled, required: field.required, onChange: (value) => handleChange?.(value), multiline: true, rows: field.rows, infoText: field.infoText, defaultEndAdornments: field.infoText ? ["info"] : ["close"] }, name));
|
|
61
61
|
}
|
|
62
|
-
if (field.type ===
|
|
62
|
+
if (field.type === "color") {
|
|
63
63
|
return (_jsx(FormColorField, { attr: name, label: field.name, form: form, disabled: field.disabled, tooltipText: field.tooltipText, onChange: (value) => handleChange?.(value) }, name));
|
|
64
64
|
}
|
|
65
65
|
const handleBlur = getOnBlurFn(field.attr);
|
|
66
|
-
return (_jsx(TextField, { attr: name, label: field.size ===
|
|
66
|
+
return (_jsx(TextField, { attr: name, label: field.size === "small" ? undefined : field.name, placeholder: field.size === "small" ? field.name : undefined, createdForm: form, mask: field.mask, blurMask: field.blurMask, disabled: field.disabled, required: field.required, onChange: (value) => handleChange?.(value), height: field.size === "small" ? "32px" : undefined, onBlur: handleBlur, infoText: field.infoText, defaultEndAdornments: field.infoText ? ["info"] : ["close"] }, name));
|
|
67
67
|
};
|
|
68
68
|
return (_jsx("div", { className: "app-form-container", children: groupFieldsIntoRows(fields).map((row, rowIdx) => (_jsx("div", { className: "app-form-row", children: row.map((field) => (_jsx("div", { className: "app-form-field", style: getFieldFlexStyle(field), children: renderField(field) }, field.attr))) }, rowIdx))) }));
|
|
69
69
|
}
|