ngx-eiffage-material 0.0.7 → 0.0.9

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.
@@ -1,12 +1,12 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, Component, Injectable, inject, output, computed, viewChild, effect, signal, forwardRef } from '@angular/core';
3
- import * as i4 from '@angular/material/button';
2
+ import { input, Component, Injectable, inject, output, computed, viewChild, effect, ChangeDetectorRef, signal, untracked, forwardRef, ViewEncapsulation } from '@angular/core';
3
+ import * as i1 from '@angular/material/button';
4
4
  import { MatButtonModule } from '@angular/material/button';
5
- import * as i6 from '@angular/material/icon';
5
+ import * as i4 from '@angular/material/icon';
6
6
  import { MatIconModule } from '@angular/material/icon';
7
7
  import * as i2 from '@angular/material/progress-spinner';
8
8
  import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
9
- import * as i1 from '@angular/material/card';
9
+ import * as i1$1 from '@angular/material/card';
10
10
  import { MatCardModule } from '@angular/material/card';
11
11
  import * as i3 from '@angular/material/sort';
12
12
  import { MatSortModule } from '@angular/material/sort';
@@ -19,11 +19,25 @@ import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
19
19
  import * as i8 from 'ngx-skeleton-loader';
20
20
  import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
21
21
  import { SlicePipe, TitleCasePipe, LowerCasePipe, UpperCasePipe, DecimalPipe, PercentPipe, CurrencyPipe, DatePipe, CommonModule } from '@angular/common';
