amis-editor 4.1.0-beta.4 → 4.2.0-beta.0
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/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/env.d.ts +1 -1
- 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 +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 +47 -11
- package/dist/store/node.d.ts +6 -0
- package/dist/style.css +1 -1
- package/dist/util.d.ts +1 -1
- package/package.json +10 -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,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,57 @@
|
|
1
|
+
import {getSchemaTpl} from '../../component/schemaTpl';
|
2
|
+
import {registerEditorPlugin} from '../../manager';
|
3
|
+
import {BasePlugin} from '../../plugin';
|
4
|
+
|
5
|
+
export class RepeatControlPlugin extends BasePlugin {
|
6
|
+
// 关联渲染器名字
|
7
|
+
rendererName = 'input-repeat';
|
8
|
+
$schema = '/schemas/RepeatControlSchema.json';
|
9
|
+
|
10
|
+
// 组件名称
|
11
|
+
name = '重复周期选择';
|
12
|
+
isBaseComponent = true;
|
13
|
+
icon = 'fa fa-repeat';
|
14
|
+
description = `选择重复的频率,如每时、每天、每周等`;
|
15
|
+
docLink = '/amis/zh-CN/components/form/input-repeat';
|
16
|
+
tags = ['表单项'];
|
17
|
+
scaffold = {
|
18
|
+
type: 'input-repeat',
|
19
|
+
label: '周期',
|
20
|
+
name: 'repeat'
|
21
|
+
};
|
22
|
+
previewSchema: any = {
|
23
|
+
type: 'form',
|
24
|
+
className: 'text-left',
|
25
|
+
mode: 'horizontal',
|
26
|
+
wrapWithPanel: false,
|
27
|
+
body: [
|
28
|
+
{
|
29
|
+
...this.scaffold
|
30
|
+
}
|
31
|
+
]
|
32
|
+
};
|
33
|
+
|
34
|
+
panelTitle = '周期';
|
35
|
+
panelBody = [
|
36
|
+
getSchemaTpl('switchDefaultValue'),
|
37
|
+
{
|
38
|
+
type: 'input-text',
|
39
|
+
name: 'value',
|
40
|
+
label: '默认值',
|
41
|
+
visibleOn: 'typeof this.value !== "undefined"'
|
42
|
+
},
|
43
|
+
|
44
|
+
{
|
45
|
+
name: 'options',
|
46
|
+
type: 'select',
|
47
|
+
label: '启用单位',
|
48
|
+
options: 'secondly,minutely,hourly,daily,weekdays,weekly,monthly,yearly'.split(
|
49
|
+
','
|
50
|
+
),
|
51
|
+
value: 'hourly,daily,weekly,monthly',
|
52
|
+
multiple: true
|
53
|
+
}
|
54
|
+
];
|
55
|
+
}
|
56
|
+
|
57
|
+
registerEditorPlugin(RepeatControlPlugin);
|
@@ -0,0 +1,186 @@
|
|
1
|
+
import {getSchemaTpl} from '../../component/schemaTpl';
|
2
|
+
import {registerEditorPlugin} from '../../manager';
|
3
|
+
import {BasePlugin} from '../../plugin';
|
4
|
+
|
5
|
+
export class RichTextControlPlugin extends BasePlugin {
|
6
|
+
// 关联渲染器名字
|
7
|
+
rendererName = 'input-rich-text';
|
8
|
+
$schema = '/schemas/RichTextControlSchema.json';
|
9
|
+
|
10
|
+
// 组件名称
|
11
|
+
name = '富文本编辑器';
|
12
|
+
isBaseComponent = true;
|
13
|
+
icon = 'fa fa-newspaper-o';
|
14
|
+
description = `可自定义富文本的配置栏`;
|
15
|
+
docLink = '/amis/zh-CN/components/form/input-rich-text';
|
16
|
+
tags = ['表单项'];
|
17
|
+
scaffold = {
|
18
|
+
type: 'input-rich-text',
|
19
|
+
label: '富文本',
|
20
|
+
name: 'rich-text'
|
21
|
+
};
|
22
|
+
previewSchema: any = {
|
23
|
+
type: 'form',
|
24
|
+
className: 'text-left',
|
25
|
+
mode: 'horizontal',
|
26
|
+
wrapWithPanel: false,
|
27
|
+
body: [
|
28
|
+
{
|
29
|
+
...this.scaffold
|
30
|
+
}
|
31
|
+
]
|
32
|
+
};
|
33
|
+
|
34
|
+
panelTitle = '富文本';
|
35
|
+
panelBody = [
|
36
|
+
getSchemaTpl('switchDefaultValue'),
|
37
|
+
{
|
38
|
+
type: 'textarea',
|
39
|
+
name: 'value',
|
40
|
+
label: '默认值',
|
41
|
+
visibleOn: 'typeof this.value !== "undefined"'
|
42
|
+
},
|
43
|
+
getSchemaTpl('api', {
|
44
|
+
name: 'receiver',
|
45
|
+
label: '文件接收接口',
|
46
|
+
value: '/api/upload/image',
|
47
|
+
__isUpload: true
|
48
|
+
}),
|
49
|
+
{
|
50
|
+
type: 'select',
|
51
|
+
name: 'vendor',
|
52
|
+
label: '编辑器类型',
|
53
|
+
value: 'tinymce',
|
54
|
+
options: ['tinymce', 'froala']
|
55
|
+
},
|
56
|
+
getSchemaTpl('fieldSet', {
|
57
|
+
title: 'froala 设置项',
|
58
|
+
visibleOn: 'data.vendor === "froala"',
|
59
|
+
body: [
|
60
|
+
{
|
61
|
+
type: 'combo',
|
62
|
+
name: 'options',
|
63
|
+
noBorder: true,
|
64
|
+
multiLine: true,
|
65
|
+
items: [
|
66
|
+
{
|
67
|
+
type: 'select',
|
68
|
+
name: 'language',
|
69
|
+
label: '语言',
|
70
|
+
labelRemark: '鼠标覆盖配置栏中配置时显示的提示语言',
|
71
|
+
defaultValue: 'zh_cn',
|
72
|
+
options: [
|
73
|
+
{label: '中文', value: 'zh_cn'},
|
74
|
+
{label: '英文', value: 'en_us'}
|
75
|
+
]
|
76
|
+
},
|
77
|
+
{
|
78
|
+
type: 'textarea',
|
79
|
+
name: 'toolbarButtons',
|
80
|
+
label: '大屏时展示的配置项',
|
81
|
+
labelRemark: '屏幕宽度 ≥ 1200px',
|
82
|
+
description:
|
83
|
+
'使用空格分开配置,使用<code>|</code>可将配置栏分组,<a target="_blank" href="https://www.froala.com/wysiwyg-editor/docs/options">参考文档</a>',
|
84
|
+
minRows: 5,
|
85
|
+
value: [
|
86
|
+
'paragraphFormat',
|
87
|
+
'quote',
|
88
|
+
'color',
|
89
|
+
'|',
|
90
|
+
'bold',
|
91
|
+
'italic',
|
92
|
+
'underline',
|
93
|
+
'strikeThrough',
|
94
|
+
'|',
|
95
|
+
'formatOL',
|
96
|
+
'formatUL',
|
97
|
+
'align',
|
98
|
+
'|',
|
99
|
+
'insertLink',
|
100
|
+
'insertImage',
|
101
|
+
'insertEmotion',
|
102
|
+
'insertTable',
|
103
|
+
'|',
|
104
|
+
'undo',
|
105
|
+
'redo',
|
106
|
+
'html'
|
107
|
+
],
|
108
|
+
pipeIn: (value: any) =>
|
109
|
+
Array.isArray(value) ? value.join(' ') : '',
|
110
|
+
pipeOut: (value: any) => value.replace(/\s+/g, ' ').split(' ')
|
111
|
+
},
|
112
|
+
{
|
113
|
+
type: 'textarea',
|
114
|
+
name: 'toolbarButtonsMD',
|
115
|
+
label: '中屏时展示的配置项',
|
116
|
+
labelRemark: '屏幕宽度 ≥ 992px',
|
117
|
+
description:
|
118
|
+
'使用空格分开配置,使用<code>|</code>可将配置栏分组,<a target="_blank" href="https://www.froala.com/wysiwyg-editor/docs/options">参考文档</a>',
|
119
|
+
minRows: 5,
|
120
|
+
pipeIn: (value: any) =>
|
121
|
+
Array.isArray(value) ? value.join(' ') : '',
|
122
|
+
pipeOut: (value: any) => value.replace(/\s+/g, ' ').split(' ')
|
123
|
+
},
|
124
|
+
{
|
125
|
+
type: 'textarea',
|
126
|
+
name: 'toolbarButtonsSM',
|
127
|
+
label: '小屏时展示的配置项',
|
128
|
+
labelRemark: '屏幕宽度 ≥ 768px',
|
129
|
+
description:
|
130
|
+
'使用空格分开配置,使用<code>|</code>可将配置栏分组,<a target="_blank" href="https://www.froala.com/wysiwyg-editor/docs/options">参考文档</a>',
|
131
|
+
minRows: 5,
|
132
|
+
pipeIn: (value: any) =>
|
133
|
+
Array.isArray(value) ? value.join(' ') : '',
|
134
|
+
pipeOut: (value: any) => value.replace(/\s+/g, ' ').split(' ')
|
135
|
+
}
|
136
|
+
]
|
137
|
+
}
|
138
|
+
]
|
139
|
+
}),
|
140
|
+
getSchemaTpl('fieldSet', {
|
141
|
+
title: 'tinymce 设置项',
|
142
|
+
visibleOn: 'data.vendor === "tinymce"',
|
143
|
+
body: [
|
144
|
+
{
|
145
|
+
type: 'combo',
|
146
|
+
name: 'options',
|
147
|
+
noBorder: true,
|
148
|
+
multiLine: true,
|
149
|
+
items: [
|
150
|
+
{
|
151
|
+
type: 'switch',
|
152
|
+
label: '是否显示菜单栏',
|
153
|
+
value: 'true',
|
154
|
+
name: 'menubar'
|
155
|
+
},
|
156
|
+
{
|
157
|
+
type: 'input-number',
|
158
|
+
label: '高度',
|
159
|
+
min: 0,
|
160
|
+
value: 400,
|
161
|
+
name: 'height'
|
162
|
+
},
|
163
|
+
{
|
164
|
+
type: 'textarea',
|
165
|
+
name: 'plugins',
|
166
|
+
label: '启用的插件',
|
167
|
+
description:
|
168
|
+
'使用空格分开配置,<a target="_blank" href="https://www.tiny.cloud/docs/general-configuration-guide/basic-setup/">参考文档</a>',
|
169
|
+
value:
|
170
|
+
'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'
|
171
|
+
},
|
172
|
+
{
|
173
|
+
type: 'textarea',
|
174
|
+
name: 'toolbar',
|
175
|
+
label: '工具栏',
|
176
|
+
value:
|
177
|
+
'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor emoticons | help'
|
178
|
+
}
|
179
|
+
]
|
180
|
+
}
|
181
|
+
]
|
182
|
+
})
|
183
|
+
];
|
184
|
+
}
|
185
|
+
|
186
|
+
registerEditorPlugin(RichTextControlPlugin);
|
@@ -0,0 +1,189 @@
|
|
1
|
+
import {Button} from 'amis';
|
2
|
+
import React from 'react';
|
3
|
+
import {registerEditorPlugin} from '../../manager';
|
4
|
+
import {
|
5
|
+
BaseEventContext,
|
6
|
+
BasePlugin,
|
7
|
+
BasicToolbarItem,
|
8
|
+
ContextMenuEventContext,
|
9
|
+
ContextMenuItem
|
10
|
+
} from '../../plugin';
|
11
|
+
import {diff, JSONPipeOut} from '../../util';
|
12
|
+
|
13
|
+
export class SubFormControlPlugin extends BasePlugin {
|
14
|
+
// 关联渲染器名字
|
15
|
+
rendererName = 'input-sub-form';
|
16
|
+
$schema = '/schemas/SubFormControlSchema.json';
|
17
|
+
|
18
|
+
// 组件名称
|
19
|
+
name = '子表单项';
|
20
|
+
isBaseComponent = true;
|
21
|
+
icon = 'fa fa-window-restore';
|
22
|
+
description = `SubForm, 配置一个子<code>form</code>作为当前的表单项`;
|
23
|
+
docLink = '/amis/zh-CN/components/form/input-sub-form';
|
24
|
+
tags = ['表单项'];
|
25
|
+
scaffold = {
|
26
|
+
type: 'input-sub-form',
|
27
|
+
name: 'subform',
|
28
|
+
label: '子表单',
|
29
|
+
form: {
|
30
|
+
title: '标题',
|
31
|
+
body: [
|
32
|
+
{
|
33
|
+
type: 'input-text',
|
34
|
+
label: '文本',
|
35
|
+
name: 'text'
|
36
|
+
}
|
37
|
+
]
|
38
|
+
}
|
39
|
+
};
|
40
|
+
previewSchema: any = {
|
41
|
+
type: 'form',
|
42
|
+
className: 'text-left',
|
43
|
+
mode: 'horizontal',
|
44
|
+
wrapWithPanel: false,
|
45
|
+
body: [
|
46
|
+
{
|
47
|
+
...this.scaffold
|
48
|
+
}
|
49
|
+
]
|
50
|
+
};
|
51
|
+
|
52
|
+
panelTitle = '子表单项';
|
53
|
+
panelBodyCreator = (context: BaseEventContext) => {
|
54
|
+
return [
|
55
|
+
{
|
56
|
+
children: ({value, onChange}: any) => {
|
57
|
+
return (
|
58
|
+
<Button
|
59
|
+
size="sm"
|
60
|
+
level="danger"
|
61
|
+
className="m-b"
|
62
|
+
block
|
63
|
+
onClick={this.editDetail.bind(this, context.id)}
|
64
|
+
>
|
65
|
+
配置成员渲染器
|
66
|
+
</Button>
|
67
|
+
);
|
68
|
+
}
|
69
|
+
},
|
70
|
+
{
|
71
|
+
name: 'labelField',
|
72
|
+
type: 'input-text',
|
73
|
+
value: 'label',
|
74
|
+
label: '名称字段名',
|
75
|
+
description: '当值中存在这个字段,则按钮名称将使用此字段的值来展示。'
|
76
|
+
},
|
77
|
+
{
|
78
|
+
name: 'btnLabel',
|
79
|
+
label: '按钮标签名',
|
80
|
+
value: '设置',
|
81
|
+
type: 'input-text'
|
82
|
+
},
|
83
|
+
{
|
84
|
+
name: 'minLength',
|
85
|
+
visibleOn: 'data.multiple',
|
86
|
+
label: '允许最少个数',
|
87
|
+
type: 'input-number'
|
88
|
+
},
|
89
|
+
|
90
|
+
{
|
91
|
+
name: 'maxLength',
|
92
|
+
visibleOn: 'data.multiple',
|
93
|
+
label: '允许最多个数',
|
94
|
+
type: 'input-number'
|
95
|
+
}
|
96
|
+
];
|
97
|
+
};
|
98
|
+
|
99
|
+
filterProps(props: any) {
|
100
|
+
props = JSONPipeOut(props);
|
101
|
+
|
102
|
+
// 至少显示一个成员,否则啥都不显示。
|
103
|
+
if (!props.value) {
|
104
|
+
props.value = [''];
|
105
|
+
}
|
106
|
+
|
107
|
+
return props;
|
108
|
+
}
|
109
|
+
|
110
|
+
buildEditorToolbar(
|
111
|
+
{id, info}: BaseEventContext,
|
112
|
+
toolbars: Array<BasicToolbarItem>
|
113
|
+
) {
|
114
|
+
if (info.renderer.name === 'input-sub-form') {
|
115
|
+
toolbars.push({
|
116
|
+
icon: 'fa fa-expand',
|
117
|
+
order: 100,
|
118
|
+
tooltip: '配置成员渲染器',
|
119
|
+
onClick: this.editDetail.bind(this, id)
|
120
|
+
});
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
buildEditorContextMenu(
|
125
|
+
{id, schema, region, info}: ContextMenuEventContext,
|
126
|
+
menus: Array<ContextMenuItem>
|
127
|
+
) {
|
128
|
+
if (info.renderer.name === 'input-sub-form') {
|
129
|
+
menus.push('|', {
|
130
|
+
label: '配置成员渲染器',
|
131
|
+
onSelect: this.editDetail.bind(this, id)
|
132
|
+
});
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
editDetail(id: string) {
|
137
|
+
const manager = this.manager;
|
138
|
+
const store = manager.store;
|
139
|
+
const node = store.getNodeById(id);
|
140
|
+
const value = store.getValueOf(id);
|
141
|
+
if (!node || !value) {
|
142
|
+
return;
|
143
|
+
}
|
144
|
+
|
145
|
+
const {
|
146
|
+
title,
|
147
|
+
actions,
|
148
|
+
name,
|
149
|
+
size,
|
150
|
+
closeOnEsc,
|
151
|
+
showCloseButton,
|
152
|
+
bodyClassName,
|
153
|
+
type,
|
154
|
+
...rest
|
155
|
+
} = value.form;
|
156
|
+
const schema = {
|
157
|
+
title,
|
158
|
+
actions,
|
159
|
+
name,
|
160
|
+
size,
|
161
|
+
closeOnEsc,
|
162
|
+
showCloseButton,
|
163
|
+
bodyClassName,
|
164
|
+
type: 'dialog',
|
165
|
+
body: {
|
166
|
+
type: 'form',
|
167
|
+
...rest
|
168
|
+
}
|
169
|
+
};
|
170
|
+
|
171
|
+
this.manager.openSubEditor({
|
172
|
+
title: '配置子表单项',
|
173
|
+
value: schema,
|
174
|
+
memberImmutable: ['body'],
|
175
|
+
onChange: newValue => {
|
176
|
+
const form = newValue.body[0];
|
177
|
+
newValue = {
|
178
|
+
...value,
|
179
|
+
form
|
180
|
+
};
|
181
|
+
// delete newValue.form.body;
|
182
|
+
delete newValue.form.type;
|
183
|
+
manager.panelChangeValue(newValue, diff(value, newValue));
|
184
|
+
}
|
185
|
+
});
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
189
|
+
registerEditorPlugin(SubFormControlPlugin);
|