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