Commit Graph

558 Commits

Author SHA1 Message Date
Tobias Bosch ac52bfd80f fix(render): create svg elements with the right namespace
Temporary fix for #4506
Closes #4949
2015-10-27 14:45:00 -07:00
Tobias Bosch 27dbd2ded4 fix(compiler): load style urls in runtime mode correctly
Closes #4952
2015-10-27 14:31:21 -07:00
vsavkin ed4826b08c feat(forms): Implement a way to manually set errors on a control
Example:

var login = new Control("someLogin");
c.setErrors({"notUnique": true});
expect(c.valid).toEqual(false);
expect(c.errors).toEqual({"notUnique": true});

c.updateValue("newLogin");
expect(c.valid).toEqual(true);

BREAKING CHANGE:

Before:

ControlGroup.errors and ControlArray.errors returned a reduced value of their children controls' errors.

After:

ControlGroup.errors and ControlArray.errors return the errors of the group and array.
And ControlGroup.controlsErrors and ControlArray.controlsErrors return the reduce value of their children controls' errors.

Closes #4917
2015-10-27 19:31:25 +00:00
Tobias Bosch d8b3601927 fix(style_url_resolver): include `asset:` urls into precompiled stylesheets.
Closes #4926
2015-10-26 17:19:33 -07:00
Tobias Bosch 60bedb43de fix(debug_element): don’t descend into merged embedded views on `componentChildren`.
Closes #4920
2015-10-26 16:39:49 -07:00
Tobias Bosch b2dc5c2c7e fix(compiler): create literal property bindings for empty *… directives.
Closes #4916
2015-10-26 13:55:34 -07:00
Tobias Bosch 2957b0b32e fix(ng_class): support sets correctly
Previously, NgClass threw in Dart checked mode.

