import { CardProps, CheckboxProps, InputNumberProps, InputProps } from 'antd'; import { PickerProps } from 'antd/lib/date-picker/generatePicker'; import { TextAreaProps } from 'antd/lib/input'; import dayjs from 'dayjs'; import React from 'react'; export interface DataManagerItemProps { colSpan?: 1 | 2 | 3 | 4; style?: React.CSSProperties; labelStyle?: React.CSSProperties; inputStyle?: React.CSSProperties; } export interface DataManagerItemCustomProps extends DataManagerItemProps { content: JSX.Element; } export interface DataManagerItemFieldProps extends DataManagerItemProps { label: string | JSX.Element; displayContent?: JSX.Element; fieldType?: 'TEXT' | 'DATE' | 'DATE_TIME' | 'INTEGER' | 'FLOAT' | 'TEXT_AREA' | 'CHECKBOX'; dateConfig?: PickerProps; textConfig?: InputProps; numberConfig?: InputNumberProps; textareaConfig?: TextAreaProps; checkboxConfig?: CheckboxProps; } export type DataManagerItemType = DataManagerItemFieldProps | DataManagerItemCustomProps; export type DataManagerProps = { /** * The title of the card to create */ title: string | JSX.Element; /** * The list of items to display in the card - typically these are fields but can also be custom content. Each item can either be an instance of:
* - `DataManagerItemFieldProps` which has the props:
* -- label `string | JSX.Element` The label for the input field
* -- fieldType? `'TEXT' | 'DATE' | 'DATE_TIME' | 'INTEGER' | 'FLOAT' | 'TEXT_AREA' | 'CHECKBOX'` The type of the input field
* -- dateConfig?: `PickerProps` The props to control the AntD DatePicker component
* -- textConfig?: `InputProps` The props to control the AntD Input component
* -- numberConfig?: `InputNumberProps` The props to control the AntD InputNumber component
* -- textareaConfig?: `TextAreaProps` The props to control the AntD TextArea component
* -- checkboxConfig?: `CheckboxProps` The props to control the AntD Checkbox component
* -- displayContent?: `JSX.Element` Use this prop to display custom content (with a label) rather than a field
* - `DataManagerItemCustomProps` which has the props:
* -- content `JSX.Element` The content to show in the row
*/ items: DataManagerItemType[]; /** * The width of the card @default '100%' */ width?: string | number; /** * The number of columns to display for each input (this can be configured at the input level too) @default 1 */ columnCount?: 1 | 2 | 3 | 4; /** * The gutter to separate columns @default `20` */ rowGutter?: number; /** * The column width of the label column based on a 24 grid system @default `8` */ labelColumnWidth?: number; /** * Any props to provide to the AntD card component @default `{}` */ cardProps?: CardProps; };