Commit 6705ef2e authored by zhangwenshuai's avatar zhangwenshuai

merge master

parents cc13ce4b a2cecbaf
...@@ -8,8 +8,15 @@ ...@@ -8,8 +8,15 @@
border-radius: 0; border-radius: 0;
display: flex; display: flex;
align-items: center; align-items: center;
height: auto;
} }
:global(.ant-select-selection__rendered) { :global(.ant-select-selection__rendered) {
width: 100%; width: 100%;
} }
} }
.searchDropdown {
overflow: auto;
:global(.ant-select-dropdown-menu) {
max-height: none;
}
}
...@@ -7,7 +7,7 @@ import { onBlurFn } from '../onBlurFn'; ...@@ -7,7 +7,7 @@ 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 } = props; const { onChange, maxCount, isMultiple, request, maxPopHeight } = props;
const selfProps = antiAssign(props, [ const selfProps = antiAssign(props, [
'columnConfig', 'columnConfig',
'onChange', 'onChange',
...@@ -19,6 +19,7 @@ export const ApolloSearch = (props: ApolloSearchProps) => { ...@@ -19,6 +19,7 @@ export const ApolloSearch = (props: ApolloSearchProps) => {
'tableId', 'tableId',
'cellRenderProps', 'cellRenderProps',
'getCalendarContainer', 'getCalendarContainer',
'maxPopHeight',
]); ]);
const isOpen: any = useRef(); const isOpen: any = useRef();
if (isMultiple) { if (isMultiple) {
...@@ -56,6 +57,10 @@ export const ApolloSearch = (props: ApolloSearchProps) => { ...@@ -56,6 +57,10 @@ export const ApolloSearch = (props: ApolloSearchProps) => {
onDropdownVisibleChange={selfProps.mode === 'multiple' ? multipleBlurFn : singleBlurFn} onDropdownVisibleChange={selfProps.mode === 'multiple' ? multipleBlurFn : singleBlurFn}
onChange={changeValue} onChange={changeValue}
initDataType="onfocus" initDataType="onfocus"
dropdownClassName={s.searchDropdown}
dropdownStyle={{
maxHeight: maxPopHeight,
}}
/> />
); );
}; };
...@@ -47,6 +47,7 @@ export const ApolloSelect = (props: ApolloSelectProps) => { ...@@ -47,6 +47,7 @@ export const ApolloSelect = (props: ApolloSelectProps) => {
{...selfProps} {...selfProps}
onChange={changeValue} onChange={changeValue}
onDropdownVisibleChange={selfProps.mode === 'multiple' ? multipleBlurFn : singleBlurFn} onDropdownVisibleChange={selfProps.mode === 'multiple' ? multipleBlurFn : singleBlurFn}
dropdownClassName={styles.selectDropdown}
dropdownStyle={{ dropdownStyle={{
maxHeight: maxPopHeight, maxHeight: maxPopHeight,
}} }}
......
...@@ -18,3 +18,9 @@ ...@@ -18,3 +18,9 @@
align-items: center; align-items: center;
} }
} }
.selectDropdown{
overflow: auto;
:global(.ant-select-dropdown-menu) {
max-height: none;
}
}
...@@ -227,7 +227,7 @@ class AssociationSearch extends React.Component<Props, State> { ...@@ -227,7 +227,7 @@ class AssociationSearch extends React.Component<Props, State> {
render() { render() {
const { data, value } = this.state; const { data, value } = this.state;
const { selfCom, autoFocus, onChange, maxPopHeight, ...rest } = this.props; const { selfCom, autoFocus, onChange, ...rest } = this.props;
return ( return (
<Consumer> <Consumer>
{({ locale }: any) => { {({ locale }: any) => {
...@@ -243,9 +243,6 @@ class AssociationSearch extends React.Component<Props, State> { ...@@ -243,9 +243,6 @@ class AssociationSearch extends React.Component<Props, State> {
onChange={this.handleChange} onChange={this.handleChange}
onFocus={this.onFocus} onFocus={this.onFocus}
onBlur={this.onBlur} onBlur={this.onBlur}
dropdownStyle={{
maxHeight: maxPopHeight,
}}
> >
{data.map((d: any) => { {data.map((d: any) => {
return ( return (
......
...@@ -92,22 +92,8 @@ class FormWrap extends Component { ...@@ -92,22 +92,8 @@ class FormWrap extends Component {
}; };
validateRequired = (item, rule, value, callback) => { validateRequired = (item, rule, value, callback) => {
if (!item.requiredFlag) { // 可输可选组件清空时数据格式有问题,单独处理一下
return callback(); if (item.requiredFlag && Number(item.columnType) === 15 && typeof value === 'object') {
}
if (!value) {
return callback('必填项不能为空');
}
if (Array.isArray(value)) {
if (value.length === 0) {
return callback('必填项不能为空');
}
const [first] = value;
if (!first.text && first.text !== 0 && !first.value && first.value !== 0) {
return callback('必填项不能为空');
}
}
if (typeof value === 'object') {
if ( if (
!value.label !value.label
&& value.label !== 0 && value.label !== 0
......
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