@craftercms/studio-ui
Version:
Services, components, models & utils to build CrafterCMS authoring extensions.
99 lines (97 loc) • 3.68 kB
JavaScript
/*
* Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3 as published by
* the Free Software Foundation.
*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as published by
* the Free Software Foundation.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import List from '@mui/material/List';
import ListSubheader from '@mui/material/ListSubheader';
import { FormattedMessage } from 'react-intl';
import ListItem from '@mui/material/ListItem';
import ListItemIcon from '@mui/material/ListItemIcon';
import Checkbox from '@mui/material/Checkbox';
import ListItemText from '@mui/material/ListItemText';
import Typography from '@mui/material/Typography';
import React from 'react';
export function RejectDialogContentUI(props) {
const { items: rejectItems, checkedItems, onUpdateChecked, classes } = props;
return React.createElement(
List,
{
subheader: React.createElement(
ListSubheader,
{ component: 'div', className: classes.listSubHeader },
React.createElement(
'label',
{ className: classes.subHeaderItem },
React.createElement(FormattedMessage, { id: 'words.item', defaultMessage: 'Item' })
),
React.createElement(
'label',
null,
React.createElement(FormattedMessage, { id: 'rejectDialog.submittedBy', defaultMessage: 'Submitted By' })
)
),
className: classes.itemsList
},
rejectItems.map((item) => {
const labelId = `checkbox-list-label-${item.path}`;
return React.createElement(
ListItem,
{ key: item.path, onClick: () => onUpdateChecked(item.path), button: true },
React.createElement(
ListItemIcon,
null,
React.createElement(Checkbox, {
edge: 'start',
checked: checkedItems.includes(item.path),
tabIndex: -1,
disableRipple: true,
inputProps: { 'aria-labelledby': labelId },
color: 'primary'
})
),
React.createElement(ListItemText, {
primary: item.label,
secondary: item.path,
id: labelId,
primaryTypographyProps: {
classes: { root: classes.ellipsis }
},
secondaryTypographyProps: {
classes: { root: classes.ellipsis }
}
}),
React.createElement(
ListItemText,
{ disableTypography: true, className: classes.submittedBy },
React.createElement(Typography, null, item.modifier?.username)
)
);
})
);
}