Merge pull request #8528 from yinchunyu/1027-sync-pm

feat:同步功能
This commit is contained in:
wutong 2023-11-13 14:24:18 +08:00 committed by GitHub
commit 60d259593e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 82 additions and 71 deletions

View File

@ -253,6 +253,7 @@ export const formItemControl: (
key: 'status', key: 'status',
body: normalizeBodySchema( body: normalizeBodySchema(
[ [
getSchemaTpl('visible'),
getSchemaTpl('hidden'), getSchemaTpl('hidden'),
supportStatic ? getSchemaTpl('static') : null, supportStatic ? getSchemaTpl('static') : null,
// TODO: 下面的部分表单项才有,是不是判断一下是否是表单项 // TODO: 下面的部分表单项才有,是不是判断一下是否是表单项

View File

@ -229,7 +229,47 @@ export class NumberControlPlugin extends BasePlugin {
}, },
getSchemaTpl('prefix'), getSchemaTpl('prefix'),
getSchemaTpl('suffix'), 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('labelRemark'),
getSchemaTpl('remark'), getSchemaTpl('remark'),
getSchemaTpl('placeholder'), getSchemaTpl('placeholder'),

View File

@ -1004,34 +1004,7 @@ export class TableControlPlugin extends BasePlugin {
}, },
getSchemaTpl('description'), getSchemaTpl('description'),
getSchemaTpl('placeholder'), getSchemaTpl('placeholder'),
getSchemaTpl('labelRemark'), 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
}
]
}
] ]
}, },
{ {
@ -1064,6 +1037,43 @@ export class TableControlPlugin extends BasePlugin {
{ {
title: '外观', title: '外观',
body: getSchemaTpl('collapseGroup', [ 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:formItem', {renderer: context.info.renderer}),
getSchemaTpl('style:classNames', { getSchemaTpl('style:classNames', {
schema: [ schema: [

View File

@ -378,7 +378,7 @@ export class NavPlugin extends BasePlugin {
// }, // },
{ {
title: '状态', title: '状态',
body: [getSchemaTpl('hidden')] body: [getSchemaTpl('visible'), getSchemaTpl('hidden')]
} }
]) ])
}, },

View File

@ -92,26 +92,6 @@ export class ProgressPlugin extends BasePlugin {
needDeleteProps: ['placeholder'], needDeleteProps: ['placeholder'],
valueType: 'number' // 期望数值类型,不过 amis中会尝试字符串 trans 数值类型 valueType: 'number' // 期望数值类型,不过 amis中会尝试字符串 trans 数值类型
}), }),
getSchemaTpl('menuTpl', {
label: tipedLabel(
'数值模板',
'值渲染模板支持JSX、数据域变量使用, 默认 ${value}%'
),
name: 'valueTpl',
variables: [
{
label: '值字段',
children: [
{
label: '进度值',
value: 'value',
tag: 'number'
}
]
}
],
requiredDataPropsVariables: true
}),
getSchemaTpl('switch', { getSchemaTpl('switch', {
name: 'showLabel', name: 'showLabel',

View File

@ -782,7 +782,7 @@ setSchemaTpl(
return { return {
title: '状态', title: '状态',
body: [ body: [
getSchemaTpl('newVisible'), getSchemaTpl('visible'),
getSchemaTpl('hidden'), getSchemaTpl('hidden'),
!config?.unsupportStatic && config?.isFormItem !config?.unsupportStatic && config?.isFormItem
? getSchemaTpl('static') ? getSchemaTpl('static')
@ -868,17 +868,6 @@ setSchemaTpl('static', {
expressionName: 'staticOn' 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', { setSchemaTpl('hidden', {
type: 'ae-StatusControl', type: 'ae-StatusControl',
label: '隐藏', label: '隐藏',

View File

@ -446,12 +446,3 @@ setSchemaTpl('dataMap', {
}) })
] ]
}); });
/**
* key value映射类组件
*/
setSchemaTpl('keyValueMapControl', {
type: 'ae-keyValueMapControl',
label: '单位选项',
name: 'unitOptions',
mode: 'normal'
});