-
Notifications
You must be signed in to change notification settings - Fork 111
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
7a11fd4
commit 2a50d59
Showing
5 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
packages/gi-assets-basic/src/components/ShortcutKeys/Component.tsx
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import type { IGIAC } from '@antv/gi-sdk'; | ||
import { extra, useContext } from '@antv/gi-sdk'; | ||
import React, { useState } from 'react'; | ||
|
||
import Desscription from './Description'; | ||
const { GIAComponent } = extra; | ||
export interface IProps { | ||
GIAC: IGIAC; | ||
} | ||
|
||
const ShortcutKeys: React.FunctionComponent<IProps> = props => { | ||
const { GIAC } = props; | ||
const { GISDK_ID } = useContext(); | ||
const [isModalOpen, setIsModalOpen] = useState(false); | ||
|
||
const showModal = () => { | ||
setIsModalOpen(true); | ||
}; | ||
|
||
const handleOk = () => { | ||
setIsModalOpen(false); | ||
}; | ||
|
||
const handleCancel = () => { | ||
setIsModalOpen(false); | ||
}; | ||
|
||
return ( | ||
<> | ||
<GIAComponent GIAC={GIAC} onClick={showModal} /> | ||
<Desscription isModalOpen={isModalOpen} handleOk={handleOk} handleCancel={handleCancel} /> | ||
</> | ||
); | ||
}; | ||
|
||
export default ShortcutKeys; |
49 changes: 49 additions & 0 deletions
49
packages/gi-assets-basic/src/components/ShortcutKeys/Description.tsx
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Icon } from '@antv/gi-sdk'; | ||
import { Col, Modal, Row } from 'antd'; | ||
import * as React from 'react'; | ||
|
||
interface DesscriptionProps { | ||
isModalOpen: boolean; | ||
handleCancel: () => void; | ||
handleOk: () => void; | ||
} | ||
|
||
const Desscription: React.FunctionComponent<DesscriptionProps> = props => { | ||
const { isModalOpen, handleCancel, handleOk } = props; | ||
|
||
return ( | ||
<Modal title="快捷键" open={isModalOpen} onOk={handleOk} onCancel={handleCancel}> | ||
<Row gutter={[12, 12]}> | ||
<Col span={12}> | ||
查询 <Icon type="icon-shortcut" /> F | ||
</Col> | ||
<Col span={12}> | ||
查询 <Icon type="icon-shortcut" /> F | ||
</Col> | ||
<Col span={12}> | ||
查询 <Icon type="icon-shortcut" /> F | ||
</Col> | ||
<Col span={12}> | ||
查询 <Icon type="icon-shortcut" /> F | ||
</Col> | ||
<Col span={12}> | ||
查询 <Icon type="icon-shortcut" /> F | ||
</Col> | ||
<Col span={12}> | ||
查询 <Icon type="icon-shortcut" /> F | ||
</Col> | ||
<Col span={12}> | ||
查询 <Icon type="icon-shortcut" /> F | ||
</Col> | ||
<Col span={12}> | ||
查询 <Icon type="icon-shortcut" /> F | ||
</Col> | ||
<Col span={12}> | ||
查询 <Icon type="icon-shortcut" /> F | ||
</Col> | ||
</Row> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default Desscription; |
9 changes: 9 additions & 0 deletions
9
packages/gi-assets-basic/src/components/ShortcutKeys/index.tsx
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Component from './Component'; | ||
import info from './info'; | ||
import registerMeta from './registerMeta'; | ||
|
||
export default { | ||
info, | ||
component: Component, | ||
registerMeta, | ||
}; |
12 changes: 12 additions & 0 deletions
12
packages/gi-assets-basic/src/components/ShortcutKeys/info.ts
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Info } from '@antv/gi-sdk'; | ||
const info = { | ||
id: 'ShortcutKeys', | ||
name: '快捷键', | ||
desc: '快捷键说明', | ||
icon: 'icon-shortcut', | ||
cover: 'http://xxxx.jpg', | ||
category: 'canvas-interaction', | ||
type: Info.type.COMPONENT_ACTION, | ||
docs: 'https://www.yuque.com/antv/gi/wc317ftgwwk3fwny', | ||
}; | ||
export default info; |
12 changes: 12 additions & 0 deletions
12
packages/gi-assets-basic/src/components/ShortcutKeys/registerMeta.ts
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { extra } from '@antv/gi-sdk'; | ||
import info from './info'; | ||
const { deepClone, GIAC_METAS } = extra; | ||
const metas = deepClone(GIAC_METAS); | ||
metas.GIAC.properties.GIAC.properties.title.default = info.name; | ||
metas.GIAC.properties.GIAC.properties.icon.default = info.icon; | ||
metas.GIAC.properties.GIAC.properties.isShowTitle.default = false; | ||
metas.GIAC.properties.GIAC.properties.tooltipPlacement.default = 'right'; | ||
|
||
export default () => { | ||
return metas; | ||
}; |