1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | import { InjectionToken, Injectable, EventEmitter, Optional, Inject, ɵfindLocaleData, ɵLocaleDataIndex, ɵgetLocalePluralCase, LOCALE_ID, ɵLOCALE_DATA, ɵisListLikeIterable, ɵstringify, IterableDiffers, KeyValueDiffers, ElementRef, Renderer2, ɵɵdefineDirective, Input, Directive, ɵɵallocHostVars, ɵɵstyling, ɵɵclassMap, ɵɵstylingApply, NgModuleRef, ComponentFactoryResolver, Type, Injector, NgModuleFactory, ViewContainerRef, isDevMode, TemplateRef, Host, Attribute, ɵɵstyleMap, Pipe, ɵlooseIdentical, WrappedValue, ɵisPromise, ɵisObservable, ChangeDetectorRef, NgModule, Version, ɵɵdefineInjectable, ɵɵinject, ErrorHandler } from '@angular/core';
|
8 | import { __decorate, __metadata, __extends, __param, __read, __values, __assign } from 'tslib';
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 | var PlatformLocation = (function () {
|
40 | function PlatformLocation() {
|
41 | }
|
42 | return PlatformLocation;
|
43 | }());
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 | var LOCATION_INITIALIZED = new InjectionToken('Location Initialized');
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 | var LocationStrategy = (function () {
|
77 | function LocationStrategy() {
|
78 | }
|
79 | return LocationStrategy;
|
80 | }());
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 | var APP_BASE_HREF = new InjectionToken('appBaseHref');
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 | var Location = (function () {
|
142 | function Location(platformStrategy, platformLocation) {
|
143 | var _this = this;
|
144 |
|
145 | this._subject = new EventEmitter();
|
146 |
|
147 | this._urlChangeListeners = [];
|
148 | this._platformStrategy = platformStrategy;
|
149 | var browserBaseHref = this._platformStrategy.getBaseHref();
|
150 | this._platformLocation = platformLocation;
|
151 | this._baseHref = Location_1.stripTrailingSlash(_stripIndexHtml(browserBaseHref));
|
152 | this._platformStrategy.onPopState(function (ev) {
|
153 | _this._subject.emit({
|
154 | 'url': _this.path(true),
|
155 | 'pop': true,
|
156 | 'state': ev.state,
|
157 | 'type': ev.type,
|
158 | });
|
159 | });
|
160 | }
|
161 | Location_1 = Location;
|
162 | |
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 | Location.prototype.path = function (includeHash) {
|
172 | if (includeHash === void 0) { includeHash = false; }
|
173 | return this.normalize(this._platformStrategy.path(includeHash));
|
174 | };
|
175 | |
176 |
|
177 |
|
178 | Location.prototype.getState = function () { return this._platformLocation.getState(); };
|
179 | |
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 | Location.prototype.isCurrentPathEqualTo = function (path, query) {
|
189 | if (query === void 0) { query = ''; }
|
190 | return this.path() == this.normalize(path + Location_1.normalizeQueryParams(query));
|
191 | };
|
192 | |
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 | Location.prototype.normalize = function (url) {
|
201 | return Location_1.stripTrailingSlash(_stripBaseHref(this._baseHref, _stripIndexHtml(url)));
|
202 | };
|
203 | |
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 | Location.prototype.prepareExternalUrl = function (url) {
|
215 | if (url && url[0] !== '/') {
|
216 | url = '/' + url;
|
217 | }
|
218 | return this._platformStrategy.prepareExternalUrl(url);
|
219 | };
|
220 |
|
221 | |
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 | Location.prototype.go = function (path, query, state) {
|
231 | if (query === void 0) { query = ''; }
|
232 | if (state === void 0) { state = null; }
|
233 | this._platformStrategy.pushState(state, '', path, query);
|
234 | this._notifyUrlChangeListeners(this.prepareExternalUrl(path + Location_1.normalizeQueryParams(query)), state);
|
235 | };
|
236 | |
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 | Location.prototype.replaceState = function (path, query, state) {
|
245 | if (query === void 0) { query = ''; }
|
246 | if (state === void 0) { state = null; }
|
247 | this._platformStrategy.replaceState(state, '', path, query);
|
248 | this._notifyUrlChangeListeners(this.prepareExternalUrl(path + Location_1.normalizeQueryParams(query)), state);
|
249 | };
|
250 | |
251 |
|
252 |
|
253 | Location.prototype.forward = function () { this._platformStrategy.forward(); };
|
254 | |
255 |
|
256 |
|
257 | Location.prototype.back = function () { this._platformStrategy.back(); };
|
258 | |
259 |
|
260 |
|
261 |
|
262 | Location.prototype.onUrlChange = function (fn) {
|
263 | var _this = this;
|
264 | this._urlChangeListeners.push(fn);
|
265 | this.subscribe(function (v) { _this._notifyUrlChangeListeners(v.url, v.state); });
|
266 | };
|
267 |
|
268 | Location.prototype._notifyUrlChangeListeners = function (url, state) {
|
269 | if (url === void 0) { url = ''; }
|
270 | this._urlChangeListeners.forEach(function (fn) { return fn(url, state); });
|
271 | };
|
272 | |
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 |
|
280 | Location.prototype.subscribe = function (onNext, onThrow, onReturn) {
|
281 | return this._subject.subscribe({ next: onNext, error: onThrow, complete: onReturn });
|
282 | };
|
283 | |
284 |
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 |
|
291 | Location.normalizeQueryParams = function (params) {
|
292 | return params && params[0] !== '?' ? '?' + params : params;
|
293 | };
|
294 | |
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 |
|
303 | Location.joinWithSlash = function (start, end) {
|
304 | if (start.length == 0) {
|
305 | return end;
|
306 | }
|
307 | if (end.length == 0) {
|
308 | return start;
|
309 | }
|
310 | var slashes = 0;
|
311 | if (start.endsWith('/')) {
|
312 | slashes++;
|
313 | }
|
314 | if (end.startsWith('/')) {
|
315 | slashes++;
|
316 | }
|
317 | if (slashes == 2) {
|
318 | return start + end.substring(1);
|
319 | }
|
320 | if (slashes == 1) {
|
321 | return start + end;
|
322 | }
|
323 | return start + '/' + end;
|
324 | };
|
325 | |
326 |
|
327 |
|
328 |
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 | Location.stripTrailingSlash = function (url) {
|
336 | var match = url.match(/#|\?|$/);
|
337 | var pathEndIdx = match && match.index || url.length;
|
338 | var droppedSlashIdx = pathEndIdx - (url[pathEndIdx - 1] === '/' ? 1 : 0);
|
339 | return url.slice(0, droppedSlashIdx) + url.slice(pathEndIdx);
|
340 | };
|
341 | var Location_1;
|
342 | Location = Location_1 = __decorate([
|
343 | Injectable(),
|
344 | __metadata("design:paramtypes", [LocationStrategy, PlatformLocation])
|
345 | ], Location);
|
346 | return Location;
|
347 | }());
|
348 | function _stripBaseHref(baseHref, url) {
|
349 | return baseHref && url.startsWith(baseHref) ? url.substring(baseHref.length) : url;
|
350 | }
|
351 | function _stripIndexHtml(url) {
|
352 | return url.replace(/\/index.html$/, '');
|
353 | }
|
354 |
|
355 |
|
356 |
|
357 |
|
358 |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 |
|
372 |
|
373 |
|
374 |
|
375 |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 | var HashLocationStrategy = (function (_super) {
|
381 | __extends(HashLocationStrategy, _super);
|
382 | function HashLocationStrategy(_platformLocation, _baseHref) {
|
383 | var _this = _super.call(this) || this;
|
384 | _this._platformLocation = _platformLocation;
|
385 | _this._baseHref = '';
|
386 | if (_baseHref != null) {
|
387 | _this._baseHref = _baseHref;
|
388 | }
|
389 | return _this;
|
390 | }
|
391 | HashLocationStrategy.prototype.onPopState = function (fn) {
|
392 | this._platformLocation.onPopState(fn);
|
393 | this._platformLocation.onHashChange(fn);
|
394 | };
|
395 | HashLocationStrategy.prototype.getBaseHref = function () { return this._baseHref; };
|
396 | HashLocationStrategy.prototype.path = function (includeHash) {
|
397 | if (includeHash === void 0) { includeHash = false; }
|
398 |
|
399 |
|
400 | var path = this._platformLocation.hash;
|
401 | if (path == null)
|
402 | path = '#';
|
403 | return path.length > 0 ? path.substring(1) : path;
|
404 | };
|
405 | HashLocationStrategy.prototype.prepareExternalUrl = function (internal) {
|
406 | var url = Location.joinWithSlash(this._baseHref, internal);
|
407 | return url.length > 0 ? ('#' + url) : url;
|
408 | };
|
409 | HashLocationStrategy.prototype.pushState = function (state, title, path, queryParams) {
|
410 | var url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams));
|
411 | if (url.length == 0) {
|
412 | url = this._platformLocation.pathname;
|
413 | }
|
414 | this._platformLocation.pushState(state, title, url);
|
415 | };
|
416 | HashLocationStrategy.prototype.replaceState = function (state, title, path, queryParams) {
|
417 | var url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams));
|
418 | if (url.length == 0) {
|
419 | url = this._platformLocation.pathname;
|
420 | }
|
421 | this._platformLocation.replaceState(state, title, url);
|
422 | };
|
423 | HashLocationStrategy.prototype.forward = function () { this._platformLocation.forward(); };
|
424 | HashLocationStrategy.prototype.back = function () { this._platformLocation.back(); };
|
425 | HashLocationStrategy = __decorate([
|
426 | Injectable(),
|
427 | __param(1, Optional()), __param(1, Inject(APP_BASE_HREF)),
|
428 | __metadata("design:paramtypes", [PlatformLocation, String])
|
429 | ], HashLocationStrategy);
|
430 | return HashLocationStrategy;
|
431 | }(LocationStrategy));
|
432 |
|
433 |
|
434 |
|
435 |
|
436 |
|
437 |
|
438 |
|
439 |
|
440 |
|
441 |
|
442 |
|
443 |
|
444 |
|
445 |
|
446 |
|
447 |
|
448 |
|
449 |
|
450 |
|
451 |
|
452 |
|
453 |
|
454 |
|
455 |
|
456 |
|
457 |
|
458 |
|
459 |
|
460 |
|
461 |
|
462 |
|
463 |
|
464 |
|
465 |
|
466 |
|
467 | var PathLocationStrategy = (function (_super) {
|
468 | __extends(PathLocationStrategy, _super);
|
469 | function PathLocationStrategy(_platformLocation, href) {
|
470 | var _this = _super.call(this) || this;
|
471 | _this._platformLocation = _platformLocation;
|
472 | if (href == null) {
|
473 | href = _this._platformLocation.getBaseHrefFromDOM();
|
474 | }
|
475 | if (href == null) {
|
476 | throw new Error("No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document.");
|
477 | }
|
478 | _this._baseHref = href;
|
479 | return _this;
|
480 | }
|
481 | PathLocationStrategy.prototype.onPopState = function (fn) {
|
482 | this._platformLocation.onPopState(fn);
|
483 | this._platformLocation.onHashChange(fn);
|
484 | };
|
485 | PathLocationStrategy.prototype.getBaseHref = function () { return this._baseHref; };
|
486 | PathLocationStrategy.prototype.prepareExternalUrl = function (internal) {
|
487 | return Location.joinWithSlash(this._baseHref, internal);
|
488 | };
|
489 | PathLocationStrategy.prototype.path = function (includeHash) {
|
490 | if (includeHash === void 0) { includeHash = false; }
|
491 | var pathname = this._platformLocation.pathname +
|
492 | Location.normalizeQueryParams(this._platformLocation.search);
|
493 | var hash = this._platformLocation.hash;
|
494 | return hash && includeHash ? "" + pathname + hash : pathname;
|
495 | };
|
496 | PathLocationStrategy.prototype.pushState = function (state, title, url, queryParams) {
|
497 | var externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams));
|
498 | this._platformLocation.pushState(state, title, externalUrl);
|
499 | };
|
500 | PathLocationStrategy.prototype.replaceState = function (state, title, url, queryParams) {
|
501 | var externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams));
|
502 | this._platformLocation.replaceState(state, title, externalUrl);
|
503 | };
|
504 | PathLocationStrategy.prototype.forward = function () { this._platformLocation.forward(); };
|
505 | PathLocationStrategy.prototype.back = function () { this._platformLocation.back(); };
|
506 | PathLocationStrategy = __decorate([
|
507 | Injectable(),
|
508 | __param(1, Optional()), __param(1, Inject(APP_BASE_HREF)),
|
509 | __metadata("design:paramtypes", [PlatformLocation, String])
|
510 | ], PathLocationStrategy);
|
511 | return PathLocationStrategy;
|
512 | }(LocationStrategy));
|
513 |
|
514 |
|
515 |
|
516 |
|
517 |
|
518 |
|
519 |
|
520 |
|
521 |
|
522 |
|
523 |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 | var CURRENCIES_EN = {
|
531 | 'ADP': [undefined, undefined, 0],
|
532 | 'AFN': [undefined, undefined, 0],
|
533 | 'ALL': [undefined, undefined, 0],
|
534 | 'AMD': [undefined, undefined, 0],
|
535 | 'AOA': [undefined, 'Kz'],
|
536 | 'ARS': [undefined, '$'],
|
537 | 'AUD': ['A$', '$'],
|
538 | 'BAM': [undefined, 'KM'],
|
539 | 'BBD': [undefined, '$'],
|
540 | 'BDT': [undefined, '৳'],
|
541 | 'BHD': [undefined, undefined, 3],
|
542 | 'BIF': [undefined, undefined, 0],
|
543 | 'BMD': [undefined, '$'],
|
544 | 'BND': [undefined, '$'],
|
545 | 'BOB': [undefined, 'Bs'],
|
546 | 'BRL': ['R$'],
|
547 | 'BSD': [undefined, '$'],
|
548 | 'BWP': [undefined, 'P'],
|
549 | 'BYN': [undefined, 'р.', 2],
|
550 | 'BYR': [undefined, undefined, 0],
|
551 | 'BZD': [undefined, '$'],
|
552 | 'CAD': ['CA$', '$', 2],
|
553 | 'CHF': [undefined, undefined, 2],
|
554 | 'CLF': [undefined, undefined, 4],
|
555 | 'CLP': [undefined, '$', 0],
|
556 | 'CNY': ['CN¥', '¥'],
|
557 | 'COP': [undefined, '$', 0],
|
558 | 'CRC': [undefined, '₡', 2],
|
559 | 'CUC': [undefined, '$'],
|
560 | 'CUP': [undefined, '$'],
|
561 | 'CZK': [undefined, 'Kč', 2],
|
562 | 'DJF': [undefined, undefined, 0],
|
563 | 'DKK': [undefined, 'kr', 2],
|
564 | 'DOP': [undefined, '$'],
|
565 | 'EGP': [undefined, 'E£'],
|
566 | 'ESP': [undefined, '₧', 0],
|
567 | 'EUR': ['€'],
|
568 | 'FJD': [undefined, '$'],
|
569 | 'FKP': [undefined, '£'],
|
570 | 'GBP': ['£'],
|
571 | 'GEL': [undefined, '₾'],
|
572 | 'GIP': [undefined, '£'],
|
573 | 'GNF': [undefined, 'FG', 0],
|
574 | 'GTQ': [undefined, 'Q'],
|
575 | 'GYD': [undefined, '$', 0],
|
576 | 'HKD': ['HK$', '$'],
|
577 | 'HNL': [undefined, 'L'],
|
578 | 'HRK': [undefined, 'kn'],
|
579 | 'HUF': [undefined, 'Ft', 2],
|
580 | 'IDR': [undefined, 'Rp', 0],
|
581 | 'ILS': ['₪'],
|
582 | 'INR': ['₹'],
|
583 | 'IQD': [undefined, undefined, 0],
|
584 | 'IRR': [undefined, undefined, 0],
|
585 | 'ISK': [undefined, 'kr', 0],
|
586 | 'ITL': [undefined, undefined, 0],
|
587 | 'JMD': [undefined, '$'],
|
588 | 'JOD': [undefined, undefined, 3],
|
589 | 'JPY': ['¥', undefined, 0],
|
590 | 'KHR': [undefined, '៛'],
|
591 | 'KMF': [undefined, 'CF', 0],
|
592 | 'KPW': [undefined, '₩', 0],
|
593 | 'KRW': ['₩', undefined, 0],
|
594 | 'KWD': [undefined, undefined, 3],
|
595 | 'KYD': [undefined, '$'],
|
596 | 'KZT': [undefined, '₸'],
|
597 | 'LAK': [undefined, '₭', 0],
|
598 | 'LBP': [undefined, 'L£', 0],
|
599 | 'LKR': [undefined, 'Rs'],
|
600 | 'LRD': [undefined, '$'],
|
601 | 'LTL': [undefined, 'Lt'],
|
602 | 'LUF': [undefined, undefined, 0],
|
603 | 'LVL': [undefined, 'Ls'],
|
604 | 'LYD': [undefined, undefined, 3],
|
605 | 'MGA': [undefined, 'Ar', 0],
|
606 | 'MGF': [undefined, undefined, 0],
|
607 | 'MMK': [undefined, 'K', 0],
|
608 | 'MNT': [undefined, '₮', 0],
|
609 | 'MRO': [undefined, undefined, 0],
|
610 | 'MUR': [undefined, 'Rs', 0],
|
611 | 'MXN': ['MX$', '$'],
|
612 | 'MYR': [undefined, 'RM'],
|
613 | 'NAD': [undefined, '$'],
|
614 | 'NGN': [undefined, '₦'],
|
615 | 'NIO': [undefined, 'C$'],
|
616 | 'NOK': [undefined, 'kr', 2],
|
617 | 'NPR': [undefined, 'Rs'],
|
618 | 'NZD': ['NZ$', '$'],
|
619 | 'OMR': [undefined, undefined, 3],
|
620 | 'PHP': [undefined, '₱'],
|
621 | 'PKR': [undefined, 'Rs', 0],
|
622 | 'PLN': [undefined, 'zł'],
|
623 | 'PYG': [undefined, '₲', 0],
|
624 | 'RON': [undefined, 'lei'],
|
625 | 'RSD': [undefined, undefined, 0],
|
626 | 'RUB': [undefined, '₽'],
|
627 | 'RUR': [undefined, 'р.'],
|
628 | 'RWF': [undefined, 'RF', 0],
|
629 | 'SBD': [undefined, '$'],
|
630 | 'SEK': [undefined, 'kr', 2],
|
631 | 'SGD': [undefined, '$'],
|
632 | 'SHP': [undefined, '£'],
|
633 | 'SLL': [undefined, undefined, 0],
|
634 | 'SOS': [undefined, undefined, 0],
|
635 | 'SRD': [undefined, '$'],
|
636 | 'SSP': [undefined, '£'],
|
637 | 'STD': [undefined, undefined, 0],
|
638 | 'STN': [undefined, 'Db'],
|
639 | 'SYP': [undefined, '£', 0],
|
640 | 'THB': [undefined, '฿'],
|
641 | 'TMM': [undefined, undefined, 0],
|
642 | 'TND': [undefined, undefined, 3],
|
643 | 'TOP': [undefined, 'T$'],
|
644 | 'TRL': [undefined, undefined, 0],
|
645 | 'TRY': [undefined, '₺'],
|
646 | 'TTD': [undefined, '$'],
|
647 | 'TWD': ['NT$', '$', 2],
|
648 | 'TZS': [undefined, undefined, 0],
|
649 | 'UAH': [undefined, '₴'],
|
650 | 'UGX': [undefined, undefined, 0],
|
651 | 'USD': ['$'],
|
652 | 'UYI': [undefined, undefined, 0],
|
653 | 'UYU': [undefined, '$'],
|
654 | 'UZS': [undefined, undefined, 0],
|
655 | 'VEF': [undefined, 'Bs'],
|
656 | 'VND': ['₫', undefined, 0],
|
657 | 'VUV': [undefined, undefined, 0],
|
658 | 'XAF': ['FCFA', undefined, 0],
|
659 | 'XCD': ['EC$', '$'],
|
660 | 'XOF': ['CFA', undefined, 0],
|
661 | 'XPF': ['CFPF', undefined, 0],
|
662 | 'YER': [undefined, undefined, 0],
|
663 | 'ZAR': [undefined, 'R'],
|
664 | 'ZMK': [undefined, undefined, 0],
|
665 | 'ZMW': [undefined, 'ZK'],
|
666 | 'ZWD': [undefined, undefined, 0]
|
667 | };
|
668 |
|
669 |
|
670 |
|
671 |
|
672 |
|
673 |
|
674 |
|
675 |
|
676 |
|
677 |
|
678 |
|
679 |
|
680 |
|
681 |
|
682 |
|
683 | var NumberFormatStyle;
|
684 | (function (NumberFormatStyle) {
|
685 | NumberFormatStyle[NumberFormatStyle["Decimal"] = 0] = "Decimal";
|
686 | NumberFormatStyle[NumberFormatStyle["Percent"] = 1] = "Percent";
|
687 | NumberFormatStyle[NumberFormatStyle["Currency"] = 2] = "Currency";
|
688 | NumberFormatStyle[NumberFormatStyle["Scientific"] = 3] = "Scientific";
|
689 | })(NumberFormatStyle || (NumberFormatStyle = {}));
|
690 |
|
691 |
|
692 |
|
693 |
|
694 |
|
695 |
|
696 |
|
697 |
|
698 |
|
699 | var Plural;
|
700 | (function (Plural) {
|
701 | Plural[Plural["Zero"] = 0] = "Zero";
|
702 | Plural[Plural["One"] = 1] = "One";
|
703 | Plural[Plural["Two"] = 2] = "Two";
|
704 | Plural[Plural["Few"] = 3] = "Few";
|
705 | Plural[Plural["Many"] = 4] = "Many";
|
706 | Plural[Plural["Other"] = 5] = "Other";
|
707 | })(Plural || (Plural = {}));
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 | var FormStyle;
|
718 | (function (FormStyle) {
|
719 | FormStyle[FormStyle["Format"] = 0] = "Format";
|
720 | FormStyle[FormStyle["Standalone"] = 1] = "Standalone";
|
721 | })(FormStyle || (FormStyle = {}));
|
722 |
|
723 |
|
724 |
|
725 |
|
726 |
|
727 |
|
728 |
|
729 | var TranslationWidth;
|
730 | (function (TranslationWidth) {
|
731 |
|
732 | TranslationWidth[TranslationWidth["Narrow"] = 0] = "Narrow";
|
733 |
|
734 | TranslationWidth[TranslationWidth["Abbreviated"] = 1] = "Abbreviated";
|
735 |
|
736 | TranslationWidth[TranslationWidth["Wide"] = 2] = "Wide";
|
737 |
|
738 | TranslationWidth[TranslationWidth["Short"] = 3] = "Short";
|
739 | })(TranslationWidth || (TranslationWidth = {}));
|
740 |
|
741 |
|
742 |
|
743 |
|
744 |
|
745 |
|
746 |
|
747 |
|
748 |
|
749 |
|
750 |
|
751 | var FormatWidth;
|
752 | (function (FormatWidth) {
|
753 | |
754 |
|
755 |
|
756 |
|
757 | FormatWidth[FormatWidth["Short"] = 0] = "Short";
|
758 | |
759 |
|
760 |
|
761 |
|
762 | FormatWidth[FormatWidth["Medium"] = 1] = "Medium";
|
763 | |
764 |
|
765 |
|
766 |
|
767 | FormatWidth[FormatWidth["Long"] = 2] = "Long";
|
768 | |
769 |
|
770 |
|
771 |
|
772 | FormatWidth[FormatWidth["Full"] = 3] = "Full";
|
773 | })(FormatWidth || (FormatWidth = {}));
|
774 |
|
775 |
|
776 |
|
777 |
|
778 |
|
779 |
|
780 |
|
781 |
|
782 |
|
783 | var NumberSymbol;
|
784 | (function (NumberSymbol) {
|
785 | |
786 |
|
787 |
|
788 |
|
789 |
|
790 | NumberSymbol[NumberSymbol["Decimal"] = 0] = "Decimal";
|
791 | |
792 |
|
793 |
|
794 |
|
795 |
|
796 | NumberSymbol[NumberSymbol["Group"] = 1] = "Group";
|
797 | |
798 |
|
799 |
|
800 |
|
801 | NumberSymbol[NumberSymbol["List"] = 2] = "List";
|
802 | |
803 |
|
804 |
|
805 |
|
806 | NumberSymbol[NumberSymbol["PercentSign"] = 3] = "PercentSign";
|
807 | |
808 |
|
809 |
|
810 |
|
811 | NumberSymbol[NumberSymbol["PlusSign"] = 4] = "PlusSign";
|
812 | |
813 |
|
814 |
|
815 |
|
816 | NumberSymbol[NumberSymbol["MinusSign"] = 5] = "MinusSign";
|
817 | |
818 |
|
819 |
|
820 |
|
821 | NumberSymbol[NumberSymbol["Exponential"] = 6] = "Exponential";
|
822 | |
823 |
|
824 |
|
825 |
|
826 | NumberSymbol[NumberSymbol["SuperscriptingExponent"] = 7] = "SuperscriptingExponent";
|
827 | |
828 |
|
829 |
|
830 |
|
831 | NumberSymbol[NumberSymbol["PerMille"] = 8] = "PerMille";
|
832 | |
833 |
|
834 |
|
835 |
|
836 | NumberSymbol[NumberSymbol["Infinity"] = 9] = "Infinity";
|
837 | |
838 |
|
839 |
|
840 |
|
841 | NumberSymbol[NumberSymbol["NaN"] = 10] = "NaN";
|
842 | |
843 |
|
844 |
|
845 |
|
846 | NumberSymbol[NumberSymbol["TimeSeparator"] = 11] = "TimeSeparator";
|
847 | |
848 |
|
849 |
|
850 |
|
851 | NumberSymbol[NumberSymbol["CurrencyDecimal"] = 12] = "CurrencyDecimal";
|
852 | |
853 |
|
854 |
|
855 |
|
856 | NumberSymbol[NumberSymbol["CurrencyGroup"] = 13] = "CurrencyGroup";
|
857 | })(NumberSymbol || (NumberSymbol = {}));
|
858 |
|
859 |
|
860 |
|
861 |
|
862 |
|
863 | var WeekDay;
|
864 | (function (WeekDay) {
|
865 | WeekDay[WeekDay["Sunday"] = 0] = "Sunday";
|
866 | WeekDay[WeekDay["Monday"] = 1] = "Monday";
|
867 | WeekDay[WeekDay["Tuesday"] = 2] = "Tuesday";
|
868 | WeekDay[WeekDay["Wednesday"] = 3] = "Wednesday";
|
869 | WeekDay[WeekDay["Thursday"] = 4] = "Thursday";
|
870 | WeekDay[WeekDay["Friday"] = 5] = "Friday";
|
871 | WeekDay[WeekDay["Saturday"] = 6] = "Saturday";
|
872 | })(WeekDay || (WeekDay = {}));
|
873 |
|
874 |
|
875 |
|
876 |
|
877 |
|
878 |
|
879 |
|
880 |
|
881 |
|
882 | function getLocaleId(locale) {
|
883 | return ɵfindLocaleData(locale)[ɵLocaleDataIndex.LocaleId];
|
884 | }
|
885 |
|
886 |
|
887 |
|
888 |
|
889 |
|
890 |
|
891 |
|
892 |
|
893 |
|
894 |
|
895 |
|
896 | function getLocaleDayPeriods(locale, formStyle, width) {
|
897 | var data = ɵfindLocaleData(locale);
|
898 | var amPmData = [data[ɵLocaleDataIndex.DayPeriodsFormat], data[ɵLocaleDataIndex.DayPeriodsStandalone]];
|
899 | var amPm = getLastDefinedValue(amPmData, formStyle);
|
900 | return getLastDefinedValue(amPm, width);
|
901 | }
|
902 |
|
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 |
|
912 |
|
913 |
|
914 | function getLocaleDayNames(locale, formStyle, width) {
|
915 | var data = ɵfindLocaleData(locale);
|
916 | var daysData = [data[ɵLocaleDataIndex.DaysFormat], data[ɵLocaleDataIndex.DaysStandalone]];
|
917 | var days = getLastDefinedValue(daysData, formStyle);
|
918 | return getLastDefinedValue(days, width);
|
919 | }
|
920 |
|
921 |
|
922 |
|
923 |
|
924 |
|
925 |
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 |
|
932 | function getLocaleMonthNames(locale, formStyle, width) {
|
933 | var data = ɵfindLocaleData(locale);
|
934 | var monthsData = [data[ɵLocaleDataIndex.MonthsFormat], data[ɵLocaleDataIndex.MonthsStandalone]];
|
935 | var months = getLastDefinedValue(monthsData, formStyle);
|
936 | return getLastDefinedValue(months, width);
|
937 | }
|
938 |
|
939 |
|
940 |
|
941 |
|
942 |
|
943 |
|
944 |
|
945 |
|
946 |
|
947 |
|
948 |
|
949 |
|
950 | function getLocaleEraNames(locale, width) {
|
951 | var data = ɵfindLocaleData(locale);
|
952 | var erasData = data[ɵLocaleDataIndex.Eras];
|
953 | return getLastDefinedValue(erasData, width);
|
954 | }
|
955 |
|
956 |
|
957 |
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 |
|
964 |
|
965 |
|
966 | function getLocaleFirstDayOfWeek(locale) {
|
967 | var data = ɵfindLocaleData(locale);
|
968 | return data[ɵLocaleDataIndex.FirstDayOfWeek];
|
969 | }
|
970 |
|
971 |
|
972 |
|
973 |
|
974 |
|
975 |
|
976 |
|
977 |
|
978 |
|
979 | function getLocaleWeekEndRange(locale) {
|
980 | var data = ɵfindLocaleData(locale);
|
981 | return data[ɵLocaleDataIndex.WeekendRange];
|
982 | }
|
983 |
|
984 |
|
985 |
|
986 |
|
987 |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 |
|
993 |
|
994 | function getLocaleDateFormat(locale, width) {
|
995 | var data = ɵfindLocaleData(locale);
|
996 | return getLastDefinedValue(data[ɵLocaleDataIndex.DateFormat], width);
|
997 | }
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 |
|
1003 |
|
1004 |
|
1005 |
|
1006 |
|
1007 |
|
1008 |
|
1009 | function getLocaleTimeFormat(locale, width) {
|
1010 | var data = ɵfindLocaleData(locale);
|
1011 | return getLastDefinedValue(data[ɵLocaleDataIndex.TimeFormat], width);
|
1012 | }
|
1013 |
|
1014 |
|
1015 |
|
1016 |
|
1017 |
|
1018 |
|
1019 |
|
1020 |
|
1021 |
|
1022 |
|
1023 |
|
1024 | function getLocaleDateTimeFormat(locale, width) {
|
1025 | var data = ɵfindLocaleData(locale);
|
1026 | var dateTimeFormatData = data[ɵLocaleDataIndex.DateTimeFormat];
|
1027 | return getLastDefinedValue(dateTimeFormatData, width);
|
1028 | }
|
1029 |
|
1030 |
|
1031 |
|
1032 |
|
1033 |
|
1034 |
|
1035 |
|
1036 |
|
1037 |
|
1038 |
|
1039 | function getLocaleNumberSymbol(locale, symbol) {
|
1040 | var data = ɵfindLocaleData(locale);
|
1041 | var res = data[ɵLocaleDataIndex.NumberSymbols][symbol];
|
1042 | if (typeof res === 'undefined') {
|
1043 | if (symbol === NumberSymbol.CurrencyDecimal) {
|
1044 | return data[ɵLocaleDataIndex.NumberSymbols][NumberSymbol.Decimal];
|
1045 | }
|
1046 | else if (symbol === NumberSymbol.CurrencyGroup) {
|
1047 | return data[ɵLocaleDataIndex.NumberSymbols][NumberSymbol.Group];
|
1048 | }
|
1049 | }
|
1050 | return res;
|
1051 | }
|
1052 |
|
1053 |
|
1054 |
|
1055 |
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 |
|
1061 |
|
1062 |
|
1063 |
|
1064 |
|
1065 |
|
1066 |
|
1067 |
|
1068 |
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 |
|
1080 |
|
1081 |
|
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 | function getLocaleNumberFormat(locale, type) {
|
1088 | var data = ɵfindLocaleData(locale);
|
1089 | return data[ɵLocaleDataIndex.NumberFormats][type];
|
1090 | }
|
1091 |
|
1092 |
|
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 |
|
1099 |
|
1100 |
|
1101 |
|
1102 | function getLocaleCurrencySymbol(locale) {
|
1103 | var data = ɵfindLocaleData(locale);
|
1104 | return data[ɵLocaleDataIndex.CurrencySymbol] || null;
|
1105 | }
|
1106 |
|
1107 |
|
1108 |
|
1109 |
|
1110 |
|
1111 |
|
1112 |
|
1113 |
|
1114 |
|
1115 |
|
1116 | function getLocaleCurrencyName(locale) {
|
1117 | var data = ɵfindLocaleData(locale);
|
1118 | return data[ɵLocaleDataIndex.CurrencyName] || null;
|
1119 | }
|
1120 |
|
1121 |
|
1122 |
|
1123 |
|
1124 |
|
1125 |
|
1126 | function getLocaleCurrencies(locale) {
|
1127 | var data = ɵfindLocaleData(locale);
|
1128 | return data[ɵLocaleDataIndex.Currencies];
|
1129 | }
|
1130 |
|
1131 |
|
1132 |
|
1133 |
|
1134 | var getLocalePluralCase = ɵgetLocalePluralCase;
|
1135 | function checkFullData(data) {
|
1136 | if (!data[ɵLocaleDataIndex.ExtraData]) {
|
1137 | throw new Error("Missing extra locale data for the locale \"" + data[ɵLocaleDataIndex.LocaleId] + "\". Use \"registerLocaleData\" to load new data. See the \"I18n guide\" on angular.io to know more.");
|
1138 | }
|
1139 | }
|
1140 |
|
1141 |
|
1142 |
|
1143 |
|
1144 |
|
1145 |
|
1146 |
|
1147 |
|
1148 |
|
1149 |
|
1150 |
|
1151 |
|
1152 |
|
1153 |
|
1154 |
|
1155 |
|
1156 |
|
1157 |
|
1158 |
|
1159 |
|
1160 |
|
1161 |
|
1162 | function getLocaleExtraDayPeriodRules(locale) {
|
1163 | var data = ɵfindLocaleData(locale);
|
1164 | checkFullData(data);
|
1165 | var rules = data[ɵLocaleDataIndex.ExtraData][2 ] || [];
|
1166 | return rules.map(function (rule) {
|
1167 | if (typeof rule === 'string') {
|
1168 | return extractTime(rule);
|
1169 | }
|
1170 | return [extractTime(rule[0]), extractTime(rule[1])];
|
1171 | });
|
1172 | }
|
1173 |
|
1174 |
|
1175 |
|
1176 |
|
1177 |
|
1178 |
|
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 |
|
1186 |
|
1187 |
|
1188 |
|
1189 |
|
1190 | function getLocaleExtraDayPeriods(locale, formStyle, width) {
|
1191 | var data = ɵfindLocaleData(locale);
|
1192 | checkFullData(data);
|
1193 | var dayPeriodsData = [
|
1194 | data[ɵLocaleDataIndex.ExtraData][0 ],
|
1195 | data[ɵLocaleDataIndex.ExtraData][1 ]
|
1196 | ];
|
1197 | var dayPeriods = getLastDefinedValue(dayPeriodsData, formStyle) || [];
|
1198 | return getLastDefinedValue(dayPeriods, width) || [];
|
1199 | }
|
1200 |
|
1201 |
|
1202 |
|
1203 |
|
1204 |
|
1205 |
|
1206 |
|
1207 |
|
1208 |
|
1209 |
|
1210 |
|
1211 |
|
1212 |
|
1213 | function getLastDefinedValue(data, index) {
|
1214 | for (var i = index; i > -1; i--) {
|
1215 | if (typeof data[i] !== 'undefined') {
|
1216 | return data[i];
|
1217 | }
|
1218 | }
|
1219 | throw new Error('Locale data API: locale data undefined');
|
1220 | }
|
1221 |
|
1222 |
|
1223 |
|
1224 | function extractTime(time) {
|
1225 | var _a = __read(time.split(':'), 2), h = _a[0], m = _a[1];
|
1226 | return { hours: +h, minutes: +m };
|
1227 | }
|
1228 |
|
1229 |
|
1230 |
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 |
|
1236 |
|
1237 |
|
1238 |
|
1239 |
|
1240 |
|
1241 |
|
1242 |
|
1243 | function getCurrencySymbol(code, format, locale) {
|
1244 | if (locale === void 0) { locale = 'en'; }
|
1245 | var currency = getLocaleCurrencies(locale)[code] || CURRENCIES_EN[code] || [];
|
1246 | var symbolNarrow = currency[1 ];
|
1247 | if (format === 'narrow' && typeof symbolNarrow === 'string') {
|
1248 | return symbolNarrow;
|
1249 | }
|
1250 | return currency[0 ] || code;
|
1251 | }
|
1252 |
|
1253 | var DEFAULT_NB_OF_CURRENCY_DIGITS = 2;
|
1254 |
|
1255 |
|
1256 |
|
1257 |
|
1258 |
|
1259 |
|
1260 |
|
1261 |
|
1262 |
|
1263 |
|
1264 | function getNumberOfCurrencyDigits(code) {
|
1265 | var digits;
|
1266 | var currency = CURRENCIES_EN[code];
|
1267 | if (currency) {
|
1268 | digits = currency[2 ];
|
1269 | }
|
1270 | return typeof digits === 'number' ? digits : DEFAULT_NB_OF_CURRENCY_DIGITS;
|
1271 | }
|
1272 |
|
1273 |
|
1274 |
|
1275 |
|
1276 |
|
1277 |
|
1278 |
|
1279 |
|
1280 | var ISO8601_DATE_REGEX = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
|
1281 |
|
1282 | var NAMED_FORMATS = {};
|
1283 | var DATE_FORMATS_SPLIT = /((?:[^GyMLwWdEabBhHmsSzZO']+)|(?:'(?:[^']|'')*')|(?:G{1,5}|y{1,4}|M{1,5}|L{1,5}|w{1,2}|W{1}|d{1,2}|E{1,6}|a{1,5}|b{1,5}|B{1,5}|h{1,2}|H{1,2}|m{1,2}|s{1,2}|S{1,3}|z{1,4}|Z{1,5}|O{1,4}))([\s\S]*)/;
|
1284 | var ZoneWidth;
|
1285 | (function (ZoneWidth) {
|
1286 | ZoneWidth[ZoneWidth["Short"] = 0] = "Short";
|
1287 | ZoneWidth[ZoneWidth["ShortGMT"] = 1] = "ShortGMT";
|
1288 | ZoneWidth[ZoneWidth["Long"] = 2] = "Long";
|
1289 | ZoneWidth[ZoneWidth["Extended"] = 3] = "Extended";
|
1290 | })(ZoneWidth || (ZoneWidth = {}));
|
1291 | var DateType;
|
1292 | (function (DateType) {
|
1293 | DateType[DateType["FullYear"] = 0] = "FullYear";
|
1294 | DateType[DateType["Month"] = 1] = "Month";
|
1295 | DateType[DateType["Date"] = 2] = "Date";
|
1296 | DateType[DateType["Hours"] = 3] = "Hours";
|
1297 | DateType[DateType["Minutes"] = 4] = "Minutes";
|
1298 | DateType[DateType["Seconds"] = 5] = "Seconds";
|
1299 | DateType[DateType["FractionalSeconds"] = 6] = "FractionalSeconds";
|
1300 | DateType[DateType["Day"] = 7] = "Day";
|
1301 | })(DateType || (DateType = {}));
|
1302 | var TranslationType;
|
1303 | (function (TranslationType) {
|
1304 | TranslationType[TranslationType["DayPeriods"] = 0] = "DayPeriods";
|
1305 | TranslationType[TranslationType["Days"] = 1] = "Days";
|
1306 | TranslationType[TranslationType["Months"] = 2] = "Months";
|
1307 | TranslationType[TranslationType["Eras"] = 3] = "Eras";
|
1308 | })(TranslationType || (TranslationType = {}));
|
1309 |
|
1310 |
|
1311 |
|
1312 |
|
1313 |
|
1314 |
|
1315 |
|
1316 |
|
1317 |
|
1318 |
|
1319 |
|
1320 |
|
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 |
|
1327 |
|
1328 |
|
1329 |
|
1330 | function formatDate(value, format, locale, timezone) {
|
1331 | var date = toDate(value);
|
1332 | var namedFormat = getNamedFormat(locale, format);
|
1333 | format = namedFormat || format;
|
1334 | var parts = [];
|
1335 | var match;
|
1336 | while (format) {
|
1337 | match = DATE_FORMATS_SPLIT.exec(format);
|
1338 | if (match) {
|
1339 | parts = parts.concat(match.slice(1));
|
1340 | var part = parts.pop();
|
1341 | if (!part) {
|
1342 | break;
|
1343 | }
|
1344 | format = part;
|
1345 | }
|
1346 | else {
|
1347 | parts.push(format);
|
1348 | break;
|
1349 | }
|
1350 | }
|
1351 | var dateTimezoneOffset = date.getTimezoneOffset();
|
1352 | if (timezone) {
|
1353 | dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
|
1354 | date = convertTimezoneToLocal(date, timezone, true);
|
1355 | }
|
1356 | var text = '';
|
1357 | parts.forEach(function (value) {
|
1358 | var dateFormatter = getDateFormatter(value);
|
1359 | text += dateFormatter ?
|
1360 | dateFormatter(date, locale, dateTimezoneOffset) :
|
1361 | value === '\'\'' ? '\'' : value.replace(/(^'|'$)/g, '').replace(/''/g, '\'');
|
1362 | });
|
1363 | return text;
|
1364 | }
|
1365 | function getNamedFormat(locale, format) {
|
1366 | var localeId = getLocaleId(locale);
|
1367 | NAMED_FORMATS[localeId] = NAMED_FORMATS[localeId] || {};
|
1368 | if (NAMED_FORMATS[localeId][format]) {
|
1369 | return NAMED_FORMATS[localeId][format];
|
1370 | }
|
1371 | var formatValue = '';
|
1372 | switch (format) {
|
1373 | case 'shortDate':
|
1374 | formatValue = getLocaleDateFormat(locale, FormatWidth.Short);
|
1375 | break;
|
1376 | case 'mediumDate':
|
1377 | formatValue = getLocaleDateFormat(locale, FormatWidth.Medium);
|
1378 | break;
|
1379 | case 'longDate':
|
1380 | formatValue = getLocaleDateFormat(locale, FormatWidth.Long);
|
1381 | break;
|
1382 | case 'fullDate':
|
1383 | formatValue = getLocaleDateFormat(locale, FormatWidth.Full);
|
1384 | break;
|
1385 | case 'shortTime':
|
1386 | formatValue = getLocaleTimeFormat(locale, FormatWidth.Short);
|
1387 | break;
|
1388 | case 'mediumTime':
|
1389 | formatValue = getLocaleTimeFormat(locale, FormatWidth.Medium);
|
1390 | break;
|
1391 | case 'longTime':
|
1392 | formatValue = getLocaleTimeFormat(locale, FormatWidth.Long);
|
1393 | break;
|
1394 | case 'fullTime':
|
1395 | formatValue = getLocaleTimeFormat(locale, FormatWidth.Full);
|
1396 | break;
|
1397 | case 'short':
|
1398 | var shortTime = getNamedFormat(locale, 'shortTime');
|
1399 | var shortDate = getNamedFormat(locale, 'shortDate');
|
1400 | formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Short), [shortTime, shortDate]);
|
1401 | break;
|
1402 | case 'medium':
|
1403 | var mediumTime = getNamedFormat(locale, 'mediumTime');
|
1404 | var mediumDate = getNamedFormat(locale, 'mediumDate');
|
1405 | formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Medium), [mediumTime, mediumDate]);
|
1406 | break;
|
1407 | case 'long':
|
1408 | var longTime = getNamedFormat(locale, 'longTime');
|
1409 | var longDate = getNamedFormat(locale, 'longDate');
|
1410 | formatValue =
|
1411 | formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Long), [longTime, longDate]);
|
1412 | break;
|
1413 | case 'full':
|
1414 | var fullTime = getNamedFormat(locale, 'fullTime');
|
1415 | var fullDate = getNamedFormat(locale, 'fullDate');
|
1416 | formatValue =
|
1417 | formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Full), [fullTime, fullDate]);
|
1418 | break;
|
1419 | }
|
1420 | if (formatValue) {
|
1421 | NAMED_FORMATS[localeId][format] = formatValue;
|
1422 | }
|
1423 | return formatValue;
|
1424 | }
|
1425 | function formatDateTime(str, opt_values) {
|
1426 | if (opt_values) {
|
1427 | str = str.replace(/\{([^}]+)}/g, function (match, key) {
|
1428 | return (opt_values != null && key in opt_values) ? opt_values[key] : match;
|
1429 | });
|
1430 | }
|
1431 | return str;
|
1432 | }
|
1433 | function padNumber(num, digits, minusSign, trim, negWrap) {
|
1434 | if (minusSign === void 0) { minusSign = '-'; }
|
1435 | var neg = '';
|
1436 | if (num < 0 || (negWrap && num <= 0)) {
|
1437 | if (negWrap) {
|
1438 | num = -num + 1;
|
1439 | }
|
1440 | else {
|
1441 | num = -num;
|
1442 | neg = minusSign;
|
1443 | }
|
1444 | }
|
1445 | var strNum = String(num);
|
1446 | while (strNum.length < digits) {
|
1447 | strNum = '0' + strNum;
|
1448 | }
|
1449 | if (trim) {
|
1450 | strNum = strNum.substr(strNum.length - digits);
|
1451 | }
|
1452 | return neg + strNum;
|
1453 | }
|
1454 | function formatFractionalSeconds(milliseconds, digits) {
|
1455 | var strMs = padNumber(milliseconds, 3);
|
1456 | return strMs.substr(0, digits);
|
1457 | }
|
1458 |
|
1459 |
|
1460 |
|
1461 | function dateGetter(name, size, offset, trim, negWrap) {
|
1462 | if (offset === void 0) { offset = 0; }
|
1463 | if (trim === void 0) { trim = false; }
|
1464 | if (negWrap === void 0) { negWrap = false; }
|
1465 | return function (date, locale) {
|
1466 | var part = getDatePart(name, date);
|
1467 | if (offset > 0 || part > -offset) {
|
1468 | part += offset;
|
1469 | }
|
1470 | if (name === DateType.Hours) {
|
1471 | if (part === 0 && offset === -12) {
|
1472 | part = 12;
|
1473 | }
|
1474 | }
|
1475 | else if (name === DateType.FractionalSeconds) {
|
1476 | return formatFractionalSeconds(part, size);
|
1477 | }
|
1478 | var localeMinus = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);
|
1479 | return padNumber(part, size, localeMinus, trim, negWrap);
|
1480 | };
|
1481 | }
|
1482 | function getDatePart(part, date) {
|
1483 | switch (part) {
|
1484 | case DateType.FullYear:
|
1485 | return date.getFullYear();
|
1486 | case DateType.Month:
|
1487 | return date.getMonth();
|
1488 | case DateType.Date:
|
1489 | return date.getDate();
|
1490 | case DateType.Hours:
|
1491 | return date.getHours();
|
1492 | case DateType.Minutes:
|
1493 | return date.getMinutes();
|
1494 | case DateType.Seconds:
|
1495 | return date.getSeconds();
|
1496 | case DateType.FractionalSeconds:
|
1497 | return date.getMilliseconds();
|
1498 | case DateType.Day:
|
1499 | return date.getDay();
|
1500 | default:
|
1501 | throw new Error("Unknown DateType value \"" + part + "\".");
|
1502 | }
|
1503 | }
|
1504 |
|
1505 |
|
1506 |
|
1507 | function dateStrGetter(name, width, form, extended) {
|
1508 | if (form === void 0) { form = FormStyle.Format; }
|
1509 | if (extended === void 0) { extended = false; }
|
1510 | return function (date, locale) {
|
1511 | return getDateTranslation(date, locale, name, width, form, extended);
|
1512 | };
|
1513 | }
|
1514 |
|
1515 |
|
1516 |
|
1517 | function getDateTranslation(date, locale, name, width, form, extended) {
|
1518 | switch (name) {
|
1519 | case TranslationType.Months:
|
1520 | return getLocaleMonthNames(locale, form, width)[date.getMonth()];
|
1521 | case TranslationType.Days:
|
1522 | return getLocaleDayNames(locale, form, width)[date.getDay()];
|
1523 | case TranslationType.DayPeriods:
|
1524 | var currentHours_1 = date.getHours();
|
1525 | var currentMinutes_1 = date.getMinutes();
|
1526 | if (extended) {
|
1527 | var rules = getLocaleExtraDayPeriodRules(locale);
|
1528 | var dayPeriods_1 = getLocaleExtraDayPeriods(locale, form, width);
|
1529 | var result_1;
|
1530 | rules.forEach(function (rule, index) {
|
1531 | if (Array.isArray(rule)) {
|
1532 |
|
1533 | var _a = rule[0], hoursFrom = _a.hours, minutesFrom = _a.minutes;
|
1534 | var _b = rule[1], hoursTo = _b.hours, minutesTo = _b.minutes;
|
1535 | if (currentHours_1 >= hoursFrom && currentMinutes_1 >= minutesFrom &&
|
1536 | (currentHours_1 < hoursTo ||
|
1537 | (currentHours_1 === hoursTo && currentMinutes_1 < minutesTo))) {
|
1538 | result_1 = dayPeriods_1[index];
|
1539 | }
|
1540 | }
|
1541 | else {
|
1542 | var hours = rule.hours, minutes = rule.minutes;
|
1543 | if (hours === currentHours_1 && minutes === currentMinutes_1) {
|
1544 | result_1 = dayPeriods_1[index];
|
1545 | }
|
1546 | }
|
1547 | });
|
1548 | if (result_1) {
|
1549 | return result_1;
|
1550 | }
|
1551 | }
|
1552 |
|
1553 | return getLocaleDayPeriods(locale, form, width)[currentHours_1 < 12 ? 0 : 1];
|
1554 | case TranslationType.Eras:
|
1555 | return getLocaleEraNames(locale, width)[date.getFullYear() <= 0 ? 0 : 1];
|
1556 | default:
|
1557 |
|
1558 |
|
1559 |
|
1560 |
|
1561 | var unexpected = name;
|
1562 | throw new Error("unexpected translation type " + unexpected);
|
1563 | }
|
1564 | }
|
1565 |
|
1566 |
|
1567 |
|
1568 |
|
1569 |
|
1570 | function timeZoneGetter(width) {
|
1571 | return function (date, locale, offset) {
|
1572 | var zone = -1 * offset;
|
1573 | var minusSign = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);
|
1574 | var hours = zone > 0 ? Math.floor(zone / 60) : Math.ceil(zone / 60);
|
1575 | switch (width) {
|
1576 | case ZoneWidth.Short:
|
1577 | return ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) +
|
1578 | padNumber(Math.abs(zone % 60), 2, minusSign);
|
1579 | case ZoneWidth.ShortGMT:
|
1580 | return 'GMT' + ((zone >= 0) ? '+' : '') + padNumber(hours, 1, minusSign);
|
1581 | case ZoneWidth.Long:
|
1582 | return 'GMT' + ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + ':' +
|
1583 | padNumber(Math.abs(zone % 60), 2, minusSign);
|
1584 | case ZoneWidth.Extended:
|
1585 | if (offset === 0) {
|
1586 | return 'Z';
|
1587 | }
|
1588 | else {
|
1589 | return ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + ':' +
|
1590 | padNumber(Math.abs(zone % 60), 2, minusSign);
|
1591 | }
|
1592 | default:
|
1593 | throw new Error("Unknown zone width \"" + width + "\"");
|
1594 | }
|
1595 | };
|
1596 | }
|
1597 | var JANUARY = 0;
|
1598 | var THURSDAY = 4;
|
1599 | function getFirstThursdayOfYear(year) {
|
1600 | var firstDayOfYear = (new Date(year, JANUARY, 1)).getDay();
|
1601 | return new Date(year, 0, 1 + ((firstDayOfYear <= THURSDAY) ? THURSDAY : THURSDAY + 7) - firstDayOfYear);
|
1602 | }
|
1603 | function getThursdayThisWeek(datetime) {
|
1604 | return new Date(datetime.getFullYear(), datetime.getMonth(), datetime.getDate() + (THURSDAY - datetime.getDay()));
|
1605 | }
|
1606 | function weekGetter(size, monthBased) {
|
1607 | if (monthBased === void 0) { monthBased = false; }
|
1608 | return function (date, locale) {
|
1609 | var result;
|
1610 | if (monthBased) {
|
1611 | var nbDaysBefore1stDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1).getDay() - 1;
|
1612 | var today = date.getDate();
|
1613 | result = 1 + Math.floor((today + nbDaysBefore1stDayOfMonth) / 7);
|
1614 | }
|
1615 | else {
|
1616 | var firstThurs = getFirstThursdayOfYear(date.getFullYear());
|
1617 | var thisThurs = getThursdayThisWeek(date);
|
1618 | var diff = thisThurs.getTime() - firstThurs.getTime();
|
1619 | result = 1 + Math.round(diff / 6.048e8);
|
1620 | }
|
1621 | return padNumber(result, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
|
1622 | };
|
1623 | }
|
1624 | var DATE_FORMATS = {};
|
1625 |
|
1626 |
|
1627 |
|
1628 |
|
1629 | function getDateFormatter(format) {
|
1630 | if (DATE_FORMATS[format]) {
|
1631 | return DATE_FORMATS[format];
|
1632 | }
|
1633 | var formatter;
|
1634 | switch (format) {
|
1635 |
|
1636 | case 'G':
|
1637 | case 'GG':
|
1638 | case 'GGG':
|
1639 | formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Abbreviated);
|
1640 | break;
|
1641 | case 'GGGG':
|
1642 | formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Wide);
|
1643 | break;
|
1644 | case 'GGGGG':
|
1645 | formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Narrow);
|
1646 | break;
|
1647 |
|
1648 | case 'y':
|
1649 | formatter = dateGetter(DateType.FullYear, 1, 0, false, true);
|
1650 | break;
|
1651 |
|
1652 | case 'yy':
|
1653 | formatter = dateGetter(DateType.FullYear, 2, 0, true, true);
|
1654 | break;
|
1655 |
|
1656 | case 'yyy':
|
1657 | formatter = dateGetter(DateType.FullYear, 3, 0, false, true);
|
1658 | break;
|
1659 |
|
1660 | case 'yyyy':
|
1661 | formatter = dateGetter(DateType.FullYear, 4, 0, false, true);
|
1662 | break;
|
1663 |
|
1664 | case 'M':
|
1665 | case 'L':
|
1666 | formatter = dateGetter(DateType.Month, 1, 1);
|
1667 | break;
|
1668 | case 'MM':
|
1669 | case 'LL':
|
1670 | formatter = dateGetter(DateType.Month, 2, 1);
|
1671 | break;
|
1672 |
|
1673 | case 'MMM':
|
1674 | formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated);
|
1675 | break;
|
1676 | case 'MMMM':
|
1677 | formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Wide);
|
1678 | break;
|
1679 | case 'MMMMM':
|
1680 | formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Narrow);
|
1681 | break;
|
1682 |
|
1683 | case 'LLL':
|
1684 | formatter =
|
1685 | dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated, FormStyle.Standalone);
|
1686 | break;
|
1687 | case 'LLLL':
|
1688 | formatter =
|
1689 | dateStrGetter(TranslationType.Months, TranslationWidth.Wide, FormStyle.Standalone);
|
1690 | break;
|
1691 | case 'LLLLL':
|
1692 | formatter =
|
1693 | dateStrGetter(TranslationType.Months, TranslationWidth.Narrow, FormStyle.Standalone);
|
1694 | break;
|
1695 |
|
1696 | case 'w':
|
1697 | formatter = weekGetter(1);
|
1698 | break;
|
1699 | case 'ww':
|
1700 | formatter = weekGetter(2);
|
1701 | break;
|
1702 |
|
1703 | case 'W':
|
1704 | formatter = weekGetter(1, true);
|
1705 | break;
|
1706 |
|
1707 | case 'd':
|
1708 | formatter = dateGetter(DateType.Date, 1);
|
1709 | break;
|
1710 | case 'dd':
|
1711 | formatter = dateGetter(DateType.Date, 2);
|
1712 | break;
|
1713 |
|
1714 | case 'E':
|
1715 | case 'EE':
|
1716 | case 'EEE':
|
1717 | formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Abbreviated);
|
1718 | break;
|
1719 | case 'EEEE':
|
1720 | formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Wide);
|
1721 | break;
|
1722 | case 'EEEEE':
|
1723 | formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Narrow);
|
1724 | break;
|
1725 | case 'EEEEEE':
|
1726 | formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Short);
|
1727 | break;
|
1728 |
|
1729 | case 'a':
|
1730 | case 'aa':
|
1731 | case 'aaa':
|
1732 | formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated);
|
1733 | break;
|
1734 | case 'aaaa':
|
1735 | formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide);
|
1736 | break;
|
1737 | case 'aaaaa':
|
1738 | formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow);
|
1739 | break;
|
1740 |
|
1741 | case 'b':
|
1742 | case 'bb':
|
1743 | case 'bbb':
|
1744 | formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Standalone, true);
|
1745 | break;
|
1746 | case 'bbbb':
|
1747 | formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Standalone, true);
|
1748 | break;
|
1749 | case 'bbbbb':
|
1750 | formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Standalone, true);
|
1751 | break;
|
1752 |
|
1753 | case 'B':
|
1754 | case 'BB':
|
1755 | case 'BBB':
|
1756 | formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Format, true);
|
1757 | break;
|
1758 | case 'BBBB':
|
1759 | formatter =
|
1760 | dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Format, true);
|
1761 | break;
|
1762 | case 'BBBBB':
|
1763 | formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Format, true);
|
1764 | break;
|
1765 |
|
1766 | case 'h':
|
1767 | formatter = dateGetter(DateType.Hours, 1, -12);
|
1768 | break;
|
1769 | case 'hh':
|
1770 | formatter = dateGetter(DateType.Hours, 2, -12);
|
1771 | break;
|
1772 |
|
1773 | case 'H':
|
1774 | formatter = dateGetter(DateType.Hours, 1);
|
1775 | break;
|
1776 |
|
1777 | case 'HH':
|
1778 | formatter = dateGetter(DateType.Hours, 2);
|
1779 | break;
|
1780 |
|
1781 | case 'm':
|
1782 | formatter = dateGetter(DateType.Minutes, 1);
|
1783 | break;
|
1784 | case 'mm':
|
1785 | formatter = dateGetter(DateType.Minutes, 2);
|
1786 | break;
|
1787 |
|
1788 | case 's':
|
1789 | formatter = dateGetter(DateType.Seconds, 1);
|
1790 | break;
|
1791 | case 'ss':
|
1792 | formatter = dateGetter(DateType.Seconds, 2);
|
1793 | break;
|
1794 |
|
1795 | case 'S':
|
1796 | formatter = dateGetter(DateType.FractionalSeconds, 1);
|
1797 | break;
|
1798 | case 'SS':
|
1799 | formatter = dateGetter(DateType.FractionalSeconds, 2);
|
1800 | break;
|
1801 | case 'SSS':
|
1802 | formatter = dateGetter(DateType.FractionalSeconds, 3);
|
1803 | break;
|
1804 |
|
1805 | case 'Z':
|
1806 | case 'ZZ':
|
1807 | case 'ZZZ':
|
1808 | formatter = timeZoneGetter(ZoneWidth.Short);
|
1809 | break;
|
1810 |
|
1811 | case 'ZZZZZ':
|
1812 | formatter = timeZoneGetter(ZoneWidth.Extended);
|
1813 | break;
|
1814 |
|
1815 | case 'O':
|
1816 | case 'OO':
|
1817 | case 'OOO':
|
1818 |
|
1819 | case 'z':
|
1820 | case 'zz':
|
1821 | case 'zzz':
|
1822 | formatter = timeZoneGetter(ZoneWidth.ShortGMT);
|
1823 | break;
|
1824 |
|
1825 | case 'OOOO':
|
1826 | case 'ZZZZ':
|
1827 |
|
1828 | case 'zzzz':
|
1829 | formatter = timeZoneGetter(ZoneWidth.Long);
|
1830 | break;
|
1831 | default:
|
1832 | return null;
|
1833 | }
|
1834 | DATE_FORMATS[format] = formatter;
|
1835 | return formatter;
|
1836 | }
|
1837 | function timezoneToOffset(timezone, fallback) {
|
1838 |
|
1839 |
|
1840 | timezone = timezone.replace(/:/g, '');
|
1841 | var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
|
1842 | return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
|
1843 | }
|
1844 | function addDateMinutes(date, minutes) {
|
1845 | date = new Date(date.getTime());
|
1846 | date.setMinutes(date.getMinutes() + minutes);
|
1847 | return date;
|
1848 | }
|
1849 | function convertTimezoneToLocal(date, timezone, reverse) {
|
1850 | var reverseValue = reverse ? -1 : 1;
|
1851 | var dateTimezoneOffset = date.getTimezoneOffset();
|
1852 | var timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
|
1853 | return addDateMinutes(date, reverseValue * (timezoneOffset - dateTimezoneOffset));
|
1854 | }
|
1855 |
|
1856 |
|
1857 |
|
1858 |
|
1859 |
|
1860 |
|
1861 |
|
1862 |
|
1863 |
|
1864 |
|
1865 |
|
1866 |
|
1867 | function toDate(value) {
|
1868 | if (isDate(value)) {
|
1869 | return value;
|
1870 | }
|
1871 | if (typeof value === 'number' && !isNaN(value)) {
|
1872 | return new Date(value);
|
1873 | }
|
1874 | if (typeof value === 'string') {
|
1875 | value = value.trim();
|
1876 | var parsedNb = parseFloat(value);
|
1877 |
|
1878 | if (!isNaN(value - parsedNb)) {
|
1879 | return new Date(parsedNb);
|
1880 | }
|
1881 | if (/^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) {
|
1882 | |
1883 |
|
1884 |
|
1885 |
|
1886 |
|
1887 |
|
1888 |
|
1889 | var _a = __read(value.split('-').map(function (val) { return +val; }), 3), y = _a[0], m = _a[1], d = _a[2];
|
1890 | return new Date(y, m - 1, d);
|
1891 | }
|
1892 | var match = void 0;
|
1893 | if (match = value.match(ISO8601_DATE_REGEX)) {
|
1894 | return isoStringToDate(match);
|
1895 | }
|
1896 | }
|
1897 | var date = new Date(value);
|
1898 | if (!isDate(date)) {
|
1899 | throw new Error("Unable to convert \"" + value + "\" into a date");
|
1900 | }
|
1901 | return date;
|
1902 | }
|
1903 |
|
1904 |
|
1905 |
|
1906 |
|
1907 | function isoStringToDate(match) {
|
1908 | var date = new Date(0);
|
1909 | var tzHour = 0;
|
1910 | var tzMin = 0;
|
1911 |
|
1912 | var dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;
|
1913 | var timeSetter = match[8] ? date.setUTCHours : date.setHours;
|
1914 |
|
1915 | if (match[9]) {
|
1916 | tzHour = Number(match[9] + match[10]);
|
1917 | tzMin = Number(match[9] + match[11]);
|
1918 | }
|
1919 | dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));
|
1920 | var h = Number(match[4] || 0) - tzHour;
|
1921 | var m = Number(match[5] || 0) - tzMin;
|
1922 | var s = Number(match[6] || 0);
|
1923 | var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);
|
1924 | timeSetter.call(date, h, m, s, ms);
|
1925 | return date;
|
1926 | }
|
1927 | function isDate(value) {
|
1928 | return value instanceof Date && !isNaN(value.valueOf());
|
1929 | }
|
1930 |
|
1931 |
|
1932 |
|
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 | var NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(-(\d+))?)?$/;
|
1939 | var MAX_DIGITS = 22;
|
1940 | var DECIMAL_SEP = '.';
|
1941 | var ZERO_CHAR = '0';
|
1942 | var PATTERN_SEP = ';';
|
1943 | var GROUP_SEP = ',';
|
1944 | var DIGIT_CHAR = '#';
|
1945 | var CURRENCY_CHAR = '¤';
|
1946 | var PERCENT_CHAR = '%';
|
1947 |
|
1948 |
|
1949 |
|
1950 | function formatNumberToLocaleString(value, pattern, locale, groupSymbol, decimalSymbol, digitsInfo, isPercent) {
|
1951 | if (isPercent === void 0) { isPercent = false; }
|
1952 | var formattedText = '';
|
1953 | var isZero = false;
|
1954 | if (!isFinite(value)) {
|
1955 | formattedText = getLocaleNumberSymbol(locale, NumberSymbol.Infinity);
|
1956 | }
|
1957 | else {
|
1958 | var parsedNumber = parseNumber(value);
|
1959 | if (isPercent) {
|
1960 | parsedNumber = toPercent(parsedNumber);
|
1961 | }
|
1962 | var minInt = pattern.minInt;
|
1963 | var minFraction = pattern.minFrac;
|
1964 | var maxFraction = pattern.maxFrac;
|
1965 | if (digitsInfo) {
|
1966 | var parts = digitsInfo.match(NUMBER_FORMAT_REGEXP);
|
1967 | if (parts === null) {
|
1968 | throw new Error(digitsInfo + " is not a valid digit info");
|
1969 | }
|
1970 | var minIntPart = parts[1];
|
1971 | var minFractionPart = parts[3];
|
1972 | var maxFractionPart = parts[5];
|
1973 | if (minIntPart != null) {
|
1974 | minInt = parseIntAutoRadix(minIntPart);
|
1975 | }
|
1976 | if (minFractionPart != null) {
|
1977 | minFraction = parseIntAutoRadix(minFractionPart);
|
1978 | }
|
1979 | if (maxFractionPart != null) {
|
1980 | maxFraction = parseIntAutoRadix(maxFractionPart);
|
1981 | }
|
1982 | else if (minFractionPart != null && minFraction > maxFraction) {
|
1983 | maxFraction = minFraction;
|
1984 | }
|
1985 | }
|
1986 | roundNumber(parsedNumber, minFraction, maxFraction);
|
1987 | var digits = parsedNumber.digits;
|
1988 | var integerLen = parsedNumber.integerLen;
|
1989 | var exponent = parsedNumber.exponent;
|
1990 | var decimals = [];
|
1991 | isZero = digits.every(function (d) { return !d; });
|
1992 |
|
1993 | for (; integerLen < minInt; integerLen++) {
|
1994 | digits.unshift(0);
|
1995 | }
|
1996 |
|
1997 | for (; integerLen < 0; integerLen++) {
|
1998 | digits.unshift(0);
|
1999 | }
|
2000 |
|
2001 | if (integerLen > 0) {
|
2002 | decimals = digits.splice(integerLen, digits.length);
|
2003 | }
|
2004 | else {
|
2005 | decimals = digits;
|
2006 | digits = [0];
|
2007 | }
|
2008 |
|
2009 | var groups = [];
|
2010 | if (digits.length >= pattern.lgSize) {
|
2011 | groups.unshift(digits.splice(-pattern.lgSize, digits.length).join(''));
|
2012 | }
|
2013 | while (digits.length > pattern.gSize) {
|
2014 | groups.unshift(digits.splice(-pattern.gSize, digits.length).join(''));
|
2015 | }
|
2016 | if (digits.length) {
|
2017 | groups.unshift(digits.join(''));
|
2018 | }
|
2019 | formattedText = groups.join(getLocaleNumberSymbol(locale, groupSymbol));
|
2020 |
|
2021 | if (decimals.length) {
|
2022 | formattedText += getLocaleNumberSymbol(locale, decimalSymbol) + decimals.join('');
|
2023 | }
|
2024 | if (exponent) {
|
2025 | formattedText += getLocaleNumberSymbol(locale, NumberSymbol.Exponential) + '+' + exponent;
|
2026 | }
|
2027 | }
|
2028 | if (value < 0 && !isZero) {
|
2029 | formattedText = pattern.negPre + formattedText + pattern.negSuf;
|
2030 | }
|
2031 | else {
|
2032 | formattedText = pattern.posPre + formattedText + pattern.posSuf;
|
2033 | }
|
2034 | return formattedText;
|
2035 | }
|
2036 |
|
2037 |
|
2038 |
|
2039 |
|
2040 |
|
2041 |
|
2042 |
|
2043 |
|
2044 |
|
2045 |
|
2046 |
|
2047 |
|
2048 |
|
2049 |
|
2050 |
|
2051 |
|
2052 |
|
2053 |
|
2054 |
|
2055 |
|
2056 |
|
2057 |
|
2058 |
|
2059 |
|
2060 | function formatCurrency(value, locale, currency, currencyCode, digitsInfo) {
|
2061 | var format = getLocaleNumberFormat(locale, NumberFormatStyle.Currency);
|
2062 | var pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
|
2063 | pattern.minFrac = getNumberOfCurrencyDigits(currencyCode);
|
2064 | pattern.maxFrac = pattern.minFrac;
|
2065 | var res = formatNumberToLocaleString(value, pattern, locale, NumberSymbol.CurrencyGroup, NumberSymbol.CurrencyDecimal, digitsInfo);
|
2066 | return res
|
2067 | .replace(CURRENCY_CHAR, currency)
|
2068 |
|
2069 | .replace(CURRENCY_CHAR, '');
|
2070 | }
|
2071 |
|
2072 |
|
2073 |
|
2074 |
|
2075 |
|
2076 |
|
2077 |
|
2078 |
|
2079 |
|
2080 |
|
2081 |
|
2082 |
|
2083 |
|
2084 |
|
2085 |
|
2086 |
|
2087 |
|
2088 |
|
2089 |
|
2090 | function formatPercent(value, locale, digitsInfo) {
|
2091 | var format = getLocaleNumberFormat(locale, NumberFormatStyle.Percent);
|
2092 | var pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
|
2093 | var res = formatNumberToLocaleString(value, pattern, locale, NumberSymbol.Group, NumberSymbol.Decimal, digitsInfo, true);
|
2094 | return res.replace(new RegExp(PERCENT_CHAR, 'g'), getLocaleNumberSymbol(locale, NumberSymbol.PercentSign));
|
2095 | }
|
2096 |
|
2097 |
|
2098 |
|
2099 |
|
2100 |
|
2101 |
|
2102 |
|
2103 |
|
2104 |
|
2105 |
|
2106 |
|
2107 |
|
2108 |
|
2109 |
|
2110 |
|
2111 |
|
2112 |
|
2113 | function formatNumber(value, locale, digitsInfo) {
|
2114 | var format = getLocaleNumberFormat(locale, NumberFormatStyle.Decimal);
|
2115 | var pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
|
2116 | return formatNumberToLocaleString(value, pattern, locale, NumberSymbol.Group, NumberSymbol.Decimal, digitsInfo);
|
2117 | }
|
2118 | function parseNumberFormat(format, minusSign) {
|
2119 | if (minusSign === void 0) { minusSign = '-'; }
|
2120 | var p = {
|
2121 | minInt: 1,
|
2122 | minFrac: 0,
|
2123 | maxFrac: 0,
|
2124 | posPre: '',
|
2125 | posSuf: '',
|
2126 | negPre: '',
|
2127 | negSuf: '',
|
2128 | gSize: 0,
|
2129 | lgSize: 0
|
2130 | };
|
2131 | var patternParts = format.split(PATTERN_SEP);
|
2132 | var positive = patternParts[0];
|
2133 | var negative = patternParts[1];
|
2134 | var positiveParts = positive.indexOf(DECIMAL_SEP) !== -1 ?
|
2135 | positive.split(DECIMAL_SEP) :
|
2136 | [
|
2137 | positive.substring(0, positive.lastIndexOf(ZERO_CHAR) + 1),
|
2138 | positive.substring(positive.lastIndexOf(ZERO_CHAR) + 1)
|
2139 | ], integer = positiveParts[0], fraction = positiveParts[1] || '';
|
2140 | p.posPre = integer.substr(0, integer.indexOf(DIGIT_CHAR));
|
2141 | for (var i = 0; i < fraction.length; i++) {
|
2142 | var ch = fraction.charAt(i);
|
2143 | if (ch === ZERO_CHAR) {
|
2144 | p.minFrac = p.maxFrac = i + 1;
|
2145 | }
|
2146 | else if (ch === DIGIT_CHAR) {
|
2147 | p.maxFrac = i + 1;
|
2148 | }
|
2149 | else {
|
2150 | p.posSuf += ch;
|
2151 | }
|
2152 | }
|
2153 | var groups = integer.split(GROUP_SEP);
|
2154 | p.gSize = groups[1] ? groups[1].length : 0;
|
2155 | p.lgSize = (groups[2] || groups[1]) ? (groups[2] || groups[1]).length : 0;
|
2156 | if (negative) {
|
2157 | var trunkLen = positive.length - p.posPre.length - p.posSuf.length, pos = negative.indexOf(DIGIT_CHAR);
|
2158 | p.negPre = negative.substr(0, pos).replace(/'/g, '');
|
2159 | p.negSuf = negative.substr(pos + trunkLen).replace(/'/g, '');
|
2160 | }
|
2161 | else {
|
2162 | p.negPre = minusSign + p.posPre;
|
2163 | p.negSuf = p.posSuf;
|
2164 | }
|
2165 | return p;
|
2166 | }
|
2167 |
|
2168 | function toPercent(parsedNumber) {
|
2169 |
|
2170 | if (parsedNumber.digits[0] === 0) {
|
2171 | return parsedNumber;
|
2172 | }
|
2173 |
|
2174 | var fractionLen = parsedNumber.digits.length - parsedNumber.integerLen;
|
2175 | if (parsedNumber.exponent) {
|
2176 | parsedNumber.exponent += 2;
|
2177 | }
|
2178 | else {
|
2179 | if (fractionLen === 0) {
|
2180 | parsedNumber.digits.push(0, 0);
|
2181 | }
|
2182 | else if (fractionLen === 1) {
|
2183 | parsedNumber.digits.push(0);
|
2184 | }
|
2185 | parsedNumber.integerLen += 2;
|
2186 | }
|
2187 | return parsedNumber;
|
2188 | }
|
2189 |
|
2190 |
|
2191 |
|
2192 |
|
2193 | function parseNumber(num) {
|
2194 | var numStr = Math.abs(num) + '';
|
2195 | var exponent = 0, digits, integerLen;
|
2196 | var i, j, zeros;
|
2197 |
|
2198 | if ((integerLen = numStr.indexOf(DECIMAL_SEP)) > -1) {
|
2199 | numStr = numStr.replace(DECIMAL_SEP, '');
|
2200 | }
|
2201 |
|
2202 | if ((i = numStr.search(/e/i)) > 0) {
|
2203 |
|
2204 | if (integerLen < 0)
|
2205 | integerLen = i;
|
2206 | integerLen += +numStr.slice(i + 1);
|
2207 | numStr = numStr.substring(0, i);
|
2208 | }
|
2209 | else if (integerLen < 0) {
|
2210 |
|
2211 | integerLen = numStr.length;
|
2212 | }
|
2213 |
|
2214 | for (i = 0; numStr.charAt(i) === ZERO_CHAR; i++) {
|
2215 | }
|
2216 | if (i === (zeros = numStr.length)) {
|
2217 |
|
2218 | digits = [0];
|
2219 | integerLen = 1;
|
2220 | }
|
2221 | else {
|
2222 |
|
2223 | zeros--;
|
2224 | while (numStr.charAt(zeros) === ZERO_CHAR)
|
2225 | zeros--;
|
2226 |
|
2227 | integerLen -= i;
|
2228 | digits = [];
|
2229 |
|
2230 | for (j = 0; i <= zeros; i++, j++) {
|
2231 | digits[j] = Number(numStr.charAt(i));
|
2232 | }
|
2233 | }
|
2234 |
|
2235 | if (integerLen > MAX_DIGITS) {
|
2236 | digits = digits.splice(0, MAX_DIGITS - 1);
|
2237 | exponent = integerLen - 1;
|
2238 | integerLen = 1;
|
2239 | }
|
2240 | return { digits: digits, exponent: exponent, integerLen: integerLen };
|
2241 | }
|
2242 |
|
2243 |
|
2244 |
|
2245 |
|
2246 | function roundNumber(parsedNumber, minFrac, maxFrac) {
|
2247 | if (minFrac > maxFrac) {
|
2248 | throw new Error("The minimum number of digits after fraction (" + minFrac + ") is higher than the maximum (" + maxFrac + ").");
|
2249 | }
|
2250 | var digits = parsedNumber.digits;
|
2251 | var fractionLen = digits.length - parsedNumber.integerLen;
|
2252 | var fractionSize = Math.min(Math.max(minFrac, fractionLen), maxFrac);
|
2253 |
|
2254 | var roundAt = fractionSize + parsedNumber.integerLen;
|
2255 | var digit = digits[roundAt];
|
2256 | if (roundAt > 0) {
|
2257 |
|
2258 | digits.splice(Math.max(parsedNumber.integerLen, roundAt));
|
2259 |
|
2260 | for (var j = roundAt; j < digits.length; j++) {
|
2261 | digits[j] = 0;
|
2262 | }
|
2263 | }
|
2264 | else {
|
2265 |
|
2266 | fractionLen = Math.max(0, fractionLen);
|
2267 | parsedNumber.integerLen = 1;
|
2268 | digits.length = Math.max(1, roundAt = fractionSize + 1);
|
2269 | digits[0] = 0;
|
2270 | for (var i = 1; i < roundAt; i++)
|
2271 | digits[i] = 0;
|
2272 | }
|
2273 | if (digit >= 5) {
|
2274 | if (roundAt - 1 < 0) {
|
2275 | for (var k = 0; k > roundAt; k--) {
|
2276 | digits.unshift(0);
|
2277 | parsedNumber.integerLen++;
|
2278 | }
|
2279 | digits.unshift(1);
|
2280 | parsedNumber.integerLen++;
|
2281 | }
|
2282 | else {
|
2283 | digits[roundAt - 1]++;
|
2284 | }
|
2285 | }
|
2286 |
|
2287 | for (; fractionLen < Math.max(0, fractionSize); fractionLen++)
|
2288 | digits.push(0);
|
2289 | var dropTrailingZeros = fractionSize !== 0;
|
2290 |
|
2291 |
|
2292 | var minLen = minFrac + parsedNumber.integerLen;
|
2293 |
|
2294 | var carry = digits.reduceRight(function (carry, d, i, digits) {
|
2295 | d = d + carry;
|
2296 | digits[i] = d < 10 ? d : d - 10;
|
2297 | if (dropTrailingZeros) {
|
2298 |
|
2299 | if (digits[i] === 0 && i >= minLen) {
|
2300 | digits.pop();
|
2301 | }
|
2302 | else {
|
2303 | dropTrailingZeros = false;
|
2304 | }
|
2305 | }
|
2306 | return d >= 10 ? 1 : 0;
|
2307 | }, 0);
|
2308 | if (carry) {
|
2309 | digits.unshift(carry);
|
2310 | parsedNumber.integerLen++;
|
2311 | }
|
2312 | }
|
2313 | function parseIntAutoRadix(text) {
|
2314 | var result = parseInt(text);
|
2315 | if (isNaN(result)) {
|
2316 | throw new Error('Invalid integer literal when parsing ' + text);
|
2317 | }
|
2318 | return result;
|
2319 | }
|
2320 |
|
2321 |
|
2322 |
|
2323 |
|
2324 |
|
2325 |
|
2326 |
|
2327 |
|
2328 |
|
2329 |
|
2330 |
|
2331 | var DEPRECATED_PLURAL_FN = new InjectionToken('UseV4Plurals');
|
2332 |
|
2333 |
|
2334 |
|
2335 | var NgLocalization = (function () {
|
2336 | function NgLocalization() {
|
2337 | }
|
2338 | return NgLocalization;
|
2339 | }());
|
2340 |
|
2341 |
|
2342 |
|
2343 |
|
2344 |
|
2345 | function getPluralCategory(value, cases, ngLocalization, locale) {
|
2346 | var key = "=" + value;
|
2347 | if (cases.indexOf(key) > -1) {
|
2348 | return key;
|
2349 | }
|
2350 | key = ngLocalization.getPluralCategory(value, locale);
|
2351 | if (cases.indexOf(key) > -1) {
|
2352 | return key;
|
2353 | }
|
2354 | if (cases.indexOf('other') > -1) {
|
2355 | return 'other';
|
2356 | }
|
2357 | throw new Error("No plural message found for value \"" + value + "\"");
|
2358 | }
|
2359 |
|
2360 |
|
2361 |
|
2362 |
|
2363 |
|
2364 | var NgLocaleLocalization = (function (_super) {
|
2365 | __extends(NgLocaleLocalization, _super);
|
2366 | function NgLocaleLocalization(locale,
|
2367 | /** @deprecated from v5 */
|
2368 | deprecatedPluralFn) {
|
2369 | var _this = _super.call(this) || this;
|
2370 | _this.locale = locale;
|
2371 | _this.deprecatedPluralFn = deprecatedPluralFn;
|
2372 | return _this;
|
2373 | }
|
2374 | NgLocaleLocalization.prototype.getPluralCategory = function (value, locale) {
|
2375 | var plural = this.deprecatedPluralFn ? this.deprecatedPluralFn(locale || this.locale, value) :
|
2376 | getLocalePluralCase(locale || this.locale)(value);
|
2377 | switch (plural) {
|
2378 | case Plural.Zero:
|
2379 | return 'zero';
|
2380 | case Plural.One:
|
2381 | return 'one';
|
2382 | case Plural.Two:
|
2383 | return 'two';
|
2384 | case Plural.Few:
|
2385 | return 'few';
|
2386 | case Plural.Many:
|
2387 | return 'many';
|
2388 | default:
|
2389 | return 'other';
|
2390 | }
|
2391 | };
|
2392 | NgLocaleLocalization = __decorate([
|
2393 | Injectable(),
|
2394 | __param(0, Inject(LOCALE_ID)),
|
2395 | __param(1, Optional()), __param(1, Inject(DEPRECATED_PLURAL_FN)),
|
2396 | __metadata("design:paramtypes", [String, Object])
|
2397 | ], NgLocaleLocalization);
|
2398 | return NgLocaleLocalization;
|
2399 | }(NgLocalization));
|
2400 |
|
2401 |
|
2402 |
|
2403 |
|
2404 |
|
2405 |
|
2406 | function getPluralCase(locale, nLike) {
|
2407 |
|
2408 | if (typeof nLike === 'string') {
|
2409 | nLike = parseInt(nLike, 10);
|
2410 | }
|
2411 | var n = nLike;
|
2412 | var nDecimal = n.toString().replace(/^[^.]*\.?/, '');
|
2413 | var i = Math.floor(Math.abs(n));
|
2414 | var v = nDecimal.length;
|
2415 | var f = parseInt(nDecimal, 10);
|
2416 | var t = parseInt(n.toString().replace(/^[^.]*\.?|0+$/g, ''), 10) || 0;
|
2417 | var lang = locale.split('-')[0].toLowerCase();
|
2418 | switch (lang) {
|
2419 | case 'af':
|
2420 | case 'asa':
|
2421 | case 'az':
|
2422 | case 'bem':
|
2423 | case 'bez':
|
2424 | case 'bg':
|
2425 | case 'brx':
|
2426 | case 'ce':
|
2427 | case 'cgg':
|
2428 | case 'chr':
|
2429 | case 'ckb':
|
2430 | case 'ee':
|
2431 | case 'el':
|
2432 | case 'eo':
|
2433 | case 'es':
|
2434 | case 'eu':
|
2435 | case 'fo':
|
2436 | case 'fur':
|
2437 | case 'gsw':
|
2438 | case 'ha':
|
2439 | case 'haw':
|
2440 | case 'hu':
|
2441 | case 'jgo':
|
2442 | case 'jmc':
|
2443 | case 'ka':
|
2444 | case 'kk':
|
2445 | case 'kkj':
|
2446 | case 'kl':
|
2447 | case 'ks':
|
2448 | case 'ksb':
|
2449 | case 'ky':
|
2450 | case 'lb':
|
2451 | case 'lg':
|
2452 | case 'mas':
|
2453 | case 'mgo':
|
2454 | case 'ml':
|
2455 | case 'mn':
|
2456 | case 'nb':
|
2457 | case 'nd':
|
2458 | case 'ne':
|
2459 | case 'nn':
|
2460 | case 'nnh':
|
2461 | case 'nyn':
|
2462 | case 'om':
|
2463 | case 'or':
|
2464 | case 'os':
|
2465 | case 'ps':
|
2466 | case 'rm':
|
2467 | case 'rof':
|
2468 | case 'rwk':
|
2469 | case 'saq':
|
2470 | case 'seh':
|
2471 | case 'sn':
|
2472 | case 'so':
|
2473 | case 'sq':
|
2474 | case 'ta':
|
2475 | case 'te':
|
2476 | case 'teo':
|
2477 | case 'tk':
|
2478 | case 'tr':
|
2479 | case 'ug':
|
2480 | case 'uz':
|
2481 | case 'vo':
|
2482 | case 'vun':
|
2483 | case 'wae':
|
2484 | case 'xog':
|
2485 | if (n === 1)
|
2486 | return Plural.One;
|
2487 | return Plural.Other;
|
2488 | case 'ak':
|
2489 | case 'ln':
|
2490 | case 'mg':
|
2491 | case 'pa':
|
2492 | case 'ti':
|
2493 | if (n === Math.floor(n) && n >= 0 && n <= 1)
|
2494 | return Plural.One;
|
2495 | return Plural.Other;
|
2496 | case 'am':
|
2497 | case 'as':
|
2498 | case 'bn':
|
2499 | case 'fa':
|
2500 | case 'gu':
|
2501 | case 'hi':
|
2502 | case 'kn':
|
2503 | case 'mr':
|
2504 | case 'zu':
|
2505 | if (i === 0 || n === 1)
|
2506 | return Plural.One;
|
2507 | return Plural.Other;
|
2508 | case 'ar':
|
2509 | if (n === 0)
|
2510 | return Plural.Zero;
|
2511 | if (n === 1)
|
2512 | return Plural.One;
|
2513 | if (n === 2)
|
2514 | return Plural.Two;
|
2515 | if (n % 100 === Math.floor(n % 100) && n % 100 >= 3 && n % 100 <= 10)
|
2516 | return Plural.Few;
|
2517 | if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 99)
|
2518 | return Plural.Many;
|
2519 | return Plural.Other;
|
2520 | case 'ast':
|
2521 | case 'ca':
|
2522 | case 'de':
|
2523 | case 'en':
|
2524 | case 'et':
|
2525 | case 'fi':
|
2526 | case 'fy':
|
2527 | case 'gl':
|
2528 | case 'it':
|
2529 | case 'nl':
|
2530 | case 'sv':
|
2531 | case 'sw':
|
2532 | case 'ur':
|
2533 | case 'yi':
|
2534 | if (i === 1 && v === 0)
|
2535 | return Plural.One;
|
2536 | return Plural.Other;
|
2537 | case 'be':
|
2538 | if (n % 10 === 1 && !(n % 100 === 11))
|
2539 | return Plural.One;
|
2540 | if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 4 &&
|
2541 | !(n % 100 >= 12 && n % 100 <= 14))
|
2542 | return Plural.Few;
|
2543 | if (n % 10 === 0 || n % 10 === Math.floor(n % 10) && n % 10 >= 5 && n % 10 <= 9 ||
|
2544 | n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 14)
|
2545 | return Plural.Many;
|
2546 | return Plural.Other;
|
2547 | case 'br':
|
2548 | if (n % 10 === 1 && !(n % 100 === 11 || n % 100 === 71 || n % 100 === 91))
|
2549 | return Plural.One;
|
2550 | if (n % 10 === 2 && !(n % 100 === 12 || n % 100 === 72 || n % 100 === 92))
|
2551 | return Plural.Two;
|
2552 | if (n % 10 === Math.floor(n % 10) && (n % 10 >= 3 && n % 10 <= 4 || n % 10 === 9) &&
|
2553 | !(n % 100 >= 10 && n % 100 <= 19 || n % 100 >= 70 && n % 100 <= 79 ||
|
2554 | n % 100 >= 90 && n % 100 <= 99))
|
2555 | return Plural.Few;
|
2556 | if (!(n === 0) && n % 1e6 === 0)
|
2557 | return Plural.Many;
|
2558 | return Plural.Other;
|
2559 | case 'bs':
|
2560 | case 'hr':
|
2561 | case 'sr':
|
2562 | if (v === 0 && i % 10 === 1 && !(i % 100 === 11) || f % 10 === 1 && !(f % 100 === 11))
|
2563 | return Plural.One;
|
2564 | if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
|
2565 | !(i % 100 >= 12 && i % 100 <= 14) ||
|
2566 | f % 10 === Math.floor(f % 10) && f % 10 >= 2 && f % 10 <= 4 &&
|
2567 | !(f % 100 >= 12 && f % 100 <= 14))
|
2568 | return Plural.Few;
|
2569 | return Plural.Other;
|
2570 | case 'cs':
|
2571 | case 'sk':
|
2572 | if (i === 1 && v === 0)
|
2573 | return Plural.One;
|
2574 | if (i === Math.floor(i) && i >= 2 && i <= 4 && v === 0)
|
2575 | return Plural.Few;
|
2576 | if (!(v === 0))
|
2577 | return Plural.Many;
|
2578 | return Plural.Other;
|
2579 | case 'cy':
|
2580 | if (n === 0)
|
2581 | return Plural.Zero;
|
2582 | if (n === 1)
|
2583 | return Plural.One;
|
2584 | if (n === 2)
|
2585 | return Plural.Two;
|
2586 | if (n === 3)
|
2587 | return Plural.Few;
|
2588 | if (n === 6)
|
2589 | return Plural.Many;
|
2590 | return Plural.Other;
|
2591 | case 'da':
|
2592 | if (n === 1 || !(t === 0) && (i === 0 || i === 1))
|
2593 | return Plural.One;
|
2594 | return Plural.Other;
|
2595 | case 'dsb':
|
2596 | case 'hsb':
|
2597 | if (v === 0 && i % 100 === 1 || f % 100 === 1)
|
2598 | return Plural.One;
|
2599 | if (v === 0 && i % 100 === 2 || f % 100 === 2)
|
2600 | return Plural.Two;
|
2601 | if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 ||
|
2602 | f % 100 === Math.floor(f % 100) && f % 100 >= 3 && f % 100 <= 4)
|
2603 | return Plural.Few;
|
2604 | return Plural.Other;
|
2605 | case 'ff':
|
2606 | case 'fr':
|
2607 | case 'hy':
|
2608 | case 'kab':
|
2609 | if (i === 0 || i === 1)
|
2610 | return Plural.One;
|
2611 | return Plural.Other;
|
2612 | case 'fil':
|
2613 | if (v === 0 && (i === 1 || i === 2 || i === 3) ||
|
2614 | v === 0 && !(i % 10 === 4 || i % 10 === 6 || i % 10 === 9) ||
|
2615 | !(v === 0) && !(f % 10 === 4 || f % 10 === 6 || f % 10 === 9))
|
2616 | return Plural.One;
|
2617 | return Plural.Other;
|
2618 | case 'ga':
|
2619 | if (n === 1)
|
2620 | return Plural.One;
|
2621 | if (n === 2)
|
2622 | return Plural.Two;
|
2623 | if (n === Math.floor(n) && n >= 3 && n <= 6)
|
2624 | return Plural.Few;
|
2625 | if (n === Math.floor(n) && n >= 7 && n <= 10)
|
2626 | return Plural.Many;
|
2627 | return Plural.Other;
|
2628 | case 'gd':
|
2629 | if (n === 1 || n === 11)
|
2630 | return Plural.One;
|
2631 | if (n === 2 || n === 12)
|
2632 | return Plural.Two;
|
2633 | if (n === Math.floor(n) && (n >= 3 && n <= 10 || n >= 13 && n <= 19))
|
2634 | return Plural.Few;
|
2635 | return Plural.Other;
|
2636 | case 'gv':
|
2637 | if (v === 0 && i % 10 === 1)
|
2638 | return Plural.One;
|
2639 | if (v === 0 && i % 10 === 2)
|
2640 | return Plural.Two;
|
2641 | if (v === 0 &&
|
2642 | (i % 100 === 0 || i % 100 === 20 || i % 100 === 40 || i % 100 === 60 || i % 100 === 80))
|
2643 | return Plural.Few;
|
2644 | if (!(v === 0))
|
2645 | return Plural.Many;
|
2646 | return Plural.Other;
|
2647 | case 'he':
|
2648 | if (i === 1 && v === 0)
|
2649 | return Plural.One;
|
2650 | if (i === 2 && v === 0)
|
2651 | return Plural.Two;
|
2652 | if (v === 0 && !(n >= 0 && n <= 10) && n % 10 === 0)
|
2653 | return Plural.Many;
|
2654 | return Plural.Other;
|
2655 | case 'is':
|
2656 | if (t === 0 && i % 10 === 1 && !(i % 100 === 11) || !(t === 0))
|
2657 | return Plural.One;
|
2658 | return Plural.Other;
|
2659 | case 'ksh':
|
2660 | if (n === 0)
|
2661 | return Plural.Zero;
|
2662 | if (n === 1)
|
2663 | return Plural.One;
|
2664 | return Plural.Other;
|
2665 | case 'kw':
|
2666 | case 'naq':
|
2667 | case 'se':
|
2668 | case 'smn':
|
2669 | if (n === 1)
|
2670 | return Plural.One;
|
2671 | if (n === 2)
|
2672 | return Plural.Two;
|
2673 | return Plural.Other;
|
2674 | case 'lag':
|
2675 | if (n === 0)
|
2676 | return Plural.Zero;
|
2677 | if ((i === 0 || i === 1) && !(n === 0))
|
2678 | return Plural.One;
|
2679 | return Plural.Other;
|
2680 | case 'lt':
|
2681 | if (n % 10 === 1 && !(n % 100 >= 11 && n % 100 <= 19))
|
2682 | return Plural.One;
|
2683 | if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 9 &&
|
2684 | !(n % 100 >= 11 && n % 100 <= 19))
|
2685 | return Plural.Few;
|
2686 | if (!(f === 0))
|
2687 | return Plural.Many;
|
2688 | return Plural.Other;
|
2689 | case 'lv':
|
2690 | case 'prg':
|
2691 | if (n % 10 === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19 ||
|
2692 | v === 2 && f % 100 === Math.floor(f % 100) && f % 100 >= 11 && f % 100 <= 19)
|
2693 | return Plural.Zero;
|
2694 | if (n % 10 === 1 && !(n % 100 === 11) || v === 2 && f % 10 === 1 && !(f % 100 === 11) ||
|
2695 | !(v === 2) && f % 10 === 1)
|
2696 | return Plural.One;
|
2697 | return Plural.Other;
|
2698 | case 'mk':
|
2699 | if (v === 0 && i % 10 === 1 || f % 10 === 1)
|
2700 | return Plural.One;
|
2701 | return Plural.Other;
|
2702 | case 'mt':
|
2703 | if (n === 1)
|
2704 | return Plural.One;
|
2705 | if (n === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 2 && n % 100 <= 10)
|
2706 | return Plural.Few;
|
2707 | if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19)
|
2708 | return Plural.Many;
|
2709 | return Plural.Other;
|
2710 | case 'pl':
|
2711 | if (i === 1 && v === 0)
|
2712 | return Plural.One;
|
2713 | if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
|
2714 | !(i % 100 >= 12 && i % 100 <= 14))
|
2715 | return Plural.Few;
|
2716 | if (v === 0 && !(i === 1) && i % 10 === Math.floor(i % 10) && i % 10 >= 0 && i % 10 <= 1 ||
|
2717 | v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 ||
|
2718 | v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 12 && i % 100 <= 14)
|
2719 | return Plural.Many;
|
2720 | return Plural.Other;
|
2721 | case 'pt':
|
2722 | if (n === Math.floor(n) && n >= 0 && n <= 2 && !(n === 2))
|
2723 | return Plural.One;
|
2724 | return Plural.Other;
|
2725 | case 'ro':
|
2726 | if (i === 1 && v === 0)
|
2727 | return Plural.One;
|
2728 | if (!(v === 0) || n === 0 ||
|
2729 | !(n === 1) && n % 100 === Math.floor(n % 100) && n % 100 >= 1 && n % 100 <= 19)
|
2730 | return Plural.Few;
|
2731 | return Plural.Other;
|
2732 | case 'ru':
|
2733 | case 'uk':
|
2734 | if (v === 0 && i % 10 === 1 && !(i % 100 === 11))
|
2735 | return Plural.One;
|
2736 | if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
|
2737 | !(i % 100 >= 12 && i % 100 <= 14))
|
2738 | return Plural.Few;
|
2739 | if (v === 0 && i % 10 === 0 ||
|
2740 | v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 ||
|
2741 | v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 11 && i % 100 <= 14)
|
2742 | return Plural.Many;
|
2743 | return Plural.Other;
|
2744 | case 'shi':
|
2745 | if (i === 0 || n === 1)
|
2746 | return Plural.One;
|
2747 | if (n === Math.floor(n) && n >= 2 && n <= 10)
|
2748 | return Plural.Few;
|
2749 | return Plural.Other;
|
2750 | case 'si':
|
2751 | if (n === 0 || n === 1 || i === 0 && f === 1)
|
2752 | return Plural.One;
|
2753 | return Plural.Other;
|
2754 | case 'sl':
|
2755 | if (v === 0 && i % 100 === 1)
|
2756 | return Plural.One;
|
2757 | if (v === 0 && i % 100 === 2)
|
2758 | return Plural.Two;
|
2759 | if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 || !(v === 0))
|
2760 | return Plural.Few;
|
2761 | return Plural.Other;
|
2762 | case 'tzm':
|
2763 | if (n === Math.floor(n) && n >= 0 && n <= 1 || n === Math.floor(n) && n >= 11 && n <= 99)
|
2764 | return Plural.One;
|
2765 | return Plural.Other;
|
2766 |
|
2767 |
|
2768 |
|
2769 | default:
|
2770 | return Plural.Other;
|
2771 | }
|
2772 | }
|
2773 |
|
2774 |
|
2775 |
|
2776 |
|
2777 |
|
2778 |
|
2779 |
|
2780 |
|
2781 |
|
2782 |
|
2783 |
|
2784 |
|
2785 |
|
2786 |
|
2787 |
|
2788 | function registerLocaleData(data, localeId, extraData) {
|
2789 | if (typeof localeId !== 'string') {
|
2790 | extraData = localeId;
|
2791 | localeId = data[ɵLocaleDataIndex.LocaleId];
|
2792 | }
|
2793 | localeId = localeId.toLowerCase().replace(/_/g, '-');
|
2794 | ɵLOCALE_DATA[localeId] = data;
|
2795 | if (extraData) {
|
2796 | ɵLOCALE_DATA[localeId][ɵLocaleDataIndex.ExtraData] = extraData;
|
2797 | }
|
2798 | }
|
2799 |
|
2800 |
|
2801 |
|
2802 |
|
2803 |
|
2804 |
|
2805 |
|
2806 |
|
2807 | function parseCookieValue(cookieStr, name) {
|
2808 | var e_1, _a;
|
2809 | name = encodeURIComponent(name);
|
2810 | try {
|
2811 | for (var _b = __values(cookieStr.split(';')), _c = _b.next(); !_c.done; _c = _b.next()) {
|
2812 | var cookie = _c.value;
|
2813 | var eqIndex = cookie.indexOf('=');
|
2814 | var _d = __read(eqIndex == -1 ? [cookie, ''] : [cookie.slice(0, eqIndex), cookie.slice(eqIndex + 1)], 2), cookieName = _d[0], cookieValue = _d[1];
|
2815 | if (cookieName.trim() === name) {
|
2816 | return decodeURIComponent(cookieValue);
|
2817 | }
|
2818 | }
|
2819 | }
|
2820 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
2821 | finally {
|
2822 | try {
|
2823 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
2824 | }
|
2825 | finally { if (e_1) throw e_1.error; }
|
2826 | }
|
2827 | return null;
|
2828 | }
|
2829 |
|
2830 |
|
2831 |
|
2832 |
|
2833 |
|
2834 |
|
2835 |
|
2836 |
|
2837 |
|
2838 |
|
2839 |
|
2840 |
|
2841 |
|
2842 |
|
2843 |
|
2844 |
|
2845 |
|
2846 |
|
2847 |
|
2848 |
|
2849 |
|
2850 |
|
2851 |
|
2852 |
|
2853 |
|
2854 |
|
2855 |
|
2856 |
|
2857 |
|
2858 |
|
2859 |
|
2860 |
|
2861 |
|
2862 |
|
2863 |
|
2864 |
|
2865 |
|
2866 |
|
2867 |
|
2868 |
|
2869 |
|
2870 |
|
2871 |
|
2872 |
|
2873 |
|
2874 |
|
2875 |
|
2876 |
|
2877 |
|
2878 |
|
2879 |
|
2880 |
|
2881 |
|
2882 |
|
2883 |
|
2884 |
|
2885 |
|
2886 |
|
2887 |
|
2888 | var StylingDiffer = (function () {
|
2889 | function StylingDiffer(_name, _options) {
|
2890 | this._name = _name;
|
2891 | this._options = _options;
|
2892 | this.value = null;
|
2893 | this._lastSetValue = null;
|
2894 | this._lastSetValueType = 0 ;
|
2895 | this._lastSetValueIdentityChange = false;
|
2896 | }
|
2897 | |
2898 |
|
2899 |
|
2900 |
|
2901 |
|
2902 |
|
2903 |
|
2904 |
|
2905 | StylingDiffer.prototype.setValue = function (value) {
|
2906 | if (Array.isArray(value)) {
|
2907 | this._lastSetValueType = 4 ;
|
2908 | }
|
2909 | else if (value instanceof Set) {
|
2910 | this._lastSetValueType = 8 ;
|
2911 | }
|
2912 | else if (value && typeof value === 'string') {
|
2913 | if (!(this._options & 4 )) {
|
2914 | throw new Error(this._name + ' string values are not allowed');
|
2915 | }
|
2916 | this._lastSetValueType = 1 ;
|
2917 | }
|
2918 | else {
|
2919 | this._lastSetValueType = value ? 2 : 0 ;
|
2920 | }
|
2921 | this._lastSetValueIdentityChange = true;
|
2922 | this._lastSetValue = value || null;
|
2923 | };
|
2924 | |
2925 |
|
2926 |
|
2927 |
|
2928 |
|
2929 |
|
2930 |
|
2931 |
|
2932 |
|
2933 |
|
2934 | StylingDiffer.prototype.hasValueChanged = function () {
|
2935 | var valueHasChanged = this._lastSetValueIdentityChange;
|
2936 | if (!valueHasChanged && !(this._lastSetValueType & 14 ))
|
2937 | return false;
|
2938 | var finalValue = null;
|
2939 | var trimValues = (this._options & 1 ) ? true : false;
|
2940 | var parseOutUnits = (this._options & 8 ) ? true : false;
|
2941 | var allowSubKeys = (this._options & 2 ) ? true : false;
|
2942 | switch (this._lastSetValueType) {
|
2943 |
|
2944 | case 1 :
|
2945 | var tokens = this._lastSetValue.split(/\s+/g);
|
2946 | if (this._options & 16 ) {
|
2947 | finalValue = {};
|
2948 | tokens.forEach(function (token, i) { return finalValue[token] = true; });
|
2949 | }
|
2950 | else {
|
2951 | finalValue = tokens.reduce(function (str, token, i) { return str + (i ? ' ' : '') + token; });
|
2952 | }
|
2953 | break;
|
2954 |
|
2955 | case 2 :
|
2956 | var map = this._lastSetValue;
|
2957 | var keys = Object.keys(map);
|
2958 | if (!valueHasChanged) {
|
2959 | if (this.value) {
|
2960 |
|
2961 |
|
2962 | valueHasChanged = mapHasChanged(keys, this.value, map);
|
2963 | }
|
2964 | else {
|
2965 | valueHasChanged = true;
|
2966 | }
|
2967 | }
|
2968 | if (valueHasChanged) {
|
2969 | finalValue =
|
2970 | bulidMapFromValues(this._name, trimValues, parseOutUnits, allowSubKeys, map, keys);
|
2971 | }
|
2972 | break;
|
2973 |
|
2974 |
|
2975 | case 4 :
|
2976 | case 8 :
|
2977 | var values = Array.from(this._lastSetValue);
|
2978 | if (!valueHasChanged) {
|
2979 | var keys_1 = Object.keys(this.value);
|
2980 | valueHasChanged = !arrayEqualsArray(keys_1, values);
|
2981 | }
|
2982 | if (valueHasChanged) {
|
2983 | finalValue =
|
2984 | bulidMapFromValues(this._name, trimValues, parseOutUnits, allowSubKeys, values);
|
2985 | }
|
2986 | break;
|
2987 |
|
2988 | default:
|
2989 | finalValue = null;
|
2990 | break;
|
2991 | }
|
2992 | if (valueHasChanged) {
|
2993 | this.value = finalValue;
|
2994 | }
|
2995 | return valueHasChanged;
|
2996 | };
|
2997 | return StylingDiffer;
|
2998 | }());
|
2999 |
|
3000 |
|
3001 |
|
3002 |
|
3003 |
|
3004 |
|
3005 | function bulidMapFromValues(errorPrefix, trim, parseOutUnits, allowSubKeys, values, keys) {
|
3006 | var map = {};
|
3007 | if (keys) {
|
3008 |
|
3009 | for (var i = 0; i < keys.length; i++) {
|
3010 | var key = keys[i];
|
3011 | key = trim ? key.trim() : key;
|
3012 | var value = values[key];
|
3013 | setMapValues(map, key, value, parseOutUnits, allowSubKeys);
|
3014 | }
|
3015 | }
|
3016 | else {
|
3017 |
|
3018 | for (var i = 0; i < values.length; i++) {
|
3019 | var value = values[i];
|
3020 | assertValidValue(errorPrefix, value);
|
3021 | value = trim ? value.trim() : value;
|
3022 | setMapValues(map, value, true, false, allowSubKeys);
|
3023 | }
|
3024 | }
|
3025 | return map;
|
3026 | }
|
3027 | function assertValidValue(errorPrefix, value) {
|
3028 | if (typeof value !== 'string') {
|
3029 | throw new Error(errorPrefix + " can only toggle CSS classes expressed as strings, got " + value);
|
3030 | }
|
3031 | }
|
3032 | function setMapValues(map, key, value, parseOutUnits, allowSubKeys) {
|
3033 | if (allowSubKeys && key.indexOf(' ') > 0) {
|
3034 | var innerKeys = key.split(/\s+/g);
|
3035 | for (var j = 0; j < innerKeys.length; j++) {
|
3036 | setIndividualMapValue(map, innerKeys[j], value, parseOutUnits);
|
3037 | }
|
3038 | }
|
3039 | else {
|
3040 | setIndividualMapValue(map, key, value, parseOutUnits);
|
3041 | }
|
3042 | }
|
3043 | function setIndividualMapValue(map, key, value, parseOutUnits) {
|
3044 | if (parseOutUnits) {
|
3045 | var values = normalizeStyleKeyAndValue(key, value);
|
3046 | value = values.value;
|
3047 | key = values.key;
|
3048 | }
|
3049 | map[key] = value;
|
3050 | }
|
3051 | function normalizeStyleKeyAndValue(key, value) {
|
3052 | var index = key.indexOf('.');
|
3053 | if (index > 0) {
|
3054 | var unit = key.substr(index + 1);
|
3055 | key = key.substring(0, index);
|
3056 | if (value != null) {
|
3057 | value += unit;
|
3058 | }
|
3059 | }
|
3060 | return { key: key, value: value };
|
3061 | }
|
3062 | function mapHasChanged(keys, a, b) {
|
3063 | var oldKeys = Object.keys(a);
|
3064 | var newKeys = keys;
|
3065 |
|
3066 | if (!arrayEqualsArray(oldKeys, newKeys)) {
|
3067 | return true;
|
3068 | }
|
3069 | for (var i = 0; i < newKeys.length; i++) {
|
3070 | var key = newKeys[i];
|
3071 | if (a[key] !== b[key]) {
|
3072 | return true;
|
3073 | }
|
3074 | }
|
3075 | return false;
|
3076 | }
|
3077 | function arrayEqualsArray(a, b) {
|
3078 | if (a && b) {
|
3079 | if (a.length !== b.length)
|
3080 | return false;
|
3081 | for (var i = 0; i < a.length; i++) {
|
3082 | if (b.indexOf(a[i]) === -1)
|
3083 | return false;
|
3084 | }
|
3085 | return true;
|
3086 | }
|
3087 | return false;
|
3088 | }
|
3089 |
|
3090 |
|
3091 |
|
3092 |
|
3093 |
|
3094 |
|
3095 |
|
3096 |
|
3097 |
|
3098 |
|
3099 | var NgClassImpl = (function () {
|
3100 | function NgClassImpl() {
|
3101 | }
|
3102 | return NgClassImpl;
|
3103 | }());
|
3104 | var NgClassR2Impl = (function () {
|
3105 | function NgClassR2Impl(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) {
|
3106 | this._iterableDiffers = _iterableDiffers;
|
3107 | this._keyValueDiffers = _keyValueDiffers;
|
3108 | this._ngEl = _ngEl;
|
3109 | this._renderer = _renderer;
|
3110 | this._initialClasses = [];
|
3111 | }
|
3112 | NgClassR2Impl.prototype.getValue = function () { return null; };
|
3113 | NgClassR2Impl.prototype.setClass = function (value) {
|
3114 | this._removeClasses(this._initialClasses);
|
3115 | this._initialClasses = typeof value === 'string' ? value.split(/\s+/) : [];
|
3116 | this._applyClasses(this._initialClasses);
|
3117 | this._applyClasses(this._rawClass);
|
3118 | };
|
3119 | NgClassR2Impl.prototype.setNgClass = function (value) {
|
3120 | this._removeClasses(this._rawClass);
|
3121 | this._applyClasses(this._initialClasses);
|
3122 | this._iterableDiffer = null;
|
3123 | this._keyValueDiffer = null;
|
3124 | this._rawClass = typeof value === 'string' ? value.split(/\s+/) : value;
|
3125 | if (this._rawClass) {
|
3126 | if (ɵisListLikeIterable(this._rawClass)) {
|
3127 | this._iterableDiffer = this._iterableDiffers.find(this._rawClass).create();
|
3128 | }
|
3129 | else {
|
3130 | this._keyValueDiffer = this._keyValueDiffers.find(this._rawClass).create();
|
3131 | }
|
3132 | }
|
3133 | };
|
3134 | NgClassR2Impl.prototype.applyChanges = function () {
|
3135 | if (this._iterableDiffer) {
|
3136 | var iterableChanges = this._iterableDiffer.diff(this._rawClass);
|
3137 | if (iterableChanges) {
|
3138 | this._applyIterableChanges(iterableChanges);
|
3139 | }
|
3140 | }
|
3141 | else if (this._keyValueDiffer) {
|
3142 | var keyValueChanges = this._keyValueDiffer.diff(this._rawClass);
|
3143 | if (keyValueChanges) {
|
3144 | this._applyKeyValueChanges(keyValueChanges);
|
3145 | }
|
3146 | }
|
3147 | };
|
3148 | NgClassR2Impl.prototype._applyKeyValueChanges = function (changes) {
|
3149 | var _this = this;
|
3150 | changes.forEachAddedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); });
|
3151 | changes.forEachChangedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); });
|
3152 | changes.forEachRemovedItem(function (record) {
|
3153 | if (record.previousValue) {
|
3154 | _this._toggleClass(record.key, false);
|
3155 | }
|
3156 | });
|
3157 | };
|
3158 | NgClassR2Impl.prototype._applyIterableChanges = function (changes) {
|
3159 | var _this = this;
|
3160 | changes.forEachAddedItem(function (record) {
|
3161 | if (typeof record.item === 'string') {
|
3162 | _this._toggleClass(record.item, true);
|
3163 | }
|
3164 | else {
|
3165 | throw new Error("NgClass can only toggle CSS classes expressed as strings, got " + ɵstringify(record.item));
|
3166 | }
|
3167 | });
|
3168 | changes.forEachRemovedItem(function (record) { return _this._toggleClass(record.item, false); });
|
3169 | };
|
3170 | |
3171 |
|
3172 |
|
3173 |
|
3174 |
|
3175 |
|
3176 |
|
3177 |
|
3178 | NgClassR2Impl.prototype._applyClasses = function (rawClassVal) {
|
3179 | var _this = this;
|
3180 | if (rawClassVal) {
|
3181 | if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) {
|
3182 | rawClassVal.forEach(function (klass) { return _this._toggleClass(klass, true); });
|
3183 | }
|
3184 | else {
|
3185 | Object.keys(rawClassVal).forEach(function (klass) { return _this._toggleClass(klass, !!rawClassVal[klass]); });
|
3186 | }
|
3187 | }
|
3188 | };
|
3189 | |
3190 |
|
3191 |
|
3192 |
|
3193 | NgClassR2Impl.prototype._removeClasses = function (rawClassVal) {
|
3194 | var _this = this;
|
3195 | if (rawClassVal) {
|
3196 | if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) {
|
3197 | rawClassVal.forEach(function (klass) { return _this._toggleClass(klass, false); });
|
3198 | }
|
3199 | else {
|
3200 | Object.keys(rawClassVal).forEach(function (klass) { return _this._toggleClass(klass, false); });
|
3201 | }
|
3202 | }
|
3203 | };
|
3204 | NgClassR2Impl.prototype._toggleClass = function (klass, enabled) {
|
3205 | var _this = this;
|
3206 | klass = klass.trim();
|
3207 | if (klass) {
|
3208 | klass.split(/\s+/g).forEach(function (klass) {
|
3209 | if (enabled) {
|
3210 | _this._renderer.addClass(_this._ngEl.nativeElement, klass);
|
3211 | }
|
3212 | else {
|
3213 | _this._renderer.removeClass(_this._ngEl.nativeElement, klass);
|
3214 | }
|
3215 | });
|
3216 | }
|
3217 | };
|
3218 | NgClassR2Impl = __decorate([
|
3219 | Injectable(),
|
3220 | __metadata("design:paramtypes", [IterableDiffers, KeyValueDiffers,
|
3221 | ElementRef, Renderer2])
|
3222 | ], NgClassR2Impl);
|
3223 | return NgClassR2Impl;
|
3224 | }());
|
3225 | var NgClassR3Impl = (function () {
|
3226 | function NgClassR3Impl() {
|
3227 | this._value = null;
|
3228 | this._ngClassDiffer = new StylingDiffer('NgClass', 1 |
|
3229 | 2 |
|
3230 | 4 | 16 );
|
3231 | this._classStringDiffer = null;
|
3232 | }
|
3233 | NgClassR3Impl.prototype.getValue = function () { return this._value; };
|
3234 | NgClassR3Impl.prototype.setClass = function (value) {
|
3235 |
|
3236 |
|
3237 | if (!value && !this._classStringDiffer)
|
3238 | return;
|
3239 | this._classStringDiffer = this._classStringDiffer ||
|
3240 | new StylingDiffer('class', 4 | 16 );
|
3241 | this._classStringDiffer.setValue(value);
|
3242 | };
|
3243 | NgClassR3Impl.prototype.setNgClass = function (value) {
|
3244 | this._ngClassDiffer.setValue(value);
|
3245 | };
|
3246 | NgClassR3Impl.prototype.applyChanges = function () {
|
3247 | var classChanged = this._classStringDiffer ? this._classStringDiffer.hasValueChanged() : false;
|
3248 | var ngClassChanged = this._ngClassDiffer.hasValueChanged();
|
3249 | if (classChanged || ngClassChanged) {
|
3250 | var value = this._ngClassDiffer.value;
|
3251 | if (this._classStringDiffer) {
|
3252 | var classValue = this._classStringDiffer.value;
|
3253 | if (classValue) {
|
3254 | value = value ? __assign({}, classValue, value) : classValue;
|
3255 | }
|
3256 | }
|
3257 | this._value = value;
|
3258 | }
|
3259 | };
|
3260 | NgClassR3Impl = __decorate([
|
3261 | Injectable()
|
3262 | ], NgClassR3Impl);
|
3263 | return NgClassR3Impl;
|
3264 | }());
|
3265 |
|
3266 |
|
3267 |
|
3268 | var NgClassImplProvider__PRE_R3__ = {
|
3269 | provide: NgClassImpl,
|
3270 | useClass: NgClassR2Impl
|
3271 | };
|
3272 | var NgClassImplProvider__POST_R3__ = {
|
3273 | provide: NgClassImpl,
|
3274 | useClass: NgClassR3Impl
|
3275 | };
|
3276 | var NgClassImplProvider = NgClassImplProvider__PRE_R3__;
|
3277 |
|
3278 |
|
3279 |
|
3280 |
|
3281 |
|
3282 |
|
3283 |
|
3284 |
|
3285 |
|
3286 |
|
3287 |
|
3288 |
|
3289 |
|
3290 | var ngClassDirectiveDef__PRE_R3__ = undefined;
|
3291 | var ɵ0 = function () { }, ɵ1 = function () { }, ɵ2 = function (rf, ctx, elIndex) {
|
3292 | if (rf & 1 ) {
|
3293 | ɵɵallocHostVars(1);
|
3294 | ɵɵstyling();
|
3295 | }
|
3296 | if (rf & 2 ) {
|
3297 | ɵɵclassMap(ctx.getValue());
|
3298 | ɵɵstylingApply();
|
3299 | }
|
3300 | };
|
3301 |
|
3302 |
|
3303 |
|
3304 | var ngClassDirectiveDef__POST_R3__ = ɵɵdefineDirective({
|
3305 | type: ɵ0,
|
3306 | selectors: null,
|
3307 | factory: ɵ1,
|
3308 | hostBindings: ɵ2
|
3309 | });
|
3310 | var ngClassDirectiveDef = ngClassDirectiveDef__PRE_R3__;
|
3311 |
|
3312 |
|
3313 |
|
3314 |
|
3315 |
|
3316 |
|
3317 |
|
3318 |
|
3319 |
|
3320 |
|
3321 |
|
3322 |
|
3323 |
|
3324 |
|
3325 | var NgClassBase = (function () {
|
3326 | function NgClassBase(_delegate) {
|
3327 | this._delegate = _delegate;
|
3328 | }
|
3329 | NgClassBase.prototype.getValue = function () { return this._delegate.getValue(); };
|
3330 | NgClassBase.ngDirectiveDef = ngClassDirectiveDef;
|
3331 | return NgClassBase;
|
3332 | }());
|
3333 |
|
3334 |
|
3335 |
|
3336 |
|
3337 |
|
3338 |
|
3339 |
|
3340 |
|
3341 |
|
3342 |
|
3343 |
|
3344 |
|
3345 |
|
3346 |
|
3347 |
|
3348 |
|
3349 |
|
3350 |
|
3351 |
|
3352 |
|
3353 |
|
3354 |
|
3355 |
|
3356 |
|
3357 |
|
3358 |
|
3359 |
|
3360 |
|
3361 | var NgClass = (function (_super) {
|
3362 | __extends(NgClass, _super);
|
3363 | function NgClass(delegate) {
|
3364 | return _super.call(this, delegate) || this;
|
3365 | }
|
3366 | Object.defineProperty(NgClass.prototype, "klass", {
|
3367 | set: function (value) { this._delegate.setClass(value); },
|
3368 | enumerable: true,
|
3369 | configurable: true
|
3370 | });
|
3371 | Object.defineProperty(NgClass.prototype, "ngClass", {
|
3372 | set: function (value) {
|
3373 | this._delegate.setNgClass(value);
|
3374 | },
|
3375 | enumerable: true,
|
3376 | configurable: true
|
3377 | });
|
3378 | NgClass.prototype.ngDoCheck = function () { this._delegate.applyChanges(); };
|
3379 | __decorate([
|
3380 | Input('class'),
|
3381 | __metadata("design:type", String),
|
3382 | __metadata("design:paramtypes", [String])
|
3383 | ], NgClass.prototype, "klass", null);
|
3384 | __decorate([
|
3385 | Input('ngClass'),
|
3386 | __metadata("design:type", Object),
|
3387 | __metadata("design:paramtypes", [Object])
|
3388 | ], NgClass.prototype, "ngClass", null);
|
3389 | NgClass = __decorate([
|
3390 | Directive({ selector: '[ngClass]', providers: [NgClassImplProvider] }),
|
3391 | __metadata("design:paramtypes", [NgClassImpl])
|
3392 | ], NgClass);
|
3393 | return NgClass;
|
3394 | }(NgClassBase));
|
3395 |
|
3396 |
|
3397 |
|
3398 |
|
3399 |
|
3400 |
|
3401 |
|
3402 |
|
3403 |
|
3404 |
|
3405 |
|
3406 |
|
3407 |
|
3408 |
|
3409 |
|
3410 |
|
3411 |
|
3412 |
|
3413 |
|
3414 |
|
3415 |
|
3416 |
|
3417 |
|
3418 |
|
3419 |
|
3420 |
|
3421 |
|
3422 |
|
3423 |
|
3424 |
|
3425 |
|
3426 |
|
3427 |
|
3428 |
|
3429 |
|
3430 |
|
3431 |
|
3432 |
|
3433 |
|
3434 |
|
3435 |
|
3436 |
|
3437 |
|
3438 |
|
3439 |
|
3440 |
|
3441 |
|
3442 |
|
3443 |
|
3444 |
|
3445 |
|
3446 |
|
3447 |
|
3448 |
|
3449 |
|
3450 |
|
3451 |
|
3452 |
|
3453 |
|
3454 |
|
3455 |
|
3456 |
|
3457 |
|
3458 | var NgComponentOutlet = (function () {
|
3459 | function NgComponentOutlet(_viewContainerRef) {
|
3460 | this._viewContainerRef = _viewContainerRef;
|
3461 | this._componentRef = null;
|
3462 | this._moduleRef = null;
|
3463 | }
|
3464 | NgComponentOutlet.prototype.ngOnChanges = function (changes) {
|
3465 | this._viewContainerRef.clear();
|
3466 | this._componentRef = null;
|
3467 | if (this.ngComponentOutlet) {
|
3468 | var elInjector = this.ngComponentOutletInjector || this._viewContainerRef.parentInjector;
|
3469 | if (changes['ngComponentOutletNgModuleFactory']) {
|
3470 | if (this._moduleRef)
|
3471 | this._moduleRef.destroy();
|
3472 | if (this.ngComponentOutletNgModuleFactory) {
|
3473 | var parentModule = elInjector.get(NgModuleRef);
|
3474 | this._moduleRef = this.ngComponentOutletNgModuleFactory.create(parentModule.injector);
|
3475 | }
|
3476 | else {
|
3477 | this._moduleRef = null;
|
3478 | }
|
3479 | }
|
3480 | var componentFactoryResolver = this._moduleRef ? this._moduleRef.componentFactoryResolver :
|
3481 | elInjector.get(ComponentFactoryResolver);
|
3482 | var componentFactory = componentFactoryResolver.resolveComponentFactory(this.ngComponentOutlet);
|
3483 | this._componentRef = this._viewContainerRef.createComponent(componentFactory, this._viewContainerRef.length, elInjector, this.ngComponentOutletContent);
|
3484 | }
|
3485 | };
|
3486 | NgComponentOutlet.prototype.ngOnDestroy = function () {
|
3487 | if (this._moduleRef)
|
3488 | this._moduleRef.destroy();
|
3489 | };
|
3490 | __decorate([
|
3491 | Input(),
|
3492 | __metadata("design:type", Type)
|
3493 | ], NgComponentOutlet.prototype, "ngComponentOutlet", void 0);
|
3494 | __decorate([
|
3495 | Input(),
|
3496 | __metadata("design:type", Injector)
|
3497 | ], NgComponentOutlet.prototype, "ngComponentOutletInjector", void 0);
|
3498 | __decorate([
|
3499 | Input(),
|
3500 | __metadata("design:type", Array)
|
3501 | ], NgComponentOutlet.prototype, "ngComponentOutletContent", void 0);
|
3502 | __decorate([
|
3503 | Input(),
|
3504 | __metadata("design:type", NgModuleFactory)
|
3505 | ], NgComponentOutlet.prototype, "ngComponentOutletNgModuleFactory", void 0);
|
3506 | NgComponentOutlet = __decorate([
|
3507 | Directive({ selector: '[ngComponentOutlet]' }),
|
3508 | __metadata("design:paramtypes", [ViewContainerRef])
|
3509 | ], NgComponentOutlet);
|
3510 | return NgComponentOutlet;
|
3511 | }());
|
3512 |
|
3513 |
|
3514 |
|
3515 |
|
3516 |
|
3517 |
|
3518 |
|
3519 |
|
3520 |
|
3521 |
|
3522 |
|
3523 | var NgForOfContext = (function () {
|
3524 | function NgForOfContext($implicit, ngForOf, index, count) {
|
3525 | this.$implicit = $implicit;
|
3526 | this.ngForOf = ngForOf;
|
3527 | this.index = index;
|
3528 | this.count = count;
|
3529 | }
|
3530 | Object.defineProperty(NgForOfContext.prototype, "first", {
|
3531 | get: function () { return this.index === 0; },
|
3532 | enumerable: true,
|
3533 | configurable: true
|
3534 | });
|
3535 | Object.defineProperty(NgForOfContext.prototype, "last", {
|
3536 | get: function () { return this.index === this.count - 1; },
|
3537 | enumerable: true,
|
3538 | configurable: true
|
3539 | });
|
3540 | Object.defineProperty(NgForOfContext.prototype, "even", {
|
3541 | get: function () { return this.index % 2 === 0; },
|
3542 | enumerable: true,
|
3543 | configurable: true
|
3544 | });
|
3545 | Object.defineProperty(NgForOfContext.prototype, "odd", {
|
3546 | get: function () { return !this.even; },
|
3547 | enumerable: true,
|
3548 | configurable: true
|
3549 | });
|
3550 | return NgForOfContext;
|
3551 | }());
|
3552 |
|
3553 |
|
3554 |
|
3555 |
|
3556 |
|
3557 |
|
3558 |
|
3559 |
|
3560 |
|
3561 |
|
3562 |
|
3563 |
|
3564 |
|
3565 |
|
3566 |
|
3567 |
|
3568 |
|
3569 |
|
3570 |
|
3571 |
|
3572 |
|
3573 |
|
3574 |
|
3575 |
|
3576 |
|
3577 |
|
3578 |
|
3579 |
|
3580 |
|
3581 |
|
3582 |
|
3583 |
|
3584 |
|
3585 |
|
3586 |
|
3587 |
|
3588 |
|
3589 |
|
3590 |
|
3591 |
|
3592 |
|
3593 |
|
3594 |
|
3595 |
|
3596 |
|
3597 |
|
3598 |
|
3599 |
|
3600 |
|
3601 |
|
3602 |
|
3603 |
|
3604 |
|
3605 |
|
3606 |
|
3607 |
|
3608 |
|
3609 |
|
3610 |
|
3611 |
|
3612 |
|
3613 |
|
3614 |
|
3615 |
|
3616 |
|
3617 |
|
3618 |
|
3619 |
|
3620 |
|
3621 |
|
3622 |
|
3623 |
|
3624 |
|
3625 |
|
3626 |
|
3627 |
|
3628 |
|
3629 |
|
3630 |
|
3631 |
|
3632 |
|
3633 |
|
3634 |
|
3635 |
|
3636 |
|
3637 |
|
3638 |
|
3639 |
|
3640 |
|
3641 |
|
3642 |
|
3643 |
|
3644 |
|
3645 |
|
3646 |
|
3647 |
|
3648 |
|
3649 | var NgForOf = (function () {
|
3650 | function NgForOf(_viewContainer, _template, _differs) {
|
3651 | this._viewContainer = _viewContainer;
|
3652 | this._template = _template;
|
3653 | this._differs = _differs;
|
3654 | this._ngForOfDirty = true;
|
3655 | this._differ = null;
|
3656 | }
|
3657 | Object.defineProperty(NgForOf.prototype, "ngForOf", {
|
3658 | |
3659 |
|
3660 |
|
3661 |
|
3662 | set: function (ngForOf) {
|
3663 | this._ngForOf = ngForOf;
|
3664 | this._ngForOfDirty = true;
|
3665 | },
|
3666 | enumerable: true,
|
3667 | configurable: true
|
3668 | });
|
3669 | Object.defineProperty(NgForOf.prototype, "ngForTrackBy", {
|
3670 | get: function () { return this._trackByFn; },
|
3671 | |
3672 |
|
3673 |
|
3674 |
|
3675 |
|
3676 |
|
3677 |
|
3678 |
|
3679 |
|
3680 |
|
3681 |
|
3682 |
|
3683 |
|
3684 |
|
3685 |
|
3686 |
|
3687 |
|
3688 | set: function (fn) {
|
3689 | if (isDevMode() && fn != null && typeof fn !== 'function') {
|
3690 |
|
3691 | if (console && console.warn) {
|
3692 | console.warn("trackBy must be a function, but received " + JSON.stringify(fn) + ". " +
|
3693 | "See https://angular.io/docs/ts/latest/api/common/index/NgFor-directive.html#!#change-propagation for more information.");
|
3694 | }
|
3695 | }
|
3696 | this._trackByFn = fn;
|
3697 | },
|
3698 | enumerable: true,
|
3699 | configurable: true
|
3700 | });
|
3701 | Object.defineProperty(NgForOf.prototype, "ngForTemplate", {
|
3702 | |
3703 |
|
3704 |
|
3705 |
|
3706 | set: function (value) {
|
3707 |
|
3708 |
|
3709 |
|
3710 | if (value) {
|
3711 | this._template = value;
|
3712 | }
|
3713 | },
|
3714 | enumerable: true,
|
3715 | configurable: true
|
3716 | });
|
3717 | |
3718 |
|
3719 |
|
3720 | NgForOf.prototype.ngDoCheck = function () {
|
3721 | if (this._ngForOfDirty) {
|
3722 | this._ngForOfDirty = false;
|
3723 |
|
3724 | var value = this._ngForOf;
|
3725 | if (!this._differ && value) {
|
3726 | try {
|
3727 | this._differ = this._differs.find(value).create(this.ngForTrackBy);
|
3728 | }
|
3729 | catch (_a) {
|
3730 | throw new Error("Cannot find a differ supporting object '" + value + "' of type '" + getTypeName(value) + "'. NgFor only supports binding to Iterables such as Arrays.");
|
3731 | }
|
3732 | }
|
3733 | }
|
3734 | if (this._differ) {
|
3735 | var changes = this._differ.diff(this._ngForOf);
|
3736 | if (changes)
|
3737 | this._applyChanges(changes);
|
3738 | }
|
3739 | };
|
3740 | NgForOf.prototype._applyChanges = function (changes) {
|
3741 | var _this = this;
|
3742 | var insertTuples = [];
|
3743 | changes.forEachOperation(function (item, adjustedPreviousIndex, currentIndex) {
|
3744 | if (item.previousIndex == null) {
|
3745 | var view = _this._viewContainer.createEmbeddedView(_this._template, new NgForOfContext(null, _this._ngForOf, -1, -1), currentIndex === null ? undefined : currentIndex);
|
3746 | var tuple = new RecordViewTuple(item, view);
|
3747 | insertTuples.push(tuple);
|
3748 | }
|
3749 | else if (currentIndex == null) {
|
3750 | _this._viewContainer.remove(adjustedPreviousIndex === null ? undefined : adjustedPreviousIndex);
|
3751 | }
|
3752 | else if (adjustedPreviousIndex !== null) {
|
3753 | var view = _this._viewContainer.get(adjustedPreviousIndex);
|
3754 | _this._viewContainer.move(view, currentIndex);
|
3755 | var tuple = new RecordViewTuple(item, view);
|
3756 | insertTuples.push(tuple);
|
3757 | }
|
3758 | });
|
3759 | for (var i = 0; i < insertTuples.length; i++) {
|
3760 | this._perViewChange(insertTuples[i].view, insertTuples[i].record);
|
3761 | }
|
3762 | for (var i = 0, ilen = this._viewContainer.length; i < ilen; i++) {
|
3763 | var viewRef = this._viewContainer.get(i);
|
3764 | viewRef.context.index = i;
|
3765 | viewRef.context.count = ilen;
|
3766 | viewRef.context.ngForOf = this._ngForOf;
|
3767 | }
|
3768 | changes.forEachIdentityChange(function (record) {
|
3769 | var viewRef = _this._viewContainer.get(record.currentIndex);
|
3770 | viewRef.context.$implicit = record.item;
|
3771 | });
|
3772 | };
|
3773 | NgForOf.prototype._perViewChange = function (view, record) {
|
3774 | view.context.$implicit = record.item;
|
3775 | };
|
3776 | |
3777 |
|
3778 |
|
3779 |
|
3780 |
|
3781 |
|
3782 | NgForOf.ngTemplateContextGuard = function (dir, ctx) {
|
3783 | return true;
|
3784 | };
|
3785 | __decorate([
|
3786 | Input(),
|
3787 | __metadata("design:type", Object),
|
3788 | __metadata("design:paramtypes", [Object])
|
3789 | ], NgForOf.prototype, "ngForOf", null);
|
3790 | __decorate([
|
3791 | Input(),
|
3792 | __metadata("design:type", Function),
|
3793 | __metadata("design:paramtypes", [Function])
|
3794 | ], NgForOf.prototype, "ngForTrackBy", null);
|
3795 | __decorate([
|
3796 | Input(),
|
3797 | __metadata("design:type", TemplateRef),
|
3798 | __metadata("design:paramtypes", [TemplateRef])
|
3799 | ], NgForOf.prototype, "ngForTemplate", null);
|
3800 | NgForOf = __decorate([
|
3801 | Directive({ selector: '[ngFor][ngForOf]' }),
|
3802 | __metadata("design:paramtypes", [ViewContainerRef, TemplateRef,
|
3803 | IterableDiffers])
|
3804 | ], NgForOf);
|
3805 | return NgForOf;
|
3806 | }());
|
3807 | var RecordViewTuple = (function () {
|
3808 | function RecordViewTuple(record, view) {
|
3809 | this.record = record;
|
3810 | this.view = view;
|
3811 | }
|
3812 | return RecordViewTuple;
|
3813 | }());
|
3814 | function getTypeName(type) {
|
3815 | return type['name'] || typeof type;
|
3816 | }
|
3817 |
|
3818 |
|
3819 |
|
3820 |
|
3821 |
|
3822 |
|
3823 |
|
3824 |
|
3825 |
|
3826 |
|
3827 |
|
3828 |
|
3829 |
|
3830 |
|
3831 |
|
3832 |
|
3833 |
|
3834 |
|
3835 |
|
3836 |
|
3837 |
|
3838 |
|
3839 |
|
3840 |
|
3841 |
|
3842 |
|
3843 |
|
3844 |
|
3845 |
|
3846 |
|
3847 |
|
3848 |
|
3849 |
|
3850 |
|
3851 |
|
3852 |
|
3853 |
|
3854 |
|
3855 |
|
3856 |
|
3857 |
|
3858 |
|
3859 |
|
3860 |
|
3861 |
|
3862 |
|
3863 |
|
3864 |
|
3865 |
|
3866 |
|
3867 |
|
3868 |
|
3869 |
|
3870 |
|
3871 |
|
3872 |
|
3873 |
|
3874 |
|
3875 |
|
3876 |
|
3877 |
|
3878 |
|
3879 |
|
3880 |
|
3881 |
|
3882 |
|
3883 |
|
3884 |
|
3885 |
|
3886 |
|
3887 |
|
3888 |
|
3889 |
|
3890 |
|
3891 |
|
3892 |
|
3893 |
|
3894 |
|
3895 |
|
3896 |
|
3897 |
|
3898 |
|
3899 |
|
3900 |
|
3901 |
|
3902 |
|
3903 |
|
3904 |
|
3905 |
|
3906 |
|
3907 |
|
3908 |
|
3909 |
|
3910 |
|
3911 |
|
3912 |
|
3913 |
|
3914 |
|
3915 |
|
3916 |
|
3917 |
|
3918 |
|
3919 |
|
3920 |
|
3921 |
|
3922 |
|
3923 |
|
3924 |
|
3925 |
|
3926 |
|
3927 |
|
3928 |
|
3929 |
|
3930 |
|
3931 |
|
3932 |
|
3933 |
|
3934 |
|
3935 |
|
3936 |
|
3937 |
|
3938 |
|
3939 |
|
3940 |
|
3941 |
|
3942 |
|
3943 |
|
3944 |
|
3945 |
|
3946 |
|
3947 |
|
3948 |
|
3949 |
|
3950 |
|
3951 |
|
3952 |
|
3953 |
|
3954 |
|
3955 |
|
3956 |
|
3957 |
|
3958 |
|
3959 |
|
3960 |
|
3961 |
|
3962 |
|
3963 |
|
3964 | var NgIf = (function () {
|
3965 | function NgIf(_viewContainer, templateRef) {
|
3966 | this._viewContainer = _viewContainer;
|
3967 | this._context = new NgIfContext();
|
3968 | this._thenTemplateRef = null;
|
3969 | this._elseTemplateRef = null;
|
3970 | this._thenViewRef = null;
|
3971 | this._elseViewRef = null;
|
3972 | this._thenTemplateRef = templateRef;
|
3973 | }
|
3974 | Object.defineProperty(NgIf.prototype, "ngIf", {
|
3975 | |
3976 |
|
3977 |
|
3978 | set: function (condition) {
|
3979 | this._context.$implicit = this._context.ngIf = condition;
|
3980 | this._updateView();
|
3981 | },
|
3982 | enumerable: true,
|
3983 | configurable: true
|
3984 | });
|
3985 | Object.defineProperty(NgIf.prototype, "ngIfThen", {
|
3986 | |
3987 |
|
3988 |
|
3989 | set: function (templateRef) {
|
3990 | assertTemplate('ngIfThen', templateRef);
|
3991 | this._thenTemplateRef = templateRef;
|
3992 | this._thenViewRef = null;
|
3993 | this._updateView();
|
3994 | },
|
3995 | enumerable: true,
|
3996 | configurable: true
|
3997 | });
|
3998 | Object.defineProperty(NgIf.prototype, "ngIfElse", {
|
3999 | |
4000 |
|
4001 |
|
4002 | set: function (templateRef) {
|
4003 | assertTemplate('ngIfElse', templateRef);
|
4004 | this._elseTemplateRef = templateRef;
|
4005 | this._elseViewRef = null;
|
4006 | this._updateView();
|
4007 | },
|
4008 | enumerable: true,
|
4009 | configurable: true
|
4010 | });
|
4011 | NgIf.prototype._updateView = function () {
|
4012 | if (this._context.$implicit) {
|
4013 | if (!this._thenViewRef) {
|
4014 | this._viewContainer.clear();
|
4015 | this._elseViewRef = null;
|
4016 | if (this._thenTemplateRef) {
|
4017 | this._thenViewRef =
|
4018 | this._viewContainer.createEmbeddedView(this._thenTemplateRef, this._context);
|
4019 | }
|
4020 | }
|
4021 | }
|
4022 | else {
|
4023 | if (!this._elseViewRef) {
|
4024 | this._viewContainer.clear();
|
4025 | this._thenViewRef = null;
|
4026 | if (this._elseTemplateRef) {
|
4027 | this._elseViewRef =
|
4028 | this._viewContainer.createEmbeddedView(this._elseTemplateRef, this._context);
|
4029 | }
|
4030 | }
|
4031 | }
|
4032 | };
|
4033 | __decorate([
|
4034 | Input(),
|
4035 | __metadata("design:type", Object),
|
4036 | __metadata("design:paramtypes", [Object])
|
4037 | ], NgIf.prototype, "ngIf", null);
|
4038 | __decorate([
|
4039 | Input(),
|
4040 | __metadata("design:type", Object),
|
4041 | __metadata("design:paramtypes", [Object])
|
4042 | ], NgIf.prototype, "ngIfThen", null);
|
4043 | __decorate([
|
4044 | Input(),
|
4045 | __metadata("design:type", Object),
|
4046 | __metadata("design:paramtypes", [Object])
|
4047 | ], NgIf.prototype, "ngIfElse", null);
|
4048 | NgIf = __decorate([
|
4049 | Directive({ selector: '[ngIf]' }),
|
4050 | __metadata("design:paramtypes", [ViewContainerRef, TemplateRef])
|
4051 | ], NgIf);
|
4052 | return NgIf;
|
4053 | }());
|
4054 |
|
4055 |
|
4056 |
|
4057 | var NgIfContext = (function () {
|
4058 | function NgIfContext() {
|
4059 | this.$implicit = null;
|
4060 | this.ngIf = null;
|
4061 | }
|
4062 | return NgIfContext;
|
4063 | }());
|
4064 | function assertTemplate(property, templateRef) {
|
4065 | var isTemplateRefOrNull = !!(!templateRef || templateRef.createEmbeddedView);
|
4066 | if (!isTemplateRefOrNull) {
|
4067 | throw new Error(property + " must be a TemplateRef, but received '" + ɵstringify(templateRef) + "'.");
|
4068 | }
|
4069 | }
|
4070 |
|
4071 |
|
4072 |
|
4073 |
|
4074 |
|
4075 |
|
4076 |
|
4077 |
|
4078 | var SwitchView = (function () {
|
4079 | function SwitchView(_viewContainerRef, _templateRef) {
|
4080 | this._viewContainerRef = _viewContainerRef;
|
4081 | this._templateRef = _templateRef;
|
4082 | this._created = false;
|
4083 | }
|
4084 | SwitchView.prototype.create = function () {
|
4085 | this._created = true;
|
4086 | this._viewContainerRef.createEmbeddedView(this._templateRef);
|
4087 | };
|
4088 | SwitchView.prototype.destroy = function () {
|
4089 | this._created = false;
|
4090 | this._viewContainerRef.clear();
|
4091 | };
|
4092 | SwitchView.prototype.enforceState = function (created) {
|
4093 | if (created && !this._created) {
|
4094 | this.create();
|
4095 | }
|
4096 | else if (!created && this._created) {
|
4097 | this.destroy();
|
4098 | }
|
4099 | };
|
4100 | return SwitchView;
|
4101 | }());
|
4102 |
|
4103 |
|
4104 |
|
4105 |
|
4106 |
|
4107 |
|
4108 |
|
4109 |
|
4110 |
|
4111 |
|
4112 |
|
4113 |
|
4114 |
|
4115 |
|
4116 |
|
4117 |
|
4118 |
|
4119 |
|
4120 |
|
4121 |
|
4122 |
|
4123 |
|
4124 |
|
4125 |
|
4126 |
|
4127 |
|
4128 |
|
4129 |
|
4130 |
|
4131 |
|
4132 |
|
4133 |
|
4134 |
|
4135 |
|
4136 |
|
4137 |
|
4138 |
|
4139 |
|
4140 |
|
4141 |
|
4142 |
|
4143 |
|
4144 |
|
4145 |
|
4146 |
|
4147 |
|
4148 |
|
4149 |
|
4150 |
|
4151 |
|
4152 |
|
4153 |
|
4154 |
|
4155 |
|
4156 |
|
4157 |
|
4158 |
|
4159 |
|
4160 |
|
4161 |
|
4162 |
|
4163 |
|
4164 |
|
4165 |
|
4166 |
|
4167 |
|
4168 |
|
4169 |
|
4170 | var NgSwitch = (function () {
|
4171 | function NgSwitch() {
|
4172 | this._defaultUsed = false;
|
4173 | this._caseCount = 0;
|
4174 | this._lastCaseCheckIndex = 0;
|
4175 | this._lastCasesMatched = false;
|
4176 | }
|
4177 | Object.defineProperty(NgSwitch.prototype, "ngSwitch", {
|
4178 | set: function (newValue) {
|
4179 | this._ngSwitch = newValue;
|
4180 | if (this._caseCount === 0) {
|
4181 | this._updateDefaultCases(true);
|
4182 | }
|
4183 | },
|
4184 | enumerable: true,
|
4185 | configurable: true
|
4186 | });
|
4187 |
|
4188 | NgSwitch.prototype._addCase = function () { return this._caseCount++; };
|
4189 |
|
4190 | NgSwitch.prototype._addDefault = function (view) {
|
4191 | if (!this._defaultViews) {
|
4192 | this._defaultViews = [];
|
4193 | }
|
4194 | this._defaultViews.push(view);
|
4195 | };
|
4196 |
|
4197 | NgSwitch.prototype._matchCase = function (value) {
|
4198 | var matched = value == this._ngSwitch;
|
4199 | this._lastCasesMatched = this._lastCasesMatched || matched;
|
4200 | this._lastCaseCheckIndex++;
|
4201 | if (this._lastCaseCheckIndex === this._caseCount) {
|
4202 | this._updateDefaultCases(!this._lastCasesMatched);
|
4203 | this._lastCaseCheckIndex = 0;
|
4204 | this._lastCasesMatched = false;
|
4205 | }
|
4206 | return matched;
|
4207 | };
|
4208 | NgSwitch.prototype._updateDefaultCases = function (useDefault) {
|
4209 | if (this._defaultViews && useDefault !== this._defaultUsed) {
|
4210 | this._defaultUsed = useDefault;
|
4211 | for (var i = 0; i < this._defaultViews.length; i++) {
|
4212 | var defaultView = this._defaultViews[i];
|
4213 | defaultView.enforceState(useDefault);
|
4214 | }
|
4215 | }
|
4216 | };
|
4217 | __decorate([
|
4218 | Input(),
|
4219 | __metadata("design:type", Object),
|
4220 | __metadata("design:paramtypes", [Object])
|
4221 | ], NgSwitch.prototype, "ngSwitch", null);
|
4222 | NgSwitch = __decorate([
|
4223 | Directive({ selector: '[ngSwitch]' })
|
4224 | ], NgSwitch);
|
4225 | return NgSwitch;
|
4226 | }());
|
4227 |
|
4228 |
|
4229 |
|
4230 |
|
4231 |
|
4232 |
|
4233 |
|
4234 |
|
4235 |
|
4236 |
|
4237 |
|
4238 |
|
4239 |
|
4240 |
|
4241 |
|
4242 |
|
4243 |
|
4244 |
|
4245 |
|
4246 |
|
4247 |
|
4248 |
|
4249 |
|
4250 |
|
4251 |
|
4252 |
|
4253 |
|
4254 |
|
4255 |
|
4256 |
|
4257 |
|
4258 |
|
4259 |
|
4260 | var NgSwitchCase = (function () {
|
4261 | function NgSwitchCase(viewContainer, templateRef, ngSwitch) {
|
4262 | this.ngSwitch = ngSwitch;
|
4263 | ngSwitch._addCase();
|
4264 | this._view = new SwitchView(viewContainer, templateRef);
|
4265 | }
|
4266 | |
4267 |
|
4268 |
|
4269 | NgSwitchCase.prototype.ngDoCheck = function () { this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase)); };
|
4270 | __decorate([
|
4271 | Input(),
|
4272 | __metadata("design:type", Object)
|
4273 | ], NgSwitchCase.prototype, "ngSwitchCase", void 0);
|
4274 | NgSwitchCase = __decorate([
|
4275 | Directive({ selector: '[ngSwitchCase]' }),
|
4276 | __param(2, Host()),
|
4277 | __metadata("design:paramtypes", [ViewContainerRef, TemplateRef,
|
4278 | NgSwitch])
|
4279 | ], NgSwitchCase);
|
4280 | return NgSwitchCase;
|
4281 | }());
|
4282 |
|
4283 |
|
4284 |
|
4285 |
|
4286 |
|
4287 |
|
4288 |
|
4289 |
|
4290 |
|
4291 |
|
4292 |
|
4293 |
|
4294 |
|
4295 |
|
4296 | var NgSwitchDefault = (function () {
|
4297 | function NgSwitchDefault(viewContainer, templateRef, ngSwitch) {
|
4298 | ngSwitch._addDefault(new SwitchView(viewContainer, templateRef));
|
4299 | }
|
4300 | NgSwitchDefault = __decorate([
|
4301 | Directive({ selector: '[ngSwitchDefault]' }),
|
4302 | __param(2, Host()),
|
4303 | __metadata("design:paramtypes", [ViewContainerRef, TemplateRef,
|
4304 | NgSwitch])
|
4305 | ], NgSwitchDefault);
|
4306 | return NgSwitchDefault;
|
4307 | }());
|
4308 |
|
4309 |
|
4310 |
|
4311 |
|
4312 |
|
4313 |
|
4314 |
|
4315 |
|
4316 |
|
4317 |
|
4318 |
|
4319 |
|
4320 |
|
4321 |
|
4322 |
|
4323 |
|
4324 |
|
4325 |
|
4326 |
|
4327 |
|
4328 |
|
4329 |
|
4330 |
|
4331 |
|
4332 |
|
4333 |
|
4334 |
|
4335 |
|
4336 |
|
4337 |
|
4338 |
|
4339 |
|
4340 |
|
4341 |
|
4342 |
|
4343 |
|
4344 |
|
4345 |
|
4346 |
|
4347 | var NgPlural = (function () {
|
4348 | function NgPlural(_localization) {
|
4349 | this._localization = _localization;
|
4350 | this._caseViews = {};
|
4351 | }
|
4352 | Object.defineProperty(NgPlural.prototype, "ngPlural", {
|
4353 | set: function (value) {
|
4354 | this._switchValue = value;
|
4355 | this._updateView();
|
4356 | },
|
4357 | enumerable: true,
|
4358 | configurable: true
|
4359 | });
|
4360 | NgPlural.prototype.addCase = function (value, switchView) { this._caseViews[value] = switchView; };
|
4361 | NgPlural.prototype._updateView = function () {
|
4362 | this._clearViews();
|
4363 | var cases = Object.keys(this._caseViews);
|
4364 | var key = getPluralCategory(this._switchValue, cases, this._localization);
|
4365 | this._activateView(this._caseViews[key]);
|
4366 | };
|
4367 | NgPlural.prototype._clearViews = function () {
|
4368 | if (this._activeView)
|
4369 | this._activeView.destroy();
|
4370 | };
|
4371 | NgPlural.prototype._activateView = function (view) {
|
4372 | if (view) {
|
4373 | this._activeView = view;
|
4374 | this._activeView.create();
|
4375 | }
|
4376 | };
|
4377 | __decorate([
|
4378 | Input(),
|
4379 | __metadata("design:type", Number),
|
4380 | __metadata("design:paramtypes", [Number])
|
4381 | ], NgPlural.prototype, "ngPlural", null);
|
4382 | NgPlural = __decorate([
|
4383 | Directive({ selector: '[ngPlural]' }),
|
4384 | __metadata("design:paramtypes", [NgLocalization])
|
4385 | ], NgPlural);
|
4386 | return NgPlural;
|
4387 | }());
|
4388 |
|
4389 |
|
4390 |
|
4391 |
|
4392 |
|
4393 |
|
4394 |
|
4395 |
|
4396 |
|
4397 |
|
4398 |
|
4399 |
|
4400 |
|
4401 |
|
4402 |
|
4403 |
|
4404 |
|
4405 |
|
4406 |
|
4407 |
|
4408 | var NgPluralCase = (function () {
|
4409 | function NgPluralCase(value, template, viewContainer, ngPlural) {
|
4410 | this.value = value;
|
4411 | var isANumber = !isNaN(Number(value));
|
4412 | ngPlural.addCase(isANumber ? "=" + value : value, new SwitchView(viewContainer, template));
|
4413 | }
|
4414 | NgPluralCase = __decorate([
|
4415 | Directive({ selector: '[ngPluralCase]' }),
|
4416 | __param(0, Attribute('ngPluralCase')),
|
4417 | __param(3, Host()),
|
4418 | __metadata("design:paramtypes", [String, TemplateRef,
|
4419 | ViewContainerRef, NgPlural])
|
4420 | ], NgPluralCase);
|
4421 | return NgPluralCase;
|
4422 | }());
|
4423 |
|
4424 |
|
4425 |
|
4426 |
|
4427 |
|
4428 |
|
4429 |
|
4430 |
|
4431 |
|
4432 |
|
4433 | var NgStyleImpl = (function () {
|
4434 | function NgStyleImpl() {
|
4435 | }
|
4436 | return NgStyleImpl;
|
4437 | }());
|
4438 | var NgStyleR2Impl = (function () {
|
4439 | function NgStyleR2Impl(_ngEl, _differs, _renderer) {
|
4440 | this._ngEl = _ngEl;
|
4441 | this._differs = _differs;
|
4442 | this._renderer = _renderer;
|
4443 | }
|
4444 | NgStyleR2Impl.prototype.getValue = function () { return null; };
|
4445 | |
4446 |
|
4447 |
|
4448 |
|
4449 |
|
4450 |
|
4451 |
|
4452 | NgStyleR2Impl.prototype.setNgStyle = function (values) {
|
4453 | this._ngStyle = values;
|
4454 | if (!this._differ && values) {
|
4455 | this._differ = this._differs.find(values).create();
|
4456 | }
|
4457 | };
|
4458 | |
4459 |
|
4460 |
|
4461 | NgStyleR2Impl.prototype.applyChanges = function () {
|
4462 | if (this._differ) {
|
4463 | var changes = this._differ.diff(this._ngStyle);
|
4464 | if (changes) {
|
4465 | this._applyChanges(changes);
|
4466 | }
|
4467 | }
|
4468 | };
|
4469 | NgStyleR2Impl.prototype._applyChanges = function (changes) {
|
4470 | var _this = this;
|
4471 | changes.forEachRemovedItem(function (record) { return _this._setStyle(record.key, null); });
|
4472 | changes.forEachAddedItem(function (record) { return _this._setStyle(record.key, record.currentValue); });
|
4473 | changes.forEachChangedItem(function (record) { return _this._setStyle(record.key, record.currentValue); });
|
4474 | };
|
4475 | NgStyleR2Impl.prototype._setStyle = function (nameAndUnit, value) {
|
4476 | var _a = __read(nameAndUnit.split('.'), 2), name = _a[0], unit = _a[1];
|
4477 | value = value != null && unit ? "" + value + unit : value;
|
4478 | if (value != null) {
|
4479 | this._renderer.setStyle(this._ngEl.nativeElement, name, value);
|
4480 | }
|
4481 | else {
|
4482 | this._renderer.removeStyle(this._ngEl.nativeElement, name);
|
4483 | }
|
4484 | };
|
4485 | NgStyleR2Impl = __decorate([
|
4486 | Injectable(),
|
4487 | __metadata("design:paramtypes", [ElementRef, KeyValueDiffers, Renderer2])
|
4488 | ], NgStyleR2Impl);
|
4489 | return NgStyleR2Impl;
|
4490 | }());
|
4491 | var NgStyleR3Impl = (function () {
|
4492 | function NgStyleR3Impl() {
|
4493 | this._differ = new StylingDiffer('NgStyle', 8 );
|
4494 | this._value = null;
|
4495 | }
|
4496 | NgStyleR3Impl.prototype.getValue = function () { return this._value; };
|
4497 | NgStyleR3Impl.prototype.setNgStyle = function (value) { this._differ.setValue(value); };
|
4498 | NgStyleR3Impl.prototype.applyChanges = function () {
|
4499 | if (this._differ.hasValueChanged()) {
|
4500 | this._value = this._differ.value;
|
4501 | }
|
4502 | };
|
4503 | NgStyleR3Impl = __decorate([
|
4504 | Injectable()
|
4505 | ], NgStyleR3Impl);
|
4506 | return NgStyleR3Impl;
|
4507 | }());
|
4508 |
|
4509 |
|
4510 |
|
4511 | var NgStyleImplProvider__PRE_R3__ = {
|
4512 | provide: NgStyleImpl,
|
4513 | useClass: NgStyleR2Impl
|
4514 | };
|
4515 | var NgStyleImplProvider__POST_R3__ = {
|
4516 | provide: NgStyleImpl,
|
4517 | useClass: NgStyleR3Impl
|
4518 | };
|
4519 | var NgStyleImplProvider = NgStyleImplProvider__PRE_R3__;
|
4520 |
|
4521 |
|
4522 |
|
4523 |
|
4524 |
|
4525 |
|
4526 |
|
4527 |
|
4528 |
|
4529 |
|
4530 |
|
4531 |
|
4532 |
|
4533 | var ngStyleDirectiveDef__PRE_R3__ = undefined;
|
4534 | var ɵ0$1 = function () { }, ɵ1$1 = function () { }, ɵ2$1 = function (rf, ctx, elIndex) {
|
4535 | if (rf & 1 ) {
|
4536 | ɵɵstyling();
|
4537 | }
|
4538 | if (rf & 2 ) {
|
4539 | ɵɵstyleMap(ctx.getValue());
|
4540 | ɵɵstylingApply();
|
4541 | }
|
4542 | };
|
4543 |
|
4544 |
|
4545 |
|
4546 | var ngStyleDirectiveDef__POST_R3__ = ɵɵdefineDirective({
|
4547 | type: ɵ0$1,
|
4548 | selectors: null,
|
4549 | factory: ɵ1$1,
|
4550 | hostBindings: ɵ2$1
|
4551 | });
|
4552 | var ngStyleDirectiveDef = ngStyleDirectiveDef__PRE_R3__;
|
4553 |
|
4554 |
|
4555 |
|
4556 |
|
4557 |
|
4558 |
|
4559 |
|
4560 |
|
4561 |
|
4562 |
|
4563 |
|
4564 |
|
4565 |
|
4566 |
|
4567 | var NgStyleBase = (function () {
|
4568 | function NgStyleBase(_delegate) {
|
4569 | this._delegate = _delegate;
|
4570 | }
|
4571 | NgStyleBase.prototype.getValue = function () { return this._delegate.getValue(); };
|
4572 | NgStyleBase.ngDirectiveDef = ngStyleDirectiveDef;
|
4573 | return NgStyleBase;
|
4574 | }());
|
4575 |
|
4576 |
|
4577 |
|
4578 |
|
4579 |
|
4580 |
|
4581 |
|
4582 |
|
4583 |
|
4584 |
|
4585 |
|
4586 |
|
4587 |
|
4588 |
|
4589 |
|
4590 |
|
4591 |
|
4592 |
|
4593 |
|
4594 |
|
4595 |
|
4596 |
|
4597 |
|
4598 |
|
4599 |
|
4600 |
|
4601 |
|
4602 |
|
4603 |
|
4604 |
|
4605 |
|
4606 |
|
4607 |
|
4608 |
|
4609 |
|
4610 |
|
4611 | var NgStyle = (function (_super) {
|
4612 | __extends(NgStyle, _super);
|
4613 | function NgStyle(delegate) {
|
4614 | return _super.call(this, delegate) || this;
|
4615 | }
|
4616 | Object.defineProperty(NgStyle.prototype, "ngStyle", {
|
4617 | set: function (value) { this._delegate.setNgStyle(value); },
|
4618 | enumerable: true,
|
4619 | configurable: true
|
4620 | });
|
4621 | NgStyle.prototype.ngDoCheck = function () { this._delegate.applyChanges(); };
|
4622 | __decorate([
|
4623 | Input('ngStyle'),
|
4624 | __metadata("design:type", Object),
|
4625 | __metadata("design:paramtypes", [Object])
|
4626 | ], NgStyle.prototype, "ngStyle", null);
|
4627 | NgStyle = __decorate([
|
4628 | Directive({ selector: '[ngStyle]', providers: [NgStyleImplProvider] }),
|
4629 | __metadata("design:paramtypes", [NgStyleImpl])
|
4630 | ], NgStyle);
|
4631 | return NgStyle;
|
4632 | }(NgStyleBase));
|
4633 |
|
4634 |
|
4635 |
|
4636 |
|
4637 |
|
4638 |
|
4639 |
|
4640 |
|
4641 |
|
4642 |
|
4643 |
|
4644 |
|
4645 |
|
4646 |
|
4647 |
|
4648 |
|
4649 |
|
4650 |
|
4651 |
|
4652 |
|
4653 |
|
4654 |
|
4655 |
|
4656 |
|
4657 |
|
4658 |
|
4659 |
|
4660 |
|
4661 |
|
4662 |
|
4663 |
|
4664 |
|
4665 | var NgTemplateOutlet = (function () {
|
4666 | function NgTemplateOutlet(_viewContainerRef) {
|
4667 | this._viewContainerRef = _viewContainerRef;
|
4668 | this._viewRef = null;
|
4669 | |
4670 |
|
4671 |
|
4672 |
|
4673 |
|
4674 |
|
4675 | this.ngTemplateOutletContext = null;
|
4676 | |
4677 |
|
4678 |
|
4679 | this.ngTemplateOutlet = null;
|
4680 | }
|
4681 | NgTemplateOutlet.prototype.ngOnChanges = function (changes) {
|
4682 | var recreateView = this._shouldRecreateView(changes);
|
4683 | if (recreateView) {
|
4684 | if (this._viewRef) {
|
4685 | this._viewContainerRef.remove(this._viewContainerRef.indexOf(this._viewRef));
|
4686 | }
|
4687 | if (this.ngTemplateOutlet) {
|
4688 | this._viewRef = this._viewContainerRef.createEmbeddedView(this.ngTemplateOutlet, this.ngTemplateOutletContext);
|
4689 | }
|
4690 | }
|
4691 | else {
|
4692 | if (this._viewRef && this.ngTemplateOutletContext) {
|
4693 | this._updateExistingContext(this.ngTemplateOutletContext);
|
4694 | }
|
4695 | }
|
4696 | };
|
4697 | |
4698 |
|
4699 |
|
4700 |
|
4701 |
|
4702 |
|
4703 |
|
4704 |
|
4705 |
|
4706 |
|
4707 | NgTemplateOutlet.prototype._shouldRecreateView = function (changes) {
|
4708 | var ctxChange = changes['ngTemplateOutletContext'];
|
4709 | return !!changes['ngTemplateOutlet'] || (ctxChange && this._hasContextShapeChanged(ctxChange));
|
4710 | };
|
4711 | NgTemplateOutlet.prototype._hasContextShapeChanged = function (ctxChange) {
|
4712 | var e_1, _a;
|
4713 | var prevCtxKeys = Object.keys(ctxChange.previousValue || {});
|
4714 | var currCtxKeys = Object.keys(ctxChange.currentValue || {});
|
4715 | if (prevCtxKeys.length === currCtxKeys.length) {
|
4716 | try {
|
4717 | for (var currCtxKeys_1 = __values(currCtxKeys), currCtxKeys_1_1 = currCtxKeys_1.next(); !currCtxKeys_1_1.done; currCtxKeys_1_1 = currCtxKeys_1.next()) {
|
4718 | var propName = currCtxKeys_1_1.value;
|
4719 | if (prevCtxKeys.indexOf(propName) === -1) {
|
4720 | return true;
|
4721 | }
|
4722 | }
|
4723 | }
|
4724 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
4725 | finally {
|
4726 | try {
|
4727 | if (currCtxKeys_1_1 && !currCtxKeys_1_1.done && (_a = currCtxKeys_1.return)) _a.call(currCtxKeys_1);
|
4728 | }
|
4729 | finally { if (e_1) throw e_1.error; }
|
4730 | }
|
4731 | return false;
|
4732 | }
|
4733 | else {
|
4734 | return true;
|
4735 | }
|
4736 | };
|
4737 | NgTemplateOutlet.prototype._updateExistingContext = function (ctx) {
|
4738 | var e_2, _a;
|
4739 | try {
|
4740 | for (var _b = __values(Object.keys(ctx)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
4741 | var propName = _c.value;
|
4742 | this._viewRef.context[propName] = this.ngTemplateOutletContext[propName];
|
4743 | }
|
4744 | }
|
4745 | catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
4746 | finally {
|
4747 | try {
|
4748 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
4749 | }
|
4750 | finally { if (e_2) throw e_2.error; }
|
4751 | }
|
4752 | };
|
4753 | __decorate([
|
4754 | Input(),
|
4755 | __metadata("design:type", Object)
|
4756 | ], NgTemplateOutlet.prototype, "ngTemplateOutletContext", void 0);
|
4757 | __decorate([
|
4758 | Input(),
|
4759 | __metadata("design:type", Object)
|
4760 | ], NgTemplateOutlet.prototype, "ngTemplateOutlet", void 0);
|
4761 | NgTemplateOutlet = __decorate([
|
4762 | Directive({ selector: '[ngTemplateOutlet]' }),
|
4763 | __metadata("design:paramtypes", [ViewContainerRef])
|
4764 | ], NgTemplateOutlet);
|
4765 | return NgTemplateOutlet;
|
4766 | }());
|
4767 |
|
4768 |
|
4769 |
|
4770 |
|
4771 |
|
4772 |
|
4773 |
|
4774 |
|
4775 |
|
4776 |
|
4777 |
|
4778 |
|
4779 | var COMMON_DIRECTIVES = [
|
4780 | NgClass,
|
4781 | NgComponentOutlet,
|
4782 | NgForOf,
|
4783 | NgIf,
|
4784 | NgTemplateOutlet,
|
4785 | NgStyle,
|
4786 | NgSwitch,
|
4787 | NgSwitchCase,
|
4788 | NgSwitchDefault,
|
4789 | NgPlural,
|
4790 | NgPluralCase,
|
4791 | ];
|
4792 |
|
4793 |
|
4794 |
|
4795 |
|
4796 |
|
4797 |
|
4798 |
|
4799 |
|
4800 | function invalidPipeArgumentError(type, value) {
|
4801 | return Error("InvalidPipeArgument: '" + value + "' for pipe '" + ɵstringify(type) + "'");
|
4802 | }
|
4803 |
|
4804 | var NumberFormatter = (function () {
|
4805 | function NumberFormatter() {
|
4806 | }
|
4807 | NumberFormatter.format = function (num, locale, style, opts) {
|
4808 | if (opts === void 0) { opts = {}; }
|
4809 | var minimumIntegerDigits = opts.minimumIntegerDigits, minimumFractionDigits = opts.minimumFractionDigits, maximumFractionDigits = opts.maximumFractionDigits, currency = opts.currency, _a = opts.currencyAsSymbol, currencyAsSymbol = _a === void 0 ? false : _a;
|
4810 | var options = {
|
4811 | minimumIntegerDigits: minimumIntegerDigits,
|
4812 | minimumFractionDigits: minimumFractionDigits,
|
4813 | maximumFractionDigits: maximumFractionDigits,
|
4814 | style: NumberFormatStyle[style].toLowerCase()
|
4815 | };
|
4816 | if (style == NumberFormatStyle.Currency) {
|
4817 | options.currency = typeof currency == 'string' ? currency : undefined;
|
4818 | options.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code';
|
4819 | }
|
4820 | return new Intl.NumberFormat(locale, options).format(num);
|
4821 | };
|
4822 | return NumberFormatter;
|
4823 | }());
|
4824 | var DATE_FORMATS_SPLIT$1 = /((?:[^yMLdHhmsazZEwGjJ']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|J+|j+|m+|s+|a|z|Z|G+|w+))(.*)/;
|
4825 | var PATTERN_ALIASES = {
|
4826 |
|
4827 | 'yMMMdjms': datePartGetterFactory(combine([
|
4828 | digitCondition('year', 1),
|
4829 | nameCondition('month', 3),
|
4830 | digitCondition('day', 1),
|
4831 | digitCondition('hour', 1),
|
4832 | digitCondition('minute', 1),
|
4833 | digitCondition('second', 1),
|
4834 | ])),
|
4835 | 'yMdjm': datePartGetterFactory(combine([
|
4836 | digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1),
|
4837 | digitCondition('hour', 1), digitCondition('minute', 1)
|
4838 | ])),
|
4839 | 'yMMMMEEEEd': datePartGetterFactory(combine([
|
4840 | digitCondition('year', 1), nameCondition('month', 4), nameCondition('weekday', 4),
|
4841 | digitCondition('day', 1)
|
4842 | ])),
|
4843 | 'yMMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 4), digitCondition('day', 1)])),
|
4844 | 'yMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 3), digitCondition('day', 1)])),
|
4845 | 'yMd': datePartGetterFactory(combine([digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1)])),
|
4846 | 'jms': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('second', 1), digitCondition('minute', 1)])),
|
4847 | 'jm': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('minute', 1)]))
|
4848 | };
|
4849 | var DATE_FORMATS$1 = {
|
4850 |
|
4851 | 'yyyy': datePartGetterFactory(digitCondition('year', 4)),
|
4852 | 'yy': datePartGetterFactory(digitCondition('year', 2)),
|
4853 | 'y': datePartGetterFactory(digitCondition('year', 1)),
|
4854 | 'MMMM': datePartGetterFactory(nameCondition('month', 4)),
|
4855 | 'MMM': datePartGetterFactory(nameCondition('month', 3)),
|
4856 | 'MM': datePartGetterFactory(digitCondition('month', 2)),
|
4857 | 'M': datePartGetterFactory(digitCondition('month', 1)),
|
4858 | 'LLLL': datePartGetterFactory(nameCondition('month', 4)),
|
4859 | 'L': datePartGetterFactory(nameCondition('month', 1)),
|
4860 | 'dd': datePartGetterFactory(digitCondition('day', 2)),
|
4861 | 'd': datePartGetterFactory(digitCondition('day', 1)),
|
4862 | 'HH': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), false)))),
|
4863 | 'H': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), false))),
|
4864 | 'hh': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), true)))),
|
4865 | 'h': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))),
|
4866 | 'jj': datePartGetterFactory(digitCondition('hour', 2)),
|
4867 | 'j': datePartGetterFactory(digitCondition('hour', 1)),
|
4868 | 'mm': digitModifier(datePartGetterFactory(digitCondition('minute', 2))),
|
4869 | 'm': datePartGetterFactory(digitCondition('minute', 1)),
|
4870 | 'ss': digitModifier(datePartGetterFactory(digitCondition('second', 2))),
|
4871 | 's': datePartGetterFactory(digitCondition('second', 1)),
|
4872 |
|
4873 |
|
4874 |
|
4875 | 'sss': datePartGetterFactory(digitCondition('second', 3)),
|
4876 | 'EEEE': datePartGetterFactory(nameCondition('weekday', 4)),
|
4877 | 'EEE': datePartGetterFactory(nameCondition('weekday', 3)),
|
4878 | 'EE': datePartGetterFactory(nameCondition('weekday', 2)),
|
4879 | 'E': datePartGetterFactory(nameCondition('weekday', 1)),
|
4880 | 'a': hourClockExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))),
|
4881 | 'Z': timeZoneGetter$1('short'),
|
4882 | 'z': timeZoneGetter$1('long'),
|
4883 | 'ww': datePartGetterFactory({}),
|
4884 |
|
4885 | 'w': datePartGetterFactory({}),
|
4886 |
|
4887 | 'G': datePartGetterFactory(nameCondition('era', 1)),
|
4888 | 'GG': datePartGetterFactory(nameCondition('era', 2)),
|
4889 | 'GGG': datePartGetterFactory(nameCondition('era', 3)),
|
4890 | 'GGGG': datePartGetterFactory(nameCondition('era', 4))
|
4891 | };
|
4892 | function digitModifier(inner) {
|
4893 | return function (date, locale) {
|
4894 | var result = inner(date, locale);
|
4895 | return result.length == 1 ? '0' + result : result;
|
4896 | };
|
4897 | }
|
4898 | function hourClockExtractor(inner) {
|
4899 | return function (date, locale) { return inner(date, locale).split(' ')[1]; };
|
4900 | }
|
4901 | function hourExtractor(inner) {
|
4902 | return function (date, locale) { return inner(date, locale).split(' ')[0]; };
|
4903 | }
|
4904 | function intlDateFormat(date, locale, options) {
|
4905 | return new Intl.DateTimeFormat(locale, options).format(date).replace(/[\u200e\u200f]/g, '');
|
4906 | }
|
4907 | function timeZoneGetter$1(timezone) {
|
4908 |
|
4909 | var options = { hour: '2-digit', hour12: false, timeZoneName: timezone };
|
4910 | return function (date, locale) {
|
4911 | var result = intlDateFormat(date, locale, options);
|
4912 |
|
4913 | return result ? result.substring(3) : '';
|
4914 | };
|
4915 | }
|
4916 | function hour12Modify(options, value) {
|
4917 | options.hour12 = value;
|
4918 | return options;
|
4919 | }
|
4920 | function digitCondition(prop, len) {
|
4921 | var result = {};
|
4922 | result[prop] = len === 2 ? '2-digit' : 'numeric';
|
4923 | return result;
|
4924 | }
|
4925 | function nameCondition(prop, len) {
|
4926 | var result = {};
|
4927 | if (len < 4) {
|
4928 | result[prop] = len > 1 ? 'short' : 'narrow';
|
4929 | }
|
4930 | else {
|
4931 | result[prop] = 'long';
|
4932 | }
|
4933 | return result;
|
4934 | }
|
4935 | function combine(options) {
|
4936 | return options.reduce(function (merged, opt) { return (__assign({}, merged, opt)); }, {});
|
4937 | }
|
4938 | function datePartGetterFactory(ret) {
|
4939 | return function (date, locale) { return intlDateFormat(date, locale, ret); };
|
4940 | }
|
4941 | var DATE_FORMATTER_CACHE = new Map();
|
4942 | function dateFormatter(format, date, locale) {
|
4943 | var fn = PATTERN_ALIASES[format];
|
4944 | if (fn)
|
4945 | return fn(date, locale);
|
4946 | var cacheKey = format;
|
4947 | var parts = DATE_FORMATTER_CACHE.get(cacheKey);
|
4948 | if (!parts) {
|
4949 | parts = [];
|
4950 | var match = void 0;
|
4951 | DATE_FORMATS_SPLIT$1.exec(format);
|
4952 | var _format = format;
|
4953 | while (_format) {
|
4954 | match = DATE_FORMATS_SPLIT$1.exec(_format);
|
4955 | if (match) {
|
4956 | parts = parts.concat(match.slice(1));
|
4957 | _format = parts.pop();
|
4958 | }
|
4959 | else {
|
4960 | parts.push(_format);
|
4961 | _format = null;
|
4962 | }
|
4963 | }
|
4964 | DATE_FORMATTER_CACHE.set(cacheKey, parts);
|
4965 | }
|
4966 | return parts.reduce(function (text, part) {
|
4967 | var fn = DATE_FORMATS$1[part];
|
4968 | return text + (fn ? fn(date, locale) : partToTime(part));
|
4969 | }, '');
|
4970 | }
|
4971 | function partToTime(part) {
|
4972 | return part === '\'\'' ? '\'' : part.replace(/(^'|'$)/g, '').replace(/''/g, '\'');
|
4973 | }
|
4974 | var DateFormatter = (function () {
|
4975 | function DateFormatter() {
|
4976 | }
|
4977 | DateFormatter.format = function (date, locale, pattern) {
|
4978 | return dateFormatter(pattern, date, locale);
|
4979 | };
|
4980 | return DateFormatter;
|
4981 | }());
|
4982 |
|
4983 |
|
4984 |
|
4985 |
|
4986 |
|
4987 |
|
4988 |
|
4989 |
|
4990 |
|
4991 |
|
4992 |
|
4993 |
|
4994 |
|
4995 |
|
4996 |
|
4997 |
|
4998 |
|
4999 |
|
5000 |
|
5001 |
|
5002 |
|
5003 |
|
5004 |
|
5005 |
|
5006 |
|
5007 |
|
5008 |
|
5009 |
|
5010 |
|
5011 |
|
5012 |
|
5013 |
|
5014 |
|
5015 |
|
5016 |
|
5017 |
|
5018 |
|
5019 |
|
5020 |
|
5021 |
|
5022 |
|
5023 |
|
5024 |
|
5025 |
|
5026 |
|
5027 |
|
5028 |
|
5029 |
|
5030 |
|
5031 |
|
5032 |
|
5033 |
|
5034 |
|
5035 |
|
5036 |
|
5037 |
|
5038 |
|
5039 |
|
5040 |
|
5041 |
|
5042 |
|
5043 |
|
5044 |
|
5045 |
|
5046 |
|
5047 |
|
5048 |
|
5049 |
|
5050 |
|
5051 |
|
5052 |
|
5053 |
|
5054 | var DeprecatedDatePipe = (function () {
|
5055 | function DeprecatedDatePipe(_locale) {
|
5056 | this._locale = _locale;
|
5057 | }
|
5058 | DeprecatedDatePipe_1 = DeprecatedDatePipe;
|
5059 | DeprecatedDatePipe.prototype.transform = function (value, pattern) {
|
5060 | if (pattern === void 0) { pattern = 'mediumDate'; }
|
5061 | if (value == null || value === '' || value !== value)
|
5062 | return null;
|
5063 | var date;
|
5064 | if (typeof value === 'string') {
|
5065 | value = value.trim();
|
5066 | }
|
5067 | if (isDate$1(value)) {
|
5068 | date = value;
|
5069 | }
|
5070 | else if (!isNaN(value - parseFloat(value))) {
|
5071 | date = new Date(parseFloat(value));
|
5072 | }
|
5073 | else if (typeof value === 'string' && /^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) {
|
5074 | |
5075 |
|
5076 |
|
5077 |
|
5078 |
|
5079 |
|
5080 |
|
5081 |
|
5082 |
|
5083 |
|
5084 | var _a = __read(value.split('-').map(function (val) { return parseInt(val, 10); }), 3), y = _a[0], m = _a[1], d = _a[2];
|
5085 | date = new Date(y, m - 1, d);
|
5086 | }
|
5087 | else {
|
5088 | date = new Date(value);
|
5089 | }
|
5090 | if (!isDate$1(date)) {
|
5091 | var match = void 0;
|
5092 | if ((typeof value === 'string') && (match = value.match(ISO8601_DATE_REGEX))) {
|
5093 | date = isoStringToDate(match);
|
5094 | }
|
5095 | else {
|
5096 | throw invalidPipeArgumentError(DeprecatedDatePipe_1, value);
|
5097 | }
|
5098 | }
|
5099 | return DateFormatter.format(date, this._locale, DeprecatedDatePipe_1._ALIASES[pattern] || pattern);
|
5100 | };
|
5101 | var DeprecatedDatePipe_1;
|
5102 |
|
5103 | DeprecatedDatePipe._ALIASES = {
|
5104 | 'medium': 'yMMMdjms',
|
5105 | 'short': 'yMdjm',
|
5106 | 'fullDate': 'yMMMMEEEEd',
|
5107 | 'longDate': 'yMMMMd',
|
5108 | 'mediumDate': 'yMMMd',
|
5109 | 'shortDate': 'yMd',
|
5110 | 'mediumTime': 'jms',
|
5111 | 'shortTime': 'jm'
|
5112 | };
|
5113 | DeprecatedDatePipe = DeprecatedDatePipe_1 = __decorate([
|
5114 | Pipe({ name: 'date', pure: true }),
|
5115 | __param(0, Inject(LOCALE_ID)),
|
5116 | __metadata("design:paramtypes", [String])
|
5117 | ], DeprecatedDatePipe);
|
5118 | return DeprecatedDatePipe;
|
5119 | }());
|
5120 | function isDate$1(value) {
|
5121 | return value instanceof Date && !isNaN(value.valueOf());
|
5122 | }
|
5123 |
|
5124 |
|
5125 |
|
5126 |
|
5127 |
|
5128 |
|
5129 |
|
5130 |
|
5131 | function formatNumber$1(pipe, locale, value, style, digits, currency, currencyAsSymbol) {
|
5132 | if (currency === void 0) { currency = null; }
|
5133 | if (currencyAsSymbol === void 0) { currencyAsSymbol = false; }
|
5134 | if (value == null)
|
5135 | return null;
|
5136 |
|
5137 | value = typeof value === 'string' && !isNaN(+value - parseFloat(value)) ? +value : value;
|
5138 | if (typeof value !== 'number') {
|
5139 | throw invalidPipeArgumentError(pipe, value);
|
5140 | }
|
5141 | var minInt;
|
5142 | var minFraction;
|
5143 | var maxFraction;
|
5144 | if (style !== NumberFormatStyle.Currency) {
|
5145 |
|
5146 | minInt = 1;
|
5147 | minFraction = 0;
|
5148 | maxFraction = 3;
|
5149 | }
|
5150 | if (digits) {
|
5151 | var parts = digits.match(NUMBER_FORMAT_REGEXP);
|
5152 | if (parts === null) {
|
5153 | throw new Error(digits + " is not a valid digit info for number pipes");
|
5154 | }
|
5155 | if (parts[1] != null) {
|
5156 | minInt = parseIntAutoRadix(parts[1]);
|
5157 | }
|
5158 | if (parts[3] != null) {
|
5159 | minFraction = parseIntAutoRadix(parts[3]);
|
5160 | }
|
5161 | if (parts[5] != null) {
|
5162 | maxFraction = parseIntAutoRadix(parts[5]);
|
5163 | }
|
5164 | }
|
5165 | return NumberFormatter.format(value, locale, style, {
|
5166 | minimumIntegerDigits: minInt,
|
5167 | minimumFractionDigits: minFraction,
|
5168 | maximumFractionDigits: maxFraction,
|
5169 | currency: currency,
|
5170 | currencyAsSymbol: currencyAsSymbol,
|
5171 | });
|
5172 | }
|
5173 |
|
5174 |
|
5175 |
|
5176 |
|
5177 |
|
5178 |
|
5179 |
|
5180 |
|
5181 |
|
5182 |
|
5183 |
|
5184 |
|
5185 |
|
5186 |
|
5187 |
|
5188 |
|
5189 |
|
5190 |
|
5191 |
|
5192 |
|
5193 |
|
5194 |
|
5195 |
|
5196 |
|
5197 |
|
5198 |
|
5199 | var DeprecatedDecimalPipe = (function () {
|
5200 | function DeprecatedDecimalPipe(_locale) {
|
5201 | this._locale = _locale;
|
5202 | }
|
5203 | DeprecatedDecimalPipe_1 = DeprecatedDecimalPipe;
|
5204 | DeprecatedDecimalPipe.prototype.transform = function (value, digits) {
|
5205 | return formatNumber$1(DeprecatedDecimalPipe_1, this._locale, value, NumberFormatStyle.Decimal, digits);
|
5206 | };
|
5207 | var DeprecatedDecimalPipe_1;
|
5208 | DeprecatedDecimalPipe = DeprecatedDecimalPipe_1 = __decorate([
|
5209 | Pipe({ name: 'number' }),
|
5210 | __param(0, Inject(LOCALE_ID)),
|
5211 | __metadata("design:paramtypes", [String])
|
5212 | ], DeprecatedDecimalPipe);
|
5213 | return DeprecatedDecimalPipe;
|
5214 | }());
|
5215 |
|
5216 |
|
5217 |
|
5218 |
|
5219 |
|
5220 |
|
5221 |
|
5222 |
|
5223 |
|
5224 |
|
5225 |
|
5226 |
|
5227 |
|
5228 |
|
5229 |
|
5230 |
|
5231 |
|
5232 |
|
5233 |
|
5234 |
|
5235 | var DeprecatedPercentPipe = (function () {
|
5236 | function DeprecatedPercentPipe(_locale) {
|
5237 | this._locale = _locale;
|
5238 | }
|
5239 | DeprecatedPercentPipe_1 = DeprecatedPercentPipe;
|
5240 | DeprecatedPercentPipe.prototype.transform = function (value, digits) {
|
5241 | return formatNumber$1(DeprecatedPercentPipe_1, this._locale, value, NumberFormatStyle.Percent, digits);
|
5242 | };
|
5243 | var DeprecatedPercentPipe_1;
|
5244 | DeprecatedPercentPipe = DeprecatedPercentPipe_1 = __decorate([
|
5245 | Pipe({ name: 'percent' }),
|
5246 | __param(0, Inject(LOCALE_ID)),
|
5247 | __metadata("design:paramtypes", [String])
|
5248 | ], DeprecatedPercentPipe);
|
5249 | return DeprecatedPercentPipe;
|
5250 | }());
|
5251 |
|
5252 |
|
5253 |
|
5254 |
|
5255 |
|
5256 |
|
5257 |
|
5258 |
|
5259 |
|
5260 |
|
5261 |
|
5262 |
|
5263 |
|
5264 |
|
5265 |
|
5266 |
|
5267 |
|
5268 |
|
5269 |
|
5270 |
|
5271 |
|
5272 |
|
5273 |
|
5274 |
|
5275 |
|
5276 |
|
5277 | var DeprecatedCurrencyPipe = (function () {
|
5278 | function DeprecatedCurrencyPipe(_locale) {
|
5279 | this._locale = _locale;
|
5280 | }
|
5281 | DeprecatedCurrencyPipe_1 = DeprecatedCurrencyPipe;
|
5282 | DeprecatedCurrencyPipe.prototype.transform = function (value, currencyCode, symbolDisplay, digits) {
|
5283 | if (currencyCode === void 0) { currencyCode = 'USD'; }
|
5284 | if (symbolDisplay === void 0) { symbolDisplay = false; }
|
5285 | return formatNumber$1(DeprecatedCurrencyPipe_1, this._locale, value, NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay);
|
5286 | };
|
5287 | var DeprecatedCurrencyPipe_1;
|
5288 | DeprecatedCurrencyPipe = DeprecatedCurrencyPipe_1 = __decorate([
|
5289 | Pipe({ name: 'currency' }),
|
5290 | __param(0, Inject(LOCALE_ID)),
|
5291 | __metadata("design:paramtypes", [String])
|
5292 | ], DeprecatedCurrencyPipe);
|
5293 | return DeprecatedCurrencyPipe;
|
5294 | }());
|
5295 |
|
5296 |
|
5297 |
|
5298 |
|
5299 |
|
5300 |
|
5301 |
|
5302 |
|
5303 |
|
5304 |
|
5305 |
|
5306 |
|
5307 |
|
5308 | var COMMON_DEPRECATED_I18N_PIPES = [DeprecatedDecimalPipe, DeprecatedPercentPipe, DeprecatedCurrencyPipe, DeprecatedDatePipe];
|
5309 |
|
5310 |
|
5311 |
|
5312 |
|
5313 |
|
5314 |
|
5315 |
|
5316 |
|
5317 | var ObservableStrategy = (function () {
|
5318 | function ObservableStrategy() {
|
5319 | }
|
5320 | ObservableStrategy.prototype.createSubscription = function (async, updateLatestValue) {
|
5321 | return async.subscribe({ next: updateLatestValue, error: function (e) { throw e; } });
|
5322 | };
|
5323 | ObservableStrategy.prototype.dispose = function (subscription) { subscription.unsubscribe(); };
|
5324 | ObservableStrategy.prototype.onDestroy = function (subscription) { subscription.unsubscribe(); };
|
5325 | return ObservableStrategy;
|
5326 | }());
|
5327 | var PromiseStrategy = (function () {
|
5328 | function PromiseStrategy() {
|
5329 | }
|
5330 | PromiseStrategy.prototype.createSubscription = function (async, updateLatestValue) {
|
5331 | return async.then(updateLatestValue, function (e) { throw e; });
|
5332 | };
|
5333 | PromiseStrategy.prototype.dispose = function (subscription) { };
|
5334 | PromiseStrategy.prototype.onDestroy = function (subscription) { };
|
5335 | return PromiseStrategy;
|
5336 | }());
|
5337 | var _promiseStrategy = new PromiseStrategy();
|
5338 | var _observableStrategy = new ObservableStrategy();
|
5339 |
|
5340 |
|
5341 |
|
5342 |
|
5343 |
|
5344 |
|
5345 |
|
5346 |
|
5347 |
|
5348 |
|
5349 |
|
5350 |
|
5351 |
|
5352 |
|
5353 |
|
5354 |
|
5355 |
|
5356 |
|
5357 |
|
5358 |
|
5359 |
|
5360 |
|
5361 |
|
5362 |
|
5363 |
|
5364 |
|
5365 |
|
5366 | var AsyncPipe = (function () {
|
5367 | function AsyncPipe(_ref) {
|
5368 | this._ref = _ref;
|
5369 | this._latestValue = null;
|
5370 | this._latestReturnedValue = null;
|
5371 | this._subscription = null;
|
5372 | this._obj = null;
|
5373 | this._strategy = null;
|
5374 | }
|
5375 | AsyncPipe_1 = AsyncPipe;
|
5376 | AsyncPipe.prototype.ngOnDestroy = function () {
|
5377 | if (this._subscription) {
|
5378 | this._dispose();
|
5379 | }
|
5380 | };
|
5381 | AsyncPipe.prototype.transform = function (obj) {
|
5382 | if (!this._obj) {
|
5383 | if (obj) {
|
5384 | this._subscribe(obj);
|
5385 | }
|
5386 | this._latestReturnedValue = this._latestValue;
|
5387 | return this._latestValue;
|
5388 | }
|
5389 | if (obj !== this._obj) {
|
5390 | this._dispose();
|
5391 | return this.transform(obj);
|
5392 | }
|
5393 | if (ɵlooseIdentical(this._latestValue, this._latestReturnedValue)) {
|
5394 | return this._latestReturnedValue;
|
5395 | }
|
5396 | this._latestReturnedValue = this._latestValue;
|
5397 | return WrappedValue.wrap(this._latestValue);
|
5398 | };
|
5399 | AsyncPipe.prototype._subscribe = function (obj) {
|
5400 | var _this = this;
|
5401 | this._obj = obj;
|
5402 | this._strategy = this._selectStrategy(obj);
|
5403 | this._subscription = this._strategy.createSubscription(obj, function (value) { return _this._updateLatestValue(obj, value); });
|
5404 | };
|
5405 | AsyncPipe.prototype._selectStrategy = function (obj) {
|
5406 | if (ɵisPromise(obj)) {
|
5407 | return _promiseStrategy;
|
5408 | }
|
5409 | if (ɵisObservable(obj)) {
|
5410 | return _observableStrategy;
|
5411 | }
|
5412 | throw invalidPipeArgumentError(AsyncPipe_1, obj);
|
5413 | };
|
5414 | AsyncPipe.prototype._dispose = function () {
|
5415 | this._strategy.dispose(this._subscription);
|
5416 | this._latestValue = null;
|
5417 | this._latestReturnedValue = null;
|
5418 | this._subscription = null;
|
5419 | this._obj = null;
|
5420 | };
|
5421 | AsyncPipe.prototype._updateLatestValue = function (async, value) {
|
5422 | if (async === this._obj) {
|
5423 | this._latestValue = value;
|
5424 | this._ref.markForCheck();
|
5425 | }
|
5426 | };
|
5427 | var AsyncPipe_1;
|
5428 | AsyncPipe = AsyncPipe_1 = __decorate([
|
5429 | Injectable(),
|
5430 | Pipe({ name: 'async', pure: false }),
|
5431 | __metadata("design:paramtypes", [ChangeDetectorRef])
|
5432 | ], AsyncPipe);
|
5433 | return AsyncPipe;
|
5434 | }());
|
5435 |
|
5436 |
|
5437 |
|
5438 |
|
5439 |
|
5440 |
|
5441 |
|
5442 |
|
5443 |
|
5444 |
|
5445 |
|
5446 |
|
5447 |
|
5448 |
|
5449 |
|
5450 |
|
5451 |
|
5452 |
|
5453 |
|
5454 |
|
5455 |
|
5456 |
|
5457 |
|
5458 | var LowerCasePipe = (function () {
|
5459 | function LowerCasePipe() {
|
5460 | }
|
5461 | LowerCasePipe_1 = LowerCasePipe;
|
5462 | |
5463 |
|
5464 |
|
5465 | LowerCasePipe.prototype.transform = function (value) {
|
5466 | if (!value)
|
5467 | return value;
|
5468 | if (typeof value !== 'string') {
|
5469 | throw invalidPipeArgumentError(LowerCasePipe_1, value);
|
5470 | }
|
5471 | return value.toLowerCase();
|
5472 | };
|
5473 | var LowerCasePipe_1;
|
5474 | LowerCasePipe = LowerCasePipe_1 = __decorate([
|
5475 | Injectable(),
|
5476 | Pipe({ name: 'lowercase' })
|
5477 | ], LowerCasePipe);
|
5478 | return LowerCasePipe;
|
5479 | }());
|
5480 |
|
5481 |
|
5482 |
|
5483 |
|
5484 |
|
5485 |
|
5486 |
|
5487 |
|
5488 | var unicodeWordMatch = /(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D])\S*/g;
|
5489 |
|
5490 |
|
5491 |
|
5492 |
|
5493 |
|
5494 |
|
5495 |
|
5496 |
|
5497 |
|
5498 |
|
5499 |
|
5500 |
|
5501 |
|
5502 |
|
5503 |
|
5504 |
|
5505 |
|
5506 | var TitleCasePipe = (function () {
|
5507 | function TitleCasePipe() {
|
5508 | }
|
5509 | TitleCasePipe_1 = TitleCasePipe;
|
5510 | |
5511 |
|
5512 |
|
5513 | TitleCasePipe.prototype.transform = function (value) {
|
5514 | if (!value)
|
5515 | return value;
|
5516 | if (typeof value !== 'string') {
|
5517 | throw invalidPipeArgumentError(TitleCasePipe_1, value);
|
5518 | }
|
5519 | return value.replace(unicodeWordMatch, (function (txt) { return txt[0].toUpperCase() + txt.substr(1).toLowerCase(); }));
|
5520 | };
|
5521 | var TitleCasePipe_1;
|
5522 | TitleCasePipe = TitleCasePipe_1 = __decorate([
|
5523 | Injectable(),
|
5524 | Pipe({ name: 'titlecase' })
|
5525 | ], TitleCasePipe);
|
5526 | return TitleCasePipe;
|
5527 | }());
|
5528 |
|
5529 |
|
5530 |
|
5531 |
|
5532 |
|
5533 |
|
5534 |
|
5535 |
|
5536 | var UpperCasePipe = (function () {
|
5537 | function UpperCasePipe() {
|
5538 | }
|
5539 | UpperCasePipe_1 = UpperCasePipe;
|
5540 | |
5541 |
|
5542 |
|
5543 | UpperCasePipe.prototype.transform = function (value) {
|
5544 | if (!value)
|
5545 | return value;
|
5546 | if (typeof value !== 'string') {
|
5547 | throw invalidPipeArgumentError(UpperCasePipe_1, value);
|
5548 | }
|
5549 | return value.toUpperCase();
|
5550 | };
|
5551 | var UpperCasePipe_1;
|
5552 | UpperCasePipe = UpperCasePipe_1 = __decorate([
|
5553 | Injectable(),
|
5554 | Pipe({ name: 'uppercase' })
|
5555 | ], UpperCasePipe);
|
5556 | return UpperCasePipe;
|
5557 | }());
|
5558 |
|
5559 |
|
5560 |
|
5561 |
|
5562 |
|
5563 |
|
5564 |
|
5565 |
|
5566 |
|
5567 |
|
5568 |
|
5569 |
|
5570 |
|
5571 |
|
5572 |
|
5573 |
|
5574 |
|
5575 |
|
5576 |
|
5577 |
|
5578 |
|
5579 |
|
5580 |
|
5581 |
|
5582 |
|
5583 |
|
5584 |
|
5585 |
|
5586 |
|
5587 |
|
5588 |
|
5589 |
|
5590 |
|
5591 |
|
5592 |
|
5593 |
|
5594 |
|
5595 |
|
5596 |
|
5597 |
|
5598 |
|
5599 |
|
5600 |
|
5601 |
|
5602 |
|
5603 |
|
5604 |
|
5605 |
|
5606 |
|
5607 |
|
5608 |
|
5609 |
|
5610 |
|
5611 |
|
5612 |
|
5613 |
|
5614 |
|
5615 |
|
5616 |
|
5617 |
|
5618 |
|
5619 |
|
5620 |
|
5621 |
|
5622 |
|
5623 |
|
5624 |
|
5625 |
|
5626 |
|
5627 |
|
5628 |
|
5629 |
|
5630 |
|
5631 |
|
5632 |
|
5633 |
|
5634 |
|
5635 |
|
5636 |
|
5637 |
|
5638 |
|
5639 |
|
5640 |
|
5641 |
|
5642 |
|
5643 |
|
5644 |
|
5645 |
|
5646 |
|
5647 |
|
5648 |
|
5649 |
|
5650 |
|
5651 |
|
5652 |
|
5653 |
|
5654 |
|
5655 |
|
5656 |
|
5657 |
|
5658 |
|
5659 |
|
5660 |
|
5661 |
|
5662 |
|
5663 |
|
5664 |
|
5665 |
|
5666 |
|
5667 |
|
5668 |
|
5669 |
|
5670 |
|
5671 |
|
5672 |
|
5673 |
|
5674 |
|
5675 |
|
5676 |
|
5677 |
|
5678 |
|
5679 |
|
5680 |
|
5681 |
|
5682 |
|
5683 |
|
5684 |
|
5685 |
|
5686 |
|
5687 |
|
5688 |
|
5689 |
|
5690 |
|
5691 |
|
5692 |
|
5693 |
|
5694 |
|
5695 |
|
5696 |
|
5697 |
|
5698 |
|
5699 |
|
5700 |
|
5701 |
|
5702 |
|
5703 |
|
5704 |
|
5705 |
|
5706 | var DatePipe = (function () {
|
5707 | function DatePipe(locale) {
|
5708 | this.locale = locale;
|
5709 | }
|
5710 | DatePipe_1 = DatePipe;
|
5711 | |
5712 |
|
5713 |
|
5714 |
|
5715 |
|
5716 |
|
5717 |
|
5718 |
|
5719 |
|
5720 |
|
5721 |
|
5722 |
|
5723 |
|
5724 | DatePipe.prototype.transform = function (value, format, timezone, locale) {
|
5725 | if (format === void 0) { format = 'mediumDate'; }
|
5726 | if (value == null || value === '' || value !== value)
|
5727 | return null;
|
5728 | try {
|
5729 | return formatDate(value, format, locale || this.locale, timezone);
|
5730 | }
|
5731 | catch (error) {
|
5732 | throw invalidPipeArgumentError(DatePipe_1, error.message);
|
5733 | }
|
5734 | };
|
5735 | var DatePipe_1;
|
5736 | DatePipe = DatePipe_1 = __decorate([
|
5737 | Injectable(),
|
5738 | Pipe({ name: 'date', pure: true }),
|
5739 | __param(0, Inject(LOCALE_ID)),
|
5740 | __metadata("design:paramtypes", [String])
|
5741 | ], DatePipe);
|
5742 | return DatePipe;
|
5743 | }());
|
5744 |
|
5745 |
|
5746 |
|
5747 |
|
5748 |
|
5749 |
|
5750 |
|
5751 |
|
5752 | var _INTERPOLATION_REGEXP = /#/g;
|
5753 |
|
5754 |
|
5755 |
|
5756 |
|
5757 |
|
5758 |
|
5759 |
|
5760 |
|
5761 |
|
5762 |
|
5763 |
|
5764 |
|
5765 |
|
5766 |
|
5767 | var I18nPluralPipe = (function () {
|
5768 | function I18nPluralPipe(_localization) {
|
5769 | this._localization = _localization;
|
5770 | }
|
5771 | I18nPluralPipe_1 = I18nPluralPipe;
|
5772 | |
5773 |
|
5774 |
|
5775 |
|
5776 |
|
5777 |
|
5778 |
|
5779 | I18nPluralPipe.prototype.transform = function (value, pluralMap, locale) {
|
5780 | if (value == null)
|
5781 | return '';
|
5782 | if (typeof pluralMap !== 'object' || pluralMap === null) {
|
5783 | throw invalidPipeArgumentError(I18nPluralPipe_1, pluralMap);
|
5784 | }
|
5785 | var key = getPluralCategory(value, Object.keys(pluralMap), this._localization, locale);
|
5786 | return pluralMap[key].replace(_INTERPOLATION_REGEXP, value.toString());
|
5787 | };
|
5788 | var I18nPluralPipe_1;
|
5789 | I18nPluralPipe = I18nPluralPipe_1 = __decorate([
|
5790 | Injectable(),
|
5791 | Pipe({ name: 'i18nPlural', pure: true }),
|
5792 | __metadata("design:paramtypes", [NgLocalization])
|
5793 | ], I18nPluralPipe);
|
5794 | return I18nPluralPipe;
|
5795 | }());
|
5796 |
|
5797 |
|
5798 |
|
5799 |
|
5800 |
|
5801 |
|
5802 |
|
5803 |
|
5804 |
|
5805 |
|
5806 |
|
5807 |
|
5808 |
|
5809 |
|
5810 |
|
5811 |
|
5812 |
|
5813 |
|
5814 |
|
5815 |
|
5816 |
|
5817 |
|
5818 |
|
5819 |
|
5820 |
|
5821 | var I18nSelectPipe = (function () {
|
5822 | function I18nSelectPipe() {
|
5823 | }
|
5824 | I18nSelectPipe_1 = I18nSelectPipe;
|
5825 | |
5826 |
|
5827 |
|
5828 |
|
5829 |
|
5830 | I18nSelectPipe.prototype.transform = function (value, mapping) {
|
5831 | if (value == null)
|
5832 | return '';
|
5833 | if (typeof mapping !== 'object' || typeof value !== 'string') {
|
5834 | throw invalidPipeArgumentError(I18nSelectPipe_1, mapping);
|
5835 | }
|
5836 | if (mapping.hasOwnProperty(value)) {
|
5837 | return mapping[value];
|
5838 | }
|
5839 | if (mapping.hasOwnProperty('other')) {
|
5840 | return mapping['other'];
|
5841 | }
|
5842 | return '';
|
5843 | };
|
5844 | var I18nSelectPipe_1;
|
5845 | I18nSelectPipe = I18nSelectPipe_1 = __decorate([
|
5846 | Injectable(),
|
5847 | Pipe({ name: 'i18nSelect', pure: true })
|
5848 | ], I18nSelectPipe);
|
5849 | return I18nSelectPipe;
|
5850 | }());
|
5851 |
|
5852 |
|
5853 |
|
5854 |
|
5855 |
|
5856 |
|
5857 |
|
5858 |
|
5859 |
|
5860 |
|
5861 |
|
5862 |
|
5863 |
|
5864 |
|
5865 |
|
5866 |
|
5867 |
|
5868 |
|
5869 |
|
5870 |
|
5871 |
|
5872 |
|
5873 |
|
5874 | var JsonPipe = (function () {
|
5875 | function JsonPipe() {
|
5876 | }
|
5877 | |
5878 |
|
5879 |
|
5880 | JsonPipe.prototype.transform = function (value) { return JSON.stringify(value, null, 2); };
|
5881 | JsonPipe = __decorate([
|
5882 | Injectable(),
|
5883 | Pipe({ name: 'json', pure: false })
|
5884 | ], JsonPipe);
|
5885 | return JsonPipe;
|
5886 | }());
|
5887 |
|
5888 |
|
5889 |
|
5890 |
|
5891 |
|
5892 |
|
5893 |
|
5894 |
|
5895 | function makeKeyValuePair(key, value) {
|
5896 | return { key: key, value: value };
|
5897 | }
|
5898 |
|
5899 |
|
5900 |
|
5901 |
|
5902 |
|
5903 |
|
5904 |
|
5905 |
|
5906 |
|
5907 |
|
5908 |
|
5909 |
|
5910 |
|
5911 |
|
5912 |
|
5913 |
|
5914 |
|
5915 |
|
5916 |
|
5917 |
|
5918 | var KeyValuePipe = (function () {
|
5919 | function KeyValuePipe(differs) {
|
5920 | this.differs = differs;
|
5921 | this.keyValues = [];
|
5922 | }
|
5923 | KeyValuePipe.prototype.transform = function (input, compareFn) {
|
5924 | var _this = this;
|
5925 | if (compareFn === void 0) { compareFn = defaultComparator; }
|
5926 | if (!input || (!(input instanceof Map) && typeof input !== 'object')) {
|
5927 | return null;
|
5928 | }
|
5929 | if (!this.differ) {
|
5930 |
|
5931 | this.differ = this.differs.find(input).create();
|
5932 | }
|
5933 | var differChanges = this.differ.diff(input);
|
5934 | if (differChanges) {
|
5935 | this.keyValues = [];
|
5936 | differChanges.forEachItem(function (r) {
|
5937 | _this.keyValues.push(makeKeyValuePair(r.key, r.currentValue));
|
5938 | });
|
5939 | this.keyValues.sort(compareFn);
|
5940 | }
|
5941 | return this.keyValues;
|
5942 | };
|
5943 | KeyValuePipe = __decorate([
|
5944 | Injectable(),
|
5945 | Pipe({ name: 'keyvalue', pure: false }),
|
5946 | __metadata("design:paramtypes", [KeyValueDiffers])
|
5947 | ], KeyValuePipe);
|
5948 | return KeyValuePipe;
|
5949 | }());
|
5950 | function defaultComparator(keyValueA, keyValueB) {
|
5951 | var a = keyValueA.key;
|
5952 | var b = keyValueB.key;
|
5953 |
|
5954 | if (a === b)
|
5955 | return 0;
|
5956 |
|
5957 | if (a === undefined)
|
5958 | return 1;
|
5959 | if (b === undefined)
|
5960 | return -1;
|
5961 |
|
5962 | if (a === null)
|
5963 | return 1;
|
5964 | if (b === null)
|
5965 | return -1;
|
5966 | if (typeof a == 'string' && typeof b == 'string') {
|
5967 | return a < b ? -1 : 1;
|
5968 | }
|
5969 | if (typeof a == 'number' && typeof b == 'number') {
|
5970 | return a - b;
|
5971 | }
|
5972 | if (typeof a == 'boolean' && typeof b == 'boolean') {
|
5973 | return a < b ? -1 : 1;
|
5974 | }
|
5975 |
|
5976 | var aString = String(a);
|
5977 | var bString = String(b);
|
5978 | return aString == bString ? 0 : aString < bString ? -1 : 1;
|
5979 | }
|
5980 |
|
5981 |
|
5982 |
|
5983 |
|
5984 |
|
5985 |
|
5986 |
|
5987 |
|
5988 |
|
5989 |
|
5990 |
|
5991 |
|
5992 |
|
5993 |
|
5994 |
|
5995 |
|
5996 |
|
5997 |
|
5998 |
|
5999 |
|
6000 |
|
6001 |
|
6002 |
|
6003 |
|
6004 |
|
6005 |
|
6006 |
|
6007 |
|
6008 |
|
6009 |
|
6010 |
|
6011 |
|
6012 |
|
6013 |
|
6014 |
|
6015 |
|
6016 |
|
6017 |
|
6018 |
|
6019 |
|
6020 |
|
6021 |
|
6022 |
|
6023 | var DecimalPipe = (function () {
|
6024 | function DecimalPipe(_locale) {
|
6025 | this._locale = _locale;
|
6026 | }
|
6027 | DecimalPipe_1 = DecimalPipe;
|
6028 | |
6029 |
|
6030 |
|
6031 |
|
6032 |
|
6033 |
|
6034 |
|
6035 |
|
6036 |
|
6037 |
|
6038 |
|
6039 |
|
6040 |
|
6041 |
|
6042 |
|
6043 | DecimalPipe.prototype.transform = function (value, digitsInfo, locale) {
|
6044 | if (isEmpty(value))
|
6045 | return null;
|
6046 | locale = locale || this._locale;
|
6047 | try {
|
6048 | var num = strToNumber(value);
|
6049 | return formatNumber(num, locale, digitsInfo);
|
6050 | }
|
6051 | catch (error) {
|
6052 | throw invalidPipeArgumentError(DecimalPipe_1, error.message);
|
6053 | }
|
6054 | };
|
6055 | var DecimalPipe_1;
|
6056 | DecimalPipe = DecimalPipe_1 = __decorate([
|
6057 | Injectable(),
|
6058 | Pipe({ name: 'number' }),
|
6059 | __param(0, Inject(LOCALE_ID)),
|
6060 | __metadata("design:paramtypes", [String])
|
6061 | ], DecimalPipe);
|
6062 | return DecimalPipe;
|
6063 | }());
|
6064 |
|
6065 |
|
6066 |
|
6067 |
|
6068 |
|
6069 |
|
6070 |
|
6071 |
|
6072 |
|
6073 |
|
6074 |
|
6075 |
|
6076 |
|
6077 |
|
6078 |
|
6079 |
|
6080 |
|
6081 |
|
6082 |
|
6083 |
|
6084 | var PercentPipe = (function () {
|
6085 | function PercentPipe(_locale) {
|
6086 | this._locale = _locale;
|
6087 | }
|
6088 | PercentPipe_1 = PercentPipe;
|
6089 | |
6090 |
|
6091 |
|
6092 |
|
6093 |
|
6094 |
|
6095 |
|
6096 |
|
6097 |
|
6098 |
|
6099 |
|
6100 |
|
6101 |
|
6102 |
|
6103 |
|
6104 |
|
6105 | PercentPipe.prototype.transform = function (value, digitsInfo, locale) {
|
6106 | if (isEmpty(value))
|
6107 | return null;
|
6108 | locale = locale || this._locale;
|
6109 | try {
|
6110 | var num = strToNumber(value);
|
6111 | return formatPercent(num, locale, digitsInfo);
|
6112 | }
|
6113 | catch (error) {
|
6114 | throw invalidPipeArgumentError(PercentPipe_1, error.message);
|
6115 | }
|
6116 | };
|
6117 | var PercentPipe_1;
|
6118 | PercentPipe = PercentPipe_1 = __decorate([
|
6119 | Injectable(),
|
6120 | Pipe({ name: 'percent' }),
|
6121 | __param(0, Inject(LOCALE_ID)),
|
6122 | __metadata("design:paramtypes", [String])
|
6123 | ], PercentPipe);
|
6124 | return PercentPipe;
|
6125 | }());
|
6126 |
|
6127 |
|
6128 |
|
6129 |
|
6130 |
|
6131 |
|
6132 |
|
6133 |
|
6134 |
|
6135 |
|
6136 |
|
6137 |
|
6138 |
|
6139 |
|
6140 |
|
6141 |
|
6142 |
|
6143 |
|
6144 |
|
6145 |
|
6146 | var CurrencyPipe = (function () {
|
6147 | function CurrencyPipe(_locale) {
|
6148 | this._locale = _locale;
|
6149 | }
|
6150 | CurrencyPipe_1 = CurrencyPipe;
|
6151 | |
6152 |
|
6153 |
|
6154 |
|
6155 |
|
6156 |
|
6157 |
|
6158 |
|
6159 |
|
6160 |
|
6161 |
|
6162 |
|
6163 |
|
6164 |
|
6165 |
|
6166 |
|
6167 |
|
6168 |
|
6169 |
|
6170 |
|
6171 |
|
6172 |
|
6173 |
|
6174 |
|
6175 |
|
6176 |
|
6177 |
|
6178 |
|
6179 |
|
6180 |
|
6181 |
|
6182 |
|
6183 | CurrencyPipe.prototype.transform = function (value, currencyCode, display, digitsInfo, locale) {
|
6184 | if (display === void 0) { display = 'symbol'; }
|
6185 | if (isEmpty(value))
|
6186 | return null;
|
6187 | locale = locale || this._locale;
|
6188 | if (typeof display === 'boolean') {
|
6189 | if (console && console.warn) {
|
6190 | console.warn("Warning: the currency pipe has been changed in Angular v5. The symbolDisplay option (third parameter) is now a string instead of a boolean. The accepted values are \"code\", \"symbol\" or \"symbol-narrow\".");
|
6191 | }
|
6192 | display = display ? 'symbol' : 'code';
|
6193 | }
|
6194 | var currency = currencyCode || 'USD';
|
6195 | if (display !== 'code') {
|
6196 | if (display === 'symbol' || display === 'symbol-narrow') {
|
6197 | currency = getCurrencySymbol(currency, display === 'symbol' ? 'wide' : 'narrow', locale);
|
6198 | }
|
6199 | else {
|
6200 | currency = display;
|
6201 | }
|
6202 | }
|
6203 | try {
|
6204 | var num = strToNumber(value);
|
6205 | return formatCurrency(num, locale, currency, currencyCode, digitsInfo);
|
6206 | }
|
6207 | catch (error) {
|
6208 | throw invalidPipeArgumentError(CurrencyPipe_1, error.message);
|
6209 | }
|
6210 | };
|
6211 | var CurrencyPipe_1;
|
6212 | CurrencyPipe = CurrencyPipe_1 = __decorate([
|
6213 | Injectable(),
|
6214 | Pipe({ name: 'currency' }),
|
6215 | __param(0, Inject(LOCALE_ID)),
|
6216 | __metadata("design:paramtypes", [String])
|
6217 | ], CurrencyPipe);
|
6218 | return CurrencyPipe;
|
6219 | }());
|
6220 | function isEmpty(value) {
|
6221 | return value == null || value === '' || value !== value;
|
6222 | }
|
6223 |
|
6224 |
|
6225 |
|
6226 | function strToNumber(value) {
|
6227 |
|
6228 | if (typeof value === 'string' && !isNaN(Number(value) - parseFloat(value))) {
|
6229 | return Number(value);
|
6230 | }
|
6231 | if (typeof value !== 'number') {
|
6232 | throw new Error(value + " is not a number");
|
6233 | }
|
6234 | return value;
|
6235 | }
|
6236 |
|
6237 |
|
6238 |
|
6239 |
|
6240 |
|
6241 |
|
6242 |
|
6243 |
|
6244 |
|
6245 |
|
6246 |
|
6247 |
|
6248 |
|
6249 |
|
6250 |
|
6251 |
|
6252 |
|
6253 |
|
6254 |
|
6255 |
|
6256 |
|
6257 |
|
6258 |
|
6259 |
|
6260 |
|
6261 |
|
6262 |
|
6263 |
|
6264 |
|
6265 |
|
6266 |
|
6267 |
|
6268 |
|
6269 |
|
6270 |
|
6271 |
|
6272 |
|
6273 |
|
6274 |
|
6275 |
|
6276 |
|
6277 |
|
6278 |
|
6279 | var SlicePipe = (function () {
|
6280 | function SlicePipe() {
|
6281 | }
|
6282 | SlicePipe_1 = SlicePipe;
|
6283 | SlicePipe.prototype.transform = function (value, start, end) {
|
6284 | if (value == null)
|
6285 | return value;
|
6286 | if (!this.supports(value)) {
|
6287 | throw invalidPipeArgumentError(SlicePipe_1, value);
|
6288 | }
|
6289 | return value.slice(start, end);
|
6290 | };
|
6291 | SlicePipe.prototype.supports = function (obj) { return typeof obj === 'string' || Array.isArray(obj); };
|
6292 | var SlicePipe_1;
|
6293 | SlicePipe = SlicePipe_1 = __decorate([
|
6294 | Injectable(),
|
6295 | Pipe({ name: 'slice', pure: false })
|
6296 | ], SlicePipe);
|
6297 | return SlicePipe;
|
6298 | }());
|
6299 |
|
6300 |
|
6301 |
|
6302 |
|
6303 |
|
6304 |
|
6305 |
|
6306 |
|
6307 |
|
6308 |
|
6309 |
|
6310 | var COMMON_PIPES = [
|
6311 | AsyncPipe,
|
6312 | UpperCasePipe,
|
6313 | LowerCasePipe,
|
6314 | JsonPipe,
|
6315 | SlicePipe,
|
6316 | DecimalPipe,
|
6317 | PercentPipe,
|
6318 | TitleCasePipe,
|
6319 | CurrencyPipe,
|
6320 | DatePipe,
|
6321 | I18nPluralPipe,
|
6322 | I18nSelectPipe,
|
6323 | KeyValuePipe,
|
6324 | ];
|
6325 |
|
6326 |
|
6327 |
|
6328 |
|
6329 |
|
6330 |
|
6331 |
|
6332 |
|
6333 |
|
6334 |
|
6335 |
|
6336 |
|
6337 |
|
6338 |
|
6339 |
|
6340 |
|
6341 |
|
6342 |
|
6343 |
|
6344 |
|
6345 |
|
6346 |
|
6347 |
|
6348 | var CommonModule = (function () {
|
6349 | function CommonModule() {
|
6350 | }
|
6351 | CommonModule = __decorate([
|
6352 | NgModule({
|
6353 | declarations: [COMMON_DIRECTIVES, COMMON_PIPES],
|
6354 | exports: [COMMON_DIRECTIVES, COMMON_PIPES],
|
6355 | providers: [
|
6356 | { provide: NgLocalization, useClass: NgLocaleLocalization },
|
6357 | ],
|
6358 | })
|
6359 | ], CommonModule);
|
6360 | return CommonModule;
|
6361 | }());
|
6362 | var ɵ0$2 = getPluralCase;
|
6363 |
|
6364 |
|
6365 |
|
6366 |
|
6367 |
|
6368 |
|
6369 | var DeprecatedI18NPipesModule = (function () {
|
6370 | function DeprecatedI18NPipesModule() {
|
6371 | }
|
6372 | DeprecatedI18NPipesModule = __decorate([
|
6373 | NgModule({
|
6374 | declarations: [COMMON_DEPRECATED_I18N_PIPES],
|
6375 | exports: [COMMON_DEPRECATED_I18N_PIPES],
|
6376 | providers: [{ provide: DEPRECATED_PLURAL_FN, useValue: ɵ0$2 }],
|
6377 | })
|
6378 | ], DeprecatedI18NPipesModule);
|
6379 | return DeprecatedI18NPipesModule;
|
6380 | }());
|
6381 |
|
6382 |
|
6383 |
|
6384 |
|
6385 |
|
6386 |
|
6387 |
|
6388 |
|
6389 |
|
6390 |
|
6391 |
|
6392 |
|
6393 |
|
6394 |
|
6395 |
|
6396 |
|
6397 | var DOCUMENT = new InjectionToken('DocumentToken');
|
6398 |
|
6399 |
|
6400 |
|
6401 |
|
6402 |
|
6403 |
|
6404 |
|
6405 |
|
6406 | var PLATFORM_BROWSER_ID = 'browser';
|
6407 | var PLATFORM_SERVER_ID = 'server';
|
6408 | var PLATFORM_WORKER_APP_ID = 'browserWorkerApp';
|
6409 | var PLATFORM_WORKER_UI_ID = 'browserWorkerUi';
|
6410 |
|
6411 |
|
6412 |
|
6413 |
|
6414 | function isPlatformBrowser(platformId) {
|
6415 | return platformId === PLATFORM_BROWSER_ID;
|
6416 | }
|
6417 |
|
6418 |
|
6419 |
|
6420 |
|
6421 | function isPlatformServer(platformId) {
|
6422 | return platformId === PLATFORM_SERVER_ID;
|
6423 | }
|
6424 |
|
6425 |
|
6426 |
|
6427 |
|
6428 | function isPlatformWorkerApp(platformId) {
|
6429 | return platformId === PLATFORM_WORKER_APP_ID;
|
6430 | }
|
6431 |
|
6432 |
|
6433 |
|
6434 |
|
6435 | function isPlatformWorkerUi(platformId) {
|
6436 | return platformId === PLATFORM_WORKER_UI_ID;
|
6437 | }
|
6438 |
|
6439 |
|
6440 |
|
6441 |
|
6442 |
|
6443 |
|
6444 |
|
6445 |
|
6446 |
|
6447 |
|
6448 |
|
6449 | var VERSION = new Version('8.2.0');
|
6450 |
|
6451 |
|
6452 |
|
6453 |
|
6454 |
|
6455 |
|
6456 |
|
6457 |
|
6458 |
|
6459 |
|
6460 |
|
6461 |
|
6462 |
|
6463 | var ViewportScroller = (function () {
|
6464 | function ViewportScroller() {
|
6465 | }
|
6466 |
|
6467 |
|
6468 |
|
6469 | ViewportScroller.ngInjectableDef = ɵɵdefineInjectable({
|
6470 | token: ViewportScroller,
|
6471 | providedIn: 'root',
|
6472 | factory: function () { return new BrowserViewportScroller(ɵɵinject(DOCUMENT), window, ɵɵinject(ErrorHandler)); }
|
6473 | });
|
6474 | return ViewportScroller;
|
6475 | }());
|
6476 |
|
6477 |
|
6478 |
|
6479 | var BrowserViewportScroller = (function () {
|
6480 | function BrowserViewportScroller(document, window, errorHandler) {
|
6481 | this.document = document;
|
6482 | this.window = window;
|
6483 | this.errorHandler = errorHandler;
|
6484 | this.offset = function () { return [0, 0]; };
|
6485 | }
|
6486 | |
6487 |
|
6488 |
|
6489 |
|
6490 |
|
6491 |
|
6492 | BrowserViewportScroller.prototype.setOffset = function (offset) {
|
6493 | if (Array.isArray(offset)) {
|
6494 | this.offset = function () { return offset; };
|
6495 | }
|
6496 | else {
|
6497 | this.offset = offset;
|
6498 | }
|
6499 | };
|
6500 | |
6501 |
|
6502 |
|
6503 |
|
6504 | BrowserViewportScroller.prototype.getScrollPosition = function () {
|
6505 | if (this.supportScrollRestoration()) {
|
6506 | return [this.window.scrollX, this.window.scrollY];
|
6507 | }
|
6508 | else {
|
6509 | return [0, 0];
|
6510 | }
|
6511 | };
|
6512 | |
6513 |
|
6514 |
|
6515 |
|
6516 | BrowserViewportScroller.prototype.scrollToPosition = function (position) {
|
6517 | if (this.supportScrollRestoration()) {
|
6518 | this.window.scrollTo(position[0], position[1]);
|
6519 | }
|
6520 | };
|
6521 | |
6522 |
|
6523 |
|
6524 |
|
6525 | BrowserViewportScroller.prototype.scrollToAnchor = function (anchor) {
|
6526 | if (this.supportScrollRestoration()) {
|
6527 |
|
6528 |
|
6529 | if (this.window.CSS && this.window.CSS.escape) {
|
6530 | anchor = this.window.CSS.escape(anchor);
|
6531 | }
|
6532 | else {
|
6533 | anchor = anchor.replace(/(\"|\'\ |:|\.|\[|\]|,|=)/g, '\\$1');
|
6534 | }
|
6535 | try {
|
6536 | var elSelectedById = this.document.querySelector("#" + anchor);
|
6537 | if (elSelectedById) {
|
6538 | this.scrollToElement(elSelectedById);
|
6539 | return;
|
6540 | }
|
6541 | var elSelectedByName = this.document.querySelector("[name='" + anchor + "']");
|
6542 | if (elSelectedByName) {
|
6543 | this.scrollToElement(elSelectedByName);
|
6544 | return;
|
6545 | }
|
6546 | }
|
6547 | catch (e) {
|
6548 | this.errorHandler.handleError(e);
|
6549 | }
|
6550 | }
|
6551 | };
|
6552 | |
6553 |
|
6554 |
|
6555 | BrowserViewportScroller.prototype.setHistoryScrollRestoration = function (scrollRestoration) {
|
6556 | if (this.supportScrollRestoration()) {
|
6557 | var history_1 = this.window.history;
|
6558 | if (history_1 && history_1.scrollRestoration) {
|
6559 | history_1.scrollRestoration = scrollRestoration;
|
6560 | }
|
6561 | }
|
6562 | };
|
6563 | BrowserViewportScroller.prototype.scrollToElement = function (el) {
|
6564 | var rect = el.getBoundingClientRect();
|
6565 | var left = rect.left + this.window.pageXOffset;
|
6566 | var top = rect.top + this.window.pageYOffset;
|
6567 | var offset = this.offset();
|
6568 | this.window.scrollTo(left - offset[0], top - offset[1]);
|
6569 | };
|
6570 | |
6571 |
|
6572 |
|
6573 |
|
6574 |
|
6575 |
|
6576 |
|
6577 |
|
6578 | BrowserViewportScroller.prototype.supportScrollRestoration = function () {
|
6579 | try {
|
6580 | return !!this.window && !!this.window.scrollTo;
|
6581 | }
|
6582 | catch (_a) {
|
6583 | return false;
|
6584 | }
|
6585 | };
|
6586 | return BrowserViewportScroller;
|
6587 | }());
|
6588 |
|
6589 |
|
6590 |
|
6591 |
|
6592 | var NullViewportScroller = (function () {
|
6593 | function NullViewportScroller() {
|
6594 | }
|
6595 | |
6596 |
|
6597 |
|
6598 | NullViewportScroller.prototype.setOffset = function (offset) { };
|
6599 | |
6600 |
|
6601 |
|
6602 | NullViewportScroller.prototype.getScrollPosition = function () { return [0, 0]; };
|
6603 | |
6604 |
|
6605 |
|
6606 | NullViewportScroller.prototype.scrollToPosition = function (position) { };
|
6607 | |
6608 |
|
6609 |
|
6610 | NullViewportScroller.prototype.scrollToAnchor = function (anchor) { };
|
6611 | |
6612 |
|
6613 |
|
6614 | NullViewportScroller.prototype.setHistoryScrollRestoration = function (scrollRestoration) { };
|
6615 | return NullViewportScroller;
|
6616 | }());
|
6617 |
|
6618 |
|
6619 |
|
6620 |
|
6621 |
|
6622 |
|
6623 |
|
6624 |
|
6625 |
|
6626 |
|
6627 |
|
6628 |
|
6629 |
|
6630 |
|
6631 |
|
6632 |
|
6633 |
|
6634 |
|
6635 |
|
6636 |
|
6637 |
|
6638 |
|
6639 |
|
6640 |
|
6641 |
|
6642 |
|
6643 |
|
6644 |
|
6645 |
|
6646 |
|
6647 | export { COMMON_DIRECTIVES as ɵangular_packages_common_common_c, NgClassImplProvider as ɵangular_packages_common_common_h, NgClassImplProvider__PRE_R3__ as ɵangular_packages_common_common_g, NgClassR3Impl as ɵangular_packages_common_common_f, NgStyleImplProvider as ɵangular_packages_common_common_k, NgStyleImplProvider__PRE_R3__ as ɵangular_packages_common_common_j, NgStyleR3Impl as ɵangular_packages_common_common_i, DEPRECATED_PLURAL_FN as ɵangular_packages_common_common_a, getPluralCase as ɵangular_packages_common_common_b, COMMON_DEPRECATED_I18N_PIPES as ɵangular_packages_common_common_e, COMMON_PIPES as ɵangular_packages_common_common_d, registerLocaleData as ɵregisterLocaleData, registerLocaleData, formatDate, formatCurrency, formatNumber, formatPercent, NgLocaleLocalization, NgLocalization, Plural, NumberFormatStyle, FormStyle, TranslationWidth, FormatWidth, NumberSymbol, WeekDay, getNumberOfCurrencyDigits, getCurrencySymbol, getLocaleDayPeriods, getLocaleDayNames, getLocaleMonthNames, getLocaleId, getLocaleEraNames, getLocaleWeekEndRange, getLocaleFirstDayOfWeek, getLocaleDateFormat, getLocaleDateTimeFormat, getLocaleExtraDayPeriodRules, getLocaleExtraDayPeriods, getLocalePluralCase, getLocaleTimeFormat, getLocaleNumberSymbol, getLocaleNumberFormat, getLocaleCurrencyName, getLocaleCurrencySymbol, parseCookieValue as ɵparseCookieValue, CommonModule, DeprecatedI18NPipesModule, NgClass, NgClassBase, NgForOf, NgForOfContext, NgIf, NgIfContext, NgPlural, NgPluralCase, NgStyle, NgStyleBase, NgSwitch, NgSwitchCase, NgSwitchDefault, NgTemplateOutlet, NgComponentOutlet, DOCUMENT, AsyncPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, JsonPipe, LowerCasePipe, CurrencyPipe, DecimalPipe, PercentPipe, SlicePipe, UpperCasePipe, TitleCasePipe, KeyValuePipe, DeprecatedDatePipe, DeprecatedCurrencyPipe, DeprecatedDecimalPipe, DeprecatedPercentPipe, PLATFORM_BROWSER_ID as ɵPLATFORM_BROWSER_ID, PLATFORM_SERVER_ID as ɵPLATFORM_SERVER_ID, PLATFORM_WORKER_APP_ID as ɵPLATFORM_WORKER_APP_ID, PLATFORM_WORKER_UI_ID as ɵPLATFORM_WORKER_UI_ID, isPlatformBrowser, isPlatformServer, isPlatformWorkerApp, isPlatformWorkerUi, VERSION, ViewportScroller, NullViewportScroller as ɵNullViewportScroller, NgClassImplProvider__POST_R3__ as ɵNgClassImplProvider__POST_R3__, NgClassR2Impl as ɵNgClassR2Impl, NgClassImpl as ɵNgClassImpl, NgStyleImplProvider__POST_R3__ as ɵNgStyleImplProvider__POST_R3__, NgStyleR2Impl as ɵNgStyleR2Impl, NgStyleImpl as ɵNgStyleImpl, ngStyleDirectiveDef__POST_R3__ as ɵngStyleDirectiveDef__POST_R3__, ngClassDirectiveDef__POST_R3__ as ɵngClassDirectiveDef__POST_R3__, PlatformLocation, LOCATION_INITIALIZED, LocationStrategy, APP_BASE_HREF, HashLocationStrategy, PathLocationStrategy, Location };
|
6648 |
|