diff --git a/bower.json b/bower.json index df8096a..4c84d0e 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-material-expansion-panel", - "version": "0.4.2", + "version": "0.4.3", "description": "Material Design Expansion Panels.", "main": [ "dist/md-expansion-panel.js", diff --git a/dist/md-expansion-panel.css b/dist/md-expansion-panel.css index 3bce5cf..7093226 100644 --- a/dist/md-expansion-panel.css +++ b/dist/md-expansion-panel.css @@ -1,28 +1,29 @@ -md-expansion-panel md-expansion-panel-collapsed, -md-expansion-panel .md-expansion-panel-footer-container, -md-expansion-panel .md-expansion-panel-header-container { +md-expansion-panel { background: #FFF; } - md-expansion-panel md-expansion-panel-collapsed .md-title, - md-expansion-panel md-expansion-panel-collapsed .md-summary, - md-expansion-panel .md-expansion-panel-footer-container .md-title, - md-expansion-panel .md-expansion-panel-footer-container .md-summary, - md-expansion-panel .md-expansion-panel-header-container .md-title, - md-expansion-panel .md-expansion-panel-header-container .md-summary { - color: #333; } - -md-expansion-panel md-expansion-panel-footer .md-expansion-panel-footer-container, -md-expansion-panel md-expansion-panel-header .md-expansion-panel-header-container { - border-color: #DDD; } - -md-expansion-panel .md-expansion-panel-icon-container .md-expansion-panel-icon { - color: #999; } - -md-expansion-panel[disabled] md-expansion-panel-collapsed { - color: #DDD; } - -md-expansion-panel:not(.md-open):not([disabled]):focus, -md-expansion-panel:not(.md-open):not([disabled]):focus md-expansion-panel-collapsed { - background: #EEE; } + md-expansion-panel md-expansion-panel-collapsed, + md-expansion-panel .md-expansion-panel-footer-container, + md-expansion-panel .md-expansion-panel-header-container { + background: #FFF; } + md-expansion-panel md-expansion-panel-collapsed .md-title, + md-expansion-panel md-expansion-panel-collapsed .md-summary, + md-expansion-panel .md-expansion-panel-footer-container .md-title, + md-expansion-panel .md-expansion-panel-footer-container .md-summary, + md-expansion-panel .md-expansion-panel-header-container .md-title, + md-expansion-panel .md-expansion-panel-header-container .md-summary { + color: #333; } + md-expansion-panel md-expansion-panel-footer .md-expansion-panel-footer-container, + md-expansion-panel md-expansion-panel-header .md-expansion-panel-header-container { + border-color: #DDD; } + md-expansion-panel .md-expansion-panel-icon-container .md-expansion-panel-icon { + color: #999; } + md-expansion-panel[disabled] md-expansion-panel-collapsed { + color: #DDD; } + md-expansion-panel:not(.md-open):not([disabled]):focus, + md-expansion-panel:not(.md-open):not([disabled]):focus md-expansion-panel-collapsed { + background: #EEE; } + +.layout-padding > md-expansion-panel-group { + padding: 0; } /* --- Expansion Panel --- */ md-expansion-panel { @@ -98,8 +99,7 @@ md-expansion-panel-collapsed { /* --- Expansion Panel Expanded --- */ md-expansion-panel-expanded { display: none; - min-height: 48px; - line-height: 48px; } + min-height: 48px; } md-expansion-panel-expanded.md-show { -webkit-transition: max-height 0.12s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.12s cubic-bezier(0.25, 0.8, 0.25, 1); transition: max-height 0.12s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.12s cubic-bezier(0.25, 0.8, 0.25, 1); } diff --git a/dist/md-expansion-panel.js b/dist/md-expansion-panel.js index 7f2fc5b..072295b 100644 --- a/dist/md-expansion-panel.js +++ b/dist/md-expansion-panel.js @@ -677,6 +677,7 @@ function expansionPanelGroupDirective() { var deregister; var registered = {}; var panels = {}; + var onChangeFuncs = []; var multipleExpand = $attrs.mdMultiple !== undefined || $attrs.multiple !== undefined; var autoExpand = $attrs.mdAutoExpand !== undefined || $attrs.autoExpand !== undefined; @@ -686,7 +687,9 @@ function expansionPanelGroupDirective() { register: register, getRegistered: getRegistered, remove: remove, - removeAll: removeAll + removeAll: removeAll, + onChange: onChange, + count: panelCount }, $attrs.mdComponentId); vm.addPanel = addPanel; @@ -708,12 +711,30 @@ function expansionPanelGroupDirective() { }); + + function onChange(callback) { + onChangeFuncs.push(callback); + + return function () { + onChangeFuncs.splice(onChangeFuncs.indexOf(callback), 1); + }; + } + + function callOnChange() { + var count = panelCount(); + onChangeFuncs.forEach(function (func) { + func(count); + }); + } + + function addPanel(componentId, panelCtrl) { panels[componentId] = panelCtrl; if (autoExpand === true) { panelCtrl.expand(); closeOthers(componentId); } + callOnChange(); } function expandPanel(componentId) { @@ -732,6 +753,11 @@ function expansionPanelGroupDirective() { function removePanel(componentId) { delete panels[componentId]; + callOnChange(); + } + + function panelCount() { + return Object.keys(panels).length; } function closeOthers(id) { @@ -836,7 +862,9 @@ function expansionPanelGroupService($mdComponentRegistry, $mdUtil, $mdExpansionP add: add, register: register, remove: remove, - removeAll: removeAll + removeAll: removeAll, + onChange: onChange, + count: count }; return service; @@ -859,6 +887,14 @@ function expansionPanelGroupService($mdComponentRegistry, $mdUtil, $mdExpansionP instance.removeAll(); } + function onChange(callback) { + return instance.onChange(callback); + } + + function count() { + return instance.count(); + } + function add(options, locals) { locals = locals || {}; diff --git a/dist/md-expansion-panel.min.css b/dist/md-expansion-panel.min.css index 9f33aba..36352a7 100644 --- a/dist/md-expansion-panel.min.css +++ b/dist/md-expansion-panel.min.css @@ -1 +1 @@ -md-expansion-panel .md-expansion-panel-footer-container,md-expansion-panel .md-expansion-panel-header-container,md-expansion-panel md-expansion-panel-collapsed{background:#fff}md-expansion-panel .md-expansion-panel-footer-container .md-summary,md-expansion-panel .md-expansion-panel-footer-container .md-title,md-expansion-panel .md-expansion-panel-header-container .md-summary,md-expansion-panel .md-expansion-panel-header-container .md-title,md-expansion-panel md-expansion-panel-collapsed .md-summary,md-expansion-panel md-expansion-panel-collapsed .md-title{color:#333}md-expansion-panel md-expansion-panel-footer .md-expansion-panel-footer-container,md-expansion-panel md-expansion-panel-header .md-expansion-panel-header-container{border-color:#ddd}md-expansion-panel .md-expansion-panel-icon-container .md-expansion-panel-icon{color:#999}md-expansion-panel[disabled] md-expansion-panel-collapsed{color:#ddd}md-expansion-panel:not(.md-open):not([disabled]):focus,md-expansion-panel:not(.md-open):not([disabled]):focus md-expansion-panel-collapsed{background:#eee}md-expansion-panel{display:block;position:relative;outline:none;margin-top:0;margin-bottom:0;padding:0;box-shadow:0 -1px 0 #e5e5e5,0 0 2px rgba(0,0,0,.12),0 2px 4px rgba(0,0,0,.24)}md-expansion-panel.md-open{margin-top:16px;margin-bottom:16px}md-expansion-panel.md-open:first-of-type{margin-top:0}md-expansion-panel.md-close{overflow:hidden}md-expansion-panel.md-open{-webkit-transition:margin-top .12s cubic-bezier(.25,.8,.25,1),margin-bottom .12s cubic-bezier(.25,.8,.25,1);transition:margin-top .12s cubic-bezier(.25,.8,.25,1),margin-bottom .12s cubic-bezier(.25,.8,.25,1)}md-expansion-panel.md-close{-webkit-transition:margin-top .08s cubic-bezier(.25,.8,.25,1),margin-bottom .08s cubic-bezier(.25,.8,.25,1);transition:margin-top .08s cubic-bezier(.25,.8,.25,1),margin-bottom .08s cubic-bezier(.25,.8,.25,1)}md-expansion-panel-collapsed .md-title,md-expansion-panel-header .md-title{-webkit-box-flex:1;-ms-flex:1;flex:1;font-size:16px;font-weight:600;min-width:80px;max-width:184px;overflow:hidden;text-overflow:ellipsis;text-align:left;white-space:nowrap}md-expansion-panel-collapsed .md-summary,md-expansion-panel-header .md-summary{-webkit-box-flex:1;-ms-flex:1;flex:1;font-size:13px;overflow:hidden;text-overflow:ellipsis;text-align:left;white-space:nowrap}md-expansion-panel-collapsed{display:-webkit-box;display:-ms-flexbox;display:flex;min-height:48px;line-height:48px;padding:0 24px;opacity:1;z-index:1;box-sizing:border-box}md-expansion-panel-collapsed.md-absolute{position:absolute}md-expansion-panel-collapsed.md-show{-webkit-transition:opacity .03s linear;transition:opacity .03s linear;-webkit-transition-delay:.03s;transition-delay:.03s}md-expansion-panel-collapsed.md-hide{-webkit-transition:opacity .1s cubic-bezier(.25,.8,.25,1);transition:opacity .1s cubic-bezier(.25,.8,.25,1);opacity:0}md-expansion-panel-expanded{display:none;min-height:48px;line-height:48px}md-expansion-panel-expanded.md-show{-webkit-transition:max-height .12s cubic-bezier(.25,.8,.25,1),opacity .12s cubic-bezier(.25,.8,.25,1);transition:max-height .12s cubic-bezier(.25,.8,.25,1),opacity .12s cubic-bezier(.25,.8,.25,1)}md-expansion-panel-expanded.md-hide{-webkit-transition:max-height .08s cubic-bezier(.25,.8,.25,1),opacity .08s cubic-bezier(.25,.8,.25,1);transition:max-height .08s cubic-bezier(.25,.8,.25,1),opacity .08s cubic-bezier(.25,.8,.25,1)}md-expansion-panel-expanded.md-hide,md-expansion-panel-expanded.md-show{display:block}md-expansion-panel-expanded.md-scroll-y{overflow-y:auto}md-expansion-panel-expanded.md-overflow{overflow:hidden}md-expansion-panel-expanded md-expansion-panel-content{display:block;padding:16px 24px}md-expansion-panel-header{display:block;position:relative}md-expansion-panel-header .md-expansion-panel-header-container{display:-webkit-box;display:-ms-flexbox;display:flex;min-height:48px;line-height:48px;padding:0 24px;box-sizing:border-box;border-bottom:1px solid}md-expansion-panel-header.md-stick .md-expansion-panel-header-container{position:fixed;z-index:1;-webkit-animation:a .3s ease-out both;animation:a .3s ease-out both}md-expansion-panel-header.md-no-stick .md-expansion-panel-header-container{-webkit-animation:b .3s ease-out both;animation:b .3s ease-out both}md-expansion-panel-footer{display:block;position:relative}md-expansion-panel-footer.md-hide,md-expansion-panel-footer.md-show{display:block}md-expansion-panel-footer .md-expansion-panel-footer-container{display:-webkit-box;display:-ms-flexbox;display:flex;min-height:48px;line-height:48px;padding:0 24px;border-top:1px solid;box-sizing:border-box}md-expansion-panel-footer.md-stick .md-expansion-panel-footer-container{position:fixed;z-index:1}md-expansion-panel .md-expansion-panel-icon-container:first-child{padding-right:12px}md-expansion-panel .md-expansion-panel-icon-container .md-expansion-panel-icon:after{font-family:mdMaterialIcons;font-size:18px;font-weight:600;display:block;content:'\e315';position:relative;speak:none;-webkit-transform:rotate(0deg);transform:rotate(0deg);-webkit-transition:-webkit-transform .4s cubic-bezier(.25,.8,.25,1);transition:-webkit-transform .4s cubic-bezier(.25,.8,.25,1);transition:transform .4s cubic-bezier(.25,.8,.25,1);transition:transform .4s cubic-bezier(.25,.8,.25,1),-webkit-transform .4s cubic-bezier(.25,.8,.25,1)}md-expansion-panel.md-open>md-expansion-panel-collasped .md-expansion-panel-icon-container .md-expansion-panel-icon:after,md-expansion-panel.md-open>md-expansion-panel-header .md-expansion-panel-icon-container .md-expansion-panel-icon:after{-webkit-transform:rotate(90deg);transform:rotate(90deg)}@-webkit-keyframes a{0%{box-shadow:0 0 0 0 transparent}to{box-shadow:0 2px 4px 0 rgba(0,0,0,.16)}}@keyframes a{0%{box-shadow:0 0 0 0 transparent}to{box-shadow:0 2px 4px 0 rgba(0,0,0,.16)}}@-webkit-keyframes b{0%{box-shadow:0 2px 4px 0 rgba(0,0,0,.16)}to{box-shadow:0 0 0 0 transparent}}@keyframes b{0%{box-shadow:0 2px 4px 0 rgba(0,0,0,.16)}to{box-shadow:0 0 0 0 transparent}} \ No newline at end of file +md-expansion-panel,md-expansion-panel .md-expansion-panel-footer-container,md-expansion-panel .md-expansion-panel-header-container,md-expansion-panel md-expansion-panel-collapsed{background:#fff}md-expansion-panel .md-expansion-panel-footer-container .md-summary,md-expansion-panel .md-expansion-panel-footer-container .md-title,md-expansion-panel .md-expansion-panel-header-container .md-summary,md-expansion-panel .md-expansion-panel-header-container .md-title,md-expansion-panel md-expansion-panel-collapsed .md-summary,md-expansion-panel md-expansion-panel-collapsed .md-title{color:#333}md-expansion-panel md-expansion-panel-footer .md-expansion-panel-footer-container,md-expansion-panel md-expansion-panel-header .md-expansion-panel-header-container{border-color:#ddd}md-expansion-panel .md-expansion-panel-icon-container .md-expansion-panel-icon{color:#999}md-expansion-panel[disabled] md-expansion-panel-collapsed{color:#ddd}md-expansion-panel:not(.md-open):not([disabled]):focus,md-expansion-panel:not(.md-open):not([disabled]):focus md-expansion-panel-collapsed{background:#eee}.layout-padding>md-expansion-panel-group{padding:0}md-expansion-panel{display:block;position:relative;outline:none;margin-top:0;margin-bottom:0;padding:0;box-shadow:0 -1px 0 #e5e5e5,0 0 2px rgba(0,0,0,.12),0 2px 4px rgba(0,0,0,.24)}md-expansion-panel.md-open{margin-top:16px;margin-bottom:16px}md-expansion-panel.md-open:first-of-type{margin-top:0}md-expansion-panel.md-close{overflow:hidden}md-expansion-panel.md-open{-webkit-transition:margin-top .12s cubic-bezier(.25,.8,.25,1),margin-bottom .12s cubic-bezier(.25,.8,.25,1);transition:margin-top .12s cubic-bezier(.25,.8,.25,1),margin-bottom .12s cubic-bezier(.25,.8,.25,1)}md-expansion-panel.md-close{-webkit-transition:margin-top .08s cubic-bezier(.25,.8,.25,1),margin-bottom .08s cubic-bezier(.25,.8,.25,1);transition:margin-top .08s cubic-bezier(.25,.8,.25,1),margin-bottom .08s cubic-bezier(.25,.8,.25,1)}md-expansion-panel-collapsed .md-title,md-expansion-panel-header .md-title{-webkit-box-flex:1;-ms-flex:1;flex:1;font-size:16px;font-weight:600;min-width:80px;max-width:184px;overflow:hidden;text-overflow:ellipsis;text-align:left;white-space:nowrap}md-expansion-panel-collapsed .md-summary,md-expansion-panel-header .md-summary{-webkit-box-flex:1;-ms-flex:1;flex:1;font-size:13px;overflow:hidden;text-overflow:ellipsis;text-align:left;white-space:nowrap}md-expansion-panel-collapsed{display:-webkit-box;display:-ms-flexbox;display:flex;min-height:48px;line-height:48px;padding:0 24px;opacity:1;z-index:1;box-sizing:border-box}md-expansion-panel-collapsed.md-absolute{position:absolute}md-expansion-panel-collapsed.md-show{-webkit-transition:opacity .03s linear;transition:opacity .03s linear;-webkit-transition-delay:.03s;transition-delay:.03s}md-expansion-panel-collapsed.md-hide{-webkit-transition:opacity .1s cubic-bezier(.25,.8,.25,1);transition:opacity .1s cubic-bezier(.25,.8,.25,1);opacity:0}md-expansion-panel-expanded{display:none;min-height:48px}md-expansion-panel-expanded.md-show{-webkit-transition:max-height .12s cubic-bezier(.25,.8,.25,1),opacity .12s cubic-bezier(.25,.8,.25,1);transition:max-height .12s cubic-bezier(.25,.8,.25,1),opacity .12s cubic-bezier(.25,.8,.25,1)}md-expansion-panel-expanded.md-hide{-webkit-transition:max-height .08s cubic-bezier(.25,.8,.25,1),opacity .08s cubic-bezier(.25,.8,.25,1);transition:max-height .08s cubic-bezier(.25,.8,.25,1),opacity .08s cubic-bezier(.25,.8,.25,1)}md-expansion-panel-expanded.md-hide,md-expansion-panel-expanded.md-show{display:block}md-expansion-panel-expanded.md-scroll-y{overflow-y:auto}md-expansion-panel-expanded.md-overflow{overflow:hidden}md-expansion-panel-expanded md-expansion-panel-content{display:block;padding:16px 24px}md-expansion-panel-header{display:block;position:relative}md-expansion-panel-header .md-expansion-panel-header-container{display:-webkit-box;display:-ms-flexbox;display:flex;min-height:48px;line-height:48px;padding:0 24px;box-sizing:border-box;border-bottom:1px solid}md-expansion-panel-header.md-stick .md-expansion-panel-header-container{position:fixed;z-index:1;-webkit-animation:a .3s ease-out both;animation:a .3s ease-out both}md-expansion-panel-header.md-no-stick .md-expansion-panel-header-container{-webkit-animation:b .3s ease-out both;animation:b .3s ease-out both}md-expansion-panel-footer{display:block;position:relative}md-expansion-panel-footer.md-hide,md-expansion-panel-footer.md-show{display:block}md-expansion-panel-footer .md-expansion-panel-footer-container{display:-webkit-box;display:-ms-flexbox;display:flex;min-height:48px;line-height:48px;padding:0 24px;border-top:1px solid;box-sizing:border-box}md-expansion-panel-footer.md-stick .md-expansion-panel-footer-container{position:fixed;z-index:1}md-expansion-panel .md-expansion-panel-icon-container:first-child{padding-right:12px}md-expansion-panel .md-expansion-panel-icon-container .md-expansion-panel-icon:after{font-family:mdMaterialIcons;font-size:18px;font-weight:600;display:block;content:'\e315';position:relative;speak:none;-webkit-transform:rotate(0deg);transform:rotate(0deg);-webkit-transition:-webkit-transform .4s cubic-bezier(.25,.8,.25,1);transition:-webkit-transform .4s cubic-bezier(.25,.8,.25,1);transition:transform .4s cubic-bezier(.25,.8,.25,1);transition:transform .4s cubic-bezier(.25,.8,.25,1),-webkit-transform .4s cubic-bezier(.25,.8,.25,1)}md-expansion-panel.md-open>md-expansion-panel-collasped .md-expansion-panel-icon-container .md-expansion-panel-icon:after,md-expansion-panel.md-open>md-expansion-panel-header .md-expansion-panel-icon-container .md-expansion-panel-icon:after{-webkit-transform:rotate(90deg);transform:rotate(90deg)}@-webkit-keyframes a{0%{box-shadow:0 0 0 0 transparent}to{box-shadow:0 2px 4px 0 rgba(0,0,0,.16)}}@keyframes a{0%{box-shadow:0 0 0 0 transparent}to{box-shadow:0 2px 4px 0 rgba(0,0,0,.16)}}@-webkit-keyframes b{0%{box-shadow:0 2px 4px 0 rgba(0,0,0,.16)}to{box-shadow:0 0 0 0 transparent}}@keyframes b{0%{box-shadow:0 2px 4px 0 rgba(0,0,0,.16)}to{box-shadow:0 0 0 0 transparent}} \ No newline at end of file diff --git a/dist/md-expansion-panel.min.js b/dist/md-expansion-panel.min.js index 9958bf0..efd370f 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";function e(){function e(e,n){var t="Invalid HTML for md-expansion-panel: ";if(e.attr("tabindex",n.tabindex||"0"),null===e[0].querySelector("md-expansion-panel-collapsed"))throw Error(t+"Expected a child element of `md-epxansion-panel-collapsed`");if(null===e[0].querySelector("md-expansion-panel-expanded"))throw Error(t+"Expected a child element of `md-epxansion-panel-expanded`");return function(e,n,t,o){var r=o[0],i=o[1];i&&(r.epxansionPanelGroupCtrl=i,i.addPanel(r.componentId,{expand:r.expand,collapse:r.collapse,remove:r.remove,destroy:r.destroy}))}}function t(e,t,o,r,i,a,s,l,c,d){function p(e){var n=a.KEY_CODE;switch(e.keyCode){case n.ENTER:m();break;case n.ESCAPE:u()}}function m(){if(I!==!0&&q!==!0){I=!0;var e=d.defer();return S.epxansionPanelGroupCtrl&&S.epxansionPanelGroupCtrl.expandPanel(S.componentId),t.removeClass("md-close"),t.addClass("md-open"),v(),y.hide(),C.show(),E&&E.show(),w&&w.show(),c(function(){e.resolve()},n),e.promise}}function u(){if(I!==!1){I=!1;var e=d.defer();return t.addClass("md-close"),t.removeClass("md-open"),x(),y.show(),C.hide(),E&&E.hide(),w&&w.hide(),c(function(){e.resolve()},n),e.promise}}function f(o){var r=d.defer();return S.epxansionPanelGroupCtrl&&S.epxansionPanelGroupCtrl.removePanel(S.componentId),"function"==typeof P&&(P(),P=void 0),o===!0||I===!1?(e.$destroy(),t.remove(),r.resolve()):(u(),c(function(){e.$destroy(),t.remove(),r.resolve()},n)),r.promise}function h(){e.$destroy()}function v(){(w&&w.noSticky!==!0||E&&E.noSticky!==!0)&&(b=e.$watch(function(){return t[0].offsetTop},G,!0),R=e.$watch(function(){return t[0].offsetWidth},H,!0),k=s.getNearestContentElement(t),"MD-CONTENT"===k.nodeName&&angular.element(k).on("scroll",G),C.setHeight===!0&&C.$element.on("scroll",G),angular.element(r).on("scroll",G).on("resize",G))}function x(){"function"==typeof b&&(b(),b=void 0),"function"==typeof R&&(R(),R=void 0),k&&"MD-CONTENT"===k.nodeName&&angular.element(k).off("scroll",G),C.setHeight===!0&&C.$element.off("scroll",G),angular.element(r).off("scroll",G).off("resize",G)}function g(e){var n,t,o;o=C.setHeight===!0?C.$element[0].getBoundingClientRect():k.getBoundingClientRect(),n=Math.max(o.top,0),t=n+o.height,w&&w.noSticky===!1&&w.onScroll(n,t),E&&E.noSticky===!1&&E.onScroll(n,t)}function $(e){w&&w.noSticky===!1&&w.onResize(e),E&&E.noSticky===!1&&E.onResize(e)}var y,C,E,w,P,k,b,R,S=this,I=!1,q=!1,G=i.throttle(g),H=i.throttle($);S.registerCollapsed=function(e){y=e},S.registerExpanded=function(e){C=e},S.registerHeader=function(e){E=e},S.registerFooter=function(e){w=e},S.$element=t,S.componentId=o.mdComponentId,S.expand=m,S.collapse=u,S.remove=f,S.destroy=h,o.$observe("disabled",function(e){q="string"==typeof e&&"false"!==e,q===!0?t.attr("tabindex","-1"):t.attr("tabindex","0")}),t.on("focus",function(e){t.on("keydown",p)}).on("blur",function(e){t.off("keydown",p)}),e.$panel={collapse:u,expand:m,remove:f},e.$on("$destroy",function(){"function"==typeof P&&(P(),P=void 0),x()}),o.mdComponentId&&(P=l.register({expand:m,collapse:u,remove:f,componentId:o.mdComponentId},o.mdComponentId))}var o={restrict:"E",require:["mdExpansionPanel","?^^mdExpansionPanelGroup"],scope:!0,compile:e,controller:["$scope","$element","$attrs","$window","$$rAF","$mdConstant","$mdUtil","$mdComponentRegistry","$timeout","$q",t]};return o}angular.module("material.components.expansionPanels").directive("mdExpansionPanel",e);var n=180}(),function(){"use strict";function e(e,n,t){function o(o){var r=e.get(o);return r?r:void t.error(n.supplant(i,[o||""]))}function r(n){return e.when(n)["catch"](t.error)}var i="ExpansionPanel '{0}' is not available! Did you use md-component-id='{0}'?",a={find:o,waitFor:r};return function(e){return void 0===e?a:o(e)}}angular.module("material.components.expansionPanels").factory("$mdExpansionPanel",e),e.$inject=["$mdComponentRegistry","$mdUtil","$log"]}(),function(){"use strict";function e(e){function n(n,t,o,r){function i(){t.css("width",t[0].offsetWidth+"px"),r.$element.css("min-height",t[0].offsetHeight+"px"),e(t,{addClass:"md-absolute md-hide",from:{opacity:1},to:{opacity:0}}).start().then(function(){t.removeClass("md-hide"),t.css("display","none")})}function a(){t.css("display",""),t.css("width",t[0].parentNode.offsetWidth+"px"),e(t,{addClass:"md-show",from:{opacity:0},to:{opacity:1}}).start().then(function(){t.removeClass("md-absolute md-show"),t.css("width",""),r.$element.css("min-height","")})}r.registerCollapsed({show:a,hide:i}),t.on("click",function(){r.expand()})}var t={restrict:"E",require:"^^mdExpansionPanel",link:n};return t}angular.module("material.components.expansionPanels").directive("mdExpansionPanelCollapsed",e),e.$inject=["$animateCss"]}(),function(){"use strict";function e(e){function n(n,t,o,r){function i(){var n=s?s:t[0].scrollHeight+"px";t.addClass("md-hide md-overflow"),t.removeClass("md-show md-scroll-y"),e(t,{from:{"max-height":n,opacity:1},to:{"max-height":"48px",opacity:0}}).start().then(function(){t.css("display","none"),t.removeClass("md-hide")})}function a(){t.css("display",""),t.addClass("md-show md-overflow");var n=s?s:t[0].scrollHeight+"px";e(t,{from:{"max-height":"48px",opacity:0},to:{"max-height":n,opacity:1}}).start().then(function(){void 0!==s?t.addClass("md-scroll-y"):t.css("max-height","none"),t.removeClass("md-overflow")})}var s=o.height||void 0;void 0!==s&&(s=s.replace("px","")+"px"),r.registerExpanded({show:a,hide:i,setHeight:void 0!==s,$element:t})}var t={restrict:"E",require:"^^mdExpansionPanel",link:n};return t}angular.module("material.components.expansionPanels").directive("mdExpansionPanelExpanded",e),e.$inject=["$animateCss"]}(),function(){"use strict";function e(){function e(e,n,t,o){function r(){}function i(){l()}function a(e,t){var r,i=n[0].getBoundingClientRect(),a=n[0].parentNode.getBoundingClientRect().top,s=a-t;i.bottom>t?(r=p[0].offsetHeight,s=Math.max(s+r,0),p.css("width",o.$element[0].offsetWidth+"px"),n.css("height",r+"px"),p.css("top",t-r+s+"px"),n.addClass("md-stick"),c=!0):c===!0&&l()}function s(e){c!==!1&&p.css("width",e+"px")}function l(){c=!1,p.css("width",""),p.css("top",""),n.css("height",""),n.removeClass("md-stick")}var c=!1,d=void 0!==t.mdNoSticky,p=angular.element(n[0].querySelector(".md-expansion-panel-footer-container"));o.registerFooter({show:r,hide:i,onScroll:a,onResize:s,noSticky:d})}var n={restrict:"E",transclude:!0,template:'',require:"^^mdExpansionPanel",link:e};return n}angular.module("material.components.expansionPanels").directive("mdExpansionPanelFooter",e)}(),function(){"use strict";function e(){function e(e,n,t,o){function r(e,n){h[e]=n,x===!0&&(n.expand(),c(e))}function i(e){c(e)}function a(e){return h[e].remove()}function s(){Object.keys(h).forEach(function(e){h[e].remove()})}function l(e){delete h[e]}function c(e){v===!1&&Object.keys(h).forEach(function(n){n!==e&&h[n].collapse()})}function d(e,n){if(void 0!==f[e])throw Error('$mdExpansionPanelGroup.register() The name "'+e+'" has already been registered');f[e]=n}function p(e){if(void 0===f[e])throw Error('$mdExpansionPanelGroup.addPanel() Cannot find Panel with name of "'+e+'"');return f[e]}var m,u=this,f={},h={},v=void 0!==n.mdMultiple||void 0!==n.multiple,x=void 0!==n.mdAutoExpand||void 0!==n.autoExpand;m=o.register({$element:t,register:d,getRegistered:p,remove:a,removeAll:s},n.mdComponentId),u.addPanel=r,u.expandPanel=i,u.removePanel=l,e.$on("$destroy",function(){"function"==typeof m&&(m(),m=void 0),Object.keys(h).forEach(function(e){h[e].destroy()})})}var n={restrict:"E",controller:["$scope","$attrs","$element","$mdComponentRegistry",e]};return n}angular.module("material.components.expansionPanels").directive("mdExpansionPanelGroup",e)}(),function(){"use strict";function e(e,n,t,o,r,i,a,s,l){function c(t){var o=e.get(t);return o?p(o):void l.error(n.supplant(m,[t||""]))}function d(n){var t=s.defer();return e.when(n).then(function(e){t.resolve(p(e))})["catch"](function(e){t.reject(),l.error(e)}),t.promise}function p(e){function l(n,t){if("string"!=typeof n)throw Error("$mdExpansionPanelGroup.register() Expects name to be a string");m(t),e.register(n,t)}function c(n){return e.remove(n)}function d(){e.removeAll()}function p(o,l){if(l=l||{},"string"==typeof o)return p(e.getRegistered(o),l);if(m(o),o.componentId&&e.isPanelActive(o.componentId))return s.reject('panel with componentId "'+o.componentId+'" is currently active');var c=s.defer(),d=r.$new();return angular.extend(d,o.scope),u(o,function(r){var s=angular.element(r),p=o.componentId||s.attr("md-component-id")||"_panelComponentId_"+n.nextUid(),m=t().waitFor(p);s.attr("md-component-id",p);var u=i(s);if(o.controller){angular.extend(l,o.locals||{}),l.$scope=d,l.$panel=m;var f=a(o.controller,l,!0),h=f();s.data("$ngControllerController",h),s.children().data("$ngControllerController",h),o.controllerAs&&(d[o.controllerAs]=h)}e.$element.append(s),u(d),m.then(function(e){c.resolve(e)})}),c.promise}function m(e){if("object"!=typeof e||null===e)throw Error("$mdExapnsionPanelGroup.add()/.register() : Requires an options object to be passed in");if(!e.template&&!e.templateUrl)throw Error("$mdExapnsionPanelGroup.add()/.register() : Is missing required paramters to create. Required One of the following: template, templateUrl")}function u(e,n){void 0!==e.templateUrl?o(e.templateUrl).then(function(e){n(e)}):n(e.template)}var f={add:p,register:l,remove:c,removeAll:d};return f}var m="ExpansionPanelGroup '{0}' is not available! Did you use md-component-id='{0}'?",u={find:c,waitFor:d};return function(e){return void 0===e?u:c(e)}}angular.module("material.components.expansionPanels").factory("$mdExpansionPanelGroup",e),e.$inject=["$mdComponentRegistry","$mdUtil","$mdExpansionPanel","$templateRequest","$rootScope","$compile","$controller","$q","$log"]}(),function(){"use strict";function e(){function e(e,n,t,o){function r(){}function i(){l()}function a(e){var t=n[0].getBoundingClientRect(),o=n[0].parentNode.getBoundingClientRect().bottom,r=Math.max(e+t.height-o,0);t.top',require:"^^mdExpansionPanel",link:e};return n}angular.module("material.components.expansionPanels").directive("mdExpansionPanelHeader",e),e.$inject=[]}(); \ No newline at end of file +!function(){"use strict";angular.module("material.components.expansionPanels",["material.core"])}(),function(){"use strict";function e(){function e(e,n){var t="Invalid HTML for md-expansion-panel: ";if(e.attr("tabindex",n.tabindex||"0"),null===e[0].querySelector("md-expansion-panel-collapsed"))throw Error(t+"Expected a child element of `md-epxansion-panel-collapsed`");if(null===e[0].querySelector("md-expansion-panel-expanded"))throw Error(t+"Expected a child element of `md-epxansion-panel-expanded`");return function(e,n,t,o){var r=o[0],i=o[1];i&&(r.epxansionPanelGroupCtrl=i,i.addPanel(r.componentId,{expand:r.expand,collapse:r.collapse,remove:r.remove,destroy:r.destroy}))}}function t(e,t,o,r,i,a,s,l,c,d){function u(e){var n=a.KEY_CODE;switch(e.keyCode){case n.ENTER:p();break;case n.ESCAPE:m()}}function p(){if(I!==!0&&q!==!0){I=!0;var e=d.defer();return S.epxansionPanelGroupCtrl&&S.epxansionPanelGroupCtrl.expandPanel(S.componentId),t.removeClass("md-close"),t.addClass("md-open"),v(),y.hide(),C.show(),E&&E.show(),w&&w.show(),c(function(){e.resolve()},n),e.promise}}function m(){if(I!==!1){I=!1;var e=d.defer();return t.addClass("md-close"),t.removeClass("md-open"),g(),y.show(),C.hide(),E&&E.hide(),w&&w.hide(),c(function(){e.resolve()},n),e.promise}}function f(o){var r=d.defer();return S.epxansionPanelGroupCtrl&&S.epxansionPanelGroupCtrl.removePanel(S.componentId),"function"==typeof P&&(P(),P=void 0),o===!0||I===!1?(e.$destroy(),t.remove(),r.resolve()):(m(),c(function(){e.$destroy(),t.remove(),r.resolve()},n)),r.promise}function h(){e.$destroy()}function v(){(w&&w.noSticky!==!0||E&&E.noSticky!==!0)&&(b=e.$watch(function(){return t[0].offsetTop},G,!0),R=e.$watch(function(){return t[0].offsetWidth},j,!0),k=s.getNearestContentElement(t),"MD-CONTENT"===k.nodeName&&angular.element(k).on("scroll",G),C.setHeight===!0&&C.$element.on("scroll",G),angular.element(r).on("scroll",G).on("resize",G))}function g(){"function"==typeof b&&(b(),b=void 0),"function"==typeof R&&(R(),R=void 0),k&&"MD-CONTENT"===k.nodeName&&angular.element(k).off("scroll",G),C.setHeight===!0&&C.$element.off("scroll",G),angular.element(r).off("scroll",G).off("resize",G)}function x(e){var n,t,o;o=C.setHeight===!0?C.$element[0].getBoundingClientRect():k.getBoundingClientRect(),n=Math.max(o.top,0),t=n+o.height,w&&w.noSticky===!1&&w.onScroll(n,t),E&&E.noSticky===!1&&E.onScroll(n,t)}function $(e){w&&w.noSticky===!1&&w.onResize(e),E&&E.noSticky===!1&&E.onResize(e)}var y,C,E,w,P,k,b,R,S=this,I=!1,q=!1,G=i.throttle(x),j=i.throttle($);S.registerCollapsed=function(e){y=e},S.registerExpanded=function(e){C=e},S.registerHeader=function(e){E=e},S.registerFooter=function(e){w=e},S.$element=t,S.componentId=o.mdComponentId,S.expand=p,S.collapse=m,S.remove=f,S.destroy=h,o.$observe("disabled",function(e){q="string"==typeof e&&"false"!==e,q===!0?t.attr("tabindex","-1"):t.attr("tabindex","0")}),t.on("focus",function(e){t.on("keydown",u)}).on("blur",function(e){t.off("keydown",u)}),e.$panel={collapse:m,expand:p,remove:f},e.$on("$destroy",function(){"function"==typeof P&&(P(),P=void 0),g()}),o.mdComponentId&&(P=l.register({expand:p,collapse:m,remove:f,componentId:o.mdComponentId},o.mdComponentId))}var o={restrict:"E",require:["mdExpansionPanel","?^^mdExpansionPanelGroup"],scope:!0,compile:e,controller:["$scope","$element","$attrs","$window","$$rAF","$mdConstant","$mdUtil","$mdComponentRegistry","$timeout","$q",t]};return o}angular.module("material.components.expansionPanels").directive("mdExpansionPanel",e);var n=180}(),function(){"use strict";function e(e,n,t){function o(o){var r=e.get(o);return r?r:void t.error(n.supplant(i,[o||""]))}function r(n){return e.when(n)["catch"](t.error)}var i="ExpansionPanel '{0}' is not available! Did you use md-component-id='{0}'?",a={find:o,waitFor:r};return function(e){return void 0===e?a:o(e)}}angular.module("material.components.expansionPanels").factory("$mdExpansionPanel",e),e.$inject=["$mdComponentRegistry","$mdUtil","$log"]}(),function(){"use strict";function e(e){function n(n,t,o,r){function i(){t.css("width",t[0].offsetWidth+"px"),r.$element.css("min-height",t[0].offsetHeight+"px"),e(t,{addClass:"md-absolute md-hide",from:{opacity:1},to:{opacity:0}}).start().then(function(){t.removeClass("md-hide"),t.css("display","none")})}function a(){t.css("display",""),t.css("width",t[0].parentNode.offsetWidth+"px"),e(t,{addClass:"md-show",from:{opacity:0},to:{opacity:1}}).start().then(function(){t.removeClass("md-absolute md-show"),t.css("width",""),r.$element.css("min-height","")})}r.registerCollapsed({show:a,hide:i}),t.on("click",function(){r.expand()})}var t={restrict:"E",require:"^^mdExpansionPanel",link:n};return t}angular.module("material.components.expansionPanels").directive("mdExpansionPanelCollapsed",e),e.$inject=["$animateCss"]}(),function(){"use strict";function e(e){function n(n,t,o,r){function i(){var n=s?s:t[0].scrollHeight+"px";t.addClass("md-hide md-overflow"),t.removeClass("md-show md-scroll-y"),e(t,{from:{"max-height":n,opacity:1},to:{"max-height":"48px",opacity:0}}).start().then(function(){t.css("display","none"),t.removeClass("md-hide")})}function a(){t.css("display",""),t.addClass("md-show md-overflow");var n=s?s:t[0].scrollHeight+"px";e(t,{from:{"max-height":"48px",opacity:0},to:{"max-height":n,opacity:1}}).start().then(function(){void 0!==s?t.addClass("md-scroll-y"):t.css("max-height","none"),t.removeClass("md-overflow")})}var s=o.height||void 0;void 0!==s&&(s=s.replace("px","")+"px"),r.registerExpanded({show:a,hide:i,setHeight:void 0!==s,$element:t})}var t={restrict:"E",require:"^^mdExpansionPanel",link:n};return t}angular.module("material.components.expansionPanels").directive("mdExpansionPanelExpanded",e),e.$inject=["$animateCss"]}(),function(){"use strict";function e(){function e(e,n,t,o){function r(){}function i(){l()}function a(e,t){var r,i=n[0].getBoundingClientRect(),a=n[0].parentNode.getBoundingClientRect().top,s=a-t;i.bottom>t?(r=u[0].offsetHeight,s=Math.max(s+r,0),u.css("width",o.$element[0].offsetWidth+"px"),n.css("height",r+"px"),u.css("top",t-r+s+"px"),n.addClass("md-stick"),c=!0):c===!0&&l()}function s(e){c!==!1&&u.css("width",e+"px")}function l(){c=!1,u.css("width",""),u.css("top",""),n.css("height",""),n.removeClass("md-stick")}var c=!1,d=void 0!==t.mdNoSticky,u=angular.element(n[0].querySelector(".md-expansion-panel-footer-container"));o.registerFooter({show:r,hide:i,onScroll:a,onResize:s,noSticky:d})}var n={restrict:"E",transclude:!0,template:'',require:"^^mdExpansionPanel",link:e};return n}angular.module("material.components.expansionPanels").directive("mdExpansionPanelFooter",e)}(),function(){"use strict";function e(){function e(e,n,t,o){function r(e){return $.push(e),function(){$.splice($.indexOf(e),1)}}function i(){var e=u();$.forEach(function(n){n(e)})}function a(e,n){x[e]=n,C===!0&&(n.expand(),p(e)),i()}function s(e){p(e)}function l(e){return x[e].remove()}function c(){Object.keys(x).forEach(function(e){x[e].remove()})}function d(e){delete x[e],i()}function u(){return Object.keys(x).length}function p(e){y===!1&&Object.keys(x).forEach(function(n){n!==e&&x[n].collapse()})}function m(e,n){if(void 0!==g[e])throw Error('$mdExpansionPanelGroup.register() The name "'+e+'" has already been registered');g[e]=n}function f(e){if(void 0===g[e])throw Error('$mdExpansionPanelGroup.addPanel() Cannot find Panel with name of "'+e+'"');return g[e]}var h,v=this,g={},x={},$=[],y=void 0!==n.mdMultiple||void 0!==n.multiple,C=void 0!==n.mdAutoExpand||void 0!==n.autoExpand;h=o.register({$element:t,register:m,getRegistered:f,remove:l,removeAll:c,onChange:r,count:u},n.mdComponentId),v.addPanel=a,v.expandPanel=s,v.removePanel=d,e.$on("$destroy",function(){"function"==typeof h&&(h(),h=void 0),Object.keys(x).forEach(function(e){x[e].destroy()})})}var n={restrict:"E",controller:["$scope","$attrs","$element","$mdComponentRegistry",e]};return n}angular.module("material.components.expansionPanels").directive("mdExpansionPanelGroup",e)}(),function(){"use strict";function e(e,n,t,o,r,i,a,s,l){function c(t){var o=e.get(t);return o?u(o):void l.error(n.supplant(p,[t||""]))}function d(n){var t=s.defer();return e.when(n).then(function(e){t.resolve(u(e))})["catch"](function(e){t.reject(),l.error(e)}),t.promise}function u(e){function l(n,t){if("string"!=typeof n)throw Error("$mdExpansionPanelGroup.register() Expects name to be a string");f(t),e.register(n,t)}function c(n){return e.remove(n)}function d(){e.removeAll()}function u(n){return e.onChange(n)}function p(){return e.count()}function m(o,l){if(l=l||{},"string"==typeof o)return m(e.getRegistered(o),l);if(f(o),o.componentId&&e.isPanelActive(o.componentId))return s.reject('panel with componentId "'+o.componentId+'" is currently active');var c=s.defer(),d=r.$new();return angular.extend(d,o.scope),h(o,function(r){var s=angular.element(r),u=o.componentId||s.attr("md-component-id")||"_panelComponentId_"+n.nextUid(),p=t().waitFor(u);s.attr("md-component-id",u);var m=i(s);if(o.controller){angular.extend(l,o.locals||{}),l.$scope=d,l.$panel=p;var f=a(o.controller,l,!0),h=f();s.data("$ngControllerController",h),s.children().data("$ngControllerController",h),o.controllerAs&&(d[o.controllerAs]=h)}e.$element.append(s),m(d),p.then(function(e){c.resolve(e)})}),c.promise}function f(e){if("object"!=typeof e||null===e)throw Error("$mdExapnsionPanelGroup.add()/.register() : Requires an options object to be passed in");if(!e.template&&!e.templateUrl)throw Error("$mdExapnsionPanelGroup.add()/.register() : Is missing required paramters to create. Required One of the following: template, templateUrl")}function h(e,n){void 0!==e.templateUrl?o(e.templateUrl).then(function(e){n(e)}):n(e.template)}var v={add:m,register:l,remove:c,removeAll:d,onChange:u,count:p};return v}var p="ExpansionPanelGroup '{0}' is not available! Did you use md-component-id='{0}'?",m={find:c,waitFor:d};return function(e){return void 0===e?m:c(e)}}angular.module("material.components.expansionPanels").factory("$mdExpansionPanelGroup",e),e.$inject=["$mdComponentRegistry","$mdUtil","$mdExpansionPanel","$templateRequest","$rootScope","$compile","$controller","$q","$log"]}(),function(){"use strict";function e(){function e(e,n,t,o){function r(){}function i(){l()}function a(e){var t=n[0].getBoundingClientRect(),o=n[0].parentNode.getBoundingClientRect().bottom,r=Math.max(e+t.height-o,0);t.top',require:"^^mdExpansionPanel",link:e};return n}angular.module("material.components.expansionPanels").directive("mdExpansionPanelHeader",e),e.$inject=[]}(); \ No newline at end of file diff --git a/package.json b/package.json index fcff933..7716377 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-material-expansion-panel", - "version": "0.4.2", + "version": "0.4.3", "author": "Ben Rubin", "description": "Material Design Expansion Panels.", "keywords": "material, material-design, design, angular, component, expansion, panel, panels",