<commit_before>import {
    Component,
    EventEmitter,
    HostListener,
    Input, isDevMode,
    OnChanges, OnDestroy, OnInit,
    Output,
    SimpleChanges,
    ViewChild,
    ViewEncapsulation
} from '@angular/core';
import { DownlineTreeviewItem, OrderDownlineTreeviewEventParser, TreeviewConfig, TreeviewEventParser, TreeviewItem } from 'ngx-treeview';
import { NgbDropdown, NgbDropdownConfig } from '@ng-bootstrap/ng-bootstrap';
import { arrayUnique } from '../../helper/function';
import { isNil, reverse } from 'lodash';
import { Ricorsivo, TreeviewEmitterInterface } from '../../interface/treeview.interface';
import { TreeviewSelezione } from '../../model/treeview-selezione.model';
import { sedeString } from '../../store/states/sedi-treeview/sedi-treeview.helper';
import { Observable } from 'rxjs';


@Component({
    selector: 'app-shared-treeview',
    templateUrl: './treeview.component.html',
    styleUrls: ['./treeview.component.css'],
    encapsulation: ViewEncapsulation.Emulated,
    providers: [
        { provide: TreeviewEventParser, useClass: OrderDownlineTreeviewEventParser },
    ]
})
export class TreeviewComponent implements OnChanges, OnDestroy, OnInit {
    @Input() colorButton = 'btn-default';
    @Input() items: TreeviewItem[];
    @Input() testoSedeSelezionata$: Observable<string>;
    @Input() tastoConferma$: Observable<boolean>;
    @Input() testoSedeSelezionata: string;
    @Input() visualizzaTasti = false;
    @Input() placement: string;
    @Input() maxHeight: number;
    @Input() disabled: boolean;
    @Output() annullaSelezione = new EventEmitter();
    @Output() confermaSelezione = new EventEmitter<TreeviewSelezione[]>();
    @Output() patchSelezione = new EventEmitter<TreeviewEmitterInterface>();

    treeViewOpened: boolean;
    treeViewSelection: TreeviewSelezione[];
    tastoConferma: boolean;

    config = TreeviewConfig.create({
        hasAllCheckBox: false,
        hasFilter: true,
        hasCollapseExpand: false,
        decoupleChildFromParent: false,
        maxHeight: 400
    });

    constructor(config: NgbDropdownConfig) {
        config.autoClose = 'outside';
    }

    @ViewChild('treeviewSedi') treeviewSedi: NgbDropdown;

    @HostListener('document:keydown.escape') onKeydownHandler() {
        if (this.treeViewOpened) {
            this.annullaSelezione.emit();
            this.treeviewSedi.close();
        }
    }

    ngOnInit(): void {
        isDevMode() && console.log('Componente Shared Treeview creato');
    }

    ngOnDestroy(): void {
        isDevMode() && console.log('Componente Shared Treeview distrutto');
    }

    ngOnChanges(changes: SimpleChanges): void {
        const testoSedeSelezionata$ = changes.testoSedeSelezionata$;
        const testoSedeSelezionata = changes.testoSedeSelezionata;<commit_msg>Fix: bug ricerca "Treeview"<commit_after>import {
    Component,
    EventEmitter,
    HostListener,
    Input, isDevMode,
    OnChanges, OnDestroy, OnInit,
    Output,
    SimpleChanges,
    ViewChild,
    ViewEncapsulation
} from '@angular/core';
import { DownlineTreeviewItem, OrderDownlineTreeviewEventParser, TreeviewConfig, TreeviewEventParser, TreeviewItem } from 'ngx-treeview';
import { NgbDropdown, NgbDropdownConfig } from '@ng-bootstrap/ng-bootstrap';
import { arrayUnique } from '../../helper/function';
import { isNil, reverse } from 'lodash';
import { Ricorsivo, TreeviewEmitterInterface } from '../../interface/treeview.interface';
import { TreeviewSelezione } from '../../model/treeview-selezione.model';
import { sedeString } from '../../store/states/sedi-treeview/sedi-treeview.helper';
import { Observable } from 'rxjs';


@Component({
    selector: 'app-shared-treeview',
    templateUrl: './treeview.component.html',
    styleUrls: ['./treeview.component.css'],
    encapsulation: ViewEncapsulation.Emulated,
    providers: [
        { provide: TreeviewEventParser, useClass: OrderDownlineTreeviewEventParser },
    ]
})
export class TreeviewComponent implements OnChanges, OnDestroy, OnInit {
    @Input() colorButton = 'btn-default';
    @Input() items: TreeviewItem[];
    @Input() testoSedeSelezionata$: Observable<string>;
    @Input() tastoConferma$: Observable<boolean>;
    @Input() testoSedeSelezionata: string;
    @Input() visualizzaTasti = false;
    @Input() placement: string;
    @Input() maxHeight: number;
    @Input() disabled: boolean;
    @Output() annullaSelezione = new EventEmitter();
    @Output() confermaSelezione = new EventEmitter<TreeviewSelezione[]>();
    @Output() patchSelezione = new EventEmitter<TreeviewEmitterInterface>();

    treeViewOpened: boolean;
    treeViewSelection: TreeviewSelezione[];
    tastoConferma: boolean;

    config = TreeviewConfig.create({
        hasAllCheckBox: false,
        hasFilter: false,
        hasCollapseExpand: false,
        decoupleChildFromParent: false,
        maxHeight: 400
    });

    constructor(config: NgbDropdownConfig) {
        config.autoClose = 'outside';
    }

    @ViewChild('treeviewSedi') treeviewSedi: NgbDropdown;

    @HostListener('document:keydown.escape') onKeydownHandler() {
        if (this.treeViewOpened) {
            this.annullaSelezione.emit();
            this.treeviewSedi.close();
        }
    }

    ngOnInit(): void {
        isDevMode() && console.log('Componente Shared Treeview creato');
    }

    ngOnDestroy(): void {
        isDevMode() && console.log('Componente Shared Treeview distrutto');
    }

    ngOnChanges(changes: SimpleChanges): void {
        const testoSedeSelezionata$ = changes.testoSedeSelezionata$;
        const testoSedeSelezionata = changes.testoSedeSelezionata;
{'fraction_non_alphanumeric': 0.12320510547775217, 'fraction_numerical': 0.0010636411983690835, 'mean_word_length': 3.8057921635434413, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1699056', 'n_tokens_mistral': 1716, 'n_tokens_neox': 1681, 'n_words': 338}