// Copyright (c) Laserfiche.
// Licensed under the MIT License. See LICENSE in the project root for license information.
import { Component, Input, Output, EventEmitter, ViewChildren, } from '@angular/core';
import { ItemsComponent } from '../items/items.component';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@angular/material/expansion";
import * as i3 from "../items/items.component";
import * as i4 from "../options/options.component";
export class LfChecklistComponent {
    /** @internal */
    constructor(
    /** @internal */
    zone) {
        this.zone = zone;
        this.checklistChanged = new EventEmitter();
        this.actionClick = new EventEmitter();
        this.cancelClick = new EventEmitter();
        /** @internal */
        this.checklists = [];
        this.initAsync = async (providers) => {
            return new Promise((resolve) => {
                this.zone.run(() => {
                    requestAnimationFrame(async () => {
                        this.checklists =
                            await providers.checklistService.loadChecklistsAsync();
                        this.itemsComponents?.forEach((component) => component.refreshChecklistItems());
                        this.checklistChanged.emit(this.checklists);
                        resolve();
                    });
                });
            });
        };
        this.forceValidation = () => {
            let isValid = true;
            this.itemsComponents.forEach((component) => {
                if (!component.forceValidation()) {
                    isValid = false;
                }
            });
            return isValid;
        };
    }
    /** @internal */
    onActionButtonClicked() {
        this.actionClick.emit(this.checklists);
    }
    /** @internal */
    onCancelButtonClicked() {
        this.cancelClick.emit(this.checklists);
    }
    /** @internal */
    emitChecklistChanges() {
        this.checklistChanged.emit(this.checklists);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LfChecklistComponent, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: LfChecklistComponent, selector: "lf-checklist-component", inputs: { action_button_text: "action_button_text", cancel_button_text: "cancel_button_text", initAsync: "initAsync", forceValidation: "forceValidation" }, outputs: { checklistChanged: "checklistChanged", actionClick: "actionClick", cancelClick: "cancelClick" }, viewQueries: [{ propertyName: "itemsComponents", predicate: ItemsComponent, descendants: true }], ngImport: i0, template: "<!--Copyright (c) Laserfiche.\r\nLicensed under the MIT License. See LICENSE in the project root for license information.-->\r\n\r\n<div id=\"lf-checklist-container\" class=\"lf-checklist-container\">\r\n    <div id=\"lf-checklist-list-container\" class=\"lf-checklist-list-container\">\r\n        <div id=\"lf-checklist-list\" class=\"lf-checklist-list\" *ngFor=\"let checklist of checklists\">\r\n            <div *ngIf=\"!checklist.collapsible\">\r\n                <div id=\"lf-checklist-name-container\" class=\"lf-checklist-name-container\">\r\n                    <span id=\"lf-checklist-name\" class=\"lf-text-label\"\r\n                        title=\"{{checklist.name}}\">{{checklist.name}}</span>\r\n                </div>\r\n                <lf-items-component *ngIf=\"checklist.checklistItems.length > 0\" [items]=\"checklist.checklistItems\"\r\n                    (itemsChanged)=\"emitChecklistChanges()\"></lf-items-component>\r\n                <lf-options-component *ngIf=\"checklist.checklistOptions.length > 0\" [options]=\"checklist.checklistOptions\"\r\n                    (optionsChanged)=\"emitChecklistChanges()\"></lf-options-component>\r\n            </div>\r\n            <div *ngIf=\"checklist.collapsible\">\r\n                <mat-expansion-panel [expanded]=\"false\" class=\"checklist-expansion-panel\">\r\n                    <mat-expansion-panel-header class=\"checklist-expansion-panel\">\r\n                        <mat-panel-title>\r\n                            <span id=\"lf-checklist-name\" class=\"lf-text-label\"\r\n                                title=\"{{checklist.name}}\">{{checklist.name}}</span>\r\n                        </mat-panel-title>\r\n                    </mat-expansion-panel-header>\r\n                    <lf-items-component *ngIf=\"checklist.checklistItems.length > 0\" [items]=\"checklist.checklistItems\"\r\n                        (itemsChanged)=\"emitChecklistChanges()\"></lf-items-component>\r\n                    <lf-options-component *ngIf=\"checklist.checklistOptions.length > 0\" [options]=\"checklist.checklistOptions\"\r\n                        (optionsChanged)=\"emitChecklistChanges()\"></lf-options-component>\r\n                </mat-expansion-panel>\r\n            </div>\r\n        </div>\r\n    </div>\r\n    <div id=\"lf-checklist-button-container\" class=\"lf-checklist-button-container\">\r\n        <button *ngIf=\"action_button_text\" id=\"lf-checklist-action-button\"\r\n            class=\"lf-checklist-action-button primary-button lf-button\"\r\n            (click)=\"onActionButtonClicked()\">{{action_button_text}}</button>\r\n        <button *ngIf=\"cancel_button_text\" id=\"lf-checklist-cancel-button\"\r\n            class=\"lf-checklist-cancel-button lf-button sec-button\"\r\n            (click)=\"onCancelButtonClicked()\">{{cancel_button_text}}</button>\r\n    </div>\r\n</div>\r\n", styles: [".lf-checklist-name-container{padding:15px 0 5px;white-space:nowrap;display:block;text-overflow:ellipsis;overflow:hidden}.lf-checklist-button-container{padding-top:10px;display:flex;justify-content:flex-end}::ng-deep .checklist-expansion-panel .mat-expansion-panel-header.mat-expanded{height:48px}::ng-deep .checklist-expansion-panel.mat-expansion-panel{position:static;border-radius:0;box-shadow:none;padding:0}::ng-deep .checklist-expansion-panel mat-expansion-panel-header{padding-left:0;padding-right:10px}::ng-deep .checklist-expansion-panel div.mat-expansion-panel-body{padding:0}mat-checkbox.lf-checkbox.full-width-checkbox{width:100%}::ng-deep .lf-checklist-field>.mdc-text-field--filled:not(.mdc-text-field--disabled){background-color:#fff}::ng-deep .lf-checklist-field .mat-mdc-form-field-flex{height:inherit}::ng-deep .lf-checklist-field .mat-mdc-form-field-infix{height:inherit;padding:0}::ng-deep .lf-checklist-option .mat-mdc-checkbox-touch-target{height:20px;width:20px}::ng-deep .lf-checklist-option .mdc-checkbox__native-control{top:10px;left:10px;right:10px;width:20px;height:20px}.lf-checklist-option>.lf-checkbox{height:25px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i2.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "directive", type: i2.MatExpansionPanelTitle, selector: "mat-panel-title" }, { kind: "component", type: i3.ItemsComponent, selector: "lf-items-component", inputs: ["items", "refreshChecklistItems"], outputs: ["itemsChanged"] }, { kind: "component", type: i4.OptionsComponent, selector: "lf-options-component", inputs: ["options"], outputs: ["optionsChanged"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LfChecklistComponent, decorators: [{
            type: Component,
            args: [{ selector: 'lf-checklist-component', template: "<!--Copyright (c) Laserfiche.\r\nLicensed under the MIT License. See LICENSE in the project root for license information.-->\r\n\r\n<div id=\"lf-checklist-container\" class=\"lf-checklist-container\">\r\n    <div id=\"lf-checklist-list-container\" class=\"lf-checklist-list-container\">\r\n        <div id=\"lf-checklist-list\" class=\"lf-checklist-list\" *ngFor=\"let checklist of checklists\">\r\n            <div *ngIf=\"!checklist.collapsible\">\r\n                <div id=\"lf-checklist-name-container\" class=\"lf-checklist-name-container\">\r\n                    <span id=\"lf-checklist-name\" class=\"lf-text-label\"\r\n                        title=\"{{checklist.name}}\">{{checklist.name}}</span>\r\n                </div>\r\n                <lf-items-component *ngIf=\"checklist.checklistItems.length > 0\" [items]=\"checklist.checklistItems\"\r\n                    (itemsChanged)=\"emitChecklistChanges()\"></lf-items-component>\r\n                <lf-options-component *ngIf=\"checklist.checklistOptions.length > 0\" [options]=\"checklist.checklistOptions\"\r\n                    (optionsChanged)=\"emitChecklistChanges()\"></lf-options-component>\r\n            </div>\r\n            <div *ngIf=\"checklist.collapsible\">\r\n                <mat-expansion-panel [expanded]=\"false\" class=\"checklist-expansion-panel\">\r\n                    <mat-expansion-panel-header class=\"checklist-expansion-panel\">\r\n                        <mat-panel-title>\r\n                            <span id=\"lf-checklist-name\" class=\"lf-text-label\"\r\n                                title=\"{{checklist.name}}\">{{checklist.name}}</span>\r\n                        </mat-panel-title>\r\n                    </mat-expansion-panel-header>\r\n                    <lf-items-component *ngIf=\"checklist.checklistItems.length > 0\" [items]=\"checklist.checklistItems\"\r\n                        (itemsChanged)=\"emitChecklistChanges()\"></lf-items-component>\r\n                    <lf-options-component *ngIf=\"checklist.checklistOptions.length > 0\" [options]=\"checklist.checklistOptions\"\r\n                        (optionsChanged)=\"emitChecklistChanges()\"></lf-options-component>\r\n                </mat-expansion-panel>\r\n            </div>\r\n        </div>\r\n    </div>\r\n    <div id=\"lf-checklist-button-container\" class=\"lf-checklist-button-container\">\r\n        <button *ngIf=\"action_button_text\" id=\"lf-checklist-action-button\"\r\n            class=\"lf-checklist-action-button primary-button lf-button\"\r\n            (click)=\"onActionButtonClicked()\">{{action_button_text}}</button>\r\n        <button *ngIf=\"cancel_button_text\" id=\"lf-checklist-cancel-button\"\r\n            class=\"lf-checklist-cancel-button lf-button sec-button\"\r\n            (click)=\"onCancelButtonClicked()\">{{cancel_button_text}}</button>\r\n    </div>\r\n</div>\r\n", styles: [".lf-checklist-name-container{padding:15px 0 5px;white-space:nowrap;display:block;text-overflow:ellipsis;overflow:hidden}.lf-checklist-button-container{padding-top:10px;display:flex;justify-content:flex-end}::ng-deep .checklist-expansion-panel .mat-expansion-panel-header.mat-expanded{height:48px}::ng-deep .checklist-expansion-panel.mat-expansion-panel{position:static;border-radius:0;box-shadow:none;padding:0}::ng-deep .checklist-expansion-panel mat-expansion-panel-header{padding-left:0;padding-right:10px}::ng-deep .checklist-expansion-panel div.mat-expansion-panel-body{padding:0}mat-checkbox.lf-checkbox.full-width-checkbox{width:100%}::ng-deep .lf-checklist-field>.mdc-text-field--filled:not(.mdc-text-field--disabled){background-color:#fff}::ng-deep .lf-checklist-field .mat-mdc-form-field-flex{height:inherit}::ng-deep .lf-checklist-field .mat-mdc-form-field-infix{height:inherit;padding:0}::ng-deep .lf-checklist-option .mat-mdc-checkbox-touch-target{height:20px;width:20px}::ng-deep .lf-checklist-option .mdc-checkbox__native-control{top:10px;left:10px;right:10px;width:20px;height:20px}.lf-checklist-option>.lf-checkbox{height:25px}\n"] }]
        }], ctorParameters: () => [{ type: i0.NgZone }], propDecorators: { action_button_text: [{
                type: Input
            }], cancel_button_text: [{
                type: Input
            }], checklistChanged: [{
                type: Output
            }], actionClick: [{
                type: Output
            }], cancelClick: [{
                type: Output
            }], itemsComponents: [{
                type: ViewChildren,
                args: [ItemsComponent]
            }], initAsync: [{
                type: Input
            }], forceValidation: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 