Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change index.js (createApp), ondestroy, emits #267

Merged
merged 1 commit into from
Feb 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,904 changes: 2,178 additions & 726 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 13 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-hotel-datepicker",
"version": "4.3.0",
"version": "5.0.0",
"description": "A responsive date range picker for Vue.js that displays the number of nights selected and allow several useful options like custom check-in/check-out rules, localization support and more",
"author": "krystalcampioni <[email protected]>",
"main": "dist/vueHotelDatepicker.common.js",
Expand Down Expand Up @@ -39,25 +39,27 @@
"dependencies": {
"fecha": "^4.2.0",
"lodash.throttle": "^4.1.1",
"vue": "^2.6.12"
"vue": "^3.0.5",
"vue-loader": "^16.1.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.10",
"@vue/cli-plugin-eslint": "~4.5.10",
"@vue/cli-plugin-unit-jest": "~4.5.10",
"@vue/cli-service": "~4.5.10",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-unit-jest": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"@vue/eslint-config-airbnb": "^5.3.0",
"@vue/eslint-config-prettier": "^6.0.0",
"@vue/test-utils": "^1.1.2",
"@vue/test-utils": "^2.0.0-rc.1",
"babel-eslint": "^10.1.0",
"chai": "^4.2.0",
"core-js": "^3.8.2",
"eslint": "^6.8.0",
"eslint": "^6.7.2",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-vue": "^6.2.2",
"eslint-plugin-vue": "^7.0.0-0",
"prettier": "^2.2.1",
"sass": "^1.32.4",
"sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.12"
"sass-loader": "^8.0.2"
}
}
56 changes: 28 additions & 28 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,42 +18,42 @@
<div :class="['menu', { hidden: !menu }]">
<h3>Examples</h3>
<ul>
<li @click="selectBox(0)" :class="{ selected: boxShow == 0 }">Sandbox</li>
<li @click="selectBox(8)" :class="{ selected: boxShow == 8 }">
<li @click="selectBox(0)" :class="{ selected: boxShow === 0 }">Sandbox</li>
<li @click="selectBox(8)" :class="{ selected: boxShow === 8 }">
Blocked different day when clicked on with <strong>periodDates</strong>
</li>
<li @click="selectBox(9)" :class="{ selected: boxShow == 9 }">
<li @click="selectBox(9)" :class="{ selected: boxShow === 9 }">
Half day, If you have check in at noon and checkout before noon
</li>
<li @click="selectBox(10)" :class="{ selected: boxShow == 10 }">
<li @click="selectBox(10)" :class="{ selected: boxShow === 10 }">
Disable check-in and check-out on the same day
</li>
<li @click="selectBox(11)" :class="{ selected: boxShow == 11 }">Allow selection of single day</li>
<li @click="selectBox(12)" :class="{ selected: boxShow == 12 }">
<li @click="selectBox(11)" :class="{ selected: boxShow === 11 }">Allow selection of single day</li>
<li @click="selectBox(12)" :class="{ selected: boxShow === 12 }">
Check in only on saturday and minimum stay of 10 nights
</li>
<li @click="selectBox(13)" :class="{ selected: boxShow == 13 }">
<li @click="selectBox(13)" :class="{ selected: boxShow === 13 }">
Block all dates after December 31st of {{ new Date().getUTCFullYear() }}
</li>
<li @click="selectBox(14)" :class="{ selected: boxShow == 14 }">Block all dates after 15th of next month</li>
<li @click="selectBox(15)" :class="{ selected: boxShow == 15 }">
<li @click="selectBox(14)" :class="{ selected: boxShow === 14 }">Block all dates after 15th of next month</li>
<li @click="selectBox(15)" :class="{ selected: boxShow === 15 }">
Block all date ranges of more than 30 days
</li>
<li @click="selectBox(16)" :class="{ selected: boxShow == 16 }">Minimum stay of 3 days</li>
<li @click="selectBox(17)" :class="{ selected: boxShow == 17 }">Certain dates blocked</li>
<li @click="selectBox(18)" :class="{ selected: boxShow == 18 }">Allow setting a default date range</li>
<li @click="selectBox(19)" :class="{ selected: boxShow == 19 }">Checkin only on saturdays</li>
<li @click="selectBox(20)" :class="{ selected: boxShow == 20 }">Custom tooltip text</li>
<li @click="selectBox(22)" :class="{ selected: boxShow == 22 }">Custom date format (MMMM D)</li>
<li @click="selectBox(24)" :class="{ selected: boxShow == 24 }">Set startingDateValue value</li>
<li @click="selectBox(25)" :class="{ selected: boxShow == 25 }">Set endingDateValue value</li>
<li @click="selectBox(26)" :class="{ selected: boxShow == 26 }">
<li @click="selectBox(16)" :class="{ selected: boxShow === 16 }">Minimum stay of 3 days</li>
<li @click="selectBox(17)" :class="{ selected: boxShow === 17 }">Certain dates blocked</li>
<li @click="selectBox(18)" :class="{ selected: boxShow === 18 }">Allow setting a default date range</li>
<li @click="selectBox(19)" :class="{ selected: boxShow === 19 }">Checkin only on saturdays</li>
<li @click="selectBox(20)" :class="{ selected: boxShow === 20 }">Custom tooltip text</li>
<li @click="selectBox(22)" :class="{ selected: boxShow === 22 }">Custom date format (MMMM D)</li>
<li @click="selectBox(24)" :class="{ selected: boxShow === 24 }">Set startingDateValue value</li>
<li @click="selectBox(25)" :class="{ selected: boxShow === 25 }">Set endingDateValue value</li>
<li @click="selectBox(26)" :class="{ selected: boxShow === 26 }">
Event startingDateValue (check-in-changed) / endingDateValue (check-out-changed)
</li>
</ul>
</div>
<div v-show="!menu || currentWidth > 1184" class="box-container">
<div v-if="boxShow == 0" class="box">
<div v-if="boxShow === 0" class="box">
<h3>Sandbox</h3>
<div style="width: 48%; display: inline-block">
<input type="checkbox" v-model="firstDayOfWeek" :true-value="1" :false-value="0" /> First day Monday<br />
Expand Down Expand Up @@ -111,7 +111,7 @@
</div>
</DatePicker>
</div>
<div v-if="boxShow == 8" class="box">
<div v-if="boxShow === 8" class="box">
<h3>
Blocked different day when clicked on with <strong>periodDates</strong>&nbsp;
<span style="font-weight: 400">Emit day-clicked</span>
Expand Down Expand Up @@ -154,15 +154,15 @@
]"
/>
</div>
<div v-if="boxShow == 10" class="box">
<div v-if="boxShow === 10" class="box">
<h3>Disable check-in and check-out on the same day</h3>
<DatePicker :disableCheckoutOnCheckin="true" :minNights="1" :i18n="i18n" />
</div>
<div v-if="boxShow == 11" class="box">
<div v-if="boxShow === 11" class="box">
<h3>Allow selection of single day</h3>
<DatePicker :singleDaySelection="true" :i18n="i18n" />
</div>
<div v-if="boxShow == 12" class="box">
<div v-if="boxShow === 12" class="box">
<h3>Check in only on saturday and minimum stay of 10 nights</h3>
<DatePicker
:disabledWeekDays="{
Expand All @@ -177,19 +177,19 @@
:enableCheckout="true"
/>
</div>
<div v-if="boxShow == 13" class="box">
<div v-if="boxShow === 13" class="box">
<h3>Block all dates after December 31st of the current year</h3>
<DatePicker :endDate="new Date(new Date().getFullYear(), 11, 31)" :i18n="i18n" />
</div>
<div v-if="boxShow == 14" class="box">
<div v-if="boxShow === 14" class="box">
<h3>Block all dates after 15th of next month</h3>
<DatePicker :endDate="new Date(new Date().getFullYear(), new Date().getMonth() + 1, 15)" :i18n="i18n" />
</div>
<div v-if="boxShow == 15" class="box">
<div v-if="boxShow === 15" class="box">
<h3>Block all date ranges of more than 30 days</h3>
<DatePicker :maxNights="30" :selectForward="false" :i18n="i18n" />
</div>
<div v-if="boxShow == 16" class="box">
<div v-if="boxShow === 16" class="box">
<h3>Minimum stay of 3 days</h3>
<DatePicker :minNights="3" :i18n="i18n" />
</div>
Expand Down Expand Up @@ -246,7 +246,7 @@
:i18n="i18n"
/>
</div>
<div v-if="boxShow == 26" class="box">
<div v-if="boxShow === 26" class="box">
<h3>Event startingDateValue / endingDateValue</h3>
<DatePicker :i18n="i18n" @check-in-changed="checkIn = $event" @check-out-changed="checkOut = $event" />
<p>new startingDateValue Date: {{ checkIn }}</p>
Expand Down
25 changes: 23 additions & 2 deletions src/DatePicker/HotelDatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,27 @@ export default {
default: false,
},
},
emits: [
'input',
'check-in-changed',
'starting-date-changed',
'check-out-changed',
'first-day-of-week-changed',
'booking-clicked',
'bookingClicked',
'enter-month',
'enter-day',
'period-selected',
'periodSelected',
'day-clicked',
'dayClicked',
'height-changed',
'clear-selection',
'handle-checkin-checkout-half-day',
'handleCheckinCheckoutHalfDay',
'ending-date-changed',
'onEnding-date-changed',
],
data() {
return {
activeMonthIndex: 0,
Expand Down Expand Up @@ -650,7 +671,7 @@ export default {
})
this.createHalfDayDates(this.baseHalfDayDates)
},
destroyed() {
unmounted() {
window.removeEventListener('resize', this.handleWindowResize)

if (!this.isDesktop) {
Expand Down Expand Up @@ -1239,7 +1260,7 @@ export default {

this.createMonth(nextMonth)
this.activeMonthIndex++
this.$emit('next-month-rendered', nextMonth)
this.$emit('clear-selection', nextMonth)
}, 350),
setCheckIn(date) {
this.checkIn = date
Expand Down
1 change: 1 addition & 0 deletions src/DatePicker/components/Day.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export default {
type: String,
},
},
emits: ['booking-clicked', 'clear-selection', 'day-clicked'],
data() {
return {
currentDate: new Date(),
Expand Down
1 change: 1 addition & 0 deletions src/DatePicker/components/Month.vue
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export default {
type: String,
},
},
emits: ['enter-day', 'enter-month', 'clear-selection', 'booking-clicked', 'day-clicked'],
computed: {
monthName() {
return this.getMonth(this.month.days[15].date)
Expand Down
8 changes: 3 additions & 5 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import Vue from 'vue'
import { createApp } from 'vue'
import App from './App.vue'

Vue.config.productionTip = false
const app = createApp(App)

new Vue({
render: (h) => h(App),
}).$mount('#app')
app.mount('#app')
Loading