From ddc834e958c011aa00cb50c39ba4753e80388ab5 Mon Sep 17 00:00:00 2001 From: wibetter <365533093@qq.com> Date: Mon, 15 Jan 2024 15:23:27 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix(amis-editor):=20layout:margin-center?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=A1=B9=E5=89=94=E9=99=A4=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=80=BC=EF=BC=8C=E9=81=BF=E5=85=8D=E5=BD=B1=E5=93=8D=E6=96=B0?= =?UTF-8?q?=E7=89=88=E5=A4=96=E8=A7=82=E8=BE=B9=E8=B7=9D=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis-editor/src/tpl/layout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/amis-editor/src/tpl/layout.tsx b/packages/amis-editor/src/tpl/layout.tsx index 8911a675dc1..f8e6b82101a 100644 --- a/packages/amis-editor/src/tpl/layout.tsx +++ b/packages/amis-editor/src/tpl/layout.tsx @@ -1153,7 +1153,7 @@ setSchemaTpl( '通过 margin 数值来设置对齐方式,其中 margin: 0 auto 用于设置居中对齐' ), name: config?.name || 'style.margin', - value: config?.value || '0', + value: config?.value, inputClassName: 'inline-flex justify-between', visibleOn: config?.visibleOn ?? From ae8500b22bc68bfdbbad2b5fc8c638c4734e0be6 Mon Sep 17 00:00:00 2001 From: wibetter <365533093@qq.com> Date: Mon, 15 Jan 2024 15:57:49 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix(amis-editor):=20=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E5=AE=B9=E5=99=A8=E7=9B=B8=E5=85=B3=E9=85=8D=E7=BD=AE=E7=BB=86?= =?UTF-8?q?=E8=8A=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis-editor/src/tpl/layout.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/amis-editor/src/tpl/layout.tsx b/packages/amis-editor/src/tpl/layout.tsx index f8e6b82101a..f7fdb25e36c 100644 --- a/packages/amis-editor/src/tpl/layout.tsx +++ b/packages/amis-editor/src/tpl/layout.tsx @@ -753,7 +753,7 @@ setSchemaTpl( name: config?.name || 'style.width', value: config?.value || '300px', visibleOn: config?.visibleOn - ? `${config?.visibleOn} && data.isFixedWidth` + ? `(${config?.visibleOn}) && data.isFixedWidth` : 'data.isFixedWidth', clearable: true, unitOptions: config?.unitOptions ?? LayoutUnitOptions, @@ -826,7 +826,7 @@ setSchemaTpl( value: config?.value, min: '${style.minWidth | toInt}', visibleOn: config?.visibleOn - ? `${config?.visibleOn} && !data.isFixedWidth` + ? `(${config?.visibleOn}) && !data.isFixedWidth` : '!data.isFixedWidth', clearable: true, unitOptions: config?.unitOptions ?? LayoutUnitOptions, @@ -865,7 +865,7 @@ setSchemaTpl( value: config?.value, max: '${style.maxWidth | toInt}', visibleOn: config?.visibleOn - ? `${config?.visibleOn} && !data.isFixedWidth` + ? `(${config?.visibleOn}) && !data.isFixedWidth` : '!data.isFixedWidth', clearable: true, unitOptions: config?.unitOptions ?? LayoutUnitOptions, @@ -993,7 +993,7 @@ setSchemaTpl( name: config?.name || 'style.height', value: config?.value || '300px', visibleOn: config?.visibleOn - ? `${config?.visibleOn} && data.isFixedHeight` + ? `(${config?.visibleOn}) && data.isFixedHeight` : 'data.isFixedHeight', clearable: true, unitOptions: config?.unitOptions ?? LayoutUnitOptions, @@ -1032,7 +1032,7 @@ setSchemaTpl( value: config?.value, min: '${style.minHeight | toInt}', visibleOn: config?.visibleOn - ? `${config?.visibleOn} && !data.isFixedHeight` + ? `(${config?.visibleOn}) && !data.isFixedHeight` : '!data.isFixedHeight', clearable: true, unitOptions: config?.unitOptions ?? LayoutUnitOptions, @@ -1071,7 +1071,7 @@ setSchemaTpl( value: config?.value, max: '${style.maxHeight | toInt}', visibleOn: config?.visibleOn - ? `${config?.visibleOn} && !data.isFixedHeight` + ? `(${config?.visibleOn}) && !data.isFixedHeight` : '!data.isFixedHeight', clearable: true, unitOptions: config?.unitOptions ?? LayoutUnitOptions, From 1b8bc719db692072919c2c86edf19c25635b0138 Mon Sep 17 00:00:00 2001 From: wibetter <365533093@qq.com> Date: Mon, 15 Jan 2024 16:48:11 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix(amis-editor):=20=E4=BC=98=E5=8C=96style?= =?UTF-8?q?2ThemeCss=EF=BC=8C=E9=81=BF=E5=85=8D=E6=97=A7=E7=9A=84themeCss?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis-editor-core/src/util.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/amis-editor-core/src/util.ts b/packages/amis-editor-core/src/util.ts index e1ab4ac5476..28b5de4690c 100644 --- a/packages/amis-editor-core/src/util.ts +++ b/packages/amis-editor-core/src/util.ts @@ -14,6 +14,7 @@ import isPlainObject from 'lodash/isPlainObject'; import isEqual from 'lodash/isEqual'; import isNumber from 'lodash/isNumber'; import debounce from 'lodash/debounce'; +import merge from 'lodash/merge'; const { guid, @@ -1224,10 +1225,10 @@ export function style2ThemeCss(data: any) { baseControlClassName }; } else { - themeCss.baseControlClassName = { - ...data.themeCss.baseControlClassName, - ...baseControlClassName - }; + themeCss.baseControlClassName = merge( + data.themeCss.baseControlClassName, + baseControlClassName + ); } return { ...data, From 9056a9e01d42dad0436ce5dac11ab2cc2650d9b7 Mon Sep 17 00:00:00 2001 From: wibetter <365533093@qq.com> Date: Mon, 15 Jan 2024 17:03:50 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix(amis-editor):=20=E5=AF=B9=E9=BD=90?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E9=85=8D=E7=BD=AE=E9=A1=B9=E5=92=8CthemeCss?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E6=A0=B7=E5=BC=8F=E9=85=8D=E7=BD=AE=E4=BF=9D?= =?UTF-8?q?=E6=8C=81=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis-editor/src/tpl/layout.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/amis-editor/src/tpl/layout.tsx b/packages/amis-editor/src/tpl/layout.tsx index f7fdb25e36c..fe77c79c727 100644 --- a/packages/amis-editor/src/tpl/layout.tsx +++ b/packages/amis-editor/src/tpl/layout.tsx @@ -1132,7 +1132,7 @@ setSchemaTpl( } ); -// 居中显示 +// 对齐方式 setSchemaTpl( 'layout:margin-center', (config?: { @@ -1172,6 +1172,16 @@ setSchemaTpl( value: 'auto 0px auto auto' } ], + pipeIn: config?.pipeIn + ? config?.pipeIn + : (value: any, data: any) => { + let themeCssValue = + data.data?.themeCss?.baseControlClassName?.[ + 'padding-and-margin:default' + ]?.margin; + return value || themeCssValue; + }, + pipeOut: config?.pipeOut, onChange: (value: string, oldValue: string, model: any, form: any) => { if ( form?.data?.style?.position === 'fixed' ||