@finema/core 1.4.47 → 1.4.49
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,8 +1,5 @@
|
|
|
1
|
-
import { type OptionalParams } from 'js-file-downloader';
|
|
2
1
|
export declare class FileHelper {
|
|
3
2
|
static toBase64: (file: File) => Promise<string>;
|
|
4
3
|
static readFileAsync: (file: File) => Promise<string>;
|
|
5
4
|
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>;
|
|
8
5
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import JsFileDownloader from "js-file-downloader";
|
|
2
1
|
export class FileHelper {
|
|
3
2
|
static toBase64 = async (file) => {
|
|
4
3
|
return new Promise((resolve, reject) => {
|
|
@@ -27,32 +26,4 @@ export class FileHelper {
|
|
|
27
26
|
const blob = await res.blob();
|
|
28
27
|
return new File([blob], filename, { type: "image/png" });
|
|
29
28
|
};
|
|
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
|
-
};
|
|
58
29
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addHours, format, formatISO, isDate, isValid, parse, subHours
|
|
1
|
+
import { addHours, addYears, format, formatISO, isDate, isValid, parse, subHours } from "date-fns";
|
|
2
2
|
import { useCoreConfig } from "#core/composables/useConfig";
|
|
3
3
|
const dateFormat = useCoreConfig().date_format;
|
|
4
4
|
const dateTimeFormat = useCoreConfig().date_time_format;
|
|
@@ -13,7 +13,6 @@ export class TimeHelper {
|
|
|
13
13
|
newDateStr = addYears(dateStr, 543);
|
|
14
14
|
}
|
|
15
15
|
if (isThaiMonth) {
|
|
16
|
-
options.locale = import("date-fns/locale/th");
|
|
17
16
|
}
|
|
18
17
|
return format(newDateStr, formatStr, options);
|
|
19
18
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finema/core",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.49",
|
|
4
4
|
"repository": "https://gitlab.finema.co/finema/ui-kit",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Finema Dev Core Team",
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
"axios": "^1.6.5",
|
|
43
43
|
"date-fns": "^3.2.0",
|
|
44
44
|
"i18next": "^23.7.16",
|
|
45
|
-
"js-file-downloader": "^1.1.25",
|
|
46
45
|
"lodash-es": "^4.17.21",
|
|
47
46
|
"nuxt-security": "^1.0.0",
|
|
48
47
|
"pinia": "^2.1.7",
|