Skip to content

Commit

Permalink
Code format
Browse files Browse the repository at this point in the history
  • Loading branch information
cetincakiroglu committed Nov 6, 2023
1 parent c471bd5 commit 9cfbd32
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
12 changes: 7 additions & 5 deletions src/app/components/dropdown/dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export class DropdownItem {
<ng-container *ngIf="!selectedItemTemplate; else defaultPlaceholder">{{ label() === 'p-emptylabel' ? '&nbsp;' : label() || 'empty' }}</ng-container>
<ng-container *ngTemplateOutlet="selectedItemTemplate; context: { $implicit: modelValue() }"></ng-container>
<ng-template #defaultPlaceholder>
<span *ngIf="label() === placeholder || label() && !placeholder">{{ label() === 'p-emptylabel' ? '&nbsp;' : placeholder}}</span>
<span *ngIf="label() === placeholder || (label() && !placeholder)">{{ label() === 'p-emptylabel' ? '&nbsp;' : placeholder }}</span>
</ng-template>
</span>
<input
Expand Down Expand Up @@ -879,7 +879,10 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV
const options = this.group ? this.flatOptions(this.options) : this.options || [];

if (this._filterValue()) {
const filteredOptions = !this.filterBy && !this.filterFields && !this.optionValue ? this.options.filter((option) => option.toLowerCase().indexOf(this._filterValue().toLowerCase()) !== -1) : this.filterService.filter(options, this.searchFields(), this._filterValue(), this.filterMatchMode, this.filterLocale);
const filteredOptions =
!this.filterBy && !this.filterFields && !this.optionValue
? this.options.filter((option) => option.toLowerCase().indexOf(this._filterValue().toLowerCase()) !== -1)
: this.filterService.filter(options, this.searchFields(), this._filterValue(), this.filterMatchMode, this.filterLocale);
if (this.group) {
const optionGroups = this.options || [];
const filtered = [];
Expand All @@ -900,7 +903,7 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV

label = computed(() => {
let selectedOptionIndex;
this.autoDisplayFirst ? !this.modelValue() ? (selectedOptionIndex = -1) : (selectedOptionIndex = this.findFirstOptionIndex()) : (selectedOptionIndex = this.findSelectedOptionIndex());
this.autoDisplayFirst ? (!this.modelValue() ? (selectedOptionIndex = -1) : (selectedOptionIndex = this.findFirstOptionIndex())) : (selectedOptionIndex = this.findSelectedOptionIndex());
return this.modelValue() ? this.getOptionLabel(this.modelValue()) : selectedOptionIndex !== -1 ? this.getOptionLabel(this.visibleOptions()[selectedOptionIndex]) : this.placeholder || 'p-emptylabel';
});

Expand Down Expand Up @@ -1045,15 +1048,14 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV
updateModel(value, event?) {
this.value = value;
this.onModelChange(value);
if(this.value !== this.modelValue()) {
if (this.value !== this.modelValue()) {
this.onChange.emit({
originalEvent: event,
value: value
});
}
this.modelValue.set(value);
this.selectedOptionUpdated = true;

}

isSelected(option) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/listbox/listbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ export class Listbox implements AfterContentInit, OnInit, ControlValueAccessor,
return;
}

event && this.onClick.emit({originalEvent: event, value: option});
event && this.onClick.emit({ originalEvent: event, value: option });

this.multiple ? this.onOptionSelectMultiple(event, option) : this.onOptionSelectSingle(event, option);
this.optionTouched = false;
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/multiselect/multiselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1620,7 +1620,7 @@ export class MultiSelect implements OnInit, AfterViewInit, AfterContentInit, Aft
if (this.disabled || this.readonly || (<Node>event.target).isSameNode(this.focusInputViewChild?.nativeElement)) {
return;
}

if (event.target.tagName === 'INPUT' || event.target.getAttribute('data-pc-section') === 'clearicon' || event.target.closest('[data-pc-section="clearicon"]')) {
event.preventDefault();
return;
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/selectbutton/selectbutton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export class SelectButton implements ControlValueAccessor {

this.focusedIndex = index;
this.value = newValue;
this.onModelChange(this.value)
this.onModelChange(this.value);

this.onChange.emit({
originalEvent: event,
Expand Down
1 change: 0 additions & 1 deletion src/app/showcase/doc/multiselect/basicdoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export class BasicDoc implements OnInit {

formGroup!: FormGroup;


ngOnInit() {
this.cities = [
{ name: 'New York', code: 'NY' },
Expand Down

1 comment on commit 9cfbd32

@vercel
Copy link

@vercel vercel bot commented on 9cfbd32 Nov 6, 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.