Skip to content

Commit ae53aac

Browse files
committed
Fixed Accordion collapse bugs
1 parent 2a700f5 commit ae53aac

File tree

5 files changed

+34
-21
lines changed

5 files changed

+34
-21
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
1+
#Version 0.6.5, (2015/02/25)
2+
3+
##Bug Fixes
4+
5+
- Accordion: double click on title causes inconstent state or bad rendering
6+
- Accordion Collapse
7+
18
#Version 0.6.0, (2014/12/12)
9+
210
- Migration on Angualr Dart 1.0, support Bootstrap 3.3.1 and bug fixes.
311

412
#Version 0.5.5, (2014/06/25)
513

614
##Bug Fixes
15+
716
- Modal Dialog with backdrop:'static' cannot be closed by click on button with data-dismiss='modal'
817

918
#Version 0.5.4, (2014/06/21)
1019

1120
##Bug Fixes
21+
1222
- Error when using typeahead-on-select=ctrl.setSelectedItem($item, $model, $label)
1323

1424
#Version 0.5.3, (2014/06/18)
1525

1626
##Bug Fixes
27+
1728
- Typeahead placement of suggestion popover offset by approax 200px
1829
- Fix animation toggle and z-index calculation in ModalWindow
1930

2031
#Version 0.5.2, (2014/06/17)
2132

2233
##Features
34+
2335
- Project migrated to follow Dart SDK 1.4.3
2436

2537
##Bug Fixes
@@ -29,11 +41,13 @@
2941
#Version 0.5.1, (2014/06/06)
3042

3143
##Features
44+
3245
- Project migrated to follow Angular Dart 0.12.0
3346

3447
#Version 0.5.0, (2014/06/05)
3548

3649
##Features
50+
3751
- All components have migrated away from Shadow DOM and applyAuthorStyles.
3852

3953
##Bug Fixes

lib/accordion/accordion.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import "package:angular/angular.dart";
88
import 'package:angular/utils.dart' as utils;
99
import 'package:logging/logging.dart' show Logger;
1010
import 'package:angular_ui/utils/dbl_click_preventer.dart';
11+
import 'package:angular_ui/utils/timeout.dart';
1112

1213
part 'accordion_group.dart';
1314

lib/accordion/accordion_group.dart

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ part of angular.ui.accordion;
1313
<a class="accordion-toggle" ng-click="toggleOpen()" accordion-transclude="heading"><span ng-class="{'text-muted': isDisabled}">{{heading}}</span></a>
1414
</h4>
1515
</div>
16-
<div class="panel-collapse" collapse="!isOpen">
16+
<div class="panel-collapse" collapse="collapse">
1717
<div class="panel-body"><content></content></div>
1818
</div>
1919
</div>
@@ -26,22 +26,31 @@ class AccordionGroupComponent implements DetachAware, ScopeAware {
2626
var heading;
2727

2828
Scope scope;
29-
AccordionComponent accordion;
30-
DblClickPreventer dblClickPreventer;
29+
final AccordionComponent accordion;
30+
final DblClickPreventer dblClickPreventer;
31+
final Timeout timeout;
3132

32-
AccordionGroupComponent(this.accordion, this.dblClickPreventer) {
33+
AccordionGroupComponent(this.accordion, this.dblClickPreventer, this.timeout) {
3334
accordion.addGroup(this);
35+
//
36+
timeout(() {
37+
scope.watch('isOpen', (value, old){
38+
collapse = !value;
39+
});
40+
}, delay:500);
3441
}
35-
42+
3643
bool _isOpen = false;
3744
@NgTwoWay('is-open')
38-
get isOpen => _isOpen;
39-
set isOpen(bool newValue) {
40-
_isOpen = utils.toBool(newValue);
45+
set isOpen(value) {
46+
_isOpen = utils.toBool(value);
4147
if (_isOpen) {
4248
accordion.closeOthers(this);
4349
}
4450
}
51+
get isOpen => _isOpen;
52+
53+
bool collapse = false;
4554

4655
bool _isDisabled = false;
4756
@NgTwoWay('is-disabled')

lib/collapse/collapse.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Collapse implements ScopeAware {
4949
async.Future doTransition(change) {
5050
async.Completer newTransition = transition(element, change);
5151

52-
var newTransitionDone = (value) {
52+
var newTransitionDone = () {
5353
// Make sure it's this transition, otherwise, leave it alone.
5454
if (currentTransition == newTransition) {
5555
currentTransition = null;
@@ -62,8 +62,7 @@ class Collapse implements ScopeAware {
6262

6363
currentTransition = newTransition;
6464

65-
newTransition.future.catchError(newTransitionDone);
66-
newTransition.future.then(newTransitionDone);
65+
newTransition.future.whenComplete(newTransitionDone);
6766

6867
return newTransition.future;
6968
}

web/index.html

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,6 @@ <h3>Datepicker (partially implemented)</h3>
4848
<h3>Modal Window</h3>
4949
<modal-demo-embedded-tmpl></modal-demo-embedded-tmpl>
5050
<modal-demo-embedded-tmpl-static-backdrop></modal-demo-embedded-tmpl-static-backdrop>
51-
<!-- <modal-demo-tag-tmpl></modal-demo-tag-tmpl> -->
52-
<!-- <div class="panel panel-default"> -->
53-
<!-- <div class="panel-heading">Modal from template file</div> -->
54-
<!-- <div class="panel-body"> -->
55-
<!-- <div modal-ctrl-file-tmpl> -->
56-
<!-- <button class="btn btn-default" ng-click="ctrl1.open('modal/modal_demo_template_from_file.html')">Open me!</button> -->
57-
<!-- <div ng-show="ctrl1.selected != null">Selected: {{ ctrl1.selected }}</div> -->
58-
<!-- </div> -->
59-
<!-- </div> -->
60-
<!-- </div> -->
6151
<hr>
6252

6353
<h3>Rating</h3>

0 commit comments

Comments
 (0)