muffin-admin 11.8.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 +36 -4
- package/dist/MuffinResourceList.d.ts +2 -2
- package/dist/MuffinResourceList.js +10 -5
- package/dist/MuffinResourceShow.d.ts +5 -5
- package/dist/MuffinResourceShow.js +43 -6
- 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/buttons/LinkButton.js +8 -2
- package/dist/common/AdminModal.d.ts +6 -4
- package/dist/common/AdminModal.js +2 -2
- 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 +12 -2
- 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 +73 -12
- package/src/MuffinResourceList.tsx +17 -6
- package/src/MuffinResourceShow.tsx +93 -15
- 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 +11 -3
- package/src/common/AdminModal.tsx +8 -5
- 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 +14 -2
- 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
|
@@ -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,12 +9,22 @@ 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
|
+
import { useLocation } from "react-router-dom";
|
|
14
15
|
export function FKField(_a) {
|
|
15
16
|
var { reference, refSource, refKey, link, source } = _a, props = __rest(_a, ["reference", "refSource", "refKey", "link", "source"]);
|
|
17
|
+
const location = useLocation();
|
|
16
18
|
refKey = refKey || "id";
|
|
17
|
-
|
|
19
|
+
const returnTo = `${location.pathname}${location.search}`;
|
|
20
|
+
const resolveLink = link ||
|
|
21
|
+
((record) => {
|
|
22
|
+
const id = record === null || record === void 0 ? void 0 : record[refKey];
|
|
23
|
+
if (id === undefined || id === null)
|
|
24
|
+
return false;
|
|
25
|
+
return `/${reference}/${id}/show?returnTo=${encodeURIComponent(returnTo)}`;
|
|
26
|
+
});
|
|
27
|
+
return (_jsxs(ReferenceField, Object.assign({ source: source, link: resolveLink, reference: reference, queryOptions: { meta: { key: refKey } } }, props, { children: [_jsx(TextField, { source: refSource }), refSource !== refKey && _jsx(FKFieldValue, { source: refKey })] })));
|
|
18
28
|
}
|
|
19
29
|
function FKFieldValue(props) {
|
|
20
30
|
const value = useFieldValue(props);
|
|
@@ -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();
|
package/dist/i18n/en.d.ts
CHANGED
package/dist/i18n/provider.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const muffinTranslations: {
|
|
2
|
-
en: import("
|
|
3
|
-
ru: import("
|
|
2
|
+
en: import("ra-core").TranslationMessages;
|
|
3
|
+
ru: import("ra-core").TranslationMessages;
|
|
4
4
|
};
|
|
5
|
-
export declare const buildProvider: (translations: any) => import("
|
|
5
|
+
export declare const buildProvider: (translations: any) => import("ra-core").I18nProvider;
|
package/dist/i18n/ru.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
export * from "./utils";
|
|
2
|
-
export * from "./MuffinAdmin";
|
|
3
|
-
export * from "./MuffinDashboard";
|
|
4
|
-
export * from "./MuffinMenu";
|
|
5
|
-
export * from "./MuffinRecordList";
|
|
6
|
-
export * from "./MuffinResource";
|
|
7
|
-
export * from "./MuffinResourceCreate";
|
|
8
|
-
export * from "./MuffinResourceEdit";
|
|
9
|
-
export * from "./MuffinResourceList";
|
|
10
|
-
export * from "./MuffinResourceShow";
|
|
11
1
|
export * from "./actions";
|
|
12
2
|
export * from "./authprovider";
|
|
13
3
|
export * from "./buildRA";
|
|
@@ -17,6 +7,16 @@ export * from "./context";
|
|
|
17
7
|
export * from "./dataprovider";
|
|
18
8
|
export * from "./fields";
|
|
19
9
|
export * from "./hooks";
|
|
10
|
+
export * from "./MuffinAdmin";
|
|
11
|
+
export * from "./MuffinDashboard";
|
|
12
|
+
export * from "./MuffinMenu";
|
|
13
|
+
export * from "./MuffinRecordList";
|
|
14
|
+
export * from "./MuffinResource";
|
|
15
|
+
export * from "./MuffinResourceCreate";
|
|
16
|
+
export * from "./MuffinResourceEdit";
|
|
17
|
+
export * from "./MuffinResourceList";
|
|
18
|
+
export * from "./MuffinResourceShow";
|
|
20
19
|
export * from "./types";
|
|
20
|
+
export * from "./utils";
|
|
21
21
|
export declare function initAdmin(prefix?: string, containerId?: string): Promise<void>;
|
|
22
|
-
export
|
|
22
|
+
export { VERSION } from "./version";
|
package/dist/index.js
CHANGED
|
@@ -9,18 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { createRoot } from "react-dom/client";
|
|
12
|
-
import { MuffinAdmin } from "./MuffinAdmin";
|
|
13
12
|
import { MuffinAdminContext } from "./context";
|
|
14
|
-
|
|
15
|
-
export * from "./MuffinAdmin";
|
|
16
|
-
export * from "./MuffinDashboard";
|
|
17
|
-
export * from "./MuffinMenu";
|
|
18
|
-
export * from "./MuffinRecordList";
|
|
19
|
-
export * from "./MuffinResource";
|
|
20
|
-
export * from "./MuffinResourceCreate";
|
|
21
|
-
export * from "./MuffinResourceEdit";
|
|
22
|
-
export * from "./MuffinResourceList";
|
|
23
|
-
export * from "./MuffinResourceShow";
|
|
13
|
+
import { MuffinAdmin } from "./MuffinAdmin";
|
|
24
14
|
export * from "./actions";
|
|
25
15
|
export * from "./authprovider";
|
|
26
16
|
export * from "./buildRA";
|
|
@@ -30,7 +20,17 @@ export * from "./context";
|
|
|
30
20
|
export * from "./dataprovider";
|
|
31
21
|
export * from "./fields";
|
|
32
22
|
export * from "./hooks";
|
|
23
|
+
export * from "./MuffinAdmin";
|
|
24
|
+
export * from "./MuffinDashboard";
|
|
25
|
+
export * from "./MuffinMenu";
|
|
26
|
+
export * from "./MuffinRecordList";
|
|
27
|
+
export * from "./MuffinResource";
|
|
28
|
+
export * from "./MuffinResourceCreate";
|
|
29
|
+
export * from "./MuffinResourceEdit";
|
|
30
|
+
export * from "./MuffinResourceList";
|
|
31
|
+
export * from "./MuffinResourceShow";
|
|
33
32
|
export * from "./types";
|
|
33
|
+
export * from "./utils";
|
|
34
34
|
export function initAdmin() {
|
|
35
35
|
return __awaiter(this, arguments, void 0, function* (prefix = "", containerId = "root") {
|
|
36
36
|
const response = yield fetch(`${prefix}/ra.json`);
|
|
@@ -42,4 +42,4 @@ export function initAdmin() {
|
|
|
42
42
|
root.render(_jsx(MuffinAdminContext.Provider, { value: adminOpts, children: _jsx(MuffinAdmin, {}) }));
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
export
|
|
45
|
+
export { VERSION } from "./version";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { InputProps } from "react-admin";
|
|
1
|
+
import { type InputProps } from "react-admin";
|
|
2
2
|
import "react-datepicker/dist/react-datepicker.css";
|
|
3
3
|
type TProps = InputProps & {
|
|
4
4
|
value: [Date, Date];
|
|
5
5
|
onChange: (value: [Date, Date]) => void;
|
|
6
6
|
};
|
|
7
|
-
export declare function DateRangeInput({ value, onChange, ...props }: TProps): import("react
|
|
7
|
+
export declare function DateRangeInput({ value, onChange, ...props }: TProps): import("react").JSX.Element;
|
|
8
8
|
export {};
|
package/dist/inputs/FKInput.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare function FKInput({ refKey, refSource, fullWidth, reference, source, ...props }: {
|
|
2
2
|
[x: string]: any;
|
|
3
|
+
fullWidth: any;
|
|
3
4
|
refKey: any;
|
|
4
5
|
refSource: any;
|
|
5
|
-
fullWidth: any;
|
|
6
6
|
reference: any;
|
|
7
7
|
source: any;
|
|
8
|
-
}): import("react
|
|
8
|
+
}): import("react").JSX.Element;
|
package/dist/inputs/JsonInput.js
CHANGED
|
@@ -19,7 +19,7 @@ const parseFunction = (json) => {
|
|
|
19
19
|
retval = JSON.parse(json);
|
|
20
20
|
}
|
|
21
21
|
finally {
|
|
22
|
-
//
|
|
22
|
+
// biome-ignore lint/correctness/noUnsafeFinally: intentional - return parsed value or original on error
|
|
23
23
|
return retval;
|
|
24
24
|
}
|
|
25
25
|
};
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TAdminPath } from "./types";
|
|
1
|
+
import type { TAdminPath } from "./types";
|
|
2
2
|
export declare function setupAdmin<T>(adminType: TAdminPath, fc: (props: any) => T): void;
|
|
3
3
|
export declare function buildAdmin(adminType: TAdminPath, props?: {}): any;
|
|
4
4
|
export declare function findBuilder(adminType: TAdminPath): (props: any) => any;
|
|
@@ -23,6 +23,6 @@ export declare function makeRequest(url: string, params?: APIParams): Promise<{
|
|
|
23
23
|
json: any;
|
|
24
24
|
}>;
|
|
25
25
|
export declare function findIcon(icon?: string): any;
|
|
26
|
-
export declare function buildIcon(icon?: string): import("react
|
|
26
|
+
export declare function buildIcon(icon?: string): import("react").JSX.Element;
|
|
27
27
|
export declare function deepMerge(target: any, ...sources: any[]): any;
|
|
28
28
|
export declare function prepareFilters(filter: any): string;
|
package/dist/utils.js
CHANGED
|
@@ -48,6 +48,7 @@ export function makeRequest(url, params = {}) {
|
|
|
48
48
|
return fetchUtils.fetchJson(url, Object.assign(Object.assign({}, opts), { headers: new Headers(Object.assign(Object.assign({}, requestHeaders), opts.headers)) }));
|
|
49
49
|
}
|
|
50
50
|
export function findIcon(icon) {
|
|
51
|
+
// biome-ignore lint/performance/noDynamicNamespaceImportAccess: icons are looked up by name from admin config
|
|
51
52
|
return icon ? icons[icon] : undefined;
|
|
52
53
|
}
|
|
53
54
|
export function buildIcon(icon) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VERSION = "13.0.0";
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const VERSION = "13.0.0";
|
package/dist/web.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "muffin-admin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"description": "NPM package for https://github.com/klen/muffin-admin",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -28,44 +28,30 @@
|
|
|
28
28
|
"ra-language-russian": "^5.4.4",
|
|
29
29
|
"react": "^19.1.1",
|
|
30
30
|
"react-admin": "^5.10.1",
|
|
31
|
-
"react-datepicker": "^
|
|
31
|
+
"react-datepicker": "^9.1.0",
|
|
32
32
|
"react-dom": "^19.1.1",
|
|
33
33
|
"validator": "^13.12.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
+
"@biomejs/biome": "^2.5.5",
|
|
36
37
|
"@types/lodash": "^4.17.20",
|
|
37
|
-
"@types/node": "
|
|
38
|
-
"@types/react": "19.
|
|
39
|
-
"@types/react-dom": "19.
|
|
40
|
-
"@types/react-window": "^
|
|
41
|
-
"@typescript-eslint/eslint-plugin": "^7.12.0",
|
|
42
|
-
"@typescript-eslint/parser": "^7.12.0",
|
|
38
|
+
"@types/node": "26.1.1",
|
|
39
|
+
"@types/react": "19.2.17",
|
|
40
|
+
"@types/react-dom": "19.2.3",
|
|
41
|
+
"@types/react-window": "^2.0.0",
|
|
43
42
|
"css-loader": "^7.1.2",
|
|
44
|
-
"dotenv": "^
|
|
45
|
-
"
|
|
46
|
-
"eslint-config-prettier": "^9.1.0",
|
|
47
|
-
"eslint-plugin-prettier": "^5.1.3",
|
|
48
|
-
"eslint-plugin-react": "^7.34.2",
|
|
43
|
+
"dotenv": "^17.4.2",
|
|
44
|
+
"esbuild-loader": "^4.5.0",
|
|
49
45
|
"html-webpack-plugin": "^5.6.0",
|
|
50
46
|
"husky": "^9.0.11",
|
|
51
|
-
"prettier": "^3.2",
|
|
52
|
-
"prettier-plugin-organize-imports": "^3.2",
|
|
53
47
|
"style-loader": "^4.0.0",
|
|
54
|
-
"
|
|
55
|
-
"typescript": "^5.4.5",
|
|
48
|
+
"typescript": "^7.0.2",
|
|
56
49
|
"webpack": "^5.91.0",
|
|
57
|
-
"webpack-cli": "^
|
|
58
|
-
"webpack-dev-server": "^
|
|
50
|
+
"webpack-cli": "^7.2.1",
|
|
51
|
+
"webpack-dev-server": "^6.0.0"
|
|
59
52
|
},
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"prettier-plugin-organize-imports"
|
|
64
|
-
],
|
|
65
|
-
"printWidth": 100,
|
|
66
|
-
"semi": false,
|
|
67
|
-
"tabWidth": 2,
|
|
68
|
-
"trailingComma": "es5",
|
|
69
|
-
"useTabs": false
|
|
53
|
+
"resolutions": {
|
|
54
|
+
"@mui/material": "^9.2.0",
|
|
55
|
+
"@mui/icons-material": "^9.2.0"
|
|
70
56
|
}
|
|
71
57
|
}
|
package/src/MuffinAdmin.tsx
CHANGED
|
@@ -3,20 +3,19 @@ import SvgIcon from "@mui/material/SvgIcon"
|
|
|
3
3
|
import Tooltip from "@mui/material/Tooltip"
|
|
4
4
|
|
|
5
5
|
import Typography from "@mui/material/Typography"
|
|
6
|
+
import { useEffect } from "react"
|
|
6
7
|
import {
|
|
7
8
|
AdminContext,
|
|
8
|
-
AdminProps,
|
|
9
|
+
type AdminProps,
|
|
9
10
|
AdminUI,
|
|
10
11
|
AppBar,
|
|
11
|
-
AppBarProps,
|
|
12
|
+
type AppBarProps,
|
|
12
13
|
Layout,
|
|
13
|
-
LayoutProps,
|
|
14
|
-
localStorageStore,
|
|
14
|
+
type LayoutProps,
|
|
15
15
|
Login,
|
|
16
|
-
LoginProps,
|
|
16
|
+
type LoginProps,
|
|
17
|
+
localStorageStore,
|
|
17
18
|
} from "react-admin"
|
|
18
|
-
|
|
19
|
-
import { useEffect } from "react"
|
|
20
19
|
import { ConfirmationProvider } from "./common"
|
|
21
20
|
import { useMuffinAdminOpts } from "./hooks"
|
|
22
21
|
import { buildProvider, muffinTranslations } from "./i18n"
|
package/src/MuffinDashboard.tsx
CHANGED
|
@@ -8,18 +8,18 @@ import TableCell from "@mui/material/TableCell"
|
|
|
8
8
|
import TableRow from "@mui/material/TableRow"
|
|
9
9
|
import Typography from "@mui/material/Typography"
|
|
10
10
|
import { useTranslate } from "react-admin"
|
|
11
|
-
import { VERSION } from "."
|
|
12
11
|
import { HelpLink } from "./common/HelpLink"
|
|
13
12
|
import { useMuffinAdminOpts } from "./hooks"
|
|
14
|
-
import { AdminDashboardBlock } from "./types"
|
|
13
|
+
import type { AdminDashboardBlock } from "./types"
|
|
15
14
|
import { buildAdmin, setupAdmin } from "./utils"
|
|
15
|
+
import { VERSION } from "./version"
|
|
16
16
|
|
|
17
17
|
export function MuffinDashboard() {
|
|
18
18
|
const { dashboard, help } = useMuffinAdminOpts()
|
|
19
19
|
const translate = useTranslate()
|
|
20
20
|
return (
|
|
21
|
-
<Stack
|
|
22
|
-
<Stack direction="row" flexWrap
|
|
21
|
+
<Stack sx={{ gap: 2, pt: 1 }}>
|
|
22
|
+
<Stack direction="row" sx={{ flexWrap: "wrap", gap: 1 }}>
|
|
23
23
|
{help && <HelpLink href={help} label={translate("muffin.how_to_use_admin")} />}
|
|
24
24
|
{buildAdmin(["dashboard-actions"])}
|
|
25
25
|
</Stack>
|
|
@@ -28,7 +28,7 @@ export function MuffinDashboard() {
|
|
|
28
28
|
<AdminCards src={dashboard} />
|
|
29
29
|
</Grid>
|
|
30
30
|
{VERSION && (
|
|
31
|
-
<Typography variant="body2" color="textSecondary" align="center"
|
|
31
|
+
<Typography variant="body2" color="textSecondary" align="center" sx={{ my: 1 }}>
|
|
32
32
|
Muffin Admin v.{VERSION}
|
|
33
33
|
</Typography>
|
|
34
34
|
)}
|
|
@@ -57,7 +57,7 @@ function DashboardCard({ title, value }: AdminDashboardBlock) {
|
|
|
57
57
|
return (
|
|
58
58
|
<Card>
|
|
59
59
|
<CardContent>
|
|
60
|
-
<Typography variant="h5" component="h2"
|
|
60
|
+
<Typography variant="h5" component="h2" sx={{ m: 2, textAlign: "center" }}>
|
|
61
61
|
{title}
|
|
62
62
|
</Typography>
|
|
63
63
|
{(Array.isArray(value) && <AdminTableView src={value} />) || (
|
package/src/MuffinMenu.tsx
CHANGED
|
@@ -4,15 +4,13 @@ import Collapse from "@mui/material/Collapse"
|
|
|
4
4
|
import ListItemButton from "@mui/material/ListItemButton"
|
|
5
5
|
import ListItemIcon from "@mui/material/ListItemIcon"
|
|
6
6
|
import ListItemText from "@mui/material/ListItemText"
|
|
7
|
-
import { matchPath, useLocation } from "react-router-dom"
|
|
8
|
-
|
|
9
|
-
import { Menu, MenuProps, useBasename, useTheme, useTranslate } from "react-admin"
|
|
10
|
-
|
|
11
7
|
import find from "lodash/find"
|
|
12
8
|
import groupBy from "lodash/groupBy"
|
|
13
9
|
import { useContext, useState } from "react"
|
|
10
|
+
import { Menu, type MenuProps, useBasename, useTheme, useTranslate } from "react-admin"
|
|
11
|
+
import { matchPath, useLocation } from "react-router-dom"
|
|
14
12
|
import { MuffinAdminContext } from "./context"
|
|
15
|
-
import { AdminResourceProps } from "./types"
|
|
13
|
+
import type { AdminResourceProps } from "./types"
|
|
16
14
|
import { findIcon, setupAdmin } from "./utils"
|
|
17
15
|
|
|
18
16
|
export function MuffinMenu(props: MenuProps) {
|
package/src/MuffinRecordList.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Box from "@mui/material/Box"
|
|
2
2
|
import Typography from "@mui/material/Typography"
|
|
3
|
-
import { Datagrid, SortPayload, useGetList, useRecordContext, useTranslate } from "react-admin"
|
|
3
|
+
import { Datagrid, type SortPayload, useGetList, useRecordContext, useTranslate } from "react-admin"
|
|
4
4
|
import { useMuffinResourceOpts } from "./hooks"
|
|
5
5
|
import { buildAdmin } from "./utils"
|
|
6
6
|
|
|
@@ -17,7 +17,7 @@ export function MuffinRecordList({ resource, filter, sort }: TProps) {
|
|
|
17
17
|
} = useMuffinResourceOpts(resource)
|
|
18
18
|
const { data, isPending } = useGetList(resource, { sort, filter: filter(record) })
|
|
19
19
|
return (
|
|
20
|
-
<Box
|
|
20
|
+
<Box sx={{ p: 2 }}>
|
|
21
21
|
<Typography variant="h6">
|
|
22
22
|
{translate(`resources.${resource}.name`, { smart_count: 2 })}
|
|
23
23
|
</Typography>
|
package/src/MuffinResource.tsx
CHANGED