@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.
@@ -2755,6 +2755,11 @@ class NiceAsyncTypeaheadService {
2755
2755
  }
2756
2756
  try {
2757
2757
  this.state$.next(Object.assign(Object.assign({}, this.state$.value), { loading: true }));
2758
+ const localItem = this.state$.value.items.find((item) => item.id === id);
2759
+ if (localItem) {
2760
+ this.state$.next(Object.assign(Object.assign({}, this.state$.value), { items: [localItem], active: localItem, page: 0, isLastPage: false }));
2761
+ return;
2762
+ }
2758
2763
  const entity = yield api.getById(id, options);
2759
2764
  if (!entity) {
2760
2765
  return;
@@ -2842,6 +2847,7 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
2842
2847
  this.panelWidth = 0;
2843
2848
  this.active$ = this.service.active$;
2844
2849
  this.entityRemoved = new EventEmitter();
2850
+ this.autoReload = true;
2845
2851
  this.preloadResource = false;
2846
2852
  this.allowNotFoundItems = false;
2847
2853
  this.panelClass = [];
@@ -2893,7 +2899,6 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
2893
2899
  this._value = value;
2894
2900
  this.propagate(value);
2895
2901
  this.stateChanges.next();
2896
- this.selected.emit(value);
2897
2902
  }
2898
2903
  }
2899
2904
  get value() {
@@ -2956,7 +2961,7 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
2956
2961
  ngOnChanges(changes) {
2957
2962
  if ("searchOptions" in changes) {
2958
2963
  const change = changes.searchOptions;
2959
- if (!change.isFirstChange() && change.currentValue !== change.previousValue) {
2964
+ if (!change.isFirstChange() && change.currentValue !== change.previousValue && this.autoReload) {
2960
2965
  this.service.search(this.resource, "", change.currentValue).then(() => this.checkIfValueStillExist());
2961
2966
  }
2962
2967
  }
@@ -3019,6 +3024,7 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
3019
3024
  this.service.setActive(event.option.value);
3020
3025
  this.value = this.bindValue ? this.getObjectItem(this.bindValue, event.option.value) : event.option.value;
3021
3026
  }
3027
+ this.selected.emit(this.value);
3022
3028
  }
3023
3029
  updateState(open) {
3024
3030
  this.open = open;
@@ -3085,6 +3091,12 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
3085
3091
  }
3086
3092
  }
3087
3093
  }
3094
+ reload() {
3095
+ var _a, _b;
3096
+ return __awaiter(this, void 0, void 0, function* () {
3097
+ yield ((_a = this.service) === null || _a === void 0 ? void 0 : _a.search(this.resource, (_b = this.searchControl.value) !== null && _b !== void 0 ? _b : "", this.searchOptions));
3098
+ });
3099
+ }
3088
3100
  reloadActive() {
3089
3101
  var _a, _b;
3090
3102
  return __awaiter(this, void 0, void 0, function* () {
@@ -3093,6 +3105,9 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
3093
3105
  this.updateLabel(active);
3094
3106
  });
3095
3107
  }
3108
+ setSearchOptions(options) {
3109
+ this.searchOptions = options;
3110
+ }
3096
3111
  updateLabel(item) {
3097
3112
  if (!item) {
3098
3113
  return;
@@ -3144,7 +3159,7 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
3144
3159
  }
3145
3160
  }
3146
3161
  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 });
3147
- 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: [
3162
+ 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: [
3148
3163
  {
3149
3164
  provide: MatFormFieldControl,
3150
3165
  useExisting: NiceAsyncTypeaheadComponent
@@ -3182,6 +3197,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
3182
3197
  type: Input
3183
3198
  }], searchOptions: [{
3184
3199
  type: Input
3200
+ }], autoReload: [{
3201
+ type: Input
3185
3202
  }], preloadResource: [{
3186
3203
  type: Input
3187
3204
  }], allowNotFoundItems: [{
@@ -10358,8 +10375,17 @@ class NiceChipListDirective {
10358
10375
  });
10359
10376
  }
10360
10377
  }
