mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
Merge remote-tracking branch 'baidu/master'
This commit is contained in:
commit
ddde285005
@ -26,6 +26,7 @@
|
||||
|
||||
> div {
|
||||
flex-grow: 0 !important;
|
||||
min-width: auto !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -142,8 +142,8 @@ export default class BadgeControl extends React.Component<
|
||||
}
|
||||
|
||||
transformBadgeValue(): BadgeForm {
|
||||
const {data: ctx, node} = this.props;
|
||||
let badge = ctx?.badge ?? {};
|
||||
const {data: ctx, node, name} = this.props;
|
||||
let badge = ctx?.[name || 'badge'] ?? {};
|
||||
// 避免获取到上层的size
|
||||
let size = ctx?.badge?.size;
|
||||
if (node.type === 'button-group-select') {
|
||||
@ -185,10 +185,10 @@ export default class BadgeControl extends React.Component<
|
||||
}
|
||||
|
||||
handleSubmit(form: BadgeForm, action: any): void {
|
||||
const {onBulkChange} = this.props;
|
||||
const {onBulkChange, name} = this.props;
|
||||
|
||||
if (action?.type === 'submit') {
|
||||
onBulkChange?.({badge: this.normalizeBadgeValue(form)});
|
||||
onBulkChange?.({[name || 'badge']: this.normalizeBadgeValue(form)});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,11 @@ import {Spinner, SpinnerExtraProps} from 'amis-ui';
|
||||
export const ColProps = ['lg', 'md', 'sm', 'xs'];
|
||||
|
||||
export type GridColumnObject = {
|
||||
/**
|
||||
* 组件唯一 id
|
||||
*/
|
||||
id?: string;
|
||||
|
||||
/**
|
||||
* 极小屏(<768px)时宽度占比
|
||||
*/
|
||||
@ -62,6 +67,10 @@ export type GridColumnObject = {
|
||||
* 样式
|
||||
*/
|
||||
style?: any;
|
||||
|
||||
wrapperCustomStyle?: any;
|
||||
|
||||
themeCss?: any;
|
||||
};
|
||||
|
||||
export type GridColumn = GridColumnObject;
|
||||
@ -165,9 +174,12 @@ export default class Grid<T> extends React.Component<GridProps & T, object> {
|
||||
formHorizontal,
|
||||
translate: __,
|
||||
disabled,
|
||||
data
|
||||
data,
|
||||
env
|
||||
} = this.props;
|
||||
const styleVar = buildStyle(column.style, data);
|
||||
|
||||
const {id, themeCss, wrapperCustomStyle} = column;
|
||||
return (
|
||||
<div
|
||||
key={key}
|
||||
@ -176,7 +188,19 @@ export default class Grid<T> extends React.Component<GridProps & T, object> {
|
||||
fromBsClass((column as any).columnClassName!),
|
||||
{
|
||||
[`Grid-col--v${ucFirst(column.valign)}`]: column.valign
|
||||
}
|
||||
},
|
||||
setThemeClassName({
|
||||
...column,
|
||||
name: 'baseControlClassName',
|
||||
id,
|
||||
themeCss
|
||||
}),
|
||||
setThemeClassName({
|
||||
...column,
|
||||
name: 'wrapperCustomStyle',
|
||||
id,
|
||||
themeCss
|
||||
})
|
||||
)}
|
||||
style={styleVar}
|
||||
>
|
||||
@ -186,6 +210,21 @@ export default class Grid<T> extends React.Component<GridProps & T, object> {
|
||||
formHorizontal:
|
||||
column.horizontal || subFormHorizontal || formHorizontal
|
||||
})}
|
||||
|
||||
<CustomStyle
|
||||
{...column}
|
||||
config={{
|
||||
wrapperCustomStyle,
|
||||
id,
|
||||
themeCss,
|
||||
classNames: [
|
||||
{
|
||||
key: 'baseControlClassName'
|
||||
}
|
||||
]
|
||||
}}
|
||||
env={env}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user