Closes #4910
2015-10-26 13:37:33 -07:00
vsavkin 28db864690 cleanup(forms): add missing tests 2015-10-26 11:50:30 -07:00
Ted Sander 28d88c5b12 feat(validators): Allow errors at both the group/array level or their children
Allow ControlGroups and ControlArrays to contain errors from their level, and
errors from their children. [Design Doc](https://docs.google.com/document/d/1EnJ3-_iFpVKFz1ifN1LkXSGQ7h3A72OQGry2g8eo7IA/edit?pli=1#heading=h.j53rt81eegm4)

BREAKING CHANGE: errors format has changed from validators. Now errors from
a control or an array's children are prefixed with 'controls' while errors
from the object itself are left at the root level.
Example:
Given a Control group as follows:
var group = new ControlGroup({
  login: new Control("", required),
  password: new Control("", required),
  passwordConfirm: new Control("", required)
});

Before:
group.errors

{
  login: {required: true},
  password: {required: true},
  passwordConfirm: {required: true},
}

After:
group.errors

{
  controls: {
    login: {required: true},
    password: {required: true},
    passwordConfirm: {required: true},
  }
}
2015-10-26 11:48:32 -07:00
Ted Sander c9fba3fa1f feat(validators): Add a pending state to AbstractControl
Add a pending state to AbstractControl and a function to set that state on
themselves and their parents. This will be used for both individual async
validators and when the imperitive mode is used. [Design Doc](https://docs.google.com/document/d/1EnJ3-_iFpVKFz1ifN1LkXSGQ7h3A72OQGry2g8eo7IA/edit?pli=1#heading=h.j53rt81eegm4)
2015-10-26 11:48:32 -07:00
Victor Berchet 04b4035ecd refactor(AppViewListener): prefix listener with on for consistency
Closes #3925
2015-10-26 18:28:27 +00:00
mikael d29a9a99aa fix(forms): handle control change in NgFormControl
when a new Control instance is bound to the directive, use the new instance, not the old one
2015-10-26 18:15:58 +00:00
Tobias Bosch 3118d5cebb fix(compiler): support events on a template element that are consumed via a direct expression
Closes #4883
2015-10-26 10:45:01 -07:00
Tobias Bosch 56a9b020d4 fix(default_value_accessor): support custom input elements that fire custom change events.
Closes #4878
2015-10-26 14:33:47 +00:00
Victor Berchet 4639f449cf feat(Parser): associate pipes right to left
closes #4605

BREAKING CHANGE:

Before:

`1 + 1 | pipe:a | pipe:b` was parsed as `(1 + 1) | pipe:(a | pipe:b)`

After:

`1 + 1 | pipe:a | pipe:b` is parsed as `((1 + 1) | pipe:a) | pipe:b`

Closes #4716
2015-10-21 18:43:10 +00:00
Yegor Jbanov 77604b8b18 chore: add test showing CSS calc() failure 2015-10-21 11:02:55 -07:00
Yegor Jbanov 491e1fdd2c feat: move NgZone to Stream/Observable-based callback API
BREAKING CHANGES:
- deprecates these methods in NgZone: overrideOnTurnStart, overrideOnTurnDone, overrideOnEventDone, overrideOnErrorHandler
- introduces new API in NgZone that may shadow other API used by existing applications.
2015-10-20 21:51:19 -07:00
Yegor Jbanov 711dbf4975 fix(compiler): do not match directives to variable names
BREAKING CHANGES:
- you can no longer use a #foo or a var-foo to apply directive [foo], although
  it didn't work properly anyway.

This commit is fixing breakage caused by the switch to pre-compiler (exact SHA
unknown).
2015-10-20 20:31:55 -07:00
Victor Berchet 0a940211d5 feat(change detection): remove support for "if"
BREAKING CHANGE: Remove if statement support from actions.

Closes #4616
2015-10-20 18:15:08 +00:00
Tim Blasi fd0ba37734 refactor(dart): Format Dart code
Use the dart formatter to clean up all pure Dart code.

Closes #4832
2015-10-20 17:39:37 +00:00
Tobias Bosch fd9b67537d fix(url_resolver): always replace `package:` in Dart, even if it came from `baseUrl`.
Closes #4775
2015-10-15 16:57:54 -07:00
vsavkin 65c737fc95 feat(forms): add input[type=number] value accessor
Closes #4014

Closes #4761
2015-10-15 18:41:17 +00:00
Marc Laval 427860a5bd chore(saucelabs): add Edge
Closes #4758
2015-10-15 18:20:41 +00:00
Tobias Bosch a941fb08f7 fix(style_compiler): don’t resolve absolute urls that start with a `/` during compilation
Closes #4763
2015-10-15 11:13:52 -07:00
Tobias Bosch cec8b58373 fix(compiler): explicitly support event bindings also on `<template>` elements
Although these events don’t fire events themselves, there might be directives on them that fire events.

Closes #4712
2015-10-15 10:08:22 -07:00
Marc Laval b89c5bc581 fix(compiler): attribute case in IE9
Closes #4743
2015-10-15 10:18:15 +02:00
Tobias Bosch 7dde18b181 fix(style_compiler): don’t touch urls in stylesheets and keep stylesheets with absolute urls in templates
We can’t resolve relative urls (e.g. for images) in the compiler as
these urls are meant to be loaded in the browser
(unless we would inline images as base64…).

Also, keep `<link rel=“stylesheet”>` in templates that
reference absolute urls with e.g. `http://`. This
behavior was already present for `@import` rules
within stylesheets.
Closes #4740
2015-10-15 01:42:48 +00:00
Kevin Moore a91ae291e4 fix(test) fix Dart annotation for integration_dart_spec.dart 2015-10-15 00:19:31 +00:00
vsavkin b716d2335b fix(forms): emit value changes after errors and status are set
Closes #4714
2015-10-14 19:36:43 +00:00
vsavkin bfbf18d983 feat(query): add filter and reduce to QueryList
Closes #4710
2015-10-13 23:52:17 +00:00
vsavkin e82a35d1fd feat(forms): add minlength and maxlength validators
Closes #4705
2015-10-13 21:42:12 +00:00
Marc Laval e15e2428c5 fix(test): command compiler attr merge test in IE 2015-10-13 13:39:32 -07:00
Julie Ralph f529236bfc refactor(test): rename test_lib to testing
Old test_lib is now testing_internal
test_lib_public is now testing
2015-10-13 10:36:49 -07:00
vsavkin 1aeafd31bd feat(di): change the params of Provider and provide to start with "use"
Closes #4684
2015-10-12 21:09:09 +00:00
Igor Minar 6abed8d996 fix(test_lib): don't mock out XHR via MockXHR by default in tests
This is useful for the compiler tests, but otherwise it's not useful.

Additionally if an application has external templates (as is common) then
we should actually fetch these templates in tests.

Fixes #4539

Closes #4682
2015-10-12 17:45:19 +00:00
Tobias Bosch eacc8e3803 fix(compiler): merge `class` and `style` attributes from the element with the host attributes
Closes #4583
Closes #4680
2015-10-12 15:35:49 +00:00
Marc Laval 0def28e594 fix(compiler): shadow CSS @import test in some browsers
Closes #4629
2015-10-12 00:28:07 +02:00
vsavkin 1eb0162cde feat(di): rename Binding into Provider
Closes #4416

Closes #4654
2015-10-11 05:13:31 +00:00
vsavkin 7c6130c2c5 feat(core): desugar [()] to [prop] and (prop-change)
BREAKING CHANGE

Before

```
<cmp [(prop)]="field"> was desugared to <cmp [prop]="field" (prop)="field=$event">
```

After
```
<cmp [(prop)]="field"> is desugared to <cmp [prop]="field" (prop-change)="field=$event">
```

Closes #4658
2015-10-11 02:58:13 +00:00
Misko Hevery cd90e6ed8f feat(ngUpgrade): support for content project from ng1->ng2 2015-10-09 21:25:45 -07:00
Alex Eagle 95f984615b Produce .d.ts files from our typescript compilation.
Deliver them into our npm module output so users can consume them directly.

Fixes #3082
2015-10-10 02:18:33 +00:00
Tobias Bosch 6207b1af88 feat(ngFor): support a custom template
Part of #1989

Closes #4637
2015-10-09 21:52:59 +00:00
Victor Berchet a8c34ae290 refactor(MapWrapper): drop delete(), get(), forEach() and size
Closes #4618
2015-10-09 20:07:43 +00:00
vsavkin bba0248989 fix(core): remove NgZone_ and use NgZone instead 2015-10-08 13:55:26 -07:00
vsavkin 14fa00791e fix(analyzer): fix dart analyzer errors 2015-10-08 13:54:44 -07:00
vsavkin d63f3c123e fix benchmarks 2015-10-08 13:54:44 -07:00
vsavkin 8b725c77fd fix(tests): fix tests 2015-10-08 13:54:44 -07:00
Alex Eagle 5458036de7 fix(typings): update test.typings for abstract superclasses 2015-10-08 13:54:43 -07:00
Alex Eagle 6075509f26 chore(typing): extract abstract superclasses to replace @private constructors 2015-10-08 13:54:43 -07:00
Tobias Bosch 6d4bd5d901 fix(render): recurse into components/embedded templates not until all elements in a view have been visited
Fixes #4551
Closes #4601
2015-10-08 11:43:21 -07:00
Yegor Jbanov 04b3dee667 fix(css): when compiling CSS, leave absolute imports alone
Closes #4592
2015-10-08 16:39:32 +00:00
Victor Berchet aee176115b refactor(ListWrapper): drop forEach and removeLast
Closes #4584
2015-10-07 17:17:31 +00:00
Victor Berchet a0277f1b3a refactor: add missing types for ts2dart
Closes #4568
2015-10-07 06:39:14 +00:00
Victor Berchet aaa215514b refactor(ListWrapper): get ride of ListWrapper.map 2015-10-07 06:39:14 +00:00
vsavkin dea6a4593b cleanup(core): making @View optional
Closes #4566
2015-10-07 02:16:42 +00:00
vsavkin bd31b01690 feat(core): add syntax sugar to make @View optional 2015-10-07 02:16:42 +00:00
Alex Eagle 6093e28b61 fix(typings): repair broken typechecks
We had the typechecker disabled by accident, and many problems snuck in

Fixes #4507

Closes #4508
2015-10-06 13:28:17 +00:00
Tobias Bosch 0b3e4fa090 refactor(core): move `ViewEncapsulation` and `ViewType` to the right places
Closes #4526
2015-10-05 11:22:21 -07:00
Tobias Bosch 0299d4af00 fix(core): keep styles for `ViewEncapsulation.Native` isolated per component
BREAKING CHANGE:
- `Renderer.registerComponent` now takes an additional argument.

Fixes #4513
Closes #4524
2015-10-05 10:34:42 -07:00
Tobias Bosch a9aef8e5e6 fix(core): set `ViewEncapsulation.Emulated` as the default again
Fixes #4494
2015-10-05 10:33:58 -07:00
Tobias Bosch 6fe8b85295 fix(render): keep bindings of components in content and view in the right order
Bindings in the component view have to be first, before 
bindings of components in the light dom (i.e. have the same
order as used in the `ViewManagerUtils.createView()` method.

Fixes #4522
Closes #4523
2015-10-05 10:10:47 -07:00
Alex Eagle 208f3d4c65 fix(typings): repair broken type-checking for StringMap
Note that the previous type of StringMap was overly permissive and didn't catch errors.
Also we have to explicitly type empty objects, which is explained here:
https://github.com/Microsoft/TypeScript/issues/5089

Closes #4487
2015-10-03 01:09:42 +00:00
Alex Eagle 7c4199cd1c chore(typings): remove StringMap
This was a poorly typed attempt to mimic TypeScript's index signatures,
which we can use instead.
This eliminates a very strange type that we were exposing to users, but
not re-exporting through our public API.

Fixes #4483
2015-10-03 01:09:42 +00:00
vsavkin c9901c5fe0 feat(core): support properties and events in addition to inputs and outputs to make transition easier
Closes #4482
2015-10-02 23:23:15 +00:00
Tobias Bosch 13161ae5aa refactor(core): move APP_ID from render/dom/dom_tokens into application_tokens 2015-10-02 13:38:52 -07:00
Tobias Bosch 6b5d345a2b refactor(core): adjust imports for move files to the right place
- render/xhr_* -> compiler/xhr_*
- render/event_config -> linker/event_config
- render/dom/schema -> compiler/schema
- render/dom/compiler/* -> compiler/*
- render/dom/view/shared_styles_host -> render/dom/shared_styles_host
2015-10-02 13:38:51 -07:00
Tobias Bosch 2450a3c5b0 refactor(core): move files to the right place
- render/xhr_* -> compiler/xhr_*
- render/event_config -> linker/event_config
- render/dom/schema -> compiler/schema
- render/dom/compiler/* -> compiler/*
- render/dom/view/shared_styles_host -> render/dom/shared_styles_host
- services/url_resolver -> compiler/url_resolver
- services/app_root_urlo -> compiler/app_root_url
2015-10-02 13:38:51 -07:00
Tobias Bosch e8e57cdd73 refactor(core): adjust imports for rename angular2/src/compiler -> angular2/src/core/compiler 2015-10-02 08:59:43 -07:00
Tobias Bosch aa3d94149f refactor(core): rename angular2/src/compiler -> angular2/src/core/compiler 2015-10-02 08:42:12 -07:00
Tobias Bosch 6248a5e846 refactor(core): move core/compiler to core/linker, adjust imports 2015-10-02 08:42:12 -07:00
Tobias Bosch 9f4fa1ab0a refactor(core): move core/compiler to core/linker 2015-10-02 08:42:11 -07:00
Tobias Bosch d21c7bdf90 refactor(compiler): remove unused code
BREAKING CHANGE:
- Removes `ChangeDetection`, use a binding for `ChangeDetectorGenConfig` instead
  to configure change detection.
- `RenderElementRef.renderBoundElementIndex` was renamed to `RenderElementRef.boundElementIndex`.
- Removes `ViewLoader`, use `XHRImpl` instead.
2015-10-01 22:27:41 -07:00
Tobias Bosch 76247b7097 refactor(compiler): use the new compiler everywhere
Closes #3605

BREAKING CHANGE:
- we don't mark an element as bound any more if it only contains text bindings
  E.g. <div>{{hello}}</div>
  This changes the indices when using `DebugElement.componentViewChildren` / `DebugElement.children`.
- `@Directive.compileChildren` was removed,
  `ng-non-bindable` is now builtin and not a directive any more
- angular no more adds the `ng-binding` class to elements with bindings
- directives are now ordered as they are listed in the View.directives regarding change detection.
  Previously they had an undefined order.
- the `Renderer` interface has new methods `createProtoView` and `registerComponentTemplate`. See `DomRenderer` for default implementations.
- reprojection with `ng-content` is now all or nothing per `ng-content` element
- angular2 transformer can't be used in tests that modify directive metadata.
  Use `angular2/src/transform/inliner_for_test` transformer instead.
2015-10-01 18:48:27 -07:00
Yegor Jbanov 841f8789fd refactor(transformer): precompile stylesheets
Part of #3605
2015-10-01 18:48:27 -07:00
vsavkin adbfd29fd7 feat(core): renames Property into Input and Event into Output
BREACKING CHANGE:

Before: @Directive({properties: ['one'], events: ['two']})
After: @Directive({inputs: ['one'], outputs: ['two']})

Before: @Component({properties: ['one'], events: ['two']})
After: @Componet({inputs: ['one'], outputs: ['two']})

Before: class A {@Property() one; @Event() two;}
After: class A {@Input() one; @Output() two;}
2015-10-01 04:36:23 +00:00
vsavkin 00a4b2e28f feat(forms): make NgControl -> NgValueAccessor dependency unidirectional
Closes #4421
2015-10-01 01:47:18 +00:00
vsavkin cec4b36d9b fix(change_detection): _throwError should not mask the original exception 2015-09-30 18:18:28 -07:00
Marc Laval eafa482052 chore(saucelabs): add latest Safaris
Closes #4411
2015-09-30 21:38:04 +00:00
vsavkin 3aa204791b feat(query): make QueryList notify on changes via an observable
BREAKING CHANGE:

Before: query.onChange(() => ...);
After: query.changes.subscribe((iterable) => {});

Closes #4395
2015-09-30 15:45:16 +00:00
Alex Eagle 9b7378d132 chore(typings): remove traceur-runtime.d.ts
fixes #4297

Closes #4415
2015-09-30 00:07:16 +00:00
Alex Rickabaugh 7714d6a6eb fix(forms): avoid issues with nulls checking on validation status and other form states.
Closes #4338
2015-09-28 21:01:51 +00:00
Victor Berchet 0319417a1b feat(Binding): improve errors
fix #4358

Closes #4360
2015-09-25 22:05:36 +00:00
Tobias Bosch 1cf45757cd feat(render): add generic view factory based on the template commands
Part of #3605
Closes #4367
2015-09-25 11:56:58 -07:00
vsavkin 4efc4a5520 feat(query): remove the 3-query-per-element limit
Closes #4336
2015-09-24 21:09:02 +00:00
Tobias Bosch 7470ad1bd1 refactor(compiler): various cleanups
- use `$implicit` variable value correctly
- handle `ng-non-bindable` correctly
- add some more assertions to `TemplateCompiler`
- make `CompiledTemplate` const
- fix default value for `@Directive.moduleId`
- add new compiler to application bindings

BREAKING CHANGE:
- `Compiler.compileInHost` and all methods of `DynamicComponentLoader` don’t take `Binding` any more, only `Type`s. This is in preparation for the new compiler which does not support this.

Part of #3605

Closes #4346
2015-09-24 10:56:29 -07:00
Alex Eagle 577ee3744a fix(bug): reflect Dart interfaces from superclass as well
fixes #4221

Closes #4222
2015-09-22 22:31:07 +00:00
vsavkin 238dfc1e17 cleanup(di): make KeyRegistry private 2015-09-22 21:38:33 +00:00
vsavkin 29b56ceb40 cleanup(di): make DependencyProvider private 2015-09-22 21:38:33 +00:00
Tobias Bosch cc0c30484f refactor(compiler): cleanup and preparation for integration
- Rename `DirectiveMetadata` into `CompileDirectiveMetadata`, merge
  with `NormalizedDirectiveMetadata` and remove `ChangeDetectionMetadata`
- Store change detector factories not as array but
  directly at the `CompiledTemplate` or the embedded template
  to make instantiation easier later on
- Already analyze variable values and map them
  to `Directive.exportAs`
- Keep the directive sort order as specified in the
  `@View()` annotation
- Allow to clear the runtime cache in `StyleCompiler`
  and `TemplateCompiler`
- Ignore `script` elements to match the semantics of the
  current compiler
- Make all components dynamically loadable and remove
  the previously introduced property `@Component#dynamicLoadable`
  for now until we find a better option to configure this
- Don’t allow to specify bindings in `@View#directives` and `@View#pipes` as this was never supported by the transformer (see below for the breaking change)

BREAKING CHANGE:
- don't support DI bindings in `@View#directives` and `@View@pipes` any more in preparation of integrating the new compiler. Use `@Directive#bindings` to reexport directives under a different token instead.

Part of #3605
Closes #4314
2015-09-22 12:50:03 -07:00
vsavkin b0effe8e27 docs(di): add docs to Injector
Closes #4254
2015-09-21 21:55:04 +00:00
vsavkin c2a60f1624 feat(core): add support for @ContentChild and @ViewChild
Closes #4251
2015-09-20 01:45:09 +00:00
vsavkin 2e9de0b169 feat(core): add sugar to use ContentChildren and ViewChildren as prop decorators
Closes #4237
2015-09-20 00:43:04 +00:00
vsavkin 5dbe292615 feat(core): add support for ContentChildren and ViewChildren 2015-09-20 00:43:04 +00:00
Marc Laval 390aacd442 fix(facade): workaround for lack of Symbol.iterator in es6-shim
Closes #4219
Fixes #4216
2015-09-18 09:46:13 +02:00
Tobias Bosch 457b689bf0 feat(compiler): add TemplateCompiler
TemplateCompiler is the entry point to the new compiler

Related to #3605
Closes #4220
2015-09-17 04:24:15 +00:00
Pawel Kozlowski 73351ac00f fix(NgClass): ignore empty and blank class names
Fixes #4033

Closes #4173
2015-09-16 07:56:48 +00:00
Pawel Kozlowski 045cc8269f fix(compiler): remove attributes when expression in [attr.foo]='exp' evaluates to null
Fixes #4150

Closes #4163
2015-09-15 19:59:12 +00:00
Lenny d890c4f827 refactor(pipes): remove LimitTo pipe in favor of slice pipe 2015-09-15 11:42:31 -07:00
Lenny 0808eeaa0c feat(StringWrapper): add support for JS slice method to string 2015-09-15 11:42:30 -07:00
Lenny bced3aaa17 fix(ListWrapper): make list slice in dart return empty list if start and end are inverted like JS 2015-09-15 11:42:30 -07:00