@recursyve/nice-ui-kit.v2 14.0.0-beta.113 → 14.0.0-beta.115

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.
@@ -2767,6 +2767,17 @@ class NiceAsyncTypeaheadService {
2767
2767
  ...this.state$.value,
2768
2768
  loading: true
2769
2769
  });
2770
+ const localItem = this.state$.value.items.find((item) => item.id === id);
2771
+ if (localItem) {
2772
+ this.state$.next({
2773
+ ...this.state$.value,
2774
+ items: [localItem],
2775
+ active: localItem,
2776
+ page: 0,
2777
+ isLastPage: false
2778
+ });
2779
+ return;
2780
+ }
2770
2781
  const entity = await api.getById(id, options);
2771
2782
  if (!entity) {
2772
2783
  return;
@@ -2861,6 +2872,7 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
2861
2872
  this.panelWidth = 0;
2862
2873
  this.active$ = this.service.active$;
2863
2874
  this.entityRemoved = new EventEmitter();
2875
+ this.autoReload = true;
2864
2876
  this.preloadResource = false;
2865
2877
  this.allowNotFoundItems = false;
2866
2878
  this.panelClass = [];
@@ -2912,7 +2924,6 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
2912
2924
  this._value = value;
2913
2925
  this.propagate(value);
2914
2926
  this.stateChanges.next();
2915
- this.selected.emit(value);
2916
2927
  }
2917
2928
  }
2918
2929
  get value() {
@@ -2974,7 +2985,7 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
2974
2985
  ngOnChanges(changes) {
2975
2986
  if ("searchOptions" in changes) {
2976
2987
  const change = changes.searchOptions;
2977
- if (!change.isFirstChange() && change.currentValue !== change.previousValue) {
2988
+ if (!change.isFirstChange() && change.currentValue !== change.previousValue && this.autoReload) {
2978
2989
  this.service.search(this.resource, "", change.currentValue).then(() => this.checkIfValueStillExist());
2979
2990
  }
2980
2991
  }
@@ -3035,6 +3046,7 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
3035
3046
  this.service.setActive(event.option.value);
3036
3047
  this.value = this.bindValue ? this.getObjectItem(this.bindValue, event.option.value) : event.option.value;
3037
3048
  }
3049
+ this.selected.emit(this.value);
3038
3050
  }
3039
3051
  updateState(open) {
3040
3052
  this.open = open;
@@ -3100,11 +3112,17 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
3100
3112
  }
3101
3113
  }
3102
3114
  }
3115
+ async reload() {
3116
+ await this.service?.search(this.resource, this.searchControl.value ?? "", this.searchOptions);
3117
+ }
3103
3118
  async reloadActive() {
3104
3119
  await this.service?.reloadActive(this.resource, this.searchOptions);
3105
3120
  const active = this.service?.getActive();
3106
3121
  this.updateLabel(active);
3107
3122
  }
3123
+ setSearchOptions(options) {
3124
+ this.searchOptions = options;
3125
+ }
3108
3126
  updateLabel(item) {
3109
3127
  if (!item) {
3110
3128
  return;
@@ -3154,7 +3172,7 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
3154
3172
  }
3155
3173
  }
3156
3174
  NiceAsyncTypeaheadComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceAsyncTypeaheadComponent, deps: [{ token: i1$2.NgControl, optional: true, self: true }, { token: i1$2.NgForm, optional: true }, { token: i1$2.FormGroupDirective, optional: true }, { token: i2$1.ErrorStateMatcher }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: NiceAsyncTypeaheadService }], target: i0.ɵɵFactoryTarget.Component });
