@maro-tech/form 0.0.2 → 0.0.3
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.
|
@@ -45,7 +45,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.19", ngImpo
|
|
|
45
45
|
class MaroFormsApiService {
|
|
46
46
|
http = inject(HttpClient);
|
|
47
47
|
getSuggestByName(name, query = '') {
|
|
48
|
-
const suffix = query ? `?
|
|
48
|
+
const suffix = query ? `?q=${encodeURIComponent(query)}` : '';
|
|
49
49
|
return this.http.get(`/api/suggest/${encodeURIComponent(name)}${suffix}`);
|
|
50
50
|
}
|
|
51
51
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: MaroFormsApiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -2447,9 +2447,6 @@ class UiDynamicFormComponent {
|
|
|
2447
2447
|
this.getSelectSearchStream(field, key).next(String(query ?? ''));
|
|
2448
2448
|
}
|
|
2449
2449
|
ensureOptionsSourceOptionsLoaded(model) {
|
|
2450
|
-
if (!this.optionsSourceResolvers.length) {
|
|
2451
|
-
return;
|
|
2452
|
-
}
|
|
2453
2450
|
const sourceKeys = [...new Set(this.getLeafFields()
|
|
2454
2451
|
.filter((field) => (field.type ?? 'text') === 'select' && !!field.optionsSource)
|
|
2455
2452
|
.map((field) => String(field.optionsSource || '').trim())
|
|
@@ -2469,7 +2466,9 @@ class UiDynamicFormComponent {
|
|
|
2469
2466
|
const version = (this.optionsSourceRequestVersions.get(sourceKey) || 0) + 1;
|
|
2470
2467
|
this.optionsSourceRequestVersions.set(sourceKey, version);
|
|
2471
2468
|
forkJoin(sourceFields.map((field) => {
|
|
2472
|
-
const resolved = resolver
|
|
2469
|
+
const resolved = resolver
|
|
2470
|
+
? resolver.resolve({ source: sourceKey, field, model })
|
|
2471
|
+
: this.formsApi.getSuggestByName(sourceKey);
|
|
2473
2472
|
return resolved instanceof Observable ? resolved : from(Promise.resolve(resolved));
|
|
2474
2473
|
})).subscribe({
|
|
2475
2474
|
next: (results) => {
|
|
@@ -2481,7 +2480,7 @@ class UiDynamicFormComponent {
|
|
|
2481
2480
|
.map((item) => ({
|
|
2482
2481
|
label: String(item?.label ?? ''),
|
|
2483
2482
|
value: item?.value == null ? null : String(item.value),
|
|
2484
|
-
disabled: item?.disabled,
|
|
2483
|
+
disabled: typeof item?.disabled === 'boolean' ? item.disabled : undefined,
|
|
2485
2484
|
imageUrl: item?.imageUrl ? String(item.imageUrl) : undefined,
|
|
2486
2485
|
}))
|
|
2487
2486
|
.filter((item) => !!item.label || item.value !== null);
|