@angular-wave/angular.ts 0.15.0 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/angular.d.ts +4 -1
- package/@types/core/compile/attributes.d.ts +28 -4
- package/@types/core/compile/inteface.d.ts +5 -1
- package/@types/core/di/inteface.d.ts +11 -0
- package/@types/core/parse/ast/ast-node.d.ts +2 -0
- package/@types/core/parse/parse.d.ts +4 -1
- package/@types/core/scope/interface.d.ts +26 -0
- package/@types/core/scope/scope.d.ts +16 -24
- package/@types/directive/bind/bind.d.ts +5 -7
- package/@types/directive/form/form.d.ts +12 -9
- package/@types/directive/init/init.d.ts +2 -2
- package/@types/directive/input/input.d.ts +8 -24
- package/@types/directive/listener/listener.d.ts +4 -0
- package/@types/directive/model/interface.d.ts +18 -0
- package/@types/directive/model/model.d.ts +20 -18
- package/@types/directive/non-bindable/non-bindable.d.ts +2 -2
- package/@types/directive/select/select.d.ts +2 -2
- package/@types/directive/setter/setter.d.ts +2 -2
- package/@types/directive/show-hide/show-hide.d.ts +3 -4
- package/@types/directive/switch/switch.d.ts +4 -4
- package/@types/interface.d.ts +22 -1
- package/@types/namespace.d.ts +16 -2
- package/@types/router/router.d.ts +5 -3
- package/@types/router/scroll/interface.d.ts +1 -1
- package/@types/router/state/interface.d.ts +5 -0
- package/@types/router/state/state-builder.d.ts +10 -6
- package/@types/router/state/state-matcher.d.ts +11 -3
- package/@types/router/state/state-object.d.ts +3 -5
- package/@types/router/state/state-queue-manager.d.ts +14 -8
- package/@types/router/state/state-registry.d.ts +12 -3
- package/@types/router/state/state-service.d.ts +8 -2
- package/@types/router/transition/hook-registry.d.ts +15 -5
- package/@types/router/transition/transition.d.ts +4 -2
- package/@types/router/url/url-rules.d.ts +3 -84
- package/@types/router/url/url-service.d.ts +9 -8
- package/@types/services/cookie/cookie.d.ts +3 -11
- package/@types/services/http/http.d.ts +6 -31
- package/@types/services/http/interface.d.ts +22 -7
- package/@types/services/location/location.d.ts +14 -13
- package/@types/services/sce/interface.d.ts +25 -0
- package/@types/services/sse/interface.d.ts +8 -1
- package/@types/services/sse/sse.d.ts +10 -18
- package/@types/services/storage/storage.d.ts +6 -6
- package/@types/services/stream/interface.d.ts +1 -1
- package/@types/services/stream/stream.d.ts +98 -0
- package/@types/services/template-request/interface.d.ts +2 -9
- package/@types/services/template-request/template-request.d.ts +7 -40
- package/@types/shared/common.d.ts +2 -2
- package/@types/shared/dom.d.ts +21 -42
- package/@types/shared/hof.d.ts +27 -37
- package/@types/shared/noderef.d.ts +2 -2
- package/@types/shared/strings.d.ts +13 -4
- package/@types/shared/utils.d.ts +123 -76
- package/@types/shared/validate.d.ts +7 -0
- package/dist/angular-ts.esm.js +1129 -1407
- package/dist/angular-ts.umd.js +1129 -1407
- package/dist/angular-ts.umd.min.js +1 -1
- package/dist/angular-ts.umd.min.js.gz +0 -0
- package/dist/angular-ts.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/@types/router/state-filters.d.ts +0 -39
- package/@types/shared/cache.d.ts +0 -7
package/dist/angular-ts.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Version: 0.15.
|
|
1
|
+
/* Version: 0.15.2 - December 24, 2025 03:47:35 */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
@@ -108,14 +108,14 @@
|
|
|
108
108
|
// via the forEach method when constructing the JQLite object in the first place
|
|
109
109
|
if (isArray(obj) || obj instanceof Array || isString(obj)) return true;
|
|
110
110
|
|
|
111
|
-
const len = /** @type {
|
|
111
|
+
const len = /** @type {ArrayLike<any>} */ (obj).length;
|
|
112
112
|
|
|
113
113
|
// NodeList objects (with `item` method) and
|
|
114
114
|
// other objects with suitable length characteristics are array-like
|
|
115
115
|
return (
|
|
116
116
|
isNumber(len) &&
|
|
117
117
|
((len >= 0 && len - 1 in /** @type {Object} */ (obj)) ||
|
|
118
|
-
typeof (/** @type {
|
|
118
|
+
typeof (/** @type {NodeList} */ (obj).item) === "function")
|
|
119
119
|
);
|
|
120
120
|
}
|
|
121
121
|
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
* @param {new (...args: any[]) => T} type The constructor to test against
|
|
156
156
|
* @returns {val is T}
|
|
157
157
|
*/
|
|
158
|
-
function
|
|
158
|
+
function isInstanceOf(val, type) {
|
|
159
159
|
return val instanceof type;
|
|
160
160
|
}
|
|
161
161
|
|
|
@@ -174,8 +174,7 @@
|
|
|
174
174
|
|
|
175
175
|
/**
|
|
176
176
|
* Determines if a reference is a `string`.
|
|
177
|
-
*
|
|
178
|
-
* @param value - The value to check.
|
|
177
|
+
* @param {unknown} value - The value to check.
|
|
179
178
|
* @returns {value is string} True if `value` is a string.
|
|
180
179
|
*/
|
|
181
180
|
function isString(value) {
|
|
@@ -288,7 +287,7 @@
|
|
|
288
287
|
* @returns {obj is Window} True if `obj` is a window obj.
|
|
289
288
|
*/
|
|
290
289
|
function isWindow(obj) {
|
|
291
|
-
return
|
|
290
|
+
return isInstanceOf(obj, Window);
|
|
292
291
|
}
|
|
293
292
|
|
|
294
293
|
/**
|
|
@@ -347,25 +346,30 @@
|
|
|
347
346
|
return isString(value) ? value.trim() : value;
|
|
348
347
|
}
|
|
349
348
|
|
|
349
|
+
/**
|
|
350
|
+
* @param {string} name
|
|
351
|
+
* @param {string} separator
|
|
352
|
+
*/
|
|
350
353
|
function snakeCase(name, separator) {
|
|
351
354
|
const modseparator = separator;
|
|
352
355
|
|
|
353
356
|
return name.replace(
|
|
354
357
|
/[A-Z]/g,
|
|
355
|
-
(
|
|
358
|
+
(/** @type {string} */ letter, /** @type {any} */ pos) =>
|
|
359
|
+
(pos ? modseparator : "") + letter.toLowerCase(),
|
|
356
360
|
);
|
|
357
361
|
}
|
|
358
362
|
|
|
359
363
|
/**
|
|
360
364
|
* Set or clear the hashkey for an object.
|
|
361
|
-
* @param obj object
|
|
362
|
-
* @param hashkey the hashkey (!truthy to delete the hashkey)
|
|
365
|
+
* @param {{ [x: string]: any; _hashKey?: any; }} obj object
|
|
366
|
+
* @param {any} hashkey the hashkey (!truthy to delete the hashkey)
|
|
363
367
|
*/
|
|
364
368
|
function setHashKey(obj, hashkey) {
|
|
365
369
|
if (hashkey) {
|
|
366
|
-
obj
|
|
370
|
+
obj._hashKey = hashkey;
|
|
367
371
|
} else {
|
|
368
|
-
delete obj
|
|
372
|
+
delete obj._hashKey;
|
|
369
373
|
}
|
|
370
374
|
}
|
|
371
375
|
|
|
@@ -380,7 +384,7 @@
|
|
|
380
384
|
* @returns {Object<string, any>} The extended destination object.
|
|
381
385
|
*/
|
|
382
386
|
function baseExtend(dst, objs, deep = false) {
|
|
383
|
-
const hasKey = dst
|
|
387
|
+
const hasKey = dst._hashKey;
|
|
384
388
|
|
|
385
389
|
for (let i = 0, ii = objs.length; i < ii; ++i) {
|
|
386
390
|
const obj = objs[i];
|
|
@@ -447,6 +451,10 @@
|
|
|
447
451
|
return extend(Object.create(parent), extra);
|
|
448
452
|
}
|
|
449
453
|
|
|
454
|
+
/**
|
|
455
|
+
* @param {{ toString: () => string; }} obj
|
|
456
|
+
* @returns {boolean}
|
|
457
|
+
*/
|
|
450
458
|
function hasCustomToString(obj) {
|
|
451
459
|
return isFunction(obj.toString) && obj.toString !== toString;
|
|
452
460
|
}
|
|
@@ -457,12 +465,16 @@
|
|
|
457
465
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/nodeName)
|
|
458
466
|
*
|
|
459
467
|
* @param {Element} element
|
|
460
|
-
* @returns
|
|
468
|
+
* @returns {string}
|
|
461
469
|
*/
|
|
462
470
|
function getNodeName(element) {
|
|
463
471
|
return lowercase(element.nodeName);
|
|
464
472
|
}
|
|
465
473
|
|
|
474
|
+
/**
|
|
475
|
+
* @param {any} array
|
|
476
|
+
* @param {string} obj
|
|
477
|
+
*/
|
|
466
478
|
function includes(array, obj) {
|
|
467
479
|
return Array.prototype.indexOf.call(array, obj) !== -1;
|
|
468
480
|
}
|
|
@@ -485,6 +497,10 @@
|
|
|
485
497
|
return index;
|
|
486
498
|
}
|
|
487
499
|
|
|
500
|
+
/**
|
|
501
|
+
* @param {unknown} val1
|
|
502
|
+
* @param {unknown} val2
|
|
503
|
+
*/
|
|
488
504
|
function simpleCompare(val1, val2) {
|
|
489
505
|
return val1 === val2 || (Number.isNaN(val1) && Number.isNaN(val2));
|
|
490
506
|
}
|
|
@@ -639,6 +655,10 @@
|
|
|
639
655
|
}
|
|
640
656
|
}
|
|
641
657
|
|
|
658
|
+
/**
|
|
659
|
+
* @param {unknown} value
|
|
660
|
+
* @returns {string | unknown}
|
|
661
|
+
*/
|
|
642
662
|
function stringify$1(value) {
|
|
643
663
|
if (isNull(value) || isUndefined(value)) {
|
|
644
664
|
return "";
|
|
@@ -650,10 +670,14 @@
|
|
|
650
670
|
value = `${value}`;
|
|
651
671
|
break;
|
|
652
672
|
default:
|
|
653
|
-
if (
|
|
654
|
-
|
|
673
|
+
if (
|
|
674
|
+
hasCustomToString(/** @type {Object} */ (value)) &&
|
|
675
|
+
!isArray(value) &&
|
|
676
|
+
!isDate(value)
|
|
677
|
+
) {
|
|
678
|
+
value = /** @type {Object} */ (value).toString();
|
|
655
679
|
} else {
|
|
656
|
-
value = toJson(value);
|
|
680
|
+
value = toJson(/** @type {any[]} */ (value));
|
|
657
681
|
}
|
|
658
682
|
}
|
|
659
683
|
|
|
@@ -668,10 +692,19 @@
|
|
|
668
692
|
return isNumber(maxDepth) && maxDepth > 0;
|
|
669
693
|
}
|
|
670
694
|
|
|
695
|
+
/**
|
|
696
|
+
* @param {any[]} array1
|
|
697
|
+
* @param {IArguments | any[] | NodeListOf<ChildNode>} array2
|
|
698
|
+
* @param {number | undefined} [index]
|
|
699
|
+
*/
|
|
671
700
|
function concat(array1, array2, index) {
|
|
672
701
|
return array1.concat(Array.prototype.slice.call(array2, index));
|
|
673
702
|
}
|
|
674
703
|
|
|
704
|
+
/**
|
|
705
|
+
* @param {IArguments | [string, ...any[]]} args
|
|
706
|
+
* @param {number} startIndex
|
|
707
|
+
*/
|
|
675
708
|
function sliceArgs(args, startIndex) {
|
|
676
709
|
return Array.prototype.slice.call(args, startIndex);
|
|
677
710
|
}
|
|
@@ -707,6 +740,10 @@
|
|
|
707
740
|
return fn;
|
|
708
741
|
}
|
|
709
742
|
|
|
743
|
+
/**
|
|
744
|
+
* @param {string} key
|
|
745
|
+
* @param {unknown} value
|
|
746
|
+
*/
|
|
710
747
|
function toJsonReplacer(key, value) {
|
|
711
748
|
let val = value;
|
|
712
749
|
|
|
@@ -728,93 +765,44 @@
|
|
|
728
765
|
}
|
|
729
766
|
|
|
730
767
|
/**
|
|
731
|
-
* Serializes input into a JSON-formatted string. Properties with leading
|
|
732
|
-
* stripped since AngularTS uses this notation internally.
|
|
733
|
-
*
|
|
734
|
-
* @param {Object|Array|Date|string|number|boolean} obj Input to be serialized into JSON.
|
|
735
|
-
* @param {boolean|number} [pretty=2] If set to true, the JSON output will contain newlines and whitespace.
|
|
736
|
-
* If set to an integer, the JSON output will contain that many spaces per indentation.
|
|
737
|
-
* @returns {string|undefined} JSON-ified string representing `obj`.
|
|
738
|
-
* @knownIssue
|
|
768
|
+
* Serializes input into a JSON-formatted string. Properties with leading `$$` characters
|
|
769
|
+
* will be stripped since AngularTS uses this notation internally.
|
|
739
770
|
*
|
|
740
|
-
*
|
|
741
|
-
*
|
|
742
|
-
*
|
|
743
|
-
*
|
|
744
|
-
*
|
|
745
|
-
*
|
|
746
|
-
*
|
|
747
|
-
* try {
|
|
748
|
-
* return _DatetoJSON.call(this);
|
|
749
|
-
* } catch(e) {
|
|
750
|
-
* if (e instanceof RangeError) {
|
|
751
|
-
* return null;
|
|
752
|
-
* }
|
|
753
|
-
* throw e;
|
|
754
|
-
* }
|
|
755
|
-
* };
|
|
756
|
-
* ```
|
|
757
|
-
*
|
|
758
|
-
* See https://github.com/angular/angular.js/pull/14221 for more information.
|
|
771
|
+
* @param {Object|Array<any>|Date|string|number|boolean} obj
|
|
772
|
+
* Input to be serialized into JSON.
|
|
773
|
+
* @param {boolean|number} [pretty=2]
|
|
774
|
+
* If `true`, the JSON output will contain newlines and whitespace (2 spaces).
|
|
775
|
+
* If a number, the JSON output will contain that many spaces per indentation.
|
|
776
|
+
* @returns {string|undefined}
|
|
777
|
+
* JSON-ified string representing `obj`, or `undefined` if `obj` is undefined.
|
|
759
778
|
*/
|
|
760
779
|
function toJson(obj, pretty) {
|
|
761
780
|
if (isUndefined(obj)) return undefined;
|
|
762
781
|
|
|
763
782
|
if (!isNumber(pretty)) {
|
|
764
|
-
pretty = pretty ? 2 :
|
|
783
|
+
pretty = pretty ? 2 : undefined;
|
|
765
784
|
}
|
|
766
785
|
|
|
767
|
-
return JSON.stringify(obj, toJsonReplacer, /** @type {
|
|
786
|
+
return JSON.stringify(obj, toJsonReplacer, /** @type {number} */ (pretty));
|
|
768
787
|
}
|
|
769
788
|
|
|
770
789
|
/**
|
|
771
790
|
* Deserializes a JSON string.
|
|
772
791
|
*
|
|
773
792
|
* @param {string} json JSON string to deserialize.
|
|
774
|
-
* @returns {Object|Array
|
|
793
|
+
* @returns {Object|Array<any>|string|number} Deserialized JSON string.
|
|
775
794
|
*/
|
|
776
795
|
function fromJson(json) {
|
|
777
796
|
return isString(json) ? JSON.parse(json) : json;
|
|
778
797
|
}
|
|
779
798
|
|
|
780
|
-
const MS_PER_MINUTE = 60_000; // 60,000 ms in a minute
|
|
781
|
-
|
|
782
|
-
function timezoneToOffset(timezone, fallback) {
|
|
783
|
-
const requestedTimezoneOffset =
|
|
784
|
-
Date.parse(`Jan 01, 1970 00:00:00 ${timezone}`) / MS_PER_MINUTE;
|
|
785
|
-
|
|
786
|
-
return isNumberNaN(requestedTimezoneOffset)
|
|
787
|
-
? fallback
|
|
788
|
-
: requestedTimezoneOffset;
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
function addDateMinutes(date, minutes) {
|
|
792
|
-
const newDate = new Date(date.getTime());
|
|
793
|
-
|
|
794
|
-
newDate.setMinutes(newDate.getMinutes() + minutes);
|
|
795
|
-
|
|
796
|
-
return newDate;
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
function convertTimezoneToLocal(date, timezone, reverse) {
|
|
800
|
-
const doReverse = 1;
|
|
801
|
-
|
|
802
|
-
const dateTimezoneOffset = date.getTimezoneOffset();
|
|
803
|
-
|
|
804
|
-
const timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
|
|
805
|
-
|
|
806
|
-
return addDateMinutes(
|
|
807
|
-
date,
|
|
808
|
-
doReverse * (timezoneOffset - dateTimezoneOffset),
|
|
809
|
-
);
|
|
810
|
-
}
|
|
811
|
-
|
|
812
799
|
/**
|
|
813
800
|
* Parses an escaped url query string into key-value pairs.
|
|
814
801
|
* @param {string} keyValue
|
|
815
|
-
* @returns {Object.<string,boolean|Array
|
|
802
|
+
* @returns {Object.<string,boolean|Array<any>>}
|
|
816
803
|
*/
|
|
817
804
|
function parseKeyValue(keyValue) {
|
|
805
|
+
/** @type {Record<string, boolean | string | Array<any>>} */
|
|
818
806
|
const obj = {};
|
|
819
807
|
|
|
820
808
|
(keyValue || "").split("&").forEach((item) => {
|
|
@@ -838,9 +826,9 @@
|
|
|
838
826
|
val = isDefined(val) ? tryDecodeURIComponent(val) : true;
|
|
839
827
|
|
|
840
828
|
if (!hasOwn(obj, /** @type {string} */ (key))) {
|
|
841
|
-
obj[key] = val;
|
|
829
|
+
obj[key] = /** @type {string } */ (val);
|
|
842
830
|
} else if (isArray(obj[key])) {
|
|
843
|
-
obj[key].push(val);
|
|
831
|
+
/** @type {Array<any>} */ (obj[key]).push(val);
|
|
844
832
|
} else {
|
|
845
833
|
obj[key] = [obj[key], val];
|
|
846
834
|
}
|
|
@@ -848,10 +836,16 @@
|
|
|
848
836
|
}
|
|
849
837
|
});
|
|
850
838
|
|
|
851
|
-
return /** @type {Object.<string,boolean|Array
|
|
839
|
+
return /** @type {Object.<string,boolean|Array<any>>} */ (obj);
|
|
852
840
|
}
|
|
853
841
|
|
|
842
|
+
/**
|
|
843
|
+
* @param {string | { [s: string]: any; } | ArrayLike<any> | null} obj
|
|
844
|
+
*/
|
|
854
845
|
function toKeyValue(obj) {
|
|
846
|
+
/**
|
|
847
|
+
* @type {string[]}
|
|
848
|
+
*/
|
|
855
849
|
const parts = [];
|
|
856
850
|
|
|
857
851
|
obj &&
|
|
@@ -919,6 +913,8 @@
|
|
|
919
913
|
* pct-encoded = "%" HEXDIG HEXDIG
|
|
920
914
|
* sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
|
|
921
915
|
* / "*" / "+" / "," / ";" / "="
|
|
916
|
+
* @param {string | number | boolean} val
|
|
917
|
+
* @param {boolean | undefined} [pctEncodeSpaces]
|
|
922
918
|
*/
|
|
923
919
|
function encodeUriQuery(val, pctEncodeSpaces) {
|
|
924
920
|
return encodeURIComponent(val)
|
|
@@ -933,28 +929,39 @@
|
|
|
933
929
|
const ngAttrPrefixes = ["ng-", "data-ng-"];
|
|
934
930
|
|
|
935
931
|
/**
|
|
936
|
-
* Creates a shallow copy of an object, an array or
|
|
932
|
+
* Creates a shallow copy of an object, an array, or returns primitives as-is.
|
|
933
|
+
*
|
|
934
|
+
* Assumes there are no proto properties.
|
|
937
935
|
*
|
|
938
|
-
*
|
|
936
|
+
* @template T
|
|
937
|
+
* @param {T} src
|
|
938
|
+
* @param {T extends any[] ? T : Record<string, unknown>} [dst]
|
|
939
|
+
* @returns {T}
|
|
939
940
|
*/
|
|
940
941
|
function shallowCopy(src, dst) {
|
|
941
942
|
if (isArray(src)) {
|
|
942
|
-
|
|
943
|
+
/** @type {any[]} */
|
|
944
|
+
const out = /** @type {any[]} */ (dst) || [];
|
|
943
945
|
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
|
|
946
|
+
out.push(...src);
|
|
947
|
+
|
|
948
|
+
return /** @type {T} */ (out);
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
if (isObject(src)) {
|
|
952
|
+
const out = /** @type {Record<string, unknown>} */ (dst) || {};
|
|
949
953
|
|
|
950
954
|
for (const key in src) {
|
|
951
|
-
|
|
952
|
-
|
|
955
|
+
// Copy all properties except $$-prefixed
|
|
956
|
+
if (!key.startsWith("$$")) {
|
|
957
|
+
out[key] = src[key];
|
|
953
958
|
}
|
|
954
959
|
}
|
|
960
|
+
|
|
961
|
+
return /** @type {T} */ (out);
|
|
955
962
|
}
|
|
956
963
|
|
|
957
|
-
return
|
|
964
|
+
return src;
|
|
958
965
|
}
|
|
959
966
|
|
|
960
967
|
/**
|
|
@@ -970,6 +977,9 @@
|
|
|
970
977
|
|
|
971
978
|
/**
|
|
972
979
|
* Throw error if the argument is falsy.
|
|
980
|
+
* @param {string | boolean | Object} arg
|
|
981
|
+
* @param {string} name
|
|
982
|
+
* @param {string | undefined} [reason]
|
|
973
983
|
*/
|
|
974
984
|
function assertArg(arg, name, reason) {
|
|
975
985
|
if (!arg) {
|
|
@@ -984,6 +994,11 @@
|
|
|
984
994
|
return arg;
|
|
985
995
|
}
|
|
986
996
|
|
|
997
|
+
/**
|
|
998
|
+
* @param {string | Function | any[]} arg
|
|
999
|
+
* @param {string} name
|
|
1000
|
+
* @param {boolean | undefined} [acceptArrayAnnotation]
|
|
1001
|
+
*/
|
|
987
1002
|
function assertArgFn(arg, name, acceptArrayAnnotation) {
|
|
988
1003
|
if (acceptArrayAnnotation && isArray(arg)) {
|
|
989
1004
|
arg = arg[arg.length - 1];
|
|
@@ -1071,7 +1086,7 @@
|
|
|
1071
1086
|
|
|
1072
1087
|
const templateArgs = sliceArgs(args, 2).map((arg) => toDebugString(arg));
|
|
1073
1088
|
|
|
1074
|
-
message += template.replace(/\{\d+\}/g, (match) => {
|
|
1089
|
+
message += template.replace(/\{\d+\}/g, (/** @type {string} */ match) => {
|
|
1075
1090
|
const index = +match.slice(1, -1);
|
|
1076
1091
|
|
|
1077
1092
|
if (index < templateArgs.length) {
|
|
@@ -1130,19 +1145,19 @@
|
|
|
1130
1145
|
* Hash of a:
|
|
1131
1146
|
* string is string
|
|
1132
1147
|
* number is number as string
|
|
1133
|
-
* object is either result of calling
|
|
1134
|
-
* that is also assigned to the
|
|
1148
|
+
* object is either result of calling _hashKey function on the object or uniquely generated id,
|
|
1149
|
+
* that is also assigned to the _hashKey property of the object.
|
|
1135
1150
|
*
|
|
1136
1151
|
* @param {*} obj
|
|
1137
1152
|
* @returns {string} hash string such that the same input will have the same hash string.
|
|
1138
1153
|
* The resulting string key is in 'type:hashKey' format.
|
|
1139
1154
|
*/
|
|
1140
1155
|
function hashKey(obj) {
|
|
1141
|
-
const key = obj && obj
|
|
1156
|
+
const key = obj && obj._hashKey;
|
|
1142
1157
|
|
|
1143
1158
|
if (key) {
|
|
1144
1159
|
if (typeof key === "function") {
|
|
1145
|
-
return obj
|
|
1160
|
+
return obj._hashKey();
|
|
1146
1161
|
}
|
|
1147
1162
|
|
|
1148
1163
|
return key;
|
|
@@ -1151,9 +1166,9 @@
|
|
|
1151
1166
|
const objType = typeof obj;
|
|
1152
1167
|
|
|
1153
1168
|
if (objType === "function" || (objType === "object" && obj !== null)) {
|
|
1154
|
-
obj
|
|
1169
|
+
obj._hashKey = `${objType}:${nextUid()}`;
|
|
1155
1170
|
|
|
1156
|
-
return obj
|
|
1171
|
+
return obj._hashKey;
|
|
1157
1172
|
}
|
|
1158
1173
|
|
|
1159
1174
|
if (objType === "undefined") {
|
|
@@ -1415,14 +1430,6 @@
|
|
|
1415
1430
|
return typeof fn === "function" && !fn.prototype;
|
|
1416
1431
|
}
|
|
1417
1432
|
|
|
1418
|
-
/**
|
|
1419
|
-
* Expando cache for adding properties to DOM nodes with JavaScript.
|
|
1420
|
-
* This used to be an Object in JQLite decorator, but swapped out for a Map
|
|
1421
|
-
*
|
|
1422
|
-
* @type {Map<number, import('../interface.ts').ExpandoStore>}
|
|
1423
|
-
*/
|
|
1424
|
-
const Cache = new Map();
|
|
1425
|
-
|
|
1426
1433
|
const ADD_CLASS_SUFFIX = "-add";
|
|
1427
1434
|
const REMOVE_CLASS_SUFFIX = "-remove";
|
|
1428
1435
|
const EVENT_CLASS_PREFIX = "ng-";
|
|
@@ -1849,10 +1856,18 @@
|
|
|
1849
1856
|
|
|
1850
1857
|
const EXPANDO = "ng";
|
|
1851
1858
|
|
|
1859
|
+
/**
|
|
1860
|
+
* Expando cache for adding properties to DOM nodes with JavaScript.
|
|
1861
|
+
* This used to be an Object in JQLite decorator, but swapped out for a Map
|
|
1862
|
+
*
|
|
1863
|
+
* @type {Map<number, import('../interface.ts').ExpandoStore>}
|
|
1864
|
+
*/
|
|
1865
|
+
const Cache = new Map();
|
|
1866
|
+
|
|
1852
1867
|
/**
|
|
1853
1868
|
* Key for storing scope data, attached to an element
|
|
1854
1869
|
*/
|
|
1855
|
-
const SCOPE_KEY =
|
|
1870
|
+
const SCOPE_KEY = $injectTokens._scope;
|
|
1856
1871
|
|
|
1857
1872
|
const DASH_LOWERCASE_REGEXP = /-([a-z])/g;
|
|
1858
1873
|
|
|
@@ -2295,7 +2310,7 @@
|
|
|
2295
2310
|
/**
|
|
2296
2311
|
* Return the DOM siblings between the first and last node in the given array.
|
|
2297
2312
|
* @param {Array<Node>} nodes An array-like object
|
|
2298
|
-
* @returns {
|
|
2313
|
+
* @returns {*[]|Array<Node>} the inputted object or a JQLite collection containing the nodes
|
|
2299
2314
|
*/
|
|
2300
2315
|
function getBlockNodes(nodes) {
|
|
2301
2316
|
// TODO(perf): update `nodes` instead of creating a new object?
|
|
@@ -2405,7 +2420,7 @@
|
|
|
2405
2420
|
* @param {HTMLElement | Element} parentElement
|
|
2406
2421
|
* The parent element that will receive the inserted element.
|
|
2407
2422
|
*
|
|
2408
|
-
* @param {
|
|
2423
|
+
* @param {ChildNode | Element | null} [afterElement]
|
|
2409
2424
|
* An optional sibling element — if present and valid, `element`
|
|
2410
2425
|
* will be inserted after it. If omitted or invalid, `element`
|
|
2411
2426
|
* is prepended to `parentElement`.
|
|
@@ -2431,6 +2446,11 @@
|
|
|
2431
2446
|
}
|
|
2432
2447
|
}
|
|
2433
2448
|
|
|
2449
|
+
/**
|
|
2450
|
+
* @param {HTMLElement} element
|
|
2451
|
+
* @param {HTMLElement} parent
|
|
2452
|
+
* @param {ChildNode | null | undefined} after
|
|
2453
|
+
*/
|
|
2434
2454
|
function animatedomInsert(element, parent, after) {
|
|
2435
2455
|
const originalVisibility = element.style.visibility;
|
|
2436
2456
|
|
|
@@ -2798,11 +2818,11 @@
|
|
|
2798
2818
|
* Creates a proxy that automatically persists an object's state
|
|
2799
2819
|
* into a storage backend whenever a property is set.
|
|
2800
2820
|
*
|
|
2801
|
-
* @param {
|
|
2821
|
+
* @param {Record<PropertyKey, any>} target - The object to wrap
|
|
2802
2822
|
* @param {string} key - The storage key
|
|
2803
|
-
* @param {
|
|
2823
|
+
* @param {import("../../core/di/inteface").StorageLike & import("../../core/di/inteface").PersistentStoreConfig} storage - Any storage-like object with getItem/setItem/removeItem
|
|
2804
2824
|
* @param {{serialize?: function, deserialize?: function}} [options] - Optional custom (de)serialization
|
|
2805
|
-
* @returns {
|
|
2825
|
+
* @returns {Record<PropertyKey, any>}
|
|
2806
2826
|
*/
|
|
2807
2827
|
function createPersistentProxy(target, key, storage, options = {}) {
|
|
2808
2828
|
const serialize = options.serialize || JSON.stringify;
|
|
@@ -2868,7 +2888,6 @@
|
|
|
2868
2888
|
}
|
|
2869
2889
|
|
|
2870
2890
|
const BADARG = "badarg";
|
|
2871
|
-
const BADARGVALUE = "badarg: value";
|
|
2872
2891
|
|
|
2873
2892
|
/** @type {Map<ng.Validator, string>} */
|
|
2874
2893
|
const reasons = new Map([
|
|
@@ -2971,6 +2990,25 @@
|
|
|
2971
2990
|
/** @type {Map<String|Function, boolean>} */
|
|
2972
2991
|
const loadedModules = new Map(); // Keep track of loaded modules to avoid circular dependencies
|
|
2973
2992
|
|
|
2993
|
+
/**
|
|
2994
|
+
* @typedef {{
|
|
2995
|
+
* $provide: {
|
|
2996
|
+
* provider: Function,
|
|
2997
|
+
* factory: Function,
|
|
2998
|
+
* service: Function,
|
|
2999
|
+
* value: Function,
|
|
3000
|
+
* constant: Function,
|
|
3001
|
+
* store: Function,
|
|
3002
|
+
* decorator: Function,
|
|
3003
|
+
* },
|
|
3004
|
+
* $injectorProvider?: {
|
|
3005
|
+
* $get: () => unknown
|
|
3006
|
+
* },
|
|
3007
|
+
* $injector?: ProviderInjector
|
|
3008
|
+
* }} ProviderCache
|
|
3009
|
+
*/
|
|
3010
|
+
|
|
3011
|
+
/** @type {ProviderCache} */
|
|
2974
3012
|
const providerCache = {
|
|
2975
3013
|
$provide: {
|
|
2976
3014
|
provider: supportObject(provider),
|
|
@@ -3127,12 +3165,11 @@
|
|
|
3127
3165
|
* Registers a service persisted in a storage
|
|
3128
3166
|
*
|
|
3129
3167
|
* @param {string} name - Service name
|
|
3130
|
-
* @param {
|
|
3168
|
+
* @param {import("../../interface.ts").Constructor} ctor - Constructor for the service
|
|
3131
3169
|
* @param {ng.StorageType} type - Type of storage to be instantiated
|
|
3132
|
-
* @param {
|
|
3133
|
-
* with { backend, serialize, deserialize }
|
|
3170
|
+
* @param {import("./inteface.ts").StorageLike & import("./inteface.ts").PersistentStoreConfig} [backendOrConfig]
|
|
3134
3171
|
*/
|
|
3135
|
-
function store(name, ctor, type, backendOrConfig
|
|
3172
|
+
function store(name, ctor, type, backendOrConfig) {
|
|
3136
3173
|
return provider(name, {
|
|
3137
3174
|
$get: /** @param {ng.InjectorService} $injector */ ($injector) => {
|
|
3138
3175
|
switch (type) {
|
|
@@ -3151,11 +3188,11 @@
|
|
|
3151
3188
|
|
|
3152
3189
|
const $cookie = $injector.get($injectTokens._cookie);
|
|
3153
3190
|
|
|
3154
|
-
const serialize = backendOrConfig
|
|
3191
|
+
const serialize = backendOrConfig?.serialize ?? JSON.stringify;
|
|
3155
3192
|
|
|
3156
|
-
const deserialize = backendOrConfig
|
|
3193
|
+
const deserialize = backendOrConfig?.deserialize ?? JSON.parse;
|
|
3157
3194
|
|
|
3158
|
-
const cookieOpts = backendOrConfig
|
|
3195
|
+
const cookieOpts = backendOrConfig?.cookie ?? {};
|
|
3159
3196
|
|
|
3160
3197
|
return createPersistentProxy(instance, name, {
|
|
3161
3198
|
getItem(key) {
|
|
@@ -3205,10 +3242,15 @@
|
|
|
3205
3242
|
backend = localStorage;
|
|
3206
3243
|
}
|
|
3207
3244
|
|
|
3208
|
-
return createPersistentProxy(
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3245
|
+
return createPersistentProxy(
|
|
3246
|
+
instance,
|
|
3247
|
+
name,
|
|
3248
|
+
/** @type {import("./inteface.ts").StorageLike} */ (backend),
|
|
3249
|
+
{
|
|
3250
|
+
serialize,
|
|
3251
|
+
deserialize,
|
|
3252
|
+
},
|
|
3253
|
+
);
|
|
3212
3254
|
}
|
|
3213
3255
|
}
|
|
3214
3256
|
|
|
@@ -3685,7 +3727,7 @@
|
|
|
3685
3727
|
*
|
|
3686
3728
|
* - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the
|
|
3687
3729
|
* XSRF token. Defaults value is `'X-XSRF-TOKEN'`.
|
|
3688
|
-
*
|
|
3730
|
+
* @type {import("./interface.ts").HttpProviderDefaults}
|
|
3689
3731
|
*/
|
|
3690
3732
|
const defaults = (this.defaults = {
|
|
3691
3733
|
// transform incoming response data
|
|
@@ -3754,6 +3796,7 @@
|
|
|
3754
3796
|
* array, on request, but reverse order, on response.
|
|
3755
3797
|
*
|
|
3756
3798
|
* {@link ng.$http#interceptors Interceptors detailed info}
|
|
3799
|
+
* @type {Array<string | ng.Injectable<import("./interface.ts").HttpInterceptorFactory>>}
|
|
3757
3800
|
*/
|
|
3758
3801
|
this.interceptors = [];
|
|
3759
3802
|
|
|
@@ -3797,19 +3840,6 @@
|
|
|
3797
3840
|
*/
|
|
3798
3841
|
this.xsrfTrustedOrigins = [];
|
|
3799
3842
|
|
|
3800
|
-
/**
|
|
3801
|
-
* This property is deprecated. Use {@link $httpProvider#xsrfTrustedOrigins xsrfTrustedOrigins}
|
|
3802
|
-
* instead.
|
|
3803
|
-
*/
|
|
3804
|
-
Object.defineProperty(this, "xsrfWhitelistedOrigins", {
|
|
3805
|
-
get() {
|
|
3806
|
-
return this.xsrfTrustedOrigins;
|
|
3807
|
-
},
|
|
3808
|
-
set(origins) {
|
|
3809
|
-
this.xsrfTrustedOrigins = origins;
|
|
3810
|
-
},
|
|
3811
|
-
});
|
|
3812
|
-
|
|
3813
3843
|
const that = this;
|
|
3814
3844
|
|
|
3815
3845
|
this.$get = [
|
|
@@ -4694,14 +4724,14 @@
|
|
|
4694
4724
|
* @param {import("./interface.ts").SwapModeType} swap
|
|
4695
4725
|
* @param {ng.Scope} scopeParam
|
|
4696
4726
|
* @param {ng.Attributes} attrsParam
|
|
4697
|
-
* @param {Element}
|
|
4727
|
+
* @param {Element} elementParam
|
|
4698
4728
|
*/
|
|
4699
4729
|
function handleSwapResponse(
|
|
4700
4730
|
html,
|
|
4701
4731
|
swap,
|
|
4702
4732
|
scopeParam,
|
|
4703
4733
|
attrsParam,
|
|
4704
|
-
|
|
4734
|
+
elementParam,
|
|
4705
4735
|
) {
|
|
4706
4736
|
let animationEnabled = false;
|
|
4707
4737
|
|
|
@@ -4724,7 +4754,7 @@
|
|
|
4724
4754
|
|
|
4725
4755
|
const target = targetSelector
|
|
4726
4756
|
? document.querySelector(targetSelector)
|
|
4727
|
-
:
|
|
4757
|
+
: elementParam;
|
|
4728
4758
|
|
|
4729
4759
|
if (!target) {
|
|
4730
4760
|
$log.warn(`${attrName}: target "${targetSelector}" not found`);
|
|
@@ -5685,14 +5715,14 @@
|
|
|
5685
5715
|
* @throws {Error} If the argument is invalid or cannot be wrapped properly.
|
|
5686
5716
|
*/
|
|
5687
5717
|
constructor(element) {
|
|
5688
|
-
/** @private @type {Node | ChildNode |
|
|
5689
|
-
this._node =
|
|
5718
|
+
/** @private @type {Node | ChildNode | undefined} */
|
|
5719
|
+
this._node = undefined;
|
|
5690
5720
|
|
|
5691
5721
|
/** @type {Element | undefined} */
|
|
5692
5722
|
this._element = undefined;
|
|
5693
5723
|
|
|
5694
|
-
/** @private @type {Array<Node>
|
|
5695
|
-
this._nodes =
|
|
5724
|
+
/** @private @type {Array<Node>} a stable list on nodes */
|
|
5725
|
+
this._nodes = [];
|
|
5696
5726
|
|
|
5697
5727
|
/** @type {boolean} */
|
|
5698
5728
|
this._isList = false;
|
|
@@ -5810,7 +5840,9 @@
|
|
|
5810
5840
|
if (this._isList) {
|
|
5811
5841
|
return this._nodes[0];
|
|
5812
5842
|
} else {
|
|
5813
|
-
return
|
|
5843
|
+
return /** @type {Element | Node | ChildNode} */ (
|
|
5844
|
+
this._element || this._node
|
|
5845
|
+
);
|
|
5814
5846
|
}
|
|
5815
5847
|
}
|
|
5816
5848
|
|
|
@@ -5819,7 +5851,9 @@
|
|
|
5819
5851
|
if (this._isList) {
|
|
5820
5852
|
return this._nodes;
|
|
5821
5853
|
} else {
|
|
5822
|
-
return
|
|
5854
|
+
return /** @type {Element | Node | ChildNode} */ (
|
|
5855
|
+
this._element || this._node
|
|
5856
|
+
);
|
|
5823
5857
|
}
|
|
5824
5858
|
}
|
|
5825
5859
|
|
|
@@ -5828,7 +5862,9 @@
|
|
|
5828
5862
|
if (this._isList) {
|
|
5829
5863
|
return Array.from(this._nodes);
|
|
5830
5864
|
} else {
|
|
5831
|
-
return [
|
|
5865
|
+
return [
|
|
5866
|
+
/** @type {Element | Node | ChildNode} */ (this._element || this._node),
|
|
5867
|
+
];
|
|
5832
5868
|
}
|
|
5833
5869
|
}
|
|
5834
5870
|
|
|
@@ -6984,10 +7020,29 @@
|
|
|
6984
7020
|
|
|
6985
7021
|
const specialAttrHolder = document.createElement("div");
|
|
6986
7022
|
|
|
7023
|
+
/**
|
|
7024
|
+
* @extends {Record<string, any>}
|
|
7025
|
+
*/
|
|
6987
7026
|
class Attributes {
|
|
6988
7027
|
static $nonscope = true;
|
|
6989
7028
|
|
|
6990
7029
|
/**
|
|
7030
|
+
* Creates an Attributes instance.
|
|
7031
|
+
*
|
|
7032
|
+
* There are two construction modes:
|
|
7033
|
+
*
|
|
7034
|
+
* 1. **Fresh instance** (no `attributesToCopy`):
|
|
7035
|
+
* - Used when compiling a DOM element for the first time.
|
|
7036
|
+
* - Initializes a new `$attr` map to track normalized → DOM attribute names.
|
|
7037
|
+
*
|
|
7038
|
+
* 2. **Clone instance** (`attributesToCopy` provided):
|
|
7039
|
+
* - Used when cloning attributes for directive linking / child scopes.
|
|
7040
|
+
* - Performs a shallow copy of all properties from the source Attributes object,
|
|
7041
|
+
* including `$attr`, normalized attribute values, and internal fields
|
|
7042
|
+
* (e.g. `$$observers`).
|
|
7043
|
+
* - `$attr` is intentionally **not reinitialized** in this case, because the
|
|
7044
|
+
* source object already contains the correct normalized → DOM attribute mapping.
|
|
7045
|
+
*
|
|
6991
7046
|
* @param {ng.AnimateService} $animate
|
|
6992
7047
|
* @param {ng.ExceptionHandlerService} $exceptionHandler
|
|
6993
7048
|
* @param {*} $sce
|
|
@@ -7008,16 +7063,20 @@
|
|
|
7008
7063
|
this[key] = attributesToCopy[key];
|
|
7009
7064
|
}
|
|
7010
7065
|
} else {
|
|
7066
|
+
/**
|
|
7067
|
+
* A map of DOM element attribute names to the normalized name. This is needed
|
|
7068
|
+
* to do reverse lookup from normalized name back to actual name.
|
|
7069
|
+
*/
|
|
7011
7070
|
this.$attr = {};
|
|
7012
7071
|
}
|
|
7013
7072
|
|
|
7014
7073
|
/** @type {import("../../shared/noderef.js").NodeRef} */
|
|
7015
|
-
this
|
|
7074
|
+
this._nodeRef = nodeRef;
|
|
7016
7075
|
}
|
|
7017
7076
|
|
|
7018
7077
|
/** @type {Node|Element} */
|
|
7019
7078
|
get $$element() {
|
|
7020
|
-
return this
|
|
7079
|
+
return this._nodeRef.node;
|
|
7021
7080
|
}
|
|
7022
7081
|
|
|
7023
7082
|
/**
|
|
@@ -7046,7 +7105,7 @@
|
|
|
7046
7105
|
classVal,
|
|
7047
7106
|
);
|
|
7048
7107
|
} else {
|
|
7049
|
-
this
|
|
7108
|
+
this._nodeRef.element.classList.add(classVal);
|
|
7050
7109
|
}
|
|
7051
7110
|
}
|
|
7052
7111
|
}
|
|
@@ -7065,7 +7124,7 @@
|
|
|
7065
7124
|
classVal,
|
|
7066
7125
|
);
|
|
7067
7126
|
} else {
|
|
7068
|
-
this
|
|
7127
|
+
this._nodeRef.element.classList.remove(classVal);
|
|
7069
7128
|
}
|
|
7070
7129
|
}
|
|
7071
7130
|
}
|
|
@@ -7084,7 +7143,7 @@
|
|
|
7084
7143
|
if (hasAnimate(this.$$element)) {
|
|
7085
7144
|
this._$animate.addClass(/** @type {Element }*/ (this.$$element), toAdd);
|
|
7086
7145
|
} else {
|
|
7087
|
-
this
|
|
7146
|
+
this._nodeRef.element.classList.add(...toAdd.trim().split(/\s+/));
|
|
7088
7147
|
}
|
|
7089
7148
|
}
|
|
7090
7149
|
const toRemove = tokenDifference(oldClasses, newClasses);
|
|
@@ -7096,7 +7155,7 @@
|
|
|
7096
7155
|
toRemove,
|
|
7097
7156
|
);
|
|
7098
7157
|
} else {
|
|
7099
|
-
this
|
|
7158
|
+
this._nodeRef.element.classList.remove(...toRemove.trim().split(/\s+/));
|
|
7100
7159
|
}
|
|
7101
7160
|
}
|
|
7102
7161
|
}
|
|
@@ -7144,7 +7203,7 @@
|
|
|
7144
7203
|
}
|
|
7145
7204
|
}
|
|
7146
7205
|
|
|
7147
|
-
const nodeName = this
|
|
7206
|
+
const nodeName = this._nodeRef.node.nodeName.toLowerCase();
|
|
7148
7207
|
|
|
7149
7208
|
let maybeSanitizedValue;
|
|
7150
7209
|
|
|
@@ -7205,6 +7264,7 @@
|
|
|
7205
7264
|
}
|
|
7206
7265
|
|
|
7207
7266
|
/**
|
|
7267
|
+
* @template T
|
|
7208
7268
|
* Observes an interpolated attribute.
|
|
7209
7269
|
*
|
|
7210
7270
|
* The observer function will be invoked once during the next `$digest` following
|
|
@@ -7212,11 +7272,11 @@
|
|
|
7212
7272
|
* changes.
|
|
7213
7273
|
*
|
|
7214
7274
|
* @param {string} key Normalized key. (ie ngAttribute) .
|
|
7215
|
-
* @param {any} fn Function that will be called whenever
|
|
7275
|
+
* @param {(value?: T) => any} fn Function that will be called whenever
|
|
7216
7276
|
the interpolated value of the attribute changes.
|
|
7217
7277
|
* See the {@link guide/interpolation#how-text-and-attribute-bindings-work Interpolation
|
|
7218
7278
|
* guide} for more info.
|
|
7219
|
-
* @returns {
|
|
7279
|
+
* @returns {Function} Returns a deregistration function for this observer.
|
|
7220
7280
|
*/
|
|
7221
7281
|
$observe(key, fn) {
|
|
7222
7282
|
const $$observers =
|
|
@@ -8370,7 +8430,7 @@
|
|
|
8370
8430
|
* @param {Attributes|any} attrs The shared attrs object which is used to populate the normalized attributes.
|
|
8371
8431
|
* @param {number=} maxPriority Max directive priority.
|
|
8372
8432
|
* @param {string} [ignoreDirective]
|
|
8373
|
-
* @return {
|
|
8433
|
+
* @return {ng.Directive[]} An array to which the directives are added to. This array is sorted before the function returns.
|
|
8374
8434
|
*/
|
|
8375
8435
|
function collectDirectives(node, attrs, maxPriority, ignoreDirective) {
|
|
8376
8436
|
/**
|
|
@@ -8621,7 +8681,7 @@
|
|
|
8621
8681
|
|
|
8622
8682
|
const { index } = previousCompileContext;
|
|
8623
8683
|
|
|
8624
|
-
templateAttrs
|
|
8684
|
+
templateAttrs._nodeRef = compileNodeRef;
|
|
8625
8685
|
let directive;
|
|
8626
8686
|
|
|
8627
8687
|
let directiveName;
|
|
@@ -8672,7 +8732,7 @@
|
|
|
8672
8732
|
|
|
8673
8733
|
if (compileNode === linkNode) {
|
|
8674
8734
|
attrs = templateAttrs;
|
|
8675
|
-
$element = templateAttrs
|
|
8735
|
+
$element = templateAttrs._nodeRef;
|
|
8676
8736
|
} else {
|
|
8677
8737
|
$element = new NodeRef(linkNode);
|
|
8678
8738
|
attrs = new Attributes(
|
|
@@ -9098,7 +9158,7 @@
|
|
|
9098
9158
|
terminalPriority = directive.priority;
|
|
9099
9159
|
$template = compileNodeRef;
|
|
9100
9160
|
compileNodeRef = new NodeRef(document.createComment(""));
|
|
9101
|
-
templateAttrs
|
|
9161
|
+
templateAttrs._nodeRef = compileNodeRef;
|
|
9102
9162
|
compileNode = compileNodeRef.node;
|
|
9103
9163
|
ctxNodeRef.node = compileNode;
|
|
9104
9164
|
replaceWith(
|
|
@@ -9869,7 +9929,7 @@
|
|
|
9869
9929
|
|
|
9870
9930
|
let linkNode = $compileNode._getAny();
|
|
9871
9931
|
|
|
9872
|
-
if (scope
|
|
9932
|
+
if (scope._destroyed) {
|
|
9873
9933
|
continue;
|
|
9874
9934
|
}
|
|
9875
9935
|
|
|
@@ -9936,7 +9996,7 @@
|
|
|
9936
9996
|
) {
|
|
9937
9997
|
let childBoundTranscludeFn = boundTranscludeFn;
|
|
9938
9998
|
|
|
9939
|
-
if (scope
|
|
9999
|
+
if (scope._destroyed) {
|
|
9940
10000
|
return;
|
|
9941
10001
|
}
|
|
9942
10002
|
|
|
@@ -10797,13 +10857,13 @@
|
|
|
10797
10857
|
* $nonscope: boolean,
|
|
10798
10858
|
* $addControl: Function,
|
|
10799
10859
|
* $getControls: () => any[],
|
|
10800
|
-
*
|
|
10860
|
+
* _renameControl: Function,
|
|
10801
10861
|
* $removeControl: Function,
|
|
10802
10862
|
* $setValidity: Function | ((key: any, isValid: boolean, control: any) => any),
|
|
10803
10863
|
* $setDirty: Function,
|
|
10804
10864
|
* $setPristine: Function,
|
|
10805
10865
|
* $setSubmitted: Function,
|
|
10806
|
-
*
|
|
10866
|
+
* _setSubmitted: Function
|
|
10807
10867
|
* }}
|
|
10808
10868
|
*/
|
|
10809
10869
|
const nullFormCtrl = {
|
|
@@ -10812,7 +10872,7 @@
|
|
|
10812
10872
|
/* empty */
|
|
10813
10873
|
},
|
|
10814
10874
|
$getControls: () => [],
|
|
10815
|
-
|
|
10875
|
+
_renameControl: (control, name) => {
|
|
10816
10876
|
control.$name = name;
|
|
10817
10877
|
},
|
|
10818
10878
|
$removeControl: () => {
|
|
@@ -10830,7 +10890,7 @@
|
|
|
10830
10890
|
$setSubmitted: () => {
|
|
10831
10891
|
/* empty */
|
|
10832
10892
|
},
|
|
10833
|
-
|
|
10893
|
+
_setSubmitted: () => {
|
|
10834
10894
|
/* empty */
|
|
10835
10895
|
},
|
|
10836
10896
|
};
|
|
@@ -10887,11 +10947,11 @@
|
|
|
10887
10947
|
class FormController {
|
|
10888
10948
|
static $nonscope = true;
|
|
10889
10949
|
/* @ignore */ static $inject = [
|
|
10890
|
-
|
|
10891
|
-
|
|
10892
|
-
|
|
10893
|
-
|
|
10894
|
-
|
|
10950
|
+
$injectTokens._element,
|
|
10951
|
+
$injectTokens._attrs,
|
|
10952
|
+
$injectTokens._scope,
|
|
10953
|
+
$injectTokens._animate,
|
|
10954
|
+
$injectTokens._interpolate,
|
|
10895
10955
|
];
|
|
10896
10956
|
|
|
10897
10957
|
/**
|
|
@@ -10902,7 +10962,7 @@
|
|
|
10902
10962
|
* @param {ng.InterpolateService} $interpolate
|
|
10903
10963
|
*/
|
|
10904
10964
|
constructor($element, $attrs, $scope, $animate, $interpolate) {
|
|
10905
|
-
this
|
|
10965
|
+
this._controls = [];
|
|
10906
10966
|
|
|
10907
10967
|
this.$name = $interpolate($attrs.name || $attrs.ngForm || "")($scope);
|
|
10908
10968
|
|
|
@@ -10931,6 +10991,7 @@
|
|
|
10931
10991
|
|
|
10932
10992
|
this.$$classCache[VALID_CLASS] = isValid;
|
|
10933
10993
|
this.$$classCache[INVALID_CLASS] = !isValid;
|
|
10994
|
+
this.$target = {};
|
|
10934
10995
|
}
|
|
10935
10996
|
|
|
10936
10997
|
/**
|
|
@@ -10941,7 +11002,7 @@
|
|
|
10941
11002
|
* a form that uses `ng-model-options` to pend updates.
|
|
10942
11003
|
*/
|
|
10943
11004
|
$rollbackViewValue() {
|
|
10944
|
-
this
|
|
11005
|
+
this._controls.forEach((control) => {
|
|
10945
11006
|
control.$rollbackViewValue();
|
|
10946
11007
|
});
|
|
10947
11008
|
}
|
|
@@ -10954,7 +11015,7 @@
|
|
|
10954
11015
|
* usually handles calling this in response to input events.
|
|
10955
11016
|
*/
|
|
10956
11017
|
$commitViewValue() {
|
|
10957
|
-
this
|
|
11018
|
+
this._controls.forEach((control) => {
|
|
10958
11019
|
control.$commitViewValue();
|
|
10959
11020
|
});
|
|
10960
11021
|
}
|
|
@@ -10978,7 +11039,7 @@
|
|
|
10978
11039
|
// Breaking change - before, inputs whose name was "hasOwnProperty" were quietly ignored
|
|
10979
11040
|
// and not added to the scope. Now we throw an error.
|
|
10980
11041
|
assertNotHasOwnProperty(control.$name, "input");
|
|
10981
|
-
this
|
|
11042
|
+
this._controls.push(control);
|
|
10982
11043
|
|
|
10983
11044
|
if (control.$name) {
|
|
10984
11045
|
this[control.$name] = control;
|
|
@@ -11000,13 +11061,14 @@
|
|
|
11000
11061
|
* Likewise, adding a control to, or removing a control from the form is not reflected
|
|
11001
11062
|
* in the shallow copy. That means you should get a fresh copy from `$getControls()` every time
|
|
11002
11063
|
* you need access to the controls.
|
|
11064
|
+
* @returns {ReadonlyArray<FormController>}
|
|
11003
11065
|
*/
|
|
11004
11066
|
$getControls() {
|
|
11005
|
-
return shallowCopy(this
|
|
11067
|
+
return shallowCopy(this._controls);
|
|
11006
11068
|
}
|
|
11007
11069
|
|
|
11008
11070
|
// Private API: rename a form control
|
|
11009
|
-
|
|
11071
|
+
_renameControl(control, newName) {
|
|
11010
11072
|
const oldName = control.$name;
|
|
11011
11073
|
|
|
11012
11074
|
if (this[oldName] === control) {
|
|
@@ -11025,6 +11087,7 @@
|
|
|
11025
11087
|
* form. `$dirty`, `$submitted` states will not be changed, because the expected behavior can be
|
|
11026
11088
|
* different from case to case. For example, removing the only `$dirty` control from a form may or
|
|
11027
11089
|
* may not mean that the form is still `$dirty`.
|
|
11090
|
+
* @param {FormController } control
|
|
11028
11091
|
*/
|
|
11029
11092
|
$removeControl(control) {
|
|
11030
11093
|
if (control.$name && this[control.$name] === control) {
|
|
@@ -11043,7 +11106,7 @@
|
|
|
11043
11106
|
this.$setValidity(name, null, control);
|
|
11044
11107
|
});
|
|
11045
11108
|
|
|
11046
|
-
arrayRemove(this
|
|
11109
|
+
arrayRemove(this._controls, control);
|
|
11047
11110
|
|
|
11048
11111
|
control.$target.$$parentForm = nullFormCtrl;
|
|
11049
11112
|
}
|
|
@@ -11096,7 +11159,7 @@
|
|
|
11096
11159
|
this.$dirty = false;
|
|
11097
11160
|
this.$pristine = true;
|
|
11098
11161
|
this.$submitted = false;
|
|
11099
|
-
this
|
|
11162
|
+
this._controls.forEach((control) => {
|
|
11100
11163
|
control.$setPristine();
|
|
11101
11164
|
});
|
|
11102
11165
|
}
|
|
@@ -11111,7 +11174,7 @@
|
|
|
11111
11174
|
* back to its pristine state.
|
|
11112
11175
|
*/
|
|
11113
11176
|
$setUntouched() {
|
|
11114
|
-
this
|
|
11177
|
+
this._controls.forEach((control) => {
|
|
11115
11178
|
control.$setUntouched();
|
|
11116
11179
|
});
|
|
11117
11180
|
}
|
|
@@ -11127,19 +11190,19 @@
|
|
|
11127
11190
|
while (rootForm.$$parentForm && rootForm.$$parentForm !== nullFormCtrl) {
|
|
11128
11191
|
rootForm = rootForm.$$parentForm;
|
|
11129
11192
|
}
|
|
11130
|
-
rootForm
|
|
11193
|
+
rootForm._setSubmitted();
|
|
11131
11194
|
}
|
|
11132
11195
|
|
|
11133
|
-
|
|
11196
|
+
_setSubmitted() {
|
|
11134
11197
|
if (hasAnimate(this.$$element)) {
|
|
11135
11198
|
this.$$animate.addClass(this.$$element, SUBMITTED_CLASS);
|
|
11136
11199
|
} else {
|
|
11137
11200
|
this.$$element.classList.add(SUBMITTED_CLASS);
|
|
11138
11201
|
}
|
|
11139
11202
|
this.$submitted = true;
|
|
11140
|
-
this
|
|
11141
|
-
if (control
|
|
11142
|
-
control
|
|
11203
|
+
this._controls.forEach((control) => {
|
|
11204
|
+
if (control._setSubmitted) {
|
|
11205
|
+
control._setSubmitted();
|
|
11143
11206
|
}
|
|
11144
11207
|
});
|
|
11145
11208
|
}
|
|
@@ -11457,7 +11520,7 @@
|
|
|
11457
11520
|
attrParam.$observe(nameAttr, (newValue) => {
|
|
11458
11521
|
if (controller.$name === newValue) return;
|
|
11459
11522
|
scope.$target[controller.$name] = undefined;
|
|
11460
|
-
controller.$$parentForm
|
|
11523
|
+
controller.$$parentForm._renameControl(controller, newValue);
|
|
11461
11524
|
|
|
11462
11525
|
if (
|
|
11463
11526
|
scope.$target !== controller.$$parentForm &&
|
|
@@ -11680,12 +11743,12 @@
|
|
|
11680
11743
|
*/
|
|
11681
11744
|
|
|
11682
11745
|
class NgModelController {
|
|
11683
|
-
static $nonscope = true;
|
|
11746
|
+
/* @ignore */ static $nonscope = true;
|
|
11684
11747
|
/* @ignore */ static $inject = [
|
|
11685
|
-
|
|
11748
|
+
$injectTokens._scope,
|
|
11686
11749
|
$injectTokens._exceptionHandler,
|
|
11687
|
-
|
|
11688
|
-
|
|
11750
|
+
$injectTokens._attrs,
|
|
11751
|
+
$injectTokens._element,
|
|
11689
11752
|
$injectTokens._parse,
|
|
11690
11753
|
$injectTokens._animate,
|
|
11691
11754
|
$injectTokens._interpolate,
|
|
@@ -11717,19 +11780,19 @@
|
|
|
11717
11780
|
/** @type {any} */
|
|
11718
11781
|
this.$$rawModelValue = undefined; // stores the parsed modelValue / model set from scope regardless of validity.
|
|
11719
11782
|
|
|
11720
|
-
/** @type {
|
|
11783
|
+
/** @type {import("./interface.ts").ModelValidators} */
|
|
11721
11784
|
this.$validators = {};
|
|
11722
11785
|
|
|
11723
|
-
/** @type {
|
|
11786
|
+
/** @type {import("./interface.ts").AsyncModelValidators} */
|
|
11724
11787
|
this.$asyncValidators = {};
|
|
11725
11788
|
|
|
11726
|
-
/** @type {Array<
|
|
11789
|
+
/** @type {Array<import("./interface.ts").ModelParser>} */
|
|
11727
11790
|
this.$parsers = [];
|
|
11728
11791
|
|
|
11729
|
-
/** @type {Array<
|
|
11792
|
+
/** @type {Array<import("./interface.ts").ModelFormatter>} */
|
|
11730
11793
|
this.$formatters = [];
|
|
11731
11794
|
|
|
11732
|
-
/** @type {Array<
|
|
11795
|
+
/** @type {Array<import("./interface.ts").ModelViewChangeListener>} */
|
|
11733
11796
|
this.$viewChangeListeners = [];
|
|
11734
11797
|
|
|
11735
11798
|
/** @type {boolean} */
|
|
@@ -11760,15 +11823,15 @@
|
|
|
11760
11823
|
// Attach the correct context to the event handler function for updateOn
|
|
11761
11824
|
this.$$updateEventHandler = this.$$updateEventHandler.bind(this);
|
|
11762
11825
|
|
|
11763
|
-
this
|
|
11764
|
-
this
|
|
11826
|
+
this._parsedNgModel = $parse($attr.ngModel);
|
|
11827
|
+
this._parsedNgModelAssign = this._parsedNgModel.assign;
|
|
11765
11828
|
|
|
11766
11829
|
/**
|
|
11767
11830
|
* @type {import("../../core/parse/interface.ts").CompiledExpression |
|
|
11768
11831
|
* (function(ng.Scope): any)}
|
|
11769
11832
|
*/
|
|
11770
|
-
this
|
|
11771
|
-
this
|
|
11833
|
+
this._ngModelGet = this._parsedNgModel;
|
|
11834
|
+
this._ngModelSet = this._parsedNgModelAssign;
|
|
11772
11835
|
this.$$pendingDebounce = null;
|
|
11773
11836
|
this.$$parserValid = undefined;
|
|
11774
11837
|
|
|
@@ -11917,8 +11980,8 @@
|
|
|
11917
11980
|
|
|
11918
11981
|
const invokeModelSetter = this.$$parse(`${this.$$attr.ngModel}($$$p)`);
|
|
11919
11982
|
|
|
11920
|
-
this
|
|
11921
|
-
let modelValue = this
|
|
11983
|
+
this._ngModelGet = ($scope) => {
|
|
11984
|
+
let modelValue = this._parsedNgModel($scope);
|
|
11922
11985
|
|
|
11923
11986
|
if (isFunction(modelValue)) {
|
|
11924
11987
|
modelValue = invokeModelGetter($scope);
|
|
@@ -11926,14 +11989,14 @@
|
|
|
11926
11989
|
|
|
11927
11990
|
return modelValue;
|
|
11928
11991
|
};
|
|
11929
|
-
this
|
|
11930
|
-
if (isFunction(this
|
|
11992
|
+
this._ngModelSet = ($scope, newValue) => {
|
|
11993
|
+
if (isFunction(this._parsedNgModel($scope))) {
|
|
11931
11994
|
invokeModelSetter($scope, { $$$p: newValue });
|
|
11932
11995
|
} else {
|
|
11933
|
-
this
|
|
11996
|
+
this._parsedNgModelAssign($scope, newValue);
|
|
11934
11997
|
}
|
|
11935
11998
|
};
|
|
11936
|
-
} else if (!this
|
|
11999
|
+
} else if (!this._parsedNgModel.assign) {
|
|
11937
12000
|
throw ngModelMinErr(
|
|
11938
12001
|
"nonassign",
|
|
11939
12002
|
"Expression '{0}' is non-assignable. Element: {1}",
|
|
@@ -12409,7 +12472,7 @@
|
|
|
12409
12472
|
if (isNumberNaN(this.$modelValue)) {
|
|
12410
12473
|
// this.$modelValue has not been touched yet...
|
|
12411
12474
|
// @ts-ignore
|
|
12412
|
-
this.$modelValue = this
|
|
12475
|
+
this.$modelValue = this._ngModelGet(this.$$scope);
|
|
12413
12476
|
}
|
|
12414
12477
|
const prevModelValue = this.$modelValue;
|
|
12415
12478
|
|
|
@@ -12446,13 +12509,15 @@
|
|
|
12446
12509
|
// intentional loose equality
|
|
12447
12510
|
// eslint-disable-next-line eqeqeq
|
|
12448
12511
|
if (that.$modelValue != prevModelValue) {
|
|
12512
|
+
if (isNull(that.$modelValue) && prevModelValue === "") return;
|
|
12513
|
+
|
|
12449
12514
|
that.$$writeModelToScope();
|
|
12450
12515
|
}
|
|
12451
12516
|
}
|
|
12452
12517
|
}
|
|
12453
12518
|
|
|
12454
12519
|
$$writeModelToScope() {
|
|
12455
|
-
this
|
|
12520
|
+
this._ngModelSet(this.$$scope, this.$modelValue);
|
|
12456
12521
|
Object.values(this.$viewChangeListeners).forEach((listener) => {
|
|
12457
12522
|
try {
|
|
12458
12523
|
listener();
|
|
@@ -12570,7 +12635,7 @@
|
|
|
12570
12635
|
* **Note:** it is not possible to override the `getterSetter` option.
|
|
12571
12636
|
* </div>
|
|
12572
12637
|
*
|
|
12573
|
-
* @param {
|
|
12638
|
+
* @param {import("../../interface.ts").NgModelOptions} options a hash of settings to override the previous options
|
|
12574
12639
|
*
|
|
12575
12640
|
*/
|
|
12576
12641
|
$overrideModelOptions(options) {
|
|
@@ -12769,7 +12834,7 @@
|
|
|
12769
12834
|
// ng-change executes in apply phase
|
|
12770
12835
|
// 4. view should be changed back to 'a'
|
|
12771
12836
|
ctrl.$$scope.$watch("value", () => {
|
|
12772
|
-
const modelValue = ctrl
|
|
12837
|
+
const modelValue = ctrl._ngModelGet(ctrl.$$scope);
|
|
12773
12838
|
|
|
12774
12839
|
// if scope model value and ngModel value are out of sync
|
|
12775
12840
|
// This cannot be moved to the action function, because it would not catch the
|
|
@@ -12818,7 +12883,7 @@
|
|
|
12818
12883
|
|
|
12819
12884
|
attr.$observe("name", (newValue) => {
|
|
12820
12885
|
if (modelCtrl.$name !== newValue) {
|
|
12821
|
-
modelCtrl.$$parentForm
|
|
12886
|
+
modelCtrl.$$parentForm._renameControl(modelCtrl, newValue);
|
|
12822
12887
|
}
|
|
12823
12888
|
});
|
|
12824
12889
|
const deregisterWatch = scope.$watch(attr.ngModel, (val) => {
|
|
@@ -12853,9 +12918,6 @@
|
|
|
12853
12918
|
};
|
|
12854
12919
|
}
|
|
12855
12920
|
|
|
12856
|
-
// Regex code was initially obtained from SO prior to modification: https://stackoverflow.com/questions/3143070/javascript-regex-iso-datetime#answer-3143231
|
|
12857
|
-
const ISO_DATE_REGEXP =
|
|
12858
|
-
/^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/;
|
|
12859
12921
|
// See valid URLs in RFC3987 (http://tools.ietf.org/html/rfc3987)
|
|
12860
12922
|
// Note: We are being more lenient, because browsers are too.
|
|
12861
12923
|
// 1. Scheme
|
|
@@ -12903,35 +12965,14 @@
|
|
|
12903
12965
|
|
|
12904
12966
|
const inputType = {
|
|
12905
12967
|
text: textInputType,
|
|
12906
|
-
date:
|
|
12907
|
-
|
|
12908
|
-
DATE_REGEXP,
|
|
12909
|
-
createDateParser(DATE_REGEXP, ["yyyy", "MM", "dd"]),
|
|
12910
|
-
),
|
|
12911
|
-
"datetime-local": createDateInputType(
|
|
12968
|
+
date: createStringDateInputType("date", DATE_REGEXP),
|
|
12969
|
+
"datetime-local": createStringDateInputType(
|
|
12912
12970
|
"datetimelocal",
|
|
12913
12971
|
DATETIMELOCAL_REGEXP,
|
|
12914
|
-
createDateParser(DATETIMELOCAL_REGEXP, [
|
|
12915
|
-
"yyyy",
|
|
12916
|
-
"MM",
|
|
12917
|
-
"dd",
|
|
12918
|
-
"HH",
|
|
12919
|
-
"mm",
|
|
12920
|
-
"ss",
|
|
12921
|
-
"sss",
|
|
12922
|
-
]),
|
|
12923
|
-
),
|
|
12924
|
-
time: createDateInputType(
|
|
12925
|
-
"time",
|
|
12926
|
-
TIME_REGEXP,
|
|
12927
|
-
createDateParser(TIME_REGEXP, ["HH", "mm", "ss", "sss"]),
|
|
12928
|
-
),
|
|
12929
|
-
week: createDateInputType("week", WEEK_REGEXP, weekParser),
|
|
12930
|
-
month: createDateInputType(
|
|
12931
|
-
"month",
|
|
12932
|
-
MONTH_REGEXP,
|
|
12933
|
-
createDateParser(MONTH_REGEXP, ["yyyy", "MM"]),
|
|
12934
12972
|
),
|
|
12973
|
+
time: createStringDateInputType("time", TIME_REGEXP),
|
|
12974
|
+
week: createStringDateInputType("week", WEEK_REGEXP),
|
|
12975
|
+
month: createStringDateInputType("month", MONTH_REGEXP),
|
|
12935
12976
|
number: numberInputType,
|
|
12936
12977
|
url: urlInputType,
|
|
12937
12978
|
email: emailInputType,
|
|
@@ -13060,318 +13101,56 @@
|
|
|
13060
13101
|
};
|
|
13061
13102
|
}
|
|
13062
13103
|
|
|
13063
|
-
|
|
13064
|
-
|
|
13065
|
-
|
|
13066
|
-
|
|
13067
|
-
|
|
13068
|
-
|
|
13069
|
-
|
|
13070
|
-
const dayOfWeekOnFirst = new Date(year, 0, 1).getDay();
|
|
13071
|
-
|
|
13072
|
-
// 4 = index of Thursday (+1 to account for 1st = 5)
|
|
13073
|
-
// 11 = index of *next* Thursday (+1 account for 1st = 12)
|
|
13074
|
-
return new Date(
|
|
13075
|
-
year,
|
|
13076
|
-
0,
|
|
13077
|
-
// eslint-disable-next-line no-magic-numbers
|
|
13078
|
-
(dayOfWeekOnFirst <= 4 ? 5 : 12) - dayOfWeekOnFirst,
|
|
13079
|
-
);
|
|
13080
|
-
}
|
|
13081
|
-
|
|
13082
|
-
if (isString(isoWeek)) {
|
|
13083
|
-
WEEK_REGEXP.lastIndex = 0;
|
|
13084
|
-
const parts = WEEK_REGEXP.exec(isoWeek);
|
|
13085
|
-
|
|
13086
|
-
if (parts) {
|
|
13087
|
-
const year = +parts[1];
|
|
13088
|
-
|
|
13089
|
-
const week = +parts[2];
|
|
13090
|
-
|
|
13091
|
-
let hours = 0;
|
|
13092
|
-
|
|
13093
|
-
let minutes = 0;
|
|
13094
|
-
|
|
13095
|
-
let seconds = 0;
|
|
13096
|
-
|
|
13097
|
-
let milliseconds = 0;
|
|
13098
|
-
|
|
13099
|
-
const firstThurs = getFirstThursdayOfYear(year);
|
|
13100
|
-
|
|
13101
|
-
const DAYS = 7;
|
|
13102
|
-
|
|
13103
|
-
const addDays = (week - 1) * DAYS;
|
|
13104
|
-
|
|
13105
|
-
if (existingDate) {
|
|
13106
|
-
hours = existingDate.getHours();
|
|
13107
|
-
minutes = existingDate.getMinutes();
|
|
13108
|
-
seconds = existingDate.getSeconds();
|
|
13109
|
-
milliseconds = existingDate.getMilliseconds();
|
|
13110
|
-
}
|
|
13111
|
-
|
|
13112
|
-
return new Date(
|
|
13113
|
-
year,
|
|
13114
|
-
0,
|
|
13115
|
-
firstThurs.getDate() + addDays,
|
|
13116
|
-
hours,
|
|
13117
|
-
minutes,
|
|
13118
|
-
seconds,
|
|
13119
|
-
milliseconds,
|
|
13120
|
-
);
|
|
13121
|
-
}
|
|
13122
|
-
}
|
|
13123
|
-
|
|
13124
|
-
return NaN;
|
|
13125
|
-
}
|
|
13126
|
-
|
|
13127
|
-
function createDateParser(regexp, mapping) {
|
|
13128
|
-
return function (iso, previousDate) {
|
|
13129
|
-
let parts;
|
|
13130
|
-
|
|
13131
|
-
let map;
|
|
13132
|
-
|
|
13133
|
-
if (isDate(iso)) {
|
|
13134
|
-
return iso;
|
|
13135
|
-
}
|
|
13136
|
-
|
|
13137
|
-
if (isString(iso)) {
|
|
13138
|
-
// When a date is JSON'ified to wraps itself inside of an extra
|
|
13139
|
-
// set of double quotes. This makes the date parsing code unable
|
|
13140
|
-
// to match the date string and parse it as a date.
|
|
13141
|
-
if (iso.charAt(0) === '"' && iso.charAt(iso.length - 1) === '"') {
|
|
13142
|
-
iso = iso.substring(1, iso.length - 1);
|
|
13143
|
-
}
|
|
13144
|
-
|
|
13145
|
-
if (ISO_DATE_REGEXP.test(iso)) {
|
|
13146
|
-
return new Date(iso);
|
|
13147
|
-
}
|
|
13148
|
-
regexp.lastIndex = 0;
|
|
13149
|
-
parts = regexp.exec(iso);
|
|
13150
|
-
|
|
13151
|
-
if (parts) {
|
|
13152
|
-
parts.shift();
|
|
13153
|
-
|
|
13154
|
-
if (previousDate) {
|
|
13155
|
-
map = {
|
|
13156
|
-
yyyy: previousDate.getFullYear(),
|
|
13157
|
-
MM: previousDate.getMonth() + 1,
|
|
13158
|
-
dd: previousDate.getDate(),
|
|
13159
|
-
HH: previousDate.getHours(),
|
|
13160
|
-
mm: previousDate.getMinutes(),
|
|
13161
|
-
ss: previousDate.getSeconds(),
|
|
13162
|
-
sss: previousDate.getMilliseconds() / 1000,
|
|
13163
|
-
};
|
|
13164
|
-
} else {
|
|
13165
|
-
map = { yyyy: 1970, MM: 1, dd: 1, HH: 0, mm: 0, ss: 0, sss: 0 };
|
|
13166
|
-
}
|
|
13167
|
-
|
|
13168
|
-
Object.entries(parts).forEach(([index, part]) => {
|
|
13169
|
-
if (index < mapping.length) {
|
|
13170
|
-
map[mapping[index]] = +part;
|
|
13171
|
-
}
|
|
13172
|
-
});
|
|
13173
|
-
|
|
13174
|
-
const date = new Date(
|
|
13175
|
-
map.yyyy,
|
|
13176
|
-
map.MM - 1,
|
|
13177
|
-
map.dd,
|
|
13178
|
-
map.HH,
|
|
13179
|
-
map.mm,
|
|
13180
|
-
map.ss || 0,
|
|
13181
|
-
map.sss * 1000 || 0,
|
|
13182
|
-
);
|
|
13183
|
-
|
|
13184
|
-
if (map.yyyy < 100) {
|
|
13185
|
-
// In the constructor, 2-digit years map to 1900-1999.
|
|
13186
|
-
// Use `setFullYear()` to set the correct year.
|
|
13187
|
-
date.setFullYear(map.yyyy);
|
|
13188
|
-
}
|
|
13189
|
-
|
|
13190
|
-
return date;
|
|
13191
|
-
}
|
|
13192
|
-
}
|
|
13193
|
-
|
|
13194
|
-
return NaN;
|
|
13195
|
-
};
|
|
13196
|
-
}
|
|
13197
|
-
|
|
13198
|
-
const MONTH_INPUT_FORMAT = /\b\d{4}-(0[1-9]|1[0-2])\b/;
|
|
13199
|
-
|
|
13200
|
-
function createDateInputType(type, regexp, parseDate) {
|
|
13201
|
-
return function dynamicDateInputType(
|
|
13202
|
-
scope,
|
|
13203
|
-
element,
|
|
13204
|
-
attr,
|
|
13205
|
-
ctrl,
|
|
13206
|
-
$filter,
|
|
13207
|
-
$parse,
|
|
13208
|
-
) {
|
|
13209
|
-
badInputChecker(scope, element, attr, ctrl, type);
|
|
13104
|
+
/**
|
|
13105
|
+
* @param {string} type
|
|
13106
|
+
* @param {RegExp} regexp
|
|
13107
|
+
* @returns {*}
|
|
13108
|
+
*/
|
|
13109
|
+
function createStringDateInputType(type, regexp) {
|
|
13110
|
+
return function stringDateInputType(scope, element, attr, ctrl, $parse) {
|
|
13210
13111
|
baseInputType(scope, element, attr, ctrl);
|
|
13211
|
-
let previousDate;
|
|
13212
|
-
|
|
13213
13112
|
ctrl.$parsers.push((value) => {
|
|
13214
13113
|
if (ctrl.$isEmpty(value)) return null;
|
|
13215
13114
|
|
|
13216
|
-
if (regexp.test(value))
|
|
13217
|
-
// Do not convert for native HTML
|
|
13218
|
-
if (["month", "week", "datetimelocal", "time", "date"].includes(type)) {
|
|
13219
|
-
return value;
|
|
13220
|
-
}
|
|
13115
|
+
if (regexp.test(value)) return value;
|
|
13221
13116
|
|
|
13222
|
-
// Note: We cannot read ctrl.$modelValue, as there might be a different
|
|
13223
|
-
// parser/formatter in the processing chain so that the model
|
|
13224
|
-
// contains some different data format!
|
|
13225
|
-
return parseDateAndConvertTimeZoneToLocal(value, previousDate);
|
|
13226
|
-
}
|
|
13227
13117
|
ctrl.$$parserName = type;
|
|
13228
13118
|
|
|
13229
13119
|
return undefined;
|
|
13230
13120
|
});
|
|
13231
13121
|
|
|
13232
|
-
ctrl.$formatters.push(
|
|
13233
|
-
if (
|
|
13234
|
-
throw ngModelMinErr("datefmt", "Expected `{0}` to be a String", value);
|
|
13235
|
-
}
|
|
13236
|
-
|
|
13237
|
-
if (type === "month") {
|
|
13238
|
-
if (isNullOrUndefined(value)) {
|
|
13239
|
-
return "";
|
|
13240
|
-
}
|
|
13241
|
-
|
|
13242
|
-
if (!MONTH_INPUT_FORMAT.test(value)) {
|
|
13243
|
-
throw ngModelMinErr(
|
|
13244
|
-
"datefmt",
|
|
13245
|
-
"Expected month `{0}` to be a 'YYYY-DD'",
|
|
13246
|
-
value,
|
|
13247
|
-
);
|
|
13248
|
-
}
|
|
13249
|
-
}
|
|
13250
|
-
|
|
13251
|
-
if (type === "week") {
|
|
13252
|
-
if (isNullOrUndefined(value)) {
|
|
13253
|
-
return "";
|
|
13254
|
-
}
|
|
13255
|
-
|
|
13256
|
-
if (!WEEK_REGEXP.test(value)) {
|
|
13257
|
-
throw ngModelMinErr(
|
|
13258
|
-
"datefmt",
|
|
13259
|
-
"Expected week `{0}` to be a 'yyyy-Www'",
|
|
13260
|
-
value,
|
|
13261
|
-
);
|
|
13262
|
-
}
|
|
13263
|
-
}
|
|
13264
|
-
|
|
13265
|
-
if (type === "datetimelocal") {
|
|
13266
|
-
if (isNullOrUndefined(value)) {
|
|
13267
|
-
return "";
|
|
13268
|
-
}
|
|
13122
|
+
ctrl.$formatters.push((value) => {
|
|
13123
|
+
if (ctrl.$isEmpty(value)) return "";
|
|
13269
13124
|
|
|
13270
|
-
|
|
13271
|
-
|
|
13272
|
-
"datefmt",
|
|
13273
|
-
"Expected week `{0}` to be a in date time format. See: https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats#local_date_and_time_strings",
|
|
13274
|
-
value,
|
|
13275
|
-
);
|
|
13276
|
-
}
|
|
13125
|
+
if (!isString(value)) {
|
|
13126
|
+
throw ngModelMinErr("datefmt", "Expected `{0}` to be a string", value);
|
|
13277
13127
|
}
|
|
13278
13128
|
|
|
13279
13129
|
return value;
|
|
13280
|
-
|
|
13281
|
-
// if (isValidDate(value)) {
|
|
13282
|
-
// previousDate = value;
|
|
13283
|
-
// const timezone = ctrl.$options.getOption("timezone");
|
|
13284
|
-
|
|
13285
|
-
// if (timezone) {
|
|
13286
|
-
// previousTimezone = timezone;
|
|
13287
|
-
// previousDate = convertTimezoneToLocal(previousDate, timezone, true);
|
|
13288
|
-
// }
|
|
13289
|
-
|
|
13290
|
-
// return value;
|
|
13291
|
-
// }
|
|
13292
|
-
// previousDate = null;
|
|
13293
|
-
// previousTimezone = null;
|
|
13294
|
-
// return "";
|
|
13295
13130
|
});
|
|
13296
13131
|
|
|
13132
|
+
// Optional min/max
|
|
13297
13133
|
if (isDefined(attr.min) || attr.ngMin) {
|
|
13298
|
-
let minVal = attr.min || $parse(attr.ngMin)(scope);
|
|
13134
|
+
let minVal = attr.min || $parse?.(attr.ngMin)(scope);
|
|
13299
13135
|
|
|
13300
|
-
|
|
13301
|
-
|
|
13302
|
-
ctrl.$validators.min = function (value) {
|
|
13303
|
-
if (type === "month") {
|
|
13304
|
-
return (
|
|
13305
|
-
isUndefined(parsedMinVal) ||
|
|
13306
|
-
parseDate(value) >= parseDate(parsedMinVal)
|
|
13307
|
-
);
|
|
13308
|
-
}
|
|
13309
|
-
|
|
13310
|
-
return (
|
|
13311
|
-
!isValidDate(value) ||
|
|
13312
|
-
isUndefined(parsedMinVal) ||
|
|
13313
|
-
parseDate(value) >= parsedMinVal
|
|
13314
|
-
);
|
|
13315
|
-
};
|
|
13136
|
+
ctrl.$validators.min = (_modelValue, viewValue) =>
|
|
13137
|
+
ctrl.$isEmpty(viewValue) || viewValue >= minVal;
|
|
13316
13138
|
attr.$observe("min", (val) => {
|
|
13317
|
-
|
|
13318
|
-
|
|
13319
|
-
minVal = val;
|
|
13320
|
-
ctrl.$validate();
|
|
13321
|
-
}
|
|
13139
|
+
minVal = val;
|
|
13140
|
+
ctrl.$validate();
|
|
13322
13141
|
});
|
|
13323
13142
|
}
|
|
13324
13143
|
|
|
13325
13144
|
if (isDefined(attr.max) || attr.ngMax) {
|
|
13326
|
-
let maxVal = attr.max || $parse(attr.ngMax)(scope);
|
|
13327
|
-
|
|
13328
|
-
let parsedMaxVal = parseObservedDateValue(deProxy(maxVal));
|
|
13329
|
-
|
|
13330
|
-
ctrl.$validators.max = function (value) {
|
|
13331
|
-
if (type === "month") {
|
|
13332
|
-
return (
|
|
13333
|
-
isUndefined(parsedMaxVal) ||
|
|
13334
|
-
parseDate(value) <= parseDate(parsedMaxVal)
|
|
13335
|
-
);
|
|
13336
|
-
}
|
|
13145
|
+
let maxVal = attr.max || $parse?.(attr.ngMax)(scope);
|
|
13337
13146
|
|
|
13338
|
-
|
|
13339
|
-
|
|
13340
|
-
isUndefined(parsedMaxVal) ||
|
|
13341
|
-
parseDate(value) <= parsedMaxVal
|
|
13342
|
-
);
|
|
13343
|
-
};
|
|
13147
|
+
ctrl.$validators.max = (_modelValue, viewValue) =>
|
|
13148
|
+
ctrl.$isEmpty(viewValue) || viewValue <= maxVal;
|
|
13344
13149
|
attr.$observe("max", (val) => {
|
|
13345
|
-
|
|
13346
|
-
|
|
13347
|
-
maxVal = val;
|
|
13348
|
-
ctrl.$validate();
|
|
13349
|
-
}
|
|
13150
|
+
maxVal = val;
|
|
13151
|
+
ctrl.$validate();
|
|
13350
13152
|
});
|
|
13351
13153
|
}
|
|
13352
|
-
|
|
13353
|
-
function isValidDate(value) {
|
|
13354
|
-
// Invalid Date: getTime() returns NaN
|
|
13355
|
-
return value && !(value.getTime && Number.isNaN(value.getTime()));
|
|
13356
|
-
}
|
|
13357
|
-
|
|
13358
|
-
function parseObservedDateValue(val) {
|
|
13359
|
-
return isDefined(val) && !isDate(val)
|
|
13360
|
-
? parseDateAndConvertTimeZoneToLocal(val) || undefined
|
|
13361
|
-
: val;
|
|
13362
|
-
}
|
|
13363
|
-
|
|
13364
|
-
function parseDateAndConvertTimeZoneToLocal(value, previousDateParam) {
|
|
13365
|
-
const timezone = ctrl.$options.getOption("timezone");
|
|
13366
|
-
|
|
13367
|
-
let parsedDate = parseDate(value, previousDateParam);
|
|
13368
|
-
|
|
13369
|
-
if (!Number.isNaN(parsedDate) && timezone) {
|
|
13370
|
-
parsedDate = convertTimezoneToLocal(parsedDate, timezone);
|
|
13371
|
-
}
|
|
13372
|
-
|
|
13373
|
-
return parsedDate;
|
|
13374
|
-
}
|
|
13375
13154
|
};
|
|
13376
13155
|
}
|
|
13377
13156
|
|
|
@@ -13496,7 +13275,7 @@
|
|
|
13496
13275
|
return (value - stepBase) % step === 0;
|
|
13497
13276
|
}
|
|
13498
13277
|
|
|
13499
|
-
function numberInputType(scope, element, attr, ctrl, $
|
|
13278
|
+
function numberInputType(scope, element, attr, ctrl, $parse) {
|
|
13500
13279
|
badInputChecker(scope, element, attr, ctrl, "number");
|
|
13501
13280
|
numberFormatterParser(ctrl);
|
|
13502
13281
|
baseInputType(scope, element, attr, ctrl);
|
|
@@ -13835,7 +13614,7 @@
|
|
|
13835
13614
|
return fallback;
|
|
13836
13615
|
}
|
|
13837
13616
|
|
|
13838
|
-
function checkboxInputType(scope, element, attr, ctrl, $
|
|
13617
|
+
function checkboxInputType(scope, element, attr, ctrl, $parse) {
|
|
13839
13618
|
const trueValue = parseConstantExpr(
|
|
13840
13619
|
$parse,
|
|
13841
13620
|
scope,
|
|
@@ -13874,14 +13653,13 @@
|
|
|
13874
13653
|
ctrl.$parsers.push((value) => (value ? trueValue : falseValue));
|
|
13875
13654
|
}
|
|
13876
13655
|
|
|
13877
|
-
inputDirective.$inject = [$injectTokens.
|
|
13656
|
+
inputDirective.$inject = [$injectTokens._parse];
|
|
13878
13657
|
|
|
13879
13658
|
/**
|
|
13880
|
-
* @param {ng.FilterFactory} $filter
|
|
13881
13659
|
* @param {ng.ParseService} $parse
|
|
13882
13660
|
* @returns {ng.Directive}
|
|
13883
13661
|
*/
|
|
13884
|
-
function inputDirective($
|
|
13662
|
+
function inputDirective($parse) {
|
|
13885
13663
|
return {
|
|
13886
13664
|
restrict: "E",
|
|
13887
13665
|
require: ["?ngModel"],
|
|
@@ -13893,7 +13671,6 @@
|
|
|
13893
13671
|
element,
|
|
13894
13672
|
attr,
|
|
13895
13673
|
ctrls[0],
|
|
13896
|
-
$filter,
|
|
13897
13674
|
$parse,
|
|
13898
13675
|
);
|
|
13899
13676
|
}
|
|
@@ -13905,47 +13682,18 @@
|
|
|
13905
13682
|
/**
|
|
13906
13683
|
* @returns {ng.Directive}
|
|
13907
13684
|
*/
|
|
13908
|
-
function
|
|
13909
|
-
const valueProperty = {
|
|
13910
|
-
configurable: true,
|
|
13911
|
-
enumerable: false,
|
|
13912
|
-
get() {
|
|
13913
|
-
return this.getAttribute("value") || "";
|
|
13914
|
-
},
|
|
13915
|
-
set(val) {
|
|
13916
|
-
this.setAttribute("value", val);
|
|
13917
|
-
},
|
|
13918
|
-
};
|
|
13919
|
-
|
|
13685
|
+
function hiddenInputDirective() {
|
|
13920
13686
|
return {
|
|
13921
13687
|
restrict: "E",
|
|
13922
|
-
priority: 200,
|
|
13923
13688
|
compile(_, attr) {
|
|
13924
|
-
if (attr.type?.toLowerCase() !== "hidden")
|
|
13925
|
-
return undefined;
|
|
13926
|
-
}
|
|
13689
|
+
if (attr.type?.toLowerCase() !== "hidden") return undefined;
|
|
13927
13690
|
|
|
13928
|
-
|
|
13691
|
+
return {
|
|
13929
13692
|
pre(_scope, element) {
|
|
13930
|
-
|
|
13931
|
-
|
|
13932
|
-
// Support: Edge
|
|
13933
|
-
// Moving the DOM around prevents autofillling
|
|
13934
|
-
if (node.parentNode) {
|
|
13935
|
-
node.parentNode.insertBefore(node, node.nextSibling);
|
|
13936
|
-
}
|
|
13937
|
-
|
|
13938
|
-
// Support: FF, IE
|
|
13939
|
-
// Avoiding direct assignment to .value prevents autofillling
|
|
13940
|
-
if (Object.defineProperty) {
|
|
13941
|
-
Object.defineProperty(node, "value", valueProperty);
|
|
13942
|
-
}
|
|
13943
|
-
|
|
13944
|
-
return undefined;
|
|
13693
|
+
/** @type {HTMLInputElement} */ (element).value =
|
|
13694
|
+
element.getAttribute("value") ?? "";
|
|
13945
13695
|
},
|
|
13946
13696
|
};
|
|
13947
|
-
|
|
13948
|
-
return res;
|
|
13949
13697
|
},
|
|
13950
13698
|
};
|
|
13951
13699
|
}
|
|
@@ -14017,8 +13765,6 @@
|
|
|
14017
13765
|
"selectValueMap",
|
|
14018
13766
|
"emptyOption",
|
|
14019
13767
|
"optionsMap",
|
|
14020
|
-
"$scope",
|
|
14021
|
-
"$element",
|
|
14022
13768
|
];
|
|
14023
13769
|
|
|
14024
13770
|
/**
|
|
@@ -14046,8 +13792,8 @@
|
|
|
14046
13792
|
/** @type {boolean} */
|
|
14047
13793
|
this.multiple = false;
|
|
14048
13794
|
|
|
14049
|
-
/** @type {HTMLOptionElement} */
|
|
14050
|
-
this.
|
|
13795
|
+
/** @private @type {HTMLOptionElement} */
|
|
13796
|
+
this._unknownOption = document.createElement("option");
|
|
14051
13797
|
|
|
14052
13798
|
/** @type {boolean} */
|
|
14053
13799
|
this.hasEmptyOption = false;
|
|
@@ -14079,10 +13825,10 @@
|
|
|
14079
13825
|
renderUnknownOption(val) {
|
|
14080
13826
|
const unknownVal = this.generateUnknownOptionValue(val);
|
|
14081
13827
|
|
|
14082
|
-
this.
|
|
14083
|
-
this.$element.prepend(this.
|
|
14084
|
-
this.
|
|
14085
|
-
this.
|
|
13828
|
+
this._unknownOption.value = unknownVal;
|
|
13829
|
+
this.$element.prepend(this._unknownOption);
|
|
13830
|
+
this._unknownOption.selected = true;
|
|
13831
|
+
this._unknownOption.setAttribute("selected", "selected");
|
|
14086
13832
|
this.$element.value = unknownVal;
|
|
14087
13833
|
}
|
|
14088
13834
|
|
|
@@ -14093,9 +13839,9 @@
|
|
|
14093
13839
|
updateUnknownOption(val) {
|
|
14094
13840
|
const unknownVal = this.generateUnknownOptionValue(val);
|
|
14095
13841
|
|
|
14096
|
-
this.
|
|
14097
|
-
this.
|
|
14098
|
-
this.
|
|
13842
|
+
this._unknownOption.value = unknownVal;
|
|
13843
|
+
this._unknownOption.selected = true;
|
|
13844
|
+
this._unknownOption.setAttribute("selected", "selected");
|
|
14099
13845
|
this.$element.value = unknownVal;
|
|
14100
13846
|
}
|
|
14101
13847
|
|
|
@@ -14116,7 +13862,7 @@
|
|
|
14116
13862
|
* Remove the unknown option from the select element if it exists.
|
|
14117
13863
|
*/
|
|
14118
13864
|
removeUnknownOption() {
|
|
14119
|
-
if (this.
|
|
13865
|
+
if (this._unknownOption.parentElement) this._unknownOption.remove();
|
|
14120
13866
|
}
|
|
14121
13867
|
|
|
14122
13868
|
/**
|
|
@@ -14241,7 +13987,7 @@
|
|
|
14241
13987
|
* @returns {boolean} Whether the unknown option is currently selected.
|
|
14242
13988
|
*/
|
|
14243
13989
|
$isUnknownOptionSelected() {
|
|
14244
|
-
return this.$element.options[0] === this.
|
|
13990
|
+
return this.$element.options[0] === this._unknownOption;
|
|
14245
13991
|
}
|
|
14246
13992
|
|
|
14247
13993
|
/**
|
|
@@ -14262,7 +14008,7 @@
|
|
|
14262
14008
|
if (isNullOrUndefined(value) && this.emptyOption) {
|
|
14263
14009
|
this.removeUnknownOption();
|
|
14264
14010
|
this.selectEmptyOption();
|
|
14265
|
-
} else if (this.
|
|
14011
|
+
} else if (this._unknownOption.parentElement) {
|
|
14266
14012
|
this.updateUnknownOption(value);
|
|
14267
14013
|
} else {
|
|
14268
14014
|
this.renderUnknownOption(value);
|
|
@@ -14421,7 +14167,7 @@
|
|
|
14421
14167
|
}
|
|
14422
14168
|
|
|
14423
14169
|
/**
|
|
14424
|
-
* @returns {
|
|
14170
|
+
* @returns {ng.Directive}
|
|
14425
14171
|
*/
|
|
14426
14172
|
function selectDirective() {
|
|
14427
14173
|
return {
|
|
@@ -14644,7 +14390,9 @@
|
|
|
14644
14390
|
scope.$watch(
|
|
14645
14391
|
attr.ngBind,
|
|
14646
14392
|
(value) => {
|
|
14647
|
-
element.textContent =
|
|
14393
|
+
element.textContent = /** @type {string} */ (
|
|
14394
|
+
stringify$1(deProxy(value))
|
|
14395
|
+
);
|
|
14648
14396
|
},
|
|
14649
14397
|
isDefined(attr.lazy),
|
|
14650
14398
|
);
|
|
@@ -14653,17 +14401,17 @@
|
|
|
14653
14401
|
}
|
|
14654
14402
|
|
|
14655
14403
|
/**
|
|
14656
|
-
* @returns {
|
|
14404
|
+
* @returns {ng.Directive}
|
|
14657
14405
|
*/
|
|
14658
14406
|
function ngBindTemplateDirective() {
|
|
14659
14407
|
return {
|
|
14660
14408
|
/**
|
|
14661
14409
|
* @param {ng.Scope} _scope
|
|
14662
14410
|
* @param {Element} element
|
|
14663
|
-
* @param {
|
|
14411
|
+
* @param {ng.Attributes} attr
|
|
14664
14412
|
*/
|
|
14665
14413
|
link(_scope, element, attr) {
|
|
14666
|
-
attr.$observe("ngBindTemplate", (value) => {
|
|
14414
|
+
attr.$observe("ngBindTemplate", (/** @type {string | null} */ value) => {
|
|
14667
14415
|
element.textContent = isUndefined(value) ? "" : value;
|
|
14668
14416
|
});
|
|
14669
14417
|
},
|
|
@@ -14672,8 +14420,8 @@
|
|
|
14672
14420
|
|
|
14673
14421
|
ngBindHtmlDirective.$inject = [$injectTokens._parse];
|
|
14674
14422
|
/**
|
|
14675
|
-
* @param {
|
|
14676
|
-
* @returns {
|
|
14423
|
+
* @param {ng.ParseService} $parse
|
|
14424
|
+
* @returns {ng.Directive}
|
|
14677
14425
|
*/
|
|
14678
14426
|
function ngBindHtmlDirective($parse) {
|
|
14679
14427
|
return {
|
|
@@ -14962,7 +14710,8 @@
|
|
|
14962
14710
|
|
|
14963
14711
|
ngHideDirective.$inject = [$injectTokens._animate];
|
|
14964
14712
|
/**
|
|
14965
|
-
* @
|
|
14713
|
+
* @param {ng.AnimateService} $animate
|
|
14714
|
+
* @returns {ng.Directive}
|
|
14966
14715
|
*/
|
|
14967
14716
|
function ngHideDirective($animate) {
|
|
14968
14717
|
return {
|
|
@@ -15004,7 +14753,7 @@
|
|
|
15004
14753
|
* @param {Element} $element
|
|
15005
14754
|
* @param {ng.Attributes} $attr
|
|
15006
14755
|
* @param {*} _ctrl
|
|
15007
|
-
* @param {
|
|
14756
|
+
* @param {ng.TranscludeFn} $transclude
|
|
15008
14757
|
*/
|
|
15009
14758
|
link($scope, $element, $attr, _ctrl, $transclude) {
|
|
15010
14759
|
/** @type {Element | null | undefined} */
|
|
@@ -15019,23 +14768,28 @@
|
|
|
15019
14768
|
$scope.$watch($attr.ngIf, (value) => {
|
|
15020
14769
|
if (value) {
|
|
15021
14770
|
if (!childScope) {
|
|
15022
|
-
$transclude(
|
|
15023
|
-
|
|
15024
|
-
|
|
15025
|
-
|
|
15026
|
-
|
|
15027
|
-
|
|
15028
|
-
|
|
15029
|
-
|
|
15030
|
-
|
|
15031
|
-
|
|
15032
|
-
|
|
15033
|
-
|
|
15034
|
-
|
|
15035
|
-
|
|
15036
|
-
|
|
15037
|
-
|
|
15038
|
-
|
|
14771
|
+
$transclude(
|
|
14772
|
+
(
|
|
14773
|
+
/** @type {Element} */ clone,
|
|
14774
|
+
/** @type {ng.Scope} */ newScope,
|
|
14775
|
+
) => {
|
|
14776
|
+
childScope = newScope;
|
|
14777
|
+
// Note: We only need the first/last node of the cloned nodes.
|
|
14778
|
+
// However, we need to keep the reference to the dom wrapper as it might be changed later
|
|
14779
|
+
// by a directive with templateUrl when its template arrives.
|
|
14780
|
+
block = clone;
|
|
14781
|
+
|
|
14782
|
+
if (hasAnimate(/** @type {Node} */ (clone))) {
|
|
14783
|
+
$animate.enter(
|
|
14784
|
+
/** @type {Element} */ (clone),
|
|
14785
|
+
/** @type {Element} */ ($element.parentElement),
|
|
14786
|
+
$element,
|
|
14787
|
+
);
|
|
14788
|
+
} else {
|
|
14789
|
+
$element.after(/** @type {Node} */ (clone));
|
|
14790
|
+
}
|
|
14791
|
+
},
|
|
14792
|
+
);
|
|
15039
14793
|
}
|
|
15040
14794
|
} else {
|
|
15041
14795
|
if (previousElements) {
|
|
@@ -15154,9 +14908,9 @@
|
|
|
15154
14908
|
if (src) {
|
|
15155
14909
|
// set the 2nd param to true to ignore the template request error so that the inner
|
|
15156
14910
|
// contents and scope can be cleaned up.
|
|
15157
|
-
await $templateRequest(src
|
|
14911
|
+
await $templateRequest(src).then(
|
|
15158
14912
|
(response) => {
|
|
15159
|
-
if (scope
|
|
14913
|
+
if (scope._destroyed) return;
|
|
15160
14914
|
|
|
15161
14915
|
if (thisChangeId !== changeCounter) return;
|
|
15162
14916
|
const newScope = scope.$new();
|
|
@@ -15188,7 +14942,7 @@
|
|
|
15188
14942
|
scope.$eval(onloadExp);
|
|
15189
14943
|
},
|
|
15190
14944
|
(err) => {
|
|
15191
|
-
if (scope
|
|
14945
|
+
if (scope._destroyed) return;
|
|
15192
14946
|
|
|
15193
14947
|
if (thisChangeId === changeCounter) {
|
|
15194
14948
|
cleanupLastIncludeContent();
|
|
@@ -15231,7 +14985,7 @@
|
|
|
15231
14985
|
}
|
|
15232
14986
|
|
|
15233
14987
|
/**
|
|
15234
|
-
* @returns {
|
|
14988
|
+
* @returns {ng.Directive}
|
|
15235
14989
|
*/
|
|
15236
14990
|
function ngInitDirective() {
|
|
15237
14991
|
return {
|
|
@@ -15253,7 +15007,7 @@
|
|
|
15253
15007
|
}
|
|
15254
15008
|
|
|
15255
15009
|
/**
|
|
15256
|
-
* @returns {
|
|
15010
|
+
* @returns {ng.Directive}
|
|
15257
15011
|
*/
|
|
15258
15012
|
function ngNonBindableDirective() {
|
|
15259
15013
|
return {
|
|
@@ -15399,7 +15153,7 @@
|
|
|
15399
15153
|
if (keyIdentifier) scope[keyIdentifier] = key;
|
|
15400
15154
|
|
|
15401
15155
|
if (value) {
|
|
15402
|
-
scope.$target
|
|
15156
|
+
scope.$target._hashKey = value._hashKey;
|
|
15403
15157
|
}
|
|
15404
15158
|
scope.$index = index;
|
|
15405
15159
|
scope.$first = index === 0;
|
|
@@ -15727,7 +15481,7 @@
|
|
|
15727
15481
|
|
|
15728
15482
|
// asks for $scope to fool the BC controller module
|
|
15729
15483
|
controller: [
|
|
15730
|
-
|
|
15484
|
+
$injectTokens._scope,
|
|
15731
15485
|
class {
|
|
15732
15486
|
constructor() {
|
|
15733
15487
|
this.cases = {};
|
|
@@ -15756,19 +15510,20 @@
|
|
|
15756
15510
|
|
|
15757
15511
|
let ii;
|
|
15758
15512
|
|
|
15513
|
+
let runner;
|
|
15514
|
+
|
|
15759
15515
|
// Start with the last, in case the array is modified during the loop
|
|
15760
15516
|
while (previousLeaveAnimations.length) {
|
|
15761
15517
|
$animate.cancel(previousLeaveAnimations.pop());
|
|
15762
15518
|
}
|
|
15763
15519
|
|
|
15764
15520
|
for (i = 0, ii = selectedScopes.length; i < ii; ++i) {
|
|
15765
|
-
const selected =
|
|
15521
|
+
const selected = selectedElements[i].clone;
|
|
15766
15522
|
|
|
15767
15523
|
selectedScopes[i].$destroy();
|
|
15768
15524
|
|
|
15769
15525
|
if (hasAnimate(selected)) {
|
|
15770
|
-
|
|
15771
|
-
$animate.leave(selected));
|
|
15526
|
+
runner = previousLeaveAnimations[i] = $animate.leave(selected);
|
|
15772
15527
|
|
|
15773
15528
|
runner.done(spliceFactory(previousLeaveAnimations, i));
|
|
15774
15529
|
} else {
|
|
@@ -15798,7 +15553,13 @@
|
|
|
15798
15553
|
selectedElements.push(block);
|
|
15799
15554
|
|
|
15800
15555
|
if (hasAnimate(caseElement)) {
|
|
15801
|
-
|
|
15556
|
+
if (runner) {
|
|
15557
|
+
requestAnimationFrame(() => {
|
|
15558
|
+
$animate.enter(caseElement, anchor.parentElement, anchor);
|
|
15559
|
+
});
|
|
15560
|
+
} else {
|
|
15561
|
+
$animate.enter(caseElement, anchor.parentElement, anchor);
|
|
15562
|
+
}
|
|
15802
15563
|
} else {
|
|
15803
15564
|
domInsert(caseElement, anchor.parentElement, anchor);
|
|
15804
15565
|
}
|
|
@@ -15811,7 +15572,7 @@
|
|
|
15811
15572
|
}
|
|
15812
15573
|
|
|
15813
15574
|
/**
|
|
15814
|
-
* @returns {
|
|
15575
|
+
* @returns {ng.Directive}
|
|
15815
15576
|
*/
|
|
15816
15577
|
function ngSwitchWhenDirective() {
|
|
15817
15578
|
return {
|
|
@@ -15841,7 +15602,7 @@
|
|
|
15841
15602
|
}
|
|
15842
15603
|
|
|
15843
15604
|
/**
|
|
15844
|
-
* @returns {
|
|
15605
|
+
* @returns {ng.Directive}
|
|
15845
15606
|
*/
|
|
15846
15607
|
function ngSwitchDefaultDirective() {
|
|
15847
15608
|
return {
|
|
@@ -17471,13 +17232,21 @@
|
|
|
17471
17232
|
*
|
|
17472
17233
|
* @param {Element} element - the element which will be inserted into the DOM
|
|
17473
17234
|
* @param {Element} parent - the parent element which will append the element as a child (so long as the after element is not present)
|
|
17474
|
-
* @param {
|
|
17235
|
+
* @param {ChildNode | null | undefined} [after] - after the sibling element after which the element will be appended
|
|
17475
17236
|
* @param {import("./interface.ts").AnimationOptions} [options] - an optional collection of options/styles that will be applied to the element.
|
|
17476
17237
|
* @returns {import('./runner/animate-runner.js').AnimateRunner} the animation runner
|
|
17477
17238
|
*/
|
|
17478
17239
|
enter(element, parent, after, options) {
|
|
17479
17240
|
parent = parent || after.parentElement;
|
|
17480
|
-
|
|
17241
|
+
|
|
17242
|
+
if (
|
|
17243
|
+
isInstanceOf(element, HTMLElement) &&
|
|
17244
|
+
isInstanceOf(parent, HTMLElement)
|
|
17245
|
+
) {
|
|
17246
|
+
animatedomInsert(element, parent, after);
|
|
17247
|
+
} else {
|
|
17248
|
+
domInsert(element, parent, after);
|
|
17249
|
+
}
|
|
17481
17250
|
|
|
17482
17251
|
return $$animateQueue.push(
|
|
17483
17252
|
element,
|
|
@@ -17500,7 +17269,15 @@
|
|
|
17500
17269
|
*/
|
|
17501
17270
|
move(element, parent, after, options) {
|
|
17502
17271
|
parent = parent || after.parentElement;
|
|
17503
|
-
|
|
17272
|
+
|
|
17273
|
+
if (
|
|
17274
|
+
isInstanceOf(element, HTMLElement) &&
|
|
17275
|
+
isInstanceOf(parent, HTMLElement)
|
|
17276
|
+
) {
|
|
17277
|
+
animatedomInsert(element, parent, after);
|
|
17278
|
+
} else {
|
|
17279
|
+
domInsert(element, parent, after);
|
|
17280
|
+
}
|
|
17504
17281
|
|
|
17505
17282
|
return $$animateQueue.push(
|
|
17506
17283
|
element,
|
|
@@ -17539,7 +17316,7 @@
|
|
|
17539
17316
|
*
|
|
17540
17317
|
* @param {Element} element the element which the CSS classes will be applied to
|
|
17541
17318
|
* @param {string} className the CSS class(es) that will be added (multiple classes are separated via spaces)
|
|
17542
|
-
* @param {import("./interface").AnimationOptions} [options] an optional collection of options/styles that will be applied to the element.
|
|
17319
|
+
* @param {import("./interface.ts").AnimationOptions} [options] an optional collection of options/styles that will be applied to the element.
|
|
17543
17320
|
* @return {import('./runner/animate-runner.js').AnimateRunner}} animationRunner the animation runner
|
|
17544
17321
|
*/
|
|
17545
17322
|
addClass(element, className, options) {
|
|
@@ -17559,7 +17336,7 @@
|
|
|
17559
17336
|
*
|
|
17560
17337
|
* @param {Element} element the element which the CSS classes will be applied to
|
|
17561
17338
|
* @param {string} className the CSS class(es) that will be removed (multiple classes are separated via spaces)
|
|
17562
|
-
* @param {import("./interface").AnimationOptions} [options] an optional collection of options/styles that will be applied to the element. *
|
|
17339
|
+
* @param {import("./interface.ts").AnimationOptions} [options] an optional collection of options/styles that will be applied to the element. *
|
|
17563
17340
|
* @return {import('./runner/animate-runner.js').AnimateRunner} animationRunner the animation runner
|
|
17564
17341
|
*/
|
|
17565
17342
|
removeClass(element, className, options) {
|
|
@@ -18181,55 +17958,6 @@
|
|
|
18181
17958
|
}
|
|
18182
17959
|
}
|
|
18183
17960
|
|
|
18184
|
-
$IsStateFilter.$inject = [$injectTokens._state];
|
|
18185
|
-
|
|
18186
|
-
/**
|
|
18187
|
-
* `isState` Filter: truthy if the current state is the parameter
|
|
18188
|
-
*
|
|
18189
|
-
* Translates to [[StateService.is]] `$state.is("stateName")`.
|
|
18190
|
-
*
|
|
18191
|
-
* #### Example:
|
|
18192
|
-
* ```html
|
|
18193
|
-
* <div ng-if="'stateName' | isState">show if state is 'stateName'</div>
|
|
18194
|
-
* ```
|
|
18195
|
-
*
|
|
18196
|
-
* @param {import('./state/state-service.js').StateProvider} $state
|
|
18197
|
-
* @returns {ng.FilterFn}
|
|
18198
|
-
*/
|
|
18199
|
-
function $IsStateFilter($state) {
|
|
18200
|
-
const isFilter = (state, params, options) =>
|
|
18201
|
-
$state.is(state, params, options);
|
|
18202
|
-
|
|
18203
|
-
isFilter.$stateful = true;
|
|
18204
|
-
|
|
18205
|
-
return isFilter;
|
|
18206
|
-
}
|
|
18207
|
-
|
|
18208
|
-
$IncludedByStateFilter.$inject = [$injectTokens._state];
|
|
18209
|
-
|
|
18210
|
-
/**
|
|
18211
|
-
* `includedByState` Filter: truthy if the current state includes the parameter
|
|
18212
|
-
*
|
|
18213
|
-
* Translates to [[StateService.includes]]` $state.is("fullOrPartialStateName")`.
|
|
18214
|
-
*
|
|
18215
|
-
* #### Example:
|
|
18216
|
-
* ```html
|
|
18217
|
-
* <div ng-if="'fullOrPartialStateName' | includedByState">show if state includes 'fullOrPartialStateName'</div>
|
|
18218
|
-
* ```
|
|
18219
|
-
*
|
|
18220
|
-
* @param {import('./state/state-service.js').StateProvider} $state
|
|
18221
|
-
* @returns {ng.FilterFn}
|
|
18222
|
-
*/
|
|
18223
|
-
function $IncludedByStateFilter($state) {
|
|
18224
|
-
const includesFilter = function (state, params, options) {
|
|
18225
|
-
return $state.includes(state, params, options);
|
|
18226
|
-
};
|
|
18227
|
-
|
|
18228
|
-
includesFilter.$stateful = true;
|
|
18229
|
-
|
|
18230
|
-
return includesFilter;
|
|
18231
|
-
}
|
|
18232
|
-
|
|
18233
17961
|
/* @ignore */
|
|
18234
17962
|
const SUFFIX = "Filter";
|
|
18235
17963
|
|
|
@@ -18253,8 +17981,6 @@
|
|
|
18253
17981
|
json: jsonFilter,
|
|
18254
17982
|
limitTo: limitToFilter,
|
|
18255
17983
|
orderBy: orderByFilter,
|
|
18256
|
-
isState: $IsStateFilter,
|
|
18257
|
-
includedByState: $IncludedByStateFilter,
|
|
18258
17984
|
}).forEach(([k, v]) =>
|
|
18259
17985
|
this.register(k, /** @type {ng.FilterFactory} */ (v)),
|
|
18260
17986
|
);
|
|
@@ -18378,9 +18104,9 @@
|
|
|
18378
18104
|
: function (scope, locals) {
|
|
18379
18105
|
let lastValue;
|
|
18380
18106
|
|
|
18381
|
-
expressions.
|
|
18382
|
-
lastValue =
|
|
18383
|
-
}
|
|
18107
|
+
for (let i = 0, j = expressions.length; i < j; i++) {
|
|
18108
|
+
lastValue = expressions[i](scope, locals);
|
|
18109
|
+
}
|
|
18384
18110
|
|
|
18385
18111
|
return lastValue;
|
|
18386
18112
|
};
|
|
@@ -19027,7 +18753,7 @@
|
|
|
19027
18753
|
|
|
19028
18754
|
let argsToWatch;
|
|
19029
18755
|
|
|
19030
|
-
let
|
|
18756
|
+
let isFilter;
|
|
19031
18757
|
|
|
19032
18758
|
const decoratedNode = /** @type {DecoratedASTNode} */ (ast);
|
|
19033
18759
|
|
|
@@ -19158,10 +18884,8 @@
|
|
|
19158
18884
|
|
|
19159
18885
|
return decoratedNode;
|
|
19160
18886
|
case ASTType._CallExpression:
|
|
19161
|
-
|
|
19162
|
-
|
|
19163
|
-
: false;
|
|
19164
|
-
allConstants = isStatelessFilter;
|
|
18887
|
+
isFilter = ast.filter;
|
|
18888
|
+
allConstants = isFilter;
|
|
19165
18889
|
argsToWatch = [];
|
|
19166
18890
|
ast.arguments.forEach((expr) => {
|
|
19167
18891
|
decorated = findConstantAndWatchExpressions(expr, $filter, astIsPure);
|
|
@@ -19169,7 +18893,7 @@
|
|
|
19169
18893
|
argsToWatch.push.apply(argsToWatch, decorated.toWatch);
|
|
19170
18894
|
});
|
|
19171
18895
|
decoratedNode.constant = allConstants;
|
|
19172
|
-
decoratedNode.toWatch =
|
|
18896
|
+
decoratedNode.toWatch = isFilter ? argsToWatch : [decoratedNode];
|
|
19173
18897
|
|
|
19174
18898
|
return decoratedNode;
|
|
19175
18899
|
case ASTType._AssignmentExpression:
|
|
@@ -19316,12 +19040,6 @@
|
|
|
19316
19040
|
return undefined === parentIsPure ? PURITY_RELATIVE : parentIsPure;
|
|
19317
19041
|
}
|
|
19318
19042
|
|
|
19319
|
-
function isStateless($filter, filterName) {
|
|
19320
|
-
const fn = $filter(filterName);
|
|
19321
|
-
|
|
19322
|
-
return !fn.$stateful;
|
|
19323
|
-
}
|
|
19324
|
-
|
|
19325
19043
|
/**
|
|
19326
19044
|
* Converts parameter to strings property name for use as keys in an object.
|
|
19327
19045
|
* Any non-string object, including a number, is typecasted into a string via the toString method.
|
|
@@ -20363,7 +20081,7 @@
|
|
|
20363
20081
|
const fn = this._astCompiler.compile(ast);
|
|
20364
20082
|
|
|
20365
20083
|
fn.literal = isLiteral(ast);
|
|
20366
|
-
fn.constant =
|
|
20084
|
+
fn.constant = !!ast.constant;
|
|
20367
20085
|
|
|
20368
20086
|
return fn;
|
|
20369
20087
|
}
|
|
@@ -20381,18 +20099,25 @@
|
|
|
20381
20099
|
}
|
|
20382
20100
|
}
|
|
20383
20101
|
|
|
20102
|
+
/**
|
|
20103
|
+
* @param {import("../ast/ast-node.d.ts").ASTNode} ast
|
|
20104
|
+
* @returns {boolean}
|
|
20105
|
+
*/
|
|
20384
20106
|
function isLiteral(ast) {
|
|
20385
|
-
|
|
20386
|
-
ast.body.length === 0 ||
|
|
20387
|
-
(ast.body.length === 1 &&
|
|
20388
|
-
(ast.body[0].expression.type === ASTType._Literal ||
|
|
20389
|
-
ast.body[0].expression.type === ASTType._ArrayExpression ||
|
|
20390
|
-
ast.body[0].expression.type === ASTType._ObjectExpression))
|
|
20391
|
-
);
|
|
20392
|
-
}
|
|
20107
|
+
const { body } = ast;
|
|
20393
20108
|
|
|
20394
|
-
|
|
20395
|
-
|
|
20109
|
+
if (body && body.length === 1) {
|
|
20110
|
+
switch (body[0].expression?.type) {
|
|
20111
|
+
case ASTType._Literal:
|
|
20112
|
+
case ASTType._ArrayExpression:
|
|
20113
|
+
case ASTType._ObjectExpression:
|
|
20114
|
+
return true;
|
|
20115
|
+
default:
|
|
20116
|
+
return false;
|
|
20117
|
+
}
|
|
20118
|
+
} else {
|
|
20119
|
+
return true;
|
|
20120
|
+
}
|
|
20396
20121
|
}
|
|
20397
20122
|
|
|
20398
20123
|
class ParseProvider {
|
|
@@ -20437,7 +20162,7 @@
|
|
|
20437
20162
|
/**
|
|
20438
20163
|
*
|
|
20439
20164
|
* @param {(any) => any} $filter
|
|
20440
|
-
* @returns {import('./interface').ParseService}
|
|
20165
|
+
* @returns {import('./interface.ts').ParseService}
|
|
20441
20166
|
*/
|
|
20442
20167
|
function ($filter) {
|
|
20443
20168
|
/** @type {import("./lexer/lexer.js").LexerOptions} */
|
|
@@ -20488,7 +20213,7 @@
|
|
|
20488
20213
|
/**
|
|
20489
20214
|
* @param {Function} parsedExpression
|
|
20490
20215
|
* @param interceptorFn
|
|
20491
|
-
* @returns {import('./interface').CompiledExpression|*}
|
|
20216
|
+
* @returns {import('./interface.ts').CompiledExpression|*}
|
|
20492
20217
|
*/
|
|
20493
20218
|
function addInterceptor(parsedExpression, interceptorFn) {
|
|
20494
20219
|
if (!interceptorFn) {
|
|
@@ -20617,7 +20342,7 @@
|
|
|
20617
20342
|
* @param {ng.Scope} scope
|
|
20618
20343
|
* @param {Function} listener
|
|
20619
20344
|
* @param {*} objectEquality
|
|
20620
|
-
* @param {import('./interface').CompiledExpression} parsedExpression
|
|
20345
|
+
* @param {import('./interface.ts').CompiledExpression} parsedExpression
|
|
20621
20346
|
* @returns {any}
|
|
20622
20347
|
*/
|
|
20623
20348
|
function inputsWatchDelegate(
|
|
@@ -21184,19 +20909,19 @@
|
|
|
21184
20909
|
* The pathname, beginning with "/"
|
|
21185
20910
|
* @type {string}
|
|
21186
20911
|
*/
|
|
21187
|
-
let
|
|
20912
|
+
let _path;
|
|
21188
20913
|
|
|
21189
20914
|
/**
|
|
21190
|
-
* @type {Object.<string,boolean|Array
|
|
20915
|
+
* @type {Object.<string,boolean|Array<any>>}
|
|
21191
20916
|
*/
|
|
21192
|
-
let
|
|
20917
|
+
let _search;
|
|
21193
20918
|
|
|
21194
20919
|
/**
|
|
21195
20920
|
* @ignore
|
|
21196
20921
|
* The hash string, minus the hash symbol
|
|
21197
20922
|
* @type {string}
|
|
21198
20923
|
*/
|
|
21199
|
-
let
|
|
20924
|
+
let _hash;
|
|
21200
20925
|
|
|
21201
20926
|
class Location {
|
|
21202
20927
|
/**
|
|
@@ -21233,14 +20958,14 @@
|
|
|
21233
20958
|
* Current url
|
|
21234
20959
|
* @type {string}
|
|
21235
20960
|
*/
|
|
21236
|
-
this
|
|
20961
|
+
this._url = undefined;
|
|
21237
20962
|
|
|
21238
20963
|
/**
|
|
21239
20964
|
* @ignore
|
|
21240
20965
|
* Callback to update browser url
|
|
21241
|
-
* @type {Function}
|
|
20966
|
+
* @type {Function | undefined}
|
|
21242
20967
|
*/
|
|
21243
|
-
this
|
|
20968
|
+
this._updateBrowser = undefined;
|
|
21244
20969
|
}
|
|
21245
20970
|
|
|
21246
20971
|
/**
|
|
@@ -21271,7 +20996,7 @@
|
|
|
21271
20996
|
* @return {string} url
|
|
21272
20997
|
*/
|
|
21273
20998
|
getUrl() {
|
|
21274
|
-
return this
|
|
20999
|
+
return this._url;
|
|
21275
21000
|
}
|
|
21276
21001
|
|
|
21277
21002
|
/**
|
|
@@ -21283,8 +21008,8 @@
|
|
|
21283
21008
|
setPath(path) {
|
|
21284
21009
|
const newPath = path !== null ? path.toString() : "";
|
|
21285
21010
|
|
|
21286
|
-
|
|
21287
|
-
this
|
|
21011
|
+
_path = newPath.charAt(0) === "/" ? newPath : `/${newPath}`;
|
|
21012
|
+
this._compose();
|
|
21288
21013
|
|
|
21289
21014
|
return this;
|
|
21290
21015
|
}
|
|
@@ -21296,7 +21021,7 @@
|
|
|
21296
21021
|
* @return {string}
|
|
21297
21022
|
*/
|
|
21298
21023
|
getPath() {
|
|
21299
|
-
return
|
|
21024
|
+
return _path;
|
|
21300
21025
|
}
|
|
21301
21026
|
|
|
21302
21027
|
/**
|
|
@@ -21305,8 +21030,8 @@
|
|
|
21305
21030
|
* @return {Location} hash
|
|
21306
21031
|
*/
|
|
21307
21032
|
setHash(hash) {
|
|
21308
|
-
|
|
21309
|
-
this
|
|
21033
|
+
_hash = hash !== null ? hash.toString() : "";
|
|
21034
|
+
this._compose();
|
|
21310
21035
|
|
|
21311
21036
|
return this;
|
|
21312
21037
|
}
|
|
@@ -21316,7 +21041,7 @@
|
|
|
21316
21041
|
* @return {string} hash
|
|
21317
21042
|
*/
|
|
21318
21043
|
getHash() {
|
|
21319
|
-
return
|
|
21044
|
+
return _hash;
|
|
21320
21045
|
}
|
|
21321
21046
|
|
|
21322
21047
|
/**
|
|
@@ -21331,7 +21056,7 @@
|
|
|
21331
21056
|
case 1:
|
|
21332
21057
|
if (isString(search) || isNumber(search)) {
|
|
21333
21058
|
search = search.toString();
|
|
21334
|
-
|
|
21059
|
+
_search = parseKeyValue(search);
|
|
21335
21060
|
} else if (isObject(search)) {
|
|
21336
21061
|
search = structuredClone(search, {});
|
|
21337
21062
|
// remove object undefined or null properties
|
|
@@ -21339,7 +21064,7 @@
|
|
|
21339
21064
|
if (isNull(value)) delete search[key];
|
|
21340
21065
|
});
|
|
21341
21066
|
|
|
21342
|
-
|
|
21067
|
+
_search = search;
|
|
21343
21068
|
} else {
|
|
21344
21069
|
throw $locationMinErr(
|
|
21345
21070
|
"isrcharg",
|
|
@@ -21349,14 +21074,14 @@
|
|
|
21349
21074
|
break;
|
|
21350
21075
|
default:
|
|
21351
21076
|
if (isUndefined(paramValue) || paramValue === null) {
|
|
21352
|
-
delete
|
|
21077
|
+
delete _search[search];
|
|
21353
21078
|
} else {
|
|
21354
21079
|
// @ts-ignore
|
|
21355
|
-
|
|
21080
|
+
_search[search] = paramValue;
|
|
21356
21081
|
}
|
|
21357
21082
|
}
|
|
21358
21083
|
|
|
21359
|
-
this
|
|
21084
|
+
this._compose();
|
|
21360
21085
|
|
|
21361
21086
|
return this;
|
|
21362
21087
|
}
|
|
@@ -21367,20 +21092,20 @@
|
|
|
21367
21092
|
* @returns {Object} Search object or Location object
|
|
21368
21093
|
*/
|
|
21369
21094
|
getSearch() {
|
|
21370
|
-
return
|
|
21095
|
+
return _search;
|
|
21371
21096
|
}
|
|
21372
21097
|
|
|
21373
21098
|
/**
|
|
21374
21099
|
* @private
|
|
21375
21100
|
* Compose url and update `url` and `absUrl` property
|
|
21376
21101
|
*/
|
|
21377
|
-
|
|
21378
|
-
this
|
|
21102
|
+
_compose() {
|
|
21103
|
+
this._url = normalizePath(_path, _search, _hash);
|
|
21379
21104
|
this.absUrl = this.html5
|
|
21380
|
-
? this.appBaseNoFile + this
|
|
21381
|
-
: this.appBase + (this
|
|
21105
|
+
? this.appBaseNoFile + this._url.substring(1)
|
|
21106
|
+
: this.appBase + (this._url ? this.hashPrefix + this._url : "");
|
|
21382
21107
|
urlUpdatedByLocation = true;
|
|
21383
|
-
setTimeout(() => this
|
|
21108
|
+
setTimeout(() => this._updateBrowser && this._updateBrowser());
|
|
21384
21109
|
}
|
|
21385
21110
|
|
|
21386
21111
|
/**
|
|
@@ -21491,11 +21216,11 @@
|
|
|
21491
21216
|
|
|
21492
21217
|
parseAppUrl(pathUrl, true);
|
|
21493
21218
|
|
|
21494
|
-
if (
|
|
21495
|
-
|
|
21219
|
+
if (!_path) {
|
|
21220
|
+
_path = "/";
|
|
21496
21221
|
}
|
|
21497
21222
|
|
|
21498
|
-
this
|
|
21223
|
+
this._compose();
|
|
21499
21224
|
} else {
|
|
21500
21225
|
const withoutBaseUrl =
|
|
21501
21226
|
stripBaseUrl(this.appBase, url) ||
|
|
@@ -21529,9 +21254,9 @@
|
|
|
21529
21254
|
|
|
21530
21255
|
parseAppUrl(withoutHashUrl, false);
|
|
21531
21256
|
|
|
21532
|
-
|
|
21257
|
+
_path = removeWindowsDriveName(_path, withoutHashUrl, this.appBase);
|
|
21533
21258
|
|
|
21534
|
-
this
|
|
21259
|
+
this._compose();
|
|
21535
21260
|
|
|
21536
21261
|
/*
|
|
21537
21262
|
* In Windows, on an anchor node on documents loaded from
|
|
@@ -21581,16 +21306,17 @@
|
|
|
21581
21306
|
rewriteLinks: true,
|
|
21582
21307
|
};
|
|
21583
21308
|
|
|
21584
|
-
/** @type {Array<import("./interface.ts").UrlChangeListener>} */
|
|
21585
|
-
this.
|
|
21586
|
-
|
|
21587
|
-
|
|
21588
|
-
|
|
21589
|
-
|
|
21590
|
-
|
|
21591
|
-
|
|
21592
|
-
|
|
21593
|
-
|
|
21309
|
+
/** @private @type {Array<import("./interface.ts").UrlChangeListener>} */
|
|
21310
|
+
this._urlChangeListeners = [];
|
|
21311
|
+
/** @private */
|
|
21312
|
+
this._urlChangeInit = false;
|
|
21313
|
+
|
|
21314
|
+
/** @private @type {History['state']} */
|
|
21315
|
+
this._cachedState = null;
|
|
21316
|
+
/** @private @type {History['state']} */
|
|
21317
|
+
this._lastHistoryState = null;
|
|
21318
|
+
/** @private @type {string} */
|
|
21319
|
+
this._lastBrowserUrl = window.location.href;
|
|
21594
21320
|
this.cacheState();
|
|
21595
21321
|
}
|
|
21596
21322
|
|
|
@@ -21613,12 +21339,12 @@
|
|
|
21613
21339
|
if (url) {
|
|
21614
21340
|
url = new URL(url).href;
|
|
21615
21341
|
|
|
21616
|
-
if (this.
|
|
21342
|
+
if (this._lastBrowserUrl === url && this._lastHistoryState === state) {
|
|
21617
21343
|
return this;
|
|
21618
21344
|
}
|
|
21619
21345
|
|
|
21620
|
-
this.
|
|
21621
|
-
this.
|
|
21346
|
+
this._lastBrowserUrl = url;
|
|
21347
|
+
this._lastHistoryState = state;
|
|
21622
21348
|
history.pushState(state, "", url);
|
|
21623
21349
|
this.cacheState();
|
|
21624
21350
|
}
|
|
@@ -21639,7 +21365,7 @@
|
|
|
21639
21365
|
* @returns {History['state']} The cached state.
|
|
21640
21366
|
*/
|
|
21641
21367
|
state() {
|
|
21642
|
-
return this.
|
|
21368
|
+
return this._cachedState;
|
|
21643
21369
|
}
|
|
21644
21370
|
|
|
21645
21371
|
/**
|
|
@@ -21651,9 +21377,9 @@
|
|
|
21651
21377
|
const currentState = history.state ?? null;
|
|
21652
21378
|
|
|
21653
21379
|
if (!equals$1(currentState, this.lastCachedState)) {
|
|
21654
|
-
this.
|
|
21380
|
+
this._cachedState = currentState;
|
|
21655
21381
|
this.lastCachedState = currentState;
|
|
21656
|
-
this.
|
|
21382
|
+
this._lastHistoryState = currentState;
|
|
21657
21383
|
}
|
|
21658
21384
|
}
|
|
21659
21385
|
|
|
@@ -21661,20 +21387,20 @@
|
|
|
21661
21387
|
* Fires the state or URL change event.
|
|
21662
21388
|
*/
|
|
21663
21389
|
#fireStateOrUrlChange() {
|
|
21664
|
-
const prevLastHistoryState = this.
|
|
21390
|
+
const prevLastHistoryState = this._lastHistoryState;
|
|
21665
21391
|
|
|
21666
21392
|
this.cacheState();
|
|
21667
21393
|
|
|
21668
21394
|
if (
|
|
21669
|
-
this.
|
|
21670
|
-
prevLastHistoryState === this.
|
|
21395
|
+
this._lastBrowserUrl === this.getBrowserUrl() &&
|
|
21396
|
+
prevLastHistoryState === this._cachedState
|
|
21671
21397
|
) {
|
|
21672
21398
|
return;
|
|
21673
21399
|
}
|
|
21674
|
-
this.
|
|
21675
|
-
this.
|
|
21676
|
-
this.
|
|
21677
|
-
listener(trimEmptyHash(window.location.href), this.
|
|
21400
|
+
this._lastBrowserUrl = this.getBrowserUrl();
|
|
21401
|
+
this._lastHistoryState = this._cachedState;
|
|
21402
|
+
this._urlChangeListeners.forEach((listener) => {
|
|
21403
|
+
listener(trimEmptyHash(window.location.href), this._cachedState);
|
|
21678
21404
|
});
|
|
21679
21405
|
}
|
|
21680
21406
|
|
|
@@ -21685,7 +21411,7 @@
|
|
|
21685
21411
|
* @returns void
|
|
21686
21412
|
*/
|
|
21687
21413
|
#onUrlChange(callback) {
|
|
21688
|
-
if (!this.
|
|
21414
|
+
if (!this._urlChangeInit) {
|
|
21689
21415
|
window.addEventListener(
|
|
21690
21416
|
"popstate",
|
|
21691
21417
|
this.#fireStateOrUrlChange.bind(this),
|
|
@@ -21694,9 +21420,9 @@
|
|
|
21694
21420
|
"hashchange",
|
|
21695
21421
|
this.#fireStateOrUrlChange.bind(this),
|
|
21696
21422
|
);
|
|
21697
|
-
this.
|
|
21423
|
+
this._urlChangeInit = true;
|
|
21698
21424
|
}
|
|
21699
|
-
this.
|
|
21425
|
+
this._urlChangeListeners.push(callback);
|
|
21700
21426
|
}
|
|
21701
21427
|
|
|
21702
21428
|
$get = [
|
|
@@ -21932,12 +21658,16 @@
|
|
|
21932
21658
|
}
|
|
21933
21659
|
};
|
|
21934
21660
|
|
|
21935
|
-
$location
|
|
21661
|
+
$location._updateBrowser = updateBrowser;
|
|
21936
21662
|
updateBrowser();
|
|
21937
21663
|
$rootScope.$on("$updateBrowser", updateBrowser);
|
|
21938
21664
|
|
|
21939
21665
|
return $location;
|
|
21940
21666
|
|
|
21667
|
+
/**
|
|
21668
|
+
* @param {string} oldUrl
|
|
21669
|
+
* @param {any} oldState
|
|
21670
|
+
*/
|
|
21941
21671
|
function afterLocationChange(oldUrl, oldState) {
|
|
21942
21672
|
$rootScope.$broadcast(
|
|
21943
21673
|
"$locationChangeSuccess",
|
|
@@ -22091,13 +21821,13 @@
|
|
|
22091
21821
|
? match.pathname.substring(1)
|
|
22092
21822
|
: match.pathname;
|
|
22093
21823
|
|
|
22094
|
-
|
|
22095
|
-
|
|
22096
|
-
|
|
21824
|
+
_path = decodePath(path, html5Mode);
|
|
21825
|
+
_search = parseKeyValue(match.search);
|
|
21826
|
+
_hash = decodeURIComponent(match.hash);
|
|
22097
21827
|
|
|
22098
21828
|
// make sure path starts with '/';
|
|
22099
|
-
if (
|
|
22100
|
-
|
|
21829
|
+
if (_path && _path.charAt(0) !== "/") {
|
|
21830
|
+
_path = `/${_path}`;
|
|
22101
21831
|
}
|
|
22102
21832
|
}
|
|
22103
21833
|
|
|
@@ -22257,7 +21987,8 @@
|
|
|
22257
21987
|
* @param {string} type
|
|
22258
21988
|
*/
|
|
22259
21989
|
_consoleLog(type) {
|
|
22260
|
-
const console =
|
|
21990
|
+
const console =
|
|
21991
|
+
window.console || /** @type {Partial<Record<string, Function>>} */ ({});
|
|
22261
21992
|
|
|
22262
21993
|
const logFn =
|
|
22263
21994
|
console[type] ||
|
|
@@ -22266,7 +21997,7 @@
|
|
|
22266
21997
|
/* empty */
|
|
22267
21998
|
});
|
|
22268
21999
|
|
|
22269
|
-
return (...args) => {
|
|
22000
|
+
return (/** @type {any[]} */ ...args) => {
|
|
22270
22001
|
const formattedArgs = args.map((arg) => this._formatError(arg));
|
|
22271
22002
|
|
|
22272
22003
|
return logFn.apply(console, formattedArgs);
|
|
@@ -22349,7 +22080,7 @@
|
|
|
22349
22080
|
*
|
|
22350
22081
|
* @param {Object} target - The object to be wrapped in a proxy.
|
|
22351
22082
|
* @param {Scope} [context] - The context for the handler, used to track listeners.
|
|
22352
|
-
* @returns {Scope} - A proxy that intercepts operations on the target object,
|
|
22083
|
+
* @returns {Scope|Object} - A proxy that intercepts operations on the target object,
|
|
22353
22084
|
* or the original value if the target is not an object.
|
|
22354
22085
|
*/
|
|
22355
22086
|
function createScope(target = {}, context) {
|
|
@@ -22405,7 +22136,8 @@
|
|
|
22405
22136
|
target instanceof Promise ||
|
|
22406
22137
|
target instanceof HTMLCollection ||
|
|
22407
22138
|
target instanceof NodeList ||
|
|
22408
|
-
target instanceof Event
|
|
22139
|
+
target instanceof Event ||
|
|
22140
|
+
target instanceof Date
|
|
22409
22141
|
) {
|
|
22410
22142
|
return true;
|
|
22411
22143
|
}
|
|
@@ -22440,20 +22172,17 @@
|
|
|
22440
22172
|
/** @type {Map<string, Array<import('./interface.ts').Listener>>} Watch listeners */
|
|
22441
22173
|
this.watchers = context ? context.watchers : new Map();
|
|
22442
22174
|
|
|
22443
|
-
/** @type {Map<String, Function[]>} Event listeners */
|
|
22444
|
-
this
|
|
22445
|
-
|
|
22446
|
-
/** @type {Map<string, Array<import('./interface.ts').Listener>>} Watch listeners from other proxies */
|
|
22447
|
-
this.foreignListeners = context ? context.foreignListeners : new Map();
|
|
22175
|
+
/** @private @type {Map<String, Function[]>} Event listeners */
|
|
22176
|
+
this._listeners = new Map();
|
|
22448
22177
|
|
|
22449
|
-
/** @type {
|
|
22450
|
-
this.
|
|
22178
|
+
/** @private @type {Map<string, Array<import('./interface.ts').Listener>>} Watch listeners from other proxies */
|
|
22179
|
+
this._foreignListeners = context ? context._foreignListeners : new Map();
|
|
22451
22180
|
|
|
22452
|
-
/** @type {
|
|
22453
|
-
this.
|
|
22181
|
+
/** @private @type {Set<Proxy<ng.Scope>>} */
|
|
22182
|
+
this._foreignProxies = context ? context._foreignProxies : new Set();
|
|
22454
22183
|
|
|
22455
|
-
/** @type {
|
|
22456
|
-
this.
|
|
22184
|
+
/** @private @type {WeakMap<Object, Array<string>>} */
|
|
22185
|
+
this._objectListeners = context ? context._objectListeners : new WeakMap();
|
|
22457
22186
|
|
|
22458
22187
|
/** @type {Proxy<Scope>} Current proxy being operated on */
|
|
22459
22188
|
this.$proxy = null;
|
|
@@ -22488,40 +22217,39 @@
|
|
|
22488
22217
|
? null
|
|
22489
22218
|
: context;
|
|
22490
22219
|
|
|
22491
|
-
|
|
22492
|
-
|
|
22493
|
-
/** @type {boolean} */
|
|
22494
|
-
this.$$destroyed = false;
|
|
22220
|
+
/** @ignore @type {boolean} */
|
|
22221
|
+
this._destroyed = false;
|
|
22495
22222
|
|
|
22496
|
-
|
|
22223
|
+
/** @private @type {import("./interface.ts").Listener[]} A list of scheduled Event listeners */
|
|
22224
|
+
this._scheduled = [];
|
|
22497
22225
|
|
|
22498
22226
|
this.$scopename = undefined;
|
|
22499
22227
|
|
|
22500
22228
|
/** @private */
|
|
22501
22229
|
this.propertyMap = {
|
|
22502
|
-
$watch: this.$watch.bind(this),
|
|
22503
|
-
$new: this.$new.bind(this),
|
|
22504
|
-
$newIsolate: this.$newIsolate.bind(this),
|
|
22505
|
-
$destroy: this.$destroy.bind(this),
|
|
22506
|
-
$flushQueue: this.$flushQueue.bind(this),
|
|
22507
|
-
$eval: this.$eval.bind(this),
|
|
22508
22230
|
$apply: this.$apply.bind(this),
|
|
22509
|
-
$postUpdate: this.$postUpdate.bind(this),
|
|
22510
|
-
$isRoot: this.#isRoot.bind(this),
|
|
22511
|
-
$on: this.$on.bind(this),
|
|
22512
|
-
$emit: this.$emit.bind(this),
|
|
22513
22231
|
$broadcast: this.$broadcast.bind(this),
|
|
22514
|
-
$
|
|
22232
|
+
$children: this.$children,
|
|
22233
|
+
$destroy: this.$destroy.bind(this),
|
|
22234
|
+
$emit: this.$emit.bind(this),
|
|
22235
|
+
$eval: this.$eval.bind(this),
|
|
22236
|
+
$flushQueue: this.$flushQueue.bind(this),
|
|
22237
|
+
$getById: this.$getById.bind(this),
|
|
22515
22238
|
$handler: /** @type {Scope} */ (this),
|
|
22239
|
+
$id: this.$id,
|
|
22240
|
+
$isRoot: this.#isRoot.bind(this),
|
|
22516
22241
|
$merge: this.$merge.bind(this),
|
|
22517
|
-
$
|
|
22518
|
-
$
|
|
22519
|
-
$
|
|
22242
|
+
$new: this.$new.bind(this),
|
|
22243
|
+
$newIsolate: this.$newIsolate.bind(this),
|
|
22244
|
+
$on: this.$on.bind(this),
|
|
22520
22245
|
$parent: this.$parent,
|
|
22246
|
+
$postUpdate: this.$postUpdate.bind(this),
|
|
22247
|
+
$proxy: this.$proxy,
|
|
22521
22248
|
$root: this.$root,
|
|
22522
|
-
$children: this.$children,
|
|
22523
|
-
$id: this.$id,
|
|
22524
22249
|
$scopename: this.$scopename,
|
|
22250
|
+
$searchByName: this.$searchByName.bind(this),
|
|
22251
|
+
$transcluded: this.$transcluded.bind(this),
|
|
22252
|
+
$watch: this.$watch.bind(this),
|
|
22525
22253
|
};
|
|
22526
22254
|
}
|
|
22527
22255
|
|
|
@@ -22581,18 +22309,18 @@
|
|
|
22581
22309
|
this.#scheduleListener(listeners);
|
|
22582
22310
|
}
|
|
22583
22311
|
|
|
22584
|
-
const
|
|
22312
|
+
const _foreignListeners = this._foreignListeners.get(property);
|
|
22585
22313
|
|
|
22586
|
-
if (
|
|
22587
|
-
this.#scheduleListener(
|
|
22314
|
+
if (_foreignListeners) {
|
|
22315
|
+
this.#scheduleListener(_foreignListeners);
|
|
22588
22316
|
}
|
|
22589
22317
|
}
|
|
22590
22318
|
|
|
22591
|
-
if (this.
|
|
22592
|
-
this.
|
|
22319
|
+
if (this._objectListeners.get(target[property])) {
|
|
22320
|
+
this._objectListeners.delete(target[property]);
|
|
22593
22321
|
}
|
|
22594
22322
|
target[property] = createScope(value, this);
|
|
22595
|
-
this.
|
|
22323
|
+
this._objectListeners.set(target[property], [property]);
|
|
22596
22324
|
|
|
22597
22325
|
return true;
|
|
22598
22326
|
}
|
|
@@ -22613,10 +22341,10 @@
|
|
|
22613
22341
|
this.#scheduleListener(listeners);
|
|
22614
22342
|
}
|
|
22615
22343
|
|
|
22616
|
-
const
|
|
22344
|
+
const _foreignListeners = this._foreignListeners.get(property);
|
|
22617
22345
|
|
|
22618
|
-
if (
|
|
22619
|
-
this.#scheduleListener(
|
|
22346
|
+
if (_foreignListeners) {
|
|
22347
|
+
this.#scheduleListener(_foreignListeners);
|
|
22620
22348
|
}
|
|
22621
22349
|
|
|
22622
22350
|
this.#checkeListenersForAllKeys(value);
|
|
@@ -22669,8 +22397,8 @@
|
|
|
22669
22397
|
}
|
|
22670
22398
|
|
|
22671
22399
|
if (isArray(target)) {
|
|
22672
|
-
if (this.
|
|
22673
|
-
const keyList = this.
|
|
22400
|
+
if (this._objectListeners.has(proxy) && property !== "length") {
|
|
22401
|
+
const keyList = this._objectListeners.get(proxy);
|
|
22674
22402
|
|
|
22675
22403
|
for (let i = 0, l = keyList.length; i < l; i++) {
|
|
22676
22404
|
const currentListeners = this.watchers.get(keyList[i]);
|
|
@@ -22686,7 +22414,7 @@
|
|
|
22686
22414
|
return true;
|
|
22687
22415
|
} else {
|
|
22688
22416
|
if (isUndefined(target[property]) && isProxy(value)) {
|
|
22689
|
-
this.
|
|
22417
|
+
this._foreignProxies.add(/** @type {Proxy<ng.Scope>} */ (value));
|
|
22690
22418
|
target[property] = value;
|
|
22691
22419
|
|
|
22692
22420
|
if (!this.watchers.has(property)) {
|
|
@@ -22707,8 +22435,8 @@
|
|
|
22707
22435
|
|
|
22708
22436
|
// Handle the case where we need to start observing object after a watcher has been set
|
|
22709
22437
|
if (isUndefined(oldValue) && isObject(target[property])) {
|
|
22710
|
-
if (!this.
|
|
22711
|
-
this.
|
|
22438
|
+
if (!this._objectListeners.has(target[property])) {
|
|
22439
|
+
this._objectListeners.set(target[property], [property]);
|
|
22712
22440
|
}
|
|
22713
22441
|
const keyList = keys(value);
|
|
22714
22442
|
|
|
@@ -22771,25 +22499,25 @@
|
|
|
22771
22499
|
});
|
|
22772
22500
|
}
|
|
22773
22501
|
|
|
22774
|
-
let
|
|
22502
|
+
let _foreignListeners = this._foreignListeners.get(property);
|
|
22775
22503
|
|
|
22776
|
-
if (!
|
|
22777
|
-
|
|
22504
|
+
if (!_foreignListeners && this.$parent?._foreignListeners) {
|
|
22505
|
+
_foreignListeners = this.$parent._foreignListeners.get(property);
|
|
22778
22506
|
}
|
|
22779
22507
|
|
|
22780
|
-
if (
|
|
22781
|
-
let scheduled =
|
|
22508
|
+
if (_foreignListeners) {
|
|
22509
|
+
let scheduled = _foreignListeners;
|
|
22782
22510
|
|
|
22783
22511
|
// filter for repeaters
|
|
22784
|
-
const hashKey = this.$target
|
|
22512
|
+
const hashKey = this.$target._hashKey;
|
|
22785
22513
|
|
|
22786
22514
|
if (hashKey) {
|
|
22787
22515
|
scheduled = [];
|
|
22788
22516
|
|
|
22789
|
-
for (let i = 0, l =
|
|
22790
|
-
const listener =
|
|
22517
|
+
for (let i = 0, l = _foreignListeners.length; i < l; i++) {
|
|
22518
|
+
const listener = _foreignListeners[i];
|
|
22791
22519
|
|
|
22792
|
-
if (listener.originalTarget
|
|
22520
|
+
if (listener.originalTarget._hashKey === hashKey) {
|
|
22793
22521
|
scheduled.push(listener);
|
|
22794
22522
|
}
|
|
22795
22523
|
}
|
|
@@ -22801,15 +22529,15 @@
|
|
|
22801
22529
|
}
|
|
22802
22530
|
}
|
|
22803
22531
|
|
|
22804
|
-
if (this.
|
|
22805
|
-
const keyList = this.
|
|
22532
|
+
if (this._objectListeners.has(proxy) && property !== "length") {
|
|
22533
|
+
const keyList = this._objectListeners.get(proxy);
|
|
22806
22534
|
|
|
22807
22535
|
for (let i = 0, l = keyList.length; i < l; i++) {
|
|
22808
22536
|
const key = keyList[i];
|
|
22809
22537
|
|
|
22810
22538
|
const listeners = this.watchers.get(key);
|
|
22811
22539
|
|
|
22812
|
-
if (listeners && this.
|
|
22540
|
+
if (listeners && this._scheduled !== listeners) {
|
|
22813
22541
|
this.#scheduleListener(listeners);
|
|
22814
22542
|
}
|
|
22815
22543
|
}
|
|
@@ -22849,8 +22577,8 @@
|
|
|
22849
22577
|
isArray(target) &&
|
|
22850
22578
|
["pop", "shift", "unshift"].includes(/** @type { string } */ (property))
|
|
22851
22579
|
) {
|
|
22852
|
-
if (this.
|
|
22853
|
-
const keyList = this.
|
|
22580
|
+
if (this._objectListeners.has(proxy)) {
|
|
22581
|
+
const keyList = this._objectListeners.get(proxy);
|
|
22854
22582
|
|
|
22855
22583
|
for (let i = 0, l = keyList.length; i < l; i++) {
|
|
22856
22584
|
const key = keyList[i];
|
|
@@ -22858,13 +22586,13 @@
|
|
|
22858
22586
|
const listeners = this.watchers.get(key);
|
|
22859
22587
|
|
|
22860
22588
|
if (listeners) {
|
|
22861
|
-
this.
|
|
22589
|
+
this._scheduled = listeners;
|
|
22862
22590
|
}
|
|
22863
22591
|
}
|
|
22864
22592
|
}
|
|
22865
22593
|
|
|
22866
22594
|
if (property === "unshift") {
|
|
22867
|
-
this.#scheduleListener(this.
|
|
22595
|
+
this.#scheduleListener(this._scheduled);
|
|
22868
22596
|
}
|
|
22869
22597
|
}
|
|
22870
22598
|
|
|
@@ -22889,8 +22617,8 @@
|
|
|
22889
22617
|
this.#scheduleListener(listeners);
|
|
22890
22618
|
}
|
|
22891
22619
|
|
|
22892
|
-
if (this.
|
|
22893
|
-
const keyList = this.
|
|
22620
|
+
if (this._objectListeners.has(this.$proxy)) {
|
|
22621
|
+
const keyList = this._objectListeners.get(this.$proxy);
|
|
22894
22622
|
|
|
22895
22623
|
for (let i = 0, l = keyList.length; i < l; i++) {
|
|
22896
22624
|
const key = keyList[i];
|
|
@@ -22901,9 +22629,9 @@
|
|
|
22901
22629
|
}
|
|
22902
22630
|
}
|
|
22903
22631
|
|
|
22904
|
-
if (this.
|
|
22905
|
-
this.#scheduleListener(this.
|
|
22906
|
-
this.
|
|
22632
|
+
if (this._scheduled) {
|
|
22633
|
+
this.#scheduleListener(this._scheduled);
|
|
22634
|
+
this._scheduled = [];
|
|
22907
22635
|
}
|
|
22908
22636
|
|
|
22909
22637
|
return true;
|
|
@@ -22911,8 +22639,8 @@
|
|
|
22911
22639
|
|
|
22912
22640
|
delete target[property];
|
|
22913
22641
|
|
|
22914
|
-
if (this.
|
|
22915
|
-
const keyList = this.
|
|
22642
|
+
if (this._objectListeners.has(this.$proxy)) {
|
|
22643
|
+
const keyList = this._objectListeners.get(this.$proxy);
|
|
22916
22644
|
|
|
22917
22645
|
for (let i = 0, l = keyList.length; i < l; i++) {
|
|
22918
22646
|
const key = keyList[i];
|
|
@@ -23154,7 +22882,7 @@
|
|
|
23154
22882
|
watchProp.split(".").slice(0, -1).join("."),
|
|
23155
22883
|
)(/** @type {Scope} */ (listener.originalTarget));
|
|
23156
22884
|
|
|
23157
|
-
if (potentialProxy && this.
|
|
22885
|
+
if (potentialProxy && this._foreignProxies.has(potentialProxy)) {
|
|
23158
22886
|
potentialProxy.$handler.#registerForeignKey(key, listener);
|
|
23159
22887
|
potentialProxy.$handler.#scheduleListener([listener]);
|
|
23160
22888
|
|
|
@@ -23237,7 +22965,7 @@
|
|
|
23237
22965
|
const listenerObject = listener.watchFn(this.$target);
|
|
23238
22966
|
|
|
23239
22967
|
if (isObject(listenerObject)) {
|
|
23240
|
-
this.
|
|
22968
|
+
this._objectListeners.set(listenerObject, [key]);
|
|
23241
22969
|
}
|
|
23242
22970
|
|
|
23243
22971
|
if (keySet.length > 0) {
|
|
@@ -23331,10 +23059,10 @@
|
|
|
23331
23059
|
|
|
23332
23060
|
/** @internal **/
|
|
23333
23061
|
#registerForeignKey(key, listener) {
|
|
23334
|
-
if (this.
|
|
23335
|
-
this.
|
|
23062
|
+
if (this._foreignListeners.has(key)) {
|
|
23063
|
+
this._foreignListeners.get(key).push(listener);
|
|
23336
23064
|
} else {
|
|
23337
|
-
this.
|
|
23065
|
+
this._foreignListeners.set(key, [listener]);
|
|
23338
23066
|
}
|
|
23339
23067
|
}
|
|
23340
23068
|
|
|
@@ -23359,7 +23087,7 @@
|
|
|
23359
23087
|
}
|
|
23360
23088
|
|
|
23361
23089
|
// #deregisterForeignKey(key, id) {
|
|
23362
|
-
// const listenerList = this.
|
|
23090
|
+
// const listenerList = this._foreignListeners.get(key);
|
|
23363
23091
|
// if (!listenerList) return false;
|
|
23364
23092
|
|
|
23365
23093
|
// const index = listenerList.findIndex((x) => x.id === id);
|
|
@@ -23367,9 +23095,9 @@
|
|
|
23367
23095
|
|
|
23368
23096
|
// listenerList.splice(index, 1);
|
|
23369
23097
|
// if (listenerList.length) {
|
|
23370
|
-
// this.
|
|
23098
|
+
// this._foreignListeners.set(key, listenerList);
|
|
23371
23099
|
// } else {
|
|
23372
|
-
// this.
|
|
23100
|
+
// this._foreignListeners.delete(key);
|
|
23373
23101
|
// }
|
|
23374
23102
|
// return true;
|
|
23375
23103
|
// }
|
|
@@ -23429,11 +23157,11 @@
|
|
|
23429
23157
|
* @returns {(function(): void)|*}
|
|
23430
23158
|
*/
|
|
23431
23159
|
$on(name, listener) {
|
|
23432
|
-
let namedListeners = this
|
|
23160
|
+
let namedListeners = this._listeners.get(name);
|
|
23433
23161
|
|
|
23434
23162
|
if (!namedListeners) {
|
|
23435
23163
|
namedListeners = [];
|
|
23436
|
-
this
|
|
23164
|
+
this._listeners.set(name, namedListeners);
|
|
23437
23165
|
}
|
|
23438
23166
|
namedListeners.push(listener);
|
|
23439
23167
|
|
|
@@ -23444,7 +23172,7 @@
|
|
|
23444
23172
|
namedListeners.splice(indexOfListener, 1);
|
|
23445
23173
|
|
|
23446
23174
|
if (namedListeners.length === 0) {
|
|
23447
|
-
this
|
|
23175
|
+
this._listeners.delete(name);
|
|
23448
23176
|
}
|
|
23449
23177
|
}
|
|
23450
23178
|
};
|
|
@@ -23480,7 +23208,7 @@
|
|
|
23480
23208
|
*/
|
|
23481
23209
|
#eventHelper({ name, event, broadcast }, ...args) {
|
|
23482
23210
|
if (!broadcast) {
|
|
23483
|
-
if (!this
|
|
23211
|
+
if (!this._listeners.has(name)) {
|
|
23484
23212
|
if (this.$parent) {
|
|
23485
23213
|
return this.$parent.$handler.#eventHelper(
|
|
23486
23214
|
{ name, event, broadcast },
|
|
@@ -23512,7 +23240,7 @@
|
|
|
23512
23240
|
|
|
23513
23241
|
const listenerArgs = concat([event], [event].concat(args), 1);
|
|
23514
23242
|
|
|
23515
|
-
const listeners = this
|
|
23243
|
+
const listeners = this._listeners.get(name);
|
|
23516
23244
|
|
|
23517
23245
|
if (listeners) {
|
|
23518
23246
|
let { length } = listeners;
|
|
@@ -23579,7 +23307,7 @@
|
|
|
23579
23307
|
}
|
|
23580
23308
|
|
|
23581
23309
|
$destroy() {
|
|
23582
|
-
if (this
|
|
23310
|
+
if (this._destroyed) return;
|
|
23583
23311
|
|
|
23584
23312
|
this.$broadcast("$destroy");
|
|
23585
23313
|
|
|
@@ -23610,8 +23338,8 @@
|
|
|
23610
23338
|
}
|
|
23611
23339
|
}
|
|
23612
23340
|
|
|
23613
|
-
this
|
|
23614
|
-
this
|
|
23341
|
+
this._listeners.clear();
|
|
23342
|
+
this._destroyed = true;
|
|
23615
23343
|
}
|
|
23616
23344
|
|
|
23617
23345
|
/**
|
|
@@ -23693,31 +23421,23 @@
|
|
|
23693
23421
|
* @returns {ng.Scope|undefined}
|
|
23694
23422
|
*/
|
|
23695
23423
|
$searchByName(name) {
|
|
23696
|
-
|
|
23697
|
-
* @param {ng.Scope} scope
|
|
23698
|
-
* @param {string} nameParam
|
|
23699
|
-
* @returns {ng.Scope|undefined}
|
|
23700
|
-
*/
|
|
23701
|
-
function getByName(scope, nameParam) {
|
|
23702
|
-
if (scope.$scopename === nameParam) {
|
|
23703
|
-
return scope;
|
|
23704
|
-
} else {
|
|
23705
|
-
let res = undefined;
|
|
23424
|
+
const stack = [this.$root];
|
|
23706
23425
|
|
|
23707
|
-
|
|
23708
|
-
|
|
23426
|
+
while (stack.length) {
|
|
23427
|
+
const scope = stack.pop();
|
|
23709
23428
|
|
|
23710
|
-
|
|
23711
|
-
|
|
23712
|
-
|
|
23713
|
-
}
|
|
23714
|
-
}
|
|
23429
|
+
if (scope.$scopename === name) {
|
|
23430
|
+
return scope;
|
|
23431
|
+
}
|
|
23715
23432
|
|
|
23716
|
-
|
|
23433
|
+
if (scope.$children?.length) {
|
|
23434
|
+
for (let i = scope.$children.length - 1; i >= 0; i--) {
|
|
23435
|
+
stack.push(scope.$children[i]);
|
|
23436
|
+
}
|
|
23717
23437
|
}
|
|
23718
23438
|
}
|
|
23719
23439
|
|
|
23720
|
-
return
|
|
23440
|
+
return undefined;
|
|
23721
23441
|
}
|
|
23722
23442
|
}
|
|
23723
23443
|
|
|
@@ -23769,146 +23489,65 @@
|
|
|
23769
23489
|
return ids;
|
|
23770
23490
|
}
|
|
23771
23491
|
|
|
23772
|
-
const $templateRequestMinErr = minErr("$templateRequest");
|
|
23773
|
-
|
|
23774
23492
|
/**
|
|
23775
|
-
*
|
|
23493
|
+
* Provider for the `$templateRequest` service.
|
|
23776
23494
|
*
|
|
23777
|
-
*
|
|
23778
|
-
*
|
|
23495
|
+
* Fetches templates via HTTP and caches them in `$templateCache`.
|
|
23496
|
+
* Templates are assumed trusted. This provider allows configuring
|
|
23497
|
+
* per-request `$http` options such as headers, timeout, or transform functions.
|
|
23779
23498
|
*/
|
|
23780
|
-
|
|
23781
|
-
|
|
23499
|
+
class TemplateRequestProvider {
|
|
23500
|
+
/** @type {ng.RequestShortcutConfig|undefined} */
|
|
23501
|
+
httpOptions;
|
|
23782
23502
|
|
|
23783
|
-
/**
|
|
23784
|
-
|
|
23785
|
-
* You can use this to override options such as the "Accept" header for template requests.
|
|
23786
|
-
* The {@link $templateRequest} will set the `cache` and the `transformResponse` properties of the
|
|
23787
|
-
* options if not overridden here.
|
|
23788
|
-
*
|
|
23789
|
-
* @param {string=} val new value for the {@link $http} options.
|
|
23790
|
-
* @returns {string|TemplateRequestProvider} Returns the {@link $http} options when used as getter and self if used as setter.
|
|
23791
|
-
*/
|
|
23792
|
-
this.httpOptions = function (val) {
|
|
23793
|
-
if (val) {
|
|
23794
|
-
httpOptions = val;
|
|
23795
|
-
|
|
23796
|
-
return this;
|
|
23797
|
-
}
|
|
23798
|
-
|
|
23799
|
-
return httpOptions;
|
|
23800
|
-
};
|
|
23801
|
-
|
|
23802
|
-
/**
|
|
23803
|
-
* The `$templateRequest` service runs security checks then downloads the provided template using
|
|
23804
|
-
* `$http` and, upon success, stores the contents inside of `$templateCache`. If the HTTP request
|
|
23805
|
-
* fails or the response data of the HTTP request is empty, a `$compile` error will be thrown (the
|
|
23806
|
-
* exception can be thwarted by setting the 2nd parameter of the function to true). Note that the
|
|
23807
|
-
* contents of `$templateCache` are trusted, so the call to `$sce.getTrustedUrl(tpl)` is omitted
|
|
23808
|
-
* when `tpl` is of type string and `$templateCache` has the matching entry.
|
|
23809
|
-
*
|
|
23810
|
-
* If you want to pass custom options to the `$http` service, such as setting the Accept header you
|
|
23811
|
-
* can configure this via {@link $templateRequestProvider#httpOptions}.
|
|
23812
|
-
*
|
|
23813
|
-
* `$templateRequest` is used internally by {@link $compile}, {@link ngRoute.$route}, and directives such
|
|
23814
|
-
* as {@link ngInclude} to download and cache templates.
|
|
23815
|
-
*
|
|
23816
|
-
* 3rd party modules should use `$templateRequest` if their services or directives are loading
|
|
23817
|
-
* templates.
|
|
23818
|
-
*
|
|
23819
|
-
* @param {string} tpl The HTTP request template URL
|
|
23820
|
-
* @param {boolean=} ignoreRequestError Whether or not to ignore the exception when the request fails or the template is empty
|
|
23821
|
-
*
|
|
23822
|
-
* @return {Promise} a promise for the HTTP response data of the given URL.
|
|
23823
|
-
*
|
|
23824
|
-
* @property {number} totalPendingRequests total amount of pending template requests being downloaded.
|
|
23825
|
-
*/
|
|
23826
|
-
this.$get = [
|
|
23827
|
-
$injectTokens._exceptionHandler,
|
|
23503
|
+
/** @returns {Array} DI tokens for Angular.ts injection */
|
|
23504
|
+
$get = [
|
|
23828
23505
|
$injectTokens._templateCache,
|
|
23829
23506
|
$injectTokens._http,
|
|
23830
|
-
$injectTokens._sce,
|
|
23831
23507
|
/**
|
|
23832
|
-
*
|
|
23833
|
-
* @param {ng.ExceptionHandlerService} $exceptionHandler
|
|
23834
23508
|
* @param {ng.TemplateCacheService} $templateCache
|
|
23835
23509
|
* @param {ng.HttpService} $http
|
|
23836
|
-
* @param {*} $sce
|
|
23837
23510
|
* @returns {ng.TemplateRequestService}
|
|
23838
23511
|
*/
|
|
23839
|
-
|
|
23840
|
-
|
|
23841
|
-
|
|
23842
|
-
|
|
23843
|
-
|
|
23844
|
-
|
|
23845
|
-
|
|
23846
|
-
|
|
23847
|
-
//
|
|
23848
|
-
|
|
23849
|
-
if (!isString(tpl) || !$templateCache.has(tpl)) {
|
|
23850
|
-
try {
|
|
23851
|
-
tpl = $sce.getTrustedResourceUrl(tpl);
|
|
23852
|
-
|
|
23853
|
-
if (!tpl) {
|
|
23854
|
-
return Promise.reject("Template not found");
|
|
23855
|
-
}
|
|
23856
|
-
} catch (err) {
|
|
23857
|
-
return Promise.reject(err.message);
|
|
23858
|
-
}
|
|
23859
|
-
}
|
|
23860
|
-
|
|
23861
|
-
let transformResponse =
|
|
23862
|
-
$http.defaults && $http.defaults.transformResponse;
|
|
23512
|
+
($templateCache, $http) => {
|
|
23513
|
+
/**
|
|
23514
|
+
* Fetch a template via HTTP and cache it.
|
|
23515
|
+
*
|
|
23516
|
+
* @param {string} templateUrl URL of the template
|
|
23517
|
+
* @returns {Promise<string>} Resolves with template content
|
|
23518
|
+
*/
|
|
23519
|
+
const fetchTemplate = (templateUrl) => {
|
|
23520
|
+
// Filter out default transformResponse for template requests
|
|
23521
|
+
let transformResponse = $http.defaults?.transformResponse ?? null;
|
|
23863
23522
|
|
|
23864
23523
|
if (isArray(transformResponse)) {
|
|
23865
|
-
transformResponse = transformResponse.filter(
|
|
23866
|
-
|
|
23867
|
-
|
|
23524
|
+
transformResponse = transformResponse.filter(
|
|
23525
|
+
(x) => x !== defaultHttpResponseTransform,
|
|
23526
|
+
);
|
|
23868
23527
|
} else if (transformResponse === defaultHttpResponseTransform) {
|
|
23869
23528
|
transformResponse = null;
|
|
23870
23529
|
}
|
|
23871
23530
|
|
|
23872
|
-
|
|
23873
|
-
|
|
23874
|
-
|
|
23875
|
-
|
|
23876
|
-
|
|
23877
|
-
|
|
23878
|
-
|
|
23879
|
-
|
|
23880
|
-
httpOptions,
|
|
23881
|
-
),
|
|
23882
|
-
)
|
|
23883
|
-
.finally(function () {
|
|
23884
|
-
handleRequestFn.totalPendingRequests--;
|
|
23885
|
-
})
|
|
23886
|
-
.then(function (response) {
|
|
23887
|
-
$templateCache.set(tpl, response.data);
|
|
23888
|
-
|
|
23889
|
-
return response.data;
|
|
23890
|
-
}, handleError);
|
|
23891
|
-
|
|
23892
|
-
function handleError(resp) {
|
|
23893
|
-
if (!ignoreRequestError) {
|
|
23894
|
-
resp = $templateRequestMinErr(
|
|
23895
|
-
"tpload",
|
|
23896
|
-
"Failed to load template: {0} (HTTP status: {1} {2})",
|
|
23897
|
-
tpl,
|
|
23898
|
-
resp.status,
|
|
23899
|
-
resp.statusText,
|
|
23900
|
-
);
|
|
23901
|
-
|
|
23902
|
-
$exceptionHandler(resp);
|
|
23903
|
-
}
|
|
23531
|
+
/** @type {ng.RequestShortcutConfig} */
|
|
23532
|
+
const config = extend(
|
|
23533
|
+
{
|
|
23534
|
+
cache: $templateCache,
|
|
23535
|
+
transformResponse,
|
|
23536
|
+
},
|
|
23537
|
+
this.httpOptions || {},
|
|
23538
|
+
);
|
|
23904
23539
|
|
|
23905
|
-
|
|
23906
|
-
|
|
23907
|
-
|
|
23540
|
+
return $http.get(templateUrl, config).then(
|
|
23541
|
+
(response) => {
|
|
23542
|
+
$templateCache.set(templateUrl, response.data);
|
|
23908
23543
|
|
|
23909
|
-
|
|
23544
|
+
return response.data;
|
|
23545
|
+
},
|
|
23546
|
+
(resp) => Promise.reject(resp),
|
|
23547
|
+
);
|
|
23548
|
+
};
|
|
23910
23549
|
|
|
23911
|
-
return
|
|
23550
|
+
return fetchTemplate;
|
|
23912
23551
|
},
|
|
23913
23552
|
];
|
|
23914
23553
|
}
|
|
@@ -24248,12 +23887,12 @@
|
|
|
24248
23887
|
const src = attrs.ngMessagesInclude || attrs.src;
|
|
24249
23888
|
|
|
24250
23889
|
$templateRequest(src).then((html) => {
|
|
24251
|
-
if ($scope
|
|
23890
|
+
if ($scope._destroyed) return;
|
|
24252
23891
|
|
|
24253
23892
|
if (isString(html) && !html.trim()) ; else {
|
|
24254
23893
|
// Non-empty template - compile and link
|
|
24255
23894
|
$compile(html)($scope, (contents) => {
|
|
24256
|
-
|
|
23895
|
+
isInstanceOf(contents, Node) && element.after(contents);
|
|
24257
23896
|
});
|
|
24258
23897
|
}
|
|
24259
23898
|
});
|
|
@@ -24404,11 +24043,7 @@
|
|
|
24404
24043
|
];
|
|
24405
24044
|
|
|
24406
24045
|
const isNodeOneOf = function (elem, nodeTypeArray) {
|
|
24407
|
-
|
|
24408
|
-
return true;
|
|
24409
|
-
}
|
|
24410
|
-
|
|
24411
|
-
return false;
|
|
24046
|
+
return nodeTypeArray.indexOf(elem.nodeName) !== -1;
|
|
24412
24047
|
};
|
|
24413
24048
|
|
|
24414
24049
|
/**
|
|
@@ -27646,7 +27281,7 @@
|
|
|
27646
27281
|
_nextTick() {
|
|
27647
27282
|
if (!this._queue.length) return;
|
|
27648
27283
|
|
|
27649
|
-
const items = this._queue.shift();
|
|
27284
|
+
const items = /** @type{Array<() => void>} */ (this._queue.shift());
|
|
27650
27285
|
|
|
27651
27286
|
items.forEach((fn) => fn());
|
|
27652
27287
|
|
|
@@ -28583,7 +28218,7 @@
|
|
|
28583
28218
|
/**
|
|
28584
28219
|
* Returns the last element of an array, or undefined if the array is empty.
|
|
28585
28220
|
* @template T
|
|
28586
|
-
* @param {
|
|
28221
|
+
* @param {any[]|string} arr - The input array.
|
|
28587
28222
|
* @returns {T | undefined} The last element or undefined.
|
|
28588
28223
|
*/
|
|
28589
28224
|
function tail(arr) {
|
|
@@ -28654,16 +28289,16 @@
|
|
|
28654
28289
|
*
|
|
28655
28290
|
* ```
|
|
28656
28291
|
*
|
|
28657
|
-
* @param fn
|
|
28292
|
+
* @param {Function} fn
|
|
28658
28293
|
* @returns {*|function(): (*|any)}
|
|
28659
28294
|
*/
|
|
28660
28295
|
function curry(fn) {
|
|
28661
|
-
const curried = (...args) => {
|
|
28296
|
+
const curried = (/** @type {any[]} */ ...args) => {
|
|
28662
28297
|
if (args.length >= fn.length) {
|
|
28663
28298
|
return fn(...args);
|
|
28664
28299
|
}
|
|
28665
28300
|
|
|
28666
|
-
return (...nextArgs) => curried(...args, ...nextArgs);
|
|
28301
|
+
return (/** @type {any} */ ...nextArgs) => curried(...args, ...nextArgs);
|
|
28667
28302
|
};
|
|
28668
28303
|
|
|
28669
28304
|
return curried;
|
|
@@ -28676,7 +28311,13 @@
|
|
|
28676
28311
|
* let getName = propEq("name", "blarg");
|
|
28677
28312
|
* getName(obj) === true
|
|
28678
28313
|
*/
|
|
28679
|
-
const propEq = curry(
|
|
28314
|
+
const propEq = curry(
|
|
28315
|
+
(
|
|
28316
|
+
/** @type {string | number} */ name,
|
|
28317
|
+
/** @type {any} */ _val,
|
|
28318
|
+
/** @type {{ [x: string]: any; }} */ obj,
|
|
28319
|
+
) => obj && obj[name] === _val,
|
|
28320
|
+
);
|
|
28680
28321
|
/**
|
|
28681
28322
|
* Given a dotted property name, returns a function that returns a nested property from an object, or undefined
|
|
28682
28323
|
* let obj = { id: 1, nestedObj: { foo: 1, name: "blarg" }, };
|
|
@@ -28685,10 +28326,11 @@
|
|
|
28685
28326
|
* let propNotFound = prop("this.property.doesnt.exist");
|
|
28686
28327
|
* propNotFound(obj) === undefined
|
|
28687
28328
|
*/
|
|
28688
|
-
const parse = (path) => {
|
|
28329
|
+
const parse = (/** @type {string} */ path) => {
|
|
28689
28330
|
const parts = path.split(".");
|
|
28690
28331
|
|
|
28691
|
-
return (
|
|
28332
|
+
return (/** @type {any} */ obj) =>
|
|
28333
|
+
parts.reduce((acc, key) => acc && acc[key], obj);
|
|
28692
28334
|
};
|
|
28693
28335
|
|
|
28694
28336
|
/**
|
|
@@ -28713,7 +28355,12 @@
|
|
|
28713
28355
|
};
|
|
28714
28356
|
}
|
|
28715
28357
|
|
|
28716
|
-
/**
|
|
28358
|
+
/**
|
|
28359
|
+
* Given a value, returns a function which returns that value.
|
|
28360
|
+
* @template T
|
|
28361
|
+
* @param {T} value - The value to wrap in a function.
|
|
28362
|
+
* @returns {() => T} A function that returns the given value.
|
|
28363
|
+
*/
|
|
28717
28364
|
const val = (value) => () => value;
|
|
28718
28365
|
|
|
28719
28366
|
/**
|
|
@@ -28730,31 +28377,28 @@
|
|
|
28730
28377
|
* of size 2: [ predicate, mapFn ]
|
|
28731
28378
|
*
|
|
28732
28379
|
* These 2-tuples should be put in an outer array.
|
|
28733
|
-
*
|
|
28734
|
-
|
|
28735
|
-
|
|
28736
|
-
|
|
28737
|
-
|
|
28738
|
-
|
|
28739
|
-
|
|
28740
|
-
|
|
28741
|
-
|
|
28742
|
-
|
|
28743
|
-
|
|
28744
|
-
|
|
28745
|
-
|
|
28746
|
-
|
|
28747
|
-
|
|
28748
|
-
|
|
28749
|
-
|
|
28750
|
-
|
|
28751
|
-
|
|
28752
|
-
*
|
|
28753
|
-
|
|
28754
|
-
*
|
|
28755
|
-
* @param struct A 2D array. Each element of the array should be an array, a 2-tuple,
|
|
28756
|
-
* with a Predicate and a mapping/output function
|
|
28757
|
-
* @returns {function(any): *}
|
|
28380
|
+
* @example ```
|
|
28381
|
+
|
|
28382
|
+
// Here's a 2-tuple where the first element is the isString predicate
|
|
28383
|
+
// and the second element is a function that returns a description of the input
|
|
28384
|
+
let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ];
|
|
28385
|
+
|
|
28386
|
+
// Second tuple: predicate "isNumber", mapfn returns a description
|
|
28387
|
+
let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ];
|
|
28388
|
+
|
|
28389
|
+
let third = [ (input) => input === null, (input) => `Oh, null...` ];
|
|
28390
|
+
|
|
28391
|
+
let fourth = [ (input) => input === undefined, (input) => `notdefined` ];
|
|
28392
|
+
|
|
28393
|
+
let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]);
|
|
28394
|
+
|
|
28395
|
+
console.log(descriptionOf(undefined)); // 'notdefined'
|
|
28396
|
+
console.log(descriptionOf(55)); // '(55) That's a number!'
|
|
28397
|
+
console.log(descriptionOf("foo")); // 'Here's your string foo'
|
|
28398
|
+
```
|
|
28399
|
+
* @param {string | any[]} struct A 2D array. Each element of the array should be an array, a 2-tuple,
|
|
28400
|
+
with a Predicate and a mapping/output function
|
|
28401
|
+
* @returns {function(any):*}
|
|
28758
28402
|
*/
|
|
28759
28403
|
function pattern(struct) {
|
|
28760
28404
|
return function (item) {
|
|
@@ -29414,17 +29058,23 @@
|
|
|
29414
29058
|
/**
|
|
29415
29059
|
* @type {number}
|
|
29416
29060
|
*/
|
|
29417
|
-
this.
|
|
29061
|
+
this._lastStartedTransitionId = -1;
|
|
29418
29062
|
|
|
29419
29063
|
/**
|
|
29420
29064
|
* @type {Queue<import("./transition/transition.js").Transition>}
|
|
29421
29065
|
*/
|
|
29422
|
-
this.
|
|
29066
|
+
this._transitionHistory = new Queue(
|
|
29067
|
+
/** @type {Array<import("./transition/transition.js").Transition>} */ ([]),
|
|
29068
|
+
1,
|
|
29069
|
+
);
|
|
29423
29070
|
|
|
29424
29071
|
/**
|
|
29425
29072
|
* @type {Queue<import("./transition/transition.js").Transition>}
|
|
29426
29073
|
*/
|
|
29427
|
-
this.
|
|
29074
|
+
this._successfulTransitions = new Queue(
|
|
29075
|
+
/** @type {Array<import("./transition/transition.js").Transition>} */ ([]),
|
|
29076
|
+
1,
|
|
29077
|
+
);
|
|
29428
29078
|
|
|
29429
29079
|
/**
|
|
29430
29080
|
* @type {import("./state/interface.ts").StateDeclaration|undefined}
|
|
@@ -29523,10 +29173,17 @@
|
|
|
29523
29173
|
return (_fn && _fn.toString()) || "undefined";
|
|
29524
29174
|
}
|
|
29525
29175
|
|
|
29176
|
+
/**
|
|
29177
|
+
* @param {any} value
|
|
29178
|
+
* @returns {string|*|string}
|
|
29179
|
+
*/
|
|
29526
29180
|
function stringify(value) {
|
|
29181
|
+
/**
|
|
29182
|
+
* @type {any[]}
|
|
29183
|
+
*/
|
|
29527
29184
|
const seen = [];
|
|
29528
29185
|
|
|
29529
|
-
const isRejection = (obj) => {
|
|
29186
|
+
const isRejection = (/** @type {Promise<any>} */ obj) => {
|
|
29530
29187
|
return (
|
|
29531
29188
|
obj &&
|
|
29532
29189
|
typeof obj.then === "function" &&
|
|
@@ -29534,7 +29191,9 @@
|
|
|
29534
29191
|
);
|
|
29535
29192
|
};
|
|
29536
29193
|
|
|
29537
|
-
const hasToString = (
|
|
29194
|
+
const hasToString = (
|
|
29195
|
+
/** @type {{ constructor: ObjectConstructor; toString: any; }} */ obj,
|
|
29196
|
+
) =>
|
|
29538
29197
|
isObject(obj) &&
|
|
29539
29198
|
!isArray(obj) &&
|
|
29540
29199
|
obj.constructor !== Object &&
|
|
@@ -29544,12 +29203,23 @@
|
|
|
29544
29203
|
[isUndefined, val("undefined")],
|
|
29545
29204
|
[isNull, val("null")],
|
|
29546
29205
|
[isPromise, val("[Promise]")],
|
|
29547
|
-
[
|
|
29548
|
-
|
|
29206
|
+
[
|
|
29207
|
+
isRejection,
|
|
29208
|
+
(
|
|
29209
|
+
/** @type {{ _transitionRejection: { toString: () => any; }; }} */ reg,
|
|
29210
|
+
) => reg._transitionRejection.toString(),
|
|
29211
|
+
],
|
|
29212
|
+
[
|
|
29213
|
+
hasToString,
|
|
29214
|
+
(/** @type {{ toString: () => any; }} */ str) => str.toString(),
|
|
29215
|
+
],
|
|
29549
29216
|
[isInjectable, functionToString],
|
|
29550
|
-
[val(true), (bool) => bool],
|
|
29217
|
+
[val(true), (/** @type {any} */ bool) => bool],
|
|
29551
29218
|
]);
|
|
29552
29219
|
|
|
29220
|
+
/**
|
|
29221
|
+
* @param {any} item
|
|
29222
|
+
*/
|
|
29553
29223
|
function format(item) {
|
|
29554
29224
|
if (isObject(item)) {
|
|
29555
29225
|
if (seen.indexOf(item) !== -1) return "[circular ref]";
|
|
@@ -29572,7 +29242,9 @@
|
|
|
29572
29242
|
);
|
|
29573
29243
|
}
|
|
29574
29244
|
|
|
29575
|
-
const stripLastPathElement = (str) =>
|
|
29245
|
+
const stripLastPathElement = (/** @type {string} */ str) =>
|
|
29246
|
+
str.replace(/\/[^/]*$/, "");
|
|
29247
|
+
|
|
29576
29248
|
/**
|
|
29577
29249
|
* Splits on a delimiter, but returns the delimiters in the array
|
|
29578
29250
|
*
|
|
@@ -29582,12 +29254,14 @@
|
|
|
29582
29254
|
* splitOnSlashes("/foo"); // ["/", "foo"]
|
|
29583
29255
|
* splitOnSlashes("/foo/"); // ["/", "foo", "/"]
|
|
29584
29256
|
* ```
|
|
29257
|
+
* @param {string} delim
|
|
29585
29258
|
*/
|
|
29586
29259
|
function splitOnDelim(delim) {
|
|
29587
29260
|
const re = new RegExp(`(${delim})`, "g");
|
|
29588
29261
|
|
|
29589
|
-
return (str) => str.split(re).filter(Boolean);
|
|
29262
|
+
return (/** @type {string} */ str) => str.split(re).filter(Boolean);
|
|
29590
29263
|
}
|
|
29264
|
+
|
|
29591
29265
|
/**
|
|
29592
29266
|
* Reduce fn that joins neighboring strings
|
|
29593
29267
|
*
|
|
@@ -29599,10 +29273,12 @@
|
|
|
29599
29273
|
* let arr = ["foo", "bar", 1, "baz", "", "qux" ];
|
|
29600
29274
|
* arr.reduce(joinNeighborsR, []) // ["foobar", 1, "bazqux" ]
|
|
29601
29275
|
* ```
|
|
29276
|
+
* @param {string | any[]} acc
|
|
29277
|
+
* @param {unknown} str
|
|
29602
29278
|
*/
|
|
29603
29279
|
function joinNeighborsR(acc, str) {
|
|
29604
|
-
if (isString(tail(acc)) && isString(str))
|
|
29605
|
-
return acc.slice(0, -1).concat(tail(acc) + str);
|
|
29280
|
+
if (isString(tail(/** @type {string} */ (acc))) && isString(str))
|
|
29281
|
+
return acc.slice(0, -1).concat(tail(/** @type {string} */ (acc)) + str);
|
|
29606
29282
|
|
|
29607
29283
|
return pushR(acc, str);
|
|
29608
29284
|
}
|
|
@@ -32172,18 +31848,24 @@
|
|
|
32172
31848
|
this._deregistered = true;
|
|
32173
31849
|
}
|
|
32174
31850
|
}
|
|
32175
|
-
/**
|
|
32176
|
-
|
|
31851
|
+
/**
|
|
31852
|
+
* Return a registration function of the requested type.
|
|
31853
|
+
* @param {ng.TransitionProvider| import("./transition.js").Transition} hookSource
|
|
31854
|
+
* @param {ng.TransitionProvider} transitionService
|
|
31855
|
+
* @param {import("./transition-event-type.js").TransitionEventType} eventType
|
|
31856
|
+
* @returns {( matchObject: any, callback: Function, options?: Record<string, any> ) => () => void }
|
|
31857
|
+
*/
|
|
31858
|
+
function makeEvent(hookSource, transitionService, eventType) {
|
|
32177
31859
|
// Create the object which holds the registered transition hooks.
|
|
32178
|
-
const _registeredHooks = (
|
|
32179
|
-
|
|
31860
|
+
const _registeredHooks = (hookSource._registeredHooks =
|
|
31861
|
+
hookSource._registeredHooks || {});
|
|
32180
31862
|
|
|
32181
31863
|
const hooks = (_registeredHooks[eventType.name] = []);
|
|
32182
31864
|
|
|
32183
31865
|
const removeHookFn = (x) => removeFrom(hooks, x);
|
|
32184
31866
|
|
|
32185
31867
|
// Create hook registration function on the HookRegistry for the event
|
|
32186
|
-
|
|
31868
|
+
hookSource[eventType.name] = hookRegistrationFn;
|
|
32187
31869
|
function hookRegistrationFn(matchObject, callback, options = {}) {
|
|
32188
31870
|
const registeredHook = new RegisteredHook(
|
|
32189
31871
|
transitionService,
|
|
@@ -32228,7 +31910,7 @@
|
|
|
32228
31910
|
* @returns
|
|
32229
31911
|
*/
|
|
32230
31912
|
buildHooksForPhase(phase) {
|
|
32231
|
-
return this.transition.
|
|
31913
|
+
return this.transition._transitionProvider
|
|
32232
31914
|
._getEvents(phase)
|
|
32233
31915
|
.map((type) => this.buildHooks(type))
|
|
32234
31916
|
.reduce(unnestR, [])
|
|
@@ -32289,7 +31971,7 @@
|
|
|
32289
31971
|
state,
|
|
32290
31972
|
hook,
|
|
32291
31973
|
_options,
|
|
32292
|
-
this.transition.
|
|
31974
|
+
this.transition._transitionProvider._$exceptionHandler,
|
|
32293
31975
|
);
|
|
32294
31976
|
|
|
32295
31977
|
return { hook, node, transitionHook };
|
|
@@ -32318,7 +32000,7 @@
|
|
|
32318
32000
|
const isCreate = hookType.hookPhase === TransitionHookPhase._CREATE;
|
|
32319
32001
|
|
|
32320
32002
|
// Instance and Global hook registries
|
|
32321
|
-
const $transitions = this.transition.
|
|
32003
|
+
const $transitions = this.transition._transitionProvider;
|
|
32322
32004
|
|
|
32323
32005
|
const registries = isCreate
|
|
32324
32006
|
? [$transitions]
|
|
@@ -32383,7 +32065,11 @@
|
|
|
32383
32065
|
* @type {import('../router.js').RouterProvider}
|
|
32384
32066
|
*/
|
|
32385
32067
|
this._globals = globals;
|
|
32386
|
-
|
|
32068
|
+
|
|
32069
|
+
/** @type {ng.TransitionProvider} */
|
|
32070
|
+
this._transitionProvider = transitionService;
|
|
32071
|
+
|
|
32072
|
+
/** @type {PromiseWithResolvers<any>} */
|
|
32387
32073
|
this._deferred = Promise.withResolvers();
|
|
32388
32074
|
|
|
32389
32075
|
/**
|
|
@@ -32439,10 +32125,12 @@
|
|
|
32439
32125
|
* (which can then be used to register hooks)
|
|
32440
32126
|
*/
|
|
32441
32127
|
createTransitionHookRegFns() {
|
|
32442
|
-
this.
|
|
32128
|
+
this._transitionProvider
|
|
32443
32129
|
._getEvents()
|
|
32444
32130
|
.filter((type) => type.hookPhase !== TransitionHookPhase._CREATE)
|
|
32445
|
-
.forEach((type) =>
|
|
32131
|
+
.forEach((type) => {
|
|
32132
|
+
return makeEvent(this, this._transitionProvider, type);
|
|
32133
|
+
});
|
|
32446
32134
|
}
|
|
32447
32135
|
|
|
32448
32136
|
getHooks(hookName) {
|
|
@@ -32453,7 +32141,7 @@
|
|
|
32453
32141
|
const enteringStates = this._treeChanges.entering.map((node) => node.state);
|
|
32454
32142
|
|
|
32455
32143
|
PathUtils.applyViewConfigs(
|
|
32456
|
-
this.
|
|
32144
|
+
this._transitionProvider.$view,
|
|
32457
32145
|
this._treeChanges.to,
|
|
32458
32146
|
enteringStates,
|
|
32459
32147
|
);
|
|
@@ -32773,7 +32461,7 @@
|
|
|
32773
32461
|
);
|
|
32774
32462
|
|
|
32775
32463
|
targetState = targetState.withOptions(newOptions, true);
|
|
32776
|
-
const newTransition = this.
|
|
32464
|
+
const newTransition = this._transitionProvider.create(
|
|
32777
32465
|
this._treeChanges.from,
|
|
32778
32466
|
targetState,
|
|
32779
32467
|
);
|
|
@@ -32959,9 +32647,9 @@
|
|
|
32959
32647
|
const startTransition = () => {
|
|
32960
32648
|
const { _globals } = this;
|
|
32961
32649
|
|
|
32962
|
-
_globals.
|
|
32650
|
+
_globals._lastStartedTransitionId = this.$id;
|
|
32963
32651
|
_globals.transition = this;
|
|
32964
|
-
_globals.
|
|
32652
|
+
_globals._transitionHistory.enqueue(this);
|
|
32965
32653
|
trace.traceTransitionStart(this);
|
|
32966
32654
|
|
|
32967
32655
|
return Promise.resolve();
|
|
@@ -33302,7 +32990,7 @@
|
|
|
33302
32990
|
const globals = trans._globals;
|
|
33303
32991
|
|
|
33304
32992
|
const transitionSuccessful = () => {
|
|
33305
|
-
globals.
|
|
32993
|
+
globals._successfulTransitions.enqueue(trans);
|
|
33306
32994
|
globals.$current = trans.$to();
|
|
33307
32995
|
globals.current = globals.$current.self;
|
|
33308
32996
|
copy(trans.params(), globals.params);
|
|
@@ -33351,12 +33039,19 @@
|
|
|
33351
33039
|
stateRegistry,
|
|
33352
33040
|
) {
|
|
33353
33041
|
return transitionService.onBefore(
|
|
33354
|
-
{
|
|
33355
|
-
|
|
33042
|
+
{
|
|
33043
|
+
entering: (state) => {
|
|
33044
|
+
return !!state.lazyLoad;
|
|
33045
|
+
},
|
|
33046
|
+
},
|
|
33047
|
+
/** @param {import("../transition/transition.js").Transition} transition*/ (
|
|
33048
|
+
transition,
|
|
33049
|
+
) => {
|
|
33356
33050
|
function retryTransition() {
|
|
33357
33051
|
if (transition.originalTransition().options().source !== "url") {
|
|
33358
33052
|
// The original transition was not triggered via url sync
|
|
33359
33053
|
// The lazy state should be loaded now, so re-try the original transition
|
|
33054
|
+
|
|
33360
33055
|
const orig = transition.targetState();
|
|
33361
33056
|
|
|
33362
33057
|
return stateService.target(
|
|
@@ -33655,7 +33350,7 @@
|
|
|
33655
33350
|
|
|
33656
33351
|
/** @type {ng.ExceptionHandlerService} */
|
|
33657
33352
|
this._$exceptionHandler = $exceptionHandler.handler;
|
|
33658
|
-
globals.
|
|
33353
|
+
globals._successfulTransitions.onEvict(treeChangesCleanup);
|
|
33659
33354
|
}
|
|
33660
33355
|
|
|
33661
33356
|
$get = [
|
|
@@ -33940,8 +33635,15 @@
|
|
|
33940
33635
|
* @param {ng.ExceptionHandlerProvider} exceptionHandlerProvider
|
|
33941
33636
|
*/
|
|
33942
33637
|
constructor(globals, transitionService, exceptionHandlerProvider) {
|
|
33638
|
+
/**
|
|
33639
|
+
* @type {ng.RouterProvider}
|
|
33640
|
+
*/
|
|
33943
33641
|
this.globals = globals;
|
|
33642
|
+
/**
|
|
33643
|
+
* @type {ng.TransitionProvider}
|
|
33644
|
+
*/
|
|
33944
33645
|
this.transitionService = transitionService;
|
|
33646
|
+
|
|
33945
33647
|
this.stateRegistry = undefined;
|
|
33946
33648
|
|
|
33947
33649
|
/** @type {ng.UrlService} */
|
|
@@ -34096,7 +33798,7 @@
|
|
|
34096
33798
|
|
|
34097
33799
|
const { globals } = this;
|
|
34098
33800
|
|
|
34099
|
-
const latestThing = () => globals.
|
|
33801
|
+
const latestThing = () => globals._transitionHistory.peekTail();
|
|
34100
33802
|
|
|
34101
33803
|
const latest = latestThing();
|
|
34102
33804
|
|
|
@@ -34311,7 +34013,7 @@
|
|
|
34311
34013
|
getCurrentPath() {
|
|
34312
34014
|
const { globals } = this;
|
|
34313
34015
|
|
|
34314
|
-
const latestSuccess = globals.
|
|
34016
|
+
const latestSuccess = globals._successfulTransitions.peekTail();
|
|
34315
34017
|
|
|
34316
34018
|
const rootPath = () => [new PathNode(this.stateRegistry.root())];
|
|
34317
34019
|
|
|
@@ -34370,7 +34072,7 @@
|
|
|
34370
34072
|
*/
|
|
34371
34073
|
const rejectedTransitionHandler = (trans) => (error) => {
|
|
34372
34074
|
if (error instanceof Rejection) {
|
|
34373
|
-
const isLatest = this.globals.
|
|
34075
|
+
const isLatest = this.globals._lastStartedTransitionId <= trans.$id;
|
|
34374
34076
|
|
|
34375
34077
|
if (error.type === RejectType._IGNORED) {
|
|
34376
34078
|
isLatest && this.urlService.update();
|
|
@@ -34666,10 +34368,10 @@
|
|
|
34666
34368
|
return $anchorScroll;
|
|
34667
34369
|
}
|
|
34668
34370
|
|
|
34669
|
-
return
|
|
34371
|
+
return (/** @type {Element} */ $element) => {
|
|
34670
34372
|
validateInstanceOf($element, Element, "$element");
|
|
34671
34373
|
|
|
34672
|
-
|
|
34374
|
+
setTimeout(() => {
|
|
34673
34375
|
$element.scrollIntoView(false);
|
|
34674
34376
|
}, 0);
|
|
34675
34377
|
};
|
|
@@ -34834,7 +34536,9 @@
|
|
|
34834
34536
|
fromProvider(provider, params, context) {
|
|
34835
34537
|
const deps = annotate(provider);
|
|
34836
34538
|
|
|
34837
|
-
const providerFn = isArray(provider)
|
|
34539
|
+
const providerFn = isArray(provider)
|
|
34540
|
+
? /** @type {Function} */ (tail(provider))
|
|
34541
|
+
: provider;
|
|
34838
34542
|
|
|
34839
34543
|
const resolvable = new Resolvable("", providerFn, deps);
|
|
34840
34544
|
|
|
@@ -35600,8 +35304,6 @@
|
|
|
35600
35304
|
);
|
|
35601
35305
|
}
|
|
35602
35306
|
|
|
35603
|
-
/** @typedef {import('./interface.ts').StateDeclaration} StateDeclaration */
|
|
35604
|
-
|
|
35605
35307
|
/**
|
|
35606
35308
|
* Internal representation of a ng-router state.
|
|
35607
35309
|
*
|
|
@@ -35611,16 +35313,16 @@
|
|
|
35611
35313
|
*
|
|
35612
35314
|
* This class prototypally inherits from the corresponding [[StateDeclaration]].
|
|
35613
35315
|
* Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]].
|
|
35614
|
-
* @implements {StateDeclaration}
|
|
35316
|
+
* @implements {ng.StateDeclaration}
|
|
35615
35317
|
*/
|
|
35616
35318
|
class StateObject {
|
|
35617
|
-
name
|
|
35618
|
-
navigable
|
|
35319
|
+
name;
|
|
35320
|
+
navigable;
|
|
35619
35321
|
/** @type {?StateObject} */
|
|
35620
|
-
parent
|
|
35621
|
-
params
|
|
35622
|
-
url
|
|
35623
|
-
includes
|
|
35322
|
+
parent;
|
|
35323
|
+
params;
|
|
35324
|
+
url;
|
|
35325
|
+
includes;
|
|
35624
35326
|
|
|
35625
35327
|
/**
|
|
35626
35328
|
* @param {import('./interface.ts').StateDeclaration} config
|
|
@@ -35639,7 +35341,7 @@
|
|
|
35639
35341
|
*/
|
|
35640
35342
|
const nameGlob = this.name ? Glob.fromString(this.name) : null;
|
|
35641
35343
|
|
|
35642
|
-
this.
|
|
35344
|
+
this._stateObjectCache = { nameGlob };
|
|
35643
35345
|
}
|
|
35644
35346
|
|
|
35645
35347
|
/**
|
|
@@ -35721,7 +35423,7 @@
|
|
|
35721
35423
|
/** Predicate which returns true if the object is a [[StateDeclaration]] object */
|
|
35722
35424
|
StateObject.isStateDeclaration = (obj) => isFunction(obj.$$state);
|
|
35723
35425
|
/** Predicate which returns true if the object is an internal [[StateObject]] object */
|
|
35724
|
-
StateObject.isState = (obj) => isObject(obj.
|
|
35426
|
+
StateObject.isState = (obj) => isObject(obj._stateObjectCache);
|
|
35725
35427
|
|
|
35726
35428
|
/**
|
|
35727
35429
|
* Creates a [[UrlRule]]
|
|
@@ -36025,20 +35727,6 @@
|
|
|
36025
35727
|
return idSort(a, b);
|
|
36026
35728
|
}
|
|
36027
35729
|
|
|
36028
|
-
function getHandlerFn(handler) {
|
|
36029
|
-
if (
|
|
36030
|
-
!isFunction(handler) &&
|
|
36031
|
-
!isString(handler) &&
|
|
36032
|
-
!is(TargetState)(handler) &&
|
|
36033
|
-
!TargetState.isDef(handler)
|
|
36034
|
-
) {
|
|
36035
|
-
throw new Error(
|
|
36036
|
-
"'handler' must be a string, function, TargetState, or have a state: 'newtarget' property",
|
|
36037
|
-
);
|
|
36038
|
-
}
|
|
36039
|
-
|
|
36040
|
-
return isFunction(handler) ? handler : val(handler);
|
|
36041
|
-
}
|
|
36042
35730
|
/**
|
|
36043
35731
|
* API for managing URL rules
|
|
36044
35732
|
*
|
|
@@ -36055,102 +35743,7 @@
|
|
|
36055
35743
|
this._sortFn = defaultRuleSortFn;
|
|
36056
35744
|
this._rules = [];
|
|
36057
35745
|
this._id = 0;
|
|
36058
|
-
this.
|
|
36059
|
-
}
|
|
36060
|
-
|
|
36061
|
-
/**
|
|
36062
|
-
* Defines the initial state, path, or behavior to use when the app starts.
|
|
36063
|
-
*
|
|
36064
|
-
* This rule defines the initial/starting state for the application.
|
|
36065
|
-
*
|
|
36066
|
-
* This rule is triggered the first time the URL is checked (when the app initially loads).
|
|
36067
|
-
* The rule is triggered only when the url matches either `""` or `"/"`.
|
|
36068
|
-
*
|
|
36069
|
-
* Note: The rule is intended to be used when the root of the application is directly linked to.
|
|
36070
|
-
* When the URL is *not* `""` or `"/"` and doesn't match other rules, the [[otherwise]] rule is triggered.
|
|
36071
|
-
* This allows 404-like behavior when an unknown URL is deep-linked.
|
|
36072
|
-
*
|
|
36073
|
-
* #### Example:
|
|
36074
|
-
* Start app at `home` state.
|
|
36075
|
-
* ```js
|
|
36076
|
-
* .initial({ state: 'home' });
|
|
36077
|
-
* ```
|
|
36078
|
-
*
|
|
36079
|
-
* #### Example:
|
|
36080
|
-
* Start app at `/home` (by url)
|
|
36081
|
-
* ```js
|
|
36082
|
-
* .initial('/home');
|
|
36083
|
-
* ```
|
|
36084
|
-
*
|
|
36085
|
-
* #### Example:
|
|
36086
|
-
* When no other url rule matches, go to `home` state
|
|
36087
|
-
* ```js
|
|
36088
|
-
* .initial((matchValue, url, router) => {
|
|
36089
|
-
* console.log('initial state');
|
|
36090
|
-
* return { state: 'home' };
|
|
36091
|
-
* })
|
|
36092
|
-
* ```
|
|
36093
|
-
*
|
|
36094
|
-
* @param handler The initial state or url path, or a function which returns the state or url path (or performs custom logic).
|
|
36095
|
-
*/
|
|
36096
|
-
initial(handler) {
|
|
36097
|
-
const handlerFn = getHandlerFn(handler);
|
|
36098
|
-
|
|
36099
|
-
const matchFn = (urlParts, router) =>
|
|
36100
|
-
router.globals.transitionHistory.size() === 0 &&
|
|
36101
|
-
!!/^\/?$/.exec(urlParts.path);
|
|
36102
|
-
|
|
36103
|
-
this.rule(this.urlRuleFactory.create(matchFn, handlerFn));
|
|
36104
|
-
}
|
|
36105
|
-
|
|
36106
|
-
/**
|
|
36107
|
-
* Defines the state, url, or behavior to use when no other rule matches the URL.
|
|
36108
|
-
*
|
|
36109
|
-
* This rule is matched when *no other rule* matches.
|
|
36110
|
-
* It is generally used to handle unknown URLs (similar to "404" behavior, but on the client side).
|
|
36111
|
-
*
|
|
36112
|
-
* - If `handler` a string, it is treated as a url redirect
|
|
36113
|
-
*
|
|
36114
|
-
* #### Example:
|
|
36115
|
-
* When no other url rule matches, redirect to `/index`
|
|
36116
|
-
* ```js
|
|
36117
|
-
* .otherwise('/index');
|
|
36118
|
-
* ```
|
|
36119
|
-
*
|
|
36120
|
-
* - If `handler` is an object with a `state` property, the state is activated.
|
|
36121
|
-
*
|
|
36122
|
-
* #### Example:
|
|
36123
|
-
* When no other url rule matches, redirect to `home` and provide a `dashboard` parameter value.
|
|
36124
|
-
* ```js
|
|
36125
|
-
* .otherwise({ state: 'home', params: { dashboard: 'default' } });
|
|
36126
|
-
* ```
|
|
36127
|
-
*
|
|
36128
|
-
* - If `handler` is a function, the function receives the current url ([[UrlParts]]) and the [[UIRouter]] object.
|
|
36129
|
-
* The function can perform actions, and/or return a value.
|
|
36130
|
-
*
|
|
36131
|
-
* #### Example:
|
|
36132
|
-
* When no other url rule matches, manually trigger a transition to the `home` state
|
|
36133
|
-
* ```js
|
|
36134
|
-
* .otherwise((matchValue, urlParts, router) => {
|
|
36135
|
-
* router.stateService.go('home');
|
|
36136
|
-
* });
|
|
36137
|
-
* ```
|
|
36138
|
-
*
|
|
36139
|
-
* #### Example:
|
|
36140
|
-
* When no other url rule matches, go to `home` state
|
|
36141
|
-
* ```js
|
|
36142
|
-
* .otherwise((matchValue, urlParts, router) => {
|
|
36143
|
-
* return { state: 'home' };
|
|
36144
|
-
* });
|
|
36145
|
-
* ```
|
|
36146
|
-
*
|
|
36147
|
-
* @param handler The url path to redirect to, or a function which returns the url path (or performs custom logic).
|
|
36148
|
-
*/
|
|
36149
|
-
otherwise(handler) {
|
|
36150
|
-
const handlerFn = getHandlerFn(handler);
|
|
36151
|
-
|
|
36152
|
-
this._otherwiseFn = this.urlRuleFactory.create(val(true), handlerFn);
|
|
36153
|
-
this._sorted = false;
|
|
35746
|
+
this._urlRuleFactory = urlRuleFactory;
|
|
36154
35747
|
}
|
|
36155
35748
|
|
|
36156
35749
|
/**
|
|
@@ -36172,7 +35765,7 @@
|
|
|
36172
35765
|
* A rule should have a `match` function which returns truthy if the rule matched.
|
|
36173
35766
|
* It should also have a `handler` function which is invoked if the rule is the best match.
|
|
36174
35767
|
*
|
|
36175
|
-
* @
|
|
35768
|
+
* @returns {() => void } a function that deregisters the rule
|
|
36176
35769
|
*/
|
|
36177
35770
|
rule(rule) {
|
|
36178
35771
|
if (!UrlRuleFactory.isUrlRule(rule)) throw new Error("invalid rule");
|
|
@@ -36192,7 +35785,7 @@
|
|
|
36192
35785
|
rules() {
|
|
36193
35786
|
this.ensureSorted();
|
|
36194
35787
|
|
|
36195
|
-
return this._rules
|
|
35788
|
+
return this._rules;
|
|
36196
35789
|
}
|
|
36197
35790
|
|
|
36198
35791
|
/**
|
|
@@ -36336,7 +35929,7 @@
|
|
|
36336
35929
|
* @return the registered [[UrlRule]]
|
|
36337
35930
|
*/
|
|
36338
35931
|
when(matcher, handler, options) {
|
|
36339
|
-
const rule = this.
|
|
35932
|
+
const rule = this._urlRuleFactory.create(matcher, handler);
|
|
36340
35933
|
|
|
36341
35934
|
if (isDefined(options && options.priority))
|
|
36342
35935
|
rule.priority = options.priority;
|
|
@@ -36386,31 +35979,32 @@
|
|
|
36386
35979
|
|
|
36387
35980
|
/**
|
|
36388
35981
|
* @param {ng.LocationProvider} $locationProvider
|
|
36389
|
-
* @param {import("../../router/state/state-service.js").StateProvider}
|
|
35982
|
+
* @param {import("../../router/state/state-service.js").StateProvider} stateProvider
|
|
36390
35983
|
* @param {import("../router.js").RouterProvider} globals
|
|
36391
35984
|
* @param {import("../../router/url/url-config.js").UrlConfigProvider} urlConfigProvider
|
|
36392
35985
|
*/
|
|
36393
|
-
constructor($locationProvider,
|
|
35986
|
+
constructor($locationProvider, stateProvider, globals, urlConfigProvider) {
|
|
36394
35987
|
/** @private */
|
|
36395
35988
|
this._locationProvider = $locationProvider;
|
|
36396
|
-
this.stateService =
|
|
35989
|
+
this.stateService = stateProvider;
|
|
36397
35990
|
|
|
36398
|
-
/** Provides services related to the URL */
|
|
36399
|
-
this.
|
|
35991
|
+
/** @type {UrlRuleFactory} Provides services related to the URL */
|
|
35992
|
+
this._urlRuleFactory = new UrlRuleFactory(this, this.stateService, globals);
|
|
36400
35993
|
|
|
36401
35994
|
/**
|
|
36402
35995
|
* The nested [[UrlRules]] API for managing URL rules and rewrites
|
|
35996
|
+
* @ignore
|
|
36403
35997
|
* @type {UrlRules}
|
|
36404
35998
|
*/
|
|
36405
|
-
this.
|
|
35999
|
+
this._rules = new UrlRules(this._urlRuleFactory);
|
|
36406
36000
|
/**
|
|
36407
36001
|
* The nested [[UrlConfig]] API to configure the URL and retrieve URL information
|
|
36408
36002
|
* @type {import("./url-config.js").UrlConfigProvider}
|
|
36409
36003
|
*/
|
|
36410
|
-
this.
|
|
36004
|
+
this._config = urlConfigProvider;
|
|
36411
36005
|
|
|
36412
|
-
/** Creates a new [[Param]] for a given location (DefType) */
|
|
36413
|
-
this.
|
|
36006
|
+
/** @type {ParamFactory} Creates a new [[Param]] for a given location (DefType) */
|
|
36007
|
+
this._paramFactory = new ParamFactory(this._config);
|
|
36414
36008
|
|
|
36415
36009
|
this._urlListeners = [];
|
|
36416
36010
|
}
|
|
@@ -36672,7 +36266,7 @@
|
|
|
36672
36266
|
*/
|
|
36673
36267
|
match(url) {
|
|
36674
36268
|
url = Object.assign({ path: "", search: {}, hash: "" }, url);
|
|
36675
|
-
const rules = this.
|
|
36269
|
+
const rules = this._rules.rules();
|
|
36676
36270
|
|
|
36677
36271
|
// Checks a single rule. Returns { rule: rule, match: match, weight: weight } if it matched, or undefined
|
|
36678
36272
|
/**
|
|
@@ -36783,7 +36377,7 @@
|
|
|
36783
36377
|
* @returns The UrlMatcher.
|
|
36784
36378
|
*/
|
|
36785
36379
|
compile(urlPattern, config) {
|
|
36786
|
-
const urlConfig = this.
|
|
36380
|
+
const urlConfig = this._config;
|
|
36787
36381
|
|
|
36788
36382
|
// backward-compatible support for config.params -> config.state.params
|
|
36789
36383
|
const params = config && !config.state && config.params;
|
|
@@ -36797,7 +36391,7 @@
|
|
|
36797
36391
|
return new UrlMatcher(
|
|
36798
36392
|
urlPattern,
|
|
36799
36393
|
urlConfig.paramTypes,
|
|
36800
|
-
this.
|
|
36394
|
+
this._paramFactory,
|
|
36801
36395
|
Object.assign(globalConfig, config),
|
|
36802
36396
|
);
|
|
36803
36397
|
}
|
|
@@ -36834,8 +36428,10 @@
|
|
|
36834
36428
|
}
|
|
36835
36429
|
|
|
36836
36430
|
class StateMatcher {
|
|
36837
|
-
|
|
36838
|
-
|
|
36431
|
+
/** @param {import("./interface.ts").StateStore} states */
|
|
36432
|
+
constructor(states) {
|
|
36433
|
+
/** @type {import("./interface.ts").StateStore} */
|
|
36434
|
+
this._states = states;
|
|
36839
36435
|
}
|
|
36840
36436
|
|
|
36841
36437
|
isRelative(stateName) {
|
|
@@ -36860,12 +36456,10 @@
|
|
|
36860
36456
|
) {
|
|
36861
36457
|
return state;
|
|
36862
36458
|
} else if (isStr && matchGlob) {
|
|
36863
|
-
const
|
|
36459
|
+
const states = Object.values(this._states);
|
|
36864
36460
|
|
|
36865
|
-
const matches =
|
|
36866
|
-
(
|
|
36867
|
-
_state.__stateObjectCache.nameGlob &&
|
|
36868
|
-
_state.__stateObjectCache.nameGlob.matches(name),
|
|
36461
|
+
const matches = states.filter((stateObj) =>
|
|
36462
|
+
stateObj._stateObjectCache.nameGlob?.matches(name),
|
|
36869
36463
|
);
|
|
36870
36464
|
|
|
36871
36465
|
if (matches.length > 1) {
|
|
@@ -37194,11 +36788,11 @@
|
|
|
37194
36788
|
class StateBuilder {
|
|
37195
36789
|
/**
|
|
37196
36790
|
* @param {import('./state-matcher.js').StateMatcher} matcher
|
|
37197
|
-
* @param urlService
|
|
36791
|
+
* @param {ng.UrlService} urlService
|
|
37198
36792
|
*/
|
|
37199
36793
|
constructor(matcher, urlService) {
|
|
37200
|
-
this.
|
|
37201
|
-
this
|
|
36794
|
+
this._matcher = matcher;
|
|
36795
|
+
this._$injector = undefined;
|
|
37202
36796
|
const self = this;
|
|
37203
36797
|
|
|
37204
36798
|
const root = () => matcher.find("");
|
|
@@ -37208,7 +36802,7 @@
|
|
|
37208
36802
|
|
|
37209
36803
|
return matcher.find(self.parentName(state)) || root();
|
|
37210
36804
|
}
|
|
37211
|
-
this.
|
|
36805
|
+
this._builders = {
|
|
37212
36806
|
name: [(state) => state.name],
|
|
37213
36807
|
self: [selfBuilder],
|
|
37214
36808
|
parent: [parentBuilder],
|
|
@@ -37218,7 +36812,7 @@
|
|
|
37218
36812
|
// Keep track of the closest ancestor state that has a URL (i.e. is navigable)
|
|
37219
36813
|
navigable: [getNavigableBuilder(isRoot)],
|
|
37220
36814
|
// TODO
|
|
37221
|
-
params: [getParamsBuilder(urlService.
|
|
36815
|
+
params: [getParamsBuilder(urlService._paramFactory)],
|
|
37222
36816
|
// Each framework-specific ng-router implementation should define its own `views` builder
|
|
37223
36817
|
// e.g., src/ng1/statebuilders/views.ts
|
|
37224
36818
|
views: [],
|
|
@@ -37231,7 +36825,7 @@
|
|
|
37231
36825
|
}
|
|
37232
36826
|
|
|
37233
36827
|
builder(name, fn) {
|
|
37234
|
-
const { builders } = this;
|
|
36828
|
+
const { _builders: builders } = this;
|
|
37235
36829
|
|
|
37236
36830
|
const array = builders[name] || [];
|
|
37237
36831
|
|
|
@@ -37254,7 +36848,7 @@
|
|
|
37254
36848
|
* @returns the built State object
|
|
37255
36849
|
*/
|
|
37256
36850
|
build(state) {
|
|
37257
|
-
const { matcher, builders } = this;
|
|
36851
|
+
const { _matcher: matcher, _builders: builders } = this;
|
|
37258
36852
|
|
|
37259
36853
|
const parent = this.parentName(state);
|
|
37260
36854
|
|
|
@@ -37330,13 +36924,14 @@
|
|
|
37330
36924
|
class StateQueueManager {
|
|
37331
36925
|
/**
|
|
37332
36926
|
* @param {import("./state-registry.js").StateRegistryProvider} stateRegistry
|
|
37333
|
-
* @param {
|
|
37334
|
-
* @param {
|
|
36927
|
+
* @param {import("../url/url-rules.js").UrlRules} urlServiceRules
|
|
36928
|
+
* @param {import("./interface.ts").StateStore} states
|
|
37335
36929
|
* @param {*} builder
|
|
37336
36930
|
* @param {*} listeners
|
|
37337
36931
|
*/
|
|
37338
36932
|
constructor(stateRegistry, urlServiceRules, states, builder, listeners) {
|
|
37339
36933
|
this.stateRegistry = stateRegistry;
|
|
36934
|
+
/** @type {import("../url/url-rules.js").UrlRules} */
|
|
37340
36935
|
this.urlServiceRules = urlServiceRules;
|
|
37341
36936
|
this.states = states;
|
|
37342
36937
|
this.builder = builder;
|
|
@@ -37432,11 +37027,16 @@
|
|
|
37432
37027
|
return states;
|
|
37433
37028
|
}
|
|
37434
37029
|
|
|
37030
|
+
/**
|
|
37031
|
+
*
|
|
37032
|
+
* @param {ng.StateDeclaration} state
|
|
37033
|
+
* @returns {() => void} a function that deregisters the rule
|
|
37034
|
+
*/
|
|
37435
37035
|
attachRoute(state) {
|
|
37436
37036
|
if (state.abstract || !state.url) return;
|
|
37437
37037
|
const rulesApi = this.urlServiceRules;
|
|
37438
37038
|
|
|
37439
|
-
rulesApi.rule(rulesApi.
|
|
37039
|
+
rulesApi.rule(rulesApi._urlRuleFactory.create(state));
|
|
37440
37040
|
}
|
|
37441
37041
|
}
|
|
37442
37042
|
|
|
@@ -37462,12 +37062,12 @@
|
|
|
37462
37062
|
* @param {ng.ViewService} viewService
|
|
37463
37063
|
*/
|
|
37464
37064
|
constructor(urlService, stateService, globals, viewService) {
|
|
37465
|
-
/** @type {
|
|
37065
|
+
/** @type {import("./interface.ts").StateStore} */
|
|
37466
37066
|
this.states = {};
|
|
37467
37067
|
|
|
37468
37068
|
stateService.stateRegistry = this; // <- circular wiring
|
|
37469
37069
|
this.urlService = urlService;
|
|
37470
|
-
this.urlServiceRules = urlService.
|
|
37070
|
+
this.urlServiceRules = urlService._rules;
|
|
37471
37071
|
this.$injector = undefined;
|
|
37472
37072
|
this.listeners = [];
|
|
37473
37073
|
this.matcher = new StateMatcher(this.states);
|
|
@@ -37502,7 +37102,7 @@
|
|
|
37502
37102
|
*/
|
|
37503
37103
|
($injector) => {
|
|
37504
37104
|
this.$injector = $injector;
|
|
37505
|
-
this.builder
|
|
37105
|
+
this.builder._$injector = $injector;
|
|
37506
37106
|
|
|
37507
37107
|
return this;
|
|
37508
37108
|
},
|
|
@@ -37628,7 +37228,7 @@
|
|
|
37628
37228
|
}
|
|
37629
37229
|
|
|
37630
37230
|
_deregisterTree(state) {
|
|
37631
|
-
const all = this.
|
|
37231
|
+
const all = this.getAll().map((x) => x.$$state());
|
|
37632
37232
|
|
|
37633
37233
|
const getChildren = (states) => {
|
|
37634
37234
|
const _children = all.filter((x) => states.indexOf(x.parent) !== -1);
|
|
@@ -37667,11 +37267,18 @@
|
|
|
37667
37267
|
* @returns {import('./state-object').StateObject[]} a list of removed states
|
|
37668
37268
|
*/
|
|
37669
37269
|
deregister(stateOrName) {
|
|
37670
|
-
const
|
|
37270
|
+
const state =
|
|
37271
|
+
/** @type {import("./interface.ts").BuiltStateDeclaration} */ (
|
|
37272
|
+
this.get(stateOrName)
|
|
37273
|
+
);
|
|
37671
37274
|
|
|
37672
|
-
if (!
|
|
37275
|
+
if (!state)
|
|
37673
37276
|
throw new Error(`Can't deregister state; not found: ${stateOrName}`);
|
|
37674
|
-
const deregisteredStates = this._deregisterTree(
|
|
37277
|
+
const deregisteredStates = this._deregisterTree(
|
|
37278
|
+
/** @type {import("./interface.ts").BuiltStateDeclaration} */ (
|
|
37279
|
+
state
|
|
37280
|
+
).$$state(),
|
|
37281
|
+
);
|
|
37675
37282
|
|
|
37676
37283
|
this.listeners.forEach((listener) =>
|
|
37677
37284
|
listener(
|
|
@@ -38758,20 +38365,26 @@
|
|
|
38758
38365
|
*/
|
|
38759
38366
|
function ngChannelDirective($eventBus) {
|
|
38760
38367
|
return {
|
|
38368
|
+
scope: false,
|
|
38761
38369
|
link: (scope, element, attrs) => {
|
|
38762
38370
|
const channel = attrs.ngChannel;
|
|
38763
38371
|
|
|
38764
38372
|
const hasTemplateContent = element.childNodes.length > 0;
|
|
38765
38373
|
|
|
38766
|
-
const unsubscribe = $eventBus.subscribe(
|
|
38767
|
-
|
|
38768
|
-
|
|
38769
|
-
|
|
38374
|
+
const unsubscribe = $eventBus.subscribe(
|
|
38375
|
+
channel,
|
|
38376
|
+
(/** @type {string | Object} */ value) => {
|
|
38377
|
+
if (hasTemplateContent) {
|
|
38378
|
+
if (isObject(value)) {
|
|
38379
|
+
scope.$merge(value);
|
|
38380
|
+
}
|
|
38381
|
+
} else if (isString(value)) {
|
|
38382
|
+
element.innerHTML = value;
|
|
38383
|
+
} else {
|
|
38384
|
+
element.innerHTML = value.toString();
|
|
38770
38385
|
}
|
|
38771
|
-
}
|
|
38772
|
-
|
|
38773
|
-
}
|
|
38774
|
-
});
|
|
38386
|
+
},
|
|
38387
|
+
);
|
|
38775
38388
|
|
|
38776
38389
|
scope.$on("$destroy", () => unsubscribe());
|
|
38777
38390
|
},
|
|
@@ -38783,7 +38396,7 @@
|
|
|
38783
38396
|
/**
|
|
38784
38397
|
* @param {ng.ParseService} $parse
|
|
38785
38398
|
* @param {ng.LogService} $log
|
|
38786
|
-
* @returns {
|
|
38399
|
+
* @returns {ng.Directive}
|
|
38787
38400
|
*/
|
|
38788
38401
|
function ngSetterDirective($parse, $log) {
|
|
38789
38402
|
return {
|
|
@@ -38805,7 +38418,7 @@
|
|
|
38805
38418
|
return;
|
|
38806
38419
|
}
|
|
38807
38420
|
|
|
38808
|
-
const updateModel = (value) => {
|
|
38421
|
+
const updateModel = (/** @type {string} */ value) => {
|
|
38809
38422
|
assignModel(scope, value.trim());
|
|
38810
38423
|
};
|
|
38811
38424
|
|
|
@@ -38943,7 +38556,7 @@
|
|
|
38943
38556
|
|
|
38944
38557
|
let called = false;
|
|
38945
38558
|
|
|
38946
|
-
const wrapper = (...args) => {
|
|
38559
|
+
const wrapper = (/** @type {any[]} */ ...args) => {
|
|
38947
38560
|
if (called) return;
|
|
38948
38561
|
called = true;
|
|
38949
38562
|
|
|
@@ -39090,28 +38703,206 @@
|
|
|
39090
38703
|
}
|
|
39091
38704
|
|
|
39092
38705
|
/**
|
|
39093
|
-
*
|
|
39094
|
-
*
|
|
39095
|
-
* Usage:
|
|
39096
|
-
* const source = $sse('/events', {
|
|
39097
|
-
* onMessage: (data) => console.log(data),
|
|
39098
|
-
* onError: (err) => console.error(err),
|
|
39099
|
-
* retryDelay: 2000,
|
|
39100
|
-
* heartbeatTimeout: 10000,
|
|
39101
|
-
* });
|
|
39102
|
-
*
|
|
39103
|
-
* source.close();
|
|
38706
|
+
* Shared Stream Connection Manager
|
|
38707
|
+
* Handles reconnect, heartbeat, and event callbacks for SSE or WebSocket
|
|
39104
38708
|
*/
|
|
38709
|
+
class StreamConnection {
|
|
38710
|
+
/**
|
|
38711
|
+
* @param {() => EventSource | WebSocket} createFn - Function that creates a new EventSource or WebSocket.
|
|
38712
|
+
* @param {ng.StreamConnectionConfig} config - Configuration object with callbacks, retries, heartbeat, transformMessage.
|
|
38713
|
+
* @param {ng.LogService} log - Optional logger (default: console).
|
|
38714
|
+
*/
|
|
38715
|
+
constructor(createFn, config = {}, log = console) {
|
|
38716
|
+
/** @private @type {() => EventSource | WebSocket} */
|
|
38717
|
+
this._createFn = createFn;
|
|
38718
|
+
this._config = {
|
|
38719
|
+
retryDelay: 1000,
|
|
38720
|
+
maxRetries: Infinity,
|
|
38721
|
+
heartbeatTimeout: 15000,
|
|
38722
|
+
transformMessage: (/** @type {string} */ data) => {
|
|
38723
|
+
try {
|
|
38724
|
+
return JSON.parse(data);
|
|
38725
|
+
} catch {
|
|
38726
|
+
return data;
|
|
38727
|
+
}
|
|
38728
|
+
},
|
|
38729
|
+
...config,
|
|
38730
|
+
};
|
|
38731
|
+
this._log = log;
|
|
38732
|
+
this._retryCount = 0;
|
|
38733
|
+
this._closed = false;
|
|
38734
|
+
this._heartbeatTimer = undefined;
|
|
38735
|
+
/** @type {EventSource | WebSocket | null} */
|
|
38736
|
+
this._connection = null;
|
|
38737
|
+
|
|
38738
|
+
this.connect();
|
|
38739
|
+
}
|
|
38740
|
+
|
|
38741
|
+
/**
|
|
38742
|
+
* Establishes a new connection using the provided createFn.
|
|
38743
|
+
* Closes any existing connection before creating a new one.
|
|
38744
|
+
*/
|
|
38745
|
+
connect() {
|
|
38746
|
+
if (this._closed) return;
|
|
38747
|
+
|
|
38748
|
+
// Close the old connection if it exists
|
|
38749
|
+
if (this._connection && typeof this._connection.close === "function") {
|
|
38750
|
+
this._connection.close();
|
|
38751
|
+
}
|
|
38752
|
+
|
|
38753
|
+
// Create new connection
|
|
38754
|
+
this._connection = this._createFn();
|
|
38755
|
+
|
|
38756
|
+
// Bind events for the new connection
|
|
38757
|
+
this._bindEvents();
|
|
38758
|
+
}
|
|
38759
|
+
|
|
38760
|
+
/**
|
|
38761
|
+
* Sends data over a WebSocket connection.
|
|
38762
|
+
* Logs a warning if called on a non-WebSocket connection.
|
|
38763
|
+
* @param {any} data - Data to send.
|
|
38764
|
+
*/
|
|
38765
|
+
send(data) {
|
|
38766
|
+
if (this._connection instanceof WebSocket) {
|
|
38767
|
+
this._connection.send(JSON.stringify(data));
|
|
38768
|
+
} else {
|
|
38769
|
+
this._log.warn("Send is only supported on WebSocket connections");
|
|
38770
|
+
}
|
|
38771
|
+
}
|
|
38772
|
+
|
|
38773
|
+
/**
|
|
38774
|
+
* Closes the connection manually and clears the heartbeat timer.
|
|
38775
|
+
*/
|
|
38776
|
+
close() {
|
|
38777
|
+
this._closed = true;
|
|
38778
|
+
clearTimeout(this._heartbeatTimer);
|
|
38779
|
+
|
|
38780
|
+
if (this._connection && this._connection.close) {
|
|
38781
|
+
this._connection.close();
|
|
38782
|
+
}
|
|
38783
|
+
}
|
|
38784
|
+
|
|
38785
|
+
/**
|
|
38786
|
+
* @private
|
|
38787
|
+
* Binds event handlers to the underlying connection (EventSource or WebSocket)
|
|
38788
|
+
* for open, message, error, and close events.
|
|
38789
|
+
*/
|
|
38790
|
+
_bindEvents() {
|
|
38791
|
+
const conn = this._connection;
|
|
38792
|
+
|
|
38793
|
+
if (conn instanceof EventSource) {
|
|
38794
|
+
conn.addEventListener("open", (err) => this._handleOpen(err));
|
|
38795
|
+
conn.addEventListener("message", (err) =>
|
|
38796
|
+
this._handleMessage(err.data, err),
|
|
38797
|
+
);
|
|
38798
|
+
conn.addEventListener("error", (err) => this._handleError(err));
|
|
38799
|
+
} else if (conn instanceof WebSocket) {
|
|
38800
|
+
conn.onopen = (err) => this._handleOpen(err);
|
|
38801
|
+
conn.onmessage = (err) => this._handleMessage(err.data, err);
|
|
38802
|
+
conn.onerror = (err) => this._handleError(err);
|
|
38803
|
+
conn.onclose = () => this._handleClose();
|
|
38804
|
+
}
|
|
38805
|
+
}
|
|
38806
|
+
|
|
38807
|
+
/**
|
|
38808
|
+
* @private
|
|
38809
|
+
* Handles the open event from the connection.
|
|
38810
|
+
* @param {Event} event - The open event.
|
|
38811
|
+
*/
|
|
38812
|
+
_handleOpen(event) {
|
|
38813
|
+
this._retryCount = 0;
|
|
38814
|
+
this._config.onOpen?.(event);
|
|
38815
|
+
this._resetHeartbeat();
|
|
38816
|
+
}
|
|
38817
|
+
|
|
38818
|
+
/**
|
|
38819
|
+
* @private
|
|
38820
|
+
* Handles incoming messages, applies the transformMessage function,
|
|
38821
|
+
* and calls the onMessage callback.
|
|
38822
|
+
* @param {any} data - Raw message data.
|
|
38823
|
+
* @param {Event} event - The message event.
|
|
38824
|
+
*/
|
|
38825
|
+
_handleMessage(data, event) {
|
|
38826
|
+
try {
|
|
38827
|
+
data = this._config.transformMessage?.(data) ?? data;
|
|
38828
|
+
} catch {
|
|
38829
|
+
/* empty */
|
|
38830
|
+
}
|
|
38831
|
+
this._config.onMessage?.(data, event);
|
|
38832
|
+
this._resetHeartbeat();
|
|
38833
|
+
}
|
|
38834
|
+
|
|
38835
|
+
/**
|
|
38836
|
+
* @private
|
|
38837
|
+
* Handles errors emitted from the connection.
|
|
38838
|
+
* Calls onError callback and schedules a reconnect.
|
|
38839
|
+
* @param {any} err - Error object or message.
|
|
38840
|
+
*/
|
|
38841
|
+
_handleError(err) {
|
|
38842
|
+
this._config.onError?.(err);
|
|
38843
|
+
this._scheduleReconnect();
|
|
38844
|
+
}
|
|
38845
|
+
|
|
38846
|
+
/**
|
|
38847
|
+
* @private
|
|
38848
|
+
* Handles close events for WebSocket connections.
|
|
38849
|
+
* Triggers reconnect logic.
|
|
38850
|
+
*/
|
|
38851
|
+
_handleClose() {
|
|
38852
|
+
this._scheduleReconnect();
|
|
38853
|
+
}
|
|
38854
|
+
|
|
38855
|
+
/**
|
|
38856
|
+
* @private
|
|
38857
|
+
* Schedules a reconnect attempt based on retryCount and config.maxRetries.
|
|
38858
|
+
* Calls onReconnect callback if reconnecting.
|
|
38859
|
+
*/
|
|
38860
|
+
_scheduleReconnect() {
|
|
38861
|
+
if (this._closed) return;
|
|
38862
|
+
|
|
38863
|
+
if (this._retryCount < this._config.maxRetries) {
|
|
38864
|
+
this._retryCount++;
|
|
38865
|
+
this._config.onReconnect?.(this._retryCount);
|
|
38866
|
+
setTimeout(() => this.connect(), this._config.retryDelay);
|
|
38867
|
+
} else {
|
|
38868
|
+
this._log.warn("StreamConnection: Max retries reached");
|
|
38869
|
+
}
|
|
38870
|
+
}
|
|
38871
|
+
|
|
38872
|
+
/**
|
|
38873
|
+
* @private
|
|
38874
|
+
* Resets the heartbeat timer. If the timer expires, the connection is closed
|
|
38875
|
+
* and a reconnect is attempted.
|
|
38876
|
+
*/
|
|
38877
|
+
_resetHeartbeat() {
|
|
38878
|
+
if (!this._config.heartbeatTimeout) return;
|
|
38879
|
+
|
|
38880
|
+
clearTimeout(this._heartbeatTimer);
|
|
38881
|
+
this._heartbeatTimer = setTimeout(() => {
|
|
38882
|
+
this._log.warn("StreamConnection: heartbeat timeout, reconnecting...");
|
|
38883
|
+
this._closeInternal();
|
|
38884
|
+
this._retryCount++;
|
|
38885
|
+
this._config.onReconnect?.(this._retryCount);
|
|
38886
|
+
this.connect();
|
|
38887
|
+
}, this._config.heartbeatTimeout);
|
|
38888
|
+
}
|
|
38889
|
+
|
|
38890
|
+
/**
|
|
38891
|
+
* @private
|
|
38892
|
+
*/
|
|
38893
|
+
_closeInternal() {
|
|
38894
|
+
clearTimeout(this._heartbeatTimer);
|
|
38895
|
+
this._connection?.close();
|
|
38896
|
+
}
|
|
38897
|
+
}
|
|
38898
|
+
|
|
39105
38899
|
class SseProvider {
|
|
39106
38900
|
constructor() {
|
|
39107
|
-
/**
|
|
39108
|
-
* Optional provider-level defaults
|
|
39109
|
-
* @type {ng.SseConfig}
|
|
39110
|
-
*/
|
|
38901
|
+
/** @type {ng.SseConfig} */
|
|
39111
38902
|
this.defaults = {
|
|
39112
38903
|
retryDelay: 1000,
|
|
39113
38904
|
maxRetries: Infinity,
|
|
39114
|
-
heartbeatTimeout: 15000,
|
|
38905
|
+
heartbeatTimeout: 15000,
|
|
39115
38906
|
transformMessage(data) {
|
|
39116
38907
|
try {
|
|
39117
38908
|
return JSON.parse(data);
|
|
@@ -39124,20 +38915,32 @@
|
|
|
39124
38915
|
|
|
39125
38916
|
$get = [
|
|
39126
38917
|
$injectTokens._log,
|
|
39127
|
-
/**
|
|
39128
|
-
* Returns the $sse service function
|
|
39129
|
-
* @param {ng.LogService} log
|
|
39130
|
-
* @returns {ng.SseService}
|
|
39131
|
-
*/
|
|
39132
|
-
(log) => {
|
|
38918
|
+
/** @param {ng.LogService} log */ (log) => {
|
|
39133
38919
|
this._$log = log;
|
|
39134
38920
|
|
|
38921
|
+
/** @type {ng.SseService} */
|
|
39135
38922
|
return (url, config = {}) => {
|
|
39136
38923
|
const mergedConfig = { ...this.defaults, ...config };
|
|
39137
38924
|
|
|
39138
38925
|
const finalUrl = this.#buildUrl(url, mergedConfig.params);
|
|
39139
38926
|
|
|
39140
|
-
return
|
|
38927
|
+
return new StreamConnection(
|
|
38928
|
+
() =>
|
|
38929
|
+
new EventSource(finalUrl, {
|
|
38930
|
+
withCredentials: !!mergedConfig.withCredentials,
|
|
38931
|
+
}),
|
|
38932
|
+
{
|
|
38933
|
+
...mergedConfig,
|
|
38934
|
+
onMessage: (data, event) => {
|
|
38935
|
+
// Cast Event -> MessageEvent safely
|
|
38936
|
+
mergedConfig.onMessage?.(
|
|
38937
|
+
data,
|
|
38938
|
+
/** @type{MessageEvent} */ (event),
|
|
38939
|
+
);
|
|
38940
|
+
},
|
|
38941
|
+
},
|
|
38942
|
+
this._$log,
|
|
38943
|
+
);
|
|
39141
38944
|
};
|
|
39142
38945
|
},
|
|
39143
38946
|
];
|
|
@@ -39147,6 +38950,7 @@
|
|
|
39147
38950
|
* @param {string} url
|
|
39148
38951
|
* @param {Record<string, any>=} params
|
|
39149
38952
|
* @returns {string}
|
|
38953
|
+
* @throws {URIError}
|
|
39150
38954
|
*/
|
|
39151
38955
|
#buildUrl(url, params) {
|
|
39152
38956
|
if (!params) return url;
|
|
@@ -39156,91 +38960,6 @@
|
|
|
39156
38960
|
|
|
39157
38961
|
return url + (url.includes("?") ? "&" : "?") + query;
|
|
39158
38962
|
}
|
|
39159
|
-
|
|
39160
|
-
/**
|
|
39161
|
-
* Creates a managed SSE connection with reconnect and heartbeat
|
|
39162
|
-
* @param {string} url
|
|
39163
|
-
* @param {ng.SseConfig} config
|
|
39164
|
-
* @returns {import("./interface.ts").SseConnection}
|
|
39165
|
-
*/
|
|
39166
|
-
#createConnection(url, config) {
|
|
39167
|
-
let es;
|
|
39168
|
-
|
|
39169
|
-
let retryCount = 0;
|
|
39170
|
-
|
|
39171
|
-
let closed = false;
|
|
39172
|
-
|
|
39173
|
-
let heartbeatTimer;
|
|
39174
|
-
|
|
39175
|
-
const connect = () => {
|
|
39176
|
-
if (closed) return;
|
|
39177
|
-
|
|
39178
|
-
es = new EventSource(url, {
|
|
39179
|
-
withCredentials: !!config.withCredentials,
|
|
39180
|
-
});
|
|
39181
|
-
|
|
39182
|
-
es.addEventListener("open", (event) => {
|
|
39183
|
-
retryCount = 0;
|
|
39184
|
-
config.onOpen?.(event);
|
|
39185
|
-
|
|
39186
|
-
if (config.heartbeatTimeout) resetHeartbeat();
|
|
39187
|
-
});
|
|
39188
|
-
|
|
39189
|
-
es.addEventListener("message", (event) => {
|
|
39190
|
-
let { data } = event;
|
|
39191
|
-
|
|
39192
|
-
try {
|
|
39193
|
-
data = config.transformMessage ? config.transformMessage(data) : data;
|
|
39194
|
-
} catch {
|
|
39195
|
-
/* empty */
|
|
39196
|
-
}
|
|
39197
|
-
config.onMessage?.(data, event);
|
|
39198
|
-
|
|
39199
|
-
if (config.heartbeatTimeout) resetHeartbeat();
|
|
39200
|
-
});
|
|
39201
|
-
|
|
39202
|
-
es.addEventListener("error", (err) => {
|
|
39203
|
-
config.onError?.(err);
|
|
39204
|
-
|
|
39205
|
-
if (closed) return;
|
|
39206
|
-
es.close();
|
|
39207
|
-
|
|
39208
|
-
if (retryCount < config.maxRetries) {
|
|
39209
|
-
retryCount++;
|
|
39210
|
-
config.onReconnect?.(retryCount);
|
|
39211
|
-
setTimeout(connect, config.retryDelay);
|
|
39212
|
-
} else {
|
|
39213
|
-
this._$log.warn("SSE: Max retries reached");
|
|
39214
|
-
}
|
|
39215
|
-
});
|
|
39216
|
-
};
|
|
39217
|
-
|
|
39218
|
-
const resetHeartbeat = () => {
|
|
39219
|
-
clearTimeout(heartbeatTimer);
|
|
39220
|
-
heartbeatTimer = setTimeout(() => {
|
|
39221
|
-
this._$log.warn("SSE: heartbeat timeout, reconnecting...");
|
|
39222
|
-
es.close();
|
|
39223
|
-
config.onReconnect?.(++retryCount);
|
|
39224
|
-
connect();
|
|
39225
|
-
}, config.heartbeatTimeout);
|
|
39226
|
-
};
|
|
39227
|
-
|
|
39228
|
-
connect();
|
|
39229
|
-
|
|
39230
|
-
return {
|
|
39231
|
-
close() {
|
|
39232
|
-
closed = true;
|
|
39233
|
-
clearTimeout(heartbeatTimer);
|
|
39234
|
-
es.close();
|
|
39235
|
-
},
|
|
39236
|
-
connect() {
|
|
39237
|
-
if (closed === false) {
|
|
39238
|
-
close();
|
|
39239
|
-
}
|
|
39240
|
-
connect();
|
|
39241
|
-
},
|
|
39242
|
-
};
|
|
39243
|
-
}
|
|
39244
38963
|
}
|
|
39245
38964
|
|
|
39246
38965
|
/**
|
|
@@ -39335,11 +39054,7 @@
|
|
|
39335
39054
|
this.defaults = {};
|
|
39336
39055
|
}
|
|
39337
39056
|
|
|
39338
|
-
$get =
|
|
39339
|
-
$injectTokens._exceptionHandler,
|
|
39340
|
-
/** @param {ng.ExceptionHandlerService} $exceptionHandler */
|
|
39341
|
-
($exceptionHandler) => new CookieService(this.defaults, $exceptionHandler),
|
|
39342
|
-
];
|
|
39057
|
+
$get = () => new CookieService(this.defaults);
|
|
39343
39058
|
}
|
|
39344
39059
|
|
|
39345
39060
|
/**
|
|
@@ -39353,14 +39068,10 @@
|
|
|
39353
39068
|
/**
|
|
39354
39069
|
* @param {ng.CookieOptions} defaults
|
|
39355
39070
|
* Default cookie attributes defined by `$cookiesProvider.defaults`.
|
|
39356
|
-
* @param {ng.ExceptionHandlerService} $exceptionHandler
|
|
39357
39071
|
*/
|
|
39358
|
-
constructor(defaults
|
|
39072
|
+
constructor(defaults) {
|
|
39359
39073
|
/** @private @type {ng.CookieOptions} */
|
|
39360
39074
|
this._defaults = Object.freeze({ ...defaults });
|
|
39361
|
-
|
|
39362
|
-
/** @private @type {ng.ExceptionHandlerService} */
|
|
39363
|
-
this._$exceptionHandler = $exceptionHandler;
|
|
39364
39075
|
}
|
|
39365
39076
|
|
|
39366
39077
|
/**
|
|
@@ -39372,14 +39083,9 @@
|
|
|
39372
39083
|
*/
|
|
39373
39084
|
get(key) {
|
|
39374
39085
|
validateIsString(key, "key");
|
|
39086
|
+
const all = parseCookies();
|
|
39375
39087
|
|
|
39376
|
-
|
|
39377
|
-
const all = parseCookies();
|
|
39378
|
-
|
|
39379
|
-
return all[key] || null;
|
|
39380
|
-
} catch (err) {
|
|
39381
|
-
throw this._$exceptionHandler(err);
|
|
39382
|
-
}
|
|
39088
|
+
return all[key] || null;
|
|
39383
39089
|
}
|
|
39384
39090
|
|
|
39385
39091
|
/**
|
|
@@ -39397,13 +39103,7 @@
|
|
|
39397
39103
|
|
|
39398
39104
|
if (!raw) return null;
|
|
39399
39105
|
|
|
39400
|
-
|
|
39401
|
-
return /** @type {T} */ (JSON.parse(raw));
|
|
39402
|
-
} catch (err) {
|
|
39403
|
-
this._$exceptionHandler(err);
|
|
39404
|
-
|
|
39405
|
-
return null;
|
|
39406
|
-
}
|
|
39106
|
+
return /** @type {T} */ (JSON.parse(raw));
|
|
39407
39107
|
}
|
|
39408
39108
|
|
|
39409
39109
|
/**
|
|
@@ -39413,11 +39113,7 @@
|
|
|
39413
39113
|
* @throws {URIError} – If decodeURIComponent fails
|
|
39414
39114
|
*/
|
|
39415
39115
|
getAll() {
|
|
39416
|
-
|
|
39417
|
-
return parseCookies();
|
|
39418
|
-
} catch (err) {
|
|
39419
|
-
return this._$exceptionHandler(err);
|
|
39420
|
-
}
|
|
39116
|
+
return parseCookies();
|
|
39421
39117
|
}
|
|
39422
39118
|
|
|
39423
39119
|
/**
|
|
@@ -39426,6 +39122,7 @@
|
|
|
39426
39122
|
* @param {string} key
|
|
39427
39123
|
* @param {string} value
|
|
39428
39124
|
* @param {ng.CookieOptions} [options]
|
|
39125
|
+
* @throws {URIError} if key or value cannot be encoded
|
|
39429
39126
|
*/
|
|
39430
39127
|
put(key, value, options = {}) {
|
|
39431
39128
|
validateIsString(key, "key");
|
|
@@ -39434,14 +39131,10 @@
|
|
|
39434
39131
|
|
|
39435
39132
|
const encodedVal = encodeURIComponent(value);
|
|
39436
39133
|
|
|
39437
|
-
|
|
39438
|
-
|
|
39439
|
-
|
|
39440
|
-
|
|
39441
|
-
})}`;
|
|
39442
|
-
} catch (err) {
|
|
39443
|
-
this._$exceptionHandler(err);
|
|
39444
|
-
}
|
|
39134
|
+
document.cookie = `${encodedKey}=${encodedVal}${buildOptions({
|
|
39135
|
+
...this._defaults,
|
|
39136
|
+
...options,
|
|
39137
|
+
})}`;
|
|
39445
39138
|
}
|
|
39446
39139
|
|
|
39447
39140
|
/**
|
|
@@ -39455,19 +39148,9 @@
|
|
|
39455
39148
|
putObject(key, value, options) {
|
|
39456
39149
|
validateIsString(key, "key");
|
|
39457
39150
|
validateRequired(value, "value");
|
|
39458
|
-
|
|
39459
|
-
|
|
39460
|
-
try {
|
|
39461
|
-
const str = JSON.stringify(value);
|
|
39151
|
+
const str = JSON.stringify(value);
|
|
39462
39152
|
|
|
39463
|
-
|
|
39464
|
-
} catch (err) {
|
|
39465
|
-
this._$exceptionHandler(
|
|
39466
|
-
new TypeError(
|
|
39467
|
-
`badserialize: "${key}" => ${/** @type {Error} */ (err).message}`,
|
|
39468
|
-
),
|
|
39469
|
-
);
|
|
39470
|
-
}
|
|
39153
|
+
this.put(key, str, options);
|
|
39471
39154
|
}
|
|
39472
39155
|
|
|
39473
39156
|
/**
|
|
@@ -40116,6 +39799,37 @@
|
|
|
40116
39799
|
];
|
|
40117
39800
|
}
|
|
40118
39801
|
|
|
39802
|
+
/**
|
|
39803
|
+
* @returns {ng.Directive}
|
|
39804
|
+
*/
|
|
39805
|
+
function ngListenerDirective() {
|
|
39806
|
+
return {
|
|
39807
|
+
scope: false,
|
|
39808
|
+
link: (scope, element, attrs) => {
|
|
39809
|
+
const channel = attrs.ngListener || element.id;
|
|
39810
|
+
|
|
39811
|
+
const hasTemplateContent = element.childNodes.length;
|
|
39812
|
+
|
|
39813
|
+
/** @type {EventListener} */
|
|
39814
|
+
const fn = (event) => {
|
|
39815
|
+
const value = /** @type {CustomEvent} */ (event).detail;
|
|
39816
|
+
|
|
39817
|
+
if (hasTemplateContent) {
|
|
39818
|
+
if (isObject(value)) {
|
|
39819
|
+
scope.$merge(value);
|
|
39820
|
+
}
|
|
39821
|
+
} else if (isString(value)) {
|
|
39822
|
+
element.innerHTML = value;
|
|
39823
|
+
}
|
|
39824
|
+
};
|
|
39825
|
+
|
|
39826
|
+
element.addEventListener(channel, fn);
|
|
39827
|
+
|
|
39828
|
+
scope.$on("$destroy", () => element.removeEventListener(channel, fn));
|
|
39829
|
+
},
|
|
39830
|
+
};
|
|
39831
|
+
}
|
|
39832
|
+
|
|
40119
39833
|
/**
|
|
40120
39834
|
* Initializes core `ng` module.
|
|
40121
39835
|
* @param {ng.Angular} angular
|
|
@@ -40165,6 +39879,7 @@
|
|
|
40165
39879
|
ngInclude: ngIncludeDirective,
|
|
40166
39880
|
ngInject: ngInjectDirective,
|
|
40167
39881
|
ngInit: ngInitDirective,
|
|
39882
|
+
ngListener: ngListenerDirective,
|
|
40168
39883
|
ngMessages: ngMessagesDirective,
|
|
40169
39884
|
ngMessage: ngMessageDirective,
|
|
40170
39885
|
ngMessageExp: ngMessageExpDirective,
|
|
@@ -40201,7 +39916,7 @@
|
|
|
40201
39916
|
ngScope: ngScopeDirective,
|
|
40202
39917
|
})
|
|
40203
39918
|
.directive({
|
|
40204
|
-
input:
|
|
39919
|
+
input: hiddenInputDirective,
|
|
40205
39920
|
ngAnimateSwap: ngAnimateSwapDirective,
|
|
40206
39921
|
ngAnimateChildren: $$AnimateChildrenDirective,
|
|
40207
39922
|
// aria directives
|
|
@@ -40293,8 +40008,13 @@
|
|
|
40293
40008
|
/** @type {ModuleRegistry} */
|
|
40294
40009
|
const moduleRegistry = {};
|
|
40295
40010
|
|
|
40296
|
-
class Angular {
|
|
40297
|
-
constructor() {
|
|
40011
|
+
class Angular extends EventTarget {
|
|
40012
|
+
constructor(submodule = false) {
|
|
40013
|
+
super();
|
|
40014
|
+
|
|
40015
|
+
/** @private @type {boolean} */
|
|
40016
|
+
this._submodule = submodule;
|
|
40017
|
+
|
|
40298
40018
|
/** @private @type {!Array<string|any>} */
|
|
40299
40019
|
this._bootsrappedModules = [];
|
|
40300
40020
|
|
|
@@ -40308,7 +40028,7 @@
|
|
|
40308
40028
|
* @public
|
|
40309
40029
|
* @type {string} `version` from `package.json`
|
|
40310
40030
|
*/
|
|
40311
|
-
this.version = "0.15.
|
|
40031
|
+
this.version = "0.15.2"; //inserted via rollup plugin
|
|
40312
40032
|
|
|
40313
40033
|
/**
|
|
40314
40034
|
* Gets the controller instance for a given element, if exists. Defaults to "ngControllerController"
|
|
@@ -40338,7 +40058,9 @@
|
|
|
40338
40058
|
/** @type {any} */ (this.$t)[i] = i;
|
|
40339
40059
|
});
|
|
40340
40060
|
|
|
40341
|
-
|
|
40061
|
+
if (!submodule) {
|
|
40062
|
+
window.angular = this;
|
|
40063
|
+
}
|
|
40342
40064
|
registerNgModule(this);
|
|
40343
40065
|
}
|
|
40344
40066
|
|