@vuetkit/core 0.0.12 → 0.0.13

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/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { Ref } from "vue";
2
2
 
3
3
  //#region src/network/useRequest/index.d.ts
4
- interface RequestOptions<T> {
4
+ interface RequestOptions<T, U> {
5
5
  manual?: boolean;
6
6
  defaultParams?: any;
7
7
  initialData?: T;
8
8
  delayLoadingTime?: number;
9
- formatData?: (data: unknown) => T;
9
+ formatData?: (data: U) => T;
10
10
  onSuccess?: (data: T) => void;
11
11
  onError?: (error: any) => void;
12
12
  onFinally?: () => void;
@@ -18,11 +18,16 @@ interface RequestReturn<T> {
18
18
  execute: (params?: any) => void;
19
19
  cancel: () => void;
20
20
  }
21
- type RequestService = (params?: any) => Promise<unknown>;
22
- declare function useRequest<T>(service: RequestService, options?: RequestOptions<T>): RequestReturn<T>;
21
+ type RequestService<U> = (params?: any) => Promise<U>;
22
+ /**
23
+ * useRequest
24
+ * @description T is the type returned by the request interface or the type returned by formatData.
25
+ * @description U is the type returned by the request interface. default is T.
26
+ */
27
+ declare function useRequest<T, U = T>(service: RequestService<U>, options?: RequestOptions<T, U>): RequestReturn<T>;
23
28
  //#endregion
24
29
  //#region src/file/useAsyncDownloadFile/index.d.ts
25
- declare function useAsyncDownloadFile(downloadService: RequestService, fileName: string): {
30
+ declare function useAsyncDownloadFile<T extends Blob>(downloadService: RequestService<T>, fileName: string): {
26
31
  downloadColumns: import("vue").Ref<number[], number[]>;
27
32
  changeDownloadColumns: (ids: number[]) => void;
28
33
  executeDownload: (params?: any) => void;
package/dist/index.js CHANGED
@@ -1,6 +1,11 @@
1
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
+ /**
5
+ * useRequest
6
+ * @description T is the type returned by the request interface or the type returned by formatData.
7
+ * @description U is the type returned by the request interface. default is T.
8
+ */
4
9
  function useRequest(service, options) {
5
10
  const { initialData = null, manual, defaultParams, delayLoadingTime = 300, formatData, onSuccess, onError, onFinally } = options || {};
6
11
  const loading = ref(false);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vuetkit/core",
3
3
  "type": "module",
4
- "version": "0.0.12",
4
+ "version": "0.0.13",
5
5
  "description": "Collection of business development Composables 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.12"
23
+ "@vuetkit/shared": "0.0.13"
24
24
  },
25
25
  "scripts": {
26
26
  "build": "tsdown --config-loader tsx"