UNPKG

fastapi-rtk

Version:

A React component library for FastAPI in combination with FastAPI React Toolkit backend, built with Mantine, JsonForms, and Zustand.

170 lines (169 loc) 7.43 kB
/** * @typedef {Object} CommonModalTitleOptionsProps * @property {React.ReactNode | ((props: { view: string; setView: (view: string) => void }) => React.ReactNode)} left - Content or function to render on the left side of the title. * @property {React.ReactNode | ((props: { view: string; setView: (view: string) => void }) => React.ReactNode)} right - Content or function to render on the right side of the title. * @property {boolean} [hideOverlay=false] - If true, hides the overlay toggle button. * @property {boolean} [hideFullScreen=false] - If true, hides the full screen toggle button. * @property {Record<string, any> | ((props: { view: string; setView: (view: string) => void }) => Record<string, any>)} [overlayButtonProps] - Additional props to be passed to the overlay toggle button. * @property {Record<string, any> | ((props: { view: string; setView: (view: string) => void }) => Record<string, any>)} [fullScreenButtonProps] - Additional props to be passed to the full screen toggle button. */ /** * @typedef {Object} CommonModalActionButtonsProps * @property {Record<string, any>} [groupProps] - Additional properties to be passed to the Group component wrapping the buttons. * @property {boolean} [withResetButton=true] - Flag to determine if the reset button should be displayed. * @property {boolean} [withSubmitButton=true] - Flag to determine if the submit button should be displayed. * @property {Record<string, any>} [resetButtonProps] - Additional properties to be passed to the reset Button component. * @property {Record<string, any>} [submitButtonProps] - Additional properties to be passed to the submit Button component. */ /** * @typedef {Object} CommonModalProps * @property {React.ReactNode} children - The content to be rendered inside the modal. * @property {string} view - Current view mode (e.g., VIEW_MODE.NORMAL, VIEW_MODE.FULL_SCREEN, VIEW_MODE.OVERLAY). * @property {Function} setView - Function to update the view mode. * @property {Function} onReset - Callback function triggered on form reset. * @property {Function} onSubmit - Callback function triggered on form submission. * @property {Record<string, any>} boxProps - Additional properties to be passed to the Box component wrapping the form. * @property {string} resetButtonText - Text displayed on the reset button. * @property {string} buttonText - Text displayed on the submit button. * @property {boolean} buttonLoading - Indicates whether the submit button should display a loading state. * @property {boolean} [withTitleOptions=true] - Flag to determine if title options (e.g., full screen, overlay toggles) should be displayed. * @property {boolean} [withButtons=true] - Flag to determine if action buttons (e.g., submit button) should be displayed. * @property {CommonModalTitleOptionsProps} [titleOptions] - Options for customizing the title area, such as toggles for full screen and overlay modes. * @property {CommonModalActionButtonsProps} [actionButtons] - Options for customizing the action buttons area. * @property {Record<string, any>} rest - Additional props to be passed to the Modal component. */ /** * ViewDialog is a component that renders a modal dialog for viewing an existing entry. * * It integrates with the application's API to fetch entry details and manages form state, * view modes, and loading state via custom hooks. The component also manages the merge * of default JSON Forms settings with any additional props provided. * * @param {CommonModalProps} props - The properties for the ViewDialog component. * @returns {JSX.Element} The rendered modal dialog component for viewing an entry. */ export function ViewDialog({ ...props }: CommonModalProps): JSX.Element; export function TabsDisplay({ columns, data, label_columns, gridProps }: { columns: any; data: any; label_columns: any; gridProps: any; }): import("react").JSX.Element; export type CommonModalTitleOptionsProps = { /** * - Content or function to render on the left side of the title. */ left: React.ReactNode | ((props: { view: string; setView: (view: string) => void; }) => React.ReactNode); /** * - Content or function to render on the right side of the title. */ right: React.ReactNode | ((props: { view: string; setView: (view: string) => void; }) => React.ReactNode); /** * - If true, hides the overlay toggle button. */ hideOverlay?: boolean; /** * - If true, hides the full screen toggle button. */ hideFullScreen?: boolean; /** * - Additional props to be passed to the overlay toggle button. */ overlayButtonProps?: Record<string, any> | ((props: { view: string; setView: (view: string) => void; }) => Record<string, any>); /** * - Additional props to be passed to the full screen toggle button. */ fullScreenButtonProps?: Record<string, any> | ((props: { view: string; setView: (view: string) => void; }) => Record<string, any>); }; export type CommonModalActionButtonsProps = { /** * - Additional properties to be passed to the Group component wrapping the buttons. */ groupProps?: Record<string, any>; /** * - Flag to determine if the reset button should be displayed. */ withResetButton?: boolean; /** * - Flag to determine if the submit button should be displayed. */ withSubmitButton?: boolean; /** * - Additional properties to be passed to the reset Button component. */ resetButtonProps?: Record<string, any>; /** * - Additional properties to be passed to the submit Button component. */ submitButtonProps?: Record<string, any>; }; export type CommonModalProps = { /** * - The content to be rendered inside the modal. */ children: React.ReactNode; /** * - Current view mode (e.g., VIEW_MODE.NORMAL, VIEW_MODE.FULL_SCREEN, VIEW_MODE.OVERLAY). */ view: string; /** * - Function to update the view mode. */ setView: Function; /** * - Callback function triggered on form reset. */ onReset: Function; /** * - Callback function triggered on form submission. */ onSubmit: Function; /** * - Additional properties to be passed to the Box component wrapping the form. */ boxProps: Record<string, any>; /** * - Text displayed on the reset button. */ resetButtonText: string; /** * - Text displayed on the submit button. */ buttonText: string; /** * - Indicates whether the submit button should display a loading state. */ buttonLoading: boolean; /** * - Flag to determine if title options (e.g., full screen, overlay toggles) should be displayed. */ withTitleOptions?: boolean; /** * - Flag to determine if action buttons (e.g., submit button) should be displayed. */ withButtons?: boolean; /** * - Options for customizing the title area, such as toggles for full screen and overlay modes. */ titleOptions?: CommonModalTitleOptionsProps; /** * - Options for customizing the action buttons area. */ actionButtons?: CommonModalActionButtonsProps; /** * - Additional props to be passed to the Modal component. */ rest: Record<string, any>; };