@mantajs/dashboard 0.1.9 → 0.1.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/app.js +11 -16
- package/dist/app.mjs +1 -1
- package/dist/{chunk-DWLO2F7H.mjs → chunk-6AOXP3RP.mjs} +23 -19
- package/dist/{product-attributes-UJ4WTBZH.mjs → product-attributes-WOKHQSU3.mjs} +1 -1
- package/dist/{product-create-5HMCLMAO.mjs → product-create-T4PVLEL7.mjs} +1 -1
- package/dist/{product-detail-D2EGSWFF.mjs → product-detail-77R3VVI5.mjs} +1 -1
- package/dist/{product-edit-4HWE7N3O.mjs → product-edit-CPKK4QSD.mjs} +1 -1
- package/dist/{product-organization-2Q76MMR4.mjs → product-organization-BH5TZRYS.mjs} +1 -1
- package/dist/vite-plugin/index.d.mts +2 -1
- package/dist/vite-plugin/index.d.ts +2 -1
- package/dist/vite-plugin/index.js +1 -1
- package/dist/vite-plugin/index.mjs +1 -1
- package/package.json +2 -1
- package/src/components/layout/main-layout/main-layout.tsx +16 -13
- package/src/vite-plugin/index.ts +1 -1
- package/src/vite-plugin/types.ts +3 -1
package/dist/app.js
CHANGED
|
@@ -100375,11 +100375,10 @@ var init_user_menu2 = __esm({
|
|
|
100375
100375
|
});
|
|
100376
100376
|
|
|
100377
100377
|
// src/components/layout/main-layout/main-layout.tsx
|
|
100378
|
-
var
|
|
100378
|
+
var import_icons10, import_ui14, import_radix_ui5, import_react_i18next10, import_react_router_dom9, import_menu_config, import_jsx_runtime22, MainLayout, MainSidebar, Logout2, Header, getDefaultMedusaRoutes, useCoreRoutes, Searchbar, CoreRouteSection, getMainMenuPaths, MAIN_MENU_PATHS, ExtensionRouteSection, UtilitySection, UserSection;
|
|
100379
100379
|
var init_main_layout = __esm({
|
|
100380
100380
|
"src/components/layout/main-layout/main-layout.tsx"() {
|
|
100381
100381
|
"use strict";
|
|
100382
|
-
MedusaIcons = __toESM(require("@medusajs/icons"));
|
|
100383
100382
|
import_icons10 = require("@medusajs/icons");
|
|
100384
100383
|
import_ui14 = require("@medusajs/ui");
|
|
100385
100384
|
import_radix_ui5 = require("radix-ui");
|
|
@@ -100397,10 +100396,6 @@ var init_main_layout = __esm({
|
|
|
100397
100396
|
init_use_document_direction();
|
|
100398
100397
|
import_menu_config = __toESM(require("virtual:dashboard/menu-config"));
|
|
100399
100398
|
import_jsx_runtime22 = require("react/jsx-runtime");
|
|
100400
|
-
getIcon = (name) => {
|
|
100401
|
-
const IconComponent = MedusaIcons[name] || MedusaIcons.SquaresPlus;
|
|
100402
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(IconComponent, {});
|
|
100403
|
-
};
|
|
100404
100399
|
MainLayout = () => {
|
|
100405
100400
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Shell, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(MainSidebar, {}) });
|
|
100406
100401
|
};
|
|
@@ -100505,7 +100500,7 @@ var init_main_layout = __esm({
|
|
|
100505
100500
|
] }),
|
|
100506
100501
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_ui14.DropdownMenu.Separator, {}),
|
|
100507
100502
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_ui14.DropdownMenu.Item, { className: "gap-x-2", asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react_router_dom9.Link, { to: "/settings/store", children: [
|
|
100508
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BuildingStorefront, { className: "text-ui-fg-subtle" }),
|
|
100503
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons10.BuildingStorefront, { className: "text-ui-fg-subtle" }),
|
|
100509
100504
|
t5("app.nav.main.storeSettings")
|
|
100510
100505
|
] }) }),
|
|
100511
100506
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_ui14.DropdownMenu.Separator, {}),
|
|
@@ -100516,21 +100511,21 @@ var init_main_layout = __esm({
|
|
|
100516
100511
|
) });
|
|
100517
100512
|
};
|
|
100518
100513
|
getDefaultMedusaRoutes = (t5) => [
|
|
100519
|
-
{ icon:
|
|
100520
|
-
{ icon:
|
|
100514
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons10.ShoppingCart, {}), label: t5("orders.domain"), to: "/orders", items: [] },
|
|
100515
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons10.Tag, {}), label: t5("products.domain"), to: "/products", items: [
|
|
100521
100516
|
{ label: t5("collections.domain"), to: "/collections" },
|
|
100522
100517
|
{ label: t5("categories.domain"), to: "/categories" }
|
|
100523
100518
|
] },
|
|
100524
|
-
{ icon:
|
|
100519
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons10.Buildings, {}), label: t5("inventory.domain"), to: "/inventory", items: [
|
|
100525
100520
|
{ label: t5("reservations.domain"), to: "/reservations" }
|
|
100526
100521
|
] },
|
|
100527
|
-
{ icon:
|
|
100522
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons10.Users, {}), label: t5("customers.domain"), to: "/customers", items: [
|
|
100528
100523
|
{ label: t5("customerGroups.domain"), to: "/customer-groups" }
|
|
100529
100524
|
] },
|
|
100530
|
-
{ icon:
|
|
100525
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons10.ReceiptPercent, {}), label: t5("promotions.domain"), to: "/promotions", items: [
|
|
100531
100526
|
{ label: t5("campaigns.domain"), to: "/campaigns" }
|
|
100532
100527
|
] },
|
|
100533
|
-
{ icon:
|
|
100528
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons10.CurrencyDollar, {}), label: t5("priceLists.domain"), to: "/price-lists" }
|
|
100534
100529
|
];
|
|
100535
100530
|
useCoreRoutes = () => {
|
|
100536
100531
|
const { t: t5 } = (0, import_react_i18next10.useTranslation)();
|
|
@@ -100538,7 +100533,7 @@ var init_main_layout = __esm({
|
|
|
100538
100533
|
return getDefaultMedusaRoutes(t5);
|
|
100539
100534
|
}
|
|
100540
100535
|
return import_menu_config.default.items.map((item) => ({
|
|
100541
|
-
icon:
|
|
100536
|
+
icon: item.icon,
|
|
100542
100537
|
label: item.useTranslation ? t5(item.label) : item.label,
|
|
100543
100538
|
to: item.to,
|
|
100544
100539
|
items: item.items?.map((sub2) => ({
|
|
@@ -100622,7 +100617,7 @@ var init_main_layout = __esm({
|
|
|
100622
100617
|
{
|
|
100623
100618
|
to: item.to,
|
|
100624
100619
|
label: item.label,
|
|
100625
|
-
icon: item.icon ? item.icon : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SquaresPlus, {}),
|
|
100620
|
+
icon: item.icon ? item.icon : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons10.SquaresPlus, {}),
|
|
100626
100621
|
items: item.items,
|
|
100627
100622
|
translationNs: item.translationNs,
|
|
100628
100623
|
type: "extension"
|
|
@@ -100642,7 +100637,7 @@ var init_main_layout = __esm({
|
|
|
100642
100637
|
label: t5("app.nav.settings.header"),
|
|
100643
100638
|
to: "/settings",
|
|
100644
100639
|
from: location.pathname,
|
|
100645
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CogSixTooth, {})
|
|
100640
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons10.CogSixTooth, {})
|
|
100646
100641
|
}
|
|
100647
100642
|
) });
|
|
100648
100643
|
};
|
package/dist/app.mjs
CHANGED
|
@@ -94515,13 +94515,21 @@ var ProtectedRoute = () => {
|
|
|
94515
94515
|
};
|
|
94516
94516
|
|
|
94517
94517
|
// src/components/layout/main-layout/main-layout.tsx
|
|
94518
|
-
import * as MedusaIcons from "@medusajs/icons";
|
|
94519
94518
|
import {
|
|
94519
|
+
BuildingStorefront,
|
|
94520
|
+
Buildings,
|
|
94520
94521
|
ChevronDownMini,
|
|
94522
|
+
CogSixTooth,
|
|
94523
|
+
CurrencyDollar,
|
|
94521
94524
|
EllipsisHorizontal as EllipsisHorizontal2,
|
|
94522
94525
|
MagnifyingGlass as MagnifyingGlass2,
|
|
94523
94526
|
MinusMini,
|
|
94524
|
-
OpenRectArrowOut as OpenRectArrowOut2
|
|
94527
|
+
OpenRectArrowOut as OpenRectArrowOut2,
|
|
94528
|
+
ReceiptPercent,
|
|
94529
|
+
ShoppingCart,
|
|
94530
|
+
SquaresPlus,
|
|
94531
|
+
Tag,
|
|
94532
|
+
Users
|
|
94525
94533
|
} from "@medusajs/icons";
|
|
94526
94534
|
import { Avatar as Avatar2, Divider, DropdownMenu as DropdownMenu3, Text as Text5, clx as clx6 } from "@medusajs/ui";
|
|
94527
94535
|
import { Collapsible as RadixCollapsible2 } from "radix-ui";
|
|
@@ -95386,10 +95394,6 @@ var UserItem = () => {
|
|
|
95386
95394
|
// src/components/layout/main-layout/main-layout.tsx
|
|
95387
95395
|
import menuConfig from "virtual:dashboard/menu-config";
|
|
95388
95396
|
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
95389
|
-
var getIcon = (name) => {
|
|
95390
|
-
const IconComponent = MedusaIcons[name] || MedusaIcons.SquaresPlus;
|
|
95391
|
-
return /* @__PURE__ */ jsx13(IconComponent, {});
|
|
95392
|
-
};
|
|
95393
95397
|
var MainLayout = () => {
|
|
95394
95398
|
return /* @__PURE__ */ jsx13(Shell, { children: /* @__PURE__ */ jsx13(MainSidebar, {}) });
|
|
95395
95399
|
};
|
|
@@ -95505,21 +95509,21 @@ var Header = () => {
|
|
|
95505
95509
|
) });
|
|
95506
95510
|
};
|
|
95507
95511
|
var getDefaultMedusaRoutes = (t2) => [
|
|
95508
|
-
{ icon:
|
|
95509
|
-
{ icon:
|
|
95512
|
+
{ icon: /* @__PURE__ */ jsx13(ShoppingCart, {}), label: t2("orders.domain"), to: "/orders", items: [] },
|
|
95513
|
+
{ icon: /* @__PURE__ */ jsx13(Tag, {}), label: t2("products.domain"), to: "/products", items: [
|
|
95510
95514
|
{ label: t2("collections.domain"), to: "/collections" },
|
|
95511
95515
|
{ label: t2("categories.domain"), to: "/categories" }
|
|
95512
95516
|
] },
|
|
95513
|
-
{ icon:
|
|
95517
|
+
{ icon: /* @__PURE__ */ jsx13(Buildings, {}), label: t2("inventory.domain"), to: "/inventory", items: [
|
|
95514
95518
|
{ label: t2("reservations.domain"), to: "/reservations" }
|
|
95515
95519
|
] },
|
|
95516
|
-
{ icon:
|
|
95520
|
+
{ icon: /* @__PURE__ */ jsx13(Users, {}), label: t2("customers.domain"), to: "/customers", items: [
|
|
95517
95521
|
{ label: t2("customerGroups.domain"), to: "/customer-groups" }
|
|
95518
95522
|
] },
|
|
95519
|
-
{ icon:
|
|
95523
|
+
{ icon: /* @__PURE__ */ jsx13(ReceiptPercent, {}), label: t2("promotions.domain"), to: "/promotions", items: [
|
|
95520
95524
|
{ label: t2("campaigns.domain"), to: "/campaigns" }
|
|
95521
95525
|
] },
|
|
95522
|
-
{ icon:
|
|
95526
|
+
{ icon: /* @__PURE__ */ jsx13(CurrencyDollar, {}), label: t2("priceLists.domain"), to: "/price-lists" }
|
|
95523
95527
|
];
|
|
95524
95528
|
var useCoreRoutes = () => {
|
|
95525
95529
|
const { t: t2 } = useTranslation9();
|
|
@@ -95527,7 +95531,7 @@ var useCoreRoutes = () => {
|
|
|
95527
95531
|
return getDefaultMedusaRoutes(t2);
|
|
95528
95532
|
}
|
|
95529
95533
|
return menuConfig.items.map((item) => ({
|
|
95530
|
-
icon:
|
|
95534
|
+
icon: item.icon,
|
|
95531
95535
|
label: item.useTranslation ? t2(item.label) : item.label,
|
|
95532
95536
|
to: item.to,
|
|
95533
95537
|
items: item.items?.map((sub) => ({
|
|
@@ -95946,7 +95950,7 @@ function getRouteMap({
|
|
|
95946
95950
|
children: [
|
|
95947
95951
|
{
|
|
95948
95952
|
path: "create",
|
|
95949
|
-
lazy: () => import("./product-create-
|
|
95953
|
+
lazy: () => import("./product-create-T4PVLEL7.mjs")
|
|
95950
95954
|
},
|
|
95951
95955
|
{
|
|
95952
95956
|
path: "import",
|
|
@@ -95962,7 +95966,7 @@ function getRouteMap({
|
|
|
95962
95966
|
path: ":id",
|
|
95963
95967
|
errorElement: /* @__PURE__ */ jsx17(ErrorBoundary, {}),
|
|
95964
95968
|
lazy: async () => {
|
|
95965
|
-
const { Breadcrumb, loader } = await import("./product-detail-
|
|
95969
|
+
const { Breadcrumb, loader } = await import("./product-detail-77R3VVI5.mjs");
|
|
95966
95970
|
return {
|
|
95967
95971
|
Component: Outlet4,
|
|
95968
95972
|
loader,
|
|
@@ -95974,11 +95978,11 @@ function getRouteMap({
|
|
|
95974
95978
|
children: [
|
|
95975
95979
|
{
|
|
95976
95980
|
path: "",
|
|
95977
|
-
lazy: () => import("./product-detail-
|
|
95981
|
+
lazy: () => import("./product-detail-77R3VVI5.mjs"),
|
|
95978
95982
|
children: [
|
|
95979
95983
|
{
|
|
95980
95984
|
path: "edit",
|
|
95981
|
-
lazy: () => import("./product-edit-
|
|
95985
|
+
lazy: () => import("./product-edit-CPKK4QSD.mjs")
|
|
95982
95986
|
},
|
|
95983
95987
|
{
|
|
95984
95988
|
path: "edit-variant",
|
|
@@ -95990,11 +95994,11 @@ function getRouteMap({
|
|
|
95990
95994
|
},
|
|
95991
95995
|
{
|
|
95992
95996
|
path: "attributes",
|
|
95993
|
-
lazy: () => import("./product-attributes-
|
|
95997
|
+
lazy: () => import("./product-attributes-WOKHQSU3.mjs")
|
|
95994
95998
|
},
|
|
95995
95999
|
{
|
|
95996
96000
|
path: "organization",
|
|
95997
|
-
lazy: () => import("./product-organization-
|
|
96001
|
+
lazy: () => import("./product-organization-BH5TZRYS.mjs")
|
|
95998
96002
|
},
|
|
95999
96003
|
{
|
|
96000
96004
|
path: "shipping-profile",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
2
3
|
|
|
3
4
|
type MenuNestedItem = {
|
|
4
5
|
label: string;
|
|
@@ -6,7 +7,7 @@ type MenuNestedItem = {
|
|
|
6
7
|
useTranslation?: boolean;
|
|
7
8
|
};
|
|
8
9
|
type MenuItem = {
|
|
9
|
-
icon:
|
|
10
|
+
icon: ReactNode;
|
|
10
11
|
label: string;
|
|
11
12
|
to: string;
|
|
12
13
|
useTranslation?: boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
2
3
|
|
|
3
4
|
type MenuNestedItem = {
|
|
4
5
|
label: string;
|
|
@@ -6,7 +7,7 @@ type MenuNestedItem = {
|
|
|
6
7
|
useTranslation?: boolean;
|
|
7
8
|
};
|
|
8
9
|
type MenuItem = {
|
|
9
|
-
icon:
|
|
10
|
+
icon: ReactNode;
|
|
10
11
|
label: string;
|
|
11
12
|
to: string;
|
|
12
13
|
useTranslation?: boolean;
|
|
@@ -53,7 +53,7 @@ function menuConfigPlugin() {
|
|
|
53
53
|
load(id) {
|
|
54
54
|
if (id !== RESOLVED_ID) return;
|
|
55
55
|
const basePath = import_path.default.resolve(process.cwd(), "src/admin/menu.config");
|
|
56
|
-
for (const ext of [".ts", ".js", ".mts", ".mjs"]) {
|
|
56
|
+
for (const ext of [".tsx", ".ts", ".jsx", ".js", ".mts", ".mjs"]) {
|
|
57
57
|
if (import_fs.default.existsSync(basePath + ext)) {
|
|
58
58
|
return `export { default } from "${basePath + ext}"`;
|
|
59
59
|
}
|
|
@@ -19,7 +19,7 @@ function menuConfigPlugin() {
|
|
|
19
19
|
load(id) {
|
|
20
20
|
if (id !== RESOLVED_ID) return;
|
|
21
21
|
const basePath = path.resolve(process.cwd(), "src/admin/menu.config");
|
|
22
|
-
for (const ext of [".ts", ".js", ".mts", ".mjs"]) {
|
|
22
|
+
for (const ext of [".tsx", ".ts", ".jsx", ".js", ".mts", ".mjs"]) {
|
|
23
23
|
if (fs.existsSync(basePath + ext)) {
|
|
24
24
|
return `export { default } from "${basePath + ext}"`;
|
|
25
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mantajs/dashboard",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "B2B Admin Dashboard for Medusa - Fork of @medusajs/dashboard",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite",
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
"@medusajs/types": "2.13.1",
|
|
85
85
|
"@medusajs/ui-preset": "2.13.1",
|
|
86
86
|
"@types/node": "^20.0.0",
|
|
87
|
+
"@types/react": "^19.2.13",
|
|
87
88
|
"@vitejs/plugin-react": "^4.0.0",
|
|
88
89
|
"autoprefixer": "^10.4.16",
|
|
89
90
|
"postcss": "^8.4.31",
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import * as MedusaIcons from "@medusajs/icons"
|
|
2
1
|
import {
|
|
2
|
+
BuildingStorefront,
|
|
3
|
+
Buildings,
|
|
3
4
|
ChevronDownMini,
|
|
5
|
+
CogSixTooth,
|
|
6
|
+
CurrencyDollar,
|
|
4
7
|
EllipsisHorizontal,
|
|
5
8
|
MagnifyingGlass,
|
|
6
9
|
MinusMini,
|
|
7
10
|
OpenRectArrowOut,
|
|
11
|
+
ReceiptPercent,
|
|
12
|
+
ShoppingCart,
|
|
13
|
+
SquaresPlus,
|
|
14
|
+
Tag,
|
|
15
|
+
Users,
|
|
8
16
|
} from "@medusajs/icons"
|
|
9
17
|
import { Avatar, Divider, DropdownMenu, Text, clx } from "@medusajs/ui"
|
|
10
18
|
import { Collapsible as RadixCollapsible } from "radix-ui"
|
|
@@ -25,11 +33,6 @@ import { useDocumentDirection } from "../../../hooks/use-document-direction"
|
|
|
25
33
|
import menuConfig from "virtual:dashboard/menu-config"
|
|
26
34
|
import type { MenuConfig } from "../../../vite-plugin/types"
|
|
27
35
|
|
|
28
|
-
const getIcon = (name: string): React.ReactNode => {
|
|
29
|
-
const IconComponent = (MedusaIcons as any)[name] || MedusaIcons.SquaresPlus
|
|
30
|
-
return <IconComponent />
|
|
31
|
-
}
|
|
32
|
-
|
|
33
36
|
export const MainLayout = () => {
|
|
34
37
|
return (
|
|
35
38
|
<Shell>
|
|
@@ -177,21 +180,21 @@ const Header = () => {
|
|
|
177
180
|
}
|
|
178
181
|
|
|
179
182
|
const getDefaultMedusaRoutes = (t: (key: string) => string): Omit<INavItem, "pathname">[] => [
|
|
180
|
-
{ icon:
|
|
181
|
-
{ icon:
|
|
183
|
+
{ icon: <ShoppingCart />, label: t("orders.domain"), to: "/orders", items: [] },
|
|
184
|
+
{ icon: <Tag />, label: t("products.domain"), to: "/products", items: [
|
|
182
185
|
{ label: t("collections.domain"), to: "/collections" },
|
|
183
186
|
{ label: t("categories.domain"), to: "/categories" },
|
|
184
187
|
]},
|
|
185
|
-
{ icon:
|
|
188
|
+
{ icon: <Buildings />, label: t("inventory.domain"), to: "/inventory", items: [
|
|
186
189
|
{ label: t("reservations.domain"), to: "/reservations" },
|
|
187
190
|
]},
|
|
188
|
-
{ icon:
|
|
191
|
+
{ icon: <Users />, label: t("customers.domain"), to: "/customers", items: [
|
|
189
192
|
{ label: t("customerGroups.domain"), to: "/customer-groups" },
|
|
190
193
|
]},
|
|
191
|
-
{ icon:
|
|
194
|
+
{ icon: <ReceiptPercent />, label: t("promotions.domain"), to: "/promotions", items: [
|
|
192
195
|
{ label: t("campaigns.domain"), to: "/campaigns" },
|
|
193
196
|
]},
|
|
194
|
-
{ icon:
|
|
197
|
+
{ icon: <CurrencyDollar />, label: t("priceLists.domain"), to: "/price-lists" },
|
|
195
198
|
]
|
|
196
199
|
|
|
197
200
|
const useCoreRoutes = (): Omit<INavItem, "pathname">[] => {
|
|
@@ -202,7 +205,7 @@ const useCoreRoutes = (): Omit<INavItem, "pathname">[] => {
|
|
|
202
205
|
}
|
|
203
206
|
|
|
204
207
|
return (menuConfig as MenuConfig).items.map((item) => ({
|
|
205
|
-
icon:
|
|
208
|
+
icon: item.icon,
|
|
206
209
|
label: item.useTranslation ? t(item.label) : item.label,
|
|
207
210
|
to: item.to,
|
|
208
211
|
items: item.items?.map((sub) => ({
|
package/src/vite-plugin/index.ts
CHANGED
|
@@ -21,7 +21,7 @@ export function menuConfigPlugin(): Plugin {
|
|
|
21
21
|
load(id) {
|
|
22
22
|
if (id !== RESOLVED_ID) return
|
|
23
23
|
const basePath = path.resolve(process.cwd(), "src/admin/menu.config")
|
|
24
|
-
for (const ext of [".ts", ".js", ".mts", ".mjs"]) {
|
|
24
|
+
for (const ext of [".tsx", ".ts", ".jsx", ".js", ".mts", ".mjs"]) {
|
|
25
25
|
if (fs.existsSync(basePath + ext)) {
|
|
26
26
|
return `export { default } from "${basePath + ext}"`
|
|
27
27
|
}
|
package/src/vite-plugin/types.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ReactNode } from "react"
|
|
2
|
+
|
|
1
3
|
export type MenuNestedItem = {
|
|
2
4
|
label: string
|
|
3
5
|
to: string
|
|
@@ -5,7 +7,7 @@ export type MenuNestedItem = {
|
|
|
5
7
|
}
|
|
6
8
|
|
|
7
9
|
export type MenuItem = {
|
|
8
|
-
icon:
|
|
10
|
+
icon: ReactNode
|
|
9
11
|
label: string
|
|
10
12
|
to: string
|
|
11
13
|
useTranslation?: boolean
|