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

Fix event listeners #27

Merged
merged 3 commits into from
Dec 15, 2017
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
27 changes: 27 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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. :)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/components/Calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions src/components/CalendarDay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down
8 changes: 4 additions & 4 deletions src/components/DatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/DateRangePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/components/MultipleDatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/components/SingleDatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down