Skip to content

Implements control to action buttons and styles #129

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
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
42 changes: 35 additions & 7 deletions vue-datepicker-1.vue
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,13 @@ table {
<li v-for="weekie in library.week">{{weekie}}</li>
</ul>
</div>
<div class="day" v-for="day in dayList" track-by="$index" @click="checkDay(day)" :class="{'checked':day.checked,'unavailable':day.unavailable,'passive-day': !(day.inMonth)}" :style="day.checked ? (option.color && option.color.checkedDay ? { background: option.color.checkedDay } : { background: '#F50057' }) : {}">{{day.value}}</div>
<div class="day"
v-for="day in dayList"
track-by="$index"
@click="checkDay(day)"
:class="{'checked':day.checked,'unavailable':day.unavailable,'passive-day': !(day.inMonth)}"
:style="day.checked ? (option.color && option.color.checkedDay ? { background: option.color.checkedDay } : { background: '#F50057' }) : {}">{{day.value}}
</div>
</div>
</div>
<div class="cov-date-box list-box" v-if="showInfo.year">
Expand Down Expand Up @@ -421,8 +427,8 @@ table {
</div>
</div>
<div class="button-box">
<span @click="showInfo.check=false">{{option.buttons? option.buttons.cancel : 'Cancel' }}</span>
<span @click="picked">{{option.buttons? option.buttons.ok : 'Ok'}}</span>
<span v-if="option.cancelAction ? option.cancelAction : false" @click="showInfo.check=false" :style="option.buttonCancelStyle ? option.buttonCancelStyle : {}">{{option.buttons? option.buttons.cancel : 'Cancel' }}</span>
<span v-if="option.successAction ? option.successAction : false" @click="picked" :style="option.buttonSuccessStyle ? option.buttonSuccessStyle : {}">{{option.buttons? option.buttons.ok : 'Ok'}}</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -472,15 +478,26 @@ exports.default = {
'border-radius': '2px',
'color': '#5F5F5F'
},
buttonCancelStyle: {
'color': '#d9534f'
},
buttonSuccessStyle: {
'color': '#fff',
'background-color': '#226b32',
'padding': '4px 25px',
'border-radius': '10px'
},
wrapperClass: 'cov-vue-date',
inputClass: 'cov-datepicker',
placeholder: 'when?',
buttons: {
ok: 'OK',
cancel: 'Cancel'
},
successAction: true,
cancelAction: true,
overlayOpacity: 0.5,
dismissible: true
dismissible: true,
};
}
},
Expand Down Expand Up @@ -600,7 +617,7 @@ exports.default = {
value: previousMonth.daysInMonth() - _i,
inMonth: false,
action: 'previous',
unavailable: false,
unavailable: true,
checked: false,
moment: (0, _moment2.default)(currentMoment).date(1).subtract(_i + 1, 'days')
};
Expand All @@ -622,6 +639,9 @@ exports.default = {
case 'weekday':
days = this.limitWeekDay(li, days);
break;
case 'day':
days = this.limitDay(li, days);
break;
}
}
} catch (err) {
Expand All @@ -645,7 +665,7 @@ exports.default = {
value: _i2,
inMonth: false,
action: 'next',
unavailable: false,
unavailable: true,
checked: false,
moment: (0, _moment2.default)(currentMoment).add(1, 'months').date(_i2)
};
Expand All @@ -670,6 +690,14 @@ exports.default = {
});
return days;
},
limitDay: function limitDay(limit, days) {
days.forEach((v) => {
if(limit.available.indexOf(v.moment.format('Y-MM-DD')) == -1) {
v.unavailable = true
}
})
return days;
},
limitFromTo: function limitFromTo(limit, days) {
var _this2 = this;

Expand Down Expand Up @@ -884,4 +912,4 @@ exports.default = {
}
}
};
</script>
</script>
30 changes: 26 additions & 4 deletions vue-datepicker-es6.vue
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,8 @@ table {
</div>
</div>
<div class="button-box">
<span @click="showInfo.check=false">{{option.buttons? option.buttons.cancel : 'Cancel' }}</span>
<span @click="picked">{{option.buttons? option.buttons.ok : 'Ok'}}</span>
<span v-if="option.cancelAction ? option.cancelAction : false" @click="showInfo.check=false" :style="option.buttonCancelStyle ? option.buttonCancelStyle : {}">{{option.buttons? option.buttons.cancel : 'Cancel' }}</span>
<span v-if="option.successAction ? option.successAction : false" @click="picked" :style="option.buttonSuccessStyle ? option.buttonSuccessStyle : {}">{{option.buttons? option.buttons.ok : 'Ok'}}</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -406,11 +406,22 @@ export default {
'border-radius': '2px',
'color': '#5F5F5F'
},
buttonCancelStyle: {
'color': '#d9534f'
},
buttonSuccessStyle: {
'color': '#fff',
'background-color': '#226b32',
'padding': '4px 25px',
'border-radius': '10px'
},
placeholder: 'when?',
buttons: {
ok: 'OK',
cancel: 'Cancel'
},
successAction: true,
cancelAction: true,
overlayOpacity: 0.5,
dismissible: true
}
Expand Down Expand Up @@ -530,7 +541,7 @@ export default {
value: previousMonth.daysInMonth() - (i),
inMonth: false,
action: 'previous',
unavailable: false,
unavailable: true,
checked: false,
moment: moment(currentMoment).date(1).subtract(i + 1, 'days')
}
Expand All @@ -542,7 +553,7 @@ export default {
value: i,
inMonth: false,
action: 'next',
unavailable: false,
unavailable: true,
checked: false,
moment: moment(currentMoment).add(1, 'months').date(i)
}
Expand All @@ -557,6 +568,9 @@ export default {
case 'weekday':
days = this.limitWeekDay(li, days)
break
case 'day':
days = this.limitDay(li, days)
break
}
}
}
Expand All @@ -577,6 +591,14 @@ export default {
})
return days
},
limitDay: function limitDay(limit, days) {
days.forEach((v) => {
if(limit.available.indexOf(v.moment.format('Y-MM-DD')) == -1) {
v.unavailable = true
}
})
return days;
},
limitFromTo (limit, days) {
if (limit.from || limit.to) {
days.map((day) => {
Expand Down
28 changes: 25 additions & 3 deletions vue-datepicker.es6-1.vue
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@ table {
</div>
</div>
<div class="button-box">
<span @click="showInfo.check=false">{{option.buttons? option.buttons.cancel : 'Cancel' }}</span>
<span @click="picked">{{option.buttons? option.buttons.ok : 'Ok'}}</span>
<span v-if="option.cancelAction ? option.cancelAction : false" @click="showInfo.check=false" :style="option.buttonCancelStyle ? option.buttonCancelStyle : {}">{{option.buttons? option.buttons.cancel : 'Cancel' }}</span>
<span v-if="option.successAction ? option.successAction : false" @click="picked" :style="option.buttonSuccessStyle ? option.buttonSuccessStyle : {}">{{option.buttons? option.buttons.ok : 'Ok'}}</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -458,11 +458,22 @@ export default {
'border-radius': '2px',
'color': '#5F5F5F'
},
buttonCancelStyle: {
'color': '#d9534f'
},
buttonSuccessStyle: {
'color': '#fff',
'background-color': '#226b32',
'padding': '4px 25px',
'border-radius': '10px'
},
placeholder: 'when?',
buttons: {
ok: 'OK',
cancel: 'Cancel'
},
successAction: true,
cancelAction: true,
overlayOpacity: 0.5,
dismissible: true
}
Expand Down Expand Up @@ -583,7 +594,7 @@ export default {
value: previousMonth.daysInMonth() - (i),
inMonth: false,
action: 'previous',
unavailable: false,
unavailable: true,
checked: false,
moment: moment(currentMoment).date(1).subtract(i + 1, 'days')
}
Expand All @@ -598,6 +609,9 @@ export default {
case 'weekday':
days = this.limitWeekDay(li, days)
break
case 'day':
days = this.limitDay(li, days)
break
}
}
}
Expand Down Expand Up @@ -630,6 +644,14 @@ export default {
})
return days
},
limitDay: function limitDay(limit, days) {
days.forEach((v) => {
if(limit.available.indexOf(v.moment.format('Y-MM-DD')) == -1) {
v.unavailable = true
}
})
return days;
},
limitFromTo (limit, days) {
if (limit.from || limit.to) {
days.map((day) => {
Expand Down
37 changes: 27 additions & 10 deletions vue-datepicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -364,27 +364,22 @@ table {
</div>
</div>
<div class="button-box">
<span @click="showInfo.check=false">{{option.buttons? option.buttons.cancel : 'Cancel' }}</span>
<span @click="picked">{{option.buttons? option.buttons.ok : 'Ok'}}</span>
<span v-if="option.cancelAction ? option.cancelAction : false" @click="showInfo.check=false" :style="option.buttonCancelStyle ? option.buttonCancelStyle : {}">{{option.buttons? option.buttons.cancel : 'Cancel' }}</span>
<span v-if="option.successAction ? option.successAction : false" @click="picked" :style="option.buttonSuccessStyle ? option.buttonSuccessStyle : {}">{{option.buttons? option.buttons.ok : 'Ok'}}</span>
</div>
</div>
</div>
</div>
</template>
<script>
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

var _moment = require('moment');

var _moment2 = _interopRequireDefault(_moment);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

exports.default = {
export default = {
props: {
required: false,
date: {
Expand Down Expand Up @@ -417,11 +412,22 @@ exports.default = {
'border-radius': '2px',
'color': '#5F5F5F'
},
buttonCancelStyle: {
'color': '#d9534f'
},
buttonSuccessStyle: {
'color': '#fff',
'background-color': '#226b32',
'padding': '4px 25px',
'border-radius': '10px'
},
placeholder: 'when?',
buttons: {
ok: 'OK',
cancel: 'Cancel'
},
successAction: '',
cancelAction: '',
overlayOpacity: 0.5,
dismissible: true
};
Expand Down Expand Up @@ -542,7 +548,7 @@ exports.default = {
value: previousMonth.daysInMonth() - _i,
inMonth: false,
action: 'previous',
unavailable: false,
unavailable: true,
checked: false,
moment: (0, _moment2.default)(currentMoment).date(1).subtract(_i + 1, 'days')
};
Expand All @@ -564,6 +570,9 @@ exports.default = {
case 'weekday':
days = this.limitWeekDay(li, days);
break;
case 'day':
days = this.limitDay(li, days);
break;
}
}
} catch (err) {
Expand All @@ -587,7 +596,7 @@ exports.default = {
value: _i2,
inMonth: false,
action: 'next',
unavailable: false,
unavailable: true,
checked: false,
moment: (0, _moment2.default)(currentMoment).add(1, 'months').date(_i2)
};
Expand All @@ -612,6 +621,14 @@ exports.default = {
});
return days;
},
limitDay: function limitDay(limit, days) {
days.forEach((v) => {
if(limit.available.indexOf(v.moment.format('Y-MM-DD')) == -1) {
v.unavailable = true
}
})
return days;
},
limitFromTo: function limitFromTo(limit, days) {
var _this2 = this;

Expand Down