1
- import { default as Cascader } from 'antd/es/cascader' ;
2
- import {
3
- CascaderStyleType ,
4
- ChildrenMultiSelectStyleType ,
5
- } from 'comps/controls/styleControlConstants' ;
6
- import { blurMethod , focusMethod } from 'comps/utils/methodUtils' ;
7
- import { trans } from 'i18n' ;
8
- import styled from 'styled-components' ;
9
- import { UICompBuilder , withDefault } from '../../generators' ;
10
- import {
11
- CommonNameConfig ,
12
- NameConfig ,
13
- withExposingConfigs ,
14
- } from '../../generators/withExposing' ;
15
- import {
16
- CascaderChildren ,
17
- CascaderPropertyView ,
18
- defaultDataSource ,
19
- } from './cascaderContants' ;
20
- import { refMethods } from 'comps/generators/withMethodExposing' ;
1
+ import { default as Cascader } from "antd/es/cascader" ;
2
+ import { CascaderStyleType , ChildrenMultiSelectStyleType } from "comps/controls/styleControlConstants" ;
3
+ import { blurMethod , focusMethod } from "comps/utils/methodUtils" ;
4
+ import { trans } from "i18n" ;
5
+ import styled from "styled-components" ;
6
+ import { UICompBuilder , withDefault } from "../../generators" ;
7
+ import { CommonNameConfig , NameConfig , withExposingConfigs } from "../../generators/withExposing" ;
8
+ import { CascaderChildren , CascaderPropertyView , defaultDataSource } from "./cascaderContants" ;
9
+ import { refMethods } from "comps/generators/withMethodExposing" ;
21
10
22
- const CascaderStyle = styled ( Cascader ) < {
23
- $style : CascaderStyleType ;
24
- $childrenInputFieldStyle : ChildrenMultiSelectStyleType ;
25
- } > `
11
+ const CascaderStyle = styled ( Cascader ) < { $style : CascaderStyleType , $childrenInputFieldStyle :ChildrenMultiSelectStyleType } > `
26
12
width: 100%;
27
- font-family: 'Montserrat';
28
- ${ ( props ) => {
29
- return (
30
- props . $style && { ...props . $style , 'border-radius' : props . $style . radius }
31
- ) ;
32
- } }
13
+ font-family:"Montserrat";
14
+ ${ ( props ) => { return props . $style && { ...props . $style , 'border-radius' : props . $style . radius } } }
33
15
` ;
34
16
35
- const DropdownRenderStyle = styled . div < {
36
- $childrenInputFieldStyle : ChildrenMultiSelectStyleType ;
37
- } > `
38
- background-color: ${ ( props ) => props . $childrenInputFieldStyle ?. background } ;
39
- border: ${ ( props ) => props . $childrenInputFieldStyle ?. border } ;
40
- border-style: ${ ( props ) => props . $childrenInputFieldStyle ?. borderStyle } ;
41
- border-width: ${ ( props ) => props . $childrenInputFieldStyle ?. borderWidth } ;
42
- border-radius: ${ ( props ) => props . $childrenInputFieldStyle ?. radius } ;
43
- rotate: ${ ( props ) => props . $childrenInputFieldStyle ?. rotation } ;
44
- margin: ${ ( props ) => props . $childrenInputFieldStyle ?. margin } ;
45
- padding: ${ ( props ) => props . $childrenInputFieldStyle ?. padding } ;
46
- .ant-cascader-menu-item-content {
47
- font-size: ${ ( props ) => props . $childrenInputFieldStyle ?. textSize } ;
48
- font-style: ${ ( props ) => props . $childrenInputFieldStyle ?. fontStyle } ;
49
- font-family: ${ ( props ) => props . $childrenInputFieldStyle ?. fontFamily } ;
50
- font-weight: ${ ( props ) => props . $childrenInputFieldStyle ?. textWeight } ;
51
- text-transform: ${ ( props ) => props . $childrenInputFieldStyle ?. textTransform } ;
52
- text-decoration: ${ ( props ) =>
53
- props . $childrenInputFieldStyle ?. textDecoration } ;
54
- color: ${ ( props ) => props . $childrenInputFieldStyle ?. text } ;
55
- }
56
- ` ;
17
+ const DropdownRenderStyle = styled . div < { $childrenInputFieldStyle : ChildrenMultiSelectStyleType } > `
18
+ background-color: ${ props => props . $childrenInputFieldStyle ?. background } ;
19
+ border: ${ props => props . $childrenInputFieldStyle ?. border } ;
20
+ border-style: ${ props => props . $childrenInputFieldStyle ?. borderStyle } ;
21
+ border-width: ${ props => props . $childrenInputFieldStyle ?. borderWidth } ;
22
+ border-radius: ${ props => props . $childrenInputFieldStyle ?. radius } ;
23
+ rotate: ${ props => props . $childrenInputFieldStyle ?. rotation } ;
24
+ margin: ${ props => props . $childrenInputFieldStyle ?. margin } ;
25
+ padding: ${ props => props . $childrenInputFieldStyle ?. padding } ;
26
+ .ant-cascader-menu-item-content{
27
+ font-size: ${ props => props . $childrenInputFieldStyle ?. textSize } ;
28
+ font-style: ${ props => props . $childrenInputFieldStyle ?. fontStyle } ;
29
+ font-family: ${ props => props . $childrenInputFieldStyle ?. fontFamily } ;
30
+ font-weight: ${ props => props . $childrenInputFieldStyle ?. textWeight } ;
31
+ text-transform: ${ props => props . $childrenInputFieldStyle ?. textTransform } ;
32
+ text-decoration: ${ props => props . $childrenInputFieldStyle ?. textDecoration } ;
33
+ color: ${ props => props . $childrenInputFieldStyle ?. text } ;
34
+ }
35
+ `
57
36
58
37
let CascaderBasicComp = ( function ( ) {
59
38
const childrenMap = CascaderChildren ;
@@ -62,9 +41,9 @@ let CascaderBasicComp = (function () {
62
41
return props . label ( {
63
42
style : props . style ,
64
43
labelStyle : props . labelStyle ,
65
- inputFieldStyle : props . inputFieldStyle ,
66
- childrenInputFieldStyle : props . childrenInputFieldStyle ,
67
- animationStyle : props . animationStyle ,
44
+ inputFieldStyle :props . inputFieldStyle ,
45
+ childrenInputFieldStyle :props . childrenInputFieldStyle ,
46
+ animationStyle :props . animationStyle ,
68
47
children : (
69
48
< CascaderStyle
70
49
ref = { props . viewRef }
@@ -77,18 +56,16 @@ let CascaderBasicComp = (function () {
77
56
showSearch = { props . showSearch }
78
57
$style = { props . inputFieldStyle }
79
58
$childrenInputFieldStyle = { props . childrenInputFieldStyle }
80
- onFocus = { ( ) => props . onEvent ( ' focus' ) }
81
- onBlur = { ( ) => props . onEvent ( ' blur' ) }
59
+ onFocus = { ( ) => props . onEvent ( " focus" ) }
60
+ onBlur = { ( ) => props . onEvent ( " blur" ) }
82
61
dropdownRender = { ( menus : React . ReactNode ) => (
83
- < DropdownRenderStyle
84
- $childrenInputFieldStyle = { props . childrenInputFieldStyle }
85
- >
86
- { menus }
62
+ < DropdownRenderStyle $childrenInputFieldStyle = { props . childrenInputFieldStyle } >
63
+ { menus }
87
64
</ DropdownRenderStyle >
88
65
) }
89
66
onChange = { ( value : ( string | number ) [ ] ) => {
90
67
props . value . onChange ( value as string [ ] ) ;
91
- props . onEvent ( ' change' ) ;
68
+ props . onEvent ( " change" ) ;
92
69
} }
93
70
/>
94
71
) ,
@@ -104,7 +81,7 @@ let CascaderBasicComp = (function () {
104
81
} ) ( ) ;
105
82
106
83
const CascaderComp = withExposingConfigs ( CascaderBasicComp , [
107
- new NameConfig ( ' value' , trans ( ' selectInput.valueDesc' ) ) ,
84
+ new NameConfig ( " value" , trans ( " selectInput.valueDesc" ) ) ,
108
85
...CommonNameConfig ,
109
86
] ) ;
110
87
0 commit comments