style: gpuselector dropdown style
This commit is contained in:
@@ -17,6 +17,47 @@
|
|||||||
border: none;
|
border: none;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
|
|
||||||
|
&.dropdown-visible {
|
||||||
|
:local(.wrapper) {
|
||||||
|
:global(.ant-select-selector) {
|
||||||
|
border-bottom: none !important;
|
||||||
|
border-radius: @borderRadius @borderRadius 0 0;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
height: 1px;
|
||||||
|
margin-inline: 1px;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
background-color: var(--ant-color-split);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.ant-select-dropdown) {
|
||||||
|
box-shadow: none;
|
||||||
|
border-width: var(--ant-line-width);
|
||||||
|
border-style: var(--ant-line-type);
|
||||||
|
border-color: var(--ant-input-active-border-color);
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
:global(.ant-select-dropdown) {
|
||||||
|
border-color: var(--ant-input-active-border-color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus-within {
|
||||||
|
border-color: var(--ant-input-active-border-color) !important;
|
||||||
|
outline: 0;
|
||||||
|
background-color: var(--ant-input-active-bg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&:focus-within {
|
&:focus-within {
|
||||||
border: none;
|
border: none;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
@@ -64,6 +105,12 @@
|
|||||||
border-color: var(--ant-color-error) !important;
|
border-color: var(--ant-color-error) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.dropdown-visible {
|
||||||
|
:global(.ant-select-dropdown) {
|
||||||
|
border-color: var(--ant-color-error) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,6 +255,15 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 54px;
|
height: 54px;
|
||||||
|
|
||||||
|
:global(.ant-select-selection-search) {
|
||||||
|
top: 20px !important;
|
||||||
|
inset-inline-start: @input-inner-padding;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.ant-select.ant-cascader .ant-select-selection-search) {
|
||||||
|
top: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
:global(.ant-input-number-input-wrap) {
|
:global(.ant-input-number-input-wrap) {
|
||||||
@@ -217,10 +273,10 @@
|
|||||||
:global(.ant-select-selector) {
|
:global(.ant-select-selector) {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding-inline: @input-inner-padding !important;
|
padding-inline: @input-inner-padding !important;
|
||||||
border-width: var(--ant-line-width) !important;
|
border-width: var(--ant-line-width);
|
||||||
border-style: var(--ant-line-type) !important;
|
border-style: var(--ant-line-type);
|
||||||
border-color: var(--ant-color-border) !important;
|
border-color: var(--ant-color-border);
|
||||||
border-radius: @borderRadius !important;
|
border-radius: @borderRadius;
|
||||||
height: 54px !important;
|
height: 54px !important;
|
||||||
padding-block: 20px 0 !important;
|
padding-block: 20px 0 !important;
|
||||||
box-shadow: none !important;
|
box-shadow: none !important;
|
||||||
@@ -237,11 +293,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:global(.ant-select-selection-search) {
|
|
||||||
top: 20px !important;
|
|
||||||
inset-inline-start: @input-inner-padding;
|
|
||||||
}
|
|
||||||
|
|
||||||
:global(.ant-select-multiple.ant-select-lg) {
|
:global(.ant-select-multiple.ant-select-lg) {
|
||||||
:global(.ant-select-selection-search) {
|
:global(.ant-select-selection-search) {
|
||||||
margin-inline-start: 0 !important;
|
margin-inline-start: 0 !important;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ interface WrapperProps {
|
|||||||
addAfter?: React.ReactNode;
|
addAfter?: React.ReactNode;
|
||||||
variant?: string;
|
variant?: string;
|
||||||
hasPrefix?: boolean;
|
hasPrefix?: boolean;
|
||||||
|
classList?: string;
|
||||||
onClick?: () => void;
|
onClick?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,18 +34,20 @@ const Wrapper: React.FC<WrapperProps> = ({
|
|||||||
addAfter,
|
addAfter,
|
||||||
hasPrefix,
|
hasPrefix,
|
||||||
noWrapperStyle,
|
noWrapperStyle,
|
||||||
|
classList,
|
||||||
onClick
|
onClick
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
className,
|
classList,
|
||||||
wrapperStyle['wrapper-box'],
|
wrapperStyle['wrapper-box'],
|
||||||
'field-wrapper',
|
'field-wrapper',
|
||||||
wrapperStyle[`validate-status-${status}`],
|
wrapperStyle[`validate-status-${status}`],
|
||||||
addAfter ? wrapperStyle['seal-input-wrapper-addafter'] : '',
|
addAfter ? wrapperStyle['seal-input-wrapper-addafter'] : '',
|
||||||
disabled ? wrapperStyle['seal-input-wrapper-disabled'] : '',
|
disabled ? wrapperStyle['seal-input-wrapper-disabled'] : '',
|
||||||
className ? wrapperStyle[className] : '',
|
className ? wrapperStyle[className] : '',
|
||||||
|
classList ? wrapperStyle[classList] : '',
|
||||||
variant ? wrapperStyle[variant] : ''
|
variant ? wrapperStyle[variant] : ''
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import type { CascaderAutoProps } from 'antd';
|
|||||||
import { Cascader, Form } from 'antd';
|
import { Cascader, Form } from 'antd';
|
||||||
import { cloneDeep } from 'lodash';
|
import { cloneDeep } from 'lodash';
|
||||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import styled from 'styled-components';
|
|
||||||
import Wrapper from './components/wrapper';
|
import Wrapper from './components/wrapper';
|
||||||
import { SealFormItemProps } from './types';
|
import { SealFormItemProps } from './types';
|
||||||
|
|
||||||
@@ -25,7 +24,7 @@ const SealCascader: React.FC<CascaderAutoProps & SealFormItemProps> = (
|
|||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const [isFocus, setIsFocus] = useState(false);
|
const [isFocus, setIsFocus] = useState(false);
|
||||||
const inputRef = useRef<any>(null);
|
const inputRef = useRef<any>(null);
|
||||||
const boxRef = useRef<any>(null);
|
const [visible, setVisible] = useState(false);
|
||||||
let status = '';
|
let status = '';
|
||||||
|
|
||||||
// the status can be controlled by Form.Item
|
// the status can be controlled by Form.Item
|
||||||
@@ -83,11 +82,14 @@ const SealCascader: React.FC<CascaderAutoProps & SealFormItemProps> = (
|
|||||||
props.onBlur?.(e);
|
props.onBlur?.(e);
|
||||||
};
|
};
|
||||||
|
|
||||||
const Boxer = styled.div``;
|
const handleDropdownVisibleChange = (open: boolean) => {
|
||||||
|
setVisible(open);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Wrapper
|
<Wrapper
|
||||||
className="seal-select-wrapper"
|
className="seal-select-wrapper"
|
||||||
|
classList={visible ? 'dropdown-visible' : ''}
|
||||||
status={status}
|
status={status}
|
||||||
label={label}
|
label={label}
|
||||||
isFocus={isFocus}
|
isFocus={isFocus}
|
||||||
@@ -104,6 +106,7 @@ const SealCascader: React.FC<CascaderAutoProps & SealFormItemProps> = (
|
|||||||
onBlur={handleOnBlur}
|
onBlur={handleOnBlur}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
notFoundContent={null}
|
notFoundContent={null}
|
||||||
|
onDropdownVisibleChange={handleDropdownVisibleChange}
|
||||||
></Cascader>
|
></Cascader>
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
:local(.dropdown-visible) {
|
||||||
|
:local(.ant-select-selector) {
|
||||||
|
border-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
-1
@@ -797,8 +797,18 @@ body {
|
|||||||
background-color: var(--ant-select-option-selected-bg) !important;
|
background-color: var(--ant-select-option-selected-bg) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ant-cascader-dropdown .ant-cascader-menu {
|
||||||
|
flex-grow: unset;
|
||||||
|
}
|
||||||
|
|
||||||
.cascader-popup-wrapper {
|
.cascader-popup-wrapper {
|
||||||
// width: 100%;
|
width: 100%;
|
||||||
|
border: 1px solid var(--ant-color-border);
|
||||||
|
inset: 54px auto auto 0 !important;
|
||||||
|
border-radius: 0 0 var(--border-radius-base) var(--border-radius-base);
|
||||||
|
border-top: none;
|
||||||
|
max-height: 240px;
|
||||||
|
min-height: 100px;
|
||||||
|
|
||||||
&.gpu-selector {
|
&.gpu-selector {
|
||||||
.ant-cascader-menu:last-child {
|
.ant-cascader-menu:last-child {
|
||||||
|
|||||||
@@ -226,5 +226,6 @@ export default {
|
|||||||
'common.button.delrecreate': 'Delete (Recreate)',
|
'common.button.delrecreate': 'Delete (Recreate)',
|
||||||
'common.options.all': 'All',
|
'common.options.all': 'All',
|
||||||
'common.options.none': 'None',
|
'common.options.none': 'None',
|
||||||
'common.options.auto': 'Auto'
|
'common.options.auto': 'Auto',
|
||||||
|
'common.search.empty': 'No matching results found.'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -219,5 +219,6 @@ export default {
|
|||||||
'common.button.delrecreate': '删除(重建)',
|
'common.button.delrecreate': '删除(重建)',
|
||||||
'common.options.all': '全部',
|
'common.options.all': '全部',
|
||||||
'common.options.none': '无',
|
'common.options.none': '无',
|
||||||
'common.options.auto': '自动'
|
'common.options.auto': '自动',
|
||||||
|
'common.search.empty': '未找到匹配结果'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { useIntl } from '@umijs/max';
|
|||||||
import {
|
import {
|
||||||
Checkbox,
|
Checkbox,
|
||||||
Collapse,
|
Collapse,
|
||||||
|
Empty,
|
||||||
Form,
|
Form,
|
||||||
FormInstance,
|
FormInstance,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
@@ -145,6 +146,23 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const gpuOptionRender = (data: any) => {
|
const gpuOptionRender = (data: any) => {
|
||||||
|
if (data.value === '__EMPTY__') {
|
||||||
|
return (
|
||||||
|
<Empty
|
||||||
|
image={false}
|
||||||
|
style={{
|
||||||
|
height: 100,
|
||||||
|
alignSelf: 'center',
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center'
|
||||||
|
}}
|
||||||
|
description={intl.formatMessage({
|
||||||
|
id: 'common.search.empty'
|
||||||
|
})}
|
||||||
|
></Empty>
|
||||||
|
);
|
||||||
|
}
|
||||||
let width: any = {
|
let width: any = {
|
||||||
maxWidth: 140,
|
maxWidth: 140,
|
||||||
minWidth: 140
|
minWidth: 140
|
||||||
@@ -275,6 +293,8 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
|||||||
>
|
>
|
||||||
<SealCascader
|
<SealCascader
|
||||||
required
|
required
|
||||||
|
showSearch
|
||||||
|
expandTrigger="hover"
|
||||||
onChange={handleGPUSelectorChange}
|
onChange={handleGPUSelectorChange}
|
||||||
multiple={backend !== backendOptionsMap.voxBox}
|
multiple={backend !== backendOptionsMap.voxBox}
|
||||||
popupClassName="cascader-popup-wrapper gpu-selector"
|
popupClassName="cascader-popup-wrapper gpu-selector"
|
||||||
|
|||||||
Reference in New Issue
Block a user