diff --git a/packages/amis-ui/scss/components/form/_icon-select.scss b/packages/amis-ui/scss/components/form/_icon-select.scss index 94b792846..84b119e22 100644 --- a/packages/amis-ui/scss/components/form/_icon-select.scss +++ b/packages/amis-ui/scss/components/form/_icon-select.scss @@ -53,6 +53,19 @@ align-items: center; justify-content: flex-start; overflow: hidden; + + img.icon { + height: var(--sizes-size-7); + margin-right: var(--sizes-size-4); + } + + &-str-svg { + height: var(--fontSizeBase); + svg { + width: 100%; + height: 100%; + } + } } &-wrapper { diff --git a/packages/amis/src/renderers/Form/IconSelect.tsx b/packages/amis/src/renderers/Form/IconSelect.tsx index 834444b17..1a86cc7d9 100644 --- a/packages/amis/src/renderers/Form/IconSelect.tsx +++ b/packages/amis/src/renderers/Form/IconSelect.tsx @@ -121,10 +121,12 @@ export default class IconSelectControl extends React.PureComponent< disabled, value: valueTemp, placeholder, - clearable, + clearable } = this.props; const value = typeof valueTemp === 'string' ? this.getValueBySvg(valueTemp) : valueTemp; + const SvgStr = + typeof valueTemp === 'string' && valueTemp.match(/()/); const pureValue = (value?.id && String(value.id).replace(/^svg-/, '')) || ''; @@ -138,14 +140,21 @@ export default class IconSelectControl extends React.PureComponent< - ) : ( - - )} + ) : valueTemp ? ( + SvgStr ? ( +
+ ) : ( + + ) + ) : null} {iconName} - {clearable && !disabled && pureValue ? ( + {clearable && !disabled && (pureValue || valueTemp) ? (