muffin-admin 3.12.2 → 3.12.4
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.js +2 -2
- package/dist/actions/LinkAction.d.ts +1 -1
- package/dist/actions/LinkAction.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +21 -0
- package/package.json +1 -1
- package/src/MuffinAdmin.tsx +2 -2
- package/src/actions/LinkAction.tsx +2 -1
- package/src/utils.tsx +21 -0
package/dist/MuffinAdmin.js
CHANGED
|
@@ -7,7 +7,7 @@ import { AdminContext, AdminUI, AppBar, Layout, localStorageStore, Login, } from
|
|
|
7
7
|
import { ConfirmationProvider } from "./common";
|
|
8
8
|
import { useMuffinAdminOpts } from "./hooks";
|
|
9
9
|
import { buildProvider, muffinTranslations } from "./i18n";
|
|
10
|
-
import { buildAdmin, findBuilder, findIcon, setupAdmin } from "./utils";
|
|
10
|
+
import { buildAdmin, deepMerge, findBuilder, findIcon, setupAdmin } from "./utils";
|
|
11
11
|
export function MuffinAdmin(props) {
|
|
12
12
|
const opts = useMuffinAdminOpts();
|
|
13
13
|
const { resources = [], auth, adminProps, apiUrl, locales: backendLocales } = opts;
|
|
@@ -15,7 +15,7 @@ export function MuffinAdmin(props) {
|
|
|
15
15
|
const muffinI18nProvider = buildProvider(backendLocales
|
|
16
16
|
? Object.fromEntries(Object.entries(muffinTranslations).map(([locale, messages]) => [
|
|
17
17
|
locale,
|
|
18
|
-
|
|
18
|
+
deepMerge({}, messages, backendLocales[locale], buildAdmin(["locale", locale]) || {}),
|
|
19
19
|
]))
|
|
20
20
|
: muffinTranslations);
|
|
21
21
|
const { basename, authProvider = findBuilder(["authprovider"])(auth), dataProvider = findBuilder(["dataprovider"])(apiUrl), catchAll, dashboard = findBuilder(["dashboard"]), disableTelemetry, error, i18nProvider = muffinI18nProvider, layout = findBuilder(["layout"]), loading, loginPage = findBuilder(["loginpage"]), authCallbackPage, notification, queryClient, requireAuth = auth.required, store = localStorageStore(), ready, theme, lightTheme, darkTheme, defaultTheme, title = "React Admin", } = props;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { AdminShowLink } from "../types";
|
|
2
|
-
export declare function LinkAction({ field, icon, ...props }: AdminShowLink & {
|
|
2
|
+
export declare function LinkAction({ field, icon, label, ...props }: AdminShowLink & {
|
|
3
3
|
resource: string;
|
|
4
4
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,12 +14,12 @@ import { useRecordContext, useResourceContext } from "react-admin";
|
|
|
14
14
|
import LinkButton from "../buttons/LinkButton";
|
|
15
15
|
import { useMuffinAdminOpts } from "../hooks";
|
|
16
16
|
export function LinkAction(_a) {
|
|
17
|
-
var { field, icon } = _a, props = __rest(_a, ["field", "icon"]);
|
|
17
|
+
var { field, icon, label } = _a, props = __rest(_a, ["field", "icon", "label"]);
|
|
18
18
|
const { resources } = useMuffinAdminOpts();
|
|
19
19
|
const record = useRecordContext();
|
|
20
20
|
const currentResource = useResourceContext();
|
|
21
21
|
if (!record)
|
|
22
22
|
return null;
|
|
23
23
|
const resource = resources.find((r) => r.name === props.resource);
|
|
24
|
-
return (_jsx(LinkButton, Object.assign({}, props, { icon: icon || (resource === null || resource === void 0 ? void 0 : resource.icon), filters: { [currentResource]: encodeURIComponent(record[field || "id"]) } })));
|
|
24
|
+
return (_jsx(LinkButton, Object.assign({}, props, { icon: icon || (resource === null || resource === void 0 ? void 0 : resource.icon), label: label || `resources.${props.resource}.name`, filters: { [currentResource]: encodeURIComponent(record[field || "id"]) } })));
|
|
25
25
|
}
|