Releases: woylie/flop_phoenix
Releases · woylie/flop_phoenix
0.24.1
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 aPagination
struct from a
Flop.Meta
struct. - Add
Flop.Phoenix.pagination_for/1
for building custom pagination components.
Update the existingFlop.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 thepagination_opts
. Set this option
with the newpage_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
to5
. - Deprecate configuring the
pagination
andtable
components via the
application environment. Define wrapper components that pass theopts
attribute to the Flop.Phoenix components instead. - Remove dependency on PhoenixHTMLHelpers.
- Require Phoenix LiveView ~> 1.0.0.
- Require Elixir ~> 1.14.
Removed
- Remove
Flop.Phoenix.cursor_pagination/1
. UseFlop.Phoenix.pagination/1
instead. - Remove
t:Flop.Phoenix.cursor_pagination_option/0
. - Remove
Flop.Phoenix.IncorrectPaginationTypeError
. - Remove
input_type/3
from thePhoenix.HTML.FormData
protocol
implementation forFlop.Meta
. The function had been removed from the
protocol in Phoenix.HTML 4.0. - Remove the previously deprecated
event
attribute from the
Flop.Phoenix.pagination/1
andFlop.Phoenix.table/1
components. Use
:on_paginate
and:on_sort
instead. - Remove the previously deprecated
hide
andshow
attributes from the
:col
and:action
slots of theFlop.Phoenix.table/1
component. Use the
:if
attribute instead.
Fixed
- Fix a warning about ranges in Elixir 1.18.
How to upgrade
Replace Flop.Phoenix.cursor_pagination/1
with Flop.Phoenix.pagination/1
.
- <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.
- page_links: {:ellipsis, 7},
+ page_links: 7,
- page_links: :hide,
+ page_links: :none,
Remove page_links
from your pagination_opts
function and add it as an
attribute instead.
def pagination_opts do
[
ellipsis_attrs: [class: "ellipsis"],
ellipsis_content: "‥",
next_link_attrs: [class: "next"],
next_link_content: next_icon(),
- page_links: 7,
pagination_link_aria_label: &"#{&1}ページ目へ",
previous_link_attrs: [class: "prev"],
previous_link_content: previous_icon()
]
end
<Flop.Phoenix.pagination
meta={@meta}
path={~p"/pets"}
+ page_links={7}
/>
Replace the :show
and :hide
attribute in the :col
slot of the table
component with :if
.
<:col
:let={pet}
- show={@admin?}
+ :if={@admin?}
label="Name"
field={:name}
>
<%= pet.name %>
</:col>
<:col
:let={pet}
- hide={!@admin?}
+ :if={@admin?}
label="Name"
field={:name}
>
<%= pet.name %>
</:col>
Replace the event
attribute of the pagination table components with
on_paginate
and on_sort
.
<Flop.Phoenix.pagination
meta={@meta}
- event="paginate"
+ on_paginate={JS.push("paginate")}
/>
<Flop.Phoenix.table
items={@pets}
meta={@meta}
- event="sort"
+ on_sort={JS.push("sort")}
>
Remove the configuration for the pagination component from config/config.exs
and define a wrapper component in your CoreComponents
module instead. This
is optional, but will make future version updates easier.
For the pagination component:
# config/config.exs
config :flop_phoenix,
- pagination: [opts: {MyAppWeb.CoreComponents, :pagination_opts}],
table: [opts: {MyAppWeb.CoreComponents, :table_opts}]
# MyAppWeb.CoreComponents
- def pagination_opts do
- [
- # ...
- ]
- end
+ attr :meta, Flop.Meta, required: true
+ attr :path, :any, default: nil
+ attr :on_paginate, JS, default: nil
+ attr :target, :string, default: nil
+
+ def pagination(assigns) do
+ ~H\"""
+ <Flop.Phoenix.pagination
+ meta={@meta}
+ path={@path}
+ on_paginate={@on_paginate}
+ target={@target}
+ opts={[
+ # ...
+ ]}
+ />
+ \"""
+ end
0.23.1
0.23.0
0.22.10
0.22.9
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 oncol
elements incolgroup
.
Fixed
- The page range calculation in the
Flop.Phoenix.pagination/1
was incorrect
towards the last pages.