From d2b4f89acca01e504a7939d99c88c46da5cc7dd4 Mon Sep 17 00:00:00 2001 From: wibetter <365533093@qq.com> Date: Tue, 25 Jul 2023 16:13:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(amis-editor):=20x=E8=BD=B4=E5=92=8Cy?= =?UTF-8?q?=E8=BD=B4=E6=BB=9A=E5=8A=A8=E6=A8=A1=E5=BC=8F=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E8=B6=85=E5=87=BA=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis-editor/src/plugin/Container.tsx | 52 +++++++++---------- .../src/plugin/Layout/FlexPluginBase.tsx | 52 +++++++++---------- packages/amis-editor/src/plugin/Wrapper.tsx | 52 +++++++++---------- packages/amis-editor/src/tpl/layout.tsx | 7 ++- 4 files changed, 77 insertions(+), 86 deletions(-) diff --git a/packages/amis-editor/src/plugin/Container.tsx b/packages/amis-editor/src/plugin/Container.tsx index e90732cfc..cb8ea120b 100644 --- a/packages/amis-editor/src/plugin/Container.tsx +++ b/packages/amis-editor/src/plugin/Container.tsx @@ -204,34 +204,30 @@ export class ContainerPlugin extends LayoutBasePlugin { // 自由容器不需要 display 相关配置项 ...(!isFreeContainer ? displayTpl : []), - isFlexItem - ? getSchemaTpl('layout:flex', { - isFlexColumnItem, - label: isFlexColumnItem ? '高度设置' : '宽度设置', - visibleOn: - 'data.style && (data.style.position === "static" || data.style.position === "relative")' - }) - : null, - isFlexItem - ? getSchemaTpl('layout:flex-grow', { - visibleOn: - 'data.style && data.style.flex === "1 1 auto" && (data.style.position === "static" || data.style.position === "relative")' - }) - : null, - isFlexItem - ? getSchemaTpl('layout:flex-basis', { - label: isFlexColumnItem ? '弹性高度' : '弹性宽度', - visibleOn: - 'data.style && (data.style.position === "static" || data.style.position === "relative") && data.style.flex === "1 1 auto"' - }) - : null, - isFlexItem - ? getSchemaTpl('layout:flex-basis', { - label: isFlexColumnItem ? '固定高度' : '固定宽度', - visibleOn: - 'data.style && (data.style.position === "static" || data.style.position === "relative") && data.style.flex === "0 0 150px"' - }) - : null, + ...(isFlexItem + ? [ + getSchemaTpl('layout:flex', { + isFlexColumnItem, + label: isFlexColumnItem ? '高度设置' : '宽度设置', + visibleOn: + 'data.style && (data.style.position === "static" || data.style.position === "relative")' + }), + getSchemaTpl('layout:flex-grow', { + visibleOn: + 'data.style && data.style.flex === "1 1 auto" && (data.style.position === "static" || data.style.position === "relative")' + }), + getSchemaTpl('layout:flex-basis', { + label: isFlexColumnItem ? '弹性高度' : '弹性宽度', + visibleOn: + 'data.style && (data.style.position === "static" || data.style.position === "relative") && data.style.flex === "1 1 auto"' + }), + getSchemaTpl('layout:flex-basis', { + label: isFlexColumnItem ? '固定高度' : '固定宽度', + visibleOn: + 'data.style && (data.style.position === "static" || data.style.position === "relative") && data.style.flex === "0 0 150px"' + }) + ] + : []), getSchemaTpl('layout:overflow-x', { visibleOn: `${ diff --git a/packages/amis-editor/src/plugin/Layout/FlexPluginBase.tsx b/packages/amis-editor/src/plugin/Layout/FlexPluginBase.tsx index d4daa9c67..6f0495a44 100644 --- a/packages/amis-editor/src/plugin/Layout/FlexPluginBase.tsx +++ b/packages/amis-editor/src/plugin/Layout/FlexPluginBase.tsx @@ -113,34 +113,30 @@ export class FlexPluginBase extends LayoutBasePlugin { getSchemaTpl('layout:flex-wrap'), - isFlexItem - ? getSchemaTpl('layout:flex', { - isFlexColumnItem, - label: isFlexColumnItem ? '高度设置' : '宽度设置', - visibleOn: - 'data.style && (data.style.position === "static" || data.style.position === "relative")' - }) - : null, - isFlexItem - ? getSchemaTpl('layout:flex-grow', { - visibleOn: - 'data.style && data.style.flex === "1 1 auto" && (data.style.position === "static" || data.style.position === "relative")' - }) - : null, - isFlexItem - ? getSchemaTpl('layout:flex-basis', { - label: isFlexColumnItem ? '弹性高度' : '弹性宽度', - visibleOn: - 'data.style && (data.style.position === "static" || data.style.position === "relative") && data.style.flex === "1 1 auto"' - }) - : null, - isFlexItem - ? getSchemaTpl('layout:flex-basis', { - label: isFlexColumnItem ? '固定高度' : '固定宽度', - visibleOn: - 'data.style && (data.style.position === "static" || data.style.position === "relative") && data.style.flex === "0 0 150px"' - }) - : null, + ...(isFlexItem + ? [ + getSchemaTpl('layout:flex', { + isFlexColumnItem, + label: isFlexColumnItem ? '高度设置' : '宽度设置', + visibleOn: + 'data.style && (data.style.position === "static" || data.style.position === "relative")' + }), + getSchemaTpl('layout:flex-grow', { + visibleOn: + 'data.style && data.style.flex === "1 1 auto" && (data.style.position === "static" || data.style.position === "relative")' + }), + getSchemaTpl('layout:flex-basis', { + label: isFlexColumnItem ? '弹性高度' : '弹性宽度', + visibleOn: + 'data.style && (data.style.position === "static" || data.style.position === "relative") && data.style.flex === "1 1 auto"' + }), + getSchemaTpl('layout:flex-basis', { + label: isFlexColumnItem ? '固定高度' : '固定宽度', + visibleOn: + 'data.style && (data.style.position === "static" || data.style.position === "relative") && data.style.flex === "0 0 150px"' + }) + ] + : []), getSchemaTpl('layout:overflow-x', { visibleOn: `${ diff --git a/packages/amis-editor/src/plugin/Wrapper.tsx b/packages/amis-editor/src/plugin/Wrapper.tsx index e0e0cc078..e2631ed22 100644 --- a/packages/amis-editor/src/plugin/Wrapper.tsx +++ b/packages/amis-editor/src/plugin/Wrapper.tsx @@ -78,34 +78,30 @@ export class WrapperPlugin extends LayoutBasePlugin { 'data.style && (data.style.display === "flex" || data.style.display === "inline-flex")' }), - isFlexItem - ? getSchemaTpl('layout:flex', { - isFlexColumnItem, - label: isFlexColumnItem ? '高度设置' : '宽度设置', - visibleOn: - 'data.style && (data.style.position === "static" || data.style.position === "relative")' - }) - : null, - isFlexItem - ? getSchemaTpl('layout:flex-grow', { - visibleOn: - 'data.style && data.style.flex === "1 1 auto" && (data.style.position === "static" || data.style.position === "relative")' - }) - : null, - isFlexItem - ? getSchemaTpl('layout:flex-basis', { - label: isFlexColumnItem ? '弹性高度' : '弹性宽度', - visibleOn: - 'data.style && (data.style.position === "static" || data.style.position === "relative") && data.style.flex === "1 1 auto"' - }) - : null, - isFlexItem - ? getSchemaTpl('layout:flex-basis', { - label: isFlexColumnItem ? '固定高度' : '固定宽度', - visibleOn: - 'data.style && (data.style.position === "static" || data.style.position === "relative") && data.style.flex === "0 0 150px"' - }) - : null, + ...(isFlexItem + ? [ + getSchemaTpl('layout:flex', { + isFlexColumnItem, + label: isFlexColumnItem ? '高度设置' : '宽度设置', + visibleOn: + 'data.style && (data.style.position === "static" || data.style.position === "relative")' + }), + getSchemaTpl('layout:flex-grow', { + visibleOn: + 'data.style && data.style.flex === "1 1 auto" && (data.style.position === "static" || data.style.position === "relative")' + }), + getSchemaTpl('layout:flex-basis', { + label: isFlexColumnItem ? '弹性高度' : '弹性宽度', + visibleOn: + 'data.style && (data.style.position === "static" || data.style.position === "relative") && data.style.flex === "1 1 auto"' + }), + getSchemaTpl('layout:flex-basis', { + label: isFlexColumnItem ? '固定高度' : '固定宽度', + visibleOn: + 'data.style && (data.style.position === "static" || data.style.position === "relative") && data.style.flex === "0 0 150px"' + }) + ] + : []), getSchemaTpl('layout:overflow-x', { visibleOn: `${ diff --git a/packages/amis-editor/src/tpl/layout.tsx b/packages/amis-editor/src/tpl/layout.tsx index 01ec83d8d..c3eaafda8 100644 --- a/packages/amis-editor/src/tpl/layout.tsx +++ b/packages/amis-editor/src/tpl/layout.tsx @@ -599,6 +599,9 @@ setSchemaTpl( // 适配 form.setValueByName('style.flexGrow', undefined); form.setValueByName('style.flexBasis', undefined); + form.setValueByName('style.overflowX', undefined); + form.setValueByName('style.overflowY', undefined); + form.setValueByName('style.overflow', undefined); if (config?.isFlexColumnItem) { form.setValueByName('style.height', undefined); @@ -893,7 +896,7 @@ setSchemaTpl( config?.label || tipedLabel(' x轴滚动模式', '用于设置水平方向的滚动模式'), name: config?.name || 'style.overflowX', - value: config?.value || 'auto', + value: config?.value || 'visible', visibleOn: config?.visibleOn, pipeIn: config?.pipeIn, pipeOut: config?.pipeOut, @@ -1099,7 +1102,7 @@ setSchemaTpl( config?.label || tipedLabel(' y轴滚动模式', '用于设置垂直方向的滚动模式'), name: config?.name || 'style.overflowY', - value: config?.value || 'auto', + value: config?.value || 'visible', visibleOn: config?.visibleOn, pipeIn: config?.pipeIn, pipeOut: config?.pipeOut,