@solidev/data 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ import { InjectionToken, PLATFORM_ID, Injectable, Inject, Optional, Component, I
3
3
  import 'reflect-metadata';
4
4
  import * as i2$2 from '@angular/forms';
5
5
  import { FormControl, Validators, FormGroup, ReactiveFormsModule, UntypedFormControl, NG_VALUE_ACCESSOR, UntypedFormGroup } from '@angular/forms';
6
- import { throwError, ReplaySubject, share, combineLatest, of, takeUntil, NEVER, Subject, debounceTime, distinctUntilChanged, isObservable, firstValueFrom, timer, Observable, BehaviorSubject, merge } from 'rxjs';
6
+ import { throwError, ReplaySubject, share, combineLatest, of, takeUntil, NEVER, Subject, debounceTime, distinctUntilChanged, firstValueFrom, isObservable, timer, Observable, BehaviorSubject, merge } from 'rxjs';
7
7
  import { tap, switchMap, map, throttleTime, filter, mergeMap, finalize, catchError, take, first } from 'rxjs/operators';
8
8
  import * as i2 from '@angular/platform-browser';
9
9
  import { makeStateKey } from '@angular/platform-browser';
@@ -1403,6 +1403,7 @@ class ModelListFilters {
1403
1403
 
1404
1404
  class ModelList {
1405
1405
  constructor(name) {
1406
+ this.messages$ = new ReplaySubject(1);
1406
1407
  this.started = false;
1407
1408
  this.name = name;
1408
1409
  }
@@ -1635,6 +1636,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImpor
1635
1636
  class ModelListFieldHeaderComponent {
1636
1637
  constructor() {
1637
1638
  this.sort = false;
1639
+ this.menuMode = 'side';
1640
+ this.sortMode = 'side';
1641
+ this.dispMenuMode = this.menuMode;
1642
+ this.dispSortMode = this.sortMode;
1643
+ this._subscriptions$ = new Subject();
1644
+ }
1645
+ ngOnInit() {
1646
+ this.list.messages$
1647
+ .pipe(takeUntil(this._subscriptions$), filter((m) => m.dest === 'header'))
1648
+ .subscribe((m) => {
1649
+ this.dispMenuMode =
1650
+ m.menu && m.menu !== 'default' ? m.menu : this.menuMode;
1651
+ this.dispSortMode =
1652
+ m.sort && m.sort !== 'default' ? m.sort : this.sortMode;
1653
+ this.display = m.show !== undefined ? m.show : this.display;
1654
+ });
1655
+ }
1656
+ ngOnDestroy() {
1657
+ this._subscriptions$.next();
1658
+ this._subscriptions$.complete();
1638
1659
  }
1639
1660
  disable() {
1640
1661
  this.list.fields.disable(this.field);
@@ -1645,10 +1666,10 @@ class ModelListFieldHeaderComponent {
1645
1666
  }
1646
1667
  }
1647
1668
  ModelListFieldHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: ModelListFieldHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1648
- ModelListFieldHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: ModelListFieldHeaderComponent, isStandalone: true, selector: "data-model-list-field-header", inputs: { list: "list", field: "field", sort: "sort", sortField: "sortField" }, ngImport: i0, template: "\n<ng-template #label><span #ref>\n <ng-content></ng-content></span><span *ngIf=\"!ref.children.length\">{{list.fields.get(field)?.label||field}}</span></ng-template>\n<div class=\"d-flex flex-row justify-content-between align-items-end slabel\" [class.active]=\"mnu.isOpen()\">\n <div class=\"flex-grow-1\">\n <data-model-list-sorter [list]=\"list\" [field]=\"sortField||field\" *ngIf=\"sort\">\n <ng-container *ngTemplateOutlet=\"label\"></ng-container>\n </data-model-list-sorter>\n <ng-container *ngIf=\"!sort\">\n <ng-container *ngTemplateOutlet=\"label\"></ng-container>\n </ng-container>\n </div>\n <div class=\"navicons d-flex flex-row\" [attr.aria-label]=\"'Gestion champs'\"><i class=\"bi bi-caret-left-fill\" role=\"button\" (click)=\"list.fields.move(field, 'before')\" aria-label=\"D\u00E9placer vers la gauche\"></i>\n <div ngbDropdown #mnu=\"ngbDropdown\" [container]=\"'body'\"><i class=\"bi bi-record\" ngbDropdownToggle aria-label=\"Ouvrir la boite de dialogue des champs\" role=\"button\"></i>\n <div ngbDropdownMenu>\n <button ngbDropdownItem (click)=\"disable()\"><i class=\"bi bi-trash me-2\"></i>Supprimer</button>\n <h6 class=\"dropdown-header\">Ajouter une colonne apr\u00E8s</h6>\n <ng-container *ngFor=\"let f of list.fields.fields|async\">\n <ng-container *ngIf=\"f.allowed &amp;&amp; !f.enabled\">\n <button ngbDropdownItem (click)=\"enable(f)\" [attr.aria-label]=\"f.label||f.name\"><i class=\"bi bi-plus-circle me-2\"></i>{{f.label||f.name}}</button>\n </ng-container>\n </ng-container>\n </div>\n </div><i class=\"bi bi-caret-right-fill\" role=\"button\" (click)=\"list.fields.move(field, 'after')\" aria-label=\"D\u00E9placer vers la droite\"></i>\n </div>\n</div>", styles: [".slabel .navicons{opacity:0}.slabel:hover .navicons,.slabel.active .navicons{opacity:1!important}.dropdown-toggle:after{display:none!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: NgbDropdownModule }, { kind: "directive", type: i2$1.NgbDropdown, selector: "[ngbDropdown]", inputs: ["autoClose", "dropdownClass", "open", "placement", "popperOptions", "container", "display"], outputs: ["openChange"], exportAs: ["ngbDropdown"] }, { kind: "directive", type: i2$1.NgbDropdownToggle, selector: "[ngbDropdownToggle]" }, { kind: "directive", type: i2$1.NgbDropdownMenu, selector: "[ngbDropdownMenu]" }, { kind: "directive", type: i2$1.NgbDropdownItem, selector: "[ngbDropdownItem]", inputs: ["disabled"] }, { kind: "component", type: ModelListSorterComponent, selector: "data-model-list-sorter", inputs: ["list", "field"] }] });
1669
+ ModelListFieldHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: ModelListFieldHeaderComponent, isStandalone: true, selector: "data-model-list-field-header", inputs: { list: "list", field: "field", sort: "sort", sortField: "sortField", menuMode: "menuMode", sortMode: "sortMode", display: "display" }, viewQueries: [{ propertyName: "mnu", first: true, predicate: ["mnu"], descendants: true }], ngImport: i0, template: "\n<ng-template #label><span #ref>\n <ng-content></ng-content></span><span *ngIf=\"!ref.children.length\">{{list.fields.get(field)?.label||field}}</span></ng-template>\n<div class=\"d-flex flex-row justify-content-between align-items-end slabel\">\n <div class=\"flex-grow-1\">\n <data-model-list-sorter [list]=\"list\" [field]=\"sortField||field\" *ngIf=\"sort &amp;&amp; dispSortMode==='side'\">\n <ng-container *ngTemplateOutlet=\"label\"></ng-container>\n </data-model-list-sorter>\n <ng-container *ngIf=\"!sort || dispSortMode==='hide'\">\n <ng-container *ngTemplateOutlet=\"label\"></ng-container>\n </ng-container>\n </div>\n <div class=\"navicons d-flex flex-row\" [attr.aria-label]=\"'Gestion champs'\" *ngIf=\"dispMenuMode==='side'\"><i class=\"bi bi-caret-left-fill\" role=\"button\" (click)=\"list.fields.move(field, 'before')\" aria-label=\"D\u00E9placer vers la gauche\"></i>\n <div ngbDropdown #mnu=\"ngbDropdown\" [container]=\"'body'\"><i class=\"bi bi-record\" ngbDropdownToggle aria-label=\"Ouvrir la boite de dialogue des champs\" role=\"button\"></i>\n <div ngbDropdownMenu>\n <button ngbDropdownItem (click)=\"disable()\"><i class=\"bi bi-trash me-2\"></i>Supprimer</button>\n <h6 class=\"dropdown-header\">Ajouter une colonne apr\u00E8s</h6>\n <ng-container *ngFor=\"let f of list.fields.fields|async\">\n <ng-container *ngIf=\"f.allowed &amp;&amp; !f.enabled\">\n <button ngbDropdownItem (click)=\"enable(f)\" [attr.aria-label]=\"f.label||f.name\"><i class=\"bi bi-plus-circle me-2\"></i>{{f.label||f.name}}</button>\n </ng-container>\n </ng-container>\n </div>\n </div><i class=\"bi bi-caret-right-fill\" role=\"button\" (click)=\"list.fields.move(field, 'after')\" aria-label=\"D\u00E9placer vers la droite\"></i>\n </div>\n</div>", styles: [".slabel .navicons{opacity:0}.slabel:hover .navicons,.slabel.active .navicons{opacity:1!important}.dropdown-toggle:after{display:none!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: NgbDropdownModule }, { kind: "directive", type: i2$1.NgbDropdown, selector: "[ngbDropdown]", inputs: ["autoClose", "dropdownClass", "open", "placement", "popperOptions", "container", "display"], outputs: ["openChange"], exportAs: ["ngbDropdown"] }, { kind: "directive", type: i2$1.NgbDropdownToggle, selector: "[ngbDropdownToggle]" }, { kind: "directive", type: i2$1.NgbDropdownMenu, selector: "[ngbDropdownMenu]" }, { kind: "directive", type: i2$1.NgbDropdownItem, selector: "[ngbDropdownItem]", inputs: ["disabled"] }, { kind: "component", type: ModelListSorterComponent, selector: "data-model-list-sorter", inputs: ["list", "field"] }] });
1649
1670
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: ModelListFieldHeaderComponent, decorators: [{
1650
1671
  type: Component,
1651
- args: [{ selector: 'data-model-list-field-header', standalone: true, imports: [CommonModule, NgbDropdownModule, ModelListSorterComponent], template: "\n<ng-template #label><span #ref>\n <ng-content></ng-content></span><span *ngIf=\"!ref.children.length\">{{list.fields.get(field)?.label||field}}</span></ng-template>\n<div class=\"d-flex flex-row justify-content-between align-items-end slabel\" [class.active]=\"mnu.isOpen()\">\n <div class=\"flex-grow-1\">\n <data-model-list-sorter [list]=\"list\" [field]=\"sortField||field\" *ngIf=\"sort\">\n <ng-container *ngTemplateOutlet=\"label\"></ng-container>\n </data-model-list-sorter>\n <ng-container *ngIf=\"!sort\">\n <ng-container *ngTemplateOutlet=\"label\"></ng-container>\n </ng-container>\n </div>\n <div class=\"navicons d-flex flex-row\" [attr.aria-label]=\"'Gestion champs'\"><i class=\"bi bi-caret-left-fill\" role=\"button\" (click)=\"list.fields.move(field, 'before')\" aria-label=\"D\u00E9placer vers la gauche\"></i>\n <div ngbDropdown #mnu=\"ngbDropdown\" [container]=\"'body'\"><i class=\"bi bi-record\" ngbDropdownToggle aria-label=\"Ouvrir la boite de dialogue des champs\" role=\"button\"></i>\n <div ngbDropdownMenu>\n <button ngbDropdownItem (click)=\"disable()\"><i class=\"bi bi-trash me-2\"></i>Supprimer</button>\n <h6 class=\"dropdown-header\">Ajouter une colonne apr\u00E8s</h6>\n <ng-container *ngFor=\"let f of list.fields.fields|async\">\n <ng-container *ngIf=\"f.allowed &amp;&amp; !f.enabled\">\n <button ngbDropdownItem (click)=\"enable(f)\" [attr.aria-label]=\"f.label||f.name\"><i class=\"bi bi-plus-circle me-2\"></i>{{f.label||f.name}}</button>\n </ng-container>\n </ng-container>\n </div>\n </div><i class=\"bi bi-caret-right-fill\" role=\"button\" (click)=\"list.fields.move(field, 'after')\" aria-label=\"D\u00E9placer vers la droite\"></i>\n </div>\n</div>", styles: [".slabel .navicons{opacity:0}.slabel:hover .navicons,.slabel.active .navicons{opacity:1!important}.dropdown-toggle:after{display:none!important}\n"] }]
1672
+ args: [{ selector: 'data-model-list-field-header', standalone: true, imports: [CommonModule, NgbDropdownModule, ModelListSorterComponent], template: "\n<ng-template #label><span #ref>\n <ng-content></ng-content></span><span *ngIf=\"!ref.children.length\">{{list.fields.get(field)?.label||field}}</span></ng-template>\n<div class=\"d-flex flex-row justify-content-between align-items-end slabel\">\n <div class=\"flex-grow-1\">\n <data-model-list-sorter [list]=\"list\" [field]=\"sortField||field\" *ngIf=\"sort &amp;&amp; dispSortMode==='side'\">\n <ng-container *ngTemplateOutlet=\"label\"></ng-container>\n </data-model-list-sorter>\n <ng-container *ngIf=\"!sort || dispSortMode==='hide'\">\n <ng-container *ngTemplateOutlet=\"label\"></ng-container>\n </ng-container>\n </div>\n <div class=\"navicons d-flex flex-row\" [attr.aria-label]=\"'Gestion champs'\" *ngIf=\"dispMenuMode==='side'\"><i class=\"bi bi-caret-left-fill\" role=\"button\" (click)=\"list.fields.move(field, 'before')\" aria-label=\"D\u00E9placer vers la gauche\"></i>\n <div ngbDropdown #mnu=\"ngbDropdown\" [container]=\"'body'\"><i class=\"bi bi-record\" ngbDropdownToggle aria-label=\"Ouvrir la boite de dialogue des champs\" role=\"button\"></i>\n <div ngbDropdownMenu>\n <button ngbDropdownItem (click)=\"disable()\"><i class=\"bi bi-trash me-2\"></i>Supprimer</button>\n <h6 class=\"dropdown-header\">Ajouter une colonne apr\u00E8s</h6>\n <ng-container *ngFor=\"let f of list.fields.fields|async\">\n <ng-container *ngIf=\"f.allowed &amp;&amp; !f.enabled\">\n <button ngbDropdownItem (click)=\"enable(f)\" [attr.aria-label]=\"f.label||f.name\"><i class=\"bi bi-plus-circle me-2\"></i>{{f.label||f.name}}</button>\n </ng-container>\n </ng-container>\n </div>\n </div><i class=\"bi bi-caret-right-fill\" role=\"button\" (click)=\"list.fields.move(field, 'after')\" aria-label=\"D\u00E9placer vers la droite\"></i>\n </div>\n</div>", styles: [".slabel .navicons{opacity:0}.slabel:hover .navicons,.slabel.active .navicons{opacity:1!important}.dropdown-toggle:after{display:none!important}\n"] }]
1652
1673
  }], ctorParameters: function () { return []; }, propDecorators: { list: [{
1653
1674
  type: Input
1654
1675
  }], field: [{
@@ -1657,6 +1678,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImpor
1657
1678
  type: Input
1658
1679
  }], sortField: [{
1659
1680
  type: Input
1681
+ }], menuMode: [{
1682
+ type: Input
1683
+ }], sortMode: [{
1684
+ type: Input
1685
+ }], display: [{
1686
+ type: Input
1687
+ }], mnu: [{
1688
+ type: ViewChild,
1689
+ args: ['mnu', { static: false }]
1660
1690
  }] } });
1661
1691
 
1662
1692
  class ModelListFiltersSelectComponent {
@@ -2044,16 +2074,165 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImpor
2044
2074
  type: Input
2045
2075
  }] } });
