@sito/dashboard-app 0.0.21 → 0.0.23
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.
- package/dist/components/Dialog/ImportDialog/ImportDialog.d.ts +1 -1
- package/dist/dashboard-app.cjs +1 -1
- package/dist/dashboard-app.js +821 -830
- package/dist/hooks/dialogs/types.d.ts +7 -16
- package/dist/hooks/dialogs/useImportDialog.d.ts +2 -2
- package/dist/hooks/forms/types.d.ts +7 -9
- package/package.json +3 -3
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
import { MutationFunction, QueryKey } from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
2
|
+
import { FieldValues } from 'react-hook-form';
|
|
3
3
|
import { ActionType } from '@sito/dashboard';
|
|
4
|
-
import { BaseEntityDto, ImportDto, ImportPreviewDto, ValidationError } from '../../lib';
|
|
5
|
-
import { UseConfirmationPropsType } from '../forms';
|
|
4
|
+
import { BaseEntityDto, HttpError, ImportDto, ImportPreviewDto, ValidationError } from '../../lib';
|
|
5
|
+
import { UseBaseFormProps, UseConfirmationPropsType, UseFormPropsType } from '../forms';
|
|
6
6
|
import { FormDialogPropsType, ImportDialogPropsType } from '../../components';
|
|
7
7
|
export interface UseDeleteDialogPropsType extends UseConfirmationPropsType<number, ValidationError> {
|
|
8
8
|
queryKey: QueryKey;
|
|
9
9
|
}
|
|
10
|
-
export interface UseFormDialogPropsType<TDto, TMutationDto, TMutationOutputDto, TFormType extends FieldValues> {
|
|
11
|
-
defaultValues?: DefaultValues<TFormType>;
|
|
12
|
-
getFunction?: (id: number) => Promise<TDto>;
|
|
13
|
-
formToDto: (data: TFormType) => TMutationDto;
|
|
14
|
-
dtoToForm?: (data: TDto) => TFormType;
|
|
15
|
-
mutationFn: MutationFunction<TMutationOutputDto, TMutationDto>;
|
|
16
|
-
onError?: (errors: ValidationError) => void;
|
|
17
|
-
onSuccess?: (data: TMutationOutputDto) => void;
|
|
18
|
-
queryKey: QueryKey;
|
|
19
|
-
onSuccessMessage: string;
|
|
10
|
+
export interface UseFormDialogPropsType<TDto, TMutationDto, TMutationOutputDto, TFormType extends FieldValues> extends UseFormPropsType<TDto, TMutationDto, TMutationOutputDto, TFormType> {
|
|
20
11
|
title: string;
|
|
21
12
|
}
|
|
22
13
|
export interface TriggerFormDialogPropsType<TFormType extends FieldValues, TError extends Error = Error> extends FormDialogPropsType<TFormType, TError> {
|
|
@@ -25,14 +16,14 @@ export interface TriggerFormDialogPropsType<TFormType extends FieldValues, TErro
|
|
|
25
16
|
export interface UseActionDialog<TRow extends BaseEntityDto, TFormType extends FieldValues> extends TriggerFormDialogPropsType<TFormType, ValidationError> {
|
|
26
17
|
action: (record: TRow) => ActionType<TRow>;
|
|
27
18
|
}
|
|
28
|
-
export
|
|
19
|
+
export interface UseImportDialogPropsType<PreviewEntityDto extends ImportPreviewDto> extends UseBaseFormProps<PreviewEntityDto, HttpError> {
|
|
29
20
|
queryKey: QueryKey;
|
|
30
21
|
entity: string;
|
|
31
|
-
mutationFn: MutationFunction<number,
|
|
22
|
+
mutationFn: MutationFunction<number, ImportDto<PreviewEntityDto>>;
|
|
32
23
|
fileProcessor?: (file: File, options?: {
|
|
33
24
|
override?: boolean;
|
|
34
25
|
}) => Promise<PreviewEntityDto[]>;
|
|
35
|
-
}
|
|
26
|
+
}
|
|
36
27
|
export type UseImportDialogReturnType<EntityDto extends BaseEntityDto, PreviewEntityDto extends ImportPreviewDto> = ImportDialogPropsType<PreviewEntityDto> & {
|
|
37
28
|
action: () => ActionType<EntityDto>;
|
|
38
29
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { BaseEntityDto, ImportPreviewDto
|
|
1
|
+
import { BaseEntityDto, ImportPreviewDto } from '../../lib';
|
|
2
2
|
import { UseImportDialogPropsType, UseImportDialogReturnType } from './types';
|
|
3
|
-
export declare function useImportDialog<EntityDto extends BaseEntityDto, PreviewEntityDto extends ImportPreviewDto
|
|
3
|
+
export declare function useImportDialog<EntityDto extends BaseEntityDto, PreviewEntityDto extends ImportPreviewDto>(props: UseImportDialogPropsType<PreviewEntityDto>): UseImportDialogReturnType<EntityDto, PreviewEntityDto>;
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { MutationFunction, QueryKey } from '@tanstack/react-query';
|
|
2
|
-
import { ValidationError } from '../../lib';
|
|
3
2
|
import { FieldValues, DefaultValues } from 'react-hook-form';
|
|
4
|
-
export
|
|
5
|
-
mutationFn: (data: TInDto[]) => Promise<TInDto>;
|
|
3
|
+
export interface UseBaseFormProps<TInDto, TError extends Error> {
|
|
6
4
|
onError?: (error: TError) => void;
|
|
7
5
|
onSuccess?: (data: TInDto) => void | Promise<void>;
|
|
8
6
|
onSuccessMessage?: string;
|
|
9
|
-
}
|
|
10
|
-
export interface
|
|
7
|
+
}
|
|
8
|
+
export interface UseConfirmationPropsType<TInDto, TError extends Error> extends UseBaseFormProps<TInDto, TError> {
|
|
9
|
+
mutationFn: (data: TInDto[]) => Promise<TInDto>;
|
|
10
|
+
}
|
|
11
|
+
export interface UseFormPropsType<TDto, TMutationDto, TMutationOutputDto, TFormType extends FieldValues> extends UseBaseFormProps<TMutationOutputDto, Error> {
|
|
11
12
|
defaultValues?: DefaultValues<TFormType>;
|
|
12
13
|
getFunction?: (id: number) => Promise<TDto>;
|
|
13
14
|
formToDto?: (data: TFormType) => TMutationDto;
|
|
14
15
|
dtoToForm?: (data: TDto) => TFormType;
|
|
15
16
|
mutationFn: MutationFunction<TMutationOutputDto, TMutationDto>;
|
|
16
|
-
|
|
17
|
-
onSuccess?: (data: TMutationOutputDto) => void;
|
|
18
|
-
queryKey?: QueryKey;
|
|
19
|
-
onSuccessMessage?: string;
|
|
17
|
+
queryKey: QueryKey;
|
|
20
18
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sito/dashboard-app",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.23",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "UI Library with prefab components",
|
|
7
7
|
"main": "dist/dashboard-app.cjs",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@fortawesome/free-regular-svg-icons": "7.0.0",
|
|
52
52
|
"@fortawesome/free-solid-svg-icons": "7.0.0",
|
|
53
53
|
"@fortawesome/react-fontawesome": "0.2.3",
|
|
54
|
-
"@sito/dashboard": "^0.0.
|
|
54
|
+
"@sito/dashboard": "^0.0.56",
|
|
55
55
|
"@tanstack/react-query": "5.83.0",
|
|
56
56
|
"react": "18.3.1",
|
|
57
57
|
"react-dom": "18.3.1",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@fortawesome/free-regular-svg-icons": "7.0.0",
|
|
65
65
|
"@fortawesome/free-solid-svg-icons": "7.0.0",
|
|
66
66
|
"@fortawesome/react-fontawesome": "0.2.3",
|
|
67
|
-
"@sito/dashboard": "^0.0.
|
|
67
|
+
"@sito/dashboard": "^0.0.56",
|
|
68
68
|
"@storybook/addon-a11y": "8.4.7",
|
|
69
69
|
"@storybook/addon-essentials": "8.4.7",
|
|
70
70
|
"@storybook/addon-interactions": "8.4.7",
|