feat: provider form

This commit is contained in:
jialin
2026-02-03 18:21:08 +08:00
parent 679e10abd6
commit b2a8d27178
15 changed files with 424 additions and 32 deletions
+1 -1
View File
@@ -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;
+11 -1
View File
@@ -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}
/>
);
})}
+27 -10
View File
@@ -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"
+4 -2
View File
@@ -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}
+5 -1
View File
@@ -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 {