muffin-admin 2.6.5 → 2.6.6

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/dist/types.d.ts CHANGED
@@ -47,6 +47,10 @@ export type AdminResourceProps = {
47
47
  show: boolean;
48
48
  edit?: boolean;
49
49
  remove?: boolean;
50
+ sort?: {
51
+ field: string;
52
+ order: "ASC" | "DESC";
53
+ };
50
54
  };
51
55
  show: AdminShowProps;
52
56
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muffin-admin",
3
- "version": "2.6.5",
3
+ "version": "2.6.6",
4
4
  "description": "NPM package for https://github.com/klen/muffin-admin",
5
5
  "files": [
6
6
  "src",
@@ -15,12 +15,13 @@ import { buildAdmin, setupAdmin } from "./utils"
15
15
 
16
16
  export function MuffinResourceList(props: AdminResourceProps["list"]) {
17
17
  const resourceName = useResourceContext()
18
- const { fields, edit, show, limit, limitMax, filters, actions, remove } = props
18
+ const { fields, edit, show, limit, limitMax, filters, actions, remove, sort } = props
19
19
  return (
20
20
  <List
21
- bulkActionButtons={buildAdmin(["list-actions", resourceName], { actions, remove })}
22
- filters={buildAdmin(["list-filters", resourceName], filters) || undefined}
21
+ sort={sort}
23
22
  perPage={limit}
23
+ filters={buildAdmin(["list-filters", resourceName], filters) || undefined}
24
+ bulkActionButtons={buildAdmin(["list-actions", resourceName], { actions, remove })}
24
25
  pagination={
25
26
  <Pagination rowsPerPageOptions={sortBy(uniq([10, 25, 50, 100, limit, limitMax]))} />
26
27
  }
package/src/types.ts CHANGED
@@ -33,12 +33,12 @@ export type AdminResourceProps = {
33
33
  label: string
34
34
  create: AdminInput[] | false
35
35
  edit:
36
- | {
37
- actions: AdminAction[]
38
- inputs: AdminInput[]
39
- remove?: boolean
40
- }
41
- | false
36
+ | {
37
+ actions: AdminAction[]
38
+ inputs: AdminInput[]
39
+ remove?: boolean
40
+ }
41
+ | false
42
42
  list: {
43
43
  limit: number
44
44
  limitMax: number
@@ -48,6 +48,10 @@ export type AdminResourceProps = {
48
48
  show: boolean
49
49
  edit?: boolean
50
50
  remove?: boolean
51
+ sort?: {
52
+ field: string
53
+ order: "ASC" | "DESC"
54
+ }
51
55
  }
52
56
  show: AdminShowProps
53
57
  }