UNPKG

@material/grid-list

Version:
1 lines 6.84 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.gridList=e():(t.mdc=t.mdc||{},t.mdc.gridList=e())}(this,function(){return r={},o.m=n={0:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=(Object.defineProperty(o,"cssClasses",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(o,"strings",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(o,"numbers",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(o,"defaultAdapter",{get:function(){return{}},enumerable:!0,configurable:!0}),o.prototype.init=function(){},o.prototype.destroy=function(){},o);function o(t){void 0===t&&(t={}),this.adapter_=t}e.MDCFoundation=r,e.default=r},1:function(t,e,n){"use strict";var r=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),u=[];try{for(;(void 0===e||0<e--)&&!(r=i.next()).done;)u.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u},o=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(r(arguments[e]));return t};Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),u=(s.attachTo=function(t){return new s(t,new i.MDCFoundation({}))},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=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];this.root_=t,this.initialize.apply(this,o(n)),this.foundation_=void 0===e?this.getDefaultFoundation():e,this.foundation_.init(),this.initialSyncWithDOM()}e.MDCComponent=u,e.default=u},129:function(t,n,e){"use strict";function r(t){for(var e in t)n.hasOwnProperty(e)||(n[e]=t[e])}Object.defineProperty(n,"__esModule",{value:!0}),r(e(130)),r(e(74)),r(e(73))},130:function(t,e,n){"use strict";var r,o=this&&this.__extends||(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(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i,u=n(1),s=n(73),a=(i=u.MDCComponent,o(f,i),f.attachTo=function(t){return new f(t)},f.prototype.getDefaultFoundation=function(){var n=this,t={deregisterResizeHandler:function(t){return window.removeEventListener("resize",t)},getNumberOfTiles:function(){return n.root_.querySelectorAll(s.MDCGridListFoundation.strings.TILE_SELECTOR).length},getOffsetWidth:function(){return n.root_.offsetWidth},getOffsetWidthForTileAtIndex:function(t){return n.root_.querySelectorAll(s.MDCGridListFoundation.strings.TILE_SELECTOR)[t].offsetWidth},registerResizeHandler:function(t){return window.addEventListener("resize",t)},setStyleForTilesElement:function(t,e){n.root_.querySelector(s.MDCGridListFoundation.strings.TILES_SELECTOR).style[t]=e}};return new s.MDCGridListFoundation(t)},f);function f(){return null!==i&&i.apply(this,arguments)||this}e.MDCGridList=a},73:function(t,e,n){"use strict";var r,o=this&&this.__extends||(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(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var u,s=n(0),a=n(74),f=(u=s.MDCFoundation,o(c,u),Object.defineProperty(c,"strings",{get:function(){return a.strings},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=u.call(this,i({},c.defaultAdapter,t))||this;return e.resizeFrame_=0,e.resizeHandler_=e.alignCenter.bind(e),e}e.MDCGridListFoundation=f,e.default=f},74:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.strings={TILES_SELECTOR:".mdc-grid-list__tiles",TILE_SELECTOR:".mdc-grid-tile"}}},o.c=r,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=129);function o(t){if(r[t])return r[t].exports;var e=r[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,o),e.l=!0,e.exports}var n,r});