@angular-wave/angular.ts 0.7.8 → 0.8.1
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/{loader.d.ts → angular.d.ts} +3 -3
- package/@types/core/di/ng-module.d.ts +61 -25
- package/@types/core/parse/parse.d.ts +6 -7
- package/@types/directive/bind/bind.d.ts +2 -1
- package/@types/index.d.ts +1 -1
- package/@types/interface.d.ts +4 -2
- package/@types/{public.d.ts → ng.d.ts} +2 -2
- package/@types/router/directives/state-directives.d.ts +2 -2
- package/@types/router/directives/view-directive.d.ts +1 -1
- package/@types/router/params/param-type.d.ts +0 -1
- package/@types/router/path/path-utils.d.ts +8 -11
- package/@types/router/{globals.d.ts → router.d.ts} +2 -2
- package/@types/router/state/interface.d.ts +1 -1
- package/@types/router/state/state-object.d.ts +1 -1
- package/@types/router/state/state-registry.d.ts +2 -2
- package/@types/router/state/state-service.d.ts +14 -16
- package/@types/router/state-filters.d.ts +24 -2
- package/@types/router/transition/transition-service.d.ts +3 -3
- package/@types/router/transition/transition.d.ts +16 -19
- package/@types/router/url/url-matcher.d.ts +3 -4
- package/@types/router/url/url-rule.d.ts +14 -4
- package/@types/router/url/url-rules.d.ts +26 -6
- package/@types/router/url/url-service.d.ts +28 -38
- package/@types/services/http/http.d.ts +48 -1
- package/@types/services/http-backend/http-backend.d.ts +48 -35
- package/@types/services/location/interface.d.ts +55 -0
- package/@types/services/location/location.d.ts +225 -252
- package/@types/shared/common.d.ts +0 -2
- package/@types/shared/hof.d.ts +0 -6
- package/@types/shared/interface.d.ts +0 -4
- package/@types/{router/common → shared}/queue.d.ts +2 -2
- package/@types/shared/url-utils/interface.d.ts +0 -1
- package/@types/shared/url-utils/url-utils.d.ts +0 -5
- package/@types/shared/utils.d.ts +29 -6
- package/CHANGELOG.md +0 -72
- package/CONTRIBUTING.md +0 -1
- package/DEVELOPERS.md +0 -1
- package/Makefile +6 -3
- package/TRIAGING.md +0 -1
- package/dist/angular-ts.esm.js +1048 -1150
- package/dist/angular-ts.umd.js +1048 -1150
- package/dist/angular-ts.umd.min.js +1 -1
- package/docs/assets/scss/index.scss +23 -0
- package/docs/content/_index.md +9 -8
- package/docs/content/docs/_index.md +1 -1
- package/docs/content/docs/directive/app.md +1 -1
- package/docs/content/docs/directive/bind.md +1 -1
- package/docs/content/docs/directive/blur.md +1 -1
- package/docs/content/docs/directive/channel.md +2 -2
- package/docs/content/docs/directive/class-even.md +1 -1
- package/docs/content/docs/directive/class-odd.md +1 -1
- package/docs/content/docs/directive/class.md +1 -1
- package/docs/content/docs/directive/click.md +1 -1
- package/docs/content/docs/directive/copy.md +1 -1
- package/docs/content/docs/directive/cut.md +1 -1
- package/docs/content/docs/directive/dblclick.md +1 -1
- package/docs/content/docs/directive/focus.md +1 -1
- package/docs/content/docs/directive/get.md +3 -3
- package/docs/content/docs/directive/keydown.md +1 -1
- package/docs/content/docs/directive/keyup.md +1 -1
- package/docs/content/docs/directive/load.md +1 -1
- package/docs/content/docs/directive/mousedown.md +1 -1
- package/docs/content/docs/directive/mouseenter.md +1 -1
- package/docs/content/docs/directive/mouseleave.md +1 -1
- package/docs/content/docs/directive/mousemove.md +1 -1
- package/docs/content/docs/directive/mouseout.md +1 -1
- package/docs/content/docs/directive/mouseover.md +1 -1
- package/docs/content/docs/directive/mouseup.md +1 -1
- package/docs/content/docs/directive/non-bindable.md +28 -0
- package/docs/content/docs/provider/locationProvider.md +26 -0
- package/docs/content/docs/provider/templateCacheProvider.md +2 -2
- package/docs/content/docs/service/location.md +57 -0
- package/docs/content/docs/service/url.md +5 -0
- package/docs/layouts/partials/hooks/head-end.html +1 -1
- package/docs/layouts/shortcodes/version.html +1 -0
- package/docs/static/examples/counter/counter-test.html +0 -4
- package/docs/static/examples/eventbus/eventbus-test.html +0 -4
- package/docs/static/examples/ng-non-bindable/ng-non-bindable-test.html +13 -0
- package/docs/static/examples/ng-non-bindable/ng-non-bindable.html +3 -0
- package/docs/static/examples/ng-non-bindable/ng-non-bindable.test.js +11 -0
- package/docs/static/typedoc/assets/hierarchy.js +1 -1
- package/docs/static/typedoc/assets/highlight.css +6 -6
- package/docs/static/typedoc/assets/navigation.js +1 -1
- package/docs/static/typedoc/assets/search.js +1 -1
- package/docs/static/typedoc/classes/Location.html +55 -0
- package/docs/static/typedoc/classes/LocationProvider.html +20 -0
- package/docs/static/typedoc/classes/NgModule.html +3 -3
- package/docs/static/typedoc/index.html +1 -1
- package/docs/static/typedoc/interfaces/DefaultPorts.html +5 -0
- package/docs/static/typedoc/interfaces/Html5Mode.html +23 -0
- package/docs/static/typedoc/interfaces/Provider.html +2 -1
- package/docs/static/typedoc/interfaces/UrlParts.html +9 -0
- package/docs/static/typedoc/types/AnnotatedFactory.html +1 -1
- package/docs/static/typedoc/types/Expression.html +1 -1
- package/docs/static/typedoc/types/Injectable.html +4 -1
- package/docs/static/typedoc/types/InjectableFactory.html +1 -4
- package/docs/static/typedoc/types/UrlChangeListener.html +5 -0
- package/docs/static/version.js +13 -0
- package/docs/test-results/.last-run.json +4 -0
- package/docs/test-results/static-examples-counter-counter-counter-example/error-context.md +50 -0
- package/package.json +2 -2
- package/src/{loader.js → angular.js} +11 -11
- package/src/angular.spec.js +189 -21
- package/src/animations/animate-css.js +17 -18
- package/src/animations/animate.spec.js +1 -1
- package/src/animations/shared.js +2 -3
- package/src/binding.spec.js +1 -1
- package/src/core/compile/compile.js +4 -7
- package/src/core/compile/compile.spec.js +1 -1
- package/src/core/controller/controller.spec.js +1 -1
- package/src/core/controller/controller.test.js +1 -0
- package/src/core/di/injector.js +7 -8
- package/src/core/di/injector.spec.js +2 -2
- package/src/core/di/injector.test.js +2 -2
- package/src/core/di/internal-injector.js +3 -6
- package/src/core/di/ng-module.js +26 -21
- package/src/core/filter/filter.js +1 -1
- package/src/core/filter/filter.spec.js +1 -1
- package/src/core/filter/filter.test.js +1 -0
- package/src/core/interpolate/interpolate.js +4 -6
- package/src/core/interpolate/interpolate.spec.js +1 -1
- package/src/core/interpolate/interpolate.test.js +1 -0
- package/src/core/parse/ast/ast.spec.js +1 -1
- package/src/core/parse/ast/ast.test.js +1 -1
- package/src/core/parse/lexer/lexer.spec.js +1 -1
- package/src/core/parse/parse.js +150 -146
- package/src/core/parse/parse.spec.js +46 -46
- package/src/core/prop.spec.js +1 -1
- package/src/core/root-element.spec.js +1 -1
- package/src/core/scope/scope.js +10 -11
- package/src/core/scope/scope.spec.js +3 -4
- package/src/directive/aria/aria.spec.js +1 -1
- package/src/directive/aria/aria.test.js +1 -0
- package/src/directive/attrs/attrs.spec.js +1 -1
- package/src/directive/attrs/attrs.test.js +1 -0
- package/src/directive/attrs/boolean.spec.js +1 -1
- package/src/directive/attrs/boolean.test.js +1 -0
- package/src/directive/attrs/element-style.spec.js +1 -1
- package/src/directive/attrs/element-style.test.js +1 -0
- package/src/directive/attrs/src.spec.js +1 -1
- package/src/directive/attrs/src.test.js +1 -0
- package/src/directive/bind/bind-html.spec.js +1 -1
- package/src/directive/bind/bind.js +1 -0
- package/src/directive/bind/bind.spec.js +1 -1
- package/src/directive/bind/bind.test.js +1 -0
- package/src/directive/channel/channel.spec.js +1 -1
- package/src/directive/channel/channel.test.js +1 -0
- package/src/directive/class/class.spec.js +1 -1
- package/src/directive/class/class.test.js +1 -0
- package/src/directive/cloak/cloak.spec.js +1 -1
- package/src/directive/cloak/cloak.test.js +1 -0
- package/src/directive/controller/controller.spec.js +1 -1
- package/src/directive/controller/controller.test.js +1 -0
- package/src/directive/events/click.spec.js +1 -1
- package/src/directive/events/event.spec.js +6 -6
- package/src/directive/events/events.test.js +1 -0
- package/src/directive/form/form.js +8 -5
- package/src/directive/form/form.spec.js +1 -1
- package/src/directive/form/form.test.js +1 -0
- package/src/directive/http/delete.spec.js +1 -1
- package/src/directive/http/form-test.html +18 -0
- package/src/directive/http/get.spec.js +1 -1
- package/src/directive/http/http.js +12 -3
- package/src/directive/http/post.spec.js +504 -9
- package/src/directive/http/put.spec.js +1 -1
- package/src/directive/if/if.spec.js +1 -1
- package/src/directive/include/include.spec.js +1 -1
- package/src/directive/init/init.spec.js +1 -1
- package/src/directive/init/init.test.js +1 -0
- package/src/directive/input/input.js +13 -15
- package/src/directive/input/input.spec.js +1 -2
- package/src/directive/input/input.test.js +1 -0
- package/src/directive/messages/messages.md +0 -4
- package/src/directive/messages/messages.spec.js +1 -1
- package/src/directive/messages/messages.test.js +1 -0
- package/src/directive/model/model.js +13 -13
- package/src/directive/model/model.spec.js +1 -1
- package/src/directive/model/model.test.js +1 -0
- package/src/directive/model-options/model-option.test.js +1 -0
- package/src/directive/model-options/model-options.js +1 -1
- package/src/directive/model-options/model-options.spec.js +1 -1
- package/src/directive/non-bindable/non-bindable.spec.js +1 -1
- package/src/directive/non-bindable/non-bindable.test.js +1 -0
- package/src/directive/observe/observe.spec.js +1 -1
- package/src/directive/observe/observe.test.js +1 -0
- package/src/directive/on/on.spec.js +1 -1
- package/src/directive/on/on.test.js +1 -0
- package/src/directive/options/options.spec.js +1 -1
- package/src/directive/options/options.test.js +1 -0
- package/src/directive/ref/href.spec.js +1 -1
- package/src/directive/ref/href.test.js +2 -0
- package/src/directive/ref/ref.spec.js +1 -1
- package/src/directive/repeat/repeat.js +1 -1
- package/src/directive/repeat/repeat.spec.js +2 -3
- package/src/directive/repeat/repeat.test.js +1 -0
- package/src/directive/script/script.spec.js +1 -1
- package/src/directive/script/script.test.js +1 -0
- package/src/directive/select/select.js +1 -1
- package/src/directive/select/select.spec.js +1 -1
- package/src/directive/select/select.test.js +1 -0
- package/src/directive/setter/setter.spec.js +1 -1
- package/src/directive/setter/setter.test.js +1 -0
- package/src/directive/show-hide/show-hide.spec.js +1 -1
- package/src/directive/show-hide/show-hide.test.js +1 -0
- package/src/directive/style/style.spec.js +1 -1
- package/src/directive/style/style.test.js +1 -0
- package/src/directive/switch/switch.spec.js +1 -1
- package/src/directive/switch/switch.test.js +1 -0
- package/src/directive/validators/validators.js +82 -84
- package/src/directive/validators/validators.spec.js +5 -4
- package/src/directive/validators/validators.test.js +1 -0
- package/src/filters/filter.spec.js +1 -1
- package/src/filters/filters.spec.js +1 -1
- package/src/filters/limit-to.js +2 -3
- package/src/filters/limit-to.spec.js +1 -1
- package/src/filters/order-by.spec.js +1 -1
- package/src/index.js +1 -1
- package/src/injection-tokens.js +7 -3
- package/src/interface.ts +4 -3
- package/src/loader.md +0 -155
- package/src/{public.js → ng.js} +11 -12
- package/src/{public.spec.js → ng.spec.js} +2 -2
- package/src/router/directives/state-directives.js +5 -5
- package/src/router/directives/state-directives.spec.js +8 -7
- package/src/router/directives/view-directive.js +7 -13
- package/src/router/directives/view-directive.spec.js +22 -23
- package/src/router/{common/common.html → glob/glob.html} +2 -3
- package/src/router/{common/common.test.js → glob/glob.test.js} +2 -1
- package/src/router/params/param-type.js +0 -1
- package/src/router/params/param.js +1 -1
- package/src/router/path/path-utils.js +5 -0
- package/src/router/router-test-hashbang.html +45 -0
- package/src/router/{globals.js → router.js} +2 -2
- package/src/router/services.spec.js +8 -9
- package/src/router/state/interface.ts +1 -1
- package/src/router/state/state-builder.js +3 -3
- package/src/router/state/state-builder.spec.js +1 -1
- package/src/router/state/state-object.js +1 -1
- package/src/router/state/state-registry.js +4 -4
- package/src/router/state/state-service.js +14 -14
- package/src/router/state/state.spec.js +23 -22
- package/src/router/state/state.test.js +1 -0
- package/src/router/state/views.js +1 -1
- package/src/router/state-filter.spec.js +1 -1
- package/src/router/state-filters.js +13 -9
- package/src/router/template-factory.js +5 -4
- package/src/router/template-factory.spec.js +7 -7
- package/src/router/transition/hook-registry.js +1 -1
- package/src/router/transition/transition-service.js +7 -6
- package/src/router/transition/transition.js +6 -6
- package/src/router/url/url-matcher.js +12 -14
- package/src/router/url/url-rule.js +8 -2
- package/src/router/url/url-rules.js +8 -5
- package/src/router/url/url-service.js +80 -76
- package/src/router/url/url-service.spec.js +61 -78
- package/src/router/url/url.test.js +1 -0
- package/src/router/view/view.js +4 -5
- package/src/router/view/view.spec.js +10 -12
- package/src/router/view/view.test.js +1 -0
- package/src/router/view-hook.spec.js +1 -1
- package/src/router/view-scroll.js +3 -1
- package/src/router/view-scroll.spec.js +12 -12
- package/src/services/anchor-scroll.html +2 -2
- package/src/services/anchor-scroll.js +5 -4
- package/src/services/http/http.js +9 -4
- package/src/services/http/http.spec.js +2 -7
- package/src/services/http/template-request.spec.js +1 -1
- package/src/services/http-backend/http-backend.js +51 -77
- package/src/services/http-backend/http-backend.spec.js +1 -2
- package/src/services/http-backend/http-backend.test.js +1 -0
- package/src/services/location/interface.ts +62 -0
- package/src/services/location/location.js +439 -519
- package/src/services/location/location.spec.js +915 -530
- package/src/services/location/location.test.js +2 -2
- package/src/services/log/log.spec.js +1 -1
- package/src/services/log/log.test.js +1 -0
- package/src/services/pubsub/pubsub.spec.js +1 -1
- package/src/services/sce/sce.js +5 -7
- package/src/services/sce/sce.md +2 -2
- package/src/services/sce/sce.spec.js +1 -1
- package/src/services/template-cache/template-cache.spec.js +1 -1
- package/src/services/template-cache/template-cache.test.js +1 -0
- package/src/shared/common.js +5 -10
- package/src/shared/common.spec.js +1 -1
- package/src/shared/hof.js +0 -14
- package/src/shared/interface.ts +0 -4
- package/src/{router/common → shared}/queue.js +7 -7
- package/src/shared/shared.html +1 -0
- package/src/shared/shared.test.js +1 -0
- package/src/shared/url-utils/interface.ts +0 -2
- package/src/shared/url-utils/url-utils.js +6 -30
- package/src/shared/url-utils/url-utils.spec.js +10 -9
- package/src/shared/utils.js +32 -9
- package/src/shared/utils.spec.js +35 -1
- package/src/src.html +1 -2
- package/typedoc.json +0 -1
- package/utils/express.js +27 -1
- package/utils/version.cjs +23 -0
- package/@types/router/state-provider.d.ts +0 -123
- package/src/directive/non-bindable/non-bindable.md +0 -17
- package/src/loader.spec.js +0 -169
- package/src/router/state-provider.js +0 -146
- package/src/services/location/location.md +0 -114
- package/src/shared/url-utils/url-utils.md +0 -46
- /package/@types/router/{common → glob}/glob.d.ts +0 -0
- /package/src/router/{common → glob}/glob.js +0 -0
- /package/src/router/{common → glob}/glob.spec.js +0 -0
- /package/src/{router/common → shared}/queue.spec.js +0 -0
package/dist/angular-ts.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Version: 0.
|
|
1
|
+
/* Version: 0.8.1 - August 7, 2025 18:30:07 */
|
|
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) :
|
|
@@ -355,14 +355,6 @@
|
|
|
355
355
|
return baseExtend(dst, src);
|
|
356
356
|
}
|
|
357
357
|
|
|
358
|
-
/**
|
|
359
|
-
* @param {string} str
|
|
360
|
-
* @returns {number}
|
|
361
|
-
*/
|
|
362
|
-
function toInt(str) {
|
|
363
|
-
return parseInt(str, 10);
|
|
364
|
-
}
|
|
365
|
-
|
|
366
358
|
/**
|
|
367
359
|
* @param {any} num
|
|
368
360
|
* @returns {boolean}
|
|
@@ -795,7 +787,7 @@
|
|
|
795
787
|
try {
|
|
796
788
|
return decodeURIComponent(value);
|
|
797
789
|
} catch {
|
|
798
|
-
|
|
790
|
+
/* empty */
|
|
799
791
|
}
|
|
800
792
|
}
|
|
801
793
|
|
|
@@ -809,6 +801,7 @@
|
|
|
809
801
|
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
|
|
810
802
|
* sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
|
|
811
803
|
* / "*" / "+" / "," / ";" / "="
|
|
804
|
+
* @param {string} val
|
|
812
805
|
*/
|
|
813
806
|
function encodeUriSegment(val) {
|
|
814
807
|
return encodeUriQuery(val, true)
|
|
@@ -1182,6 +1175,36 @@
|
|
|
1182
1175
|
return new Promise((resolve) => setTimeout(resolve, t));
|
|
1183
1176
|
}
|
|
1184
1177
|
|
|
1178
|
+
/**
|
|
1179
|
+
* Checks if a given string starts with a specified substring.
|
|
1180
|
+
*
|
|
1181
|
+
* This is a simple polyfill-like function that mimics the behavior of
|
|
1182
|
+
* `String.prototype.startsWith` without using the built-in method.
|
|
1183
|
+
*
|
|
1184
|
+
* @param {string} str - The full string to evaluate.
|
|
1185
|
+
* @param {string} search - The substring to test against the beginning of `str`.
|
|
1186
|
+
* @returns {boolean} `true` if `str` starts with `search`, otherwise `false`.
|
|
1187
|
+
*
|
|
1188
|
+
* @example
|
|
1189
|
+
* startsWith("hello world", "hello");
|
|
1190
|
+
* // returns true
|
|
1191
|
+
*
|
|
1192
|
+
* @example
|
|
1193
|
+
* startsWith("hello world", "world");
|
|
1194
|
+
* // returns false
|
|
1195
|
+
*
|
|
1196
|
+
* @example
|
|
1197
|
+
* startsWith("test", "");
|
|
1198
|
+
* // returns true (empty search string always matches)
|
|
1199
|
+
*
|
|
1200
|
+
* @example
|
|
1201
|
+
* startsWith("abc", "abcd");
|
|
1202
|
+
* // returns false
|
|
1203
|
+
*/
|
|
1204
|
+
function startsWith(str, search) {
|
|
1205
|
+
return str.slice(0, search.length) === search;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1185
1208
|
/**
|
|
1186
1209
|
* Expando cache for adding properties to DOM nodes with JavaScript.
|
|
1187
1210
|
* This used to be an Object in JQLite decorator, but swapped out for a Map
|
|
@@ -1765,6 +1788,9 @@
|
|
|
1765
1788
|
* @type Readonly<Record<string, string>>
|
|
1766
1789
|
*/
|
|
1767
1790
|
const $injectTokens = Object.freeze({
|
|
1791
|
+
$attrs: "$attrs",
|
|
1792
|
+
$scope: "$scope",
|
|
1793
|
+
$element: "$element",
|
|
1768
1794
|
$$AnimateRunner: "$$AnimateRunner",
|
|
1769
1795
|
$$animateAsyncRun: "$$animateAsyncRun",
|
|
1770
1796
|
$$animateCache: "$$animateCache",
|
|
@@ -1790,10 +1816,11 @@
|
|
|
1790
1816
|
$interpolate: "$interpolate",
|
|
1791
1817
|
$location: "$location",
|
|
1792
1818
|
$log: "$log",
|
|
1793
|
-
$
|
|
1819
|
+
$viewScroll: "$viewScroll",
|
|
1794
1820
|
$parse: "$parse",
|
|
1795
1821
|
$rootScope: "$rootScope",
|
|
1796
|
-
$
|
|
1822
|
+
$rootElement: "$rootElement",
|
|
1823
|
+
$router: "$router",
|
|
1797
1824
|
$sce: "$sce",
|
|
1798
1825
|
$sceDelegate: "$sceDelegate",
|
|
1799
1826
|
$state: "$state",
|
|
@@ -1803,7 +1830,7 @@
|
|
|
1803
1830
|
$templateRequest: "$templateRequest",
|
|
1804
1831
|
$transitions: "$transitions",
|
|
1805
1832
|
$urlConfig: "$urlConfig",
|
|
1806
|
-
$
|
|
1833
|
+
$url: "$url",
|
|
1807
1834
|
$view: "$view",
|
|
1808
1835
|
// provide literals
|
|
1809
1836
|
$provide: "$provide",
|
|
@@ -1847,7 +1874,7 @@
|
|
|
1847
1874
|
/**
|
|
1848
1875
|
* @param {string} name - Name of the module
|
|
1849
1876
|
* @param {Array<string>} requires - List of modules which the injector will load before the current module
|
|
1850
|
-
* @param {
|
|
1877
|
+
* @param {import("../../interface.js").Injectable} [configFn]
|
|
1851
1878
|
*/
|
|
1852
1879
|
constructor(name, requires, configFn) {
|
|
1853
1880
|
assert(isString(name), "name required");
|
|
@@ -1873,7 +1900,7 @@
|
|
|
1873
1900
|
/** @type {!Array<Array<*>>} */
|
|
1874
1901
|
this.configBlocks = [];
|
|
1875
1902
|
|
|
1876
|
-
/** @type {!Array.<
|
|
1903
|
+
/** @type {!Array.<import("../../interface.js").Injectable>} */
|
|
1877
1904
|
this.runBlocks = [];
|
|
1878
1905
|
|
|
1879
1906
|
if (configFn) {
|
|
@@ -1903,7 +1930,7 @@
|
|
|
1903
1930
|
|
|
1904
1931
|
/**
|
|
1905
1932
|
*
|
|
1906
|
-
* @param {
|
|
1933
|
+
* @param {import("../../interface.js").Injectable} configFn
|
|
1907
1934
|
* @returns {NgModule}
|
|
1908
1935
|
*/
|
|
1909
1936
|
config(configFn) {
|
|
@@ -1912,7 +1939,7 @@
|
|
|
1912
1939
|
}
|
|
1913
1940
|
|
|
1914
1941
|
/**
|
|
1915
|
-
* @param {
|
|
1942
|
+
* @param {import("../../interface.js").Injectable} block
|
|
1916
1943
|
* @returns {NgModule}
|
|
1917
1944
|
*/
|
|
1918
1945
|
run(block) {
|
|
@@ -1922,12 +1949,12 @@
|
|
|
1922
1949
|
|
|
1923
1950
|
/**
|
|
1924
1951
|
* @param {string} name
|
|
1925
|
-
* @param {
|
|
1952
|
+
* @param {import("../../interface.js").Injectable} options
|
|
1926
1953
|
* @returns {NgModule}
|
|
1927
1954
|
*/
|
|
1928
1955
|
component(name, options) {
|
|
1929
1956
|
if (options && isFunction(options)) {
|
|
1930
|
-
options
|
|
1957
|
+
options["$$moduleName"] = name;
|
|
1931
1958
|
}
|
|
1932
1959
|
this.invokeQueue.push([COMPILE_LITERAL, "component", [name, options]]);
|
|
1933
1960
|
return this;
|
|
@@ -1935,12 +1962,12 @@
|
|
|
1935
1962
|
|
|
1936
1963
|
/**
|
|
1937
1964
|
* @param {string} name
|
|
1938
|
-
* @param {
|
|
1965
|
+
* @param {import("../../interface.js").Injectable} providerFunction
|
|
1939
1966
|
* @returns {NgModule}
|
|
1940
1967
|
*/
|
|
1941
1968
|
factory(name, providerFunction) {
|
|
1942
1969
|
if (providerFunction && isFunction(providerFunction)) {
|
|
1943
|
-
providerFunction
|
|
1970
|
+
providerFunction["$$moduleName"] = name;
|
|
1944
1971
|
}
|
|
1945
1972
|
this.invokeQueue.push([$injectTokens.$provide, "factory", [name, providerFunction]]);
|
|
1946
1973
|
return this;
|
|
@@ -1948,12 +1975,12 @@
|
|
|
1948
1975
|
|
|
1949
1976
|
/**
|
|
1950
1977
|
* @param {string} name
|
|
1951
|
-
* @param {
|
|
1978
|
+
* @param {import("../../interface.js").Injectable} serviceFunction
|
|
1952
1979
|
* @returns {NgModule}
|
|
1953
1980
|
*/
|
|
1954
1981
|
service(name, serviceFunction) {
|
|
1955
1982
|
if (serviceFunction && isFunction(serviceFunction)) {
|
|
1956
|
-
serviceFunction
|
|
1983
|
+
serviceFunction["$$moduleName"] = name;
|
|
1957
1984
|
}
|
|
1958
1985
|
this.invokeQueue.push([$injectTokens.$provide, "service", [name, serviceFunction]]);
|
|
1959
1986
|
return this;
|
|
@@ -1961,12 +1988,12 @@
|
|
|
1961
1988
|
|
|
1962
1989
|
/**
|
|
1963
1990
|
* @param {string} name
|
|
1964
|
-
* @param {
|
|
1991
|
+
* @param {import("../../interface.js").Injectable} providerType
|
|
1965
1992
|
* @returns {NgModule}
|
|
1966
1993
|
*/
|
|
1967
1994
|
provider(name, providerType) {
|
|
1968
1995
|
if (providerType && isFunction(providerType)) {
|
|
1969
|
-
providerType
|
|
1996
|
+
providerType["$$moduleName"] = name;
|
|
1970
1997
|
}
|
|
1971
1998
|
this.invokeQueue.push([$injectTokens.$provide, "provider", [name, providerType]]);
|
|
1972
1999
|
return this;
|
|
@@ -1974,12 +2001,12 @@
|
|
|
1974
2001
|
|
|
1975
2002
|
/**
|
|
1976
2003
|
* @param {string} name
|
|
1977
|
-
* @param {
|
|
2004
|
+
* @param {import("../../interface.js").Injectable} decorFn
|
|
1978
2005
|
* @returns {NgModule}
|
|
1979
2006
|
*/
|
|
1980
2007
|
decorator(name, decorFn) {
|
|
1981
2008
|
if (decorFn && isFunction(decorFn)) {
|
|
1982
|
-
decorFn
|
|
2009
|
+
decorFn["$$moduleName"] = name;
|
|
1983
2010
|
}
|
|
1984
2011
|
this.configBlocks.push([$injectTokens.$provide, "decorator", [name, decorFn]]);
|
|
1985
2012
|
return this;
|
|
@@ -1987,12 +2014,12 @@
|
|
|
1987
2014
|
|
|
1988
2015
|
/**
|
|
1989
2016
|
* @param {string} name
|
|
1990
|
-
* @param {
|
|
2017
|
+
* @param {import("../../interface.js").Injectable} directiveFactory
|
|
1991
2018
|
* @returns {NgModule}
|
|
1992
2019
|
*/
|
|
1993
2020
|
directive(name, directiveFactory) {
|
|
1994
2021
|
if (directiveFactory && isFunction(directiveFactory)) {
|
|
1995
|
-
directiveFactory
|
|
2022
|
+
directiveFactory["$$moduleName"] = name;
|
|
1996
2023
|
}
|
|
1997
2024
|
this.invokeQueue.push([
|
|
1998
2025
|
COMPILE_LITERAL,
|
|
@@ -2004,12 +2031,12 @@
|
|
|
2004
2031
|
|
|
2005
2032
|
/**
|
|
2006
2033
|
* @param {string} name
|
|
2007
|
-
* @param {
|
|
2034
|
+
* @param {import("../../interface.js").Injectable} animationFactory
|
|
2008
2035
|
* @returns {NgModule}
|
|
2009
2036
|
*/
|
|
2010
2037
|
animation(name, animationFactory) {
|
|
2011
2038
|
if (animationFactory && isFunction(animationFactory)) {
|
|
2012
|
-
animationFactory
|
|
2039
|
+
animationFactory["$$moduleName"] = name;
|
|
2013
2040
|
}
|
|
2014
2041
|
this.invokeQueue.push([
|
|
2015
2042
|
ANIMATION_LITERAL,
|
|
@@ -2019,9 +2046,14 @@
|
|
|
2019
2046
|
return this;
|
|
2020
2047
|
}
|
|
2021
2048
|
|
|
2049
|
+
/**
|
|
2050
|
+
* @param {string} name
|
|
2051
|
+
* @param {import("../../interface.js").Injectable} filterFn
|
|
2052
|
+
* @return {NgModule}
|
|
2053
|
+
*/
|
|
2022
2054
|
filter(name, filterFn) {
|
|
2023
2055
|
if (filterFn && isFunction(filterFn)) {
|
|
2024
|
-
filterFn
|
|
2056
|
+
filterFn["$$moduleName"] = name;
|
|
2025
2057
|
}
|
|
2026
2058
|
this.invokeQueue.push([FILTER_LITERAL, "register", [name, filterFn]]);
|
|
2027
2059
|
return this;
|
|
@@ -2029,12 +2061,12 @@
|
|
|
2029
2061
|
|
|
2030
2062
|
/**
|
|
2031
2063
|
* @param {string} name
|
|
2032
|
-
* @param {
|
|
2064
|
+
* @param {import("../../interface.js").Injectable} ctlFn
|
|
2033
2065
|
* @returns {NgModule}
|
|
2034
2066
|
*/
|
|
2035
2067
|
controller(name, ctlFn) {
|
|
2036
2068
|
if (ctlFn && isFunction(ctlFn)) {
|
|
2037
|
-
ctlFn
|
|
2069
|
+
ctlFn["$$moduleName"] = name;
|
|
2038
2070
|
}
|
|
2039
2071
|
this.invokeQueue.push([CONTROLLER_LITERAL, "register", [name, ctlFn]]);
|
|
2040
2072
|
return this;
|
|
@@ -2149,8 +2181,7 @@
|
|
|
2149
2181
|
|
|
2150
2182
|
if (isClass(/** @type {Function} */ (fn))) {
|
|
2151
2183
|
args.unshift(null);
|
|
2152
|
-
|
|
2153
|
-
return res;
|
|
2184
|
+
return new (Function.prototype.bind.apply(fn, args))();
|
|
2154
2185
|
} else {
|
|
2155
2186
|
return /** @type {Function} */ (fn).apply(self, args);
|
|
2156
2187
|
}
|
|
@@ -2239,8 +2270,7 @@
|
|
|
2239
2270
|
*/
|
|
2240
2271
|
factory(serviceName) {
|
|
2241
2272
|
const provider = this.providerInjector.get(serviceName + providerSuffix$1);
|
|
2242
|
-
|
|
2243
|
-
return res;
|
|
2273
|
+
return this.invoke(provider.$get, provider, undefined, serviceName);
|
|
2244
2274
|
}
|
|
2245
2275
|
|
|
2246
2276
|
/**
|
|
@@ -2274,8 +2304,7 @@
|
|
|
2274
2304
|
*/
|
|
2275
2305
|
function extractArgs$1(fn) {
|
|
2276
2306
|
const fnText = stringifyFn$1(fn).replace(STRIP_COMMENTS$1, "");
|
|
2277
|
-
|
|
2278
|
-
return args;
|
|
2307
|
+
return fnText.match(ARROW_ARG$1) || fnText.match(FN_ARGS$1);
|
|
2279
2308
|
}
|
|
2280
2309
|
|
|
2281
2310
|
/**
|
|
@@ -2566,8 +2595,7 @@
|
|
|
2566
2595
|
*/
|
|
2567
2596
|
function extractArgs(fn) {
|
|
2568
2597
|
const fnText = stringifyFn(fn).replace(STRIP_COMMENTS, "");
|
|
2569
|
-
|
|
2570
|
-
return args;
|
|
2598
|
+
return fnText.match(ARROW_ARG) || fnText.match(FN_ARGS);
|
|
2571
2599
|
}
|
|
2572
2600
|
|
|
2573
2601
|
/**
|
|
@@ -3024,11 +3052,7 @@
|
|
|
3024
3052
|
}
|
|
3025
3053
|
}
|
|
3026
3054
|
|
|
3027
|
-
const urlParsingNode = document.createElement("a");
|
|
3028
3055
|
const originUrl = urlResolve(window.location.href);
|
|
3029
|
-
let baseUrlParsingNode;
|
|
3030
|
-
|
|
3031
|
-
urlParsingNode.href = "http://[::1]";
|
|
3032
3056
|
|
|
3033
3057
|
/**
|
|
3034
3058
|
* @param {import("./interface.js").ResolvableUrl} url
|
|
@@ -3038,7 +3062,10 @@
|
|
|
3038
3062
|
if (!isString(url))
|
|
3039
3063
|
return /** @type {import("./interface.js").ParsedUrl} */ (url);
|
|
3040
3064
|
|
|
3041
|
-
urlParsingNode
|
|
3065
|
+
const urlParsingNode = new URL(
|
|
3066
|
+
/** @type {string} */ (url),
|
|
3067
|
+
window.location.href,
|
|
3068
|
+
);
|
|
3042
3069
|
|
|
3043
3070
|
const hostname = urlParsingNode.hostname.includes(":")
|
|
3044
3071
|
? `[${urlParsingNode.hostname}]`
|
|
@@ -3046,9 +3073,7 @@
|
|
|
3046
3073
|
|
|
3047
3074
|
return {
|
|
3048
3075
|
href: urlParsingNode.href,
|
|
3049
|
-
protocol: urlParsingNode.protocol
|
|
3050
|
-
? urlParsingNode.protocol.replace(/:$/, "")
|
|
3051
|
-
: "",
|
|
3076
|
+
protocol: urlParsingNode.protocol,
|
|
3052
3077
|
host: urlParsingNode.host,
|
|
3053
3078
|
search: urlParsingNode.search
|
|
3054
3079
|
? urlParsingNode.search.replace(/^\?/, "")
|
|
@@ -3086,7 +3111,7 @@
|
|
|
3086
3111
|
* @returns {boolean} Whether the URL is same-origin as the document base URL.
|
|
3087
3112
|
*/
|
|
3088
3113
|
function urlIsSameOriginAsBaseUrl(requestUrl) {
|
|
3089
|
-
return urlsAreSameOrigin(requestUrl,
|
|
3114
|
+
return urlsAreSameOrigin(requestUrl, document.baseURI);
|
|
3090
3115
|
}
|
|
3091
3116
|
|
|
3092
3117
|
/**
|
|
@@ -3138,27 +3163,6 @@
|
|
|
3138
3163
|
return url1.protocol === url2.protocol && url1.host === url2.host;
|
|
3139
3164
|
}
|
|
3140
3165
|
|
|
3141
|
-
/**
|
|
3142
|
-
* Returns the current document base URL.
|
|
3143
|
-
* @returns {string}
|
|
3144
|
-
*/
|
|
3145
|
-
function getBaseUrl() {
|
|
3146
|
-
if (document.baseURI) {
|
|
3147
|
-
return document.baseURI;
|
|
3148
|
-
}
|
|
3149
|
-
|
|
3150
|
-
// `document.baseURI` is available everywhere except IE
|
|
3151
|
-
if (!baseUrlParsingNode) {
|
|
3152
|
-
baseUrlParsingNode = document.createElement("a");
|
|
3153
|
-
baseUrlParsingNode.href = ".";
|
|
3154
|
-
|
|
3155
|
-
// Work-around for IE bug described in Implementation Notes. The fix in `urlResolve()` is not
|
|
3156
|
-
// suitable here because we need to track changes to the base URL.
|
|
3157
|
-
baseUrlParsingNode = baseUrlParsingNode.cloneNode(false);
|
|
3158
|
-
}
|
|
3159
|
-
return baseUrlParsingNode.href;
|
|
3160
|
-
}
|
|
3161
|
-
|
|
3162
3166
|
/**
|
|
3163
3167
|
* Removes a trailing hash ('#') from the given URL if it exists.
|
|
3164
3168
|
*
|
|
@@ -3480,7 +3484,6 @@
|
|
|
3480
3484
|
"Attempting to use an unsafe value in a safe context.",
|
|
3481
3485
|
),
|
|
3482
3486
|
);
|
|
3483
|
-
return;
|
|
3484
3487
|
};
|
|
3485
3488
|
|
|
3486
3489
|
if ($injector.has("$sanitize")) {
|
|
@@ -3715,7 +3718,6 @@
|
|
|
3715
3718
|
"Attempting to use an unsafe value in a safe context.",
|
|
3716
3719
|
),
|
|
3717
3720
|
);
|
|
3718
|
-
return;
|
|
3719
3721
|
}
|
|
3720
3722
|
|
|
3721
3723
|
return { trustAs, getTrusted, valueOf };
|
|
@@ -3914,7 +3916,7 @@
|
|
|
3914
3916
|
|
|
3915
3917
|
/**
|
|
3916
3918
|
* Shorthand method. `$sce.parseAsHtml(expression string)` →
|
|
3917
|
-
* {@link ng.$
|
|
3919
|
+
* {@link ng.$sceparseAs `$sce.parseAs($sce.HTML, value)`}
|
|
3918
3920
|
*
|
|
3919
3921
|
* @param {string} expression String expression to compile.
|
|
3920
3922
|
* @return {function(context, locals)} A function which represents the compiled expression:
|
|
@@ -3927,7 +3929,7 @@
|
|
|
3927
3929
|
|
|
3928
3930
|
/**
|
|
3929
3931
|
* Shorthand method. `$sce.parseAsCss(value)` →
|
|
3930
|
-
* {@link ng.$
|
|
3932
|
+
* {@link ng.$sceparseAs `$sce.parseAs($sce.CSS, value)`}
|
|
3931
3933
|
*
|
|
3932
3934
|
* @param {string} expression String expression to compile.
|
|
3933
3935
|
* @return {function(context, locals)} A function which represents the compiled expression:
|
|
@@ -3940,7 +3942,7 @@
|
|
|
3940
3942
|
|
|
3941
3943
|
/**
|
|
3942
3944
|
* Shorthand method. `$sce.parseAsUrl(value)` →
|
|
3943
|
-
* {@link ng.$
|
|
3945
|
+
* {@link ng.$sceparseAs `$sce.parseAs($sce.URL, value)`}
|
|
3944
3946
|
*
|
|
3945
3947
|
* @param {string} expression String expression to compile.
|
|
3946
3948
|
* @return {function(context, locals)} A function which represents the compiled expression:
|
|
@@ -3953,7 +3955,7 @@
|
|
|
3953
3955
|
|
|
3954
3956
|
/**
|
|
3955
3957
|
* Shorthand method. `$sce.parseAsResourceUrl(value)` →
|
|
3956
|
-
* {@link ng.$
|
|
3958
|
+
* {@link ng.$sceparseAs `$sce.parseAs($sce.RESOURCE_URL, value)`}
|
|
3957
3959
|
*
|
|
3958
3960
|
* @param {string} expression String expression to compile.
|
|
3959
3961
|
* @return {function(context, locals)} A function which represents the compiled expression:
|
|
@@ -3966,7 +3968,7 @@
|
|
|
3966
3968
|
|
|
3967
3969
|
/**
|
|
3968
3970
|
* Shorthand method. `$sce.parseAsJs(value)` →
|
|
3969
|
-
* {@link ng.$
|
|
3971
|
+
* {@link ng.$sceparseAs `$sce.parseAs($sce.JS, value)`}
|
|
3970
3972
|
*
|
|
3971
3973
|
* @param {string} expression String expression to compile.
|
|
3972
3974
|
* @return {function(context, locals)} A function which represents the compiled expression:
|
|
@@ -4523,7 +4525,7 @@
|
|
|
4523
4525
|
const DirectiveSuffix = "Directive";
|
|
4524
4526
|
|
|
4525
4527
|
class CompileProvider {
|
|
4526
|
-
static $inject = ["$provide", "$$sanitizeUriProvider"];
|
|
4528
|
+
/* @ignore */ static $inject = ["$provide", "$$sanitizeUriProvider"];
|
|
4527
4529
|
|
|
4528
4530
|
/**
|
|
4529
4531
|
* @param {import('../../interface.js').Provider} $provide
|
|
@@ -5598,8 +5600,7 @@
|
|
|
5598
5600
|
// Null out all of these references for garbage collection
|
|
5599
5601
|
compileNodes = transcludeFn = previousCompileContext = null;
|
|
5600
5602
|
}
|
|
5601
|
-
|
|
5602
|
-
return linked;
|
|
5603
|
+
return compiled.apply(this, arguments);
|
|
5603
5604
|
};
|
|
5604
5605
|
}
|
|
5605
5606
|
|
|
@@ -5943,14 +5944,13 @@
|
|
|
5943
5944
|
// * `undefined` - a slot that was not declared (i.e. invalid)
|
|
5944
5945
|
const slotTranscludeFn = boundTranscludeFn.$$slots[slotName];
|
|
5945
5946
|
if (slotTranscludeFn) {
|
|
5946
|
-
|
|
5947
|
+
return slotTranscludeFn(
|
|
5947
5948
|
scope,
|
|
5948
5949
|
cloneAttachFn,
|
|
5949
5950
|
transcludeControllers,
|
|
5950
5951
|
futureParentElement,
|
|
5951
5952
|
scopeToChild,
|
|
5952
5953
|
);
|
|
5953
|
-
return slotTranscludeRes;
|
|
5954
5954
|
}
|
|
5955
5955
|
|
|
5956
5956
|
if (isUndefined(slotTranscludeFn)) {
|
|
@@ -5963,14 +5963,13 @@
|
|
|
5963
5963
|
);
|
|
5964
5964
|
}
|
|
5965
5965
|
} else {
|
|
5966
|
-
|
|
5966
|
+
return boundTranscludeFn(
|
|
5967
5967
|
scope,
|
|
5968
5968
|
cloneAttachFn,
|
|
5969
5969
|
transcludeControllers,
|
|
5970
5970
|
futureParentElement,
|
|
5971
5971
|
scopeToChild,
|
|
5972
5972
|
);
|
|
5973
|
-
return boundTranscludeRes;
|
|
5974
5973
|
}
|
|
5975
5974
|
}
|
|
5976
5975
|
};
|
|
@@ -7734,7 +7733,13 @@
|
|
|
7734
7733
|
|
|
7735
7734
|
class FormController {
|
|
7736
7735
|
static $nonscope = true;
|
|
7737
|
-
static $inject = [
|
|
7736
|
+
/* @ignore */ static $inject = [
|
|
7737
|
+
"$element",
|
|
7738
|
+
"$attrs",
|
|
7739
|
+
"$scope",
|
|
7740
|
+
"$animate",
|
|
7741
|
+
"$interpolate",
|
|
7742
|
+
];
|
|
7738
7743
|
|
|
7739
7744
|
/**
|
|
7740
7745
|
* @param {Element} $element
|
|
@@ -8198,7 +8203,7 @@
|
|
|
8198
8203
|
return [
|
|
8199
8204
|
"$parse",
|
|
8200
8205
|
function ($parse) {
|
|
8201
|
-
|
|
8206
|
+
return {
|
|
8202
8207
|
name: "form",
|
|
8203
8208
|
restrict: isNgForm ? "EA" : "E",
|
|
8204
8209
|
require: ["form", "^^?form"], // first is the form's own ctrl, second is an optional parent form
|
|
@@ -8277,9 +8282,6 @@
|
|
|
8277
8282
|
};
|
|
8278
8283
|
},
|
|
8279
8284
|
};
|
|
8280
|
-
|
|
8281
|
-
return formDirective;
|
|
8282
|
-
|
|
8283
8285
|
function getSetter(expression) {
|
|
8284
8286
|
if (expression === "") {
|
|
8285
8287
|
// create an assignable expression, so forms with an empty name can be renamed later
|
|
@@ -8307,7 +8309,7 @@
|
|
|
8307
8309
|
|
|
8308
8310
|
class NgModelOptionsController {
|
|
8309
8311
|
static $nonscope = true;
|
|
8310
|
-
static $inject = ["$attrs", "$scope"];
|
|
8312
|
+
/* @ignore */ static $inject = ["$attrs", "$scope"];
|
|
8311
8313
|
|
|
8312
8314
|
/**
|
|
8313
8315
|
* @param {import('../../core/compile/attributes.js').Attributes} $attrs
|
|
@@ -8476,14 +8478,14 @@
|
|
|
8476
8478
|
|
|
8477
8479
|
class NgModelController {
|
|
8478
8480
|
static $nonscope = true;
|
|
8479
|
-
static $inject = [
|
|
8481
|
+
/* @ignore */ static $inject = [
|
|
8480
8482
|
"$scope",
|
|
8481
|
-
|
|
8483
|
+
$injectTokens.$exceptionHandler,
|
|
8482
8484
|
"$attrs",
|
|
8483
8485
|
"$element",
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8486
|
+
$injectTokens.$parse,
|
|
8487
|
+
$injectTokens.$animate,
|
|
8488
|
+
$injectTokens.$interpolate,
|
|
8487
8489
|
];
|
|
8488
8490
|
|
|
8489
8491
|
/**
|
|
@@ -9130,8 +9132,7 @@
|
|
|
9130
9132
|
}
|
|
9131
9133
|
|
|
9132
9134
|
$$parseAndValidate() {
|
|
9133
|
-
|
|
9134
|
-
let modelValue = viewValue;
|
|
9135
|
+
let modelValue = this.$$lastCommittedViewValue;
|
|
9135
9136
|
const that = this;
|
|
9136
9137
|
|
|
9137
9138
|
this.$$parserValid = isUndefined(modelValue) ? undefined : true;
|
|
@@ -10054,9 +10055,8 @@
|
|
|
10054
10055
|
}
|
|
10055
10056
|
|
|
10056
10057
|
function badInputChecker(scope, element, attr, ctrl, parserName) {
|
|
10057
|
-
const node = element;
|
|
10058
10058
|
const nativeValidation = (ctrl.$$hasNativeValidators = isObject(
|
|
10059
|
-
|
|
10059
|
+
element.validity,
|
|
10060
10060
|
));
|
|
10061
10061
|
|
|
10062
10062
|
if (nativeValidation) {
|
|
@@ -10603,12 +10603,11 @@
|
|
|
10603
10603
|
// TODO REMOVE IS SUPPORT
|
|
10604
10604
|
// Support: IE9 only
|
|
10605
10605
|
// In IE9 values are converted to string (e.g. `input.value = null` results in `input.value === 'null'`).
|
|
10606
|
-
|
|
10606
|
+
element["value"] = isDefined(value)
|
|
10607
10607
|
? isProxy(value)
|
|
10608
10608
|
? value.$target
|
|
10609
10609
|
: value
|
|
10610
10610
|
: null;
|
|
10611
|
-
element["value"] = propValue;
|
|
10612
10611
|
attr.$set("value", value);
|
|
10613
10612
|
}
|
|
10614
10613
|
|
|
@@ -10667,7 +10666,7 @@
|
|
|
10667
10666
|
/**
|
|
10668
10667
|
* @type {Array<string>}
|
|
10669
10668
|
*/
|
|
10670
|
-
static $inject = ["$element", "$scope"];
|
|
10669
|
+
/* @ignore */ static $inject = ["$element", "$scope"];
|
|
10671
10670
|
|
|
10672
10671
|
/**
|
|
10673
10672
|
* @param {HTMLSelectElement} $element
|
|
@@ -11275,6 +11274,7 @@
|
|
|
11275
11274
|
|
|
11276
11275
|
ngBindHtmlDirective.$inject = [$injectTokens.$parse];
|
|
11277
11276
|
/**
|
|
11277
|
+
* @param {import('../../core/parse/interface.ts').ParseService} $parse
|
|
11278
11278
|
* @returns {import('../../interface.ts').Directive}
|
|
11279
11279
|
*/
|
|
11280
11280
|
function ngBindHtmlDirective($parse) {
|
|
@@ -11977,7 +11977,7 @@
|
|
|
11977
11977
|
transclude: "element",
|
|
11978
11978
|
priority: 1000,
|
|
11979
11979
|
terminal: true,
|
|
11980
|
-
compile: ($element, $attr) => {
|
|
11980
|
+
compile: (_$element, $attr) => {
|
|
11981
11981
|
const expression = $attr["ngRepeat"];
|
|
11982
11982
|
const hasAnimate = !!$attr["animate"];
|
|
11983
11983
|
|
|
@@ -13157,7 +13157,7 @@
|
|
|
13157
13157
|
*
|
|
13158
13158
|
*/
|
|
13159
13159
|
const requiredDirective = [
|
|
13160
|
-
|
|
13160
|
+
$injectTokens.$parse,
|
|
13161
13161
|
/**
|
|
13162
13162
|
* @param {import("../../core/parse/interface.ts").ParseService} $parse
|
|
13163
13163
|
* @returns {import("../../interface.ts").Directive}
|
|
@@ -13239,75 +13239,72 @@
|
|
|
13239
13239
|
* </div>
|
|
13240
13240
|
*/
|
|
13241
13241
|
const patternDirective = [
|
|
13242
|
-
|
|
13242
|
+
$injectTokens.$parse,
|
|
13243
13243
|
/**
|
|
13244
13244
|
* @param {import("../../core/parse/interface.ts").ParseService} $parse
|
|
13245
13245
|
* @returns {import("../../interface.ts").Directive}
|
|
13246
13246
|
*/
|
|
13247
|
-
($parse) => {
|
|
13248
|
-
|
|
13249
|
-
|
|
13250
|
-
|
|
13251
|
-
|
|
13252
|
-
|
|
13253
|
-
let parseFn;
|
|
13247
|
+
($parse) => ({
|
|
13248
|
+
restrict: "A",
|
|
13249
|
+
require: "?ngModel",
|
|
13250
|
+
compile: (_Elm, tAttr) => {
|
|
13251
|
+
let patternExp;
|
|
13252
|
+
let parseFn;
|
|
13254
13253
|
|
|
13255
|
-
|
|
13256
|
-
|
|
13254
|
+
if (tAttr["ngPattern"]) {
|
|
13255
|
+
patternExp = tAttr["ngPattern"];
|
|
13257
13256
|
|
|
13258
|
-
|
|
13259
|
-
|
|
13260
|
-
|
|
13261
|
-
|
|
13262
|
-
|
|
13263
|
-
|
|
13264
|
-
|
|
13265
|
-
|
|
13266
|
-
|
|
13267
|
-
|
|
13268
|
-
|
|
13269
|
-
|
|
13270
|
-
}
|
|
13257
|
+
// ngPattern might be a scope expression, or an inlined regex, which is not parsable.
|
|
13258
|
+
// We get value of the attribute here, so we can compare the old and the new value
|
|
13259
|
+
// in the observer to avoid unnecessary validations
|
|
13260
|
+
if (
|
|
13261
|
+
tAttr["ngPattern"].charAt(0) === "/" &&
|
|
13262
|
+
REGEX_STRING_REGEXP.test(tAttr["ngPattern"])
|
|
13263
|
+
) {
|
|
13264
|
+
parseFn = function () {
|
|
13265
|
+
return tAttr["ngPattern"];
|
|
13266
|
+
};
|
|
13267
|
+
} else {
|
|
13268
|
+
parseFn = $parse(tAttr["ngPattern"]);
|
|
13271
13269
|
}
|
|
13270
|
+
}
|
|
13272
13271
|
|
|
13273
|
-
|
|
13274
|
-
|
|
13275
|
-
|
|
13276
|
-
let attrVal = attr["pattern"];
|
|
13272
|
+
return function (scope, elm, attr, ctrl) {
|
|
13273
|
+
if (!ctrl) return;
|
|
13274
|
+
let attrVal = attr["pattern"];
|
|
13277
13275
|
|
|
13278
|
-
|
|
13279
|
-
|
|
13280
|
-
|
|
13281
|
-
|
|
13282
|
-
|
|
13276
|
+
if (attr["ngPattern"]) {
|
|
13277
|
+
attrVal = parseFn(scope);
|
|
13278
|
+
} else {
|
|
13279
|
+
patternExp = attr["pattern"];
|
|
13280
|
+
}
|
|
13283
13281
|
|
|
13284
|
-
|
|
13285
|
-
|
|
13286
|
-
|
|
13282
|
+
let regexp = parsePatternAttr(attrVal, patternExp, elm);
|
|
13283
|
+
attr.$observe("pattern", (newVal) => {
|
|
13284
|
+
const oldRegexp = regexp;
|
|
13287
13285
|
|
|
13288
|
-
|
|
13286
|
+
regexp = parsePatternAttr(newVal, patternExp, elm);
|
|
13289
13287
|
|
|
13290
|
-
|
|
13291
|
-
|
|
13292
|
-
|
|
13293
|
-
|
|
13294
|
-
|
|
13295
|
-
|
|
13296
|
-
|
|
13288
|
+
if (
|
|
13289
|
+
(oldRegexp && oldRegexp.toString()) !==
|
|
13290
|
+
(regexp && regexp.toString())
|
|
13291
|
+
) {
|
|
13292
|
+
ctrl["$validate"]();
|
|
13293
|
+
}
|
|
13294
|
+
});
|
|
13297
13295
|
|
|
13298
|
-
|
|
13299
|
-
|
|
13300
|
-
|
|
13301
|
-
|
|
13302
|
-
|
|
13303
|
-
|
|
13304
|
-
|
|
13305
|
-
|
|
13306
|
-
};
|
|
13296
|
+
ctrl["$validators"]["pattern"] = (_modelValue, viewValue) => {
|
|
13297
|
+
// HTML5 pattern constraint validates the input value, so we validate the viewValue
|
|
13298
|
+
return (
|
|
13299
|
+
// @ts-ignore
|
|
13300
|
+
ctrl.$isEmpty(viewValue) ||
|
|
13301
|
+
isUndefined(regexp) ||
|
|
13302
|
+
regexp.test(viewValue)
|
|
13303
|
+
);
|
|
13307
13304
|
};
|
|
13308
|
-
}
|
|
13309
|
-
}
|
|
13310
|
-
},
|
|
13305
|
+
};
|
|
13306
|
+
},
|
|
13307
|
+
}),
|
|
13311
13308
|
];
|
|
13312
13309
|
|
|
13313
13310
|
/**
|
|
@@ -13341,7 +13338,7 @@
|
|
|
13341
13338
|
*
|
|
13342
13339
|
*/
|
|
13343
13340
|
const maxlengthDirective = [
|
|
13344
|
-
|
|
13341
|
+
$injectTokens.$parse,
|
|
13345
13342
|
/**
|
|
13346
13343
|
* @param {import("../../core/parse/interface.ts").ParseService} $parse
|
|
13347
13344
|
* @returns {import("../../interface.ts").Directive}
|
|
@@ -13413,32 +13410,28 @@
|
|
|
13413
13410
|
*
|
|
13414
13411
|
*/
|
|
13415
13412
|
const minlengthDirective = [
|
|
13416
|
-
|
|
13417
|
-
|
|
13418
|
-
|
|
13419
|
-
|
|
13420
|
-
|
|
13421
|
-
|
|
13422
|
-
if (!ctrl) return;
|
|
13413
|
+
$injectTokens.$parse,
|
|
13414
|
+
($parse) => ({
|
|
13415
|
+
restrict: "A",
|
|
13416
|
+
require: "?ngModel",
|
|
13417
|
+
link(scope, elm, attr, ctrl) {
|
|
13418
|
+
if (!ctrl) return;
|
|
13423
13419
|
|
|
13424
|
-
|
|
13425
|
-
|
|
13420
|
+
let minlength = attr.minlength || $parse(attr.ngMinlength)(scope);
|
|
13421
|
+
let minlengthParsed = parseLength(minlength) || -1;
|
|
13426
13422
|
|
|
13427
|
-
|
|
13428
|
-
|
|
13429
|
-
|
|
13430
|
-
|
|
13431
|
-
|
|
13432
|
-
|
|
13433
|
-
|
|
13434
|
-
|
|
13435
|
-
|
|
13436
|
-
|
|
13437
|
-
|
|
13438
|
-
|
|
13439
|
-
},
|
|
13440
|
-
};
|
|
13441
|
-
},
|
|
13423
|
+
attr.$observe("minlength", (value) => {
|
|
13424
|
+
if (minlength !== value) {
|
|
13425
|
+
minlengthParsed = parseLength(value) || -1;
|
|
13426
|
+
minlength = value;
|
|
13427
|
+
ctrl.$validate();
|
|
13428
|
+
}
|
|
13429
|
+
});
|
|
13430
|
+
ctrl.$validators.minlength = function (modelValue, viewValue) {
|
|
13431
|
+
return ctrl.$isEmpty(viewValue) || viewValue.length >= minlengthParsed;
|
|
13432
|
+
};
|
|
13433
|
+
},
|
|
13434
|
+
}),
|
|
13442
13435
|
];
|
|
13443
13436
|
|
|
13444
13437
|
function parsePatternAttr(regex, patternExp, elm) {
|
|
@@ -13449,7 +13442,12 @@
|
|
|
13449
13442
|
}
|
|
13450
13443
|
|
|
13451
13444
|
if (isString(regex)) {
|
|
13452
|
-
|
|
13445
|
+
const match = regex.match(/^\/(.*)\/([gimsuy]*)$/);
|
|
13446
|
+
if (match) {
|
|
13447
|
+
regex = new RegExp(match[1], match[2]);
|
|
13448
|
+
} else {
|
|
13449
|
+
regex = new RegExp(`^${regex}$`);
|
|
13450
|
+
}
|
|
13453
13451
|
}
|
|
13454
13452
|
|
|
13455
13453
|
if (!regex.test) {
|
|
@@ -13466,7 +13464,7 @@
|
|
|
13466
13464
|
}
|
|
13467
13465
|
|
|
13468
13466
|
function parseLength(val) {
|
|
13469
|
-
const intVal =
|
|
13467
|
+
const intVal = parseInt(val, 10);
|
|
13470
13468
|
return isNumberNaN(intVal) ? -1 : intVal;
|
|
13471
13469
|
}
|
|
13472
13470
|
|
|
@@ -13489,8 +13487,8 @@
|
|
|
13489
13487
|
}
|
|
13490
13488
|
|
|
13491
13489
|
$get = [
|
|
13492
|
-
|
|
13493
|
-
|
|
13490
|
+
$injectTokens.$location,
|
|
13491
|
+
$injectTokens.$rootScope,
|
|
13494
13492
|
/**
|
|
13495
13493
|
*
|
|
13496
13494
|
* @param {import('../services/location/location.js').Location} $location
|
|
@@ -13568,7 +13566,7 @@
|
|
|
13568
13566
|
? hash
|
|
13569
13567
|
: isNumber(hash)
|
|
13570
13568
|
? hash.toString()
|
|
13571
|
-
: $location.
|
|
13569
|
+
: $location.getHash();
|
|
13572
13570
|
let elm;
|
|
13573
13571
|
|
|
13574
13572
|
// empty hash, scroll to the top of the page
|
|
@@ -13585,7 +13583,7 @@
|
|
|
13585
13583
|
};
|
|
13586
13584
|
|
|
13587
13585
|
// does not scroll when user clicks on anchor link that is currently on
|
|
13588
|
-
// (no url change, no $location.
|
|
13586
|
+
// (no url change, no $location.getHash() change), browser native does scroll
|
|
13589
13587
|
if (this.autoScrollingEnabled) {
|
|
13590
13588
|
$rootScope["$location"] = $location;
|
|
13591
13589
|
$rootScope.$watch("$location.$$hash", (newVal, oldVal) => {
|
|
@@ -13958,8 +13956,7 @@
|
|
|
13958
13956
|
|
|
13959
13957
|
function applyInlineStyle(node, styleTuple) {
|
|
13960
13958
|
const prop = styleTuple[0];
|
|
13961
|
-
|
|
13962
|
-
node.style[prop] = value;
|
|
13959
|
+
node.style[prop] = styleTuple[1];
|
|
13963
13960
|
}
|
|
13964
13961
|
|
|
13965
13962
|
function concatWithSpace(a, b) {
|
|
@@ -15029,7 +15026,7 @@
|
|
|
15029
15026
|
if (Math.abs(Number(limit)) === Infinity) {
|
|
15030
15027
|
limit = Number(limit);
|
|
15031
15028
|
} else {
|
|
15032
|
-
limit =
|
|
15029
|
+
limit = parseInt(/** @type {string} */ (limit), 10);
|
|
15033
15030
|
}
|
|
15034
15031
|
if (isNumberNaN(limit)) return input;
|
|
15035
15032
|
|
|
@@ -15039,7 +15036,7 @@
|
|
|
15039
15036
|
begin =
|
|
15040
15037
|
!begin || isNaN(/** @type {any} */ (begin))
|
|
15041
15038
|
? 0
|
|
15042
|
-
:
|
|
15039
|
+
: parseInt(/** @type {string} */ (begin), 10);
|
|
15043
15040
|
begin =
|
|
15044
15041
|
begin < 0 ? Math.max(0, /** @type {[]} */ (input).length + begin) : begin;
|
|
15045
15042
|
|
|
@@ -15233,6 +15230,8 @@
|
|
|
15233
15230
|
}
|
|
15234
15231
|
}
|
|
15235
15232
|
|
|
15233
|
+
$IsStateFilter.$inject = [$injectTokens.$state];
|
|
15234
|
+
|
|
15236
15235
|
/**
|
|
15237
15236
|
* `isState` Filter: truthy if the current state is the parameter
|
|
15238
15237
|
*
|
|
@@ -15242,18 +15241,19 @@
|
|
|
15242
15241
|
* ```html
|
|
15243
15242
|
* <div ng-if="'stateName' | isState">show if state is 'stateName'</div>
|
|
15244
15243
|
* ```
|
|
15245
|
-
|
|
15246
|
-
|
|
15247
|
-
/**
|
|
15244
|
+
*
|
|
15245
|
+
* @param {import('./state/state-service.js').StateProvider} $state
|
|
15248
15246
|
* @returns {import('../interface.ts').FilterFn}
|
|
15249
15247
|
*/
|
|
15250
15248
|
function $IsStateFilter($state) {
|
|
15251
|
-
const isFilter =
|
|
15252
|
-
|
|
15253
|
-
};
|
|
15249
|
+
const isFilter = (state, params, options) =>
|
|
15250
|
+
$state.is(state, params, options);
|
|
15254
15251
|
isFilter.$stateful = true;
|
|
15255
15252
|
return isFilter;
|
|
15256
15253
|
}
|
|
15254
|
+
|
|
15255
|
+
$IncludedByStateFilter.$inject = [$injectTokens.$state];
|
|
15256
|
+
|
|
15257
15257
|
/**
|
|
15258
15258
|
* `includedByState` Filter: truthy if the current state includes the parameter
|
|
15259
15259
|
*
|
|
@@ -15263,9 +15263,8 @@
|
|
|
15263
15263
|
* ```html
|
|
15264
15264
|
* <div ng-if="'fullOrPartialStateName' | includedByState">show if state includes 'fullOrPartialStateName'</div>
|
|
15265
15265
|
* ```
|
|
15266
|
-
|
|
15267
|
-
|
|
15268
|
-
/**
|
|
15266
|
+
*
|
|
15267
|
+
* @param {import('./state/state-service.js').StateProvider} $state
|
|
15269
15268
|
* @returns {import('../interface.ts').FilterFn}
|
|
15270
15269
|
*/
|
|
15271
15270
|
function $IncludedByStateFilter($state) {
|
|
@@ -15279,7 +15278,7 @@
|
|
|
15279
15278
|
const SUFFIX = "Filter";
|
|
15280
15279
|
|
|
15281
15280
|
class FilterProvider {
|
|
15282
|
-
static $inject = [$injectTokens.$provide];
|
|
15281
|
+
/* @ignore */ static $inject = [$injectTokens.$provide];
|
|
15283
15282
|
|
|
15284
15283
|
/**
|
|
15285
15284
|
* @param {import('../../interface.ts').Provider} $provide
|
|
@@ -17182,173 +17181,177 @@
|
|
|
17182
17181
|
return ast.constant;
|
|
17183
17182
|
}
|
|
17184
17183
|
|
|
17185
|
-
|
|
17186
|
-
|
|
17184
|
+
class ParseProvider {
|
|
17185
|
+
constructor() {
|
|
17186
|
+
const cache = Object.create(null);
|
|
17187
17187
|
|
|
17188
|
-
|
|
17189
|
-
|
|
17188
|
+
/** @type {function(any):boolean?} */
|
|
17189
|
+
let identStart;
|
|
17190
17190
|
|
|
17191
|
-
|
|
17192
|
-
|
|
17191
|
+
/** @type {function(any):boolean?} */
|
|
17192
|
+
let identContinue;
|
|
17193
17193
|
|
|
17194
|
-
/**
|
|
17195
|
-
* Allows defining the set of characters that are allowed in AngularTS expressions. The function
|
|
17196
|
-
* `identifierStart` will get called to know if a given character is a valid character to be the
|
|
17197
|
-
* first character for an identifier. The function `identifierContinue` will get called to know if
|
|
17198
|
-
* a given character is a valid character to be a follow-up identifier character. The functions
|
|
17199
|
-
* `identifierStart` and `identifierContinue` will receive as arguments the single character to be
|
|
17200
|
-
* identifier and the character code point. These arguments will be `string` and `numeric`. Keep in
|
|
17201
|
-
* mind that the `string` parameter can be two characters long depending on the character
|
|
17202
|
-
* representation. It is expected for the function to return `true` or `false`, whether that
|
|
17203
|
-
* character is allowed or not.
|
|
17204
|
-
*
|
|
17205
|
-
* Since this function will be called extensively, keep the implementation of these functions fast,
|
|
17206
|
-
* as the performance of these functions have a direct impact on the expressions parsing speed.
|
|
17207
|
-
*
|
|
17208
|
-
* @param {function(any):boolean} [identifierStart] The function that will decide whether the given character is
|
|
17209
|
-
* a valid identifier start character.
|
|
17210
|
-
* @param {function(any):boolean} [identifierContinue] The function that will decide whether the given character is
|
|
17211
|
-
* a valid identifier continue character.
|
|
17212
|
-
* @returns {ParseProvider}
|
|
17213
|
-
*/
|
|
17214
|
-
this.setIdentifierFns = function (identifierStart, identifierContinue) {
|
|
17215
|
-
identStart = identifierStart;
|
|
17216
|
-
identContinue = identifierContinue;
|
|
17217
|
-
return this;
|
|
17218
|
-
};
|
|
17219
|
-
|
|
17220
|
-
this.$get = [
|
|
17221
|
-
"$filter",
|
|
17222
17194
|
/**
|
|
17195
|
+
* Allows defining the set of characters that are allowed in AngularTS expressions. The function
|
|
17196
|
+
* `identifierStart` will get called to know if a given character is a valid character to be the
|
|
17197
|
+
* first character for an identifier. The function `identifierContinue` will get called to know if
|
|
17198
|
+
* a given character is a valid character to be a follow-up identifier character. The functions
|
|
17199
|
+
* `identifierStart` and `identifierContinue` will receive as arguments the single character to be
|
|
17200
|
+
* identifier and the character code point. These arguments will be `string` and `numeric`. Keep in
|
|
17201
|
+
* mind that the `string` parameter can be two characters long depending on the character
|
|
17202
|
+
* representation. It is expected for the function to return `true` or `false`, whether that
|
|
17203
|
+
* character is allowed or not.
|
|
17204
|
+
*
|
|
17205
|
+
* Since this function will be called extensively, keep the implementation of these functions fast,
|
|
17206
|
+
* as the performance of these functions have a direct impact on the expressions parsing speed.
|
|
17223
17207
|
*
|
|
17224
|
-
* @param {(any)
|
|
17225
|
-
*
|
|
17208
|
+
* @param {function(any):boolean} [identifierStart] The function that will decide whether the given character is
|
|
17209
|
+
* a valid identifier start character.
|
|
17210
|
+
* @param {function(any):boolean} [identifierContinue] The function that will decide whether the given character is
|
|
17211
|
+
* a valid identifier continue character.
|
|
17212
|
+
* @returns {ParseProvider}
|
|
17226
17213
|
*/
|
|
17227
|
-
function (
|
|
17228
|
-
|
|
17229
|
-
|
|
17230
|
-
|
|
17231
|
-
|
|
17232
|
-
};
|
|
17233
|
-
return $parse;
|
|
17214
|
+
this.setIdentifierFns = function (identifierStart, identifierContinue) {
|
|
17215
|
+
identStart = identifierStart;
|
|
17216
|
+
identContinue = identifierContinue;
|
|
17217
|
+
return this;
|
|
17218
|
+
};
|
|
17234
17219
|
|
|
17220
|
+
this.$get = [
|
|
17221
|
+
"$filter",
|
|
17235
17222
|
/**
|
|
17236
|
-
*
|
|
17237
|
-
* @param
|
|
17238
|
-
* @returns
|
|
17223
|
+
*
|
|
17224
|
+
* @param {(any) => any} $filter
|
|
17225
|
+
* @returns {import('./interface').ParseService}
|
|
17239
17226
|
*/
|
|
17240
|
-
function $
|
|
17241
|
-
|
|
17227
|
+
function ($filter) {
|
|
17228
|
+
/** @type {import("./lexer/lexer.js").LexerOptions} */
|
|
17229
|
+
const $lexerOptions = {
|
|
17230
|
+
isIdentifierStart: isFunction(identStart) && identStart,
|
|
17231
|
+
isIdentifierContinue: isFunction(identContinue) && identContinue,
|
|
17232
|
+
};
|
|
17233
|
+
return $parse;
|
|
17242
17234
|
|
|
17243
|
-
|
|
17244
|
-
|
|
17245
|
-
|
|
17246
|
-
|
|
17235
|
+
/**
|
|
17236
|
+
* @param {string} exp
|
|
17237
|
+
* @param interceptorFn
|
|
17238
|
+
* @returns any
|
|
17239
|
+
*/
|
|
17240
|
+
function $parse(exp, interceptorFn) {
|
|
17241
|
+
let parsedExpression, cacheKey;
|
|
17247
17242
|
|
|
17248
|
-
|
|
17243
|
+
switch (typeof exp) {
|
|
17244
|
+
case "string":
|
|
17245
|
+
exp = exp.trim();
|
|
17246
|
+
cacheKey = exp;
|
|
17249
17247
|
|
|
17250
|
-
|
|
17251
|
-
const lexer = new Lexer($lexerOptions);
|
|
17252
|
-
const parser = new Parser(lexer, $filter);
|
|
17253
|
-
parsedExpression = parser.parse(exp);
|
|
17248
|
+
parsedExpression = cache[cacheKey];
|
|
17254
17249
|
|
|
17255
|
-
|
|
17256
|
-
|
|
17257
|
-
|
|
17250
|
+
if (!parsedExpression) {
|
|
17251
|
+
const lexer = new Lexer($lexerOptions);
|
|
17252
|
+
const parser = new Parser(lexer, $filter);
|
|
17253
|
+
parsedExpression = parser.parse(exp);
|
|
17258
17254
|
|
|
17259
|
-
|
|
17260
|
-
|
|
17255
|
+
cache[cacheKey] = addWatchDelegate(parsedExpression);
|
|
17256
|
+
}
|
|
17257
|
+
return addInterceptor(parsedExpression, interceptorFn);
|
|
17261
17258
|
|
|
17262
|
-
|
|
17263
|
-
|
|
17264
|
-
}
|
|
17265
|
-
}
|
|
17259
|
+
case "function":
|
|
17260
|
+
return addInterceptor(exp, interceptorFn);
|
|
17266
17261
|
|
|
17267
|
-
|
|
17268
|
-
|
|
17269
|
-
|
|
17270
|
-
* @returns {import('./interface').CompiledExpression|*}
|
|
17271
|
-
*/
|
|
17272
|
-
function addInterceptor(parsedExpression, interceptorFn) {
|
|
17273
|
-
if (!interceptorFn) return parsedExpression;
|
|
17274
|
-
|
|
17275
|
-
// Extract any existing interceptors out of the parsedExpression
|
|
17276
|
-
// to ensure the original parsedExpression is always the $$intercepted
|
|
17277
|
-
// @ts-ignore
|
|
17278
|
-
if (parsedExpression.$$interceptor) {
|
|
17279
|
-
interceptorFn = chainInterceptors(
|
|
17280
|
-
// @ts-ignore
|
|
17281
|
-
parsedExpression.$$interceptor,
|
|
17282
|
-
interceptorFn,
|
|
17283
|
-
);
|
|
17284
|
-
// @ts-ignore
|
|
17285
|
-
parsedExpression = parsedExpression.$$intercepted;
|
|
17262
|
+
default:
|
|
17263
|
+
return addInterceptor(() => {}, interceptorFn);
|
|
17264
|
+
}
|
|
17286
17265
|
}
|
|
17287
17266
|
|
|
17288
|
-
|
|
17267
|
+
/**
|
|
17268
|
+
* @param {Function} parsedExpression
|
|
17269
|
+
* @param interceptorFn
|
|
17270
|
+
* @returns {import('./interface').CompiledExpression|*}
|
|
17271
|
+
*/
|
|
17272
|
+
function addInterceptor(parsedExpression, interceptorFn) {
|
|
17273
|
+
if (!interceptorFn) {
|
|
17274
|
+
return parsedExpression;
|
|
17275
|
+
}
|
|
17289
17276
|
|
|
17290
|
-
|
|
17291
|
-
|
|
17292
|
-
|
|
17293
|
-
|
|
17294
|
-
|
|
17295
|
-
|
|
17296
|
-
|
|
17297
|
-
|
|
17298
|
-
|
|
17299
|
-
|
|
17300
|
-
|
|
17301
|
-
if (scope?.getter) {
|
|
17302
|
-
return;
|
|
17277
|
+
// Extract any existing interceptors out of the parsedExpression
|
|
17278
|
+
// to ensure the original parsedExpression is always the $$intercepted
|
|
17279
|
+
// @ts-ignore
|
|
17280
|
+
if (parsedExpression.$$interceptor) {
|
|
17281
|
+
interceptorFn = chainInterceptors(
|
|
17282
|
+
// @ts-ignore
|
|
17283
|
+
parsedExpression.$$interceptor,
|
|
17284
|
+
interceptorFn,
|
|
17285
|
+
);
|
|
17286
|
+
// @ts-ignore
|
|
17287
|
+
parsedExpression = parsedExpression.$$intercepted;
|
|
17303
17288
|
}
|
|
17304
|
-
const res = isFunction(value) ? value() : value;
|
|
17305
|
-
return interceptorFn(isProxy(res) ? res.$target : res);
|
|
17306
|
-
};
|
|
17307
17289
|
|
|
17308
|
-
|
|
17309
|
-
fn.$$intercepted = parsedExpression;
|
|
17310
|
-
fn.$$interceptor = interceptorFn;
|
|
17290
|
+
let useInputs = false;
|
|
17311
17291
|
|
|
17312
|
-
|
|
17313
|
-
|
|
17314
|
-
|
|
17315
|
-
|
|
17316
|
-
|
|
17317
|
-
|
|
17318
|
-
|
|
17319
|
-
|
|
17320
|
-
|
|
17292
|
+
const fn = function interceptedExpression(
|
|
17293
|
+
scope,
|
|
17294
|
+
locals,
|
|
17295
|
+
assign,
|
|
17296
|
+
inputs,
|
|
17297
|
+
) {
|
|
17298
|
+
const value =
|
|
17299
|
+
useInputs && inputs
|
|
17300
|
+
? inputs[0]
|
|
17301
|
+
: parsedExpression(scope, locals, assign, inputs);
|
|
17302
|
+
// Do not invoke for getters
|
|
17303
|
+
if (scope?.getter) {
|
|
17304
|
+
return;
|
|
17305
|
+
}
|
|
17306
|
+
const res = isFunction(value) ? value() : value;
|
|
17307
|
+
return interceptorFn(isProxy(res) ? res.$target : res);
|
|
17308
|
+
};
|
|
17321
17309
|
|
|
17322
|
-
|
|
17323
|
-
|
|
17324
|
-
|
|
17325
|
-
|
|
17310
|
+
// Maintain references to the interceptor/intercepted
|
|
17311
|
+
fn.$$intercepted = parsedExpression;
|
|
17312
|
+
fn.$$interceptor = interceptorFn;
|
|
17313
|
+
|
|
17314
|
+
// Propagate the literal/oneTime/constant attributes
|
|
17326
17315
|
// @ts-ignore
|
|
17327
|
-
|
|
17316
|
+
fn.literal = parsedExpression.literal;
|
|
17328
17317
|
// @ts-ignore
|
|
17329
|
-
fn.
|
|
17330
|
-
|
|
17331
|
-
|
|
17332
|
-
|
|
17333
|
-
|
|
17334
|
-
|
|
17335
|
-
|
|
17336
|
-
|
|
17337
|
-
|
|
17338
|
-
|
|
17339
|
-
|
|
17340
|
-
|
|
17341
|
-
|
|
17342
|
-
|
|
17343
|
-
|
|
17344
|
-
|
|
17318
|
+
fn.oneTime = parsedExpression.oneTime;
|
|
17319
|
+
// @ts-ignore
|
|
17320
|
+
fn.constant = parsedExpression.constant;
|
|
17321
|
+
// @ts-ignore
|
|
17322
|
+
fn.decoratedNode = parsedExpression.decoratedNode;
|
|
17323
|
+
|
|
17324
|
+
// Treat the interceptor like filters.
|
|
17325
|
+
// If it is not $stateful then only watch its inputs.
|
|
17326
|
+
// If the expression itself has no inputs then use the full expression as an input.
|
|
17327
|
+
if (!interceptorFn.$stateful) {
|
|
17328
|
+
// @ts-ignore
|
|
17329
|
+
useInputs = !parsedExpression.inputs;
|
|
17330
|
+
// @ts-ignore
|
|
17331
|
+
fn.inputs = parsedExpression.inputs
|
|
17332
|
+
? // @ts-ignore
|
|
17333
|
+
parsedExpression.inputs
|
|
17334
|
+
: [parsedExpression];
|
|
17335
|
+
|
|
17336
|
+
if (!interceptorFn.$$pure) {
|
|
17337
|
+
fn.inputs = fn.inputs.map(function (e) {
|
|
17338
|
+
// Remove the isPure flag of inputs when it is not absolute because they are now wrapped in a
|
|
17339
|
+
// non-pure interceptor function.
|
|
17340
|
+
if (e.isPure === PURITY_RELATIVE) {
|
|
17341
|
+
return function depurifier(s) {
|
|
17342
|
+
return e(s);
|
|
17343
|
+
};
|
|
17344
|
+
}
|
|
17345
|
+
return e;
|
|
17346
|
+
});
|
|
17347
|
+
}
|
|
17345
17348
|
}
|
|
17346
|
-
}
|
|
17347
17349
|
|
|
17348
|
-
|
|
17349
|
-
|
|
17350
|
-
|
|
17351
|
-
|
|
17350
|
+
return addWatchDelegate(fn);
|
|
17351
|
+
}
|
|
17352
|
+
},
|
|
17353
|
+
];
|
|
17354
|
+
}
|
|
17352
17355
|
}
|
|
17353
17356
|
|
|
17354
17357
|
function constantWatchDelegate(
|
|
@@ -17826,8 +17829,7 @@
|
|
|
17826
17829
|
let j = 0;
|
|
17827
17830
|
for (; j < ii; j++) {
|
|
17828
17831
|
let fn = parseFns[j];
|
|
17829
|
-
|
|
17830
|
-
vals[j] = res;
|
|
17832
|
+
vals[j] = fn(context);
|
|
17831
17833
|
}
|
|
17832
17834
|
cb(compute(vals));
|
|
17833
17835
|
});
|
|
@@ -17836,8 +17838,7 @@
|
|
|
17836
17838
|
values[i] = parseFns[i](context);
|
|
17837
17839
|
}
|
|
17838
17840
|
|
|
17839
|
-
|
|
17840
|
-
return res;
|
|
17841
|
+
return compute(values);
|
|
17841
17842
|
} catch (err) {
|
|
17842
17843
|
interr(text, err);
|
|
17843
17844
|
}
|
|
@@ -18229,6 +18230,7 @@
|
|
|
18229
18230
|
});
|
|
18230
18231
|
|
|
18231
18232
|
let useApplyAsync = false;
|
|
18233
|
+
|
|
18232
18234
|
/**
|
|
18233
18235
|
* Configure $http service to combine processing of multiple http responses received at around
|
|
18234
18236
|
* the same time via {@link ng.$rootScope.Scope#$applyAsync $rootScope.$applyAsync}. This can result in
|
|
@@ -18261,7 +18263,7 @@
|
|
|
18261
18263
|
*
|
|
18262
18264
|
* {@link ng.$http#interceptors Interceptors detailed info}
|
|
18263
18265
|
*/
|
|
18264
|
-
|
|
18266
|
+
this.interceptors = [];
|
|
18265
18267
|
|
|
18266
18268
|
/**
|
|
18267
18269
|
* Array containing URLs whose origins are trusted to receive the XSRF token. See the
|
|
@@ -18298,8 +18300,10 @@
|
|
|
18298
18300
|
* $http.get('https://stats.example.com/activity').then(...);
|
|
18299
18301
|
* }]);
|
|
18300
18302
|
* ```
|
|
18303
|
+
*
|
|
18304
|
+
* @type {string[]}
|
|
18301
18305
|
*/
|
|
18302
|
-
|
|
18306
|
+
this.xsrfTrustedOrigins = [];
|
|
18303
18307
|
|
|
18304
18308
|
/**
|
|
18305
18309
|
* This property is deprecated. Use {@link $httpProvider#xsrfTrustedOrigins xsrfTrustedOrigins}
|
|
@@ -18345,7 +18349,7 @@
|
|
|
18345
18349
|
*/
|
|
18346
18350
|
const reversedInterceptors = [];
|
|
18347
18351
|
|
|
18348
|
-
|
|
18352
|
+
this.interceptors.forEach((interceptorFactory) => {
|
|
18349
18353
|
reversedInterceptors.unshift(
|
|
18350
18354
|
isString(interceptorFactory)
|
|
18351
18355
|
? $injector.get(interceptorFactory)
|
|
@@ -18356,7 +18360,9 @@
|
|
|
18356
18360
|
/**
|
|
18357
18361
|
* A function to check request URLs against a list of allowed origins.
|
|
18358
18362
|
*/
|
|
18359
|
-
const urlIsAllowedOrigin = urlIsAllowedOriginFactory(
|
|
18363
|
+
const urlIsAllowedOrigin = urlIsAllowedOriginFactory(
|
|
18364
|
+
this.xsrfTrustedOrigins,
|
|
18365
|
+
);
|
|
18360
18366
|
|
|
18361
18367
|
/**
|
|
18362
18368
|
* @property {Array.<Object>} requestConfig Array of config objects for currently pending
|
|
@@ -18855,24 +18861,13 @@
|
|
|
18855
18861
|
}
|
|
18856
18862
|
|
|
18857
18863
|
/**
|
|
18858
|
-
* HTTP backend used by the
|
|
18859
|
-
* XMLHttpRequest object and deals with browser incompatibilities.
|
|
18860
|
-
*
|
|
18861
|
-
* You should never need to use this service directly, instead use the higher-level abstractions:
|
|
18862
|
-
* {@link ng.$http $http}.
|
|
18863
|
-
*
|
|
18864
|
-
*/
|
|
18865
|
-
/**
|
|
18866
|
-
* HTTP backend used by the {@link ng.$http service} that delegates to
|
|
18864
|
+
* HTTP backend used by the `$http` that delegates to
|
|
18867
18865
|
* XMLHttpRequest object and deals with browser incompatibilities.
|
|
18868
|
-
*
|
|
18869
|
-
* You should never need to use this service directly, instead use the higher-level abstractions:
|
|
18870
|
-
* {@link ng.$http $http}.
|
|
18871
|
-
*
|
|
18866
|
+
* You should never need to use this service directly.
|
|
18872
18867
|
*/
|
|
18873
18868
|
class HttpBackendProvider {
|
|
18874
18869
|
constructor() {
|
|
18875
|
-
this.$get =
|
|
18870
|
+
this.$get = () => createHttpBackend();
|
|
18876
18871
|
}
|
|
18877
18872
|
}
|
|
18878
18873
|
|
|
@@ -18880,7 +18875,21 @@
|
|
|
18880
18875
|
* @returns
|
|
18881
18876
|
*/
|
|
18882
18877
|
function createHttpBackend() {
|
|
18883
|
-
|
|
18878
|
+
/**
|
|
18879
|
+
* Makes an HTTP request using XMLHttpRequest with flexible options.
|
|
18880
|
+
*
|
|
18881
|
+
* @param {string} method - The HTTP method (e.g., "GET", "POST").
|
|
18882
|
+
* @param {string} [url] - The URL to send the request to. Defaults to the current page URL.
|
|
18883
|
+
* @param {*} [post] - The body to send with the request, if any.
|
|
18884
|
+
* @param {function(number, any, string|null, string, string): void} [callback] - Callback invoked when the request completes.
|
|
18885
|
+
* @param {Object<string, string|undefined>} [headers] - Headers to set on the request.
|
|
18886
|
+
* @param {number|Promise<any>} [timeout] - Timeout in ms or a cancellable promise.
|
|
18887
|
+
* @param {boolean} [withCredentials] - Whether to send credentials with the request.
|
|
18888
|
+
* @param {XMLHttpRequestResponseType} [responseType] - The type of data expected in the response.
|
|
18889
|
+
* @param {Object<string, EventListener>} [eventHandlers] - Event listeners for the XMLHttpRequest object.
|
|
18890
|
+
* @param {Object<string, EventListener>} [uploadEventHandlers] - Event listeners for the XMLHttpRequest.upload object.
|
|
18891
|
+
* @returns {void}
|
|
18892
|
+
*/
|
|
18884
18893
|
return function (
|
|
18885
18894
|
method,
|
|
18886
18895
|
url,
|
|
@@ -18897,34 +18906,31 @@
|
|
|
18897
18906
|
|
|
18898
18907
|
const xhr = new XMLHttpRequest();
|
|
18899
18908
|
let abortedByTimeout = false;
|
|
18909
|
+
let timeoutId;
|
|
18900
18910
|
|
|
18901
18911
|
xhr.open(method, url, true);
|
|
18912
|
+
|
|
18902
18913
|
if (headers) {
|
|
18903
|
-
|
|
18914
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
18904
18915
|
if (isDefined(value)) {
|
|
18905
18916
|
xhr.setRequestHeader(key, value);
|
|
18906
18917
|
}
|
|
18907
|
-
}
|
|
18918
|
+
}
|
|
18908
18919
|
}
|
|
18909
18920
|
|
|
18910
|
-
xhr.onload =
|
|
18921
|
+
xhr.onload = () => {
|
|
18922
|
+
let status = xhr.status || 0;
|
|
18911
18923
|
const statusText = xhr.statusText || "";
|
|
18912
18924
|
|
|
18913
|
-
let status = xhr.status;
|
|
18914
|
-
|
|
18915
|
-
// fix status code when it is 0 (0 status is undocumented).
|
|
18916
|
-
// Occurs when accessing file resources or on Android 4.1 stock browser
|
|
18917
|
-
// while retrieving files from application cache.
|
|
18918
18925
|
if (status === 0) {
|
|
18919
18926
|
status = xhr.response
|
|
18920
18927
|
? 200
|
|
18921
|
-
:
|
|
18928
|
+
: new URL(url).protocol === "file:"
|
|
18922
18929
|
? 404
|
|
18923
18930
|
: 0;
|
|
18924
18931
|
}
|
|
18925
18932
|
|
|
18926
18933
|
completeRequest(
|
|
18927
|
-
callback,
|
|
18928
18934
|
status,
|
|
18929
18935
|
xhr.response,
|
|
18930
18936
|
xhr.getAllResponseHeaders(),
|
|
@@ -18933,20 +18939,11 @@
|
|
|
18933
18939
|
);
|
|
18934
18940
|
};
|
|
18935
18941
|
|
|
18936
|
-
xhr.onerror =
|
|
18937
|
-
|
|
18938
|
-
// See https://xhr.spec.whatwg.org/#request-error-steps and https://fetch.spec.whatwg.org/#concept-network-error
|
|
18939
|
-
completeRequest(callback, -1, null, null, "", "error");
|
|
18940
|
-
};
|
|
18941
|
-
xhr.ontimeout = function () {
|
|
18942
|
-
// The response is always empty
|
|
18943
|
-
// See https://xhr.spec.whatwg.org/#request-error-steps and https://fetch.spec.whatwg.org/#concept-network-error
|
|
18944
|
-
completeRequest(callback, -1, null, null, "", "timeout");
|
|
18945
|
-
};
|
|
18942
|
+
xhr.onerror = () => completeRequest(-1, null, null, "", "error");
|
|
18943
|
+
xhr.ontimeout = () => completeRequest(-1, null, null, "", "timeout");
|
|
18946
18944
|
|
|
18947
|
-
xhr.onabort =
|
|
18945
|
+
xhr.onabort = () => {
|
|
18948
18946
|
completeRequest(
|
|
18949
|
-
callback,
|
|
18950
18947
|
-1,
|
|
18951
18948
|
null,
|
|
18952
18949
|
null,
|
|
@@ -18956,16 +18953,15 @@
|
|
|
18956
18953
|
};
|
|
18957
18954
|
|
|
18958
18955
|
if (eventHandlers) {
|
|
18959
|
-
eventHandlers
|
|
18960
|
-
|
|
18961
|
-
|
|
18962
|
-
});
|
|
18956
|
+
for (const [key, handler] of Object.entries(eventHandlers)) {
|
|
18957
|
+
xhr.addEventListener(key, handler);
|
|
18958
|
+
}
|
|
18963
18959
|
}
|
|
18964
18960
|
|
|
18965
18961
|
if (uploadEventHandlers) {
|
|
18966
|
-
|
|
18967
|
-
xhr.upload.addEventListener(key,
|
|
18968
|
-
}
|
|
18962
|
+
for (const [key, handler] of Object.entries(uploadEventHandlers)) {
|
|
18963
|
+
xhr.upload.addEventListener(key, handler);
|
|
18964
|
+
}
|
|
18969
18965
|
}
|
|
18970
18966
|
|
|
18971
18967
|
if (withCredentials) {
|
|
@@ -18976,317 +18972,205 @@
|
|
|
18976
18972
|
try {
|
|
18977
18973
|
xhr.responseType = responseType;
|
|
18978
18974
|
} catch (e) {
|
|
18979
|
-
|
|
18980
|
-
// https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are
|
|
18981
|
-
// known to throw when setting the value "json" as the response type. Other older
|
|
18982
|
-
// browsers implementing the responseType
|
|
18983
|
-
//
|
|
18984
|
-
// The json response type can be ignored if not supported, because JSON payloads are
|
|
18985
|
-
// parsed on the client-side regardless.
|
|
18986
|
-
if (responseType !== "json") {
|
|
18987
|
-
throw e;
|
|
18988
|
-
}
|
|
18975
|
+
if (responseType !== "json") throw e;
|
|
18989
18976
|
}
|
|
18990
18977
|
}
|
|
18991
18978
|
|
|
18992
18979
|
xhr.send(isUndefined(post) ? null : post);
|
|
18993
18980
|
|
|
18994
|
-
|
|
18995
|
-
|
|
18996
|
-
//
|
|
18997
|
-
// http.timeout = numerical timeout timeout
|
|
18998
|
-
// http.timeout = $timeout timeout
|
|
18999
|
-
// http.timeout = promise abort
|
|
19000
|
-
// xhr.abort() abort (The xhr object is normally inaccessible, but
|
|
19001
|
-
// can be exposed with the xhrFactory)
|
|
19002
|
-
/** @type {number} */
|
|
19003
|
-
let timeoutId;
|
|
19004
|
-
if (timeout > 0) {
|
|
19005
|
-
timeoutId = setTimeout(() => {
|
|
19006
|
-
timeoutRequest("timeout");
|
|
19007
|
-
}, timeout);
|
|
18981
|
+
if (typeof timeout === "number" && timeout > 0) {
|
|
18982
|
+
timeoutId = setTimeout(() => timeoutRequest("timeout"), timeout);
|
|
19008
18983
|
} else if (isPromiseLike(timeout)) {
|
|
19009
|
-
timeout.then(() => {
|
|
19010
|
-
timeoutRequest(isDefined(timeout
|
|
18984
|
+
/** @type {Promise} */ (timeout).then(() => {
|
|
18985
|
+
timeoutRequest(isDefined(timeout["$$timeoutId"]) ? "timeout" : "abort");
|
|
19011
18986
|
});
|
|
19012
18987
|
}
|
|
19013
18988
|
|
|
18989
|
+
/**
|
|
18990
|
+
* @param {"timeout"|"abort"} reason
|
|
18991
|
+
*/
|
|
19014
18992
|
function timeoutRequest(reason) {
|
|
19015
18993
|
abortedByTimeout = reason === "timeout";
|
|
19016
|
-
if (xhr)
|
|
19017
|
-
xhr.abort();
|
|
19018
|
-
}
|
|
18994
|
+
if (xhr) xhr.abort();
|
|
19019
18995
|
}
|
|
19020
18996
|
|
|
18997
|
+
/**
|
|
18998
|
+
* @param {number} status - HTTP status code or -1 for network errors.
|
|
18999
|
+
* @param {*} response - The parsed or raw response from the server.
|
|
19000
|
+
* @param {string|null} headersString - The raw response headers as a string.
|
|
19001
|
+
* @param {string} statusText - The status text returned by the server.
|
|
19002
|
+
* @param {"complete"|"error"|"timeout"|"abort"} xhrStatus - Final status of the request.
|
|
19003
|
+
*/
|
|
19021
19004
|
function completeRequest(
|
|
19022
|
-
callback,
|
|
19023
19005
|
status,
|
|
19024
19006
|
response,
|
|
19025
19007
|
headersString,
|
|
19026
19008
|
statusText,
|
|
19027
19009
|
xhrStatus,
|
|
19028
19010
|
) {
|
|
19029
|
-
// cancel timeout and subsequent timeout promise resolution
|
|
19030
19011
|
if (isDefined(timeoutId)) {
|
|
19031
19012
|
clearTimeout(timeoutId);
|
|
19032
19013
|
}
|
|
19033
|
-
|
|
19034
19014
|
callback(status, response, headersString, statusText, xhrStatus);
|
|
19035
19015
|
}
|
|
19036
19016
|
};
|
|
19037
19017
|
}
|
|
19038
19018
|
|
|
19019
|
+
const PATH_MATCH = /^([^?#]*)(\?([^#]*))?(#(.*))?$/;
|
|
19020
|
+
const $locationMinErr = minErr("$location");
|
|
19021
|
+
|
|
19022
|
+
let urlUpdatedByLocation = false;
|
|
19023
|
+
|
|
19039
19024
|
/**
|
|
19040
|
-
* @
|
|
19041
|
-
*
|
|
19042
|
-
* @
|
|
19043
|
-
* @property {number} ftp
|
|
19025
|
+
* @ignore
|
|
19026
|
+
* The pathname, beginning with "/"
|
|
19027
|
+
* @type {string}
|
|
19044
19028
|
*/
|
|
19029
|
+
let $$path;
|
|
19045
19030
|
|
|
19046
19031
|
/**
|
|
19047
|
-
*
|
|
19048
|
-
*
|
|
19049
|
-
* @typedef {Object} Html5Mode
|
|
19050
|
-
* @property {boolean} enabled - (default: false) If true, will rely on `history.pushState` to
|
|
19051
|
-
* change URLs where supported. Falls back to hash-prefixed paths in browsers that do not
|
|
19052
|
-
* support `pushState`.
|
|
19053
|
-
* @property {boolean} requireBase - (default: `true`) When html5Mode is enabled, specifies
|
|
19054
|
-
* whether or not a `<base>` tag is required to be present. If both `enabled` and `requireBase`
|
|
19055
|
-
* are true, and a `<base>` tag is not present, an error will be thrown when `$location` is injected.
|
|
19056
|
-
* See the {@link guide/$location $location guide} for more information.
|
|
19057
|
-
* @property {boolean|string} rewriteLinks - (default: `true`) When html5Mode is enabled, enables or
|
|
19058
|
-
* disables URL rewriting for relative links. If set to a string, URL rewriting will only apply to links
|
|
19059
|
-
* with an attribute that matches the given string. For example, if set to `'internal-link'`, URL rewriting
|
|
19060
|
-
* will only occur for `<a internal-link>` links. Note that [attribute name normalization](guide/directive#normalization)
|
|
19061
|
-
* does not apply here, so `'internalLink'` will **not** match `'internal-link'`.
|
|
19032
|
+
* @type {Object.<string,boolean|Array>}
|
|
19062
19033
|
*/
|
|
19063
|
-
|
|
19064
|
-
/** @type {DefaultPorts} */
|
|
19065
|
-
const DEFAULT_PORTS = { http: 80, https: 443, ftp: 21 };
|
|
19066
|
-
const PATH_MATCH = /^([^?#]*)(\?([^#]*))?(#(.*))?$/;
|
|
19067
|
-
const $locationMinErr = minErr("$location");
|
|
19034
|
+
let $$search;
|
|
19068
19035
|
|
|
19069
19036
|
/**
|
|
19070
|
-
* @
|
|
19037
|
+
* @ignore
|
|
19038
|
+
* The hash string, minus the hash symbol
|
|
19039
|
+
* @type {string}
|
|
19071
19040
|
*/
|
|
19041
|
+
let $$hash;
|
|
19042
|
+
|
|
19072
19043
|
class Location {
|
|
19073
19044
|
/**
|
|
19074
19045
|
* @param {string} appBase application base URL
|
|
19075
19046
|
* @param {string} appBaseNoFile application base URL stripped of any filename
|
|
19047
|
+
* @param {boolean} [html5] Defaults to true
|
|
19048
|
+
* @param {string} [prefix] URL path prefix for html5 mode or hash prefix for hashbang mode
|
|
19076
19049
|
*/
|
|
19077
|
-
constructor(appBase, appBaseNoFile) {
|
|
19078
|
-
const parsedUrl = urlResolve(appBase);
|
|
19079
|
-
|
|
19050
|
+
constructor(appBase, appBaseNoFile, html5 = true, prefix) {
|
|
19080
19051
|
/** @type {string} */
|
|
19081
19052
|
this.appBase = appBase;
|
|
19082
19053
|
|
|
19083
19054
|
/** @type {string} */
|
|
19084
19055
|
this.appBaseNoFile = appBaseNoFile;
|
|
19085
19056
|
|
|
19086
|
-
/**
|
|
19087
|
-
|
|
19088
|
-
* @type {string}
|
|
19089
|
-
*/
|
|
19090
|
-
this.$$absUrl = "";
|
|
19091
|
-
|
|
19092
|
-
/**
|
|
19093
|
-
* If html5 mode is enabled
|
|
19094
|
-
* @type {boolean}
|
|
19095
|
-
*/
|
|
19096
|
-
this.$$html5 = false;
|
|
19097
|
-
|
|
19098
|
-
/**
|
|
19099
|
-
* Has any change been replacing?
|
|
19100
|
-
* @type {boolean}
|
|
19101
|
-
*/
|
|
19102
|
-
this.$$replace = false;
|
|
19057
|
+
/** @type {boolean} */
|
|
19058
|
+
this.html5 = html5;
|
|
19103
19059
|
|
|
19104
|
-
/** @type {string} */
|
|
19105
|
-
this
|
|
19060
|
+
/** @type {string | undefined} */
|
|
19061
|
+
this.basePrefix = html5 ? prefix || "" : undefined;
|
|
19106
19062
|
|
|
19107
|
-
/** @type {string} */
|
|
19108
|
-
this
|
|
19063
|
+
/** @type {string | undefined} */
|
|
19064
|
+
this.hashPrefix = html5 ? undefined : prefix;
|
|
19109
19065
|
|
|
19110
19066
|
/**
|
|
19111
|
-
*
|
|
19112
|
-
*
|
|
19113
|
-
*/
|
|
19114
|
-
this.$$port =
|
|
19115
|
-
toInt(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null;
|
|
19116
|
-
|
|
19117
|
-
/**
|
|
19118
|
-
* The pathname, beginning with "/"
|
|
19067
|
+
* An absolute URL is the full URL, including protocol (http/https ), the optional subdomain (e.g. www ), domain (example.com), and path (which includes the directory and slug)
|
|
19068
|
+
* with all segments encoded according to rules specified in [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).
|
|
19119
19069
|
* @type {string}
|
|
19120
19070
|
*/
|
|
19121
|
-
this
|
|
19071
|
+
this.absUrl = "";
|
|
19122
19072
|
|
|
19123
19073
|
/**
|
|
19124
|
-
*
|
|
19074
|
+
* @ignore
|
|
19075
|
+
* Current url
|
|
19125
19076
|
* @type {string}
|
|
19126
19077
|
*/
|
|
19127
|
-
this.$$
|
|
19078
|
+
this.$$url = undefined;
|
|
19128
19079
|
|
|
19129
19080
|
/**
|
|
19130
|
-
*
|
|
19131
|
-
*
|
|
19081
|
+
* @ignore
|
|
19082
|
+
* Callback to update browser url
|
|
19083
|
+
* @type {Function}
|
|
19132
19084
|
*/
|
|
19133
|
-
this.$$
|
|
19134
|
-
}
|
|
19135
|
-
|
|
19136
|
-
/**
|
|
19137
|
-
* Return full URL representation with all segments encoded according to rules specified in
|
|
19138
|
-
* [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).
|
|
19139
|
-
*
|
|
19140
|
-
* @return {string} full URL
|
|
19141
|
-
*/
|
|
19142
|
-
absUrl() {
|
|
19143
|
-
return this.$$absUrl;
|
|
19085
|
+
this.$$updateBrowser = undefined;
|
|
19144
19086
|
}
|
|
19145
19087
|
|
|
19146
19088
|
/**
|
|
19147
|
-
* This method is getter / setter.
|
|
19148
|
-
*
|
|
19149
|
-
* Return URL (e.g. `/path?a=b#hash`) when called without any parameter.
|
|
19150
19089
|
* Change path, search and hash, when called with parameter and return `$location`.
|
|
19151
19090
|
*
|
|
19152
|
-
* @param {string
|
|
19153
|
-
* @return {Location
|
|
19091
|
+
* @param {string} url New URL without base prefix (e.g. `/path?a=b#hash`)
|
|
19092
|
+
* @return {Location} url
|
|
19154
19093
|
*/
|
|
19155
|
-
|
|
19156
|
-
|
|
19157
|
-
|
|
19094
|
+
setUrl(url) {
|
|
19095
|
+
const match = PATH_MATCH.exec(url);
|
|
19096
|
+
|
|
19097
|
+
if (match[1] !== undefined || url === "") {
|
|
19098
|
+
this.setPath(match[1] || "");
|
|
19158
19099
|
}
|
|
19159
19100
|
|
|
19160
|
-
|
|
19161
|
-
|
|
19162
|
-
|
|
19163
|
-
|
|
19101
|
+
if (match[2] !== undefined || match[1] !== undefined || url === "") {
|
|
19102
|
+
this.setSearch(match[3] || "");
|
|
19103
|
+
}
|
|
19104
|
+
|
|
19105
|
+
this.setHash(match[5] || "");
|
|
19164
19106
|
|
|
19165
19107
|
return this;
|
|
19166
19108
|
}
|
|
19167
19109
|
|
|
19168
19110
|
/**
|
|
19111
|
+
* Return URL (e.g. `/path?a=b#hash`) when called without any parameter.
|
|
19169
19112
|
*
|
|
19170
|
-
*
|
|
19171
|
-
* @return {string} protocol of current URL
|
|
19113
|
+
* @return {string} url
|
|
19172
19114
|
*/
|
|
19173
|
-
|
|
19174
|
-
return this.$$
|
|
19115
|
+
getUrl() {
|
|
19116
|
+
return this.$$url;
|
|
19175
19117
|
}
|
|
19176
19118
|
|
|
19177
19119
|
/**
|
|
19178
|
-
*
|
|
19179
|
-
*
|
|
19180
|
-
* Return host of current URL.
|
|
19120
|
+
* Change path parameter and return `$location`.
|
|
19181
19121
|
*
|
|
19182
|
-
*
|
|
19183
|
-
*
|
|
19184
|
-
*
|
|
19185
|
-
* @return {string} host of current URL.
|
|
19122
|
+
* @param {(string|number)} path New path
|
|
19123
|
+
* @return {Location}
|
|
19186
19124
|
*/
|
|
19187
|
-
|
|
19188
|
-
|
|
19189
|
-
|
|
19190
|
-
|
|
19191
|
-
|
|
19192
|
-
* This method is getter only.
|
|
19193
|
-
*
|
|
19194
|
-
* Return port of current URL.
|
|
19195
|
-
*
|
|
19196
|
-
*
|
|
19197
|
-
* ```js
|
|
19198
|
-
* // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
|
|
19199
|
-
* let port = $location.port();
|
|
19200
|
-
* // => 80
|
|
19201
|
-
* ```
|
|
19202
|
-
*
|
|
19203
|
-
* @return {number} port
|
|
19204
|
-
*/
|
|
19205
|
-
port() {
|
|
19206
|
-
return this.$$port;
|
|
19125
|
+
setPath(path) {
|
|
19126
|
+
let newPath = path !== null ? path.toString() : "";
|
|
19127
|
+
$$path = newPath.charAt(0) === "/" ? newPath : `/${newPath}`;
|
|
19128
|
+
this.$$compose();
|
|
19129
|
+
return this;
|
|
19207
19130
|
}
|
|
19208
19131
|
|
|
19209
19132
|
/**
|
|
19210
|
-
* This method is getter / setter.
|
|
19211
19133
|
*
|
|
19212
|
-
* Return path of current URL
|
|
19134
|
+
* Return path of current URL
|
|
19213
19135
|
*
|
|
19214
|
-
*
|
|
19215
|
-
*
|
|
19216
|
-
* Note: Path should always begin with forward slash (/), this method will add the forward slash
|
|
19217
|
-
* if it is missing.
|
|
19218
|
-
*
|
|
19219
|
-
*
|
|
19220
|
-
* ```js
|
|
19221
|
-
* // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
|
|
19222
|
-
* let path = $location.path();
|
|
19223
|
-
* // => "/some/path"
|
|
19224
|
-
* ```
|
|
19225
|
-
*
|
|
19226
|
-
* @param {(string|number)=} path New path
|
|
19227
|
-
* @return {(string|object)} path if called with no parameters, or `$location` if called with a parameter
|
|
19136
|
+
* @return {string}
|
|
19228
19137
|
*/
|
|
19229
|
-
|
|
19230
|
-
|
|
19231
|
-
return this.$$path;
|
|
19232
|
-
}
|
|
19233
|
-
let newPath = path !== null ? path.toString() : "";
|
|
19234
|
-
this.$$path = newPath.charAt(0) === "/" ? newPath : `/${newPath}`;
|
|
19235
|
-
this.$$compose();
|
|
19236
|
-
return this;
|
|
19138
|
+
getPath() {
|
|
19139
|
+
return $$path;
|
|
19237
19140
|
}
|
|
19238
19141
|
|
|
19239
19142
|
/**
|
|
19240
|
-
* This method is getter / setter.
|
|
19241
|
-
*
|
|
19242
|
-
* Returns the hash fragment when called without any parameters.
|
|
19243
|
-
*
|
|
19244
19143
|
* Changes the hash fragment when called with a parameter and returns `$location`.
|
|
19245
|
-
*
|
|
19246
|
-
*
|
|
19247
|
-
* ```js
|
|
19248
|
-
* // given URL http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue
|
|
19249
|
-
* let hash = $location.hash();
|
|
19250
|
-
* // => "hashValue"
|
|
19251
|
-
* ```
|
|
19252
|
-
*
|
|
19253
|
-
* @param {(string|number)=} hash New hash fragment
|
|
19254
|
-
* @return {string|Location} hash
|
|
19144
|
+
* @param {(string|number)} hash New hash fragment
|
|
19145
|
+
* @return {Location} hash
|
|
19255
19146
|
*/
|
|
19256
|
-
|
|
19257
|
-
|
|
19258
|
-
return this.$$hash;
|
|
19259
|
-
}
|
|
19260
|
-
|
|
19261
|
-
this.$$hash = hash !== null ? hash.toString() : "";
|
|
19147
|
+
setHash(hash) {
|
|
19148
|
+
$$hash = hash !== null ? hash.toString() : "";
|
|
19262
19149
|
this.$$compose();
|
|
19263
19150
|
return this;
|
|
19264
19151
|
}
|
|
19265
19152
|
|
|
19266
19153
|
/**
|
|
19267
|
-
*
|
|
19268
|
-
*
|
|
19154
|
+
* Returns the hash fragment when called without any parameters.
|
|
19155
|
+
* @return {string} hash
|
|
19269
19156
|
*/
|
|
19270
|
-
|
|
19271
|
-
|
|
19272
|
-
return this;
|
|
19157
|
+
getHash() {
|
|
19158
|
+
return $$hash;
|
|
19273
19159
|
}
|
|
19274
19160
|
|
|
19275
19161
|
/**
|
|
19276
|
-
*
|
|
19162
|
+
* Sets the search part (as object) of current URL
|
|
19277
19163
|
*
|
|
19278
|
-
* @param {string|Object
|
|
19164
|
+
* @param {string|Object} search New search params - string or hash object.
|
|
19279
19165
|
* @param {(string|number|Array<string>|boolean)=} paramValue If search is a string or number, then paramValue will override only a single search property.
|
|
19280
|
-
* @returns {Object
|
|
19166
|
+
* @returns {Object} Search object or Location object
|
|
19281
19167
|
*/
|
|
19282
|
-
|
|
19168
|
+
setSearch(search, paramValue) {
|
|
19283
19169
|
switch (arguments.length) {
|
|
19284
|
-
case 0:
|
|
19285
|
-
return this.$$search;
|
|
19286
19170
|
case 1:
|
|
19287
19171
|
if (isString(search) || isNumber(search)) {
|
|
19288
19172
|
search = search.toString();
|
|
19289
|
-
|
|
19173
|
+
$$search = parseKeyValue(search);
|
|
19290
19174
|
} else if (isObject(search)) {
|
|
19291
19175
|
search = structuredClone(search, {});
|
|
19292
19176
|
// remove object undefined or null properties
|
|
@@ -19294,7 +19178,7 @@
|
|
|
19294
19178
|
if (value == null) delete search[key];
|
|
19295
19179
|
});
|
|
19296
19180
|
|
|
19297
|
-
|
|
19181
|
+
$$search = search;
|
|
19298
19182
|
} else {
|
|
19299
19183
|
throw $locationMinErr(
|
|
19300
19184
|
"isrcharg",
|
|
@@ -19304,9 +19188,10 @@
|
|
|
19304
19188
|
break;
|
|
19305
19189
|
default:
|
|
19306
19190
|
if (isUndefined(paramValue) || paramValue === null) {
|
|
19307
|
-
delete
|
|
19191
|
+
delete $$search[search];
|
|
19308
19192
|
} else {
|
|
19309
|
-
|
|
19193
|
+
// @ts-ignore
|
|
19194
|
+
$$search[search] = paramValue;
|
|
19310
19195
|
}
|
|
19311
19196
|
}
|
|
19312
19197
|
|
|
@@ -19315,28 +19200,28 @@
|
|
|
19315
19200
|
}
|
|
19316
19201
|
|
|
19317
19202
|
/**
|
|
19318
|
-
*
|
|
19319
|
-
*
|
|
19203
|
+
* Returns the search part (as object) of current URL
|
|
19204
|
+
*
|
|
19205
|
+
* @returns {Object} Search object or Location object
|
|
19320
19206
|
*/
|
|
19321
|
-
|
|
19322
|
-
|
|
19323
|
-
this.$$absUrl = this.$$normalizeUrl(this.$$url);
|
|
19324
|
-
this.$$urlUpdatedByLocation = true;
|
|
19207
|
+
getSearch() {
|
|
19208
|
+
return $$search;
|
|
19325
19209
|
}
|
|
19326
19210
|
|
|
19327
19211
|
/**
|
|
19328
|
-
* @
|
|
19329
|
-
*
|
|
19212
|
+
* @private
|
|
19213
|
+
* Compose url and update `url` and `absUrl` property
|
|
19330
19214
|
*/
|
|
19331
|
-
$$
|
|
19332
|
-
|
|
19215
|
+
$$compose() {
|
|
19216
|
+
this.$$url = normalizePath($$path, $$search, $$hash);
|
|
19217
|
+
this.absUrl = this.html5
|
|
19218
|
+
? this.appBaseNoFile + this.$$url.substring(1)
|
|
19219
|
+
: this.appBase + (this.$$url ? this.hashPrefix + this.$$url : "");
|
|
19220
|
+
urlUpdatedByLocation = true;
|
|
19221
|
+
setTimeout(() => this.$$updateBrowser && this.$$updateBrowser());
|
|
19333
19222
|
}
|
|
19334
19223
|
|
|
19335
19224
|
/**
|
|
19336
|
-
* This method is getter / setter.
|
|
19337
|
-
*
|
|
19338
|
-
* Return the history state object when called without any parameter.
|
|
19339
|
-
*
|
|
19340
19225
|
* Change the history state object when called with one parameter and return `$location`.
|
|
19341
19226
|
* The state object is later passed to `pushState` or `replaceState`.
|
|
19342
19227
|
* See {@link https://developer.mozilla.org/en-US/docs/Web/API/History/pushState#state|History.state}
|
|
@@ -19344,85 +19229,30 @@
|
|
|
19344
19229
|
* NOTE: This method is supported only in HTML5 mode and only in browsers supporting
|
|
19345
19230
|
* the HTML5 History API (i.e. methods `pushState` and `replaceState`). If you need to support
|
|
19346
19231
|
* older browsers (like IE9 or Android < 4.0), don't use this method.
|
|
19347
|
-
*
|
|
19348
|
-
* @
|
|
19349
|
-
* @return {any} state
|
|
19232
|
+
* @param {any} state
|
|
19233
|
+
* @returns {Location}
|
|
19350
19234
|
*/
|
|
19351
|
-
|
|
19352
|
-
if (!
|
|
19353
|
-
return this.$$state;
|
|
19354
|
-
}
|
|
19355
|
-
|
|
19356
|
-
if (!(this instanceof LocationHtml5Url) || !this.$$html5) {
|
|
19235
|
+
setState(state) {
|
|
19236
|
+
if (!this.html5) {
|
|
19357
19237
|
throw $locationMinErr(
|
|
19358
19238
|
"nostate",
|
|
19359
|
-
"History API state support is available only "
|
|
19360
|
-
"in HTML5 mode and only in browsers supporting HTML5 History API",
|
|
19239
|
+
"History API state support is available only in HTML5 mode",
|
|
19361
19240
|
);
|
|
19362
19241
|
}
|
|
19363
|
-
// The user might modify `stateObject` after invoking `$location.
|
|
19242
|
+
// The user might modify `stateObject` after invoking `$location.setState(stateObject)`
|
|
19364
19243
|
// but we're changing the $$state reference to $browser.state() during the $digest
|
|
19365
19244
|
// so the modification window is narrow.
|
|
19366
19245
|
this.$$state = isUndefined(state) ? null : state;
|
|
19367
|
-
|
|
19246
|
+
urlUpdatedByLocation = true;
|
|
19368
19247
|
return this;
|
|
19369
19248
|
}
|
|
19370
19249
|
|
|
19371
19250
|
/**
|
|
19372
|
-
*
|
|
19373
|
-
* @
|
|
19374
|
-
* @returns {boolean}
|
|
19375
|
-
*/
|
|
19376
|
-
$$parseLinkUrl(_url, _url2) {
|
|
19377
|
-
throw new Error(`Method not implemented ${_url} ${_url2}`);
|
|
19378
|
-
}
|
|
19379
|
-
|
|
19380
|
-
$$parse(_url) {
|
|
19381
|
-
throw new Error(`Method not implemented ${_url}`);
|
|
19382
|
-
}
|
|
19383
|
-
}
|
|
19384
|
-
|
|
19385
|
-
/**
|
|
19386
|
-
* This object is exposed as $location service when HTML5 mode is enabled and supported
|
|
19387
|
-
*/
|
|
19388
|
-
class LocationHtml5Url extends Location {
|
|
19389
|
-
/**
|
|
19390
|
-
* @param {string} appBase application base URL
|
|
19391
|
-
* @param {string} appBaseNoFile application base URL stripped of any filename
|
|
19392
|
-
* @param {string} basePrefix URL path prefix
|
|
19393
|
-
*/
|
|
19394
|
-
constructor(appBase, appBaseNoFile, basePrefix) {
|
|
19395
|
-
super(appBase, appBaseNoFile);
|
|
19396
|
-
this.$$html5 = true;
|
|
19397
|
-
this.basePrefix = basePrefix || "";
|
|
19398
|
-
}
|
|
19399
|
-
|
|
19400
|
-
/**
|
|
19401
|
-
* Parse given HTML5 (regular) URL string into properties
|
|
19402
|
-
* @param {string} url HTML5 URL
|
|
19251
|
+
* Return the history state object
|
|
19252
|
+
* @returns {any}
|
|
19403
19253
|
*/
|
|
19404
|
-
|
|
19405
|
-
|
|
19406
|
-
if (!isString(pathUrl)) {
|
|
19407
|
-
throw $locationMinErr(
|
|
19408
|
-
"ipthprfx",
|
|
19409
|
-
'Invalid url "{0}", missing path prefix "{1}".',
|
|
19410
|
-
url,
|
|
19411
|
-
this.appBaseNoFile,
|
|
19412
|
-
);
|
|
19413
|
-
}
|
|
19414
|
-
|
|
19415
|
-
parseAppUrl(pathUrl, this, true);
|
|
19416
|
-
|
|
19417
|
-
if (!this.$$path) {
|
|
19418
|
-
this.$$path = "/";
|
|
19419
|
-
}
|
|
19420
|
-
|
|
19421
|
-
this.$$compose();
|
|
19422
|
-
}
|
|
19423
|
-
|
|
19424
|
-
$$normalizeUrl(url) {
|
|
19425
|
-
return this.appBaseNoFile + url.substring(1); // first char is always '/'
|
|
19254
|
+
getState() {
|
|
19255
|
+
return this.$$state;
|
|
19426
19256
|
}
|
|
19427
19257
|
|
|
19428
19258
|
/**
|
|
@@ -19430,148 +19260,138 @@
|
|
|
19430
19260
|
* @param {string} relHref
|
|
19431
19261
|
* @returns {boolean}
|
|
19432
19262
|
*/
|
|
19433
|
-
|
|
19434
|
-
if (
|
|
19435
|
-
|
|
19436
|
-
|
|
19437
|
-
|
|
19438
|
-
|
|
19439
|
-
|
|
19440
|
-
|
|
19441
|
-
|
|
19442
|
-
|
|
19263
|
+
parseLinkUrl(url, relHref) {
|
|
19264
|
+
if (this.html5) {
|
|
19265
|
+
if (relHref && relHref[0] === "#") {
|
|
19266
|
+
// special case for links to hash fragments:
|
|
19267
|
+
// keep the old url and only replace the hash fragment
|
|
19268
|
+
this.setHash(relHref.slice(1));
|
|
19269
|
+
return true;
|
|
19270
|
+
}
|
|
19271
|
+
let appUrl;
|
|
19272
|
+
let prevAppUrl;
|
|
19273
|
+
let rewrittenUrl;
|
|
19443
19274
|
|
|
19444
|
-
|
|
19445
|
-
|
|
19446
|
-
|
|
19447
|
-
|
|
19448
|
-
|
|
19449
|
-
|
|
19450
|
-
|
|
19451
|
-
|
|
19452
|
-
|
|
19453
|
-
|
|
19275
|
+
if (isDefined((appUrl = stripBaseUrl(this.appBase, url)))) {
|
|
19276
|
+
prevAppUrl = appUrl;
|
|
19277
|
+
if (
|
|
19278
|
+
this.basePrefix &&
|
|
19279
|
+
isDefined((appUrl = stripBaseUrl(this.basePrefix, appUrl)))
|
|
19280
|
+
) {
|
|
19281
|
+
rewrittenUrl =
|
|
19282
|
+
this.appBaseNoFile + (stripBaseUrl("/", appUrl) || appUrl);
|
|
19283
|
+
} else {
|
|
19284
|
+
rewrittenUrl = this.appBase + prevAppUrl;
|
|
19285
|
+
}
|
|
19286
|
+
} else if (isDefined((appUrl = stripBaseUrl(this.appBaseNoFile, url)))) {
|
|
19287
|
+
rewrittenUrl = this.appBaseNoFile + appUrl;
|
|
19288
|
+
} else if (this.appBaseNoFile === `${url}/`) {
|
|
19289
|
+
rewrittenUrl = this.appBaseNoFile;
|
|
19454
19290
|
}
|
|
19455
|
-
|
|
19456
|
-
|
|
19457
|
-
|
|
19458
|
-
rewrittenUrl
|
|
19459
|
-
}
|
|
19460
|
-
|
|
19461
|
-
|
|
19291
|
+
if (rewrittenUrl) {
|
|
19292
|
+
this.parse(rewrittenUrl);
|
|
19293
|
+
}
|
|
19294
|
+
return !!rewrittenUrl;
|
|
19295
|
+
} else {
|
|
19296
|
+
if (stripHash(this.appBase) === stripHash(url)) {
|
|
19297
|
+
this.parse(url);
|
|
19298
|
+
return true;
|
|
19299
|
+
}
|
|
19300
|
+
return false;
|
|
19462
19301
|
}
|
|
19463
|
-
return !!rewrittenUrl;
|
|
19464
19302
|
}
|
|
19465
|
-
}
|
|
19466
19303
|
|
|
19467
|
-
/**
|
|
19468
|
-
* LocationHashbangUrl represents URL
|
|
19469
|
-
* This object is exposed as $location service when developer doesn't opt into html5 mode.
|
|
19470
|
-
* It also serves as the base class for html5 mode fallback on legacy browsers.
|
|
19471
|
-
*
|
|
19472
|
-
*/
|
|
19473
|
-
class LocationHashbangUrl extends Location {
|
|
19474
19304
|
/**
|
|
19475
|
-
*
|
|
19476
|
-
* @param {string}
|
|
19477
|
-
* @param {string} hashPrefix hashbang prefix
|
|
19305
|
+
* Parse given HTML5 (regular) URL string into properties
|
|
19306
|
+
* @param {string} url HTML5 URL
|
|
19478
19307
|
*/
|
|
19479
|
-
|
|
19480
|
-
|
|
19481
|
-
|
|
19482
|
-
|
|
19308
|
+
parse(url) {
|
|
19309
|
+
if (this.html5) {
|
|
19310
|
+
const pathUrl = stripBaseUrl(this.appBaseNoFile, url);
|
|
19311
|
+
if (!isString(pathUrl)) {
|
|
19312
|
+
throw $locationMinErr(
|
|
19313
|
+
"ipthprfx",
|
|
19314
|
+
'Invalid url "{0}", missing path prefix "{1}".',
|
|
19315
|
+
url,
|
|
19316
|
+
this.appBaseNoFile,
|
|
19317
|
+
);
|
|
19318
|
+
}
|
|
19483
19319
|
|
|
19484
|
-
|
|
19485
|
-
* Parse given hashbang URL into properties
|
|
19486
|
-
* @param {string} url Hashbang URL
|
|
19487
|
-
*/
|
|
19488
|
-
$$parse(url) {
|
|
19489
|
-
const withoutBaseUrl =
|
|
19490
|
-
stripBaseUrl(this.appBase, url) || stripBaseUrl(this.appBaseNoFile, url);
|
|
19491
|
-
let withoutHashUrl;
|
|
19320
|
+
parseAppUrl(pathUrl, true);
|
|
19492
19321
|
|
|
19493
|
-
|
|
19494
|
-
|
|
19495
|
-
// got either a hashbang path or a plain hash fragment
|
|
19496
|
-
withoutHashUrl = stripBaseUrl(this.hashPrefix, withoutBaseUrl);
|
|
19497
|
-
if (isUndefined(withoutHashUrl)) {
|
|
19498
|
-
// There was no hashbang prefix so we just have a hash fragment
|
|
19499
|
-
withoutHashUrl = withoutBaseUrl;
|
|
19322
|
+
if (!$$path) {
|
|
19323
|
+
$$path = "/";
|
|
19500
19324
|
}
|
|
19325
|
+
|
|
19326
|
+
this.$$compose();
|
|
19501
19327
|
} else {
|
|
19502
|
-
|
|
19503
|
-
|
|
19504
|
-
|
|
19505
|
-
|
|
19506
|
-
|
|
19328
|
+
const withoutBaseUrl =
|
|
19329
|
+
stripBaseUrl(this.appBase, url) ||
|
|
19330
|
+
stripBaseUrl(this.appBaseNoFile, url);
|
|
19331
|
+
let withoutHashUrl;
|
|
19332
|
+
|
|
19333
|
+
if (!isUndefined(withoutBaseUrl) && withoutBaseUrl.charAt(0) === "#") {
|
|
19334
|
+
// The rest of the URL starts with a hash so we have
|
|
19335
|
+
// got either a hashbang path or a plain hash fragment
|
|
19336
|
+
withoutHashUrl = stripBaseUrl(this.hashPrefix, withoutBaseUrl);
|
|
19337
|
+
if (isUndefined(withoutHashUrl)) {
|
|
19338
|
+
// There was no hashbang prefix so we just have a hash fragment
|
|
19339
|
+
withoutHashUrl = withoutBaseUrl;
|
|
19340
|
+
}
|
|
19507
19341
|
} else {
|
|
19508
|
-
|
|
19509
|
-
|
|
19510
|
-
|
|
19511
|
-
|
|
19342
|
+
// There was no hashbang path nor hash fragment:
|
|
19343
|
+
// If we are in HTML5 mode we use what is left as the path;
|
|
19344
|
+
// Otherwise we ignore what is left
|
|
19345
|
+
if (this.html5) {
|
|
19346
|
+
withoutHashUrl = withoutBaseUrl;
|
|
19347
|
+
} else {
|
|
19348
|
+
withoutHashUrl = "";
|
|
19349
|
+
if (isUndefined(withoutBaseUrl)) {
|
|
19350
|
+
this.appBase = url;
|
|
19351
|
+
}
|
|
19512
19352
|
}
|
|
19513
19353
|
}
|
|
19514
|
-
}
|
|
19515
19354
|
|
|
19516
|
-
|
|
19355
|
+
parseAppUrl(withoutHashUrl, false);
|
|
19517
19356
|
|
|
19518
|
-
|
|
19519
|
-
this.$$path,
|
|
19520
|
-
withoutHashUrl,
|
|
19521
|
-
this.appBase,
|
|
19522
|
-
);
|
|
19357
|
+
$$path = removeWindowsDriveName($$path, withoutHashUrl, this.appBase);
|
|
19523
19358
|
|
|
19524
|
-
|
|
19359
|
+
this.$$compose();
|
|
19525
19360
|
|
|
19526
|
-
/*
|
|
19527
|
-
* In Windows, on an anchor node on documents loaded from
|
|
19528
|
-
* the filesystem, the browser will return a pathname
|
|
19529
|
-
* prefixed with the drive name ('/C:/path') when a
|
|
19530
|
-
* pathname without a drive is set:
|
|
19531
|
-
* * a.setAttribute('href', '/foo')
|
|
19532
|
-
* * a.pathname === '/C:/foo' //true
|
|
19533
|
-
*
|
|
19534
|
-
* Inside of AngularTS, we're always using pathnames that
|
|
19535
|
-
* do not include drive names for routing.
|
|
19536
|
-
*/
|
|
19537
|
-
function removeWindowsDriveName(path, url, base) {
|
|
19538
19361
|
/*
|
|
19539
|
-
|
|
19540
|
-
|
|
19541
|
-
|
|
19542
|
-
|
|
19543
|
-
|
|
19544
|
-
|
|
19545
|
-
|
|
19546
|
-
|
|
19547
|
-
|
|
19548
|
-
|
|
19549
|
-
|
|
19362
|
+
* In Windows, on an anchor node on documents loaded from
|
|
19363
|
+
* the filesystem, the browser will return a pathname
|
|
19364
|
+
* prefixed with the drive name ('/C:/path') when a
|
|
19365
|
+
* pathname without a drive is set:
|
|
19366
|
+
* * a.setAttribute('href', '/foo')
|
|
19367
|
+
* * a.pathname === '/C:/foo' //true
|
|
19368
|
+
*
|
|
19369
|
+
* Inside of AngularTS, we're always using pathnames that
|
|
19370
|
+
* do not include drive names for routing.
|
|
19371
|
+
*/
|
|
19372
|
+
function removeWindowsDriveName(path, url, base) {
|
|
19373
|
+
/*
|
|
19374
|
+
Matches paths for file protocol on windows,
|
|
19375
|
+
such as /C:/foo/bar, and captures only /foo/bar.
|
|
19376
|
+
*/
|
|
19377
|
+
const windowsFilePathExp = /^\/[A-Z]:(\/.*)/;
|
|
19550
19378
|
|
|
19551
|
-
|
|
19552
|
-
if (windowsFilePathExp.exec(url)) {
|
|
19553
|
-
return path;
|
|
19554
|
-
}
|
|
19379
|
+
let firstPathSegmentMatch;
|
|
19555
19380
|
|
|
19556
|
-
|
|
19557
|
-
|
|
19558
|
-
|
|
19559
|
-
|
|
19381
|
+
// Get the relative path from the input URL.
|
|
19382
|
+
if (startsWith(url, base)) {
|
|
19383
|
+
url = url.replace(base, "");
|
|
19384
|
+
}
|
|
19560
19385
|
|
|
19561
|
-
|
|
19562
|
-
|
|
19563
|
-
|
|
19386
|
+
// The input URL intentionally contains a first path segment that ends with a colon.
|
|
19387
|
+
if (windowsFilePathExp.exec(url)) {
|
|
19388
|
+
return path;
|
|
19389
|
+
}
|
|
19564
19390
|
|
|
19565
|
-
|
|
19566
|
-
|
|
19567
|
-
|
|
19568
|
-
*/
|
|
19569
|
-
$$parseLinkUrl(url) {
|
|
19570
|
-
if (stripHash(this.appBase) === stripHash(url)) {
|
|
19571
|
-
this.$$parse(url);
|
|
19572
|
-
return true;
|
|
19391
|
+
firstPathSegmentMatch = windowsFilePathExp.exec(path);
|
|
19392
|
+
return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;
|
|
19393
|
+
}
|
|
19573
19394
|
}
|
|
19574
|
-
return false;
|
|
19575
19395
|
}
|
|
19576
19396
|
}
|
|
19577
19397
|
|
|
@@ -19580,20 +19400,20 @@
|
|
|
19580
19400
|
/** @type {string} */
|
|
19581
19401
|
this.hashPrefixConf = "!";
|
|
19582
19402
|
|
|
19583
|
-
/** @type {Html5Mode} */
|
|
19403
|
+
/** @type {import("./interface.ts").Html5Mode} */
|
|
19584
19404
|
this.html5ModeConf = {
|
|
19585
|
-
enabled:
|
|
19586
|
-
requireBase:
|
|
19405
|
+
enabled: true,
|
|
19406
|
+
requireBase: false,
|
|
19587
19407
|
rewriteLinks: true,
|
|
19588
19408
|
};
|
|
19589
19409
|
|
|
19590
|
-
/** @type {Array<import("./interface.
|
|
19410
|
+
/** @type {Array<import("./interface.ts").UrlChangeListener>} */
|
|
19591
19411
|
this.urlChangeListeners = [];
|
|
19592
19412
|
this.urlChangeInit = false;
|
|
19593
19413
|
|
|
19594
19414
|
/** @type {History['state']} */
|
|
19595
19415
|
this.cachedState = null;
|
|
19596
|
-
/** @
|
|
19416
|
+
/** @type {History['state']} */
|
|
19597
19417
|
this.lastHistoryState = null;
|
|
19598
19418
|
/** @type {string} */
|
|
19599
19419
|
this.lastBrowserUrl = window.location.href;
|
|
@@ -19604,14 +19424,19 @@
|
|
|
19604
19424
|
// URL API
|
|
19605
19425
|
/// ///////////////////////////////////////////////////////////
|
|
19606
19426
|
|
|
19427
|
+
/**
|
|
19428
|
+
* Updates the browser's current URL and history state.
|
|
19429
|
+
*
|
|
19430
|
+
* @param {string|undefined} url - The target URL to navigate to.
|
|
19431
|
+
* @param {*} [state=null] - Optional history state object to associate with the new URL.
|
|
19432
|
+
* @returns {LocationProvider}
|
|
19433
|
+
*/
|
|
19607
19434
|
setUrl(url, state) {
|
|
19608
19435
|
if (state === undefined) {
|
|
19609
19436
|
state = null;
|
|
19610
19437
|
}
|
|
19611
|
-
|
|
19612
|
-
// setter
|
|
19613
19438
|
if (url) {
|
|
19614
|
-
url =
|
|
19439
|
+
url = new URL(url).href;
|
|
19615
19440
|
|
|
19616
19441
|
if (this.lastBrowserUrl === url && this.lastHistoryState === state) {
|
|
19617
19442
|
return this;
|
|
@@ -19628,7 +19453,7 @@
|
|
|
19628
19453
|
* Returns the current URL with any empty hash (`#`) removed.
|
|
19629
19454
|
* @return {string}
|
|
19630
19455
|
*/
|
|
19631
|
-
|
|
19456
|
+
getBrowserUrl() {
|
|
19632
19457
|
return trimEmptyHash(window.location.href);
|
|
19633
19458
|
}
|
|
19634
19459
|
|
|
@@ -19656,19 +19481,17 @@
|
|
|
19656
19481
|
|
|
19657
19482
|
/**
|
|
19658
19483
|
* Fires the state or URL change event.
|
|
19659
|
-
*
|
|
19660
|
-
* @private
|
|
19661
19484
|
*/
|
|
19662
|
-
fireStateOrUrlChange() {
|
|
19485
|
+
#fireStateOrUrlChange() {
|
|
19663
19486
|
const prevLastHistoryState = this.lastHistoryState;
|
|
19664
19487
|
this.cacheState();
|
|
19665
19488
|
if (
|
|
19666
|
-
this.lastBrowserUrl === this.
|
|
19489
|
+
this.lastBrowserUrl === this.getBrowserUrl() &&
|
|
19667
19490
|
prevLastHistoryState === this.cachedState
|
|
19668
19491
|
) {
|
|
19669
19492
|
return;
|
|
19670
19493
|
}
|
|
19671
|
-
this.lastBrowserUrl = this.
|
|
19494
|
+
this.lastBrowserUrl = this.getBrowserUrl();
|
|
19672
19495
|
this.lastHistoryState = this.cachedState;
|
|
19673
19496
|
this.urlChangeListeners.forEach((listener) => {
|
|
19674
19497
|
listener(trimEmptyHash(window.location.href), this.cachedState);
|
|
@@ -19681,131 +19504,75 @@
|
|
|
19681
19504
|
* @param {import("./interface.js").UrlChangeListener} callback - The callback function to register.
|
|
19682
19505
|
* @returns void
|
|
19683
19506
|
*/
|
|
19684
|
-
onUrlChange(callback) {
|
|
19507
|
+
#onUrlChange(callback) {
|
|
19685
19508
|
if (!this.urlChangeInit) {
|
|
19686
|
-
window.addEventListener(
|
|
19509
|
+
window.addEventListener(
|
|
19510
|
+
"popstate",
|
|
19511
|
+
this.#fireStateOrUrlChange.bind(this),
|
|
19512
|
+
);
|
|
19687
19513
|
window.addEventListener(
|
|
19688
19514
|
"hashchange",
|
|
19689
|
-
this
|
|
19515
|
+
this.#fireStateOrUrlChange.bind(this),
|
|
19690
19516
|
);
|
|
19691
19517
|
this.urlChangeInit = true;
|
|
19692
19518
|
}
|
|
19693
19519
|
this.urlChangeListeners.push(callback);
|
|
19694
19520
|
}
|
|
19695
19521
|
|
|
19696
|
-
/**
|
|
19697
|
-
* The default value for the prefix is `'!'`.
|
|
19698
|
-
* @param {string=} prefix Prefix for hash part (containing path and search)
|
|
19699
|
-
* @returns {void}
|
|
19700
|
-
*/
|
|
19701
|
-
setHashPrefix(prefix) {
|
|
19702
|
-
this.hashPrefixConf = prefix;
|
|
19703
|
-
}
|
|
19704
|
-
|
|
19705
|
-
/**
|
|
19706
|
-
* Current hash prefix
|
|
19707
|
-
* @returns {string}
|
|
19708
|
-
*/
|
|
19709
|
-
getHashPrefix() {
|
|
19710
|
-
return this.hashPrefixConf;
|
|
19711
|
-
}
|
|
19712
|
-
|
|
19713
|
-
/**
|
|
19714
|
-
* Configures html5 mode
|
|
19715
|
-
* @param {(boolean|Html5Mode)=} mode If boolean, sets `html5Mode.enabled` to value. Otherwise, accepts html5Mode object
|
|
19716
|
-
*
|
|
19717
|
-
* @returns {void}
|
|
19718
|
-
*/
|
|
19719
|
-
setHtml5Mode(mode) {
|
|
19720
|
-
if (isBoolean(mode)) {
|
|
19721
|
-
this.html5ModeConf.enabled = /** @type {boolean} */ (mode);
|
|
19722
|
-
}
|
|
19723
|
-
if (isObject(mode)) {
|
|
19724
|
-
const html5Mode = /** @type {Html5Mode} */ (mode);
|
|
19725
|
-
if (isDefined(html5Mode.enabled) && isBoolean(html5Mode.enabled)) {
|
|
19726
|
-
this.html5ModeConf.enabled = html5Mode.enabled;
|
|
19727
|
-
}
|
|
19728
|
-
|
|
19729
|
-
if (
|
|
19730
|
-
isDefined(html5Mode.requireBase) &&
|
|
19731
|
-
isBoolean(html5Mode.requireBase)
|
|
19732
|
-
) {
|
|
19733
|
-
this.html5ModeConf.requireBase = html5Mode.requireBase;
|
|
19734
|
-
}
|
|
19735
|
-
|
|
19736
|
-
if (
|
|
19737
|
-
isDefined(html5Mode.rewriteLinks) &&
|
|
19738
|
-
(isBoolean(html5Mode.rewriteLinks) || isString(html5Mode.rewriteLinks))
|
|
19739
|
-
) {
|
|
19740
|
-
this.html5ModeConf.rewriteLinks = html5Mode.rewriteLinks;
|
|
19741
|
-
}
|
|
19742
|
-
}
|
|
19743
|
-
}
|
|
19744
|
-
|
|
19745
|
-
/**
|
|
19746
|
-
* Returns html5 mode cofiguration
|
|
19747
|
-
* @returns {Html5Mode}
|
|
19748
|
-
*/
|
|
19749
|
-
getHtml5Mode() {
|
|
19750
|
-
return this.html5ModeConf;
|
|
19751
|
-
}
|
|
19752
|
-
|
|
19753
19522
|
$get = [
|
|
19754
|
-
|
|
19755
|
-
|
|
19523
|
+
$injectTokens.$rootScope,
|
|
19524
|
+
$injectTokens.$rootElement,
|
|
19756
19525
|
/**
|
|
19757
19526
|
*
|
|
19758
19527
|
* @param {import('../../core/scope/scope.js').Scope} $rootScope
|
|
19759
19528
|
* @param {Element} $rootElement
|
|
19760
|
-
* @returns
|
|
19529
|
+
* @returns {Location}
|
|
19761
19530
|
*/
|
|
19762
19531
|
($rootScope, $rootElement) => {
|
|
19763
19532
|
/** @type {Location} */
|
|
19764
19533
|
let $location;
|
|
19765
|
-
let LocationMode;
|
|
19766
19534
|
const baseHref = getBaseHref(); // if base[href] is undefined, it defaults to ''
|
|
19767
19535
|
const initialUrl = trimEmptyHash(window.location.href);
|
|
19768
19536
|
let appBase;
|
|
19769
19537
|
|
|
19770
|
-
if (this.
|
|
19771
|
-
if (!baseHref && this.
|
|
19538
|
+
if (this.html5ModeConf.enabled) {
|
|
19539
|
+
if (!baseHref && this.html5ModeConf.requireBase) {
|
|
19772
19540
|
throw $locationMinErr(
|
|
19773
19541
|
"nobase",
|
|
19774
19542
|
"$location in HTML5 mode requires a <base> tag to be present!",
|
|
19775
19543
|
);
|
|
19776
19544
|
}
|
|
19777
19545
|
appBase = serverBase(initialUrl) + (baseHref || "/");
|
|
19778
|
-
LocationMode = LocationHtml5Url;
|
|
19779
19546
|
} else {
|
|
19780
19547
|
appBase = stripHash(initialUrl);
|
|
19781
|
-
LocationMode = LocationHashbangUrl;
|
|
19782
19548
|
}
|
|
19783
19549
|
const appBaseNoFile = stripFile(appBase);
|
|
19784
19550
|
|
|
19785
|
-
$location = new
|
|
19551
|
+
$location = new Location(
|
|
19786
19552
|
appBase,
|
|
19787
19553
|
appBaseNoFile,
|
|
19788
|
-
|
|
19554
|
+
this.html5ModeConf.enabled,
|
|
19555
|
+
`#${this.hashPrefixConf}`,
|
|
19789
19556
|
);
|
|
19790
|
-
$location
|
|
19557
|
+
$location.parseLinkUrl(initialUrl, initialUrl);
|
|
19791
19558
|
|
|
19792
19559
|
$location.$$state = this.state();
|
|
19793
19560
|
|
|
19794
19561
|
const IGNORE_URI_REGEXP = /^\s*(javascript|mailto):/i;
|
|
19795
19562
|
|
|
19796
19563
|
const setBrowserUrlWithFallback = (url, state) => {
|
|
19797
|
-
const oldUrl = $location.
|
|
19564
|
+
const oldUrl = $location.getUrl();
|
|
19798
19565
|
const oldState = $location.$$state;
|
|
19799
19566
|
try {
|
|
19800
19567
|
this.setUrl(url, state);
|
|
19801
19568
|
|
|
19802
|
-
// Make sure $location.
|
|
19569
|
+
// Make sure $location.getState() returns referentially identical (not just deeply equal)
|
|
19803
19570
|
// state object; this makes possible quick checking if the state changed in the digest
|
|
19804
19571
|
// loop. Checking deep equality would be too expensive.
|
|
19805
19572
|
$location.$$state = this.state();
|
|
19806
19573
|
} catch (e) {
|
|
19807
19574
|
// Restore old values if pushState fails
|
|
19808
|
-
$location.
|
|
19575
|
+
$location.setUrl(/** @type {string} */ (oldUrl));
|
|
19809
19576
|
$location.$$state = oldState;
|
|
19810
19577
|
|
|
19811
19578
|
throw e;
|
|
@@ -19816,7 +19583,7 @@
|
|
|
19816
19583
|
"click",
|
|
19817
19584
|
/** @param {MouseEvent} event */
|
|
19818
19585
|
(event) => {
|
|
19819
|
-
const rewriteLinks = this.
|
|
19586
|
+
const rewriteLinks = this.html5ModeConf.rewriteLinks;
|
|
19820
19587
|
// TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)
|
|
19821
19588
|
// currently we open nice url link and redirect then
|
|
19822
19589
|
|
|
@@ -19825,7 +19592,6 @@
|
|
|
19825
19592
|
event.ctrlKey ||
|
|
19826
19593
|
event.metaKey ||
|
|
19827
19594
|
event.shiftKey ||
|
|
19828
|
-
event.which === 2 ||
|
|
19829
19595
|
event.button === 2
|
|
19830
19596
|
) {
|
|
19831
19597
|
return;
|
|
@@ -19860,7 +19626,7 @@
|
|
|
19860
19626
|
// an animation.
|
|
19861
19627
|
|
|
19862
19628
|
const scvAnimatedString = /** @type {unknown} */ (absHref);
|
|
19863
|
-
absHref =
|
|
19629
|
+
absHref = new URL(
|
|
19864
19630
|
/** @type {SVGAnimatedString } */ (scvAnimatedString).animVal,
|
|
19865
19631
|
).href;
|
|
19866
19632
|
}
|
|
@@ -19873,7 +19639,7 @@
|
|
|
19873
19639
|
!elm.getAttribute("target") &&
|
|
19874
19640
|
!event.defaultPrevented
|
|
19875
19641
|
) {
|
|
19876
|
-
if ($location
|
|
19642
|
+
if ($location.parseLinkUrl(absHref, relHref)) {
|
|
19877
19643
|
// We do a preventDefault for all urls that are part of the AngularTS application,
|
|
19878
19644
|
// in html5mode and also without, so that we are able to abort navigation without
|
|
19879
19645
|
// getting double entries in the location history.
|
|
@@ -19884,14 +19650,14 @@
|
|
|
19884
19650
|
);
|
|
19885
19651
|
|
|
19886
19652
|
// rewrite hashbang url <> html5 url
|
|
19887
|
-
if ($location.absUrl
|
|
19888
|
-
this.setUrl($location.absUrl
|
|
19653
|
+
if ($location.absUrl !== initialUrl) {
|
|
19654
|
+
this.setUrl($location.absUrl, true);
|
|
19889
19655
|
}
|
|
19890
19656
|
|
|
19891
19657
|
let initializing = true;
|
|
19892
19658
|
|
|
19893
19659
|
// update $location when $browser url changes
|
|
19894
|
-
this
|
|
19660
|
+
this.#onUrlChange((newUrl, newState) => {
|
|
19895
19661
|
if (!startsWith(newUrl, appBaseNoFile)) {
|
|
19896
19662
|
// If we are navigating outside of the app then force a reload
|
|
19897
19663
|
window.location.href = newUrl;
|
|
@@ -19899,10 +19665,10 @@
|
|
|
19899
19665
|
}
|
|
19900
19666
|
|
|
19901
19667
|
Promise.resolve().then(() => {
|
|
19902
|
-
const oldUrl = $location.absUrl
|
|
19668
|
+
const oldUrl = $location.absUrl;
|
|
19903
19669
|
const oldState = $location.$$state;
|
|
19904
19670
|
let defaultPrevented;
|
|
19905
|
-
$location
|
|
19671
|
+
$location.parse(newUrl);
|
|
19906
19672
|
$location.$$state = newState;
|
|
19907
19673
|
|
|
19908
19674
|
defaultPrevented = $rootScope.$broadcast(
|
|
@@ -19915,10 +19681,10 @@
|
|
|
19915
19681
|
|
|
19916
19682
|
// if the location was changed by a `$locationChangeStart` handler then stop
|
|
19917
19683
|
// processing this location change
|
|
19918
|
-
if ($location.absUrl
|
|
19684
|
+
if ($location.absUrl !== newUrl) return;
|
|
19919
19685
|
|
|
19920
19686
|
if (defaultPrevented) {
|
|
19921
|
-
$location
|
|
19687
|
+
$location.parse(oldUrl);
|
|
19922
19688
|
$location.$$state = oldState;
|
|
19923
19689
|
setBrowserUrlWithFallback(oldUrl, oldState);
|
|
19924
19690
|
} else {
|
|
@@ -19930,21 +19696,21 @@
|
|
|
19930
19696
|
|
|
19931
19697
|
// update browser
|
|
19932
19698
|
const updateBrowser = () => {
|
|
19933
|
-
if (initializing ||
|
|
19934
|
-
|
|
19699
|
+
if (initializing || urlUpdatedByLocation) {
|
|
19700
|
+
urlUpdatedByLocation = false;
|
|
19935
19701
|
|
|
19936
|
-
const oldUrl = /** @type {string} */ (this.
|
|
19937
|
-
const newUrl = $location.absUrl
|
|
19702
|
+
const oldUrl = /** @type {string} */ (this.getBrowserUrl());
|
|
19703
|
+
const newUrl = $location.absUrl;
|
|
19938
19704
|
const oldState = this.state();
|
|
19939
19705
|
const urlOrStateChanged =
|
|
19940
19706
|
!urlsEqual(oldUrl, newUrl) ||
|
|
19941
|
-
($location
|
|
19707
|
+
($location.html5 && oldState !== $location.$$state);
|
|
19942
19708
|
|
|
19943
19709
|
if (initializing || urlOrStateChanged) {
|
|
19944
19710
|
initializing = false;
|
|
19945
19711
|
|
|
19946
19712
|
setTimeout(() => {
|
|
19947
|
-
const newUrl = $location.absUrl
|
|
19713
|
+
const newUrl = $location.absUrl;
|
|
19948
19714
|
const { defaultPrevented } = $rootScope.$broadcast(
|
|
19949
19715
|
"$locationChangeStart",
|
|
19950
19716
|
newUrl,
|
|
@@ -19955,10 +19721,10 @@
|
|
|
19955
19721
|
|
|
19956
19722
|
// if the location was changed by a `$locationChangeStart` handler then stop
|
|
19957
19723
|
// processing this location change
|
|
19958
|
-
if ($location.absUrl
|
|
19724
|
+
if ($location.absUrl !== newUrl) return;
|
|
19959
19725
|
|
|
19960
19726
|
if (defaultPrevented) {
|
|
19961
|
-
$location
|
|
19727
|
+
$location.parse(oldUrl);
|
|
19962
19728
|
$location.$$state = oldState;
|
|
19963
19729
|
} else {
|
|
19964
19730
|
if (urlOrStateChanged) {
|
|
@@ -19972,13 +19738,8 @@
|
|
|
19972
19738
|
});
|
|
19973
19739
|
}
|
|
19974
19740
|
}
|
|
19975
|
-
|
|
19976
|
-
$location.$$replace = false;
|
|
19977
|
-
|
|
19978
|
-
// we don't need to return anything because $evalAsync will make the digest loop dirty when
|
|
19979
|
-
// there is a change
|
|
19980
19741
|
};
|
|
19981
|
-
|
|
19742
|
+
$location.$$updateBrowser = updateBrowser;
|
|
19982
19743
|
updateBrowser();
|
|
19983
19744
|
$rootScope.$on("$updateBrowser", updateBrowser);
|
|
19984
19745
|
|
|
@@ -19987,7 +19748,7 @@
|
|
|
19987
19748
|
function afterLocationChange(oldUrl, oldState) {
|
|
19988
19749
|
$rootScope.$broadcast(
|
|
19989
19750
|
"$locationChangeSuccess",
|
|
19990
|
-
$location.absUrl
|
|
19751
|
+
$location.absUrl,
|
|
19991
19752
|
oldUrl,
|
|
19992
19753
|
$location.$$state,
|
|
19993
19754
|
oldState,
|
|
@@ -19999,28 +19760,63 @@
|
|
|
19999
19760
|
|
|
20000
19761
|
/**
|
|
20001
19762
|
* ///////////////////////////
|
|
20002
|
-
*
|
|
19763
|
+
* PRIVATE HELPERS
|
|
20003
19764
|
* ///////////////////////////
|
|
20004
19765
|
*/
|
|
20005
19766
|
|
|
20006
19767
|
/**
|
|
20007
|
-
*
|
|
19768
|
+
* @ignore
|
|
19769
|
+
* Encodes a URL path by encoding each path segment individually using `encodeUriSegment`,
|
|
19770
|
+
* while preserving forward slashes (`/`) as segment separators.
|
|
20008
19771
|
*
|
|
20009
|
-
*
|
|
20010
|
-
*
|
|
19772
|
+
* This function first decodes any existing percent-encodings (such as `%20` or `%2F`)
|
|
19773
|
+
* in each segment to prevent double encoding, except for encoded forward slashes (`%2F`),
|
|
19774
|
+
* which are replaced with literal slashes before decoding to keep path boundaries intact.
|
|
19775
|
+
*
|
|
19776
|
+
* After decoding, each segment is re-encoded with `encodeUriSegment` according to RFC 3986,
|
|
19777
|
+
* encoding only characters that must be encoded in a path segment.
|
|
19778
|
+
*
|
|
19779
|
+
* The encoded segments are then rejoined with `/` to form the encoded path.
|
|
19780
|
+
*
|
|
19781
|
+
* @param {string} path - The URL path string to encode. May contain multiple segments separated by `/`.
|
|
19782
|
+
* @returns {string} The encoded path, where each segment is encoded, but forward slashes are preserved.
|
|
19783
|
+
*
|
|
19784
|
+
* @example
|
|
19785
|
+
* encodePath("user profile/images/pic 1.jpg")
|
|
19786
|
+
* // returns "user%20profile/images/pic%201.jpg"
|
|
19787
|
+
*
|
|
19788
|
+
* @example
|
|
19789
|
+
* encodePath("folder1%2Fsub/folder2")
|
|
19790
|
+
* // returns "folder1%2Fsub/folder2"
|
|
20011
19791
|
*/
|
|
20012
19792
|
function encodePath(path) {
|
|
20013
19793
|
const segments = path.split("/");
|
|
20014
19794
|
let i = segments.length;
|
|
20015
19795
|
|
|
20016
19796
|
while (i--) {
|
|
20017
|
-
//
|
|
20018
|
-
|
|
19797
|
+
// Decode any existing encodings (e.g. %20, %2F) to prevent double-encoding
|
|
19798
|
+
// But keep slashes intact (they were split on)
|
|
19799
|
+
const decodedSegment = decodeURIComponent(
|
|
19800
|
+
segments[i].replace(/%2F/gi, "/"),
|
|
19801
|
+
);
|
|
19802
|
+
segments[i] = encodeUriSegment(decodedSegment);
|
|
20019
19803
|
}
|
|
20020
19804
|
|
|
20021
19805
|
return segments.join("/");
|
|
20022
19806
|
}
|
|
20023
19807
|
|
|
19808
|
+
/**
|
|
19809
|
+
* @ignore
|
|
19810
|
+
* Decodes each segment of a URL path.
|
|
19811
|
+
*
|
|
19812
|
+
* Splits the input path by "/", decodes each segment using decodeURIComponent,
|
|
19813
|
+
* and if html5Mode is enabled, re-encodes any forward slashes inside segments
|
|
19814
|
+
* as "%2F" to avoid confusion with path separators.
|
|
19815
|
+
*
|
|
19816
|
+
* @param {string} path - The URL path to decode.
|
|
19817
|
+
* @param {boolean} html5Mode - If true, encodes forward slashes in segments as "%2F".
|
|
19818
|
+
* @returns {string} The decoded path with segments optionally encoding slashes.
|
|
19819
|
+
*/
|
|
20024
19820
|
function decodePath(path, html5Mode) {
|
|
20025
19821
|
const segments = path.split("/");
|
|
20026
19822
|
let i = segments.length;
|
|
@@ -20036,6 +19832,33 @@
|
|
|
20036
19832
|
return segments.join("/");
|
|
20037
19833
|
}
|
|
20038
19834
|
|
|
19835
|
+
/**
|
|
19836
|
+
* @ignore
|
|
19837
|
+
* Normalizes a URL path by encoding the path segments, query parameters, and hash fragment.
|
|
19838
|
+
*
|
|
19839
|
+
* - Path segments are encoded using `encodePath`, which encodes each segment individually.
|
|
19840
|
+
* - Query parameters (`searchValue`) are converted to a query string using `toKeyValue`.
|
|
19841
|
+
* - Hash fragment (`hashValue`) is encoded using `encodeUriSegment` and prefixed with `#`.
|
|
19842
|
+
*
|
|
19843
|
+
* This function returns a fully constructed URL path with optional query and hash components.
|
|
19844
|
+
*
|
|
19845
|
+
* @param {string} pathValue - The base URL path (e.g., "folder/item name").
|
|
19846
|
+
* @param {Object.<string, any> | string | null} searchValue - An object or string representing query parameters.
|
|
19847
|
+
* - If an object, it can contain strings, numbers, booleans, or arrays of values.
|
|
19848
|
+
* - If a string, it is assumed to be a raw query string.
|
|
19849
|
+
* - If null or undefined, no query string is added.
|
|
19850
|
+
* @param {string | null} hashValue - The URL fragment (everything after `#`). If null or undefined, no hash is added.
|
|
19851
|
+
*
|
|
19852
|
+
* @returns {string} The normalized URL path including encoded path, optional query string, and optional hash.
|
|
19853
|
+
*
|
|
19854
|
+
* @example
|
|
19855
|
+
* normalizePath("products/list", { category: "books", page: 2 }, "section1")
|
|
19856
|
+
* // returns "products/list?category=books&page=2#section1"
|
|
19857
|
+
*
|
|
19858
|
+
* @example
|
|
19859
|
+
* normalizePath("user profile/images", null, null)
|
|
19860
|
+
* // returns "user%20profile/images"
|
|
19861
|
+
*/
|
|
20039
19862
|
function normalizePath(pathValue, searchValue, hashValue) {
|
|
20040
19863
|
const search = toKeyValue(searchValue);
|
|
20041
19864
|
const hash = hashValue ? `#${encodeUriSegment(hashValue)}` : "";
|
|
@@ -20044,7 +19867,15 @@
|
|
|
20044
19867
|
return path + (search ? `?${search}` : "") + hash;
|
|
20045
19868
|
}
|
|
20046
19869
|
|
|
20047
|
-
|
|
19870
|
+
/**
|
|
19871
|
+
* @ignore
|
|
19872
|
+
* Parses the application URL and updates the location object with path, search, and hash.
|
|
19873
|
+
*
|
|
19874
|
+
* @param {string} url - The URL string to parse.
|
|
19875
|
+
* @param {boolean} html5Mode - Whether HTML5 mode is enabled (affects decoding).
|
|
19876
|
+
* @throws Will throw an error if the URL starts with invalid slashes.
|
|
19877
|
+
*/
|
|
19878
|
+
function parseAppUrl(url, html5Mode) {
|
|
20048
19879
|
if (/^\s*[\\/]{2,}/.test(url)) {
|
|
20049
19880
|
throw $locationMinErr("badpath", 'Invalid url "{0}".', url);
|
|
20050
19881
|
}
|
|
@@ -20058,22 +19889,20 @@
|
|
|
20058
19889
|
prefixed && match.pathname.charAt(0) === "/"
|
|
20059
19890
|
? match.pathname.substring(1)
|
|
20060
19891
|
: match.pathname;
|
|
20061
|
-
|
|
20062
|
-
|
|
20063
|
-
|
|
19892
|
+
$$path = decodePath(path, html5Mode);
|
|
19893
|
+
$$search = parseKeyValue(match.search);
|
|
19894
|
+
$$hash = decodeURIComponent(match.hash);
|
|
20064
19895
|
|
|
20065
19896
|
// make sure path starts with '/';
|
|
20066
|
-
if (
|
|
20067
|
-
|
|
19897
|
+
if ($$path && $$path.charAt(0) !== "/") {
|
|
19898
|
+
$$path = `/${$$path}`;
|
|
20068
19899
|
}
|
|
20069
19900
|
}
|
|
20070
19901
|
|
|
20071
|
-
function startsWith(str, search) {
|
|
20072
|
-
return str.slice(0, search.length) === search;
|
|
20073
|
-
}
|
|
20074
|
-
|
|
20075
19902
|
/**
|
|
20076
|
-
*
|
|
19903
|
+
* @ignore
|
|
19904
|
+
* Returns the substring of `url` after the `base` string if `url` starts with `base`.
|
|
19905
|
+
* Returns `undefined` if `url` does not start with `base`.
|
|
20077
19906
|
* @param {string} base
|
|
20078
19907
|
* @param {string} url
|
|
20079
19908
|
* @returns {string} returns text from `url` after `base` or `undefined` if it does not begin with
|
|
@@ -20085,25 +19914,96 @@
|
|
|
20085
19914
|
}
|
|
20086
19915
|
}
|
|
20087
19916
|
|
|
19917
|
+
/**
|
|
19918
|
+
* @ignore
|
|
19919
|
+
* Removes the hash fragment (including the '#') from the given URL string.
|
|
19920
|
+
*
|
|
19921
|
+
* @param {string} url - The URL string to process.
|
|
19922
|
+
* @returns {string} The URL without the hash fragment.
|
|
19923
|
+
*/
|
|
20088
19924
|
function stripHash(url) {
|
|
20089
19925
|
const index = url.indexOf("#");
|
|
20090
19926
|
return index === -1 ? url : url.substring(0, index);
|
|
20091
19927
|
}
|
|
20092
19928
|
|
|
19929
|
+
/**
|
|
19930
|
+
* @ignore
|
|
19931
|
+
* Removes the file name (and any hash) from a URL, returning the base directory path.
|
|
19932
|
+
*
|
|
19933
|
+
* For example:
|
|
19934
|
+
* - Input: "https://example.com/path/to/file.js"
|
|
19935
|
+
* Output: "https://example.com/path/to/"
|
|
19936
|
+
*
|
|
19937
|
+
* - Input: "https://example.com/path/to/file.js#section"
|
|
19938
|
+
* Output: "https://example.com/path/to/"
|
|
19939
|
+
*
|
|
19940
|
+
* @param {string} url - The URL from which to strip the file name and hash.
|
|
19941
|
+
* @returns {string} The base path of the URL, ending with a slash.
|
|
19942
|
+
*/
|
|
20093
19943
|
function stripFile(url) {
|
|
20094
19944
|
return url.substring(0, stripHash(url).lastIndexOf("/") + 1);
|
|
20095
19945
|
}
|
|
20096
19946
|
|
|
20097
|
-
|
|
19947
|
+
/**
|
|
19948
|
+
* @ignore
|
|
19949
|
+
* Extracts the base server URL (scheme, host, and optional port) from a full URL.
|
|
19950
|
+
*
|
|
19951
|
+
* If no path is present, returns the full URL.
|
|
19952
|
+
*
|
|
19953
|
+
* For example:
|
|
19954
|
+
* - Input: "https://example.com/path/to/file"
|
|
19955
|
+
* Output: "https://example.com"
|
|
19956
|
+
*
|
|
19957
|
+
* - Input: "http://localhost:3000/api/data"
|
|
19958
|
+
* Output: "http://localhost:3000"
|
|
19959
|
+
*
|
|
19960
|
+
* @param {string} url - The full URL to extract the server base from.
|
|
19961
|
+
* @returns {string} The server base, including scheme and host (and port if present).
|
|
19962
|
+
*/
|
|
20098
19963
|
function serverBase(url) {
|
|
20099
|
-
|
|
19964
|
+
const start = url.indexOf("//") + 2;
|
|
19965
|
+
const slashIndex = url.indexOf("/", start);
|
|
19966
|
+
return slashIndex === -1 ? url : url.substring(0, slashIndex);
|
|
20100
19967
|
}
|
|
20101
19968
|
|
|
20102
|
-
|
|
20103
|
-
|
|
20104
|
-
|
|
19969
|
+
/**
|
|
19970
|
+
* @ignore
|
|
19971
|
+
* Determine if two URLs are equal despite potential differences in encoding,
|
|
19972
|
+
* trailing slashes, or empty hash fragments, such as between $location.absUrl() and $browser.url().
|
|
19973
|
+
*
|
|
19974
|
+
* @param {string} a - First URL to compare.
|
|
19975
|
+
* @param {string} b - Second URL to compare.
|
|
19976
|
+
* @returns {boolean} True if URLs are equivalent after normalization.
|
|
19977
|
+
*/
|
|
20105
19978
|
function urlsEqual(a, b) {
|
|
20106
|
-
return
|
|
19979
|
+
return normalizeUrl(a) === normalizeUrl(b);
|
|
19980
|
+
}
|
|
19981
|
+
|
|
19982
|
+
/**
|
|
19983
|
+
* @ignore
|
|
19984
|
+
* Normalize a URL by resolving it via a DOM anchor element,
|
|
19985
|
+
* removing trailing slashes (except root), and trimming empty hashes.
|
|
19986
|
+
*
|
|
19987
|
+
* @param {string} url - URL to normalize.
|
|
19988
|
+
* @returns {string} Normalized URL string.
|
|
19989
|
+
*/
|
|
19990
|
+
function normalizeUrl(url) {
|
|
19991
|
+
const anchor = document.createElement("a");
|
|
19992
|
+
anchor.href = url;
|
|
19993
|
+
|
|
19994
|
+
let normalized = anchor.href;
|
|
19995
|
+
|
|
19996
|
+
// Remove trailing slash unless it's root (e.g., https://example.com/)
|
|
19997
|
+
if (normalized.endsWith("/") && !/^https?:\/\/[^/]+\/$/.test(normalized)) {
|
|
19998
|
+
normalized = normalized.slice(0, -1);
|
|
19999
|
+
}
|
|
20000
|
+
|
|
20001
|
+
// Remove empty hash (e.g., https://example.com/foo# -> https://example.com/foo)
|
|
20002
|
+
if (normalized.endsWith("#")) {
|
|
20003
|
+
normalized = normalized.slice(0, -1);
|
|
20004
|
+
}
|
|
20005
|
+
|
|
20006
|
+
return normalized;
|
|
20107
20007
|
}
|
|
20108
20008
|
|
|
20109
20009
|
/**
|
|
@@ -20257,7 +20157,7 @@
|
|
|
20257
20157
|
Array.isArray(target.$nonscope) &&
|
|
20258
20158
|
target.$nonscope.includes(key))
|
|
20259
20159
|
) {
|
|
20260
|
-
|
|
20160
|
+
/* empty */
|
|
20261
20161
|
} else {
|
|
20262
20162
|
target[key] = createScope(target[key], proxy.$handler);
|
|
20263
20163
|
}
|
|
@@ -20736,6 +20636,7 @@
|
|
|
20736
20636
|
|
|
20737
20637
|
/**
|
|
20738
20638
|
* @param {Listener[]} listeners
|
|
20639
|
+
* @param {Function} filter
|
|
20739
20640
|
*/
|
|
20740
20641
|
#scheduleListener(listeners, filter = (val) => val) {
|
|
20741
20642
|
Promise.resolve().then(() => {
|
|
@@ -21386,8 +21287,7 @@
|
|
|
21386
21287
|
function calculateWatcherCount(model) {
|
|
21387
21288
|
const childIds = collectChildIds(model).add(model.$id);
|
|
21388
21289
|
|
|
21389
|
-
|
|
21390
|
-
const count = Array.from(model.watchers.values()).reduce(
|
|
21290
|
+
return Array.from(model.watchers.values()).reduce(
|
|
21391
21291
|
(count, watcherArray) =>
|
|
21392
21292
|
count +
|
|
21393
21293
|
watcherArray.reduce(
|
|
@@ -21397,7 +21297,6 @@
|
|
|
21397
21297
|
),
|
|
21398
21298
|
0,
|
|
21399
21299
|
);
|
|
21400
|
-
return count;
|
|
21401
21300
|
}
|
|
21402
21301
|
|
|
21403
21302
|
/**
|
|
@@ -23088,8 +22987,7 @@
|
|
|
23088
22987
|
|
|
23089
22988
|
temporaryStyles.forEach((entry) => {
|
|
23090
22989
|
const key = entry[0];
|
|
23091
|
-
|
|
23092
|
-
node.style[key] = value;
|
|
22990
|
+
node.style[key] = entry[1];
|
|
23093
22991
|
});
|
|
23094
22992
|
|
|
23095
22993
|
applyAnimationClasses(element, options);
|
|
@@ -25615,20 +25513,6 @@
|
|
|
25615
25513
|
name.split(".").map((name) => (obj) => obj && obj[name]),
|
|
25616
25514
|
);
|
|
25617
25515
|
|
|
25618
|
-
/**
|
|
25619
|
-
* Given two functions that return truthy or falsey values, returns a function that returns truthy
|
|
25620
|
-
* if at least one of the functions returns truthy for the given arguments
|
|
25621
|
-
*/
|
|
25622
|
-
function or(fn1, fn2) {
|
|
25623
|
-
return (...args) => fn1.apply(null, args) || fn2.apply(null, args);
|
|
25624
|
-
}
|
|
25625
|
-
/**
|
|
25626
|
-
* Check if all the elements of an array match a predicate function
|
|
25627
|
-
*
|
|
25628
|
-
* @param fn1 a predicate function `fn1`
|
|
25629
|
-
* @returns a function which takes an array and returns true if `fn1` is true for all elements of the array
|
|
25630
|
-
*/
|
|
25631
|
-
const all = (fn1) => (arr) => arr.reduce((b, x) => b && !!fn1(x), true);
|
|
25632
25516
|
/** Given a class, returns a Predicate function that returns true if the object is of that class */
|
|
25633
25517
|
const is = (ctor) => (obj) =>
|
|
25634
25518
|
(obj != null && obj.constructor === ctor) || obj instanceof ctor;
|
|
@@ -25691,10 +25575,10 @@
|
|
|
25691
25575
|
t2 = typeof o2;
|
|
25692
25576
|
if (t1 !== t2 || t1 !== "object") return false;
|
|
25693
25577
|
const tup = [o1, o2];
|
|
25694
|
-
if (
|
|
25695
|
-
if (
|
|
25696
|
-
if (
|
|
25697
|
-
if (
|
|
25578
|
+
if (tup.every(Array.isArray)) return _arraysEq(o1, o2);
|
|
25579
|
+
if (tup.every(isDate)) return o1.getTime() === o2.getTime();
|
|
25580
|
+
if (tup.every(isRegExp)) return o1.toString() === o2.toString();
|
|
25581
|
+
if (tup.every(isFunction)) return true; // meh
|
|
25698
25582
|
if ([isFunction, Array.isArray, isDate, isRegExp].some((fn) => !!fn(tup))) {
|
|
25699
25583
|
return false;
|
|
25700
25584
|
}
|
|
@@ -25815,11 +25699,6 @@
|
|
|
25815
25699
|
if (idx >= 0) array.splice(idx, 1);
|
|
25816
25700
|
return array;
|
|
25817
25701
|
}
|
|
25818
|
-
/** pushes a values to an array and returns the value */
|
|
25819
|
-
const pushTo = curry((arr, val) => {
|
|
25820
|
-
arr.push(val);
|
|
25821
|
-
return val;
|
|
25822
|
-
});
|
|
25823
25702
|
|
|
25824
25703
|
/**
|
|
25825
25704
|
* Applies a set of defaults to an options object. The options object is filtered
|
|
@@ -26141,7 +26020,6 @@
|
|
|
26141
26020
|
/**
|
|
26142
26021
|
* @param def A configuration object which contains the custom type definition. The object's
|
|
26143
26022
|
* properties will override the default methods and/or pattern in `ParamType`'s public interface.
|
|
26144
|
-
* @returns a new ParamType object
|
|
26145
26023
|
*/
|
|
26146
26024
|
constructor(def) {
|
|
26147
26025
|
this.pattern = /.*/;
|
|
@@ -26604,12 +26482,14 @@
|
|
|
26604
26482
|
|
|
26605
26483
|
/** @type {Array<(item: T) => void>} */
|
|
26606
26484
|
this._evictListeners = [];
|
|
26485
|
+
}
|
|
26607
26486
|
|
|
26608
|
-
|
|
26609
|
-
|
|
26610
|
-
|
|
26611
|
-
|
|
26612
|
-
|
|
26487
|
+
/**
|
|
26488
|
+
* Register a listener that will be called with the evicted item.
|
|
26489
|
+
* @param {(item: T) => void} listener
|
|
26490
|
+
*/
|
|
26491
|
+
onEvict(listener) {
|
|
26492
|
+
this._evictListeners.push(listener);
|
|
26613
26493
|
}
|
|
26614
26494
|
|
|
26615
26495
|
/**
|
|
@@ -26698,7 +26578,7 @@
|
|
|
26698
26578
|
* This is where we hold the global mutable state such as current state, current
|
|
26699
26579
|
* params, current transition, etc.
|
|
26700
26580
|
*/
|
|
26701
|
-
class
|
|
26581
|
+
class Router {
|
|
26702
26582
|
constructor() {
|
|
26703
26583
|
/**
|
|
26704
26584
|
* Current parameter values
|
|
@@ -27592,7 +27472,7 @@
|
|
|
27592
27472
|
const normalized = this.type.$normalize(value);
|
|
27593
27473
|
if (!this.type.is(normalized)) return false;
|
|
27594
27474
|
// The value was of the correct type, but when encoded, did not match the ParamType's regexp
|
|
27595
|
-
const encoded = this.type.encode(normalized);
|
|
27475
|
+
const encoded = normalized; // this.type.encode(normalized);
|
|
27596
27476
|
return !(isString(encoded) && !this.type.pattern.exec(encoded));
|
|
27597
27477
|
}
|
|
27598
27478
|
toString() {
|
|
@@ -27804,8 +27684,13 @@
|
|
|
27804
27684
|
// The param keys specified by the incoming toParams
|
|
27805
27685
|
return toPath.map(makeInheritedParamsNode);
|
|
27806
27686
|
}
|
|
27687
|
+
|
|
27807
27688
|
/**
|
|
27808
27689
|
* Computes the tree changes (entering, exiting) between a fromPath and toPath.
|
|
27690
|
+
* @param {PathNode[]} fromPath
|
|
27691
|
+
* @param {PathNode[]} toPath
|
|
27692
|
+
* @param {boolean} [reloadState]
|
|
27693
|
+
* @returns {import("../transition/interface.js").TreeChanges}
|
|
27809
27694
|
*/
|
|
27810
27695
|
static treeChanges(fromPath, toPath, reloadState) {
|
|
27811
27696
|
const max = Math.min(fromPath.length, toPath.length);
|
|
@@ -28171,7 +28056,7 @@
|
|
|
28171
28056
|
name = name || "$default";
|
|
28172
28057
|
// Account for views: { header: "headerComponent" }
|
|
28173
28058
|
if (isString(config)) config = { component: config };
|
|
28174
|
-
// Make a shallow copy of the
|
|
28059
|
+
// Make a shallow copy of the urlConfig object
|
|
28175
28060
|
config = Object.assign({}, config);
|
|
28176
28061
|
// Do not allow a view to mix props for component-style view with props for template/controller-style view
|
|
28177
28062
|
if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) {
|
|
@@ -28325,8 +28210,7 @@
|
|
|
28325
28210
|
this._listeners = [];
|
|
28326
28211
|
this._pluginapi = {
|
|
28327
28212
|
_registeredUIView: (id) => {
|
|
28328
|
-
|
|
28329
|
-
return res;
|
|
28213
|
+
return find(this._ngViews, (view) => view.id === id);
|
|
28330
28214
|
},
|
|
28331
28215
|
_registeredUIViews: () => this._ngViews,
|
|
28332
28216
|
_activeViewConfigs: () => this._viewConfigs,
|
|
@@ -28364,8 +28248,7 @@
|
|
|
28364
28248
|
throw new Error(
|
|
28365
28249
|
"ViewService: No view config factory registered for type " + decl.$type,
|
|
28366
28250
|
);
|
|
28367
|
-
|
|
28368
|
-
return cfgs;
|
|
28251
|
+
return cfgFactory(path, decl);
|
|
28369
28252
|
}
|
|
28370
28253
|
/**
|
|
28371
28254
|
* Deactivates a ViewConfig.
|
|
@@ -29672,15 +29555,15 @@
|
|
|
29672
29555
|
*
|
|
29673
29556
|
* If the target state is not valid, an error is thrown.
|
|
29674
29557
|
*
|
|
29675
|
-
* @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath`
|
|
29558
|
+
* @param {Array<import('../path/path-node.js').PathNode>} fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath`
|
|
29676
29559
|
* encapsulates the "from state".
|
|
29677
|
-
* @param targetState The target state and parameters being transitioned to (also, the transition options)
|
|
29560
|
+
* @param {import('../state/target-state.js').TargetState} targetState The target state and parameters being transitioned to (also, the transition options)
|
|
29678
29561
|
* @param {import('../transition/transition-service.js').TransitionProvider} transitionService The [[TransitionService]] instance
|
|
29679
|
-
* @param {import('../
|
|
29562
|
+
* @param {import('../router.js').Router} globals
|
|
29680
29563
|
*/
|
|
29681
29564
|
constructor(fromPath, targetState, transitionService, globals) {
|
|
29682
29565
|
/**
|
|
29683
|
-
* @type {import('../
|
|
29566
|
+
* @type {import('../router.js').Router}
|
|
29684
29567
|
*/
|
|
29685
29568
|
this.globals = globals;
|
|
29686
29569
|
this.transitionService = transitionService;
|
|
@@ -30218,8 +30101,8 @@
|
|
|
30218
30101
|
).length
|
|
30219
30102
|
);
|
|
30220
30103
|
};
|
|
30221
|
-
const newTC = this.
|
|
30222
|
-
const pendTC = pending && pending.
|
|
30104
|
+
const newTC = this._treeChanges;
|
|
30105
|
+
const pendTC = pending && pending._treeChanges;
|
|
30223
30106
|
if (
|
|
30224
30107
|
pendTC &&
|
|
30225
30108
|
same(pendTC.to, newTC.to) &&
|
|
@@ -30860,10 +30743,10 @@
|
|
|
30860
30743
|
* This API is located at `router.transitionService` ([[UIRouter.transitionService]])
|
|
30861
30744
|
*/
|
|
30862
30745
|
class TransitionProvider {
|
|
30863
|
-
static $inject = [
|
|
30746
|
+
/* @ignore */ static $inject = provider([$injectTokens.$router, $injectTokens.$view]);
|
|
30864
30747
|
|
|
30865
30748
|
/**
|
|
30866
|
-
* @param {import('../
|
|
30749
|
+
* @param {import('../router.js').Router} globals
|
|
30867
30750
|
* @param viewService
|
|
30868
30751
|
*/
|
|
30869
30752
|
constructor(globals, viewService) {
|
|
@@ -30891,10 +30774,10 @@
|
|
|
30891
30774
|
}
|
|
30892
30775
|
|
|
30893
30776
|
$get = [
|
|
30894
|
-
|
|
30895
|
-
|
|
30896
|
-
|
|
30897
|
-
|
|
30777
|
+
$injectTokens.$state,
|
|
30778
|
+
$injectTokens.$url,
|
|
30779
|
+
$injectTokens.$stateRegistry,
|
|
30780
|
+
$injectTokens.$view,
|
|
30898
30781
|
(stateService, urlService, stateRegistry, viewService) => {
|
|
30899
30782
|
// Lazy load state trees
|
|
30900
30783
|
this._deregisterHookFns.lazyLoad = registerLazyLoadHook(
|
|
@@ -31110,7 +30993,7 @@
|
|
|
31110
30993
|
/**
|
|
31111
30994
|
* The latest successful state parameters
|
|
31112
30995
|
*
|
|
31113
|
-
* @deprecated This is a passthrough through to [[
|
|
30996
|
+
* @deprecated This is a passthrough through to [[Router.params]]
|
|
31114
30997
|
*/
|
|
31115
30998
|
get params() {
|
|
31116
30999
|
return this.globals.params;
|
|
@@ -31118,7 +31001,7 @@
|
|
|
31118
31001
|
/**
|
|
31119
31002
|
* The current [[StateDeclaration]]
|
|
31120
31003
|
*
|
|
31121
|
-
* @deprecated This is a passthrough through to [[
|
|
31004
|
+
* @deprecated This is a passthrough through to [[Router.current]]
|
|
31122
31005
|
*/
|
|
31123
31006
|
get current() {
|
|
31124
31007
|
return this.globals.current;
|
|
@@ -31126,18 +31009,18 @@
|
|
|
31126
31009
|
/**
|
|
31127
31010
|
* The current [[StateObject]] (an internal API)
|
|
31128
31011
|
*
|
|
31129
|
-
* @deprecated This is a passthrough through to [[
|
|
31012
|
+
* @deprecated This is a passthrough through to [[Router.$current]]
|
|
31130
31013
|
*/
|
|
31131
31014
|
get $current() {
|
|
31132
31015
|
return this.globals.$current;
|
|
31133
31016
|
}
|
|
31134
31017
|
|
|
31135
|
-
static $inject = ["$
|
|
31018
|
+
/* @ignore */ static $inject = ["$routerProvider", "$transitionsProvider"];
|
|
31136
31019
|
|
|
31137
31020
|
// Needs access to urlService, stateRegistry
|
|
31138
31021
|
/**
|
|
31139
31022
|
*
|
|
31140
|
-
* @param {import('../
|
|
31023
|
+
* @param {import('../router.js').Router} globals
|
|
31141
31024
|
* @param {*} transitionService
|
|
31142
31025
|
*/
|
|
31143
31026
|
constructor(globals, transitionService) {
|
|
@@ -31211,9 +31094,9 @@
|
|
|
31211
31094
|
* - **params** `{object}` - returns an array of state params that are ensured to
|
|
31212
31095
|
* be a super-set of parent's params.
|
|
31213
31096
|
* - **views** `{object}` - returns a views object where each key is an absolute view
|
|
31214
|
-
* name (i.e. "viewName@stateName") and each value is the
|
|
31097
|
+
* name (i.e. "viewName@stateName") and each value is the urlConfig object
|
|
31215
31098
|
* (template, controller) for the view. Even when you don't use the views object
|
|
31216
|
-
* explicitly on a state
|
|
31099
|
+
* explicitly on a state urlConfig, one is still created for you internally.
|
|
31217
31100
|
* So by decorating this builder function you have access to decorating template
|
|
31218
31101
|
* and controller properties.
|
|
31219
31102
|
* - **ownParams** `{object}` - returns an array of params that belong to the state,
|
|
@@ -31231,10 +31114,10 @@
|
|
|
31231
31114
|
* let result = {},
|
|
31232
31115
|
* views = parent(state);
|
|
31233
31116
|
*
|
|
31234
|
-
* angular.forEach(views, function (
|
|
31117
|
+
* angular.forEach(views, function (urlConfig, name) {
|
|
31235
31118
|
* let autoName = (state.name + '.' + name).replace('.', '/');
|
|
31236
|
-
*
|
|
31237
|
-
* result[name] =
|
|
31119
|
+
* urlConfig.templateUrl = urlConfig.templateUrl || '/partials/' + autoName + '.html';
|
|
31120
|
+
* result[name] = urlConfig;
|
|
31238
31121
|
* });
|
|
31239
31122
|
* return result;
|
|
31240
31123
|
* });
|
|
@@ -31258,7 +31141,7 @@
|
|
|
31258
31141
|
* @param {object} func A function that is responsible for decorating the original
|
|
31259
31142
|
* builder function. The function receives two parameters:
|
|
31260
31143
|
*
|
|
31261
|
-
* - `{object}` - state - The state
|
|
31144
|
+
* - `{object}` - state - The state urlConfig object.
|
|
31262
31145
|
* - `{object}` - super - The original builder function.
|
|
31263
31146
|
*
|
|
31264
31147
|
* @return {object} $stateProvider - $stateProvider instance
|
|
@@ -31491,7 +31374,7 @@
|
|
|
31491
31374
|
const globals = this.globals;
|
|
31492
31375
|
const latestSuccess = globals.successfulTransitions.peekTail();
|
|
31493
31376
|
const rootPath = () => [new PathNode(this.stateRegistry.root())];
|
|
31494
|
-
return latestSuccess ? latestSuccess.
|
|
31377
|
+
return latestSuccess ? latestSuccess._treeChanges.to : rootPath();
|
|
31495
31378
|
}
|
|
31496
31379
|
/**
|
|
31497
31380
|
* Low-level method for transitioning to a new state.
|
|
@@ -31788,7 +31671,7 @@
|
|
|
31788
31671
|
}
|
|
31789
31672
|
|
|
31790
31673
|
$get = [
|
|
31791
|
-
|
|
31674
|
+
$injectTokens.$anchorScroll,
|
|
31792
31675
|
/**
|
|
31793
31676
|
* @param {import('../services/anchor-scroll.js').AnchorScrollObject} $anchorScroll
|
|
31794
31677
|
* @returns {import('../services/anchor-scroll.js').AnchorScrollObject|Function}
|
|
@@ -31826,10 +31709,10 @@
|
|
|
31826
31709
|
}
|
|
31827
31710
|
|
|
31828
31711
|
$get = [
|
|
31829
|
-
|
|
31830
|
-
|
|
31831
|
-
|
|
31832
|
-
|
|
31712
|
+
$injectTokens.$http,
|
|
31713
|
+
$injectTokens.$templateCache,
|
|
31714
|
+
$injectTokens.$templateRequest,
|
|
31715
|
+
$injectTokens.$injector,
|
|
31833
31716
|
/**
|
|
31834
31717
|
* @param {import("interface.ts").HttpService} $http
|
|
31835
31718
|
* @param {import("../services/template-cache/interface.ts").TemplateCache} $templateCache
|
|
@@ -32131,13 +32014,6 @@
|
|
|
32131
32014
|
*
|
|
32132
32015
|
*/
|
|
32133
32016
|
class UrlMatcher {
|
|
32134
|
-
static encodeDashes(str) {
|
|
32135
|
-
// Replace dashes with encoded "\-"
|
|
32136
|
-
return encodeURIComponent(str).replace(
|
|
32137
|
-
/-/g,
|
|
32138
|
-
(c) => `%5C%${c.charCodeAt(0).toString(16).toUpperCase()}`,
|
|
32139
|
-
);
|
|
32140
|
-
}
|
|
32141
32017
|
/** @internal Given a matcher, return an array with the matcher's path segments and path params, in order */
|
|
32142
32018
|
static pathSegmentsAndParams(matcher) {
|
|
32143
32019
|
const staticSegments = matcher._segments;
|
|
@@ -32348,9 +32224,6 @@
|
|
|
32348
32224
|
return this.pattern;
|
|
32349
32225
|
}
|
|
32350
32226
|
_getDecodedParamValue(value, param) {
|
|
32351
|
-
if (isDefined(value)) {
|
|
32352
|
-
value = param.type.decode(value);
|
|
32353
|
-
}
|
|
32354
32227
|
return param.value(value);
|
|
32355
32228
|
}
|
|
32356
32229
|
/**
|
|
@@ -32372,9 +32245,9 @@
|
|
|
32372
32245
|
* // returns { id: 'bob', q: 'hello', r: null }
|
|
32373
32246
|
* ```
|
|
32374
32247
|
*
|
|
32375
|
-
* @param path The URL path to match, e.g. `$location.
|
|
32376
|
-
* @param search URL search parameters, e.g. `$location.
|
|
32377
|
-
* @param hash URL hash e.g. `$location.
|
|
32248
|
+
* @param path The URL path to match, e.g. `$location.getPath()`.
|
|
32249
|
+
* @param search URL search parameters, e.g. `$location.getSearch()`.
|
|
32250
|
+
* @param hash URL hash e.g. `$location.getHash()`.
|
|
32378
32251
|
*
|
|
32379
32252
|
* @returns The captured parameter values.
|
|
32380
32253
|
*/
|
|
@@ -32541,7 +32414,7 @@
|
|
|
32541
32414
|
if (encoded == null) return acc;
|
|
32542
32415
|
// If this parameter value is an array, encode the value using encodeDashes
|
|
32543
32416
|
if (Array.isArray(encoded))
|
|
32544
|
-
return acc + map(encoded,
|
|
32417
|
+
return acc + map(encoded, encodeDashes).join("-");
|
|
32545
32418
|
// If the parameter type is "raw", then do not encodeURIComponent
|
|
32546
32419
|
if (param.raw) return acc + encoded;
|
|
32547
32420
|
// Encode the value
|
|
@@ -32571,6 +32444,14 @@
|
|
|
32571
32444
|
|
|
32572
32445
|
UrlMatcher.nameValidator = /^\w+([-.]+\w+)*(?:\[\])?$/;
|
|
32573
32446
|
|
|
32447
|
+
function encodeDashes(str) {
|
|
32448
|
+
// Replace dashes with encoded "\-"
|
|
32449
|
+
return encodeURIComponent(str).replace(
|
|
32450
|
+
/-/g,
|
|
32451
|
+
(c) => `%5C%${c.charCodeAt(0).toString(16).toUpperCase()}`,
|
|
32452
|
+
);
|
|
32453
|
+
}
|
|
32454
|
+
|
|
32574
32455
|
/** @typedef {import('./interface.js').StateDeclaration} StateDeclaration */
|
|
32575
32456
|
|
|
32576
32457
|
/**
|
|
@@ -32696,6 +32577,11 @@
|
|
|
32696
32577
|
* - [[StateObject]]
|
|
32697
32578
|
*/
|
|
32698
32579
|
class UrlRuleFactory {
|
|
32580
|
+
/**
|
|
32581
|
+
* @param {import('../url/url-service.js').UrlService} urlService
|
|
32582
|
+
* @param {import('../state/state-service.js').StateProvider} stateService
|
|
32583
|
+
* @param {import('../router.js').Router} routerGlobals
|
|
32584
|
+
*/
|
|
32699
32585
|
constructor(urlService, stateService, routerGlobals) {
|
|
32700
32586
|
this.urlService = urlService;
|
|
32701
32587
|
this.stateService = stateService;
|
|
@@ -32714,7 +32600,7 @@
|
|
|
32714
32600
|
[isString, (_what) => makeRule(this.urlService.compile(_what))],
|
|
32715
32601
|
[is(UrlMatcher), (_what) => this.fromUrlMatcher(_what, handler)],
|
|
32716
32602
|
[
|
|
32717
|
-
|
|
32603
|
+
(...args) => isState(...args) || isStateDeclaration(...args),
|
|
32718
32604
|
(_what) => this.fromState(_what, this.stateService, this.routerGlobals),
|
|
32719
32605
|
],
|
|
32720
32606
|
[is(RegExp), (_what) => this.fromRegExp(_what, handler)],
|
|
@@ -32888,6 +32774,7 @@
|
|
|
32888
32774
|
this.$id = -1;
|
|
32889
32775
|
this._group = undefined;
|
|
32890
32776
|
this.handler = handler || ((x) => x);
|
|
32777
|
+
this.priority = undefined;
|
|
32891
32778
|
}
|
|
32892
32779
|
|
|
32893
32780
|
/**
|
|
@@ -32901,7 +32788,9 @@
|
|
|
32901
32788
|
}
|
|
32902
32789
|
}
|
|
32903
32790
|
|
|
32904
|
-
|
|
32791
|
+
function prioritySort(a, b) {
|
|
32792
|
+
return (b.priority || 0) - (a.priority || 0);
|
|
32793
|
+
}
|
|
32905
32794
|
|
|
32906
32795
|
const typeSort = (a, b) => {
|
|
32907
32796
|
const weights = { STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1 };
|
|
@@ -32932,8 +32821,7 @@
|
|
|
32932
32821
|
* - Equally sorted State and UrlMatcher rules will each match the URL.
|
|
32933
32822
|
* Then, the *best* match is chosen based on how many parameter values were matched.
|
|
32934
32823
|
*/
|
|
32935
|
-
|
|
32936
|
-
defaultRuleSortFn = (a, b) => {
|
|
32824
|
+
function defaultRuleSortFn(a, b) {
|
|
32937
32825
|
let cmp = prioritySort(a, b);
|
|
32938
32826
|
if (cmp !== 0) return cmp;
|
|
32939
32827
|
cmp = typeSort(a, b);
|
|
@@ -32941,7 +32829,8 @@
|
|
|
32941
32829
|
cmp = urlMatcherSort(a, b);
|
|
32942
32830
|
if (cmp !== 0) return cmp;
|
|
32943
32831
|
return idSort(a, b);
|
|
32944
|
-
}
|
|
32832
|
+
}
|
|
32833
|
+
|
|
32945
32834
|
function getHandlerFn(handler) {
|
|
32946
32835
|
if (
|
|
32947
32836
|
!isFunction(handler) &&
|
|
@@ -32963,9 +32852,10 @@
|
|
|
32963
32852
|
*
|
|
32964
32853
|
* The most commonly used methods are [[otherwise]] and [[when]].
|
|
32965
32854
|
*
|
|
32966
|
-
* This API is found at `$
|
|
32855
|
+
* This API is found at `$url.rules` (see: [[UIRouter.urlService]], [[URLService.rules]])
|
|
32967
32856
|
*/
|
|
32968
32857
|
class UrlRules {
|
|
32858
|
+
/** @param {UrlRuleFactory} urlRuleFactory */
|
|
32969
32859
|
constructor(urlRuleFactory) {
|
|
32970
32860
|
this._sortFn = defaultRuleSortFn;
|
|
32971
32861
|
this._rules = [];
|
|
@@ -33268,39 +33158,37 @@
|
|
|
33268
33158
|
* API for URL management
|
|
33269
33159
|
*/
|
|
33270
33160
|
class UrlService {
|
|
33271
|
-
static $inject = [
|
|
33272
|
-
|
|
33273
|
-
|
|
33274
|
-
|
|
33275
|
-
|
|
33276
|
-
];
|
|
33161
|
+
static $inject = provider([
|
|
33162
|
+
$injectTokens.$location,
|
|
33163
|
+
$injectTokens.$state,
|
|
33164
|
+
$injectTokens.$router,
|
|
33165
|
+
$injectTokens.$urlConfig,
|
|
33166
|
+
]);
|
|
33167
|
+
|
|
33168
|
+
/** @type {import("../../services/location/location").Location} */
|
|
33169
|
+
$location;
|
|
33277
33170
|
|
|
33278
33171
|
/**
|
|
33279
33172
|
* @param {import("../../services/location/location").LocationProvider} $locationProvider
|
|
33280
33173
|
* @param {import("../../router/state/state-service.js").StateProvider} stateService
|
|
33281
|
-
* @param globals
|
|
33174
|
+
* @param {import("../router.js").Router} globals
|
|
33282
33175
|
* @param {import("../../router/url/url-config.js").UrlConfigProvider} urlConfigProvider
|
|
33283
33176
|
*/
|
|
33284
33177
|
constructor($locationProvider, stateService, globals, urlConfigProvider) {
|
|
33178
|
+
this.$locationProvider = $locationProvider;
|
|
33285
33179
|
this.stateService = stateService;
|
|
33286
33180
|
this.stateService.urlService = this; // circular wiring
|
|
33287
|
-
this.$locationProvider = $locationProvider;
|
|
33288
|
-
this.$location = undefined;
|
|
33289
33181
|
|
|
33290
33182
|
/** Provides services related to the URL */
|
|
33291
33183
|
this.urlRuleFactory = new UrlRuleFactory(this, this.stateService, globals);
|
|
33292
33184
|
|
|
33293
33185
|
/**
|
|
33294
33186
|
* The nested [[UrlRules]] API for managing URL rules and rewrites
|
|
33295
|
-
*
|
|
33296
|
-
* See: [[UrlRules]] for details
|
|
33297
33187
|
* @type {UrlRules}
|
|
33298
33188
|
*/
|
|
33299
33189
|
this.rules = new UrlRules(this.urlRuleFactory);
|
|
33300
33190
|
/**
|
|
33301
33191
|
* The nested [[UrlConfig]] API to configure the URL and retrieve URL information
|
|
33302
|
-
*
|
|
33303
|
-
* See: [[UrlConfig]] for details
|
|
33304
33192
|
* @type {import("./url-config.js").UrlConfigProvider}
|
|
33305
33193
|
*/
|
|
33306
33194
|
this.config = urlConfigProvider;
|
|
@@ -33308,37 +33196,44 @@
|
|
|
33308
33196
|
/** Creates a new [[Param]] for a given location (DefType) */
|
|
33309
33197
|
this.paramFactory = new ParamFactory(this.config);
|
|
33310
33198
|
|
|
33311
|
-
/**
|
|
33312
|
-
* Gets the path part of the current url
|
|
33313
|
-
*
|
|
33314
|
-
* If the current URL is `/some/path?query=value#anchor`, this returns `/some/path`
|
|
33315
|
-
*
|
|
33316
|
-
* @return the path portion of the url
|
|
33317
|
-
*/
|
|
33318
|
-
this.path = () => this.$location.path();
|
|
33319
|
-
/**
|
|
33320
|
-
* Gets the search part of the current url as an object
|
|
33321
|
-
*
|
|
33322
|
-
* If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }`
|
|
33323
|
-
*
|
|
33324
|
-
* @return the search (query) portion of the url, as an object
|
|
33325
|
-
*/
|
|
33326
|
-
this.search = () => this.$location.search();
|
|
33327
|
-
/**
|
|
33328
|
-
* Gets the hash part of the current url
|
|
33329
|
-
*
|
|
33330
|
-
* If the current URL is `/some/path?query=value#anchor`, this returns `anchor`
|
|
33331
|
-
*
|
|
33332
|
-
* @return the hash (anchor) portion of the url
|
|
33333
|
-
*/
|
|
33334
|
-
this.hash = () => this.$location.hash();
|
|
33335
|
-
|
|
33336
33199
|
this._urlListeners = [];
|
|
33337
33200
|
}
|
|
33338
33201
|
|
|
33202
|
+
/**
|
|
33203
|
+
* Gets the path part of the current url
|
|
33204
|
+
*
|
|
33205
|
+
* If the current URL is `/some/path?query=value#anchor`, this returns `/some/path`
|
|
33206
|
+
*
|
|
33207
|
+
* @return {string} the path portion of the url
|
|
33208
|
+
*/
|
|
33209
|
+
getPath() {
|
|
33210
|
+
return this.$location.getPath();
|
|
33211
|
+
}
|
|
33212
|
+
|
|
33213
|
+
/**
|
|
33214
|
+
* Gets the search part of the current url as an object
|
|
33215
|
+
*
|
|
33216
|
+
* If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }`
|
|
33217
|
+
*
|
|
33218
|
+
* @return {Object} the search (query) portion of the url, as an object
|
|
33219
|
+
*/
|
|
33220
|
+
getSearch() {
|
|
33221
|
+
return this.$location.getSearch();
|
|
33222
|
+
}
|
|
33223
|
+
/**
|
|
33224
|
+
* Gets the hash part of the current url
|
|
33225
|
+
*
|
|
33226
|
+
* If the current URL is `/some/path?query=value#anchor`, this returns `anchor`
|
|
33227
|
+
*
|
|
33228
|
+
* @return {string} the hash (anchor) portion of the url
|
|
33229
|
+
*/
|
|
33230
|
+
getHash() {
|
|
33231
|
+
return this.$location.getHash();
|
|
33232
|
+
}
|
|
33233
|
+
|
|
33339
33234
|
$get = [
|
|
33340
|
-
|
|
33341
|
-
|
|
33235
|
+
$injectTokens.$location,
|
|
33236
|
+
$injectTokens.$rootScope,
|
|
33342
33237
|
/**
|
|
33343
33238
|
*
|
|
33344
33239
|
* @param {import('../../services/location/location.js').Location} $location
|
|
@@ -33352,21 +33247,14 @@
|
|
|
33352
33247
|
fn(evt);
|
|
33353
33248
|
});
|
|
33354
33249
|
});
|
|
33355
|
-
this.listen();
|
|
33250
|
+
this.listen(true);
|
|
33356
33251
|
return this;
|
|
33357
33252
|
},
|
|
33358
33253
|
];
|
|
33359
33254
|
|
|
33360
33255
|
/**
|
|
33361
|
-
* @returns {
|
|
33256
|
+
* @returns {string}
|
|
33362
33257
|
*/
|
|
33363
|
-
html5Mode() {
|
|
33364
|
-
return (
|
|
33365
|
-
this.$locationProvider.getHtml5Mode().enabled &&
|
|
33366
|
-
typeof history !== "undefined"
|
|
33367
|
-
);
|
|
33368
|
-
}
|
|
33369
|
-
|
|
33370
33258
|
baseHref() {
|
|
33371
33259
|
return (
|
|
33372
33260
|
this._baseHref ||
|
|
@@ -33421,20 +33309,21 @@
|
|
|
33421
33309
|
* @param {string} [newUrl] The new value for the URL.
|
|
33422
33310
|
* This url should reflect only the new internal [[path]], [[search]], and [[hash]] values.
|
|
33423
33311
|
* It should not include the protocol, site, port, or base path of an absolute HREF.
|
|
33424
|
-
* @param {boolean} [replace] When true, replaces the current history entry (instead of appending it) with this new url
|
|
33425
33312
|
* @param {any} [state] The history's state object, i.e., pushState (if the LocationServices implementation supports it)
|
|
33426
33313
|
*
|
|
33427
33314
|
* @return the url (after potentially being processed)
|
|
33428
33315
|
*/
|
|
33429
|
-
url(newUrl,
|
|
33430
|
-
if (isDefined(newUrl))
|
|
33431
|
-
|
|
33432
|
-
|
|
33433
|
-
|
|
33316
|
+
url(newUrl, state) {
|
|
33317
|
+
if (isDefined(newUrl)) {
|
|
33318
|
+
const decodeUri = decodeURIComponent(newUrl);
|
|
33319
|
+
this.$location.setUrl(decodeUri);
|
|
33320
|
+
}
|
|
33321
|
+
if (state) this.$location.setState(state);
|
|
33322
|
+
return this.$location.getUrl();
|
|
33434
33323
|
}
|
|
33435
33324
|
|
|
33436
33325
|
/**
|
|
33437
|
-
* @
|
|
33326
|
+
* @private
|
|
33438
33327
|
*
|
|
33439
33328
|
* Registers a low level url change handler
|
|
33440
33329
|
*
|
|
@@ -33445,8 +33334,8 @@
|
|
|
33445
33334
|
* let deregisterFn = locationServices.onChange((evt) => console.log("url change", evt));
|
|
33446
33335
|
* ```
|
|
33447
33336
|
*
|
|
33448
|
-
* @param callback a function that will be called when the url is changing
|
|
33449
|
-
* @return a function that de-registers the callback
|
|
33337
|
+
* @param {Function} callback a function that will be called when the url is changing
|
|
33338
|
+
* @return {Function} a function that de-registers the callback
|
|
33450
33339
|
*/
|
|
33451
33340
|
onChange(callback) {
|
|
33452
33341
|
this._urlListeners.push(callback);
|
|
@@ -33454,13 +33343,21 @@
|
|
|
33454
33343
|
}
|
|
33455
33344
|
|
|
33456
33345
|
/**
|
|
33457
|
-
* Gets the current URL parts
|
|
33346
|
+
* Gets the current URL parts.
|
|
33347
|
+
*
|
|
33348
|
+
* Returns an object with the `path`, `search`, and `hash` components
|
|
33349
|
+
* of the current browser location.
|
|
33458
33350
|
*
|
|
33459
|
-
*
|
|
33351
|
+
* @returns {import("../../services/location/interface.ts").UrlParts} The current URL's path, search, and hash.
|
|
33460
33352
|
*/
|
|
33461
33353
|
parts() {
|
|
33462
|
-
return {
|
|
33354
|
+
return {
|
|
33355
|
+
path: this.$location.getPath(),
|
|
33356
|
+
search: this.$location.getSearch(),
|
|
33357
|
+
hash: this.$location.getHash(),
|
|
33358
|
+
};
|
|
33463
33359
|
}
|
|
33360
|
+
|
|
33464
33361
|
/**
|
|
33465
33362
|
* Activates the best rule for the current URL
|
|
33466
33363
|
*
|
|
@@ -33484,16 +33381,16 @@
|
|
|
33484
33381
|
if (evt && evt.defaultPrevented) return;
|
|
33485
33382
|
const stateService = this.stateService;
|
|
33486
33383
|
const url = {
|
|
33487
|
-
path: this.
|
|
33488
|
-
search: this.
|
|
33489
|
-
hash: this.
|
|
33384
|
+
path: this.$location.getPath(),
|
|
33385
|
+
search: this.$location.getSearch(),
|
|
33386
|
+
hash: this.$location.getHash(),
|
|
33490
33387
|
};
|
|
33491
33388
|
/**
|
|
33492
33389
|
* @type {*}
|
|
33493
33390
|
*/
|
|
33494
33391
|
const best = this.match(url);
|
|
33495
33392
|
const applyResult = pattern([
|
|
33496
|
-
[isString, (newurl) => this.url(newurl
|
|
33393
|
+
[isString, (newurl) => this.url(newurl)],
|
|
33497
33394
|
[
|
|
33498
33395
|
TargetState.isDef,
|
|
33499
33396
|
(def) => stateService.go(def.state, def.params, def.options),
|
|
@@ -33526,7 +33423,7 @@
|
|
|
33526
33423
|
* });
|
|
33527
33424
|
* ```
|
|
33528
33425
|
*
|
|
33529
|
-
* @param enabled `true` or `false` to start or stop listening to URL changes
|
|
33426
|
+
* @param {boolean} enabled `true` or `false` to start or stop listening to URL changes
|
|
33530
33427
|
*/
|
|
33531
33428
|
listen(enabled) {
|
|
33532
33429
|
if (enabled === false) {
|
|
@@ -33604,7 +33501,7 @@
|
|
|
33604
33501
|
* ```js
|
|
33605
33502
|
* matcher = $umf.compile("/about/:person");
|
|
33606
33503
|
* params = { person: "bob" };
|
|
33607
|
-
* $bob = $
|
|
33504
|
+
* $bob = $url.href(matcher, params);
|
|
33608
33505
|
* // $bob == "/about/bob";
|
|
33609
33506
|
* ```
|
|
33610
33507
|
*
|
|
@@ -33620,22 +33517,18 @@
|
|
|
33620
33517
|
let url = urlMatcher.format(params);
|
|
33621
33518
|
if (url == null) return null;
|
|
33622
33519
|
options = options || { absolute: false };
|
|
33623
|
-
const isHtml5 = this.
|
|
33624
|
-
if (!isHtml5
|
|
33625
|
-
url = "#" + this.$locationProvider.
|
|
33520
|
+
const isHtml5 = this.$locationProvider.html5ModeConf.enabled;
|
|
33521
|
+
if (!isHtml5) {
|
|
33522
|
+
url = "#" + this.$locationProvider.hashPrefixConf + url;
|
|
33626
33523
|
}
|
|
33627
33524
|
url = appendBasePath(url, isHtml5, options.absolute, this.baseHref());
|
|
33628
33525
|
if (!options.absolute || !url) {
|
|
33629
33526
|
return url;
|
|
33630
33527
|
}
|
|
33631
33528
|
const slash = !isHtml5 && url ? "/" : "";
|
|
33632
|
-
const cfgPort = this.$location.port();
|
|
33633
|
-
const port = cfgPort === 80 || cfgPort === 443 ? "" : ":" + cfgPort;
|
|
33634
33529
|
return [
|
|
33635
|
-
|
|
33636
|
-
|
|
33637
|
-
this.$location.host(),
|
|
33638
|
-
port,
|
|
33530
|
+
`${window.location.protocol}//`,
|
|
33531
|
+
window.location.host,
|
|
33639
33532
|
slash,
|
|
33640
33533
|
url,
|
|
33641
33534
|
].join("");
|
|
@@ -33773,7 +33666,7 @@
|
|
|
33773
33666
|
return state.data;
|
|
33774
33667
|
}
|
|
33775
33668
|
|
|
33776
|
-
function getUrlBuilder($
|
|
33669
|
+
function getUrlBuilder($url, root) {
|
|
33777
33670
|
return function (stateObject) {
|
|
33778
33671
|
let stateDec = stateObject.self;
|
|
33779
33672
|
// For future states, i.e., states whose name ends with `.**`,
|
|
@@ -33793,9 +33686,9 @@
|
|
|
33793
33686
|
const parsed = parseUrl(stateDec.url);
|
|
33794
33687
|
const url = !parsed
|
|
33795
33688
|
? stateDec.url
|
|
33796
|
-
: $
|
|
33689
|
+
: $url.compile(parsed.val, { state: stateDec });
|
|
33797
33690
|
if (!url) return null;
|
|
33798
|
-
if (!$
|
|
33691
|
+
if (!$url.isMatcher(url))
|
|
33799
33692
|
throw new Error(`Invalid url '${url}' in state '${stateObject}'`);
|
|
33800
33693
|
return parsed && parsed.root
|
|
33801
33694
|
? url
|
|
@@ -34219,17 +34112,17 @@
|
|
|
34219
34112
|
*
|
|
34220
34113
|
*/
|
|
34221
34114
|
class StateRegistryProvider {
|
|
34222
|
-
static $inject = provider([
|
|
34223
|
-
$injectTokens.$
|
|
34115
|
+
/* @ignore */ static $inject = provider([
|
|
34116
|
+
$injectTokens.$url,
|
|
34224
34117
|
$injectTokens.$state,
|
|
34225
|
-
$injectTokens.$
|
|
34118
|
+
$injectTokens.$router,
|
|
34226
34119
|
$injectTokens.$view,
|
|
34227
34120
|
]);
|
|
34228
34121
|
|
|
34229
34122
|
/**
|
|
34230
34123
|
* @param urlService
|
|
34231
34124
|
* @param stateService
|
|
34232
|
-
* @param {import('../
|
|
34125
|
+
* @param {import('../router.js').Router} globals
|
|
34233
34126
|
* @param viewService
|
|
34234
34127
|
*/
|
|
34235
34128
|
constructor(urlService, stateService, globals, viewService) {
|
|
@@ -34708,7 +34601,7 @@
|
|
|
34708
34601
|
|
|
34709
34602
|
$StateRefActiveDirective.$inject = [
|
|
34710
34603
|
"$state",
|
|
34711
|
-
"$
|
|
34604
|
+
"$router",
|
|
34712
34605
|
"$interpolate",
|
|
34713
34606
|
"$stateRegistry",
|
|
34714
34607
|
"$transitions",
|
|
@@ -34716,7 +34609,7 @@
|
|
|
34716
34609
|
|
|
34717
34610
|
/**
|
|
34718
34611
|
* @param {*} $state
|
|
34719
|
-
* @param {import('../
|
|
34612
|
+
* @param {import('../router.js').Router} $router
|
|
34720
34613
|
* @param {*} $interpolate
|
|
34721
34614
|
* @param {*} $stateRegistry
|
|
34722
34615
|
* @param {*} $transitions
|
|
@@ -34724,7 +34617,7 @@
|
|
|
34724
34617
|
*/
|
|
34725
34618
|
function $StateRefActiveDirective(
|
|
34726
34619
|
$state,
|
|
34727
|
-
$
|
|
34620
|
+
$router,
|
|
34728
34621
|
$interpolate,
|
|
34729
34622
|
$stateRegistry,
|
|
34730
34623
|
$transitions,
|
|
@@ -34763,8 +34656,8 @@
|
|
|
34763
34656
|
trans.promise.then(update, () => {});
|
|
34764
34657
|
}
|
|
34765
34658
|
$scope.$on("$destroy", setupEventListeners());
|
|
34766
|
-
if ($
|
|
34767
|
-
updateAfterTransition($
|
|
34659
|
+
if ($router.transition) {
|
|
34660
|
+
updateAfterTransition($router.transition);
|
|
34768
34661
|
}
|
|
34769
34662
|
function setupEventListeners() {
|
|
34770
34663
|
const deregisterStatesChangedListener =
|
|
@@ -34866,7 +34759,7 @@
|
|
|
34866
34759
|
* The ng-view can be targeted in a View using the name ([[StateDeclaration.views]]).
|
|
34867
34760
|
*
|
|
34868
34761
|
* - `autoscroll`: an expression. When it evaluates to true, the `ng-view` will be scrolled into view when it is activated.
|
|
34869
|
-
* Uses [[$
|
|
34762
|
+
* Uses [[$viewScroll]] to do the scrolling.
|
|
34870
34763
|
*
|
|
34871
34764
|
* - `onload`: Expression to evaluate whenever the view updates.
|
|
34872
34765
|
*
|
|
@@ -34985,16 +34878,16 @@
|
|
|
34985
34878
|
let ngView = [
|
|
34986
34879
|
"$view",
|
|
34987
34880
|
"$animate",
|
|
34988
|
-
"$
|
|
34881
|
+
"$viewScroll",
|
|
34989
34882
|
"$interpolate",
|
|
34990
34883
|
/**
|
|
34991
34884
|
* @param {*} $view
|
|
34992
34885
|
* @param {*} $animate
|
|
34993
|
-
* @param {*} $
|
|
34886
|
+
* @param {*} $viewScroll
|
|
34994
34887
|
* @param {*} $interpolate
|
|
34995
34888
|
* @returns {import("../../interface.js").Directive}
|
|
34996
34889
|
*/
|
|
34997
|
-
function $ViewDirective($view, $animate, $
|
|
34890
|
+
function $ViewDirective($view, $animate, $viewScroll, $interpolate) {
|
|
34998
34891
|
function getRenderer() {
|
|
34999
34892
|
return {
|
|
35000
34893
|
enter: function (element, target, cb) {
|
|
@@ -35120,7 +35013,7 @@
|
|
|
35120
35013
|
* @param {string} viewName Name of the view.
|
|
35121
35014
|
*/
|
|
35122
35015
|
newScope.$emit("$viewContentLoading", name);
|
|
35123
|
-
|
|
35016
|
+
currentEl = $transclude(newScope, function (clone) {
|
|
35124
35017
|
setCacheData(clone, "$ngViewAnim", $ngViewAnim);
|
|
35125
35018
|
setCacheData(clone, "$ngView", $ngViewData);
|
|
35126
35019
|
renderer.enter(clone, $element, function () {
|
|
@@ -35131,12 +35024,11 @@
|
|
|
35131
35024
|
(isDefined(autoScrollExp) && !autoScrollExp) ||
|
|
35132
35025
|
scope.$eval(autoScrollExp)
|
|
35133
35026
|
) {
|
|
35134
|
-
$
|
|
35027
|
+
$viewScroll(clone);
|
|
35135
35028
|
}
|
|
35136
35029
|
});
|
|
35137
35030
|
cleanupLastView();
|
|
35138
35031
|
});
|
|
35139
|
-
currentEl = cloned;
|
|
35140
35032
|
currentScope = newScope;
|
|
35141
35033
|
/**
|
|
35142
35034
|
* Fired once the view is **loaded**, *after* the DOM is rendered.
|
|
@@ -35619,7 +35511,6 @@
|
|
|
35619
35511
|
|
|
35620
35512
|
return {
|
|
35621
35513
|
restrict: "A",
|
|
35622
|
-
terminal: true,
|
|
35623
35514
|
link(scope, element, attrs) {
|
|
35624
35515
|
const eventName =
|
|
35625
35516
|
attrs["trigger"] ||
|
|
@@ -35731,8 +35622,17 @@
|
|
|
35731
35622
|
}
|
|
35732
35623
|
|
|
35733
35624
|
if (method === "post" || method === "put") {
|
|
35734
|
-
|
|
35735
|
-
|
|
35625
|
+
let data;
|
|
35626
|
+
const config = {};
|
|
35627
|
+
if (attrs["enctype"]) {
|
|
35628
|
+
config.headers = {
|
|
35629
|
+
"Content-Type": attrs["enctype"],
|
|
35630
|
+
};
|
|
35631
|
+
data = toKeyValue(collectFormData(element));
|
|
35632
|
+
} else {
|
|
35633
|
+
data = collectFormData(element);
|
|
35634
|
+
}
|
|
35635
|
+
$http[method](url, data, config).then(handler).catch(handler);
|
|
35736
35636
|
} else {
|
|
35737
35637
|
$http[method](url).then(handler).catch(handler);
|
|
35738
35638
|
}
|
|
@@ -35746,7 +35646,7 @@
|
|
|
35746
35646
|
|
|
35747
35647
|
/**
|
|
35748
35648
|
* Initializes core `ng` module.
|
|
35749
|
-
* @param {import('./
|
|
35649
|
+
* @param {import('./angular.js').Angular} angular
|
|
35750
35650
|
* @returns {import('./core/di/ng-module.js').NgModule} `ng` module
|
|
35751
35651
|
*/
|
|
35752
35652
|
function registerNgModule(angular) {
|
|
@@ -35755,7 +35655,7 @@
|
|
|
35755
35655
|
"ng",
|
|
35756
35656
|
[],
|
|
35757
35657
|
[
|
|
35758
|
-
|
|
35658
|
+
$injectTokens.$provide,
|
|
35759
35659
|
/** @param {import("./interface.js").Provider} $provide */
|
|
35760
35660
|
($provide) => {
|
|
35761
35661
|
// $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.
|
|
@@ -35763,7 +35663,7 @@
|
|
|
35763
35663
|
$$sanitizeUri: SanitizeUriProvider,
|
|
35764
35664
|
});
|
|
35765
35665
|
$provide
|
|
35766
|
-
.provider(
|
|
35666
|
+
.provider($injectTokens.$compile, CompileProvider)
|
|
35767
35667
|
.directive({
|
|
35768
35668
|
input: inputDirective,
|
|
35769
35669
|
textarea: inputDirective,
|
|
@@ -35869,7 +35769,7 @@
|
|
|
35869
35769
|
$parse: ParseProvider,
|
|
35870
35770
|
$$rAFScheduler: RafSchedulerProvider,
|
|
35871
35771
|
$rootScope: RootScopeProvider,
|
|
35872
|
-
$
|
|
35772
|
+
$router: Router,
|
|
35873
35773
|
$sce: SceProvider,
|
|
35874
35774
|
$sceDelegate: SceDelegateProvider,
|
|
35875
35775
|
$templateCache: TemplateCacheProvider,
|
|
@@ -35878,9 +35778,9 @@
|
|
|
35878
35778
|
$view: ViewService,
|
|
35879
35779
|
$transitions: TransitionProvider,
|
|
35880
35780
|
$state: StateProvider,
|
|
35881
|
-
$
|
|
35781
|
+
$viewScroll: ViewScrollProvider,
|
|
35882
35782
|
$templateFactory: TemplateFactoryProvider,
|
|
35883
|
-
$
|
|
35783
|
+
$url: UrlService,
|
|
35884
35784
|
$stateRegistry: StateRegistryProvider,
|
|
35885
35785
|
$eventBus: PubSubProvider,
|
|
35886
35786
|
});
|
|
@@ -35888,14 +35788,12 @@
|
|
|
35888
35788
|
],
|
|
35889
35789
|
)
|
|
35890
35790
|
.factory("$stateParams", [
|
|
35891
|
-
|
|
35791
|
+
$injectTokens.$router,
|
|
35892
35792
|
/**
|
|
35893
|
-
* @param {import('./router/
|
|
35793
|
+
* @param {import('./router/router.js').Router} globals
|
|
35894
35794
|
* @returns {import('./router/params/state-params.js').StateParams }
|
|
35895
35795
|
*/
|
|
35896
|
-
|
|
35897
|
-
return globals.params;
|
|
35898
|
-
},
|
|
35796
|
+
(globals) => globals.params,
|
|
35899
35797
|
])
|
|
35900
35798
|
.value("$trace", trace);
|
|
35901
35799
|
}
|
|
@@ -35923,7 +35821,7 @@
|
|
|
35923
35821
|
/**
|
|
35924
35822
|
* @type {string} `version` from `package.json`
|
|
35925
35823
|
*/
|
|
35926
|
-
this.version = "0.
|
|
35824
|
+
this.version = "0.8.1"; //inserted via rollup plugin
|
|
35927
35825
|
|
|
35928
35826
|
/** @type {!Array<string|any>} */
|
|
35929
35827
|
this.bootsrappedModules = [];
|
|
@@ -35932,9 +35830,9 @@
|
|
|
35932
35830
|
this.getInjector = getInjector;
|
|
35933
35831
|
this.getScope = getScope;
|
|
35934
35832
|
this.errorHandlingConfig = errorHandlingConfig;
|
|
35833
|
+
this.$t = $injectTokens;
|
|
35935
35834
|
|
|
35936
35835
|
window["angular"] = this;
|
|
35937
|
-
this.$injectTokens = $injectTokens;
|
|
35938
35836
|
registerNgModule(this);
|
|
35939
35837
|
}
|
|
35940
35838
|
|
|
@@ -36011,14 +35909,14 @@
|
|
|
36011
35909
|
|
|
36012
35910
|
const injector = createInjector(this.bootsrappedModules, config.strictDi);
|
|
36013
35911
|
injector.invoke([
|
|
36014
|
-
|
|
36015
|
-
|
|
36016
|
-
|
|
36017
|
-
|
|
35912
|
+
$injectTokens.$rootScope,
|
|
35913
|
+
$injectTokens.$rootElement,
|
|
35914
|
+
$injectTokens.$compile,
|
|
35915
|
+
$injectTokens.$injector,
|
|
36018
35916
|
/**
|
|
36019
35917
|
* @param {import('./core/scope/scope.js').Scope} scope
|
|
36020
35918
|
* @param {Element} el
|
|
36021
|
-
* @param {
|
|
35919
|
+
* @param {import("./core/compile/compile.js").CompileFn} compile
|
|
36022
35920
|
* @param {import("./core/di/internal-injector.js").InjectorService} $injector
|
|
36023
35921
|
*/
|
|
36024
35922
|
(scope, el, compile, $injector) => {
|
|
@@ -36041,7 +35939,7 @@
|
|
|
36041
35939
|
}
|
|
36042
35940
|
|
|
36043
35941
|
$injector
|
|
36044
|
-
.get(
|
|
35942
|
+
.get($injectTokens.$stateRegistry)
|
|
36045
35943
|
.get()
|
|
36046
35944
|
.map((x) => x.$$state().resolvables)
|
|
36047
35945
|
.reduce(unnestR, [])
|
|
@@ -36146,7 +36044,7 @@
|
|
|
36146
36044
|
* @param {string} name The name of the module to create or retrieve.
|
|
36147
36045
|
* @param {Array.<string>} [requires] If specified then new module is being created. If
|
|
36148
36046
|
* unspecified then the module is being retrieved for further configuration.
|
|
36149
|
-
* @param {
|
|
36047
|
+
* @param {import("./interface.js").Injectable} [configFn] Optional configuration function for the module that gets
|
|
36150
36048
|
* passed to {@link NgModule.config NgModule.config()}.
|
|
36151
36049
|
* @returns {NgModule} A newly registered module.
|
|
36152
36050
|
*/
|
|
@@ -36163,7 +36061,7 @@
|
|
|
36163
36061
|
name,
|
|
36164
36062
|
);
|
|
36165
36063
|
}
|
|
36166
|
-
return new NgModule(name, requires,
|
|
36064
|
+
return new NgModule(name, requires, configFn);
|
|
36167
36065
|
});
|
|
36168
36066
|
}
|
|
36169
36067
|
}
|