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
@@ -1,6 +1,10 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import {RendererAction, RendererEvent} from '../../event-action';
|
1
3
|
import {defaultValue, getSchemaTpl} from '../../component/schemaTpl';
|
4
|
+
import {getComboWrapper} from '../../event-action/schema';
|
2
5
|
import {registerEditorPlugin} from '../../manager';
|
3
|
-
import {BasePlugin} from '../../plugin';
|
6
|
+
import {BaseEventContext, BasePlugin} from '../../plugin';
|
7
|
+
import {getEventControlConfig} from '../../util';
|
4
8
|
|
5
9
|
export class TreeControlPlugin extends BasePlugin {
|
6
10
|
// 关联渲染器名字
|
@@ -50,7 +54,158 @@ export class TreeControlPlugin extends BasePlugin {
|
|
50
54
|
}
|
51
55
|
};
|
52
56
|
|
57
|
+
notRenderFormZone = true;
|
58
|
+
|
53
59
|
panelTitle = '树选择';
|
60
|
+
|
61
|
+
// 事件定义
|
62
|
+
events: RendererEvent[] = [
|
63
|
+
{
|
64
|
+
eventName: 'change',
|
65
|
+
eventLabel: '值变化',
|
66
|
+
description: '选中值变化时触发',
|
67
|
+
dataSchema: [
|
68
|
+
{
|
69
|
+
type: 'object',
|
70
|
+
properties: {
|
71
|
+
'event.data.value': {
|
72
|
+
type: 'string',
|
73
|
+
title: '选中节点的值'
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
77
|
+
]
|
78
|
+
},
|
79
|
+
{
|
80
|
+
eventName: 'add',
|
81
|
+
eventLabel: '新增选项',
|
82
|
+
description: '新增节点提交时触发',
|
83
|
+
dataSchema: [
|
84
|
+
{
|
85
|
+
type: 'object',
|
86
|
+
properties: {
|
87
|
+
'event.data.value': {
|
88
|
+
type: 'object',
|
89
|
+
title: '新增的节点信息'
|
90
|
+
},
|
91
|
+
'event.data.options': {
|
92
|
+
type: 'array',
|
93
|
+
title: '选项集合'
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
]
|
98
|
+
},
|
99
|
+
{
|
100
|
+
eventName: 'edit',
|
101
|
+
eventLabel: '编辑选项',
|
102
|
+
description: '编辑选项',
|
103
|
+
dataSchema: [
|
104
|
+
{
|
105
|
+
type: 'object',
|
106
|
+
properties: {
|
107
|
+
'event.data.value': {
|
108
|
+
type: 'object',
|
109
|
+
title: '编辑的节点信息'
|
110
|
+
},
|
111
|
+
'event.data.options': {
|
112
|
+
type: 'array',
|
113
|
+
title: '选项集合'
|
114
|
+
}
|
115
|
+
}
|
116
|
+
}
|
117
|
+
]
|
118
|
+
},
|
119
|
+
{
|
120
|
+
eventName: 'delete',
|
121
|
+
eventLabel: '删除选项',
|
122
|
+
description: '删除选项',
|
123
|
+
dataSchema: [
|
124
|
+
{
|
125
|
+
type: 'object',
|
126
|
+
properties: {
|
127
|
+
'event.data.value': {
|
128
|
+
type: 'object',
|
129
|
+
title: '删除的节点信息'
|
130
|
+
},
|
131
|
+
'event.data.options': {
|
132
|
+
type: 'array',
|
133
|
+
title: '选项集合'
|
134
|
+
}
|
135
|
+
}
|
136
|
+
}
|
137
|
+
]
|
138
|
+
},
|
139
|
+
{
|
140
|
+
eventName: 'loadFinished',
|
141
|
+
eventLabel: '懒加载完成',
|
142
|
+
description: '懒加载接口远程请求成功时触发',
|
143
|
+
dataSchema: [
|
144
|
+
{
|
145
|
+
type: 'object',
|
146
|
+
properties: {
|
147
|
+
'event.data.value': {
|
148
|
+
type: 'object',
|
149
|
+
title: 'deferApi 懒加载远程请求成功后返回的数据'
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
]
|
154
|
+
}
|
155
|
+
];
|
156
|
+
|
157
|
+
// 动作定义
|
158
|
+
actions: RendererAction[] = [
|
159
|
+
{
|
160
|
+
actionType: 'expand',
|
161
|
+
actionLabel: '展开',
|
162
|
+
description: '展开指定层级',
|
163
|
+
config: ['openLevel'],
|
164
|
+
desc: (info: any) => {
|
165
|
+
return (
|
166
|
+
<div>
|
167
|
+
<span className="variable-right">{info?.__rendererLabel}</span>
|
168
|
+
展开到第
|
169
|
+
<span className="variable-left variable-right">
|
170
|
+
{info?.args?.openLevel}
|
171
|
+
</span>
|
172
|
+
层
|
173
|
+
</div>
|
174
|
+
);
|
175
|
+
},
|
176
|
+
schema: getComboWrapper({
|
177
|
+
type: 'input-formula',
|
178
|
+
variables: '${variables}',
|
179
|
+
evalMode: false,
|
180
|
+
variableMode: 'tabs',
|
181
|
+
label: '展开层级',
|
182
|
+
size: 'lg',
|
183
|
+
name: 'openLevel',
|
184
|
+
mode: 'horizontal'
|
185
|
+
})
|
186
|
+
},
|
187
|
+
{
|
188
|
+
actionType: 'collapse',
|
189
|
+
actionLabel: '收起',
|
190
|
+
description: '收起树节点'
|
191
|
+
},
|
192
|
+
{
|
193
|
+
actionType: 'clear',
|
194
|
+
actionLabel: '清空',
|
195
|
+
description: '清除数据'
|
196
|
+
},
|
197
|
+
{
|
198
|
+
actionType: 'reset',
|
199
|
+
actionLabel: '重置',
|
200
|
+
description: '重置数据'
|
201
|
+
},
|
202
|
+
{
|
203
|
+
actionType: 'setValue',
|
204
|
+
actionLabel: '赋值',
|
205
|
+
description: '触发组件数据更新'
|
206
|
+
}
|
207
|
+
];
|
208
|
+
|
54
209
|
panelDefinitions = {
|
55
210
|
options: {
|
56
211
|
label: '选项 Options',
|
@@ -92,7 +247,7 @@ export class TreeControlPlugin extends BasePlugin {
|
|
92
247
|
]
|
93
248
|
}
|
94
249
|
};
|
95
|
-
|
250
|
+
panelBodyCreator = (context: BaseEventContext) =>
|
96
251
|
getSchemaTpl('tabs', [
|
97
252
|
{
|
98
253
|
title: '常规',
|
@@ -141,49 +296,41 @@ export class TreeControlPlugin extends BasePlugin {
|
|
141
296
|
2
|
142
297
|
)
|
143
298
|
}),
|
144
|
-
|
299
|
+
|
300
|
+
getSchemaTpl('switch', {
|
145
301
|
label: '隐藏顶级',
|
146
|
-
name: 'hideRoot'
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
},
|
151
|
-
{
|
302
|
+
name: 'hideRoot'
|
303
|
+
}),
|
304
|
+
|
305
|
+
getSchemaTpl('switch', {
|
152
306
|
name: 'showIcon',
|
153
307
|
label: '是否显示图标',
|
154
|
-
type: 'switch',
|
155
|
-
mode: 'inline',
|
156
|
-
className: 'w-full',
|
157
308
|
pipeIn: defaultValue(true)
|
158
|
-
},
|
309
|
+
}),
|
310
|
+
|
159
311
|
getSchemaTpl('multiple'),
|
160
|
-
|
312
|
+
|
313
|
+
getSchemaTpl('switch', {
|
161
314
|
name: 'cascade',
|
315
|
+
label: '不自动选中子节点',
|
162
316
|
visibleOn: 'data.multiple',
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
className: 'w-full'
|
168
|
-
},
|
169
|
-
{
|
317
|
+
description: '选中父级时,孩子节点是否自动选中'
|
318
|
+
}),
|
319
|
+
|
320
|
+
getSchemaTpl('switch', {
|
170
321
|
name: 'withChildren',
|
171
|
-
visibleOn: 'data.cascade !== true && data.multiple',
|
172
322
|
label: '数值是否携带子节点',
|
173
|
-
type: 'switch',
|
174
|
-
disabledOn: 'data.onlyChildren',
|
175
|
-
mode: 'inline',
|
176
|
-
className: 'w-full'
|
177
|
-
},
|
178
|
-
{
|
179
|
-
name: 'onlyChildren',
|
180
323
|
visibleOn: 'data.cascade !== true && data.multiple',
|
324
|
+
disabledOn: 'data.onlyChildren'
|
325
|
+
}),
|
326
|
+
|
327
|
+
getSchemaTpl('switch', {
|
328
|
+
name: 'onlyChildren',
|
181
329
|
label: '数值是否只包含子节点',
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
},
|
330
|
+
visibleOn: 'data.cascade !== true && data.multiple',
|
331
|
+
disabledOn: 'data.withChildren'
|
332
|
+
}),
|
333
|
+
|
187
334
|
getSchemaTpl('joinValues'),
|
188
335
|
getSchemaTpl('delimiter'),
|
189
336
|
getSchemaTpl('extractValue'),
|
@@ -203,27 +350,30 @@ export class TreeControlPlugin extends BasePlugin {
|
|
203
350
|
visibleOn: 'data.hideRoot !== true'
|
204
351
|
},
|
205
352
|
|
206
|
-
{
|
353
|
+
getSchemaTpl('switch', {
|
207
354
|
name: 'showIcon',
|
208
355
|
label: '是否显示图标',
|
209
|
-
type: 'switch',
|
210
|
-
mode: 'inline',
|
211
|
-
className: 'w-full',
|
212
356
|
pipeIn: defaultValue(true)
|
213
|
-
},
|
357
|
+
}),
|
214
358
|
|
215
|
-
{
|
359
|
+
getSchemaTpl('switch', {
|
216
360
|
label: '是否显示单选按钮',
|
217
361
|
name: 'showRadio',
|
218
|
-
type: 'switch',
|
219
|
-
mode: 'inline',
|
220
|
-
className: 'w-full',
|
221
362
|
visibleOn: '!data.multiple'
|
222
|
-
}
|
363
|
+
})
|
364
|
+
]
|
365
|
+
},
|
366
|
+
{
|
367
|
+
title: '事件',
|
368
|
+
className: 'p-none',
|
369
|
+
body: [
|
370
|
+
getSchemaTpl('eventControl', {
|
371
|
+
name: 'onEvent',
|
372
|
+
...getEventControlConfig(this.manager, context)
|
373
|
+
})
|
223
374
|
]
|
224
375
|
}
|
225
|
-
])
|
226
|
-
];
|
376
|
+
]);
|
227
377
|
}
|
228
378
|
|
229
379
|
registerEditorPlugin(TreeControlPlugin);
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import {registerEditorPlugin} from '../../manager';
|
2
|
+
|
3
|
+
import {DateRangeControlPlugin} from './InputDateRange';
|
4
|
+
|
5
|
+
export class YearRangeControlPlugin extends DateRangeControlPlugin {
|
6
|
+
// 关联渲染器名字
|
7
|
+
rendererName = 'input-year-range';
|
8
|
+
$schema = '/schemas/DateRangeControlSchema.json';
|
9
|
+
|
10
|
+
order = -440;
|
11
|
+
|
12
|
+
// 组件名称
|
13
|
+
icon = 'fa fa-calendar';
|
14
|
+
name = '日期范围';
|
15
|
+
isBaseComponent = true;
|
16
|
+
description =
|
17
|
+
'年份范围选择,可通过<code>minDate</code>、<code>maxDate</code>设定最小、最大日期';
|
18
|
+
docLink = '/amis/zh-CN/components/form/year-range';
|
19
|
+
tags = ['表单项'];
|
20
|
+
scaffold = {
|
21
|
+
type: 'input-year-range',
|
22
|
+
label: '日期范围',
|
23
|
+
name: 'year-range'
|
24
|
+
};
|
25
|
+
previewSchema: any = {
|
26
|
+
type: 'form',
|
27
|
+
className: 'text-left',
|
28
|
+
mode: 'horizontal',
|
29
|
+
wrapWithPanel: false,
|
30
|
+
body: [
|
31
|
+
{
|
32
|
+
...this.scaffold
|
33
|
+
}
|
34
|
+
]
|
35
|
+
};
|
36
|
+
|
37
|
+
disabledRendererPlugin = true;
|
38
|
+
notRenderFormZone = true;
|
39
|
+
}
|
40
|
+
|
41
|
+
registerEditorPlugin(YearRangeControlPlugin);
|
package/src/plugin/Form/Item.tsx
CHANGED
@@ -24,25 +24,30 @@ export class ItemPlugin extends BasePlugin {
|
|
24
24
|
panels: Array<BasicPanelItem>
|
25
25
|
) {
|
26
26
|
const renderer = context.info.renderer;
|
27
|
+
const store = this.manager.store;
|
27
28
|
|
28
29
|
if (context.selections.length) {
|
29
30
|
return;
|
30
31
|
}
|
31
|
-
|
32
|
+
const plugin = context.info.plugin;
|
32
33
|
// 如果是表单项
|
33
|
-
if (
|
34
|
+
if (
|
35
|
+
!context.info.hostId &&
|
36
|
+
renderer?.isFormItem &&
|
37
|
+
!plugin?.notRenderFormZone
|
38
|
+
) {
|
34
39
|
panels.push({
|
35
40
|
key: 'form-item',
|
36
41
|
icon: 'fa fa-desktop',
|
37
42
|
title: this.panelTitle,
|
38
43
|
render: this.manager.makeSchemaFormRender({
|
39
|
-
body: this.panelBodyCreator(context)
|
44
|
+
body: this.panelBodyCreator(context),
|
45
|
+
panelById: store.activeId
|
40
46
|
}),
|
41
47
|
order: -200
|
42
48
|
});
|
43
49
|
}
|
44
50
|
}
|
45
|
-
|
46
51
|
panelBodyCreator = (context: BaseEventContext) => {
|
47
52
|
const ignoreName = ~['button', 'submit', 'reset'].indexOf(
|
48
53
|
context.schema.type
|
@@ -87,21 +92,17 @@ export class ItemPlugin extends BasePlugin {
|
|
87
92
|
}),
|
88
93
|
renderer.renderLabel !== false ? getSchemaTpl('label') : null,
|
89
94
|
hasReadOnly
|
90
|
-
? {
|
91
|
-
type: 'switch',
|
95
|
+
? getSchemaTpl('switch', {
|
92
96
|
name: 'readOnly',
|
93
|
-
label: '只读模式'
|
94
|
-
|
95
|
-
className: 'w-full'
|
96
|
-
}
|
97
|
+
label: '只读模式'
|
98
|
+
})
|
97
99
|
: null,
|
98
|
-
{
|
99
|
-
type: 'switch',
|
100
|
+
getSchemaTpl('switch', {
|
100
101
|
name: 'disabled',
|
101
102
|
label: '禁用',
|
102
103
|
mode: 'inline',
|
103
104
|
className: 'w-full'
|
104
|
-
},
|
105
|
+
}),
|
105
106
|
ignoreValidator ? null : getSchemaTpl('required'),
|
106
107
|
getSchemaTpl('description'),
|
107
108
|
getSchemaTpl('placeholder'),
|
@@ -150,14 +151,12 @@ export class ItemPlugin extends BasePlugin {
|
|
150
151
|
// TODO: 有些表单项没有 disabled
|
151
152
|
getSchemaTpl('disabled'),
|
152
153
|
getSchemaTpl('visible'),
|
153
|
-
|
154
|
-
|
154
|
+
|
155
|
+
getSchemaTpl('switch', {
|
155
156
|
name: 'clearValueOnHidden',
|
156
157
|
label: '隐藏时删除表单项值',
|
157
|
-
mode: 'inline',
|
158
|
-
className: 'w-full',
|
159
158
|
disabledOn: 'typeof this.visible === "boolean"'
|
160
|
-
}
|
159
|
+
})
|
161
160
|
]
|
162
161
|
},
|
163
162
|
ignoreValidator
|
@@ -1,6 +1,9 @@
|
|
1
1
|
import {getSchemaTpl} from '../../component/schemaTpl';
|
2
2
|
import {registerEditorPlugin} from '../../manager';
|
3
|
-
import {BasePlugin} from '../../plugin';
|
3
|
+
import {BasePlugin, BaseEventContext} from '../../plugin';
|
4
|
+
|
5
|
+
import {formItemControl} from '../../component/control/BaseControl';
|
6
|
+
import {RendererAction, RendererEvent} from '../../event-action';
|
4
7
|
|
5
8
|
export class ListControlPlugin extends BasePlugin {
|
6
9
|
// 关联渲染器名字
|
@@ -45,29 +48,81 @@ export class ListControlPlugin extends BasePlugin {
|
|
45
48
|
]
|
46
49
|
};
|
47
50
|
|
51
|
+
notRenderFormZone = true;
|
52
|
+
|
48
53
|
panelTitle = '列表选择';
|
49
|
-
|
50
|
-
|
54
|
+
|
55
|
+
// 事件定义
|
56
|
+
events: RendererEvent[] = [
|
51
57
|
{
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
getSchemaTpl('extractValue'),
|
66
|
-
getSchemaTpl('options'),
|
67
|
-
getSchemaTpl('source')
|
58
|
+
eventName: 'change',
|
59
|
+
eventLabel: '值变化',
|
60
|
+
description: '选中值变化时触发',
|
61
|
+
dataSchema: [
|
62
|
+
{
|
63
|
+
type: 'object',
|
64
|
+
properties: {
|
65
|
+
'event.data.value': {
|
66
|
+
type: 'string',
|
67
|
+
title: '选中值'
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
68
71
|
]
|
69
|
-
}
|
72
|
+
}
|
70
73
|
];
|
74
|
+
|
75
|
+
// 动作定义
|
76
|
+
actions: RendererAction[] = [
|
77
|
+
{
|
78
|
+
actionType: 'clear',
|
79
|
+
actionLabel: '清空',
|
80
|
+
description: '清除选中值'
|
81
|
+
},
|
82
|
+
{
|
83
|
+
actionType: 'reset',
|
84
|
+
actionLabel: '重置',
|
85
|
+
description: '将值重置为resetValue,若没有配置resetValue,则清空'
|
86
|
+
},
|
87
|
+
{
|
88
|
+
actionType: 'reload',
|
89
|
+
actionLabel: '重新加载',
|
90
|
+
description: '触发组件数据刷新并重新渲染'
|
91
|
+
},
|
92
|
+
{
|
93
|
+
actionType: 'setValue',
|
94
|
+
actionLabel: '赋值',
|
95
|
+
description: '触发组件数据更新'
|
96
|
+
}
|
97
|
+
];
|
98
|
+
|
99
|
+
panelBodyCreator = (context: BaseEventContext) => {
|
100
|
+
return formItemControl(
|
101
|
+
{
|
102
|
+
common: {
|
103
|
+
replace: true,
|
104
|
+
body: [
|
105
|
+
getSchemaTpl('formItemName', {
|
106
|
+
required: true
|
107
|
+
}),
|
108
|
+
getSchemaTpl('label'),
|
109
|
+
getSchemaTpl('multiple'),
|
110
|
+
getSchemaTpl('extractValue')
|
111
|
+
]
|
112
|
+
},
|
113
|
+
option: {
|
114
|
+
body: [
|
115
|
+
getSchemaTpl('optionControl', {
|
116
|
+
description: '设置选项后,输入时会下拉这些选项供用户参考。'
|
117
|
+
}),
|
118
|
+
getSchemaTpl('value')
|
119
|
+
]
|
120
|
+
},
|
121
|
+
status: {}
|
122
|
+
},
|
123
|
+
context
|
124
|
+
);
|
125
|
+
};
|
71
126
|
}
|
72
127
|
|
73
128
|
registerEditorPlugin(ListControlPlugin);
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import {getSchemaTpl} from '../../component/schemaTpl';
|
1
2
|
import {registerEditorPlugin} from '../../manager';
|
2
3
|
import {BasePlugin} from '../../plugin';
|
3
4
|
|
@@ -32,13 +33,7 @@ export class LocationControlPlugin extends BasePlugin {
|
|
32
33
|
|
33
34
|
panelTitle = '地理位置选择';
|
34
35
|
panelBody = [
|
35
|
-
|
36
|
-
name: 'clearable',
|
37
|
-
label: '是否可清除',
|
38
|
-
type: 'switch',
|
39
|
-
mode: 'inline',
|
40
|
-
className: 'block'
|
41
|
-
},
|
36
|
+
getSchemaTpl('clearable'),
|
42
37
|
{
|
43
38
|
type: 'input-text',
|
44
39
|
name: 'ak',
|