fix(client): comment out useless code

This commit is contained in:
SemmyWong 2022-07-01 22:00:00 +08:00 committed by GitHub
parent 5603faacf3
commit 4e9384bce2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,44 +1,48 @@
import { Field } from '@formily/core';
import { useField, useFieldSchema } from '@formily/react';
import React, { useEffect, useState } from 'react';
// import { Select, Space } from 'antd';
import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { CollectionField, useCollection } from '../../../collection-manager';
import { useCompile, useFilterOptions } from '../../../schema-component';
import { CollectionField } from '../../../collection-manager';
import { useCompile } from '../../../schema-component';
export const AssignedField = (props: any) => {
const { t } = useTranslation();
const compile = useCompile();
const field = useField<Field>();
const fieldSchema = useFieldSchema();
const [type, setType] = useState<string>('constantValue');
// const [type, setType] = useState<string>('constantValue');
const [value, setValue] = useState(field?.value?.value ?? '');
const [options, setOptions] = useState<any[]>([]);
const { getField } = useCollection();
const collectionField = getField(fieldSchema.name);
const { uiSchema } = collectionField;
const currentUser = useFilterOptions('users');
const currentRecord = useFilterOptions(collectionField.collectionName);
useEffect(() => {
const opt = [
{
name: 'currentUser',
title: t('Current user'),
children: [...currentUser],
},
{
name: 'currentRecord',
title: t('Current record'),
children: [...currentRecord],
},
];
setOptions(compile(opt));
}, []);
// const [options, setOptions] = useState<any[]>([]);
// const { getField } = useCollection();
// const collectionField = getField(fieldSchema.name);
// const { uiSchema } = collectionField;
// const currentUser = useFilterOptions('users');
// const currentRecord = useFilterOptions(collectionField.collectionName);
// useEffect(() => {
// const opt = [
// {
// name: 'currentUser',
// title: t('Current user'),
// children: [...currentUser],
// },
// {
// name: 'currentRecord',
// title: t('Current record'),
// children: [...currentRecord],
// },
// ];
// setOptions(compile(opt));
// }, []);
const valueChangeHandler = (val) => {
setValue(val);
};
// const typeChangeHandler = (val) => {
// setType(val);
// };
return <CollectionField {...props} value={field.value} onChange={valueChangeHandler} />;
// return (