Refactor prop name

pull/12/head
cagataycivici 2019-05-21 14:28:31 +03:00
parent 597edc6bb3
commit 4ff5e1b75b
3 changed files with 19 additions and 16 deletions

View File

@ -1,6 +1,6 @@
<template>
<span :class="containerClass">
<CalendarInputText ref="input" v-if="!inline" type="text" v-bind="$attrs" v-on="listeners" :value="inputFieldValue" :readonly="!manualEntry" />
<CalendarInputText ref="input" v-if="!inline" type="text" v-bind="$attrs" v-on="listeners" :value="inputFieldValue" :readonly="!manualInput" />
<CalendarButton v-if="showIcon" :icon="icon" tabindex="-1" class="p-datepicker-trigger p-calendar-button" :disabled="$attrs.disabled" @click="onButtonClick" />
<transition name="p-input-overlay" @enter="onOverlayEnter" @leave="onOverlayLeave">
<div ref="overlay" :class="panelStyleClass" v-if="inline ? true : overlayVisible">
@ -285,7 +285,7 @@ export default {
type: Boolean,
default: false
},
manualEntry: {
manualInput: {
type: Boolean,
default: true
},
@ -514,7 +514,7 @@ export default {
navBackward(event) {
event.preventDefault();
if (this.$attrs.disabled) {
if (!this.isEnabled()) {
return;
}
@ -536,7 +536,7 @@ export default {
navForward(event) {
event.preventDefault();
if (this.$attrs.disabled) {
if (!this.isEnabled()) {
return;
}
@ -561,6 +561,9 @@ export default {
incrementYear() {
this.currentYear++;
},
isEnabled() {
return !this.$attrs.disabled && !this.$attrs.readonly;
},
updateCurrentTimeMeta(date) {
const hours = date.getHours();
@ -908,13 +911,13 @@ export default {
event.preventDefault();
},
onTimePickerElementMouseDown(event, type, direction) {
if (!this.$attrs.disabled) {
if (this.isEnabled()) {
this.repeat(event, null, type, direction);
event.preventDefault();
}
},
onTimePickerElementMouseUp(event) {
if (!this.$attrs.disabled) {
if (this.isEnabled()) {
this.clearTimePickerTimer();
this.updateModelTime();
event.preventDefault();
@ -1466,7 +1469,7 @@ export default {
},
focus: event => {
$vm.focus = true;
if ($vm.showOnFocus) {
if ($vm.showOnFocus && $vm.isEnabled()) {
$vm.overlayVisible = true;
}
$vm.$emit('focus', event)

View File

@ -23,11 +23,11 @@
</div>
<div class="p-col-12 p-md-4">
<h3>Min-Max</h3>
<Calendar v-model="date4" :minDate="minDate" :maxDate="maxDate" :manualEntry="false" />
<Calendar v-model="date4" :minDate="minDate" :maxDate="maxDate" :manualInput="false" />
</div>
<div class="p-col-12 p-md-4">
<h3>Disable Days</h3>
<Calendar v-model="date5" :disabledDates="invalidDates" :disabledDays="[0,6]" :manualEntry="false" />
<Calendar v-model="date5" :disabledDates="invalidDates" :disabledDays="[0,6]" :manualInput="false" />
</div>
<div class="p-col-12 p-md-4">
<h3>Navigators</h3>
@ -35,11 +35,11 @@
</div>
<div class="p-col-12 p-md-4">
<h3>Multiple</h3>
<Calendar v-model="dates1" selectionMode="multiple" :manualEntry="false" />
<Calendar v-model="dates1" selectionMode="multiple" :manualInput="false" />
</div>
<div class="p-col-12 p-md-4">
<h3>Range</h3>
<Calendar v-model="dates2" selectionMode="range" :manualEntry="false" />
<Calendar v-model="dates2" selectionMode="range" :manualInput="false" />
</div>
<div class="p-col-12 p-md-4">
<h3>Button Bar</h3>

View File

@ -401,7 +401,7 @@ export default {
<td>When enabled, calendar will show week numbers.</td>
</tr>
<tr>
<td>manualEntry</td>
<td>manualInput</td>
<td>boolean</td>
<td>true</td>
<td>Wheter to allow prevents entering the date manually via typing.</td>
@ -563,11 +563,11 @@ export default {
&lt;/div&gt;
&lt;div class=&quot;p-col-12 p-md-4&quot;&gt;
&lt;h3&gt;Min-Max&lt;/h3&gt;
&lt;Calendar v-model=&quot;date4&quot; :minDate=&quot;minDate&quot; :maxDate=&quot;maxDate&quot; :readonly=&quot;true&quot; /&gt;
&lt;Calendar v-model=&quot;date4&quot; :minDate=&quot;minDate&quot; :maxDate=&quot;maxDate&quot; :manualInput=&quot;false&quot; /&gt;
&lt;/div&gt;
&lt;div class=&quot;p-col-12 p-md-4&quot;&gt;
&lt;h3&gt;Disable Days&lt;/h3&gt;
&lt;Calendar v-model=&quot;date5&quot; :disabledDates=&quot;invalidDates&quot; :disabledDays=&quot;[0,6]&quot; :readonly=&quot;true&quot; /&gt;
&lt;Calendar v-model=&quot;date5&quot; :disabledDates=&quot;invalidDates&quot; :disabledDays=&quot;[0,6]&quot; :manualInput=&quot;false&quot; /&gt;
&lt;/div&gt;
&lt;div class=&quot;p-col-12 p-md-4&quot;&gt;
&lt;h3&gt;Navigators&lt;/h3&gt;
@ -575,11 +575,11 @@ export default {
&lt;/div&gt;
&lt;div class=&quot;p-col-12 p-md-4&quot;&gt;
&lt;h3&gt;Multiple&lt;/h3&gt;
&lt;Calendar v-model=&quot;dates1&quot; selectionMode=&quot;multiple&quot; :readonly=&quot;true&quot; /&gt;
&lt;Calendar v-model=&quot;dates1&quot; selectionMode=&quot;multiple&quot; :manualInput=&quot;false&quot; /&gt;
&lt;/div&gt;
&lt;div class=&quot;p-col-12 p-md-4&quot;&gt;
&lt;h3&gt;Range&lt;/h3&gt;
&lt;Calendar v-model=&quot;dates2&quot; selectionMode=&quot;range&quot; :readonly=&quot;true&quot; /&gt;
&lt;Calendar v-model=&quot;dates2&quot; selectionMode=&quot;range&quot; :manualInput=&quot;false&quot; /&gt;
&lt;/div&gt;
&lt;div class=&quot;p-col-12 p-md-4&quot;&gt;
&lt;h3&gt;Button Bar&lt;/h3&gt;