Skip to content
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

fix: 修复变量命名冲突导致功能失效,修复弹出层内容堆叠在一起。新增标签内文本溢出后,hover展示全部信息 #11319

Merged
merged 3 commits into from
Dec 4, 2024
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
2 changes: 1 addition & 1 deletion docs/zh-CN/components/form/picker.md
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,7 @@ order: 35
| pickerSchema | `string` | `{mode: 'list', listItem: {title: '${label}'}}` | 即用 List 类型的渲染,来展示列表信息。更多配置参考 [CRUD](../crud) |
| embed | `boolean` | `false` | 是否使用内嵌模式 |
| overflowConfig | `OverflowConfig` | 参考[OverflowConfig](./#overflowconfig) | 开启最大标签展示数量的相关配置 `3.4.0` |
| removable | `removable` | `true` | 用于控制是否显示选中项的删除图标,默认值为 `true` | `6.10.0` |
2betop marked this conversation as resolved.
Show resolved Hide resolved
| itemClearable | `itemClearable` | `true` | 用于控制是否显示选中项的删除图标,默认值为 `true` | `6.10.0` |

### OverflowConfig

Expand Down
2 changes: 1 addition & 1 deletion packages/amis-editor/src/plugin/Form/Picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ export class PickerControlPlugin extends BasePlugin {
},
{
type: 'switch',
name: 'removable',
name: 'itemClearable',
label: '选中项可删除',
pipeIn: defaultValue(true),
inputClassName: 'is-inline '
Expand Down
2 changes: 1 addition & 1 deletion packages/amis-ui/scss/components/_crud.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
&-overflow {
&-wrapper {
display: flex;
flex-flow: column nowrap;
flex-wrap: wrap;
justify-content: flex-start;
align-items: flex-start;
overflow-x: hidden;
Expand Down
2 changes: 1 addition & 1 deletion packages/amis-ui/scss/components/form/_picker.scss
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
&-overflow {
&-wrapper {
display: flex;
flex-flow: column nowrap;
flex-wrap: wrap;
justify-content: flex-start;
align-items: flex-start;
overflow-x: hidden;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,13 @@ exports[`1. Renderer:Picker base 2`] = `
class="cxd-Picker-values"
>
<div
class="cxd-Picker-value"
class="cxd-OverflowTpl cxd-Picker-value"
>
<span
class="cxd-Picker-valueIcon"
>
×
</span>
<span
class="cxd-Picker-valueLabel"
>
Expand Down
14 changes: 8 additions & 6 deletions packages/amis/src/renderers/Form/Picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
isIntegerInRange,
setThemeClassName
} from 'amis-core';
import {Html, Icon, TooltipWrapper} from 'amis-ui';
import {Html, Icon, OverflowTpl, TooltipWrapper} from 'amis-ui';
import {FormOptionsSchema, SchemaTpl} from '../../Schema';
import intersectionWith from 'lodash/intersectionWith';
import type {TooltipWrapperSchema} from '../TooltipWrapper';
Expand Down Expand Up @@ -105,7 +105,7 @@ export interface PickerControlSchema extends FormOptionsSchema {
/**
* 选中项可删除,默认为true
*/
removable?: boolean;
itemClearable?: boolean;
}

export interface PickerProps extends OptionsControlProps {
Expand Down Expand Up @@ -529,7 +529,7 @@ export default class PickerControl extends React.PureComponent<

renderTag(item: Option, index: number) {
const {
removable = true,
itemClearable = true,
classPrefix: ns,
classnames: cx,
labelField,
Expand All @@ -543,7 +543,9 @@ export default class PickerControl extends React.PureComponent<
} = this.props;

return (
<div
<OverflowTpl
inline={false}
tooltip={getVariable(item, labelField || 'label')}
key={index}
className={cx(
`${ns}Picker-value`,
Expand All @@ -558,7 +560,7 @@ export default class PickerControl extends React.PureComponent<
}
)}
>
{removable && (
{itemClearable && (
<span
className={cx(
`${ns}Picker-valueIcon`,
Expand Down Expand Up @@ -601,7 +603,7 @@ export default class PickerControl extends React.PureComponent<
}`
)}
</span>
</div>
</OverflowTpl>
);
}

Expand Down
Loading