ect-auto-id 1.21.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/README.md +40 -0
- package/fesm2022/ect-auto-id.mjs +34 -0
- package/fesm2022/ect-auto-id.mjs.map +1 -0
- package/package.json +38 -0
- package/types/ect-auto-id.d.ts +12 -0
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# EctAutoId
|
|
2
|
+
|
|
3
|
+
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 21.0.1.
|
|
4
|
+
|
|
5
|
+
## Description
|
|
6
|
+
|
|
7
|
+
This directive can be added against any HTML element making sure that the ID used for that HTML element is unique on the HTML page.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
After installing the NPM package, to use the component, first import the AutoIdDirective into your component's Imports array, e.g.:
|
|
12
|
+
```javascript
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'my-component',
|
|
15
|
+
imports: [ AutoIdDirective ],
|
|
16
|
+
templateUrl: './my-component.component.html',
|
|
17
|
+
styleUrl: './my-component.css'
|
|
18
|
+
})
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
In your HTML template, to use the directive, do this:
|
|
22
|
+
```html
|
|
23
|
+
<label autoId>Hello World</label>
|
|
24
|
+
<p autoId>Some more text in here</p>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Dependencies
|
|
28
|
+
|
|
29
|
+
None
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## Cost
|
|
33
|
+
|
|
34
|
+
If you find some benefit from using this package, please consider the time it took to put this together, and why not buy me a coffee? Goodness only knows that most of us would not function without coffee. All donations very much welcomed:
|
|
35
|
+
(https://www.buymeacoffee.com/exoduscloudtech)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## Licence
|
|
39
|
+
|
|
40
|
+
The licence agreement for this paid component can be found here: (https://angular-grid.net/assets/licence/licence_agreement.txt)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Directive } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
class AutoIdDirective {
|
|
5
|
+
el;
|
|
6
|
+
static next = 0;
|
|
7
|
+
constructor(el) {
|
|
8
|
+
this.el = el;
|
|
9
|
+
const existing = el.nativeElement.id;
|
|
10
|
+
if (!existing) {
|
|
11
|
+
el.nativeElement.id = `auto-id-${AutoIdDirective.next++}`;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: AutoIdDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
15
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.1", type: AutoIdDirective, isStandalone: true, selector: "[autoId]", ngImport: i0 });
|
|
16
|
+
}
|
|
17
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: AutoIdDirective, decorators: [{
|
|
18
|
+
type: Directive,
|
|
19
|
+
args: [{
|
|
20
|
+
selector: '[autoId]',
|
|
21
|
+
standalone: true
|
|
22
|
+
}]
|
|
23
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }] });
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* Public API Surface of ect-auto-id
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Generated bundle index. Do not edit.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
export { AutoIdDirective };
|
|
34
|
+
//# sourceMappingURL=ect-auto-id.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ect-auto-id.mjs","sources":["../../../projects/ect-auto-id/src/lib/ect-auto-id.ts","../../../projects/ect-auto-id/src/public-api.ts","../../../projects/ect-auto-id/src/ect-auto-id.ts"],"sourcesContent":["import { Directive, ElementRef } from \"@angular/core\";\r\n\r\n@Directive({\r\n selector: '[autoId]',\r\n standalone: true\r\n})\r\nexport class AutoIdDirective {\r\n static next = 0;\r\n\r\n constructor(private el: ElementRef<HTMLElement>) {\r\n const existing = el.nativeElement.id;\r\n if (!existing) {\r\n el.nativeElement.id = `auto-id-${AutoIdDirective.next++}`;\r\n }\r\n }\r\n}","/*\r\n * Public API Surface of ect-auto-id\r\n */\r\n\r\nexport * from './lib/ect-auto-id';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAMa,eAAe,CAAA;AAGN,IAAA,EAAA;AAFpB,IAAA,OAAO,IAAI,GAAG,CAAC;AAEf,IAAA,WAAA,CAAoB,EAA2B,EAAA;QAA3B,IAAA,CAAA,EAAE,GAAF,EAAE;AACpB,QAAA,MAAM,QAAQ,GAAG,EAAE,CAAC,aAAa,CAAC,EAAE;QACpC,IAAI,CAAC,QAAQ,EAAE;YACb,EAAE,CAAC,aAAa,CAAC,EAAE,GAAG,CAAA,QAAA,EAAW,eAAe,CAAC,IAAI,EAAE,CAAA,CAAE;QAC3D;IACF;uGARW,eAAe,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,UAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAf,eAAe,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,UAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,UAAU;AACpB,oBAAA,UAAU,EAAE;AACb,iBAAA;;;ACLD;;AAEG;;ACFH;;AAEG;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ect-auto-id",
|
|
3
|
+
"version": "1.21.0",
|
|
4
|
+
"description": "ECT Auto ID which is a quick way to assign a unique ID to any HTML element.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"angular",
|
|
7
|
+
"auto",
|
|
8
|
+
"id"
|
|
9
|
+
],
|
|
10
|
+
"author": {
|
|
11
|
+
"name": "Exodus Cloud Technology",
|
|
12
|
+
"email": "info@exoduscloudtechnology.co.uk",
|
|
13
|
+
"url": "https://angular-grid.net"
|
|
14
|
+
},
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"@angular/common": "^21.0.1",
|
|
21
|
+
"@angular/core": "^21.0.1"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"tslib": "^2.5.0"
|
|
25
|
+
},
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"module": "fesm2022/ect-auto-id.mjs",
|
|
28
|
+
"typings": "types/ect-auto-id.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
"./package.json": {
|
|
31
|
+
"default": "./package.json"
|
|
32
|
+
},
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./types/ect-auto-id.d.ts",
|
|
35
|
+
"default": "./fesm2022/ect-auto-id.mjs"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { ElementRef } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
declare class AutoIdDirective {
|
|
5
|
+
private el;
|
|
6
|
+
static next: number;
|
|
7
|
+
constructor(el: ElementRef<HTMLElement>);
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AutoIdDirective, never>;
|
|
9
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<AutoIdDirective, "[autoId]", never, {}, {}, never, never, true, never>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { AutoIdDirective };
|