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 Dec 6, 2023
2 parents 45f9e6d + ae3b7ff commit dbc16b0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
18 changes: 9 additions & 9 deletions src/app/components/dropdown/dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV
}

get isVisibleClearIcon(): boolean | undefined {
return this.modelValue() != null && ObjectUtils.isNotEmpty(this.modelValue()) && this.modelValue() !== '' && this.showClear && !this.disabled;
return this.modelValue() != null && this.hasSelectedOption() && this.showClear && !this.disabled;
}

get containerClass() {
Expand Down Expand Up @@ -1134,9 +1134,9 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV
return (
(this.optionGroupLabel
? index -
this.visibleOptions()
.slice(0, index)
.filter((option) => this.isOptionGroup(option)).length
this.visibleOptions()
.slice(0, index)
.filter((option) => this.isOptionGroup(option)).length
: index) + 1
);
}
Expand Down Expand Up @@ -1459,7 +1459,7 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV
}

hasSelectedOption() {
return ObjectUtils.isNotEmpty(this.modelValue());
return this.modelValue() !== undefined;
}

isValidSelectedOption(option) {
Expand Down Expand Up @@ -1487,8 +1487,8 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV
const matchedOptionIndex =
index < this.visibleOptions().length - 1
? this.visibleOptions()
.slice(index + 1)
.findIndex((option) => this.isValidOption(option))
.slice(index + 1)
.findIndex((option) => this.isValidOption(option))
: -1;
return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : index;
}
Expand Down Expand Up @@ -1666,8 +1666,8 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV
optionIndex =
optionIndex === -1
? this.visibleOptions()
.slice(0, this.focusedOptionIndex())
.findIndex((option) => this.isOptionMatched(option))
.slice(0, this.focusedOptionIndex())
.findIndex((option) => this.isOptionMatched(option))
: optionIndex + this.focusedOptionIndex();
} else {
optionIndex = this.visibleOptions().findIndex((option) => this.isOptionMatched(option));
Expand Down
8 changes: 3 additions & 5 deletions src/app/components/multiselect/multiselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ export class MultiSelect implements OnInit, AfterViewInit, AfterContentInit, Aft
}

searchFields() {
return this.filterFields || [this.optionLabel];
return (this.filterBy || this.optionLabel || 'label').split(',');
}

findNearestSelectedOptionIndex(index, firstCheckUp = false) {
Expand Down Expand Up @@ -2056,20 +2056,18 @@ export class MultiSelect implements OnInit, AfterViewInit, AfterContentInit, Aft

activateFilter() {
if (this.hasFilter() && this._options) {
let searchFields: string[] = (this.filterBy || this.optionLabel || 'label').split(',');

if (this.group) {
let filteredGroups = [];
for (let optgroup of this.options as any[]) {
let filteredSubOptions = this.filterService.filter(this.getOptionGroupChildren(optgroup), searchFields, this.filterValue, this.filterMatchMode, this.filterLocale);
let filteredSubOptions = this.filterService.filter(this.getOptionGroupChildren(optgroup), this.searchFields(), this.filterValue, this.filterMatchMode, this.filterLocale);
if (filteredSubOptions && filteredSubOptions.length) {
filteredGroups.push({ ...optgroup, ...{ [this.optionGroupChildren]: filteredSubOptions } });
}
}

this._filteredOptions = filteredGroups;
} else {
this._filteredOptions = this.filterService.filter(this.options as any[], searchFields, this._filterValue, this.filterMatchMode, this.filterLocale);
this._filteredOptions = this.filterService.filter(this.options as any[], this.searchFields(), this.filterValue, this.filterMatchMode, this.filterLocale);
}
} else {
this._filteredOptions = null;
Expand Down
8 changes: 3 additions & 5 deletions src/app/showcase/doc/rating/templatedoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Code } from '../../domain/code';
</app-docsectiontext>
<div class="card flex justify-content-center">
<p-rating [(ngModel)]="value" stars="5">
<ng-template pTemplate="cancel">
<ng-template pTemplate="cancelicon">
<img src="https://primefaces.org/cdn/primeng/images/demo/rating/cancel.png" width="25px" height="25px" />
</ng-template>
<ng-template pTemplate="onicon">
Expand All @@ -25,10 +25,8 @@ import { Code } from '../../domain/code';
})
export class TemplateDoc {
value!: number;

code: Code = {
basic: `<p-rating [(ngModel)]="value" stars="5">
<ng-template pTemplate="cancel">
<ng-template pTemplate="cancelicon">
<img src="https://primefaces.org/cdn/primeng/images/demo/rating/cancel.png" width="25px" height="25px" />
</ng-template>
<ng-template pTemplate="onicon">
Expand All @@ -42,7 +40,7 @@ export class TemplateDoc {
html: `
<div class="card flex justify-content-center">
<p-rating [(ngModel)]="value" stars="5">
<ng-template pTemplate="cancel">
<ng-template pTemplate="cancelicon">
<img src="https://primefaces.org/cdn/primeng/images/demo/rating/cancel.png" width="25px" height="25px" />
</ng-template>
<ng-template pTemplate="onicon">
Expand Down

1 comment on commit dbc16b0

@vercel
Copy link

@vercel vercel bot commented on dbc16b0 Dec 6, 2023

Choose a reason for hiding this comment

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

Deployment failed with the following error:

The value for maxDuration must be between 1 second and 10 seconds, in order to increase this limit upgrade your plan: https://vercel.com/pricing

Please sign in to comment.