@ecodev/natural 45.0.0 → 45.0.1

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.
@@ -13,7 +13,7 @@ import * as i4 from '@angular/material/button';
13
13
  import { MatButtonModule } from '@angular/material/button';
14
14
  import * as i2 from '@angular/material/snack-bar';
15
15
  import { MatSnackBarModule } from '@angular/material/snack-bar';
16
- import { switchMap, map, first, filter, finalize, takeUntil, take, tap, takeWhile, debounceTime, shareReplay, startWith, distinctUntilChanged, throttleTime } from 'rxjs/operators';
16
+ import { switchMap, first, map, filter, finalize, takeUntil, take, tap, takeWhile, debounceTime, shareReplay, startWith, distinctUntilChanged, throttleTime } from 'rxjs/operators';
17
17
  import * as i7$2 from '@angular/material/table';
18
18
  import { MatTableDataSource, MatTableModule } from '@angular/material/table';
19
19
  import { DataSource, SelectionModel } from '@angular/cdk/collections';
@@ -2121,7 +2121,7 @@ function unique(fieldName, excludedId, modelService) {
2121
2121
  };
2122
2122
  const qvm = new NaturalQueryVariablesManager();
2123
2123
  qvm.set('variables', variables);
2124
- return timer(500).pipe(switchMap(() => modelService.count(qvm).pipe(map(count => (count > 0 ? { duplicateValue: count } : null)))));
2124
+ return timer(500).pipe(switchMap(() => modelService.count(qvm).pipe(first(), map(count => (count > 0 ? { duplicateValue: count } : null)))));
2125
2125
  };
2126
2126
  }
2127
2127
  /**
@@ -3423,7 +3423,10 @@ class NaturalAbstractNavigableList extends NaturalAbstractList {
3423
3423
  const variables = { filter: { groups: [{ conditions: [condition] }] } };
3424
3424
  const qvm = new NaturalQueryVariablesManager();
3425
3425
  qvm.set('variables', variables);
3426
- this.service.count(qvm).subscribe(count => (navigableItem.hasNavigation = count > 0));
3426
+ this.service
3427
+ .count(qvm)
3428
+ .pipe(first$1())
3429
+ .subscribe(count => (navigableItem.hasNavigation = count > 0));
3427
3430
  return navigableItem;
3428
3431
  });
3429
3432
  const navigableResult = {
@@ -3900,7 +3903,7 @@ class NaturalAbstractModelService {
3900
3903
  return input;
3901
3904
  }
3902
3905
  /**
3903
- * Return the number of objects matching the query
3906
+ * Return the number of objects matching the query. It may never complete.
3904
3907
  *
3905
3908
  * This is used for the unique validator
3906
3909
  */
@@ -6331,7 +6334,7 @@ class NaturalHierarchicSelectorService {
6331
6334
  }
6332
6335
  countItems(node, contextFilters = null) {
6333
6336
  const configurations = this.getContextualizedConfigs(node, contextFilters, null);
6334
- const observables = configurations.map(c => c.configuration.injectedService.count(c.variablesManager));
6337
+ const observables = configurations.map(c => c.configuration.injectedService.count(c.variablesManager).pipe(first$1()));
6335
6338
  forkJoin(observables).subscribe(results => {
6336
6339
  const totalItems = results.reduce((total, length) => total + length, 0);
6337
6340
  node.expandable = totalItems > 0;
@@ -6368,12 +6371,6 @@ class NaturalHierarchicSelectorService {
6368
6371
  }
6369
6372
  return configsAndServices;
6370
6373
  }
6371
- /**
6372
- * Check configuration to return a boolean that allows or denies the selection for the given element
6373
- */
6374
- isSelectable(node) {
6375
- return !!node.node.config.selectableAtKey;
6376
- }
6377
6374
  /**
6378
6375
  * Return models matching given FlatNodes
6379
6376
  * Returns a Literal of models grouped by their configuration attribute "selectableAtKey"
@@ -7072,7 +7069,7 @@ class NaturalHierarchicSelectorComponent extends NaturalAbstractController {
7072
7069
  }
7073
7070
  else if (!this.multiple) {
7074
7071
  if (this.flatNodesSelection.isSelected(flatNode)) {
7075
- this.unselectSingleFlatNode(flatNode);
7072
+ this.unselectSingleFlatNode();
7076
7073
  }
7077
7074
  else {
7078
7075
  // If not multiple, and we want to select an element, unselect everything before to keep a single selection
@@ -7243,7 +7240,7 @@ class NaturalHierarchicSelectorComponent extends NaturalAbstractController {
7243
7240
  /**
7244
7241
  * Clear all selected and select the given node
7245
7242
  */
7246
- unselectSingleFlatNode(flatNode) {
7243
+ unselectSingleFlatNode() {
7247
7244
  this.flatNodesSelection.clear();
7248
7245
  this.selectedNodes = [];
7249
7246
  this.updateSelection(this.selectedNodes);