@vectoriox/iox-ui 4.12.0 → 4.13.0

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.
@@ -2592,49 +2592,53 @@ const KIND_ORDER = { route: 0, current: 1, siblings: 2, related: 3 };
2592
2592
  function matchesFilter(item, filter) {
2593
2593
  return Object.keys(filter).every(k => String(getByPath(item, k)) === String(filter[k]));
2594
2594
  }
2595
+ /**
2596
+ * Compute ONE relative source's value from its already-resolved {@link RelativeInputs} — the SHARED
2597
+ * kind→computation decision, so the batch pass ({@link resolveRelativeInto}) and the builder's async
2598
+ * per-alias resolver produce identical results with no forked switch. `route` → the route params;
2599
+ * `current` → the subject; `siblings` → {@link resolveSiblings} over the collection; `related` → the
2600
+ * collection filtered by {@link buildRelatedFilter}'s predicate (+ {@link excludeSelf}).
2601
+ */
2602
+ function computeRelative(spec, inputs) {
2603
+ const idField = spec.idField ?? '_id';
2604
+ switch (spec.kind) {
2605
+ case 'route':
2606
+ return inputs.routeParams ?? {};
2607
+ case 'current':
2608
+ return inputs.subject ?? null;
2609
+ case 'siblings':
2610
+ return resolveSiblings(inputs.collection, getByPath(inputs.subject, idField), {
2611
+ idField, sortBy: spec.sortBy, sortDir: spec.sortDir, wrap: spec.wrap,
2612
+ });
2613
+ case 'related': {
2614
+ const filter = buildRelatedFilter(inputs.subject, { matchFields: spec.matchFields ?? [] });
2615
+ const pool = Array.isArray(inputs.collection) ? inputs.collection : [];
2616
+ const items = pool.filter(it => matchesFilter(it, filter));
2617
+ return spec.excludeSelf !== false ? excludeSelf(items, getByPath(inputs.subject, idField), idField) : items;
2618
+ }
2619
+ default:
2620
+ return null;
2621
+ }
2622
+ }
2595
2623
  /**
2596
2624
  * Compute every `type:'relative'` source into `resolved` (keyed by alias), IN PLACE. Pure w.r.t. HTTP
2597
2625
  * — it only reads already-resolved roots + the route params, so both consumers run it identically as
2598
- * a second pass. `route` the route params; `current` → the subject source value; `siblings` →
2599
- * {@link resolveSiblings} over the collection; `related` the collection filtered client-side by
2600
- * {@link buildRelatedFilter}'s predicate (+ {@link excludeSelf}). Mutates and returns `resolved`.
2626
+ * a second pass. Delegates each source to {@link computeRelative}. `current`'s subject is `from`;
2627
+ * `siblings`/`related` take `collection` = `from` and `subject` = `subjectFrom ?? from`. Mutates and
2628
+ * returns `resolved`.
2601
2629
  */
2602
2630
  function resolveRelativeInto(dataSources, resolved, routeParams = {}) {
2603
2631
  const relatives = (dataSources ?? [])
2604
2632
  .filter(d => d?.type === 'relative' && !!d.alias && !!d.request?.relative)
2605
2633
  .sort((a, b) => KIND_ORDER[a.request.relative.kind] - KIND_ORDER[b.request.relative.kind]);
2606
2634
  for (const d of relatives) {
2607
- const alias = d.alias;
2608
2635
  const spec = d.request.relative;
2609
- const idField = spec.idField ?? '_id';
2610
- switch (spec.kind) {
2611
- case 'route':
2612
- resolved[alias] = routeParams;
2613
- break;
2614
- case 'current':
2615
- resolved[alias] = spec.from ? (resolved[spec.from] ?? null) : null;
2616
- break;
2617
- case 'siblings': {
2618
- const collection = resolved[spec.from ?? ''];
2619
- const subject = resolved[spec.subjectFrom ?? spec.from ?? ''];
2620
- const currentId = getByPath(subject, idField);
2621
- resolved[alias] = resolveSiblings(collection, currentId, {
2622
- idField, sortBy: spec.sortBy, sortDir: spec.sortDir, wrap: spec.wrap,
2623
- });
2624
- break;
2625
- }
2626
- case 'related': {
2627
- const collection = resolved[spec.from ?? ''];
2628
- const subject = resolved[spec.subjectFrom ?? spec.from ?? ''];
2629
- const filter = buildRelatedFilter(subject, { matchFields: spec.matchFields ?? [] });
2630
- const pool = Array.isArray(collection) ? collection : [];
2631
- let items = pool.filter(it => matchesFilter(it, filter));
2632
- if (spec.excludeSelf !== false)
2633
- items = excludeSelf(items, getByPath(subject, idField), idField);
2634
- resolved[alias] = items;
2635
- break;
2636
- }
2637
- }
2636
+ const subjectAlias = spec.kind === 'current' ? spec.from : (spec.subjectFrom ?? spec.from);
2637
+ resolved[d.alias] = computeRelative(spec, {
2638
+ subject: subjectAlias ? resolved[subjectAlias] : undefined,
2639
+ collection: spec.from ? resolved[spec.from] : undefined,
2640
+ routeParams,
2641
+ });
2638
2642
  }
2639
2643
  return resolved;
2640
2644
  }
