feat: provider form
This commit is contained in:
@@ -2,7 +2,7 @@ import { createFromIconfontCN } from '@ant-design/icons';
|
||||
// import './iconfont/iconfont.js';
|
||||
|
||||
const IconFont = createFromIconfontCN({
|
||||
scriptUrl: '//at.alicdn.com/t/c/font_4613488_qm5jah0zmp8.js'
|
||||
scriptUrl: '//at.alicdn.com/t/c/font_4613488_j0qgzymxj98.js'
|
||||
});
|
||||
|
||||
export default IconFont;
|
||||
|
||||
@@ -15,6 +15,13 @@ interface ListInputProps {
|
||||
onChange: (data: string[]) => void;
|
||||
onBlur?: (e: any, index: number) => void;
|
||||
onDelete?: (index: number) => void;
|
||||
renderItem?: (
|
||||
data: any,
|
||||
props: {
|
||||
onChange: (value: string) => void;
|
||||
onBlur?: (e: any) => void;
|
||||
}
|
||||
) => React.ReactNode;
|
||||
}
|
||||
|
||||
const ListInput: React.FC<ListInputProps> = (props) => {
|
||||
@@ -28,7 +35,8 @@ const ListInput: React.FC<ListInputProps> = (props) => {
|
||||
btnText,
|
||||
options,
|
||||
labelExtra,
|
||||
trim = true
|
||||
trim = true,
|
||||
renderItem
|
||||
} = props;
|
||||
const [list, setList] = React.useState<{ value: string; uid: number }[]>([]);
|
||||
const countRef = React.useRef(0);
|
||||
@@ -92,12 +100,14 @@ const ListInput: React.FC<ListInputProps> = (props) => {
|
||||
<ListItem
|
||||
placeholder={props.placeholder}
|
||||
options={options}
|
||||
data={item}
|
||||
key={item.uid}
|
||||
value={item.value}
|
||||
onBlur={(e) => onBlur?.(e, index)}
|
||||
onRemove={() => handleOnRemove(index)}
|
||||
onChange={(val) => handleOnChange(val, index)}
|
||||
trim={trim}
|
||||
renderItem={renderItem}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -8,11 +8,19 @@ interface LabelItemProps {
|
||||
onRemove: () => void;
|
||||
onChange: (value: string) => void;
|
||||
onBlur?: (e: any) => void;
|
||||
renderItem?: (
|
||||
data: any,
|
||||
props: {
|
||||
onChange: (value: string) => void;
|
||||
onBlur?: (e: any) => void;
|
||||
}
|
||||
) => React.ReactNode;
|
||||
value: string;
|
||||
label?: string;
|
||||
placeholder?: string;
|
||||
options?: Global.HintOptions[];
|
||||
trim?: boolean;
|
||||
data?: any;
|
||||
}
|
||||
|
||||
const ListItem: React.FC<LabelItemProps> = (props) => {
|
||||
@@ -23,7 +31,9 @@ const ListItem: React.FC<LabelItemProps> = (props) => {
|
||||
label,
|
||||
value,
|
||||
options,
|
||||
trim = true
|
||||
trim = true,
|
||||
data,
|
||||
renderItem
|
||||
} = props;
|
||||
|
||||
const handleOnChange = (value: any) => {
|
||||
@@ -32,15 +42,22 @@ const ListItem: React.FC<LabelItemProps> = (props) => {
|
||||
|
||||
return (
|
||||
<div className="list-item">
|
||||
<HintInput
|
||||
value={value}
|
||||
onChange={handleOnChange}
|
||||
onBlur={onBlur}
|
||||
label={label}
|
||||
sourceOptions={options}
|
||||
trim={trim}
|
||||
placeholder={props.placeholder}
|
||||
/>
|
||||
{renderItem ? (
|
||||
renderItem(data, {
|
||||
onChange: handleOnChange,
|
||||
onBlur
|
||||
})
|
||||
) : (
|
||||
<HintInput
|
||||
value={value}
|
||||
onChange={handleOnChange}
|
||||
onBlur={onBlur}
|
||||
label={label}
|
||||
sourceOptions={options}
|
||||
trim={trim}
|
||||
placeholder={props.placeholder}
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
size="small"
|
||||
className="btn"
|
||||
|
||||
@@ -11,7 +11,8 @@ import Wrapper from './wrapper';
|
||||
import SelectWrapper from './wrapper/select';
|
||||
|
||||
const SealSelect: React.FC<
|
||||
SelectProps & SealFormItemProps & { footer?: React.ReactNode }
|
||||
SelectProps &
|
||||
SealFormItemProps & { footer?: React.ReactNode; alwaysFocus?: boolean }
|
||||
> = (props) => {
|
||||
const {
|
||||
label,
|
||||
@@ -25,6 +26,7 @@ const SealSelect: React.FC<
|
||||
notFoundContent = null,
|
||||
loading,
|
||||
footer,
|
||||
alwaysFocus = false,
|
||||
...rest
|
||||
} = props;
|
||||
const intl = useIntl();
|
||||
@@ -99,7 +101,7 @@ const SealSelect: React.FC<
|
||||
className="seal-select-wrapper"
|
||||
status={status}
|
||||
label={label}
|
||||
isFocus={isFocus}
|
||||
isFocus={alwaysFocus || isFocus}
|
||||
required={required}
|
||||
description={description}
|
||||
disabled={props.disabled}
|
||||
|
||||
@@ -2,6 +2,7 @@ import styled from 'styled-components';
|
||||
import { BORDERRADIUS, INPUT_INNER_PADDING, INPUTHEIGHT } from '../config';
|
||||
|
||||
const SelectWrapper = styled.div`
|
||||
flex: 1;
|
||||
.seal-select-wrapper {
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
@@ -89,6 +90,9 @@ const SelectWrapper = styled.div`
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
.ant-select .ant-select-content {
|
||||
padding-block: 0px 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
.ant-select-selection-overflow-item > span {
|
||||
@@ -118,7 +122,7 @@ const SelectWrapper = styled.div`
|
||||
}
|
||||
|
||||
.ant-select-content {
|
||||
padding-block: 20px 0 !important;
|
||||
padding-block: 20px 0;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
&.ant-cascader {
|
||||
|
||||
Reference in New Issue
Block a user