fix(amis-saas-7819): 同步主干最新代码

Change-Id: Id7cdbc0c38221eb7547c9ea8d1dd897e223b0549
This commit is contained in:
wibetter 2022-11-11 12:01:20 +08:00
commit 388706aeed
2 changed files with 47 additions and 14 deletions

View File

@ -3,7 +3,10 @@
*/
import flatten from 'lodash/flatten';
import {getEventControlConfig, SUPPORT_STATIC_FORMITEM_CMPTS} from '../renderer/event-control/helper';
import {
getEventControlConfig,
SUPPORT_STATIC_FORMITEM_CMPTS
} from '../renderer/event-control/helper';
import {getSchemaTpl, isObject, tipedLabel} from 'amis-editor-core';
import type {BaseEventContext} from 'amis-editor-core';
import {SchemaObject} from 'amis/lib/Schema';
@ -340,12 +343,14 @@ export const formItemControl: (
name: 'descriptionClassName',
visibleOn: 'this.description'
}),
...!supportStatic ? [] : [
getSchemaTpl('className', {
label: '静态 CSS 类名',
name: 'staticClassName'
})
]
...(!supportStatic
? []
: [
getSchemaTpl('className', {
label: '静态 CSS 类名',
name: 'staticClassName'
})
])
],
panels?.style?.body,
panels?.style?.replace,
@ -471,10 +476,11 @@ export function remarkTpl(config: {
}
]
},
getSchemaTpl('icon', {
{
type: 'icon-select',
name: 'icon',
label: '图标'
}),
},
{
name: 'className',
label: 'CSS 类名',

View File

@ -361,12 +361,39 @@ const Background: React.FC<BackgroundProps> = props => {
setTabIndex(index);
}
function handleChange(key: string, keyValue: string) {
function handleChange(key: string, keyValue: string | number) {
const {value, onChange} = props;
const result = {
...value,
[key]: keyValue
};
let result = {};
if (key === 'backgroundColor') {
result = {
...omit(value, [
'backgroundImage',
'backgroundPosition',
'backgroundSize',
'backgroundRepeat',
'angle'
]),
[key]: keyValue
};
} else if (key === 'angle') {
keyValue = keyValue || 0;
const linearGradient = value?.backgroundImage;
let backgroundImage = linearGradient?.replace(
/(\d{1,})?deg/,
`${keyValue}deg`
);
result = {
...value,
backgroundImage
};
} else {
result = {
...value,
[key]: keyValue
};
}
onChange(result);
}