@@ -3073,5 +3077,5 @@ function effectiveTransitionId(anim) {
3073
3077
  * Generated bundle index. Do not edit.
3074
3078
  */
3075
3079
 
3076
- export { AOSService, AnalyticsService, BuilderButtonComponent, BuilderDividerComponent, BuilderHeadingComponent, BuilderIconComponent, BuilderImageComponent, BuilderLinkComponent, BuilderSpacerComponent, ButtonBlockComponent, CMSClientInfraModule, CardComponent, ClientListComponent, ClientListItemComponent, ClientRepeaterComponent, ClientSliderContainerComponent, ClientSliderSlideComponent, ComponentInstanceRegistryService, ConsentService, ContainerComponent, ContentService, DEFAULT_PAGE_TRANSITION, DEFAULT_PAGE_TRANSITION_DURATION, DEFAULT_PAGE_TRANSITION_EASING, DEFAULT_PAGE_TRANSITION_PERSPECTIVE, DEFAULT_WIDTH_BY_TYPE, ENVIRONMENT, IOX_BUILDER_EVENTS, IS_PREVIEW, IoxAnimateContainer, IoxAosDirective, IoxAosModule, IoxBuilderComponentsModule, IoxComponentRegistryService, IoxPageComponent, IoxPageModule, IoxUiModule, LinkedContainerComponent, PAGE_TRANSITION_CATEGORIES, PAGE_TRANSITION_PRESETS, PageScrollProvider, PrivacyModalComponent, PrivacyModalService, PrivacyModelEvent, RESERVED_ALIAS_PREFIX, SUPPRESSED_STYLE_PROPS_BY_TYPE, SectionComponent, TRANSITION_FEELS, TextBlockComponent, VIRTUAL_TRAIT_KEYS, ViewPositionDirective, ViewPositionModule, WebSettingsService, applyFeel, buildDataSourceFilter, buildRelatedFilter, buildTransitionTimeline, collectReferencedAliases, compileDeclarations, composeVirtualTraits, dataSourcePlanToRequest, effectiveTransitionId, excludeSelf, feelFor, getByPath, isReservedAlias, legacyEnterToTransition, matchRouteParams, normalizeCollectionResult, planDataSource, referencedDataSources, referencedDataSourcesDeep, renderDefaultDeclarations, resolveDerivedInto, resolvePageTransition, resolveRelativeInto, resolveRepeaterItems, resolveSiblings, resolveSingleItemId, rewriteViewportUnits, stripSuppressedProps, styleKeyToKebab };
3080
+ export { AOSService, AnalyticsService, BuilderButtonComponent, BuilderDividerComponent, BuilderHeadingComponent, BuilderIconComponent, BuilderImageComponent, BuilderLinkComponent, BuilderSpacerComponent, ButtonBlockComponent, CMSClientInfraModule, CardComponent, ClientListComponent, ClientListItemComponent, ClientRepeaterComponent, ClientSliderContainerComponent, ClientSliderSlideComponent, ComponentInstanceRegistryService, ConsentService, ContainerComponent, ContentService, DEFAULT_PAGE_TRANSITION, DEFAULT_PAGE_TRANSITION_DURATION, DEFAULT_PAGE_TRANSITION_EASING, DEFAULT_PAGE_TRANSITION_PERSPECTIVE, DEFAULT_WIDTH_BY_TYPE, ENVIRONMENT, IOX_BUILDER_EVENTS, IS_PREVIEW, IoxAnimateContainer, IoxAosDirective, IoxAosModule, IoxBuilderComponentsModule, IoxComponentRegistryService, IoxPageComponent, IoxPageModule, IoxUiModule, LinkedContainerComponent, PAGE_TRANSITION_CATEGORIES, PAGE_TRANSITION_PRESETS, PageScrollProvider, PrivacyModalComponent, PrivacyModalService, PrivacyModelEvent, RESERVED_ALIAS_PREFIX, SUPPRESSED_STYLE_PROPS_BY_TYPE, SectionComponent, TRANSITION_FEELS, TextBlockComponent, VIRTUAL_TRAIT_KEYS, ViewPositionDirective, ViewPositionModule, WebSettingsService, applyFeel, buildDataSourceFilter, buildRelatedFilter, buildTransitionTimeline, collectReferencedAliases, compileDeclarations, composeVirtualTraits, computeRelative, dataSourcePlanToRequest, effectiveTransitionId, excludeSelf, feelFor, getByPath, isReservedAlias, legacyEnterToTransition, matchRouteParams, normalizeCollectionResult, planDataSource, referencedDataSources, referencedDataSourcesDeep, renderDefaultDeclarations, resolveDerivedInto, resolvePageTransition, resolveRelativeInto, resolveRepeaterItems, resolveSiblings, resolveSingleItemId, rewriteViewportUnits, stripSuppressedProps, styleKeyToKebab };
3077
3081
  //# sourceMappingURL=vectoriox-iox-ui.mjs.map