@yysports/tools 0.1.8 → 0.1.9
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/Utils/file.d.ts +1 -1
- package/dist/Utils/file.js +3 -2
- package/lib/Utils/file.d.ts +1 -1
- package/lib/Utils/file.js +2 -2
- package/package.json +9 -9
package/dist/Utils/file.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { compressAccuratelyConfig } from 'image-conversion';
|
|
2
|
-
export declare const downloadFile: (href: string, fileName?: string) => void;
|
|
2
|
+
export declare const downloadFile: (href: string, fileName?: string, target?: '_blank' | '_self' | '_parent' | '_top') => void;
|
|
3
3
|
export declare const compressImg: (file: Blob, config?: number | compressAccuratelyConfig | undefined) => Promise<Blob>;
|
|
4
4
|
/**
|
|
5
5
|
* 检查文件类型
|
package/dist/Utils/file.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { compressAccurately } from 'image-conversion';
|
|
2
2
|
export var downloadFile = function downloadFile(href, fileName) {
|
|
3
|
+
var target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '_blank';
|
|
3
4
|
var aEle = document.createElement('a');
|
|
4
|
-
aEle.target =
|
|
5
|
+
aEle.target = target;
|
|
5
6
|
aEle.href = href;
|
|
6
7
|
aEle.download = fileName || '';
|
|
7
8
|
aEle.click();
|
|
@@ -15,7 +16,7 @@ export var compressImg = function compressImg(file, config) {
|
|
|
15
16
|
* 检查文件类型
|
|
16
17
|
* @param file File 文件对象
|
|
17
18
|
* @param accept string 文件类型,使用“,”分割,如:image/png,image/jpeg
|
|
18
|
-
* @returns
|
|
19
|
+
* @returns
|
|
19
20
|
*/
|
|
20
21
|
export var checkFileType = function checkFileType(file, accept) {
|
|
21
22
|
if (accept) {
|
package/lib/Utils/file.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { compressAccuratelyConfig } from 'image-conversion';
|
|
2
|
-
export declare const downloadFile: (href: string, fileName?: string) => void;
|
|
2
|
+
export declare const downloadFile: (href: string, fileName?: string, target?: '_blank' | '_self' | '_parent' | '_top') => void;
|
|
3
3
|
export declare const compressImg: (file: Blob, config?: number | compressAccuratelyConfig | undefined) => Promise<Blob>;
|
|
4
4
|
/**
|
|
5
5
|
* 检查文件类型
|
package/lib/Utils/file.js
CHANGED
|
@@ -25,9 +25,9 @@ __export(file_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(file_exports);
|
|
27
27
|
var import_image_conversion = require("image-conversion");
|
|
28
|
-
var downloadFile = (href, fileName) => {
|
|
28
|
+
var downloadFile = (href, fileName, target = "_blank") => {
|
|
29
29
|
const aEle = document.createElement("a");
|
|
30
|
-
aEle.target =
|
|
30
|
+
aEle.target = target;
|
|
31
31
|
aEle.href = href;
|
|
32
32
|
aEle.download = fileName || "";
|
|
33
33
|
aEle.click();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yysports/tools",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "常用工具函数库",
|
|
5
5
|
"homepage": "https://git.pousheng.com/sport-service-department/pousheng-guard/yysports_tools#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -64,25 +64,25 @@
|
|
|
64
64
|
"pako": "^2.1.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@ant-design/pro-components": "^2.7.
|
|
67
|
+
"@ant-design/pro-components": "^2.7.14",
|
|
68
68
|
"@commitlint/cli": "^19.3.0",
|
|
69
69
|
"@commitlint/config-conventional": "^19.2.2",
|
|
70
70
|
"@types/pako": "^2.0.3",
|
|
71
71
|
"@types/react": "^18.3.3",
|
|
72
72
|
"@types/react-dom": "^18.3.0",
|
|
73
|
-
"@umijs/lint": "^4.3.
|
|
74
|
-
"antd": "^5.19.
|
|
75
|
-
"dumi": "^2.4.
|
|
76
|
-
"eslint": "^9.
|
|
77
|
-
"father": "^4.4.
|
|
78
|
-
"husky": "^9.
|
|
73
|
+
"@umijs/lint": "^4.3.11",
|
|
74
|
+
"antd": "^5.19.4",
|
|
75
|
+
"dumi": "^2.4.7",
|
|
76
|
+
"eslint": "^9.8.0",
|
|
77
|
+
"father": "^4.4.6",
|
|
78
|
+
"husky": "^9.1.4",
|
|
79
79
|
"lint-staged": "^15.2.7",
|
|
80
80
|
"prettier": "^3.3.3",
|
|
81
81
|
"prettier-plugin-organize-imports": "^3.2.4",
|
|
82
82
|
"prettier-plugin-packagejson": "^2.5.1",
|
|
83
83
|
"react": "^18.3.1",
|
|
84
84
|
"react-dom": "^18.3.1",
|
|
85
|
-
"stylelint": "^16.
|
|
85
|
+
"stylelint": "^16.8.1"
|
|
86
86
|
},
|
|
87
87
|
"publishConfig": {
|
|
88
88
|
"access": "public"
|