pull/1533/head
Cagatay Civici 2021-08-27 11:09:46 +03:00
commit 648e6cf4a2
8 changed files with 31 additions and 9 deletions

View File

@ -245,6 +245,12 @@ const CalendarProps = [
type: "any",
default: "null",
description: "Inline style of the component."
},
{
name: "keepInvalid",
type: "boolean",
default: "false",
description: "Keep invalid value when input blur."
}
];

View File

@ -43,7 +43,7 @@
z-index: 1;
&:hover {
background-color: rgba(255, 255, 255, 0.25);
background-color: rgba(0, 0, 0, 0.25);
}
}
}

View File

@ -42,6 +42,7 @@ interface CalendarProps {
inputClass?: string;
style?: any;
class?: string;
keepInvalid?: boolean;
}
declare class Calendar {

View File

@ -289,6 +289,10 @@ export default {
type: String,
default: 'body'
},
keepInvalid: {
type: Boolean,
default: false
},
inputClass: null,
inputStyle: null,
class: null,
@ -1936,7 +1940,9 @@ export default {
}
}
catch(err) {
this.updateModel(event.target.value);
// invalid date
let value = this.keepInvalid ? event.target.value : null;
this.updateModel(value);
}
},
onFocus() {
@ -1998,7 +2004,7 @@ export default {
return propValue || new Date();
},
inputFieldValue() {
return this.formatValue(this.modelValue);
return this.keepInvalid ? this.modelValue : this.formatValue(this.modelValue);
},
containerClass() {
return [

View File

@ -534,7 +534,7 @@ export default {
clearTimeout(this.searchTimeout);
}
const char = String.fromCharCode(event.keyCode);
const char = event.key;
this.previousSearchChar = this.currentSearchChar;
this.currentSearchChar = char;

View File

@ -11,7 +11,7 @@
</div>
<div ref="content" class="p-fileupload-content" @dragenter="onDragEnter" @dragover="onDragOver" @dragleave="onDragLeave" @drop="onDrop">
<FileUploadProgressBar :value="progress" v-if="hasFiles" />
<FileUploadMessage v-for="msg of messages" severity="error" :key="msg">{{msg}}</FileUploadMessage>
<FileUploadMessage v-for="msg of messages" severity="error" :key="msg" @close="onMessageClose">{{msg}}</FileUploadMessage>
<div class="p-fileupload-files" v-if="hasFiles">
<div class="p-fileupload-row" v-for="(file, index) of files" :key="file.name + file.type + file.size">
<div>
@ -30,7 +30,7 @@
</div>
</div>
<div class="p-fileupload p-fileupload-basic p-component" v-else-if="isBasic">
<FileUploadMessage v-for="msg of messages" severity="error" :key="msg">{{msg}}</FileUploadMessage>
<FileUploadMessage v-for="msg of messages" severity="error" :key="msg" @close="onMessageClose">{{msg}}</FileUploadMessage>
<span :class="basicChooseButtonClass" :style="style" @mouseup="onBasicUploaderClick" @keydown.enter="choose" @focus="onFocus" @blur="onBlur" v-ripple tabindex="0" >
<span :class="basicChooseButtonIconClass"></span>
<span class="p-button-label">{{basicChooseButtonLabel}}</span>
@ -397,6 +397,9 @@ export default {
if (this.isFileLimitExceeded()) {
this.messages.push(this.invalidFileLimitMessage.replace('{0}', this.fileLimit.toString()))
}
},
onMessageClose() {
this.messages = null;
}
},
computed: {

View File

@ -827,7 +827,7 @@ export default {
this.$refs.input.$el.setAttribute('aria-valuenow', value);
},
concatValues(val1, val2) {
if (val1 !== null && val2 !== null) {
if (val1 && val2) {
let decimalCharIndex = val2.search(this._decimal);
this._decimal.lastIndex = 0;

View File

@ -420,6 +420,12 @@ export default {
<td>null</td>
<td>Style class of the component.</td>
</tr>
<tr>
<td>keepInvalid</td>
<td>boolean</td>
<td>false</td>
<td>Keep invalid value when input blur.</td>
</tr>
</tbody>
</table>
</div>
@ -802,7 +808,7 @@ export default {
let prevYear = (prevMonth === 11) ? year - 1 : year;
let nextMonth = (month === 11) ? 0 : month + 1;
let nextYear = (nextMonth === 0) ? year + 1 : year;
const minDate = ref(new Date());
const maxDate = ref(new Date());
const invalidDates = ref();
@ -832,7 +838,7 @@ export default {
invalidDate.setDate(today.getDate() - 1);
invalidDates.value = [today, invalidDate];
return { minDate, maxDate, invalidDates, date1, date2, date3, date4, date5, date6, date7,
return { minDate, maxDate, invalidDates, date1, date2, date3, date4, date5, date6, date7,
date8, date9, date10, date11, date12, date13, date14, dates1, dates2 }
}
}