proje-react-panel 1.0.17 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/components/Counter.d.ts +9 -0
  2. package/dist/components/DetailsPage.d.ts +7 -0
  3. package/dist/components/ErrorBoundary.d.ts +16 -0
  4. package/dist/components/ErrorComponent.d.ts +4 -0
  5. package/dist/components/LoadingScreen.d.ts +2 -0
  6. package/dist/components/Login.d.ts +13 -0
  7. package/dist/components/Panel.d.ts +1 -3
  8. package/dist/components/components/Checkbox.d.ts +3 -2
  9. package/dist/components/components/FormField.d.ts +5 -1
  10. package/dist/components/components/InnerForm.d.ts +8 -3
  11. package/dist/components/components/Label.d.ts +3 -2
  12. package/dist/components/components/Uploader.d.ts +8 -0
  13. package/dist/components/components/index.d.ts +1 -1
  14. package/dist/components/components/list/ListPage.d.ts +1 -1
  15. package/dist/components/form/Checkbox.d.ts +7 -0
  16. package/dist/components/form/FormField.d.ts +17 -0
  17. package/dist/components/form/FormPage.d.ts +6 -0
  18. package/dist/components/form/InnerForm.d.ts +10 -0
  19. package/dist/components/form/Label.d.ts +9 -0
  20. package/dist/components/form/Uploader.d.ts +8 -0
  21. package/dist/components/layout/Layout.d.ts +3 -4
  22. package/dist/components/layout/SideBar.d.ts +2 -3
  23. package/dist/components/list/CellField.d.ts +9 -0
  24. package/dist/components/list/Datagrid.d.ts +6 -8
  25. package/dist/components/list/FilterPopup.d.ts +7 -5
  26. package/dist/components/list/ListHeader.d.ts +11 -0
  27. package/dist/components/list/ListPage.d.ts +6 -0
  28. package/dist/components/pages/FormPage.d.ts +8 -2
  29. package/dist/decorators/details/Details.d.ts +11 -0
  30. package/dist/decorators/details/DetailsItem.d.ts +11 -0
  31. package/dist/decorators/details/getDetailsPageMeta.d.ts +8 -0
  32. package/dist/decorators/form/Form.d.ts +21 -5
  33. package/dist/decorators/form/Input.d.ts +7 -3
  34. package/dist/decorators/form/getFormPageMeta.d.ts +10 -0
  35. package/dist/decorators/list/Cell.d.ts +13 -1
  36. package/dist/decorators/list/List.d.ts +18 -1
  37. package/dist/decorators/list/cells/ImageCell.d.ts +9 -0
  38. package/dist/decorators/list/getListPageMeta.d.ts +8 -0
  39. package/dist/index.cjs.js +1 -1
  40. package/dist/index.d.ts +12 -17
  41. package/dist/index.esm.js +1 -1
  42. package/dist/initPanel.d.ts +1 -1
  43. package/dist/store/store.d.ts +0 -3
  44. package/dist/types/AnyClass.d.ts +2 -1
  45. package/dist/types/getDetailsData.d.ts +1 -0
  46. package/dist/types/initPanelOptions.d.ts +0 -1
  47. package/package.json +1 -1
  48. package/src/assets/icons/svg/check.svg +4 -0
  49. package/src/assets/icons/svg/cross.svg +4 -0
  50. package/src/components/DetailsPage.tsx +55 -0
  51. package/src/components/{components/ErrorComponent.tsx → ErrorComponent.tsx} +1 -1
  52. package/src/components/{pages/Login.tsx → Login.tsx} +2 -2
  53. package/src/components/Panel.tsx +4 -5
  54. package/src/components/form/Checkbox.tsx +21 -0
  55. package/src/components/{components → form}/FormField.tsx +30 -22
  56. package/src/components/form/FormPage.tsx +32 -0
  57. package/src/components/form/InnerForm.tsx +85 -0
  58. package/src/components/form/Label.tsx +21 -0
  59. package/src/components/form/Uploader.tsx +66 -0
  60. package/src/components/layout/Layout.tsx +29 -32
  61. package/src/components/layout/SideBar.tsx +4 -13
  62. package/src/components/list/CellField.tsx +63 -0
  63. package/src/components/list/Datagrid.tsx +106 -0
  64. package/src/components/{components/list → list}/FilterPopup.tsx +13 -9
  65. package/src/components/list/ListHeader.tsx +47 -0
  66. package/src/components/{components/list → list}/ListPage.tsx +20 -82
  67. package/src/decorators/details/Details.ts +31 -0
  68. package/src/decorators/details/DetailsItem.ts +40 -0
  69. package/src/decorators/details/getDetailsPageMeta.ts +15 -0
  70. package/src/decorators/form/Form.ts +37 -12
  71. package/src/decorators/form/Input.ts +11 -4
  72. package/src/decorators/form/getFormPageMeta.ts +21 -0
  73. package/src/decorators/list/Cell.ts +41 -1
  74. package/src/decorators/list/List.ts +30 -6
  75. package/src/decorators/list/cells/ImageCell.ts +17 -0
  76. package/src/decorators/list/getListPageMeta.ts +16 -0
  77. package/src/index.ts +32 -24
  78. package/src/initPanel.ts +1 -4
  79. package/src/store/store.ts +0 -5
  80. package/src/styles/components/checkbox.scss +42 -0
  81. package/src/styles/components/uploader.scss +86 -0
  82. package/src/styles/details.scss +62 -0
  83. package/src/styles/form.scss +9 -11
  84. package/src/styles/index.scss +26 -12
  85. package/src/styles/list.scss +3 -1
  86. package/src/types/AnyClass.ts +2 -1
  87. package/src/types/initPanelOptions.ts +1 -3
  88. package/src/components/components/Checkbox.tsx +0 -9
  89. package/src/components/components/ImageUploader.tsx +0 -301
  90. package/src/components/components/InnerForm.tsx +0 -74
  91. package/src/components/components/Label.tsx +0 -15
  92. package/src/components/components/index.ts +0 -8
  93. package/src/components/components/list/Datagrid.tsx +0 -127
  94. package/src/components/pages/ControllerDetails.tsx +0 -37
  95. package/src/components/pages/FormPage.tsx +0 -34
  96. package/src/decorators/Crud.ts +0 -20
  97. package/src/decorators/form/FormOptions.ts +0 -8
  98. package/src/decorators/form/getFormFields.ts +0 -13
  99. package/src/decorators/list/GetCellFields.ts +0 -13
  100. package/src/decorators/list/ImageCell.ts +0 -13
  101. package/src/decorators/list/ListData.ts +0 -7
  102. package/src/decorators/list/getListFields.ts +0 -10
  103. package/src/styles/image-uploader.scss +0 -94
  104. package/src/types/Screen.ts +0 -4
  105. package/src/types/ScreenCreatorData.ts +0 -14
  106. package/src/utils/createScreens.ts +0 -5
  107. package/src/utils/getFields.ts +0 -22
  108. /package/src/components/{components/Counter.tsx → Counter.tsx} +0 -0
  109. /package/src/components/{components/ErrorBoundary.tsx → ErrorBoundary.tsx} +0 -0
  110. /package/src/components/{components/LoadingScreen.tsx → LoadingScreen.tsx} +0 -0
  111. /package/src/components/{components/list → list}/EmptyList.tsx +0 -0
  112. /package/src/components/{components/list → list}/Pagination.tsx +0 -0
  113. /package/src/components/{components/list → list}/index.ts +0 -0
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface CounterProps {
3
+ image: React.ReactNode;
4
+ text: string;
5
+ targetNumber: number;
6
+ duration?: number;
7
+ }
8
+ export declare function Counter({ image, text, targetNumber, duration }: CounterProps): React.JSX.Element;
9
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { AnyClass } from '../types/AnyClass';
3
+ interface DetailsPageProps<T extends AnyClass> {
4
+ model: new (...args: any[]) => T;
5
+ }
6
+ export declare function DetailsPage<T extends AnyClass>({ model }: DetailsPageProps<T>): React.JSX.Element;
7
+ export {};
@@ -0,0 +1,16 @@
1
+ import React, { Component, ErrorInfo, ReactNode } from "react";
2
+ interface Props {
3
+ children: ReactNode;
4
+ }
5
+ interface State {
6
+ hasError: boolean;
7
+ error: Error | null;
8
+ errorInfo: ErrorInfo | null;
9
+ }
10
+ export declare class ErrorBoundary extends Component<Props, State> {
11
+ state: State;
12
+ static getDerivedStateFromError(error: Error): State;
13
+ componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
14
+ render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
15
+ }
16
+ export {};
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ export declare function ErrorComponent({ error }: {
3
+ error: unknown | Response;
4
+ }): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare function LoadingScreen(): React.JSX.Element;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ export type OnLogin = {
3
+ login: (username: string, password: string) => Promise<LoginResponse>;
4
+ };
5
+ interface LoginResponse {
6
+ user: any;
7
+ token: string;
8
+ }
9
+ interface LoginProps {
10
+ onLogin: OnLogin;
11
+ }
12
+ export declare function Login({ onLogin }: LoginProps): React.JSX.Element;
13
+ export {};
@@ -1,8 +1,6 @@
1
1
  import React from 'react';
