@recursyve/nice-ui-kit.v2 14.0.0-beta.113 → 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.
- package/esm2020/lib/components/async-typeahead/async-typeahead.component.mjs +13 -4
- package/esm2020/lib/components/async-typeahead/providers/async-typeahead.service.mjs +12 -1
- package/fesm2015/recursyve-nice-ui-kit.v2.mjs +20 -3
- package/fesm2015/recursyve-nice-ui-kit.v2.mjs.map +1 -1
- package/fesm2020/recursyve-nice-ui-kit.v2.mjs +23 -3
- package/fesm2020/recursyve-nice-ui-kit.v2.mjs.map +1 -1
- package/lib/components/async-typeahead/async-typeahead.component.d.ts +4 -1
- package/package.json +1 -1
|
@@ -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: [{
|