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.
Files changed (218) hide show
  1. package/dist/component/Breadcrumb.d.ts +23 -2
  2. package/dist/component/ClassNameControl.d.ts +1 -1
  3. package/dist/component/Control/APIControl.d.ts +2 -2
  4. package/dist/component/Control/OptionControl.d.ts +3 -3
  5. package/dist/component/Control/PopoverEdit.d.ts +4 -4
  6. package/dist/component/Control/ValidationControl.d.ts +1 -1
  7. package/dist/component/Editor.d.ts +20 -1
  8. package/dist/component/IFramePreview.d.ts +2 -1
  9. package/dist/component/NodeWrapper.d.ts +1 -1
  10. package/dist/component/Panel/RenderersPanel.d.ts +1 -2
  11. package/dist/component/Preview.d.ts +3 -1
  12. package/dist/component/RegionWrapper.d.ts +4 -0
  13. package/dist/component/ScaffoldModal.d.ts +1 -1
  14. package/dist/component/VRenderer.d.ts +4 -0
  15. package/dist/component/base/InputComponentName.d.ts +1 -1
  16. package/dist/component/base/SearchCustomRendererPanel.d.ts +15 -0
  17. package/dist/component/base/SearchPanel.d.ts +83 -0
  18. package/dist/component/base/SearchRendererPanel.d.ts +2 -42
  19. package/dist/component/base/ShortcutKey.d.ts +23 -0
  20. package/dist/env.d.ts +1 -1
  21. package/dist/exports.min.js +1 -1
  22. package/dist/index.d.ts +5 -1
  23. package/dist/index.min.js +1 -1
  24. package/dist/manager.d.ts +16 -4
  25. package/dist/plugin/Alert.d.ts +1 -1
  26. package/dist/plugin/Button.d.ts +1 -1
  27. package/dist/plugin/Card.d.ts +1 -0
  28. package/dist/plugin/Cards.d.ts +2 -1
  29. package/dist/plugin/Carousel.d.ts +1 -0
  30. package/dist/plugin/Chart.d.ts +1 -0
  31. package/dist/plugin/Collapse.d.ts +1 -0
  32. package/dist/plugin/Custom.d.ts +3 -0
  33. package/dist/plugin/CustomRegion.d.ts +40 -0
  34. package/dist/plugin/Dialog.d.ts +1 -1
  35. package/dist/plugin/Drawer.d.ts +1 -1
  36. package/dist/plugin/DropDownButton.d.ts +1 -1
  37. package/dist/plugin/Each.d.ts +1 -1
  38. package/dist/plugin/Flex.d.ts +1 -0
  39. package/dist/plugin/Form/Control.d.ts +1 -0
  40. package/dist/plugin/Form/Form.d.ts +19 -3
  41. package/dist/plugin/Form/Formula.d.ts +3 -3
  42. package/dist/plugin/Form/InputURL.d.ts +1 -0
  43. package/dist/plugin/Form/Switch.d.ts +2 -0
  44. package/dist/plugin/Grid.d.ts +1 -0
  45. package/dist/plugin/HBox.d.ts +1 -0
  46. package/dist/plugin/IFrame.d.ts +3 -3
  47. package/dist/plugin/Json.d.ts +1 -0
  48. package/dist/plugin/List.d.ts +2 -1
  49. package/dist/plugin/Mapping.d.ts +1 -0
  50. package/dist/plugin/Markdown.d.ts +1 -0
  51. package/dist/plugin/Nav.d.ts +1 -0
  52. package/dist/plugin/Page.d.ts +1 -1
  53. package/dist/plugin/Panel/Outline.d.ts +8 -0
  54. package/dist/plugin/Progress.d.ts +1 -0
  55. package/dist/plugin/QRCode.d.ts +1 -0
  56. package/dist/plugin/Reset.d.ts +0 -1
  57. package/dist/plugin/Service.d.ts +1 -0
  58. package/dist/plugin/Sparkline.d.ts +1 -0
  59. package/dist/plugin/Status.d.ts +1 -0
  60. package/dist/plugin/Steps.d.ts +1 -0
  61. package/dist/plugin/Submit.d.ts +0 -1
  62. package/dist/plugin/Table.d.ts +1 -1
  63. package/dist/plugin/TableView.d.ts +1 -0
  64. package/dist/plugin/Tasks.d.ts +1 -0
  65. package/dist/plugin/TooltipWrapper.d.ts +1 -0
  66. package/dist/plugin/Video.d.ts +1 -0
  67. package/dist/plugin/WebComponent.d.ts +1 -0
  68. package/dist/plugin/Wizard.d.ts +11 -2
  69. package/dist/plugin/Wrapper.d.ts +1 -0
  70. package/dist/plugin.d.ts +8 -7
  71. package/dist/store/editor.d.ts +58 -22
  72. package/dist/store/node.d.ts +6 -0
  73. package/dist/style.css +1 -1
  74. package/dist/util.d.ts +1 -1
  75. package/package.json +9 -3
  76. package/src/component/schemaTpl.tsx +2157 -0
  77. package/src/plugin/Alert.tsx +87 -0
  78. package/src/plugin/AnchorNav.tsx +233 -0
  79. package/src/plugin/Audio.tsx +154 -0
  80. package/src/plugin/Avatar.tsx +77 -0
  81. package/src/plugin/Breadcrumb.tsx +107 -0
  82. package/src/plugin/Button.tsx +281 -0
  83. package/src/plugin/ButtonGroup.tsx +85 -0
  84. package/src/plugin/ButtonToolbar.tsx +87 -0
  85. package/src/plugin/CRUD.tsx +1835 -0
  86. package/src/plugin/Card.tsx +290 -0
  87. package/src/plugin/Cards.tsx +318 -0
  88. package/src/plugin/Carousel.tsx +377 -0
  89. package/src/plugin/Chart.tsx +218 -0
  90. package/src/plugin/CodeView.tsx +60 -0
  91. package/src/plugin/Collapse.tsx +136 -0
  92. package/src/plugin/CollapseGroup.tsx +167 -0
  93. package/src/plugin/Container.tsx +40 -0
  94. package/src/plugin/Custom.tsx +128 -0
  95. package/src/plugin/CustomRegion.tsx +156 -0
  96. package/src/plugin/Date.tsx +74 -0
  97. package/src/plugin/Datetime.tsx +68 -0
  98. package/src/plugin/Dialog.tsx +176 -0
  99. package/src/plugin/Divider.tsx +36 -0
  100. package/src/plugin/Drawer.tsx +214 -0
  101. package/src/plugin/DropDownButton.tsx +235 -0
  102. package/src/plugin/Each.tsx +150 -0
  103. package/src/plugin/ErrorRenderer.tsx +15 -0
  104. package/src/plugin/Flex.tsx +151 -0
  105. package/src/plugin/Form/ButtonGroupSelect.tsx +75 -0
  106. package/src/plugin/Form/ButtonToolbar.tsx +110 -0
  107. package/src/plugin/Form/ChainedSelect.tsx +70 -0
  108. package/src/plugin/Form/Checkbox.tsx +87 -0
  109. package/src/plugin/Form/Checkboxes.tsx +167 -0
  110. package/src/plugin/Form/CodeEditor.tsx +81 -0
  111. package/src/plugin/Form/Combo.tsx +582 -0
  112. package/src/plugin/Form/ConditionBuilder.tsx +315 -0
  113. package/src/plugin/Form/Control.tsx +139 -0
  114. package/src/plugin/Form/DiffEditor.tsx +111 -0
  115. package/src/plugin/Form/FieldSet.tsx +163 -0
  116. package/src/plugin/Form/Form.tsx +687 -0
  117. package/src/plugin/Form/Formula.tsx +79 -0
  118. package/src/plugin/Form/Group.tsx +295 -0
  119. package/src/plugin/Form/Hidden.tsx +44 -0
  120. package/src/plugin/Form/InputArray.tsx +228 -0
  121. package/src/plugin/Form/InputCity.tsx +93 -0
  122. package/src/plugin/Form/InputColor.tsx +123 -0
  123. package/src/plugin/Form/InputDate.tsx +175 -0
  124. package/src/plugin/Form/InputDateRange.tsx +225 -0
  125. package/src/plugin/Form/InputDateTime.tsx +183 -0
  126. package/src/plugin/Form/InputDateTimeRange.tsx +221 -0
  127. package/src/plugin/Form/InputEmail.tsx +33 -0
  128. package/src/plugin/Form/InputExcel.tsx +85 -0
  129. package/src/plugin/Form/InputFile.tsx +221 -0
  130. package/src/plugin/Form/InputGroup.tsx +96 -0
  131. package/src/plugin/Form/InputImage.tsx +266 -0
  132. package/src/plugin/Form/InputKV.tsx +72 -0
  133. package/src/plugin/Form/InputMonth.tsx +35 -0
  134. package/src/plugin/Form/InputMonthRange.tsx +195 -0
  135. package/src/plugin/Form/InputNumber.tsx +89 -0
  136. package/src/plugin/Form/InputPassword.tsx +33 -0
  137. package/src/plugin/Form/InputQuarter.tsx +35 -0
  138. package/src/plugin/Form/InputQuarterRange.tsx +195 -0
  139. package/src/plugin/Form/InputRange.tsx +121 -0
  140. package/src/plugin/Form/InputRating.tsx +78 -0
  141. package/src/plugin/Form/InputRepeat.tsx +57 -0
  142. package/src/plugin/Form/InputRichText.tsx +186 -0
  143. package/src/plugin/Form/InputSubForm.tsx +189 -0
  144. package/src/plugin/Form/InputTable.tsx +434 -0
  145. package/src/plugin/Form/InputTag.tsx +70 -0
  146. package/src/plugin/Form/InputText.tsx +186 -0
  147. package/src/plugin/Form/InputTime.tsx +85 -0
  148. package/src/plugin/Form/InputTree.tsx +229 -0
  149. package/src/plugin/Form/InputURL.tsx +34 -0
  150. package/src/plugin/Form/InputYear.tsx +35 -0
  151. package/src/plugin/Form/Item.tsx +327 -0
  152. package/src/plugin/Form/ListSelect.tsx +73 -0
  153. package/src/plugin/Form/LocationPicker.tsx +62 -0
  154. package/src/plugin/Form/MatrixCheckboxes.tsx +136 -0
  155. package/src/plugin/Form/NestedSelect.tsx +211 -0
  156. package/src/plugin/Form/Picker.tsx +209 -0
  157. package/src/plugin/Form/Radios.tsx +119 -0
  158. package/src/plugin/Form/Select.tsx +233 -0
  159. package/src/plugin/Form/Static.tsx +322 -0
  160. package/src/plugin/Form/Switch.tsx +107 -0
  161. package/src/plugin/Form/TabsTransfer.tsx +259 -0
  162. package/src/plugin/Form/Textarea.tsx +83 -0
  163. package/src/plugin/Form/Transfer.tsx +368 -0
  164. package/src/plugin/Form/TreeSelect.tsx +263 -0
  165. package/src/plugin/Form/UUID.tsx +48 -0
  166. package/src/plugin/Grid.tsx +798 -0
  167. package/src/plugin/HBox.tsx +727 -0
  168. package/src/plugin/IFrame.tsx +70 -0
  169. package/src/plugin/Image.tsx +314 -0
  170. package/src/plugin/Images.tsx +231 -0
  171. package/src/plugin/Json.tsx +69 -0
  172. package/src/plugin/Link.tsx +93 -0
  173. package/src/plugin/List.tsx +278 -0
  174. package/src/plugin/ListItem.tsx +229 -0
  175. package/src/plugin/Log.tsx +52 -0
  176. package/src/plugin/Mapping.tsx +149 -0
  177. package/src/plugin/Markdown.tsx +47 -0
  178. package/src/plugin/Nav.tsx +184 -0
  179. package/src/plugin/Operation.tsx +95 -0
  180. package/src/plugin/Others/Action.tsx +426 -0
  181. package/src/plugin/Others/BasicToolbar.tsx +585 -0
  182. package/src/plugin/Others/DataDebug.tsx +134 -0
  183. package/src/plugin/Others/TableCell.tsx +480 -0
  184. package/src/plugin/Others/Unknown.tsx +37 -0
  185. package/src/plugin/Page.tsx +306 -0
  186. package/src/plugin/Panel/AvailableRenderers.tsx +41 -0
  187. package/src/plugin/Panel/Code.tsx +44 -0
  188. package/src/plugin/Panel/Name.tsx +26 -0
  189. package/src/plugin/Panel/Outline.tsx +40 -0
  190. package/src/plugin/Panel.tsx +243 -0
  191. package/src/plugin/Plain.tsx +84 -0
  192. package/src/plugin/Progress.tsx +125 -0
  193. package/src/plugin/Property.tsx +139 -0
  194. package/src/plugin/QRCode.tsx +96 -0
  195. package/src/plugin/Reset.tsx +23 -0
  196. package/src/plugin/Service.tsx +162 -0
  197. package/src/plugin/Sparkline.tsx +40 -0
  198. package/src/plugin/Status.tsx +76 -0
  199. package/src/plugin/Steps.tsx +128 -0
  200. package/src/plugin/Submit.tsx +23 -0
  201. package/src/plugin/Table.tsx +428 -0
  202. package/src/plugin/TableView.tsx +709 -0
  203. package/src/plugin/Tabs.tsx +362 -0
  204. package/src/plugin/Tasks.tsx +274 -0
  205. package/src/plugin/Time.tsx +68 -0
  206. package/src/plugin/TooltipWrapper.tsx +193 -0
  207. package/src/plugin/Tpl.tsx +158 -0
  208. package/src/plugin/Video.tsx +158 -0
  209. package/src/plugin/WebComponent.tsx +53 -0
  210. package/src/plugin/Wizard.tsx +740 -0
  211. package/src/plugin/Wrapper.tsx +107 -0
  212. package/src/plugin.ts +1050 -0
  213. package/dist/150a58f3318ca7541ed9.png +0 -0
  214. package/dist/471adb97c322b226e589.png +0 -0
  215. package/dist/4de5f42360bc5946c3c2.png +0 -0
  216. package/dist/4e9968bba3855f088fed.png +0 -0
  217. package/dist/7f09c38ebc687fea847a.png +0 -0
  218. 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);