10378
+ ngOnDestroy() {
10379
+ this.unsubscribeAll$.next();
10380
+ this.unsubscribeAll$.complete();
10381
+ }
10361
10382
  writeValue(obj) {
10362
- this._values = obj !== null && obj !== void 0 ? obj : [];
10383
+ if (obj && Array.isArray(obj)) {
10384
+ this._values = obj;
10385
+ }
10386
+ else {
10387
+ this._values = [];
10388
+ }
10363
10389
  this.updateTypeaheadSearchOptions();
10364
10390
  this.values$.next(this._values);
10365
10391
  }
@@ -10408,7 +10434,7 @@ class NiceChipListDirective {
10408
10434
  });
10409
10435
  }
10410
10436
  }
10411
- 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 });
10437
+ 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 });
10412
10438
  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 });
10413
10439
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceChipListDirective, decorators: [{
10414
10440
  type: Directive,
@@ -10420,6 +10446,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
10420
10446
  type: Optional
10421
10447
  }] }, { type: i1$2.NgControl, decorators: [{
10422
10448
  type: Optional
10449
+ }, {
10450
+ type: Self
10423
10451
  }] }, { type: i0.ElementRef }];
10424
10452
  }, propDecorators: { withItemList: [{
10425
10453
  type: Input
@@ -10813,6 +10841,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
10813
10841
  }]
10814
10842
  }] });
10815
10843
 
10844
+ // tslint:disable-next-line:directive-selector
10845
+ class RerenderDirective {
10846
+ constructor(templateRef, viewContainerRef) {
10847
+ this.templateRef = templateRef;
10848
+ this.viewContainerRef = viewContainerRef;
10849
+ }
10850
+ set rerender(_) {
10851
+ this.viewContainerRef.clear();
10852
+ this.viewContainerRef.createEmbeddedView(this.templateRef);
10853
+ }
10854
+ }
10855
+ 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 });
10856
+ RerenderDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.3", type: RerenderDirective, isStandalone: true, selector: "[rerender]", inputs: { rerender: "rerender" }, ngImport: i0 });
10857
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: RerenderDirective, decorators: [{
10858
+ type: Directive,
10859
+ args: [{ selector: "[rerender]", standalone: true }]
10860
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { rerender: [{
10861
+ type: Input
10862
+ }] } });
10863
+
10864
+ class ResolveDirectiveContext {
10865
+ }
10866
+ // tslint:disable-next-line:directive-selector
10867
+ class ResolveDirective {
10868
+ constructor(templateRef, viewContainerRef) {
10869
+ this.templateRef = templateRef;
10870
+ this.viewContainerRef = viewContainerRef;
10871
+ this.context = new ResolveDirectiveContext();
10872
+ this.embeddedViewRef = null;
10873
+ }
10874
+ set resolve(value) {
10875
+ this.context.$implicit = this.context.resolve = value;
10876
+ if (!this.embeddedViewRef) {
10877
+ this.viewContainerRef.clear();
10878
+ this.embeddedViewRef = this.viewContainerRef.createEmbeddedView(this.templateRef, this.context);
10879
+ }
10880
+ }
10881
+ static ngTemplateContextGuard(directive, ctx) {
10882
+ return true;
10883
+ }
10884
+ }
10885
+ 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 });
10886
+ ResolveDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.3", type: ResolveDirective, isStandalone: true, selector: "[resolve]", inputs: { resolve: "resolve" }, ngImport: i0 });
10887
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: ResolveDirective, decorators: [{
10888
+ type: Directive,
10889
+ args: [{ selector: "[resolve]", standalone: true }]
10890
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { resolve: [{
10891
+ type: Input
10892
+ }] } });
10893
+
10816
10894
  class NiceModule {
10817
10895
  /**
10818
10896
  * Constructor
@@ -10890,5 +10968,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
10890
10968
  * Generated bundle index. Do not edit.
10891
10969
  */
10892
10970
 
10893
- 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 };
10971
+ 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 };
10894
10972
  //# sourceMappingURL=recursyve-nice-ui-kit.v2.mjs.map