22
- import { ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
22
+ import * as i5$1 from '@angular/forms';
23
+ import { FormControl, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
24
+ import * as i6 from '@angular/material/chips';
23
25
  import { MatChipsModule } from '@angular/material/chips';
26
+ import * as i2$2 from '@angular/material/form-field';
24
27
  import { MatFormFieldModule } from '@angular/material/form-field';
28
+ import * as i7$1 from '@angular/material/progress-bar';
25
29
  import { MatProgressBarModule } from '@angular/material/progress-bar';
30
+ import * as i1$2 from '@angular/material/input';
26
31
  import { MatInputModule } from '@angular/material/input';
32
+ import * as i3$1 from '@angular/material/select';
33
+ import { MatSelectModule } from '@angular/material/select';
34
+ import { MatBottomSheetRef, MAT_BOTTOM_SHEET_DATA, MatBottomSheet, MatBottomSheetModule } from '@angular/material/bottom-sheet';
35
+ import { Subject, debounceTime, distinctUntilChanged, takeUntil } from 'rxjs';
36
+ import { toSignal, toObservable, rxResource } from '@angular/core/rxjs-interop';
37
+ import * as i2$3 from '@angular/material/divider';
38
+ import { MatDividerModule } from '@angular/material/divider';
39
+ import * as i8$1 from '@angular/material/list';
40
+ import { MatListModule } from '@angular/material/list';
27
41
 
28
42
  class NgxLoadingButton {
29
43
  isLoading = input.required(...(ngDevMode ? [{ debugName: "isLoading" }] : [])); //Indica si el botón está cargando
@@ -36,7 +50,7 @@ class NgxLoadingButton {
36
50
  //Por defecto es Primary
37
51
  color = input(undefined, ...(ngDevMode ? [{ debugName: "color" }] : [])); //Color del botón
38
52
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: NgxLoadingButton, deps: [], target: i0.ɵɵFactoryTarget.Component });
39
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: NgxLoadingButton, isStandalone: true, selector: "ngx-loading-button", inputs: { isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, matButton: { classPropertyName: "matButton", publicName: "matButton", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, spinnerDiameter: { classPropertyName: "spinnerDiameter", publicName: "spinnerDiameter", isSignal: true, isRequired: false, transformFunction: null }, spinnerStrokeWidth: { classPropertyName: "spinnerStrokeWidth", publicName: "spinnerStrokeWidth", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<button\r\n class=\"loadingButton\"\r\n [matButton]=\"matButton()\"\r\n [type]=\"type()\"\r\n [disabled]=\"disabled() || isLoading()\"\r\n [class.isLoading]=\"isLoading()\"\r\n [class]=\"color() ?? ''\"\r\n>\r\n {{ label() }}\r\n</button>\r\n\r\n@if (isLoading()) {\r\n <mat-spinner\r\n class=\"spinnerLoadingButton\"\r\n [diameter]=\"spinnerDiameter()\"\r\n [strokeWidth]=\"spinnerStrokeWidth()\"\r\n />\r\n}\r\n", styles: [":host{display:inline-flex;position:relative}.loadingButton{width:100%}.spinnerLoadingButton{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.isLoading{--mat-button-filled-disabled-label-text-color: transparent;--mat-button-outlined-disabled-label-text-color: transparent;--mat-button-protected-disabled-label-text-color: transparent;--mat-button-text-disabled-label-text-color: transparent;--mat-button-tonal-disabled-label-text-color: transparent}.secondary{--mat-button-filled-container-color: var(--mat-sys-secondary);--mat-button-filled-label-text-color: var(--mat-sys-on-secondary);--mat-button-outlined-label-text-color: var(--mat-sys-secondary);--mat-button-outlined-state-layer-color: var(--mat-sys-secondary);--mat-button-outlined-ripple-color: var(--mat-sys-secondary-container);--mat-button-protected-label-text-color: var(--mat-sys-secondary);--mat-button-protected-state-layer-color: var(--mat-sys-secondary);--mat-button-protected-ripple-color: var(--mat-sys-secondary-container);--mat-button-text-label-text-color: var(--mat-sys-secondary);--mat-button-text-state-layer-color: var(--mat-sys-secondary);--mat-button-text-ripple-color: var(--mat-sys-secondary-container)}.secondarySpinner{--mat-progress-spinner-active-indicator-color: var(--mat-sys-secondary)}.tertiary{--mat-button-filled-container-color: var(--mat-sys-tertiary);--mat-button-filled-label-text-color: var(--mat-sys-on-tertiary);--mat-button-outlined-label-text-color: var(--mat-sys-tertiary);--mat-button-outlined-state-layer-color: var(--mat-sys-tertiary);--mat-button-outlined-ripple-color: var(--mat-sys-tertiary-container);--mat-button-protected-label-text-color: var(--mat-sys-tertiary);--mat-button-protected-state-layer-color: var(--mat-sys-tertiary);--mat-button-protected-ripple-color: var(--mat-sys-tertiary-container);--mat-button-text-label-text-color: var(--mat-sys-tertiary);--mat-button-text-state-layer-color: var(--mat-sys-tertiary);--mat-button-text-ripple-color: var(--mat-sys-tertiary-container)}.tertiarySpinner{--mat-progress-spinner-active-indicator-color: var(--mat-sys-tertiary)}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i2.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatIconModule }] });
53
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: NgxLoadingButton, isStandalone: true, selector: "ngx-loading-button", inputs: { isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, matButton: { classPropertyName: "matButton", publicName: "matButton", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, spinnerDiameter: { classPropertyName: "spinnerDiameter", publicName: "spinnerDiameter", isSignal: true, isRequired: false, transformFunction: null }, spinnerStrokeWidth: { classPropertyName: "spinnerStrokeWidth", publicName: "spinnerStrokeWidth", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<button\r\n class=\"loadingButton\"\r\n [matButton]=\"matButton()\"\r\n [type]=\"type()\"\r\n [disabled]=\"disabled() || isLoading()\"\r\n [class.isLoading]=\"isLoading()\"\r\n [class]=\"color() ?? ''\"\r\n>\r\n {{ label() }}\r\n</button>\r\n\r\n@if (isLoading()) {\r\n <mat-spinner\r\n class=\"spinnerLoadingButton\"\r\n [diameter]=\"spinnerDiameter()\"\r\n [strokeWidth]=\"spinnerStrokeWidth()\"\r\n />\r\n}\r\n", styles: [":host{display:inline-flex;position:relative}.loadingButton{width:100%}.spinnerLoadingButton{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.isLoading{--mat-button-filled-disabled-label-text-color: transparent;--mat-button-outlined-disabled-label-text-color: transparent;--mat-button-protected-disabled-label-text-color: transparent;--mat-button-text-disabled-label-text-color: transparent;--mat-button-tonal-disabled-label-text-color: transparent}.secondary{--mat-button-filled-container-color: var(--mat-sys-secondary);--mat-button-filled-label-text-color: var(--mat-sys-on-secondary);--mat-button-outlined-label-text-color: var(--mat-sys-secondary);--mat-button-outlined-state-layer-color: var(--mat-sys-secondary);--mat-button-outlined-ripple-color: var(--mat-sys-secondary-container);--mat-button-protected-label-text-color: var(--mat-sys-secondary);--mat-button-protected-state-layer-color: var(--mat-sys-secondary);--mat-button-protected-ripple-color: var(--mat-sys-secondary-container);--mat-button-text-label-text-color: var(--mat-sys-secondary);--mat-button-text-state-layer-color: var(--mat-sys-secondary);--mat-button-text-ripple-color: var(--mat-sys-secondary-container)}.secondarySpinner{--mat-progress-spinner-active-indicator-color: var(--mat-sys-secondary)}.tertiary{--mat-button-filled-container-color: var(--mat-sys-tertiary);--mat-button-filled-label-text-color: var(--mat-sys-on-tertiary);--mat-button-outlined-label-text-color: var(--mat-sys-tertiary);--mat-button-outlined-state-layer-color: var(--mat-sys-tertiary);--mat-button-outlined-ripple-color: var(--mat-sys-tertiary-container);--mat-button-protected-label-text-color: var(--mat-sys-tertiary);--mat-button-protected-state-layer-color: var(--mat-sys-tertiary);--mat-button-protected-ripple-color: var(--mat-sys-tertiary-container);--mat-button-text-label-text-color: var(--mat-sys-tertiary);--mat-button-text-state-layer-color: var(--mat-sys-tertiary);--mat-button-text-ripple-color: var(--mat-sys-tertiary-container)}.tertiarySpinner{--mat-progress-spinner-active-indicator-color: var(--mat-sys-tertiary)}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i2.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatIconModule }] });
40
54
  }
41
55
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: NgxLoadingButton, decorators: [{
42
56
  type: Component,
@@ -195,7 +209,7 @@ class CommonTableComponent {
195
209
  update = output();
196
210
  delete = output();
197
211
  //computed
198
- displayedColumns = computed(() => this.tableConfig().displayedColumns, ...(ngDevMode ? [{ debugName: "displayedColumns" }] : []));
212
+ displayedColumns = computed(() => this.tableConfig().tableColumns.map(column => column.key), ...(ngDevMode ? [{ debugName: "displayedColumns" }] : []));
199
213
  datasource = computed(() => new MatTableDataSource(), ...(ngDevMode ? [{ debugName: "datasource" }] : []));
200
214
  paginator = viewChild(MatPaginator, ...(ngDevMode ? [{ debugName: "paginator" }] : []));
201
215
  constructor() {
@@ -208,7 +222,7 @@ class CommonTableComponent {
208
222
  });
209
223
  }
210
224
  getAllColumns() {
211
- const columns = [...this.tableConfig().displayedColumns];
225
+ const columns = [...this.displayedColumns()];
212
226
  if (this.hasActions()) {
213
227
  columns.push('actions');
214
228
  }
@@ -246,7 +260,7 @@ class CommonTableComponent {
246
260
  this.delete.emit(row);
247
261
  }
248
262
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: CommonTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
249
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: CommonTableComponent, isStandalone: true, selector: "common-table", inputs: { tableConfig: { classPropertyName: "tableConfig", publicName: "tableConfig", isSignal: true, isRequired: true, transformFunction: null }, tableData: { classPropertyName: "tableData", publicName: "tableData", isSignal: true, isRequired: true, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { create: "create", view: "view", download: "download", update: "update", delete: "delete" }, viewQueries: [{ propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true, isSignal: true }], ngImport: i0, template: "<mat-card>\r\n <div class=\"tableContainer\">\r\n <div class=\"tableHeader\">\r\n <div class=\"tableHeader__title\">\r\n <span>{{ tableConfig().title }}</span>\r\n </div>\r\n <div class=\"tableHeader__buttons\">\r\n @if(canDoAction('canCreate')) {\r\n <button mat-raised-button type=\"button\" (click)=\"onCreateClick()\">\r\n <mat-icon>add</mat-icon>\r\n <span>Create</span>\r\n </button>\r\n }\r\n </div>\r\n </div>\r\n @if(isLoading()) {\r\n <ngx-skeleton-loader [count]=\"tableConfig().skeletonConfig?.count || 5\" />\r\n } @else { \r\n <div class=\"overflowTable\">\r\n <table mat-table class=\"mat-elevation-z8\" [dataSource]=\"datasource()\" class=\"customTable\" matSort>\r\n @for(column of tableConfig().tableColumns; track column.key) {\r\n <!-- Dynamically generate columns -->\r\n <ng-container [matColumnDef]=\"column.key\">\r\n <!-- Header cell definition -->\r\n <th mat-header-cell *matHeaderCellDef>{{ column.displayName }}</th>\r\n \r\n <!-- Data cell definition -->\r\n <td mat-cell *matCellDef=\"let row\">\r\n @switch (column.type) {\r\n @case ('button') {\r\n @if(_commonTableService.isButtonVisible(column, row)) {\r\n <button\r\n [matButton]=\"column.buttonConfig?.variant || 'filled'\"\r\n [class]=\"column.buttonConfig?.color\"\r\n [disabled]=\"_commonTableService.isButtonDisabled(column, row)\"\r\n [matTooltip]=\"column.buttonConfig?.tooltip || ''\"\r\n (click)=\"_commonTableService.onCustomButtonClick(column, row)\"\r\n >\r\n @if(column.buttonConfig?.icon) {\r\n <mat-icon>{{ column.buttonConfig?.icon }}</mat-icon>\r\n }\r\n @if(column.buttonConfig?.text) {\r\n {{ column.buttonConfig?.text }}\r\n }\r\n </button>\r\n }\r\n }\r\n @case ('icon-button') {\r\n @if(_commonTableService.isButtonVisible(column, row)) {\r\n <button \r\n matIconButton\r\n [class]=\"column.buttonConfig?.color\"\r\n [disabled]=\"_commonTableService.isButtonDisabled(column, row)\"\r\n [matTooltip]=\"column.buttonConfig?.tooltip || ''\"\r\n (click)=\"_commonTableService.onCustomButtonClick(column, row)\"\r\n >\r\n @if(column.buttonConfig?.icon) {\r\n <mat-icon>{{ column.buttonConfig?.icon }}</mat-icon>\r\n }\r\n </button>\r\n }\r\n }\r\n @case ('link') {\r\n @if(_commonTableService.isLinkVisible(column, row)) {\r\n <!-- External link -->\r\n @if(_commonTableService.getLinkHref(column, row)) {\r\n <a\r\n [style]=\"{ display: 'flex', alignItems: 'center', gap: '2px' }\"\r\n [href]=\"_commonTableService.getLinkHref(column, row)\"\r\n [target]=\"column.linkConfig?.target || '_blank'\"\r\n [matTooltip]=\"column.linkConfig?.tooltip || ''\"\r\n [style.color]=\"column.linkConfig?.color || 'primary'\"\r\n [style.text-decoration]=\"column.linkConfig?.underline ? 'underline' : 'none'\"\r\n >\r\n @if(column.linkConfig?.icon) {\r\n <mat-icon>{{ column.linkConfig?.icon }}</mat-icon>\r\n }\r\n @if(column.linkConfig?.text) {\r\n {{ column.linkConfig?.text }}\r\n }\r\n </a>\r\n }\r\n }\r\n }\r\n <!-- Text is by default -->\r\n @default {\r\n {{ _commonTableService.getCellValue(column, row) }}\r\n }\r\n }\r\n </td>\r\n </ng-container>\r\n }\r\n \r\n <!-- Actions Column -->\r\n @if(hasActions()) {\r\n <ng-container matColumnDef=\"actions\">\r\n <th mat-header-cell *matHeaderCellDef>Actions</th>\r\n <td mat-cell *matCellDef=\"let row\">\r\n @if(canDoAction('canView', row)) {\r\n <button matIconButton (click)=\"onViewClick(row)\">\r\n <mat-icon>visibility</mat-icon>\r\n </button>\r\n }\r\n @if(canDoAction('canDownload', row)) {\r\n <button matIconButton (click)=\"onDownloadClick(row)\">\r\n <mat-icon>download</mat-icon>\r\n </button>\r\n }\r\n @if(canDoAction('canUpdate', row)) {\r\n <button matIconButton (click)=\"onUpdateClick(row)\">\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n }\r\n @if(canDoAction('canDelete', row)) {\r\n <button matIconButton (click)=\"onDeleteClick(row)\">\r\n <mat-icon>delete</mat-icon>\r\n </button>\r\n }\r\n </td>\r\n </ng-container>\r\n }\r\n \r\n <tr mat-header-row *matHeaderRowDef=\"getAllColumns()\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: getAllColumns();\"></tr>\r\n <tr *matNoDataRow>No data available</tr>\r\n </table>\r\n <mat-paginator\r\n #paginator\r\n [length]=\"datasource().data.length\"\r\n [pageSize]=\"5\"\r\n [pageSizeOptions]=\"[5, 10, 25, 100]\"\r\n />\r\n </div>\r\n }\r\n\r\n </div>\r\n</mat-card>", styles: [".tableContainer{display:flex;flex-direction:column;padding:16px 8px;gap:12px}.tableContainer .tableHeader{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:0 0 0 8px}.tableContainer .tableHeader__title{font-size:16px;font-weight:500}.tableContainer .tableHeader__buttons{display:flex;flex-direction:row;align-items:center;gap:8px}.tableContainer .tableHeader__buttons button{padding:0 16px;height:28px;box-shadow:0 1px 2px #0000001a,0 1px 3px 2px #0000000d;border-radius:4px}.overflowTable{overflow-x:auto;width:100%}.secondary{--mat-button-filled-container-color: var(--mat-sys-secondary);--mat-button-filled-label-text-color: var(--mat-sys-on-secondary);--mat-button-outlined-label-text-color: var(--mat-sys-secondary);--mat-button-outlined-state-layer-color: var(--mat-sys-secondary);--mat-button-outlined-ripple-color: var(--mat-sys-secondary-container);--mat-button-protected-label-text-color: var(--mat-sys-secondary);--mat-button-protected-state-layer-color: var(--mat-sys-secondary);--mat-button-protected-ripple-color: var(--mat-sys-secondary-container);--mat-button-text-label-text-color: var(--mat-sys-secondary);--mat-button-text-state-layer-color: var(--mat-sys-secondary);--mat-button-text-ripple-color: var(--mat-sys-secondary-container)}.tertiary{--mat-button-filled-container-color: var(--mat-sys-tertiary);--mat-button-filled-label-text-color: var(--mat-sys-on-tertiary);--mat-button-outlined-label-text-color: var(--mat-sys-tertiary);--mat-button-outlined-state-layer-color: var(--mat-sys-tertiary);--mat-button-outlined-ripple-color: var(--mat-sys-tertiary-container);--mat-button-protected-label-text-color: var(--mat-sys-tertiary);--mat-button-protected-state-layer-color: var(--mat-sys-tertiary);--mat-button-protected-ripple-color: var(--mat-sys-tertiary-container);--mat-button-text-label-text-color: var(--mat-sys-tertiary);--mat-button-text-state-layer-color: var(--mat-sys-tertiary);--mat-button-text-ripple-color: var(--mat-sys-tertiary-container)}\n"], dependencies: [{ kind: "ngmodule", type: MatCardModule }, { kind: "component", type: i1.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i2$1.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i2$1.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i2$1.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i2$1.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i2$1.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i2$1.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i2$1.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i2$1.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i2$1.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i2$1.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: i2$1.MatNoDataRow, selector: "ng-template[matNoDataRow]" }, { kind: "ngmodule", type: MatSortModule }, { kind: "directive", type: i3.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatPaginatorModule }, { kind: "component", type: i7.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "ngmodule", type: NgxSkeletonLoaderModule }, { kind: "component", type: i8.NgxSkeletonLoaderComponent, selector: "ngx-skeleton-loader", inputs: ["count", "loadingText", "appearance", "animation", "ariaLabel", "theme", "size"] }] });
263
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: CommonTableComponent, isStandalone: true, selector: "common-table", inputs: { tableConfig: { classPropertyName: "tableConfig", publicName: "tableConfig", isSignal: true, isRequired: true, transformFunction: null }, tableData: { classPropertyName: "tableData", publicName: "tableData", isSignal: true, isRequired: true, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { create: "create", view: "view", download: "download", update: "update", delete: "delete" }, viewQueries: [{ propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true, isSignal: true }], ngImport: i0, template: "<mat-card>\r\n <div class=\"tableContainer\">\r\n <div class=\"tableHeader\">\r\n <div class=\"tableHeader__title\">\r\n <span>{{ tableConfig().title }}</span>\r\n </div>\r\n <div class=\"tableHeader__buttons\">\r\n @if(canDoAction('canCreate')) {\r\n <button mat-raised-button type=\"button\" (click)=\"onCreateClick()\">\r\n <mat-icon>add</mat-icon>\r\n <span>Create</span>\r\n </button>\r\n }\r\n </div>\r\n </div>\r\n @if(isLoading()) {\r\n <ngx-skeleton-loader [count]=\"tableConfig().skeletonConfig?.count || 5\" />\r\n } @else { \r\n <div class=\"overflowTable\">\r\n <table mat-table class=\"mat-elevation-z8\" [dataSource]=\"datasource()\" class=\"customTable\" matSort>\r\n @for(column of tableConfig().tableColumns; track column.key) {\r\n <!-- Dynamically generate columns -->\r\n <ng-container [matColumnDef]=\"column.key\">\r\n <!-- Header cell definition -->\r\n <th mat-header-cell *matHeaderCellDef>{{ column.displayName }}</th>\r\n \r\n <!-- Data cell definition -->\r\n <td mat-cell *matCellDef=\"let row\">\r\n @switch (column.type) {\r\n @case ('button') {\r\n @if(_commonTableService.isButtonVisible(column, row)) {\r\n <button\r\n [matButton]=\"column.buttonConfig?.variant || 'filled'\"\r\n [class]=\"column.buttonConfig?.color\"\r\n [disabled]=\"_commonTableService.isButtonDisabled(column, row)\"\r\n [matTooltip]=\"column.buttonConfig?.tooltip || ''\"\r\n (click)=\"_commonTableService.onCustomButtonClick(column, row)\"\r\n >\r\n @if(column.buttonConfig?.icon) {\r\n <mat-icon>{{ column.buttonConfig?.icon }}</mat-icon>\r\n }\r\n @if(column.buttonConfig?.text) {\r\n {{ column.buttonConfig?.text }}\r\n }\r\n </button>\r\n }\r\n }\r\n @case ('icon-button') {\r\n @if(_commonTableService.isButtonVisible(column, row)) {\r\n <button \r\n matIconButton\r\n [class]=\"column.buttonConfig?.color\"\r\n [disabled]=\"_commonTableService.isButtonDisabled(column, row)\"\r\n [matTooltip]=\"column.buttonConfig?.tooltip || ''\"\r\n (click)=\"_commonTableService.onCustomButtonClick(column, row)\"\r\n >\r\n @if(column.buttonConfig?.icon) {\r\n <mat-icon>{{ column.buttonConfig?.icon }}</mat-icon>\r\n }\r\n </button>\r\n }\r\n }\r\n @case ('link') {\r\n @if(_commonTableService.isLinkVisible(column, row)) {\r\n <!-- External link -->\r\n @if(_commonTableService.getLinkHref(column, row)) {\r\n <a\r\n [style]=\"{ display: 'flex', alignItems: 'center', gap: '2px' }\"\r\n [href]=\"_commonTableService.getLinkHref(column, row)\"\r\n [target]=\"column.linkConfig?.target || '_blank'\"\r\n [matTooltip]=\"column.linkConfig?.tooltip || ''\"\r\n [style.color]=\"column.linkConfig?.color || 'primary'\"\r\n [style.text-decoration]=\"column.linkConfig?.underline ? 'underline' : 'none'\"\r\n >\r\n @if(column.linkConfig?.icon) {\r\n <mat-icon>{{ column.linkConfig?.icon }}</mat-icon>\r\n }\r\n @if(column.linkConfig?.text) {\r\n {{ column.linkConfig?.text }}\r\n }\r\n </a>\r\n }\r\n }\r\n }\r\n <!-- Text is by default -->\r\n @default {\r\n {{ _commonTableService.getCellValue(column, row) }}\r\n }\r\n }\r\n </td>\r\n </ng-container>\r\n }\r\n \r\n <!-- Actions Column -->\r\n @if(hasActions()) {\r\n <ng-container matColumnDef=\"actions\">\r\n <th mat-header-cell *matHeaderCellDef>Actions</th>\r\n <td mat-cell *matCellDef=\"let row\">\r\n @if(canDoAction('canView', row)) {\r\n <button matIconButton (click)=\"onViewClick(row)\">\r\n <mat-icon>visibility</mat-icon>\r\n </button>\r\n }\r\n @if(canDoAction('canDownload', row)) {\r\n <button matIconButton (click)=\"onDownloadClick(row)\">\r\n <mat-icon>download</mat-icon>\r\n </button>\r\n }\r\n @if(canDoAction('canUpdate', row)) {\r\n <button matIconButton (click)=\"onUpdateClick(row)\">\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n }\r\n @if(canDoAction('canDelete', row)) {\r\n <button matIconButton (click)=\"onDeleteClick(row)\">\r\n <mat-icon>delete</mat-icon>\r\n </button>\r\n }\r\n </td>\r\n </ng-container>\r\n }\r\n \r\n <tr mat-header-row *matHeaderRowDef=\"getAllColumns()\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: getAllColumns();\"></tr>\r\n <tr *matNoDataRow>No data available</tr>\r\n </table>\r\n <mat-paginator\r\n #paginator\r\n [length]=\"datasource().data.length\"\r\n [pageSize]=\"5\"\r\n [pageSizeOptions]=\"[5, 10, 25, 100]\"\r\n />\r\n </div>\r\n }\r\n\r\n </div>\r\n</mat-card>", styles: [".tableContainer{display:flex;flex-direction:column;padding:16px 8px;gap:12px}.tableContainer .tableHeader{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:0 0 0 8px}.tableContainer .tableHeader__title{font-size:16px;font-weight:500}.tableContainer .tableHeader__buttons{display:flex;flex-direction:row;align-items:center;gap:8px}.tableContainer .tableHeader__buttons button{padding:0 16px;height:28px;box-shadow:0 1px 2px #0000001a,0 1px 3px 2px #0000000d;border-radius:4px}.overflowTable{overflow-x:auto;width:100%}.secondary{--mat-button-filled-container-color: var(--mat-sys-secondary);--mat-button-filled-label-text-color: var(--mat-sys-on-secondary);--mat-button-outlined-label-text-color: var(--mat-sys-secondary);--mat-button-outlined-state-layer-color: var(--mat-sys-secondary);--mat-button-outlined-ripple-color: var(--mat-sys-secondary-container);--mat-button-protected-label-text-color: var(--mat-sys-secondary);--mat-button-protected-state-layer-color: var(--mat-sys-secondary);--mat-button-protected-ripple-color: var(--mat-sys-secondary-container);--mat-button-text-label-text-color: var(--mat-sys-secondary);--mat-button-text-state-layer-color: var(--mat-sys-secondary);--mat-button-text-ripple-color: var(--mat-sys-secondary-container)}.tertiary{--mat-button-filled-container-color: var(--mat-sys-tertiary);--mat-button-filled-label-text-color: var(--mat-sys-on-tertiary);--mat-button-outlined-label-text-color: var(--mat-sys-tertiary);--mat-button-outlined-state-layer-color: var(--mat-sys-tertiary);--mat-button-outlined-ripple-color: var(--mat-sys-tertiary-container);--mat-button-protected-label-text-color: var(--mat-sys-tertiary);--mat-button-protected-state-layer-color: var(--mat-sys-tertiary);--mat-button-protected-ripple-color: var(--mat-sys-tertiary-container);--mat-button-text-label-text-color: var(--mat-sys-tertiary);--mat-button-text-state-layer-color: var(--mat-sys-tertiary);--mat-button-text-ripple-color: var(--mat-sys-tertiary-container)}\n"], dependencies: [{ kind: "ngmodule", type: MatCardModule }, { kind: "component", type: i1$1.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i2$1.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i2$1.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i2$1.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i2$1.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i2$1.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i2$1.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i2$1.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i2$1.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i2$1.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i2$1.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: i2$1.MatNoDataRow, selector: "ng-template[matNoDataRow]" }, { kind: "ngmodule", type: MatSortModule }, { kind: "directive", type: i3.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i1.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatPaginatorModule }, { kind: "component", type: i7.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "ngmodule", type: NgxSkeletonLoaderModule }, { kind: "component", type: i8.NgxSkeletonLoaderComponent, selector: "ngx-skeleton-loader", inputs: ["count", "loadingText", "appearance", "animation", "ariaLabel", "theme", "size"] }] });
250
264
  }
251
265
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: CommonTableComponent, decorators: [{
252
266
  type: Component,
@@ -309,11 +323,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
309
323
  }] });
310
324
 
311
325
  class NgxInputFile {
326
+ // dependencies injection
327
+ _cdr = inject(ChangeDetectorRef);
312
328
  value = signal([], ...(ngDevMode ? [{ debugName: "value" }] : []));
313
329
  onChangeCb;
314
330
  onTouchCb;
315
- disabled = signal(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
316
331
  label = input('Seleccionar archivo', ...(ngDevMode ? [{ debugName: "label" }] : []));
332
+ control = input.required(...(ngDevMode ? [{ debugName: "control" }] : []));
333
+ disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
317
334
  placeholder = input('Haz click o arrastra archivos aquí', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
318
335
  class = input('', ...(ngDevMode ? [{ debugName: "class" }] : []));
319
336
  accept = input([], ...(ngDevMode ? [{ debugName: "accept" }] : []));
@@ -322,9 +339,41 @@ class NgxInputFile {
322
339
  error = input('', ...(ngDevMode ? [{ debugName: "error" }] : []));
323
340
  isDropping = signal(false, ...(ngDevMode ? [{ debugName: "isDropping" }] : []));
324
341
  inputFileRef = viewChild('inputFileRef', ...(ngDevMode ? [{ debugName: "inputFileRef" }] : []));
342
+ internalControl = new FormControl([]);
343
+ checkErrors() {
344
+ if (this.control().invalid) {
345
+ this.internalControl.setErrors(this.control().errors);
346
+ }
347
+ else {
348
+ this.internalControl.setErrors(null);
349
+ }
350
+ }
351
+ controlEffect = effect(() => {
352
+ const value = this.value();
353
+ // Usar untracked para evitar ciclos y emitEvent: false para no disparar eventos
354
+ untracked(() => {
355
+ this.control().setValue(value, { emitEvent: false });
356
+ // Actualizar el control interno con strings (nombres de archivo)
357
+ const fileNames = value.map(f => f.name);
358
+ this.internalControl.setValue(fileNames, { emitEvent: false });
359
+ this.checkErrors();
360
+ console.log('checkErrors', this.internalControl.errors);
361
+ this._cdr.markForCheck();
362
+ });
363
+ }, ...(ngDevMode ? [{ debugName: "controlEffect" }] : []));
364
+ ngOnInit() {
365
+ if (this.disabled()) {
366
+ this.control().disable();
367
+ this.internalControl.disable();
368
+ }
369
+ }
325
370
  onContainerClick() {
326
371
  this.onTouchCb?.();
327
372
  if (!this.disabled()) {
373
+ this.control().markAsTouched();
374
+ this.internalControl.markAsTouched();
375
+ this.control().markAsDirty();
376
+ this.internalControl.markAsDirty();
328
377
  this.inputFileRef()?.nativeElement.click();
329
378
  }
330
379
  }
@@ -332,6 +381,7 @@ class NgxInputFile {
332
381
  const target = event.target;
333
382
  const files = target.files;
334
383
  this.attachFiles(files);
384
+ target.value = '';
335
385
  }
336
386
  onDragOver(event) {
337
387
  event.preventDefault();
@@ -352,20 +402,21 @@ class NgxInputFile {
352
402
  }
353
403
  attachFiles(files) {
354
404
  if (files && files.length > 0) {
405
+ let newValue;
355
406
  if (this.multiple()) {
356
- for (let i = 0; i < files.length; i++) {
357
- const archivo = files.item(i);
358
- this.value.set([...this.value(), archivo]);
359
- }
407
+ const currentFiles = this.value();
408
+ const newFiles = Array.from(files);
409
+ newValue = [...currentFiles, ...newFiles];
360
410
  }
361
411
  else {
362
- this.value.set([files.item(0)]);
412
+ newValue = [files[0]];
363
413
  }
364
- this.onChangeCb?.(this.value());
365
- }
366
- const inputRef = this.inputFileRef();
367
- if (inputRef) {
368
- inputRef.nativeElement.value = ''; //Esto se hace para que se detecte el evento change si eliminamos files (por seguridad un input file solo se puede resetear a vacio)
414
+ this.value.set(newValue);
415
+ this.onChangeCb?.(newValue);
416
+ this.control().markAsTouched();
417
+ this.internalControl.markAsTouched();
418
+ this.control().markAsDirty();
419
+ this.internalControl.markAsDirty();
369
420
  }
370
421
  }
371
422
  writeValue(files) {
@@ -377,13 +428,14 @@ class NgxInputFile {
377
428
  registerOnTouched(fn) {
378
429
  this.onTouchCb = fn;
379
430
  }
380
- setDisabledState(isDisabled) {
381
- this.disabled.set(isDisabled);
382
- }
383
- onDeleteFileClick(event, file) {
384
- event.stopPropagation();
385
- this.value.set(this.value().filter((item) => item != file));
386
- this.onChangeCb?.(this.value());
431
+ onDeleteFileClick(file) {
432
+ const newValue = this.value().filter((item) => item !== file);
433
+ this.value.set(newValue);
434
+ this.onChangeCb?.(newValue);
435
+ this.control().markAsTouched();
436
+ this.internalControl.markAsTouched();
437
+ this.control().markAsDirty();
438
+ this.internalControl.markAsDirty();
387
439
  }
388
440
  getAccept() {
389
441
  return this.accept().join();
@@ -392,13 +444,13 @@ class NgxInputFile {
392
444
  return (bytes / 1024 / 1024).toFixed(1);
393
445
  }
394
446
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: NgxInputFile, deps: [], target: i0.ɵɵFactoryTarget.Component });
395
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: NgxInputFile, isStandalone: true, selector: "ngx-input-file", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
447
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: NgxInputFile, isStandalone: true, selector: "ngx-input-file", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
396
448
  {
397
449
  provide: NG_VALUE_ACCESSOR,
398
450
  useExisting: forwardRef(() => NgxInputFile),
399
451
  multi: true,
400
452
  },
401
- ], viewQueries: [{ propertyName: "inputFileRef", first: true, predicate: ["inputFileRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<div [class]=\"class()\">\r\n <div\r\n (click)=\"onContainerClick()\"\r\n [class]=\"['inputContainer', disabled() ? 'inputContainerDisabled' : '', error() && !disabled() ? 'borderError' : '', isDropping() && !disabled() ? 'isDropping' : '']\"\r\n (dragover)=\"onDragOver($event)\"\r\n (dragleave)=\"onDragLeave($event)\"\r\n (drop)=\"onDrop($event)\"\r\n >\r\n <input #inputFileRef type=\"file\" [accept]=\"getAccept()\" [multiple]=\"multiple()\" (change)=\"onInputchange($event)\">\r\n \r\n <p [class]=\"['label', error() && !disabled() ? 'markError' : '']\">{{label()}}</p>\r\n @if (value().length === 0) {\r\n <p class=\"noFiles\">{{placeholder()}}</p>\r\n }\r\n @for (file of value(); track file) {\r\n <div class=\"fileContainer\">\r\n <p class=\"fileData\"><span>({{bytesToMegaBytes(file.size)}} MB)</span> {{file.name}}</p>\r\n <button matIconButton type=\"button\" color=\"primary\" matTooltip=\"Eliminar archivo\" (click)=\"onDeleteFileClick($event, file)\">\r\n <mat-icon>delete</mat-icon>\r\n </button>\r\n </div>\r\n }\r\n </div>\r\n <div class=\"hintYError\">\r\n @if (error() && !disabled()) {\r\n <span class=\"markError\">{{ error() }}</span>\r\n } @else {\r\n <span>{{ hint() }}</span>\r\n }\r\n \r\n </div>\r\n <!-- <p [class]=\"['hintYError', error() && !disabled() ? 'markError' : '']\">\r\n {{ error() && !disabled() ? error() : hint() }}\r\n </p> -->\r\n</div>", styles: [":host{display:block}.inputContainer{width:100%;min-height:56px;border:1px solid #ccc;border-radius:5px;cursor:pointer;position:relative;display:flex;flex-direction:column;justify-content:center}.inputContainerDisabled{cursor:default!important;opacity:.4}input{display:none}.label{margin:0;position:absolute;top:-8px;left:10px;background:#fff;padding:0 5px;font-size:12px;color:#636363;white-space:nowrap;overflow:hidden;max-width:80%}.noFiles{padding:16px;margin:0;color:#3f3f3f}.fileContainer{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:center}.fileData{width:100%;margin:0;font-size:13px;padding-left:16px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fileData span{color:var(--primary);font-weight:400}.hintYError{height:20px;display:flex;align-items:center;padding:0 16px;font-size:var(--mat-form-field-subscript-text-size, var(--mat-sys-body-small-size))}.borderError{border-color:var(--mat-sys-error)}.markError{color:var(--mat-sys-error)}.isDropping{border-style:solid;border-color:var(--primary)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "ngmodule", type: MatChipsModule }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: MatInputModule }] });
453
+ ], viewQueries: [{ propertyName: "inputFileRef", first: true, predicate: ["inputFileRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n (click)=\"onContainerClick()\"\r\n class=\"chips-field\"\r\n (dragover)=\"onDragOver($event)\"\r\n (dragleave)=\"onDragLeave($event)\"\r\n (drop)=\"onDrop($event)\"\r\n [class.dragover]=\"isDropping()\"\r\n>\r\n <mat-label>{{ label() }}</mat-label>\r\n <mat-chip-grid \r\n #chipGrid \r\n [formControl]=\"internalControl\"\r\n class=\"chips-grid\"\r\n >\r\n @for(file of value(); track file.name + $index) {\r\n <mat-chip-row\r\n (removed)=\"onDeleteFileClick(file)\"\r\n class=\"chip-item\"\r\n >\r\n <span>({{ bytesToMegaBytes(file.size) }} MB)</span> {{ file.name }}\r\n <button matChipRemove>\r\n <mat-icon>cancel</mat-icon>\r\n </button>\r\n </mat-chip-row>\r\n }\r\n </mat-chip-grid>\r\n <input \r\n #inputFileRef\r\n type=\"file\"\r\n [accept]=\"getAccept()\" \r\n [multiple]=\"multiple()\" \r\n (change)=\"onInputchange($event)\"\r\n [matChipInputFor]=\"chipGrid\"\r\n style=\"display: none\"\r\n /> \r\n <mat-hint>{{ isDropping() ? 'Arrastrar archivos aqu\u00ED' : hint() }}</mat-hint>\r\n <mat-error>{{ error() }}</mat-error>\r\n</mat-form-field>", styles: [":host{display:block}mat-form-field{cursor:pointer}.chips-field{width:auto}.chips-field.dragover .mat-mdc-form-field-flex{border:2px dashed var(--mdc-theme-primary)}.chips-field.dragover{background-color:#0000000a;transition:background-color .2s ease}.chips-grid{display:flex;flex-wrap:wrap;gap:8px}.chip-item{width:auto!important;max-width:fit-content}:host ::ng-deep .mat-mdc-form-field-infix{width:auto;min-width:180px}mat-form-field{--mat-form-field-outlined-focus-outline-color: var(--mat-sys-outline);--mat-form-field-outlined-outline-color: var(--mat-sys-outline);--mat-form-field-outlined-hover-outline-color: var(--mat-sys-outline);--mat-form-field-outlined-focus-label-text-color: var(--mat-sys-on-surface)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i6.MatChipGrid, selector: "mat-chip-grid", inputs: ["disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i6.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled", "readonly", "matChipInputDisabledInteractive"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i6.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i6.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i5$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatInputModule }] });
402
454
  }
403
455
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: NgxInputFile, decorators: [{
404
456
  type: Component,
@@ -418,9 +470,343 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
418
470
  useExisting: forwardRef(() => NgxInputFile),
419
471
  multi: true,
420
472
  },
421
- ], template: "<div [class]=\"class()\">\r\n <div\r\n (click)=\"onContainerClick()\"\r\n [class]=\"['inputContainer', disabled() ? 'inputContainerDisabled' : '', error() && !disabled() ? 'borderError' : '', isDropping() && !disabled() ? 'isDropping' : '']\"\r\n (dragover)=\"onDragOver($event)\"\r\n (dragleave)=\"onDragLeave($event)\"\r\n (drop)=\"onDrop($event)\"\r\n >\r\n <input #inputFileRef type=\"file\" [accept]=\"getAccept()\" [multiple]=\"multiple()\" (change)=\"onInputchange($event)\">\r\n \r\n <p [class]=\"['label', error() && !disabled() ? 'markError' : '']\">{{label()}}</p>\r\n @if (value().length === 0) {\r\n <p class=\"noFiles\">{{placeholder()}}</p>\r\n }\r\n @for (file of value(); track file) {\r\n <div class=\"fileContainer\">\r\n <p class=\"fileData\"><span>({{bytesToMegaBytes(file.size)}} MB)</span> {{file.name}}</p>\r\n <button matIconButton type=\"button\" color=\"primary\" matTooltip=\"Eliminar archivo\" (click)=\"onDeleteFileClick($event, file)\">\r\n <mat-icon>delete</mat-icon>\r\n </button>\r\n </div>\r\n }\r\n </div>\r\n <div class=\"hintYError\">\r\n @if (error() && !disabled()) {\r\n <span class=\"markError\">{{ error() }}</span>\r\n } @else {\r\n <span>{{ hint() }}</span>\r\n }\r\n \r\n </div>\r\n <!-- <p [class]=\"['hintYError', error() && !disabled() ? 'markError' : '']\">\r\n {{ error() && !disabled() ? error() : hint() }}\r\n </p> -->\r\n</div>", styles: [":host{display:block}.inputContainer{width:100%;min-height:56px;border:1px solid #ccc;border-radius:5px;cursor:pointer;position:relative;display:flex;flex-direction:column;justify-content:center}.inputContainerDisabled{cursor:default!important;opacity:.4}input{display:none}.label{margin:0;position:absolute;top:-8px;left:10px;background:#fff;padding:0 5px;font-size:12px;color:#636363;white-space:nowrap;overflow:hidden;max-width:80%}.noFiles{padding:16px;margin:0;color:#3f3f3f}.fileContainer{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:center}.fileData{width:100%;margin:0;font-size:13px;padding-left:16px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fileData span{color:var(--primary);font-weight:400}.hintYError{height:20px;display:flex;align-items:center;padding:0 16px;font-size:var(--mat-form-field-subscript-text-size, var(--mat-sys-body-small-size))}.borderError{border-color:var(--mat-sys-error)}.markError{color:var(--mat-sys-error)}.isDropping{border-style:solid;border-color:var(--primary)}\n"] }]
473
+ ], template: "<mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n (click)=\"onContainerClick()\"\r\n class=\"chips-field\"\r\n (dragover)=\"onDragOver($event)\"\r\n (dragleave)=\"onDragLeave($event)\"\r\n (drop)=\"onDrop($event)\"\r\n [class.dragover]=\"isDropping()\"\r\n>\r\n <mat-label>{{ label() }}</mat-label>\r\n <mat-chip-grid \r\n #chipGrid \r\n [formControl]=\"internalControl\"\r\n class=\"chips-grid\"\r\n >\r\n @for(file of value(); track file.name + $index) {\r\n <mat-chip-row\r\n (removed)=\"onDeleteFileClick(file)\"\r\n class=\"chip-item\"\r\n >\r\n <span>({{ bytesToMegaBytes(file.size) }} MB)</span> {{ file.name }}\r\n <button matChipRemove>\r\n <mat-icon>cancel</mat-icon>\r\n </button>\r\n </mat-chip-row>\r\n }\r\n </mat-chip-grid>\r\n <input \r\n #inputFileRef\r\n type=\"file\"\r\n [accept]=\"getAccept()\" \r\n [multiple]=\"multiple()\" \r\n (change)=\"onInputchange($event)\"\r\n [matChipInputFor]=\"chipGrid\"\r\n style=\"display: none\"\r\n /> \r\n <mat-hint>{{ isDropping() ? 'Arrastrar archivos aqu\u00ED' : hint() }}</mat-hint>\r\n <mat-error>{{ error() }}</mat-error>\r\n</mat-form-field>", styles: [":host{display:block}mat-form-field{cursor:pointer}.chips-field{width:auto}.chips-field.dragover .mat-mdc-form-field-flex{border:2px dashed var(--mdc-theme-primary)}.chips-field.dragover{background-color:#0000000a;transition:background-color .2s ease}.chips-grid{display:flex;flex-wrap:wrap;gap:8px}.chip-item{width:auto!important;max-width:fit-content}:host ::ng-deep .mat-mdc-form-field-infix{width:auto;min-width:180px}mat-form-field{--mat-form-field-outlined-focus-outline-color: var(--mat-sys-outline);--mat-form-field-outlined-outline-color: var(--mat-sys-outline);--mat-form-field-outlined-hover-outline-color: var(--mat-sys-outline);--mat-form-field-outlined-focus-label-text-color: var(--mat-sys-on-surface)}\n"] }]
474
+ }] });
475
+
476
+ const includeNoSensible = (cadena, query) => {
477
+ const nomalizadoCadena = cadena
478
+ .toLowerCase()
479
+ .normalize('NFD')
480
+ .replace(/[\u0300-\u036f]/g, '');
481
+ const nomalizadoQuery = query
482
+ .toLowerCase()
483
+ .normalize('NFD')
484
+ .replace(/[\u0300-\u036f]/g, '');
485
+ return nomalizadoCadena.includes(nomalizadoQuery);
486
+ };
487
+ const base64ToUtf8 = (str) => {
488
+ return decodeURIComponent(atob(str)
489
+ .split('')
490
+ .map(function (c) {
491
+ return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
492
+ })
493
+ .join(''));
494
+ };
495
+
496
+ class NgxBasicSelect {
497
+ //inputs
498
+ label = input.required(...(ngDevMode ? [{ debugName: "label" }] : []));
499
+ options = input.required(...(ngDevMode ? [{ debugName: "options" }] : []));
500
+ basicSelectConfig = input.required(...(ngDevMode ? [{ debugName: "basicSelectConfig" }] : []));
501
+ control = input.required(...(ngDevMode ? [{ debugName: "control" }] : []));
502
+ isLoading = input.required(...(ngDevMode ? [{ debugName: "isLoading" }] : []));
503
+ placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
504
+ appearance = input('fill', ...(ngDevMode ? [{ debugName: "appearance" }] : []));
505
+ multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple" }] : []));
506
+ disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
507
+ clearable = input(false, ...(ngDevMode ? [{ debugName: "clearable" }] : []));
508
+ error = input('', ...(ngDevMode ? [{ debugName: "error" }] : []));
509
+ class = input('', ...(ngDevMode ? [{ debugName: "class" }] : []));
510
+ //outputs
511
+ selectionChange = output();
512
+ //viewChilds
513
+ matSelect = viewChild.required('matSelect');
514
+ searchInput = viewChild('searchInput', ...(ngDevMode ? [{ debugName: "searchInput" }] : []));
515
+ ngOnInit() {
516
+ if (this.disabled()) {
517
+ this.control().disable();
518
+ }
519
+ }
520
+ onOpenedChange(opened) {
521
+ if (opened) {
522
+ this.onClearInputClick();
523
+ }
524
+ }
525
+ includeInFilter(option, query) {
526
+ return includeNoSensible(String(this.basicSelectConfig().displayedLabel(option)), query);
527
+ }
528
+ onClearClick() {
529
+ this.control().setValue(this.multiple() ? [] : null);
530
+ this.selectionChange.emit(this.multiple() ? [] : null);
531
+ }
532
+ onSelectionChange(event) {
533
+ if (this.multiple()) {
534
+ const values = event.value;
535
+ this.selectionChange.emit(values);
536
+ }
537
+ else {
538
+ const value = event.value;
539
+ this.selectionChange.emit(value);
540
+ }
541
+ }
542
+ onClearInputClick() {
543
+ const searchInputRef = this.searchInput();
544
+ if (searchInputRef) {
545
+ searchInputRef.nativeElement.value = '';
546
+ searchInputRef.nativeElement.focus();
547
+ }
548
+ }
549
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: NgxBasicSelect, deps: [], target: i0.ɵɵFactoryTarget.Component });
550
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: NgxBasicSelect, isStandalone: true, selector: "ngx-basic-select", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null }, basicSelectConfig: { classPropertyName: "basicSelectConfig", publicName: "basicSelectConfig", isSignal: true, isRequired: true, transformFunction: null }, control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: true, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: true, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectionChange: "selectionChange" }, viewQueries: [{ propertyName: "matSelect", first: true, predicate: ["matSelect"], descendants: true, isSignal: true }, { propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true, isSignal: true }], ngImport: i0, template: "\n<mat-form-field [appearance]=\"appearance()\" [className]=\"class()\">\n <mat-label>{{ label() }}</mat-label>\n <mat-select \n #matSelect\n [formControl]=\"control()\"\n (selectionChange)=\"onSelectionChange($event)\"\n [multiple]=\"multiple()\"\n [placeholder]=\"placeholder()\"\n (openedChange)=\"onOpenedChange($event)\"\n >\n @if(!isLoading()) {\n <div class=\"searchFilter\">\n <mat-icon class=\"searchIcon\">search</mat-icon>\n <input \n matInput\n #searchInput \n type=\"text\"\n (keydown)=\"$event.stopPropagation()\"\n />\n <button matIconButton (click)=\"onClearInputClick(); searchInput.value = ''\">\n <mat-icon>close</mat-icon>\n </button>\n </div>\n @for(option of options(); track option[basicSelectConfig().valueKey]) {\n <mat-option \n [value]=\"option[basicSelectConfig().valueKey]\" \n [disabled]=\"basicSelectConfig().disabled ? basicSelectConfig().disabled?.(option) : false\"\n [style]=\"{ display: includeInFilter(option, searchInput.value) ? 'flex' : 'none' }\"\n > \n {{ basicSelectConfig().displayedLabel(option) }}\n </mat-option>\n }\n }\n </mat-select>\n @if(isLoading()) {\n <mat-icon matSuffix><mat-spinner diameter=\"20\" /></mat-icon>\n } @else if(clearable() && (multiple() ? control().value?.length : control().value)) {\n <mat-icon matSuffix (click)=\"onClearClick(); $event.stopPropagation()\">close</mat-icon>\n }\n <mat-error>{{ error() }}</mat-error>\n</mat-form-field>", styles: [":host{display:block;width:100%}mat-form-field{width:100%}mat-select{width:100%}.searchFilter{display:flex;align-items:center;position:sticky;top:-8px;height:48px;width:100%;background:#fff;z-index:10;border-bottom:1px solid var(--accent-3)}.searchFilter input{height:48px;padding:0 48px;width:calc(100% - 96px);position:absolute;top:0;left:0}.searchFilter .searchIcon{position:absolute;top:0;left:0;height:48px;width:48px;display:flex;align-items:center;justify-content:center}button{position:absolute;right:5px}\n"], dependencies: [{ kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i1$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i3$1.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i3$1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i5$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i2.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }] });
551
+ }
552
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: NgxBasicSelect, decorators: [{
553
+ type: Component,
554
+ args: [{ selector: 'ngx-basic-select', imports: [
555
+ MatInputModule,
556
+ MatSelectModule,
557
+ MatIconModule,
558
+ MatButtonModule,
559
+ MatFormFieldModule,
560
+ ReactiveFormsModule,
561
+ MatProgressSpinnerModule,
562
+ ], template: "\n<mat-form-field [appearance]=\"appearance()\" [className]=\"class()\">\n <mat-label>{{ label() }}</mat-label>\n <mat-select \n #matSelect\n [formControl]=\"control()\"\n (selectionChange)=\"onSelectionChange($event)\"\n [multiple]=\"multiple()\"\n [placeholder]=\"placeholder()\"\n (openedChange)=\"onOpenedChange($event)\"\n >\n @if(!isLoading()) {\n <div class=\"searchFilter\">\n <mat-icon class=\"searchIcon\">search</mat-icon>\n <input \n matInput\n #searchInput \n type=\"text\"\n (keydown)=\"$event.stopPropagation()\"\n />\n <button matIconButton (click)=\"onClearInputClick(); searchInput.value = ''\">\n <mat-icon>close</mat-icon>\n </button>\n </div>\n @for(option of options(); track option[basicSelectConfig().valueKey]) {\n <mat-option \n [value]=\"option[basicSelectConfig().valueKey]\" \n [disabled]=\"basicSelectConfig().disabled ? basicSelectConfig().disabled?.(option) : false\"\n [style]=\"{ display: includeInFilter(option, searchInput.value) ? 'flex' : 'none' }\"\n > \n {{ basicSelectConfig().displayedLabel(option) }}\n </mat-option>\n }\n }\n </mat-select>\n @if(isLoading()) {\n <mat-icon matSuffix><mat-spinner diameter=\"20\" /></mat-icon>\n } @else if(clearable() && (multiple() ? control().value?.length : control().value)) {\n <mat-icon matSuffix (click)=\"onClearClick(); $event.stopPropagation()\">close</mat-icon>\n }\n <mat-error>{{ error() }}</mat-error>\n</mat-form-field>", styles: [":host{display:block;width:100%}mat-form-field{width:100%}mat-select{width:100%}.searchFilter{display:flex;align-items:center;position:sticky;top:-8px;height:48px;width:100%;background:#fff;z-index:10;border-bottom:1px solid var(--accent-3)}.searchFilter input{height:48px;padding:0 48px;width:calc(100% - 96px);position:absolute;top:0;left:0}.searchFilter .searchIcon{position:absolute;top:0;left:0;height:48px;width:48px;display:flex;align-items:center;justify-content:center}button{position:absolute;right:5px}\n"] }]
563
+ }] });
564
+
565
+ class PaginatedSelectBottomSheetComponent {
566
+ // dependencies injection
567
+ _bottomSheetRef = inject((MatBottomSheetRef));
568
+ _data = inject(MAT_BOTTOM_SHEET_DATA);
569
+ //signals
570
+ accumulatedItems = signal([], ...(ngDevMode ? [{ debugName: "accumulatedItems" }] : []));
571
+ queryInput = signal('', ...(ngDevMode ? [{ debugName: "queryInput" }] : []));
572
+ cancel$ = new Subject();
573
+ debouncedQuery = toSignal(toObservable(this.queryInput).pipe(debounceTime(500), distinctUntilChanged()), { initialValue: '' });
574
+ // Obtener valores iniciales seleccionados
575
+ getInitialSelectedValues() {
576
+ return this._data.selectedItems.map(item => item[this._data.config.valueKey]);
577
+ }
578
+ selectedsOptions = signal(this._data.selectedItems, ...(ngDevMode ? [{ debugName: "selectedsOptions" }] : []));
579
+ selectedsOptionsValues = signal(this.getInitialSelectedValues(), ...(ngDevMode ? [{ debugName: "selectedsOptionsValues" }] : []));
580
+ //resource
581
+ optionsResource = rxResource({
582
+ params: () => {
583
+ const filters = {
584
+ ...this._data.filters(),
585
+ query: this.debouncedQuery(),
586
+ };
587
+ this.cancel$.next();
588
+ return filters;
589
+ },
590
+ stream: ({ params }) => this._data.endpoint(params).pipe(takeUntil(this.cancel$)),
591
+ defaultValue: { items: [], total: 0 },
592
+ });
593
+ //computed
594
+ isLoading = computed(() => this.optionsResource.isLoading(), ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
595
+ options = computed(() => this.accumulatedItems(), ...(ngDevMode ? [{ debugName: "options" }] : []));
596
+ total = computed(() => this.optionsResource.value().total, ...(ngDevMode ? [{ debugName: "total" }] : []));
597
+ //effect
598
+ filtersEffect = effect(() => {
599
+ const resourceValue = this.optionsResource.value();
600
+ const currentPage = this._data.filters().pageNumber;
601
+ if (currentPage === 1) {
602
+ this.accumulatedItems.set(resourceValue.items);
603
+ }
604
+ else {
605
+ this.accumulatedItems.update((current) => [...current, ...resourceValue.items]);
606
+ }
607
+ }, ...(ngDevMode ? [{ debugName: "filtersEffect" }] : []));
608
+ onScroll(div) {
609
+ if (this.isLoading())
610
+ return;
611
+ const scrollTop = div.scrollTop;
612
+ const clientHeight = div.clientHeight;
613
+ const scrollHeight = div.scrollHeight;
614
+ const marginToBottom = 300;
615
+ const isNearToBottom = scrollTop + clientHeight + marginToBottom >= scrollHeight;
616
+ const optionsLength = this.options().length;
617
+ const total = this.total();
618
+ if (isNearToBottom && total > optionsLength) {
619
+ this._data.filters.update((current) => ({
620
+ ...current,
621
+ pageNumber: current.pageNumber + 1
622
+ }));
623
+ }
624
+ }
625
+ onQueryChange(event, div) {
626
+ const query = event.target.value;
627
+ this.queryInput.set(query);
628
+ div.scrollTop = 0;
629
+ if (this._data.filters().pageNumber !== 1) {
630
+ this._data.filters.update((current) => ({
631
+ ...current,
632
+ pageNumber: 1
633
+ }));
634
+ }
635
+ }
636
+ onClearClick(input) {
637
+ input.value = '';
638
+ this.queryInput.set('');
639
+ if (this._data.filters().pageNumber !== 1) {
640
+ this._data.filters.update((current) => ({
641
+ ...current,
642
+ pageNumber: 1
643
+ }));
644
+ }
645
+ }
646
+ onSelectionChange(event) {
647
+ if (this._data.multiple) {
648
+ const selectedsOptionsValues = event.source.selectedOptions.selected.map(option => option.value);
649
+ const selectedsOptions = this.options().filter(option => selectedsOptionsValues.includes(option[this._data.config.valueKey]));
650
+ this.selectedsOptions.update(() => {
651
+ return selectedsOptions;
652
+ });
653
+ }
654
+ else {
655
+ const selectedOptionValue = event.options[0].value;
656
+ const selectedOption = this.options().find(option => option[this._data.config.valueKey] == selectedOptionValue);
657
+ this._bottomSheetRef.dismiss([selectedOption]);
658
+ }
659
+ }
660
+ isSelected(optionValue) {
661
+ return this.selectedsOptionsValues().includes(optionValue);
662
+ }
663
+ onResetClick() {
664
+ this.selectedsOptions.set([]);
665
+ this.selectedsOptionsValues.set([]);
666
+ }
667
+ onConfirmMultiSelectionClick() {
668
+ this._bottomSheetRef.dismiss(this.selectedsOptions());
669
+ }
670
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: PaginatedSelectBottomSheetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
671
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: PaginatedSelectBottomSheetComponent, isStandalone: true, selector: "paginated-select-bottom-sheet", ngImport: i0, template: "<div class=\"bottomSheetContainer\">\n <div class=\"header\">\n @if(_data.title) {\n <div class=\"title\">\n {{ _data.title }}\n </div>\n }\n @if(!_data.hideFilter) {\n <mat-form-field subscriptSizing=\"dynamic\" appearance=\"outline\">\n <mat-icon matPrefix>search</mat-icon>\n <input matInput #searchInput [placeholder]=\"_data.filterPlaceholder\" (input)=\"onQueryChange($event, optionsContainer); $event.stopPropagation()\" />\n @if(searchInput.value.length > 0) {\n <button matSuffix mat-icon-button (click)=\"onClearClick(searchInput); $event.stopPropagation()\">\n <mat-icon>close</mat-icon>\n </button>\n }\n </mat-form-field>\n \n <mat-chip-listbox [multiple]=\"false\">\n @for(filterKey of _data.config.filtersKeys; track filterKey.key) {\n <mat-chip-option [value]=\"filterKey.key\" [selected]=\"\">{{ filterKey.label() }}</mat-chip-option>\n }\n </mat-chip-listbox>\n }\n </div>\n <div class=\"loading\">\n @if(isLoading()) {\n <mat-progress-bar mode=\"indeterminate\" />\n }\n </div>\n <div #optionsContainer class=\"optionsContainer\" (scroll)=\"onScroll(optionsContainer)\">\n <mat-selection-list [multiple]=\"_data.multiple\" (selectionChange)=\"onSelectionChange($event)\">\n @for(option of options(); track option[_data.config.valueKey]; let last = $last) {\n <mat-list-option \n [value]=\"option[_data.config.valueKey]\"\n [selected]=\"isSelected(option[_data.config.valueKey])\"\n [disabled]=\"_data.config.disabled ? _data.config.disabled(option) : false\"\n >\n {{_data.config.displayedLabel(option)}}\n </mat-list-option>\n @if(!last) {\n <mat-divider />\n }\n }\n </mat-selection-list>\n </div> \n\n\n <div class=\"footer\">\n @if(_data.multiple) {\n <div class=\"length\">\n {{ selectedsOptions().length }} / {{ total() }} {{ _data.multipleItemsLabel }}\n </div>\n <div class=\"actions\">\n @if(selectedsOptions().length > 0) {\n <button mat-button (click)=\"onResetClick()\">{{ _data.resetLabel }}</button>\n }\n <button mat-raised-button color=\"primary\" (click)=\"onConfirmMultiSelectionClick()\">{{ _data.confirmLabel }}</button>\n </div>\n } @else {\n <div class=\"length\">\n {{ total() }} {{ _data.itemsLabel }}\n </div>\n }\n </div>\n</div>", styles: [":host{display:flex;flex-direction:column;min-width:720px}.mat-bottom-sheet-container{padding:0 16px!important}.bottomSheetContainer{display:flex;flex-direction:column;height:100%;max-height:80vh}.bottomSheetContainer .header{width:100%;flex:0 0 auto;margin-top:15px}.bottomSheetContainer .header .title{margin-bottom:10px;font-size:20px;font-weight:500}.bottomSheetContainer .header mat-form-field{width:100%}.bottomSheetContainer .header mat-chip-listbox{width:100%}.bottomSheetContainer .loading{display:flex;align-items:center;width:100%;height:20px}.bottomSheetContainer .optionsContainer{flex:1 1 auto;height:360px;width:100%;overflow-y:auto}.bottomSheetContainer .footer{margin-top:8px;width:100%;flex:0 0 auto;display:flex;justify-content:space-between;height:56px;box-shadow:0 15px 10px -15px #0000001a}mat-form-field{--mat-form-field-outlined-focus-outline-color: var(--mat-sys-outline);--mat-form-field-outlined-outline-color: var(--mat-sys-outline);--mat-form-field-outlined-hover-outline-color: var(--mat-sys-outline)}@media (max-width: 960px){:host{min-width:auto}}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i1.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i2$3.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i2$2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i1$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i6.MatChipListbox, selector: "mat-chip-listbox", inputs: ["multiple", "aria-orientation", "selectable", "compareWith", "required", "hideSingleSelectionIndicator", "value"], outputs: ["change"] }, { kind: "component", type: i6.MatChipOption, selector: "mat-basic-chip-option, [mat-basic-chip-option], mat-chip-option, [mat-chip-option]", inputs: ["selectable", "selected"], outputs: ["selectionChange"] }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i7$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "ngmodule", type: MatListModule }, { kind: "component", type: i8$1.MatSelectionList, selector: "mat-selection-list", inputs: ["color", "compareWith", "multiple", "hideSingleSelectionIndicator", "disabled"], outputs: ["selectionChange"], exportAs: ["matSelectionList"] }, { kind: "component", type: i8$1.MatListOption, selector: "mat-list-option", inputs: ["togglePosition", "checkboxPosition", "color", "value", "selected"], outputs: ["selectedChange"], exportAs: ["matListOption"] }, { kind: "ngmodule", type: ReactiveFormsModule }], encapsulation: i0.ViewEncapsulation.None });
672
+ }
673
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: PaginatedSelectBottomSheetComponent, decorators: [{
674
+ type: Component,
675
+ args: [{ selector: 'paginated-select-bottom-sheet', imports: [
676
+ MatButtonModule,
677
+ MatDividerModule,
678
+ CommonModule,
679
+ MatFormFieldModule,
680
+ MatIconModule,
681
+ MatInputModule,
682
+ MatChipsModule,
683
+ MatProgressBarModule,
684
+ MatListModule,
685
+ ReactiveFormsModule,
686
+ ], encapsulation: ViewEncapsulation.None, template: "<div class=\"bottomSheetContainer\">\n <div class=\"header\">\n @if(_data.title) {\n <div class=\"title\">\n {{ _data.title }}\n </div>\n }\n @if(!_data.hideFilter) {\n <mat-form-field subscriptSizing=\"dynamic\" appearance=\"outline\">\n <mat-icon matPrefix>search</mat-icon>\n <input matInput #searchInput [placeholder]=\"_data.filterPlaceholder\" (input)=\"onQueryChange($event, optionsContainer); $event.stopPropagation()\" />\n @if(searchInput.value.length > 0) {\n <button matSuffix mat-icon-button (click)=\"onClearClick(searchInput); $event.stopPropagation()\">\n <mat-icon>close</mat-icon>\n </button>\n }\n </mat-form-field>\n \n <mat-chip-listbox [multiple]=\"false\">\n @for(filterKey of _data.config.filtersKeys; track filterKey.key) {\n <mat-chip-option [value]=\"filterKey.key\" [selected]=\"\">{{ filterKey.label() }}</mat-chip-option>\n }\n </mat-chip-listbox>\n }\n </div>\n <div class=\"loading\">\n @if(isLoading()) {\n <mat-progress-bar mode=\"indeterminate\" />\n }\n </div>\n <div #optionsContainer class=\"optionsContainer\" (scroll)=\"onScroll(optionsContainer)\">\n <mat-selection-list [multiple]=\"_data.multiple\" (selectionChange)=\"onSelectionChange($event)\">\n @for(option of options(); track option[_data.config.valueKey]; let last = $last) {\n <mat-list-option \n [value]=\"option[_data.config.valueKey]\"\n [selected]=\"isSelected(option[_data.config.valueKey])\"\n [disabled]=\"_data.config.disabled ? _data.config.disabled(option) : false\"\n >\n {{_data.config.displayedLabel(option)}}\n </mat-list-option>\n @if(!last) {\n <mat-divider />\n }\n }\n </mat-selection-list>\n </div> \n\n\n <div class=\"footer\">\n @if(_data.multiple) {\n <div class=\"length\">\n {{ selectedsOptions().length }} / {{ total() }} {{ _data.multipleItemsLabel }}\n </div>\n <div class=\"actions\">\n @if(selectedsOptions().length > 0) {\n <button mat-button (click)=\"onResetClick()\">{{ _data.resetLabel }}</button>\n }\n <button mat-raised-button color=\"primary\" (click)=\"onConfirmMultiSelectionClick()\">{{ _data.confirmLabel }}</button>\n </div>\n } @else {\n <div class=\"length\">\n {{ total() }} {{ _data.itemsLabel }}\n </div>\n }\n </div>\n</div>", styles: [":host{display:flex;flex-direction:column;min-width:720px}.mat-bottom-sheet-container{padding:0 16px!important}.bottomSheetContainer{display:flex;flex-direction:column;height:100%;max-height:80vh}.bottomSheetContainer .header{width:100%;flex:0 0 auto;margin-top:15px}.bottomSheetContainer .header .title{margin-bottom:10px;font-size:20px;font-weight:500}.bottomSheetContainer .header mat-form-field{width:100%}.bottomSheetContainer .header mat-chip-listbox{width:100%}.bottomSheetContainer .loading{display:flex;align-items:center;width:100%;height:20px}.bottomSheetContainer .optionsContainer{flex:1 1 auto;height:360px;width:100%;overflow-y:auto}.bottomSheetContainer .footer{margin-top:8px;width:100%;flex:0 0 auto;display:flex;justify-content:space-between;height:56px;box-shadow:0 15px 10px -15px #0000001a}mat-form-field{--mat-form-field-outlined-focus-outline-color: var(--mat-sys-outline);--mat-form-field-outlined-outline-color: var(--mat-sys-outline);--mat-form-field-outlined-hover-outline-color: var(--mat-sys-outline)}@media (max-width: 960px){:host{min-width:auto}}\n"] }]
422
687
  }] });
423
688
 
689
+ class NgxPaginatedSelect {
690
+ // dependencies injection
691
+ _bottomSheet = inject(MatBottomSheet);
692
+ cdr = inject(ChangeDetectorRef);
693
+ // inputs
694
+ label = input.required(...(ngDevMode ? [{ debugName: "label" }] : []));
695
+ title = input('', ...(ngDevMode ? [{ debugName: "title" }] : []));
696
+ endpoint = input.required(...(ngDevMode ? [{ debugName: "endpoint" }] : []));
697
+ config = input.required(...(ngDevMode ? [{ debugName: "config" }] : []));
698
+ filters = input(signal({
699
+ pageNumber: 1,
700
+ pageSize: 10,
701
+ query: undefined,
702
+ sortBy: undefined
703
+ }), ...(ngDevMode ? [{ debugName: "filters" }] : []));
704
+ control = input.required(...(ngDevMode ? [{ debugName: "control" }] : []));
705
+ selectedItems = input([], ...(ngDevMode ? [{ debugName: "selectedItems" }] : []));
706
+ hideFilter = input(false, ...(ngDevMode ? [{ debugName: "hideFilter" }] : []));
707
+ filterPlaceholder = input('Select an option', ...(ngDevMode ? [{ debugName: "filterPlaceholder" }] : []));
708
+ multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple" }] : []));
709
+ disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
710
+ clearable = input(false, ...(ngDevMode ? [{ debugName: "clearable" }] : []));
711
+ itemsLabel = input('items', ...(ngDevMode ? [{ debugName: "itemsLabel" }] : []));
712
+ multipleItemsLabel = input('items selected', ...(ngDevMode ? [{ debugName: "multipleItemsLabel" }] : []));
713
+ resetLabel = input('Reset', ...(ngDevMode ? [{ debugName: "resetLabel" }] : []));
714
+ confirmLabel = input('Confirm', ...(ngDevMode ? [{ debugName: "confirmLabel" }] : []));
715
+ error = input('', ...(ngDevMode ? [{ debugName: "error" }] : []));
716
+ class = input('', ...(ngDevMode ? [{ debugName: "class" }] : []));
717
+ hideChips = input(false, ...(ngDevMode ? [{ debugName: "hideChips" }] : []));
718
+ _selectedItems = signal([], ...(ngDevMode ? [{ debugName: "_selectedItems" }] : []));
719
+ constructor() {
720
+ effect(() => {
721
+ this._selectedItems.set(this.selectedItems());
722
+ });
723
+ }
724
+ ngOnInit() {
725
+ if (this.disabled()) {
726
+ this.control().disable();
727
+ }
728
+ }
729
+ getSelectedItemsLabel() {
730
+ return this._selectedItems()
731
+ .map((item) => String(this.config().displayedLabel(item)))
732
+ .join(', ') || '';
733
+ }
734
+ // signals
735
+ // filters = signal<PaginatedFilter>(this.initialFilters);
736
+ // effect
737
+ controlEffect = effect(() => {
738
+ const selectedItems = this._selectedItems();
739
+ if (this.multiple()) {
740
+ this.control().setValue(selectedItems.map((item) => item[this.config().valueKey]));
741
+ }
742
+ else {
743
+ this.control().setValue(selectedItems?.[0]?.[this.config().valueKey]);
744
+ }
745
+ this.cdr.markForCheck();
746
+ }, ...(ngDevMode ? [{ debugName: "controlEffect" }] : []));
747
+ onOpenBottomSheetClick(event) {
748
+ event.stopPropagation();
749
+ event.preventDefault();
750
+ if (this.disabled()) {
751
+ return;
752
+ }
753
+ event.target.blur();
754
+ this.control().markAsTouched();
755
+ this.control().markAsDirty();
756
+ this._bottomSheet.open(PaginatedSelectBottomSheetComponent, {
757
+ data: {
758
+ label: this.label(),
759
+ title: this.title(),
760
+ endpoint: this.endpoint(),
761
+ config: this.config(),
762
+ selectedItems: this._selectedItems(),
763
+ hideFilter: this.hideFilter(),
764
+ filters: this.filters(),
765
+ filterPlaceholder: this.filterPlaceholder(),
766
+ multiple: this.multiple(),
767
+ itemsLabel: this.itemsLabel(),
768
+ multipleItemsLabel: this.multipleItemsLabel(),
769
+ resetLabel: this.resetLabel(),
770
+ confirmLabel: this.confirmLabel(),
771
+ },
772
+ }).afterDismissed().subscribe((selectedItems) => {
773
+ // this.filters().set(this.initialFilters);
774
+ if (selectedItems !== undefined) {
775
+ this._selectedItems.set(selectedItems);
776
+ }
777
+ });
778
+ }
779
+ onChipRemoved(item) {
780
+ this._selectedItems.set(this._selectedItems().filter(i => i[this.config().valueKey] !== item[this.config().valueKey]));
781
+ }
782
+ onResetClick(event) {
783
+ event.stopPropagation();
784
+ event.preventDefault();
785
+ // this.filters.set(this.initialFilters);
786
+ this._selectedItems.set(this.selectedItems());
787
+ this.control().reset();
788
+ this.control().markAsTouched();
789
+ this.control().updateValueAndValidity();
790
+ this.cdr.markForCheck();
791
+ }
792
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: NgxPaginatedSelect, deps: [], target: i0.ɵɵFactoryTarget.Component });
793
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: NgxPaginatedSelect, isStandalone: true, selector: "ngx-paginated-select", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, endpoint: { classPropertyName: "endpoint", publicName: "endpoint", isSignal: true, isRequired: true, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, filters: { classPropertyName: "filters", publicName: "filters", isSignal: true, isRequired: false, transformFunction: null }, control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: true, transformFunction: null }, selectedItems: { classPropertyName: "selectedItems", publicName: "selectedItems", isSignal: true, isRequired: false, transformFunction: null }, hideFilter: { classPropertyName: "hideFilter", publicName: "hideFilter", isSignal: true, isRequired: false, transformFunction: null }, filterPlaceholder: { classPropertyName: "filterPlaceholder", publicName: "filterPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, itemsLabel: { classPropertyName: "itemsLabel", publicName: "itemsLabel", isSignal: true, isRequired: false, transformFunction: null }, multipleItemsLabel: { classPropertyName: "multipleItemsLabel", publicName: "multipleItemsLabel", isSignal: true, isRequired: false, transformFunction: null }, resetLabel: { classPropertyName: "resetLabel", publicName: "resetLabel", isSignal: true, isRequired: false, transformFunction: null }, confirmLabel: { classPropertyName: "confirmLabel", publicName: "confirmLabel", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, hideChips: { classPropertyName: "hideChips", publicName: "hideChips", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if(hideChips()) {\n <mat-form-field \n appearance=\"outline\" \n floatLabel=\"always\" \n (click)=\"onOpenBottomSheetClick($event)\"\n >\n <mat-label>{{ label() }}</mat-label>\n \n <input\n matInput\n [formControl]=\"control()\"\n [readonly]=\"true\"\n [value]=\"getSelectedItemsLabel()\"\n class=\"clickable-input\"\n />\n <div matSuffix>\n @if(clearable() && control().value) {\n <button matIconButton matSuffix (click)=\"onResetClick($event);\">\n <mat-icon>close</mat-icon>\n </button>\n }\n <mat-icon matSuffix>arrow_drop_down</mat-icon>\n </div>\n <mat-error>{{ error() }}</mat-error>\n </mat-form-field>\n} @else {\n <mat-form-field \n appearance=\"outline\" \n floatLabel=\"always\"\n (click)=\"onOpenBottomSheetClick($event)\"\n class=\"chips-field\"\n >\n <mat-label>{{ label() }}</mat-label>\n <mat-chip-grid #chipGrid class=\"chips-grid\" [formControl]=\"control()\">\n @for(item of _selectedItems(); track item[config().valueKey]) {\n <mat-chip-row\n (removed)=\"onChipRemoved(item)\"\n class=\"chip-item\"\n >\n {{ config().displayedLabel(item) }}\n <button matChipRemove>\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip-row>\n }\n </mat-chip-grid>\n\n\n <input \n matInput\n [matChipInputFor]=\"chipGrid\"\n style=\"display: none\"\n />\n <mat-icon matSuffix>arrow_drop_down</mat-icon>\n <mat-error>{{ error() }}</mat-error>\n </mat-form-field>\n}", styles: [":host{display:block}.clickable-input{cursor:pointer!important;pointer-events:none}mat-form-field{cursor:pointer}.chips-field{width:auto}.chips-grid{display:flex;flex-wrap:wrap;gap:8px}.chip-item{width:auto!important;max-width:fit-content}:host ::ng-deep .mat-mdc-form-field-infix{width:auto;min-width:180px}mat-form-field{--mat-form-field-outlined-focus-outline-color: var(--mat-sys-outline);--mat-form-field-outlined-outline-color: var(--mat-sys-outline);--mat-form-field-outlined-hover-outline-color: var(--mat-sys-outline);--mat-form-field-outlined-focus-label-text-color: var(--mat-sys-on-surface)}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatBottomSheetModule }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i1$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i5$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i5$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i6.MatChipGrid, selector: "mat-chip-grid", inputs: ["disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i6.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled", "readonly", "matChipInputDisabledInteractive"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i6.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i6.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }] });
794
+ }
795
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: NgxPaginatedSelect, decorators: [{
796
+ type: Component,
797
+ args: [{ selector: 'ngx-paginated-select', imports: [
798
+ MatButtonModule,
799
+ MatBottomSheetModule,
800
+ CommonModule,
801
+ MatFormFieldModule,
802
+ MatInputModule,
803
+ MatIconModule,
804
+ MatSelectModule,
805
+ ReactiveFormsModule,
806
+ MatChipsModule
807
+ ], template: "@if(hideChips()) {\n <mat-form-field \n appearance=\"outline\" \n floatLabel=\"always\" \n (click)=\"onOpenBottomSheetClick($event)\"\n >\n <mat-label>{{ label() }}</mat-label>\n \n <input\n matInput\n [formControl]=\"control()\"\n [readonly]=\"true\"\n [value]=\"getSelectedItemsLabel()\"\n class=\"clickable-input\"\n />\n <div matSuffix>\n @if(clearable() && control().value) {\n <button matIconButton matSuffix (click)=\"onResetClick($event);\">\n <mat-icon>close</mat-icon>\n </button>\n }\n <mat-icon matSuffix>arrow_drop_down</mat-icon>\n </div>\n <mat-error>{{ error() }}</mat-error>\n </mat-form-field>\n} @else {\n <mat-form-field \n appearance=\"outline\" \n floatLabel=\"always\"\n (click)=\"onOpenBottomSheetClick($event)\"\n class=\"chips-field\"\n >\n <mat-label>{{ label() }}</mat-label>\n <mat-chip-grid #chipGrid class=\"chips-grid\" [formControl]=\"control()\">\n @for(item of _selectedItems(); track item[config().valueKey]) {\n <mat-chip-row\n (removed)=\"onChipRemoved(item)\"\n class=\"chip-item\"\n >\n {{ config().displayedLabel(item) }}\n <button matChipRemove>\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip-row>\n }\n </mat-chip-grid>\n\n\n <input \n matInput\n [matChipInputFor]=\"chipGrid\"\n style=\"display: none\"\n />\n <mat-icon matSuffix>arrow_drop_down</mat-icon>\n <mat-error>{{ error() }}</mat-error>\n </mat-form-field>\n}", styles: [":host{display:block}.clickable-input{cursor:pointer!important;pointer-events:none}mat-form-field{cursor:pointer}.chips-field{width:auto}.chips-grid{display:flex;flex-wrap:wrap;gap:8px}.chip-item{width:auto!important;max-width:fit-content}:host ::ng-deep .mat-mdc-form-field-infix{width:auto;min-width:180px}mat-form-field{--mat-form-field-outlined-focus-outline-color: var(--mat-sys-outline);--mat-form-field-outlined-outline-color: var(--mat-sys-outline);--mat-form-field-outlined-hover-outline-color: var(--mat-sys-outline);--mat-form-field-outlined-focus-label-text-color: var(--mat-sys-on-surface)}\n"] }]
808
+ }], ctorParameters: () => [] });
809
+
424
810
  // export * from './lib/services/index';
425
811
  // export * from './lib/utils/index';
426
812
 
@@ -428,5 +814,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
428
814
  * Generated bundle index. Do not edit.
429
815
  */
430
816
 
431
- export { NgxBasicTable, NgxInputFile, NgxLoadingButton, NgxPaginatedTable };
817
+ export { NgxBasicSelect, NgxBasicTable, NgxInputFile, NgxLoadingButton, NgxPaginatedSelect, NgxPaginatedTable };
432
818
  //# sourceMappingURL=ngx-eiffage-material.mjs.map