Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/primefaces/primeng
Browse files Browse the repository at this point in the history
  • Loading branch information
cetincakiroglu committed Oct 11, 2023
2 parents c2b0504 + 5a96037 commit d2b3fff
Show file tree
Hide file tree
Showing 36 changed files with 473 additions and 272 deletions.
51 changes: 50 additions & 1 deletion src/app/components/button/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,46 @@ export class Button implements AfterContentInit {
* @group Props
*/
@Input() loadingIcon: string | undefined;
/**
* Add a shadow to indicate elevation.
* @group Props
*/
@Input() raised: boolean = false;
/**
* Add a circular border radius to the button.
* @group Props
*/
@Input() rounded: boolean = false;
/**
* Add a textual class to the button without a background initially.
* @group Props
*/
@Input() text: boolean = false;
/**
* Add a plain textual class to the button without a background initially.
* @group Props
*/
@Input() plain: boolean = false;
/**
* Defines the style of the button.
* @group Props
*/
@Input() severity: 'secondary' | 'success' | 'info' | 'warning' | 'help' | 'danger' | string | undefined;
/**
* Add a border class without a background initially.
* @group Props
*/
@Input() outlined: boolean = false;
/**
* Add a link style to the button.
* @group Props
*/
@Input() link: boolean = false;
/**
* Defines the size of the button.
* @group Props
*/
@Input() size: 'small' | 'large' | undefined;
/**
* Inline style of the element.
* @group Props
Expand Down Expand Up @@ -393,7 +433,16 @@ export class Button implements AfterContentInit {
'p-button-vertical': (this.iconPos === 'top' || this.iconPos === 'bottom') && this.label,
'p-disabled': this.disabled || this.loading,
'p-button-loading': this.loading,
'p-button-loading-label-only': this.loading && !this.icon && this.label && !this.loadingIcon && this.iconPos === 'left'
'p-button-loading-label-only': this.loading && !this.icon && this.label && !this.loadingIcon && this.iconPos === 'left',
'p-button-link': this.link,
[`p-button-${this.severity}`]: this.severity,
'p-button-raised': this.raised,
'p-button-rounded': this.rounded,
'p-button-text': this.text,
'p-button-outlined': this.outlined,
'p-button-sm': this.size === 'small',
'p-button-lg': this.size === 'large',
'p-button-plain': this.plain
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/components/chip/chip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { TimesCircleIcon } from 'primeng/icons/timescircle';
<ng-container *ngIf="removable">
<ng-container *ngIf="!removeIconTemplate">
<span tabindex="0" *ngIf="removeIcon" [class]="removeIcon" [ngClass]="'pi-chip-remove-icon'" [attr.data-pc-section]="'removeicon'" (click)="close($event)" (keydown)="onKeydown($event)"></span>
<TimesCircleIcon tabindex="0" *ngIf="!removeIcon" [styleClass]="'pi-chip-remove-icon'" [attr.data-pc-section]="'removeicon'" (click)="close($event)" (keydown)="onKeydown($event)" />
<TimesCircleIcon tabindex="0" *ngIf="!removeIcon" [class]="'pi-chip-remove-icon'" [attr.data-pc-section]="'removeicon'" (click)="close($event)" (keydown)="onKeydown($event)" />
</ng-container>
<span *ngIf="removeIconTemplate" tabindex="0" [attr.data-pc-section]="'removeicon'" class="pi-chip-remove-icon" (click)="close($event)" (keydown)="onKeydown($event)">
<ng-template *ngTemplateOutlet="removeIconTemplate"></ng-template>
Expand Down
33 changes: 18 additions & 15 deletions src/app/components/selectbutton/selectbutton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ export class SelectButton implements ControlValueAccessor {
* @group Props
*/
@Input() multiple: boolean | undefined;
/**
* Whether selection can not be cleared.
* @group Props
*/
@Input() allowEmpty: boolean = true;
/**
* Inline style of the component.
* @group Props
Expand Down Expand Up @@ -174,26 +179,24 @@ export class SelectButton implements ControlValueAccessor {

const optionValue = this.getOptionValue(option);

let selected = this.isSelected(option);

if (selected && !this.allowEmpty) {
return;
}

if (this.multiple) {
if (this.isSelected(option)) this.removeOption(option);
else this.value = [...(this.value || []), optionValue];

this.onModelChange(this.value);

this.onChange.emit({
originalEvent: event,
value: this.value
});
} else if (this.value !== optionValue) {
this.value = optionValue;
this.onModelChange(this.value);

this.onChange.emit({
originalEvent: event,
value: this.value
});
} else {
this.value = selected ? null : optionValue;
}

this.onModelChange(this.value);
this.onChange.emit({
originalEvent: event,
value: this.value
});
this.onOptionClick.emit({
originalEvent: event,
option: option,
Expand Down
76 changes: 73 additions & 3 deletions src/app/showcase/doc/apidoc/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -2234,7 +2234,7 @@
"optional": true,
"readonly": false,
"type": "\"focus\" | \"hover\"",
"description": "Event to show tooltip."
"description": "Event to show the tooltip."
},
{
"name": "appendTo",
Expand Down Expand Up @@ -4251,7 +4251,7 @@
"name": "severity",
"optional": false,
"readonly": false,
"type": "\"success\" | \"warning\" | \"danger\" | \"info\"",
"type": "\"success\" | \"warning\" | \"info\" | \"danger\"",
"description": "Severity type of the badge."
}
]
Expand Down Expand Up @@ -4287,7 +4287,7 @@
"name": "severity",
"optional": false,
"readonly": false,
"type": "\"success\" | \"warning\" | \"danger\" | \"info\"",
"type": "\"success\" | \"warning\" | \"info\" | \"danger\"",
"description": "Severity type of the badge."
},
{
Expand Down Expand Up @@ -4588,6 +4588,68 @@
"type": "string",
"description": "Icon to display in loading state."
},
{
"name": "raised",
"optional": false,
"readonly": false,
"type": "boolean",
"default": "false",
"description": "Add a shadow to indicate elevation."
},
{
"name": "rounded",
"optional": false,
"readonly": false,
"type": "boolean",
"default": "false",
"description": "Add a circular border radius to the button."
},
{
"name": "text",
"optional": false,
"readonly": false,
"type": "boolean",
"default": "false",
"description": "Add a textual class to the button without a background initially."
},
{
"name": "plain",
"optional": false,
"readonly": false,
"type": "boolean",
"default": "false",
"description": "Add a plain textual class to the button without a background initially."
},
{
"name": "severity",
"optional": false,
"readonly": false,
"type": "string",
"description": "Defines the style of the button."
},
{
"name": "outlined",
"optional": false,
"readonly": false,
"type": "boolean",
"default": "false",
"description": "Add a border class without a background initially."
},
{
"name": "link",
"optional": false,
"readonly": false,
"type": "boolean",
"default": "false",
"description": "Add a link style to the button."
},
{
"name": "size",
"optional": false,
"readonly": false,
"type": "\"small\" | \"large\"",
"description": "Defines the size of the button."
},
{
"name": "style",
"optional": false,
Expand Down Expand Up @@ -18592,6 +18654,14 @@
"default": "false",
"description": "When specified, allows selecting multiple values."
},
{
"name": "allowEmpty",
"optional": false,
"readonly": false,
"type": "boolean",
"default": "true",
"description": "Whether selection can not be cleared."
},
{
"name": "style",
"optional": false,
Expand Down
6 changes: 3 additions & 3 deletions src/app/showcase/doc/button/linkdoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Code } from '../../domain/code';
<p>A button can be rendered as a link as well.</p>
</app-docsectiontext>
<div class="card flex justify-content-center">
<p-button label="Submit" styleClass="p-button-link"></p-button>
<p-button label="Submit" [link]="true"></p-button>
</div>
<app-code [code]="code" selector="button-link-demo"></app-code>
</section>`
Expand All @@ -20,11 +20,11 @@ export class LinkDoc {

code: Code = {
basic: `
<p-button label="Submit" styleClass="p-button-link"></p-button>`,
<p-button label="Submit" [link]="true"></p-button>`,

html: `
<div class="card flex justify-content-center">
<p-button label="Submit" styleClass="p-button-link"></p-button>
<p-button label="Submit" [link]="true"></p-button>
</div>`,

typescript: `
Expand Down
42 changes: 21 additions & 21 deletions src/app/showcase/doc/button/outlineddoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import { Code } from '../../domain/code';
<p>Outlined buttons display a border without a background initially.</p>
</app-docsectiontext>
<div class="card flex flex-wrap gap-3 justify-content-center">
<p-button label="Primary" styleClass="p-button-outlined"></p-button>
<p-button label="Secondary" styleClass="p-button-outlined p-button-secondary"></p-button>
<p-button label="Success" styleClass="p-button-outlined p-button-success"></p-button>
<p-button label="Info" styleClass="p-button-outlined p-button-info"></p-button>
<p-button label="Warning" styleClass="p-button-outlined p-button-warning"></p-button>
<p-button label="Help" styleClass="p-button-outlined p-button-help"></p-button>
<p-button label="Danger" styleClass="p-button-outlined p-button-danger"></p-button>
<p-button label="Primary" [outlined]="true"></p-button>
<p-button label="Secondary" [outlined]="true" severity="secondary"></p-button>
<p-button label="Success" [outlined]="true" severity="success"></p-button>
<p-button label="Info" [outlined]="true" severity="info"></p-button>
<p-button label="Warning" [outlined]="true" severity="warning"></p-button>
<p-button label="Help" [outlined]="true" severity="help"></p-button>
<p-button label="Danger" [outlined]="true" severity="danger"></p-button>
</div>
<app-code [code]="code" selector="button-outlined-demo"></app-code>
</section>`
Expand All @@ -26,23 +26,23 @@ export class OutlinedDoc {

code: Code = {
basic: `
<p-button label="Primary" styleClass="p-button-outlined"></p-button>
<p-button label="Secondary" styleClass="p-button-outlined p-button-secondary"></p-button>
<p-button label="Success" styleClass="p-button-outlined p-button-success"></p-button>
<p-button label="Info" styleClass="p-button-outlined p-button-info"></p-button>
<p-button label="Warning" styleClass="p-button-outlined p-button-warning"></p-button>
<p-button label="Help" styleClass="p-button-outlined p-button-help"></p-button>
<p-button label="Danger" styleClass="p-button-outlined p-button-danger"></p-button>`,
<p-button label="Primary" [outlined]="true"></p-button>
<p-button label="Secondary" [outlined]="true" severity="secondary"></p-button>
<p-button label="Success" [outlined]="true" severity="success"></p-button>
<p-button label="Info" [outlined]="true" severity="info"></p-button>
<p-button label="Warning" [outlined]="true" severity="warning"></p-button>
<p-button label="Help" [outlined]="true" severity="help"></p-button>
<p-button label="Danger" [outlined]="true" severity="danger"></p-button>`,

html: `
<div class="card flex flex-wrap gap-3 justify-content-center">
<p-button label="Primary" styleClass="p-button-outlined"></p-button>
<p-button label="Secondary" styleClass="p-button-outlined p-button-secondary"></p-button>
<p-button label="Success" styleClass="p-button-outlined p-button-success"></p-button>
<p-button label="Info" styleClass="p-button-outlined p-button-info"></p-button>
<p-button label="Warning" styleClass="p-button-outlined p-button-warning"></p-button>
<p-button label="Help" styleClass="p-button-outlined p-button-help"></p-button>
<p-button label="Danger" styleClass="p-button-outlined p-button-danger"></p-button>
<p-button label="Primary" [outlined]="true"></p-button>
<p-button label="Secondary" [outlined]="true" severity="secondary"></p-button>
<p-button label="Success" [outlined]="true" severity="success"></p-button>
<p-button label="Info" [outlined]="true" severity="info"></p-button>
<p-button label="Warning" [outlined]="true" severity="warning"></p-button>
<p-button label="Help" [outlined]="true" severity="help"></p-button>
<p-button label="Danger" [outlined]="true" severity="danger"></p-button>
</div>`,

typescript: `
Expand Down
42 changes: 21 additions & 21 deletions src/app/showcase/doc/button/raiseddoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import { Code } from '../../domain/code';
<p>Raised buttons display a shadow to indicate elevation.</p>
</app-docsectiontext>
<div class="card flex flex-wrap gap-3 justify-content-center">
<p-button label="Primary" styleClass="p-button-raised"></p-button>
<p-button label="Secondary" styleClass="p-button-raised p-button-secondary"></p-button>
<p-button label="Success" styleClass="p-button-raised p-button-success"></p-button>
<p-button label="Info" styleClass="p-button-raised p-button-info"></p-button>
<p-button label="Warning" styleClass="p-button-raised p-button-warning"></p-button>
<p-button label="Help" styleClass="p-button-raised p-button-help"></p-button>
<p-button label="Danger" styleClass="p-button-raised p-button-danger"></p-button>
<p-button label="Primary" [raised]="true"></p-button>
<p-button label="Secondary" [raised]="true" severity="secondary"></p-button>
<p-button label="Success" [raised]="true" severity="success"></p-button>
<p-button label="Info" [raised]="true" severity="info"></p-button>
<p-button label="Warning" [raised]="true" severity="warning"></p-button>
<p-button label="Help" [raised]="true" severity="help"></p-button>
<p-button label="Danger" [raised]="true" severity="danger"></p-button>
</div>
<app-code [code]="code" selector="button-raised-demo"></app-code>
</section>`
Expand All @@ -26,23 +26,23 @@ export class RaisedDoc {

code: Code = {
basic: `
<p-button label="Primary" styleClass="p-button-raised"></p-button>
<p-button label="Secondary" styleClass="p-button-raised p-button-secondary"></p-button>
<p-button label="Success" styleClass="p-button-raised p-button-success"></p-button>
<p-button label="Info" styleClass="p-button-raised p-button-info"></p-button>
<p-button label="Warning" styleClass="p-button-raised p-button-warning"></p-button>
<p-button label="Help" styleClass="p-button-raised p-button-help"></p-button>
<p-button label="Danger" styleClass="p-button-raised p-button-danger"></p-button>`,
<p-button label="Primary" [raised]="true"></p-button>
<p-button label="Secondary" [raised]="true" severity="secondary"></p-button>
<p-button label="Success" [raised]="true" severity="success"></p-button>
<p-button label="Info" [raised]="true" severity="info"></p-button>
<p-button label="Warning" [raised]="true" severity="warning"></p-button>
<p-button label="Help" [raised]="true" severity="help"></p-button>
<p-button label="Danger" [raised]="true" severity="danger"></p-button>`,

html: `
<div class="card flex flex-wrap gap-3 justify-content-center">
<p-button label="Primary" styleClass="p-button-raised"></p-button>
<p-button label="Secondary" styleClass="p-button-raised p-button-secondary"></p-button>
<p-button label="Success" styleClass="p-button-raised p-button-success"></p-button>
<p-button label="Info" styleClass="p-button-raised p-button-info"></p-button>
<p-button label="Warning" styleClass="p-button-raised p-button-warning"></p-button>
<p-button label="Help" styleClass="p-button-raised p-button-help"></p-button>
<p-button label="Danger" styleClass="p-button-raised p-button-danger"></p-button>
<p-button label="Primary" [raised]="true"></p-button>
<p-button label="Secondary" [raised]="true" severity="secondary"></p-button>
<p-button label="Success" [raised]="true" severity="success"></p-button>
<p-button label="Info" [raised]="true" severity="info"></p-button>
<p-button label="Warning" [raised]="true" severity="warning"></p-button>
<p-button label="Help" [raised]="true" severity="help"></p-button>
<p-button label="Danger" [raised]="true" severity="danger"></p-button>
</div>`,

typescript: `
Expand Down
Loading

1 comment on commit d2b3fff

@vercel
Copy link

@vercel vercel bot commented on d2b3fff Oct 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.