2046
2076
 
2077
+ class Level {
2078
+ constructor(tree, level, choices) {
2079
+ this.tree = tree;
2080
+ this.level = level;
2081
+ this.fc = new FormControl('');
2082
+ this.choices = choices;
2083
+ this.subs = this.fc.valueChanges.subscribe((val) => {
2084
+ if (this.selected !== val) {
2085
+ this.selected = val;
2086
+ this.tree.updated(this);
2087
+ }
2088
+ });
2089
+ }
2090
+ close() {
2091
+ this.subs.unsubscribe();
2092
+ }
2093
+ }
2094
+ class Tree {
2095
+ constructor(qs, maxLevel, display, filter) {
2096
+ this.qs = qs;
2097
+ this.maxLevel = maxLevel;
2098
+ this.display = display;
2099
+ this.filter = filter;
2100
+ this.levels = [];
2101
+ this.changed = new Subject();
2102
+ }
2103
+ /**
2104
+ * Conditionnaly add level to current tree.
2105
+ *
2106
+ * - if previous level have non-empty selected value
2107
+ * - if current level choices are non empty
2108
+ */
2109
+ async addLevel(fparent) {
2110
+ let values = [];
2111
+ if (this.levels.length === 0) {
2112
+ values = await firstValueFrom(this.qs
2113
+ .filter({ level: this.levels.length, parent: 'null', ...this.filter })
2114
+ .get());
2115
+ }
2116
+ else {
2117
+ const parent = fparent
2118
+ ? fparent
2119
+ : this.levels[this.levels.length - 1].selected;
2120
+ if (parent) {
2121
+ values = await firstValueFrom(this.qs
2122
+ .filter({
2123
+ level: this.levels.length,
2124
+ parent: this.levels[this.levels.length - 1].selected || 'null',
2125
+ ...this.filter,
2126
+ })
2127
+ .get());
2128
+ }
2129
+ }
2130
+ if (values.length > 0) {
2131
+ const level = new Level(this, this.levels.length, []);
2132
+ for (const v of values) {
2133
+ level.choices.push({ value: v.id, desc: this.display(v) });
2134
+ }
2135
+ this.levels.push(level);
2136
+ return level;
2137
+ }
2138
+ return null;
2139
+ }
2140
+ updated(level) {
2141
+ const newLevels = [];
2142
+ for (const l of this.levels) {
2143
+ if (l.level <= level.level) {
2144
+ newLevels.push(l);
2145
+ }
2146
+ else if (l.level > level.level) {
2147
+ l.close();
2148
+ }
2149
+ }
2150
+ this.levels = newLevels;
2151
+ this.addLevel();
2152
+ if (level.selected) {
2153
+ this.changed.next(level.selected);
2154
+ }
2155
+ else {
2156
+ this.changed.next(this.levels[level.level - 1]?.selected || null);
2157
+ }
2158
+ }
2159
+ async prepare(value) {
2160
+ // console.log('prepare', value);
2161
+ const levels = [];
2162
+ let cur = (await firstValueFrom(this.qs.filter({ id: value, ...this.filter }).get()))[0];
2163
+ levels.push(cur);
2164
+ let nlev = 0;
2165
+ while (cur.parent !== null) {
2166
+ cur = (await firstValueFrom(this.qs
2167
+ .filter({
2168
+ id: cur.parent,
2169
+ ...this.filter,
2170
+ })
2171
+ .get()))[0];
2172
+ levels.push(cur);
2173
+ nlev++;
2174
+ if (nlev > this.maxLevel) {
2175
+ throw Error('Max level error, could not find root');
2176
+ }
2177
+ }
2178
+ for (let i = levels.length - 1; i >= 0; i--) {
2179
+ const lv = await this.addLevel();
2180
+ if (lv !== null) {
2181
+ lv.selected = levels[i].id;
2182
+ lv.fc.setValue(levels[i].id, { emitEvent: false });
2183
+ }
2184
+ }
2185
+ if (this.levels.length <= this.maxLevel) {
2186
+ await this.addLevel();
2187
+ }
2188
+ }
2189
+ reset() { }
2190
+ }
2047
2191
  class ModelListTreeFilterComponent {
2048
2192
  constructor() {
2049
2193
  this.classes = '';
2050
2194
  }
2195
+ async ngOnInit() {
2196
+ this.tree = new Tree(this.filter.queryset, this.filter.maxLevel, this.filter.display, this.filter.filter);
2197
+ if (this.filter.get()) {
2198
+ await this.tree.prepare(this.filter.get()?.value);
2199
+ }
2200
+ else {
2201
+ await this.tree.addLevel();
2202
+ }
2203
+ this.tree.changed.pipe(debounceTime(250)).subscribe((val) => {
2204
+ // console.log('changed', val);
2205
+ if (val === null) {
2206
+ this.filter.clear();
2207
+ this.list.filters.update();
2208
+ }
2209
+ else {
2210
+ if (this.filter.set(val, '')) {
2211
+ this.list.filters.update();
2212
+ }
2213
+ }
2214
+ });
2215
+ // this.tree.changed.subscribe((selected) => {
2216
+ // console.log('tree changed', selected);
2217
+ // this.filter.set(selected, '');
2218
+ // });
2219
+ // if (this.filter.getValue()) {
2220
+ // console.log('filter value', this.filter.getValue());
2221
+ // await this.tree.prepare(this.filter.getValue() as number);
2222
+ // } else {
2223
+ // await this.tree.addLevel();
2224
+ // }
2225
+ }
2226
+ disable() {
2227
+ this.filter.enabled = false;
2228
+ this.list.filters.update();
2229
+ }
2051
2230
  }
