import { CdkDrag, CdkDropList } from '@angular/cdk/drag-drop';
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, ViewChild, ViewChildren, } from '@angular/core';
import { DataTable2Component, } from '@vendure/admin-ui/core';
import * as i0 from "@angular/core";
import * as i1 from "@vendure/admin-ui/core";
import * as i2 from "@angular/cdk/drag-drop";
import * as i3 from "@clr/angular";
import * as i4 from "@angular/common";
import * as i5 from "ngx-pagination";
import * as i6 from "@ngx-translate/core";
export class CollectionDataTableComponent extends DataTable2Component {
    constructor(changeDetectorRef, localStorageService, dataService, dragDrop) {
        super(changeDetectorRef, localStorageService, dataService);
        this.changeDetectorRef = changeDetectorRef;
        this.localStorageService = localStorageService;
        this.dataService = dataService;
        this.dragDrop = dragDrop;
        this.changeOrder = new EventEmitter();
        this.dragRefs = [];
        this.absoluteIndex = {};
        this.sortPredicate = (index, item) => {
            const itemAtIndex = this.dropList.getSortedItems()[index];
            return itemAtIndex?.data.collection.parentId === item.data.collection.parentId;
        };
    }
    ngOnChanges(changes) {
        super.ngOnChanges(changes);
        if (changes.subCollections || changes.items) {
            const allCollections = [];
            for (const collection of this.items ?? []) {
                allCollections.push(collection);
                const subCollectionMatches = this.getSubcollections(collection);
                allCollections.push(...subCollectionMatches.flat());
            }
            allCollections.forEach((collection, index) => (this.absoluteIndex[collection.id] = index));
        }
    }
    ngAfterViewInit() {
        this.collectionRowList.changes.subscribe((val) => {
            this.dropList.getSortedItems().forEach(item => this.dropList.removeItem(item));
            for (const ref of val.toArray()) {
                ref.dropContainer = this.dropList;
                ref._dragRef._withDropContainer(this.dropList._dropListRef);
                this.dropList.addItem(ref);
            }
        });
    }
    getSubcollections(item) {
        return this.subCollections?.filter(c => c.parentId === item.id) ?? [];
    }
    onDrop(event) {
        const isTopLevel = event.item.data.collection.breadcrumbs.length === 2;
        const pageIndexOffset = isTopLevel ? (this.currentPage - 1) * this.itemsPerPage : 0;
        const parentId = event.item.data.collection.parentId;
        const parentIndex = this.items.findIndex(i => i.id === parentId);
        const adjustedIndex = pageIndexOffset + event.currentIndex - parentIndex - 1;
        this.changeOrder.emit({
            collectionId: event.item.data.collection.id,
            index: adjustedIndex,
            parentId: event.item.data.collection.parentId,
        });
        if (isTopLevel) {
            this.items = [...this.items];
            this.items.splice(event.previousIndex, 1);
            this.items.splice(event.currentIndex, 0, event.item.data.collection);
        }
        else {
            const parent = this.items.find(i => i.id === parentId);
            if (parent) {
                const subCollections = this.getSubcollections(parent);
                const adjustedPreviousIndex = pageIndexOffset + event.previousIndex - parentIndex - 1;
                subCollections.splice(adjustedPreviousIndex, 1);
                subCollections.splice(event.currentIndex, 0, event.item.data.collection);
            }
        }
        this.changeDetectorRef.markForCheck();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: CollectionDataTableComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.LocalStorageService }, { token: i1.DataService }, { token: i2.DragDrop }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: CollectionDataTableComponent, selector: "vdr-collection-data-table", inputs: { subCollections: "subCollections" }, outputs: { changeOrder: "changeOrder" }, viewQueries: [{ propertyName: "dropList", first: true, predicate: CdkDropList, descendants: true, static: true }, { propertyName: "collectionRowList", predicate: ["collectionRow"], descendants: true, read: CdkDrag }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<vdr-data-table-filter-presets\n    *ngIf=\"filters\"\n    [filters]=\"filters\"\n    [dataTableId]=\"id\"\n></vdr-data-table-filter-presets>\n<div class=\"table-wrapper\">\n    <div class=\"bulk-actions\">\n        <ng-content select=\"vdr-bulk-action-menu\"></ng-content>\n    </div>\n    <table class=\"\" [class.no-select]=\"disableSelect\">\n        <thead [class.items-selected]=\"selectionManager?.selection.length\">\n            <tr class=\"heading-row\">\n                <th *ngIf=\"selectionManager\" class=\"selection-col\">\n                    <div class=\"flex\">\n                        <div class=\"drag-handle-spacer\"></div>\n                        <input\n                            type=\"checkbox\"\n                            clrCheckbox\n                            [checked]=\"selectionManager?.areAllCurrentItemsSelected()\"\n                            (change)=\"onToggleAllClick()\"\n                        />\n                    </div>\n                </th>\n                <th\n                    *ngFor=\"let column of visibleSortedColumns; last as isLast\"\n                    [class.expand]=\"column.expand\"\n                >\n                    <div class=\"cell-content\" [ngClass]=\"column.align\">\n                        <vdr-ui-extension-point\n                            [locationId]=\"id\"\n                            [metadata]=\"column.id\"\n                            api=\"dataTable\"\n                            [topPx]=\"-6\"\n                            [leftPx]=\"-24\"\n                            display=\"block\"\n                        >\n                            <span>{{ column.heading }}</span>\n                        </vdr-ui-extension-point>\n                        <div *ngIf=\"column.sort as sort\" class=\"sort-toggle\">\n                            <button (click)=\"sort.toggleSortOrder()\" [class.active]=\"sort.sortOrder\">\n                                <clr-icon *ngIf=\"!sort.sortOrder\" shape=\"two-way-arrows left\"></clr-icon>\n                                <clr-icon *ngIf=\"sort.sortOrder === 'ASC'\" shape=\"arrow up\"></clr-icon>\n                                <clr-icon *ngIf=\"sort.sortOrder === 'DESC'\" shape=\"arrow down\"></clr-icon>\n                            </button>\n                            <div class=\"sort-label\" *ngIf=\"sort.sortOrder\">{{ sort.sortOrder }}</div>\n                        </div>\n                    </div>\n                </th>\n                <th>\n                    <div class=\"column-picker\">\n                        <vdr-data-table-colum-picker\n                            [uiLanguage]=\"uiLanguage$ | async\"\n                            [columns]=\"sortedColumns\"\n                            (reorder)=\"onColumnReorder($event)\"\n                            (resetColumns)=\"onColumnsReset()\"\n                        ></vdr-data-table-colum-picker>\n                    </div>\n                </th>\n            </tr>\n            <tr *ngIf=\"searchComponent || customSearchTemplate || filters?.length\">\n                <th\n                    [attr.colspan]=\"visibleSortedColumns.length + (selectionManager ? 2 : 1)\"\n                    class=\"filter-row\"\n                    [class.active]=\"showSearchFilterRow\"\n                >\n                    <button\n                        class=\"button-ghost toggle-search-filter-row\"\n                        [class.active]=\"showSearchFilterRow\"\n                        (click)=\"toggleSearchFilterRow()\"\n                        [title]=\"'common.search-and-filter-list' | translate\"\n                    >\n                        <clr-icon shape=\"search\"></clr-icon>\n                    </button>\n                    <div class=\"filter-row-wrapper\" [class.hidden]=\"!showSearchFilterRow\">\n                        <ng-container *ngTemplateOutlet=\"searchComponent?.template\"></ng-container>\n                        <ng-container *ngTemplateOutlet=\"customSearchTemplate\"></ng-container>\n                        <ng-container *ngIf=\"filters\">\n                            <div class=\"filters\">\n                                <vdr-data-table-filters\n                                    *ngFor=\"let activeFilter of filters.activeFilters\"\n                                    [filterWithValue]=\"activeFilter\"\n                                    [filters]=\"filters\"\n                                    class=\"mt-1\"\n                                ></vdr-data-table-filters>\n                                <vdr-data-table-filters\n                                    *ngIf=\"filters.length\"\n                                    [filters]=\"filters\"\n                                    class=\"mt-1\"\n                                ></vdr-data-table-filters>\n                                <vdr-add-filter-preset-button\n                                    [filters]=\"filters\"\n                                    [dataTableId]=\"id\"\n                                ></vdr-add-filter-preset-button>\n                            </div>\n                        </ng-container>\n                    </div>\n                </th>\n            </tr>\n        </thead>\n        <tbody\n            cdkDropList\n            cdkDropListLockAxis=\"y\"\n            (cdkDropListDropped)=\"onDrop($event)\"\n            [cdkDropListSortPredicate]=\"sortPredicate\"\n        >\n            <ng-container\n                *ngFor=\"\n                let item of items\n                    | paginate\n                        : {\n                              itemsPerPage: itemsPerPage,\n                              currentPage: currentPage,\n                              totalItems: totalItems,\n                              id: id,\n                          };\n                index as i;\n                trackBy: trackByFn\n            \"\n            >\n                <ng-container\n                    [ngTemplateOutlet]=\"collectionRowTmp\"\n                    [ngTemplateOutletContext]=\"{ item: item, i: i, depth: 0 }\"\n                ></ng-container>\n            </ng-container>\n            <ng-container>\n                <tr *ngIf=\"!items?.length\">\n                    <td [attr.colspan]=\"visibleSortedColumns.length + (selectionManager ? 2 : 1)\">\n                        <vdr-empty-placeholder [emptyStateLabel]=\"emptyStateLabel\"></vdr-empty-placeholder>\n                    </td>\n                </tr>\n            </ng-container>\n        </tbody>\n    </table>\n</div>\n<div class=\"table-footer\">\n    <vdr-items-per-page-controls\n        *ngIf=\"totalItems\"\n        [itemsPerPage]=\"itemsPerPage\"\n        (itemsPerPageChange)=\"itemsPerPageChange.emit($event)\"\n    ></vdr-items-per-page-controls>\n    <div *ngIf=\"totalItems\" class=\"p5 total-items-count\">\n        {{ 'common.total-items' | translate : { currentStart, currentEnd, totalItems } }}\n    </div>\n\n    <vdr-pagination-controls\n        *ngIf=\"totalItems\"\n        [id]=\"id\"\n        [currentPage]=\"currentPage\"\n        [itemsPerPage]=\"itemsPerPage\"\n        [totalItems]=\"totalItems\"\n        (pageChange)=\"pageChange.emit($event)\"\n    ></vdr-pagination-controls>\n</div>\n\n<ng-template #collectionRowTmp let-item=\"item\" let-depth=\"depth\">\n    <tr #collectionRow cdkDrag [cdkDragData]=\"{ depth: depth, collection: item }\" cdkDragBoundary=\"tbody\">\n        <td\n            *ngIf=\"selectionManager\"\n            [class.active]=\"activeIndex === absoluteIndex[item.id]\"\n            class=\"selection-col\"\n        >\n            <div class=\"flex\">\n                <div class=\"drag-handle\" cdkDragHandle [title]=\"'catalog.reorder-collection' | translate\">\n                    <clr-icon shape=\"drag-handle\"></clr-icon>\n                </div>\n                <input\n                    type=\"checkbox\"\n                    clrCheckbox\n                    [checked]=\"selectionManager?.isSelected(item)\"\n                    (click)=\"onRowClick(item, $event)\"\n                />\n            </div>\n        </td>\n        <td\n            *ngFor=\"let column of visibleSortedColumns\"\n            [class.active]=\"activeIndex === absoluteIndex[item.id]\"\n        >\n            <div class=\"cell-content\" [ngClass]=\"column.align\">\n                <ng-container\n                    *ngIf=\"customComponents.get(column.id) as componentConfig; else defaultComponent\"\n                >\n                    <ng-container\n                        *ngComponentOutlet=\"\n                            componentConfig.config.component;\n                            inputs: { rowItem: item };\n                            injector: componentConfig.injector\n                        \"\n                    ></ng-container>\n                </ng-container>\n                <ng-template #defaultComponent>\n                    <ng-container\n                        *ngTemplateOutlet=\"column.template; context: { item: item, depth: depth }\"\n                    ></ng-container>\n                </ng-template>\n            </div>\n        </td>\n        <td [class.active]=\"activeIndex === absoluteIndex[item.id]\"><!-- column select --></td>\n    </tr>\n    <ng-container *ngFor=\"let subCollection of getSubcollections(item)\">\n        <ng-container\n            *ngTemplateOutlet=\"collectionRowTmp; context: { item: subCollection, depth: depth + 1 }\"\n        ></ng-container>\n    </ng-container>\n</ng-template>\n", styles: [":host{display:block;max-width:100%;position:relative;margin-bottom:calc(var(--space-unit) * 4);container-type:inline-size}th{border-bottom:1px solid var(--color-table-header-border);font-size:var(--font-size-xs);font-weight:600;text-transform:uppercase;position:relative;white-space:nowrap}th,td{padding:calc(var(--space-unit) * 1.5) calc(var(--space-unit) * 1)}tr td:first-of-type,tr th:first-of-type{text-align:center}@media screen and (min-width: 992px){tr td:first-of-type,tr th:first-of-type{padding-inline-start:var(--surface-margin-left);text-align:start}}th:last-of-type,td:last-of-type{border-inline-end:1px solid var(--color-table-header-border)}tr:first-of-type th:last-of-type{border-image:linear-gradient(0deg,var(--color-table-header-border),transparent) 1}tr:last-of-type td:last-of-type{border-image:linear-gradient(180deg,var(--color-table-header-border),transparent) 1}tbody td{border-bottom:1px solid var(--color-table-row-separator)}tbody tr:hover{background-color:var(--color-table-row-hover-bg)}.bulk-actions{margin-inline-start:calc(var(--space-unit) * 5);background-color:var(--color-surface-bg);z-index:10;display:flex;position:absolute;top:5px;height:40px}@media screen and (min-width: 992px){.bulk-actions{margin-inline-start:calc(var(--space-unit) * 8.5)}}@media screen and (min-width: 1280px){.bulk-actions{margin-inline-start:calc(var(--space-unit) * 10.5)}}.table-wrapper{display:block;overflow-y:hidden;overflow-x:auto;position:relative;width:100%;max-width:var(--surface-width)}table{width:100%}table.no-select{-webkit-user-select:none;user-select:none}.column-picker{width:24px}.sort-toggle{display:flex;align-items:center;margin-inline-start:calc(var(--space-unit) * .5)}.sort-toggle button{border:0;border-radius:var(--border-radius-lg);color:var(--color-weight-500);padding:0 2px;cursor:pointer;background-color:transparent}.sort-toggle button.active{color:var(--color-primary-700)}.sort-toggle .sort-label{margin-inline-start:calc(var(--space-unit) * .5);font-size:10px;color:var(--color-primary-600);font-weight:400}.toggle-search-filter-row{position:absolute;top:-12px;left:4px}@media screen and (min-width: 1280px){.toggle-search-filter-row{left:8px}}.toggle-search-filter-row.active{background-color:var(--color-primary-700);color:var(--color-primary-100);border-color:var(--color-primary-700)}th.filter-row{position:relative;font-size:var(--font-size-base);font-weight:400;background-color:var(--color-weight-100);box-shadow:var(--data-table-filter-box-shadow);border-left-width:0;border-right-width:0;text-align:initial;padding:0}th.filter-row input{width:100%}th.filter-row.active{border-bottom:1px solid var(--color-table-header-border)}th.filter-row .filters{margin-top:calc(var(--space-unit) * 1);display:flex;flex-wrap:wrap;gap:calc(var(--space-unit) * .5)}.filter-row-wrapper{padding:calc(var(--space-unit) * 4);padding-inline-start:0;max-height:150px;transition:max-height .2s,padding .2s,opacity .2s}.filter-row-wrapper.hidden{max-height:0px;padding-top:0;padding-bottom:0;overflow:hidden;opacity:0}.cell-link{display:block;width:100%;height:100%}td.active{background-color:var(--color-table-row-active-bg)}.cell-content{display:flex;align-items:center;line-height:var(--font-size-sm);color:var(--color-weight-700)}.cell-content.left{justify-content:flex-start}.cell-content.center{justify-content:center}.cell-content.right{justify-content:flex-end}.selection-col{width:calc(var(--space-unit) * 8)}vdr-empty-placeholder{width:100%}.table-footer{display:flex;align-items:baseline;justify-content:space-between;margin-top:var(--space-unit);margin-inline-start:var(--surface-margin-left);margin-inline-end:var(--space-unit)}.total-items-count{font-size:var(--font-size-xs)}@container (max-width: 500px){.total-items-count{display:none}}\n", ".bulk-actions{margin-inline-start:calc(var(--space-unit) * 6);background-color:var(--color-surface-bg)}@media screen and (min-width: 992px){.bulk-actions{margin-inline-start:calc(var(--space-unit) * 9.5)}}@media screen and (min-width: 1280px){.bulk-actions{margin-inline-start:calc(var(--space-unit) * 11.5)}}.drag-handle{cursor:grab}.drag-handle-spacer{width:16px}.cdk-drop-list-dragging .cdk-drag{transition:transform .25s cubic-bezier(0,0,.2,1)}.cdk-drag-animating{transition:transform .3s cubic-bezier(0,0,.2,1)}.cdk-drag-preview{opacity:0}.cdk-drag-placeholder{background-color:var(--color-primary-100)!important}\n"], dependencies: [{ kind: "directive", type: i3.ClrDatagridItemsTrackBy, selector: "[ngForTrackBy]", inputs: ["ngForTrackBy"] }, { kind: "directive", type: i3.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i3.ClrCheckbox, selector: "[clrCheckbox],[clrToggle]" }, { kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i2.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: i1.ItemsPerPageControlsComponent, selector: "vdr-items-per-page-controls", inputs: ["itemsPerPage"], outputs: ["itemsPerPageChange"] }, { kind: "component", type: i1.PaginationControlsComponent, selector: "vdr-pagination-controls", inputs: ["id", "currentPage", "itemsPerPage", "totalItems"], outputs: ["pageChange"] }, { kind: "directive", type: i1.FormFieldControlDirective, selector: "input, textarea, select" }, { kind: "component", type: i1.EmptyPlaceholderComponent, selector: "vdr-empty-placeholder", inputs: ["emptyStateLabel"] }, { kind: "component", type: i1.UiExtensionPointComponent, selector: "vdr-ui-extension-point", inputs: ["locationId", "metadata", "topPx", "leftPx", "display", "api"] }, { kind: "component", type: i1.DataTableFiltersComponent, selector: "vdr-data-table-filters", inputs: ["filters", "filterWithValue"] }, { kind: "component", type: i1.DataTableColumnPickerComponent, selector: "vdr-data-table-colum-picker", inputs: ["columns", "uiLanguage"], outputs: ["reorder", "resetColumns"] }, { kind: "component", type: i1.DataTableFilterPresetsComponent, selector: "vdr-data-table-filter-presets", inputs: ["dataTableId", "filters"] }, { kind: "component", type: i1.AddFilterPresetButtonComponent, selector: "vdr-add-filter-preset-button", inputs: ["dataTableId", "filters"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }, { kind: "pipe", type: i5.PaginatePipe, name: "paginate" }, { kind: "pipe", type: i6.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: CollectionDataTableComponent, decorators: [{
            type: Component,
            args: [{ selector: 'vdr-collection-data-table', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-data-table-filter-presets\n    *ngIf=\"filters\"\n    [filters]=\"filters\"\n    [dataTableId]=\"id\"\n></vdr-data-table-filter-presets>\n<div class=\"table-wrapper\">\n    <div class=\"bulk-actions\">\n        <ng-content select=\"vdr-bulk-action-menu\"></ng-content>\n    </div>\n    <table class=\"\" [class.no-select]=\"disableSelect\">\n        <thead [class.items-selected]=\"selectionManager?.selection.length\">\n            <tr class=\"heading-row\">\n                <th *ngIf=\"selectionManager\" class=\"selection-col\">\n                    <div class=\"flex\">\n                        <div class=\"drag-handle-spacer\"></div>\n                        <input\n                            type=\"checkbox\"\n                            clrCheckbox\n                            [checked]=\"selectionManager?.areAllCurrentItemsSelected()\"\n                            (change)=\"onToggleAllClick()\"\n                        />\n                    </div>\n                </th>\n                <th\n                    *ngFor=\"let column of visibleSortedColumns; last as isLast\"\n                    [class.expand]=\"column.expand\"\n                >\n                    <div class=\"cell-content\" [ngClass]=\"column.align\">\n                        <vdr-ui-extension-point\n                            [locationId]=\"id\"\n                            [metadata]=\"column.id\"\n                            api=\"dataTable\"\n                            [topPx]=\"-6\"\n                            [leftPx]=\"-24\"\n                            display=\"block\"\n                        >\n                            <span>{{ column.heading }}</span>\n                        </vdr-ui-extension-point>\n                        <div *ngIf=\"column.sort as sort\" class=\"sort-toggle\">\n                            <button (click)=\"sort.toggleSortOrder()\" [class.active]=\"sort.sortOrder\">\n                                <clr-icon *ngIf=\"!sort.sortOrder\" shape=\"two-way-arrows left\"></clr-icon>\n                                <clr-icon *ngIf=\"sort.sortOrder === 'ASC'\" shape=\"arrow up\"></clr-icon>\n                                <clr-icon *ngIf=\"sort.sortOrder === 'DESC'\" shape=\"arrow down\"></clr-icon>\n                            </button>\n                            <div class=\"sort-label\" *ngIf=\"sort.sortOrder\">{{ sort.sortOrder }}</div>\n                        </div>\n                    </div>\n                </th>\n                <th>\n                    <div class=\"column-picker\">\n                        <vdr-data-table-colum-picker\n                            [uiLanguage]=\"uiLanguage$ | async\"\n                            [columns]=\"sortedColumns\"\n                            (reorder)=\"onColumnReorder($event)\"\n                            (resetColumns)=\"onColumnsReset()\"\n                        ></vdr-data-table-colum-picker>\n                    </div>\n                </th>\n            </tr>\n            <tr *ngIf=\"searchComponent || customSearchTemplate || filters?.length\">\n                <th\n                    [attr.colspan]=\"visibleSortedColumns.length + (selectionManager ? 2 : 1)\"\n                    class=\"filter-row\"\n                    [class.active]=\"showSearchFilterRow\"\n                >\n                    <button\n                        class=\"button-ghost toggle-search-filter-row\"\n                        [class.active]=\"showSearchFilterRow\"\n                        (click)=\"toggleSearchFilterRow()\"\n                        [title]=\"'common.search-and-filter-list' | translate\"\n                    >\n                        <clr-icon shape=\"search\"></clr-icon>\n                    </button>\n                    <div class=\"filter-row-wrapper\" [class.hidden]=\"!showSearchFilterRow\">\n                        <ng-container *ngTemplateOutlet=\"searchComponent?.template\"></ng-container>\n                        <ng-container *ngTemplateOutlet=\"customSearchTemplate\"></ng-container>\n                        <ng-container *ngIf=\"filters\">\n                            <div class=\"filters\">\n                                <vdr-data-table-filters\n                                    *ngFor=\"let activeFilter of filters.activeFilters\"\n                                    [filterWithValue]=\"activeFilter\"\n                                    [filters]=\"filters\"\n                                    class=\"mt-1\"\n                                ></vdr-data-table-filters>\n                                <vdr-data-table-filters\n                                    *ngIf=\"filters.length\"\n                                    [filters]=\"filters\"\n                                    class=\"mt-1\"\n                                ></vdr-data-table-filters>\n                                <vdr-add-filter-preset-button\n                                    [filters]=\"filters\"\n                                    [dataTableId]=\"id\"\n                                ></vdr-add-filter-preset-button>\n                            </div>\n                        </ng-container>\n                    </div>\n                </th>\n            </tr>\n        </thead>\n        <tbody\n            cdkDropList\n            cdkDropListLockAxis=\"y\"\n            (cdkDropListDropped)=\"onDrop($event)\"\n            [cdkDropListSortPredicate]=\"sortPredicate\"\n        >\n            <ng-container\n                *ngFor=\"\n                let item of items\n                    | paginate\n                        : {\n                              itemsPerPage: itemsPerPage,\n                              currentPage: currentPage,\n                              totalItems: totalItems,\n                              id: id,\n                          };\n                index as i;\n                trackBy: trackByFn\n            \"\n            >\n                <ng-container\n                    [ngTemplateOutlet]=\"collectionRowTmp\"\n                    [ngTemplateOutletContext]=\"{ item: item, i: i, depth: 0 }\"\n                ></ng-container>\n            </ng-container>\n            <ng-container>\n                <tr *ngIf=\"!items?.length\">\n                    <td [attr.colspan]=\"visibleSortedColumns.length + (selectionManager ? 2 : 1)\">\n                        <vdr-empty-placeholder [emptyStateLabel]=\"emptyStateLabel\"></vdr-empty-placeholder>\n                    </td>\n                </tr>\n            </ng-container>\n        </tbody>\n    </table>\n</div>\n<div class=\"table-footer\">\n    <vdr-items-per-page-controls\n        *ngIf=\"totalItems\"\n        [itemsPerPage]=\"itemsPerPage\"\n        (itemsPerPageChange)=\"itemsPerPageChange.emit($event)\"\n    ></vdr-items-per-page-controls>\n    <div *ngIf=\"totalItems\" class=\"p5 total-items-count\">\n        {{ 'common.total-items' | translate : { currentStart, currentEnd, totalItems } }}\n    </div>\n\n    <vdr-pagination-controls\n        *ngIf=\"totalItems\"\n        [id]=\"id\"\n        [currentPage]=\"currentPage\"\n        [itemsPerPage]=\"itemsPerPage\"\n        [totalItems]=\"totalItems\"\n        (pageChange)=\"pageChange.emit($event)\"\n    ></vdr-pagination-controls>\n</div>\n\n<ng-template #collectionRowTmp let-item=\"item\" let-depth=\"depth\">\n    <tr #collectionRow cdkDrag [cdkDragData]=\"{ depth: depth, collection: item }\" cdkDragBoundary=\"tbody\">\n        <td\n            *ngIf=\"selectionManager\"\n            [class.active]=\"activeIndex === absoluteIndex[item.id]\"\n            class=\"selection-col\"\n        >\n            <div class=\"flex\">\n                <div class=\"drag-handle\" cdkDragHandle [title]=\"'catalog.reorder-collection' | translate\">\n                    <clr-icon shape=\"drag-handle\"></clr-icon>\n                </div>\n                <input\n                    type=\"checkbox\"\n                    clrCheckbox\n                    [checked]=\"selectionManager?.isSelected(item)\"\n                    (click)=\"onRowClick(item, $event)\"\n                />\n            </div>\n        </td>\n        <td\n            *ngFor=\"let column of visibleSortedColumns\"\n            [class.active]=\"activeIndex === absoluteIndex[item.id]\"\n        >\n            <div class=\"cell-content\" [ngClass]=\"column.align\">\n                <ng-container\n                    *ngIf=\"customComponents.get(column.id) as componentConfig; else defaultComponent\"\n                >\n                    <ng-container\n                        *ngComponentOutlet=\"\n                            componentConfig.config.component;\n                            inputs: { rowItem: item };\n                            injector: componentConfig.injector\n                        \"\n                    ></ng-container>\n                </ng-container>\n                <ng-template #defaultComponent>\n                    <ng-container\n                        *ngTemplateOutlet=\"column.template; context: { item: item, depth: depth }\"\n                    ></ng-container>\n                </ng-template>\n            </div>\n        </td>\n        <td [class.active]=\"activeIndex === absoluteIndex[item.id]\"><!-- column select --></td>\n    </tr>\n    <ng-container *ngFor=\"let subCollection of getSubcollections(item)\">\n        <ng-container\n            *ngTemplateOutlet=\"collectionRowTmp; context: { item: subCollection, depth: depth + 1 }\"\n        ></ng-container>\n    </ng-container>\n</ng-template>\n", styles: [":host{display:block;max-width:100%;position:relative;margin-bottom:calc(var(--space-unit) * 4);container-type:inline-size}th{border-bottom:1px solid var(--color-table-header-border);font-size:var(--font-size-xs);font-weight:600;text-transform:uppercase;position:relative;white-space:nowrap}th,td{padding:calc(var(--space-unit) * 1.5) calc(var(--space-unit) * 1)}tr td:first-of-type,tr th:first-of-type{text-align:center}@media screen and (min-width: 992px){tr td:first-of-type,tr th:first-of-type{padding-inline-start:var(--surface-margin-left);text-align:start}}th:last-of-type,td:last-of-type{border-inline-end:1px solid var(--color-table-header-border)}tr:first-of-type th:last-of-type{border-image:linear-gradient(0deg,var(--color-table-header-border),transparent) 1}tr:last-of-type td:last-of-type{border-image:linear-gradient(180deg,var(--color-table-header-border),transparent) 1}tbody td{border-bottom:1px solid var(--color-table-row-separator)}tbody tr:hover{background-color:var(--color-table-row-hover-bg)}.bulk-actions{margin-inline-start:calc(var(--space-unit) * 5);background-color:var(--color-surface-bg);z-index:10;display:flex;position:absolute;top:5px;height:40px}@media screen and (min-width: 992px){.bulk-actions{margin-inline-start:calc(var(--space-unit) * 8.5)}}@media screen and (min-width: 1280px){.bulk-actions{margin-inline-start:calc(var(--space-unit) * 10.5)}}.table-wrapper{display:block;overflow-y:hidden;overflow-x:auto;position:relative;width:100%;max-width:var(--surface-width)}table{width:100%}table.no-select{-webkit-user-select:none;user-select:none}.column-picker{width:24px}.sort-toggle{display:flex;align-items:center;margin-inline-start:calc(var(--space-unit) * .5)}.sort-toggle button{border:0;border-radius:var(--border-radius-lg);color:var(--color-weight-500);padding:0 2px;cursor:pointer;background-color:transparent}.sort-toggle button.active{color:var(--color-primary-700)}.sort-toggle .sort-label{margin-inline-start:calc(var(--space-unit) * .5);font-size:10px;color:var(--color-primary-600);font-weight:400}.toggle-search-filter-row{position:absolute;top:-12px;left:4px}@media screen and (min-width: 1280px){.toggle-search-filter-row{left:8px}}.toggle-search-filter-row.active{background-color:var(--color-primary-700);color:var(--color-primary-100);border-color:var(--color-primary-700)}th.filter-row{position:relative;font-size:var(--font-size-base);font-weight:400;background-color:var(--color-weight-100);box-shadow:var(--data-table-filter-box-shadow);border-left-width:0;border-right-width:0;text-align:initial;padding:0}th.filter-row input{width:100%}th.filter-row.active{border-bottom:1px solid var(--color-table-header-border)}th.filter-row .filters{margin-top:calc(var(--space-unit) * 1);display:flex;flex-wrap:wrap;gap:calc(var(--space-unit) * .5)}.filter-row-wrapper{padding:calc(var(--space-unit) * 4);padding-inline-start:0;max-height:150px;transition:max-height .2s,padding .2s,opacity .2s}.filter-row-wrapper.hidden{max-height:0px;padding-top:0;padding-bottom:0;overflow:hidden;opacity:0}.cell-link{display:block;width:100%;height:100%}td.active{background-color:var(--color-table-row-active-bg)}.cell-content{display:flex;align-items:center;line-height:var(--font-size-sm);color:var(--color-weight-700)}.cell-content.left{justify-content:flex-start}.cell-content.center{justify-content:center}.cell-content.right{justify-content:flex-end}.selection-col{width:calc(var(--space-unit) * 8)}vdr-empty-placeholder{width:100%}.table-footer{display:flex;align-items:baseline;justify-content:space-between;margin-top:var(--space-unit);margin-inline-start:var(--surface-margin-left);margin-inline-end:var(--space-unit)}.total-items-count{font-size:var(--font-size-xs)}@container (max-width: 500px){.total-items-count{display:none}}\n", ".bulk-actions{margin-inline-start:calc(var(--space-unit) * 6);background-color:var(--color-surface-bg)}@media screen and (min-width: 992px){.bulk-actions{margin-inline-start:calc(var(--space-unit) * 9.5)}}@media screen and (min-width: 1280px){.bulk-actions{margin-inline-start:calc(var(--space-unit) * 11.5)}}.drag-handle{cursor:grab}.drag-handle-spacer{width:16px}.cdk-drop-list-dragging .cdk-drag{transition:transform .25s cubic-bezier(0,0,.2,1)}.cdk-drag-animating{transition:transform .3s cubic-bezier(0,0,.2,1)}.cdk-drag-preview{opacity:0}.cdk-drag-placeholder{background-color:var(--color-primary-100)!important}\n"] }]
        }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1.LocalStorageService }, { type: i1.DataService }, { type: i2.DragDrop }]; }, propDecorators: { subCollections: [{
                type: Input
            }], changeOrder: [{
                type: Output
            }], dropList: [{
                type: ViewChild,
                args: [CdkDropList, { static: true }]
            }], collectionRowList: [{
                type: ViewChildren,
                args: ['collectionRow', { read: CdkDrag }]
            }] } });
//# sourceMappingURL=data:application/json;base64, 