muffin-admin 11.2.10 → 11.2.11
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/fields/FKField.js +9 -3
- 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/fields/FKField.tsx +15 -11
- package/src/index.tsx +1 -1
package/dist/fields/FKField.js
CHANGED
|
@@ -9,11 +9,17 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx,
|
|
13
|
-
import { ReferenceField, TextField } from "react-admin";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
+
import { ReferenceField, TextField, useFieldValue } 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
16
|
refKey = refKey || "id";
|
|
17
|
-
return (
|
|
17
|
+
return (_jsxs(ReferenceField, Object.assign({ source: source, link: link || "show", reference: reference, queryOptions: { meta: { key: refKey } } }, props, { children: [_jsx(TextField, { source: refSource }), refSource !== refKey && _jsx(FKFieldValue, { source: refKey })] })));
|
|
18
|
+
}
|
|
19
|
+
function FKFieldValue(props) {
|
|
20
|
+
const value = useFieldValue(props);
|
|
21
|
+
if (value === undefined)
|
|
22
|
+
return null;
|
|
23
|
+
return (_jsxs(_Fragment, { children: [" (#", _jsx(TextField, Object.assign({}, props)), ")"] }));
|
|
18
24
|
}
|
|
19
25
|
FKField.displayName = "FKField";
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED