Merge branch 'master' into master
This commit is contained in:
@ -11,6 +11,11 @@
|
||||
<div v-if="preview == 'single'" class="dz-preview dz-preview-single" :class="previewClasses" ref="previewSingle">
|
||||
<div class="dz-preview-cover">
|
||||
<img class="dz-preview-img" data-dz-thumbnail>
|
||||
<i class="fas fa-file-image display-3 fa-2x mt-2 d-none" data-dz-thumbnail-image></i>
|
||||
<i class="far fa-file-pdf display-3 fa-2x mt-2 d-none" data-dz-thumbnail-pdf></i>
|
||||
<i class="far fa-file-word fa-2x mt-2 d-none" data-dz-thumbnail-word></i>
|
||||
<i class="far fa-file-excel fa-2x mt-2 d-none" data-dz-thumbnail-excel></i>
|
||||
<span class="mb-1 d-none" data-dz-name>...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -20,6 +25,10 @@
|
||||
<div class="col-auto">
|
||||
<div class="avatar">
|
||||
<img class="avatar-img rounded" data-dz-thumbnail>
|
||||
<i class="fas fa-file-image display-3 d-none" data-dz-thumbnail-image></i>
|
||||
<i class="far fa-file-pdf display-3 d-none" data-dz-thumbnail-pdf></i>
|
||||
<i class="far fa-file-word d-none" data-dz-thumbnail-word></i>
|
||||
<i class="far fa-file-excel d-none" data-dz-thumbnail-excel></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -107,85 +116,114 @@ export default {
|
||||
let preview = this.preview == 'single' ? this.$refs.previewSingle : this.$refs.previewMultiple;
|
||||
|
||||
if (this.configurations.maxFiles === undefined && this.multiple == false) {
|
||||
this.configurations.maxFiles = 1
|
||||
this.configurations.maxFiles = 1;
|
||||
}
|
||||
|
||||
if (this.configurations.acceptedFiles === undefined) {
|
||||
this.configurations.acceptedFiles = 'image/*'
|
||||
this.configurations.acceptedFiles = 'image/*';
|
||||
}
|
||||
|
||||
let finalOptions = {
|
||||
...self.configurations,
|
||||
url: this.url,
|
||||
previewsContainer: preview,
|
||||
previewTemplate: preview.innerHTML,
|
||||
dictDefaultMessage: this.textDropFile,
|
||||
autoProcessQueue: false,
|
||||
...self.configurations,
|
||||
url: this.url,
|
||||
previewsContainer: preview,
|
||||
previewTemplate: preview.innerHTML,
|
||||
dictDefaultMessage: this.textDropFile,
|
||||
autoProcessQueue: false,
|
||||
|
||||
init: function () {
|
||||
let dropzone = this
|
||||
init: function () {
|
||||
let dropzone = this;
|
||||
|
||||
dropzone.on('addedfile', function (file) {
|
||||
self.files.push(file);
|
||||
dropzone.on('addedfile', function (file) {
|
||||
self.files.push(file);
|
||||
|
||||
if (self.configurations.maxFiles == 1) {
|
||||
self.$emit('change', file);
|
||||
} else {
|
||||
self.$emit('change', self.files);
|
||||
}
|
||||
}),
|
||||
if (self.configurations.maxFiles == 1) {
|
||||
self.$emit('change', file);
|
||||
} else {
|
||||
self.$emit('change', self.files);
|
||||
}
|
||||
|
||||
if (file.type.indexOf("image") == -1) {
|
||||
let ext = file.name.split('.').pop();
|
||||
|
||||
file.previewElement.querySelector("[data-dz-thumbnail]").classList.add("d-none");
|
||||
file.previewElement.querySelector("[data-dz-name]").classList.remove("d-none");
|
||||
|
||||
if (ext == "pdf") {
|
||||
file.previewElement.querySelector("[data-dz-thumbnail-pdf]").classList.remove("d-none");
|
||||
} else if ((ext.indexOf("doc") != -1) || (ext.indexOf("docx") != -1)) {
|
||||
file.previewElement.querySelector("[data-dz-thumbnail-word]").classList.remove("d-none");
|
||||
} else if ((ext.indexOf("xls") != -1) || (ext.indexOf("xlsx") != -1)) {
|
||||
file.previewElement.querySelector("[data-dz-thumbnail-excel]").classList.remove("d-none");
|
||||
} else {
|
||||
file.previewElement.querySelector("[data-dz-thumbnail-image]").classList.remove("d-none");
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
dropzone.on('removedfile', function (file) {
|
||||
let index = self.files.findIndex(f => f.name === file.name)
|
||||
dropzone.on('removedfile', function (file) {
|
||||
let index = self.files.findIndex(f => f.name === file.name)
|
||||
|
||||
if (index !== -1) {
|
||||
self.files.splice(index, 1);
|
||||
}
|
||||
if (index !== -1) {
|
||||
self.files.splice(index, 1);
|
||||
}
|
||||
|
||||
self.$emit('change', self.files);
|
||||
self.$emit('change', self.files);
|
||||
|
||||
if (self.multiple) {
|
||||
this.enable();
|
||||
}
|
||||
}),
|
||||
if (self.multiple) {
|
||||
this.enable();
|
||||
}
|
||||
}),
|
||||
|
||||
dropzone.on('maxfilesexceeded', function(file) {
|
||||
this.removeAllFiles('notCancel');
|
||||
this.addFile(file);
|
||||
}),
|
||||
dropzone.on('maxfilesexceeded', function(file) {
|
||||
this.removeAllFiles('notCancel');
|
||||
this.addFile(file);
|
||||
}),
|
||||
|
||||
dropzone.on('maxfilesreached', function(file) {
|
||||
if (self.multiple) {
|
||||
this.disable();
|
||||
}
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
self.attachments.forEach(async (attachment) => {
|
||||
let blob = await self.getAttachmentContent(attachment.path)
|
||||
let file = new File([blob], attachment.name, { type: blob.type })
|
||||
|
||||
dropzone.displayExistingFile(file, attachment.path, () => {
|
||||
file.previewElement.querySelector("[data-dz-download]").href = attachment.downloadPath
|
||||
file.previewElement.querySelector("[data-dz-download]").classList.remove("d-none")
|
||||
})
|
||||
dropzone.on('maxfilesreached', function(file) {
|
||||
if (self.multiple) {
|
||||
this.disable();
|
||||
}
|
||||
})
|
||||
|
||||
if (self.preview == 'single' && self.attachments.length == 1)
|
||||
document.querySelector("#dropzone").classList.add("dz-max-files-reached");
|
||||
}, 750)
|
||||
}
|
||||
if (self.attachments.length) {
|
||||
setTimeout(() => {
|
||||
self.attachments.forEach(async (attachment) => {
|
||||
var mockFile = {
|
||||
id: attachment.id,
|
||||
name: attachment.name,
|
||||
size: attachment.size,
|
||||
type: attachment.type,
|
||||
download: attachment.downloadPath,
|
||||
dropzone: 'edit',
|
||||
};
|
||||
|
||||
dropzone.emit("addedfile", mockFile);
|
||||
dropzone.options.thumbnail.call(dropzone, mockFile, attachment.path);
|
||||
|
||||
// Make sure that there is no progress bar, etc...
|
||||
dropzone.emit("complete", mockFile);
|
||||
});
|
||||
|
||||
self.files.forEach(async (attachment) => {
|
||||
if (attachment.download) {
|
||||
attachment.previewElement.querySelector("[data-dz-download]").href = attachment.download;
|
||||
attachment.previewElement.querySelector("[data-dz-download]").classList.remove("d-none");
|
||||
}
|
||||
});
|
||||
|
||||
if (self.preview == 'single' && self.attachments.length == 1) {
|
||||
document.querySelector("#dropzone").classList.add("dz-max-files-reached");
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.dropzone = new Dropzone(this.$el, finalOptions);
|
||||
|
||||
preview.innerHTML = '';
|
||||
},
|
||||
async getAttachmentContent(imageUrl) {
|
||||
return await axios.get(imageUrl, { responseType: 'blob' }).then(function (response) {
|
||||
return response.data
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
async mounted() {
|
||||
|
@ -42,6 +42,7 @@ export default {
|
||||
data () {
|
||||
return {
|
||||
editor: null,
|
||||
editorValue: this.value,
|
||||
content: null,
|
||||
lastHtmlValue: '',
|
||||
editorId: null,
|
||||
@ -60,10 +61,10 @@ export default {
|
||||
}
|
||||
});
|
||||
|
||||
if (this.value.length > 0) {
|
||||
this.value = this.value.replace(new RegExp('<p><br></p>', 'g'), '<p> </p>');
|
||||
if (this.editorValue.length > 0) {
|
||||
this.editorValue = this.editorValue.replace(new RegExp('<p><br></p>', 'g'), '<p> </p>');
|
||||
|
||||
this.editor.pasteHTML(this.value);
|
||||
this.editor.pasteHTML(this.editorValue);
|
||||
}
|
||||
|
||||
let editorRef = this.$refs.editor;
|
||||
@ -89,9 +90,9 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
this.value = this.value.replace(new RegExp('<p><br></p>', 'g'), '<p> </p>');
|
||||
this.editorValue = this.editorValue.replace(new RegExp('<p><br></p>', 'g'), '<p> </p>');
|
||||
|
||||
this.editor.pasteHTML(this.value);
|
||||
this.editor.pasteHTML(this.editorValue);
|
||||
},
|
||||
|
||||
randomString() {
|
||||
@ -107,7 +108,7 @@ export default {
|
||||
},
|
||||
|
||||
async mounted () {
|
||||
this.content = this.value;
|
||||
this.content = this.editorValue;
|
||||
|
||||
this.editorId = this.randomString();
|
||||
this.toolbarId = this.randomString();
|
||||
@ -124,6 +125,12 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
editorValue (newVal) {
|
||||
if (newVal !== this.content) {
|
||||
this.pasteHTML(newVal);
|
||||
}
|
||||
},
|
||||
|
||||
content (newVal) {
|
||||
this.$emit('input', newVal);
|
||||
},
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
<span v-if="filter.operator" class="el-tag el-tag--primary el-tag--small el-tag--light el-tag-operator">
|
||||
<i v-if="filter.operator == '='" class="fas fa-equals"></i>
|
||||
<i v-else-if="filter.operator == '><'" class="fas fa-arrows-alt-h"></i>
|
||||
<i v-else class="fas fa-not-equal"></i>
|
||||
|
||||
<i v-if="!filter.value" class="el-tag__close el-icon-close" @click="onFilterDelete(index)"></i>
|
||||
@ -41,9 +42,9 @@
|
||||
class="form-control datepicker"
|
||||
:placeholder="placeholder"
|
||||
:ref="'input-search-date-field-' + _uid"
|
||||
v-model="search"
|
||||
value=""
|
||||
@focus="onInputFocus"
|
||||
@input="onInputDateSelected"
|
||||
@on-close="onInputDateSelected"
|
||||
@keyup.enter="onInputConfirm"
|
||||
>
|
||||
</flat-picker>
|
||||
@ -70,6 +71,10 @@
|
||||
<li ref="" class="dropdown-item">
|
||||
<button type="button" class="btn btn-link" @click="onOperatorSelected('!=')"><i class="fas fa-not-equal"></i><span class="btn-helptext d-none">{{ operatorIsNotText }}</span></button>
|
||||
</li>
|
||||
|
||||
<li v-if="range" ref="" class="dropdown-item">
|
||||
<button type="button" class="btn btn-link" @click="onOperatorSelected('><')"><i class="fas fa-arrows-alt-h"></i><span class="btn-helptext d-none">{{ operatorIsNotText }}</span></button>
|
||||
</li>
|
||||
</div>
|
||||
|
||||
<div :id="'search-field-value-' + _uid" class="dropdown-menu" :class="[{'show': visible.values}]">
|
||||
@ -159,6 +164,7 @@ export default {
|
||||
values: false,
|
||||
},
|
||||
|
||||
range: false,
|
||||
option_values: [],
|
||||
selected_options: [],
|
||||
selected_operator: [],
|
||||
@ -192,12 +198,24 @@ export default {
|
||||
console.log('Focus :' + this.filter_last_step);
|
||||
},
|
||||
|
||||
onInputDateSelected(event) {
|
||||
this.filtered[this.filter_index].value = event;
|
||||
onInputDateSelected(selectedDates, dateStr, instance) {
|
||||
this.filtered[this.filter_index].value = dateStr;
|
||||
|
||||
let date = instance.formatDate(selectedDates[0], 'Y-m-d');
|
||||
|
||||
if (selectedDates.length > 1) {
|
||||
let dates = [];
|
||||
|
||||
selectedDates.forEach(function (item) {
|
||||
dates.push(instance.formatDate(item, 'Y-m-d'));
|
||||
}, this);
|
||||
|
||||
date = dates.join('-to-');
|
||||
}
|
||||
|
||||
this.selected_values.push({
|
||||
key: event,
|
||||
value: event,
|
||||
key: date,
|
||||
value: dateStr,
|
||||
});
|
||||
|
||||
this.$emit('change', this.filtered);
|
||||
@ -225,8 +243,6 @@ export default {
|
||||
};
|
||||
}
|
||||
|
||||
this.show_date = false;
|
||||
|
||||
this.filter_last_step = 'options';
|
||||
},
|
||||
|
||||
@ -236,10 +252,22 @@ export default {
|
||||
let option_url = this.selected_options[this.filter_index].url;
|
||||
|
||||
if (this.search) {
|
||||
option_url += '?search="' + this.search + '" limit:10';
|
||||
if (option_url.indexOf('?') === -1) {
|
||||
option_url += '?search="' + this.search + '" limit:10';
|
||||
} else {
|
||||
if (option_url.indexOf('search=') === -1) {
|
||||
option_url += '&search="' + this.search + '" limit:10';
|
||||
} else {
|
||||
option_url += ' "' + this.search + '" limit:10';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (option_url) {
|
||||
if (option_url.indexOf('limit') === -1) {
|
||||
option_url += ' limit:10';
|
||||
}
|
||||
|
||||
window.axios.get(option_url)
|
||||
.then(response => {
|
||||
this.values = [];
|
||||
@ -287,7 +315,14 @@ export default {
|
||||
args += 'not ';
|
||||
}
|
||||
|
||||
args += this.selected_options[index].key + ':' + this.selected_values[index].key + ' ';
|
||||
if (this.selected_operator[index].key == '><') {
|
||||
let dates = this.selected_values[index].key.split('-to-');
|
||||
|
||||
args += this.selected_options[index].key + '>=' + dates[0] + ' ';
|
||||
args += this.selected_options[index].key + '<=' + dates[1] + ' ';
|
||||
} else {
|
||||
args += this.selected_options[index].key + ':' + this.selected_values[index].key + ' ';
|
||||
}
|
||||
|
||||
search_string[path][this.selected_options[index].key] = {
|
||||
'key': this.selected_values[index].key,
|
||||
@ -303,6 +338,7 @@ export default {
|
||||
|
||||
onOptionSelected(value) {
|
||||
this.current_value = value;
|
||||
this.range = false;
|
||||
|
||||
let option = false;
|
||||
let option_url = false;
|
||||
@ -323,6 +359,10 @@ export default {
|
||||
this.option_values[value] = this.filter_list[i].values;
|
||||
}
|
||||
|
||||
if (typeof this.filter_list[i].type !== 'undefined' && this.filter_list[i].type == 'date') {
|
||||
this.range = true;
|
||||
}
|
||||
|
||||
this.selected_options.push(this.filter_list[i]);
|
||||
this.filter_list.splice(i, 1);
|
||||
break;
|
||||
@ -349,6 +389,10 @@ export default {
|
||||
}
|
||||
|
||||
if (!this.option_values[value] && option_url) {
|
||||
if (option_url.indexOf('limit') === -1) {
|
||||
option_url += ' limit:10';
|
||||
}
|
||||
|
||||
window.axios.get(option_url)
|
||||
.then(response => {
|
||||
let data = response.data.data;
|
||||
@ -403,6 +447,9 @@ export default {
|
||||
this.show_date = true;
|
||||
|
||||
this.$nextTick(() => {
|
||||
let mode = this.selected_operator[this.filter_index].key == '><' ? 'range' : 'single';
|
||||
|
||||
this.$refs['input-search-date-field-' + this._uid].fp.set('mode', mode);
|
||||
this.$refs['input-search-date-field-' + this._uid].fp.open();
|
||||
});
|
||||
|
||||
@ -534,6 +581,9 @@ export default {
|
||||
}
|
||||
|
||||
if (this.value) {
|
||||
this.value = this.value.replace(/\s+[a-zA-Z\w]+[<=]+/g, '-to-');
|
||||
this.value = this.value.replace('>=', ':');
|
||||
|
||||
let search_string = this.value.replace('not ', '').replace(' not ', ' ');
|
||||
|
||||
console.log(search_string);
|
||||
@ -542,7 +592,7 @@ export default {
|
||||
|
||||
search_string.forEach(function (string) {
|
||||
if (string.search(':') === -1) {
|
||||
this.search = string.replace(new RegExp("[" + '"' + "]*$"), '');
|
||||
this.search = string.replace(/[\"]+/g, '');
|
||||
} else {
|
||||
let filter = string.split(':');
|
||||
let option = '';
|
||||
|
@ -294,10 +294,12 @@ export default {
|
||||
},
|
||||
|
||||
created() {
|
||||
let created_options = (this.dynamicOptions) ? this.dynamicOptions : this.options;
|
||||
|
||||
if (this.group) {
|
||||
// Option set sort_option data
|
||||
if (!Array.isArray(this.options)) {
|
||||
for (const [index, options] of Object.entries(this.options)) {
|
||||
if (!Array.isArray(created_options)) {
|
||||
for (const [index, options] of Object.entries(created_options)) {
|
||||
let values = [];
|
||||
|
||||
for (const [key, value] of Object.entries(options)) {
|
||||
@ -313,7 +315,7 @@ export default {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.options.forEach(function (option, index) {
|
||||
created_options.forEach(function (option, index) {
|
||||
if (typeof(option) == 'string') {
|
||||
this.sort_options.push({
|
||||
index: index,
|
||||
@ -331,15 +333,15 @@ export default {
|
||||
}
|
||||
} else {
|
||||
// Option set sort_option data
|
||||
if (!Array.isArray(this.options)) {
|
||||
for (const [key, value] of Object.entries(this.options)) {
|
||||
if (!Array.isArray(created_options)) {
|
||||
for (const [key, value] of Object.entries(created_options)) {
|
||||
this.sort_options.push({
|
||||
key: key,
|
||||
value: value
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.options.forEach(function (option, index) {
|
||||
created_options.forEach(function (option, index) {
|
||||
if (typeof(option) == 'string') {
|
||||
this.sort_options.push({
|
||||
index: index,
|
||||
@ -765,7 +767,7 @@ export default {
|
||||
dynamicOptions: function(options) {
|
||||
this.sort_options = [];
|
||||
this.selected = '';
|
||||
|
||||
|
||||
if (this.group) {
|
||||
// Option set sort_option data
|
||||
if (!Array.isArray(options)) {
|
||||
|
@ -466,11 +466,14 @@ export default {
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
|
||||
setSortOptions() {
|
||||
let created_options = (this.dynamicOptions) ? this.dynamicOptions : this.options;
|
||||
|
||||
if (this.group) {
|
||||
// Option set sort_option data
|
||||
if (!Array.isArray(this.options)) {
|
||||
for (const [index, options] of Object.entries(this.options)) {
|
||||
if (!Array.isArray(created_options)) {
|
||||
for (const [index, options] of Object.entries(created_options)) {
|
||||
let values = [];
|
||||
|
||||
for (const [key, value] of Object.entries(options)) {
|
||||
@ -486,7 +489,7 @@ export default {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.options.forEach(function (option, index) {
|
||||
created_options.forEach(function (option, index) {
|
||||
this.sort_options.push({
|
||||
index: index,
|
||||
key: option.id,
|
||||
@ -496,15 +499,15 @@ export default {
|
||||
}
|
||||
} else {
|
||||
// Option set sort_option data
|
||||
if (!Array.isArray(this.options)) {
|
||||
for (const [key, value] of Object.entries(this.options)) {
|
||||
if (!Array.isArray(created_options)) {
|
||||
for (const [key, value] of Object.entries(created_options)) {
|
||||
this.sort_options.push({
|
||||
key: key,
|
||||
value: value
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.options.forEach(function (option, index) {
|
||||
created_options.forEach(function (option, index) {
|
||||
this.sort_options.push({
|
||||
index: index,
|
||||
key: option.id,
|
||||
@ -956,7 +959,7 @@ export default {
|
||||
dynamicOptions: function(options) {
|
||||
this.sort_options = [];
|
||||
this.selected = '';
|
||||
|
||||
|
||||
if (this.group) {
|
||||
// Option set sort_option data
|
||||
if (!Array.isArray(options)) {
|
||||
|
Reference in New Issue
Block a user