@finema/core 1.4.18 → 1.4.20
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/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/composables/loaderList.d.ts +2 -1
- package/dist/runtime/composables/loaderList.mjs +3 -1
- package/dist/runtime/composables/loaderObject.d.ts +1 -1
- package/dist/runtime/composables/loaderObject.mjs +3 -1
- package/dist/runtime/composables/loaderPage.d.ts +1 -1
- package/dist/runtime/composables/loaderPage.mjs +1 -1
- package/dist/runtime/composables/useForm.d.ts +1 -1
- package/dist/runtime/composables/useTable.d.ts +4 -3
- package/dist/runtime/helpers/apiListHelper.d.ts +17 -2
- package/dist/runtime/helpers/apiObjectHelper.d.ts +38 -2
- package/dist/runtime/helpers/apiPageHelper.d.ts +86 -4
- package/dist/runtime/helpers/apiPageHelper.mjs +3 -3
- package/package.json +1 -1
- package/dist/runtime/types/loaderTypes.d.ts +0 -133
- package/dist/runtime/types/loaderTypes.mjs +0 -0
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { type IListLoaderOptions
|
|
1
|
+
import { type IListLoaderOptions } from '../helpers/apiListHelper';
|
|
2
|
+
import { type IUseListLoader } from '../helpers/apiObjectHelper';
|
|
2
3
|
export declare const useListLoader: <T = any, O = Record<string, any>>(loaderOptions: IListLoaderOptions<T, O>) => IUseListLoader<T, O>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ref } from "vue";
|
|
2
2
|
import { ObjectHelper } from "../utils/ObjectHelper.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
apiListHelper
|
|
5
|
+
} from "../helpers/apiListHelper.mjs";
|
|
4
6
|
export const useListLoader = (loaderOptions) => {
|
|
5
7
|
const status = ref(ObjectHelper.createStatus());
|
|
6
8
|
const items = ref([]);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type IObjectLoaderOptions, type IUseObjectLoader } from '../
|
|
1
|
+
import { type IObjectLoaderOptions, type IUseObjectLoader } from '../helpers/apiObjectHelper';
|
|
2
2
|
export declare const useObjectLoader: <T = any, B = any, O = Record<string, any>>(loaderOptions: IObjectLoaderOptions<T, B, O>) => IUseObjectLoader<T, B, O>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ref } from "vue";
|
|
2
2
|
import { ObjectHelper } from "../utils/ObjectHelper.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
apiObjectHelper
|
|
5
|
+
} from "../helpers/apiObjectHelper.mjs";
|
|
4
6
|
export const useObjectLoader = (loaderOptions) => {
|
|
5
7
|
const status = ref(ObjectHelper.createStatus());
|
|
6
8
|
const data = ref(null);
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
apiFetchHelper,
|
|
7
7
|
apiFindHelper,
|
|
8
8
|
updateHelper
|
|
9
|
-
} from "
|
|
9
|
+
} from "../helpers/apiPageHelper.mjs";
|
|
10
10
|
import { useCoreConfig } from "./useConfig.mjs";
|
|
11
11
|
export const initPageOptions = (options) => ({
|
|
12
12
|
currentPageCount: 0,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ComputedRef } from 'vue';
|
|
2
2
|
import { type FieldContext, type FieldOptions } from 'vee-validate';
|
|
3
|
-
import { type IFieldProps, type IFormField } from '
|
|
3
|
+
import { type IFieldProps, type IFormField } from '../components/Form/types';
|
|
4
4
|
interface IFieldContext<TValue> extends FieldContext<TValue> {
|
|
5
5
|
wrapperProps: ComputedRef<IFieldProps>;
|
|
6
6
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type ComputedRef } from 'vue';
|
|
2
2
|
import { type Store } from 'pinia';
|
|
3
|
-
import { type IStatus
|
|
4
|
-
import { type IColumn, type IRow, type ISimpleTableOptions, type ITableOptions } from '
|
|
3
|
+
import { type IStatus } from '#imports';
|
|
4
|
+
import { type IColumn, type IRow, type ISimpleTableOptions, type ITableOptions } from '../components/Table/types';
|
|
5
|
+
import { type IUsePageLoader } from '../helpers/apiPageHelper';
|
|
5
6
|
export interface IUseTable<T = object> {
|
|
6
7
|
repo: IUsePageLoader<T> | Store<any, any>;
|
|
7
8
|
columns: () => IColumn[];
|
|
@@ -15,4 +16,4 @@ export interface IUseTableSimple<T = object> {
|
|
|
15
16
|
}
|
|
16
17
|
export declare const useTable: <T = object>(options: IUseTable<T>) => ComputedRef<ITableOptions<T>>;
|
|
17
18
|
export declare const useTableSimple: <T = object>(options: IUseTableSimple<T>) => ComputedRef<ISimpleTableOptions<T>>;
|
|
18
|
-
export declare const createTableOptions: <T = object>(repo: IUsePageLoader<T>, columns: IColumn[], rows: IRow[], options: ITableOptions<T
|
|
19
|
+
export declare const createTableOptions: <T = object>(repo: IUsePageLoader<T>, columns: IColumn[], rows: IRow[], options: Partial<ITableOptions<T>>) => ITableOptions<T>;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
1
|
import { type IAPIListState, type IAPIOptions, type IStatus } from '#core/types/lib';
|
|
2
|
-
import
|
|
3
|
-
export
|
|
2
|
+
import type { AxiosRequestConfig } from 'axios';
|
|
3
|
+
export interface IListRunLoaderOptions<T, D = Record<string, any>> {
|
|
4
|
+
mockItems?: T[];
|
|
5
|
+
isMock?: boolean;
|
|
6
|
+
params?: Record<string, any>;
|
|
7
|
+
expire?: number;
|
|
8
|
+
data?: D;
|
|
9
|
+
}
|
|
10
|
+
export interface IListLoaderOptions<T, O> {
|
|
11
|
+
prefix?: string;
|
|
12
|
+
url: string;
|
|
13
|
+
primary?: string;
|
|
14
|
+
mockItems?: T[];
|
|
15
|
+
getURL?: (opts: IListRunLoaderOptions<T, O>) => string;
|
|
16
|
+
getRequestOptions?: (opts: IListRunLoaderOptions<T, O>) => AxiosRequestConfig;
|
|
17
|
+
}
|
|
18
|
+
export declare const apiListHelper: <T, O>(state: () => IAPIListState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, onUpdateItems: (data: T[]) => void, opts: IListLoaderOptions<T, O> & IListRunLoaderOptions<T, O>) => Promise<void>;
|
|
@@ -1,3 +1,39 @@
|
|
|
1
1
|
import { type IAPIObjectState, type IAPIOptions, type IStatus } from '#core/types/lib';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import type { AxiosRequestConfig, Method } from 'axios';
|
|
3
|
+
import type { Ref, UnwrapRef } from 'vue';
|
|
4
|
+
import { type IListRunLoaderOptions } from '#core/helpers/apiListHelper';
|
|
5
|
+
export interface IObjectRunLoaderOptions<T, D = Record<string, any>> {
|
|
6
|
+
mockItem?: T;
|
|
7
|
+
isMock?: boolean;
|
|
8
|
+
params?: Record<string, any>;
|
|
9
|
+
expire?: number;
|
|
10
|
+
data?: D;
|
|
11
|
+
}
|
|
12
|
+
export interface IObjectLoaderOptions<T, B, O> {
|
|
13
|
+
prefix?: string;
|
|
14
|
+
url: string;
|
|
15
|
+
method: Method;
|
|
16
|
+
primary?: string;
|
|
17
|
+
mockItem?: T;
|
|
18
|
+
getURL?: (data: B | undefined, opts: IObjectRunLoaderOptions<T, O>) => string;
|
|
19
|
+
getRequestOptions?: (data: B | undefined, opts: IObjectRunLoaderOptions<T, O>) => AxiosRequestConfig;
|
|
20
|
+
}
|
|
21
|
+
export interface IUseObjectLoader<T, B, O> {
|
|
22
|
+
status: Ref<IStatus>;
|
|
23
|
+
data: Ref<UnwrapRef<T | null>>;
|
|
24
|
+
options: Ref<IAPIOptions>;
|
|
25
|
+
run: (data?: B, opts?: IObjectRunLoaderOptions<T, O>) => Promise<void>;
|
|
26
|
+
clear: () => void;
|
|
27
|
+
setLoading: () => void;
|
|
28
|
+
setData: (data: T | null) => void;
|
|
29
|
+
}
|
|
30
|
+
export interface IUseListLoader<T, O> {
|
|
31
|
+
status: Ref<IStatus>;
|
|
32
|
+
items: Ref<UnwrapRef<T[]>>;
|
|
33
|
+
options: Ref<Record<string, any>>;
|
|
34
|
+
run: (opts?: IListRunLoaderOptions<T, O>) => void;
|
|
35
|
+
setItems: (items: T[]) => void;
|
|
36
|
+
clear: () => void;
|
|
37
|
+
setLoading: () => void;
|
|
38
|
+
}
|
|
39
|
+
export declare const apiObjectHelper: <T, B, O>(state: () => IAPIObjectState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, onUpdateData: (data: any) => void, data: B | undefined, opts: IObjectLoaderOptions<T, B, O> & IObjectRunLoaderOptions<T, O>) => Promise<void>;
|
|
@@ -1,7 +1,89 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import
|
|
1
|
+
import { type IAPIAddState, type IAPIDeleteState, type IAPIFetchState, type IAPIFindState, type IAPIOptions, type IAPIUpdateState, type IPageOptions, type IStatus } from '../types/lib';
|
|
2
|
+
import type { AxiosRequestConfig } from 'axios';
|
|
3
|
+
import type { Ref, UnwrapRef } from 'vue';
|
|
4
|
+
export interface IPageFetchLoaderOptions<D = Record<string, any>> {
|
|
5
|
+
isMock?: boolean;
|
|
6
|
+
params?: Record<string, any>;
|
|
7
|
+
expire?: number;
|
|
8
|
+
data?: D;
|
|
9
|
+
}
|
|
10
|
+
export interface IPageFindLoaderOptions<D = Record<string, any>> {
|
|
11
|
+
isMock?: boolean;
|
|
12
|
+
params?: Record<string, any>;
|
|
13
|
+
expire?: number;
|
|
14
|
+
data?: D;
|
|
15
|
+
}
|
|
16
|
+
export interface IPageUpdateLoaderOptions<D = Record<string, any>> {
|
|
17
|
+
isMock?: boolean;
|
|
18
|
+
params?: Record<string, any>;
|
|
19
|
+
data?: D;
|
|
20
|
+
}
|
|
21
|
+
export interface IPageDeleteLoaderOptions<D = Record<string, any>> {
|
|
22
|
+
isMock?: boolean;
|
|
23
|
+
params?: Record<string, any>;
|
|
24
|
+
data?: D;
|
|
25
|
+
}
|
|
26
|
+
export interface IPageAddLoaderOptions<D = Record<string, any>> {
|
|
27
|
+
isMock?: boolean;
|
|
28
|
+
params?: Record<string, any>;
|
|
29
|
+
data?: D;
|
|
30
|
+
}
|
|
31
|
+
export interface IPageLoaderOptions<T> {
|
|
32
|
+
prefix?: string;
|
|
33
|
+
baseURL: string;
|
|
34
|
+
primary?: string;
|
|
35
|
+
isMock?: boolean;
|
|
36
|
+
mockItems?: T[];
|
|
37
|
+
getBaseRequestOptions?: () => AxiosRequestConfig;
|
|
38
|
+
fetch?: {
|
|
39
|
+
getURL?: (page: number, query: string, opts: IPageFetchLoaderOptions<any>) => string;
|
|
40
|
+
getRequestOptions?: (page: number, query: string, opts: IPageFetchLoaderOptions<any>) => AxiosRequestConfig;
|
|
41
|
+
};
|
|
42
|
+
find?: {
|
|
43
|
+
getURL?: (id: string | number, opts: IPageFindLoaderOptions<any>) => string;
|
|
44
|
+
getRequestOptions?: (id: string | number, opts: IPageFindLoaderOptions<any>) => AxiosRequestConfig;
|
|
45
|
+
};
|
|
46
|
+
update?: {
|
|
47
|
+
getURL?: (id: string | number, data: any, opts: IPageUpdateLoaderOptions<any>) => string;
|
|
48
|
+
getRequestOptions?: (id: string | number, data: any, opts: IPageUpdateLoaderOptions<any>) => AxiosRequestConfig;
|
|
49
|
+
};
|
|
50
|
+
delete?: {
|
|
51
|
+
getURL?: (id: string | number, opts: IPageDeleteLoaderOptions<any>) => string;
|
|
52
|
+
getRequestOptions?: (id: string | number, opts: IPageDeleteLoaderOptions<any>) => AxiosRequestConfig;
|
|
53
|
+
};
|
|
54
|
+
add?: {
|
|
55
|
+
getURL?: (data: any, opts: IPageAddLoaderOptions<any>) => string;
|
|
56
|
+
getRequestOptions?: (data: any, opts: IPageAddLoaderOptions<any>) => AxiosRequestConfig;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export interface IUsePageLoader<T> {
|
|
60
|
+
fetchStatus: Ref<IStatus>;
|
|
61
|
+
findStatus: Ref<IStatus>;
|
|
62
|
+
addStatus: Ref<IStatus>;
|
|
63
|
+
updateStatus: Ref<IStatus>;
|
|
64
|
+
deleteStatus: Ref<IStatus>;
|
|
65
|
+
fetchOptions: Ref<IPageOptions>;
|
|
66
|
+
deleteOptions: Ref<IAPIOptions>;
|
|
67
|
+
addOptions: Ref<IAPIOptions>;
|
|
68
|
+
findOptions: Ref<IAPIOptions>;
|
|
69
|
+
updateOptions: Ref<IAPIOptions>;
|
|
70
|
+
clear: () => void;
|
|
71
|
+
fetch: (page?: number, query?: string, opts?: IPageFetchLoaderOptions) => Promise<void>;
|
|
72
|
+
search: (query: string, opts?: IPageFetchLoaderOptions) => Promise<void>;
|
|
73
|
+
find: (id: string, opts?: any) => Promise<void>;
|
|
74
|
+
update: (id: string, data: any, opts?: any) => Promise<void>;
|
|
75
|
+
add: (data: any, opts?: IPageAddLoaderOptions) => Promise<void>;
|
|
76
|
+
remove: (id: string, opts?: IPageDeleteLoaderOptions) => Promise<void>;
|
|
77
|
+
setFetchLoading: () => void;
|
|
78
|
+
setFindLoading: () => void;
|
|
79
|
+
fetchItems: Ref<UnwrapRef<T[]>>;
|
|
80
|
+
findItem: Ref<UnwrapRef<T | null>>;
|
|
81
|
+
deleteItem: Ref<UnwrapRef<T | null>>;
|
|
82
|
+
addItem: Ref<UnwrapRef<T | null>>;
|
|
83
|
+
updateItem: Ref<UnwrapRef<T | null>>;
|
|
84
|
+
}
|
|
3
85
|
export declare const apiAddHelper: <T>(state: () => IAPIAddState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, onUpdateData: (data: any) => void, onUpdateItems: (data: any[]) => void, data: any, opts: IPageLoaderOptions<any> & IPageFetchLoaderOptions) => Promise<void>;
|
|
4
86
|
export declare const apiDeleteHelper: <T>(state: () => IAPIDeleteState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, _onUpdateData: (data: T) => void, onUpdateItems: (data: T[]) => void, id: string | number, opts: IPageLoaderOptions<any> & IPageDeleteLoaderOptions) => Promise<void>;
|
|
5
|
-
export declare const apiFetchHelper: <T>(state: () => IAPIFetchState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IPageOptions) => void, onUpdateItems: (items: T[]) => void, page: number, query: string, opts: any) => Promise<void>;
|
|
6
|
-
export declare const apiFindHelper: <T>(state: () => IAPIFindState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, onUpdateData: (data: any) => void, id: string | number, opts: any) => Promise<void>;
|
|
87
|
+
export declare const apiFetchHelper: <T>(state: () => IAPIFetchState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IPageOptions) => void, onUpdateItems: (items: T[]) => void, page: number, query: string, opts: IPageLoaderOptions<T> & IPageFetchLoaderOptions<any>) => Promise<void>;
|
|
88
|
+
export declare const apiFindHelper: <T>(state: () => IAPIFindState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, onUpdateData: (data: any) => void, id: string | number, opts: IPageLoaderOptions<T> & IPageFindLoaderOptions<Record<string, any>>) => Promise<void>;
|
|
7
89
|
export declare const updateHelper: <T>(state: () => IAPIUpdateState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, onUpdateData: (data: T) => void, _onUpdateItems: (data: T[]) => void, onUpdateOldData: (data: T) => void, id: string | number, data: any, opts: IPageLoaderOptions<any> & IPageUpdateLoaderOptions) => Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ObjectHelper } from "../utils/ObjectHelper.mjs";
|
|
2
|
-
import { ParamHelper } from "
|
|
3
|
-
import { NewRequester } from "
|
|
4
|
-
import { _findIndex, _get, _shuffle } from "
|
|
2
|
+
import { ParamHelper } from "../utils/ParamHelper.mjs";
|
|
3
|
+
import { NewRequester } from "../lib/Requester.mjs";
|
|
4
|
+
import { _findIndex, _get, _shuffle } from "../utils/lodash.mjs";
|
|
5
5
|
import { useCoreConfig } from "../composables/useConfig.mjs";
|
|
6
6
|
export const apiAddHelper = async (state, onUpdateStatus, onUpdateOptions, onUpdateData, onUpdateItems, data, opts) => {
|
|
7
7
|
onUpdateStatus(ObjectHelper.toLoadingStatus(state().status));
|
package/package.json
CHANGED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { type AxiosRequestConfig, type Method } from 'axios';
|
|
2
|
-
import { type Ref, type UnwrapRef } from 'vue';
|
|
3
|
-
import { type IAPIOptions, type IPageOptions, type IStatus } from '~/src/runtime/types/lib';
|
|
4
|
-
export interface IPageFetchLoaderOptions<D = Record<string, any>> {
|
|
5
|
-
isMock?: boolean;
|
|
6
|
-
params?: Record<string, any>;
|
|
7
|
-
expire?: number;
|
|
8
|
-
data?: D;
|
|
9
|
-
}
|
|
10
|
-
export interface IPageFindLoaderOptions<D = Record<string, any>> {
|
|
11
|
-
isMock?: boolean;
|
|
12
|
-
params?: Record<string, any>;
|
|
13
|
-
expire?: number;
|
|
14
|
-
data?: D;
|
|
15
|
-
}
|
|
16
|
-
export interface IPageUpdateLoaderOptions<D = Record<string, any>> {
|
|
17
|
-
isMock?: boolean;
|
|
18
|
-
params?: Record<string, any>;
|
|
19
|
-
data?: D;
|
|
20
|
-
}
|
|
21
|
-
export interface IPageDeleteLoaderOptions<D = Record<string, any>> {
|
|
22
|
-
isMock?: boolean;
|
|
23
|
-
params?: Record<string, any>;
|
|
24
|
-
data?: D;
|
|
25
|
-
}
|
|
26
|
-
export interface IPageAddLoaderOptions<D = Record<string, any>> {
|
|
27
|
-
isMock?: boolean;
|
|
28
|
-
params?: Record<string, any>;
|
|
29
|
-
data?: D;
|
|
30
|
-
}
|
|
31
|
-
export interface IObjectRunLoaderOptions<T, D = Record<string, any>> {
|
|
32
|
-
mockItem?: T;
|
|
33
|
-
isMock?: boolean;
|
|
34
|
-
params?: Record<string, any>;
|
|
35
|
-
expire?: number;
|
|
36
|
-
data?: D;
|
|
37
|
-
}
|
|
38
|
-
export interface IListRunLoaderOptions<T, D = Record<string, any>> {
|
|
39
|
-
mockItems?: T[];
|
|
40
|
-
isMock?: boolean;
|
|
41
|
-
params?: Record<string, any>;
|
|
42
|
-
expire?: number;
|
|
43
|
-
data?: D;
|
|
44
|
-
}
|
|
45
|
-
export interface IPageLoaderOptions<T> {
|
|
46
|
-
prefix?: string;
|
|
47
|
-
baseURL: string;
|
|
48
|
-
primary?: string;
|
|
49
|
-
isMock?: boolean;
|
|
50
|
-
mockItems?: T[];
|
|
51
|
-
getBaseRequestOptions?: () => AxiosRequestConfig;
|
|
52
|
-
fetch?: {
|
|
53
|
-
getURL?: (page: number, query: string, opts: IPageFetchLoaderOptions<any>) => string;
|
|
54
|
-
getRequestOptions?: (page: number, query: string, opts: IPageFetchLoaderOptions<any>) => AxiosRequestConfig;
|
|
55
|
-
};
|
|
56
|
-
find?: {
|
|
57
|
-
getURL?: (id: string | number, opts: IPageFindLoaderOptions<any>) => string;
|
|
58
|
-
getRequestOptions?: (id: string | number, opts: IPageFindLoaderOptions<any>) => AxiosRequestConfig;
|
|
59
|
-
};
|
|
60
|
-
update?: {
|
|
61
|
-
getURL?: (id: string | number, data: any, opts: IPageUpdateLoaderOptions<any>) => string;
|
|
62
|
-
getRequestOptions?: (id: string | number, data: any, opts: IPageUpdateLoaderOptions<any>) => AxiosRequestConfig;
|
|
63
|
-
};
|
|
64
|
-
delete?: {
|
|
65
|
-
getURL?: (id: string | number, opts: IPageDeleteLoaderOptions<any>) => string;
|
|
66
|
-
getRequestOptions?: (id: string | number, opts: IPageDeleteLoaderOptions<any>) => AxiosRequestConfig;
|
|
67
|
-
};
|
|
68
|
-
add?: {
|
|
69
|
-
getURL?: (data: any, opts: IPageAddLoaderOptions<any>) => string;
|
|
70
|
-
getRequestOptions?: (data: any, opts: IPageAddLoaderOptions<any>) => AxiosRequestConfig;
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
export interface IObjectLoaderOptions<T, B, O> {
|
|
74
|
-
prefix?: string;
|
|
75
|
-
url: string;
|
|
76
|
-
method: Method;
|
|
77
|
-
primary?: string;
|
|
78
|
-
mockItem?: T;
|
|
79
|
-
getURL?: (data: B | undefined, opts: IObjectRunLoaderOptions<T, O>) => string;
|
|
80
|
-
getRequestOptions?: (data: B | undefined, opts: IObjectRunLoaderOptions<T, O>) => AxiosRequestConfig;
|
|
81
|
-
}
|
|
82
|
-
export interface IListLoaderOptions<T, O> {
|
|
83
|
-
prefix?: string;
|
|
84
|
-
url: string;
|
|
85
|
-
primary?: string;
|
|
86
|
-
mockItems?: T[];
|
|
87
|
-
getURL?: (opts: IListRunLoaderOptions<T, O>) => string;
|
|
88
|
-
getRequestOptions?: (opts: IListRunLoaderOptions<T, O>) => AxiosRequestConfig;
|
|
89
|
-
}
|
|
90
|
-
export interface IUsePageLoader<T> {
|
|
91
|
-
fetchStatus: Ref<IStatus>;
|
|
92
|
-
findStatus: Ref<IStatus>;
|
|
93
|
-
addStatus: Ref<IStatus>;
|
|
94
|
-
updateStatus: Ref<IStatus>;
|
|
95
|
-
deleteStatus: Ref<IStatus>;
|
|
96
|
-
fetchOptions: Ref<IPageOptions>;
|
|
97
|
-
deleteOptions: Ref<IAPIOptions>;
|
|
98
|
-
addOptions: Ref<IAPIOptions>;
|
|
99
|
-
findOptions: Ref<IAPIOptions>;
|
|
100
|
-
updateOptions: Ref<IAPIOptions>;
|
|
101
|
-
clear: () => void;
|
|
102
|
-
fetch: (page?: number, query?: string, opts?: IPageFetchLoaderOptions) => Promise<void>;
|
|
103
|
-
search: (query: string, opts?: IPageFetchLoaderOptions) => Promise<void>;
|
|
104
|
-
find: (id: string, opts?: any) => Promise<void>;
|
|
105
|
-
update: (id: string, data: any, opts?: any) => Promise<void>;
|
|
106
|
-
add: (data: any, opts?: IPageAddLoaderOptions) => Promise<void>;
|
|
107
|
-
remove: (id: string, opts?: IPageDeleteLoaderOptions) => Promise<void>;
|
|
108
|
-
setFetchLoading: () => void;
|
|
109
|
-
setFindLoading: () => void;
|
|
110
|
-
fetchItems: Ref<UnwrapRef<T[]>>;
|
|
111
|
-
findItem: Ref<UnwrapRef<T | null>>;
|
|
112
|
-
deleteItem: Ref<UnwrapRef<T | null>>;
|
|
113
|
-
addItem: Ref<UnwrapRef<T | null>>;
|
|
114
|
-
updateItem: Ref<UnwrapRef<T | null>>;
|
|
115
|
-
}
|
|
116
|
-
export interface IUseObjectLoader<T, B, O> {
|
|
117
|
-
status: Ref<IStatus>;
|
|
118
|
-
data: Ref<UnwrapRef<T | null>>;
|
|
119
|
-
options: Ref<IAPIOptions>;
|
|
120
|
-
run: (data?: B, opts?: IObjectRunLoaderOptions<T, O>) => Promise<void>;
|
|
121
|
-
clear: () => void;
|
|
122
|
-
setLoading: () => void;
|
|
123
|
-
setData: (data: T | null) => void;
|
|
124
|
-
}
|
|
125
|
-
export interface IUseListLoader<T, O> {
|
|
126
|
-
status: Ref<IStatus>;
|
|
127
|
-
items: Ref<UnwrapRef<T[]>>;
|
|
128
|
-
options: Ref<Record<string, any>>;
|
|
129
|
-
run: (opts?: IListRunLoaderOptions<T, O>) => void;
|
|
130
|
-
setItems: (items: T[]) => void;
|
|
131
|
-
clear: () => void;
|
|
132
|
-
setLoading: () => void;
|
|
133
|
-
}
|
|
File without changes
|