feat: update antd from 5.2.3 to 5.24.1 (#3593)

This commit is contained in:
WindSpiritSR 2025-02-18 20:54:10 +08:00 committed by GitHub
parent aa52af02b3
commit d61f9a1856
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 866 additions and 695 deletions

View File

@ -3,8 +3,8 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@ant-design/cssinjs": "^1.10.1", "@ant-design/cssinjs": "^1.23.0",
"@ant-design/icons": "^4.7.0", "@ant-design/icons": "^5.6.1",
"@craco/craco": "^6.4.5", "@craco/craco": "^6.4.5",
"@crowdin/cli": "^3.7.10", "@crowdin/cli": "^3.7.10",
"@ctrl/tinycolor": "^3.5.0", "@ctrl/tinycolor": "^3.5.0",
@ -23,8 +23,8 @@
"@web3-onboard/sequence": "^2.0.8", "@web3-onboard/sequence": "^2.0.8",
"@web3-onboard/taho": "^2.0.5", "@web3-onboard/taho": "^2.0.5",
"@web3-onboard/trust": "^2.0.4", "@web3-onboard/trust": "^2.0.4",
"antd": "5.2.3", "antd": "5.24.1",
"antd-token-previewer": "^1.1.0-22", "antd-token-previewer": "^2.0.8",
"buffer": "^6.0.3", "buffer": "^6.0.3",
"codemirror": "^6.0.1", "codemirror": "^6.0.1",
"copy-to-clipboard": "^3.3.1", "copy-to-clipboard": "^3.3.1",

View File

@ -327,7 +327,7 @@ class App extends Component {
isAiAssistantOpen: false, isAiAssistantOpen: false,
}); });
}} }}
visible={this.state.isAiAssistantOpen} open={this.state.isAiAssistantOpen}
> >
<iframe id="iframeHelper" title={"iframeHelper"} src={`${Conf.AiAssistantUrl}/?isRaw=1`} width="100%" height="100%" scrolling="no" frameBorder="no" /> <iframe id="iframeHelper" title={"iframeHelper"} src={`${Conf.AiAssistantUrl}/?isRaw=1`} width="100%" height="100%" scrolling="no" frameBorder="no" />
</Drawer> </Drawer>

View File

