-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #349 from oceanbase/dengfuping-design
fix(design): Form hideRequiredMark should be priority over ConfigProvider form.requiredMark
- Loading branch information
Showing
7 changed files
with
230 additions
and
11 deletions.
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
packages/design/src/form/__tests__/__snapshots__/index.test.tsx.snap
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Button, ConfigProvider, Form, Input, message } from '@oceanbase/design'; | ||
import React from 'react'; | ||
|
||
const onFinish = (values: any) => { | ||
message.success('Success'); | ||
console.log(values); | ||
}; | ||
|
||
const onFinishFailed = (errorInfo: any) => { | ||
message.error('Failed'); | ||
console.log(errorInfo); | ||
}; | ||
|
||
const App: React.FC = () => ( | ||
<ConfigProvider | ||
form={{ | ||
requiredMark: true, | ||
}} | ||
> | ||
<Form | ||
name="basic" | ||
labelCol={{ span: 6 }} | ||
wrapperCol={{ span: 10 }} | ||
onFinish={onFinish} | ||
onFinishFailed={onFinishFailed} | ||
hideRequiredMark={true} | ||
> | ||
<Form.Item | ||
label="Username" | ||
name="username" | ||
rules={[{ required: true, message: 'Please input your username!' }]} | ||
> | ||
<Input /> | ||
</Form.Item> | ||
<Form.Item label="Address" name="address"> | ||
<Input /> | ||
</Form.Item> | ||
<Form.Item wrapperCol={{ offset: 6, span: 10 }}> | ||
<Button type="primary" htmlType="submit"> | ||
Submit | ||
</Button> | ||
</Form.Item> | ||
</Form> | ||
</ConfigProvider> | ||
); | ||
|
||
export default App; |
49 changes: 49 additions & 0 deletions
49
packages/design/src/form/demo/requiredMark-same-with-antd.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 { Button, ConfigProvider, Form, Input, message } from '@oceanbase/design'; | ||
import React from 'react'; | ||
|
||
const onFinish = (values: any) => { | ||
message.success('Success'); | ||
console.log(values); | ||
}; | ||
|
||
const onFinishFailed = (errorInfo: any) => { | ||
message.error('Failed'); | ||
console.log(errorInfo); | ||
}; | ||
|
||
const App: React.FC = () => ( | ||
<ConfigProvider | ||
form={{ | ||
// global config | ||
requiredMark: true, | ||
}} | ||
> | ||
<Form | ||
name="basic" | ||
labelCol={{ span: 6 }} | ||
wrapperCol={{ span: 10 }} | ||
onFinish={onFinish} | ||
onFinishFailed={onFinishFailed} | ||
// local config | ||
// requiredMark={true} | ||
> | ||
<Form.Item | ||
label="Username" | ||
name="username" | ||
rules={[{ required: true, message: 'Please input your username!' }]} | ||
> | ||
<Input /> | ||
</Form.Item> | ||
<Form.Item label="Address" name="address"> | ||
<Input /> | ||
</Form.Item> | ||
<Form.Item wrapperCol={{ offset: 6, span: 10 }}> | ||
<Button type="primary" htmlType="submit"> | ||
Submit | ||
</Button> | ||
</Form.Item> | ||
</Form> | ||
</ConfigProvider> | ||
); | ||
|
||
export default App; |
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
Oops, something went wrong.