muffin-admin 12.0.0 → 13.0.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.
- package/dist/MuffinAdmin.d.ts +5 -5
- package/dist/MuffinAdmin.js +1 -1
- package/dist/MuffinDashboard.d.ts +1 -1
- package/dist/MuffinDashboard.js +3 -3
- package/dist/MuffinMenu.d.ts +2 -2
- package/dist/MuffinMenu.js +2 -2
- package/dist/MuffinRecordList.d.ts +2 -2
- package/dist/MuffinRecordList.js +1 -1
- package/dist/MuffinResource.d.ts +2 -2
- package/dist/MuffinResourceCreate.d.ts +3 -3
- package/dist/MuffinResourceEdit.d.ts +6 -6
- package/dist/MuffinResourceEdit.js +1 -1
- package/dist/MuffinResourceList.d.ts +2 -2
- package/dist/MuffinResourceList.js +3 -4
- package/dist/MuffinResourceShow.d.ts +5 -5
- package/dist/MuffinResourceShow.js +1 -1
- package/dist/actions/LinkAction.d.ts +2 -2
- package/dist/authprovider.js +7 -9
- package/dist/buildRA.d.ts +4 -3
- package/dist/buildRA.js +1 -1
- package/dist/buttons/ActionButton.d.ts +5 -5
- package/dist/buttons/ActionButton.js +5 -5
- package/dist/buttons/CopyButton.d.ts +1 -1
- package/dist/buttons/LinkButton.d.ts +2 -2
- package/dist/common/AdminModal.d.ts +4 -4
- package/dist/common/ConfirmationProvider.d.ts +2 -2
- package/dist/common/ConfirmationProvider.js +1 -1
- package/dist/common/HelpLink.d.ts +1 -1
- package/dist/common/PayloadButtons.d.ts +1 -1
- package/dist/common/PayloadButtons.js +1 -1
- package/dist/context.d.ts +1 -1
- package/dist/dataprovider.d.ts +7 -7
- package/dist/fields/AvatarField.d.ts +3 -3
- package/dist/fields/AvatarField.js +2 -2
- package/dist/fields/CopyField.d.ts +1 -1
- package/dist/fields/EditableBooleanField.d.ts +1 -1
- package/dist/fields/FKField.d.ts +4 -4
- package/dist/fields/FKField.js +1 -1
- package/dist/fields/JsonField.d.ts +1 -1
- package/dist/filters/DateRangeFilter.d.ts +1 -1
- package/dist/filters/Filter.d.ts +2 -2
- package/dist/filters/Filter.js +2 -2
- package/dist/filters/SearchFilter.d.ts +2 -2
- package/dist/filters/SearchFilter.js +6 -4
- package/dist/hooks/useAction.d.ts +2 -2
- package/dist/hooks/useAction.js +2 -2
- package/dist/i18n/en.d.ts +1 -1
- package/dist/i18n/provider.d.ts +3 -3
- package/dist/i18n/ru.d.ts +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.js +12 -12
- package/dist/inputs/DateRangeInput.d.ts +2 -2
- package/dist/inputs/FKInput.d.ts +2 -2
- package/dist/inputs/ImgInput.d.ts +2 -2
- package/dist/inputs/JsonInput.d.ts +1 -1
- package/dist/inputs/JsonInput.js +1 -1
- package/dist/inputs/TimestampInput.d.ts +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +1 -0
- package/dist/web.js +0 -1
- package/package.json +15 -29
- package/src/MuffinAdmin.tsx +6 -7
- package/src/MuffinDashboard.tsx +6 -6
- package/src/MuffinMenu.tsx +3 -5
- package/src/MuffinRecordList.tsx +2 -2
- package/src/MuffinResource.tsx +1 -1
- package/src/MuffinResourceCreate.tsx +1 -1
- package/src/MuffinResourceEdit.tsx +1 -1
- package/src/MuffinResourceList.tsx +2 -5
- package/src/MuffinResourceShow.tsx +1 -1
- package/src/actions/LinkAction.tsx +1 -1
- package/src/authprovider.ts +88 -101
- package/src/buildRA.tsx +4 -3
- package/src/buttons/ActionButton.tsx +9 -10
- package/src/buttons/LinkButton.tsx +1 -1
- package/src/common/AdminModal.tsx +3 -3
- package/src/common/ConfirmationProvider.tsx +1 -1
- package/src/common/PayloadButtons.tsx +1 -1
- package/src/context.ts +1 -1
- package/src/dataprovider.ts +2 -2
- package/src/fields/AvatarField.tsx +8 -10
- package/src/fields/FKField.tsx +1 -1
- package/src/filters/Filter.tsx +2 -2
- package/src/filters/SearchFilter.tsx +14 -7
- package/src/globals.d.ts +1 -0
- package/src/hooks/useAction.ts +4 -4
- package/src/i18n/en.ts +1 -1
- package/src/i18n/ru.ts +1 -1
- package/src/index.tsx +12 -13
- package/src/inputs/DateRangeInput.tsx +1 -1
- package/src/inputs/JsonInput.tsx +1 -1
- package/src/utils.tsx +2 -1
- package/src/version.ts +1 -0
- package/src/web.ts +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
package/dist/MuffinAdmin.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AdminProps, AppBarProps, LayoutProps, LoginProps } from "react-admin";
|
|
2
|
-
export declare function MuffinAdmin({ lightTheme, darkTheme, ...props }: AdminProps): import("react
|
|
3
|
-
export declare function MuffinAdminLayout(props: LayoutProps): import("react
|
|
4
|
-
export declare function MuffinAppBar(props: AppBarProps): import("react
|
|
5
|
-
export declare function MuffinLogin(props: LoginProps): import("react
|
|
1
|
+
import { type AdminProps, type AppBarProps, type LayoutProps, type LoginProps } from "react-admin";
|
|
2
|
+
export declare function MuffinAdmin({ lightTheme, darkTheme, ...props }: AdminProps): import("react").JSX.Element;
|
|
3
|
+
export declare function MuffinAdminLayout(props: LayoutProps): import("react").JSX.Element;
|
|
4
|
+
export declare function MuffinAppBar(props: AppBarProps): import("react").JSX.Element;
|
|
5
|
+
export declare function MuffinLogin(props: LoginProps): import("react").JSX.Element;
|
package/dist/MuffinAdmin.js
CHANGED
|
@@ -14,8 +14,8 @@ import IconButton from "@mui/material/IconButton";
|
|
|
14
14
|
import SvgIcon from "@mui/material/SvgIcon";
|
|
15
15
|
import Tooltip from "@mui/material/Tooltip";
|
|
16
16
|
import Typography from "@mui/material/Typography";
|
|
17
|
-
import { AdminContext, AdminUI, AppBar, Layout, localStorageStore, Login, } from "react-admin";
|
|
18
17
|
import { useEffect } from "react";
|
|
18
|
+
import { AdminContext, AdminUI, AppBar, Layout, Login, localStorageStore, } from "react-admin";
|
|
19
19
|
import { ConfirmationProvider } from "./common";
|
|
20
20
|
import { useMuffinAdminOpts } from "./hooks";
|
|
21
21
|
import { buildProvider, muffinTranslations } from "./i18n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function MuffinDashboard(): import("react
|
|
1
|
+
export declare function MuffinDashboard(): import("react").JSX.Element;
|
package/dist/MuffinDashboard.js
CHANGED
|
@@ -9,14 +9,14 @@ import TableCell from "@mui/material/TableCell";
|
|
|
9
9
|
import TableRow from "@mui/material/TableRow";
|
|
10
10
|
import Typography from "@mui/material/Typography";
|
|
11
11
|
import { useTranslate } from "react-admin";
|
|
12
|
-
import { VERSION } from ".";
|
|
13
12
|
import { HelpLink } from "./common/HelpLink";
|
|
14
13
|
import { useMuffinAdminOpts } from "./hooks";
|
|
15
14
|
import { buildAdmin, setupAdmin } from "./utils";
|
|
15
|
+
import { VERSION } from "./version";
|
|
16
16
|
export function MuffinDashboard() {
|
|
17
17
|
const { dashboard, help } = useMuffinAdminOpts();
|
|
18
18
|
const translate = useTranslate();
|
|
19
|
-
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 })] }), VERSION && (_jsxs(Typography, { variant: "body2", color: "textSecondary", align: "center", my: 1, children: ["Muffin Admin v.", VERSION] }))] }));
|
|
19
|
+
return (_jsxs(Stack, { sx: { gap: 2, pt: 1 }, children: [_jsxs(Stack, { direction: "row", sx: { 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 })] }), VERSION && (_jsxs(Typography, { variant: "body2", color: "textSecondary", align: "center", sx: { my: 1 }, children: ["Muffin Admin v.", VERSION] }))] }));
|
|
20
20
|
}
|
|
21
21
|
setupAdmin(["dashboard"], MuffinDashboard);
|
|
22
22
|
setupAdmin(["dashboard-actions"], () => null);
|
|
@@ -27,6 +27,6 @@ function AdminCards({ src }) {
|
|
|
27
27
|
return _jsx(DashboardCard, Object.assign({}, src));
|
|
28
28
|
}
|
|
29
29
|
function DashboardCard({ title, value }) {
|
|
30
|
-
return (_jsx(Card, { children: _jsxs(CardContent, { children: [_jsx(Typography, { variant: "h5", component: "h2", m: 2,
|
|
30
|
+
return (_jsx(Card, { children: _jsxs(CardContent, { children: [_jsx(Typography, { variant: "h5", component: "h2", sx: { m: 2, textAlign: "center" }, children: title }), (Array.isArray(value) && _jsx(AdminTableView, { src: value })) || (_jsx("pre", { children: JSON.stringify(value, null, 2) }))] }) }));
|
|
31
31
|
}
|
|
32
32
|
const AdminTableView = ({ src }) => (_jsx(Table, { width: "100%", sx: { tableLayout: "fixed" }, children: _jsx(TableBody, { children: src.map((row, idx) => (_jsx(TableRow, { hover: true, children: row.map((cell, idx) => (_jsx(TableCell, { children: cell }, idx))) }, idx))) }) }));
|
package/dist/MuffinMenu.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { MenuProps } from "react-admin";
|
|
2
|
-
export declare function MuffinMenu(props: MenuProps): import("react
|
|
1
|
+
import { type MenuProps } from "react-admin";
|
|
2
|
+
export declare function MuffinMenu(props: MenuProps): import("react").JSX.Element;
|
package/dist/MuffinMenu.js
CHANGED
|
@@ -5,11 +5,11 @@ import Collapse from "@mui/material/Collapse";
|
|
|
5
5
|
import ListItemButton from "@mui/material/ListItemButton";
|
|
6
6
|
import ListItemIcon from "@mui/material/ListItemIcon";
|
|
7
7
|
import ListItemText from "@mui/material/ListItemText";
|
|
8
|
-
import { matchPath, useLocation } from "react-router-dom";
|
|
9
|
-
import { Menu, useBasename, useTheme, useTranslate } from "react-admin";
|
|
10
8
|
import find from "lodash/find";
|
|
11
9
|
import groupBy from "lodash/groupBy";
|
|
12
10
|
import { useContext, useState } from "react";
|
|
11
|
+
import { Menu, useBasename, useTheme, useTranslate } from "react-admin";
|
|
12
|
+
import { matchPath, useLocation } from "react-router-dom";
|
|
13
13
|
import { MuffinAdminContext } from "./context";
|
|
14
14
|
import { findIcon, setupAdmin } from "./utils";
|
|
15
15
|
export function MuffinMenu(props) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { SortPayload } from "react-admin";
|
|
1
|
+
import { type SortPayload } from "react-admin";
|
|
2
2
|
type TProps = {
|
|
3
3
|
resource: string;
|
|
4
4
|
filter: (record: any) => Record<string, any>;
|
|
5
5
|
sort?: SortPayload;
|
|
6
6
|
};
|
|
7
|
-
export declare function MuffinRecordList({ resource, filter, sort }: TProps): import("react
|
|
7
|
+
export declare function MuffinRecordList({ resource, filter, sort }: TProps): import("react").JSX.Element;
|
|
8
8
|
export {};
|
package/dist/MuffinRecordList.js
CHANGED
|
@@ -9,5 +9,5 @@ export function MuffinRecordList({ resource, filter, sort }) {
|
|
|
9
9
|
const translate = useTranslate();
|
|
10
10
|
const { list: { fields }, } = useMuffinResourceOpts(resource);
|
|
11
11
|
const { data, isPending } = useGetList(resource, { sort, filter: filter(record) });
|
|
12
|
-
return (_jsxs(Box, { p: 2, children: [_jsx(Typography, { variant: "h6", children: translate(`resources.${resource}.name`, { smart_count: 2 }) }), _jsx(Datagrid, { resource: resource, bulkActionButtons: false, isPending: isPending, data: data, children: buildAdmin(["list-fields", resource], fields) })] }));
|
|
12
|
+
return (_jsxs(Box, { sx: { p: 2 }, children: [_jsx(Typography, { variant: "h6", children: translate(`resources.${resource}.name`, { smart_count: 2 }) }), _jsx(Datagrid, { resource: resource, bulkActionButtons: false, isPending: isPending, data: data, children: buildAdmin(["list-fields", resource], fields) })] }));
|
|
13
13
|
}
|
package/dist/MuffinResource.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ResourceProps } from "react-admin";
|
|
2
|
-
export declare function MuffinResource({ name, ...props }: ResourceProps): import("react
|
|
1
|
+
import { type ResourceProps } from "react-admin";
|
|
2
|
+
export declare function MuffinResource({ name, ...props }: ResourceProps): import("react").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { PropsWithChildren } from "react";
|
|
2
|
-
export declare function MuffinResourceCreate({ children }: PropsWithChildren): import("react
|
|
3
|
-
export declare function MuffinCreateToolbar({ children }: PropsWithChildren): import("react
|
|
1
|
+
import type { PropsWithChildren } from "react";
|
|
2
|
+
export declare function MuffinResourceCreate({ children }: PropsWithChildren): import("react").JSX.Element;
|
|
3
|
+
export declare function MuffinCreateToolbar({ children }: PropsWithChildren): import("react").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PropsWithChildren } from "react";
|
|
2
|
-
export declare function MuffinEdit({ children }: PropsWithChildren): import("react
|
|
3
|
-
export declare function MuffinEditFormToolbar(): import("react
|
|
4
|
-
export declare function MuffinEditInputs(): import("react
|
|
5
|
-
export declare function MuffinEditToolbar({ children }: PropsWithChildren): import("react
|
|
6
|
-
export declare function MuffinEditActions({ children }: PropsWithChildren): import("react
|
|
1
|
+
import type { PropsWithChildren } from "react";
|
|
2
|
+
export declare function MuffinEdit({ children }: PropsWithChildren): import("react").JSX.Element;
|
|
3
|
+
export declare function MuffinEditFormToolbar(): import("react").JSX.Element;
|
|
4
|
+
export declare function MuffinEditInputs(): import("react").JSX.Element;
|
|
5
|
+
export declare function MuffinEditToolbar({ children }: PropsWithChildren): import("react").JSX.Element;
|
|
6
|
+
export declare function MuffinEditActions({ children }: PropsWithChildren): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Typography } from "@mui/material";
|
|
3
3
|
import { DeleteButton, Edit, ListButton, SaveButton, ShowButton, SimpleForm, Toolbar, TopToolbar, useRecordContext, useResourceContext, useTranslate, } from "react-admin";
|
|
4
4
|
import { useLocation, useNavigate } from "react-router-dom";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { PropsWithChildren } from "react";
|
|
2
|
-
export declare function MuffinList({ children }: PropsWithChildren): import("react
|
|
1
|
+
import type { PropsWithChildren } from "react";
|
|
2
|
+
export declare function MuffinList({ children }: PropsWithChildren): import("react").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import sortBy from "lodash/sortBy";
|
|
3
3
|
import uniq from "lodash/uniq";
|
|
4
|
-
import { BulkDeleteButton, BulkExportButton, CreateButton, DatagridConfigurable, EditButton,
|
|
4
|
+
import { BulkDeleteButton, BulkExportButton, CreateButton, DatagridConfigurable, EditButton, FilterButton, InfiniteList, List, Pagination, SelectColumnsButton, TopToolbar, useTranslate, } from "react-admin";
|
|
5
5
|
import { buildRA, buildRAComponent } from "./buildRA";
|
|
6
6
|
import { BulkActionButton, ListActionButton } from "./buttons";
|
|
7
7
|
import { HelpLink } from "./common/HelpLink";
|
|
@@ -48,10 +48,9 @@ setupAdmin(["list-grid-buttons"], MuffinListGridButtons);
|
|
|
48
48
|
function MuffinListToolbar() {
|
|
49
49
|
const { actions: baseActions = [], help, list: { create }, } = useMuffinResourceOpts();
|
|
50
50
|
const actions = baseActions.filter((a) => { var _a; return (_a = a.view) === null || _a === void 0 ? void 0 : _a.includes("list"); });
|
|
51
|
-
const hasExport = actions.some((a) => a.id === "export");
|
|
52
51
|
return (_jsxs(TopToolbar, { children: [help && _jsx(HelpLink, { href: help }), _jsx(SelectColumnsButton, {}), _jsx(FilterButton, {}), create && _jsx(CreateButton, {}), actions.length
|
|
53
52
|
? actions.map((props) => _jsx(ListActionButton, Object.assign({}, props), props.id))
|
|
54
|
-
: null
|
|
53
|
+
: null] }));
|
|
55
54
|
}
|
|
56
55
|
setupAdmin(["list-toolbar"], MuffinListToolbar);
|
|
57
56
|
function MuffinListActions() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PropsWithChildren } from "react";
|
|
2
|
-
export declare function MuffinShow({ children }: PropsWithChildren): import("react
|
|
3
|
-
export declare function MuffinShowToolbar(): import("react
|
|
4
|
-
export declare function MuffinShowActions({ children }: PropsWithChildren): import("react
|
|
5
|
-
export declare function MuffinShowLinks({ children }: PropsWithChildren): import("react
|
|
1
|
+
import type { PropsWithChildren } from "react";
|
|
2
|
+
export declare function MuffinShow({ children }: PropsWithChildren): import("react").JSX.Element;
|
|
3
|
+
export declare function MuffinShowToolbar(): import("react").JSX.Element;
|
|
4
|
+
export declare function MuffinShowActions({ children }: PropsWithChildren): import("react").JSX.Element;
|
|
5
|
+
export declare function MuffinShowLinks({ children }: PropsWithChildren): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Typography } from "@mui/material";
|
|
3
3
|
import { EditButton, ListButton, Show, SimpleShowLayout, TopToolbar, useRecordContext, useTranslate, } from "react-admin";
|
|
4
4
|
import { useLocation, useNavigate } from "react-router-dom";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AdminShowLink } from "../types";
|
|
1
|
+
import type { AdminShowLink } from "../types";
|
|
2
2
|
export declare function LinkAction({ field, filter, icon, label, ...props }: AdminShowLink & {
|
|
3
3
|
resource: string;
|
|
4
|
-
}): import("react
|
|
4
|
+
}): import("react").JSX.Element;
|
package/dist/authprovider.js
CHANGED
|
@@ -8,27 +8,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import Cookies from "js-cookie";
|
|
11
|
-
import { findBuilder, makeRequest, requestHeaders, setupAdmin } from "
|
|
12
|
-
setupAdmin(["auth-storage-get"], ({ storage, storageName }) => () => storage == "localstorage"
|
|
13
|
-
|
|
14
|
-
: Cookies.get(storageName));
|
|
15
|
-
setupAdmin(["auth-storage-set"], ({ storage }) => (name, value, requestOnly) => {
|
|
11
|
+
import { findBuilder, makeRequest, requestHeaders, setupAdmin } from "./utils";
|
|
12
|
+
setupAdmin(["auth-storage-get"], ({ storage, storageName }) => () => storage == "localstorage" ? localStorage.getItem(storageName) : Cookies.get(storageName));
|
|
13
|
+
setupAdmin(["auth-storage-set"], ({ storage }) => (name, value, _requestOnly) => {
|
|
16
14
|
if (storage == "localstorage") {
|
|
17
15
|
localStorage.setItem(name, value);
|
|
18
|
-
requestHeaders
|
|
16
|
+
requestHeaders.Authorization = value;
|
|
19
17
|
}
|
|
20
18
|
else
|
|
21
19
|
Cookies.set(name, value);
|
|
22
20
|
});
|
|
23
21
|
export function MuffinAuthProvider(props) {
|
|
24
|
-
const { identityURL, authorizeURL, logoutURL, required, storageName, storage
|
|
22
|
+
const { identityURL, authorizeURL, logoutURL, required, storageName, storage } = props;
|
|
25
23
|
const authGet = findBuilder(["auth-storage-get"])(props);
|
|
26
24
|
const authSet = findBuilder(["auth-storage-set"])(props);
|
|
27
25
|
// Initialize request headers
|
|
28
26
|
if (storage == "localstorage") {
|
|
29
27
|
const token = authGet(storageName);
|
|
30
28
|
if (token)
|
|
31
|
-
requestHeaders
|
|
29
|
+
requestHeaders.Authorization = token;
|
|
32
30
|
}
|
|
33
31
|
const getIdentity = () => __awaiter(this, void 0, void 0, function* () {
|
|
34
32
|
if (identityURL) {
|
|
@@ -79,7 +77,7 @@ export function MuffinAuthProvider(props) {
|
|
|
79
77
|
}),
|
|
80
78
|
getIdentity,
|
|
81
79
|
getPermissions: () => __awaiter(this, void 0, void 0, function* () {
|
|
82
|
-
const role = authGet(storageName
|
|
80
|
+
const role = authGet(`${storageName}_role`);
|
|
83
81
|
return role || "";
|
|
84
82
|
}),
|
|
85
83
|
};
|
package/dist/buildRA.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function
|
|
1
|
+
import type { ElementType } from "react";
|
|
2
|
+
export declare function buildRAComponent(name: string, props: any): import("react").JSX.Element;
|
|
3
|
+
export declare function buildRA(items: [string, Record<string, any>][]): import("react").JSX.Element[];
|
|
4
|
+
export declare function registerUI(name: string, component: ElementType): void;
|
package/dist/buildRA.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ArrayField, ArrayInput, AutocompleteArrayInput, AutocompleteInput, BooleanField, BooleanInput, CheckboxGroupInput, ChipField, DateField, DateInput, DateTimeInput, EmailField, FileField, FileInput, ImageField, ImageInput, NullableBooleanInput, NumberField, NumberInput, PasswordInput, RadioButtonGroupInput, ReferenceArrayField, ReferenceArrayInput, ReferenceField, ReferenceInput, ReferenceManyField,
|
|
2
|
+
import { ArrayField, ArrayInput, AutocompleteArrayInput, AutocompleteInput, BooleanField, BooleanInput, CheckboxGroupInput, ChipField, DateField, DateInput, DateTimeInput, EmailField, FileField, FileInput, ImageField, ImageInput, NullableBooleanInput, NumberField, NumberInput, PasswordInput, RadioButtonGroupInput, ReferenceArrayField, ReferenceArrayInput, ReferenceField, ReferenceInput, ReferenceManyField, RichTextField, required, SearchInput, SelectArrayInput, SelectField, SelectInput, TextField, TextInput, UrlField, } from "react-admin";
|
|
3
3
|
import { AvatarField, CopyField, EditableBooleanField, FKField, JsonField } from "./fields";
|
|
4
4
|
import { DateRangeFilter, Filter, SearchFilter } from "./filters";
|
|
5
5
|
import { FKInput, ImgInput, JsonInput, TimestampInput } from "./inputs";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AdminAction, AdminPayloadProps } from "../types";
|
|
1
|
+
import type { AdminAction, AdminPayloadProps } from "../types";
|
|
2
2
|
export type ActionPayloadProps = {
|
|
3
3
|
active: boolean;
|
|
4
4
|
onClose: () => void;
|
|
5
5
|
onHandle: (payload: any) => void;
|
|
6
6
|
};
|
|
7
|
-
export declare function ActionButton({ paths, confirm, file, ...props }: AdminAction): import("react
|
|
8
|
-
export declare function ListActionButton({ paths, confirm, file, ...props }: AdminAction): import("react
|
|
9
|
-
export declare function BulkActionButton({ paths, confirm, ...props }: AdminAction): import("react
|
|
10
|
-
export declare function CommonPayload({ active, onClose, onHandle, schema, title, help, }: AdminPayloadProps): import("react
|
|
7
|
+
export declare function ActionButton({ paths, confirm, file, ...props }: AdminAction): import("react").JSX.Element;
|
|
8
|
+
export declare function ListActionButton({ paths, confirm, file, ...props }: AdminAction): import("react").JSX.Element;
|
|
9
|
+
export declare function BulkActionButton({ paths, confirm, ...props }: AdminAction): import("react").JSX.Element;
|
|
10
|
+
export declare function CommonPayload({ active, onClose, onHandle, schema, title, help, }: AdminPayloadProps): import("react").JSX.Element;
|
|
@@ -18,11 +18,11 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
18
18
|
}
|
|
19
19
|
return t;
|
|
20
20
|
};
|
|
21
|
-
import {
|
|
22
|
-
import { Button, FormGroupsProvider, useAugmentedForm, useListContext, useRecordContext, useResourceContext, useTranslate, } from "react-admin";
|
|
23
|
-
import { FormProvider } from "react-hook-form";
|
|
21
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
22
|
import { Link, Stack } from "@mui/material";
|
|
25
23
|
import { useState } from "react";
|
|
24
|
+
import { Button, FormGroupsProvider, useAugmentedForm, useListContext, useRecordContext, useResourceContext, useTranslate, } from "react-admin";
|
|
25
|
+
import { FormProvider } from "react-hook-form";
|
|
26
26
|
import { buildRA } from "../buildRA";
|
|
27
27
|
import { AdminModal, PayloadButtons, useConfirmation } from "../common";
|
|
28
28
|
import { HelpLink } from "../common/HelpLink";
|
|
@@ -99,7 +99,7 @@ export function CommonPayload({ active, onClose, onHandle, schema, title, help,
|
|
|
99
99
|
record: {},
|
|
100
100
|
});
|
|
101
101
|
return (_jsx(FormProvider, Object.assign({}, form, { children: _jsx(FormGroupsProvider, { children: _jsx(AdminModal, { maxWidth: "sm", open: active, onClose: onClose, title: help
|
|
102
|
-
? (_jsxs(Stack, { alignItems: "flex-start", children: [_jsx("span", { children: translate(title, { _: title }) }), _jsx(HelpLink, { href: help, style: { alignSelf: "flex-end" } })] }))
|
|
102
|
+
? (_jsxs(Stack, { sx: { alignItems: "flex-start" }, children: [_jsx("span", { children: translate(title, { _: title }) }), _jsx(HelpLink, { href: help, style: { alignSelf: "flex-end" } })] }))
|
|
103
103
|
: translate(title, { _: title }), actions: _jsx(PayloadButtons, { onClose: onClose, onSubmit: formHandleSubmit, isValid: form.formState.isValid }), children: inputs }) }) })));
|
|
104
104
|
}
|
|
105
105
|
function FileButton({ path, record, label, icon, filterValues, }) {
|
|
@@ -107,7 +107,7 @@ function FileButton({ path, record, label, icon, filterValues, }) {
|
|
|
107
107
|
let url = `${apiUrl}${path}?f`;
|
|
108
108
|
if (record)
|
|
109
109
|
url = url.replace("{id}", record.id);
|
|
110
|
-
const authorization = requestHeaders
|
|
110
|
+
const authorization = requestHeaders.Authorization;
|
|
111
111
|
if (authorization)
|
|
112
112
|
url += `&t=${authorization}`;
|
|
113
113
|
if (Object.keys(filterValues).length)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AdminShowLink } from "../types";
|
|
1
|
+
import type { AdminShowLink } from "../types";
|
|
2
2
|
declare const LinkButton: ({ filters, icon, label, resource, id, title, }: AdminShowLink & {
|
|
3
3
|
resource: string;
|
|
4
4
|
filters?: any;
|
|
5
5
|
id?: string;
|
|
6
|
-
}) => import("react
|
|
6
|
+
}) => import("react").JSX.Element;
|
|
7
7
|
export default LinkButton;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DialogProps } from "@mui/material";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { type DialogProps } from "@mui/material";
|
|
2
|
+
import type { SxProps, Theme } from "@mui/material/styles";
|
|
3
|
+
import type { PropsWithChildren } from "react";
|
|
4
4
|
interface IProps extends Omit<DialogProps, "title" | "open" | "onClose"> {
|
|
5
5
|
open: boolean;
|
|
6
6
|
onClose: () => void;
|
|
@@ -8,5 +8,5 @@ interface IProps extends Omit<DialogProps, "title" | "open" | "onClose"> {
|
|
|
8
8
|
actions?: React.ReactNode;
|
|
9
9
|
contentSx?: SxProps<Theme>;
|
|
10
10
|
}
|
|
11
|
-
export declare function AdminModal({ open, onClose, children, title, actions, contentSx, ...props }: PropsWithChildren<IProps>): import("react
|
|
11
|
+
export declare function AdminModal({ open, onClose, children, title, actions, contentSx, ...props }: PropsWithChildren<IProps>): import("react").JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropsWithChildren } from "react";
|
|
1
|
+
import { type PropsWithChildren } from "react";
|
|
2
2
|
type TConfirmProps = {
|
|
3
3
|
title?: string;
|
|
4
4
|
message: string;
|
|
@@ -8,6 +8,6 @@ type TConfirmContext = {
|
|
|
8
8
|
confirm: (props: TConfirmProps) => Promise<boolean>;
|
|
9
9
|
};
|
|
10
10
|
export declare const ConfirmContext: import("react").Context<TConfirmContext>;
|
|
11
|
-
export declare function ConfirmationProvider({ children }: PropsWithChildren): import("react
|
|
11
|
+
export declare function ConfirmationProvider({ children }: PropsWithChildren): import("react").JSX.Element;
|
|
12
12
|
export declare const useConfirmation: () => TConfirmContext;
|
|
13
13
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Typography } from "@mui/material";
|
|
3
3
|
import { createContext, useContext, useState } from "react";
|
|
4
4
|
import { useTranslate } from "react-admin";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Button } from "react-admin";
|
|
2
|
-
export declare function HelpLink({ label, ...props }: Parameters<typeof Button>[0]): import("react
|
|
2
|
+
export declare function HelpLink({ label, ...props }: Parameters<typeof Button>[0]): import("react").JSX.Element;
|
|
@@ -2,5 +2,5 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Stack } from "@mui/material";
|
|
3
3
|
import { Button } from "react-admin";
|
|
4
4
|
export function PayloadButtons({ onClose, onSubmit, isValid = true, }) {
|
|
5
|
-
return (_jsxs(Stack, { direction: "row", alignItems: "center", justifyContent: "flex-end"
|
|
5
|
+
return (_jsxs(Stack, { direction: "row", spacing: 1, sx: { alignItems: "center", justifyContent: "flex-end" }, children: [_jsx(Button, { label: "ra.action.confirm", variant: "contained", disabled: !isValid, size: "medium", onClick: onSubmit }), _jsx(Button, { label: "ra.action.cancel", variant: "outlined", size: "medium", onClick: onClose })] }));
|
|
6
6
|
}
|
package/dist/context.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AdminOpts } from "./types";
|
|
1
|
+
import type { AdminOpts } from "./types";
|
|
2
2
|
export declare const MuffinAdminContext: import("react").Context<AdminOpts>;
|
package/dist/dataprovider.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TID } from "./types";
|
|
2
|
-
import { APIParams } from "./utils";
|
|
1
|
+
import type { TID } from "./types";
|
|
2
|
+
import { type APIParams } from "./utils";
|
|
3
3
|
type TQueryMeta = {
|
|
4
4
|
key?: string;
|
|
5
5
|
};
|
|
@@ -16,9 +16,9 @@ export declare function MuffinDataprovider(apiUrl: string): {
|
|
|
16
16
|
hasNextPage: boolean;
|
|
17
17
|
};
|
|
18
18
|
} | {
|
|
19
|
-
data: any;
|
|
20
19
|
total?: undefined;
|
|
21
20
|
pageInfo?: undefined;
|
|
21
|
+
data: any;
|
|
22
22
|
}>;
|
|
23
23
|
getOne: (resource: string, { id, meta }: {
|
|
24
24
|
id: TID;
|
|
@@ -68,15 +68,15 @@ export declare function MuffinDataprovider(apiUrl: string): {
|
|
|
68
68
|
hasNextPage: boolean;
|
|
69
69
|
};
|
|
70
70
|
} | {
|
|
71
|
-
data: any;
|
|
72
71
|
total?: undefined;
|
|
73
72
|
pageInfo?: undefined;
|
|
73
|
+
data: any;
|
|
74
74
|
}>;
|
|
75
75
|
getManyReference: (resource: string, { target, id, filter, ...opts }: {
|
|
76
76
|
[x: string]: any;
|
|
77
|
-
target: any;
|
|
78
|
-
id: any;
|
|
79
77
|
filter: any;
|
|
78
|
+
id: any;
|
|
79
|
+
target: any;
|
|
80
80
|
}) => Promise<{
|
|
81
81
|
data: any;
|
|
82
82
|
total: number;
|
|
@@ -85,9 +85,9 @@ export declare function MuffinDataprovider(apiUrl: string): {
|
|
|
85
85
|
hasNextPage: boolean;
|
|
86
86
|
};
|
|
87
87
|
} | {
|
|
88
|
-
data: any;
|
|
89
88
|
total?: undefined;
|
|
90
89
|
pageInfo?: undefined;
|
|
90
|
+
data: any;
|
|
91
91
|
}>;
|
|
92
92
|
runAction: (_: string, action: string, props: TActionProps) => Promise<{
|
|
93
93
|
data: any;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export declare function AvatarField({ source, alt, style, nameProp, ...props }: {
|
|
2
2
|
[x: string]: any;
|
|
3
|
-
source: any;
|
|
4
3
|
alt: any;
|
|
5
|
-
style: any;
|
|
6
4
|
nameProp: any;
|
|
7
|
-
|
|
5
|
+
source: any;
|
|
6
|
+
style: any;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
8
8
|
export declare namespace AvatarField {
|
|
9
9
|
var displayName: string;
|
|
10
10
|
}
|
|
@@ -17,7 +17,7 @@ import { useRecordContext } from "ra-core";
|
|
|
17
17
|
export function AvatarField(_a) {
|
|
18
18
|
var { source, alt, style, nameProp } = _a, props = __rest(_a, ["source", "alt", "style", "nameProp"]);
|
|
19
19
|
const record = useRecordContext(props);
|
|
20
|
-
|
|
20
|
+
const value = get(record, source), name = record[nameProp];
|
|
21
21
|
// Check value is a valid URL
|
|
22
22
|
if (value) {
|
|
23
23
|
try {
|
|
@@ -25,7 +25,7 @@ export function AvatarField(_a) {
|
|
|
25
25
|
}
|
|
26
26
|
catch (_b) {
|
|
27
27
|
// Not a valid URL, return loader
|
|
28
|
-
return
|
|
28
|
+
return _jsx(CircularProgress, { size: 24 });
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
const letters = name
|
package/dist/fields/FKField.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export declare function FKField({ reference, refSource, refKey, link, source, ...props }: {
|
|
2
2
|
[x: string]: any;
|
|
3
|
-
reference: any;
|
|
4
|
-
refSource: any;
|
|
5
|
-
refKey: any;
|
|
6
3
|
link: any;
|
|
4
|
+
refKey: any;
|
|
5
|
+
refSource: any;
|
|
6
|
+
reference: any;
|
|
7
7
|
source: any;
|
|
8
|
-
}): import("react
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
9
|
export declare namespace FKField {
|
|
10
10
|
var displayName: string;
|
|
11
11
|
}
|
package/dist/fields/FKField.js
CHANGED
|
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import {
|
|
12
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { ReferenceField, TextField, useFieldValue } from "react-admin";
|
|
14
14
|
import { useLocation } from "react-router-dom";
|
|
15
15
|
export function FKField(_a) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function DateRangeFilter(props: any): import("react
|
|
1
|
+
export declare function DateRangeFilter(props: any): import("react").JSX.Element;
|
package/dist/filters/Filter.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { InputProps } from "react-admin";
|
|
2
|
-
export declare function Filter({ type, ...props }: InputProps): import("react
|
|
1
|
+
import { type InputProps } from "react-admin";
|
|
2
|
+
export declare function Filter({ type, ...props }: InputProps): import("react").JSX.Element;
|
package/dist/filters/Filter.js
CHANGED
|
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import {
|
|
12
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import Button from "@mui/material/Button";
|
|
14
14
|
import FormGroup from "@mui/material/FormGroup";
|
|
15
15
|
import Menu from "@mui/material/Menu";
|
|
@@ -29,7 +29,7 @@ export function Filter(_a) {
|
|
|
29
29
|
var { type = "text" } = _a, props = __rest(_a, ["type"]);
|
|
30
30
|
const { field } = useInput(Object.assign({ format: (value) => (value ? value[Object.keys(value)[0]] : "") }, props));
|
|
31
31
|
const [op, setOp] = useState((field.value && Object.keys(field.value)[0]) || "$eq");
|
|
32
|
-
const onChange =
|
|
32
|
+
const onChange = (e) => {
|
|
33
33
|
field.onChange({ [op]: e.target.value });
|
|
34
34
|
};
|
|
35
35
|
const [menuEl, setMenuEl] = useState(null);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { SearchInputProps } from "react-admin";
|
|
2
|
-
export declare function SearchFilter({ source, className, ...props }: SearchInputProps): import("react
|
|
1
|
+
import { type SearchInputProps } from "react-admin";
|
|
2
|
+
export declare function SearchFilter({ source, className, ...props }: SearchInputProps): import("react").JSX.Element;
|
|
@@ -16,7 +16,7 @@ import clsx from "clsx";
|
|
|
16
16
|
import debounce from "lodash/debounce";
|
|
17
17
|
import { useTranslate } from "ra-core";
|
|
18
18
|
import { useState } from "react";
|
|
19
|
-
import { ResettableTextField, useInput, useResourceContext } from "react-admin";
|
|
19
|
+
import { ResettableTextField, useInput, useResourceContext, } from "react-admin";
|
|
20
20
|
export function SearchFilter(_a) {
|
|
21
21
|
var { source, className } = _a, props = __rest(_a, ["source", "className"]);
|
|
22
22
|
const translate = useTranslate();
|
|
@@ -25,10 +25,12 @@ export function SearchFilter(_a) {
|
|
|
25
25
|
const resource = useResourceContext();
|
|
26
26
|
const onBlur = () => field.onChange(searchValue);
|
|
27
27
|
const label = translate(`resources.${resource}.fields.${source}`);
|
|
28
|
-
return (_jsx(ResettableTextField, Object.assign({ resettable: true, ref: field.ref, label: label, value: searchValue, onBlur: debounce(onBlur, 500), placeholder: translate("muffin.action.search"), onChange: (e) => { var _a
|
|
28
|
+
return (_jsx(ResettableTextField, Object.assign({ resettable: true, ref: field.ref, label: label, value: searchValue, onBlur: debounce(onBlur, 500), placeholder: translate("muffin.action.search"), onChange: (e) => { var _a; var _b; return setSearchValue((_b = (_a = e.target) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : e); }, onKeyUp: (e) => {
|
|
29
29
|
if (e.key === "Enter")
|
|
30
30
|
field.onChange(searchValue);
|
|
31
|
-
} }, props, { className: clsx("ra-input", `ra-input-${source}`, className),
|
|
32
|
-
|
|
31
|
+
} }, props, { className: clsx("ra-input", `ra-input-${source}`, className), slotProps: {
|
|
32
|
+
input: {
|
|
33
|
+
endAdornment: (_jsx(InputAdornment, { position: "end", children: _jsx(SearchIcon, { color: "disabled" }) })),
|
|
34
|
+
},
|
|
33
35
|
} })));
|
|
34
36
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import { TActionProps } from "../dataprovider";
|
|
1
|
+
import { type UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
+
import type { TActionProps } from "../dataprovider";
|
|
3
3
|
export declare function useAction(action: string, options?: UseMutationOptions<{
|
|
4
4
|
data: any;
|
|
5
5
|
}, any, TActionProps>): import("@tanstack/react-query").UseMutationResult<{
|
package/dist/hooks/useAction.js
CHANGED
|
@@ -7,9 +7,9 @@ export function useAction(action, options) {
|
|
|
7
7
|
const unselectAll = useUnselectAll(resource);
|
|
8
8
|
const dataProvider = useDataProvider();
|
|
9
9
|
return useMutation(Object.assign({ mutationFn: (params) => dataProvider.runAction(resource, action, params), onSuccess: ({ data }) => {
|
|
10
|
-
if (data
|
|
10
|
+
if (data === null || data === void 0 ? void 0 : data.message)
|
|
11
11
|
notify(data.message, { type: "success" });
|
|
12
|
-
if (data
|
|
12
|
+
if (data === null || data === void 0 ? void 0 : data.redirectTo)
|
|
13
13
|
window.location = data.redirectTo;
|
|
14
14
|
else {
|
|
15
15
|
unselectAll();
|