amis-editor 4.2.0-beta.3 → 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/ScaffoldModal.d.ts +1 -1
- package/dist/component/VRenderer.d.ts +10 -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 +0 -0
- 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 +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 +55 -28
- 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
- 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
@@ -4,16 +4,39 @@
|
|
4
4
|
*/
|
5
5
|
import {isObject} from '../util';
|
6
6
|
import find = require('lodash/find');
|
7
|
-
import
|
7
|
+
import forEach = require('lodash/forEach');
|
8
|
+
import reduce = require('lodash/reduce');
|
9
|
+
import {str2rules, buildApi, Html} from 'amis';
|
8
10
|
import flatten from 'lodash/flatten';
|
11
|
+
import kebabCase from 'lodash/kebabCase';
|
9
12
|
import React = require('react');
|
10
13
|
import {InputComponentName} from './base/InputComponentName';
|
11
|
-
import remarkTpl from './
|
14
|
+
import {remarkTpl, tipedLabel, ValidationOptions} from './control/BaseControl';
|
15
|
+
|
16
|
+
import type {ValidatorFilter} from './control/ValidationControl';
|
17
|
+
import {ValidatorTag} from './validator';
|
18
|
+
import {SchemaCollection, SchemaObject} from 'amis/lib/Schema';
|
12
19
|
|
13
20
|
const tpls: {
|
14
21
|
[propName: string]: any;
|
15
22
|
} = {
|
16
|
-
|
23
|
+
/**
|
24
|
+
* @deprecated 兼容当前组件的switch
|
25
|
+
*/
|
26
|
+
'switch': {
|
27
|
+
type: 'switch',
|
28
|
+
mode: 'horizontal',
|
29
|
+
horizontal: {
|
30
|
+
justify: true,
|
31
|
+
left: 8
|
32
|
+
},
|
33
|
+
inputClassName: 'is-inline '
|
34
|
+
},
|
35
|
+
|
36
|
+
/**
|
37
|
+
* 表单项字段name
|
38
|
+
*/
|
39
|
+
'formItemName': {
|
17
40
|
label: '字段名',
|
18
41
|
name: 'name',
|
19
42
|
type: 'input-text'
|
@@ -26,54 +49,51 @@ const tpls: {
|
|
26
49
|
// validateOnChange: false
|
27
50
|
},
|
28
51
|
|
29
|
-
formItemMode: {
|
30
|
-
label: '
|
52
|
+
'formItemMode': {
|
53
|
+
label: '布局',
|
31
54
|
name: 'mode',
|
32
55
|
type: 'button-group-select',
|
33
|
-
size: 'sm',
|
34
56
|
option: '继承',
|
35
|
-
|
57
|
+
horizontal: {
|
58
|
+
left: 2,
|
59
|
+
justify: true
|
60
|
+
},
|
36
61
|
// className: 'w-full',
|
37
62
|
pipeIn: defaultValue(''),
|
38
63
|
options: [
|
39
|
-
{
|
40
|
-
label: '继承',
|
41
|
-
value: ''
|
42
|
-
},
|
43
|
-
|
44
|
-
{
|
45
|
-
label: '正常',
|
46
|
-
value: 'normal'
|
47
|
-
},
|
48
|
-
|
49
64
|
{
|
50
65
|
label: '内联',
|
51
66
|
value: 'inline'
|
52
67
|
},
|
53
|
-
|
54
68
|
{
|
55
69
|
label: '水平',
|
56
70
|
value: 'horizontal'
|
71
|
+
},
|
72
|
+
{
|
73
|
+
label: '垂直',
|
74
|
+
value: 'normal'
|
75
|
+
},
|
76
|
+
{
|
77
|
+
label: '继承',
|
78
|
+
value: ''
|
57
79
|
}
|
58
|
-
]
|
80
|
+
],
|
81
|
+
pipeOut: (v: string) => (v ? v : undefined)
|
59
82
|
},
|
60
83
|
|
61
|
-
formItemInline: {
|
84
|
+
'formItemInline': {
|
85
|
+
type: 'switch',
|
62
86
|
label: '表单项内联',
|
63
87
|
name: 'inline',
|
64
|
-
type: 'switch',
|
65
88
|
visibleOn: 'data.mode != "inline"',
|
66
|
-
mode: 'inline',
|
67
|
-
className: 'w-full',
|
68
89
|
pipeIn: defaultValue(false)
|
69
90
|
// onChange: (value:any, origin:any, item:any, form:any) => form.getValueByName('size') === "full" && form.setValueByName('')
|
70
91
|
},
|
71
92
|
|
72
|
-
formItemSize: {
|
93
|
+
'formItemSize': {
|
73
94
|
name: 'size',
|
74
|
-
label: '
|
75
|
-
type: '
|
76
|
-
size: 'sm',
|
95
|
+
label: '控件宽度',
|
96
|
+
type: 'select',
|
77
97
|
pipeIn: defaultValue('full'),
|
78
98
|
// mode: 'inline',
|
79
99
|
// className: 'w-full',
|
@@ -97,7 +117,10 @@ const tpls: {
|
|
97
117
|
label: '大',
|
98
118
|
value: 'lg'
|
99
119
|
},
|
100
|
-
|
120
|
+
{
|
121
|
+
label: '占满',
|
122
|
+
value: 'full'
|
123
|
+
},
|
101
124
|
{
|
102
125
|
label: '默认',
|
103
126
|
value: ''
|
@@ -105,68 +128,78 @@ const tpls: {
|
|
105
128
|
]
|
106
129
|
},
|
107
130
|
|
108
|
-
minLength: {
|
131
|
+
'minLength': {
|
109
132
|
name: 'minLength',
|
110
133
|
type: 'input-number',
|
111
134
|
label: '限制最小数量'
|
112
135
|
},
|
113
136
|
|
114
|
-
maxLength: {
|
137
|
+
'maxLength': {
|
115
138
|
name: 'maxLength',
|
116
139
|
type: 'input-number',
|
117
140
|
label: '限制最大数量'
|
118
141
|
},
|
119
142
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
{
|
143
|
+
/**
|
144
|
+
* 表单项名称label
|
145
|
+
*/
|
146
|
+
'label': {
|
147
|
+
label: '标题',
|
148
|
+
name: 'label',
|
149
|
+
type: 'input-text',
|
150
|
+
pipeIn(v: any) {
|
151
|
+
return v === false ? '' : v;
|
152
|
+
}
|
153
|
+
},
|
154
|
+
|
155
|
+
'labelHide': () =>
|
156
|
+
getSchemaTpl('switch', {
|
128
157
|
name: 'label',
|
129
|
-
label: '
|
130
|
-
type: 'switch',
|
131
|
-
mode: 'inline',
|
132
|
-
className: 'w-full',
|
158
|
+
label: tipedLabel('隐藏标题', '隐藏后,水平布局时标题宽度为0'),
|
133
159
|
pipeIn: (value: any) => value === false,
|
134
160
|
pipeOut: (value: any) => (value === true ? false : ''),
|
135
161
|
visibleOn:
|
136
|
-
'__props__.formMode === "horizontal" || data.mode === "horizontal" || data.label ===false'
|
137
|
-
|
138
|
-
}
|
139
|
-
],
|
162
|
+
'__props__.formMode === "horizontal" || data.mode === "horizontal" || data.label === false'
|
163
|
+
}),
|
140
164
|
|
141
|
-
placeholder: {
|
142
|
-
label: '
|
165
|
+
'placeholder': {
|
166
|
+
label: '占位提示',
|
143
167
|
name: 'placeholder',
|
144
168
|
type: 'input-text',
|
145
|
-
placeholder: '
|
169
|
+
placeholder: '空内容提示占位'
|
146
170
|
},
|
147
171
|
|
148
|
-
tabs: (
|
172
|
+
'tabs': (
|
149
173
|
config: Array<{
|
150
174
|
title: string;
|
151
|
-
|
175
|
+
className?: string;
|
176
|
+
body: Array<SchemaObject>;
|
152
177
|
}>
|
153
178
|
) => {
|
154
179
|
return {
|
155
180
|
type: 'tabs',
|
156
181
|
tabsMode: 'line', // tiled
|
157
182
|
className: 'editor-prop-config-tabs',
|
183
|
+
linksClassName: 'editor-prop-config-tabs-links',
|
158
184
|
contentClassName:
|
159
185
|
'no-border editor-prop-config-tabs-cont hoverShowScrollBar',
|
160
186
|
tabs: config
|
161
187
|
.filter(item => item)
|
162
|
-
.map(item =>
|
163
|
-
|
164
|
-
|
165
|
-
|
188
|
+
.map(item => {
|
189
|
+
const newSchema = {
|
190
|
+
...item,
|
191
|
+
body: Array.isArray(item.body) ? flatten(item.body) : [item.body]
|
192
|
+
};
|
193
|
+
// 新版配置面板空隙在子组件中,兼容一下
|
194
|
+
if (newSchema.body[0]?.type === 'collapse-group') {
|
195
|
+
newSchema.className = (newSchema.className || '') + ' p-none';
|
196
|
+
}
|
197
|
+
return newSchema;
|
198
|
+
})
|
166
199
|
};
|
167
200
|
},
|
168
201
|
|
169
|
-
collapse: (
|
202
|
+
'collapse': (
|
170
203
|
config: Array<{
|
171
204
|
title: string;
|
172
205
|
body: Array<any>;
|
@@ -187,7 +220,7 @@ const tpls: {
|
|
187
220
|
};
|
188
221
|
},
|
189
222
|
|
190
|
-
fieldSet: (config: {
|
223
|
+
'fieldSet': (config: {
|
191
224
|
title: string;
|
192
225
|
body: Array<any>;
|
193
226
|
collapsed?: boolean;
|
@@ -203,44 +236,192 @@ const tpls: {
|
|
203
236
|
};
|
204
237
|
},
|
205
238
|
|
206
|
-
|
239
|
+
'collapseGroup': (
|
240
|
+
config: Array<{
|
241
|
+
title: string;
|
242
|
+
key: string;
|
243
|
+
visibleOn: string;
|
244
|
+
body: Array<any>;
|
245
|
+
}>
|
246
|
+
) => {
|
247
|
+
const collapseGroupBody = config
|
248
|
+
.filter(
|
249
|
+
item => item && Array.isArray(item?.body) && item?.body.length > 0
|
250
|
+
)
|
251
|
+
.map((item, index) => ({
|
252
|
+
type: 'collapse',
|
253
|
+
headingClassName: 'ae-formItemControl-header',
|
254
|
+
bodyClassName: 'ae-formItemControl-body',
|
255
|
+
...item,
|
256
|
+
key: item.key || index.toString(),
|
257
|
+
body: flatten(item.body)
|
258
|
+
}));
|
259
|
+
|
260
|
+
return {
|
261
|
+
type: 'collapse-group',
|
262
|
+
expandIconPosition: 'right',
|
263
|
+
expandIcon: {
|
264
|
+
type: 'icon',
|
265
|
+
icon: 'chevron-right'
|
266
|
+
},
|
267
|
+
className: 'ae-formItemControl ae-styleControl',
|
268
|
+
activeKey: collapseGroupBody.map((group, index) => group.key),
|
269
|
+
body: collapseGroupBody
|
270
|
+
};
|
271
|
+
},
|
272
|
+
|
273
|
+
'clearable': {
|
207
274
|
type: 'switch',
|
275
|
+
label: '可清除',
|
208
276
|
name: 'clearable',
|
209
|
-
|
210
|
-
className: 'w-full',
|
211
|
-
label: '启用清除按钮'
|
277
|
+
inputClassName: 'is-inline'
|
212
278
|
},
|
213
279
|
|
214
|
-
hint: {
|
215
|
-
label: '
|
280
|
+
'hint': {
|
281
|
+
label: '输入框提示',
|
216
282
|
type: 'input-text',
|
217
283
|
name: 'hint',
|
218
284
|
description: '当输入框获得焦点的时候显示,用来提示用户输入内容。'
|
219
285
|
},
|
220
286
|
|
221
|
-
remark: remarkTpl({
|
287
|
+
'remark': remarkTpl({
|
288
|
+
name: 'remark',
|
289
|
+
label: '控件提示',
|
290
|
+
labelRemark:
|
291
|
+
'在输入控件旁展示提示,注意控件宽度需设置,否则提示触发图标将自动换行'
|
292
|
+
}),
|
293
|
+
|
294
|
+
'labelRemark': remarkTpl({
|
295
|
+
name: 'labelRemark',
|
296
|
+
label: '标题提示',
|
297
|
+
labelRemark: '在标题旁展示提示'
|
298
|
+
}),
|
299
|
+
|
300
|
+
/**
|
301
|
+
* 表单项组件默认值
|
302
|
+
*/
|
303
|
+
'value': {
|
304
|
+
type: 'ae-formulaControl',
|
305
|
+
label: '默认值',
|
306
|
+
name: 'value'
|
307
|
+
},
|
308
|
+
|
309
|
+
'inputType': {
|
310
|
+
label: '输入类型',
|
311
|
+
name: 'type',
|
312
|
+
type: 'select',
|
313
|
+
creatable: false,
|
314
|
+
options: [
|
315
|
+
{
|
316
|
+
label: '文本',
|
317
|
+
value: 'input-text'
|
318
|
+
},
|
319
|
+
{
|
320
|
+
label: '密码',
|
321
|
+
value: 'input-password'
|
322
|
+
},
|
323
|
+
{
|
324
|
+
label: '邮箱',
|
325
|
+
value: 'input-email'
|
326
|
+
},
|
327
|
+
{
|
328
|
+
label: 'URL',
|
329
|
+
value: 'input-url'
|
330
|
+
}
|
331
|
+
]
|
332
|
+
},
|
333
|
+
|
334
|
+
'selectDateType': {
|
335
|
+
label: '日期类型',
|
336
|
+
name: 'type',
|
337
|
+
type: 'select',
|
338
|
+
creatable: false,
|
339
|
+
options: [
|
340
|
+
{
|
341
|
+
label: '日期',
|
342
|
+
value: 'input-date'
|
343
|
+
},
|
344
|
+
{
|
345
|
+
label: '日期时间',
|
346
|
+
value: 'input-datetime'
|
347
|
+
},
|
348
|
+
{
|
349
|
+
label: '时间',
|
350
|
+
value: 'input-time'
|
351
|
+
},
|
352
|
+
{
|
353
|
+
label: '月份',
|
354
|
+
value: 'input-month'
|
355
|
+
},
|
356
|
+
{
|
357
|
+
label: '季度',
|
358
|
+
value: 'input-quarter'
|
359
|
+
},
|
360
|
+
{
|
361
|
+
label: '年份',
|
362
|
+
value: 'input-year'
|
363
|
+
}
|
364
|
+
]
|
365
|
+
},
|
366
|
+
|
367
|
+
'selectDateRangeType': {
|
368
|
+
label: '日期类型',
|
369
|
+
name: 'type',
|
370
|
+
type: 'select',
|
371
|
+
creatable: false,
|
372
|
+
options: [
|
373
|
+
{
|
374
|
+
label: '日期',
|
375
|
+
value: 'input-date-range'
|
376
|
+
},
|
377
|
+
{
|
378
|
+
label: '日期时间',
|
379
|
+
value: 'input-datetime-range'
|
380
|
+
},
|
381
|
+
{
|
382
|
+
label: '时间',
|
383
|
+
value: 'input-time-range'
|
384
|
+
},
|
385
|
+
{
|
386
|
+
label: '月份',
|
387
|
+
value: 'input-month-range'
|
388
|
+
},
|
389
|
+
{
|
390
|
+
label: '季度',
|
391
|
+
value: 'input-quarter-range'
|
392
|
+
},
|
393
|
+
{
|
394
|
+
label: '年份',
|
395
|
+
value: 'input-year-range'
|
396
|
+
}
|
397
|
+
]
|
398
|
+
},
|
222
399
|
|
223
|
-
|
400
|
+
'menuTpl': {
|
401
|
+
type: 'ae-formulaControl',
|
402
|
+
label: tipedLabel('模板', '选项渲染模板,支持JSX,变量使用\\${xx}'),
|
403
|
+
name: 'menuTpl'
|
404
|
+
},
|
224
405
|
|
225
|
-
expression: {
|
406
|
+
'expression': {
|
226
407
|
type: 'input-text',
|
227
408
|
description: '支持 JS 表达式,如:`this.xxx == 1`'
|
228
409
|
},
|
229
410
|
|
230
|
-
icon: {
|
411
|
+
'icon': {
|
231
412
|
label: '图标',
|
232
413
|
type: 'icon-picker',
|
233
414
|
name: 'icon',
|
415
|
+
className: 'fix-icon-picker-overflow',
|
234
416
|
placeholder: '点击选择图标',
|
235
417
|
clearable: true,
|
236
418
|
description: ''
|
237
419
|
},
|
238
420
|
|
239
|
-
size: {
|
421
|
+
'size': {
|
240
422
|
label: '控件尺寸',
|
241
423
|
type: 'button-group-select',
|
242
424
|
name: 'size',
|
243
|
-
size: 'sm',
|
244
425
|
clearable: true,
|
245
426
|
options: [
|
246
427
|
{
|
@@ -262,7 +443,24 @@ const tpls: {
|
|
262
443
|
]
|
263
444
|
},
|
264
445
|
|
265
|
-
|
446
|
+
'horizontal-align': {
|
447
|
+
type: 'button-group-select',
|
448
|
+
label: '位置',
|
449
|
+
options: [
|
450
|
+
{
|
451
|
+
label: '左边',
|
452
|
+
value: 'left',
|
453
|
+
icon: 'fa fa-align-left'
|
454
|
+
},
|
455
|
+
{
|
456
|
+
label: '右边',
|
457
|
+
value: 'right',
|
458
|
+
icon: 'fa fa-align-right'
|
459
|
+
}
|
460
|
+
]
|
461
|
+
},
|
462
|
+
|
463
|
+
'name': {
|
266
464
|
label: '名字',
|
267
465
|
name: 'name',
|
268
466
|
type: 'input-text',
|
@@ -270,7 +468,7 @@ const tpls: {
|
|
270
468
|
placeholder: '请输入字母或者数字'
|
271
469
|
},
|
272
470
|
|
273
|
-
reload: {
|
471
|
+
'reload': {
|
274
472
|
label: '刷新目标组件',
|
275
473
|
name: 'reload',
|
276
474
|
asFormItem: true,
|
@@ -288,54 +486,17 @@ const tpls: {
|
|
288
486
|
}
|
289
487
|
},
|
290
488
|
|
291
|
-
className: {
|
292
|
-
label: 'CSS 类名',
|
489
|
+
'className': (schema: any) => ({
|
293
490
|
type: 'ae-classname',
|
294
491
|
name: 'className',
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
},
|
304
|
-
|
305
|
-
apiControl: (patch: any = {}) => {
|
306
|
-
const {name, label, value, description, sampleBuilder, ...rest} = patch;
|
307
|
-
|
308
|
-
return {
|
309
|
-
type: 'ae-apiControl',
|
310
|
-
label,
|
311
|
-
name,
|
312
|
-
description,
|
313
|
-
labelRemark: sampleBuilder
|
314
|
-
? {
|
315
|
-
icon: '',
|
316
|
-
label: '示例',
|
317
|
-
title: '接口返回示例',
|
318
|
-
tooltipClassName: 'ae-ApiSample-tooltip',
|
319
|
-
render: (data: any) => (
|
320
|
-
<Html
|
321
|
-
className="ae-ApiSample"
|
322
|
-
inline={false}
|
323
|
-
html={`
|
324
|
-
<pre><code>${sampleBuilder(data)}</code></pre>
|
325
|
-
`}
|
326
|
-
/>
|
327
|
-
),
|
328
|
-
trigger: 'click',
|
329
|
-
className: 'm-l-xs',
|
330
|
-
rootClose: true,
|
331
|
-
placement: 'left'
|
332
|
-
}
|
333
|
-
: undefined,
|
334
|
-
...rest
|
335
|
-
};
|
336
|
-
},
|
337
|
-
|
338
|
-
api: (patch: any = {}) => {
|
492
|
+
...(schema || {}),
|
493
|
+
label: tipedLabel(
|
494
|
+
schema?.label || 'CSS 类名',
|
495
|
+
'有哪些辅助类 CSS 类名?请前往 <a href="https://baidu.github.io/amis/docs/concepts/style" target="_blank">样式说明</a>,除此之外你可以添加自定义类名,然后在系统配置中添加自定义样式。'
|
496
|
+
)
|
497
|
+
}),
|
498
|
+
|
499
|
+
'api': (patch: any = {}) => {
|
339
500
|
const {name, label, value, description, sampleBuilder, ...rest} = patch;
|
340
501
|
|
341
502
|
return {
|
@@ -418,8 +579,9 @@ const tpls: {
|
|
418
579
|
let url = value;
|
419
580
|
let method = 'get';
|
420
581
|
|
421
|
-
const m =
|
422
|
-
|
582
|
+
const m = /^(raw:|external:)?(get|post|put|patch|delete):(.*)$/.exec(
|
583
|
+
url
|
584
|
+
);
|
423
585
|
if (m) {
|
424
586
|
url = m[1] + m[3];
|
425
587
|
method = m[2];
|
@@ -479,7 +641,6 @@ const tpls: {
|
|
479
641
|
type: 'switch',
|
480
642
|
label: '数据映射',
|
481
643
|
name: 'data',
|
482
|
-
mode: 'inline',
|
483
644
|
className: 'w-full m-b-xs',
|
484
645
|
pipeIn: (value: any) => !!value,
|
485
646
|
pipeOut: (value: any) => (value ? {'&': '$$'} : null)
|
@@ -490,7 +651,8 @@ const tpls: {
|
|
490
651
|
visibleOn: '!this.data',
|
491
652
|
inline: false,
|
492
653
|
className: 'text-sm text-muted m-b',
|
493
|
-
tpl:
|
654
|
+
tpl:
|
655
|
+
'当没开启数据映射时,发送 API 的时候会发送尽可能多的数据,如果你想自己控制发送的数据,或者需要额外的数据处理,请开启此选项'
|
494
656
|
},
|
495
657
|
|
496
658
|
{
|
@@ -515,7 +677,6 @@ const tpls: {
|
|
515
677
|
type: 'switch',
|
516
678
|
label: '是否设置缓存',
|
517
679
|
name: 'cache',
|
518
|
-
mode: 'inline',
|
519
680
|
className: 'w-full m-b-xs',
|
520
681
|
description: '设置该请求缓存的有效时间',
|
521
682
|
pipeIn: (value: any) => !!value,
|
@@ -533,11 +694,9 @@ const tpls: {
|
|
533
694
|
},
|
534
695
|
|
535
696
|
{
|
536
|
-
label: '文件下载',
|
537
697
|
type: 'switch',
|
698
|
+
label: '文件下载',
|
538
699
|
name: 'responseType',
|
539
|
-
mode: 'inline',
|
540
|
-
className: 'block',
|
541
700
|
pipeIn: (value: any) => value === 'blob',
|
542
701
|
pipeOut: (value: any) => (value ? 'blob' : undefined),
|
543
702
|
description:
|
@@ -573,8 +732,6 @@ const tpls: {
|
|
573
732
|
type: 'switch',
|
574
733
|
label: '数据替换',
|
575
734
|
name: 'replaceData',
|
576
|
-
mode: 'inline',
|
577
|
-
className: 'w-full',
|
578
735
|
description: '默认数据都是追加方式,开启这个后是完全替换'
|
579
736
|
},
|
580
737
|
|
@@ -582,7 +739,6 @@ const tpls: {
|
|
582
739
|
type: 'switch',
|
583
740
|
label: '返回结果映射',
|
584
741
|
name: 'responseData',
|
585
|
-
mode: 'inline',
|
586
742
|
className: 'w-full m-b-xs',
|
587
743
|
pipeIn: (value: any) => !!value,
|
588
744
|
pipeOut: (value: any) => (value ? {'&': '$$'} : null)
|
@@ -636,8 +792,42 @@ const tpls: {
|
|
636
792
|
...rest
|
637
793
|
};
|
638
794
|
},
|
795
|
+
/**
|
796
|
+
* combo 组件样式包装调整
|
797
|
+
*/
|
798
|
+
'combo-container': (config: SchemaObject) => {
|
799
|
+
if (isObject(config)) {
|
800
|
+
const itemsWrapperClassName =
|
801
|
+
(config as any).type === 'combo' &&
|
802
|
+
'ae-Combo-items ' + ((config as any).itemsWrapperClassName ?? '');
|
803
|
+
return {
|
804
|
+
...(config as any),
|
805
|
+
...(itemsWrapperClassName ? {itemsWrapperClassName} : {})
|
806
|
+
};
|
807
|
+
}
|
808
|
+
return config;
|
809
|
+
},
|
810
|
+
|
811
|
+
// 所有组件的状态
|
812
|
+
'status': (config: {
|
813
|
+
isFormItem?: boolean;
|
814
|
+
readonly?: boolean;
|
815
|
+
disabled?: boolean;
|
816
|
+
}) => {
|
817
|
+
return {
|
818
|
+
title: '状态',
|
819
|
+
body: [
|
820
|
+
getSchemaTpl('hidden'),
|
821
|
+
config?.readonly ? getSchemaTpl('readonly') : null,
|
822
|
+
config?.disabled || config?.isFormItem
|
823
|
+
? getSchemaTpl('disabled')
|
824
|
+
: null,
|
825
|
+
config?.isFormItem ? getSchemaTpl('clearValueOnHidden') : null
|
826
|
+
]
|
827
|
+
};
|
828
|
+
},
|
639
829
|
|
640
|
-
source: (patch: any = {}) => {
|
830
|
+
'source': (patch: any = {}) => {
|
641
831
|
return getSchemaTpl('api', {
|
642
832
|
name: 'source',
|
643
833
|
label: '获取选项接口',
|
@@ -668,39 +858,45 @@ const tpls: {
|
|
668
858
|
});
|
669
859
|
},
|
670
860
|
|
671
|
-
autoFill: {
|
861
|
+
'autoFill': {
|
672
862
|
type: 'input-kv',
|
673
863
|
name: 'autoFill',
|
674
|
-
label:
|
675
|
-
|
676
|
-
description:
|
864
|
+
label: tipedLabel(
|
865
|
+
'自动填充',
|
677
866
|
'将当前已选中的选项的某个字段的值,自动填充到表单中某个表单项中,支持数据映射'
|
867
|
+
)
|
678
868
|
},
|
679
869
|
|
680
|
-
|
681
|
-
|
682
|
-
apiString: {
|
870
|
+
'apiString': {
|
683
871
|
name: 'api',
|
684
872
|
type: 'input-text',
|
685
873
|
placeholder: 'http://'
|
686
874
|
},
|
687
875
|
|
688
|
-
required: {
|
689
|
-
name: 'required',
|
876
|
+
'required': {
|
690
877
|
type: 'switch',
|
691
|
-
|
692
|
-
|
693
|
-
|
878
|
+
name: 'required',
|
879
|
+
label: '是否必填',
|
880
|
+
mode: 'horizontal',
|
881
|
+
horizontal: {
|
882
|
+
justify: true,
|
883
|
+
left: 8
|
884
|
+
},
|
885
|
+
inputClassName: 'is-inline '
|
694
886
|
},
|
695
887
|
|
696
|
-
|
888
|
+
/**
|
889
|
+
* 表单项描述description
|
890
|
+
*/
|
891
|
+
'description': {
|
697
892
|
name: 'description',
|
698
893
|
type: 'textarea',
|
699
|
-
label: '描述',
|
894
|
+
label: tipedLabel('描述', '表单项控件下方浅色文字描述'),
|
895
|
+
maxRows: 2,
|
700
896
|
pipeIn: (value: any, data: any) => value || data.desc || ''
|
701
897
|
},
|
702
898
|
|
703
|
-
options: {
|
899
|
+
'options': {
|
704
900
|
label: '选项 Options',
|
705
901
|
name: 'options',
|
706
902
|
type: 'combo',
|
@@ -780,7 +976,7 @@ const tpls: {
|
|
780
976
|
]
|
781
977
|
},
|
782
978
|
|
783
|
-
tree: {
|
979
|
+
'tree': {
|
784
980
|
label: '选项 Options',
|
785
981
|
name: 'options',
|
786
982
|
type: 'combo',
|
@@ -810,103 +1006,86 @@ const tpls: {
|
|
810
1006
|
]
|
811
1007
|
},
|
812
1008
|
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
1009
|
+
'leftFixed': {
|
1010
|
+
name: 'horizontal.leftFixed',
|
1011
|
+
type: 'button-group-select',
|
1012
|
+
visibleOn: 'data.horizontal && data.horizontal.leftFixed',
|
1013
|
+
label: '宽度',
|
1014
|
+
options: [
|
1015
|
+
{
|
1016
|
+
label: '小',
|
1017
|
+
value: 'sm'
|
1018
|
+
},
|
1019
|
+
|
1020
|
+
{
|
1021
|
+
label: '中',
|
1022
|
+
value: 'normal'
|
1023
|
+
},
|
1024
|
+
|
1025
|
+
{
|
1026
|
+
label: '大',
|
1027
|
+
value: 'lg'
|
1028
|
+
}
|
1029
|
+
]
|
830
1030
|
},
|
831
1031
|
|
832
|
-
|
833
|
-
type: 'combo',
|
834
|
-
syncDefaultValue: false,
|
1032
|
+
'leftRate': {
|
835
1033
|
name: 'horizontal',
|
836
|
-
|
837
|
-
visibleOn:
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
: value && /\bcol\-(?:xs|sm|md|lg)\-(\d+)\b/.test(value.left)
|
845
|
-
? parseInt(RegExp.$1, 10)
|
846
|
-
: 2,
|
847
|
-
leftFixed: (value && value.leftFixed) || ''
|
848
|
-
};
|
1034
|
+
type: 'input-range',
|
1035
|
+
visibleOn: 'data.horizontal && !data.horizontal.leftFixed',
|
1036
|
+
min: 1,
|
1037
|
+
max: 11,
|
1038
|
+
step: 1,
|
1039
|
+
label: tipedLabel('比例', '12 等份,标题宽度占比 n/12'),
|
1040
|
+
pipeIn(v: any) {
|
1041
|
+
return v.left || 3;
|
849
1042
|
},
|
850
|
-
pipeOut
|
851
|
-
|
1043
|
+
pipeOut(v: any) {
|
1044
|
+
return {left: v, right: 12 - v};
|
1045
|
+
}
|
1046
|
+
},
|
852
1047
|
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
1048
|
+
'horizontal': () => [
|
1049
|
+
{
|
1050
|
+
type: 'button-group-select',
|
1051
|
+
label: '标题宽度',
|
1052
|
+
name: 'horizontal',
|
1053
|
+
options: [
|
1054
|
+
{label: '继承', value: 'formHorizontal'},
|
1055
|
+
{label: '固宽', value: 'leftFixed'},
|
1056
|
+
{label: '比例', value: 'leftRate'}
|
1057
|
+
],
|
1058
|
+
pipeIn(v: any) {
|
1059
|
+
if (!v) {
|
1060
|
+
return 'formHorizontal';
|
1061
|
+
}
|
1062
|
+
if (v.leftFixed) {
|
1063
|
+
return 'leftFixed';
|
1064
|
+
}
|
1065
|
+
return 'leftRate';
|
1066
|
+
},
|
1067
|
+
pipeOut(v: any) {
|
1068
|
+
const defaultData = {
|
1069
|
+
formHorizontal: undefined,
|
1070
|
+
leftFixed: {leftFixed: 'normal'},
|
1071
|
+
leftRate: {left: 3, right: 9}
|
1072
|
+
};
|
1073
|
+
|
1074
|
+
// @ts-ignore
|
1075
|
+
return defaultData[v];
|
1076
|
+
},
|
1077
|
+
visibleOn: 'this.mode == "horizontal" && this.label !== false'
|
858
1078
|
},
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
{
|
868
|
-
label: '比率',
|
869
|
-
value: ''
|
870
|
-
},
|
871
|
-
|
872
|
-
{
|
873
|
-
label: '小宽度',
|
874
|
-
value: 'sm',
|
875
|
-
visibleOn: 'this.leftFixed'
|
876
|
-
},
|
877
|
-
|
878
|
-
{
|
879
|
-
label: '固定宽度',
|
880
|
-
value: 'normal'
|
881
|
-
},
|
882
|
-
|
883
|
-
{
|
884
|
-
label: '大宽度',
|
885
|
-
value: 'lg',
|
886
|
-
visibleOn: 'this.leftFixed'
|
887
|
-
}
|
888
|
-
]
|
889
|
-
},
|
890
|
-
{
|
891
|
-
name: 'leftRate',
|
892
|
-
type: 'input-range',
|
893
|
-
visibleOn: '!this.leftFixed',
|
894
|
-
min: 1,
|
895
|
-
max: 11,
|
896
|
-
step: 1,
|
897
|
-
label: '左右分布调整(n/12)',
|
898
|
-
labelRemark: {
|
899
|
-
trigger: 'click',
|
900
|
-
className: 'm-l-xs',
|
901
|
-
rootClose: true,
|
902
|
-
content: '一共 12 等份,这里可以设置左侧宽度占比 n/12。',
|
903
|
-
placement: 'left'
|
904
|
-
}
|
905
|
-
}
|
906
|
-
]
|
907
|
-
},
|
1079
|
+
{
|
1080
|
+
type: 'container',
|
1081
|
+
className: 'ae-ExtendMore mb-3',
|
1082
|
+
visibleOn:
|
1083
|
+
'this.mode == "horizontal" && this.horizontal && this.label !== false',
|
1084
|
+
body: [getSchemaTpl('leftFixed'), getSchemaTpl('leftRate')]
|
1085
|
+
}
|
1086
|
+
],
|
908
1087
|
|
909
|
-
subFormItemMode: {
|
1088
|
+
'subFormItemMode': {
|
910
1089
|
label: '子表单展示模式',
|
911
1090
|
name: 'subFormMode',
|
912
1091
|
type: 'button-group-select',
|
@@ -938,14 +1117,12 @@ const tpls: {
|
|
938
1117
|
]
|
939
1118
|
},
|
940
1119
|
|
941
|
-
subFormHorizontalMode: {
|
1120
|
+
'subFormHorizontalMode': {
|
1121
|
+
type: 'switch',
|
942
1122
|
label: '子表单水平占比设置',
|
943
1123
|
name: 'subFormHorizontal',
|
944
|
-
type: 'switch',
|
945
1124
|
onText: '继承',
|
946
1125
|
offText: '自定义',
|
947
|
-
mode: 'inline',
|
948
|
-
className: 'w-full',
|
949
1126
|
inputClassName: 'text-sm',
|
950
1127
|
visibleOn: 'this.subFormMode == "horizontal"',
|
951
1128
|
pipeIn: (value: any) => !value,
|
@@ -957,7 +1134,7 @@ const tpls: {
|
|
957
1134
|
}
|
958
1135
|
},
|
959
1136
|
|
960
|
-
subFormHorizontal: {
|
1137
|
+
'subFormHorizontal': {
|
961
1138
|
type: 'combo',
|
962
1139
|
syncDefaultValue: false,
|
963
1140
|
visibleOn: 'data.subFormMode == "horizontal" && data.subFormHorizontal',
|
@@ -1033,7 +1210,7 @@ const tpls: {
|
|
1033
1210
|
]
|
1034
1211
|
},
|
1035
1212
|
|
1036
|
-
validations: (function () {
|
1213
|
+
'validations': (function () {
|
1037
1214
|
const options = [
|
1038
1215
|
// {
|
1039
1216
|
// label: '必填',
|
@@ -1290,7 +1467,7 @@ const tpls: {
|
|
1290
1467
|
};
|
1291
1468
|
})(),
|
1292
1469
|
|
1293
|
-
validationErrors: (function () {
|
1470
|
+
'validationErrors': (function () {
|
1294
1471
|
const options = [
|
1295
1472
|
// {
|
1296
1473
|
// label: '必填',
|
@@ -1520,12 +1697,10 @@ const tpls: {
|
|
1520
1697
|
};
|
1521
1698
|
})(),
|
1522
1699
|
|
1523
|
-
submitOnChange: {
|
1524
|
-
label: '修改即提交',
|
1700
|
+
'submitOnChange': {
|
1525
1701
|
type: 'switch',
|
1702
|
+
label: '修改即提交',
|
1526
1703
|
name: 'submitOnChange',
|
1527
|
-
mode: 'inline',
|
1528
|
-
className: 'w-full',
|
1529
1704
|
labelRemark: {
|
1530
1705
|
trigger: 'click',
|
1531
1706
|
className: 'm-l-xs',
|
@@ -1535,27 +1710,23 @@ const tpls: {
|
|
1535
1710
|
}
|
1536
1711
|
},
|
1537
1712
|
|
1538
|
-
validateOnChange: {
|
1539
|
-
type: '
|
1713
|
+
'validateOnChange': {
|
1714
|
+
type: 'select',
|
1540
1715
|
name: 'validateOnChange',
|
1541
|
-
label: '
|
1542
|
-
description: '默认为当表单提交过则每次修改都触发验证。',
|
1543
|
-
size: 'xs',
|
1544
|
-
mode: 'inline',
|
1545
|
-
className: 'w-full',
|
1716
|
+
label: '校验触发',
|
1546
1717
|
options: [
|
1547
1718
|
{
|
1548
|
-
label: '
|
1719
|
+
label: '提交后每次修改即触发',
|
1549
1720
|
value: ''
|
1550
1721
|
},
|
1551
1722
|
|
1552
1723
|
{
|
1553
|
-
label: '
|
1724
|
+
label: '修改即触发',
|
1554
1725
|
value: true
|
1555
1726
|
},
|
1556
1727
|
|
1557
1728
|
{
|
1558
|
-
label: '
|
1729
|
+
label: '提交触发',
|
1559
1730
|
value: false
|
1560
1731
|
}
|
1561
1732
|
],
|
@@ -1563,85 +1734,7 @@ const tpls: {
|
|
1563
1734
|
pipeOut: (value: any) => (value === '' ? undefined : !!value)
|
1564
1735
|
},
|
1565
1736
|
|
1566
|
-
|
1567
|
-
type: 'ae-validationControl',
|
1568
|
-
label: '校验',
|
1569
|
-
mode: 'normal'
|
1570
|
-
},
|
1571
|
-
|
1572
|
-
visible: {
|
1573
|
-
type: 'fieldSet',
|
1574
|
-
title: '显隐配置',
|
1575
|
-
collapsable: false, // 避免和最外层的属性配置面板的tabs样式重叠
|
1576
|
-
body: [
|
1577
|
-
{
|
1578
|
-
label: '设置方式',
|
1579
|
-
name: 'visible',
|
1580
|
-
type: 'button-group-select',
|
1581
|
-
size: 'xs',
|
1582
|
-
mode: 'inline',
|
1583
|
-
className: 'w-full',
|
1584
|
-
options: [
|
1585
|
-
{
|
1586
|
-
label: '静态设置',
|
1587
|
-
value: 1
|
1588
|
-
},
|
1589
|
-
|
1590
|
-
{
|
1591
|
-
label: '表达式',
|
1592
|
-
value: 2
|
1593
|
-
}
|
1594
|
-
],
|
1595
|
-
pipeIn: (value: any) => (typeof value === 'boolean' ? 1 : 2),
|
1596
|
-
pipeOut: (value: any) => (value === 1 ? true : ''),
|
1597
|
-
onChange: (value: any, oldValue: boolean, model: any, form: any) => {
|
1598
|
-
if (value) {
|
1599
|
-
form.setValues({
|
1600
|
-
__visibleOn: form.data.visibleOn,
|
1601
|
-
visibleOn: '',
|
1602
|
-
clearValueOnHidden: false
|
1603
|
-
});
|
1604
|
-
} else {
|
1605
|
-
form.setValueByName('visibleOn', form.data.__visibleOn);
|
1606
|
-
}
|
1607
|
-
}
|
1608
|
-
},
|
1609
|
-
|
1610
|
-
{
|
1611
|
-
type: 'switch',
|
1612
|
-
label: '可见(visible)',
|
1613
|
-
name: 'visible',
|
1614
|
-
visibleOn: 'typeof this.visible === "boolean"',
|
1615
|
-
pipeIn: (value: any, data: any) => value !== false && !data.hidden,
|
1616
|
-
mode: 'inline',
|
1617
|
-
className: 'w-full m-b-none',
|
1618
|
-
onChange: (value: boolean, oldValue: boolean, model: any, form: any) =>
|
1619
|
-
form.setValueByName('visibleOn', '')
|
1620
|
-
},
|
1621
|
-
|
1622
|
-
{
|
1623
|
-
name: 'visibleOn',
|
1624
|
-
label: '可见表达式(visibleOn)',
|
1625
|
-
labelRemark: {
|
1626
|
-
trigger: 'click',
|
1627
|
-
className: 'm-l-xs',
|
1628
|
-
rootClose: true,
|
1629
|
-
content:
|
1630
|
-
'纯粹的 JS 语法,this 指向当前数据层。文档:<a href="https://baidu.github.io/amis/docs/concepts/expression">表达式语法</a>',
|
1631
|
-
placement: 'left'
|
1632
|
-
},
|
1633
|
-
placeholder: '如:this.type === 1',
|
1634
|
-
type: 'input-text',
|
1635
|
-
visibleOn: 'typeof this.visible !== "boolean"',
|
1636
|
-
autoComplete: false,
|
1637
|
-
pipeIn: (value: any, data: any) =>
|
1638
|
-
value || (data.hiddenOn && `!(${data.hiddenOn})`) || '',
|
1639
|
-
className: 'm-b-none'
|
1640
|
-
}
|
1641
|
-
]
|
1642
|
-
},
|
1643
|
-
|
1644
|
-
initFetch: {
|
1737
|
+
'initFetch': {
|
1645
1738
|
type: 'group',
|
1646
1739
|
label: '是否初始加载',
|
1647
1740
|
visibleOn: 'this.initApi',
|
@@ -1691,155 +1784,200 @@ const tpls: {
|
|
1691
1784
|
]
|
1692
1785
|
},
|
1693
1786
|
|
1694
|
-
disabled:
|
1695
|
-
|
1696
|
-
|
1697
|
-
|
1698
|
-
|
1699
|
-
|
1700
|
-
|
1701
|
-
{
|
1702
|
-
label: '设置方式',
|
1703
|
-
name: 'disabled',
|
1704
|
-
type: 'button-group-select',
|
1705
|
-
size: 'xs',
|
1706
|
-
mode: 'inline',
|
1707
|
-
className: 'w-full',
|
1708
|
-
options: [
|
1709
|
-
{
|
1710
|
-
label: '静态设置',
|
1711
|
-
value: 1
|
1712
|
-
},
|
1787
|
+
'disabled': {
|
1788
|
+
type: 'ae-StatusControl',
|
1789
|
+
label: '禁用',
|
1790
|
+
mode: 'normal',
|
1791
|
+
name: 'disabled',
|
1792
|
+
expressioName: 'disabledOn'
|
1793
|
+
},
|
1713
1794
|
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
},
|
1795
|
+
'readonly': {
|
1796
|
+
type: 'ae-StatusControl',
|
1797
|
+
label: '只读',
|
1798
|
+
mode: 'normal',
|
1799
|
+
name: 'readOnly',
|
1800
|
+
expressioName: 'readOnlyOn'
|
1801
|
+
},
|
1722
1802
|
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
className: 'w-full m-b-none',
|
1731
|
-
onChange: (
|
1732
|
-
value: boolean,
|
1733
|
-
oldValue: boolean,
|
1734
|
-
model: any,
|
1735
|
-
form: any
|
1736
|
-
) => form.setValueByName('disabledOn', '')
|
1737
|
-
},
|
1803
|
+
'visible': {
|
1804
|
+
type: 'ae-StatusControl',
|
1805
|
+
label: '可见',
|
1806
|
+
mode: 'normal',
|
1807
|
+
name: 'visible',
|
1808
|
+
expressioName: 'visibleOn'
|
1809
|
+
},
|
1738
1810
|
|
1739
|
-
|
1740
|
-
|
1741
|
-
|
1742
|
-
|
1743
|
-
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1747
|
-
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1751
|
-
|
1752
|
-
|
1753
|
-
|
1754
|
-
|
1755
|
-
]
|
1756
|
-
};
|
1811
|
+
'hidden': {
|
1812
|
+
type: 'ae-StatusControl',
|
1813
|
+
label: '隐藏',
|
1814
|
+
mode: 'normal',
|
1815
|
+
name: 'hidden',
|
1816
|
+
expressioName: 'hiddenOn'
|
1817
|
+
},
|
1818
|
+
|
1819
|
+
'maximum': {
|
1820
|
+
type: 'input-number',
|
1821
|
+
label: '最大值'
|
1822
|
+
},
|
1823
|
+
|
1824
|
+
'minimum': {
|
1825
|
+
type: 'input-number',
|
1826
|
+
label: '最小值'
|
1757
1827
|
},
|
1758
1828
|
|
1759
|
-
switchDefaultValue: {
|
1829
|
+
'switchDefaultValue': {
|
1760
1830
|
type: 'switch',
|
1831
|
+
label: '默认值设置',
|
1761
1832
|
name: 'value',
|
1762
|
-
label: '设置默认值',
|
1763
|
-
mode: 'inline',
|
1764
|
-
className: 'w-full',
|
1765
1833
|
pipeIn: (value: any) => typeof value !== 'undefined',
|
1766
1834
|
pipeOut: (value: any, origin: any, data: any) => (value ? '' : undefined),
|
1767
|
-
|
1835
|
+
labelRemark: {
|
1836
|
+
trigger: ['hover', 'focus'],
|
1837
|
+
setting: true,
|
1838
|
+
title: '',
|
1839
|
+
content: '不设置时根据 name 获取'
|
1840
|
+
}
|
1768
1841
|
},
|
1769
1842
|
|
1770
|
-
multiple: {
|
1771
|
-
|
1843
|
+
'multiple': (schema: any = {}) => ({
|
1844
|
+
type: 'ae-Switch-More',
|
1845
|
+
mode: 'normal',
|
1772
1846
|
name: 'multiple',
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
1847
|
+
label: '可多选',
|
1848
|
+
value: false,
|
1849
|
+
hiddenOnDefault: true,
|
1850
|
+
formType: 'extend',
|
1851
|
+
form: {
|
1852
|
+
body: schema.replace
|
1853
|
+
? schema.body
|
1854
|
+
: [
|
1855
|
+
getSchemaTpl('joinValues'),
|
1856
|
+
getSchemaTpl('delimiter'),
|
1857
|
+
getSchemaTpl('extractValue'),
|
1858
|
+
...[schema.body || []]
|
1859
|
+
]
|
1860
|
+
}
|
1861
|
+
}),
|
1862
|
+
|
1863
|
+
'checkAll': () => [
|
1864
|
+
getSchemaTpl('switch', {
|
1865
|
+
label: '可全选',
|
1866
|
+
name: 'checkAll',
|
1867
|
+
value: false,
|
1868
|
+
visibleOn: 'data.multiple'
|
1869
|
+
}),
|
1870
|
+
{
|
1871
|
+
type: 'container',
|
1872
|
+
className: 'ae-ExtendMore mb-2',
|
1873
|
+
visibleOn: 'data.checkAll && data.multiple',
|
1874
|
+
body: [
|
1875
|
+
getSchemaTpl('switch', {
|
1876
|
+
label: '默认全选',
|
1877
|
+
name: 'defaultCheckAll',
|
1878
|
+
value: false
|
1879
|
+
}),
|
1880
|
+
{
|
1881
|
+
type: 'input-text',
|
1882
|
+
name: 'checkAllLabel',
|
1883
|
+
label: '选项文案',
|
1884
|
+
value: '全选',
|
1885
|
+
mode: 'row'
|
1886
|
+
}
|
1887
|
+
]
|
1888
|
+
}
|
1889
|
+
],
|
1789
1890
|
|
1790
|
-
|
1891
|
+
'joinValues': () =>
|
1892
|
+
getSchemaTpl('switch', {
|
1893
|
+
label: tipedLabel(
|
1894
|
+
'拼接值',
|
1895
|
+
'开启后将选中的选项 value 的值用连接符拼接起来,作为当前表单项的值'
|
1896
|
+
),
|
1897
|
+
name: 'joinValues',
|
1898
|
+
visibleOn: 'data.multiple',
|
1899
|
+
value: true
|
1900
|
+
}),
|
1901
|
+
|
1902
|
+
'delimiter': {
|
1791
1903
|
type: 'input-text',
|
1792
1904
|
name: 'delimiter',
|
1793
|
-
label: '
|
1905
|
+
label: tipedLabel('拼接符', '将多个值拼接成一个字符串的连接符号'),
|
1794
1906
|
visibleOn: 'data.multiple && data.joinValues',
|
1795
1907
|
pipeIn: defaultValue(',')
|
1796
1908
|
},
|
1797
1909
|
|
1798
|
-
extractValue: {
|
1910
|
+
'extractValue': {
|
1799
1911
|
type: 'switch',
|
1912
|
+
label: tipedLabel(
|
1913
|
+
'仅提取值',
|
1914
|
+
'开启后将选中项的 value 封装为数组,关闭后则将整个选项数据封装为数组。'
|
1915
|
+
),
|
1800
1916
|
name: 'extractValue',
|
1801
|
-
|
1802
|
-
|
1803
|
-
|
1804
|
-
visibleOn: 'data.joinValues === false',
|
1805
|
-
pipeIn: defaultValue(false),
|
1806
|
-
description: '开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。'
|
1917
|
+
inputClassName: 'is-inline',
|
1918
|
+
visibleOn: 'data.multiple && data.joinValues === false',
|
1919
|
+
pipeIn: defaultValue(false)
|
1807
1920
|
},
|
1808
1921
|
|
1809
|
-
creatable: {
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1922
|
+
'creatable': (schema: Partial<SchemaObject> = {}) => {
|
1923
|
+
return {
|
1924
|
+
label: tipedLabel('可创建', '配置事件动作可插入或拦截默认交互'),
|
1925
|
+
type: 'ae-switch-more',
|
1926
|
+
mode: 'normal',
|
1927
|
+
name: 'creatable',
|
1928
|
+
...schema
|
1929
|
+
};
|
1815
1930
|
},
|
1816
1931
|
|
1817
|
-
|
1818
|
-
|
1932
|
+
'addApi': () =>
|
1933
|
+
getSchemaTpl('apiControl', {
|
1934
|
+
label: '新增接口',
|
1935
|
+
name: 'addApi',
|
1936
|
+
visibleOn: 'data.creatable'
|
1937
|
+
}),
|
1938
|
+
|
1939
|
+
'createBtnLabel': {
|
1940
|
+
label: '按钮名称',
|
1819
1941
|
name: 'createBtnLabel',
|
1820
1942
|
type: 'input-text',
|
1821
|
-
|
1822
|
-
placeholder: '新增选项',
|
1823
|
-
className: 'w-full'
|
1943
|
+
placeholder: '新建'
|
1824
1944
|
},
|
1825
1945
|
|
1826
|
-
editable: {
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1830
|
-
|
1831
|
-
|
1946
|
+
'editable': (schema: Partial<SchemaObject> = {}) => {
|
1947
|
+
return {
|
1948
|
+
label: tipedLabel('可编辑', '配置事件动作可插入或拦截默认交互'),
|
1949
|
+
type: 'ae-switch-more',
|
1950
|
+
mode: 'normal',
|
1951
|
+
name: 'editable',
|
1952
|
+
...schema
|
1953
|
+
};
|
1832
1954
|
},
|
1833
1955
|
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1956
|
+
'editApi': () =>
|
1957
|
+
getSchemaTpl('apiControl', {
|
1958
|
+
label: '编辑接口',
|
1959
|
+
name: 'editApi',
|
1960
|
+
visibleOn: 'data.editable'
|
1961
|
+
}),
|
1962
|
+
|
1963
|
+
'removable': (schema: Partial<SchemaObject> = {}) => {
|
1964
|
+
return {
|
1965
|
+
label: tipedLabel('可删除', '配置事件动作可插入或拦截默认交互'),
|
1966
|
+
type: 'ae-switch-more',
|
1967
|
+
mode: 'normal',
|
1968
|
+
name: 'removable',
|
1969
|
+
...schema
|
1970
|
+
};
|
1840
1971
|
},
|
1841
1972
|
|
1842
|
-
|
1973
|
+
'deleteApi': () =>
|
1974
|
+
getSchemaTpl('apiControl', {
|
1975
|
+
label: '删除接口',
|
1976
|
+
name: 'deleteApi',
|
1977
|
+
visibleOn: 'data.removable'
|
1978
|
+
}),
|
1979
|
+
|
1980
|
+
'ref': () => {
|
1843
1981
|
// {
|
1844
1982
|
// type: 'input-text',
|
1845
1983
|
// name: '$ref',
|
@@ -1849,17 +1987,22 @@ const tpls: {
|
|
1849
1987
|
return null;
|
1850
1988
|
},
|
1851
1989
|
|
1852
|
-
imageUrl: {
|
1990
|
+
'imageUrl': {
|
1853
1991
|
type: 'input-text',
|
1854
1992
|
label: '图片'
|
1855
1993
|
},
|
1856
1994
|
|
1857
|
-
|
1995
|
+
'backgroundImageUrl': {
|
1996
|
+
type: 'input-text',
|
1997
|
+
label: '图片路径'
|
1998
|
+
},
|
1999
|
+
|
2000
|
+
'fileUrl': {
|
1858
2001
|
type: 'input-text',
|
1859
2002
|
label: '文件'
|
1860
2003
|
},
|
1861
2004
|
|
1862
|
-
markdownBody: {
|
2005
|
+
'markdownBody': {
|
1863
2006
|
name: 'value',
|
1864
2007
|
type: 'editor',
|
1865
2008
|
language: 'markdown',
|
@@ -1870,7 +2013,7 @@ const tpls: {
|
|
1870
2013
|
}
|
1871
2014
|
},
|
1872
2015
|
|
1873
|
-
richText: {
|
2016
|
+
'richText': {
|
1874
2017
|
label: '富文本',
|
1875
2018
|
type: 'input-rich-text',
|
1876
2019
|
buttons: [
|
@@ -1901,18 +2044,20 @@ const tpls: {
|
|
1901
2044
|
size: 'lg'
|
1902
2045
|
},
|
1903
2046
|
|
1904
|
-
showCounter: {
|
1905
|
-
label: '是否显示计数器',
|
1906
|
-
name: 'showCounter',
|
2047
|
+
'showCounter': {
|
1907
2048
|
type: 'switch',
|
1908
|
-
|
1909
|
-
|
2049
|
+
label: '计数器',
|
2050
|
+
name: 'showCounter',
|
2051
|
+
inputClassName: 'is-inline'
|
1910
2052
|
},
|
1911
2053
|
|
1912
|
-
borderMode: {
|
1913
|
-
type: 'select',
|
2054
|
+
'borderMode': {
|
1914
2055
|
name: 'borderMode',
|
1915
2056
|
label: '边框模式',
|
2057
|
+
type: 'button-group-select',
|
2058
|
+
size: 'sm',
|
2059
|
+
mode: 'row',
|
2060
|
+
className: 'ae-buttonGroupSelect--justify',
|
1916
2061
|
options: [
|
1917
2062
|
{label: '全边框', value: 'full'},
|
1918
2063
|
{label: '半边框', value: 'half'},
|
@@ -1920,10 +2065,432 @@ const tpls: {
|
|
1920
2065
|
]
|
1921
2066
|
},
|
1922
2067
|
|
1923
|
-
|
2068
|
+
'searchable': () =>
|
2069
|
+
getSchemaTpl('switch', {
|
2070
|
+
label: '可检索',
|
2071
|
+
name: 'searchable'
|
2072
|
+
}),
|
2073
|
+
|
2074
|
+
'sortable': {
|
2075
|
+
type: 'switch',
|
2076
|
+
label: '可排序',
|
2077
|
+
name: 'sortable'
|
2078
|
+
},
|
2079
|
+
|
2080
|
+
'selectFirst': {
|
2081
|
+
type: 'switch',
|
2082
|
+
label: '是否默认选择第一个',
|
2083
|
+
name: 'selectFirst'
|
2084
|
+
},
|
2085
|
+
|
2086
|
+
'hideNodePathLabel': {
|
2087
|
+
type: 'switch',
|
2088
|
+
label: '隐藏选中节点的祖先节点文本信息',
|
2089
|
+
name: 'hideNodePathLabel'
|
2090
|
+
},
|
2091
|
+
|
2092
|
+
'clearValueOnHidden': () =>
|
2093
|
+
getSchemaTpl('switch', {
|
2094
|
+
type: 'switch',
|
2095
|
+
horizontal: {left: 8, justify: true},
|
2096
|
+
label: tipedLabel(
|
2097
|
+
'隐藏时删除字段',
|
2098
|
+
'当前表单项隐藏时,表单提交数据中会删除该表单项的值'
|
2099
|
+
),
|
2100
|
+
name: 'clearValueOnHidden'
|
2101
|
+
}),
|
2102
|
+
|
2103
|
+
'utc': {
|
2104
|
+
type: 'switch',
|
2105
|
+
label: tipedLabel(
|
2106
|
+
'UTC转换',
|
2107
|
+
'开启后,提交数据和展示数据将进行UTC转换;存在跨地域用户的应用建议开启'
|
2108
|
+
),
|
2109
|
+
name: 'utc',
|
2110
|
+
inputClassName: 'is-inline'
|
2111
|
+
},
|
2112
|
+
|
2113
|
+
'embed': {
|
2114
|
+
type: 'switch',
|
2115
|
+
label: '内嵌模式',
|
2116
|
+
name: 'embed'
|
2117
|
+
},
|
2118
|
+
|
2119
|
+
'buttonLevel': {
|
2120
|
+
label: '按钮样式',
|
2121
|
+
type: 'select',
|
2122
|
+
name: 'level',
|
2123
|
+
options: [
|
2124
|
+
{
|
2125
|
+
label: '默认',
|
2126
|
+
value: 'default',
|
2127
|
+
level: 'default'
|
2128
|
+
},
|
2129
|
+
{
|
2130
|
+
label: '链接',
|
2131
|
+
value: 'link',
|
2132
|
+
level: 'link'
|
2133
|
+
},
|
2134
|
+
{
|
2135
|
+
label: '主色',
|
2136
|
+
value: 'primary',
|
2137
|
+
level: 'primary'
|
2138
|
+
},
|
2139
|
+
|
2140
|
+
{
|
2141
|
+
label: '淡色',
|
2142
|
+
value: 'light',
|
2143
|
+
level: 'light'
|
2144
|
+
},
|
2145
|
+
{
|
2146
|
+
label: '深色',
|
2147
|
+
value: 'dark',
|
2148
|
+
level: 'dark'
|
2149
|
+
},
|
2150
|
+
|
2151
|
+
{
|
2152
|
+
label: '提示',
|
2153
|
+
value: 'info',
|
2154
|
+
level: 'info'
|
2155
|
+
},
|
2156
|
+
{
|
2157
|
+
label: '成功',
|
2158
|
+
value: 'success',
|
2159
|
+
level: 'success'
|
2160
|
+
},
|
2161
|
+
{
|
2162
|
+
label: '警告',
|
2163
|
+
value: 'warning',
|
2164
|
+
level: 'warning'
|
2165
|
+
},
|
2166
|
+
{
|
2167
|
+
label: '严重',
|
2168
|
+
value: 'danger',
|
2169
|
+
level: 'danger'
|
2170
|
+
},
|
2171
|
+
{
|
2172
|
+
label: '次要',
|
2173
|
+
value: 'secondary',
|
2174
|
+
level: 'secondary'
|
2175
|
+
},
|
2176
|
+
{
|
2177
|
+
label: '加强',
|
2178
|
+
value: 'enhance',
|
2179
|
+
level: 'enhance'
|
2180
|
+
}
|
2181
|
+
],
|
2182
|
+
pipeIn: defaultValue('default')
|
2183
|
+
},
|
2184
|
+
|
2185
|
+
'uploadType': {
|
2186
|
+
label: '上传方式',
|
2187
|
+
name: 'uploadType',
|
2188
|
+
type: 'select',
|
2189
|
+
value: 'fileReceptor',
|
2190
|
+
options: [
|
2191
|
+
{
|
2192
|
+
label: '文件接收器',
|
2193
|
+
value: 'fileReceptor'
|
2194
|
+
},
|
2195
|
+
|
2196
|
+
{
|
2197
|
+
label: '对象存储',
|
2198
|
+
value: 'bos'
|
2199
|
+
}
|
2200
|
+
]
|
2201
|
+
},
|
2202
|
+
|
2203
|
+
'bos': {
|
2204
|
+
label: '存储仓库',
|
2205
|
+
type: 'select',
|
2206
|
+
name: 'bos',
|
2207
|
+
value: 'default',
|
2208
|
+
options: [
|
2209
|
+
{
|
2210
|
+
label: '平台默认',
|
2211
|
+
value: 'default'
|
2212
|
+
}
|
2213
|
+
]
|
2214
|
+
},
|
2215
|
+
|
2216
|
+
'proxy': {
|
2217
|
+
type: 'switch',
|
2218
|
+
label: '后端代理',
|
2219
|
+
name: 'proxy',
|
2220
|
+
mode: 'horizontal',
|
2221
|
+
horizontal: {
|
2222
|
+
justify: true,
|
2223
|
+
left: 8
|
2224
|
+
},
|
2225
|
+
inputClassName: 'is-inline'
|
2226
|
+
},
|
2227
|
+
|
2228
|
+
/**
|
2229
|
+
* 选项控件
|
2230
|
+
*/
|
2231
|
+
'optionControl': {
|
2232
|
+
label: '数据',
|
2233
|
+
mode: 'normal',
|
2234
|
+
name: 'options',
|
2235
|
+
type: 'ae-optionControl'
|
2236
|
+
},
|
2237
|
+
|
2238
|
+
'badge': {
|
2239
|
+
label: '角标',
|
2240
|
+
name: 'badge',
|
2241
|
+
type: 'ae-badge'
|
2242
|
+
},
|
2243
|
+
|
2244
|
+
/**
|
2245
|
+
* 接口控件
|
2246
|
+
*/
|
2247
|
+
'apiControl': (patch: any = {}) => {
|
2248
|
+
const {name, label, value, description, sampleBuilder, ...rest} = patch;
|
2249
|
+
|
2250
|
+
return {
|
2251
|
+
type: 'ae-apiControl',
|
2252
|
+
label,
|
2253
|
+
name,
|
2254
|
+
description,
|
2255
|
+
mode: 'normal',
|
2256
|
+
labelRemark: sampleBuilder
|
2257
|
+
? {
|
2258
|
+
icon: '',
|
2259
|
+
label: '示例',
|
2260
|
+
title: '接口返回示例',
|
2261
|
+
tooltipClassName: 'ae-ApiSample-tooltip',
|
2262
|
+
render: (data: any) => (
|
2263
|
+
<Html
|
2264
|
+
className="ae-ApiSample"
|
2265
|
+
inline={false}
|
2266
|
+
html={`
|
2267
|
+
<pre><code>${sampleBuilder(data)}</code></pre>
|
2268
|
+
`}
|
2269
|
+
/>
|
2270
|
+
),
|
2271
|
+
trigger: 'click',
|
2272
|
+
className: 'm-l-xs',
|
2273
|
+
rootClose: true,
|
2274
|
+
placement: 'left'
|
2275
|
+
}
|
2276
|
+
: undefined,
|
2277
|
+
...rest
|
2278
|
+
};
|
2279
|
+
},
|
2280
|
+
|
2281
|
+
/**
|
2282
|
+
* 接口控件
|
2283
|
+
*/
|
2284
|
+
'actionApiControl': (patch: any = {}) => {
|
2285
|
+
const {name, label, value, description, sampleBuilder, ...rest} = patch;
|
2286
|
+
|
2287
|
+
return {
|
2288
|
+
type: 'ae-actionApiControl',
|
2289
|
+
label,
|
2290
|
+
name,
|
2291
|
+
description,
|
2292
|
+
mode: 'normal',
|
2293
|
+
labelRemark: sampleBuilder
|
2294
|
+
? {
|
2295
|
+
icon: '',
|
2296
|
+
label: '示例',
|
2297
|
+
title: '接口返回示例',
|
2298
|
+
tooltipClassName: 'ae-ApiSample-tooltip',
|
2299
|
+
render: (data: any) => (
|
2300
|
+
<Html
|
2301
|
+
className="ae-ApiSample"
|
2302
|
+
inline={false}
|
2303
|
+
html={`
|
2304
|
+
<pre><code>${sampleBuilder(data)}</code></pre>
|
2305
|
+
`}
|
2306
|
+
/>
|
2307
|
+
),
|
2308
|
+
trigger: 'click',
|
2309
|
+
className: 'm-l-xs',
|
2310
|
+
rootClose: true,
|
2311
|
+
placement: 'left'
|
2312
|
+
}
|
2313
|
+
: undefined,
|
2314
|
+
...rest
|
2315
|
+
};
|
2316
|
+
},
|
2317
|
+
|
2318
|
+
'validation': (config: {
|
2319
|
+
tag: ValidatorTag | ((ctx: any) => ValidatorTag);
|
2320
|
+
}) => {
|
2321
|
+
let a = {
|
2322
|
+
title: '校验',
|
2323
|
+
body: [
|
2324
|
+
{
|
2325
|
+
type: 'ae-validationControl',
|
2326
|
+
mode: 'normal',
|
2327
|
+
...config
|
2328
|
+
// pipeIn: (value: any, data: any) => {
|
2329
|
+
// // return reduce(value, (arr: any, item) => {
|
2330
|
+
// // if (typeof item === 'string') {
|
2331
|
+
// // arr.push(item);
|
2332
|
+
// // }
|
2333
|
+
// // else {
|
2334
|
+
// // let isAdd = false;
|
2335
|
+
// // // 优先判断是否具备可展示条件
|
2336
|
+
// // forEach(item?.isShow, (val, key) => {
|
2337
|
+
// // if ([...val].includes(data?.data[key])) {
|
2338
|
+
// // isAdd = true;
|
2339
|
+
// // return false;
|
2340
|
+
// // }
|
2341
|
+
// // })
|
2342
|
+
// // !isAdd && forEach(item?.isHidden, (val, key) => {
|
2343
|
+
// // const hasExist = [...val].includes(data?.data[key]);
|
2344
|
+
// // isAdd = hasExist ? false : true;
|
2345
|
+
// // if (hasExist) {
|
2346
|
+
// // return false;
|
2347
|
+
// // }
|
2348
|
+
// // })
|
2349
|
+
// // isAdd && arr.push(item.option);
|
2350
|
+
// // }
|
2351
|
+
// // return arr;
|
2352
|
+
// // }, []);
|
2353
|
+
// },
|
2354
|
+
},
|
2355
|
+
getSchemaTpl('validateOnChange')
|
2356
|
+
]
|
2357
|
+
};
|
2358
|
+
return a;
|
2359
|
+
},
|
2360
|
+
/**
|
2361
|
+
* 表单项校验控件
|
2362
|
+
*/
|
2363
|
+
'validationControl': (value: Array<ValidationOptions> = []) => ({
|
2364
|
+
type: 'ae-validationControl',
|
2365
|
+
label: '校验规则',
|
2366
|
+
mode: 'normal',
|
2367
|
+
pipeIn: (value: any, data: any) => {
|
2368
|
+
return reduce(
|
2369
|
+
value,
|
2370
|
+
(arr: any, item) => {
|
2371
|
+
if (typeof item === 'string') {
|
2372
|
+
arr.push(item);
|
2373
|
+
} else {
|
2374
|
+
let isAdd = false;
|
2375
|
+
// 优先判断是否具备可展示条件
|
2376
|
+
forEach(item?.isShow, (val, key) => {
|
2377
|
+
if ([...val].includes(data?.data[key])) {
|
2378
|
+
isAdd = true;
|
2379
|
+
return false;
|
2380
|
+
}
|
2381
|
+
return true;
|
2382
|
+
});
|
2383
|
+
!isAdd &&
|
2384
|
+
forEach(item?.isHidden, (val, key) => {
|
2385
|
+
const hasExist = [...val].includes(data?.data[key]);
|
2386
|
+
isAdd = hasExist ? false : true;
|
2387
|
+
if (hasExist) {
|
2388
|
+
return false;
|
2389
|
+
}
|
2390
|
+
return true;
|
2391
|
+
});
|
2392
|
+
isAdd && arr.push(item.option);
|
2393
|
+
}
|
2394
|
+
return arr;
|
2395
|
+
},
|
2396
|
+
[]
|
2397
|
+
);
|
2398
|
+
},
|
2399
|
+
value
|
2400
|
+
}),
|
2401
|
+
|
2402
|
+
/**
|
2403
|
+
* 表达式编辑器控件
|
2404
|
+
*/
|
2405
|
+
'formulaControl': (schema: object = {}) => {
|
2406
|
+
return {
|
2407
|
+
type: 'ae-formulaControl',
|
2408
|
+
...schema
|
2409
|
+
};
|
2410
|
+
},
|
2411
|
+
|
2412
|
+
/**
|
2413
|
+
* 日期范围快捷键组件
|
2414
|
+
*/
|
2415
|
+
'dateShortCutControl': (schema: object = {}) => {
|
2416
|
+
return {
|
2417
|
+
type: 'ae-DateShortCutControl',
|
2418
|
+
...schema
|
2419
|
+
};
|
2420
|
+
},
|
2421
|
+
|
2422
|
+
'eventControl': (schema: any = {}) => {
|
2423
|
+
return {
|
2424
|
+
type: 'ae-eventControl',
|
2425
|
+
mode: 'normal',
|
2426
|
+
...schema
|
2427
|
+
};
|
2428
|
+
},
|
2429
|
+
|
2430
|
+
'style:formItem': ({renderer, schema}: any) => {
|
2431
|
+
return {
|
2432
|
+
title: '表单项',
|
2433
|
+
key: 'formItem',
|
2434
|
+
body: [
|
2435
|
+
getSchemaTpl('formItemMode'),
|
2436
|
+
getSchemaTpl('labelHide'),
|
2437
|
+
getSchemaTpl('horizontal'),
|
2438
|
+
renderer?.sizeMutable !== false ? getSchemaTpl('formItemSize') : null
|
2439
|
+
// getSchemaTpl('formItemInline')
|
2440
|
+
].concat(schema)
|
2441
|
+
};
|
2442
|
+
},
|
2443
|
+
|
2444
|
+
'style:classNames': (config: {
|
2445
|
+
schema: SchemaCollection;
|
2446
|
+
isFormItem: boolean;
|
2447
|
+
}) => {
|
2448
|
+
const {isFormItem = true, schema = []} = config || {};
|
2449
|
+
|
2450
|
+
return {
|
2451
|
+
title: 'CSS 类名',
|
2452
|
+
body: (isFormItem
|
2453
|
+
? [
|
2454
|
+
getSchemaTpl('className', {
|
2455
|
+
label: '表单项'
|
2456
|
+
}),
|
2457
|
+
getSchemaTpl('className', {
|
2458
|
+
label: '标签',
|
2459
|
+
name: 'labelClassName'
|
2460
|
+
}),
|
2461
|
+
getSchemaTpl('className', {
|
2462
|
+
label: '控件',
|
2463
|
+
name: 'inputClassName'
|
2464
|
+
})
|
2465
|
+
]
|
2466
|
+
: [
|
2467
|
+
getSchemaTpl('className', {
|
2468
|
+
label: '外层'
|
2469
|
+
})
|
2470
|
+
]
|
2471
|
+
).concat(schema)
|
2472
|
+
};
|
2473
|
+
},
|
2474
|
+
|
2475
|
+
'style:others': (schemas: any[] = []) => ({
|
2476
|
+
title: '其他项',
|
2477
|
+
body: [...schemas]
|
2478
|
+
}),
|
2479
|
+
|
2480
|
+
'data': {
|
1924
2481
|
type: 'input-kv',
|
1925
2482
|
name: 'data',
|
1926
2483
|
label: '初始静态数据'
|
2484
|
+
},
|
2485
|
+
|
2486
|
+
'app-page': {
|
2487
|
+
type: 'nested-select',
|
2488
|
+
label: '选择页面',
|
2489
|
+
name: 'link',
|
2490
|
+
mode: 'horizontal',
|
2491
|
+
size: 'lg',
|
2492
|
+
required: true,
|
2493
|
+
options: []
|
1927
2494
|
}
|
1928
2495
|
};
|
1929
2496
|
|
@@ -2115,23 +2682,165 @@ export const styleTpl = {
|
|
2115
2682
|
}
|
2116
2683
|
]
|
2117
2684
|
};
|
2118
|
-
|
2685
|
+
|
2686
|
+
/**
|
2687
|
+
* 通用CSS Style控件
|
2688
|
+
* @param {string | Array<string>} exclude 需要隐藏的配置key
|
2689
|
+
*/
|
2690
|
+
tpls['style:common'] = (exclude: string[] | string) => {
|
2691
|
+
// key统一转换成Kebab case,eg: boxShadow => bos-shadow
|
2692
|
+
exclude = (exclude
|
2693
|
+
? Array.isArray(exclude)
|
2694
|
+
? exclude
|
2695
|
+
: [exclude]
|
2696
|
+
: []
|
2697
|
+
).map((key: string) => kebabCase(key));
|
2698
|
+
|
2699
|
+
return [
|
2700
|
+
{
|
2701
|
+
header: '布局',
|
2702
|
+
key: 'layout',
|
2703
|
+
body: [
|
2704
|
+
{
|
2705
|
+
type: 'style-display',
|
2706
|
+
label: false,
|
2707
|
+
name: 'style'
|
2708
|
+
}
|
2709
|
+
].filter(comp => !~exclude.indexOf(comp.type.replace(/^style-/i, '')))
|
2710
|
+
},
|
2711
|
+
{
|
2712
|
+
header: '文字',
|
2713
|
+
key: 'font',
|
2714
|
+
body: [
|
2715
|
+
{
|
2716
|
+
type: 'style-font',
|
2717
|
+
label: false,
|
2718
|
+
name: 'style'
|
2719
|
+
}
|
2720
|
+
]
|
2721
|
+
},
|
2722
|
+
{
|
2723
|
+
header: '内外边距',
|
2724
|
+
key: 'box-model',
|
2725
|
+
body: [
|
2726
|
+
{
|
2727
|
+
type: 'style-box-model',
|
2728
|
+
label: false,
|
2729
|
+
name: 'style'
|
2730
|
+
}
|
2731
|
+
]
|
2732
|
+
},
|
2733
|
+
{
|
2734
|
+
header: '背景',
|
2735
|
+
key: 'background',
|
2736
|
+
body: [
|
2737
|
+
{
|
2738
|
+
type: 'style-background',
|
2739
|
+
label: false,
|
2740
|
+
name: 'style'
|
2741
|
+
}
|
2742
|
+
]
|
2743
|
+
},
|
2744
|
+
{
|
2745
|
+
header: '边框',
|
2746
|
+
key: 'border',
|
2747
|
+
body: [
|
2748
|
+
{
|
2749
|
+
type: 'style-border',
|
2750
|
+
label: false,
|
2751
|
+
name: 'style'
|
2752
|
+
}
|
2753
|
+
]
|
2754
|
+
},
|
2755
|
+
{
|
2756
|
+
header: '阴影',
|
2757
|
+
key: 'box-shadow',
|
2758
|
+
body: [
|
2759
|
+
{
|
2760
|
+
type: 'style-box-shadow',
|
2761
|
+
label: false,
|
2762
|
+
name: 'style.boxShadow'
|
2763
|
+
}
|
2764
|
+
]
|
2765
|
+
},
|
2766
|
+
{
|
2767
|
+
header: '其他',
|
2768
|
+
key: 'other',
|
2769
|
+
body: [
|
2770
|
+
{
|
2771
|
+
label: '透明度',
|
2772
|
+
name: 'style.opacity',
|
2773
|
+
min: 0,
|
2774
|
+
max: 1,
|
2775
|
+
step: 0.05,
|
2776
|
+
type: 'input-range',
|
2777
|
+
pipeIn: defaultValue(1),
|
2778
|
+
marks: {
|
2779
|
+
'0%': '0',
|
2780
|
+
'50%': '0.5',
|
2781
|
+
'100%': '1'
|
2782
|
+
}
|
2783
|
+
},
|
2784
|
+
{
|
2785
|
+
label: '光标类型',
|
2786
|
+
name: 'style.cursor',
|
2787
|
+
type: 'select',
|
2788
|
+
mode: 'row',
|
2789
|
+
menuTpl: {
|
2790
|
+
type: 'html',
|
2791
|
+
html:
|
2792
|
+
"<span style='cursor:${value};'>${label}</span><code class='ae-Code'>${value}</code>",
|
2793
|
+
className: 'ae-selection-code'
|
2794
|
+
},
|
2795
|
+
pipIn: defaultValue('default'),
|
2796
|
+
options: [
|
2797
|
+
{label: '默认', value: 'default'},
|
2798
|
+
{label: '自动', value: 'auto'},
|
2799
|
+
{label: '无指针', value: 'none'},
|
2800
|
+
{label: '悬浮', value: 'pointer'},
|
2801
|
+
{label: '帮助', value: 'help'},
|
2802
|
+
{label: '文本', value: 'text'},
|
2803
|
+
{label: '单元格', value: 'cell'},
|
2804
|
+
{label: '交叉指针', value: 'crosshair'},
|
2805
|
+
{label: '可移动', value: 'move'},
|
2806
|
+
{label: '禁用', value: 'not-allowed'},
|
2807
|
+
{label: '可抓取', value: 'grab'},
|
2808
|
+
{label: '放大', value: 'zoom-in'},
|
2809
|
+
{label: '缩小', value: 'zoom-out'}
|
2810
|
+
]
|
2811
|
+
}
|
2812
|
+
]
|
2813
|
+
}
|
2814
|
+
].filter(item => !~exclude.indexOf(item.key));
|
2815
|
+
};
|
2816
|
+
|
2817
|
+
export function getCollapseCate(config: {
|
2818
|
+
name: string;
|
2819
|
+
body: SchemaCollection;
|
2820
|
+
visibleOn?: string;
|
2821
|
+
tools: SchemaCollection;
|
2822
|
+
}) {
|
2823
|
+
return;
|
2824
|
+
}
|
2119
2825
|
|
2120
2826
|
export function getSchemaTpl(name: string, patch?: object): any {
|
2121
|
-
const tpl = tpls[name];
|
2827
|
+
const tpl = tpls[name] || {};
|
2828
|
+
let schema = null;
|
2122
2829
|
|
2123
2830
|
if (typeof tpl === 'function') {
|
2124
|
-
|
2831
|
+
schema = tpl(patch);
|
2832
|
+
} else {
|
2833
|
+
schema = tpl
|
2834
|
+
? patch
|
2835
|
+
? {
|
2836
|
+
...tpl,
|
2837
|
+
...patch
|
2838
|
+
}
|
2839
|
+
: tpl
|
2840
|
+
: null;
|
2125
2841
|
}
|
2126
2842
|
|
2127
|
-
return
|
2128
|
-
? patch
|
2129
|
-
? {
|
2130
|
-
...tpl,
|
2131
|
-
...patch
|
2132
|
-
}
|
2133
|
-
: tpl
|
2134
|
-
: null;
|
2843
|
+
return schema;
|
2135
2844
|
}
|
2136
2845
|
|
2137
2846
|
export function setSchemaTpl(name: string, value: any) {
|
@@ -2150,6 +2859,21 @@ export function valuePipeOut(value: any) {
|
|
2150
2859
|
}
|
2151
2860
|
}
|
2152
2861
|
|
2862
|
+
export function undefinedPipeOut(value: any) {
|
2863
|
+
if (Array.isArray(value)) {
|
2864
|
+
return value.length ? value : undefined;
|
2865
|
+
}
|
2866
|
+
|
2867
|
+
if (typeof value === 'string') {
|
2868
|
+
return value ? value : undefined;
|
2869
|
+
}
|
2870
|
+
|
2871
|
+
if (typeof value === 'object') {
|
2872
|
+
return Object.keys(value).length ? value : undefined;
|
2873
|
+
}
|
2874
|
+
return value;
|
2875
|
+
}
|
2876
|
+
|
2153
2877
|
export function defaultValue(defaultValue: any, strictMode: boolean = true) {
|
2154
2878
|
return strictMode
|
2155
2879
|
? (value: any) => (typeof value === 'undefined' ? defaultValue : value)
|