@skyux/router 6.16.0 → 7.0.0-alpha.0
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/esm2020/lib/modules/href/href-resolver.service.mjs +3 -3
- package/esm2020/lib/modules/href/href.directive.mjs +133 -119
- package/esm2020/lib/modules/href/href.module.mjs +5 -5
- package/esm2020/lib/modules/link/link-external.directive.mjs +24 -18
- package/esm2020/lib/modules/link/link.directive.mjs +18 -13
- package/esm2020/lib/modules/link/link.module.mjs +4 -4
- package/esm2020/lib/modules/recently-accessed/recently-accessed.service.mjs +3 -3
- package/fesm2015/skyux-router.mjs +189 -163
- package/fesm2015/skyux-router.mjs.map +1 -1
- package/fesm2020/skyux-router.mjs +184 -161
- package/fesm2020/skyux-router.mjs.map +1 -1
- package/lib/modules/href/href.directive.d.ts +6 -20
- package/lib/modules/link/link-external.directive.d.ts +2 -5
- package/lib/modules/link/link.directive.d.ts +2 -4
- package/package.json +8 -8
- package/skyux-router.d.ts +0 -5
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Directive, Optional, Input, NgModule, Injectable, EventEmitter, Output, HostListener } from '@angular/core';
|
|
3
|
+
import { __classPrivateFieldSet, __classPrivateFieldGet } from 'tslib';
|
|
3
4
|
import * as i2 from '@angular/common';
|
|
4
5
|
import { PathLocationStrategy, CommonModule } from '@angular/common';
|
|
5
6
|
import * as i1 from '@angular/router';
|
|
@@ -8,18 +9,23 @@ import * as i4 from '@skyux/config';
|
|
|
8
9
|
import * as i3 from '@skyux/core';
|
|
9
10
|
import { HttpParams } from '@angular/common/http';
|
|
10
11
|
|
|
12
|
+
var _SkyAppLinkExternalDirective_instances, _SkyAppLinkExternalDirective_window, _SkyAppLinkExternalDirective_skyAppConfig, _SkyAppLinkExternalDirective_paramsProvider, _SkyAppLinkExternalDirective_mergeQueryParams;
|
|
11
13
|
/**
|
|
12
14
|
* @deprecated Use `skyHref` directive instead.
|
|
13
15
|
*/
|
|
14
16
|
class SkyAppLinkExternalDirective extends RouterLinkWithHref {
|
|
15
17
|
constructor(router, route, platformLocation, window, skyAppConfig, paramsProvider, hostConfig) {
|
|
16
|
-
super(router, route, new PathLocationStrategy(platformLocation, hostConfig ? hostConfig.host.url : skyAppConfig
|
|
17
|
-
this
|
|
18
|
-
this
|
|
19
|
-
this
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
super(router, route, new PathLocationStrategy(platformLocation, hostConfig ? hostConfig.host.url : skyAppConfig?.skyux.host?.url));
|
|
19
|
+
_SkyAppLinkExternalDirective_instances.add(this);
|
|
20
|
+
_SkyAppLinkExternalDirective_window.set(this, void 0);
|
|
21
|
+
_SkyAppLinkExternalDirective_skyAppConfig.set(this, void 0);
|
|
22
|
+
_SkyAppLinkExternalDirective_paramsProvider.set(this, void 0);
|
|
23
|
+
__classPrivateFieldSet(this, _SkyAppLinkExternalDirective_window, window, "f");
|
|
24
|
+
__classPrivateFieldSet(this, _SkyAppLinkExternalDirective_skyAppConfig, skyAppConfig, "f");
|
|
25
|
+
__classPrivateFieldSet(this, _SkyAppLinkExternalDirective_paramsProvider, paramsProvider, "f");
|
|
26
|
+
if (__classPrivateFieldGet(this, _SkyAppLinkExternalDirective_window, "f").nativeWindow.window.name &&
|
|
27
|
+
__classPrivateFieldGet(this, _SkyAppLinkExternalDirective_window, "f").nativeWindow.window.name !== '') {
|
|
28
|
+
this.target = __classPrivateFieldGet(this, _SkyAppLinkExternalDirective_window, "f").nativeWindow.window.name;
|
|
23
29
|
}
|
|
24
30
|
else {
|
|
25
31
|
this.target = '_top';
|
|
@@ -29,19 +35,19 @@ class SkyAppLinkExternalDirective extends RouterLinkWithHref {
|
|
|
29
35
|
this.routerLink = commands;
|
|
30
36
|
}
|
|
31
37
|
ngOnChanges(changes) {
|
|
32
|
-
this.queryParams = this.
|
|
38
|
+
this.queryParams = __classPrivateFieldGet(this, _SkyAppLinkExternalDirective_instances, "m", _SkyAppLinkExternalDirective_mergeQueryParams).call(this, changes.queryParams?.currentValue);
|
|
33
39
|
super.ngOnChanges(changes);
|
|
34
40
|
}
|
|
35
|
-
mergeQueryParams(queryParams) {
|
|
36
|
-
const skyuxParams = this.skyAppConfig
|
|
37
|
-
? this.skyAppConfig.runtime.params.getAll()
|
|
38
|
-
: this.paramsProvider.params.getAll();
|
|
39
|
-
return Object.assign({}, this.queryParams, queryParams, skyuxParams);
|
|
40
|
-
}
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
_SkyAppLinkExternalDirective_window = new WeakMap(), _SkyAppLinkExternalDirective_skyAppConfig = new WeakMap(), _SkyAppLinkExternalDirective_paramsProvider = new WeakMap(), _SkyAppLinkExternalDirective_instances = new WeakSet(), _SkyAppLinkExternalDirective_mergeQueryParams = function _SkyAppLinkExternalDirective_mergeQueryParams(queryParams) {
|
|
43
|
+
const skyuxParams = __classPrivateFieldGet(this, _SkyAppLinkExternalDirective_skyAppConfig, "f")
|
|
44
|
+
? __classPrivateFieldGet(this, _SkyAppLinkExternalDirective_skyAppConfig, "f").runtime.params.getAll()
|
|
45
|
+
: __classPrivateFieldGet(this, _SkyAppLinkExternalDirective_paramsProvider, "f")?.params.getAll();
|
|
46
|
+
return Object.assign({}, this.queryParams, queryParams, skyuxParams);
|
|
47
|
+
};
|
|
48
|
+
SkyAppLinkExternalDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyAppLinkExternalDirective, deps: [{ token: i1.Router }, { token: i1.ActivatedRoute }, { token: i2.PlatformLocation }, { token: i3.SkyAppWindowRef }, { token: i4.SkyAppConfig, optional: true }, { token: i4.SkyAppRuntimeConfigParamsProvider, optional: true }, { token: i4.SkyAppConfigHost, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
49
|
+
SkyAppLinkExternalDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: SkyAppLinkExternalDirective, selector: "[skyAppLinkExternal]", inputs: { skyAppLinkExternal: "skyAppLinkExternal" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
50
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyAppLinkExternalDirective, decorators: [{
|
|
45
51
|
type: Directive,
|
|
46
52
|
args: [{
|
|
47
53
|
selector: '[skyAppLinkExternal]',
|
|
@@ -56,29 +62,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
56
62
|
type: Input
|
|
57
63
|
}] } });
|
|
58
64
|
|
|
65
|
+
var _SkyAppLinkDirective_instances, _SkyAppLinkDirective_skyAppConfig, _SkyAppLinkDirective_paramsProvider, _SkyAppLinkDirective_mergeQueryParams;
|
|
59
66
|
class SkyAppLinkDirective extends RouterLinkWithHref {
|
|
60
67
|
constructor(router, route, locationStrategy, skyAppConfig, paramsProvider) {
|
|
61
68
|
super(router, route, locationStrategy);
|
|
62
|
-
this
|
|
63
|
-
this
|
|
69
|
+
_SkyAppLinkDirective_instances.add(this);
|
|
70
|
+
_SkyAppLinkDirective_skyAppConfig.set(this, void 0);
|
|
71
|
+
_SkyAppLinkDirective_paramsProvider.set(this, void 0);
|
|
72
|
+
__classPrivateFieldSet(this, _SkyAppLinkDirective_skyAppConfig, skyAppConfig, "f");
|
|
73
|
+
__classPrivateFieldSet(this, _SkyAppLinkDirective_paramsProvider, paramsProvider, "f");
|
|
64
74
|
}
|
|
65
75
|
set skyAppLink(commands) {
|
|
66
76
|
this.routerLink = commands;
|
|
67
77
|
}
|
|
68
78
|
ngOnChanges(changes) {
|
|
69
|
-
this.queryParams = this.
|
|
79
|
+
this.queryParams = __classPrivateFieldGet(this, _SkyAppLinkDirective_instances, "m", _SkyAppLinkDirective_mergeQueryParams).call(this, changes.queryParams?.currentValue);
|
|
70
80
|
super.ngOnChanges(changes);
|
|
71
81
|
}
|
|
72
|
-
mergeQueryParams(queryParams) {
|
|
73
|
-
const skyuxParams = this.skyAppConfig
|
|
74
|
-
? this.skyAppConfig.runtime.params.getAll(true)
|
|
75
|
-
: this.paramsProvider.params.getAll(true);
|
|
76
|
-
return Object.assign({}, this.queryParams, queryParams, skyuxParams);
|
|
77
|
-
}
|
|
78
82
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
_SkyAppLinkDirective_skyAppConfig = new WeakMap(), _SkyAppLinkDirective_paramsProvider = new WeakMap(), _SkyAppLinkDirective_instances = new WeakSet(), _SkyAppLinkDirective_mergeQueryParams = function _SkyAppLinkDirective_mergeQueryParams(queryParams) {
|
|
84
|
+
const skyuxParams = __classPrivateFieldGet(this, _SkyAppLinkDirective_skyAppConfig, "f")
|
|
85
|
+
? __classPrivateFieldGet(this, _SkyAppLinkDirective_skyAppConfig, "f").runtime.params.getAll(true)
|
|
86
|
+
: __classPrivateFieldGet(this, _SkyAppLinkDirective_paramsProvider, "f")?.params.getAll(true);
|
|
87
|
+
return Object.assign({}, this.queryParams, queryParams, skyuxParams);
|
|
88
|
+
};
|
|
89
|
+
SkyAppLinkDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyAppLinkDirective, deps: [{ token: i1.Router }, { token: i1.ActivatedRoute }, { token: i2.LocationStrategy }, { token: i4.SkyAppConfig, optional: true }, { token: i4.SkyAppRuntimeConfigParamsProvider, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
90
|
+
SkyAppLinkDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: SkyAppLinkDirective, selector: "[skyAppLink]", inputs: { skyAppLink: "skyAppLink" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
91
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyAppLinkDirective, decorators: [{
|
|
82
92
|
type: Directive,
|
|
83
93
|
args: [{
|
|
84
94
|
selector: '[skyAppLink]',
|
|
@@ -94,10 +104,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
94
104
|
/* istanbul ignore next */
|
|
95
105
|
class SkyAppLinkModule {
|
|
96
106
|
}
|
|
97
|
-
SkyAppLinkModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
98
|
-
SkyAppLinkModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "
|
|
99
|
-
SkyAppLinkModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
100
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
107
|
+
SkyAppLinkModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyAppLinkModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
108
|
+
SkyAppLinkModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: SkyAppLinkModule, declarations: [SkyAppLinkDirective, SkyAppLinkExternalDirective], exports: [SkyAppLinkDirective, SkyAppLinkExternalDirective] });
|
|
109
|
+
SkyAppLinkModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyAppLinkModule });
|
|
110
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyAppLinkModule, decorators: [{
|
|
101
111
|
type: NgModule,
|
|
102
112
|
args: [{
|
|
103
113
|
declarations: [SkyAppLinkDirective, SkyAppLinkExternalDirective],
|
|
@@ -116,29 +126,60 @@ class SkyHrefResolverService {
|
|
|
116
126
|
});
|
|
117
127
|
}
|
|
118
128
|
}
|
|
119
|
-
SkyHrefResolverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
120
|
-
SkyHrefResolverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
121
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
129
|
+
SkyHrefResolverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyHrefResolverService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
130
|
+
SkyHrefResolverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyHrefResolverService });
|
|
131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyHrefResolverService, decorators: [{
|
|
122
132
|
type: Injectable
|
|
123
133
|
}] });
|
|
124
134
|
|
|
135
|
+
var _SkyHrefDirective_instances, _SkyHrefDirective_route, _SkyHrefDirective_href, _SkyHrefDirective__skyHref, _SkyHrefDirective__skyHrefElse, _SkyHrefDirective_router, _SkyHrefDirective_renderer, _SkyHrefDirective_element, _SkyHrefDirective_skyAppConfig, _SkyHrefDirective_paramsProvider, _SkyHrefDirective_hrefResolver, _SkyHrefDirective_applicationRef, _SkyHrefDirective_changeDetectorRef, _SkyHrefDirective_applyChanges, _SkyHrefDirective_checkRouteAccess, _SkyHrefDirective_getChanges, _SkyHrefDirective_getSkyuxParams, _SkyHrefDirective_getUrlTree;
|
|
125
136
|
class SkyHrefDirective {
|
|
126
137
|
constructor(router, renderer, element, skyAppConfig, paramsProvider, hrefResolver, applicationRef, changeDetectorRef) {
|
|
127
|
-
this
|
|
128
|
-
this.renderer = renderer;
|
|
129
|
-
this.element = element;
|
|
130
|
-
this.skyAppConfig = skyAppConfig;
|
|
131
|
-
this.paramsProvider = paramsProvider;
|
|
132
|
-
this.hrefResolver = hrefResolver;
|
|
133
|
-
this.applicationRef = applicationRef;
|
|
134
|
-
this.changeDetectorRef = changeDetectorRef;
|
|
138
|
+
_SkyHrefDirective_instances.add(this);
|
|
135
139
|
/**
|
|
136
140
|
* Emits whether the link is available (true) or not (false).
|
|
137
141
|
*/
|
|
138
142
|
this.skyHrefChange = new EventEmitter();
|
|
139
|
-
this
|
|
140
|
-
this
|
|
141
|
-
this
|
|
143
|
+
_SkyHrefDirective_route.set(this, false);
|
|
144
|
+
_SkyHrefDirective_href.set(this, '');
|
|
145
|
+
_SkyHrefDirective__skyHref.set(this, '');
|
|
146
|
+
_SkyHrefDirective__skyHrefElse.set(this, 'hide');
|
|
147
|
+
_SkyHrefDirective_router.set(this, void 0);
|
|
148
|
+
_SkyHrefDirective_renderer.set(this, void 0);
|
|
149
|
+
_SkyHrefDirective_element.set(this, void 0);
|
|
150
|
+
_SkyHrefDirective_skyAppConfig.set(this, void 0);
|
|
151
|
+
_SkyHrefDirective_paramsProvider.set(this, void 0);
|
|
152
|
+
_SkyHrefDirective_hrefResolver.set(this, void 0);
|
|
153
|
+
_SkyHrefDirective_applicationRef.set(this, void 0);
|
|
154
|
+
_SkyHrefDirective_changeDetectorRef.set(this, void 0);
|
|
155
|
+
/* istanbul ignore next */
|
|
156
|
+
_SkyHrefDirective_getUrlTree.set(this, () => {
|
|
157
|
+
const href = __classPrivateFieldGet(this, _SkyHrefDirective_href, "f").toLowerCase();
|
|
158
|
+
if (!href ||
|
|
159
|
+
!__classPrivateFieldGet(this, _SkyHrefDirective_skyAppConfig, "f")?.skyux.host?.url ||
|
|
160
|
+
!__classPrivateFieldGet(this, _SkyHrefDirective_skyAppConfig, "f")?.runtime?.app?.base) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
const baseUrl = (__classPrivateFieldGet(this, _SkyHrefDirective_skyAppConfig, "f").skyux.host.url +
|
|
164
|
+
__classPrivateFieldGet(this, _SkyHrefDirective_skyAppConfig, "f").runtime.app.base.substr(0, __classPrivateFieldGet(this, _SkyHrefDirective_skyAppConfig, "f").runtime.app.base.length - 1)).toLowerCase();
|
|
165
|
+
if (href === baseUrl ||
|
|
166
|
+
// Make sure the base URL is not simply a partial match of the base URL plus additional
|
|
167
|
+
// characters after the base URL that are not "terminating" characters
|
|
168
|
+
href.indexOf(baseUrl + '/') === 0 ||
|
|
169
|
+
href.indexOf(baseUrl + '?') === 0) {
|
|
170
|
+
const routePath = __classPrivateFieldGet(this, _SkyHrefDirective_href, "f").substring(baseUrl.length);
|
|
171
|
+
return __classPrivateFieldGet(this, _SkyHrefDirective_router, "f").parseUrl(routePath);
|
|
172
|
+
}
|
|
173
|
+
return false;
|
|
174
|
+
});
|
|
175
|
+
__classPrivateFieldSet(this, _SkyHrefDirective_router, router, "f");
|
|
176
|
+
__classPrivateFieldSet(this, _SkyHrefDirective_renderer, renderer, "f");
|
|
177
|
+
__classPrivateFieldSet(this, _SkyHrefDirective_element, element, "f");
|
|
178
|
+
__classPrivateFieldSet(this, _SkyHrefDirective_skyAppConfig, skyAppConfig, "f");
|
|
179
|
+
__classPrivateFieldSet(this, _SkyHrefDirective_paramsProvider, paramsProvider, "f");
|
|
180
|
+
__classPrivateFieldSet(this, _SkyHrefDirective_hrefResolver, hrefResolver, "f");
|
|
181
|
+
__classPrivateFieldSet(this, _SkyHrefDirective_applicationRef, applicationRef, "f");
|
|
182
|
+
__classPrivateFieldSet(this, _SkyHrefDirective_changeDetectorRef, changeDetectorRef, "f");
|
|
142
183
|
}
|
|
143
184
|
/**
|
|
144
185
|
* Provide a link as a string or as an array of strings to be joined by a slash to form a complete
|
|
@@ -148,12 +189,15 @@ class SkyHrefDirective {
|
|
|
148
189
|
*/
|
|
149
190
|
set skyHref(skyHref) {
|
|
150
191
|
if (typeof skyHref === 'string') {
|
|
151
|
-
this
|
|
192
|
+
__classPrivateFieldSet(this, _SkyHrefDirective__skyHref, skyHref, "f");
|
|
152
193
|
}
|
|
153
194
|
else {
|
|
154
|
-
this
|
|
195
|
+
__classPrivateFieldSet(this, _SkyHrefDirective__skyHref, skyHref ? skyHref.join('/') : '', "f");
|
|
155
196
|
}
|
|
156
|
-
this.
|
|
197
|
+
__classPrivateFieldGet(this, _SkyHrefDirective_instances, "m", _SkyHrefDirective_checkRouteAccess).call(this);
|
|
198
|
+
}
|
|
199
|
+
get skyHref() {
|
|
200
|
+
return __classPrivateFieldGet(this, _SkyHrefDirective__skyHref, "f");
|
|
157
201
|
}
|
|
158
202
|
/**
|
|
159
203
|
* Set the behavior for when the link is not available to either hide the link or display unlinked text.
|
|
@@ -161,134 +205,113 @@ class SkyHrefDirective {
|
|
|
161
205
|
* @param value
|
|
162
206
|
*/
|
|
163
207
|
set skyHrefElse(value) {
|
|
164
|
-
this
|
|
165
|
-
this.
|
|
208
|
+
__classPrivateFieldSet(this, _SkyHrefDirective__skyHrefElse, value, "f");
|
|
209
|
+
__classPrivateFieldGet(this, _SkyHrefDirective_instances, "m", _SkyHrefDirective_applyChanges).call(this, __classPrivateFieldGet(this, _SkyHrefDirective_instances, "m", _SkyHrefDirective_getChanges).call(this));
|
|
210
|
+
}
|
|
211
|
+
get skyHrefElse() {
|
|
212
|
+
return __classPrivateFieldGet(this, _SkyHrefDirective__skyHrefElse, "f");
|
|
166
213
|
}
|
|
167
214
|
/* istanbul ignore next */
|
|
168
215
|
onClick(button, ctrlKey, shiftKey, altKey, metaKey) {
|
|
169
|
-
if (!this
|
|
216
|
+
if (!__classPrivateFieldGet(this, _SkyHrefDirective_route, "f") || !__classPrivateFieldGet(this, _SkyHrefDirective_route, "f").userHasAccess) {
|
|
170
217
|
return false;
|
|
171
218
|
}
|
|
172
219
|
if (button !== 0 || ctrlKey || shiftKey || altKey || metaKey) {
|
|
173
220
|
return true;
|
|
174
221
|
}
|
|
175
|
-
const target = this.
|
|
222
|
+
const target = __classPrivateFieldGet(this, _SkyHrefDirective_element, "f").nativeElement.getAttribute('target');
|
|
176
223
|
if (typeof target === 'string' && target !== '_self') {
|
|
177
224
|
return true;
|
|
178
225
|
}
|
|
179
|
-
const urlTree = this.
|
|
226
|
+
const urlTree = __classPrivateFieldGet(this, _SkyHrefDirective_getUrlTree, "f").call(this);
|
|
180
227
|
if (urlTree) {
|
|
181
|
-
this.
|
|
228
|
+
__classPrivateFieldGet(this, _SkyHrefDirective_router, "f").navigateByUrl(urlTree);
|
|
182
229
|
return false;
|
|
183
230
|
}
|
|
184
231
|
return true;
|
|
185
232
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
else {
|
|
192
|
-
this.renderer.removeAttribute(this.element.nativeElement, 'hidden');
|
|
193
|
-
}
|
|
194
|
-
if (change.href) {
|
|
195
|
-
this.renderer.setAttribute(this.element.nativeElement, 'href', change.href);
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
this.renderer.removeAttribute(this.element.nativeElement, 'href');
|
|
199
|
-
}
|
|
200
|
-
this.skyHrefChange.emit({ userHasAccess: !change.hidden });
|
|
233
|
+
}
|
|
234
|
+
_SkyHrefDirective_route = new WeakMap(), _SkyHrefDirective_href = new WeakMap(), _SkyHrefDirective__skyHref = new WeakMap(), _SkyHrefDirective__skyHrefElse = new WeakMap(), _SkyHrefDirective_router = new WeakMap(), _SkyHrefDirective_renderer = new WeakMap(), _SkyHrefDirective_element = new WeakMap(), _SkyHrefDirective_skyAppConfig = new WeakMap(), _SkyHrefDirective_paramsProvider = new WeakMap(), _SkyHrefDirective_hrefResolver = new WeakMap(), _SkyHrefDirective_applicationRef = new WeakMap(), _SkyHrefDirective_changeDetectorRef = new WeakMap(), _SkyHrefDirective_getUrlTree = new WeakMap(), _SkyHrefDirective_instances = new WeakSet(), _SkyHrefDirective_applyChanges = function _SkyHrefDirective_applyChanges(change) {
|
|
235
|
+
__classPrivateFieldGet(this, _SkyHrefDirective_renderer, "f").addClass(__classPrivateFieldGet(this, _SkyHrefDirective_element, "f").nativeElement, 'sky-href');
|
|
236
|
+
if (change.hidden) {
|
|
237
|
+
__classPrivateFieldGet(this, _SkyHrefDirective_renderer, "f").setAttribute(__classPrivateFieldGet(this, _SkyHrefDirective_element, "f").nativeElement, 'hidden', 'hidden');
|
|
201
238
|
}
|
|
202
|
-
|
|
203
|
-
this.
|
|
204
|
-
url: this._skyHref,
|
|
205
|
-
userHasAccess: false,
|
|
206
|
-
};
|
|
207
|
-
/* istanbul ignore else */
|
|
208
|
-
if (this.hrefResolver && this._skyHref) {
|
|
209
|
-
this.applyChanges(this.getChanges());
|
|
210
|
-
try {
|
|
211
|
-
this.hrefResolver.resolveHref({ url: this._skyHref }).then((route) => {
|
|
212
|
-
this._route = { ...route };
|
|
213
|
-
this.applyChanges(this.getChanges());
|
|
214
|
-
/* istanbul ignore else */
|
|
215
|
-
if (this.changeDetectorRef && this.applicationRef) {
|
|
216
|
-
this.changeDetectorRef.markForCheck();
|
|
217
|
-
this.applicationRef.tick();
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
catch (error) {
|
|
222
|
-
this.applyChanges(this.getChanges());
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
else {
|
|
226
|
-
// no resolver or skyHref is falsy
|
|
227
|
-
this._route.userHasAccess = !!this._skyHref;
|
|
228
|
-
this.applyChanges(this.getChanges());
|
|
229
|
-
}
|
|
239
|
+
else {
|
|
240
|
+
__classPrivateFieldGet(this, _SkyHrefDirective_renderer, "f").removeAttribute(__classPrivateFieldGet(this, _SkyHrefDirective_element, "f").nativeElement, 'hidden');
|
|
230
241
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
|
|
242
|
+
if (change.href) {
|
|
243
|
+
__classPrivateFieldGet(this, _SkyHrefDirective_renderer, "f").setAttribute(__classPrivateFieldGet(this, _SkyHrefDirective_element, "f").nativeElement, 'href', change.href);
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
__classPrivateFieldGet(this, _SkyHrefDirective_renderer, "f").removeAttribute(__classPrivateFieldGet(this, _SkyHrefDirective_element, "f").nativeElement, 'href');
|
|
247
|
+
}
|
|
248
|
+
this.skyHrefChange.emit({ userHasAccess: !change.hidden });
|
|
249
|
+
}, _SkyHrefDirective_checkRouteAccess = function _SkyHrefDirective_checkRouteAccess() {
|
|
250
|
+
__classPrivateFieldSet(this, _SkyHrefDirective_route, {
|
|
251
|
+
url: this.skyHref,
|
|
252
|
+
userHasAccess: false,
|
|
253
|
+
}, "f");
|
|
254
|
+
/* istanbul ignore else */
|
|
255
|
+
if (__classPrivateFieldGet(this, _SkyHrefDirective_hrefResolver, "f") && this.skyHref) {
|
|
256
|
+
__classPrivateFieldGet(this, _SkyHrefDirective_instances, "m", _SkyHrefDirective_applyChanges).call(this, __classPrivateFieldGet(this, _SkyHrefDirective_instances, "m", _SkyHrefDirective_getChanges).call(this));
|
|
257
|
+
try {
|
|
258
|
+
__classPrivateFieldGet(this, _SkyHrefDirective_hrefResolver, "f").resolveHref({ url: this.skyHref }).then((route) => {
|
|
259
|
+
__classPrivateFieldSet(this, _SkyHrefDirective_route, { ...route }, "f");
|
|
260
|
+
__classPrivateFieldGet(this, _SkyHrefDirective_instances, "m", _SkyHrefDirective_applyChanges).call(this, __classPrivateFieldGet(this, _SkyHrefDirective_instances, "m", _SkyHrefDirective_getChanges).call(this));
|
|
261
|
+
/* istanbul ignore else */
|
|
262
|
+
if (__classPrivateFieldGet(this, _SkyHrefDirective_changeDetectorRef, "f") && __classPrivateFieldGet(this, _SkyHrefDirective_applicationRef, "f")) {
|
|
263
|
+
__classPrivateFieldGet(this, _SkyHrefDirective_changeDetectorRef, "f").markForCheck();
|
|
264
|
+
__classPrivateFieldGet(this, _SkyHrefDirective_applicationRef, "f").tick();
|
|
265
|
+
}
|
|
250
266
|
});
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
? '?' + queryParamsMerged.toString()
|
|
255
|
-
: '') +
|
|
256
|
-
(fragment ? `#${fragment}` : '');
|
|
257
|
-
return {
|
|
258
|
-
href: this._href,
|
|
259
|
-
hidden: false,
|
|
260
|
-
};
|
|
267
|
+
}
|
|
268
|
+
catch (error) {
|
|
269
|
+
__classPrivateFieldGet(this, _SkyHrefDirective_instances, "m", _SkyHrefDirective_applyChanges).call(this, __classPrivateFieldGet(this, _SkyHrefDirective_instances, "m", _SkyHrefDirective_getChanges).call(this));
|
|
261
270
|
}
|
|
262
271
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
272
|
+
else {
|
|
273
|
+
// no resolver or skyHref is falsy
|
|
274
|
+
__classPrivateFieldGet(this, _SkyHrefDirective_route, "f").userHasAccess = !!this.skyHref;
|
|
275
|
+
__classPrivateFieldGet(this, _SkyHrefDirective_instances, "m", _SkyHrefDirective_applyChanges).call(this, __classPrivateFieldGet(this, _SkyHrefDirective_instances, "m", _SkyHrefDirective_getChanges).call(this));
|
|
267
276
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
return this.router.parseUrl(routePath);
|
|
277
|
+
}, _SkyHrefDirective_getChanges = function _SkyHrefDirective_getChanges() {
|
|
278
|
+
const queryParams = {};
|
|
279
|
+
if (!__classPrivateFieldGet(this, _SkyHrefDirective_route, "f") || !__classPrivateFieldGet(this, _SkyHrefDirective_route, "f").userHasAccess) {
|
|
280
|
+
return {
|
|
281
|
+
href: '',
|
|
282
|
+
hidden: this.skyHrefElse === 'hide',
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
const [beforeFragment, fragment] = __classPrivateFieldGet(this, _SkyHrefDirective_route, "f").url.split('#', 2);
|
|
287
|
+
const [baseUrl, search] = beforeFragment.split('?', 2);
|
|
288
|
+
if (search) {
|
|
289
|
+
const searchParams = new HttpParams({ fromString: search });
|
|
290
|
+
searchParams.keys().forEach((key) => {
|
|
291
|
+
queryParams[key] = searchParams.get(key);
|
|
292
|
+
});
|
|
285
293
|
}
|
|
286
|
-
|
|
294
|
+
const queryParamsMerged = new HttpParams({
|
|
295
|
+
fromObject: Object.assign({}, __classPrivateFieldGet(this, _SkyHrefDirective_instances, "m", _SkyHrefDirective_getSkyuxParams).call(this), queryParams),
|
|
296
|
+
});
|
|
297
|
+
__classPrivateFieldSet(this, _SkyHrefDirective_href, baseUrl +
|
|
298
|
+
(queryParamsMerged.keys().length > 0
|
|
299
|
+
? '?' + queryParamsMerged.toString()
|
|
300
|
+
: '') +
|
|
301
|
+
(fragment ? `#${fragment}` : ''), "f");
|
|
302
|
+
return {
|
|
303
|
+
href: __classPrivateFieldGet(this, _SkyHrefDirective_href, "f"),
|
|
304
|
+
hidden: false,
|
|
305
|
+
};
|
|
287
306
|
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
307
|
+
}, _SkyHrefDirective_getSkyuxParams = function _SkyHrefDirective_getSkyuxParams() {
|
|
308
|
+
return typeof __classPrivateFieldGet(this, _SkyHrefDirective_skyAppConfig, "f")?.runtime.params?.getAll === 'function'
|
|
309
|
+
? __classPrivateFieldGet(this, _SkyHrefDirective_skyAppConfig, "f").runtime.params.getAll(true)
|
|
310
|
+
: __classPrivateFieldGet(this, _SkyHrefDirective_paramsProvider, "f")?.params.getAll(true);
|
|
311
|
+
};
|
|
312
|
+
SkyHrefDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyHrefDirective, deps: [{ token: i1.Router }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i4.SkyAppConfig, optional: true }, { token: i4.SkyAppRuntimeConfigParamsProvider, optional: true }, { token: SkyHrefResolverService, optional: true }, { token: i0.ApplicationRef, optional: true }, { token: i0.ChangeDetectorRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
313
|
+
SkyHrefDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: SkyHrefDirective, selector: "[skyHref]", inputs: { skyHref: "skyHref", skyHrefElse: "skyHrefElse" }, outputs: { skyHrefChange: "skyHrefChange" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" } }, ngImport: i0 });
|
|
314
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyHrefDirective, decorators: [{
|
|
292
315
|
type: Directive,
|
|
293
316
|
args: [{
|
|
294
317
|
selector: '[skyHref]',
|
|
@@ -322,10 +345,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
322
345
|
|
|
323
346
|
class SkyHrefModule {
|
|
324
347
|
}
|
|
325
|
-
SkyHrefModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
326
|
-
SkyHrefModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "
|
|
327
|
-
SkyHrefModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
328
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
348
|
+
SkyHrefModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyHrefModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
349
|
+
SkyHrefModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: SkyHrefModule, declarations: [SkyHrefDirective], imports: [CommonModule], exports: [SkyHrefDirective] });
|
|
350
|
+
SkyHrefModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyHrefModule, imports: [CommonModule] });
|
|
351
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyHrefModule, decorators: [{
|
|
329
352
|
type: NgModule,
|
|
330
353
|
args: [{
|
|
331
354
|
declarations: [SkyHrefDirective],
|
|
@@ -339,9 +362,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
339
362
|
*/
|
|
340
363
|
class SkyRecentlyAccessedService {
|
|
341
364
|
}
|
|
342
|
-
SkyRecentlyAccessedService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
343
|
-
SkyRecentlyAccessedService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
344
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
365
|
+
SkyRecentlyAccessedService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyRecentlyAccessedService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
366
|
+
SkyRecentlyAccessedService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyRecentlyAccessedService });
|
|
367
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyRecentlyAccessedService, decorators: [{
|
|
345
368
|
type: Injectable
|
|
346
369
|
}] });
|
|
347
370
|
|