Initial import of weiyuan frontend
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
import React from 'react';
|
||||
import { Modal } from '@douyinfe/semi-ui';
|
||||
|
||||
/*
|
||||
* 企业中心统一弹窗包装。
|
||||
*
|
||||
* Semi Modal 渲染到 body 的 portal,企业中心的 .org-center 作用域样式
|
||||
* 够不着它,必须通过 className 挂载精修样式(styles/org.css 的 .org-modal,
|
||||
* 沿用 index.css 中 .notice-modal-enhanced 的先例模式)。
|
||||
* 企业中心所有 <Modal> 一律使用本组件,不要直接引 Semi Modal。
|
||||
*/
|
||||
const withOrgClass = (className) =>
|
||||
className ? `org-modal ${className}` : 'org-modal';
|
||||
|
||||
const OrgModal = ({ className, ...rest }) => (
|
||||
<Modal className={withOrgClass(className)} {...rest} />
|
||||
);
|
||||
|
||||
/* 命令式 API 同样注入 className(如 OrgModal.confirm({...})) */
|
||||
['confirm', 'info', 'success', 'warning', 'error'].forEach((method) => {
|
||||
OrgModal[method] = (config = {}) =>
|
||||
Modal[method]({ ...config, className: withOrgClass(config.className) });
|
||||
});
|
||||
OrgModal.destroyAll = Modal.destroyAll;
|
||||
|
||||
export default OrgModal;
|
||||
Reference in New Issue
Block a user