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
mehmetcetin01140 committed Jan 4, 2024
2 parents 91b401b + 6303b4b commit 8d782b9
Show file tree
Hide file tree
Showing 29 changed files with 739 additions and 740 deletions.
1 change: 0 additions & 1 deletion src/app/components/checkbox/checkbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,4 @@ describe('Checkbox', () => {

expect(iconEl.className).toContain('pi pi-new-check');
});

});
43 changes: 24 additions & 19 deletions src/app/components/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1850,6 +1850,7 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable

if (this.lazy && this.paginator) {
(rangeStart as number) -= <number>this.first;
(rangeEnd as number) -= <number>this.first;
}

let rangeRowsData = [];
Expand Down Expand Up @@ -2033,7 +2034,7 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable
clearTimeout(this.filterTimeout);
}
if (!this.isFilterBlank(value)) {
this.filters[field] = field == 'global'? { value: value, matchMode: matchMode } : [{ value: value, matchMode: matchMode }];
this.filters[field] = field == 'global' ? { value: value, matchMode: matchMode } : [{ value: value, matchMode: matchMode }];
} else if (this.filters[field]) {
delete this.filters[field];
}
Expand Down Expand Up @@ -2264,28 +2265,32 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable
}
}

const exportableColumns: any[] = (<any[]>columns).filter(column => column.exportable !== false && column.field);
const exportableColumns: any[] = (<any[]>columns).filter((column) => column.exportable !== false && column.field);

//headers
csv += exportableColumns.map(column => '"' + this.getExportHeader(column) + '"').join(this.csvSeparator);
csv += exportableColumns.map((column) => '"' + this.getExportHeader(column) + '"').join(this.csvSeparator);

//body
const body = data.map((record: any) =>
exportableColumns.map(column => {
let cellData = ObjectUtils.resolveFieldData(record, column.field);

if (cellData != null) {
if (this.exportFunction) {
cellData = this.exportFunction({
data: cellData,
field: column.field
});
} else cellData = String(cellData).replace(/"/g, '""');
} else cellData = '';

return '"' + cellData + '"';
}).join(this.csvSeparator)
).join('\n');
const body = data
.map((record: any) =>
exportableColumns
.map((column) => {
let cellData = ObjectUtils.resolveFieldData(record, column.field);

if (cellData != null) {
if (this.exportFunction) {
cellData = this.exportFunction({
data: cellData,
field: column.field
});
} else cellData = String(cellData).replace(/"/g, '""');
} else cellData = '';

return '"' + cellData + '"';
})
.join(this.csvSeparator)
)
.join('\n');

if (body.length) {
csv += '\n' + body;
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/toast/toast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export class ToastItem implements AfterViewInit, OnDestroy {
});

event.preventDefault();
}
};

