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 { > div {
flex-grow: 0 !important; flex-grow: 0 !important;
min-width: auto !important;
} }
} }
} }

View File

@ -142,8 +142,8 @@ export default class BadgeControl extends React.Component<
} }
transformBadgeValue(): BadgeForm { transformBadgeValue(): BadgeForm {
const {data: ctx, node} = this.props; const {data: ctx, node, name} = this.props;
let badge = ctx?.badge ?? {}; let badge = ctx?.[name || 'badge'] ?? {};
// 避免获取到上层的size // 避免获取到上层的size
let size = ctx?.badge?.size; let size = ctx?.badge?.size;
if (node.type === 'button-group-select') { if (node.type === 'button-group-select') {
@ -185,10 +185,10 @@ export default class BadgeControl extends React.Component<
} }
handleSubmit(form: BadgeForm, action: any): void { handleSubmit(form: BadgeForm, action: any): void {
const {onBulkChange} = this.props; const {onBulkChange, name} = this.props;
if (action?.type === 'submit') { 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 const ColProps = ['lg', 'md', 'sm', 'xs'];
export type GridColumnObject = { export type GridColumnObject = {
/**
* id
*/
id?: string;
/** /**
* <768px时宽度占比 * <768px时宽度占比
*/ */
@ -62,6 +67,10 @@ export type GridColumnObject = {
* *
*/ */
style?: any; style?: any;
wrapperCustomStyle?: any;
themeCss?: any;
}; };
export type GridColumn = GridColumnObject; export type GridColumn = GridColumnObject;
@ -165,9 +174,12 @@ export default class Grid<T> extends React.Component<GridProps & T, object> {
formHorizontal, formHorizontal,
translate: __, translate: __,
disabled, disabled,
data data,
env
} = this.props; } = this.props;
const styleVar = buildStyle(column.style, data); const styleVar = buildStyle(column.style, data);
const {id, themeCss, wrapperCustomStyle} = column;
return ( return (
<div <div
key={key} key={key}
@ -176,7 +188,19 @@ export default class Grid<T> extends React.Component<GridProps & T, object> {
fromBsClass((column as any).columnClassName!), fromBsClass((column as any).columnClassName!),
{ {
[`Grid-col--v${ucFirst(column.valign)}`]: column.valign [`Grid-col--v${ucFirst(column.valign)}`]: column.valign
} },
setThemeClassName({
...column,
name: 'baseControlClassName',
id,
themeCss
}),
setThemeClassName({
...column,
name: 'wrapperCustomStyle',
id,
themeCss
})
)} )}
style={styleVar} style={styleVar}
> >
@ -186,6 +210,21 @@ export default class Grid<T> extends React.Component<GridProps & T, object> {
formHorizontal: formHorizontal:
column.horizontal || subFormHorizontal || formHorizontal column.horizontal || subFormHorizontal || formHorizontal
})} })}
<CustomStyle
{...column}
config={{
wrapperCustomStyle,
id,
themeCss,
classNames: [
{
key: 'baseControlClassName'
}
]
}}
env={env}
/>
</div> </div>
); );
} }