comand-component-library 3.1.43 → 3.1.44
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/comand-component-library.umd.min.js +1 -1
- package/package.json +3 -2
- package/src/App.vue +6 -1
- package/src/components/CmdFormElement.vue +2 -6
- package/src/components/CmdLoginForm.vue +3 -3
- package/src/components/CmdProgressBar.vue +1 -1
- package/src/components/CmdSwitchButton.vue +5 -3
- package/src/components/CmdUploadForm.vue +722 -174
- package/src/mixins/CmdUploadForm/DefaultMessageProperties.js +49 -0
- package/src/mixins/I18n.js +56 -0
- package/src/utils/GetFileExtension.js +15 -0
@@ -0,0 +1,49 @@
|
|
1
|
+
export default {
|
2
|
+
data() {
|
3
|
+
return {
|
4
|
+
defaultMessageProperties: {
|
5
|
+
"cmduploadform.no_file_to_upload": "No file selected to upload",
|
6
|
+
"cmduploadform.no_files_to_upload": "No files selected to upload",
|
7
|
+
"cmduploadform.labeltext.select_file": "Select file to upload",
|
8
|
+
"cmduploadform.labeltext.select_files": "Select files to upload",
|
9
|
+
"cmduploadform.labeltext.remove_file_from_list": "Remove file from list",
|
10
|
+
"cmduploadform.labeltext.remove_all_files_from_list": "Remove all files from list",
|
11
|
+
"cmduploadform.labeltext.file_uploading": "file to upload",
|
12
|
+
"cmduploadform.labeltext.files_uploading": "files to upload",
|
13
|
+
"cmduploadform.labeltext.comment": "Comment:",
|
14
|
+
"cmduploadform.buttontext.upload_file": "Upload file",
|
15
|
+
"cmduploadform.buttontext.upload_files": "Upload files",
|
16
|
+
"cmduploadform.buttontext.cancel": "Cancel",
|
17
|
+
"cmduploadform.placeholder.comment": "Please type in a specific comment",
|
18
|
+
"cmduploadform.system_message.found_duplicate_file": "Found duplicate file (not added again)",
|
19
|
+
"cmduploadform.system_message.upload_success": "Upload successful",
|
20
|
+
"cmduploadform.system_message.upload_failed": "Upload failed",
|
21
|
+
"cmduploadform.system_message.fill_required": "Fill all required fields",
|
22
|
+
"cmduploadform.system_message.the_following_errors_occurred": "The following errors occurred!",
|
23
|
+
"cmduploadform.system_message.an_unknown_error_occurred": "An unknown error occurred!",
|
24
|
+
"cmduploadform.system_message.only_one_file_allowed": "Only one file allowed!",
|
25
|
+
"cmduploadform.system_message_total_size_of_files_too_large": "Total size of files too large!",
|
26
|
+
"cmduploadform.system_message.duplicate_file": 'Duplicate file "{0}" found (not added to list again)',
|
27
|
+
"cmduploadform.system_message.not_allowed_file_type": 'File "{0}" has not allowed file type ({1})',
|
28
|
+
"cmduploadform.system_message.all_files_are_uploaded_successfully": "All files are uploaded successfully",
|
29
|
+
"cmduploadform.system_message.some_files_are_not_uploaded_successfully": "Some files are not uploaded successfully",
|
30
|
+
"cmduploadform.system_message.file_size_too_large": 'File size of "{0}" too large ({1})',
|
31
|
+
"cmduploadform.headline.summary_of_all_files": "Summary of all files",
|
32
|
+
"cmduploadform.headline.list_of_selected_files": "List of selected files",
|
33
|
+
"cmduploadform.headline.select_additional_files": "Select additional files",
|
34
|
+
"cmduploadform.headline.select_new_file": "Chosen the wrong file? Select a new one",
|
35
|
+
"cmduploadform.allowed_file_types": "Allowed file types:",
|
36
|
+
"cmduploadform.max_total_upload_size": "Max. total upload size:",
|
37
|
+
"cmduploadform.max_file_upload_size": "Max. file upload size:",
|
38
|
+
"cmduploadform.or": "or",
|
39
|
+
"cmduploadform.drag_and_drop": "drag (and drop)",
|
40
|
+
"cmduploadform.additional": "additional",
|
41
|
+
"cmduploadform.new": "new",
|
42
|
+
"cmduploadform.files_to_this_area": "files to this area",
|
43
|
+
"cmduploadform.tooltip.toggle_list_of_allowed_file_types": "Toggle list of allowed file types",
|
44
|
+
"cmduploadform.reset_upload": "Reset upload",
|
45
|
+
"cmduploadform.tooltip.all_files_will_be_removed": "All files will be remove from upload-list!"
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
export default {
|
2
|
+
props: {
|
3
|
+
/**
|
4
|
+
* Message properties for internationalization.
|
5
|
+
*
|
6
|
+
* You can either specify an object with key-value-pairs or a function which
|
7
|
+
* takes at least one input parameter (the key) and returns the according
|
8
|
+
* message.
|
9
|
+
*
|
10
|
+
* If key-value-pairs are provided, the value can be either a string or a
|
11
|
+
* function. If it is a function, then it is called with an array of
|
12
|
+
* replacements for placeholders in the message.
|
13
|
+
*
|
14
|
+
* If a function is provided, it is called with two parameters. The first
|
15
|
+
* parameter is the message key and the second parameter is an array of
|
16
|
+
* replacements for placeholders in the message.
|
17
|
+
*
|
18
|
+
* Example:
|
19
|
+
* <pre>
|
20
|
+
* {
|
21
|
+
* "my.message1": "My {0} test message with {1} placeholders",
|
22
|
+
* "my.message2": params => "My {0} message".replace("{0}", params[0])
|
23
|
+
* }
|
24
|
+
* </pre>
|
25
|
+
*/
|
26
|
+
i18n: {
|
27
|
+
type: [Object, Function],
|
28
|
+
default: () => ({})
|
29
|
+
}
|
30
|
+
},
|
31
|
+
methods: {
|
32
|
+
getMessage(key, ...params) {
|
33
|
+
if (!key) {
|
34
|
+
return ""
|
35
|
+
}
|
36
|
+
let messages = this.i18n
|
37
|
+
if (typeof this.i18n === "function") {
|
38
|
+
messages = this.i18n.call(this, key, params)
|
39
|
+
if (typeof messages !== "object") {
|
40
|
+
return messages
|
41
|
+
}
|
42
|
+
}
|
43
|
+
let message =
|
44
|
+
messages[key] ||
|
45
|
+
(this.defaultMessageProperties && this.defaultMessageProperties[key]) ||
|
46
|
+
key
|
47
|
+
if (typeof message === "function") {
|
48
|
+
return message.call(this, params || [])
|
49
|
+
}
|
50
|
+
if (Array.isArray(params) && params.length) {
|
51
|
+
params.forEach((param, index) => (message = message.replace("{" + index + "}", param)))
|
52
|
+
}
|
53
|
+
return message
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/**
|
2
|
+
* @param filename
|
3
|
+
* @returns {string} file extension of given filename or empty string if filename is empty/undefined
|
4
|
+
*/
|
5
|
+
function getFileExtension(filename) {
|
6
|
+
if (filename) {
|
7
|
+
const positionOfLastDot = filename.lastIndexOf(".")
|
8
|
+
if (positionOfLastDot > -1) {
|
9
|
+
return filename.substring(positionOfLastDot + 1)
|
10
|
+
}
|
11
|
+
}
|
12
|
+
return ""
|
13
|
+
}
|
14
|
+
|
15
|
+
export { getFileExtension }
|