material-sass 4.0.0.alpha6 → 4.0.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +36 -8
- data/Rakefile +16 -3
- data/app/assets/javascripts/material-sprockets.js +6 -1
- data/app/assets/javascripts/material.js +654 -417
- data/app/assets/javascripts/material.min.js +1 -0
- data/app/assets/javascripts/material/addons/picker.date.js +234 -0
- data/app/assets/javascripts/material/addons/picker.js +172 -0
- data/app/assets/javascripts/material/addons/textarea-autosize.js +20 -2
- data/app/assets/javascripts/material/addons/waves.js +127 -0
- data/app/assets/javascripts/material/components/floating-label.js +92 -0
- data/app/assets/javascripts/material/components/navdrawer.js +353 -0
- data/app/assets/javascripts/material/components/selection-control-focus.js +47 -0
- data/app/assets/javascripts/material/components/tab-switch.js +148 -0
- data/app/assets/javascripts/material/components/util.js +133 -0
- data/app/assets/javascripts/material/initializers/picker.js +171 -0
- data/app/assets/javascripts/material/initializers/textarea-autosize.js +10 -0
- data/app/assets/javascripts/material/initializers/waves.js +13 -0
- data/app/assets/stylesheets/material/_colours.scss +324 -0
- data/app/assets/stylesheets/material/_functions.scss +65 -0
- data/app/assets/stylesheets/material/_mixins.scss +23 -23
- data/app/assets/stylesheets/material/_print.scss +102 -0
- data/app/assets/stylesheets/material/_utilities.scss +21 -17
- data/app/assets/stylesheets/material/_variables.scss +13 -42
- data/app/assets/stylesheets/material/base/_base.scss +420 -5
- data/app/assets/stylesheets/material/base/_grid.scss +34 -33
- data/app/assets/stylesheets/material/base/_typography.scss +165 -174
- data/app/assets/stylesheets/material/bootstrap/_alert.scss +32 -39
- data/app/assets/stylesheets/material/bootstrap/_badge.scss +34 -0
- data/app/assets/stylesheets/material/bootstrap/_breadcrumb.scss +18 -18
- data/app/assets/stylesheets/material/bootstrap/_carousel.scss +127 -142
- data/app/assets/stylesheets/material/bootstrap/_close.scss +18 -19
- data/app/assets/stylesheets/material/bootstrap/_code.scss +10 -7
- data/app/assets/stylesheets/material/bootstrap/_custom-form.scss +50 -56
- data/app/assets/stylesheets/material/bootstrap/_form.scss +159 -129
- data/app/assets/stylesheets/material/bootstrap/_image.scss +19 -16
- data/app/assets/stylesheets/material/bootstrap/_jumbotron.scss +10 -7
- data/app/assets/stylesheets/material/bootstrap/_nav.scss +71 -69
- data/app/assets/stylesheets/material/bootstrap/_pagination.scss +34 -26
- data/app/assets/stylesheets/material/bootstrap/_popover.scss +26 -59
- data/app/assets/stylesheets/material/bootstrap/_responsive-embed.scss +4 -4
- data/app/assets/stylesheets/material/bootstrap/_transition.scss +10 -8
- data/app/assets/stylesheets/material/material.scss +75 -62
- data/app/assets/stylesheets/material/material/_button-flat.scss +26 -39
- data/app/assets/stylesheets/material/material/_button-float.scss +10 -14
- data/app/assets/stylesheets/material/material/_button-group.scss +268 -0
- data/app/assets/stylesheets/material/material/_button.scss +133 -189
- data/app/assets/stylesheets/material/material/_card.scss +300 -248
- data/app/assets/stylesheets/material/material/_chip.scss +65 -64
- data/app/assets/stylesheets/material/material/_data-table.scss +135 -45
- data/app/assets/stylesheets/material/material/_dialog.scss +141 -110
- data/app/assets/stylesheets/material/material/_expansion-panel.scss +86 -119
- data/app/assets/stylesheets/material/material/_menu.scss +308 -228
- data/app/assets/stylesheets/material/material/_navdrawer.scss +239 -234
- data/app/assets/stylesheets/material/material/_picker.scss +157 -155
- data/app/assets/stylesheets/material/material/_progress-circular.scss +80 -80
- data/app/assets/stylesheets/material/material/_progress.scss +180 -115
- data/app/assets/stylesheets/material/material/_selection-control.scss +132 -139
- data/app/assets/stylesheets/material/material/_stepper.scss +94 -93
- data/app/assets/stylesheets/material/material/_tab.scss +74 -93
- data/app/assets/stylesheets/material/material/_text-field-floating-label.scss +29 -20
- data/app/assets/stylesheets/material/material/_text-field-input-group.scss +94 -24
- data/app/assets/stylesheets/material/material/_text-field-textarea.scss +13 -26
- data/app/assets/stylesheets/material/material/_text-field.scss +127 -118
- data/app/assets/stylesheets/material/material/_toolbar.scss +308 -313
- data/app/assets/stylesheets/material/material/_tooltip.scss +23 -62
- data/app/assets/stylesheets/material/mixins/_background-variant.scss +6 -6
- data/app/assets/stylesheets/material/mixins/_border-radius.scss +17 -17
- data/app/assets/stylesheets/material/mixins/_breakpoint.scss +32 -2
- data/app/assets/stylesheets/material/mixins/_clearfix.scss +1 -1
- data/app/assets/stylesheets/material/mixins/_form.scss +62 -25
- data/app/assets/stylesheets/material/mixins/_grid-framework.scss +8 -16
- data/app/assets/stylesheets/material/mixins/_grid.scss +40 -64
- data/app/assets/stylesheets/material/mixins/_material-icons.scss +36 -0
- data/app/assets/stylesheets/material/mixins/_nav-divider.scss +1 -1
- data/app/assets/stylesheets/material/mixins/_reset-text.scss +2 -21
- data/app/assets/stylesheets/material/mixins/_screenreader.scss +14 -12
- data/app/assets/stylesheets/material/mixins/_text-alignment.scss +23 -0
- data/app/assets/stylesheets/material/mixins/_text-emphasis.scss +6 -6
- data/app/assets/stylesheets/material/mixins/_transition.scss +42 -10
- data/app/assets/stylesheets/material/utilities/_background.scss +18 -18
- data/app/assets/stylesheets/material/utilities/_border.scss +88 -41
- data/app/assets/stylesheets/material/utilities/_display.scss +63 -30
- data/app/assets/stylesheets/material/utilities/_flex.scss +139 -134
- data/app/assets/stylesheets/material/utilities/_material-icons.scss +3 -5
- data/app/assets/stylesheets/material/utilities/_position.scss +19 -22
- data/app/assets/stylesheets/material/utilities/_sizing.scss +11 -12
- data/app/assets/stylesheets/material/utilities/_spacing.scss +51 -56
- data/app/assets/stylesheets/material/utilities/_text.scss +80 -75
- data/app/assets/stylesheets/material/utilities/_visibility.scss +5 -46
- data/app/assets/stylesheets/material/utilities/_waves.scss +11 -18
- data/app/assets/stylesheets/material/variables/_elevation-shadow.scss +89 -82
- data/app/assets/stylesheets/material/variables/_grid.scss +29 -26
- data/app/assets/stylesheets/material/variables/_palette.scss +45 -0
- data/app/assets/stylesheets/material/variables/_spacer.scss +34 -88
- data/app/assets/stylesheets/material/variables/_transition.scss +29 -0
- data/app/assets/stylesheets/material/variables/_typography.scss +88 -74
- data/app/assets/stylesheets/material/variables/_variable-bootstrap.scss +196 -133
- data/app/assets/stylesheets/material/variables/_variable-material.scss +481 -429
- data/lib/material-sass/version.rb +1 -1
- data/material-sass.gemspec +3 -3
- metadata +26 -21
- data/app/assets/javascripts/material/addons-materialise/pickadate.js +0 -139
- data/app/assets/javascripts/material/addons-materialise/textarea-autosize.js +0 -11
- data/app/assets/javascripts/material/addons-materialise/wave.js +0 -15
- data/app/assets/javascripts/material/addons/pickadate.js +0 -7
- data/app/assets/javascripts/material/addons/wave.js +0 -5
- data/app/assets/javascripts/material/src/floating-label.js +0 -91
- data/app/assets/javascripts/material/src/navdrawer.js +0 -352
- data/app/assets/javascripts/material/src/tab-switch.js +0 -133
- data/app/assets/javascripts/material/src/util.js +0 -138
- data/app/assets/stylesheets/material/base/_normalize.scss +0 -253
- data/app/assets/stylesheets/material/base/_reboot.scss +0 -239
- data/app/assets/stylesheets/material/bootstrap/_button-group.scss +0 -134
- data/app/assets/stylesheets/material/mixins/_tab-focus.scss +0 -5
- data/app/assets/stylesheets/material/mixins/_transform.scss +0 -9
- data/app/assets/stylesheets/material/variables/_animation.scss +0 -22
- data/app/assets/stylesheets/material/variables/_colour.scss +0 -389
@@ -0,0 +1,148 @@
|
|
1
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
2
|
+
|
3
|
+
/*
|
4
|
+
* tab indicator animation
|
5
|
+
* requires bootstrap's (v4.0.0-beta) tab.js
|
6
|
+
*/
|
7
|
+
|
8
|
+
var TabSwitch = function ($) {
|
9
|
+
|
10
|
+
// constants >>>
|
11
|
+
var DATA_KEY = 'md.tabswitch';
|
12
|
+
var NAME = 'tabswitch';
|
13
|
+
var NO_CONFLICT = $.fn[NAME];
|
14
|
+
var TRANSITION_DURATION = 390;
|
15
|
+
|
16
|
+
var ClassName = {
|
17
|
+
ANIMATE: 'animate',
|
18
|
+
DROPDOWN_ITEM: 'dropdown-item',
|
19
|
+
INDICATOR: 'nav-tabs-indicator',
|
20
|
+
MATERIAL: 'nav-tabs-material',
|
21
|
+
SCROLLABLE: 'nav-tabs-scrollable',
|
22
|
+
SHOW: 'show'
|
23
|
+
};
|
24
|
+
|
25
|
+
var Event = {
|
26
|
+
SHOW_BS_TAB: 'show.bs.tab'
|
27
|
+
};
|
28
|
+
|
29
|
+
var Selector = {
|
30
|
+
DATA_TOGGLE: '.nav-tabs [data-toggle="tab"]',
|
31
|
+
DROPDOWN: '.dropdown',
|
32
|
+
NAV: '.nav-tabs'
|
33
|
+
};
|
34
|
+
// <<< constants
|
35
|
+
|
36
|
+
var TabSwitch = function () {
|
37
|
+
function TabSwitch(nav) {
|
38
|
+
_classCallCheck(this, TabSwitch);
|
39
|
+
|
40
|
+
if (typeof $.fn.tab === 'undefined') {
|
41
|
+
throw new Error('Material\'s JavaScript requires Bootstrap\'s tab.js');
|
42
|
+
}
|
43
|
+
|
44
|
+
this._nav = nav;
|
45
|
+
this._navindicator = null;
|
46
|
+
}
|
47
|
+
|
48
|
+
TabSwitch.prototype.switch = function _switch(element, relatedTarget) {
|
49
|
+
var _this = this;
|
50
|
+
|
51
|
+
var navLeft = $(this._nav).offset().left;
|
52
|
+
var navScrollLeft = $(this._nav).scrollLeft();
|
53
|
+
var navWidth = $(this._nav).outerWidth();
|
54
|
+
var supportsTransition = Util.supportsTransitionEnd();
|
55
|
+
|
56
|
+
if (!this._navindicator) {
|
57
|
+
this._createIndicator(navLeft, navScrollLeft, navWidth, relatedTarget);
|
58
|
+
}
|
59
|
+
|
60
|
+
if ($(element).hasClass(ClassName.DROPDOWN_ITEM)) {
|
61
|
+
element = $(element).closest(Selector.DROPDOWN);
|
62
|
+
}
|
63
|
+
|
64
|
+
var elLeft = $(element).offset().left;
|
65
|
+
var elWidth = $(element).outerWidth();
|
66
|
+
|
67
|
+
$(this._navindicator).addClass(ClassName.SHOW);
|
68
|
+
Util.reflow(this._navindicator);
|
69
|
+
|
70
|
+
if (supportsTransition) {
|
71
|
+
$(this._nav).addClass(ClassName.ANIMATE);
|
72
|
+
}
|
73
|
+
|
74
|
+
$(this._navindicator).css({
|
75
|
+
left: elLeft + navScrollLeft - navLeft,
|
76
|
+
right: navWidth - (elLeft + navScrollLeft - navLeft + elWidth)
|
77
|
+
});
|
78
|
+
|
79
|
+
var complete = function complete() {
|
80
|
+
$(_this._nav).removeClass(ClassName.ANIMATE);
|
81
|
+
$(_this._navindicator).removeClass(ClassName.SHOW);
|
82
|
+
};
|
83
|
+
|
84
|
+
if (!supportsTransition) {
|
85
|
+
complete();
|
86
|
+
return;
|
87
|
+
}
|
88
|
+
|
89
|
+
$(this._navindicator).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
|
90
|
+
};
|
91
|
+
|
92
|
+
TabSwitch.prototype._createIndicator = function _createIndicator(navLeft, navScrollLeft, navWidth, relatedTarget) {
|
93
|
+
this._navindicator = document.createElement('div');
|
94
|
+
|
95
|
+
$(this._navindicator).addClass(ClassName.INDICATOR).appendTo(this._nav);
|
96
|
+
|
97
|
+
if (relatedTarget !== undefined) {
|
98
|
+
if ($(relatedTarget).hasClass(ClassName.DROPDOWN_ITEM)) {
|
99
|
+
relatedTarget = $(relatedTarget).closest(Selector.DROPDOWN);
|
100
|
+
}
|
101
|
+
|
102
|
+
var relatedLeft = $(relatedTarget).offset().left;
|
103
|
+
var relatedWidth = $(relatedTarget).outerWidth();
|
104
|
+
|
105
|
+
$(this._navindicator).css({
|
106
|
+
left: relatedLeft + navScrollLeft - navLeft,
|
107
|
+
right: navWidth - (relatedLeft + navScrollLeft - navLeft + relatedWidth)
|
108
|
+
});
|
109
|
+
}
|
110
|
+
|
111
|
+
$(this._nav).addClass(ClassName.MATERIAL);
|
112
|
+
};
|
113
|
+
|
114
|
+
TabSwitch._jQueryInterface = function _jQueryInterface(relatedTarget) {
|
115
|
+
return this.each(function () {
|
116
|
+
var nav = $(this).closest(Selector.NAV)[0];
|
117
|
+
|
118
|
+
if (!nav) {
|
119
|
+
return;
|
120
|
+
}
|
121
|
+
|
122
|
+
var data = $(nav).data(DATA_KEY);
|
123
|
+
|
124
|
+
if (!data) {
|
125
|
+
data = new TabSwitch(nav);
|
126
|
+
$(nav).data(DATA_KEY, data);
|
127
|
+
}
|
128
|
+
|
129
|
+
data.switch(this, relatedTarget);
|
130
|
+
});
|
131
|
+
};
|
132
|
+
|
133
|
+
return TabSwitch;
|
134
|
+
}();
|
135
|
+
|
136
|
+
$(document).on(Event.SHOW_BS_TAB, Selector.DATA_TOGGLE, function (event) {
|
137
|
+
TabSwitch._jQueryInterface.call($(event.target), event.relatedTarget);
|
138
|
+
});
|
139
|
+
|
140
|
+
$.fn[NAME] = TabSwitch._jQueryInterface;
|
141
|
+
$.fn[NAME].Constructor = TabSwitch;
|
142
|
+
$.fn[NAME].noConflict = function () {
|
143
|
+
$.fn[NAME] = NO_CONFLICT;
|
144
|
+
return TabSwitch._jQueryInterface;
|
145
|
+
};
|
146
|
+
|
147
|
+
return TabSwitch;
|
148
|
+
}(jQuery);
|
@@ -0,0 +1,133 @@
|
|
1
|
+
/*
|
2
|
+
* global util js
|
3
|
+
* based on bootstrap's (v4.0.0-beta) util.js
|
4
|
+
*/
|
5
|
+
|
6
|
+
var Util = function ($) {
|
7
|
+
|
8
|
+
var MAX_UID = 1000000;
|
9
|
+
var transition = false;
|
10
|
+
|
11
|
+
var TransitionEndEvent = {
|
12
|
+
WebkitTransition: 'webkitTransitionEnd',
|
13
|
+
MozTransition: 'transitionend',
|
14
|
+
OTransition: 'oTransitionEnd otransitionend',
|
15
|
+
transition: 'transitionend'
|
16
|
+
};
|
17
|
+
|
18
|
+
function getSpecialTransitionEndEvent() {
|
19
|
+
return {
|
20
|
+
bindType: transition.end,
|
21
|
+
delegateType: transition.end,
|
22
|
+
handle: function handle(event) {
|
23
|
+
if ($(event.target).is(this)) {
|
24
|
+
// eslint-disable-next-line prefer-rest-params
|
25
|
+
return event.handleObj.handler.apply(this, arguments);
|
26
|
+
}
|
27
|
+
return undefined;
|
28
|
+
}
|
29
|
+
};
|
30
|
+
}
|
31
|
+
|
32
|
+
function isElement(obj) {
|
33
|
+
return (obj[0] || obj).nodeType;
|
34
|
+
}
|
35
|
+
|
36
|
+
function setTransitionEndSupport() {
|
37
|
+
transition = transitionEndTest();
|
38
|
+
|
39
|
+
$.fn.emulateTransitionEnd = transitionEndEmulator;
|
40
|
+
|
41
|
+
if (Util.supportsTransitionEnd()) {
|
42
|
+
$.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
function toType(obj) {
|
47
|
+
return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
|
48
|
+
}
|
49
|
+
|
50
|
+
function transitionEndEmulator(duration) {
|
51
|
+
var _this = this;
|
52
|
+
|
53
|
+
var called = false;
|
54
|
+
|
55
|
+
$(this).one(Util.TRANSITION_END, function () {
|
56
|
+
called = true;
|
57
|
+
});
|
58
|
+
|
59
|
+
setTimeout(function () {
|
60
|
+
if (!called) {
|
61
|
+
Util.triggerTransitionEnd(_this);
|
62
|
+
}
|
63
|
+
}, duration);
|
64
|
+
|
65
|
+
return this;
|
66
|
+
}
|
67
|
+
|
68
|
+
function transitionEndTest() {
|
69
|
+
if (window.QUnit) {
|
70
|
+
return false;
|
71
|
+
}
|
72
|
+
|
73
|
+
var el = document.createElement('material');
|
74
|
+
|
75
|
+
for (var name in TransitionEndEvent) {
|
76
|
+
if (el.style[name] !== undefined) {
|
77
|
+
return {
|
78
|
+
end: TransitionEndEvent[name]
|
79
|
+
};
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
return false;
|
84
|
+
}
|
85
|
+
|
86
|
+
var Util = {
|
87
|
+
TRANSITION_END: 'mdTransitionEnd',
|
88
|
+
|
89
|
+
getSelectorFromElement: function getSelectorFromElement(element) {
|
90
|
+
var selector = element.getAttribute('data-target');
|
91
|
+
|
92
|
+
if (!selector) {
|
93
|
+
selector = element.getAttribute('href') || '';
|
94
|
+
selector = /^#[a-z]/i.test(selector) ? selector : null;
|
95
|
+
}
|
96
|
+
|
97
|
+
return selector;
|
98
|
+
},
|
99
|
+
getUID: function getUID(prefix) {
|
100
|
+
do {
|
101
|
+
// eslint-disable-next-line no-bitwise
|
102
|
+
prefix += ~~(Math.random() * MAX_UID);
|
103
|
+
} while (document.getElementById(prefix));
|
104
|
+
return prefix;
|
105
|
+
},
|
106
|
+
reflow: function reflow(element) {
|
107
|
+
new Function('md', 'return md')(element.offsetHeight);
|
108
|
+
},
|
109
|
+
supportsTransitionEnd: function supportsTransitionEnd() {
|
110
|
+
return Boolean(transition);
|
111
|
+
},
|
112
|
+
triggerTransitionEnd: function triggerTransitionEnd(element) {
|
113
|
+
$(element).trigger(transition.end);
|
114
|
+
},
|
115
|
+
typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
|
116
|
+
for (var property in configTypes) {
|
117
|
+
if (configTypes.hasOwnProperty(property)) {
|
118
|
+
var expectedTypes = configTypes[property];
|
119
|
+
var value = config[property];
|
120
|
+
var valueType = value && isElement(value) ? 'element' : toType(value);
|
121
|
+
|
122
|
+
if (!new RegExp(expectedTypes).test(valueType)) {
|
123
|
+
throw new Error(componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".'));
|
124
|
+
}
|
125
|
+
}
|
126
|
+
}
|
127
|
+
}
|
128
|
+
};
|
129
|
+
|
130
|
+
setTransitionEndSupport();
|
131
|
+
|
132
|
+
return Util;
|
133
|
+
}(jQuery);
|
@@ -0,0 +1,171 @@
|
|
1
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
2
|
+
|
3
|
+
/*
|
4
|
+
* customise pickadate js for material
|
5
|
+
* requires addons/picker.js and addons/picker.date.js
|
6
|
+
*/
|
7
|
+
|
8
|
+
+function ($) {
|
9
|
+
|
10
|
+
'use strict';
|
11
|
+
|
12
|
+
var Datepicker = function Datepicker(element, options) {
|
13
|
+
this._element = element;
|
14
|
+
this._options = options;
|
15
|
+
};
|
16
|
+
|
17
|
+
if (typeof $.fn.pickadate === 'undefined') {
|
18
|
+
throw new Error('Material\'s JavaScript requires pickadate.js');
|
19
|
+
}
|
20
|
+
|
21
|
+
Datepicker.DEFAULTS = {
|
22
|
+
cancel: 'Cancel',
|
23
|
+
closeOnCancel: true,
|
24
|
+
closeOnSelect: false,
|
25
|
+
container: 'body',
|
26
|
+
disable: [],
|
27
|
+
firstDay: 0,
|
28
|
+
format: 'd/m/yyyy',
|
29
|
+
formatSubmit: '',
|
30
|
+
klass: {
|
31
|
+
// button
|
32
|
+
buttonClear: 'btn btn-outline-primary picker-button-clear',
|
33
|
+
buttonClose: 'btn btn-outline-primary picker-button-close',
|
34
|
+
buttonToday: 'btn btn-outline-primary picker-button-today',
|
35
|
+
|
36
|
+
// day
|
37
|
+
day: 'picker-day',
|
38
|
+
disabled: 'picker-day-disabled',
|
39
|
+
highlighted: 'picker-day-highlighted',
|
40
|
+
infocus: 'picker-day-infocus',
|
41
|
+
now: 'picker-day-today',
|
42
|
+
outfocus: 'picker-day-outfocus',
|
43
|
+
selected: 'picker-day-selected',
|
44
|
+
weekdays: 'picker-weekday',
|
45
|
+
|
46
|
+
// element
|
47
|
+
box: 'picker-box',
|
48
|
+
footer: 'picker-footer',
|
49
|
+
frame: 'picker-frame',
|
50
|
+
header: 'picker-header',
|
51
|
+
holder: 'picker-holder',
|
52
|
+
table: 'picker-table',
|
53
|
+
wrap: 'picker-wrap',
|
54
|
+
|
55
|
+
// input element
|
56
|
+
active: 'picker-input-active',
|
57
|
+
input: 'picker-input',
|
58
|
+
|
59
|
+
// month and year nav
|
60
|
+
month: 'picker-month',
|
61
|
+
navDisabled: 'picker-nav-disabled',
|
62
|
+
navNext: 'material-icons picker-nav-next',
|
63
|
+
navPrev: 'material-icons picker-nav-prev',
|
64
|
+
selectMonth: 'picker-select-month',
|
65
|
+
selectYear: 'picker-select-year',
|
66
|
+
year: 'picker-year',
|
67
|
+
|
68
|
+
// root picker
|
69
|
+
focused: 'picker-focused',
|
70
|
+
opened: 'picker-opened',
|
71
|
+
picker: 'picker'
|
72
|
+
},
|
73
|
+
max: false,
|
74
|
+
min: false,
|
75
|
+
monthsFull: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
76
|
+
monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
77
|
+
ok: 'OK',
|
78
|
+
onClose: false,
|
79
|
+
onOpen: false,
|
80
|
+
onRender: false,
|
81
|
+
onSet: false,
|
82
|
+
onStart: false,
|
83
|
+
onStop: false,
|
84
|
+
selectMonths: false,
|
85
|
+
selectYears: false,
|
86
|
+
today: '',
|
87
|
+
weekdaysFull: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
88
|
+
weekdaysShort: ['S', 'M', 'T', 'W', 'T', 'F', 'S']
|
89
|
+
};
|
90
|
+
|
91
|
+
Datepicker.prototype.display = function (datepickerApi, datepickerRoot, datepickerValue) {
|
92
|
+
$('.picker-date-display', datepickerRoot).remove();
|
93
|
+
|
94
|
+
$('.picker-wrap', datepickerRoot).prepend('<div class="picker-date-display">' + '<div class="picker-date-display-top">' + '<span class="picker-year-display">' + datepickerApi.get(datepickerValue, 'yyyy') + '</span>' + '</div>' + '<div class="picker-date-display-bottom">' + '<span class="picker-weekday-display">' + datepickerApi.get(datepickerValue, 'dddd') + '</span>' + '<span class="picker-day-display">' + datepickerApi.get(datepickerValue, 'd') + '</span>' + '<span class="picker-month-display">' + datepickerApi.get(datepickerValue, 'mmm') + '</span>' + '</div>' + '</div>');
|
95
|
+
};
|
96
|
+
|
97
|
+
Datepicker.prototype.show = function () {
|
98
|
+
var that = this;
|
99
|
+
|
100
|
+
$(this._element).pickadate({
|
101
|
+
clear: that._options.cancel,
|
102
|
+
close: that._options.ok,
|
103
|
+
closeOnClear: that._options.closeOnCancel,
|
104
|
+
closeOnSelect: that._options.closeOnSelect,
|
105
|
+
container: that._options.container,
|
106
|
+
disable: that._options.disable,
|
107
|
+
firstDay: that._options.firstDay,
|
108
|
+
format: that._options.format,
|
109
|
+
formatSubmit: that._options.formatSubmit,
|
110
|
+
klass: that._options.klass,
|
111
|
+
max: that._options.max,
|
112
|
+
min: that._options.min,
|
113
|
+
monthsFull: that._options.monthsFull,
|
114
|
+
monthsShort: that._options.monthsShort,
|
115
|
+
onClose: that._options.onClose,
|
116
|
+
onOpen: that._options.onOpen,
|
117
|
+
onRender: that._options.onRender,
|
118
|
+
onSet: that._options.onSet,
|
119
|
+
onStart: that._options.onStart,
|
120
|
+
onStop: that._options.onStop,
|
121
|
+
selectMonths: that._options.selectMonths,
|
122
|
+
selectYears: that._options.selectYears,
|
123
|
+
today: that._options.today,
|
124
|
+
weekdaysFull: that._options.weekdaysFull,
|
125
|
+
weekdaysShort: that._options.weekdaysShort
|
126
|
+
});
|
127
|
+
|
128
|
+
var datepickerApi = $(this._element).pickadate('picker'),
|
129
|
+
datepickerNode = datepickerApi.$node,
|
130
|
+
datepickerRoot = datepickerApi.$root;
|
131
|
+
|
132
|
+
datepickerApi.on({
|
133
|
+
close: function close() {
|
134
|
+
$(document.activeElement).blur();
|
135
|
+
},
|
136
|
+
open: function open() {
|
137
|
+
if (!$('.picker__date-display', datepickerRoot).length) {
|
138
|
+
that.display(datepickerApi, datepickerRoot, 'highlight');
|
139
|
+
}
|
140
|
+
},
|
141
|
+
set: function set() {
|
142
|
+
if (datepickerApi.get('select') !== null) {
|
143
|
+
that.display(datepickerApi, datepickerRoot, 'select');
|
144
|
+
}
|
145
|
+
}
|
146
|
+
});
|
147
|
+
};
|
148
|
+
|
149
|
+
function Plugin(option) {
|
150
|
+
return this.each(function () {
|
151
|
+
var data = $(this).data('bs.pickdate');
|
152
|
+
var options = $.extend({}, Datepicker.DEFAULTS, $(this).data(), (typeof option === 'undefined' ? 'undefined' : _typeof(option)) == 'object' && option);
|
153
|
+
|
154
|
+
if (!data) {
|
155
|
+
$(this).data('bs.pickdate', data = new Datepicker(this, options));
|
156
|
+
}
|
157
|
+
|
158
|
+
data.show();
|
159
|
+
});
|
160
|
+
}
|
161
|
+
|
162
|
+
var old = $.fn.pickdate;
|
163
|
+
|
164
|
+
$.fn.pickdate = Plugin;
|
165
|
+
$.fn.pickdate.Constructor = Datepicker;
|
166
|
+
|
167
|
+
$.fn.pickdate.noConflict = function () {
|
168
|
+
$.fn.pickdate = old;
|
169
|
+
return this;
|
170
|
+
};
|
171
|
+
}(jQuery);
|