2
- import { InitPanelOptions } from '../types/initPanelOptions';
3
2
  type AppProps = {
4
3
  children: React.ReactNode;
5
- init: () => InitPanelOptions;
6
4
  };
7
- export declare function Panel({ children, init }: AppProps): React.JSX.Element;
5
+ export declare function Panel({ children }: AppProps): React.JSX.Element;
8
6
  export {};
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
+ import { InputOptions } from '../../decorators/form/Input';
2
3
  interface CheckboxProps extends React.InputHTMLAttributes<HTMLInputElement> {
3
- id: string;
4
+ input: InputOptions;
4
5
  }
5
- export declare function Checkbox({ id, ...props }: CheckboxProps): React.JSX.Element;
6
+ export declare function Checkbox({ input, ...props }: CheckboxProps): React.JSX.Element;
6
7
  export {};
@@ -8,6 +8,10 @@ interface FormFieldProps {
8
8
  message?: string;
9
9
  };
10
10
  baseName?: string;
11
+ onSelectPreloader?: (inputOptions: InputOptions) => Promise<{
12
+ label: string;
13
+ value: string;
14
+ }[]>;
11
15
  }
12
- export declare function FormField({ input, register, error, baseName }: FormFieldProps): React.JSX.Element;
16
+ export declare function FormField({ input, register, error, baseName, onSelectPreloader }: FormFieldProps): React.JSX.Element;
13
17
  export {};
