UNPKG

@alauda-fe/common

Version:

Alauda frontend team common codes.

784 lines 103 kB
import { __decorate, __metadata } from "tslib"; import { handlePixel } from '@alauda/ui'; import { ChangeDetectionStrategy, Component, ContentChildren, EventEmitter, HostBinding, Input, Output, QueryList, TemplateRef, } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { get, isFunction, isObjectLike, isString, last } from 'lodash-es'; import { BehaviorSubject, combineLatest, map, merge, Observable, of, ReplaySubject, switchMap, tap, } from 'rxjs'; import { ACTION, CREATED_AT, LINK, UPDATE } from '../core/constants/constants'; import { isFieldNotAvailable } from '../core/pipes/field-not-available.pipe'; import { CREATOR, NAME } from '../core/services/k8s-util.service'; import { K8sResourceAction, } from '../core/types/k8s/public-api'; import { isK8sResource, noop, trackByUid } from '../core/utils/common'; import { ObservableInput } from '../core/utils/decorators'; import { publishRef } from '../core/utils/operators'; import { DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_PAGINATION_LAYOUT, } from './constants'; import { TableCellDefDirective } from './helpers.directive'; import { KNOWN_COLUMNS, TableUtilService } from './util.service'; import * as i0 from "@angular/core"; import * as i1 from "@angular/router"; import * as i2 from "./util.service"; import * as i3 from "@angular/common"; import * as i4 from "@alauda/ui"; import * as i5 from "../k8s-resource-list/footer/component"; import * as i6 from "../effect-directive/e2e-attribute-binding.directive"; import * as i7 from "../widget/relative-time/component"; import * as i8 from "../disabled-container/disabled-container.component"; import * as i9 from "../widget/terminating-tag/component"; import * as i10 from "../core/pipes/field-not-available.pipe"; import * as i11 from "../core/pipes/pure.pipe"; import * as i12 from "../core/pipes/k8s-util.pipe"; import * as i13 from "../translate/translate.pipe"; const _c0 = (a0, a1, a2, a3, a4) => ({ $implicit: a0, index: a1, even: a2, odd: a3, last: a4 }); const _c1 = (a0, a1) => ({ columnDef: a0, value: a1 }); const _c2 = (a0, a1) => ({ data: a0, columnDef: a1 }); const _c3 = a0 => ({ name: a0 }); const _c4 = (a0, a1) => [a0, "detail", a1]; const _c5 = (a0, a1) => ({ $implicit: a0, columnDef: a1 }); function TableComponent_ng_container_3_aui_table_header_cell_1_ng_container_1_span_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "span", 20); i0.ɵɵtext(1); i0.ɵɵpipe(2, "translate"); i0.ɵɵelementEnd(); } if (rf & 2) { const columnDef_r2 = i0.ɵɵnextContext(3).$implicit; i0.ɵɵproperty("start", columnDef_r2.sort.direction); i0.ɵɵadvance(); i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 2, columnDef_r2.label || columnDef_r2.name)); } } function TableComponent_ng_container_3_aui_table_header_cell_1_ng_container_1_span_2_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "span"); i0.ɵɵtext(1); i0.ɵɵpipe(2, "translate"); i0.ɵɵelementEnd(); } if (rf & 2) { const columnDef_r2 = i0.ɵɵnextContext(3).$implicit; i0.ɵɵadvance(); i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, columnDef_r2.label || columnDef_r2.name)); } } function TableComponent_ng_container_3_aui_table_header_cell_1_ng_container_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainerStart(0); i0.ɵɵtemplate(1, TableComponent_ng_container_3_aui_table_header_cell_1_ng_container_1_span_1_Template, 3, 4, "span", 19)(2, TableComponent_ng_container_3_aui_table_header_cell_1_ng_container_1_span_2_Template, 3, 3, "span", 15); i0.ɵɵelementContainerEnd(); } if (rf & 2) { const columnDef_r2 = i0.ɵɵnextContext(2).$implicit; i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", columnDef_r2.sort); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", !columnDef_r2.sort); } } function TableComponent_ng_container_3_aui_table_header_cell_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "aui-table-header-cell"); i0.ɵɵtemplate(1, TableComponent_ng_container_3_aui_table_header_cell_1_ng_container_1_Template, 3, 2, "ng-container", 15); i0.ɵɵelementEnd(); } if (rf & 2) { const columnDef_r2 = i0.ɵɵnextContext().$implicit; const ctx_r2 = i0.ɵɵnextContext(); i0.ɵɵstyleMap(columnDef_r2.style); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", columnDef_r2.name !== ctx_r2.ACTION); } } function TableComponent_ng_container_3_aui_table_cell_2_ng_container_1_ng_container_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainer(0); } } function TableComponent_ng_container_3_aui_table_cell_2_ng_container_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainerStart(0); i0.ɵɵtemplate(1, TableComponent_ng_container_3_aui_table_cell_2_ng_container_1_ng_container_1_Template, 1, 0, "ng-container", 23); i0.ɵɵelementContainerEnd(); } if (rf & 2) { const template_r4 = ctx.ngIf; const ctx_r4 = i0.ɵɵnextContext(); const data_r6 = ctx_r4.$implicit; const index_r7 = ctx_r4.index; const even_r8 = ctx_r4.even; const odd_r9 = ctx_r4.odd; const last_r10 = ctx_r4.last; i0.ɵɵadvance(); i0.ɵɵproperty("ngTemplateOutlet", template_r4)("ngTemplateOutletContext", i0.ɵɵpureFunction5(2, _c0, data_r6, index_r7, even_r8, odd_r9, last_r10)); } } function TableComponent_ng_container_3_aui_table_cell_2_ng_template_3_ng_container_0_ng_container_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainer(0); } } function TableComponent_ng_container_3_aui_table_cell_2_ng_template_3_ng_container_0_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainerStart(0); i0.ɵɵtemplate(1, TableComponent_ng_container_3_aui_table_cell_2_ng_template_3_ng_container_0_ng_container_1_Template, 1, 0, "ng-container", 23); i0.ɵɵelementContainerEnd(); } if (rf & 2) { const value_r11 = ctx.ngIf; const columnDef_r2 = i0.ɵɵnextContext(3).$implicit; i0.ɵɵnextContext(); const tableCellContent_r12 = i0.ɵɵreference(14); i0.ɵɵadvance(); i0.ɵɵproperty("ngTemplateOutlet", tableCellContent_r12)("ngTemplateOutletContext", i0.ɵɵpureFunction2(2, _c1, columnDef_r2, value_r11)); } } function TableComponent_ng_container_3_aui_table_cell_2_ng_template_3_Template(rf, ctx) { if (rf & 1) { i0.ɵɵtemplate(0, TableComponent_ng_container_3_aui_table_cell_2_ng_template_3_ng_container_0_Template, 2, 5, "ng-container", 22); i0.ɵɵpipe(1, "pure"); } if (rf & 2) { const data_r6 = i0.ɵɵnextContext().$implicit; const defaultTableCellTpl_r13 = i0.ɵɵreference(6); const columnDef_r2 = i0.ɵɵnextContext().$implicit; const ctx_r2 = i0.ɵɵnextContext(); i0.ɵɵproperty("ngIf", columnDef_r2.path != null && i0.ɵɵpipeBind4(1, 2, data_r6, ctx_r2.getValueFromPath, columnDef_r2.name, columnDef_r2.path))("ngIfElse", defaultTableCellTpl_r13); } } function TableComponent_ng_container_3_aui_table_cell_2_ng_template_5_ng_container_0_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainer(0); } } function TableComponent_ng_container_3_aui_table_cell_2_ng_template_5_Template(rf, ctx) { if (rf & 1) { i0.ɵɵtemplate(0, TableComponent_ng_container_3_aui_table_cell_2_ng_template_5_ng_container_0_Template, 1, 0, "ng-container", 23); } if (rf & 2) { const data_r6 = i0.ɵɵnextContext().$implicit; const columnDef_r2 = i0.ɵɵnextContext().$implicit; i0.ɵɵnextContext(); const defaultTableCell_r14 = i0.ɵɵreference(12); i0.ɵɵproperty("ngTemplateOutlet", defaultTableCell_r14)("ngTemplateOutletContext", i0.ɵɵpureFunction2(2, _c2, data_r6, columnDef_r2)); } } function TableComponent_ng_container_3_aui_table_cell_2_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "aui-table-cell", 21); i0.ɵɵtemplate(1, TableComponent_ng_container_3_aui_table_cell_2_ng_container_1_Template, 2, 8, "ng-container", 22); i0.ɵɵpipe(2, "pure"); i0.ɵɵtemplate(3, TableComponent_ng_container_3_aui_table_cell_2_ng_template_3_Template, 2, 7, "ng-template", null, 5, i0.ɵɵtemplateRefExtractor)(5, TableComponent_ng_container_3_aui_table_cell_2_ng_template_5_Template, 1, 5, "ng-template", null, 6, i0.ɵɵtemplateRefExtractor); i0.ɵɵelementEnd(); } if (rf & 2) { const tableCellDefTpl_r15 = i0.ɵɵreference(4); const columnDef_r2 = i0.ɵɵnextContext().$implicit; const ctx_r2 = i0.ɵɵnextContext(); i0.ɵɵstyleMap(columnDef_r2.style); i0.ɵɵproperty("direction", columnDef_r2.direction)("ngClass", columnDef_r2.class); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", i0.ɵɵpipeBind2(2, 6, columnDef_r2.name, ctx_r2.getColumnTemplate))("ngIfElse", tableCellDefTpl_r15); } } function TableComponent_ng_container_3_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainerStart(0, 16); i0.ɵɵtemplate(1, TableComponent_ng_container_3_aui_table_header_cell_1_Template, 2, 3, "aui-table-header-cell", 17)(2, TableComponent_ng_container_3_aui_table_cell_2_Template, 7, 9, "aui-table-cell", 18); i0.ɵɵelementContainerEnd(); } if (rf & 2) { const columnDef_r2 = ctx.$implicit; i0.ɵɵproperty("auiTableColumnDef", columnDef_r2.name)("sticky", columnDef_r2.sticky)("stickyEnd", columnDef_r2.stickyEnd); } } function TableComponent_aui_table_header_row_5_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelement(0, "aui-table-header-row"); } } function TableComponent_aui_table_row_7_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelement(0, "aui-table-row"); } } function TableComponent_ng_container_9_ng_container_1_ng_container_4_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainerStart(0); i0.ɵɵtext(1); i0.ɵɵpipe(2, "translate"); i0.ɵɵpipe(3, "translate"); i0.ɵɵelementContainerEnd(); } if (rf & 2) { const finalResourceName_r16 = ctx.ngIf; const ctx_r2 = i0.ɵɵnextContext(3); i0.ɵɵadvance(); i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind2(3, 3, "no_named_data_hint", i0.ɵɵpureFunction1(6, _c3, ctx_r2.resourceNameTranslated || i0.ɵɵpipeBind1(2, 1, finalResourceName_r16))), " "); } } function TableComponent_ng_container_9_ng_container_1_ng_container_10_ng_container_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainer(0, 28); } if (rf & 2) { const ctx_r2 = i0.ɵɵnextContext(4); i0.ɵɵproperty("ngTemplateOutlet", ctx_r2.loadingErrorTemplate); } } function TableComponent_ng_container_9_ng_container_1_ng_container_10_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainerStart(0); i0.ɵɵtemplate(1, TableComponent_ng_container_9_ng_container_1_ng_container_10_ng_container_1_Template, 1, 1, "ng-container", 27); i0.ɵɵelementContainerEnd(); } } function TableComponent_ng_container_9_ng_container_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainerStart(0); i0.ɵɵelementStart(1, "div", 25); i0.ɵɵpipe(2, "async"); i0.ɵɵpipe(3, "async"); i0.ɵɵtemplate(4, TableComponent_ng_container_9_ng_container_1_ng_container_4_Template, 4, 8, "ng-container", 22); i0.ɵɵpipe(5, "async"); i0.ɵɵelementEnd(); i0.ɵɵelementStart(6, "acl-k8s-resource-list-footer", 26); i0.ɵɵpipe(7, "async"); i0.ɵɵpipe(8, "async"); i0.ɵɵpipe(9, "async"); i0.ɵɵtemplate(10, TableComponent_ng_container_9_ng_container_1_ng_container_10_Template, 2, 0, "ng-container", 15); i0.ɵɵelementEnd(); i0.ɵɵelementContainerEnd(); } if (rf & 2) { let tmp_7_0; let tmp_10_0; const ctx_r2 = i0.ɵɵnextContext(2); const noData_r17 = i0.ɵɵreference(20); i0.ɵɵadvance(); i0.ɵɵproperty("hidden", ((tmp_7_0 = i0.ɵɵpipeBind1(2, 9, ctx_r2.pagedItems$)) == null ? null : tmp_7_0.length) || !((tmp_7_0 = i0.ɵɵpipeBind1(3, 11, ctx_r2.list.items$)) == null ? null : tmp_7_0.length)); i0.ɵɵadvance(3); i0.ɵɵproperty("ngIf", i0.ɵɵpipeBind1(5, 13, ctx_r2.finalResourceName$))("ngIfElse", noData_r17); i0.ɵɵadvance(2); i0.ɵɵproperty("hidden", !((tmp_10_0 = i0.ɵɵpipeBind1(7, 15, ctx_r2.pagedItems$)) == null ? null : tmp_10_0.length) && ((tmp_10_0 = i0.ɵɵpipeBind1(8, 17, ctx_r2.list.items$)) == null ? null : tmp_10_0.length))("list", ctx_r2.list)("resourceName", i0.ɵɵpipeBind1(9, 19, ctx_r2.finalResourceName$))("resourceNameTranslated", ctx_r2.resourceNameTranslated)("firstScrollLoad", ctx_r2.firstScrollLoad); i0.ɵɵadvance(4); i0.ɵɵproperty("ngIf", ctx_r2.loadingErrorTemplate); } } function TableComponent_ng_container_9_div_2_ng_container_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainerStart(0); i0.ɵɵtext(1); i0.ɵɵpipe(2, "translate"); i0.ɵɵpipe(3, "translate"); i0.ɵɵelementContainerEnd(); } if (rf & 2) { const ctx_r2 = i0.ɵɵnextContext(3); i0.ɵɵadvance(); i0.ɵɵtextInterpolate1(" ", ctx_r2.noDataHint || i0.ɵɵpipeBind2(3, 3, "no_named_data_hint", i0.ɵɵpureFunction1(6, _c3, ctx_r2.resourceNameTranslated || i0.ɵɵpipeBind1(2, 1, ctx_r2.resourceName))), " "); } } function TableComponent_ng_container_9_div_2_ng_template_3_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelement(0, "aui-icon", 30); i0.ɵɵtext(1); i0.ɵɵpipe(2, "translate"); } if (rf & 2) { i0.ɵɵadvance(); i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(2, 1, "loading_please_wait"), " "); } } function TableComponent_ng_container_9_div_2_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "div", 29); i0.ɵɵtemplate(1, TableComponent_ng_container_9_div_2_ng_container_1_Template, 4, 8, "ng-container", 22); i0.ɵɵpipe(2, "async"); i0.ɵɵtemplate(3, TableComponent_ng_container_9_div_2_ng_template_3_Template, 3, 3, "ng-template", null, 7, i0.ɵɵtemplateRefExtractor); i0.ɵɵelementEnd(); } if (rf & 2) { const loading_r18 = i0.ɵɵreference(4); const ctx_r2 = i0.ɵɵnextContext(2); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", i0.ɵɵpipeBind1(2, 2, ctx_r2.finalDataSource$))("ngIfElse", loading_r18); } } function TableComponent_ng_container_9_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainerStart(0); i0.ɵɵtemplate(1, TableComponent_ng_container_9_ng_container_1_Template, 11, 21, "ng-container", 15)(2, TableComponent_ng_container_9_div_2_Template, 5, 4, "div", 24); i0.ɵɵpipe(3, "async"); i0.ɵɵelementContainerEnd(); } if (rf & 2) { let tmp_7_0; const ctx_r2 = i0.ɵɵnextContext(); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", ctx_r2.list); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", !ctx_r2.list && !((tmp_7_0 = i0.ɵɵpipeBind1(3, 2, ctx_r2.pagedItems$)) == null ? null : tmp_7_0.length)); } } function TableComponent_ng_container_10_Template(rf, ctx) { if (rf & 1) { const _r19 = i0.ɵɵgetCurrentView(); i0.ɵɵelementContainerStart(0); i0.ɵɵelementStart(1, "aui-paginator", 31); i0.ɵɵpipe(2, "async"); i0.ɵɵpipe(3, "async"); i0.ɵɵlistener("currentPageChange", function TableComponent_ng_container_10_Template_aui_paginator_currentPageChange_1_listener($event) { i0.ɵɵrestoreView(_r19); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.currentPage$.next($event)); })("pageSizeChange", function TableComponent_ng_container_10_Template_aui_paginator_pageSizeChange_1_listener($event) { i0.ɵɵrestoreView(_r19); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.pageSize$.next($event)); }); i0.ɵɵelementEnd(); i0.ɵɵelementContainerEnd(); } if (rf & 2) { const ctx_r2 = i0.ɵɵnextContext(); i0.ɵɵadvance(); i0.ɵɵproperty("layout", ctx_r2.paginationLayout)("currentPage", i0.ɵɵpipeBind1(2, 5, ctx_r2.currentPage$))("pageSize", i0.ɵɵpipeBind1(3, 7, ctx_r2.pageSize$))("total", ctx_r2.pagination.total)("pageSizeOptions", ctx_r2.pageSizeOptions); } } function TableComponent_ng_template_11_ng_container_1_div_1_ng_container_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainerStart(0); i0.ɵɵelementStart(1, "a", 39); i0.ɵɵpipe(2, "async"); i0.ɵɵtext(3); i0.ɵɵelementEnd(); i0.ɵɵelementContainerEnd(); } if (rf & 2) { const name_r20 = i0.ɵɵnextContext().ngIf; const ctx_r2 = i0.ɵɵnextContext(3); i0.ɵɵadvance(); i0.ɵɵproperty("routerLink", i0.ɵɵpureFunction2(5, _c4, i0.ɵɵpipeBind1(2, 3, ctx_r2.isListPage$) ? ".." : ".", name_r20))("auiTooltip", name_r20); i0.ɵɵadvance(2); i0.ɵɵtextInterpolate1(" ", name_r20, " "); } } function TableComponent_ng_template_11_ng_container_1_div_1_ng_template_3_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "span", 40); i0.ɵɵpipe(1, "aclIsDeleting"); i0.ɵɵtext(2); i0.ɵɵelementEnd(); } if (rf & 2) { const name_r20 = i0.ɵɵnextContext().ngIf; const data_r21 = i0.ɵɵnextContext(2).data; i0.ɵɵclassProp("deleting-text", i0.ɵɵpipeBind1(1, 4, data_r21)); i0.ɵɵproperty("auiTooltip", name_r20); i0.ɵɵadvance(2); i0.ɵɵtextInterpolate(name_r20); } } function TableComponent_ng_template_11_ng_container_1_div_1_acl_deleting_tag_5_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelement(0, "acl-deleting-tag", 41); } if (rf & 2) { const data_r21 = i0.ɵɵnextContext(3).data; i0.ɵɵproperty("resource", data_r21); } } function TableComponent_ng_template_11_ng_container_1_div_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "div", 37); i0.ɵɵtemplate(1, TableComponent_ng_template_11_ng_container_1_div_1_ng_container_1_Template, 4, 8, "ng-container", 22); i0.ɵɵpipe(2, "aclIsDeleting"); i0.ɵɵtemplate(3, TableComponent_ng_template_11_ng_container_1_div_1_ng_template_3_Template, 3, 6, "ng-template", null, 8, i0.ɵɵtemplateRefExtractor)(5, TableComponent_ng_template_11_ng_container_1_div_1_acl_deleting_tag_5_Template, 1, 1, "acl-deleting-tag", 38); i0.ɵɵpipe(6, "pure"); i0.ɵɵelementEnd(); } if (rf & 2) { const plainName_r22 = i0.ɵɵreference(4); const ctx_r22 = i0.ɵɵnextContext(2); const data_r21 = ctx_r22.data; const columnDef_r24 = ctx_r22.columnDef; const ctx_r2 = i0.ɵɵnextContext(); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", (columnDef_r24.extra == null ? null : columnDef_r24.extra.link) !== false && !i0.ɵɵpipeBind1(2, 3, data_r21))("ngIfElse", plainName_r22); i0.ɵɵadvance(4); i0.ɵɵproperty("ngIf", i0.ɵɵpipeBind2(6, 5, data_r21, ctx_r2.isK8sResource)); } } function TableComponent_ng_template_11_ng_container_1_div_3_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "div", 42); i0.ɵɵpipe(1, "aclIsDeleting"); i0.ɵɵtext(2); i0.ɵɵelementEnd(); } if (rf & 2) { const displayName_r25 = ctx.ngIf; const data_r21 = i0.ɵɵnextContext(2).data; i0.ɵɵclassProp("deleting-text", i0.ɵɵpipeBind1(1, 3, data_r21)); i0.ɵɵadvance(2); i0.ɵɵtextInterpolate1(" ", displayName_r25, " "); } } function TableComponent_ng_template_11_ng_container_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainerStart(0); i0.ɵɵtemplate(1, TableComponent_ng_template_11_ng_container_1_div_1_Template, 7, 8, "div", 35); i0.ɵɵpipe(2, "pure"); i0.ɵɵtemplate(3, TableComponent_ng_template_11_ng_container_1_div_3_Template, 3, 5, "div", 36); i0.ɵɵpipe(4, "pure"); i0.ɵɵpipe(5, "aclDisplayName"); i0.ɵɵelementContainerEnd(); } if (rf & 2) { const ctx_r22 = i0.ɵɵnextContext(); const data_r21 = ctx_r22.data; const columnDef_r24 = ctx_r22.columnDef; const ctx_r2 = i0.ɵɵnextContext(); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", i0.ɵɵpipeBind3(2, 2, data_r21, ctx_r2.getValueFromPath, columnDef_r24.name)); i0.ɵɵadvance(2); i0.ɵɵproperty("ngIf", i0.ɵɵpipeBind2(4, 6, data_r21, ctx_r2.isK8sResource) ? i0.ɵɵpipeBind1(5, 9, data_r21) : data_r21.displayName); } } function TableComponent_ng_template_11_ng_container_2_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainerStart(0); i0.ɵɵelement(1, "acl-relative-time", 43); i0.ɵɵpipe(2, "pure"); i0.ɵɵelementContainerEnd(); } if (rf & 2) { const ctx_r22 = i0.ɵɵnextContext(); const data_r21 = ctx_r22.data; const columnDef_r24 = ctx_r22.columnDef; const ctx_r2 = i0.ɵɵnextContext(); i0.ɵɵadvance(); i0.ɵɵproperty("time", i0.ɵɵpipeBind3(2, 1, data_r21, ctx_r2.getValueFromPath, columnDef_r24.name)); } } function TableComponent_ng_template_11_ng_container_3_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainerStart(0); i0.ɵɵelementStart(1, "button", 44); i0.ɵɵelement(2, "aui-icon", 45); i0.ɵɵelementEnd(); i0.ɵɵelementContainerEnd(); } if (rf & 2) { const ctx_r22 = i0.ɵɵnextContext(); const data_r21 = ctx_r22.data; const columnDef_r24 = ctx_r22.columnDef; i0.ɵɵnextContext(); const menu_r26 = i0.ɵɵreference(16); i0.ɵɵadvance(); i0.ɵɵproperty("square", true)("auiDropdown", menu_r26)("auiDropdownContext", i0.ɵɵpureFunction2(3, _c5, data_r21, columnDef_r24)); } } function TableComponent_ng_template_11_ng_container_4_ng_container_1_ng_container_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainer(0); } } function TableComponent_ng_template_11_ng_container_4_ng_container_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainerStart(0); i0.ɵɵtemplate(1, TableComponent_ng_template_11_ng_container_4_ng_container_1_ng_container_1_Template, 1, 0, "ng-container", 23); i0.ɵɵelementContainerEnd(); } if (rf & 2) { const value_r27 = ctx.ngIf; const columnDef_r24 = i0.ɵɵnextContext(2).columnDef; i0.ɵɵnextContext(); const tableCellContent_r12 = i0.ɵɵreference(14); i0.ɵɵadvance(); i0.ɵɵproperty("ngTemplateOutlet", tableCellContent_r12)("ngTemplateOutletContext", i0.ɵɵpureFunction2(2, _c1, columnDef_r24, value_r27)); } } function TableComponent_ng_template_11_ng_container_4_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainerStart(0); i0.ɵɵtemplate(1, TableComponent_ng_template_11_ng_container_4_ng_container_1_Template, 2, 5, "ng-container", 22); i0.ɵɵpipe(2, "pure"); i0.ɵɵelementContainerEnd(); } if (rf & 2) { const ctx_r22 = i0.ɵɵnextContext(); const data_r21 = ctx_r22.data; const columnDef_r24 = ctx_r22.columnDef; const ctx_r2 = i0.ɵɵnextContext(); const empty_r28 = i0.ɵɵreference(18); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", i0.ɵɵpipeBind3(2, 2, data_r21, ctx_r2.getValueFromPath, columnDef_r24.name))("ngIfElse", empty_r28); } } function TableComponent_ng_template_11_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainerStart(0, 32); i0.ɵɵtemplate(1, TableComponent_ng_template_11_ng_container_1_Template, 6, 11, "ng-container", 33)(2, TableComponent_ng_template_11_ng_container_2_Template, 3, 5, "ng-container", 33)(3, TableComponent_ng_template_11_ng_container_3_Template, 3, 6, "ng-container", 33)(4, TableComponent_ng_template_11_ng_container_4_Template, 3, 6, "ng-container", 34); i0.ɵɵelementContainerEnd(); } if (rf & 2) { const columnDef_r24 = ctx.columnDef; const ctx_r2 = i0.ɵɵnextContext(); i0.ɵɵproperty("ngSwitch", columnDef_r24.name); i0.ɵɵadvance(); i0.ɵɵproperty("ngSwitchCase", ctx_r2.NAME); i0.ɵɵadvance(); i0.ɵɵproperty("ngSwitchCase", ctx_r2.CREATED_AT); i0.ɵɵadvance(); i0.ɵɵproperty("ngSwitchCase", ctx_r2.ACTION); } } function TableComponent_ng_template_13_ng_container_0_div_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "div", 47); i0.ɵɵtext(1); i0.ɵɵelementEnd(); } if (rf & 2) { const text_r29 = i0.ɵɵnextContext().ngIf; i0.ɵɵproperty("auiTooltip", text_r29); i0.ɵɵadvance(); i0.ɵɵtextInterpolate1(" ", text_r29, " "); } } function TableComponent_ng_template_13_ng_container_0_ng_template_2_Template(rf, ctx) { if (rf & 1) { i0.ɵɵtext(0); } if (rf & 2) { const text_r29 = i0.ɵɵnextContext().ngIf; i0.ɵɵtextInterpolate(text_r29); } } function TableComponent_ng_template_13_ng_container_0_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementContainerStart(0); i0.ɵɵtemplate(1, TableComponent_ng_template_13_ng_container_0_div_1_Template, 2, 2, "div", 46)(2, TableComponent_ng_template_13_ng_container_0_ng_template_2_Template, 1, 1, "ng-template", null, 9, i0.ɵɵtemplateRefExtractor); i0.ɵɵelementContainerEnd(); } if (rf & 2) { const plainText_r30 = i0.ɵɵreference(3); const columnDef_r31 = i0.ɵɵnextContext().columnDef; i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", columnDef_r31.ellipsis)("ngIfElse", plainText_r30); } } function TableComponent_ng_template_13_Template(rf, ctx) { if (rf & 1) { i0.ɵɵtemplate(0, TableComponent_ng_template_13_ng_container_0_Template, 4, 2, "ng-container", 22); i0.ɵɵpipe(1, "translate"); i0.ɵɵpipe(2, "pure"); i0.ɵɵpipe(3, "translate"); } if (rf & 2) { const columnDef_r31 = ctx.columnDef; const value_r32 = ctx.value; const ctx_r2 = i0.ɵɵnextContext(); const empty_r28 = i0.ɵɵreference(18); i0.ɵɵproperty("ngIf", columnDef_r31.translate == null ? value_r32 : columnDef_r31.translate === true ? i0.ɵɵpipeBind1(1, 2, value_r32) : i0.ɵɵpipeBind1(3, 8, i0.ɵɵpipeBind3(2, 4, value_r32, columnDef_r31.translate, ctx_r2.finalContext)))("ngIfElse", empty_r28); } } function TableComponent_ng_template_15_acl_disabled_container_1_Template(rf, ctx) { if (rf & 1) { const _r33 = i0.ɵɵgetCurrentView(); i0.ɵɵelementStart(0, "acl-disabled-container", 49); i0.ɵɵpipe(1, "pure"); i0.ɵɵpipe(2, "pure"); i0.ɵɵpipe(3, "pure"); i0.ɵɵpipe(4, "translate"); i0.ɵɵlistener("click", function TableComponent_ng_template_15_acl_disabled_container_1_Template_acl_disabled_container_click_0_listener() { i0.ɵɵrestoreView(_r33); const ctx_r33 = i0.ɵɵnextContext(); const data_r35 = ctx_r33.$implicit; const columnDef_r36 = ctx_r33.columnDef; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.onUpdate(data_r35, columnDef_r36)); }); i0.ɵɵelementStart(5, "aui-menu-item"); i0.ɵɵtext(6); i0.ɵɵpipe(7, "translate"); i0.ɵɵelementEnd()(); } if (rf & 2) { const ctx_r33 = i0.ɵɵnextContext(); const data_r35 = ctx_r33.$implicit; const columnDef_r36 = ctx_r33.columnDef; const ctx_r2 = i0.ɵɵnextContext(); i0.ɵɵproperty("isAllowed", !ctx_r2.permissions || ctx_r2.permissions.update)("isDisabled", i0.ɵɵpipeBind2(1, 4, columnDef_r36.extra == null ? null : columnDef_r36.extra.update == null ? null : columnDef_r36.extra.update.disabled.handler, ctx_r2.isFunction) && i0.ɵɵpipeBind3(2, 7, data_r35, columnDef_r36.extra.update.disabled.handler, ctx_r2.finalContext))("tooltip", i0.ɵɵpipeBind1(4, 16, i0.ɵɵpipeBind4(3, 11, columnDef_r36.extra == null ? null : columnDef_r36.extra.update == null ? null : columnDef_r36.extra.update.disabled.tooltip, ctx_r2.getValue, data_r35, ctx_r2.finalContext))); i0.ɵɵadvance(6); i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(7, 18, "update")); } } function TableComponent_ng_template_15_acl_disabled_container_2_Template(rf, ctx) { if (rf & 1) { const _r37 = i0.ɵɵgetCurrentView(); i0.ɵɵelementStart(0, "acl-disabled-container", 49); i0.ɵɵpipe(1, "pure"); i0.ɵɵpipe(2, "pure"); i0.ɵɵpipe(3, "pure"); i0.ɵɵpipe(4, "translate"); i0.ɵɵlistener("click", function TableComponent_ng_template_15_acl_disabled_container_2_Template_acl_disabled_container_click_0_listener() { i0.ɵɵrestoreView(_r37); const data_r35 = i0.ɵɵnextContext().$implicit; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.delete.emit(data_r35)); }); i0.ɵɵelementStart(5, "aui-menu-item"); i0.ɵɵtext(6); i0.ɵɵpipe(7, "translate"); i0.ɵɵelementEnd()(); } if (rf & 2) { const ctx_r33 = i0.ɵɵnextContext(); const data_r35 = ctx_r33.$implicit; const columnDef_r36 = ctx_r33.columnDef; const ctx_r2 = i0.ɵɵnextContext(); i0.ɵɵproperty("isAllowed", !ctx_r2.permissions || ctx_r2.permissions.delete)("isDisabled", i0.ɵɵpipeBind2(1, 4, columnDef_r36.extra == null ? null : columnDef_r36.extra.delete == null ? null : columnDef_r36.extra.delete.disabled.handler, ctx_r2.isFunction) && i0.ɵɵpipeBind3(2, 7, data_r35, columnDef_r36.extra.delete.disabled.handler, ctx_r2.finalContext))("tooltip", i0.ɵɵpipeBind1(4, 16, i0.ɵɵpipeBind4(3, 11, columnDef_r36.extra == null ? null : columnDef_r36.extra.delete == null ? null : columnDef_r36.extra.delete.disabled.tooltip, ctx_r2.getValue, data_r35, ctx_r2.finalContext))); i0.ɵɵadvance(6); i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(7, 18, "delete")); } } function TableComponent_ng_template_15_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "aui-menu"); i0.ɵɵtemplate(1, TableComponent_ng_template_15_acl_disabled_container_1_Template, 8, 20, "acl-disabled-container", 48)(2, TableComponent_ng_template_15_acl_disabled_container_2_Template, 8, 20, "acl-disabled-container", 48); i0.ɵɵelementEnd(); } if (rf & 2) { const columnDef_r36 = ctx.columnDef; i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", (columnDef_r36.extra == null ? null : columnDef_r36.extra.update) !== false); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", (columnDef_r36.extra == null ? null : columnDef_r36.extra.delete) !== false); } } function TableComponent_ng_template_17_Template(rf, ctx) { if (rf & 1) { i0.ɵɵtext(0); i0.ɵɵpipe(1, "aclFieldNotAvailable"); } if (rf & 2) { i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(1, 1, null)); } } function TableComponent_ng_template_19_Template(rf, ctx) { if (rf & 1) { i0.ɵɵtext(0); i0.ɵɵpipe(1, "translate"); } if (rf & 2) { i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(1, 1, "no_data")); } } export class TableComponent { get finalContext() { return this.context ?? this.util; } get scrollWrapper() { return !!this.sticky; } get scrollWrapperHeight() { return handlePixel(this.sticky); } get isListPage() { return this.route.routeConfig?.path === 'list'; } trackByName(_, columnDef) { return columnDef.name; } constructor(router, route, util) { this.router = router; this.route = route; this.util = util; this.trackBy = this.trackByFn; this.enablePagination = false; this.pageSize = DEFAULT_PAGE_SIZE; this.pageSizeOptions = DEFAULT_PAGE_SIZE_OPTIONS; this.paginationLayout = DEFAULT_PAGINATION_LAYOUT; this.update = new EventEmitter(); this.delete = new EventEmitter(); this.sortChange = new EventEmitter(); this.currentPage$ = new BehaviorSubject(1); this.pageSize$ = new BehaviorSubject(this.pageSize || DEFAULT_PAGE_SIZE); this.pagination = { total: 0, pages: 0, }; this.finalDataSource$ = this.dataSource$.pipe(switchMap(dataSource => dataSource instanceof Observable ? dataSource : of(dataSource)), publishRef()); this.finalResourceName$ = combineLatest([this.list$, this.resourceName$]).pipe(switchMap(([list, resourceName]) => !list || resourceName ? of(resourceName) : list.rawResponse$.pipe(map(res => res?.kind.slice(0, -4).toLowerCase()))), publishRef()); this.columnDefs$ = this.columns$.pipe(map(columns => (columns || []).map(column => { column = isString(column) ? { name: column } : column; if (!('path' in column) && !KNOWN_COLUMNS.has(column.name)) { column.path = column.name; } this.normalizeColumnDefSort(column); this.normalizeColumnDefTranslate(column); return this.normalizeActionColumnDef(column); })), publishRef()); this.columnNames$ = this.columnDefs$.pipe(map(columns => columns.map(column => column.name)), publishRef()); this.activeSort$$ = new ReplaySubject(1); this.activeSort$ = merge(this.activeSort$$, this.columnDefs$.pipe(map(columnDefs => { const columnDef = columnDefs.find(column => column.sort?.active); return columnDef ? { active: columnDef.name, direction: columnDef.sort.direction } : null; }))).pipe(publishRef()); this.filteredItems$ = combineLatest([ combineLatest([this.list$, this.finalDataSource$]).pipe(switchMap(([list, dataSource]) => (list ? list.items$ : of(dataSource)))), this.columnDefs$, this.activeSort$, this.filterParams$, this.filterFn$, ]).pipe(map(([items, columnDefs, activeSort, filterParams, filterFn = this.util.defaultFilterFn,]) => filterFn.call(this.finalContext, items, columnDefs, activeSort, filterParams, this.finalContext)), publishRef()); this.pagedItems$ = combineLatest([ this.filteredItems$, this.currentPage$, this.pageSize$, ]).pipe(tap(([items, _, pageSize]) => { if (this.enablePagination) { this.pagination = items.length === 0 ? { total: 0, pages: 0 } : { total: items.length, pages: Math.ceil(items.length / pageSize), }; } }), map(([items, currentPage, pageSize]) => { if (!this.enablePagination) { return items; } if (this.pagination.pages < currentPage && this.pagination.pages !== 0) { currentPage = this.pagination.pages; this.currentPage$.next(currentPage); } const begin = (currentPage - 1) * pageSize; return items.slice(begin, begin + pageSize); }), publishRef()); this.isListPage$ = this.route.url.pipe(map(() => this.isListPage), publishRef()); this.isFunction = isFunction; this.isK8sResource = isK8sResource; this.isFieldNotAvailable = isFieldNotAvailable; this.getValueFromPath = this.util.getValueFromPath; this.NAME = NAME; this.CREATOR = CREATOR; this.CREATED_AT = CREATED_AT; this.ACTION = ACTION; this.getColumnTemplate = this.getColumnTemplate.bind(this); } normalizeColumnDefTranslate(column) { const { translate } = column; if (translate == null) { return column; } if (translate === true) { column.translate = true; } if (isString(translate)) { column.translate = (value) => translate + value; } else if (isObjectLike(translate)) { column.translate = (value) => get(translate, value); } return column; } normalizeColumnDefSort(column) { const { sort } = column; if (sort == null) { return column; } if (sort === true) { column.sort = { direction: 'asc', }; } else if (isString(sort)) { column.sort = { direction: sort, }; } else if (isFunction(sort)) { column.sort = { direction: 'asc', handler: sort, }; } else if (sort.direction == null) { sort.direction = 'asc'; } return column; } onSortChange($event) { this.sortChange.next($event); this.activeSort$$.next($event); } normalizeActionColumnDef(column) { if (column.name !== ACTION || !column.extra) { return column; } const extra = column.extra; [K8sResourceAction.DELETE, K8sResourceAction.UPDATE].forEach(action => { if (!extra[action]) { return; } let handler = extra[action].disabled; if (handler == null) { handler = noop; } if (isFunction(handler)) { extra[action].disabled = { handler }; } }); return column; } getColumnTemplate(column) { return this.tableCellDefs.find(def => def.aclTableCellDef === column) ?.templateRef; } trackByFn(index, item) { return isK8sResource(item) ? trackByUid(index, item) : get(item, NAME, index); } onUpdate(data, columnDef) { this.update.emit(data); if (get(columnDef.extra, [UPDATE, LINK]) !== false) { this.router.navigate([ this.isListPage ? '..' : '.', UPDATE, this.getValueFromPath(data, NAME), ], { relativeTo: this.route, }); } } getValue(functionOrValue, ...args) { return isFunction(functionOrValue) ? functionOrValue.call(last(args), ...args) : functionOrValue; } static { this.ɵfac = function TableComponent_Factory(t) { return new (t || TableComponent)(i0.ɵɵdirectiveInject(i1.Router), i0.ɵɵdirectiveInject(i1.ActivatedRoute), i0.ɵɵdirectiveInject(i2.TableUtilService)); }; } static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TableComponent, selectors: [["acl-table"]], contentQueries: function TableComponent_ContentQueries(rf, ctx, dirIndex) { if (rf & 1) { i0.ɵɵcontentQuery(dirIndex, TableCellDefDirective, 4); } if (rf & 2) { let _t; i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.tableCellDefs = _t); } }, hostVars: 4, hostBindings: function TableComponent_HostBindings(rf, ctx) { if (rf & 2) { i0.ɵɵstyleProp("max-height", ctx.scrollWrapperHeight); i0.ɵɵclassProp("aui-table__scroll-wrapper", ctx.scrollWrapper); } }, inputs: { list: "list", dataSource: "dataSource", resourceName: "resourceName", resourceNameTranslated: "resourceNameTranslated", sticky: "sticky", permissions: "permissions", columns: "columns", filterParams: "filterParams", context: "context", filterFn: "filterFn", trackBy: "trackBy", noDataHint: "noDataHint", loadingErrorTemplate: "loadingErrorTemplate", enablePagination: "enablePagination", pageSize: "pageSize", pageSizeOptions: "pageSizeOptions", paginationLayout: "paginationLayout", firstScrollLoad: "firstScrollLoad" }, outputs: { update: "update", delete: "delete", sortChange: "sortChange" }, decls: 21, vars: 21, consts: [["defaultTableCell", ""], ["tableCellContent", ""], ["menu", ""], ["empty", ""], ["noData", ""], ["tableCellDefTpl", ""], ["defaultTableCellTpl", ""], ["loading", ""], ["plainName", ""], ["plainText", ""], ["auiSort", "", 3, "sortChange", "active", "direction", "dataSource", "trackBy", "auiTableScrollable"], [3, "auiTableColumnDef", "sticky", "stickyEnd", 4, "ngFor", "ngForOf", "ngForTrackBy"], [4, "auiTableHeaderRowDef", "auiTableHeaderRowDefSticky"], [4, "auiTableRowDef", "auiTableRowDefColumns"], [4, "auiTablePlaceholderDef"], [4, "ngIf"], [3, "auiTableColumnDef", "sticky", "stickyEnd"], [3, "style", 4, "auiTableHeaderCellDef"], [3, "direction", "ngClass", "style", 4, "auiTableCellDef"], ["aui-sort-header", "", 3, "start", 4, "ngIf"], ["aui-sort-header", "", 3, "start"], [3, "direction", "ngClass"], [4, "ngIf", "ngIfElse"], [4, "ngTemplateOutlet", "ngTemplateOutletContext"], ["class", "empty-placeholder", 4, "ngIf"], [1, "empty-placeholder", 3, "hidden"], [3, "hidden", "list", "resourceName", "resourceNameTranslated", "firstScrollLoad"], [3, "ngTemplateOutlet", 4, "aclK8sListFooterLoadingError"], [3, "ngTemplateOutlet"], [1, "empty-placeholder"], ["size", "16px", "icon", "spinner", 1, "acl-loading-mask__icon"], [3, "currentPageChange", "pageSizeChange", "layout", "currentPage", "pageSize", "total", "pageSizeOptions"], [3, "ngSwitch"], [4, "ngSwitchCase"], [4, "ngSwitchDefault"], ["class", "aui-table__cell__name", 4, "ngIf"], ["class", "aui-table__cell__display-name", 3, "deleting-text", 4, "ngIf"], [1, "aui-table__cell__name"], [3, "resource", 4, "ngIf"], [3, "routerLink", "auiTooltip"], [3, "auiTooltip"], [3, "resource"], [1, "aui-table__cell__display-name"], [3, "time"], ["aui-button", "text", "size", "small", 3, "square", "auiDropdown", "auiDropdownContext"], ["icon", "ellipsis_v_s"], ["class", "text-overflow", 3, "auiTooltip", 4, "ngIf", "ngIfElse"], [1, "text-overflow", 3, "auiTooltip"], [3, "isAllowed", "isDisabled", "tooltip", "click", 4, "ngIf"], [3, "click", "isAllowed", "isDisabled", "tooltip"]], template: function TableComponent_Template(rf, ctx) { if (rf & 1) { const _r1 = i0.ɵɵgetCurrentView(); i0.ɵɵelementStart(0, "aui-table", 10); i0.ɵɵpipe(1, "async"); i0.ɵɵpipe(2, "async"); i0.ɵɵlistener("sortChange", function TableComponent_Template_aui_table_sortChange_0_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onSortChange($event)); }); i0.ɵɵtemplate(3, TableComponent_ng_container_3_Template, 3, 3, "ng-container", 11); i0.ɵɵpipe(4, "async"); i0.ɵɵtemplate(5, TableComponent_aui_table_header_row_5_Template, 1, 0, "aui-table-header-row", 12); i0.ɵɵpipe(6, "async"); i0.ɵɵtemplate(7, TableComponent_aui_table_row_7_Template, 1, 0, "aui-table-row", 13); i0.ɵɵpipe(8, "async"); i0.ɵɵtemplate(9, TableComponent_ng_container_9_Template, 4, 4, "ng-container", 14); i0.ɵɵelementEnd(); i0.ɵɵtemplate(10, TableComponent_ng_container_10_Template, 4, 9, "ng-container", 15)(11, TableComponent_ng_template_11_Template, 5, 4, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor)(13, TableComponent_ng_template_13_Template, 4, 10, "ng-template", null, 1, i0.ɵɵtemplateRefExtractor)(15, TableComponent_ng_template_15_Template, 3, 2, "ng-template", null, 2, i0.ɵɵtemplateRefExtractor)(17, TableComponent_ng_template_17_Template, 2, 3, "ng-template", null, 3, i0.ɵɵtemplateRefExtractor)(19, TableComponent_ng_template_19_Template, 2, 3, "ng-template", null, 4, i0.ɵɵtemplateRefExtractor); } if (rf & 2) { let tmp_5_0; let tmp_6_0; i0.ɵɵproperty("active", (tmp_5_0 = i0.ɵɵpipeBind1(1, 11, ctx.activeSort$)) == null ? null : tmp_5_0.active)("direction", (tmp_6_0 = i0.ɵɵpipeBind1(2, 13, ctx.activeSort$)) == null ? null : tmp_6_0.direction)("dataSource", ctx.pagedItems$)("trackBy", ctx.trackBy)("auiTableScrollable", !!ctx.sticky); i0.ɵɵadvance(3); i0.ɵɵproperty("ngForOf", i0.ɵɵpipeBind1(4, 15, ctx.columnDefs$))("ngForTrackBy", ctx.trackByName); i0.ɵɵadvance(2); i0.ɵɵproperty("auiTableHeaderRowDef", i0.ɵɵpipeBind1(6, 17, ctx.columnNames$))("auiTableHeaderRowDefSticky", !!ctx.sticky); i0.ɵɵadvance(2); i0.ɵɵproperty("auiTableRowDefColumns", i0.ɵɵpipeBind1(8, 19, ctx.columnNames$)); i0.ɵɵadvance(3); i0.ɵɵproperty("ngIf", ctx.enablePagination); } }, dependencies: [i3.NgClass, i3.NgForOf, i3.NgIf, i3.NgTemplateOutlet, i3.NgSwitch, i3.NgSwitchCase, i3.NgSwitchDefault, i1.RouterLink, i4.ButtonComponent, i4.DropdownDirective, i4.MenuComponent, i4.MenuItemComponent, i4.IconComponent, i4.SortDirective, i4.SortHeaderComponent, i4.TooltipDirective, i4.TableComponent, i4.TableRowComponent, i4.TableHeaderRowComponent, i4.TableCellDirective, i4.TableCellDefDirective, i4.TableHeaderCellDirective, i4.TableRowDefDirective, i4.TableHeaderRowDefDirective, i4.TableHeaderCellDefDirective, i4.TableColumnDefDirective, i4.TablePlaceholderDefDirective, i4.TableScrollableDirective, i5.K8SResourceListFooterComponent, i5.K8sListFooterLoadingErrorDirective, i6.E2eAttributeBindingDirective, i7.RelativeTimeComponent, i8.DisabledContainerComponent, i9.TerminatingTagComponent, i4.PaginatorComponent, i3.AsyncPipe, i10.FieldNotAvailablePipe, i11.PurePipe, i12.K8sDisplayNamePipe, i12.K8sIsDeletingPipe, i13.TranslatePipe], styles: [".deleting-text[_ngcontent-%COMP%]{color:rgb(var(--aui-color-disabled-text))}[_nghost-%COMP%]{display:block}.aui-table__scroll-wrapper[_nghost-%COMP%]{display:flex}[_nghost-%COMP%] +acl-table{margin-top:12px}html:not([lang|=zh]) [_nghost-%COMP%] .aui-table__column-created_at{flex:0 0 140px}"], changeDetection: 0 }); } } __decorate([ ObservableInput(), __metadata("design:type", Observable) ], TableComponent.prototype, "list$", void 0); __decorate([ ObservableInput(), __metadata("design:type", Observable) ], TableComponent.prototype, "dataSource$", void 0); __decorate([ ObservableInput(), __metadata("design:type", Observable) ], TableComponent.prototype, "resourceName$", void 0); __decorate([ ObservableInput(), __metadata("design:type", Observable) ], TableComponent.prototype, "columns$", void 0); __decorate([ ObservableInput(), __metadata("design:type", Observable) ], TableComponent.prototype, "filterParams$", void 0); __decorate([ ObservableInput(), __metadata("design:type", Observable) ], TableComponent.prototype, "filterFn$", void 0); (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TableComponent, [{ type: Component, args: [{ selector: 'acl-table', changeDetection: ChangeDetectionStrategy.OnPush, template: "<aui-table\n auiSort\n [active]=\"(activeSort$ | async)?.active\"\n [direction]=\"(activeSort$ | async)?.direction\"\n [dataSource]=\"pagedItems$\"\n [trackBy]=\"trackBy\"\n (sortChange)=\"onSortChange($event)\"\n [auiTableScrollable]=\"!!sticky\"\n>\n <ng-container\n *ngFor=\"let columnDef of columnDefs$ | async; trackBy: trackByName\"\n [auiTableColumnDef]=\"columnDef.name\"\n [sticky]=\"columnDef.sticky\"\n [stickyEnd]=\"columnDef.stickyEnd\"\n >\n <aui-table-header-cell\n *auiTableHeaderCellDef\n [style]=\"columnDef.style\"\n >\n <ng-container *ngIf=\"columnDef.name !== ACTION\">\n <span\n *ngIf=\"columnDef.sort\"\n aui-sort-header\n [start]=\"columnDef.sort.direction\"\n >{{ columnDef.label || columnDef.name | translate }}</span\n >\n <span *ngIf=\"!columnDef.sort\">{{\n columnDef.label || columnDef.name | translate\n }}</span>\n </ng-container>\n </aui-table-header-cell>\n\n <aui-table-cell\n *auiTableCellDef=\"\n let data;\n let index = index;\n let even = even;\n let odd = odd;\n let last = last\n \"\n [direction]=\"columnDef.direction\"\n [ngClass]=\"columnDef.class\"\n [style]=\"columnDef.style\"\n >\n <ng-container\n *ngIf=\"\n columnDef.name | pure: getColumnTemplate as template;\n else tableCellDefTpl\n \"\n >\n <ng-container\n *ngTemplateOutlet=\"\n template;\n context: {\n $implicit: data,\n index: index,\n even: even,\n odd: odd,\n last: last,\n }\n \"\n ></ng-container>\n </ng-container>\n <ng-template #tableCellDefTpl>\n <ng-container\n *ngIf=\"\n columnDef.path != null &&\n (data\n | pure\n : getValueFromPath\n : columnDef.name\n : columnDef.path) as value;\n else defaultTableCellTpl\n \"\n >\n <ng-container\n *ngTemplateOutlet=\"\n tableCellContent;\n context: { columnDef: columnDef, value: value }\n \"\n ></ng-container>\n </ng-container>\n </ng-template>\n <ng-template #defaultTableCellTpl>\n <ng-container\n *ngTemplateOutlet=\"\n defaultTableCell;\n context: { data: data, columnDef: columnDef }\n \"\n ></ng-container>\n </ng-template>\n </aui-table-cell>\n </ng-container>\n\n <aui-table-header-row\n *auiTableHeaderRowDef=\"columnNames$ | async; sticky: !!sticky\"\n ></aui-table-header-row>\n <aui-table-row\n *auiTableRowDef=\"let row; columns: columnNames$ | async\"\n ></aui-table-row>\n\n <ng-container *auiTablePlaceholderDef>\n <ng-container *ngIf=\"list\">\n <div\n [hidden]=\"\n (pagedItems$ | async)?.length || !(list.items$ | async)?.length\n \"\n class=\"empty-placeholder\"\n >\n <ng-container\n *ngIf=\"finalResourceName$ | async as finalResourceName; else noData\"\n >\n {{\n 'no_named_data_hint'\n | translate\n : {\n name:\n resourceNameTranslated || (finalResourceName | translate),\n }\n }}\n </ng-container>\n </div>\n <acl-k8s-resource-list-footer\n [hidden]=\"\n !(pagedItems$ | async)?.length && (list.items$ | async)?.length\n \"\n [list]=\"list\"\n [resourceName]=\"finalResourceName$ | async\"\n [resourceNameTranslated]=\"resourceNameTranslated\"\n [firstScrollLoad]=\"firstScrollLoad\"\n >\n <ng-container *ngIf=\"loadingErrorTemplate\">\n <ng-container\n *aclK8sListFooterLoadingError\n [ngTemplateOutlet]=\"loadingErrorTemplate\"\n ></ng-container>\n </ng-container>\n </acl-k8s-resource-list-footer>\n </ng-container>\n <div\n *ngIf=\"!list && !(pagedItems$ | async)?.length\"\n class=\"empty-placeholder\"\n >\n <ng-container *ngIf=\"finalDataSource$ | async; else loading\">\n {{\n noDataHint ||\n ('no_named_data_hint'\n | translate\n : {\n name: resourceNameTranslated || (resourceName | translate),\n })\n }}\n </ng-container>\n <ng-template #loading>\n <aui-icon\n class=\"acl-loading-mask__icon\"\n size=\"16px\"\n icon=\"spinner\"\n ></aui-icon>\n {{ 'loading_please_wait' | translate }}\n </ng-template>\n </div>\n </ng-container>\n</aui-table>\n\n<ng-container *ngIf=\"enablePagination\">\n <aui-paginator\n [layout]=\"paginationLayout\"\n [currentPage]=\"currentPage$ | async\"\n [pageSize]=\"pageSize$ | async\"\n [total]=\"pagination.total\"\n (currentPageChange)=\"currentPage$.next($event)\"\n (pageSizeChange)=\"pageSize$.next($event)\"\n [pageSizeOptions]=\"pageSizeOptions\"\n ></aui-paginator>\n</ng-container>\n\n<ng-template\n #defaultTableCell\n let-data=\"data\"\n let-columnDef=\"columnDef\"\n>\n <ng-container [ngSwitch]=\"columnDef.name\">\n <ng-container *ngSwitchCase=\"NAME\">\n <div\n *ngIf=\"data | pure: getValueFro