2020-01-02 19:10:16 +08:00
|
|
|
---
|
|
|
|
order: 2
|
|
|
|
title:
|
|
|
|
zh-CN: 方向
|
|
|
|
en-US: Direction
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
这里列出了支持 `rtl` 方向的组件,您可以在演示中切换方向。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
Components which support rtl direction are listed here, you can toggle the direction in the demo.
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
2020-01-02 19:10:16 +08:00
|
|
|
import {
|
2022-05-23 14:37:16 +08:00
|
|
|
DownloadOutlined,
|
|
|
|
LeftOutlined,
|
|
|
|
MinusOutlined,
|
|
|
|
PlusOutlined,
|
|
|
|
RightOutlined,
|
|
|
|
SearchOutlined as SearchIcon,
|
|
|
|
SmileOutlined,
|
|
|
|
} from '@ant-design/icons';
|
|
|
|
import type { RadioChangeEvent } from 'antd';
|
|
|
|
import {
|
|
|
|
Badge,
|
|
|
|
Button,
|
|
|
|
Cascader,
|
2020-01-02 19:10:16 +08:00
|
|
|
Col,
|
|
|
|
ConfigProvider,
|
2022-05-23 14:37:16 +08:00
|
|
|
Divider,
|
|
|
|
Input,
|
|
|
|
InputNumber,
|
|
|
|
Modal,
|
|
|
|
Pagination,
|
2020-01-02 19:10:16 +08:00
|
|
|
Radio,
|
2022-05-23 14:37:16 +08:00
|
|
|
Rate,
|
|
|
|
Row,
|
|
|
|
Select,
|
|
|
|
Steps,
|
2020-01-02 19:10:16 +08:00
|
|
|
Switch,
|
|
|
|
Tree,
|
|
|
|
TreeSelect,
|
|
|
|
} from 'antd';
|
2022-07-04 22:09:54 +08:00
|
|
|
import type { DirectionType } from 'antd/es/config-provider';
|
2022-05-23 14:37:16 +08:00
|
|
|
import React, { useState } from 'react';
|
2020-01-02 19:10:16 +08:00
|
|
|
|
|
|
|
const InputGroup = Input.Group;
|
|
|
|
const ButtonGroup = Button.Group;
|
|
|
|
const { Option } = Select;
|
|
|
|
const { TreeNode } = Tree;
|
|
|
|
const { Search } = Input;
|
|
|
|
const { Step } = Steps;
|
|
|
|
|
|
|
|
const cascaderOptions = [
|
|
|
|
{
|
|
|
|
value: 'tehran',
|
|
|
|
label: 'تهران',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'tehran-c',
|
|
|
|
label: 'تهران',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'saadat-abad',
|
|
|
|
label: 'سعادت آیاد',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'ardabil',
|
|
|
|
label: 'اردبیل',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'ardabil-c',
|
|
|
|
label: 'اردبیل',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'primadar',
|
|
|
|
label: 'پیرمادر',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'gilan',
|
|
|
|
label: 'گیلان',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'rasht',
|
|
|
|
label: 'رشت',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'district-3',
|
|
|
|
label: 'منطقه ۳',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
];
|
2022-05-19 09:46:26 +08:00
|
|
|
type Placement = 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight';
|
2020-01-02 19:10:16 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const Page: React.FC<{ popupPlacement: Placement }> = ({ popupPlacement }) => {
|
|
|
|
const [currentStep, setCurrentStep] = useState(0);
|
2022-08-23 16:55:57 +08:00
|
|
|
const [modalOpen, setModalOpen] = useState(false);
|
2022-05-19 09:46:26 +08:00
|
|
|
const [badgeCount, setBadgeCount] = useState(5);
|
|
|
|
const [showBadge, setShowBadge] = useState(true);
|
2020-01-02 19:10:16 +08:00
|
|
|
|
2022-05-11 19:43:54 +08:00
|
|
|
const selectBefore = (
|
2020-01-02 19:10:16 +08:00
|
|
|
<Select defaultValue="Http://" style={{ width: 90 }}>
|
|
|
|
<Option value="Http://">Http://</Option>
|
|
|
|
<Option value="Https://">Https://</Option>
|
|
|
|
</Select>
|
|
|
|
);
|
|
|
|
|
2022-05-11 19:43:54 +08:00
|
|
|
const selectAfter = (
|
2020-01-02 19:10:16 +08:00
|
|
|
<Select defaultValue=".com" style={{ width: 80 }}>
|
|
|
|
<Option value=".com">.com</Option>
|
|
|
|
<Option value=".jp">.jp</Option>
|
|
|
|
<Option value=".cn">.cn</Option>
|
|
|
|
<Option value=".org">.org</Option>
|
|
|
|
</Select>
|
|
|
|
);
|
|
|
|
|
|
|
|
// ==== Cascader ====
|
2022-05-19 09:46:26 +08:00
|
|
|
const cascaderFilter = (inputValue: string, path: { label: string }[]) =>
|
2020-12-09 17:12:32 +08:00
|
|
|
path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1);
|
2020-01-02 19:10:16 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const onCascaderChange = (value: any) => {
|
2020-01-02 19:10:16 +08:00
|
|
|
console.log(value);
|
|
|
|
};
|
|
|
|
// ==== End Cascader ====
|
|
|
|
|
|
|
|
// ==== Modal ====
|
2022-05-11 19:43:54 +08:00
|
|
|
const showModal = () => {
|
2022-08-23 16:55:57 +08:00
|
|
|
setModalOpen(true);
|
2020-01-02 19:10:16 +08:00
|
|
|
};
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const handleOk = (e: React.MouseEvent<HTMLElement>) => {
|
2020-01-02 19:10:16 +08:00
|
|
|
console.log(e);
|
2022-08-23 16:55:57 +08:00
|
|
|
setModalOpen(false);
|
2020-01-02 19:10:16 +08:00
|
|
|
};
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const handleCancel = (e: React.MouseEvent<HTMLElement>) => {
|
2020-01-02 19:10:16 +08:00
|
|
|
console.log(e);
|
2022-08-23 16:55:57 +08:00
|
|
|
setModalOpen(false);
|
2020-01-02 19:10:16 +08:00
|
|
|
};
|
2022-05-11 19:43:54 +08:00
|
|
|
|
2020-01-02 19:10:16 +08:00
|
|
|
// ==== End Modal ====
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const onStepsChange = (newCurrentStep: number) => {
|
|
|
|
console.log('onChange:', newCurrentStep);
|
|
|
|
setCurrentStep(newCurrentStep);
|
2020-01-02 19:10:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
// ==== Badge ====
|
|
|
|
|
2022-05-11 19:43:54 +08:00
|
|
|
const increaseBadge = () => {
|
2022-05-19 09:46:26 +08:00
|
|
|
setBadgeCount(badgeCount + 1);
|
2020-01-02 19:10:16 +08:00
|
|
|
};
|
|
|
|
|
2022-05-11 19:43:54 +08:00
|
|
|
const declineBadge = () => {
|
2022-05-19 09:46:26 +08:00
|
|
|
let newBadgeCount = badgeCount - 1;
|
|
|
|
if (newBadgeCount < 0) {
|
|
|
|
newBadgeCount = 0;
|
2020-01-02 19:10:16 +08:00
|
|
|
}
|
2022-05-19 09:46:26 +08:00
|
|
|
setBadgeCount(newBadgeCount);
|
2020-01-02 19:10:16 +08:00
|
|
|
};
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const onChangeBadge = (checked: boolean) => {
|
|
|
|
setShowBadge(checked);
|
2020-01-02 19:10:16 +08:00
|
|
|
};
|
2022-05-19 09:46:26 +08:00
|
|
|
// ==== End Badge ====
|
2022-05-11 19:43:54 +08:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="direction-components">
|
|
|
|
<Row>
|
|
|
|
<Col span={24}>
|
|
|
|
<Divider orientation="left">Cascader example</Divider>
|
|
|
|
<Cascader
|
|
|
|
suffixIcon={<SearchIcon />}
|
|
|
|
options={cascaderOptions}
|
|
|
|
onChange={onCascaderChange}
|
|
|
|
placeholder="یک مورد انتخاب کنید"
|
2022-05-19 09:46:26 +08:00
|
|
|
popupPlacement={popupPlacement}
|
2022-05-11 19:43:54 +08:00
|
|
|
/>
|
|
|
|
With search:
|
|
|
|
<Cascader
|
|
|
|
suffixIcon={<SmileOutlined />}
|
|
|
|
options={cascaderOptions}
|
|
|
|
onChange={onCascaderChange}
|
|
|
|
placeholder="Select an item"
|
2022-05-19 09:46:26 +08:00
|
|
|
popupPlacement={popupPlacement}
|
|
|
|
showSearch={{ filter: cascaderFilter }}
|
2022-05-11 19:43:54 +08:00
|
|
|
/>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<br />
|
|
|
|
<Row>
|
|
|
|
<Col span={12}>
|
|
|
|
<Divider orientation="left">Switch example</Divider>
|
|
|
|
|
|
|
|
<Switch defaultChecked />
|
|
|
|
|
|
|
|
<Switch loading defaultChecked />
|
|
|
|
|
|
|
|
<Switch size="small" loading />
|
|
|
|
</Col>
|
|
|
|
<Col span={12}>
|
|
|
|
<Divider orientation="left">Radio Group example</Divider>
|
|
|
|
|
|
|
|
<Radio.Group defaultValue="c" buttonStyle="solid">
|
|
|
|
<Radio.Button value="a">تهران</Radio.Button>
|
|
|
|
<Radio.Button value="b" disabled>
|
|
|
|
اصفهان
|
|
|
|
</Radio.Button>
|
|
|
|
<Radio.Button value="c">فارس</Radio.Button>
|
|
|
|
<Radio.Button value="d">خوزستان</Radio.Button>
|
|
|
|
</Radio.Group>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<br />
|
|
|
|
<Row>
|
|
|
|
<Col span={12}>
|
|
|
|
<Divider orientation="left">Button example</Divider>
|
|
|
|
<div className="button-demo">
|
|
|
|
<Button type="primary" icon={<DownloadOutlined />} />
|
|
|
|
<Button type="primary" shape="circle" icon={<DownloadOutlined />} />
|
|
|
|
<Button type="primary" shape="round" icon={<DownloadOutlined />} />
|
|
|
|
<Button type="primary" shape="round" icon={<DownloadOutlined />}>
|
|
|
|
Download
|
|
|
|
</Button>
|
|
|
|
<Button type="primary" icon={<DownloadOutlined />}>
|
|
|
|
Download
|
|
|
|
</Button>
|
|
|
|
<br />
|
|
|
|
<Button.Group>
|
|
|
|
<Button type="primary">
|
|
|
|
<LeftOutlined />
|
|
|
|
Backward
|
2020-01-02 19:10:16 +08:00
|
|
|
</Button>
|
2022-05-11 19:43:54 +08:00
|
|
|
<Button type="primary">
|
|
|
|
Forward
|
|
|
|
<RightOutlined />
|
2020-01-02 19:10:16 +08:00
|
|
|
</Button>
|
2022-05-11 19:43:54 +08:00
|
|
|
</Button.Group>
|
|
|
|
<Button type="primary" loading>
|
|
|
|
Loading
|
|
|
|
</Button>
|
|
|
|
<Button type="primary" size="small" loading>
|
|
|
|
Loading
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
</Col>
|
|
|
|
<Col span={12}>
|
|
|
|
<Divider orientation="left">Tree example</Divider>
|
|
|
|
<Tree
|
|
|
|
showLine
|
|
|
|
checkable
|
|
|
|
defaultExpandedKeys={['0-0-0', '0-0-1']}
|
|
|
|
defaultSelectedKeys={['0-0-0', '0-0-1']}
|
|
|
|
defaultCheckedKeys={['0-0-0', '0-0-1']}
|
|
|
|
>
|
|
|
|
<TreeNode title="parent 1" key="0-0">
|
|
|
|
<TreeNode title="parent 1-0" key="0-0-0" disabled>
|
|
|
|
<TreeNode title="leaf" key="0-0-0-0" disableCheckbox />
|
|
|
|
<TreeNode title="leaf" key="0-0-0-1" />
|
2020-01-02 19:10:16 +08:00
|
|
|
</TreeNode>
|
2022-05-11 19:43:54 +08:00
|
|
|
<TreeNode title="parent 1-1" key="0-0-1">
|
|
|
|
<TreeNode title={<span style={{ color: '#1890ff' }}>sss</span>} key="0-0-1-0" />
|
|
|
|
</TreeNode>
|
|
|
|
</TreeNode>
|
|
|
|
</Tree>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<br />
|
|
|
|
<Row>
|
|
|
|
<Col span={24}>
|
|
|
|
<Divider orientation="left">Input (Input Group) example</Divider>
|
|
|
|
<InputGroup size="large">
|
|
|
|
<Row gutter={8}>
|
|
|
|
<Col span={5}>
|
|
|
|
<Input defaultValue="0571" />
|
|
|
|
</Col>
|
|
|
|
<Col span={8}>
|
|
|
|
<Input defaultValue="26888888" />
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
</InputGroup>
|
|
|
|
<br />
|
|
|
|
<InputGroup compact>
|
|
|
|
<Input style={{ width: '20%' }} defaultValue="0571" />
|
|
|
|
<Input style={{ width: '30%' }} defaultValue="26888888" />
|
|
|
|
</InputGroup>
|
|
|
|
<br />
|
|
|
|
<InputGroup compact>
|
|
|
|
<Select defaultValue="Option1">
|
|
|
|
<Option value="Option1">Option1</Option>
|
|
|
|
<Option value="Option2">Option2</Option>
|
|
|
|
</Select>
|
|
|
|
<Input style={{ width: '50%' }} defaultValue="input content" />
|
|
|
|
<InputNumber />
|
|
|
|
</InputGroup>
|
|
|
|
<br />
|
|
|
|
<Search placeholder="input search text" enterButton="Search" size="large" />
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<div style={{ marginBottom: 16 }}>
|
|
|
|
<Input addonBefore={selectBefore} addonAfter={selectAfter} defaultValue="mysite" />
|
|
|
|
</div>
|
|
|
|
<br />
|
|
|
|
<Row>
|
|
|
|
<Col span={12}>
|
|
|
|
<Divider orientation="left">Select example</Divider>
|
|
|
|
<Select mode="multiple" defaultValue="مورچه" style={{ width: 120 }}>
|
|
|
|
<Option value="jack">Jack</Option>
|
|
|
|
<Option value="مورچه">مورچه</Option>
|
|
|
|
<Option value="disabled" disabled>
|
|
|
|
Disabled
|
|
|
|
</Option>
|
|
|
|
<Option value="Yiminghe">yiminghe</Option>
|
2020-01-02 19:10:16 +08:00
|
|
|
</Select>
|
2022-05-11 19:43:54 +08:00
|
|
|
<Select defaultValue="مورچه" style={{ width: 120 }} disabled>
|
|
|
|
<Option value="مورچه">مورچه</Option>
|
|
|
|
</Select>
|
|
|
|
<Select defaultValue="مورچه" style={{ width: 120 }} loading>
|
|
|
|
<Option value="مورچه">مورچه</Option>
|
|
|
|
</Select>
|
|
|
|
<Select
|
|
|
|
showSearch
|
|
|
|
style={{ width: 200 }}
|
|
|
|
placeholder="Select a person"
|
|
|
|
optionFilterProp="children"
|
|
|
|
filterOption={(input, option) =>
|
2022-05-19 09:46:26 +08:00
|
|
|
option?.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
2022-05-11 19:43:54 +08:00
|
|
|
}
|
|
|
|
>
|
|
|
|
<Option value="jack">Jack</Option>
|
|
|
|
<Option value="سعید">سعید</Option>
|
|
|
|
<Option value="tom">Tom</Option>
|
|
|
|
</Select>
|
|
|
|
</Col>
|
|
|
|
<Col span={12}>
|
|
|
|
<Divider orientation="left">TreeSelect example</Divider>
|
|
|
|
<div>
|
|
|
|
<TreeSelect
|
2020-01-02 19:10:16 +08:00
|
|
|
showSearch
|
2022-05-11 19:43:54 +08:00
|
|
|
style={{ width: '100%' }}
|
|
|
|
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
|
|
|
placeholder="Please select"
|
|
|
|
allowClear
|
|
|
|
treeDefaultExpandAll
|
2020-01-02 19:10:16 +08:00
|
|
|
>
|
2022-05-19 09:46:26 +08:00
|
|
|
<TreeNode title="parent 1" key="0-1">
|
|
|
|
<TreeNode title="parent 1-0" key="0-1-1">
|
|
|
|
<TreeNode title="my leaf" key="random" />
|
|
|
|
<TreeNode title="your leaf" key="random1" />
|
2020-01-02 19:10:16 +08:00
|
|
|
</TreeNode>
|
2022-05-19 09:46:26 +08:00
|
|
|
<TreeNode title="parent 1-1" key="random2">
|
|
|
|
<TreeNode title={<b style={{ color: '#08c' }}>sss</b>} key="random3" />
|
2022-05-11 19:43:54 +08:00
|
|
|
</TreeNode>
|
|
|
|
</TreeNode>
|
|
|
|
</TreeSelect>
|
|
|
|
</div>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<br />
|
|
|
|
<Row>
|
|
|
|
<Col span={24}>
|
|
|
|
<Divider orientation="left">Modal example</Divider>
|
|
|
|
<div>
|
|
|
|
<Button type="primary" onClick={showModal}>
|
|
|
|
Open Modal
|
|
|
|
</Button>
|
2022-08-23 16:55:57 +08:00
|
|
|
<Modal title="پنچره ساده" open={modalOpen} onOk={handleOk} onCancel={handleCancel}>
|
2022-05-11 19:43:54 +08:00
|
|
|
<p>نگاشتههای خود را اینجا قراردهید</p>
|
|
|
|
<p>نگاشتههای خود را اینجا قراردهید</p>
|
|
|
|
<p>نگاشتههای خود را اینجا قراردهید</p>
|
|
|
|
</Modal>
|
|
|
|
</div>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<br />
|
|
|
|
<Row>
|
|
|
|
<Col span={24}>
|
|
|
|
<Divider orientation="left">Steps example</Divider>
|
|
|
|
<div>
|
2022-05-19 09:46:26 +08:00
|
|
|
<Steps progressDot current={currentStep}>
|
2022-05-11 19:43:54 +08:00
|
|
|
<Step title="Finished" description="This is a description." />
|
|
|
|
<Step title="In Progress" description="This is a description." />
|
|
|
|
<Step title="Waiting" description="This is a description." />
|
|
|
|
</Steps>
|
|
|
|
<br />
|
2022-05-19 09:46:26 +08:00
|
|
|
<Steps current={currentStep} onChange={onStepsChange}>
|
2022-05-11 19:43:54 +08:00
|
|
|
<Step title="Step 1" description="This is a description." />
|
|
|
|
<Step title="Step 2" description="This is a description." />
|
|
|
|
<Step title="Step 3" description="This is a description." />
|
|
|
|
</Steps>
|
|
|
|
</div>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<br />
|
|
|
|
<Row>
|
|
|
|
<Col span={12}>
|
|
|
|
<Divider orientation="left">Rate example</Divider>
|
|
|
|
<div>
|
|
|
|
<Rate defaultValue={2.5} />
|
|
|
|
<br />
|
|
|
|
<strong>* Note:</strong> Half star not implemented in RTL direction, it will be
|
|
|
|
supported after <a href="https://github.com/react-component/rate">rc-rate</a>{' '}
|
|
|
|
implement rtl support.
|
|
|
|
</div>
|
|
|
|
</Col>
|
|
|
|
<Col span={12}>
|
|
|
|
<Divider orientation="left">Badge example</Divider>
|
|
|
|
<div>
|
2020-01-02 19:10:16 +08:00
|
|
|
<div>
|
2022-05-19 09:46:26 +08:00
|
|
|
<Badge count={badgeCount}>
|
2022-05-11 19:43:54 +08:00
|
|
|
<a href="#" className="head-example" />
|
|
|
|
</Badge>
|
|
|
|
<ButtonGroup>
|
|
|
|
<Button onClick={declineBadge}>
|
|
|
|
<MinusOutlined />
|
|
|
|
</Button>
|
|
|
|
<Button onClick={increaseBadge}>
|
|
|
|
<PlusOutlined />
|
|
|
|
</Button>
|
|
|
|
</ButtonGroup>
|
2020-01-02 19:10:16 +08:00
|
|
|
</div>
|
2022-05-11 19:43:54 +08:00
|
|
|
<div style={{ marginTop: 10 }}>
|
2022-05-19 09:46:26 +08:00
|
|
|
<Badge dot={showBadge}>
|
2022-05-11 19:43:54 +08:00
|
|
|
<a href="#" className="head-example" />
|
|
|
|
</Badge>
|
2022-05-19 09:46:26 +08:00
|
|
|
<Switch onChange={onChangeBadge} checked={showBadge} />
|
2020-01-02 19:10:16 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-05-11 19:43:54 +08:00
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<Row>
|
|
|
|
<Col span={24}>
|
|
|
|
<Divider orientation="left">Pagination example</Divider>
|
|
|
|
<Pagination showSizeChanger defaultCurrent={3} total={500} />
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<br />
|
|
|
|
<Row>
|
|
|
|
<Col span={24}>
|
|
|
|
<Divider orientation="left">Grid System example</Divider>
|
|
|
|
<div className="grid-demo">
|
|
|
|
<div className="code-box-demo">
|
|
|
|
<p>
|
|
|
|
<strong>* Note:</strong> Every calculation in RTL grid system is from right side
|
|
|
|
(offset, push, etc.)
|
|
|
|
</p>
|
|
|
|
<Row>
|
|
|
|
<Col span={8}>col-8</Col>
|
|
|
|
<Col span={8} offset={8}>
|
|
|
|
col-8
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<Row>
|
|
|
|
<Col span={6} offset={6}>
|
|
|
|
col-6 col-offset-6
|
|
|
|
</Col>
|
|
|
|
<Col span={6} offset={6}>
|
|
|
|
col-6 col-offset-6
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<Row>
|
|
|
|
<Col span={12} offset={6}>
|
|
|
|
col-12 col-offset-6
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<Row>
|
|
|
|
<Col span={18} push={6}>
|
|
|
|
col-18 col-push-6
|
|
|
|
</Col>
|
|
|
|
<Col span={6} pull={18}>
|
|
|
|
col-6 col-pull-18
|
|
|
|
</Col>
|
|
|
|
</Row>
|
2020-01-02 19:10:16 +08:00
|
|
|
</div>
|
2022-05-11 19:43:54 +08:00
|
|
|
</div>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
</div>
|
|
|
|
);
|
2022-05-19 09:46:26 +08:00
|
|
|
};
|
2020-01-02 19:10:16 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => {
|
|
|
|
const [direction, setDirection] = useState<DirectionType>('ltr');
|
|
|
|
const [popupPlacement, setPopupPlacement] = useState<Placement>('bottomLeft');
|
2020-01-02 19:10:16 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const changeDirection = (e: RadioChangeEvent) => {
|
2020-01-02 19:10:16 +08:00
|
|
|
const directionValue = e.target.value;
|
2022-05-11 19:43:54 +08:00
|
|
|
setDirection(directionValue);
|
2020-01-02 19:10:16 +08:00
|
|
|
if (directionValue === 'rtl') {
|
2022-05-11 19:43:54 +08:00
|
|
|
setPopupPlacement('bottomRight');
|
2020-01-02 19:10:16 +08:00
|
|
|
} else {
|
2022-05-11 19:43:54 +08:00
|
|
|
setPopupPlacement('bottomLeft');
|
2020-01-02 19:10:16 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-05-11 19:43:54 +08:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<div style={{ marginBottom: 16 }}>
|
|
|
|
<span style={{ marginRight: 16 }}>Change direction of components: </span>
|
|
|
|
<Radio.Group defaultValue="ltr" onChange={changeDirection}>
|
|
|
|
<Radio.Button key="ltr" value="ltr">
|
|
|
|
LTR
|
|
|
|
</Radio.Button>
|
|
|
|
<Radio.Button key="rtl" value="rtl">
|
|
|
|
RTL
|
|
|
|
</Radio.Button>
|
|
|
|
</Radio.Group>
|
|
|
|
</div>
|
|
|
|
<ConfigProvider direction={direction}>
|
2022-05-19 09:46:26 +08:00
|
|
|
<Page popupPlacement={popupPlacement} />
|
2022-05-11 19:43:54 +08:00
|
|
|
</ConfigProvider>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
2022-05-19 09:46:26 +08:00
|
|
|
|
|
|
|
export default App;
|
2020-01-02 19:10:16 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
```css
|
|
|
|
.button-demo .ant-btn,
|
|
|
|
.button-demo .ant-btn-group {
|
|
|
|
margin-right: 8px;
|
|
|
|
margin-bottom: 12px;
|
|
|
|
}
|
|
|
|
.button-demo .ant-btn-group > .ant-btn,
|
|
|
|
.button-demo .ant-btn-group > span > .ant-btn {
|
|
|
|
margin-right: 0;
|
|
|
|
margin-left: 0;
|
|
|
|
}
|
2020-03-01 00:05:52 +08:00
|
|
|
|
2020-01-02 19:10:16 +08:00
|
|
|
.head-example {
|
|
|
|
display: inline-block;
|
|
|
|
width: 42px;
|
|
|
|
height: 42px;
|
|
|
|
vertical-align: middle;
|
|
|
|
background: #eee;
|
|
|
|
border-radius: 4px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.ant-badge:not(.ant-badge-not-a-wrapper) {
|
|
|
|
margin-right: 20px;
|
|
|
|
}
|
|
|
|
.ant-badge-rtl:not(.ant-badge-not-a-wrapper) {
|
|
|
|
margin-right: 0;
|
|
|
|
margin-left: 20px;
|
|
|
|
}
|
|
|
|
```
|
2020-01-03 19:00:01 +08:00
|
|
|
|
|
|
|
<style>
|
|
|
|
[data-theme="dark"] .head-example {
|
|
|
|
background: rgba(255,255,255,.12);
|
|
|
|
}
|
|
|
|
</style>
|