diff --git a/src/components/breadcrumb/index.tsx b/src/components/breadcrumb/index.tsx
index 6bf3cf0..4f9c4d9 100644
--- a/src/components/breadcrumb/index.tsx
+++ b/src/components/breadcrumb/index.tsx
@@ -4,6 +4,8 @@ import { DownOutlined } from '@ant-design/icons'
import { getIcon } from '@/components/icon'
import { memo, useCallback } from 'react'
import { useStyle } from './style.ts'
+import { useSetAtom } from 'jotai'
+import { currentMenuAtom } from '@/store/system.ts'
export const PageBreadcrumb = memo((props: BreadcrumbProps & {
showIcon?: boolean;
@@ -12,6 +14,7 @@ export const PageBreadcrumb = memo((props: BreadcrumbProps & {
const { styles } = useStyle()
const nav = useNavigate()
+ const setCurrent = useSetAtom(currentMenuAtom)
const { items = [], showIcon = true, ...other } = props
const renderIcon = useCallback((icon: any) => {
@@ -26,7 +29,7 @@ export const PageBreadcrumb = memo((props: BreadcrumbProps & {
const isLast = route?.path === items[items.length - 1]?.path
if (route.children) {
- const items = route.children.map((item) => {
+ const items = route.children.filter(item => !(item.hidden || item.hidden_breadcrumb)).map((item) => {
return {
...item,
key: item.path || item.name,
@@ -41,9 +44,12 @@ export const PageBreadcrumb = memo((props: BreadcrumbProps & {
onClick: (menu) => {
const info = props.menusFlatten.current?.find(item => item.path === menu.key)
if (info) {
+ setCurrent(info)
// setOpenKeys([ info.path as string ])
nav({
to: info.path,
+ }).then(() => {
+
})
}
}
@@ -75,10 +81,9 @@ export const PageBreadcrumb = memo((props: BreadcrumbProps & {
)
}
-
return (
-
diff --git a/src/components/popconfirm/index.tsx b/src/components/popconfirm/index.tsx
new file mode 100644
index 0000000..697d297
--- /dev/null
+++ b/src/components/popconfirm/index.tsx
@@ -0,0 +1,21 @@
+import { Popconfirm as AntPopconfirm, PopconfirmProps } from 'antd'
+
+const Popconfirm = (props: PopconfirmProps) => {
+
+ const disabled = props.disabled
+
+ let attr = {}
+ if (typeof disabled !== 'undefined') {
+ attr = {
+ disabled: disabled
+ }
+ }
+
+ return (
+
+ {props.children}
+
+ )
+}
+
+export default Popconfirm
\ No newline at end of file
diff --git a/src/components/table/style.ts b/src/components/table/style.ts
index e6d24de..96e2cc9 100644
--- a/src/components/table/style.ts
+++ b/src/components/table/style.ts
@@ -34,6 +34,12 @@ export const useStyle = createStyles(({ token, css, cx, prefixCls }, props: any)
margin: 0;
align-content: center;
}
+
+ .ant-table-cell{
+ .ant-divider-vertical{
+ margin-inline: 0;
+ }
+ }
`
return {
diff --git a/src/global.d.ts b/src/global.d.ts
index 26ae21c..2ce9442 100644
--- a/src/global.d.ts
+++ b/src/global.d.ts
@@ -77,6 +77,7 @@ export interface IRootContext {
interface MenuItem extends IMenu {
routes?: MenuItem[];
+ parent?: IMenu
}
interface IAuth {
diff --git a/src/layout/ListPageLayout.tsx b/src/layout/ListPageLayout.tsx
index d1d1afd..aa36c84 100644
--- a/src/layout/ListPageLayout.tsx
+++ b/src/layout/ListPageLayout.tsx
@@ -1,10 +1,13 @@
import React from 'react'
import { useStyle } from '@/layout/style.ts'
import { PageContainer, PageContainerProps } from '@ant-design/pro-components'
-import { useAtomValue } from 'jotai'
+import { useAtom } from 'jotai'
import { currentMenuAtom } from '@/store/system.ts'
import useResizeObserver from '@/hooks/useResizeObserver.ts'
import useInlineStyle from '@/hooks/useInlineStyle.ts'
+import { Space } from 'antd'
+import { ArrowLeftOutlined } from '@ant-design/icons'
+import { useNavigate } from '@tanstack/react-router'
interface IListPageLayoutProps extends PageContainerProps {
children: React.ReactNode
@@ -13,15 +16,17 @@ interface IListPageLayoutProps extends PageContainerProps {
const ListPageLayout: React.FC
= (
{
- className, children, authHeight = true, ...props
+ className, children, authHeight = true, ...props
}) => {
+
+ const navigate = useNavigate()
const { styles, cx } = useStyle({ className: 'one-col' })
- const currentMenu = useAtomValue(currentMenuAtom)
+ const [ currentMenu, setCurrentMenu ] = useAtom(currentMenuAtom)
const [ , headerSize ] = useResizeObserver({
selector: '.ant-page-header',
})
- useInlineStyle({
+ useInlineStyle({
styles: {
'--pageHeader': `${headerSize.blockSize}px`,
},
@@ -33,7 +38,21 @@ const ListPageLayout: React.FC = (
+ {
+ currentMenu?.parent && {
+ navigate({
+ to: currentMenu?.parent?.path,
+ }).then(() => {
+ setCurrentMenu(currentMenu.parent!)
+ })
+ }}>
+ }
+ {currentMenu?.title}
+
+ }
className={cx(styles.container, styles.pageCard, styles.layoutTable, className)}
{...props}
diff --git a/src/layout/RootLayout.tsx b/src/layout/RootLayout.tsx
index 4fa11cd..0eb8c11 100644
--- a/src/layout/RootLayout.tsx
+++ b/src/layout/RootLayout.tsx
@@ -6,7 +6,7 @@ import { appAtom, currentMenuAtom } from '@/store/system.ts'
import { currentStaticUserAtom, userMenuDataAtom } from '@/store/system/user.ts'
import { MenuItem } from '@/global'
import { ProConfigProvider, ProLayout, } from '@ant-design/pro-components'
-import { zhCNIntl, enUSIntl } from '@ant-design/pro-provider/es/intl'
+import { enUSIntl, zhCNIntl } from '@ant-design/pro-provider/es/intl'
import { CatchBoundary, Link, Outlet, useNavigate } from '@tanstack/react-router'
import { ConfigProvider } from '@/components/config-provider'
import { useEffect, useRef, useState } from 'react'
@@ -55,18 +55,24 @@ export default () => {
const [ pathname, setPathname ] = useState(location.pathname)
const [ openMenuKeys, setOpenKeys ] = useState([])
const [ collapsed, setCollapsed ] = useState(false)
-
+ const [ childPath, setChildPath ] = useState('')
const menusFlatten = useRef