@skyux/router 5.7.1 → 6.0.0-beta.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.
Files changed (46) hide show
  1. package/esm2020/index.mjs +13 -0
  2. package/esm2020/lib/modules/href/href-query-params.mjs +2 -0
  3. package/esm2020/lib/modules/href/href-resolver.mjs +2 -0
  4. package/esm2020/lib/modules/href/href-resolver.service.mjs +19 -0
  5. package/esm2020/lib/modules/href/href.directive.mjs +195 -0
  6. package/esm2020/lib/modules/href/href.module.mjs +18 -0
  7. package/esm2020/lib/modules/href/types/href-resolver.args.mjs +2 -0
  8. package/esm2020/lib/modules/href/types/href.mjs +2 -0
  9. package/esm2020/lib/modules/link/link-external.directive.mjs +58 -0
  10. package/esm2020/lib/modules/link/link-query-params.mjs +2 -0
  11. package/esm2020/lib/modules/link/link.directive.mjs +43 -0
  12. package/esm2020/lib/modules/link/link.module.mjs +18 -0
  13. package/esm2020/skyux-router.mjs +5 -0
  14. package/fesm2015/skyux-router.mjs +340 -0
  15. package/fesm2015/skyux-router.mjs.map +1 -0
  16. package/{fesm2015/skyux-router.js → fesm2020/skyux-router.mjs} +27 -31
  17. package/fesm2020/skyux-router.mjs.map +1 -0
  18. package/package.json +24 -11
  19. package/bundles/skyux-router.umd.js +0 -720
  20. package/esm2015/index.js +0 -13
  21. package/esm2015/index.js.map +0 -1
  22. package/esm2015/lib/modules/href/href-query-params.js +0 -2
  23. package/esm2015/lib/modules/href/href-query-params.js.map +0 -1
  24. package/esm2015/lib/modules/href/href-resolver.js +0 -2
  25. package/esm2015/lib/modules/href/href-resolver.js.map +0 -1
  26. package/esm2015/lib/modules/href/href-resolver.service.js +0 -19
  27. package/esm2015/lib/modules/href/href-resolver.service.js.map +0 -1
  28. package/esm2015/lib/modules/href/href.directive.js +0 -197
  29. package/esm2015/lib/modules/href/href.directive.js.map +0 -1
  30. package/esm2015/lib/modules/href/href.module.js +0 -18
  31. package/esm2015/lib/modules/href/href.module.js.map +0 -1
  32. package/esm2015/lib/modules/href/types/href-resolver.args.js +0 -2
  33. package/esm2015/lib/modules/href/types/href-resolver.args.js.map +0 -1
  34. package/esm2015/lib/modules/href/types/href.js +0 -2
  35. package/esm2015/lib/modules/href/types/href.js.map +0 -1
  36. package/esm2015/lib/modules/link/link-external.directive.js +0 -59
  37. package/esm2015/lib/modules/link/link-external.directive.js.map +0 -1
  38. package/esm2015/lib/modules/link/link-query-params.js +0 -2
  39. package/esm2015/lib/modules/link/link-query-params.js.map +0 -1
  40. package/esm2015/lib/modules/link/link.directive.js +0 -44
  41. package/esm2015/lib/modules/link/link.directive.js.map +0 -1
  42. package/esm2015/lib/modules/link/link.module.js +0 -18
  43. package/esm2015/lib/modules/link/link.module.js.map +0 -1
  44. package/esm2015/skyux-router.js +0 -5
  45. package/esm2015/skyux-router.js.map +0 -1
  46. package/fesm2015/skyux-router.js.map +0 -1
