mirror of
https://github.com/frappe/air-datepicker.git
synced 2026-01-14 11:01:22 +08:00
fix onRenderCell implementation, disable navTitle when years view
This commit is contained in:
parent
7a2508384b
commit
8b2feab2d0
3
dist/css/datepicker.css
vendored
3
dist/css/datepicker.css
vendored
@ -53,6 +53,9 @@
|
|||||||
border-radius: 2px; }
|
border-radius: 2px; }
|
||||||
.datepicker--nav-title:hover {
|
.datepicker--nav-title:hover {
|
||||||
background: #eee; }
|
background: #eee; }
|
||||||
|
.datepicker--nav-title.-disabled- {
|
||||||
|
cursor: default;
|
||||||
|
background: none; }
|
||||||
|
|
||||||
/* -------------------------------------------------
|
/* -------------------------------------------------
|
||||||
Datepicker cells
|
Datepicker cells
|
||||||
|
|||||||
9
dist/js/datepicker.js
vendored
9
dist/js/datepicker.js
vendored
@ -413,6 +413,9 @@ var Datepicker;
|
|||||||
html = Datepicker.template(template, $.extend({title: title}, this.opts));
|
html = Datepicker.template(template, $.extend({title: title}, this.opts));
|
||||||
|
|
||||||
this.d.$nav.html(html);
|
this.d.$nav.html(html);
|
||||||
|
if (this.d.view == 'years') {
|
||||||
|
$('.datepicker--nav-title', this.d.$nav).addClass('-disabled-');
|
||||||
|
}
|
||||||
this.setNavStatus();
|
this.setNavStatus();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -436,7 +439,9 @@ var Datepicker;
|
|||||||
this.d[action]();
|
this.d[action]();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onClickNavTitle: function () {
|
_onClickNavTitle: function (e) {
|
||||||
|
if ($(e.target).hasClass('-disabled-')) return;
|
||||||
|
|
||||||
if (this.d.view == 'days') {
|
if (this.d.view == 'days') {
|
||||||
return this.d.view = 'months'
|
return this.d.view = 'months'
|
||||||
}
|
}
|
||||||
@ -585,7 +590,7 @@ Datepicker.Cell = function () {
|
|||||||
var _class = "datepicker--cell datepicker--cell-day",
|
var _class = "datepicker--cell datepicker--cell-day",
|
||||||
currentDate = new Date(),
|
currentDate = new Date(),
|
||||||
d = Datepicker.getParsedDate(date),
|
d = Datepicker.getParsedDate(date),
|
||||||
render,
|
render = {},
|
||||||
html = d.date;
|
html = d.date;
|
||||||
|
|
||||||
if (this.opts.onRenderCell) {
|
if (this.opts.onRenderCell) {
|
||||||
|
|||||||
@ -88,7 +88,7 @@
|
|||||||
var _class = "datepicker--cell datepicker--cell-day",
|
var _class = "datepicker--cell datepicker--cell-day",
|
||||||
currentDate = new Date(),
|
currentDate = new Date(),
|
||||||
d = Datepicker.getParsedDate(date),
|
d = Datepicker.getParsedDate(date),
|
||||||
render,
|
render = {},
|
||||||
html = d.date;
|
html = d.date;
|
||||||
|
|
||||||
if (this.opts.onRenderCell) {
|
if (this.opts.onRenderCell) {
|
||||||
|
|||||||
@ -32,6 +32,9 @@
|
|||||||
html = Datepicker.template(template, $.extend({title: title}, this.opts));
|
html = Datepicker.template(template, $.extend({title: title}, this.opts));
|
||||||
|
|
||||||
this.d.$nav.html(html);
|
this.d.$nav.html(html);
|
||||||
|
if (this.d.view == 'years') {
|
||||||
|
$('.datepicker--nav-title', this.d.$nav).addClass('-disabled-');
|
||||||
|
}
|
||||||
this.setNavStatus();
|
this.setNavStatus();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -55,7 +58,9 @@
|
|||||||
this.d[action]();
|
this.d[action]();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onClickNavTitle: function () {
|
_onClickNavTitle: function (e) {
|
||||||
|
if ($(e.target).hasClass('-disabled-')) return;
|
||||||
|
|
||||||
if (this.d.view == 'days') {
|
if (this.d.view == 'days') {
|
||||||
return this.d.view = 'months'
|
return this.d.view = 'months'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,4 +39,9 @@
|
|||||||
&:hover {
|
&:hover {
|
||||||
background: $colorCellHover;
|
background: $colorCellHover;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.-disabled- {
|
||||||
|
cursor: default;
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user