@jatahworx/alpha-annotations-lib
v1.0.12
Published
AlphaComponent is a TypeScript decorator for adding metadata to classes. It is designed to simplify the process of attaching version, label, category, and icon information to your Angular components.
Downloads
92
Readme
Alpha-annotations-lib
AlphaComponent is a TypeScript decorator for adding metadata to classes. It is designed to simplify the process of attaching version, label, category, and icon information to your Angular components.
Installation
npm install alpha-annotation-lib or import this library and use it
Import the provided methods and extend them as needed in your TypeScript code
Usage
import { AlphaComponent } from "alpha-annotation-lib";
or;
import { AlphaComponent } from "././path_to_the_library";
//Adding the metadata to the decorator
//class decorator
@AlphaComponent({
componentName:string,
componentVersion:string,
label:string,
selector:string,
category:string,
icon?:string,
})
//Property decorator
@AlphaAttribute({
category: string,
uiType: UI_TYPE.COLOR_PICKER,
defaultValue: string,
type:ATTRIBUTE_TYPE.PROPERTY,
label: string,
fieldMappings: string
})
## Examples
@AlphaComponent({
componentName: "my_component",
componentVersion: "0.0.1",
label: "my_component",
selector: "alpha-text-field",
category: "general",
icon: "fa-input",
})
//this should be the selector name
@customElement('alpha-text-field')
export class MyComponent {
@AlphaAttribute({
category: "dropdown",
uiType: UI_TYPE.COLOR_PICKER,
defaultValue: '',
type: ATTRIBUTE_TYPE.PROPERTY,
label: "label",
fieldMappings: "value"
})
@property({ type: String })
value = '';
}
## License
The Alpha Component is licensed under the MIT License.