@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
|
@@ -5,6 +5,7 @@ const TEST_URL = "src/router/state/state.html?random=false";
|
|
|
5
5
|
test("unit tests contain no errors", async ({ page }) => {
|
|
6
6
|
await page.goto(TEST_URL);
|
|
7
7
|
await page.content();
|
|
8
|
+
await page.waitForTimeout(1000);
|
|
8
9
|
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
9
10
|
/0 failures/,
|
|
10
11
|
);
|
|
@@ -64,7 +64,7 @@ export function ng1ViewsBuilder(state) {
|
|
|
64
64
|
name = name || "$default";
|
|
65
65
|
// Account for views: { header: "headerComponent" }
|
|
66
66
|
if (isString(config)) config = { component: config };
|
|
67
|
-
// Make a shallow copy of the
|
|
67
|
+
// Make a shallow copy of the urlConfig object
|
|
68
68
|
config = Object.assign({}, config);
|
|
69
69
|
// Do not allow a view to mix props for component-style view with props for template/controller-style view
|
|
70
70
|
if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) {
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { $injectTokens as $t } from "../injection-tokens.js";
|
|
2
|
+
|
|
3
|
+
$IsStateFilter.$inject = [$t.$state];
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
6
|
* `isState` Filter: truthy if the current state is the parameter
|
|
3
7
|
*
|
|
@@ -7,18 +11,19 @@
|
|
|
7
11
|
* ```html
|
|
8
12
|
* <div ng-if="'stateName' | isState">show if state is 'stateName'</div>
|
|
9
13
|
* ```
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
14
|
+
*
|
|
15
|
+
* @param {import('./state/state-service.js').StateProvider} $state
|
|
13
16
|
* @returns {import('../interface.ts').FilterFn}
|
|
14
17
|
*/
|
|
15
18
|
export function $IsStateFilter($state) {
|
|
16
|
-
const isFilter =
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
+
const isFilter = (state, params, options) =>
|
|
20
|
+
$state.is(state, params, options);
|
|
19
21
|
isFilter.$stateful = true;
|
|
20
22
|
return isFilter;
|
|
21
23
|
}
|
|
24
|
+
|
|
25
|
+
$IncludedByStateFilter.$inject = [$t.$state];
|
|
26
|
+
|
|
22
27
|
/**
|
|
23
28
|
* `includedByState` Filter: truthy if the current state includes the parameter
|
|
24
29
|
*
|
|
@@ -28,9 +33,8 @@ export function $IsStateFilter($state) {
|
|
|
28
33
|
* ```html
|
|
29
34
|
* <div ng-if="'fullOrPartialStateName' | includedByState">show if state includes 'fullOrPartialStateName'</div>
|
|
30
35
|
* ```
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/**
|
|
36
|
+
*
|
|
37
|
+
* @param {import('./state/state-service.js').StateProvider} $state
|
|
34
38
|
* @returns {import('../interface.ts').FilterFn}
|
|
35
39
|
*/
|
|
36
40
|
export function $IncludedByStateFilter($state) {
|
|
@@ -4,6 +4,7 @@ import { Resolvable } from "./resolve/resolvable.js";
|
|
|
4
4
|
import { kebobString } from "../shared/strings.js";
|
|
5
5
|
import { annotate } from "../core/di/injector.js";
|
|
6
6
|
import { DirectiveSuffix } from "../core/compile/compile.js";
|
|
7
|
+
import { $injectTokens as $t } from "../injection-tokens.js";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* @typedef BindingTuple
|
|
@@ -21,10 +22,10 @@ export class TemplateFactoryProvider {
|
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
$get = [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
$t.$http,
|
|
26
|
+
$t.$templateCache,
|
|
27
|
+
$t.$templateRequest,
|
|
28
|
+
$t.$injector,
|
|
28
29
|
/**
|
|
29
30
|
* @param {import("interface.ts").HttpService} $http
|
|
30
31
|
* @param {import("../services/template-cache/interface.ts").TemplateCache} $templateCache
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { dealoc } from "../shared/dom.js";
|
|
2
|
-
import { Angular } from "../
|
|
2
|
+
import { Angular } from "../angular.js";
|
|
3
3
|
import { wait } from "../shared/test-utils.js";
|
|
4
4
|
|
|
5
5
|
describe("templateFactory", () => {
|
|
@@ -78,9 +78,9 @@ describe("templateFactory", () => {
|
|
|
78
78
|
]);
|
|
79
79
|
$injector.invoke(
|
|
80
80
|
(_$templateFactory_, _$httpBackend_, _$sce_, $rootScope) => {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
$templateFactory = _$templateFactory_;
|
|
82
|
+
$httpBackend = _$httpBackend_;
|
|
83
|
+
$sce = _$sce_;
|
|
84
84
|
$scope = $rootScope;
|
|
85
85
|
},
|
|
86
86
|
);
|
|
@@ -119,9 +119,9 @@ describe("templateFactory", () => {
|
|
|
119
119
|
_$state_,
|
|
120
120
|
_$compile_,
|
|
121
121
|
) => {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
$templateFactory = _$templateFactory_;
|
|
123
|
+
$httpBackend = _$httpBackend_;
|
|
124
|
+
$sce = _$sce_;
|
|
125
125
|
$scope = $rootScope;
|
|
126
126
|
$stateRegistry = _$stateRegistry_;
|
|
127
127
|
$stateService = _$state_;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { removeFrom, tail, map } from "../../shared/common.js";
|
|
2
2
|
import { isString, isFunction } from "../../shared/utils.js";
|
|
3
|
-
import { Glob } from "../
|
|
3
|
+
import { Glob } from "../glob/glob.js";
|
|
4
4
|
import { TransitionHookScope } from "./interface.js";
|
|
5
5
|
/**
|
|
6
6
|
* Determines if the given state matches the matchCriteria
|
|
@@ -31,6 +31,7 @@ import { registerIgnoredTransitionHook } from "../hooks/ignored-transition.js";
|
|
|
31
31
|
import { registerInvalidTransitionHook } from "../hooks/invalid-transition.js";
|
|
32
32
|
import { registerRedirectToHook } from "../hooks/redirect-to.js";
|
|
33
33
|
import { registerUpdateUrl } from "../hooks/url.js";
|
|
34
|
+
import { $injectTokens as $t, provider } from "../../injection-tokens.js";
|
|
34
35
|
/**
|
|
35
36
|
* The default [[Transition]] options.
|
|
36
37
|
*
|
|
@@ -61,10 +62,10 @@ export let defaultTransOpts = {
|
|
|
61
62
|
* This API is located at `router.transitionService` ([[UIRouter.transitionService]])
|
|
62
63
|
*/
|
|
63
64
|
export class TransitionProvider {
|
|
64
|
-
static $inject = [
|
|
65
|
+
/* @ignore */ static $inject = provider([$t.$router, $t.$view]);
|
|
65
66
|
|
|
66
67
|
/**
|
|
67
|
-
* @param {import('../
|
|
68
|
+
* @param {import('../router.js').Router} globals
|
|
68
69
|
* @param viewService
|
|
69
70
|
*/
|
|
70
71
|
constructor(globals, viewService) {
|
|
@@ -92,10 +93,10 @@ export class TransitionProvider {
|
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
$get = [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
$t.$state,
|
|
97
|
+
$t.$url,
|
|
98
|
+
$t.$stateRegistry,
|
|
99
|
+
$t.$view,
|
|
99
100
|
(stateService, urlService, stateRegistry, viewService) => {
|
|
100
101
|
// Lazy load state trees
|
|
101
102
|
this._deregisterHookFns.lazyLoad = registerLazyLoadHook(
|
|
@@ -40,15 +40,15 @@ export class Transition {
|
|
|
40
40
|
*
|
|
41
41
|
* If the target state is not valid, an error is thrown.
|
|
42
42
|
*
|
|
43
|
-
* @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath`
|
|
43
|
+
* @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`
|
|
44
44
|
* encapsulates the "from state".
|
|
45
|
-
* @param targetState The target state and parameters being transitioned to (also, the transition options)
|
|
45
|
+
* @param {import('../state/target-state.js').TargetState} targetState The target state and parameters being transitioned to (also, the transition options)
|
|
46
46
|
* @param {import('../transition/transition-service.js').TransitionProvider} transitionService The [[TransitionService]] instance
|
|
47
|
-
* @param {import('../
|
|
47
|
+
* @param {import('../router.js').Router} globals
|
|
48
48
|
*/
|
|
49
49
|
constructor(fromPath, targetState, transitionService, globals) {
|
|
50
50
|
/**
|
|
51
|
-
* @type {import('../
|
|
51
|
+
* @type {import('../router.js').Router}
|
|
52
52
|
*/
|
|
53
53
|
this.globals = globals;
|
|
54
54
|
this.transitionService = transitionService;
|
|
@@ -586,8 +586,8 @@ export class Transition {
|
|
|
586
586
|
).length
|
|
587
587
|
);
|
|
588
588
|
};
|
|
589
|
-
const newTC = this.
|
|
590
|
-
const pendTC = pending && pending.
|
|
589
|
+
const newTC = this._treeChanges;
|
|
590
|
+
const pendTC = pending && pending._treeChanges;
|
|
591
591
|
if (
|
|
592
592
|
pendTC &&
|
|
593
593
|
same(pendTC.to, newTC.to) &&
|
|
@@ -93,13 +93,6 @@ const defaultConfig = {
|
|
|
93
93
|
*
|
|
94
94
|
*/
|
|
95
95
|
export class UrlMatcher {
|
|
96
|
-
static encodeDashes(str) {
|
|
97
|
-
// Replace dashes with encoded "\-"
|
|
98
|
-
return encodeURIComponent(str).replace(
|
|
99
|
-
/-/g,
|
|
100
|
-
(c) => `%5C%${c.charCodeAt(0).toString(16).toUpperCase()}`,
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
96
|
/** @internal Given a matcher, return an array with the matcher's path segments and path params, in order */
|
|
104
97
|
static pathSegmentsAndParams(matcher) {
|
|
105
98
|
const staticSegments = matcher._segments;
|
|
@@ -310,9 +303,6 @@ export class UrlMatcher {
|
|
|
310
303
|
return this.pattern;
|
|
311
304
|
}
|
|
312
305
|
_getDecodedParamValue(value, param) {
|
|
313
|
-
if (isDefined(value)) {
|
|
314
|
-
value = param.type.decode(value);
|
|
315
|
-
}
|
|
316
306
|
return param.value(value);
|
|
317
307
|
}
|
|
318
308
|
/**
|
|
@@ -334,9 +324,9 @@ export class UrlMatcher {
|
|
|
334
324
|
* // returns { id: 'bob', q: 'hello', r: null }
|
|
335
325
|
* ```
|
|
336
326
|
*
|
|
337
|
-
* @param path The URL path to match, e.g. `$location.
|
|
338
|
-
* @param search URL search parameters, e.g. `$location.
|
|
339
|
-
* @param hash URL hash e.g. `$location.
|
|
327
|
+
* @param path The URL path to match, e.g. `$location.getPath()`.
|
|
328
|
+
* @param search URL search parameters, e.g. `$location.getSearch()`.
|
|
329
|
+
* @param hash URL hash e.g. `$location.getHash()`.
|
|
340
330
|
*
|
|
341
331
|
* @returns The captured parameter values.
|
|
342
332
|
*/
|
|
@@ -503,7 +493,7 @@ export class UrlMatcher {
|
|
|
503
493
|
if (encoded == null) return acc;
|
|
504
494
|
// If this parameter value is an array, encode the value using encodeDashes
|
|
505
495
|
if (Array.isArray(encoded))
|
|
506
|
-
return acc + map(encoded,
|
|
496
|
+
return acc + map(encoded, encodeDashes).join("-");
|
|
507
497
|
// If the parameter type is "raw", then do not encodeURIComponent
|
|
508
498
|
if (param.raw) return acc + encoded;
|
|
509
499
|
// Encode the value
|
|
@@ -532,3 +522,11 @@ export class UrlMatcher {
|
|
|
532
522
|
}
|
|
533
523
|
|
|
534
524
|
UrlMatcher.nameValidator = /^\w+([-.]+\w+)*(?:\[\])?$/;
|
|
525
|
+
|
|
526
|
+
function encodeDashes(str) {
|
|
527
|
+
// Replace dashes with encoded "\-"
|
|
528
|
+
return encodeURIComponent(str).replace(
|
|
529
|
+
/-/g,
|
|
530
|
+
(c) => `%5C%${c.charCodeAt(0).toString(16).toUpperCase()}`,
|
|
531
|
+
);
|
|
532
|
+
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
isUndefined,
|
|
7
7
|
assert,
|
|
8
8
|
} from "../../shared/utils.js";
|
|
9
|
-
import { is,
|
|
9
|
+
import { is, pattern } from "../../shared/hof.js";
|
|
10
10
|
import { StateObject } from "../state/state-object.js";
|
|
11
11
|
/**
|
|
12
12
|
* Creates a [[UrlRule]]
|
|
@@ -19,6 +19,11 @@ import { StateObject } from "../state/state-object.js";
|
|
|
19
19
|
* - [[StateObject]]
|
|
20
20
|
*/
|
|
21
21
|
export class UrlRuleFactory {
|
|
22
|
+
/**
|
|
23
|
+
* @param {import('../url/url-service.js').UrlService} urlService
|
|
24
|
+
* @param {import('../state/state-service.js').StateProvider} stateService
|
|
25
|
+
* @param {import('../router.js').Router} routerGlobals
|
|
26
|
+
*/
|
|
22
27
|
constructor(urlService, stateService, routerGlobals) {
|
|
23
28
|
this.urlService = urlService;
|
|
24
29
|
this.stateService = stateService;
|
|
@@ -37,7 +42,7 @@ export class UrlRuleFactory {
|
|
|
37
42
|
[isString, (_what) => makeRule(this.urlService.compile(_what))],
|
|
38
43
|
[is(UrlMatcher), (_what) => this.fromUrlMatcher(_what, handler)],
|
|
39
44
|
[
|
|
40
|
-
|
|
45
|
+
(...args) => isState(...args) || isStateDeclaration(...args),
|
|
41
46
|
(_what) => this.fromState(_what, this.stateService, this.routerGlobals),
|
|
42
47
|
],
|
|
43
48
|
[is(RegExp), (_what) => this.fromRegExp(_what, handler)],
|
|
@@ -211,6 +216,7 @@ export class BaseUrlRule {
|
|
|
211
216
|
this.$id = -1;
|
|
212
217
|
this._group = undefined;
|
|
213
218
|
this.handler = handler || ((x) => x);
|
|
219
|
+
this.priority = undefined;
|
|
214
220
|
}
|
|
215
221
|
|
|
216
222
|
/**
|
|
@@ -5,7 +5,9 @@ import { isDefined, isFunction, isString } from "../../shared/utils.js";
|
|
|
5
5
|
import { removeFrom } from "../../shared/common.js";
|
|
6
6
|
import { UrlRuleFactory } from "./url-rule.js";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
function prioritySort(a, b) {
|
|
9
|
+
return (b.priority || 0) - (a.priority || 0);
|
|
10
|
+
}
|
|
9
11
|
|
|
10
12
|
const typeSort = (a, b) => {
|
|
11
13
|
const weights = { STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1 };
|
|
@@ -36,8 +38,7 @@ const idSort = (a, b) => {
|
|
|
36
38
|
* - Equally sorted State and UrlMatcher rules will each match the URL.
|
|
37
39
|
* Then, the *best* match is chosen based on how many parameter values were matched.
|
|
38
40
|
*/
|
|
39
|
-
|
|
40
|
-
defaultRuleSortFn = (a, b) => {
|
|
41
|
+
function defaultRuleSortFn(a, b) {
|
|
41
42
|
let cmp = prioritySort(a, b);
|
|
42
43
|
if (cmp !== 0) return cmp;
|
|
43
44
|
cmp = typeSort(a, b);
|
|
@@ -45,7 +46,8 @@ defaultRuleSortFn = (a, b) => {
|
|
|
45
46
|
cmp = urlMatcherSort(a, b);
|
|
46
47
|
if (cmp !== 0) return cmp;
|
|
47
48
|
return idSort(a, b);
|
|
48
|
-
}
|
|
49
|
+
}
|
|
50
|
+
|
|
49
51
|
function getHandlerFn(handler) {
|
|
50
52
|
if (
|
|
51
53
|
!isFunction(handler) &&
|
|
@@ -67,9 +69,10 @@ function getHandlerFn(handler) {
|
|
|
67
69
|
*
|
|
68
70
|
* The most commonly used methods are [[otherwise]] and [[when]].
|
|
69
71
|
*
|
|
70
|
-
* This API is found at `$
|
|
72
|
+
* This API is found at `$url.rules` (see: [[UIRouter.urlService]], [[URLService.rules]])
|
|
71
73
|
*/
|
|
72
74
|
export class UrlRules {
|
|
75
|
+
/** @param {UrlRuleFactory} urlRuleFactory */
|
|
73
76
|
constructor(urlRuleFactory) {
|
|
74
77
|
this._sortFn = defaultRuleSortFn;
|
|
75
78
|
this._rules = [];
|
|
@@ -13,44 +13,43 @@ import { UrlMatcher } from "./url-matcher.js";
|
|
|
13
13
|
import { ParamFactory } from "../params/param-factory.js";
|
|
14
14
|
import { UrlRuleFactory } from "./url-rule.js";
|
|
15
15
|
import { getBaseHref } from "../../shared/dom.js";
|
|
16
|
+
import { $injectTokens as $t, provider } from "../../injection-tokens.js";
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* API for URL management
|
|
19
20
|
*/
|
|
20
21
|
export class UrlService {
|
|
21
|
-
static $inject = [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
];
|
|
22
|
+
static $inject = provider([
|
|
23
|
+
$t.$location,
|
|
24
|
+
$t.$state,
|
|
25
|
+
$t.$router,
|
|
26
|
+
$t.$urlConfig,
|
|
27
|
+
]);
|
|
28
|
+
|
|
29
|
+
/** @type {import("../../services/location/location").Location} */
|
|
30
|
+
$location;
|
|
27
31
|
|
|
28
32
|
/**
|
|
29
33
|
* @param {import("../../services/location/location").LocationProvider} $locationProvider
|
|
30
34
|
* @param {import("../../router/state/state-service.js").StateProvider} stateService
|
|
31
|
-
* @param globals
|
|
35
|
+
* @param {import("../router.js").Router} globals
|
|
32
36
|
* @param {import("../../router/url/url-config.js").UrlConfigProvider} urlConfigProvider
|
|
33
37
|
*/
|
|
34
38
|
constructor($locationProvider, stateService, globals, urlConfigProvider) {
|
|
39
|
+
this.$locationProvider = $locationProvider;
|
|
35
40
|
this.stateService = stateService;
|
|
36
41
|
this.stateService.urlService = this; // circular wiring
|
|
37
|
-
this.$locationProvider = $locationProvider;
|
|
38
|
-
this.$location = undefined;
|
|
39
42
|
|
|
40
43
|
/** Provides services related to the URL */
|
|
41
44
|
this.urlRuleFactory = new UrlRuleFactory(this, this.stateService, globals);
|
|
42
45
|
|
|
43
46
|
/**
|
|
44
47
|
* The nested [[UrlRules]] API for managing URL rules and rewrites
|
|
45
|
-
*
|
|
46
|
-
* See: [[UrlRules]] for details
|
|
47
48
|
* @type {UrlRules}
|
|
48
49
|
*/
|
|
49
50
|
this.rules = new UrlRules(this.urlRuleFactory);
|
|
50
51
|
/**
|
|
51
52
|
* The nested [[UrlConfig]] API to configure the URL and retrieve URL information
|
|
52
|
-
*
|
|
53
|
-
* See: [[UrlConfig]] for details
|
|
54
53
|
* @type {import("./url-config.js").UrlConfigProvider}
|
|
55
54
|
*/
|
|
56
55
|
this.config = urlConfigProvider;
|
|
@@ -58,37 +57,44 @@ export class UrlService {
|
|
|
58
57
|
/** Creates a new [[Param]] for a given location (DefType) */
|
|
59
58
|
this.paramFactory = new ParamFactory(this.config);
|
|
60
59
|
|
|
61
|
-
/**
|
|
62
|
-
* Gets the path part of the current url
|
|
63
|
-
*
|
|
64
|
-
* If the current URL is `/some/path?query=value#anchor`, this returns `/some/path`
|
|
65
|
-
*
|
|
66
|
-
* @return the path portion of the url
|
|
67
|
-
*/
|
|
68
|
-
this.path = () => this.$location.path();
|
|
69
|
-
/**
|
|
70
|
-
* Gets the search part of the current url as an object
|
|
71
|
-
*
|
|
72
|
-
* If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }`
|
|
73
|
-
*
|
|
74
|
-
* @return the search (query) portion of the url, as an object
|
|
75
|
-
*/
|
|
76
|
-
this.search = () => this.$location.search();
|
|
77
|
-
/**
|
|
78
|
-
* Gets the hash part of the current url
|
|
79
|
-
*
|
|
80
|
-
* If the current URL is `/some/path?query=value#anchor`, this returns `anchor`
|
|
81
|
-
*
|
|
82
|
-
* @return the hash (anchor) portion of the url
|
|
83
|
-
*/
|
|
84
|
-
this.hash = () => this.$location.hash();
|
|
85
|
-
|
|
86
60
|
this._urlListeners = [];
|
|
87
61
|
}
|
|
88
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Gets the path part of the current url
|
|
65
|
+
*
|
|
66
|
+
* If the current URL is `/some/path?query=value#anchor`, this returns `/some/path`
|
|
67
|
+
*
|
|
68
|
+
* @return {string} the path portion of the url
|
|
69
|
+
*/
|
|
70
|
+
getPath() {
|
|
71
|
+
return this.$location.getPath();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Gets the search part of the current url as an object
|
|
76
|
+
*
|
|
77
|
+
* If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }`
|
|
78
|
+
*
|
|
79
|
+
* @return {Object} the search (query) portion of the url, as an object
|
|
80
|
+
*/
|
|
81
|
+
getSearch() {
|
|
82
|
+
return this.$location.getSearch();
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Gets the hash part of the current url
|
|
86
|
+
*
|
|
87
|
+
* If the current URL is `/some/path?query=value#anchor`, this returns `anchor`
|
|
88
|
+
*
|
|
89
|
+
* @return {string} the hash (anchor) portion of the url
|
|
90
|
+
*/
|
|
91
|
+
getHash() {
|
|
92
|
+
return this.$location.getHash();
|
|
93
|
+
}
|
|
94
|
+
|
|
89
95
|
$get = [
|
|
90
|
-
|
|
91
|
-
|
|
96
|
+
$t.$location,
|
|
97
|
+
$t.$rootScope,
|
|
92
98
|
/**
|
|
93
99
|
*
|
|
94
100
|
* @param {import('../../services/location/location.js').Location} $location
|
|
@@ -102,21 +108,14 @@ export class UrlService {
|
|
|
102
108
|
fn(evt);
|
|
103
109
|
});
|
|
104
110
|
});
|
|
105
|
-
this.listen();
|
|
111
|
+
this.listen(true);
|
|
106
112
|
return this;
|
|
107
113
|
},
|
|
108
114
|
];
|
|
109
115
|
|
|
110
116
|
/**
|
|
111
|
-
* @returns {
|
|
117
|
+
* @returns {string}
|
|
112
118
|
*/
|
|
113
|
-
html5Mode() {
|
|
114
|
-
return (
|
|
115
|
-
this.$locationProvider.getHtml5Mode().enabled &&
|
|
116
|
-
typeof history !== "undefined"
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
119
|
baseHref() {
|
|
121
120
|
return (
|
|
122
121
|
this._baseHref ||
|
|
@@ -171,20 +170,21 @@ export class UrlService {
|
|
|
171
170
|
* @param {string} [newUrl] The new value for the URL.
|
|
172
171
|
* This url should reflect only the new internal [[path]], [[search]], and [[hash]] values.
|
|
173
172
|
* It should not include the protocol, site, port, or base path of an absolute HREF.
|
|
174
|
-
* @param {boolean} [replace] When true, replaces the current history entry (instead of appending it) with this new url
|
|
175
173
|
* @param {any} [state] The history's state object, i.e., pushState (if the LocationServices implementation supports it)
|
|
176
174
|
*
|
|
177
175
|
* @return the url (after potentially being processed)
|
|
178
176
|
*/
|
|
179
|
-
url(newUrl,
|
|
180
|
-
if (isDefined(newUrl))
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
177
|
+
url(newUrl, state) {
|
|
178
|
+
if (isDefined(newUrl)) {
|
|
179
|
+
const decodeUri = decodeURIComponent(newUrl);
|
|
180
|
+
this.$location.setUrl(decodeUri);
|
|
181
|
+
}
|
|
182
|
+
if (state) this.$location.setState(state);
|
|
183
|
+
return this.$location.getUrl();
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
/**
|
|
187
|
-
* @
|
|
187
|
+
* @private
|
|
188
188
|
*
|
|
189
189
|
* Registers a low level url change handler
|
|
190
190
|
*
|
|
@@ -195,8 +195,8 @@ export class UrlService {
|
|
|
195
195
|
* let deregisterFn = locationServices.onChange((evt) => console.log("url change", evt));
|
|
196
196
|
* ```
|
|
197
197
|
*
|
|
198
|
-
* @param callback a function that will be called when the url is changing
|
|
199
|
-
* @return a function that de-registers the callback
|
|
198
|
+
* @param {Function} callback a function that will be called when the url is changing
|
|
199
|
+
* @return {Function} a function that de-registers the callback
|
|
200
200
|
*/
|
|
201
201
|
onChange(callback) {
|
|
202
202
|
this._urlListeners.push(callback);
|
|
@@ -204,13 +204,21 @@ export class UrlService {
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
/**
|
|
207
|
-
* Gets the current URL parts
|
|
207
|
+
* Gets the current URL parts.
|
|
208
|
+
*
|
|
209
|
+
* Returns an object with the `path`, `search`, and `hash` components
|
|
210
|
+
* of the current browser location.
|
|
208
211
|
*
|
|
209
|
-
*
|
|
212
|
+
* @returns {import("../../services/location/interface.ts").UrlParts} The current URL's path, search, and hash.
|
|
210
213
|
*/
|
|
211
214
|
parts() {
|
|
212
|
-
return {
|
|
215
|
+
return {
|
|
216
|
+
path: this.$location.getPath(),
|
|
217
|
+
search: this.$location.getSearch(),
|
|
218
|
+
hash: this.$location.getHash(),
|
|
219
|
+
};
|
|
213
220
|
}
|
|
221
|
+
|
|
214
222
|
/**
|
|
215
223
|
* Activates the best rule for the current URL
|
|
216
224
|
*
|
|
@@ -234,16 +242,16 @@ export class UrlService {
|
|
|
234
242
|
if (evt && evt.defaultPrevented) return;
|
|
235
243
|
const stateService = this.stateService;
|
|
236
244
|
const url = {
|
|
237
|
-
path: this.
|
|
238
|
-
search: this.
|
|
239
|
-
hash: this.
|
|
245
|
+
path: this.$location.getPath(),
|
|
246
|
+
search: this.$location.getSearch(),
|
|
247
|
+
hash: this.$location.getHash(),
|
|
240
248
|
};
|
|
241
249
|
/**
|
|
242
250
|
* @type {*}
|
|
243
251
|
*/
|
|
244
252
|
const best = this.match(url);
|
|
245
253
|
const applyResult = pattern([
|
|
246
|
-
[isString, (newurl) => this.url(newurl
|
|
254
|
+
[isString, (newurl) => this.url(newurl)],
|
|
247
255
|
[
|
|
248
256
|
TargetState.isDef,
|
|
249
257
|
(def) => stateService.go(def.state, def.params, def.options),
|
|
@@ -276,7 +284,7 @@ export class UrlService {
|
|
|
276
284
|
* });
|
|
277
285
|
* ```
|
|
278
286
|
*
|
|
279
|
-
* @param enabled `true` or `false` to start or stop listening to URL changes
|
|
287
|
+
* @param {boolean} enabled `true` or `false` to start or stop listening to URL changes
|
|
280
288
|
*/
|
|
281
289
|
listen(enabled) {
|
|
282
290
|
if (enabled === false) {
|
|
@@ -354,7 +362,7 @@ export class UrlService {
|
|
|
354
362
|
* ```js
|
|
355
363
|
* matcher = $umf.compile("/about/:person");
|
|
356
364
|
* params = { person: "bob" };
|
|
357
|
-
* $bob = $
|
|
365
|
+
* $bob = $url.href(matcher, params);
|
|
358
366
|
* // $bob == "/about/bob";
|
|
359
367
|
* ```
|
|
360
368
|
*
|
|
@@ -370,22 +378,18 @@ export class UrlService {
|
|
|
370
378
|
let url = urlMatcher.format(params);
|
|
371
379
|
if (url == null) return null;
|
|
372
380
|
options = options || { absolute: false };
|
|
373
|
-
const isHtml5 = this.
|
|
374
|
-
if (!isHtml5
|
|
375
|
-
url = "#" + this.$locationProvider.
|
|
381
|
+
const isHtml5 = this.$locationProvider.html5ModeConf.enabled;
|
|
382
|
+
if (!isHtml5) {
|
|
383
|
+
url = "#" + this.$locationProvider.hashPrefixConf + url;
|
|
376
384
|
}
|
|
377
385
|
url = appendBasePath(url, isHtml5, options.absolute, this.baseHref());
|
|
378
386
|
if (!options.absolute || !url) {
|
|
379
387
|
return url;
|
|
380
388
|
}
|
|
381
389
|
const slash = !isHtml5 && url ? "/" : "";
|
|
382
|
-
const cfgPort = this.$location.port();
|
|
383
|
-
const port = cfgPort === 80 || cfgPort === 443 ? "" : ":" + cfgPort;
|
|
384
390
|
return [
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
this.$location.host(),
|
|
388
|
-
port,
|
|
391
|
+
`${window.location.protocol}//`,
|
|
392
|
+
window.location.host,
|
|
389
393
|
slash,
|
|
390
394
|
url,
|
|
391
395
|
].join("");
|