Skip to content

Commit fbd2d11

Browse files
author
Anatoly Ostrovsky
committed
Router and filter improvements
1 parent 63a740c commit fbd2d11

46 files changed

Lines changed: 1479 additions & 910 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

integrations/closure/externs/angular.js

Lines changed: 21 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ ng.Component = function() {};
177177

178178
/**
179179
* Public Component.controller member exposed by the AngularTS namespace contract.
180-
* @type {(!Array<(function(...?): (!Object|undefined)|function(...?): ?)>|function(...?): (!Object|undefined)|function(new: ?, ...?)|function(new: Object, ...?)|string|undefined)}
180+
* @type {(!Array<(function(...?): !Object|function(...?): (!Object|undefined))>|function(...?): (!Object|undefined)|function(new: Object, ...?)|string|undefined)}
181181
*/
182182
ng.Component.prototype.controller;
183183

@@ -205,6 +205,12 @@ ng.Component.prototype.templateUrl;
205205
*/
206206
ng.Component.prototype.bindings;
207207

208+
/**
209+
* Replaces the generated component host element with the component template.
210+
* @type {(boolean|undefined)}
211+
*/
212+
ng.Component.prototype.replace;
213+
208214
/**
209215
* Whether transclusion is enabled. Disabled by default.
210216
* @type {(!Object<string, string>|boolean|undefined)}
@@ -280,7 +286,7 @@ ng.Directive.prototype.compile;
280286

281287
/**
282288
* Controller constructor or injectable string name
283-
* @type {(!Array<(function(...?): (!Object|undefined)|function(...?): ?)>|function(...?): (!Object|undefined)|function(new: ?, ...?)|function(new: Object, ...?)|string|undefined)}
289+
* @type {(!Array<(function(...?): !Object|function(...?): (!Object|undefined))>|function(...?): (!Object|undefined)|function(new: Object, ...?)|string|undefined)}
284290
*/
285291
ng.Directive.prototype.controller;
286292

@@ -475,7 +481,7 @@ ng.NgModule.prototype.animation = function(name, animationFactory) {};
475481
/**
476482
* Public NgModule.filter member exposed by the AngularTS namespace contract.
477483
* @param {string} name
478-
* @param {function(...?): !Object} filterFn
484+
* @param {function(...?): function(...?): ?} filterFn
479485
* @return {!ng.NgModule}
480486
*/
481487
ng.NgModule.prototype.filter = function(name, filterFn) {};
@@ -869,7 +875,7 @@ ng.FilterProvider.prototype.$get;
869875
/**
870876
* Public FilterProvider.register member exposed by the AngularTS namespace contract.
871877
* @param {string} name
872-
* @param {function(...?): !Object} factory
878+
* @param {function(...?): function(...?): ?} factory
873879
* @return {!ng.FilterProvider}
874880
*/
875881
ng.FilterProvider.prototype.register = function(name, factory) {};
@@ -1378,7 +1384,7 @@ ng.CompileService;
13781384

13791385
/**
13801386
* Public AngularTS ControllerService contract exposed through the global ng namespace for Closure-annotated applications.
1381-
* @typedef {function((!Array<(function(...?): (!Object|undefined)|function(...?): ?)>|function(...?): (!Object|undefined)|function(new: ?, ...?)|function(new: Object, ...?)|string), (!Object|undefined), (boolean|undefined), (string|undefined)): ?}
1387+
* @typedef {function((!Array<(function(...?): !Object|function(...?): (!Object|undefined))>|function(...?): (!Object|undefined)|function(new: Object, ...?)|string), (!Object|undefined), (boolean|undefined), (string|undefined)): ?}
13821388
*/
13831389
ng.ControllerService;
13841390

@@ -1448,7 +1454,7 @@ ng.FilterFn;
14481454

14491455
/**
14501456
* Public AngularTS FilterFactory contract exposed through the global ng namespace for Closure-annotated applications.
1451-
* @typedef {function(...?): !Object}
1457+
* @typedef {function(...?): function(...?): ?}
14521458
*/
14531459
ng.FilterFactory;
14541460

@@ -1476,60 +1482,30 @@ ng.EntryFilterItem.prototype.key;
14761482
*/
14771483
ng.EntryFilterItem.prototype.value;
14781484

1479-
/**
1480-
* Public AngularTS DateFilterFormat contract exposed through the global ng namespace for Closure-annotated applications.
1481-
* @typedef {string}
1482-
*/
1483-
ng.DateFilterFormat;
1484-
14851485
/**
14861486
* Public AngularTS DateFilterOptions contract exposed through the global ng namespace for Closure-annotated applications.
14871487
* @record
14881488
*/
14891489
ng.DateFilterOptions = function() {};
14901490

1491-
/**
1492-
* Public DateFilterOptions.locale member exposed by the AngularTS namespace contract.
1493-
* @type {(string|undefined)}
1494-
*/
1495-
ng.DateFilterOptions.prototype.locale;
1496-
14971491
/**
14981492
* Public AngularTS NumberFilterOptions contract exposed through the global ng namespace for Closure-annotated applications.
14991493
* @record
15001494
*/
15011495
ng.NumberFilterOptions = function() {};
15021496

