@recursyve/nice-ui-kit.v2 13.2.0-beta.100 → 13.2.0-beta.102

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,13 +8980,21 @@ 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
+ if (this.asyncTypeahead) {
8984
+ const searchOptions = this.asyncTypeahead.searchOptions;
8985
+ this.asyncTypeahead.searchOptions = { ...(searchOptions ?? {}), ignore: this._values ?? [] };
8986
+ this.asyncTypeahead.ngOnChanges({
8987
+ searchOptions: new SimpleChange(searchOptions, this.asyncTypeahead.searchOptions, false)
8988
+ });
8989
+ }
8980
8990
  this.propagateChanges(this._values);
8981
8991
  this.values$.next(this._values);
8982
8992
  });
8983
8993
  }
8984
8994
  }
8985
8995
  writeValue(obj) {
8986
- this._values = [];
8996
+ this._values = obj ?? [];
8997
+ this.values$.next(this._values);
8987
8998
  }
8988
8999
  registerOnChange(fn) {
8989
9000
  this.propagateChanges = fn;
@@ -8994,7 +9005,8 @@ class NiceChipListDirective {
8994
9005
  .pipe(takeUntil(this.unsubscribeAll$), filter((selected) => selected))
8995
9006
  .subscribe((_) => {
8996
9007
  this.addValue(this.asyncTypeahead.getActive());
8997
- this.asyncTypeahead.writeValue(null);
9008
+ this.asyncTypeahead.searchOptions = { ...(this.asyncTypeahead.searchOptions ?? {}), ignore: this._values ?? [] };
9009
+ this.asyncTypeahead.onRemove(null, this.reloadOnSelected);
8998
9010
  });
8999
9011
  }
9000
9012
  addValue(value) {
@@ -9007,7 +9019,7 @@ class NiceChipListDirective {
9007
9019
  }
9008
9020
  }
9009
9021
  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 });
9010
- 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 });
9022
+ 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 });
9011
9023
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceChipListDirective, decorators: [{
9012
9024
  type: Directive,
9013
9025
  args: [{
@@ -9019,6 +9031,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
9019
9031
  type: Optional
9020
9032
  }] }, { type: i0.ElementRef }]; }, propDecorators: { withItemList: [{
9021
9033
  type: Input
9034
+ }], reloadOnSelected: [{
9035
+ type: Input
9022
9036
  }], onKeyDown: [{
9023
9037
  type: HostListener,
9024
9038
  args: ["keydown", ["$event"]]