fix some bugs (#252)

* fix: fix kanban could not show columns

* fix: modify drag area height

* fix: fix click Modal will open Drawer

* fix: change the Cancel button to the Reset
This commit is contained in:
SemmyWong 2022-03-28 09:18:07 +08:00 committed by GitHub
parent c5e18903d2
commit 3633a518ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 69 additions and 62 deletions

View File

@ -18,11 +18,15 @@ export const useCancelAction = () => {
};
};
export const useCancelFilterAction = () => {
export const useResetFilterAction = () => {
const { run } = useResourceActionContext();
const form = useForm();
const ctx = useActionContext();
return {
async run() {
form.reset();
run();
ctx.setVisible(false);
},
};

View File

@ -21,58 +21,64 @@ export const ActionModal: ComposedActionDrawer = observer((props) => {
return (
<>
{createPortal(
<Modal
width={'80%'}
title={field.title}
{...others}
destroyOnClose
visible={visible}
onCancel={() => setVisible(false)}
className={classNames(
others.className,
css`
&.nb-action-popup {
.ant-modal-body {
background: #f0f2f5;
}
}
`,
)}
footer={
footerSchema ? (
<div
className={css`
display: flex;
justify-content: flex-end;
width: 100%;
.ant-btn {
margin-right: 8px;
}
`}
>
<RecursionField
basePath={field.address}
schema={schema}
onlyRenderProperties
filterProperties={(s) => {
return s['x-component'] === footerNodeName;
}}
/>
</div>
) : (
false
)
}
<div
onClick={(e) => {
e.stopPropagation();
}}
>
<RecursionField
basePath={field.address}
schema={schema}
onlyRenderProperties
filterProperties={(s) => {
return s['x-component'] !== footerNodeName;
}}
/>
</Modal>,
<Modal
width={'80%'}
title={field.title}
{...others}
destroyOnClose
visible={visible}
onCancel={() => setVisible(false)}
className={classNames(
others.className,
css`
&.nb-action-popup {
.ant-modal-body {
background: #f0f2f5;
}
}
`,
)}
footer={
footerSchema ? (
<div
className={css`
display: flex;
justify-content: flex-end;
width: 100%;
.ant-btn {
margin-right: 8px;
}
`}
>
<RecursionField
basePath={field.address}
schema={schema}
onlyRenderProperties
filterProperties={(s) => {
return s['x-component'] === footerNodeName;
}}
/>
</div>
) : (
false
)
}
>
<RecursionField
basePath={field.address}
schema={schema}
onlyRenderProperties
filterProperties={(s) => {
return s['x-component'] !== footerNodeName;
}}
/>
</Modal>
</div>,
document.body,
)}
</>

View File

@ -56,7 +56,7 @@ const RowDivider = (props) => {
ref={setNodeRef}
style={{
zIndex: active ? 1000 : 0,
height: 24,
height: 2,
width: '100%',
position: 'absolute',
marginTop: -24,

View File

@ -1,7 +1,4 @@
export const toGroupDataSource = (groupField: IGroupField, dataSource: Array<any> = []) => {
if (dataSource.length === 0) {
return { columns: [] };
}
const groupDataSource = {
__unknown__: {
id: '__unknown__',

View File

@ -44,12 +44,12 @@ const schema = {
'x-component': 'Filter.SaveDefaultValue',
'x-component-props': {},
},
cancel: {
reset: {
type: 'void',
title: '{{t("Cancel")}}',
title: '{{t("Reset")}}',
'x-component': 'Action',
'x-component-props': {
useAction: '{{cm.useCancelFilterAction}}',
useAction: '{{cm.useResetFilterAction}}',
},
},
submit: {

View File

@ -88,13 +88,13 @@ export default {
'x-async': false,
'x-index': 1,
},
cancel: {
reset: {
_isJSONSchemaObject: true,
version: '2.0',
type: 'void',
title: '{{t("Cancel")}}',
title: '{{t("Reset")}}',
'x-component': 'Action',
'x-component-props': { useAction: '{{cm.useCancelFilterAction}}' },
'x-component-props': { useAction: '{{cm.useResetFilterAction}}' },
'x-uid': '40ifgzo3pks',
'x-async': false,
'x-index': 2,