Skip to content

Commit

Permalink
fix: #40 and #43
Browse files Browse the repository at this point in the history
  • Loading branch information
LukaszWatroba committed Feb 15, 2016
1 parent f410d45 commit b521820
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 88 deletions.
6 changes: 1 addition & 5 deletions dist/v-accordion.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,10 @@ v-pane-content {
border-bottom-color: #2196F3; }
.vAccordion--default v-pane.is-expanded > v-pane-header::after {
-webkit-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
opacity: 0; }
.vAccordion--default v-pane.is-expanded > v-pane-header::before {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg); }
.vAccordion--default v-pane.is-expanded > v-pane-content > div {
opacity: 1;
Expand All @@ -102,19 +100,17 @@ v-pane-content {
height: 1px;
background-color: #2196F3;
-webkit-transform-origin: 50% 50%;
-ms-transform-origin: 50% 50%;
transform-origin: 50% 50%;
will-change: transform;
-webkit-transition: all 0.25s;
transition: all 0.25s; }
.vAccordion--default v-pane-header::before {
-webkit-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
transform: rotate(-90deg); }
.vAccordion--default v-pane-header:hover, .vAccordion--default v-pane-header:focus {
color: #2196F3; }
.vAccordion--default v-pane-content > div {
padding-bottom: 20px;
will-change: transform, opacity;
opacity: 0;
-webkit-transform: translate3d(0, 30px, 0);
transform: translate3d(0, 30px, 0);
Expand Down
73 changes: 34 additions & 39 deletions dist/v-accordion.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -46,46 +46,47 @@ function vAccordionDirective ($timeout) {
collapseCb: '&?oncollapse',
id: '@?'
},
link: function (scope, iElement, iAttrs, ctrl, transclude) {
transclude(scope.$parent.$new(), function (clone, transclusionScope) {
transclusionScope.$accordion = scope.internalControl;
iElement.append(clone);
});
link: {
pre: function (scope, iElement, iAttrs) {
scope.allowMultiple = (angular.isDefined(iAttrs.multiple) && iAttrs.multiple === '');
},
post: function (scope, iElement, iAttrs, ctrl, transclude) {
transclude(scope.$parent.$new(), function (clone, transclusionScope) {
transclusionScope.$accordion = scope.internalControl;
iElement.append(clone);
});

var protectedApiMethods = ['toggle', 'expand', 'collapse', 'expandAll', 'collapseAll', 'hasExpandedPane'];
iAttrs.$set('role', 'tablist');

function checkCustomControlAPIMethods () {
angular.forEach(protectedApiMethods, function (iteratedMethodName) {
if (scope.control[iteratedMethodName]) {
throw new Error('The `' + iteratedMethodName + '` method can not be overwritten');
}
});
}
if (scope.allowMultiple) {
iAttrs.$set('aria-multiselectable', 'true');
}

if (!angular.isDefined(scope.allowMultiple)) {
scope.allowMultiple = angular.isDefined(iAttrs.multiple);
}
function checkCustomControlAPIMethods () {
var protectedApiMethods = ['toggle', 'expand', 'collapse', 'expandAll', 'collapseAll', 'hasExpandedPane'];

iAttrs.$set('role', 'tablist');
angular.forEach(protectedApiMethods, function (iteratedMethodName) {
if (scope.control[iteratedMethodName]) {
throw new Error('The `' + iteratedMethodName + '` method can not be overwritten');
}
});
}

if (scope.allowMultiple) {
iAttrs.$set('aria-multiselectable', 'true');
}
if (angular.isDefined(scope.control)) {
checkCustomControlAPIMethods();

if (angular.isDefined(scope.control)) {
checkCustomControlAPIMethods();
var mergedControl = angular.extend({}, scope.internalControl, scope.control);
scope.control = scope.internalControl = mergedControl;
}
else {
scope.control = scope.internalControl;
}

var mergedControl = angular.extend({}, scope.internalControl, scope.control);
scope.control = scope.internalControl = mergedControl;
}
else {
scope.control = scope.internalControl;
$timeout(function () {
var eventName = (angular.isDefined(ctrl.getAccordionId())) ? ctrl.getAccordionId() + ':onReady' : 'vAccordion:onReady';
scope.$emit(eventName);
}, 0);
}

$timeout(function () {
var eventName = (angular.isDefined(ctrl.getAccordionId())) ? ctrl.getAccordionId() + ':onReady' : 'vAccordion:onReady';
scope.$emit(eventName);
}, 0);
}
};
}
Expand Down Expand Up @@ -338,7 +339,6 @@ function vPaneContentDirective () {




// vPaneHeader directive
angular.module('vAccordion.directives')
.directive('vPaneHeader', vPaneHeaderDirective);
Expand Down Expand Up @@ -417,14 +417,9 @@ function vPaneDirective ($timeout, $animate, accordionConfig) {
id: '@?'
},
link: function (scope, iElement, iAttrs, accordionCtrl, transclude) {

transclude(scope.$parent.$new(), function (clone, transclusionScope) {
transclusionScope.$pane = scope.internalControl;

if (scope.id) {
transclusionScope.$pane.id = scope.id;
}

if (scope.id) { transclusionScope.$pane.id = scope.id; }
iElement.append(clone);
});

Expand Down
2 changes: 1 addition & 1 deletion dist/v-accordion.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b521820

Please sign in to comment.