Skip to content

Commit

Permalink
Merge pull request #100 from js-smart/development
Browse files Browse the repository at this point in the history
release version 17.4.0
  • Loading branch information
pavankjadda authored May 19, 2024
2 parents 82599aa + b1145e3 commit bb1c08b
Show file tree
Hide file tree
Showing 17 changed files with 353 additions and 357 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@

<hr />
<success-button (click)="setLoading()" [loading]="loading" class="m-3" label="Success Button"></success-button>
<delete-button (click)="setLoading()" [loading]="loading" class="m-3" label="Delete Button"></delete-button>
<delete-button (onClick)="setDeleteLoading($event)" [loading]="loading" class="m-3" label="Delete Button"></delete-button>

<hr />
<manage-button class="m-3"></manage-button>
<search-button class="m-3"></search-button>
<pdf-export-button class="m-3"></pdf-export-button>
<excel-export-button class="m-3"></excel-export-button>

<hr />
</div>

<hr />
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,12 @@ export class ButtonsDemoComponent {
this.loading = false;
}, 3000);
}

setDeleteLoading($event: MouseEvent) {
console.log('Delete Button clicked');
this.loading = true;
setTimeout(() => {
this.loading = false;
}, 3000);
}
}
20 changes: 10 additions & 10 deletions projects/ngxsmart/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@js-smart/ngxsmart",
"version": "17.3.0",
"peerDependencies": {
"@angular/common": "^17.0.0",
"@angular/core": "^17.0.0"
},
"dependencies": {
"tslib": "^2.3.0"
},
"sideEffects": false
"name": "@js-smart/ngxsmart",
"version": "17.4.0",
"peerDependencies": {
"@angular/common": "^17.0.0",
"@angular/core": "^17.0.0"
},
"dependencies": {
"tslib": "^2.3.0"
},
"sideEffects": false
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { Component, input, output } from '@angular/core';

