proje-react-panel 1.4.1 → 1.6.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 (39) hide show
  1. package/.vscode/launch.json +9 -0
  2. package/dist/components/list/CellField.d.ts +2 -2
  3. package/dist/components/list/cells/BooleanCell.d.ts +5 -2
  4. package/dist/components/list/cells/DateCell.d.ts +5 -2
  5. package/dist/components/list/cells/DefaultCell.d.ts +3 -2
  6. package/dist/components/list/cells/DownloadCell.d.ts +3 -2
  7. package/dist/components/list/cells/ImageCell.d.ts +3 -2
  8. package/dist/components/list/cells/LinkCell.d.ts +8 -0
  9. package/dist/components/list/cells/UUIDCell.d.ts +5 -2
  10. package/dist/decorators/details/Details.d.ts +1 -1
  11. package/dist/decorators/list/Cell.d.ts +5 -1
  12. package/dist/decorators/list/List.d.ts +8 -4
  13. package/dist/decorators/list/cells/LinkCell.d.ts +13 -0
  14. package/dist/index.cjs.js +1 -1
  15. package/dist/index.d.ts +2 -1
  16. package/dist/index.esm.js +1 -1
  17. package/package.json +1 -1
  18. package/src/assets/icons/svg/down-arrow-backup-2.svg +3 -0
  19. package/src/components/DetailsPage.tsx +5 -1
  20. package/src/components/list/CellField.tsx +25 -10
  21. package/src/components/list/Datagrid.tsx +83 -53
  22. package/src/components/list/ListPage.tsx +3 -0
  23. package/src/components/list/cells/BooleanCell.tsx +7 -2
  24. package/src/components/list/cells/DateCell.tsx +6 -2
  25. package/src/components/list/cells/DefaultCell.tsx +4 -4
  26. package/src/components/list/cells/DownloadCell.tsx +4 -2
  27. package/src/components/list/cells/ImageCell.tsx +5 -2
  28. package/src/components/list/cells/LinkCell.tsx +31 -0
  29. package/src/components/list/cells/UUIDCell.tsx +6 -2
  30. package/src/decorators/details/Details.ts +1 -1
  31. package/src/decorators/list/Cell.ts +5 -1
  32. package/src/decorators/list/List.ts +4 -4
  33. package/src/decorators/list/cells/LinkCell.ts +22 -0
  34. package/src/index.ts +2 -1
  35. package/src/services/DataService.ts +14 -10
  36. package/src/store/store.ts +1 -1
  37. package/src/styles/components/button.scss +14 -0
  38. package/src/styles/index.scss +1 -1
  39. package/src/styles/list.scss +64 -1
@@ -22,6 +22,15 @@
22
22
  "cwd": "${workspaceFolder}/examples",
23
23
  "console": "integratedTerminal",
24
24
  "internalConsoleOptions": "neverOpen"
25
+ },
26
+ {
27
+ "type": "node",
28
+ "request": "launch",
29
+ "name": "Start Server",
30
+ "runtimeExecutable": "yarn",
31
+ "runtimeArgs": ["start"],
32
+ "cwd": "/Users/hasbisefademir/WebstormProjects/proje/nestjs-react-panel-server",
33
+ "console": "integratedTerminal"
25
34
  }
26
35
  ]
27
36
  }
@@ -3,7 +3,7 @@ import { AnyClass } from '../../types/AnyClass';
3
3
  import { CellConfiguration } from '../../decorators/list/Cell';
4
4
  interface CellFieldProps<T extends AnyClass> {
5
5
  configuration: CellConfiguration;
6
- value: T[keyof T];
6
+ item: T;
7
7
  }
8
- export declare function CellField<T extends AnyClass>({ configuration, value, }: CellFieldProps<T>): React.ReactElement;
8
+ export declare function CellField<T extends AnyClass>({ configuration, item, }: CellFieldProps<T>): React.ReactElement;
9
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 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 {};
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { CellConfiguration } from '../../../decorators/list/Cell';
3
+ interface LinkCellProps<T> {
4
+ item: T;
5
+ configuration: CellConfiguration;
6
+ }
7
+ export declare function LinkCell<T>({ item, configuration }: LinkCellProps<T>): React.JSX.Element;
8
+ 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 {};
@@ -4,7 +4,7 @@ export type GetDetailsDataFN<T> = (param: Record<string, string>) => Promise<T>;
4
4
  interface DetailsOptions<T extends AnyClass> {
5
5
  getDetailsData: GetDetailsDataFN<T>;
6
6
  key?: string;
7
- primaryId: keyof T;
7
+ primaryId?: keyof T;
8
8
  }
9
9
  export type DetailsConfiguration<T extends AnyClass> = DetailsOptions<T> & {
10
10
  key: string;
@@ -13,13 +13,17 @@ export interface StaticSelectFilter extends Filter {
13
13
  }[];
14
14
  }
15
15
  export type CellTypes = 'string' | 'date' | 'number' | 'boolean' | 'uuid';
16
- export type ExtendedCellTypes = CellTypes | 'image' | 'download';
16
+ export type ExtendedCellTypes = CellTypes | 'image' | 'download' | 'link';
17
17
  export interface CellOptions {
18
18
  name?: string;
19
19
  title?: string;
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,12 +41,11 @@ 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>;
40
- primaryId: string;
44
+ actions?: ((item: T) => ListActionOptions<T>) | ListActionOptions<T>;
45
+ primaryId?: string;
41
46
  key?: string;
42
47
  }
43
48
  export type ListConfiguration<T> = ListOptions<T> & {
44
- primaryId: string;
45
49
  key: string;
46
50
  };
47
51
  export declare function List<T>(options?: ListOptions<T> | ((item: T) => ListOptions<T>)): ClassDecorator;
@@ -0,0 +1,13 @@
1
+ import { CellConfiguration, CellOptions } from '../Cell';
2
+ export interface LinkCellOptions<T> extends Omit<CellOptions, 'type'> {
3
+ url?: string;
4
+ path?: string;
5
+ onClick?: (data: T) => void;
6
+ }
7
+ export interface LinkCellConfiguration<T> extends CellConfiguration {
8
+ type: 'link';
9
+ url?: string;
10
+ path?: string;
11
+ onClick?: (data: T) => void;
12
+ }
13
+ export declare function LinkCell<T>(options?: LinkCellOptions<T>): PropertyDecorator;