Skip to content

Commit

Permalink
feat(WIP): add ShortcutKeys
Browse files Browse the repository at this point in the history
  • Loading branch information
pomelo-nwu committed Aug 6, 2023
1 parent 7a11fd4 commit 2a50d59
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 0 deletions.
36 changes: 36 additions & 0 deletions packages/gi-assets-basic/src/components/ShortcutKeys/Component.tsx
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;
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;
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 packages/gi-assets-basic/src/components/ShortcutKeys/info.ts
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;
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;
};

0 comments on commit 2a50d59

Please sign in to comment.