material-components-vue
Version:
Material Design components for Vue.js
2 lines • 10.7 kB
JavaScript
/*! For license information please see grid-list.min.js.LICENSE */
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(window,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=69)}({0:function(t,e,n){"use strict";n.d(e,"b",function(){return i}),n.d(e,"a",function(){return o}),n.d(e,"e",function(){return s}),n.d(e,"c",function(){return u}),n.d(e,"d",function(){return a});var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function i(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var o=function(){return(o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function s(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}function u(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function a(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(u(arguments[e]));return t}},1:function(t,e,n){"use strict";var r={inheritAttrs:!1},i=["primary","secondary","background","surface","on-primary","on-secondary","on-surface","primary-bg","secondary-bg","text-primary-on-light","text-secondary-on-light","text-hint-on-light","text-disabled-on-light","text-icon-on-light","text-primary-on-dark","text-secondary-on-dark","text-hint-on-dark","text-disabled-on-dark","text-icon-on-dark"],o={props:{theming:{type:String,default:""}},mounted:function(){-1<i.indexOf(this.theming)&&this.$el.classList.add("mdc-theme--"+this.theming)}};n.d(e,"a",function(){return r}),n.d(e,"b",function(){return o})},2:function(t,e,n){"use strict";n.d(e,"a",function(){return r});var r=function(){function t(t){void 0===t&&(t={}),this.adapter_=t}return Object.defineProperty(t,"cssClasses",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(t,"strings",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(t,"numbers",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(t,"defaultAdapter",{get:function(){return{}},enumerable:!0,configurable:!0}),t.prototype.init=function(){},t.prototype.destroy=function(){},t}()},37:function(t,e,n){},4:function(t,e,n){"use strict";function r(t,e,n,r,i,o,s,u){var a,c="function"==typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=n,c._compiled=!0),r&&(c.functional=!0),o&&(c._scopeId="data-v-"+o),s?(a=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},c._ssrRegister=a):i&&(a=u?function(){i.call(this,this.$root.$options.shadowRoot)}:i),a)if(c.functional){c._injectStyles=a;var l=c.render;c.render=function(t,e){return a.call(e),l(t,e)}}else{var d=c.beforeCreate;c.beforeCreate=d?[].concat(d,a):[a]}return{exports:t,options:c}}n.d(e,"a",function(){return r})},5:function(t,e,n){"use strict";n.d(e,"a",function(){return o});var r=n(0),i=n(2),o=function(){function t(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];this.root_=t,this.initialize.apply(this,r.d(n)),this.foundation_=void 0===e?this.getDefaultFoundation():e,this.foundation_.init(),this.initialSyncWithDOM()}return t.attachTo=function(e){return new t(e,new i.a({}))},t.prototype.initialize=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},t.prototype.getDefaultFoundation=function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")},t.prototype.initialSyncWithDOM=function(){},t.prototype.destroy=function(){this.foundation_.destroy()},t.prototype.listen=function(t,e){this.root_.addEventListener(t,e)},t.prototype.unlisten=function(t,e){this.root_.removeEventListener(t,e)},t.prototype.emit=function(t,e,n){var r;void 0===n&&(n=!1),"function"==typeof CustomEvent?r=new CustomEvent(t,{bubbles:n,detail:e}):(r=document.createEvent("CustomEvent")).initCustomEvent(t,n,!1,e),this.root_.dispatchEvent(r)},t}()},69:function(t,e,n){"use strict";n.r(e);var r=n(0),i=n(5),o=n(2),s={TILES_SELECTOR:".mdc-grid-list__tiles",TILE_SELECTOR:".mdc-grid-tile"},u=function(t){function e(n){var i=t.call(this,r.a({},e.defaultAdapter,n))||this;return i.resizeFrame_=0,i.resizeHandler_=i.alignCenter.bind(i),i}return r.b(e,t),Object.defineProperty(e,"strings",{get:function(){return s},enumerable:!0,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{deregisterResizeHandler:function(){},getNumberOfTiles:function(){return 0},getOffsetWidth:function(){return 0},getOffsetWidthForTileAtIndex:function(){return 0},registerResizeHandler:function(){},setStyleForTilesElement:function(){}}},enumerable:!0,configurable:!0}),e.prototype.init=function(){this.alignCenter(),this.adapter_.registerResizeHandler(this.resizeHandler_)},e.prototype.destroy=function(){this.adapter_.deregisterResizeHandler(this.resizeHandler_)},e.prototype.alignCenter=function(){var t=this;cancelAnimationFrame(this.resizeFrame_),this.resizeFrame_=requestAnimationFrame(function(){t.alignCenter_(),t.resizeFrame_=0})},e.prototype.alignCenter_=function(){if(0!==this.adapter_.getNumberOfTiles()){var t=this.adapter_.getOffsetWidth(),e=this.adapter_.getOffsetWidthForTileAtIndex(0),n=e*Math.floor(t/e);this.adapter_.setStyleForTilesElement("width",n+"px")}},e}(o.a),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.b(e,t),e.attachTo=function(t){return new e(t)},e.prototype.getDefaultFoundation=function(){var t=this;return new u({deregisterResizeHandler:function(t){return window.removeEventListener("resize",t)},getNumberOfTiles:function(){return t.root_.querySelectorAll(u.strings.TILE_SELECTOR).length},getOffsetWidth:function(){return t.root_.offsetWidth},getOffsetWidthForTileAtIndex:function(e){return t.root_.querySelectorAll(u.strings.TILE_SELECTOR)[e].offsetWidth},registerResizeHandler:function(t){return window.addEventListener("resize",t)},setStyleForTilesElement:function(e,n){t.root_.querySelector(u.strings.TILES_SELECTOR).style[e]=n}})},e}(i.a),c=n(1),l={mixins:[c.a,c.b],props:{headerCaption:{type:Boolean,required:!1},smallGutter:{type:Boolean,required:!1},twolineCaption:{type:Boolean,required:!1},startIcon:{type:Boolean,required:!1},endIcon:{type:Boolean,required:!1},ratio:{type:String,validator:function(t){return-1<["1x1","16x9","2x3","3x2","4x3","3x4"].indexOf(t)},default:"1x1"}},data:function(){return{mdcGridList:void 0}},computed:{classes:function(){var t={"mdc-grid-list--header-caption":this.headerCaption,"mdc-grid-list--tile-gutter-1":this.smallGutter,"mdc-grid-list--twoline-caption":this.twolineCaption,"mdc-grid-list--with-icon-align-start":this.startIcon,"mdc-grid-list--with-icon-align-end":this.endIcon},e={};return this.ratio&&(e["mdc-grid-list--tile-aspect-"+this.ratio]=!0),function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.forEach(function(e){var r,i,o;r=t,o=n[i=e],i in r?Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[i]=o})}return t}({},t,e)}},mounted:function(){this.mdcGridList=a.attachTo(this.$el)},beforeDestroy:function(){this.mdcGridList.destroy()}},d=n(4),f=Object(d.a)(l,function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"mdc-grid-list",class:this.classes},[e("ul",{staticClass:"mdc-grid-list__tiles"},[this._t("default")],2)])},[],!1,null,null,null).exports,p={mixins:[c.a,c.b],props:{imgSrc:{type:String,default:""}},data:function(){return{slotObserver:void 0}},mounted:function(){var t=this;this.updateSlots(),this.slotObserver=new MutationObserver(function(){return t.updateSlots()}),this.slotObserver.observe(this.$el,{childList:!0,subtree:!0})},methods:{updateSlots:function(){this.$slots.supporttext&&this.$slots.supporttext.map(function(t){return t.elm.classList.add("mdc-grid-tile__support-text")}),this.$slots.icon&&this.$slots.icon.map(function(t){t.elm.classList.add("mdc-grid-tile__icon")}),this.$slots.primary&&this.$slots.primary.map(function(t){return t.elm.classList.add("mdc-grid-tile__primary-content")})}}},h=Object(d.a)(p,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("li",t._g({staticClass:"mdc-grid-tile"},t.$listeners),[n("div",{staticClass:"mdc-grid-tile__primary"},[t._t("primary",[t.imgSrc?n("img",{staticClass:"mdc-grid-tile__primary-content",attrs:{src:t.imgSrc}}):t._e()])],2),t._v(" "),t.$slots.default?n("span",{staticClass:"mdc-grid-tile__secondary"},[n("span",{staticClass:"mdc-grid-tile__title"},[t._t("default")],2),t._v(" "),t._t("icon"),t._v(" "),t._t("supporttext")],2):t._e()])},[],!1,null,null,null).exports,m=(n(37),n(7)),y={install:function(t){t.component("m-grid-list",f),t.component("m-grid-tile",h)}};e.default=y,Object(m.a)(y)},7:function(t,e,n){"use strict";function r(t){"undefined"!=typeof window&&window.Vue&&window.Vue.use(t)}n.d(e,"a",function(){return r})}})});