@recursyve/nice-ui-kit.v2 14.0.0-beta.112 → 14.0.0-beta.114

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.
@@ -1841,7 +1841,10 @@ class NiceAssetsCarouselComponent {
1841
1841
  this.activeAsset = index;
1842
1842
  }
1843
1843
  async onFilesChange(event) {
1844
- const files = event.target?.files;
1844
+ let files = event.target?.files;
1845
+ if (this.imagesProcessor) {
1846
+ files = await this.getProcessedFiles(files);
1847
+ }
1845
1848
  await this.onFilesDrop(files);
1846
1849
  this.inputElement.nativeElement.value = "";
1847
1850
  }
@@ -1893,9 +1896,15 @@ class NiceAssetsCarouselComponent {
1893
1896
  await this._activeVideoElement.nativeElement.play();
1894
1897
  await this._assetsElement.get(this._active).nativeElement.firstElementChild.play();
1895
1898
  }
1899
+ async getProcessedFiles(files) {
1900
+ try {
1901
+ return await this.imagesProcessor(files);
1902
+ }
1903
+ catch (e) { }
1904
+ }
1896
1905
  }
1897
1906
  NiceAssetsCarouselComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceAssetsCarouselComponent, deps: [{ token: NICE_ASSETS_CAROUSEL_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1898
- NiceAssetsCarouselComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceAssetsCarouselComponent, selector: "nice-assets-carousel", inputs: { color: "color", edit: "edit", accept: "accept", customActions: "customActions", multipleUpload: "multipleUpload", visiblePreviewAsset: "visiblePreviewAsset", showAddAssetContainer: "showAddAssetContainer", assets: "assets" }, outputs: { activeChange: "activeChange", removedAsset: "removedAsset" }, providers: [
1907
+ NiceAssetsCarouselComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceAssetsCarouselComponent, selector: "nice-assets-carousel", inputs: { color: "color", edit: "edit", accept: "accept", customActions: "customActions", imagesProcessor: "imagesProcessor", multipleUpload: "multipleUpload", visiblePreviewAsset: "visiblePreviewAsset", showAddAssetContainer: "showAddAssetContainer", assets: "assets" }, outputs: { activeChange: "activeChange", removedAsset: "removedAsset" }, providers: [
1899
1908
  {
1900
1909
  provide: NG_VALUE_ACCESSOR,
1901
1910
  useExisting: forwardRef(() => NiceAssetsCarouselComponent),
@@ -1927,6 +1936,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
1927
1936
  type: Input
1928
1937
  }], customActions: [{
1929
1938
  type: Input
1939
+ }], imagesProcessor: [{
1940
+ type: Input
1930
1941
  }], multipleUpload: [{
1931
1942
  type: Input
1932
1943
  }], visiblePreviewAsset: [{
@@ -2756,6 +2767,17 @@ class NiceAsyncTypeaheadService {
2756
2767
  ...this.state$.value,
2757
2768
  loading: true
2758
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
+ }
2759
2781
  const entity = await api.getById(id, options);
2760
2782
  if (!entity) {
2761
2783
  return;
@@ -2850,6 +2872,7 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
2850
2872
  this.panelWidth = 0;
2851
2873
  this.active$ = this.service.active$;
2852
2874
  this.entityRemoved = new EventEmitter();
2875
+ this.autoReload = true;
2853
2876
  this.preloadResource = false;
2854
2877
  this.allowNotFoundItems = false;
2855
2878
  this.panelClass = [];
@@ -2901,7 +2924,6 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
2901
2924
  this._value = value;
2902
2925
  this.propagate(value);
2903
2926
  this.stateChanges.next();
2904
- this.selected.emit(value);
2905
2927
  }
2906
2928
  }
2907
2929
  get value() {
@@ -2963,7 +2985,7 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
2963
2985
  ngOnChanges(changes) {
2964
2986
  if ("searchOptions" in changes) {
2965
2987
  const change = changes.searchOptions;
2966
- if (!change.isFirstChange() && change.currentValue !== change.previousValue) {
2988
+ if (!change.isFirstChange() && change.currentValue !== change.previousValue && this.autoReload) {
2967
2989
  this.service.search(this.resource, "", change.currentValue).then(() => this.checkIfValueStillExist());
2968
2990
  }
2969
2991
  }
@@ -3024,6 +3046,7 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
3024
3046
  this.service.setActive(event.option.value);
3025
3047
  this.value = this.bindValue ? this.getObjectItem(this.bindValue, event.option.value) : event.option.value;
3026
3048
  }
3049
+ this.selected.emit(this.value);
3027
3050
  }
3028
3051
  updateState(open) {
3029
3052
  this.open = open;
@@ -3089,11 +3112,17 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
3089
3112
  }
3090
3113
  }
3091
3114
  }
3115
+ async reload() {
3116
+ await this.service?.search(this.resource, this.searchControl.value ?? "", this.searchOptions);
3117
+ }
3092
3118
  async reloadActive() {
3093
3119
  await this.service?.reloadActive(this.resource, this.searchOptions);
3094
3120
  const active = this.service?.getActive();
3095
3121
  this.updateLabel(active);
3096
3122
  }
3123
+ setSearchOptions(options) {
3124
+ this.searchOptions = options;
3125
+ }
3097
3126
  updateLabel(item) {
3098
3127
  if (!item) {
3099
3128
  return;
@@ -3143,7 +3172,7 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
3143
3172
  }
3144
3173
  }
3145
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 });
3146
- 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: [
3147
3176
  {
3148
3177
  provide: MatFormFieldControl,
3149
3178
  useExisting: NiceAsyncTypeaheadComponent
@@ -3179,6 +3208,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
3179
3208
  type: Input
3180
3209
  }], searchOptions: [{
3181
3210
  type: Input
3211
+ }], autoReload: [{
3212
+ type: Input
3182
3213
  }], preloadResource: [{
3183
3214
  type: Input
3184
3215
  }], allowNotFoundItems: [{