ngx-material-entity 15.3.0 → 16.0.0
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/classes/entity.model.d.ts +2 -2
- package/components/confirm-dialog/confirm-dialog-data.d.ts +1 -1
- package/components/edit-page/edit-page.component.d.ts +4 -2
- package/components/edit-page/page-edit-data.builder.d.ts +1 -1
- package/components/input/array/array-string-chips-input/array-string-chips-input.component.d.ts +1 -0
- package/components/input/array/array-table.class.d.ts +4 -2
- package/components/input/base-input.component.d.ts +5 -1
- package/components/input/boolean/boolean-checkbox-input/boolean-checkbox-input.component.d.ts +1 -1
- package/components/input/boolean/boolean-dropdown-input/boolean-dropdown-input.component.d.ts +1 -1
- package/components/input/file/file-default-input/file-default-input.component.d.ts +0 -2
- package/components/input/file/file-image-input/file-image-input.component.d.ts +3 -2
- package/components/input/file/file-input/file-input.component.d.ts +4 -2
- package/components/input/input.component.d.ts +9 -4
- package/components/input/input.module.d.ts +2 -1
- package/components/table/display-column-value/base-display-column-value.component.d.ts +1 -1
- package/components/table/display-column-value/display-column-value.component.d.ts +1 -1
- package/components/table/edit-dialog/edit-entity-dialog.component.d.ts +3 -1
- package/components/table/table-data.builder.d.ts +1 -1
- package/components/table/table-data.d.ts +1 -1
- package/components/table/table.component.d.ts +1 -1
- package/decorators/base/decorator-types.enum.d.ts +1 -1
- package/decorators/base/property-decorator.data.d.ts +1 -1
- package/decorators/file/file-decorator.data.d.ts +1 -1
- package/decorators/number/number-decorator.data.d.ts +1 -1
- package/decorators/string/string-decorator.data.d.ts +1 -1
- package/encapsulation/jszip.utilities.d.ts +1 -1
- package/encapsulation/uuid.utilities.d.ts +11 -0
- package/esm2022/classes/base.builder.mjs +44 -0
- package/esm2022/classes/entity.model.mjs +26 -0
- package/esm2022/components/confirm-dialog/confirm-dialog-data.builder.mjs +58 -0
- package/esm2022/components/confirm-dialog/confirm-dialog.component.mjs +60 -0
- package/esm2022/components/edit-page/edit-page.component.mjs +291 -0
- package/esm2022/components/input/array/array-date-input/array-date-input.component.mjs +23 -0
- package/esm2022/components/input/array/array-date-range-input/array-date-range-input.component.mjs +49 -0
- package/esm2022/components/input/array/array-date-time-input/array-date-time-input.component.mjs +49 -0
- package/esm2022/components/input/array/array-string-autocomplete-chips/array-string-autocomplete-chips.component.mjs +50 -0
- package/esm2022/components/input/array/array-string-chips-input/array-string-chips-input.component.mjs +69 -0
- package/esm2022/components/input/array/array-table.class.mjs +100 -0
- package/esm2022/components/input/base-input.component.mjs +88 -0
- package/esm2022/components/input/boolean/boolean-checkbox-input/boolean-checkbox-input.component.mjs +21 -0
- package/esm2022/components/input/boolean/boolean-dropdown-input/boolean-dropdown-input.component.mjs +17 -0
- package/esm2022/components/input/boolean/boolean-toggle-input/boolean-toggle-input.component.mjs +21 -0
- package/esm2022/components/input/custom/custom.component.mjs +28 -0
- package/esm2022/components/input/date/date-input/date-input.component.mjs +19 -0
- package/esm2022/components/input/date/date-range-input/date-range-input.component.mjs +68 -0
- package/esm2022/components/input/date/date-time-input/date-time-input.component.mjs +69 -0
- package/esm2022/components/input/file/file-default-input/file-default-input.component.mjs +18 -0
- package/esm2022/components/input/file/file-image-input/file-image-input.component.mjs +101 -0
- package/esm2022/components/input/file/file-input/dragDrop.directive.mjs +62 -0
- package/esm2022/components/input/file/file-input/file-input.component.mjs +206 -0
- package/esm2022/components/input/input.component.mjs +849 -0
- package/esm2022/components/input/input.module.mjs +172 -0
- package/esm2022/components/input/number/number-dropdown-input/number-dropdown-input.component.mjs +23 -0
- package/esm2022/components/input/number/number-input/number-input.component.mjs +16 -0
- package/esm2022/components/input/number/number-slider-input/number-slider-input.component.mjs +17 -0
- package/esm2022/components/input/relations/references-many-input/references-many-input.component.mjs +102 -0
- package/esm2022/components/input/string/string-autocomplete-input/string-autocomplete-input.component.mjs +36 -0
- package/esm2022/components/input/string/string-dropdown-input/string-dropdown-input.component.mjs +23 -0
- package/esm2022/components/input/string/string-input/string-input.component.mjs +16 -0
- package/esm2022/components/input/string/string-password-input/string-password-input.component.mjs +39 -0
- package/esm2022/components/input/string/string-textbox-input/string-textbox-input.component.mjs +17 -0
- package/esm2022/components/table/create-dialog/create-dialog-data.builder.mjs +42 -0
- package/esm2022/components/table/create-dialog/create-entity-dialog-data.builder.mjs +32 -0
- package/esm2022/components/table/create-dialog/create-entity-dialog.component.mjs +107 -0
- package/esm2022/components/table/display-column-value/base-display-column-value.component.mjs +28 -0
- package/esm2022/components/table/display-column-value/display-column-value.component.mjs +37 -0
- package/esm2022/components/table/edit-dialog/edit-data.builder.mjs +106 -0
- package/esm2022/components/table/edit-dialog/edit-entity-dialog.component.mjs +209 -0
- package/esm2022/components/table/edit-dialog/edit-entity.builder.mjs +39 -0
- package/esm2022/components/table/table-data.builder.mjs +269 -0
- package/esm2022/components/table/table.component.mjs +348 -0
- package/esm2022/decorators/array/array-decorator-internal.data.mjs +286 -0
- package/esm2022/decorators/array/array-decorator.data.mjs +21 -0
- package/esm2022/decorators/base/property-decorator-internal.data.mjs +82 -0
- package/esm2022/decorators/base/property-decorator.data.mjs +56 -0
- package/esm2022/decorators/boolean/boolean-decorator-internal.data.mjs +43 -0
- package/esm2022/decorators/boolean/boolean-decorator.data.mjs +11 -0
- package/esm2022/decorators/custom/custom-decorator-internal.data.mjs +35 -0
- package/{esm2020 → esm2022}/decorators/date/date-decorator-internal.data.mjs +43 -1
- package/esm2022/decorators/date/date-decorator.data.mjs +11 -0
- package/esm2022/decorators/file/file-decorator-internal.data.mjs +143 -0
- package/esm2022/decorators/file/file-decorator.data.mjs +64 -0
- package/esm2022/decorators/has-many/has-many-decorator-internal.data.mjs +42 -0
- package/esm2022/decorators/number/number-decorator-internal.data.mjs +76 -0
- package/esm2022/decorators/number/number-decorator.data.mjs +11 -0
- package/esm2022/decorators/object/object-decorator-internal.data.mjs +20 -0
- package/esm2022/decorators/object/object-decorator.data.mjs +22 -0
- package/esm2022/decorators/references-many/references-many-decorator-internal.data.mjs +48 -0
- package/esm2022/decorators/references-one/references-one-decorator-internal.data.mjs +24 -0
- package/esm2022/decorators/string/string-decorator-internal.data.mjs +114 -0
- package/esm2022/decorators/string/string-decorator.data.mjs +11 -0
- package/esm2022/encapsulation/uuid.utilities.mjs +15 -0
- package/esm2022/services/entity.service.mjs +276 -0
- package/esm2022/utilities/date.utilities.mjs +159 -0
- package/esm2022/utilities/entity.utilities.mjs +905 -0
- package/esm2022/utilities/file.utilities.mjs +180 -0
- package/{fesm2020 → fesm2022}/ngx-material-entity.mjs +1355 -484
- package/fesm2022/ngx-material-entity.mjs.map +1 -0
- package/package.json +11 -17
- package/utilities/date.utilities.d.ts +1 -1
- package/utilities/entity.utilities.d.ts +7 -3
- package/utilities/file.utilities.d.ts +6 -2
- package/esm2020/classes/base.builder.mjs +0 -42
- package/esm2020/classes/entity.model.mjs +0 -22
- package/esm2020/components/confirm-dialog/confirm-dialog-data.builder.mjs +0 -44
- package/esm2020/components/confirm-dialog/confirm-dialog.component.mjs +0 -57
- package/esm2020/components/edit-page/edit-page.component.mjs +0 -274
- package/esm2020/components/input/array/array-date-input/array-date-input.component.mjs +0 -26
- package/esm2020/components/input/array/array-date-range-input/array-date-range-input.component.mjs +0 -50
- package/esm2020/components/input/array/array-date-time-input/array-date-time-input.component.mjs +0 -49
- package/esm2020/components/input/array/array-string-autocomplete-chips/array-string-autocomplete-chips.component.mjs +0 -49
- package/esm2020/components/input/array/array-string-chips-input/array-string-chips-input.component.mjs +0 -70
- package/esm2020/components/input/array/array-table.class.mjs +0 -93
- package/esm2020/components/input/base-input.component.mjs +0 -64
- package/esm2020/components/input/boolean/boolean-checkbox-input/boolean-checkbox-input.component.mjs +0 -21
- package/esm2020/components/input/boolean/boolean-dropdown-input/boolean-dropdown-input.component.mjs +0 -17
- package/esm2020/components/input/boolean/boolean-toggle-input/boolean-toggle-input.component.mjs +0 -21
- package/esm2020/components/input/custom/custom.component.mjs +0 -26
- package/esm2020/components/input/date/date-input/date-input.component.mjs +0 -22
- package/esm2020/components/input/date/date-range-input/date-range-input.component.mjs +0 -71
- package/esm2020/components/input/date/date-time-input/date-time-input.component.mjs +0 -71
- package/esm2020/components/input/file/file-default-input/file-default-input.component.mjs +0 -23
- package/esm2020/components/input/file/file-image-input/file-image-input.component.mjs +0 -98
- package/esm2020/components/input/file/file-input/dragDrop.directive.mjs +0 -63
- package/esm2020/components/input/file/file-input/file-input.component.mjs +0 -195
- package/esm2020/components/input/input.component.mjs +0 -746
- package/esm2020/components/input/input.module.mjs +0 -169
- package/esm2020/components/input/number/number-dropdown-input/number-dropdown-input.component.mjs +0 -26
- package/esm2020/components/input/number/number-input/number-input.component.mjs +0 -16
- package/esm2020/components/input/number/number-slider-input/number-slider-input.component.mjs +0 -17
- package/esm2020/components/input/relations/references-many-input/references-many-input.component.mjs +0 -100
- package/esm2020/components/input/string/string-autocomplete-input/string-autocomplete-input.component.mjs +0 -34
- package/esm2020/components/input/string/string-dropdown-input/string-dropdown-input.component.mjs +0 -26
- package/esm2020/components/input/string/string-input/string-input.component.mjs +0 -16
- package/esm2020/components/input/string/string-password-input/string-password-input.component.mjs +0 -42
- package/esm2020/components/input/string/string-textbox-input/string-textbox-input.component.mjs +0 -17
- package/esm2020/components/table/create-dialog/create-dialog-data.builder.mjs +0 -32
- package/esm2020/components/table/create-dialog/create-entity-dialog-data.builder.mjs +0 -26
- package/esm2020/components/table/create-dialog/create-entity-dialog.component.mjs +0 -100
- package/esm2020/components/table/display-column-value/base-display-column-value.component.mjs +0 -27
- package/esm2020/components/table/display-column-value/display-column-value.component.mjs +0 -33
- package/esm2020/components/table/edit-dialog/edit-data.builder.mjs +0 -76
- package/esm2020/components/table/edit-dialog/edit-entity-dialog.component.mjs +0 -195
- package/esm2020/components/table/edit-dialog/edit-entity.builder.mjs +0 -29
- package/esm2020/components/table/table-data.builder.mjs +0 -205
- package/esm2020/components/table/table.component.mjs +0 -333
- package/esm2020/decorators/array/array-decorator-internal.data.mjs +0 -150
- package/esm2020/decorators/array/array-decorator.data.mjs +0 -7
- package/esm2020/decorators/base/property-decorator-internal.data.mjs +0 -58
- package/esm2020/decorators/base/property-decorator.data.mjs +0 -6
- package/esm2020/decorators/boolean/boolean-decorator-internal.data.mjs +0 -33
- package/esm2020/decorators/boolean/boolean-decorator.data.mjs +0 -7
- package/esm2020/decorators/custom/custom-decorator-internal.data.mjs +0 -27
- package/esm2020/decorators/date/date-decorator.data.mjs +0 -7
- package/esm2020/decorators/file/file-decorator-internal.data.mjs +0 -97
- package/esm2020/decorators/file/file-decorator.data.mjs +0 -7
- package/esm2020/decorators/has-many/has-many-decorator-internal.data.mjs +0 -32
- package/esm2020/decorators/number/number-decorator-internal.data.mjs +0 -54
- package/esm2020/decorators/number/number-decorator.data.mjs +0 -7
- package/esm2020/decorators/object/object-decorator-internal.data.mjs +0 -14
- package/esm2020/decorators/object/object-decorator.data.mjs +0 -7
- package/esm2020/decorators/references-many/references-many-decorator-internal.data.mjs +0 -30
- package/esm2020/decorators/references-one/references-one-decorator-internal.data.mjs +0 -16
- package/esm2020/decorators/string/string-decorator-internal.data.mjs +0 -72
- package/esm2020/decorators/string/string-decorator.data.mjs +0 -7
- package/esm2020/services/entity.service.mjs +0 -274
- package/esm2020/utilities/date.utilities.mjs +0 -159
- package/esm2020/utilities/entity.utilities.mjs +0 -896
- package/esm2020/utilities/file.utilities.mjs +0 -176
- package/fesm2015/ngx-material-entity.mjs +0 -6300
- package/fesm2015/ngx-material-entity.mjs.map +0 -1
- package/fesm2020/ngx-material-entity.mjs.map +0 -1
- /package/{esm2020 → esm2022}/components/confirm-dialog/confirm-dialog-data.mjs +0 -0
- /package/{esm2020 → esm2022}/components/edit-page/edit-data.route.mjs +0 -0
- /package/{esm2020 → esm2022}/components/edit-page/page-edit-data.builder.mjs +0 -0
- /package/{esm2020 → esm2022}/components/get-validation-error-message.function.mjs +0 -0
- /package/{esm2020 → esm2022}/components/table/create-dialog/create-entity-dialog-data.mjs +0 -0
- /package/{esm2020 → esm2022}/components/table/default.actions.mjs +0 -0
- /package/{esm2020 → esm2022}/components/table/edit-dialog/edit-entity-data.mjs +0 -0
- /package/{esm2020 → esm2022}/components/table/table-data.mjs +0 -0
- /package/{esm2020 → esm2022}/decorators/array/array.decorator.mjs +0 -0
- /package/{esm2020 → esm2022}/decorators/base/base-property.decorator.mjs +0 -0
- /package/{esm2020 → esm2022}/decorators/base/decorator-types.enum.mjs +0 -0
- /package/{esm2020 → esm2022}/decorators/base/dropdown-value.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/decorators/boolean/boolean.decorator.mjs +0 -0
- /package/{esm2020 → esm2022}/decorators/custom/custom-decorator.data.mjs +0 -0
- /package/{esm2020 → esm2022}/decorators/custom/custom.decorator.mjs +0 -0
- /package/{esm2020 → esm2022}/decorators/date/date.decorator.mjs +0 -0
- /package/{esm2020 → esm2022}/decorators/file/file.decorator.mjs +0 -0
- /package/{esm2020 → esm2022}/decorators/has-many/has-many-decorator.data.mjs +0 -0
- /package/{esm2020 → esm2022}/decorators/has-many/has-many.decorator.mjs +0 -0
- /package/{esm2020 → esm2022}/decorators/number/number.decorator.mjs +0 -0
- /package/{esm2020 → esm2022}/decorators/object/object.decorator.mjs +0 -0
- /package/{esm2020 → esm2022}/decorators/references-many/references-many-decorator.data.mjs +0 -0
- /package/{esm2020 → esm2022}/decorators/references-many/references-many.decorator.mjs +0 -0
- /package/{esm2020 → esm2022}/decorators/references-one/references-one-decorator.data.mjs +0 -0
- /package/{esm2020 → esm2022}/decorators/references-one/references-one.decorator.mjs +0 -0
- /package/{esm2020 → esm2022}/decorators/string/string.decorator.mjs +0 -0
- /package/{esm2020 → esm2022}/encapsulation/js-2-xml.utilities.mjs +0 -0
- /package/{esm2020 → esm2022}/encapsulation/jszip.utilities.mjs +0 -0
- /package/{esm2020 → esm2022}/encapsulation/lodash.utilities.mjs +0 -0
- /package/{esm2020 → esm2022}/encapsulation/reflect.utilities.mjs +0 -0
- /package/{esm2020 → esm2022}/functions/default-false.function.mjs +0 -0
- /package/{esm2020 → esm2022}/functions/default-true.function.mjs +0 -0
- /package/{esm2020 → esm2022}/functions/is-async-function.function.mjs +0 -0
- /package/{esm2020 → esm2022}/mocks/placeholder-data.png.mjs +0 -0
- /package/{esm2020 → esm2022}/ngx-material-entity.mjs +0 -0
- /package/{esm2020 → esm2022}/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/services/unsaved-changes.guard.mjs +0 -0
- /package/{esm2020 → esm2022}/utilities/selection.utilities.mjs +0 -0
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { JSZipUtilities } from '../encapsulation/jszip.utilities';
|
|
2
|
-
import { LodashUtilities } from '../encapsulation/lodash.utilities';
|
|
3
|
-
/**
|
|
4
|
-
* Provides functionality regarding files.
|
|
5
|
-
*/
|
|
6
|
-
export class FileUtilities {
|
|
7
|
-
/**
|
|
8
|
-
* Gets the accept value for the html input.
|
|
9
|
-
*
|
|
10
|
-
* @param mimeTypes - The mimeTypes to get the accept string from.
|
|
11
|
-
* @returns A comma separated string of all the provided mime types.
|
|
12
|
-
*/
|
|
13
|
-
static getAcceptString(mimeTypes) {
|
|
14
|
-
if (!mimeTypes?.length) {
|
|
15
|
-
return '*';
|
|
16
|
-
}
|
|
17
|
-
return mimeTypes.join(', ');
|
|
18
|
-
}
|
|
19
|
-
// TODO: Find a way to use blobs with jest
|
|
20
|
-
/* istanbul ignore next */
|
|
21
|
-
/**
|
|
22
|
-
* Reads a url to display the given file.
|
|
23
|
-
*
|
|
24
|
-
* @param file - The file to get the url from.
|
|
25
|
-
* @returns A promise of the url. Undefined if no file was provided.
|
|
26
|
-
*/
|
|
27
|
-
static async getDataURLFromFile(file) {
|
|
28
|
-
if (!file) {
|
|
29
|
-
return undefined;
|
|
30
|
-
}
|
|
31
|
-
return new Promise((resolve, reject) => {
|
|
32
|
-
const reader = new FileReader();
|
|
33
|
-
reader.onload = e => resolve(e.target?.result);
|
|
34
|
-
reader.onerror = e => reject(e);
|
|
35
|
-
reader.readAsDataURL(file);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
// TODO: Find a way to use blobs with jest
|
|
39
|
-
/* istanbul ignore next */
|
|
40
|
-
/**
|
|
41
|
-
* Gets a file from the given url.
|
|
42
|
-
*
|
|
43
|
-
* @param url - The url to get the file from.
|
|
44
|
-
* @returns A promise of the File.
|
|
45
|
-
*/
|
|
46
|
-
static async getFileFromUrl(url) {
|
|
47
|
-
const res = await fetch(url);
|
|
48
|
-
if (!res.ok) {
|
|
49
|
-
// TODO make error more robust
|
|
50
|
-
throw new Error(`Error fetching the file from the url ${url}`);
|
|
51
|
-
}
|
|
52
|
-
return await res.blob();
|
|
53
|
-
}
|
|
54
|
-
// TODO: Find a way to use blobs with jest
|
|
55
|
-
/* istanbul ignore next */
|
|
56
|
-
/**
|
|
57
|
-
* Gets the file data with the blob from the given File Data.
|
|
58
|
-
*
|
|
59
|
-
* @param data - The File Data to get the file data with blob from.
|
|
60
|
-
* @returns FileDataWithFile.
|
|
61
|
-
*/
|
|
62
|
-
static async getFileData(data) {
|
|
63
|
-
if (data.file) {
|
|
64
|
-
return {
|
|
65
|
-
file: data.file,
|
|
66
|
-
name: data.name,
|
|
67
|
-
url: data.url,
|
|
68
|
-
type: data.type,
|
|
69
|
-
size: data.size
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
return {
|
|
74
|
-
file: await FileUtilities.getFileFromUrl(data.url),
|
|
75
|
-
name: data.name,
|
|
76
|
-
url: data.url,
|
|
77
|
-
type: data.type,
|
|
78
|
-
size: data.size
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
// TODO: Find a way to use blobs with jest
|
|
83
|
-
/* istanbul ignore next */
|
|
84
|
-
/**
|
|
85
|
-
* Downloads a single file from the given File Data.
|
|
86
|
-
*
|
|
87
|
-
* @param fileData - The file data. Needs to contain a blob.
|
|
88
|
-
*/
|
|
89
|
-
static downloadSingleFile(fileData) {
|
|
90
|
-
this.downLoadBlob(fileData.file, fileData.name);
|
|
91
|
-
}
|
|
92
|
-
// TODO: Find a way to use blobs with jest
|
|
93
|
-
/* istanbul ignore next */
|
|
94
|
-
/**
|
|
95
|
-
* Downloads a blob.
|
|
96
|
-
*
|
|
97
|
-
* @param blob - The blob to download.
|
|
98
|
-
* @param name - The name of the downloaded file.
|
|
99
|
-
*/
|
|
100
|
-
static downLoadBlob(blob, name) {
|
|
101
|
-
const a = document.createElement('a');
|
|
102
|
-
const objectUrl = URL.createObjectURL(blob);
|
|
103
|
-
a.href = objectUrl;
|
|
104
|
-
if (name) {
|
|
105
|
-
a.download = name;
|
|
106
|
-
}
|
|
107
|
-
a.click();
|
|
108
|
-
URL.revokeObjectURL(objectUrl);
|
|
109
|
-
}
|
|
110
|
-
// TODO: Find a way to use blobs with jest
|
|
111
|
-
/* istanbul ignore next */
|
|
112
|
-
/**
|
|
113
|
-
* Downloads multiple files as a zip with the given name.
|
|
114
|
-
*
|
|
115
|
-
* @param name - The name of the zip file to generate.
|
|
116
|
-
* @param multiFileData - The file data array to put in the zip.
|
|
117
|
-
*/
|
|
118
|
-
static async downloadMultipleFiles(name, multiFileData) {
|
|
119
|
-
const zip = JSZipUtilities.new();
|
|
120
|
-
for (let i = 0; i < multiFileData.length; i++) {
|
|
121
|
-
multiFileData[i] = await FileUtilities.getFileData(multiFileData[i]);
|
|
122
|
-
zip.file(multiFileData[i].name, multiFileData[i].file);
|
|
123
|
-
}
|
|
124
|
-
const zipBlob = await zip.generateAsync({ type: 'blob' });
|
|
125
|
-
const fileData = {
|
|
126
|
-
name: name,
|
|
127
|
-
file: zipBlob,
|
|
128
|
-
type: 'application/zip',
|
|
129
|
-
size: zipBlob.size
|
|
130
|
-
};
|
|
131
|
-
FileUtilities.downloadSingleFile(fileData);
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Checks if the given file has a valid mime type.
|
|
135
|
-
*
|
|
136
|
-
* @param type - The type of the file to check.
|
|
137
|
-
* @param allowedMimeTypes - The allowed mime types.
|
|
138
|
-
* @returns Whether or not the given file has a valid mime type.
|
|
139
|
-
*/
|
|
140
|
-
static isMimeTypeValid(type, allowedMimeTypes) {
|
|
141
|
-
if (allowedMimeTypes.includes('*')) {
|
|
142
|
-
return true;
|
|
143
|
-
}
|
|
144
|
-
for (const t of allowedMimeTypes) {
|
|
145
|
-
if (t === type) {
|
|
146
|
-
return true;
|
|
147
|
-
}
|
|
148
|
-
if (t.endsWith('*') && type.startsWith(t.split('*')[0])) {
|
|
149
|
-
return true;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return false;
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Transform the given value to Megabytes.
|
|
156
|
-
*
|
|
157
|
-
* @param value - The original value.
|
|
158
|
-
* @param unit - If the value is B, KB or GB.
|
|
159
|
-
* @returns The given value as bytes.
|
|
160
|
-
*/
|
|
161
|
-
static transformToMegaBytes(value, unit) {
|
|
162
|
-
const bytes = this.transformToBytes(LodashUtilities.cloneDeep(value), unit);
|
|
163
|
-
return bytes / 1000000;
|
|
164
|
-
}
|
|
165
|
-
static transformToBytes(value, unit) {
|
|
166
|
-
switch (unit) {
|
|
167
|
-
case 'B':
|
|
168
|
-
return value;
|
|
169
|
-
case 'KB':
|
|
170
|
-
return value * 1000;
|
|
171
|
-
case 'GB':
|
|
172
|
-
return value * 1000000000;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZS51dGlsaXRpZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9uZ3gtbWF0ZXJpYWwtZW50aXR5L3NyYy91dGlsaXRpZXMvZmlsZS51dGlsaXRpZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFFLGNBQWMsRUFBTyxNQUFNLGtDQUFrQy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gIH1cbiAgICAgICAgcmV0dXJuIGF3YWl0IHJlcy5ibG9iKCk7XG4gICAgfVxuXG4gICAgLy8gVE9ETzogRmluZCBhIHdheSB0byB1c2UgYmxvYnMgd2l0aCBqZXN0XG4gICAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi9cbiAgICAvKipcbiAgICAgKiBHZXRzIHRoZSBmaWxlIGRhdGEgd2l0aCB0aGUgYmxvYiBmcm9tIHRoZSBnaXZlbiBGaWxlIERhdGEuXG4gICAgICpcbiAgICAgKiBAcGFyYW0gZGF0YSAtIFRoZSBGaWxlIERhdGEgdG8gZ2V0IHRoZSBmaWxlIGRhdGEgd2l0aCBibG9iIGZyb20uXG4gICAgICogQHJldHVybnMgRmlsZURhdGFXaXRoRmlsZS5cbiAgICAgKi9cbiAgICBzdGF0aWMgYXN5bmMgZ2V0RmlsZURhdGEoZGF0YTogRmlsZURhdGEpOiBQcm9taXNlPEZpbGVEYXRhV2l0aEZpbGU+IHtcbiAgICAgICAgaWYgKGRhdGEuZmlsZSkge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBmaWxlOiBkYXRhLmZpbGUsXG4gICAgICAgICAgICAgICAgbmFtZTogZGF0YS5uYW1lLFxuICAgICAgICAgICAgICAgIHVybDogZGF0YS51cmwsXG4gICAgICAgICAgICAgICAgdHlwZTogZGF0YS50eXBlLFxuICAgICAgICAgICAgICAgIHNpemU6IGRhdGEuc2l6ZVxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgZmlsZTogYXdhaXQgRmlsZVV0aWxpdGllcy5nZXRGaWxlRnJvbVVybChkYXRhLnVybCBhcyBzdHJpbmcpLFxuICAgICAgICAgICAgICAgIG5hbWU6IGRhdGEubmFtZSxcbiAgICAgICAgICAgICAgICB1cmw6IGRhdGEudXJsLFxuICAgICAgICAgICAgICAgIHR5cGU6IGR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