diff --git a/lib/accordion/accordion.dart b/lib/accordion/accordion.dart index 460461c..ca02940 100644 --- a/lib/accordion/accordion.dart +++ b/lib/accordion/accordion.dart @@ -3,6 +3,7 @@ // All rights reserved. Please see the LICENSE.md file. library angular.ui.accordion; +import 'dart:html' as html; import 'package:angular/angular.dart'; //import 'package:angular_ui/app/injectable_service.dart'; import 'package:angular/utils.dart' as utils; @@ -17,6 +18,7 @@ class AccordionModule extends Module { bind(AccordionComponent); bind(AccordionHeadingComponent); bind(AccordionGroupComponent); + bind(AccordionHeadingTranscludeComponent); bind(AccordionConfig, toValue:new AccordionConfig()); } } @@ -31,14 +33,14 @@ class AccordionConfig { publishAs: 'ctrl', visibility: Directive.CHILDREN_VISIBILITY, templateUrl: 'packages/angular_ui/accordion/accordion.html', - applyAuthorStyles: true + useShadowDom: false ) @Component( selector: '[accordion]', publishAs: 'ctrl', visibility: Directive.CHILDREN_VISIBILITY, templateUrl: 'packages/angular_ui/accordion/accordion.html', - applyAuthorStyles: true + useShadowDom: false ) class AccordionComponent { @NgTwoWay('close-others') bool isCloseOthers; diff --git a/lib/accordion/accordion_group.dart b/lib/accordion/accordion_group.dart index d21d1fc..e13e2fd 100644 --- a/lib/accordion/accordion_group.dart +++ b/lib/accordion/accordion_group.dart @@ -8,11 +8,11 @@ part of angular.ui.accordion; publishAs: 'ctrl', visibility: Directive.CHILDREN_VISIBILITY, templateUrl: 'packages/angular_ui/accordion/accordion_group.html', - applyAuthorStyles: true + useShadowDom: false ) class AccordionGroupComponent implements DetachAware { bool _isOpen = false; - @NgAttr('heading') String heading; + @NgAttr('heading') var heading; Scope scope; AccordionComponent accordion; @@ -29,6 +29,7 @@ class AccordionGroupComponent implements DetachAware { } } + @override void detach() { this.accordion.removeGroup(this); } @@ -40,15 +41,35 @@ class AccordionGroupComponent implements DetachAware { * Heading containing HTML - * */ -@Component( - selector: 'accordion-heading', - publishAs: 'ctrl', - template: '', - applyAuthorStyles: true +@Decorator( + selector: 'accordion-heading' ) class AccordionHeadingComponent { - Scope _scope; - AccordionHeadingComponent(this._scope, AccordionGroupComponent accordionGroup) { - _log.fine('AccordionHeadingComponent'); + AccordionHeadingComponent(html.Element elem, AccordionGroupComponent acc) { + elem.remove(); + acc.heading = elem; + } +} + +@Decorator( + selector: 'accordion-heading-transclude' +) +class AccordionHeadingTranscludeComponent { + + final html.Element elem; + + @NgOneWay('parent-accordion-group-component') + set accordionGroupComponent(AccordionGroupComponent acc) { + if (acc.heading!=null) { + if (acc.heading is String){ + elem.appendText(acc.heading); + } else { + elem.append(acc.heading); + } + } + } + + AccordionHeadingTranscludeComponent(this.elem) { + _log.fine('TabsetComponent'); } } diff --git a/lib/accordion/accordion_group.html b/lib/accordion/accordion_group.html index ab9665d..6a3be14 100644 --- a/lib/accordion/accordion_group.html +++ b/lib/accordion/accordion_group.html @@ -7,7 +7,8 @@

- {{ctrl.heading}} + +

diff --git a/lib/tabs/tab_heading.dart b/lib/tabs/tab_heading.dart index a6dbae6..b43eeb5 100644 --- a/lib/tabs/tab_heading.dart +++ b/lib/tabs/tab_heading.dart @@ -8,6 +8,7 @@ part of angular.ui.tabs; ) class TabHeading { TabHeading(Element elem, TabComponent tab) { + elem.remove(); tab.heading = elem; } }