Merge pull request #7570 from wibetter/master

fix(amis-editor): chart配置/同时放开api和config配置
This commit is contained in:
刘丹 2023-07-25 16:36:44 +08:00 committed by GitHub
commit 4ce2437afb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 95 additions and 93 deletions

View File

@ -209,6 +209,7 @@ export class ChartPlugin extends BasePlugin {
{ {
title: '数据设置', title: '数据设置',
body: [ body: [
/*
{ {
type: 'select', type: 'select',
name: 'chartDataType', name: 'chartDataType',
@ -233,10 +234,10 @@ export class ChartPlugin extends BasePlugin {
} }
] ]
}, },
*/
getSchemaTpl('apiControl', { getSchemaTpl('apiControl', {
label: '数据接口', label: '数据接口',
visibleOn: 'chartDataType === "dataApi"', // visibleOn: 'chartDataType === "dataApi"',
description: description:
'接口可以返回echart图表完整配置或者图表数据建议返回图表数据映射到 Echarts 配置中' '接口可以返回echart图表完整配置或者图表数据建议返回图表数据映射到 Echarts 配置中'
}), }),
@ -244,7 +245,8 @@ export class ChartPlugin extends BasePlugin {
getSchemaTpl('switch', { getSchemaTpl('switch', {
label: '初始是否拉取', label: '初始是否拉取',
name: 'initFetch', name: 'initFetch',
visibleOn: 'chartDataType === "dataApi" && data.api', // visibleOn: 'chartDataType === "dataApi" && data.api',
visibleOn: 'data.api',
pipeIn: defaultValue(true) pipeIn: defaultValue(true)
}), }),
@ -253,13 +255,14 @@ export class ChartPlugin extends BasePlugin {
label: '定时刷新间隔', label: '定时刷新间隔',
type: 'input-number', type: 'input-number',
step: 500, step: 500,
visibleOn: 'chartDataType === "dataApi" && data.api', // visibleOn: 'chartDataType === "dataApi" && data.api',
visibleOn: 'data.api',
description: '设置后将自动定时刷新最小3000, 单位 ms' description: '设置后将自动定时刷新最小3000, 单位 ms'
}, },
{ {
name: 'config', name: 'config',
asFormItem: true, asFormItem: true,
visibleOn: 'chartDataType === "json"', // visibleOn: 'chartDataType === "json"',
component: ChartConfigEditor, component: ChartConfigEditor,
// type: 'json-editor', // type: 'json-editor',
label: tipedLabel( label: tipedLabel(

View File

@ -204,34 +204,30 @@ export class ContainerPlugin extends LayoutBasePlugin {
// 自由容器不需要 display 相关配置项 // 自由容器不需要 display 相关配置项
...(!isFreeContainer ? displayTpl : []), ...(!isFreeContainer ? displayTpl : []),
isFlexItem ...(isFlexItem
? getSchemaTpl('layout:flex', { ? [
isFlexColumnItem, getSchemaTpl('layout:flex', {
label: isFlexColumnItem ? '高度设置' : '宽度设置', isFlexColumnItem,
visibleOn: label: isFlexColumnItem ? '高度设置' : '宽度设置',
'data.style && (data.style.position === "static" || data.style.position === "relative")' visibleOn:
}) 'data.style && (data.style.position === "static" || data.style.position === "relative")'
: null, }),
isFlexItem getSchemaTpl('layout:flex-grow', {
? getSchemaTpl('layout:flex-grow', { visibleOn:
visibleOn: 'data.style && data.style.flex === "1 1 auto" && (data.style.position === "static" || data.style.position === "relative")'
'data.style && data.style.flex === "1 1 auto" && (data.style.position === "static" || data.style.position === "relative")' }),
}) getSchemaTpl('layout:flex-basis', {
: null, label: isFlexColumnItem ? '弹性高度' : '弹性宽度',
isFlexItem visibleOn:
? getSchemaTpl('layout:flex-basis', { 'data.style && (data.style.position === "static" || data.style.position === "relative") && data.style.flex === "1 1 auto"'
label: isFlexColumnItem ? '弹性高度' : '弹性宽度', }),
visibleOn: getSchemaTpl('layout:flex-basis', {
'data.style && (data.style.position === "static" || data.style.position === "relative") && data.style.flex === "1 1 auto"' label: isFlexColumnItem ? '固定高度' : '固定宽度',
}) visibleOn:
: null, 'data.style && (data.style.position === "static" || data.style.position === "relative") && data.style.flex === "0 0 150px"'
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,
getSchemaTpl('layout:overflow-x', { getSchemaTpl('layout:overflow-x', {
visibleOn: `${ visibleOn: `${
@ -308,7 +304,11 @@ export class ContainerPlugin extends LayoutBasePlugin {
title: '外观', title: '外观',
className: 'p-none', className: 'p-none',
body: getSchemaTpl('collapseGroup', [ body: getSchemaTpl('collapseGroup', [
...getSchemaTpl('theme:common', {exclude: ['layout']}) ...getSchemaTpl('theme:common', {exclude: ['layout']}),
{
title: '自定义 CSS 类名',
body: [getSchemaTpl('className')]
}
]) ])
}, },
{ {

View File

@ -113,34 +113,30 @@ export class FlexPluginBase extends LayoutBasePlugin {
getSchemaTpl('layout:flex-wrap'), getSchemaTpl('layout:flex-wrap'),
isFlexItem ...(isFlexItem
? getSchemaTpl('layout:flex', { ? [
isFlexColumnItem, getSchemaTpl('layout:flex', {
label: isFlexColumnItem ? '高度设置' : '宽度设置', isFlexColumnItem,
visibleOn: label: isFlexColumnItem ? '高度设置' : '宽度设置',
'data.style && (data.style.position === "static" || data.style.position === "relative")' visibleOn:
}) 'data.style && (data.style.position === "static" || data.style.position === "relative")'
: null, }),
isFlexItem getSchemaTpl('layout:flex-grow', {
? getSchemaTpl('layout:flex-grow', { visibleOn:
visibleOn: 'data.style && data.style.flex === "1 1 auto" && (data.style.position === "static" || data.style.position === "relative")'
'data.style && data.style.flex === "1 1 auto" && (data.style.position === "static" || data.style.position === "relative")' }),
}) getSchemaTpl('layout:flex-basis', {
: null, label: isFlexColumnItem ? '弹性高度' : '弹性宽度',
isFlexItem visibleOn:
? getSchemaTpl('layout:flex-basis', { 'data.style && (data.style.position === "static" || data.style.position === "relative") && data.style.flex === "1 1 auto"'
label: isFlexColumnItem ? '弹性高度' : '弹性宽度', }),
visibleOn: getSchemaTpl('layout:flex-basis', {
'data.style && (data.style.position === "static" || data.style.position === "relative") && data.style.flex === "1 1 auto"' label: isFlexColumnItem ? '固定高度' : '固定宽度',
}) visibleOn:
: null, 'data.style && (data.style.position === "static" || data.style.position === "relative") && data.style.flex === "0 0 150px"'
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,
getSchemaTpl('layout:overflow-x', { getSchemaTpl('layout:overflow-x', {
visibleOn: `${ visibleOn: `${
@ -212,7 +208,11 @@ export class FlexPluginBase extends LayoutBasePlugin {
title: '外观', title: '外观',
className: 'p-none', className: 'p-none',
body: getSchemaTpl('collapseGroup', [ body: getSchemaTpl('collapseGroup', [
...getSchemaTpl('theme:common', {exclude: ['layout']}) ...getSchemaTpl('theme:common', {exclude: ['layout']}),
{
title: '自定义 CSS 类名',
body: [getSchemaTpl('className')]
}
]) ])
} }
]) ])

View File

@ -78,34 +78,30 @@ export class WrapperPlugin extends LayoutBasePlugin {
'data.style && (data.style.display === "flex" || data.style.display === "inline-flex")' 'data.style && (data.style.display === "flex" || data.style.display === "inline-flex")'
}), }),
isFlexItem ...(isFlexItem
? getSchemaTpl('layout:flex', { ? [
isFlexColumnItem, getSchemaTpl('layout:flex', {
label: isFlexColumnItem ? '高度设置' : '宽度设置', isFlexColumnItem,
visibleOn: label: isFlexColumnItem ? '高度设置' : '宽度设置',
'data.style && (data.style.position === "static" || data.style.position === "relative")' visibleOn:
}) 'data.style && (data.style.position === "static" || data.style.position === "relative")'
: null, }),
isFlexItem getSchemaTpl('layout:flex-grow', {
? getSchemaTpl('layout:flex-grow', { visibleOn:
visibleOn: 'data.style && data.style.flex === "1 1 auto" && (data.style.position === "static" || data.style.position === "relative")'
'data.style && data.style.flex === "1 1 auto" && (data.style.position === "static" || data.style.position === "relative")' }),
}) getSchemaTpl('layout:flex-basis', {
: null, label: isFlexColumnItem ? '弹性高度' : '弹性宽度',
isFlexItem visibleOn:
? getSchemaTpl('layout:flex-basis', { 'data.style && (data.style.position === "static" || data.style.position === "relative") && data.style.flex === "1 1 auto"'
label: isFlexColumnItem ? '弹性高度' : '弹性宽度', }),
visibleOn: getSchemaTpl('layout:flex-basis', {
'data.style && (data.style.position === "static" || data.style.position === "relative") && data.style.flex === "1 1 auto"' label: isFlexColumnItem ? '固定高度' : '固定宽度',
}) visibleOn:
: null, 'data.style && (data.style.position === "static" || data.style.position === "relative") && data.style.flex === "0 0 150px"'
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,
getSchemaTpl('layout:overflow-x', { getSchemaTpl('layout:overflow-x', {
visibleOn: `${ visibleOn: `${

View File

@ -599,6 +599,9 @@ setSchemaTpl(
// 适配 // 适配
form.setValueByName('style.flexGrow', undefined); form.setValueByName('style.flexGrow', undefined);
form.setValueByName('style.flexBasis', undefined); form.setValueByName('style.flexBasis', undefined);
form.setValueByName('style.overflowX', undefined);
form.setValueByName('style.overflowY', undefined);
form.setValueByName('style.overflow', undefined);
if (config?.isFlexColumnItem) { if (config?.isFlexColumnItem) {
form.setValueByName('style.height', undefined); form.setValueByName('style.height', undefined);
@ -893,7 +896,7 @@ setSchemaTpl(
config?.label || config?.label ||
tipedLabel(' x轴滚动模式', '用于设置水平方向的滚动模式'), tipedLabel(' x轴滚动模式', '用于设置水平方向的滚动模式'),
name: config?.name || 'style.overflowX', name: config?.name || 'style.overflowX',
value: config?.value || 'auto', value: config?.value || 'visible',
visibleOn: config?.visibleOn, visibleOn: config?.visibleOn,
pipeIn: config?.pipeIn, pipeIn: config?.pipeIn,
pipeOut: config?.pipeOut, pipeOut: config?.pipeOut,
@ -1099,7 +1102,7 @@ setSchemaTpl(
config?.label || config?.label ||
tipedLabel(' y轴滚动模式', '用于设置垂直方向的滚动模式'), tipedLabel(' y轴滚动模式', '用于设置垂直方向的滚动模式'),
name: config?.name || 'style.overflowY', name: config?.name || 'style.overflowY',
value: config?.value || 'auto', value: config?.value || 'visible',
visibleOn: config?.visibleOn, visibleOn: config?.visibleOn,
pipeIn: config?.pipeIn, pipeIn: config?.pipeIn,
pipeOut: config?.pipeOut, pipeOut: config?.pipeOut,