@sinequa/atomic-angular 1.0.10 → 1.0.11
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/fesm2022/sinequa-atomic-angular.mjs +125 -49
- package/fesm2022/sinequa-atomic-angular.mjs.map +1 -1
- package/index.d.ts +212 -179
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, inject, HostBinding, Component, Pipe, InjectionToken, computed, ChangeDetectorRef, DestroyRef, LOCALE_ID, Inject, Optional, input, output, signal, effect, assertInInjectionContext, runInInjectionContext, Injector, EventEmitter, Directive, viewChild, ElementRef, afterNextRender, untracked, linkedSignal, model, TemplateRef, HostListener, Renderer2, contentChildren, contentChild, booleanAttribute, ChangeDetectionStrategy, resource, ViewContainerRef, viewChildren, numberAttribute, afterEveryRender } from '@angular/core';
|
|
2
|
+
import { Injectable, inject, HostBinding, Component, Pipe, InjectionToken, computed, ChangeDetectorRef, DestroyRef, LOCALE_ID, Inject, Optional, input, output, signal, effect, assertInInjectionContext, runInInjectionContext, Injector, EventEmitter, Directive, viewChild, ElementRef, afterNextRender, untracked, linkedSignal, model, TemplateRef, HostListener, Renderer2, contentChildren, contentChild, booleanAttribute, ChangeDetectionStrategy, resource, ViewContainerRef, viewChildren, numberAttribute, afterRenderEffect, afterEveryRender } from '@angular/core';
|
|
3
3
|
import { BehaviorSubject, Subscription, catchError, EMPTY, firstValueFrom, map, Subject, of, tap, throwError, filter, shareReplay, fromEvent, debounceTime, from, switchMap } from 'rxjs';
|
|
4
4
|
import { TranslocoService, TranslocoPipe, provideTranslocoScope } from '@jsverse/transloco';
|
|
5
5
|
import { DropdownComponent, DropdownContentComponent, InputComponent, ButtonComponent, cn, FaIconComponent, EllipsisIcon, ChevronRightIcon, MenuComponent, MenuContentComponent, MenuItemComponent, BadgeComponent, DialogComponent, DialogHeaderComponent, DialogTitleComponent, DialogContentComponent, DialogFooterComponent, ListItemComponent, SwitchComponent, SelectOptionDirective, DialogService, TabsComponent, TabsListComponent, TabComponent, ChevronLeftIconComponent, ChevronsLeftIconComponent, ChevronsRightIconComponent, Separator, SheetCloseDirective, SheetService, DateRangePickerDirective, DatepickerDirective, ButtonGroup, InputGroupInput, InputGroupComponent, InputGroupAddonComponent, SearchIcon, FilterIcon, LoadingCircleIconComponent, CircleCheckIconComponent, PopoverComponent, CardComponent, CardHeaderComponent, CardContentComponent, CardFooterComponent, BookmarkIcon, PopoverContentComponent, UserIcon, TrashIcon, FolderIcon, VerticalDividerComponent, BreakpointObserverService, HorizontalDividerComponent, FlagEnglishIconComponent, FlagFrenchIconComponent, EditIcon, UndoIcon, AvatarComponent, AvatarFallbackComponent, AvatarImageComponent } from '@sinequa/ui';
|
|
@@ -6925,8 +6925,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
|
|
|
6925
6925
|
}]
|
|
6926
6926
|
}] });
|
|
6927
6927
|
/**
|
|
6928
|
-
* Directive to be used on the
|
|
6929
|
-
*
|
|
6928
|
+
* Directive to be used on the "more" trigger element. The overflow manager
|
|
6929
|
+
* reserves this element's size when not all items fit, so the last visible
|
|
6930
|
+
* item never overlaps it. Its position is not used for measurement.
|
|
6930
6931
|
*/
|
|
6931
6932
|
class OverflowStopDirective {
|
|
6932
6933
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: OverflowStopDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
@@ -6940,10 +6941,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
|
|
|
6940
6941
|
}]
|
|
6941
6942
|
}] });
|
|
6942
6943
|
/**
|
|
6943
|
-
* Directive that
|
|
6944
|
-
*
|
|
6945
|
-
*
|
|
6946
|
-
*
|
|
6944
|
+
* Directive that counts how many items fit inside the container and hides the
|
|
6945
|
+
* overflowing ones. The boundary is the container's own content edge, which
|
|
6946
|
+
* keeps the measurement correct even when the host lives inside a flex layout
|
|
6947
|
+
* (we never depend on a sibling's position). The stop element is used only to
|
|
6948
|
+
* reserve space for the "more" trigger when not all items fit.
|
|
6949
|
+
*
|
|
6950
|
+
* The directive applies `display: none` on the items that do not fit.
|
|
6947
6951
|
*
|
|
6948
6952
|
* You can specify a target element to observe for resize events, otherwise the
|
|
6949
6953
|
* directive will observe the element itself.
|
|
@@ -6982,10 +6986,26 @@ class OverflowManagerDirective {
|
|
|
6982
6986
|
target = input(...(ngDevMode ? [undefined, { debugName: "target" }] : []));
|
|
6983
6987
|
margin = input(4, ...(ngDevMode ? [{ debugName: "margin" }] : []));
|
|
6984
6988
|
direction = input("horizontal", ...(ngDevMode ? [{ debugName: "direction" }] : []));
|
|
6989
|
+
/**
|
|
6990
|
+
* Always reserve the stop element's size, even when every item fits inside
|
|
6991
|
+
* the container. Use it when the stop trigger is permanently visible (e.g.
|
|
6992
|
+
* the "more" button also gives access to items that are never rendered in
|
|
6993
|
+
* the container), so the last item never overlaps it.
|
|
6994
|
+
*/
|
|
6995
|
+
reserveStop = input(false, ...(ngDevMode ? [{ debugName: "reserveStop", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
6985
6996
|
count = output();
|
|
6986
6997
|
el = inject(ElementRef).nativeElement;
|
|
6987
6998
|
destroyRef = inject(DestroyRef);
|
|
6988
6999
|
resizeObserver = new ResizeObserver(() => this.countItems());
|
|
7000
|
+
// Recompute when an individual item's size changes (label update, async
|
|
7001
|
+
// translation, font load…), not only when the container resizes. Items we
|
|
7002
|
+
// hid with `display: none` report a 0×0 size; ignore those notifications so
|
|
7003
|
+
// our own show/hide toggling doesn't trigger redundant recounts.
|
|
7004
|
+
itemsResizeObserver = new ResizeObserver((entries) => {
|
|
7005
|
+
const visibleItemResized = entries.some((entry) => entry.target.style.display !== "none");
|
|
7006
|
+
if (visibleItemResized)
|
|
7007
|
+
this.countItems();
|
|
7008
|
+
});
|
|
6989
7009
|
countSub;
|
|
6990
7010
|
_lastCount;
|
|
6991
7011
|
constructor() {
|
|
@@ -6997,21 +7017,37 @@ class OverflowManagerDirective {
|
|
|
6997
7017
|
this.countItems();
|
|
6998
7018
|
}
|
|
6999
7019
|
});
|
|
7020
|
+
// (re)observe every item whenever the projected list changes, so that
|
|
7021
|
+
// added/removed items and per-item size changes both trigger a recount
|
|
7022
|
+
effect(() => {
|
|
7023
|
+
const items = this.items();
|
|
7024
|
+
this.itemsResizeObserver.disconnect();
|
|
7025
|
+
items.forEach((item) => this.itemsResizeObserver.observe(item.nativeElement));
|
|
7026
|
+
});
|
|
7000
7027
|
// listens to the count output and toggles the visibility of the items
|
|
7001
7028
|
this.countSub = this.count.subscribe((count) => this.toggleToCount(count));
|
|
7002
7029
|
this.destroyRef.onDestroy(() => {
|
|
7003
7030
|
this.resizeObserver.disconnect();
|
|
7031
|
+
this.itemsResizeObserver.disconnect();
|
|
7004
7032
|
this.countSub?.unsubscribe();
|
|
7005
7033
|
this.countSub = undefined;
|
|
7006
7034
|
});
|
|
7007
7035
|
}
|
|
7008
7036
|
/**
|
|
7009
|
-
* Counts the number of items that can fit
|
|
7037
|
+
* Counts the number of items that can fit inside the container.
|
|
7038
|
+
*
|
|
7039
|
+
* The boundary is the container's own content edge (not the position of the
|
|
7040
|
+
* stop element). This is what makes the measurement robust when the host is
|
|
7041
|
+
* placed inside a flex layout: we never rely on a sibling staying where we
|
|
7042
|
+
* expect it. The stop element is only used for its *size*, to reserve space
|
|
7043
|
+
* for the "more" trigger when not all items fit.
|
|
7044
|
+
*
|
|
7010
7045
|
* Emits the count if it has changed.
|
|
7011
7046
|
*/
|
|
7012
7047
|
countItems() {
|
|
7013
7048
|
if (!this.items() || this.items().length === 0 || !this.stop())
|
|
7014
7049
|
return;
|
|
7050
|
+
const horizontal = this.direction() === "horizontal";
|
|
7015
7051
|
// Reset all items to their natural size before measuring so that previously
|
|
7016
7052
|
// hidden items (display: none) don't corrupt the layout and position of
|
|
7017
7053
|
// their siblings.
|
|
@@ -7019,19 +7055,33 @@ class OverflowManagerDirective {
|
|
|
7019
7055
|
item.nativeElement.style.display = "";
|
|
7020
7056
|
});
|
|
7021
7057
|
// getBoundingClientRect() forces a synchronous reflow, so positions are
|
|
7022
|
-
// accurate after the reset above.
|
|
7058
|
+
// accurate after the reset above. Using rects (not offsetWidth) means the
|
|
7059
|
+
// inter-item gap is accounted for automatically.
|
|
7060
|
+
const containerRect = this.el.getBoundingClientRect();
|
|
7023
7061
|
const stopRect = this.stop().nativeElement.getBoundingClientRect();
|
|
7024
7062
|
const itemsRects = this.items().map((item) => item.nativeElement.getBoundingClientRect());
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
7030
|
-
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7063
|
+
// The container's content edge, with a small slack margin.
|
|
7064
|
+
const containerEnd = (horizontal ? containerRect.right : containerRect.bottom) - this.margin();
|
|
7065
|
+
const itemEnd = (rect) => (horizontal ? rect.right : rect.bottom);
|
|
7066
|
+
let count;
|
|
7067
|
+
// If every item fits within the container, no "more" trigger is needed and
|
|
7068
|
+
// we don't reserve any space for it — unless the trigger is permanently
|
|
7069
|
+
// visible (reserveStop), in which case its space is always reserved.
|
|
7070
|
+
if (!this.reserveStop() && itemEnd(itemsRects[itemsRects.length - 1]) <= containerEnd) {
|
|
7071
|
+
count = itemsRects.length;
|
|
7072
|
+
}
|
|
7073
|
+
else {
|
|
7074
|
+
// Otherwise reserve the stop element's own size so the last visible item
|
|
7075
|
+
// never overlaps the "more" trigger.
|
|
7076
|
+
const reserve = horizontal ? stopRect.width : stopRect.height;
|
|
7077
|
+
const limit = containerEnd - reserve;
|
|
7078
|
+
count = 0;
|
|
7079
|
+
for (const rect of itemsRects) {
|
|
7080
|
+
if (itemEnd(rect) <= limit)
|
|
7081
|
+
count++;
|
|
7082
|
+
else
|
|
7083
|
+
break;
|
|
7084
|
+
}
|
|
7035
7085
|
}
|
|
7036
7086
|
if (this._lastCount !== count) {
|
|
7037
7087
|
this._lastCount = count;
|
|
@@ -7054,7 +7104,7 @@ class OverflowManagerDirective {
|
|
|
7054
7104
|
});
|
|
7055
7105
|
}
|
|
7056
7106
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: OverflowManagerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
7057
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.3.18", type: OverflowManagerDirective, isStandalone: true, selector: "[overflowManager]", inputs: { target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: false, transformFunction: null }, margin: { classPropertyName: "margin", publicName: "margin", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { count: "count" }, queries: [{ propertyName: "items", predicate: OverflowItemDirective, descendants: true, read: ElementRef, isSignal: true }, { propertyName: "stop", first: true, predicate: OverflowStopDirective, descendants: true, read: ElementRef, isSignal: true }], ngImport: i0 });
|
|
7107
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.3.18", type: OverflowManagerDirective, isStandalone: true, selector: "[overflowManager]", inputs: { target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: false, transformFunction: null }, margin: { classPropertyName: "margin", publicName: "margin", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, reserveStop: { classPropertyName: "reserveStop", publicName: "reserveStop", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { count: "count" }, queries: [{ propertyName: "items", predicate: OverflowItemDirective, descendants: true, read: ElementRef, isSignal: true }, { propertyName: "stop", first: true, predicate: OverflowStopDirective, descendants: true, read: ElementRef, isSignal: true }], ngImport: i0 });
|
|
7058
7108
|
}
|
|
7059
7109
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: OverflowManagerDirective, decorators: [{
|
|
7060
7110
|
type: Directive,
|
|
@@ -7062,7 +7112,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
|
|
|
7062
7112
|
selector: "[overflowManager]",
|
|
7063
7113
|
standalone: true
|
|
7064
7114
|
}]
|
|
7065
|
-
}], ctorParameters: () => [], propDecorators: { items: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => OverflowItemDirective), { ...{ descendants: true, read: ElementRef }, isSignal: true }] }], stop: [{ type: i0.ContentChild, args: [i0.forwardRef(() => OverflowStopDirective), { ...{ descendants: true, read: ElementRef }, isSignal: true }] }], target: [{ type: i0.Input, args: [{ isSignal: true, alias: "target", required: false }] }], margin: [{ type: i0.Input, args: [{ isSignal: true, alias: "margin", required: false }] }], direction: [{ type: i0.Input, args: [{ isSignal: true, alias: "direction", required: false }] }], count: [{ type: i0.Output, args: ["count"] }] } });
|
|
7115
|
+
}], ctorParameters: () => [], propDecorators: { items: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => OverflowItemDirective), { ...{ descendants: true, read: ElementRef }, isSignal: true }] }], stop: [{ type: i0.ContentChild, args: [i0.forwardRef(() => OverflowStopDirective), { ...{ descendants: true, read: ElementRef }, isSignal: true }] }], target: [{ type: i0.Input, args: [{ isSignal: true, alias: "target", required: false }] }], margin: [{ type: i0.Input, args: [{ isSignal: true, alias: "margin", required: false }] }], direction: [{ type: i0.Input, args: [{ isSignal: true, alias: "direction", required: false }] }], reserveStop: [{ type: i0.Input, args: [{ isSignal: true, alias: "reserveStop", required: false }] }], count: [{ type: i0.Output, args: ["count"] }] } });
|
|
7066
7116
|
|
|
7067
7117
|
/**
|
|
7068
7118
|
* Directive that selects an article on click.
|
|
@@ -7299,7 +7349,7 @@ class NavbarTabsComponent {
|
|
|
7299
7349
|
</Menu>
|
|
7300
7350
|
</div>
|
|
7301
7351
|
}
|
|
7302
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: ButtonComponent, selector: "button", inputs: ["class", "variant", "decoration", "scheme", "iconOnly", "size"] }, { kind: "component", type: MenuComponent, selector: "menu, Menu", inputs: ["disabled"] }, { kind: "directive", type: MenuItemComponent, selector: "menu-item, menuitem, MenuItem", inputs: ["class", "variant", "decoration"] }, { kind: "directive", type: MenuContentComponent, selector: "MenuContent, menucontent, menu-content", inputs: ["class", "position"] }, { kind: "directive", type: TabsComponent, selector: "tabs, Tabs", inputs: ["class"] }, { kind: "directive", type: TabsListComponent, selector: "tabs-list, TabsList", inputs: ["class", "variant", "size"] }, { kind: "directive", type: TabComponent, selector: "tab, Tab", inputs: ["class", "variant", "size", "noTruncate", "value", "active"], outputs: ["clicked"] }, { kind: "directive", type: OverflowManagerDirective, selector: "[overflowManager]", inputs: ["target", "margin", "direction"], outputs: ["count"] }, { kind: "directive", type: OverflowItemDirective, selector: "[overflowItem]" }, { kind: "directive", type: OverflowStopDirective, selector: "[overflowStop]" }, { kind: "directive", type: BadgeComponent, selector: "badge, Badge", inputs: ["class", "variant", "size"] }, { kind: "component", type: EllipsisIcon, selector: "ellipsis-icon, EllipsisIcon, ellipsisicon", inputs: ["class", "orientation"] }, { kind: "component", type: FaIconComponent, selector: "fa-icon, FaIcon", inputs: ["faClass"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }, { kind: "pipe", type: SyslangPipe, name: "syslang" }] });
|
|
7352
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: ButtonComponent, selector: "button", inputs: ["class", "variant", "decoration", "scheme", "iconOnly", "size"] }, { kind: "component", type: MenuComponent, selector: "menu, Menu", inputs: ["disabled"] }, { kind: "directive", type: MenuItemComponent, selector: "menu-item, menuitem, MenuItem", inputs: ["class", "variant", "decoration"] }, { kind: "directive", type: MenuContentComponent, selector: "MenuContent, menucontent, menu-content", inputs: ["class", "position"] }, { kind: "directive", type: TabsComponent, selector: "tabs, Tabs", inputs: ["class"] }, { kind: "directive", type: TabsListComponent, selector: "tabs-list, TabsList", inputs: ["class", "variant", "size"] }, { kind: "directive", type: TabComponent, selector: "tab, Tab", inputs: ["class", "variant", "size", "noTruncate", "value", "active"], outputs: ["clicked"] }, { kind: "directive", type: OverflowManagerDirective, selector: "[overflowManager]", inputs: ["target", "margin", "direction", "reserveStop"], outputs: ["count"] }, { kind: "directive", type: OverflowItemDirective, selector: "[overflowItem]" }, { kind: "directive", type: OverflowStopDirective, selector: "[overflowStop]" }, { kind: "directive", type: BadgeComponent, selector: "badge, Badge", inputs: ["class", "variant", "size"] }, { kind: "component", type: EllipsisIcon, selector: "ellipsis-icon, EllipsisIcon, ellipsisicon", inputs: ["class", "orientation"] }, { kind: "component", type: FaIconComponent, selector: "fa-icon, FaIcon", inputs: ["faClass"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }, { kind: "pipe", type: SyslangPipe, name: "syslang" }] });
|
|
7303
7353
|
}
|
|
7304
7354
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: NavbarTabsComponent, decorators: [{
|
|
7305
7355
|
type: Component,
|
|
@@ -14610,50 +14660,76 @@ class FiltersBarComponent {
|
|
|
14610
14660
|
return this.aggregationsStore.aggregations().length > 0;
|
|
14611
14661
|
return false;
|
|
14612
14662
|
}, ...(ngDevMode ? [{ debugName: "hasAggregations" }] : []));
|
|
14663
|
+
/**
|
|
14664
|
+
* The full list of authorized filters, NOT capped by `filtersCount`.
|
|
14665
|
+
*
|
|
14666
|
+
* This computed signal performs the following operations:
|
|
14667
|
+
* 1. Retrieves aggregations from either the component's aggregations input or the app store
|
|
14668
|
+
* 2. Filters aggregations based on the route's filter criteria configuration
|
|
14669
|
+
* 3. Excludes filters specified in the `excludeFilters` list
|
|
14670
|
+
* 4. If `includeFilters` is not empty, only includes filters present in that list
|
|
14671
|
+
* 5. Maps the filtered aggregations to objects containing only `name` and `column` properties
|
|
14672
|
+
*/
|
|
14673
|
+
allAuthorizedFilters = computed(() => {
|
|
14674
|
+
return this.aggregationsService
|
|
14675
|
+
.getAuthorizedFilters(this.aggregations(), this.includeFilters(), this.excludeFilters(), this.homepage())
|
|
14676
|
+
.map((f) => ({ name: f.name, column: f.column }));
|
|
14677
|
+
}, ...(ngDevMode ? [{ debugName: "allAuthorizedFilters" }] : []));
|
|
14613
14678
|
/**
|
|
14614
14679
|
* Computes the list of additional filters that can be displayed in the "more filters" popover.
|
|
14615
14680
|
*
|
|
14616
|
-
*
|
|
14617
|
-
*
|
|
14618
|
-
*
|
|
14681
|
+
* Derived from the FULL authorized list (not the one capped by `filtersCount`), so the
|
|
14682
|
+
* filters beyond `filtersCount` — which are never rendered in the bar — are still counted.
|
|
14683
|
+
* Otherwise, when every rendered filter fits in the container, this list would be empty and
|
|
14684
|
+
* the "more" button would be hidden even though more filters exist beyond the cap.
|
|
14619
14685
|
*
|
|
14620
|
-
* This property manages the visibility
|
|
14686
|
+
* This property manages the visibility of the "more filters" button in the UI.
|
|
14621
14687
|
*
|
|
14622
14688
|
* @returns An array of Aggregation objects representing the additional filters available.
|
|
14623
14689
|
*/
|
|
14624
14690
|
hasMoreFilters = computed(() => {
|
|
14625
|
-
const moreFiltersAggregations = this.
|
|
14626
|
-
.filter((f) => !this.excludeFilters().includes(f.name)) // filter out the excluded filters
|
|
14627
|
-
.filter((f) => !this.includeFilters().length || this.includeFilters().includes(f.name)) // exclude filters not included in includeFilters if not empty
|
|
14628
|
-
.map((f) => ({ column: f.column, name: f.name }))
|
|
14691
|
+
const moreFiltersAggregations = this.allAuthorizedFilters()
|
|
14629
14692
|
.toSpliced(0, this.visibleFiltersCount())
|
|
14630
14693
|
.map((f) => this.aggregationsStore.getAggregation(f.column, "column"));
|
|
14631
14694
|
return moreFiltersAggregations;
|
|
14632
14695
|
}, ...(ngDevMode ? [{ debugName: "hasMoreFilters" }] : []));
|
|
14633
14696
|
/**
|
|
14634
|
-
*
|
|
14635
|
-
*
|
|
14636
|
-
* This computed signal performs the following operations:
|
|
14637
|
-
* 1. Retrieves aggregations from either the component's aggregations input or the app store
|
|
14638
|
-
* 2. Filters aggregations based on the route's filter criteria configuration
|
|
14639
|
-
* 3. Excludes filters specified in the `excludeFilters` list
|
|
14640
|
-
* 4. If `includeFilters` is not empty, only includes filters present in that list
|
|
14641
|
-
* 5. Maps the filtered aggregations to objects containing only `name` and `column` properties
|
|
14642
|
-
* 6. Limits the result to the number specified by `filtersCount`
|
|
14697
|
+
* The authorized filters rendered as buttons in the bar, limited to the number
|
|
14698
|
+
* specified by `filtersCount`.
|
|
14643
14699
|
*
|
|
14644
14700
|
* @returns An array of authorized filter objects, each containing `name` and `column` properties
|
|
14645
14701
|
*/
|
|
14646
14702
|
authorizedFilters = computed(() => {
|
|
14647
|
-
|
|
14648
|
-
.getAuthorizedFilters(this.aggregations(), this.includeFilters(), this.excludeFilters(), this.homepage())
|
|
14649
|
-
.map((f) => ({ name: f.name, column: f.column }))
|
|
14650
|
-
.toSpliced(this.filtersCount());
|
|
14651
|
-
return authorizedFilters;
|
|
14703
|
+
return this.allAuthorizedFilters().toSpliced(this.filtersCount());
|
|
14652
14704
|
}, ...(ngDevMode ? [{ debugName: "authorizedFilters" }] : []));
|
|
14705
|
+
/**
|
|
14706
|
+
* Whether some authorized filters exist beyond the `filtersCount` cap.
|
|
14707
|
+
*
|
|
14708
|
+
* Those filters are never rendered in the bar and are only reachable through
|
|
14709
|
+
* the "more" button, which is therefore permanently visible: the overflow
|
|
14710
|
+
* manager must always reserve its space so the last filter button never
|
|
14711
|
+
* overlaps it (`reserveStop`).
|
|
14712
|
+
*/
|
|
14713
|
+
hasCappedFilters = computed(() => this.allAuthorizedFilters().length > this.filtersCount(), ...(ngDevMode ? [{ debugName: "hasCappedFilters" }] : []));
|
|
14653
14714
|
constructor() {
|
|
14654
14715
|
this.transloco.events$
|
|
14655
14716
|
.pipe(takeUntilDestroyed(this.destroyRef), debounceTime(100))
|
|
14656
14717
|
.subscribe(() => this.overflowManagerRef()?.countItems());
|
|
14718
|
+
// Recount the overflow whenever the applied filters or basket change (e.g.
|
|
14719
|
+
// a filter modified or removed from the "more filters" popover). A
|
|
14720
|
+
// FilterButton hidden by the overflow manager (display: none) emits no
|
|
14721
|
+
// resize notification when its natural width changes, so it could fit in
|
|
14722
|
+
// the bar again without the manager knowing. afterRenderEffect guarantees
|
|
14723
|
+
// the DOM already reflects the new state when we measure.
|
|
14724
|
+
afterRenderEffect({
|
|
14725
|
+
read: () => {
|
|
14726
|
+
// track filters and basket changes (getState is reactive here)
|
|
14727
|
+
const { filters, basket } = getState(this.queryParamsStore);
|
|
14728
|
+
void filters;
|
|
14729
|
+
void basket;
|
|
14730
|
+
this.overflowManagerRef()?.countItems();
|
|
14731
|
+
}
|
|
14732
|
+
});
|
|
14657
14733
|
}
|
|
14658
14734
|
/**
|
|
14659
14735
|
* Clears all filters (included baskets) by invoking the clearFilters method on the queryParamsStore.
|
|
@@ -14702,8 +14778,8 @@ class FiltersBarComponent {
|
|
|
14702
14778
|
});
|
|
14703
14779
|
}
|
|
14704
14780
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: FiltersBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
14705
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: FiltersBarComponent, isStandalone: true, selector: "filters-bar, FiltersBar, filtersbar", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, morePosition: { classPropertyName: "morePosition", publicName: "morePosition", isSignal: true, isRequired: false, transformFunction: null }, aggregations: { classPropertyName: "aggregations", publicName: "aggregations", isSignal: true, isRequired: false, transformFunction: null }, includeFilters: { classPropertyName: "includeFilters", publicName: "includeFilters", isSignal: true, isRequired: false, transformFunction: null }, excludeFilters: { classPropertyName: "excludeFilters", publicName: "excludeFilters", isSignal: true, isRequired: false, transformFunction: null }, filtersCount: { classPropertyName: "filtersCount", publicName: "filtersCount", isSignal: true, isRequired: false, transformFunction: null }, showMoreFiltersButton: { classPropertyName: "showMoreFiltersButton", publicName: "showMoreFiltersButton", isSignal: true, isRequired: false, transformFunction: null }, homepage: { classPropertyName: "homepage", publicName: "homepage", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null }, expandedLevel: { classPropertyName: "expandedLevel", publicName: "expandedLevel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onClearFilters: "onClearFilters", onClearBasket: "onClearBasket" }, host: { listeners: { "click": "handleClick($event)" }, properties: { "class": "cn('block relative', class())" } }, providers: [provideTranslocoScope("filters")], viewQueries: [{ propertyName: "moreButtonRef", first: true, predicate: MoreButtonComponent, descendants: true, isSignal: true }, { propertyName: "filterButtonRefs", predicate: FilterButtonComponent, descendants: true, isSignal: true }, { propertyName: "overflowManagerRef", first: true, predicate: OverflowManagerDirective, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
14706
|
-
<div overflowManager [direction]="direction()" (count)="adjustFiltersCount($event)" class="flex items-end gap-2 rounded-[inherit] bg-inherit">
|
|
14781
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: FiltersBarComponent, isStandalone: true, selector: "filters-bar, FiltersBar, filtersbar", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, morePosition: { classPropertyName: "morePosition", publicName: "morePosition", isSignal: true, isRequired: false, transformFunction: null }, aggregations: { classPropertyName: "aggregations", publicName: "aggregations", isSignal: true, isRequired: false, transformFunction: null }, includeFilters: { classPropertyName: "includeFilters", publicName: "includeFilters", isSignal: true, isRequired: false, transformFunction: null }, excludeFilters: { classPropertyName: "excludeFilters", publicName: "excludeFilters", isSignal: true, isRequired: false, transformFunction: null }, filtersCount: { classPropertyName: "filtersCount", publicName: "filtersCount", isSignal: true, isRequired: false, transformFunction: null }, showMoreFiltersButton: { classPropertyName: "showMoreFiltersButton", publicName: "showMoreFiltersButton", isSignal: true, isRequired: false, transformFunction: null }, homepage: { classPropertyName: "homepage", publicName: "homepage", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null }, expandedLevel: { classPropertyName: "expandedLevel", publicName: "expandedLevel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onClearFilters: "onClearFilters", onClearBasket: "onClearBasket" }, host: { listeners: { "click": "handleClick($event)" }, properties: { "class": "cn('block relative min-w-0', class())" } }, providers: [provideTranslocoScope("filters")], viewQueries: [{ propertyName: "moreButtonRef", first: true, predicate: MoreButtonComponent, descendants: true, isSignal: true }, { propertyName: "filterButtonRefs", predicate: FilterButtonComponent, descendants: true, isSignal: true }, { propertyName: "overflowManagerRef", first: true, predicate: OverflowManagerDirective, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
14782
|
+
<div overflowManager [direction]="direction()" [reserveStop]="hasCappedFilters()" (count)="adjustFiltersCount($event)" class="flex items-end gap-2 rounded-[inherit] bg-inherit">
|
|
14707
14783
|
@if (hasFilters()) {
|
|
14708
14784
|
<button
|
|
14709
14785
|
variant="destructive"
|
|
@@ -14755,7 +14831,7 @@ class FiltersBarComponent {
|
|
|
14755
14831
|
}
|
|
14756
14832
|
}
|
|
14757
14833
|
</div>
|
|
14758
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: ButtonComponent, selector: "button", inputs: ["class", "variant", "decoration", "scheme", "iconOnly", "size"] }, { kind: "component", type: MoreButtonComponent, selector: "more-button, MoreButton", inputs: ["count", "position", "includedFilters", "excludedFilters", "aggregations", "homepage"] }, { kind: "component", type: FilterButtonComponent, selector: "filter-button, FilterButton", inputs: ["name", "column", "position", "offset", "expandedLevel"] }, { kind: "directive", type: OverflowManagerDirective, selector: "[overflowManager]", inputs: ["target", "margin", "direction"], outputs: ["count"] }, { kind: "directive", type: OverflowItemDirective, selector: "[overflowItem]" }, { kind: "directive", type: OverflowStopDirective, selector: "[overflowStop]" }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }] });
|
|
14834
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: ButtonComponent, selector: "button", inputs: ["class", "variant", "decoration", "scheme", "iconOnly", "size"] }, { kind: "component", type: MoreButtonComponent, selector: "more-button, MoreButton", inputs: ["count", "position", "includedFilters", "excludedFilters", "aggregations", "homepage"] }, { kind: "component", type: FilterButtonComponent, selector: "filter-button, FilterButton", inputs: ["name", "column", "position", "offset", "expandedLevel"] }, { kind: "directive", type: OverflowManagerDirective, selector: "[overflowManager]", inputs: ["target", "margin", "direction", "reserveStop"], outputs: ["count"] }, { kind: "directive", type: OverflowItemDirective, selector: "[overflowItem]" }, { kind: "directive", type: OverflowStopDirective, selector: "[overflowStop]" }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }] });
|
|
14759
14835
|
}
|
|
14760
14836
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: FiltersBarComponent, decorators: [{
|
|
14761
14837
|
type: Component,
|
|
@@ -14773,7 +14849,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
|
|
|
14773
14849
|
],
|
|
14774
14850
|
providers: [provideTranslocoScope("filters")],
|
|
14775
14851
|
template: `
|
|
14776
|
-
<div overflowManager [direction]="direction()" (count)="adjustFiltersCount($event)" class="flex items-end gap-2 rounded-[inherit] bg-inherit">
|
|
14852
|
+
<div overflowManager [direction]="direction()" [reserveStop]="hasCappedFilters()" (count)="adjustFiltersCount($event)" class="flex items-end gap-2 rounded-[inherit] bg-inherit">
|
|
14777
14853
|
@if (hasFilters()) {
|
|
14778
14854
|
<button
|
|
14779
14855
|
variant="destructive"
|
|
@@ -14827,7 +14903,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
|
|
|
14827
14903
|
</div>
|
|
14828
14904
|
`,
|
|
14829
14905
|
host: {
|
|
14830
|
-
"[class]": "cn('block relative', class())",
|
|
14906
|
+
"[class]": "cn('block relative min-w-0', class())",
|
|
14831
14907
|
"(click)": "handleClick($event)"
|
|
14832
14908
|
}
|
|
14833
14909
|
}]
|