muffin-admin 6.0.0 → 6.1.0

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.
@@ -15,7 +15,7 @@ import { buildAdmin, setupAdmin } from "./utils";
15
15
  export function MuffinDashboard() {
16
16
  const { dashboard, help } = useMuffinAdminOpts();
17
17
  const translate = useTranslate();
18
- return (_jsxs(Stack, { gap: 2, pt: 1, children: [_jsxs(Stack, { direction: "row", flexWrap: "wrap", gap: 1, children: [help && _jsx(HelpLink, { href: help, label: translate("muffin.how_to_use_admin") }), buildAdmin(["dashboard-actions"])] }), _jsxs(Grid, { container: true, spacing: 1, children: [buildAdmin(["dashboard-content"]), _jsx(AdminCards, { src: dashboard })] })] }));
18
+ return (_jsxs(Stack, { gap: 2, pt: 1, children: [_jsxs(Stack, { direction: "row", flexWrap: "wrap", gap: 1, children: [help && _jsx(HelpLink, { href: help, label: translate("muffin.how_to_use_admin") }), buildAdmin(["dashboard-actions"])] }), _jsxs(Grid, { container: true, spacing: 1, children: [buildAdmin(["dashboard-content"]), _jsx(AdminCards, { src: dashboard })] }), _jsxs(Typography, { variant: "body2", color: "textSecondary", align: "center", my: 1, children: ["Muffin Admin v.", process.env.VERSION] })] }));
19
19
  }
20
20
  setupAdmin(["dashboard"], MuffinDashboard);
21
21
  function AdminCards({ src }) {
@@ -12,6 +12,10 @@ export declare function MuffinDataprovider(apiUrl: string): {
12
12
  hasPreviousPage: boolean;
13
13
  hasNextPage: boolean;
14
14
  };
15
+ } | {
16
+ data: any;
17
+ total?: undefined;
18
+ pageInfo?: undefined;
15
19
  }>;
16
20
  getOne: (resource: string, { id }: {
17
21
  id: TID;
@@ -59,6 +63,10 @@ export declare function MuffinDataprovider(apiUrl: string): {
59
63
  hasPreviousPage: boolean;
60
64
  hasNextPage: boolean;
61
65
  };
66
+ } | {
67
+ data: any;
68
+ total?: undefined;
69
+ pageInfo?: undefined;
62
70
  }>;
63
71
  getManyReference: (resource: string, { target, id, filter, ...opts }: {
64
72
  [x: string]: any;
@@ -72,6 +80,10 @@ export declare function MuffinDataprovider(apiUrl: string): {
72
80
  hasPreviousPage: boolean;
73
81
  hasNextPage: boolean;
74
82
  };
83
+ } | {
84
+ data: any;
85
+ total?: undefined;
86
+ pageInfo?: undefined;
75
87
  }>;
76
88
  runAction: (resource: string, action: string, props: TActionProps) => Promise<{
77
89
  data: any;
@@ -45,14 +45,16 @@ export function MuffinDataprovider(apiUrl) {
45
45
  query.sort = order == "ASC" ? field : `-${field}`;
46
46
  }
47
47
  const { headers, data } = yield request(resource, { query });
48
- return {
49
- data,
50
- total: parseInt(headers.get("x-total"), 10),
51
- pageInfo: {
52
- hasPreviousPage: pagination.page > 1,
53
- hasNextPage: data.length === pagination.perPage,
54
- },
55
- };
48
+ if (pagination)
49
+ return {
50
+ data,
51
+ total: parseInt(headers.get("x-total"), 10),
52
+ pageInfo: {
53
+ hasPreviousPage: pagination.page > 1,
54
+ hasNextPage: data.length === pagination.perPage,
55
+ },
56
+ };
57
+ return { data };
56
58
  }),
57
59
  getOne: (resource_1, _a) => __awaiter(this, [resource_1, _a], void 0, function* (resource, { id }) {
58
60
  return yield request(`${resource}/${id}`);
package/dist/index.d.ts CHANGED
@@ -17,3 +17,4 @@ export * from "./fields";
17
17
  export * from "./hooks";
18
18
  export * from "./types";
19
19
  export declare function initAdmin(prefix?: string, containerId?: string): Promise<void>;
20
+ export declare const VERSION: string;
package/dist/index.js CHANGED
@@ -40,3 +40,4 @@ export function initAdmin() {
40
40
  root.render(_jsx(MuffinAdminContext.Provider, { value: adminOpts, children: _jsx(MuffinAdmin, {}) }));
41
41
  });
42
42
  }
43
+ export const VERSION = process.env.VERSION;