Merge remote-tracking branch 'baidu/master'

This commit is contained in:
2betop 2024-07-01 11:07:05 +08:00
commit ddde285005
3 changed files with 46 additions and 6 deletions

View File

@ -26,6 +26,7 @@
> div {
flex-grow: 0 !important;
min-width: auto !important;
}
}
}

View File

@ -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)});
}
}

View File

@ -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>
);
}