get closeAriaLabel() {
return this.config.translation.aria ? this.config.translation.aria.close : undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,5 +201,4 @@ describe('TriStateCheckbox', () => {
expect(onKeyDownSpy).toHaveBeenCalled();
expect(tristate.value).toBeUndefined();
});

});
6 changes: 1 addition & 5 deletions src/app/showcase/doc/chart/chartjsdoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ export class ChartjsDoc {
code: Code = {
typescript: `
npm install chart.js --save
"scripts": [
"../node_modules/chart.js/dist/chart.js",
//..others
],`
`
};
}
2 changes: 1 addition & 1 deletion src/app/showcase/doc/chart/doughnutdoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class DoughnutDoc implements OnInit {
ngOnInit() {
this.initChart();
}

initChart() {
if (isPlatformBrowser(this.platformId)) {
const documentStyle = getComputedStyle(document.documentElement);
Expand Down
6 changes: 3 additions & 3 deletions src/app/showcase/doc/chart/horizontalbardoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class HorizontalBarDoc implements OnInit {
options: any;

subscription!: Subscription;

constructor(@Inject(PLATFORM_ID) private platformId: any, private configService: AppConfigService, private cd: ChangeDetectorRef) {
this.subscription = this.configService.configUpdate$.pipe(debounceTime(25)).subscribe((config) => {
this.initChart();
Expand All @@ -30,10 +30,10 @@ export class HorizontalBarDoc implements OnInit {
}

ngOnInit() {
this.initChart()
this.initChart();
}

initChart(){
initChart() {
if (isPlatformBrowser(this.platformId)) {
const documentStyle = getComputedStyle(document.documentElement);
const textColor = documentStyle.getPropertyValue('--text-color');
Expand Down
2 changes: 1 addition & 1 deletion src/app/showcase/doc/chart/piedoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class PieDoc implements OnInit {
options: any;

subscription!: Subscription;

constructor(@Inject(PLATFORM_ID) private platformId: any, private configService: AppConfigService, private cd: ChangeDetectorRef) {
this.subscription = this.configService.configUpdate$.pipe(debounceTime(25)).subscribe((config) => {
this.initChart();
Expand Down
4 changes: 2 additions & 2 deletions src/app/showcase/doc/chart/stackedbardoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class StackedBarDoc implements OnInit {
maintainAspectRatio: false,
aspectRatio: 0.8,
plugins: {
tooltips: {
tooltip: {
mode: 'index',
intersect: false
},
Expand Down Expand Up @@ -156,7 +156,7 @@ export class ChartStackedBarDemo implements OnInit {
maintainAspectRatio: false,
aspectRatio: 0.8,
plugins: {
tooltips: {
tooltip: {
mode: 'index',
intersect: false
},
Expand Down
4 changes: 2 additions & 2 deletions src/app/showcase/doc/chart/verticalbardoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ export class VerticalBarDoc implements OnInit {
}

ngOnInit() {
this.initChart()
this.initChart();
}

initChart(){
initChart() {
if (isPlatformBrowser(this.platformId)) {
const documentStyle = getComputedStyle(document.documentElement);
const textColor = documentStyle.getPropertyValue('--text-color');
Expand Down
4 changes: 2 additions & 2 deletions src/app/showcase/doc/guides/csslayer/specificitydoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { Code } from 'src/app/showcase/domain/code';
</p>
<p>
For example, let's assume you need to remove the rounded borders of the InputSwitch component defined by the theme in use. In order to achieve this, <i>.p-inputswitch .p-inputswitch-slider</i> selector needs to be overriden. Without
the layers, we'd have to write a stronger css or use <i>!important</i> however, with layers, this does not present an issue as your CSS can always override PrimeNG with a more straightforward class name such as
<i>my-inputswitch</i>. Another advantage of this approach is that it does not force you to figure out the built-in class names of the components.
the layers, we'd have to write a stronger css or use <i>!important</i> however, with layers, this does not present an issue as your CSS can always override PrimeNG with a more straightforward class name such as <i>my-inputswitch</i>.
Another advantage of this approach is that it does not force you to figure out the built-in class names of the components.
</p>
<div class="card flex justify-content-center">
<p-inputSwitch [(ngModel)]="checked" styleClass="my-inputswitch" />
Expand Down
2 changes: 1 addition & 1 deletion src/app/showcase/doc/table/basicdoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class BasicDoc {
this.cd.markForCheck();
});
}

code: Code = {
basic: `<p-table [value]="products" [tableStyle]="{ 'min-width': '50rem' }">
<ng-template pTemplate="header">
Expand Down
72 changes: 36 additions & 36 deletions src/app/showcase/doc/table/columngroupdoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,42 @@ import { Code } from '../../domain/code';
<p>Columns can be grouped using rowspan and <i>colspan</i> properties.</p>
</app-docsectiontext>
<p-deferred-demo (load)="loadDemoData()">
<div class="card">
<p-table [value]="sales" [tableStyle]="{ 'min-width': '50rem' }">
<ng-template pTemplate="header">
<tr>
<th rowspan="3">Product</th>
<th colspan="4">Sale Rate</th>
</tr>
<tr>
<th colspan="2">Sales</th>
<th colspan="2">Profits</th>
</tr>
<tr>
<th>Last Year</th>
<th>This Year</th>
<th>Last Year</th>
<th>This Year</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-sale>
<tr>
<td>{{ sale.product }}</td>
<td>{{ sale.lastYearSale }}%</td>
<td>{{ sale.thisYearSale }}%</td>
<td>{{ sale.lastYearProfit | currency : 'USD' }}</td>
<td>{{ sale.thisYearProfit | currency : 'USD' }}</td>
</tr>
</ng-template>
<ng-template pTemplate="footer">
<tr>
<td colspan="3" class="text-right">Totals</td>
<td>{{ lastYearTotal | currency : 'USD' }}</td>
<td>{{ thisYearTotal | currency : 'USD' }}</td>
</tr>
</ng-template>
</p-table>
</div>
<div class="card">
<p-table [value]="sales" [tableStyle]="{ 'min-width': '50rem' }">
<ng-template pTemplate="header">
<tr>
<th rowspan="3">Product</th>
<th colspan="4">Sale Rate</th>
</tr>
<tr>
<th colspan="2">Sales</th>
<th colspan="2">Profits</th>
</tr>
<tr>
<th>Last Year</th>
<th>This Year</th>
<th>Last Year</th>
<th>This Year</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-sale>
<tr>
<td>{{ sale.product }}</td>
<td>{{ sale.lastYearSale }}%</td>
<td>{{ sale.thisYearSale }}%</td>
<td>{{ sale.lastYearProfit | currency : 'USD' }}</td>
<td>{{ sale.thisYearProfit | currency : 'USD' }}</td>
</tr>
</ng-template>
<ng-template pTemplate="footer">
<tr>
<td colspan="3" class="text-right">Totals</td>
<td>{{ lastYearTotal | currency : 'USD' }}</td>
<td>{{ thisYearTotal | currency : 'USD' }}</td>
</tr>
</ng-template>
</p-table>
</div>
</p-deferred-demo>
<app-code [code]="code" selector="table-column-group-demo"></app-code>`,
changeDetection: ChangeDetectionStrategy.OnPush
Expand Down
52 changes: 26 additions & 26 deletions src/app/showcase/doc/table/columnselectiondoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ import { ProductService } from '../../service/productservice';
<p>Selection using custom elements.</p>
</app-docsectiontext>
<p-deferred-demo (load)="loadDemoData()">
<div class="card">
<p-toast></p-toast>
<p-table [value]="products" [tableStyle]="{ 'min-width': '50rem' }">
<ng-template pTemplate="header">
<tr>
<th>Code</th>
<th>Name</th>
<th>Category</th>
<th>Quantity</th>
<th style="width: 5rem"></th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-product>
<tr>
<td>{{ product.code }}</td>
<td>{{ product.name }}</td>
<td>{{ product.category }}</td>
<td>{{ product.quantity }}</td>
<td>
<button type="button" pButton pRipple icon="pi pi-plus" (click)="selectProduct(product)"></button>
</td>
</tr>
</ng-template>
</p-table>
</div>
<div class="card">
<p-toast></p-toast>
<p-table [value]="products" [tableStyle]="{ 'min-width': '50rem' }">
<ng-template pTemplate="header">
<tr>
<th>Code</th>
<th>Name</th>
<th>Category</th>
<th>Quantity</th>
<th style="width: 5rem"></th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-product>
<tr>
<td>{{ product.code }}</td>
<td>{{ product.name }}</td>
<td>{{ product.category }}</td>
<td>{{ product.quantity }}</td>
<td>
<button type="button" pButton pRipple icon="pi pi-plus" (click)="selectProduct(product)"></button>
</td>
</tr>
</ng-template>
</p-table>
</div>
</p-deferred-demo>
<app-code [code]="code" selector="table-column-selection-demo" [extFiles]="extFiles"></app-code>`,
changeDetection: ChangeDetectionStrategy.OnPush,
Expand All @@ -47,7 +47,7 @@ export class ColumnSelectionDoc {

constructor(private productService: ProductService, private messageService: MessageService, private cd: ChangeDetectorRef) {}

loadDemoData(){
loadDemoData() {
this.productService.getProductsMini().then((data) => {
this.products = data;
this.cd.markForCheck();
Expand Down
Loading

0 comments on commit 8d782b9

Please sign in to comment.