3157
- NiceAsyncTypeaheadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceAsyncTypeaheadComponent, selector: "nice-async-typeahead", inputs: { resource: "resource", searchOptions: "searchOptions", preloadResource: "preloadResource", allowNotFoundItems: "allowNotFoundItems", panelClass: "panelClass", bindValue: "bindValue", bindLabel: "bindLabel", placeholder: "placeholder", emptyPlaceholder: "emptyPlaceholder", optionTemplate: "optionTemplate", filterFn: "filterFn", labelFormatFn: "labelFormatFn", disabled: "disabled", value: "value", required: "required" }, outputs: { entityRemoved: "entityRemoved", selected: "selected" }, host: { properties: { "class.floating": "this.shouldLabelFloat", "id": "this.id", "attr.aria-describedby": "this.describedBy" } }, providers: [
3175
+ NiceAsyncTypeaheadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceAsyncTypeaheadComponent, selector: "nice-async-typeahead", inputs: { resource: "resource", searchOptions: "searchOptions", autoReload: "autoReload", preloadResource: "preloadResource", allowNotFoundItems: "allowNotFoundItems", panelClass: "panelClass", bindValue: "bindValue", bindLabel: "bindLabel", placeholder: "placeholder", emptyPlaceholder: "emptyPlaceholder", optionTemplate: "optionTemplate", filterFn: "filterFn", labelFormatFn: "labelFormatFn", disabled: "disabled", value: "value", required: "required" }, outputs: { entityRemoved: "entityRemoved", selected: "selected" }, host: { properties: { "class.floating": "this.shouldLabelFloat", "id": "this.id", "attr.aria-describedby": "this.describedBy" } }, providers: [
3158
3176
  {
3159
3177
  provide: MatFormFieldControl,
3160
3178
  useExisting: NiceAsyncTypeaheadComponent
@@ -3190,6 +3208,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
3190
3208
  type: Input
3191
3209
  }], searchOptions: [{
3192
3210
  type: Input
3211
+ }], autoReload: [{
3212
+ type: Input
3193
3213
  }], preloadResource: [{
3194
3214
  type: Input
3195
3215
  }], allowNotFoundItems: [{
@@ -10338,8 +10358,17 @@ class NiceChipListDirective {
10338
10358
  });
10339
10359
  }
10340
10360
  }
10361
+ ngOnDestroy() {
10362
+ this.unsubscribeAll$.next();
10363
+ this.unsubscribeAll$.complete();
10364
+ }
10341
10365
  writeValue(obj) {
10342
- this._values = obj ?? [];
10366
+ if (obj && Array.isArray(obj)) {
10367
+ this._values = obj;
10368
+ }
10369
+ else {
10370
+ this._values = [];
10371
+ }
10343
10372
  this.updateTypeaheadSearchOptions();
10344
10373
  this.values$.next(this._values);
10345
10374
  }
@@ -10385,7 +10414,7 @@ class NiceChipListDirective {
10385
10414
  });
10386
10415
  }
10387
10416
  }
10388
- NiceChipListDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceChipListDirective, deps: [{ token: NiceAsyncTypeaheadComponent, optional: true }, { token: i1$2.NgControl, optional: true }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
10417
+ NiceChipListDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceChipListDirective, deps: [{ token: NiceAsyncTypeaheadComponent, optional: true }, { token: i1$2.NgControl, optional: true, self: true }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
10389
10418
  NiceChipListDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.3", type: NiceChipListDirective, selector: "input[niceChipList], nice-async-typeahead[niceChipList]", inputs: { withItemList: "withItemList", reloadOnSelected: "reloadOnSelected", separatorKeyboardCodes: "separatorKeyboardCodes" }, host: { listeners: { "keydown": "onKeyDown($event)" } }, usesOnChanges: true, ngImport: i0 });
10390
10419
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceChipListDirective, decorators: [{
10391
10420
  type: Directive,
@@ -10396,6 +10425,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
10396
10425
  type: Optional
10397
10426
  }] }, { type: i1$2.NgControl, decorators: [{
10398
10427
  type: Optional
10428
+ }, {
10429
+ type: Self
10399
10430
  }] }, { type: i0.ElementRef }]; }, propDecorators: { withItemList: [{
10400
10431
  type: Input
10401
10432
  }], reloadOnSelected: [{
@@ -10788,6 +10819,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
10788
10819
  }]
10789
10820
  }] });
10790
10821
 
