forked from p96170835/amis
commit
492b4d1c3d
|
@ -134,8 +134,7 @@
|
|||
|
||||
&-menu {
|
||||
max-height: px2rem(300px);
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
overflow: auto;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
|
@ -174,7 +173,7 @@
|
|||
|
||||
&-option {
|
||||
cursor: pointer;
|
||||
min-width: px2rem(150px);
|
||||
min-width: px2rem(120px);
|
||||
padding: ($Form-select-menu-height - $Form-input-lineHeight * $Form-input-fontSize)/2 $Form-select-paddingX;
|
||||
|
||||
&.is-active {
|
||||
|
|
|
@ -229,12 +229,12 @@
|
|||
|
||||
|
||||
&-item &-item>&-itemLabel,
|
||||
&-item>&-placeholder {
|
||||
&-item &-item>&-placeholder {
|
||||
padding-left: $Tree-indent;
|
||||
}
|
||||
|
||||
&-item &-item &-item>&-itemLabel,
|
||||
&-item &-item>&-placeholder {
|
||||
&-item &-item &-item>&-placeholder {
|
||||
padding-left: $Tree-indent * 2;
|
||||
}
|
||||
|
||||
|
|
|
@ -715,7 +715,7 @@ export class Select extends React.Component<SelectProps, SelectState> {
|
|||
<PopOver
|
||||
overlay
|
||||
className={cx('Select-popover')}
|
||||
style={{width: this.target ? this.target.offsetWidth : 'auto'}}
|
||||
style={{minWidth: this.target ? this.target.offsetWidth : 'auto'}}
|
||||
onHide={this.close}
|
||||
>
|
||||
{menu}
|
||||
|
|
|
@ -540,7 +540,8 @@ export class TreeSelector extends React.Component<
|
|||
/>
|
||||
) : null;
|
||||
|
||||
const isLeaf = !item.children || !item.children.length;
|
||||
const isLeaf =
|
||||
(!item.children || !item.children.length) && !item.placeholder;
|
||||
|
||||
return (
|
||||
<li
|
||||
|
@ -646,8 +647,12 @@ export class TreeSelector extends React.Component<
|
|||
) : null}
|
||||
{childrenItems}
|
||||
</ul>
|
||||
) : !childrenItems && item.placeholder ? (
|
||||
<div className={cx('Tree-placeholder')}>{item.placeholder}</div>
|
||||
) : !childrenItems && item.placeholder && unfolded[item[valueField]] ? (
|
||||
<ul className={cx('Tree-sublist')}>
|
||||
<li className={cx('Tree-item')}>
|
||||
<div className={cx('Tree-placeholder')}>{item.placeholder}</div>
|
||||
</li>
|
||||
</ul>
|
||||
) : null}
|
||||
</li>
|
||||
);
|
||||
|
|
|
@ -540,6 +540,7 @@ export function registerOptionsControl(config: OptionsConfig) {
|
|||
|
||||
if (!payload.ok) {
|
||||
env.notify('error', payload.msg || '新增失败,请仔细检查');
|
||||
result = null;
|
||||
} else {
|
||||
result = payload.data || result;
|
||||
}
|
||||
|
@ -563,8 +564,9 @@ export function registerOptionsControl(config: OptionsConfig) {
|
|||
};
|
||||
}
|
||||
|
||||
// 如果配置了 source 直接重新拉取接口就够了
|
||||
if (source) {
|
||||
// 如果配置了 source 且配置了 addApi 直接重新拉取接口就够了
|
||||
// 不能不判断 addApi 就刷新,因为有些场景就是临时添加的。
|
||||
if (source && addApi) {
|
||||
this.reload();
|
||||
} else {
|
||||
// 否则直接前端变更 options
|
||||
|
@ -642,6 +644,7 @@ export function registerOptionsControl(config: OptionsConfig) {
|
|||
|
||||
if (!payload.ok) {
|
||||
env.notify('error', payload.msg || '保存失败,请仔细检查');
|
||||
result = null;
|
||||
} else {
|
||||
result = payload.data || result;
|
||||
}
|
||||
|
@ -657,7 +660,7 @@ export function registerOptionsControl(config: OptionsConfig) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (source) {
|
||||
if (source && !editApi) {
|
||||
this.reload();
|
||||
} else {
|
||||
const indexes = findTreeIndex(model.options, item => item === origin);
|
||||
|
|
|
@ -136,6 +136,32 @@ export const validations: {
|
|||
}
|
||||
return true;
|
||||
},
|
||||
isPhoneNumber: function(values, value) {
|
||||
return (
|
||||
!isExisty(value) || isEmpty(value) || /^[1]([3-9])[0-9]{9}$/.test(value)
|
||||
);
|
||||
},
|
||||
isTelNumber: function(values, value) {
|
||||
return (
|
||||
!isExisty(value) ||
|
||||
isEmpty(value) ||
|
||||
/^(\(\d{3,4}\)|\d{3,4}-|\s)?\d{7,14}$/.test(value)
|
||||
);
|
||||
},
|
||||
isZipcode: function(values, value) {
|
||||
return (
|
||||
!isExisty(value) || isEmpty(value) || /^[1-9]{1}(\d+){5}$/.test(value)
|
||||
);
|
||||
},
|
||||
isId: function(values, value) {
|
||||
return (
|
||||
!isExisty(value) ||
|
||||
isEmpty(value) ||
|
||||
/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}$)/.test(
|
||||
value
|
||||
)
|
||||
);
|
||||
},
|
||||
notEmptyString: function(values, value) {
|
||||
return !isExisty(value) || !(String(value) && String(value).trim() === '');
|
||||
},
|
||||
|
@ -199,7 +225,11 @@ export const validateMessages: {
|
|||
isLength: '请输入长度为 $1 的内容',
|
||||
notEmptyString: '请不要全输入空白字符',
|
||||
equalsField: '输入的数据与 $1 值不一致',
|
||||
equals: '输入的数据与 $1 不一致'
|
||||
equals: '输入的数据与 $1 不一致',
|
||||
isPhoneNumber: '请输入合法的手机号码',
|
||||
isTelNumber: '请输入合法的电话号码',
|
||||
isZipcode: '请输入合法的邮编地址',
|
||||
isId: '请输入合法的身份证号'
|
||||
};
|
||||
|
||||
export function validate(
|
||||
|
|
Loading…
Reference in New Issue