material-sass 4.0.0.beta2 → 4.0.0.beta3
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 +3 -3
- data/Rakefile +11 -9
- data/assets/javascripts/material.js +3278 -825
- data/assets/javascripts/material.min.js +17 -1
- data/assets/javascripts/material/{initializers/picker.js → addons/pickadate.js} +5 -23
- data/assets/javascripts/material/components/expansion-panel.js +9 -18
- data/assets/javascripts/material/components/floating-label.js +21 -24
- data/assets/javascripts/material/components/{navdrawer.js → nav-drawer.js} +51 -55
- data/assets/javascripts/material/components/selection-control-focus.js +15 -21
- data/assets/javascripts/material/components/tab-switch.js +13 -20
- data/assets/javascripts/material/components/util.js +31 -41
- data/assets/stylesheets/material/_functions.scss +1 -1
- data/assets/stylesheets/material/_print.scss +13 -2
- data/assets/stylesheets/material/_utilities.scss +0 -1
- data/assets/stylesheets/material/_variables.scss +0 -1
- data/assets/stylesheets/material/base/_base.scss +1 -16
- data/assets/stylesheets/material/bootstrap/_close.scss +4 -0
- data/assets/stylesheets/material/bootstrap/_code.scss +6 -0
- data/assets/stylesheets/material/bootstrap/_custom-form.scss +26 -28
- data/assets/stylesheets/material/bootstrap/_form.scss +7 -36
- data/assets/stylesheets/material/bootstrap/_pagination.scss +7 -2
- data/assets/stylesheets/material/bootstrap/_popover.scss +18 -14
- data/assets/stylesheets/material/material.scss +0 -1
- data/assets/stylesheets/material/material/_button-flat.scss +8 -8
- data/assets/stylesheets/material/material/_button-group.scss +26 -63
- data/assets/stylesheets/material/material/_button.scss +18 -18
- data/assets/stylesheets/material/material/_dialog.scss +6 -6
- data/assets/stylesheets/material/material/_expansion-panel.scss +4 -4
- data/assets/stylesheets/material/material/_menu.scss +2 -2
- data/assets/stylesheets/material/material/_picker.scss +3 -3
- data/assets/stylesheets/material/material/_progress.scss +2 -1
- data/assets/stylesheets/material/material/_selection-control.scss +88 -67
- data/assets/stylesheets/material/material/_text-field-input-group.scss +49 -82
- data/assets/stylesheets/material/material/_text-field.scss +36 -6
- data/assets/stylesheets/material/material/_toolbar.scss +4 -0
- data/assets/stylesheets/material/material/_tooltip.scss +1 -1
- data/assets/stylesheets/material/mixins/_breakpoint.scss +1 -1
- data/assets/stylesheets/material/mixins/_form.scss +79 -17
- data/assets/stylesheets/material/mixins/_grid-framework.scss +9 -3
- data/assets/stylesheets/material/mixins/_grid.scss +3 -1
- data/assets/stylesheets/material/mixins/_hover.scss +14 -55
- data/assets/stylesheets/material/mixins/_material-icons.scss +2 -4
- data/assets/stylesheets/material/mixins/_text-alignment.scss +2 -2
- data/assets/stylesheets/material/mixins/_text-hide.scss +1 -1
- data/assets/stylesheets/material/utilities/_border.scss +20 -0
- data/assets/stylesheets/material/variables/_palette.scss +2 -0
- data/assets/stylesheets/material/variables/_variable-bootstrap.scss +17 -0
- data/assets/stylesheets/material/variables/_variable-material.scss +2 -6
- data/lib/material-sass/version.rb +1 -1
- metadata +4 -12
- data/assets/javascripts/material/addons/picker.date.js +0 -234
- data/assets/javascripts/material/addons/picker.js +0 -172
- data/assets/javascripts/material/addons/textarea-autosize.js +0 -23
- data/assets/javascripts/material/addons/waves.js +0 -127
- data/assets/javascripts/material/initializers/textarea-autosize.js +0 -10
- data/assets/javascripts/material/initializers/waves.js +0 -13
- data/assets/stylesheets/material/material/_text-field-textarea.scss +0 -15
- data/assets/stylesheets/material/utilities/_waves.scss +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7975e440c98db73c6dcd55aa6636168fed1cb2e90eb163faa1a50ea03f086c60
|
4
|
+
data.tar.gz: 2e1ce900d97b2f11f14d19d60cc8156d8a30ec3e2ceaf2a2619d0b420900dd53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16158469216238f4ce31a0225281a3a3fbe999baa9683ac79a20272203f2c40438f3affa6524a3dcde151a6db0b9ca6741e32fa9da35dde0a9a4c49fd7267d07
|
7
|
+
data.tar.gz: bf550e98f868743d595038c754a50eddf62fce57e90d14a7bf613bbd3fec08c97182dc151bb67b150ab9b0379d85943b8e110860716f3ca65413c28ac9f4cb3e
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -22,8 +22,8 @@ Since bootstrap relies on it, install it with ```bin/yarn add jquery``` or via `
|
|
22
22
|
Add this line to your application's Gemfile:
|
23
23
|
|
24
24
|
```ruby
|
25
|
-
gem 'bootstrap', '~> 4.0.0.
|
26
|
-
gem 'material-sass', '~> 4.0.0.
|
25
|
+
gem 'bootstrap', '~> 4.0.0.beta2.1'
|
26
|
+
gem 'material-sass', '~> 4.0.0.beta2'
|
27
27
|
```
|
28
28
|
And then run the bundler and restart your server to make the files available through the pipeline:
|
29
29
|
|
@@ -34,7 +34,7 @@ $ bundle install
|
|
34
34
|
Or install it yourself as:
|
35
35
|
|
36
36
|
```console
|
37
|
-
$ gem install material-sass
|
37
|
+
$ gem install material-sass --pre
|
38
38
|
```
|
39
39
|
|
40
40
|
## Usage
|
data/Rakefile
CHANGED
@@ -11,21 +11,16 @@ namespace :javascripts do
|
|
11
11
|
|
12
12
|
desc "Copy #{source_dir}/assets/js/src"
|
13
13
|
task :copy do
|
14
|
-
src_dir = "#{source_dir}/dist/
|
14
|
+
src_dir = "#{source_dir}/js/dist/src/."
|
15
15
|
tgt_dir = "assets/javascripts/material/components"
|
16
16
|
mkdir_p tgt_dir
|
17
17
|
cp_r src_dir, tgt_dir
|
18
18
|
cp "#{source_dir}/js/material.js", "assets/javascripts/material.js"
|
19
19
|
cp "#{source_dir}/js/material.min.js", "assets/javascripts/material.min.js"
|
20
20
|
|
21
|
-
|
22
|
-
src_dir = "#{source_dir}/dist/
|
23
|
-
tgt_dir = "assets/javascripts/material/"
|
24
|
-
mkdir_p tgt_dir
|
25
|
-
cp_r src_dir, tgt_dir
|
26
|
-
|
27
|
-
src_dir = "#{source_dir}/dist/assets/js/addons-materialise/."
|
28
|
-
tgt_dir = "assets/javascripts/material/initializers"
|
21
|
+
|
22
|
+
src_dir = "#{source_dir}/js/dist/third-party/."
|
23
|
+
tgt_dir = "assets/javascripts/material/addons"
|
29
24
|
mkdir_p tgt_dir
|
30
25
|
cp_r src_dir, tgt_dir
|
31
26
|
|
@@ -74,3 +69,10 @@ end
|
|
74
69
|
|
75
70
|
desc "Setup or update assets files"
|
76
71
|
task setup: ["javascripts:setup", "stylesheets:setup"]
|
72
|
+
|
73
|
+
desc 'Update material from upstream'
|
74
|
+
task :update, :branch do |t, args|
|
75
|
+
require './tasks/updater'
|
76
|
+
Updater.new(branch: args[:branch]).update_material
|
77
|
+
end
|
78
|
+
|
@@ -1,1038 +1,3491 @@
|
|
1
1
|
/*!
|
2
|
-
* Material v4.0.0-beta (http://daemonite.github.io/material/)
|
3
|
-
* Copyright
|
2
|
+
* Daemonite Material v4.0.0-beta (http://daemonite.github.io/material/)
|
3
|
+
* Copyright 2011-2018 Daemon Pty Ltd
|
4
4
|
* Licensed under MIT (https://github.com/Daemonite/material/blob/master/LICENSE)
|
5
5
|
*/
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
(function (global, factory) {
|
8
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery')) :
|
9
|
+
typeof define === 'function' && define.amd ? define(['exports', 'jquery'], factory) :
|
10
|
+
(factory((global.material = {}),global.jQuery));
|
11
|
+
}(this, (function (exports,$) { 'use strict';
|
12
|
+
|
13
|
+
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
14
|
+
|
15
|
+
function createCommonjsModule(fn, module) {
|
16
|
+
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
9
17
|
}
|
10
18
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
19
|
+
var picker = createCommonjsModule(function (module, exports) {
|
20
|
+
/*!
|
21
|
+
* pickadate.js v3.5.6, 2015/04/20
|
22
|
+
* By Amsul, http://amsul.ca
|
23
|
+
* Hosted on http://amsul.github.io/pickadate.js
|
24
|
+
* Licensed under MIT
|
25
|
+
*/
|
17
26
|
|
18
|
-
|
19
|
-
!function(a){a(Picker,jQuery)}(function(a,b){function c(a,b){var c=this,d=a.$node[0],e=d.value,f=a.$node.data("value"),g=f||e,h=f?b.formatSubmit:b.format,i=function(){return d.currentStyle?"rtl"==d.currentStyle.direction:"rtl"==getComputedStyle(a.$root[0]).direction};c.settings=b,c.$node=a.$node,c.queue={min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse navigate create validate",view:"parse create validate viewset",disable:"deactivate",enable:"activate"},c.item={},c.item.clear=null,c.item.disable=(b.disable||[]).slice(0),c.item.enable=-function(a){return a[0]===!0?a.shift():-1}(c.item.disable),c.set("min",b.min).set("max",b.max).set("now"),g?c.set("select",g,{format:h,defaultValue:!0}):c.set("select",null).set("highlight",c.item.now),c.key={40:7,38:-7,39:function(){return i()?-1:1},37:function(){return i()?1:-1},go:function(a){var b=c.item.highlight,d=new Date(b.year,b.month,b.date+a);c.set("highlight",d,{interval:a}),this.render()}},a.on("render",function(){a.$root.find("."+b.klass.selectMonth).on("change",function(){var c=this.value;c&&(a.set("highlight",[a.get("view").year,c,a.get("highlight").date]),a.$root.find("."+b.klass.selectMonth).trigger("focus"))}),a.$root.find("."+b.klass.selectYear).on("change",function(){var c=this.value;c&&(a.set("highlight",[c,a.get("view").month,a.get("highlight").date]),a.$root.find("."+b.klass.selectYear).trigger("focus"))})},1).on("open",function(){var d="";c.disabled(c.get("now"))&&(d=":not(."+b.klass.buttonToday+")"),a.$root.find("button"+d+", select").attr("disabled",!1)},1).on("close",function(){a.$root.find("button, select").attr("disabled",!0)},1)}var d=7,e=6,f=a._;c.prototype.set=function(a,b,c){var d=this,e=d.item;return null===b?("clear"==a&&(a="select"),e[a]=b,d):(e["enable"==a?"disable":"flip"==a?"enable":a]=d.queue[a].split(" ").map(function(e){return b=d[e](a,b,c)}).pop(),"select"==a?d.set("highlight",e.select,c):"highlight"==a?d.set("view",e.highlight,c):a.match(/^(flip|min|max|disable|enable)$/)&&(e.select&&d.disabled(e.select)&&d.set("select",e.select,c),e.highlight&&d.disabled(e.highlight)&&d.set("highlight",e.highlight,c)),d)},c.prototype.get=function(a){return this.item[a]},c.prototype.create=function(a,c,d){var e,g=this;return c=void 0===c?a:c,c==-(1/0)||c==1/0?e=c:b.isPlainObject(c)&&f.isInteger(c.pick)?c=c.obj:b.isArray(c)?(c=new Date(c[0],c[1],c[2]),c=f.isDate(c)?c:g.create().obj):c=f.isInteger(c)||f.isDate(c)?g.normalize(new Date(c),d):g.now(a,c,d),{year:e||c.getFullYear(),month:e||c.getMonth(),date:e||c.getDate(),day:e||c.getDay(),obj:e||c,pick:e||c.getTime()}},c.prototype.createRange=function(a,c){var d=this,e=function(a){return a===!0||b.isArray(a)||f.isDate(a)?d.create(a):a};return f.isInteger(a)||(a=e(a)),f.isInteger(c)||(c=e(c)),f.isInteger(a)&&b.isPlainObject(c)?a=[c.year,c.month,c.date+a]:f.isInteger(c)&&b.isPlainObject(a)&&(c=[a.year,a.month,a.date+c]),{from:e(a),to:e(c)}},c.prototype.withinRange=function(a,b){return a=this.createRange(a.from,a.to),b.pick>=a.from.pick&&b.pick<=a.to.pick},c.prototype.overlapRanges=function(a,b){var c=this;return a=c.createRange(a.from,a.to),b=c.createRange(b.from,b.to),c.withinRange(a,b.from)||c.withinRange(a,b.to)||c.withinRange(b,a.from)||c.withinRange(b,a.to)},c.prototype.now=function(a,b,c){return b=new Date,c&&c.rel&&b.setDate(b.getDate()+c.rel),this.normalize(b,c)},c.prototype.navigate=function(a,c,d){var e,f,g,h,i=b.isArray(c),j=b.isPlainObject(c),k=this.item.view;if(i||j){for(j?(f=c.year,g=c.month,h=c.date):(f=+c[0],g=+c[1],h=+c[2]),d&&d.nav&&k&&k.month!==g&&(f=k.year,g=k.month),e=new Date(f,g+(d&&d.nav?d.nav:0),1),f=e.getFullYear(),g=e.getMonth();new Date(f,g,h).getMonth()!==g;)h-=1;c=[f,g,h]}return c},c.prototype.normalize=function(a){return a.setHours(0,0,0,0),a},c.prototype.measure=function(a,b){var c=this;return b?"string"==typeof b?b=c.parse(a,b):f.isInteger(b)&&(b=c.now(a,b,{rel:b})):b="min"==a?-(1/0):1/0,b},c.prototype.viewset=function(a,b){return this.create([b.year,b.month,1])},c.prototype.validate=function(a,c,d){var e,g,h,i,j=this,k=c,l=d&&d.interval?d.interval:1,m=-1===j.item.enable,n=j.item.min,o=j.item.max,p=m&&j.item.disable.filter(function(a){if(b.isArray(a)){var d=j.create(a).pick;d<c.pick?e=!0:d>c.pick&&(g=!0)}return f.isInteger(a)}).length;if((!d||!d.nav&&!d.defaultValue)&&(!m&&j.disabled(c)||m&&j.disabled(c)&&(p||e||g)||!m&&(c.pick<=n.pick||c.pick>=o.pick)))for(m&&!p&&(!g&&l>0||!e&&0>l)&&(l*=-1);j.disabled(c)&&(Math.abs(l)>1&&(c.month<k.month||c.month>k.month)&&(c=k,l=l>0?1:-1),c.pick<=n.pick?(h=!0,l=1,c=j.create([n.year,n.month,n.date+(c.pick===n.pick?0:-1)])):c.pick>=o.pick&&(i=!0,l=-1,c=j.create([o.year,o.month,o.date+(c.pick===o.pick?0:1)])),!h||!i);)c=j.create([c.year,c.month,c.date+l]);return c},c.prototype.disabled=function(a){var c=this,d=c.item.disable.filter(function(d){return f.isInteger(d)?a.day===(c.settings.firstDay?d:d-1)%7:b.isArray(d)||f.isDate(d)?a.pick===c.create(d).pick:b.isPlainObject(d)?c.withinRange(d,a):void 0});return d=d.length&&!d.filter(function(a){return b.isArray(a)&&"inverted"==a[3]||b.isPlainObject(a)&&a.inverted}).length,-1===c.item.enable?!d:d||a.pick<c.item.min.pick||a.pick>c.item.max.pick},c.prototype.parse=function(a,b,c){var d=this,e={};return b&&"string"==typeof b?(c&&c.format||(c=c||{},c.format=d.settings.format),d.formats.toArray(c.format).map(function(a){var c=d.formats[a],g=c?f.trigger(c,d,[b,e]):a.replace(/^!/,"").length;c&&(e[a]=b.substr(0,g)),b=b.substr(g)}),[e.yyyy||e.yy,+(e.mm||e.m)-1,e.dd||e.d]):b},c.prototype.formats=function(){function a(a,b,c){var d=a.match(/[^\x00-\x7F]+|\w+/)[0];return c.mm||c.m||(c.m=b.indexOf(d)+1),d.length}function b(a){return a.match(/\w+/)[0].length}return{d:function(a,b){return a?f.digits(a):b.date},dd:function(a,b){return a?2:f.lead(b.date)},ddd:function(a,c){return a?b(a):this.settings.weekdaysShort[c.day]},dddd:function(a,c){return a?b(a):this.settings.weekdaysFull[c.day]},m:function(a,b){return a?f.digits(a):b.month+1},mm:function(a,b){return a?2:f.lead(b.month+1)},mmm:function(b,c){var d=this.settings.monthsShort;return b?a(b,d,c):d[c.month]},mmmm:function(b,c){var d=this.settings.monthsFull;return b?a(b,d,c):d[c.month]},yy:function(a,b){return a?2:(""+b.year).slice(2)},yyyy:function(a,b){return a?4:b.year},toArray:function(a){return a.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g)},toString:function(a,b){var c=this;return c.formats.toArray(a).map(function(a){return f.trigger(c.formats[a],c,[0,b])||a.replace(/^!/,"")}).join("")}}}(),c.prototype.isDateExact=function(a,c){var d=this;return f.isInteger(a)&&f.isInteger(c)||"boolean"==typeof a&&"boolean"==typeof c?a===c:(f.isDate(a)||b.isArray(a))&&(f.isDate(c)||b.isArray(c))?d.create(a).pick===d.create(c).pick:b.isPlainObject(a)&&b.isPlainObject(c)?d.isDateExact(a.from,c.from)&&d.isDateExact(a.to,c.to):!1},c.prototype.isDateOverlap=function(a,c){var d=this,e=d.settings.firstDay?1:0;return f.isInteger(a)&&(f.isDate(c)||b.isArray(c))?(a=a%7+e,a===d.create(c).day+1):f.isInteger(c)&&(f.isDate(a)||b.isArray(a))?(c=c%7+e,c===d.create(a).day+1):b.isPlainObject(a)&&b.isPlainObject(c)?d.overlapRanges(a,c):!1},c.prototype.flipEnable=function(a){var b=this.item;b.enable=a||(-1==b.enable?1:-1)},c.prototype.deactivate=function(a,c){var d=this,e=d.item.disable.slice(0);return"flip"==c?d.flipEnable():c===!1?(d.flipEnable(1),e=[]):c===!0?(d.flipEnable(-1),e=[]):c.map(function(a){for(var c,g=0;g<e.length;g+=1)if(d.isDateExact(a,e[g])){c=!0;break}c||(f.isInteger(a)||f.isDate(a)||b.isArray(a)||b.isPlainObject(a)&&a.from&&a.to)&&e.push(a)}),e},c.prototype.activate=function(a,c){var d=this,e=d.item.disable,g=e.length;return"flip"==c?d.flipEnable():c===!0?(d.flipEnable(1),e=[]):c===!1?(d.flipEnable(-1),e=[]):c.map(function(a){var c,h,i,j;for(i=0;g>i;i+=1){if(h=e[i],d.isDateExact(h,a)){c=e[i]=null,j=!0;break}if(d.isDateOverlap(h,a)){b.isPlainObject(a)?(a.inverted=!0,c=a):b.isArray(a)?(c=a,c[3]||c.push("inverted")):f.isDate(a)&&(c=[a.getFullYear(),a.getMonth(),a.getDate(),"inverted"]);break}}if(c)for(i=0;g>i;i+=1)if(d.isDateExact(e[i],a)){e[i]=null;break}if(j)for(i=0;g>i;i+=1)if(d.isDateOverlap(e[i],a)){e[i]=null;break}c&&e.push(c)}),e.filter(function(a){return null!=a})},c.prototype.nodes=function(a){var b=this,c=b.settings,g=b.item,h=g.now,i=g.select,j=g.highlight,k=g.view,l=g.disable,m=g.min,n=g.max,o=function(a,b){return c.firstDay&&(a.push(a.shift()),b.push(b.shift())),f.node("thead",f.node("tr",f.group({min:0,max:d-1,i:1,node:"th",item:function(d){return[a[d],c.klass.weekdays,'scope=col title="'+b[d]+'"']}})))}((c.showWeekdaysFull?c.weekdaysFull:c.weekdaysShort).slice(0),c.weekdaysFull.slice(0)),p=function(a){return f.node("div"," ",c.klass["nav"+(a?"Next":"Prev")]+(a&&k.year>=n.year&&k.month>=n.month||!a&&k.year<=m.year&&k.month<=m.month?" "+c.klass.navDisabled:""),"data-nav="+(a||-1)+" "+f.ariaAttr({role:"button",controls:b.$node[0].id+"_table"})+' title="'+(a?c.labelMonthNext:c.labelMonthPrev)+'"')},q=function(){var d=c.showMonthsShort?c.monthsShort:c.monthsFull;return c.selectMonths?f.node("select",f.group({min:0,max:11,i:1,node:"option",item:function(a){return[d[a],0,"value="+a+(k.month==a?" selected":"")+(k.year==m.year&&a<m.month||k.year==n.year&&a>n.month?" disabled":"")]}}),c.klass.selectMonth,(a?"":"disabled")+" "+f.ariaAttr({controls:b.$node[0].id+"_table"})+' title="'+c.labelMonthSelect+'"'):f.node("div",d[k.month],c.klass.month)},r=function(){var d=k.year,e=c.selectYears===!0?5:~~(c.selectYears/2);if(e){var g=m.year,h=n.year,i=d-e,j=d+e;if(g>i&&(j+=g-i,i=g),j>h){var l=i-g,o=j-h;i-=l>o?o:l,j=h}return f.node("select",f.group({min:i,max:j,i:1,node:"option",item:function(a){return[a,0,"value="+a+(d==a?" selected":"")]}}),c.klass.selectYear,(a?"":"disabled")+" "+f.ariaAttr({controls:b.$node[0].id+"_table"})+' title="'+c.labelYearSelect+'"')}return f.node("div",d,c.klass.year)};return f.node("div",(c.selectYears?r()+q():q()+r())+p()+p(1),c.klass.header)+f.node("table",o+f.node("tbody",f.group({min:0,max:e-1,i:1,node:"tr",item:function(a){var e=c.firstDay&&0===b.create([k.year,k.month,1]).day?-7:0;return[f.group({min:d*a-k.day+e+1,max:function(){return this.min+d-1},i:1,node:"td",item:function(a){a=b.create([k.year,k.month,a+(c.firstDay?1:0)]);var d=i&&i.pick==a.pick,e=j&&j.pick==a.pick,g=l&&b.disabled(a)||a.pick<m.pick||a.pick>n.pick,o=f.trigger(b.formats.toString,b,[c.format,a]);return[f.node("div",a.date,function(b){return b.push(k.month==a.month?c.klass.infocus:c.klass.outfocus),h.pick==a.pick&&b.push(c.klass.now),d&&b.push(c.klass.selected),e&&b.push(c.klass.highlighted),g&&b.push(c.klass.disabled),b.join(" ")}([c.klass.day]),"data-pick="+a.pick+" "+f.ariaAttr({role:"gridcell",label:o,selected:d&&b.$node.val()===o?!0:null,activedescendant:e?!0:null,disabled:g?!0:null})),"",f.ariaAttr({role:"presentation"})]}})]}})),c.klass.table,'id="'+b.$node[0].id+'_table" '+f.ariaAttr({role:"grid",controls:b.$node[0].id,readonly:!0}))+f.node("div",f.node("button",c.today,c.klass.buttonToday,"type=button data-pick="+h.pick+(a&&!b.disabled(h)?"":" disabled")+" "+f.ariaAttr({controls:b.$node[0].id}))+f.node("button",c.clear,c.klass.buttonClear,"type=button data-clear=1"+(a?"":" disabled")+" "+f.ariaAttr({controls:b.$node[0].id}))+f.node("button",c.close,c.klass.buttonClose,"type=button data-close=true "+(a?"":" disabled")+" "+f.ariaAttr({controls:b.$node[0].id})),c.klass.footer)},c.defaults=function(a){return{labelMonthNext:"Next month",labelMonthPrev:"Previous month",labelMonthSelect:"Select a month",labelYearSelect:"Select a year",monthsFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdaysFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],today:"Today",clear:"Clear",close:"Close",closeOnSelect:!0,closeOnClear:!0,format:"d mmmm, yyyy",klass:{table:a+"table",header:a+"header",navPrev:a+"nav--prev",navNext:a+"nav--next",navDisabled:a+"nav--disabled",month:a+"month",year:a+"year",selectMonth:a+"select--month",selectYear:a+"select--year",weekdays:a+"weekday",day:a+"day",disabled:a+"day--disabled",selected:a+"day--selected",highlighted:a+"day--highlighted",now:a+"day--today",infocus:a+"day--infocus",outfocus:a+"day--outfocus",footer:a+"footer",buttonClear:a+"button--clear",buttonToday:a+"button--today",buttonClose:a+"button--close"}}}(a.klasses().picker+"__"),a.extend("pickadate",c)});
|
20
|
-
!function(a,b,c,d){function h(b,c){this.element=b,this.$element=a(b),this.init()}var e="textareaAutoSize",f="plugin_"+e,g=function(a){return a.replace(/\s/g,"").length>0};h.prototype={init:function(){var c=parseInt(this.$element.css("paddingBottom"))+parseInt(this.$element.css("paddingTop"))+parseInt(this.$element.css("borderTopWidth"))+parseInt(this.$element.css("borderBottomWidth"))||0;g(this.element.value)&&this.$element.height(this.element.scrollHeight-c),this.$element.on("input keyup",function(d){var e=a(b),f=e.scrollTop();a(this).height(0).height(this.scrollHeight-c),e.scrollTop(f)})}},a.fn[e]=function(b){return this.each(function(){a.data(this,f)||a.data(this,f,new h(this,b))}),this}}(jQuery,window,document);
|
27
|
+
(function ( factory ) {
|
21
28
|
|
22
|
-
|
29
|
+
// AMD.
|
30
|
+
if ( typeof undefined == 'function' && undefined.amd )
|
31
|
+
undefined( 'picker', ['jquery'], factory );
|
23
32
|
|
24
|
-
|
33
|
+
// Node.js/browserify.
|
34
|
+
else module.exports = factory( $ );
|
25
35
|
|
26
|
-
|
36
|
+
}(function( $$$1 ) {
|
27
37
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
38
|
+
var $window = $$$1( window );
|
39
|
+
var $document = $$$1( document );
|
40
|
+
var $html = $$$1( document.documentElement );
|
41
|
+
var supportsTransitions = document.documentElement.style.transition != null;
|
32
42
|
|
33
|
-
if (typeof $.fn.pickadate === 'undefined') {
|
34
|
-
throw new Error('Material\'s JavaScript requires pickadate.js')
|
35
|
-
}
|
36
43
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
container : 'body',
|
42
|
-
disable : [],
|
43
|
-
firstDay : 0,
|
44
|
-
format : 'd/m/yyyy',
|
45
|
-
formatSubmit : '',
|
46
|
-
klass : {
|
47
|
-
// button
|
48
|
-
buttonClear : 'btn btn-outline-primary picker-button-clear',
|
49
|
-
buttonClose : 'btn btn-outline-primary picker-button-close',
|
50
|
-
buttonToday : 'btn btn-outline-primary picker-button-today',
|
44
|
+
/**
|
45
|
+
* The picker constructor that creates a blank picker.
|
46
|
+
*/
|
47
|
+
function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {
|
51
48
|
|
52
|
-
|
53
|
-
|
54
|
-
disabled : 'picker-day-disabled',
|
55
|
-
highlighted : 'picker-day-highlighted',
|
56
|
-
infocus : 'picker-day-infocus',
|
57
|
-
now : 'picker-day-today',
|
58
|
-
outfocus : 'picker-day-outfocus',
|
59
|
-
selected : 'picker-day-selected',
|
60
|
-
weekdays : 'picker-weekday',
|
49
|
+
// If there’s no element, return the picker constructor.
|
50
|
+
if ( !ELEMENT ) return PickerConstructor
|
61
51
|
|
62
|
-
// element
|
63
|
-
box : 'picker-box',
|
64
|
-
footer : 'picker-footer',
|
65
|
-
frame : 'picker-frame',
|
66
|
-
header : 'picker-header',
|
67
|
-
holder : 'picker-holder',
|
68
|
-
table : 'picker-table',
|
69
|
-
wrap : 'picker-wrap',
|
70
52
|
|
71
|
-
|
72
|
-
|
73
|
-
input : 'picker-input',
|
53
|
+
var
|
54
|
+
IS_DEFAULT_THEME = false,
|
74
55
|
|
75
|
-
// month and year nav
|
76
|
-
month : 'picker-month',
|
77
|
-
navDisabled : 'picker-nav-disabled',
|
78
|
-
navNext : 'material-icons picker-nav-next',
|
79
|
-
navPrev : 'material-icons picker-nav-prev',
|
80
|
-
selectMonth : 'picker-select-month',
|
81
|
-
selectYear : 'picker-select-year',
|
82
|
-
year : 'picker-year',
|
83
56
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
},
|
89
|
-
max : false,
|
90
|
-
min : false,
|
91
|
-
monthsFull : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
92
|
-
monthsShort : ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
93
|
-
ok : 'OK',
|
94
|
-
onClose : false,
|
95
|
-
onOpen : false,
|
96
|
-
onRender : false,
|
97
|
-
onSet : false,
|
98
|
-
onStart : false,
|
99
|
-
onStop : false,
|
100
|
-
selectMonths : false,
|
101
|
-
selectYears : false,
|
102
|
-
today : '',
|
103
|
-
weekdaysFull : ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
104
|
-
weekdaysShort : ['S', 'M', 'T', 'W', 'T', 'F', 'S']
|
105
|
-
}
|
57
|
+
// The state of the picker.
|
58
|
+
STATE = {
|
59
|
+
id: ELEMENT.id || 'P' + Math.abs( ~~(Math.random() * new Date()) )
|
60
|
+
},
|
106
61
|
|
107
|
-
Datepicker.prototype.display = function (datepickerApi, datepickerRoot, datepickerValue) {
|
108
|
-
$('.picker-date-display', datepickerRoot).remove()
|
109
|
-
|
110
|
-
$('.picker-wrap', datepickerRoot).prepend('<div class="picker-date-display">' +
|
111
|
-
'<div class="picker-date-display-top">' +
|
112
|
-
'<span class="picker-year-display">' + datepickerApi.get(datepickerValue, 'yyyy') + '</span>' +
|
113
|
-
'</div>' +
|
114
|
-
'<div class="picker-date-display-bottom">' +
|
115
|
-
'<span class="picker-weekday-display">' + datepickerApi.get(datepickerValue, 'dddd') + '</span>' +
|
116
|
-
'<span class="picker-day-display">' + datepickerApi.get(datepickerValue, 'd') + '</span>' +
|
117
|
-
'<span class="picker-month-display">' + datepickerApi.get(datepickerValue, 'mmm') + '</span>' +
|
118
|
-
'</div>' +
|
119
|
-
'</div>')
|
120
|
-
}
|
121
62
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
$(this._element).pickadate({
|
126
|
-
clear : that._options.cancel,
|
127
|
-
close : that._options.ok,
|
128
|
-
closeOnClear : that._options.closeOnCancel,
|
129
|
-
closeOnSelect : that._options.closeOnSelect,
|
130
|
-
container : that._options.container,
|
131
|
-
disable : that._options.disable,
|
132
|
-
firstDay : that._options.firstDay,
|
133
|
-
format : that._options.format,
|
134
|
-
formatSubmit : that._options.formatSubmit,
|
135
|
-
klass : that._options.klass,
|
136
|
-
max : that._options.max,
|
137
|
-
min : that._options.min,
|
138
|
-
monthsFull : that._options.monthsFull,
|
139
|
-
monthsShort : that._options.monthsShort,
|
140
|
-
onClose : that._options.onClose,
|
141
|
-
onOpen : that._options.onOpen,
|
142
|
-
onRender : that._options.onRender,
|
143
|
-
onSet : that._options.onSet,
|
144
|
-
onStart : that._options.onStart,
|
145
|
-
onStop : that._options.onStop,
|
146
|
-
selectMonths : that._options.selectMonths,
|
147
|
-
selectYears : that._options.selectYears,
|
148
|
-
today : that._options.today,
|
149
|
-
weekdaysFull : that._options.weekdaysFull,
|
150
|
-
weekdaysShort : that._options.weekdaysShort
|
151
|
-
})
|
152
|
-
|
153
|
-
var datepickerApi = $(this._element).pickadate('picker'),
|
154
|
-
datepickerNode = datepickerApi.$node,
|
155
|
-
datepickerRoot = datepickerApi.$root
|
63
|
+
// Merge the defaults and options passed.
|
64
|
+
SETTINGS = COMPONENT ? $$$1.extend( true, {}, COMPONENT.defaults, OPTIONS ) : OPTIONS || {},
|
156
65
|
|
157
|
-
datepickerApi.on({
|
158
|
-
close: function () {
|
159
|
-
$(document.activeElement).blur()
|
160
|
-
},
|
161
|
-
open: function () {
|
162
|
-
if (!$('.picker__date-display', datepickerRoot).length) {
|
163
|
-
that.display(datepickerApi, datepickerRoot, 'highlight')
|
164
|
-
}
|
165
|
-
},
|
166
|
-
set: function () {
|
167
|
-
if (datepickerApi.get('select') !== null) {
|
168
|
-
that.display(datepickerApi, datepickerRoot, 'select')
|
169
|
-
}
|
170
|
-
}
|
171
|
-
})
|
172
|
-
}
|
173
66
|
|
174
|
-
|
175
|
-
|
176
|
-
var data = $(this).data('bs.pickdate')
|
177
|
-
var options = $.extend({}, Datepicker.DEFAULTS, $(this).data(), typeof option == 'object' && option)
|
67
|
+
// Merge the default classes with the settings classes.
|
68
|
+
CLASSES = $$$1.extend( {}, PickerConstructor.klasses(), SETTINGS.klass ),
|
178
69
|
|
179
|
-
if (!data) {
|
180
|
-
$(this).data('bs.pickdate', (data = new Datepicker(this, options)))
|
181
|
-
}
|
182
70
|
|
183
|
-
|
184
|
-
|
185
|
-
}
|
71
|
+
// The element node wrapper into a jQuery object.
|
72
|
+
$ELEMENT = $$$1( ELEMENT ),
|
186
73
|
|
187
|
-
var old = $.fn.pickdate
|
188
74
|
|
189
|
-
|
190
|
-
|
75
|
+
// Pseudo picker constructor.
|
76
|
+
PickerInstance = function() {
|
77
|
+
return this.start()
|
78
|
+
},
|
191
79
|
|
192
|
-
$.fn.pickdate.noConflict = function () {
|
193
|
-
$.fn.pickdate = old
|
194
|
-
return this
|
195
|
-
}
|
196
80
|
|
197
|
-
|
81
|
+
// The picker prototype.
|
82
|
+
P = PickerInstance.prototype = {
|
198
83
|
|
199
|
-
|
200
|
-
if ($('.textarea-autosize').length && (typeof $.fn.textareaAutoSize !== 'undefined')) {
|
201
|
-
$('.textarea-autosize').textareaAutoSize()
|
202
|
-
}
|
203
|
-
})
|
204
|
-
|
205
|
-
$(function () {
|
206
|
-
if ($('.waves-attach').length && (typeof Waves !== 'undefined')) {
|
207
|
-
Waves.attach('.waves-attach')
|
208
|
-
Waves.init({
|
209
|
-
duration: 300
|
210
|
-
})
|
211
|
-
}
|
212
|
-
})
|
84
|
+
constructor: PickerInstance,
|
213
85
|
|
214
|
-
|
86
|
+
$node: $ELEMENT,
|
215
87
|
|
216
|
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
217
88
|
|
218
|
-
|
89
|
+
/**
|
90
|
+
* Initialize everything
|
91
|
+
*/
|
92
|
+
start: function() {
|
219
93
|
|
220
|
-
|
221
|
-
|
222
|
-
* expansion panel
|
223
|
-
* upon selecting the collapsed panel,
|
224
|
-
* it expands to display in full
|
225
|
-
*/
|
94
|
+
// If it’s already started, do nothing.
|
95
|
+
if ( STATE && STATE.start ) return P
|
226
96
|
|
227
|
-
var ExpansionPanel = function ($) {
|
228
97
|
|
229
|
-
|
230
|
-
|
231
|
-
|
98
|
+
// Update the picker states.
|
99
|
+
STATE.methods = {};
|
100
|
+
STATE.start = true;
|
101
|
+
STATE.open = false;
|
102
|
+
STATE.type = ELEMENT.type;
|
232
103
|
|
233
|
-
var ClassName = {
|
234
|
-
SHOW: 'show',
|
235
|
-
SHOW_PREDECESSOR: 'show-predecessor'
|
236
|
-
};
|
237
104
|
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
105
|
+
// Confirm focus state, convert into text input to remove UA stylings,
|
106
|
+
// and set as readonly to prevent keyboard popup.
|
107
|
+
ELEMENT.autofocus = ELEMENT == getActiveElement();
|
108
|
+
ELEMENT.readOnly = !SETTINGS.editable;
|
109
|
+
ELEMENT.id = ELEMENT.id || STATE.id;
|
110
|
+
if ( ELEMENT.type != 'text' ) {
|
111
|
+
ELEMENT.type = 'text';
|
112
|
+
}
|
242
113
|
|
243
|
-
var Selector = {
|
244
|
-
PANEL: '.expansion-panel',
|
245
|
-
PANEL_BODY: '.expansion-panel .collapse'
|
246
|
-
};
|
247
|
-
// <<< constants
|
248
114
|
|
249
|
-
|
250
|
-
|
115
|
+
// Create a new picker component with the settings.
|
116
|
+
P.component = new COMPONENT(P, SETTINGS);
|
251
117
|
|
252
|
-
target.removeClass(ClassName.SHOW);
|
253
118
|
|
254
|
-
|
119
|
+
// Create the picker root and then prepare it.
|
120
|
+
P.$root = $$$1( '<div class="' + CLASSES.picker + '" id="' + ELEMENT.id + '_root" />' );
|
121
|
+
prepareElementRoot();
|
255
122
|
|
256
|
-
if (predecessor.length) {
|
257
|
-
predecessor.removeClass(ClassName.SHOW_PREDECESSOR);
|
258
|
-
}
|
259
|
-
}).on('' + Event.SHOW, Selector.PANEL_BODY, function (event) {
|
260
|
-
var target = $(event.target).closest(Selector.PANEL);
|
261
123
|
|
262
|
-
|
124
|
+
// Create the picker holder and then prepare it.
|
125
|
+
P.$holder = $$$1( createWrappedComponent() ).appendTo( P.$root );
|
126
|
+
prepareElementHolder();
|
263
127
|
|
264
|
-
var predecessor = target.prev(Selector.PANEL);
|
265
128
|
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
}(jQuery);
|
129
|
+
// If there’s a format for the hidden input element, create the element.
|
130
|
+
if ( SETTINGS.formatSubmit ) {
|
131
|
+
prepareElementHidden();
|
132
|
+
}
|
271
133
|
|
272
|
-
/*
|
273
|
-
* floating label
|
274
|
-
* when a user engages with the text input field,
|
275
|
-
* the floating inline labels move to float above the field
|
276
|
-
*/
|
277
134
|
|
278
|
-
|
135
|
+
// Prepare the input element.
|
136
|
+
prepareElement();
|
279
137
|
|
280
|
-
// constants >>>
|
281
|
-
var DATA_KEY = 'md.floatinglabel';
|
282
|
-
var EVENT_KEY = '.' + DATA_KEY;
|
283
|
-
var NAME = 'floatinglabel';
|
284
|
-
var NO_CONFLICT = $.fn[NAME];
|
285
138
|
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
};
|
139
|
+
// Insert the hidden input as specified in the settings.
|
140
|
+
if ( SETTINGS.containerHidden ) $$$1( SETTINGS.containerHidden ).append( P._hidden );
|
141
|
+
else $ELEMENT.after( P._hidden );
|
290
142
|
|
291
|
-
var Event = {
|
292
|
-
CHANGE: 'change' + EVENT_KEY,
|
293
|
-
FOCUSIN: 'focusin' + EVENT_KEY,
|
294
|
-
FOCUSOUT: 'focusout' + EVENT_KEY
|
295
|
-
};
|
296
143
|
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
};
|
301
|
-
// <<< constants
|
144
|
+
// Insert the root as specified in the settings.
|
145
|
+
if ( SETTINGS.container ) $$$1( SETTINGS.container ).append( P.$root );
|
146
|
+
else $ELEMENT.after( P.$root );
|
302
147
|
|
303
|
-
var FloatingLabel = function () {
|
304
|
-
function FloatingLabel(element) {
|
305
|
-
_classCallCheck(this, FloatingLabel);
|
306
148
|
|
307
|
-
|
308
|
-
|
149
|
+
// Bind the default component and settings events.
|
150
|
+
P.on({
|
151
|
+
start: P.component.onStart,
|
152
|
+
render: P.component.onRender,
|
153
|
+
stop: P.component.onStop,
|
154
|
+
open: P.component.onOpen,
|
155
|
+
close: P.component.onClose,
|
156
|
+
set: P.component.onSet
|
157
|
+
}).on({
|
158
|
+
start: SETTINGS.onStart,
|
159
|
+
render: SETTINGS.onRender,
|
160
|
+
stop: SETTINGS.onStop,
|
161
|
+
open: SETTINGS.onOpen,
|
162
|
+
close: SETTINGS.onClose,
|
163
|
+
set: SETTINGS.onSet
|
164
|
+
});
|
309
165
|
|
310
|
-
FloatingLabel.prototype.change = function change(relatedTarget) {
|
311
|
-
if ($(this._element).val() || $(this._element).is('select') && $('option:first-child', $(this._element)).html().replace(' ', '') !== '') {
|
312
|
-
$(relatedTarget).addClass(ClassName.HAS_VALUE);
|
313
|
-
} else {
|
314
|
-
$(relatedTarget).removeClass(ClassName.HAS_VALUE);
|
315
|
-
}
|
316
|
-
};
|
317
166
|
|
318
|
-
|
319
|
-
|
320
|
-
};
|
167
|
+
// Once we’re all set, check the theme in use.
|
168
|
+
IS_DEFAULT_THEME = isUsingDefaultTheme( P.$holder[0] );
|
321
169
|
|
322
|
-
FloatingLabel.prototype.focusout = function focusout(relatedTarget) {
|
323
|
-
$(relatedTarget).removeClass(ClassName.IS_FOCUSED);
|
324
|
-
};
|
325
170
|
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
171
|
+
// If the element has autofocus, open the picker.
|
172
|
+
if ( ELEMENT.autofocus ) {
|
173
|
+
P.open();
|
174
|
+
}
|
330
175
|
|
331
|
-
if (!data) {
|
332
|
-
data = new FloatingLabel(this);
|
333
|
-
$(this).data(DATA_KEY, data);
|
334
|
-
}
|
335
176
|
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
}
|
177
|
+
// Trigger queued the “start” and “render” events.
|
178
|
+
return P.trigger( 'start' ).trigger( 'render' )
|
179
|
+
}, //start
|
340
180
|
|
341
|
-
data[_event]($(this).closest(Selector.DATA_PARENT));
|
342
|
-
}
|
343
|
-
});
|
344
|
-
};
|
345
181
|
|
346
|
-
|
347
|
-
|
182
|
+
/**
|
183
|
+
* Render a new picker
|
184
|
+
*/
|
185
|
+
render: function( entireComponent ) {
|
348
186
|
|
349
|
-
|
350
|
-
|
351
|
-
|
187
|
+
// Insert a new component holder in the root or box.
|
188
|
+
if ( entireComponent ) {
|
189
|
+
P.$holder = $$$1( createWrappedComponent() );
|
190
|
+
prepareElementHolder();
|
191
|
+
P.$root.html( P.$holder );
|
192
|
+
}
|
193
|
+
else P.$root.find( '.' + CLASSES.box ).html( P.component.nodes( STATE.open ) );
|
352
194
|
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
$.fn[NAME] = NO_CONFLICT;
|
357
|
-
return FloatingLabel._jQueryInterface;
|
358
|
-
};
|
195
|
+
// Trigger the queued “render” events.
|
196
|
+
return P.trigger( 'render' )
|
197
|
+
}, //render
|
359
198
|
|
360
|
-
return FloatingLabel;
|
361
|
-
}(jQuery);
|
362
|
-
|
363
|
-
/*
|
364
|
-
* navigation drawer
|
365
|
-
* based on bootstrap's (v4.0.0-beta) modal.js
|
366
|
-
*/
|
367
|
-
|
368
|
-
var NavDrawer = function ($) {
|
369
|
-
|
370
|
-
// constants >>>
|
371
|
-
var DATA_API_KEY = '.data-api';
|
372
|
-
var DATA_KEY = 'md.navdrawer';
|
373
|
-
var ESCAPE_KEYCODE = 27;
|
374
|
-
var EVENT_KEY = '.' + DATA_KEY;
|
375
|
-
var NAME = 'navdrawer';
|
376
|
-
var NO_CONFLICT = $.fn[NAME];
|
377
|
-
var TRANSITION_DURATION = 292.5;
|
378
|
-
var TRANSITION_DURATION_BACKDROP = 487.5;
|
379
|
-
|
380
|
-
var ClassName = {
|
381
|
-
BACKDROP: 'navdrawer-backdrop',
|
382
|
-
OPEN: 'navdrawer-open',
|
383
|
-
SHOW: 'show'
|
384
|
-
};
|
385
199
|
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
type: 'default'
|
391
|
-
};
|
200
|
+
/**
|
201
|
+
* Destroy everything
|
202
|
+
*/
|
203
|
+
stop: function() {
|
392
204
|
|
393
|
-
|
394
|
-
|
395
|
-
show: 'boolean',
|
396
|
-
type: 'string'
|
397
|
-
};
|
205
|
+
// If it’s already stopped, do nothing.
|
206
|
+
if ( !STATE.start ) return P
|
398
207
|
|
399
|
-
|
400
|
-
|
401
|
-
CLICK_DISMISS: 'click.dismiss' + EVENT_KEY,
|
402
|
-
FOCUSIN: 'focusin' + EVENT_KEY,
|
403
|
-
HIDDEN: 'hidden' + EVENT_KEY,
|
404
|
-
HIDE: 'hide' + EVENT_KEY,
|
405
|
-
KEYDOWN_DISMISS: 'keydown.dismiss' + EVENT_KEY,
|
406
|
-
MOUSEDOWN_DISMISS: 'mousedown.dismiss' + EVENT_KEY,
|
407
|
-
MOUSEUP_DISMISS: 'mouseup.dismiss' + EVENT_KEY,
|
408
|
-
SHOW: 'show' + EVENT_KEY,
|
409
|
-
SHOWN: 'shown' + EVENT_KEY
|
410
|
-
};
|
208
|
+
// Then close the picker.
|
209
|
+
P.close();
|
411
210
|
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
};
|
417
|
-
// <<< constants
|
211
|
+
// Remove the hidden field.
|
212
|
+
if ( P._hidden ) {
|
213
|
+
P._hidden.parentNode.removeChild( P._hidden );
|
214
|
+
}
|
418
215
|
|
419
|
-
|
420
|
-
|
421
|
-
_classCallCheck(this, NavDrawer);
|
216
|
+
// Remove the root.
|
217
|
+
P.$root.remove();
|
422
218
|
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
}
|
219
|
+
// Remove the input class, remove the stored data, and unbind
|
220
|
+
// the events (after a tick for IE - see `P.close`).
|
221
|
+
$ELEMENT.removeClass( CLASSES.input ).removeData( NAME );
|
222
|
+
setTimeout( function() {
|
223
|
+
$ELEMENT.off( '.' + STATE.id );
|
224
|
+
}, 0);
|
430
225
|
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
}
|
226
|
+
// Restore the element state
|
227
|
+
ELEMENT.type = STATE.type;
|
228
|
+
ELEMENT.readOnly = false;
|
435
229
|
|
436
|
-
|
437
|
-
|
230
|
+
// Trigger the queued “stop” events.
|
231
|
+
P.trigger( 'stop' );
|
438
232
|
|
439
|
-
|
233
|
+
// Reset the picker states.
|
234
|
+
STATE.methods = {};
|
235
|
+
STATE.start = false;
|
440
236
|
|
441
|
-
|
442
|
-
|
443
|
-
}
|
237
|
+
return P
|
238
|
+
}, //stop
|
444
239
|
|
445
|
-
this._isShown = false;
|
446
|
-
this._setEscapeEvent();
|
447
|
-
$(document).off(Event.FOCUSIN);
|
448
|
-
$(this._content).off(Event.MOUSEDOWN_DISMISS);
|
449
240
|
|
450
|
-
|
241
|
+
/**
|
242
|
+
* Open up the picker
|
243
|
+
*/
|
244
|
+
open: function( dontGiveFocus ) {
|
451
245
|
|
452
|
-
|
453
|
-
|
246
|
+
// If it’s already open, do nothing.
|
247
|
+
if ( STATE.open ) return P
|
454
248
|
|
455
|
-
|
456
|
-
|
249
|
+
// Add the “active” class.
|
250
|
+
$ELEMENT.addClass( CLASSES.active );
|
251
|
+
aria( ELEMENT, 'expanded', true );
|
457
252
|
|
458
|
-
|
459
|
-
|
460
|
-
|
253
|
+
// * A Firefox bug, when `html` has `overflow:hidden`, results in
|
254
|
+
// killing transitions :(. So add the “opened” state on the next tick.
|
255
|
+
// Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
|
256
|
+
setTimeout( function() {
|
461
257
|
|
462
|
-
|
258
|
+
// Add the “opened” class to the picker root.
|
259
|
+
P.$root.addClass( CLASSES.opened );
|
260
|
+
aria( P.$root[0], 'hidden', false );
|
463
261
|
|
464
|
-
|
465
|
-
return;
|
466
|
-
}
|
262
|
+
}, 0 );
|
467
263
|
|
468
|
-
|
469
|
-
|
470
|
-
this._setEscapeEvent();
|
471
|
-
$(this._element).addClass(NAME + '-' + this._config.type);
|
472
|
-
$(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, $.proxy(this.hide, this));
|
264
|
+
// If we have to give focus, bind the element and doc events.
|
265
|
+
if ( dontGiveFocus !== false ) {
|
473
266
|
|
474
|
-
|
475
|
-
|
476
|
-
if ($(event.target).is(_this._element)) {
|
477
|
-
_this._ignoreBackdropClick = true;
|
478
|
-
}
|
479
|
-
});
|
480
|
-
});
|
267
|
+
// Set it as open.
|
268
|
+
STATE.open = true;
|
481
269
|
|
482
|
-
|
483
|
-
|
484
|
-
|
270
|
+
// Prevent the page from scrolling.
|
271
|
+
if ( IS_DEFAULT_THEME ) {
|
272
|
+
$html.
|
273
|
+
css( 'overflow', 'hidden' ).
|
274
|
+
css( 'padding-right', '+=' + getScrollbarWidth() );
|
275
|
+
}
|
276
|
+
|
277
|
+
// Pass focus to the root element’s jQuery object.
|
278
|
+
focusPickerOnceOpened();
|
279
|
+
|
280
|
+
// Bind the document events.
|
281
|
+
$document.on( 'click.' + STATE.id + ' focusin.' + STATE.id, function( event ) {
|
282
|
+
|
283
|
+
var target = event.target;
|
284
|
+
|
285
|
+
// If the target of the event is not the element, close the picker picker.
|
286
|
+
// * Don’t worry about clicks or focusins on the root because those don’t bubble up.
|
287
|
+
// Also, for Firefox, a click on an `option` element bubbles up directly
|
288
|
+
// to the doc. So make sure the target wasn't the doc.
|
289
|
+
// * In Firefox stopPropagation() doesn’t prevent right-click events from bubbling,
|
290
|
+
// which causes the picker to unexpectedly close when right-clicking it. So make
|
291
|
+
// sure the event wasn’t a right-click.
|
292
|
+
if ( target != ELEMENT && target != document && event.which != 3 ) {
|
485
293
|
|
486
|
-
|
487
|
-
|
488
|
-
|
294
|
+
// If the target was the holder that covers the screen,
|
295
|
+
// keep the element focused to maintain tabindex.
|
296
|
+
P.close( target === P.$holder[0] );
|
297
|
+
}
|
489
298
|
|
490
|
-
|
491
|
-
|
299
|
+
}).on( 'keydown.' + STATE.id, function( event ) {
|
300
|
+
|
301
|
+
var
|
302
|
+
// Get the keycode.
|
303
|
+
keycode = event.keyCode,
|
492
304
|
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
305
|
+
// Translate that to a selection change.
|
306
|
+
keycodeToMove = P.component.key[ keycode ],
|
307
|
+
|
308
|
+
// Grab the target.
|
309
|
+
target = event.target;
|
310
|
+
|
311
|
+
|
312
|
+
// On escape, close the picker and give focus.
|
313
|
+
if ( keycode == 27 ) {
|
314
|
+
P.close( true );
|
315
|
+
}
|
501
316
|
|
502
|
-
NavDrawer.prototype._getConfig = function _getConfig(config) {
|
503
|
-
config = $.extend({}, Default, config);
|
504
|
-
Util.typeCheckConfig(NAME, config, DefaultType);
|
505
|
-
return config;
|
506
|
-
};
|
507
317
|
|
508
|
-
|
509
|
-
|
318
|
+
// Check if there is a key movement or “enter” keypress on the element.
|
319
|
+
else if ( target == P.$holder[0] && ( keycodeToMove || keycode == 13 ) ) {
|
320
|
+
|
321
|
+
// Prevent the default action to stop page movement.
|
322
|
+
event.preventDefault();
|
510
323
|
|
511
|
-
|
512
|
-
|
324
|
+
// Trigger the key movement action.
|
325
|
+
if ( keycodeToMove ) {
|
326
|
+
PickerConstructor._.trigger( P.component.key.go, P, [ PickerConstructor._.trigger( keycodeToMove ) ] );
|
327
|
+
}
|
513
328
|
|
514
|
-
|
515
|
-
|
329
|
+
// On “enter”, if the highlighted item isn’t disabled, set the value and close.
|
330
|
+
else if ( !P.$root.find( '.' + CLASSES.highlighted ).hasClass( CLASSES.disabled ) ) {
|
331
|
+
P.set( 'select', P.component.item.highlight );
|
332
|
+
if ( SETTINGS.closeOnSelect ) {
|
333
|
+
P.close( true );
|
334
|
+
}
|
335
|
+
}
|
336
|
+
}
|
516
337
|
|
517
|
-
$(_this3._element).trigger(Event.HIDDEN);
|
518
|
-
});
|
519
|
-
};
|
520
338
|
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
339
|
+
// If the target is within the root and “enter” is pressed,
|
340
|
+
// prevent the default action and trigger a click on the target instead.
|
341
|
+
else if ( $$$1.contains( P.$root[0], target ) && keycode == 13 ) {
|
342
|
+
event.preventDefault();
|
343
|
+
target.click();
|
344
|
+
}
|
345
|
+
});
|
346
|
+
}
|
347
|
+
|
348
|
+
// Trigger the queued “open” events.
|
349
|
+
return P.trigger( 'open' )
|
350
|
+
}, //open
|
351
|
+
|
352
|
+
|
353
|
+
/**
|
354
|
+
* Close the picker
|
355
|
+
*/
|
356
|
+
close: function( giveFocus ) {
|
357
|
+
|
358
|
+
// If we need to give focus, do it before changing states.
|
359
|
+
if ( giveFocus ) {
|
360
|
+
if ( SETTINGS.editable ) {
|
361
|
+
ELEMENT.focus();
|
362
|
+
}
|
363
|
+
else {
|
364
|
+
// ....ah yes! It would’ve been incomplete without a crazy workaround for IE :|
|
365
|
+
// The focus is triggered *after* the close has completed - causing it
|
366
|
+
// to open again. So unbind and rebind the event at the next tick.
|
367
|
+
P.$holder.off( 'focus.toOpen' ).focus();
|
368
|
+
setTimeout( function() {
|
369
|
+
P.$holder.on( 'focus.toOpen', handleFocusToOpenEvent );
|
370
|
+
}, 0 );
|
371
|
+
}
|
372
|
+
}
|
373
|
+
|
374
|
+
// Remove the “active” class.
|
375
|
+
$ELEMENT.removeClass( CLASSES.active );
|
376
|
+
aria( ELEMENT, 'expanded', false );
|
377
|
+
|
378
|
+
// * A Firefox bug, when `html` has `overflow:hidden`, results in
|
379
|
+
// killing transitions :(. So remove the “opened” state on the next tick.
|
380
|
+
// Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
|
381
|
+
setTimeout( function() {
|
382
|
+
|
383
|
+
// Remove the “opened” and “focused” class from the picker root.
|
384
|
+
P.$root.removeClass( CLASSES.opened + ' ' + CLASSES.focused );
|
385
|
+
aria( P.$root[0], 'hidden', true );
|
386
|
+
|
387
|
+
}, 0 );
|
388
|
+
|
389
|
+
// If it’s already closed, do nothing more.
|
390
|
+
if ( !STATE.open ) return P
|
391
|
+
|
392
|
+
// Set it as closed.
|
393
|
+
STATE.open = false;
|
394
|
+
|
395
|
+
// Allow the page to scroll.
|
396
|
+
if ( IS_DEFAULT_THEME ) {
|
397
|
+
$html.
|
398
|
+
css( 'overflow', '' ).
|
399
|
+
css( 'padding-right', '-=' + getScrollbarWidth() );
|
400
|
+
}
|
401
|
+
|
402
|
+
// Unbind the document events.
|
403
|
+
$document.off( '.' + STATE.id );
|
404
|
+
|
405
|
+
// Trigger the queued “close” events.
|
406
|
+
return P.trigger( 'close' )
|
407
|
+
}, //close
|
408
|
+
|
409
|
+
|
410
|
+
/**
|
411
|
+
* Clear the values
|
412
|
+
*/
|
413
|
+
clear: function( options ) {
|
414
|
+
return P.set( 'clear', null, options )
|
415
|
+
}, //clear
|
416
|
+
|
417
|
+
|
418
|
+
/**
|
419
|
+
* Set something
|
420
|
+
*/
|
421
|
+
set: function( thing, value, options ) {
|
422
|
+
|
423
|
+
var thingItem, thingValue,
|
424
|
+
thingIsObject = $$$1.isPlainObject( thing ),
|
425
|
+
thingObject = thingIsObject ? thing : {};
|
426
|
+
|
427
|
+
// Make sure we have usable options.
|
428
|
+
options = thingIsObject && $$$1.isPlainObject( value ) ? value : options || {};
|
429
|
+
|
430
|
+
if ( thing ) {
|
431
|
+
|
432
|
+
// If the thing isn’t an object, make it one.
|
433
|
+
if ( !thingIsObject ) {
|
434
|
+
thingObject[ thing ] = value;
|
435
|
+
}
|
436
|
+
|
437
|
+
// Go through the things of items to set.
|
438
|
+
for ( thingItem in thingObject ) {
|
439
|
+
|
440
|
+
// Grab the value of the thing.
|
441
|
+
thingValue = thingObject[ thingItem ];
|
442
|
+
|
443
|
+
// First, if the item exists and there’s a value, set it.
|
444
|
+
if ( thingItem in P.component.item ) {
|
445
|
+
if ( thingValue === undefined ) thingValue = null;
|
446
|
+
P.component.set( thingItem, thingValue, options );
|
447
|
+
}
|
448
|
+
|
449
|
+
// Then, check to update the element value and broadcast a change.
|
450
|
+
if ( thingItem == 'select' || thingItem == 'clear' ) {
|
451
|
+
$ELEMENT.
|
452
|
+
val( thingItem == 'clear' ? '' : P.get( thingItem, SETTINGS.format ) ).
|
453
|
+
trigger( 'change' );
|
454
|
+
}
|
455
|
+
}
|
456
|
+
|
457
|
+
// Render a new picker.
|
458
|
+
P.render();
|
459
|
+
}
|
460
|
+
|
461
|
+
// When the method isn’t muted, trigger queued “set” events and pass the `thingObject`.
|
462
|
+
return options.muted ? P : P.trigger( 'set', thingObject )
|
463
|
+
}, //set
|
464
|
+
|
465
|
+
|
466
|
+
/**
|
467
|
+
* Get something
|
468
|
+
*/
|
469
|
+
get: function( thing, format ) {
|
470
|
+
|
471
|
+
// Make sure there’s something to get.
|
472
|
+
thing = thing || 'value';
|
473
|
+
|
474
|
+
// If a picker state exists, return that.
|
475
|
+
if ( STATE[ thing ] != null ) {
|
476
|
+
return STATE[ thing ]
|
477
|
+
}
|
478
|
+
|
479
|
+
// Return the submission value, if that.
|
480
|
+
if ( thing == 'valueSubmit' ) {
|
481
|
+
if ( P._hidden ) {
|
482
|
+
return P._hidden.value
|
483
|
+
}
|
484
|
+
thing = 'value';
|
485
|
+
}
|
486
|
+
|
487
|
+
// Return the value, if that.
|
488
|
+
if ( thing == 'value' ) {
|
489
|
+
return ELEMENT.value
|
490
|
+
}
|
491
|
+
|
492
|
+
// Check if a component item exists, return that.
|
493
|
+
if ( thing in P.component.item ) {
|
494
|
+
if ( typeof format == 'string' ) {
|
495
|
+
var thingValue = P.component.get( thing );
|
496
|
+
return thingValue ?
|
497
|
+
PickerConstructor._.trigger(
|
498
|
+
P.component.formats.toString,
|
499
|
+
P.component,
|
500
|
+
[ format, thingValue ]
|
501
|
+
) : ''
|
502
|
+
}
|
503
|
+
return P.component.get( thing )
|
504
|
+
}
|
505
|
+
}, //get
|
506
|
+
|
507
|
+
|
508
|
+
|
509
|
+
/**
|
510
|
+
* Bind events on the things.
|
511
|
+
*/
|
512
|
+
on: function( thing, method, internal ) {
|
513
|
+
|
514
|
+
var thingName, thingMethod,
|
515
|
+
thingIsObject = $$$1.isPlainObject( thing ),
|
516
|
+
thingObject = thingIsObject ? thing : {};
|
517
|
+
|
518
|
+
if ( thing ) {
|
519
|
+
|
520
|
+
// If the thing isn’t an object, make it one.
|
521
|
+
if ( !thingIsObject ) {
|
522
|
+
thingObject[ thing ] = method;
|
523
|
+
}
|
524
|
+
|
525
|
+
// Go through the things to bind to.
|
526
|
+
for ( thingName in thingObject ) {
|
527
|
+
|
528
|
+
// Grab the method of the thing.
|
529
|
+
thingMethod = thingObject[ thingName ];
|
530
|
+
|
531
|
+
// If it was an internal binding, prefix it.
|
532
|
+
if ( internal ) {
|
533
|
+
thingName = '_' + thingName;
|
534
|
+
}
|
535
|
+
|
536
|
+
// Make sure the thing methods collection exists.
|
537
|
+
STATE.methods[ thingName ] = STATE.methods[ thingName ] || [];
|
538
|
+
|
539
|
+
// Add the method to the relative method collection.
|
540
|
+
STATE.methods[ thingName ].push( thingMethod );
|
541
|
+
}
|
542
|
+
}
|
543
|
+
|
544
|
+
return P
|
545
|
+
}, //on
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
/**
|
550
|
+
* Unbind events on the things.
|
551
|
+
*/
|
552
|
+
off: function() {
|
553
|
+
var i, thingName,
|
554
|
+
names = arguments;
|
555
|
+
for ( i = 0, namesCount = names.length; i < namesCount; i += 1 ) {
|
556
|
+
thingName = names[i];
|
557
|
+
if ( thingName in STATE.methods ) {
|
558
|
+
delete STATE.methods[thingName];
|
559
|
+
}
|
560
|
+
}
|
561
|
+
return P
|
562
|
+
},
|
527
563
|
|
528
|
-
NavDrawer.prototype._setEscapeEvent = function _setEscapeEvent() {
|
529
|
-
var _this4 = this;
|
530
564
|
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
565
|
+
/**
|
566
|
+
* Fire off method events.
|
567
|
+
*/
|
568
|
+
trigger: function( name, data ) {
|
569
|
+
var _trigger = function( name ) {
|
570
|
+
var methodList = STATE.methods[ name ];
|
571
|
+
if ( methodList ) {
|
572
|
+
methodList.map( function( method ) {
|
573
|
+
PickerConstructor._.trigger( method, P, [ data ] );
|
574
|
+
});
|
575
|
+
}
|
576
|
+
};
|
577
|
+
_trigger( '_' + name );
|
578
|
+
_trigger( name );
|
579
|
+
return P
|
580
|
+
} //trigger
|
581
|
+
}; //PickerInstance.prototype
|
582
|
+
|
541
583
|
|
542
|
-
|
543
|
-
|
584
|
+
/**
|
585
|
+
* Wrap the picker holder components together.
|
586
|
+
*/
|
587
|
+
function createWrappedComponent() {
|
544
588
|
|
545
|
-
|
589
|
+
// Create a picker wrapper holder
|
590
|
+
return PickerConstructor._.node( 'div',
|
546
591
|
|
547
|
-
|
548
|
-
|
592
|
+
// Create a picker wrapper node
|
593
|
+
PickerConstructor._.node( 'div',
|
549
594
|
|
550
|
-
|
595
|
+
// Create a picker frame
|
596
|
+
PickerConstructor._.node( 'div',
|
551
597
|
|
552
|
-
|
553
|
-
|
554
|
-
_this5._ignoreBackdropClick = false;
|
555
|
-
return;
|
556
|
-
}
|
598
|
+
// Create a picker box node
|
599
|
+
PickerConstructor._.node( 'div',
|
557
600
|
|
558
|
-
|
559
|
-
|
560
|
-
}
|
601
|
+
// Create the components nodes.
|
602
|
+
P.component.nodes( STATE.open ),
|
561
603
|
|
562
|
-
|
563
|
-
|
604
|
+
// The picker box class
|
605
|
+
CLASSES.box
|
606
|
+
),
|
564
607
|
|
565
|
-
|
566
|
-
|
567
|
-
|
608
|
+
// Picker wrap class
|
609
|
+
CLASSES.wrap
|
610
|
+
),
|
568
611
|
|
569
|
-
|
612
|
+
// Picker frame class
|
613
|
+
CLASSES.frame
|
614
|
+
),
|
570
615
|
|
571
|
-
|
572
|
-
|
573
|
-
}
|
616
|
+
// Picker holder class
|
617
|
+
CLASSES.holder,
|
574
618
|
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
}
|
619
|
+
'tabindex="-1"'
|
620
|
+
) //endreturn
|
621
|
+
} //createWrappedComponent
|
579
622
|
|
580
|
-
$(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(TRANSITION_DURATION_BACKDROP);
|
581
|
-
} else if (this._backdrop && !this._isShown) {
|
582
|
-
$(this._backdrop).removeClass(ClassName.SHOW);
|
583
623
|
|
584
|
-
var callbackRemove = function callbackRemove() {
|
585
|
-
_this5._removeBackdrop();
|
586
624
|
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
625
|
+
/**
|
626
|
+
* Prepare the input element with all bindings.
|
627
|
+
*/
|
628
|
+
function prepareElement() {
|
591
629
|
|
592
|
-
|
593
|
-
$(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(TRANSITION_DURATION_BACKDROP);
|
594
|
-
} else {
|
595
|
-
callbackRemove();
|
596
|
-
}
|
597
|
-
} else if (callback) {
|
598
|
-
callback();
|
599
|
-
}
|
600
|
-
};
|
630
|
+
$ELEMENT.
|
601
631
|
|
602
|
-
|
603
|
-
|
632
|
+
// Store the picker data by component name.
|
633
|
+
data(NAME, P).
|
604
634
|
|
605
|
-
|
635
|
+
// Add the “input” class name.
|
636
|
+
addClass(CLASSES.input).
|
606
637
|
|
607
|
-
|
608
|
-
|
609
|
-
|
638
|
+
// If there’s a `data-value`, update the value of the element.
|
639
|
+
val( $ELEMENT.data('value') ?
|
640
|
+
P.get('select', SETTINGS.format) :
|
641
|
+
ELEMENT.value
|
642
|
+
);
|
610
643
|
|
611
|
-
this._element.removeAttribute('aria-hidden');
|
612
|
-
this._element.style.display = 'block';
|
613
644
|
|
614
|
-
if
|
615
|
-
|
645
|
+
// Only bind keydown events if the element isn’t editable.
|
646
|
+
if ( !SETTINGS.editable ) {
|
647
|
+
|
648
|
+
$ELEMENT.
|
649
|
+
|
650
|
+
// On focus/click, open the picker.
|
651
|
+
on( 'focus.' + STATE.id + ' click.' + STATE.id, function(event) {
|
652
|
+
event.preventDefault();
|
653
|
+
P.open();
|
654
|
+
}).
|
655
|
+
|
656
|
+
// Handle keyboard event based on the picker being opened or not.
|
657
|
+
on( 'keydown.' + STATE.id, handleKeydownEvent );
|
616
658
|
}
|
617
659
|
|
618
|
-
$(this._element).addClass(ClassName.SHOW);
|
619
|
-
this._enforceFocus();
|
620
660
|
|
621
|
-
|
622
|
-
|
661
|
+
// Update the aria attributes.
|
662
|
+
aria(ELEMENT, {
|
663
|
+
haspopup: true,
|
664
|
+
expanded: false,
|
665
|
+
readonly: false,
|
666
|
+
owns: ELEMENT.id + '_root'
|
623
667
|
});
|
668
|
+
}
|
624
669
|
|
625
|
-
var transitionComplete = function transitionComplete() {
|
626
|
-
_this6._element.focus();
|
627
|
-
$(_this6._element).trigger(shownEvent);
|
628
|
-
};
|
629
670
|
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
671
|
+
/**
|
672
|
+
* Prepare the root picker element with all bindings.
|
673
|
+
*/
|
674
|
+
function prepareElementRoot() {
|
675
|
+
aria( P.$root[0], 'hidden', true );
|
676
|
+
}
|
636
677
|
|
637
|
-
NavDrawer._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
|
638
|
-
return this.each(function () {
|
639
|
-
var _config = $.extend({}, NavDrawer.Default, $(this).data(), (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config);
|
640
678
|
|
641
|
-
|
679
|
+
/**
|
680
|
+
* Prepare the holder picker element with all bindings.
|
681
|
+
*/
|
682
|
+
function prepareElementHolder() {
|
642
683
|
|
643
|
-
|
644
|
-
data = new NavDrawer(this, _config);
|
645
|
-
$(this).data(DATA_KEY, data);
|
646
|
-
}
|
684
|
+
P.$holder.
|
647
685
|
|
648
|
-
|
649
|
-
if (data[config] === undefined) {
|
650
|
-
throw new Error('No method named "' + config + '"');
|
651
|
-
}
|
686
|
+
on({
|
652
687
|
|
653
|
-
|
654
|
-
|
655
|
-
data.show(relatedTarget);
|
656
|
-
}
|
657
|
-
});
|
658
|
-
};
|
688
|
+
// For iOS8.
|
689
|
+
keydown: handleKeydownEvent,
|
659
690
|
|
660
|
-
|
661
|
-
key: 'Default',
|
662
|
-
get: function get() {
|
663
|
-
return Default;
|
664
|
-
}
|
665
|
-
}]);
|
691
|
+
'focus.toOpen': handleFocusToOpenEvent,
|
666
692
|
|
667
|
-
|
668
|
-
|
693
|
+
blur: function() {
|
694
|
+
// Remove the “target” class.
|
695
|
+
$ELEMENT.removeClass( CLASSES.target );
|
696
|
+
},
|
669
697
|
|
670
|
-
|
671
|
-
|
698
|
+
// When something within the holder is focused, stop from bubbling
|
699
|
+
// to the doc and remove the “focused” state from the root.
|
700
|
+
focusin: function( event ) {
|
701
|
+
P.$root.removeClass( CLASSES.focused );
|
702
|
+
event.stopPropagation();
|
703
|
+
},
|
672
704
|
|
673
|
-
|
674
|
-
|
705
|
+
// When something within the holder is clicked, stop it
|
706
|
+
// from bubbling to the doc.
|
707
|
+
'mousedown click': function( event ) {
|
675
708
|
|
676
|
-
|
677
|
-
target = $(selector)[0];
|
678
|
-
}
|
709
|
+
var target = event.target;
|
679
710
|
|
680
|
-
|
711
|
+
// Make sure the target isn’t the root holder so it can bubble up.
|
712
|
+
if ( target != P.$holder[0] ) {
|
681
713
|
|
682
|
-
|
683
|
-
event.preventDefault();
|
684
|
-
}
|
714
|
+
event.stopPropagation();
|
685
715
|
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
716
|
+
// * For mousedown events, cancel the default action in order to
|
717
|
+
// prevent cases where focus is shifted onto external elements
|
718
|
+
// when using things like jQuery mobile or MagnificPopup (ref: #249 & #120).
|
719
|
+
// Also, for Firefox, don’t prevent action on the `option` element.
|
720
|
+
if ( event.type == 'mousedown' && !$$$1( target ).is( 'input, select, textarea, button, option' )) {
|
690
721
|
|
691
|
-
|
692
|
-
if ($(_this7).is(':visible')) {
|
693
|
-
_this7.focus();
|
694
|
-
}
|
695
|
-
});
|
696
|
-
});
|
722
|
+
event.preventDefault();
|
697
723
|
|
698
|
-
|
699
|
-
|
724
|
+
// Re-focus onto the holder so that users can click away
|
725
|
+
// from elements focused within the picker.
|
726
|
+
P.$holder[0].focus();
|
727
|
+
}
|
728
|
+
}
|
729
|
+
}
|
700
730
|
|
701
|
-
|
702
|
-
$.fn[NAME].Constructor = NavDrawer;
|
703
|
-
$.fn[NAME].noConflict = function () {
|
704
|
-
$.fn[NAME] = NO_CONFLICT;
|
705
|
-
return NavDrawer._jQueryInterface;
|
706
|
-
};
|
731
|
+
}).
|
707
732
|
|
708
|
-
|
709
|
-
|
733
|
+
// If there’s a click on an actionable element, carry out the actions.
|
734
|
+
on( 'click', '[data-pick], [data-nav], [data-clear], [data-close]', function() {
|
710
735
|
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
*/
|
736
|
+
var $target = $$$1( this ),
|
737
|
+
targetData = $target.data(),
|
738
|
+
targetDisabled = $target.hasClass( CLASSES.navDisabled ) || $target.hasClass( CLASSES.disabled ),
|
715
739
|
|
716
|
-
|
740
|
+
// * For IE, non-focusable elements can be active elements as well
|
741
|
+
// (http://stackoverflow.com/a/2684561).
|
742
|
+
activeElement = getActiveElement();
|
743
|
+
activeElement = activeElement && ( activeElement.type || activeElement.href );
|
717
744
|
|
718
|
-
|
719
|
-
|
720
|
-
|
745
|
+
// If it’s disabled or nothing inside is actively focused, re-focus the element.
|
746
|
+
if ( targetDisabled || activeElement && !$$$1.contains( P.$root[0], activeElement ) ) {
|
747
|
+
P.$holder[0].focus();
|
748
|
+
}
|
721
749
|
|
722
|
-
|
723
|
-
|
724
|
-
|
750
|
+
// If something is superficially changed, update the `highlight` based on the `nav`.
|
751
|
+
if ( !targetDisabled && targetData.nav ) {
|
752
|
+
P.set( 'highlight', P.component.item.highlight, { nav: targetData.nav } );
|
753
|
+
}
|
725
754
|
|
726
|
-
|
727
|
-
|
728
|
-
|
755
|
+
// If something is picked, set `select` then close with focus.
|
756
|
+
else if ( !targetDisabled && 'pick' in targetData ) {
|
757
|
+
P.set( 'select', targetData.pick );
|
758
|
+
if ( SETTINGS.closeOnSelect ) {
|
759
|
+
P.close( true );
|
760
|
+
}
|
761
|
+
}
|
729
762
|
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
763
|
+
// If a “clear” button is pressed, empty the values and close with focus.
|
764
|
+
else if ( targetData.clear ) {
|
765
|
+
P.clear();
|
766
|
+
if ( SETTINGS.closeOnClear ) {
|
767
|
+
P.close( true );
|
768
|
+
}
|
769
|
+
}
|
736
770
|
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
};
|
741
|
-
// <<< constants
|
771
|
+
else if ( targetData.close ) {
|
772
|
+
P.close( true );
|
773
|
+
}
|
742
774
|
|
743
|
-
|
744
|
-
$(event.target).removeClass(ClassName.FOCUS);
|
745
|
-
}).on('' + Event.FOCUS, Selector.INPUT, function (event) {
|
746
|
-
if (LastInteraction.IS_MOUSEDOWN === false) {
|
747
|
-
$(event.target).addClass(ClassName.FOCUS);
|
748
|
-
}
|
749
|
-
}).on('' + Event.MOUSEDOWN, Selector.CONTROL, function () {
|
750
|
-
LastInteraction.IS_MOUSEDOWN = true;
|
751
|
-
}).on('' + Event.MOUSEUP, Selector.CONTROL, function () {
|
752
|
-
setTimeout(function () {
|
753
|
-
LastInteraction.IS_MOUSEDOWN = false;
|
754
|
-
}, 1);
|
755
|
-
});
|
756
|
-
}(jQuery);
|
757
|
-
|
758
|
-
/*
|
759
|
-
* tab indicator animation
|
760
|
-
* requires bootstrap's (v4.0.0-beta) tab.js
|
761
|
-
*/
|
762
|
-
|
763
|
-
var TabSwitch = function ($) {
|
764
|
-
|
765
|
-
// constants >>>
|
766
|
-
var DATA_KEY = 'md.tabswitch';
|
767
|
-
var NAME = 'tabswitch';
|
768
|
-
var NO_CONFLICT = $.fn[NAME];
|
769
|
-
var TRANSITION_DURATION = 390;
|
770
|
-
|
771
|
-
var ClassName = {
|
772
|
-
ANIMATE: 'animate',
|
773
|
-
DROPDOWN_ITEM: 'dropdown-item',
|
774
|
-
INDICATOR: 'nav-tabs-indicator',
|
775
|
-
MATERIAL: 'nav-tabs-material',
|
776
|
-
SCROLLABLE: 'nav-tabs-scrollable',
|
777
|
-
SHOW: 'show'
|
778
|
-
};
|
775
|
+
}); //P.$holder
|
779
776
|
|
780
|
-
|
781
|
-
SHOW_BS_TAB: 'show.bs.tab'
|
782
|
-
};
|
777
|
+
}
|
783
778
|
|
784
|
-
var Selector = {
|
785
|
-
DATA_TOGGLE: '.nav-tabs [data-toggle="tab"]',
|
786
|
-
DROPDOWN: '.dropdown',
|
787
|
-
NAV: '.nav-tabs'
|
788
|
-
};
|
789
|
-
// <<< constants
|
790
779
|
|
791
|
-
|
792
|
-
|
793
|
-
|
780
|
+
/**
|
781
|
+
* Prepare the hidden input element along with all bindings.
|
782
|
+
*/
|
783
|
+
function prepareElementHidden() {
|
794
784
|
|
795
|
-
|
796
|
-
|
785
|
+
var name;
|
786
|
+
|
787
|
+
if ( SETTINGS.hiddenName === true ) {
|
788
|
+
name = ELEMENT.name;
|
789
|
+
ELEMENT.name = '';
|
790
|
+
}
|
791
|
+
else {
|
792
|
+
name = [
|
793
|
+
typeof SETTINGS.hiddenPrefix == 'string' ? SETTINGS.hiddenPrefix : '',
|
794
|
+
typeof SETTINGS.hiddenSuffix == 'string' ? SETTINGS.hiddenSuffix : '_submit'
|
795
|
+
];
|
796
|
+
name = name[0] + ELEMENT.name + name[1];
|
797
797
|
}
|
798
798
|
|
799
|
-
|
800
|
-
|
801
|
-
|
799
|
+
P._hidden = $$$1(
|
800
|
+
'<input ' +
|
801
|
+
'type=hidden ' +
|
802
|
+
|
803
|
+
// Create the name using the original input’s with a prefix and suffix.
|
804
|
+
'name="' + name + '"' +
|
805
|
+
|
806
|
+
// If the element has a value, set the hidden value as well.
|
807
|
+
(
|
808
|
+
$ELEMENT.data('value') || ELEMENT.value ?
|
809
|
+
' value="' + P.get('select', SETTINGS.formatSubmit) + '"' :
|
810
|
+
''
|
811
|
+
) +
|
812
|
+
'>'
|
813
|
+
)[0];
|
814
|
+
|
815
|
+
$ELEMENT.
|
816
|
+
|
817
|
+
// If the value changes, update the hidden input with the correct format.
|
818
|
+
on('change.' + STATE.id, function() {
|
819
|
+
P._hidden.value = ELEMENT.value ?
|
820
|
+
P.get('select', SETTINGS.formatSubmit) :
|
821
|
+
'';
|
822
|
+
});
|
823
|
+
}
|
802
824
|
|
803
|
-
TabSwitch.prototype.switch = function _switch(element, relatedTarget) {
|
804
|
-
var _this8 = this;
|
805
825
|
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
var supportsTransition = Util.supportsTransitionEnd();
|
826
|
+
// Wait for transitions to end before focusing the holder. Otherwise, while
|
827
|
+
// using the `container` option, the view jumps to the container.
|
828
|
+
function focusPickerOnceOpened() {
|
810
829
|
|
811
|
-
if (
|
812
|
-
|
830
|
+
if (IS_DEFAULT_THEME && supportsTransitions) {
|
831
|
+
P.$holder.find('.' + CLASSES.frame).one('transitionend', function() {
|
832
|
+
P.$holder[0].focus();
|
833
|
+
});
|
813
834
|
}
|
814
|
-
|
815
|
-
|
816
|
-
element = $(element).closest(Selector.DROPDOWN);
|
835
|
+
else {
|
836
|
+
P.$holder[0].focus();
|
817
837
|
}
|
838
|
+
}
|
818
839
|
|
819
|
-
var elLeft = $(element).offset().left;
|
820
|
-
var elWidth = $(element).outerWidth();
|
821
840
|
|
822
|
-
|
823
|
-
Util.reflow(this._navindicator);
|
841
|
+
function handleFocusToOpenEvent(event) {
|
824
842
|
|
825
|
-
|
826
|
-
|
827
|
-
}
|
843
|
+
// Stop the event from propagating to the doc.
|
844
|
+
event.stopPropagation();
|
828
845
|
|
829
|
-
|
830
|
-
|
831
|
-
right: navWidth - (elLeft + navScrollLeft - navLeft + elWidth)
|
832
|
-
});
|
846
|
+
// Add the “target” class.
|
847
|
+
$ELEMENT.addClass( CLASSES.target );
|
833
848
|
|
834
|
-
|
835
|
-
|
836
|
-
$(_this8._navindicator).removeClass(ClassName.SHOW);
|
837
|
-
};
|
849
|
+
// Add the “focused” class to the root.
|
850
|
+
P.$root.addClass( CLASSES.focused );
|
838
851
|
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
}
|
852
|
+
// And then finally open the picker.
|
853
|
+
P.open();
|
854
|
+
}
|
843
855
|
|
844
|
-
$(this._navindicator).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
|
845
|
-
};
|
846
856
|
|
847
|
-
|
848
|
-
|
857
|
+
// For iOS8.
|
858
|
+
function handleKeydownEvent( event ) {
|
849
859
|
|
850
|
-
|
860
|
+
var keycode = event.keyCode,
|
851
861
|
|
852
|
-
|
853
|
-
|
854
|
-
relatedTarget = $(relatedTarget).closest(Selector.DROPDOWN);
|
855
|
-
}
|
862
|
+
// Check if one of the delete keys was pressed.
|
863
|
+
isKeycodeDelete = /^(8|46)$/.test(keycode);
|
856
864
|
|
857
|
-
|
858
|
-
|
865
|
+
// For some reason IE clears the input value on “escape”.
|
866
|
+
if ( keycode == 27 ) {
|
867
|
+
P.close( true );
|
868
|
+
return false
|
869
|
+
}
|
870
|
+
|
871
|
+
// Check if `space` or `delete` was pressed or the picker is closed with a key movement.
|
872
|
+
if ( keycode == 32 || isKeycodeDelete || !STATE.open && P.component.key[keycode] ) {
|
859
873
|
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
874
|
+
// Prevent it from moving the page and bubbling to doc.
|
875
|
+
event.preventDefault();
|
876
|
+
event.stopPropagation();
|
877
|
+
|
878
|
+
// If `delete` was pressed, clear the values and close the picker.
|
879
|
+
// Otherwise open the picker.
|
880
|
+
if ( isKeycodeDelete ) { P.clear().close(); }
|
881
|
+
else { P.open(); }
|
864
882
|
}
|
883
|
+
}
|
865
884
|
|
866
|
-
$(this._nav).addClass(ClassName.MATERIAL);
|
867
|
-
};
|
868
885
|
|
869
|
-
|
870
|
-
|
871
|
-
|
886
|
+
// Return a new picker instance.
|
887
|
+
return new PickerInstance()
|
888
|
+
} //PickerConstructor
|
872
889
|
|
873
|
-
if (!nav) {
|
874
|
-
return;
|
875
|
-
}
|
876
890
|
|
877
|
-
var data = $(nav).data(DATA_KEY);
|
878
891
|
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
892
|
+
/**
|
893
|
+
* The default classes and prefix to use for the HTML classes.
|
894
|
+
*/
|
895
|
+
PickerConstructor.klasses = function( prefix ) {
|
896
|
+
prefix = prefix || 'picker';
|
897
|
+
return {
|
883
898
|
|
884
|
-
|
885
|
-
|
886
|
-
|
899
|
+
picker: prefix,
|
900
|
+
opened: prefix + '--opened',
|
901
|
+
focused: prefix + '--focused',
|
887
902
|
|
888
|
-
|
889
|
-
|
903
|
+
input: prefix + '__input',
|
904
|
+
active: prefix + '__input--active',
|
905
|
+
target: prefix + '__input--target',
|
890
906
|
|
891
|
-
|
892
|
-
TabSwitch._jQueryInterface.call($(event.target), event.relatedTarget);
|
893
|
-
});
|
907
|
+
holder: prefix + '__holder',
|
894
908
|
|
895
|
-
|
896
|
-
|
897
|
-
$.fn[NAME].noConflict = function () {
|
898
|
-
$.fn[NAME] = NO_CONFLICT;
|
899
|
-
return TabSwitch._jQueryInterface;
|
900
|
-
};
|
909
|
+
frame: prefix + '__frame',
|
910
|
+
wrap: prefix + '__wrap',
|
901
911
|
|
902
|
-
|
903
|
-
|
912
|
+
box: prefix + '__box'
|
913
|
+
}
|
914
|
+
}; //PickerConstructor.klasses
|
904
915
|
|
905
|
-
/*
|
906
|
-
* global util js
|
907
|
-
* based on bootstrap's (v4.0.0-beta) util.js
|
908
|
-
*/
|
909
916
|
|
910
|
-
var Util = function ($) {
|
911
917
|
|
912
|
-
|
913
|
-
|
918
|
+
/**
|
919
|
+
* Check if the default theme is being used.
|
920
|
+
*/
|
921
|
+
function isUsingDefaultTheme( element ) {
|
914
922
|
|
915
|
-
var
|
916
|
-
|
917
|
-
MozTransition: 'transitionend',
|
918
|
-
OTransition: 'oTransitionEnd otransitionend',
|
919
|
-
transition: 'transitionend'
|
920
|
-
};
|
923
|
+
var theme,
|
924
|
+
prop = 'position';
|
921
925
|
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
delegateType: transition.end,
|
926
|
-
handle: function handle(event) {
|
927
|
-
if ($(event.target).is(this)) {
|
928
|
-
// eslint-disable-next-line prefer-rest-params
|
929
|
-
return event.handleObj.handler.apply(this, arguments);
|
930
|
-
}
|
931
|
-
return undefined;
|
932
|
-
}
|
933
|
-
};
|
926
|
+
// For IE.
|
927
|
+
if ( element.currentStyle ) {
|
928
|
+
theme = element.currentStyle[prop];
|
934
929
|
}
|
935
930
|
|
936
|
-
|
937
|
-
|
931
|
+
// For normal browsers.
|
932
|
+
else if ( window.getComputedStyle ) {
|
933
|
+
theme = getComputedStyle( element )[prop];
|
938
934
|
}
|
939
935
|
|
940
|
-
|
941
|
-
|
936
|
+
return theme == 'fixed'
|
937
|
+
}
|
942
938
|
|
943
|
-
$.fn.emulateTransitionEnd = transitionEndEmulator;
|
944
939
|
|
945
|
-
if (Util.supportsTransitionEnd()) {
|
946
|
-
$.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
|
947
|
-
}
|
948
|
-
}
|
949
940
|
|
950
|
-
|
951
|
-
|
941
|
+
/**
|
942
|
+
* Get the width of the browser’s scrollbar.
|
943
|
+
* Taken from: https://github.com/VodkaBears/Remodal/blob/master/src/jquery.remodal.js
|
944
|
+
*/
|
945
|
+
function getScrollbarWidth() {
|
946
|
+
|
947
|
+
if ( $html.height() <= $window.height() ) {
|
948
|
+
return 0
|
952
949
|
}
|
953
950
|
|
954
|
-
|
955
|
-
|
951
|
+
var $outer = $$$1( '<div style="visibility:hidden;width:100px" />' ).
|
952
|
+
appendTo( 'body' );
|
956
953
|
|
957
|
-
|
954
|
+
// Get the width without scrollbars.
|
955
|
+
var widthWithoutScroll = $outer[0].offsetWidth;
|
958
956
|
|
959
|
-
|
960
|
-
|
961
|
-
|
957
|
+
// Force adding scrollbars.
|
958
|
+
$outer.css( 'overflow', 'scroll' );
|
959
|
+
|
960
|
+
// Add the inner div.
|
961
|
+
var $inner = $$$1( '<div style="width:100%" />' ).appendTo( $outer );
|
962
962
|
|
963
|
-
|
964
|
-
|
965
|
-
|
963
|
+
// Get the width with scrollbars.
|
964
|
+
var widthWithScroll = $inner[0].offsetWidth;
|
965
|
+
|
966
|
+
// Remove the divs.
|
967
|
+
$outer.remove();
|
968
|
+
|
969
|
+
// Return the difference between the widths.
|
970
|
+
return widthWithoutScroll - widthWithScroll
|
971
|
+
}
|
972
|
+
|
973
|
+
|
974
|
+
|
975
|
+
/**
|
976
|
+
* PickerConstructor helper methods.
|
977
|
+
*/
|
978
|
+
PickerConstructor._ = {
|
979
|
+
|
980
|
+
/**
|
981
|
+
* Create a group of nodes. Expects:
|
982
|
+
* `
|
983
|
+
{
|
984
|
+
min: {Integer},
|
985
|
+
max: {Integer},
|
986
|
+
i: {Integer},
|
987
|
+
node: {String},
|
988
|
+
item: {Function}
|
966
989
|
}
|
967
|
-
|
990
|
+
* `
|
991
|
+
*/
|
992
|
+
group: function( groupObject ) {
|
968
993
|
|
969
|
-
|
970
|
-
|
994
|
+
var
|
995
|
+
// Scope for the looped object
|
996
|
+
loopObjectScope,
|
971
997
|
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
998
|
+
// Create the nodes list
|
999
|
+
nodesList = '',
|
1000
|
+
|
1001
|
+
// The counter starts from the `min`
|
1002
|
+
counter = PickerConstructor._.trigger( groupObject.min, groupObject );
|
1003
|
+
|
1004
|
+
|
1005
|
+
// Loop from the `min` to `max`, incrementing by `i`
|
1006
|
+
for ( ; counter <= PickerConstructor._.trigger( groupObject.max, groupObject, [ counter ] ); counter += groupObject.i ) {
|
976
1007
|
|
977
|
-
|
1008
|
+
// Trigger the `item` function within scope of the object
|
1009
|
+
loopObjectScope = PickerConstructor._.trigger( groupObject.item, groupObject, [ counter ] );
|
978
1010
|
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
1011
|
+
// Splice the subgroup and create nodes out of the sub nodes
|
1012
|
+
nodesList += PickerConstructor._.node(
|
1013
|
+
groupObject.node,
|
1014
|
+
loopObjectScope[ 0 ], // the node
|
1015
|
+
loopObjectScope[ 1 ], // the classes
|
1016
|
+
loopObjectScope[ 2 ] // the attributes
|
1017
|
+
);
|
984
1018
|
}
|
985
|
-
}
|
986
1019
|
|
987
|
-
|
988
|
-
|
1020
|
+
// Return the list of nodes
|
1021
|
+
return nodesList
|
1022
|
+
}, //group
|
1023
|
+
|
1024
|
+
|
1025
|
+
/**
|
1026
|
+
* Create a dom node string
|
1027
|
+
*/
|
1028
|
+
node: function( wrapper, item, klass, attribute ) {
|
1029
|
+
|
1030
|
+
// If the item is false-y, just return an empty string
|
1031
|
+
if ( !item ) return ''
|
1032
|
+
|
1033
|
+
// If the item is an array, do a join
|
1034
|
+
item = $$$1.isArray( item ) ? item.join( '' ) : item;
|
1035
|
+
|
1036
|
+
// Check for the class
|
1037
|
+
klass = klass ? ' class="' + klass + '"' : '';
|
1038
|
+
|
1039
|
+
// Check for any attributes
|
1040
|
+
attribute = attribute ? ' ' + attribute : '';
|
1041
|
+
|
1042
|
+
// Return the wrapped item
|
1043
|
+
return '<' + wrapper + klass + attribute + '>' + item + '</' + wrapper + '>'
|
1044
|
+
}, //node
|
1045
|
+
|
1046
|
+
|
1047
|
+
/**
|
1048
|
+
* Lead numbers below 10 with a zero.
|
1049
|
+
*/
|
1050
|
+
lead: function( number ) {
|
1051
|
+
return ( number < 10 ? '0': '' ) + number
|
1052
|
+
},
|
1053
|
+
|
1054
|
+
|
1055
|
+
/**
|
1056
|
+
* Trigger a function otherwise return the value.
|
1057
|
+
*/
|
1058
|
+
trigger: function( callback, scope, args ) {
|
1059
|
+
return typeof callback == 'function' ? callback.apply( scope, args || [] ) : callback
|
1060
|
+
},
|
1061
|
+
|
1062
|
+
|
1063
|
+
/**
|
1064
|
+
* If the second character is a digit, length is 2 otherwise 1.
|
1065
|
+
*/
|
1066
|
+
digits: function( string ) {
|
1067
|
+
return ( /\d/ ).test( string[ 1 ] ) ? 2 : 1
|
1068
|
+
},
|
1069
|
+
|
1070
|
+
|
1071
|
+
/**
|
1072
|
+
* Tell if something is a date object.
|
1073
|
+
*/
|
1074
|
+
isDate: function( value ) {
|
1075
|
+
return {}.toString.call( value ).indexOf( 'Date' ) > -1 && this.isInteger( value.getDate() )
|
1076
|
+
},
|
1077
|
+
|
1078
|
+
|
1079
|
+
/**
|
1080
|
+
* Tell if something is an integer.
|
1081
|
+
*/
|
1082
|
+
isInteger: function( value ) {
|
1083
|
+
return {}.toString.call( value ).indexOf( 'Number' ) > -1 && value % 1 === 0
|
1084
|
+
},
|
1085
|
+
|
1086
|
+
|
1087
|
+
/**
|
1088
|
+
* Create ARIA attribute strings.
|
1089
|
+
*/
|
1090
|
+
ariaAttr: ariaAttr
|
1091
|
+
}; //PickerConstructor._
|
1092
|
+
|
989
1093
|
|
990
|
-
var Util = {
|
991
|
-
TRANSITION_END: 'mdTransitionEnd',
|
992
1094
|
|
993
|
-
|
994
|
-
|
1095
|
+
/**
|
1096
|
+
* Extend the picker with a component and defaults.
|
1097
|
+
*/
|
1098
|
+
PickerConstructor.extend = function( name, Component ) {
|
1099
|
+
|
1100
|
+
// Extend jQuery.
|
1101
|
+
$$$1.fn[ name ] = function( options, action ) {
|
995
1102
|
|
996
|
-
|
997
|
-
|
998
|
-
|
1103
|
+
// Grab the component data.
|
1104
|
+
var componentData = this.data( name );
|
1105
|
+
|
1106
|
+
// If the picker is requested, return the data object.
|
1107
|
+
if ( options == 'picker' ) {
|
1108
|
+
return componentData
|
999
1109
|
}
|
1000
1110
|
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
do {
|
1005
|
-
// eslint-disable-next-line no-bitwise
|
1006
|
-
prefix += ~~(Math.random() * MAX_UID);
|
1007
|
-
} while (document.getElementById(prefix));
|
1008
|
-
return prefix;
|
1009
|
-
},
|
1010
|
-
reflow: function reflow(element) {
|
1011
|
-
new Function('md', 'return md')(element.offsetHeight);
|
1012
|
-
},
|
1013
|
-
supportsTransitionEnd: function supportsTransitionEnd() {
|
1014
|
-
return Boolean(transition);
|
1015
|
-
},
|
1016
|
-
triggerTransitionEnd: function triggerTransitionEnd(element) {
|
1017
|
-
$(element).trigger(transition.end);
|
1018
|
-
},
|
1019
|
-
typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
|
1020
|
-
for (var property in configTypes) {
|
1021
|
-
if (configTypes.hasOwnProperty(property)) {
|
1022
|
-
var expectedTypes = configTypes[property];
|
1023
|
-
var value = config[property];
|
1024
|
-
var valueType = value && isElement(value) ? 'element' : toType(value);
|
1025
|
-
|
1026
|
-
if (!new RegExp(expectedTypes).test(valueType)) {
|
1027
|
-
throw new Error(componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".'));
|
1028
|
-
}
|
1029
|
-
}
|
1111
|
+
// If the component data exists and `options` is a string, carry out the action.
|
1112
|
+
if ( componentData && typeof options == 'string' ) {
|
1113
|
+
return PickerConstructor._.trigger( componentData[ options ], componentData, [ action ] )
|
1030
1114
|
}
|
1031
|
-
|
1115
|
+
|
1116
|
+
// Otherwise go through each matched element and if the component
|
1117
|
+
// doesn’t exist, create a new picker using `this` element
|
1118
|
+
// and merging the defaults and options with a deep copy.
|
1119
|
+
return this.each( function() {
|
1120
|
+
var $this = $$$1( this );
|
1121
|
+
if ( !$this.data( name ) ) {
|
1122
|
+
new PickerConstructor( this, name, Component, options );
|
1123
|
+
}
|
1124
|
+
})
|
1032
1125
|
};
|
1033
1126
|
|
1034
|
-
|
1127
|
+
// Set the defaults.
|
1128
|
+
$$$1.fn[ name ].defaults = Component.defaults;
|
1129
|
+
}; //PickerConstructor.extend
|
1130
|
+
|
1131
|
+
|
1132
|
+
|
1133
|
+
function aria(element, attribute, value) {
|
1134
|
+
if ( $$$1.isPlainObject(attribute) ) {
|
1135
|
+
for ( var key in attribute ) {
|
1136
|
+
ariaSet(element, key, attribute[key]);
|
1137
|
+
}
|
1138
|
+
}
|
1139
|
+
else {
|
1140
|
+
ariaSet(element, attribute, value);
|
1141
|
+
}
|
1142
|
+
}
|
1143
|
+
function ariaSet(element, attribute, value) {
|
1144
|
+
element.setAttribute(
|
1145
|
+
(attribute == 'role' ? '' : 'aria-') + attribute,
|
1146
|
+
value
|
1147
|
+
);
|
1148
|
+
}
|
1149
|
+
function ariaAttr(attribute, data) {
|
1150
|
+
if ( !$$$1.isPlainObject(attribute) ) {
|
1151
|
+
attribute = { attribute: data };
|
1152
|
+
}
|
1153
|
+
data = '';
|
1154
|
+
for ( var key in attribute ) {
|
1155
|
+
var attr = (key == 'role' ? '' : 'aria-') + key,
|
1156
|
+
attrVal = attribute[key];
|
1157
|
+
data += attrVal == null ? '' : attr + '="' + attribute[key] + '"';
|
1158
|
+
}
|
1159
|
+
return data
|
1160
|
+
}
|
1161
|
+
|
1162
|
+
// IE8 bug throws an error for activeElements within iframes.
|
1163
|
+
function getActiveElement() {
|
1164
|
+
try {
|
1165
|
+
return document.activeElement
|
1166
|
+
} catch ( err ) { }
|
1167
|
+
}
|
1168
|
+
|
1169
|
+
|
1170
|
+
|
1171
|
+
// Expose the picker constructor.
|
1172
|
+
return PickerConstructor
|
1173
|
+
|
1174
|
+
|
1175
|
+
}));
|
1176
|
+
});
|
1177
|
+
|
1178
|
+
var picker_date = createCommonjsModule(function (module, exports) {
|
1179
|
+
/*!
|
1180
|
+
* Date picker for pickadate.js v3.5.6
|
1181
|
+
* http://amsul.github.io/pickadate.js/date.htm
|
1182
|
+
*/
|
1183
|
+
|
1184
|
+
(function ( factory ) {
|
1185
|
+
|
1186
|
+
// AMD.
|
1187
|
+
if ( typeof undefined == 'function' && undefined.amd )
|
1188
|
+
undefined( ['picker', 'jquery'], factory );
|
1189
|
+
|
1190
|
+
// Node.js/browserify.
|
1191
|
+
else module.exports = factory( picker, $ );
|
1192
|
+
|
1193
|
+
}(function( Picker, $$$1 ) {
|
1194
|
+
|
1195
|
+
|
1196
|
+
/**
|
1197
|
+
* Globals and constants
|
1198
|
+
*/
|
1199
|
+
var DAYS_IN_WEEK = 7,
|
1200
|
+
WEEKS_IN_CALENDAR = 6,
|
1201
|
+
_ = Picker._;
|
1202
|
+
|
1203
|
+
|
1204
|
+
|
1205
|
+
/**
|
1206
|
+
* The date picker constructor
|
1207
|
+
*/
|
1208
|
+
function DatePicker( picker$$1, settings ) {
|
1209
|
+
|
1210
|
+
var calendar = this,
|
1211
|
+
element = picker$$1.$node[ 0 ],
|
1212
|
+
elementValue = element.value,
|
1213
|
+
elementDataValue = picker$$1.$node.data( 'value' ),
|
1214
|
+
valueString = elementDataValue || elementValue,
|
1215
|
+
formatString = elementDataValue ? settings.formatSubmit : settings.format,
|
1216
|
+
isRTL = function() {
|
1217
|
+
|
1218
|
+
return element.currentStyle ?
|
1219
|
+
|
1220
|
+
// For IE.
|
1221
|
+
element.currentStyle.direction == 'rtl' :
|
1222
|
+
|
1223
|
+
// For normal browsers.
|
1224
|
+
getComputedStyle( picker$$1.$root[0] ).direction == 'rtl'
|
1225
|
+
};
|
1226
|
+
|
1227
|
+
calendar.settings = settings;
|
1228
|
+
calendar.$node = picker$$1.$node;
|
1229
|
+
|
1230
|
+
// The queue of methods that will be used to build item objects.
|
1231
|
+
calendar.queue = {
|
1232
|
+
min: 'measure create',
|
1233
|
+
max: 'measure create',
|
1234
|
+
now: 'now create',
|
1235
|
+
select: 'parse create validate',
|
1236
|
+
highlight: 'parse navigate create validate',
|
1237
|
+
view: 'parse create validate viewset',
|
1238
|
+
disable: 'deactivate',
|
1239
|
+
enable: 'activate'
|
1240
|
+
};
|
1241
|
+
|
1242
|
+
// The component's item object.
|
1243
|
+
calendar.item = {};
|
1244
|
+
|
1245
|
+
calendar.item.clear = null;
|
1246
|
+
calendar.item.disable = ( settings.disable || [] ).slice( 0 );
|
1247
|
+
calendar.item.enable = -(function( collectionDisabled ) {
|
1248
|
+
return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1
|
1249
|
+
})( calendar.item.disable );
|
1250
|
+
|
1251
|
+
calendar.
|
1252
|
+
set( 'min', settings.min ).
|
1253
|
+
set( 'max', settings.max ).
|
1254
|
+
set( 'now' );
|
1255
|
+
|
1256
|
+
// When there’s a value, set the `select`, which in turn
|
1257
|
+
// also sets the `highlight` and `view`.
|
1258
|
+
if ( valueString ) {
|
1259
|
+
calendar.set( 'select', valueString, {
|
1260
|
+
format: formatString,
|
1261
|
+
defaultValue: true
|
1262
|
+
});
|
1263
|
+
}
|
1264
|
+
|
1265
|
+
// If there’s no value, default to highlighting “today”.
|
1266
|
+
else {
|
1267
|
+
calendar.
|
1268
|
+
set( 'select', null ).
|
1269
|
+
set( 'highlight', calendar.item.now );
|
1270
|
+
}
|
1271
|
+
|
1272
|
+
|
1273
|
+
// The keycode to movement mapping.
|
1274
|
+
calendar.key = {
|
1275
|
+
40: 7, // Down
|
1276
|
+
38: -7, // Up
|
1277
|
+
39: function() { return isRTL() ? -1 : 1 }, // Right
|
1278
|
+
37: function() { return isRTL() ? 1 : -1 }, // Left
|
1279
|
+
go: function( timeChange ) {
|
1280
|
+
var highlightedObject = calendar.item.highlight,
|
1281
|
+
targetDate = new Date( highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange );
|
1282
|
+
calendar.set(
|
1283
|
+
'highlight',
|
1284
|
+
targetDate,
|
1285
|
+
{ interval: timeChange }
|
1286
|
+
);
|
1287
|
+
this.render();
|
1288
|
+
}
|
1289
|
+
};
|
1290
|
+
|
1291
|
+
|
1292
|
+
// Bind some picker events.
|
1293
|
+
picker$$1.
|
1294
|
+
on( 'render', function() {
|
1295
|
+
picker$$1.$root.find( '.' + settings.klass.selectMonth ).on( 'change', function() {
|
1296
|
+
var value = this.value;
|
1297
|
+
if ( value ) {
|
1298
|
+
picker$$1.set( 'highlight', [ picker$$1.get( 'view' ).year, value, picker$$1.get( 'highlight' ).date ] );
|
1299
|
+
picker$$1.$root.find( '.' + settings.klass.selectMonth ).trigger( 'focus' );
|
1300
|
+
}
|
1301
|
+
});
|
1302
|
+
picker$$1.$root.find( '.' + settings.klass.selectYear ).on( 'change', function() {
|
1303
|
+
var value = this.value;
|
1304
|
+
if ( value ) {
|
1305
|
+
picker$$1.set( 'highlight', [ value, picker$$1.get( 'view' ).month, picker$$1.get( 'highlight' ).date ] );
|
1306
|
+
picker$$1.$root.find( '.' + settings.klass.selectYear ).trigger( 'focus' );
|
1307
|
+
}
|
1308
|
+
});
|
1309
|
+
}, 1 ).
|
1310
|
+
on( 'open', function() {
|
1311
|
+
var includeToday = '';
|
1312
|
+
if ( calendar.disabled( calendar.get('now') ) ) {
|
1313
|
+
includeToday = ':not(.' + settings.klass.buttonToday + ')';
|
1314
|
+
}
|
1315
|
+
picker$$1.$root.find( 'button' + includeToday + ', select' ).attr( 'disabled', false );
|
1316
|
+
}, 1 ).
|
1317
|
+
on( 'close', function() {
|
1318
|
+
picker$$1.$root.find( 'button, select' ).attr( 'disabled', true );
|
1319
|
+
}, 1 );
|
1320
|
+
|
1321
|
+
} //DatePicker
|
1322
|
+
|
1323
|
+
|
1324
|
+
/**
|
1325
|
+
* Set a datepicker item object.
|
1326
|
+
*/
|
1327
|
+
DatePicker.prototype.set = function( type, value, options ) {
|
1328
|
+
|
1329
|
+
var calendar = this,
|
1330
|
+
calendarItem = calendar.item;
|
1331
|
+
|
1332
|
+
// If the value is `null` just set it immediately.
|
1333
|
+
if ( value === null ) {
|
1334
|
+
if ( type == 'clear' ) type = 'select';
|
1335
|
+
calendarItem[ type ] = value;
|
1336
|
+
return calendar
|
1337
|
+
}
|
1338
|
+
|
1339
|
+
// Otherwise go through the queue of methods, and invoke the functions.
|
1340
|
+
// Update this as the time unit, and set the final value as this item.
|
1341
|
+
// * In the case of `enable`, keep the queue but set `disable` instead.
|
1342
|
+
// And in the case of `flip`, keep the queue but set `enable` instead.
|
1343
|
+
calendarItem[ ( type == 'enable' ? 'disable' : type == 'flip' ? 'enable' : type ) ] = calendar.queue[ type ].split( ' ' ).map( function( method ) {
|
1344
|
+
value = calendar[ method ]( type, value, options );
|
1345
|
+
return value
|
1346
|
+
}).pop();
|
1347
|
+
|
1348
|
+
// Check if we need to cascade through more updates.
|
1349
|
+
if ( type == 'select' ) {
|
1350
|
+
calendar.set( 'highlight', calendarItem.select, options );
|
1351
|
+
}
|
1352
|
+
else if ( type == 'highlight' ) {
|
1353
|
+
calendar.set( 'view', calendarItem.highlight, options );
|
1354
|
+
}
|
1355
|
+
else if ( type.match( /^(flip|min|max|disable|enable)$/ ) ) {
|
1356
|
+
if ( calendarItem.select && calendar.disabled( calendarItem.select ) ) {
|
1357
|
+
calendar.set( 'select', calendarItem.select, options );
|
1358
|
+
}
|
1359
|
+
if ( calendarItem.highlight && calendar.disabled( calendarItem.highlight ) ) {
|
1360
|
+
calendar.set( 'highlight', calendarItem.highlight, options );
|
1361
|
+
}
|
1362
|
+
}
|
1363
|
+
|
1364
|
+
return calendar
|
1365
|
+
}; //DatePicker.prototype.set
|
1366
|
+
|
1367
|
+
|
1368
|
+
/**
|
1369
|
+
* Get a datepicker item object.
|
1370
|
+
*/
|
1371
|
+
DatePicker.prototype.get = function( type ) {
|
1372
|
+
return this.item[ type ]
|
1373
|
+
}; //DatePicker.prototype.get
|
1374
|
+
|
1375
|
+
|
1376
|
+
/**
|
1377
|
+
* Create a picker date object.
|
1378
|
+
*/
|
1379
|
+
DatePicker.prototype.create = function( type, value, options ) {
|
1380
|
+
|
1381
|
+
var isInfiniteValue,
|
1382
|
+
calendar = this;
|
1383
|
+
|
1384
|
+
// If there’s no value, use the type as the value.
|
1385
|
+
value = value === undefined ? type : value;
|
1386
|
+
|
1387
|
+
|
1388
|
+
// If it’s infinity, update the value.
|
1389
|
+
if ( value == -Infinity || value == Infinity ) {
|
1390
|
+
isInfiniteValue = value;
|
1391
|
+
}
|
1392
|
+
|
1393
|
+
// If it’s an object, use the native date object.
|
1394
|
+
else if ( $$$1.isPlainObject( value ) && _.isInteger( value.pick ) ) {
|
1395
|
+
value = value.obj;
|
1396
|
+
}
|
1397
|
+
|
1398
|
+
// If it’s an array, convert it into a date and make sure
|
1399
|
+
// that it’s a valid date – otherwise default to today.
|
1400
|
+
else if ( $$$1.isArray( value ) ) {
|
1401
|
+
value = new Date( value[ 0 ], value[ 1 ], value[ 2 ] );
|
1402
|
+
value = _.isDate( value ) ? value : calendar.create().obj;
|
1403
|
+
}
|
1404
|
+
|
1405
|
+
// If it’s a number or date object, make a normalized date.
|
1406
|
+
else if ( _.isInteger( value ) || _.isDate( value ) ) {
|
1407
|
+
value = calendar.normalize( new Date( value ), options );
|
1408
|
+
}
|
1409
|
+
|
1410
|
+
// If it’s a literal true or any other case, set it to now.
|
1411
|
+
else /*if ( value === true )*/ {
|
1412
|
+
value = calendar.now( type, value, options );
|
1413
|
+
}
|
1414
|
+
|
1415
|
+
// Return the compiled object.
|
1416
|
+
return {
|
1417
|
+
year: isInfiniteValue || value.getFullYear(),
|
1418
|
+
month: isInfiniteValue || value.getMonth(),
|
1419
|
+
date: isInfiniteValue || value.getDate(),
|
1420
|
+
day: isInfiniteValue || value.getDay(),
|
1421
|
+
obj: isInfiniteValue || value,
|
1422
|
+
pick: isInfiniteValue || value.getTime()
|
1423
|
+
}
|
1424
|
+
}; //DatePicker.prototype.create
|
1425
|
+
|
1426
|
+
|
1427
|
+
/**
|
1428
|
+
* Create a range limit object using an array, date object,
|
1429
|
+
* literal “true”, or integer relative to another time.
|
1430
|
+
*/
|
1431
|
+
DatePicker.prototype.createRange = function( from, to ) {
|
1432
|
+
|
1433
|
+
var calendar = this,
|
1434
|
+
createDate = function( date ) {
|
1435
|
+
if ( date === true || $$$1.isArray( date ) || _.isDate( date ) ) {
|
1436
|
+
return calendar.create( date )
|
1437
|
+
}
|
1438
|
+
return date
|
1439
|
+
};
|
1440
|
+
|
1441
|
+
// Create objects if possible.
|
1442
|
+
if ( !_.isInteger( from ) ) {
|
1443
|
+
from = createDate( from );
|
1444
|
+
}
|
1445
|
+
if ( !_.isInteger( to ) ) {
|
1446
|
+
to = createDate( to );
|
1447
|
+
}
|
1448
|
+
|
1449
|
+
// Create relative dates.
|
1450
|
+
if ( _.isInteger( from ) && $$$1.isPlainObject( to ) ) {
|
1451
|
+
from = [ to.year, to.month, to.date + from ];
|
1452
|
+
}
|
1453
|
+
else if ( _.isInteger( to ) && $$$1.isPlainObject( from ) ) {
|
1454
|
+
to = [ from.year, from.month, from.date + to ];
|
1455
|
+
}
|
1456
|
+
|
1457
|
+
return {
|
1458
|
+
from: createDate( from ),
|
1459
|
+
to: createDate( to )
|
1460
|
+
}
|
1461
|
+
}; //DatePicker.prototype.createRange
|
1462
|
+
|
1463
|
+
|
1464
|
+
/**
|
1465
|
+
* Check if a date unit falls within a date range object.
|
1466
|
+
*/
|
1467
|
+
DatePicker.prototype.withinRange = function( range, dateUnit ) {
|
1468
|
+
range = this.createRange(range.from, range.to);
|
1469
|
+
return dateUnit.pick >= range.from.pick && dateUnit.pick <= range.to.pick
|
1470
|
+
};
|
1471
|
+
|
1472
|
+
|
1473
|
+
/**
|
1474
|
+
* Check if two date range objects overlap.
|
1475
|
+
*/
|
1476
|
+
DatePicker.prototype.overlapRanges = function( one, two ) {
|
1477
|
+
|
1478
|
+
var calendar = this;
|
1479
|
+
|
1480
|
+
// Convert the ranges into comparable dates.
|
1481
|
+
one = calendar.createRange( one.from, one.to );
|
1482
|
+
two = calendar.createRange( two.from, two.to );
|
1483
|
+
|
1484
|
+
return calendar.withinRange( one, two.from ) || calendar.withinRange( one, two.to ) ||
|
1485
|
+
calendar.withinRange( two, one.from ) || calendar.withinRange( two, one.to )
|
1486
|
+
};
|
1487
|
+
|
1488
|
+
|
1489
|
+
/**
|
1490
|
+
* Get the date today.
|
1491
|
+
*/
|
1492
|
+
DatePicker.prototype.now = function( type, value, options ) {
|
1493
|
+
value = new Date();
|
1494
|
+
if ( options && options.rel ) {
|
1495
|
+
value.setDate( value.getDate() + options.rel );
|
1496
|
+
}
|
1497
|
+
return this.normalize( value, options )
|
1498
|
+
};
|
1499
|
+
|
1500
|
+
|
1501
|
+
/**
|
1502
|
+
* Navigate to next/prev month.
|
1503
|
+
*/
|
1504
|
+
DatePicker.prototype.navigate = function( type, value, options ) {
|
1505
|
+
|
1506
|
+
var targetDateObject,
|
1507
|
+
targetYear,
|
1508
|
+
targetMonth,
|
1509
|
+
targetDate,
|
1510
|
+
isTargetArray = $$$1.isArray( value ),
|
1511
|
+
isTargetObject = $$$1.isPlainObject( value ),
|
1512
|
+
viewsetObject = this.item.view;/*,
|
1513
|
+
safety = 100*/
|
1514
|
+
|
1515
|
+
|
1516
|
+
if ( isTargetArray || isTargetObject ) {
|
1517
|
+
|
1518
|
+
if ( isTargetObject ) {
|
1519
|
+
targetYear = value.year;
|
1520
|
+
targetMonth = value.month;
|
1521
|
+
targetDate = value.date;
|
1522
|
+
}
|
1523
|
+
else {
|
1524
|
+
targetYear = +value[0];
|
1525
|
+
targetMonth = +value[1];
|
1526
|
+
targetDate = +value[2];
|
1527
|
+
}
|
1528
|
+
|
1529
|
+
// If we’re navigating months but the view is in a different
|
1530
|
+
// month, navigate to the view’s year and month.
|
1531
|
+
if ( options && options.nav && viewsetObject && viewsetObject.month !== targetMonth ) {
|
1532
|
+
targetYear = viewsetObject.year;
|
1533
|
+
targetMonth = viewsetObject.month;
|
1534
|
+
}
|
1535
|
+
|
1536
|
+
// Figure out the expected target year and month.
|
1537
|
+
targetDateObject = new Date( targetYear, targetMonth + ( options && options.nav ? options.nav : 0 ), 1 );
|
1538
|
+
targetYear = targetDateObject.getFullYear();
|
1539
|
+
targetMonth = targetDateObject.getMonth();
|
1540
|
+
|
1541
|
+
// If the month we’re going to doesn’t have enough days,
|
1542
|
+
// keep decreasing the date until we reach the month’s last date.
|
1543
|
+
while ( /*safety &&*/ new Date( targetYear, targetMonth, targetDate ).getMonth() !== targetMonth ) {
|
1544
|
+
targetDate -= 1;
|
1545
|
+
/*safety -= 1
|
1546
|
+
if ( !safety ) {
|
1547
|
+
throw 'Fell into an infinite loop while navigating to ' + new Date( targetYear, targetMonth, targetDate ) + '.'
|
1548
|
+
}*/
|
1549
|
+
}
|
1550
|
+
|
1551
|
+
value = [ targetYear, targetMonth, targetDate ];
|
1552
|
+
}
|
1553
|
+
|
1554
|
+
return value
|
1555
|
+
}; //DatePicker.prototype.navigate
|
1556
|
+
|
1557
|
+
|
1558
|
+
/**
|
1559
|
+
* Normalize a date by setting the hours to midnight.
|
1560
|
+
*/
|
1561
|
+
DatePicker.prototype.normalize = function( value/*, options*/ ) {
|
1562
|
+
value.setHours( 0, 0, 0, 0 );
|
1563
|
+
return value
|
1564
|
+
};
|
1565
|
+
|
1566
|
+
|
1567
|
+
/**
|
1568
|
+
* Measure the range of dates.
|
1569
|
+
*/
|
1570
|
+
DatePicker.prototype.measure = function( type, value/*, options*/ ) {
|
1571
|
+
|
1572
|
+
var calendar = this;
|
1573
|
+
|
1574
|
+
// If it’s anything false-y, remove the limits.
|
1575
|
+
if ( !value ) {
|
1576
|
+
value = type == 'min' ? -Infinity : Infinity;
|
1577
|
+
}
|
1578
|
+
|
1579
|
+
// If it’s a string, parse it.
|
1580
|
+
else if ( typeof value == 'string' ) {
|
1581
|
+
value = calendar.parse( type, value );
|
1582
|
+
}
|
1583
|
+
|
1584
|
+
// If it's an integer, get a date relative to today.
|
1585
|
+
else if ( _.isInteger( value ) ) {
|
1586
|
+
value = calendar.now( type, value, { rel: value } );
|
1587
|
+
}
|
1588
|
+
|
1589
|
+
return value
|
1590
|
+
}; ///DatePicker.prototype.measure
|
1591
|
+
|
1592
|
+
|
1593
|
+
/**
|
1594
|
+
* Create a viewset object based on navigation.
|
1595
|
+
*/
|
1596
|
+
DatePicker.prototype.viewset = function( type, dateObject/*, options*/ ) {
|
1597
|
+
return this.create([ dateObject.year, dateObject.month, 1 ])
|
1598
|
+
};
|
1599
|
+
|
1600
|
+
|
1601
|
+
/**
|
1602
|
+
* Validate a date as enabled and shift if needed.
|
1603
|
+
*/
|
1604
|
+
DatePicker.prototype.validate = function( type, dateObject, options ) {
|
1605
|
+
|
1606
|
+
var calendar = this,
|
1607
|
+
|
1608
|
+
// Keep a reference to the original date.
|
1609
|
+
originalDateObject = dateObject,
|
1610
|
+
|
1611
|
+
// Make sure we have an interval.
|
1612
|
+
interval = options && options.interval ? options.interval : 1,
|
1613
|
+
|
1614
|
+
// Check if the calendar enabled dates are inverted.
|
1615
|
+
isFlippedBase = calendar.item.enable === -1,
|
1616
|
+
|
1617
|
+
// Check if we have any enabled dates after/before now.
|
1618
|
+
hasEnabledBeforeTarget, hasEnabledAfterTarget,
|
1619
|
+
|
1620
|
+
// The min & max limits.
|
1621
|
+
minLimitObject = calendar.item.min,
|
1622
|
+
maxLimitObject = calendar.item.max,
|
1623
|
+
|
1624
|
+
// Check if we’ve reached the limit during shifting.
|
1625
|
+
reachedMin, reachedMax,
|
1626
|
+
|
1627
|
+
// Check if the calendar is inverted and at least one weekday is enabled.
|
1628
|
+
hasEnabledWeekdays = isFlippedBase && calendar.item.disable.filter( function( value ) {
|
1629
|
+
|
1630
|
+
// If there’s a date, check where it is relative to the target.
|
1631
|
+
if ( $$$1.isArray( value ) ) {
|
1632
|
+
var dateTime = calendar.create( value ).pick;
|
1633
|
+
if ( dateTime < dateObject.pick ) hasEnabledBeforeTarget = true;
|
1634
|
+
else if ( dateTime > dateObject.pick ) hasEnabledAfterTarget = true;
|
1635
|
+
}
|
1636
|
+
|
1637
|
+
// Return only integers for enabled weekdays.
|
1638
|
+
return _.isInteger( value )
|
1639
|
+
}).length;/*,
|
1640
|
+
|
1641
|
+
safety = 100*/
|
1642
|
+
|
1643
|
+
|
1644
|
+
|
1645
|
+
// Cases to validate for:
|
1646
|
+
// [1] Not inverted and date disabled.
|
1647
|
+
// [2] Inverted and some dates enabled.
|
1648
|
+
// [3] Not inverted and out of range.
|
1649
|
+
//
|
1650
|
+
// Cases to **not** validate for:
|
1651
|
+
// • Navigating months.
|
1652
|
+
// • Not inverted and date enabled.
|
1653
|
+
// • Inverted and all dates disabled.
|
1654
|
+
// • ..and anything else.
|
1655
|
+
if ( !options || (!options.nav && !options.defaultValue) ) if (
|
1656
|
+
/* 1 */ ( !isFlippedBase && calendar.disabled( dateObject ) ) ||
|
1657
|
+
/* 2 */ ( isFlippedBase && calendar.disabled( dateObject ) && ( hasEnabledWeekdays || hasEnabledBeforeTarget || hasEnabledAfterTarget ) ) ||
|
1658
|
+
/* 3 */ ( !isFlippedBase && (dateObject.pick <= minLimitObject.pick || dateObject.pick >= maxLimitObject.pick) )
|
1659
|
+
) {
|
1660
|
+
|
1661
|
+
|
1662
|
+
// When inverted, flip the direction if there aren’t any enabled weekdays
|
1663
|
+
// and there are no enabled dates in the direction of the interval.
|
1664
|
+
if ( isFlippedBase && !hasEnabledWeekdays && ( ( !hasEnabledAfterTarget && interval > 0 ) || ( !hasEnabledBeforeTarget && interval < 0 ) ) ) {
|
1665
|
+
interval *= -1;
|
1666
|
+
}
|
1667
|
+
|
1668
|
+
|
1669
|
+
// Keep looping until we reach an enabled date.
|
1670
|
+
while ( /*safety &&*/ calendar.disabled( dateObject ) ) {
|
1671
|
+
|
1672
|
+
/*safety -= 1
|
1673
|
+
if ( !safety ) {
|
1674
|
+
throw 'Fell into an infinite loop while validating ' + dateObject.obj + '.'
|
1675
|
+
}*/
|
1676
|
+
|
1677
|
+
|
1678
|
+
// If we’ve looped into the next/prev month with a large interval, return to the original date and flatten the interval.
|
1679
|
+
if ( Math.abs( interval ) > 1 && ( dateObject.month < originalDateObject.month || dateObject.month > originalDateObject.month ) ) {
|
1680
|
+
dateObject = originalDateObject;
|
1681
|
+
interval = interval > 0 ? 1 : -1;
|
1682
|
+
}
|
1683
|
+
|
1684
|
+
|
1685
|
+
// If we’ve reached the min/max limit, reverse the direction, flatten the interval and set it to the limit.
|
1686
|
+
if ( dateObject.pick <= minLimitObject.pick ) {
|
1687
|
+
reachedMin = true;
|
1688
|
+
interval = 1;
|
1689
|
+
dateObject = calendar.create([
|
1690
|
+
minLimitObject.year,
|
1691
|
+
minLimitObject.month,
|
1692
|
+
minLimitObject.date + (dateObject.pick === minLimitObject.pick ? 0 : -1)
|
1693
|
+
]);
|
1694
|
+
}
|
1695
|
+
else if ( dateObject.pick >= maxLimitObject.pick ) {
|
1696
|
+
reachedMax = true;
|
1697
|
+
interval = -1;
|
1698
|
+
dateObject = calendar.create([
|
1699
|
+
maxLimitObject.year,
|
1700
|
+
maxLimitObject.month,
|
1701
|
+
maxLimitObject.date + (dateObject.pick === maxLimitObject.pick ? 0 : 1)
|
1702
|
+
]);
|
1703
|
+
}
|
1704
|
+
|
1705
|
+
|
1706
|
+
// If we’ve reached both limits, just break out of the loop.
|
1707
|
+
if ( reachedMin && reachedMax ) {
|
1708
|
+
break
|
1709
|
+
}
|
1710
|
+
|
1711
|
+
|
1712
|
+
// Finally, create the shifted date using the interval and keep looping.
|
1713
|
+
dateObject = calendar.create([ dateObject.year, dateObject.month, dateObject.date + interval ]);
|
1714
|
+
}
|
1715
|
+
|
1716
|
+
} //endif
|
1717
|
+
|
1718
|
+
|
1719
|
+
// Return the date object settled on.
|
1720
|
+
return dateObject
|
1721
|
+
}; //DatePicker.prototype.validate
|
1722
|
+
|
1723
|
+
|
1724
|
+
/**
|
1725
|
+
* Check if a date is disabled.
|
1726
|
+
*/
|
1727
|
+
DatePicker.prototype.disabled = function( dateToVerify ) {
|
1728
|
+
|
1729
|
+
var
|
1730
|
+
calendar = this,
|
1731
|
+
|
1732
|
+
// Filter through the disabled dates to check if this is one.
|
1733
|
+
isDisabledMatch = calendar.item.disable.filter( function( dateToDisable ) {
|
1734
|
+
|
1735
|
+
// If the date is a number, match the weekday with 0index and `firstDay` check.
|
1736
|
+
if ( _.isInteger( dateToDisable ) ) {
|
1737
|
+
return dateToVerify.day === ( calendar.settings.firstDay ? dateToDisable : dateToDisable - 1 ) % 7
|
1738
|
+
}
|
1739
|
+
|
1740
|
+
// If it’s an array or a native JS date, create and match the exact date.
|
1741
|
+
if ( $$$1.isArray( dateToDisable ) || _.isDate( dateToDisable ) ) {
|
1742
|
+
return dateToVerify.pick === calendar.create( dateToDisable ).pick
|
1743
|
+
}
|
1744
|
+
|
1745
|
+
// If it’s an object, match a date within the “from” and “to” range.
|
1746
|
+
if ( $$$1.isPlainObject( dateToDisable ) ) {
|
1747
|
+
return calendar.withinRange( dateToDisable, dateToVerify )
|
1748
|
+
}
|
1749
|
+
});
|
1750
|
+
|
1751
|
+
// If this date matches a disabled date, confirm it’s not inverted.
|
1752
|
+
isDisabledMatch = isDisabledMatch.length && !isDisabledMatch.filter(function( dateToDisable ) {
|
1753
|
+
return $$$1.isArray( dateToDisable ) && dateToDisable[3] == 'inverted' ||
|
1754
|
+
$$$1.isPlainObject( dateToDisable ) && dateToDisable.inverted
|
1755
|
+
}).length;
|
1756
|
+
|
1757
|
+
// Check the calendar “enabled” flag and respectively flip the
|
1758
|
+
// disabled state. Then also check if it’s beyond the min/max limits.
|
1759
|
+
return calendar.item.enable === -1 ? !isDisabledMatch : isDisabledMatch ||
|
1760
|
+
dateToVerify.pick < calendar.item.min.pick ||
|
1761
|
+
dateToVerify.pick > calendar.item.max.pick
|
1762
|
+
|
1763
|
+
}; //DatePicker.prototype.disabled
|
1764
|
+
|
1765
|
+
|
1766
|
+
/**
|
1767
|
+
* Parse a string into a usable type.
|
1768
|
+
*/
|
1769
|
+
DatePicker.prototype.parse = function( type, value, options ) {
|
1770
|
+
|
1771
|
+
var calendar = this,
|
1772
|
+
parsingObject = {};
|
1773
|
+
|
1774
|
+
// If it’s already parsed, we’re good.
|
1775
|
+
if ( !value || typeof value != 'string' ) {
|
1776
|
+
return value
|
1777
|
+
}
|
1778
|
+
|
1779
|
+
// We need a `.format` to parse the value with.
|
1780
|
+
if ( !( options && options.format ) ) {
|
1781
|
+
options = options || {};
|
1782
|
+
options.format = calendar.settings.format;
|
1783
|
+
}
|
1784
|
+
|
1785
|
+
// Convert the format into an array and then map through it.
|
1786
|
+
calendar.formats.toArray( options.format ).map( function( label ) {
|
1787
|
+
|
1788
|
+
var
|
1789
|
+
// Grab the formatting label.
|
1790
|
+
formattingLabel = calendar.formats[ label ],
|
1791
|
+
|
1792
|
+
// The format length is from the formatting label function or the
|
1793
|
+
// label length without the escaping exclamation (!) mark.
|
1794
|
+
formatLength = formattingLabel ? _.trigger( formattingLabel, calendar, [ value, parsingObject ] ) : label.replace( /^!/, '' ).length;
|
1795
|
+
|
1796
|
+
// If there's a format label, split the value up to the format length.
|
1797
|
+
// Then add it to the parsing object with appropriate label.
|
1798
|
+
if ( formattingLabel ) {
|
1799
|
+
parsingObject[ label ] = value.substr( 0, formatLength );
|
1800
|
+
}
|
1801
|
+
|
1802
|
+
// Update the value as the substring from format length to end.
|
1803
|
+
value = value.substr( formatLength );
|
1804
|
+
});
|
1805
|
+
|
1806
|
+
// Compensate for month 0index.
|
1807
|
+
return [
|
1808
|
+
parsingObject.yyyy || parsingObject.yy,
|
1809
|
+
+( parsingObject.mm || parsingObject.m ) - 1,
|
1810
|
+
parsingObject.dd || parsingObject.d
|
1811
|
+
]
|
1812
|
+
}; //DatePicker.prototype.parse
|
1813
|
+
|
1814
|
+
|
1815
|
+
/**
|
1816
|
+
* Various formats to display the object in.
|
1817
|
+
*/
|
1818
|
+
DatePicker.prototype.formats = (function() {
|
1819
|
+
|
1820
|
+
// Return the length of the first word in a collection.
|
1821
|
+
function getWordLengthFromCollection( string, collection, dateObject ) {
|
1822
|
+
|
1823
|
+
// Grab the first word from the string.
|
1824
|
+
// Regex pattern from http://stackoverflow.com/q/150033
|
1825
|
+
var word = string.match( /[^\x00-\x7F]+|\w+/ )[ 0 ];
|
1826
|
+
|
1827
|
+
// If there's no month index, add it to the date object
|
1828
|
+
if ( !dateObject.mm && !dateObject.m ) {
|
1829
|
+
dateObject.m = collection.indexOf( word ) + 1;
|
1830
|
+
}
|
1831
|
+
|
1832
|
+
// Return the length of the word.
|
1833
|
+
return word.length
|
1834
|
+
}
|
1835
|
+
|
1836
|
+
// Get the length of the first word in a string.
|
1837
|
+
function getFirstWordLength( string ) {
|
1838
|
+
return string.match( /\w+/ )[ 0 ].length
|
1839
|
+
}
|
1840
|
+
|
1841
|
+
return {
|
1842
|
+
|
1843
|
+
d: function( string, dateObject ) {
|
1844
|
+
|
1845
|
+
// If there's string, then get the digits length.
|
1846
|
+
// Otherwise return the selected date.
|
1847
|
+
return string ? _.digits( string ) : dateObject.date
|
1848
|
+
},
|
1849
|
+
dd: function( string, dateObject ) {
|
1850
|
+
|
1851
|
+
// If there's a string, then the length is always 2.
|
1852
|
+
// Otherwise return the selected date with a leading zero.
|
1853
|
+
return string ? 2 : _.lead( dateObject.date )
|
1854
|
+
},
|
1855
|
+
ddd: function( string, dateObject ) {
|
1856
|
+
|
1857
|
+
// If there's a string, then get the length of the first word.
|
1858
|
+
// Otherwise return the short selected weekday.
|
1859
|
+
return string ? getFirstWordLength( string ) : this.settings.weekdaysShort[ dateObject.day ]
|
1860
|
+
},
|
1861
|
+
dddd: function( string, dateObject ) {
|
1862
|
+
|
1863
|
+
// If there's a string, then get the length of the first word.
|
1864
|
+
// Otherwise return the full selected weekday.
|
1865
|
+
return string ? getFirstWordLength( string ) : this.settings.weekdaysFull[ dateObject.day ]
|
1866
|
+
},
|
1867
|
+
m: function( string, dateObject ) {
|
1868
|
+
|
1869
|
+
// If there's a string, then get the length of the digits
|
1870
|
+
// Otherwise return the selected month with 0index compensation.
|
1871
|
+
return string ? _.digits( string ) : dateObject.month + 1
|
1872
|
+
},
|
1873
|
+
mm: function( string, dateObject ) {
|
1874
|
+
|
1875
|
+
// If there's a string, then the length is always 2.
|
1876
|
+
// Otherwise return the selected month with 0index and leading zero.
|
1877
|
+
return string ? 2 : _.lead( dateObject.month + 1 )
|
1878
|
+
},
|
1879
|
+
mmm: function( string, dateObject ) {
|
1880
|
+
|
1881
|
+
var collection = this.settings.monthsShort;
|
1882
|
+
|
1883
|
+
// If there's a string, get length of the relevant month from the short
|
1884
|
+
// months collection. Otherwise return the selected month from that collection.
|
1885
|
+
return string ? getWordLengthFromCollection( string, collection, dateObject ) : collection[ dateObject.month ]
|
1886
|
+
},
|
1887
|
+
mmmm: function( string, dateObject ) {
|
1888
|
+
|
1889
|
+
var collection = this.settings.monthsFull;
|
1890
|
+
|
1891
|
+
// If there's a string, get length of the relevant month from the full
|
1892
|
+
// months collection. Otherwise return the selected month from that collection.
|
1893
|
+
return string ? getWordLengthFromCollection( string, collection, dateObject ) : collection[ dateObject.month ]
|
1894
|
+
},
|
1895
|
+
yy: function( string, dateObject ) {
|
1896
|
+
|
1897
|
+
// If there's a string, then the length is always 2.
|
1898
|
+
// Otherwise return the selected year by slicing out the first 2 digits.
|
1899
|
+
return string ? 2 : ( '' + dateObject.year ).slice( 2 )
|
1900
|
+
},
|
1901
|
+
yyyy: function( string, dateObject ) {
|
1902
|
+
|
1903
|
+
// If there's a string, then the length is always 4.
|
1904
|
+
// Otherwise return the selected year.
|
1905
|
+
return string ? 4 : dateObject.year
|
1906
|
+
},
|
1907
|
+
|
1908
|
+
// Create an array by splitting the formatting string passed.
|
1909
|
+
toArray: function( formatString ) { return formatString.split( /(d{1,4}|m{1,4}|y{4}|yy|!.)/g ) },
|
1910
|
+
|
1911
|
+
// Format an object into a string using the formatting options.
|
1912
|
+
toString: function ( formatString, itemObject ) {
|
1913
|
+
var calendar = this;
|
1914
|
+
return calendar.formats.toArray( formatString ).map( function( label ) {
|
1915
|
+
return _.trigger( calendar.formats[ label ], calendar, [ 0, itemObject ] ) || label.replace( /^!/, '' )
|
1916
|
+
}).join( '' )
|
1917
|
+
}
|
1918
|
+
}
|
1919
|
+
})(); //DatePicker.prototype.formats
|
1920
|
+
|
1921
|
+
|
1922
|
+
|
1923
|
+
|
1924
|
+
/**
|
1925
|
+
* Check if two date units are the exact.
|
1926
|
+
*/
|
1927
|
+
DatePicker.prototype.isDateExact = function( one, two ) {
|
1928
|
+
|
1929
|
+
var calendar = this;
|
1930
|
+
|
1931
|
+
// When we’re working with weekdays, do a direct comparison.
|
1932
|
+
if (
|
1933
|
+
( _.isInteger( one ) && _.isInteger( two ) ) ||
|
1934
|
+
( typeof one == 'boolean' && typeof two == 'boolean' )
|
1935
|
+
) {
|
1936
|
+
return one === two
|
1937
|
+
}
|
1938
|
+
|
1939
|
+
// When we’re working with date representations, compare the “pick” value.
|
1940
|
+
if (
|
1941
|
+
( _.isDate( one ) || $$$1.isArray( one ) ) &&
|
1942
|
+
( _.isDate( two ) || $$$1.isArray( two ) )
|
1943
|
+
) {
|
1944
|
+
return calendar.create( one ).pick === calendar.create( two ).pick
|
1945
|
+
}
|
1946
|
+
|
1947
|
+
// When we’re working with range objects, compare the “from” and “to”.
|
1948
|
+
if ( $$$1.isPlainObject( one ) && $$$1.isPlainObject( two ) ) {
|
1949
|
+
return calendar.isDateExact( one.from, two.from ) && calendar.isDateExact( one.to, two.to )
|
1950
|
+
}
|
1951
|
+
|
1952
|
+
return false
|
1953
|
+
};
|
1954
|
+
|
1955
|
+
|
1956
|
+
/**
|
1957
|
+
* Check if two date units overlap.
|
1958
|
+
*/
|
1959
|
+
DatePicker.prototype.isDateOverlap = function( one, two ) {
|
1960
|
+
|
1961
|
+
var calendar = this,
|
1962
|
+
firstDay = calendar.settings.firstDay ? 1 : 0;
|
1963
|
+
|
1964
|
+
// When we’re working with a weekday index, compare the days.
|
1965
|
+
if ( _.isInteger( one ) && ( _.isDate( two ) || $$$1.isArray( two ) ) ) {
|
1966
|
+
one = one % 7 + firstDay;
|
1967
|
+
return one === calendar.create( two ).day + 1
|
1968
|
+
}
|
1969
|
+
if ( _.isInteger( two ) && ( _.isDate( one ) || $$$1.isArray( one ) ) ) {
|
1970
|
+
two = two % 7 + firstDay;
|
1971
|
+
return two === calendar.create( one ).day + 1
|
1972
|
+
}
|
1973
|
+
|
1974
|
+
// When we’re working with range objects, check if the ranges overlap.
|
1975
|
+
if ( $$$1.isPlainObject( one ) && $$$1.isPlainObject( two ) ) {
|
1976
|
+
return calendar.overlapRanges( one, two )
|
1977
|
+
}
|
1978
|
+
|
1979
|
+
return false
|
1980
|
+
};
|
1981
|
+
|
1982
|
+
|
1983
|
+
/**
|
1984
|
+
* Flip the “enabled” state.
|
1985
|
+
*/
|
1986
|
+
DatePicker.prototype.flipEnable = function(val) {
|
1987
|
+
var itemObject = this.item;
|
1988
|
+
itemObject.enable = val || (itemObject.enable == -1 ? 1 : -1);
|
1989
|
+
};
|
1990
|
+
|
1991
|
+
|
1992
|
+
/**
|
1993
|
+
* Mark a collection of dates as “disabled”.
|
1994
|
+
*/
|
1995
|
+
DatePicker.prototype.deactivate = function( type, datesToDisable ) {
|
1996
|
+
|
1997
|
+
var calendar = this,
|
1998
|
+
disabledItems = calendar.item.disable.slice(0);
|
1999
|
+
|
2000
|
+
|
2001
|
+
// If we’re flipping, that’s all we need to do.
|
2002
|
+
if ( datesToDisable == 'flip' ) {
|
2003
|
+
calendar.flipEnable();
|
2004
|
+
}
|
2005
|
+
|
2006
|
+
else if ( datesToDisable === false ) {
|
2007
|
+
calendar.flipEnable(1);
|
2008
|
+
disabledItems = [];
|
2009
|
+
}
|
2010
|
+
|
2011
|
+
else if ( datesToDisable === true ) {
|
2012
|
+
calendar.flipEnable(-1);
|
2013
|
+
disabledItems = [];
|
2014
|
+
}
|
2015
|
+
|
2016
|
+
// Otherwise go through the dates to disable.
|
2017
|
+
else {
|
2018
|
+
|
2019
|
+
datesToDisable.map(function( unitToDisable ) {
|
2020
|
+
|
2021
|
+
var matchFound;
|
2022
|
+
|
2023
|
+
// When we have disabled items, check for matches.
|
2024
|
+
// If something is matched, immediately break out.
|
2025
|
+
for ( var index = 0; index < disabledItems.length; index += 1 ) {
|
2026
|
+
if ( calendar.isDateExact( unitToDisable, disabledItems[index] ) ) {
|
2027
|
+
matchFound = true;
|
2028
|
+
break
|
2029
|
+
}
|
2030
|
+
}
|
2031
|
+
|
2032
|
+
// If nothing was found, add the validated unit to the collection.
|
2033
|
+
if ( !matchFound ) {
|
2034
|
+
if (
|
2035
|
+
_.isInteger( unitToDisable ) ||
|
2036
|
+
_.isDate( unitToDisable ) ||
|
2037
|
+
$$$1.isArray( unitToDisable ) ||
|
2038
|
+
( $$$1.isPlainObject( unitToDisable ) && unitToDisable.from && unitToDisable.to )
|
2039
|
+
) {
|
2040
|
+
disabledItems.push( unitToDisable );
|
2041
|
+
}
|
2042
|
+
}
|
2043
|
+
});
|
2044
|
+
}
|
2045
|
+
|
2046
|
+
// Return the updated collection.
|
2047
|
+
return disabledItems
|
2048
|
+
}; //DatePicker.prototype.deactivate
|
2049
|
+
|
2050
|
+
|
2051
|
+
/**
|
2052
|
+
* Mark a collection of dates as “enabled”.
|
2053
|
+
*/
|
2054
|
+
DatePicker.prototype.activate = function( type, datesToEnable ) {
|
2055
|
+
|
2056
|
+
var calendar = this,
|
2057
|
+
disabledItems = calendar.item.disable,
|
2058
|
+
disabledItemsCount = disabledItems.length;
|
2059
|
+
|
2060
|
+
// If we’re flipping, that’s all we need to do.
|
2061
|
+
if ( datesToEnable == 'flip' ) {
|
2062
|
+
calendar.flipEnable();
|
2063
|
+
}
|
2064
|
+
|
2065
|
+
else if ( datesToEnable === true ) {
|
2066
|
+
calendar.flipEnable(1);
|
2067
|
+
disabledItems = [];
|
2068
|
+
}
|
2069
|
+
|
2070
|
+
else if ( datesToEnable === false ) {
|
2071
|
+
calendar.flipEnable(-1);
|
2072
|
+
disabledItems = [];
|
2073
|
+
}
|
2074
|
+
|
2075
|
+
// Otherwise go through the disabled dates.
|
2076
|
+
else {
|
2077
|
+
|
2078
|
+
datesToEnable.map(function( unitToEnable ) {
|
2079
|
+
|
2080
|
+
var matchFound,
|
2081
|
+
disabledUnit,
|
2082
|
+
index,
|
2083
|
+
isExactRange;
|
2084
|
+
|
2085
|
+
// Go through the disabled items and try to find a match.
|
2086
|
+
for ( index = 0; index < disabledItemsCount; index += 1 ) {
|
2087
|
+
|
2088
|
+
disabledUnit = disabledItems[index];
|
2089
|
+
|
2090
|
+
// When an exact match is found, remove it from the collection.
|
2091
|
+
if ( calendar.isDateExact( disabledUnit, unitToEnable ) ) {
|
2092
|
+
matchFound = disabledItems[index] = null;
|
2093
|
+
isExactRange = true;
|
2094
|
+
break
|
2095
|
+
}
|
2096
|
+
|
2097
|
+
// When an overlapped match is found, add the “inverted” state to it.
|
2098
|
+
else if ( calendar.isDateOverlap( disabledUnit, unitToEnable ) ) {
|
2099
|
+
if ( $$$1.isPlainObject( unitToEnable ) ) {
|
2100
|
+
unitToEnable.inverted = true;
|
2101
|
+
matchFound = unitToEnable;
|
2102
|
+
}
|
2103
|
+
else if ( $$$1.isArray( unitToEnable ) ) {
|
2104
|
+
matchFound = unitToEnable;
|
2105
|
+
if ( !matchFound[3] ) matchFound.push( 'inverted' );
|
2106
|
+
}
|
2107
|
+
else if ( _.isDate( unitToEnable ) ) {
|
2108
|
+
matchFound = [ unitToEnable.getFullYear(), unitToEnable.getMonth(), unitToEnable.getDate(), 'inverted' ];
|
2109
|
+
}
|
2110
|
+
break
|
2111
|
+
}
|
2112
|
+
}
|
2113
|
+
|
2114
|
+
// If a match was found, remove a previous duplicate entry.
|
2115
|
+
if ( matchFound ) for ( index = 0; index < disabledItemsCount; index += 1 ) {
|
2116
|
+
if ( calendar.isDateExact( disabledItems[index], unitToEnable ) ) {
|
2117
|
+
disabledItems[index] = null;
|
2118
|
+
break
|
2119
|
+
}
|
2120
|
+
}
|
2121
|
+
|
2122
|
+
// In the event that we’re dealing with an exact range of dates,
|
2123
|
+
// make sure there are no “inverted” dates because of it.
|
2124
|
+
if ( isExactRange ) for ( index = 0; index < disabledItemsCount; index += 1 ) {
|
2125
|
+
if ( calendar.isDateOverlap( disabledItems[index], unitToEnable ) ) {
|
2126
|
+
disabledItems[index] = null;
|
2127
|
+
break
|
2128
|
+
}
|
2129
|
+
}
|
2130
|
+
|
2131
|
+
// If something is still matched, add it into the collection.
|
2132
|
+
if ( matchFound ) {
|
2133
|
+
disabledItems.push( matchFound );
|
2134
|
+
}
|
2135
|
+
});
|
2136
|
+
}
|
2137
|
+
|
2138
|
+
// Return the updated collection.
|
2139
|
+
return disabledItems.filter(function( val ) { return val != null })
|
2140
|
+
}; //DatePicker.prototype.activate
|
2141
|
+
|
2142
|
+
|
2143
|
+
/**
|
2144
|
+
* Create a string for the nodes in the picker.
|
2145
|
+
*/
|
2146
|
+
DatePicker.prototype.nodes = function( isOpen ) {
|
2147
|
+
|
2148
|
+
var
|
2149
|
+
calendar = this,
|
2150
|
+
settings = calendar.settings,
|
2151
|
+
calendarItem = calendar.item,
|
2152
|
+
nowObject = calendarItem.now,
|
2153
|
+
selectedObject = calendarItem.select,
|
2154
|
+
highlightedObject = calendarItem.highlight,
|
2155
|
+
viewsetObject = calendarItem.view,
|
2156
|
+
disabledCollection = calendarItem.disable,
|
2157
|
+
minLimitObject = calendarItem.min,
|
2158
|
+
maxLimitObject = calendarItem.max,
|
2159
|
+
|
2160
|
+
|
2161
|
+
// Create the calendar table head using a copy of weekday labels collection.
|
2162
|
+
// * We do a copy so we don't mutate the original array.
|
2163
|
+
tableHead = (function( collection, fullCollection ) {
|
2164
|
+
|
2165
|
+
// If the first day should be Monday, move Sunday to the end.
|
2166
|
+
if ( settings.firstDay ) {
|
2167
|
+
collection.push( collection.shift() );
|
2168
|
+
fullCollection.push( fullCollection.shift() );
|
2169
|
+
}
|
2170
|
+
|
2171
|
+
// Create and return the table head group.
|
2172
|
+
return _.node(
|
2173
|
+
'thead',
|
2174
|
+
_.node(
|
2175
|
+
'tr',
|
2176
|
+
_.group({
|
2177
|
+
min: 0,
|
2178
|
+
max: DAYS_IN_WEEK - 1,
|
2179
|
+
i: 1,
|
2180
|
+
node: 'th',
|
2181
|
+
item: function( counter ) {
|
2182
|
+
return [
|
2183
|
+
collection[ counter ],
|
2184
|
+
settings.klass.weekdays,
|
2185
|
+
'scope=col title="' + fullCollection[ counter ] + '"'
|
2186
|
+
]
|
2187
|
+
}
|
2188
|
+
})
|
2189
|
+
)
|
2190
|
+
) //endreturn
|
2191
|
+
})( ( settings.showWeekdaysFull ? settings.weekdaysFull : settings.weekdaysShort ).slice( 0 ), settings.weekdaysFull.slice( 0 ) ), //tableHead
|
2192
|
+
|
2193
|
+
|
2194
|
+
// Create the nav for next/prev month.
|
2195
|
+
createMonthNav = function( next ) {
|
2196
|
+
|
2197
|
+
// Otherwise, return the created month tag.
|
2198
|
+
return _.node(
|
2199
|
+
'div',
|
2200
|
+
' ',
|
2201
|
+
settings.klass[ 'nav' + ( next ? 'Next' : 'Prev' ) ] + (
|
2202
|
+
|
2203
|
+
// If the focused month is outside the range, disabled the button.
|
2204
|
+
( next && viewsetObject.year >= maxLimitObject.year && viewsetObject.month >= maxLimitObject.month ) ||
|
2205
|
+
( !next && viewsetObject.year <= minLimitObject.year && viewsetObject.month <= minLimitObject.month ) ?
|
2206
|
+
' ' + settings.klass.navDisabled : ''
|
2207
|
+
),
|
2208
|
+
'data-nav=' + ( next || -1 ) + ' ' +
|
2209
|
+
_.ariaAttr({
|
2210
|
+
role: 'button',
|
2211
|
+
controls: calendar.$node[0].id + '_table'
|
2212
|
+
}) + ' ' +
|
2213
|
+
'title="' + (next ? settings.labelMonthNext : settings.labelMonthPrev ) + '"'
|
2214
|
+
) //endreturn
|
2215
|
+
}, //createMonthNav
|
2216
|
+
|
2217
|
+
|
2218
|
+
// Create the month label.
|
2219
|
+
createMonthLabel = function() {
|
2220
|
+
|
2221
|
+
var monthsCollection = settings.showMonthsShort ? settings.monthsShort : settings.monthsFull;
|
2222
|
+
|
2223
|
+
// If there are months to select, add a dropdown menu.
|
2224
|
+
if ( settings.selectMonths ) {
|
2225
|
+
|
2226
|
+
return _.node( 'select',
|
2227
|
+
_.group({
|
2228
|
+
min: 0,
|
2229
|
+
max: 11,
|
2230
|
+
i: 1,
|
2231
|
+
node: 'option',
|
2232
|
+
item: function( loopedMonth ) {
|
2233
|
+
|
2234
|
+
return [
|
2235
|
+
|
2236
|
+
// The looped month and no classes.
|
2237
|
+
monthsCollection[ loopedMonth ], 0,
|
2238
|
+
|
2239
|
+
// Set the value and selected index.
|
2240
|
+
'value=' + loopedMonth +
|
2241
|
+
( viewsetObject.month == loopedMonth ? ' selected' : '' ) +
|
2242
|
+
(
|
2243
|
+
(
|
2244
|
+
( viewsetObject.year == minLimitObject.year && loopedMonth < minLimitObject.month ) ||
|
2245
|
+
( viewsetObject.year == maxLimitObject.year && loopedMonth > maxLimitObject.month )
|
2246
|
+
) ?
|
2247
|
+
' disabled' : ''
|
2248
|
+
)
|
2249
|
+
]
|
2250
|
+
}
|
2251
|
+
}),
|
2252
|
+
settings.klass.selectMonth,
|
2253
|
+
( isOpen ? '' : 'disabled' ) + ' ' +
|
2254
|
+
_.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' +
|
2255
|
+
'title="' + settings.labelMonthSelect + '"'
|
2256
|
+
)
|
2257
|
+
}
|
2258
|
+
|
2259
|
+
// If there's a need for a month selector
|
2260
|
+
return _.node( 'div', monthsCollection[ viewsetObject.month ], settings.klass.month )
|
2261
|
+
}, //createMonthLabel
|
2262
|
+
|
2263
|
+
|
2264
|
+
// Create the year label.
|
2265
|
+
createYearLabel = function() {
|
2266
|
+
|
2267
|
+
var focusedYear = viewsetObject.year,
|
2268
|
+
|
2269
|
+
// If years selector is set to a literal "true", set it to 5. Otherwise
|
2270
|
+
// divide in half to get half before and half after focused year.
|
2271
|
+
numberYears = settings.selectYears === true ? 5 : ~~( settings.selectYears / 2 );
|
2272
|
+
|
2273
|
+
// If there are years to select, add a dropdown menu.
|
2274
|
+
if ( numberYears ) {
|
2275
|
+
|
2276
|
+
var
|
2277
|
+
minYear = minLimitObject.year,
|
2278
|
+
maxYear = maxLimitObject.year,
|
2279
|
+
lowestYear = focusedYear - numberYears,
|
2280
|
+
highestYear = focusedYear + numberYears;
|
2281
|
+
|
2282
|
+
// If the min year is greater than the lowest year, increase the highest year
|
2283
|
+
// by the difference and set the lowest year to the min year.
|
2284
|
+
if ( minYear > lowestYear ) {
|
2285
|
+
highestYear += minYear - lowestYear;
|
2286
|
+
lowestYear = minYear;
|
2287
|
+
}
|
2288
|
+
|
2289
|
+
// If the max year is less than the highest year, decrease the lowest year
|
2290
|
+
// by the lower of the two: available and needed years. Then set the
|
2291
|
+
// highest year to the max year.
|
2292
|
+
if ( maxYear < highestYear ) {
|
2293
|
+
|
2294
|
+
var availableYears = lowestYear - minYear,
|
2295
|
+
neededYears = highestYear - maxYear;
|
2296
|
+
|
2297
|
+
lowestYear -= availableYears > neededYears ? neededYears : availableYears;
|
2298
|
+
highestYear = maxYear;
|
2299
|
+
}
|
2300
|
+
|
2301
|
+
return _.node( 'select',
|
2302
|
+
_.group({
|
2303
|
+
min: lowestYear,
|
2304
|
+
max: highestYear,
|
2305
|
+
i: 1,
|
2306
|
+
node: 'option',
|
2307
|
+
item: function( loopedYear ) {
|
2308
|
+
return [
|
2309
|
+
|
2310
|
+
// The looped year and no classes.
|
2311
|
+
loopedYear, 0,
|
2312
|
+
|
2313
|
+
// Set the value and selected index.
|
2314
|
+
'value=' + loopedYear + ( focusedYear == loopedYear ? ' selected' : '' )
|
2315
|
+
]
|
2316
|
+
}
|
2317
|
+
}),
|
2318
|
+
settings.klass.selectYear,
|
2319
|
+
( isOpen ? '' : 'disabled' ) + ' ' + _.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' +
|
2320
|
+
'title="' + settings.labelYearSelect + '"'
|
2321
|
+
)
|
2322
|
+
}
|
2323
|
+
|
2324
|
+
// Otherwise just return the year focused
|
2325
|
+
return _.node( 'div', focusedYear, settings.klass.year )
|
2326
|
+
}; //createYearLabel
|
2327
|
+
|
2328
|
+
|
2329
|
+
// Create and return the entire calendar.
|
2330
|
+
return _.node(
|
2331
|
+
'div',
|
2332
|
+
( settings.selectYears ? createYearLabel() + createMonthLabel() : createMonthLabel() + createYearLabel() ) +
|
2333
|
+
createMonthNav() + createMonthNav( 1 ),
|
2334
|
+
settings.klass.header
|
2335
|
+
) + _.node(
|
2336
|
+
'table',
|
2337
|
+
tableHead +
|
2338
|
+
_.node(
|
2339
|
+
'tbody',
|
2340
|
+
_.group({
|
2341
|
+
min: 0,
|
2342
|
+
max: WEEKS_IN_CALENDAR - 1,
|
2343
|
+
i: 1,
|
2344
|
+
node: 'tr',
|
2345
|
+
item: function( rowCounter ) {
|
2346
|
+
|
2347
|
+
// If Monday is the first day and the month starts on Sunday, shift the date back a week.
|
2348
|
+
var shiftDateBy = settings.firstDay && calendar.create([ viewsetObject.year, viewsetObject.month, 1 ]).day === 0 ? -7 : 0;
|
2349
|
+
|
2350
|
+
return [
|
2351
|
+
_.group({
|
2352
|
+
min: DAYS_IN_WEEK * rowCounter - viewsetObject.day + shiftDateBy + 1, // Add 1 for weekday 0index
|
2353
|
+
max: function() {
|
2354
|
+
return this.min + DAYS_IN_WEEK - 1
|
2355
|
+
},
|
2356
|
+
i: 1,
|
2357
|
+
node: 'td',
|
2358
|
+
item: function( targetDate ) {
|
2359
|
+
|
2360
|
+
// Convert the time date from a relative date to a target date.
|
2361
|
+
targetDate = calendar.create([ viewsetObject.year, viewsetObject.month, targetDate + ( settings.firstDay ? 1 : 0 ) ]);
|
2362
|
+
|
2363
|
+
var isSelected = selectedObject && selectedObject.pick == targetDate.pick,
|
2364
|
+
isHighlighted = highlightedObject && highlightedObject.pick == targetDate.pick,
|
2365
|
+
isDisabled = disabledCollection && calendar.disabled( targetDate ) || targetDate.pick < minLimitObject.pick || targetDate.pick > maxLimitObject.pick,
|
2366
|
+
formattedDate = _.trigger( calendar.formats.toString, calendar, [ settings.format, targetDate ] );
|
2367
|
+
|
2368
|
+
return [
|
2369
|
+
_.node(
|
2370
|
+
'div',
|
2371
|
+
targetDate.date,
|
2372
|
+
(function( klasses ) {
|
2373
|
+
|
2374
|
+
// Add the `infocus` or `outfocus` classes based on month in view.
|
2375
|
+
klasses.push( viewsetObject.month == targetDate.month ? settings.klass.infocus : settings.klass.outfocus );
|
2376
|
+
|
2377
|
+
// Add the `today` class if needed.
|
2378
|
+
if ( nowObject.pick == targetDate.pick ) {
|
2379
|
+
klasses.push( settings.klass.now );
|
2380
|
+
}
|
2381
|
+
|
2382
|
+
// Add the `selected` class if something's selected and the time matches.
|
2383
|
+
if ( isSelected ) {
|
2384
|
+
klasses.push( settings.klass.selected );
|
2385
|
+
}
|
2386
|
+
|
2387
|
+
// Add the `highlighted` class if something's highlighted and the time matches.
|
2388
|
+
if ( isHighlighted ) {
|
2389
|
+
klasses.push( settings.klass.highlighted );
|
2390
|
+
}
|
2391
|
+
|
2392
|
+
// Add the `disabled` class if something's disabled and the object matches.
|
2393
|
+
if ( isDisabled ) {
|
2394
|
+
klasses.push( settings.klass.disabled );
|
2395
|
+
}
|
2396
|
+
|
2397
|
+
return klasses.join( ' ' )
|
2398
|
+
})([ settings.klass.day ]),
|
2399
|
+
'data-pick=' + targetDate.pick + ' ' + _.ariaAttr({
|
2400
|
+
role: 'gridcell',
|
2401
|
+
label: formattedDate,
|
2402
|
+
selected: isSelected && calendar.$node.val() === formattedDate ? true : null,
|
2403
|
+
activedescendant: isHighlighted ? true : null,
|
2404
|
+
disabled: isDisabled ? true : null
|
2405
|
+
})
|
2406
|
+
),
|
2407
|
+
'',
|
2408
|
+
_.ariaAttr({ role: 'presentation' })
|
2409
|
+
] //endreturn
|
2410
|
+
}
|
2411
|
+
})
|
2412
|
+
] //endreturn
|
2413
|
+
}
|
2414
|
+
})
|
2415
|
+
),
|
2416
|
+
settings.klass.table,
|
2417
|
+
'id="' + calendar.$node[0].id + '_table' + '" ' + _.ariaAttr({
|
2418
|
+
role: 'grid',
|
2419
|
+
controls: calendar.$node[0].id,
|
2420
|
+
readonly: true
|
2421
|
+
})
|
2422
|
+
) +
|
2423
|
+
|
2424
|
+
// * For Firefox forms to submit, make sure to set the buttons’ `type` attributes as “button”.
|
2425
|
+
_.node(
|
2426
|
+
'div',
|
2427
|
+
_.node( 'button', settings.today, settings.klass.buttonToday,
|
2428
|
+
'type=button data-pick=' + nowObject.pick +
|
2429
|
+
( isOpen && !calendar.disabled(nowObject) ? '' : ' disabled' ) + ' ' +
|
2430
|
+
_.ariaAttr({ controls: calendar.$node[0].id }) ) +
|
2431
|
+
_.node( 'button', settings.clear, settings.klass.buttonClear,
|
2432
|
+
'type=button data-clear=1' +
|
2433
|
+
( isOpen ? '' : ' disabled' ) + ' ' +
|
2434
|
+
_.ariaAttr({ controls: calendar.$node[0].id }) ) +
|
2435
|
+
_.node('button', settings.close, settings.klass.buttonClose,
|
2436
|
+
'type=button data-close=true ' +
|
2437
|
+
( isOpen ? '' : ' disabled' ) + ' ' +
|
2438
|
+
_.ariaAttr({ controls: calendar.$node[0].id }) ),
|
2439
|
+
settings.klass.footer
|
2440
|
+
) //endreturn
|
2441
|
+
}; //DatePicker.prototype.nodes
|
2442
|
+
|
2443
|
+
|
2444
|
+
|
2445
|
+
|
2446
|
+
/**
|
2447
|
+
* The date picker defaults.
|
2448
|
+
*/
|
2449
|
+
DatePicker.defaults = (function( prefix ) {
|
2450
|
+
|
2451
|
+
return {
|
2452
|
+
|
2453
|
+
// The title label to use for the month nav buttons
|
2454
|
+
labelMonthNext: 'Next month',
|
2455
|
+
labelMonthPrev: 'Previous month',
|
2456
|
+
|
2457
|
+
// The title label to use for the dropdown selectors
|
2458
|
+
labelMonthSelect: 'Select a month',
|
2459
|
+
labelYearSelect: 'Select a year',
|
2460
|
+
|
2461
|
+
// Months and weekdays
|
2462
|
+
monthsFull: [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ],
|
2463
|
+
monthsShort: [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ],
|
2464
|
+
weekdaysFull: [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ],
|
2465
|
+
weekdaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],
|
2466
|
+
|
2467
|
+
// Today and clear
|
2468
|
+
today: 'Today',
|
2469
|
+
clear: 'Clear',
|
2470
|
+
close: 'Close',
|
2471
|
+
|
2472
|
+
// Picker close behavior
|
2473
|
+
closeOnSelect: true,
|
2474
|
+
closeOnClear: true,
|
2475
|
+
|
2476
|
+
// The format to show on the `input` element
|
2477
|
+
format: 'd mmmm, yyyy',
|
2478
|
+
|
2479
|
+
// Classes
|
2480
|
+
klass: {
|
2481
|
+
|
2482
|
+
table: prefix + 'table',
|
2483
|
+
|
2484
|
+
header: prefix + 'header',
|
2485
|
+
|
2486
|
+
navPrev: prefix + 'nav--prev',
|
2487
|
+
navNext: prefix + 'nav--next',
|
2488
|
+
navDisabled: prefix + 'nav--disabled',
|
2489
|
+
|
2490
|
+
month: prefix + 'month',
|
2491
|
+
year: prefix + 'year',
|
2492
|
+
|
2493
|
+
selectMonth: prefix + 'select--month',
|
2494
|
+
selectYear: prefix + 'select--year',
|
2495
|
+
|
2496
|
+
weekdays: prefix + 'weekday',
|
2497
|
+
|
2498
|
+
day: prefix + 'day',
|
2499
|
+
disabled: prefix + 'day--disabled',
|
2500
|
+
selected: prefix + 'day--selected',
|
2501
|
+
highlighted: prefix + 'day--highlighted',
|
2502
|
+
now: prefix + 'day--today',
|
2503
|
+
infocus: prefix + 'day--infocus',
|
2504
|
+
outfocus: prefix + 'day--outfocus',
|
2505
|
+
|
2506
|
+
footer: prefix + 'footer',
|
2507
|
+
|
2508
|
+
buttonClear: prefix + 'button--clear',
|
2509
|
+
buttonToday: prefix + 'button--today',
|
2510
|
+
buttonClose: prefix + 'button--close'
|
2511
|
+
}
|
2512
|
+
}
|
2513
|
+
})( Picker.klasses().picker + '__' );
|
2514
|
+
|
2515
|
+
|
2516
|
+
|
2517
|
+
|
2518
|
+
|
2519
|
+
/**
|
2520
|
+
* Extend the picker to add the date picker.
|
2521
|
+
*/
|
2522
|
+
Picker.extend( 'pickadate', DatePicker );
|
2523
|
+
|
2524
|
+
|
2525
|
+
}));
|
2526
|
+
});
|
2527
|
+
|
2528
|
+
function _defineProperties(target, props) {
|
2529
|
+
for (var i = 0; i < props.length; i++) {
|
2530
|
+
var descriptor = props[i];
|
2531
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
2532
|
+
descriptor.configurable = true;
|
2533
|
+
if ("value" in descriptor) descriptor.writable = true;
|
2534
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
2535
|
+
}
|
2536
|
+
}
|
2537
|
+
|
2538
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
2539
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
2540
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
2541
|
+
return Constructor;
|
2542
|
+
}
|
2543
|
+
|
2544
|
+
/*
|
2545
|
+
* Customise pickadate JavaScript for Material
|
2546
|
+
*/
|
2547
|
+
(function ($$$1) {
|
2548
|
+
var Datepicker = function Datepicker(element, options) {
|
2549
|
+
this._element = element;
|
2550
|
+
this._options = options;
|
2551
|
+
};
|
2552
|
+
|
2553
|
+
Datepicker.DEFAULTS = {
|
2554
|
+
cancel: 'Cancel',
|
2555
|
+
closeOnCancel: true,
|
2556
|
+
closeOnSelect: false,
|
2557
|
+
container: 'body',
|
2558
|
+
disable: [],
|
2559
|
+
firstDay: 0,
|
2560
|
+
format: 'd/m/yyyy',
|
2561
|
+
formatSubmit: '',
|
2562
|
+
klass: {
|
2563
|
+
// button
|
2564
|
+
buttonClear: 'btn btn-outline-primary picker-button-clear',
|
2565
|
+
buttonClose: 'btn btn-outline-primary picker-button-close',
|
2566
|
+
buttonToday: 'btn btn-outline-primary picker-button-today',
|
2567
|
+
// day
|
2568
|
+
day: 'picker-day',
|
2569
|
+
disabled: 'picker-day-disabled',
|
2570
|
+
highlighted: 'picker-day-highlighted',
|
2571
|
+
infocus: 'picker-day-infocus',
|
2572
|
+
now: 'picker-day-today',
|
2573
|
+
outfocus: 'picker-day-outfocus',
|
2574
|
+
selected: 'picker-day-selected',
|
2575
|
+
weekdays: 'picker-weekday',
|
2576
|
+
// element
|
2577
|
+
box: 'picker-box',
|
2578
|
+
footer: 'picker-footer',
|
2579
|
+
frame: 'picker-frame',
|
2580
|
+
header: 'picker-header',
|
2581
|
+
holder: 'picker-holder',
|
2582
|
+
table: 'picker-table',
|
2583
|
+
wrap: 'picker-wrap',
|
2584
|
+
// input element
|
2585
|
+
active: 'picker-input-active',
|
2586
|
+
input: 'picker-input',
|
2587
|
+
// month and year nav
|
2588
|
+
month: 'picker-month',
|
2589
|
+
navDisabled: 'picker-nav-disabled',
|
2590
|
+
navNext: 'material-icons picker-nav-next',
|
2591
|
+
navPrev: 'material-icons picker-nav-prev',
|
2592
|
+
selectMonth: 'picker-select-month',
|
2593
|
+
selectYear: 'picker-select-year',
|
2594
|
+
year: 'picker-year',
|
2595
|
+
// root picker
|
2596
|
+
focused: 'picker-focused',
|
2597
|
+
opened: 'picker-opened',
|
2598
|
+
picker: 'picker'
|
2599
|
+
},
|
2600
|
+
max: false,
|
2601
|
+
min: false,
|
2602
|
+
monthsFull: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
2603
|
+
monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
2604
|
+
ok: 'OK',
|
2605
|
+
onClose: false,
|
2606
|
+
onOpen: false,
|
2607
|
+
onRender: false,
|
2608
|
+
onSet: false,
|
2609
|
+
onStart: false,
|
2610
|
+
onStop: false,
|
2611
|
+
selectMonths: false,
|
2612
|
+
selectYears: false,
|
2613
|
+
today: '',
|
2614
|
+
weekdaysFull: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
2615
|
+
weekdaysShort: ['S', 'M', 'T', 'W', 'T', 'F', 'S']
|
2616
|
+
};
|
2617
|
+
|
2618
|
+
Datepicker.prototype.display = function (datepickerApi, datepickerRoot, datepickerValue) {
|
2619
|
+
$$$1('.picker-date-display', datepickerRoot).remove();
|
2620
|
+
$$$1('.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>');
|
2621
|
+
};
|
2622
|
+
|
2623
|
+
Datepicker.prototype.show = function () {
|
2624
|
+
var that = this;
|
2625
|
+
$$$1(this._element).pickadate({
|
2626
|
+
clear: that._options.cancel,
|
2627
|
+
close: that._options.ok,
|
2628
|
+
closeOnClear: that._options.closeOnCancel,
|
2629
|
+
closeOnSelect: that._options.closeOnSelect,
|
2630
|
+
container: that._options.container,
|
2631
|
+
disable: that._options.disable,
|
2632
|
+
firstDay: that._options.firstDay,
|
2633
|
+
format: that._options.format,
|
2634
|
+
formatSubmit: that._options.formatSubmit,
|
2635
|
+
klass: that._options.klass,
|
2636
|
+
max: that._options.max,
|
2637
|
+
min: that._options.min,
|
2638
|
+
monthsFull: that._options.monthsFull,
|
2639
|
+
monthsShort: that._options.monthsShort,
|
2640
|
+
onClose: that._options.onClose,
|
2641
|
+
onOpen: that._options.onOpen,
|
2642
|
+
onRender: that._options.onRender,
|
2643
|
+
onSet: that._options.onSet,
|
2644
|
+
onStart: that._options.onStart,
|
2645
|
+
onStop: that._options.onStop,
|
2646
|
+
selectMonths: that._options.selectMonths,
|
2647
|
+
selectYears: that._options.selectYears,
|
2648
|
+
today: that._options.today,
|
2649
|
+
weekdaysFull: that._options.weekdaysFull,
|
2650
|
+
weekdaysShort: that._options.weekdaysShort
|
2651
|
+
});
|
2652
|
+
var datepickerApi = $$$1(this._element).pickadate('picker'),
|
2653
|
+
datepickerNode = datepickerApi.$node,
|
2654
|
+
datepickerRoot = datepickerApi.$root;
|
2655
|
+
datepickerApi.on({
|
2656
|
+
close: function close() {
|
2657
|
+
$$$1(document.activeElement).blur();
|
2658
|
+
},
|
2659
|
+
open: function open() {
|
2660
|
+
if (!$$$1('.picker__date-display', datepickerRoot).length) {
|
2661
|
+
that.display(datepickerApi, datepickerRoot, 'highlight');
|
2662
|
+
}
|
2663
|
+
},
|
2664
|
+
set: function set() {
|
2665
|
+
if (datepickerApi.get('select') !== null) {
|
2666
|
+
that.display(datepickerApi, datepickerRoot, 'select');
|
2667
|
+
}
|
2668
|
+
}
|
2669
|
+
});
|
2670
|
+
};
|
2671
|
+
|
2672
|
+
function Plugin(option) {
|
2673
|
+
return this.each(function () {
|
2674
|
+
var data = $$$1(this).data('bs.pickdate');
|
2675
|
+
var options = $$$1.extend({}, Datepicker.DEFAULTS, $$$1(this).data(), typeof option == 'object' && option);
|
2676
|
+
|
2677
|
+
if (!data) {
|
2678
|
+
$$$1(this).data('bs.pickdate', data = new Datepicker(this, options));
|
2679
|
+
}
|
2680
|
+
|
2681
|
+
data.show();
|
2682
|
+
});
|
2683
|
+
}
|
2684
|
+
|
2685
|
+
var old = $$$1.fn.pickdate;
|
2686
|
+
$$$1.fn.pickdate = Plugin;
|
2687
|
+
$$$1.fn.pickdate.Constructor = Datepicker;
|
2688
|
+
|
2689
|
+
$$$1.fn.pickdate.noConflict = function () {
|
2690
|
+
$$$1.fn.pickdate = old;
|
2691
|
+
return this;
|
2692
|
+
};
|
2693
|
+
})(jQuery);
|
2694
|
+
|
2695
|
+
/*
|
2696
|
+
* expansion panel
|
2697
|
+
* upon selecting the collapsed panel,
|
2698
|
+
* it expands to display in full
|
2699
|
+
*/
|
2700
|
+
|
2701
|
+
var ExpansionPanel = function ($$$1) {
|
2702
|
+
// constants >>>
|
2703
|
+
var DATA_KEY = 'bs.collapse';
|
2704
|
+
var EVENT_KEY = "." + DATA_KEY;
|
2705
|
+
var ClassName = {
|
2706
|
+
SHOW: 'show',
|
2707
|
+
SHOW_PREDECESSOR: 'show-predecessor'
|
2708
|
+
};
|
2709
|
+
var Event = {
|
2710
|
+
HIDE: "hide" + EVENT_KEY,
|
2711
|
+
SHOW: "show" + EVENT_KEY
|
2712
|
+
};
|
2713
|
+
var Selector = {
|
2714
|
+
PANEL: '.expansion-panel',
|
2715
|
+
PANEL_BODY: '.expansion-panel .collapse' // <<< constants
|
2716
|
+
|
2717
|
+
};
|
2718
|
+
$$$1(document).on("" + Event.HIDE, Selector.PANEL_BODY, function (event) {
|
2719
|
+
var target = $$$1(event.target).closest(Selector.PANEL);
|
2720
|
+
target.removeClass(ClassName.SHOW);
|
2721
|
+
var predecessor = target.prev(Selector.PANEL);
|
2722
|
+
|
2723
|
+
if (predecessor.length) {
|
2724
|
+
predecessor.removeClass(ClassName.SHOW_PREDECESSOR);
|
2725
|
+
}
|
2726
|
+
}).on("" + Event.SHOW, Selector.PANEL_BODY, function (event) {
|
2727
|
+
var target = $$$1(event.target).closest(Selector.PANEL);
|
2728
|
+
target.addClass(ClassName.SHOW);
|
2729
|
+
var predecessor = target.prev(Selector.PANEL);
|
2730
|
+
|
2731
|
+
if (predecessor.length) {
|
2732
|
+
predecessor.addClass(ClassName.SHOW_PREDECESSOR);
|
2733
|
+
}
|
2734
|
+
});
|
2735
|
+
}($);
|
2736
|
+
|
2737
|
+
/*
|
2738
|
+
* floating label
|
2739
|
+
* when a user engages with the text input field,
|
2740
|
+
* the floating inline labels move to float above the field
|
2741
|
+
*/
|
2742
|
+
|
2743
|
+
var FloatingLabel = function ($$$1) {
|
2744
|
+
// constants >>>
|
2745
|
+
var DATA_KEY = 'md.floatinglabel';
|
2746
|
+
var EVENT_KEY = "." + DATA_KEY;
|
2747
|
+
var NAME = 'floatinglabel';
|
2748
|
+
var NO_CONFLICT = $$$1.fn[NAME];
|
2749
|
+
var ClassName = {
|
2750
|
+
IS_FOCUSED: 'is-focused',
|
2751
|
+
HAS_VALUE: 'has-value'
|
2752
|
+
};
|
2753
|
+
var Event = {
|
2754
|
+
CHANGE: "change" + EVENT_KEY,
|
2755
|
+
FOCUSIN: "focusin" + EVENT_KEY,
|
2756
|
+
FOCUSOUT: "focusout" + EVENT_KEY
|
2757
|
+
};
|
2758
|
+
var Selector = {
|
2759
|
+
DATA_PARENT: '.floating-label',
|
2760
|
+
DATA_TOGGLE: '.floating-label .form-control' // <<< constants
|
2761
|
+
|
2762
|
+
};
|
2763
|
+
|
2764
|
+
var FloatingLabel =
|
2765
|
+
/*#__PURE__*/
|
2766
|
+
function () {
|
2767
|
+
function FloatingLabel(element) {
|
2768
|
+
this._element = element;
|
2769
|
+
}
|
2770
|
+
|
2771
|
+
var _proto = FloatingLabel.prototype;
|
2772
|
+
|
2773
|
+
_proto.change = function change(relatedTarget) {
|
2774
|
+
if ($$$1(this._element).val() || $$$1(this._element).is('select') && $$$1('option:first-child', $$$1(this._element)).html().replace(' ', '') !== '') {
|
2775
|
+
$$$1(relatedTarget).addClass(ClassName.HAS_VALUE);
|
2776
|
+
} else {
|
2777
|
+
$$$1(relatedTarget).removeClass(ClassName.HAS_VALUE);
|
2778
|
+
}
|
2779
|
+
};
|
2780
|
+
|
2781
|
+
_proto.focusin = function focusin(relatedTarget) {
|
2782
|
+
$$$1(relatedTarget).addClass(ClassName.IS_FOCUSED);
|
2783
|
+
};
|
2784
|
+
|
2785
|
+
_proto.focusout = function focusout(relatedTarget) {
|
2786
|
+
$$$1(relatedTarget).removeClass(ClassName.IS_FOCUSED);
|
2787
|
+
};
|
2788
|
+
|
2789
|
+
FloatingLabel._jQueryInterface = function _jQueryInterface(event) {
|
2790
|
+
return this.each(function () {
|
2791
|
+
var _event = event ? event : 'change';
|
2792
|
+
|
2793
|
+
var data = $$$1(this).data(DATA_KEY);
|
2794
|
+
|
2795
|
+
if (!data) {
|
2796
|
+
data = new FloatingLabel(this);
|
2797
|
+
$$$1(this).data(DATA_KEY, data);
|
2798
|
+
}
|
2799
|
+
|
2800
|
+
if (typeof _event === 'string') {
|
2801
|
+
if (data[_event] === 'undefined') {
|
2802
|
+
throw new Error("No method named \"" + _event + "\"");
|
2803
|
+
}
|
2804
|
+
|
2805
|
+
data[_event]($$$1(this).closest(Selector.DATA_PARENT));
|
2806
|
+
}
|
2807
|
+
});
|
2808
|
+
};
|
2809
|
+
|
2810
|
+
return FloatingLabel;
|
2811
|
+
}();
|
2812
|
+
|
2813
|
+
$$$1(document).on(Event.CHANGE + " " + Event.FOCUSIN + " " + Event.FOCUSOUT, Selector.DATA_TOGGLE, function (event) {
|
2814
|
+
FloatingLabel._jQueryInterface.call($$$1(this), event.type);
|
2815
|
+
});
|
2816
|
+
$$$1.fn[NAME] = FloatingLabel._jQueryInterface;
|
2817
|
+
$$$1.fn[NAME].Constructor = FloatingLabel;
|
2818
|
+
|
2819
|
+
$$$1.fn[NAME].noConflict = function () {
|
2820
|
+
$$$1.fn[NAME] = NO_CONFLICT;
|
2821
|
+
return FloatingLabel._jQueryInterface;
|
2822
|
+
};
|
2823
|
+
|
2824
|
+
return FloatingLabel;
|
2825
|
+
}($);
|
2826
|
+
|
2827
|
+
/*
|
2828
|
+
* global util js
|
2829
|
+
* based on bootstrap's (v4.0.0-beta) util.js
|
2830
|
+
*/
|
2831
|
+
|
2832
|
+
var Util = function ($$$1) {
|
2833
|
+
var MAX_UID = 1000000;
|
2834
|
+
var transition = false;
|
2835
|
+
|
2836
|
+
function escapeId(selector) {
|
2837
|
+
selector = typeof $$$1.escapeSelector === 'function' ? $$$1.escapeSelector(selector).substr(1) : selector.replace(/(:|\.|\[|\]|,|=|@)/g, '\\$1');
|
2838
|
+
return selector;
|
2839
|
+
}
|
2840
|
+
|
2841
|
+
function getSpecialTransitionEndEvent() {
|
2842
|
+
return {
|
2843
|
+
bindType: transition.end,
|
2844
|
+
delegateType: transition.end,
|
2845
|
+
handle: function handle(event) {
|
2846
|
+
if ($$$1(event.target).is(this)) {
|
2847
|
+
return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
|
2848
|
+
}
|
2849
|
+
|
2850
|
+
return undefined; // eslint-disable-line no-undefined
|
2851
|
+
}
|
2852
|
+
};
|
2853
|
+
}
|
2854
|
+
|
2855
|
+
function setTransitionEndSupport() {
|
2856
|
+
transition = transitionEndTest();
|
2857
|
+
$$$1.fn.emulateTransitionEnd = transitionEndEmulator;
|
2858
|
+
|
2859
|
+
if (Util.supportsTransitionEnd()) {
|
2860
|
+
$$$1.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
|
2861
|
+
}
|
2862
|
+
}
|
2863
|
+
|
2864
|
+
function toType(obj) {
|
2865
|
+
return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
|
2866
|
+
}
|
2867
|
+
|
2868
|
+
function transitionEndEmulator(duration) {
|
2869
|
+
var _this = this;
|
2870
|
+
|
2871
|
+
var called = false;
|
2872
|
+
$$$1(this).one(Util.TRANSITION_END, function () {
|
2873
|
+
called = true;
|
2874
|
+
});
|
2875
|
+
setTimeout(function () {
|
2876
|
+
if (!called) {
|
2877
|
+
Util.triggerTransitionEnd(_this);
|
2878
|
+
}
|
2879
|
+
}, duration);
|
2880
|
+
return this;
|
2881
|
+
}
|
2882
|
+
|
2883
|
+
function transitionEndTest() {
|
2884
|
+
if (window.QUnit) {
|
2885
|
+
return false;
|
2886
|
+
}
|
2887
|
+
|
2888
|
+
return {
|
2889
|
+
end: 'transitionend'
|
2890
|
+
};
|
2891
|
+
}
|
2892
|
+
|
2893
|
+
var Util = {
|
2894
|
+
TRANSITION_END: 'mdTransitionEnd',
|
2895
|
+
getSelectorFromElement: function getSelectorFromElement(element) {
|
2896
|
+
var selector = element.getAttribute('data-target');
|
2897
|
+
|
2898
|
+
if (!selector || selector === '#') {
|
2899
|
+
selector = element.getAttribute('href') || '';
|
2900
|
+
}
|
2901
|
+
|
2902
|
+
if (selector.charAt(0) === '#') {
|
2903
|
+
selector = escapeId(selector);
|
2904
|
+
}
|
2905
|
+
|
2906
|
+
try {
|
2907
|
+
var $selector = $$$1(document).find(selector);
|
2908
|
+
return $selector.length > 0 ? selector : null;
|
2909
|
+
} catch (err) {
|
2910
|
+
return null;
|
2911
|
+
}
|
2912
|
+
},
|
2913
|
+
getUID: function getUID(prefix) {
|
2914
|
+
do {
|
2915
|
+
// eslint-disable-next-line no-bitwise
|
2916
|
+
prefix += ~~(Math.random() * MAX_UID);
|
2917
|
+
} while (document.getElementById(prefix));
|
2918
|
+
|
2919
|
+
return prefix;
|
2920
|
+
},
|
2921
|
+
isElement: function isElement(obj) {
|
2922
|
+
return (obj[0] || obj).nodeType;
|
2923
|
+
},
|
2924
|
+
reflow: function reflow(element) {
|
2925
|
+
return element.offsetHeight;
|
2926
|
+
},
|
2927
|
+
supportsTransitionEnd: function supportsTransitionEnd() {
|
2928
|
+
return Boolean(transition);
|
2929
|
+
},
|
2930
|
+
triggerTransitionEnd: function triggerTransitionEnd(element) {
|
2931
|
+
$$$1(element).trigger(transition.end);
|
2932
|
+
},
|
2933
|
+
typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
|
2934
|
+
for (var property in configTypes) {
|
2935
|
+
if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
|
2936
|
+
var expectedTypes = configTypes[property];
|
2937
|
+
var value = config[property];
|
2938
|
+
var valueType = value && Util.isElement(value) ? 'element' : toType(value);
|
2939
|
+
|
2940
|
+
if (!new RegExp(expectedTypes).test(valueType)) {
|
2941
|
+
throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
|
2942
|
+
}
|
2943
|
+
}
|
2944
|
+
}
|
2945
|
+
}
|
2946
|
+
};
|
2947
|
+
setTransitionEndSupport();
|
2948
|
+
return Util;
|
2949
|
+
}($);
|
2950
|
+
|
2951
|
+
/*
|
2952
|
+
* navigation drawer
|
2953
|
+
* based on bootstrap's (v4.0.0-beta) modal.js
|
2954
|
+
*/
|
2955
|
+
|
2956
|
+
var NavDrawer = function ($$$1) {
|
2957
|
+
// constants >>>
|
2958
|
+
var DATA_API_KEY = '.data-api';
|
2959
|
+
var DATA_KEY = 'md.navdrawer';
|
2960
|
+
var ESCAPE_KEYCODE = 27;
|
2961
|
+
var EVENT_KEY = "." + DATA_KEY;
|
2962
|
+
var NAME = 'navdrawer';
|
2963
|
+
var NO_CONFLICT = $$$1.fn[NAME];
|
2964
|
+
var TRANSITION_DURATION = 292.5;
|
2965
|
+
var TRANSITION_DURATION_BACKDROP = 487.5;
|
2966
|
+
var ClassName = {
|
2967
|
+
BACKDROP: 'navdrawer-backdrop',
|
2968
|
+
OPEN: 'navdrawer-open',
|
2969
|
+
SHOW: 'show'
|
2970
|
+
};
|
2971
|
+
var Default = {
|
2972
|
+
breakpoint: 1280,
|
2973
|
+
keyboard: true,
|
2974
|
+
show: true,
|
2975
|
+
type: 'default'
|
2976
|
+
};
|
2977
|
+
var DefaultType = {
|
2978
|
+
keyboard: 'boolean',
|
2979
|
+
show: 'boolean',
|
2980
|
+
type: 'string'
|
2981
|
+
};
|
2982
|
+
var Event = {
|
2983
|
+
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY,
|
2984
|
+
CLICK_DISMISS: "click.dismiss" + EVENT_KEY,
|
2985
|
+
FOCUSIN: "focusin" + EVENT_KEY,
|
2986
|
+
HIDDEN: "hidden" + EVENT_KEY,
|
2987
|
+
HIDE: "hide" + EVENT_KEY,
|
2988
|
+
KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY,
|
2989
|
+
MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY,
|
2990
|
+
MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY,
|
2991
|
+
SHOW: "show" + EVENT_KEY,
|
2992
|
+
SHOWN: "shown" + EVENT_KEY
|
2993
|
+
};
|
2994
|
+
var Selector = {
|
2995
|
+
CONTENT: '.navdrawer-content',
|
2996
|
+
DATA_DISMISS: '[data-dismiss="navdrawer"]',
|
2997
|
+
DATA_TOGGLE: '[data-toggle="navdrawer"]' // <<< constants
|
2998
|
+
|
2999
|
+
};
|
3000
|
+
|
3001
|
+
var NavDrawer =
|
3002
|
+
/*#__PURE__*/
|
3003
|
+
function () {
|
3004
|
+
function NavDrawer(element, config) {
|
3005
|
+
this._backdrop = null;
|
3006
|
+
this._config = this._getConfig(config);
|
3007
|
+
this._content = $$$1(element).find(Selector.CONTENT)[0];
|
3008
|
+
this._element = element;
|
3009
|
+
this._ignoreBackdropClick = false;
|
3010
|
+
this._isShown = false;
|
3011
|
+
}
|
3012
|
+
|
3013
|
+
var _proto = NavDrawer.prototype;
|
3014
|
+
|
3015
|
+
_proto.hide = function hide(event) {
|
3016
|
+
if (event) {
|
3017
|
+
event.preventDefault();
|
3018
|
+
}
|
3019
|
+
|
3020
|
+
var hideClassName = ClassName.OPEN + "-" + this._config.type;
|
3021
|
+
var hideEvent = $$$1.Event(Event.HIDE);
|
3022
|
+
$$$1(this._element).trigger(hideEvent);
|
3023
|
+
|
3024
|
+
if (!this._isShown || hideEvent.isDefaultPrevented()) {
|
3025
|
+
return;
|
3026
|
+
}
|
3027
|
+
|
3028
|
+
this._isShown = false;
|
3029
|
+
|
3030
|
+
this._setEscapeEvent();
|
3031
|
+
|
3032
|
+
$$$1(document).off(Event.FOCUSIN);
|
3033
|
+
$$$1(this._content).off(Event.MOUSEDOWN_DISMISS);
|
3034
|
+
$$$1(this._element).off(Event.CLICK_DISMISS).removeClass(ClassName.SHOW);
|
3035
|
+
|
3036
|
+
this._hideNavdrawer(hideClassName);
|
3037
|
+
};
|
3038
|
+
|
3039
|
+
_proto.show = function show(relatedTarget) {
|
3040
|
+
var _this = this;
|
3041
|
+
|
3042
|
+
var showEvent = $$$1.Event(Event.SHOW, {
|
3043
|
+
relatedTarget: relatedTarget
|
3044
|
+
});
|
3045
|
+
$$$1(this._element).trigger(showEvent);
|
3046
|
+
|
3047
|
+
if (this._isShown || showEvent.isDefaultPrevented()) {
|
3048
|
+
return;
|
3049
|
+
}
|
3050
|
+
|
3051
|
+
this._isShown = true;
|
3052
|
+
$$$1(document.body).addClass(ClassName.OPEN + "-" + this._config.type);
|
3053
|
+
|
3054
|
+
this._setEscapeEvent();
|
3055
|
+
|
3056
|
+
$$$1(this._element).addClass(NAME + "-" + this._config.type);
|
3057
|
+
$$$1(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, $$$1.proxy(this.hide, this));
|
3058
|
+
$$$1(this._content).on(Event.MOUSEDOWN_DISMISS, function () {
|
3059
|
+
$$$1(_this._element).one(Event.MOUSEUP_DISMISS, function (event) {
|
3060
|
+
if ($$$1(event.target).is(_this._element)) {
|
3061
|
+
_this._ignoreBackdropClick = true;
|
3062
|
+
}
|
3063
|
+
});
|
3064
|
+
});
|
3065
|
+
|
3066
|
+
this._showBackdrop();
|
3067
|
+
|
3068
|
+
this._showElement(relatedTarget);
|
3069
|
+
};
|
3070
|
+
|
3071
|
+
_proto.toggle = function toggle(relatedTarget) {
|
3072
|
+
return this._isShown ? this.hide() : this.show(relatedTarget);
|
3073
|
+
};
|
3074
|
+
|
3075
|
+
_proto._enforceFocus = function _enforceFocus() {
|
3076
|
+
var _this2 = this;
|
3077
|
+
|
3078
|
+
$$$1(document).off(Event.FOCUSIN).on(Event.FOCUSIN, function (event) {
|
3079
|
+
if (_this2._config.type === 'default' || $$$1(window).width() <= _this2._config.breakpoint) {
|
3080
|
+
if (_this2._element !== event.target && !$$$1(_this2._element).has(event.target).length) {
|
3081
|
+
_this2._element.focus();
|
3082
|
+
}
|
3083
|
+
}
|
3084
|
+
});
|
3085
|
+
};
|
3086
|
+
|
3087
|
+
_proto._getConfig = function _getConfig(config) {
|
3088
|
+
config = $$$1.extend({}, Default, config);
|
3089
|
+
Util.typeCheckConfig(NAME, config, DefaultType);
|
3090
|
+
return config;
|
3091
|
+
};
|
3092
|
+
|
3093
|
+
_proto._hideNavdrawer = function _hideNavdrawer(className) {
|
3094
|
+
var _this3 = this;
|
3095
|
+
|
3096
|
+
this._showBackdrop(function () {
|
3097
|
+
$$$1(document.body).removeClass(className);
|
3098
|
+
|
3099
|
+
_this3._element.setAttribute('aria-hidden', 'true');
|
3100
|
+
|
3101
|
+
_this3._element.style.display = 'none';
|
3102
|
+
$$$1(_this3._element).trigger(Event.HIDDEN);
|
3103
|
+
});
|
3104
|
+
};
|
3105
|
+
|
3106
|
+
_proto._removeBackdrop = function _removeBackdrop() {
|
3107
|
+
if (this._backdrop) {
|
3108
|
+
$$$1(this._backdrop).remove();
|
3109
|
+
this._backdrop = null;
|
3110
|
+
}
|
3111
|
+
};
|
3112
|
+
|
3113
|
+
_proto._setEscapeEvent = function _setEscapeEvent() {
|
3114
|
+
var _this4 = this;
|
3115
|
+
|
3116
|
+
if (this._isShown && this._config.keyboard) {
|
3117
|
+
$$$1(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
|
3118
|
+
if (event.which === ESCAPE_KEYCODE) {
|
3119
|
+
_this4.hide();
|
3120
|
+
}
|
3121
|
+
});
|
3122
|
+
} else if (!this._isShown) {
|
3123
|
+
$$$1(this._element).off(Event.KEYDOWN_DISMISS);
|
3124
|
+
}
|
3125
|
+
};
|
3126
|
+
|
3127
|
+
_proto._showBackdrop = function _showBackdrop(callback) {
|
3128
|
+
var _this5 = this;
|
3129
|
+
|
3130
|
+
var supportsTransition = Util.supportsTransitionEnd();
|
3131
|
+
|
3132
|
+
if (this._isShown) {
|
3133
|
+
this._backdrop = document.createElement('div');
|
3134
|
+
$$$1(this._backdrop).addClass(ClassName.BACKDROP).addClass(ClassName.BACKDROP + "-" + this._config.type).appendTo(document.body);
|
3135
|
+
$$$1(this._element).on(Event.CLICK_DISMISS, function (event) {
|
3136
|
+
if (_this5._ignoreBackdropClick) {
|
3137
|
+
_this5._ignoreBackdropClick = false;
|
3138
|
+
return;
|
3139
|
+
}
|
3140
|
+
|
3141
|
+
if (event.target !== event.currentTarget) {
|
3142
|
+
return;
|
3143
|
+
}
|
3144
|
+
|
3145
|
+
_this5.hide();
|
3146
|
+
});
|
3147
|
+
|
3148
|
+
if (supportsTransition) {
|
3149
|
+
Util.reflow(this._backdrop);
|
3150
|
+
}
|
3151
|
+
|
3152
|
+
$$$1(this._backdrop).addClass(ClassName.SHOW);
|
3153
|
+
|
3154
|
+
if (!callback) {
|
3155
|
+
return;
|
3156
|
+
}
|
3157
|
+
|
3158
|
+
if (!supportsTransition) {
|
3159
|
+
callback();
|
3160
|
+
return;
|
3161
|
+
}
|
3162
|
+
|
3163
|
+
$$$1(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(TRANSITION_DURATION_BACKDROP);
|
3164
|
+
} else if (this._backdrop && !this._isShown) {
|
3165
|
+
$$$1(this._backdrop).removeClass(ClassName.SHOW);
|
3166
|
+
|
3167
|
+
var callbackRemove = function callbackRemove() {
|
3168
|
+
_this5._removeBackdrop();
|
3169
|
+
|
3170
|
+
if (callback) {
|
3171
|
+
callback();
|
3172
|
+
}
|
3173
|
+
};
|
3174
|
+
|
3175
|
+
if (supportsTransition) {
|
3176
|
+
$$$1(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(TRANSITION_DURATION_BACKDROP);
|
3177
|
+
} else {
|
3178
|
+
callbackRemove();
|
3179
|
+
}
|
3180
|
+
} else if (callback) {
|
3181
|
+
callback();
|
3182
|
+
}
|
3183
|
+
};
|
3184
|
+
|
3185
|
+
_proto._showElement = function _showElement(relatedTarget) {
|
3186
|
+
var _this6 = this;
|
3187
|
+
|
3188
|
+
var supportsTransition = Util.supportsTransitionEnd();
|
3189
|
+
|
3190
|
+
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
|
3191
|
+
document.body.appendChild(this._element);
|
3192
|
+
}
|
3193
|
+
|
3194
|
+
this._element.removeAttribute('aria-hidden');
|
3195
|
+
|
3196
|
+
this._element.style.display = 'block';
|
3197
|
+
|
3198
|
+
if (supportsTransition) {
|
3199
|
+
Util.reflow(this._element);
|
3200
|
+
}
|
3201
|
+
|
3202
|
+
$$$1(this._element).addClass(ClassName.SHOW);
|
3203
|
+
|
3204
|
+
this._enforceFocus();
|
3205
|
+
|
3206
|
+
var shownEvent = $$$1.Event(Event.SHOWN, {
|
3207
|
+
relatedTarget: relatedTarget
|
3208
|
+
});
|
3209
|
+
|
3210
|
+
var transitionComplete = function transitionComplete() {
|
3211
|
+
_this6._element.focus();
|
3212
|
+
|
3213
|
+
$$$1(_this6._element).trigger(shownEvent);
|
3214
|
+
};
|
3215
|
+
|
3216
|
+
if (supportsTransition) {
|
3217
|
+
$$$1(this._content).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(TRANSITION_DURATION);
|
3218
|
+
} else {
|
3219
|
+
transitionComplete();
|
3220
|
+
}
|
3221
|
+
};
|
3222
|
+
|
3223
|
+
NavDrawer._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
|
3224
|
+
return this.each(function () {
|
3225
|
+
var _config = $$$1.extend({}, NavDrawer.Default, $$$1(this).data(), typeof config === 'object' && config);
|
3226
|
+
|
3227
|
+
var data = $$$1(this).data(DATA_KEY);
|
3228
|
+
|
3229
|
+
if (!data) {
|
3230
|
+
data = new NavDrawer(this, _config);
|
3231
|
+
$$$1(this).data(DATA_KEY, data);
|
3232
|
+
}
|
3233
|
+
|
3234
|
+
if (typeof config === 'string') {
|
3235
|
+
if (data[config] === 'undefined') {
|
3236
|
+
throw new Error("No method named \"" + config + "\"");
|
3237
|
+
}
|
3238
|
+
|
3239
|
+
data[config](relatedTarget);
|
3240
|
+
} else if (_config.show) {
|
3241
|
+
data.show(relatedTarget);
|
3242
|
+
}
|
3243
|
+
});
|
3244
|
+
};
|
3245
|
+
|
3246
|
+
_createClass(NavDrawer, null, [{
|
3247
|
+
key: "Default",
|
3248
|
+
get: function get() {
|
3249
|
+
return Default;
|
3250
|
+
}
|
3251
|
+
}]);
|
3252
|
+
return NavDrawer;
|
3253
|
+
}();
|
3254
|
+
|
3255
|
+
$$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
3256
|
+
var _this7 = this;
|
3257
|
+
|
3258
|
+
var selector = Util.getSelectorFromElement(this);
|
3259
|
+
var target;
|
3260
|
+
|
3261
|
+
if (selector) {
|
3262
|
+
target = $$$1(selector)[0];
|
3263
|
+
}
|
3264
|
+
|
3265
|
+
var config = $$$1(target).data(DATA_KEY) ? 'toggle' : $$$1.extend({}, $$$1(target).data(), $$$1(this).data());
|
3266
|
+
|
3267
|
+
if (this.tagName === 'A') {
|
3268
|
+
event.preventDefault();
|
3269
|
+
}
|
3270
|
+
|
3271
|
+
var $target = $$$1(target).one(Event.SHOW, function (showEvent) {
|
3272
|
+
if (showEvent.isDefaultPrevented()) {
|
3273
|
+
return;
|
3274
|
+
}
|
3275
|
+
|
3276
|
+
$target.one(Event.HIDDEN, function () {
|
3277
|
+
if ($$$1(_this7).is(':visible')) {
|
3278
|
+
_this7.focus();
|
3279
|
+
}
|
3280
|
+
});
|
3281
|
+
});
|
3282
|
+
|
3283
|
+
NavDrawer._jQueryInterface.call($$$1(target), config, this);
|
3284
|
+
});
|
3285
|
+
$$$1.fn[NAME] = NavDrawer._jQueryInterface;
|
3286
|
+
$$$1.fn[NAME].Constructor = NavDrawer;
|
3287
|
+
|
3288
|
+
$$$1.fn[NAME].noConflict = function () {
|
3289
|
+
$$$1.fn[NAME] = NO_CONFLICT;
|
3290
|
+
return NavDrawer._jQueryInterface;
|
3291
|
+
};
|
3292
|
+
|
3293
|
+
return NavDrawer;
|
3294
|
+
}($);
|
3295
|
+
|
3296
|
+
/*
|
3297
|
+
* selection control focus
|
3298
|
+
* chrome persists the focus style on checkboxes/radio buttons after clicking
|
3299
|
+
*/
|
3300
|
+
|
3301
|
+
var SelectionControlFocus = function ($$$1) {
|
3302
|
+
// constants >>>
|
3303
|
+
var DATA_KEY = 'md.selectioncontrolfocus';
|
3304
|
+
var EVENT_KEY = "." + DATA_KEY;
|
3305
|
+
var ClassName = {
|
3306
|
+
FOCUS: 'focus'
|
3307
|
+
};
|
3308
|
+
var LastInteraction = {
|
3309
|
+
IS_MOUSEDOWN: false
|
3310
|
+
};
|
3311
|
+
var Event = {
|
3312
|
+
BLUR: "blur" + EVENT_KEY,
|
3313
|
+
FOCUS: "focus" + EVENT_KEY,
|
3314
|
+
MOUSEDOWN: "mousedown" + EVENT_KEY,
|
3315
|
+
MOUSEUP: "mouseup" + EVENT_KEY
|
3316
|
+
};
|
3317
|
+
var Selector = {
|
3318
|
+
CONTROL: '.custom-control',
|
3319
|
+
INPUT: '.custom-control-input' // <<< constants
|
3320
|
+
|
3321
|
+
};
|
3322
|
+
$$$1(document).on("" + Event.BLUR, Selector.INPUT, function (event) {
|
3323
|
+
$$$1(event.target).removeClass(ClassName.FOCUS);
|
3324
|
+
}).on("" + Event.FOCUS, Selector.INPUT, function (event) {
|
3325
|
+
if (LastInteraction.IS_MOUSEDOWN === false) {
|
3326
|
+
$$$1(event.target).addClass(ClassName.FOCUS);
|
3327
|
+
}
|
3328
|
+
}).on("" + Event.MOUSEDOWN, Selector.CONTROL, function () {
|
3329
|
+
LastInteraction.IS_MOUSEDOWN = true;
|
3330
|
+
}).on("" + Event.MOUSEUP, Selector.CONTROL, function () {
|
3331
|
+
setTimeout(function () {
|
3332
|
+
LastInteraction.IS_MOUSEDOWN = false;
|
3333
|
+
}, 1);
|
3334
|
+
});
|
3335
|
+
}($);
|
3336
|
+
|
3337
|
+
/*
|
3338
|
+
* tab indicator animation
|
3339
|
+
* requires bootstrap's (v4.0.0-beta) tab.js
|
3340
|
+
*/
|
3341
|
+
|
3342
|
+
var TabSwitch = function ($$$1) {
|
3343
|
+
// constants >>>
|
3344
|
+
var DATA_KEY = 'md.tabswitch';
|
3345
|
+
var NAME = 'tabswitch';
|
3346
|
+
var NO_CONFLICT = $$$1.fn[NAME];
|
3347
|
+
var TRANSITION_DURATION = 390;
|
3348
|
+
var ClassName = {
|
3349
|
+
ANIMATE: 'animate',
|
3350
|
+
DROPDOWN_ITEM: 'dropdown-item',
|
3351
|
+
INDICATOR: 'nav-tabs-indicator',
|
3352
|
+
MATERIAL: 'nav-tabs-material',
|
3353
|
+
SCROLLABLE: 'nav-tabs-scrollable',
|
3354
|
+
SHOW: 'show'
|
3355
|
+
};
|
3356
|
+
var Event = {
|
3357
|
+
SHOW_BS_TAB: 'show.bs.tab'
|
3358
|
+
};
|
3359
|
+
var Selector = {
|
3360
|
+
DATA_TOGGLE: '.nav-tabs [data-toggle="tab"]',
|
3361
|
+
DROPDOWN: '.dropdown',
|
3362
|
+
NAV: '.nav-tabs' // <<< constants
|
3363
|
+
|
3364
|
+
};
|
3365
|
+
|
3366
|
+
var TabSwitch =
|
3367
|
+
/*#__PURE__*/
|
3368
|
+
function () {
|
3369
|
+
function TabSwitch(nav) {
|
3370
|
+
if (typeof $$$1.fn.tab === 'undefined') {
|
3371
|
+
throw new Error('Material\'s JavaScript requires Bootstrap\'s tab.js');
|
3372
|
+
}
|
3373
|
+
|
3374
|
+
this._nav = nav;
|
3375
|
+
this._navindicator = null;
|
3376
|
+
}
|
3377
|
+
|
3378
|
+
var _proto = TabSwitch.prototype;
|
3379
|
+
|
3380
|
+
_proto.switch = function _switch(element, relatedTarget) {
|
3381
|
+
var _this = this;
|
3382
|
+
|
3383
|
+
var navLeft = $$$1(this._nav).offset().left;
|
3384
|
+
var navScrollLeft = $$$1(this._nav).scrollLeft();
|
3385
|
+
var navWidth = $$$1(this._nav).outerWidth();
|
3386
|
+
var supportsTransition = Util.supportsTransitionEnd();
|
3387
|
+
|
3388
|
+
if (!this._navindicator) {
|
3389
|
+
this._createIndicator(navLeft, navScrollLeft, navWidth, relatedTarget);
|
3390
|
+
}
|
3391
|
+
|
3392
|
+
if ($$$1(element).hasClass(ClassName.DROPDOWN_ITEM)) {
|
3393
|
+
element = $$$1(element).closest(Selector.DROPDOWN);
|
3394
|
+
}
|
3395
|
+
|
3396
|
+
var elLeft = $$$1(element).offset().left;
|
3397
|
+
var elWidth = $$$1(element).outerWidth();
|
3398
|
+
$$$1(this._navindicator).addClass(ClassName.SHOW);
|
3399
|
+
Util.reflow(this._navindicator);
|
3400
|
+
|
3401
|
+
if (supportsTransition) {
|
3402
|
+
$$$1(this._nav).addClass(ClassName.ANIMATE);
|
3403
|
+
}
|
3404
|
+
|
3405
|
+
$$$1(this._navindicator).css({
|
3406
|
+
left: elLeft + navScrollLeft - navLeft,
|
3407
|
+
right: navWidth - (elLeft + navScrollLeft - navLeft + elWidth)
|
3408
|
+
});
|
3409
|
+
|
3410
|
+
var complete = function complete() {
|
3411
|
+
$$$1(_this._nav).removeClass(ClassName.ANIMATE);
|
3412
|
+
$$$1(_this._navindicator).removeClass(ClassName.SHOW);
|
3413
|
+
};
|
3414
|
+
|
3415
|
+
if (!supportsTransition) {
|
3416
|
+
complete();
|
3417
|
+
return;
|
3418
|
+
}
|
3419
|
+
|
3420
|
+
$$$1(this._navindicator).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
|
3421
|
+
};
|
3422
|
+
|
3423
|
+
_proto._createIndicator = function _createIndicator(navLeft, navScrollLeft, navWidth, relatedTarget) {
|
3424
|
+
this._navindicator = document.createElement('div');
|
3425
|
+
$$$1(this._navindicator).addClass(ClassName.INDICATOR).appendTo(this._nav);
|
3426
|
+
|
3427
|
+
if (relatedTarget !== 'undefined') {
|
3428
|
+
if ($$$1(relatedTarget).hasClass(ClassName.DROPDOWN_ITEM)) {
|
3429
|
+
relatedTarget = $$$1(relatedTarget).closest(Selector.DROPDOWN);
|
3430
|
+
}
|
3431
|
+
|
3432
|
+
var relatedLeft = $$$1(relatedTarget).offset().left;
|
3433
|
+
var relatedWidth = $$$1(relatedTarget).outerWidth();
|
3434
|
+
$$$1(this._navindicator).css({
|
3435
|
+
left: relatedLeft + navScrollLeft - navLeft,
|
3436
|
+
right: navWidth - (relatedLeft + navScrollLeft - navLeft + relatedWidth)
|
3437
|
+
});
|
3438
|
+
}
|
3439
|
+
|
3440
|
+
$$$1(this._nav).addClass(ClassName.MATERIAL);
|
3441
|
+
};
|
3442
|
+
|
3443
|
+
TabSwitch._jQueryInterface = function _jQueryInterface(relatedTarget) {
|
3444
|
+
return this.each(function () {
|
3445
|
+
var nav = $$$1(this).closest(Selector.NAV)[0];
|
3446
|
+
|
3447
|
+
if (!nav) {
|
3448
|
+
return;
|
3449
|
+
}
|
3450
|
+
|
3451
|
+
var data = $$$1(nav).data(DATA_KEY);
|
3452
|
+
|
3453
|
+
if (!data) {
|
3454
|
+
data = new TabSwitch(nav);
|
3455
|
+
$$$1(nav).data(DATA_KEY, data);
|
3456
|
+
}
|
3457
|
+
|
3458
|
+
data.switch(this, relatedTarget);
|
3459
|
+
});
|
3460
|
+
};
|
3461
|
+
|
3462
|
+
return TabSwitch;
|
3463
|
+
}();
|
3464
|
+
|
3465
|
+
$$$1(document).on(Event.SHOW_BS_TAB, Selector.DATA_TOGGLE, function (event) {
|
3466
|
+
TabSwitch._jQueryInterface.call($$$1(event.target), event.relatedTarget);
|
3467
|
+
});
|
3468
|
+
$$$1.fn[NAME] = TabSwitch._jQueryInterface;
|
3469
|
+
$$$1.fn[NAME].Constructor = TabSwitch;
|
3470
|
+
|
3471
|
+
$$$1.fn[NAME].noConflict = function () {
|
3472
|
+
$$$1.fn[NAME] = NO_CONFLICT;
|
3473
|
+
return TabSwitch._jQueryInterface;
|
3474
|
+
};
|
3475
|
+
|
3476
|
+
return TabSwitch;
|
3477
|
+
}($);
|
3478
|
+
|
3479
|
+
// Extend third party JavaScript
|
3480
|
+
|
3481
|
+
exports.Util = Util;
|
3482
|
+
exports.ExpansionPanel = ExpansionPanel;
|
3483
|
+
exports.FloatingLabel = FloatingLabel;
|
3484
|
+
exports.NavDrawer = NavDrawer;
|
3485
|
+
exports.SelectionControlFocus = SelectionControlFocus;
|
3486
|
+
exports.TabSwitch = TabSwitch;
|
3487
|
+
|
3488
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
1035
3489
|
|
1036
|
-
|
1037
|
-
|
1038
|
-
}();
|
3490
|
+
})));
|
3491
|
+
//# sourceMappingURL=material.js.map
|