diff --git a/.gitignore b/.gitignore
index 2b85d59..acccc72 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
.DS_Store
.project
+.packages
.idea
.children
*.dart.js
@@ -8,8 +9,11 @@
*.iml
packages
packages/
-pubspec.lock
.buildlog
content_shell*.zip
drt-*
test.log
+/.settings/
+node_modules
+.pub
+build
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..4df7637
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,7 @@
+language: node_js
+node_js:
+ - "0.11"
+before_install:
+ - export DISPLAY=:99.0
+script:
+ - ./scripts/travis/run_tests.sh
\ No newline at end of file
diff --git a/AUTHORS.md b/AUTHORS.md
new file mode 100644
index 0000000..1c7675d
--- /dev/null
+++ b/AUTHORS.md
@@ -0,0 +1,10 @@
+Contributors in the order of first contribution
+
+* [Sergey Akopkokyants](https://github.com/akserg)
+* [Tõnis Pool](https://github.com/poolik)
+* [Günter Zöchbauer](https://github.com/zoechi)
+* [Francesco Cina](https://github.com/ufoscout)
+* [Neeraj Mittal](https://github.com/neermitt)
+* [Robert Schütte](https://github.com/Roba1993)
+* [Jonathan Hughes](https://github.com/jonathanhughes)
+* [Martynas Kazlauskas](martynas@firmfirm.co)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6306cbc..66d1321 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,23 +1,147 @@
-# Version 0.2.0, In Progress...
+# Version 0.6.13 (2016/26/09)
+
+## Bug Fixes
+
+- Accordion collapsed after initialization with delay [#154](https://github.com/akserg/angular.dart.ui/issues/154)
+- Typeahead highlight only works with the exact match need it to show highlight based on the words [#171](https://github.com/akserg/angular.dart.ui/issues/171)
+
+# Version 0.6.12 (2015/12/04)
+
+## Bug Fixes
+
+- Unit tests fail with issue: The null object does not have a method '[]'
+- Added null check when backdrop is double clicked.
+
+
+# Version 0.6.10-11 (2015/10/08)
+
+## Bug Fixes
+
+- Carousel transition canceled
+
+# Version 0.6.9, (2015/09/24)
+
+## Bug Fixes
+
+- Work around to tab heading issue.
+
+# Version 0.6.8, (2015/03/01)
+
+- Updated Copyright info.
+- Improved documentation for Carousel component and general README file
+
+# Version 0.6.7, (2015/02/27)
+
+## Bug Fixes
+
+- Accordion: double click on title causes inconsistent state or bad rendering
+- Accordion Collapse
+- Accordion doesn't expand after creation if is-open equals true
+- Accordion: fast clicks on title causes inconsistent state or bad rendering
+- Combine slide and angular css files
+
+# Version 0.6.0, (2014/12/12)
+
+- Migration on Angular Dart 1.0, support Bootstrap 3.3.1 and bug fixes.
+
+# Version 0.5.5, (2014/06/25)
+
+## Bug Fixes
+
+- Modal Dialog with backdrop:'static' cannot be closed by click on button with data-dismiss='modal'
+
+# Version 0.5.4, (2014/06/21)
+
+## Bug Fixes
+
+- Error when using typeahead-on-select=ctrl.setSelectedItem($item, $model, $label)
+
+# Version 0.5.3, (2014/06/18)
+
+## Bug Fixes
+
+- Typeahead placement of suggestion popover offset by 200px
+- Fix animation toggle and z-index calculation in ModalWindow
+
+# Version 0.5.2, (2014/06/17)
## Features
-- **alert**
-- **Collapse:**
- - created ([7e8af32](https://github.com/akserg/angular.dart.ui/commit/7e8af32))
-- **DropdownToggle:**
- - merged pull request ([b3753d3](https://github.com/akserg/angular.dart.ui/commit/b3753d3))
-- **alert**
- - created ([6ab5094](https://github.com/akserg/angular.dart.ui/commit/6ab5094))
+- Project migrated to follow Dart SDK 1.4.3
+
+## Bug Fixes
+
+- ModalWindow must call dismiss method of top ModalInstance instead of Modal.close.
+
+# Version 0.5.1, (2014/06/06)
+
+## Features
+
+- Project migrated to follow Angular Dart 0.12.0
+
+# Version 0.5.0, (2014/06/05)
+
+## Features
+
+- All components have migrated away from Shadow DOM and applyAuthorStyles.
+
+## Bug Fixes
+
+- ng-click called multiple times
+- DatePicker tests fail with UTC+1
+
+# Version 0.4.0, (2014/05/16)
+
+## Features
+
+- Carousel
+- Timepicker
+- Pagination
+- Tooltip
+- Popover
+- Typehead
+
+## Bug Fixes
+
+- Classes Popover, Tooltip, ModalWindow, DatePicker compiled to JavaScript don't work proper
+- Error compiling Pagination component to JavaScript
+- Checkbox component doesn't work proper in example
+
+# Version 0.3.0, (2014/04/19)
+
+## Features
+
+- Accordion
+- Datepicker (partially implemented)
+- Rating
+- Tabs
+- Drag and Drop support
+
+## Bug Fixes
+
+- Fixed selectors of all components
+- Fixed unittest for all components
+
+# Version 0.2.0, (2014/02/13)
+
+## Features
+
+- Collapse
+- DropdownToggle
+- Alert
+- Progressbar
+- Modal
+- Timeout
+
+## Bug Fixes
+
+- Transition and Collapse are not working as expected
# Version 0.1.0, (2014/01/14)
## Features
-- **Buttons:**
- - created ([bcedb32](https://github.com/akserg/angular.dart.ui/commit/bcedb32))
-- **Position:**
- - created ([bcedb32](https://github.com/akserg/angular.dart.ui/commit/bcedb32))
-- **Transition:**
- - created ([3894ad9](https://github.com/akserg/angular.dart.ui/commit/3894ad9))
+- Buttons
+- Position
+- Transition
diff --git a/LICENSE.md b/LICENSE.md
index fb65421..10e365a 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,4 +1,4 @@
-Copyright (C) 2013 - 2014 Sergey Akopkokhyants. All rights reserved.
+Copyright (C) 2013 - 2016 Angular Dart UI authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/README.md b/README.md
index 5e17e7a..d5fe880 100644
--- a/README.md
+++ b/README.md
@@ -1,16 +1,70 @@
-angular.dart.ui [](https://drone.io/github.com/akserg/angular.dart.ui/latest)
+Angular UI [](https://travis-ci.org/akserg/angular.dart.ui) [](http://waffle.io/akserg/angular.dart.ui?milestone=0.6) [](https://coveralls.io/r/akserg/angular.dart.ui)
===============
Port of Angular-UI to Dart.
-###Bootstrap directives and components
+Look at [Demo](http://akserg.github.io/angular.dart.ui.demo/index.html) page for this project.
-- **Checkbox and RadioButton**
-- **DropdownToggle**
-- **Collapse**
-- **Alert**
+You may be interesting in check out [Material Design Theme](http://akserg.github.io/angular.dart.material.demo) for this project.
+
+## Quick-Start
+Include the following code to your `index.html`
+```html
+
+
+
+
+
+
+
+
+```
+
+Add the angular-ui module in your `main.dart`
+```dart
+import 'package:angular/angular.dart';
+import 'package:angular/application_factory.dart';
+import 'package:angular_ui/angular_ui.dart';
+
+void main() {
+ applicationFactory()
+ .addModule(new AngularUIModule()) // The angular-ui module
+ .addModule(new MainModule()) // Your own module
+ .run();
+}
+```
+
+Use the angular-ui components as described below or in the [demo](http://akserg.github.io/angular.dart.ui.demo/index.html).
+
+
+##Bootstrap directives and components
+
+- Checkbox and RadioButton
+- DropdownToggle
+- Collapse
+- Alert
+- ProgressBar
+- Modal
+- Accordion
+- Rating
+- Datepicker (partially implemented)
+- Tabs
+- Drag and Drop support
+- Carousel
+- Timepicker
+- Pagination
+- Tooltip
+- Popover
+- Typehead
+
+*Note: Drag and Drop support is experimental feature and API can be changed at any time in the future.*
##Credits
-Big thanks for yours valuable input:
-- **T�nis Pool** (https://github.com/poolik).
-- **AngularDart project** (https://github.com/angular/angular.dart)
\ No newline at end of file
+
+- [Sergey Akopkokhyants](https://github.com/akserg)
+- [Tõnis Pool](https://github.com/poolik).
+- [Günter Zöchbauer](https://github.com/zoechi)
+- [Francesco Cina](https://github.com/ufoscout)
+- [AngularDart project](https://github.com/angular/angular.dart)
+- [Neeraj Mittal](https://github.com/neermitt)
+- [Robert Schütte](https://github.com/Roba1993)
\ No newline at end of file
diff --git a/karma.conf.js b/karma.conf.js
new file mode 100644
index 0000000..c21bab4
--- /dev/null
+++ b/karma.conf.js
@@ -0,0 +1,27 @@
+module.exports = function(config) {
+ config.set({
+ basePath: '.',
+ frameworks: ['dart-unittest'],
+
+ files: [
+ {pattern: 'test/angular_ui_tests.dart', included: true},
+ {pattern: '**/*.dart', included: false},
+ {pattern: '**/*.html', included: false}
+ ],
+
+ exclude: [
+ ],
+
+ autoWatch: true,
+ captureTimeout: 60000,
+ browserNoActivityTimeout: 300000,
+
+
+ plugins: [
+ 'karma-dart',
+ 'karma-chrome-launcher'
+ ],
+
+ browsers: ['Dartium']
+ });
+};
diff --git a/lib/.settings/org.eclipse.core.resources.prefs b/lib/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/lib/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/=UTF-8
diff --git a/lib/README.md b/lib/README.md
new file mode 100644
index 0000000..b4d552e
--- /dev/null
+++ b/lib/README.md
@@ -0,0 +1 @@
+**AngularUI** module.
\ No newline at end of file
diff --git a/lib/accordion/README.md b/lib/accordion/README.md
new file mode 100644
index 0000000..e861814
--- /dev/null
+++ b/lib/accordion/README.md
@@ -0,0 +1,3 @@
+The **accordion directive** builds to provide a list of items, with collapsible bodies that are collapsed or expanded by clicking on the item's header.
+We can control whether expanding an item will cause the other items to close, using the `close-others` attribute on accordion.
+The body of each accordion group is transcluded in to the body of the collapsible element.
\ No newline at end of file
diff --git a/lib/accordion/accordion.dart b/lib/accordion/accordion.dart
new file mode 100644
index 0000000..7f2cdb5
--- /dev/null
+++ b/lib/accordion/accordion.dart
@@ -0,0 +1,86 @@
+// Copyright (C) 2013 - 2015 Angular Dart UI authors. Please see AUTHORS.md.
+// https://github.com/akserg/angular.dart.ui
+// All rights reserved. Please see the LICENSE.md file.
+library angular.ui.accordion;
+
+import 'dart:html' as dom;
+import "package:angular/angular.dart";
+import 'package:angular/utils.dart' as utils;
+import 'package:logging/logging.dart' show Logger;
+import 'package:angular_ui/utils/dbl_click_preventer.dart';
+import 'package:angular_ui/utils/timeout.dart';
+
+part 'accordion_group.dart';
+
+final _log = new Logger('angular.ui.accordion');
+
+class AccordionModule extends Module {
+ AccordionModule() {
+ install(new DblClickPreventerModule());
+ bind(AccordionComponent);
+ bind(AccordionHeadingComponent);
+ bind(AccordionGroupComponent);
+ bind(AccordionTransclude);
+ bind(AccordionConfig, toValue:new AccordionConfig());
+ }
+}
+
+@Injectable()
+class AccordionConfig {
+ bool closeOthers = true;
+}
+
+@Component(
+ selector: 'accordion',
+ //templateUrl: 'packages/angular_ui/accordion/accordion.html',
+ template: '
',
+ useShadowDom: false
+)
+//@Component(
+// selector: '[accordion]',
+// templateUrl: 'packages/angular_ui/accordion/accordion.html',
+// useShadowDom: false
+//)
+class AccordionComponent implements ScopeAware {
+
+ @NgTwoWay('close-others')
+ bool isCloseOthers;
+
+ Scope scope;
+ final AccordionConfig _config;
+
+ /*
+ * This array keeps track of the accordion groups
+ */
+ List groups = [];
+
+ AccordionComponent(this._config);
+
+ /*
+ * Ensure that all the groups in this accordion are closed, unless close-others explicitly says not to
+ */
+ void closeOthers(AccordionGroupComponent openGroup) {
+ isCloseOthers = isCloseOthers != null ? isCloseOthers : _config.closeOthers;
+ if (isCloseOthers) {
+ groups.forEach((AccordionGroupComponent e) {
+ if(e != openGroup) {
+ e.isOpen = false;
+ }
+ });
+ }
+ }
+
+ /*
+ * This is called from the accordion-group directive to add itself to the accordion
+ */
+ void addGroup(AccordionGroupComponent groupScope) {
+ groups.add(groupScope);
+ }
+
+ /*
+ * This is called from the accordion-group directive when to remove itself
+ */
+ void removeGroup(AccordionGroupComponent groupScope) {
+ groups.remove(groupScope);
+ }
+}
diff --git a/lib/accordion/accordion.html b/lib/accordion/accordion.html
new file mode 100644
index 0000000..93287ec
--- /dev/null
+++ b/lib/accordion/accordion.html
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/lib/accordion/accordion_group.dart b/lib/accordion/accordion_group.dart
new file mode 100644
index 0000000..e41ef99
--- /dev/null
+++ b/lib/accordion/accordion_group.dart
@@ -0,0 +1,118 @@
+// Copyright (C) 2013 - 2015 Angular Dart UI authors. Please see AUTHORS.md.
+// https://github.com/akserg/angular.dart.ui
+// All rights reserved. Please see the LICENSE.md file.
+part of angular.ui.accordion;
+
+@Component(
+ selector: 'accordion-group',
+// templateUrl: 'packages/angular_ui/accordion/accordion_group.html',
+ template: r'''
+
diff --git a/lib/alert.dart b/lib/alert.dart
deleted file mode 100644
index d49fe01..0000000
--- a/lib/alert.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2013 - 2014, akserg (Sergey Akopkokhyants)
-// https://github.com/akserg/angular.dart.ui
-// All rights reserved. Please see the LICENSE.md file.
-library angular.ui.alert;
-
-import "package:angular/angular.dart";
-
-/**
- * Alert Module.
- */
-class AlertModule extends Module {
- AlertModule() {
- type(Alert);
- }
-}
-
-/**
- * Alert component.
- */
-@NgComponent(selector: 'alert', publishAs: 't', applyAuthorStyles: true,
- templateUrl: 'packages/angular_ui/alert.html')
-class Alert {
- @NgOneWay('type')
- String type;
-
- @NgCallback('close')
- var close;
-
- /**
- * Flag helps show or hide close button depends on availability of [close]
- * attribute.
- */
- bool get showable => (close as BoundExpression).expression.isChain;
-
- /**
- * Thst method calls [close] callback
- */
- void closeHandler() {
- close();
- }
-}
\ No newline at end of file
diff --git a/lib/alert.html b/lib/alert.html
deleted file mode 100644
index 8abc24f..0000000
--- a/lib/alert.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/lib/alert/README.md b/lib/alert/README.md
new file mode 100644
index 0000000..e25e11f
--- /dev/null
+++ b/lib/alert/README.md
@@ -0,0 +1,3 @@
+**Alert** is an Angular Dart version of bootstrap's alert.
+This directive can be used to generate alerts from the dynamic model data (using the ng-repeat directive);
+The presence of the "close" attribute determines if a close button is displayed.
diff --git a/lib/alert/alert.dart b/lib/alert/alert.dart
new file mode 100644
index 0000000..fab435c
--- /dev/null
+++ b/lib/alert/alert.dart
@@ -0,0 +1,58 @@
+// Copyright (C) 2013 - 2015 Angular Dart UI authors. Please see AUTHORS.md.
+// https://github.com/akserg/angular.dart.ui
+// All rights reserved. Please see the LICENSE.md file.
+library angular.ui.alert;
+
+import "package:angular/angular.dart";
+import "package:angular/core_dom/module_internal.dart";
+
+/**
+ * Alert Module.
+ */
+class AlertModule extends Module {
+ AlertModule() {
+ bind(Alert);
+ }
+}
+
+/**
+ * Alert component.
+ */
+@Component(selector: 'alert',
+ useShadowDom: false,
+// templateUrl: 'packages/angular_ui/alert/alert.html'
+ template: '''
+
+
+
+
'''
+)
+//@Component(selector: '[alert]',
+// useShadowDom: false,
+// templateUrl: 'packages/angular_ui/alert/alert.html')
+class Alert implements ScopeAware {
+ @NgOneWay('type')
+ String type;
+
+ @NgCallback('close')
+ var close;
+
+ Scope scope;
+
+ /**
+ * Flag helps show or hide close button depends on availability of [close]
+ * attribute.
+ */
+ var _closeable = false;
+ bool get closeable => _closeable;
+
+ /**
+ * Calculate and return alert type as string depnds on type. If type is null
+ * methods returns 'warning' as default value.
+ */
+ String get alertTypeAsString => "alert-${type != null ? type : 'warning'}";
+
+ Alert(NodeAttrs attr) {
+ _closeable = attr.containsKey('close');
+ }
+}
\ No newline at end of file
diff --git a/lib/alert/alert.html b/lib/alert/alert.html
new file mode 100644
index 0000000..83d6ed7
--- /dev/null
+++ b/lib/alert/alert.html
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/angular_ui.dart b/lib/angular_ui.dart
index 91a0c9c..4716a97 100644
--- a/lib/angular_ui.dart
+++ b/lib/angular_ui.dart
@@ -1,26 +1,60 @@
-// Copyright (c) 2013 - 2014, akserg (Sergey Akopkokhyants)
+// Copyright (C) 2013 - 2015 Angular Dart UI authors. Please see AUTHORS.md.
// https://github.com/akserg/angular.dart.ui
// All rights reserved. Please see the LICENSE.md file.
library angular.ui;
import "package:angular/angular.dart";
-import 'package:angular_ui/buttons.dart';
-import 'package:angular_ui/collapse.dart';
-import 'package:angular_ui/dropdown_toggle.dart';
-import 'package:angular_ui/alert.dart';
-import 'package:angular_ui/carousel.dart';
+import 'package:angular_ui/alert/alert.dart';
+import 'package:angular_ui/accordion/accordion.dart';
+import 'package:angular_ui/buttons/buttons.dart';
+import 'package:angular_ui/carousel/carousel.dart';
+import 'package:angular_ui/collapse/collapse.dart';
+import 'package:angular_ui/dropdown/dropdown_toggle.dart';
+import 'package:angular_ui/pagination/pagination.dart';
+import 'package:angular_ui/progressbar/progressbar.dart';
+import 'package:angular_ui/rating/rating.dart';
+import 'package:angular_ui/tabs/tabset.dart';
+import 'package:angular_ui/utils/content_append.dart';
+import 'package:angular_ui/utils/timeout.dart';
+import 'package:angular_ui/utils/transition.dart';
+import 'package:angular_ui/modal/modal.dart';
+import 'package:angular_ui/dragdrop/dragdrop.dart';
+import 'package:angular_ui/datepicker/datepicker.dart';
+import 'package:angular_ui/timepicker/timepicker.dart';
+import 'package:angular_ui/tooltip/tooltip.dart';
+import 'package:angular_ui/popover/popover.dart';
+import 'package:angular_ui/typeahead/module.dart';
+import 'package:angular_ui/utils/dbl_click_preventer.dart';
+
+export 'package:angular_ui/modal/modal.dart';
/**
* AngularUI Module
*/
class AngularUIModule extends Module {
AngularUIModule() {
+ install(new AlertModule());
+ install(new AccordionModule());
install(new ButtonModule());
+ install(new CarouselModule());
install(new CollapseModule());
+ install(new DragDropModule());
install(new DropdownToggleModule());
- install(new AlertModule());
- install(new CarouselModule());
+ install(new PaginationModule());
+ install(new ProgressbarModule());
+ install(new RatingModule());
+ install(new TabsModule());
+ install(new TimeoutModule());
+ install(new TransitionModule());
+ install(new ModalModule());
+ install(new DatepickerModule());
+ install(new TimepickerModule());
+ install(new TooltipModule());
+ install(new PopoverModule());
+ install(new TypeaheadModule());
+ install(new ContentAppendModule());
+ install(new DblClickPreventerModule());
}
}
diff --git a/lib/buttons/README.md b/lib/buttons/README.md
new file mode 100644
index 0000000..73ef600
--- /dev/null
+++ b/lib/buttons/README.md
@@ -0,0 +1,2 @@
+There are 2 directives that can make a group of buttons to behave like a set of checkboxes or radio buttons.
+
diff --git a/lib/buttons.dart b/lib/buttons/buttons.dart
similarity index 69%
rename from lib/buttons.dart
rename to lib/buttons/buttons.dart
index 4fb20dd..b183567 100644
--- a/lib/buttons.dart
+++ b/lib/buttons/buttons.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 - 2014, akserg (Sergey Akopkokhyants)
+// Copyright (C) 2013 - 2015 Angular Dart UI authors. Please see AUTHORS.md.
// https://github.com/akserg/angular.dart.ui
// All rights reserved. Please see the LICENSE.md file.
library angular.ui.buttons;
@@ -11,9 +11,9 @@ import "package:angular/angular.dart";
*/
class ButtonModule extends Module {
ButtonModule() {
- value(ButtonConfig, new ButtonConfig(activeClass:'active', toggleEvent: 'click'));
- type(BtnRadio);
- type(BtnCheckbox);
+ bind(ButtonConfig, toValue:new ButtonConfig(activeClass:'active', toggleEvent: 'click'));
+ bind(BtnRadio);
+ bind(BtnCheckbox);
}
}
@@ -24,13 +24,13 @@ class ButtonConfig {
String activeClass;
String toggleEvent;
- ButtonConfig({this.activeClass, this.toggleEvent});
+ ButtonConfig({this.activeClass:'active', this.toggleEvent:'click'});
}
/**
* Radio button directive.
*/
-@NgDirective(selector:'[btn-radio]')
+@Decorator(selector:'[btn-radio]')
class BtnRadio {
@NgAttr("btn-radio")
@@ -45,13 +45,15 @@ class BtnRadio {
BtnRadio(this.element, this.ngModel, this.config, this.scope) {
// model -> UI
ngModel.render = (value) {
- element.classes.toggle(config.activeClass, ngModel.modelValue == scope.$eval(btnRadioAttr));
+ element.classes.toggle(config.activeClass, ngModel.modelValue == scope.eval(btnRadioAttr));
};
// ui -> model
element.on[config.toggleEvent].listen((dom.Event event) {
if (!element.classes.contains(config.activeClass)) {
- ngModel.viewValue = scope.$eval(btnRadioAttr);
+ ngModel.markAsTouched();
+ ngModel.viewValue = scope.eval(btnRadioAttr);
+ ngModel.render(ngModel.modelValue);
}
});
}
@@ -60,7 +62,7 @@ class BtnRadio {
/**
* Checkbox button directive
*/
-@NgDirective(selector:'[btn-checkbox]')
+@Decorator(selector:'[btn-checkbox]')
class BtnCheckbox {
ButtonConfig config;
NgModel ngModel;
@@ -79,7 +81,7 @@ class BtnCheckbox {
dynamic get falseValue => getCheckboxValue(btnCheckboxFalse, false);
dynamic getCheckboxValue(attributeValue, defaultValue) {
- var val = scope.$eval(attributeValue);
+ var val = scope.eval(attributeValue);
return val != null ? val : defaultValue;
}
@@ -91,7 +93,14 @@ class BtnCheckbox {
// ui -> model
element.on[config.toggleEvent].listen((dom.Event event) {
+ // We need remove focus out of the element because it doesn't change the state
+ element.blur();
+ ngModel.markAsTouched();
ngModel.viewValue = element.classes.contains(config.activeClass) ? falseValue : trueValue;
+ ngModel.render(ngModel.modelValue);
+ });
+ element.onBlur.listen((e) {
+ ngModel.markAsTouched();
});
}
}
\ No newline at end of file
diff --git a/lib/carousel.dart b/lib/carousel.dart
deleted file mode 100644
index 87b3b7a..0000000
--- a/lib/carousel.dart
+++ /dev/null
@@ -1,286 +0,0 @@
-// Copyright (c) 2013 - 2014, akserg (Sergey Akopkokhyants)
-// https://github.com/akserg/angular.dart.ui
-// All rights reserved. Please see the LICENSE.md file.
-library angular.ui.carousel;
-
-import 'dart:html' as dom;
-import 'dart:async' as async;
-import "package:angular/angular.dart";
-import 'transition.dart';
-import 'timeout.dart';
-
-/**
- * Carousel Module.
- */
-class CarouselModule extends Module {
- CarouselModule() {
- install(new TransitionModule());
- type(CarouselController);
- type(Carousel);
- type(Slide);
- }
-}
-
-class CarouselController {
- List slides = [];
- var currentIndex = -1;
- var currentTimeout;
- var isPlaying = false;
- Slide currentSlide;
-
- var destroyed = false;
-
- Scope scope;
- Transition transition;
- Timeout timeout;
-
- CarouselController(this.scope, this.transition, this.timeout) {
- scope.$on('destroy', () {
- destroyed = true;
- });
-
- scope.next = () {
- var newIndex = (currentIndex + 1) % slides.length;
-
- //Prevent this user-triggered transition from occurring if there is already one in progress
- if (scope.currentTransition == null) {
- return select(slides[newIndex], direction:'next');
- }
- };
-
- scope.prev = () {
- var newIndex = currentIndex - 1 < 0 ? slides.length - 1 : currentIndex - 1;
-
- //Prevent this user-triggered transition from occurring if there is already one in progress
- if (scope.currentTransition == null) {
- return select(slides[newIndex], direction:'prev');
- }
- };
-
- scope.select = (slide) {
- select(slide);
- };
-
- scope.isActive = (slide) {
- return currentSlide == slide;
- };
-
- scope.slides = () {
- return slides;
- };
-
- scope.$watch('interval', restartTimer);
- scope.$on('destroy', resetTimer);
-
- scope.play = () {
- if (!isPlaying) {
- isPlaying = true;
- restartTimer();
- }
- };
-
- scope.pause = () {
- if (!scope.noPause) {
- isPlaying = false;
- resetTimer();
- }
- };
- }
-
- void select(Slide nextSlide, {String direction:null}) {
- var nextIndex = slides.indexOf(nextSlide);
- // Decide direction if it's not given
- if (direction == null) {
- direction = nextIndex > currentIndex ? 'next' : 'prev';
- }
- if (nextSlide != null && nextSlide != currentSlide) {
- var goNext = () {
- // Scope has been destroyed, stop here.
- if (destroyed) { return; }
- //
- var transitionDone = (Slide next, Slide current) {
- next.direction = '';
- next.entering = false;
- next.leaving = false;
- next.active = true;
- //
- if (current != null) {
- current.direction = '';
- current.entering = false;
- current.leaving = false;
- current.active = false;
- }
- scope.currentTransition = null;
- };
- // If we have a slide to transition from and we have a transition type and we're allowed, go
- if (currentSlide != null && !scope.noTransition && nextSlide.element != null) {
- // We shouldn't do class manip in here, but it's the same weird thing bootstrap does. need to fix sometime
- nextSlide.element.classes.add(direction);
- var reflow = nextSlide.element.offsetWidth; //force reflow
-
- //Set all other slides to stop doing their stuff for the new transition
- slides.forEach((slide) {
- //angular.extend(slide, {direction: '', entering: false, leaving: false, active: false});
- slide.direction = '';
- slide.entering = false;
- slide.leaving = false;
- slide.active = false;
- });
-
- nextSlide.direction = direction;
- nextSlide.entering = true;
- nextSlide.active = true;
-
- if (currentSlide != null) {
- currentSlide.direction = direction;
- currentSlide.leaving = true;
- }
-
- scope.currentTransition = transition(nextSlide.element, {});
-
- // We have to create new pointers inside a closure since next & current will change
- var closure = (next, current) {
- (scope.currentTransition as async.Completer).future.then((onValue) {
- transitionDone(next, current);
- }, onError:(e) {
- transitionDone(next, current);
- });
- };
- //
- closure(nextSlide, currentSlide);
- } else {
- transitionDone(nextSlide, currentSlide);
- }
- currentSlide = nextSlide;
- currentIndex = nextIndex;
- //every time you change slides, reset the timer
- restartTimer();
- };
-
- if (scope.currentTransition != null) {
- (scope.currentTransition as async.Completer).completeError('Transition cancelled');
- //Timeout so ng-class in template has time to fix classes for finished slide
- timeout(goNext);
- } else {
- goNext();
- }
- }
- }
-
- /* Allow outside people to call indexOf on slides array */
- int indexOfSlide (slide) {
- return slides.indexOf(slide);
- }
-
- void restartTimer() {
- resetTimer();
- var interval = scope.interval;
- if (interval != null && interval >= 0) {
- currentTimeout = timeout(timerFn, delay:interval);
- }
- }
-
- void resetTimer() {
- if (currentTimeout != null) {
- timeout.cancel(currentTimeout);
- currentTimeout = null;
- }
- }
-
- void timerFn() {
- if (isPlaying) {
- scope.next();
- restartTimer();
- } else {
- scope.pause();
- }
- }
-
- void addSlide(slide, element) {
- slide.element = element;
- slides.add(slide);
- //if this is the first slide or the slide is set to active, select it
- if(slides.length == 1 || slide.active) {
- select(slides[slides.length-1]);
- if (slides.length == 1) {
- scope.play();
- }
- } else {
- slide.active = false;
- }
- }
-
- void removeSlide(slide) {
- //get the index of the slide inside the carousel
- var index = slides.indexOf(slide);
- slides.removeAt(index);
- if (slides.length > 0 && slide.active) {
- if (index >= slides.length) {
- select(slides[index-1]);
- } else {
- select(slides[index]);
- }
- } else if (currentIndex > index) {
- currentIndex--;
- }
- }
-}
-
-/**
- * Carousel component.
- */
-@NgComponent(selector: 'carousel', publishAs: 'c', applyAuthorStyles: true,
- template: '''
-
''')
-class Carousel {
-
-}
-
-/**
- * Slide component.
- * Creates a slide inside a [Carousel] component.
- * Must be placed as a child of a Carousel element.
- */
-@NgComponent(selector: 'slide', publishAs: 's', applyAuthorStyles: true,
- template:'''
-
-''')
-class Slide {
- @NgTwoWay('active')
- bool active = false;
-
- var direction = '';
- var entering = false;
- var leaving = false;
-
- var scope;
- dom.Element element;
- var carouselCtrl;
-
- Slide(Scope this.scope, dom.Element this.element, this.carouselCtrl) {
- carouselCtrl.addSlide(scope, element);
- //when the scope is destroyed then remove the slide from the current slides array
- scope.$on('destroy', () {
- carouselCtrl.removeSlide(scope);
- });
-
- scope.$watch('active', (active) {
- if (active) {
- carouselCtrl.select(scope);
- }
- });
- }
-}
\ No newline at end of file
diff --git a/lib/carousel/README.md b/lib/carousel/README.md
new file mode 100644
index 0000000..100e1e3
--- /dev/null
+++ b/lib/carousel/README.md
@@ -0,0 +1,55 @@
+**Carousel** creates a carousel similar to bootstrap's image carousel.
+Use a `` element with `` elements inside it. It will automatically cycle through the slides at a given rate, and a current-index variable will be kept in sync with the currently visible slide.
+
+## Demo
+Use the `` element in your html
+```html
+
+
+
+
+
+
Slide {{$index}}
+
{{item['text']}}
+
+
+
+
+```
+
+Generate the slide content in dart
+```dart
+@Component(
+ selector: 'carousel-demo',
+ templateUrl: 'your_html.html',
+ useShadowDom: false)
+class CarouselDemo {
+ List