Skip to content

Commit

Permalink
Code format
Browse files Browse the repository at this point in the history
  • Loading branch information
cetincakiroglu committed Sep 26, 2024
1 parent 0f3ffbc commit 7f84022
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 43 deletions.
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 12 additions & 7 deletions src/app/components/autocomplete/autocomplete.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { animate, AnimationEvent, style, transition, trigger } from '@angular/animations';
import { AnimationEvent } from '@angular/animations';
import { CommonModule, DOCUMENT } from '@angular/common';
import {
AfterContentInit,
Expand Down Expand Up @@ -28,21 +28,20 @@ import {
ViewEncapsulation
} from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { OverlayOptions, OverlayService, PrimeNGConfig, PrimeTemplate, SharedModule, TranslationKeys } from 'primeng/api';
import { OverlayOptions, OverlayService, PrimeNGConfig, PrimeTemplate, ScrollerOptions, SharedModule, TranslationKeys } from 'primeng/api';
import { AutoFocusModule } from 'primeng/autofocus';
import { ButtonModule } from 'primeng/button';
import { ConnectedOverlayScrollHandler, DomHandler } from 'primeng/dom';
import { InputTextModule } from 'primeng/inputtext';
import { Overlay, OverlayModule } from 'primeng/overlay';
import { RippleModule } from 'primeng/ripple';
import { Scroller, ScrollerModule } from 'primeng/scroller';
import { ScrollerOptions } from 'primeng/api';
import { ObjectUtils, UniqueComponentId } from 'primeng/utils';
import { TimesCircleIcon } from 'primeng/icons/timescircle';
import { SpinnerIcon } from 'primeng/icons/spinner';
import { TimesIcon } from 'primeng/icons/times';
import { ChevronDownIcon } from 'primeng/icons/chevrondown';
import { Nullable, VoidListener } from 'primeng/ts-helpers';
import { Nullable } from 'primeng/ts-helpers';
import { AutoCompleteCompleteEvent, AutoCompleteDropdownClickEvent, AutoCompleteLazyLoadEvent, AutoCompleteSelectEvent, AutoCompleteUnselectEvent } from './autocomplete.interface';

export const AUTOCOMPLETE_VALUE_ACCESSOR: any = {
Expand Down Expand Up @@ -880,13 +879,19 @@ export class AutoComplete implements AfterViewChecked, AfterContentInit, OnDestr
return typeof this.modelValue() === 'string' && this.optionValue;
}


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

constructor(@Inject(DOCUMENT) private document: Document, public el: ElementRef, public renderer: Renderer2, public cd: ChangeDetectorRef, public config: PrimeNGConfig, public overlayService: OverlayService, private zone: NgZone) {

constructor(
@Inject(DOCUMENT) private document: Document,
public el: ElementRef,
public renderer: Renderer2,
public cd: ChangeDetectorRef,
public config: PrimeNGConfig,
public overlayService: OverlayService,
private zone: NgZone
) {
effect(() => {
this.filled = ObjectUtils.isNotEmpty(this.modelValue());
});
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/calendar/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { ChevronDownIcon } from 'primeng/icons/chevrondown';
import { TimesIcon } from 'primeng/icons/times';
import { CalendarIcon } from 'primeng/icons/calendar';
import { Nullable, VoidListener } from 'primeng/ts-helpers';
import { NavigationState, CalendarResponsiveOptions, CalendarTypeView, LocaleSettings, Month, CalendarMonthChangeEvent, CalendarYearChangeEvent } from './calendar.interface';
import { CalendarMonthChangeEvent, CalendarResponsiveOptions, CalendarTypeView, CalendarYearChangeEvent, LocaleSettings, Month, NavigationState } from './calendar.interface';
import { AutoFocusModule } from 'primeng/autofocus';

export const CALENDAR_VALUE_ACCESSOR: any = {
Expand Down Expand Up @@ -1847,7 +1847,7 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor {
if (!this.isComparable()) return false;
if (this.isMultipleSelection()) return false;

let value = this.isRangeSelection() ? this.value[0] : this.value;
let value = this.isRangeSelection() ? this.value[0] : this.value;
return value ? value.getFullYear() === year : false;
}

Expand Down
23 changes: 21 additions & 2 deletions src/app/components/panel/panel.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
import { animate, state, style, transition, trigger } from '@angular/animations';
import { CommonModule } from '@angular/common';
import { AfterContentInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ContentChildren, ElementRef, EventEmitter, Input, NgModule, Output, QueryList, TemplateRef, ViewEncapsulation, booleanAttribute } from '@angular/core';
import {
AfterContentInit,
booleanAttribute,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
ContentChild,
ContentChildren,
ElementRef,
EventEmitter,
Input,
NgModule,
Output,
QueryList,
TemplateRef,
ViewEncapsulation,
} from '@angular/core';
import { BlockableUI, Footer, PrimeTemplate, SharedModule } from 'primeng/api';
import { MinusIcon } from 'primeng/icons/minus';
import { PlusIcon } from 'primeng/icons/plus';
Expand Down Expand Up @@ -211,7 +227,10 @@ export class Panel implements AfterContentInit, BlockableUI {
return this.header;
}

constructor(private el: ElementRef, private cd: ChangeDetectorRef) {}
constructor(
private el: ElementRef,
private cd: ChangeDetectorRef
) {}

ngAfterContentInit() {
(this.templates as QueryList<PrimeTemplate>).forEach((item) => {
Expand Down
17 changes: 11 additions & 6 deletions src/app/components/scroller/scroller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,19 @@ import {
SimpleChanges,
TemplateRef,
ViewChild,
ViewEncapsulation
ViewEncapsulation,
} from '@angular/core';
import { PrimeTemplate, ScrollerOptions, SharedModule } from 'primeng/api';
import { DomHandler } from 'primeng/dom';
import { SpinnerIcon } from 'primeng/icons/spinner';
import { Nullable, VoidListener } from 'primeng/ts-helpers';
import { ScrollerLazyLoadEvent, ScrollerScrollEvent, ScrollerScrollIndexChangeEvent, ScrollerToType } from './scroller.interface';
import { Nullable } from 'primeng/ts-helpers';
import {
ScrollerLazyLoadEvent,
ScrollerScrollEvent,
ScrollerScrollIndexChangeEvent,
ScrollerToType,
} from './scroller.interface';

/**
* Scroller is a performance-approach to handle huge data efficiently.
* @group Components
Expand Down Expand Up @@ -874,14 +880,13 @@ export class Scroller implements OnInit, AfterContentInit, AfterViewChecked, OnD

setSpacerSize() {
if (this._items) {
const setProp = (_name, _count, _size) => (this.spacerStyle = { ...this.spacerStyle, ...{[`${_name}`]: _count * _size + 'px' }});
const setProp = (_name, _count, _size) => (this.spacerStyle = { ...this.spacerStyle, ...{ [`${_name}`]: _count * _size + 'px' } });

const numItems = this._items.length;
if (this.both) {
setProp('height', numItems, this._itemSize[0]);
setProp('width', this._columns?.length || this._items[1]?.length, this._itemSize[1]);
}
else {
} else {
this.horizontal ? setProp('width', this._columns.length || this._items.length, this._itemSize) : setProp('height', numItems, this._itemSize);
}
}
Expand Down
11 changes: 8 additions & 3 deletions src/app/components/tree/tree.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { TestBed, ComponentFixture } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { Tree, UITreeNode } from './tree';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { ContextMenu, ContextMenuSub } from 'primeng/contextmenu';
import { RouterTestingModule } from '@angular/router/testing';
import { Component, ElementRef, ViewChild, OnInit, NO_ERRORS_SCHEMA } from '@angular/core';
import { Component, ElementRef, NO_ERRORS_SCHEMA, OnInit, ViewChild } from '@angular/core';
import { ContextMenuService, TreeDragDropService } from 'primeng/api';

@Component({
Expand Down Expand Up @@ -195,7 +195,12 @@ describe('Tree', () => {
data: 'De Niro Movies',
children: [
{ label: 'Goodfellas', icon: 'pi pi-file-video-o', data: 'Goodfellas Movie' },
{ label: 'Untouchables', icon: 'pi pi-file-video-o', data: 'Untouchables Movie', selectable: false }
{
label: 'Untouchables',
icon: 'pi pi-file-video-o',
data: 'Untouchables Movie',
selectable: false
}
]
}
]
Expand Down
25 changes: 12 additions & 13 deletions src/app/components/tree/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ import {
ViewChild,
ViewEncapsulation
} from '@angular/core';
import { BlockableUI, PrimeNGConfig, PrimeTemplate, SharedModule, TranslationKeys, TreeDragDropService, TreeNode } from 'primeng/api';
import { BlockableUI, PrimeNGConfig, PrimeTemplate, ScrollerOptions, SharedModule, TranslationKeys, TreeDragDropService, TreeNode } from 'primeng/api';
import { DomHandler } from 'primeng/dom';
import { RippleModule } from 'primeng/ripple';
import { Scroller, ScrollerModule } from 'primeng/scroller';
import { ScrollerOptions } from 'primeng/api';
import { ObjectUtils } from 'primeng/utils';
import { Subscription } from 'rxjs';
import { CheckIcon } from 'primeng/icons/check';
Expand Down Expand Up @@ -1542,20 +1541,20 @@ export class Tree implements OnInit, AfterContentInit, OnChanges, OnDestroy, Blo
}
}
}

filterUnselectableChildren(node: TreeNode): TreeNode {
let clonedNode = Object.assign({}, node);

if (clonedNode.children && clonedNode.children.length) {
for (let child of clonedNode.children) {
if (child.selectable === false) {
clonedNode.children = clonedNode.children.filter((val: TreeNode) => val != child);
}
child = this.filterUnselectableChildren(child);
let clonedNode = Object.assign({}, node);

if (clonedNode.children && clonedNode.children.length) {
for (let child of clonedNode.children) {
if (child.selectable === false) {
clonedNode.children = clonedNode.children.filter((val: TreeNode) => val != child);
}
child = this.filterUnselectableChildren(child);
}
}
}

return clonedNode;
return clonedNode;
}

isSelected(node: TreeNode) {
Expand Down
4 changes: 2 additions & 2 deletions src/app/showcase/doc/autocomplete/objectsdoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ interface AutoCompleteCompleteEvent {
selector: 'autocomplete-objects-demo',
template: ` <app-docsectiontext>
<p>
AutoComplete can also work with objects using the <i>optionLabel</i> property that defines the label to display as a suggestion. The value passed to the model would still be the object instance of a suggestion. Here is an example with a
Country object that has name and code fields such as <i>&#123;name: "United States", code:"USA"&#125;</i>.
AutoComplete can also work with objects using the <i>optionLabel</i> property that defines the label to display as a suggestion. The value passed to the model would still be the object instance of a suggestion. Here is an example with
a Country object that has name and code fields such as <i>&#123;name: "United States", code:"USA"&#125;</i>.
</p>
</app-docsectiontext>
<div class="card flex justify-content-center">
Expand Down
8 changes: 6 additions & 2 deletions src/app/showcase/doc/autocomplete/showclear-doc.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ export class ShowClearDoc implements OnInit {
countries: any[] | undefined;

countryFormGroup: FormGroup = this.formBuilder.group({
'country': [{ name: 'Switzerland', code: 'CH' }]
country: [{ name: 'Switzerland', code: 'CH' }]
});

filteredCountries: any[] | undefined;

constructor(private countryService: CountryService, private PlatformService: PlatformService, private formBuilder: FormBuilder) {}
constructor(
private countryService: CountryService,
private PlatformService: PlatformService,
private formBuilder: FormBuilder
) {}

ngOnInit() {
if (this.PlatformService.isBrowser()) {
Expand Down
3 changes: 2 additions & 1 deletion src/app/showcase/pages/templates/atlantis/atlantis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { TemplateSeparatorModule } from 'src/app/showcase/layout/templates/templ
import { TemplateYoutubeModule } from 'src/app/showcase/layout/templates/templateyoutube';
import { AtlantisLogo } from './atlantislogo';
import { AtlantisSeparator } from './atlantisseparator';

@Component({
standalone: true,
selector: 'atlantis-page',
Expand Down Expand Up @@ -202,7 +203,7 @@ export class AtlantisPage {
{
title: 'Basic License',
price: '$59',
included: ['Non Commercial Usage', 'Single End Product, No Multi-Use', '1 Year Free Updates'],
included: ['Non Commercial Usage', 'Single End Product, No Multi-Use', '1 Year Free Updates']
},
{
title: 'Extended License',
Expand Down

0 comments on commit 7f84022

Please sign in to comment.