From bcea0b2a29f2acbbb49b3483cd828fe44f90ef24 Mon Sep 17 00:00:00 2001 From: Ben Rubin Date: Mon, 24 Oct 2016 23:56:46 -0500 Subject: [PATCH] new version --- bower.json | 2 +- dist/md-expansion-panel.js | 40 ++++++++++++++++++++++++++++++++++ dist/md-expansion-panel.min.js | 2 +- package.json | 2 +- 4 files changed, 43 insertions(+), 3 deletions(-) diff --git a/bower.json b/bower.json index ce4cc92..abbf0bd 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-material-expansion-panel", - "version": "0.6.2", + "version": "0.7.0", "description": "Material Design Expansion Panels.", "main": [ "dist/md-expansion-panel.js", diff --git a/dist/md-expansion-panel.js b/dist/md-expansion-panel.js index e0d98d9..839ba6a 100644 --- a/dist/md-expansion-panel.js +++ b/dist/md-expansion-panel.js @@ -852,8 +852,11 @@ function expansionPanelGroupDirective() { $element: $element, register: register, getRegistered: getRegistered, + getAll: getAll, + getOpen: getOpen, remove: remove, removeAll: removeAll, + collapseAll: collapseAll, onChange: onChange, count: panelCount }, $attrs.mdComponentId); @@ -949,6 +952,28 @@ function expansionPanelGroupDirective() { } return registered[name]; } + + + function getAll() { + return Object.keys(panels).map(function (panelId) { + return panels[panelId]; + }); + } + + function getOpen() { + return Object.keys(panels).map(function (panelId) { + return panels[panelId]; + }).filter(function (instance) { + return instance.isOpen(); + }); + } + + function collapseAll(noAnimation) { + var animation = noAnimation === true ? false : true; + Object.keys(panels).forEach(function (panelId) { + panels[panelId].collapse({animation: animation}); + }); + } } } }()); @@ -1027,8 +1052,11 @@ function expansionPanelGroupService($mdComponentRegistry, $mdUtil, $mdExpansionP var service = { add: add, register: register, + getAll: getAll, + getOpen: getOpen, remove: remove, removeAll: removeAll, + collapseAll: collapseAll, onChange: onChange, count: count }; @@ -1061,6 +1089,18 @@ function expansionPanelGroupService($mdComponentRegistry, $mdUtil, $mdExpansionP return instance.count(); } + function getAll() { + return instance.getAll(); + } + + function getOpen() { + return instance.getOpen(); + } + + function collapseAll(noAnimation) { + instance.collapseAll(noAnimation); + } + function add(options, locals) { locals = locals || {}; diff --git a/dist/md-expansion-panel.min.js b/dist/md-expansion-panel.min.js index 8062c3d..4a1b83e 100644 --- a/dist/md-expansion-panel.min.js +++ b/dist/md-expansion-panel.min.js @@ -1 +1 @@ -!function(){"use strict";angular.module("material.components.expansionPanels",["material.core"])}(),function(){"use strict";angular.module("material.components.expansionPanels").run(["$templateCache",function(n){n.put("icons/ic_keyboard_arrow_right_black_24px.svg",'\n \n \n')}])}(),function(){"use strict";function n(){function n(n,e){var o="Invalid HTML for md-expansion-panel: ";if(n.attr("tabindex",e.tabindex||"0"),null===n[0].querySelector("md-expansion-panel-collapsed"))throw Error(o+"Expected a child element of `md-epxansion-panel-collapsed`");if(null===n[0].querySelector("md-expansion-panel-expanded"))throw Error(o+"Expected a child element of `md-epxansion-panel-expanded`");return function(n,e,o,t){var i=t[0],r=t[1];i.epxansionPanelGroupCtrl=r||void 0,i.init()}}function o(n,o,t,i,r,a,s,c,l,d,u,m){function p(n){var e=a.KEY_CODE;switch(n.keyCode){case e.ENTER:g();break;case e.ESCAPE:x()}}function f(){M=!0,W===!0&&v()}function v(){return M===!1?void(W=!0):("function"==typeof j&&(j(),j=void 0),F.componentId&&F.epxansionPanelGroupCtrl&&F.epxansionPanelGroupCtrl.removePanel(F.componentId),void 0===t.mdComponentId&&t.$set("mdComponentId","_expansion_panel_id_"+s.nextUid()),F.componentId=t.mdComponentId,j=c.register({expand:g,collapse:x,remove:C,onRemove:$,isOpen:h,addClickCatcher:S,removeClickCatcher:_,componentId:t.mdComponentId},t.mdComponentId),void(F.epxansionPanelGroupCtrl&&F.epxansionPanelGroupCtrl.addPanel(F.componentId,{expand:g,collapse:x,remove:C,onRemove:$,destroy:E,isOpen:h})))}function h(){return D}function g(n){if(D!==!0&&L!==!0){D=!0,n=n||{};var t=d.defer();return F.epxansionPanelGroupCtrl&&F.epxansionPanelGroupCtrl.expandPanel(F.componentId),o.removeClass("md-close"),o.addClass("md-open"),n.animation===!1?o.addClass("md-no-animation"):o.removeClass("md-no-animation"),w(),G.hide(n),N.show(n),q&&q.show(n),H&&H.show(n),l(function(){t.resolve()},n.animation===!1?0:e),t.promise}}function x(n){if(D!==!1){D=!1,n=n||{};var t=d.defer();return o.addClass("md-close"),o.removeClass("md-open"),n.animation===!1?o.addClass("md-no-animation"):o.removeClass("md-no-animation"),P(),G.show(n),N.hide(n),q&&q.hide(n),H&&H.hide(n),l(function(){t.resolve()},n.animation===!1?0:e),t.promise}}function C(t){t=t||{};var i=d.defer();return F.epxansionPanelGroupCtrl&&F.epxansionPanelGroupCtrl.removePanel(F.componentId),"function"==typeof j&&(j(),j=void 0),t.animation===!1||D===!1?(n.$destroy(),o.remove(),i.resolve(),y()):(x(),l(function(){n.$destroy(),o.remove(),i.resolve(),y()},e)),i.promise}function $(n){U=n}function y(){"function"==typeof U&&(U(),U=void 0)}function E(){n.$destroy()}function w(){(H&&H.noSticky!==!0||q&&q.noSticky!==!0)&&(O=n.$watch(function(){return o[0].offsetTop},K,!0),B=n.$watch(function(){return o[0].offsetWidth},Y,!0),z=s.getNearestContentElement(o),"MD-CONTENT"===z.nodeName?(A=k(z),angular.element(z).on("scroll",K)):A=void 0,N.setHeight===!0&&N.$element.on("scroll",K),angular.element(i).on("scroll",K).on("resize",K).on("resize",Y))}function P(){"function"==typeof O&&(O(),O=void 0),"function"==typeof B&&(B(),B=void 0),z&&"MD-CONTENT"===z.nodeName&&angular.element(z).off("scroll",K),N.setHeight===!0&&N.$element.off("scroll",K),angular.element(i).off("scroll",K).off("resize",K).off("resize",Y)}function k(n){for(var e=n.parentNode;e&&e!==document;){if(b(e,"transform"))return e;e=e.parentNode}}function b(n,e){var o=!1;if(n){var t=i.getComputedStyle(n);o=void 0!==t[e]&&"none"!==t[e]}return o}function I(n){var e,o,t;t=N.setHeight===!0?N.$element[0].getBoundingClientRect():z.getBoundingClientRect();var i=A?A.getBoundingClientRect().top:0;e=Math.max(t.top,0),o=e+t.height,H&&H.noSticky===!1&&H.onScroll(e,o,i),q&&q.noSticky===!1&&q.onScroll(e,o,i)}function R(){var n=o[0].offsetWidth;H&&H.noSticky===!1&&H.onResize(n),q&&q.noSticky===!1&&q.onResize(n)}function S(e){T=s.createBackdrop(n),T[0].tabIndex=-1,"function"==typeof e&&T.on("click",e),u.enter(T,o.parent(),null,{duration:0}),o.css("z-index",60)}function _(){T&&(T.remove(),T.off("click"),T=void 0,o.css("z-index",""))}var G,N,q,H,j,z,O,B,U,A,T,F=this,M=!1,W=!1,D=!1,L=!1,K=r.throttle(I),Y=r.throttle(R);F.registerCollapsed=function(n){G=n},F.registerExpanded=function(n){N=n},F.registerHeader=function(n){q=n},F.registerFooter=function(n){H=n},void 0===t.mdComponentId?(t.$set("mdComponentId","_expansion_panel_id_"+s.nextUid()),v()):t.$observe("mdComponentId",function(){v()}),F.$element=o,F.expand=g,F.collapse=x,F.remove=C,F.destroy=E,F.onRemove=$,F.init=f,t.$observe("disabled",function(n){L="string"==typeof n&&"false"!==n,L===!0?o.attr("tabindex","-1"):o.attr("tabindex","0")}),o.on("focus",function(n){o.on("keydown",p)}).on("blur",function(n){o.off("keydown",p)}),n.$panel={collapse:x,expand:g,remove:C,isOpen:h},n.$on("$destroy",function(){_(),"function"==typeof j&&(j(),j=void 0),P()})}var t={restrict:"E",require:["mdExpansionPanel","?^^mdExpansionPanelGroup"],scope:!0,compile:n,controller:["$scope","$element","$attrs","$window","$$rAF","$mdConstant","$mdUtil","$mdComponentRegistry","$timeout","$q","$animate","$parse",o]};return t}angular.module("material.components.expansionPanels").directive("mdExpansionPanel",n);var e=180}(),function(){"use strict";function n(n,e,o){function t(t){var i=n.get(t);return i?i:void o.error(e.supplant(r,[t||""]))}function i(e){return n.when(e)["catch"](o.error)}var r="ExpansionPanel '{0}' is not available! Did you use md-component-id='{0}'?",a={find:t,waitFor:i};return function(n){return void 0===n?a:t(n)}}angular.module("material.components.expansionPanels").factory("$mdExpansionPanel",n),n.$inject=["$mdComponentRegistry","$mdUtil","$log"]}(),function(){"use strict";function n(n,e){function o(o,t,i,r){function a(e){t.css("width",t[0].offsetWidth+"px"),r.$element.css("min-height",t[0].offsetHeight+"px");var o={addClass:"md-absolute md-hide",from:{opacity:1},to:{opacity:0}};e.animation===!1&&(o.duration=0),n(t,o).start().then(function(){t.removeClass("md-hide"),t.css("display","none")})}function s(o){t.css("display",""),t.css("width",t[0].parentNode.offsetWidth+"px");var i={addClass:"md-show",from:{opacity:0},to:{opacity:1}};o.animation===!1&&(i.duration=0),n(t,i).start().then(function(){r.$element.css("transition","none"),t.removeClass("md-absolute md-show"),t.css("width",""),r.$element.css("min-height",""),e(function(){r.$element.css("transition","")},0)})}r.registerCollapsed({show:s,hide:a}),t.on("click",function(){r.expand()})}var t={restrict:"E",require:"^^mdExpansionPanel",link:o};return t}angular.module("material.components.expansionPanels").directive("mdExpansionPanelCollapsed",n),n.$inject=["$animateCss","$timeout"]}(),function(){"use strict";function n(n,e){function o(o,t,i,r){function a(e){var o=c?c:t[0].scrollHeight+"px";t.addClass("md-hide md-overflow"),t.removeClass("md-show md-scroll-y");var i={from:{"max-height":o,opacity:1},to:{"max-height":"48px",opacity:0}};e.animation===!1&&(i.duration=0),n(t,i).start().then(function(){t.css("display","none"),t.removeClass("md-hide")})}function s(o){t.css("display",""),t.addClass("md-show md-overflow");var i=c?c:t[0].scrollHeight+"px",r={from:{"max-height":"48px",opacity:0},to:{"max-height":i,opacity:1}};o.animation===!1&&(r.duration=0),n(t,r).start().then(function(){void 0!==c?t.addClass("md-scroll-y"):(t.css("transition","none"),t.css("max-height","none"),e(function(){t.css("transition","")},0)),t.removeClass("md-overflow")})}var c=i.height||void 0;void 0!==c&&(c=c.replace("px","")+"px"),r.registerExpanded({show:s,hide:a,setHeight:void 0!==c,$element:t})}var t={restrict:"E",require:"^^mdExpansionPanel",link:o};return t}angular.module("material.components.expansionPanels").directive("mdExpansionPanelExpanded",n),n.$inject=["$animateCss","$timeout"]}(),function(){"use strict";function n(){function n(n,e,o,t){function i(){}function r(){c()}function a(n,o,i){var r,a,s=e[0].getBoundingClientRect();s.bottom>o?(r=u[0].offsetHeight,a=o-r-i,a',require:"^^mdExpansionPanel",link:n};return e}angular.module("material.components.expansionPanels").directive("mdExpansionPanelFooter",n)}(),function(){"use strict";function n(){function n(n,e,o,t){function i(n){return C.push(n),function(){C.splice(C.indexOf(n),1)}}function r(){var n=u();C.forEach(function(e){e(n)})}function a(n,e){x[n]=e,y===!0&&(e.expand(),m(n)),r()}function s(n){m(n)}function c(n,e){return x[n].remove(e)}function l(n){Object.keys(x).forEach(function(e){x[e].remove(n)})}function d(n){delete x[n],r()}function u(){return Object.keys(x).length}function m(n){$===!1&&Object.keys(x).forEach(function(e){e!==n&&x[e].collapse()})}function p(n,e){if(void 0!==g[n])throw Error('$mdExpansionPanelGroup.register() The name "'+n+'" has already been registered');g[n]=e}function f(n){if(void 0===g[n])throw Error('$mdExpansionPanelGroup.addPanel() Cannot find Panel with name of "'+n+'"');return g[n]}var v,h=this,g={},x={},C=[],$=void 0!==e.mdMultiple||void 0!==e.multiple,y=void 0!==e.mdAutoExpand||void 0!==e.autoExpand;v=t.register({$element:o,register:p,getRegistered:f,remove:c,removeAll:l,onChange:i,count:u},e.mdComponentId),h.addPanel=a,h.expandPanel=s,h.removePanel=d,n.$on("$destroy",function(){"function"==typeof v&&(v(),v=void 0),Object.keys(x).forEach(function(n){x[n].destroy()})})}var e={restrict:"E",controller:["$scope","$attrs","$element","$mdComponentRegistry",n]};return e}angular.module("material.components.expansionPanels").directive("mdExpansionPanelGroup",n)}(),function(){"use strict";function n(n,e,o,t,i,r,a,s,c){function l(o){var t=n.get(o);return t?u(t):void c.error(e.supplant(m,[o||""]))}function d(e){var o=s.defer();return n.when(e).then(function(n){o.resolve(u(n))})["catch"](function(n){o.reject(),c.error(n)}),o.promise}function u(n){function c(e,o){if("string"!=typeof e)throw Error("$mdExpansionPanelGroup.register() Expects name to be a string");f(o),n.register(e,o)}function l(e,o){return n.remove(e,o)}function d(e){n.removeAll(e)}function u(e){return n.onChange(e)}function m(){return n.count()}function p(t,c){if(c=c||{},"string"==typeof t)return p(n.getRegistered(t),c);if(f(t),t.componentId&&n.isPanelActive(t.componentId))return s.reject('panel with componentId "'+t.componentId+'" is currently active');var l=s.defer(),d=i.$new();return angular.extend(d,t.scope),v(t,function(i){var s=angular.element(i),u=t.componentId||s.attr("md-component-id")||"_panelComponentId_"+e.nextUid(),m=o().waitFor(u);s.attr("md-component-id",u);var p=r(s);if(t.controller){angular.extend(c,t.locals||{}),c.$scope=d,c.$panel=m;var f=a(t.controller,c,!0),v=f();s.data("$ngControllerController",v),s.children().data("$ngControllerController",v),t.controllerAs&&(d[t.controllerAs]=v)}n.$element.append(s),p(d),m.then(function(n){l.resolve(n)})}),l.promise}function f(n){if("object"!=typeof n||null===n)throw Error("$mdExapnsionPanelGroup.add()/.register() : Requires an options object to be passed in");if(!n.template&&!n.templateUrl)throw Error("$mdExapnsionPanelGroup.add()/.register() : Is missing required paramters to create. Required One of the following: template, templateUrl")}function v(n,e){void 0!==n.templateUrl?t(n.templateUrl).then(function(n){e(n)}):e(n.template)}var h={add:p,register:c,remove:l,removeAll:d,onChange:u,count:m};return h}var m="ExpansionPanelGroup '{0}' is not available! Did you use md-component-id='{0}'?",p={find:l,waitFor:d};return function(n){return void 0===n?p:l(n)}}angular.module("material.components.expansionPanels").factory("$mdExpansionPanelGroup",n),n.$inject=["$mdComponentRegistry","$mdUtil","$mdExpansionPanel","$templateRequest","$rootScope","$compile","$controller","$q","$log"]}(),function(){"use strict";function n(){function n(n,e,o,t){function i(){}function r(){c()}function a(n,o,t){var i,r,a=e[0].getBoundingClientRect();a.top',require:"^^mdExpansionPanel",link:n};return e}angular.module("material.components.expansionPanels").directive("mdExpansionPanelHeader",n),n.$inject=[]}(),function(){"use strict";function n(){var n={restrict:"E",template:'',replace:!0};return n}angular.module("material.components.expansionPanels").directive("mdExpansionPanelIcon",n)}(); \ No newline at end of file +!function(){"use strict";angular.module("material.components.expansionPanels",["material.core"])}(),function(){"use strict";angular.module("material.components.expansionPanels").run(["$templateCache",function(n){n.put("icons/ic_keyboard_arrow_right_black_24px.svg",'\n \n \n')}])}(),function(){"use strict";function n(){function n(n,e){var t="Invalid HTML for md-expansion-panel: ";if(n.attr("tabindex",e.tabindex||"0"),null===n[0].querySelector("md-expansion-panel-collapsed"))throw Error(t+"Expected a child element of `md-epxansion-panel-collapsed`");if(null===n[0].querySelector("md-expansion-panel-expanded"))throw Error(t+"Expected a child element of `md-epxansion-panel-expanded`");return function(n,e,t,o){var i=o[0],r=o[1];i.epxansionPanelGroupCtrl=r||void 0,i.init()}}function t(n,t,o,i,r,a,s,c,l,d,u,p){function m(n){var e=a.KEY_CODE;switch(n.keyCode){case e.ENTER:g();break;case e.ESCAPE:x()}}function f(){M=!0,W===!0&&v()}function v(){return M===!1?void(W=!0):("function"==typeof q&&(q(),q=void 0),F.componentId&&F.epxansionPanelGroupCtrl&&F.epxansionPanelGroupCtrl.removePanel(F.componentId),void 0===o.mdComponentId&&o.$set("mdComponentId","_expansion_panel_id_"+s.nextUid()),F.componentId=o.mdComponentId,q=c.register({expand:g,collapse:x,remove:C,onRemove:$,isOpen:h,addClickCatcher:S,removeClickCatcher:_,componentId:o.mdComponentId},o.mdComponentId),void(F.epxansionPanelGroupCtrl&&F.epxansionPanelGroupCtrl.addPanel(F.componentId,{expand:g,collapse:x,remove:C,onRemove:$,destroy:E,isOpen:h})))}function h(){return D}function g(n){if(D!==!0&&L!==!0){D=!0,n=n||{};var o=d.defer();return F.epxansionPanelGroupCtrl&&F.epxansionPanelGroupCtrl.expandPanel(F.componentId),t.removeClass("md-close"),t.addClass("md-open"),n.animation===!1?t.addClass("md-no-animation"):t.removeClass("md-no-animation"),w(),O.hide(n),G.show(n),j&&j.show(n),N&&N.show(n),l(function(){o.resolve()},n.animation===!1?0:e),o.promise}}function x(n){if(D!==!1){D=!1,n=n||{};var o=d.defer();return t.addClass("md-close"),t.removeClass("md-open"),n.animation===!1?t.addClass("md-no-animation"):t.removeClass("md-no-animation"),P(),O.show(n),G.hide(n),j&&j.hide(n),N&&N.hide(n),l(function(){o.resolve()},n.animation===!1?0:e),o.promise}}function C(o){o=o||{};var i=d.defer();return F.epxansionPanelGroupCtrl&&F.epxansionPanelGroupCtrl.removePanel(F.componentId),"function"==typeof q&&(q(),q=void 0),o.animation===!1||D===!1?(n.$destroy(),t.remove(),i.resolve(),y()):(x(),l(function(){n.$destroy(),t.remove(),i.resolve(),y()},e)),i.promise}function $(n){B=n}function y(){"function"==typeof B&&(B(),B=void 0)}function E(){n.$destroy()}function w(){(N&&N.noSticky!==!0||j&&j.noSticky!==!0)&&(H=n.$watch(function(){return t[0].offsetTop},K,!0),z=n.$watch(function(){return t[0].offsetWidth},Y,!0),A=s.getNearestContentElement(t),"MD-CONTENT"===A.nodeName?(U=k(A),angular.element(A).on("scroll",K)):U=void 0,G.setHeight===!0&&G.$element.on("scroll",K),angular.element(i).on("scroll",K).on("resize",K).on("resize",Y))}function P(){"function"==typeof H&&(H(),H=void 0),"function"==typeof z&&(z(),z=void 0),A&&"MD-CONTENT"===A.nodeName&&angular.element(A).off("scroll",K),G.setHeight===!0&&G.$element.off("scroll",K),angular.element(i).off("scroll",K).off("resize",K).off("resize",Y)}function k(n){for(var e=n.parentNode;e&&e!==document;){if(b(e,"transform"))return e;e=e.parentNode}}function b(n,e){var t=!1;if(n){var o=i.getComputedStyle(n);t=void 0!==o[e]&&"none"!==o[e]}return t}function I(n){var e,t,o;o=G.setHeight===!0?G.$element[0].getBoundingClientRect():A.getBoundingClientRect();var i=U?U.getBoundingClientRect().top:0;e=Math.max(o.top,0),t=e+o.height,N&&N.noSticky===!1&&N.onScroll(e,t,i),j&&j.noSticky===!1&&j.onScroll(e,t,i)}function R(){var n=t[0].offsetWidth;N&&N.noSticky===!1&&N.onResize(n),j&&j.noSticky===!1&&j.onResize(n)}function S(e){T=s.createBackdrop(n),T[0].tabIndex=-1,"function"==typeof e&&T.on("click",e),u.enter(T,t.parent(),null,{duration:0}),t.css("z-index",60)}function _(){T&&(T.remove(),T.off("click"),T=void 0,t.css("z-index",""))}var O,G,j,N,q,A,H,z,B,U,T,F=this,M=!1,W=!1,D=!1,L=!1,K=r.throttle(I),Y=r.throttle(R);F.registerCollapsed=function(n){O=n},F.registerExpanded=function(n){G=n},F.registerHeader=function(n){j=n},F.registerFooter=function(n){N=n},void 0===o.mdComponentId?(o.$set("mdComponentId","_expansion_panel_id_"+s.nextUid()),v()):o.$observe("mdComponentId",function(){v()}),F.$element=t,F.expand=g,F.collapse=x,F.remove=C,F.destroy=E,F.onRemove=$,F.init=f,o.$observe("disabled",function(n){L="string"==typeof n&&"false"!==n,L===!0?t.attr("tabindex","-1"):t.attr("tabindex","0")}),t.on("focus",function(n){t.on("keydown",m)}).on("blur",function(n){t.off("keydown",m)}),n.$panel={collapse:x,expand:g,remove:C,isOpen:h},n.$on("$destroy",function(){_(),"function"==typeof q&&(q(),q=void 0),P()})}var o={restrict:"E",require:["mdExpansionPanel","?^^mdExpansionPanelGroup"],scope:!0,compile:n,controller:["$scope","$element","$attrs","$window","$$rAF","$mdConstant","$mdUtil","$mdComponentRegistry","$timeout","$q","$animate","$parse",t]};return o}angular.module("material.components.expansionPanels").directive("mdExpansionPanel",n);var e=180}(),function(){"use strict";function n(n,e,t){function o(o){var i=n.get(o);return i?i:void t.error(e.supplant(r,[o||""]))}function i(e){return n.when(e)["catch"](t.error)}var r="ExpansionPanel '{0}' is not available! Did you use md-component-id='{0}'?",a={find:o,waitFor:i};return function(n){return void 0===n?a:o(n)}}angular.module("material.components.expansionPanels").factory("$mdExpansionPanel",n),n.$inject=["$mdComponentRegistry","$mdUtil","$log"]}(),function(){"use strict";function n(n,e){function t(t,o,i,r){function a(e){o.css("width",o[0].offsetWidth+"px"),r.$element.css("min-height",o[0].offsetHeight+"px");var t={addClass:"md-absolute md-hide",from:{opacity:1},to:{opacity:0}};e.animation===!1&&(t.duration=0),n(o,t).start().then(function(){o.removeClass("md-hide"),o.css("display","none")})}function s(t){o.css("display",""),o.css("width",o[0].parentNode.offsetWidth+"px");var i={addClass:"md-show",from:{opacity:0},to:{opacity:1}};t.animation===!1&&(i.duration=0),n(o,i).start().then(function(){r.$element.css("transition","none"),o.removeClass("md-absolute md-show"),o.css("width",""),r.$element.css("min-height",""),e(function(){r.$element.css("transition","")},0)})}r.registerCollapsed({show:s,hide:a}),o.on("click",function(){r.expand()})}var o={restrict:"E",require:"^^mdExpansionPanel",link:t};return o}angular.module("material.components.expansionPanels").directive("mdExpansionPanelCollapsed",n),n.$inject=["$animateCss","$timeout"]}(),function(){"use strict";function n(n,e){function t(t,o,i,r){function a(e){var t=c?c:o[0].scrollHeight+"px";o.addClass("md-hide md-overflow"),o.removeClass("md-show md-scroll-y");var i={from:{"max-height":t,opacity:1},to:{"max-height":"48px",opacity:0}};e.animation===!1&&(i.duration=0),n(o,i).start().then(function(){o.css("display","none"),o.removeClass("md-hide")})}function s(t){o.css("display",""),o.addClass("md-show md-overflow");var i=c?c:o[0].scrollHeight+"px",r={from:{"max-height":"48px",opacity:0},to:{"max-height":i,opacity:1}};t.animation===!1&&(r.duration=0),n(o,r).start().then(function(){void 0!==c?o.addClass("md-scroll-y"):(o.css("transition","none"),o.css("max-height","none"),e(function(){o.css("transition","")},0)),o.removeClass("md-overflow")})}var c=i.height||void 0;void 0!==c&&(c=c.replace("px","")+"px"),r.registerExpanded({show:s,hide:a,setHeight:void 0!==c,$element:o})}var o={restrict:"E",require:"^^mdExpansionPanel",link:t};return o}angular.module("material.components.expansionPanels").directive("mdExpansionPanelExpanded",n),n.$inject=["$animateCss","$timeout"]}(),function(){"use strict";function n(){function n(n,e,t,o){function i(){}function r(){c()}function a(n,t,i){var r,a,s=e[0].getBoundingClientRect();s.bottom>t?(r=u[0].offsetHeight,a=t-r-i,a',require:"^^mdExpansionPanel",link:n};return e}angular.module("material.components.expansionPanels").directive("mdExpansionPanelFooter",n)}(),function(){"use strict";function n(){function n(n,e,t,o){function i(n){return E.push(n),function(){E.splice(E.indexOf(n),1)}}function r(){var n=u();E.forEach(function(e){e(n)})}function a(n,e){y[n]=e,P===!0&&(e.expand(),p(n)),r()}function s(n){p(n)}function c(n,e){return y[n].remove(e)}function l(n){Object.keys(y).forEach(function(e){y[e].remove(n)})}function d(n){delete y[n],r()}function u(){return Object.keys(y).length}function p(n){w===!1&&Object.keys(y).forEach(function(e){e!==n&&y[e].collapse()})}function m(n,e){if(void 0!==$[n])throw Error('$mdExpansionPanelGroup.register() The name "'+n+'" has already been registered');$[n]=e}function f(n){if(void 0===$[n])throw Error('$mdExpansionPanelGroup.addPanel() Cannot find Panel with name of "'+n+'"');return $[n]}function v(){return Object.keys(y).map(function(n){return y[n]})}function h(){return Object.keys(y).map(function(n){return y[n]}).filter(function(n){return n.isOpen()})}function g(n){var e=n!==!0;Object.keys(y).forEach(function(n){y[n].collapse({animation:e})})}var x,C=this,$={},y={},E=[],w=void 0!==e.mdMultiple||void 0!==e.multiple,P=void 0!==e.mdAutoExpand||void 0!==e.autoExpand;x=o.register({$element:t,register:m,getRegistered:f,getAll:v,getOpen:h,remove:c,removeAll:l,collapseAll:g,onChange:i,count:u},e.mdComponentId),C.addPanel=a,C.expandPanel=s,C.removePanel=d,n.$on("$destroy",function(){"function"==typeof x&&(x(),x=void 0),Object.keys(y).forEach(function(n){y[n].destroy()})})}var e={restrict:"E",controller:["$scope","$attrs","$element","$mdComponentRegistry",n]};return e}angular.module("material.components.expansionPanels").directive("mdExpansionPanelGroup",n)}(),function(){"use strict";function n(n,e,t,o,i,r,a,s,c){function l(t){var o=n.get(t);return o?u(o):void c.error(e.supplant(p,[t||""]))}function d(e){var t=s.defer();return n.when(e).then(function(n){t.resolve(u(n))})["catch"](function(n){t.reject(),c.error(n)}),t.promise}function u(n){function c(e,t){if("string"!=typeof e)throw Error("$mdExpansionPanelGroup.register() Expects name to be a string");g(t),n.register(e,t)}function l(e,t){return n.remove(e,t)}function d(e){n.removeAll(e)}function u(e){return n.onChange(e)}function p(){return n.count()}function m(){return n.getAll()}function f(){return n.getOpen()}function v(e){n.collapseAll(e)}function h(o,c){if(c=c||{},"string"==typeof o)return h(n.getRegistered(o),c);if(g(o),o.componentId&&n.isPanelActive(o.componentId))return s.reject('panel with componentId "'+o.componentId+'" is currently active');var l=s.defer(),d=i.$new();return angular.extend(d,o.scope),x(o,function(i){var s=angular.element(i),u=o.componentId||s.attr("md-component-id")||"_panelComponentId_"+e.nextUid(),p=t().waitFor(u);s.attr("md-component-id",u);var m=r(s);if(o.controller){angular.extend(c,o.locals||{}),c.$scope=d,c.$panel=p;var f=a(o.controller,c,!0),v=f();s.data("$ngControllerController",v),s.children().data("$ngControllerController",v),o.controllerAs&&(d[o.controllerAs]=v)}n.$element.append(s),m(d),p.then(function(n){l.resolve(n)})}),l.promise}function g(n){if("object"!=typeof n||null===n)throw Error("$mdExapnsionPanelGroup.add()/.register() : Requires an options object to be passed in");if(!n.template&&!n.templateUrl)throw Error("$mdExapnsionPanelGroup.add()/.register() : Is missing required paramters to create. Required One of the following: template, templateUrl")}function x(n,e){void 0!==n.templateUrl?o(n.templateUrl).then(function(n){e(n)}):e(n.template)}var C={add:h,register:c,getAll:m,getOpen:f,remove:l,removeAll:d,collapseAll:v,onChange:u,count:p};return C}var p="ExpansionPanelGroup '{0}' is not available! Did you use md-component-id='{0}'?",m={find:l,waitFor:d};return function(n){return void 0===n?m:l(n)}}angular.module("material.components.expansionPanels").factory("$mdExpansionPanelGroup",n),n.$inject=["$mdComponentRegistry","$mdUtil","$mdExpansionPanel","$templateRequest","$rootScope","$compile","$controller","$q","$log"]}(),function(){"use strict";function n(){function n(n,e,t,o){function i(){}function r(){c()}function a(n,t,o){var i,r,a=e[0].getBoundingClientRect();a.top',require:"^^mdExpansionPanel",link:n};return e}angular.module("material.components.expansionPanels").directive("mdExpansionPanelHeader",n),n.$inject=[]}(),function(){"use strict";function n(){var n={restrict:"E",template:'',replace:!0};return n}angular.module("material.components.expansionPanels").directive("mdExpansionPanelIcon",n)}(); \ No newline at end of file diff --git a/package.json b/package.json index 8564389..063ea68 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-material-expansion-panel", - "version": "0.6.2", + "version": "0.7.0", "author": "Ben Rubin", "description": "Material Design Expansion Panels for angular material", "keywords": "material, material-design, design, angular, component, expansion, panel, panels",