feat: 参考原型图 ui优化提交 企业端-企业中心 相关的页面
This commit is contained in:
@@ -109,7 +109,17 @@ export const Form = forwardRef(function Form(
|
||||
? 'inline'
|
||||
: 'vertical'
|
||||
}
|
||||
labelCol={labelWidth ? { flex: labelWidth } : undefined}
|
||||
labelCol={
|
||||
props.labelCol ??
|
||||
(labelWidth
|
||||
? {
|
||||
flex: `0 0 ${typeof labelWidth === 'number' ? `${labelWidth}px` : labelWidth}`,
|
||||
}
|
||||
: undefined)
|
||||
}
|
||||
wrapperCol={
|
||||
props.wrapperCol ?? (labelWidth ? { flex: '1 1 0' } : undefined)
|
||||
}
|
||||
labelAlign={labelAlign}
|
||||
onFinish={onSubmit}
|
||||
onFinishFailed={onSubmitFail}
|
||||
|
||||
@@ -20,7 +20,8 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
import React, { forwardRef } from 'react';
|
||||
import * as Ant from 'antd';
|
||||
import { controlSize, placement } from './controls';
|
||||
import { paginationEvents } from './pagination';
|
||||
import { paginationEvents, paginationShowTotal } from './pagination';
|
||||
import { overlayMaskClosable } from './overlayPolicy';
|
||||
|
||||
export * from './controls';
|
||||
export { Form, withField } from './form';
|
||||
@@ -124,7 +125,7 @@ export const Space = ({ spacing, vertical, size, ...props }) => (
|
||||
<Ant.Space
|
||||
{...props}
|
||||
direction={vertical ? 'vertical' : 'horizontal'}
|
||||
size={spacing ?? size}
|
||||
size={spacing === 'medium' ? 'middle' : (spacing ?? size)}
|
||||
/>
|
||||
);
|
||||
export const Divider = ({ margin, align, layout, style, ...props }) => (
|
||||
@@ -271,6 +272,7 @@ export function Table({
|
||||
current: pagination.currentPage ?? pagination.current,
|
||||
pageSizeOptions:
|
||||
pagination.pageSizeOpts ?? pagination.pageSizeOptions,
|
||||
showTotal: paginationShowTotal(pagination.showTotal),
|
||||
...paginationEvents(pagination),
|
||||
}
|
||||
: false
|
||||
@@ -301,7 +303,7 @@ export function Pagination({
|
||||
})}
|
||||
pageSizeOptions={pageSizeOpts ?? props.pageSizeOptions}
|
||||
size={size === 'small' ? 'small' : 'default'}
|
||||
showTotal={showTotal === true ? (total) => `${total}` : showTotal}
|
||||
showTotal={paginationShowTotal(showTotal)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -516,6 +518,7 @@ function modalProps({
|
||||
}) {
|
||||
return {
|
||||
...props,
|
||||
maskClosable: overlayMaskClosable(props.maskClosable),
|
||||
open: visible,
|
||||
title: header === null ? null : (props.title ?? header),
|
||||
keyboard: closeOnEsc,
|
||||
@@ -556,6 +559,7 @@ export const SideSheet = ({
|
||||
}) => (
|
||||
<Ant.Drawer
|
||||
{...props}
|
||||
maskClosable={overlayMaskClosable(props.maskClosable)}
|
||||
open={visible}
|
||||
onClose={onCancel}
|
||||
keyboard={closeOnEsc}
|
||||
@@ -681,6 +685,7 @@ export const Dropdown = Object.assign(
|
||||
|
||||
const NavItem = ({ children }) => children;
|
||||
const NavSub = ({ children }) => children;
|
||||
const NavGroup = ({ children }) => children;
|
||||
export const Nav = Object.assign(
|
||||
function Nav({
|
||||
children,
|
||||
@@ -701,6 +706,21 @@ export const Nav = Object.assign(
|
||||
return React.Children.toArray(nodes).flatMap((child, index) => {
|
||||
if (!React.isValidElement(child)) return [];
|
||||
const p = child.props;
|
||||
if (child.type === NavGroup) {
|
||||
const children = items(p.children, `${prefix}${p.itemKey}-`);
|
||||
if (children.length === 0) return [];
|
||||
// Collapsed menus keep their icon tooltips without group headings.
|
||||
if (isCollapsed) return children;
|
||||
return [
|
||||
{
|
||||
type: 'group',
|
||||
key: p.itemKey,
|
||||
label: p.text,
|
||||
className: p.className,
|
||||
children: p.folded ? [] : children,
|
||||
},
|
||||
];
|
||||
}
|
||||
if (child.type === NavItem || child.type === NavSub) {
|
||||
const label = renderWrapper
|
||||
? renderWrapper({ itemElement: <span>{p.text}</span>, props: p })
|
||||
@@ -736,5 +756,5 @@ export const Nav = Object.assign(
|
||||
/>
|
||||
);
|
||||
},
|
||||
{ Item: NavItem, Sub: NavSub },
|
||||
{ Item: NavItem, Sub: NavSub, Group: NavGroup },
|
||||
);
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
// Shared overlays also serve admin pages; apply the personal-page policy only
|
||||
// when rendering an overlay or opening an imperative confirmation on these routes.
|
||||
export function overlayMaskClosable(
|
||||
configured,
|
||||
pathname = globalThis.window?.location?.pathname ?? '',
|
||||
) {
|
||||
const scoped =
|
||||
pathname === '/market' ||
|
||||
pathname === '/market/' ||
|
||||
pathname === '/skill-market' ||
|
||||
pathname === '/skill-market/' ||
|
||||
pathname === '/user-center' ||
|
||||
pathname.startsWith('/user-center/');
|
||||
return scoped ? true : configured;
|
||||
}
|
||||
@@ -17,6 +17,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
// Legacy pagination accepts a boolean; Ant Design calls a renderer when enabled.
|
||||
export const paginationShowTotal = (showTotal) =>
|
||||
showTotal === true ? (total) => `${total}` : showTotal;
|
||||
|
||||
// Preserve the existing callback sequence while Ant Design owns presentation.
|
||||
export function paginationEvents({
|
||||
currentPage,
|
||||
|
||||
Reference in New Issue
Block a user