@pongrass/utils 0.0.1-v20 → 0.0.3-v20
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 +7 -7
- package/fesm2022/pongrass-utils.mjs +756 -13
- package/fesm2022/pongrass-utils.mjs.map +1 -1
- package/index.d.ts +275 -3
- package/package.json +10 -4
|
@@ -1,26 +1,35 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { signal, Injectable, Component, ViewChild, inject, EventEmitter, Input, Output, ElementRef, HostListener, Directive, Renderer2, NgModule } from '@angular/core';
|
|
2
|
+
import { signal, Injectable, Component, ViewChild, inject, EventEmitter, Input, Output, ElementRef, HostListener, Directive, Renderer2, NgModule, effect } from '@angular/core';
|
|
3
3
|
import * as i2 from '@angular/common';
|
|
4
4
|
import { CommonModule, NgClass } from '@angular/common';
|
|
5
|
-
import * as
|
|
5
|
+
import * as i3 from '@angular/forms';
|
|
6
6
|
import { FormsModule, NgControl, FormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
|
|
7
|
-
import * as
|
|
8
|
-
import { FormModule, ButtonModule, MultiSelectModule, MultiSelectComponent, InputGroupComponent, DatePickerModule, ModalModule, TooltipModule } from '@coreui/angular-pro';
|
|
7
|
+
import * as i2$1 from '@coreui/angular-pro';
|
|
8
|
+
import { FormModule, ButtonModule, MultiSelectModule, MultiSelectComponent, InputGroupComponent, DatePickerModule, ModalModule, TooltipModule, OffcanvasModule } from '@coreui/angular-pro';
|
|
9
9
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
10
|
-
import { lastValueFrom } from 'rxjs';
|
|
10
|
+
import { lastValueFrom, map, Subject } from 'rxjs';
|
|
11
11
|
import * as i5 from '@coreui/icons-angular';
|
|
12
12
|
import { IconModule } from '@coreui/icons-angular';
|
|
13
13
|
import * as i8 from 'ngx-bootstrap/datepicker';
|
|
14
14
|
import { BsDatepickerModule } from 'ngx-bootstrap/datepicker';
|
|
15
15
|
import Swal from 'sweetalert2';
|
|
16
16
|
import { Tooltip } from '@coreui/coreui-pro';
|
|
17
|
+
import { ToastrService } from 'ngx-toastr';
|
|
18
|
+
import { auditTime, takeUntil } from 'rxjs/operators';
|
|
19
|
+
import * as i1 from '@ag-grid-community/angular';
|
|
20
|
+
import { AgGridModule } from '@ag-grid-community/angular';
|
|
21
|
+
import { ClientSideRowModelModule } from '@ag-grid-community/client-side-row-model';
|
|
22
|
+
import { ModuleRegistry, _EditCoreModule } from '@ag-grid-community/core';
|
|
23
|
+
import { CsvExportModule } from '@ag-grid-community/csv-export';
|
|
17
24
|
|
|
18
25
|
class ConfigurationServiceLib {
|
|
19
26
|
currentTablePreference;
|
|
20
27
|
allConfigValues;
|
|
28
|
+
openFilterModal;
|
|
21
29
|
constructor() {
|
|
22
30
|
this.currentTablePreference = signal({}, ...(ngDevMode ? [{ debugName: "currentTablePreference" }] : []));
|
|
23
31
|
this.allConfigValues = signal(null, ...(ngDevMode ? [{ debugName: "allConfigValues" }] : []));
|
|
32
|
+
this.openFilterModal = signal(false, ...(ngDevMode ? [{ debugName: "openFilterModal" }] : []));
|
|
24
33
|
}
|
|
25
34
|
/* Generate Unique ID as String */
|
|
26
35
|
generateUniqueId() {
|
|
@@ -199,7 +208,7 @@ class CustomSelectFilterComponent {
|
|
|
199
208
|
}
|
|
200
209
|
</div>
|
|
201
210
|
</div>
|
|
202
|
-
`, isInline: true, styles: [".select-filter-container{padding:10px}.select-filter-container label{display:flex;gap:5px}.search-box{width:100%;margin-bottom:5px;padding:4px}.checkbox-list{max-height:200px;overflow-y:auto}.checkbox-item{padding:4px 6px;cursor:pointer;border-radius:4px}.checkbox-item:hover{background-color:#f0f0f0}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type:
|
|
211
|
+
`, isInline: true, styles: [".select-filter-container{padding:10px}.select-filter-container label{display:flex;gap:5px}.search-box{width:100%;margin-bottom:5px;padding:4px}.checkbox-list{max-height:200px;overflow-y:auto}.checkbox-item{padding:4px 6px;cursor:pointer;border-radius:4px}.checkbox-item:hover{background-color:#f0f0f0}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.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: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: FormModule }, { kind: "directive", type: i2$1.FormCheckInputDirective, selector: "input[cFormCheckInput]", inputs: ["type", "indeterminate", "valid"] }, { kind: "directive", type: i2$1.FormControlDirective, selector: "input[cFormControl], textarea[cFormControl]", inputs: ["sizing", "valid", "type", "plaintext"] }] });
|
|
203
212
|
}
|
|
204
213
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: CustomSelectFilterComponent, decorators: [{
|
|
205
214
|
type: Component,
|
|
@@ -265,7 +274,7 @@ class CheckboxCellRendererComponent {
|
|
|
265
274
|
[checked]="value"
|
|
266
275
|
(change)="onChangeCheckBox($event)"
|
|
267
276
|
[disabled]="ischeckboxDisabled" />
|
|
268
|
-
</div>`, isInline: true, dependencies: [{ kind: "ngmodule", type: FormModule }, { kind: "directive", type:
|
|
277
|
+
</div>`, isInline: true, dependencies: [{ kind: "ngmodule", type: FormModule }, { kind: "directive", type: i2$1.FormCheckInputDirective, selector: "input[cFormCheckInput]", inputs: ["type", "indeterminate", "valid"] }] });
|
|
269
278
|
}
|
|
270
279
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: CheckboxCellRendererComponent, decorators: [{
|
|
271
280
|
type: Component,
|
|
@@ -305,7 +314,7 @@ class CommentsButtonCellRendererComponent {
|
|
|
305
314
|
Comments
|
|
306
315
|
</button>
|
|
307
316
|
</div>
|
|
308
|
-
`, isInline: true, styles: [""], dependencies: [{ kind: "ngmodule", type: ButtonModule }, { kind: "directive", type:
|
|
317
|
+
`, isInline: true, styles: [""], dependencies: [{ kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2$1.ButtonDirective, selector: "[cButton]", inputs: ["active", "color", "disabled", "shape", "size", "tabindex", "type", "variant"], exportAs: ["cButton"] }] });
|
|
309
318
|
}
|
|
310
319
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: CommentsButtonCellRendererComponent, decorators: [{
|
|
311
320
|
type: Component,
|
|
@@ -372,6 +381,19 @@ class UtilsService {
|
|
|
372
381
|
const response = await lastValueFrom(request$);
|
|
373
382
|
return { ...response, timestamp: new Date().toISOString() };
|
|
374
383
|
}
|
|
384
|
+
// JSONRPC POST Request
|
|
385
|
+
postJsonRpcRequest(method, params) {
|
|
386
|
+
const headers = new HttpHeaders({ 'Content-Type': 'application/json' });
|
|
387
|
+
const body = {
|
|
388
|
+
jsonrpc: '2.0',
|
|
389
|
+
method: method,
|
|
390
|
+
params: params,
|
|
391
|
+
id: this.configurationServiceLib.generateUniqueId()
|
|
392
|
+
};
|
|
393
|
+
return this.httpService
|
|
394
|
+
.post(window.config.apiBaseURLWebMaint, body, { headers })
|
|
395
|
+
.pipe(map(response => ({ ...response, timestamp: new Date().toISOString() })));
|
|
396
|
+
}
|
|
375
397
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: UtilsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
376
398
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: UtilsService, providedIn: 'root' });
|
|
377
399
|
}
|
|
@@ -477,7 +499,7 @@ class EditionListGroupedComponent {
|
|
|
477
499
|
});
|
|
478
500
|
}
|
|
479
501
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: EditionListGroupedComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
480
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: EditionListGroupedComponent, isStandalone: true, selector: "app-edition-list-grouped", inputs: { label: "label", multiple: "multiple", hasFormError: "hasFormError" }, outputs: { selectedEditionsChange: "selectedEditionsChange" }, ngImport: i0, template: "<div class=\"row\">\n <div class=\"col-12\">\n @if (label) {\n <label for=\"sel-group-edition\">{{ label }}</label>\n }\n <c-multi-select\n [cleaner]=\"true\"\n [selectionType]=\"multiple ? 'counter' : 'text'\"\n [multiple]=\"multiple\"\n clearSearchOnSelect\n [ngClass]=\"{ 'form-invalid': hasFormError }\"\n placeholder=\"All Editions\"\n visibleItems=\"8\"\n (valueChange)=\"onEditionSelection($event)\"\n (visibleChange)=\"onVisibleChange($event)\">\n @for (option of editionPublicationList; track $index + '_' + option.region) {\n <c-multi-select-optgroup>\n <c-multi-select-optgroup-label (click)=\"onSelectEditionGroup(option.region, $index)\" class=\"region-selector cursor-pointer\">{{\n option?.region\n }}</c-multi-select-optgroup-label>\n @for (item of option.values; track item?.description) {\n <c-multi-select-option [value]=\"item\" [selected]=\"item.selected\">{{ '[' + item?.edname + ']' }} {{ item?.description }}</c-multi-select-option>\n }\n </c-multi-select-optgroup>\n }\n </c-multi-select>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MultiSelectModule }, { kind: "component", type:
|
|
502
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: EditionListGroupedComponent, isStandalone: true, selector: "app-edition-list-grouped", inputs: { label: "label", multiple: "multiple", hasFormError: "hasFormError" }, outputs: { selectedEditionsChange: "selectedEditionsChange" }, ngImport: i0, template: "<div class=\"row\">\n <div class=\"col-12\">\n @if (label) {\n <label for=\"sel-group-edition\">{{ label }}</label>\n }\n <c-multi-select\n [cleaner]=\"true\"\n [selectionType]=\"multiple ? 'counter' : 'text'\"\n [multiple]=\"multiple\"\n clearSearchOnSelect\n [ngClass]=\"{ 'form-invalid': hasFormError }\"\n placeholder=\"All Editions\"\n visibleItems=\"8\"\n (valueChange)=\"onEditionSelection($event)\"\n (visibleChange)=\"onVisibleChange($event)\">\n @for (option of editionPublicationList; track $index + '_' + option.region) {\n <c-multi-select-optgroup>\n <c-multi-select-optgroup-label (click)=\"onSelectEditionGroup(option.region, $index)\" class=\"region-selector cursor-pointer\">{{\n option?.region\n }}</c-multi-select-optgroup-label>\n @for (item of option.values; track item?.description) {\n <c-multi-select-option [value]=\"item\" [selected]=\"item.selected\">{{ '[' + item?.edname + ']' }} {{ item?.description }}</c-multi-select-option>\n }\n </c-multi-select-optgroup>\n }\n </c-multi-select>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MultiSelectModule }, { kind: "component", type: i2$1.MultiSelectComponent, selector: "c-multi-select", inputs: ["allowCreateOptions", "cleaner", "clearSearchOnSelect", "disabled", "loading", "multiple", "options", "optionsMaxHeight", "optionsStyle", "placeholder", "resetSelectionOnOptionsChange", "search", "searchNoResultsLabel", "searchValue", "selectAll", "selectAllLabel", "selectionType", "selectionTypeCounterText", "selectionTypeCounterTextPluralMap", "size", "value", "valid", "virtualScroller", "visibleItems", "itemSize", "itemMinWidth", "visible", "popperOptions"], outputs: ["searchValueChange", "valueChange", "visibleChange"], exportAs: ["cMultiSelect"] }, { kind: "component", type: i2$1.MultiSelectOptionComponent, selector: "c-multi-select-option", inputs: ["optionsStyle", "label", "text", "visible", "disabled", "selected", "value", "active", "role"], outputs: ["selectedChange", "focusChange"], exportAs: ["cMultiSelectOption"] }, { kind: "component", type: i2$1.MultiSelectOptgroupComponent, selector: "c-multi-select-optgroup", inputs: ["label", "disabled"] }, { kind: "component", type: i2$1.MultiSelectOptgroupLabelComponent, selector: "c-multi-select-optgroup-label" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
481
503
|
}
|
|
482
504
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: EditionListGroupedComponent, decorators: [{
|
|
483
505
|
type: Component,
|
|
@@ -518,7 +540,7 @@ class IndustryUpdateListboxCellRendererComponent {
|
|
|
518
540
|
}
|
|
519
541
|
}
|
|
520
542
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: IndustryUpdateListboxCellRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
521
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: IndustryUpdateListboxCellRendererComponent, isStandalone: true, selector: "app-industry-update-listbox-cell-renderer", ngImport: i0, template: "<select\n class=\"form-select select-industry\"\n [ngClass]=\"{ 'select-industry-red': selectedIndustry === 'select-industry' }\"\n [(ngModel)]=\"selectedIndustry\"\n (change)=\"onIndustryChange($event)\"\n id=\"sel-industry\"\n name=\"sel-industry\">\n <option value=\"select-industry\" disabled class=\"select-industry-opt\">Select Industry</option>\n @for (industry of industryList; track industry.industry) {\n <option [value]=\"industry?.industry\" class=\"select-industry-opt\">\n {{ industry?.description }}\n </option>\n }\n</select>\n", styles: [".form-select.select-industry{color:#000}.form-select.select-industry.select-industry-red{color:#666666b3}.form-select.select-industry option{color:#000}.form-select.select-industry option[value=select-industry]{color:gray}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type:
|
|
543
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: IndustryUpdateListboxCellRendererComponent, isStandalone: true, selector: "app-industry-update-listbox-cell-renderer", ngImport: i0, template: "<select\n class=\"form-select select-industry\"\n [ngClass]=\"{ 'select-industry-red': selectedIndustry === 'select-industry' }\"\n [(ngModel)]=\"selectedIndustry\"\n (change)=\"onIndustryChange($event)\"\n id=\"sel-industry\"\n name=\"sel-industry\">\n <option value=\"select-industry\" disabled class=\"select-industry-opt\">Select Industry</option>\n @for (industry of industryList; track industry.industry) {\n <option [value]=\"industry?.industry\" class=\"select-industry-opt\">\n {{ industry?.description }}\n </option>\n }\n</select>\n", styles: [".form-select.select-industry{color:#000}.form-select.select-industry.select-industry-red{color:#666666b3}.form-select.select-industry option{color:#000}.form-select.select-industry option[value=select-industry]{color:gray}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
522
544
|
}
|
|
523
545
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: IndustryUpdateListboxCellRendererComponent, decorators: [{
|
|
524
546
|
type: Component,
|
|
@@ -550,13 +572,174 @@ class PageStatusCellRendererComponent {
|
|
|
550
572
|
return selectedStatus && selectedStatus.html_color ? selectedStatus.html_color : '#C5B4E3';
|
|
551
573
|
}
|
|
552
574
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: PageStatusCellRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
553
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: PageStatusCellRendererComponent, isStandalone: true, selector: "app-page-status-cell-renderer", ngImport: i0, template: "<div class=\"wrapper-production-status-select\">\n <select\n class=\"status-dropdown\"\n aria-label=\"status-dropdown\"\n cSelect\n sizing=\"sm\"\n (click)=\"$event.stopPropagation()\"\n [ngModel]=\"pageStatus!.page_status_name\"\n (ngModelChange)=\"updatePageStatus($event)\"\n [ngStyle]=\"{ '--select-background': getStatusColor() }\">\n @for (status of pageStatusList; track $index) {\n <option [value]=\"status.page_status_name\">\n {{ status.page_status_name }}\n </option>\n }\n </select>\n</div>\n", styles: [".status-dropdown:not(.options){background-color:var(--select-background)}.status-dropdown option{background-color:#fff;color:#000}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type:
|
|
575
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: PageStatusCellRendererComponent, isStandalone: true, selector: "app-page-status-cell-renderer", ngImport: i0, template: "<div class=\"wrapper-production-status-select\">\n <select\n class=\"status-dropdown\"\n aria-label=\"status-dropdown\"\n cSelect\n sizing=\"sm\"\n (click)=\"$event.stopPropagation()\"\n [ngModel]=\"pageStatus!.page_status_name\"\n (ngModelChange)=\"updatePageStatus($event)\"\n [ngStyle]=\"{ '--select-background': getStatusColor() }\">\n @for (status of pageStatusList; track $index) {\n <option [value]=\"status.page_status_name\">\n {{ status.page_status_name }}\n </option>\n }\n </select>\n</div>\n", styles: [".status-dropdown:not(.options){background-color:var(--select-background)}.status-dropdown option{background-color:#fff;color:#000}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormModule }, { kind: "directive", type: i2$1.FormSelectDirective, selector: "select[cSelect]", inputs: ["sizing", "valid"] }] });
|
|
554
576
|
}
|
|
555
577
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: PageStatusCellRendererComponent, decorators: [{
|
|
556
578
|
type: Component,
|
|
557
579
|
args: [{ selector: 'app-page-status-cell-renderer', imports: [FormsModule, CommonModule, FormModule], standalone: true, template: "<div class=\"wrapper-production-status-select\">\n <select\n class=\"status-dropdown\"\n aria-label=\"status-dropdown\"\n cSelect\n sizing=\"sm\"\n (click)=\"$event.stopPropagation()\"\n [ngModel]=\"pageStatus!.page_status_name\"\n (ngModelChange)=\"updatePageStatus($event)\"\n [ngStyle]=\"{ '--select-background': getStatusColor() }\">\n @for (status of pageStatusList; track $index) {\n <option [value]=\"status.page_status_name\">\n {{ status.page_status_name }}\n </option>\n }\n </select>\n</div>\n", styles: [".status-dropdown:not(.options){background-color:var(--select-background)}.status-dropdown option{background-color:#fff;color:#000}\n"] }]
|
|
558
580
|
}] });
|
|
559
581
|
|
|
582
|
+
class StatusSelectCellRendererComponent {
|
|
583
|
+
prodStatusList = [];
|
|
584
|
+
params;
|
|
585
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
586
|
+
fileStatus = undefined;
|
|
587
|
+
agInit(params) {
|
|
588
|
+
this.params = params;
|
|
589
|
+
this.prodStatusList = params.colDef?.cellRendererParams?.data?.prodStatusList ?? [];
|
|
590
|
+
this.refresh(params);
|
|
591
|
+
}
|
|
592
|
+
// Return Cell Value
|
|
593
|
+
refresh(params) {
|
|
594
|
+
this.fileStatus = params.data;
|
|
595
|
+
return true;
|
|
596
|
+
}
|
|
597
|
+
updatePageStatus(value) {
|
|
598
|
+
if (this.params.colDef?.cellRendererParams?.onUpdateFileStatus) {
|
|
599
|
+
this.params.colDef.cellRendererParams.onUpdateFileStatus(this.params.data, value);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
getStatusColor() {
|
|
603
|
+
const selectedStatus = this.prodStatusList.find(status => status.statusid === this.fileStatus.it_prodstatusid);
|
|
604
|
+
return selectedStatus && selectedStatus.html_color ? selectedStatus.html_color : '#C5B4E3';
|
|
605
|
+
}
|
|
606
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: StatusSelectCellRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
607
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: StatusSelectCellRendererComponent, isStandalone: true, selector: "app-status-select-cell-renderer", ngImport: i0, template: "<div class=\"wrapper-production-status-select\">\n <select\n class=\"status-dropdown\"\n aria-label=\"status-dropdown\"\n cSelect\n sizing=\"sm\"\n (click)=\"$event.stopPropagation()\"\n [ngModel]=\"this.fileStatus!.it_prodstatusid\"\n (ngModelChange)=\"updatePageStatus($event)\"\n [ngStyle]=\"{ '--select-background': getStatusColor() }\">\n @for (status of prodStatusList; track $index) {\n <option [value]=\"status.statusid\">\n {{ status.statusdesc }}\n </option>\n }\n </select>\n</div>\n", styles: [".status-dropdown:not(.options){background-color:var(--select-background)}.status-dropdown option{background-color:#fff;color:#000}\n"], dependencies: [{ kind: "ngmodule", type: FormModule }, { kind: "directive", type: i2$1.FormSelectDirective, selector: "select[cSelect]", inputs: ["sizing", "valid"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
608
|
+
}
|
|
609
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: StatusSelectCellRendererComponent, decorators: [{
|
|
610
|
+
type: Component,
|
|
611
|
+
args: [{ standalone: true, imports: [FormModule, CommonModule, FormsModule], selector: 'app-status-select-cell-renderer', template: "<div class=\"wrapper-production-status-select\">\n <select\n class=\"status-dropdown\"\n aria-label=\"status-dropdown\"\n cSelect\n sizing=\"sm\"\n (click)=\"$event.stopPropagation()\"\n [ngModel]=\"this.fileStatus!.it_prodstatusid\"\n (ngModelChange)=\"updatePageStatus($event)\"\n [ngStyle]=\"{ '--select-background': getStatusColor() }\">\n @for (status of prodStatusList; track $index) {\n <option [value]=\"status.statusid\">\n {{ status.statusdesc }}\n </option>\n }\n </select>\n</div>\n", styles: [".status-dropdown:not(.options){background-color:var(--select-background)}.status-dropdown option{background-color:#fff;color:#000}\n"] }]
|
|
612
|
+
}] });
|
|
613
|
+
|
|
614
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
615
|
+
class JsonrpcService {
|
|
616
|
+
httpService = inject(HttpClient);
|
|
617
|
+
configService = inject(ConfigurationServiceLib);
|
|
618
|
+
// JSONRPC POST Request
|
|
619
|
+
postJsonRpcRequest(method, params) {
|
|
620
|
+
const headers = new HttpHeaders({ 'Content-Type': 'application/json' });
|
|
621
|
+
const body = {
|
|
622
|
+
jsonrpc: '2.0',
|
|
623
|
+
method: method,
|
|
624
|
+
params: params,
|
|
625
|
+
id: this.configService.generateUniqueId()
|
|
626
|
+
};
|
|
627
|
+
return this.httpService
|
|
628
|
+
.post(window.config.apiBaseURLWebMaint, body, { headers })
|
|
629
|
+
.pipe(map(response => ({ ...response, timestamp: new Date().toISOString() })));
|
|
630
|
+
}
|
|
631
|
+
// JSONRPC POST Request With promise
|
|
632
|
+
async postJsonRpcRequestPromise(method, params) {
|
|
633
|
+
const headers = new HttpHeaders({ 'Content-Type': 'application/json' });
|
|
634
|
+
const body = {
|
|
635
|
+
jsonrpc: '2.0',
|
|
636
|
+
method: method,
|
|
637
|
+
params: params,
|
|
638
|
+
id: this.configService.generateUniqueId()
|
|
639
|
+
};
|
|
640
|
+
const request$ = this.httpService.post(window.config.apiBaseURLWebMaint, body, { headers });
|
|
641
|
+
const response = await lastValueFrom(request$);
|
|
642
|
+
return { ...response, timestamp: new Date().toISOString() };
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
*
|
|
646
|
+
* @param formName Form config name
|
|
647
|
+
* @param tableName Table Name
|
|
648
|
+
*/
|
|
649
|
+
async getFormConfig(formName, tableName) {
|
|
650
|
+
const params = {
|
|
651
|
+
uid: +localStorage.getItem(BrowserConstantsEnum.loginUid),
|
|
652
|
+
form_name: formName,
|
|
653
|
+
table_name: tableName
|
|
654
|
+
};
|
|
655
|
+
return this.postJsonRpcRequestPromise(JSONRPCMethods.getFormsConfig, params)
|
|
656
|
+
.then((response) => {
|
|
657
|
+
return response.result ? response.result[0] : { rows: [] };
|
|
658
|
+
})
|
|
659
|
+
.finally(() => { });
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
*
|
|
663
|
+
* @param formName Report config name
|
|
664
|
+
* @param reportName Table Name
|
|
665
|
+
*/
|
|
666
|
+
async getFormConfigReports(formName, reportName) {
|
|
667
|
+
const params = {
|
|
668
|
+
uid: +localStorage.getItem(BrowserConstantsEnum.loginUid),
|
|
669
|
+
form_name: formName,
|
|
670
|
+
report_name: reportName
|
|
671
|
+
};
|
|
672
|
+
return this.postJsonRpcRequestPromise(JSONRPCMethods.report, params)
|
|
673
|
+
.then((response) => {
|
|
674
|
+
return response.result ? response.result[0] : { rows: [] };
|
|
675
|
+
})
|
|
676
|
+
.finally(() => { });
|
|
677
|
+
}
|
|
678
|
+
/** Get available forms */
|
|
679
|
+
async getTableConfig(tableName) {
|
|
680
|
+
try {
|
|
681
|
+
const response = await this.postJsonRpcRequestPromise(JSONRPCMethods.getFormsConfig, {
|
|
682
|
+
uid: +localStorage.getItem(BrowserConstantsEnum.loginUid),
|
|
683
|
+
table_name: tableName
|
|
684
|
+
});
|
|
685
|
+
if (response.result) {
|
|
686
|
+
return response.result;
|
|
687
|
+
}
|
|
688
|
+
return [];
|
|
689
|
+
}
|
|
690
|
+
catch (error) {
|
|
691
|
+
return [];
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
/** Get single row data by their params */
|
|
695
|
+
async getTableRow(tableName, param) {
|
|
696
|
+
let params = {
|
|
697
|
+
uid: +localStorage.getItem(BrowserConstantsEnum.loginUid),
|
|
698
|
+
table_name: tableName
|
|
699
|
+
};
|
|
700
|
+
params = { ...params, ...param };
|
|
701
|
+
return await this.postJsonRpcRequestPromise(JSONRPCMethods.tableSearch, params);
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
*
|
|
705
|
+
* @param tableName Table Name
|
|
706
|
+
* @param param Form values and params needed fo the call
|
|
707
|
+
* @param action 'U' for update and 'N' for create and 'D' for delete
|
|
708
|
+
* @returns Promise<any>
|
|
709
|
+
*/
|
|
710
|
+
async createUpdateDeleteTableRow(tableName, requests, action) {
|
|
711
|
+
let params = {
|
|
712
|
+
uid: +localStorage.getItem(BrowserConstantsEnum.loginUid),
|
|
713
|
+
table_name: tableName,
|
|
714
|
+
maint_action: action
|
|
715
|
+
};
|
|
716
|
+
params = { ...params, ...requests };
|
|
717
|
+
return await this.postJsonRpcRequestPromise(JSONRPCMethods.tableUpdate, params);
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
*
|
|
721
|
+
* @param tableName Table Name
|
|
722
|
+
* @param param Params to get the list of data
|
|
723
|
+
* @returns Array of data
|
|
724
|
+
*/
|
|
725
|
+
async getTableList(tableName, param) {
|
|
726
|
+
let params = {
|
|
727
|
+
uid: +localStorage.getItem(BrowserConstantsEnum.loginUid),
|
|
728
|
+
table_name: tableName
|
|
729
|
+
};
|
|
730
|
+
params = { ...params, ...param };
|
|
731
|
+
return await this.postJsonRpcRequestPromise(JSONRPCMethods.tableList, params);
|
|
732
|
+
}
|
|
733
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: JsonrpcService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
734
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: JsonrpcService, providedIn: 'root' });
|
|
735
|
+
}
|
|
736
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: JsonrpcService, decorators: [{
|
|
737
|
+
type: Injectable,
|
|
738
|
+
args: [{
|
|
739
|
+
providedIn: 'root'
|
|
740
|
+
}]
|
|
741
|
+
}] });
|
|
742
|
+
|
|
560
743
|
var FormFieldType;
|
|
561
744
|
(function (FormFieldType) {
|
|
562
745
|
FormFieldType["Text"] = "text";
|
|
@@ -1344,7 +1527,7 @@ class MultiFormComponent {
|
|
|
1344
1527
|
return null;
|
|
1345
1528
|
}
|
|
1346
1529
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: MultiFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1347
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: MultiFormComponent, isStandalone: false, selector: "app-multi-form", inputs: { config: "config", showUnsavedFlags: "showUnsavedFlags", currentTableGridsSelectedIndex: "currentTableGridsSelectedIndex", formId: "formId" }, outputs: { fieldAction: "fieldAction", formSavedUnsavedListen: "formSavedUnsavedListen", selectionChangeEvent: "selectionChangeEvent" }, usesOnChanges: true, ngImport: i0, template: "<form [formGroup]=\"multiForm\" cForm class=\"multiform-wrapper\" appCircularFocus>\n @for (row of config?.rows; track $index; let isLast = $last) {\n <div class=\"row gx-3 multiform-inner\" [id]=\"formId\" [ngClass]=\"config?.rows?.length > 1 && !isLast ? 'border-bottom mb-3' : ''\">\n @for (field of row; track $index) {\n @if (field?.type !== FormFieldType.Separator && field?.type !== FormFieldType.FormHeader) {\n <div class=\"mb-3\" [class]=\"'field-' + field.type\" [ngClass]=\"field.colspan ? 'col-md-' + field.colspan : 'col'\" [attr.data-id]=\"field.controlName\">\n @if (multiForm.controls[field.controlName]) {\n <!-- Label -->\n @if (field.label && field.type !== FormFieldType.Checkbox) {\n <label\n [appShowTooltipIfTruncated]=\"field.label\"\n cLabel\n class=\"mb-1 label-multiform single-line-label\"\n [for]=\"field.controlName\"\n [ngClass]=\"{ 'text-danger': isFormSubmitted && multiForm.controls[field.controlName]?.errors }\"\n [ngStyle]=\"field.styles?.label\"\n >{{ field.label }}\n @if (field?.validations?.required || false) {\n <strong class=\"text-danger\">*</strong>\n }\n </label>\n }\n\n <!-- Text, Email, Number Inputs -->\n @if (\n field.type === FormFieldType.Text ||\n field.type === FormFieldType.Email ||\n field.type === FormFieldType.Number ||\n field.type === FormFieldType.Password ||\n field.type === FormFieldType.Url ||\n field.type === FormFieldType.Tel\n ) {\n <div class=\"position-relative w-100\">\n <input\n [type]=\"field.type\"\n cFormControl\n [formControlName]=\"field.controlName\"\n [id]=\"field.controlName\"\n [placeholder]=\"field.placeholder || ''\"\n [ngClass]=\"{\n 'form-invalid border-danger border border-2':\n (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors,\n 'no-label-margin': !field.label\n }\"\n [min]=\"field.validations?.min\"\n [max]=\"field.validations?.max\"\n [ngStyle]=\"field.styles?.field\" />\n\n @if (field.actionButton) {\n <button\n type=\"button\"\n [cTooltip]=\"field.actionButton?.tooltip\"\n tooltipPlacement=\"top\"\n cButton\n color=\"primary\"\n variant=\"outline\"\n aria-label=\"action\"\n class=\"d-flex position-absolute top-50 end-0 translate-middle-y me-2 btn p-0 border-0 bg-transparent\"\n (click)=\"onClickFieldAction($event, field)\">\n <svg cIcon class=\"text-primary\" [name]=\"field.actionButton.icon\" size=\"xl\"></svg>\n </button>\n }\n @if (multiForm.controls[field.controlName]?.touched || isFormSubmitted) {\n @if (multiForm.controls[field.controlName]?.errors) {\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\n } @else if (multiForm.controls[field.controlName]?.errors?.['pattern']) {\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is invalid</small>\n } @else if (multiForm.controls[field.controlName]?.errors?.['minlength']) {\n <small class=\"text-danger fst-italic form-invalid-label\">\n Minimum length {{ field?.validations?.minLength }} characters is required\n </small>\n } @else if (multiForm.controls[field.controlName]?.errors?.['maxlength']) {\n <small class=\"text-danger fst-italic form-invalid-label\">\n Maximum length {{ field?.validations?.maxLength }} characters is allowed\n </small>\n }\n }\n }\n </div>\n }\n\n <!-- Select Inputs -->\n @else if (field.type === FormFieldType.Select || field.type === inputType?.colorSelect) {\n <ng-container>\n <c-multi-select\n [multiple]=\"field?.multiple || false\"\n [allowCreateOptions]=\"field?.allowCreateOptions || false\"\n [search]=\"field?.allowCreateOptions || field?.allowSearch || false\"\n [clearSearchOnSelect]=\"true\"\n [selectionType]=\"field?.selectionType || 'tags'\"\n [cleaner]=\"field?.allowCleaner || true\"\n [formControlName]=\"field.controlName\"\n [placeholder]=\"field.placeholder || 'Select'\"\n [appMultiSelectStyler]=\"field.type === inputType?.colorSelect\"\n [options]=\"colorCodes$\"\n [optionsMaxHeight]=\"400\"\n [ngClass]=\"{\n 'form-invalid': (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\n }\"\n (valueChange)=\"onValueChange($event, field.controlName)\"\n [ngStyle]=\"field.styles?.field\">\n @if (field.type === inputType?.colorSelect) {\n @for (option of colorCodes$; track $index) {\n <c-multi-select-option [value]=\"option?.label\">\n <label class=\"d-flex gap-2\">\n <span class=\"color-box\" [style.background-color]=\"option?.value\"></span>\n {{ option.label }}\n </label>\n </c-multi-select-option>\n }\n } @else {\n @for (option of field.options; track $index) {\n <c-multi-select-option [value]=\"option?.value\">\n {{ option.label }}\n </c-multi-select-option>\n }\n }\n </c-multi-select>\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\n }\n }\n </ng-container>\n }\n\n <!-- Date input -->\n @else if (field.type === FormFieldType.Date) {\n <ng-container>\n <input\n type=\"text\"\n [placeholder]=\"field?.label || 'Select Date'\"\n class=\"form-control\"\n [ngClass]=\"{\n 'form-invalid': (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\n }\"\n (bsValueChange)=\"onDateValueChange($event, field.controlName)\"\n [formControlName]=\"field.controlName\"\n [dateInputFormat]=\"configurationService?.allConfigValues()?.defaultDateFormat || 'MM/DD/YYYY'\"\n [bsConfig]=\"{\n containerClass: 'pongrass-red-datepicker',\n showWeekNumbers: false,\n adaptivePosition: true,\n useUtc: false\n }\"\n bsDatepicker\n [ngStyle]=\"field.styles?.field\" />\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\n }\n }\n </ng-container>\n }\n <!-- Textarea -->\n @else if (field.type === FormFieldType.Textarea) {\n <ng-container>\n <textarea\n cFormControl\n [id]=\"field.controlName\"\n [rows]=\"field?.textareaRows || 4\"\n [columns]=\"field?.textareaColumns || 4\"\n [placeholder]=\"field.placeholder || ''\"\n [ngClass]=\"{\n 'form-invalid border-danger border border-2':\n (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\n }\"\n [formControlName]=\"field.controlName\"\n [ngStyle]=\"field.styles?.field\"></textarea>\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\n } @else if (multiForm.controls[field.controlName]?.errors?.['minlength']) {\n <small class=\"text-danger fst-italic form-invalid-label\">\n Minimum length {{ field?.validations?.minLength }} characters is required\n </small>\n } @else if (multiForm.controls[field.controlName]?.errors?.['maxlength']) {\n <small class=\"text-danger fst-italic form-invalid-label\">\n Maximum length {{ field?.validations?.maxLength }} characters is allowed\n </small>\n }\n }\n </ng-container>\n }\n <!-- Checkbox -->\n @else if (field.type === FormFieldType.Checkbox) {\n <div class=\"no-label-margin\">\n <input cFormCheckInput [id]=\"field.controlName\" type=\"checkbox\" [formControlName]=\"field.controlName\" [ngStyle]=\"field.styles?.field\" />\n <label cFormCheckLabel [for]=\"field.controlName\" class=\"ms-2\" [ngStyle]=\"field.styles?.label\">{{ field.label }}</label>\n </div>\n }\n <!-- Decimal input -->\n @else if (field.type === FormFieldType.Float) {\n <ng-container>\n <input\n cFormControl\n [id]=\"field.controlName\"\n type=\"number\"\n class=\"me-2\"\n [formControlName]=\"field.controlName\"\n [appDecimalInput]=\"field.validations?.precision || 2\"\n [ngClass]=\"{\n 'form-invalid border-danger border border-2':\n (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\n }\"\n [min]=\"field.validations?.min\"\n [max]=\"field.validations?.max\"\n [ngStyle]=\"field.styles?.field\" />\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\n } @else if (multiForm.controls[field.controlName]?.errors?.['pattern']) {\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is invalid</small>\n } @else if (multiForm.controls[field.controlName]?.errors?.['minlength']) {\n <small class=\"text-danger fst-italic form-invalid-label\">\n Minimum length {{ field?.validations?.minLength }} characters is required\n </small>\n } @else if (multiForm.controls[field.controlName]?.errors?.['maxlength']) {\n <small class=\"text-danger fst-italic form-invalid-label\">\n Maximum length {{ field?.validations?.maxLength }} characters is allowed\n </small>\n }\n }\n </ng-container>\n } @else if (field.type === FormFieldType.Edition) {\n <ng-container>\n <app-edition-list-grouped\n (selectedEditionsChange)=\"onEditionChange($event)\"\n [multiple]=\"field?.multiple || true\"\n [hasFormError]=\"isFormSubmitted && multiForm.controls[field.controlName]?.errors\">\n </app-edition-list-grouped>\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\n }\n }\n </ng-container>\n }\n }\n </div>\n }\n\n @if (field?.type === FormFieldType.Separator) {\n <div [class]=\"'field-' + field.type\" [ngClass]=\"field.colspan ? 'col-md-' + field.colspan : 'col'\"></div>\n }\n @if (field?.type === FormFieldType.FormHeader) {\n <div [class]=\"'fs-6 fw-bold my-2 field-' + field.type\" [ngClass]=\"field.colspan ? 'col-md-' + field.colspan : 'col'\">{{ field?.label }}</div>\n }\n }\n </div>\n }\n</form>\n", styles: [".no-label-margin{margin-top:1.6rem}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}.h-135{height:135px}.single-line-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%;display:block}.label-multiform{font-size:16px;font-weight:400}.field-checkbox{display:flex;align-items:center}\n"], dependencies: [{ kind: "directive", type: CircularFocusDirective, selector: "[appCircularFocus]", inputs: ["formId", "formGroup"] }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i1.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i4.MultiSelectComponent, selector: "c-multi-select", inputs: ["allowCreateOptions", "cleaner", "clearSearchOnSelect", "disabled", "loading", "multiple", "options", "optionsMaxHeight", "optionsStyle", "placeholder", "resetSelectionOnOptionsChange", "search", "searchNoResultsLabel", "searchValue", "selectAll", "selectAllLabel", "selectionType", "selectionTypeCounterText", "selectionTypeCounterTextPluralMap", "size", "value", "valid", "virtualScroller", "visibleItems", "itemSize", "itemMinWidth", "visible", "popperOptions"], outputs: ["searchValueChange", "valueChange", "visibleChange"], exportAs: ["cMultiSelect"] }, { kind: "component", type: i4.MultiSelectOptionComponent, selector: "c-multi-select-option", inputs: ["optionsStyle", "label", "text", "visible", "disabled", "selected", "value", "active", "role"], outputs: ["selectedChange", "focusChange"], exportAs: ["cMultiSelectOption"] }, { kind: "directive", type: i4.FormDirective, selector: "form[cForm]", inputs: ["validated"] }, { kind: "directive", type: i4.FormCheckLabelDirective, selector: "label[cFormCheckLabel]" }, { kind: "directive", type: i4.FormCheckInputDirective, selector: "input[cFormCheckInput]", inputs: ["type", "indeterminate", "valid"] }, { kind: "directive", type: i4.FormControlDirective, selector: "input[cFormControl], textarea[cFormControl]", inputs: ["sizing", "valid", "type", "plaintext"] }, { kind: "directive", type: i4.FormLabelDirective, selector: "[cLabel]", inputs: ["cLabel", "sizing"] }, { kind: "directive", type: i5.IconDirective, selector: "svg[cIcon]", inputs: ["cIcon", "customClasses", "size", "title", "height", "width", "name", "viewBox", "xmlns", "pointer-events", "role"], exportAs: ["cIcon"] }, { kind: "directive", type: DecimalInputDirective, selector: "[appDecimalInput]", inputs: ["appDecimalInput"] }, { kind: "directive", type: ShowTooltipIfTruncatedDirective, selector: "[appShowTooltipIfTruncated]", inputs: ["appShowTooltipIfTruncated"] }, { kind: "directive", type: i4.TooltipDirective, selector: "[cTooltip]", inputs: ["cTooltip", "cTooltipOptions", "cTooltipPlacement", "cTooltipRef", "cTooltipTrigger", "cTooltipVisible"], outputs: ["cTooltipVisibleChange"], exportAs: ["cTooltip"] }, { kind: "directive", type: i4.ButtonDirective, selector: "[cButton]", inputs: ["active", "color", "disabled", "shape", "size", "tabindex", "type", "variant"], exportAs: ["cButton"] }, { kind: "directive", type: i8.BsDatepickerDirective, selector: "[bsDatepicker]", inputs: ["placement", "triggers", "outsideClick", "container", "outsideEsc", "isDisabled", "minDate", "maxDate", "ignoreMinMaxErrors", "minMode", "daysDisabled", "datesDisabled", "datesEnabled", "dateCustomClasses", "dateTooltipTexts", "isOpen", "bsValue", "bsConfig"], outputs: ["onShown", "onHidden", "bsValueChange"], exportAs: ["bsDatepicker"] }, { kind: "directive", type: i8.BsDatepickerInputDirective, selector: "input[bsDatepicker]" }, { kind: "component", type: EditionListGroupedComponent, selector: "app-edition-list-grouped", inputs: ["label", "multiple", "hasFormError"], outputs: ["selectedEditionsChange"] }, { kind: "directive", type: MultiSelectStylerDirective, selector: "[appMultiSelectStyler]", inputs: ["appMultiSelectStyler", "options"] }] });
|
|
1530
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: MultiFormComponent, isStandalone: false, selector: "app-multi-form", inputs: { config: "config", showUnsavedFlags: "showUnsavedFlags", currentTableGridsSelectedIndex: "currentTableGridsSelectedIndex", formId: "formId" }, outputs: { fieldAction: "fieldAction", formSavedUnsavedListen: "formSavedUnsavedListen", selectionChangeEvent: "selectionChangeEvent" }, usesOnChanges: true, ngImport: i0, template: "<form [formGroup]=\"multiForm\" cForm class=\"multiform-wrapper\" appCircularFocus>\n @for (row of config?.rows; track $index; let isLast = $last) {\n <div class=\"row gx-3 multiform-inner\" [id]=\"formId\" [ngClass]=\"config?.rows?.length > 1 && !isLast ? 'border-bottom mb-3' : ''\">\n @for (field of row; track $index) {\n @if (field?.type !== FormFieldType.Separator && field?.type !== FormFieldType.FormHeader) {\n <div class=\"mb-3\" [class]=\"'field-' + field.type\" [ngClass]=\"field.colspan ? 'col-md-' + field.colspan : 'col'\" [attr.data-id]=\"field.controlName\">\n @if (multiForm.controls[field.controlName]) {\n <!-- Label -->\n @if (field.label && field.type !== FormFieldType.Checkbox) {\n <label\n [appShowTooltipIfTruncated]=\"field.label\"\n cLabel\n class=\"mb-1 label-multiform single-line-label\"\n [for]=\"field.controlName\"\n [ngClass]=\"{ 'text-danger': isFormSubmitted && multiForm.controls[field.controlName]?.errors }\"\n [ngStyle]=\"field.styles?.label\"\n >{{ field.label }}\n @if (field?.validations?.required || false) {\n <strong class=\"text-danger\">*</strong>\n }\n </label>\n }\n\n <!-- Text, Email, Number Inputs -->\n @if (\n field.type === FormFieldType.Text ||\n field.type === FormFieldType.Email ||\n field.type === FormFieldType.Number ||\n field.type === FormFieldType.Password ||\n field.type === FormFieldType.Url ||\n field.type === FormFieldType.Tel\n ) {\n <div class=\"position-relative w-100\">\n <input\n [type]=\"field.type\"\n cFormControl\n [formControlName]=\"field.controlName\"\n [id]=\"field.controlName\"\n [placeholder]=\"field.placeholder || ''\"\n [ngClass]=\"{\n 'form-invalid border-danger border border-2':\n (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors,\n 'no-label-margin': !field.label\n }\"\n [min]=\"field.validations?.min\"\n [max]=\"field.validations?.max\"\n [ngStyle]=\"field.styles?.field\" />\n\n @if (field.actionButton) {\n <button\n type=\"button\"\n [cTooltip]=\"field.actionButton?.tooltip\"\n tooltipPlacement=\"top\"\n cButton\n color=\"primary\"\n variant=\"outline\"\n aria-label=\"action\"\n class=\"d-flex position-absolute top-50 end-0 translate-middle-y me-2 btn p-0 border-0 bg-transparent\"\n (click)=\"onClickFieldAction($event, field)\">\n <svg cIcon class=\"text-primary\" [name]=\"field.actionButton.icon\" size=\"xl\"></svg>\n </button>\n }\n @if (multiForm.controls[field.controlName]?.touched || isFormSubmitted) {\n @if (multiForm.controls[field.controlName]?.errors) {\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\n } @else if (multiForm.controls[field.controlName]?.errors?.['pattern']) {\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is invalid</small>\n } @else if (multiForm.controls[field.controlName]?.errors?.['minlength']) {\n <small class=\"text-danger fst-italic form-invalid-label\">\n Minimum length {{ field?.validations?.minLength }} characters is required\n </small>\n } @else if (multiForm.controls[field.controlName]?.errors?.['maxlength']) {\n <small class=\"text-danger fst-italic form-invalid-label\">\n Maximum length {{ field?.validations?.maxLength }} characters is allowed\n </small>\n }\n }\n }\n </div>\n }\n\n <!-- Select Inputs -->\n @else if (field.type === FormFieldType.Select || field.type === inputType?.colorSelect) {\n <ng-container>\n <c-multi-select\n [multiple]=\"field?.multiple || false\"\n [allowCreateOptions]=\"field?.allowCreateOptions || false\"\n [search]=\"field?.allowCreateOptions || field?.allowSearch || false\"\n [clearSearchOnSelect]=\"true\"\n [selectionType]=\"field?.selectionType || 'tags'\"\n [cleaner]=\"field?.allowCleaner || true\"\n [formControlName]=\"field.controlName\"\n [placeholder]=\"field.placeholder || 'Select'\"\n [appMultiSelectStyler]=\"field.type === inputType?.colorSelect\"\n [options]=\"colorCodes$\"\n [optionsMaxHeight]=\"400\"\n [ngClass]=\"{\n 'form-invalid': (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\n }\"\n (valueChange)=\"onValueChange($event, field.controlName)\"\n [ngStyle]=\"field.styles?.field\">\n @if (field.type === inputType?.colorSelect) {\n @for (option of colorCodes$; track $index) {\n <c-multi-select-option [value]=\"option?.label\">\n <label class=\"d-flex gap-2\">\n <span class=\"color-box\" [style.background-color]=\"option?.value\"></span>\n {{ option.label }}\n </label>\n </c-multi-select-option>\n }\n } @else {\n @for (option of field.options; track $index) {\n <c-multi-select-option [value]=\"option?.value\">\n {{ option.label }}\n </c-multi-select-option>\n }\n }\n </c-multi-select>\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\n }\n }\n </ng-container>\n }\n\n <!-- Date input -->\n @else if (field.type === FormFieldType.Date) {\n <ng-container>\n <input\n type=\"text\"\n [placeholder]=\"field?.label || 'Select Date'\"\n class=\"form-control\"\n [ngClass]=\"{\n 'form-invalid': (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\n }\"\n (bsValueChange)=\"onDateValueChange($event, field.controlName)\"\n [formControlName]=\"field.controlName\"\n [dateInputFormat]=\"configurationService?.allConfigValues()?.defaultDateFormat || 'MM/DD/YYYY'\"\n [bsConfig]=\"{\n containerClass: 'pongrass-red-datepicker',\n showWeekNumbers: false,\n adaptivePosition: true,\n useUtc: false\n }\"\n bsDatepicker\n [ngStyle]=\"field.styles?.field\" />\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\n }\n }\n </ng-container>\n }\n <!-- Textarea -->\n @else if (field.type === FormFieldType.Textarea) {\n <ng-container>\n <textarea\n cFormControl\n [id]=\"field.controlName\"\n [rows]=\"field?.textareaRows || 4\"\n [columns]=\"field?.textareaColumns || 4\"\n [placeholder]=\"field.placeholder || ''\"\n [ngClass]=\"{\n 'form-invalid border-danger border border-2':\n (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\n }\"\n [formControlName]=\"field.controlName\"\n [ngStyle]=\"field.styles?.field\"></textarea>\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\n } @else if (multiForm.controls[field.controlName]?.errors?.['minlength']) {\n <small class=\"text-danger fst-italic form-invalid-label\">\n Minimum length {{ field?.validations?.minLength }} characters is required\n </small>\n } @else if (multiForm.controls[field.controlName]?.errors?.['maxlength']) {\n <small class=\"text-danger fst-italic form-invalid-label\">\n Maximum length {{ field?.validations?.maxLength }} characters is allowed\n </small>\n }\n }\n </ng-container>\n }\n <!-- Checkbox -->\n @else if (field.type === FormFieldType.Checkbox) {\n <div class=\"no-label-margin\">\n <input cFormCheckInput [id]=\"field.controlName\" type=\"checkbox\" [formControlName]=\"field.controlName\" [ngStyle]=\"field.styles?.field\" />\n <label cFormCheckLabel [for]=\"field.controlName\" class=\"ms-2\" [ngStyle]=\"field.styles?.label\">{{ field.label }}</label>\n </div>\n }\n <!-- Decimal input -->\n @else if (field.type === FormFieldType.Float) {\n <ng-container>\n <input\n cFormControl\n [id]=\"field.controlName\"\n type=\"number\"\n class=\"me-2\"\n [formControlName]=\"field.controlName\"\n [appDecimalInput]=\"field.validations?.precision || 2\"\n [ngClass]=\"{\n 'form-invalid border-danger border border-2':\n (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\n }\"\n [min]=\"field.validations?.min\"\n [max]=\"field.validations?.max\"\n [ngStyle]=\"field.styles?.field\" />\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\n } @else if (multiForm.controls[field.controlName]?.errors?.['pattern']) {\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is invalid</small>\n } @else if (multiForm.controls[field.controlName]?.errors?.['minlength']) {\n <small class=\"text-danger fst-italic form-invalid-label\">\n Minimum length {{ field?.validations?.minLength }} characters is required\n </small>\n } @else if (multiForm.controls[field.controlName]?.errors?.['maxlength']) {\n <small class=\"text-danger fst-italic form-invalid-label\">\n Maximum length {{ field?.validations?.maxLength }} characters is allowed\n </small>\n }\n }\n </ng-container>\n } @else if (field.type === FormFieldType.Edition) {\n <ng-container>\n <app-edition-list-grouped\n (selectedEditionsChange)=\"onEditionChange($event)\"\n [multiple]=\"field?.multiple || true\"\n [hasFormError]=\"isFormSubmitted && multiForm.controls[field.controlName]?.errors\">\n </app-edition-list-grouped>\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\n }\n }\n </ng-container>\n }\n }\n </div>\n }\n\n @if (field?.type === FormFieldType.Separator) {\n <div [class]=\"'field-' + field.type\" [ngClass]=\"field.colspan ? 'col-md-' + field.colspan : 'col'\"></div>\n }\n @if (field?.type === FormFieldType.FormHeader) {\n <div [class]=\"'fs-6 fw-bold my-2 field-' + field.type\" [ngClass]=\"field.colspan ? 'col-md-' + field.colspan : 'col'\">{{ field?.label }}</div>\n }\n }\n </div>\n }\n</form>\n", styles: [".no-label-margin{margin-top:1.6rem}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}.h-135{height:135px}.single-line-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%;display:block}.label-multiform{font-size:16px;font-weight:400}.field-checkbox{display:flex;align-items:center}\n"], dependencies: [{ kind: "directive", type: CircularFocusDirective, selector: "[appCircularFocus]", inputs: ["formId", "formGroup"] }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i3.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: i3.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i3.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i3.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i2$1.MultiSelectComponent, selector: "c-multi-select", inputs: ["allowCreateOptions", "cleaner", "clearSearchOnSelect", "disabled", "loading", "multiple", "options", "optionsMaxHeight", "optionsStyle", "placeholder", "resetSelectionOnOptionsChange", "search", "searchNoResultsLabel", "searchValue", "selectAll", "selectAllLabel", "selectionType", "selectionTypeCounterText", "selectionTypeCounterTextPluralMap", "size", "value", "valid", "virtualScroller", "visibleItems", "itemSize", "itemMinWidth", "visible", "popperOptions"], outputs: ["searchValueChange", "valueChange", "visibleChange"], exportAs: ["cMultiSelect"] }, { kind: "component", type: i2$1.MultiSelectOptionComponent, selector: "c-multi-select-option", inputs: ["optionsStyle", "label", "text", "visible", "disabled", "selected", "value", "active", "role"], outputs: ["selectedChange", "focusChange"], exportAs: ["cMultiSelectOption"] }, { kind: "directive", type: i2$1.FormDirective, selector: "form[cForm]", inputs: ["validated"] }, { kind: "directive", type: i2$1.FormCheckLabelDirective, selector: "label[cFormCheckLabel]" }, { kind: "directive", type: i2$1.FormCheckInputDirective, selector: "input[cFormCheckInput]", inputs: ["type", "indeterminate", "valid"] }, { kind: "directive", type: i2$1.FormControlDirective, selector: "input[cFormControl], textarea[cFormControl]", inputs: ["sizing", "valid", "type", "plaintext"] }, { kind: "directive", type: i2$1.FormLabelDirective, selector: "[cLabel]", inputs: ["cLabel", "sizing"] }, { kind: "directive", type: i5.IconDirective, selector: "svg[cIcon]", inputs: ["cIcon", "customClasses", "size", "title", "height", "width", "name", "viewBox", "xmlns", "pointer-events", "role"], exportAs: ["cIcon"] }, { kind: "directive", type: DecimalInputDirective, selector: "[appDecimalInput]", inputs: ["appDecimalInput"] }, { kind: "directive", type: ShowTooltipIfTruncatedDirective, selector: "[appShowTooltipIfTruncated]", inputs: ["appShowTooltipIfTruncated"] }, { kind: "directive", type: i2$1.TooltipDirective, selector: "[cTooltip]", inputs: ["cTooltip", "cTooltipOptions", "cTooltipPlacement", "cTooltipRef", "cTooltipTrigger", "cTooltipVisible"], outputs: ["cTooltipVisibleChange"], exportAs: ["cTooltip"] }, { kind: "directive", type: i2$1.ButtonDirective, selector: "[cButton]", inputs: ["active", "color", "disabled", "shape", "size", "tabindex", "type", "variant"], exportAs: ["cButton"] }, { kind: "directive", type: i8.BsDatepickerDirective, selector: "[bsDatepicker]", inputs: ["placement", "triggers", "outsideClick", "container", "outsideEsc", "isDisabled", "minDate", "maxDate", "ignoreMinMaxErrors", "minMode", "daysDisabled", "datesDisabled", "datesEnabled", "dateCustomClasses", "dateTooltipTexts", "isOpen", "bsValue", "bsConfig"], outputs: ["onShown", "onHidden", "bsValueChange"], exportAs: ["bsDatepicker"] }, { kind: "directive", type: i8.BsDatepickerInputDirective, selector: "input[bsDatepicker]" }, { kind: "component", type: EditionListGroupedComponent, selector: "app-edition-list-grouped", inputs: ["label", "multiple", "hasFormError"], outputs: ["selectedEditionsChange"] }, { kind: "directive", type: MultiSelectStylerDirective, selector: "[appMultiSelectStyler]", inputs: ["appMultiSelectStyler", "options"] }] });
|
|
1348
1531
|
}
|
|
1349
1532
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: MultiFormComponent, decorators: [{
|
|
1350
1533
|
type: Component,
|
|
@@ -1422,6 +1605,566 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
|
|
|
1422
1605
|
}]
|
|
1423
1606
|
}] });
|
|
1424
1607
|
|
|
1608
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1609
|
+
class GenericFilterModelComponent {
|
|
1610
|
+
configurationService = inject(ConfigurationServiceLib);
|
|
1611
|
+
jsonrpcService = inject(JsonrpcService);
|
|
1612
|
+
filterFormConfiguration = [];
|
|
1613
|
+
tableName = '';
|
|
1614
|
+
sendFilteredData;
|
|
1615
|
+
filterFormComponent;
|
|
1616
|
+
isFilterModalActive;
|
|
1617
|
+
constructor() {
|
|
1618
|
+
this.isFilterModalActive = false;
|
|
1619
|
+
this.sendFilteredData = new EventEmitter();
|
|
1620
|
+
effect(() => {
|
|
1621
|
+
this.isFilterModalActive = this.configurationService.openFilterModal();
|
|
1622
|
+
});
|
|
1623
|
+
}
|
|
1624
|
+
ngOnInit() {
|
|
1625
|
+
if (!this.tableName)
|
|
1626
|
+
throw new Error('Table name is required to filter data.');
|
|
1627
|
+
}
|
|
1628
|
+
handleFilterModal(event) {
|
|
1629
|
+
this.isFilterModalActive = event;
|
|
1630
|
+
this.configurationService.openFilterModal.set(this.isFilterModalActive);
|
|
1631
|
+
}
|
|
1632
|
+
resetFilter() {
|
|
1633
|
+
this.filterFormComponent.resetForm();
|
|
1634
|
+
this.sendFilteredData.emit({ isReset: true, returnedData: [] });
|
|
1635
|
+
}
|
|
1636
|
+
async onFilter() {
|
|
1637
|
+
const formValues = this.filterAttributesWithValues(this.filterFormComponent.getFormValues().values);
|
|
1638
|
+
if (Object.keys(formValues).length > 0) {
|
|
1639
|
+
const tableData = await this.jsonrpcService.getTableList(this.tableName, formValues);
|
|
1640
|
+
this.sendFilteredData.emit({ isReset: false, returnedData: tableData.result || [] });
|
|
1641
|
+
this.configurationService.openFilterModal.set(false);
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
filterAttributesWithValues(object) {
|
|
1645
|
+
return Object.keys(object)
|
|
1646
|
+
.filter(key => object[key] !== null && object[key] !== '' && object[key] !== undefined)
|
|
1647
|
+
.reduce((result, key) => {
|
|
1648
|
+
result[key] = object[key];
|
|
1649
|
+
return result;
|
|
1650
|
+
}, {});
|
|
1651
|
+
}
|
|
1652
|
+
close() {
|
|
1653
|
+
this.configurationService.openFilterModal.set(false);
|
|
1654
|
+
}
|
|
1655
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: GenericFilterModelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1656
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: GenericFilterModelComponent, isStandalone: true, selector: "app-generic-filter-model", inputs: { filterFormConfiguration: "filterFormConfiguration", tableName: "tableName" }, outputs: { sendFilteredData: "sendFilteredData" }, viewQueries: [{ propertyName: "filterFormComponent", first: true, predicate: ["filterFormComponent"], descendants: true }], ngImport: i0, template: "<!-- Filter Modal -->\n<c-modal id=\"generic-filter-modal\" [visible]=\"isFilterModalActive\" (visibleChange)=\"handleFilterModal($event)\" size=\"md\" alignment=\"center\" scrollable>\n <c-modal-header>\n <h5 cModalTitle>Advanced Search</h5>\n <!-- <button (click)=\"commonService.openFilterModal.set(false)\" cButtonClose></button> -->\n </c-modal-header>\n <c-modal-body>\n @if (filterFormConfiguration) {\n <app-multi-form [config]=\"filterFormConfiguration\" #filterFormComponent></app-multi-form>\n }\n </c-modal-body>\n <c-modal-footer>\n <button (click)=\"close()\" cButton color=\"secondary\">Close</button>\n <button (click)=\"resetFilter()\" cButton color=\"primary\">Reset</button>\n <button cButton color=\"primary\" (click)=\"onFilter()\">Search</button>\n </c-modal-footer>\n</c-modal>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MultiFormModule }, { kind: "component", type: MultiFormComponent, selector: "app-multi-form", inputs: ["config", "showUnsavedFlags", "currentTableGridsSelectedIndex", "formId"], outputs: ["fieldAction", "formSavedUnsavedListen", "selectionChangeEvent"] }, { kind: "ngmodule", type: ModalModule }, { kind: "component", type: i2$1.ModalBodyComponent, selector: "c-modal-body" }, { kind: "component", type: i2$1.ModalComponent, selector: "c-modal", inputs: ["alignment", "backdrop", "fullscreen", "keyboard", "id", "size", "transition", "role", "ariaModal", "scrollable", "visible"], outputs: ["visibleChange"], exportAs: ["cModal"] }, { kind: "component", type: i2$1.ModalFooterComponent, selector: "c-modal-footer" }, { kind: "component", type: i2$1.ModalHeaderComponent, selector: "c-modal-header" }, { kind: "directive", type: i2$1.ModalTitleDirective, selector: "[cModalTitle]" }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2$1.ButtonDirective, selector: "[cButton]", inputs: ["active", "color", "disabled", "shape", "size", "tabindex", "type", "variant"], exportAs: ["cButton"] }] });
|
|
1657
|
+
}
|
|
1658
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: GenericFilterModelComponent, decorators: [{
|
|
1659
|
+
type: Component,
|
|
1660
|
+
args: [{ selector: 'app-generic-filter-model', standalone: true, imports: [CommonModule, MultiFormModule, ModalModule, ButtonModule], template: "<!-- Filter Modal -->\n<c-modal id=\"generic-filter-modal\" [visible]=\"isFilterModalActive\" (visibleChange)=\"handleFilterModal($event)\" size=\"md\" alignment=\"center\" scrollable>\n <c-modal-header>\n <h5 cModalTitle>Advanced Search</h5>\n <!-- <button (click)=\"commonService.openFilterModal.set(false)\" cButtonClose></button> -->\n </c-modal-header>\n <c-modal-body>\n @if (filterFormConfiguration) {\n <app-multi-form [config]=\"filterFormConfiguration\" #filterFormComponent></app-multi-form>\n }\n </c-modal-body>\n <c-modal-footer>\n <button (click)=\"close()\" cButton color=\"secondary\">Close</button>\n <button (click)=\"resetFilter()\" cButton color=\"primary\">Reset</button>\n <button cButton color=\"primary\" (click)=\"onFilter()\">Search</button>\n </c-modal-footer>\n</c-modal>\n" }]
|
|
1661
|
+
}], ctorParameters: () => [], propDecorators: { filterFormConfiguration: [{
|
|
1662
|
+
type: Input
|
|
1663
|
+
}], tableName: [{
|
|
1664
|
+
type: Input
|
|
1665
|
+
}], sendFilteredData: [{
|
|
1666
|
+
type: Output
|
|
1667
|
+
}], filterFormComponent: [{
|
|
1668
|
+
type: ViewChild,
|
|
1669
|
+
args: ['filterFormComponent']
|
|
1670
|
+
}] } });
|
|
1671
|
+
|
|
1672
|
+
var FilterType;
|
|
1673
|
+
(function (FilterType) {
|
|
1674
|
+
FilterType["SELECT"] = "SELECT_FILTER";
|
|
1675
|
+
FilterType["TEXT"] = "TEXT_FILTER";
|
|
1676
|
+
FilterType["NUMBER"] = "NUMBER_FILTER";
|
|
1677
|
+
FilterType["DATE"] = "DATE_FILTER";
|
|
1678
|
+
})(FilterType || (FilterType = {}));
|
|
1679
|
+
// Built-in AG Grid filters
|
|
1680
|
+
const AgGridFilters = {
|
|
1681
|
+
[FilterType.TEXT]: 'agTextColumnFilter',
|
|
1682
|
+
[FilterType.NUMBER]: 'agNumberColumnFilter',
|
|
1683
|
+
[FilterType.DATE]: 'agDateColumnFilter'
|
|
1684
|
+
};
|
|
1685
|
+
// Custom filters that can be used in the table grid
|
|
1686
|
+
const TABLE_GRID_FILTER_COMPONENTS = {
|
|
1687
|
+
[FilterType.SELECT]: CustomSelectFilterComponent
|
|
1688
|
+
// Add others as needed
|
|
1689
|
+
};
|
|
1690
|
+
|
|
1691
|
+
const MessageLabel = {
|
|
1692
|
+
RowPerPage: 'Rows per page'
|
|
1693
|
+
};
|
|
1694
|
+
|
|
1695
|
+
class TableGridComponent {
|
|
1696
|
+
formBuilder = inject(FormBuilder);
|
|
1697
|
+
utilsService = inject(UtilsService);
|
|
1698
|
+
toastrService = inject(ToastrService);
|
|
1699
|
+
configurationService = inject(ConfigurationServiceLib);
|
|
1700
|
+
tableConfiguration;
|
|
1701
|
+
columnToolVisible;
|
|
1702
|
+
initialPageNumber;
|
|
1703
|
+
tableGridReady;
|
|
1704
|
+
tableRowSelection;
|
|
1705
|
+
tableRowClicked;
|
|
1706
|
+
columnStateEvent;
|
|
1707
|
+
pageChange;
|
|
1708
|
+
filterChanged;
|
|
1709
|
+
cellValueChanged;
|
|
1710
|
+
gridAPI;
|
|
1711
|
+
columnsListselectionForm;
|
|
1712
|
+
tableGridState;
|
|
1713
|
+
autoSizeTrigger$ = new Subject();
|
|
1714
|
+
subscribeUntil$ = new Subject();
|
|
1715
|
+
autoSizeStrategy = {
|
|
1716
|
+
type: 'fitCellContents',
|
|
1717
|
+
defaultMinWidth: 100
|
|
1718
|
+
};
|
|
1719
|
+
/**
|
|
1720
|
+
* Resize all columns to fit the grid width while maintaining their minimum widths.
|
|
1721
|
+
* This method collects the current widths of all columns and applies them as limits
|
|
1722
|
+
*/
|
|
1723
|
+
sizeToFit() {
|
|
1724
|
+
const columnLimits = [];
|
|
1725
|
+
this.gridAPI?.api.getColumns().forEach(column => {
|
|
1726
|
+
column.getMaxWidth();
|
|
1727
|
+
columnLimits.push({
|
|
1728
|
+
key: column.getColId(),
|
|
1729
|
+
minWidth: column.getActualWidth()
|
|
1730
|
+
});
|
|
1731
|
+
});
|
|
1732
|
+
this.gridAPI?.api.sizeColumnsToFit({
|
|
1733
|
+
columnLimits: columnLimits
|
|
1734
|
+
});
|
|
1735
|
+
}
|
|
1736
|
+
/**
|
|
1737
|
+
* Automatically resize all columns to fit their content.
|
|
1738
|
+
* This method collects the current widths of all columns and applies them as limits
|
|
1739
|
+
* to ensure that the columns are resized based on their content.
|
|
1740
|
+
*/
|
|
1741
|
+
autoSizeAll(skipHeader = false) {
|
|
1742
|
+
this.gridAPI?.api.autoSizeAllColumns(skipHeader);
|
|
1743
|
+
this.sizeToFit();
|
|
1744
|
+
}
|
|
1745
|
+
gridOptions = {
|
|
1746
|
+
onRowDataUpdated: () => {
|
|
1747
|
+
// Trigger auto-size when row data is updated
|
|
1748
|
+
// this.autoSizeTrigger$.next();
|
|
1749
|
+
},
|
|
1750
|
+
localeText: {
|
|
1751
|
+
pageSizeSelectorLabel: `${MessageLabel.RowPerPage}:`,
|
|
1752
|
+
ariaPageSizeSelectorLabel: `${MessageLabel.RowPerPage}`
|
|
1753
|
+
}
|
|
1754
|
+
};
|
|
1755
|
+
constructor() {
|
|
1756
|
+
this.tableGridReady = new EventEmitter();
|
|
1757
|
+
this.tableRowSelection = new EventEmitter();
|
|
1758
|
+
this.tableRowClicked = new EventEmitter();
|
|
1759
|
+
this.columnStateEvent = new EventEmitter();
|
|
1760
|
+
this.pageChange = new EventEmitter();
|
|
1761
|
+
this.filterChanged = new EventEmitter();
|
|
1762
|
+
this.cellValueChanged = new EventEmitter();
|
|
1763
|
+
this.columnToolVisible = false;
|
|
1764
|
+
this.initialPageNumber = 0;
|
|
1765
|
+
this.tableGridState = [];
|
|
1766
|
+
effect(() => {
|
|
1767
|
+
// if (this.layoutService.appliedTheme() === 'dark') {
|
|
1768
|
+
// this.tableConfiguration.tableTheme = `${this.tableConfiguration.themeClass}-dark`;
|
|
1769
|
+
// } else {
|
|
1770
|
+
// this.tableConfiguration.tableTheme = this.tableConfiguration.themeClass;
|
|
1771
|
+
// }
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
ngOnChanges(changes) {
|
|
1775
|
+
if (changes['tableConfiguration'] && !changes['tableConfiguration'].firstChange) {
|
|
1776
|
+
if (this.gridAPI) {
|
|
1777
|
+
this.gridAPI.api.refreshClientSideRowModel();
|
|
1778
|
+
}
|
|
1779
|
+
setTimeout(() => {
|
|
1780
|
+
this.createColumnState();
|
|
1781
|
+
this.createColumnsListForm();
|
|
1782
|
+
}, 0);
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
ngOnInit() {
|
|
1786
|
+
this.createColumnsListForm();
|
|
1787
|
+
this.gridOptions = {
|
|
1788
|
+
...this.gridOptions,
|
|
1789
|
+
...this.tableConfiguration.defaultGridOptions
|
|
1790
|
+
};
|
|
1791
|
+
this.autoSizeTrigger$.pipe(auditTime(500), takeUntil(this.subscribeUntil$)).subscribe(() => {
|
|
1792
|
+
this.autoSizeAll();
|
|
1793
|
+
});
|
|
1794
|
+
}
|
|
1795
|
+
/** Send event to parent component when Ag Grid is stabilized*/
|
|
1796
|
+
onGridReady(event) {
|
|
1797
|
+
this.gridAPI = event;
|
|
1798
|
+
this.createColumnState();
|
|
1799
|
+
this.tableGridReady.emit(event);
|
|
1800
|
+
}
|
|
1801
|
+
/** Send event to parent component when a row is selected */
|
|
1802
|
+
onRowSelected(event) {
|
|
1803
|
+
const selectedRows = this.gridAPI?.api.getSelectedRows();
|
|
1804
|
+
this.tableRowSelection.emit({ event: event, rows: selectedRows });
|
|
1805
|
+
}
|
|
1806
|
+
/** Send event to parent component when a row is clicked */
|
|
1807
|
+
onRowClicked(event) {
|
|
1808
|
+
this.tableRowClicked.emit({ event: event, row: event.data });
|
|
1809
|
+
}
|
|
1810
|
+
/** Create column state on initialization of table grid */
|
|
1811
|
+
createColumnState() {
|
|
1812
|
+
if (this.gridAPI) {
|
|
1813
|
+
if (this.tableConfiguration.initialState) {
|
|
1814
|
+
this.tableGridState = this.tableConfiguration.initialState;
|
|
1815
|
+
const initialState = this.tableGridState.map(item => ({
|
|
1816
|
+
colId: item.key,
|
|
1817
|
+
hide: item.visible === null || item.visible === undefined ? false : !item.visible,
|
|
1818
|
+
width: item.width,
|
|
1819
|
+
sort: item.sort || null
|
|
1820
|
+
}));
|
|
1821
|
+
this.gridAPI.api.applyColumnState({
|
|
1822
|
+
state: initialState,
|
|
1823
|
+
defaultState: { sort: null }
|
|
1824
|
+
});
|
|
1825
|
+
}
|
|
1826
|
+
else {
|
|
1827
|
+
const state = this.gridAPI.api.getColumnState();
|
|
1828
|
+
state.forEach((columnState) => {
|
|
1829
|
+
this.tableGridState.push({
|
|
1830
|
+
key: columnState.colId,
|
|
1831
|
+
visible: columnState.hide ? !columnState.hide : true,
|
|
1832
|
+
width: columnState.width,
|
|
1833
|
+
sort: columnState.sort
|
|
1834
|
+
});
|
|
1835
|
+
});
|
|
1836
|
+
}
|
|
1837
|
+
// this.configurationService.currentTablePreference.set({ tableState: this.tableGridState, tableName: this.tableConfiguration.tablename });
|
|
1838
|
+
this.configurationService.setTablePreference(this.tableConfiguration.tablename, this.tableGridState);
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
/** Set visibility of columns and send the event and column form to parent component along with last checkbox event data */
|
|
1842
|
+
getCheckboxStatus(event, field) {
|
|
1843
|
+
const isChecked = event.target.checked;
|
|
1844
|
+
const columnIndex = this.tableGridState.findIndex(item => item.key === field);
|
|
1845
|
+
if (columnIndex > -1) {
|
|
1846
|
+
this.tableGridState[columnIndex] = {
|
|
1847
|
+
...this.tableGridState[columnIndex],
|
|
1848
|
+
visible: isChecked
|
|
1849
|
+
};
|
|
1850
|
+
}
|
|
1851
|
+
if (this.gridAPI) {
|
|
1852
|
+
this.gridAPI.api.setColumnsVisible([field], isChecked);
|
|
1853
|
+
this.gridAPI.api.autoSizeColumns([field]);
|
|
1854
|
+
}
|
|
1855
|
+
// this.configurationService.currentTablePreference.set({ tableState: this.tableGridState, tableName: this.tableConfiguration.tablename });
|
|
1856
|
+
this.configurationService.setTablePreference(this.tableConfiguration.tablename, this.tableGridState);
|
|
1857
|
+
}
|
|
1858
|
+
/** Create form group for column tools menu */
|
|
1859
|
+
createColumnsListForm() {
|
|
1860
|
+
if (!this.columnToolVisible)
|
|
1861
|
+
return;
|
|
1862
|
+
if (!this.tableConfiguration.tablename) {
|
|
1863
|
+
throw new Error('Table name is required for columns tools list');
|
|
1864
|
+
}
|
|
1865
|
+
const controls = {};
|
|
1866
|
+
if (this.tableConfiguration?.columnDefs) {
|
|
1867
|
+
this.tableConfiguration.columnDefs.forEach(col => {
|
|
1868
|
+
col.filter = this.getAppliedFilter(col.filter);
|
|
1869
|
+
});
|
|
1870
|
+
this.tableConfiguration.initialState.forEach((col) => {
|
|
1871
|
+
controls[col.key] = [col.visible === null || col.visible === undefined ? true : col.visible];
|
|
1872
|
+
});
|
|
1873
|
+
}
|
|
1874
|
+
if (Object.entries(controls).length > 0) {
|
|
1875
|
+
this.columnsListselectionForm = this.formBuilder.group(controls);
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
getAppliedFilter(filterType) {
|
|
1879
|
+
if (!filterType)
|
|
1880
|
+
return undefined;
|
|
1881
|
+
// Ensure it's a valid FilterType
|
|
1882
|
+
if (Object.values(FilterType).includes(filterType)) {
|
|
1883
|
+
// Check if a custom component exists for this filterType
|
|
1884
|
+
const customComponent = TABLE_GRID_FILTER_COMPONENTS[filterType];
|
|
1885
|
+
return customComponent ?? AgGridFilters[filterType];
|
|
1886
|
+
}
|
|
1887
|
+
return filterType;
|
|
1888
|
+
}
|
|
1889
|
+
/** On resizing columns, update the tableGridState */
|
|
1890
|
+
onColumnResized(event) {
|
|
1891
|
+
if (event.finished && event.column) {
|
|
1892
|
+
const columnId = event.column.colId;
|
|
1893
|
+
const columnWidth = event.column.actualWidth;
|
|
1894
|
+
const columnVisible = event.column.visible;
|
|
1895
|
+
const column = this.tableGridState.find(item => item.key === columnId);
|
|
1896
|
+
if (column) {
|
|
1897
|
+
column.width = columnWidth;
|
|
1898
|
+
column.visible = columnVisible;
|
|
1899
|
+
}
|
|
1900
|
+
// this.configurationService.currentTablePreference.set({ tableState: this.tableGridState, tableName: this.tableConfiguration.tablename });
|
|
1901
|
+
this.configurationService.setTablePreference(this.tableConfiguration.tablename, this.tableGridState);
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
/** On moving columns, update the tableGridState */
|
|
1905
|
+
onColumnMoved(event) {
|
|
1906
|
+
if (event.finished) {
|
|
1907
|
+
const { column, toIndex } = event;
|
|
1908
|
+
if (!column || toIndex === undefined || toIndex === null) {
|
|
1909
|
+
return;
|
|
1910
|
+
}
|
|
1911
|
+
const movedColId = column.getColId();
|
|
1912
|
+
const currentIndex = this.tableGridState.findIndex((col) => col.key === movedColId);
|
|
1913
|
+
if (currentIndex > -1) {
|
|
1914
|
+
const [movedColumn] = this.tableGridState.splice(currentIndex, 1);
|
|
1915
|
+
this.tableGridState.splice(toIndex, 0, movedColumn);
|
|
1916
|
+
}
|
|
1917
|
+
// this.configurationService.currentTablePreference.set({ tableState: this.tableGridState, tableName: this.tableConfiguration.tablename });
|
|
1918
|
+
this.configurationService.setTablePreference(this.tableConfiguration.tablename, this.tableGridState);
|
|
1919
|
+
}
|
|
1920
|
+
}
|
|
1921
|
+
onSortChanged(event) {
|
|
1922
|
+
if (event.columns) {
|
|
1923
|
+
event.columns.forEach((col) => {
|
|
1924
|
+
const column = this.tableGridState.find(item => item.key === col.colId);
|
|
1925
|
+
if (column) {
|
|
1926
|
+
column.sort = col.sort || null;
|
|
1927
|
+
}
|
|
1928
|
+
});
|
|
1929
|
+
// this.configurationService.currentTablePreference.set({ tableState: this.tableGridState, tableName: this.tableConfiguration.tablename });
|
|
1930
|
+
this.configurationService.setTablePreference(this.tableConfiguration.tablename, this.tableGridState);
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
/** Emit event when pagination is changed */
|
|
1934
|
+
onPaginationChanged(event) {
|
|
1935
|
+
this.pageChange.emit(event);
|
|
1936
|
+
}
|
|
1937
|
+
/** Emit event when first data is rendered */
|
|
1938
|
+
onFirstDataRendered(event) {
|
|
1939
|
+
event.api.paginationGoToPage(this.initialPageNumber);
|
|
1940
|
+
}
|
|
1941
|
+
/** Emit event to update table preference */
|
|
1942
|
+
updatetablePreference() {
|
|
1943
|
+
this.columnStateEvent.emit({
|
|
1944
|
+
currentEvent: {},
|
|
1945
|
+
currentTableState: this.tableGridState
|
|
1946
|
+
});
|
|
1947
|
+
}
|
|
1948
|
+
/** Reset table preference to default state */
|
|
1949
|
+
resetTablePreference() {
|
|
1950
|
+
if (!this.tableConfiguration.tablename) {
|
|
1951
|
+
throw new Error('Table name is required for columns tools list');
|
|
1952
|
+
}
|
|
1953
|
+
const params = {
|
|
1954
|
+
uid: +localStorage.getItem(BrowserConstantsEnum.loginUid),
|
|
1955
|
+
table_name: this.tableConfiguration.tablename,
|
|
1956
|
+
maint_action: 'D'
|
|
1957
|
+
};
|
|
1958
|
+
this.utilsService.postJsonRpcRequest(JSONRPCMethods.updateTablePreference, params).subscribe({
|
|
1959
|
+
next: (response) => {
|
|
1960
|
+
if (response.result) {
|
|
1961
|
+
this.tableGridState = [];
|
|
1962
|
+
if (response.result.fields_to_display && response.result.fields_to_display.length > 0) {
|
|
1963
|
+
this.tableConfiguration.initialState = response.result.fields_to_display;
|
|
1964
|
+
}
|
|
1965
|
+
this.tableConfiguration.initialState.forEach((col) => {
|
|
1966
|
+
col.visible = col.visible === null || col.visible === undefined ? true : col.visible;
|
|
1967
|
+
col.width = 200;
|
|
1968
|
+
col.sort = null;
|
|
1969
|
+
this.tableGridState.push(col);
|
|
1970
|
+
this.columnsListselectionForm.controls[col.key].setValue(true);
|
|
1971
|
+
});
|
|
1972
|
+
if (this.gridAPI) {
|
|
1973
|
+
this.gridAPI.api.applyColumnState({
|
|
1974
|
+
state: this.tableGridState.map(item => ({
|
|
1975
|
+
colId: item.key,
|
|
1976
|
+
hide: item.visible === null || item.visible === undefined ? false : !item.visible,
|
|
1977
|
+
width: 200,
|
|
1978
|
+
sort: item.sort || null,
|
|
1979
|
+
flex: 1
|
|
1980
|
+
})),
|
|
1981
|
+
defaultState: { sort: null },
|
|
1982
|
+
applyOrder: true
|
|
1983
|
+
});
|
|
1984
|
+
// this.configurationService.currentTablePreference.set({ tableState: this.tableGridState, tableName: this.tableConfiguration.tablename });
|
|
1985
|
+
this.configurationService.setTablePreference(this.tableConfiguration.tablename, this.tableGridState);
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
else {
|
|
1989
|
+
this.toastrService.success('Failed to reset table preference');
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
});
|
|
1993
|
+
}
|
|
1994
|
+
/** Reset table preference to default state */
|
|
1995
|
+
resetTablePreferenceV2() {
|
|
1996
|
+
if (!this.tableConfiguration?.tablename) {
|
|
1997
|
+
throw new Error('Table name is required for column tools list');
|
|
1998
|
+
}
|
|
1999
|
+
this.tableConfiguration.initialState.forEach((col) => {
|
|
2000
|
+
col.visible = false;
|
|
2001
|
+
delete col.width;
|
|
2002
|
+
delete col.sort;
|
|
2003
|
+
});
|
|
2004
|
+
const params = {
|
|
2005
|
+
uid: +localStorage.getItem(BrowserConstantsEnum.loginUid),
|
|
2006
|
+
table_name: this.tableConfiguration.tablename,
|
|
2007
|
+
display_options: this.tableGridState
|
|
2008
|
+
};
|
|
2009
|
+
this.utilsService.postJsonRpcRequest(JSONRPCMethods.updateTablePreference, params).subscribe({
|
|
2010
|
+
next: (response) => {
|
|
2011
|
+
if (response?.result) {
|
|
2012
|
+
this.handleSuccessfulReset(response.result);
|
|
2013
|
+
}
|
|
2014
|
+
else {
|
|
2015
|
+
this.toastrService.error('Failed to reset table preference');
|
|
2016
|
+
}
|
|
2017
|
+
},
|
|
2018
|
+
error: () => {
|
|
2019
|
+
this.toastrService.error('An error occurred while resetting table preference');
|
|
2020
|
+
}
|
|
2021
|
+
});
|
|
2022
|
+
}
|
|
2023
|
+
/** Handle successful reset of table preference */
|
|
2024
|
+
handleSuccessfulReset(result) {
|
|
2025
|
+
this.tableGridState = [];
|
|
2026
|
+
const fieldsToDisplay = result.fields_to_display || [];
|
|
2027
|
+
if (fieldsToDisplay.length > 0) {
|
|
2028
|
+
this.tableConfiguration.initialState = fieldsToDisplay;
|
|
2029
|
+
}
|
|
2030
|
+
this.tableConfiguration.initialState.forEach((col) => {
|
|
2031
|
+
col.visible = false;
|
|
2032
|
+
this.tableGridState.push(col);
|
|
2033
|
+
this.columnsListselectionForm.controls[col.key]?.setValue(false);
|
|
2034
|
+
});
|
|
2035
|
+
this.updateGridState();
|
|
2036
|
+
}
|
|
2037
|
+
/** Update grid state based on the current tableGridState */
|
|
2038
|
+
updateGridState() {
|
|
2039
|
+
if (this.gridAPI) {
|
|
2040
|
+
const columnState = this.tableGridState.map(item => ({
|
|
2041
|
+
colId: item.key,
|
|
2042
|
+
hide: true,
|
|
2043
|
+
width: 200,
|
|
2044
|
+
sort: item.sort || null,
|
|
2045
|
+
flex: 1
|
|
2046
|
+
}));
|
|
2047
|
+
this.gridAPI.api.applyColumnState({
|
|
2048
|
+
state: columnState,
|
|
2049
|
+
defaultState: { sort: null },
|
|
2050
|
+
applyOrder: true
|
|
2051
|
+
});
|
|
2052
|
+
// this.configurationService.currentTablePreference.set({ tableState: this.tableGridState, tableName: this.tableConfiguration.tablename });
|
|
2053
|
+
this.configurationService.setTablePreference(this.tableConfiguration.tablename, this.tableGridState);
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
/* Emit event when filter is changed */
|
|
2057
|
+
onFilterChanged(params) {
|
|
2058
|
+
const filterModel = params.api.getFilterModel();
|
|
2059
|
+
const filteredRows = [];
|
|
2060
|
+
params.api.forEachNodeAfterFilter((node) => {
|
|
2061
|
+
if (node.data) {
|
|
2062
|
+
filteredRows.push(node.data);
|
|
2063
|
+
}
|
|
2064
|
+
});
|
|
2065
|
+
const filterChangedParams = {
|
|
2066
|
+
rows: filteredRows,
|
|
2067
|
+
column: params.columns,
|
|
2068
|
+
filters: filterModel
|
|
2069
|
+
};
|
|
2070
|
+
this.filterChanged.emit(filterChangedParams);
|
|
2071
|
+
}
|
|
2072
|
+
/** Emit event when a cell value is changed */
|
|
2073
|
+
onCellValueChanged(event) {
|
|
2074
|
+
this.cellValueChanged.emit(event);
|
|
2075
|
+
}
|
|
2076
|
+
ngOnDestroy() {
|
|
2077
|
+
this.subscribeUntil$.next();
|
|
2078
|
+
this.subscribeUntil$.complete();
|
|
2079
|
+
}
|
|
2080
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: TableGridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2081
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: TableGridComponent, isStandalone: false, selector: "app-table-grid", inputs: { tableConfiguration: "tableConfiguration", columnToolVisible: "columnToolVisible", initialPageNumber: "initialPageNumber" }, outputs: { tableGridReady: "tableGridReady", tableRowSelection: "tableRowSelection", tableRowClicked: "tableRowClicked", columnStateEvent: "columnStateEvent", pageChange: "pageChange", filterChanged: "filterChanged", cellValueChanged: "cellValueChanged" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"row\">\n <div class=\"col-12 d-md-flex\">\n <div class=\"table-list-wrapper flex-fill\">\n <!-- style=\"width: 100%; height: 567px\" -->\n <ag-grid-angular\n style=\"width: 100%\"\n [rowData]=\"tableConfiguration.rows\"\n [columnDefs]=\"tableConfiguration.columnDefs\"\n [defaultColDef]=\"tableConfiguration.defaultColDef\"\n [rowSelection]=\"tableConfiguration.rowSelectionOption\"\n [pagination]=\"tableConfiguration.pagination.enabled\"\n [paginationPageSize]=\"tableConfiguration.pagination.paginationPageSize\"\n [paginationPageSizeSelector]=\"tableConfiguration.pagination.paginationPageSizeSelector\"\n [class]=\"[tableConfiguration.tableClasses, tableConfiguration.tableTheme]\"\n [selectionColumnDef]=\"tableConfiguration.selectionColumnDef\"\n (gridReady)=\"onGridReady($event)\"\n (rowSelected)=\"onRowSelected($event)\"\n (rowClicked)=\"onRowClicked($event)\"\n (columnResized)=\"onColumnResized($event)\"\n (columnMoved)=\"onColumnMoved($event)\"\n (sortChanged)=\"onSortChanged($event)\"\n (paginationChanged)=\"onPaginationChanged($event)\"\n (firstDataRendered)=\"onFirstDataRendered($event)\"\n (filterChanged)=\"onFilterChanged($event)\"\n (cellValueChanged)=\"onCellValueChanged($event)\"\n [masterDetail]=\"tableConfiguration.masterDetail\"\n [detailCellRendererParams]=\"tableConfiguration.detailCellRendererParams\"\n [detailCellRenderer]=\"tableConfiguration.detailCellRenderer\"\n [enableCellTextSelection]=\"true\"\n [gridOptions]=\"gridOptions\"\n [ensureDomOrder]=\"true\"\n [tooltipShowDelay]=\"tableConfiguration.tooltipShowDelay\" />\n </div>\n\n @if (columnToolVisible && columnsListselectionForm) {\n <div class=\"columns-list ms-3 p-3 d-md-flex flex-column h-100 d-none border border-1 rounded hide columns-tool\" [id]=\"tableConfiguration.tablename\">\n <div class=\"d-flex justify-content-between align-items-center mb-3 gap-2 columns-heading\">\n <span\n class=\"cursor-pointer text-primary\"\n tooltipPlacement=\"top\"\n cTooltip=\"Column Preference\"\n [cOffcanvasToggle]=\"tableConfiguration.tablename + 'config-columns'\">\n <svg cIcon name=\"cilColumns\" size=\"xl\"></svg>\n </span>\n\n <span class=\"cursor-pointer text-primary\" tooltipPlacement=\"top\" cTooltip=\"Auto Resize Columns\" (click)=\"autoSizeAll()\">\n <svg cIcon name=\"cilResizeWidth\" size=\"xl\"></svg>\n </span>\n </div>\n </div>\n\n <c-offcanvas placement=\"end\" [id]=\"tableConfiguration.tablename + 'config-columns'\" width=\"550\">\n <c-offcanvas-header>\n <h5 cOffcanvasTitle>Table Column Preference</h5>\n <button\n cButtonClose\n size=\"sm\"\n class=\"text-reset ms-auto\"\n [cOffcanvasToggle]=\"tableConfiguration.tablename + 'config-columns'\"\n aria-label=\"Close\"></button>\n </c-offcanvas-header>\n <c-offcanvas-body>\n <div class=\"columns-wrapper mb-2\" [formGroup]=\"columnsListselectionForm\">\n @for (item of this.tableGridState; track $index) {\n <div class=\"checkbox-item px-1\">\n <c-form-check>\n <input\n (change)=\"getCheckboxStatus($event, item.key)\"\n [checked]=\"columnsListselectionForm.get(item.key)?.value\"\n cFormCheckInput\n [id]=\"'cb_' + item.key\"\n type=\"checkbox\"\n [formControl]=\"columnsListselectionForm.controls[item.key]\" />\n <label class=\"truncate-preference-label\" cFormCheckLabel [for]=\"'cb_' + item.key\" [title]=\"item?.headerName || item?.label\">\n {{ item?.headerName || item?.label }}</label\n >\n </c-form-check>\n </div>\n }\n </div>\n <div class=\"align d-flex gap-3 justify-content-end\">\n <button\n cButton\n [disabled]=\"tableConfiguration.tablePreference.disableRemovecolumn\"\n color=\"primary\"\n class=\"px-2 mt-auto\"\n variant=\"outline\"\n (click)=\"resetTablePreferenceV2()\">\n Clear\n </button>\n <button\n cButton\n [disabled]=\"tableConfiguration.tablePreference.disableResetPreference\"\n color=\"primary\"\n class=\"px-2 mt-auto\"\n variant=\"outline\"\n (click)=\"resetTablePreference()\">\n Reset\n </button>\n <button\n cButton\n [disabled]=\"tableConfiguration.tablePreference.disableUpdatePreference\"\n color=\"primary\"\n class=\"px-2 mt-auto\"\n variant=\"outline\"\n (click)=\"updatetablePreference()\">\n Update\n </button>\n </div>\n </c-offcanvas-body>\n </c-offcanvas>\n }\n </div>\n</div>\n", styles: [".offcanvas.offcanvas-end{--cui-offcanvas-width: 350px}.border{--cui-border-color: color-mix(in srgb, transparent, #181d1f 15%)}.columns-list{width:210px;transition:width .2s ease-in,padding .2s ease-in;overflow:hidden;display:flex;flex-direction:column;max-height:calc(100vh - 210px)}.default-ag-layout{height:calc(100vh - 210px)}.small-table-container{max-height:calc(100vh - 210px)}.columns-wrapper{flex-grow:1;overflow-y:auto;overflow-x:hidden;transition:opacity .2s ease-in,height .2s ease-in;opacity:1;height:calc(92vh - 93px);overflow:auto}.columns-tool.hide{width:32px;transition:width .2s ease-in,padding .2s ease-in}.columns-tool.hide button,.columns-tool.hide .columns-wrapper{opacity:0;height:0;pointer-events:none}.columns-tool.hide .columns-heading{flex-direction:column}.columns-tool.hide .columns-heading p{margin:50px 0 0;writing-mode:vertical-rl;text-orientation:mixed;letter-spacing:4px;font-size:.8rem;transition:margin .2s ease-in,font-size .2s ease-in}.columns-tool button{transform:scale(1);opacity:1;transition:opacity .2s ease-in,transform .1s ease-in;will-change:opacity,transform;height:40px}.columns-tool.hide button{opacity:0;transform:scale(.95)}.columns-heading{display:flex;justify-content:space-between;align-items:center;transition:flex-direction .2s ease-in}.columns-heading p{margin:0;font-size:1rem;text-align:center;letter-spacing:normal}.truncate-preference-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n"], dependencies: [{ kind: "component", type: i1.AgGridAngular, selector: "ag-grid-angular", inputs: ["gridOptions", "modules", "statusBar", "sideBar", "suppressContextMenu", "preventDefaultOnContextMenu", "allowContextMenuWithControlKey", "columnMenu", "suppressMenuHide", "enableBrowserTooltips", "tooltipTrigger", "tooltipShowDelay", "tooltipHideDelay", "tooltipMouseTrack", "tooltipShowMode", "tooltipInteraction", "popupParent", "copyHeadersToClipboard", "copyGroupHeadersToClipboard", "clipboardDelimiter", "suppressCopyRowsToClipboard", "suppressCopySingleCellRanges", "suppressLastEmptyLineOnPaste", "suppressClipboardPaste", "suppressClipboardApi", "suppressCutToClipboard", "columnDefs", "defaultColDef", "defaultColGroupDef", "columnTypes", "dataTypeDefinitions", "maintainColumnOrder", "enableStrictPivotColumnOrder", "suppressFieldDotNotation", "headerHeight", "groupHeaderHeight", "floatingFiltersHeight", "pivotHeaderHeight", "pivotGroupHeaderHeight", "allowDragFromColumnsToolPanel", "suppressMovableColumns", "suppressColumnMoveAnimation", "suppressMoveWhenColumnDragging", "suppressDragLeaveHidesColumns", "suppressRowGroupHidesColumns", "colResizeDefault", "suppressAutoSize", "autoSizePadding", "skipHeaderOnAutoSize", "autoSizeStrategy", "components", "editType", "singleClickEdit", "suppressClickEdit", "readOnlyEdit", "stopEditingWhenCellsLoseFocus", "enterNavigatesVertically", "enterNavigatesVerticallyAfterEdit", "enableCellEditingOnBackspace", "undoRedoCellEditing", "undoRedoCellEditingLimit", "defaultCsvExportParams", "suppressCsvExport", "defaultExcelExportParams", "suppressExcelExport", "excelStyles", "quickFilterText", "cacheQuickFilter", "includeHiddenColumnsInQuickFilter", "quickFilterParser", "quickFilterMatcher", "applyQuickFilterBeforePivotOrAgg", "excludeChildrenWhenTreeDataFiltering", "enableAdvancedFilter", "advancedFilterModel", "includeHiddenColumnsInAdvancedFilter", "advancedFilterParent", "advancedFilterBuilderParams", "suppressAdvancedFilterEval", "suppressSetFilterByDefault", "enableCharts", "chartThemes", "customChartThemes", "chartThemeOverrides", "chartToolPanelsDef", "chartMenuItems", "loadingCellRenderer", "loadingCellRendererParams", "loadingCellRendererSelector", "localeText", "masterDetail", "keepDetailRows", "keepDetailRowsCount", "detailCellRenderer", "detailCellRendererParams", "detailRowHeight", "detailRowAutoHeight", "context", "dragAndDropImageComponent", "dragAndDropImageComponentParams", "alignedGrids", "tabIndex", "rowBuffer", "valueCache", "valueCacheNeverExpires", "enableCellExpressions", "suppressTouch", "suppressFocusAfterRefresh", "suppressAsyncEvents", "suppressBrowserResizeObserver", "suppressPropertyNamesCheck", "suppressChangeDetection", "debug", "loading", "overlayLoadingTemplate", "loadingOverlayComponent", "loadingOverlayComponentParams", "suppressLoadingOverlay", "overlayNoRowsTemplate", "noRowsOverlayComponent", "noRowsOverlayComponentParams", "suppressNoRowsOverlay", "pagination", "paginationPageSize", "paginationPageSizeSelector", "paginationAutoPageSize", "paginateChildRows", "suppressPaginationPanel", "pivotMode", "pivotPanelShow", "pivotMaxGeneratedColumns", "pivotDefaultExpanded", "pivotColumnGroupTotals", "pivotRowTotals", "pivotSuppressAutoColumn", "suppressExpandablePivotGroups", "functionsReadOnly", "aggFuncs", "suppressAggFuncInHeader", "alwaysAggregateAtRootLevel", "aggregateOnlyChangedColumns", "suppressAggFilteredOnly", "removePivotHeaderRowWhenSingleValueColumn", "animateRows", "enableCellChangeFlash", "cellFlashDuration", "cellFlashDelay", "cellFadeDuration", "cellFadeDelay", "allowShowChangeAfterFilter", "domLayout", "ensureDomOrder", "enableRtl", "suppressColumnVirtualisation", "suppressMaxRenderedRowRestriction", "suppressRowVirtualisation", "rowDragManaged", "suppressRowDrag", "suppressMoveWhenRowDragging", "rowDragEntireRow", "rowDragMultiRow", "rowDragText", "fullWidthCellRenderer", "fullWidthCellRendererParams", "embedFullWidthRows", "suppressGroupMaintainValueType", "groupDisplayType", "groupDefaultExpanded", "autoGroupColumnDef", "groupMaintainOrder", "groupSelectsChildren", "groupLockGroupColumns", "groupAggFiltering", "groupIncludeFooter", "groupIncludeTotalFooter", "groupTotalRow", "grandTotalRow", "suppressStickyTotalRow", "groupSuppressBlankHeader", "groupSelectsFiltered", "showOpenedGroup", "groupRemoveSingleChildren", "groupRemoveLowestSingleChildren", "groupHideOpenParents", "groupAllowUnbalanced", "rowGroupPanelShow", "groupRowRenderer", "groupRowRendererParams", "suppressMakeColumnVisibleAfterUnGroup", "treeData", "rowGroupPanelSuppressSort", "suppressGroupRowsSticky", "pinnedTopRowData", "pinnedBottomRowData", "rowModelType", "rowData", "asyncTransactionWaitMillis", "suppressModelUpdateAfterUpdateTransaction", "datasource", "cacheOverflowSize", "infiniteInitialRowCount", "serverSideInitialRowCount", "suppressServerSideInfiniteScroll", "suppressServerSideFullWidthLoadingRow", "cacheBlockSize", "maxBlocksInCache", "maxConcurrentDatasourceRequests", "blockLoadDebounceMillis", "purgeClosedRowNodes", "serverSideDatasource", "serverSideSortAllLevels", "serverSideEnableClientSideSort", "serverSideOnlyRefreshFilteredGroups", "serverSideSortOnServer", "serverSideFilterOnServer", "serverSidePivotResultFieldSeparator", "viewportDatasource", "viewportRowModelPageSize", "viewportRowModelBufferSize", "alwaysShowHorizontalScroll", "alwaysShowVerticalScroll", "debounceVerticalScrollbar", "suppressHorizontalScroll", "suppressScrollOnNewData", "suppressScrollWhenPopupsAreOpen", "suppressAnimationFrame", "suppressMiddleClickScrolls", "suppressPreventDefaultOnMouseWheel", "scrollbarWidth", "rowSelection", "cellSelection", "rowMultiSelectWithClick", "suppressRowDeselection", "suppressRowClickSelection", "suppressCellFocus", "suppressHeaderFocus", "selectionColumnDef", "suppressMultiRangeSelection", "enableCellTextSelection", "enableRangeSelection", "enableRangeHandle", "enableFillHandle", "fillHandleDirection", "suppressClearOnFillReduction", "sortingOrder", "accentedSort", "unSortIcon", "suppressMultiSort", "alwaysMultiSort", "multiSortKey", "suppressMaintainUnsortedOrder", "icons", "rowHeight", "rowStyle", "rowClass", "rowClassRules", "suppressRowHoverHighlight", "suppressRowTransform", "columnHoverHighlight", "gridId", "deltaSort", "treeDataDisplayType", "enableGroupEdit", "initialState", "theme", "loadThemeGoogleFonts", "getContextMenuItems", "getMainMenuItems", "postProcessPopup", "processUnpinnedColumns", "processCellForClipboard", "processHeaderForClipboard", "processGroupHeaderForClipboard", "processCellFromClipboard", "sendToClipboard", "processDataFromClipboard", "isExternalFilterPresent", "doesExternalFilterPass", "getChartToolbarItems", "createChartContainer", "focusGridInnerElement", "navigateToNextHeader", "tabToNextHeader", "navigateToNextCell", "tabToNextCell", "getLocaleText", "getDocument", "paginationNumberFormatter", "getGroupRowAgg", "isGroupOpenByDefault", "initialGroupOrderComparator", "processPivotResultColDef", "processPivotResultColGroupDef", "getDataPath", "getChildCount", "getServerSideGroupLevelParams", "isServerSideGroupOpenByDefault", "isApplyServerSideTransaction", "isServerSideGroup", "getServerSideGroupKey", "getBusinessKeyForNode", "getRowId", "resetRowDataOnUpdate", "processRowPostCreate", "isRowSelectable", "isRowMaster", "fillOperation", "postSortRows", "getRowStyle", "getRowClass", "getRowHeight", "isFullWidthRow"], outputs: ["toolPanelVisibleChanged", "toolPanelSizeChanged", "columnMenuVisibleChanged", "contextMenuVisibleChanged", "cutStart", "cutEnd", "pasteStart", "pasteEnd", "columnVisible", "columnPinned", "columnResized", "columnMoved", "columnValueChanged", "columnPivotModeChanged", "columnPivotChanged", "columnGroupOpened", "newColumnsLoaded", "gridColumnsChanged", "displayedColumnsChanged", "virtualColumnsChanged", "columnEverythingChanged", "columnHeaderMouseOver", "columnHeaderMouseLeave", "columnHeaderClicked", "columnHeaderContextMenu", "componentStateChanged", "cellValueChanged", "cellEditRequest", "rowValueChanged", "cellEditingStarted", "cellEditingStopped", "rowEditingStarted", "rowEditingStopped", "undoStarted", "undoEnded", "redoStarted", "redoEnded", "cellSelectionDeleteStart", "cellSelectionDeleteEnd", "rangeDeleteStart", "rangeDeleteEnd", "fillStart", "fillEnd", "filterOpened", "filterChanged", "filterModified", "advancedFilterBuilderVisibleChanged", "chartCreated", "chartRangeSelectionChanged", "chartOptionsChanged", "chartDestroyed", "cellKeyDown", "gridReady", "firstDataRendered", "gridSizeChanged", "modelUpdated", "virtualRowRemoved", "viewportChanged", "bodyScroll", "bodyScrollEnd", "dragStarted", "dragStopped", "dragCancelled", "stateUpdated", "paginationChanged", "rowDragEnter", "rowDragMove", "rowDragLeave", "rowDragEnd", "rowDragCancel", "columnRowGroupChanged", "rowGroupOpened", "expandOrCollapseAll", "pivotMaxColumnsExceeded", "pinnedRowDataChanged", "rowDataUpdated", "asyncTransactionsFlushed", "storeRefreshed", "headerFocused", "cellClicked", "cellDoubleClicked", "cellFocused", "cellMouseOver", "cellMouseOut", "cellMouseDown", "rowClicked", "rowDoubleClicked", "rowSelected", "selectionChanged", "cellContextMenu", "rangeSelectionChanged", "cellSelectionChanged", "tooltipShow", "tooltipHide", "sortChanged"] }, { kind: "component", type: i2$1.FormCheckComponent, selector: "c-form-check", inputs: ["inline", "reverse", "sizing", "switch"], exportAs: ["cFormCheck"] }, { kind: "directive", type: i2$1.FormCheckLabelDirective, selector: "label[cFormCheckLabel]" }, { kind: "directive", type: i2$1.FormCheckInputDirective, selector: "input[cFormCheckInput]", inputs: ["type", "indeterminate", "valid"] }, { kind: "directive", type: i3.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.ButtonDirective, selector: "[cButton]", inputs: ["active", "color", "disabled", "shape", "size", "tabindex", "type", "variant"], exportAs: ["cButton"] }, { kind: "directive", type: i2$1.ButtonCloseDirective, selector: "[cButtonClose]", inputs: ["white"] }, { kind: "component", type: i2$1.OffcanvasBodyComponent, selector: "c-offcanvas-body" }, { kind: "component", type: i2$1.OffcanvasComponent, selector: "c-offcanvas", inputs: ["backdrop", "keyboard", "placement", "responsive", "id", "role", "ariaModal", "scroll", "visible"], outputs: ["visibleChange"], exportAs: ["cOffcanvas"] }, { kind: "component", type: i2$1.OffcanvasHeaderComponent, selector: "c-offcanvas-header" }, { kind: "directive", type: i2$1.OffcanvasTitleDirective, selector: "[cOffcanvasTitle]" }, { kind: "directive", type: i2$1.OffcanvasToggleDirective, selector: "[cOffcanvasToggle]", inputs: ["cOffcanvasToggle"] }, { kind: "directive", type: i2$1.TooltipDirective, selector: "[cTooltip]", inputs: ["cTooltip", "cTooltipOptions", "cTooltipPlacement", "cTooltipRef", "cTooltipTrigger", "cTooltipVisible"], outputs: ["cTooltipVisibleChange"], exportAs: ["cTooltip"] }, { kind: "directive", type: i5.IconDirective, selector: "svg[cIcon]", inputs: ["cIcon", "customClasses", "size", "title", "height", "width", "name", "viewBox", "xmlns", "pointer-events", "role"], exportAs: ["cIcon"] }] });
|
|
2082
|
+
}
|
|
2083
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: TableGridComponent, decorators: [{
|
|
2084
|
+
type: Component,
|
|
2085
|
+
args: [{ selector: 'app-table-grid', standalone: false, template: "<div class=\"row\">\n <div class=\"col-12 d-md-flex\">\n <div class=\"table-list-wrapper flex-fill\">\n <!-- style=\"width: 100%; height: 567px\" -->\n <ag-grid-angular\n style=\"width: 100%\"\n [rowData]=\"tableConfiguration.rows\"\n [columnDefs]=\"tableConfiguration.columnDefs\"\n [defaultColDef]=\"tableConfiguration.defaultColDef\"\n [rowSelection]=\"tableConfiguration.rowSelectionOption\"\n [pagination]=\"tableConfiguration.pagination.enabled\"\n [paginationPageSize]=\"tableConfiguration.pagination.paginationPageSize\"\n [paginationPageSizeSelector]=\"tableConfiguration.pagination.paginationPageSizeSelector\"\n [class]=\"[tableConfiguration.tableClasses, tableConfiguration.tableTheme]\"\n [selectionColumnDef]=\"tableConfiguration.selectionColumnDef\"\n (gridReady)=\"onGridReady($event)\"\n (rowSelected)=\"onRowSelected($event)\"\n (rowClicked)=\"onRowClicked($event)\"\n (columnResized)=\"onColumnResized($event)\"\n (columnMoved)=\"onColumnMoved($event)\"\n (sortChanged)=\"onSortChanged($event)\"\n (paginationChanged)=\"onPaginationChanged($event)\"\n (firstDataRendered)=\"onFirstDataRendered($event)\"\n (filterChanged)=\"onFilterChanged($event)\"\n (cellValueChanged)=\"onCellValueChanged($event)\"\n [masterDetail]=\"tableConfiguration.masterDetail\"\n [detailCellRendererParams]=\"tableConfiguration.detailCellRendererParams\"\n [detailCellRenderer]=\"tableConfiguration.detailCellRenderer\"\n [enableCellTextSelection]=\"true\"\n [gridOptions]=\"gridOptions\"\n [ensureDomOrder]=\"true\"\n [tooltipShowDelay]=\"tableConfiguration.tooltipShowDelay\" />\n </div>\n\n @if (columnToolVisible && columnsListselectionForm) {\n <div class=\"columns-list ms-3 p-3 d-md-flex flex-column h-100 d-none border border-1 rounded hide columns-tool\" [id]=\"tableConfiguration.tablename\">\n <div class=\"d-flex justify-content-between align-items-center mb-3 gap-2 columns-heading\">\n <span\n class=\"cursor-pointer text-primary\"\n tooltipPlacement=\"top\"\n cTooltip=\"Column Preference\"\n [cOffcanvasToggle]=\"tableConfiguration.tablename + 'config-columns'\">\n <svg cIcon name=\"cilColumns\" size=\"xl\"></svg>\n </span>\n\n <span class=\"cursor-pointer text-primary\" tooltipPlacement=\"top\" cTooltip=\"Auto Resize Columns\" (click)=\"autoSizeAll()\">\n <svg cIcon name=\"cilResizeWidth\" size=\"xl\"></svg>\n </span>\n </div>\n </div>\n\n <c-offcanvas placement=\"end\" [id]=\"tableConfiguration.tablename + 'config-columns'\" width=\"550\">\n <c-offcanvas-header>\n <h5 cOffcanvasTitle>Table Column Preference</h5>\n <button\n cButtonClose\n size=\"sm\"\n class=\"text-reset ms-auto\"\n [cOffcanvasToggle]=\"tableConfiguration.tablename + 'config-columns'\"\n aria-label=\"Close\"></button>\n </c-offcanvas-header>\n <c-offcanvas-body>\n <div class=\"columns-wrapper mb-2\" [formGroup]=\"columnsListselectionForm\">\n @for (item of this.tableGridState; track $index) {\n <div class=\"checkbox-item px-1\">\n <c-form-check>\n <input\n (change)=\"getCheckboxStatus($event, item.key)\"\n [checked]=\"columnsListselectionForm.get(item.key)?.value\"\n cFormCheckInput\n [id]=\"'cb_' + item.key\"\n type=\"checkbox\"\n [formControl]=\"columnsListselectionForm.controls[item.key]\" />\n <label class=\"truncate-preference-label\" cFormCheckLabel [for]=\"'cb_' + item.key\" [title]=\"item?.headerName || item?.label\">\n {{ item?.headerName || item?.label }}</label\n >\n </c-form-check>\n </div>\n }\n </div>\n <div class=\"align d-flex gap-3 justify-content-end\">\n <button\n cButton\n [disabled]=\"tableConfiguration.tablePreference.disableRemovecolumn\"\n color=\"primary\"\n class=\"px-2 mt-auto\"\n variant=\"outline\"\n (click)=\"resetTablePreferenceV2()\">\n Clear\n </button>\n <button\n cButton\n [disabled]=\"tableConfiguration.tablePreference.disableResetPreference\"\n color=\"primary\"\n class=\"px-2 mt-auto\"\n variant=\"outline\"\n (click)=\"resetTablePreference()\">\n Reset\n </button>\n <button\n cButton\n [disabled]=\"tableConfiguration.tablePreference.disableUpdatePreference\"\n color=\"primary\"\n class=\"px-2 mt-auto\"\n variant=\"outline\"\n (click)=\"updatetablePreference()\">\n Update\n </button>\n </div>\n </c-offcanvas-body>\n </c-offcanvas>\n }\n </div>\n</div>\n", styles: [".offcanvas.offcanvas-end{--cui-offcanvas-width: 350px}.border{--cui-border-color: color-mix(in srgb, transparent, #181d1f 15%)}.columns-list{width:210px;transition:width .2s ease-in,padding .2s ease-in;overflow:hidden;display:flex;flex-direction:column;max-height:calc(100vh - 210px)}.default-ag-layout{height:calc(100vh - 210px)}.small-table-container{max-height:calc(100vh - 210px)}.columns-wrapper{flex-grow:1;overflow-y:auto;overflow-x:hidden;transition:opacity .2s ease-in,height .2s ease-in;opacity:1;height:calc(92vh - 93px);overflow:auto}.columns-tool.hide{width:32px;transition:width .2s ease-in,padding .2s ease-in}.columns-tool.hide button,.columns-tool.hide .columns-wrapper{opacity:0;height:0;pointer-events:none}.columns-tool.hide .columns-heading{flex-direction:column}.columns-tool.hide .columns-heading p{margin:50px 0 0;writing-mode:vertical-rl;text-orientation:mixed;letter-spacing:4px;font-size:.8rem;transition:margin .2s ease-in,font-size .2s ease-in}.columns-tool button{transform:scale(1);opacity:1;transition:opacity .2s ease-in,transform .1s ease-in;will-change:opacity,transform;height:40px}.columns-tool.hide button{opacity:0;transform:scale(.95)}.columns-heading{display:flex;justify-content:space-between;align-items:center;transition:flex-direction .2s ease-in}.columns-heading p{margin:0;font-size:1rem;text-align:center;letter-spacing:normal}.truncate-preference-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n"] }]
|
|
2086
|
+
}], ctorParameters: () => [], propDecorators: { tableConfiguration: [{
|
|
2087
|
+
type: Input
|
|
2088
|
+
}], columnToolVisible: [{
|
|
2089
|
+
type: Input
|
|
2090
|
+
}], initialPageNumber: [{
|
|
2091
|
+
type: Input
|
|
2092
|
+
}], tableGridReady: [{
|
|
2093
|
+
type: Output
|
|
2094
|
+
}], tableRowSelection: [{
|
|
2095
|
+
type: Output
|
|
2096
|
+
}], tableRowClicked: [{
|
|
2097
|
+
type: Output
|
|
2098
|
+
}], columnStateEvent: [{
|
|
2099
|
+
type: Output
|
|
2100
|
+
}], pageChange: [{
|
|
2101
|
+
type: Output
|
|
2102
|
+
}], filterChanged: [{
|
|
2103
|
+
type: Output
|
|
2104
|
+
}], cellValueChanged: [{
|
|
2105
|
+
type: Output
|
|
2106
|
+
}] } });
|
|
2107
|
+
|
|
2108
|
+
ModuleRegistry.registerModules([ClientSideRowModelModule, CsvExportModule, _EditCoreModule]);
|
|
2109
|
+
class TableGridModule {
|
|
2110
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: TableGridModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2111
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.9", ngImport: i0, type: TableGridModule, declarations: [TableGridComponent], imports: [CommonModule, AgGridModule, FormModule, ReactiveFormsModule, ButtonModule, OffcanvasModule, TooltipModule, IconModule], exports: [TableGridComponent] });
|
|
2112
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: TableGridModule, imports: [CommonModule, AgGridModule, FormModule, ReactiveFormsModule, ButtonModule, OffcanvasModule, TooltipModule, IconModule] });
|
|
2113
|
+
}
|
|
2114
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: TableGridModule, decorators: [{
|
|
2115
|
+
type: NgModule,
|
|
2116
|
+
args: [{
|
|
2117
|
+
declarations: [TableGridComponent],
|
|
2118
|
+
imports: [CommonModule, AgGridModule, FormModule, ReactiveFormsModule, ButtonModule, OffcanvasModule, TooltipModule, IconModule],
|
|
2119
|
+
exports: [TableGridComponent]
|
|
2120
|
+
}]
|
|
2121
|
+
}] });
|
|
2122
|
+
|
|
2123
|
+
class ITableGridConfiguration {
|
|
2124
|
+
initialState;
|
|
2125
|
+
columnDefs = [];
|
|
2126
|
+
rows;
|
|
2127
|
+
defaultColDef;
|
|
2128
|
+
rowSelectionOption;
|
|
2129
|
+
pagination;
|
|
2130
|
+
themeClass;
|
|
2131
|
+
tableTheme;
|
|
2132
|
+
tablename;
|
|
2133
|
+
selectionColumnDef;
|
|
2134
|
+
tablePreference;
|
|
2135
|
+
detailCellRendererParams;
|
|
2136
|
+
detailCellRenderer;
|
|
2137
|
+
frameworkComponents;
|
|
2138
|
+
tooltipShowDelay;
|
|
2139
|
+
masterDetail;
|
|
2140
|
+
tableClasses = ['default-ag-layout'];
|
|
2141
|
+
defaultGridOptions;
|
|
2142
|
+
constructor() {
|
|
2143
|
+
this.pagination = new ITableGridPagination();
|
|
2144
|
+
this.tablename = '';
|
|
2145
|
+
this.tableTheme = '';
|
|
2146
|
+
this.defaultColDef = {
|
|
2147
|
+
filter: 'agTextColumnFilter',
|
|
2148
|
+
floatingFilter: false
|
|
2149
|
+
};
|
|
2150
|
+
this.themeClass = 'ag-theme-quartz';
|
|
2151
|
+
this.rowSelectionOption = {
|
|
2152
|
+
enableClickSelection: true,
|
|
2153
|
+
mode: 'singleRow',
|
|
2154
|
+
checkboxes: false
|
|
2155
|
+
};
|
|
2156
|
+
this.masterDetail = false;
|
|
2157
|
+
this.tablePreference = { disableRemovecolumn: false, disableResetPreference: false, disableUpdatePreference: false };
|
|
2158
|
+
this.tooltipShowDelay = 100;
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2161
|
+
class ITableGridPagination {
|
|
2162
|
+
configurationService = inject(ConfigurationServiceLib);
|
|
2163
|
+
enabled = true;
|
|
2164
|
+
paginationPageSize = this.configurationService.allConfigValues()?.tableGridConfig.defaultPageSize || 20;
|
|
2165
|
+
paginationPageSizeSelector = this.configurationService.allConfigValues()?.tableGridConfig.defaultPageSizeSelector || false;
|
|
2166
|
+
}
|
|
2167
|
+
|
|
1425
2168
|
/*
|
|
1426
2169
|
* Public API Surface of utils
|
|
1427
2170
|
*/
|
|
@@ -1430,5 +2173,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
|
|
|
1430
2173
|
* Generated bundle index. Do not edit.
|
|
1431
2174
|
*/
|
|
1432
2175
|
|
|
1433
|
-
export { CheckboxCellRendererComponent, ColorCellRendererComponent, CommentsButtonCellRendererComponent, ConfigurationServiceLib, CustomSelectFilterComponent, EditionListGroupedComponent, FormFieldType, IndustryUpdateListboxCellRendererComponent, MultiFormComponent, MultiFormModule, PageStatusCellRendererComponent };
|
|
2176
|
+
export { CheckboxCellRendererComponent, ColorCellRendererComponent, CommentsButtonCellRendererComponent, ConfigurationServiceLib, CustomSelectFilterComponent, EditionListGroupedComponent, FormFieldType, GenericFilterModelComponent, ITableGridConfiguration, ITableGridPagination, IndustryUpdateListboxCellRendererComponent, MultiFormComponent, MultiFormModule, PageStatusCellRendererComponent, StatusSelectCellRendererComponent, TableGridComponent, TableGridModule };
|
|
1434
2177
|
//# sourceMappingURL=pongrass-utils.mjs.map
|