2052
2231
  ModelListTreeFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: ModelListTreeFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2053
- ModelListTreeFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: ModelListTreeFilterComponent, isStandalone: true, selector: "data-model-list-tree-filter", inputs: { list: "list", filter: "filter", classes: "classes" }, ngImport: i0, template: "<p>model-list-tree-filter works!</p>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
2232
+ ModelListTreeFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: ModelListTreeFilterComponent, isStandalone: true, selector: "data-model-list-tree-filter", inputs: { list: "list", filter: "filter", classes: "classes" }, ngImport: i0, template: "\n<div class=\"filteritem\" [ngClass]=\"filter.displayClasses || classes\">\n <div class=\"trash float-end\" (click)=\"disable()\"><i class=\"bi bi-trash\"></i></div>\n <label>{{filter.label}}</label>\n <div class=\"levelselect\" *ngFor=\"let l of tree.levels\">\n <select class=\"form-select form-select-sm\" [formControl]=\"l.fc\">\n <option value=\"\">{{filter.help}}</option>\n <option *ngFor=\"let ch of l.choices\" [value]=\"ch.value\">{{ch.desc}}</option>\n </select>\n </div>\n</div>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] });
2054
2233
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: ModelListTreeFilterComponent, decorators: [{
2055
2234
  type: Component,
2056
- args: [{ selector: 'data-model-list-tree-filter', standalone: true, imports: [CommonModule], template: "<p>model-list-tree-filter works!</p>" }]
2235
+ args: [{ selector: 'data-model-list-tree-filter', standalone: true, imports: [CommonModule, ReactiveFormsModule], template: "\n<div class=\"filteritem\" [ngClass]=\"filter.displayClasses || classes\">\n <div class=\"trash float-end\" (click)=\"disable()\"><i class=\"bi bi-trash\"></i></div>\n <label>{{filter.label}}</label>\n <div class=\"levelselect\" *ngFor=\"let l of tree.levels\">\n <select class=\"form-select form-select-sm\" [formControl]=\"l.fc\">\n <option value=\"\">{{filter.help}}</option>\n <option *ngFor=\"let ch of l.choices\" [value]=\"ch.value\">{{ch.desc}}</option>\n </select>\n </div>\n</div>" }]
2057
2236
  }], ctorParameters: function () { return []; }, propDecorators: { list: [{
2058
2237
  type: Input
2059
2238
  }], filter: [{
@@ -2242,6 +2421,9 @@ class ModelListFilter {
2242
2421
  getValue() {
2243
2422
  return `${this._value?.value}`;
2244
2423
  }
2424
+ get() {
2425
+ return this._value;
2426
+ }
2245
2427
  mtoggle(value, desc, notify = true) {
2246
2428
  if (this._mvalue.has(`${value}`)) {
2247
2429
  this._mvalue.delete(`${value}`);
@@ -2535,15 +2717,19 @@ class ModelListTextFilter extends ModelListFilter {
2535
2717
  }
2536
2718
  }
2537
2719
 
2538
- class ModelListTreeFilter extends ModelListFilter {
2720
+ class ModelListTreeFilter extends ModelListAutocompleteFilter {
2539
2721
  constructor(params) {
2540
2722
  super(params);
2541
- this.type = "tree";
2542
- if (this.label == "") {
2543
- this.label = "Sélectionnez dans la hiérarchie";
2723
+ this.maxLevel = 5;
2724
+ this.type = 'tree';
2725
+ if (this.label == '') {
2726
+ this.label = 'Sélectionnez dans la hiérarchie';
2544
2727
  }
2545
- if (this.help == "") {
2546
- this.help = "Texte à rechercher";
2728
+ if (this.help == '') {
2729
+ this.help = 'Texte à rechercher';
2730
+ }
2731
+ if (params.maxLevel) {
2732
+ this.maxLevel = params.maxLevel;
2547
2733
  }
2548
2734
  }
2549
2735
  }
@@ -5233,6 +5419,9 @@ let AuthServiceBase = class AuthServiceBase {
5233
5419
  }
5234
5420
  get currentUser$() {
5235
5421
  // Needs refresh ?
5422
+ if (this.isAnonymous) {
5423
+ return of(null);
5424
+ }
5236
5425
  if (!this._fetched ||
5237
5426
  Date.now() - this._fetched >
5238
5427
  (this._params.userFetchValiditySeconds || 3600) * 1000) {