ant-design/components/input-number/demo/addon.tsx
KAM 0dcd6e8c22
fix(InputNumber): Fix incorrect disable state style for input box com… (#42974)
* fix(InputNumber): Fix incorrect disable state style for input box components with front and rear label configuration

* fix(InputNumber): Add case previews for pre and post tags and prefix activation in the disabled state in InputNumber, and add corresponding test cases

* fix(InputNumber): Fix the issue of incorrect inputNumber background color caused by the original prefix icon being disabled

* fix(InputNumber): Remove the toggle disable state interaction in the addon case

* fix(InputNumber): Optimize and merge style processing

* fix(InputNumber): Adjust the addon case and remove irrelevant cases

* fix(InputNumber): Update the snapshot in the InputNumber component unit test

* fix(InputNumber): Fix the issue of incorrect test snapshots caused by adjusting the controls in the disabled state display

* fix(InputNumber): Fix the issue of incorrect test snapshots caused by adjusting the controls in the disabled state display

* fix(InputNumber): Fix the issue of incorrect test snapshots caused by adjusting the controls in the disabled state display

* fix(InputNumber): Fix the issue of incorrect test snapshots caused by adjusting the controls in the disabled state display

* fix(InputNumber): Fix the issue of incorrect test snapshots caused by adjusting the controls in the disabled state display
2023-06-16 14:04:13 +08:00

50 lines
1.3 KiB
TypeScript

import { SettingOutlined } from '@ant-design/icons';
import { Cascader, InputNumber, Select, Space } from 'antd';
import React from 'react';
const { Option } = Select;
const selectBefore = (
<Select defaultValue="add" style={{ width: 60 }}>
<Option value="add">+</Option>
<Option value="minus">-</Option>
</Select>
);
const selectAfter = (
<Select defaultValue="USD" style={{ width: 60 }}>
<Option value="USD">$</Option>
<Option value="EUR"></Option>
<Option value="GBP">£</Option>
<Option value="CNY">¥</Option>
</Select>
);
const App: React.FC = () => (
<Space direction="vertical">
<InputNumber addonBefore="+" addonAfter="$" defaultValue={100} />
<InputNumber addonBefore={selectBefore} addonAfter={selectAfter} defaultValue={100} />
<InputNumber addonAfter={<SettingOutlined />} defaultValue={100} />
<InputNumber
addonBefore={<Cascader placeholder="cascader" style={{ width: 150 }} />}
defaultValue={100}
/>
<InputNumber
addonBefore="+"
addonAfter={<SettingOutlined />}
defaultValue={100}
disabled
controls
/>
<InputNumber
prefix="¥"
addonBefore="+"
addonAfter={<SettingOutlined />}
defaultValue={100}
disabled
controls
/>
</Space>
);
export default App;