@skyux/core 6.4.0 → 6.5.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/documentation.json +3 -3
- package/esm2020/lib/modules/id/id.directive.mjs +11 -4
- package/fesm2015/skyux-core.mjs +9 -3
- package/fesm2015/skyux-core.mjs.map +1 -1
- package/fesm2020/skyux-core.mjs +9 -3
- package/fesm2020/skyux-core.mjs.map +1 -1
- package/lib/modules/id/id.directive.d.ts +1 -1
- package/package.json +2 -2
package/documentation.json
CHANGED
@@ -7287,7 +7287,7 @@
|
|
7287
7287
|
"sources": [
|
7288
7288
|
{
|
7289
7289
|
"fileName": "projects/core/src/modules/id/id.directive.ts",
|
7290
|
-
"line":
|
7290
|
+
"line": 30,
|
7291
7291
|
"character": 2
|
7292
7292
|
}
|
7293
7293
|
],
|
@@ -7351,7 +7351,7 @@
|
|
7351
7351
|
"sources": [
|
7352
7352
|
{
|
7353
7353
|
"fileName": "projects/core/src/modules/id/id.directive.ts",
|
7354
|
-
"line":
|
7354
|
+
"line": 24,
|
7355
7355
|
"character": 13
|
7356
7356
|
}
|
7357
7357
|
],
|
@@ -7389,7 +7389,7 @@
|
|
7389
7389
|
"sources": [
|
7390
7390
|
{
|
7391
7391
|
"fileName": "projects/core/src/modules/id/id.directive.ts",
|
7392
|
-
"line":
|
7392
|
+
"line": 23,
|
7393
7393
|
"character": 13
|
7394
7394
|
}
|
7395
7395
|
]
|
@@ -1,9 +1,14 @@
|
|
1
|
+
var _SkyIdDirective__id;
|
2
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
1
3
|
import { Directive, ElementRef, Renderer2 } from '@angular/core';
|
2
4
|
import * as i0 from "@angular/core";
|
3
5
|
let idIndex = 0;
|
4
6
|
function generateId() {
|
5
7
|
idIndex++;
|
6
|
-
|
8
|
+
// Include timestamp and an incrementing index to guarantee unique IDs both during the application
|
9
|
+
// lifecycle as well as across sessions, since browsers will try to apply autocomplete options to
|
10
|
+
// elements with the same ID across sessions.
|
11
|
+
return `sky-id-gen__${new Date().getTime()}__${idIndex}`;
|
7
12
|
}
|
8
13
|
/**
|
9
14
|
* Sets the element's `id` attribute to a unique ID. To reference this unique ID on other elements,
|
@@ -12,16 +17,18 @@ function generateId() {
|
|
12
17
|
*/
|
13
18
|
export class SkyIdDirective {
|
14
19
|
constructor(elRef, renderer) {
|
20
|
+
_SkyIdDirective__id.set(this, void 0);
|
15
21
|
// Generate and apply the ID before the template is rendered
|
16
22
|
// to avoid a changed-after-checked error.
|
17
23
|
const id = generateId();
|
18
24
|
renderer.setAttribute(elRef.nativeElement, 'id', id);
|
19
|
-
this
|
25
|
+
__classPrivateFieldSet(this, _SkyIdDirective__id, id, "f");
|
20
26
|
}
|
21
27
|
get id() {
|
22
|
-
return this
|
28
|
+
return __classPrivateFieldGet(this, _SkyIdDirective__id, "f");
|
23
29
|
}
|
24
30
|
}
|
31
|
+
_SkyIdDirective__id = new WeakMap();
|
25
32
|
SkyIdDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyIdDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
26
33
|
SkyIdDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.2", type: SkyIdDirective, selector: "[skyId]", exportAs: ["skyId"], ngImport: i0 });
|
27
34
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyIdDirective, decorators: [{
|
@@ -31,4 +38,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
31
38
|
exportAs: 'skyId',
|
32
39
|
}]
|
33
40
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; } });
|
34
|
-
//# sourceMappingURL=data:application/json;base64,
|
41
|
+
//# sourceMappingURL=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WN0b3I6ICdbc2t5SWRdJyxcbiAgZXhwb3J0QXM6ICdza3lJZCcsXG59KVxuZXhwb3J0IGNsYXNzIFNreUlkRGlyZWN0aXZlIHtcbiAgcHVibGljIGdldCBpZCgpOiBzdHJpbmcge1xuICAgIHJldHVybiB0aGlzLiNfaWQ7XG4gIH1cblxuICAjX2lkOiBzdHJpbmc7XG5cbiAgY29uc3RydWN0b3IoZWxSZWY6IEVsZW1lbnRSZWYsIHJlbmRlcmVyOiBSZW5kZXJlcjIpIHtcbiAgICAvLyBHZW5lcmF0ZSBhbmQgYXBwbHkgdGhlIElEIGJlZm9yZSB0aGUgdGVtcGxhdGUgaXMgcmVuZGVyZWRcbiAgICAvLyB0byBhdm9pZCBhIGNoYW5nZWQtYWZ0ZXItY2hlY2tlZCBlcnJvci5cbiAgICBjb25zdCBpZCA9IGdlbmVyYXRlSWQoKTtcblxuICAgIHJlbmRlcmVyLnNldEF0dHJpYnV0ZShlbFJlZi5uYXRpdmVFbGVtZW50LCAnaWQnLCBpZCk7XG5cbiAgICB0aGlzLiNfaWQgPSBpZDtcbiAgfVxufVxuIl19
|
package/fesm2015/skyux-core.mjs
CHANGED
@@ -1345,10 +1345,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
1345
1345
|
}]
|
1346
1346
|
}] });
|
1347
1347
|
|
1348
|
+
var _SkyIdDirective__id;
|
1348
1349
|
let idIndex = 0;
|
1349
1350
|
function generateId() {
|
1350
1351
|
idIndex++;
|
1351
|
-
|
1352
|
+
// Include timestamp and an incrementing index to guarantee unique IDs both during the application
|
1353
|
+
// lifecycle as well as across sessions, since browsers will try to apply autocomplete options to
|
1354
|
+
// elements with the same ID across sessions.
|
1355
|
+
return `sky-id-gen__${new Date().getTime()}__${idIndex}`;
|
1352
1356
|
}
|
1353
1357
|
/**
|
1354
1358
|
* Sets the element's `id` attribute to a unique ID. To reference this unique ID on other elements,
|
@@ -1357,16 +1361,18 @@ function generateId() {
|
|
1357
1361
|
*/
|
1358
1362
|
class SkyIdDirective {
|
1359
1363
|
constructor(elRef, renderer) {
|
1364
|
+
_SkyIdDirective__id.set(this, void 0);
|
1360
1365
|
// Generate and apply the ID before the template is rendered
|
1361
1366
|
// to avoid a changed-after-checked error.
|
1362
1367
|
const id = generateId();
|
1363
1368
|
renderer.setAttribute(elRef.nativeElement, 'id', id);
|
1364
|
-
this
|
1369
|
+
__classPrivateFieldSet(this, _SkyIdDirective__id, id, "f");
|
1365
1370
|
}
|
1366
1371
|
get id() {
|
1367
|
-
return this
|
1372
|
+
return __classPrivateFieldGet(this, _SkyIdDirective__id, "f");
|
1368
1373
|
}
|
1369
1374
|
}
|
1375
|
+
_SkyIdDirective__id = new WeakMap();
|
1370
1376
|
SkyIdDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyIdDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
1371
1377
|
SkyIdDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.2", type: SkyIdDirective, selector: "[skyId]", exportAs: ["skyId"], ngImport: i0 });
|
1372
1378
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyIdDirective, decorators: [{
|