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.
@@ -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, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
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 (_jsx(ReferenceField, Object.assign({ source: source, link: link || "show", reference: reference, queryOptions: { meta: { key: refKey } } }, props, { children: _jsxs(_Fragment, { children: [_jsx(TextField, { source: refSource }), refSource !== refKey && (_jsxs(_Fragment, { children: [" (#", _jsx(TextField, { source: refKey }), ")"] }))] }) })));
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
@@ -19,4 +19,4 @@ export * from "./fields";
19
19
  export * from "./hooks";
20
20
  export * from "./types";
21
21
  export declare function initAdmin(prefix?: string, containerId?: string): Promise<void>;
22
- export declare const VERSION = "11.2.10";
22
+ export declare const VERSION = "11.2.11";
package/dist/index.js CHANGED
@@ -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 const VERSION = "11.2.10";
45
+ export const VERSION = "11.2.11";