Skip to content

Commit ddde285

Browse files
committed
Merge remote-tracking branch 'baidu/master'
2 parents 05d3240 + 60959a3 commit ddde285

File tree

3 files changed

+46
-6
lines changed

3 files changed

+46
-6
lines changed

packages/amis-editor-core/scss/control/_badge-control.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
> div {
2828
flex-grow: 0 !important;
29+
min-width: auto !important;
2930
}
3031
}
3132
}

packages/amis-editor/src/renderer/BadgeControl.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ export default class BadgeControl extends React.Component<
142142
}
143143

144144
transformBadgeValue(): BadgeForm {
145-
const {data: ctx, node} = this.props;
146-
let badge = ctx?.badge ?? {};
145+
const {data: ctx, node, name} = this.props;
146+
let badge = ctx?.[name || 'badge'] ?? {};
147147
// 避免获取到上层的size
148148
let size = ctx?.badge?.size;
149149
if (node.type === 'button-group-select') {
@@ -185,10 +185,10 @@ export default class BadgeControl extends React.Component<
185185
}
186186

187187
handleSubmit(form: BadgeForm, action: any): void {
188-
const {onBulkChange} = this.props;
188+
const {onBulkChange, name} = this.props;
189189

190190
if (action?.type === 'submit') {
191-
onBulkChange?.({badge: this.normalizeBadgeValue(form)});
191+
onBulkChange?.({[name || 'badge']: this.normalizeBadgeValue(form)});
192192
}
193193
}
194194

packages/amis/src/renderers/Grid.tsx

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ import {Spinner, SpinnerExtraProps} from 'amis-ui';
1616
export const ColProps = ['lg', 'md', 'sm', 'xs'];
1717

1818
export type GridColumnObject = {
19+
/**
20+
* 组件唯一 id
21+
*/
22+
id?: string;
23+
1924
/**
2025
* 极小屏(<768px)时宽度占比
2126
*/
@@ -62,6 +67,10 @@ export type GridColumnObject = {
6267
* 样式
6368
*/
6469
style?: any;
70+
71+
wrapperCustomStyle?: any;
72+
73+
themeCss?: any;
6574
};
6675

6776
export type GridColumn = GridColumnObject;
@@ -165,9 +174,12 @@ export default class Grid<T> extends React.Component<GridProps & T, object> {
165174
formHorizontal,
166175
translate: __,
167176
disabled,
168-
data
177+
data,
178+
env
169179
} = this.props;
170180
const styleVar = buildStyle(column.style, data);
181+
182+
const {id, themeCss, wrapperCustomStyle} = column;
171183
return (
172184
<div
173185
key={key}
@@ -176,7 +188,19 @@ export default class Grid<T> extends React.Component<GridProps & T, object> {
176188
fromBsClass((column as any).columnClassName!),
177189
{
178190
[`Grid-col--v${ucFirst(column.valign)}`]: column.valign
179-
}
191+
},
192+
setThemeClassName({
193+
...column,
194+
name: 'baseControlClassName',
195+
id,
196+
themeCss
197+
}),
198+
setThemeClassName({
199+
...column,
200+
name: 'wrapperCustomStyle',
201+
id,
202+
themeCss
203+
})
180204
)}
181205
style={styleVar}
182206
>
@@ -186,6 +210,21 @@ export default class Grid<T> extends React.Component<GridProps & T, object> {
186210
formHorizontal:
187211
column.horizontal || subFormHorizontal || formHorizontal
188212
})}
213+
214+
<CustomStyle
215+
{...column}
216+
config={{
217+
wrapperCustomStyle,
218+
id,
219+
themeCss,
220+
classNames: [
221+
{
222+
key: 'baseControlClassName'
223+
}
224+
]
225+
}}
226+
env={env}
227+
/>
189228
</div>
190229
);
191230
}

0 commit comments

Comments
 (0)