sf-crud 13.2.62 → 13.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/sf-crud.mjs +77 -35
- package/fesm2022/sf-crud.mjs.map +1 -1
- package/lib/components/control/control.component.d.ts +1 -0
- package/lib/components/tablero/tablero.component.d.ts +1 -0
- package/lib/shared/models/crud-config.model.d.ts +9 -0
- package/lib/shared/services/tablero.service.d.ts +10 -1
- package/package.json +1 -1
package/fesm2022/sf-crud.mjs
CHANGED
|
@@ -1068,23 +1068,13 @@ class TableroService {
|
|
|
1068
1068
|
if (!table || !config)
|
|
1069
1069
|
return;
|
|
1070
1070
|
this.setLoading({ inProgress: true, target: 'data' });
|
|
1071
|
-
// Solo resetear datos si no es paginación, para mantener el skeleton con las filas correctas
|
|
1072
|
-
// if (typeLoad !== 'data') {
|
|
1073
|
-
// this._data.set([]);
|
|
1074
|
-
// this._initialData.set([]);
|
|
1075
|
-
// this._totalRecords.set(0);
|
|
1076
|
-
// }
|
|
1077
1071
|
let url = this.applyKeys(table.keys, `${this.generalService.jsonConfig[table.server]}${table.endpoint}`, config.dataExt);
|
|
1078
1072
|
this.generalService
|
|
1079
1073
|
.genericRequest(table.method, url, config.dataExt)
|
|
1080
1074
|
.then((res) => {
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
else
|
|
1085
|
-
aux = res;
|
|
1086
|
-
this._initialData.set(_.cloneDeep(aux));
|
|
1087
|
-
this.generateData(aux);
|
|
1075
|
+
const { items, totalRecords } = this.extractResponseData(res, table);
|
|
1076
|
+
this._initialData.set(_.cloneDeep(items));
|
|
1077
|
+
this.generateData(items, undefined, totalRecords);
|
|
1088
1078
|
this._initialLoadDone.set(true);
|
|
1089
1079
|
this.setLoading({ inProgress: false, target: 'data' });
|
|
1090
1080
|
})
|
|
@@ -1093,13 +1083,48 @@ class TableroService {
|
|
|
1093
1083
|
this.setLoading({ inProgress: false, target: 'data' });
|
|
1094
1084
|
});
|
|
1095
1085
|
}
|
|
1096
|
-
|
|
1086
|
+
/**
|
|
1087
|
+
* Extrae los items y metadatos de paginación de la respuesta del servidor
|
|
1088
|
+
* según el responseMapping configurado o usando la lógica por defecto.
|
|
1089
|
+
*/
|
|
1090
|
+
extractResponseData(res, table) {
|
|
1091
|
+
const mapping = table.responseMapping;
|
|
1092
|
+
// Si la respuesta ya es un array, retornar directamente
|
|
1093
|
+
if (Array.isArray(res)) {
|
|
1094
|
+
return { items: res, totalRecords: 0 };
|
|
1095
|
+
}
|
|
1096
|
+
// Si hay responseMapping configurado, usar los campos especificados
|
|
1097
|
+
if (mapping) {
|
|
1098
|
+
const source = res.data !== undefined ? res.data : res;
|
|
1099
|
+
const items = mapping.items ? this.getNestedValue(source, mapping.items) : source;
|
|
1100
|
+
const totalRecords = mapping.total ? (this.getNestedValue(source, mapping.total) || 0) : 0;
|
|
1101
|
+
return {
|
|
1102
|
+
items: Array.isArray(items) ? items : [],
|
|
1103
|
+
totalRecords
|
|
1104
|
+
};
|
|
1105
|
+
}
|
|
1106
|
+
// Fallback: lógica original (res.data como array, o buscar TotalRecords en items)
|
|
1107
|
+
const data = res.data !== undefined ? res.data : res;
|
|
1108
|
+
if (Array.isArray(data)) {
|
|
1109
|
+
// Buscar TotalRecords en el primer item (comportamiento legacy)
|
|
1110
|
+
const firstWithTotal = data.find((item) => item['TotalRecords'] !== undefined);
|
|
1111
|
+
const totalRecords = firstWithTotal ? (firstWithTotal['TotalRecords'] || data.length) : 0;
|
|
1112
|
+
return { items: data, totalRecords };
|
|
1113
|
+
}
|
|
1114
|
+
return { items: [], totalRecords: 0 };
|
|
1115
|
+
}
|
|
1116
|
+
/**
|
|
1117
|
+
* Obtiene un valor de un objeto usando una ruta con puntos (ej: "pagination.total")
|
|
1118
|
+
*/
|
|
1119
|
+
getNestedValue(obj, path) {
|
|
1120
|
+
return path.split('.').reduce((current, key) => current?.[key], obj);
|
|
1121
|
+
}
|
|
1122
|
+
generateData(data, tableConfig, externalTotalRecords) {
|
|
1097
1123
|
const table = tableConfig || this._table();
|
|
1098
1124
|
if (!table)
|
|
1099
1125
|
return;
|
|
1100
1126
|
const previousTotalRecords = this._totalRecords();
|
|
1101
1127
|
const newData = [];
|
|
1102
|
-
let totalRecords = 0;
|
|
1103
1128
|
data.forEach((item) => {
|
|
1104
1129
|
let newItem = {};
|
|
1105
1130
|
table.columns.forEach((col) => {
|
|
@@ -1109,17 +1134,10 @@ class TableroService {
|
|
|
1109
1134
|
if (table?.dataKey && !newItem[table.dataKey]) {
|
|
1110
1135
|
newItem[table.dataKey] = this.getValue(table.dataKey, item);
|
|
1111
1136
|
}
|
|
1112
|
-
if (table?.customPaginator &&
|
|
1113
|
-
totalRecords === 0 &&
|
|
1114
|
-
item['TotalRecords'] !== undefined) {
|
|
1115
|
-
totalRecords = item['TotalRecords'] || data.length;
|
|
1116
|
-
}
|
|
1117
|
-
// const missingKeys = Object.keys(item).filter(key => !(key in newItem));
|
|
1118
|
-
// missingKeys.forEach(key => {
|
|
1119
|
-
// newItem[key] = item[key];
|
|
1120
|
-
// })
|
|
1121
1137
|
newData.push(newItem);
|
|
1122
1138
|
});
|
|
1139
|
+
// Determinar total de registros: prioridad al valor externo, luego fallback
|
|
1140
|
+
let totalRecords = externalTotalRecords || 0;
|
|
1123
1141
|
if (totalRecords === 0) {
|
|
1124
1142
|
totalRecords =
|
|
1125
1143
|
previousTotalRecords > 0 ? previousTotalRecords : newData.length;
|
|
@@ -1156,6 +1174,9 @@ class TableroService {
|
|
|
1156
1174
|
case '@searchValue':
|
|
1157
1175
|
endpoint = endpoint.replace(key.key, encodeURIComponent(this._searchValue()));
|
|
1158
1176
|
break;
|
|
1177
|
+
case '@total':
|
|
1178
|
+
endpoint = endpoint.replace(key.key, this._totalRecords().toString());
|
|
1179
|
+
break;
|
|
1159
1180
|
default:
|
|
1160
1181
|
if (key.key.startsWith('@filter.')) {
|
|
1161
1182
|
const filterKey = key.key.replace('@filter.', '');
|
|
@@ -1300,11 +1321,13 @@ class TableroService {
|
|
|
1300
1321
|
// Debounce de 400ms para evitar múltiples llamadas
|
|
1301
1322
|
this.searchTimeout = setTimeout(() => {
|
|
1302
1323
|
this._currentPage.set(1);
|
|
1324
|
+
this._totalRecords.set(0);
|
|
1303
1325
|
this.getInfoTablero();
|
|
1304
1326
|
}, 400);
|
|
1305
1327
|
}
|
|
1306
1328
|
refresh() {
|
|
1307
1329
|
this._currentPage.set(1);
|
|
1330
|
+
this._totalRecords.set(0);
|
|
1308
1331
|
this.getInfoTablero();
|
|
1309
1332
|
}
|
|
1310
1333
|
destroy() {
|
|
@@ -1337,6 +1360,7 @@ class TableroService {
|
|
|
1337
1360
|
this._filterValue.set(value);
|
|
1338
1361
|
if (this._table()?.customPaginator) {
|
|
1339
1362
|
this._currentPage.set(1);
|
|
1363
|
+
this._totalRecords.set(0);
|
|
1340
1364
|
this.getInfoTablero();
|
|
1341
1365
|
}
|
|
1342
1366
|
}
|
|
@@ -1634,13 +1658,17 @@ class TableroComponent {
|
|
|
1634
1658
|
this.selectFilter = true;
|
|
1635
1659
|
fallback(value);
|
|
1636
1660
|
}
|
|
1661
|
+
isSingleOption(col) {
|
|
1662
|
+
const options = this.tableroService.optionsMap().get(col);
|
|
1663
|
+
return options && options.length === 1;
|
|
1664
|
+
}
|
|
1637
1665
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TableroComponent, deps: [{ token: SfCrudService }, { token: TableroService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1638
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: TableroComponent, isStandalone: true, selector: "sf-crudtablero", inputs: { opciones: "opciones", idEntidad: "idEntidad", idKatios: "idKatios", environment: "environment", user: "user", dataExt: "dataExt", showCreateButton: "showCreateButton", customConfig: "customConfig", table: "table", customFilters: "customFilters", rowsPerPage: "rowsPerPage", optionsMap: "optionsMap" }, outputs: { onSelectAction: "onSelectAction" }, host: { properties: { "style.--secondary-color": "this.color2", "style.--button-color": "this.colorButtons" } }, usesOnChanges: true, ngImport: i0, template: "<!-- <p-toolbar styleClass=\"mb-4 gap-2\" *ngIf=\"btn.create\">\r\n <ng-template #start>\r\n <button pButton pRipple [label]=\"btn.create.label\" [icon]=\"btn.create.icon\" class=\"p-button-success mr-2\"\r\n (click)=\"showAddDialog()\"></button>\r\n </ng-template>\r\n</p-toolbar> -->\r\n<p-table #dt [columns]=\"tableConfig?.columns\" [value]=\"displayData\" [rowHover]=\"true\"\r\n [rows]=\"totalRows\" [paginator]=\"true\" [totalRecords]=\"totalRecords\" [lazy]=\"tableConfig?.customPaginator || false\"\r\n [first]=\"first\" [globalFilterFields]=\"tableConfig?.filters || []\"\r\n [tableStyle]=\"{'min-width': '75rem'}\" currentPageReportTemplate=\"Registro {first} al {last} de {totalRecords}\"\r\n [showCurrentPageReport]=\"true\" [selectionMode]=\"tableConfig?.selectionMode || null\" [(selection)]=\"itemSelected\"\r\n [dataKey]=\"tableConfig?.dataKey\" (onRowSelect)=\"goToDetail($event)\" (onLazyLoad)=\"pageChange($event)\">\r\n <ng-template pTemplate=\"caption\">\r\n <lib-tablero-header (searchChange)=\"onGlobalSearch($event, dt)\"></lib-tablero-header> \r\n </ng-template>\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th *ngFor=\"let col of columns\">\r\n <div class=\"flex align-items-center justify-between\">\r\n {{col.label}}\r\n <ng-container *ngIf=\"col.filter\" [ngSwitch]=\"col.filter.type\">\r\n <p-columnFilter *ngSwitchCase=\"'text'\" type=\"text\" [field]=\"col.filter.field\"\r\n [display]=\"col.filter.display\" [showMatchModes]=\"col.filter.showMatchModes || false\"\r\n [showOperator]=\"col.filter.showOperator || false\"\r\n [showAddButton]=\"col.filter.showAddButton || false\" \r\n [showApplyButton]=\"col.filter.showApplyButton || false\" />\r\n <p-columnFilter *ngSwitchCase=\"'list'\" [field]=\"col.filter.field\" [display]=\"col.filter.display\"\r\n [matchMode]=\"col.filter.matchMode || 'equals'\"\r\n [showMatchModes]=\"col.filter.showMatchModes || false\"\r\n [showOperator]=\"col.filter.showOperator || false\"\r\n [showAddButton]=\"col.filter.showAddButton || false\"\r\n [showApplyButton]=\"col.filter.showApplyButton || false\"\r\n >\r\n <ng-template #filter let-value let-filter=\"filterCallback\">\r\n <p-select [ngModel]=\"value\" [options]=\"filterOptions.get(col.col) ?? []\"\r\n placeholder=\"Seleccione\" class=\"w-full\"\r\n [optionLabel]=\"col.filter?.config?.optionLabel\"\r\n [optionValue]=\"col.filter?.config?.optionValue\"\r\n (onChange)=\"filterValue($event.value, filter)\" />\r\n </ng-template>\r\n </p-columnFilter>\r\n <p-columnFilter *ngSwitchCase=\"'multiselect'\" [field]=\"col.filter.field\"\r\n [display]=\"col.filter.display\" [matchMode]=\"col.filter.matchMode || 'in'\"\r\n [showMatchModes]=\"col.filter.showMatchModes || false\"\r\n [showOperator]=\"col.filter.showOperator || false\"\r\n [showAddButton]=\"col.filter.showAddButton || false\"\r\n [showApplyButton]=\"col.filter.showApplyButton || false\" \r\n >\r\n <ng-template #filter let-value let-filter=\"filterCallback\">\r\n <p-multiselect [ngModel]=\"value\" [options]=\"filterOptions.get(col.col) ?? []\"\r\n placeholder=\"Seleccione\" class=\"w-full\"\r\n [optionLabel]=\"col.filter?.config?.optionLabel\"\r\n [optionValue]=\"col.filter?.config?.optionValue\"\r\n [panelStyle]=\"{ minWidth: '16rem' }\"\r\n (onChange)=\"filterValue($event.value, filter)\" >\r\n </p-multiselect>\r\n </ng-template>\r\n </p-columnFilter>\r\n </ng-container>\r\n </div>\r\n </th>\r\n <th *ngIf=\"tableConfig?.showActions\">Acci\u00F3n</th>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\" let-index=\"rowIndex\">\r\n <!-- Skeleton cuando est\u00E1 cargando paginaci\u00F3n -->\r\n <tr *ngIf=\"isLoadingData\">\r\n <td *ngFor=\"let col of columns\">\r\n <p-skeleton [width]=\"col.type === 'tag' ? '6rem' : '100%'\" height=\"1.5rem\"></p-skeleton>\r\n </td>\r\n <td *ngIf=\"tableConfig?.showActions\">\r\n <p-skeleton width=\"3rem\" height=\"2rem\" borderRadius=\"4px\"></p-skeleton>\r\n </td>\r\n </tr>\r\n <!-- Datos reales -->\r\n <tr *ngIf=\"!isLoadingData\" [pSelectableRow]=\"rowData\">\r\n <ng-container *ngFor=\"let col of columns\">\r\n <td>\r\n @switch (col.type) {\r\n @case('date:yyyy-mm-dd'){\r\n {{rowData[col.col] | date: 'yyyy-MM-dd'}}\r\n }\r\n @case('currency:USD'){\r\n {{rowData[col.col] | currency: 'USD'}}\r\n }\r\n @case('tag'){\r\n <p-tag [value]=\"rowData[col.col]\" [ngClass]=\"rowData[col.col] ? (col.class || '') : 'hidden'\" />\r\n }\r\n @case('icon'){\r\n @if(col.classCondition){\r\n @if(col.classCondition[rowData[col.col]].type === 'image'){\r\n <img [src]=\"col.classCondition[rowData[col.col]].src\" alt=\"icon\"\r\n [ngClass]=\"col.classCondition[rowData[col.col]].class || ''\" />\r\n }\r\n @else{\r\n <i class=\"pi\" [ngClass]=\"col.classCondition[rowData[col.col]].class\"></i>\r\n }\r\n }\r\n @else {\r\n <i class=\"pi\" [ngClass]=\"col.class || ''\"></i>\r\n }\r\n }\r\n @default{\r\n {{rowData[col.col]}}\r\n }\r\n }\r\n </td>\r\n <!-- <td *ngSwitchCase=\"'date:yyyy-mm-dd'\">{{rowData[col.col] | date: 'yyyy-MM-dd'}}</td>\r\n <td *ngSwitchCase=\"'currency:USD'\">{{rowData[col.col] | currency: 'USD'}}</td>\r\n <td *ngSwitchCase=\"'tag'\">\r\n <p-tag [value]=\"rowData[col.col]\" [ngClass]=\"rowData[col.col] ? (col.class || '') : 'hidden'\" />\r\n </td>\r\n <td *ngSwitchCase=\"'icon'\">\r\n <i class=\"pi\" [ngClass]=\"col.col && col.classConditions ? col.classConditions[rowData[col.col]] : col.icon ? col.icon : ''\"></i>\r\n </td>\r\n <td *ngSwitchDefault>{{rowData[col.col]}}</td> -->\r\n </ng-container>\r\n <td *ngIf=\"tableConfig?.showActions\">\r\n <p-splitButton *ngIf=\"items.length > 1\" icon=\"pi pi-align-justify\" [model]=\"items\" appendTo=\"body\"\r\n (onDropdownClick)=\"itemSelected = rowData\"></p-splitButton>\r\n <div *ngIf=\"items.length <= 1\">\r\n <button *ngFor=\"let item of items\" pButton pRipple [icon]=\"item.icon\" class=\"mr-2\"\r\n (click)=\"itemSelected = rowData; item.command()\"></button>\r\n </div>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"emptymessage\" *ngIf=\"!loading.inProgress\">\r\n <tr>\r\n <td [attr.colspan]=\"(tableConfig?.columns?.length || 0) + 1\" class=\"text-center\">\r\n <div class=\"text-center text-gray-500 py-5\">\r\n <p-avatar icon=\"pi pi-info\" class=\"mr-2 surface-100 text-primary\" size=\"xlarge\" shape=\"circle\" />\r\n <p>{{tableConfig?.emptyMessage || 'No se encontraron registros.'}}</p>\r\n </div>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n</p-table>", styles: ["::ng-deep .p-datatable table{min-width:100%}button:not(.p-button-success){background:var(--secondary-color)!important;border:var(--secondary-color)!important;color:#fff}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i5.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "pipe", type: i5.CurrencyPipe, name: "currency" }, { kind: "pipe", type: i5.DatePipe, name: "date" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i5$2.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "virtualRowHeight", "selectAll"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i3$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i5$2.SelectableRow, selector: "[pSelectableRow]", inputs: ["pSelectableRow", "pSelectableRowIndex", "pSelectableRowDisabled"] }, { kind: "component", type: i5$2.ColumnFilter, selector: "p-columnFilter", inputs: ["field", "type", "display", "showMenu", "matchMode", "operator", "showOperator", "showClearButton", "showApplyButton", "showMatchModes", "showAddButton", "hideOnClear", "placeholder", "matchModeOptions", "maxConstraints", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "locale", "localeMatcher", "currency", "currencyDisplay", "useGrouping", "showButtons", "ariaLabel", "filterButtonProps"], outputs: ["onShow", "onHide"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i7.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "ngmodule", type: DropdownModule }, { kind: "ngmodule", type: InputTextModule }, { kind: "ngmodule", type: ToolbarModule }, { kind: "ngmodule", type: TooltipModule }, { kind: "ngmodule", type: DialogModule }, { kind: "ngmodule", type: CardModule }, { kind: "ngmodule", type: IconFieldModule }, { kind: "ngmodule", type: InputIconModule }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i8.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: MultiSelectModule }, { kind: "component", type: i9.MultiSelect, selector: "p-multiSelect, p-multiselect, p-multi-select", inputs: ["id", "ariaLabel", "style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "fluid", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "variant", "appendTo", "dataKey", "name", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "chipIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "loading", "virtualScrollItemSize", "loadingIcon", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "size", "showClear", "autofocus", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "defaultLabel", "placeholder", "options", "filterValue", "itemSize", "selectAll", "focusOnHover", "filterFields", "selectOnFocus", "autoOptionFocus", "highlightOnSelect"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad", "onRemove", "onSelectAllChange"] }, { kind: "ngmodule", type: SplitButtonModule }, { kind: "component", type: i10.SplitButton, selector: "p-splitbutton, p-splitButton, p-split-button", inputs: ["model", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "icon", "iconPos", "label", "tooltip", "tooltipOptions", "style", "styleClass", "menuStyle", "menuStyleClass", "dropdownIcon", "appendTo", "dir", "expandAriaLabel", "showTransitionOptions", "hideTransitionOptions", "buttonProps", "menuButtonProps", "autofocus", "disabled", "tabindex", "menuButtonDisabled", "buttonDisabled"], outputs: ["onClick", "onMenuHide", "onMenuShow", "onDropdownClick"] }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: i11.Tag, selector: "p-tag", inputs: ["style", "styleClass", "severity", "value", "icon", "rounded"] }, { kind: "ngmodule", type: AvatarModule }, { kind: "component", type: i12.Avatar, selector: "p-avatar", inputs: ["label", "icon", "image", "size", "shape", "style", "styleClass", "ariaLabel", "ariaLabelledBy"], outputs: ["onImageError"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i13.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: TableroHeaderComponent, selector: "lib-tablero-header", inputs: ["disabled"], outputs: ["searchChange"] }] });
|
|
1666
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: TableroComponent, isStandalone: true, selector: "sf-crudtablero", inputs: { opciones: "opciones", idEntidad: "idEntidad", idKatios: "idKatios", environment: "environment", user: "user", dataExt: "dataExt", showCreateButton: "showCreateButton", customConfig: "customConfig", table: "table", customFilters: "customFilters", rowsPerPage: "rowsPerPage", optionsMap: "optionsMap" }, outputs: { onSelectAction: "onSelectAction" }, host: { properties: { "style.--secondary-color": "this.color2", "style.--button-color": "this.colorButtons" } }, usesOnChanges: true, ngImport: i0, template: "<!-- <p-toolbar styleClass=\"mb-4 gap-2\" *ngIf=\"btn.create\">\r\n <ng-template #start>\r\n <button pButton pRipple [label]=\"btn.create.label\" [icon]=\"btn.create.icon\" class=\"p-button-success mr-2\"\r\n (click)=\"showAddDialog()\"></button>\r\n </ng-template>\r\n</p-toolbar> -->\r\n<p-table #dt [columns]=\"tableConfig?.columns\" [value]=\"displayData\" [rowHover]=\"true\" [rows]=\"totalRows\"\r\n [paginator]=\"true\" [totalRecords]=\"totalRecords\" [lazy]=\"tableConfig?.customPaginator || false\" [first]=\"first\"\r\n [globalFilterFields]=\"tableConfig?.filters || []\" [tableStyle]=\"{'min-width': '75rem'}\"\r\n currentPageReportTemplate=\"Registro {first} al {last} de {totalRecords}\" [showCurrentPageReport]=\"true\"\r\n [selectionMode]=\"tableConfig?.selectionMode || null\" [(selection)]=\"itemSelected\" [dataKey]=\"tableConfig?.dataKey\"\r\n (onRowSelect)=\"goToDetail($event)\" (onLazyLoad)=\"pageChange($event)\">\r\n <ng-template pTemplate=\"caption\">\r\n <lib-tablero-header (searchChange)=\"onGlobalSearch($event, dt)\"></lib-tablero-header>\r\n </ng-template>\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th *ngFor=\"let col of columns\">\r\n <div class=\"flex align-items-center justify-between\">\r\n {{col.label}}\r\n <ng-container *ngIf=\"col.filter\" [ngSwitch]=\"col.filter.type\">\r\n <p-columnFilter *ngSwitchCase=\"'text'\" type=\"text\" [field]=\"col.filter.field\"\r\n [display]=\"col.filter.display\" [showMatchModes]=\"col.filter.showMatchModes || false\"\r\n [showOperator]=\"col.filter.showOperator || false\"\r\n [showAddButton]=\"col.filter.showAddButton || false\"\r\n [showApplyButton]=\"col.filter.showApplyButton || false\" />\r\n <ng-container *ngSwitchCase=\"'list'\">\r\n <p-columnFilter *ngIf=\"!isSingleOption(col.filter.field)\" [field]=\"col.filter.field\"\r\n [display]=\"col.filter.display\" [matchMode]=\"col.filter.matchMode || 'equals'\"\r\n [showMatchModes]=\"col.filter.showMatchModes || false\"\r\n [showOperator]=\"col.filter.showOperator || false\"\r\n [showAddButton]=\"col.filter.showAddButton || false\"\r\n [showApplyButton]=\"col.filter.showApplyButton || false\">\r\n <ng-template #filter let-value let-filter=\"filterCallback\">\r\n <p-select [ngModel]=\"value\" [options]=\"filterOptions.get(col.col) ?? []\"\r\n placeholder=\"Seleccione\" class=\"w-full\"\r\n [optionLabel]=\"col.filter?.config?.optionLabel\"\r\n [optionValue]=\"col.filter?.config?.optionValue\"\r\n (onChange)=\"filterValue($event.value, filter)\" />\r\n </ng-template>\r\n </p-columnFilter>\r\n </ng-container>\r\n <p-columnFilter *ngSwitchCase=\"'multiselect'\" [field]=\"col.filter.field\"\r\n [display]=\"col.filter.display\" [matchMode]=\"col.filter.matchMode || 'in'\"\r\n [showMatchModes]=\"col.filter.showMatchModes || false\"\r\n [showOperator]=\"col.filter.showOperator || false\"\r\n [showAddButton]=\"col.filter.showAddButton || false\"\r\n [showApplyButton]=\"col.filter.showApplyButton || false\">\r\n <ng-template #filter let-value let-filter=\"filterCallback\">\r\n <p-multiselect [ngModel]=\"value\" [options]=\"filterOptions.get(col.col) ?? []\"\r\n placeholder=\"Seleccione\" class=\"w-full\"\r\n [optionLabel]=\"col.filter?.config?.optionLabel\"\r\n [optionValue]=\"col.filter?.config?.optionValue\" [panelStyle]=\"{ minWidth: '16rem' }\"\r\n (onChange)=\"filterValue($event.value, filter)\">\r\n </p-multiselect>\r\n </ng-template>\r\n </p-columnFilter>\r\n </ng-container>\r\n </div>\r\n </th>\r\n <th *ngIf=\"tableConfig?.showActions\">Acci\u00F3n</th>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\" let-index=\"rowIndex\">\r\n <!-- Skeleton cuando est\u00E1 cargando paginaci\u00F3n -->\r\n <tr *ngIf=\"isLoadingData\">\r\n <td *ngFor=\"let col of columns\">\r\n <p-skeleton [width]=\"col.type === 'tag' ? '6rem' : '100%'\" height=\"1.5rem\"></p-skeleton>\r\n </td>\r\n <td *ngIf=\"tableConfig?.showActions\">\r\n <p-skeleton width=\"3rem\" height=\"2rem\" borderRadius=\"4px\"></p-skeleton>\r\n </td>\r\n </tr>\r\n <!-- Datos reales -->\r\n <tr *ngIf=\"!isLoadingData\" [pSelectableRow]=\"rowData\">\r\n <ng-container *ngFor=\"let col of columns\">\r\n <td>\r\n @switch (col.type) {\r\n @case('date:yyyy-mm-dd'){\r\n {{rowData[col.col] | date: 'yyyy-MM-dd'}}\r\n }\r\n @case('currency:USD'){\r\n {{rowData[col.col] | currency: 'USD'}}\r\n }\r\n @case('tag'){\r\n <p-tag [value]=\"rowData[col.col]\" [ngClass]=\"rowData[col.col] ? (col.class || '') : 'hidden'\" />\r\n }\r\n @case('icon'){\r\n @if(col.classCondition){\r\n @if(col.classCondition[rowData[col.col]].type === 'image'){\r\n <img [src]=\"col.classCondition[rowData[col.col]].src\" alt=\"icon\"\r\n [ngClass]=\"col.classCondition[rowData[col.col]].class || ''\" />\r\n }\r\n @else{\r\n <i class=\"pi\" [ngClass]=\"col.classCondition[rowData[col.col]].class\"></i>\r\n }\r\n }\r\n @else {\r\n <i class=\"pi\" [ngClass]=\"col.class || ''\"></i>\r\n }\r\n }\r\n @default{\r\n {{rowData[col.col]}}\r\n }\r\n }\r\n </td>\r\n <!-- <td *ngSwitchCase=\"'date:yyyy-mm-dd'\">{{rowData[col.col] | date: 'yyyy-MM-dd'}}</td>\r\n <td *ngSwitchCase=\"'currency:USD'\">{{rowData[col.col] | currency: 'USD'}}</td>\r\n <td *ngSwitchCase=\"'tag'\">\r\n <p-tag [value]=\"rowData[col.col]\" [ngClass]=\"rowData[col.col] ? (col.class || '') : 'hidden'\" />\r\n </td>\r\n <td *ngSwitchCase=\"'icon'\">\r\n <i class=\"pi\" [ngClass]=\"col.col && col.classConditions ? col.classConditions[rowData[col.col]] : col.icon ? col.icon : ''\"></i>\r\n </td>\r\n <td *ngSwitchDefault>{{rowData[col.col]}}</td> -->\r\n </ng-container>\r\n <td *ngIf=\"tableConfig?.showActions\">\r\n <p-splitButton *ngIf=\"items.length > 1\" icon=\"pi pi-align-justify\" [model]=\"items\" appendTo=\"body\"\r\n (onDropdownClick)=\"itemSelected = rowData\"></p-splitButton>\r\n <div *ngIf=\"items.length <= 1\">\r\n <button *ngFor=\"let item of items\" pButton pRipple [icon]=\"item.icon\" class=\"mr-2\"\r\n (click)=\"itemSelected = rowData; item.command()\"></button>\r\n </div>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"emptymessage\" *ngIf=\"!loading.inProgress\">\r\n <tr>\r\n <td [attr.colspan]=\"(tableConfig?.columns?.length || 0) + 1\" class=\"text-center\">\r\n <div class=\"text-center text-gray-500 py-5\">\r\n <p-avatar icon=\"pi pi-info\" class=\"mr-2 surface-100 text-primary\" size=\"xlarge\" shape=\"circle\" />\r\n <p>{{tableConfig?.emptyMessage || 'No se encontraron registros.'}}</p>\r\n </div>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n</p-table>", styles: ["::ng-deep .p-datatable table{min-width:100%}button:not(.p-button-success){background:var(--secondary-color)!important;border:var(--secondary-color)!important;color:#fff}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i5.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "pipe", type: i5.CurrencyPipe, name: "currency" }, { kind: "pipe", type: i5.DatePipe, name: "date" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i5$2.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "virtualRowHeight", "selectAll"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i3$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i5$2.SelectableRow, selector: "[pSelectableRow]", inputs: ["pSelectableRow", "pSelectableRowIndex", "pSelectableRowDisabled"] }, { kind: "component", type: i5$2.ColumnFilter, selector: "p-columnFilter", inputs: ["field", "type", "display", "showMenu", "matchMode", "operator", "showOperator", "showClearButton", "showApplyButton", "showMatchModes", "showAddButton", "hideOnClear", "placeholder", "matchModeOptions", "maxConstraints", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "locale", "localeMatcher", "currency", "currencyDisplay", "useGrouping", "showButtons", "ariaLabel", "filterButtonProps"], outputs: ["onShow", "onHide"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i7.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "ngmodule", type: DropdownModule }, { kind: "ngmodule", type: InputTextModule }, { kind: "ngmodule", type: ToolbarModule }, { kind: "ngmodule", type: TooltipModule }, { kind: "ngmodule", type: DialogModule }, { kind: "ngmodule", type: CardModule }, { kind: "ngmodule", type: IconFieldModule }, { kind: "ngmodule", type: InputIconModule }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i8.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: MultiSelectModule }, { kind: "component", type: i9.MultiSelect, selector: "p-multiSelect, p-multiselect, p-multi-select", inputs: ["id", "ariaLabel", "style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "fluid", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "variant", "appendTo", "dataKey", "name", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "chipIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "loading", "virtualScrollItemSize", "loadingIcon", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "size", "showClear", "autofocus", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "defaultLabel", "placeholder", "options", "filterValue", "itemSize", "selectAll", "focusOnHover", "filterFields", "selectOnFocus", "autoOptionFocus", "highlightOnSelect"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad", "onRemove", "onSelectAllChange"] }, { kind: "ngmodule", type: SplitButtonModule }, { kind: "component", type: i10.SplitButton, selector: "p-splitbutton, p-splitButton, p-split-button", inputs: ["model", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "icon", "iconPos", "label", "tooltip", "tooltipOptions", "style", "styleClass", "menuStyle", "menuStyleClass", "dropdownIcon", "appendTo", "dir", "expandAriaLabel", "showTransitionOptions", "hideTransitionOptions", "buttonProps", "menuButtonProps", "autofocus", "disabled", "tabindex", "menuButtonDisabled", "buttonDisabled"], outputs: ["onClick", "onMenuHide", "onMenuShow", "onDropdownClick"] }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: i11.Tag, selector: "p-tag", inputs: ["style", "styleClass", "severity", "value", "icon", "rounded"] }, { kind: "ngmodule", type: AvatarModule }, { kind: "component", type: i12.Avatar, selector: "p-avatar", inputs: ["label", "icon", "image", "size", "shape", "style", "styleClass", "ariaLabel", "ariaLabelledBy"], outputs: ["onImageError"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i13.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: TableroHeaderComponent, selector: "lib-tablero-header", inputs: ["disabled"], outputs: ["searchChange"] }] });
|
|
1639
1667
|
}
|
|
1640
1668
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TableroComponent, decorators: [{
|
|
1641
1669
|
type: Component,
|
|
1642
1670
|
args: [{ selector: 'sf-crudtablero', imports: [CommonModule, FormsModule, TableModule, ButtonModule, DropdownModule, InputTextModule, ToolbarModule, TooltipModule, DialogModule, CardModule, IconFieldModule, InputIconModule,
|
|
1643
|
-
SelectModule, MultiSelectModule, SplitButtonModule, TagModule, AvatarModule, SkeletonModule, TableroHeaderComponent], standalone: true, template: "<!-- <p-toolbar styleClass=\"mb-4 gap-2\" *ngIf=\"btn.create\">\r\n <ng-template #start>\r\n <button pButton pRipple [label]=\"btn.create.label\" [icon]=\"btn.create.icon\" class=\"p-button-success mr-2\"\r\n (click)=\"showAddDialog()\"></button>\r\n </ng-template>\r\n</p-toolbar> -->\r\n<p-table #dt [columns]=\"tableConfig?.columns\" [value]=\"displayData\" [rowHover]=\"true\"
|
|
1671
|
+
SelectModule, MultiSelectModule, SplitButtonModule, TagModule, AvatarModule, SkeletonModule, TableroHeaderComponent], standalone: true, template: "<!-- <p-toolbar styleClass=\"mb-4 gap-2\" *ngIf=\"btn.create\">\r\n <ng-template #start>\r\n <button pButton pRipple [label]=\"btn.create.label\" [icon]=\"btn.create.icon\" class=\"p-button-success mr-2\"\r\n (click)=\"showAddDialog()\"></button>\r\n </ng-template>\r\n</p-toolbar> -->\r\n<p-table #dt [columns]=\"tableConfig?.columns\" [value]=\"displayData\" [rowHover]=\"true\" [rows]=\"totalRows\"\r\n [paginator]=\"true\" [totalRecords]=\"totalRecords\" [lazy]=\"tableConfig?.customPaginator || false\" [first]=\"first\"\r\n [globalFilterFields]=\"tableConfig?.filters || []\" [tableStyle]=\"{'min-width': '75rem'}\"\r\n currentPageReportTemplate=\"Registro {first} al {last} de {totalRecords}\" [showCurrentPageReport]=\"true\"\r\n [selectionMode]=\"tableConfig?.selectionMode || null\" [(selection)]=\"itemSelected\" [dataKey]=\"tableConfig?.dataKey\"\r\n (onRowSelect)=\"goToDetail($event)\" (onLazyLoad)=\"pageChange($event)\">\r\n <ng-template pTemplate=\"caption\">\r\n <lib-tablero-header (searchChange)=\"onGlobalSearch($event, dt)\"></lib-tablero-header>\r\n </ng-template>\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th *ngFor=\"let col of columns\">\r\n <div class=\"flex align-items-center justify-between\">\r\n {{col.label}}\r\n <ng-container *ngIf=\"col.filter\" [ngSwitch]=\"col.filter.type\">\r\n <p-columnFilter *ngSwitchCase=\"'text'\" type=\"text\" [field]=\"col.filter.field\"\r\n [display]=\"col.filter.display\" [showMatchModes]=\"col.filter.showMatchModes || false\"\r\n [showOperator]=\"col.filter.showOperator || false\"\r\n [showAddButton]=\"col.filter.showAddButton || false\"\r\n [showApplyButton]=\"col.filter.showApplyButton || false\" />\r\n <ng-container *ngSwitchCase=\"'list'\">\r\n <p-columnFilter *ngIf=\"!isSingleOption(col.filter.field)\" [field]=\"col.filter.field\"\r\n [display]=\"col.filter.display\" [matchMode]=\"col.filter.matchMode || 'equals'\"\r\n [showMatchModes]=\"col.filter.showMatchModes || false\"\r\n [showOperator]=\"col.filter.showOperator || false\"\r\n [showAddButton]=\"col.filter.showAddButton || false\"\r\n [showApplyButton]=\"col.filter.showApplyButton || false\">\r\n <ng-template #filter let-value let-filter=\"filterCallback\">\r\n <p-select [ngModel]=\"value\" [options]=\"filterOptions.get(col.col) ?? []\"\r\n placeholder=\"Seleccione\" class=\"w-full\"\r\n [optionLabel]=\"col.filter?.config?.optionLabel\"\r\n [optionValue]=\"col.filter?.config?.optionValue\"\r\n (onChange)=\"filterValue($event.value, filter)\" />\r\n </ng-template>\r\n </p-columnFilter>\r\n </ng-container>\r\n <p-columnFilter *ngSwitchCase=\"'multiselect'\" [field]=\"col.filter.field\"\r\n [display]=\"col.filter.display\" [matchMode]=\"col.filter.matchMode || 'in'\"\r\n [showMatchModes]=\"col.filter.showMatchModes || false\"\r\n [showOperator]=\"col.filter.showOperator || false\"\r\n [showAddButton]=\"col.filter.showAddButton || false\"\r\n [showApplyButton]=\"col.filter.showApplyButton || false\">\r\n <ng-template #filter let-value let-filter=\"filterCallback\">\r\n <p-multiselect [ngModel]=\"value\" [options]=\"filterOptions.get(col.col) ?? []\"\r\n placeholder=\"Seleccione\" class=\"w-full\"\r\n [optionLabel]=\"col.filter?.config?.optionLabel\"\r\n [optionValue]=\"col.filter?.config?.optionValue\" [panelStyle]=\"{ minWidth: '16rem' }\"\r\n (onChange)=\"filterValue($event.value, filter)\">\r\n </p-multiselect>\r\n </ng-template>\r\n </p-columnFilter>\r\n </ng-container>\r\n </div>\r\n </th>\r\n <th *ngIf=\"tableConfig?.showActions\">Acci\u00F3n</th>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\" let-index=\"rowIndex\">\r\n <!-- Skeleton cuando est\u00E1 cargando paginaci\u00F3n -->\r\n <tr *ngIf=\"isLoadingData\">\r\n <td *ngFor=\"let col of columns\">\r\n <p-skeleton [width]=\"col.type === 'tag' ? '6rem' : '100%'\" height=\"1.5rem\"></p-skeleton>\r\n </td>\r\n <td *ngIf=\"tableConfig?.showActions\">\r\n <p-skeleton width=\"3rem\" height=\"2rem\" borderRadius=\"4px\"></p-skeleton>\r\n </td>\r\n </tr>\r\n <!-- Datos reales -->\r\n <tr *ngIf=\"!isLoadingData\" [pSelectableRow]=\"rowData\">\r\n <ng-container *ngFor=\"let col of columns\">\r\n <td>\r\n @switch (col.type) {\r\n @case('date:yyyy-mm-dd'){\r\n {{rowData[col.col] | date: 'yyyy-MM-dd'}}\r\n }\r\n @case('currency:USD'){\r\n {{rowData[col.col] | currency: 'USD'}}\r\n }\r\n @case('tag'){\r\n <p-tag [value]=\"rowData[col.col]\" [ngClass]=\"rowData[col.col] ? (col.class || '') : 'hidden'\" />\r\n }\r\n @case('icon'){\r\n @if(col.classCondition){\r\n @if(col.classCondition[rowData[col.col]].type === 'image'){\r\n <img [src]=\"col.classCondition[rowData[col.col]].src\" alt=\"icon\"\r\n [ngClass]=\"col.classCondition[rowData[col.col]].class || ''\" />\r\n }\r\n @else{\r\n <i class=\"pi\" [ngClass]=\"col.classCondition[rowData[col.col]].class\"></i>\r\n }\r\n }\r\n @else {\r\n <i class=\"pi\" [ngClass]=\"col.class || ''\"></i>\r\n }\r\n }\r\n @default{\r\n {{rowData[col.col]}}\r\n }\r\n }\r\n </td>\r\n <!-- <td *ngSwitchCase=\"'date:yyyy-mm-dd'\">{{rowData[col.col] | date: 'yyyy-MM-dd'}}</td>\r\n <td *ngSwitchCase=\"'currency:USD'\">{{rowData[col.col] | currency: 'USD'}}</td>\r\n <td *ngSwitchCase=\"'tag'\">\r\n <p-tag [value]=\"rowData[col.col]\" [ngClass]=\"rowData[col.col] ? (col.class || '') : 'hidden'\" />\r\n </td>\r\n <td *ngSwitchCase=\"'icon'\">\r\n <i class=\"pi\" [ngClass]=\"col.col && col.classConditions ? col.classConditions[rowData[col.col]] : col.icon ? col.icon : ''\"></i>\r\n </td>\r\n <td *ngSwitchDefault>{{rowData[col.col]}}</td> -->\r\n </ng-container>\r\n <td *ngIf=\"tableConfig?.showActions\">\r\n <p-splitButton *ngIf=\"items.length > 1\" icon=\"pi pi-align-justify\" [model]=\"items\" appendTo=\"body\"\r\n (onDropdownClick)=\"itemSelected = rowData\"></p-splitButton>\r\n <div *ngIf=\"items.length <= 1\">\r\n <button *ngFor=\"let item of items\" pButton pRipple [icon]=\"item.icon\" class=\"mr-2\"\r\n (click)=\"itemSelected = rowData; item.command()\"></button>\r\n </div>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"emptymessage\" *ngIf=\"!loading.inProgress\">\r\n <tr>\r\n <td [attr.colspan]=\"(tableConfig?.columns?.length || 0) + 1\" class=\"text-center\">\r\n <div class=\"text-center text-gray-500 py-5\">\r\n <p-avatar icon=\"pi pi-info\" class=\"mr-2 surface-100 text-primary\" size=\"xlarge\" shape=\"circle\" />\r\n <p>{{tableConfig?.emptyMessage || 'No se encontraron registros.'}}</p>\r\n </div>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n</p-table>", styles: ["::ng-deep .p-datatable table{min-width:100%}button:not(.p-button-success){background:var(--secondary-color)!important;border:var(--secondary-color)!important;color:#fff}\n"] }]
|
|
1644
1672
|
}], ctorParameters: () => [{ type: SfCrudService }, { type: TableroService }], propDecorators: { opciones: [{
|
|
1645
1673
|
type: Input
|
|
1646
1674
|
}], idEntidad: [{
|
|
@@ -1698,6 +1726,9 @@ class ConfigTablero {
|
|
|
1698
1726
|
rowsPerPage;
|
|
1699
1727
|
label;
|
|
1700
1728
|
customSearch;
|
|
1729
|
+
responseMapping;
|
|
1730
|
+
emptyMessage;
|
|
1731
|
+
showActions;
|
|
1701
1732
|
}
|
|
1702
1733
|
class ConfigRegistro {
|
|
1703
1734
|
operations = [];
|
|
@@ -2789,19 +2820,30 @@ class ControlComponent {
|
|
|
2789
2820
|
}
|
|
2790
2821
|
}
|
|
2791
2822
|
sendDependencyValue(data) {
|
|
2792
|
-
if (this.control.dependency
|
|
2793
|
-
if (
|
|
2794
|
-
this.setDependencyValue.emit({ data: data, scope: this.control.dependency.scope });
|
|
2795
|
-
}
|
|
2796
|
-
else if (typeof (this.control.dependency) === "object") {
|
|
2797
|
-
this.setDependencyValue.emit({ data: data[this.control.dependency.value], scope: this.control.dependency.scope });
|
|
2798
|
-
}
|
|
2799
|
-
else if (Array.isArray(this.control.dependency)) {
|
|
2823
|
+
if (this.control.dependency) {
|
|
2824
|
+
if (Array.isArray(this.control.dependency)) {
|
|
2800
2825
|
const array = this.control.dependency;
|
|
2801
2826
|
array.forEach((d) => {
|
|
2802
|
-
this.
|
|
2827
|
+
this.evaluateDependencyValue(data, d.value, d.scope);
|
|
2803
2828
|
});
|
|
2804
2829
|
}
|
|
2830
|
+
else {
|
|
2831
|
+
this.evaluateDependencyValue(data, this.control.dependency.value, this.control.dependency.scope);
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
evaluateDependencyValue(data, value, scope) {
|
|
2836
|
+
if ((this.control.subtype === 'dropdown' || this.control.subtype === 'multiselect' || this.control.subtype === 'group') && this.dataFromService.length > 0 && typeof (data) !== "object") {
|
|
2837
|
+
const selectedOption = this.dataFromService.find((item) => item[this.control.config?.optionValue] === data);
|
|
2838
|
+
if (selectedOption) {
|
|
2839
|
+
this.setDependencyValue.emit({ data: selectedOption[value], scope: scope });
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2842
|
+
else if (typeof (data) !== "object") {
|
|
2843
|
+
this.setDependencyValue.emit({ data: data, scope: scope });
|
|
2844
|
+
}
|
|
2845
|
+
else {
|
|
2846
|
+
this.setDependencyValue.emit({ data: data[value], scope: scope });
|
|
2805
2847
|
}
|
|
2806
2848
|
}
|
|
2807
2849
|
/**
|