Dashboard Plugin
Extend a new Load Node
import { getColsFromFields, GetStorageFormFieldsType } from '@/utils/metaData';
import { ColumnsType } from 'antd/es/table';
import { excludeObject } from '@/utils';
const getForm: GetStorageFormFieldsType = (
type: 'form' | 'col' = 'form',
{ currentValues, isEdit } = {} as any,
) => {
// -- Focus Start --
const fileds = [
{
name: 'name',
type: 'input',
label: 'Name',
_inTable: true,
},
type: 'radio',
label: 'Sex',
initialValue: 'female',
props: {
options: [
{
label: 'female',
value: 'female',
},
{
label: 'male',
value: 'male',
},
],
disabled: isEdit && [110, 130].includes(currentValues?.status),
},
_inTable: true,
},
{
label: 'Age',
props: {
min: 1,
max: 200,
},
},
// -- Focus End --
];
// The following is a generic return
return type === 'col'
? getColsFromFields(fileds)
: fileds.map(item => excludeObject(['_inTable'], item));
};
// The following is a generic export
const tableColumns = getForm('col') as ColumnsType;
export const StorageExample = {
getForm,
};