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 form = useForm();
const ctx = useActionContext(); const ctx = useActionContext();
return { return {
async run() { async run() {
form.reset();
run();
ctx.setVisible(false); ctx.setVisible(false);
}, },
}; };

View File

@ -21,58 +21,64 @@ export const ActionModal: ComposedActionDrawer = observer((props) => {
return ( return (
<> <>
{createPortal( {createPortal(
<Modal <div
width={'80%'} onClick={(e) => {
title={field.title} e.stopPropagation();
{...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 <Modal
basePath={field.address} width={'80%'}
schema={schema} title={field.title}
onlyRenderProperties {...others}
filterProperties={(s) => { destroyOnClose
return s['x-component'] !== footerNodeName; visible={visible}
}} onCancel={() => setVisible(false)}
/> className={classNames(
</Modal>, 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, document.body,
)} )}
</> </>

View File

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

View File

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

View File

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

View File

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