proje-react-panel 1.5.0 → 1.6.0-test-1

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 (43) hide show
  1. package/.cursor/rules.md +11 -1
  2. package/AUTH_LAYOUT_EXAMPLE.md +343 -0
  3. package/AUTH_LAYOUT_GUIDE.md +819 -0
  4. package/IMPLEMENTATION_GUIDE.md +899 -0
  5. package/dist/api/ApiConfig.d.ts +11 -0
  6. package/dist/api/AuthApi.d.ts +2 -5
  7. package/dist/api/CrudApi.d.ts +11 -12
  8. package/dist/components/list/cells/BooleanCell.d.ts +5 -2
  9. package/dist/components/list/cells/DateCell.d.ts +5 -2
  10. package/dist/components/list/cells/DefaultCell.d.ts +3 -2
  11. package/dist/components/list/cells/DownloadCell.d.ts +3 -2
  12. package/dist/components/list/cells/ImageCell.d.ts +3 -2
  13. package/dist/components/list/cells/UUIDCell.d.ts +5 -2
  14. package/dist/decorators/auth/DefaultLoginForm.d.ts +4 -0
  15. package/dist/decorators/list/Cell.d.ts +4 -0
  16. package/dist/decorators/list/List.d.ts +7 -2
  17. package/dist/index.cjs.js +15 -1
  18. package/dist/index.d.ts +5 -0
  19. package/dist/index.esm.js +15 -1
  20. package/dist/types/Login.d.ts +8 -0
  21. package/package.json +3 -1
  22. package/src/api/ApiConfig.ts +63 -0
  23. package/src/api/AuthApi.ts +8 -0
  24. package/src/api/CrudApi.ts +96 -60
  25. package/src/components/list/CellField.tsx +19 -10
  26. package/src/components/list/Datagrid.tsx +26 -12
  27. package/src/components/list/cells/BooleanCell.tsx +7 -2
  28. package/src/components/list/cells/DateCell.tsx +6 -2
  29. package/src/components/list/cells/DefaultCell.tsx +4 -4
  30. package/src/components/list/cells/DownloadCell.tsx +4 -2
  31. package/src/components/list/cells/ImageCell.tsx +4 -2
  32. package/src/components/list/cells/LinkCell.tsx +3 -2
  33. package/src/components/list/cells/UUIDCell.tsx +6 -2
  34. package/src/decorators/auth/DefaultLoginForm.ts +32 -0
  35. package/src/decorators/list/Cell.ts +4 -0
  36. package/src/decorators/list/List.ts +3 -2
  37. package/src/index.ts +25 -0
  38. package/src/store/store.ts +1 -1
  39. package/src/styles/components/button.scss +14 -0
  40. package/src/styles/index.scss +1 -1
  41. package/src/styles/list.scss +8 -1
  42. package/src/types/Login.ts +9 -0
  43. package/src/utils/logout.ts +2 -0
@@ -0,0 +1,11 @@
1
+ import { AxiosInstance } from 'axios';
2
+ declare let axiosInstance: AxiosInstance;
3
+ export interface ApiConfig {
4
+ baseUrl: string;
5
+ }
6
+ export declare function initApi(config: ApiConfig): void;
7
+ export declare function initAuthToken(): void;
8
+ export declare function setAuthToken(token: string): void;
9
+ export declare function setAuthLogout(): void;
10
+ export declare function getAxiosInstance(): AxiosInstance;
11
+ export { axiosInstance };
@@ -1,5 +1,2 @@
1
- export declare const AuthApi: {
2
- login: (fetchSettings: {
3
- baseUrl: string;
4
- }, username: string, password: string) => Promise<any>;
5
- };
1
+ import { LoginForm, LoginResponse } from '../types/Login';
2
+ export declare function login<T>(data: LoginForm | FormData): Promise<LoginResponse<T>>;
@@ -1,12 +1,11 @@
1
- interface FetchOptions {
2
- token: string;
3
- baseUrl: string;
4
- }
5
- export declare const CrudApi: {
6
- getList: (options: FetchOptions, api: string) => Promise<any>;
7
- create: (options: FetchOptions, api: string, data: any) => Promise<any>;
8
- details: (options: FetchOptions, api: string, id: any) => Promise<any>;
9
- edit: (options: FetchOptions, api: string, data: any) => Promise<any>;
10
- delete: (options: FetchOptions, api: string, id: string) => Promise<any>;
11
- };
12
- export {};
1
+ import { GetDataForList } from '../decorators/list/List';
2
+ import { OnSubmitFN } from '../decorators/form/Form';
3
+ import { GetDetailsDataFN } from '../decorators/details/Details';
4
+ export declare function getAll<T>(endpoint: string): GetDataForList<T>;
5
+ export declare function getOne<T>(endpoint: string, key?: string): GetDetailsDataFN<T>;
6
+ export declare function create<T>(endpoint: string): OnSubmitFN<T>;
7
+ export declare function createFormData<T>(endpoint: string): OnSubmitFN<T>;
8
+ export declare function update<T>(endpoint: string, key?: string): OnSubmitFN<T>;
9
+ export declare function updateFormData<T>(endpoint: string, key?: string): OnSubmitFN<T>;
10
+ export declare function updateSimple<T>(endpoint: string): OnSubmitFN<T>;
11
+ export declare function remove<T>(endpoint: string, key?: string): (data: T) => Promise<void>;
@@ -1,6 +1,9 @@
1
1
  import React from 'react';
