Commit d103ccec authored by zhangwenshuai's avatar zhangwenshuai

update select ui

parent 8972d499
...@@ -40,6 +40,7 @@ export interface ApolloInputSearchProps extends SelectProps<any>, CommonProps { ...@@ -40,6 +40,7 @@ export interface ApolloInputSearchProps extends SelectProps<any>, CommonProps {
export interface ApolloSelectProps extends SelectProps<any>, CommonProps { export interface ApolloSelectProps extends SelectProps<any>, CommonProps {
isMultiple?: boolean; isMultiple?: boolean;
options?: any[]; options?: any[];
maxPopHeight?:boolean;
} }
export interface ApolloNumberProps extends InputNumberProps, CommonProps {} export interface ApolloNumberProps extends InputNumberProps, CommonProps {}
export interface ApolloCheckboxProps extends CheckboxProps, CommonProps { export interface ApolloCheckboxProps extends CheckboxProps, CommonProps {
......
.search { .search {
width: 100%; width: 100%;
height: 100%; //height: 100%;
display: flex;
:global(.ant-select-selection) { :global(.ant-select-selection) {
width: 100%; width: 100%;
min-height: 100%; min-height: 100%;
...@@ -8,7 +9,7 @@ ...@@ -8,7 +9,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
} }
:global(.ant-select-selection__rendered){ :global(.ant-select-selection__rendered) {
width: 100%; width: 100%;
} }
} }
...@@ -7,9 +7,9 @@ import { onBlurFn } from '../onBlurFn'; ...@@ -7,9 +7,9 @@ import { onBlurFn } from '../onBlurFn';
import s from './index.less'; import s from './index.less';
export const ApolloSearch = (props: ApolloSearchProps) => { export const ApolloSearch = (props: ApolloSearchProps) => {
const { onChange, maxCount, isMultiple, request, origin } = props; const { onChange, maxCount, isMultiple, request } = props;
const selfProps = antiAssign(props, ['columnConfig', 'onChange', 'isMultiple', 'options', 'request', 'maxCount']); const selfProps = antiAssign(props, ['columnConfig', 'onChange', 'isMultiple', 'options', 'request', 'maxCount']);
const isOpen = useRef(); const isOpen: any = useRef();
if (isMultiple) { if (isMultiple) {
selfProps.mode = 'multiple'; selfProps.mode = 'multiple';
} }
...@@ -35,23 +35,16 @@ export const ApolloSearch = (props: ApolloSearchProps) => { ...@@ -35,23 +35,16 @@ export const ApolloSearch = (props: ApolloSearchProps) => {
onBlurFn(props); onBlurFn(props);
} }
}; };
return ( return (
origin === 'editForm' ? <Search
<Search className={s.search}
className={s.search} request={request}
request={request} fieldNames={{ value: 'fieldValueValue', label: 'fieldValueName' }}
fieldNames={{ value: 'fieldValueValue', label: 'fieldValueName' }} {...selfProps}
{...selfProps} onDropdownVisibleChange={selfProps.mode === 'multiple' ? multipleBlurFn : singleBlurFn}
onChange={changeValue} onChange={changeValue}
onDropdownVisibleChange={selfProps.mode === 'multiple' ? multipleBlurFn : singleBlurFn} initDataType="onfocus"
initDataType="onfocus" />
/> : <Search
className={s.search}
request={request}
fieldNames={{ value: 'fieldValueValue', label: 'fieldValueName' }}
{...selfProps}
onChange={changeValue}
initDataType="onfocus"
/>
); );
}; };
...@@ -6,7 +6,7 @@ import { antiAssign } from '../../../../utils/utils'; ...@@ -6,7 +6,7 @@ import { antiAssign } from '../../../../utils/utils';
import styles from './styles.less'; import styles from './styles.less';
export const ApolloSelect = (props: ApolloSelectProps) => { export const ApolloSelect = (props: ApolloSelectProps) => {
const { options = [], onChange, isMultiple, origin, maxPopHeight } = props; const { options = [], onChange, isMultiple, maxPopHeight } = props;
const selfProps = antiAssign(props, ['columnConfig', 'onChange', 'isMultiple', 'options', 'maxPopHeight']); const selfProps = antiAssign(props, ['columnConfig', 'onChange', 'isMultiple', 'options', 'maxPopHeight']);
const isOpen: any = useRef(); const isOpen: any = useRef();
...@@ -31,7 +31,7 @@ export const ApolloSelect = (props: ApolloSelectProps) => { ...@@ -31,7 +31,7 @@ export const ApolloSelect = (props: ApolloSelectProps) => {
} }
}; };
return origin === 'editForm' ? ( return (
<Select <Select
className={styles.select} className={styles.select}
{...selfProps} {...selfProps}
...@@ -49,22 +49,5 @@ export const ApolloSelect = (props: ApolloSelectProps) => { ...@@ -49,22 +49,5 @@ export const ApolloSelect = (props: ApolloSelectProps) => {
); );
})} })}
</Select> </Select>
) : (
<Select
className={styles.select}
{...selfProps}
onChange={changeValue}
dropdownStyle={{
maxHeight: maxPopHeight,
}}
>
{options.map((item) => {
return (
<Select.Option key={item.id} value={item.id}>
{item.name}
</Select.Option>
);
})}
</Select>
); );
}; };
.select { .select {
width: 100%; width: 100%;
height: 100%; display: flex;
:global(.ant-select-selector) { :global(.ant-select-selector) {
height: 100% !important; height: 100% !important;
align-items: center; align-items: center;
} }
:global(.ant-select-selection) { :global(.ant-select-selection) {
width: 100%; width: 100%;
min-height: 100%; height: auto;
border-radius: 0; border-radius: 0;
display: flex; display: flex;
align-items: center; align-items: center;
} }
:global(.ant-select-selection__rendered){ :global(.ant-select-selection__rendered) {
width: 100%; width: 100%;
display: flex;
align-items: center;
} }
} }
.searchContainer {
width: 100%;
height: 100%;
:global(.ant-select-selection__rendered) {
width: 100%;
}
:global(.ant-select-selection) {
min-height: 100%;
}
}
## 此组件用于组合数据录入空间几何
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment