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

View File

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

View File

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