Skip to content

Commit c3dcac6

Browse files
authored
Merge pull request #2 from ballcat-projects/dev
Dev
2 parents 3cbde57 + 88cd81e commit c3dcac6

File tree

32 files changed

+820
-342
lines changed

32 files changed

+820
-342
lines changed

config/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@ export default defineConfig({
4747
},
4848
// Fast Refresh 热更新
4949
fastRefresh: {},
50+
extraBabelPlugins: ['react-activation/babel'],
5051
});

config/settings.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export type ProjectSetting = LayoutSettings & {
1010
defaultLocal: 'zh-CN' | 'en-US';
1111
// 是否展示水印
1212
waterMark: boolean;
13+
// 是否展示顶部多页签
14+
multiTab: boolean;
1315
storageOptions: {
1416
// 缓存key 前缀
1517
namespace: string;
@@ -33,6 +35,7 @@ const Settings: ProjectSetting = {
3335
historyType: 'hash',
3436
defaultLocal: 'zh-CN',
3537
waterMark: true,
38+
multiTab: true,
3639
storageOptions: {
3740
namespace: 'ballcat/',
3841
storage: 'local',

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"moment": "^2.25.3",
5050
"omit.js": "^2.0.2",
5151
"react": "^17.0.0",
52+
"react-activation": "^0.9.4",
5253
"react-color": "2.19.3",
5354
"react-cropper": "2.1.8",
5455
"react-dev-inspector": "^1.1.1",

src/components/Editor/WangEditor.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,16 @@ export default ({
2424
);
2525

2626
useEffect(() => {
27-
const we = new WangEditor(`#wang-editor-dom`);
27+
let we: WangEditor;
28+
29+
try {
30+
we = new WangEditor(`#wang-editor-dom`);
31+
} catch (e) {
32+
// 组件缓存时. 从有这个组件的页面切换出去会导致这里不停的报错. 找不到 wang-editor-dom Dom.
33+
// 这里捕获异常就不管了. 切换回来这个组件会重新渲染
34+
return () => {};
35+
}
36+
2837
setEditor(we);
2938
we.config.onchange = (val: string) => update(val);
3039

src/components/Form/FullForm.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,9 @@ import ProForm from '@ant-design/pro-form';
55
import type { R } from '@/typings';
66
import I18n from '@/utils/I18nUtils';
77
import type { FullFormProps } from '.';
8+
import { defautlTitle } from '.';
89
import { Button, Card } from 'antd';
910

10-
export const defautlTitle = {
11-
read: I18n.text('form.read'),
12-
edit: I18n.text('form.edit'),
13-
create: I18n.text('form.create'),
14-
del: I18n.text('form.del'),
15-
};
16-
1711
const FullForm = <E, P = E>(props: FullFormProps<E, P>) => {
1812
const {
1913
formRef: currencyRef,
@@ -65,7 +59,7 @@ const FullForm = <E, P = E>(props: FullFormProps<E, P>) => {
6559
req?: (body: P) => Promise<R<any>>,
6660
) => {
6761
if (req === undefined) {
68-
I18n.error({ key: 'orm.error.request', params: { title: defautlTitle[st] } });
62+
I18n.error({ key: 'form.error.request', params: { title: defautlTitle[st] } });
6963
return Promise.resolve(false);
7064
}
7165
setLoading(true);
@@ -121,10 +115,10 @@ const FullForm = <E, P = E>(props: FullFormProps<E, P>) => {
121115
];
122116
},
123117
}}
124-
{...antProps}
125118
layout="horizontal"
126119
labelCol={labelCol || { sm: { span: 24 }, md: { span: 4 } }}
127120
wrapperCol={wrapperCol}
121+
{...antProps}
128122
formRef={formRef}
129123
onFinish={async (values) => {
130124
switch (status) {

src/components/Form/ModalForm.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,7 @@ import type { ProFormInstance } from '@ant-design/pro-form';
44
import { ModalForm as AntdModalForm } from '@ant-design/pro-form';
55
import type { R } from '@/typings';
66
import I18n from '@/utils/I18nUtils';
7-
8-
export const defautlTitle = {
9-
read: I18n.text('form.read'),
10-
edit: I18n.text('form.edit'),
11-
create: I18n.text('form.create'),
12-
del: I18n.text('form.del'),
13-
};
7+
import { defautlTitle } from '.';
148

159
const ModalForm = <E, P = E>(props: ModalFormProps<E, P>) => {
1610
const {
@@ -45,7 +39,7 @@ const ModalForm = <E, P = E>(props: ModalFormProps<E, P>) => {
4539
req?: (body: P) => Promise<R<any>>,
4640
) => {
4741
if (req === undefined) {
48-
I18n.error({ key: 'orm.error.request', params: { title: defautlTitle[st] } });
42+
I18n.error({ key: 'form.error.request', params: { title: defautlTitle[st] } });
4943
return Promise.resolve(false);
5044
}
5145

@@ -95,13 +89,13 @@ const ModalForm = <E, P = E>(props: ModalFormProps<E, P>) => {
9589

9690
return (
9791
<AntdModalForm<E>
98-
{...antProps}
9992
width={width}
10093
layout="horizontal"
10194
labelCol={labelCol || { sm: { span: 24 }, md: { span: 4 } }}
10295
wrapperCol={wrapperCol}
103-
formRef={formRef}
10496
title={modalTitle}
97+
{...antProps}
98+
formRef={formRef}
10599
visible={visible}
106100
onVisibleChange={setVisible}
107101
onFinish={async (values) => {

src/components/Form/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import FormDictSelect from './dict/FormDictSelect';
44
import FormNumber from './FormNumber';
55
import FormGroup from './FormGroup';
66
import FormDictCheckbox from './dict/FormDictCheckbox';
7+
import I18n from '@/utils/I18nUtils';
78

89
export * from './typings';
910

@@ -18,4 +19,10 @@ const Form = {
1819

1920
export default Form;
2021

21-
export { ModalForm, FormDictRadio, FormDictSelect, FormNumber };
22+
const defautlTitle = {
23+
read: I18n.text('form.read'),
24+
edit: I18n.text('form.edit'),
25+
create: I18n.text('form.create'),
26+
del: I18n.text('form.del'),
27+
};
28+
export { ModalForm, FormDictRadio, FormDictSelect, FormNumber, defautlTitle };

src/components/Inline/index.less

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/components/Inline/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Component } from 'react';
2-
import './index.less';
32
import type { Route } from '@ant-design/pro-layout/lib/typings';
43

54
export type InlineMeta = {
@@ -25,7 +24,12 @@ class Inline extends Component<InlineProps, InlineState> {
2524
render() {
2625
const { meta } = this.state;
2726

28-
return <iframe className="iframe" src={meta.uri} />;
27+
return (
28+
<iframe
29+
style={{ boxSizing: 'border-box', height: '100%', width: '100%', border: '0' }}
30+
src={meta.uri}
31+
/>
32+
);
2933
}
3034
}
3135

src/components/Lov/Lov.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ for (let i = 0; i < keys.length; i += 1) {
1616
}
1717

1818
const Lov: React.FC<LovProps> = (props) => {
19-
const config = cache[props.keyword];
20-
const { value, onChange } = props;
19+
const { value, onChange, keyword, overwriteConfig } = props;
20+
const config = { ...cache[keyword], ...overwriteConfig };
2121
const [show, setShow] = useState<boolean>(false);
2222
const [lovValue, setLovValue] = useState<any>();
2323
const [modalKey, setModalKey] = useState<number>(1);

0 commit comments

Comments
 (0)