chrv-components 1.11.29 → 1.11.31

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.
Binary file
@@ -10,7 +10,7 @@ import { MatTooltipModule, MatTooltip } from '@angular/material/tooltip';
10
10
  import * as i1 from '@angular/common';
11
11
  import { CommonModule, AsyncPipe, DatePipe, DATE_PIPE_DEFAULT_OPTIONS, isPlatformBrowser, NgClass } from '@angular/common';
12
12
  import { MatDialogTitle, MatDialogContent, MatDialogActions, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
13
- import { Subject, Observable, map, BehaviorSubject, skip, debounceTime, distinctUntilChanged, combineLatest, of, startWith, from, mergeMap, toArray, timer, catchError, forkJoin, take, skipWhile, tap, finalize as finalize$1, interval } from 'rxjs';
13
+ import { Subject, Observable, map, BehaviorSubject, skip, debounceTime, distinctUntilChanged, startWith, combineLatestWith, from, mergeMap, toArray, timer, of, catchError, forkJoin, take, skipWhile, tap, finalize as finalize$1, interval } from 'rxjs';
14
14
  import * as i1$1 from '@angular/forms';
15
15
  import { NG_VALIDATORS, Validators, FormControl, NgControl, ReactiveFormsModule, FormsModule, FormBuilder } from '@angular/forms';
16
16
  import * as i2$2 from '@angular/material/autocomplete';
@@ -1431,6 +1431,7 @@ class ChrSearchSelectComponent extends ChrBaseInputComponent {
1431
1431
  this.autocomplete = viewChild.required('auto');
1432
1432
  this.placeholder = input();
1433
1433
  this.data = input([]);
1434
+ this.data$ = new BehaviorSubject([]);
1434
1435
  this.display = input();
1435
1436
  this.filters = input(null);
1436
1437
  /**
@@ -1477,31 +1478,8 @@ class ChrSearchSelectComponent extends ChrBaseInputComponent {
1477
1478
  /**
1478
1479
  * Start filtering the autocomplete's list based on the input's textual value
1479
1480
  */
1480
- // protected registerFilters = () => {
1481
- // this.filteredModelOptions = this.values.pipe(
1482
- // startWith(''),
1483
- // map((value) => this._filterModel(value! || -1)),
1484
- // map((values) => {
1485
- // const filters = this.filters();
1486
- // return filters && filters[this.filterIndex()]?.callback
1487
- // ? values.filter((r) =>
1488
- // this.filters()![this.filterIndex()]?.callback!(r)
1489
- // )
1490
- // : values;
1491
- // })
1492
- // );
1493
- // };
1494
1481
  this.registerFilters = () => {
1495
- this.filteredModelOptions = combineLatest([
1496
- this.values.pipe(startWith('')),
1497
- // Convertir le signal data() en Observable
1498
- of(this.data()).pipe(startWith(this.data())),
1499
- ]).pipe(map(([value, data]) => {
1500
- // S'assurer que les données sont disponibles avant de filtrer
1501
- if (!data || data.length === 0)
1502
- return [];
1503
- return this._filterModel(value || -1);
1504
- }), map((values) => {
1482
+ this.filteredModelOptions = this.values.pipe(startWith(''), combineLatestWith(this.data$), map(([value, data]) => this._filterModel(value || -1)), map((values) => {
1505
1483
  const filters = this.filters();
1506
1484
  return filters && filters[this.filterIndex()]?.callback
1507
1485
  ? values.filter((r) => this.filters()[this.filterIndex()]?.callback(r))
@@ -1569,6 +1547,9 @@ class ChrSearchSelectComponent extends ChrBaseInputComponent {
1569
1547
  .toLowerCase()
1570
1548
  .includes(input.trim().toLowerCase());
1571
1549
  };
1550
+ effect(() => {
1551
+ this.data$.next(this.data() || []);
1552
+ });
1572
1553
  }
1573
1554
  ngOnInit() {
1574
1555
  super.ngOnInit();
@@ -1623,6 +1604,7 @@ class ChrTagSelectComponent extends ChrBaseInputComponent {
1623
1604
  this.values = new BehaviorSubject('');
1624
1605
  this.placeholder = input();
1625
1606
  this.data = input([]);
1607
+ this.data$ = new BehaviorSubject([]);
1626
1608
  this.display = input();
1627
1609
  this.filters = input(null);
1628
1610
  /**
@@ -1705,31 +1687,8 @@ class ChrTagSelectComponent extends ChrBaseInputComponent {
1705
1687
  // this.value![this.value!.indexOf(entry)] = entry;
1706
1688
  // return this.onValueChange(this.value);
1707
1689
  };
1708
- // protected registerFilters = () => {
1709
- // this.filteredModelOptions = this.values.pipe(
1710
- // startWith(''),
1711
- // map((value) => this._filterModel(this.textInputValue() || -1)),
1712
- // map((values) => {
1713
- // const filters = this.filters();
1714
- // return filters && filters[this.filterIndex()]?.callback
1715
- // ? values.filter((r) =>
1716
- // this.filters()![this.filterIndex()]?.callback!(r)
1717
- // )
1718
- // : values;
1719
- // })
1720
- // );
1721
- // };
1722
1690
  this.registerFilters = () => {
1723
- this.filteredModelOptions = combineLatest([
1724
- this.values.pipe(startWith('')),
1725
- // Convertir le signal data() en Observable
1726
- of(this.data()).pipe(startWith(this.data())),
1727
- ]).pipe(map(([value, data]) => {
1728
- // S'assurer que les données sont disponibles avant de filtrer
1729
- if (!data || data.length === 0)
1730
- return [];
1731
- return this._filterModel(this.textInputValue() || -1);
1732
- }), map((values) => {
1691
+ this.filteredModelOptions = this.values.pipe(startWith(''), combineLatestWith(this.data$), map((value) => this._filterModel(this.textInputValue() || -1)), map((values) => {
1733
1692
  const filters = this.filters();
1734
1693
  return filters && filters[this.filterIndex()]?.callback
1735
1694
  ? values.filter((r) => this.filters()[this.filterIndex()]?.callback(r))
@@ -1795,6 +1754,9 @@ class ChrTagSelectComponent extends ChrBaseInputComponent {
1795
1754
  this.value = [...(this.value ?? [])];
1796
1755
  return this.onValueChange(this.value);
1797
1756
  });
1757
+ effect(() => {
1758
+ this.data$.next(this.data() || []);
1759
+ });
1798
1760
  }
1799
1761
  ngOnInit() {
1800
1762
  super.ngOnInit();