The wml-button-zero
library is an Angular-focused toolkit designed to provide developers with versatile and customizable button components. Its primary goal is to offer a streamlined approach to implementing interactive buttons within Angular applications, addressing common challenges such as dynamic content loading, user interaction handling, and flexible styling. By delivering a set of modular and adaptable components, the library aims to enhance the development workflow and enrich the user experience across diverse application scenarios.
Within this library, WmlButtonZeroComponent stands as the central component, offering a comprehensive suite of customization options. It's built to cater to developers seeking to implement buttons with specific behaviors, styles, and functionalities, providing a deep level of control over the component's properties. On the other hand, WmlButtonOneComponent serves as a simpler alternative, designed for use cases that demand a straightforward button with less complexity in customization. While it retains core interactive features, it's streamlined for easier implementation, making it suitable for scenarios where a basic button suffices. This structural differentiation within the library ensures that developers have access to both detailed and simplified button components, aligning with varied application requirements and developer preferences.
npm install -d @windmillcode/angular-wml-button-zero
Property | Type | Description |
---|---|---|
id |
string |
The unique identifier for the button component. |
cdref |
ChangeDetectorRef |
Optional. Angular's ChangeDetectorRef associated with the component for triggering change detection manually. |
updateSubj |
Subject<Partial<WmlButtonZeroParams>> |
Subject to emit updates for the component. Useful for reactive programming patterns. |
type |
WMLButtonParamsTypeEnum |
The type of the button, which determines its styling. Can be PRIMARY , SECONDARY , or TERTIARY . |
text |
WMLUIProperty |
Overrides the text property to set the button's display text. |
button |
WMLUIProperty |
Overrides the button property to customize click behavior. |
icons |
Array<WMLImage<any, WMLButtonIconType>> |
Overrides the icons property to customize the button's icons. |
-
constructor(params: Partial<WmlButtonZeroParams> = {})
: Initializes a new instance of theWmlButtonZeroParams
class with optional parameters for customization. -
updateBtnClasses(value: WMLButtonParamsTypeEnum)
: Updates the button's classes based on the specified type (PRIMARY
,SECONDARY
, orTERTIARY
).
let wmlButtonZeroParams = new WmlButtonZeroParams({
type: WMLButtonParamsTypeEnum.PRIMARY,
text: new WMLUIProperty({ text: "Click Me" }),
button: new WMLUIProperty({
click: () => {
alert("This button was clicked");
}
}),
// Assuming WMLImage and WMLButtonIconType are defined elsewhere
icons: [new WMLImage<any, WMLButtonIconType>({ isPresent: false, class: 'fa-solid' })]
});
Property | Type | Description |
---|---|---|
btnClass |
string |
Gets or sets the button's primary CSS class. |
btnStyle |
Partial<CSSStyleDeclaration> |
Partial CSS styles for the button. |
btnIsPresent |
boolean |
Indicates whether the button is present in the DOM. |
type |
WMLButtonParamsTypeEnum |
The type of the button, influencing its styling. Can be PRIMARY , SECONDARY , or TERTIARY . |
iconType |
WMLButtonIconType |
The type of icon used in the button. |
text |
string |
The display text of the button. |
updateSubj |
Subject<Partial<WmlButtonOneParams>> |
Subject to emit updates for the component. |
-
constructor(params: Partial<WmlButtonOneParams> = {})
: Initializes a new instance of theWmlButtonOneParams
class with optional parameters for customization. -
updateBtnClassString(value: string)
: Updates the button's primary CSS class. -
updateBtnClasses(value: WMLButtonParamsTypeEnum)
: Updates the button's classes based on the specified type (PRIMARY
,SECONDARY
, orTERTIARY
). -
click(evt?)
: Custom click handler for the button.
let wmlButtonOneParams = new WmlButtonOneParams({
type: WMLButtonParamsTypeEnum.SECONDARY,
text: "Click Me",
click: (evt?) => {
alert("This button was clicked");
}
});
- to globally customize in your css file &[number] represents the button &Text&0 represents the btn text
.WmlButtonOneMainButton{
&0 {
&Text {
&0 {
}
}
}
&1 {
&Text {
&0 {
}
}
}
&2 {
&Text {
&0 {
}
}
}
}
- v0.0.1 button is ready to be used
- v0.0.2 include cursor pointer for the button view
- v0.0.3 gave hover functionality to the button
- 1.0.0 BREAKING change WmlButtonZeroParams.icon changed to WmlButtonZeroParams.icons to represent the multiple icons one can have on the button WmlButtonZeroParams.icons[number] which is a WMLImage now has type of img or icon, if a type is not specified an img is used the icon comes before the text and not after the text
- 2.0.0 BREAKING CHANGE WmlButtonZeroParamsTypeEnum renamed to WMLButtonParamsTypeEnum created wml-button-one component which leverages wmlButton for easier button creation
- 2.1.0
- full support for wml-button-one
- 2.1.1
- add WmlButtonOneParams.btnIsPresent to show and hide buttons
- 3.0.0
- ensured that there is support for ngx-translate and non ngx-translate features
- to enable translation
export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http);
}
HttpClientModule,
WmlButtonZeroModule
.forChild(
new WMLModuleForRootParams({
ngxTranslateLoaderFactory:HttpLoaderFactory
})
),
* to disable translation
WmlButtonZeroModule
- fixed major problems concerning ngx-translate
// translate
// first make sure to have ONLY ONE in the imports for AppModule
TranslateModule.forRoot({
defaultLanguage: 'en',
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps:[HttpClient]
}
}),
// then
WmlButtonZeroNGXTranslateModule
// for regular
WmlButtonZeroModule
- added css id support, and made cdref available on the params
- add id support on the selector element itself
- for wmlbuttonzero, added additional wmluiproperty to button zero
,
- updated package to reflect the version 16.2.80 of @angular/core package,
- updated package to reflect the version 16.2.90 of @angular/core package,
- updated package to reflect the version 16.2.91 of @angular/core package,
- updated package to conform with @windmillcode/angular-wml-components-base for unit testing features ,
- updated package to conform with @windmillcode/angular-wml-components-base for unit testing features ,
- updated package to conform with @windmillcode/angular-wml-components-base for unit testing features ,
- updated package to conform with @windmillcode/angular-wml-components-base for unit testing features ,
- updated package to conform with @windmillcode/angular-wml-components-base for unit testing features ,
- updated package to conform with @windmillcode/angular-wml-components-base for unit testing features ,
- updated package to reflect the version ^17.0.2 of @angular/core package,
- updated package to reflect the version ^17.0.4 of @angular/core package,
- updated package to reflect the version ^17.0.5 of @angular/core package,
- updated package to reflect the version ^17.0.6s of @angular/core package,
- updated package to reflect the version ^17.0.7 of @angular/core package,
- updated package to conform with @windmillcode/angular-wml-components-base ,
- updated package to conform with @windmillcode/angular-wml-components-base ,
- updated package to conform with @windmillcode/angular-wml-components-base ,
- updated package to reflect the version ^17.0.8 of @angular/core package,
- updated package to conform with @windmillcode/angular-wml-components-base ,
- updated package to conform with @windmillcode/angular-wml-components-base
- [FIX] ensured that change detection was working for buttons ,
- updated package to conform with @windmillcode/angular-wml-components-base
- [FIX] toggle margin between icon and text for wml-button-one when iconIsPresent is set to true ,
- updated package to conform with @windmillcode/angular-wml-components-base ,
- updated package to conform with @windmillcode/angular-wml-components-base
- updated WmlButtonOneParams.click to have optional evt paramaeter ,
- updated package to reflect the version ^17.1.0 of @angular/core package,
- updated package to conform with @windmillcode/angular-wml-components-base ,
- updated package to conform with @windmillcode/angular-wml-components-base ,
- updated package to reflect the version ^17.1.2 of @angular/core package,
- updated package to conform with @windmillcode/angular-wml-components-base
- corrected code so no text should wrap if the text overflows the button ,
- updated package to reflect the version ^17.1.3 of @angular/core package,
- updated package to reflect the version ^17.2.1 of @angular/core package
- [UPDATE] added WmlButtonZeroParams.listenForUpdate amd WmlButtonOneParams.listenForUpdate so changes that dont reflect by assignment would reflect this way
,
- updated package to reflect the version ^17.2.2 of @angular/core package,
- updated package to reflect the version ^17.2.2 of @angular/core package,
- updated package to reflect the version ^17.2.3 of @angular/core package,
- updated package to conform with @windmillcode/angular-wml-components-base ,
- updated package to conform with @windmillcode/angular-wml-components-base ,
- updated package to reflect the version ^17.2.4 of @angular/core package,
- updated package to conform with @windmillcode/angular-wml-components-base ,
- updated package to conform with @windmillcode/angular-wml-components-base ,
- updated package to conform with @windmillcode/angular-wml-components-base ,
- updated package to conform with @windmillcode/angular-wml-components-base ,
- updated package to reflect the version ^17.3.0 of @angular/core package ,
- updated package to reflect the version ^17.3.1 of @angular/core package,
- updated package to reflect the version ^17.3.2 of @angular/core package,
- updated package to reflect the version ^17.3.3 of @angular/core package,
- updated package to reflect the version ^17.3.4 of @angular/core package,
- updated package to conform with @windmillcode/angular-wml-components-base ,
- updated package to reflect the version ^17.3.5 of @angular/core package,
- updated package to conform with @windmillcode/angular-wml-components-base ,
- updated package to reflect the version ^17.3.6 of @angular/core package,
- updated package to reflect the version ^17.3.7 of @angular/core package,
- updated package to reflect the version ^17.3.8 of @angular/core package,
- updated package to reflect the version ^17.3.9 of @angular/core package,
- updated package to reflect the version ^18.0.0 of @angular/core package,
- updated package to reflect the version ^18.0.0 of @angular/core package,
- updated package to conform with @windmillcode/angular-wml-components-base ,
- updated package to reflect the version ^18.0.1 of @angular/core package,
- updated package to reflect the version ^18.0.2 of @angular/core package,
- updated package to reflect the version ^18.0.3 of @angular/core package,
- updated package to conform with @windmillcode/angular-wml-components-base ,
- updated package to conform with @windmillcode/angular-wml-components-base ,
- updated package to reflect the version ^18.0.5 of @angular/core package,
- updated package to reflect the version ^18.0.6 of @angular/core package,
- updated package to reflect the version ^18.1.0 of @angular/core package,
- updated package to reflect the version ^18.1.0 of @angular/core package,
- updated package to reflect the version ^18.1.0 of @angular/core package
- [FIX] - fixed a bug with the default type not showing ,
- updated package to conform with @windmillcode/angular-wml-components-base ,
- updated package to reflect the version ^18.1.1 of @angular/core package,
- updated package to reflect the version ^18.1.2 of @angular/core package
[7/26/2024 4:05:00 PM EST]
[UPDATE] Updated wml-button-one.component.html, added conditional links for params.link and params.routerLink [UPDATE] Updated wml-button-one.component.scss, added styles for links and removed unnecessary comments [BREAKING CHANGE] Added encapsulation: ViewEncapsulation.None in wml-button-one.component.ts [UPDATE] Added RouterModule to imports in wml-button-zero.module.ts ,
- updated package to conform with @windmillcode/angular-wml-components-base ,
- updated package to conform with @windmillcode/angular-wml-components-base