2
+ import { AnyClass } from '../../../types/AnyClass';
3
+ import { CellConfiguration } from '../../../decorators/list/Cell';
2
4
  interface BooleanCellProps {
3
- value: boolean;
5
+ item: AnyClass;
6
+ configuration: CellConfiguration;
4
7
  }
5
- export declare function BooleanCell({ value }: BooleanCellProps): React.JSX.Element;
8
+ export declare function BooleanCell({ item, configuration }: BooleanCellProps): React.JSX.Element;
6
9
  export {};
@@ -1,6 +1,9 @@
1
1
  import React from 'react';
2
+ import { AnyClass } from '../../../types/AnyClass';
3
+ import { CellConfiguration } from '../../../decorators/list/Cell';
2
4
  interface DateCellProps {
3
- value: string | number | Date;
5
+ item: AnyClass;
6
+ configuration: CellConfiguration;
4
7
  }
5
- export declare function DateCell({ value }: DateCellProps): React.JSX.Element;
8
+ export declare function DateCell({ item, configuration }: DateCellProps): React.JSX.Element;
6
9
  export {};
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
2
  import { CellConfiguration } from '../../../decorators/list/Cell';
3
+ import { AnyClass } from '../../../types/AnyClass';
3
4
  interface DefaultCellProps {
4
- value: any;
5
+ item: AnyClass;
5
6
  configuration: CellConfiguration;
6
7
  }
7
- export declare function DefaultCell({ value, configuration }: DefaultCellProps): React.ReactElement;
8
+ export declare function DefaultCell({ item, configuration }: DefaultCellProps): React.ReactElement;
8
9
  export {};
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
2
  import { CellConfiguration } from '../../../decorators/list/Cell';
3
+ import { AnyClass } from '../../../types/AnyClass';
3
4
  interface DownloadCellProps {
4
- value: string;
5
+ item: AnyClass;
5
6
  configuration: CellConfiguration;
6
7
  }
7
- export declare function DownloadCell({ value, configuration }: DownloadCellProps): React.ReactElement;
8
+ export declare function DownloadCell({ item, configuration }: DownloadCellProps): React.ReactElement;
8
9
  export {};
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
2
  import { CellConfiguration } from '../../../decorators/list/Cell';
3
+ import { AnyClass } from '../../../types/AnyClass';
3
4
  interface ImageCellProps {
4
- value: string;
5
+ item: AnyClass;
5
6
  configuration: CellConfiguration;
6
7
  }
7
- export declare function ImageCell({ value, configuration }: ImageCellProps): React.JSX.Element;
8
+ export declare function ImageCell({ item, configuration }: ImageCellProps): React.JSX.Element;
8
9
  export {};
@@ -1,6 +1,9 @@
1
1
  import React from 'react';
2
+ import { AnyClass } from '../../../types/AnyClass';
3
+ import { CellConfiguration } from '../../../decorators/list/Cell';
2
4
  interface UUIDCellProps {
3
- value: string;
5
+ item: AnyClass;
6
+ configuration: CellConfiguration;
4
7
  }
5
- export declare function UUIDCell({ value }: UUIDCellProps): React.JSX.Element;
8
+ export declare function UUIDCell({ item, configuration }: UUIDCellProps): React.JSX.Element;
6
9
  export {};
@@ -0,0 +1,4 @@
1
+ export declare class DefaultLoginForm {
2
+ username: string;
3
+ password: string;
4
+ }
@@ -20,6 +20,10 @@ export interface CellOptions {
20
20
  type?: CellTypes;
21
21
  placeHolder?: string;
22
22
  filter?: Filter | StaticSelectFilter;
23
+ style?: {
24
+ minWidth?: string;
25
+ width?: string;
26
+ };
23
27
  }
24
28
  export interface CellConfiguration extends Omit<CellOptions, 'type'> {
25
29
  name: string;
@@ -19,7 +19,12 @@ export interface ListHeaderOptions {
19
19
  label: string;
20
20
  };
21
21
  }
22
- export interface ListCellOptions<T> {
22
+ export interface ListActionOptions<T> {
23
+ customActions?: {
24
+ label: string;
25
+ onClick: (item: T) => void;
26
+ icon?: string;
27
+ }[];
23
28
  details?: {
24
29
  path: string;
25
30
  label: string;
@@ -36,7 +41,7 @@ export interface ListCellOptions<T> {
36
41
  export interface ListOptions<T> {
37
42
  getData: GetDataForList<T>;
38
43
  headers?: ListHeaderOptions;
39
- cells?: ((item: T) => ListCellOptions<T>) | ListCellOptions<T>;
44
+ actions?: ((item: T) => ListActionOptions<T>) | ListActionOptions<T>;
40
45
  primaryId?: string;
41
46
  key?: string;
42
47
  }