@vuetkit/core 0.0.4 → 0.0.6
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/README.md +4 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +22 -2
- package/package.json +2 -2
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -21,4 +21,12 @@ interface RequestReturn<T> {
|
|
|
21
21
|
type RequestService = (params?: any) => Promise<unknown>;
|
|
22
22
|
declare function useRequest<T>(service: RequestService, options?: RequestOptions<T>): RequestReturn<T>;
|
|
23
23
|
//#endregion
|
|
24
|
-
|
|
24
|
+
//#region src/file/useAsyncDownloadFile/index.d.ts
|
|
25
|
+
declare function useAsyncDownloadFile(downloadService: RequestService, fileName: string): {
|
|
26
|
+
downloadColumns: import("vue").Ref<number[], number[]>;
|
|
27
|
+
changeDownloadColumns: (ids: number[]) => void;
|
|
28
|
+
executeDownload: (params?: any) => void;
|
|
29
|
+
loading: import("vue").Ref<boolean, boolean>;
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { RequestOptions, RequestReturn, RequestService, useAsyncDownloadFile, useRequest };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { realObj } from "@vuetkit/shared";
|
|
1
|
+
import { downloadFile, realObj } from "@vuetkit/shared";
|
|
2
2
|
import { onMounted, onUnmounted, ref, shallowRef, toValue } from "vue";
|
|
3
3
|
//#region src/network/useRequest/index.ts
|
|
4
4
|
function useRequest(service, options) {
|
|
@@ -91,4 +91,24 @@ function useRequest(service, options) {
|
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
93
|
//#endregion
|
|
94
|
-
|
|
94
|
+
//#region src/file/useAsyncDownloadFile/index.ts
|
|
95
|
+
function useAsyncDownloadFile(downloadService, fileName) {
|
|
96
|
+
const downloadColumns = ref([]);
|
|
97
|
+
const changeDownloadColumns = (ids) => {
|
|
98
|
+
downloadColumns.value = ids;
|
|
99
|
+
};
|
|
100
|
+
const { loading, execute: executeDownload } = useRequest(downloadService, {
|
|
101
|
+
manual: true,
|
|
102
|
+
onSuccess: (data) => {
|
|
103
|
+
downloadFile(data, fileName);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
return {
|
|
107
|
+
downloadColumns,
|
|
108
|
+
changeDownloadColumns,
|
|
109
|
+
executeDownload,
|
|
110
|
+
loading
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { useAsyncDownloadFile, useRequest };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuetkit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.6",
|
|
5
5
|
"description": "Collection of business development hooks for Vue3 projects",
|
|
6
6
|
"author": "Kalu5",
|
|
7
7
|
"license": "MIT",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"vue": "^3.5.35"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@vuetkit/shared": "0.0.
|
|
23
|
+
"@vuetkit/shared": "0.0.6"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "tsdown --config-loader tsx"
|