1503-
/**
1504-
* Public NumberFilterOptions.locale member exposed by the AngularTS namespace contract.
1505-
* @type {(string|undefined)}
1506-
*/
1507-
ng.NumberFilterOptions.prototype.locale;
1508-
15091497
/**
15101498
* Public AngularTS CurrencyFilterOptions contract exposed through the global ng namespace for Closure-annotated applications.
15111499
* @record
15121500
*/
15131501
ng.CurrencyFilterOptions = function() {};
15141502

15151503
/**
1516-
* Public CurrencyFilterOptions.locale member exposed by the AngularTS namespace contract.
1517-
* @type {(string|undefined)}
1518-
*/
1519-
ng.CurrencyFilterOptions.prototype.locale;
1520-
1521-
/**
1522-
* Public AngularTS RelativeTimeFilterOptions contract exposed through the global ng namespace for Closure-annotated applications.
1504+
* An object with some or all of properties of `options` parameter of `Intl.RelativeTimeFormat` constructor. [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).
15231505
* @record
15241506
*/
15251507
ng.RelativeTimeFilterOptions = function() {};
15261508

1527-
/**
1528-
* Public RelativeTimeFilterOptions.locale member exposed by the AngularTS namespace contract.
1529-
* @type {(string|undefined)}
1530-
*/
1531-
ng.RelativeTimeFilterOptions.prototype.locale;
1532-
15331509
/**
15341510
* Function that serializes query params into a URL-encoded string.
15351511
* @typedef {function((!Object<string, ?>|undefined)): string}
@@ -3555,6 +3531,12 @@ ng.InjectionTokens.prototype.$aria;
35553531
*/
35563532
ng.InjectionTokens.prototype.$compile;
35573533

3534+
/**
3535+
* Public InjectionTokens.$compileLifecycle member exposed by the AngularTS namespace contract.
3536+
* @type {string}
3537+
*/
3538+
ng.InjectionTokens.prototype.$compileLifecycle;
3539+
35583540
/**
35593541
* Public InjectionTokens.$cookie member exposed by the AngularTS namespace contract.
35603542
* @type {string}
@@ -4843,7 +4825,7 @@ ng.StateDeclaration.prototype.dynamic;
48434825

48444826
/**
48454827
* The name of the component to use for this view. The name of an AngularTS `.component()` which will be used for this view. Resolve data can be provided to the component via the component's `bindings` object. For each binding declared on the component, any resolve with the same name is set on the component's controller instance. Note: Mapping from resolve names to component inputs may be specified using [[bindings]]. #### Example: ```js .state('profile', { // Use the <my-profile></my-profile> component for this state. component: 'MyProfile', } ``` Note: When using `component` to define a view, you may _not_ use any of: `template`, `templateUrl`, `controller`.
4846-
* @type {(string|undefined)}
4828+
* @type {(!ng.Component|string|undefined)}
48474829
*/
48484830
ng.StateDeclaration.prototype.component;
48494831

@@ -4855,7 +4837,7 @@ ng.StateDeclaration.prototype.bindings;
48554837

48564838
/**
48574839
* The view's controller function or name The controller function, or the name of a registered controller. The controller function will be used to control the contents of the [[directives.ngVIew]] directive. See: [[Ng1Controller]] for information about component-level router hooks.
4858-
* @type {(!Array<(function(...?): (!Object|undefined)|function(...?): ?)>|function(...?): (!Object|undefined)|function(new: ?, ...?)|function(new: Object, ...?)|string|undefined)}
4840+
* @type {(!Array<(function(...?): !Object|function(...?): (!Object|undefined))>|function(...?): (!Object|undefined)|function(new: Object, ...?)|string|undefined)}
48594841
*/
48604842
ng.StateDeclaration.prototype.controller;
48614843

integrations/dart/NG_NAMESPACE_PARITY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ part of the Dart public facade.
137137
| ng type | Dart status |
138138
| --- | --- |
139139
| `CurrencyFilterOptions` | started |
140-
| `DateFilterFormat` | started |
141140
| `DateFilterOptions` | started |
142141
| `EntryFilterItem` | started |
143142
| `FilterFactory` | started |

integrations/dart/lib/src/filters.dart

Lines changed: 6 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -4,55 +4,10 @@ typedef FilterFn = Object? Function(Object? input, [List<Object?> args]);
44
/// Factory that creates an AngularTS filter implementation.
55
typedef FilterFactory = FilterFn Function();
66

