mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
fix(amis-editor): 处理input-number单位选项交互;input-table展示列配置项位置处理 & progress组件配置面板去除模版配置项 feat:组件状态支持"可见"配置项 (#8515)
* fix: 处理input-number单位选项交互;input-table展示列配置项位置处理 * fix: progress组件配置面板去除模版配置项 * feat: 组件状态支持"可见"配置项 * fix: inputNumber单位选项自动填充值 --------- Co-authored-by: yinchunyu <yinchunyu@baidu.com>
This commit is contained in:
parent
cd5cd3f40c
commit
5d89128ed9
@ -253,6 +253,7 @@ export const formItemControl: (
|
||||
key: 'status',
|
||||
body: normalizeBodySchema(
|
||||
[
|
||||
getSchemaTpl('visible'),
|
||||
getSchemaTpl('hidden'),
|
||||
supportStatic ? getSchemaTpl('static') : null,
|
||||
// TODO: 下面的部分表单项才有,是不是判断一下是否是表单项
|
||||
|
@ -223,7 +223,47 @@ export class NumberControlPlugin extends BasePlugin {
|
||||
},
|
||||
getSchemaTpl('prefix'),
|
||||
getSchemaTpl('suffix'),
|
||||
getSchemaTpl('keyValueMapControl'),
|
||||
getSchemaTpl('combo-container', {
|
||||
type: 'combo',
|
||||
label: '单位选项',
|
||||
mode: 'normal',
|
||||
name: 'unitOptions',
|
||||
items: [
|
||||
{
|
||||
placeholder: '文本',
|
||||
type: i18nEnabled ? 'input-text-i18n' : 'input-text',
|
||||
name: 'label'
|
||||
},
|
||||
{
|
||||
placeholder: '值',
|
||||
type: 'input-text',
|
||||
name: 'value'
|
||||
}
|
||||
],
|
||||
draggable: false,
|
||||
multiple: true,
|
||||
pipeIn: (value: any) => {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map(item =>
|
||||
typeof item === 'string'
|
||||
? {
|
||||
label: item,
|
||||
value: item
|
||||
}
|
||||
: item
|
||||
);
|
||||
}
|
||||
return [];
|
||||
},
|
||||
pipeOut: (value: any[]) => {
|
||||
if (!value.length) {
|
||||
return undefined;
|
||||
}
|
||||
return value.map(item =>
|
||||
item.value ? item : {label: item.label, value: item.label}
|
||||
);
|
||||
}
|
||||
}),
|
||||
getSchemaTpl('labelRemark'),
|
||||
getSchemaTpl('remark'),
|
||||
getSchemaTpl('placeholder'),
|
||||
|
@ -1004,34 +1004,7 @@ export class TableControlPlugin extends BasePlugin {
|
||||
},
|
||||
getSchemaTpl('description'),
|
||||
getSchemaTpl('placeholder'),
|
||||
getSchemaTpl('labelRemark'),
|
||||
{
|
||||
name: 'columnsTogglable',
|
||||
label: tipedLabel(
|
||||
'列显示开关',
|
||||
'是否展示表格列的显隐控件,“自动”即列数量大于5时自动开启'
|
||||
),
|
||||
type: 'button-group-select',
|
||||
pipeIn: defaultValue('auto'),
|
||||
size: 'sm',
|
||||
labelAlign: 'left',
|
||||
options: [
|
||||
{
|
||||
label: '自动',
|
||||
value: 'auto'
|
||||
},
|
||||
|
||||
{
|
||||
label: '开启',
|
||||
value: true
|
||||
},
|
||||
|
||||
{
|
||||
label: '关闭',
|
||||
value: false
|
||||
}
|
||||
]
|
||||
}
|
||||
getSchemaTpl('labelRemark')
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -1064,6 +1037,43 @@ export class TableControlPlugin extends BasePlugin {
|
||||
{
|
||||
title: '外观',
|
||||
body: getSchemaTpl('collapseGroup', [
|
||||
{
|
||||
title: '基本',
|
||||
body: [
|
||||
{
|
||||
name: 'columnsTogglable',
|
||||
label: tipedLabel(
|
||||
'列显示开关',
|
||||
'是否展示表格列的显隐控件,“自动”即列数量大于5时自动开启'
|
||||
),
|
||||
type: 'button-group-select',
|
||||
pipeIn: defaultValue('auto'),
|
||||
size: 'sm',
|
||||
labelAlign: 'left',
|
||||
options: [
|
||||
{
|
||||
label: '自动',
|
||||
value: 'auto'
|
||||
},
|
||||
|
||||
{
|
||||
label: '开启',
|
||||
value: true
|
||||
},
|
||||
|
||||
{
|
||||
label: '关闭',
|
||||
value: false
|
||||
}
|
||||
]
|
||||
},
|
||||
getSchemaTpl('switch', {
|
||||
name: 'affixHeader',
|
||||
label: '是否固定表头',
|
||||
pipeIn: defaultValue(false)
|
||||
})
|
||||
]
|
||||
},
|
||||
getSchemaTpl('style:formItem', {renderer: context.info.renderer}),
|
||||
getSchemaTpl('style:classNames', {
|
||||
schema: [
|
||||
|
@ -378,7 +378,7 @@ export class NavPlugin extends BasePlugin {
|
||||
// },
|
||||
{
|
||||
title: '状态',
|
||||
body: [getSchemaTpl('hidden')]
|
||||
body: [getSchemaTpl('visible'), getSchemaTpl('hidden')]
|
||||
}
|
||||
])
|
||||
},
|
||||
|
@ -92,26 +92,6 @@ export class ProgressPlugin extends BasePlugin {
|
||||
needDeleteProps: ['placeholder'],
|
||||
valueType: 'number' // 期望数值类型,不过 amis中会尝试字符串 trans 数值类型
|
||||
}),
|
||||
getSchemaTpl('menuTpl', {
|
||||
label: tipedLabel(
|
||||
'数值模板',
|
||||
'值渲染模板,支持JSX、数据域变量使用, 默认 ${value}%'
|
||||
),
|
||||
name: 'valueTpl',
|
||||
variables: [
|
||||
{
|
||||
label: '值字段',
|
||||
children: [
|
||||
{
|
||||
label: '进度值',
|
||||
value: 'value',
|
||||
tag: 'number'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
requiredDataPropsVariables: true
|
||||
}),
|
||||
|
||||
getSchemaTpl('switch', {
|
||||
name: 'showLabel',
|
||||
|
@ -273,7 +273,7 @@ export class ServicePlugin extends BasePlugin {
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
body: [getSchemaTpl('hidden')]
|
||||
body: [getSchemaTpl('visible'), getSchemaTpl('hidden')]
|
||||
},
|
||||
{
|
||||
title: '高级',
|
||||
|
@ -792,7 +792,7 @@ setSchemaTpl(
|
||||
return {
|
||||
title: '状态',
|
||||
body: [
|
||||
getSchemaTpl('newVisible'),
|
||||
getSchemaTpl('visible'),
|
||||
getSchemaTpl('hidden'),
|
||||
!config?.unsupportStatic && config?.isFormItem
|
||||
? getSchemaTpl('static')
|
||||
@ -878,17 +878,6 @@ setSchemaTpl('static', {
|
||||
expressionName: 'staticOn'
|
||||
});
|
||||
|
||||
// 新版配置面板兼容 [可见] 状态
|
||||
setSchemaTpl('newVisible', {
|
||||
type: 'ae-StatusControl',
|
||||
label: '可见',
|
||||
mode: 'normal',
|
||||
name: 'visible',
|
||||
expressionName: 'visibleOn',
|
||||
visibleOn:
|
||||
'data.visible || data.visible === false || data.visibleOn !== undefined'
|
||||
});
|
||||
|
||||
setSchemaTpl('hidden', {
|
||||
type: 'ae-StatusControl',
|
||||
label: '隐藏',
|
||||
|
@ -739,13 +739,3 @@ setSchemaTpl('optionDeleteControl', (params: OptionControlParams) => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* key value映射类组件
|
||||
*/
|
||||
setSchemaTpl('keyValueMapControl', {
|
||||
type: 'ae-keyValueMapControl',
|
||||
label: '单位选项',
|
||||
name: 'unitOptions',
|
||||
mode: 'normal'
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user