fui-material 2.7.2 → 2.7.4
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/f-ui-kit.es.js +79 -1331
- package/dist/f-ui-kit.es.js.map +1 -1
- package/dist/f-ui-kit.umd.js +2 -2
- package/dist/f-ui-kit.umd.js.map +1 -1
- package/dist/types/context/LibraryProvider.d.ts +1 -1
- package/dist/types/hooks/index.d.ts +3 -3
- package/dist/types/hooks/useFApiMutation/index.d.ts +1 -0
- package/dist/types/hooks/{useApiMutation/useApiMutation.d.ts → useFApiMutation/useFApiMutation.d.ts} +4 -4
- package/dist/types/hooks/useFApiQuery/index.d.ts +1 -0
- package/dist/types/hooks/{useApiQuery/useApiQuery.d.ts → useFApiQuery/useFApiQuery.d.ts} +4 -4
- package/dist/types/hooks/useFManualApiQuery/index.d.ts +1 -0
- package/dist/types/hooks/{useManualApiQuery/useManualApiQuery.d.ts → useFManualApiQuery/useFManualApiQuery.d.ts} +7 -7
- package/dist/types/material/FButtonFile/FButtonFile.d.ts +1 -1
- package/dist/types/material/FSelectSearchDb/FSelectSearchDb.d.ts +1 -1
- package/package.json +1 -1
- package/dist/types/hooks/useApiMutation/index.d.ts +0 -1
- package/dist/types/hooks/useApiQuery/index.d.ts +0 -1
- package/dist/types/hooks/useManualApiQuery/index.d.ts +0 -1
|
@@ -9,6 +9,6 @@ export interface LibraryConfig {
|
|
|
9
9
|
declare const LibraryProvider: ({ children, config }: {
|
|
10
10
|
children: ReactNode;
|
|
11
11
|
config: LibraryConfig;
|
|
12
|
-
}) => import("react
|
|
12
|
+
}) => import("react").JSX.Element;
|
|
13
13
|
export declare const useLibraryContext: () => LibraryConfig;
|
|
14
14
|
export default LibraryProvider;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as useFApi } from "./useFApi";
|
|
2
|
-
export { default as
|
|
3
|
-
export { default as
|
|
4
|
-
export { default as
|
|
2
|
+
export { default as useFApiMutation } from "./useFApiMutation";
|
|
3
|
+
export { default as useFApiQuery } from "./useFApiQuery";
|
|
4
|
+
export { default as useFManualApiQuery } from "./useFManualApiQuery";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./useFApiMutation";
|
package/dist/types/hooks/{useApiMutation/useApiMutation.d.ts → useFApiMutation/useFApiMutation.d.ts}
RENAMED
|
@@ -39,7 +39,7 @@ export type CustomMutationResult<TData, TError, TVariables, TContext> = Omit<Use
|
|
|
39
39
|
*
|
|
40
40
|
* @example
|
|
41
41
|
* // 1. Простая отправка формы (синхронная):
|
|
42
|
-
* const { mutate, isPending } =
|
|
42
|
+
* const { mutate, isPending } = useFApiMutation<IUser, ICreateUserDto>(
|
|
43
43
|
* '/api/v1/users',
|
|
44
44
|
* undefined,
|
|
45
45
|
* {
|
|
@@ -54,7 +54,7 @@ export type CustomMutationResult<TData, TError, TVariables, TContext> = Omit<Use
|
|
|
54
54
|
*
|
|
55
55
|
* @example
|
|
56
56
|
* // 2. Запрос с динамическим URL и async/await:
|
|
57
|
-
* const { mutateAsync } =
|
|
57
|
+
* const { mutateAsync } = useFApiMutation<void, IRoleDto>('/api/v1/users/:userId/roles/:roleId');
|
|
58
58
|
*
|
|
59
59
|
* const handleAssignRole = async () => {
|
|
60
60
|
* try {
|
|
@@ -65,11 +65,11 @@ export type CustomMutationResult<TData, TError, TVariables, TContext> = Omit<Use
|
|
|
65
65
|
* }
|
|
66
66
|
* };
|
|
67
67
|
*/
|
|
68
|
-
export declare const
|
|
68
|
+
export declare const useFApiMutation: <TQueryFnData, TVariables = unknown>(url: string, config?: AxiosRequestConfig, options?: Omit<UseMutationOptions<TQueryFnData, AxiosError, {
|
|
69
69
|
data?: TVariables;
|
|
70
70
|
urlParams?: Record<string, string | number>;
|
|
71
71
|
}, unknown>, "mutationFn"> & {
|
|
72
72
|
/** Ключ кэша TanStack Query, который нужно автоматически инвалидировать (обновить) при успехе */
|
|
73
73
|
queryKeyToInvalidate?: QueryKey;
|
|
74
74
|
} & ExtraOptions) => CustomMutationResult<TQueryFnData, AxiosError, TVariables, unknown>;
|
|
75
|
-
export default
|
|
75
|
+
export default useFApiMutation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./useFApiQuery";
|
|
@@ -18,21 +18,21 @@ import { ExtraOptions } from "../types";
|
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* // 1. Простой GET-запрос параметров:
|
|
21
|
-
* const { data, isLoading } =
|
|
21
|
+
* const { data, isLoading } = useFApiQuery<IUser[]>(
|
|
22
22
|
* ['users', { page: 1, limit: 10 }],
|
|
23
23
|
* '/api/v1/users'
|
|
24
24
|
* );
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
27
27
|
* // 2. POST-запрос справочника с нотификацией об ошибке:
|
|
28
|
-
* const { data, error } =
|
|
28
|
+
* const { data, error } = useFApiQuery<IDirectoryResponse>(
|
|
29
29
|
* ['dictionary', { category: 'cities' }],
|
|
30
30
|
* '/api/v1/dictionary',
|
|
31
31
|
* undefined,
|
|
32
32
|
* { method: 'POST', onErrorNotification: true }
|
|
33
33
|
* );
|
|
34
34
|
*/
|
|
35
|
-
declare const
|
|
35
|
+
declare const useFApiQuery: <TQueryFnData, TData = TQueryFnData>(queryKey: QueryKey, url: string, config?: Omit<AxiosRequestConfig, "params" | "data" | "method">, options?: Omit<UseQueryOptions<TQueryFnData, AxiosError, TData>, "queryKey" | "queryFn"> & {
|
|
36
36
|
method?: "GET" | "POST";
|
|
37
37
|
} & ExtraOptions) => UseQueryResult<TData, AxiosError>;
|
|
38
|
-
export default
|
|
38
|
+
export default useFApiQuery;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./useFManualApiQuery";
|
|
@@ -5,7 +5,7 @@ import { ExtraOptions } from "../types";
|
|
|
5
5
|
* Параметры для функции `run`, запускающей запрос вручную.
|
|
6
6
|
* @template T - Тип передаваемых параметров запроса (тело POST или GET-параметры)
|
|
7
7
|
*/
|
|
8
|
-
export interface
|
|
8
|
+
export interface IuseFManualApiQueryRun<T> {
|
|
9
9
|
/** Новые основные параметры запроса (передаются как `data` в POST или `params` в GET) */
|
|
10
10
|
newParams?: T;
|
|
11
11
|
/** Дополнительные URL-параметры (query string) */
|
|
@@ -18,9 +18,9 @@ export interface IUseManualApiQueryRun<T> {
|
|
|
18
18
|
preserveUrlParams?: boolean;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* Тип возвращаемого значения хука `
|
|
21
|
+
* Тип возвращаемого значения хука `useFManualApiQuery` с описанием функции `run` для подсказок IDE
|
|
22
22
|
*/
|
|
23
|
-
export type
|
|
23
|
+
export type useFManualApiQueryResult<TData, TVariables> = UseQueryResult<TData, AxiosError> & {
|
|
24
24
|
/**
|
|
25
25
|
* Асинхронная функция для ручного запуска HTTP-запроса.
|
|
26
26
|
* Обновляет параметры, выполняет запрос, сохраняет результат в кэш TanStack Query и возвращает его.
|
|
@@ -36,7 +36,7 @@ export type UseManualApiQueryResult<TData, TVariables> = UseQueryResult<TData, A
|
|
|
36
36
|
* // Повторный вызов с текущими параметрами:
|
|
37
37
|
* await run();
|
|
38
38
|
*/
|
|
39
|
-
run: (options?:
|
|
39
|
+
run: (options?: IuseFManualApiQueryRun<TVariables>) => Promise<TData>;
|
|
40
40
|
/** Текущие основные параметры запроса */
|
|
41
41
|
params: TVariables | undefined;
|
|
42
42
|
/** Текущие дополнительные URL-параметры (query string) */
|
|
@@ -58,8 +58,8 @@ export type UseManualApiQueryResult<TData, TVariables> = UseQueryResult<TData, A
|
|
|
58
58
|
*
|
|
59
59
|
* @returns Объект `useQuery` + функция `run` (возвращает `Promise<TData>`) и текущие параметры (`params`, `urlParams`).
|
|
60
60
|
*/
|
|
61
|
-
declare function
|
|
61
|
+
declare function useFManualApiQuery<TQueryFnData, TData = TQueryFnData, TVariables = unknown>(queryKey: string, url: string, initialParams?: TVariables, config?: Omit<AxiosRequestConfig, 'params' | 'data' | 'method'>, options?: Omit<UseQueryOptions<TQueryFnData, AxiosError, TData>, 'queryKey' | 'queryFn'> & {
|
|
62
62
|
method?: 'GET' | 'POST';
|
|
63
63
|
urlParams?: Record<string, unknown>;
|
|
64
|
-
} & ExtraOptions):
|
|
65
|
-
export default
|
|
64
|
+
} & ExtraOptions): useFManualApiQueryResult<TData, TVariables>;
|
|
65
|
+
export default useFManualApiQuery;
|
|
@@ -140,5 +140,5 @@ export interface IFButtonFile {
|
|
|
140
140
|
* @param {FlexDirectionType} [direction='row'] - Расположение файлов.
|
|
141
141
|
* @param {Function} onChange - Callback с массивом файлов.
|
|
142
142
|
*/
|
|
143
|
-
declare const FButtonFile: ({ children, variant, color, size, disabled, st, className, fullWidth, id, onChange, multiple, accept, direction, required, }: IFButtonFile) => import("react
|
|
143
|
+
declare const FButtonFile: ({ children, variant, color, size, disabled, st, className, fullWidth, id, onChange, multiple, accept, direction, required, }: IFButtonFile) => import("react").JSX.Element;
|
|
144
144
|
export default FButtonFile;
|
|
@@ -141,5 +141,5 @@ export interface IFSelectSearchDb<T> {
|
|
|
141
141
|
*
|
|
142
142
|
* @returns {JSX.Element} — Рендерит поле ввода с выпадающим списком результатов поиска.
|
|
143
143
|
*/
|
|
144
|
-
declare const FSelectSearchDb: <T>({ fetchingFunc, selectedElement, selectItem, onChange, st, id, className, disabled, readOnly, fullWidth, label, onBlur, onFocus, errText, helpText, required, defaultValue, type, placeholder, }: IFSelectSearchDb<T>) => import("react
|
|
144
|
+
declare const FSelectSearchDb: <T>({ fetchingFunc, selectedElement, selectItem, onChange, st, id, className, disabled, readOnly, fullWidth, label, onBlur, onFocus, errText, helpText, required, defaultValue, type, placeholder, }: IFSelectSearchDb<T>) => import("react").JSX.Element;
|
|
145
145
|
export default FSelectSearchDb;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./useApiMutation";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./useApiQuery";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./useManualApiQuery";
|