amis-editor 4.1.0-beta.4 → 4.2.0-beta.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/component/Breadcrumb.d.ts +23 -2
- package/dist/component/ClassNameControl.d.ts +1 -1
- package/dist/component/Control/APIControl.d.ts +2 -2
- package/dist/component/Control/OptionControl.d.ts +3 -3
- package/dist/component/Control/PopoverEdit.d.ts +4 -4
- package/dist/component/Control/ValidationControl.d.ts +1 -1
- package/dist/component/Editor.d.ts +20 -1
- package/dist/component/IFramePreview.d.ts +2 -1
- package/dist/component/NodeWrapper.d.ts +1 -1
- package/dist/component/Panel/RenderersPanel.d.ts +1 -2
- package/dist/component/Preview.d.ts +3 -1
- package/dist/component/RegionWrapper.d.ts +4 -0
- package/dist/component/ScaffoldModal.d.ts +1 -1
- package/dist/component/VRenderer.d.ts +4 -0
- package/dist/component/base/InputComponentName.d.ts +1 -1
- package/dist/component/base/SearchCustomRendererPanel.d.ts +15 -0
- package/dist/component/base/SearchPanel.d.ts +83 -0
- package/dist/component/base/SearchRendererPanel.d.ts +2 -42
- package/dist/component/base/ShortcutKey.d.ts +23 -0
- package/dist/env.d.ts +1 -1
- package/dist/exports.min.js +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.min.js +1 -1
- package/dist/manager.d.ts +16 -4
- package/dist/plugin/Alert.d.ts +1 -1
- package/dist/plugin/Button.d.ts +1 -1
- package/dist/plugin/Card.d.ts +1 -0
- package/dist/plugin/Cards.d.ts +2 -1
- package/dist/plugin/Carousel.d.ts +1 -0
- package/dist/plugin/Chart.d.ts +1 -0
- package/dist/plugin/Collapse.d.ts +1 -0
- package/dist/plugin/Custom.d.ts +3 -0
- package/dist/plugin/CustomRegion.d.ts +40 -0
- package/dist/plugin/Dialog.d.ts +1 -1
- package/dist/plugin/Drawer.d.ts +1 -1
- package/dist/plugin/DropDownButton.d.ts +1 -1
- package/dist/plugin/Each.d.ts +1 -1
- package/dist/plugin/Flex.d.ts +1 -0
- package/dist/plugin/Form/Control.d.ts +1 -0
- package/dist/plugin/Form/Form.d.ts +19 -3
- package/dist/plugin/Form/Formula.d.ts +3 -3
- package/dist/plugin/Form/InputURL.d.ts +1 -0
- package/dist/plugin/Form/Switch.d.ts +2 -0
- package/dist/plugin/Grid.d.ts +1 -0
- package/dist/plugin/HBox.d.ts +1 -0
- package/dist/plugin/IFrame.d.ts +3 -3
- package/dist/plugin/Json.d.ts +1 -0
- package/dist/plugin/List.d.ts +2 -1
- package/dist/plugin/Mapping.d.ts +1 -0
- package/dist/plugin/Markdown.d.ts +1 -0
- package/dist/plugin/Nav.d.ts +1 -0
- package/dist/plugin/Page.d.ts +1 -1
- package/dist/plugin/Panel/Outline.d.ts +8 -0
- package/dist/plugin/Progress.d.ts +1 -0
- package/dist/plugin/QRCode.d.ts +1 -0
- package/dist/plugin/Reset.d.ts +0 -1
- package/dist/plugin/Service.d.ts +1 -0
- package/dist/plugin/Sparkline.d.ts +1 -0
- package/dist/plugin/Status.d.ts +1 -0
- package/dist/plugin/Steps.d.ts +1 -0
- package/dist/plugin/Submit.d.ts +0 -1
- package/dist/plugin/Table.d.ts +1 -1
- package/dist/plugin/TableView.d.ts +1 -0
- package/dist/plugin/Tasks.d.ts +1 -0
- package/dist/plugin/TooltipWrapper.d.ts +1 -0
- package/dist/plugin/Video.d.ts +1 -0
- package/dist/plugin/WebComponent.d.ts +1 -0
- package/dist/plugin/Wizard.d.ts +11 -2
- package/dist/plugin/Wrapper.d.ts +1 -0
- package/dist/plugin.d.ts +8 -7
- package/dist/store/editor.d.ts +58 -22
- package/dist/store/node.d.ts +6 -0
- package/dist/style.css +1 -1
- package/dist/util.d.ts +1 -1
- package/package.json +9 -3
- package/src/component/schemaTpl.tsx +2157 -0
- package/src/plugin/Alert.tsx +87 -0
- package/src/plugin/AnchorNav.tsx +233 -0
- package/src/plugin/Audio.tsx +154 -0
- package/src/plugin/Avatar.tsx +77 -0
- package/src/plugin/Breadcrumb.tsx +107 -0
- package/src/plugin/Button.tsx +281 -0
- package/src/plugin/ButtonGroup.tsx +85 -0
- package/src/plugin/ButtonToolbar.tsx +87 -0
- package/src/plugin/CRUD.tsx +1835 -0
- package/src/plugin/Card.tsx +290 -0
- package/src/plugin/Cards.tsx +318 -0
- package/src/plugin/Carousel.tsx +377 -0
- package/src/plugin/Chart.tsx +218 -0
- package/src/plugin/CodeView.tsx +60 -0
- package/src/plugin/Collapse.tsx +136 -0
- package/src/plugin/CollapseGroup.tsx +167 -0
- package/src/plugin/Container.tsx +40 -0
- package/src/plugin/Custom.tsx +128 -0
- package/src/plugin/CustomRegion.tsx +156 -0
- package/src/plugin/Date.tsx +74 -0
- package/src/plugin/Datetime.tsx +68 -0
- package/src/plugin/Dialog.tsx +176 -0
- package/src/plugin/Divider.tsx +36 -0
- package/src/plugin/Drawer.tsx +214 -0
- package/src/plugin/DropDownButton.tsx +235 -0
- package/src/plugin/Each.tsx +150 -0
- package/src/plugin/ErrorRenderer.tsx +15 -0
- package/src/plugin/Flex.tsx +151 -0
- package/src/plugin/Form/ButtonGroupSelect.tsx +75 -0
- package/src/plugin/Form/ButtonToolbar.tsx +110 -0
- package/src/plugin/Form/ChainedSelect.tsx +70 -0
- package/src/plugin/Form/Checkbox.tsx +87 -0
- package/src/plugin/Form/Checkboxes.tsx +167 -0
- package/src/plugin/Form/CodeEditor.tsx +81 -0
- package/src/plugin/Form/Combo.tsx +582 -0
- package/src/plugin/Form/ConditionBuilder.tsx +315 -0
- package/src/plugin/Form/Control.tsx +139 -0
- package/src/plugin/Form/DiffEditor.tsx +111 -0
- package/src/plugin/Form/FieldSet.tsx +163 -0
- package/src/plugin/Form/Form.tsx +687 -0
- package/src/plugin/Form/Formula.tsx +79 -0
- package/src/plugin/Form/Group.tsx +295 -0
- package/src/plugin/Form/Hidden.tsx +44 -0
- package/src/plugin/Form/InputArray.tsx +228 -0
- package/src/plugin/Form/InputCity.tsx +93 -0
- package/src/plugin/Form/InputColor.tsx +123 -0
- package/src/plugin/Form/InputDate.tsx +175 -0
- package/src/plugin/Form/InputDateRange.tsx +225 -0
- package/src/plugin/Form/InputDateTime.tsx +183 -0
- package/src/plugin/Form/InputDateTimeRange.tsx +221 -0
- package/src/plugin/Form/InputEmail.tsx +33 -0
- package/src/plugin/Form/InputExcel.tsx +85 -0
- package/src/plugin/Form/InputFile.tsx +221 -0
- package/src/plugin/Form/InputGroup.tsx +96 -0
- package/src/plugin/Form/InputImage.tsx +266 -0
- package/src/plugin/Form/InputKV.tsx +72 -0
- package/src/plugin/Form/InputMonth.tsx +35 -0
- package/src/plugin/Form/InputMonthRange.tsx +195 -0
- package/src/plugin/Form/InputNumber.tsx +89 -0
- package/src/plugin/Form/InputPassword.tsx +33 -0
- package/src/plugin/Form/InputQuarter.tsx +35 -0
- package/src/plugin/Form/InputQuarterRange.tsx +195 -0
- package/src/plugin/Form/InputRange.tsx +121 -0
- package/src/plugin/Form/InputRating.tsx +78 -0
- package/src/plugin/Form/InputRepeat.tsx +57 -0
- package/src/plugin/Form/InputRichText.tsx +186 -0
- package/src/plugin/Form/InputSubForm.tsx +189 -0
- package/src/plugin/Form/InputTable.tsx +434 -0
- package/src/plugin/Form/InputTag.tsx +70 -0
- package/src/plugin/Form/InputText.tsx +186 -0
- package/src/plugin/Form/InputTime.tsx +85 -0
- package/src/plugin/Form/InputTree.tsx +229 -0
- package/src/plugin/Form/InputURL.tsx +34 -0
- package/src/plugin/Form/InputYear.tsx +35 -0
- package/src/plugin/Form/Item.tsx +327 -0
- package/src/plugin/Form/ListSelect.tsx +73 -0
- package/src/plugin/Form/LocationPicker.tsx +62 -0
- package/src/plugin/Form/MatrixCheckboxes.tsx +136 -0
- package/src/plugin/Form/NestedSelect.tsx +211 -0
- package/src/plugin/Form/Picker.tsx +209 -0
- package/src/plugin/Form/Radios.tsx +119 -0
- package/src/plugin/Form/Select.tsx +233 -0
- package/src/plugin/Form/Static.tsx +322 -0
- package/src/plugin/Form/Switch.tsx +107 -0
- package/src/plugin/Form/TabsTransfer.tsx +259 -0
- package/src/plugin/Form/Textarea.tsx +83 -0
- package/src/plugin/Form/Transfer.tsx +368 -0
- package/src/plugin/Form/TreeSelect.tsx +263 -0
- package/src/plugin/Form/UUID.tsx +48 -0
- package/src/plugin/Grid.tsx +798 -0
- package/src/plugin/HBox.tsx +727 -0
- package/src/plugin/IFrame.tsx +70 -0
- package/src/plugin/Image.tsx +314 -0
- package/src/plugin/Images.tsx +231 -0
- package/src/plugin/Json.tsx +69 -0
- package/src/plugin/Link.tsx +93 -0
- package/src/plugin/List.tsx +278 -0
- package/src/plugin/ListItem.tsx +229 -0
- package/src/plugin/Log.tsx +52 -0
- package/src/plugin/Mapping.tsx +149 -0
- package/src/plugin/Markdown.tsx +47 -0
- package/src/plugin/Nav.tsx +184 -0
- package/src/plugin/Operation.tsx +95 -0
- package/src/plugin/Others/Action.tsx +426 -0
- package/src/plugin/Others/BasicToolbar.tsx +585 -0
- package/src/plugin/Others/DataDebug.tsx +134 -0
- package/src/plugin/Others/TableCell.tsx +480 -0
- package/src/plugin/Others/Unknown.tsx +37 -0
- package/src/plugin/Page.tsx +306 -0
- package/src/plugin/Panel/AvailableRenderers.tsx +41 -0
- package/src/plugin/Panel/Code.tsx +44 -0
- package/src/plugin/Panel/Name.tsx +26 -0
- package/src/plugin/Panel/Outline.tsx +40 -0
- package/src/plugin/Panel.tsx +243 -0
- package/src/plugin/Plain.tsx +84 -0
- package/src/plugin/Progress.tsx +125 -0
- package/src/plugin/Property.tsx +139 -0
- package/src/plugin/QRCode.tsx +96 -0
- package/src/plugin/Reset.tsx +23 -0
- package/src/plugin/Service.tsx +162 -0
- package/src/plugin/Sparkline.tsx +40 -0
- package/src/plugin/Status.tsx +76 -0
- package/src/plugin/Steps.tsx +128 -0
- package/src/plugin/Submit.tsx +23 -0
- package/src/plugin/Table.tsx +428 -0
- package/src/plugin/TableView.tsx +709 -0
- package/src/plugin/Tabs.tsx +362 -0
- package/src/plugin/Tasks.tsx +274 -0
- package/src/plugin/Time.tsx +68 -0
- package/src/plugin/TooltipWrapper.tsx +193 -0
- package/src/plugin/Tpl.tsx +158 -0
- package/src/plugin/Video.tsx +158 -0
- package/src/plugin/WebComponent.tsx +53 -0
- package/src/plugin/Wizard.tsx +740 -0
- package/src/plugin/Wrapper.tsx +107 -0
- package/src/plugin.ts +1050 -0
- package/dist/150a58f3318ca7541ed9.png +0 -0
- package/dist/471adb97c322b226e589.png +0 -0
- package/dist/4de5f42360bc5946c3c2.png +0 -0
- package/dist/4e9968bba3855f088fed.png +0 -0
- package/dist/7f09c38ebc687fea847a.png +0 -0
- package/dist/c94073576487510314ea.png +0 -0
@@ -0,0 +1,73 @@
|
|
1
|
+
import {getSchemaTpl} from '../../component/schemaTpl';
|
2
|
+
import {registerEditorPlugin} from '../../manager';
|
3
|
+
import {BasePlugin} from '../../plugin';
|
4
|
+
|
5
|
+
export class ListControlPlugin extends BasePlugin {
|
6
|
+
// 关联渲染器名字
|
7
|
+
rendererName = 'list-select';
|
8
|
+
$schema = '/schemas/ListControlSchema.json';
|
9
|
+
|
10
|
+
order = -430;
|
11
|
+
|
12
|
+
// 组件名称
|
13
|
+
name = '列表选择';
|
14
|
+
isBaseComponent = true;
|
15
|
+
icon = 'fa fa-ellipsis-h';
|
16
|
+
description = `单选或者多选,支持<code>source</code>拉取选项,选项可配置图片,也可以自定义<code>HTML</code>配置`;
|
17
|
+
docLink = '/amis/zh-CN/components/form/list-select';
|
18
|
+
tags = ['表单项'];
|
19
|
+
scaffold = {
|
20
|
+
type: 'list-select',
|
21
|
+
label: '列表',
|
22
|
+
name: 'list',
|
23
|
+
options: [
|
24
|
+
{
|
25
|
+
label: '选项A',
|
26
|
+
value: 'A'
|
27
|
+
},
|
28
|
+
|
29
|
+
{
|
30
|
+
label: '选项B',
|
31
|
+
value: 'B'
|
32
|
+
}
|
33
|
+
]
|
34
|
+
};
|
35
|
+
previewSchema: any = {
|
36
|
+
type: 'form',
|
37
|
+
className: 'text-left',
|
38
|
+
mode: 'horizontal',
|
39
|
+
wrapWithPanel: false,
|
40
|
+
body: [
|
41
|
+
{
|
42
|
+
...this.scaffold,
|
43
|
+
value: 'A'
|
44
|
+
}
|
45
|
+
]
|
46
|
+
};
|
47
|
+
|
48
|
+
panelTitle = '列表选择';
|
49
|
+
panelBody = [
|
50
|
+
getSchemaTpl('switchDefaultValue'),
|
51
|
+
{
|
52
|
+
type: 'list-select',
|
53
|
+
name: 'value',
|
54
|
+
label: '默认值',
|
55
|
+
description: '请填入选项 Options 中 value 值',
|
56
|
+
source: '${options}',
|
57
|
+
visibleOn: 'typeof this.value !== "undefined"'
|
58
|
+
},
|
59
|
+
getSchemaTpl('fieldSet', {
|
60
|
+
title: '选项',
|
61
|
+
body: [
|
62
|
+
getSchemaTpl('multiple'),
|
63
|
+
getSchemaTpl('joinValues'),
|
64
|
+
getSchemaTpl('delimiter'),
|
65
|
+
getSchemaTpl('extractValue'),
|
66
|
+
getSchemaTpl('options'),
|
67
|
+
getSchemaTpl('source')
|
68
|
+
]
|
69
|
+
})
|
70
|
+
];
|
71
|
+
}
|
72
|
+
|
73
|
+
registerEditorPlugin(ListControlPlugin);
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import {registerEditorPlugin} from '../../manager';
|
2
|
+
import {BasePlugin} from '../../plugin';
|
3
|
+
|
4
|
+
export class LocationControlPlugin extends BasePlugin {
|
5
|
+
// 关联渲染器名字
|
6
|
+
rendererName = 'location-picker';
|
7
|
+
$schema = '/schemas/LocationControlSchema.json';
|
8
|
+
|
9
|
+
// 组件名称
|
10
|
+
name = '地理位置选择';
|
11
|
+
isBaseComponent = true;
|
12
|
+
icon = 'fa fa-location-arrow';
|
13
|
+
description = `地理位置选择`;
|
14
|
+
docLink = '/amis/zh-CN/components/form/location-picker';
|
15
|
+
tags = ['表单项'];
|
16
|
+
scaffold = {
|
17
|
+
type: 'location-picker',
|
18
|
+
name: 'location'
|
19
|
+
};
|
20
|
+
|
21
|
+
previewSchema: any = {
|
22
|
+
type: 'form',
|
23
|
+
className: 'text-left',
|
24
|
+
mode: 'horizontal',
|
25
|
+
wrapWithPanel: false,
|
26
|
+
body: [
|
27
|
+
{
|
28
|
+
...this.scaffold
|
29
|
+
}
|
30
|
+
]
|
31
|
+
};
|
32
|
+
|
33
|
+
panelTitle = '地理位置选择';
|
34
|
+
panelBody = [
|
35
|
+
{
|
36
|
+
name: 'clearable',
|
37
|
+
label: '是否可清除',
|
38
|
+
type: 'switch',
|
39
|
+
mode: 'inline',
|
40
|
+
className: 'block'
|
41
|
+
},
|
42
|
+
{
|
43
|
+
type: 'input-text',
|
44
|
+
name: 'ak',
|
45
|
+
label: '百度地图的 AK',
|
46
|
+
description:
|
47
|
+
'请从<a href="http://lbsyun.baidu.com/" target="_blank">百度地图开放平台</a>获取'
|
48
|
+
},
|
49
|
+
{
|
50
|
+
type: 'select',
|
51
|
+
name: 'coordinatesType',
|
52
|
+
label: '坐标格式',
|
53
|
+
value: 'bd09',
|
54
|
+
options: [
|
55
|
+
{label: '百度坐标', value: 'bd09'},
|
56
|
+
{label: '国测局坐标', value: 'gcj02'}
|
57
|
+
]
|
58
|
+
}
|
59
|
+
];
|
60
|
+
}
|
61
|
+
|
62
|
+
registerEditorPlugin(LocationControlPlugin);
|
@@ -0,0 +1,136 @@
|
|
1
|
+
import {defaultValue, getSchemaTpl} from '../../component/schemaTpl';
|
2
|
+
import {registerEditorPlugin} from '../../manager';
|
3
|
+
import {BasePlugin} from '../../plugin';
|
4
|
+
|
5
|
+
export class MatrixControlPlugin extends BasePlugin {
|
6
|
+
// 关联渲染器名字
|
7
|
+
rendererName = 'matrix-checkboxes';
|
8
|
+
$schema = '/schemas/MatrixControlSchema.json';
|
9
|
+
|
10
|
+
// 组件名称
|
11
|
+
name = '矩阵开关';
|
12
|
+
isBaseComponent = true;
|
13
|
+
icon = 'fa fa-th-large';
|
14
|
+
description = `可配置行单选,列单选,以及全部选项只能单选或者全部选项多选`;
|
15
|
+
docLink = '/amis/zh-CN/components/form/matrix-checkboxes';
|
16
|
+
tags = ['表单项'];
|
17
|
+
scaffold = {
|
18
|
+
type: 'matrix-checkboxes',
|
19
|
+
name: 'matrix',
|
20
|
+
label: '矩阵开关',
|
21
|
+
rowLabel: '行标题说明',
|
22
|
+
columns: [
|
23
|
+
{
|
24
|
+
label: '列1'
|
25
|
+
},
|
26
|
+
{
|
27
|
+
label: '列2'
|
28
|
+
}
|
29
|
+
],
|
30
|
+
rows: [
|
31
|
+
{
|
32
|
+
label: '行1'
|
33
|
+
},
|
34
|
+
{
|
35
|
+
label: '行2'
|
36
|
+
}
|
37
|
+
]
|
38
|
+
};
|
39
|
+
previewSchema: any = {
|
40
|
+
type: 'form',
|
41
|
+
className: 'text-left',
|
42
|
+
mode: 'horizontal',
|
43
|
+
wrapWithPanel: false,
|
44
|
+
body: [
|
45
|
+
{
|
46
|
+
...this.scaffold
|
47
|
+
}
|
48
|
+
]
|
49
|
+
};
|
50
|
+
|
51
|
+
panelTitle = '矩阵开关';
|
52
|
+
panelBody = [
|
53
|
+
getSchemaTpl('api', {
|
54
|
+
name: 'source',
|
55
|
+
label: '获取矩阵数据接口'
|
56
|
+
}),
|
57
|
+
getSchemaTpl('multiple', {
|
58
|
+
value: true
|
59
|
+
}),
|
60
|
+
{
|
61
|
+
type: 'button-group-select',
|
62
|
+
name: 'singleSelectMode',
|
63
|
+
label: '单选模式',
|
64
|
+
description: '行级、列级或者单个单元单选',
|
65
|
+
size: 'xs',
|
66
|
+
mode: 'inline',
|
67
|
+
className: 'w-full',
|
68
|
+
visibleOn: '!this.multiple',
|
69
|
+
options: [
|
70
|
+
{
|
71
|
+
label: '行级',
|
72
|
+
value: 'row'
|
73
|
+
},
|
74
|
+
|
75
|
+
{
|
76
|
+
label: '列级',
|
77
|
+
value: 'column'
|
78
|
+
},
|
79
|
+
|
80
|
+
{
|
81
|
+
label: '单个单元',
|
82
|
+
value: 'cell'
|
83
|
+
}
|
84
|
+
],
|
85
|
+
pipeIn: defaultValue('column')
|
86
|
+
},
|
87
|
+
getSchemaTpl('fieldSet', {
|
88
|
+
title: '矩阵配置',
|
89
|
+
body: [
|
90
|
+
{
|
91
|
+
label: '列配置',
|
92
|
+
name: 'columns',
|
93
|
+
type: 'combo',
|
94
|
+
multiple: true,
|
95
|
+
addButtonText: '添加一列',
|
96
|
+
scaffold: {
|
97
|
+
label: '列说明'
|
98
|
+
},
|
99
|
+
items: [
|
100
|
+
{
|
101
|
+
type: 'input-text',
|
102
|
+
name: 'label',
|
103
|
+
placeholder: '列说明'
|
104
|
+
}
|
105
|
+
]
|
106
|
+
},
|
107
|
+
|
108
|
+
{
|
109
|
+
name: 'rowLabel',
|
110
|
+
label: '行标题文字',
|
111
|
+
type: 'input-text'
|
112
|
+
},
|
113
|
+
|
114
|
+
{
|
115
|
+
label: '行配置',
|
116
|
+
name: 'rows',
|
117
|
+
type: 'combo',
|
118
|
+
multiple: true,
|
119
|
+
scaffold: {
|
120
|
+
label: '行说明'
|
121
|
+
},
|
122
|
+
addButtonText: '添加一行',
|
123
|
+
items: [
|
124
|
+
{
|
125
|
+
type: 'input-text',
|
126
|
+
name: 'label',
|
127
|
+
placeholder: '行说明'
|
128
|
+
}
|
129
|
+
]
|
130
|
+
}
|
131
|
+
]
|
132
|
+
})
|
133
|
+
];
|
134
|
+
}
|
135
|
+
|
136
|
+
registerEditorPlugin(MatrixControlPlugin);
|
@@ -0,0 +1,211 @@
|
|
1
|
+
import {getSchemaTpl} from '../../component/schemaTpl';
|
2
|
+
import {registerEditorPlugin} from '../../manager';
|
3
|
+
import {BasePlugin} from '../../plugin';
|
4
|
+
|
5
|
+
export class NestedSelectControlPlugin extends BasePlugin {
|
6
|
+
// 关联渲染器名字
|
7
|
+
rendererName = 'nested-select';
|
8
|
+
$schema = '/schemas/NestedSelectControlSchema.json';
|
9
|
+
|
10
|
+
// 组件名称
|
11
|
+
name = '嵌套下拉框';
|
12
|
+
isBaseComponent = true;
|
13
|
+
icon = 'fa fa-indent';
|
14
|
+
description = `适用于选项中含有子项,可通过<code>source</code>拉取选项,支持多选`;
|
15
|
+
docLink = '/amis/zh-CN/components/form/nestedselect';
|
16
|
+
tags = ['表单项'];
|
17
|
+
scaffold = {
|
18
|
+
type: 'nested-select',
|
19
|
+
label: '嵌套下拉框',
|
20
|
+
name: 'nestedSelect',
|
21
|
+
options: [
|
22
|
+
{
|
23
|
+
label: '选项A',
|
24
|
+
value: 'A'
|
25
|
+
},
|
26
|
+
|
27
|
+
{
|
28
|
+
label: '选项B',
|
29
|
+
value: 'B',
|
30
|
+
children: [
|
31
|
+
{
|
32
|
+
label: '选项C',
|
33
|
+
value: 'C'
|
34
|
+
},
|
35
|
+
{
|
36
|
+
label: '选项D',
|
37
|
+
value: 'D'
|
38
|
+
}
|
39
|
+
]
|
40
|
+
}
|
41
|
+
]
|
42
|
+
};
|
43
|
+
previewSchema: any = {
|
44
|
+
type: 'form',
|
45
|
+
className: 'text-left',
|
46
|
+
mode: 'horizontal',
|
47
|
+
wrapWithPanel: false,
|
48
|
+
body: [
|
49
|
+
{
|
50
|
+
...this.scaffold
|
51
|
+
}
|
52
|
+
]
|
53
|
+
};
|
54
|
+
|
55
|
+
panelTitle = '嵌套下拉';
|
56
|
+
|
57
|
+
panelDefinitions = {
|
58
|
+
options: {
|
59
|
+
label: '选项 Options',
|
60
|
+
name: 'options',
|
61
|
+
type: 'combo',
|
62
|
+
multiple: true,
|
63
|
+
multiLine: true,
|
64
|
+
draggable: true,
|
65
|
+
addButtonText: '新增选项',
|
66
|
+
scaffold: {
|
67
|
+
label: '',
|
68
|
+
value: ''
|
69
|
+
},
|
70
|
+
items: [
|
71
|
+
{
|
72
|
+
type: 'group',
|
73
|
+
body: [
|
74
|
+
{
|
75
|
+
type: 'input-text',
|
76
|
+
name: 'label',
|
77
|
+
placeholder: '名称',
|
78
|
+
required: true
|
79
|
+
},
|
80
|
+
|
81
|
+
{
|
82
|
+
type: 'input-text',
|
83
|
+
name: 'value',
|
84
|
+
placeholder: '值',
|
85
|
+
unique: true
|
86
|
+
}
|
87
|
+
]
|
88
|
+
},
|
89
|
+
{
|
90
|
+
$ref: 'options',
|
91
|
+
label: '子选项',
|
92
|
+
name: 'children',
|
93
|
+
addButtonText: '新增子选项'
|
94
|
+
}
|
95
|
+
]
|
96
|
+
}
|
97
|
+
};
|
98
|
+
panelBody = [
|
99
|
+
getSchemaTpl('tabs', [
|
100
|
+
{
|
101
|
+
title: '常规',
|
102
|
+
body: [
|
103
|
+
getSchemaTpl('switchDefaultValue'),
|
104
|
+
{
|
105
|
+
type: 'input-text',
|
106
|
+
name: 'value',
|
107
|
+
label: '默认值',
|
108
|
+
visibleOn: 'typeof this.value !== "undefined"'
|
109
|
+
},
|
110
|
+
|
111
|
+
getSchemaTpl('clearable'),
|
112
|
+
|
113
|
+
{
|
114
|
+
type: 'switch',
|
115
|
+
name: 'searchable',
|
116
|
+
label: '可否检索',
|
117
|
+
mode: 'inline',
|
118
|
+
className: 'w-full'
|
119
|
+
},
|
120
|
+
{
|
121
|
+
type: 'input-text',
|
122
|
+
name: 'searchPromptText',
|
123
|
+
label: '搜索框占位文本'
|
124
|
+
},
|
125
|
+
{
|
126
|
+
type: 'input-text',
|
127
|
+
name: 'noResultsText',
|
128
|
+
label: '无结果时的文本'
|
129
|
+
},
|
130
|
+
{
|
131
|
+
type: 'switch',
|
132
|
+
name: 'hideNodePathLabel',
|
133
|
+
label: '隐藏选中节点的祖先节点文本信息',
|
134
|
+
mode: 'inline',
|
135
|
+
className: 'w-full'
|
136
|
+
},
|
137
|
+
{
|
138
|
+
type: 'switch',
|
139
|
+
name: 'enableNodePath',
|
140
|
+
label: '节点路径模式',
|
141
|
+
mode: 'inline',
|
142
|
+
className: 'w-full'
|
143
|
+
},
|
144
|
+
{
|
145
|
+
type: 'switch',
|
146
|
+
name: 'onlyChildren',
|
147
|
+
label: '选中父节点时只使用子节点的值',
|
148
|
+
mode: 'inline',
|
149
|
+
className: 'w-full'
|
150
|
+
},
|
151
|
+
{
|
152
|
+
type: 'input-text',
|
153
|
+
name: 'pathSeparator',
|
154
|
+
visibleOn: 'this.enableNodePath',
|
155
|
+
label: '节点路径的分隔符'
|
156
|
+
},
|
157
|
+
getSchemaTpl('borderMode'),
|
158
|
+
getSchemaTpl('fieldSet', {
|
159
|
+
title: '选项',
|
160
|
+
body: [
|
161
|
+
{
|
162
|
+
$ref: 'options',
|
163
|
+
name: 'options'
|
164
|
+
},
|
165
|
+
getSchemaTpl('api', {
|
166
|
+
name: 'source',
|
167
|
+
label: '获取选项接口'
|
168
|
+
}),
|
169
|
+
getSchemaTpl('multiple'),
|
170
|
+
|
171
|
+
{
|
172
|
+
name: 'cascade',
|
173
|
+
visibleOn: 'data.multiple',
|
174
|
+
label: '不自动选中子节点?',
|
175
|
+
description: '选中父级时,孩子节点是否自动选中',
|
176
|
+
type: 'switch',
|
177
|
+
mode: 'inline',
|
178
|
+
className: 'w-full'
|
179
|
+
},
|
180
|
+
|
181
|
+
{
|
182
|
+
name: 'withChildren',
|
183
|
+
visibleOn: 'data.cascade !== true && data.multiple',
|
184
|
+
label: '数值是否携带子节点',
|
185
|
+
type: 'switch',
|
186
|
+
mode: 'inline',
|
187
|
+
className: 'w-full'
|
188
|
+
},
|
189
|
+
|
190
|
+
getSchemaTpl('joinValues'),
|
191
|
+
getSchemaTpl('delimiter'),
|
192
|
+
getSchemaTpl('extractValue'),
|
193
|
+
getSchemaTpl('autoFill')
|
194
|
+
]
|
195
|
+
})
|
196
|
+
]
|
197
|
+
},
|
198
|
+
{
|
199
|
+
title: '外观',
|
200
|
+
body: [
|
201
|
+
getSchemaTpl('className', {
|
202
|
+
label: '菜单类名',
|
203
|
+
name: 'menuClassName'
|
204
|
+
})
|
205
|
+
]
|
206
|
+
}
|
207
|
+
])
|
208
|
+
];
|
209
|
+
}
|
210
|
+
|
211
|
+
registerEditorPlugin(NestedSelectControlPlugin);
|
@@ -0,0 +1,209 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import {Button} from 'amis';
|
3
|
+
import omit = require('lodash/omit');
|
4
|
+
import {getSchemaTpl} from '../../component/schemaTpl';
|
5
|
+
import {registerEditorPlugin} from '../../manager';
|
6
|
+
import {
|
7
|
+
BaseEventContext,
|
8
|
+
BasePlugin,
|
9
|
+
BasicToolbarItem,
|
10
|
+
ContextMenuEventContext,
|
11
|
+
ContextMenuItem
|
12
|
+
} from '../../plugin';
|
13
|
+
import {diff} from '../../../src/util';
|
14
|
+
|
15
|
+
export class PickerControlPlugin extends BasePlugin {
|
16
|
+
// 关联渲染器名字
|
17
|
+
rendererName = 'picker';
|
18
|
+
$schema = '/schemas/PickerControlSchema.json';
|
19
|
+
|
20
|
+
// 组件名称
|
21
|
+
name = '列表选取';
|
22
|
+
isBaseComponent = true;
|
23
|
+
icon = 'fa fa-window-restore';
|
24
|
+
description = `通过<code>pickerSchema</code>配置可供选取的数据源进行选择需要的数据,支持多选`;
|
25
|
+
docLink = '/amis/zh-CN/components/form/picker';
|
26
|
+
tags = ['表单项'];
|
27
|
+
scaffold = {
|
28
|
+
type: 'picker',
|
29
|
+
label: '列表选取',
|
30
|
+
name: 'picker',
|
31
|
+
options: [
|
32
|
+
{
|
33
|
+
label: '选项A',
|
34
|
+
value: 'A'
|
35
|
+
},
|
36
|
+
|
37
|
+
{
|
38
|
+
label: '选项B',
|
39
|
+
value: 'B'
|
40
|
+
}
|
41
|
+
]
|
42
|
+
};
|
43
|
+
previewSchema: any = {
|
44
|
+
type: 'form',
|
45
|
+
className: 'text-left',
|
46
|
+
mode: 'horizontal',
|
47
|
+
wrapWithPanel: false,
|
48
|
+
body: [
|
49
|
+
{
|
50
|
+
...this.scaffold
|
51
|
+
}
|
52
|
+
]
|
53
|
+
};
|
54
|
+
|
55
|
+
panelTitle = '列表选取';
|
56
|
+
panelBodyCreator = (context: BaseEventContext) => {
|
57
|
+
return [
|
58
|
+
{
|
59
|
+
type: 'switch',
|
60
|
+
name: 'embed',
|
61
|
+
mode: 'inline',
|
62
|
+
className: 'w-full',
|
63
|
+
label: '开启内嵌模式'
|
64
|
+
},
|
65
|
+
|
66
|
+
getSchemaTpl('switchDefaultValue'),
|
67
|
+
|
68
|
+
{
|
69
|
+
type: 'input-text',
|
70
|
+
name: 'value',
|
71
|
+
label: '默认值',
|
72
|
+
visibleOn: 'typeof this.value !== "undefined"'
|
73
|
+
},
|
74
|
+
|
75
|
+
getSchemaTpl('fieldSet', {
|
76
|
+
title: '选项',
|
77
|
+
body: [
|
78
|
+
getSchemaTpl('options'),
|
79
|
+
getSchemaTpl('api', {
|
80
|
+
name: 'source',
|
81
|
+
label: '获取选项接口'
|
82
|
+
}),
|
83
|
+
|
84
|
+
{
|
85
|
+
children: (
|
86
|
+
<Button
|
87
|
+
size="sm"
|
88
|
+
level="danger"
|
89
|
+
className="m-b"
|
90
|
+
onClick={this.editDetail.bind(this, context.id)}
|
91
|
+
block
|
92
|
+
>
|
93
|
+
配置选框详情
|
94
|
+
</Button>
|
95
|
+
)
|
96
|
+
},
|
97
|
+
|
98
|
+
{
|
99
|
+
label: 'labelTpl',
|
100
|
+
type: 'textarea',
|
101
|
+
name: 'labelTpl',
|
102
|
+
labelRemark: '已选定数据的展示样式',
|
103
|
+
description:
|
104
|
+
'支持使用 <code>\\${xxx}</code> 来获取变量,或者用 lodash.template 语法来写模板逻辑。<a target="_blank" href="/amis/zh-CN/docs/concepts/template">详情</a>'
|
105
|
+
},
|
106
|
+
|
107
|
+
{
|
108
|
+
type: 'button-group-select',
|
109
|
+
name: 'modalMode',
|
110
|
+
label: '选框类型',
|
111
|
+
value: 'dialog',
|
112
|
+
size: 'xs',
|
113
|
+
options: [
|
114
|
+
{
|
115
|
+
label: '弹框',
|
116
|
+
value: 'dialog'
|
117
|
+
},
|
118
|
+
|
119
|
+
{
|
120
|
+
label: '抽出式弹框',
|
121
|
+
value: 'drawer'
|
122
|
+
}
|
123
|
+
]
|
124
|
+
},
|
125
|
+
|
126
|
+
getSchemaTpl('multiple'),
|
127
|
+
getSchemaTpl('joinValues'),
|
128
|
+
getSchemaTpl('delimiter'),
|
129
|
+
getSchemaTpl('extractValue'),
|
130
|
+
getSchemaTpl('autoFill')
|
131
|
+
]
|
132
|
+
})
|
133
|
+
];
|
134
|
+
};
|
135
|
+
|
136
|
+
buildEditorToolbar(
|
137
|
+
{id, info}: BaseEventContext,
|
138
|
+
toolbars: Array<BasicToolbarItem>
|
139
|
+
) {
|
140
|
+
if (info.renderer.name === this.rendererName) {
|
141
|
+
toolbars.push({
|
142
|
+
icon: 'fa fa-expand',
|
143
|
+
order: 100,
|
144
|
+
tooltip: '配置选框详情',
|
145
|
+
onClick: this.editDetail.bind(this, id)
|
146
|
+
});
|
147
|
+
}
|
148
|
+
}
|
149
|
+
|
150
|
+
buildEditorContextMenu(
|
151
|
+
{id, schema, region, info}: ContextMenuEventContext,
|
152
|
+
menus: Array<ContextMenuItem>
|
153
|
+
) {
|
154
|
+
if (info.renderer.name === this.rendererName) {
|
155
|
+
menus.push('|', {
|
156
|
+
label: '配置选框详情',
|
157
|
+
onSelect: this.editDetail.bind(this, id)
|
158
|
+
});
|
159
|
+
}
|
160
|
+
}
|
161
|
+
|
162
|
+
editDetail(id: string) {
|
163
|
+
const manager = this.manager;
|
164
|
+
const store = manager.store;
|
165
|
+
const node = store.getNodeById(id)!;
|
166
|
+
const value = store.getValueOf(id);
|
167
|
+
|
168
|
+
if (!node || !value) {
|
169
|
+
return;
|
170
|
+
}
|
171
|
+
|
172
|
+
const component = node.getComponent();
|
173
|
+
|
174
|
+
const schema = {
|
175
|
+
type: 'crud',
|
176
|
+
mode: 'list',
|
177
|
+
...(value.pickerSchema || {
|
178
|
+
listItem: {
|
179
|
+
title: '${label}'
|
180
|
+
}
|
181
|
+
}),
|
182
|
+
api: value.source,
|
183
|
+
pickerMode: true,
|
184
|
+
multiple: value.multiple
|
185
|
+
};
|
186
|
+
|
187
|
+
this.manager.openSubEditor({
|
188
|
+
title: '配置选框详情',
|
189
|
+
value: schema,
|
190
|
+
data: {options: component.props.options},
|
191
|
+
onChange: newValue => {
|
192
|
+
newValue = {
|
193
|
+
...value,
|
194
|
+
pickerSchema: {...newValue},
|
195
|
+
source: newValue.api
|
196
|
+
};
|
197
|
+
|
198
|
+
delete newValue.pickerSchema.api;
|
199
|
+
delete newValue.pickerSchema.type;
|
200
|
+
delete newValue.pickerSchema.pickerMode;
|
201
|
+
delete newValue.pickerSchema.multiple;
|
202
|
+
|
203
|
+
manager.panelChangeValue(newValue, diff(value, newValue));
|
204
|
+
}
|
205
|
+
});
|
206
|
+
}
|
207
|
+
}
|
208
|
+
|
209
|
+
registerEditorPlugin(PickerControlPlugin);
|