ish-ui 1.0.36 → 1.0.37
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { RadioButtonsProps } from '../model';
|
|
3
|
+
declare function FormRadioButtons({ items, disabled, input: { value, onChange, name }, meta: { invalid, error }, labelPath, valuePath, color, row, label, labelClass, labelAdornment, radioProps, radioGroupProps }: RadioButtonsProps): React.JSX.Element;
|
|
4
|
+
export default FormRadioButtons;
|
|
@@ -6,22 +6,24 @@
|
|
|
6
6
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
7
7
|
*/
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import {
|
|
10
|
-
import { FormControl, FormControlLabel, Radio, RadioGroup } from '@mui/material';
|
|
9
|
+
import { FormControl, FormControlLabel, FormHelperText, InputLabel, Radio, RadioGroup, } from '@mui/material';
|
|
11
10
|
import Typography from '@mui/material/Typography';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
display: 'flex'
|
|
15
|
-
},
|
|
11
|
+
import { makeAppStyles } from '../styles';
|
|
12
|
+
const useStyles = makeAppStyles(theme => ({
|
|
16
13
|
group: {
|
|
17
14
|
margin: theme.spacing(1, 0)
|
|
18
15
|
}
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
return (React.createElement(
|
|
23
|
-
React.createElement(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
16
|
+
}));
|
|
17
|
+
function FormRadioButtons({ items, disabled, input: { value, onChange, name }, meta: { invalid, error }, labelPath = 'label', valuePath = 'value', color = 'primary', row, label, labelClass, labelAdornment, radioProps, radioGroupProps }) {
|
|
18
|
+
const classes = useStyles();
|
|
19
|
+
return (React.createElement(FormControl, { component: "fieldset", error: invalid },
|
|
20
|
+
label && (React.createElement(InputLabel, { shrink: true, htmlFor: `input-${name}`, className: labelClass },
|
|
21
|
+
label,
|
|
22
|
+
labelAdornment)),
|
|
23
|
+
React.createElement(RadioGroup, Object.assign({ className: classes.group, value: value, onChange: (e) => onChange(e.target.value), row: row }, radioGroupProps), items
|
|
24
|
+
&& items.map((i, n) => (React.createElement(FormControlLabel, { key: n, value: i[valuePath], control: React.createElement(Radio, Object.assign({ color: color, id: `input-${n}-${name}`, name: name }, radioProps)), label: (React.createElement(Typography, { component: "span", variant: "body2" }, i[labelPath])), disabled: disabled, htmlFor: `input-${n}-${name}` })))),
|
|
25
|
+
React.createElement(FormHelperText, { classes: {
|
|
26
|
+
error: 'shakingError'
|
|
27
|
+
} }, error)));
|
|
28
|
+
}
|
|
29
|
+
export default FormRadioButtons;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const selectStyles: (theme: any) => import("@mui/styles").StyleRules<{}, "label" | "
|
|
2
|
+
export declare const selectStyles: (theme: any) => import("@mui/styles").StyleRules<{}, "label" | "error" | "inline" | "multiple" | "root" | "expandIcon" | "menuItem" | "inputWrapper" | "readonly" | "editIcon" | "bottomMargin" | "bottomPadding" | "topMargin" | "editable" | "valid" | "autoWidthSelect" | "emptySelect" | "validUnderline" | "menuItemActive" | "menuList" | "hasPopup" | "hasClear">;
|
|
3
3
|
export declare const ListRow: React.MemoExoticComponent<any>;
|
|
4
4
|
export declare const ListboxComponent: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<any>>;
|
|
5
5
|
export declare const NoWrapOption: (content: any, data: any, search: any, parentProps: any) => React.JSX.Element;
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* */
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { FieldInputProps, FormSwitchProps } from '../model';
|
|
6
|
-
export declare const Switch: React.JSXElementConstructor<Omit<any, "classes"> & import("@mui/styles").StyledComponentProps<"
|
|
6
|
+
export declare const Switch: React.JSXElementConstructor<Omit<any, "classes"> & import("@mui/styles").StyledComponentProps<"icon" | "disabled" | "checked" | "default" | "bar" | "inline" | "root" | "focusVisible">>;
|
|
7
7
|
export declare function FormSwitch<InputProps extends FieldInputProps>({ input, color, disabled, stringValue, label, className, inline, onChangeHandler, onClick }: FormSwitchProps<InputProps>): React.JSX.Element;
|
package/dist/model/Fields.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ import { AnyArgFunction } from '../model/CommonFunctions';
|
|
|
5
5
|
import { ShowConfirmCaller } from '../model/Confirm';
|
|
6
6
|
import { PopperPlacementType } from '@mui/material';
|
|
7
7
|
import { FormControlTypeMap } from '@mui/material/FormControl/FormControl';
|
|
8
|
+
import { RadioProps } from '@mui/material/Radio/Radio';
|
|
9
|
+
import { RadioGroupProps } from '@mui/material/RadioGroup/RadioGroup';
|
|
8
10
|
export type EventHandler<Event> = (event: Event, name?: string) => void;
|
|
9
11
|
export interface EventOrValueHandler<Event> extends EventHandler<Event> {
|
|
10
12
|
(value: any): void;
|
|
@@ -244,6 +246,23 @@ export interface ColorPickerWrapperProps {
|
|
|
244
246
|
placement?: PopperPlacementType;
|
|
245
247
|
width?: number;
|
|
246
248
|
}
|
|
249
|
+
export interface RadioButtonsProps<IP = FieldInputProps, MP = FieldMetaProps> {
|
|
250
|
+
items: Record<any, any>[];
|
|
251
|
+
input?: Partial<Omit<IP, 'onBlur'>> & {
|
|
252
|
+
onBlur?: AnyArgFunction;
|
|
253
|
+
};
|
|
254
|
+
meta?: Partial<MP>;
|
|
255
|
+
disabled?: boolean;
|
|
256
|
+
labelPath?: string;
|
|
257
|
+
valuePath?: string;
|
|
258
|
+
row?: boolean;
|
|
259
|
+
label?: any;
|
|
260
|
+
labelClass?: string;
|
|
261
|
+
labelAdornment?: any;
|
|
262
|
+
color?: RadioProps['color'];
|
|
263
|
+
radioProps?: RadioProps;
|
|
264
|
+
radioGroupProps?: RadioGroupProps;
|
|
265
|
+
}
|
|
247
266
|
export type FormFieldProps = ({
|
|
248
267
|
type: 'phone' | 'duration' | 'text' | 'multilineText' | 'password' | 'number' | 'file' | 'money';
|
|
249
268
|
} & FormFieldBaseProps & EditInPlaceFieldProps<FieldInputProps, FieldMetaProps>) | ({
|
|
@@ -263,5 +282,7 @@ export type FormFieldProps = ({
|
|
|
263
282
|
} & FormFieldBaseProps & TagsFieldProps<TagLike, FieldInputProps, FieldMetaProps>) | ({
|
|
264
283
|
type: 'color';
|
|
265
284
|
} & ColorPickerWrapperProps) | ({
|
|
285
|
+
type: 'radio';
|
|
286
|
+
} & RadioButtonsProps) | ({
|
|
266
287
|
type: 'stub';
|
|
267
288
|
});
|