mirror of
https://github.com/mdbootstrap/mdb-ui-kit.git
synced 2024-11-24 02:24:09 +03:00
10 lines
133 KiB
JavaScript
10 lines
133 KiB
JavaScript
|
/*!
|
||
|
* Bootstrap Material Design v4.0.0-prealpha (https://github.com/FezVrasta/bootstrap-material-design)
|
||
|
* Copyright 2014-2016 Federico Zivolo
|
||
|
* Licensed under MIT (https://github.com/FezVrasta/bootstrap-material-design/blob/master/LICENSE)
|
||
|
*/
|
||
|
!function(){"use strict";var babelHelpers={};babelHelpers["typeof"]="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj},babelHelpers.classCallCheck=function(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")},babelHelpers.createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),babelHelpers.get=function get(object,property,receiver){null===object&&(object=Function.prototype);var desc=Object.getOwnPropertyDescriptor(object,property);if(void 0===desc){var parent=Object.getPrototypeOf(object);return null===parent?void 0:get(parent,property,receiver)}if("value"in desc)return desc.value;var getter=desc.get;if(void 0!==getter)return getter.call(receiver)},babelHelpers.inherits=function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)},babelHelpers.possibleConstructorReturn=function(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call},function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(_dereq_,module,exports){(function(global){if(_dereq_(189),_dereq_(2),global._babelPolyfill)throw new Error("only one instance of babel-polyfill is allowed");global._babelPolyfill=!0}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{189:189,2:2}],2:[function(_dereq_,module,exports){module.exports=_dereq_(190)},{190:190}],3:[function(_dereq_,module,exports){module.exports=function(it){if("function"!=typeof it)throw TypeError(it+" is not a function!");return it}},{}],4:[function(_dereq_,module,exports){var UNSCOPABLES=_dereq_(84)("unscopables"),ArrayProto=Array.prototype;void 0==ArrayProto[UNSCOPABLES]&&_dereq_(32)(ArrayProto,UNSCOPABLES,{}),module.exports=function(key){ArrayProto[UNSCOPABLES][key]=!0}},{32:32,84:84}],5:[function(_dereq_,module,exports){var isObject=_dereq_(39);module.exports=function(it){if(!isObject(it))throw TypeError(it+" is not an object!");return it}},{39:39}],6:[function(_dereq_,module,exports){var toObject=_dereq_(81),toIndex=_dereq_(77),toLength=_dereq_(80);module.exports=[].copyWithin||function(target,start){var O=toObject(this),len=toLength(O.length),to=toIndex(target,len),from=toIndex(start,len),$$=arguments,end=$$.length>2?$$[2]:void 0,count=Math.min((void 0===end?len:toIndex(end,len))-from,len-to),inc=1;for(to>from&&from+count>to&&(inc=-1,from+=count-1,to+=count-1);count-- >0;)from in O?O[to]=O[from]:delete O[to],to+=inc,from+=inc;return O}},{77:77,80:80,81:81}],7:[function(_dereq_,module,exports){var toObject=_dereq_(81),toIndex=_dereq_(77),toLength=_dereq_(80);module.exports=[].fill||function(value){for(var O=toObject(this,!0),length=toLength(O.len
|
||
|
var exp={};exp[KEY]=exec(trim),$def($def.P+$def.F*fails(function(){return!!spaces[KEY]()||non[KEY]()!=non}),"String",exp)},trim=$export.trim=function(string,TYPE){return string=String(defined(string)),1&TYPE&&(string=string.replace(ltrim,"")),2&TYPE&&(string=string.replace(rtrim,"")),string};module.exports=$export},{19:19,20:20,25:25}],76:[function(_dereq_,module,exports){var defer,channel,port,ctx=_dereq_(18),invoke=_dereq_(34),html=_dereq_(33),cel=_dereq_(22),global=_dereq_(30),process=global.process,setTask=global.setImmediate,clearTask=global.clearImmediate,MessageChannel=global.MessageChannel,counter=0,queue={},ONREADYSTATECHANGE="onreadystatechange",run=function(){var id=+this;if(queue.hasOwnProperty(id)){var fn=queue[id];delete queue[id],fn()}},listner=function(event){run.call(event.data)};setTask&&clearTask||(setTask=function(fn){for(var args=[],i=1;arguments.length>i;)args.push(arguments[i++]);return queue[++counter]=function(){invoke("function"==typeof fn?fn:Function(fn),args)},defer(counter),counter},clearTask=function(id){delete queue[id]},"process"==_dereq_(12)(process)?defer=function(id){process.nextTick(ctx(run,id,1))}:MessageChannel?(channel=new MessageChannel,port=channel.port2,channel.port1.onmessage=listner,defer=ctx(port.postMessage,port,1)):global.addEventListener&&"function"==typeof postMessage&&!global.importScripts?(defer=function(id){global.postMessage(id+"","*")},global.addEventListener("message",listner,!1)):defer=ONREADYSTATECHANGE in cel("script")?function(id){html.appendChild(cel("script"))[ONREADYSTATECHANGE]=function(){html.removeChild(this),run.call(id)}}:function(id){setTimeout(ctx(run,id,1),0)}),module.exports={set:setTask,clear:clearTask}},{12:12,18:18,22:22,30:30,33:33,34:34}],77:[function(_dereq_,module,exports){var toInteger=_dereq_(78),max=Math.max,min=Math.min;module.exports=function(index,length){return index=toInteger(index),0>index?max(index+length,0):min(index,length)}},{78:78}],78:[function(_dereq_,module,exports){var ceil=Math.ceil,floor=Math.floor;module.exports=function(it){return isNaN(it=+it)?0:(it>0?floor:ceil)(it)}},{}],79:[function(_dereq_,module,exports){var IObject=_dereq_(35),defined=_dereq_(20);module.exports=function(it){return IObject(defined(it))}},{20:20,35:35}],80:[function(_dereq_,module,exports){var toInteger=_dereq_(78),min=Math.min;module.exports=function(it){return it>0?min(toInteger(it),9007199254740991):0}},{78:78}],81:[function(_dereq_,module,exports){var defined=_dereq_(20);module.exports=function(it){return Object(defined(it))}},{20:20}],82:[function(_dereq_,module,exports){var isObject=_dereq_(39);module.exports=function(it,S){if(!isObject(it))return it;var fn,val;if(S&&"function"==typeof(fn=it.toString)&&!isObject(val=fn.call(it)))return val;if("function"==typeof(fn=it.valueOf)&&!isObject(val=fn.call(it)))return val;if(!S&&"function"==typeof(fn=it.toString)&&!isObject(val=fn.call(it)))return val;throw TypeError("Can't convert object to primitive value")}},{39:39}],83:[function(_dereq_,module,exports){var id=0,px=Math.random();module.exports=function(key){return"Symbol(".concat(void 0===key?"":key,")_",(++id+px).toString(36))}},{}],84:[function(_dereq_,module,exports){var store=_dereq_(68)("wks"),uid=_dereq_(83),_Symbol=_dereq_(30).Symbol;module.exports=function(name){return store[name]||(store[name]=_Symbol&&_Symbol[name]||(_Symbol||uid)("Symbol."+name))}},{30:30,68:68,83:83}],85:[function(_dereq_,module,exports){var classof=_dereq_(11),ITERATOR=_dereq_(84)("iterator"),Iterators=_dereq_(46);module.exports=_dereq_(17).getIteratorMethod=function(it){return void 0!=it?it[ITERATOR]||it["@@iterator"]||Iterators[classof(it)]:void 0}},{11:11,17:17,46:46,84:84}],86:[function(_dereq_,module,exports){var IE8_DOM_DEFINE,$=_dereq_(47),DESCRIPTORS=_dereq_(21),createDesc=_dereq_(61),html=_dereq_(33),cel=_dereq_(22),has=_dereq_(31),cof=_dereq_(12),$def=_dereq_(19),invoke=_dereq_(34),arrayMethod=_dereq_(9),IE_PROTO=_dereq_(83)("__proto__"),isObject=_dereq_(39),anObject=_dereq_(5),aFunction=_dereq_(3),toObject=_dereq_(81),toIObject=_dereq_(79),toInteger=_dereq_(7
|
||
|
return!1}}})},{19:19,5:5}],152:[function(_dereq_,module,exports){var $def=_dereq_(19),setProto=_dereq_(65);setProto&&$def($def.S,"Reflect",{setPrototypeOf:function(target,proto){setProto.check(target,proto);try{return setProto.set(target,proto),!0}catch(e){return!1}}})},{19:19,65:65}],153:[function(_dereq_,module,exports){function set(target,propertyKey,V){var existingDescriptor,proto,receiver=arguments.length<4?target:arguments[3],ownDesc=$.getDesc(anObject(target),propertyKey);if(!ownDesc){if(isObject(proto=$.getProto(target)))return set(proto,propertyKey,V,receiver);ownDesc=createDesc(0)}return has(ownDesc,"value")?ownDesc.writable!==!1&&isObject(receiver)?(existingDescriptor=$.getDesc(receiver,propertyKey)||createDesc(0),existingDescriptor.value=V,$.setDesc(receiver,propertyKey,existingDescriptor),!0):!1:void 0===ownDesc.set?!1:(ownDesc.set.call(receiver,V),!0)}var $=_dereq_(47),has=_dereq_(31),$def=_dereq_(19),createDesc=_dereq_(61),anObject=_dereq_(5),isObject=_dereq_(39);$def($def.S,"Reflect",{set:set})},{19:19,31:31,39:39,47:47,5:5,61:61}],154:[function(_dereq_,module,exports){var $=_dereq_(47),global=_dereq_(30),isRegExp=_dereq_(40),$flags=_dereq_(27),$RegExp=global.RegExp,Base=$RegExp,proto=$RegExp.prototype,re1=/a/g,re2=/a/g,CORRECT_NEW=new $RegExp(re1)!==re1;!_dereq_(21)||CORRECT_NEW&&!_dereq_(25)(function(){return re2[_dereq_(84)("match")]=!1,$RegExp(re1)!=re1||$RegExp(re2)==re2||"/a/i"!=$RegExp(re1,"i")})||($RegExp=function(p,f){var piRE=isRegExp(p),fiU=void 0===f;return this instanceof $RegExp||!piRE||p.constructor!==$RegExp||!fiU?CORRECT_NEW?new Base(piRE&&!fiU?p.source:p,f):Base((piRE=p instanceof $RegExp)?p.source:p,piRE&&fiU?$flags.call(p):f):p},$.each.call($.getNames(Base),function(key){key in $RegExp||$.setDesc($RegExp,key,{configurable:!0,get:function(){return Base[key]},set:function(it){Base[key]=it}})}),proto.constructor=$RegExp,$RegExp.prototype=proto,_dereq_(62)(global,"RegExp",$RegExp)),_dereq_(66)("RegExp")},{21:21,25:25,27:27,30:30,40:40,47:47,62:62,66:66,84:84}],155:[function(_dereq_,module,exports){var $=_dereq_(47);_dereq_(21)&&"g"!=/./g.flags&&$.setDesc(RegExp.prototype,"flags",{configurable:!0,get:_dereq_(27)})},{21:21,27:27,47:47}],156:[function(_dereq_,module,exports){_dereq_(26)("match",1,function(defined,MATCH){return function(regexp){var O=defined(this),fn=void 0==regexp?void 0:regexp[MATCH];return void 0!==fn?fn.call(regexp,O):new RegExp(regexp)[MATCH](String(O))}})},{26:26}],157:[function(_dereq_,module,exports){_dereq_(26)("replace",2,function(defined,REPLACE,$replace){return function(searchValue,replaceValue){var O=defined(this),fn=void 0==searchValue?void 0:searchValue[REPLACE];return void 0!==fn?fn.call(searchValue,O,replaceValue):$replace.call(String(O),searchValue,replaceValue)}})},{26:26}],158:[function(_dereq_,module,exports){_dereq_(26)("search",1,function(defined,SEARCH){return function(regexp){var O=defined(this),fn=void 0==regexp?void 0:regexp[SEARCH];return void 0!==fn?fn.call(regexp,O):new RegExp(regexp)[SEARCH](String(O))}})},{26:26}],159:[function(_dereq_,module,exports){_dereq_(26)("split",2,function(defined,SPLIT,$split){return function(separator,limit){var O=defined(this),fn=void 0==separator?void 0:separator[SPLIT];return void 0!==fn?fn.call(separator,O,limit):$split.call(String(O),separator,limit)}})},{26:26}],160:[function(_dereq_,module,exports){var strong=_dereq_(13);_dereq_(16)("Set",function(get){return function(){return get(this,arguments.length>0?arguments[0]:void 0)}},{add:function(value){return strong.def(this,value=0===value?0:value,value)}},strong)},{13:13,16:16}],161:[function(_dereq_,module,exports){var $def=_dereq_(19),$at=_dereq_(71)(!1);$def($def.P,"String",{codePointAt:function(pos){return $at(this,pos)}})},{19:19,71:71}],162:[function(_dereq_,module,exports){var $def=_dereq_(19),toLength=_dereq_(80),context=_dereq_(72),ENDS_WITH="endsWith",$endsWith=""[ENDS_WITH];$def($def.P+$def.F*_dereq_(24)(ENDS_WITH),"String",{endsWith:function(searchString){var that=context(this,searchString,ENDS_WITH),$$=arguments,endPosition=$$.length>1?$$[1]:void 0,l
|
||
|
return _this._rejectInvalidComponentMatches(),_this.rejectWithoutRequiredStructure(),_this._rejectWithoutRequiredClasses(),_this.$formGroup=_this.findFormGroup(_this.config.formGroup.required),_this.$mdbFormGroup=_this.resolveMdbFormGroup(),_this.$mdbLabel=_this.resolveMdbLabel(),_this.resolveMdbFormGroupSizing(),_this.addFocusListener(),_this.addChangeListener(),_this}return babelHelpers.inherits(BaseInput,_Base),babelHelpers.createClass(BaseInput,[{key:"dispose",value:function(dataKey){babelHelpers.get(Object.getPrototypeOf(BaseInput.prototype),"dispose",this).call(this,dataKey),this.$mdbFormGroup=null,this.$formGroup=null}},{key:"rejectWithoutRequiredStructure",value:function(){}},{key:"addFocusListener",value:function(){var _this2=this;this.$element.on("focus",function(){_this2.addFormGroupFocus()}).on("blur",function(){_this2.removeFormGroupFocus()})}},{key:"addChangeListener",value:function(){var _this3=this;this.$element.on("keydown paste",function(event){Util.isChar(event)&&_this3.addIsFilled()}).on("keyup change",function(){if(_this3.isEmpty()?_this3.removeIsFilled():_this3.addIsFilled(),_this3.config.validate){var isValid="undefined"==typeof _this3.$element[0].checkValidity||_this3.$element[0].checkValidity();isValid?_this3.removeHasDanger():_this3.addHasDanger()}})}},{key:"addHasDanger",value:function(){this.$mdbFormGroup.addClass(ClassName.HAS_DANGER)}},{key:"removeHasDanger",value:function(){this.$mdbFormGroup.removeClass(ClassName.HAS_DANGER)}},{key:"isEmpty",value:function(){return null===this.$element.val()||void 0===this.$element.val()||""===this.$element.val()}},{key:"resolveMdbFormGroup",value:function(){var mfg=this.findMdbFormGroup(!1);return(void 0===mfg||0===mfg.length)&&(!this.config.mdbFormGroup.create||void 0!==this.$formGroup&&0!==this.$formGroup.length?this.$formGroup.addClass(ClassName.MDB_FORM_GROUP):this.outerElement().wrap(this.config.mdbFormGroup.template),mfg=this.findMdbFormGroup(this.config.mdbFormGroup.required)),mfg}},{key:"outerElement",value:function(){return this.$element}},{key:"resolveMdbLabel",value:function(){var label=this.$mdbFormGroup.find(Selector.MDB_LABEL_WILDCARD);return(void 0===label||0===label.length)&&(label=this.findMdbLabel(this.config.label.required),void 0===label||0===label.length||label.addClass(this.config.label.className)),label}},{key:"findMdbLabel",value:function(){var raiseError=arguments.length<=0||void 0===arguments[0]?!0:arguments[0],label=null,_iteratorNormalCompletion=!0,_didIteratorError=!1,_iteratorError=void 0;try{for(var _step,_iterator=this.config.label.selectors[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=!0){var selector=_step.value;if(label=$.isFunction(selector)?selector(this):this.$mdbFormGroup.find(selector),void 0!==label&&label.length>0)break}}catch(err){_didIteratorError=!0,_iteratorError=err}finally{try{!_iteratorNormalCompletion&&_iterator["return"]&&_iterator["return"]()}finally{if(_didIteratorError)throw _iteratorError}}return 0===label.length&&raiseError&&$.error("Failed to find "+Selector.MDB_LABEL_WILDCARD+" within form-group for "+Util.describe(this.$element)),label}},{key:"findFormGroup",value:function(){var raiseError=arguments.length<=0||void 0===arguments[0]?!0:arguments[0],fg=this.$element.closest(Selector.FORM_GROUP);return 0===fg.length&&raiseError&&$.error("Failed to find "+Selector.FORM_GROUP+" for "+Util.describe(this.$element)),fg}},{key:"resolveMdbFormGroupSizing",value:function(){if(this.config.convertInputSizeVariations)for(var inputSize in FormControlSizeMarkers)this.$element.hasClass(inputSize)&&this.$mdbFormGroup.addClass(FormControlSizeMarkers[inputSize])}},{key:"_rejectInvalidComponentMatches",value:function(){var _iteratorNormalCompletion2=!0,_didIteratorError2=!1,_iteratorError2=void 0;try{for(var _step2,_iterator2=this.config.invalidComponentMatches[Symbol.iterator]();!(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done);_iteratorNormalCompletion2=!0){var otherComponent=_step2.value;otherComponent.rejectMatch(this.constructor.name,this.$el
|
||
|
}},{key:"rippleEnd",value:function(){this.$decorator&&(this.$decorator.data("animating","off"),"off"===this.$decorator.data("mousedown")&&this.rippleOut(this.$decorator))}},{key:"rippleOut",value:function(){var _this3=this;this.$decorator.off(),Util.transitionEndSupported()?this.$decorator.addClass("ripple-out"):this.$decorator.animate({opacity:0},100,function(){_this3.$decorator.trigger("transitionend")}),this.$decorator.on(Util.transitionEndSelector(),function(){_this3.$decorator&&(_this3.$decorator.remove(),_this3.$decorator=null)})}},{key:"rippleOn",value:function(){var _this4=this,size=this._getNewSize();Util.transitionEndSupported()?this.$decorator.css({"-ms-transform":"scale("+size+")","-moz-transform":"scale("+size+")","-webkit-transform":"scale("+size+")",transform:"scale("+size+")"}).addClass("ripple-on").data("animating","on").data("mousedown","on"):this.$decorator.animate({width:2*Math.max(this.$element.outerWidth(),this.$element.outerHeight()),height:2*Math.max(this.$element.outerWidth(),this.$element.outerHeight()),"margin-left":-1*Math.max(this.$element.outerWidth(),this.$element.outerHeight()),"margin-top":-1*Math.max(this.$element.outerWidth(),this.$element.outerHeight()),opacity:.2},this.config.duration,function(){_this4.$decorator.trigger("transitionend")})}},{key:"_getNewSize",value:function(){return Math.max(this.$element.outerWidth(),this.$element.outerHeight())/this.$decorator.outerWidth()*2.5}}],[{key:"_jQueryInterface",value:function(config){return this.each(function(){var $element=$(this),data=$element.data(DATA_KEY);data||(data=new Ripples($element,config),$element.data(DATA_KEY,data))})}}]),Ripples}();return $.fn[JQUERY_NAME]=Ripples._jQueryInterface,$.fn[JQUERY_NAME].Constructor=Ripples,$.fn[JQUERY_NAME].noConflict=function(){return $.fn[JQUERY_NAME]=JQUERY_NO_CONFLICT,Ripples._jQueryInterface},Ripples}(jQuery),function($){var NAME="autofill",DATA_KEY="mdb."+NAME,JQUERY_NAME="mdb"+(NAME.charAt(0).toUpperCase()+NAME.slice(1)),JQUERY_NO_CONFLICT=$.fn[JQUERY_NAME],Default={},Autofill=function(_Base){function Autofill($element,config){babelHelpers.classCallCheck(this,Autofill);var _this=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(Autofill).call(this,$element,$.extend(!0,{},Default,config)));return _this._watchLoading(),_this._attachEventHandlers(),_this}return babelHelpers.inherits(Autofill,_Base),babelHelpers.createClass(Autofill,[{key:"dispose",value:function(){babelHelpers.get(Object.getPrototypeOf(Autofill.prototype),"dispose",this).call(this,DATA_KEY)}},{key:"_watchLoading",value:function(){var _this2=this;setTimeout(function(){clearInterval(_this2._onLoading)},1e4)}},{key:"_onLoading",value:function(){setInterval(function(){$("input[type!=checkbox]").each(function(index,element){var $element=$(element);$element.val()&&$element.val()!==$element.attr("value")&&$element.trigger("change")})},100)}},{key:"_attachEventHandlers",value:function(){var focused=null;$(document).on("focus","input",function(event){var $inputs=$(event.currentTarget).closest("form").find("input").not("[type=file]");focused=setInterval(function(){$inputs.each(function(index,element){var $element=$(element);$element.val()!==$element.attr("value")&&$element.trigger("change")})},100)}).on("blur",".form-group input",function(){clearInterval(focused)})}}],[{key:"_jQueryInterface",value:function(config){return this.each(function(){var $element=$(this),data=$element.data(DATA_KEY);data||(data=new Autofill($element,config),$element.data(DATA_KEY,data))})}}]),Autofill}(Base);return $.fn[JQUERY_NAME]=Autofill._jQueryInterface,$.fn[JQUERY_NAME].Constructor=Autofill,$.fn[JQUERY_NAME].noConflict=function(){return $.fn[JQUERY_NAME]=JQUERY_NO_CONFLICT,Autofill._jQueryInterface},Autofill}(jQuery),function($){var NAME="bootstrapMaterialDesign",DATA_KEY="mdb."+NAME,JQUERY_NAME=NAME,JQUERY_NO_CONFLICT=$.fn[JQUERY_NAME],Default={global:{validate:!1,label:{className:"mdb-label-static"}},autofill:{selector:"body"},checkbox:{selector:".checkbox > label > input[type=checkbox]"},checkboxInline:{selector:"label.checkbox-inlin
|