From 2ec1428797c03be90259de617662df6d9044bfc2 Mon Sep 17 00:00:00 2001 From: liaoxuezhi Date: Mon, 17 Jun 2019 01:00:21 +0800 Subject: [PATCH] =?UTF-8?q?Checkboxes=20Radios=20=E6=94=AF=E6=8C=81group?= =?UTF-8?q?=E5=88=86=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scss/components/form/_checks.scss | 10 ++++ src/components/Radios.tsx | 65 +++++++++++++++++++------- src/renderers/Form/Checkboxes.tsx | 78 ++++++++++++++++++++++--------- src/renderers/Form/Radios.tsx | 4 +- 4 files changed, 117 insertions(+), 40 deletions(-) diff --git a/scss/components/form/_checks.scss b/scss/components/form/_checks.scss index 36b0bb5e1..6519ed617 100644 --- a/scss/components/form/_checks.scss +++ b/scss/components/form/_checks.scss @@ -219,4 +219,14 @@ display: inline-block; margin-right: $gap-md; } + + &-group { + padding-left: px2rem(120px); + @include clearfix(); + } + + &-groupLabel { + float: left; + margin-left: px2rem(-120px); + } } diff --git a/src/components/Radios.tsx b/src/components/Radios.tsx index a7dbf6531..72372fdba 100644 --- a/src/components/Radios.tsx +++ b/src/components/Radios.tsx @@ -30,6 +30,7 @@ interface RadioProps extends OptionProps { disabled?: boolean; onChange?: Function; columnsCount: number; + itemClassName?: string; classPrefix: string; classnames: ClassNamesFn; } @@ -71,6 +72,47 @@ export class Radios extends React.Component { onChange && onChange(newValue); } + renderGroup(option:Option, index:number, valueArray: Array