@ -58,6 +58,16 @@ img {
} }
} }
.org-select {
display: flex;
position: relative;
transform: translateY(50%);
margin: 0 10px !important;
float: right;
min-width: 120px;
max-width: 180px;
}
.rightDropDown { .rightDropDown {
display: flex; display: flex;
align-items: center; align-items: center;

View File

@ -121,10 +121,12 @@ class BaseListPage extends React.Component {
record[dataIndex] record[dataIndex]
? record[dataIndex].toString().toLowerCase().includes(value.toLowerCase()) ? record[dataIndex].toString().toLowerCase().includes(value.toLowerCase())
: "", : "",
onFilterDropdownOpenChange: visible => { filterDropdownProps: {
if (visible) { onOpenChange: visible => {
setTimeout(() => this.searchInput.select(), 100); if (visible) {
} setTimeout(() => this.searchInput.select(), 100);
}
},
}, },
render: (text, record, index) => { render: (text, record, index) => {
const highlightContent = this.state.searchedColumn === dataIndex ? ( const highlightContent = this.state.searchedColumn === dataIndex ? (
@ -173,7 +175,7 @@ class BaseListPage extends React.Component {
const steps = TourConfig.getSteps(); const steps = TourConfig.getSteps();
steps.map((item, index) => { steps.map((item, index) => {
if (!index) { if (!index) {
item.target = () => document.querySelector("table"); item.target = () => document.querySelector(".ant-table");
} else { } else {
item.target = () => document.getElementById(item.id) || null; item.target = () => document.getElementById(item.id) || null;
} }

View File

@ -19,8 +19,6 @@ import {Tabs} from "antd";
import i18next from "i18next"; import i18next from "i18next";
import Editor from "./common/Editor"; import Editor from "./common/Editor";
const {TabPane} = Tabs;
const CasbinEditor = ({model, onModelTextChange}) => { const CasbinEditor = ({model, onModelTextChange}) => {
const [activeKey, setActiveKey] = useState("advanced"); const [activeKey, setActiveKey] = useState("advanced");
const iframeRef = useRef(null); const iframeRef = useRef(null);
@ -66,10 +64,15 @@ const CasbinEditor = ({model, onModelTextChange}) => {
return ( return (
<div style={{height: "100%", width: "100%", display: "flex", flexDirection: "column"}}> <div style={{height: "100%", width: "100%", display: "flex", flexDirection: "column"}}>
<Tabs activeKey={activeKey} onChange={handleTabChange} style={{flex: "0 0 auto", marginTop: "-10px"}}> <Tabs
<TabPane tab={i18next.t("model:Basic Editor")} key="basic" /> activeKey={activeKey}
<TabPane tab={i18next.t("model:Advanced Editor")} key="advanced" /> onChange={handleTabChange}
</Tabs> style={{flex: "0 0 auto", marginTop: "-10px"}}
items={[
{key: "basic", label: i18next.t("model:Basic Editor")},
{key: "advanced", label: i18next.t("model:Advanced Editor")},
]}
/>
<div style={{flex: "1 1 auto", overflow: "hidden"}}> <div style={{flex: "1 1 auto", overflow: "hidden"}}>
{activeKey === "advanced" ? ( {activeKey === "advanced" ? (
<IframeEditor <IframeEditor

View File

@ -206,11 +206,11 @@ function ManagementPage(props) {
<OrganizationSelect <OrganizationSelect
initValue={Setting.getOrganization()} initValue={Setting.getOrganization()}
withAll={true} withAll={true}
style={{marginRight: "20px", width: "180px", display: !Setting.isMobile() ? "flex" : "none"}} className="org-select"
style={{display: Setting.isMobile() ? "none" : "flex"}}
onChange={(value) => { onChange={(value) => {
Setting.setOrganization(value); Setting.setOrganization(value);
}} }}
className="select-box"
/> />
} }
</React.Fragment> </React.Fragment>
@ -459,7 +459,7 @@ function ManagementPage(props) {
<Header style={{padding: "0", marginBottom: "3px", backgroundColor: props.themeAlgorithm.includes("dark") ? "black" : "white"}} > <Header style={{padding: "0", marginBottom: "3px", backgroundColor: props.themeAlgorithm.includes("dark") ? "black" : "white"}} >
{props.requiredEnableMfa || (Setting.isMobile() ? {props.requiredEnableMfa || (Setting.isMobile() ?
<React.Fragment> <React.Fragment>
<Drawer title={i18next.t("general:Close")} placement="left" visible={menuVisible} onClose={onClose}> <Drawer title={i18next.t("general:Close")} placement="left" open={menuVisible} onClose={onClose}>
<Menu <Menu
items={getMenuItems()} items={getMenuItems()}
mode={"inline"} mode={"inline"}

View File

@ -113,8 +113,8 @@ class PermissionListPage extends BaseListPage {
return ( return (
<Upload {...props}> <Upload {...props}>
<Button id="upload-button" type="primary" size="small"> <Button icon={<UploadOutlined />} id="upload-button" type="primary" size="small">
<UploadOutlined /> {i18next.t("user:Upload (.xlsx)")} {i18next.t("user:Upload (.xlsx)")}
</Button></Upload> </Button></Upload>
); );
} }

View File

@ -106,8 +106,8 @@ class RoleListPage extends BaseListPage {
return ( return (
<Upload {...props}> <Upload {...props}>
<Button type="primary" size="small"> <Button icon={<UploadOutlined />} type="primary" size="small">
<UploadOutlined /> {i18next.t("user:Upload (.xlsx)")} {i18next.t("user:Upload (.xlsx)")}
</Button> </Button>
</Upload> </Upload>
); );

View File

@ -188,8 +188,8 @@ class UserListPage extends BaseListPage {
return ( return (
<Upload {...props}> <Upload {...props}>
<Button id="upload-button" type="primary" size="small"> <Button icon={<UploadOutlined />} id="upload-button" type="primary" size="small">
<UploadOutlined /> {i18next.t("user:Upload (.xlsx)")} {i18next.t("user:Upload (.xlsx)")}
</Button> </Button>
</Upload> </Upload>
); );

View File

@ -471,9 +471,12 @@ class ForgetPage extends React.Component {
<React.Fragment> <React.Fragment>
<CustomGithubCorner /> <CustomGithubCorner />
<div className="forget-content" style={{padding: Setting.isMobile() ? "0" : null, boxShadow: Setting.isMobile() ? "none" : null}}> <div className="forget-content" style={{padding: Setting.isMobile() ? "0" : null, boxShadow: Setting.isMobile() ? "none" : null}}>
<Button type="text" style={{position: "relative", left: Setting.isMobile() ? "10px" : "-90px", top: 0}} size={"large"} onClick={() => {this.stepBack();}}> <Button type="text"
<ArrowLeftOutlined style={{fontSize: "24px"}} /> style={{position: "relative", left: Setting.isMobile() ? "10px" : "-90px", top: 0}}
</Button> icon={<ArrowLeftOutlined style={{fontSize: "24px"}} />}
size={"large"}
onClick={() => {this.stepBack();}}
/>
<Row> <Row>
<Col span={24} style={{justifyContent: "center"}}> <Col span={24} style={{justifyContent: "center"}}>
<Row> <Row>

View File

@ -530,9 +530,11 @@ class LoginPage extends React.Component {
return null; return null;
} }
const resultItemKey = `${application.organization}_${application.name}_${signinItem.name}`;
if (signinItem.name === "Logo") { if (signinItem.name === "Logo") {
return ( return (
<div className="login-logo-box"> <div key={resultItemKey} className="login-logo-box">
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} /> <div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
{ {
Setting.renderHelmet(application) Setting.renderHelmet(application)
@ -544,7 +546,7 @@ class LoginPage extends React.Component {
); );
} else if (signinItem.name === "Back button") { } else if (signinItem.name === "Back button") {
return ( return (
<div className="back-button"> <div key={resultItemKey} className="back-button">
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} /> <div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
{ {
this.renderBackButton() this.renderBackButton()
@ -562,14 +564,14 @@ class LoginPage extends React.Component {
} }
return ( return (
<div className="login-languages"> <div key={resultItemKey} className="login-languages">
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} /> <div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
<LanguageSelect languages={application.organizationObj.languages} /> <LanguageSelect languages={application.organizationObj.languages} />
</div> </div>
); );
} else if (signinItem.name === "Signin methods") { } else if (signinItem.name === "Signin methods") {
return ( return (
<div> <div key={resultItemKey}>
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} /> <div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
{this.renderMethodChoiceBox()} {this.renderMethodChoiceBox()}
</div> </div>
@ -577,7 +579,7 @@ class LoginPage extends React.Component {
; ;
} else if (signinItem.name === "Username") { } else if (signinItem.name === "Username") {
return ( return (
<div> <div key={resultItemKey}>
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} /> <div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
<Form.Item <Form.Item
name="username" name="username"
@ -654,14 +656,14 @@ class LoginPage extends React.Component {
); );
} else if (signinItem.name === "Password") { } else if (signinItem.name === "Password") {
return ( return (
<div> <div key={resultItemKey}>
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} /> <div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
{this.renderPasswordOrCodeInput(signinItem)} {this.renderPasswordOrCodeInput(signinItem)}
</div> </div>
); );
} else if (signinItem.name === "Forgot password?") { } else if (signinItem.name === "Forgot password?") {
return ( return (
<div> <div key={resultItemKey}>
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} /> <div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
<div className="login-forget-password"> <div className="login-forget-password">
<Form.Item name="autoSignin" valuePropName="checked" noStyle> <Form.Item name="autoSignin" valuePropName="checked" noStyle>
@ -679,7 +681,7 @@ class LoginPage extends React.Component {
return AgreementModal.isAgreementRequired(application) ? AgreementModal.renderAgreementFormItem(application, true, {}, this) : null; return AgreementModal.isAgreementRequired(application) ? AgreementModal.renderAgreementFormItem(application, true, {}, this) : null;
} else if (signinItem.name === "Login button") { } else if (signinItem.name === "Login button") {
return ( return (
<Form.Item className="login-button-box"> <Form.Item key={resultItemKey} className="login-button-box">
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} /> <div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
<Button <Button
type="primary" type="primary"
@ -723,13 +725,13 @@ class LoginPage extends React.Component {
} }
return ( return (
<div> <div key={resultItemKey}>
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} /> <div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
<Form.Item> <Form.Item>
{ {
application.providers.filter(providerItem => this.isProviderVisible(providerItem)).map((providerItem, id) => { application.providers.filter(providerItem => this.isProviderVisible(providerItem)).map((providerItem, id) => {
return ( return (
<span key ={id} onClick={(e) => { <span key={id} onClick={(e) => {
const agreementChecked = this.form.current.getFieldValue("agreement"); const agreementChecked = this.form.current.getFieldValue("agreement");
if (agreementChecked !== undefined && typeof agreementChecked === "boolean" && !agreementChecked) { if (agreementChecked !== undefined && typeof agreementChecked === "boolean" && !agreementChecked) {
@ -752,11 +754,11 @@ class LoginPage extends React.Component {
); );
} else if (signinItem.name.startsWith("Text ") || signinItem?.isCustom) { } else if (signinItem.name.startsWith("Text ") || signinItem?.isCustom) {
return ( return (
<div dangerouslySetInnerHTML={{__html: signinItem.customCss}} /> <div key={resultItemKey} dangerouslySetInnerHTML={{__html: signinItem.customCss}} />
); );
} else if (signinItem.name === "Signup link") { } else if (signinItem.name === "Signup link") {
return ( return (
<div style={{width: "100%"}} className="login-signup-link"> <div key={resultItemKey} style={{width: "100%"}} className="login-signup-link">
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} /> <div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
{this.renderFooter(application, signinItem)} {this.renderFooter(application, signinItem)}
</div> </div>

View File

@ -167,25 +167,35 @@ const Dashboard = (props) => {
}; };
myChart.setOption(option); myChart.setOption(option);
const cardStyles = {
body: {
width: Setting.isMobile() ? "340px" : "100%",
height: Setting.isMobile() ? "100px" : "150px",
display: "flex",
alignItems: "center",
justifyContent: "center",
},
};
return ( return (
<Row id="statistic" gutter={80} justify={"center"}> <Row id="statistic" gutter={80} justify={"center"}>
<Col span={50} style={{marginBottom: "10px"}}> <Col span={50} style={{marginBottom: "10px"}}>
<Card bordered={false} bodyStyle={{width: Setting.isMobile() ? "340px" : "100%", height: Setting.isMobile() ? "100px" : "150px", display: "flex", alignItems: "center", justifyContent: "center"}}> <Card variant="borderless" styles={cardStyles}>
<Statistic title={i18next.t("home:Total users")} fontSize="100px" value={dashboardData.userCounts[30]} valueStyle={{fontSize: "30px"}} style={{width: "200px", paddingLeft: "10px"}} /> <Statistic title={i18next.t("home:Total users")} fontSize="100px" value={dashboardData.userCounts[30]} valueStyle={{fontSize: "30px"}} style={{width: "200px", paddingLeft: "10px"}} />
</Card> </Card>
</Col> </Col>
<Col span={50} style={{marginBottom: "10px"}}> <Col span={50} style={{marginBottom: "10px"}}>
<Card bordered={false} bodyStyle={{width: Setting.isMobile() ? "340px" : "100%", height: Setting.isMobile() ? "100px" : "150px", display: "flex", alignItems: "center", justifyContent: "center"}}> <Card variant="borderless" styles={cardStyles}>
<Statistic title={i18next.t("home:New users today")} fontSize="100px" value={dashboardData.userCounts[30] - dashboardData.userCounts[30 - 1]} valueStyle={{fontSize: "30px"}} prefix={<ArrowUpOutlined />} style={{width: "200px", paddingLeft: "10px"}} /> <Statistic title={i18next.t("home:New users today")} fontSize="100px" value={dashboardData.userCounts[30] - dashboardData.userCounts[30 - 1]} valueStyle={{fontSize: "30px"}} prefix={<ArrowUpOutlined />} style={{width: "200px", paddingLeft: "10px"}} />
</Card> </Card>
</Col> </Col>
<Col span={50} style={{marginBottom: "10px"}}> <Col span={50} style={{marginBottom: "10px"}}>
<Card bordered={false} bodyStyle={{width: Setting.isMobile() ? "340px" : "100%", height: Setting.isMobile() ? "100px" : "150px", display: "flex", alignItems: "center", justifyContent: "center"}}> <Card variant="borderless" styles={cardStyles}>
<Statistic title={i18next.t("home:New users past 7 days")} value={dashboardData.userCounts[30] - dashboardData.userCounts[30 - 7]} valueStyle={{fontSize: "30px"}} prefix={<ArrowUpOutlined />} style={{width: "200px", paddingLeft: "10px"}} /> <Statistic title={i18next.t("home:New users past 7 days")} value={dashboardData.userCounts[30] - dashboardData.userCounts[30 - 7]} valueStyle={{fontSize: "30px"}} prefix={<ArrowUpOutlined />} style={{width: "200px", paddingLeft: "10px"}} />
</Card> </Card>
</Col> </Col>
<Col span={50} style={{marginBottom: "10px"}}> <Col span={50} style={{marginBottom: "10px"}}>
<Card bordered={false} bodyStyle={{width: Setting.isMobile() ? "340px" : "100%", height: Setting.isMobile() ? "100px" : "150px", display: "flex", alignItems: "center", justifyContent: "center"}}> <Card variant="borderless" styles={cardStyles}>
<Statistic title={i18next.t("home:New users past 30 days")} value={dashboardData.userCounts[30] - dashboardData.userCounts[30 - 30]} valueStyle={{fontSize: "30px"}} prefix={<ArrowUpOutlined />} style={{width: "200px", paddingLeft: "10px"}} /> <Statistic title={i18next.t("home:New users past 30 days")} value={dashboardData.userCounts[30] - dashboardData.userCounts[30 - 30]} valueStyle={{fontSize: "30px"}} prefix={<ArrowUpOutlined />} style={{width: "200px", paddingLeft: "10px"}} />
</Card> </Card>
</Col> </Col>

View File

@ -31,7 +31,7 @@ const GridCards = (props) => {
return ( return (
Setting.isMobile() ? ( Setting.isMobile() ? (
<Card bodyStyle={{padding: 0}}> <Card styles={{body: {padding: 0}}}>
{items.map(item => <SingleCard key={item.link} logo={item.logo} link={item.link} title={item.name} desc={item.description} isSingle={items.length === 1} />)} {items.map(item => <SingleCard key={item.link} logo={item.logo} link={item.link} title={item.name} desc={item.description} isSingle={items.length === 1} />)}
</Card> </Card>
) : ( ) : (

View File

@ -70,6 +70,7 @@ function OrganizationSelect(props) {
<Select <Select
options={getOrganizationItems()} options={getOrganizationItems()}
virtual={false} virtual={false}
popupMatchSelectWidth={false}
placeholder={i18next.t("login:Please select an organization")} placeholder={i18next.t("login:Please select an organization")}
value={value} value={value}
onChange={handleOnChange} onChange={handleOnChange}

View File

@ -147,7 +147,7 @@ class PricingPage extends React.Component {
if (Setting.isMobile()) { if (Setting.isMobile()) {
return ( return (
<Card style={{border: "none"}} bodyStyle={{padding: 0}}> <Card style={{border: "none"}} styles={{body: {padding: 0}}}>
{ {
this.state.plans.map(item => { this.state.plans.map(item => {
return item.period === this.state.selectedPeriod ? ( return item.period === this.state.selectedPeriod ? (

File diff suppressed because it is too large Load Diff