muffin-admin 8.3.0 → 8.4.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/buildRA.js +2 -1
- package/dist/buttons/CopyButton.d.ts +3 -0
- package/dist/buttons/CopyButton.js +13 -0
- package/dist/buttons/index.d.ts +1 -0
- package/dist/buttons/index.js +1 -0
- package/dist/fields/CopyField.d.ts +4 -0
- package/dist/fields/CopyField.js +23 -0
- package/dist/fields/index.d.ts +1 -0
- package/dist/fields/index.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/buildRA.tsx +2 -1
- package/src/buttons/CopyButton.tsx +24 -0
- package/src/buttons/index.ts +1 -0
- package/src/fields/CopyField.tsx +17 -0
- package/src/fields/index.ts +1 -0
- package/src/index.tsx +1 -1
package/dist/buildRA.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
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, required, RichTextField, SelectArrayInput, SelectField, SelectInput, TextField, TextInput, UrlField, } from "react-admin";
|
|
3
|
-
import { AvatarField, EditableBooleanField, FKField, JsonField } from "./fields";
|
|
3
|
+
import { AvatarField, CopyField, EditableBooleanField, FKField, JsonField } from "./fields";
|
|
4
4
|
import { FilterInput, FKInput, JsonInput, TimestampInput } from "./inputs";
|
|
5
5
|
const UI = {
|
|
6
6
|
// Fields
|
|
@@ -23,6 +23,7 @@ const UI = {
|
|
|
23
23
|
EditableBooleanField,
|
|
24
24
|
FKField,
|
|
25
25
|
JsonField,
|
|
26
|
+
CopyField,
|
|
26
27
|
// Inputs
|
|
27
28
|
ArrayInput,
|
|
28
29
|
AutocompleteArrayInput,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import CopyIcon from "@mui/icons-material/FileCopy";
|
|
3
|
+
import { Snackbar } from "@mui/material";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
export function CopyButton({ value }) {
|
|
6
|
+
const [open, setOpen] = useState(false);
|
|
7
|
+
const handleClick = (e) => {
|
|
8
|
+
setOpen(true);
|
|
9
|
+
navigator.clipboard.writeText(value);
|
|
10
|
+
e.stopPropagation();
|
|
11
|
+
};
|
|
12
|
+
return (_jsxs("span", { title: "Copy to clipboard", children: [_jsx(CopyIcon, { color: "info", fontSize: "small", onClick: handleClick, style: { cursor: "pointer" } }), _jsx(Snackbar, { open: open, autoHideDuration: 2000, onClose: () => setOpen(false), message: `Copied to clipboard: ${value}` })] }));
|
|
13
|
+
}
|
package/dist/buttons/index.d.ts
CHANGED
package/dist/buttons/index.js
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import get from "lodash/get";
|
|
14
|
+
import { useRecordContext } from "react-admin";
|
|
15
|
+
import { CopyButton } from "../buttons";
|
|
16
|
+
export function CopyField(_a) {
|
|
17
|
+
var { source } = _a, props = __rest(_a, ["source"]);
|
|
18
|
+
const record = useRecordContext(props);
|
|
19
|
+
const value = get(record, source);
|
|
20
|
+
if (!value)
|
|
21
|
+
return null;
|
|
22
|
+
return (_jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [_jsx("span", { children: value }), _jsx(CopyButton, { value: value })] }));
|
|
23
|
+
}
|
package/dist/fields/index.d.ts
CHANGED
package/dist/fields/index.js
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED