-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
362d526
commit 285c428
Showing
9 changed files
with
266 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,55 @@ | ||
import map from '../../components/map'; | ||
export default map; | ||
import React, { useState } from 'react'; | ||
import { Modal, Drawer } from 'antd'; | ||
import { isObj } from '../../base/utils'; | ||
import Map from '../../components/map'; | ||
|
||
const MapWithModal = props => { | ||
const { options = {}, schema } = props || {}; | ||
const [show, setShow] = useState(false); | ||
const toggle = () => setShow(o => !o); | ||
if (options && options.modal) { | ||
const config = isObj(options.modal) ? options.modal : {}; | ||
const { text } = config; | ||
return ( | ||
<div> | ||
<a className="pointer" onClick={toggle}> | ||
{text && typeof text === 'string' ? '+ ' + text : '+ 配置'} | ||
</a> | ||
<Modal | ||
title={(schema && schema.title) || '子配置'} | ||
visible={show} | ||
onCancel={toggle} | ||
footer={null} | ||
width="80%" | ||
{...config} | ||
style={{ maxWidth: 800, ...config.style }} | ||
> | ||
<Map {...props} /> | ||
</Modal> | ||
</div> | ||
); | ||
} | ||
if (options && options.drawer) { | ||
const config = isObj(options.drawer) ? options.drawer : {}; | ||
const { text } = config; | ||
return ( | ||
<div> | ||
<a className="pointer" onClick={toggle}> | ||
{text && typeof text === 'string' ? '+ ' + text : '+ 配置'} | ||
</a> | ||
<Drawer | ||
title={(schema && schema.title) || '子配置'} | ||
visible={show} | ||
onClose={toggle} | ||
width="80%" | ||
{...config} | ||
> | ||
<Map {...props} /> | ||
</Drawer> | ||
</div> | ||
); | ||
} | ||
return <Map {...props} />; | ||
}; | ||
|
||
export default MapWithModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,54 @@ | ||
import map from '../../components/map'; | ||
export default map; | ||
import React, { useState } from 'react'; | ||
import { Dialog as Modal, Drawer } from '@alifd/next'; | ||
import { isObj } from '../../base/utils'; | ||
import Map from '../../components/map'; | ||
|
||
const MapWithModal = props => { | ||
const { options = {}, schema } = props || {}; | ||
const [show, setShow] = useState(false); | ||
const toggle = () => setShow(o => !o); | ||
if (options && options.modal) { | ||
const config = isObj(options.modal) ? options.modal : {}; | ||
const { text } = config; | ||
return ( | ||
<div> | ||
<a className="pointer" onClick={toggle}> | ||
{text && typeof text === 'string' ? '+ ' + text : '+ 配置'} | ||
</a> | ||
<Modal | ||
title={(schema && schema.title) || '子配置'} | ||
visible={show} | ||
onClose={toggle} | ||
footer={false} | ||
{...config} | ||
style={{ maxWidth: 800, width: '80%', ...config.style }} | ||
> | ||
<Map {...props} /> | ||
</Modal> | ||
</div> | ||
); | ||
} | ||
if (options && options.drawer) { | ||
const config = isObj(options.drawer) ? options.drawer : {}; | ||
const { text } = config; | ||
return ( | ||
<div> | ||
<a className="pointer" onClick={toggle}> | ||
{text && typeof text === 'string' ? '+ ' + text : '+ 配置'} | ||
</a> | ||
<Drawer | ||
title={(schema && schema.title) || '子配置'} | ||
visible={show} | ||
onClose={toggle} | ||
width="80%" | ||
{...config} | ||
> | ||
<Map {...props} /> | ||
</Drawer> | ||
</div> | ||
); | ||
} | ||
return <Map {...props} />; | ||
}; | ||
|
||
export default MapWithModal; |