@gmfe/react 2.14.17 → 2.14.19-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/common/hooks/index.js +3 -3
- package/src/common/hooks/use_mutation_observer.js +25 -25
- package/src/common/util.js +52 -52
- package/src/component/affix/affix.stories.js +13 -13
- package/src/component/affix/index.js +21 -21
- package/src/component/box/box.js +31 -31
- package/src/component/box/box.stories.js +94 -94
- package/src/component/box/box_form.js +77 -77
- package/src/component/box/box_panel.js +91 -91
- package/src/component/box/box_table.js +51 -51
- package/src/component/box/index.js +6 -6
- package/src/component/box/style.less +39 -39
- package/src/component/button/button.stories.js +91 -91
- package/src/component/button/index.js +92 -92
- package/src/component/button/style.less +114 -114
- package/src/component/calendar/calendar.js +52 -52
- package/src/component/calendar/calendar.stories.js +57 -57
- package/src/component/calendar/content.js +89 -89
- package/src/component/calendar/day.js +109 -109
- package/src/component/calendar/head.js +243 -243
- package/src/component/calendar/index.js +4 -4
- package/src/component/calendar/range_calendar.js +150 -150
- package/src/component/calendar/style.less +140 -140
- package/src/component/calendar/week.js +27 -27
- package/src/component/carousel/carousel.js +178 -178
- package/src/component/carousel/stories.js +50 -50
- package/src/component/carousel/style.less +48 -48
- package/src/component/cascader/cascader.js +443 -443
- package/src/component/cascader/cascader.select.js +195 -195
- package/src/component/cascader/stories.js +240 -240
- package/src/component/cascader/style.less +122 -122
- package/src/component/checkbox/checkbox.js +86 -86
- package/src/component/checkbox/checkbox_group.js +66 -66
- package/src/component/checkbox/index.js +4 -4
- package/src/component/checkbox/stories.js +103 -103
- package/src/component/checkbox/style.less +88 -88
- package/src/component/collapse/collapse.stories.js +18 -18
- package/src/component/collapse/index.js +36 -36
- package/src/component/color_picker/index.js +190 -190
- package/src/component/color_picker/stories.js +17 -17
- package/src/component/color_picker/style.less +41 -41
- package/src/component/date_picker/date_picker.stories.js +102 -102
- package/src/component/date_picker/index.js +217 -217
- package/src/component/date_picker/overlay.js +119 -119
- package/src/component/date_picker/style.less +22 -22
- package/src/component/date_picker/time_select.js +62 -62
- package/src/component/date_range_picker/date_range_picker.stories.js +196 -196
- package/src/component/date_range_picker/index.js +206 -206
- package/src/component/date_range_picker/left.js +127 -127
- package/src/component/date_range_picker/overlay.js +202 -202
- package/src/component/date_range_picker/style.less +46 -46
- package/src/component/date_range_picker/time_range_select.js +150 -150
- package/src/component/date_range_picker/two.js +129 -129
- package/src/component/date_range_picker/util.js +42 -42
- package/src/component/dialog/index.js +240 -240
- package/src/component/dialog/stories.js +125 -125
- package/src/component/divider/index.js +28 -28
- package/src/component/divider/stories.js +5 -5
- package/src/component/divider/style.less +15 -15
- package/src/component/drawer/index.js +107 -107
- package/src/component/drawer/style.less +43 -43
- package/src/component/drop_down/drop_down.js +84 -84
- package/src/component/drop_down/drop_down_item.js +43 -43
- package/src/component/drop_down/drop_down_items.js +22 -22
- package/src/component/drop_down/index.js +5 -5
- package/src/component/drop_down/stories.js +38 -38
- package/src/component/drop_down/style.less +21 -21
- package/src/component/drop_select/index.js +208 -208
- package/src/component/drop_select/style.less +69 -69
- package/src/component/dropper/index.js +62 -62
- package/src/component/dropper/style.less +18 -18
- package/src/component/editable_text/editable_text.stories.js +47 -47
- package/src/component/editable_text/index.js +106 -106
- package/src/component/editable_text/style.less +29 -29
- package/src/component/filter_select/filter.select.js +416 -416
- package/src/component/filter_select/multiple.filter.select.js +425 -425
- package/src/component/filter_select/style.less +117 -117
- package/src/component/flex/index.js +132 -132
- package/src/component/flex/stories.js +13 -13
- package/src/component/flex/style.less +101 -101
- package/src/component/flip_number/index.js +196 -196
- package/src/component/flip_number/stories.js +25 -25
- package/src/component/flip_number/utils.js +50 -50
- package/src/component/form/form.js +153 -153
- package/src/component/form/form.stories.js +553 -553
- package/src/component/form/form_block.js +59 -59
- package/src/component/form/form_button.js +29 -29
- package/src/component/form/form_group.js +173 -173
- package/src/component/form/form_item.js +163 -163
- package/src/component/form/form_panel.js +71 -71
- package/src/component/form/index.js +8 -8
- package/src/component/form/style.less +130 -130
- package/src/component/form/util.js +13 -13
- package/src/component/function_set/function_set.stories.js +91 -91
- package/src/component/function_set/index.js +98 -98
- package/src/component/function_set/overlay.js +56 -56
- package/src/component/grid/col.js +72 -72
- package/src/component/grid/grid.stories.js +123 -123
- package/src/component/grid/index.js +4 -4
- package/src/component/grid/mixin.less +48 -48
- package/src/component/grid/row.js +44 -44
- package/src/component/grid/style.less +26 -26
- package/src/component/grid/util.js +11 -11
- package/src/component/icon_down_up/index.js +28 -28
- package/src/component/icon_down_up/stories.js +18 -18
- package/src/component/icon_down_up/style.less +8 -8
- package/src/component/image_preview/index.js +20 -20
- package/src/component/image_preview/preview_modal.js +193 -193
- package/src/component/image_preview/style.less +119 -119
- package/src/component/img_uploader/index.js +149 -149
- package/src/component/img_uploader/index.stories.js +51 -51
- package/src/component/img_uploader/style.less +22 -22
- package/src/component/input/index.js +19 -19
- package/src/component/input_number/index.js +73 -73
- package/src/component/input_number/number.js +158 -158
- package/src/component/input_number/stories.js +21 -21
- package/src/component/input_number/style.less +10 -10
- package/src/component/layout_root/index.js +165 -165
- package/src/component/lazy_img/index.js +68 -68
- package/src/component/level_list/index.js +120 -120
- package/src/component/level_list/level_item.js +64 -64
- package/src/component/level_list/level_list.stories.js +139 -139
- package/src/component/level_list/style.less +47 -47
- package/src/component/level_list/util.js +22 -22
- package/src/component/level_select/index.js +240 -240
- package/src/component/level_select/level_select.stories.js +67 -67
- package/src/component/list/base.js +155 -155
- package/src/component/list/index.js +93 -93
- package/src/component/list/list.stories.js +99 -99
- package/src/component/list/style.less +58 -58
- package/src/component/loading/index.js +45 -45
- package/src/component/loading/loading_chunk.js +59 -59
- package/src/component/loading/loading_full_screen.js +62 -62
- package/src/component/loading/stories.js +46 -46
- package/src/component/loading/style.less +92 -92
- package/src/component/mask/index.js +34 -34
- package/src/component/mask/style.less +10 -10
- package/src/component/modal/clean_modal.js +36 -36
- package/src/component/modal/index.js +293 -293
- package/src/component/modal/right_side_modal.js +37 -37
- package/src/component/modal/stories.js +96 -96
- package/src/component/modal/style.less +145 -145
- package/src/component/more_select/base.js +517 -517
- package/src/component/more_select/index.js +91 -91
- package/src/component/more_select/stories.js +261 -261
- package/src/component/more_select/style.less +130 -130
- package/src/component/nav/index.js +269 -269
- package/src/component/nav/nav.stories.js +133 -133
- package/src/component/nav/style.less +156 -156
- package/src/component/nprogress/index.js +34 -34
- package/src/component/nprogress/stories.js +22 -22
- package/src/component/nprogress/style.less +39 -39
- package/src/component/pagination/base.js +67 -67
- package/src/component/pagination/left.js +65 -65
- package/src/component/pagination/page.js +120 -120
- package/src/component/pagination/page_peek.js +96 -96
- package/src/component/pagination/pagination.js +54 -54
- package/src/component/pagination/pagination.stories.js +104 -104
- package/src/component/pagination/pagination_text.js +71 -71
- package/src/component/pagination/pagination_v2.js +30 -30
- package/src/component/pagination/right.js +67 -67
- package/src/component/pagination/style.less +52 -52
- package/src/component/pagination/util.js +5 -5
- package/src/component/picture_preview/index.js +21 -21
- package/src/component/popover/index.js +373 -373
- package/src/component/popover/stories.js +101 -101
- package/src/component/popup/index.js +4 -4
- package/src/component/popup/popup.js +172 -172
- package/src/component/popup/popup_content_confirm.js +67 -67
- package/src/component/popup/style.less +105 -105
- package/src/component/price/index.js +147 -147
- package/src/component/price/stories.js +34 -34
- package/src/component/progress/index.js +101 -101
- package/src/component/progress/stories.js +60 -60
- package/src/component/progress/style.less +88 -88
- package/src/component/progress_circle/index.js +116 -116
- package/src/component/progress_circle/stories.js +54 -54
- package/src/component/progress_circle/style.less +17 -17
- package/src/component/radio/index.js +4 -4
- package/src/component/radio/radio.js +76 -76
- package/src/component/radio/radio_group.js +51 -51
- package/src/component/radio/stories.js +80 -80
- package/src/component/radio/style.less +63 -63
- package/src/component/recommend_input/index.js +118 -118
- package/src/component/recommend_input/recommend_input.stories.js +56 -56
- package/src/component/recommend_input/style.less +25 -25
- package/src/component/select/index.js +4 -4
- package/src/component/select/option.js +22 -22
- package/src/component/select/select.js +186 -186
- package/src/component/select/select.stories.js +79 -79
- package/src/component/select/style.less +4 -4
- package/src/component/selection/index.js +132 -132
- package/src/component/selection/selection.stories.js +41 -41
- package/src/component/selection/style.less +67 -67
- package/src/component/sheet/index.js +7 -7
- package/src/component/sheet/sheet.js +348 -348
- package/src/component/sheet/sheet_action.js +16 -16
- package/src/component/sheet/sheet_batch_action.js +16 -16
- package/src/component/sheet/sheet_column.js +21 -21
- package/src/component/sheet/sheet_select.js +31 -31
- package/src/component/sheet/stories.js +210 -210
- package/src/component/sheet/style.less +95 -95
- package/src/component/steps/index.js +66 -66
- package/src/component/steps/steps.stories.js +15 -15
- package/src/component/steps/style.less +39 -39
- package/src/component/storage/index.js +54 -54
- package/src/component/storage/stories.js +38 -38
- package/src/component/switch/index.js +118 -118
- package/src/component/switch/stories.js +7 -7
- package/src/component/switch/style.less +70 -70
- package/src/component/table_select/index.js +152 -152
- package/src/component/table_select/style.less +12 -12
- package/src/component/table_select/table_select.stories.js +91 -91
- package/src/component/table_select/util.js +21 -21
- package/src/component/tabs/style.less +33 -33
- package/src/component/tabs/tabs.js +97 -97
- package/src/component/tabs/tabs.stories.js +48 -48
- package/src/component/time_span/style.less +45 -45
- package/src/component/time_span/time_span.js +183 -183
- package/src/component/time_span/time_span.stories.js +66 -66
- package/src/component/time_span/time_span_picker.js +112 -112
- package/src/component/time_span/time_span_picker.stories.js +71 -71
- package/src/component/tip/index.js +168 -168
- package/src/component/tip/stories.js +54 -54
- package/src/component/tip/style.less +41 -41
- package/src/component/tool_tip/index.js +58 -58
- package/src/component/tool_tip/stories.js +36 -36
- package/src/component/transfer/box.js +186 -141
- package/src/component/transfer/index.js +4 -4
- package/src/component/transfer/stories.js +108 -118
- package/src/component/transfer/style.less +34 -34
- package/src/component/transfer/transfer.js +181 -173
- package/src/component/transfer/transfer_group.js +178 -178
- package/src/component/transfer_v2/index.js +171 -171
- package/src/component/transfer_v2/transfer_v2.stories.js +226 -226
- package/src/component/tree/bottom.js +41 -41
- package/src/component/tree/index.js +205 -205
- package/src/component/tree/item.js +154 -154
- package/src/component/tree/list.js +151 -151
- package/src/component/tree/style.less +147 -147
- package/src/component/tree/tree.stories.js +241 -241
- package/src/component/tree/util.js +24 -24
- package/src/component/tree_v2/bottom.js +40 -40
- package/src/component/tree_v2/index.js +260 -260
- package/src/component/tree_v2/list.js +230 -230
- package/src/component/tree_v2/style.less +38 -38
- package/src/component/tree_v2/tree.stories.js +419 -419
- package/src/component/tree_v2/util.js +185 -185
- package/src/component/uploader/index.js +108 -108
- package/src/component/uploader/style.less +24 -24
- package/src/component/uploader/uploader.stories.js +51 -51
- package/src/css/arrow.less +56 -56
- package/src/css/bg.less +52 -52
- package/src/css/border.less +40 -40
- package/src/css/cover.less +236 -236
- package/src/css/cursor.less +19 -19
- package/src/css/display.less +16 -16
- package/src/css/distance.less +324 -324
- package/src/css/error.less +10 -10
- package/src/css/other.less +16 -16
- package/src/css/overflow.less +23 -23
- package/src/css/position.less +11 -11
- package/src/css/rotate.less +28 -28
- package/src/css/shadow.less +11 -11
- package/src/css/stories.js +104 -104
- package/src/css/svg.less +51 -51
- package/src/css/text.less +120 -120
- package/src/css/variables.less +62 -62
- package/src/event_type.js +16 -16
- package/src/fonts/glyphicons-halflings-regular.svg +542 -542
- package/src/index.js +237 -237
- package/src/index.less +108 -108
- package/src/less/.csscomb.json +304 -304
- package/src/less/.csslintrc +19 -19
- package/src/less/alerts.less +72 -72
- package/src/less/badges.less +65 -65
- package/src/less/bootstrap.less +51 -51
- package/src/less/breadcrumbs.less +25 -25
- package/src/less/button-groups.less +253 -253
- package/src/less/buttons.less +186 -186
- package/src/less/carousel.less +269 -269
- package/src/less/close.less +33 -33
- package/src/less/code.less +68 -68
- package/src/less/component-animations.less +39 -39
- package/src/less/custom.less +37 -37
- package/src/less/dropdowns.less +215 -215
- package/src/less/forms.less +612 -612
- package/src/less/glyphicons.less +1614 -1614
- package/src/less/grid.less +76 -76
- package/src/less/input-groups.less +175 -175
- package/src/less/jumbotron.less +53 -53
- package/src/less/labels.less +64 -64
- package/src/less/list-group.less +126 -126
- package/src/less/media.less +66 -66
- package/src/less/mixins/alerts.less +14 -14
- package/src/less/mixins/background-variant.less +9 -9
- package/src/less/mixins/border-radius.less +21 -21
- package/src/less/mixins/buttons.less +65 -65
- package/src/less/mixins/center-block.less +7 -7
- package/src/less/mixins/clearfix.less +22 -22
- package/src/less/mixins/forms.less +84 -84
- package/src/less/mixins/gradients.less +59 -59
- package/src/less/mixins/grid-framework.less +96 -96
- package/src/less/mixins/grid.less +134 -134
- package/src/less/mixins/hide-text.less +21 -21
- package/src/less/mixins/image.less +25 -25
- package/src/less/mixins/labels.less +12 -12
- package/src/less/mixins/list-group.less +30 -30
- package/src/less/mixins/nav-divider.less +10 -10
- package/src/less/mixins/nav-vertical-align.less +9 -9
- package/src/less/mixins/opacity.less +8 -8
- package/src/less/mixins/pagination.less +24 -24
- package/src/less/mixins/panels.less +24 -24
- package/src/less/mixins/progress-bar.less +10 -10
- package/src/less/mixins/reset-filter.less +8 -8
- package/src/less/mixins/reset-text.less +18 -18
- package/src/less/mixins/resize.less +6 -6
- package/src/less/mixins/responsive-visibility.less +21 -21
- package/src/less/mixins/size.less +10 -10
- package/src/less/mixins/tab-focus.less +9 -9
- package/src/less/mixins/table-row.less +28 -28
- package/src/less/mixins/text-emphasis.less +9 -9
- package/src/less/mixins/text-overflow.less +8 -8
- package/src/less/mixins/vendor-prefixes.less +254 -254
- package/src/less/mixins.less +36 -36
- package/src/less/modals.less +163 -163
- package/src/less/navbar.less +651 -651
- package/src/less/navs.less +236 -236
- package/src/less/normalize.less +424 -424
- package/src/less/pager.less +54 -54
- package/src/less/pagination.less +90 -90
- package/src/less/panels.less +274 -274
- package/src/less/popovers.less +140 -140
- package/src/less/print.less +103 -103
- package/src/less/progress-bars.less +92 -92
- package/src/less/responsive-embed.less +35 -35
- package/src/less/responsive-utilities.less +209 -209
- package/src/less/scaffolding.less +154 -154
- package/src/less/tables.less +228 -228
- package/src/less/theme.less +344 -344
- package/src/less/thumbnails.less +35 -35
- package/src/less/tooltip.less +115 -115
- package/src/less/type.less +352 -352
- package/src/less/utilities.less +57 -57
- package/src/less/variables.less +833 -833
- package/src/less/wells.less +29 -29
- package/src/sotries.js +4 -4
- package/src/validator/index.js +10 -10
- package/src/validator/rules.js +66 -66
- package/src/validator/type.js +10 -10
- package/src/validator/validator.js +86 -86
- package/src/var.less +4 -4
- package/svg/calendar-month.svg +8 -8
- package/svg/calendar-year.svg +13 -13
- package/svg/calendar.svg +17 -17
- package/svg/check-detail.svg +18 -18
- package/svg/close-circle.svg +13 -13
- package/svg/closeup.svg +20 -20
- package/svg/delete.svg +10 -10
- package/svg/down-small.svg +1 -1
- package/svg/down.svg +1 -1
- package/svg/edit-box.svg +17 -17
- package/svg/edit-pen.svg +17 -17
- package/svg/empty.svg +27 -27
- package/svg/expand.svg +21 -21
- package/svg/left-small.svg +1 -1
- package/svg/more.svg +10 -10
- package/svg/next.svg +40 -40
- package/svg/pen.svg +12 -12
- package/svg/remove.svg +1 -1
- package/svg/right-small.svg +1 -1
- package/svg/search.svg +8 -8
- package/svg/setting.svg +17 -17
- package/svg/up-small.svg +1 -1
- package/svg/up.svg +1 -1
@@ -1,553 +1,553 @@
|
|
1
|
-
import React, { useRef } from 'react'
|
2
|
-
import { storiesOf } from '@storybook/react'
|
3
|
-
import {
|
4
|
-
Form,
|
5
|
-
FormItem,
|
6
|
-
FormButton,
|
7
|
-
FormBlock,
|
8
|
-
FormGroup,
|
9
|
-
FormPanel
|
10
|
-
} from './index'
|
11
|
-
import {
|
12
|
-
Select,
|
13
|
-
Switch,
|
14
|
-
Validator,
|
15
|
-
RadioGroup,
|
16
|
-
Radio,
|
17
|
-
CheckboxGroup,
|
18
|
-
Checkbox,
|
19
|
-
InputNumberV2,
|
20
|
-
Flex,
|
21
|
-
Button
|
22
|
-
} from '../../index'
|
23
|
-
import { observable } from 'mobx'
|
24
|
-
import { observer } from 'mobx-react'
|
25
|
-
|
26
|
-
const area = [
|
27
|
-
{
|
28
|
-
value: 0,
|
29
|
-
text: '南山'
|
30
|
-
},
|
31
|
-
{
|
32
|
-
value: 1,
|
33
|
-
text: '福田'
|
34
|
-
}
|
35
|
-
]
|
36
|
-
|
37
|
-
const store = observable({
|
38
|
-
name: '',
|
39
|
-
desc: '',
|
40
|
-
area: null,
|
41
|
-
sex: 0,
|
42
|
-
taste: [],
|
43
|
-
isWork: false,
|
44
|
-
height: null,
|
45
|
-
setData(key, value) {
|
46
|
-
this[key] = value
|
47
|
-
}
|
48
|
-
})
|
49
|
-
|
50
|
-
const Tets = observer(() => {
|
51
|
-
return (
|
52
|
-
<FormBlock col={2}>
|
53
|
-
<FormItem label='邀请码' required>
|
54
|
-
<input
|
55
|
-
type='text'
|
56
|
-
value={store.name}
|
57
|
-
onChange={e => store.setData('name', e.target.value)}
|
58
|
-
/>
|
59
|
-
<div className='gm-text-desc gm-margin-top-5'>
|
60
|
-
可以允许商户在规定时间内自主修改已提交订单内容
|
61
|
-
</div>
|
62
|
-
</FormItem>
|
63
|
-
<FormItem label='名字' required>
|
64
|
-
<input
|
65
|
-
type='text'
|
66
|
-
value={store.name}
|
67
|
-
onChange={e => store.setData('name', e.target.value)}
|
68
|
-
/>
|
69
|
-
</FormItem>
|
70
|
-
<FormItem label='地区地区地区'>
|
71
|
-
<Select
|
72
|
-
data={area}
|
73
|
-
value={store.area}
|
74
|
-
onChange={value => store.setData('area', value)}
|
75
|
-
/>
|
76
|
-
</FormItem>
|
77
|
-
<FormItem label='是否工作' required>
|
78
|
-
<Switch
|
79
|
-
checked={store.isWork}
|
80
|
-
onChange={checked => store.setData('isWork', checked)}
|
81
|
-
/>
|
82
|
-
</FormItem>
|
83
|
-
<FormItem
|
84
|
-
label='描述'
|
85
|
-
required
|
86
|
-
validate={Validator.create([], store.desc)}
|
87
|
-
>
|
88
|
-
<textarea
|
89
|
-
value={store.desc}
|
90
|
-
onChange={e => store.setData('desc', e.target.value)}
|
91
|
-
/>
|
92
|
-
</FormItem>
|
93
|
-
</FormBlock>
|
94
|
-
)
|
95
|
-
})
|
96
|
-
|
97
|
-
storiesOf('Form', module)
|
98
|
-
.addParameters({
|
99
|
-
info: {
|
100
|
-
propTablesExclude: [
|
101
|
-
Select,
|
102
|
-
Switch,
|
103
|
-
RadioGroup,
|
104
|
-
Radio,
|
105
|
-
CheckboxGroup,
|
106
|
-
Checkbox,
|
107
|
-
InputNumberV2
|
108
|
-
]
|
109
|
-
}
|
110
|
-
})
|
111
|
-
.add('说明', () => <div />, {
|
112
|
-
info: {
|
113
|
-
text: `
|
114
|
-
方向:方便大家接入表单,不做冗余事情,不做不合理事情。发现不合理的地方提出来。
|
115
|
-
|
116
|
-
尽在不言中...,文档不好写。 麻烦大家保持紧密沟通,和通读文档以便获取更多信息。
|
117
|
-
|
118
|
-
哈哈哈
|
119
|
-
|
120
|
-
|
121
|
-
新UI表单约束较多
|
122
|
-
- 栏数。有 1栏(默认) 2栏 3栏。其中搜索区域 3栏,常规表单区域 1栏 和 2栏
|
123
|
-
- 栏宽。一个表单内是固定的,宽度默认 320, FormPanel特殊一栏默认是 400,具体情况可自定义
|
124
|
-
- Item 内自然撑开
|
125
|
-
- Item宽度。一般占一栏,可能占两栏,可能占三栏
|
126
|
-
- Item高度。一般占一行,其他看具体情况自然往下撑开
|
127
|
-
`
|
128
|
-
}
|
129
|
-
})
|
130
|
-
.add(
|
131
|
-
'单栏',
|
132
|
-
() => (
|
133
|
-
<Form
|
134
|
-
disabledCol
|
135
|
-
labelWidth='100px'
|
136
|
-
onSubmit={() => console.log('onSubmit')}
|
137
|
-
>
|
138
|
-
<FormItem label='名字' required>
|
139
|
-
<input
|
140
|
-
type='text'
|
141
|
-
value={store.name}
|
142
|
-
onChange={e => store.setData('name', e.target.value)}
|
143
|
-
/>
|
144
|
-
</FormItem>
|
145
|
-
<FormItem
|
146
|
-
label='描述'
|
147
|
-
required
|
148
|
-
validate={Validator.create([], store.desc)}
|
149
|
-
>
|
150
|
-
<textarea
|
151
|
-
value={store.desc}
|
152
|
-
onChange={e => store.setData('desc', e.target.value)}
|
153
|
-
/>
|
154
|
-
</FormItem>
|
155
|
-
<FormItem label='地区'>
|
156
|
-
<Select
|
157
|
-
data={area}
|
158
|
-
value={store.area}
|
159
|
-
onChange={value => store.setData('area', value)}
|
160
|
-
/>
|
161
|
-
</FormItem>
|
162
|
-
<FormItem label='是否工作'>
|
163
|
-
<Switch
|
164
|
-
checked={store.isWork}
|
165
|
-
onChange={checked => store.setData('isWork', checked)}
|
166
|
-
/>
|
167
|
-
</FormItem>
|
168
|
-
<FormItem label='性别'>
|
169
|
-
<RadioGroup
|
170
|
-
name='sex'
|
171
|
-
inline
|
172
|
-
value={store.sex}
|
173
|
-
onChange={value => store.setData('sex', value)}
|
174
|
-
>
|
175
|
-
<Radio value={0}>男</Radio>
|
176
|
-
<Radio value={1}>女</Radio>
|
177
|
-
</RadioGroup>
|
178
|
-
</FormItem>
|
179
|
-
<FormItem label='兴趣'>
|
180
|
-
<CheckboxGroup
|
181
|
-
name='taste'
|
182
|
-
inline
|
183
|
-
value={store.taste}
|
184
|
-
onChange={value => store.setData('taste', value)}
|
185
|
-
>
|
186
|
-
<Checkbox value={0}>阅读</Checkbox>
|
187
|
-
<Checkbox value={1}>打篮球</Checkbox>
|
188
|
-
<Checkbox value={2}>美食</Checkbox>
|
189
|
-
<Checkbox value={3}>旅游</Checkbox>
|
190
|
-
</CheckboxGroup>
|
191
|
-
</FormItem>
|
192
|
-
<FormItem label='自定义' unLabelTop>
|
193
|
-
<div>
|
194
|
-
这里是自定义。没有上边距的情况下,label 要对齐,则提供 unLabelTop
|
195
|
-
去掉 label 的上边距
|
196
|
-
</div>
|
197
|
-
</FormItem>
|
198
|
-
<FormItem label='身高'>
|
199
|
-
<InputNumberV2
|
200
|
-
value={store.height}
|
201
|
-
onChange={value => store.setData('height', value)}
|
202
|
-
/>
|
203
|
-
<div className='gm-text-desc gm-margin-top-5'>要填写升高,升高</div>
|
204
|
-
<div>(这里演示多个 children 的情况)</div>
|
205
|
-
</FormItem>
|
206
|
-
<FormButton>
|
207
|
-
<Button type='primary' htmlType='submit'>
|
208
|
-
提交
|
209
|
-
</Button>
|
210
|
-
</FormButton>
|
211
|
-
</Form>
|
212
|
-
),
|
213
|
-
{
|
214
|
-
info: {
|
215
|
-
text: `
|
216
|
-
Form 包住。一栏用法需要提供 disableCol。
|
217
|
-
|
218
|
-
FormItem 包住表单元素
|
219
|
-
- 可以简单包住 input 即可,FormItem 会自动去识别常用的表单元素,并添加 form-control 类名,以便撑开
|
220
|
-
- children 可以是数组,FormItem 读到第一个表单元素,做上面的操作
|
221
|
-
|
222
|
-
`
|
223
|
-
}
|
224
|
-
}
|
225
|
-
)
|
226
|
-
.add(
|
227
|
-
'多栏',
|
228
|
-
() => (
|
229
|
-
<Form labelWidth='100px' onSubmit={() => console.log('onSubmit')}>
|
230
|
-
<FormBlock col={2}>
|
231
|
-
<FormItem label='名字' required>
|
232
|
-
<input
|
233
|
-
type='text'
|
234
|
-
value={store.name}
|
235
|
-
onChange={e => store.setData('name', e.target.value)}
|
236
|
-
/>
|
237
|
-
</FormItem>
|
238
|
-
<FormItem label='地区'>
|
239
|
-
<Select
|
240
|
-
data={area}
|
241
|
-
value={store.area}
|
242
|
-
onChange={value => store.setData('area', value)}
|
243
|
-
/>
|
244
|
-
</FormItem>
|
245
|
-
<FormItem label='是否工作'>
|
246
|
-
<Switch
|
247
|
-
checked={store.isWork}
|
248
|
-
onChange={checked => store.setData('isWork', checked)}
|
249
|
-
/>
|
250
|
-
</FormItem>
|
251
|
-
<FormItem label='身高'>
|
252
|
-
<InputNumberV2
|
253
|
-
value={store.height}
|
254
|
-
onChange={value => store.setData('height', value)}
|
255
|
-
/>
|
256
|
-
<div className='gm-text-desc gm-margin-top-5'>要填写升高,升高</div>
|
257
|
-
<div>(这里演示多个 children 的情况)</div>
|
258
|
-
</FormItem>
|
259
|
-
<FormItem label='性别'>
|
260
|
-
<RadioGroup
|
261
|
-
name='sex'
|
262
|
-
inline
|
263
|
-
value={store.sex}
|
264
|
-
onChange={value => store.setData('sex', value)}
|
265
|
-
>
|
266
|
-
<Radio value={0}>男</Radio>
|
267
|
-
<Radio value={1}>女</Radio>
|
268
|
-
</RadioGroup>
|
269
|
-
</FormItem>
|
270
|
-
<FormItem label='兴趣'>
|
271
|
-
<CheckboxGroup
|
272
|
-
name='taste'
|
273
|
-
inline
|
274
|
-
value={store.taste}
|
275
|
-
onChange={value => store.setData('taste', value)}
|
276
|
-
>
|
277
|
-
<Checkbox value={0}>阅读</Checkbox>
|
278
|
-
<Checkbox value={1}>打篮球</Checkbox>
|
279
|
-
<Checkbox value={2}>美食</Checkbox>
|
280
|
-
<Checkbox value={3}>旅游</Checkbox>
|
281
|
-
</CheckboxGroup>
|
282
|
-
</FormItem>
|
283
|
-
</FormBlock>
|
284
|
-
<FormItem
|
285
|
-
col={2}
|
286
|
-
label='描述'
|
287
|
-
required
|
288
|
-
validate={Validator.create([], store.desc)}
|
289
|
-
>
|
290
|
-
<textarea
|
291
|
-
value={store.desc}
|
292
|
-
onChange={e => store.setData('desc', e.target.value)}
|
293
|
-
/>
|
294
|
-
</FormItem>
|
295
|
-
<FormItem col={2} label='自定义' unLabelTop>
|
296
|
-
<div>
|
297
|
-
这里是自定义。没有上边距的情况下,label 要对齐,则提供 unLabelTop
|
298
|
-
去掉 label 的上边距
|
299
|
-
</div>
|
300
|
-
</FormItem>
|
301
|
-
|
302
|
-
<FormButton>
|
303
|
-
<Button type='primary' htmlType='submit'>
|
304
|
-
提交
|
305
|
-
</Button>
|
306
|
-
</FormButton>
|
307
|
-
</Form>
|
308
|
-
),
|
309
|
-
{
|
310
|
-
info: {
|
311
|
-
text: `
|
312
|
-
多栏会涉及 FormBlock。用 FormBlock 把一类表单元素框起来。然后给 col,让表单元素自适应
|
313
|
-
`
|
314
|
-
}
|
315
|
-
}
|
316
|
-
)
|
317
|
-
.add(
|
318
|
-
'多个表单',
|
319
|
-
() => {
|
320
|
-
const form1 = useRef(null)
|
321
|
-
const form2 = useRef(null)
|
322
|
-
return (
|
323
|
-
<FormGroup
|
324
|
-
formRefs={[form1, form2]}
|
325
|
-
onCancel={() => console.log('Cancel')}
|
326
|
-
onSubmit={() => console.log('onSubmit')}
|
327
|
-
>
|
328
|
-
<div>第一个表单</div>
|
329
|
-
<Form ref={form1} labelWidth='100px' hasButtonInGroup>
|
330
|
-
<FormItem label='名字' required>
|
331
|
-
<input
|
332
|
-
type='text'
|
333
|
-
value={store.name}
|
334
|
-
onChange={e => store.setData('name', e.target.value)}
|
335
|
-
/>
|
336
|
-
</FormItem>
|
337
|
-
</Form>
|
338
|
-
<div>第二个表单</div>
|
339
|
-
<Form ref={form2} labelWidth='100px' hasButtonInGroup>
|
340
|
-
<FormItem
|
341
|
-
label='描述'
|
342
|
-
required
|
343
|
-
validate={Validator.create([], store.desc)}
|
344
|
-
>
|
345
|
-
<textarea
|
346
|
-
value={store.desc}
|
347
|
-
onChange={e => store.setData('desc', e.target.value)}
|
348
|
-
/>
|
349
|
-
</FormItem>
|
350
|
-
<FormItem label='名字' required>
|
351
|
-
<input
|
352
|
-
type='text'
|
353
|
-
value={store.name}
|
354
|
-
onChange={e => store.setData('name', e.target.value)}
|
355
|
-
/>
|
356
|
-
</FormItem>
|
357
|
-
</Form>
|
358
|
-
</FormGroup>
|
359
|
-
)
|
360
|
-
},
|
361
|
-
{
|
362
|
-
info: {
|
363
|
-
text: `
|
364
|
-
当表单元素多的时候,按钮部分会吸低
|
365
|
-
`
|
366
|
-
}
|
367
|
-
}
|
368
|
-
)
|
369
|
-
.add('form panel', () => {
|
370
|
-
const form3 = useRef(null)
|
371
|
-
const form4 = useRef(null)
|
372
|
-
return (
|
373
|
-
<FormGroup
|
374
|
-
formRefs={[form3, form4]}
|
375
|
-
onCancel={() => console.log('Cancel')}
|
376
|
-
// onSubmit={() => console.log('onSubmit')}
|
377
|
-
onSubmitValidated={() => console.log('onSubmitValidated')}
|
378
|
-
>
|
379
|
-
<FormPanel
|
380
|
-
title='店铺设置'
|
381
|
-
left={
|
382
|
-
<button
|
383
|
-
className='btn btn-primary gm-margin-left-10'
|
384
|
-
onClick={() => console.log('搜索')}
|
385
|
-
>
|
386
|
-
搜索
|
387
|
-
</button>
|
388
|
-
}
|
389
|
-
right={<Button onClick={() => console.log('删除')}>删除</Button>}
|
390
|
-
>
|
391
|
-
<Form
|
392
|
-
colWidth='400px'
|
393
|
-
ref={form3}
|
394
|
-
labelWidth='160px'
|
395
|
-
hasButtonInGroup
|
396
|
-
>
|
397
|
-
<FormItem label='名字' colWidth='700px' required>
|
398
|
-
<input
|
399
|
-
type='text'
|
400
|
-
className='form-control'
|
401
|
-
value={store.name}
|
402
|
-
onChange={e => store.setData('name', e.target.value)}
|
403
|
-
/>
|
404
|
-
</FormItem>
|
405
|
-
<FormItem label='邀请码' required>
|
406
|
-
<input
|
407
|
-
type='text'
|
408
|
-
value={store.name}
|
409
|
-
onChange={e => store.setData('name', e.target.value)}
|
410
|
-
/>
|
411
|
-
<div className='gm-text-desc gm-margin-top-5'>
|
412
|
-
可以允许商户在规定时间内自主修改已提交订单内容
|
413
|
-
</div>
|
414
|
-
</FormItem>
|
415
|
-
|
416
|
-
<FormBlock col={2}>
|
417
|
-
<FormItem
|
418
|
-
label='名字'
|
419
|
-
required
|
420
|
-
toolTip={
|
421
|
-
<div
|
422
|
-
className='gm-padding-10 gm-bg'
|
423
|
-
style={{ width: '455px' }}
|
424
|
-
>
|
425
|
-
<p style={{ marginBottom: '4px', fontSize: '12px' }}>
|
426
|
-
23333333333333333
|
427
|
-
</p>
|
428
|
-
<p style={{ marginBottom: 0, fontSize: '12px' }}>
|
429
|
-
4555555555555555
|
430
|
-
</p>
|
431
|
-
</div>
|
432
|
-
}
|
433
|
-
>
|
434
|
-
<Flex alignCenter>
|
435
|
-
<input
|
436
|
-
type='text'
|
437
|
-
className='form-control'
|
438
|
-
value={store.name}
|
439
|
-
onChange={e => store.setData('name', e.target.value)}
|
440
|
-
/>
|
441
|
-
</Flex>
|
442
|
-
</FormItem>
|
443
|
-
<FormItem
|
444
|
-
label='地区'
|
445
|
-
toolTipLeft
|
446
|
-
toolTip={
|
447
|
-
<div
|
448
|
-
className='gm-padding-10 gm-bg'
|
449
|
-
style={{ width: '455px' }}
|
450
|
-
>
|
451
|
-
<p style={{ marginBottom: '4px', fontSize: '12px' }}>
|
452
|
-
23333333333333333
|
453
|
-
</p>
|
454
|
-
<p style={{ marginBottom: 0, fontSize: '12px' }}>
|
455
|
-
4555555555555555
|
456
|
-
</p>
|
457
|
-
</div>
|
458
|
-
}
|
459
|
-
>
|
460
|
-
<Select
|
461
|
-
data={area}
|
462
|
-
value={store.area}
|
463
|
-
onChange={value => store.setData('area', value)}
|
464
|
-
/>
|
465
|
-
</FormItem>
|
466
|
-
<FormItem
|
467
|
-
label='描述'
|
468
|
-
required
|
469
|
-
validate={Validator.create([], store.desc)}
|
470
|
-
>
|
471
|
-
<textarea
|
472
|
-
value={store.desc}
|
473
|
-
onChange={e => store.setData('desc', e.target.value)}
|
474
|
-
/>
|
475
|
-
</FormItem>
|
476
|
-
<FormItem label='兴趣'>
|
477
|
-
<CheckboxGroup
|
478
|
-
style={{ width: '400px' }}
|
479
|
-
name='taste'
|
480
|
-
inline
|
481
|
-
value={store.taste}
|
482
|
-
onChange={value => store.setData('taste', value)}
|
483
|
-
>
|
484
|
-
<Checkbox value={0}>阅读</Checkbox>
|
485
|
-
<Checkbox value={1}>打篮球</Checkbox>
|
486
|
-
<Checkbox value={2}>美食</Checkbox>
|
487
|
-
<Checkbox value={0}>阅读</Checkbox>
|
488
|
-
<Checkbox value={1}>打篮球</Checkbox>
|
489
|
-
<Checkbox value={2}>美食</Checkbox>
|
490
|
-
</CheckboxGroup>
|
491
|
-
</FormItem>
|
492
|
-
</FormBlock>
|
493
|
-
<FormPanel.More>
|
494
|
-
<FormBlock col={2}>
|
495
|
-
<FormItem label='邀请码' required>
|
496
|
-
<input
|
497
|
-
type='text'
|
498
|
-
value={store.name}
|
499
|
-
onChange={e => store.setData('name', e.target.value)}
|
500
|
-
/>
|
501
|
-
<div className='gm-text-desc gm-margin-top-5'>
|
502
|
-
可以允许商户在规定时间内自主修改已提交订单内容
|
503
|
-
</div>
|
504
|
-
</FormItem>
|
505
|
-
<FormItem label='名字' required>
|
506
|
-
<input
|
507
|
-
type='text'
|
508
|
-
value={store.name}
|
509
|
-
onChange={e => store.setData('name', e.target.value)}
|
510
|
-
/>
|
511
|
-
</FormItem>
|
512
|
-
<FormItem label={<span>地区地区地区</span>}>
|
513
|
-
<Select
|
514
|
-
data={area}
|
515
|
-
value={store.area}
|
516
|
-
onChange={value => store.setData('area', value)}
|
517
|
-
/>
|
518
|
-
</FormItem>
|
519
|
-
<FormItem label='是否工作' required>
|
520
|
-
<Switch
|
521
|
-
checked={store.isWork}
|
522
|
-
onChange={checked => store.setData('isWork', checked)}
|
523
|
-
/>
|
524
|
-
</FormItem>
|
525
|
-
</FormBlock>
|
526
|
-
</FormPanel.More>
|
527
|
-
</Form>
|
528
|
-
</FormPanel>
|
529
|
-
|
530
|
-
<FormPanel
|
531
|
-
title='店铺设置'
|
532
|
-
left={
|
533
|
-
<span
|
534
|
-
className='gm-margin-left-10'
|
535
|
-
onClick={() => console.log('搜索')}
|
536
|
-
>
|
537
|
-
搜索
|
538
|
-
</span>
|
539
|
-
}
|
540
|
-
right={<span onClick={() => console.log('删除')}>删除</span>}
|
541
|
-
>
|
542
|
-
<Form
|
543
|
-
colWidth='400px'
|
544
|
-
ref={form4}
|
545
|
-
labelWidth='160px'
|
546
|
-
hasButtonInGroup
|
547
|
-
>
|
548
|
-
<Tets />
|
549
|
-
</Form>
|
550
|
-
</FormPanel>
|
551
|
-
</FormGroup>
|
552
|
-
)
|
553
|
-
})
|
1
|
+
import React, { useRef } from 'react'
|
2
|
+
import { storiesOf } from '@storybook/react'
|
3
|
+
import {
|
4
|
+
Form,
|
5
|
+
FormItem,
|
6
|
+
FormButton,
|
7
|
+
FormBlock,
|
8
|
+
FormGroup,
|
9
|
+
FormPanel
|
10
|
+
} from './index'
|
11
|
+
import {
|
12
|
+
Select,
|
13
|
+
Switch,
|
14
|
+
Validator,
|
15
|
+
RadioGroup,
|
16
|
+
Radio,
|
17
|
+
CheckboxGroup,
|
18
|
+
Checkbox,
|
19
|
+
InputNumberV2,
|
20
|
+
Flex,
|
21
|
+
Button
|
22
|
+
} from '../../index'
|
23
|
+
import { observable } from 'mobx'
|
24
|
+
import { observer } from 'mobx-react'
|
25
|
+
|
26
|
+
const area = [
|
27
|
+
{
|
28
|
+
value: 0,
|
29
|
+
text: '南山'
|
30
|
+
},
|
31
|
+
{
|
32
|
+
value: 1,
|
33
|
+
text: '福田'
|
34
|
+
}
|
35
|
+
]
|
36
|
+
|
37
|
+
const store = observable({
|
38
|
+
name: '',
|
39
|
+
desc: '',
|
40
|
+
area: null,
|
41
|
+
sex: 0,
|
42
|
+
taste: [],
|
43
|
+
isWork: false,
|
44
|
+
height: null,
|
45
|
+
setData(key, value) {
|
46
|
+
this[key] = value
|
47
|
+
}
|
48
|
+
})
|
49
|
+
|
50
|
+
const Tets = observer(() => {
|
51
|
+
return (
|
52
|
+
<FormBlock col={2}>
|
53
|
+
<FormItem label='邀请码' required>
|
54
|
+
<input
|
55
|
+
type='text'
|
56
|
+
value={store.name}
|
57
|
+
onChange={e => store.setData('name', e.target.value)}
|
58
|
+
/>
|
59
|
+
<div className='gm-text-desc gm-margin-top-5'>
|
60
|
+
可以允许商户在规定时间内自主修改已提交订单内容
|
61
|
+
</div>
|
62
|
+
</FormItem>
|
63
|
+
<FormItem label='名字' required>
|
64
|
+
<input
|
65
|
+
type='text'
|
66
|
+
value={store.name}
|
67
|
+
onChange={e => store.setData('name', e.target.value)}
|
68
|
+
/>
|
69
|
+
</FormItem>
|
70
|
+
<FormItem label='地区地区地区'>
|
71
|
+
<Select
|
72
|
+
data={area}
|
73
|
+
value={store.area}
|
74
|
+
onChange={value => store.setData('area', value)}
|
75
|
+
/>
|
76
|
+
</FormItem>
|
77
|
+
<FormItem label='是否工作' required>
|
78
|
+
<Switch
|
79
|
+
checked={store.isWork}
|
80
|
+
onChange={checked => store.setData('isWork', checked)}
|
81
|
+
/>
|
82
|
+
</FormItem>
|
83
|
+
<FormItem
|
84
|
+
label='描述'
|
85
|
+
required
|
86
|
+
validate={Validator.create([], store.desc)}
|
87
|
+
>
|
88
|
+
<textarea
|
89
|
+
value={store.desc}
|
90
|
+
onChange={e => store.setData('desc', e.target.value)}
|
91
|
+
/>
|
92
|
+
</FormItem>
|
93
|
+
</FormBlock>
|
94
|
+
)
|
95
|
+
})
|
96
|
+
|
97
|
+
storiesOf('Form', module)
|
98
|
+
.addParameters({
|
99
|
+
info: {
|
100
|
+
propTablesExclude: [
|
101
|
+
Select,
|
102
|
+
Switch,
|
103
|
+
RadioGroup,
|
104
|
+
Radio,
|
105
|
+
CheckboxGroup,
|
106
|
+
Checkbox,
|
107
|
+
InputNumberV2
|
108
|
+
]
|
109
|
+
}
|
110
|
+
})
|
111
|
+
.add('说明', () => <div />, {
|
112
|
+
info: {
|
113
|
+
text: `
|
114
|
+
方向:方便大家接入表单,不做冗余事情,不做不合理事情。发现不合理的地方提出来。
|
115
|
+
|
116
|
+
尽在不言中...,文档不好写。 麻烦大家保持紧密沟通,和通读文档以便获取更多信息。
|
117
|
+
|
118
|
+
哈哈哈
|
119
|
+
|
120
|
+
|
121
|
+
新UI表单约束较多
|
122
|
+
- 栏数。有 1栏(默认) 2栏 3栏。其中搜索区域 3栏,常规表单区域 1栏 和 2栏
|
123
|
+
- 栏宽。一个表单内是固定的,宽度默认 320, FormPanel特殊一栏默认是 400,具体情况可自定义
|
124
|
+
- Item 内自然撑开
|
125
|
+
- Item宽度。一般占一栏,可能占两栏,可能占三栏
|
126
|
+
- Item高度。一般占一行,其他看具体情况自然往下撑开
|
127
|
+
`
|
128
|
+
}
|
129
|
+
})
|
130
|
+
.add(
|
131
|
+
'单栏',
|
132
|
+
() => (
|
133
|
+
<Form
|
134
|
+
disabledCol
|
135
|
+
labelWidth='100px'
|
136
|
+
onSubmit={() => console.log('onSubmit')}
|
137
|
+
>
|
138
|
+
<FormItem label='名字' required>
|
139
|
+
<input
|
140
|
+
type='text'
|
141
|
+
value={store.name}
|
142
|
+
onChange={e => store.setData('name', e.target.value)}
|
143
|
+
/>
|
144
|
+
</FormItem>
|
145
|
+
<FormItem
|
146
|
+
label='描述'
|
147
|
+
required
|
148
|
+
validate={Validator.create([], store.desc)}
|
149
|
+
>
|
150
|
+
<textarea
|
151
|
+
value={store.desc}
|
152
|
+
onChange={e => store.setData('desc', e.target.value)}
|
153
|
+
/>
|
154
|
+
</FormItem>
|
155
|
+
<FormItem label='地区'>
|
156
|
+
<Select
|
157
|
+
data={area}
|
158
|
+
value={store.area}
|
159
|
+
onChange={value => store.setData('area', value)}
|
160
|
+
/>
|
161
|
+
</FormItem>
|
162
|
+
<FormItem label='是否工作'>
|
163
|
+
<Switch
|
164
|
+
checked={store.isWork}
|
165
|
+
onChange={checked => store.setData('isWork', checked)}
|
166
|
+
/>
|
167
|
+
</FormItem>
|
168
|
+
<FormItem label='性别'>
|
169
|
+
<RadioGroup
|
170
|
+
name='sex'
|
171
|
+
inline
|
172
|
+
value={store.sex}
|
173
|
+
onChange={value => store.setData('sex', value)}
|
174
|
+
>
|
175
|
+
<Radio value={0}>男</Radio>
|
176
|
+
<Radio value={1}>女</Radio>
|
177
|
+
</RadioGroup>
|
178
|
+
</FormItem>
|
179
|
+
<FormItem label='兴趣'>
|
180
|
+
<CheckboxGroup
|
181
|
+
name='taste'
|
182
|
+
inline
|
183
|
+
value={store.taste}
|
184
|
+
onChange={value => store.setData('taste', value)}
|
185
|
+
>
|
186
|
+
<Checkbox value={0}>阅读</Checkbox>
|
187
|
+
<Checkbox value={1}>打篮球</Checkbox>
|
188
|
+
<Checkbox value={2}>美食</Checkbox>
|
189
|
+
<Checkbox value={3}>旅游</Checkbox>
|
190
|
+
</CheckboxGroup>
|
191
|
+
</FormItem>
|
192
|
+
<FormItem label='自定义' unLabelTop>
|
193
|
+
<div>
|
194
|
+
这里是自定义。没有上边距的情况下,label 要对齐,则提供 unLabelTop
|
195
|
+
去掉 label 的上边距
|
196
|
+
</div>
|
197
|
+
</FormItem>
|
198
|
+
<FormItem label='身高'>
|
199
|
+
<InputNumberV2
|
200
|
+
value={store.height}
|
201
|
+
onChange={value => store.setData('height', value)}
|
202
|
+
/>
|
203
|
+
<div className='gm-text-desc gm-margin-top-5'>要填写升高,升高</div>
|
204
|
+
<div>(这里演示多个 children 的情况)</div>
|
205
|
+
</FormItem>
|
206
|
+
<FormButton>
|
207
|
+
<Button type='primary' htmlType='submit'>
|
208
|
+
提交
|
209
|
+
</Button>
|
210
|
+
</FormButton>
|
211
|
+
</Form>
|
212
|
+
),
|
213
|
+
{
|
214
|
+
info: {
|
215
|
+
text: `
|
216
|
+
Form 包住。一栏用法需要提供 disableCol。
|
217
|
+
|
218
|
+
FormItem 包住表单元素
|
219
|
+
- 可以简单包住 input 即可,FormItem 会自动去识别常用的表单元素,并添加 form-control 类名,以便撑开
|
220
|
+
- children 可以是数组,FormItem 读到第一个表单元素,做上面的操作
|
221
|
+
|
222
|
+
`
|
223
|
+
}
|
224
|
+
}
|
225
|
+
)
|
226
|
+
.add(
|
227
|
+
'多栏',
|
228
|
+
() => (
|
229
|
+
<Form labelWidth='100px' onSubmit={() => console.log('onSubmit')}>
|
230
|
+
<FormBlock col={2}>
|
231
|
+
<FormItem label='名字' required>
|
232
|
+
<input
|
233
|
+
type='text'
|
234
|
+
value={store.name}
|
235
|
+
onChange={e => store.setData('name', e.target.value)}
|
236
|
+
/>
|
237
|
+
</FormItem>
|
238
|
+
<FormItem label='地区'>
|
239
|
+
<Select
|
240
|
+
data={area}
|
241
|
+
value={store.area}
|
242
|
+
onChange={value => store.setData('area', value)}
|
243
|
+
/>
|
244
|
+
</FormItem>
|
245
|
+
<FormItem label='是否工作'>
|
246
|
+
<Switch
|
247
|
+
checked={store.isWork}
|
248
|
+
onChange={checked => store.setData('isWork', checked)}
|
249
|
+
/>
|
250
|
+
</FormItem>
|
251
|
+
<FormItem label='身高'>
|
252
|
+
<InputNumberV2
|
253
|
+
value={store.height}
|
254
|
+
onChange={value => store.setData('height', value)}
|
255
|
+
/>
|
256
|
+
<div className='gm-text-desc gm-margin-top-5'>要填写升高,升高</div>
|
257
|
+
<div>(这里演示多个 children 的情况)</div>
|
258
|
+
</FormItem>
|
259
|
+
<FormItem label='性别'>
|
260
|
+
<RadioGroup
|
261
|
+
name='sex'
|
262
|
+
inline
|
263
|
+
value={store.sex}
|
264
|
+
onChange={value => store.setData('sex', value)}
|
265
|
+
>
|
266
|
+
<Radio value={0}>男</Radio>
|
267
|
+
<Radio value={1}>女</Radio>
|
268
|
+
</RadioGroup>
|
269
|
+
</FormItem>
|
270
|
+
<FormItem label='兴趣'>
|
271
|
+
<CheckboxGroup
|
272
|
+
name='taste'
|
273
|
+
inline
|
274
|
+
value={store.taste}
|
275
|
+
onChange={value => store.setData('taste', value)}
|
276
|
+
>
|
277
|
+
<Checkbox value={0}>阅读</Checkbox>
|
278
|
+
<Checkbox value={1}>打篮球</Checkbox>
|
279
|
+
<Checkbox value={2}>美食</Checkbox>
|
280
|
+
<Checkbox value={3}>旅游</Checkbox>
|
281
|
+
</CheckboxGroup>
|
282
|
+
</FormItem>
|
283
|
+
</FormBlock>
|
284
|
+
<FormItem
|
285
|
+
col={2}
|
286
|
+
label='描述'
|
287
|
+
required
|
288
|
+
validate={Validator.create([], store.desc)}
|
289
|
+
>
|
290
|
+
<textarea
|
291
|
+
value={store.desc}
|
292
|
+
onChange={e => store.setData('desc', e.target.value)}
|
293
|
+
/>
|
294
|
+
</FormItem>
|
295
|
+
<FormItem col={2} label='自定义' unLabelTop>
|
296
|
+
<div>
|
297
|
+
这里是自定义。没有上边距的情况下,label 要对齐,则提供 unLabelTop
|
298
|
+
去掉 label 的上边距
|
299
|
+
</div>
|
300
|
+
</FormItem>
|
301
|
+
|
302
|
+
<FormButton>
|
303
|
+
<Button type='primary' htmlType='submit'>
|
304
|
+
提交
|
305
|
+
</Button>
|
306
|
+
</FormButton>
|
307
|
+
</Form>
|
308
|
+
),
|
309
|
+
{
|
310
|
+
info: {
|
311
|
+
text: `
|
312
|
+
多栏会涉及 FormBlock。用 FormBlock 把一类表单元素框起来。然后给 col,让表单元素自适应
|
313
|
+
`
|
314
|
+
}
|
315
|
+
}
|
316
|
+
)
|
317
|
+
.add(
|
318
|
+
'多个表单',
|
319
|
+
() => {
|
320
|
+
const form1 = useRef(null)
|
321
|
+
const form2 = useRef(null)
|
322
|
+
return (
|
323
|
+
<FormGroup
|
324
|
+
formRefs={[form1, form2]}
|
325
|
+
onCancel={() => console.log('Cancel')}
|
326
|
+
onSubmit={() => console.log('onSubmit')}
|
327
|
+
>
|
328
|
+
<div>第一个表单</div>
|
329
|
+
<Form ref={form1} labelWidth='100px' hasButtonInGroup>
|
330
|
+
<FormItem label='名字' required>
|
331
|
+
<input
|
332
|
+
type='text'
|
333
|
+
value={store.name}
|
334
|
+
onChange={e => store.setData('name', e.target.value)}
|
335
|
+
/>
|
336
|
+
</FormItem>
|
337
|
+
</Form>
|
338
|
+
<div>第二个表单</div>
|
339
|
+
<Form ref={form2} labelWidth='100px' hasButtonInGroup>
|
340
|
+
<FormItem
|
341
|
+
label='描述'
|
342
|
+
required
|
343
|
+
validate={Validator.create([], store.desc)}
|
344
|
+
>
|
345
|
+
<textarea
|
346
|
+
value={store.desc}
|
347
|
+
onChange={e => store.setData('desc', e.target.value)}
|
348
|
+
/>
|
349
|
+
</FormItem>
|
350
|
+
<FormItem label='名字' required>
|
351
|
+
<input
|
352
|
+
type='text'
|
353
|
+
value={store.name}
|
354
|
+
onChange={e => store.setData('name', e.target.value)}
|
355
|
+
/>
|
356
|
+
</FormItem>
|
357
|
+
</Form>
|
358
|
+
</FormGroup>
|
359
|
+
)
|
360
|
+
},
|
361
|
+
{
|
362
|
+
info: {
|
363
|
+
text: `
|
364
|
+
当表单元素多的时候,按钮部分会吸低
|
365
|
+
`
|
366
|
+
}
|
367
|
+
}
|
368
|
+
)
|
369
|
+
.add('form panel', () => {
|
370
|
+
const form3 = useRef(null)
|
371
|
+
const form4 = useRef(null)
|
372
|
+
return (
|
373
|
+
<FormGroup
|
374
|
+
formRefs={[form3, form4]}
|
375
|
+
onCancel={() => console.log('Cancel')}
|
376
|
+
// onSubmit={() => console.log('onSubmit')}
|
377
|
+
onSubmitValidated={() => console.log('onSubmitValidated')}
|
378
|
+
>
|
379
|
+
<FormPanel
|
380
|
+
title='店铺设置'
|
381
|
+
left={
|
382
|
+
<button
|
383
|
+
className='btn btn-primary gm-margin-left-10'
|
384
|
+
onClick={() => console.log('搜索')}
|
385
|
+
>
|
386
|
+
搜索
|
387
|
+
</button>
|
388
|
+
}
|
389
|
+
right={<Button onClick={() => console.log('删除')}>删除</Button>}
|
390
|
+
>
|
391
|
+
<Form
|
392
|
+
colWidth='400px'
|
393
|
+
ref={form3}
|
394
|
+
labelWidth='160px'
|
395
|
+
hasButtonInGroup
|
396
|
+
>
|
397
|
+
<FormItem label='名字' colWidth='700px' required>
|
398
|
+
<input
|
399
|
+
type='text'
|
400
|
+
className='form-control'
|
401
|
+
value={store.name}
|
402
|
+
onChange={e => store.setData('name', e.target.value)}
|
403
|
+
/>
|
404
|
+
</FormItem>
|
405
|
+
<FormItem label='邀请码' required>
|
406
|
+
<input
|
407
|
+
type='text'
|
408
|
+
value={store.name}
|
409
|
+
onChange={e => store.setData('name', e.target.value)}
|
410
|
+
/>
|
411
|
+
<div className='gm-text-desc gm-margin-top-5'>
|
412
|
+
可以允许商户在规定时间内自主修改已提交订单内容
|
413
|
+
</div>
|
414
|
+
</FormItem>
|
415
|
+
|
416
|
+
<FormBlock col={2}>
|
417
|
+
<FormItem
|
418
|
+
label='名字'
|
419
|
+
required
|
420
|
+
toolTip={
|
421
|
+
<div
|
422
|
+
className='gm-padding-10 gm-bg'
|
423
|
+
style={{ width: '455px' }}
|
424
|
+
>
|
425
|
+
<p style={{ marginBottom: '4px', fontSize: '12px' }}>
|
426
|
+
23333333333333333
|
427
|
+
</p>
|
428
|
+
<p style={{ marginBottom: 0, fontSize: '12px' }}>
|
429
|
+
4555555555555555
|
430
|
+
</p>
|
431
|
+
</div>
|
432
|
+
}
|
433
|
+
>
|
434
|
+
<Flex alignCenter>
|
435
|
+
<input
|
436
|
+
type='text'
|
437
|
+
className='form-control'
|
438
|
+
value={store.name}
|
439
|
+
onChange={e => store.setData('name', e.target.value)}
|
440
|
+
/>
|
441
|
+
</Flex>
|
442
|
+
</FormItem>
|
443
|
+
<FormItem
|
444
|
+
label='地区'
|
445
|
+
toolTipLeft
|
446
|
+
toolTip={
|
447
|
+
<div
|
448
|
+
className='gm-padding-10 gm-bg'
|
449
|
+
style={{ width: '455px' }}
|
450
|
+
>
|
451
|
+
<p style={{ marginBottom: '4px', fontSize: '12px' }}>
|
452
|
+
23333333333333333
|
453
|
+
</p>
|
454
|
+
<p style={{ marginBottom: 0, fontSize: '12px' }}>
|
455
|
+
4555555555555555
|
456
|
+
</p>
|
457
|
+
</div>
|
458
|
+
}
|
459
|
+
>
|
460
|
+
<Select
|
461
|
+
data={area}
|
462
|
+
value={store.area}
|
463
|
+
onChange={value => store.setData('area', value)}
|
464
|
+
/>
|
465
|
+
</FormItem>
|
466
|
+
<FormItem
|
467
|
+
label='描述'
|
468
|
+
required
|
469
|
+
validate={Validator.create([], store.desc)}
|
470
|
+
>
|
471
|
+
<textarea
|
472
|
+
value={store.desc}
|
473
|
+
onChange={e => store.setData('desc', e.target.value)}
|
474
|
+
/>
|
475
|
+
</FormItem>
|
476
|
+
<FormItem label='兴趣'>
|
477
|
+
<CheckboxGroup
|
478
|
+
style={{ width: '400px' }}
|
479
|
+
name='taste'
|
480
|
+
inline
|
481
|
+
value={store.taste}
|
482
|
+
onChange={value => store.setData('taste', value)}
|
483
|
+
>
|
484
|
+
<Checkbox value={0}>阅读</Checkbox>
|
485
|
+
<Checkbox value={1}>打篮球</Checkbox>
|
486
|
+
<Checkbox value={2}>美食</Checkbox>
|
487
|
+
<Checkbox value={0}>阅读</Checkbox>
|
488
|
+
<Checkbox value={1}>打篮球</Checkbox>
|
489
|
+
<Checkbox value={2}>美食</Checkbox>
|
490
|
+
</CheckboxGroup>
|
491
|
+
</FormItem>
|
492
|
+
</FormBlock>
|
493
|
+
<FormPanel.More>
|
494
|
+
<FormBlock col={2}>
|
495
|
+
<FormItem label='邀请码' required>
|
496
|
+
<input
|
497
|
+
type='text'
|
498
|
+
value={store.name}
|
499
|
+
onChange={e => store.setData('name', e.target.value)}
|
500
|
+
/>
|
501
|
+
<div className='gm-text-desc gm-margin-top-5'>
|
502
|
+
可以允许商户在规定时间内自主修改已提交订单内容
|
503
|
+
</div>
|
504
|
+
</FormItem>
|
505
|
+
<FormItem label='名字' required>
|
506
|
+
<input
|
507
|
+
type='text'
|
508
|
+
value={store.name}
|
509
|
+
onChange={e => store.setData('name', e.target.value)}
|
510
|
+
/>
|
511
|
+
</FormItem>
|
512
|
+
<FormItem label={<span>地区地区地区</span>}>
|
513
|
+
<Select
|
514
|
+
data={area}
|
515
|
+
value={store.area}
|
516
|
+
onChange={value => store.setData('area', value)}
|
517
|
+
/>
|
518
|
+
</FormItem>
|
519
|
+
<FormItem label='是否工作' required>
|
520
|
+
<Switch
|
521
|
+
checked={store.isWork}
|
522
|
+
onChange={checked => store.setData('isWork', checked)}
|
523
|
+
/>
|
524
|
+
</FormItem>
|
525
|
+
</FormBlock>
|
526
|
+
</FormPanel.More>
|
527
|
+
</Form>
|
528
|
+
</FormPanel>
|
529
|
+
|
530
|
+
<FormPanel
|
531
|
+
title='店铺设置'
|
532
|
+
left={
|
533
|
+
<span
|
534
|
+
className='gm-margin-left-10'
|
535
|
+
onClick={() => console.log('搜索')}
|
536
|
+
>
|
537
|
+
搜索
|
538
|
+
</span>
|
539
|
+
}
|
540
|
+
right={<span onClick={() => console.log('删除')}>删除</span>}
|
541
|
+
>
|
542
|
+
<Form
|
543
|
+
colWidth='400px'
|
544
|
+
ref={form4}
|
545
|
+
labelWidth='160px'
|
546
|
+
hasButtonInGroup
|
547
|
+
>
|
548
|
+
<Tets />
|
549
|
+
</Form>
|
550
|
+
</FormPanel>
|
551
|
+
</FormGroup>
|
552
|
+
)
|
553
|
+
})
|