From 2a8e8fa589dc550e8cc4cb63a3f8e665e3ebc7eb Mon Sep 17 00:00:00 2001 From: zhangtao07 Date: Thu, 27 Jun 2024 16:41:40 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dcrud2=E8=A7=92?= =?UTF-8?q?=E6=A0=87=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../amis-editor-core/scss/control/_badge-control.scss | 1 + packages/amis-editor/src/renderer/BadgeControl.tsx | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/amis-editor-core/scss/control/_badge-control.scss b/packages/amis-editor-core/scss/control/_badge-control.scss index 1999c60b6..ba7bc309a 100644 --- a/packages/amis-editor-core/scss/control/_badge-control.scss +++ b/packages/amis-editor-core/scss/control/_badge-control.scss @@ -26,6 +26,7 @@ > div { flex-grow: 0 !important; + min-width: auto !important; } } } diff --git a/packages/amis-editor/src/renderer/BadgeControl.tsx b/packages/amis-editor/src/renderer/BadgeControl.tsx index 44eb41124..2c85ef897 100644 --- a/packages/amis-editor/src/renderer/BadgeControl.tsx +++ b/packages/amis-editor/src/renderer/BadgeControl.tsx @@ -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)}); } } From 023bef5d368366c7743fea9139adb6af38374c0f Mon Sep 17 00:00:00 2001 From: zhangtao07 Date: Thu, 27 Jun 2024 17:23:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=86=E6=A0=8F=E6=A0=8F=E7=9B=AE?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=96=E8=A7=82=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis/src/renderers/Grid.tsx | 43 ++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/packages/amis/src/renderers/Grid.tsx b/packages/amis/src/renderers/Grid.tsx index 3f6a0503c..4bea3377d 100644 --- a/packages/amis/src/renderers/Grid.tsx +++ b/packages/amis/src/renderers/Grid.tsx @@ -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 extends React.Component { formHorizontal, translate: __, disabled, - data + data, + env } = this.props; const styleVar = buildStyle(column.style, data); + + const {id, themeCss, wrapperCustomStyle} = column; return (
extends React.Component { 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 extends React.Component { formHorizontal: column.horizontal || subFormHorizontal || formHorizontal })} + +
); }