@@ -1,720 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/router'), require('@skyux/core'), require('@skyux/config'), require('@angular/common/http')) :
3
- typeof define === 'function' && define.amd ? define('@skyux/router', ['exports', '@angular/core', '@angular/common', '@angular/router', '@skyux/core', '@skyux/config', '@angular/common/http'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.skyux = global.skyux || {}, global.skyux.router = {}), global.ng.core, global.ng.common, global.ng.router, global.i3, global.i4, global.ng.common.http));
5
- })(this, (function (exports, i0, i2, i1, i3, i4, http) { 'use strict';
6
-
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () { return e[k]; }
17
- });
18
- }
19
- });
20
- }
21
- n["default"] = e;
22
- return Object.freeze(n);
23
- }
24
-
25
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
- var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
27
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
28
- var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
29
- var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
30
-
31
- /*! *****************************************************************************
32
- Copyright (c) Microsoft Corporation.
33
-
34
- Permission to use, copy, modify, and/or distribute this software for any
35
- purpose with or without fee is hereby granted.
36
-
37
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
38
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
39
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
40
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
41
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
42
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
43
- PERFORMANCE OF THIS SOFTWARE.
44
- ***************************************************************************** */
45
- /* global Reflect, Promise */
46
- var extendStatics = function (d, b) {
47
- extendStatics = Object.setPrototypeOf ||
48
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
49
- function (d, b) { for (var p in b)
50
- if (Object.prototype.hasOwnProperty.call(b, p))
51
- d[p] = b[p]; };
52
- return extendStatics(d, b);
53
- };
54
- function __extends(d, b) {
55
- if (typeof b !== "function" && b !== null)
56
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
57
- extendStatics(d, b);
58
- function __() { this.constructor = d; }
59
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
60
- }
61
- var __assign = function () {
62
- __assign = Object.assign || function __assign(t) {
63
- for (var s, i = 1, n = arguments.length; i < n; i++) {
64
- s = arguments[i];
65
- for (var p in s)
66
- if (Object.prototype.hasOwnProperty.call(s, p))
67
- t[p] = s[p];
68
- }
69
- return t;
70
- };
71
- return __assign.apply(this, arguments);
72
- };
73
- function __rest(s, e) {
74
- var t = {};
75
- for (var p in s)
76
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
77
- t[p] = s[p];
78
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
79
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
80
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
81
- t[p[i]] = s[p[i]];
82
- }
83
- return t;
84
- }
85
- function __decorate(decorators, target, key, desc) {
86
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
87
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
88
- r = Reflect.decorate(decorators, target, key, desc);
89
- else
90
- for (var i = decorators.length - 1; i >= 0; i--)
91
- if (d = decorators[i])
92
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
93
- return c > 3 && r && Object.defineProperty(target, key, r), r;
94
- }
95
- function __param(paramIndex, decorator) {
96
- return function (target, key) { decorator(target, key, paramIndex); };
97
- }
98
- function __metadata(metadataKey, metadataValue) {
99
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
100
- return Reflect.metadata(metadataKey, metadataValue);
101
- }
102
- function __awaiter(thisArg, _arguments, P, generator) {
103
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
104
- return new (P || (P = Promise))(function (resolve, reject) {
105
- function fulfilled(value) { try {
106
- step(generator.next(value));
107
- }
108
- catch (e) {
109
- reject(e);
110
- } }
111
- function rejected(value) { try {
112
- step(generator["throw"](value));
113
- }
114
- catch (e) {
115
- reject(e);
116
- } }
117
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
118
- step((generator = generator.apply(thisArg, _arguments || [])).next());
119
- });
120
- }
121
- function __generator(thisArg, body) {
122
- var _ = { label: 0, sent: function () { if (t[0] & 1)
123
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
124
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
125
- function verb(n) { return function (v) { return step([n, v]); }; }
126
- function step(op) {
127
- if (f)
128
- throw new TypeError("Generator is already executing.");
129
- while (_)
130
- try {
131
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
132
- return t;
133
- if (y = 0, t)
134
- op = [op[0] & 2, t.value];
135
- switch (op[0]) {
136
- case 0:
137
- case 1:
138
- t = op;
139
- break;
140
- case 4:
141
- _.label++;
142
- return { value: op[1], done: false };
143
- case 5:
144
- _.label++;
145
- y = op[1];
146
- op = [0];
147
- continue;
148
- case 7:
149
- op = _.ops.pop();
150
- _.trys.pop();
151
- continue;
152
- default:
153
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
154
- _ = 0;
155
- continue;
156
- }
157
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
158
- _.label = op[1];
159
- break;
160
- }
161
- if (op[0] === 6 && _.label < t[1]) {
162
- _.label = t[1];
163
- t = op;
164
- break;
165
- }
166
- if (t && _.label < t[2]) {
167
- _.label = t[2];
168
- _.ops.push(op);
169
- break;
170
- }
171
- if (t[2])
172
- _.ops.pop();
173
- _.trys.pop();
174
- continue;
175
- }
176
- op = body.call(thisArg, _);
177
- }
178
- catch (e) {
179
- op = [6, e];
180
- y = 0;
181
- }
182
- finally {
183
- f = t = 0;
184
- }
185
- if (op[0] & 5)
186
- throw op[1];
187
- return { value: op[0] ? op[1] : void 0, done: true };
188
- }
189
- }
190
- var __createBinding = Object.create ? (function (o, m, k, k2) {
191
- if (k2 === undefined)
192
- k2 = k;
193
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
194
- }) : (function (o, m, k, k2) {
195
- if (k2 === undefined)
196
- k2 = k;
197
- o[k2] = m[k];
198
- });
199
- function __exportStar(m, o) {
200
- for (var p in m)
201
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
202
- __createBinding(o, m, p);
203
- }
204
- function __values(o) {
205
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
206
- if (m)
207
- return m.call(o);
208
- if (o && typeof o.length === "number")
209
- return {
210
- next: function () {
211
- if (o && i >= o.length)
212
- o = void 0;
213
- return { value: o && o[i++], done: !o };
214
- }
215
- };
216
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
217
- }
218
- function __read(o, n) {
219
- var m = typeof Symbol === "function" && o[Symbol.iterator];
220
- if (!m)
221
- return o;
222
- var i = m.call(o), r, ar = [], e;
223
- try {
224
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
225
- ar.push(r.value);
226
- }
227
- catch (error) {
228
- e = { error: error };
229
- }
230
- finally {
231
- try {
232
- if (r && !r.done && (m = i["return"]))
233
- m.call(i);
234
- }
235
- finally {
236
- if (e)
237
- throw e.error;
238
- }
239
- }
240
- return ar;
241
- }
242
- /** @deprecated */
243
- function __spread() {
244
- for (var ar = [], i = 0; i < arguments.length; i++)
245
- ar = ar.concat(__read(arguments[i]));
246
- return ar;
247
- }
248
- /** @deprecated */
249
- function __spreadArrays() {
250
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
251
- s += arguments[i].length;
252
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
253
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
254
- r[k] = a[j];
255
- return r;
256
- }
257
- function __spreadArray(to, from, pack) {
258
- if (pack || arguments.length === 2)
259
- for (var i = 0, l = from.length, ar; i < l; i++) {
260
- if (ar || !(i in from)) {
261
- if (!ar)
262
- ar = Array.prototype.slice.call(from, 0, i);
263
- ar[i] = from[i];
264
- }
265
- }
266
- return to.concat(ar || Array.prototype.slice.call(from));
267
- }
268
- function __await(v) {
269
- return this instanceof __await ? (this.v = v, this) : new __await(v);
270
- }
271
- function __asyncGenerator(thisArg, _arguments, generator) {
272
- if (!Symbol.asyncIterator)
273
- throw new TypeError("Symbol.asyncIterator is not defined.");
274
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
275
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
276
- function verb(n) { if (g[n])
277
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
278
- function resume(n, v) { try {
279
- step(g[n](v));
280
- }
281
- catch (e) {
282
- settle(q[0][3], e);
283
- } }
284
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
285
- function fulfill(value) { resume("next", value); }
286
- function reject(value) { resume("throw", value); }
287
- function settle(f, v) { if (f(v), q.shift(), q.length)
288
- resume(q[0][0], q[0][1]); }
289
- }
290
- function __asyncDelegator(o) {
291
- var i, p;
292
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
293
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
294
- }
295
- function __asyncValues(o) {
296
- if (!Symbol.asyncIterator)
297
- throw new TypeError("Symbol.asyncIterator is not defined.");
298
- var m = o[Symbol.asyncIterator], i;
299
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
300
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
301
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
302
- }
303
- function __makeTemplateObject(cooked, raw) {
304
- if (Object.defineProperty) {
305
- Object.defineProperty(cooked, "raw", { value: raw });
306
- }
307
- else {
308
- cooked.raw = raw;
309
- }
310
- return cooked;
311
- }
312
- ;
313
- var __setModuleDefault = Object.create ? (function (o, v) {
314
- Object.defineProperty(o, "default", { enumerable: true, value: v });
315
- }) : function (o, v) {
316
- o["default"] = v;
317
- };
318
- function __importStar(mod) {
319
- if (mod && mod.__esModule)
320
- return mod;
321
- var result = {};
322
- if (mod != null)
323
- for (var k in mod)
324
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
325
- __createBinding(result, mod, k);
326
- __setModuleDefault(result, mod);
327
- return result;
328
- }
329
- function __importDefault(mod) {
330
- return (mod && mod.__esModule) ? mod : { default: mod };
331
- }
332
- function __classPrivateFieldGet(receiver, state, kind, f) {
333
- if (kind === "a" && !f)
334
- throw new TypeError("Private accessor was defined without a getter");
335
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
336
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
337
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
338
- }
339
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
340
- if (kind === "m")
341
- throw new TypeError("Private method is not writable");
342
- if (kind === "a" && !f)
343
- throw new TypeError("Private accessor was defined without a setter");
344
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
345
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
346
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
347
- }
348
-
349
- /**
350
- * @deprecated Use `skyHref` directive instead.
351
- */
352
- var SkyAppLinkExternalDirective = /** @class */ (function (_super) {
353
- __extends(SkyAppLinkExternalDirective, _super);
354
- function SkyAppLinkExternalDirective(router, route, platformLocation, window, skyAppConfig, paramsProvider, hostConfig) {
355
- var _this = _super.call(this, router, route, new i2.PathLocationStrategy(platformLocation, hostConfig ? hostConfig.host.url : skyAppConfig.skyux.host.url)) || this;
356
- _this.window = window;
357
- _this.skyAppConfig = skyAppConfig;
358
- _this.paramsProvider = paramsProvider;
359
- if (_this.window.nativeWindow.window.name &&
360
- _this.window.nativeWindow.window.name !== '') {
361
- _this.target = _this.window.nativeWindow.window.name;
362
- }
363
- else {
364
- _this.target = '_top';
365
- }
366
- return _this;
367
- }
368
- Object.defineProperty(SkyAppLinkExternalDirective.prototype, "skyAppLinkExternal", {
369
- set: function (commands) {
370
- this.routerLink = commands;
371
- },
372
- enumerable: false,
373
- configurable: true
374
- });
375
- SkyAppLinkExternalDirective.prototype.ngOnChanges = function (changes) {
376
- var _a;
377
- this.queryParams = this.mergeQueryParams((_a = changes.queryParams) === null || _a === void 0 ? void 0 : _a.currentValue);
378
- _super.prototype.ngOnChanges.call(this, changes);
379
- };
380
- SkyAppLinkExternalDirective.prototype.mergeQueryParams = function (queryParams) {
381
- var skyuxParams = this.skyAppConfig
382
- ? this.skyAppConfig.runtime.params.getAll()
383
- : this.paramsProvider.params.getAll();
384
- return Object.assign({}, this.queryParams, queryParams, skyuxParams);
385
- };
386
- return SkyAppLinkExternalDirective;
387
- }(i1.RouterLinkWithHref));
388
- SkyAppLinkExternalDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAppLinkExternalDirective, deps: [{ token: i1__namespace.Router }, { token: i1__namespace.ActivatedRoute }, { token: i2__namespace.PlatformLocation }, { token: i3__namespace.SkyAppWindowRef }, { token: i4__namespace.SkyAppConfig, optional: true }, { token: i4__namespace.SkyAppRuntimeConfigParamsProvider, optional: true }, { token: i4__namespace.SkyAppConfigHost, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Directive });
389
- SkyAppLinkExternalDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: SkyAppLinkExternalDirective, selector: "[skyAppLinkExternal]", inputs: { skyAppLinkExternal: "skyAppLinkExternal" }, usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
390
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAppLinkExternalDirective, decorators: [{
391
- type: i0.Directive,
392
- args: [{
393
- selector: '[skyAppLinkExternal]',
394
- }]
395
- }], ctorParameters: function () {
396
- return [{ type: i1__namespace.Router }, { type: i1__namespace.ActivatedRoute }, { type: i2__namespace.PlatformLocation }, { type: i3__namespace.SkyAppWindowRef }, { type: i4__namespace.SkyAppConfig, decorators: [{
397
- type: i0.Optional
398
- }] }, { type: i4__namespace.SkyAppRuntimeConfigParamsProvider, decorators: [{
399
- type: i0.Optional
400
- }] }, { type: i4__namespace.SkyAppConfigHost, decorators: [{
401
- type: i0.Optional
402
- }] }];
403
- }, propDecorators: { skyAppLinkExternal: [{
404
- type: i0.Input
405
- }] } });
406
-
407
- var SkyAppLinkDirective = /** @class */ (function (_super) {
408
- __extends(SkyAppLinkDirective, _super);
409
- function SkyAppLinkDirective(router, route, locationStrategy, skyAppConfig, paramsProvider) {
410
- var _this = _super.call(this, router, route, locationStrategy) || this;
411
- _this.skyAppConfig = skyAppConfig;
412
- _this.paramsProvider = paramsProvider;
413
- return _this;
414
- }
415
- Object.defineProperty(SkyAppLinkDirective.prototype, "skyAppLink", {
416
- set: function (commands) {
417
- this.routerLink = commands;
418
- },
419
- enumerable: false,
420
- configurable: true
421
- });
422
- SkyAppLinkDirective.prototype.ngOnChanges = function (changes) {
423
- var _a;
424
- this.queryParams = this.mergeQueryParams((_a = changes.queryParams) === null || _a === void 0 ? void 0 : _a.currentValue);
425
- _super.prototype.ngOnChanges.call(this, changes);
426
- };
427
- SkyAppLinkDirective.prototype.mergeQueryParams = function (queryParams) {
428
- var skyuxParams = this.skyAppConfig
429
- ? this.skyAppConfig.runtime.params.getAll(true)
430
- : this.paramsProvider.params.getAll(true);
431
- return Object.assign({}, this.queryParams, queryParams, skyuxParams);
432
- };
433
- return SkyAppLinkDirective;
434
- }(i1.RouterLinkWithHref));
435
- SkyAppLinkDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAppLinkDirective, deps: [{ token: i1__namespace.Router }, { token: i1__namespace.ActivatedRoute }, { token: i2__namespace.LocationStrategy }, { token: i4__namespace.SkyAppConfig, optional: true }, { token: i4__namespace.SkyAppRuntimeConfigParamsProvider, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Directive });
436
- SkyAppLinkDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: SkyAppLinkDirective, selector: "[skyAppLink]", inputs: { skyAppLink: "skyAppLink" }, usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
437
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAppLinkDirective, decorators: [{
438
- type: i0.Directive,
439
- args: [{
440
- selector: '[skyAppLink]',
441
- }]
442
- }], ctorParameters: function () {
443
- return [{ type: i1__namespace.Router }, { type: i1__namespace.ActivatedRoute }, { type: i2__namespace.LocationStrategy }, { type: i4__namespace.SkyAppConfig, decorators: [{
444
- type: i0.Optional
445
- }] }, { type: i4__namespace.SkyAppRuntimeConfigParamsProvider, decorators: [{
446
- type: i0.Optional
447
- }] }];
448
- }, propDecorators: { skyAppLink: [{
449
- type: i0.Input
450
- }] } });
451
-
452
- /* istanbul ignore next */
453
- var SkyAppLinkModule = /** @class */ (function () {
454
- function SkyAppLinkModule() {
455
- }
456
- return SkyAppLinkModule;
457
- }());
458
- SkyAppLinkModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAppLinkModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
459
- SkyAppLinkModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAppLinkModule, declarations: [SkyAppLinkDirective, SkyAppLinkExternalDirective], exports: [SkyAppLinkDirective, SkyAppLinkExternalDirective] });
460
- SkyAppLinkModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAppLinkModule });
461
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAppLinkModule, decorators: [{
462
- type: i0.NgModule,
463
- args: [{
464
- declarations: [SkyAppLinkDirective, SkyAppLinkExternalDirective],
465
- exports: [SkyAppLinkDirective, SkyAppLinkExternalDirective],
466
- }]
467
- }] });
468
-
469
- /**
470
- * Return the link as-is.
471
- */
472
- var SkyHrefResolverService = /** @class */ (function () {
473
- function SkyHrefResolverService() {
474
- }
475
- SkyHrefResolverService.prototype.resolveHref = function (args) {
476
- return Promise.resolve({
477
- url: args.url,
478
- userHasAccess: true,
479
- });
480
- };
481
- return SkyHrefResolverService;
482
- }());
483
- SkyHrefResolverService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyHrefResolverService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
484
- SkyHrefResolverService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyHrefResolverService });
485
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyHrefResolverService, decorators: [{
486
- type: i0.Injectable
487
- }] });
488
-
489
- var SkyHrefDirective = /** @class */ (function () {
490
- function SkyHrefDirective(router, renderer, element, skyAppConfig, paramsProvider, hrefResolver, applicationRef, changeDetectorRef) {
491
- this.router = router;
492
- this.renderer = renderer;
493
- this.element = element;
494
- this.skyAppConfig = skyAppConfig;
495
- this.paramsProvider = paramsProvider;
496
- this.hrefResolver = hrefResolver;
497
- this.applicationRef = applicationRef;
498
- this.changeDetectorRef = changeDetectorRef;
499
- this._route = false;
500
- this._skyHref = '';
501
- this._skyHrefElse = 'hide';
502
- }
503
- Object.defineProperty(SkyHrefDirective.prototype, "skyHref", {
504
- /**
505
- * Provide a link as a string or as an array of strings to be joined by a slash to form a complete
506
- * URL.
507
- *
508
- * @param skyHref
509
- */
510
- set: function (skyHref) {
511
- if (typeof skyHref === 'string') {
512
- this._skyHref = skyHref;
513
- }
514
- else {
515
- this._skyHref = skyHref.join('/');
516
- }
517
- this.checkRouteAccess();
518
- },
519
- enumerable: false,
520
- configurable: true
521
- });
522
- Object.defineProperty(SkyHrefDirective.prototype, "skyHrefElse", {
523
- set: function (value) {
524
- this._skyHrefElse = value;
525
- this.applyChanges(this.getChanges());
526
- },
527
- enumerable: false,
528
- configurable: true
529
- });
530
- /* istanbul ignore next */
531
- SkyHrefDirective.prototype.onClick = function (button, ctrlKey, shiftKey, altKey, metaKey) {
532
- if (!this._route || !this._route.userHasAccess) {
533
- return false;
534
- }
535
- if (button !== 0 || ctrlKey || shiftKey || altKey || metaKey) {
536
- return true;
537
- }
538
- var target = this.element.nativeElement.getAttribute('target');
539
- if (typeof target === 'string' && target !== '_self') {
540
- return true;
541
- }
542
- var urlTree = this.getUrlTree();
543
- if (urlTree) {
544
- this.router.navigateByUrl(urlTree);
545
- return false;
546
- }
547
- return true;
548
- };
549
- SkyHrefDirective.prototype.applyChanges = function (change) {
550
- this.renderer.addClass(this.element.nativeElement, 'sky-href');
551
- if (change.hidden) {
552
- this.renderer.setAttribute(this.element.nativeElement, 'hidden', 'hidden');
553
- }
554
- else {
555
- this.renderer.removeAttribute(this.element.nativeElement, 'hidden');
556
- }
557
- if (change.href) {
558
- this.renderer.setAttribute(this.element.nativeElement, 'href', change.href);
559
- }
560
- else {
561
- this.renderer.removeAttribute(this.element.nativeElement, 'href');
562
- }
563
- };
564
- SkyHrefDirective.prototype.checkRouteAccess = function () {
565
- var _this = this;
566
- this._route = {
567
- url: this._skyHref,
568
- userHasAccess: false,
569
- };
570
- /* istanbul ignore else */
571
- if (this.hrefResolver && this._skyHref) {
572
- this.applyChanges(this.getChanges());
573
- try {
574
- this.hrefResolver.resolveHref({ url: this._skyHref }).then(function (route) {
575
- _this._route = Object.assign({}, route);
576
- _this.applyChanges(_this.getChanges());
577
- /* istanbul ignore else */
578
- if (_this.changeDetectorRef && _this.applicationRef) {
579
- _this.changeDetectorRef.markForCheck();
580
- _this.applicationRef.tick();
581
- }
582
- });
583
- }
584
- catch (error) {
585
- this.applyChanges(this.getChanges());
586
- }
587
- }
588
- else {
589
- // no resolver or skyHref is falsy
590
- this._route.userHasAccess = !!this._skyHref;
591
- this.applyChanges(this.getChanges());
592
- }
593
- };
594
- SkyHrefDirective.prototype.getChanges = function () {
595
- var queryParams = {};
596
- if (!this._route || !this._route.userHasAccess) {
597
- return {
598
- href: '',
599
- hidden: this._skyHrefElse === 'hide',
600
- };
601
- }
602
- else {
603
- var _f = __read(this._route.url.split('#', 2), 2), beforeFragment = _f[0], fragment = _f[1];
604
- var _g = __read(beforeFragment.split('?', 2), 2), baseUrl = _g[0], search = _g[1];
605
- if (search) {
606
- var searchParams_1 = new http.HttpParams({ fromString: search });
607
- searchParams_1.keys().forEach(function (key) {
608
- queryParams[key] = searchParams_1.get(key);
609
- });
610
- }
611
- var queryParamsMerged = new http.HttpParams({
612
- fromObject: Object.assign({}, this.getSkyuxParams(), queryParams),
613
- });
614
- this._href =
615
- baseUrl +
616
- (queryParamsMerged.keys().length > 0
617
- ? '?' + queryParamsMerged.toString()
618
- : '') +
619
- (fragment ? "#" + fragment : '');
620
- return {
621
- href: this._href,
622
- hidden: false,
623
- };
624
- }
625
- };
626
- SkyHrefDirective.prototype.getSkyuxParams = function () {
627
- var _a, _b;
628
- return typeof ((_b = (_a = this.skyAppConfig) === null || _a === void 0 ? void 0 : _a.runtime.params) === null || _b === void 0 ? void 0 : _b.getAll) === 'function'
629
- ? this.skyAppConfig.runtime.params.getAll(true)
630
- : this.paramsProvider.params.getAll(true);
631
- };
632
- /* istanbul ignore next */
633
- SkyHrefDirective.prototype.getUrlTree = function () {
634
- var _a, _b, _c, _d, _e;
635
- var href = this._href.toLowerCase();
636
- if (!href ||
637
- !((_b = (_a = this.skyAppConfig) === null || _a === void 0 ? void 0 : _a.skyux.host) === null || _b === void 0 ? void 0 : _b.url) ||
638
- !((_e = (_d = (_c = this.skyAppConfig) === null || _c === void 0 ? void 0 : _c.runtime) === null || _d === void 0 ? void 0 : _d.app) === null || _e === void 0 ? void 0 : _e.base)) {
639
- return false;
640
- }
641
- var baseUrl = (this.skyAppConfig.skyux.host.url +
642
- this.skyAppConfig.runtime.app.base.substr(0, this.skyAppConfig.runtime.app.base.length - 1)).toLowerCase();
643
- if (href === baseUrl ||
644
- // Make sure the base URL is not simply a partial match of the base URL plus additional
645
- // characters after the base URL that are not "terminating" characters
646
- href.indexOf(baseUrl + '/') === 0 ||
647
- href.indexOf(baseUrl + '?') === 0) {
648
- var routePath = this._href.substring(baseUrl.length);
649
- return this.router.parseUrl(routePath);
650
- }
651
- return false;
652
- };
653
- return SkyHrefDirective;
654
- }());
655
- SkyHrefDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyHrefDirective, deps: [{ token: i1__namespace.Router }, { token: i0__namespace.Renderer2 }, { token: i0__namespace.ElementRef }, { token: i4__namespace.SkyAppConfig, optional: true }, { token: i4__namespace.SkyAppRuntimeConfigParamsProvider, optional: true }, { token: SkyHrefResolverService, optional: true }, { token: i0__namespace.ApplicationRef, optional: true }, { token: i0__namespace.ChangeDetectorRef, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Directive });
656
- SkyHrefDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: SkyHrefDirective, selector: "[skyHref]", inputs: { skyHref: "skyHref", skyHrefElse: "skyHrefElse" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" } }, ngImport: i0__namespace });
657
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyHrefDirective, decorators: [{
658
- type: i0.Directive,
659
- args: [{
660
- selector: '[skyHref]',
661
- }]
662
- }], ctorParameters: function () {
663
- return [{ type: i1__namespace.Router }, { type: i0__namespace.Renderer2 }, { type: i0__namespace.ElementRef }, { type: i4__namespace.SkyAppConfig, decorators: [{
664
- type: i0.Optional
665
- }] }, { type: i4__namespace.SkyAppRuntimeConfigParamsProvider, decorators: [{
666
- type: i0.Optional
667
- }] }, { type: SkyHrefResolverService, decorators: [{
668
- type: i0.Optional
669
- }] }, { type: i0__namespace.ApplicationRef, decorators: [{
670
- type: i0.Optional
671
- }] }, { type: i0__namespace.ChangeDetectorRef, decorators: [{
672
- type: i0.Optional
673
- }] }];
674
- }, propDecorators: { skyHref: [{
675
- type: i0.Input
676
- }], skyHrefElse: [{
677
- type: i0.Input
678
- }], onClick: [{
679
- type: i0.HostListener,
680
- args: ['click', [
681
- '$event.button',
682
- '$event.ctrlKey',
683
- '$event.shiftKey',
684
- '$event.altKey',
685
- '$event.metaKey',
686
- ]]
687
- }] } });
688
-
689
- var SkyHrefModule = /** @class */ (function () {
690
- function SkyHrefModule() {
691
- }
692
- return SkyHrefModule;
693
- }());
694
- SkyHrefModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyHrefModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
695
- SkyHrefModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyHrefModule, declarations: [SkyHrefDirective], imports: [i2.CommonModule], exports: [SkyHrefDirective] });
696
- SkyHrefModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyHrefModule, imports: [[i2.CommonModule]] });
697
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyHrefModule, decorators: [{
698
- type: i0.NgModule,
699
- args: [{
700
- declarations: [SkyHrefDirective],
701
- exports: [SkyHrefDirective],
702
- imports: [i2.CommonModule],
703
- }]
704
- }] });
705
-
706
- /**
707
- * Generated bundle index. Do not edit.
708
- */
709
-
710
- exports.SkyAppLinkModule = SkyAppLinkModule;
711
- exports.SkyHrefModule = SkyHrefModule;
712
- exports.SkyHrefResolverService = SkyHrefResolverService;
713
- exports["λ1"] = SkyHrefDirective;
714
- exports["λ2"] = SkyAppLinkExternalDirective;
715
- exports["λ3"] = SkyAppLinkDirective;
716
-
717
- Object.defineProperty(exports, '__esModule', { value: true });
718
-
719
- }));
720
- //# sourceMappingURL=skyux-router.umd.js.map