@vectoriox/iox-builder 2.2.2 → 2.3.1
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.
|
@@ -17,7 +17,7 @@ import { SelectModule } from 'primeng/select';
|
|
|
17
17
|
import { TooltipModule } from 'primeng/tooltip';
|
|
18
18
|
import { DialogModule } from 'primeng/dialog';
|
|
19
19
|
import * as i16 from '@vectoriox/iox-ui';
|
|
20
|
-
import { ComponentInstanceRegistryService, DEFAULT_WIDTH_BY_TYPE, compileDeclarations, composeVirtualTraits, IS_PREVIEW, planDataSource, dataSourcePlanToRequest, normalizeCollectionResult, resolveRepeaterItems, IoxPageModule } from '@vectoriox/iox-ui';
|
|
20
|
+
import { ComponentInstanceRegistryService, DEFAULT_WIDTH_BY_TYPE, compileDeclarations, composeVirtualTraits, IS_PREVIEW, planDataSource, dataSourcePlanToRequest, normalizeCollectionResult, resolveRepeaterItems, getByPath, IoxPageModule } from '@vectoriox/iox-ui';
|
|
21
21
|
export { ComponentInstanceRegistryService, VIRTUAL_TRAIT_KEYS, composeVirtualTraits } from '@vectoriox/iox-ui';
|
|
22
22
|
import Lenis from 'lenis';
|
|
23
23
|
import { Subject, BehaviorSubject, of } from 'rxjs';
|
|
@@ -1894,6 +1894,9 @@ var DataSourceType;
|
|
|
1894
1894
|
DataSourceType["ExternalApi"] = "external-api";
|
|
1895
1895
|
DataSourceType["InternalApi"] = "internal-api";
|
|
1896
1896
|
DataSourceType["Static"] = "static";
|
|
1897
|
+
/** A VIEW into another variable: `{ from: <alias>, path }` (e.g. galleryImages = product.gallery).
|
|
1898
|
+
* Resolves to the value one (or more) level(s) into a parent variable — page-scoped. */
|
|
1899
|
+
DataSourceType["Derived"] = "derived";
|
|
1897
1900
|
})(DataSourceType || (DataSourceType = {}));
|
|
1898
1901
|
/**
|
|
1899
1902
|
* Maps each action type to its logical inverse for auto-populating toggle
|
|
@@ -5571,6 +5574,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
|
|
|
5571
5574
|
* Examples: 'title', 'author.name', 'tags[0]', 'items[2].title'
|
|
5572
5575
|
*/
|
|
5573
5576
|
function resolvePath(obj, path) {
|
|
5577
|
+
// Empty path (or `$`) means "the value itself" — used to bind to an item that IS a primitive
|
|
5578
|
+
// (e.g. a Repeater over `gallery: string[]`, where each item is the URL string). See
|
|
5579
|
+
// binding-panel-redesign-plan.md.
|
|
5580
|
+
if (path === '' || path === '$' || path == null)
|
|
5581
|
+
return obj;
|
|
5574
5582
|
return path.split('.').reduce((current, key) => {
|
|
5575
5583
|
if (current == null)
|
|
5576
5584
|
return undefined;
|
|
@@ -5688,6 +5696,27 @@ class BuilderDataSourceService {
|
|
|
5688
5696
|
fetchRepeaterItems(ds, sourcePath) {
|
|
5689
5697
|
return this.fetch(ds).pipe(map(value => resolveRepeaterItems(value, sourcePath)));
|
|
5690
5698
|
}
|
|
5699
|
+
/**
|
|
5700
|
+
* Resolve a data source BY ALIAS, following `derived` aliases (a VIEW into another variable:
|
|
5701
|
+
* resolve the parent, then getByPath). `findByAlias` is injected so this module stays registry-free
|
|
5702
|
+
* (the caller passes its own page-scoped registry). Recurses for chained derived aliases.
|
|
5703
|
+
*/
|
|
5704
|
+
fetchByAlias(alias, findByAlias) {
|
|
5705
|
+
const ds = findByAlias(alias);
|
|
5706
|
+
if (!ds)
|
|
5707
|
+
return of(null);
|
|
5708
|
+
if (ds.type === 'derived') {
|
|
5709
|
+
const d = ds.request?.derived;
|
|
5710
|
+
if (!d?.from)
|
|
5711
|
+
return of(null);
|
|
5712
|
+
return this.fetchByAlias(d.from, findByAlias).pipe(map(parent => getByPath(parent, d.path ?? '')));
|
|
5713
|
+
}
|
|
5714
|
+
return this.fetch(ds);
|
|
5715
|
+
}
|
|
5716
|
+
/** Repeater items for an alias (follows derived aliases + applies an optional sourcePath). */
|
|
5717
|
+
fetchRepeaterItemsByAlias(alias, findByAlias, sourcePath) {
|
|
5718
|
+
return this.fetchByAlias(alias, findByAlias).pipe(map(value => resolveRepeaterItems(value, sourcePath)));
|
|
5719
|
+
}
|
|
5691
5720
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BuilderDataSourceService, deps: [{ token: i1.HttpClient }, { token: IOX_DATA_SOURCE_ENDPOINTS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
5692
5721
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BuilderDataSourceService }); }
|
|
5693
5722
|
}
|
|
@@ -5830,9 +5859,9 @@ class BuilderRepeaterComponent {
|
|
|
5830
5859
|
return;
|
|
5831
5860
|
this.isLoading = true;
|
|
5832
5861
|
this.cdr.markForCheck();
|
|
5833
|
-
//
|
|
5834
|
-
//
|
|
5835
|
-
this.dataSourceService.
|
|
5862
|
+
// Resolve BY ALIAS so `derived` sources (e.g. galleryImages = product.gallery) follow their
|
|
5863
|
+
// parent. `sourcePath` (legacy/back-compat) still repeats over an array property inline.
|
|
5864
|
+
this.dataSourceService.fetchRepeaterItemsByAlias(this._source, (a) => this.dsRegistry.findByAlias(a), this._sourcePath).subscribe(items => {
|
|
5836
5865
|
this.items = items.slice(0, this._limit);
|
|
5837
5866
|
this.refreshPreviews();
|
|
5838
5867
|
this.isLoading = false;
|
|
@@ -7895,17 +7924,6 @@ class RepeaterComponentConfig extends ComponentConfig {
|
|
|
7895
7924
|
options: [], // populated at runtime from DataSourceRegistryService aliases
|
|
7896
7925
|
default: '',
|
|
7897
7926
|
},
|
|
7898
|
-
{
|
|
7899
|
-
// Repeat over an ARRAY PROPERTY inside a SINGLE resource (e.g. product → `gallery`).
|
|
7900
|
-
// Empty for list/query sources (the source itself is the array). The Bindings panel
|
|
7901
|
-
// populates the options from the resource schema's array fields when the source is a
|
|
7902
|
-
// single resource. See repeater-nested-array-plan.md.
|
|
7903
|
-
name: 'sourcePath',
|
|
7904
|
-
label: 'Repeat over property',
|
|
7905
|
-
type: TraitInputType.Select,
|
|
7906
|
-
options: [], // populated at runtime from the single source's array schema fields
|
|
7907
|
-
default: '',
|
|
7908
|
-
},
|
|
7909
7927
|
{
|
|
7910
7928
|
name: 'limit',
|
|
7911
7929
|
label: 'Limit',
|