@skyux/core 6.4.0 → 6.7.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/fesm2020/skyux-core.mjs
CHANGED
@@ -1344,10 +1344,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
1344
1344
|
}]
|
1345
1345
|
}] });
|
1346
1346
|
|
1347
|
+
var _SkyIdDirective__id;
|
1347
1348
|
let idIndex = 0;
|
1348
1349
|
function generateId() {
|
1349
1350
|
idIndex++;
|
1350
|
-
|
1351
|
+
// Include timestamp and an incrementing index to guarantee unique IDs both during the application
|
1352
|
+
// lifecycle as well as across sessions, since browsers will try to apply autocomplete options to
|
1353
|
+
// elements with the same ID across sessions.
|
1354
|
+
return `sky-id-gen__${new Date().getTime()}__${idIndex}`;
|
1351
1355
|
}
|
1352
1356
|
/**
|
1353
1357
|
* Sets the element's `id` attribute to a unique ID. To reference this unique ID on other elements,
|
@@ -1356,16 +1360,18 @@ function generateId() {
|
|
1356
1360
|
*/
|
1357
1361
|
class SkyIdDirective {
|
1358
1362
|
constructor(elRef, renderer) {
|
1363
|
+
_SkyIdDirective__id.set(this, void 0);
|
1359
1364
|
// Generate and apply the ID before the template is rendered
|
1360
1365
|
// to avoid a changed-after-checked error.
|
1361
1366
|
const id = generateId();
|
1362
1367
|
renderer.setAttribute(elRef.nativeElement, 'id', id);
|
1363
|
-
this
|
1368
|
+
__classPrivateFieldSet(this, _SkyIdDirective__id, id, "f");
|
1364
1369
|
}
|
1365
1370
|
get id() {
|
1366
|
-
return this
|
1371
|
+
return __classPrivateFieldGet(this, _SkyIdDirective__id, "f");
|
1367
1372
|
}
|
1368
1373
|
}
|
1374
|
+
_SkyIdDirective__id = new WeakMap();
|
1369
1375
|
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 });
|
1370
1376
|
SkyIdDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.2", type: SkyIdDirective, selector: "[skyId]", exportAs: ["skyId"], ngImport: i0 });
|
1371
1377
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyIdDirective, decorators: [{
|