amis-saas-7944 Merge remote-tracking branch 'origin/feat-tree-merge' into amis-saas-7944

Change-Id: I638d7d39743f12978521beaf8304ea203f9ac6c8
This commit is contained in:
igrowp 2022-12-19 14:51:51 +08:00
commit ade4dc4e82
5 changed files with 126 additions and 40 deletions

View File

@ -10,6 +10,7 @@ export class FormulaControlPlugin extends BasePlugin {
// 组件名称 // 组件名称
name = '公式'; name = '公式';
isBaseComponent = true; isBaseComponent = true;
disabledRendererPlugin = true;
icon = 'fa fa-calculator'; icon = 'fa fa-calculator';
pluginIcon = 'formula-plugin'; pluginIcon = 'formula-plugin';
description = '通过公式计算指定的变量值,并将其结果作用到指定的变量中'; description = '通过公式计算指定的变量值,并将其结果作用到指定的变量中';

View File

@ -407,7 +407,7 @@ export class DateControlPlugin extends BasePlugin {
size: 'md', size: 'md',
label: '模式', label: '模式',
mode: 'row', mode: 'row',
value: false, pipeIn: defaultValue(false),
options: [ options: [
{ {
label: '浮层', label: '浮层',

View File

@ -416,7 +416,7 @@ export class DateRangeControlPlugin extends BasePlugin {
size: 'md', size: 'md',
label: '模式', label: '模式',
mode: 'row', mode: 'row',
value: false, pipeIn: defaultValue(false),
options: [ options: [
{ {
label: '浮层', label: '浮层',

View File

@ -20,8 +20,8 @@ export class TreeControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-list-alt'; icon = 'fa fa-list-alt';
pluginIcon = 'input-tree-plugin'; pluginIcon = 'input-tree-plugin';
description = description = '树型结构选择,支持 [内嵌模式] 与 [浮层模式] 的外观切换';
'树型结构来选择,可通过 options 来配置选项,也可通过 source 拉取选项'; searchKeywords = 'tree、树下拉、树下拉框、tree-select';
docLink = '/amis/zh-CN/components/form/input-tree'; docLink = '/amis/zh-CN/components/form/input-tree';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {
@ -55,9 +55,13 @@ export class TreeControlPlugin extends BasePlugin {
className: 'text-left', className: 'text-left',
mode: 'horizontal', mode: 'horizontal',
wrapWithPanel: false, wrapWithPanel: false,
body: { body: [
...this.scaffold {
...this.scaffold,
label: '树选择框 - 内嵌模式',
mode: 'normal'
} }
]
}; };
notRenderFormZone = true; notRenderFormZone = true;
@ -280,6 +284,34 @@ export class TreeControlPlugin extends BasePlugin {
required: true required: true
}), }),
getSchemaTpl('label'), getSchemaTpl('label'),
{
type: 'button-group-select',
name: 'type',
label: '模式',
pipeIn: defaultValue('input-tree'),
options: [
{
label: '内嵌',
value: 'input-tree'
},
{
label: '浮层',
value: 'tree-select'
}
]
},
getSchemaTpl('clearable', {
mode: 'horizontal',
horizontal: {
justify: true,
left: 8
},
inputClassName: 'is-inline ',
visibleOn: 'data.type === "tree-select"'
}),
getSchemaTpl('searchable', {
visibleOn: 'data.type === "tree-select"'
}),
getSchemaTpl('multiple', { getSchemaTpl('multiple', {
body: [ body: [
{ {
@ -404,7 +436,8 @@ export class TreeControlPlugin extends BasePlugin {
getSchemaTpl('valueFormula', { getSchemaTpl('valueFormula', {
name: 'highlightTxt', name: 'highlightTxt',
label: '高亮节点字符', label: '高亮节点字符',
type: 'input-text' type: 'input-text',
visibleOn: 'data.type === "input-tree"'
}), }),
{ {
type: 'ae-Switch-More', type: 'ae-Switch-More',
@ -445,8 +478,17 @@ export class TreeControlPlugin extends BasePlugin {
name: 'rootLabel' name: 'rootLabel'
} }
] ]
}
}, },
visibleOn: 'data.type === "input-tree"'
},
getSchemaTpl('switch', {
label: tipedLabel(
'选项文本仅显示选中节点',
'隐藏选择框中已选中节点的祖先节点的文本信息'
),
name: 'hideNodePathLabel',
visibleOn: 'data.type==="tree-select"'
}),
getSchemaTpl('switch', { getSchemaTpl('switch', {
label: '显示节点图标', label: '显示节点图标',
name: 'showIcon', name: 'showIcon',
@ -460,6 +502,10 @@ export class TreeControlPlugin extends BasePlugin {
name: 'showRadio', name: 'showRadio',
hiddenOn: 'data.multiple' hiddenOn: 'data.multiple'
}), }),
getSchemaTpl('switch', {
label: tipedLabel('显示层级展开线', '显示树层级展开线'),
name: 'showOutline'
}),
getSchemaTpl('switch', { getSchemaTpl('switch', {
name: 'withChildren', name: 'withChildren',
label: '数值是否携带子节点', label: '数值是否携带子节点',

View File

@ -12,17 +12,18 @@ export class TreeSelectControlPlugin extends BasePlugin {
$schema = '/schemas/TreeSelectControlSchema.json'; $schema = '/schemas/TreeSelectControlSchema.json';
// 组件名称 // 组件名称
name = '树下拉框'; name = '树选择框';
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-chevron-down'; disabledRendererPlugin = true;
icon = 'fa fa-list-alt';
pluginIcon = 'tree-select-plugin'; pluginIcon = 'tree-select-plugin';
description = '点击输入框,弹出树型选择框进行选择'; description = '树型结构选择,支持 [内嵌模式] 与 [浮层模式] 的外观切换';
docLink = '/amis/zh-CN/components/form/treeselect'; docLink = '/amis/zh-CN/components/form/treeselect';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {
type: 'tree-select', type: 'tree-select',
label: '树下拉框', label: '树下拉框',
name: 'tree-select', name: 'tree',
clearable: false, clearable: false,
options: [ options: [
{ {
@ -58,7 +59,7 @@ export class TreeSelectControlPlugin extends BasePlugin {
notRenderFormZone = true; notRenderFormZone = true;
panelTitle = '树下拉'; panelTitle = '树选择';
// 事件定义 // 事件定义
events: RendererPluginEvent[] = [ events: RendererPluginEvent[] = [
@ -265,16 +266,34 @@ export class TreeSelectControlPlugin extends BasePlugin {
required: true required: true
}), }),
getSchemaTpl('label'), getSchemaTpl('label'),
{
type: 'button-group-select',
name: 'type',
label: '模式',
pipeIn: defaultValue('tree-select'),
options: [
{
label: '内嵌',
value: 'input-tree'
},
{
label: '浮层',
value: 'tree-select'
}
]
},
getSchemaTpl('clearable', { getSchemaTpl('clearable', {
mode: 'horizontal', mode: 'horizontal',
horizontal: { horizontal: {
justify: true, justify: true,
left: 8 left: 8
}, },
inputClassName: 'is-inline ' inputClassName: 'is-inline ',
visibleOn: 'data.type === "tree-select"'
}),
getSchemaTpl('searchable', {
visibleOn: 'data.type === "tree-select"'
}), }),
getSchemaTpl('searchable'),
getSchemaTpl('multiple', { getSchemaTpl('multiple', {
body: [ body: [
{ {
@ -397,6 +416,12 @@ export class TreeSelectControlPlugin extends BasePlugin {
{ {
title: '高级', title: '高级',
body: [ body: [
getSchemaTpl('valueFormula', {
name: 'highlightTxt',
label: '高亮节点字符',
type: 'input-text',
visibleOn: 'data.type === "input-tree"'
}),
{ {
type: 'ae-Switch-More', type: 'ae-Switch-More',
mode: 'normal', mode: 'normal',
@ -418,34 +443,35 @@ export class TreeSelectControlPlugin extends BasePlugin {
] ]
} }
}, },
{
type: 'ae-Switch-More',
mode: 'normal',
name: 'hideRoot',
label: '显示顶级节点',
value: true,
trueValue: false,
falseValue: true,
formType: 'extend',
form: {
body: [
{
type: 'input-text',
label: '节点文案',
value: '顶级',
name: 'rootLabel'
}
]
},
visibleOn: 'data.type === "input-tree"'
},
getSchemaTpl('switch', { getSchemaTpl('switch', {
label: tipedLabel( label: tipedLabel(
'选项文本仅显示选中节点', '选项文本仅显示选中节点',
'隐藏选择框中已选中节点的祖先节点的文本信息' '隐藏选择框中已选中节点的祖先节点的文本信息'
), ),
name: 'hideNodePathLabel' name: 'hideNodePathLabel',
visibleOn: 'data.type==="tree-select"'
}), }),
// tree-select 该组件目前无此配置
// {
// type: 'ae-Switch-More',
// mode: 'normal',
// name: 'hideRoot',
// label: '显示顶级节点',
// value: true,
// trueValue: false,
// falseValue: true,
// formType: 'extend',
// form: {
// body: [
// {
// type: 'input-text',
// label: '节点文案',
// value: '顶级',
// name: 'rootLabel'
// }
// ]
// }
// },
getSchemaTpl('switch', { getSchemaTpl('switch', {
label: '显示节点图标', label: '显示节点图标',
name: 'showIcon', name: 'showIcon',
@ -463,6 +489,19 @@ export class TreeSelectControlPlugin extends BasePlugin {
label: tipedLabel('显示层级展开线', '显示树层级展开线'), label: tipedLabel('显示层级展开线', '显示树层级展开线'),
name: 'showOutline' name: 'showOutline'
}), }),
getSchemaTpl('switch', {
name: 'withChildren',
label: '数值是否携带子节点',
visibleOn: 'data.cascade !== true && data.multiple',
disabledOn: 'data.onlyChildren'
}),
getSchemaTpl('switch', {
name: 'onlyChildren',
label: '数值是否只包含子节点',
visibleOn: 'data.cascade !== true && data.multiple',
disabledOn: 'data.withChildren'
}),
{ {
type: 'ae-Switch-More', type: 'ae-Switch-More',
mode: 'normal', mode: 'normal',
@ -505,7 +544,7 @@ export class TreeSelectControlPlugin extends BasePlugin {
getSchemaTpl('style:classNames', { getSchemaTpl('style:classNames', {
schema: [ schema: [
getSchemaTpl('className', { getSchemaTpl('className', {
label: 'tree容器', label: '外层容器',
name: 'treeContainerClassName' name: 'treeContainerClassName'
}) })
] ]