Skip to content

Commit

Permalink
[fix] editor 配置面板中的开关打开更多配置的组件配置整理
Browse files Browse the repository at this point in the history
  • Loading branch information
yangwei14 committed Dec 9, 2024
1 parent effc93e commit aeaa7d4
Show file tree
Hide file tree
Showing 20 changed files with 554 additions and 602 deletions.
22 changes: 5 additions & 17 deletions packages/amis-editor/src/component/BaseControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,23 +402,11 @@ export function remarkTpl(config: {
: config.label,
bulk: false,
name: config.name,
pipeIn: (value: any) => !!value,
pipeOut: (value: any) => {
// 更新内容
if (isObject(value)) {
return value;
}
// 关到开
if (value) {
return {
icon: 'fa fa-question-circle',
trigger: ['hover'],
className: 'Remark--warning',
placement: 'top'
};
}
// 开到关
return undefined;
defaultData: {
icon: 'fa fa-question-circle',
trigger: ['hover'],
className: 'Remark--warning',
placement: 'top'
},
form: {
size: 'md',
Expand Down
7 changes: 4 additions & 3 deletions packages/amis-editor/src/plugin/Carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,19 +301,20 @@ export class CarouselPlugin extends BasePlugin {
}),
{
type: 'ae-switch-more',
bulk: true,
mode: 'normal',
name: 'multiple',
bulk: false,
label: '多图展示',
formType: 'extend',
form: {
body: [
{
name: 'multiple.count',
name: 'count',
label: '数量',
type: 'input-number',
min: 2,
step: 1
step: 1,
value: 5
}
]
}
Expand Down
6 changes: 5 additions & 1 deletion packages/amis-editor/src/plugin/CollapseGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,15 @@ export class CollapseGroupPlugin extends BasePlugin {
getSchemaTpl('icon', {
name: 'expandIcon',
label: '图标',
value: {
type: 'icon',
vendor: ''
},
pipeIn: (value: any) => value?.icon,
pipeOut: (value: any) => ({
type: 'icon',
vendor: '',
icon: value
icon: value ? value : undefined
})
})
]
Expand Down
18 changes: 0 additions & 18 deletions packages/amis-editor/src/plugin/Form/InputRating.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,7 @@ export class RateControlPlugin extends BasePlugin {
{
type: 'ae-switch-more',
label: '自定义',
bulk: true,
mode: 'normal',
value: false,
formType: 'extend',
form: {
body: [
Expand All @@ -265,22 +263,6 @@ export class RateControlPlugin extends BasePlugin {
name: 'char'
}
]
},
pipeIn: (value: string) => {
if (typeof value === 'string' && value.length) {
return {
character: value
};
}
return undefined;
},
pipeOut: (value: any) => {
if (!isObject(value)) {
return undefined;
}
return typeof value.character === 'string'
? value.character
: undefined;
}
},

Expand Down
2 changes: 2 additions & 0 deletions packages/amis-editor/src/plugin/Form/InputTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,8 @@ export class TableControlPlugin extends BasePlugin {
'确认模式',
'开启时,新增、编辑需要点击表格右侧的“保存”按钮才能变更组件数据。未开启时,新增、编辑、删除操作直接改变组件数据。'
),
isChecked: (v: any) => v !== false,
falseValue: false,
mode: 'normal',
formType: 'extend',
hiddenOnDefault: true,
Expand Down
7 changes: 5 additions & 2 deletions packages/amis-editor/src/plugin/Form/InputTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,10 @@ export class TreeControlPlugin extends BasePlugin {
bulk: false,
name: 'itemActions',
formType: 'extend',
defaultData: {
type: 'container',
body: [{type: 'button', label: '按钮'}]
},
form: {
body: [
{
Expand Down Expand Up @@ -755,8 +759,7 @@ export class TreeControlPlugin extends BasePlugin {
label: '设置层级',
name: 'unfoldedLevel',
value: 1,
min: 0,
hiddenOn: 'this.initiallyOpen'
min: 0
}
]
}
Expand Down
2 changes: 0 additions & 2 deletions packages/amis-editor/src/plugin/Form/ListSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ export class ListControlPlugin extends BasePlugin {
type: 'ae-switch-more',
mode: 'normal',
label: '自定义显示模板',
bulk: false,
name: 'itemSchema',
formType: 'extend',
form: {
body: [
Expand Down
12 changes: 7 additions & 5 deletions packages/amis-editor/src/plugin/Form/Picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -369,28 +369,30 @@ export class PickerControlPlugin extends BasePlugin {
type: 'ae-switch-more',
mode: 'normal',
formType: 'extend',
name: 'overflowConfigSwitch',
pipeIn: (value: any) => !!value,
name: 'overflowConfig',
bulk: false,
isChecked: (v: any) => !!v,
label: tipedLabel(
'标签收纳',
'当值数量超出一定数量时,可进行收纳显示'
),
extendData: ['embed'],
form: {
body: [
{
type: 'input-number',
name: 'overflowConfig.maxTagCount',
name: 'maxTagCount',
label: '最大标签数',
defaultValue: -1
},
getOverflowTagPopoverTpl({
namePre: 'overflowConfig.overflowTagPopover',
namePre: 'overflowTagPopover',
title: '选择器收纳器',
key: 'select',
className: 'm-b-sm'
}),
getOverflowTagPopoverTpl({
namePre: 'overflowConfig.overflowTagPopoverInCRUD',
namePre: 'overflowTagPopoverInCRUD',
title: 'CRUD收纳器',
key: 'crud',
className: 'm-b-sm',
Expand Down
Loading

0 comments on commit aeaa7d4

Please sign in to comment.