Types
AdminNavigationTypes
Example:
src/types.ts
export type AdminNavigationTypes = (
| AdminNavGroupType
| AdminNavSubGroupType
| AdminNavLinkType
| AdminNavSectionTitleType
| AdminDividerType
| AdminResourceType
)[];
Data Types:
- AdminNavGroupType
- AdminNavSubGroupType
- AdminNavLinkType
- AdminNavSectionTitleType
- AdminDividerType
- AdminResourceType
AdminNavGroupType
Example:
src/types.ts
export type AdminNavGroupType = {
id_NavGroup?: number;
type?: string;
NavGroupTitle: LocalizedString;
icon?: string | string[] | ReactNode | SvgIconComponent;
childrenGroup?: AdminNavSubGroupTypes;
children?: AdminNavLinkTypes;
};
Data Types:
- AdminNavSubGroupTypes
- AdminNavLinkTypes
- LocalizedString
- SvgIconComponent
@mui/icons-material
- ReactNode
react
AdminNavSubGroupType
Example:
src/types.ts
export type AdminNavSubGroupType = {
id_navSubGroup?: number;
navSubGroupTitle: LocalizedString;
icon?: string | string[] | ReactNode | SvgIconComponent;
children?: AdminNavLinkType[];
};
export type AdminNavSubGroupTypes = AdminNavSubGroupType[];
Data Types:
- LocalizedString
- AdminNavLinkType
- SvgIconComponent
@mui/icons-material
- ReactNode
react
AdminNavLinkType
Example:
src/types.ts
export type AdminNavLinkType = {
id_navLink?: number;
type?: string;
path?: string;
navLinkTitle: LocalizedString;
icon?: string | string[] | ReactNode | SvgIconComponent;
resource?: AdminResourceType;
};
export type AdminNavLinkTypes = AdminNavLinkType[];
Data Types:
- LocalizedString
- AdminResourceType
- SvgIconComponent
@mui/icons-material
- ReactNode
react
AdminNavSectionTitleType
Example:
src/types.ts
export type AdminNavSectionTitleType = {
sectionTitle: LocalizedString;
};
Data Types:
AdminDividerType
Example:
src/types.ts
export type AdminDividerType = {
divider: boolean;
};
AdminResourceType
Example:
src/types.ts
export type AdminResourceType = {
multiple: boolean;
primaryColumnName: string;
localeColumnName: string;
listColumns: AdminListColumnsType[];
listData: (locale: string) => Promise<Object[]>;
formData: (primaryColumnValue: string) => Promise<Object[]>;
insertData: (dataObject: FormData) => Promise<string>;
insertLocaleData: (dataObject: FormData) => Promise<boolean>;
deleteData: (primaryColumnValue: string) => Promise<boolean>;
deleteFile: (primaryColumnValue: string, fieldName: string, filePath: string) => Promise<boolean>;
};
export type AdminResourceTypes = AdminResourceType[];
Properties:
- mutiple - If it is "false", it is possible to enter only one row in the table. Useful for settings-related data.
- primaryColumnName: The primary unique column used in the table to identify the data (id or id_column... )
- localeColumnName: A column that contains the id or name of the language whose data we want to get.
Data Types:
AdminListColumnsType
Example:
src/types.ts
export type AdminListColumnsType = {
id: string;
label: LocalizedString;
minWidth?: number;
maxWidth?: number;
align?: 'center' | 'left' | 'right' | 'inherit' | 'justify' | undefined;
type?: string;
text?: string;
color?: string;
backgroundColor?: string;
display_in_list?: 0 | 1; // Default 0
display_in_form?: 0 | 1; // Default 1
inputParams?: AdminDataInputParams;
};
Data Types:
AdminDataInputParams
Example:
src/types.ts
export type AdminDataInputParams = {
type:
| 'text'
| 'textarea'
| 'html'
| 'integer'
| 'decimal'
| 'switch'
| 'select'
| 'color'
| 'image'
| 'checkbox'
| 'password'
| 'url';
length?: number;
default?: string | number;
required?: 0 | 1;
translatable?: true | false;
selectOptions?: SelectOption[] | ((locale?: string) => Promise<SelectOption[]>);
imageType?: string;
rows?: number; // For textarea
help?: LocalizedString; // Help text
};
Data Types:
LocalizedString
Example:
src/types.ts
interface LocalizedString {
[key: string]: string;
}
SelectOption
Example:
src/types.ts
export type SelectOption = {
value: number;
name: string;
};
AdminFullLocales
Example:
src/types.ts
export type AdminFullLocales = {
name: string;
value: string;
};
UserType
Example:
src/types.ts
export type UserType = {
id_profile?: string;
firstname?: string;
lastname?: string;
email?: string;
};
AdminTitle
Example:
src/types.ts
export type AdminTitle = {
[key: string]: string;
};