@Component({
standalone: true,
template: ``,
})
export class BaseButtonComponent {
/**
* Is search in progress and loading the data
*/
loading = input<boolean>(false);

/**
* Is button disabled
*/
disabled = input<boolean>(false);

/**
* Type of the button. Following values are supported. See BootStrap docs for more information
* <pre>
* 1. button
* 2. submit
* </pre>
*/
type = input('button');

/**
* If set, shows when action in Progress
*/
loadingLabel = input('Saving...');

/**
* If set, shows when Delete is not in progress
*/
label = input('Save');

/**
* If set, shows the icon. Otherwise, shows delete icon
*/
icon = input('save');

/**
* If set, shows material icon otherwise hides the icons
*/
showIcon = input(true);

/**
* If set, sets the style of the button
*/
style = input<{ [name: string]: any } | null | undefined>();

/**
* If set, sets the class of the button
*/
classes = input('btn');

/**
* If set, sets the data-cy attribute for the button
*/
dataCy = input('save-button');

/**
* Output event when button is clicked
*/
onClick = output<MouseEvent>();

/**
* Output event when button is focused
*/
onFocus = output<FocusEvent>();

/**
* Output event when button is blurred
*/
onBlur = output<FocusEvent>();
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
import { Component, input } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
import { MatIcon } from '@angular/material/icon';
import { MatAnchor, MatButton } from '@angular/material/button';
import { EditSolidSvgComponent } from '../../../svg-icons/edit-solid-svg/edit-solid-svg.component';
import { BaseButtonComponent } from '../base-button/base-button.component';
import { NgStyle } from '@angular/common';

@Component({
selector: 'bs-link-button',
standalone: true,
imports: [CommonModule, MatButtonModule, MatIconModule],

imports: [MatButton, MatIcon, EditSolidSvgComponent, MatAnchor, NgStyle],
template: `
<a class="btn text-primary" data-cy="bs-link-button" mat-button>
<a
type="{{ type() }}"
class="{{ classes() }}"
(click)="onClick.emit($event)"
(focus)="onFocus.emit($event)"
(blur)="onBlur.emit($event)"
[disabled]="disabled()"
[type]="type()"
[ngStyle]="style()"
[attr.data-cy]="'edit-link-button'"
mat-button>
<mat-icon>{{ icon() }}</mat-icon>
{{ label() }}
</a>
`,
styleUrls: ['../../../../assets/app-buttons.css'],
})
export class BsLinkButtonComponent {
/**
* Icon to display
*/
icon = input('search');
export class BsLinkButtonComponent extends BaseButtonComponent {
override label = input('Edit');
override icon = input('search');
override classes = input('btn text-primary');

/**
* If set, shows the label
*/
label = input('Edit');
constructor() {
super();
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
import { Component, input } from '@angular/core';
import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
import { BaseButtonComponent } from '../base-button/base-button.component';
import { NgStyle } from '@angular/common';

@Component({
selector: 'delete-button',
standalone: true,
imports: [MatButtonModule, MatIconModule],

imports: [MatButtonModule, MatIconModule, NgStyle],
template: `
<button [disabled]="disabled() || loading()" class="btn delete-button }}" mat-raised-button type="{{ type() }}" data-cy="delete-button">
<button
mat-raised-button
class="btn {{ classes() }}"
(click)="onClick.emit($event)"
(focus)="onFocus.emit($event)"
(blur)="onBlur.emit($event)"
[disabled]="disabled() || loading()"
[type]="type()"
[ngStyle]="style()"
[attr.data-cy]="'delete-button'">
@if (loading()) {
<span aria-hidden="true" class="spinner-border spinner-border-sm" role="status"></span>
}
Expand All @@ -20,38 +30,13 @@ import { MatButtonModule } from '@angular/material/button';
`,
styleUrls: ['../../../../assets/app-buttons.css'],
})
export class DeleteButtonComponent {
/**
* Is search in progress and loading the data
*/
loading = input<boolean>(false);

/**
* Is button disabled
*/
disabled = input<boolean>(false);

/**
* Type of the button. Following values are supported. See BootStrap docs for more information
* <pre>
* 1. button
* 2. submit
* </pre>
*/
type = input('button');

/**
* If set, shows when Delete in Progress
*/
loadingLabel = input('Deleting...');

/**
* If set, shows when Delete is not in progress
*/
label = input('Delete');
export class DeleteButtonComponent extends BaseButtonComponent {
override loadingLabel = input('Deleting...');
override label = input('Delete');
override icon = input('delete');
override classes = input('delete-button');

/**
* If set, shows the icon. Otherwise, shows delete icon
*/
icon = input('delete');
constructor() {
super();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,36 @@ import { CommonModule } from '@angular/common';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { EditSolidSvgComponent } from '../../../svg-icons/edit-solid-svg/edit-solid-svg.component';
import { BaseButtonComponent } from '../base-button/base-button.component';

@Component({
selector: 'edit-bs-button',
standalone: true,
imports: [CommonModule, MatButtonModule, MatIconModule, EditSolidSvgComponent],

template: `
<button class="text-primary" mat-button color="primary" data-cy="edit-bs-button" type="{{ type() }}">
<button
color="primary"
type="{{ type() }}"
class="{{ classes() }}"
(click)="onClick.emit($event)"
(focus)="onFocus.emit($event)"
(blur)="onBlur.emit($event)"
[disabled]="disabled()"
[type]="type()"
[ngStyle]="style()"
[attr.data-cy]="'edit-bs-button'"
mat-button>
<edit-solid-svg></edit-solid-svg>
{{ label() }}
</button>
`,
styleUrls: ['../../../../assets/app-buttons.css'],
})
export class EditBsButtonComponent {
/**
* Type of the button. Following values are supported. See BootStrap docs for mor
* e information
* <pre>
* 1. button
* 2. submit
* </pre>
*/
type = input('button');
export class EditBsButtonComponent extends BaseButtonComponent {
override label = input('Edit');
override classes = input('text-primary');

/**
* If set, shows the label
*/
label = input('Edit');
constructor() {
super();
}
}
Original file line number Diff line number Diff line change
@@ -1,39 +1,36 @@
import { Component, input } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
import { NgStyle } from '@angular/common';
import { MatIcon } from '@angular/material/icon';
import { MatButton } from '@angular/material/button';
import { BaseButtonComponent } from '../base-button/base-button.component';

@Component({
selector: 'edit-button',
standalone: true,
imports: [CommonModule, MatButtonModule, MatIconModule],

imports: [MatButton, MatIcon, NgStyle],
template: `
<button class="primary-button" mat-raised-button type="{{ type() }}" data-cy="edit-button">
<button
class="{{ classes() }}"
(click)="onClick.emit($event)"
(focus)="onFocus.emit($event)"
(blur)="onBlur.emit($event)"
[disabled]="disabled()"
[type]="type()"
[ngStyle]="style()"
[attr.data-cy]="'edit-button'"
mat-raised-button>
<mat-icon>{{ icon() }}</mat-icon>
{{ label() }}
</button>
`,
styleUrls: ['../../../../assets/app-buttons.css'],
})
export class EditButtonComponent {
/**
* Type of the button. Following values are supported. See BootStrap docs for mor
* e information
* <pre>
* 1. button
* 2. submit
* </pre>
*/
type = input('button');

/**
* If set, shows material icon
*/
icon = input('edit');
export class EditButtonComponent extends BaseButtonComponent {
override label = input('Edit');
override icon = input('edit');
override classes = input('primary-button');

/**
* If set, shows the label
*/
label = input('Edit');
constructor() {
super();
}
}
Loading

0 comments on commit bb1c08b

Please sign in to comment.