From a6d6a68ad129c679910970f2678fb42c6252d5d0 Mon Sep 17 00:00:00 2001 From: qinhaoyan <30946345+qinhaoyan@users.noreply.github.com> Date: Fri, 2 Feb 2024 13:52:40 +0800 Subject: [PATCH] =?UTF-8?q?form=E7=BB=84=E4=BB=B6=E5=A4=96=E8=A7=82?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis-editor/src/plugin/Form/Form.tsx | 68 ++++++++++--------- packages/amis-editor/src/tpl/horizontal.tsx | 3 +- packages/amis-editor/src/tpl/style.tsx | 10 ++- .../src/helper/ParseThemeData.ts | 2 +- .../src/style/_theme-select.scss | 1 + .../amis-ui/scss/components/form/_number.scss | 2 +- 6 files changed, 44 insertions(+), 42 deletions(-) diff --git a/packages/amis-editor/src/plugin/Form/Form.tsx b/packages/amis-editor/src/plugin/Form/Form.tsx index 37916df57..c74af5117 100644 --- a/packages/amis-editor/src/plugin/Form/Form.tsx +++ b/packages/amis-editor/src/plugin/Form/Form.tsx @@ -1086,7 +1086,7 @@ export class FormPlugin extends BasePlugin { title: '外观', body: getSchemaTpl('collapseGroup', [ { - title: '布局', + title: '基本', body: [ getSchemaTpl('formItemMode', { isForm: true, @@ -1117,12 +1117,7 @@ export class FormPlugin extends BasePlugin { return undefined; } } - } - ] - }, - { - title: '其他', - body: [ + }, getSchemaTpl('switch', { name: 'wrapWithPanel', label: tipedLabel( @@ -1141,33 +1136,40 @@ export class FormPlugin extends BasePlugin { }) ] }, - ...getSchemaTpl('theme:common', { - classname: 'formControlClassName', - baseTitle: 'form样式', - exclude: ['layout'], - extra: [ - getSchemaTpl('theme:base', { - classname: 'panelControlClassName', - title: 'Panel样式', - visibleOn: isWrapped - }), - getSchemaTpl('theme:base', { - classname: 'headerControlClassName', - title: '标题区样式', - visibleOn: isWrapped - }), - getSchemaTpl('theme:base', { - classname: 'bodyControlClassName', - title: '内容区样式', - visibleOn: isWrapped - }), - getSchemaTpl('theme:base', { - classname: 'actionsControlClassName', - title: '操作区样式', - visibleOn: isWrapped - }) - ] + getSchemaTpl('theme:base', { + classname: 'panelControlClassName', + title: 'Panel样式', + visibleOn: isWrapped }), + getSchemaTpl('theme:base', { + classname: 'headerControlClassName', + title: '标题区样式', + visibleOn: isWrapped + }), + getSchemaTpl('theme:base', { + classname: 'bodyControlClassName', + title: '内容区样式', + visibleOn: isWrapped + }), + getSchemaTpl('theme:base', { + classname: 'actionsControlClassName', + title: '操作区样式', + visibleOn: isWrapped + }), + getSchemaTpl('theme:base', { + classname: 'formControlClassName', + title: '表单样式', + hiddenOn: isWrapped + }), + { + title: '自定义样式', + body: [ + { + type: 'theme-cssCode', + label: false + } + ] + }, /** */ getSchemaTpl('style:classNames', { isFormItem: false, diff --git a/packages/amis-editor/src/tpl/horizontal.tsx b/packages/amis-editor/src/tpl/horizontal.tsx index be1a3dd50..60968e589 100644 --- a/packages/amis-editor/src/tpl/horizontal.tsx +++ b/packages/amis-editor/src/tpl/horizontal.tsx @@ -118,7 +118,8 @@ setSchemaTpl( body: [ getSchemaTpl('leftFixed'), getSchemaTpl('leftRate'), - getSchemaTpl('labelAlign') + getSchemaTpl('labelAlign'), + {} ] }) ]; diff --git a/packages/amis-editor/src/tpl/style.tsx b/packages/amis-editor/src/tpl/style.tsx index 0d3190ecd..f9e005b10 100644 --- a/packages/amis-editor/src/tpl/style.tsx +++ b/packages/amis-editor/src/tpl/style.tsx @@ -591,6 +591,7 @@ setSchemaTpl( classname?: string; title?: string; hiddenOn?: string; + visibleOn?: string; hidePaddingAndMargin?: boolean; }) => { const { @@ -599,6 +600,7 @@ setSchemaTpl( classname = 'baseControlClassName', title = '基本样式', hiddenOn, + visibleOn, hidePaddingAndMargin } = option; const curHidePaddingAndMargin = hidePaddingAndMargin ?? false; @@ -614,11 +616,6 @@ setSchemaTpl( name: `themeCss.${classname}.radius:${state}`, state }), - getSchemaTpl('theme:paddingAndMargin', { - visibleOn: visibleOn, - name: `themeCss.${classname}.padding-and-margin:${state}`, - state - }), !curHidePaddingAndMargin ? getSchemaTpl('theme:paddingAndMargin', { visibleOn: visibleOn, @@ -690,7 +687,8 @@ setSchemaTpl( title, collapsed, body: styles, - hiddenOn + hiddenOn, + visibleOn }; } ); diff --git a/packages/amis-theme-editor-helper/src/helper/ParseThemeData.ts b/packages/amis-theme-editor-helper/src/helper/ParseThemeData.ts index a02854a26..77a6e9f3f 100644 --- a/packages/amis-theme-editor-helper/src/helper/ParseThemeData.ts +++ b/packages/amis-theme-editor-helper/src/helper/ParseThemeData.ts @@ -282,7 +282,7 @@ export class ParseThemeData { // 解析组件通用方法 parseComponentCommon(component: any) { - if (component.token) { + if (component.token && component.body) { // 有token时结束递归 const token = component.token; for (let key in component.body) { diff --git a/packages/amis-theme-editor-helper/src/style/_theme-select.scss b/packages/amis-theme-editor-helper/src/style/_theme-select.scss index 54eb95764..10b8dbddd 100644 --- a/packages/amis-theme-editor-helper/src/style/_theme-select.scss +++ b/packages/amis-theme-editor-helper/src/style/_theme-select.scss @@ -9,6 +9,7 @@ $ns: cxd-; padding: 0 px2rem(8px); display: flex; align-items: center; + background-color: #fff; .ThemeSelectContent-theme { background-color: #f7f8fa; border-radius: 2px; diff --git a/packages/amis-ui/scss/components/form/_number.scss b/packages/amis-ui/scss/components/form/_number.scss index c96317d0c..03407a17e 100644 --- a/packages/amis-ui/scss/components/form/_number.scss +++ b/packages/amis-ui/scss/components/form/_number.scss @@ -378,7 +378,7 @@ .#{$ns}NumberControl-single-unit { cursor: default; text-align: center; - min-width: unset; + min-width: unset !important; padding: 0 var(--inputNumber-base-default-unit-paddingLeft); } }