woylie/flop_phoenix
Components for pagination, sortable tables and filter forms using Phoenix, Ecto and Flop
30 Releases
Latest: 3mo ago
0.26.0Latest
๐ Changed
- Breaking: Wrap the sorting indicator in the table header inside the sort
- link. Remove wrapper `span` and the `th_wrapper_attrs` option. Please check
- your table styles when upgrading (see HTML differences below).
- Add `head` slot to `Flop.Phoenix.table/1`.
๐ Fixed
- Remove unused require Logger warnings in Elixir 1.20.
๐ Changed table header markup
- Sortable table header markup before the change:
- ```html
- <th aria-sort="ascending">
- <span>
- <a href="/">Name</a>
- <span class="order-direction">โด</span>
- </span>
- </th>
- + 10 more
0.25.3
๐ Changed
- Require `phoenix_live_view` `~> 1.0.6 or ~> 1.1.0`.
0.25.2
๐ Fixed
- Allow overriding `maxlength` attribute in filter value field.
0.25.1
๐ Fixed
- Function clause error when no pagination parameters are passed and no
- `default_pagination_type` is set.
0.25.0
โจ Added
- Add guide about load-more buttons and infinite scroll.
- Add guide about CSS styles.
- Add guide about page size controls.
๐ Changed
- Remove `opts` attribute from `Flop.Phoenix.pagination/1` and remove
- configuration of the pagination component via application environment.
- Remove all default classes from pagination component.
- Remove `wrapper_attrs` from pagination component in favor of global
- attributes.
- Set page link aria label function with `page_link_aria_label_fun` attribute
- on `Flop.Phoenix.pagination/1` component instead of using
- `pagination_link_aria_label` option.
- + 24 more
๐ฆ How to upgrade
- The configuration via `pagination_opts` is deprecated. Instead of referencing a
- function that returns the pagination opts, it is recommended to define a
- component that wraps the `Flop.Phoenix.pagination/1` component and sets the
- necessary attributes.
- Follow the upgrade guide of version 0.24.0 to update the pagination component
- configuration, including the removal of the application configuration, if you
- haven't done so already.
- Remove the `wrapper_opts` from your pagination options and pass them directly
- + 111 more
0.24.1
๐ Fixed
- Determine pagination type when there is only a `limit`.
0.24.0
โจ Added
- Add `Flop.Phoenix.Pagination` struct to hold information needed to render
- a pagination component.
- Add `Flop.Phoenix.Pagination.new/2` to build a `Pagination` struct from a
- `Flop.Meta` struct.
- Add `Flop.Phoenix.pagination_for/1` for building custom pagination components.
- Update the existing `Flop.Phoenix.pagination/1` component to it.
- Add `Flop.Phoenix.page_link_range/3` for determining which page links to
- render in a pagination component.
๐ Changed
- Support cursor pagination in `Flop.Phoenix.pagination/1`.
- Remove the `page_links` option from the `pagination_opts`. Set this option
- with the new `page_links` attribute instead.
- Change the values of the `page_links` option from
- `:all | :hide | {:ellipsis, pos_integer}` to `:all | :none | pos_integer`.
- Change default value for `page_links` option of the
- `Flop.Phoenix.pagination/1` component from `:all` to `5`.
- Deprecate configuring the `pagination` and `table` components via the
- + 5 more
๐๏ธ Removed
- Remove `Flop.Phoenix.cursor_pagination/1`. Use `Flop.Phoenix.pagination/1`
- instead.
- Remove `t:Flop.Phoenix.cursor_pagination_option/0`.
- Remove `Flop.Phoenix.IncorrectPaginationTypeError`.
- Remove `input_type/3` from the `Phoenix.HTML.FormData` protocol
- implementation for `Flop.Meta`. The function had been removed from the
- protocol in Phoenix.HTML 4.0.
- Remove the previously deprecated `event` attribute from the
- + 5 more
๐ Fixed
- Fix a warning about ranges in Elixir 1.18.
๐ฆ How to upgrade
- Replace `Flop.Phoenix.cursor_pagination/1` with `Flop.Phoenix.pagination/1`.
- ```diff
- <Flop.Phoenix.cursor_pagination meta={@meta} path={~p"/pets"} />
- + <Flop.Phoenix.pagination meta={@meta} path={~p"/pets"} />
- ```
- Update the format of the `page_links` option for the pagination component.
- ```diff
- page_links: {:ellipsis, 7},
- + 94 more
0.23.1
๐ Changed
- Raise an error if a meta struct with the wrong pagination type is passed to the `pagination` or `cursor_pagination` component.
๐ Fixed
- Fix compilation error in Phoenix LiveView 1.0.0-rc.7.
- Fix type of `row_click` attribute.
0.23.0
๐ Changed
- Support and require `live_view ~> 1.0.0-rc.0`.
- Allow to pass options directly in config file instead of referencing function.
๐ Fixed
- Fixed a deprecation warning in Elixir 1.17.
0.22.10
๐ Changed
- Loosen version requirement for `flop` to support 0.26.
0.22.9
โจ Added
- Added `:pagination_list_item_attrs` option to `Flop.Phoenix.pagination/1`.
0.22.8
โจ Added
- Support `:col_class` attr on `:col` and `:action` slots in addition to `:col_style`.
๐ Changed
- Don't render empty `style` attributes on `col` elements in `colgroup`.
๐ Fixed
- The page range calculation in the `Flop.Phoenix.pagination/1` was incorrect
- towards the last pages.
0.22.7
๐ Changed
- Loosen version requirement for `phoenix_html`.
๐ Fixed
- Warning when wrapping table component and passing on `:col` slot as attribute.
0.22.6
๐ Changed
- Support Flop 0.25.0.
- Update documentation examples for filter forms.
0.22.5
๐ Changed
- Requires `phoenix_html ~> 4.0`.
0.22.4
๐ Fixed
- Don't render `li` element if a pagination link is not rendered.
0.22.3
๐ Changed
- Support Flop ~> 0.24.0.
0.22.2
๐ Fixed
- Numbered pagination links were not wrapped in `li` elements.
0.22.1
๐ Changed
- Allow to use `t:Phoenix.HTML.safe/0` as a label attribute in table headers.
0.22.0
โจ Added
- Added `directions` attribute to the `col` slot of the table component. This
- allows you to override the default sort directions, e.g. to specify
- nulls-first or nulls-last.
- Added `thead_th_attrs` and `th_wrapper_attrs` attributes to the `col` slot
- of the table component.
- Added `thead_th_attrs` attribute to the `action` slot of the table component.
๐ Changed
- Renamed `attrs` mattribute on the `col` and `action` slots of the table
- component to `tbody_td_attrs` in order to match the naming of the global
- table options.
๐ฆ Upgrade guide
- Rename the `attrs` attribute to `tbody_td_attrs` in both the `col` slot and the
- `action` slot:
- ```diff
- <Flop.Phoenix.table items={@pets} meta={@meta} path={~p"/pets"}>
- <:col :let={p} attrs={[class="my-class"]}><%= p.id %></:col>
- <:action :let={p} attrs={[class="my-class"]}>button</:col>
- + <:col :let={p} tbody_td_attrs={[class="my-class"]}><%= p.id %></:col>
- + <:action :let={p} tbody_td_attrs={[class="my-class"]}>button</:col>
- + 2 more
0.21.2
๐ Changed
- Support `phoenix_liveview ~> 0.20`.
0.21.1
โจ Added
- Allow passing a function to the `attrs` option of table component's `:action`
- slot. Before, this was only supported in the `:col` slot.
๐ Changed
- Improve some error messages and documentation examples.
๐ Fixed
- In the `:col` and `:action` slots of the table component, the `attrs` option
- did not properly override the attributes set with the `:tbody_td_attrs`
- option.
0.21.0
๐ Changed
- Depend on flop ~> 0.22.0.
0.20.0
โจ Added
- Added an `on_paginate` attribute to the `pagination` and `cursor_pagination`
- components. This attribute takes a `Phoenix.LiveView.JS` command as a value.
- The attribute can be combined with the `path` attribute, in which case the URL
- will be patched _and_ the the given JS command is executed.
- Similarly, an `on_sort` attribute was added to the `table` component.
- Allow setting `tbody_tr_attrs` to a function that takes the current row item
- as an argument and returns a list of attributes.
- Allow setting the `attrs` attribute of the `:col` slot of the table component
- + 2 more
๐ Changed
- The table ID falls back to `"sortable-table"` if no schema module is used.
- The tbody ID was changed to `{id}-tbody`.
- The table container ID is set to `{id}-container` now.
- The table ID is set to `{id}` now.
๐๏ธ Deprecated
- The `show` and `hide` attributes of the `:col` slot of the table component are
- now deprecated in favor of the `:if` attribute.
- The `event` attribute of the pagination, cursor pagination and table
- components has been deprecated in favor of `on_pagination` and `on_sort`.
0.19.1
๐ Changed
- The table component only renders an ascending/descending order indicator in the column header for the first order field, instead rendering one in the column headers for all ordered fields.
- Support Flop 0.22.
0.19.0
๐ Changed
- Necessary updates for `phoenix_live_view ~> 0.19.0`.
- Requires `phoenix_live_view ~> 0.19.0`.
- Remove previously deprecated `Flop.Phoenix.pop_filter/2`. Use
- `Flop.Filter.pop/3` instead.
0.18.2
๐ Changed
- Added `hidden` attribute to hidden inputs rendered by `filter_fields`
- component in order to solve CSS spacing issues.
0.18.1
๐ Changed
- Added support for LiveView streams to the table component. To this end,
- `row_id`, `row_item` and `id` attributes were added to the component,
- following the example of Phoenix 1.7. The `id` attribute is added to the
- `tbody`. If no `id` is explicitly set, a default value will be used depending
- on the schema name.
0.18.0
๐ Changed
- Added dependency on `Phoenix.HTML` `~> 3.3.0`.
- The `filter_fields` component now passes the `Phoenix.HTML.FormField` struct
- introduced in `Phoenix.HTML` 3.3.0 to the inner block.
- Support `:as` option for filter inputs with `Phoenix.HTML.FormData/4`
- (`inputs_for`).
- `Phoenix.HTML.FormData.input_type/2` now considers the Ecto type for join,
- custom and compound fields.
- Remove support for `path_helper` assigns, previously deprecated in 0.15.
- + 1 more
๐ฆ How to upgrade
- If your `input` component already knows how to handle the
- `Phoenix.HTML.FormField` struct, you can update the inner block for
- `filter_fields` like this:
- ```diff
- <.filter_fields :let={i} form={f} fields={[:email, :name]}>
- <.input
- field={{i.form, i.field}}
- + field={i.field}
- + 30 more
0.17.2
๐ Changed
- Support Flop 0.19.
