ng-prime-tools 0.0.1 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +185 -13
- package/esm2022/lib/enums/index.mjs +6 -0
- package/esm2022/lib/enums/public_api.mjs +4 -0
- package/esm2022/lib/enums/search-criteria-type-enum.mjs +10 -0
- package/esm2022/lib/models/filter-option.mjs +2 -0
- package/esm2022/lib/models/index.mjs +6 -2
- package/esm2022/lib/models/public_api.mjs +5 -0
- package/esm2022/lib/models/search-criteria.mjs +2 -0
- package/esm2022/lib/models/table-column.mjs +2 -0
- package/esm2022/lib/multi-search-criteria/index.mjs +6 -0
- package/esm2022/lib/multi-search-criteria/multi-search-criteria.component.mjs +128 -0
- package/esm2022/lib/multi-search-criteria/multi-search-criteria.module.mjs +48 -0
- package/esm2022/lib/multi-search-criteria/public_api.mjs +4 -0
- package/esm2022/lib/ng-advanced-prime-table/index.mjs +6 -0
- package/esm2022/lib/ng-advanced-prime-table/ng-advanced-prime-table.component.mjs +316 -0
- package/esm2022/lib/ng-advanced-prime-table/ng-advanced-prime-table.module.mjs +60 -0
- package/esm2022/lib/ng-advanced-prime-table/public_api.mjs +4 -0
- package/esm2022/lib/ng-prime-tools.module.mjs +30 -0
- package/esm2022/lib/pipes/custom-currency.mjs +4 -4
- package/esm2022/lib/pipes/custom-date.pipe.mjs +44 -0
- package/esm2022/public-api.mjs +7 -9
- package/fesm2022/ng-prime-tools.mjs +393 -73
- package/fesm2022/ng-prime-tools.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/lib/enums/index.d.ts +6 -0
- package/lib/enums/index.d.ts.map +1 -0
- package/lib/enums/public_api.d.ts +3 -0
- package/lib/enums/public_api.d.ts.map +1 -0
- package/lib/enums/search-criteria-type-enum.d.ts +9 -0
- package/lib/enums/search-criteria-type-enum.d.ts.map +1 -0
- package/lib/enums/table-type-enum.d.ts +1 -0
- package/lib/enums/table-type-enum.d.ts.map +1 -0
- package/lib/models/filter-option.d.ts +5 -0
- package/lib/models/filter-option.d.ts.map +1 -0
- package/lib/models/index.d.ts +6 -1
- package/lib/models/index.d.ts.map +1 -0
- package/lib/models/public_api.d.ts +4 -0
- package/lib/models/public_api.d.ts.map +1 -0
- package/lib/models/search-criteria.d.ts +11 -0
- package/lib/models/search-criteria.d.ts.map +1 -0
- package/lib/models/{table-column.model.d.ts → table-column.d.ts} +1 -0
- package/lib/models/table-column.d.ts.map +1 -0
- package/lib/multi-search-criteria/index.d.ts +6 -0
- package/lib/multi-search-criteria/index.d.ts.map +1 -0
- package/lib/multi-search-criteria/multi-search-criteria.component.d.ts +24 -0
- package/lib/multi-search-criteria/multi-search-criteria.component.d.ts.map +1 -0
- package/lib/multi-search-criteria/multi-search-criteria.module.d.ts +16 -0
- package/lib/multi-search-criteria/multi-search-criteria.module.d.ts.map +1 -0
- package/lib/multi-search-criteria/public_api.d.ts +3 -0
- package/lib/multi-search-criteria/public_api.d.ts.map +1 -0
- package/lib/ng-advanced-prime-table/index.d.ts +6 -0
- package/lib/ng-advanced-prime-table/index.d.ts.map +1 -0
- package/lib/{advanced-table/advanced-table.component.d.ts → ng-advanced-prime-table/ng-advanced-prime-table.component.d.ts} +6 -4
- package/lib/ng-advanced-prime-table/ng-advanced-prime-table.component.d.ts.map +1 -0
- package/lib/ng-advanced-prime-table/ng-advanced-prime-table.module.d.ts +20 -0
- package/lib/ng-advanced-prime-table/ng-advanced-prime-table.module.d.ts.map +1 -0
- package/lib/ng-advanced-prime-table/public_api.d.ts +3 -0
- package/lib/ng-advanced-prime-table/public_api.d.ts.map +1 -0
- package/lib/ng-prime-tools.module.d.ts +11 -0
- package/lib/ng-prime-tools.module.d.ts.map +1 -0
- package/lib/pipes/custom-currency.d.ts +1 -0
- package/lib/pipes/custom-currency.d.ts.map +1 -0
- package/lib/pipes/custom-date.pipe.d.ts +8 -0
- package/lib/pipes/custom-date.pipe.d.ts.map +1 -0
- package/ng-prime-tools.d.ts.map +1 -0
- package/package.json +22 -11
- package/public-api.d.ts +6 -5
- package/public-api.d.ts.map +1 -0
- package/esm2022/lib/advanced-table/advanced-table.component.mjs +0 -288
- package/esm2022/lib/models/table-column.model.mjs +0 -2
- package/esm2022/lib/ng-prime-tools.component.mjs +0 -11
- package/esm2022/lib/ng-prime-tools.service.mjs +0 -14
- package/lib/ng-prime-tools.component.d.ts +0 -5
- package/lib/ng-prime-tools.service.d.ts +0 -6
@@ -1,59 +1,30 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import {
|
3
|
-
import * as i2 from 'primeng/table';
|
4
|
-
import { TableModule } from 'primeng/table';
|
2
|
+
import { Pipe, EventEmitter, Component, Input, Output, ViewChild, NgModule } from '@angular/core';
|
5
3
|
import * as i1 from '@angular/common';
|
6
4
|
import { CommonModule } from '@angular/common';
|
7
|
-
import * as
|
8
|
-
import {
|
5
|
+
import * as i2 from 'primeng/table';
|
6
|
+
import { TableModule } from 'primeng/table';
|
7
|
+
import * as i3 from 'primeng/api';
|
8
|
+
import * as i4 from 'primeng/inputtext';
|
9
|
+
import { InputTextModule } from 'primeng/inputtext';
|
9
10
|
import * as i5 from 'primeng/button';
|
10
11
|
import { ButtonModule } from 'primeng/button';
|
11
12
|
import * as i6 from 'primeng/calendar';
|
12
13
|
import { CalendarModule } from 'primeng/calendar';
|
13
|
-
import * as
|
14
|
-
import {
|
14
|
+
import * as i7 from '@angular/forms';
|
15
|
+
import { FormsModule } from '@angular/forms';
|
15
16
|
import * as i8 from 'primeng/multiselect';
|
16
17
|
import { MultiSelectModule } from 'primeng/multiselect';
|
17
|
-
import * as i9 from 'primeng/
|
18
|
+
import * as i9 from 'primeng/tag';
|
19
|
+
import { TagModule } from 'primeng/tag';
|
20
|
+
import * as i10 from 'primeng/iconfield';
|
18
21
|
import { IconFieldModule } from 'primeng/iconfield';
|
19
|
-
import * as
|
22
|
+
import * as i11 from 'primeng/inputicon';
|
20
23
|
import { InputIconModule } from 'primeng/inputicon';
|
21
|
-
import * as
|
22
|
-
import {
|
23
|
-
import * as
|
24
|
-
|
25
|
-
class AdvancedPrimeToolsService {
|
26
|
-
constructor() { }
|
27
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: AdvancedPrimeToolsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
28
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: AdvancedPrimeToolsService, providedIn: 'root' }); }
|
29
|
-
}
|
30
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: AdvancedPrimeToolsService, decorators: [{
|
31
|
-
type: Injectable,
|
32
|
-
args: [{
|
33
|
-
providedIn: 'root'
|
34
|
-
}]
|
35
|
-
}], ctorParameters: () => [] });
|
36
|
-
|
37
|
-
class AdvancedPrimeToolsComponent {
|
38
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: AdvancedPrimeToolsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
39
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.3", type: AdvancedPrimeToolsComponent, isStandalone: true, selector: "lib-ng-prime-tools", ngImport: i0, template: ` <p>ng-prime-tools works!</p> `, isInline: true, styles: [""] }); }
|
40
|
-
}
|
41
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: AdvancedPrimeToolsComponent, decorators: [{
|
42
|
-
type: Component,
|
43
|
-
args: [{ selector: 'lib-ng-prime-tools', standalone: true, imports: [], template: ` <p>ng-prime-tools works!</p> ` }]
|
44
|
-
}] });
|
45
|
-
|
46
|
-
var TableTypeEnum;
|
47
|
-
(function (TableTypeEnum) {
|
48
|
-
TableTypeEnum["DATE"] = "DATE";
|
49
|
-
TableTypeEnum["STRING"] = "STRING";
|
50
|
-
TableTypeEnum["AMOUNT"] = "AMOUNT";
|
51
|
-
TableTypeEnum["NUMBER"] = "NUMBER";
|
52
|
-
TableTypeEnum["MULTISELECT"] = "MULTISELECT";
|
53
|
-
TableTypeEnum["CURRENCY"] = "CURRENCY";
|
54
|
-
TableTypeEnum["BOOLEAN"] = "BOOLEAN";
|
55
|
-
TableTypeEnum["ACTION"] = "ACTION";
|
56
|
-
})(TableTypeEnum || (TableTypeEnum = {}));
|
24
|
+
import * as i8$1 from 'primeng/inputnumber';
|
25
|
+
import { InputNumberModule } from 'primeng/inputnumber';
|
26
|
+
import * as i9$1 from 'primeng/panel';
|
27
|
+
import { PanelModule } from 'primeng/panel';
|
57
28
|
|
58
29
|
class CustomCurrencyPipe {
|
59
30
|
transform(value, currency = 'MAD', decimalPlaces) {
|
@@ -80,10 +51,10 @@ class CustomCurrencyPipe {
|
|
80
51
|
}
|
81
52
|
return formattedCurrency;
|
82
53
|
}
|
83
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
84
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
54
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: CustomCurrencyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
55
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: CustomCurrencyPipe, isStandalone: true, name: "customCurrency" }); }
|
85
56
|
}
|
86
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
57
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: CustomCurrencyPipe, decorators: [{
|
87
58
|
type: Pipe,
|
88
59
|
args: [{
|
89
60
|
name: 'customCurrency',
|
@@ -91,7 +62,49 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImpor
|
|
91
62
|
}]
|
92
63
|
}] });
|
93
64
|
|
94
|
-
class
|
65
|
+
class CustomDatePipe {
|
66
|
+
transform(value, format = 'dd/MM/yyyy') {
|
67
|
+
if (!value)
|
68
|
+
return null;
|
69
|
+
if (typeof value === 'string') {
|
70
|
+
const parts = value.split('/');
|
71
|
+
if (parts.length === 3) {
|
72
|
+
const day = parseInt(parts[0], 10);
|
73
|
+
const month = parseInt(parts[1], 10) - 1;
|
74
|
+
const year = parseInt(parts[2], 10);
|
75
|
+
const date = new Date(year, month, day);
|
76
|
+
if (isNaN(date.getTime()))
|
77
|
+
return null;
|
78
|
+
const options = {
|
79
|
+
year: 'numeric',
|
80
|
+
month: '2-digit',
|
81
|
+
day: '2-digit',
|
82
|
+
};
|
83
|
+
return new Intl.DateTimeFormat('en-GB', options).format(date);
|
84
|
+
}
|
85
|
+
}
|
86
|
+
else if (value instanceof Date) {
|
87
|
+
// If the value is already a Date object
|
88
|
+
const options = {
|
89
|
+
year: 'numeric',
|
90
|
+
month: '2-digit',
|
91
|
+
day: '2-digit',
|
92
|
+
};
|
93
|
+
return new Intl.DateTimeFormat('en-GB', options).format(value);
|
94
|
+
}
|
95
|
+
return null;
|
96
|
+
}
|
97
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: CustomDatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
98
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: CustomDatePipe, name: "customDate" }); }
|
99
|
+
}
|
100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: CustomDatePipe, decorators: [{
|
101
|
+
type: Pipe,
|
102
|
+
args: [{
|
103
|
+
name: 'customDate',
|
104
|
+
}]
|
105
|
+
}] });
|
106
|
+
|
107
|
+
class NgAdvancedPrimeTableComponent {
|
95
108
|
constructor() {
|
96
109
|
// Inputs
|
97
110
|
this.data = [];
|
@@ -128,8 +141,8 @@ class AdvancedTableComponent {
|
|
128
141
|
// Transform the date fields based on column metadata
|
129
142
|
this.data = this.formatingDateFields();
|
130
143
|
this.globalFilterFields = this.columns
|
131
|
-
.
|
132
|
-
.
|
144
|
+
.filter((col) => col.code !== undefined && col.isFilter !== false)
|
145
|
+
.map((col) => col.code);
|
133
146
|
this.initializePagination();
|
134
147
|
this.initializeActions();
|
135
148
|
// Set default value for isSortable
|
@@ -183,7 +196,10 @@ class AdvancedTableComponent {
|
|
183
196
|
}
|
184
197
|
initializePagination() {
|
185
198
|
if (this.isPaginated) {
|
186
|
-
|
199
|
+
// Check if rowsPerPage is undefined or an empty array
|
200
|
+
if (!this.rowsPerPage || this.rowsPerPage.length === 0) {
|
201
|
+
this.rowsPerPage = [20, 30, 40];
|
202
|
+
}
|
187
203
|
this.rows = this.rowsPerPage[0];
|
188
204
|
}
|
189
205
|
}
|
@@ -306,26 +322,60 @@ class AdvancedTableComponent {
|
|
306
322
|
}
|
307
323
|
filterGlobal(event) {
|
308
324
|
const target = event.target;
|
309
|
-
|
325
|
+
const value = target.value.toLowerCase();
|
326
|
+
// Create a new filtered dataset
|
327
|
+
const filteredData = this.data.filter((item) => {
|
328
|
+
return this.globalFilterFields.some((field) => {
|
329
|
+
const column = this.columns.find((col) => col.code === field);
|
330
|
+
if (!column) {
|
331
|
+
return false;
|
332
|
+
}
|
333
|
+
// Handle different column types
|
334
|
+
if (column.type === TableTypeEnum.DATE) {
|
335
|
+
const itemDate = this.formatDate(item[field]);
|
336
|
+
return itemDate && itemDate.includes(value);
|
337
|
+
}
|
338
|
+
else if (column.type === TableTypeEnum.AMOUNT ||
|
339
|
+
column.type === TableTypeEnum.NUMBER) {
|
340
|
+
return (item[field] && item[field].toString().toLowerCase().includes(value));
|
341
|
+
}
|
342
|
+
else {
|
343
|
+
return (item[field] && item[field].toString().toLowerCase().includes(value));
|
344
|
+
}
|
345
|
+
});
|
346
|
+
});
|
347
|
+
// Update the table's value
|
348
|
+
this.dt.value = filteredData;
|
349
|
+
}
|
350
|
+
formatDate(date) {
|
351
|
+
if (!date)
|
352
|
+
return '';
|
353
|
+
if (date instanceof Date) {
|
354
|
+
// Handle Date object
|
355
|
+
const day = date.getDate().toString().padStart(2, '0');
|
356
|
+
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
357
|
+
const year = date.getFullYear().toString();
|
358
|
+
return `${day}/${month}/${year}`;
|
359
|
+
}
|
360
|
+
else if (typeof date === 'string') {
|
361
|
+
// Handle string date
|
362
|
+
const parts = date.split('/');
|
363
|
+
if (parts.length === 3) {
|
364
|
+
return `${parts[0]}/${parts[1]}/${parts[2]}`;
|
365
|
+
}
|
366
|
+
else {
|
367
|
+
// Handle partial dates
|
368
|
+
return date;
|
369
|
+
}
|
370
|
+
}
|
371
|
+
return '';
|
310
372
|
}
|
311
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
312
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.3", type: AdvancedTableComponent, isStandalone: true, selector: "advanced-table", inputs: { data: "data", columns: "columns", totalRecords: "totalRecords", rowsPerPage: "rowsPerPage", hasSearchFilter: "hasSearchFilter", hasColumnFilter: "hasColumnFilter", isPaginated: "isPaginated", actions: "actions", isSortable: "isSortable" }, outputs: { filter: "filter", search: "search" }, viewQueries: [{ propertyName: "dt", first: true, predicate: ["dt"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"table-container\">\n <div>\n <p-table\n #dt\n [value]=\"data\"\n dataKey=\"id\"\n [rows]=\"rows\"\n [paginator]=\"isPaginated\"\n [globalFilterFields]=\"globalFilterFields\"\n styleClass=\"p-datatable-gridlines\"\n [rowsPerPageOptions]=\"rowsPerPage\"\n styleClass=\"p-datatable-striped\"\n editMode=\"row\"\n [globalFilterFields]=\"globalFilterFields\"\n >\n <ng-template pTemplate=\"caption\">\n <div class=\"flex\">\n <div>\n <h3>Total: {{ totalRecords }}</h3>\n </div>\n\n <div>\n <p-button\n label=\"Clear\"\n [outlined]=\"true\"\n icon=\"pi pi-filter-slash\"\n (click)=\"clear(dt)\"\n class=\"bt-filter-btn\"\n />\n </div>\n <div class=\"ml-auto\" *ngIf=\"hasSearchFilter\">\n <!-- Add this wrapper div with ml-auto class -->\n <p-iconField iconPosition=\"left\" class=\"ml-auto\">\n <p-inputIcon>\n <i class=\"pi pi-search\"></i>\n </p-inputIcon>\n <input\n pInputText\n type=\"text\"\n [(ngModel)]=\"searchValue\"\n (input)=\"filterGlobal($event)\"\n placeholder=\"Search keyword\"\n />\n </p-iconField>\n </div>\n </div>\n </ng-template>\n\n <ng-template pTemplate=\"header\">\n <tr>\n <th *ngFor=\"let col of columns\">\n <ng-container\n *ngIf=\"isSortable && col.isSortable !== false; else noSortHeader\"\n >\n <th pSortableColumn=\"{{ col.code }}\" style=\"width: 20%\">\n <div class=\"header-container\">\n <span>{{ col.title }}</span>\n <p-sortIcon field=\"{{ col.code }}\" />\n <ng-container *ngIf=\"col.isFilter !== false\">\n <p-columnFilter\n *ngIf=\"col.type === 'AMOUNT'\"\n display=\"menu\"\n [field]=\"col.code\"\n [type]=\"getColumnFilterType(col)\"\n [currency]=\"getCurrencySymbol(col)\"\n ></p-columnFilter>\n\n <p-columnFilter\n *ngIf=\"col.type !== 'AMOUNT'\"\n display=\"menu\"\n [field]=\"col.code\"\n display=\"menu\"\n [type]=\"getColumnFilterType(col)\"\n [type]=\"getColumnFilterType(col)\"\n >\n <ng-template\n pTemplate=\"filter\"\n let-value\n let-filterCallback=\"filterCallback\"\n *ngIf=\"getColumnFilterType(col) === 'date'\"\n >\n <p-calendar\n [ngModel]=\"value\"\n (ngModelChange)=\"filterCallback($event)\"\n [dateFormat]=\"'dd/mm/yy'\"\n ></p-calendar>\n </ng-template>\n\n <ng-template\n pTemplate=\"filter\"\n let-value\n let-filterCallback=\"filterCallback\"\n *ngIf=\"getColumnFilterType(col) === 'multiSelect'\"\n >\n <p-multiSelect\n [options]=\"col.filterOptions\"\n [ngModel]=\"value\"\n (ngModelChange)=\"filterCallback($event)\"\n [display]=\"'chip'\"\n placeholder=\"Select\"\n class=\"custom-multiselect\"\n ></p-multiSelect>\n </ng-template>\n </p-columnFilter>\n </ng-container>\n </div>\n </th>\n </ng-container>\n <ng-template #noSortHeader>\n <th>\n <div class=\"header-container\">\n <span>{{ col.title }}</span>\n <ng-container *ngIf=\"col.isFilter !== false\">\n <p-columnFilter\n *ngIf=\"col.type === 'AMOUNT'\"\n display=\"menu\"\n [field]=\"col.code\"\n [type]=\"getColumnFilterType(col)\"\n [currency]=\"getCurrencySymbol(col)\"\n ></p-columnFilter>\n\n <p-columnFilter\n *ngIf=\"col.type !== 'AMOUNT'\"\n display=\"menu\"\n [field]=\"col.code\"\n [type]=\"getColumnFilterType(col)\"\n >\n <ng-template\n pTemplate=\"filter\"\n let-value\n let-filterCallback=\"filterCallback\"\n *ngIf=\"getColumnFilterType(col) === 'date'\"\n >\n <p-calendar\n [ngModel]=\"value\"\n (ngModelChange)=\"filterCallback($event)\"\n [dateFormat]=\"'dd/mm/yy'\"\n ></p-calendar>\n </ng-template>\n\n <ng-template\n pTemplate=\"filter\"\n let-value\n let-filterCallback=\"filterCallback\"\n *ngIf=\"getColumnFilterType(col) === 'multiSelect'\"\n >\n <p-multiSelect\n [options]=\"col.filterOptions\"\n [ngModel]=\"value\"\n (ngModelChange)=\"filterCallback($event)\"\n [display]=\"'chip'\"\n placeholder=\"Select\"\n class=\"custom-multiselect\"\n ></p-multiSelect>\n </ng-template>\n </p-columnFilter>\n </ng-container>\n </div>\n </th>\n </ng-template>\n </th>\n </tr>\n </ng-template>\n\n <ng-template\n pTemplate=\"body\"\n let-data\n let-editing=\"editing\"\n let-ri=\"rowIndex\"\n >\n <!-- Render a table row and make it editable if `isEdit` is true -->\n <tr [pEditableRow]=\"isEdit ? data : null\">\n <!-- Loop through each column and render corresponding table cells -->\n <ng-container *ngFor=\"let col of columns\">\n <ng-container *ngIf=\"col.code !== undefined\">\n <!-- Check if the data for the column exists -->\n <ng-container *ngIf=\"data[col.code] !== undefined\">\n <!-- Render an editable cell if the column is editable -->\n <td *ngIf=\"isEditable(col.code); else normalTD\">\n <!-- Multi-select input for columns that are multi-selectable -->\n <ng-container\n *ngIf=\"isMultiSelect(col.code); else datePicker\"\n >\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <p-multiSelect\n appendTo=\"body\"\n [ngModel]=\"data[col.code]\"\n [style]=\"{ width: '100%' }\"\n (ngModelChange)=\"\n changeHandler(data.id, col.code, $event)\n \"\n [options]=\"optionValues\"\n ></p-multiSelect>\n </ng-template>\n <ng-template pTemplate=\"output\">\n <div class=\"multi-select-container\">\n <ng-container *ngFor=\"let rec of data[col.code]\">\n <p-tag [value]=\"rec\"></p-tag>\n </ng-container>\n </div>\n </ng-template>\n </p-cellEditor>\n </ng-container>\n\n <!-- Date picker input for columns that require date selection -->\n <ng-template #datePicker>\n <ng-container\n *ngIf=\"isDatePicker(col.code); else normalInput\"\n >\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <p-calendar\n [inputId]=\"data[col.code]\"\n [ngModel]=\"data[col.code]\"\n (ngModelChange)=\"\n changeHandler(data.id, col.code, $event)\n \"\n [dateFormat]=\"'dd/mm/yy'\"\n ></p-calendar>\n </ng-template>\n <ng-template pTemplate=\"output\">\n {{ data[col.code] | date : \"dd/MM/yyyy\" }}\n </ng-template>\n </p-cellEditor>\n </ng-container>\n </ng-template>\n\n <!-- Normal text input for other columns -->\n <ng-template #normalInput>\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <input\n pInputText\n type=\"text\"\n [ngModel]=\"data[col.code]\"\n (change)=\"onChange($event, data.id, col.code)\"\n />\n </ng-template>\n <ng-template pTemplate=\"output\">\n <!-- Use currency pipe to format the output for AMOUNT type -->\n <ng-container\n *ngIf=\"col.type === 'AMOUNT'; else normalOutput\"\n >\n {{\n data[col.code]\n | customCurrency\n : getCurrencySymbol(col)\n : col.decimalPlaces\n }}\n </ng-container>\n <ng-template #normalOutput>\n {{ data[col.code] }}\n </ng-template>\n </ng-template>\n </p-cellEditor>\n </ng-template>\n </td>\n\n <!-- Render a normal table cell if the column is not editable -->\n <ng-template #normalTD>\n <td>\n <!-- Use customCurrency pipe to format the output for AMOUNT type with optional decimal places -->\n <ng-container\n *ngIf=\"col.type === 'AMOUNT'; else normalText\"\n >\n >\n {{\n data[col.code]\n | customCurrency\n : getCurrencySymbol(col)\n : col.decimalPlaces\n }}\n </ng-container>\n <ng-template #normalText>\n {{ data[col.code] }}\n </ng-template>\n </td>\n </ng-template>\n </ng-container>\n </ng-container>\n </ng-container>\n\n <!-- Render action buttons if there are any actions defined -->\n <td *ngIf=\"actions?.length\">\n <div class=\"action-buttons-container\">\n <!-- Delete button if deletion is allowed -->\n <div *ngIf=\"isDelete\">\n <button\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-trash\"\n (click)=\"Delete(data.id)\"\n class=\"p-button-rounded p-button-text\"\n ></button>\n </div>\n <!-- Edit, save, and cancel buttons for row editing -->\n <div>\n <button\n pInitEditableRow\n *ngIf=\"!editing\"\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-pencil\"\n (click)=\"initEditableRow(data)\"\n class=\"p-button-rounded p-button-text\"\n ></button>\n <button\n *ngIf=\"editing\"\n pSaveEditableRow\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-check\"\n (click)=\"saveEditableRow(data)\"\n class=\"p-button-rounded p-button-text\"\n ></button>\n <button\n *ngIf=\"editing\"\n pCancelEditableRow\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-times\"\n (click)=\"cancelEditableRow(data)\"\n class=\"p-button-rounded p-button-text\"\n ></button>\n </div>\n </div>\n </td>\n </tr>\n </ng-template>\n </p-table>\n </div>\n</div>\n", styles: [".date{width:100%;height:5rem;display:grid;justify-items:start;align-items:center}.filter-container{width:100%;display:flex;justify-content:space-between;align-items:center}.settings{display:flex;gap:1rem}.multi-select-container{display:flex;justify-content:center;align-items:center;gap:.3rem}::ng-deep p-table{min-width:50rem}.table-container{display:flex;flex-direction:column;gap:.5rem}::ng-deep .custom-multiselect .p-hidden-accessible input{display:none}::ng-deep .p-datatable .p-sortable-column.p-highlight:hover{background:none}::ng-deep .p-datatable .p-sortable-column:focus{box-shadow:none;outline:0 none}::ng-deep .header-container{display:flex;align-items:center}::ng-deep .header-container span{margin-right:.5em}::ng-deep p-columnfilter.p-element.ng-star-inserted{margin-top:4px}.flex{display:flex;justify-content:space-between;align-items:center}.ml-auto{margin-left:auto}::ng-deep p-inputicon{margin-right:-1.5rem;z-index:2;position:relative}::ng-deep .p-inputtext{padding-left:1.7rem}::ng-deep .bt-filter-btn button{cursor:pointer;margin-left:1rem}::ng-deep .p-icon-field-left .p-input-icon:first-of-type{left:-1rem}.table-row{text-align:center;display:flex;gap:1rem;justify-content:center}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.DatePipe, name: "date" }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i2.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "selectAll", "virtualRowHeight"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i2.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "component", type: i2.CellEditor, selector: "p-cellEditor" }, { kind: "component", type: i2.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "directive", type: i2.EditableRow, selector: "[pEditableRow]", inputs: ["pEditableRow", "pEditableRowDisabled"] }, { kind: "directive", type: i2.InitEditableRow, selector: "[pInitEditableRow]" }, { kind: "directive", type: i2.SaveEditableRow, selector: "[pSaveEditableRow]" }, { kind: "directive", type: i2.CancelEditableRow, selector: "[pCancelEditableRow]" }, { kind: "component", type: i2.ColumnFilter, selector: "p-columnFilter", inputs: ["field", "type", "display", "showMenu", "matchMode", "operator", "showOperator", "showClearButton", "showApplyButton", "showMatchModes", "showAddButton", "hideOnClear", "placeholder", "matchModeOptions", "maxConstraints", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "locale", "localeMatcher", "currency", "currencyDisplay", "useGrouping", "showButtons", "ariaLabel"], outputs: ["onShow", "onHide"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i4.InputText, selector: "[pInputText]", inputs: ["variant"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i5.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }, { kind: "component", type: i5.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "style", "styleClass", "badgeClass", "ariaLabel", "autofocus"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: CalendarModule }, { kind: "component", type: i6.Calendar, selector: "p-calendar", inputs: ["iconDisplay", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepYearPicker", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "variant", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i7.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MultiSelectModule }, { kind: "component", type: i8.MultiSelect, selector: "p-multiSelect", inputs: ["id", "ariaLabel", "style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "variant", "appendTo", "dataKey", "name", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "loading", "virtualScrollItemSize", "loadingIcon", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "showClear", "autofocus", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "defaultLabel", "placeholder", "options", "filterValue", "itemSize", "selectAll", "focusOnHover", "filterFields", "selectOnFocus", "autoOptionFocus"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad", "onRemove", "onSelectAllChange"] }, { kind: "pipe", type: CustomCurrencyPipe, name: "customCurrency" }, { kind: "ngmodule", type: IconFieldModule }, { kind: "component", type: i9.IconField, selector: "p-iconField", inputs: ["iconPosition"] }, { kind: "ngmodule", type: InputIconModule }, { kind: "component", type: i10.InputIcon, selector: "p-inputIcon", inputs: ["styleClass"] }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: i11.Tag, selector: "p-tag", inputs: ["style", "styleClass", "severity", "value", "icon", "rounded"] }] }); }
|
373
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: NgAdvancedPrimeTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
374
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: NgAdvancedPrimeTableComponent, selector: "ng-advanced-prime-table", inputs: { data: "data", columns: "columns", totalRecords: "totalRecords", rowsPerPage: "rowsPerPage", hasSearchFilter: "hasSearchFilter", hasColumnFilter: "hasColumnFilter", isPaginated: "isPaginated", actions: "actions", isSortable: "isSortable" }, outputs: { filter: "filter", search: "search" }, viewQueries: [{ propertyName: "dt", first: true, predicate: ["dt"], descendants: true }], ngImport: i0, template: "<div class=\"table-container\">\n <div>\n <p-table\n #dt\n [value]=\"data\"\n [rows]=\"rows\"\n [paginator]=\"isPaginated\"\n [globalFilterFields]=\"globalFilterFields\"\n [rowsPerPageOptions]=\"rowsPerPage\"\n dataKey=\"id\"\n styleClass=\"p-datatable-gridlines\"\n styleClass=\"p-datatable-striped\"\n editMode=\"row\"\n >\n <ng-template pTemplate=\"caption\">\n <div class=\"flex\">\n <div>\n <h3>Total: {{ totalRecords }}</h3>\n </div>\n\n <div>\n <p-button\n label=\"Clear\"\n [outlined]=\"true\"\n icon=\"pi pi-filter-slash\"\n (click)=\"clear(dt)\"\n class=\"bt-filter-btn\"\n />\n </div>\n <div class=\"ml-auto\" *ngIf=\"hasSearchFilter\">\n <!-- Add this wrapper div with ml-auto class -->\n <p-iconField iconPosition=\"left\" class=\"ml-auto\">\n <p-inputIcon>\n <i class=\"pi pi-search\"></i>\n </p-inputIcon>\n <input\n pInputText\n type=\"text\"\n [(ngModel)]=\"searchValue\"\n (input)=\"filterGlobal($event)\"\n placeholder=\"Search keyword\"\n />\n </p-iconField>\n </div>\n </div>\n </ng-template>\n\n <ng-template pTemplate=\"header\">\n <tr>\n <th *ngFor=\"let col of columns\">\n <ng-container\n *ngIf=\"isSortable && col.isSortable !== false; else noSortHeader\"\n >\n <th pSortableColumn=\"{{ col.code }}\" style=\"width: 20%\">\n <div class=\"header-container\">\n <span>{{ col.title }}</span>\n <p-sortIcon field=\"{{ col.code }}\" />\n <ng-container *ngIf=\"col.isFilter !== false\">\n <p-columnFilter\n *ngIf=\"col.type === 'AMOUNT'\"\n display=\"menu\"\n [field]=\"col.code\"\n [type]=\"getColumnFilterType(col)\"\n [currency]=\"getCurrencySymbol(col)\"\n ></p-columnFilter>\n\n <p-columnFilter\n *ngIf=\"col.type !== 'AMOUNT'\"\n display=\"menu\"\n [field]=\"col.code\"\n display=\"menu\"\n [type]=\"getColumnFilterType(col)\"\n [type]=\"getColumnFilterType(col)\"\n >\n <ng-template\n pTemplate=\"filter\"\n let-value\n let-filterCallback=\"filterCallback\"\n *ngIf=\"getColumnFilterType(col) === 'date'\"\n >\n <p-calendar\n [ngModel]=\"value\"\n (ngModelChange)=\"filterCallback($event)\"\n [dateFormat]=\"'dd/mm/yy'\"\n ></p-calendar>\n </ng-template>\n\n <ng-template\n pTemplate=\"filter\"\n let-value\n let-filterCallback=\"filterCallback\"\n *ngIf=\"getColumnFilterType(col) === 'multiSelect'\"\n >\n <p-multiSelect\n [options]=\"col.filterOptions\"\n [ngModel]=\"value\"\n (ngModelChange)=\"filterCallback($event)\"\n [display]=\"'chip'\"\n placeholder=\"Select\"\n class=\"custom-multiselect\"\n ></p-multiSelect>\n </ng-template>\n </p-columnFilter>\n </ng-container>\n </div>\n </th>\n </ng-container>\n <ng-template #noSortHeader>\n <th>\n <div class=\"header-container\">\n <span>{{ col.title }}</span>\n <ng-container *ngIf=\"col.isFilter !== false\">\n <p-columnFilter\n *ngIf=\"col.type === 'AMOUNT'\"\n display=\"menu\"\n [field]=\"col.code\"\n [type]=\"getColumnFilterType(col)\"\n [currency]=\"getCurrencySymbol(col)\"\n ></p-columnFilter>\n\n <p-columnFilter\n *ngIf=\"col.type !== 'AMOUNT'\"\n display=\"menu\"\n [field]=\"col.code\"\n [type]=\"getColumnFilterType(col)\"\n >\n <ng-template\n pTemplate=\"filter\"\n let-value\n let-filterCallback=\"filterCallback\"\n *ngIf=\"getColumnFilterType(col) === 'date'\"\n >\n <p-calendar\n [ngModel]=\"value\"\n (ngModelChange)=\"filterCallback($event)\"\n [dateFormat]=\"'dd/mm/yy'\"\n ></p-calendar>\n </ng-template>\n\n <ng-template\n pTemplate=\"filter\"\n let-value\n let-filterCallback=\"filterCallback\"\n *ngIf=\"getColumnFilterType(col) === 'multiSelect'\"\n >\n <p-multiSelect\n [options]=\"col.filterOptions\"\n [ngModel]=\"value\"\n (ngModelChange)=\"filterCallback($event)\"\n [display]=\"'chip'\"\n placeholder=\"Select\"\n class=\"custom-multiselect\"\n ></p-multiSelect>\n </ng-template>\n </p-columnFilter>\n </ng-container>\n </div>\n </th>\n </ng-template>\n </th>\n </tr>\n </ng-template>\n\n <ng-template\n pTemplate=\"body\"\n let-data\n let-editing=\"editing\"\n let-ri=\"rowIndex\"\n >\n <!-- Render a table row and make it editable if `isEdit` is true -->\n <tr [pEditableRow]=\"isEdit ? data : null\">\n <!-- Loop through each column and render corresponding table cells -->\n <ng-container *ngFor=\"let col of columns\">\n <ng-container *ngIf=\"col.code !== undefined\">\n <!-- Check if the data for the column exists -->\n <ng-container *ngIf=\"data[col.code] !== undefined\">\n <!-- Render an editable cell if the column is editable -->\n <td *ngIf=\"isEditable(col.code); else normalTD\">\n <!-- Multi-select input for columns that are multi-selectable -->\n <ng-container\n *ngIf=\"isMultiSelect(col.code); else datePicker\"\n >\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <p-multiSelect\n appendTo=\"body\"\n [ngModel]=\"data[col.code]\"\n [style]=\"{ width: '100%' }\"\n (ngModelChange)=\"\n changeHandler(data.id, col.code, $event)\n \"\n [options]=\"optionValues\"\n ></p-multiSelect>\n </ng-template>\n <ng-template pTemplate=\"output\">\n <div class=\"multi-select-container\">\n <ng-container *ngFor=\"let rec of data[col.code]\">\n <p-tag [value]=\"rec\"></p-tag>\n </ng-container>\n </div>\n </ng-template>\n </p-cellEditor>\n </ng-container>\n\n <!-- Date picker input for columns that require date selection -->\n <ng-template #datePicker>\n <ng-container\n *ngIf=\"isDatePicker(col.code); else normalInput\"\n >\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <p-calendar\n [inputId]=\"data[col.code]\"\n [ngModel]=\"data[col.code]\"\n (ngModelChange)=\"\n changeHandler(data.id, col.code, $event)\n \"\n [dateFormat]=\"'dd/mm/yy'\"\n ></p-calendar>\n </ng-template>\n <ng-template pTemplate=\"output\">\n {{ data[col.code] | customDate }}\n </ng-template>\n </p-cellEditor>\n </ng-container>\n </ng-template>\n\n <!-- Normal text input for other columns -->\n <ng-template #normalInput>\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <input\n pInputText\n type=\"text\"\n [ngModel]=\"data[col.code]\"\n (change)=\"onChange($event, data.id, col.code)\"\n />\n </ng-template>\n <ng-template pTemplate=\"output\">\n <!-- Use currency pipe to format the output for AMOUNT type -->\n <ng-container\n *ngIf=\"col.type === 'AMOUNT'; else normalOutput\"\n >\n {{\n data[col.code]\n | customCurrency\n : getCurrencySymbol(col)\n : col.decimalPlaces\n }}\n </ng-container>\n <ng-template #normalOutput>\n {{ data[col.code] }}\n </ng-template>\n </ng-template>\n </p-cellEditor>\n </ng-template>\n </td>\n\n <!-- Render a normal table cell if the column is not editable -->\n <ng-template #normalTD>\n <td>\n <!-- Use customCurrency pipe to format the output for AMOUNT type with optional decimal places -->\n <ng-container\n *ngIf=\"col.type === 'AMOUNT'; else normalText\"\n >\n >\n {{\n data[col.code]\n | customCurrency\n : getCurrencySymbol(col)\n : col.decimalPlaces\n }}\n </ng-container>\n <ng-template #normalText>\n {{ data[col.code] }}\n </ng-template>\n </td>\n </ng-template>\n </ng-container>\n </ng-container>\n </ng-container>\n\n <!-- Render action buttons if there are any actions defined -->\n <td *ngIf=\"actions?.length\">\n <div class=\"action-buttons-container\">\n <!-- Delete button if deletion is allowed -->\n <div *ngIf=\"isDelete\">\n <button\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-trash\"\n (click)=\"Delete(data.id)\"\n class=\"p-button-rounded p-button-text\"\n ></button>\n </div>\n <!-- Edit, save, and cancel buttons for row editing -->\n <div>\n <button\n pInitEditableRow\n *ngIf=\"!editing\"\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-pencil\"\n (click)=\"initEditableRow(data)\"\n class=\"p-button-rounded p-button-text\"\n ></button>\n <button\n *ngIf=\"editing\"\n pSaveEditableRow\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-check\"\n (click)=\"saveEditableRow(data)\"\n class=\"p-button-rounded p-button-text\"\n ></button>\n <button\n *ngIf=\"editing\"\n pCancelEditableRow\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-times\"\n (click)=\"cancelEditableRow(data)\"\n class=\"p-button-rounded p-button-text\"\n ></button>\n </div>\n </div>\n </td>\n </tr>\n </ng-template>\n </p-table>\n </div>\n</div>\n", styles: [".date{width:100%;height:5rem;display:grid;justify-items:start;align-items:center}.filter-container{width:100%;display:flex;justify-content:space-between;align-items:center}.settings{display:flex;gap:1rem}.multi-select-container{display:flex;justify-content:center;align-items:center;gap:.3rem}::ng-deep p-table{min-width:50rem}.table-container{display:flex;flex-direction:column;gap:.5rem}::ng-deep .custom-multiselect .p-hidden-accessible input{display:none}::ng-deep .p-datatable .p-sortable-column.p-highlight:hover{background:none}::ng-deep .p-datatable .p-sortable-column:focus{box-shadow:none;outline:0 none}::ng-deep .header-container{display:flex;align-items:center}::ng-deep .header-container span{margin-right:.5em}::ng-deep p-columnfilter.p-element.ng-star-inserted{margin-top:4px}.flex{display:flex;justify-content:space-between;align-items:center}.ml-auto{margin-left:auto}::ng-deep p-inputicon{margin-right:-1.5rem;z-index:2;position:relative}::ng-deep .p-inputtext{padding-left:1.7rem}::ng-deep .bt-filter-btn button{cursor:pointer;margin-left:1rem}::ng-deep .p-icon-field-left .p-input-icon:first-of-type{left:-1rem}.table-row{text-align:center;display:flex;gap:1rem;justify-content:center}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "selectAll", "virtualRowHeight"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i2.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "component", type: i2.CellEditor, selector: "p-cellEditor" }, { kind: "component", type: i2.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "directive", type: i2.EditableRow, selector: "[pEditableRow]", inputs: ["pEditableRow", "pEditableRowDisabled"] }, { kind: "directive", type: i2.InitEditableRow, selector: "[pInitEditableRow]" }, { kind: "directive", type: i2.SaveEditableRow, selector: "[pSaveEditableRow]" }, { kind: "directive", type: i2.CancelEditableRow, selector: "[pCancelEditableRow]" }, { kind: "component", type: i2.ColumnFilter, selector: "p-columnFilter", inputs: ["field", "type", "display", "showMenu", "matchMode", "operator", "showOperator", "showClearButton", "showApplyButton", "showMatchModes", "showAddButton", "hideOnClear", "placeholder", "matchModeOptions", "maxConstraints", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "locale", "localeMatcher", "currency", "currencyDisplay", "useGrouping", "showButtons", "ariaLabel"], outputs: ["onShow", "onHide"] }, { kind: "directive", type: i4.InputText, selector: "[pInputText]", inputs: ["variant"] }, { kind: "directive", type: i5.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }, { kind: "component", type: i5.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "style", "styleClass", "badgeClass", "ariaLabel", "autofocus"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: i6.Calendar, selector: "p-calendar", inputs: ["iconDisplay", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepYearPicker", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "variant", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "directive", type: i7.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i8.MultiSelect, selector: "p-multiSelect", inputs: ["id", "ariaLabel", "style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "variant", "appendTo", "dataKey", "name", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "loading", "virtualScrollItemSize", "loadingIcon", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "showClear", "autofocus", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "defaultLabel", "placeholder", "options", "filterValue", "itemSize", "selectAll", "focusOnHover", "filterFields", "selectOnFocus", "autoOptionFocus"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad", "onRemove", "onSelectAllChange"] }, { kind: "component", type: i9.Tag, selector: "p-tag", inputs: ["style", "styleClass", "severity", "value", "icon", "rounded"] }, { kind: "component", type: i10.IconField, selector: "p-iconField", inputs: ["iconPosition"] }, { kind: "component", type: i11.InputIcon, selector: "p-inputIcon", inputs: ["styleClass"] }, { kind: "pipe", type: CustomCurrencyPipe, name: "customCurrency" }, { kind: "pipe", type: CustomDatePipe, name: "customDate" }] }); }
|
313
375
|
}
|
314
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
376
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: NgAdvancedPrimeTableComponent, decorators: [{
|
315
377
|
type: Component,
|
316
|
-
args: [{ selector: 'advanced-table', standalone: true, imports: [
|
317
|
-
CommonModule,
|
318
|
-
TableModule,
|
319
|
-
InputTextModule,
|
320
|
-
ButtonModule,
|
321
|
-
CalendarModule,
|
322
|
-
FormsModule,
|
323
|
-
MultiSelectModule,
|
324
|
-
CustomCurrencyPipe,
|
325
|
-
IconFieldModule,
|
326
|
-
InputIconModule,
|
327
|
-
TagModule,
|
328
|
-
], template: "<div class=\"table-container\">\n <div>\n <p-table\n #dt\n [value]=\"data\"\n dataKey=\"id\"\n [rows]=\"rows\"\n [paginator]=\"isPaginated\"\n [globalFilterFields]=\"globalFilterFields\"\n styleClass=\"p-datatable-gridlines\"\n [rowsPerPageOptions]=\"rowsPerPage\"\n styleClass=\"p-datatable-striped\"\n editMode=\"row\"\n [globalFilterFields]=\"globalFilterFields\"\n >\n <ng-template pTemplate=\"caption\">\n <div class=\"flex\">\n <div>\n <h3>Total: {{ totalRecords }}</h3>\n </div>\n\n <div>\n <p-button\n label=\"Clear\"\n [outlined]=\"true\"\n icon=\"pi pi-filter-slash\"\n (click)=\"clear(dt)\"\n class=\"bt-filter-btn\"\n />\n </div>\n <div class=\"ml-auto\" *ngIf=\"hasSearchFilter\">\n <!-- Add this wrapper div with ml-auto class -->\n <p-iconField iconPosition=\"left\" class=\"ml-auto\">\n <p-inputIcon>\n <i class=\"pi pi-search\"></i>\n </p-inputIcon>\n <input\n pInputText\n type=\"text\"\n [(ngModel)]=\"searchValue\"\n (input)=\"filterGlobal($event)\"\n placeholder=\"Search keyword\"\n />\n </p-iconField>\n </div>\n </div>\n </ng-template>\n\n <ng-template pTemplate=\"header\">\n <tr>\n <th *ngFor=\"let col of columns\">\n <ng-container\n *ngIf=\"isSortable && col.isSortable !== false; else noSortHeader\"\n >\n <th pSortableColumn=\"{{ col.code }}\" style=\"width: 20%\">\n <div class=\"header-container\">\n <span>{{ col.title }}</span>\n <p-sortIcon field=\"{{ col.code }}\" />\n <ng-container *ngIf=\"col.isFilter !== false\">\n <p-columnFilter\n *ngIf=\"col.type === 'AMOUNT'\"\n display=\"menu\"\n [field]=\"col.code\"\n [type]=\"getColumnFilterType(col)\"\n [currency]=\"getCurrencySymbol(col)\"\n ></p-columnFilter>\n\n <p-columnFilter\n *ngIf=\"col.type !== 'AMOUNT'\"\n display=\"menu\"\n [field]=\"col.code\"\n display=\"menu\"\n [type]=\"getColumnFilterType(col)\"\n [type]=\"getColumnFilterType(col)\"\n >\n <ng-template\n pTemplate=\"filter\"\n let-value\n let-filterCallback=\"filterCallback\"\n *ngIf=\"getColumnFilterType(col) === 'date'\"\n >\n <p-calendar\n [ngModel]=\"value\"\n (ngModelChange)=\"filterCallback($event)\"\n [dateFormat]=\"'dd/mm/yy'\"\n ></p-calendar>\n </ng-template>\n\n <ng-template\n pTemplate=\"filter\"\n let-value\n let-filterCallback=\"filterCallback\"\n *ngIf=\"getColumnFilterType(col) === 'multiSelect'\"\n >\n <p-multiSelect\n [options]=\"col.filterOptions\"\n [ngModel]=\"value\"\n (ngModelChange)=\"filterCallback($event)\"\n [display]=\"'chip'\"\n placeholder=\"Select\"\n class=\"custom-multiselect\"\n ></p-multiSelect>\n </ng-template>\n </p-columnFilter>\n </ng-container>\n </div>\n </th>\n </ng-container>\n <ng-template #noSortHeader>\n <th>\n <div class=\"header-container\">\n <span>{{ col.title }}</span>\n <ng-container *ngIf=\"col.isFilter !== false\">\n <p-columnFilter\n *ngIf=\"col.type === 'AMOUNT'\"\n display=\"menu\"\n [field]=\"col.code\"\n [type]=\"getColumnFilterType(col)\"\n [currency]=\"getCurrencySymbol(col)\"\n ></p-columnFilter>\n\n <p-columnFilter\n *ngIf=\"col.type !== 'AMOUNT'\"\n display=\"menu\"\n [field]=\"col.code\"\n [type]=\"getColumnFilterType(col)\"\n >\n <ng-template\n pTemplate=\"filter\"\n let-value\n let-filterCallback=\"filterCallback\"\n *ngIf=\"getColumnFilterType(col) === 'date'\"\n >\n <p-calendar\n [ngModel]=\"value\"\n (ngModelChange)=\"filterCallback($event)\"\n [dateFormat]=\"'dd/mm/yy'\"\n ></p-calendar>\n </ng-template>\n\n <ng-template\n pTemplate=\"filter\"\n let-value\n let-filterCallback=\"filterCallback\"\n *ngIf=\"getColumnFilterType(col) === 'multiSelect'\"\n >\n <p-multiSelect\n [options]=\"col.filterOptions\"\n [ngModel]=\"value\"\n (ngModelChange)=\"filterCallback($event)\"\n [display]=\"'chip'\"\n placeholder=\"Select\"\n class=\"custom-multiselect\"\n ></p-multiSelect>\n </ng-template>\n </p-columnFilter>\n </ng-container>\n </div>\n </th>\n </ng-template>\n </th>\n </tr>\n </ng-template>\n\n <ng-template\n pTemplate=\"body\"\n let-data\n let-editing=\"editing\"\n let-ri=\"rowIndex\"\n >\n <!-- Render a table row and make it editable if `isEdit` is true -->\n <tr [pEditableRow]=\"isEdit ? data : null\">\n <!-- Loop through each column and render corresponding table cells -->\n <ng-container *ngFor=\"let col of columns\">\n <ng-container *ngIf=\"col.code !== undefined\">\n <!-- Check if the data for the column exists -->\n <ng-container *ngIf=\"data[col.code] !== undefined\">\n <!-- Render an editable cell if the column is editable -->\n <td *ngIf=\"isEditable(col.code); else normalTD\">\n <!-- Multi-select input for columns that are multi-selectable -->\n <ng-container\n *ngIf=\"isMultiSelect(col.code); else datePicker\"\n >\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <p-multiSelect\n appendTo=\"body\"\n [ngModel]=\"data[col.code]\"\n [style]=\"{ width: '100%' }\"\n (ngModelChange)=\"\n changeHandler(data.id, col.code, $event)\n \"\n [options]=\"optionValues\"\n ></p-multiSelect>\n </ng-template>\n <ng-template pTemplate=\"output\">\n <div class=\"multi-select-container\">\n <ng-container *ngFor=\"let rec of data[col.code]\">\n <p-tag [value]=\"rec\"></p-tag>\n </ng-container>\n </div>\n </ng-template>\n </p-cellEditor>\n </ng-container>\n\n <!-- Date picker input for columns that require date selection -->\n <ng-template #datePicker>\n <ng-container\n *ngIf=\"isDatePicker(col.code); else normalInput\"\n >\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <p-calendar\n [inputId]=\"data[col.code]\"\n [ngModel]=\"data[col.code]\"\n (ngModelChange)=\"\n changeHandler(data.id, col.code, $event)\n \"\n [dateFormat]=\"'dd/mm/yy'\"\n ></p-calendar>\n </ng-template>\n <ng-template pTemplate=\"output\">\n {{ data[col.code] | date : \"dd/MM/yyyy\" }}\n </ng-template>\n </p-cellEditor>\n </ng-container>\n </ng-template>\n\n <!-- Normal text input for other columns -->\n <ng-template #normalInput>\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <input\n pInputText\n type=\"text\"\n [ngModel]=\"data[col.code]\"\n (change)=\"onChange($event, data.id, col.code)\"\n />\n </ng-template>\n <ng-template pTemplate=\"output\">\n <!-- Use currency pipe to format the output for AMOUNT type -->\n <ng-container\n *ngIf=\"col.type === 'AMOUNT'; else normalOutput\"\n >\n {{\n data[col.code]\n | customCurrency\n : getCurrencySymbol(col)\n : col.decimalPlaces\n }}\n </ng-container>\n <ng-template #normalOutput>\n {{ data[col.code] }}\n </ng-template>\n </ng-template>\n </p-cellEditor>\n </ng-template>\n </td>\n\n <!-- Render a normal table cell if the column is not editable -->\n <ng-template #normalTD>\n <td>\n <!-- Use customCurrency pipe to format the output for AMOUNT type with optional decimal places -->\n <ng-container\n *ngIf=\"col.type === 'AMOUNT'; else normalText\"\n >\n >\n {{\n data[col.code]\n | customCurrency\n : getCurrencySymbol(col)\n : col.decimalPlaces\n }}\n </ng-container>\n <ng-template #normalText>\n {{ data[col.code] }}\n </ng-template>\n </td>\n </ng-template>\n </ng-container>\n </ng-container>\n </ng-container>\n\n <!-- Render action buttons if there are any actions defined -->\n <td *ngIf=\"actions?.length\">\n <div class=\"action-buttons-container\">\n <!-- Delete button if deletion is allowed -->\n <div *ngIf=\"isDelete\">\n <button\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-trash\"\n (click)=\"Delete(data.id)\"\n class=\"p-button-rounded p-button-text\"\n ></button>\n </div>\n <!-- Edit, save, and cancel buttons for row editing -->\n <div>\n <button\n pInitEditableRow\n *ngIf=\"!editing\"\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-pencil\"\n (click)=\"initEditableRow(data)\"\n class=\"p-button-rounded p-button-text\"\n ></button>\n <button\n *ngIf=\"editing\"\n pSaveEditableRow\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-check\"\n (click)=\"saveEditableRow(data)\"\n class=\"p-button-rounded p-button-text\"\n ></button>\n <button\n *ngIf=\"editing\"\n pCancelEditableRow\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-times\"\n (click)=\"cancelEditableRow(data)\"\n class=\"p-button-rounded p-button-text\"\n ></button>\n </div>\n </div>\n </td>\n </tr>\n </ng-template>\n </p-table>\n </div>\n</div>\n", styles: [".date{width:100%;height:5rem;display:grid;justify-items:start;align-items:center}.filter-container{width:100%;display:flex;justify-content:space-between;align-items:center}.settings{display:flex;gap:1rem}.multi-select-container{display:flex;justify-content:center;align-items:center;gap:.3rem}::ng-deep p-table{min-width:50rem}.table-container{display:flex;flex-direction:column;gap:.5rem}::ng-deep .custom-multiselect .p-hidden-accessible input{display:none}::ng-deep .p-datatable .p-sortable-column.p-highlight:hover{background:none}::ng-deep .p-datatable .p-sortable-column:focus{box-shadow:none;outline:0 none}::ng-deep .header-container{display:flex;align-items:center}::ng-deep .header-container span{margin-right:.5em}::ng-deep p-columnfilter.p-element.ng-star-inserted{margin-top:4px}.flex{display:flex;justify-content:space-between;align-items:center}.ml-auto{margin-left:auto}::ng-deep p-inputicon{margin-right:-1.5rem;z-index:2;position:relative}::ng-deep .p-inputtext{padding-left:1.7rem}::ng-deep .bt-filter-btn button{cursor:pointer;margin-left:1rem}::ng-deep .p-icon-field-left .p-input-icon:first-of-type{left:-1rem}.table-row{text-align:center;display:flex;gap:1rem;justify-content:center}\n"] }]
|
378
|
+
args: [{ selector: 'ng-advanced-prime-table', template: "<div class=\"table-container\">\n <div>\n <p-table\n #dt\n [value]=\"data\"\n [rows]=\"rows\"\n [paginator]=\"isPaginated\"\n [globalFilterFields]=\"globalFilterFields\"\n [rowsPerPageOptions]=\"rowsPerPage\"\n dataKey=\"id\"\n styleClass=\"p-datatable-gridlines\"\n styleClass=\"p-datatable-striped\"\n editMode=\"row\"\n >\n <ng-template pTemplate=\"caption\">\n <div class=\"flex\">\n <div>\n <h3>Total: {{ totalRecords }}</h3>\n </div>\n\n <div>\n <p-button\n label=\"Clear\"\n [outlined]=\"true\"\n icon=\"pi pi-filter-slash\"\n (click)=\"clear(dt)\"\n class=\"bt-filter-btn\"\n />\n </div>\n <div class=\"ml-auto\" *ngIf=\"hasSearchFilter\">\n <!-- Add this wrapper div with ml-auto class -->\n <p-iconField iconPosition=\"left\" class=\"ml-auto\">\n <p-inputIcon>\n <i class=\"pi pi-search\"></i>\n </p-inputIcon>\n <input\n pInputText\n type=\"text\"\n [(ngModel)]=\"searchValue\"\n (input)=\"filterGlobal($event)\"\n placeholder=\"Search keyword\"\n />\n </p-iconField>\n </div>\n </div>\n </ng-template>\n\n <ng-template pTemplate=\"header\">\n <tr>\n <th *ngFor=\"let col of columns\">\n <ng-container\n *ngIf=\"isSortable && col.isSortable !== false; else noSortHeader\"\n >\n <th pSortableColumn=\"{{ col.code }}\" style=\"width: 20%\">\n <div class=\"header-container\">\n <span>{{ col.title }}</span>\n <p-sortIcon field=\"{{ col.code }}\" />\n <ng-container *ngIf=\"col.isFilter !== false\">\n <p-columnFilter\n *ngIf=\"col.type === 'AMOUNT'\"\n display=\"menu\"\n [field]=\"col.code\"\n [type]=\"getColumnFilterType(col)\"\n [currency]=\"getCurrencySymbol(col)\"\n ></p-columnFilter>\n\n <p-columnFilter\n *ngIf=\"col.type !== 'AMOUNT'\"\n display=\"menu\"\n [field]=\"col.code\"\n display=\"menu\"\n [type]=\"getColumnFilterType(col)\"\n [type]=\"getColumnFilterType(col)\"\n >\n <ng-template\n pTemplate=\"filter\"\n let-value\n let-filterCallback=\"filterCallback\"\n *ngIf=\"getColumnFilterType(col) === 'date'\"\n >\n <p-calendar\n [ngModel]=\"value\"\n (ngModelChange)=\"filterCallback($event)\"\n [dateFormat]=\"'dd/mm/yy'\"\n ></p-calendar>\n </ng-template>\n\n <ng-template\n pTemplate=\"filter\"\n let-value\n let-filterCallback=\"filterCallback\"\n *ngIf=\"getColumnFilterType(col) === 'multiSelect'\"\n >\n <p-multiSelect\n [options]=\"col.filterOptions\"\n [ngModel]=\"value\"\n (ngModelChange)=\"filterCallback($event)\"\n [display]=\"'chip'\"\n placeholder=\"Select\"\n class=\"custom-multiselect\"\n ></p-multiSelect>\n </ng-template>\n </p-columnFilter>\n </ng-container>\n </div>\n </th>\n </ng-container>\n <ng-template #noSortHeader>\n <th>\n <div class=\"header-container\">\n <span>{{ col.title }}</span>\n <ng-container *ngIf=\"col.isFilter !== false\">\n <p-columnFilter\n *ngIf=\"col.type === 'AMOUNT'\"\n display=\"menu\"\n [field]=\"col.code\"\n [type]=\"getColumnFilterType(col)\"\n [currency]=\"getCurrencySymbol(col)\"\n ></p-columnFilter>\n\n <p-columnFilter\n *ngIf=\"col.type !== 'AMOUNT'\"\n display=\"menu\"\n [field]=\"col.code\"\n [type]=\"getColumnFilterType(col)\"\n >\n <ng-template\n pTemplate=\"filter\"\n let-value\n let-filterCallback=\"filterCallback\"\n *ngIf=\"getColumnFilterType(col) === 'date'\"\n >\n <p-calendar\n [ngModel]=\"value\"\n (ngModelChange)=\"filterCallback($event)\"\n [dateFormat]=\"'dd/mm/yy'\"\n ></p-calendar>\n </ng-template>\n\n <ng-template\n pTemplate=\"filter\"\n let-value\n let-filterCallback=\"filterCallback\"\n *ngIf=\"getColumnFilterType(col) === 'multiSelect'\"\n >\n <p-multiSelect\n [options]=\"col.filterOptions\"\n [ngModel]=\"value\"\n (ngModelChange)=\"filterCallback($event)\"\n [display]=\"'chip'\"\n placeholder=\"Select\"\n class=\"custom-multiselect\"\n ></p-multiSelect>\n </ng-template>\n </p-columnFilter>\n </ng-container>\n </div>\n </th>\n </ng-template>\n </th>\n </tr>\n </ng-template>\n\n <ng-template\n pTemplate=\"body\"\n let-data\n let-editing=\"editing\"\n let-ri=\"rowIndex\"\n >\n <!-- Render a table row and make it editable if `isEdit` is true -->\n <tr [pEditableRow]=\"isEdit ? data : null\">\n <!-- Loop through each column and render corresponding table cells -->\n <ng-container *ngFor=\"let col of columns\">\n <ng-container *ngIf=\"col.code !== undefined\">\n <!-- Check if the data for the column exists -->\n <ng-container *ngIf=\"data[col.code] !== undefined\">\n <!-- Render an editable cell if the column is editable -->\n <td *ngIf=\"isEditable(col.code); else normalTD\">\n <!-- Multi-select input for columns that are multi-selectable -->\n <ng-container\n *ngIf=\"isMultiSelect(col.code); else datePicker\"\n >\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <p-multiSelect\n appendTo=\"body\"\n [ngModel]=\"data[col.code]\"\n [style]=\"{ width: '100%' }\"\n (ngModelChange)=\"\n changeHandler(data.id, col.code, $event)\n \"\n [options]=\"optionValues\"\n ></p-multiSelect>\n </ng-template>\n <ng-template pTemplate=\"output\">\n <div class=\"multi-select-container\">\n <ng-container *ngFor=\"let rec of data[col.code]\">\n <p-tag [value]=\"rec\"></p-tag>\n </ng-container>\n </div>\n </ng-template>\n </p-cellEditor>\n </ng-container>\n\n <!-- Date picker input for columns that require date selection -->\n <ng-template #datePicker>\n <ng-container\n *ngIf=\"isDatePicker(col.code); else normalInput\"\n >\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <p-calendar\n [inputId]=\"data[col.code]\"\n [ngModel]=\"data[col.code]\"\n (ngModelChange)=\"\n changeHandler(data.id, col.code, $event)\n \"\n [dateFormat]=\"'dd/mm/yy'\"\n ></p-calendar>\n </ng-template>\n <ng-template pTemplate=\"output\">\n {{ data[col.code] | customDate }}\n </ng-template>\n </p-cellEditor>\n </ng-container>\n </ng-template>\n\n <!-- Normal text input for other columns -->\n <ng-template #normalInput>\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <input\n pInputText\n type=\"text\"\n [ngModel]=\"data[col.code]\"\n (change)=\"onChange($event, data.id, col.code)\"\n />\n </ng-template>\n <ng-template pTemplate=\"output\">\n <!-- Use currency pipe to format the output for AMOUNT type -->\n <ng-container\n *ngIf=\"col.type === 'AMOUNT'; else normalOutput\"\n >\n {{\n data[col.code]\n | customCurrency\n : getCurrencySymbol(col)\n : col.decimalPlaces\n }}\n </ng-container>\n <ng-template #normalOutput>\n {{ data[col.code] }}\n </ng-template>\n </ng-template>\n </p-cellEditor>\n </ng-template>\n </td>\n\n <!-- Render a normal table cell if the column is not editable -->\n <ng-template #normalTD>\n <td>\n <!-- Use customCurrency pipe to format the output for AMOUNT type with optional decimal places -->\n <ng-container\n *ngIf=\"col.type === 'AMOUNT'; else normalText\"\n >\n >\n {{\n data[col.code]\n | customCurrency\n : getCurrencySymbol(col)\n : col.decimalPlaces\n }}\n </ng-container>\n <ng-template #normalText>\n {{ data[col.code] }}\n </ng-template>\n </td>\n </ng-template>\n </ng-container>\n </ng-container>\n </ng-container>\n\n <!-- Render action buttons if there are any actions defined -->\n <td *ngIf=\"actions?.length\">\n <div class=\"action-buttons-container\">\n <!-- Delete button if deletion is allowed -->\n <div *ngIf=\"isDelete\">\n <button\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-trash\"\n (click)=\"Delete(data.id)\"\n class=\"p-button-rounded p-button-text\"\n ></button>\n </div>\n <!-- Edit, save, and cancel buttons for row editing -->\n <div>\n <button\n pInitEditableRow\n *ngIf=\"!editing\"\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-pencil\"\n (click)=\"initEditableRow(data)\"\n class=\"p-button-rounded p-button-text\"\n ></button>\n <button\n *ngIf=\"editing\"\n pSaveEditableRow\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-check\"\n (click)=\"saveEditableRow(data)\"\n class=\"p-button-rounded p-button-text\"\n ></button>\n <button\n *ngIf=\"editing\"\n pCancelEditableRow\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-times\"\n (click)=\"cancelEditableRow(data)\"\n class=\"p-button-rounded p-button-text\"\n ></button>\n </div>\n </div>\n </td>\n </tr>\n </ng-template>\n </p-table>\n </div>\n</div>\n", styles: [".date{width:100%;height:5rem;display:grid;justify-items:start;align-items:center}.filter-container{width:100%;display:flex;justify-content:space-between;align-items:center}.settings{display:flex;gap:1rem}.multi-select-container{display:flex;justify-content:center;align-items:center;gap:.3rem}::ng-deep p-table{min-width:50rem}.table-container{display:flex;flex-direction:column;gap:.5rem}::ng-deep .custom-multiselect .p-hidden-accessible input{display:none}::ng-deep .p-datatable .p-sortable-column.p-highlight:hover{background:none}::ng-deep .p-datatable .p-sortable-column:focus{box-shadow:none;outline:0 none}::ng-deep .header-container{display:flex;align-items:center}::ng-deep .header-container span{margin-right:.5em}::ng-deep p-columnfilter.p-element.ng-star-inserted{margin-top:4px}.flex{display:flex;justify-content:space-between;align-items:center}.ml-auto{margin-left:auto}::ng-deep p-inputicon{margin-right:-1.5rem;z-index:2;position:relative}::ng-deep .p-inputtext{padding-left:1.7rem}::ng-deep .bt-filter-btn button{cursor:pointer;margin-left:1rem}::ng-deep .p-icon-field-left .p-input-icon:first-of-type{left:-1rem}.table-row{text-align:center;display:flex;gap:1rem;justify-content:center}\n"] }]
|
329
379
|
}], ctorParameters: () => [], propDecorators: { data: [{
|
330
380
|
type: Input
|
331
381
|
}], columns: [{
|
@@ -350,16 +400,286 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImpor
|
|
350
400
|
type: Output
|
351
401
|
}], dt: [{
|
352
402
|
type: ViewChild,
|
353
|
-
args: ['dt', { static:
|
403
|
+
args: ['dt', { static: false }]
|
354
404
|
}] } });
|
355
405
|
|
356
|
-
|
357
|
-
|
406
|
+
class NgAdvancedPrimeTableModule {
|
407
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: NgAdvancedPrimeTableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
408
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: NgAdvancedPrimeTableModule, declarations: [NgAdvancedPrimeTableComponent, CustomDatePipe], imports: [CommonModule,
|
409
|
+
TableModule,
|
410
|
+
InputTextModule,
|
411
|
+
ButtonModule,
|
412
|
+
CalendarModule,
|
413
|
+
FormsModule,
|
414
|
+
MultiSelectModule,
|
415
|
+
TagModule,
|
416
|
+
CustomCurrencyPipe,
|
417
|
+
IconFieldModule,
|
418
|
+
InputIconModule], exports: [NgAdvancedPrimeTableComponent] }); }
|
419
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: NgAdvancedPrimeTableModule, imports: [CommonModule,
|
420
|
+
TableModule,
|
421
|
+
InputTextModule,
|
422
|
+
ButtonModule,
|
423
|
+
CalendarModule,
|
424
|
+
FormsModule,
|
425
|
+
MultiSelectModule,
|
426
|
+
TagModule,
|
427
|
+
IconFieldModule,
|
428
|
+
InputIconModule] }); }
|
429
|
+
}
|
430
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: NgAdvancedPrimeTableModule, decorators: [{
|
431
|
+
type: NgModule,
|
432
|
+
args: [{
|
433
|
+
declarations: [NgAdvancedPrimeTableComponent, CustomDatePipe],
|
434
|
+
imports: [
|
435
|
+
CommonModule,
|
436
|
+
TableModule,
|
437
|
+
InputTextModule,
|
438
|
+
ButtonModule,
|
439
|
+
CalendarModule,
|
440
|
+
FormsModule,
|
441
|
+
MultiSelectModule,
|
442
|
+
TagModule,
|
443
|
+
CustomCurrencyPipe,
|
444
|
+
IconFieldModule,
|
445
|
+
InputIconModule,
|
446
|
+
],
|
447
|
+
exports: [NgAdvancedPrimeTableComponent],
|
448
|
+
}]
|
449
|
+
}] });
|
450
|
+
|
451
|
+
// projects/ng-prime-tools/src/lib/ng-advanced-prime-table/index.ts
|
452
|
+
|
453
|
+
/**
|
454
|
+
* Generated bundle index. Do not edit.
|
455
|
+
*/
|
456
|
+
/// <amd-module name="ng-prime-tools/multi-search-criteria" />
|
457
|
+
|
458
|
+
var TableTypeEnum;
|
459
|
+
(function (TableTypeEnum) {
|
460
|
+
TableTypeEnum["DATE"] = "DATE";
|
461
|
+
TableTypeEnum["STRING"] = "STRING";
|
462
|
+
TableTypeEnum["AMOUNT"] = "AMOUNT";
|
463
|
+
TableTypeEnum["NUMBER"] = "NUMBER";
|
464
|
+
TableTypeEnum["MULTISELECT"] = "MULTISELECT";
|
465
|
+
TableTypeEnum["CURRENCY"] = "CURRENCY";
|
466
|
+
TableTypeEnum["BOOLEAN"] = "BOOLEAN";
|
467
|
+
TableTypeEnum["ACTION"] = "ACTION";
|
468
|
+
})(TableTypeEnum || (TableTypeEnum = {}));
|
469
|
+
|
470
|
+
var SearchCriteriaTypeEnum;
|
471
|
+
(function (SearchCriteriaTypeEnum) {
|
472
|
+
SearchCriteriaTypeEnum["DATE"] = "DATE";
|
473
|
+
SearchCriteriaTypeEnum["DATERANGE"] = "DATERANGE";
|
474
|
+
SearchCriteriaTypeEnum["STRING"] = "STRING";
|
475
|
+
SearchCriteriaTypeEnum["AMOUNT"] = "AMOUNT";
|
476
|
+
SearchCriteriaTypeEnum["NUMBER"] = "NUMBER";
|
477
|
+
SearchCriteriaTypeEnum["MULTISELECT"] = "MULTISELECT";
|
478
|
+
})(SearchCriteriaTypeEnum || (SearchCriteriaTypeEnum = {}));
|
479
|
+
|
480
|
+
// projects/ng-prime-tools/src/lib/enums/public_api.ts
|
481
|
+
|
482
|
+
/**
|
483
|
+
* Generated bundle index. Do not edit.
|
484
|
+
*/
|
485
|
+
/// <amd-module name="ng-prime-tools/enums" />
|
486
|
+
|
487
|
+
class MultiSearchCriteriaComponent {
|
488
|
+
constructor() {
|
489
|
+
this.SearchCriteriaTypeEnum = SearchCriteriaTypeEnum;
|
490
|
+
this.title = '';
|
491
|
+
this.criteria = [];
|
492
|
+
this.inputsPerRow = 3;
|
493
|
+
this.data = [];
|
494
|
+
this.filteredData = new EventEmitter();
|
495
|
+
this.selectAll = false;
|
496
|
+
this.selected = [];
|
497
|
+
}
|
498
|
+
ngOnInit() {
|
499
|
+
this.criteria.forEach((item) => {
|
500
|
+
if (item.type === SearchCriteriaTypeEnum.MULTISELECT &&
|
501
|
+
item.filterOptions) {
|
502
|
+
this.selected = [...item.filterOptions];
|
503
|
+
item.value = this.selected;
|
504
|
+
}
|
505
|
+
});
|
506
|
+
}
|
507
|
+
getCurrencySymbol(input) {
|
508
|
+
return input.currency || 'EUR';
|
509
|
+
}
|
510
|
+
search() {
|
511
|
+
console.log('Original Data:', this.data);
|
512
|
+
const filtered = this.data.filter((item) => {
|
513
|
+
return this.criteria.every((criterion) => {
|
514
|
+
console.log('Criterion:', criterion);
|
515
|
+
if (criterion.type === SearchCriteriaTypeEnum.DATERANGE) {
|
516
|
+
const [startDate, endDate] = criterion.value || [
|
517
|
+
undefined,
|
518
|
+
undefined,
|
519
|
+
];
|
520
|
+
const itemDate = this.parseDate(item[criterion.code] || item['date']);
|
521
|
+
console.log('Item Date:', itemDate, 'Start Date:', startDate, 'End Date:', endDate);
|
522
|
+
if (!startDate && !endDate) {
|
523
|
+
return true;
|
524
|
+
}
|
525
|
+
if (itemDate === null) {
|
526
|
+
return false;
|
527
|
+
}
|
528
|
+
const parsedStartDate = startDate ? this.parseDate(startDate) : null;
|
529
|
+
const parsedEndDate = endDate ? this.parseDate(endDate) : null;
|
530
|
+
console.log('Parsed Start Date:', parsedStartDate, 'Parsed End Date:', parsedEndDate);
|
531
|
+
return ((!parsedStartDate || itemDate >= parsedStartDate) &&
|
532
|
+
(!parsedEndDate || itemDate <= parsedEndDate));
|
533
|
+
}
|
534
|
+
else if (criterion.type === SearchCriteriaTypeEnum.AMOUNT) {
|
535
|
+
return !criterion.value || item[criterion.code] === criterion.value;
|
536
|
+
}
|
537
|
+
else if (criterion.type === SearchCriteriaTypeEnum.MULTISELECT) {
|
538
|
+
return (!criterion.value ||
|
539
|
+
criterion.value.some((option) => option.label === item[criterion.code]));
|
540
|
+
}
|
541
|
+
else if (criterion.type === SearchCriteriaTypeEnum.STRING) {
|
542
|
+
return (!criterion.value ||
|
543
|
+
item[criterion.code]
|
544
|
+
.toString()
|
545
|
+
.toLowerCase()
|
546
|
+
.includes(criterion.value.toString().toLowerCase()));
|
547
|
+
}
|
548
|
+
return true;
|
549
|
+
});
|
550
|
+
});
|
551
|
+
console.log('Filtered Data:', filtered);
|
552
|
+
this.filteredData.emit(filtered);
|
553
|
+
}
|
554
|
+
clear() {
|
555
|
+
this.criteria.forEach((input) => {
|
556
|
+
input.value = null;
|
557
|
+
});
|
558
|
+
this.filteredData.emit(this.data);
|
559
|
+
}
|
560
|
+
onSelectAllChange(event) {
|
561
|
+
this.selectAll = event.checked;
|
562
|
+
this.selected = event.checked
|
563
|
+
? [
|
564
|
+
...(this.criteria.find((criterion) => criterion.type === SearchCriteriaTypeEnum.MULTISELECT)?.filterOptions || []),
|
565
|
+
]
|
566
|
+
: [];
|
567
|
+
}
|
568
|
+
parseDate(dateString) {
|
569
|
+
if (!dateString) {
|
570
|
+
return null;
|
571
|
+
}
|
572
|
+
if (Object.prototype.toString.call(dateString) === '[object Date]') {
|
573
|
+
return dateString;
|
574
|
+
}
|
575
|
+
const parts = dateString.split('/');
|
576
|
+
if (parts.length === 3) {
|
577
|
+
const day = parseInt(parts[0], 10);
|
578
|
+
const month = parseInt(parts[1], 10) - 1;
|
579
|
+
const year = parseInt(parts[2], 10);
|
580
|
+
const date = new Date(year, month, day);
|
581
|
+
return isNaN(date.getTime()) ? null : date;
|
582
|
+
}
|
583
|
+
return null;
|
584
|
+
}
|
585
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: MultiSearchCriteriaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
586
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: MultiSearchCriteriaComponent, selector: "multi-search-criteria", inputs: { title: "title", criteria: "criteria", inputsPerRow: "inputsPerRow", data: "data" }, outputs: { filteredData: "filteredData" }, ngImport: i0, template: "<p-panel header=\"{{ title }}\" [toggleable]=\"true\" [collapsed]=\"true\">\n <div\n class=\"criteria-container\"\n [ngStyle]=\"{ 'grid-template-columns': 'repeat(' + inputsPerRow + ', 1fr)' }\"\n >\n <div *ngFor=\"let input of criteria\" class=\"criteria-item\">\n <label class=\"bsc-label\">{{ input.title }}</label>\n\n <ng-container [ngSwitch]=\"input.type\">\n <p-calendar\n *ngSwitchCase=\"SearchCriteriaTypeEnum.DATERANGE\"\n [(ngModel)]=\"input.value\"\n selectionMode=\"range\"\n [dateFormat]=\"'dd/mm/yy'\"\n class=\"full-width-input\"\n [showIcon]=\"true\"\n (ngModelChange)=\"input.value = $event\"\n ></p-calendar>\n <p-calendar\n *ngSwitchCase=\"SearchCriteriaTypeEnum.DATE\"\n [ngModel]=\"input.value\"\n (ngModelChange)=\"input.value = $event\"\n [dateFormat]=\"'dd/mm/yy'\"\n [showIcon]=\"true\"\n class=\"full-width-input\"\n ></p-calendar>\n <input\n *ngSwitchCase=\"SearchCriteriaTypeEnum.STRING\"\n type=\"text\"\n pInputText\n [(ngModel)]=\"input.value\"\n class=\"full-width-input\"\n />\n\n <p-inputNumber\n *ngSwitchCase=\"SearchCriteriaTypeEnum.AMOUNT\"\n type=\"number\"\n [(ngModel)]=\"input.value\"\n mode=\"decimal\"\n inputId=\"minmaxfraction\"\n [minFractionDigits]=\"2\"\n [maxFractionDigits]=\"5\"\n [placeholder]=\"getCurrencySymbol(input)\"\n class=\"full-width-input\"\n ></p-inputNumber>\n\n <p-inputNumber\n *ngSwitchCase=\"SearchCriteriaTypeEnum.NUMBER\"\n type=\"number\"\n [(ngModel)]=\"input.value\"\n class=\"full-width-input\"\n ></p-inputNumber>\n\n <p-multiSelect\n *ngSwitchCase=\"SearchCriteriaTypeEnum.MULTISELECT\"\n [options]=\"input.filterOptions\"\n [display]=\"'chip'\"\n placeholder=\"Select\"\n [selectAll]=\"selectAll\"\n [(ngModel)]=\"input.value\"\n optionLabel=\"label\"\n (onSelectAllChange)=\"onSelectAllChange($event)\"\n class=\"custom-multiselect full-width-input\"\n ></p-multiSelect>\n </ng-container>\n </div>\n </div>\n\n <ng-template pTemplate=\"footer\">\n <div class=\"footer-buttons\">\n <p-button\n label=\"Effacer\"\n icon=\"pi pi-times\"\n (click)=\"clear()\"\n class=\"footer-button\"\n ></p-button>\n <p-button\n label=\"Rechercher\"\n icon=\"pi pi-search\"\n (click)=\"search()\"\n class=\"footer-button\"\n ></p-button>\n </div>\n </ng-template>\n</p-panel>\n", styles: ["::ng-deep .p-element .p-hidden-accessible input{display:none}::ng-deep .bsc-label{display:block;margin-bottom:5px;font-weight:700}::ng-deep .custom-multiselect{width:100%}::ng-deep .p-multiselect .p-multiselect-label{font-size:14px;color:#333}::ng-deep .p-inputtext{width:100%}::ng-deep .p-calendar .p-inputtext{width:100%}::ng-deep .p-inputnumber{width:100%}.criteria-container{display:grid;gap:10px}.criteria-item{margin-bottom:10px;box-sizing:border-box}.full-width-input,::ng-deep .p-calendar,::ng-deep .p-multiselect{width:100%}::ng-deep .p-calendar .p-inputtext,::ng-deep .p-multiselect .p-multiselect-label{width:100%}.footer-buttons{display:flex;justify-content:flex-end;gap:10px}::ng-deep .footer-button button{width:140px;cursor:pointer}::ng-deep .p-panel .p-panel-footer{background:#f8f9fa}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "component", type: i6.Calendar, selector: "p-calendar", inputs: ["iconDisplay", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepYearPicker", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "variant", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "component", type: i5.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "style", "styleClass", "badgeClass", "ariaLabel", "autofocus"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: i3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i4.InputText, selector: "[pInputText]", inputs: ["variant"] }, { kind: "component", type: i8.MultiSelect, selector: "p-multiSelect", inputs: ["id", "ariaLabel", "style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "variant", "appendTo", "dataKey", "name", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "loading", "virtualScrollItemSize", "loadingIcon", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "showClear", "autofocus", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "defaultLabel", "placeholder", "options", "filterValue", "itemSize", "selectAll", "focusOnHover", "filterFields", "selectOnFocus", "autoOptionFocus"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad", "onRemove", "onSelectAllChange"] }, { kind: "directive", type: i7.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i8$1.InputNumber, selector: "p-inputNumber", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabelledBy", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "variant", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus", "disabled"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "component", type: i9$1.Panel, selector: "p-panel", inputs: ["toggleable", "header", "collapsed", "style", "styleClass", "iconPos", "expandIcon", "collapseIcon", "showHeader", "toggler", "transitionOptions"], outputs: ["collapsedChange", "onBeforeToggle", "onAfterToggle"] }] }); }
|
587
|
+
}
|
588
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: MultiSearchCriteriaComponent, decorators: [{
|
589
|
+
type: Component,
|
590
|
+
args: [{ selector: 'multi-search-criteria', template: "<p-panel header=\"{{ title }}\" [toggleable]=\"true\" [collapsed]=\"true\">\n <div\n class=\"criteria-container\"\n [ngStyle]=\"{ 'grid-template-columns': 'repeat(' + inputsPerRow + ', 1fr)' }\"\n >\n <div *ngFor=\"let input of criteria\" class=\"criteria-item\">\n <label class=\"bsc-label\">{{ input.title }}</label>\n\n <ng-container [ngSwitch]=\"input.type\">\n <p-calendar\n *ngSwitchCase=\"SearchCriteriaTypeEnum.DATERANGE\"\n [(ngModel)]=\"input.value\"\n selectionMode=\"range\"\n [dateFormat]=\"'dd/mm/yy'\"\n class=\"full-width-input\"\n [showIcon]=\"true\"\n (ngModelChange)=\"input.value = $event\"\n ></p-calendar>\n <p-calendar\n *ngSwitchCase=\"SearchCriteriaTypeEnum.DATE\"\n [ngModel]=\"input.value\"\n (ngModelChange)=\"input.value = $event\"\n [dateFormat]=\"'dd/mm/yy'\"\n [showIcon]=\"true\"\n class=\"full-width-input\"\n ></p-calendar>\n <input\n *ngSwitchCase=\"SearchCriteriaTypeEnum.STRING\"\n type=\"text\"\n pInputText\n [(ngModel)]=\"input.value\"\n class=\"full-width-input\"\n />\n\n <p-inputNumber\n *ngSwitchCase=\"SearchCriteriaTypeEnum.AMOUNT\"\n type=\"number\"\n [(ngModel)]=\"input.value\"\n mode=\"decimal\"\n inputId=\"minmaxfraction\"\n [minFractionDigits]=\"2\"\n [maxFractionDigits]=\"5\"\n [placeholder]=\"getCurrencySymbol(input)\"\n class=\"full-width-input\"\n ></p-inputNumber>\n\n <p-inputNumber\n *ngSwitchCase=\"SearchCriteriaTypeEnum.NUMBER\"\n type=\"number\"\n [(ngModel)]=\"input.value\"\n class=\"full-width-input\"\n ></p-inputNumber>\n\n <p-multiSelect\n *ngSwitchCase=\"SearchCriteriaTypeEnum.MULTISELECT\"\n [options]=\"input.filterOptions\"\n [display]=\"'chip'\"\n placeholder=\"Select\"\n [selectAll]=\"selectAll\"\n [(ngModel)]=\"input.value\"\n optionLabel=\"label\"\n (onSelectAllChange)=\"onSelectAllChange($event)\"\n class=\"custom-multiselect full-width-input\"\n ></p-multiSelect>\n </ng-container>\n </div>\n </div>\n\n <ng-template pTemplate=\"footer\">\n <div class=\"footer-buttons\">\n <p-button\n label=\"Effacer\"\n icon=\"pi pi-times\"\n (click)=\"clear()\"\n class=\"footer-button\"\n ></p-button>\n <p-button\n label=\"Rechercher\"\n icon=\"pi pi-search\"\n (click)=\"search()\"\n class=\"footer-button\"\n ></p-button>\n </div>\n </ng-template>\n</p-panel>\n", styles: ["::ng-deep .p-element .p-hidden-accessible input{display:none}::ng-deep .bsc-label{display:block;margin-bottom:5px;font-weight:700}::ng-deep .custom-multiselect{width:100%}::ng-deep .p-multiselect .p-multiselect-label{font-size:14px;color:#333}::ng-deep .p-inputtext{width:100%}::ng-deep .p-calendar .p-inputtext{width:100%}::ng-deep .p-inputnumber{width:100%}.criteria-container{display:grid;gap:10px}.criteria-item{margin-bottom:10px;box-sizing:border-box}.full-width-input,::ng-deep .p-calendar,::ng-deep .p-multiselect{width:100%}::ng-deep .p-calendar .p-inputtext,::ng-deep .p-multiselect .p-multiselect-label{width:100%}.footer-buttons{display:flex;justify-content:flex-end;gap:10px}::ng-deep .footer-button button{width:140px;cursor:pointer}::ng-deep .p-panel .p-panel-footer{background:#f8f9fa}\n"] }]
|
591
|
+
}], propDecorators: { title: [{
|
592
|
+
type: Input
|
593
|
+
}], criteria: [{
|
594
|
+
type: Input
|
595
|
+
}], inputsPerRow: [{
|
596
|
+
type: Input
|
597
|
+
}], data: [{
|
598
|
+
type: Input
|
599
|
+
}], filteredData: [{
|
600
|
+
type: Output
|
601
|
+
}] } });
|
602
|
+
|
603
|
+
class MultiSearchCriteriaModule {
|
604
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: MultiSearchCriteriaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
605
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: MultiSearchCriteriaModule, declarations: [MultiSearchCriteriaComponent], imports: [CommonModule,
|
606
|
+
CalendarModule,
|
607
|
+
InputTextModule,
|
608
|
+
MultiSelectModule,
|
609
|
+
ButtonModule,
|
610
|
+
FormsModule,
|
611
|
+
InputNumberModule,
|
612
|
+
PanelModule], exports: [MultiSearchCriteriaComponent] }); }
|
613
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: MultiSearchCriteriaModule, imports: [CommonModule,
|
614
|
+
CalendarModule,
|
615
|
+
InputTextModule,
|
616
|
+
MultiSelectModule,
|
617
|
+
ButtonModule,
|
618
|
+
FormsModule,
|
619
|
+
InputNumberModule,
|
620
|
+
PanelModule] }); }
|
621
|
+
}
|
622
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: MultiSearchCriteriaModule, decorators: [{
|
623
|
+
type: NgModule,
|
624
|
+
args: [{
|
625
|
+
declarations: [MultiSearchCriteriaComponent],
|
626
|
+
imports: [
|
627
|
+
CommonModule,
|
628
|
+
CalendarModule,
|
629
|
+
InputTextModule,
|
630
|
+
MultiSelectModule,
|
631
|
+
ButtonModule,
|
632
|
+
FormsModule,
|
633
|
+
InputNumberModule,
|
634
|
+
PanelModule,
|
635
|
+
],
|
636
|
+
exports: [MultiSearchCriteriaComponent],
|
637
|
+
}]
|
638
|
+
}] });
|
639
|
+
|
640
|
+
// projects/ng-prime-tools/src/lib/ng-advanced-prime-table/index.ts
|
641
|
+
|
642
|
+
/**
|
643
|
+
* Generated bundle index. Do not edit.
|
644
|
+
*/
|
645
|
+
/// <amd-module name="ng-prime-tools/multi-search-criteria" />
|
646
|
+
|
647
|
+
class NgPrimeToolsModule {
|
648
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: NgPrimeToolsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
649
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: NgPrimeToolsModule, imports: [CommonModule,
|
650
|
+
FormsModule,
|
651
|
+
NgAdvancedPrimeTableModule,
|
652
|
+
MultiSearchCriteriaModule], exports: [NgAdvancedPrimeTableModule, MultiSearchCriteriaModule] }); }
|
653
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: NgPrimeToolsModule, imports: [CommonModule,
|
654
|
+
FormsModule,
|
655
|
+
NgAdvancedPrimeTableModule,
|
656
|
+
MultiSearchCriteriaModule, NgAdvancedPrimeTableModule, MultiSearchCriteriaModule] }); }
|
657
|
+
}
|
658
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: NgPrimeToolsModule, decorators: [{
|
659
|
+
type: NgModule,
|
660
|
+
args: [{
|
661
|
+
imports: [
|
662
|
+
CommonModule,
|
663
|
+
FormsModule,
|
664
|
+
NgAdvancedPrimeTableModule,
|
665
|
+
MultiSearchCriteriaModule,
|
666
|
+
],
|
667
|
+
exports: [NgAdvancedPrimeTableModule, MultiSearchCriteriaModule],
|
668
|
+
}]
|
669
|
+
}] });
|
670
|
+
|
671
|
+
// projects/ng-prime-tools/src/lib/models/public_api.ts
|
672
|
+
|
673
|
+
/**
|
674
|
+
* Generated bundle index. Do not edit.
|
358
675
|
*/
|
676
|
+
/// <amd-module name="ng-prime-tools/models" />
|
677
|
+
|
678
|
+
// projects/ng-prime-tools/src/public-api.ts
|
359
679
|
|
360
680
|
/**
|
361
681
|
* Generated bundle index. Do not edit.
|
362
682
|
*/
|
363
683
|
|
364
|
-
export {
|
684
|
+
export { MultiSearchCriteriaComponent, MultiSearchCriteriaModule, NgAdvancedPrimeTableComponent, NgAdvancedPrimeTableModule, NgPrimeToolsModule, SearchCriteriaTypeEnum, TableTypeEnum };
|
365
685
|
//# sourceMappingURL=ng-prime-tools.mjs.map
|