Dashboard Plugin

    Extend a new Load Node

    1. import { getColsFromFields, GetStorageFormFieldsType } from '@/utils/metaData';
    2. import { ColumnsType } from 'antd/es/table';
    3. import { excludeObject } from '@/utils';
    4. const getForm: GetStorageFormFieldsType = (
    5. type: 'form' | 'col' = 'form',
    6. { currentValues, isEdit } = {} as any,
    7. ) => {
    8. // -- Focus Start --
    9. const fileds = [
    10. {
    11. name: 'name',
    12. type: 'input',
    13. label: 'Name',
    14. _inTable: true,
    15. },
    16. type: 'radio',
    17. label: 'Sex',
    18. initialValue: 'female',
    19. props: {
    20. options: [
    21. {
    22. label: 'female',
    23. value: 'female',
    24. },
    25. {
    26. label: 'male',
    27. value: 'male',
    28. },
    29. ],
    30. disabled: isEdit && [110, 130].includes(currentValues?.status),
    31. },
    32. _inTable: true,
    33. },
    34. {
    35. label: 'Age',
    36. props: {
    37. min: 1,
    38. max: 200,
    39. },
    40. },
    41. // -- Focus End --
    42. ];
    43. // The following is a generic return
    44. return type === 'col'
    45. ? getColsFromFields(fileds)
    46. : fileds.map(item => excludeObject(['_inTable'], item));
    47. };
    48. // The following is a generic export
    49. const tableColumns = getForm('col') as ColumnsType;
    50. export const StorageExample = {
    51. getForm,
    52. };