feat: quick add support sort (#1175)

Co-authored-by: sealday <sealday@gmail.com>
Reviewed-on: daoyoucloud/tachybase#1175
This commit is contained in:
sealday 2024-06-13 05:21:03 +08:00
parent 45edb084b7
commit 7118423925

View File

@ -207,24 +207,28 @@ export const InternalTabs = observer((props) => {
{options.length ? ( {options.length ? (
<Tabs <Tabs
tabPosition="left" tabPosition="left"
items={options.map((item) => ({ items={options
...item, .sort((a, b) => (a.sort != null ? a.sort - b.sort : a.id - b.id))
children: ( .map((item) => ({
<Space style={{ maxHeight: '30vh', overflow: 'auto', padding: '10px 0px 20px 0px' }}> ...item,
{item?.childrenItems?.map((childrenitem, index) => ( children: (
<Button <Space style={{ maxHeight: '30vh', overflow: 'auto', padding: '10px 0px 20px 0px' }}>
key={index} {item?.childrenItems
onClick={() => { ?.sort((a, b) => (a.sort != null ? a.sort - b.sort : a.id - b.id))
onChange(childrenitem); .map((childrenitem, index) => (
}} <Button
icon={childrenitem.checked ? <CheckOutlined /> : null} key={index}
> onClick={() => {
{childrenitem.label} onChange(childrenitem);
</Button> }}
))} icon={childrenitem.checked ? <CheckOutlined /> : null}
</Space> >
), {childrenitem.label}
}))} </Button>
))}
</Space>
),
}))}
style={{ maxHeight: '30vh', padding: '10px' }} style={{ maxHeight: '30vh', padding: '10px' }}
defaultActiveKey="all" defaultActiveKey="all"
></Tabs> ></Tabs>