import { Component, EventEmitter, Inject, Output, ViewChild } from '@angular/core';
import { MAT_CHECKBOX_DEFAULT_OPTIONS } from '@angular/material/checkbox';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import * as _ from 'lodash';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { SelectDepartmentAnimationTrigger } from '../select-department/common/animation';
import { SelectDepartmentPopupData } from '../select-department';
import * as i0 from "@angular/core";
import * as i1 from "@angular/material/dialog";
import * as i2 from "../../services/translation-registry.service";
import * as i3 from "@angular/common";
import * as i4 from "../../directives/chips/chip.directive";
import * as i5 from "../../directives/chips/chip-body.directive";
import * as i6 from "../../directives/tooltip/tooltip-renderer.directive";
import * as i7 from "../../directives/content-changes.directive";
import * as i8 from "@angular/material/icon";
import * as i9 from "../button/button";
import * as i10 from "@angular/material/progress-spinner";
import * as i11 from "@angular/material/chips";
import * as i12 from "../select-process-data-tree/select-process-data-tree.component";
import * as i13 from "@angular/material/divider";
import * as i14 from "../select-department";
export class SelectProcessDataComponent {
    get isIncludeChild() {
        return !!this.treeProcessData && this.treeProcessData.isIncludeChildren;
    }
    constructor(cdRef, dialogRef, data, trans) {
        this.cdRef = cdRef;
        this.dialogRef = dialogRef;
        this.data = data;
        this.trans = trans;
        this.ngUnsubscribe = new Subject();
        this.onPagingEvent = new EventEmitter();
        this.popupData = new SelectDepartmentPopupData();
        this.resultSelected = [];
        this.onSearchEvent = new EventEmitter();
        this.onCheckNodeEvent = new EventEmitter();
        this.onExpandNodeEvent = new EventEmitter();
        this.onLoadMoreEvent = new EventEmitter();
        this.onCheckItemSearchEvent = new EventEmitter();
        this.onCheckAllItemSearchEvent = new EventEmitter();
        this.toggleIncludeChildEvent = new EventEmitter();
        this.resultSearch = [];
        this.isActiveViewSearch = false;
        this.trans.getLanguageSubject$.pipe(takeUntil(this.ngUnsubscribe)).subscribe((res) => {
            if (res) {
                this.LANG = this.trans.getObjectLang(res);
            }
        });
        // Init popup data
        this.popupData = _.cloneDeep(this.data);
    }
    ngAfterViewInit() {
        this.cdRef.detectChanges();
    }
    onCloseDialog() {
        this.dialogRef.close(this.treeProcessData.resultSelected);
    }
    ngOnInit() {
    }
    ngOnDestroy() {
        this.ngUnsubscribe.next();
        this.ngUnsubscribe.complete();
    }
    get currentTreeData() {
        return this.treeProcessData ? this.treeProcessData.currentTreeData : [];
    }
    displayWhenSelectDepartmentOption($event) {
        return '';
    }
    onScrollToNode(node) {
        // this.treeProcessData.scrollToNode(node.id);
    }
    onRemoveNode(node) {
        this.treeProcessData.onRemoveNode(node.id);
    }
    /**
   * Gets a list of the data node's subtree of descendent data nodes.
   */
    getChildrenNode(node) {
        return this.treeProcessData.getListChildrenOfNode(node);
    }
    onResultDepartmentChange(data) {
        this.resultSelected = data.map(item => {
            return {
                ...item,
                tooltip: this.generateTootip(item)
            };
        });
    }
    defaultFormatTooltipNode(node) {
        return node.isGroup ? this.formatString(this.popupData.config.tooltipIncludeLabel ? this.popupData.config.tooltipIncludeLabel : this.LANG.TOOLTIP_INCLUDE_SUB_DEPARTMENT, node.name, node.children.length.toString()) : node.name;
    }
    generateTootip(node) {
        return !!this.popupData.formatTooltipItemResult ? this.popupData.formatTooltipItemResult(node) : this.defaultFormatTooltipNode(node);
    }
    updateResultSearch(data) {
        if (!this.treeProcessData)
            return;
        this.treeProcessData.setResultSearch(data);
    }
    formatString(...replacements) {
        let result = arguments[0];
        for (let i = 0; i < arguments.length - 1; i++) {
            const reg = new RegExp(`\\{${i}\\}`, 'gm');
            result = result.replace(reg, arguments[i + 1]);
        }
        return result;
    }
    /**
         * This function use for lazy load children of node
         * @param node node update
         * @param data list children to update node.
         * @param mode default is update that replace current list children by new list children , if mode = 'insert' will insert new value to list children existed before.
    */
    updateChildOfNode(node, data, mode = 'update') {
        this.treeProcessData.updateChildOfNode(node, data, mode);
    }
    addRootTree(data = []) {
        this.treeProcessData.addRootTree(data);
    }
    /**
   * This function handle check node of tree
   * @param node node of tree
   * @param callback do something before handle check node
   * @returns
   */
    onBeforeCheckNode(node, callback) {
        return this.treeProcessData.onBeforeCheckNode(node, callback);
    }
    handleCheckNode(node) {
        if (!this.treeProcessData)
            return;
        this.treeProcessData.handleCheckNode(node);
    }
    /**
   * This method use for lazy mode, do some thing before init list node selected
   * @param callback
   * @returns
   */
    async onBeforeInitNodeSelected(callback) {
        if (!this.treeProcessData)
            return;
        if (!!callback)
            await this.treeProcessData.onBeforeInitNodeSelected(callback);
    }
    /**
     * Get node by id of node
     * @param nodeId id of node
     * @returns
     */
    findNode(nodeId) {
        if (!this.treeProcessData)
            return;
        return this.treeProcessData.treeControl.dataNodes.find(node => node.id === nodeId.toString());
    }
    /**
   * This method use for lazy mode, do some thing before select all result search
   * @param callback
   * @returns
   */
    async onBeforeCheckAllSearch(callback) {
        if (!this.treeProcessData)
            return;
        await this.treeProcessData.onBeforeCheckAllSearch(callback);
    }
    /**
  * This method use for lazy mode, do some thing before check item result
  * @param callback
  * @returns
  */
    onBeforeCheckItemSearch(item, callback) {
        return this.treeProcessData.onBeforeCheckItemSearch(item, callback);
    }
    setLoadingStateNode(isLoading, nodeId) {
        !!this.treeProcessData && this.treeProcessData.setLoadingStateNode(isLoading, nodeId);
    }
    /**
     * Select a value or an array of values.
     */
    onSelectNode(...nodeIds) {
        this.treeProcessData.onSelectNode(...nodeIds);
    }
    /**
     * Deselects a value or an array of values.
     */
    onDeselectNode(...nodeIds) {
        this.treeProcessData.onDeselectNode(...nodeIds);
    }
    /**
    * Toggles a value between selected and deselected.
    */
    onToggleNode(nodeId) {
        this.treeProcessData.onToggleNode(nodeId);
    }
    getNodeById(nodeId) {
        return this.treeProcessData.getNodeById(nodeId);
    }
    isNodeLoading(nodeId) {
        if (!this.treeProcessData)
            return false;
        const node = this.treeProcessData.getNodeById(nodeId);
        return !!node && node.isLoading;
    }
    setLoadingMore(state) {
        if (!this.treeProcessData)
            return;
        this.treeProcessData.getLoadingMore$.next(state);
    }
    setLoading(state) {
        if (!this.treeProcessData)
            return;
        this.treeProcessData.getLoading$.next(state);
    }
    setLoadingNode(nodeId, state) {
        if (!this.treeProcessData)
            return;
        const node = this.treeProcessData.getNodeById(nodeId);
        if (!!node)
            node.isLoading = state;
    }
    updateTreeData(data = this.currentTreeData) {
        !!this.treeProcessData && this.treeProcessData.updateDataTree(data);
    }
    onDestroyLoadMore() {
        this.treeProcessData.onDestroyLoadMore();
    }
    setSelectedListData(data) {
        this.popupData.config.selectedList = data;
    }
    getCheckedStatusNode(node) {
        return this.treeProcessData.getCheckedStatusNode(node);
    }
    updateNodeInformation(node) {
        return this.treeProcessData.updateNodeInformation(node);
    }
    updateSelectedResultData(node) {
        return this.treeProcessData.updateSelectedResultData(node);
    }
    getAllParentNode(node) {
        return this.treeProcessData.getAllParentNode(node);
    }
    onCheckNode(node, fireEventCheckNode = true) {
        return this.treeProcessData.onCheckNode(node, fireEventCheckNode);
    }
    getChildrenSelected(node) {
        return this.treeProcessData.getChildrenSelected(node);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectProcessDataComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: i2.TranslateLibraryService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: SelectProcessDataComponent, selector: "qms-select-process-data", outputs: { onPagingEvent: "onPagingEvent", onSearchEvent: "onSearchEvent", onCheckNodeEvent: "onCheckNodeEvent", onExpandNodeEvent: "onExpandNodeEvent", onLoadMoreEvent: "onLoadMoreEvent", onCheckItemSearchEvent: "onCheckItemSearchEvent", onCheckAllItemSearchEvent: "onCheckAllItemSearchEvent", toggleIncludeChildEvent: "toggleIncludeChildEvent" }, providers: [
            {
                provide: MAT_CHECKBOX_DEFAULT_OPTIONS,
                useValue: {
                    clickAction: 'noop'
                }
            }
        ], viewQueries: [{ propertyName: "treeProcessData", first: true, predicate: ["treeProcessData"], descendants: true }], ngImport: i0, template: "<div class=\"qms-select-department\">\n  <div class=\"header-dialog mb-2\">\n    <span>{{popupData.headerName}}</span>\n    <button matDialogClose class=\"btn-close-dialog\" color=\"light\" qms-btn-icon>\n      <mat-icon>close</mat-icon>\n    </button>\n  </div>\n  <div>\n    <div class=\"qms-scrollbar\">\n      <div>\n        <qms-select-process-data-tree #treeProcessData customClass=\"custom-department-tree\"\n          [height]=\"popupData.config.isMobile ? '38vh' : '50vh'\" [rowsSkeleton]=\"9\" [config]=\"popupData.config\"\n          (onSearchEvent)=\"onSearchEvent.emit($event)\" (onValueChangeEvent)=\"onResultDepartmentChange($event)\"\n          (onPagingSearchEvent)=\"onPagingEvent.emit($event)\" (onCheckNodeEvent)=\"onCheckNodeEvent.emit($event)\"\n          (onExpandNodeEvent)=\"onExpandNodeEvent.emit($event)\" (onLoadMoreEvent)=\"onLoadMoreEvent.emit()\"\n          (onCheckAllItemSearchEvent)=\"onCheckAllItemSearchEvent.emit($event)\"\n          (onCheckItemSearchEvent)=\"onCheckItemSearchEvent.emit($event)\"\n          (toggleIncludeChildEvent)=\"toggleIncludeChildEvent.emit($event)\">\n        </qms-select-process-data-tree>\n      </div>\n    </div>\n    <div class=\"line__divider\"></div>\n    <div [@heightAnimation] *ngIf=\"treeProcessData && !!treeProcessData.resultSelected.length\" class=\" pr-0 pe-0\">\n      <div class=\"header-title\">{{LANG.RESULTS}}</div>\n      <div class=\"result-content pr-0 pe-0\">\n        <mat-chip-set class=\"panel__item qms-scrollbar\">\n          <div [@inOutAnimation_2] [id]=\"'item-result-'+item.id\" *ngFor=\"let item of treeProcessData.resultSelected\">\n            <mat-chip [@updateItemAnimation] *qmsContentChanges=\"item.children?.length\"\n              [qms-tool-tip]=\"generateTootip(item)\" position=\"top\" mode=\"dark\" qms-chip [removable]=\"true\">\n              <span (click)=\"onScrollToNode(item)\" qms-chip-body>\n                <span class=\"related__item__content_name\" #itemName>\n                  <span>{{item.name}}</span>\n                  <span class=\"select__include-children__count\" *ngIf=\"!!item?.isGroup && !popupData.config.lazy\">\n                    {{item.children.length}}/{{item.childCount}}\n                  </span>\n                  <span class=\"select__include-children__count\" *ngIf=\"!!item?.isGroup && popupData.config.lazy\">\n                    {{item.selectedChildCount}}/{{item.childCount}}\n                  </span>\n                </span>\n              </span>\n\n              <button (click)=\"onRemoveNode(item)\" matChipRemove *ngIf=\"!isNodeLoading(item.id); else loadingSpinner\">\n                <mat-icon>cancel</mat-icon>\n              </button>\n\n\n            </mat-chip>\n          </div>\n        </mat-chip-set>\n      </div>\n    </div>\n    <mat-divider *ngIf=\"treeProcessData && !!treeProcessData.resultSelected.length\" class=\"mx-auto\"></mat-divider>\n    <div class=\"confirm__button__groups\">\n      <button (click)=\"onCloseDialog()\" class=\"btn-add\"\n        [disabled]=\"!resultSelected.length && !popupData.config.canAddNullResult\"\n        [class.qms-btn-disabled]=\"!resultSelected.length && !popupData.config.canAddNullResult\" qms-btn>\n        <span>{{LANG.ADD}}</span>\n        <span>\n          ({{treeProcessData.resultSelected.length}})\n        </span>\n      </button>\n      <button qms-btn-text mat-dialog-close>\n        Cancel\n      </button>\n    </div>\n  </div>\n</div>\n\n<!-- Loading spinner -->\n<ng-template #loadingSpinner>\n  <div class=\"qms-spinner-wrapper\">\n    <div class=\"qms-spinner center\">\n      <mat-spinner [diameter]=\"20\" [strokeWidth]=\"2\"></mat-spinner>\n    </div>\n  </div>\n</ng-template>", styles: [".qms-select-department{font-family:Open Sans,sans-serif}.qms-select-department .cursor-pointer{cursor:pointer}.qms-select-department .ml-5{margin-left:10px}.qms-select-department .padding-5{padding:5px}.qms-select-department .header-dialog{display:flex;justify-content:space-between;align-items:center;font-weight:600;font-size:16px}.qms-select-department .input__field{display:flex;align-items:center;position:relative}.qms-select-department .input__field input.input-search{width:100%;padding:10px;outline:none;border:none;background:var(--background-input-text)}.qms-select-department .input__field .btn-search{cursor:pointer;vertical-align:middle;position:absolute;top:50%;right:10px;transform:translateY(-50%)}.qms-select-department .line__divider{border-bottom:1px solid #ccc;height:1px;margin-top:10px;min-width:300px;max-width:100%}.qms-select-department .mat-expansion-panel-header{height:30px;font-size:12px;letter-spacing:1px;font-family:Raleway;font-weight:600;padding:0}.qms-select-department .mat-expansion-panel-header .mat-expansion-panel-header-title{align-items:center;margin-left:12px}.qms-select-department .mat-expansion-panel:not([class*=mat-elevation-z]){box-shadow:none}.qms-select-department .panel__item{max-height:175px;margin-top:4px;overflow-x:hidden;overflow-y:auto;padding-right:5px;width:100%;display:block}.qms-select-department .panel__item .related__item__inline{max-width:100%}.qms-select-department .panel__item ::ng-deep .mat-chip-list-wrapper{margin:0 -4px!important}.qms-select-department .panel__item .select__toggle-include{width:100%}.qms-select-department .panel__item .select__toggle-include.toggle-include-child .mat-mdc-slide-toggle.qms-group-options .mat-slide-toggle-thumb{background-color:#5a5a5a!important}.qms-select-department .panel__item .related__item__content{height:32px;line-height:32px;background-color:var(--related-item-background);max-width:100%;margin-bottom:5px;margin-left:2.5px;margin-right:2.5px}.qms-select-department .panel__item .related__item__content .mat-icon{color:var(--related-mat-icon-color);font-size:24px}.qms-select-department .header-title{font-weight:600;color:#000000de}.qms-select-department .result-content{padding-right:0!important}.qms-select-department .result-content .mat-chip-list{min-height:40px}.qms-select-department .result-content .mat-chip-list .mat-icon{color:#0000004d!important;cursor:pointer}.qms-select-department .result-content .mat-chip-list .mat-icon:hover{color:#000!important}.qms-select-department .result-content span.related__item__content_name{min-width:calc(100% - 13px);display:flex;align-items:center}.qms-select-department .result-content span.related__item__content_name>span:nth-child(1){display:inline-block;margin-right:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:200px}.qms-select-department .result-content span.related__item__content_name .select__include-children__count{font-size:.75rem;color:#00000080;font-weight:600;line-height:16px}.qms-select-department .text-name{position:relative;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;cursor:pointer;width:100%}.qms-select-department ::ng-deep .mat-mdc-checkbox.qms-group-options.flex-direction-row .mat-checkbox-layout{white-space:normal}.qms-select-department ::ng-deep .mat-mdc-checkbox.qms-group-options.flex-direction-row .mat-checkbox-label{flex-direction:row;align-items:center;position:relative;padding-bottom:2px}.qms-select-department .confirm__button__groups .btn-add>.qms-btn-wrapper{display:flex;justify-content:center;align-items:center}.qms-select-department ::ng-deep .custom-department-tree .qms-view-search-result{height:100%!important}.qms-select-department ::ng-deep .custom-department-tree .qms-view-search-result .result{max-height:calc(100% - 80px)!important}.qms-select-department ::ng-deep .custom-department-tree .loading-container{height:calc(100% - 40px)!important}.qms-select-department ::ng-deep .btn-close-dialog.qms-btn-icon:focus:not(:hover){background-color:unset!important;color:unset!important}.qms-spinner-wrapper{display:inline-block;width:22px;height:22px}.qms-spinner-wrapper .qms-spinner{font-size:20px;width:1em;height:1em;position:absolute;right:5px;top:50%;transform:translateY(-50%)}.qms-spinner-wrapper .qms-spinner .mat-mdc-progress-spinner circle{stroke:#1b75be!important}@media screen and (max-width: 600px){::ng-deep .cdk-global-overlay-wrapper{justify-content:center!important;width:100vw}.header-title{font-size:14px}.related__item__content_name{font-size:12px!important}}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.QMSInputChipDirective, selector: "mat-chip[qms-chip]", inputs: ["selected"] }, { kind: "directive", type: i5.QMSChipBodyDirective, selector: "[qms-chip-body]" }, { kind: "directive", type: i6.QMSToolTipRendererDirective, selector: "[qms-tool-tip]", inputs: ["showToolTip", "mode", "qms-tool-tip", "contentTemplate", "position"] }, { kind: "directive", type: i7.QMSContentChangesDirective, selector: "[qmsContentChanges]", inputs: ["qmsContentChanges"] }, { kind: "component", type: i8.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "component", type: i9.QMSButton, selector: "button[qms-btn], button[qms-btn-lg], button[qms-btn-outlined],\n               button[qms-btn-outlined-lg], button[qms-btn-text], button[qms-btn-text-lg],\n               button[qms-btn-fab],button[qms-btn-fab-sm],button[qms-btn-fab-ext],\n               button[qms-btn-fab-outlined],button[qms-btn-fab-outlined-sm],button[qms-btn-fab-outlined-ext]", inputs: ["disabled", "color"], exportAs: ["qmsButton"] }, { kind: "component", type: i9.QMSButtonIcon, selector: "button[qms-btn-icon]", inputs: ["disabled", "color", "active"], exportAs: ["qmsButtonIcon"] }, { kind: "component", type: i10.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: i11.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["role", "id", "aria-label", "aria-description", "value", "color", "removable", "highlighted", "disableRipple", "disabled", "tabIndex"], outputs: ["removed", "destroyed"], exportAs: ["matChip"] }, { kind: "directive", type: i11.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i11.MatChipSet, selector: "mat-chip-set", inputs: ["disabled", "role", "tabIndex"] }, { kind: "component", type: i12.SelectProcessDataTreeComponent, selector: "qms-select-process-data-tree", inputs: ["rowsSkeleton", "height", "config"], outputs: ["onSearchEvent", "onPagingSearchEvent", "onValueChangeEvent", "selectionNodeChangeEvent", "onCheckNodeEvent", "onExpandNodeEvent", "onLoadMoreEvent", "onCheckItemSearchEvent", "onCheckAllItemSearchEvent", "toggleIncludeChildEvent"] }, { kind: "component", type: i13.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }], animations: [SelectDepartmentAnimationTrigger] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectProcessDataComponent, decorators: [{
            type: Component,
            args: [{ selector: 'qms-select-process-data', providers: [
                        {
                            provide: MAT_CHECKBOX_DEFAULT_OPTIONS,
                            useValue: {
                                clickAction: 'noop'
                            }
                        }
                    ], animations: [SelectDepartmentAnimationTrigger], template: "<div class=\"qms-select-department\">\n  <div class=\"header-dialog mb-2\">\n    <span>{{popupData.headerName}}</span>\n    <button matDialogClose class=\"btn-close-dialog\" color=\"light\" qms-btn-icon>\n      <mat-icon>close</mat-icon>\n    </button>\n  </div>\n  <div>\n    <div class=\"qms-scrollbar\">\n      <div>\n        <qms-select-process-data-tree #treeProcessData customClass=\"custom-department-tree\"\n          [height]=\"popupData.config.isMobile ? '38vh' : '50vh'\" [rowsSkeleton]=\"9\" [config]=\"popupData.config\"\n          (onSearchEvent)=\"onSearchEvent.emit($event)\" (onValueChangeEvent)=\"onResultDepartmentChange($event)\"\n          (onPagingSearchEvent)=\"onPagingEvent.emit($event)\" (onCheckNodeEvent)=\"onCheckNodeEvent.emit($event)\"\n          (onExpandNodeEvent)=\"onExpandNodeEvent.emit($event)\" (onLoadMoreEvent)=\"onLoadMoreEvent.emit()\"\n          (onCheckAllItemSearchEvent)=\"onCheckAllItemSearchEvent.emit($event)\"\n          (onCheckItemSearchEvent)=\"onCheckItemSearchEvent.emit($event)\"\n          (toggleIncludeChildEvent)=\"toggleIncludeChildEvent.emit($event)\">\n        </qms-select-process-data-tree>\n      </div>\n    </div>\n    <div class=\"line__divider\"></div>\n    <div [@heightAnimation] *ngIf=\"treeProcessData && !!treeProcessData.resultSelected.length\" class=\" pr-0 pe-0\">\n      <div class=\"header-title\">{{LANG.RESULTS}}</div>\n      <div class=\"result-content pr-0 pe-0\">\n        <mat-chip-set class=\"panel__item qms-scrollbar\">\n          <div [@inOutAnimation_2] [id]=\"'item-result-'+item.id\" *ngFor=\"let item of treeProcessData.resultSelected\">\n            <mat-chip [@updateItemAnimation] *qmsContentChanges=\"item.children?.length\"\n              [qms-tool-tip]=\"generateTootip(item)\" position=\"top\" mode=\"dark\" qms-chip [removable]=\"true\">\n              <span (click)=\"onScrollToNode(item)\" qms-chip-body>\n                <span class=\"related__item__content_name\" #itemName>\n                  <span>{{item.name}}</span>\n                  <span class=\"select__include-children__count\" *ngIf=\"!!item?.isGroup && !popupData.config.lazy\">\n                    {{item.children.length}}/{{item.childCount}}\n                  </span>\n                  <span class=\"select__include-children__count\" *ngIf=\"!!item?.isGroup && popupData.config.lazy\">\n                    {{item.selectedChildCount}}/{{item.childCount}}\n                  </span>\n                </span>\n              </span>\n\n              <button (click)=\"onRemoveNode(item)\" matChipRemove *ngIf=\"!isNodeLoading(item.id); else loadingSpinner\">\n                <mat-icon>cancel</mat-icon>\n              </button>\n\n\n            </mat-chip>\n          </div>\n        </mat-chip-set>\n      </div>\n    </div>\n    <mat-divider *ngIf=\"treeProcessData && !!treeProcessData.resultSelected.length\" class=\"mx-auto\"></mat-divider>\n    <div class=\"confirm__button__groups\">\n      <button (click)=\"onCloseDialog()\" class=\"btn-add\"\n        [disabled]=\"!resultSelected.length && !popupData.config.canAddNullResult\"\n        [class.qms-btn-disabled]=\"!resultSelected.length && !popupData.config.canAddNullResult\" qms-btn>\n        <span>{{LANG.ADD}}</span>\n        <span>\n          ({{treeProcessData.resultSelected.length}})\n        </span>\n      </button>\n      <button qms-btn-text mat-dialog-close>\n        Cancel\n      </button>\n    </div>\n  </div>\n</div>\n\n<!-- Loading spinner -->\n<ng-template #loadingSpinner>\n  <div class=\"qms-spinner-wrapper\">\n    <div class=\"qms-spinner center\">\n      <mat-spinner [diameter]=\"20\" [strokeWidth]=\"2\"></mat-spinner>\n    </div>\n  </div>\n</ng-template>", styles: [".qms-select-department{font-family:Open Sans,sans-serif}.qms-select-department .cursor-pointer{cursor:pointer}.qms-select-department .ml-5{margin-left:10px}.qms-select-department .padding-5{padding:5px}.qms-select-department .header-dialog{display:flex;justify-content:space-between;align-items:center;font-weight:600;font-size:16px}.qms-select-department .input__field{display:flex;align-items:center;position:relative}.qms-select-department .input__field input.input-search{width:100%;padding:10px;outline:none;border:none;background:var(--background-input-text)}.qms-select-department .input__field .btn-search{cursor:pointer;vertical-align:middle;position:absolute;top:50%;right:10px;transform:translateY(-50%)}.qms-select-department .line__divider{border-bottom:1px solid #ccc;height:1px;margin-top:10px;min-width:300px;max-width:100%}.qms-select-department .mat-expansion-panel-header{height:30px;font-size:12px;letter-spacing:1px;font-family:Raleway;font-weight:600;padding:0}.qms-select-department .mat-expansion-panel-header .mat-expansion-panel-header-title{align-items:center;margin-left:12px}.qms-select-department .mat-expansion-panel:not([class*=mat-elevation-z]){box-shadow:none}.qms-select-department .panel__item{max-height:175px;margin-top:4px;overflow-x:hidden;overflow-y:auto;padding-right:5px;width:100%;display:block}.qms-select-department .panel__item .related__item__inline{max-width:100%}.qms-select-department .panel__item ::ng-deep .mat-chip-list-wrapper{margin:0 -4px!important}.qms-select-department .panel__item .select__toggle-include{width:100%}.qms-select-department .panel__item .select__toggle-include.toggle-include-child .mat-mdc-slide-toggle.qms-group-options .mat-slide-toggle-thumb{background-color:#5a5a5a!important}.qms-select-department .panel__item .related__item__content{height:32px;line-height:32px;background-color:var(--related-item-background);max-width:100%;margin-bottom:5px;margin-left:2.5px;margin-right:2.5px}.qms-select-department .panel__item .related__item__content .mat-icon{color:var(--related-mat-icon-color);font-size:24px}.qms-select-department .header-title{font-weight:600;color:#000000de}.qms-select-department .result-content{padding-right:0!important}.qms-select-department .result-content .mat-chip-list{min-height:40px}.qms-select-department .result-content .mat-chip-list .mat-icon{color:#0000004d!important;cursor:pointer}.qms-select-department .result-content .mat-chip-list .mat-icon:hover{color:#000!important}.qms-select-department .result-content span.related__item__content_name{min-width:calc(100% - 13px);display:flex;align-items:center}.qms-select-department .result-content span.related__item__content_name>span:nth-child(1){display:inline-block;margin-right:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:200px}.qms-select-department .result-content span.related__item__content_name .select__include-children__count{font-size:.75rem;color:#00000080;font-weight:600;line-height:16px}.qms-select-department .text-name{position:relative;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;cursor:pointer;width:100%}.qms-select-department ::ng-deep .mat-mdc-checkbox.qms-group-options.flex-direction-row .mat-checkbox-layout{white-space:normal}.qms-select-department ::ng-deep .mat-mdc-checkbox.qms-group-options.flex-direction-row .mat-checkbox-label{flex-direction:row;align-items:center;position:relative;padding-bottom:2px}.qms-select-department .confirm__button__groups .btn-add>.qms-btn-wrapper{display:flex;justify-content:center;align-items:center}.qms-select-department ::ng-deep .custom-department-tree .qms-view-search-result{height:100%!important}.qms-select-department ::ng-deep .custom-department-tree .qms-view-search-result .result{max-height:calc(100% - 80px)!important}.qms-select-department ::ng-deep .custom-department-tree .loading-container{height:calc(100% - 40px)!important}.qms-select-department ::ng-deep .btn-close-dialog.qms-btn-icon:focus:not(:hover){background-color:unset!important;color:unset!important}.qms-spinner-wrapper{display:inline-block;width:22px;height:22px}.qms-spinner-wrapper .qms-spinner{font-size:20px;width:1em;height:1em;position:absolute;right:5px;top:50%;transform:translateY(-50%)}.qms-spinner-wrapper .qms-spinner .mat-mdc-progress-spinner circle{stroke:#1b75be!important}@media screen and (max-width: 600px){::ng-deep .cdk-global-overlay-wrapper{justify-content:center!important;width:100vw}.header-title{font-size:14px}.related__item__content_name{font-size:12px!important}}\n"] }]
        }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i1.MatDialogRef }, { type: i14.SelectDepartmentPopupData, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }, { type: i2.TranslateLibraryService }], propDecorators: { treeProcessData: [{
                type: ViewChild,
                args: ['treeProcessData']
            }], onPagingEvent: [{
                type: Output
            }], onSearchEvent: [{
                type: Output
            }], onCheckNodeEvent: [{
                type: Output
            }], onExpandNodeEvent: [{
                type: Output
            }], onLoadMoreEvent: [{
                type: Output
            }], onCheckItemSearchEvent: [{
                type: Output
            }], onCheckAllItemSearchEvent: [{
                type: Output
            }], toggleIncludeChildEvent: [{
                type: Output
            }] } });
//# sourceMappingURL=data:application/json;base64, 