UNPKG

material-components-vue

Version:
2 lines 10.9 kB
/*! 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 n={},t.m=e={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 a})),n.d(e,"d",(function(){return u}));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 a(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 u(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(a(arguments[e]));return t}},2: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}))},3:function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=(Object.defineProperty(i,"cssClasses",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(i,"strings",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(i,"numbers",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(i,"defaultAdapter",{get:function(){return{}},enumerable:!0,configurable:!0}),i.prototype.init=function(){},i.prototype.destroy=function(){},i);function i(t){void 0===t&&(t={}),this.adapter_=t}},38:function(t,e,n){},4:function(t,e,n){"use strict";function r(t,e,n,r,i,o,s,a){var u,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?(u=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=u):i&&(u=a?function(){i.call(this,this.$root.$options.shadowRoot)}:i),u)if(c.functional){c._injectStyles=u;var l=c.render;c.render=function(t,e){return u.call(e),l(t,e)}}else{var d=c.beforeCreate;c.beforeCreate=d?[].concat(d,u):[u]}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(3),o=(s.attachTo=function(t){return new s(t,new i.a({}))},s.prototype.initialize=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},s.prototype.getDefaultFoundation=function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")},s.prototype.initialSyncWithDOM=function(){},s.prototype.destroy=function(){this.foundation_.destroy()},s.prototype.listen=function(t,e,n){this.root_.addEventListener(t,e,n)},s.prototype.unlisten=function(t,e,n){this.root_.removeEventListener(t,e,n)},s.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)},s);function s(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()}},69:function(t,e,n){"use strict";n.r(e);var r,i=n(0),o=n(5),s=n(3),a={TILES_SELECTOR:".mdc-grid-list__tiles",TILE_SELECTOR:".mdc-grid-tile"},u=(r=s.a,i.b(c,r),Object.defineProperty(c,"strings",{get:function(){return a},enumerable:!0,configurable:!0}),Object.defineProperty(c,"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}),c.prototype.init=function(){this.alignCenter(),this.adapter_.registerResizeHandler(this.resizeHandler_)},c.prototype.destroy=function(){this.adapter_.deregisterResizeHandler(this.resizeHandler_)},c.prototype.alignCenter=function(){var t=this;cancelAnimationFrame(this.resizeFrame_),this.resizeFrame_=requestAnimationFrame((function(){t.alignCenter_(),t.resizeFrame_=0}))},c.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")}},c);function c(t){var e=r.call(this,i.a({},c.defaultAdapter,t))||this;return e.resizeFrame_=0,e.resizeHandler_=e.alignCenter.bind(e),e}var l,d=(l=o.a,i.b(f,l),f.attachTo=function(t){return new f(t)},f.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}})},f);function f(){return null!==l&&l.apply(this,arguments)||this}var p=n(2);function h(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function y(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var m={mixins:[p.a,p.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]:{};e%2?h(n,!0).forEach((function(e){y(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):h(n).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},t,{},e)}},mounted:function(){this.mdcGridList=d.attachTo(this.$el)},beforeDestroy:function(){this.mdcGridList.destroy()}},g=n(4),_=Object(g.a)(m,(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,b={mixins:[p.a,p.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")}))}}},v=Object(g.a)(b,(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,O=(n(38),n(7)),x={install:function(t){t.component("m-grid-list",_),t.component("m-grid-tile",v)}};e.default=x,Object(O.a)(x)},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}))}},t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var i in e)t.d(r,i,function(t){return e[t]}.bind(null,i));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},t.p="",t(t.s=69);function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var e,n}));