@codezee/sixtify-brahma 0.2.191 → 0.2.193
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/package.json +1 -1
- package/packages/shared-components/dist/AgGrid/AgGrid.js +6 -6
- package/packages/shared-components/dist/FilterList/FilterTypeWrapper.d.ts +1 -0
- package/packages/shared-components/dist/FilterList/FilterTypeWrapper.d.ts.map +1 -1
- package/packages/shared-components/dist/FilterList/GetFilterPopupComponent.d.ts.map +1 -1
- package/packages/shared-components/dist/FilterList/GetFilterPopupComponent.js +6 -2
- package/packages/shared-components/dist/FormFields/Autocomplete/Autocomplete.d.ts +3 -2
- package/packages/shared-components/dist/FormFields/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/packages/shared-components/dist/FormFields/Autocomplete/Autocomplete.js +12 -4
- package/packages/shared-components/dist/FormFields/RadioGroupField/RadioGroupField.d.ts +1 -1
- package/packages/shared-components/dist/FormFields/RadioGroupField/RadioGroupField.d.ts.map +1 -1
- package/packages/shared-components/dist/FormFields/RadioGroupField/RadioGroupField.js +32 -14
- package/packages/shared-components/dist/FormFields/Select/Select.js +1 -1
package/package.json
CHANGED
|
@@ -76,7 +76,7 @@ exports.AgGrid = (0, react_1.forwardRef)((props, ref) => {
|
|
|
76
76
|
if (datasource) {
|
|
77
77
|
setTimeout(() => {
|
|
78
78
|
const displayedCount = api.getDisplayedRowCount();
|
|
79
|
-
const renderedNodes = api.getRenderedNodes()
|
|
79
|
+
const renderedNodes = api.getRenderedNodes()?.length ?? 0;
|
|
80
80
|
updateNoRowsOverlay(api, displayedCount === 0 && renderedNodes === 0);
|
|
81
81
|
}, 50);
|
|
82
82
|
}
|
|
@@ -84,7 +84,7 @@ exports.AgGrid = (0, react_1.forwardRef)((props, ref) => {
|
|
|
84
84
|
else {
|
|
85
85
|
setTimeout(() => {
|
|
86
86
|
const displayedCount = api.getDisplayedRowCount();
|
|
87
|
-
const renderedNodes = api.getRenderedNodes()
|
|
87
|
+
const renderedNodes = api.getRenderedNodes()?.length ?? 0;
|
|
88
88
|
updateNoRowsOverlay(api, displayedCount === 0 && renderedNodes === 0);
|
|
89
89
|
}, 50);
|
|
90
90
|
}
|
|
@@ -117,13 +117,13 @@ exports.AgGrid = (0, react_1.forwardRef)((props, ref) => {
|
|
|
117
117
|
const datasource = api.getGridOption("datasource");
|
|
118
118
|
if (datasource) {
|
|
119
119
|
setTimeout(() => {
|
|
120
|
-
updateNoRowsOverlay(api, !api.getDisplayedRowCount() && !api.getRenderedNodes()
|
|
120
|
+
updateNoRowsOverlay(api, !api.getDisplayedRowCount() && !api.getRenderedNodes()?.length);
|
|
121
121
|
}, 50);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
else {
|
|
125
125
|
setTimeout(() => {
|
|
126
|
-
updateNoRowsOverlay(api, !api.getDisplayedRowCount() && !api.getRenderedNodes()
|
|
126
|
+
updateNoRowsOverlay(api, !api.getDisplayedRowCount() && !api.getRenderedNodes()?.length);
|
|
127
127
|
}, 50);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
@@ -136,13 +136,13 @@ exports.AgGrid = (0, react_1.forwardRef)((props, ref) => {
|
|
|
136
136
|
const datasource = api.getGridOption("datasource");
|
|
137
137
|
if (datasource) {
|
|
138
138
|
setTimeout(() => {
|
|
139
|
-
updateNoRowsOverlay(api, !api.getDisplayedRowCount() && !api.getRenderedNodes()
|
|
139
|
+
updateNoRowsOverlay(api, !api.getDisplayedRowCount() && !api.getRenderedNodes()?.length);
|
|
140
140
|
}, 50);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
else {
|
|
144
144
|
setTimeout(() => {
|
|
145
|
-
updateNoRowsOverlay(api, !api.getDisplayedRowCount() && !api.getRenderedNodes()
|
|
145
|
+
updateNoRowsOverlay(api, !api.getDisplayedRowCount() && !api.getRenderedNodes()?.length);
|
|
146
146
|
}, 50);
|
|
147
147
|
}
|
|
148
148
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterTypeWrapper.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterTypeWrapper.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG5D,MAAM,MAAM,mBAAmB,GAC3B,cAAc,GACd,MAAM,GACN,MAAM,GACN,WAAW,GACX,UAAU,GACV,OAAO,GACP,QAAQ,CAAC;AAEb,KAAK,OAAO,GAAG,SAAS;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,EAAE,CAAC;AAEJ,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,mBAAmB,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FilterTypeWrapper.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterTypeWrapper.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG5D,MAAM,MAAM,mBAAmB,GAC3B,cAAc,GACd,MAAM,GACN,MAAM,GACN,WAAW,GACX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,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAQ1D,KAAK,2BAA2B,GAAG;IACjC,cAAc,EAAE,cAAc,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC9B,MAAM,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IACjC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,EACtC,cAAc,EACd,OAAO,EACP,MAAM,EACN,cAAc,EACd,SAAiB,GAClB,EAAE,2BAA2B,GAAG,wBAAwB,
|
|
1
|
+
{"version":3,"file":"GetFilterPopupComponent.d.ts","sourceRoot":"","sources":["../../src/FilterList/GetFilterPopupComponent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAOzE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAQ1D,KAAK,2BAA2B,GAAG;IACjC,cAAc,EAAE,cAAc,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC9B,MAAM,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IACjC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,EACtC,cAAc,EACd,OAAO,EACP,MAAM,EACN,cAAc,EACd,SAAiB,GAClB,EAAE,2BAA2B,GAAG,wBAAwB,CAsFxD"}
|
|
@@ -8,8 +8,11 @@ function getFilterPopupComponent({ selectedFilter, control, errors, setIsPopupOp
|
|
|
8
8
|
const theme = (0, material_1.useTheme)();
|
|
9
9
|
const { sapphireBlue, black } = theme.palette.app.color;
|
|
10
10
|
const errorSelectedKey = errors[selectedFilter.key];
|
|
11
|
+
const { placeholder, label } = selectedFilter;
|
|
12
|
+
const autocompletePlaceholder = placeholder ?? `Select ${label}`;
|
|
13
|
+
const textFieldPlaceholder = placeholder ?? label;
|
|
11
14
|
return {
|
|
12
|
-
autoComplete: selectedFilter.options && ((0, jsx_runtime_1.jsx)(FormFields_1.Autocomplete, { disableClearable: true, multiple: selectedFilter.multiSelect ?? false, placeholder:
|
|
15
|
+
autoComplete: selectedFilter.options && ((0, jsx_runtime_1.jsx)(FormFields_1.Autocomplete, { disableClearable: true, multiple: selectedFilter.multiSelect ?? false, placeholder: autocompletePlaceholder, name: `${selectedFilter.key}`, disabled: selectedFilter.isDisabled, shouldCloseOnSelect: selectedFilter.multiSelect ?? false, control: control, options: selectedFilter.options ?? [], onOpen: () => setIsPopupOpen?.(true), onClose: () => setIsPopupOpen?.(false), autoFocus: autoFocus, sx: {
|
|
13
16
|
maxHeight: "250px",
|
|
14
17
|
overflowY: "auto",
|
|
15
18
|
width: "100%",
|
|
@@ -19,6 +22,7 @@ function getFilterPopupComponent({ selectedFilter, control, errors, setIsPopupOp
|
|
|
19
22
|
},
|
|
20
23
|
}, ...(selectedFilter.employeeAutocomplete && {
|
|
21
24
|
isShowEmployeeData: true,
|
|
25
|
+
isShowOptionsOnType: true,
|
|
22
26
|
getOptionLabel: (option) => {
|
|
23
27
|
if (typeof option === "string") {
|
|
24
28
|
return option;
|
|
@@ -26,7 +30,7 @@ function getFilterPopupComponent({ selectedFilter, control, errors, setIsPopupOp
|
|
|
26
30
|
return `${option.label} (${option.employee_code}) - ${option.punch_code}`;
|
|
27
31
|
},
|
|
28
32
|
}), error: !!errorSelectedKey, helperText: errorSelectedKey?.message })),
|
|
29
|
-
text: ((0, jsx_runtime_1.jsx)(FormFields_1.TextField, { name: selectedFilter.key, control: control, disabled: selectedFilter.isDisabled, placeholder:
|
|
33
|
+
text: ((0, jsx_runtime_1.jsx)(FormFields_1.TextField, { name: selectedFilter.key, control: control, disabled: selectedFilter.isDisabled, placeholder: textFieldPlaceholder, error: !!errorSelectedKey, helperText: errorSelectedKey?.message, autoFocus: autoFocus })),
|
|
30
34
|
date: ((0, jsx_runtime_1.jsx)(FormFields_1.DatePicker, { name: selectedFilter.key, control: control, disabled: selectedFilter.isDisabled, error: !!errorSelectedKey, helperText: errorSelectedKey?.message, autoFocus: autoFocus, ...(selectedFilter.monthYearFormat && {
|
|
31
35
|
format: "MMM yyyy",
|
|
32
36
|
views: ["year", "month"],
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AutocompleteValue, AutocompleteProps as MuiAutocompleteProps, StackProps } from "@mui/material";
|
|
2
|
+
import { type HTMLProps, type ReactNode } from "react";
|
|
2
3
|
import { type ControllerRenderProps, type FieldValues, type UseControllerProps, type UseFormSetValue } from "react-hook-form";
|
|
3
4
|
import { type NavigationKey } from "../../utils/hooks/useFormFieldFocus";
|
|
4
5
|
import type { OnAction, Styling } from "../../utils/types";
|
|
@@ -21,7 +22,7 @@ export type AutocompleteProps<P extends FieldValues> = UseControllerProps<P> & O
|
|
|
21
22
|
isShowAvatar?: boolean;
|
|
22
23
|
shouldCloseOnSelect?: boolean;
|
|
23
24
|
actionInsideAutocomplete?: boolean;
|
|
24
|
-
actionIcon?:
|
|
25
|
+
actionIcon?: ReactNode;
|
|
25
26
|
onActionClick?: () => void;
|
|
26
27
|
onAction?: OnAction;
|
|
27
28
|
isShowSelectAll?: boolean;
|
|
@@ -29,7 +30,7 @@ export type AutocompleteProps<P extends FieldValues> = UseControllerProps<P> & O
|
|
|
29
30
|
autoFocus?: boolean;
|
|
30
31
|
isShowEmployeeData?: boolean;
|
|
31
32
|
maxLimit?: number;
|
|
32
|
-
renderOption?: (props:
|
|
33
|
+
renderOption?: (props: HTMLProps<HTMLLIElement>, option: Option, state: {
|
|
33
34
|
selected: boolean;
|
|
34
35
|
}) => JSX.Element;
|
|
35
36
|
getOptionLabel?: (option: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../../src/FormFields/Autocomplete/Autocomplete.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,iBAAiB,EACjB,iBAAiB,IAAI,oBAAoB,EACzC,UAAU,EACX,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../../src/FormFields/Autocomplete/Autocomplete.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,iBAAiB,EACjB,iBAAiB,IAAI,oBAAoB,EACzC,UAAU,EACX,MAAM,eAAe,CAAC;AAyBvB,OAAO,EAML,KAAK,SAAS,EAGd,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AACf,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAEhB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACrB,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAU3D,MAAM,MAAM,MAAM,GAAG;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,WAAW,IAAI,kBAAkB,CAAC,CAAC,CAAC,GAC1E,IAAI,CACF,IAAI,CACF,oBAAoB,CAAC,MAAM,EA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AAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,aAAa,CAAC;IAG9B,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEJ,wBAAgB,YAAY,CAAC,CAAC,SAAS,WAAW,EAAE,EAClD,OAAO,EACP,YAAY,EACZ,IAAI,EACJ,QAAgB,EAChB,KAAK,EACL,QAAgB,EAChB,QAAgB,EAChB,OAAY,EACZ,KAAK,EACL,OAAe,EACf,UAAU,EACV,KAAK,EACL,SAAiB,EACjB,WAAgB,EAChB,QAAQ,EACR,mBAA2B,EAC3B,eAAsB,EACtB,YAAoB,EACpB,kBAA0B,EAC1B,mBAA2B,EAC3B,wBAAgC,EAChC,UAAU,EACV,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,SAAiB,EACjB,aAAa,EACb,gBAA0C,EAC1C,cAAc,EACd,QAAQ,EACR,SAAa,EACb,OAAkB,EAClB,aAAqB,EACrB,cAAc,EACd,cAAsB,EACtB,GAAG,SAAS,EACb,EAAE,iBAAiB,CAAC,CAAC,CAAC,2CAw0BtB"}
|
|
@@ -221,7 +221,7 @@ function Autocomplete({ control, defaultValue, name, required = false, label, mu
|
|
|
221
221
|
borderRadius: "50%",
|
|
222
222
|
},
|
|
223
223
|
width: "100%",
|
|
224
|
-
}, open: internalOpen, onOpen: handleOpen, onClose: handleClose, disableCloseOnSelect: multiple
|
|
224
|
+
}, open: internalOpen, onOpen: handleOpen, onClose: handleClose, disableCloseOnSelect: multiple && !shouldCloseOnSelect, disabled: disabled, freeSolo: freeSolo, ...restMuiProps, ...restField, disableClearable: disableClearable, slotProps: {
|
|
225
225
|
clearIndicator: {
|
|
226
226
|
tabIndex: disableClearable ||
|
|
227
227
|
(multiple
|
|
@@ -240,14 +240,22 @@ function Autocomplete({ control, defaultValue, name, required = false, label, mu
|
|
|
240
240
|
},
|
|
241
241
|
popupIndicator: {
|
|
242
242
|
tabIndex: disabled ? -1 : 0,
|
|
243
|
+
onClick: (event) => {
|
|
244
|
+
event.preventDefault();
|
|
245
|
+
event.stopPropagation();
|
|
246
|
+
if (internalOpen) {
|
|
247
|
+
handleClose(event, "toggleInput");
|
|
248
|
+
handleClose(event, "blur");
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
handleOpen(event);
|
|
252
|
+
}
|
|
253
|
+
},
|
|
243
254
|
onKeyDown: (event) => {
|
|
244
255
|
if (navigationKey === "enter" && event.key === "Enter") {
|
|
245
256
|
handleEnterNavigation(event);
|
|
246
257
|
}
|
|
247
258
|
},
|
|
248
|
-
onMouseDown: (event) => {
|
|
249
|
-
event.stopPropagation();
|
|
250
|
-
},
|
|
251
259
|
},
|
|
252
260
|
}, renderTags: (value, getTagProps) => {
|
|
253
261
|
const visibleTags = limitTags ? value.slice(0, limitTags) : value;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type StackOwnProps, type StackProps, type SxProps } from "@mui/material";
|
|
2
2
|
import { type RadioProps as MuiRadioProps } from "@mui/material/Radio";
|
|
3
|
-
import type
|
|
3
|
+
import { type ReactNode } from "react";
|
|
4
4
|
import { type ControllerRenderProps, type FieldValues, type UseControllerProps } from "react-hook-form";
|
|
5
5
|
import { type NavigationKey } from "../../utils/hooks/useFormFieldFocus";
|
|
6
6
|
type Options = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroupField.d.ts","sourceRoot":"","sources":["../../../src/FormFields/RadioGroupField/RadioGroupField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,OAAO,EACb,MAAM,eAAe,CAAC;AACvB,OAAc,EAAE,KAAK,UAAU,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"RadioGroupField.d.ts","sourceRoot":"","sources":["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EN,wBAAgB,eAAe,CAAC,CAAC,SAAS,WAAW,EAAE,EACrD,IAAI,EACJ,KAAK,EACL,KAAK,EACL,OAAO,EACP,OAAO,EACP,YAAY,EACZ,IAAc,EACd,KAAmB,EACnB,OAAe,EACf,QAAgB,EAChB,SAAiB,EACjB,EAAO,EACP,cAAc,EACd,YAAoB,EACpB,aAAqB,EACrB,cAAc,EACd,GAAG,oBAAoB,EACxB,EAAE,oBAAoB,CAAC,CAAC,CAAC,2CAwIzB"}
|
|
@@ -7,12 +7,14 @@ exports.RadioGroupField = RadioGroupField;
|
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const material_1 = require("@mui/material");
|
|
9
9
|
const Radio_1 = __importDefault(require("@mui/material/Radio"));
|
|
10
|
+
const react_1 = require("react");
|
|
10
11
|
const react_hook_form_1 = require("react-hook-form");
|
|
11
12
|
const useFormFieldFocus_1 = require("../../utils/hooks/useFormFieldFocus");
|
|
12
13
|
const Skeleton_1 = require("./Skeleton");
|
|
13
14
|
function RadioGroupField({ name, rules, label, control, options, defaultValue, size = "small", color = "secondary", loading = false, required = false, direction = "row", sx = {}, containerProps, isHorizontal = false, navigationKey = "tab", customOnChange, ...restRadioButtonProps }) {
|
|
14
15
|
const { field: { value, onChange, ref, ...restField }, } = (0, react_hook_form_1.useController)({ name, control, defaultValue, rules });
|
|
15
16
|
const { inputRef, handleKeyDown: handleNavigationKeyDown, maintainFocus, } = (0, useFormFieldFocus_1.useFormFieldFocus)({ navigationKey });
|
|
17
|
+
const fallbackInputRef = (0, react_1.useRef)(null);
|
|
16
18
|
const handleKeyDown = (event) => {
|
|
17
19
|
handleNavigationKeyDown(event, undefined, false);
|
|
18
20
|
};
|
|
@@ -23,19 +25,19 @@ function RadioGroupField({ name, rules, label, control, options, defaultValue, s
|
|
|
23
25
|
whiteSpace: "normal",
|
|
24
26
|
overflow: "visible",
|
|
25
27
|
textOverflow: "unset",
|
|
26
|
-
}, required: required, disabled: restRadioButtonProps.disabled, children: label })), (0, jsx_runtime_1.jsx)(material_1.RadioGroup, { name: name, value: value, onKeyDown: handleKeyDown, onChange: (
|
|
28
|
+
}, required: required, disabled: restRadioButtonProps.disabled, children: label })), (0, jsx_runtime_1.jsx)(material_1.RadioGroup, { name: name, value: value, onKeyDown: handleKeyDown, onChange: (event, radioValue) => {
|
|
27
29
|
let selectedValue;
|
|
28
|
-
if (
|
|
30
|
+
if (radioValue === "true") {
|
|
29
31
|
selectedValue = true;
|
|
30
32
|
onChange(true);
|
|
31
33
|
}
|
|
32
|
-
else if (
|
|
34
|
+
else if (radioValue === "false") {
|
|
33
35
|
selectedValue = false;
|
|
34
36
|
onChange(false);
|
|
35
37
|
}
|
|
36
38
|
else {
|
|
37
|
-
selectedValue =
|
|
38
|
-
onChange(
|
|
39
|
+
selectedValue = radioValue;
|
|
40
|
+
onChange(radioValue);
|
|
39
41
|
}
|
|
40
42
|
if (customOnChange) {
|
|
41
43
|
const selectedOption = options.find(({ values }) => values === selectedValue);
|
|
@@ -43,20 +45,36 @@ function RadioGroupField({ name, rules, label, control, options, defaultValue, s
|
|
|
43
45
|
customOnChange(selectedOption);
|
|
44
46
|
}
|
|
45
47
|
}
|
|
48
|
+
const targetInput = event.target;
|
|
49
|
+
if (targetInput) {
|
|
50
|
+
inputRef.current = targetInput;
|
|
51
|
+
}
|
|
52
|
+
else if (!inputRef.current && fallbackInputRef.current) {
|
|
53
|
+
inputRef.current = fallbackInputRef.current;
|
|
54
|
+
}
|
|
46
55
|
maintainFocus();
|
|
47
56
|
}, children: (0, jsx_runtime_1.jsx)(material_1.Stack, { gap: direction === "column" ? "5px" : "10px", direction: direction, ...containerProps, children: options?.map(({ label, values, disabled }, index) => {
|
|
48
57
|
return (
|
|
49
58
|
// eslint-disable-next-line sonarjs/no-array-index-key
|
|
50
|
-
(0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { value: values, control: (0, jsx_runtime_1.jsx)(Radio_1.default, { ...restField, ...restRadioButtonProps,
|
|
51
|
-
if (el
|
|
59
|
+
(0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { value: values, control: (0, jsx_runtime_1.jsx)(Radio_1.default, { ...restField, ...restRadioButtonProps, color: color, size: size, inputRef: (el) => {
|
|
60
|
+
if (!el) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const shouldUseAsPrimaryRef = value === values ||
|
|
64
|
+
(!inputRef.current && index === 0);
|
|
65
|
+
if (shouldUseAsPrimaryRef) {
|
|
52
66
|
inputRef.current = el;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
fallbackInputRef.current = el;
|
|
68
|
+
}
|
|
69
|
+
else if (!fallbackInputRef.current && index === 0) {
|
|
70
|
+
fallbackInputRef.current = el;
|
|
71
|
+
}
|
|
72
|
+
if (ref) {
|
|
73
|
+
if (typeof ref === "function") {
|
|
74
|
+
ref(el);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
ref.current = el;
|
|
60
78
|
}
|
|
61
79
|
}
|
|
62
80
|
} }), disabled: disabled, label: label, sx: sx }) }, index));
|
|
@@ -82,7 +82,7 @@ function Select({ control, defaultValue, name, required = false, label, multiple
|
|
|
82
82
|
gap: 0.5,
|
|
83
83
|
overflow: "hidden",
|
|
84
84
|
}, children: [visibleItems.map((option) => ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", noWrap: true, color: disabledColor, sx: {
|
|
85
|
-
|
|
85
|
+
WebkitTextFillColor: disabledColor,
|
|
86
86
|
backgroundColor: slate[800],
|
|
87
87
|
padding: "2px 5px",
|
|
88
88
|
borderRadius: "12px",
|