fix: cleanup

This commit is contained in:
chenos 2022-03-22 14:56:43 +08:00
parent f7ce3f64cf
commit 8af19d2489
15 changed files with 15 additions and 25 deletions

View File

@ -28,7 +28,6 @@ export const ScopeSelect = (props) => {
}),
[],
);
console.log('props.value', props.value, form.values);
return (
<FormProvider form={form}>
<SchemaComponent
@ -36,7 +35,6 @@ export const ScopeSelect = (props) => {
scope={{
onChange(value) {
props?.onChange?.(value);
console.log('onChange', value);
},
}}
schema={scopesSchema}

View File

@ -136,7 +136,6 @@ export const scopesSchema: ISchema = {
// },
useDataSource(options) {
const record = useRecord();
console.log('useRecord', record);
return useRequest(
{
resource: 'rolesResourcesScopes',

View File

@ -25,7 +25,6 @@ const getSchema = (schema: IField): ISchema => {
name: `f_${uid()}`,
};
initialValue.uiSchema.title = schema.title;
console.log('initialValue', initialValue);
return {
type: 'object',
properties: {

View File

@ -102,7 +102,6 @@ export const Calendar: any = observer((props: any) => {
refreshDeps: [props.dataSource],
onSuccess(data) {
const events = toEvents(data?.data, fieldNames);
console.log('events', events, data);
setDataSource(events);
},
},
@ -114,7 +113,6 @@ export const Calendar: any = observer((props: any) => {
}
return buf;
}, null);
console.log('field', field);
return (
<AsyncDataProvider value={result}>
<CalendarContext.Provider value={{ field, props, record }}>

View File

@ -1,4 +1,4 @@
import { CheckOutlined, CloseOutlined } from '@ant-design/icons';
import { CheckOutlined } from '@ant-design/icons';
import { connect, mapProps, mapReadPretty, useField } from '@formily/react';
import { isValid } from '@formily/shared';
import { Checkbox as AntdCheckbox, Tag } from 'antd';
@ -29,11 +29,7 @@ export const Checkbox: ComposedCheckbox = connect(
if (!isValid(props.value)) {
return <div></div>;
}
return props.value ? (
<CheckOutlined style={{ color: '#52c41a' }} />
) : (
<CloseOutlined style={{ color: '#f5222d' }} />
);
return props.value ? <CheckOutlined style={{ color: '#52c41a' }} /> : null;
}),
);

View File

@ -30,7 +30,6 @@ Radio.Group = connect(
const { options = [], value } = props;
const field = useField<any>();
const dataSource = field.dataSource || [];
console.log({ dataSource });
return (
<div>
{dataSource

View File

@ -40,7 +40,6 @@ const useTableColumns = () => {
},
} as TableColumnProps<any>;
});
console.log(columns);
if (!exists) {
return columns;
}

View File

@ -18,7 +18,6 @@ type TableVoidProps = TableProps<any> & {
};
const usePaginationProps = (props: TableProps<any> & { request?: any }, service): TablePaginationConfig | false => {
console.log('f.componentProps.pagination', props);
if (props.pagination === false) {
return false;
}
@ -97,7 +96,6 @@ export const TableVoid: React.FC<TableVoidProps> = observer((props) => {
}
field.componentProps.pagination.current = data?.meta?.page || 1;
field.componentProps.pagination.pageSize = data?.meta?.pageSize || 10;
console.log('f.componentProps.pagination', field.componentProps.pagination);
},
},
props,

View File

@ -80,7 +80,6 @@ const designerCss = css`
Tabs.TabPane = observer((props: TabPaneProps) => {
const Designer = useDesigner();
const field = useField();
console.log('Designer', Designer);
return (
<SortableItem className={classNames('nb-action-link', designerCss, props.className)}>
{props.tab || field.title}

View File

@ -22,7 +22,6 @@ ReadPretty.Attachment = (props: UploadProps) => {
const [photoIndex, setPhotoIndex] = useState(0);
const [visible, setVisible] = useState(false);
const { size } = props;
console.log('field.value', field.value, images);
return (
<div>
<div className={cls('ant-upload-picture-card-wrapper nb-upload', size ? `nb-upload-${size}` : null)}>

View File

@ -38,6 +38,7 @@ Upload.Attachment = connect((props: UploadProps) => {
setFileList(toFileList(value));
}
}, [value, sync]);
const uploadProps = useUploadProps({ ...props });
return (
<div>
<div className={cls('ant-upload-picture-card-wrapper nb-upload')}>
@ -126,7 +127,7 @@ Upload.Attachment = connect((props: UploadProps) => {
{!disabled && (multiple || toArr(value).length < 1) && (
<div className={'ant-upload-list-picture-card-container'}>
<AntdUpload
{...useUploadProps({ ...props })}
{...uploadProps}
disabled={disabled}
multiple={multiple}
listType={'picture-card'}
@ -140,7 +141,6 @@ Upload.Attachment = connect((props: UploadProps) => {
setFileList(info.fileList.map(toItem));
} else {
if (info.file.status === 'done') {
console.log('field.value', info.file?.response?.data);
// TODO(BUG): object 的联动有问题,不响应,折中的办法先置空再赋值
onChange(null);
onChange(info.file?.response?.data);

View File

@ -2,10 +2,10 @@ import { Field } from '@formily/core';
import { useField } from '@formily/react';
import { reaction } from '@formily/reactive';
import { isArr, isValid, toArr as toArray } from '@formily/shared';
import { useAPIClient } from '../../../api-client';
import { UploadChangeParam } from 'antd/lib/upload';
import { UploadFile } from 'antd/lib/upload/interface';
import { useEffect } from 'react';
import { useAPIClient } from '../../../api-client';
import { UPLOAD_PLACEHOLDER } from './placeholder';
import type { IUploadProps, UploadProps } from './type';
@ -28,7 +28,6 @@ export const toMap = (fileList: any) => {
}
list = [fileList];
}
console.log({ list, fileList });
return list.map((item) => {
return [item.id || item.uid, toItem(item)];
});

View File

@ -9,7 +9,6 @@ import { ActionContext, SchemaComponent, useActionContext } from '../schema-comp
const useCloseAction = () => {
const { setVisible } = useActionContext();
// const form = useForm();
return {
async run() {
setVisible(false);
@ -18,23 +17,28 @@ const useCloseAction = () => {
};
const useSystemSettingsValues = (options) => {
const { visible } = useActionContext();
const result = useSystemSettings();
return useRequest(() => Promise.resolve(result.data), {
...options,
refreshDeps: [visible],
});
};
const useSaveSystemSettingsValues = () => {
const { setVisible } = useActionContext();
const form = useForm();
const { mutate } = useSystemSettings();
const { mutate, data } = useSystemSettings();
const api = useAPIClient();
return {
async run() {
await form.submit();
setVisible(false);
mutate({
data: form.values,
data: {
...data?.data,
...form.values,
},
});
await api.request({
url: 'systemSettings:update/1',
@ -108,6 +112,7 @@ const schema: ISchema = {
'x-component': 'Action',
'x-component-props': {
type: 'primary',
htmlType: 'submit',
useAction: '{{ useSaveSystemSettingsValues }}',
},
},

View File

@ -33,6 +33,7 @@ const schema: ISchema = {
type: 'void',
'x-component': 'Action',
'x-component-props': {
htmlType: 'submit',
block: true,
type: 'primary',
useAction: '{{ useSignin }}',

View File

@ -63,6 +63,7 @@ const schema: ISchema = {
'x-component-props': {
block: true,
type: 'primary',
htmlType: 'submit',
useAction: '{{ useSignup }}',
style: { width: '100%' },
},