zy-react-library 2.2.3 → 2.2.4

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.
@@ -1,16 +1,45 @@
1
- interface UseDownloadBlobOptions {
2
- /** 下载文件的自定义文件名(不含后缀),默认为当前时间戳 */
3
- name?: string;
4
- /** Blob 对象的 MIME 类型,默认为 Excel 类型 */
5
- type?: string;
6
- /** 请求时携带的查询参数对象 */
7
- params?: Record<string, any>;
8
- }
9
-
10
- export type DownloadBlobFunction = (url: string, options?: UseDownloadBlobOptions) => Promise<{ data: Blob }>;
11
-
12
- /**
13
- * 下载Blob流文件
14
- */
15
- export default function useDownloadBlob(returnType: "array"): [boolean, DownloadBlobFunction];
16
- export default function useDownloadBlob(returnType?: "object"): { loading: boolean; downloadBlob: DownloadBlobFunction };
1
+ /** 常见下载文件 MIME 类型,同时允许传入其他合法 MIME 字符串 */
2
+ export type DownloadBlobMimeType
3
+ = | "application/pdf"
4
+ | "application/msword"
5
+ | "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
6
+ | "application/vnd.ms-excel"
7
+ | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
8
+ | "application/vnd.ms-powerpoint"
9
+ | "application/vnd.openxmlformats-officedocument.presentationml.presentation"
10
+ | "text/csv"
11
+ | "text/plain"
12
+ | "application/json"
13
+ | "application/zip"
14
+ | "application/x-rar-compressed"
15
+ | "application/x-7z-compressed"
16
+ | "application/gzip"
17
+ | "image/jpeg"
18
+ | "image/png"
19
+ | "image/gif"
20
+ | "image/webp"
21
+ | "image/svg+xml"
22
+ | "image/bmp"
23
+ | "audio/mpeg"
24
+ | "audio/wav"
25
+ | "video/mp4"
26
+ | "video/webm"
27
+ | "application/octet-stream"
28
+ | (string & {});
29
+
30
+ interface UseDownloadBlobOptions {
31
+ /** 下载文件的自定义文件名(不含后缀),默认为当前时间戳 */
32
+ name?: string;
33
+ /** Blob 对象的 MIME 类型,默认为 application/vnd.ms-excel 类型 */
34
+ type?: DownloadBlobMimeType;
35
+ /** 请求时携带的查询参数对象 */
36
+ params?: Record<string, any>;
37
+ }
38
+
39
+ export type DownloadBlobFunction = (url: string, options?: UseDownloadBlobOptions) => Promise<{ data: Blob }>;
40
+
41
+ /**
42
+ * 下载Blob流文件
43
+ */
44
+ export default function useDownloadBlob(returnType: "array"): [boolean, DownloadBlobFunction];
45
+ export default function useDownloadBlob(returnType?: "object"): { loading: boolean; downloadBlob: DownloadBlobFunction };
@@ -1,6 +1,18 @@
1
1
  export type SetUrlCriteriaQueryFunction = (searchForm: Record<string, any>, pagination: Record<string, any>) => void;
2
2
 
3
- export type GetUrlCriteriaQueryFunction = (keysStr: "searchFormKeys" | "paginationKeys" | string, valuesStr: "searchFormValues" | "paginationValues" | string) => Record<string, any>;
3
+ /** URL 中存储字段名列表的参数名,同时允许传入自定义参数名 */
4
+ export type UrlCriteriaKeysKey
5
+ = | "searchFormKeys"
6
+ | "paginationKeys"
7
+ | (string & {});
8
+
9
+ /** URL 中存储字段值列表的参数名,同时允许传入自定义参数名 */
10
+ export type UrlCriteriaValuesKey
11
+ = | "searchFormValues"
12
+ | "paginationValues"
13
+ | (string & {});
14
+
15
+ export type GetUrlCriteriaQueryFunction = (keysStr: UrlCriteriaKeysKey, valuesStr: UrlCriteriaValuesKey) => Record<string, any>;
4
16
 
5
17
  /**
6
18
  * 处理搜索条件缓存到 URL
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zy-react-library",
3
3
  "private": false,
4
- "version": "2.2.3",
4
+ "version": "2.2.4",
5
5
  "type": "module",
6
6
  "description": "",
7
7
  "author": "LiuJiaNan",