Skip to content

Hotfix/select onchange #2358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions shell/app/common/components/configurable-filter/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@
.twt-tag-item {
height: 20px;
line-height: 20px;
margin-left: 0;
margin-right: 4px;
}

.rc-virtual-list-holder-inner {
Expand All @@ -193,6 +195,7 @@

.ant-select-item {
padding: 0;
margin-right: 4px;
background-color: transparent !important;
}

Expand Down
16 changes: 8 additions & 8 deletions shell/app/common/components/render-form-item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ const RenderFormItem = ({

ItemComp = (
<ClassWrapper>
<SelectComp options={options} size={size} itemProps={itemProps} />
<SelectComp options={options} size={size} {...itemProps} />
</ClassWrapper>
);
action = i18n.t('common:select');
Expand All @@ -227,7 +227,7 @@ const RenderFormItem = ({

ItemComp = (
<ClassWrapper>
<TagsSelect options={options} size={size} itemProps={itemProps} />
<TagsSelect options={options} size={size} {...itemProps} />
</ClassWrapper>
);
action = i18n.t('common:select');
Expand Down Expand Up @@ -278,8 +278,8 @@ const RenderFormItem = ({
break;
case 'dateRange':
ItemComp = (
<ClassWrapper {...itemProps}>
<DateRange />
<ClassWrapper>
<DateRange {...itemProps} />
</ClassWrapper>
);
break;
Expand Down Expand Up @@ -381,11 +381,11 @@ interface SelectCompProps {
value: Array<number | string>;
onChange: (value: Array<number | string>) => void;
itemProps: Obj;
optionRender: (option: IOption) => JSX.Element;
}

const SelectComp = ({ value, onChange, options, size, itemProps }: SelectCompProps) => {
const SelectComp = ({ value, onChange, options, size, optionRender, ...restItemProps }: SelectCompProps) => {
const fixOptions = options.filter?.((item: IOption) => item.fix) || [];
const { optionRender, ...restItemProps } = itemProps;
return (
<Select
{...restItemProps}
Expand Down Expand Up @@ -525,12 +525,12 @@ interface TagsSelectProps {
itemProps: Obj;
}

const TagsSelect = ({ size, options, value = [], onChange, itemProps }: TagsSelectProps) => {
const TagsSelect = ({ size, options, value = [], onChange, ...restItemProps }: TagsSelectProps) => {
const [open, setOpen] = React.useState(false);

return (
<Select
{...itemProps}
{...restItemProps}
value={value}
onChange={onChange}
className="erda-tags-select"
Expand Down