/*
 * Copyright 2015-2024 Ritense BV, the Netherlands.
 *
 * Licensed under EUPL, Version 1.2 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { Component, ElementRef, ViewChild, ViewContainerRef, } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "../../services/user-interface.service";
import * as i2 from "../../services";
import * as i3 from "@angular/common";
import * as i4 from "../page-title/page-title.component";
import * as i5 from "../breadcrumb-navigation/breadcrumb-navigation.component";
import * as i6 from "../../directives/render-page-header/render-page-header.directive";
import * as i7 from "../page-actions/page-actions.component";
import * as i8 from "../page-subtitle/page-subtitle.component";
export class PageHeaderComponent {
    constructor(userInterfaceService, pageHeaderService, pageTitleService) {
        this.userInterfaceService = userInterfaceService;
        this.pageHeaderService = pageHeaderService;
        this.pageTitleService = pageTitleService;
        this.showPageHeader$ = this.userInterfaceService.showPageHeader$;
        this.compactMode$ = this.pageHeaderService.compactMode$;
        this.pageActionsHasContent$ = this.pageHeaderService.pageActionsHasContent$;
        this.pageTitleHidden$ = this.pageTitleService.pageTitleHidden$;
    }
    ngAfterViewInit() {
        this.pageHeaderService.setContentViewContainerRef(this._contentrVcr);
        this.openPageHeadResizeObserver();
    }
    ngOnDestroy() {
        this._pageHeadResizeObserver?.disconnect();
    }
    openPageHeadResizeObserver() {
        this._pageHeadResizeObserver = new ResizeObserver(entries => {
            const pageHeadEntry = Array.isArray(entries) && entries[0];
            const pageHeadHeight = pageHeadEntry?.contentRect?.height;
            if (pageHeadHeight)
                this.pageHeaderService.setPageHeadHeight(pageHeadHeight);
        });
        this._pageHeadResizeObserver.observe(this._pageHead.nativeElement);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PageHeaderComponent, deps: [{ token: i1.UserInterfaceService }, { token: i2.PageHeaderService }, { token: i2.PageTitleService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: PageHeaderComponent, selector: "valtimo-page-header", viewQueries: [{ propertyName: "_contentrVcr", first: true, predicate: ["contentVcr"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "_pageHead", first: true, predicate: ["pageHead"], descendants: true, read: ElementRef, static: true }], ngImport: i0, template: "<!--\n  ~ Copyright 2015-2024 Ritense BV, the Netherlands.\n  ~\n  ~ Licensed under EUPL, Version 1.2 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" basis,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div\n  #pageHead\n  class=\"page-head\"\n  [ngClass]=\"{\n    '--hidden': (showPageHeader$ | async) === false,\n    '--compact': compactMode$ | async,\n    '--no-content': (compactMode$ | async) && (pageActionsHasContent$ | async) === false,\n    '--no-margin': pageTitleHidden$ | async,\n  }\"\n>\n  <ng-container #contentVcr></ng-container>\n\n  <valtimo-page-subtitle></valtimo-page-subtitle>\n\n  <valtimo-page-actions></valtimo-page-actions>\n</div>\n\n<ng-container renderPageHeader>\n  <ng-template>\n    <div class=\"page-header-container\" [ngClass]=\"{'--compact': compactMode$ | async}\">\n      <valtimo-breadcrumb-navigation></valtimo-breadcrumb-navigation>\n\n      <valtimo-page-title></valtimo-page-title>\n    </div>\n  </ng-template>\n</ng-container>\n", styles: [".page-head{display:flex;width:100%;justify-content:space-between;align-items:flex-end;margin-bottom:24px}.page-head.--hidden{display:none}.page-head.--compact{margin-bottom:16px}.page-head.--no-content,.page-head.--no-margin{margin-bottom:0}.page-header-container{width:min-content}.page-header-container.--compact{display:flex;width:100%;justify-content:space-between;align-items:center;padding-inline:16px}\n/*!\n * Copyright 2015-2024 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i4.PageTitleComponent, selector: "valtimo-page-title" }, { kind: "component", type: i5.BreadcrumbNavigationComponent, selector: "valtimo-breadcrumb-navigation" }, { kind: "directive", type: i6.RenderPageHeaderDirective, selector: "[renderPageHeader]" }, { kind: "component", type: i7.PageActionsComponent, selector: "valtimo-page-actions" }, { kind: "component", type: i8.PageSubtitleComponent, selector: "valtimo-page-subtitle" }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PageHeaderComponent, decorators: [{
            type: Component,
            args: [{ selector: 'valtimo-page-header', template: "<!--\n  ~ Copyright 2015-2024 Ritense BV, the Netherlands.\n  ~\n  ~ Licensed under EUPL, Version 1.2 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" basis,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div\n  #pageHead\n  class=\"page-head\"\n  [ngClass]=\"{\n    '--hidden': (showPageHeader$ | async) === false,\n    '--compact': compactMode$ | async,\n    '--no-content': (compactMode$ | async) && (pageActionsHasContent$ | async) === false,\n    '--no-margin': pageTitleHidden$ | async,\n  }\"\n>\n  <ng-container #contentVcr></ng-container>\n\n  <valtimo-page-subtitle></valtimo-page-subtitle>\n\n  <valtimo-page-actions></valtimo-page-actions>\n</div>\n\n<ng-container renderPageHeader>\n  <ng-template>\n    <div class=\"page-header-container\" [ngClass]=\"{'--compact': compactMode$ | async}\">\n      <valtimo-breadcrumb-navigation></valtimo-breadcrumb-navigation>\n\n      <valtimo-page-title></valtimo-page-title>\n    </div>\n  </ng-template>\n</ng-container>\n", styles: [".page-head{display:flex;width:100%;justify-content:space-between;align-items:flex-end;margin-bottom:24px}.page-head.--hidden{display:none}.page-head.--compact{margin-bottom:16px}.page-head.--no-content,.page-head.--no-margin{margin-bottom:0}.page-header-container{width:min-content}.page-header-container.--compact{display:flex;width:100%;justify-content:space-between;align-items:center;padding-inline:16px}\n/*!\n * Copyright 2015-2024 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n"] }]
        }], ctorParameters: () => [{ type: i1.UserInterfaceService }, { type: i2.PageHeaderService }, { type: i2.PageTitleService }], propDecorators: { _contentrVcr: [{
                type: ViewChild,
                args: ['contentVcr', { static: true, read: ViewContainerRef }]
            }], _pageHead: [{
                type: ViewChild,
                args: ['pageHead', { static: true, read: ElementRef }]
            }] } });
//# sourceMappingURL=data:application/json;base64, 