7-
/// Built-in date filter format names.
8-
enum DateFilterFormat {
9-
/// Invokes short.
10-
short('short'),
11-
12-
/// Invokes medium.
13-
medium('medium'),
14-
15-
/// Invokes long.
16-
long('long'),
17-
18-
/// Invokes full.
19-
full('full'),
20-
21-
/// Invokes short date.
22-
shortDate('shortDate'),
23-
24-
/// Invokes medium date.
25-
mediumDate('mediumDate'),
26-
27-
/// Invokes long date.
28-
longDate('longDate'),
29-
30-
/// Invokes full date.
31-
fullDate('fullDate'),
32-
33-
/// Invokes short time.
34-
shortTime('shortTime'),
35-
36-
/// Invokes medium time.
37-
mediumTime('mediumTime'),
38-
39-
/// Invokes long time.
40-
longTime('longTime'),
41-
42-
/// Invokes full time.
43-
fullTime('fullTime');
44-
45-
const DateFilterFormat(this.value);
46-
47-
/// Registers an AngularTS value.
48-
final String value;
49-
}
50-
517
/// Options passed to the date filter.
528
final class DateFilterOptions {
539
/// Creates a date filter options.
5410
const DateFilterOptions({
55-
this.locale,
5611
this.calendar,
5712
this.dateStyle,
5813
this.day,
@@ -76,9 +31,6 @@ final class DateFilterOptions {
7631
this.intl = const {},
7732
});
7833

79-
/// The locale.
80-
final String? locale;
81-
8234
/// The calendar.
8335
final String? calendar;
8436

@@ -145,7 +97,6 @@ final class DateFilterOptions {
14597
/// The to map.
14698
Map<String, Object?> toMap() => {
14799
...intl,
148-
if (locale != null) 'locale': locale,
149100
if (calendar != null) 'calendar': calendar,
150101
if (dateStyle != null) 'dateStyle': dateStyle,
151102
if (day != null) 'day': day,
@@ -174,7 +125,6 @@ final class DateFilterOptions {
174125
final class NumberFilterOptions {
175126
/// Creates a number filter options.
176127
const NumberFilterOptions({
177-
this.locale,
178128
this.compactDisplay,
179129
this.currency,
180130
this.currencyDisplay,
@@ -199,9 +149,6 @@ final class NumberFilterOptions {
199149
this.intl = const {},
200150
});
201151

202-
/// The locale.
203-
final String? locale;
204-
205152
/// The compact display.
206153
final String? compactDisplay;
207154

@@ -271,7 +218,6 @@ final class NumberFilterOptions {
271218
/// The to map.
272219
Map<String, Object?> toMap() => {
273220
...intl,
274-
if (locale != null) 'locale': locale,
275221
if (compactDisplay != null) 'compactDisplay': compactDisplay,
276222
if (currency != null) 'currency': currency,
277223
if (currencyDisplay != null) 'currencyDisplay': currencyDisplay,
@@ -306,8 +252,8 @@ final class NumberFilterOptions {
306252
final class CurrencyFilterOptions {
307253
/// Creates a currency filter options.
308254
const CurrencyFilterOptions({
309-
this.locale,
310255
this.compactDisplay,
256+
this.currency,
311257
this.currencyDisplay,
312258
this.currencySign,
313259
this.localeMatcher,
@@ -329,12 +275,12 @@ final class CurrencyFilterOptions {
329275
this.intl = const {},
330276
});
331277

332-
/// The locale.
333-
final String? locale;
334-
335278
/// The compact display.
336279
final String? compactDisplay;
337280

281+
/// The currency.
282+
final String? currency;
283+
338284
/// The currency display.
339285
final String? currencyDisplay;
340286

@@ -389,14 +335,14 @@ final class CurrencyFilterOptions {
389335
/// The use grouping.
390336
final Object? useGrouping;
391337

392-
/// Raw `Intl.NumberFormatOptions` values except `currency` and `style`.
338+
/// Raw `Intl.NumberFormatOptions` values except `style`.
393339
final Map<String, Object?> intl;
394340

395341
/// The to map.
396342
Map<String, Object?> toMap() => {
397343
...intl,
398-
if (locale != null) 'locale': locale,
399344
if (compactDisplay != null) 'compactDisplay': compactDisplay,
345+
if (currency != null) 'currency': currency,
400346
if (currencyDisplay != null) 'currencyDisplay': currencyDisplay,
401347
if (currencySign != null) 'currencySign': currencySign,
402348
if (localeMatcher != null) 'localeMatcher': localeMatcher,
@@ -428,16 +374,12 @@ final class CurrencyFilterOptions {
428374
final class RelativeTimeFilterOptions {
429375
/// Creates a relative time filter options.
430376
const RelativeTimeFilterOptions({
431-
this.locale,
432377
this.localeMatcher,
433378
this.numeric,
434379
this.style,
435380
this.intl = const {},
436381
});
437382

438-
/// The locale.
439-
final String? locale;
440-
441383
/// The locale matcher.
442384
final String? localeMatcher;
443385

@@ -453,7 +395,6 @@ final class RelativeTimeFilterOptions {
453395
/// The to map.
454396
Map<String, Object?> toMap() => {
455397
...intl,
456-
if (locale != null) 'locale': locale,
457398
if (localeMatcher != null) 'localeMatcher': localeMatcher,
458399
if (numeric != null) 'numeric': numeric,
459400
if (style != null) 'style': style,

0 commit comments

Comments
 (0)