From 099a0538e46a038e2be39aa14dc62cf052665774 Mon Sep 17 00:00:00 2001 From: Nathan Reyes Date: Wed, 13 Dec 2017 13:41:32 -0600 Subject: [PATCH 1/3] Removes Vue scope dependency. Closes #23 --- CHANGELOG.md | 4 ++++ package.json | 2 +- src/components/DateRangePicker.vue | 2 +- src/components/MultipleDatePicker.vue | 2 +- src/components/SingleDatePicker.vue | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5094d415b..83e5d28a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.4.1 +* Use local nextTick reference, deleting Vue scope dependency. +* Fix null attribute bug in date picker. + ## 0.4.0 * Fix weekday labels not always having same exact width * Add support for complex attribute dates. Closes #7 and #12. diff --git a/package.json b/package.json index 73393601e..d3320f038 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "v-calendar", - "version": "0.4.0", + "version": "0.4.1", "description": "A clean and extendable plugin for building simple attributed calendars in Vue.js.", "keywords": [ "vue", diff --git a/src/components/DateRangePicker.vue b/src/components/DateRangePicker.vue index 3b7aeb206..726dd084f 100755 --- a/src/components/DateRangePicker.vue +++ b/src/components/DateRangePicker.vue @@ -56,7 +56,7 @@ export default { }; }, attributes_() { - const attributes = [...this.attributes]; + const attributes = [...(this.attributes || [])]; if (this.dragAttribute_) attributes.push(this.dragAttribute_); else if (this.selectAttribute_) attributes.push(this.selectAttribute_); if (this.disabledAttribute) attributes.push(this.disabledAttribute); diff --git a/src/components/MultipleDatePicker.vue b/src/components/MultipleDatePicker.vue index d8e03616c..5d6531144 100755 --- a/src/components/MultipleDatePicker.vue +++ b/src/components/MultipleDatePicker.vue @@ -33,7 +33,7 @@ export default { }; }, attributes_() { - const attributes = [...this.attributes]; + const attributes = [...(this.attributes || [])]; if (this.selectAttribute_) attributes.push(this.selectAttribute_); if (this.disabledAttribute) attributes.push(this.disabledAttribute); return attributes; diff --git a/src/components/SingleDatePicker.vue b/src/components/SingleDatePicker.vue index f78a711cd..0ce08752c 100755 --- a/src/components/SingleDatePicker.vue +++ b/src/components/SingleDatePicker.vue @@ -33,7 +33,7 @@ export default { }; }, attributes_() { - const attributes = [...this.attributes]; + const attributes = [...(this.attributes || [])]; if (this.selectAttribute_) attributes.push(this.selectAttribute_); if (this.disabledAttribute) attributes.push(this.disabledAttribute); return attributes; From bfd95bbd6b65287074df2fe430b6c7c23a3ffc02 Mon Sep 17 00:00:00 2001 From: Nathan Reyes Date: Wed, 13 Dec 2017 20:00:12 -0600 Subject: [PATCH 2/3] Add CONTRIBUTING.md --- CONTRIBUTING.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..1ec9b16d3 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,27 @@ +## Welcome +Thanks for your interest in contributing to this project. As you may have noticed, this project is currently in Beta, but for me this is the perfect opportunity to collect ideas on how to make a better calendar component plugin. + +This is currently a one-person project but I'll try and respond as quickly as possible. Also, this project is my first foray into the wide world of open source, so please understand that if you find something obvious related to handling issues, pull requests and the like, it is probably because of my lack of experience with sharing code and open source in general. Thanks for your patience! + +## First things first +If you haven't done so, check out the [README](https://github.com/nathanreyes/v-calendar/blob/master/README.md) for a quick rundown of project, as well as the [website](https://vcalendar.netlify.com) where you can find detailed information on the project API, try out demonstrations and get an overall feel for how things work. If you have an idea or find a bug, please reference if it can be recreated on the website. That will be the quickest way to track down the problem. + +## Contributing +At this stage, the project is still in flux so if you set out to make big changes, chances are things might be moved around quite a bit. With that said, the best contributions to be made at this stage are things like typos, coding efficiencies, localization support and bugs. Also, github issues make the most sense for everything right now, so feel free to use them for bugs, enhancements and discussions. For bigger ideas, here are some other goals that might help guide your contributions: + +### Utilization of the attribute concept +I want to minimize the API as much as possible, so try to present any new concepts within the concept of the current API. For example, attributes are the core concept of `v-calendar`, so try and augment the way they are structured before trying to introduce a new prop on the base component. + +### Keep calendar layout to a minimum +There are lots of great calendar concepts out there. The core idea with this project is that it should be *possible* to implement those ideas with `v-calendar`, but that it' default design should be as neutral as feasibly possible. + +### Simple and clean designs +Reasonable margins. Symmetrical layout. Subtle animations. You get the point :) + +### Testing +Testing environment is currently in the works... + +## EXAMPLES WANTED! +If you have used this plugin to make something great, I'd love to see it and perhaps include a link to it from the docs site. + +Again, thanks for your interest and happing coding. :) From 2c4489da2039cccf0d449d3b1c90bb5d1e020e45 Mon Sep 17 00:00:00 2001 From: luca Date: Thu, 14 Dec 2017 16:53:52 +0100 Subject: [PATCH 3/3] use events name in lowercase --- src/components/Calendar.vue | 4 ++-- src/components/CalendarDay.vue | 8 ++++---- src/components/DatePicker.vue | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/Calendar.vue b/src/components/Calendar.vue index 46e7eacc7..00181f203 100755 --- a/src/components/Calendar.vue +++ b/src/components/Calendar.vue @@ -100,13 +100,13 @@ export default { this.refreshToPage(); }, fromPage_(val) { - this.$emit('update:fromPage', val); + this.$emit('update:frompage', val); if (!pageIsBeforePage(val, this.toPage_)) { this.toPage_ = getNextPage(val); } }, toPage_(val) { - this.$emit('update:toPage', val); + this.$emit('update:topage', val); if (!pageIsAfterPage(val, this.fromPage_)) { this.fromPage_ = getPrevPage(val); } diff --git a/src/components/CalendarDay.vue b/src/components/CalendarDay.vue index c28c9dda9..69947a6b7 100755 --- a/src/components/CalendarDay.vue +++ b/src/components/CalendarDay.vue @@ -170,21 +170,21 @@ export default { Math.abs(state.x - state.startX) <= defaults.maxTapTolerance && Math.abs(state.y - state.startY) <= defaults.maxTapTolerance; if (state.tapDetected) { - this.$emit('daySelect', this.dayInfo, this.attributesMap); + this.$emit('dayselect', this.dayInfo, this.attributesMap); } state.started = false; }, click() { if (this.touchState && this.touchState.tapDetected) return; - this.$emit('daySelect', this.dayInfo, this.attributesMap); + this.$emit('dayselect', this.dayInfo, this.attributesMap); }, mouseenter() { this.isHovered = true; - this.$emit('dayMouseEnter', this.dayInfo, this.attributesMap); + this.$emit('daymouseenter', this.dayInfo, this.attributesMap); }, mouseleave() { this.isHovered = false; - this.$emit('dayMouseLeave', this.dayInfo, this.attributesMap); + this.$emit('daymouseleave', this.dayInfo, this.attributesMap); }, processAttributes() { const backgrounds = []; diff --git a/src/components/DatePicker.vue b/src/components/DatePicker.vue index e8de66f78..0a84ce723 100755 --- a/src/components/DatePicker.vue +++ b/src/components/DatePicker.vue @@ -153,10 +153,10 @@ export default { this.toPage_ = val; }, fromPage_(val) { - this.$emit('update:fromPage', val); + this.$emit('update:frompage', val); }, toPage_(val) { - this.$emit('update:toPage', val); + this.$emit('update:topage', val); }, mode() { // Clear value on select mode change @@ -184,8 +184,8 @@ export default { filteredListeners() { // Remove parent listeners that we want to intercept and re-broadcast const listeners = { ...this.$listeners }; - delete listeners['update:fromPage']; - delete listeners['update:toPage']; + delete listeners['update:frompage']; + delete listeners['update:topage']; return listeners; }, popoverDidDisappear() {