Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/material-renderers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"@jsonforms/react": "3.7.0-alpha.1",
"@mui/icons-material": "^7.0.0",
"@mui/material": "^7.0.0",
"@mui/x-date-pickers": "^7.28.0",
"@mui/x-date-pickers": "^8.0.0",
"react": "^16.12.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
},
"devDependencies": {
Expand All @@ -100,7 +100,7 @@
"@jsonforms/react": "workspace:*",
"@mui/icons-material": "^7.3.0",
"@mui/material": "^7.3.0",
"@mui/x-date-pickers": "^7.29.4",
"@mui/x-date-pickers": "^8.11.3",
"@rollup/plugin-commonjs": "^23.0.3",
"@rollup/plugin-json": "^5.0.2",
"@rollup/plugin-node-resolve": "^15.0.1",
Expand Down
17 changes: 11 additions & 6 deletions packages/material-renderers/src/controls/MaterialDateControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ import {
createOnChangeHandler,
getData,
useFocus,
useInputVariant,
} from '../util';

export const MaterialDateControl = (props: ControlProps) => {
const [focused, onFocus, onBlur] = useFocus();
const inputVariant = useInputVariant();
const {
description,
id,
Expand Down Expand Up @@ -75,6 +77,7 @@ export const MaterialDateControl = (props: ControlProps) => {
const saveFormat = appliedUiSchemaOptions.dateSaveFormat ?? defaultDateFormat;

const views = appliedUiSchemaOptions.views ?? ['year', 'day'];
const closeOnSelect = appliedUiSchemaOptions.closeOnSelect ?? true;

const firstFormHelperText = showDescription
? description
Expand All @@ -100,7 +103,7 @@ export const MaterialDateControl = (props: ControlProps) => {
updateChild,
onBlur
),
[path, handleChange, format, saveFormat, updateChild]
[path, handleChange, format, saveFormat, updateChild, onBlur]
);
const value = getData(data, saveFormat);

Expand All @@ -121,23 +124,25 @@ export const MaterialDateControl = (props: ControlProps) => {
format={format}
views={views}
disabled={!enabled}
closeOnSelect={closeOnSelect}
slotProps={{
actionBar: ({ wrapperVariant }) => ({
actionBar: ({ pickerVariant }) => ({
actions:
wrapperVariant === 'desktop' ? [] : ['clear', 'cancel', 'accept'],
pickerVariant === 'desktop' ? [] : ['clear', 'cancel', 'accept'],
}),
textField: {
id: id + '-input',
required: required && !appliedUiSchemaOptions.hideRequiredAsterisk,
autoFocus: appliedUiSchemaOptions.focus,
error: !isValid,
fullWidth: !appliedUiSchemaOptions.trim,
variant: inputVariant,
inputProps: {
autoFocus: appliedUiSchemaOptions.focus,
type: 'text',
onFocus: onFocus,
onBlur: onBlurHandler,
},
InputLabelProps: data ? { shrink: true } : undefined,
onFocus: onFocus,
onBlur: onBlurHandler,
},
}}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ import {
createOnChangeHandler,
getData,
useFocus,
useInputVariant,
} from '../util';

export const MaterialDateTimeControl = (props: ControlProps) => {
const [focused, onFocus, onBlur] = useFocus();
const inputVariant = useInputVariant();
const {
id,
description,
Expand Down Expand Up @@ -82,6 +84,7 @@ export const MaterialDateTimeControl = (props: ControlProps) => {
'hours',
'minutes',
];
const closeOnSelect = appliedUiSchemaOptions.closeOnSelect ?? true;

const firstFormHelperText = showDescription
? description
Expand Down Expand Up @@ -124,27 +127,30 @@ export const MaterialDateTimeControl = (props: ControlProps) => {
label={label}
value={value}
onAccept={onChange}
onChange={onChange}
format={format}
ampm={!!appliedUiSchemaOptions.ampm}
views={views}
closeOnSelect={closeOnSelect}
disabled={!enabled}
slotProps={{
actionBar: ({ wrapperVariant }) => ({
actionBar: ({ pickerVariant }) => ({
actions:
wrapperVariant === 'desktop' ? [] : ['clear', 'cancel', 'accept'],
pickerVariant === 'desktop' ? [] : ['clear', 'cancel', 'accept'],
}),
textField: {
id: id + '-input',
required: required && !appliedUiSchemaOptions.hideRequiredAsterisk,
autoFocus: appliedUiSchemaOptions.focus,
error: !isValid,
fullWidth: !appliedUiSchemaOptions.trim,
variant: inputVariant,
inputProps: {
autoFocus: appliedUiSchemaOptions.focus,
type: 'text',
onFocus: onFocus,
onBlur: onBlurHandler,
},
InputLabelProps: data ? { shrink: true } : undefined,
onFocus: onFocus,
onBlur: onBlurHandler,
},
}}
/>
Expand Down
16 changes: 11 additions & 5 deletions packages/material-renderers/src/controls/MaterialTimeControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ import {
createOnChangeHandler,
getData,
useFocus,
useInputVariant,
} from '../util';

export const MaterialTimeControl = (props: ControlProps) => {
const [focused, onFocus, onBlur] = useFocus();
const inputVariant = useInputVariant();
const {
id,
description,
Expand Down Expand Up @@ -76,6 +78,7 @@ export const MaterialTimeControl = (props: ControlProps) => {
const saveFormat = appliedUiSchemaOptions.timeSaveFormat ?? defaultTimeFormat;

const views = appliedUiSchemaOptions.views ?? ['hours', 'minutes'];
const closeOnSelect = appliedUiSchemaOptions.closeOnSelect ?? true;

const firstFormHelperText = showDescription
? description
Expand Down Expand Up @@ -118,27 +121,30 @@ export const MaterialTimeControl = (props: ControlProps) => {
label={label}
value={value}
onAccept={onChange}
onChange={onChange}
format={format}
ampm={!!appliedUiSchemaOptions.ampm}
views={views}
closeOnSelect={closeOnSelect}
disabled={!enabled}
slotProps={{
actionBar: ({ wrapperVariant }) => ({
actionBar: ({ pickerVariant }) => ({
actions:
wrapperVariant === 'desktop' ? [] : ['clear', 'cancel', 'accept'],
pickerVariant === 'desktop' ? [] : ['clear', 'cancel', 'accept'],
}),
textField: {
id: id + '-input',
required: required && !appliedUiSchemaOptions.hideRequiredAsterisk,
autoFocus: appliedUiSchemaOptions.focus,
error: !isValid,
fullWidth: !appliedUiSchemaOptions.trim,
variant: inputVariant,
inputProps: {
autoFocus: appliedUiSchemaOptions.focus,
type: 'text',
onBlur: onBlurHandler,
onFocus: onFocus,
},
InputLabelProps: data ? { shrink: true } : undefined,
onFocus: onFocus,
onBlur: onBlurHandler,
},
}}
/>
Expand Down
84 changes: 71 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading