Skip to content

Commit 686f06f

Browse files
authored
Merge pull request #97 from wenccro/main
fix:selectSetter的options支持方法stringSetter支持预览和去除边框
2 parents 8880d5b + dd011ab commit 686f06f

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/setter/select-setter/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,23 @@ interface SelectSetterProps {
66
value?: any;
77
mode?: 'single' | 'multiple' | 'tag';
88
defaultValue?: any;
9-
options: any[];
9+
options: any[] | Function;
1010
/**
1111
* 展开后是否能搜索
1212
*/
1313
showSearch?: boolean;
1414
// 是否可以清除
15-
hasClear?:boolean
15+
hasClear?: boolean
1616
}
1717

1818
interface SelectSetterState {
1919
setterValue: string | null;
2020
}
2121

22-
const formateOptions = (options: any[]) => {
22+
const formateOptions = (options: any[] | Function) => {
23+
if (typeof options === 'function') {
24+
return options();
25+
}
2326
return options.map((item: any) => {
2427
if (item.children) {
2528
const children = item.children.map((child: any) => {

src/setter/string-setter/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { Input } from '@alifd/next';
33
import './index.less';
44

55
interface StringSetterProps {
6+
isPreview?: boolean;
7+
hasBorder?: boolean;
68
value: string;
79
defaultValue: string;
810
placeholder: string;
@@ -13,9 +15,11 @@ export default class StringSetter extends React.PureComponent<StringSetterProps,
1315
static displayName = 'StringSetter';
1416

1517
render() {
16-
const { onChange, placeholder, value } = this.props;
18+
const { onChange, placeholder, value, isPreview = false, hasBorder = true } = this.props;
1719
return (
1820
<Input
21+
isPreview={isPreview}
22+
hasBorder={hasBorder}
1923
size="small"
2024
value={value}
2125
placeholder={placeholder || ''}

0 commit comments

Comments
 (0)