ng-prime-tools 1.0.5 → 1.0.7
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 +285 -0
- package/esm2022/lib/enums/button-color.enum.mjs +10 -0
- package/esm2022/lib/enums/form-input-type.enum.mjs +14 -0
- package/esm2022/lib/enums/index.mjs +2 -6
- package/esm2022/lib/enums/input-validation.enum.mjs +8 -0
- package/esm2022/lib/enums/public-api.mjs +7 -0
- package/esm2022/lib/enums/{search-criteria-type-enum.mjs → search-criteria-type.enum.mjs} +1 -1
- package/esm2022/lib/enums/{table-type-enum.mjs → table-type.enum.mjs} +1 -1
- package/esm2022/lib/models/filter-option.model.mjs +2 -0
- package/esm2022/lib/models/form-button.model.mjs +2 -0
- package/esm2022/lib/models/form-check-field.model.mjs +2 -0
- package/esm2022/lib/models/form-date-field.model.mjs +2 -0
- package/esm2022/lib/models/form-drop-down-field.model.mjs +2 -0
- package/esm2022/lib/models/form-field-group.model.mjs +2 -0
- package/esm2022/lib/models/form-field.model.mjs +2 -0
- package/esm2022/lib/models/form-multi-select.model.mjs +2 -0
- package/esm2022/lib/models/form-number-field.model.mjs +2 -0
- package/esm2022/lib/models/form-switch-field.model.mjs +2 -0
- package/esm2022/lib/models/form-text-area-field.model.mjs +2 -0
- package/esm2022/lib/models/form-text-field.model.mjs +2 -0
- package/esm2022/lib/models/index.mjs +2 -2
- package/esm2022/lib/models/public-api.mjs +15 -0
- package/esm2022/lib/models/search-criteria.model.mjs +2 -0
- package/esm2022/lib/models/table-column.model.mjs +2 -0
- package/esm2022/lib/multi-search-criteria/multi-search-criteria.component.mjs +1 -1
- package/esm2022/lib/ng-advanced-prime-table/ng-advanced-prime-table.component.mjs +21 -3
- package/esm2022/lib/ng-prime-tools.module.mjs +66 -6
- package/esm2022/lib/pt-check-box-input/index.mjs +2 -0
- package/esm2022/lib/pt-check-box-input/pt-check-box-input.component.mjs +61 -0
- package/esm2022/lib/pt-check-box-input/pt-check-box-input.module.mjs +20 -0
- package/esm2022/lib/pt-check-box-input/public-api.mjs +3 -0
- package/esm2022/lib/pt-date-input/index.mjs +2 -0
- package/esm2022/lib/pt-date-input/pt-date-input.component.mjs +85 -0
- package/esm2022/lib/pt-date-input/pt-date-input.module.mjs +20 -0
- package/esm2022/lib/pt-date-input/pt-date.service.mjs +62 -0
- package/esm2022/lib/pt-date-input/public-api.mjs +3 -0
- package/esm2022/lib/pt-dropdown/index.mjs +2 -0
- package/esm2022/lib/pt-dropdown/pt-dropdown.component.mjs +57 -0
- package/esm2022/lib/pt-dropdown/pt-dropdown.module.mjs +20 -0
- package/esm2022/lib/pt-dropdown/public-api.mjs +3 -0
- package/esm2022/lib/pt-form-builder/index.mjs +2 -0
- package/esm2022/lib/pt-form-builder/pt-dynamic-form-field/pt-dynamic-form-field-module.mjs +59 -0
- package/esm2022/lib/pt-form-builder/pt-dynamic-form-field/pt-dynamic-form-field.component.mjs +55 -0
- package/esm2022/lib/pt-form-builder/pt-form-builder.component.mjs +77 -0
- package/esm2022/lib/pt-form-builder/pt-form-builder.module.mjs +32 -0
- package/esm2022/lib/pt-form-builder/public-api.mjs +3 -0
- package/esm2022/lib/pt-multi-select/index.mjs +2 -0
- package/esm2022/lib/pt-multi-select/pt-multi-select.component.mjs +57 -0
- package/esm2022/lib/pt-multi-select/pt-multi-select.module.mjs +20 -0
- package/esm2022/lib/pt-multi-select/public-api.mjs +3 -0
- package/esm2022/lib/pt-number-input/index.mjs +2 -0
- package/esm2022/lib/pt-number-input/pt-number-input.component.mjs +88 -0
- package/esm2022/lib/pt-number-input/pt-number-input.module.mjs +43 -0
- package/esm2022/lib/pt-number-input/public-api.mjs +3 -0
- package/esm2022/lib/pt-switch-input/index.mjs +2 -0
- package/esm2022/lib/pt-switch-input/pt-switch-input.component.mjs +62 -0
- package/esm2022/lib/pt-switch-input/pt-switch-input.module.mjs +20 -0
- package/esm2022/lib/pt-switch-input/public-api.mjs +3 -0
- package/esm2022/lib/pt-text-area-input/index.mjs +2 -0
- package/esm2022/lib/pt-text-area-input/pt-text-area-input.component.mjs +83 -0
- package/esm2022/lib/pt-text-area-input/pt-text-area-input.module.mjs +36 -0
- package/esm2022/lib/pt-text-area-input/public-api.mjs +3 -0
- package/esm2022/lib/pt-text-input/index.mjs +2 -0
- package/esm2022/lib/pt-text-input/pt-text-input.component.mjs +86 -0
- package/esm2022/lib/pt-text-input/pt-text-input.module.mjs +36 -0
- package/esm2022/lib/pt-text-input/public-api.mjs +3 -0
- package/esm2022/lib/types/date-format.type.mjs +2 -0
- package/esm2022/lib/types/date-input.type.mjs +2 -0
- package/esm2022/lib/types/index.mjs +2 -0
- package/esm2022/lib/types/public-api.mjs +2 -0
- package/esm2022/lib/utils/date.util.mjs +69 -0
- package/esm2022/public-api.mjs +11 -2
- package/fesm2022/ng-prime-tools.mjs +1119 -20
- package/fesm2022/ng-prime-tools.mjs.map +1 -1
- package/lib/enums/button-color.enum.d.ts +9 -0
- package/lib/enums/button-color.enum.d.ts.map +1 -0
- package/lib/enums/form-input-type.enum.d.ts +13 -0
- package/lib/enums/form-input-type.enum.d.ts.map +1 -0
- package/lib/enums/index.d.ts +1 -5
- package/lib/enums/index.d.ts.map +1 -1
- package/lib/enums/input-validation.enum.d.ts +7 -0
- package/lib/enums/input-validation.enum.d.ts.map +1 -0
- package/lib/enums/public-api.d.ts +6 -0
- package/lib/enums/public-api.d.ts.map +1 -0
- package/lib/enums/{search-criteria-type-enum.d.ts → search-criteria-type.enum.d.ts} +1 -1
- package/lib/enums/search-criteria-type.enum.d.ts.map +1 -0
- package/lib/enums/{table-type-enum.d.ts → table-type.enum.d.ts} +1 -1
- package/lib/enums/table-type.enum.d.ts.map +1 -0
- package/lib/models/{filter-option.d.ts → filter-option.model.d.ts} +1 -1
- package/lib/models/filter-option.model.d.ts.map +1 -0
- package/lib/models/form-button.model.d.ts +10 -0
- package/lib/models/form-button.model.d.ts.map +1 -0
- package/lib/models/form-check-field.model.d.ts +4 -0
- package/lib/models/form-check-field.model.d.ts.map +1 -0
- package/lib/models/form-date-field.model.d.ts +11 -0
- package/lib/models/form-date-field.model.d.ts.map +1 -0
- package/lib/models/form-drop-down-field.model.d.ts +5 -0
- package/lib/models/form-drop-down-field.model.d.ts.map +1 -0
- package/lib/models/form-field-group.model.d.ts +7 -0
- package/lib/models/form-field-group.model.d.ts.map +1 -0
- package/lib/models/form-field.model.d.ts +16 -0
- package/lib/models/form-field.model.d.ts.map +1 -0
- package/lib/models/form-multi-select.model.d.ts +5 -0
- package/lib/models/form-multi-select.model.d.ts.map +1 -0
- package/lib/models/form-number-field.model.d.ts +11 -0
- package/lib/models/form-number-field.model.d.ts.map +1 -0
- package/lib/models/form-switch-field.model.d.ts +4 -0
- package/lib/models/form-switch-field.model.d.ts.map +1 -0
- package/lib/models/form-text-area-field.model.d.ts +11 -0
- package/lib/models/form-text-area-field.model.d.ts.map +1 -0
- package/lib/models/form-text-field.model.d.ts +8 -0
- package/lib/models/form-text-field.model.d.ts.map +1 -0
- package/lib/models/index.d.ts +1 -1
- package/lib/models/public-api.d.ts +15 -0
- package/lib/models/public-api.d.ts.map +1 -0
- package/lib/models/{search-criteria.d.ts → search-criteria.model.d.ts} +3 -3
- package/lib/models/search-criteria.model.d.ts.map +1 -0
- package/lib/models/{table-column.d.ts → table-column.model.d.ts} +2 -2
- package/lib/models/table-column.model.d.ts.map +1 -0
- package/lib/multi-search-criteria/multi-search-criteria.component.d.ts +2 -2
- package/lib/multi-search-criteria/multi-search-criteria.component.d.ts.map +1 -1
- package/lib/ng-advanced-prime-table/ng-advanced-prime-table.component.d.ts +7 -1
- package/lib/ng-advanced-prime-table/ng-advanced-prime-table.component.d.ts.map +1 -1
- package/lib/ng-prime-tools.module.d.ts +8 -1
- package/lib/ng-prime-tools.module.d.ts.map +1 -1
- package/lib/pt-check-box-input/index.d.ts +2 -0
- package/lib/pt-check-box-input/index.d.ts.map +1 -0
- package/lib/pt-check-box-input/pt-check-box-input.component.d.ts +16 -0
- package/lib/pt-check-box-input/pt-check-box-input.component.d.ts.map +1 -0
- package/lib/pt-check-box-input/pt-check-box-input.module.d.ts +11 -0
- package/lib/pt-check-box-input/pt-check-box-input.module.d.ts.map +1 -0
- package/lib/pt-check-box-input/public-api.d.ts +3 -0
- package/lib/pt-check-box-input/public-api.d.ts.map +1 -0
- package/lib/pt-date-input/index.d.ts +2 -0
- package/lib/pt-date-input/index.d.ts.map +1 -0
- package/lib/pt-date-input/pt-date-input.component.d.ts +24 -0
- package/lib/pt-date-input/pt-date-input.component.d.ts.map +1 -0
- package/lib/pt-date-input/pt-date-input.module.d.ts +11 -0
- package/lib/pt-date-input/pt-date-input.module.d.ts.map +1 -0
- package/lib/pt-date-input/pt-date.service.d.ts +11 -0
- package/lib/pt-date-input/pt-date.service.d.ts.map +1 -0
- package/lib/pt-date-input/public-api.d.ts +3 -0
- package/lib/pt-date-input/public-api.d.ts.map +1 -0
- package/lib/pt-dropdown/index.d.ts +2 -0
- package/lib/pt-dropdown/index.d.ts.map +1 -0
- package/lib/pt-dropdown/pt-dropdown.component.d.ts +15 -0
- package/lib/pt-dropdown/pt-dropdown.component.d.ts.map +1 -0
- package/lib/pt-dropdown/pt-dropdown.module.d.ts +11 -0
- package/lib/pt-dropdown/pt-dropdown.module.d.ts.map +1 -0
- package/lib/pt-dropdown/public-api.d.ts +3 -0
- package/lib/pt-dropdown/public-api.d.ts.map +1 -0
- package/lib/pt-form-builder/index.d.ts +2 -0
- package/lib/pt-form-builder/index.d.ts.map +1 -0
- package/lib/pt-form-builder/pt-dynamic-form-field/pt-dynamic-form-field-module.d.ts +18 -0
- package/lib/pt-form-builder/pt-dynamic-form-field/pt-dynamic-form-field-module.d.ts.map +1 -0
- package/lib/pt-form-builder/pt-dynamic-form-field/pt-dynamic-form-field.component.d.ts +29 -0
- package/lib/pt-form-builder/pt-dynamic-form-field/pt-dynamic-form-field.component.d.ts.map +1 -0
- package/lib/pt-form-builder/pt-form-builder.component.d.ts +33 -0
- package/lib/pt-form-builder/pt-form-builder.component.d.ts.map +1 -0
- package/lib/pt-form-builder/pt-form-builder.module.d.ts +12 -0
- package/lib/pt-form-builder/pt-form-builder.module.d.ts.map +1 -0
- package/lib/pt-form-builder/public-api.d.ts +3 -0
- package/lib/pt-form-builder/public-api.d.ts.map +1 -0
- package/lib/pt-multi-select/index.d.ts +2 -0
- package/lib/pt-multi-select/index.d.ts.map +1 -0
- package/lib/pt-multi-select/pt-multi-select.component.d.ts +15 -0
- package/lib/pt-multi-select/pt-multi-select.component.d.ts.map +1 -0
- package/lib/pt-multi-select/pt-multi-select.module.d.ts +11 -0
- package/lib/pt-multi-select/pt-multi-select.module.d.ts.map +1 -0
- package/lib/pt-multi-select/public-api.d.ts +3 -0
- package/lib/pt-multi-select/public-api.d.ts.map +1 -0
- package/lib/pt-number-input/index.d.ts +2 -0
- package/lib/pt-number-input/index.d.ts.map +1 -0
- package/lib/pt-number-input/pt-number-input.component.d.ts +16 -0
- package/lib/pt-number-input/pt-number-input.component.d.ts.map +1 -0
- package/lib/pt-number-input/pt-number-input.module.d.ts +14 -0
- package/lib/pt-number-input/pt-number-input.module.d.ts.map +1 -0
- package/lib/pt-number-input/public-api.d.ts +3 -0
- package/lib/pt-number-input/public-api.d.ts.map +1 -0
- package/lib/pt-switch-input/index.d.ts +2 -0
- package/lib/pt-switch-input/index.d.ts.map +1 -0
- package/lib/pt-switch-input/pt-switch-input.component.d.ts +16 -0
- package/lib/pt-switch-input/pt-switch-input.component.d.ts.map +1 -0
- package/lib/pt-switch-input/pt-switch-input.module.d.ts +11 -0
- package/lib/pt-switch-input/pt-switch-input.module.d.ts.map +1 -0
- package/lib/pt-switch-input/public-api.d.ts +3 -0
- package/lib/pt-switch-input/public-api.d.ts.map +1 -0
- package/lib/pt-text-area-input/index.d.ts +2 -0
- package/lib/pt-text-area-input/index.d.ts.map +1 -0
- package/lib/pt-text-area-input/pt-text-area-input.component.d.ts +17 -0
- package/lib/pt-text-area-input/pt-text-area-input.component.d.ts.map +1 -0
- package/lib/pt-text-area-input/pt-text-area-input.module.d.ts +13 -0
- package/lib/pt-text-area-input/pt-text-area-input.module.d.ts.map +1 -0
- package/lib/pt-text-area-input/public-api.d.ts +3 -0
- package/lib/pt-text-area-input/public-api.d.ts.map +1 -0
- package/lib/pt-text-input/index.d.ts +2 -0
- package/lib/pt-text-input/index.d.ts.map +1 -0
- package/lib/pt-text-input/pt-text-input.component.d.ts +18 -0
- package/lib/pt-text-input/pt-text-input.component.d.ts.map +1 -0
- package/lib/pt-text-input/pt-text-input.module.d.ts +13 -0
- package/lib/pt-text-input/pt-text-input.module.d.ts.map +1 -0
- package/lib/pt-text-input/public-api.d.ts +3 -0
- package/lib/pt-text-input/public-api.d.ts.map +1 -0
- package/lib/types/date-format.type.d.ts +2 -0
- package/lib/types/date-format.type.d.ts.map +1 -0
- package/lib/types/date-input.type.d.ts +2 -0
- package/lib/types/date-input.type.d.ts.map +1 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/public-api.d.ts +2 -0
- package/lib/types/public-api.d.ts.map +1 -0
- package/lib/utils/date.util.d.ts +7 -0
- package/lib/utils/date.util.d.ts.map +1 -0
- package/package.json +1 -1
- package/public-api.d.ts +9 -0
- package/public-api.d.ts.map +1 -1
- package/esm2022/lib/enums/public_api.mjs +0 -4
- package/esm2022/lib/models/filter-option.mjs +0 -2
- package/esm2022/lib/models/public_api.mjs +0 -5
- package/esm2022/lib/models/search-criteria.mjs +0 -2
- package/esm2022/lib/models/table-column.mjs +0 -2
- package/lib/enums/public_api.d.ts +0 -3
- package/lib/enums/public_api.d.ts.map +0 -1
- package/lib/enums/search-criteria-type-enum.d.ts.map +0 -1
- package/lib/enums/table-type-enum.d.ts.map +0 -1
- package/lib/models/filter-option.d.ts.map +0 -1
- package/lib/models/public_api.d.ts +0 -4
- package/lib/models/public_api.d.ts.map +0 -1
- package/lib/models/search-criteria.d.ts.map +0 -1
- package/lib/models/table-column.d.ts.map +0 -1
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { Pipe, EventEmitter, Component, Input, Output, ViewChild, NgModule } from '@angular/core';
|
2
|
+
import { Pipe, EventEmitter, Component, Input, Output, ViewChild, NgModule, Injectable } from '@angular/core';
|
3
3
|
import * as i1 from '@angular/common';
|
4
4
|
import { CommonModule } from '@angular/common';
|
5
5
|
import * as i2 from 'primeng/table';
|
@@ -7,12 +7,12 @@ import { TableModule } from 'primeng/table';
|
|
7
7
|
import * as i3 from 'primeng/api';
|
8
8
|
import * as i4 from 'primeng/inputtext';
|
9
9
|
import { InputTextModule } from 'primeng/inputtext';
|
10
|
-
import * as
|
10
|
+
import * as i3$1 from 'primeng/button';
|
11
11
|
import { ButtonModule } from 'primeng/button';
|
12
12
|
import * as i6 from 'primeng/calendar';
|
13
13
|
import { CalendarModule } from 'primeng/calendar';
|
14
|
-
import * as
|
15
|
-
import { FormsModule } from '@angular/forms';
|
14
|
+
import * as i2$1 from '@angular/forms';
|
15
|
+
import { FormsModule, FormControl, Validators, ReactiveFormsModule } from '@angular/forms';
|
16
16
|
import * as i8 from 'primeng/multiselect';
|
17
17
|
import { MultiSelectModule } from 'primeng/multiselect';
|
18
18
|
import * as i9 from 'primeng/tag';
|
@@ -25,6 +25,18 @@ import * as i8$1 from 'primeng/inputnumber';
|
|
25
25
|
import { InputNumberModule } from 'primeng/inputnumber';
|
26
26
|
import * as i9$1 from 'primeng/panel';
|
27
27
|
import { PanelModule } from 'primeng/panel';
|
28
|
+
import * as i3$2 from 'primeng/checkbox';
|
29
|
+
import { CheckboxModule } from 'primeng/checkbox';
|
30
|
+
import * as i3$3 from 'primeng/inputgroup';
|
31
|
+
import { InputGroupModule } from 'primeng/inputgroup';
|
32
|
+
import * as i4$1 from 'primeng/inputgroupaddon';
|
33
|
+
import { InputGroupAddonModule } from 'primeng/inputgroupaddon';
|
34
|
+
import * as i3$4 from 'primeng/inputswitch';
|
35
|
+
import { InputSwitchModule } from 'primeng/inputswitch';
|
36
|
+
import * as i3$5 from 'primeng/inputtextarea';
|
37
|
+
import { InputTextareaModule } from 'primeng/inputtextarea';
|
38
|
+
import * as i3$6 from 'primeng/dropdown';
|
39
|
+
import { DropdownModule } from 'primeng/dropdown';
|
28
40
|
|
29
41
|
class CustomCurrencyPipe {
|
30
42
|
transform(value, currency, decimalPlaces, thousandSeparator = 'comma', decimalSeparator = 'dot') {
|
@@ -118,6 +130,8 @@ class NgAdvancedPrimeTableComponent {
|
|
118
130
|
this.totalRecords = 0;
|
119
131
|
this.rowsPerPage = [];
|
120
132
|
this.hasSearchFilter = false;
|
133
|
+
this.hasExportExcel = false;
|
134
|
+
this.hasExportPDF = false;
|
121
135
|
this.hasColumnFilter = false;
|
122
136
|
this.isPaginated = false;
|
123
137
|
this.actions = [];
|
@@ -125,6 +139,8 @@ class NgAdvancedPrimeTableComponent {
|
|
125
139
|
// Outputs: Events emitted to the parent component
|
126
140
|
this.filter = new EventEmitter();
|
127
141
|
this.search = new EventEmitter();
|
142
|
+
this.exportExcelEvent = new EventEmitter();
|
143
|
+
this.exportPdfEvent = new EventEmitter();
|
128
144
|
this.searchValue = '';
|
129
145
|
this.validCurrencyCodes = ['USD', 'EUR', 'MAD'];
|
130
146
|
// Component state properties
|
@@ -368,12 +384,18 @@ class NgAdvancedPrimeTableComponent {
|
|
368
384
|
}
|
369
385
|
return '';
|
370
386
|
}
|
387
|
+
exportExcel() {
|
388
|
+
this.exportExcelEvent.emit();
|
389
|
+
}
|
390
|
+
exportPdf() {
|
391
|
+
this.exportPdfEvent.emit();
|
392
|
+
}
|
371
393
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: NgAdvancedPrimeTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
372
|
-
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 : col.thousandSeparator\n : col.decimalSeparator\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 : col.thousandSeparator\n : col.decimalSeparator\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" }] }); }
|
394
|
+
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", hasExportExcel: "hasExportExcel", hasExportPDF: "hasExportPDF", hasColumnFilter: "hasColumnFilter", isPaginated: "isPaginated", actions: "actions", isSortable: "isSortable" }, outputs: { filter: "filter", search: "search", exportExcelEvent: "exportExcelEvent", exportPdfEvent: "exportPdfEvent" }, 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 <!-- Clear filters -->\n <button\n *ngIf=\"hasSearchFilter\"\n pButton\n icon=\"pi pi-filter-slash\"\n class=\"p-button-rounded p-button-text fa-lg\"\n (click)=\"clear(dt)\"\n title=\"Clear filters\"\n ></button>\n\n <!-- Export to Excel Button -->\n <button\n *ngIf=\"hasExportExcel\"\n pButton\n icon=\"pi pi-file-excel\"\n class=\"p-button-rounded p-button-text fa-lg\"\n (click)=\"exportExcel()\"\n title=\"Export to Excel\"\n ></button>\n\n <!-- Export to PDF Button -->\n <button\n *ngIf=\"hasExportPDF\"\n pButton\n icon=\"pi pi-file-pdf\"\n class=\"p-button-rounded p-button-text fa-lg\"\n (click)=\"exportPdf()\"\n title=\"Export to PDF\"\n ></button>\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 : col.thousandSeparator\n : col.decimalSeparator\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 : col.thousandSeparator\n : col.decimalSeparator\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}::ng-deep span.p-button-icon.pi.pi-file-excel{font-size:1.25em;color:green}::ng-deep span.p-button-icon.pi.pi-file-pdf{font-size:1.25em;color:red}\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: i3$1.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }, { 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: i2$1.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: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.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" }] }); }
|
373
395
|
}
|
374
396
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: NgAdvancedPrimeTableComponent, decorators: [{
|
375
397
|
type: Component,
|
376
|
-
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 : col.thousandSeparator\n : col.decimalSeparator\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 : col.thousandSeparator\n : col.decimalSeparator\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"] }]
|
398
|
+
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 <!-- Clear filters -->\n <button\n *ngIf=\"hasSearchFilter\"\n pButton\n icon=\"pi pi-filter-slash\"\n class=\"p-button-rounded p-button-text fa-lg\"\n (click)=\"clear(dt)\"\n title=\"Clear filters\"\n ></button>\n\n <!-- Export to Excel Button -->\n <button\n *ngIf=\"hasExportExcel\"\n pButton\n icon=\"pi pi-file-excel\"\n class=\"p-button-rounded p-button-text fa-lg\"\n (click)=\"exportExcel()\"\n title=\"Export to Excel\"\n ></button>\n\n <!-- Export to PDF Button -->\n <button\n *ngIf=\"hasExportPDF\"\n pButton\n icon=\"pi pi-file-pdf\"\n class=\"p-button-rounded p-button-text fa-lg\"\n (click)=\"exportPdf()\"\n title=\"Export to PDF\"\n ></button>\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 : col.thousandSeparator\n : col.decimalSeparator\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 : col.thousandSeparator\n : col.decimalSeparator\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}::ng-deep span.p-button-icon.pi.pi-file-excel{font-size:1.25em;color:green}::ng-deep span.p-button-icon.pi.pi-file-pdf{font-size:1.25em;color:red}\n"] }]
|
377
399
|
}], ctorParameters: () => [], propDecorators: { data: [{
|
378
400
|
type: Input
|
379
401
|
}], columns: [{
|
@@ -384,6 +406,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
384
406
|
type: Input
|
385
407
|
}], hasSearchFilter: [{
|
386
408
|
type: Input
|
409
|
+
}], hasExportExcel: [{
|
410
|
+
type: Input
|
411
|
+
}], hasExportPDF: [{
|
412
|
+
type: Input
|
387
413
|
}], hasColumnFilter: [{
|
388
414
|
type: Input
|
389
415
|
}], isPaginated: [{
|
@@ -396,6 +422,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
396
422
|
type: Output
|
397
423
|
}], search: [{
|
398
424
|
type: Output
|
425
|
+
}], exportExcelEvent: [{
|
426
|
+
type: Output
|
427
|
+
}], exportPdfEvent: [{
|
428
|
+
type: Output
|
399
429
|
}], dt: [{
|
400
430
|
type: ViewChild,
|
401
431
|
args: ['dt', { static: false }]
|
@@ -475,12 +505,39 @@ var SearchCriteriaTypeEnum;
|
|
475
505
|
SearchCriteriaTypeEnum["MULTISELECT"] = "MULTISELECT";
|
476
506
|
})(SearchCriteriaTypeEnum || (SearchCriteriaTypeEnum = {}));
|
477
507
|
|
478
|
-
|
508
|
+
var FormInputTypeEnum;
|
509
|
+
(function (FormInputTypeEnum) {
|
510
|
+
FormInputTypeEnum["DATE"] = "DATE";
|
511
|
+
FormInputTypeEnum["TEXT"] = "TEXT";
|
512
|
+
FormInputTypeEnum["TEXTAREA"] = "TEXTAREA";
|
513
|
+
FormInputTypeEnum["AMOUNT"] = "AMOUNT";
|
514
|
+
FormInputTypeEnum["NUMBER"] = "NUMBER";
|
515
|
+
FormInputTypeEnum["MULTISELECT"] = "MULTISELECT";
|
516
|
+
FormInputTypeEnum["SELECT"] = "SELECT";
|
517
|
+
FormInputTypeEnum["CURRENCY"] = "CURRENCY";
|
518
|
+
FormInputTypeEnum["CHECKBOX"] = "CHECKBOX";
|
519
|
+
FormInputTypeEnum["SWITCH"] = "SWITCH";
|
520
|
+
})(FormInputTypeEnum || (FormInputTypeEnum = {}));
|
479
521
|
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
522
|
+
var ButtonColorEnum;
|
523
|
+
(function (ButtonColorEnum) {
|
524
|
+
ButtonColorEnum["PRIMARY"] = "p-button-primary";
|
525
|
+
ButtonColorEnum["SECONDARY"] = "p-button-secondary";
|
526
|
+
ButtonColorEnum["SUCCESS"] = "p-button-success";
|
527
|
+
ButtonColorEnum["INFO"] = "p-button-info";
|
528
|
+
ButtonColorEnum["WARNING"] = "p-button-warning";
|
529
|
+
ButtonColorEnum["DANGER"] = "p-button-danger";
|
530
|
+
})(ButtonColorEnum || (ButtonColorEnum = {}));
|
531
|
+
|
532
|
+
var InputValidationEnum;
|
533
|
+
(function (InputValidationEnum) {
|
534
|
+
InputValidationEnum["ONLY_LETTERS"] = "^[A-Za-z ]+$";
|
535
|
+
InputValidationEnum["ONLY_NUMBERS"] = "^[0-9]+$";
|
536
|
+
InputValidationEnum["LETTERS_AND_NUMBERS"] = "^[A-Za-z0-9 ]+$";
|
537
|
+
InputValidationEnum["PHONE_NUMBER"] = "^[0-9 ]+$";
|
538
|
+
})(InputValidationEnum || (InputValidationEnum = {}));
|
539
|
+
|
540
|
+
// projects/ng-prime-tools/src/lib/enums/public_api.ts
|
484
541
|
|
485
542
|
class MultiSearchCriteriaComponent {
|
486
543
|
constructor() {
|
@@ -587,7 +644,7 @@ class MultiSearchCriteriaComponent {
|
|
587
644
|
return null;
|
588
645
|
}
|
589
646
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: MultiSearchCriteriaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
590
|
-
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", mode: "mode" }, outputs: { filteredData: "filteredData", searchCriteria: "searchCriteria" }, 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, input)\"\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:
|
647
|
+
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", mode: "mode" }, outputs: { filteredData: "filteredData", searchCriteria: "searchCriteria" }, 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, input)\"\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: i3$1.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: i2$1.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: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.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"] }] }); }
|
591
648
|
}
|
592
649
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: MultiSearchCriteriaComponent, decorators: [{
|
593
650
|
type: Component,
|
@@ -652,16 +709,1043 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
652
709
|
*/
|
653
710
|
/// <amd-module name="ng-prime-tools/multi-search-criteria" />
|
654
711
|
|
712
|
+
class PTCheckBoxInputComponent {
|
713
|
+
ngOnInit() {
|
714
|
+
this.setupControl();
|
715
|
+
}
|
716
|
+
setupControl() {
|
717
|
+
let control = this.formGroup.get(this.formField.name);
|
718
|
+
if (!control) {
|
719
|
+
control = new FormControl(null);
|
720
|
+
this.formGroup.addControl(this.formField.name, control);
|
721
|
+
}
|
722
|
+
setTimeout(() => {
|
723
|
+
if (this.formField.disabled) {
|
724
|
+
control.disable({ emitEvent: false });
|
725
|
+
}
|
726
|
+
else {
|
727
|
+
control.enable({ emitEvent: false });
|
728
|
+
}
|
729
|
+
});
|
730
|
+
const validators = this.getValidators();
|
731
|
+
control.setValidators(validators);
|
732
|
+
control.updateValueAndValidity({ emitEvent: false });
|
733
|
+
}
|
734
|
+
getValidators() {
|
735
|
+
const validators = [];
|
736
|
+
if (this.formField.required) {
|
737
|
+
validators.push(this.requireChoiceValidator());
|
738
|
+
}
|
739
|
+
return validators;
|
740
|
+
}
|
741
|
+
requireChoiceValidator() {
|
742
|
+
return (control) => {
|
743
|
+
return control.value !== null && control.value !== undefined
|
744
|
+
? null
|
745
|
+
: { requiredChoice: true };
|
746
|
+
};
|
747
|
+
}
|
748
|
+
getErrorMessage() {
|
749
|
+
const control = this.formGroup.get(this.formField.name);
|
750
|
+
if (control?.errors?.['requiredChoice'] && !control?.dirty) {
|
751
|
+
return this.formField.errorText || `${this.formField.label} is required`;
|
752
|
+
}
|
753
|
+
return '';
|
754
|
+
}
|
755
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTCheckBoxInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
756
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: PTCheckBoxInputComponent, selector: "pt-check-box-input", inputs: { formGroup: "formGroup", formField: "formField" }, ngImport: i0, template: "<div\n [formGroup]=\"formGroup\"\n class=\"form-field\"\n [ngStyle]=\"{ width: formField.width || '100%' }\"\n *ngIf=\"!formField.hidden\"\n>\n <div class=\"checkbox-container\">\n <p-checkbox\n [formControlName]=\"formField.name\"\n [binary]=\"true\"\n [label]=\"formField.label || ''\"\n ></p-checkbox>\n </div>\n <div\n *ngIf=\"\n formGroup.get(formField.name)?.errors &&\n (formGroup.get(formField.name)?.touched ||\n formGroup.get(formField.name)?.dirty)\n \"\n class=\"error-container\"\n >\n <small class=\"p-error\">{{ getErrorMessage() }}</small>\n </div>\n</div>\n", styles: [".form-field{margin-bottom:1rem}.form-field label{display:block;margin-bottom:.5rem;font-weight:700;font-size:1rem}.checkbox-container{display:flex;align-items:center}.p-error{font-size:.8rem;color:#f44336}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i3$2.Checkbox, selector: "p-checkbox", inputs: ["value", "name", "disabled", "binary", "label", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "styleClass", "labelStyleClass", "formControl", "checkboxIcon", "readonly", "required", "autofocus", "trueValue", "falseValue", "variant"], outputs: ["onChange", "onFocus", "onBlur"] }] }); }
|
757
|
+
}
|
758
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTCheckBoxInputComponent, decorators: [{
|
759
|
+
type: Component,
|
760
|
+
args: [{ selector: 'pt-check-box-input', template: "<div\n [formGroup]=\"formGroup\"\n class=\"form-field\"\n [ngStyle]=\"{ width: formField.width || '100%' }\"\n *ngIf=\"!formField.hidden\"\n>\n <div class=\"checkbox-container\">\n <p-checkbox\n [formControlName]=\"formField.name\"\n [binary]=\"true\"\n [label]=\"formField.label || ''\"\n ></p-checkbox>\n </div>\n <div\n *ngIf=\"\n formGroup.get(formField.name)?.errors &&\n (formGroup.get(formField.name)?.touched ||\n formGroup.get(formField.name)?.dirty)\n \"\n class=\"error-container\"\n >\n <small class=\"p-error\">{{ getErrorMessage() }}</small>\n </div>\n</div>\n", styles: [".form-field{margin-bottom:1rem}.form-field label{display:block;margin-bottom:.5rem;font-weight:700;font-size:1rem}.checkbox-container{display:flex;align-items:center}.p-error{font-size:.8rem;color:#f44336}\n"] }]
|
761
|
+
}], propDecorators: { formGroup: [{
|
762
|
+
type: Input
|
763
|
+
}], formField: [{
|
764
|
+
type: Input
|
765
|
+
}] } });
|
766
|
+
|
767
|
+
// date.util.ts
|
768
|
+
function getDefaultDateFormat(dateInputType) {
|
769
|
+
switch (dateInputType) {
|
770
|
+
case 'time':
|
771
|
+
return 'HH:mm';
|
772
|
+
case 'datetime':
|
773
|
+
return 'dd/mm/yy';
|
774
|
+
case 'date':
|
775
|
+
default:
|
776
|
+
return 'dd/mm/yy';
|
777
|
+
}
|
778
|
+
}
|
779
|
+
function getDefaultPlaceholder(dateInputType) {
|
780
|
+
switch (dateInputType) {
|
781
|
+
case 'time':
|
782
|
+
return 'Select time';
|
783
|
+
case 'datetime':
|
784
|
+
return 'Select date and time';
|
785
|
+
case 'date':
|
786
|
+
default:
|
787
|
+
return 'Select date';
|
788
|
+
}
|
789
|
+
}
|
790
|
+
function parseDate(dateString, format) {
|
791
|
+
const parts = dateString.match(/\d+/g);
|
792
|
+
if (!parts || parts.length < 2)
|
793
|
+
throw new Error(`Invalid date string: ${dateString}`);
|
794
|
+
let day, month, year, hour, minute, second;
|
795
|
+
switch (format) {
|
796
|
+
case 'dd/mm/yy':
|
797
|
+
case 'dd-mm-yy':
|
798
|
+
case 'dd.mm.yy':
|
799
|
+
[day, month, year] = parts;
|
800
|
+
break;
|
801
|
+
case 'mm/dd/yy':
|
802
|
+
[month, day, year] = parts;
|
803
|
+
break;
|
804
|
+
case 'yy/mm/dd':
|
805
|
+
[year, month, day] = parts;
|
806
|
+
break;
|
807
|
+
case 'HH:mm':
|
808
|
+
[hour, minute] = parts;
|
809
|
+
return new Date(0, 0, 0, Number(hour), Number(minute));
|
810
|
+
case 'HH:mm:ss':
|
811
|
+
[hour, minute, second] = parts;
|
812
|
+
return new Date(0, 0, 0, Number(hour), Number(minute), Number(second));
|
813
|
+
default:
|
814
|
+
throw new Error(`Unsupported date format: ${format}`);
|
815
|
+
}
|
816
|
+
year = year.length === 2 ? `20${year}` : year;
|
817
|
+
return new Date(Number(year), Number(month) - 1, Number(day), Number(hour || 0), Number(minute || 0), Number(second || 0));
|
818
|
+
}
|
819
|
+
function validateTimeValue(value, dateFormat, valueType, hourFormat) {
|
820
|
+
const timeFormat = dateFormat.includes('ss') ? 'HH:mm:ss' : 'HH:mm';
|
821
|
+
const timeParts = value.match(/\d+/g);
|
822
|
+
if (!timeParts || timeParts.length !== (timeFormat === 'HH:mm:ss' ? 3 : 2)) {
|
823
|
+
throw new Error(`Invalid ${valueType} "${value}" for time format "${timeFormat}".`);
|
824
|
+
}
|
825
|
+
const [hour, minute, second] = timeParts.map(Number);
|
826
|
+
const maxHour = hourFormat === '12' ? 12 : 23;
|
827
|
+
if (hour < 0 ||
|
828
|
+
hour > maxHour ||
|
829
|
+
minute < 0 ||
|
830
|
+
minute > 59 ||
|
831
|
+
(second !== undefined && (second < 0 || second > 59))) {
|
832
|
+
throw new Error(`Invalid ${valueType} "${value}". Time must be between 00:00 and ${maxHour}:59.`);
|
833
|
+
}
|
834
|
+
}
|
835
|
+
|
836
|
+
// pt-date.service.ts
|
837
|
+
class PTDateService {
|
838
|
+
constructor() { }
|
839
|
+
// Assign default date format based on input type
|
840
|
+
assignDefaultDateFormat(dateInputType, currentFormat) {
|
841
|
+
return currentFormat || getDefaultDateFormat(dateInputType);
|
842
|
+
}
|
843
|
+
// Validate date format and input type compatibility
|
844
|
+
validateDateFormatAndType(dateFormat, dateInputType, minValue, maxValue, hourFormat = '24') {
|
845
|
+
const dateOnlyFormats = [
|
846
|
+
'dd/mm/yy',
|
847
|
+
'dd-mm-yy',
|
848
|
+
'dd.mm.yy',
|
849
|
+
'mm/dd/yy',
|
850
|
+
'yy/mm/dd',
|
851
|
+
];
|
852
|
+
const timeOnlyFormats = ['HH:mm', 'HH:mm:ss'];
|
853
|
+
const dateTimeFormats = dateOnlyFormats;
|
854
|
+
switch (dateInputType) {
|
855
|
+
case 'date':
|
856
|
+
if (!dateOnlyFormats.includes(dateFormat)) {
|
857
|
+
throw new Error(`Invalid dateFormat "${dateFormat}" for dateInputType "date".`);
|
858
|
+
}
|
859
|
+
break;
|
860
|
+
case 'time':
|
861
|
+
if (!timeOnlyFormats.includes(dateFormat)) {
|
862
|
+
throw new Error(`Invalid dateFormat "${dateFormat}" for dateInputType "time".`);
|
863
|
+
}
|
864
|
+
if (minValue) {
|
865
|
+
validateTimeValue(minValue, dateFormat, 'minValue', hourFormat);
|
866
|
+
}
|
867
|
+
if (maxValue) {
|
868
|
+
validateTimeValue(maxValue, dateFormat, 'maxValue', hourFormat);
|
869
|
+
}
|
870
|
+
break;
|
871
|
+
case 'datetime':
|
872
|
+
if (!dateTimeFormats.includes(dateFormat)) {
|
873
|
+
throw new Error(`Invalid dateFormat "${dateFormat}" for dateInputType "datetime".`);
|
874
|
+
}
|
875
|
+
break;
|
876
|
+
case 'range':
|
877
|
+
if (!dateOnlyFormats.includes(dateFormat)) {
|
878
|
+
throw new Error(`Invalid dateFormat "${dateFormat}" for dateInputType "range".`);
|
879
|
+
}
|
880
|
+
break;
|
881
|
+
default:
|
882
|
+
throw new Error(`Unsupported dateInputType: ${dateInputType}`);
|
883
|
+
}
|
884
|
+
}
|
885
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTDateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
886
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTDateService, providedIn: 'root' }); }
|
887
|
+
}
|
888
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTDateService, decorators: [{
|
889
|
+
type: Injectable,
|
890
|
+
args: [{
|
891
|
+
providedIn: 'root',
|
892
|
+
}]
|
893
|
+
}], ctorParameters: () => [] });
|
894
|
+
|
895
|
+
class PTDateInputComponent {
|
896
|
+
constructor(dateService) {
|
897
|
+
this.dateService = dateService;
|
898
|
+
this.minDate = null;
|
899
|
+
this.maxDate = null;
|
900
|
+
this.defaultPlaceholder = 'Select date';
|
901
|
+
this.defaultDateFormat = 'dd/mm/yy';
|
902
|
+
}
|
903
|
+
ngOnInit() {
|
904
|
+
this.defaultDateFormat = this.dateService.assignDefaultDateFormat(this.formField.dateInputType || 'date', this.formField.dateFormat);
|
905
|
+
this.setupControl();
|
906
|
+
this.initializeDateLimits();
|
907
|
+
try {
|
908
|
+
this.dateService.validateDateFormatAndType(this.defaultDateFormat, this.formField.dateInputType || 'date', this.formField.minValue, this.formField.maxValue, this.formField.hourFormat || '24');
|
909
|
+
}
|
910
|
+
catch (error) {
|
911
|
+
if (error instanceof Error) {
|
912
|
+
console.error(error.message);
|
913
|
+
}
|
914
|
+
else {
|
915
|
+
console.error('An unknown error occurred.');
|
916
|
+
}
|
917
|
+
}
|
918
|
+
this.defaultPlaceholder = getDefaultPlaceholder(this.formField.dateInputType || 'date');
|
919
|
+
}
|
920
|
+
setupControl() {
|
921
|
+
let control = this.formGroup.get(this.formField.name);
|
922
|
+
if (!control) {
|
923
|
+
control = new FormControl(null);
|
924
|
+
this.formGroup.addControl(this.formField.name, control);
|
925
|
+
}
|
926
|
+
setTimeout(() => {
|
927
|
+
if (this.formField.disabled) {
|
928
|
+
control.disable({ emitEvent: false });
|
929
|
+
}
|
930
|
+
else {
|
931
|
+
control.enable({ emitEvent: false });
|
932
|
+
}
|
933
|
+
});
|
934
|
+
control.setValidators(this.getValidators());
|
935
|
+
control.updateValueAndValidity({ emitEvent: false });
|
936
|
+
}
|
937
|
+
initializeDateLimits() {
|
938
|
+
const dateFormat = this.formField.dateFormat;
|
939
|
+
if (this.formField.minValue) {
|
940
|
+
this.minDate = parseDate(this.formField.minValue, dateFormat);
|
941
|
+
}
|
942
|
+
if (this.formField.maxValue) {
|
943
|
+
this.maxDate = parseDate(this.formField.maxValue, dateFormat);
|
944
|
+
}
|
945
|
+
}
|
946
|
+
getValidators() {
|
947
|
+
const validators = [];
|
948
|
+
if (this.formField.required) {
|
949
|
+
validators.push(Validators.required);
|
950
|
+
}
|
951
|
+
return validators;
|
952
|
+
}
|
953
|
+
getErrorMessage() {
|
954
|
+
const control = this.formGroup.get(this.formField.name);
|
955
|
+
if (control?.hasError('required')) {
|
956
|
+
return this.formField.errorText || `${this.formField.label} is required`;
|
957
|
+
}
|
958
|
+
return '';
|
959
|
+
}
|
960
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTDateInputComponent, deps: [{ token: PTDateService }], target: i0.ɵɵFactoryTarget.Component }); }
|
961
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: PTDateInputComponent, selector: "pt-date-input", inputs: { formGroup: "formGroup", formField: "formField" }, ngImport: i0, template: "<div\n [formGroup]=\"formGroup\"\n class=\"form-field\"\n [ngStyle]=\"{ width: formField.width || '100%' }\"\n *ngIf=\"!formField.hidden\"\n>\n <label *ngIf=\"formField.label\">{{ formField.label }}</label>\n <p-calendar\n [formControlName]=\"formField.name\"\n [placeholder]=\"formField.placeholder || defaultPlaceholder\"\n [dateFormat]=\"formField.dateFormat || defaultDateFormat\"\n [showIcon]=\"true\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [showTime]=\"\n formField.dateInputType === 'datetime' ||\n formField.dateInputType === 'time'\n \"\n [timeOnly]=\"formField.dateInputType === 'time'\"\n [hourFormat]=\"formField.hourFormat || '24'\"\n [selectionMode]=\"formField.dateInputType === 'range' ? 'range' : 'single'\"\n ></p-calendar>\n <div\n *ngIf=\"\n formGroup.get(formField.name)?.invalid &&\n formGroup.get(formField.name)?.touched\n \"\n >\n <small class=\"p-error\">{{ getErrorMessage() }}</small>\n </div>\n</div>\n", styles: [".form-field{margin-bottom:1rem}.form-field label{display:block;margin-bottom:.5rem;font-weight:700}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { 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"] }] }); }
|
962
|
+
}
|
963
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTDateInputComponent, decorators: [{
|
964
|
+
type: Component,
|
965
|
+
args: [{ selector: 'pt-date-input', template: "<div\n [formGroup]=\"formGroup\"\n class=\"form-field\"\n [ngStyle]=\"{ width: formField.width || '100%' }\"\n *ngIf=\"!formField.hidden\"\n>\n <label *ngIf=\"formField.label\">{{ formField.label }}</label>\n <p-calendar\n [formControlName]=\"formField.name\"\n [placeholder]=\"formField.placeholder || defaultPlaceholder\"\n [dateFormat]=\"formField.dateFormat || defaultDateFormat\"\n [showIcon]=\"true\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [showTime]=\"\n formField.dateInputType === 'datetime' ||\n formField.dateInputType === 'time'\n \"\n [timeOnly]=\"formField.dateInputType === 'time'\"\n [hourFormat]=\"formField.hourFormat || '24'\"\n [selectionMode]=\"formField.dateInputType === 'range' ? 'range' : 'single'\"\n ></p-calendar>\n <div\n *ngIf=\"\n formGroup.get(formField.name)?.invalid &&\n formGroup.get(formField.name)?.touched\n \"\n >\n <small class=\"p-error\">{{ getErrorMessage() }}</small>\n </div>\n</div>\n", styles: [".form-field{margin-bottom:1rem}.form-field label{display:block;margin-bottom:.5rem;font-weight:700}\n"] }]
|
966
|
+
}], ctorParameters: () => [{ type: PTDateService }], propDecorators: { formGroup: [{
|
967
|
+
type: Input
|
968
|
+
}], formField: [{
|
969
|
+
type: Input
|
970
|
+
}] } });
|
971
|
+
|
972
|
+
class PTNumberInputComponent {
|
973
|
+
ngOnInit() {
|
974
|
+
this.setupControl();
|
975
|
+
}
|
976
|
+
setupControl() {
|
977
|
+
const control = this.formGroup.get(this.formField.name);
|
978
|
+
if (control) {
|
979
|
+
const validators = this.getValidators();
|
980
|
+
control.setValidators(validators);
|
981
|
+
// Manage the disabled state directly
|
982
|
+
setTimeout(() => {
|
983
|
+
if (this.formField.disabled) {
|
984
|
+
control.disable({ emitEvent: false });
|
985
|
+
}
|
986
|
+
else {
|
987
|
+
control.enable({ emitEvent: false });
|
988
|
+
}
|
989
|
+
control.updateValueAndValidity({ emitEvent: false });
|
990
|
+
});
|
991
|
+
}
|
992
|
+
}
|
993
|
+
getValidators() {
|
994
|
+
const validators = [];
|
995
|
+
if (this.formField.required) {
|
996
|
+
validators.push(Validators.required);
|
997
|
+
}
|
998
|
+
if (this.formField.minValue !== undefined) {
|
999
|
+
const minValue = Number(this.formField.minValue);
|
1000
|
+
if (!isNaN(minValue)) {
|
1001
|
+
validators.push(Validators.min(minValue));
|
1002
|
+
}
|
1003
|
+
else {
|
1004
|
+
console.error(`Invalid minValue: ${this.formField.minValue} is not a number.`);
|
1005
|
+
}
|
1006
|
+
}
|
1007
|
+
if (this.formField.maxValue !== undefined) {
|
1008
|
+
const maxValue = Number(this.formField.maxValue);
|
1009
|
+
if (!isNaN(maxValue)) {
|
1010
|
+
validators.push(Validators.max(maxValue));
|
1011
|
+
}
|
1012
|
+
else {
|
1013
|
+
console.error(`Invalid maxValue: ${this.formField.maxValue} is not a number.`);
|
1014
|
+
}
|
1015
|
+
}
|
1016
|
+
if (this.formField.inputValidation) {
|
1017
|
+
validators.push(this.validateWithInputValidation(this.formField.inputValidation));
|
1018
|
+
}
|
1019
|
+
return validators;
|
1020
|
+
}
|
1021
|
+
validateWithInputValidation(inputValidation) {
|
1022
|
+
return Validators.pattern(new RegExp(inputValidation));
|
1023
|
+
}
|
1024
|
+
getErrorMessage() {
|
1025
|
+
const control = this.formGroup.get(this.formField.name);
|
1026
|
+
if (control?.hasError('required')) {
|
1027
|
+
return this.formField.errorText || `${this.formField.label} is required`;
|
1028
|
+
}
|
1029
|
+
else if (control?.hasError('min')) {
|
1030
|
+
return `${this.formField.label} must be at least ${this.formField.minValue}`;
|
1031
|
+
}
|
1032
|
+
else if (control?.hasError('max')) {
|
1033
|
+
return `${this.formField.label} must be at most ${this.formField.maxValue}`;
|
1034
|
+
}
|
1035
|
+
else if (control?.hasError('pattern')) {
|
1036
|
+
return `${this.formField.label} is invalid`;
|
1037
|
+
}
|
1038
|
+
return '';
|
1039
|
+
}
|
1040
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTNumberInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
1041
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: PTNumberInputComponent, selector: "pt-number-input", inputs: { formGroup: "formGroup", formField: "formField" }, ngImport: i0, template: "<div\n [formGroup]=\"formGroup\"\n class=\"form-field\"\n [ngStyle]=\"{ width: formField.width || '100%' }\"\n *ngIf=\"!formField.hidden\"\n>\n <label *ngIf=\"formField.label\">{{ formField.label }}</label>\n <p-inputGroup>\n <ng-container\n *ngIf=\"!formField.iconPosition || formField.iconPosition === 'left'\"\n >\n <p-inputGroupAddon *ngIf=\"formField.iconClass || formField.currency\">\n <i *ngIf=\"formField.iconClass\" [ngClass]=\"formField.iconClass\"></i>\n <span *ngIf=\"!formField.iconClass && formField.currency\">\n {{ formField.currency }}\n </span>\n </p-inputGroupAddon>\n <p-inputNumber\n [formControlName]=\"formField.name\"\n mode=\"decimal\"\n [locale]=\"formField.numberFormat || undefined\"\n [useGrouping]=\"formField.numberFormat ? true : false\"\n [minFractionDigits]=\"formField.decimalDigits || 0\"\n [maxFractionDigits]=\"formField.decimalDigits || 0\"\n [placeholder]=\"formField.placeholder || ''\"\n ></p-inputNumber>\n </ng-container>\n <ng-container *ngIf=\"formField.iconPosition === 'right'\">\n <p-inputNumber\n [formControlName]=\"formField.name\"\n mode=\"decimal\"\n [locale]=\"formField.numberFormat || undefined\"\n [useGrouping]=\"formField.numberFormat ? true : false\"\n [minFractionDigits]=\"formField.decimalDigits || 0\"\n [maxFractionDigits]=\"formField.decimalDigits || 0\"\n [placeholder]=\"formField.placeholder || ''\"\n ></p-inputNumber>\n <p-inputGroupAddon *ngIf=\"formField.iconClass || formField.currency\">\n <i *ngIf=\"formField.iconClass\" [ngClass]=\"formField.iconClass\"></i>\n <span *ngIf=\"!formField.iconClass && formField.currency\">\n {{ formField.currency }}\n </span>\n </p-inputGroupAddon>\n </ng-container>\n </p-inputGroup>\n <div\n *ngIf=\"\n formGroup.get(formField.name)?.invalid &&\n formGroup.get(formField.name)?.touched\n \"\n >\n <small class=\"p-error\">{{ getErrorMessage() }}</small>\n </div>\n</div>\n", styles: [".form-field{margin-bottom:1rem}.form-field label{display:block;margin-bottom:.5rem;font-weight:700}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i3$3.InputGroup, selector: "p-inputGroup", inputs: ["style", "styleClass"] }, { kind: "component", type: i4$1.InputGroupAddon, selector: "p-inputGroupAddon", inputs: ["style", "styleClass"] }, { 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"] }] }); }
|
1042
|
+
}
|
1043
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTNumberInputComponent, decorators: [{
|
1044
|
+
type: Component,
|
1045
|
+
args: [{ selector: 'pt-number-input', template: "<div\n [formGroup]=\"formGroup\"\n class=\"form-field\"\n [ngStyle]=\"{ width: formField.width || '100%' }\"\n *ngIf=\"!formField.hidden\"\n>\n <label *ngIf=\"formField.label\">{{ formField.label }}</label>\n <p-inputGroup>\n <ng-container\n *ngIf=\"!formField.iconPosition || formField.iconPosition === 'left'\"\n >\n <p-inputGroupAddon *ngIf=\"formField.iconClass || formField.currency\">\n <i *ngIf=\"formField.iconClass\" [ngClass]=\"formField.iconClass\"></i>\n <span *ngIf=\"!formField.iconClass && formField.currency\">\n {{ formField.currency }}\n </span>\n </p-inputGroupAddon>\n <p-inputNumber\n [formControlName]=\"formField.name\"\n mode=\"decimal\"\n [locale]=\"formField.numberFormat || undefined\"\n [useGrouping]=\"formField.numberFormat ? true : false\"\n [minFractionDigits]=\"formField.decimalDigits || 0\"\n [maxFractionDigits]=\"formField.decimalDigits || 0\"\n [placeholder]=\"formField.placeholder || ''\"\n ></p-inputNumber>\n </ng-container>\n <ng-container *ngIf=\"formField.iconPosition === 'right'\">\n <p-inputNumber\n [formControlName]=\"formField.name\"\n mode=\"decimal\"\n [locale]=\"formField.numberFormat || undefined\"\n [useGrouping]=\"formField.numberFormat ? true : false\"\n [minFractionDigits]=\"formField.decimalDigits || 0\"\n [maxFractionDigits]=\"formField.decimalDigits || 0\"\n [placeholder]=\"formField.placeholder || ''\"\n ></p-inputNumber>\n <p-inputGroupAddon *ngIf=\"formField.iconClass || formField.currency\">\n <i *ngIf=\"formField.iconClass\" [ngClass]=\"formField.iconClass\"></i>\n <span *ngIf=\"!formField.iconClass && formField.currency\">\n {{ formField.currency }}\n </span>\n </p-inputGroupAddon>\n </ng-container>\n </p-inputGroup>\n <div\n *ngIf=\"\n formGroup.get(formField.name)?.invalid &&\n formGroup.get(formField.name)?.touched\n \"\n >\n <small class=\"p-error\">{{ getErrorMessage() }}</small>\n </div>\n</div>\n", styles: [".form-field{margin-bottom:1rem}.form-field label{display:block;margin-bottom:.5rem;font-weight:700}\n"] }]
|
1046
|
+
}], propDecorators: { formGroup: [{
|
1047
|
+
type: Input
|
1048
|
+
}], formField: [{
|
1049
|
+
type: Input
|
1050
|
+
}] } });
|
1051
|
+
|
1052
|
+
class PTSwitchInputComponent {
|
1053
|
+
ngOnInit() {
|
1054
|
+
this.setupControl();
|
1055
|
+
}
|
1056
|
+
setupControl() {
|
1057
|
+
let control = this.formGroup.get(this.formField.name);
|
1058
|
+
if (!control) {
|
1059
|
+
// Initialize control with false indicating not activated
|
1060
|
+
control = new FormControl(this.formField.required ? null : false);
|
1061
|
+
this.formGroup.addControl(this.formField.name, control);
|
1062
|
+
}
|
1063
|
+
// Apply validators and manage disabled state
|
1064
|
+
control.setValidators(this.getValidators());
|
1065
|
+
setTimeout(() => {
|
1066
|
+
if (this.formField.disabled) {
|
1067
|
+
control.disable({ emitEvent: false });
|
1068
|
+
}
|
1069
|
+
else {
|
1070
|
+
control.enable({ emitEvent: false });
|
1071
|
+
}
|
1072
|
+
control.updateValueAndValidity({ emitEvent: false });
|
1073
|
+
});
|
1074
|
+
}
|
1075
|
+
getValidators() {
|
1076
|
+
const validators = [];
|
1077
|
+
if (this.formField.required) {
|
1078
|
+
validators.push(this.requireChoiceValidator());
|
1079
|
+
}
|
1080
|
+
return validators;
|
1081
|
+
}
|
1082
|
+
requireChoiceValidator() {
|
1083
|
+
return (control) => {
|
1084
|
+
return control.value !== null && control.value !== undefined
|
1085
|
+
? null
|
1086
|
+
: { requiredChoice: true };
|
1087
|
+
};
|
1088
|
+
}
|
1089
|
+
getErrorMessage() {
|
1090
|
+
const control = this.formGroup.get(this.formField.name);
|
1091
|
+
if (control?.errors?.['requiredChoice'] && !control?.dirty) {
|
1092
|
+
return this.formField.errorText || `${this.formField.label} is required`;
|
1093
|
+
}
|
1094
|
+
return '';
|
1095
|
+
}
|
1096
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTSwitchInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
1097
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: PTSwitchInputComponent, selector: "pt-switch-input", inputs: { formGroup: "formGroup", formField: "formField" }, ngImport: i0, template: "<div\n [formGroup]=\"formGroup\"\n class=\"form-field\"\n [ngStyle]=\"{ width: formField.width || '100%' }\"\n *ngIf=\"!formField.hidden\"\n>\n <div class=\"switch-container\" style=\"display: flex; align-items: center\">\n <p-inputSwitch [formControlName]=\"formField.name\"></p-inputSwitch>\n <label *ngIf=\"formField.label\" style=\"margin-left: 8px\">{{\n formField.label\n }}</label>\n </div>\n <div\n *ngIf=\"\n formGroup.get(formField.name)?.errors &&\n (formGroup.get(formField.name)?.touched ||\n formGroup.get(formField.name)?.dirty)\n \"\n class=\"error-container\"\n >\n <small class=\"p-error\">{{ getErrorMessage() }}</small>\n </div>\n</div>\n", styles: [".switch-container{display:flex;align-items:center}.error-container{margin-top:5px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i3$4.InputSwitch, selector: "p-inputSwitch", inputs: ["style", "styleClass", "tabindex", "inputId", "name", "disabled", "readonly", "trueValue", "falseValue", "ariaLabel", "ariaLabelledBy", "autofocus"], outputs: ["onChange"] }] }); }
|
1098
|
+
}
|
1099
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTSwitchInputComponent, decorators: [{
|
1100
|
+
type: Component,
|
1101
|
+
args: [{ selector: 'pt-switch-input', template: "<div\n [formGroup]=\"formGroup\"\n class=\"form-field\"\n [ngStyle]=\"{ width: formField.width || '100%' }\"\n *ngIf=\"!formField.hidden\"\n>\n <div class=\"switch-container\" style=\"display: flex; align-items: center\">\n <p-inputSwitch [formControlName]=\"formField.name\"></p-inputSwitch>\n <label *ngIf=\"formField.label\" style=\"margin-left: 8px\">{{\n formField.label\n }}</label>\n </div>\n <div\n *ngIf=\"\n formGroup.get(formField.name)?.errors &&\n (formGroup.get(formField.name)?.touched ||\n formGroup.get(formField.name)?.dirty)\n \"\n class=\"error-container\"\n >\n <small class=\"p-error\">{{ getErrorMessage() }}</small>\n </div>\n</div>\n", styles: [".switch-container{display:flex;align-items:center}.error-container{margin-top:5px}\n"] }]
|
1102
|
+
}], propDecorators: { formGroup: [{
|
1103
|
+
type: Input
|
1104
|
+
}], formField: [{
|
1105
|
+
type: Input
|
1106
|
+
}] } });
|
1107
|
+
|
1108
|
+
class PTTextAreaInputComponent {
|
1109
|
+
constructor() {
|
1110
|
+
this.characterCount = 0;
|
1111
|
+
}
|
1112
|
+
ngOnInit() {
|
1113
|
+
this.setupControl();
|
1114
|
+
}
|
1115
|
+
setupControl() {
|
1116
|
+
const control = this.formGroup.get(this.formField.name);
|
1117
|
+
if (control) {
|
1118
|
+
const validators = this.getValidators();
|
1119
|
+
control.setValidators(validators);
|
1120
|
+
// Manage the disabled state here
|
1121
|
+
setTimeout(() => {
|
1122
|
+
if (this.formField.disabled) {
|
1123
|
+
control.disable();
|
1124
|
+
}
|
1125
|
+
else {
|
1126
|
+
control.enable();
|
1127
|
+
}
|
1128
|
+
control.updateValueAndValidity();
|
1129
|
+
});
|
1130
|
+
// Subscribe to value changes to update character count
|
1131
|
+
control.valueChanges.subscribe((value) => {
|
1132
|
+
this.characterCount = value ? value.length : 0;
|
1133
|
+
});
|
1134
|
+
}
|
1135
|
+
}
|
1136
|
+
getValidators() {
|
1137
|
+
const validators = [];
|
1138
|
+
if (this.formField.required) {
|
1139
|
+
validators.push(Validators.required);
|
1140
|
+
}
|
1141
|
+
if (this.formField.minLength !== undefined) {
|
1142
|
+
validators.push(Validators.minLength(this.formField.minLength));
|
1143
|
+
}
|
1144
|
+
if (this.formField.maxLength !== undefined) {
|
1145
|
+
validators.push(Validators.maxLength(this.formField.maxLength));
|
1146
|
+
}
|
1147
|
+
if (this.formField.inputValidation) {
|
1148
|
+
validators.push(this.validateWithInputValidation(this.formField.inputValidation));
|
1149
|
+
}
|
1150
|
+
return validators;
|
1151
|
+
}
|
1152
|
+
validateWithInputValidation(inputValidation) {
|
1153
|
+
return Validators.pattern(new RegExp(inputValidation));
|
1154
|
+
}
|
1155
|
+
getErrorMessage() {
|
1156
|
+
const control = this.formGroup.get(this.formField.name);
|
1157
|
+
if (control?.hasError('required')) {
|
1158
|
+
return this.formField.errorText || `${this.formField.label} is required`;
|
1159
|
+
}
|
1160
|
+
else if (control?.hasError('minlength')) {
|
1161
|
+
return `${this.formField.label} must be at least ${this.formField.minLength} characters long`;
|
1162
|
+
}
|
1163
|
+
else if (control?.hasError('maxlength')) {
|
1164
|
+
return `${this.formField.label} must be at most ${this.formField.maxLength} characters long`;
|
1165
|
+
}
|
1166
|
+
else if (control?.hasError('pattern')) {
|
1167
|
+
return `${this.formField.label} is invalid`;
|
1168
|
+
}
|
1169
|
+
return '';
|
1170
|
+
}
|
1171
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTTextAreaInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
1172
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: PTTextAreaInputComponent, selector: "pt-text-area-input", inputs: { formGroup: "formGroup", formField: "formField" }, ngImport: i0, template: "<div\n [formGroup]=\"formGroup\"\n *ngIf=\"!formField.hidden\"\n class=\"form-field\"\n [ngStyle]=\"{ width: formField.width || '100%' }\"\n>\n <label *ngIf=\"formField.label\">{{ formField.label }}</label>\n <p-inputGroup>\n <ng-container\n *ngIf=\"!formField.iconPosition || formField.iconPosition === 'left'\"\n >\n <p-inputGroupAddon *ngIf=\"formField.iconClass\">\n <i *ngIf=\"formField.iconClass\" [ngClass]=\"formField.iconClass\"></i>\n </p-inputGroupAddon>\n <textarea\n pInputTextarea\n [formControlName]=\"formField.name\"\n [rows]=\"formField.rows || 5\"\n [cols]=\"formField.cols || 30\"\n [autoResize]=\"formField.autoResize || false\"\n [attr.minlength]=\"formField.minLength\"\n [attr.maxlength]=\"formField.maxLength\"\n [placeholder]=\"formField.placeholder || ''\"\n ></textarea>\n </ng-container>\n <ng-container *ngIf=\"formField.iconPosition === 'right'\">\n <textarea\n pInputTextarea\n [formControlName]=\"formField.name\"\n [rows]=\"formField.rows || 5\"\n [cols]=\"formField.cols || 30\"\n [autoResize]=\"formField.autoResize || false\"\n [attr.minlength]=\"formField.minLength\"\n [attr.maxlength]=\"formField.maxLength\"\n [placeholder]=\"formField.placeholder || ''\"\n ></textarea>\n <p-inputGroupAddon *ngIf=\"formField.iconClass\">\n <i *ngIf=\"formField.iconClass\" [ngClass]=\"formField.iconClass\"></i>\n </p-inputGroupAddon>\n </ng-container>\n </p-inputGroup>\n <div class=\"form-info-row\">\n <small\n *ngIf=\"\n formGroup.get(formField.name)?.invalid &&\n formGroup.get(formField.name)?.touched\n \"\n class=\"p-error\"\n >\n {{ getErrorMessage() }}\n </small>\n <div class=\"spacer\"></div>\n <!-- Spacer to ensure alignment -->\n <div\n *ngIf=\"!formField.disabled && formField.maxLength !== undefined\"\n class=\"character-counter\"\n >\n {{ characterCount }}/{{ formField.maxLength }} characters\n </div>\n </div>\n</div>\n", styles: [".form-field{position:relative;margin-bottom:2rem}.form-field label{display:block;margin-bottom:.5rem;font-weight:700;font-size:1rem}.form-info-row{display:flex;justify-content:space-between;align-items:center;margin-top:.5rem}.spacer{flex-grow:1}.character-counter{font-size:.8rem;color:#888;text-align:right;margin-left:auto}.p-error{font-size:.8rem;color:#f44336}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2$1.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: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3$5.InputTextarea, selector: "[pInputTextarea]", inputs: ["autoResize", "variant"], outputs: ["onResize"] }, { kind: "component", type: i3$3.InputGroup, selector: "p-inputGroup", inputs: ["style", "styleClass"] }, { kind: "component", type: i4$1.InputGroupAddon, selector: "p-inputGroupAddon", inputs: ["style", "styleClass"] }] }); }
|
1173
|
+
}
|
1174
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTTextAreaInputComponent, decorators: [{
|
1175
|
+
type: Component,
|
1176
|
+
args: [{ selector: 'pt-text-area-input', template: "<div\n [formGroup]=\"formGroup\"\n *ngIf=\"!formField.hidden\"\n class=\"form-field\"\n [ngStyle]=\"{ width: formField.width || '100%' }\"\n>\n <label *ngIf=\"formField.label\">{{ formField.label }}</label>\n <p-inputGroup>\n <ng-container\n *ngIf=\"!formField.iconPosition || formField.iconPosition === 'left'\"\n >\n <p-inputGroupAddon *ngIf=\"formField.iconClass\">\n <i *ngIf=\"formField.iconClass\" [ngClass]=\"formField.iconClass\"></i>\n </p-inputGroupAddon>\n <textarea\n pInputTextarea\n [formControlName]=\"formField.name\"\n [rows]=\"formField.rows || 5\"\n [cols]=\"formField.cols || 30\"\n [autoResize]=\"formField.autoResize || false\"\n [attr.minlength]=\"formField.minLength\"\n [attr.maxlength]=\"formField.maxLength\"\n [placeholder]=\"formField.placeholder || ''\"\n ></textarea>\n </ng-container>\n <ng-container *ngIf=\"formField.iconPosition === 'right'\">\n <textarea\n pInputTextarea\n [formControlName]=\"formField.name\"\n [rows]=\"formField.rows || 5\"\n [cols]=\"formField.cols || 30\"\n [autoResize]=\"formField.autoResize || false\"\n [attr.minlength]=\"formField.minLength\"\n [attr.maxlength]=\"formField.maxLength\"\n [placeholder]=\"formField.placeholder || ''\"\n ></textarea>\n <p-inputGroupAddon *ngIf=\"formField.iconClass\">\n <i *ngIf=\"formField.iconClass\" [ngClass]=\"formField.iconClass\"></i>\n </p-inputGroupAddon>\n </ng-container>\n </p-inputGroup>\n <div class=\"form-info-row\">\n <small\n *ngIf=\"\n formGroup.get(formField.name)?.invalid &&\n formGroup.get(formField.name)?.touched\n \"\n class=\"p-error\"\n >\n {{ getErrorMessage() }}\n </small>\n <div class=\"spacer\"></div>\n <!-- Spacer to ensure alignment -->\n <div\n *ngIf=\"!formField.disabled && formField.maxLength !== undefined\"\n class=\"character-counter\"\n >\n {{ characterCount }}/{{ formField.maxLength }} characters\n </div>\n </div>\n</div>\n", styles: [".form-field{position:relative;margin-bottom:2rem}.form-field label{display:block;margin-bottom:.5rem;font-weight:700;font-size:1rem}.form-info-row{display:flex;justify-content:space-between;align-items:center;margin-top:.5rem}.spacer{flex-grow:1}.character-counter{font-size:.8rem;color:#888;text-align:right;margin-left:auto}.p-error{font-size:.8rem;color:#f44336}\n"] }]
|
1177
|
+
}], propDecorators: { formGroup: [{
|
1178
|
+
type: Input
|
1179
|
+
}], formField: [{
|
1180
|
+
type: Input
|
1181
|
+
}] } });
|
1182
|
+
|
1183
|
+
class PTTextInputComponent {
|
1184
|
+
constructor() {
|
1185
|
+
this.characterCount = 0;
|
1186
|
+
}
|
1187
|
+
ngOnInit() {
|
1188
|
+
this.setupControl();
|
1189
|
+
this.updateCharacterCount();
|
1190
|
+
}
|
1191
|
+
setupControl() {
|
1192
|
+
const control = this.formGroup.get(this.formField.name);
|
1193
|
+
if (control) {
|
1194
|
+
const validators = this.getValidators();
|
1195
|
+
control.setValidators(validators);
|
1196
|
+
setTimeout(() => {
|
1197
|
+
if (this.formField.disabled) {
|
1198
|
+
control.disable({ emitEvent: false });
|
1199
|
+
}
|
1200
|
+
else {
|
1201
|
+
control.enable({ emitEvent: false });
|
1202
|
+
control.valueChanges.subscribe(() => {
|
1203
|
+
this.updateCharacterCount();
|
1204
|
+
});
|
1205
|
+
}
|
1206
|
+
control.updateValueAndValidity({ emitEvent: false });
|
1207
|
+
});
|
1208
|
+
}
|
1209
|
+
}
|
1210
|
+
updateCharacterCount() {
|
1211
|
+
const control = this.formGroup.get(this.formField.name);
|
1212
|
+
this.characterCount = control.value ? control.value.length : 0;
|
1213
|
+
}
|
1214
|
+
getValidators() {
|
1215
|
+
const validators = [];
|
1216
|
+
if (this.formField.required) {
|
1217
|
+
validators.push(Validators.required);
|
1218
|
+
}
|
1219
|
+
if (this.formField.minLength !== undefined) {
|
1220
|
+
validators.push(Validators.minLength(this.formField.minLength));
|
1221
|
+
}
|
1222
|
+
if (this.formField.maxLength !== undefined) {
|
1223
|
+
validators.push(Validators.maxLength(this.formField.maxLength));
|
1224
|
+
}
|
1225
|
+
if (this.formField.inputValidation) {
|
1226
|
+
validators.push(this.validateWithInputValidation(this.formField.inputValidation));
|
1227
|
+
}
|
1228
|
+
return validators;
|
1229
|
+
}
|
1230
|
+
validateWithInputValidation(inputValidation) {
|
1231
|
+
return Validators.pattern(new RegExp(inputValidation));
|
1232
|
+
}
|
1233
|
+
getErrorMessage() {
|
1234
|
+
const control = this.formGroup.get(this.formField.name);
|
1235
|
+
if (control?.hasError('required')) {
|
1236
|
+
return `${this.formField.label} is required`;
|
1237
|
+
}
|
1238
|
+
else if (control?.hasError('minlength')) {
|
1239
|
+
return `${this.formField.label} must be at least ${this.formField.minLength} characters`;
|
1240
|
+
}
|
1241
|
+
else if (control?.hasError('maxlength')) {
|
1242
|
+
return `${this.formField.label} must be at most ${this.formField.maxLength} characters`;
|
1243
|
+
}
|
1244
|
+
else if (control?.hasError('pattern')) {
|
1245
|
+
return `${this.formField.label} is invalid`;
|
1246
|
+
}
|
1247
|
+
return '';
|
1248
|
+
}
|
1249
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTTextInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
1250
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: PTTextInputComponent, selector: "pt-text-input", inputs: { formGroup: "formGroup", formField: "formField" }, ngImport: i0, template: "<div\n [formGroup]=\"formGroup\"\n class=\"form-field\"\n [ngStyle]=\"{ width: formField.width || '100%' }\"\n *ngIf=\"!formField.hidden\"\n>\n <label *ngIf=\"formField.label\">{{ formField.label }}</label>\n <ng-container *ngIf=\"formField.iconClass; else noIcon\">\n <p-iconField [iconPosition]=\"formField.iconPosition || 'left'\">\n <p-inputIcon\n *ngIf=\"formField.iconClass\"\n [styleClass]=\"formField.iconClass\"\n ></p-inputIcon>\n <input\n type=\"text\"\n pInputText\n [formControlName]=\"formField.name\"\n [placeholder]=\"formField.placeholder ?? ''\"\n [attr.minlength]=\"formField.minLength\"\n [attr.maxlength]=\"formField.maxLength\"\n />\n </p-iconField>\n </ng-container>\n <ng-template #noIcon>\n <input\n type=\"text\"\n pInputText\n [formControlName]=\"formField.name\"\n [placeholder]=\"formField.placeholder ?? ''\"\n [attr.minlength]=\"formField.minLength\"\n [attr.maxlength]=\"formField.maxLength\"\n [ngStyle]=\"{ width: '100%' }\"\n />\n </ng-template>\n <div class=\"form-info-row\">\n <small\n *ngIf=\"\n formGroup.get(formField.name)?.invalid &&\n formGroup.get(formField.name)?.touched\n \"\n class=\"p-error\"\n >\n {{ getErrorMessage() }}\n </small>\n <div class=\"spacer\"></div>\n <!-- Spacer to maintain right alignment -->\n <div\n *ngIf=\"!formField.disabled && formField.maxLength !== undefined\"\n class=\"character-counter\"\n >\n {{ characterCount }}/{{ formField.maxLength }} characters\n </div>\n </div>\n</div>\n", styles: [".form-field{position:relative;margin-bottom:2rem}.form-field label{display:block;margin-bottom:.5rem;font-weight:700;font-size:1rem}.form-info-row{display:flex;justify-content:space-between;align-items:center;margin-top:.5rem}.spacer{flex-grow:1}.character-counter{font-size:.8rem;color:#888;text-align:right;margin-left:auto}.p-error{font-size:.8rem;color:#f44336}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2$1.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: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i4.InputText, selector: "[pInputText]", inputs: ["variant"] }, { kind: "component", type: i10.IconField, selector: "p-iconField", inputs: ["iconPosition"] }, { kind: "component", type: i11.InputIcon, selector: "p-inputIcon", inputs: ["styleClass"] }] }); }
|
1251
|
+
}
|
1252
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTTextInputComponent, decorators: [{
|
1253
|
+
type: Component,
|
1254
|
+
args: [{ selector: 'pt-text-input', template: "<div\n [formGroup]=\"formGroup\"\n class=\"form-field\"\n [ngStyle]=\"{ width: formField.width || '100%' }\"\n *ngIf=\"!formField.hidden\"\n>\n <label *ngIf=\"formField.label\">{{ formField.label }}</label>\n <ng-container *ngIf=\"formField.iconClass; else noIcon\">\n <p-iconField [iconPosition]=\"formField.iconPosition || 'left'\">\n <p-inputIcon\n *ngIf=\"formField.iconClass\"\n [styleClass]=\"formField.iconClass\"\n ></p-inputIcon>\n <input\n type=\"text\"\n pInputText\n [formControlName]=\"formField.name\"\n [placeholder]=\"formField.placeholder ?? ''\"\n [attr.minlength]=\"formField.minLength\"\n [attr.maxlength]=\"formField.maxLength\"\n />\n </p-iconField>\n </ng-container>\n <ng-template #noIcon>\n <input\n type=\"text\"\n pInputText\n [formControlName]=\"formField.name\"\n [placeholder]=\"formField.placeholder ?? ''\"\n [attr.minlength]=\"formField.minLength\"\n [attr.maxlength]=\"formField.maxLength\"\n [ngStyle]=\"{ width: '100%' }\"\n />\n </ng-template>\n <div class=\"form-info-row\">\n <small\n *ngIf=\"\n formGroup.get(formField.name)?.invalid &&\n formGroup.get(formField.name)?.touched\n \"\n class=\"p-error\"\n >\n {{ getErrorMessage() }}\n </small>\n <div class=\"spacer\"></div>\n <!-- Spacer to maintain right alignment -->\n <div\n *ngIf=\"!formField.disabled && formField.maxLength !== undefined\"\n class=\"character-counter\"\n >\n {{ characterCount }}/{{ formField.maxLength }} characters\n </div>\n </div>\n</div>\n", styles: [".form-field{position:relative;margin-bottom:2rem}.form-field label{display:block;margin-bottom:.5rem;font-weight:700;font-size:1rem}.form-info-row{display:flex;justify-content:space-between;align-items:center;margin-top:.5rem}.spacer{flex-grow:1}.character-counter{font-size:.8rem;color:#888;text-align:right;margin-left:auto}.p-error{font-size:.8rem;color:#f44336}\n"] }]
|
1255
|
+
}], propDecorators: { formGroup: [{
|
1256
|
+
type: Input
|
1257
|
+
}], formField: [{
|
1258
|
+
type: Input
|
1259
|
+
}] } });
|
1260
|
+
|
1261
|
+
class PTDropdownComponent {
|
1262
|
+
ngOnInit() {
|
1263
|
+
this.setupControl();
|
1264
|
+
}
|
1265
|
+
setupControl() {
|
1266
|
+
let control = this.formGroup.get(this.formField.name);
|
1267
|
+
if (!control) {
|
1268
|
+
control = new FormControl(this.formField.value || null);
|
1269
|
+
this.formGroup.addControl(this.formField.name, control);
|
1270
|
+
}
|
1271
|
+
const validators = this.getValidators();
|
1272
|
+
control.setValidators(validators);
|
1273
|
+
// Manage the disabled state using form control
|
1274
|
+
setTimeout(() => {
|
1275
|
+
if (this.formField.disabled !== undefined) {
|
1276
|
+
if (this.formField.disabled) {
|
1277
|
+
control.disable({ emitEvent: false });
|
1278
|
+
}
|
1279
|
+
else {
|
1280
|
+
control.enable({ emitEvent: false });
|
1281
|
+
}
|
1282
|
+
}
|
1283
|
+
control.updateValueAndValidity({ emitEvent: false });
|
1284
|
+
});
|
1285
|
+
}
|
1286
|
+
getValidators() {
|
1287
|
+
const validators = [];
|
1288
|
+
if (this.formField.required) {
|
1289
|
+
validators.push(Validators.required);
|
1290
|
+
}
|
1291
|
+
return validators;
|
1292
|
+
}
|
1293
|
+
getErrorMessage() {
|
1294
|
+
const control = this.formGroup.get(this.formField.name);
|
1295
|
+
if (control?.hasError('required')) {
|
1296
|
+
return this.formField.errorText || `${this.formField.label} is required`;
|
1297
|
+
}
|
1298
|
+
return '';
|
1299
|
+
}
|
1300
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
1301
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: PTDropdownComponent, selector: "pt-dropdown", inputs: { formGroup: "formGroup", formField: "formField" }, ngImport: i0, template: "<div\n [formGroup]=\"formGroup\"\n class=\"form-field\"\n [ngStyle]=\"{ width: formField.width || '100%' }\"\n *ngIf=\"!formField.hidden\"\n>\n <label *ngIf=\"formField.label\">{{ formField.label }}</label>\n <p-dropdown\n [formControlName]=\"formField.name\"\n [options]=\"formField.options\"\n [placeholder]=\"formField.placeholder || 'Select an option'\"\n optionLabel=\"label\"\n ></p-dropdown>\n <div\n *ngIf=\"\n formGroup.get(formField.name)?.invalid &&\n formGroup.get(formField.name)?.touched\n \"\n >\n <small class=\"p-error\">{{ getErrorMessage() }}</small>\n </div>\n</div>\n", styles: [".form-field{margin-bottom:1rem}.form-field label{display:block;margin-bottom:.5rem;font-weight:700}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i3$6.Dropdown, selector: "p-dropdown", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }] }); }
|
1302
|
+
}
|
1303
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTDropdownComponent, decorators: [{
|
1304
|
+
type: Component,
|
1305
|
+
args: [{ selector: 'pt-dropdown', template: "<div\n [formGroup]=\"formGroup\"\n class=\"form-field\"\n [ngStyle]=\"{ width: formField.width || '100%' }\"\n *ngIf=\"!formField.hidden\"\n>\n <label *ngIf=\"formField.label\">{{ formField.label }}</label>\n <p-dropdown\n [formControlName]=\"formField.name\"\n [options]=\"formField.options\"\n [placeholder]=\"formField.placeholder || 'Select an option'\"\n optionLabel=\"label\"\n ></p-dropdown>\n <div\n *ngIf=\"\n formGroup.get(formField.name)?.invalid &&\n formGroup.get(formField.name)?.touched\n \"\n >\n <small class=\"p-error\">{{ getErrorMessage() }}</small>\n </div>\n</div>\n", styles: [".form-field{margin-bottom:1rem}.form-field label{display:block;margin-bottom:.5rem;font-weight:700}\n"] }]
|
1306
|
+
}], propDecorators: { formGroup: [{
|
1307
|
+
type: Input
|
1308
|
+
}], formField: [{
|
1309
|
+
type: Input
|
1310
|
+
}] } });
|
1311
|
+
|
1312
|
+
class PTMultiSelectComponent {
|
1313
|
+
ngOnInit() {
|
1314
|
+
this.setupControl();
|
1315
|
+
}
|
1316
|
+
setupControl() {
|
1317
|
+
let control = this.formGroup.get(this.formField.name);
|
1318
|
+
if (!control) {
|
1319
|
+
control = new FormControl(this.formField.value || []);
|
1320
|
+
this.formGroup.addControl(this.formField.name, control);
|
1321
|
+
}
|
1322
|
+
const validators = this.getValidators();
|
1323
|
+
control.setValidators(validators);
|
1324
|
+
// Manage the disabled state using form control
|
1325
|
+
setTimeout(() => {
|
1326
|
+
if (this.formField.disabled !== undefined) {
|
1327
|
+
if (this.formField.disabled) {
|
1328
|
+
control.disable({ emitEvent: false });
|
1329
|
+
}
|
1330
|
+
else {
|
1331
|
+
control.enable({ emitEvent: false });
|
1332
|
+
}
|
1333
|
+
}
|
1334
|
+
control.updateValueAndValidity({ emitEvent: false });
|
1335
|
+
});
|
1336
|
+
}
|
1337
|
+
getValidators() {
|
1338
|
+
const validators = [];
|
1339
|
+
if (this.formField.required) {
|
1340
|
+
validators.push(Validators.required);
|
1341
|
+
}
|
1342
|
+
return validators;
|
1343
|
+
}
|
1344
|
+
getErrorMessage() {
|
1345
|
+
const control = this.formGroup.get(this.formField.name);
|
1346
|
+
if (control?.hasError('required')) {
|
1347
|
+
return this.formField.errorText || `${this.formField.label} is required`;
|
1348
|
+
}
|
1349
|
+
return '';
|
1350
|
+
}
|
1351
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTMultiSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
1352
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: PTMultiSelectComponent, selector: "pt-multi-select", inputs: { formGroup: "formGroup", formField: "formField" }, ngImport: i0, template: "<div\n [formGroup]=\"formGroup\"\n class=\"form-field\"\n [ngStyle]=\"{ width: formField.width || '100%' }\"\n *ngIf=\"!formField.hidden\"\n>\n <label *ngIf=\"formField.label\">{{ formField.label }}</label>\n <p-multiSelect\n [formControlName]=\"formField.name\"\n [options]=\"formField.options\"\n [placeholder]=\"formField.placeholder || 'Select options'\"\n optionLabel=\"label\"\n ></p-multiSelect>\n <div\n *ngIf=\"\n formGroup.get(formField.name)?.invalid &&\n formGroup.get(formField.name)?.touched\n \"\n >\n <small class=\"p-error\">{{ getErrorMessage() }}</small>\n </div>\n</div>\n", styles: [".form-field{margin-bottom:1rem}.form-field label{display:block;margin-bottom:.5rem;font-weight:700}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { 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"] }] }); }
|
1353
|
+
}
|
1354
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTMultiSelectComponent, decorators: [{
|
1355
|
+
type: Component,
|
1356
|
+
args: [{ selector: 'pt-multi-select', template: "<div\n [formGroup]=\"formGroup\"\n class=\"form-field\"\n [ngStyle]=\"{ width: formField.width || '100%' }\"\n *ngIf=\"!formField.hidden\"\n>\n <label *ngIf=\"formField.label\">{{ formField.label }}</label>\n <p-multiSelect\n [formControlName]=\"formField.name\"\n [options]=\"formField.options\"\n [placeholder]=\"formField.placeholder || 'Select options'\"\n optionLabel=\"label\"\n ></p-multiSelect>\n <div\n *ngIf=\"\n formGroup.get(formField.name)?.invalid &&\n formGroup.get(formField.name)?.touched\n \"\n >\n <small class=\"p-error\">{{ getErrorMessage() }}</small>\n </div>\n</div>\n", styles: [".form-field{margin-bottom:1rem}.form-field label{display:block;margin-bottom:.5rem;font-weight:700}\n"] }]
|
1357
|
+
}], propDecorators: { formGroup: [{
|
1358
|
+
type: Input
|
1359
|
+
}], formField: [{
|
1360
|
+
type: Input
|
1361
|
+
}] } });
|
1362
|
+
|
1363
|
+
class PTDynamicFormFieldComponent {
|
1364
|
+
constructor() {
|
1365
|
+
this.FormInputTypeEnum = FormInputTypeEnum;
|
1366
|
+
}
|
1367
|
+
asTextField(field) {
|
1368
|
+
return field;
|
1369
|
+
}
|
1370
|
+
asNumberField(field) {
|
1371
|
+
return field;
|
1372
|
+
}
|
1373
|
+
asTextAreaField(field) {
|
1374
|
+
return field;
|
1375
|
+
}
|
1376
|
+
asDateField(field) {
|
1377
|
+
return field;
|
1378
|
+
}
|
1379
|
+
asSelectField(field) {
|
1380
|
+
return field;
|
1381
|
+
}
|
1382
|
+
asMultiSelectField(field) {
|
1383
|
+
return field;
|
1384
|
+
}
|
1385
|
+
asCheckboxField(field) {
|
1386
|
+
return field;
|
1387
|
+
}
|
1388
|
+
asSwitchField(field) {
|
1389
|
+
return field;
|
1390
|
+
}
|
1391
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTDynamicFormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
1392
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: PTDynamicFormFieldComponent, selector: "pt-dynamic-form-field", inputs: { field: "field", form: "form", inputWidth: "inputWidth" }, ngImport: i0, template: "<div\n [formGroup]=\"form\"\n class=\"form-field\"\n [ngStyle]=\"{\n width:\n field.type !== FormInputTypeEnum.CHECKBOX &&\n field.type !== FormInputTypeEnum.SWITCH\n ? field.width || inputWidth\n : 'auto'\n }\"\n>\n <ng-container [ngSwitch]=\"field.type\">\n <pt-text-input\n *ngSwitchCase=\"FormInputTypeEnum.TEXT\"\n [formGroup]=\"form\"\n [formField]=\"asTextField(field)\"\n ></pt-text-input>\n <pt-number-input\n *ngSwitchCase=\"FormInputTypeEnum.NUMBER\"\n [formGroup]=\"form\"\n [formField]=\"asNumberField(field)\"\n ></pt-number-input>\n <pt-number-input\n *ngSwitchCase=\"FormInputTypeEnum.AMOUNT\"\n [formGroup]=\"form\"\n [formField]=\"asNumberField(field)\"\n ></pt-number-input>\n <pt-text-area-input\n *ngSwitchCase=\"FormInputTypeEnum.TEXTAREA\"\n [formGroup]=\"form\"\n [formField]=\"asTextAreaField(field)\"\n ></pt-text-area-input>\n <pt-date-input\n *ngSwitchCase=\"FormInputTypeEnum.DATE\"\n [formGroup]=\"form\"\n [formField]=\"asDateField(field)\"\n ></pt-date-input>\n <pt-multi-select\n *ngSwitchCase=\"FormInputTypeEnum.MULTISELECT\"\n [formGroup]=\"form\"\n [formField]=\"asMultiSelectField(field)\"\n ></pt-multi-select>\n <pt-dropdown\n *ngSwitchCase=\"FormInputTypeEnum.SELECT\"\n [formGroup]=\"form\"\n [formField]=\"asSelectField(field)\"\n ></pt-dropdown>\n <pt-check-box-input\n *ngSwitchCase=\"FormInputTypeEnum.CHECKBOX\"\n [formGroup]=\"form\"\n [formField]=\"asCheckboxField(field)\"\n ></pt-check-box-input>\n <pt-switch-input\n *ngSwitchCase=\"FormInputTypeEnum.SWITCH\"\n [formGroup]=\"form\"\n [formField]=\"asSwitchField(field)\"\n ></pt-switch-input>\n </ng-container>\n</div>\n", styles: [".form-field{margin-bottom:1rem}.form-field label{display:block;margin-bottom:.5rem;font-weight:700}\n"], dependencies: [{ 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: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: PTCheckBoxInputComponent, selector: "pt-check-box-input", inputs: ["formGroup", "formField"] }, { kind: "component", type: PTDateInputComponent, selector: "pt-date-input", inputs: ["formGroup", "formField"] }, { kind: "component", type: PTNumberInputComponent, selector: "pt-number-input", inputs: ["formGroup", "formField"] }, { kind: "component", type: PTSwitchInputComponent, selector: "pt-switch-input", inputs: ["formGroup", "formField"] }, { kind: "component", type: PTTextAreaInputComponent, selector: "pt-text-area-input", inputs: ["formGroup", "formField"] }, { kind: "component", type: PTTextInputComponent, selector: "pt-text-input", inputs: ["formGroup", "formField"] }, { kind: "component", type: PTDropdownComponent, selector: "pt-dropdown", inputs: ["formGroup", "formField"] }, { kind: "component", type: PTMultiSelectComponent, selector: "pt-multi-select", inputs: ["formGroup", "formField"] }] }); }
|
1393
|
+
}
|
1394
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTDynamicFormFieldComponent, decorators: [{
|
1395
|
+
type: Component,
|
1396
|
+
args: [{ selector: 'pt-dynamic-form-field', template: "<div\n [formGroup]=\"form\"\n class=\"form-field\"\n [ngStyle]=\"{\n width:\n field.type !== FormInputTypeEnum.CHECKBOX &&\n field.type !== FormInputTypeEnum.SWITCH\n ? field.width || inputWidth\n : 'auto'\n }\"\n>\n <ng-container [ngSwitch]=\"field.type\">\n <pt-text-input\n *ngSwitchCase=\"FormInputTypeEnum.TEXT\"\n [formGroup]=\"form\"\n [formField]=\"asTextField(field)\"\n ></pt-text-input>\n <pt-number-input\n *ngSwitchCase=\"FormInputTypeEnum.NUMBER\"\n [formGroup]=\"form\"\n [formField]=\"asNumberField(field)\"\n ></pt-number-input>\n <pt-number-input\n *ngSwitchCase=\"FormInputTypeEnum.AMOUNT\"\n [formGroup]=\"form\"\n [formField]=\"asNumberField(field)\"\n ></pt-number-input>\n <pt-text-area-input\n *ngSwitchCase=\"FormInputTypeEnum.TEXTAREA\"\n [formGroup]=\"form\"\n [formField]=\"asTextAreaField(field)\"\n ></pt-text-area-input>\n <pt-date-input\n *ngSwitchCase=\"FormInputTypeEnum.DATE\"\n [formGroup]=\"form\"\n [formField]=\"asDateField(field)\"\n ></pt-date-input>\n <pt-multi-select\n *ngSwitchCase=\"FormInputTypeEnum.MULTISELECT\"\n [formGroup]=\"form\"\n [formField]=\"asMultiSelectField(field)\"\n ></pt-multi-select>\n <pt-dropdown\n *ngSwitchCase=\"FormInputTypeEnum.SELECT\"\n [formGroup]=\"form\"\n [formField]=\"asSelectField(field)\"\n ></pt-dropdown>\n <pt-check-box-input\n *ngSwitchCase=\"FormInputTypeEnum.CHECKBOX\"\n [formGroup]=\"form\"\n [formField]=\"asCheckboxField(field)\"\n ></pt-check-box-input>\n <pt-switch-input\n *ngSwitchCase=\"FormInputTypeEnum.SWITCH\"\n [formGroup]=\"form\"\n [formField]=\"asSwitchField(field)\"\n ></pt-switch-input>\n </ng-container>\n</div>\n", styles: [".form-field{margin-bottom:1rem}.form-field label{display:block;margin-bottom:.5rem;font-weight:700}\n"] }]
|
1397
|
+
}], propDecorators: { field: [{
|
1398
|
+
type: Input
|
1399
|
+
}], form: [{
|
1400
|
+
type: Input
|
1401
|
+
}], inputWidth: [{
|
1402
|
+
type: Input
|
1403
|
+
}] } });
|
1404
|
+
|
1405
|
+
class PTFormBuilderComponent {
|
1406
|
+
constructor(fb) {
|
1407
|
+
this.fb = fb;
|
1408
|
+
this.mainGroup = { fields: [], groups: [] };
|
1409
|
+
this.buttons = [];
|
1410
|
+
this.inputWidth = '100%';
|
1411
|
+
this.language = 'en';
|
1412
|
+
this.formSubmit = new EventEmitter();
|
1413
|
+
this.FormInputTypeEnum = FormInputTypeEnum;
|
1414
|
+
this.errorMessages = {
|
1415
|
+
en: {
|
1416
|
+
required: 'is required',
|
1417
|
+
},
|
1418
|
+
fr: {
|
1419
|
+
required: 'est requis',
|
1420
|
+
},
|
1421
|
+
};
|
1422
|
+
this.form = this.fb.group({});
|
1423
|
+
}
|
1424
|
+
ngOnInit() {
|
1425
|
+
this.buildFormGroup(this.mainGroup);
|
1426
|
+
}
|
1427
|
+
buildFormGroup(group) {
|
1428
|
+
group.fields?.forEach((field) => {
|
1429
|
+
const validators = field.required ? [Validators.required] : [];
|
1430
|
+
this.form.addControl(field.name, this.fb.control(field.value, validators));
|
1431
|
+
});
|
1432
|
+
group.groups?.forEach((subGroup) => {
|
1433
|
+
this.buildFormGroup(subGroup);
|
1434
|
+
});
|
1435
|
+
}
|
1436
|
+
getErrorMessage(field) {
|
1437
|
+
if (this.form.get(field.name)?.hasError('required')) {
|
1438
|
+
return (field.errorText ||
|
1439
|
+
`${field.label} ${this.errorMessages[this.language].required}`);
|
1440
|
+
}
|
1441
|
+
return '';
|
1442
|
+
}
|
1443
|
+
onSubmit() {
|
1444
|
+
this.form.markAllAsTouched();
|
1445
|
+
if (this.form.valid) {
|
1446
|
+
this.formSubmit.emit(this.form.value);
|
1447
|
+
}
|
1448
|
+
}
|
1449
|
+
onClear() {
|
1450
|
+
this.form.reset();
|
1451
|
+
}
|
1452
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTFormBuilderComponent, deps: [{ token: i2$1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
1453
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: PTFormBuilderComponent, selector: "pt-form-builder", inputs: { mainGroup: "mainGroup", buttons: "buttons", title: "title", titleStyle: "titleStyle", inputWidth: "inputWidth", language: "language" }, outputs: { formSubmit: "formSubmit" }, ngImport: i0, template: "<div *ngIf=\"title\" [ngStyle]=\"titleStyle\" class=\"form-title\">{{ title }}</div>\n<form [formGroup]=\"form\" (ngSubmit)=\"onSubmit()\">\n <ng-container *ngFor=\"let field of mainGroup.fields\">\n <pt-dynamic-form-field\n [field]=\"field\"\n [form]=\"form\"\n [inputWidth]=\"inputWidth\"\n ></pt-dynamic-form-field>\n </ng-container>\n\n <ng-container *ngFor=\"let group of mainGroup.groups\">\n <div class=\"form-field-group\" [ngStyle]=\"{ width: group.width || '100%' }\">\n <ng-container *ngFor=\"let field of group.fields\">\n <pt-dynamic-form-field\n [field]=\"field\"\n [form]=\"form\"\n class=\"flex-item\"\n ></pt-dynamic-form-field>\n </ng-container>\n </div>\n </ng-container>\n\n <div class=\"button-group\">\n <button\n *ngFor=\"let button of buttons\"\n type=\"button\"\n pButton\n [label]=\"button.text\"\n [icon]=\"button.icon || ''\"\n [class]=\"button.color\"\n (click)=\"\n button.isSubmit\n ? onSubmit()\n : button.isClear\n ? onClear()\n : button.action\n ? button.action()\n : null\n \"\n ></button>\n </div>\n</form>\n", styles: [".form-title{text-align:center;margin-bottom:1rem;font-size:1.5rem;font-weight:700}.form-field{margin-bottom:1rem}.form-field label{display:block;margin-bottom:.5rem;font-weight:700}::ng-deep .p-inputtext,::ng-deep .p-inputtextarea,::ng-deep .p-calendar,::ng-deep .p-inputnumber,::ng-deep .p-multiselect,::ng-deep .p-dropdown{width:100%!important}::ng-deep .p-inputnumber,::ng-deep p-inputnumber{display:flex!important}.button-group{display:flex;gap:1rem;margin-top:1rem;justify-content:space-between}.button-group button{flex:1;display:flex;align-items:center;justify-content:center}.button-group button i{margin-right:.5rem}.button-group button.p-button-primary{background-color:#007bff;color:#fff}.button-group button.p-button-secondary{background-color:#6c757d;color:#fff}.button-group button.p-button-success{background-color:#28a745;color:#fff}.button-group button:hover{opacity:.9}.form-field-group{display:flex;gap:1rem}.form-field-group .flex-item{flex:1}\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: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3$1.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }, { kind: "component", type: PTDynamicFormFieldComponent, selector: "pt-dynamic-form-field", inputs: ["field", "form", "inputWidth"] }] }); }
|
1454
|
+
}
|
1455
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTFormBuilderComponent, decorators: [{
|
1456
|
+
type: Component,
|
1457
|
+
args: [{ selector: 'pt-form-builder', template: "<div *ngIf=\"title\" [ngStyle]=\"titleStyle\" class=\"form-title\">{{ title }}</div>\n<form [formGroup]=\"form\" (ngSubmit)=\"onSubmit()\">\n <ng-container *ngFor=\"let field of mainGroup.fields\">\n <pt-dynamic-form-field\n [field]=\"field\"\n [form]=\"form\"\n [inputWidth]=\"inputWidth\"\n ></pt-dynamic-form-field>\n </ng-container>\n\n <ng-container *ngFor=\"let group of mainGroup.groups\">\n <div class=\"form-field-group\" [ngStyle]=\"{ width: group.width || '100%' }\">\n <ng-container *ngFor=\"let field of group.fields\">\n <pt-dynamic-form-field\n [field]=\"field\"\n [form]=\"form\"\n class=\"flex-item\"\n ></pt-dynamic-form-field>\n </ng-container>\n </div>\n </ng-container>\n\n <div class=\"button-group\">\n <button\n *ngFor=\"let button of buttons\"\n type=\"button\"\n pButton\n [label]=\"button.text\"\n [icon]=\"button.icon || ''\"\n [class]=\"button.color\"\n (click)=\"\n button.isSubmit\n ? onSubmit()\n : button.isClear\n ? onClear()\n : button.action\n ? button.action()\n : null\n \"\n ></button>\n </div>\n</form>\n", styles: [".form-title{text-align:center;margin-bottom:1rem;font-size:1.5rem;font-weight:700}.form-field{margin-bottom:1rem}.form-field label{display:block;margin-bottom:.5rem;font-weight:700}::ng-deep .p-inputtext,::ng-deep .p-inputtextarea,::ng-deep .p-calendar,::ng-deep .p-inputnumber,::ng-deep .p-multiselect,::ng-deep .p-dropdown{width:100%!important}::ng-deep .p-inputnumber,::ng-deep p-inputnumber{display:flex!important}.button-group{display:flex;gap:1rem;margin-top:1rem;justify-content:space-between}.button-group button{flex:1;display:flex;align-items:center;justify-content:center}.button-group button i{margin-right:.5rem}.button-group button.p-button-primary{background-color:#007bff;color:#fff}.button-group button.p-button-secondary{background-color:#6c757d;color:#fff}.button-group button.p-button-success{background-color:#28a745;color:#fff}.button-group button:hover{opacity:.9}.form-field-group{display:flex;gap:1rem}.form-field-group .flex-item{flex:1}\n"] }]
|
1458
|
+
}], ctorParameters: () => [{ type: i2$1.FormBuilder }], propDecorators: { mainGroup: [{
|
1459
|
+
type: Input
|
1460
|
+
}], buttons: [{
|
1461
|
+
type: Input
|
1462
|
+
}], title: [{
|
1463
|
+
type: Input
|
1464
|
+
}], titleStyle: [{
|
1465
|
+
type: Input
|
1466
|
+
}], inputWidth: [{
|
1467
|
+
type: Input
|
1468
|
+
}], language: [{
|
1469
|
+
type: Input
|
1470
|
+
}], formSubmit: [{
|
1471
|
+
type: Output
|
1472
|
+
}] } });
|
1473
|
+
|
1474
|
+
class PTCheckBoxInputModule {
|
1475
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTCheckBoxInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
1476
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: PTCheckBoxInputModule, declarations: [PTCheckBoxInputComponent], imports: [CommonModule, ReactiveFormsModule, CheckboxModule], exports: [PTCheckBoxInputComponent] }); }
|
1477
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTCheckBoxInputModule, imports: [CommonModule, ReactiveFormsModule, CheckboxModule] }); }
|
1478
|
+
}
|
1479
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTCheckBoxInputModule, decorators: [{
|
1480
|
+
type: NgModule,
|
1481
|
+
args: [{
|
1482
|
+
declarations: [PTCheckBoxInputComponent],
|
1483
|
+
imports: [CommonModule, ReactiveFormsModule, CheckboxModule],
|
1484
|
+
exports: [PTCheckBoxInputComponent],
|
1485
|
+
}]
|
1486
|
+
}] });
|
1487
|
+
|
1488
|
+
class PTNumberInputModule {
|
1489
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTNumberInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
1490
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: PTNumberInputModule, declarations: [PTNumberInputComponent], imports: [CommonModule,
|
1491
|
+
ReactiveFormsModule,
|
1492
|
+
FormsModule,
|
1493
|
+
InputGroupModule,
|
1494
|
+
InputGroupAddonModule,
|
1495
|
+
InputTextModule,
|
1496
|
+
InputNumberModule], exports: [PTNumberInputComponent] }); }
|
1497
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTNumberInputModule, imports: [CommonModule,
|
1498
|
+
ReactiveFormsModule,
|
1499
|
+
FormsModule,
|
1500
|
+
InputGroupModule,
|
1501
|
+
InputGroupAddonModule,
|
1502
|
+
InputTextModule,
|
1503
|
+
InputNumberModule] }); }
|
1504
|
+
}
|
1505
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTNumberInputModule, decorators: [{
|
1506
|
+
type: NgModule,
|
1507
|
+
args: [{
|
1508
|
+
declarations: [PTNumberInputComponent],
|
1509
|
+
imports: [
|
1510
|
+
CommonModule,
|
1511
|
+
ReactiveFormsModule,
|
1512
|
+
FormsModule,
|
1513
|
+
InputGroupModule,
|
1514
|
+
InputGroupAddonModule,
|
1515
|
+
InputTextModule,
|
1516
|
+
InputNumberModule,
|
1517
|
+
],
|
1518
|
+
exports: [PTNumberInputComponent],
|
1519
|
+
}]
|
1520
|
+
}] });
|
1521
|
+
|
1522
|
+
class PTSwitchInputModule {
|
1523
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTSwitchInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
1524
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: PTSwitchInputModule, declarations: [PTSwitchInputComponent], imports: [CommonModule, ReactiveFormsModule, InputSwitchModule], exports: [PTSwitchInputComponent] }); }
|
1525
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTSwitchInputModule, imports: [CommonModule, ReactiveFormsModule, InputSwitchModule] }); }
|
1526
|
+
}
|
1527
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTSwitchInputModule, decorators: [{
|
1528
|
+
type: NgModule,
|
1529
|
+
args: [{
|
1530
|
+
declarations: [PTSwitchInputComponent],
|
1531
|
+
imports: [CommonModule, ReactiveFormsModule, InputSwitchModule],
|
1532
|
+
exports: [PTSwitchInputComponent],
|
1533
|
+
}]
|
1534
|
+
}] });
|
1535
|
+
|
1536
|
+
class PTTextInputModule {
|
1537
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTTextInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
1538
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: PTTextInputModule, declarations: [PTTextInputComponent], imports: [CommonModule,
|
1539
|
+
ReactiveFormsModule,
|
1540
|
+
InputTextModule,
|
1541
|
+
IconFieldModule,
|
1542
|
+
InputIconModule], exports: [PTTextInputComponent] }); }
|
1543
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTTextInputModule, imports: [CommonModule,
|
1544
|
+
ReactiveFormsModule,
|
1545
|
+
InputTextModule,
|
1546
|
+
IconFieldModule,
|
1547
|
+
InputIconModule] }); }
|
1548
|
+
}
|
1549
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTTextInputModule, decorators: [{
|
1550
|
+
type: NgModule,
|
1551
|
+
args: [{
|
1552
|
+
declarations: [PTTextInputComponent],
|
1553
|
+
imports: [
|
1554
|
+
CommonModule,
|
1555
|
+
ReactiveFormsModule,
|
1556
|
+
InputTextModule,
|
1557
|
+
IconFieldModule,
|
1558
|
+
InputIconModule,
|
1559
|
+
],
|
1560
|
+
exports: [PTTextInputComponent],
|
1561
|
+
}]
|
1562
|
+
}] });
|
1563
|
+
|
1564
|
+
class PTTextAreaInputModule {
|
1565
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTTextAreaInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
1566
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: PTTextAreaInputModule, declarations: [PTTextAreaInputComponent], imports: [CommonModule,
|
1567
|
+
ReactiveFormsModule,
|
1568
|
+
InputTextareaModule,
|
1569
|
+
InputGroupModule,
|
1570
|
+
InputGroupAddonModule], exports: [PTTextAreaInputComponent] }); }
|
1571
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTTextAreaInputModule, imports: [CommonModule,
|
1572
|
+
ReactiveFormsModule,
|
1573
|
+
InputTextareaModule,
|
1574
|
+
InputGroupModule,
|
1575
|
+
InputGroupAddonModule] }); }
|
1576
|
+
}
|
1577
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTTextAreaInputModule, decorators: [{
|
1578
|
+
type: NgModule,
|
1579
|
+
args: [{
|
1580
|
+
declarations: [PTTextAreaInputComponent],
|
1581
|
+
imports: [
|
1582
|
+
CommonModule,
|
1583
|
+
ReactiveFormsModule,
|
1584
|
+
InputTextareaModule,
|
1585
|
+
InputGroupModule,
|
1586
|
+
InputGroupAddonModule,
|
1587
|
+
],
|
1588
|
+
exports: [PTTextAreaInputComponent],
|
1589
|
+
}]
|
1590
|
+
}] });
|
1591
|
+
|
1592
|
+
class PTDateInputModule {
|
1593
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTDateInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
1594
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: PTDateInputModule, declarations: [PTDateInputComponent], imports: [CommonModule, ReactiveFormsModule, CalendarModule], exports: [PTDateInputComponent] }); }
|
1595
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTDateInputModule, imports: [CommonModule, ReactiveFormsModule, CalendarModule] }); }
|
1596
|
+
}
|
1597
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTDateInputModule, decorators: [{
|
1598
|
+
type: NgModule,
|
1599
|
+
args: [{
|
1600
|
+
declarations: [PTDateInputComponent],
|
1601
|
+
imports: [CommonModule, ReactiveFormsModule, CalendarModule],
|
1602
|
+
exports: [PTDateInputComponent],
|
1603
|
+
}]
|
1604
|
+
}] });
|
1605
|
+
|
1606
|
+
class PTDropdownModule {
|
1607
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTDropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
1608
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: PTDropdownModule, declarations: [PTDropdownComponent], imports: [CommonModule, ReactiveFormsModule, DropdownModule], exports: [PTDropdownComponent] }); }
|
1609
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTDropdownModule, imports: [CommonModule, ReactiveFormsModule, DropdownModule] }); }
|
1610
|
+
}
|
1611
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTDropdownModule, decorators: [{
|
1612
|
+
type: NgModule,
|
1613
|
+
args: [{
|
1614
|
+
declarations: [PTDropdownComponent],
|
1615
|
+
imports: [CommonModule, ReactiveFormsModule, DropdownModule],
|
1616
|
+
exports: [PTDropdownComponent],
|
1617
|
+
}]
|
1618
|
+
}] });
|
1619
|
+
|
1620
|
+
class PTMultiSelectModule {
|
1621
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTMultiSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
1622
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: PTMultiSelectModule, declarations: [PTMultiSelectComponent], imports: [CommonModule, ReactiveFormsModule, MultiSelectModule], exports: [PTMultiSelectComponent] }); }
|
1623
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTMultiSelectModule, imports: [CommonModule, ReactiveFormsModule, MultiSelectModule] }); }
|
1624
|
+
}
|
1625
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTMultiSelectModule, decorators: [{
|
1626
|
+
type: NgModule,
|
1627
|
+
args: [{
|
1628
|
+
declarations: [PTMultiSelectComponent],
|
1629
|
+
imports: [CommonModule, ReactiveFormsModule, MultiSelectModule],
|
1630
|
+
exports: [PTMultiSelectComponent],
|
1631
|
+
}]
|
1632
|
+
}] });
|
1633
|
+
|
1634
|
+
class PTDynamicFormFieldModule {
|
1635
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTDynamicFormFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
1636
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: PTDynamicFormFieldModule, declarations: [PTDynamicFormFieldComponent], imports: [CommonModule,
|
1637
|
+
ReactiveFormsModule,
|
1638
|
+
// Inputs
|
1639
|
+
PTCheckBoxInputModule,
|
1640
|
+
PTDateInputModule,
|
1641
|
+
PTNumberInputModule,
|
1642
|
+
PTSwitchInputModule,
|
1643
|
+
PTTextAreaInputModule,
|
1644
|
+
PTTextInputModule,
|
1645
|
+
PTDropdownModule,
|
1646
|
+
PTMultiSelectModule], exports: [PTDynamicFormFieldComponent] }); }
|
1647
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTDynamicFormFieldModule, imports: [CommonModule,
|
1648
|
+
ReactiveFormsModule,
|
1649
|
+
// Inputs
|
1650
|
+
PTCheckBoxInputModule,
|
1651
|
+
PTDateInputModule,
|
1652
|
+
PTNumberInputModule,
|
1653
|
+
PTSwitchInputModule,
|
1654
|
+
PTTextAreaInputModule,
|
1655
|
+
PTTextInputModule,
|
1656
|
+
PTDropdownModule,
|
1657
|
+
PTMultiSelectModule] }); }
|
1658
|
+
}
|
1659
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTDynamicFormFieldModule, decorators: [{
|
1660
|
+
type: NgModule,
|
1661
|
+
args: [{
|
1662
|
+
declarations: [PTDynamicFormFieldComponent],
|
1663
|
+
imports: [
|
1664
|
+
CommonModule,
|
1665
|
+
ReactiveFormsModule,
|
1666
|
+
// Inputs
|
1667
|
+
PTCheckBoxInputModule,
|
1668
|
+
PTDateInputModule,
|
1669
|
+
PTNumberInputModule,
|
1670
|
+
PTSwitchInputModule,
|
1671
|
+
PTTextAreaInputModule,
|
1672
|
+
PTTextInputModule,
|
1673
|
+
PTDropdownModule,
|
1674
|
+
PTMultiSelectModule,
|
1675
|
+
],
|
1676
|
+
exports: [PTDynamicFormFieldComponent],
|
1677
|
+
}]
|
1678
|
+
}] });
|
1679
|
+
|
1680
|
+
class PTFormBuilderModule {
|
1681
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTFormBuilderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
1682
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: PTFormBuilderModule, declarations: [PTFormBuilderComponent], imports: [CommonModule,
|
1683
|
+
ReactiveFormsModule,
|
1684
|
+
ButtonModule,
|
1685
|
+
PTDynamicFormFieldModule], exports: [PTFormBuilderComponent] }); }
|
1686
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTFormBuilderModule, imports: [CommonModule,
|
1687
|
+
ReactiveFormsModule,
|
1688
|
+
ButtonModule,
|
1689
|
+
PTDynamicFormFieldModule] }); }
|
1690
|
+
}
|
1691
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PTFormBuilderModule, decorators: [{
|
1692
|
+
type: NgModule,
|
1693
|
+
args: [{
|
1694
|
+
declarations: [PTFormBuilderComponent],
|
1695
|
+
imports: [
|
1696
|
+
CommonModule,
|
1697
|
+
ReactiveFormsModule,
|
1698
|
+
ButtonModule,
|
1699
|
+
PTDynamicFormFieldModule,
|
1700
|
+
],
|
1701
|
+
exports: [PTFormBuilderComponent],
|
1702
|
+
}]
|
1703
|
+
}] });
|
1704
|
+
|
655
1705
|
class NgPrimeToolsModule {
|
656
1706
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: NgPrimeToolsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
657
1707
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: NgPrimeToolsModule, imports: [CommonModule,
|
658
1708
|
FormsModule,
|
659
1709
|
NgAdvancedPrimeTableModule,
|
660
|
-
MultiSearchCriteriaModule
|
1710
|
+
MultiSearchCriteriaModule,
|
1711
|
+
// Inputs
|
1712
|
+
PTCheckBoxInputModule,
|
1713
|
+
PTDateInputModule,
|
1714
|
+
PTFormBuilderModule,
|
1715
|
+
PTNumberInputModule,
|
1716
|
+
PTSwitchInputModule,
|
1717
|
+
PTTextAreaInputModule,
|
1718
|
+
PTTextInputModule], exports: [NgAdvancedPrimeTableModule,
|
1719
|
+
MultiSearchCriteriaModule,
|
1720
|
+
// Inputs
|
1721
|
+
PTCheckBoxInputModule,
|
1722
|
+
PTDateInputModule,
|
1723
|
+
PTFormBuilderModule,
|
1724
|
+
PTNumberInputModule,
|
1725
|
+
PTSwitchInputModule,
|
1726
|
+
PTTextAreaInputModule,
|
1727
|
+
PTTextInputModule] }); }
|
661
1728
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: NgPrimeToolsModule, imports: [CommonModule,
|
662
1729
|
FormsModule,
|
663
1730
|
NgAdvancedPrimeTableModule,
|
664
|
-
MultiSearchCriteriaModule,
|
1731
|
+
MultiSearchCriteriaModule,
|
1732
|
+
// Inputs
|
1733
|
+
PTCheckBoxInputModule,
|
1734
|
+
PTDateInputModule,
|
1735
|
+
PTFormBuilderModule,
|
1736
|
+
PTNumberInputModule,
|
1737
|
+
PTSwitchInputModule,
|
1738
|
+
PTTextAreaInputModule,
|
1739
|
+
PTTextInputModule, NgAdvancedPrimeTableModule,
|
1740
|
+
MultiSearchCriteriaModule,
|
1741
|
+
// Inputs
|
1742
|
+
PTCheckBoxInputModule,
|
1743
|
+
PTDateInputModule,
|
1744
|
+
PTFormBuilderModule,
|
1745
|
+
PTNumberInputModule,
|
1746
|
+
PTSwitchInputModule,
|
1747
|
+
PTTextAreaInputModule,
|
1748
|
+
PTTextInputModule] }); }
|
665
1749
|
}
|
666
1750
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: NgPrimeToolsModule, decorators: [{
|
667
1751
|
type: NgModule,
|
@@ -671,23 +1755,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
671
1755
|
FormsModule,
|
672
1756
|
NgAdvancedPrimeTableModule,
|
673
1757
|
MultiSearchCriteriaModule,
|
1758
|
+
// Inputs
|
1759
|
+
PTCheckBoxInputModule,
|
1760
|
+
PTDateInputModule,
|
1761
|
+
PTFormBuilderModule,
|
1762
|
+
PTNumberInputModule,
|
1763
|
+
PTSwitchInputModule,
|
1764
|
+
PTTextAreaInputModule,
|
1765
|
+
PTTextInputModule,
|
1766
|
+
],
|
1767
|
+
exports: [
|
1768
|
+
NgAdvancedPrimeTableModule,
|
1769
|
+
MultiSearchCriteriaModule,
|
1770
|
+
// Inputs
|
1771
|
+
PTCheckBoxInputModule,
|
1772
|
+
PTDateInputModule,
|
1773
|
+
PTFormBuilderModule,
|
1774
|
+
PTNumberInputModule,
|
1775
|
+
PTSwitchInputModule,
|
1776
|
+
PTTextAreaInputModule,
|
1777
|
+
PTTextInputModule,
|
674
1778
|
],
|
675
|
-
exports: [NgAdvancedPrimeTableModule, MultiSearchCriteriaModule],
|
676
1779
|
}]
|
677
1780
|
}] });
|
678
1781
|
|
679
|
-
// projects/ng-prime-tools/src/lib/models/public_api.ts
|
680
|
-
|
681
1782
|
/**
|
682
1783
|
* Generated bundle index. Do not edit.
|
683
1784
|
*/
|
684
1785
|
/// <amd-module name="ng-prime-tools/models" />
|
685
1786
|
|
686
|
-
// projects/ng-prime-tools/src/public-api.ts
|
687
|
-
|
688
1787
|
/**
|
689
1788
|
* Generated bundle index. Do not edit.
|
690
1789
|
*/
|
691
1790
|
|
692
|
-
export { MultiSearchCriteriaComponent, MultiSearchCriteriaModule, NgAdvancedPrimeTableComponent, NgAdvancedPrimeTableModule, NgPrimeToolsModule, SearchCriteriaTypeEnum, TableTypeEnum };
|
1791
|
+
export { ButtonColorEnum, FormInputTypeEnum, InputValidationEnum, MultiSearchCriteriaComponent, MultiSearchCriteriaModule, NgAdvancedPrimeTableComponent, NgAdvancedPrimeTableModule, NgPrimeToolsModule, PTCheckBoxInputComponent, PTCheckBoxInputModule, PTDateInputComponent, PTDateInputModule, PTDropdownComponent, PTDropdownModule, PTFormBuilderComponent, PTFormBuilderModule, PTNumberInputComponent, PTNumberInputModule, PTSwitchInputComponent, PTSwitchInputModule, PTTextAreaInputComponent, PTTextAreaInputModule, PTTextInputComponent, PTTextInputModule, SearchCriteriaTypeEnum, TableTypeEnum };
|
693
1792
|
//# sourceMappingURL=ng-prime-tools.mjs.map
|