muffin-admin 9.0.0 → 9.1.1
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/MuffinDashboard.js +1 -0
- package/dist/filters/DateRangeFilter.d.ts +1 -2
- package/dist/filters/DateRangeFilter.js +1 -1
- package/dist/filters/Filter.d.ts +2 -1
- package/dist/filters/Filter.js +3 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/inputs/DateRangeInput.d.ts +3 -2
- package/dist/inputs/DateRangeInput.js +16 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/MuffinDashboard.tsx +1 -0
- package/src/filters/DateRangeFilter.tsx +3 -3
- package/src/filters/Filter.tsx +7 -2
- package/src/index.tsx +1 -1
- package/src/inputs/DateRangeInput.tsx +13 -4
package/dist/MuffinDashboard.js
CHANGED
|
@@ -19,6 +19,7 @@ export function MuffinDashboard() {
|
|
|
19
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] }))] }));
|
|
20
20
|
}
|
|
21
21
|
setupAdmin(["dashboard"], MuffinDashboard);
|
|
22
|
+
setupAdmin(["dashboard-actions"], () => null);
|
|
22
23
|
function AdminCards({ src }) {
|
|
23
24
|
if (Array.isArray(src))
|
|
24
25
|
return (_jsx(Grid, { container: true, item: true, spacing: 2, children: src.map((card, idx) => (_jsx(AdminCards, { src: card }, idx))) }));
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function DateRangeFilter(props: InputProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare function DateRangeFilter(props: any): import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,5 +13,5 @@ export function DateRangeFilter(props) {
|
|
|
13
13
|
if (!Array.isArray(filterValue))
|
|
14
14
|
filterValue = [null, null];
|
|
15
15
|
const value = filterValue.map((d) => (d ? new Date(d) : d));
|
|
16
|
-
return _jsx(DateRangeInput, { value: value, onChange: onChange });
|
|
16
|
+
return _jsx(DateRangeInput, Object.assign({ value: value, onChange: onChange }, props));
|
|
17
17
|
}
|
package/dist/filters/Filter.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { InputProps } from "react-admin";
|
|
2
|
+
export declare function Filter({ type, ...props }: InputProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/filters/Filter.js
CHANGED
|
@@ -16,7 +16,7 @@ import Menu from "@mui/material/Menu";
|
|
|
16
16
|
import MenuItem from "@mui/material/MenuItem";
|
|
17
17
|
import TextField from "@mui/material/TextField";
|
|
18
18
|
import { useState } from "react";
|
|
19
|
-
import { useInput } from "react-admin";
|
|
19
|
+
import { FieldTitle, useInput } from "react-admin";
|
|
20
20
|
const OPERATORS = {
|
|
21
21
|
$eq: "=",
|
|
22
22
|
$ne: "≠",
|
|
@@ -34,7 +34,8 @@ export function Filter(_a) {
|
|
|
34
34
|
};
|
|
35
35
|
const [menuEl, setMenuEl] = useState(null);
|
|
36
36
|
const open = Boolean(menuEl);
|
|
37
|
-
|
|
37
|
+
const { label, source, resource, isRequired } = props;
|
|
38
|
+
return (_jsxs(_Fragment, { children: [_jsxs(FormGroup, { row: true, sx: { flexWrap: "nowrap" }, children: [_jsx(Button, { size: "small", disableElevation: true, sx: { minWidth: 30 }, onClick: (e) => setMenuEl(e.currentTarget), children: _jsx("span", { style: { fontSize: "1.5em" }, children: OPERATORS[op] }) }), _jsx(TextField, Object.assign({}, field, { onChange: onChange, value: field.value, variant: "outlined", type: type, label: _jsx(FieldTitle, { label: label, source: source, resource: resource, isRequired: isRequired }) }))] }), _jsx(Menu, { open: open, onClose: () => setMenuEl(null), anchorEl: menuEl, children: Object.entries(OPERATORS).map(([key, value]) => (_jsx(MenuItem, { selected: op === value, onClick: () => {
|
|
38
39
|
setOp(key);
|
|
39
40
|
setMenuEl(null);
|
|
40
41
|
field.onChange({ [key]: field.value });
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { InputProps } from "react-admin";
|
|
1
2
|
import "react-datepicker/dist/react-datepicker.css";
|
|
2
|
-
type TProps = {
|
|
3
|
+
type TProps = InputProps & {
|
|
3
4
|
value: [Date, Date];
|
|
4
5
|
onChange: (value: [Date, Date]) => void;
|
|
5
6
|
};
|
|
6
|
-
export declare function DateRangeInput({ value, onChange }: TProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function DateRangeInput({ value, onChange, ...props }: TProps): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -1,13 +1,26 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
13
|
import TextField from "@mui/material/TextField";
|
|
3
14
|
import { enGB, ru } from "date-fns/locale";
|
|
4
|
-
import { useLocale } from "react-admin";
|
|
15
|
+
import { FieldTitle, useLocale } from "react-admin";
|
|
5
16
|
import DatePicker, { registerLocale } from "react-datepicker";
|
|
6
17
|
import "react-datepicker/dist/react-datepicker.css";
|
|
7
18
|
registerLocale("ru", ru);
|
|
8
19
|
registerLocale("en", enGB);
|
|
9
|
-
export function DateRangeInput(
|
|
20
|
+
export function DateRangeInput(_a) {
|
|
21
|
+
var { value, onChange } = _a, props = __rest(_a, ["value", "onChange"]);
|
|
10
22
|
const [startDate, endDate] = value;
|
|
11
23
|
const locale = useLocale();
|
|
12
|
-
|
|
24
|
+
const { label, source, resource, isRequired } = props;
|
|
25
|
+
return (_jsx(DatePicker, { withPortal: true, locale: locale, selectsRange: true, endDate: endDate, onChange: onChange, startDate: startDate, customInput: _jsx(TextField, { variant: "outlined", label: _jsx(FieldTitle, { label: label, source: source, resource: resource, isRequired: isRequired }) }) }));
|
|
13
26
|
}
|