@@ -1,12 +1,17 @@
1
1
  import React from 'react';
2
+ import { InputOptions } from '../../decorators/form/Input';
2
3
  import { FormOptions } from '../../decorators/form/FormOptions';
3
- import { AnyClass } from '../../types/AnyClass';
4
4
  import { OnSubmitFN, GetDetailsDataFN } from '../pages/FormPage';
5
- interface InnerFormProps<T extends AnyClass> {
5
+ interface InnerFormProps<T> {
6
6
  formOptions: FormOptions;
7
7
  onSubmit: OnSubmitFN<T>;
8
8
  getDetailsData?: GetDetailsDataFN<T>;
9
9
  redirectBackOnSuccess?: boolean;
10
+ onSelectPreloader?: (inputOptions: InputOptions) => Promise<{
11
+ label: string;
12
+ value: string;
13
+ }[]>;
14
+ type?: 'json' | 'formData';
10
15
  }
11
- export declare function InnerForm<T extends AnyClass>({ formOptions, onSubmit, getDetailsData, redirectBackOnSuccess, }: InnerFormProps<T>): React.JSX.Element;
16
+ export declare function InnerForm<T>({ formOptions, onSubmit, getDetailsData, redirectBackOnSuccess, onSelectPreloader, type, }: InnerFormProps<T>): React.JSX.Element;
12
17
  export {};
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
- interface LabelProps {
2
+ interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
3
3
  htmlFor: string;
4
4
  label?: string;
5
5
  fieldName: string;
6
+ children?: React.ReactNode;
6
7
  }
7
- export declare function Label({ htmlFor, label, fieldName }: LabelProps): React.JSX.Element;
8
+ export declare function Label({ label, fieldName, children, ...props }: LabelProps): React.JSX.Element;
8
9
  export {};
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { InputOptions } from '../../decorators/form/Input';
3
+ interface UploaderProps {
4
+ input: InputOptions;
5
+ maxLength?: number;
6
+ }
7
+ export declare function Uploader({ input, maxLength }: UploaderProps): React.JSX.Element;
8
+ export {};
@@ -2,7 +2,7 @@ export { InnerForm } from './InnerForm';
2
2
  export { FormField } from './FormField';
3
3
  export { LoadingScreen } from './LoadingScreen';
4
4
  export { Counter } from './Counter';
5
- export { ImageUploader } from './ImageUploader';
5
+ export { Uploader } from './Uploader';
6
6
  export { ErrorComponent } from './ErrorComponent';
7
7
  export { Label } from './Label';
8
8
  export { ErrorBoundary } from './ErrorBoundary';
@@ -13,7 +13,7 @@ export interface PaginatedResponse<T> {
13
13
  }
14
14
  export type GetDataForList<T> = (params: GetDataParams) => Promise<PaginatedResponse<T>>;
15
15
  export declare function ListPage<T extends AnyClass>({ model, getData, onRemoveItem, customHeader, }: {
16
- model: T;
16
+ model: any;
17
17
  getData: GetDataForList<T>;
18
18
  customHeader?: React.ReactNode;
19
19
  onRemoveItem?: (item: T) => Promise<void>;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { InputConfiguration } from '../../decorators/form/Input';
3
+ interface CheckboxProps extends React.InputHTMLAttributes<HTMLInputElement> {
4
+ input: InputConfiguration;
5
+ }
6
+ export declare function Checkbox({ input, ...props }: CheckboxProps): React.JSX.Element;
7
+ export {};
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { InputConfiguration } from '../../decorators/form/Input';
3
+ import { UseFormRegister } from 'react-hook-form';
4
+ interface FormFieldProps {
5
+ input: InputConfiguration;
6
+ register: UseFormRegister<any>;
7
+ error?: {
8
+ message?: string;
9
+ };
10
+ baseName?: string;
11
+ onSelectPreloader?: (inputOptions: InputConfiguration) => Promise<{
12
+ label: string;
13
+ value: string;
14
+ }[]>;
15
+ }
16
+ export declare function FormField({ input, register, error, baseName, onSelectPreloader }: FormFieldProps): React.JSX.Element;
17
+ export {};
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { AnyClass, AnyClassConstructor } from '../../types/AnyClass';
3
+ export interface FormPageProps<T extends AnyClass> {
4
+ model: AnyClassConstructor<T>;
5
+ }
6
+ export declare function FormPage<T extends AnyClass>({ model }: FormPageProps<T>): React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { InputConfiguration } from '../../decorators/form/Input';
3
+ import { FormConfiguration } from '../../decorators/form/Form';
4
+ import { AnyClass } from '../../types/AnyClass';
5
+ interface InnerFormProps<T extends AnyClass> {
6
+ inputs: InputConfiguration[];
7
+ formClass: FormConfiguration<T>;
8
+ }
9
+ export declare function InnerForm<T extends AnyClass>({ inputs, formClass }: InnerFormProps<T>): React.JSX.Element;
10
+ export {};
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
3
+ htmlFor: string;
4
+ label?: string;
5
+ fieldName: string;
6
+ children?: React.ReactNode;
7
+ }
8
+ export declare function Label({ label, fieldName, children, ...props }: LabelProps): React.JSX.Element;
9
+ export {};
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { InputOptions } from '../../decorators/form/Input';
3
+ interface UploaderProps {
4
+ input: InputOptions;
5
+ maxLength?: number;
6
+ }
7
+ export declare function Uploader({ input, maxLength }: UploaderProps): React.JSX.Element;
8
+ export {};
@@ -1,12 +1,11 @@
1
- import React from "react";
2
- import { ScreenCreatorData } from "../../types/ScreenCreatorData";
1
+ import React from 'react';
3
2
  export declare function Layout<IconType>({ children, menu, getIcons, logout, }: {
4
3
  children?: React.ReactNode;
5
- menu?: (screens: Record<string, ScreenCreatorData>) => {
4
+ menu?: () => {
6
5
  name: string;
7
6
  path: string;
8
7
  iconType: IconType;
9
8
  }[];
10
9
  getIcons?: (iconType: IconType) => React.ReactNode;
11
- logout?: () => void;
10
+ logout?: (type: 'redirect' | 'logout') => void;
12
11
  }): React.JSX.Element;
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
- import { ScreenCreatorData } from '../../types/ScreenCreatorData';
3
- type GetMenuFunction<IconType> = (screens: Record<string, ScreenCreatorData>) => {
2
+ type GetMenuFunction<IconType> = () => {
4
3
  name: string;
5
4
  path: string;
6
5
  iconType: IconType;
@@ -9,6 +8,6 @@ type GetIconsFunction<IconType> = (iconType: IconType) => React.ReactNode;
9
8
  export declare function SideBar<IconType>({ menu, getIcons, onLogout, }: {
10
9
  menu?: GetMenuFunction<IconType>;
11
10
  getIcons?: GetIconsFunction<IconType>;
12
- onLogout?: () => void;
11
+ onLogout?: (type: 'redirect' | 'logout') => void;
13
12
  }): React.JSX.Element;
14
13
  export {};
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { AnyClass } from '../../types/AnyClass';
3
+ interface CellFieldProps<T extends AnyClass> {
4
+ cellOptions: any;
5
+ item: T;
6
+ value: any;
7
+ }
8
+ export declare function CellField<T extends AnyClass>({ cellOptions, item, value }: CellFieldProps<T>): React.JSX.Element;
9
+ export {};
@@ -1,12 +1,10 @@
1
1
  import React from 'react';
2
- import { ListData } from '../../decorators/list/ListData';
3
- interface ListProps<T extends {
4
- id: string;
5
- }> {
2
+ import { ListPageMeta } from '../../decorators/list/getListPageMeta';
3
+ import { AnyClass } from '../../types/AnyClass';
4
+ interface DatagridProps<T extends AnyClass> {
6
5
  data: T[];
7
- listData: ListData;
6
+ listPageMeta: ListPageMeta<T>;
7
+ onRemoveItem?: (item: T) => Promise<void>;
8
8
  }
9
- export declare function Datagrid<T extends {
10
- id: string;
11
- }>({ data, listData }: ListProps<T>): React.JSX.Element;
9
+ export declare function Datagrid<T extends AnyClass>({ data, listPageMeta, onRemoveItem, }: DatagridProps<T>): React.JSX.Element;
12
10
  export {};
@@ -1,10 +1,12 @@
1
1
  import React from 'react';
2
- import { CellOptions } from '../../decorators/list/Cell';
3
- interface FilterPopupProps {
2
+ import { ListPageMeta } from '../../decorators/list/getListPageMeta';
3
+ import { AnyClass } from '../../types/AnyClass';
4
+ interface FilterPopupProps<T extends AnyClass> {
4
5
  isOpen: boolean;
5
6
  onClose: () => void;
6
- onApplyFilters: (filters: any) => void;
7
- fields: CellOptions[];
7
+ onApplyFilters: (filters: Record<string, string>) => void;
8
+ listPageMeta: ListPageMeta<T>;
9
+ activeFilters?: Record<string, string>;
8
10
  }
9
- export declare const FilterPopup: React.FC<FilterPopupProps>;
11
+ export declare function FilterPopup<T extends AnyClass>({ isOpen, onClose, onApplyFilters, listPageMeta, activeFilters, }: FilterPopupProps<T>): React.ReactElement | null;
10
12
  export {};
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { AnyClass } from '../../types/AnyClass';
3
+ import { ListPageMeta } from '../../decorators/list/getListPageMeta';
4
+ interface ListHeaderProps<T extends AnyClass> {
5
+ listPageMeta: ListPageMeta<T>;
6
+ filtered: boolean;
7
+ onFilterClick: () => void;
8
+ customHeader?: React.ReactNode;
9
+ }
10
+ export declare function ListHeader<T extends AnyClass>({ listPageMeta, filtered, onFilterClick, customHeader, }: ListHeaderProps<T>): React.JSX.Element;
11
+ export {};
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { AnyClass, AnyClassConstructor } from '../../types/AnyClass';
3
+ export declare function ListPage<T extends AnyClass>({ model, customHeader, }: {
4
+ model: AnyClassConstructor<T>;
5
+ customHeader?: React.ReactNode;
6
+ }): React.JSX.Element;
@@ -1,12 +1,18 @@
1
1
  import React from 'react';
2
2
  import { AnyClass } from '../../types/AnyClass';
3
+ import { InputOptions } from '../../decorators/form/Input';
3
4
  export type GetDetailsDataFN<T> = (param: Record<string, string>) => Promise<T>;
4
5
  export type OnSubmitFN<T> = (data: T) => Promise<T>;
5
6
  export interface FormPageProps<T extends AnyClass> {
6
- model: T;
7
+ model: any;
7
8
  getDetailsData?: GetDetailsDataFN<T>;
8
9
  redirect?: string;
9
10
  onSubmit: OnSubmitFN<T>;
11
+ onSelectPreloader?: (inputOptions: InputOptions) => Promise<{
12
+ label: string;
13
+ value: string;
14
+ }[]>;
10
15
  redirectBackOnSuccess?: boolean;
16
+ type?: 'json' | 'formData';
11
17
  }
12
- export declare function FormPage<T extends AnyClass>({ model, getDetailsData, onSubmit, redirect, redirectBackOnSuccess, ...rest }: FormPageProps<T>): React.JSX.Element;
18
+ export declare function FormPage<T extends AnyClass>({ model, getDetailsData, onSubmit, redirect, onSelectPreloader, redirectBackOnSuccess, type, ...rest }: FormPageProps<T>): React.JSX.Element;
@@ -0,0 +1,11 @@
1
+ import 'reflect-metadata';
2
+ import { AnyClass } from '../../types/AnyClass';
3
+ export type GetDetailsDataFN<T> = (param: Record<string, string>) => Promise<T>;
4
+ interface DetailsOptions<T extends AnyClass> {
5
+ getDetailsData: GetDetailsDataFN<T>;
6
+ }
7
+ export interface DetailsConfiguration<T extends AnyClass> extends DetailsOptions<T> {
8
+ }
9
+ export declare function Details<T extends AnyClass>(options?: DetailsOptions<T>): ClassDecorator;
10
+ export declare function getDetailsConfiguration<T extends AnyClass>(entityClass: T): DetailsConfiguration<T>;
11
+ export {};
@@ -0,0 +1,11 @@
1
+ import 'reflect-metadata';
2
+ import { AnyClass } from '../../types/AnyClass';
3
+ interface DetailsItemOptions {
4
+ name?: string;
5
+ }
6
+ export interface DetailsItemConfiguration extends DetailsItemOptions {
7
+ name: string;
8
+ }
9
+ export declare function DetailsItem(options?: DetailsItemOptions): PropertyDecorator;
10
+ export declare function getDetailsItemFields<T extends AnyClass>(entityClass: T): DetailsItemConfiguration[];
11
+ export {};
@@ -0,0 +1,8 @@
1
+ import { AnyClass } from '../../types/AnyClass';
2
+ import { DetailsItemConfiguration } from './DetailsItem';
3
+ import { DetailsConfiguration } from './Details';
4
+ export interface DetailsPageMeta<T extends AnyClass> {
5
+ class: DetailsConfiguration<T>;
6
+ items: DetailsItemConfiguration[];
7
+ }
8
+ export declare function getDetailsPageMeta<T extends AnyClass>(entityClass: T): DetailsPageMeta<T>;
@@ -1,6 +1,22 @@
1
- import "reflect-metadata";
2
- import { AnyClass } from "../../types/AnyClass";
3
- export interface FormConfiguration {
1
+ import 'reflect-metadata';
2
+ import { AnyClass, AnyClassConstructor } from '../../types/AnyClass';
3
+ import { GetDetailsDataFN } from '../details/Details';
4
+ import { InputConfiguration } from './Input';
5
+ export type OnSubmitFN<T> = (data: T | FormData) => Promise<T | FormData>;
6
+ interface FormOptions<T extends AnyClass> {
7
+ onSubmit: OnSubmitFN<T>;
8
+ getDetailsData?: GetDetailsDataFN<T>;
9
+ onSelectPreloader?: (inputOptions: InputConfiguration) => Promise<{
10
+ label: string;
11
+ value: string;
12
+ }[]>;
13
+ redirectBackOnSuccess?: boolean;
14
+ type?: 'json' | 'formData';
4
15
  }
5
- export declare function FormDecorator(options?: FormConfiguration): ClassDecorator;
6
- export declare function getFormConfiguration(entityClass: AnyClass): FormConfiguration | undefined;
16
+ export interface FormConfiguration<T extends AnyClass> extends FormOptions<T> {
17
+ redirectBackOnSuccess: boolean;
18
+ type: 'json' | 'formData';
19
+ }
20
+ export declare function Form<T extends AnyClass>(options?: FormOptions<T>): ClassDecorator;
21
+ export declare function getFormConfiguration<T extends AnyClass, K extends AnyClassConstructor<T>>(entityClass: K): FormConfiguration<T>;
22
+ export {};
@@ -1,5 +1,5 @@
1
1
  import 'reflect-metadata';
2
- import { AnyClass } from '../../types/AnyClass';
2
+ import { AnyClass, AnyClassConstructor } from '../../types/AnyClass';
3
3
  export interface InputOptions {
4
4
  type?: 'input' | 'select' | 'textarea' | 'file-upload' | 'checkbox' | 'hidden' | 'nested';
5
5
  inputType?: 'text' | 'email' | 'tel' | 'password' | 'number' | 'date';
@@ -11,7 +11,11 @@ export interface InputOptions {
11
11
  value: string;
12
12
  label: string;
13
13
  }[];
14
- nestedFields?: InputOptions[];
14
+ optionsPreload?: boolean;
15
+ nestedFields?: InputConfiguration[];
16
+ }
17
+ export interface InputConfiguration extends InputOptions {
18
+ name: string;
15
19
  }
16
20
  export declare function Input(options?: InputOptions): PropertyDecorator;
17
- export declare function getInputFields<T extends AnyClass>(entityClass: T): InputOptions[];
21
+ export declare function getInputFields<T extends AnyClass>(entityClass: AnyClassConstructor<T>): InputConfiguration[];
@@ -0,0 +1,10 @@
1
+ import { AnyClass, AnyClassConstructor } from '../../types/AnyClass';
2
+ import { InputConfiguration } from './Input';
3
+ import { FormConfiguration } from './Form';
4
+ import { Resolver } from 'react-hook-form';
5
+ export interface FormPageMeta<T extends AnyClass> {
6
+ resolver: Resolver<T>;
7
+ class: FormConfiguration<T>;
8
+ inputs: InputConfiguration[];
9
+ }
10
+ export declare function getFormPageMeta<T extends AnyClass, K extends AnyClassConstructor<T>>(entityClass: K): FormPageMeta<T>;
@@ -1,4 +1,5 @@
1
1
  import 'reflect-metadata';
2
+ import { AnyClass } from '../../types/AnyClass';
2
3
  export declare const CELL_KEY: unique symbol;
3
4
  interface Filter {
4
5
  type: 'string' | 'number' | 'date' | 'static-select';
@@ -10,12 +11,23 @@ export interface StaticSelectFilter extends Filter {
10
11
  label: string;
11
12
  }[];
12
13
  }
14
+ export type CellTypes = 'string' | 'date' | 'number' | 'boolean' | 'uuid';
15
+ export type ExtendedCellTypes = CellTypes | 'image';
13
16
  export interface CellOptions {
14
17
  name?: string;
15
18
  title?: string;
16
- type?: 'string' | 'date' | 'image' | 'number';
19
+ type?: CellTypes;
17
20
  placeHolder?: string;
18
21
  filter?: Filter | StaticSelectFilter;
19
22
  }
23
+ export interface ExtendedCellOptions extends Omit<CellOptions, 'type'> {
24
+ type?: ExtendedCellTypes;
25
+ }
26
+ export interface CellConfiguration extends Omit<CellOptions, 'type'> {
27
+ name: string;
28
+ type: ExtendedCellTypes;
29
+ }
20
30
  export declare function Cell(options?: CellOptions): PropertyDecorator;
31
+ export declare function ExtendedCell(options?: ExtendedCellOptions): PropertyDecorator;
32
+ export declare function getCellFields<T extends AnyClass>(entityClass: T): CellConfiguration[];
21
33
  export {};
@@ -1,4 +1,17 @@
1
1
  import 'reflect-metadata';
2
+ import { AnyClass } from '../../types/AnyClass';
3
+ export interface GetDataParams {
4
+ page?: number;
5
+ limit?: number;
6
+ filters?: Record<string, any>;
7
+ }
8
+ export interface PaginatedResponse<T> {
9
+ data: T[];
10
+ total: number;
11
+ page: number;
12
+ limit: number;
13
+ }
14
+ export type GetDataForList<T> = (params: GetDataParams) => Promise<PaginatedResponse<T>>;
2
15
  export interface ListHeaderOptions {
3
16
  title?: string;
4
17
  create?: {
@@ -17,11 +30,15 @@ export interface ListCellOptions<T> {
17
30
  };
18
31
  delete?: {
19
32
  label: string;
33
+ onRemoveItem?: (item: T) => Promise<void>;
20
34
  };
21
35
  }
22
36
  export interface ListOptions<T> {
37
+ getData: GetDataForList<T>;
23
38
  headers?: ListHeaderOptions;
24
39
  cells?: ((item: T) => ListCellOptions<T>) | ListCellOptions<T>;
25
40
  }
41
+ export interface ListConfiguration<T> extends ListOptions<T> {
42
+ }
26
43
  export declare function List<T>(options?: ListOptions<T> | ((item: T) => ListOptions<T>)): ClassDecorator;
27
- export declare function getClassListData<T>(entityClass: T): ListOptions<T> | undefined;
44
+ export declare function getListConfiguration<T extends AnyClass>(entityClass: T): ListConfiguration<T>;
@@ -0,0 +1,9 @@
1
+ import 'reflect-metadata';
2
+ import { CellConfiguration, CellOptions } from '../Cell';
3
+ export interface ImageCellOptions extends CellOptions {
4
+ baseUrl: string;
5
+ }
6
+ export interface ImageCellConfiguration extends CellConfiguration {
7
+ type: 'image';
8
+ }
9
+ export declare function ImageCell(options?: ImageCellOptions): PropertyDecorator;
@@ -0,0 +1,8 @@
1
+ import { AnyClass } from '../../types/AnyClass';
2
+ import { CellConfiguration } from './Cell';
3
+ import { ListConfiguration } from './List';
4
+ export interface ListPageMeta<T extends AnyClass> {
5
+ class: ListConfiguration<T>;
6
+ cells: CellConfiguration[];
7
+ }
8
+ export declare function getListPageMeta<T extends AnyClass>(entityClass: T): ListPageMeta<T>;