@kine-design/crud 0.0.1-beta.1
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/layout/KContent.d.ts +2 -0
- package/dist/components/layout/KHeader.d.ts +2 -0
- package/dist/components/layout/KLayout.d.ts +44 -0
- package/dist/components/layout/KSider.d.ts +2 -0
- package/dist/components/layout/index.d.ts +13 -0
- package/dist/components/login/KLoginPage.d.ts +43 -0
- package/dist/components/login/index.d.ts +10 -0
- package/dist/components/navMenu/KNavMenu.d.ts +27 -0
- package/dist/components/navMenu/index.d.ts +2 -0
- package/dist/components/pageHeader/KPageHeader.d.ts +49 -0
- package/dist/components/pageHeader/index.d.ts +9 -0
- package/dist/components/searchTable/KSearchTable.d.ts +99 -0
- package/dist/components/searchTable/index.d.ts +9 -0
- package/dist/components/upload/KFileList.d.ts +27 -0
- package/dist/components/upload/KImageUpload.d.ts +91 -0
- package/dist/components/upload/KUpload.d.ts +82 -0
- package/dist/components/upload/index.d.ts +12 -0
- package/dist/components/upload/types.d.ts +23 -0
- package/dist/composables/auth/authGuard.d.ts +67 -0
- package/dist/composables/auth/index.d.ts +14 -0
- package/dist/composables/auth/types.d.ts +90 -0
- package/dist/composables/auth/useAuth.d.ts +45 -0
- package/dist/composables/auth/vCan.d.ts +44 -0
- package/dist/composables/defineRepository.d.ts +25 -0
- package/dist/composables/error/createErrorHandler.d.ts +22 -0
- package/dist/composables/error/defaultFeedbackHandler.d.ts +3 -0
- package/dist/composables/error/dispatchError.d.ts +6 -0
- package/dist/composables/error/index.d.ts +13 -0
- package/dist/composables/error/types.d.ts +28 -0
- package/dist/composables/error/useErrorHandler.d.ts +26 -0
- package/dist/composables/index.d.ts +15 -0
- package/dist/composables/request/composables.d.ts +44 -0
- package/dist/composables/request/controlGate.d.ts +21 -0
- package/dist/composables/request/createRequest.d.ts +31 -0
- package/dist/composables/request/index.d.ts +23 -0
- package/dist/composables/request/orchestrator.d.ts +16 -0
- package/dist/composables/request/requestBuilder.d.ts +34 -0
- package/dist/composables/request/transport/fetchTransport.d.ts +4 -0
- package/dist/composables/request/transport/xhrTransport.d.ts +4 -0
- package/dist/composables/request/types.d.ts +166 -0
- package/dist/composables/request/upload.d.ts +17 -0
- package/dist/composables/router/createRouterGuard.d.ts +50 -0
- package/dist/composables/router/defineCrudRoutes.d.ts +26 -0
- package/dist/composables/router/index.d.ts +14 -0
- package/dist/composables/router/types.d.ts +110 -0
- package/dist/composables/router/useMenuFromRoutes.d.ts +30 -0
- package/dist/composables/router/useTabStore.d.ts +35 -0
- package/dist/composables/setupCrud.d.ts +17 -0
- package/dist/composables/storage/createStorageAdapter.d.ts +22 -0
- package/dist/composables/storage/index.d.ts +12 -0
- package/dist/composables/storage/types.d.ts +14 -0
- package/dist/composables/storage/useStorage.d.ts +17 -0
- package/dist/composables/store/defineUserStore.d.ts +62 -0
- package/dist/composables/store/index.d.ts +10 -0
- package/dist/composables/types.d.ts +68 -0
- package/dist/crud.css +1308 -0
- package/dist/crud.js +3046 -0
- package/dist/index.d.ts +29 -0
- package/dist/setup.d.ts +95 -0
- package/dist/vite.config.build.d.ts +2 -0
- package/package.json +33 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { MaybeRef } from 'vue';
|
|
2
|
+
/** 通用列表请求参数 */
|
|
3
|
+
export type ListParams = Record<string, unknown>;
|
|
4
|
+
/** 通用 ID 类型 */
|
|
5
|
+
export type EntityId = string | number;
|
|
6
|
+
export interface RepositoryEndpoints<TList, TDetail, TCreateInput, TCreateOutput, TUpdateInput, TUpdateOutput> {
|
|
7
|
+
/** 列表查询 */
|
|
8
|
+
list?: (params: ListParams) => Promise<TList>;
|
|
9
|
+
/** 单条详情查询 */
|
|
10
|
+
detail?: (id: EntityId) => Promise<TDetail>;
|
|
11
|
+
/** 创建 */
|
|
12
|
+
create?: (data: TCreateInput) => Promise<TCreateOutput>;
|
|
13
|
+
/** 更新 */
|
|
14
|
+
update?: (id: EntityId, data: TUpdateInput) => Promise<TUpdateOutput>;
|
|
15
|
+
/** 删除 */
|
|
16
|
+
remove?: (id: EntityId) => Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
/** mutation 共用选项 */
|
|
19
|
+
export interface MutationOptions {
|
|
20
|
+
/**
|
|
21
|
+
* 跨领域缓存失效声明。
|
|
22
|
+
* mutation 成功后除自身领域外,还会额外失效这些领域的所有 query。
|
|
23
|
+
*/
|
|
24
|
+
invalidates?: string[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* useList 返回值(只暴露业务层常用字段,屏蔽 TanStack 底层细节)。
|
|
28
|
+
* 需要更多字段时可在此扩展。
|
|
29
|
+
*/
|
|
30
|
+
export interface UseListReturn<TData> {
|
|
31
|
+
data: import('vue').ComputedRef<TData | undefined>;
|
|
32
|
+
isLoading: import('vue').ComputedRef<boolean>;
|
|
33
|
+
isFetching: import('vue').ComputedRef<boolean>;
|
|
34
|
+
isError: import('vue').ComputedRef<boolean>;
|
|
35
|
+
error: import('vue').ComputedRef<Error | null>;
|
|
36
|
+
refetch: () => void;
|
|
37
|
+
}
|
|
38
|
+
/** useDetail 返回值 */
|
|
39
|
+
export interface UseDetailReturn<TData> {
|
|
40
|
+
data: import('vue').ComputedRef<TData | undefined>;
|
|
41
|
+
isLoading: import('vue').ComputedRef<boolean>;
|
|
42
|
+
isFetching: import('vue').ComputedRef<boolean>;
|
|
43
|
+
isError: import('vue').ComputedRef<boolean>;
|
|
44
|
+
error: import('vue').ComputedRef<Error | null>;
|
|
45
|
+
refetch: () => void;
|
|
46
|
+
}
|
|
47
|
+
/** useMutation 返回值(create / update / remove 共用) */
|
|
48
|
+
export interface UseMutationReturn<TVariables, TData> {
|
|
49
|
+
mutate: TVariables extends void ? () => Promise<TData> : (variables: TVariables) => Promise<TData>;
|
|
50
|
+
isPending: import('vue').ComputedRef<boolean>;
|
|
51
|
+
isError: import('vue').ComputedRef<boolean>;
|
|
52
|
+
error: import('vue').ComputedRef<Error | null>;
|
|
53
|
+
}
|
|
54
|
+
export interface Repository<TList, TDetail, TCreateInput, TCreateOutput, TUpdateInput, TUpdateOutput> {
|
|
55
|
+
/** 列表 query hook */
|
|
56
|
+
useList: (params?: MaybeRef<ListParams>) => UseListReturn<TList>;
|
|
57
|
+
/** 详情 query hook */
|
|
58
|
+
useDetail: (id: MaybeRef<EntityId>) => UseDetailReturn<TDetail>;
|
|
59
|
+
/** 创建 mutation hook */
|
|
60
|
+
useCreate: (options?: MutationOptions) => UseMutationReturn<TCreateInput, TCreateOutput>;
|
|
61
|
+
/** 更新 mutation hook */
|
|
62
|
+
useUpdate: (options?: MutationOptions) => UseMutationReturn<{
|
|
63
|
+
id: EntityId;
|
|
64
|
+
data: TUpdateInput;
|
|
65
|
+
}, TUpdateOutput>;
|
|
66
|
+
/** 删除 mutation hook */
|
|
67
|
+
useRemove: (options?: MutationOptions) => UseMutationReturn<EntityId, void>;
|
|
68
|
+
}
|