-
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.
- Loading branch information
1 parent
44481dc
commit c7fe37d
Showing
7 changed files
with
199 additions
and
11 deletions.
There are no files selected for viewing
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,162 @@ | ||
import { ProForm } from '@uiw-admin/components' | ||
import { Slider } from 'uiw' | ||
|
||
const option = [ | ||
{ value: 1, label: '苹果' }, | ||
{ value: 2, label: '西瓜' }, | ||
{ value: 3, label: '香蕉' }, | ||
{ value: 4, label: '东北大冻梨' }, | ||
{ value: 5, label: '香蕉' }, | ||
{ value: 6, label: '葡萄' }, | ||
{ value: 6, label: '哈密瓜' }, | ||
] | ||
|
||
const Page = () => { | ||
return ( | ||
<ProForm | ||
// 表单类型 | ||
formType="card" | ||
title="基本使用(与uiw/form使用保持一致)" | ||
// 自定义组件 | ||
customWidgetsList={{ | ||
slider: Slider, | ||
}} | ||
cardProps={{ | ||
noHover: true, | ||
}} | ||
// 是否展示uiw/form提交按钮 | ||
showSaveButton | ||
// 是否展示uiw/form重置按钮 | ||
showResetButton | ||
// 提交后验证 | ||
onSubmit={(initial, current) => { | ||
console.log(111, initial, current) | ||
}} | ||
formDatas={[ | ||
{ | ||
label: 'input', | ||
key: 'input', | ||
widget: 'input', | ||
initialValue: '', | ||
widgetProps: {}, | ||
help: 'input不能为空', | ||
rules: [{ required: true, message: 'input不能为空' }], | ||
}, | ||
{ | ||
label: 'textarea', | ||
key: 'textarea', | ||
widget: 'textarea', | ||
span: '24', | ||
colstyle: { maxWidth: 800 }, | ||
}, | ||
{ | ||
label: 'select', | ||
key: 'select', | ||
widget: 'select', | ||
option: [ | ||
{ value: 1, label: '苹果' }, | ||
{ value: 2, label: '西瓜' }, | ||
{ value: 3, label: '香蕉' }, | ||
{ value: 4, label: '东北大冻梨' }, | ||
], | ||
}, | ||
{ | ||
label: 'switch', | ||
key: 'switch', | ||
widget: 'switch', | ||
}, | ||
{ | ||
label: 'radio', | ||
widget: 'radio', | ||
key: 'radio', | ||
option: [ | ||
{ label: '男', value: 'man' }, | ||
{ label: '女', value: 'girl' }, | ||
], | ||
}, | ||
{ | ||
label: '多选框', | ||
widget: 'checkbox', | ||
key: 'checkbox', | ||
option: [ | ||
{ label: '四川菜', value: 'sichuan' }, | ||
{ label: '湖北菜', value: 'hubei' }, | ||
], | ||
}, | ||
{ | ||
label: '年月日时分秒', | ||
key: 'dateInputsecond', | ||
widget: 'dateInput', | ||
widgetProps: { | ||
format: 'YYYY-MM-DD HH:mm:ss', | ||
}, | ||
}, | ||
{ | ||
label: '年月日', | ||
key: 'dateInput', | ||
widget: 'dateInput', | ||
widgetProps: { | ||
format: 'YYYY-MM-DD', | ||
}, | ||
}, | ||
{ | ||
label: '年月', | ||
key: 'monthPicker', | ||
widget: 'monthPicker', | ||
widgetProps: { | ||
format: 'YYYY-MM', | ||
}, | ||
}, | ||
{ | ||
label: '时分秒', | ||
key: 'timePicker', | ||
widget: 'timePicker', | ||
}, | ||
{ | ||
label: 'searchSelect', | ||
key: 'searchSelect', | ||
widget: 'searchSelect', | ||
option: option, | ||
widgetProps: { | ||
mode: 'multiple', | ||
allowClear: true, | ||
showSearch: true, | ||
style: { width: '100%' }, | ||
}, | ||
}, | ||
{ | ||
label: '评分', | ||
key: 'rate', | ||
widget: 'rate', | ||
span: '8', | ||
}, | ||
// 只读模式下支持读取React.ReactNode | ||
{ | ||
label: '自定义组件', | ||
key: 'slider', | ||
widget: 'slider', | ||
readSpan: 2, | ||
span: '16', | ||
}, | ||
{ | ||
label: '上传组件', | ||
key: 'upload', | ||
widget: 'upload', | ||
span: '24', | ||
readSpan: 3, | ||
widgetProps: { | ||
uploadType: 'card', | ||
multiple: true, | ||
maxNumber: 2, | ||
showFileIcon: { | ||
showPreviewIcon: true, | ||
showRemoveIcon: true, | ||
}, | ||
}, | ||
}, | ||
]} | ||
/> | ||
) | ||
} | ||
|
||
export default Page |
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
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 |
---|---|---|
|
@@ -19,5 +19,5 @@ | |
} | ||
|
||
.uiw-protable-form .w-select { | ||
background-color: #fff; | ||
background-color: transparent; | ||
} |
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 |
---|---|---|
@@ -1,9 +1,15 @@ | ||
export { default as ProTable } from './ProTable'; | ||
export * from './ProTable'; | ||
export { default as useTable } from './ProTable/useTable'; | ||
export * from './ProTable/useTable'; | ||
export { default as Skeleton } from './Skeleton'; | ||
export * from './Skeleton'; | ||
export { default as ProDrawer } from './ProDrawer'; | ||
export * from './ProDrawer'; | ||
export { default as ProForm } from './ProForm'; | ||
export * from './ProForm'; | ||
export { default as useForm } from './ProForm/hooks/useForm'; | ||
export * from './ProForm'; | ||
|
||
export * from './form'; | ||
export { default as Form } from './form'; |