@finema/core 1.4.37 → 1.4.38
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/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { type OptionalParams } from 'js-file-downloader';
|
|
1
2
|
export declare class FileHelper {
|
|
2
3
|
static toBase64: (file: File) => Promise<string>;
|
|
3
4
|
static readFileAsync: (file: File) => Promise<string>;
|
|
4
5
|
static dataURLtoFile: (dataUrl: string, filename: string) => Promise<File>;
|
|
6
|
+
static downloadURL: (url: string, filename?: string, params?: OptionalParams) => Promise<any>;
|
|
7
|
+
static downloadFromURL: (url: string, filename?: string, params?: OptionalParams) => Promise<any>;
|
|
5
8
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import JsFileDownloader from "js-file-downloader";
|
|
1
2
|
export class FileHelper {
|
|
2
3
|
static toBase64 = async (file) => {
|
|
3
4
|
return new Promise((resolve, reject) => {
|
|
@@ -26,4 +27,32 @@ export class FileHelper {
|
|
|
26
27
|
const blob = await res.blob();
|
|
27
28
|
return new File([blob], filename, { type: "image/png" });
|
|
28
29
|
};
|
|
30
|
+
static downloadURL = async (url, filename = "", params = {}) => {
|
|
31
|
+
const getExtension = () => {
|
|
32
|
+
return url.split("?")[0].split(".").pop();
|
|
33
|
+
};
|
|
34
|
+
let finalFilename = filename && `${filename.trim().toLowerCase().replaceAll(" ", "-")}`;
|
|
35
|
+
if (getExtension()) {
|
|
36
|
+
finalFilename = `${finalFilename}.${getExtension()}`;
|
|
37
|
+
}
|
|
38
|
+
return new JsFileDownloader({
|
|
39
|
+
url,
|
|
40
|
+
filename: finalFilename,
|
|
41
|
+
...params
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
static downloadFromURL = async (url, filename = "", params = {}) => {
|
|
45
|
+
const getExtension = () => {
|
|
46
|
+
return url.split("?")[0].split(".").pop();
|
|
47
|
+
};
|
|
48
|
+
let finalFilename = filename && `${filename.trim().toLowerCase().replaceAll(" ", "-")}`;
|
|
49
|
+
if (getExtension()) {
|
|
50
|
+
finalFilename = `${finalFilename}.${getExtension()}`;
|
|
51
|
+
}
|
|
52
|
+
return new JsFileDownloader({
|
|
53
|
+
url,
|
|
54
|
+
filename: finalFilename,
|
|
55
|
+
...params
|
|
56
|
+
});
|
|
57
|
+
};
|
|
29
58
|
}
|
package/package.json
CHANGED
|
@@ -1,86 +1,87 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@finema/core",
|
|
3
|
-
"version": "1.4.
|
|
4
|
-
"repository": "https://gitlab.finema.co/finema/ui-kit",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"author": "Finema Dev Core Team",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./dist/types.d.ts",
|
|
11
|
-
"import": "./dist/module.mjs",
|
|
12
|
-
"require": "./dist/module.cjs"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"main": "./dist/module.cjs",
|
|
16
|
-
"types": "./dist/types.d.ts",
|
|
17
|
-
"files": [
|
|
18
|
-
"dist"
|
|
19
|
-
],
|
|
20
|
-
"engines": {
|
|
21
|
-
"node": ">=18.0.0"
|
|
22
|
-
},
|
|
23
|
-
"scripts": {
|
|
24
|
-
"prepack": "nuxt-module-build build",
|
|
25
|
-
"dev": "nuxi dev playground",
|
|
26
|
-
"dev:build": "nuxi build playground",
|
|
27
|
-
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
28
|
-
"lint": "eslint . --cache",
|
|
29
|
-
"lint:fix": "eslint . --fix --cache",
|
|
30
|
-
"test": "vitest run",
|
|
31
|
-
"test:watch": "vitest watch",
|
|
32
|
-
"release": "release-it --ci",
|
|
33
|
-
"prepare": "husky install"
|
|
34
|
-
},
|
|
35
|
-
"dependencies": {
|
|
36
|
-
"@nuxt/kit": "^3.7.4",
|
|
37
|
-
"@nuxt/ui": "^2.13.0",
|
|
38
|
-
"@pinia/nuxt": "^0.5.1",
|
|
39
|
-
"@vee-validate/nuxt": "^4.12.4",
|
|
40
|
-
"@vee-validate/zod": "^4.12.4",
|
|
41
|
-
"@vuepic/vue-datepicker": "^7.4.1",
|
|
42
|
-
"axios": "^1.6.5",
|
|
43
|
-
"date-fns": "^3.2.0",
|
|
44
|
-
"i18next": "^23.7.16",
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"zod
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"@
|
|
56
|
-
"@nuxt/
|
|
57
|
-
"@nuxt/
|
|
58
|
-
"@nuxt/
|
|
59
|
-
"@nuxt/
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
62
|
-
"@types/
|
|
63
|
-
"@
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"stylelint
|
|
76
|
-
"stylelint-config-
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"*.{
|
|
85
|
-
|
|
86
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@finema/core",
|
|
3
|
+
"version": "1.4.38",
|
|
4
|
+
"repository": "https://gitlab.finema.co/finema/ui-kit",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Finema Dev Core Team",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/types.d.ts",
|
|
11
|
+
"import": "./dist/module.mjs",
|
|
12
|
+
"require": "./dist/module.cjs"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"main": "./dist/module.cjs",
|
|
16
|
+
"types": "./dist/types.d.ts",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=18.0.0"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"prepack": "nuxt-module-build build",
|
|
25
|
+
"dev": "nuxi dev playground",
|
|
26
|
+
"dev:build": "nuxi build playground",
|
|
27
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
28
|
+
"lint": "eslint . --cache",
|
|
29
|
+
"lint:fix": "eslint . --fix --cache",
|
|
30
|
+
"test": "vitest run",
|
|
31
|
+
"test:watch": "vitest watch",
|
|
32
|
+
"release": "release-it --ci",
|
|
33
|
+
"prepare": "husky install"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@nuxt/kit": "^3.7.4",
|
|
37
|
+
"@nuxt/ui": "^2.13.0",
|
|
38
|
+
"@pinia/nuxt": "^0.5.1",
|
|
39
|
+
"@vee-validate/nuxt": "^4.12.4",
|
|
40
|
+
"@vee-validate/zod": "^4.12.4",
|
|
41
|
+
"@vuepic/vue-datepicker": "^7.4.1",
|
|
42
|
+
"axios": "^1.6.5",
|
|
43
|
+
"date-fns": "^3.2.0",
|
|
44
|
+
"i18next": "^23.7.16",
|
|
45
|
+
"js-file-downloader": "^1.1.25",
|
|
46
|
+
"lodash-es": "^4.17.21",
|
|
47
|
+
"nuxt-security": "^1.0.0",
|
|
48
|
+
"pinia": "^2.1.7",
|
|
49
|
+
"qrcode.vue": "^3.4.1",
|
|
50
|
+
"url-join": "^5.0.0",
|
|
51
|
+
"zod": "^3.22.4",
|
|
52
|
+
"zod-i18n-map": "^2.25.0"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@finema/eslint-config": "^1.2.0",
|
|
56
|
+
"@nuxt/devtools": "latest",
|
|
57
|
+
"@nuxt/eslint-config": "^0.2.0",
|
|
58
|
+
"@nuxt/module-builder": "^0.5.4",
|
|
59
|
+
"@nuxt/schema": "^3.7.4",
|
|
60
|
+
"@nuxt/test-utils": "^3.9.0",
|
|
61
|
+
"@release-it/conventional-changelog": "^8.0.1",
|
|
62
|
+
"@types/lodash-es": "^4.17.12",
|
|
63
|
+
"@types/node": "^20.10.8",
|
|
64
|
+
"@vue/test-utils": "^2.4.3",
|
|
65
|
+
"changelogen": "^0.5.5",
|
|
66
|
+
"eslint": "^8.56.0",
|
|
67
|
+
"happy-dom": "^13.0.0",
|
|
68
|
+
"husky": "^8.0.3",
|
|
69
|
+
"lint-staged": "^15.2.0",
|
|
70
|
+
"nuxt": "^3.9.1",
|
|
71
|
+
"playwright-core": "^1.40.1",
|
|
72
|
+
"prettier": "^3.1.1",
|
|
73
|
+
"release-it": "^17.0.1",
|
|
74
|
+
"sass": "^1.69.5",
|
|
75
|
+
"stylelint": "^16.1.0",
|
|
76
|
+
"stylelint-config-prettier-scss": "^1.0.0",
|
|
77
|
+
"stylelint-config-standard-scss": "^13.0.0",
|
|
78
|
+
"vitest": "^1.1.3"
|
|
79
|
+
},
|
|
80
|
+
"resolutions": {
|
|
81
|
+
"vue": "3.3.13"
|
|
82
|
+
},
|
|
83
|
+
"lint-staged": {
|
|
84
|
+
"*.{ts,vue,tsx,js}": "eslint --fix --cache",
|
|
85
|
+
"*.{html,json}": "prettier --write"
|
|
86
|
+
}
|
|
87
|
+
}
|