amis-saas-9429 页面编辑器外观继承

Change-Id: Ief1c25788164b1c24855bfee6863df6740696f2f
This commit is contained in:
hongyang03 2023-02-23 11:16:30 +08:00
parent 82b526e2f8
commit aa5e2f9fc6
3 changed files with 52 additions and 18 deletions

View File

@ -358,11 +358,22 @@ export class TextControlPlugin extends BasePlugin {
'collapseGroup',
[
getSchemaTpl('style:formItem', {renderer}),
getSchemaTpl('theme:form-label'),
getSchemaTpl('theme:form-description'),
getSchemaTpl('theme:form-label', {
fontOption: {editorThemePath: 'form.item.default.label.body.font'}
}),
getSchemaTpl('theme:form-description', {
fontOption: {
editorThemePath: 'form.item.default.description.body.font'
}
}),
{
title: '输入框样式',
body: [...inputStateTpl('css.inputControlClassName')]
body: [
...inputStateTpl(
'css.inputControlClassName',
'input.base.default'
)
]
},
{
title: 'AddOn样式',

View File

@ -1,6 +1,6 @@
import {getSchemaTpl} from 'amis-editor-core';
export const inputStateTpl = (className: string) => {
export const inputStateTpl = (className: string, path: string = '') => {
return [
{
type: 'select',
@ -22,13 +22,19 @@ export const inputStateTpl = (className: string) => {
}
]
},
{
type: 'hidden',
name: 'editorPath',
value: path
},
...inputStateFunc(
"${editorState == 'default' || !editorState}",
'default',
className
className,
path
),
...inputStateFunc("${editorState == 'hover'}", 'hover', className),
...inputStateFunc("${editorState == 'active'}", 'active', className)
...inputStateFunc("${editorState == 'hover'}", 'hover', className, path),
...inputStateFunc("${editorState == 'active'}", 'active', className, path)
];
};
@ -36,32 +42,43 @@ export const inputStateFunc = (
visibleOn: string,
state: string,
className: string,
path: string,
options: any = []
) => {
return [
getSchemaTpl('theme:font', {
label: '文字',
name: `${className}.font:${state}`,
visibleOn: visibleOn
visibleOn: visibleOn,
editorThemePath: `${path}.${state}.body.font`,
state
}),
getSchemaTpl('theme:colorPicker', {
label: '背景',
name: `${className}.background:${state}`,
labelMode: 'input',
needGradient: true,
visibleOn: visibleOn
visibleOn: visibleOn,
editorThemePath: `${path}.${state}.body.bg-color`,
state
}),
getSchemaTpl('theme:border', {
name: `${className}.border:${state}`,
visibleOn: visibleOn
visibleOn: visibleOn,
editorThemePath: `${path}.${state}.body.border`,
state
}),
getSchemaTpl('theme:paddingAndMargin', {
name: `${className}.padding-and-margin:${state}`,
visibleOn: visibleOn
visibleOn: visibleOn,
editorThemePath: `${path}.${state}.body.padding-and-margin`,
state
}),
getSchemaTpl('theme:radius', {
name: `${className}.radius:${state}`,
visibleOn: visibleOn
visibleOn: visibleOn,
editorThemePath: `${path}.${state}.body.border`,
state
}),
...options
];

View File

@ -465,33 +465,39 @@ setSchemaTpl(
);
// form label
setSchemaTpl('theme:form-label', () => {
setSchemaTpl('theme:form-label', (option: any = {}) => {
const {fontOption = {}, pAmOption = {}} = option;
return {
title: 'Label样式',
body: [
getSchemaTpl('theme:font', {
label: '文字',
name: 'css.labelClassName.font'
name: 'css.labelClassName.font',
...fontOption
}),
getSchemaTpl('theme:paddingAndMargin', {
name: 'css.labelClassName.padding-and-margin'
name: 'css.labelClassName.padding-and-margin',
...pAmOption
})
]
};
});
// form description
setSchemaTpl('theme:form-description', () => {
setSchemaTpl('theme:form-description', (option: any = {}) => {
const {fontOption = {}, pAmOption = {}} = option;
return {
title: '描述样式',
visibleOn: 'this.description',
body: [
getSchemaTpl('theme:font', {
label: '文字',
name: 'css.descriptionClassName.font'
name: 'css.descriptionClassName.font',
...fontOption
}),
getSchemaTpl('theme:paddingAndMargin', {
name: 'css.descriptionClassName.padding-and-margin'
name: 'css.descriptionClassName.padding-and-margin',
...pAmOption
})
]
};