m3e/paginator

paginator provides Lustre support for the M3E Paginator component

Types

Config holds the configuration for a Paginator

pub type Config {
  Config(
    interaction: state.Interaction,
    first_page_label: String,
    page_size_visibility: PageSizeVisibility,
    items_per_page_label: String,
    last_page_label: String,
    length: Int,
    next_page_label: String,
    page_index: Int,
    page_size: PageSize,
    page_sizes: List(PageSize),
    page_size_variant: form_field.Variant,
    previous_page_label: String,
    first_last_buttons_visibility: FirstLastButtonsVisibility,
  )
}

Constructors

FirstLastButtonsVisibility specifies if first/last buttons are visible or hidden

pub type FirstLastButtonsVisibility {
  Shown
  Omitted
}

Constructors

  • Shown
  • Omitted

PageSize captures the semantics of the page-size attribute

pub type PageSize {
  PageSize(Int)
  PageSizeAll
}

Constructors

  • PageSize(Int)
  • PageSizeAll

PageSizeVisibility specifies if the page size selector is visible or hidden

pub type PageSizeVisibility {
  Visible
  Hidden
}

Constructors

  • Visible
  • Hidden

Paginator provides Lustre support for the M3E Paginator component

Fields:

  • interaction: Whether the element is enabled or disabled
  • first_page_label: The accessible label given to the button used to move to the first page
  • page_size_visibility: Whether to hide page size selection
  • items_per_page_label: The label for the page size selector
  • last_page_label: The accessible label given to the button used to move to the last page
  • length: The length of the total number of items which are being paginated
  • next_page_label: The accessible label given to the button used to move to the next page
  • page_index: The zero-based page index of the displayed list of items
  • page_size: The number of items to display in a page
  • page_sizes: A comma separated list of available page sizes
  • page_size_variant: The appearance variant of the page size
  • previous_page_label: The accessible label given to the button used to move to the previous page
  • first_last_buttons_visibility: Whether to show first/last buttons
pub opaque type Paginator

Slot gives type-safe names to each of the defined HTML named slots

pub type Slot {
  FirstPageIcon
  LastPageIcon
  NextPageIcon
  PreviousPageIcon
}

Constructors

  • FirstPageIcon
  • LastPageIcon
  • NextPageIcon
  • PreviousPageIcon

Values

pub fn default_config() -> Config

default_config creates a new Config with default values

pub const default_first_last_buttons_visibility: FirstLastButtonsVisibility
pub const default_first_page_label: String
pub const default_items_per_page_label: String
pub const default_last_page_label: String
pub const default_next_page_label: String
pub const default_page_size: Int
pub const default_page_size_visibility: PageSizeVisibility
pub const default_page_sizes: List(PageSize)
pub const default_previous_page_label: String
pub fn disabled(
  p: Paginator,
  interaction: state.Interaction,
) -> Paginator

disabled sets the interaction field

pub fn first_page_label(
  p: Paginator,
  first_page_label: String,
) -> Paginator

first_page_label sets the first_page_label field

pub fn from_config(c: Config) -> Paginator

from_config creates a Paginator from a Config record

pub fn hide_page_size(
  p: Paginator,
  page_size_visibility: PageSizeVisibility,
) -> Paginator

hide_page_size sets the page_size_visibility field

pub fn items_per_page_label(
  p: Paginator,
  items_per_page_label: String,
) -> Paginator

items_per_page_label sets the items_per_page_label field

pub fn last_page_label(
  p: Paginator,
  last_page_label: String,
) -> Paginator

last_page_label sets the last_page_label field

pub fn length(p: Paginator, length: Int) -> Paginator

length sets the length field

pub fn new() -> Paginator

new creates a Paginator with default values

pub fn next_page_label(
  p: Paginator,
  next_page_label: String,
) -> Paginator

next_page_label sets the next_page_label field

pub fn page_index(p: Paginator, page_index: Int) -> Paginator

page_index sets the page_index field

pub fn page_size(p: Paginator, page_size: PageSize) -> Paginator

page_size sets the page_size field

pub fn page_size_variant(
  p: Paginator,
  page_size_variant: form_field.Variant,
) -> Paginator

page_size_variant sets the page_size_variant field

pub fn page_sizes(
  p: Paginator,
  page_sizes: List(PageSize),
) -> Paginator

page_sizes sets the page_sizes field

pub fn previous_page_label(
  p: Paginator,
  previous_page_label: String,
) -> Paginator

previous_page_label sets the previous_page_label field

pub fn render(
  p: Paginator,
  attributes: List(attribute.Attribute(msg)),
  children: List(element.Element(msg)),
) -> element.Element(msg)

render creates a Lustre Element from a Paginator

Parameters:

  • p: a Paginator
  • attributes: a list of additional attributes
  • children: a list of child Elements
pub fn render_config(
  config: Config,
  attributes: List(attribute.Attribute(msg)),
  children: List(element.Element(msg)),
) -> element.Element(msg)

render_config creates a Lustre Element directly from a Config

pub fn show_first_last_buttons(
  p: Paginator,
  first_last_buttons_visibility: FirstLastButtonsVisibility,
) -> Paginator

show_first_last_buttons sets the first_last_buttons_visibility field

pub fn slot(s: Slot) -> attribute.Attribute(msg)

slot creates a Lustre ‘slot’ Attribute(msg) for a Slot

Search Document