improve styling

This commit is contained in:
chenos 2021-08-23 12:15:22 +08:00
parent 6f84f925aa
commit 52818bfeb4
2 changed files with 35 additions and 30 deletions

View File

@ -115,33 +115,35 @@ const KanbanColumn = (props) => {
const { field, schemas } = useKanban(); const { field, schemas } = useKanban();
const { items } = props; const { items } = props;
return ( return (
<SortableContext <div className={'nb-kanban-list'}>
// id={option.value} <SortableContext
items={items || []} // id={option.value}
strategy={verticalListSortingStrategy} items={items || []}
> strategy={verticalListSortingStrategy}
{items?.map((item) => { >
const index = field.value?.findIndex((val) => val.id === item.id); {items?.map((item) => {
return ( const index = field.value?.findIndex((val) => val.id === item.id);
<SortableItem return (
className={'nb-kanban-item'} <SortableItem
key={item.id} className={'nb-kanban-item'}
id={item.id} key={item.id}
data={{ type: 'card', columnId: option.value }} id={item.id}
> data={{ type: 'card', columnId: option.value }}
<KanbanCardContext.Provider
value={{ index, schemas, record: item }}
> >
{/* <Card bordered={false}>{item.id}</Card> */} <KanbanCardContext.Provider
<RecursionField value={{ index, schemas, record: item }}
name={index} >
schema={schemas.get('Kanban.Card')} {/* <Card bordered={false}>{item.id}</Card> */}
/> <RecursionField
</KanbanCardContext.Provider> name={index}
</SortableItem> schema={schemas.get('Kanban.Card')}
); />
})} </KanbanCardContext.Provider>
</SortableContext> </SortableItem>
);
})}
</SortableContext>
</div>
); );
}; };
@ -414,7 +416,7 @@ Kanban.useCreateAction = () => {
const column = useContext(KanbanColumnContext); const column = useContext(KanbanColumnContext);
const groupField = props.groupField; const groupField = props.groupField;
const form = useForm(); const form = useForm();
const [,setVisible] = useContext(VisibleContext); const [, setVisible] = useContext(VisibleContext);
return { return {
async run() { async run() {
await resource.create({ await resource.create({
@ -432,7 +434,7 @@ Kanban.useUpdateAction = () => {
const { service, resource, props } = useKanban(); const { service, resource, props } = useKanban();
const ctx = useContext(KanbanCardContext); const ctx = useContext(KanbanCardContext);
const form = useForm(); const form = useForm();
const [,setVisible] = useContext(VisibleContext); const [, setVisible] = useContext(VisibleContext);
return { return {
async run() { async run() {
await resource.save(omit(form.values, ['sort']), { await resource.save(omit(form.values, ['sort']), {

View File

@ -14,8 +14,11 @@
background: #f9f9f9; background: #f9f9f9;
margin-right: 12px; margin-right: 12px;
padding: 12px; padding: 12px;
height: 60vh; .nb-kanban-list {
overflow: auto; height: 60vh;
overflow: auto;
margin-bottom: 12px;
}
} }
.nb-kanban-item { .nb-kanban-item {