amis-editor 4.2.0-beta.2 → 5.1.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/6dbcbb49b6fd405190a9.png +0 -0
- package/dist/component/Control/APIControl.d.ts +1101 -447
- package/dist/component/Control/ActionAPIControl.d.ts +1158 -0
- package/dist/component/Control/BadgeControl.d.ts +133 -0
- package/dist/component/Control/BaseControl.d.ts +248 -0
- package/dist/component/Control/DataBindingControl.d.ts +14 -0
- package/dist/component/Control/DataPickerControl.d.ts +13 -0
- package/dist/component/Control/DateShortCutControl.d.ts +83 -0
- package/dist/component/Control/FormulaControl.d.ts +51 -0
- package/dist/component/Control/OptionControl.d.ts +23 -34
- package/dist/component/Control/StatusControl.d.ts +39 -0
- package/dist/component/Control/SwitchMoreControl.d.ts +224 -0
- package/dist/component/Control/ValidationControl.d.ts +50 -15
- package/dist/component/Control/ValidationItem.d.ts +46 -0
- package/dist/component/Control/style-control/Background.d.ts +17 -0
- package/dist/component/Control/style-control/Border.d.ts +18 -0
- package/dist/component/Control/style-control/BoxModel.d.ts +17 -0
- package/dist/component/Control/style-control/BoxShadow.d.ts +18 -0
- package/dist/component/Control/style-control/Display.d.ts +14 -0
- package/dist/component/Control/style-control/Font.d.ts +16 -0
- package/dist/component/Control/style-control/font-family.d.ts +11 -0
- package/dist/component/Control/style-control/transformation.d.ts +29 -0
- package/dist/component/Control/style-control/types.d.ts +8 -0
- package/dist/component/Editor.d.ts +16 -0
- package/dist/component/RegionWrapper.d.ts +10 -0
- package/dist/component/VRenderer.d.ts +10 -0
- package/dist/component/schemaTpl.d.ts +8 -0
- package/dist/component/validator.d.ts +62 -0
- package/dist/dnd/index.d.ts +1 -1
- package/dist/event-action/action-config-panel.d.ts +8 -0
- package/dist/event-action/actions.d.ts +3 -0
- package/dist/event-action/comp-action-select.d.ts +11 -0
- package/dist/event-action/config.d.ts +13 -0
- package/dist/event-action/index.d.ts +459 -0
- package/dist/event-action/schema.d.ts +32 -0
- package/dist/exports.min.js +1 -1
- package/dist/index.d.ts +23 -5
- package/dist/index.min.js +1 -1
- package/dist/manager.d.ts +46 -1
- package/dist/plugin/Alert.d.ts +4 -2
- package/dist/plugin/Button.d.ts +5 -1
- package/dist/plugin/ButtonGroup.d.ts +13 -34
- package/dist/plugin/ButtonToolbar.d.ts +4 -10
- package/dist/plugin/CRUD.d.ts +2 -0
- package/dist/plugin/Chart.d.ts +2 -0
- package/dist/plugin/Collapse.d.ts +1 -0
- package/dist/plugin/CollapseGroup.d.ts +28 -4
- package/dist/plugin/Container.d.ts +2 -1
- package/dist/plugin/Dialog.d.ts +12 -2
- package/dist/plugin/Drawer.d.ts +12 -2
- package/dist/plugin/DropDownButton.d.ts +11 -11
- package/dist/plugin/Form/ButtonGroupSelect.d.ts +7 -2
- package/dist/plugin/Form/ButtonToolbar.d.ts +8 -7
- package/dist/plugin/Form/ChainedSelect.d.ts +3 -0
- package/dist/plugin/Form/Checkbox.d.ts +7 -2
- package/dist/plugin/Form/Checkboxes.d.ts +8 -2
- package/dist/plugin/Form/CodeEditor.d.ts +7 -22
- package/dist/plugin/Form/Combo.d.ts +3 -0
- package/dist/plugin/Form/Control.d.ts +6 -2
- package/dist/plugin/Form/DiffEditor.d.ts +7 -1
- package/dist/plugin/Form/Form.d.ts +6 -0
- package/dist/plugin/Form/Formula.d.ts +1 -25
- package/dist/plugin/Form/InputDate.d.ts +8 -2
- package/dist/plugin/Form/InputDateRange.d.ts +8 -2
- package/dist/plugin/Form/InputDateTime.d.ts +4 -4
- package/dist/plugin/Form/InputDateTimeRange.d.ts +4 -4
- package/dist/plugin/Form/InputEmail.d.ts +1 -0
- package/dist/plugin/Form/InputExcel.d.ts +6 -41
- package/dist/plugin/Form/InputFile.d.ts +7 -3
- package/dist/plugin/Form/InputKV.d.ts +6 -0
- package/dist/plugin/Form/InputMonth.d.ts +1 -0
- package/dist/plugin/Form/InputMonthRange.d.ts +4 -4
- package/dist/plugin/Form/InputPassword.d.ts +1 -0
- package/dist/plugin/Form/InputQuarter.d.ts +1 -0
- package/dist/plugin/Form/InputQuarterRange.d.ts +4 -4
- package/dist/plugin/Form/InputRange.d.ts +3 -0
- package/dist/plugin/Form/InputRating.d.ts +9 -3
- package/dist/plugin/Form/InputText.d.ts +24 -2
- package/dist/plugin/Form/InputTime.d.ts +3 -3
- package/dist/plugin/Form/InputTimeRange.d.ts +20 -0
- package/dist/plugin/Form/InputTree.d.ts +6 -2
- package/dist/plugin/Form/InputURL.d.ts +1 -0
- package/dist/plugin/Form/InputYear.d.ts +1 -0
- package/dist/plugin/Form/InputYearRange.d.ts +20 -0
- package/dist/plugin/Form/ListSelect.d.ts +6 -2
- package/dist/plugin/Form/LocationPicker.d.ts +1 -31
- package/dist/plugin/Form/NestedSelect.d.ts +5 -2
- package/dist/plugin/Form/Radios.d.ts +7 -2
- package/dist/plugin/Form/Select.d.ts +7 -2
- package/dist/plugin/Form/Switch.d.ts +7 -2
- package/dist/plugin/Form/TabsTransfer.d.ts +5 -2
- package/dist/plugin/Form/Textarea.d.ts +7 -1
- package/dist/plugin/Form/Transfer.d.ts +5 -2
- package/dist/plugin/Form/TreeSelect.d.ts +6 -2
- package/dist/plugin/IFrame.d.ts +2 -2
- package/dist/plugin/Nav.d.ts +1 -116
- package/dist/plugin/Others/Action.d.ts +5 -1
- package/dist/plugin/Page.d.ts +5 -2
- package/dist/plugin/Progress.d.ts +5 -1
- package/dist/plugin/Table.d.ts +2 -0
- package/dist/plugin/Tabs.d.ts +33 -2
- package/dist/plugin/TooltipWrapper.d.ts +10 -0
- package/dist/plugin/Tpl.d.ts +2 -1
- package/dist/plugin/Wizard.d.ts +4 -1
- package/dist/plugin.d.ts +37 -1
- package/dist/store/editor.d.ts +65 -38
- package/dist/store/node.d.ts +16 -0
- package/dist/style.css +1 -1
- package/dist/util.d.ts +36 -3
- package/package.json +14 -8
- package/src/component/schemaTpl.tsx +1198 -474
- package/src/plugin/.DS_Store +0 -0
- package/src/plugin/Alert.tsx +69 -48
- package/src/plugin/AnchorNav.tsx +1 -0
- package/src/plugin/Audio.tsx +9 -15
- package/src/plugin/Avatar.tsx +2 -1
- package/src/plugin/Breadcrumb.tsx +2 -1
- package/src/plugin/Button.tsx +257 -188
- package/src/plugin/ButtonGroup.tsx +99 -38
- package/src/plugin/ButtonToolbar.tsx +7 -13
- package/src/plugin/CRUD.tsx +77 -135
- package/src/plugin/Card.tsx +1 -0
- package/src/plugin/Cards.tsx +8 -14
- package/src/plugin/Carousel.tsx +1 -1
- package/src/plugin/Chart.tsx +26 -14
- package/src/plugin/Collapse.tsx +78 -78
- package/src/plugin/CollapseGroup.tsx +165 -83
- package/src/plugin/Container.tsx +59 -6
- package/src/plugin/Custom.tsx +2 -8
- package/src/plugin/CustomRegion.tsx +4 -3
- package/src/plugin/Dialog.tsx +55 -24
- package/src/plugin/Drawer.tsx +65 -35
- package/src/plugin/DropDownButton.tsx +95 -79
- package/src/plugin/Flex.tsx +123 -65
- package/src/plugin/Form/ButtonGroupSelect.tsx +114 -26
- package/src/plugin/Form/ButtonToolbar.tsx +62 -55
- package/src/plugin/Form/ChainedSelect.tsx +45 -0
- package/src/plugin/Form/Checkbox.tsx +122 -33
- package/src/plugin/Form/Checkboxes.tsx +154 -87
- package/src/plugin/Form/CodeEditor.tsx +163 -34
- package/src/plugin/Form/Combo.tsx +104 -65
- package/src/plugin/Form/Control.tsx +16 -70
- package/src/plugin/Form/DiffEditor.tsx +158 -54
- package/src/plugin/Form/FieldSet.tsx +6 -11
- package/src/plugin/Form/Form.tsx +277 -70
- package/src/plugin/Form/Formula.tsx +8 -14
- package/src/plugin/Form/InputArray.tsx +7 -16
- package/src/plugin/Form/InputCity.tsx +1 -1
- package/src/plugin/Form/InputDate.tsx +344 -121
- package/src/plugin/Form/InputDateRange.tsx +303 -161
- package/src/plugin/Form/InputDateTime.tsx +6 -150
- package/src/plugin/Form/InputDateTimeRange.tsx +7 -187
- package/src/plugin/Form/InputEmail.tsx +1 -0
- package/src/plugin/Form/InputExcel.tsx +70 -27
- package/src/plugin/Form/InputFile.tsx +326 -152
- package/src/plugin/Form/InputImage.tsx +1 -1
- package/src/plugin/Form/InputKV.tsx +61 -0
- package/src/plugin/Form/InputMonth.tsx +3 -1
- package/src/plugin/Form/InputMonthRange.tsx +6 -160
- package/src/plugin/Form/InputNumber.tsx +1 -1
- package/src/plugin/Form/InputPassword.tsx +2 -0
- package/src/plugin/Form/InputQuarter.tsx +3 -1
- package/src/plugin/Form/InputQuarterRange.tsx +6 -160
- package/src/plugin/Form/InputRange.tsx +74 -4
- package/src/plugin/Form/InputRating.tsx +347 -35
- package/src/plugin/Form/InputRichText.tsx +2 -3
- package/src/plugin/Form/InputTable.tsx +33 -49
- package/src/plugin/Form/InputTag.tsx +1 -1
- package/src/plugin/Form/InputText.tsx +310 -132
- package/src/plugin/Form/InputTime.tsx +4 -53
- package/src/plugin/Form/InputTimeRange.tsx +41 -0
- package/src/plugin/Form/InputTree.tsx +196 -46
- package/src/plugin/Form/InputURL.tsx +2 -0
- package/src/plugin/Form/InputYear.tsx +2 -0
- package/src/plugin/Form/InputYearRange.tsx +41 -0
- package/src/plugin/Form/Item.tsx +17 -18
- package/src/plugin/Form/ListSelect.tsx +75 -20
- package/src/plugin/Form/LocationPicker.tsx +2 -7
- package/src/plugin/Form/MatrixCheckboxes.tsx +1 -1
- package/src/plugin/Form/NestedSelect.tsx +110 -43
- package/src/plugin/Form/Picker.tsx +2 -5
- package/src/plugin/Form/Radios.tsx +122 -52
- package/src/plugin/Form/Select.tsx +239 -168
- package/src/plugin/Form/Static.tsx +1 -1
- package/src/plugin/Form/Switch.tsx +170 -58
- package/src/plugin/Form/TabsTransfer.tsx +175 -79
- package/src/plugin/Form/Textarea.tsx +146 -36
- package/src/plugin/Form/Transfer.tsx +295 -233
- package/src/plugin/Form/TreeSelect.tsx +287 -146
- package/src/plugin/Grid.tsx +340 -312
- package/src/plugin/HBox.tsx +1 -0
- package/src/plugin/IFrame.tsx +21 -12
- package/src/plugin/Image.tsx +7 -12
- package/src/plugin/Images.tsx +7 -12
- package/src/plugin/Link.tsx +6 -12
- package/src/plugin/List.tsx +6 -10
- package/src/plugin/ListItem.tsx +1 -0
- package/src/plugin/Nav.tsx +7 -9
- package/src/plugin/Others/Action.tsx +16 -10
- package/src/plugin/Others/BasicToolbar.tsx +4 -1
- package/src/plugin/Others/TableCell.tsx +19 -39
- package/src/plugin/Page.tsx +315 -229
- package/src/plugin/Panel.tsx +6 -7
- package/src/plugin/Plain.tsx +3 -6
- package/src/plugin/Progress.tsx +234 -94
- package/src/plugin/Service.tsx +10 -6
- package/src/plugin/Table.tsx +49 -20
- package/src/plugin/TableView.tsx +212 -106
- package/src/plugin/Tabs.tsx +306 -146
- package/src/plugin/TooltipWrapper.tsx +231 -135
- package/src/plugin/Tpl.tsx +68 -52
- package/src/plugin/Video.tsx +9 -20
- package/src/plugin/Wizard.tsx +537 -336
- package/src/plugin/Wrapper.tsx +82 -61
- package/src/plugin.ts +66 -4
- package/static/empty.png +0 -0
@@ -19,6 +19,7 @@ import React from 'react';
|
|
19
19
|
import {diff, JSONPipeIn} from '../../../src/util';
|
20
20
|
import {JSONPipeOut} from '../../util';
|
21
21
|
import {mockValue} from '../../mocker';
|
22
|
+
import {RendererAction, RendererEvent} from '../../event-action';
|
22
23
|
import {setVariable} from 'amis-core';
|
23
24
|
|
24
25
|
export class ComboControlPlugin extends BasePlugin {
|
@@ -75,6 +76,81 @@ export class ComboControlPlugin extends BasePlugin {
|
|
75
76
|
]
|
76
77
|
};
|
77
78
|
|
79
|
+
// 事件定义
|
80
|
+
events: RendererEvent[] = [
|
81
|
+
{
|
82
|
+
eventName: 'add',
|
83
|
+
eventLabel: '添加',
|
84
|
+
description: '添加组合项时触发',
|
85
|
+
dataSchema: [
|
86
|
+
{
|
87
|
+
type: 'object',
|
88
|
+
properties: {
|
89
|
+
'event.data.value': {
|
90
|
+
type: 'object',
|
91
|
+
title: '当前组合项的值'
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
]
|
96
|
+
},
|
97
|
+
{
|
98
|
+
eventName: 'delete',
|
99
|
+
eventLabel: '删除',
|
100
|
+
description: '删除组合项',
|
101
|
+
dataSchema: [
|
102
|
+
{
|
103
|
+
type: 'object',
|
104
|
+
properties: {
|
105
|
+
'event.data.key': {
|
106
|
+
type: 'string',
|
107
|
+
title: '删除项的索引'
|
108
|
+
},
|
109
|
+
'event.data.value': {
|
110
|
+
type: 'string',
|
111
|
+
title: '现有组合项的值'
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
115
|
+
]
|
116
|
+
},
|
117
|
+
{
|
118
|
+
eventName: 'tabsChange',
|
119
|
+
eventLabel: '切换tab',
|
120
|
+
description: '当设置 tabsMode 为 true 时,切换选项卡时触发',
|
121
|
+
dataSchema: [
|
122
|
+
{
|
123
|
+
type: 'object',
|
124
|
+
properties: {
|
125
|
+
'event.data.key': {
|
126
|
+
type: 'string',
|
127
|
+
title: '选项卡索引'
|
128
|
+
}
|
129
|
+
}
|
130
|
+
}
|
131
|
+
]
|
132
|
+
}
|
133
|
+
];
|
134
|
+
|
135
|
+
// 动作定义
|
136
|
+
actions: RendererAction[] = [
|
137
|
+
{
|
138
|
+
actionType: 'clear',
|
139
|
+
actionLabel: '清空',
|
140
|
+
description: '清除选中值'
|
141
|
+
},
|
142
|
+
{
|
143
|
+
actionType: 'reset',
|
144
|
+
actionLabel: '重置',
|
145
|
+
description: '将值重置为resetValue,若没有配置resetValue,则清空'
|
146
|
+
},
|
147
|
+
{
|
148
|
+
actionType: 'setValue',
|
149
|
+
actionLabel: '赋值',
|
150
|
+
description: '触发组件数据更新'
|
151
|
+
}
|
152
|
+
];
|
153
|
+
|
78
154
|
panelTitle = '组合输入';
|
79
155
|
panelBodyCreator = (context: BaseEventContext) => {
|
80
156
|
return [
|
@@ -191,15 +267,12 @@ export class ComboControlPlugin extends BasePlugin {
|
|
191
267
|
}
|
192
268
|
},
|
193
269
|
|
194
|
-
{
|
270
|
+
getSchemaTpl('switch', {
|
195
271
|
name: 'typeSwitchable',
|
196
272
|
visibleOn: 'this.conditions',
|
197
273
|
label: '是否可切换类型',
|
198
|
-
type: 'switch',
|
199
|
-
mode: 'inline',
|
200
|
-
className: 'block',
|
201
274
|
pipeIn: defaultValue(true)
|
202
|
-
},
|
275
|
+
}),
|
203
276
|
|
204
277
|
{
|
205
278
|
name: 'items',
|
@@ -245,41 +318,32 @@ export class ComboControlPlugin extends BasePlugin {
|
|
245
318
|
visibleOn: 'typeof this.value !== "undefined"'
|
246
319
|
},
|
247
320
|
|
248
|
-
{
|
321
|
+
getSchemaTpl('switch', {
|
249
322
|
label: '多行模式',
|
250
323
|
name: 'multiLine',
|
251
|
-
type: 'switch',
|
252
|
-
mode: 'inline',
|
253
|
-
className: 'w-full',
|
254
324
|
value: false,
|
255
|
-
|
256
|
-
},
|
325
|
+
description: '即是否要换行'
|
326
|
+
}),
|
257
327
|
|
258
328
|
getSchemaTpl('multiple'),
|
259
329
|
getSchemaTpl('joinValues'),
|
260
330
|
getSchemaTpl('delimiter'),
|
261
331
|
|
262
|
-
{
|
263
|
-
type: 'switch',
|
332
|
+
getSchemaTpl('switch', {
|
264
333
|
name: 'flat',
|
265
|
-
mode: 'inline',
|
266
|
-
className: 'w-full',
|
267
334
|
label: '是否将值打平',
|
268
335
|
visibleOn:
|
269
336
|
'Array.isArray(data.items) && data.items.length === 1 && data.multiple',
|
270
337
|
description:
|
271
338
|
'默认数组内的数据结构为对象,如果只有一个表单项,可以配置将值打平,那么数组内放置的就是那个表单项的值'
|
272
|
-
},
|
339
|
+
}),
|
273
340
|
|
274
|
-
{
|
341
|
+
getSchemaTpl('switch', {
|
275
342
|
label: '是否可新增',
|
276
|
-
type: 'switch',
|
277
343
|
name: 'addable',
|
278
|
-
mode: 'inline',
|
279
|
-
className: 'w-full',
|
280
344
|
visibleOn: 'this.multiple',
|
281
345
|
pipeIn: defaultValue(true)
|
282
|
-
},
|
346
|
+
}),
|
283
347
|
|
284
348
|
{
|
285
349
|
type: 'textarea',
|
@@ -298,15 +362,12 @@ export class ComboControlPlugin extends BasePlugin {
|
|
298
362
|
pipeIn: defaultValue('新增')
|
299
363
|
},
|
300
364
|
|
301
|
-
{
|
365
|
+
getSchemaTpl('switch', {
|
302
366
|
label: '是否可删除',
|
303
|
-
type: 'switch',
|
304
367
|
name: 'removable',
|
305
|
-
mode: 'inline',
|
306
|
-
className: 'w-full',
|
307
368
|
visibleOn: 'this.multiple',
|
308
369
|
pipeIn: defaultValue(true)
|
309
|
-
},
|
370
|
+
}),
|
310
371
|
|
311
372
|
getSchemaTpl('api', {
|
312
373
|
name: 'deleteApi',
|
@@ -322,14 +383,11 @@ export class ComboControlPlugin extends BasePlugin {
|
|
322
383
|
pipeIn: defaultValue('确认要删除')
|
323
384
|
},
|
324
385
|
|
325
|
-
{
|
386
|
+
getSchemaTpl('switch', {
|
326
387
|
name: 'draggable',
|
327
388
|
label: '是否可拖拽排序',
|
328
|
-
|
329
|
-
|
330
|
-
mode: 'inline',
|
331
|
-
className: 'w-full'
|
332
|
-
},
|
389
|
+
visibleOn: 'this.multiple'
|
390
|
+
}),
|
333
391
|
|
334
392
|
{
|
335
393
|
label: '拖拽排序的提示文字',
|
@@ -339,14 +397,11 @@ export class ComboControlPlugin extends BasePlugin {
|
|
339
397
|
pipeIn: defaultValue('可通过拖动每行中的【交换】按钮进行顺序调整')
|
340
398
|
},
|
341
399
|
|
342
|
-
{
|
400
|
+
getSchemaTpl('switch', {
|
343
401
|
name: 'noBorder',
|
344
402
|
label: '去掉边框',
|
345
|
-
|
346
|
-
|
347
|
-
mode: 'inline',
|
348
|
-
className: 'w-full'
|
349
|
-
},
|
403
|
+
visibleOn: 'this.multiLine'
|
404
|
+
}),
|
350
405
|
|
351
406
|
{
|
352
407
|
name: 'minLength',
|
@@ -387,23 +442,17 @@ export class ComboControlPlugin extends BasePlugin {
|
|
387
442
|
]
|
388
443
|
},
|
389
444
|
|
390
|
-
{
|
445
|
+
getSchemaTpl('switch', {
|
391
446
|
name: 'canAccessSuperData',
|
392
447
|
label: '是否自动填充父级同名变量',
|
393
|
-
|
394
|
-
|
395
|
-
mode: 'inline',
|
396
|
-
className: 'w-full'
|
397
|
-
},
|
448
|
+
pipeIn: defaultValue(false)
|
449
|
+
}),
|
398
450
|
|
399
|
-
{
|
451
|
+
getSchemaTpl('switch', {
|
400
452
|
name: 'tabsMode',
|
401
453
|
label: '采用 Tabs 展示方式',
|
402
|
-
type: 'switch',
|
403
|
-
mode: 'inline',
|
404
|
-
className: 'w-full',
|
405
454
|
pipeIn: defaultValue(false)
|
406
|
-
},
|
455
|
+
}),
|
407
456
|
|
408
457
|
{
|
409
458
|
name: 'tabsStyle',
|
@@ -437,25 +486,19 @@ export class ComboControlPlugin extends BasePlugin {
|
|
437
486
|
className: 'w-full'
|
438
487
|
},
|
439
488
|
|
440
|
-
{
|
489
|
+
getSchemaTpl('switch', {
|
441
490
|
name: 'lazyLoad',
|
442
491
|
label: '懒加载',
|
443
|
-
type: 'switch',
|
444
|
-
mode: 'inline',
|
445
|
-
className: 'w-full',
|
446
492
|
pipeIn: defaultValue(false),
|
447
493
|
description: '如果数据比较多,比较卡顿时,可开启此配置项'
|
448
|
-
},
|
494
|
+
}),
|
449
495
|
|
450
|
-
{
|
496
|
+
getSchemaTpl('switch', {
|
451
497
|
name: 'strictMode',
|
452
498
|
label: '严格模式',
|
453
|
-
type: 'switch',
|
454
|
-
mode: 'inline',
|
455
|
-
className: 'w-full',
|
456
499
|
pipeIn: defaultValue(true),
|
457
500
|
description: '如果你希望环境变量的值实时透传到 Combo 中,请关闭此选项。'
|
458
|
-
},
|
501
|
+
}),
|
459
502
|
|
460
503
|
{
|
461
504
|
name: 'syncFields',
|
@@ -468,17 +511,13 @@ export class ComboControlPlugin extends BasePlugin {
|
|
468
511
|
description:
|
469
512
|
'如果 Combo 层级比较深,底层的获取外层的数据可能不同步。但是给 combo 配置这个属性就能同步下来。'
|
470
513
|
},
|
471
|
-
|
472
|
-
{
|
514
|
+
getSchemaTpl('switch', {
|
473
515
|
name: 'nullable',
|
474
516
|
label: '允许为空',
|
475
|
-
type: 'switch',
|
476
|
-
mode: 'inline',
|
477
|
-
className: 'w-full',
|
478
517
|
pipeIn: defaultValue(false),
|
479
518
|
description:
|
480
519
|
'如果子表单项里面配置验证器,且又是单条模式。可以允许用户选择清空(不填)。'
|
481
|
-
},
|
520
|
+
}),
|
482
521
|
|
483
522
|
{
|
484
523
|
name: 'items',
|
@@ -2,7 +2,8 @@ import React from 'react';
|
|
2
2
|
import {Button} from 'amis';
|
3
3
|
import {getSchemaTpl} from '../../component/schemaTpl';
|
4
4
|
import {registerEditorPlugin} from '../../manager';
|
5
|
-
import {BasePlugin, RegionConfig} from '../../plugin';
|
5
|
+
import {BasePlugin, RegionConfig, BaseEventContext} from '../../plugin';
|
6
|
+
import {formItemControl} from '../../component/control/BaseControl';
|
6
7
|
|
7
8
|
export class ControlPlugin extends BasePlugin {
|
8
9
|
// 关联渲染器名字
|
@@ -16,6 +17,10 @@ export class ControlPlugin extends BasePlugin {
|
|
16
17
|
description = `表单项容器`;
|
17
18
|
docLink = '/amis/zh-CN/components/form/group';
|
18
19
|
tags = ['容器'];
|
20
|
+
/**
|
21
|
+
* 组件选择面板中隐藏,和Container合并
|
22
|
+
*/
|
23
|
+
disabledRendererPlugin = true;
|
19
24
|
scaffold = {
|
20
25
|
type: 'control',
|
21
26
|
label: '表单项容器',
|
@@ -43,15 +48,15 @@ export class ControlPlugin extends BasePlugin {
|
|
43
48
|
{
|
44
49
|
key: 'body',
|
45
50
|
label: '元素集合',
|
46
|
-
preferTag: '
|
51
|
+
preferTag: '表单项'
|
47
52
|
}
|
48
53
|
];
|
49
54
|
|
50
55
|
panelTitle = '表单项容器';
|
51
|
-
|
52
|
-
|
53
|
-
{
|
54
|
-
|
56
|
+
panelBodyCreator = (context: BaseEventContext) => {
|
57
|
+
return formItemControl({
|
58
|
+
common: {
|
59
|
+
replace: true,
|
55
60
|
body: [
|
56
61
|
{
|
57
62
|
children: (
|
@@ -67,73 +72,14 @@ export class ControlPlugin extends BasePlugin {
|
|
67
72
|
</Button>
|
68
73
|
)
|
69
74
|
},
|
70
|
-
getSchemaTpl('
|
71
|
-
getSchemaTpl('placeholder'),
|
75
|
+
getSchemaTpl('labelRemark'),
|
72
76
|
getSchemaTpl('remark'),
|
73
|
-
getSchemaTpl('
|
74
|
-
|
75
|
-
},
|
76
|
-
|
77
|
-
{
|
78
|
-
title: '外观',
|
79
|
-
body: [
|
80
|
-
getSchemaTpl('formItemMode'),
|
81
|
-
getSchemaTpl('horizontalMode'),
|
82
|
-
getSchemaTpl('horizontal', {
|
83
|
-
label: '',
|
84
|
-
visibleOn:
|
85
|
-
'data.mode == "horizontal" && data.label !== false && data.horizontal'
|
86
|
-
}),
|
87
|
-
|
88
|
-
// renderer.sizeMutable !== false
|
89
|
-
// ? getSchemaTpl('formItemSize')
|
90
|
-
// : null,
|
91
|
-
getSchemaTpl('formItemInline'),
|
92
|
-
|
93
|
-
getSchemaTpl('className'),
|
94
|
-
getSchemaTpl('className', {
|
95
|
-
label: 'Label CSS 类名',
|
96
|
-
name: 'labelClassName'
|
97
|
-
}),
|
98
|
-
getSchemaTpl('className', {
|
99
|
-
label: '控件 CSS 类名',
|
100
|
-
name: 'inputClassName'
|
101
|
-
}),
|
102
|
-
getSchemaTpl('className', {
|
103
|
-
label: '描述 CSS 类名',
|
104
|
-
name: 'descriptionClassName',
|
105
|
-
visibleOn: 'this.description'
|
106
|
-
})
|
107
|
-
]
|
108
|
-
},
|
109
|
-
|
110
|
-
{
|
111
|
-
title: '显隐',
|
112
|
-
body: [
|
113
|
-
// TODO: 有些表单项没有 disabled
|
114
|
-
getSchemaTpl('disabled'),
|
115
|
-
getSchemaTpl('visible'),
|
116
|
-
{
|
117
|
-
type: 'switch',
|
118
|
-
name: 'clearValueOnHidden',
|
119
|
-
label: '隐藏时删除表单项值',
|
120
|
-
mode: 'inline',
|
121
|
-
className: 'w-full'
|
122
|
-
}
|
123
|
-
]
|
124
|
-
},
|
125
|
-
{
|
126
|
-
title: '验证',
|
127
|
-
body: [
|
128
|
-
// getSchemaTplByName('ref'),
|
129
|
-
getSchemaTpl('validations'),
|
130
|
-
getSchemaTpl('validationErrors'),
|
131
|
-
getSchemaTpl('validateOnChange'),
|
132
|
-
getSchemaTpl('submitOnChange')
|
77
|
+
getSchemaTpl('placeholder'),
|
78
|
+
getSchemaTpl('description')
|
133
79
|
]
|
134
80
|
}
|
135
|
-
|
136
|
-
|
81
|
+
});
|
82
|
+
};
|
137
83
|
}
|
138
84
|
|
139
85
|
registerEditorPlugin(ControlPlugin);
|
@@ -2,11 +2,17 @@ import {availableLanguages} from 'amis/lib/renderers/Form/Editor';
|
|
2
2
|
import {
|
3
3
|
defaultValue,
|
4
4
|
getSchemaTpl,
|
5
|
+
undefinedPipeOut,
|
5
6
|
valuePipeOut
|
6
7
|
} from '../../component/schemaTpl';
|
7
8
|
import {registerEditorPlugin} from '../../manager';
|
8
9
|
import {BasePlugin} from '../../plugin';
|
9
10
|
|
11
|
+
import type {BaseEventContext} from '../../plugin';
|
12
|
+
import {ValidatorTag} from '../../component/validator';
|
13
|
+
import {getEventControlConfig} from '../../util';
|
14
|
+
import {RendererAction, RendererEvent} from '../../event-action';
|
15
|
+
|
10
16
|
export class DiffEditorControlPlugin extends BasePlugin {
|
11
17
|
// 关联渲染器名字
|
12
18
|
rendererName = 'diff-editor';
|
@@ -40,72 +46,170 @@ export class DiffEditorControlPlugin extends BasePlugin {
|
|
40
46
|
]
|
41
47
|
};
|
42
48
|
|
43
|
-
|
44
|
-
panelBody = [
|
49
|
+
events: RendererEvent[] = [
|
45
50
|
{
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
+
eventName: 'focus',
|
52
|
+
eventLabel: '获取焦点',
|
53
|
+
description: '右侧输入框获取焦点时触发',
|
54
|
+
dataSchema: [
|
55
|
+
{
|
56
|
+
type: 'object',
|
57
|
+
properties: {
|
58
|
+
'event.data.value': {
|
59
|
+
type: 'string',
|
60
|
+
title: '当前代码'
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
]
|
51
65
|
},
|
66
|
+
{
|
67
|
+
eventName: 'blur',
|
68
|
+
eventLabel: '失去焦点',
|
69
|
+
description: '右侧输入框失去焦点时触发',
|
70
|
+
dataSchema: [
|
71
|
+
{
|
72
|
+
type: 'object',
|
73
|
+
properties: {
|
74
|
+
'event.data.value': {
|
75
|
+
type: 'string',
|
76
|
+
title: '当前代码'
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
]
|
81
|
+
}
|
82
|
+
];
|
52
83
|
|
53
|
-
|
54
|
-
label: '设置右侧默认值'
|
55
|
-
}),
|
56
|
-
|
84
|
+
actions: RendererAction[] = [
|
57
85
|
{
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
pipeOut: valuePipeOut,
|
62
|
-
visibleOn: 'typeof this.value !== "undefined"'
|
86
|
+
actionType: 'clear',
|
87
|
+
actionLabel: '清空',
|
88
|
+
description: '清除选中值'
|
63
89
|
},
|
64
|
-
|
65
90
|
{
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
value: 'javascript',
|
70
|
-
searchable: true,
|
71
|
-
options: availableLanguages.concat()
|
91
|
+
actionType: 'reset',
|
92
|
+
actionLabel: '重置',
|
93
|
+
description: '将值重置为resetValue,若没有配置resetValue,则清空'
|
72
94
|
},
|
73
|
-
|
74
95
|
{
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
},
|
96
|
+
actionType: 'focus',
|
97
|
+
actionLabel: '获取焦点',
|
98
|
+
description: '获取焦点,焦点落在右侧编辑面板'
|
99
|
+
},
|
100
|
+
{
|
101
|
+
actionType: 'setValue',
|
102
|
+
actionLabel: '赋值',
|
103
|
+
description: '触发组件数据更新'
|
104
|
+
}
|
105
|
+
];
|
86
106
|
|
87
|
-
|
88
|
-
label: '中',
|
89
|
-
value: 'md'
|
90
|
-
},
|
107
|
+
notRenderFormZone = true;
|
91
108
|
|
92
|
-
|
93
|
-
label: '大',
|
94
|
-
value: 'lg'
|
95
|
-
},
|
109
|
+
panelTitle = 'Diff编辑器';
|
96
110
|
|
97
|
-
|
98
|
-
label: '加大',
|
99
|
-
value: 'xl'
|
100
|
-
},
|
111
|
+
panelJustify = true;
|
101
112
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
113
|
+
panelBodyCreator = (context: BaseEventContext) => {
|
114
|
+
return getSchemaTpl('tabs', [
|
115
|
+
{
|
116
|
+
title: '属性',
|
117
|
+
body: getSchemaTpl('collapseGroup', [
|
118
|
+
{
|
119
|
+
title: '基本',
|
120
|
+
body: [
|
121
|
+
getSchemaTpl('formItemName', {
|
122
|
+
required: true
|
123
|
+
}),
|
124
|
+
getSchemaTpl('label'),
|
125
|
+
{
|
126
|
+
label: '语言',
|
127
|
+
name: 'language',
|
128
|
+
type: 'select',
|
129
|
+
value: 'javascript',
|
130
|
+
searchable: true,
|
131
|
+
options: availableLanguages.concat()
|
132
|
+
},
|
133
|
+
{
|
134
|
+
type: 'textarea',
|
135
|
+
name: 'diffValue',
|
136
|
+
label: '左侧默认值',
|
137
|
+
pipeOut: valuePipeOut,
|
138
|
+
placeholder: '支持使用 ${xxx} 来获取变量'
|
139
|
+
},
|
140
|
+
{
|
141
|
+
type: 'textarea',
|
142
|
+
name: 'value',
|
143
|
+
label: '右侧默认值',
|
144
|
+
placeholder: '支持使用 ${xxx} 来获取变量'
|
145
|
+
},
|
146
|
+
getSchemaTpl('labelRemark'),
|
147
|
+
getSchemaTpl('remark'),
|
148
|
+
getSchemaTpl('description')
|
149
|
+
]
|
150
|
+
},
|
151
|
+
getSchemaTpl('status', {isFormItem: true}),
|
152
|
+
getSchemaTpl('validation', {
|
153
|
+
tag: ValidatorTag.All
|
154
|
+
})
|
155
|
+
])
|
156
|
+
},
|
157
|
+
{
|
158
|
+
title: '外观',
|
159
|
+
body: getSchemaTpl('collapseGroup', [
|
160
|
+
getSchemaTpl('style:formItem', {
|
161
|
+
renderer: context.info.renderer,
|
162
|
+
schema: [
|
163
|
+
{
|
164
|
+
name: 'size',
|
165
|
+
type: 'select',
|
166
|
+
pipeIn: defaultValue(''),
|
167
|
+
pipeOut: undefinedPipeOut,
|
168
|
+
label: '控件尺寸',
|
169
|
+
options: [
|
170
|
+
{
|
171
|
+
label: '默认',
|
172
|
+
value: ''
|
173
|
+
},
|
174
|
+
|
175
|
+
{
|
176
|
+
label: '中',
|
177
|
+
value: 'md'
|
178
|
+
},
|
179
|
+
|
180
|
+
{
|
181
|
+
label: '大',
|
182
|
+
value: 'lg'
|
183
|
+
},
|
184
|
+
|
185
|
+
{
|
186
|
+
label: '特大',
|
187
|
+
value: 'xl'
|
188
|
+
},
|
189
|
+
|
190
|
+
{
|
191
|
+
label: '超大',
|
192
|
+
value: 'xxl'
|
193
|
+
}
|
194
|
+
]
|
195
|
+
}
|
196
|
+
]
|
197
|
+
}),
|
198
|
+
getSchemaTpl('style:classNames')
|
199
|
+
])
|
200
|
+
},
|
201
|
+
{
|
202
|
+
title: '事件',
|
203
|
+
className: 'p-none',
|
204
|
+
body: [
|
205
|
+
getSchemaTpl('eventControl', {
|
206
|
+
name: 'onEvent',
|
207
|
+
...getEventControlConfig(this.manager, context)
|
208
|
+
})
|
209
|
+
]
|
210
|
+
}
|
211
|
+
]);
|
212
|
+
};
|
109
213
|
}
|
110
214
|
|
111
215
|
registerEditorPlugin(DiffEditorControlPlugin);
|
@@ -66,22 +66,17 @@ export class FieldSetControlPlugin extends BasePlugin {
|
|
66
66
|
// required: true
|
67
67
|
},
|
68
68
|
|
69
|
-
{
|
69
|
+
getSchemaTpl('switch', {
|
70
70
|
name: 'collapsable',
|
71
71
|
label: '是否可折叠',
|
72
|
-
type: 'switch',
|
73
|
-
mode: 'inline',
|
74
|
-
className: 'w-full',
|
75
72
|
pipeIn: defaultValue(false)
|
76
|
-
},
|
77
|
-
|
73
|
+
}),
|
74
|
+
|
75
|
+
getSchemaTpl('switch', {
|
78
76
|
name: 'collapsed',
|
79
77
|
label: '默认是否折叠',
|
80
|
-
|
81
|
-
|
82
|
-
visibleOn: 'this.collapsable',
|
83
|
-
className: 'w-full'
|
84
|
-
},
|
78
|
+
visibleOn: 'this.collapsable'
|
79
|
+
}),
|
85
80
|
|
86
81
|
{
|
87
82
|
name: 'className',
|