amis-editor 4.1.0-beta.2 → 4.1.0-beta.20
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/Editor.d.ts +19 -0
- package/dist/component/Panel/RenderersPanel.d.ts +1 -2
- package/dist/component/RegionWrapper.d.ts +4 -0
- package/dist/component/VRenderer.d.ts +4 -0
- 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/exports.min.js +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.min.js +1 -1
- package/dist/manager.d.ts +14 -3
- package/dist/plugin/Card.d.ts +1 -0
- package/dist/plugin/Cards.d.ts +1 -0
- 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 +43 -0
- 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/InputURL.d.ts +1 -0
- package/dist/plugin/Grid.d.ts +1 -0
- package/dist/plugin/HBox.d.ts +1 -0
- package/dist/plugin/Json.d.ts +1 -0
- package/dist/plugin/List.d.ts +1 -0
- 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/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/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 +2 -2
- package/dist/store/editor.d.ts +20 -2
- package/dist/store/node.d.ts +6 -0
- package/dist/style.css +1 -1
- package/dist/util.d.ts +7 -2
- package/package.json +6 -3
- package/src/component/schemaTpl.tsx +2155 -0
- package/src/plugin/Alert.tsx +87 -0
- package/src/plugin/AnchorNav.tsx +233 -0
- package/src/plugin/Audio.tsx +161 -0
- package/src/plugin/Avatar.tsx +77 -0
- package/src/plugin/Breadcrumb.tsx +107 -0
- package/src/plugin/Button.tsx +283 -0
- package/src/plugin/ButtonGroup.tsx +88 -0
- package/src/plugin/ButtonToolbar.tsx +89 -0
- package/src/plugin/CRUD.tsx +1832 -0
- package/src/plugin/Card.tsx +290 -0
- package/src/plugin/Cards.tsx +315 -0
- package/src/plugin/Carousel.tsx +386 -0
- package/src/plugin/Chart.tsx +218 -0
- package/src/plugin/CodeView.tsx +60 -0
- package/src/plugin/Collapse.tsx +143 -0
- package/src/plugin/CollapseGroup.tsx +167 -0
- package/src/plugin/Container.tsx +44 -0
- package/src/plugin/Custom.tsx +128 -0
- package/src/plugin/CustomRegion.tsx +150 -0
- package/src/plugin/Date.tsx +81 -0
- package/src/plugin/Datetime.tsx +75 -0
- package/src/plugin/Dialog.tsx +178 -0
- package/src/plugin/Divider.tsx +36 -0
- package/src/plugin/Drawer.tsx +217 -0
- package/src/plugin/DropDownButton.tsx +234 -0
- package/src/plugin/Each.tsx +152 -0
- package/src/plugin/ErrorRenderer.tsx +15 -0
- package/src/plugin/Flex.tsx +156 -0
- package/src/plugin/Form/ButtonGroupSelect.tsx +86 -0
- package/src/plugin/Form/ButtonToolbar.tsx +121 -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 +91 -0
- package/src/plugin/Form/Combo.tsx +582 -0
- package/src/plugin/Form/ConditionBuilder.tsx +324 -0
- package/src/plugin/Form/Control.tsx +139 -0
- package/src/plugin/Form/DiffEditor.tsx +117 -0
- package/src/plugin/Form/FieldSet.tsx +175 -0
- package/src/plugin/Form/Form.tsx +692 -0
- package/src/plugin/Form/Formula.tsx +91 -0
- package/src/plugin/Form/Group.tsx +300 -0
- package/src/plugin/Form/Hidden.tsx +56 -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 +228 -0
- package/src/plugin/Form/InputGroup.tsx +105 -0
- package/src/plugin/Form/InputImage.tsx +277 -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 +97 -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 +69 -0
- package/src/plugin/Form/InputRichText.tsx +197 -0
- package/src/plugin/Form/InputSubForm.tsx +198 -0
- package/src/plugin/Form/InputTable.tsx +434 -0
- package/src/plugin/Form/InputTag.tsx +81 -0
- package/src/plugin/Form/InputText.tsx +186 -0
- package/src/plugin/Form/InputTime.tsx +95 -0
- package/src/plugin/Form/InputTree.tsx +240 -0
- package/src/plugin/Form/InputURL.tsx +34 -0
- package/src/plugin/Form/InputYear.tsx +35 -0
- package/src/plugin/Form/Item.tsx +325 -0
- package/src/plugin/Form/ListSelect.tsx +84 -0
- package/src/plugin/Form/LocationPicker.tsx +75 -0
- package/src/plugin/Form/MatrixCheckboxes.tsx +147 -0
- package/src/plugin/Form/NestedSelect.tsx +222 -0
- package/src/plugin/Form/Picker.tsx +217 -0
- package/src/plugin/Form/Radios.tsx +130 -0
- package/src/plugin/Form/Select.tsx +216 -0
- package/src/plugin/Form/Static.tsx +335 -0
- package/src/plugin/Form/Switch.tsx +116 -0
- package/src/plugin/Form/TabsTransfer.tsx +270 -0
- package/src/plugin/Form/Textarea.tsx +94 -0
- package/src/plugin/Form/Transfer.tsx +379 -0
- package/src/plugin/Form/TreeSelect.tsx +263 -0
- package/src/plugin/Form/UUID.tsx +48 -0
- package/src/plugin/Grid.tsx +799 -0
- package/src/plugin/HBox.tsx +727 -0
- package/src/plugin/IFrame.tsx +72 -0
- package/src/plugin/Image.tsx +318 -0
- package/src/plugin/Images.tsx +238 -0
- package/src/plugin/Json.tsx +76 -0
- package/src/plugin/Link.tsx +95 -0
- package/src/plugin/List.tsx +278 -0
- package/src/plugin/ListItem.tsx +233 -0
- package/src/plugin/Log.tsx +52 -0
- package/src/plugin/Mapping.tsx +156 -0
- package/src/plugin/Markdown.tsx +47 -0
- package/src/plugin/Nav.tsx +186 -0
- package/src/plugin/Operation.tsx +97 -0
- package/src/plugin/Others/Action.tsx +428 -0
- package/src/plugin/Others/BasicToolbar.tsx +591 -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 +308 -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 +91 -0
- package/src/plugin/Progress.tsx +132 -0
- package/src/plugin/Property.tsx +139 -0
- package/src/plugin/QRCode.tsx +98 -0
- package/src/plugin/Reset.tsx +23 -0
- package/src/plugin/Service.tsx +167 -0
- package/src/plugin/Sparkline.tsx +40 -0
- package/src/plugin/Status.tsx +78 -0
- package/src/plugin/Steps.tsx +140 -0
- package/src/plugin/Submit.tsx +23 -0
- package/src/plugin/Table.tsx +440 -0
- package/src/plugin/TableView.tsx +711 -0
- package/src/plugin/Tabs.tsx +364 -0
- package/src/plugin/Tasks.tsx +276 -0
- package/src/plugin/Time.tsx +75 -0
- package/src/plugin/TooltipWrapper.tsx +193 -0
- package/src/plugin/Tpl.tsx +162 -0
- package/src/plugin/Video.tsx +160 -0
- package/src/plugin/WebComponent.tsx +56 -0
- package/src/plugin/Wizard.tsx +743 -0
- package/src/plugin/Wrapper.tsx +107 -0
- package/src/plugin.ts +1046 -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,78 @@
|
|
1
|
+
import {getSchemaTpl} from '../../component/schemaTpl';
|
2
|
+
import {registerEditorPlugin} from '../../manager';
|
3
|
+
import {BasePlugin} from '../../plugin';
|
4
|
+
|
5
|
+
export class RatingControlPlugin extends BasePlugin {
|
6
|
+
// 关联渲染器名字
|
7
|
+
rendererName = 'input-rating';
|
8
|
+
$schema = '/schemas/RatingControlSchema.json';
|
9
|
+
|
10
|
+
// 组件名称
|
11
|
+
name = '评分';
|
12
|
+
isBaseComponent = true;
|
13
|
+
icon = 'fa fa-star-o';
|
14
|
+
description = `支持只读、半星选择`;
|
15
|
+
docLink = '/amis/zh-CN/components/form/input-rating';
|
16
|
+
tags = ['表单项'];
|
17
|
+
scaffold = {
|
18
|
+
type: 'input-rating',
|
19
|
+
label: '评分',
|
20
|
+
name: 'rating'
|
21
|
+
};
|
22
|
+
previewSchema: any = {
|
23
|
+
type: 'form',
|
24
|
+
className: 'text-left',
|
25
|
+
mode: 'horizontal',
|
26
|
+
wrapWithPanel: false,
|
27
|
+
body: [
|
28
|
+
{
|
29
|
+
...this.scaffold,
|
30
|
+
value: 3
|
31
|
+
}
|
32
|
+
]
|
33
|
+
};
|
34
|
+
|
35
|
+
panelTitle = '评分';
|
36
|
+
panelBody = [
|
37
|
+
getSchemaTpl('switchDefaultValue'),
|
38
|
+
|
39
|
+
{
|
40
|
+
type: 'input-number',
|
41
|
+
name: 'value',
|
42
|
+
label: '默认值',
|
43
|
+
visibleOn: 'typeof this.value !== "undefined"'
|
44
|
+
},
|
45
|
+
|
46
|
+
{
|
47
|
+
label: '最大值',
|
48
|
+
name: 'count',
|
49
|
+
type: 'input-number',
|
50
|
+
value: 5
|
51
|
+
},
|
52
|
+
{
|
53
|
+
type: 'switch',
|
54
|
+
name: 'half',
|
55
|
+
mode: 'inline',
|
56
|
+
className: 'w-full',
|
57
|
+
label: '允许半星',
|
58
|
+
value: false
|
59
|
+
},
|
60
|
+
|
61
|
+
{
|
62
|
+
type: 'switch',
|
63
|
+
name: 'allowClear',
|
64
|
+
mode: 'inline',
|
65
|
+
className: 'w-full',
|
66
|
+
label: '可清除',
|
67
|
+
description: '是否允许再次点击后清除',
|
68
|
+
value: false
|
69
|
+
},
|
70
|
+
getSchemaTpl('className', {
|
71
|
+
label: '描述 CSS 类名',
|
72
|
+
name: 'descriptionClassName',
|
73
|
+
visibleOn: 'data.description'
|
74
|
+
})
|
75
|
+
];
|
76
|
+
}
|
77
|
+
|
78
|
+
registerEditorPlugin(RatingControlPlugin);
|
@@ -0,0 +1,69 @@
|
|
1
|
+
import {relativeValueRe} from 'amis';
|
2
|
+
import {availableLanguages} from 'amis/lib/renderers/Form/Editor';
|
3
|
+
import {
|
4
|
+
defaultValue,
|
5
|
+
getSchemaTpl,
|
6
|
+
valuePipeOut
|
7
|
+
} from '../../component/schemaTpl';
|
8
|
+
import {registerEditorPlugin} from '../../manager';
|
9
|
+
import {
|
10
|
+
BasePlugin,
|
11
|
+
BasicSubRenderInfo,
|
12
|
+
RendererEventContext,
|
13
|
+
SubRendererInfo
|
14
|
+
} from '../../plugin';
|
15
|
+
|
16
|
+
export class RepeatControlPlugin extends BasePlugin {
|
17
|
+
// 关联渲染器名字
|
18
|
+
rendererName = 'input-repeat';
|
19
|
+
$schema = '/schemas/RepeatControlSchema.json';
|
20
|
+
|
21
|
+
// 组件名称
|
22
|
+
name = '重复周期选择';
|
23
|
+
isBaseComponent = true;
|
24
|
+
icon = 'fa fa-repeat';
|
25
|
+
description = `选择重复的频率,如每时、每天、每周等`;
|
26
|
+
docLink = '/amis/zh-CN/components/form/input-repeat';
|
27
|
+
tags = ['表单项'];
|
28
|
+
scaffold = {
|
29
|
+
type: 'input-repeat',
|
30
|
+
label: '周期',
|
31
|
+
name: 'repeat'
|
32
|
+
};
|
33
|
+
previewSchema: any = {
|
34
|
+
type: 'form',
|
35
|
+
className: 'text-left',
|
36
|
+
mode: 'horizontal',
|
37
|
+
wrapWithPanel: false,
|
38
|
+
body: [
|
39
|
+
{
|
40
|
+
...this.scaffold
|
41
|
+
}
|
42
|
+
]
|
43
|
+
};
|
44
|
+
|
45
|
+
panelTitle = '周期';
|
46
|
+
panelBody = [
|
47
|
+
getSchemaTpl('switchDefaultValue'),
|
48
|
+
{
|
49
|
+
type: 'input-text',
|
50
|
+
name: 'value',
|
51
|
+
label: '默认值',
|
52
|
+
visibleOn: 'typeof this.value !== "undefined"'
|
53
|
+
},
|
54
|
+
|
55
|
+
{
|
56
|
+
name: 'options',
|
57
|
+
type: 'select',
|
58
|
+
label: '启用单位',
|
59
|
+
options:
|
60
|
+
'secondly,minutely,hourly,daily,weekdays,weekly,monthly,yearly'.split(
|
61
|
+
','
|
62
|
+
),
|
63
|
+
value: 'hourly,daily,weekly,monthly',
|
64
|
+
multiple: true
|
65
|
+
}
|
66
|
+
];
|
67
|
+
}
|
68
|
+
|
69
|
+
registerEditorPlugin(RepeatControlPlugin);
|
@@ -0,0 +1,197 @@
|
|
1
|
+
import {relativeValueRe} from 'amis';
|
2
|
+
import {availableLanguages} from 'amis/lib/renderers/Form/Editor';
|
3
|
+
import {
|
4
|
+
defaultValue,
|
5
|
+
getSchemaTpl,
|
6
|
+
valuePipeOut
|
7
|
+
} from '../../component/schemaTpl';
|
8
|
+
import {registerEditorPlugin} from '../../manager';
|
9
|
+
import {
|
10
|
+
BasePlugin,
|
11
|
+
BasicSubRenderInfo,
|
12
|
+
RendererEventContext,
|
13
|
+
SubRendererInfo
|
14
|
+
} from '../../plugin';
|
15
|
+
|
16
|
+
export class RichTextControlPlugin extends BasePlugin {
|
17
|
+
// 关联渲染器名字
|
18
|
+
rendererName = 'input-rich-text';
|
19
|
+
$schema = '/schemas/RichTextControlSchema.json';
|
20
|
+
|
21
|
+
// 组件名称
|
22
|
+
name = '富文本编辑器';
|
23
|
+
isBaseComponent = true;
|
24
|
+
icon = 'fa fa-newspaper-o';
|
25
|
+
description = `可自定义富文本的配置栏`;
|
26
|
+
docLink = '/amis/zh-CN/components/form/input-rich-text';
|
27
|
+
tags = ['表单项'];
|
28
|
+
scaffold = {
|
29
|
+
type: 'input-rich-text',
|
30
|
+
label: '富文本',
|
31
|
+
name: 'rich-text'
|
32
|
+
};
|
33
|
+
previewSchema: any = {
|
34
|
+
type: 'form',
|
35
|
+
className: 'text-left',
|
36
|
+
mode: 'horizontal',
|
37
|
+
wrapWithPanel: false,
|
38
|
+
body: [
|
39
|
+
{
|
40
|
+
...this.scaffold
|
41
|
+
}
|
42
|
+
]
|
43
|
+
};
|
44
|
+
|
45
|
+
panelTitle = '富文本';
|
46
|
+
panelBody = [
|
47
|
+
getSchemaTpl('switchDefaultValue'),
|
48
|
+
{
|
49
|
+
type: 'textarea',
|
50
|
+
name: 'value',
|
51
|
+
label: '默认值',
|
52
|
+
visibleOn: 'typeof this.value !== "undefined"'
|
53
|
+
},
|
54
|
+
getSchemaTpl('api', {
|
55
|
+
name: 'receiver',
|
56
|
+
label: '文件接收接口',
|
57
|
+
value: '/api/upload/image',
|
58
|
+
__isUpload: true
|
59
|
+
}),
|
60
|
+
{
|
61
|
+
type: 'select',
|
62
|
+
name: 'vendor',
|
63
|
+
label: '编辑器类型',
|
64
|
+
value: 'tinymce',
|
65
|
+
options: ['tinymce', 'froala']
|
66
|
+
},
|
67
|
+
getSchemaTpl('fieldSet', {
|
68
|
+
title: 'froala 设置项',
|
69
|
+
visibleOn: 'data.vendor === "froala"',
|
70
|
+
body: [
|
71
|
+
{
|
72
|
+
type: 'combo',
|
73
|
+
name: 'options',
|
74
|
+
noBorder: true,
|
75
|
+
multiLine: true,
|
76
|
+
items: [
|
77
|
+
{
|
78
|
+
type: 'select',
|
79
|
+
name: 'language',
|
80
|
+
label: '语言',
|
81
|
+
labelRemark: '鼠标覆盖配置栏中配置时显示的提示语言',
|
82
|
+
defaultValue: 'zh_cn',
|
83
|
+
options: [
|
84
|
+
{label: '中文', value: 'zh_cn'},
|
85
|
+
{label: '英文', value: 'en_us'}
|
86
|
+
]
|
87
|
+
},
|
88
|
+
{
|
89
|
+
type: 'textarea',
|
90
|
+
name: 'toolbarButtons',
|
91
|
+
label: '大屏时展示的配置项',
|
92
|
+
labelRemark: '屏幕宽度 ≥ 1200px',
|
93
|
+
description:
|
94
|
+
'使用空格分开配置,使用<code>|</code>可将配置栏分组,<a target="_blank" href="https://www.froala.com/wysiwyg-editor/docs/options">参考文档</a>',
|
95
|
+
minRows: 5,
|
96
|
+
value: [
|
97
|
+
'paragraphFormat',
|
98
|
+
'quote',
|
99
|
+
'color',
|
100
|
+
'|',
|
101
|
+
'bold',
|
102
|
+
'italic',
|
103
|
+
'underline',
|
104
|
+
'strikeThrough',
|
105
|
+
'|',
|
106
|
+
'formatOL',
|
107
|
+
'formatUL',
|
108
|
+
'align',
|
109
|
+
'|',
|
110
|
+
'insertLink',
|
111
|
+
'insertImage',
|
112
|
+
'insertEmotion',
|
113
|
+
'insertTable',
|
114
|
+
'|',
|
115
|
+
'undo',
|
116
|
+
'redo',
|
117
|
+
'html'
|
118
|
+
],
|
119
|
+
pipeIn: (value: any) =>
|
120
|
+
Array.isArray(value) ? value.join(' ') : '',
|
121
|
+
pipeOut: (value: any) => value.replace(/\s+/g, ' ').split(' ')
|
122
|
+
},
|
123
|
+
{
|
124
|
+
type: 'textarea',
|
125
|
+
name: 'toolbarButtonsMD',
|
126
|
+
label: '中屏时展示的配置项',
|
127
|
+
labelRemark: '屏幕宽度 ≥ 992px',
|
128
|
+
description:
|
129
|
+
'使用空格分开配置,使用<code>|</code>可将配置栏分组,<a target="_blank" href="https://www.froala.com/wysiwyg-editor/docs/options">参考文档</a>',
|
130
|
+
minRows: 5,
|
131
|
+
pipeIn: (value: any) =>
|
132
|
+
Array.isArray(value) ? value.join(' ') : '',
|
133
|
+
pipeOut: (value: any) => value.replace(/\s+/g, ' ').split(' ')
|
134
|
+
},
|
135
|
+
{
|
136
|
+
type: 'textarea',
|
137
|
+
name: 'toolbarButtonsSM',
|
138
|
+
label: '小屏时展示的配置项',
|
139
|
+
labelRemark: '屏幕宽度 ≥ 768px',
|
140
|
+
description:
|
141
|
+
'使用空格分开配置,使用<code>|</code>可将配置栏分组,<a target="_blank" href="https://www.froala.com/wysiwyg-editor/docs/options">参考文档</a>',
|
142
|
+
minRows: 5,
|
143
|
+
pipeIn: (value: any) =>
|
144
|
+
Array.isArray(value) ? value.join(' ') : '',
|
145
|
+
pipeOut: (value: any) => value.replace(/\s+/g, ' ').split(' ')
|
146
|
+
}
|
147
|
+
]
|
148
|
+
}
|
149
|
+
]
|
150
|
+
}),
|
151
|
+
getSchemaTpl('fieldSet', {
|
152
|
+
title: 'tinymce 设置项',
|
153
|
+
visibleOn: 'data.vendor === "tinymce"',
|
154
|
+
body: [
|
155
|
+
{
|
156
|
+
type: 'combo',
|
157
|
+
name: 'options',
|
158
|
+
noBorder: true,
|
159
|
+
multiLine: true,
|
160
|
+
items: [
|
161
|
+
{
|
162
|
+
type: 'switch',
|
163
|
+
label: '是否显示菜单栏',
|
164
|
+
value: 'true',
|
165
|
+
name: 'menubar'
|
166
|
+
},
|
167
|
+
{
|
168
|
+
type: 'input-number',
|
169
|
+
label: '高度',
|
170
|
+
min: 0,
|
171
|
+
value: 400,
|
172
|
+
name: 'height'
|
173
|
+
},
|
174
|
+
{
|
175
|
+
type: 'textarea',
|
176
|
+
name: 'plugins',
|
177
|
+
label: '启用的插件',
|
178
|
+
description:
|
179
|
+
'使用空格分开配置,<a target="_blank" href="https://www.tiny.cloud/docs/general-configuration-guide/basic-setup/">参考文档</a>',
|
180
|
+
value:
|
181
|
+
'advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking table emoticons template paste help'
|
182
|
+
},
|
183
|
+
{
|
184
|
+
type: 'textarea',
|
185
|
+
name: 'toolbar',
|
186
|
+
label: '工具栏',
|
187
|
+
value:
|
188
|
+
'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor emoticons | help'
|
189
|
+
}
|
190
|
+
]
|
191
|
+
}
|
192
|
+
]
|
193
|
+
})
|
194
|
+
];
|
195
|
+
}
|
196
|
+
|
197
|
+
registerEditorPlugin(RichTextControlPlugin);
|
@@ -0,0 +1,198 @@
|
|
1
|
+
import {Button, relativeValueRe} from 'amis';
|
2
|
+
import {availableLanguages} from 'amis/lib/renderers/Form/Editor';
|
3
|
+
import React from 'react';
|
4
|
+
import {
|
5
|
+
defaultValue,
|
6
|
+
getSchemaTpl,
|
7
|
+
valuePipeOut
|
8
|
+
} from '../../component/schemaTpl';
|
9
|
+
import {registerEditorPlugin} from '../../manager';
|
10
|
+
import {
|
11
|
+
BaseEventContext,
|
12
|
+
BasePlugin,
|
13
|
+
BasicSubRenderInfo,
|
14
|
+
BasicToolbarItem,
|
15
|
+
ContextMenuEventContext,
|
16
|
+
ContextMenuItem,
|
17
|
+
RendererEventContext,
|
18
|
+
SubRendererInfo
|
19
|
+
} from '../../plugin';
|
20
|
+
import {diff, JSONPipeOut} from '../../util';
|
21
|
+
|
22
|
+
export class SubFormControlPlugin extends BasePlugin {
|
23
|
+
// 关联渲染器名字
|
24
|
+
rendererName = 'input-sub-form';
|
25
|
+
$schema = '/schemas/SubFormControlSchema.json';
|
26
|
+
|
27
|
+
// 组件名称
|
28
|
+
name = '子表单项';
|
29
|
+
isBaseComponent = true;
|
30
|
+
icon = 'fa fa-window-restore';
|
31
|
+
description = `SubForm, 配置一个子<code>form</code>作为当前的表单项`;
|
32
|
+
docLink = '/amis/zh-CN/components/form/input-sub-form';
|
33
|
+
tags = ['表单项'];
|
34
|
+
scaffold = {
|
35
|
+
type: 'input-sub-form',
|
36
|
+
name: 'subform',
|
37
|
+
label: '子表单',
|
38
|
+
form: {
|
39
|
+
title: '标题',
|
40
|
+
body: [
|
41
|
+
{
|
42
|
+
type: 'input-text',
|
43
|
+
label: '文本',
|
44
|
+
name: 'text'
|
45
|
+
}
|
46
|
+
]
|
47
|
+
}
|
48
|
+
};
|
49
|
+
previewSchema: any = {
|
50
|
+
type: 'form',
|
51
|
+
className: 'text-left',
|
52
|
+
mode: 'horizontal',
|
53
|
+
wrapWithPanel: false,
|
54
|
+
body: [
|
55
|
+
{
|
56
|
+
...this.scaffold
|
57
|
+
}
|
58
|
+
]
|
59
|
+
};
|
60
|
+
|
61
|
+
panelTitle = '子表单项';
|
62
|
+
panelBodyCreator = (context: BaseEventContext) => {
|
63
|
+
return [
|
64
|
+
{
|
65
|
+
children: ({value, onChange}: any) => {
|
66
|
+
return (
|
67
|
+
<Button
|
68
|
+
size="sm"
|
69
|
+
level="danger"
|
70
|
+
className="m-b"
|
71
|
+
block
|
72
|
+
onClick={this.editDetail.bind(this, context.id)}
|
73
|
+
>
|
74
|
+
配置成员渲染器
|
75
|
+
</Button>
|
76
|
+
);
|
77
|
+
}
|
78
|
+
},
|
79
|
+
{
|
80
|
+
name: 'labelField',
|
81
|
+
type: 'input-text',
|
82
|
+
value: 'label',
|
83
|
+
label: '名称字段名',
|
84
|
+
description: '当值中存在这个字段,则按钮名称将使用此字段的值来展示。'
|
85
|
+
},
|
86
|
+
{
|
87
|
+
name: 'btnLabel',
|
88
|
+
label: '按钮标签名',
|
89
|
+
value: '设置',
|
90
|
+
type: 'input-text'
|
91
|
+
},
|
92
|
+
{
|
93
|
+
name: 'minLength',
|
94
|
+
visibleOn: 'data.multiple',
|
95
|
+
label: '允许最少个数',
|
96
|
+
type: 'input-number'
|
97
|
+
},
|
98
|
+
|
99
|
+
{
|
100
|
+
name: 'maxLength',
|
101
|
+
visibleOn: 'data.multiple',
|
102
|
+
label: '允许最多个数',
|
103
|
+
type: 'input-number'
|
104
|
+
}
|
105
|
+
];
|
106
|
+
};
|
107
|
+
|
108
|
+
filterProps(props: any) {
|
109
|
+
props = JSONPipeOut(props);
|
110
|
+
|
111
|
+
// 至少显示一个成员,否则啥都不显示。
|
112
|
+
if (!props.value) {
|
113
|
+
props.value = [''];
|
114
|
+
}
|
115
|
+
|
116
|
+
return props;
|
117
|
+
}
|
118
|
+
|
119
|
+
buildEditorToolbar(
|
120
|
+
{id, info}: BaseEventContext,
|
121
|
+
toolbars: Array<BasicToolbarItem>
|
122
|
+
) {
|
123
|
+
if (info.renderer.name === 'input-sub-form') {
|
124
|
+
toolbars.push({
|
125
|
+
icon: 'fa fa-expand',
|
126
|
+
order: 100,
|
127
|
+
tooltip: '配置成员渲染器',
|
128
|
+
onClick: this.editDetail.bind(this, id)
|
129
|
+
});
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
buildEditorContextMenu(
|
134
|
+
{id, schema, region, info}: ContextMenuEventContext,
|
135
|
+
menus: Array<ContextMenuItem>
|
136
|
+
) {
|
137
|
+
if (info.renderer.name === 'input-sub-form') {
|
138
|
+
menus.push('|', {
|
139
|
+
label: '配置成员渲染器',
|
140
|
+
onSelect: this.editDetail.bind(this, id)
|
141
|
+
});
|
142
|
+
}
|
143
|
+
}
|
144
|
+
|
145
|
+
editDetail(id: string) {
|
146
|
+
const manager = this.manager;
|
147
|
+
const store = manager.store;
|
148
|
+
const node = store.getNodeById(id);
|
149
|
+
const value = store.getValueOf(id);
|
150
|
+
if (!node || !value) {
|
151
|
+
return;
|
152
|
+
}
|
153
|
+
|
154
|
+
const {
|
155
|
+
title,
|
156
|
+
actions,
|
157
|
+
name,
|
158
|
+
size,
|
159
|
+
closeOnEsc,
|
160
|
+
showCloseButton,
|
161
|
+
bodyClassName,
|
162
|
+
type,
|
163
|
+
...rest
|
164
|
+
} = value.form;
|
165
|
+
const schema = {
|
166
|
+
title,
|
167
|
+
actions,
|
168
|
+
name,
|
169
|
+
size,
|
170
|
+
closeOnEsc,
|
171
|
+
showCloseButton,
|
172
|
+
bodyClassName,
|
173
|
+
type: 'dialog',
|
174
|
+
body: {
|
175
|
+
type: 'form',
|
176
|
+
...rest
|
177
|
+
}
|
178
|
+
};
|
179
|
+
|
180
|
+
this.manager.openSubEditor({
|
181
|
+
title: '配置子表单项',
|
182
|
+
value: schema,
|
183
|
+
memberImmutable: ['body'],
|
184
|
+
onChange: newValue => {
|
185
|
+
const form = newValue.body[0];
|
186
|
+
newValue = {
|
187
|
+
...value,
|
188
|
+
form
|
189
|
+
};
|
190
|
+
// delete newValue.form.body;
|
191
|
+
delete newValue.form.type;
|
192
|
+
manager.panelChangeValue(newValue, diff(value, newValue));
|
193
|
+
}
|
194
|
+
});
|
195
|
+
}
|
196
|
+
}
|
197
|
+
|
198
|
+
registerEditorPlugin(SubFormControlPlugin);
|