@recursyve/nice-ui-kit.v2 13.2.0-beta.101 → 13.2.0-beta.103

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.
@@ -2,7 +2,7 @@ import * as i1$7 from '@angular/animations';
2
2
  import { animation, style, animate, trigger, transition, useAnimation, state, keyframes } from '@angular/animations';
3
3
  import { HttpContextToken, HttpResponse, HttpContext, HttpParams } from '@angular/common/http';
4
4
  import * as i0 from '@angular/core';
5
- import { Injectable, NgModule, EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, HostBinding, InjectionToken, Directive, HostListener, forwardRef, Optional, Inject, ViewChild, ViewChildren, Self, Pipe, ElementRef, PLATFORM_ID, TemplateRef, ContentChildren, ContentChild, SkipSelf } from '@angular/core';
5
+ import { Injectable, NgModule, EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, HostBinding, InjectionToken, Directive, HostListener, forwardRef, Optional, Inject, ViewChild, ViewChildren, Self, Pipe, ElementRef, PLATFORM_ID, TemplateRef, ContentChildren, ContentChild, SimpleChange, SkipSelf } from '@angular/core';
6
6
  import { plainToInstance } from 'class-transformer';
7
7
  import { map, filter, takeUntil, tap, take, debounceTime as debounceTime$1, delay, switchMap } from 'rxjs/operators';
8
8
  import { catchError, ReplaySubject, Subject, BehaviorSubject, mergeMap, from, isObservable, firstValueFrom, debounceTime, distinctUntilChanged, startWith, tap as tap$1, Observable, combineLatest, fromEvent, merge as merge$1 } from 'rxjs';
@@ -2983,7 +2983,7 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
2983
2983
  }
2984
2984
  }
2985
2985
  }
2986
- onRemove(event) {
2986
+ onRemove(event, reload = true) {
2987
2987
  if (event) {
2988
2988
  // event.stopPropagation();
2989
2989
  }
@@ -2997,7 +2997,9 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
2997
2997
  this.ngControl.control.markAsTouched();
2998
2998
  }
2999
2999
  this.stateChanges.next();
3000
- this.service.search(this.resource, "", this.searchOptions);
3000
+ if (reload) {
3001
+ this.service.search(this.resource, "", this.searchOptions);
3002
+ }
3001
3003
  }
3002
3004
  formatLabel(item) {
3003
3005
  if (this._labelFormatFn) {
@@ -8939,6 +8941,7 @@ class NiceChipListDirective {
8939
8941
  this.asyncTypeahead = asyncTypeahead;
8940
8942
  this.ngControl = ngControl;
8941
8943
  this.elementRef = elementRef;
8944
+ this.reloadOnSelected = true;
8942
8945
  this.unsubscribeAll$ = new Subject();
8943
8946
  this.values$ = new BehaviorSubject([]);
8944
8947
  this._values = [];
@@ -8977,6 +8980,7 @@ class NiceChipListDirective {
8977
8980
  this.withItemList.items$ = this.values$;
8978
8981
  this.withItemList.removeChip.pipe(takeUntil(this.unsubscribeAll$)).subscribe(x => {
8979
8982
  this._values.splice(x, 1);
8983
+ this.updateTypeaheadSearchOptions();
8980
8984
  this.propagateChanges(this._values);
8981
8985
  this.values$.next(this._values);
8982
8986
  });
@@ -8984,6 +8988,7 @@ class NiceChipListDirective {
8984
8988
  }
8985
8989
  writeValue(obj) {
8986
8990
  this._values = obj ?? [];
8991
+ this.updateTypeaheadSearchOptions();
8987
8992
  this.values$.next(this._values);
8988
8993
  }
8989
8994
  registerOnChange(fn) {
@@ -8995,7 +9000,8 @@ class NiceChipListDirective {
8995
9000
  .pipe(takeUntil(this.unsubscribeAll$), filter((selected) => selected))
8996
9001
  .subscribe((_) => {
8997
9002
  this.addValue(this.asyncTypeahead.getActive());
8998
- this.asyncTypeahead.writeValue(null);
9003
+ this.asyncTypeahead.searchOptions = { ...(this.asyncTypeahead.searchOptions ?? {}), ignore: this._values ?? [] };
9004
+ this.asyncTypeahead.onRemove(null, this.reloadOnSelected);
8999
9005
  });
9000
9006
  }
9001
9007
  addValue(value) {
@@ -9006,9 +9012,19 @@ class NiceChipListDirective {
9006
9012
  this.propagateChanges(this._values);
9007
9013
  this.values$.next(this._values);
9008
9014
  }
9015
+ updateTypeaheadSearchOptions() {
9016
+ if (!this.asyncTypeahead) {
9017
+ return;
9018
+ }
9019
+ const searchOptions = this.asyncTypeahead.searchOptions;
9020
+ this.asyncTypeahead.searchOptions = { ...(searchOptions ?? {}), ignore: this._values ?? [] };
9021
+ this.asyncTypeahead.ngOnChanges({
9022
+ searchOptions: new SimpleChange(searchOptions, this.asyncTypeahead.searchOptions, false)
9023
+ });
9024
+ }
9009
9025
  }
9010
9026
  NiceChipListDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceChipListDirective, deps: [{ token: NiceAsyncTypeaheadComponent, optional: true }, { token: i1$2.NgControl, optional: true }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
9011
- NiceChipListDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.3", type: NiceChipListDirective, selector: "input[niceChipList], nice-async-typeahead[niceChipList]", inputs: { withItemList: "withItemList" }, host: { listeners: { "keydown": "onKeyDown($event)" } }, usesOnChanges: true, ngImport: i0 });
9027
+ NiceChipListDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.3", type: NiceChipListDirective, selector: "input[niceChipList], nice-async-typeahead[niceChipList]", inputs: { withItemList: "withItemList", reloadOnSelected: "reloadOnSelected" }, host: { listeners: { "keydown": "onKeyDown($event)" } }, usesOnChanges: true, ngImport: i0 });
9012
9028
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceChipListDirective, decorators: [{
9013
9029
  type: Directive,
9014
9030
  args: [{
@@ -9020,6 +9036,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
9020
9036
  type: Optional
9021
9037
  }] }, { type: i0.ElementRef }]; }, propDecorators: { withItemList: [{
9022
9038
  type: Input
9039
+ }], reloadOnSelected: [{
9040
+ type: Input
9023
9041
  }], onKeyDown: [{
9024
9042
  type: HostListener,
9025
9043
  args: ["keydown", ["$event"]]