ish-ui 1.0.35 → 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.
- package/dist/formFields/FormRadioButtons.d.ts +3 -2
- package/dist/formFields/FormRadioButtons.js +17 -15
- package/dist/formFields/SelectCustomComponents.d.ts +1 -1
- package/dist/formFields/Switch.d.ts +1 -1
- package/dist/model/Calendar.d.ts +5 -0
- package/dist/model/Calendar.js +8 -0
- package/dist/model/Fields.d.ts +21 -0
- package/dist/model/index.d.ts +1 -0
- package/dist/model/index.js +1 -0
- package/dist/timetable/miniCalendar/CalendarDay.d.ts +6 -9
- package/dist/timetable/miniCalendar/CalendarDay.js +3 -8
- package/dist/utils/dates/timetable.d.ts +2 -5
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright ish group pty ltd 2023.
|
|
3
|
+
*
|
|
4
|
+
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
|
|
5
|
+
*
|
|
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
|
+
*/
|
|
8
|
+
export {};
|
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
|
});
|
package/dist/model/index.d.ts
CHANGED
package/dist/model/index.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DateArgFunction } from '../../model';
|
|
3
|
-
interface Props {
|
|
4
|
-
|
|
2
|
+
import { DateArgFunction, CalendarDayModel } from '../../model';
|
|
3
|
+
interface Props extends CalendarDayModel {
|
|
4
|
+
dayIndexValue: number;
|
|
5
|
+
isSameAsTarget?: boolean;
|
|
6
|
+
hasSession?: boolean;
|
|
5
7
|
isToday?: boolean;
|
|
6
|
-
|
|
7
|
-
date: Date;
|
|
8
|
-
status: string;
|
|
9
|
-
selectedMonthSessionDays: number[];
|
|
10
|
-
disabled: boolean;
|
|
11
|
-
theme?: any;
|
|
8
|
+
disabled?: boolean;
|
|
12
9
|
targetDay?: Date;
|
|
13
10
|
setTargetDay?: DateArgFunction;
|
|
14
11
|
customClasses?: {
|
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
*
|
|
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
|
-
import React, {
|
|
8
|
+
import React, { memo } from 'react';
|
|
9
9
|
import { Button } from '@mui/material';
|
|
10
|
-
import { isSameDay } from 'date-fns';
|
|
11
10
|
import clsx from 'clsx';
|
|
12
11
|
import { alpha } from '@mui/material/styles';
|
|
13
12
|
import { makeAppStyles } from '../../styles';
|
|
@@ -55,13 +54,9 @@ const useStyles = makeAppStyles(theme => ({
|
|
|
55
54
|
}
|
|
56
55
|
}));
|
|
57
56
|
const CalendarDay = memo((props) => {
|
|
58
|
-
const { customClasses = {}, day,
|
|
59
|
-
const isSame = isSameDay(targetDay, date);
|
|
60
|
-
const isToday = isSameDay(new Date(), date);
|
|
61
|
-
const dayIndexValue = selectedMonthSessionDays[day - 1];
|
|
62
|
-
const hasSession = useMemo(() => selectedMonthSessionDays.length && status === 'current' && dayIndexValue !== 0, [selectedMonthSessionDays, dayIndexValue, status]);
|
|
57
|
+
const { customClasses = {}, day, date, setTargetDay, dayIndexValue, hasSession, isSameAsTarget, isToday, disabled } = props;
|
|
63
58
|
const classes = useStyles({ dayIndexValue, hasSession, isToday });
|
|
64
|
-
return (React.createElement(Button, { className: clsx(classes.root, customClasses.root,
|
|
59
|
+
return (React.createElement(Button, { className: clsx(classes.root, customClasses.root, isSameAsTarget && clsx(classes.same, customClasses.selected), {
|
|
65
60
|
[customClasses.hasSession || classes.hasSession]: hasSession,
|
|
66
61
|
[customClasses.today || classes.isToday]: isToday
|
|
67
62
|
}), onClick: () => setTargetDay(date), classes: {
|