@sito/dashboard-app 0.0.1 → 0.0.2

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.
@@ -3,3 +3,4 @@ export * from './useRestoreAction';
3
3
  export * from './useEditAction';
4
4
  export * from './types';
5
5
  export * from './useExportAction';
6
+ export * from './useImportAction';
@@ -14,11 +14,13 @@ export interface UseMultipleActionPropTypes<TInDto> extends UseActionPropTypes {
14
14
  export interface UseExportAction extends UseActionPropTypes {
15
15
  onClick: () => void;
16
16
  }
17
+ export type UseImportAction = UseExportAction;
17
18
  export declare enum GlobalActions {
18
19
  Add = "add",
19
20
  Edit = "edit",
20
21
  Delete = "delete",
21
22
  Restore = "restore",
22
23
  Refresh = "refresh",
23
- Export = "export"
24
+ Export = "export",
25
+ Import = "import"
24
26
  }
@@ -0,0 +1,11 @@
1
+ import { GlobalActions, UseImportAction } from '..';
2
+ export declare const useImportAction: (props: UseImportAction) => {
3
+ action: () => {
4
+ id: GlobalActions;
5
+ hidden: boolean;
6
+ disabled: boolean;
7
+ icon: import("react/jsx-runtime").JSX.Element;
8
+ tooltip: string;
9
+ onClick: () => void;
10
+ };
11
+ };
@@ -2,4 +2,5 @@ export * from './useDeleteDialog';
2
2
  export * from './useDialog';
3
3
  export * from './useFormDialog';
4
4
  export * from './useRestoreDialog';
5
+ export * from './useImportDialog';
5
6
  export type * from './types';
@@ -25,3 +25,8 @@ export interface TriggerFormDialogPropsType<TFormType extends FieldValues, TErro
25
25
  export interface UseActionDialog<TRow extends BaseEntityDto, TFormType extends FieldValues> extends TriggerFormDialogPropsType<TFormType, ValidationError> {
26
26
  action: (record: TRow) => Action<TRow>;
27
27
  }
28
+ export type UseImportDialogPropsType<TMutationOutputDto, TMutationDto> = {
29
+ mutationFn: MutationFunction<TMutationOutputDto, TMutationDto>;
30
+ queryKey: QueryKey;
31
+ entity: string;
32
+ };
@@ -0,0 +1,26 @@
1
+ import { UseImportDialogPropsType } from './types';
2
+ import { ImportDto } from '../../lib';
3
+ export declare function useImportDialog(props: UseImportDialogPropsType<number, ImportDto>): {
4
+ open: boolean;
5
+ title: string;
6
+ handleClose: () => void;
7
+ action: () => {
8
+ id: import('..').GlobalActions;
9
+ hidden: boolean;
10
+ disabled: boolean;
11
+ icon: import("react/jsx-runtime").JSX.Element;
12
+ tooltip: string;
13
+ onClick: () => void;
14
+ };
15
+ onSubmit: import('react-hook-form').SubmitHandler<import('react-hook-form').FieldValues>;
16
+ reset?: import('react-hook-form').UseFormReset<import('react-hook-form').FieldValues> | undefined;
17
+ control?: import('react-hook-form').Control<import('react-hook-form').FieldValues> | undefined;
18
+ getValues?: import('react-hook-form').UseFormGetValues<import('react-hook-form').FieldValues> | undefined;
19
+ setValue?: import('react-hook-form').UseFormSetValue<import('react-hook-form').FieldValues> | undefined;
20
+ setError?: import('react-hook-form').UseFormSetError<import('react-hook-form').FieldValues> | undefined;
21
+ handleSubmit: import('react-hook-form').UseFormHandleSubmit<import('react-hook-form').FieldValues>;
22
+ parseFormError?: ((error: import('../../lib').ValidationError) => string[]) | undefined;
23
+ releaseFormError?: (() => void) | undefined;
24
+ buttonEnd?: boolean | undefined;
25
+ isLoading?: boolean | undefined;
26
+ };
@@ -10,7 +10,7 @@ export type UseConfirmationPropsType<TInDto, TError extends Error> = {
10
10
  export interface UseFormPropsType<TDto, TMutationDto, TMutationOutputDto, TFormType extends FieldValues> {
11
11
  defaultValues?: DefaultValues<TFormType>;
12
12
  getFunction?: (id: number) => Promise<TDto>;
13
- formToDto: (data: TFormType) => TMutationDto;
13
+ formToDto?: (data: TFormType) => TMutationDto;
14
14
  dtoToForm?: (data: TDto) => TFormType;
15
15
  mutationFn: MutationFunction<TMutationOutputDto, TMutationDto>;
16
16
  onError?: (errors: ValidationError) => void;
@@ -1,6 +1,6 @@
1
1
  import { APIClient } from './APIClient';
2
2
  import { QueryParam } from './types';
3
- import { BaseCommonEntityDto, BaseEntityDto, BaseFilterDto, DeleteDto, QueryResult } from '..';
3
+ import { BaseCommonEntityDto, BaseEntityDto, BaseFilterDto, DeleteDto, ImportDto, QueryResult } from '..';
4
4
  export declare class BaseClient<Tables, TDto extends BaseEntityDto, TCommonDto extends BaseCommonEntityDto, TAddDto, TUpdateDto extends DeleteDto, TFilter extends BaseFilterDto> {
5
5
  table: Tables;
6
6
  secured: boolean;
@@ -42,6 +42,12 @@ export declare class BaseClient<Tables, TDto extends BaseEntityDto, TCommonDto e
42
42
  * @returns - List of elements
43
43
  */
44
44
  export(filters?: TFilter): Promise<TDto[]>;
45
+ /**
46
+ *
47
+ * @param data - Import data
48
+ * @returns - List of elements
49
+ */
50
+ import(data: ImportDto): Promise<number>;
45
51
  /**
46
52
  *
47
53
  * @param query - Where conditions (key-value)
@@ -0,0 +1,4 @@
1
+ export type ImportDto = {
2
+ file: string;
3
+ override: boolean;
4
+ };
@@ -1,3 +1,4 @@
1
1
  export * from './base';
2
2
  export * from './auth';
3
3
  export * from './user';
4
+ export * from './ImportDto';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sito/dashboard-app",
3
3
  "private": false,
4
- "version": "0.0.1",
4
+ "version": "0.0.2",
5
5
  "type": "module",
6
6
  "description": "UI Library with prefab components",
7
7
  "main": "dist/dashboard-app.cjs",
@@ -72,7 +72,18 @@
72
72
  "typescript-eslint": "8.22.0",
73
73
  "vite": "6.1.0",
74
74
  "vite-plugin-dts": "4.0.2",
75
- "vite-plugin-lib-inject-css": "1.3.0"
75
+ "vite-plugin-lib-inject-css": "1.3.0",
76
+ "@emotion/css": "11.13.5",
77
+ "@tanstack/react-query": "5.83.0",
78
+ "react": "18.3.1",
79
+ "react-dom": "18.3.1",
80
+ "react-hook-form": "7.61.1",
81
+ "@fortawesome/fontawesome-svg-core": "7.0.0",
82
+ "@fortawesome/free-brands-svg-icons": "7.0.0",
83
+ "@fortawesome/free-regular-svg-icons": "7.0.0",
84
+ "@fortawesome/free-solid-svg-icons": "7.0.0",
85
+ "@fortawesome/react-fontawesome": "0.2.3",
86
+ "@sito/dashboard": "^0.0.49"
76
87
  },
77
88
  "dependencies": {
78
89
  "some-javascript-utils": "^0.10.10"