muffin-admin 2.6.7 → 2.7.2

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.
@@ -1,2 +1,3 @@
1
+ import { AdminProps } from "react-admin";
1
2
  import { AdminOpts } from "./types";
2
- export declare function MuffinAdmin(props: AdminOpts): import("react/jsx-runtime").JSX.Element;
3
+ export declare function MuffinAdmin(opts: AdminOpts, props: AdminProps): import("react/jsx-runtime").JSX.Element;
@@ -3,23 +3,19 @@ import IconButton from "@mui/material/IconButton";
3
3
  import SvgIcon from "@mui/material/SvgIcon";
4
4
  import Tooltip from "@mui/material/Tooltip";
5
5
  import Typography from "@mui/material/Typography";
6
- import createTheme from "@mui/material/styles/createTheme";
7
6
  import { Admin, AppBar, Layout, Login } from "react-admin";
8
7
  import { AdminPropsContext, buildAdmin, findBuilder, findIcon, setupAdmin } from "./utils";
9
- const darkTheme = createTheme({
10
- palette: { mode: "dark" },
11
- });
12
- export function MuffinAdmin(props) {
13
- const { resources, auth, appBarLinks, adminProps, dashboard } = props;
8
+ export function MuffinAdmin(opts, props) {
9
+ const { resources, auth, appBarLinks, adminProps, dashboard } = opts;
14
10
  const children = resources.map((resource) => buildAdmin(["resource", resource.name], Object.assign({}, resource)));
15
11
  document.title = adminProps.title || "Muffin Admin";
16
12
  const appBar = (props) => (_jsxs(AppBar, Object.assign({}, props, { children: [_jsx(Typography, { variant: "h6", color: "inherit", id: "react-admin-title", style: {
17
13
  flex: 1,
18
- textOverflow: "ellipsis",
19
- whiteSpace: "nowrap",
20
14
  overflow: "hidden",
15
+ whiteSpace: "nowrap",
16
+ textOverflow: "ellipsis",
21
17
  } }), appBarLinks.map((info) => (_jsx(Tooltip, { title: info.title, children: _jsx(IconButton, { color: "inherit", href: info.url, children: _jsx(SvgIcon, { component: findIcon(info.icon) }) }) }, info.url)))] })));
22
- return (_jsx(AdminPropsContext.Provider, { value: props, children: _jsx(Admin, { authProvider: buildAdmin(["authprovider"], auth), dashboard: dashboard ? buildAdmin(["dashboard"], dashboard) : null, dataProvider: buildAdmin(["dataprovider"], props), layout: (props) => _jsx(Layout, Object.assign({}, props, { appBar: appBar })), loginPage: findBuilder(["loginpage"]), requireAuth: auth.required, darkTheme: { palette: { mode: "dark" } }, children: children }) }));
18
+ return (_jsx(AdminPropsContext.Provider, { value: opts, children: _jsx(Admin, Object.assign({ authProvider: buildAdmin(["authprovider"], auth), dataProvider: buildAdmin(["dataprovider"], opts), layout: (props) => _jsx(Layout, Object.assign({}, props, { appBar: appBar })), loginPage: findBuilder(["loginpage"]), dashboard: dashboard ? buildAdmin(["dashboard"], dashboard) : null, requireAuth: auth.required, darkTheme: { palette: { mode: "dark" } } }, props, { children: children })) }));
23
19
  }
24
20
  setupAdmin(["admin"], MuffinAdmin);
25
21
  // Initialize login page
@@ -13,6 +13,6 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
13
13
  import { ReferenceField, TextField } from "react-admin";
14
14
  export function FKField(_a) {
15
15
  var { reference, refSource, refKey, link, source } = _a, props = __rest(_a, ["reference", "refSource", "refKey", "link", "source"]);
16
- return (_jsx(ReferenceField, Object.assign({ link: link || "show", reference: reference, source: source, queryOptions: { meta: { key: refKey } } }, props, { children: _jsxs(_Fragment, { children: [_jsx(TextField, { source: refSource }), " (#", _jsx(TextField, { source: refKey || "id" }), ")"] }) })));
16
+ return (_jsx(ReferenceField, Object.assign({ source: source, link: link || "show", reference: reference, queryOptions: { meta: { key: refKey } } }, props, { children: _jsxs(_Fragment, { children: [_jsx(TextField, { source: refSource }), " (#", _jsx(TextField, { source: refKey || "id" }), ")"] }) })));
17
17
  }
18
18
  FKField.displayName = "FKField";
@@ -9,7 +9,7 @@ export function JsonField({ label, source }) {
9
9
  if (!value || Object.keys(value).length == 0)
10
10
  return null;
11
11
  const src = JSON.stringify(value, null, 2);
12
- const retval = (_jsxs("div", { children: [_jsx("p", {}), label, _jsx(Button, { variant: "contained", color: "primary", size: "small", label: expand ? "colapse" : "expand", onClick: (e) => {
12
+ const retval = (_jsxs("div", { children: [_jsx("p", {}), label, _jsx(Button, { size: "small", color: "primary", variant: "contained", label: expand ? "colapse" : "expand", onClick: (e) => {
13
13
  setExpand(!expand);
14
14
  e.stopPropagation();
15
15
  } }), _jsx("p", { children: expand && _jsx("pre", { children: src }) })] }));