@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.
@@ -1840,7 +1840,10 @@ class NiceAssetsCarouselComponent {
1840
1840
  onFilesChange(event) {
1841
1841
  var _a;
1842
1842
  return __awaiter(this, void 0, void 0, function* () {
1843
- const files = (_a = event.target) === null || _a === void 0 ? void 0 : _a.files;
1843
+ let files = (_a = event.target) === null || _a === void 0 ? void 0 : _a.files;
1844
+ if (this.imagesProcessor) {
1845
+ files = yield this.getProcessedFiles(files);
1846
+ }
1844
1847
  yield this.onFilesDrop(files);
1845
1848
  this.inputElement.nativeElement.value = "";
1846
1849
  });
@@ -1899,9 +1902,17 @@ class NiceAssetsCarouselComponent {
1899
1902
  yield this._assetsElement.get(this._active).nativeElement.firstElementChild.play();
1900
1903
  });
1901
1904
  }
1905
+ getProcessedFiles(files) {
1906
+ return __awaiter(this, void 0, void 0, function* () {
1907
+ try {
1908
+ return yield this.imagesProcessor(files);
1909
+ }
1910
+ catch (e) { }
1911
+ });
1912
+ }
1902
1913
  }
1903
1914
  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 });
1904
- 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: [
1915
+ 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: [
1905
1916
  {
1906
1917
  provide: NG_VALUE_ACCESSOR,
1907
1918
  useExisting: forwardRef(() => NiceAssetsCarouselComponent),
@@ -1935,6 +1946,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
1935
1946
  type: Input
1936
1947
  }], customActions: [{
1937
1948
  type: Input
1949
+ }], imagesProcessor: [{
1950
+ type: Input
1938
1951
  }], multipleUpload: [{
1939
1952
  type: Input
1940
1953
  }], visiblePreviewAsset: [{
@@ -2742,6 +2755,11 @@ class NiceAsyncTypeaheadService {
2742
2755
  }
2743
2756
  try {
2744
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
+ }
2745
2763
  const entity = yield api.getById(id, options);
2746
2764
  if (!entity) {
2747
2765
  return;
@@ -2829,6 +2847,7 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
2829
2847
  this.panelWidth = 0;
2830
2848
  this.active$ = this.service.active$;
2831
2849
  this.entityRemoved = new EventEmitter();
2850
+ this.autoReload = true;
2832
2851
  this.preloadResource = false;
2833
2852
  this.allowNotFoundItems = false;
2834
2853
  this.panelClass = [];
@@ -2880,7 +2899,6 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
2880
2899
  this._value = value;
2881
2900
  this.propagate(value);
2882
2901
  this.stateChanges.next();
2883
- this.selected.emit(value);
2884
2902
  }
2885
2903
  }
2886
2904
  get value() {
@@ -2943,7 +2961,7 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
2943
2961
  ngOnChanges(changes) {
2944
2962
  if ("searchOptions" in changes) {
2945
2963
  const change = changes.searchOptions;
2946
- if (!change.isFirstChange() && change.currentValue !== change.previousValue) {
2964
+ if (!change.isFirstChange() && change.currentValue !== change.previousValue && this.autoReload) {
2947
2965
  this.service.search(this.resource, "", change.currentValue).then(() => this.checkIfValueStillExist());
2948
2966
  }
2949
2967
  }
@@ -3006,6 +3024,7 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
3006
3024
  this.service.setActive(event.option.value);
3007
3025
  this.value = this.bindValue ? this.getObjectItem(this.bindValue, event.option.value) : event.option.value;
3008
3026
  }
3027
+ this.selected.emit(this.value);
3009
3028
  }
3010
3029
  updateState(open) {
3011
3030
  this.open = open;
@@ -3072,6 +3091,12 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
3072
3091
  }
3073
3092
  }
3074
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
+ }
3075
3100
  reloadActive() {
3076
3101
  var _a, _b;
3077
3102
  return __awaiter(this, void 0, void 0, function* () {
@@ -3080,6 +3105,9 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
3080
3105
  this.updateLabel(active);
3081
3106
  });
3082
3107
  }
3108
+ setSearchOptions(options) {
3109
+ this.searchOptions = options;
3110
+ }
3083
3111
  updateLabel(item) {
3084
3112
  if (!item) {
3085
3113
  return;
@@ -3131,7 +3159,7 @@ class NiceAsyncTypeaheadComponent extends _BaseAsyncTypeaheadComponent {
3131
3159
  }
3132
3160
  }
3133
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 });
3134
- 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: [
3135
3163
  {
3136
3164
  provide: MatFormFieldControl,
3137
3165
  useExisting: NiceAsyncTypeaheadComponent
@@ -3169,6 +3197,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
3169
3197
  type: Input
3170
3198
  }], searchOptions: [{
3171
3199
  type: Input
3200
+ }], autoReload: [{
3201
+ type: Input
3172
3202
  }], preloadResource: [{
3173
3203
  type: Input
3174
3204
  }], allowNotFoundItems: [{