amis-saas-7517 主题外观

Change-Id: If6d82ef043334e9ffd5e6472e2c7f3b451ce1411
This commit is contained in:
qkiroc 2022-11-20 22:24:38 +08:00
parent 805d1cd500
commit b01955fa6a
4 changed files with 70 additions and 82 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "amis-editor", "name": "amis-editor",
"version": "5.2.1", "version": "5.2.1-theme.0",
"description": "amis 可视化编辑器", "description": "amis 可视化编辑器",
"main": "lib/index.js", "main": "lib/index.js",
"module": "esm/index.js", "module": "esm/index.js",
@ -33,7 +33,7 @@
}, },
"dependencies": { "dependencies": {
"@webcomponents/webcomponentsjs": "^2.6.0", "@webcomponents/webcomponentsjs": "^2.6.0",
"amis-editor-core": "*", "amis-editor-core": "^5.2.1-theme.0",
"amis-theme-editor": "*", "amis-theme-editor": "*",
"i18n-runtime": "*", "i18n-runtime": "*",
"lodash": "^4.17.15" "lodash": "^4.17.15"
@ -102,8 +102,8 @@
"amis": "*", "amis": "*",
"amis-core": "*", "amis-core": "*",
"amis-formula": "*", "amis-formula": "*",
"amis-ui": "*",
"amis-theme-editor": "*", "amis-theme-editor": "*",
"amis-ui": "*",
"i18n-runtime": "*" "i18n-runtime": "*"
} }
} }

View File

@ -165,7 +165,7 @@ import './renderer/FeatureControl';
import './renderer/event-control/index'; import './renderer/event-control/index';
import './renderer/TreeOptionControl'; import './renderer/TreeOptionControl';
import './renderer/TransferTableControl'; import './renderer/TransferTableControl';
import 'amis-theme-editor/lib/renderers'; import 'amis-theme-editor';
export * from './component/BaseControl'; export * from './component/BaseControl';
export * from './icons/index'; export * from './icons/index';

View File

@ -80,37 +80,19 @@ export class ButtonPlugin extends BasePlugin {
const buttonStateFunc = (visibleOn: string, state: string) => { const buttonStateFunc = (visibleOn: string, state: string) => {
return [ return [
{ getSchemaTpl('theme:colorPicker', {
mode: 'default',
type: 'amis-theme-color-picker',
label: '文字颜色', label: '文字颜色',
name: `css.className.color:${state}`, name: `css.className.color:${state}`,
labelMode: 'input', labelMode: 'input',
needCustom: true,
visibleOn: visibleOn visibleOn: visibleOn
}, }),
{ getSchemaTpl('theme:colorPicker', {
mode: 'default',
type: 'amis-theme-color-picker',
label: '背景颜色', label: '背景颜色',
name: `css.className.background-color:${state}`, name: `css.className.background:${state}`,
labelMode: 'input', labelMode: 'input',
needCustom: true, needGradient: true,
visibleOn: visibleOn visibleOn: visibleOn
}, })
// {
// type: 'amis-theme-shadow-editor',
// name: `css.className.shadow:${state}`,
// label: '阴影'
// },
{
mode: 'default',
label: '边框',
type: 'amis-theme-border',
name: `css.className.border:${state}`,
needColorCustom: true,
visibleOn: visibleOn
}
]; ];
}; };
@ -306,7 +288,7 @@ export class ButtonPlugin extends BasePlugin {
body: [ body: [
{ {
type: 'select', type: 'select',
name: 'state', name: 'editorState',
label: '状态', label: '状态',
selectFirst: true, selectFirst: true,
options: [ options: [
@ -328,57 +310,19 @@ export class ButtonPlugin extends BasePlugin {
} }
] ]
}, },
...buttonStateFunc("${state == 'default' || !state}", 'default'), ...buttonStateFunc(
...buttonStateFunc("${state == 'hover'}", 'hover'), "${editorState == 'default' || !editorState}",
...buttonStateFunc("${state == 'active'}", 'active'), 'default'
...buttonStateFunc("${state == 'disabled'}", 'disabled') ),
...buttonStateFunc("${editorState == 'hover'}", 'hover'),
...buttonStateFunc("${editorState == 'active'}", 'active')
] ]
}, },
{ {
title: '尺寸参数', title: '尺寸参数',
body: [ body: [getSchemaTpl('theme:paddingAndMargin')]
{
mode: 'default',
label: '尺寸',
type: 'amis-theme-size-editor',
name: `css.className.size`,
hideWidth: true
},
{
mode: 'default',
type: 'amis-theme-font-editor',
label: '文字',
name: `css.className.font`
},
{
mode: 'default',
type: 'amis-theme-radius',
label: '圆角',
name: `css.className.radius`
},
{
mode: 'default',
type: 'amis-theme-padding-and-margin',
label: '边距',
name: `css.className.radipadding-and-margin`
}
]
}, },
getSchemaTpl('style:classNames', { getSchemaTpl('theme:classNames')
isFormItem: false,
schema: [
getSchemaTpl('className', {
name: 'iconClassName',
label: '左侧图标',
visibleOn: 'this.icon'
}),
getSchemaTpl('className', {
name: 'rightIconClassName',
label: '右侧图标',
visibleOn: 'this.rightIcon'
})
]
})
]) ])
}, },
{ {

View File

@ -44,12 +44,14 @@ setSchemaTpl(
label: '控件', label: '控件',
name: 'inputClassName' name: 'inputClassName'
}), }),
...unsupportStatic ? [] : [ ...(unsupportStatic
getSchemaTpl('className', { ? []
label: '表单项静态', : [
name: 'staticClassName' getSchemaTpl('className', {
}) label: '表单项静态',
] name: 'staticClassName'
})
])
] ]
: [ : [
getSchemaTpl('className', { getSchemaTpl('className', {
@ -418,3 +420,45 @@ export const styleTpl = {
} }
] ]
}; };
/**
*
*/
// css类名
setSchemaTpl('theme:classNames', (option: any = []) => {
return {
title: 'CSS 类名',
body: [
{
type: 'input-text',
label: '外层',
name: 'className'
},
...option
]
};
});
// 颜色选择器
setSchemaTpl('theme:colorPicker', (option: any = {}) => {
return {
mode: 'default',
type: 'amis-theme-color-picker',
label: '颜色',
name: `css.className.color`,
needCustom: true,
...option
};
});
// 边距选择器
setSchemaTpl('theme:paddingAndMargin', (option: any = {}) => {
return {
mode: 'default',
type: 'amis-theme-padding-and-margin',
label: '边距',
name: `css.className.padding-and-margin`,
...option
};
});