amis-editor 4.2.0-beta.0 → 5.1.8
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/Editor.d.ts +16 -0
- package/dist/component/RegionWrapper.d.ts +10 -0
- package/dist/component/VRenderer.d.ts +10 -0
- package/dist/component/base/ShortcutKey.d.ts +23 -0
- package/dist/component/control/APIControl.d.ts +1158 -0
- 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 → control}/OptionControl.d.ts +23 -34
- package/dist/component/{Control → control}/PopoverEdit.d.ts +1 -1
- 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 +65 -0
- 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/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 +24 -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 -9
- 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
- package/dist/component/Control/APIControl.d.ts +0 -504
- package/dist/component/Control/ValidationControl.d.ts +0 -30
- package/dist/component/remarkTpl.d.ts +0 -150
@@ -3,30 +3,54 @@ import {
|
|
3
3
|
BasePlugin,
|
4
4
|
BasicSubRenderInfo,
|
5
5
|
RendererEventContext,
|
6
|
-
SubRendererInfo
|
6
|
+
SubRendererInfo,
|
7
|
+
BaseEventContext
|
7
8
|
} from '../../plugin';
|
8
|
-
import {
|
9
|
+
import {
|
10
|
+
defaultValue,
|
11
|
+
getSchemaTpl,
|
12
|
+
setSchemaTpl
|
13
|
+
} from '../../component/schemaTpl';
|
14
|
+
import {ValidatorTag} from '../../component/validator';
|
15
|
+
import {tipedLabel} from '../../component/control/BaseControl';
|
16
|
+
import {getEventControlConfig} from '../../util';
|
17
|
+
|
18
|
+
const isText = 'data.type === "input-text"';
|
19
|
+
const isPassword = 'data.type === "input-password"';
|
20
|
+
const isEmail = 'data.type === "input-email"';
|
21
|
+
const isUrl = 'data.type === "input-url"';
|
22
|
+
function isTextShow(value: string, name: boolean): boolean {
|
23
|
+
return ['input-text'].includes(value) ? !!name : false;
|
24
|
+
}
|
9
25
|
|
10
26
|
export class TextControlPlugin extends BasePlugin {
|
11
27
|
// 关联渲染器名字
|
12
28
|
rendererName = 'input-text';
|
29
|
+
|
13
30
|
$schema = '/schemas/TextControlSchema.json';
|
14
31
|
|
15
32
|
order = -500;
|
16
|
-
|
33
|
+
// 添加源对应组件中文名称 & type字段
|
34
|
+
searchKeywords =
|
35
|
+
'文本框、邮箱框、input-email、URL框、input-url、密码框、input-password';
|
17
36
|
// 组件名称
|
18
37
|
name = '文本框';
|
38
|
+
|
19
39
|
isBaseComponent = true;
|
20
40
|
icon = 'fa fa-terminal';
|
21
|
-
|
22
|
-
|
23
|
-
|
41
|
+
|
42
|
+
description = '文本输入框,支持普通文本、密码、URL、邮箱等多种内容输入';
|
43
|
+
|
44
|
+
docLink = '/amis/zh-CN/components/form/text';
|
45
|
+
|
24
46
|
tags = ['表单项'];
|
47
|
+
|
25
48
|
scaffold = {
|
26
49
|
type: 'input-text',
|
27
50
|
label: '文本',
|
28
51
|
name: 'text'
|
29
52
|
};
|
53
|
+
|
30
54
|
previewSchema: any = {
|
31
55
|
type: 'form',
|
32
56
|
className: 'text-left',
|
@@ -39,148 +63,302 @@ export class TextControlPlugin extends BasePlugin {
|
|
39
63
|
]
|
40
64
|
};
|
41
65
|
|
66
|
+
notRenderFormZone = true;
|
67
|
+
|
42
68
|
panelTitle = '文本框';
|
43
|
-
panelBody = [
|
44
|
-
getSchemaTpl('switchDefaultValue'),
|
45
|
-
{
|
46
|
-
type: 'input-text',
|
47
|
-
name: 'value',
|
48
|
-
label: '默认值',
|
49
|
-
visibleOn: 'typeof this.value !== "undefined"'
|
50
|
-
},
|
51
|
-
getSchemaTpl('hint'),
|
52
|
-
getSchemaTpl('showCounter'),
|
53
69
|
|
70
|
+
events = [
|
71
|
+
// {
|
72
|
+
// eventName: 'click',
|
73
|
+
// eventLabel: '点击',
|
74
|
+
// description: '点击事件'
|
75
|
+
// },
|
54
76
|
{
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
type: 'button'
|
77
|
+
eventName: 'change',
|
78
|
+
eventLabel: '值变化',
|
79
|
+
description: '输入框内容变化',
|
80
|
+
dataSchema: [
|
81
|
+
{
|
82
|
+
type: 'object',
|
83
|
+
properties: {
|
84
|
+
'event.data.value': {
|
85
|
+
type: 'string',
|
86
|
+
title: '输入值'
|
66
87
|
}
|
67
|
-
|
88
|
+
}
|
89
|
+
}
|
90
|
+
]
|
68
91
|
},
|
69
|
-
|
70
92
|
{
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
items: [
|
93
|
+
eventName: 'focus',
|
94
|
+
eventLabel: '获取焦点',
|
95
|
+
description: '输入框获取焦点',
|
96
|
+
dataSchema: [
|
76
97
|
{
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
{
|
83
|
-
label: '文本',
|
84
|
-
value: 'text'
|
85
|
-
},
|
86
|
-
|
87
|
-
{
|
88
|
-
label: '按钮',
|
89
|
-
value: 'button'
|
90
|
-
},
|
91
|
-
|
92
|
-
{
|
93
|
-
label: '提交',
|
94
|
-
value: 'submit'
|
98
|
+
type: 'object',
|
99
|
+
properties: {
|
100
|
+
'event.data.value': {
|
101
|
+
type: 'string',
|
102
|
+
title: '输入值'
|
95
103
|
}
|
96
|
-
|
97
|
-
}
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
{
|
107
|
-
name: 'icon',
|
108
|
-
label: 'Icon',
|
109
|
-
type: 'icon-picker',
|
110
|
-
visibleOn: 'this.type === "text"'
|
111
|
-
},
|
112
|
-
|
113
|
-
getSchemaTpl('className', {
|
114
|
-
visibleOn: 'this.type === "text"'
|
115
|
-
}),
|
116
|
-
|
104
|
+
}
|
105
|
+
}
|
106
|
+
]
|
107
|
+
},
|
108
|
+
{
|
109
|
+
eventName: 'blur',
|
110
|
+
eventLabel: '失去焦点',
|
111
|
+
description: '输入框失去焦点',
|
112
|
+
dataSchema: [
|
117
113
|
{
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
options: [
|
124
|
-
{
|
125
|
-
label: '左边',
|
126
|
-
value: 'left'
|
127
|
-
},
|
128
|
-
|
129
|
-
{
|
130
|
-
label: '右边',
|
131
|
-
value: 'right'
|
114
|
+
type: 'object',
|
115
|
+
properties: {
|
116
|
+
'event.data.value': {
|
117
|
+
type: 'string',
|
118
|
+
title: '输入值'
|
132
119
|
}
|
133
|
-
|
120
|
+
}
|
134
121
|
}
|
135
122
|
]
|
136
|
-
}
|
123
|
+
}
|
124
|
+
// 貌似无效,先下掉
|
125
|
+
// {
|
126
|
+
// eventName: 'enter',
|
127
|
+
// eventLabel: '回车',
|
128
|
+
// description: '按键回车'
|
129
|
+
// }
|
130
|
+
];
|
137
131
|
|
132
|
+
actions = [
|
138
133
|
{
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
className: 'w-full',
|
143
|
-
type: 'switch',
|
144
|
-
pipeIn: (value: any) => value !== false,
|
145
|
-
pipeOut: (value: any) => (value ? '' : false),
|
146
|
-
onChange: (value: any, oldValue: any, model: any, form: any) => {
|
147
|
-
if (oldValue === '' || oldValue) {
|
148
|
-
form.setValues({
|
149
|
-
__options: form.data.options,
|
150
|
-
options: []
|
151
|
-
});
|
152
|
-
} else {
|
153
|
-
form.setValues({
|
154
|
-
options: form.data.__options
|
155
|
-
});
|
156
|
-
}
|
157
|
-
}
|
134
|
+
actionType: 'clear',
|
135
|
+
actionLabel: '清空',
|
136
|
+
description: '清空输入框内容'
|
158
137
|
},
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
description: '
|
163
|
-
}
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
description:
|
173
|
-
|
174
|
-
visibleOn: 'data.autoComplete !== false'
|
175
|
-
}),
|
176
|
-
getSchemaTpl('multiple', {
|
177
|
-
visibleOn: 'data.options || data.source || data.autoComplete'
|
178
|
-
}),
|
179
|
-
getSchemaTpl('joinValues'),
|
180
|
-
getSchemaTpl('delimiter'),
|
181
|
-
getSchemaTpl('extractValue'),
|
182
|
-
getSchemaTpl('autoFill')
|
138
|
+
{
|
139
|
+
actionType: 'reset',
|
140
|
+
actionLabel: '重置',
|
141
|
+
description: '将值重置为resetValue,若没有配置resetValue,则清空'
|
142
|
+
},
|
143
|
+
{
|
144
|
+
actionType: 'reload',
|
145
|
+
actionLabel: '重新加载',
|
146
|
+
description: '触发组件数据刷新并重新渲染'
|
147
|
+
},
|
148
|
+
{
|
149
|
+
actionType: 'setValue',
|
150
|
+
actionLabel: '赋值',
|
151
|
+
description: '触发组件数据更新'
|
152
|
+
}
|
183
153
|
];
|
154
|
+
|
155
|
+
panelJustify = true;
|
156
|
+
|
157
|
+
panelBodyCreator = (context: BaseEventContext) => {
|
158
|
+
const renderer: any = context.info.renderer;
|
159
|
+
|
160
|
+
return getSchemaTpl('tabs', [
|
161
|
+
{
|
162
|
+
title: '属性',
|
163
|
+
body: getSchemaTpl('collapseGroup', [
|
164
|
+
{
|
165
|
+
title: '基本',
|
166
|
+
body: [
|
167
|
+
getSchemaTpl('formItemName', {
|
168
|
+
required: true
|
169
|
+
}),
|
170
|
+
getSchemaTpl('label'),
|
171
|
+
getSchemaTpl('inputType', {
|
172
|
+
value: this.scaffold.type,
|
173
|
+
onChange: (
|
174
|
+
value: string,
|
175
|
+
oldValue: string,
|
176
|
+
model: any,
|
177
|
+
form: any
|
178
|
+
) => {
|
179
|
+
const {
|
180
|
+
showCounter,
|
181
|
+
validations,
|
182
|
+
validationErrors = {},
|
183
|
+
autoComplete
|
184
|
+
} = form.data;
|
185
|
+
|
186
|
+
const is_old_email = oldValue === 'input-email';
|
187
|
+
const is_old_url = oldValue === 'input-url';
|
188
|
+
|
189
|
+
if (is_old_email) {
|
190
|
+
validations && delete validations.isEmail;
|
191
|
+
validationErrors && delete validationErrors.isEmail;
|
192
|
+
}
|
193
|
+
|
194
|
+
if (is_old_url) {
|
195
|
+
validations && delete validations.isUrl;
|
196
|
+
validationErrors && delete validationErrors.isUrl;
|
197
|
+
}
|
198
|
+
|
199
|
+
form.setValues({
|
200
|
+
type: value,
|
201
|
+
showCounter: ['input-url', 'input-email'].includes(value)
|
202
|
+
? undefined
|
203
|
+
: !!showCounter,
|
204
|
+
autoComplete: ['input-text'].includes(value)
|
205
|
+
? autoComplete
|
206
|
+
: undefined
|
207
|
+
});
|
208
|
+
form.changeValue('validations', {...validations});
|
209
|
+
form.changeValue('validationErrors', {...validationErrors});
|
210
|
+
}
|
211
|
+
}),
|
212
|
+
getSchemaTpl('value'),
|
213
|
+
getSchemaTpl('clearable'),
|
214
|
+
// getSchemaTpl('multiple',{
|
215
|
+
// visibleOn: `${isText} || ${isUrl}`
|
216
|
+
// }),
|
217
|
+
getSchemaTpl('showCounter', {
|
218
|
+
visibleOn: `${isText} || ${isPassword}`
|
219
|
+
}),
|
220
|
+
{
|
221
|
+
name: 'addOn',
|
222
|
+
label: tipedLabel('AddOn', '输入框左侧或右侧的附加挂件'),
|
223
|
+
type: 'ae-Switch-More',
|
224
|
+
mode: 'normal',
|
225
|
+
formType: 'extend',
|
226
|
+
title: 'AddOn',
|
227
|
+
bulk: false,
|
228
|
+
defaultData: {
|
229
|
+
label: '按钮',
|
230
|
+
type: 'button'
|
231
|
+
},
|
232
|
+
form: {
|
233
|
+
body: [
|
234
|
+
{
|
235
|
+
name: 'type',
|
236
|
+
label: '类型',
|
237
|
+
type: 'button-group-select',
|
238
|
+
inputClassName: 'items-center',
|
239
|
+
pipeIn: defaultValue('button'),
|
240
|
+
options: [
|
241
|
+
{
|
242
|
+
label: '文本',
|
243
|
+
value: 'text'
|
244
|
+
},
|
245
|
+
|
246
|
+
{
|
247
|
+
label: '按钮',
|
248
|
+
value: 'button'
|
249
|
+
},
|
250
|
+
|
251
|
+
{
|
252
|
+
label: '提交',
|
253
|
+
value: 'submit'
|
254
|
+
}
|
255
|
+
]
|
256
|
+
},
|
257
|
+
getSchemaTpl('horizontal-align', {
|
258
|
+
name: 'position',
|
259
|
+
pipeIn: defaultValue('right')
|
260
|
+
}),
|
261
|
+
{
|
262
|
+
name: 'label',
|
263
|
+
label: '文字',
|
264
|
+
type: 'input-text'
|
265
|
+
},
|
266
|
+
getSchemaTpl('icon')
|
267
|
+
]
|
268
|
+
}
|
269
|
+
},
|
270
|
+
|
271
|
+
// {
|
272
|
+
// type: 'ae-Switch-More',
|
273
|
+
// mode: 'normal',
|
274
|
+
// label: tipedLabel(
|
275
|
+
// '自动补全',
|
276
|
+
// '根据输入内容,调用接口提供选项。当前输入值可用${term}变量'
|
277
|
+
// ),
|
278
|
+
// visibleOn: isText,
|
279
|
+
// formType: 'extend',
|
280
|
+
// defaultData: {
|
281
|
+
// autoComplete: {
|
282
|
+
// method: 'get',
|
283
|
+
// url: ''
|
284
|
+
// }
|
285
|
+
// },
|
286
|
+
// form: {
|
287
|
+
// body: [
|
288
|
+
// getSchemaTpl('apiControl', {
|
289
|
+
// name: 'autoComplete',
|
290
|
+
// label: '接口',
|
291
|
+
// description: '',
|
292
|
+
// visibleOn: 'data.autoComplete !== false',
|
293
|
+
// footer: []
|
294
|
+
// })
|
295
|
+
// ]
|
296
|
+
// }
|
297
|
+
// },
|
298
|
+
getSchemaTpl('labelRemark'),
|
299
|
+
getSchemaTpl('remark'),
|
300
|
+
getSchemaTpl('placeholder'),
|
301
|
+
getSchemaTpl('description')
|
302
|
+
]
|
303
|
+
},
|
304
|
+
getSchemaTpl('status', {
|
305
|
+
isFormItem: true,
|
306
|
+
readonly: true
|
307
|
+
}),
|
308
|
+
getSchemaTpl('validation', {
|
309
|
+
tag: (data: any) => {
|
310
|
+
switch (data.type) {
|
311
|
+
case 'input-password':
|
312
|
+
return ValidatorTag.Password;
|
313
|
+
case 'input-email':
|
314
|
+
return ValidatorTag.Email;
|
315
|
+
case 'input-url':
|
316
|
+
return ValidatorTag.URL;
|
317
|
+
default:
|
318
|
+
return ValidatorTag.Text;
|
319
|
+
}
|
320
|
+
}
|
321
|
+
})
|
322
|
+
// {
|
323
|
+
// title: '高级',
|
324
|
+
// body: [
|
325
|
+
// getSchemaTpl('autoFill')
|
326
|
+
// ]
|
327
|
+
// }
|
328
|
+
])
|
329
|
+
},
|
330
|
+
{
|
331
|
+
title: '外观',
|
332
|
+
body: getSchemaTpl('collapseGroup', [
|
333
|
+
getSchemaTpl('style:formItem', {renderer}),
|
334
|
+
getSchemaTpl('style:classNames', {
|
335
|
+
schema: [
|
336
|
+
getSchemaTpl('className', {
|
337
|
+
label: '描述',
|
338
|
+
name: 'descriptionClassName',
|
339
|
+
visibleOn: 'this.description'
|
340
|
+
}),
|
341
|
+
getSchemaTpl('className', {
|
342
|
+
name: 'addOn.className',
|
343
|
+
label: 'AddOn',
|
344
|
+
visibleOn: 'this.addOn && this.addOn.type === "text"'
|
345
|
+
})
|
346
|
+
]
|
347
|
+
})
|
348
|
+
])
|
349
|
+
},
|
350
|
+
{
|
351
|
+
title: '事件',
|
352
|
+
className: 'p-none',
|
353
|
+
body: [
|
354
|
+
getSchemaTpl('eventControl', {
|
355
|
+
name: 'onEvent',
|
356
|
+
...getEventControlConfig(this.manager, context)
|
357
|
+
})
|
358
|
+
]
|
359
|
+
}
|
360
|
+
]);
|
361
|
+
};
|
184
362
|
}
|
185
363
|
|
186
364
|
registerEditorPlugin(TextControlPlugin);
|
@@ -1,9 +1,7 @@
|
|
1
|
-
import {relativeValueRe} from 'amis';
|
2
|
-
import {defaultValue, getSchemaTpl} from '../../component/schemaTpl';
|
3
1
|
import {registerEditorPlugin} from '../../manager';
|
4
|
-
import {
|
2
|
+
import {DateControlPlugin} from './InputDate';
|
5
3
|
|
6
|
-
export class TimeControlPlugin extends
|
4
|
+
export class TimeControlPlugin extends DateControlPlugin {
|
7
5
|
// 关联渲染器名字
|
8
6
|
rendererName = 'input-time';
|
9
7
|
$schema = '/schemas/TimeControlSchema.json';
|
@@ -20,6 +18,8 @@ export class TimeControlPlugin extends BasePlugin {
|
|
20
18
|
label: '时间',
|
21
19
|
name: 'time'
|
22
20
|
};
|
21
|
+
|
22
|
+
disabledRendererPlugin = true;
|
23
23
|
previewSchema: any = {
|
24
24
|
type: 'form',
|
25
25
|
className: 'text-left',
|
@@ -31,55 +31,6 @@ export class TimeControlPlugin extends BasePlugin {
|
|
31
31
|
};
|
32
32
|
|
33
33
|
panelTitle = '时间框';
|
34
|
-
panelBody = [
|
35
|
-
getSchemaTpl('switchDefaultValue'),
|
36
|
-
|
37
|
-
{
|
38
|
-
type: 'input-text',
|
39
|
-
name: 'value',
|
40
|
-
label: '默认值',
|
41
|
-
visibleOn: 'typeof this.value !== "undefined"',
|
42
|
-
placeholder: '请输入相对值',
|
43
|
-
description: '支持 <code>now、+1day、-2weeks</code>这种相对值用法'
|
44
|
-
},
|
45
|
-
{
|
46
|
-
type: 'fieldSet',
|
47
|
-
title: '使用固定值',
|
48
|
-
collapsed: true,
|
49
|
-
collapsable: true,
|
50
|
-
className: 'fieldset',
|
51
|
-
visibleOn: 'typeof this.value !== "undefined"',
|
52
|
-
body: [
|
53
|
-
{
|
54
|
-
type: 'input-time',
|
55
|
-
name: 'value',
|
56
|
-
pipeIn: (value: any) =>
|
57
|
-
relativeValueRe.test(value) || ~['now', 'today'].indexOf(value)
|
58
|
-
? ''
|
59
|
-
: value
|
60
|
-
}
|
61
|
-
]
|
62
|
-
},
|
63
|
-
{
|
64
|
-
type: 'input-text',
|
65
|
-
name: 'timeFormat',
|
66
|
-
label: '值格式',
|
67
|
-
description:
|
68
|
-
'请参考 <a href="https://momentjs.com/" target="_blank">moment</a> 中的格式用法。',
|
69
|
-
pipeIn: defaultValue('HH:mm')
|
70
|
-
},
|
71
|
-
getSchemaTpl('clearable', {
|
72
|
-
pipeIn: defaultValue(true)
|
73
|
-
}),
|
74
|
-
{
|
75
|
-
type: 'input-text',
|
76
|
-
name: 'inputFormat',
|
77
|
-
label: '显示格式',
|
78
|
-
description:
|
79
|
-
'请参考 <a href="https://momentjs.com/" target="_blank">moment</a> 中的格式用法。',
|
80
|
-
pipeIn: defaultValue('HH:mm')
|
81
|
-
}
|
82
|
-
];
|
83
34
|
}
|
84
35
|
|
85
36
|
registerEditorPlugin(TimeControlPlugin);
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import {registerEditorPlugin} from '../../manager';
|
2
|
+
|
3
|
+
import {DateRangeControlPlugin} from './InputDateRange';
|
4
|
+
|
5
|
+
export class TimeRangeControlPlugin extends DateRangeControlPlugin {
|
6
|
+
// 关联渲染器名字
|
7
|
+
rendererName = 'input-time-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/time-range';
|
19
|
+
tags = ['表单项'];
|
20
|
+
scaffold = {
|
21
|
+
type: 'input-time-range',
|
22
|
+
label: '日期范围',
|
23
|
+
name: 'time-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(TimeRangeControlPlugin);
|