@@ -52,22 +52,30 @@ class LabelForm extends React.PureComponent<Props, {}> {
52
52
onSubmit,
53
53
} = this . props ;
54
54
55
- form . validateFields ( ( error , values ) : void => {
55
+ form . validateFields ( ( error , formValues ) : void => {
56
56
if ( ! error ) {
57
57
onSubmit ( {
58
- name : values . labelName ,
58
+ name : formValues . labelName ,
59
59
id : label ? label . id : idGenerator ( ) ,
60
- attributes : values . keys . map ( ( key : number , index : number ) : Attribute => (
61
- {
62
- name : values . attrName [ key ] ,
63
- type : values . type [ key ] ,
64
- mutable : values . mutable [ key ] ,
60
+ attributes : formValues . keys . map ( ( key : number , index : number ) : Attribute => {
61
+ let attrValues = formValues . values [ key ] ;
62
+ if ( ! Array . isArray ( attrValues ) ) {
63
+ if ( formValues . type [ key ] === AttributeType . NUMBER ) {
64
+ attrValues = attrValues . split ( ';' ) ;
65
+ } else {
66
+ attrValues = [ attrValues ] ;
67
+ }
68
+ }
69
+
70
+ return {
71
+ name : formValues . attrName [ key ] ,
72
+ type : formValues . type [ key ] ,
73
+ mutable : formValues . mutable [ key ] ,
65
74
id : label && index < label . attributes . length
66
75
? label . attributes [ index ] . id : key ,
67
- values : Array . isArray ( values . values [ key ] )
68
- ? values . values [ key ] : [ values . values [ key ] ] ,
69
- }
70
- ) ) ,
76
+ values : attrValues ,
77
+ } ;
78
+ } ) ,
71
79
} ) ;
72
80
73
81
form . resetFields ( ) ;
0 commit comments