diff --git a/src/app/components/table/table.ts b/src/app/components/table/table.ts index 92b17555df0..46bf3000877 100644 --- a/src/app/components/table/table.ts +++ b/src/app/components/table/table.ts @@ -5264,6 +5264,18 @@ export class ColumnFilter implements AfterContentInit { * @group Props */ @Input() ariaLabel: string | undefined; + /** + * Callback to invoke on overlay is shown. + * @param {AnimationEvent} originalEvent - animation event. + * @group Emits + */ + @Output() onShow: EventEmitter<{originalEvent: AnimationEvent}> = new EventEmitter<{originalEvent: AnimationEvent}>(); + /** + * Callback to invoke on overlay is hidden. + * @param {AnimationEvent} originalEvent - animation event. + * @group Emits + */ + @Output() onHide: EventEmitter<{originalEvent: AnimationEvent}> = new EventEmitter<{originalEvent: AnimationEvent}>(); @ViewChild('icon') icon: Nullable; @@ -5596,6 +5608,7 @@ export class ColumnFilter implements AfterContentInit { }; this.overlaySubscription = this.overlayService.clickObservable.subscribe(this.overlayEventListener); + this.onShow.emit({originalEvent: event}) break; case 'void': @@ -5615,6 +5628,7 @@ export class ColumnFilter implements AfterContentInit { break; case 'void': ZIndexUtils.clear(event.element); + this.onHide.emit({originalEvent: event}) break; } } diff --git a/src/app/showcase/doc/table/filtermenudoc.ts b/src/app/showcase/doc/table/filtermenudoc.ts deleted file mode 100644 index a9ea69a6602..00000000000 --- a/src/app/showcase/doc/table/filtermenudoc.ts +++ /dev/null @@ -1,653 +0,0 @@ -import { ChangeDetectionStrategy, ChangeDetectorRef, Component } from '@angular/core'; -import { Table } from 'primeng/table'; -import { Code } from '@domain/code'; -import { Customer, Representative } from '@domain/customer'; -import { CustomerService } from '@service/customerservice'; - -@Component({ - selector: 'filter-menu-doc', - template: ` -

Filters are displayed in an overlay.

-
- -
- - -
- - - - - -
-
- - - -
- Name - -
- - -
- Country - -
- - -
- Agent - - -
- Agent Picker -
-
- - - -
- - {{ option.name }} -
-
-
-
-
-
- - -
- Date - -
- - -
- Balance - -
- - -
- Status - - - - - - - - - -
- - -
- Activity - - - -
- 0 - {{ value[0] }} - {{ value[1] }} -
-
-
-
- - -
- Verified - -
- - -
- - - - {{ customer.name }} - - - - {{ customer.country.name }} - - - - {{ customer.representative.name }} - - - {{ customer.date | date : 'MM/dd/yyyy' }} - - - {{ customer.balance | currency : 'USD' : 'symbol' }} - - - - - - - - - - - - - - - No customers found. - - -
-
-
- `, - changeDetection: ChangeDetectionStrategy.OnPush -}) -export class FilterMenuDoc { - customers!: Customer[]; - - representatives!: Representative[]; - - statuses!: any[]; - - loading: boolean = true; - - activityValues: number[] = [0, 100]; - - constructor(private customerService: CustomerService, private cd: ChangeDetectorRef) {} - - loadDemoData() { - this.customerService.getCustomersLarge().then((customers) => { - this.customers = customers; - this.loading = false; - - this.customers.forEach((customer) => (customer.date = new Date(customer.date))); - this.cd.markForCheck(); - }); - - this.representatives = [ - { name: 'Amy Elsner', image: 'amyelsner.png' }, - { name: 'Anna Fali', image: 'annafali.png' }, - { name: 'Asiya Javayant', image: 'asiyajavayant.png' }, - { name: 'Bernardo Dominic', image: 'bernardodominic.png' }, - { name: 'Elwin Sharvill', image: 'elwinsharvill.png' }, - { name: 'Ioni Bowcher', image: 'ionibowcher.png' }, - { name: 'Ivan Magalhaes', image: 'ivanmagalhaes.png' }, - { name: 'Onyama Limba', image: 'onyamalimba.png' }, - { name: 'Stephen Shaw', image: 'stephenshaw.png' }, - { name: 'Xuxue Feng', image: 'xuxuefeng.png' } - ]; - - this.statuses = [ - { label: 'Unqualified', value: 'unqualified' }, - { label: 'Qualified', value: 'qualified' }, - { label: 'New', value: 'new' }, - { label: 'Negotiation', value: 'negotiation' }, - { label: 'Renewal', value: 'renewal' }, - { label: 'Proposal', value: 'proposal' } - ]; - } - - clear(table: Table) { - table.clear(); - } - - getSeverity(status: string) { - switch (status) { - case 'unqualified': - return 'danger'; - - case 'qualified': - return 'success'; - - case 'new': - return 'info'; - - case 'negotiation': - return 'warning'; - - case 'renewal': - return null; - } - } - - code: Code = { - basic: ` - -
- - - - - -
-
- - - -
- Name - -
- - -
- Country - -
- - -
- Agent - - -
- Agent Picker -
-
- - - -
- - {{ option.name }} -
-
-
-
-
-
- - -
- Date - -
- - -
- Balance - -
- - -
- Status - - - - - - - - - -
- - -
- Activity - - - -
- {{ activityValues[0] }} - {{ activityValues[1] }} -
-
-
-
- - -
- Verified - -
- - -
- - - - {{ customer.name }} - - - - {{ customer.country.name }} - - - - {{ customer.representative.name }} - - - {{ customer.date | date: 'MM/dd/yyyy' }} - - - {{ customer.balance | currency: 'USD':'symbol' }} - - - - - - - - - - - - - - - No customers found. - - -
`, - html: ` -
- - -
- - - - - -
-
- - - -
- Name - -
- - -
- Country - -
- - -
- Agent - - -
- Agent Picker -
-
- - - -
- - {{ option.name }} -
-
-
-
-
-
- - -
- Date - -
- - -
- Balance - -
- - -
- Status - - - - - - - - - -
- - -
- Activity - - - -
- {{ activityValues[0] }} - {{ activityValues[1] }} -
-
-
-
- - -
- Verified - -
- - -
- - - - {{ customer.name }} - - - - {{ customer.country.name }} - - - - {{ customer.representative.name }} - - - {{ customer.date | date: 'MM/dd/yyyy' }} - - - {{ customer.balance | currency: 'USD':'symbol' }} - - - - - - - - - - - - - - - No customers found. - - -
-
`, - typescript: ` -import { Component, OnInit } from '@angular/core'; -import { Table } from 'primeng/table'; -import { Customer, Representative } from '@domain/customer'; -import { CustomerService } from '@service/customerservice'; - -@Component({ - selector: 'table-filter-menu-demo', - templateUrl: 'table-filter-menu-demo.html', - styleUrls: ['table-filter-menu-demo.scss'] -}) -export class TableFilterMenuDemo implements OnInit { - customers!: Customer[]; - - representatives!: Representative[]; - - statuses!: any[]; - - loading: boolean = true; - - activityValues: number[] = [0, 100]; - - constructor(private customerService: CustomerService) {} - - ngOnInit() { - this.customerService.getCustomersLarge().then((customers) => { - this.customers = customers; - this.loading = false; - - this.customers.forEach((customer) => (customer.date = new Date(customer.date))); - }); - - this.representatives = [ - { name: 'Amy Elsner', image: 'amyelsner.png' }, - { name: 'Anna Fali', image: 'annafali.png' }, - { name: 'Asiya Javayant', image: 'asiyajavayant.png' }, - { name: 'Bernardo Dominic', image: 'bernardodominic.png' }, - { name: 'Elwin Sharvill', image: 'elwinsharvill.png' }, - { name: 'Ioni Bowcher', image: 'ionibowcher.png' }, - { name: 'Ivan Magalhaes', image: 'ivanmagalhaes.png' }, - { name: 'Onyama Limba', image: 'onyamalimba.png' }, - { name: 'Stephen Shaw', image: 'stephenshaw.png' }, - { name: 'Xuxue Feng', image: 'xuxuefeng.png' } - ]; - - this.statuses = [ - { label: 'Unqualified', value: 'unqualified' }, - { label: 'Qualified', value: 'qualified' }, - { label: 'New', value: 'new' }, - { label: 'Negotiation', value: 'negotiation' }, - { label: 'Renewal', value: 'renewal' }, - { label: 'Proposal', value: 'proposal' } - ]; - } - - clear(table: Table) { - table.clear(); - } - - getSeverity(status: string) { - switch (status.toLowerCase()) { - case 'unqualified': - return 'danger'; - - case 'qualified': - return 'success'; - - case 'new': - return 'info'; - - case 'negotiation': - return 'warning'; - - case 'renewal': - return null; - } - } -}`, - scss: ` -:host ::ng-deep { - .p-progressbar { - height: .5rem; - background-color: #D8DADC; - - .p-progressbar-value { - background-color: #607D8B; - } - } -}`, - data: `{ - id: 1000, - name: 'James Butt', - country: { - name: 'Algeria', - code: 'dz' - }, - company: 'Benton, John B Jr', - date: '2015-09-13', - status: 'unqualified', - verified: true, - activity: 17, - representative: { - name: 'Ioni Bowcher', - image: 'ionibowcher.png' - }, - balance: 70663 -}, -...`, - service: ['CustomerService'] - }; - - extFiles = [ - { - path: 'src/domain/customer.ts', - content: ` -export interface Country { - name?: string; - code?: string; -} - -export interface Representative { - name?: string; - image?: string; -} - -export interface Customer { - id?: number; - name?: string; - country?: Country; - company?: string; - date?: string | Date; - status?: string; - activity?: number; - representative?: Representative; - verified?: boolean; - balance?: number; -}` - } - ]; -} diff --git a/src/app/showcase/doc/table/tabledoc.module.ts b/src/app/showcase/doc/table/tabledoc.module.ts index 63dba95dfa7..f0213ffbc25 100644 --- a/src/app/showcase/doc/table/tabledoc.module.ts +++ b/src/app/showcase/doc/table/tabledoc.module.ts @@ -45,7 +45,6 @@ import { CustomSortDoc } from './customsortdoc'; import { DynamicDoc } from './dynamicdoc'; import { ExpandableRowGroupDoc } from './expandablerowgroupdoc'; import { ExportDoc } from './exportdoc'; -import { FilterMenuDoc } from './filtermenudoc'; import { FilterBasicDoc } from './filterbasic'; import { FlexibleScrollDoc } from './flexiblescrolldoc'; import { FrozenColumnsDoc } from './frozencolumnsdoc'; @@ -143,7 +142,6 @@ import { FilterAdvancedDoc } from './filteradvanceddoc'; DynamicDoc, ExpandableRowGroupDoc, ExportDoc, - FilterMenuDoc, FilterBasicDoc, FilterAdvancedDoc, FlexibleScrollDoc,