@vectoriox/iox-ui 4.12.0 → 4.14.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,57 @@ 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
+ const siblings = resolveSiblings(inputs.collection, getByPath(inputs.subject, idField), {
2611
+ idField, sortBy: spec.sortBy, sortDir: spec.sortDir, wrap: spec.wrap,
2612
+ });
2613
+ // `pick` resolves the source directly to that neighbour item (named-source shape,
2614
+ // e.g. `nextProject`); without it the caller binds a sub-path of the whole object.
2615
+ return spec.pick ? siblings[spec.pick] : siblings;
2616
+ }
2617
+ case 'related': {
2618
+ const filter = buildRelatedFilter(inputs.subject, { matchFields: spec.matchFields ?? [] });
2619
+ const pool = Array.isArray(inputs.collection) ? inputs.collection : [];
2620
+ const items = pool.filter(it => matchesFilter(it, filter));
2621
+ return spec.excludeSelf !== false ? excludeSelf(items, getByPath(inputs.subject, idField), idField) : items;
2622
+ }
2623
+ default:
2624
+ return null;
2625
+ }
2626
+ }
2595
2627
  /**
2596
2628
  * Compute every `type:'relative'` source into `resolved` (keyed by alias), IN PLACE. Pure w.r.t. HTTP
2597
2629
  * — 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`.
2630
+ * a second pass. Delegates each source to {@link computeRelative}. `current`'s subject is `from`;
2631
+ * `siblings`/`related` take `collection` = `from` and `subject` = `subjectFrom ?? from`. Mutates and
2632
+ * returns `resolved`.
2601
2633
  */
2602
2634
  function resolveRelativeInto(dataSources, resolved, routeParams = {}) {
2603
2635
  const relatives = (dataSources ?? [])
2604
2636
  .filter(d => d?.type === 'relative' && !!d.alias && !!d.request?.relative)
2605
2637
  .sort((a, b) => KIND_ORDER[a.request.relative.kind] - KIND_ORDER[b.request.relative.kind]);
2606
2638
  for (const d of relatives) {
2607
- const alias = d.alias;
2608
2639
  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
- }
2640
+ const subjectAlias = spec.kind === 'current' ? spec.from : (spec.subjectFrom ?? spec.from);
2641
+ resolved[d.alias] = computeRelative(spec, {
2642
+ subject: subjectAlias ? resolved[subjectAlias] : undefined,
2643
+ collection: spec.from ? resolved[spec.from] : undefined,
2644
+ routeParams,
2645
+ });
2638
2646
  }
2639
2647
  return resolved;
2640
2648
  }
@@ -3073,5 +3081,5 @@ function effectiveTransitionId(anim) {
3073
3081
  * Generated bundle index. Do not edit.
3074
3082
  */
3075
3083
 
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 };
3084
+ 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
3085
  //# sourceMappingURL=vectoriox-iox-ui.mjs.map