@agnos-ui/angular-bootstrap
Version:
Bootstrap-based component library for Angular.
1,592 lines (1,580 loc) • 235 kB
TypeScript
import * as i1 from '@agnos-ui/angular-headless';
import { WidgetSlotContext, Widget, SlotContent, HasFocus, FloatingUI, Directive, PropsConfig, BaseWidgetDirective, WidgetFactory, TransitionFn, ConfigValidator, ToasterService as ToasterService$1, WidgetsConfigStore, Partial2Levels, WidgetProps, AngularWidget, IsSlotContent } from '@agnos-ui/angular-headless';
export * from '@agnos-ui/angular-headless';
import * as _angular_core from '@angular/core';
import { TemplateRef, AfterViewInit, OnInit, InputSignal, Injector, InjectionToken, FactoryProvider } from '@angular/core';
import { Placement } from '@floating-ui/dom';
import { ControlValueAccessor } from '@angular/forms';
import { modalCloseButtonClick, modalOutsideClick } from '@agnos-ui/core-bootstrap/components/modal';
import { BSContextualClass } from '@agnos-ui/core-bootstrap/types';
export * from '@agnos-ui/core-bootstrap/types';
import { CollapseWidget as CollapseWidget$1 } from '@agnos-ui/core-bootstrap/components/collapse';
import { EmblaPluginType, EmblaPluginsType, EmblaCarouselType } from 'embla-carousel';
export * from '@agnos-ui/core-bootstrap/services/transitions';
import { BootstrapWidgetsConfig } from '@agnos-ui/core-bootstrap/config';
import { ReadableSignal } from '@amadeus-it-group/tansu';
/**
* Retrieve a shallow copy of the default Select config
* @returns the default Select config
*/
declare const export_getSelectDefaultConfig: () => SelectProps<any>;
/**
* Interface for the slot context of the pagination widget
* @template Item - The type of the items in the Select component.
*/
interface SelectContext<Item> extends WidgetSlotContext<SelectWidget<Item>> {
}
/**
* Represents the context for a select item, extending the base `SelectContext` with additional
* contextual data specific to an item.
*
* @template Item - The type of the item within the select context.
*/
interface SelectItemContext<Item> extends SelectContext<Item> {
/**
* Contextual data related to an item
*/
itemContext: ItemContext<Item>;
}
/**
* Represents the state of a Select component.
*
* @template Item - The type of the items in the select component.
*/
interface SelectState<Item> {
/**
* List of item contexts, to be displayed in the menu
*/
visibleItems: ItemContext<Item>[];
/**
* List of selected items to be display
*/
selectedContexts: ItemContext<Item>[];
/**
* Highlighted item context.
* It is designed to define the highlighted item in the dropdown menu
*/
highlighted: ItemContext<Item> | undefined;
/**
* Current placement of the dropdown
*/
placement: Placement | undefined;
/**
* id used for the input inside the select
*/
id: string | undefined;
/**
* aria-label used for the input inside the select
*
* @defaultValue `'Select'`
*/
ariaLabel: string | undefined;
/**
* List of selected item ids
*
* @defaultValue `[]`
*/
selected: Item[];
/**
* Filtered text to be display in the filter input
*
* @defaultValue `''`
*/
filterText: string;
/**
* true if the select is disabled
*
* @defaultValue `false`
*/
disabled: boolean;
/**
* true if the select is open
*
* @defaultValue `false`
*/
open: boolean;
/**
* Class to be added on the dropdown menu container
*
* @defaultValue `''`
*/
menuClassName: string;
/**
* Class to be added on menu items
*
* @defaultValue `''`
*/
menuItemClassName: string;
/**
* Class to be added on selected items (displayed in the input zone)
*
* @defaultValue `''`
*/
badgeClassName: string;
/**
* true if a loading process is being done
*
* @defaultValue `false`
*/
loading: boolean;
/**
* CSS classes to be applied on the widget main container
*
* @defaultValue `''`
*/
className: string;
/**
* The template to override the way each badge on the left of the input is displayed.
* This define the content of the badge inside the badge container.
*
* @defaultValue
* ```ts
* ({itemContext}: SelectItemContext<any>) => itemContext.item
* ```
*/
badgeLabel: SlotContent<SelectItemContext<Item>>;
/**
* The template to override the way each item is displayed in the list.
* This define the content of the badge inside the badge container.
*
* @defaultValue
* ```ts
* ({itemContext}: SelectItemContext<any>) => itemContext.item
* ```
*/
itemLabel: SlotContent<SelectItemContext<Item>>;
}
/**
* Represents the properties for the Select component.
*
* @template Item - The type of the items in the select component.
*/
interface SelectProps<Item> {
/**
* List of available items for the dropdown
*
* @defaultValue `[]`
*/
items: Item[];
/**
* List of allowed placements for the dropdown.
* This refers to the [allowedPlacements from floating UI](https://floating-ui.com/docs/autoPlacement#allowedplacements), given the different [Placement possibilities](https://floating-ui.com/docs/computePosition#placement).
*
* @defaultValue
* ```ts
* ['bottom-start', 'top-start', 'bottom-end', 'top-end']
* ```
*/
allowedPlacements: Placement[];
/**
* Custom function to get the id of an item
* By default, the item is returned
*
* @defaultValue
* ```ts
* (item: any) => '' + item
* ```
*/
itemIdFn(item: Item): string;
/**
* Retrieves navigable elements within an HTML element containing badges and the input.
*
* @param node - HTMLElement that contains the badges and the input
*
* @defaultValue
* ```ts
* (node: HTMLElement) => node.querySelectorAll('.au-select-badge,input')
* ```
*/
navSelector(node: HTMLElement): NodeListOf<HTMLSpanElement | HTMLInputElement>;
/**
* Callback called dropdown open state change
* @param isOpen - updated open state
*
* @defaultValue
* ```ts
* () => {}
* ```
*/
onOpenChange(isOpen: boolean): void;
/**
* Callback called when the text filter change
* @param text - Filtered text
*
* @defaultValue
* ```ts
* () => {}
* ```
*/
onFilterTextChange(text: string): void;
/**
* Callback called when the selection change
*
* @defaultValue
* ```ts
* () => {}
* ```
*/
onSelectedChange(selected: Item[]): void;
/**
* id used for the input inside the select
*/
id: string | undefined;
/**
* aria-label used for the input inside the select
*
* @defaultValue `'Select'`
*/
ariaLabel: string | undefined;
/**
* List of selected item ids
*
* @defaultValue `[]`
*/
selected: Item[];
/**
* Filtered text to be display in the filter input
*
* @defaultValue `''`
*/
filterText: string;
/**
* true if the select is disabled
*
* @defaultValue `false`
*/
disabled: boolean;
/**
* true if the select is open
*
* @defaultValue `false`
*/
open: boolean;
/**
* Class to be added on the dropdown menu container
*
* @defaultValue `''`
*/
menuClassName: string;
/**
* Class to be added on menu items
*
* @defaultValue `''`
*/
menuItemClassName: string;
/**
* Class to be added on selected items (displayed in the input zone)
*
* @defaultValue `''`
*/
badgeClassName: string;
/**
* true if a loading process is being done
*
* @defaultValue `false`
*/
loading: boolean;
/**
* CSS classes to be applied on the widget main container
*
* @defaultValue `''`
*/
className: string;
/**
* The template to override the way each badge on the left of the input is displayed.
* This define the content of the badge inside the badge container.
*
* @defaultValue
* ```ts
* ({itemContext}: SelectItemContext<any>) => itemContext.item
* ```
*/
badgeLabel: SlotContent<SelectItemContext<Item>>;
/**
* The template to override the way each item is displayed in the list.
* This define the content of the badge inside the badge container.
*
* @defaultValue
* ```ts
* ({itemContext}: SelectItemContext<any>) => itemContext.item
* ```
*/
itemLabel: SlotContent<SelectItemContext<Item>>;
}
/**
* Represents a Select widget component.
*
* @template Item - The type of the items that the select widget will handle.
*/
type SelectWidget<Item> = Widget<SelectProps<Item>, SelectState<Item>, SelectApi<Item>, SelectDirectives<Item>>;
/**
* Creates a new select widget instance.
* @param config - config of the modal, either as a store or as an object containing values or stores.
* @returns a new select widget instance
*/
declare const export_createSelect: <Item>(config?: PropsConfig<SelectProps<Item>>) => SelectWidget<Item>;
/**
* Item representation built from the items provided in parameters
*
* @template T - The type of the Select Items
*/
interface ItemContext<T> {
/**
* Original item given in the parameters
*/
item: T;
/**
* Unique id to identify the item
*/
id: string;
/**
* Specify if the item is checked
*/
selected: boolean;
}
/**
* Interface representing the API for a Select component.
*
* @template Item - The type of the Select Items
*/
interface SelectApi<Item> {
/**
* Clear all the selected items
*/
clear(): void;
/**
* Clear the filter text
*/
clearText(): void;
/**
* Highlight the given item, if there is a corresponding match among the visible list
*/
highlight(item: Item): void;
/**
* Highlight the first item among the visible list
*/
highlightFirst(): void;
/**
* Highlight the previous item among the visible list
* Loop to the last item if needed
*/
highlightPrevious(): void;
/**
* Highlight the next item among the visible list.
* Loop to the first item if needed
*/
highlightNext(): void;
/**
* Highlight the last item among the visible list
*/
highlightLast(): void;
/**
* Select the provided item.
* The selected list is used to
* @param item - the item to select
*/
select(item: Item): void;
/**
* Unselect the provided item.
* @param item - the item to unselect
*/
unselect(item: Item): void;
/**
* Toggle the selection of an item
* @param item - the item to toggle
* @param selected - an optional boolean to enforce the selected/unselected state instead of toggling
*/
toggleItem(item: Item, selected?: boolean): void;
/**
* open the select
*/
open(): void;
/**
* close the select
*/
close(): void;
/**
* Toggle the dropdown menu
* @param isOpen - If specified, set the menu in the defined state.
*/
toggle(isOpen?: boolean): void;
}
/**
* Interface representing the directives used in the Select component.
*
* @template Item - The type of the Select Items
*/
interface SelectDirectives<Item> {
/**
* Directive to be used in the input group and the menu containers
*/
hasFocusDirective: HasFocus['directive'];
/**
* Directive that enables dynamic positioning of menu element
*/
floatingDirective: FloatingUI['directives']['floatingDirective'];
/**
* A directive to be applied to the input group element serves as the base for menu positioning
*/
referenceDirective: FloatingUI['directives']['referenceDirective'];
/**
* A directive to be applied to the element that contains the badges and the input
*/
inputContainerDirective: Directive;
/**
* A directive that applies all the necessary attributes to the container badges
*/
badgeAttributesDirective: Directive<ItemContext<Item>>;
/**
* A directive that applies all the necessary attributes to the dropdown menu
*/
menuAttributesDirective: Directive;
/**
* A directive that applies all the necessary attributes to the dropdown item
*/
itemAttributesDirective: Directive<ItemContext<Item>>;
/**
* A directive to be applied to the input
*/
inputDirective: Directive;
/**
* A directive to be applied to a button that closes a badge
*/
badgeCloseButtonDirective: Directive<ItemContext<Item>>;
}
/**
* Directive to provide a custom template for the badge label in a select component.
*
* @template Item - The type of the item in the select component.
*
* This directive uses a template reference to render the {@link SelectItemContext<Item>}.
*/
declare class SelectBadgeLabelDirective<Item> {
templateRef: TemplateRef<any>;
static ngTemplateContextGuard<Item>(_dir: SelectBadgeLabelDirective<Item>, context: unknown): context is SelectItemContext<Item>;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SelectBadgeLabelDirective<any>, never>;
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<SelectBadgeLabelDirective<any>, "ng-template[auSelectBadgeLabel]", never, {}, {}, never, never, true, never>;
}
/**
* Directive to provide a custom label template for select items.
*
* This directive allows you to define a custom template for the labels of items
* in a select component. The template can be specified using an Angular `TemplateRef`.
*
* @template Item - The type of the items in the select component.
*
* This directive uses a template reference to render the {@link SelectItemContext<Item>}.
*/
declare class SelectItemLabelDirective<Item> {
templateRef: TemplateRef<any>;
static ngTemplateContextGuard<Item>(_dir: SelectItemLabelDirective<Item>, context: unknown): context is SelectItemContext<Item>;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SelectItemLabelDirective<any>, never>;
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<SelectItemLabelDirective<any>, "ng-template[auSelectItemLabel]", never, {}, {}, never, never, true, never>;
}
/**
* A component that represents a customizable select dropdown widget.
*
* @template Item - The type of items in the select dropdown.
*/
declare class SelectComponent<Item> extends BaseWidgetDirective<SelectWidget<Item>> {
/**
* aria-label used for the input inside the select
*
* @defaultValue `'Select'`
*/
readonly ariaLabel: _angular_core.InputSignal<string | undefined>;
/**
* id used for the input inside the select
*/
readonly id: _angular_core.InputSignal<string | undefined>;
/**
* List of available items for the dropdown
*
* @defaultValue `[]`
*/
readonly items: _angular_core.InputSignal<Item[] | undefined>;
/**
* List of allowed placements for the dropdown.
* This refers to the [allowedPlacements from floating UI](https://floating-ui.com/docs/autoPlacement#allowedplacements), given the different [Placement possibilities](https://floating-ui.com/docs/computePosition#placement).
*
* @defaultValue
* ```ts
* ['bottom-start', 'top-start', 'bottom-end', 'top-end']
* ```
*/
readonly allowedPlacements: _angular_core.InputSignal<Placement[] | undefined>;
/**
* true if the select is open
*
* @defaultValue `false`
*/
readonly open: _angular_core.InputSignalWithTransform<boolean | undefined, unknown>;
/**
* Filtered text to be display in the filter input
*
* @defaultValue `''`
*/
readonly filterText: _angular_core.InputSignal<string | undefined>;
/**
* CSS classes to be applied on the widget main container
*
* @defaultValue `''`
*/
readonly className: _angular_core.InputSignal<string | undefined>;
/**
* true if the select is disabled
*
* @defaultValue `false`
*/
readonly disabled: _angular_core.InputSignalWithTransform<boolean | undefined, unknown>;
/**
* List of selected item ids
*
* @defaultValue `[]`
*/
readonly selected: _angular_core.InputSignal<Item[] | undefined>;
/**
* true if a loading process is being done
*
* @defaultValue `false`
*/
readonly loading: _angular_core.InputSignalWithTransform<boolean | undefined, unknown>;
/**
* Custom function to get the id of an item
* By default, the item is returned
*
* @defaultValue
* ```ts
* (item: any) => '' + item
* ```
*/
readonly itemIdFn: _angular_core.InputSignal<((item: Item) => string) | undefined>;
/**
* Class to be added on the dropdown menu container
*
* @defaultValue `''`
*/
readonly menuClassName: _angular_core.InputSignal<string | undefined>;
/**
* The template to override the way each badge on the left of the input is displayed.
* This define the content of the badge inside the badge container.
*
* @defaultValue
* ```ts
* ({itemContext}: SelectItemContext<any>) => itemContext.item
* ```
*/
readonly badgeLabel: _angular_core.InputSignal<SlotContent<SelectItemContext<Item>>>;
readonly slotSelectBadgeLabelFromContent: _angular_core.Signal<SelectBadgeLabelDirective<any> | undefined>;
/**
* The template to override the way each item is displayed in the list.
* This define the content of the badge inside the badge container.
*
* @defaultValue
* ```ts
* ({itemContext}: SelectItemContext<any>) => itemContext.item
* ```
*/
readonly itemLabel: _angular_core.InputSignal<SlotContent<SelectItemContext<Item>>>;
readonly slotSelectItemLabelFromContent: _angular_core.Signal<SelectItemLabelDirective<any> | undefined>;
/**
* Callback called when the text filter change
* @param text - Filtered text
*
* @defaultValue
* ```ts
* () => {}
* ```
*/
readonly filterTextChange: _angular_core.OutputEmitterRef<string>;
/**
* Callback called when the selection change
*
* @defaultValue
* ```ts
* () => {}
* ```
*/
readonly selectedChange: _angular_core.OutputEmitterRef<Item[]>;
/**
* Callback called dropdown open state change
* @param isOpen - updated open state
*
* @defaultValue
* ```ts
* () => {}
* ```
*/
readonly openChange: _angular_core.OutputEmitterRef<boolean>;
/**
* Class to be added on menu items
*
* @defaultValue `''`
*/
readonly menuItemClassName: _angular_core.InputSignal<string | undefined>;
/**
* Class to be added on selected items (displayed in the input zone)
*
* @defaultValue `''`
*/
readonly badgeClassName: _angular_core.InputSignal<string | undefined>;
/**
* Retrieves navigable elements within an HTML element containing badges and the input.
*
* @param node - HTMLElement that contains the badges and the input
*
* @defaultValue
* ```ts
* (node: HTMLElement) => node.querySelectorAll('.au-select-badge,input')
* ```
*/
readonly navSelector: _angular_core.InputSignal<((node: HTMLElement) => NodeListOf<HTMLSpanElement | HTMLInputElement>) | undefined>;
constructor();
itemCtxTrackBy(_: number, itemContext: ItemContext<Item>): string;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SelectComponent<any>, never>;
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SelectComponent<any>, "[auSelect]", never, { "ariaLabel": { "alias": "auAriaLabel"; "required": false; "isSignal": true; }; "id": { "alias": "auId"; "required": false; "isSignal": true; }; "items": { "alias": "auItems"; "required": false; "isSignal": true; }; "allowedPlacements": { "alias": "auAllowedPlacements"; "required": false; "isSignal": true; }; "open": { "alias": "auOpen"; "required": false; "isSignal": true; }; "filterText": { "alias": "auFilterText"; "required": false; "isSignal": true; }; "className": { "alias": "auClassName"; "required": false; "isSignal": true; }; "disabled": { "alias": "auDisabled"; "required": false; "isSignal": true; }; "selected": { "alias": "auSelected"; "required": false; "isSignal": true; }; "loading": { "alias": "auLoading"; "required": false; "isSignal": true; }; "itemIdFn": { "alias": "auItemIdFn"; "required": false; "isSignal": true; }; "menuClassName": { "alias": "auMenuClassName"; "required": false; "isSignal": true; }; "badgeLabel": { "alias": "auBadgeLabel"; "required": false; "isSignal": true; }; "itemLabel": { "alias": "auItemLabel"; "required": false; "isSignal": true; }; "menuItemClassName": { "alias": "auMenuItemClassName"; "required": false; "isSignal": true; }; "badgeClassName": { "alias": "auBadgeClassName"; "required": false; "isSignal": true; }; "navSelector": { "alias": "auNavSelector"; "required": false; "isSignal": true; }; }, { "filterTextChange": "auFilterTextChange"; "selectedChange": "auSelectedChange"; "openChange": "auOpenChange"; }, ["slotSelectBadgeLabelFromContent", "slotSelectItemLabelFromContent"], never, true, never>;
}
/**
* Retrieve a shallow copy of the default Rating config
* @returns the default Rating config
*/
declare const export_getRatingDefaultConfig: () => RatingProps;
/**
* Represents the state of a rating component.
*/
interface RatingState {
/**
* the aria value of the rating
*/
ariaValueText: string;
/**
* the visible value of the rating (it changes when hovering over the rating even though the real value did not change)
*/
visibleRating: number;
/**
* is the rating interactive i.e. listening to hover, click and keyboard events
*/
interactive: boolean;
/**
* the list of stars
*/
stars: StarContext[];
/**
* The current rating. Could be a decimal value like `3.75`.
*
* @defaultValue `0`
*/
rating: number;
/**
* The maximum rating that can be given.
*
* @defaultValue `10`
*/
maxRating: number;
/**
* If `true`, the rating is disabled.
*
* @defaultValue `false`
*/
disabled: boolean;
/**
* If `true`, the rating can't be changed.
*
* @defaultValue `false`
*/
readonly: boolean;
/**
* Define if the rating can be reset.
*
* If set to true, the user can 'unset' the rating value by cliking on the current rating value.
*
* @defaultValue `true`
*/
resettable: boolean;
/**
* Allows setting a custom rating tabindex.
* If the component is disabled, `tabindex` will still be set to `-1`.
*
* @defaultValue `0`
*/
tabindex: number;
/**
* The aria label
*
* @defaultValue `'Rating'`
*/
ariaLabel: string;
/**
* The aria labelled by
*
* @defaultValue `''`
*/
ariaLabelledBy: string;
/**
* CSS classes to be applied on the widget main container
*
* @defaultValue `''`
*/
className: string;
/**
* The template to override the way each star is displayed.
*
* @defaultValue
* ```ts
* ({fill}: StarContext) => String.fromCharCode(fill === 100 ? 9733 : 9734)
* ```
*/
star: SlotContent<StarContext>;
}
/**
* Represents the properties for the Rating component.
*/
interface RatingProps {
/**
* Return the value for the 'aria-valuetext' attribute.
* @param rating - Current rating value.
* @param maxRating - maxRating value.
*
* @defaultValue
* ```ts
* (rating: number, maxRating: number) => `${rating} out of ${maxRating}`
* ```
*/
ariaValueTextFn: (rating: number, maxRating: number) => string;
/**
* An event emitted when the rating is changed.
*
* Event payload is equal to the newly selected rating.
*
* @defaultValue
* ```ts
* () => {}
* ```
*/
onRatingChange: (rating: number) => void;
/**
* An event emitted when the user is hovering over a given rating.
*
* Event payload is equal to the rating being hovered over.
*
* @defaultValue
* ```ts
* () => {}
* ```
*/
onHover: (rating: number) => void;
/**
* An event emitted when the user stops hovering over a given rating.
*
* Event payload is equal to the rating of the last item being hovered over.
*
* @defaultValue
* ```ts
* () => {}
* ```
*/
onLeave: (rating: number) => void;
/**
* The current rating. Could be a decimal value like `3.75`.
*
* @defaultValue `0`
*/
rating: number;
/**
* The maximum rating that can be given.
*
* @defaultValue `10`
*/
maxRating: number;
/**
* If `true`, the rating is disabled.
*
* @defaultValue `false`
*/
disabled: boolean;
/**
* If `true`, the rating can't be changed.
*
* @defaultValue `false`
*/
readonly: boolean;
/**
* Define if the rating can be reset.
*
* If set to true, the user can 'unset' the rating value by cliking on the current rating value.
*
* @defaultValue `true`
*/
resettable: boolean;
/**
* Allows setting a custom rating tabindex.
* If the component is disabled, `tabindex` will still be set to `-1`.
*
* @defaultValue `0`
*/
tabindex: number;
/**
* The aria label
*
* @defaultValue `'Rating'`
*/
ariaLabel: string;
/**
* The aria labelled by
*
* @defaultValue `''`
*/
ariaLabelledBy: string;
/**
* CSS classes to be applied on the widget main container
*
* @defaultValue `''`
*/
className: string;
/**
* The template to override the way each star is displayed.
*
* @defaultValue
* ```ts
* ({fill}: StarContext) => String.fromCharCode(fill === 100 ? 9733 : 9734)
* ```
*/
star: SlotContent<StarContext>;
}
/**
* Represents a Rating Widget component.
*/
type RatingWidget = Widget<RatingProps, RatingState, RatingApi, RatingDirectives>;
/**
* Create a RatingWidget with given config props
* @param config - an optional rating config
* @returns a RatingWidget
*/
declare const export_createRating: WidgetFactory<RatingWidget>;
/**
* Represents the context for a star in a rating component.
*/
interface StarContext {
/**
* indicates how much the current star is filled, from 0 to 100
*/
fill: number;
/**
* the position of the star in the rating
*/
index: number;
}
/**
* Interface representing directives for a rating component.
*/
interface RatingDirectives {
/**
* A directive to be applied to the main container
* This will handle the keydown, mouseleave, tabindex and aria attributes
*/
containerDirective: Directive;
/**
* A directive to be applied on each star element
*/
starDirective: Directive<{
index: number;
}>;
}
/**
* Interface representing the API that can be performed on a rating component.
*/
interface RatingApi {
/**
* Sets the rating value.
*
* @param index - Star index, starting from 1
*/
setRating(index: number): void;
/**
* Sets the hovered rating value.
*
* @param index - Star index, starting from 1
*/
setHoveredRating(index: number): void;
/**
* Leave the rating, resetting the visible rating to the rating value and triggering the onLeave callback
*/
leave(): void;
}
/**
* Directive to represent a rating star.
*
* This directive uses a template reference to render the {@link StarContext}.
*/
declare class RatingStarDirective {
templateRef: TemplateRef<any>;
static ngTemplateContextGuard(_dir: RatingStarDirective, context: unknown): context is StarContext;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RatingStarDirective, never>;
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RatingStarDirective, "ng-template[auRatingStar]", never, {}, {}, never, never, true, never>;
}
/**
* The `RatingComponent` is an Angular component that allows users to provide a rating.
* It extends `BaseWidgetDirective` and implements `ControlValueAccessor` to integrate with Angular forms.
*/
declare class RatingComponent extends BaseWidgetDirective<RatingWidget> implements ControlValueAccessor {
onChange: (_: any) => void;
onTouched: () => void;
/**
* Return the value for the 'aria-valuetext' attribute.
* @param rating - Current rating value.
* @param maxRating - maxRating value.
*
* @defaultValue
* ```ts
* (rating: number, maxRating: number) => `${rating} out of ${maxRating}`
* ```
*/
readonly ariaValueTextFn: _angular_core.InputSignal<((rating: number, maxRating: number) => string) | undefined>;
/**
* If `true`, the rating is disabled.
*
* @defaultValue `false`
*/
readonly disabled: _angular_core.InputSignalWithTransform<boolean | undefined, unknown>;
/**
* The maximum rating that can be given.
*
* @defaultValue `10`
*/
readonly maxRating: _angular_core.InputSignalWithTransform<number | undefined, unknown>;
/**
* The current rating. Could be a decimal value like `3.75`.
*
* @defaultValue `0`
*/
readonly rating: _angular_core.InputSignalWithTransform<number | undefined, unknown>;
/**
* If `true`, the rating can't be changed.
*
* @defaultValue `false`
*/
readonly readonly: _angular_core.InputSignalWithTransform<boolean | undefined, unknown>;
/**
* Define if the rating can be reset.
*
* If set to true, the user can 'unset' the rating value by cliking on the current rating value.
*
* @defaultValue `true`
*/
readonly resettable: _angular_core.InputSignalWithTransform<boolean | undefined, unknown>;
/**
* The template to override the way each star is displayed.
*
* @defaultValue
* ```ts
* ({fill}: StarContext) => String.fromCharCode(fill === 100 ? 9733 : 9734)
* ```
*/
readonly star: _angular_core.InputSignal<SlotContent<StarContext>>;
readonly slotStarFromContent: _angular_core.Signal<RatingStarDirective | undefined>;
/**
* Allows setting a custom rating tabindex.
* If the component is disabled, `tabindex` will still be set to `-1`.
*
* @defaultValue `0`
*/
readonly tabindex: _angular_core.InputSignalWithTransform<number | undefined, unknown>;
/**
* CSS classes to be applied on the widget main container
*
* @defaultValue `''`
*/
readonly className: _angular_core.InputSignal<string | undefined>;
/**
* The aria label
*
* @defaultValue `'Rating'`
*/
readonly ariaLabel: _angular_core.InputSignal<string | undefined>;
/**
* The aria labelled by
*
* @defaultValue `''`
*/
readonly ariaLabelledBy: _angular_core.InputSignal<string | undefined>;
/**
* An event emitted when the user is hovering over a given rating.
*
* Event payload is equal to the rating being hovered over.
*
* @defaultValue
* ```ts
* () => {}
* ```
*/
readonly hover: _angular_core.OutputEmitterRef<number>;
/**
* An event emitted when the user stops hovering over a given rating.
*
* Event payload is equal to the rating of the last item being hovered over.
*
* @defaultValue
* ```ts
* () => {}
* ```
*/
readonly leave: _angular_core.OutputEmitterRef<number>;
/**
* An event emitted when the rating is changed.
*
* Event payload is equal to the newly selected rating.
*
* @defaultValue
* ```ts
* () => {}
* ```
*/
readonly ratingChange: _angular_core.OutputEmitterRef<number>;
writeValue(value: any): void;
registerOnChange(fn: (value: any) => any): void;
registerOnTouched(fn: () => any): void;
setDisabledState(disabled: boolean): void;
constructor();
trackByIndex(index: number): number;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RatingComponent, never>;
static ɵcmp: _angular_core.ɵɵComponentDeclaration<RatingComponent, "[auRating]", never, { "ariaValueTextFn": { "alias": "auAriaValueTextFn"; "required": false; "isSignal": true; }; "disabled": { "alias": "auDisabled"; "required": false; "isSignal": true; }; "maxRating": { "alias": "auMaxRating"; "required": false; "isSignal": true; }; "rating": { "alias": "auRating"; "required": false; "isSignal": true; }; "readonly": { "alias": "auReadonly"; "required": false; "isSignal": true; }; "resettable": { "alias": "auResettable"; "required": false; "isSignal": true; }; "star": { "alias": "auStar"; "required": false; "isSignal": true; }; "tabindex": { "alias": "auTabindex"; "required": false; "isSignal": true; }; "className": { "alias": "auClassName"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "auAriaLabel"; "required": false; "isSignal": true; }; "ariaLabelledBy": { "alias": "auAriaLabelledBy"; "required": false; "isSignal": true; }; }, { "hover": "auHover"; "leave": "auLeave"; "ratingChange": "auRatingChange"; }, ["slotStarFromContent"], never, true, never>;
}
/**
* Retrieve a shallow copy of the default Pagination config
* @returns the default Pagination config
*/
declare const export_getPaginationDefaultConfig: () => PaginationProps;
/**
* A type for the slot context of the pagination widget
*/
interface PaginationContext extends WidgetSlotContext<PaginationWidget> {
}
/**
* A type for the slot context of the pagination widget when the slot is the number label
*/
interface PaginationNumberContext extends PaginationContext {
/**
* Displayed page
*/
displayedPage: number;
}
/**
* Represents the state of a pagination component.
*/
interface PaginationState {
/**
* The number of pages.
*/
pageCount: number;
/**
* The current pages, the number in the Array is the number of the page.
*/
pages: number[];
/**
* true if the previous link need to be disabled
*/
previousDisabled: boolean;
/**
* true if the next link need to be disabled
*/
nextDisabled: boolean;
/**
* The label for each "Page" page link.
*/
pagesLabel: string[];
/** The hrefs for each "Page" page link */
pagesHrefs: string[];
/** The hrefs for the direction links */
directionsHrefs: DirectionsHrefs;
/** The aria-live text */
ariaLiveLabelText: string;
/**
* The current page.
*
* Page numbers start with `1`.
*
* @defaultValue `1`
*/
page: number;
/**
* The label for the nav element.
*
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue `'Page navigation'`
*/
ariaLabel: string;
/**
* The label for the "active" page.
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue
* ```ts
* '(current)'
* ```
*/
activeLabel: string;
/**
* The label for the "First" page button.
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue
* ```ts
* 'Action link for first page'
* ```
*/
ariaFirstLabel: string;
/**
* The label for the "Previous" page button.
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue
* ```ts
* 'Action link for previous page'
* ```
*/
ariaPreviousLabel: string;
/**
* The label for the "Next" page button.
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue
* ```ts
* 'Action link for next page'
* ```
*/
ariaNextLabel: string;
/**
* The label for the "Last" page button.
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue
* ```ts
* 'Action link for last page'
* ```
*/
ariaLastLabel: string;
/**
* The label for the "Ellipsis" page.
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue `'Ellipsis page element'`
*/
ariaEllipsisLabel: string;
/**
* If `true`, pagination links will be disabled.
*
* @defaultValue `false`
*/
disabled: boolean;
/**
* If `true`, the "Next" and "Previous" page links are shown.
*
* @defaultValue `true`
*/
directionLinks: boolean;
/**
* If `true`, the "First" and "Last" page links are shown.
*
* @defaultValue `false`
*/
boundaryLinks: boolean;
/**
* CSS classes to be applied on the widget main container
*
* @defaultValue `''`
*/
className: string;
/**
* The template to use for the structure of the pagination component
* The default structure uses {@link PaginationProps.ellipsisLabel|ellipsisLabel}, {@link PaginationProps.firstPageLabel|firstPageLabel},
* {@link PaginationProps.previousPageLabel|previousPageLabel}, {@link PaginationProps.nextPageLabel|nextPageLabel},
* {@link PaginationProps.lastPageLabel|lastPageLabel}, {@link PaginationProps.pagesDisplay|pagesDisplay},
* {@link PaginationProps.numberLabel|numberLabel},
*/
structure: SlotContent<PaginationContext>;
/**
* The template to use for the ellipsis slot
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue `'…'`
*/
ellipsisLabel: SlotContent<PaginationContext>;
/**
* The template to use for the first slot
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue `'«'`
*/
firstPageLabel: SlotContent<PaginationContext>;
/**
* The template to use for the previous slot
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue `'‹'`
*/
previousPageLabel: SlotContent<PaginationContext>;
/**
* The template to use for the next slot
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue `'›'`
*/
nextPageLabel: SlotContent<PaginationContext>;
/**
* The template to use for the last slot
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue `'»'`
*/
lastPageLabel: SlotContent<PaginationContext>;
/**
* The template to use for the pages slot
* To use to customize the pages view
* override any configuration parameters provided for this
*/
pagesDisplay: SlotContent<PaginationContext>;
/**
* The template to use for the number slot
* override any configuration parameters provided for this
* for I18n, we suggest to use the global configuration
* @param displayedPage - The current page number
*
* @defaultValue
* ```ts
* ({displayedPage}: PaginationNumberContext) => `${displayedPage}`
* ```
*/
numberLabel: SlotContent<PaginationNumberContext>;
/**
* The pagination display size.
*
* Bootstrap currently supports small and large sizes.
*
* @defaultValue `null`
*/
size: 'sm' | 'lg' | null;
}
/**
* Represents the properties for the Pagination component.
*/
interface PaginationProps {
/**
* The number of items in your paginated collection.
*
* Note, that this is not the number of pages. Page numbers are calculated dynamically based on
* `collectionSize` and `pageSize`.
*
* Ex. if you have 100 items in your collection and displaying 20 items per page, you'll end up with 5 pages.
*
* Whatever the collectionSize the page number is of minimum 1.
*
* @defaultValue `0`
*/
collectionSize: number;
/**
* The number of items per page.
* @remarks min value is 1
*
* @defaultValue `10`
*/
pageSize: number;
/**
* An event fired when the page is changed.
*
* Event payload is the number of the newly selected page.
*
* Page numbers start with `1`.
* @defaultValue
* ```ts
* () => {}
* ```
*/
onPageChange: (page: number) => void;
/**
* pagesFactory returns a function computing the array of pages to be displayed
* as number (-1 are treated as ellipsis).
* Use Page slot to customize the pages view and not this
* @param page - The current page number
* @param pageCount - The total number of pages
*
* @defaultValue
* ```ts
* (_page: number, pageCount: number) => {
* const pages: number[] = [];
* for (let i = 1; i <= pageCount; i++) {
* pages.push(i);
* }
* return pages;
* }
* ```
*/
pagesFactory: (page: number, pageCount: number) => number[];
/**
* Provide the label for each "Page" page button.
* This is used for accessibility purposes.
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
* @param processPage - The current page number
* @param pageCount - The total number of pages
*
* @defaultValue
* ```ts
* (processPage: number, pageCount: number) => `Page ${processPage} of ${pageCount}`
* ```
*/
ariaPageLabel: (processPage: number, pageCount: number) => string;
/**
* Provide the label for the aria-live element
* This is used for accessibility purposes.
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
* @param currentPage - The current page number
* @param pageCount - The total number of pages
*
* @defaultValue
* ```ts
* (currentPage: number) => `Current page is ${currentPage}`
* ```
*/
ariaLiveLabel: (currentPage: number, pageCount: number) => string;
/**
* Factory function providing the href for a "Page" page anchor,
* based on the current page number
* @param pageNumber - The index to use in the link
*
* @defaultValue
* ```ts
* (_page: number) => PAGE_LINK_DEFAULT
* ```
*/
pageLink: (pageNumber: number) => string;
/**
* The current page.
*
* Page numbers start with `1`.
*
* @defaultValue `1`
*/
page: number;
/**
* The label for the nav element.
*
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue `'Page navigation'`
*/
ariaLabel: string;
/**
* The label for the "active" page.
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue
* ```ts
* '(current)'
* ```
*/
activeLabel: string;
/**
* The label for the "First" page button.
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue
* ```ts
* 'Action link for first page'
* ```
*/
ariaFirstLabel: string;
/**
* The label for the "Previous" page button.
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue
* ```ts
* 'Action link for previous page'
* ```
*/
ariaPreviousLabel: string;
/**
* The label for the "Next" page button.
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue
* ```ts
* 'Action link for next page'
* ```
*/
ariaNextLabel: string;
/**
* The label for the "Last" page button.
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue
* ```ts
* 'Action link for last page'
* ```
*/
ariaLastLabel: string;
/**
* The label for the "Ellipsis" page.
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue `'Ellipsis page element'`
*/
ariaEllipsisLabel: string;
/**
* If `true`, pagination links will be disabled.
*
* @defaultValue `false`
*/
disabled: boolean;
/**
* If `true`, the "Next" and "Previous" page links are shown.
*
* @defaultValue `true`
*/
directionLinks: boolean;
/**
* If `true`, the "First" and "Last" page links are shown.
*
* @defaultValue `false`
*/
boundaryLinks: boolean;
/**
* CSS classes to be applied on the widget main container
*
* @defaultValue `''`
*/
className: string;
/**
* The template to use for the structure of the pagination component
* The default structure uses {@link PaginationProps.ellipsisLabel|ellipsisLabel}, {@link PaginationProps.firstPageLabel|firstPageLabel},
* {@link PaginationProps.previousPageLabel|previousPageLabel}, {@link PaginationProps.nextPageLabel|nextPageLabel},
* {@link PaginationProps.lastPageLabel|lastPageLabel}, {@link PaginationProps.pagesDisplay|pagesDisplay},
* {@link PaginationProps.numberLabel|numberLabel},
*/
structure: SlotContent<PaginationContext>;
/**
* The template to use for the ellipsis slot
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue `'…'`
*/
ellipsisLabel: SlotContent<PaginationContext>;
/**
* The template to use for the first slot
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue `'«'`
*/
firstPageLabel: SlotContent<PaginationContext>;
/**
* The template to use for the previous slot
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue `'‹'`
*/
previousPageLabel: SlotContent<PaginationContext>;
/**
* The template to use for the next slot
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue `'›'`
*/
nextPageLabel: SlotContent<PaginationContext>;
/**
* The template to use for the last slot
* for I18n, we suggest to use the global configuration
* override any configuration parameters provided for this
*
* @defaultValue `'»'`
*/
lastPageLabel: SlotContent<PaginationContext>;
/**
* The template to use for the pages slot
* To use to customize the pages view
* override any configuration parameters provided for this
*/
pagesDisplay: SlotContent<PaginationContext>;
/**
* The template to use for the number slot
* override any configuration parameters provided for this
* for I18n, we suggest to use the global configuration
* @param displayedPage - The current page number
*
* @defaultValue
* ```ts
* ({displayedPage}: PaginationNumberContext) => `${displayedPage}`
* ```
*/
numberLabel: SlotContent<PaginationNumberContext>;
/**
* The pagination display size.
*
* Bootstrap currently supports small and large sizes.
*
* @defaultValue `null`
*/
size: 'sm' | 'lg' | null;
}
/**
* Represents a pagination widget component.
*
* This type defines a widget that handles pagination functionality,
* including properties, state, api and directives specific to pagination.
*/
type PaginationWidget = Widget<PaginationProps, PaginationState, PaginationApi, PaginationDirectives>;
/**
* Create a PaginationWidget with given config props
* @param config - an optional alert config
* @returns a PaginationWidget
*/
declare const export_createPagination: WidgetFactory<PaginationWidget>;
/**
* Interface representing the hrefs for pagination navigation links.
*/
interface DirectionsHrefs {
/**
* The href for the 'Previous' navigation link
*/
previous: string;
/**
* The href for the 'Next' direction link
*/
next: string;
}
/**
* Interface representing pagination API for navigating through pages.
*/
interface PaginationApi {
/**
* To "go" to a specific page
* @param page - The page number to select
*/
select(page: number): void;
/**
* To "go" to the first page
*/