@dyrected/vue 2.18.1 → 2.20.0
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/composables/useTrash.d.ts +67 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3587 -3533
- package/package.json +4 -4
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import { TrashController } from '@dyrected/admin/public';
|
|
3
|
+
import { TrashEntry } from '@dyrected/sdk';
|
|
4
|
+
export interface UseTrashOptions {
|
|
5
|
+
pageSize?: number;
|
|
6
|
+
initialSearchQuery?: string;
|
|
7
|
+
onRestore?: (restored: unknown, trashId: string) => void | Promise<void>;
|
|
8
|
+
onPurge?: (trashId: string) => void | Promise<void>;
|
|
9
|
+
onEmpty?: () => void | Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export interface VueTrashPagination {
|
|
12
|
+
page: ComputedRef<number>;
|
|
13
|
+
limit: ComputedRef<number>;
|
|
14
|
+
totalPages: ComputedRef<number>;
|
|
15
|
+
hasNextPage: ComputedRef<boolean>;
|
|
16
|
+
hasPrevPage: ComputedRef<boolean>;
|
|
17
|
+
setPage: (page: number) => Promise<void>;
|
|
18
|
+
setLimit: (limit: number) => Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export interface UseTrashResult {
|
|
21
|
+
entries: ComputedRef<TrashEntry[]>;
|
|
22
|
+
total: ComputedRef<number>;
|
|
23
|
+
isLoading: ComputedRef<boolean>;
|
|
24
|
+
error: ComputedRef<Error | null>;
|
|
25
|
+
page: ComputedRef<number>;
|
|
26
|
+
limit: ComputedRef<number>;
|
|
27
|
+
totalPages: ComputedRef<number>;
|
|
28
|
+
hasNextPage: ComputedRef<boolean>;
|
|
29
|
+
hasPrevPage: ComputedRef<boolean>;
|
|
30
|
+
searchQuery: ComputedRef<string>;
|
|
31
|
+
pagination: VueTrashPagination;
|
|
32
|
+
search: (query: string) => Promise<void>;
|
|
33
|
+
restore: (id: string, options?: {
|
|
34
|
+
overrides?: Record<string, unknown>;
|
|
35
|
+
}) => Promise<unknown>;
|
|
36
|
+
restoreMany: (ids: string[]) => Promise<{
|
|
37
|
+
restored: string[];
|
|
38
|
+
failed: unknown[];
|
|
39
|
+
count: number;
|
|
40
|
+
}>;
|
|
41
|
+
keep: (id: string, options?: {
|
|
42
|
+
purgeAt?: Date | string | number | null;
|
|
43
|
+
} | boolean) => Promise<{
|
|
44
|
+
message: string;
|
|
45
|
+
purgeAt: number | null;
|
|
46
|
+
}>;
|
|
47
|
+
purge: (id: string) => Promise<{
|
|
48
|
+
message: string;
|
|
49
|
+
}>;
|
|
50
|
+
empty: (confirm?: string) => Promise<{
|
|
51
|
+
message: string;
|
|
52
|
+
count: number;
|
|
53
|
+
}>;
|
|
54
|
+
refetch: () => Promise<void>;
|
|
55
|
+
controller: Ref<TrashController>;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Vue composable for browsing and managing trashed documents in a collection.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```vue
|
|
62
|
+
* <script setup>
|
|
63
|
+
* const { entries, total, isLoading, pagination, restore, keep, purge, empty } = useTrash("guests");
|
|
64
|
+
* </script>
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare function useTrash(collection: string | Ref<string>, options?: UseTrashOptions): UseTrashResult;
|