mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 20:18:03 +08:00
Merge pull request #268 from catchonme/master
tree选项disabled时不允许添加编辑和删除
This commit is contained in:
commit
f8de41825c
@ -26,6 +26,7 @@ amis 页面是通过 JSON 配置出来的,是由一个一个渲染模型组成
|
||||
- [Email](./renderers/Form/Email.md): Email 输入框
|
||||
- [Password](./renderers/Form/Password.md): 密码输入框
|
||||
- [Number](./renderers/Form/Number.md): 数字输入框
|
||||
- [Tag](./renderers/Form/Tag.md): 标签输入框
|
||||
- [Select](./renderers/Form/Select.md): 选项表单
|
||||
- [Chained-Select](./renderers/Form/Chained-Select.md): 无限级别下拉
|
||||
- [Checkbox](./renderers/Form/Checkbox.md): 勾选框
|
||||
|
43
docs/renderers/Form/Tag.md
Normal file
43
docs/renderers/Form/Tag.md
Normal file
@ -0,0 +1,43 @@
|
||||
### Tag
|
||||
|
||||
标签输入框。
|
||||
|
||||
- `type` 请设置成 `tag`
|
||||
- `clearable` 在有值的时候是否显示一个删除图标在右侧。
|
||||
- `resetValue` 默认为 `""`, 删除后设置此配置项给定的值。
|
||||
- `optionsTip` 选项提示,默认为 `最近您使用的标签`
|
||||
- `options` 选项配置,类型为数组,成员格式如下,或者直接为字符串,配置后用户输入内容时会作为选项提示辅助输入
|
||||
- `label` 文字
|
||||
- `value` 值
|
||||
- `source` 通过 `options` 只能配置静态数据,如果设置了 `source` 则会从接口拉取,实现动态效果。
|
||||
- `joinValues` 默认为 `true`
|
||||
- 单选模式:当用户选中某个选项时,选项中的 value 将被作为该表单项的值提交,否则,整个选项对象都会作为该表单项的值提交。
|
||||
- 多选模式:选中的多个选项的 `value` 会通过 `delimiter` 连接起来,否则直接将以数组的形式提交值。
|
||||
- `delimiter` 默认为 `,`
|
||||
- `extractValue` 默认为 `false`, `joinValues`设置为`false`时生效, 开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。
|
||||
- **还有更多通用配置请参考** [FormItem](./FormItem.md)
|
||||
|
||||
```schema:height="200" scope="form-item"
|
||||
{
|
||||
"type": "tag",
|
||||
"name": "tag",
|
||||
"label": "标签"
|
||||
}
|
||||
```
|
||||
|
||||
带提示功能
|
||||
|
||||
```schema:height="240" scope="form-item"
|
||||
{
|
||||
"type": "tag",
|
||||
"name": "tag",
|
||||
"label": "标签",
|
||||
"clearable": true,
|
||||
"options": [
|
||||
"wangzhaojun",
|
||||
"libai",
|
||||
"luna",
|
||||
"zhongkui"
|
||||
]
|
||||
}
|
||||
```
|
@ -189,6 +189,13 @@ export default {
|
||||
cb(null, makeMarkdownRenderer(doc));
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: 'Tag',
|
||||
path: '/docs/renderers/Form/Tag',
|
||||
getComponent: (location, cb) => require(['../../docs/renderers/Form/Tag.md'], (doc) => {
|
||||
cb(null, makeMarkdownRenderer(doc));
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: 'Select',
|
||||
path: '/docs/renderers/Form/Select',
|
||||
|
@ -60,6 +60,17 @@ export default {
|
||||
{
|
||||
type: "divider"
|
||||
},
|
||||
{
|
||||
type: "tag",
|
||||
name: "tag",
|
||||
label: "标签",
|
||||
placeholder: '',
|
||||
clearable: true,
|
||||
options: ["lixiaolong", "zhouxingxing", "yipingpei", "liyuanfang"]
|
||||
},
|
||||
{
|
||||
type: "divider"
|
||||
},
|
||||
{
|
||||
type: "text",
|
||||
name: "placeholder",
|
||||
|
@ -556,7 +556,8 @@ export class TreeSelector extends React.Component<TreeSelectorProps, TreeSelecto
|
||||
>
|
||||
{highlightTxt ? highlight(item[nameField], highlightTxt) : item[nameField]}
|
||||
</span>
|
||||
{!addTop
|
||||
{!nodeDisabled
|
||||
&& !addTop
|
||||
&& !addItem
|
||||
&& !editItem ? (
|
||||
<span className={cx('Tree-item-icons')}>
|
||||
|
Loading…
Reference in New Issue
Block a user