10822
+ // tslint:disable-next-line:directive-selector
10823
+ class RerenderDirective {
10824
+ constructor(templateRef, viewContainerRef) {
10825
+ this.templateRef = templateRef;
10826
+ this.viewContainerRef = viewContainerRef;
10827
+ }
10828
+ set rerender(_) {
10829
+ this.viewContainerRef.clear();
10830
+ this.viewContainerRef.createEmbeddedView(this.templateRef);
10831
+ }
10832
+ }
10833
+ RerenderDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: RerenderDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
10834
+ RerenderDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.3", type: RerenderDirective, isStandalone: true, selector: "[rerender]", inputs: { rerender: "rerender" }, ngImport: i0 });
10835
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: RerenderDirective, decorators: [{
10836
+ type: Directive,
10837
+ args: [{ selector: "[rerender]", standalone: true }]
10838
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { rerender: [{
10839
+ type: Input
10840
+ }] } });
10841
+
10842
+ class ResolveDirectiveContext {
10843
+ }
10844
+ // tslint:disable-next-line:directive-selector
10845
+ class ResolveDirective {
10846
+ constructor(templateRef, viewContainerRef) {
10847
+ this.templateRef = templateRef;
10848
+ this.viewContainerRef = viewContainerRef;
10849
+ this.context = new ResolveDirectiveContext();
10850
+ this.embeddedViewRef = null;
10851
+ }
10852
+ set resolve(value) {
10853
+ this.context.$implicit = this.context.resolve = value;
10854
+ if (!this.embeddedViewRef) {
10855
+ this.viewContainerRef.clear();
10856
+ this.embeddedViewRef = this.viewContainerRef.createEmbeddedView(this.templateRef, this.context);
10857
+ }
10858
+ }
10859
+ static ngTemplateContextGuard(directive, ctx) {
10860
+ return true;
10861
+ }
10862
+ }
10863
+ ResolveDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: ResolveDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
10864
+ ResolveDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.3", type: ResolveDirective, isStandalone: true, selector: "[resolve]", inputs: { resolve: "resolve" }, ngImport: i0 });
10865
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: ResolveDirective, decorators: [{
10866
+ type: Directive,
10867
+ args: [{ selector: "[resolve]", standalone: true }]
10868
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { resolve: [{
10869
+ type: Input
10870
+ }] } });
10871
+
10791
10872
  class NiceModule {
10792
10873
  /**
10793
10874
  * Constructor
@@ -10863,5 +10944,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
10863
10944
  * Generated bundle index. Do not edit.
10864
10945
  */
10865
10946
 
10866
- export { ArrayUtils, BooleanPipe, CapitalizeFirstLetterPipe, CarouselComponent, CaseUtils, CeilPipe, ChipListItemLabelDirective, ColorsUtils, DateUtils, DefaultExportBottomSheetService, EntriesPipe, ExportBottomSheetComponent, ExportBottomSheetService, FileUtils, FindByKeyPipe, FirstLetterPipe, FloorPipe, FontAwesomeUtils, FormDataUtils, HttpStatusCodes, ImgCropperConfig, ImgCropperError, ImgResolution, JoinPipe, KeyboardCodes, LexoRankUtils, LinkPipe, LocalizedBooleanPipe, LocalizedCurrencyPipe, LocalizedDateOnlyPipe, LocalizedDatePipe, MinutesToTimePipe, ModalMode, NICE_ASYNC_TYPEAHEAD_PROVIDER, NavigationHideItemResolver, NavigationHintResolver, NiceAlertComponent, NiceAlertModule, NiceAlertService, NiceApiException, NiceAssetsCarouselActiveContentDirective, NiceAssetsCarouselComponent, NiceAssetsCarouselModule, NiceAsyncTypeaheadComponent, NiceAsyncTypeaheadModule, NiceAsyncTypeaheadProvider, NiceAutofocusDirective, NiceAutofocusDirectiveModule, NiceAutogrowDirective, NiceAutogrowModule, NiceBaseForm, NiceBaseFormComponent, NiceBaseFormModule, NiceCardComponent, NiceCardModule, NiceCarouselModule, NiceChipAsyncTypeaheadDirective, NiceChipListDirective, NiceChipListDirectiveModule, NiceChipListItemsComponent, NiceClickStopPropagationDirective, NiceCollapsableComponent, NiceCollapsableModule, NiceConfigModule, NiceConfigService, NiceControlStatusDirective, NiceCropperAreaComponent, NiceDateRangePickerComponent, NiceDateRangePickerModule, NiceDraggableListDirective, NiceDraggableListModule, NiceDrawerComponent, NiceDrawerModule, NiceDrawerService, NiceDropzoneDirective, NiceDropzoneModule, NiceExportBottomSheetModule, NiceFormErrorComponent, NiceFormErrorModule, NiceFormSubmitDirective, NiceHorizontalNavigationBasicItemComponent, NiceHorizontalNavigationBranchItemComponent, NiceHorizontalNavigationComponent, NiceHorizontalNavigationDividerItemComponent, NiceHorizontalNavigationSpacerItemComponent, NiceHorizontalStepperComponent, NiceHorizontalStepperModule, NiceHttpExceptionFactory, NiceImageCropperComponent, NiceImageCropperModule, NiceImageErrorPlaceholderDirective, NiceImageErrorPlaceholderDirectiveModule, NiceLayoutComponent, NiceLayoutModule, NiceLoadingDirective, NiceLoadingSpinnerComponent, NiceLoadingSpinnerModule, NiceLottieComponent, NiceLottieModule, NiceMaterialModule, NiceMaterialStyleDirective, NiceMediaWatcherModule, NiceMediaWatcherService, NiceModalOnClickDirective, NiceModalOpenerDirective, NiceModule, NiceNavigationComponent, NiceNavigationModule, NiceNavigationService, NicePipesModule, NicePreventCloseWindowDirective, NiceRoundedStyleDirective, NiceScrollResetDirective, NiceScrollResetModule, NiceScrollbarDirective, NiceScrollbarModule, NiceSearchBarComponent, NiceSearchBarModule, NiceSplashScreenModule, NiceSplashScreenService, NiceStepComponent, NiceStopPropagationModule, NiceSweetAlertComponent, NiceSweetAlertDirective, NiceSweetAlertModule, NiceSweetAlertService, NiceToastComponent, NiceToastModule, NiceToastService, NiceToggleButtonGroupModule, NiceTransformResponseInterceptor, NiceTypeaheadComponent, NiceTypeaheadModule, NiceTypeaheadNewValue, NiceUtilsModule, NiceUtilsService, NiceVerticalNavigationAsideItemComponent, NiceVerticalNavigationBasicItemComponent, NiceVerticalNavigationCollapsableItemComponent, NiceVerticalNavigationComponent, NiceVerticalNavigationDividerItemComponent, NiceVerticalNavigationGroupItemComponent, NiceVerticalNavigationSpacerItemComponent, NiceWindowDirectiveModule, NumberToOrdinalIndicatorPipe, NumberUtils, ObjectUtils, OptionsScrollDirective, PadPipe, PhonePipe, PictureModalComponent, PictureModalService, PostalCodePipe, PromiseUtils, QueryParamsUtils, RangePipe, RegexUtils, RoundPipe, SanitizeBypassPipe, SecondsToTimePipe, TRANSFORM_TYPE, ToggleButtonComponent, ToggleButtonGroupComponent, TrackByPropPipe, TypeUtils, UrlUtils, _HintComponentBase, _normalizeDegrees, isNotNullOrUndefined, isNullOrUndefined, mergeDeep, mixinNiceApi, niceAnimations, round };
10947
+ export { ArrayUtils, BooleanPipe, CapitalizeFirstLetterPipe, CarouselComponent, CaseUtils, CeilPipe, ChipListItemLabelDirective, ColorsUtils, DateUtils, DefaultExportBottomSheetService, EntriesPipe, ExportBottomSheetComponent, ExportBottomSheetService, FileUtils, FindByKeyPipe, FirstLetterPipe, FloorPipe, FontAwesomeUtils, FormDataUtils, HttpStatusCodes, ImgCropperConfig, ImgCropperError, ImgResolution, JoinPipe, KeyboardCodes, LexoRankUtils, LinkPipe, LocalizedBooleanPipe, LocalizedCurrencyPipe, LocalizedDateOnlyPipe, LocalizedDatePipe, MinutesToTimePipe, ModalMode, NICE_ASYNC_TYPEAHEAD_PROVIDER, NavigationHideItemResolver, NavigationHintResolver, NiceAlertComponent, NiceAlertModule, NiceAlertService, NiceApiException, NiceAssetsCarouselActiveContentDirective, NiceAssetsCarouselComponent, NiceAssetsCarouselModule, NiceAsyncTypeaheadComponent, NiceAsyncTypeaheadModule, NiceAsyncTypeaheadProvider, NiceAutofocusDirective, NiceAutofocusDirectiveModule, NiceAutogrowDirective, NiceAutogrowModule, NiceBaseForm, NiceBaseFormComponent, NiceBaseFormModule, NiceCardComponent, NiceCardModule, NiceCarouselModule, NiceChipAsyncTypeaheadDirective, NiceChipListDirective, NiceChipListDirectiveModule, NiceChipListItemsComponent, NiceClickStopPropagationDirective, NiceCollapsableComponent, NiceCollapsableModule, NiceConfigModule, NiceConfigService, NiceControlStatusDirective, NiceCropperAreaComponent, NiceDateRangePickerComponent, NiceDateRangePickerModule, NiceDraggableListDirective, NiceDraggableListModule, NiceDrawerComponent, NiceDrawerModule, NiceDrawerService, NiceDropzoneDirective, NiceDropzoneModule, NiceExportBottomSheetModule, NiceFormErrorComponent, NiceFormErrorModule, NiceFormSubmitDirective, NiceHorizontalNavigationBasicItemComponent, NiceHorizontalNavigationBranchItemComponent, NiceHorizontalNavigationComponent, NiceHorizontalNavigationDividerItemComponent, NiceHorizontalNavigationSpacerItemComponent, NiceHorizontalStepperComponent, NiceHorizontalStepperModule, NiceHttpExceptionFactory, NiceImageCropperComponent, NiceImageCropperModule, NiceImageErrorPlaceholderDirective, NiceImageErrorPlaceholderDirectiveModule, NiceLayoutComponent, NiceLayoutModule, NiceLoadingDirective, NiceLoadingSpinnerComponent, NiceLoadingSpinnerModule, NiceLottieComponent, NiceLottieModule, NiceMaterialModule, NiceMaterialStyleDirective, NiceMediaWatcherModule, NiceMediaWatcherService, NiceModalOnClickDirective, NiceModalOpenerDirective, NiceModule, NiceNavigationComponent, NiceNavigationModule, NiceNavigationService, NicePipesModule, NicePreventCloseWindowDirective, NiceRoundedStyleDirective, NiceScrollResetDirective, NiceScrollResetModule, NiceScrollbarDirective, NiceScrollbarModule, NiceSearchBarComponent, NiceSearchBarModule, NiceSplashScreenModule, NiceSplashScreenService, NiceStepComponent, NiceStopPropagationModule, NiceSweetAlertComponent, NiceSweetAlertDirective, NiceSweetAlertModule, NiceSweetAlertService, NiceToastComponent, NiceToastModule, NiceToastService, NiceToggleButtonGroupModule, NiceTransformResponseInterceptor, NiceTypeaheadComponent, NiceTypeaheadModule, NiceTypeaheadNewValue, NiceUtilsModule, NiceUtilsService, NiceVerticalNavigationAsideItemComponent, NiceVerticalNavigationBasicItemComponent, NiceVerticalNavigationCollapsableItemComponent, NiceVerticalNavigationComponent, NiceVerticalNavigationDividerItemComponent, NiceVerticalNavigationGroupItemComponent, NiceVerticalNavigationSpacerItemComponent, NiceWindowDirectiveModule, NumberToOrdinalIndicatorPipe, NumberUtils, ObjectUtils, OptionsScrollDirective, PadPipe, PhonePipe, PictureModalComponent, PictureModalService, PostalCodePipe, PromiseUtils, QueryParamsUtils, RangePipe, RegexUtils, RerenderDirective, ResolveDirective, RoundPipe, SanitizeBypassPipe, SecondsToTimePipe, TRANSFORM_TYPE, ToggleButtonComponent, ToggleButtonGroupComponent, TrackByPropPipe, TypeUtils, UrlUtils, _HintComponentBase, _normalizeDegrees, isNotNullOrUndefined, isNullOrUndefined, mergeDeep, mixinNiceApi, niceAnimations, round };
10867
10948
  //# sourceMappingURL=recursyve-nice-ui-kit.v2.mjs.map