amis-editor 4.2.0-beta.2 → 5.1.9-beta.0
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/BackTop.d.ts +1 -1
- 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 +44 -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 +1209 -474
- 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 +78 -136
- 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,43 @@ 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('newVisible'),
|
821
|
+
getSchemaTpl('hidden'),
|
822
|
+
config?.readonly ? getSchemaTpl('readonly') : null,
|
823
|
+
config?.disabled || config?.isFormItem
|
824
|
+
? getSchemaTpl('disabled')
|
825
|
+
: null,
|
826
|
+
config?.isFormItem ? getSchemaTpl('clearValueOnHidden') : null
|
827
|
+
]
|
828
|
+
};
|
829
|
+
},
|
639
830
|
|
640
|
-
source: (patch: any = {}) => {
|
831
|
+
'source': (patch: any = {}) => {
|
641
832
|
return getSchemaTpl('api', {
|
642
833
|
name: 'source',
|
643
834
|
label: '获取选项接口',
|
@@ -668,39 +859,45 @@ const tpls: {
|
|
668
859
|
});
|
669
860
|
},
|
670
861
|
|
671
|
-
autoFill: {
|
862
|
+
'autoFill': {
|
672
863
|
type: 'input-kv',
|
673
864
|
name: 'autoFill',
|
674
|
-
label:
|
675
|
-
|
676
|
-
description:
|
865
|
+
label: tipedLabel(
|
866
|
+
'自动填充',
|
677
867
|
'将当前已选中的选项的某个字段的值,自动填充到表单中某个表单项中,支持数据映射'
|
868
|
+
)
|
678
869
|
},
|
679
870
|
|
680
|
-
|
681
|
-
|
682
|
-
apiString: {
|
871
|
+
'apiString': {
|
683
872
|
name: 'api',
|
684
873
|
type: 'input-text',
|
685
874
|
placeholder: 'http://'
|
686
875
|
},
|
687
876
|
|
688
|
-
required: {
|
689
|
-
name: 'required',
|
877
|
+
'required': {
|
690
878
|
type: 'switch',
|
691
|
-
|
692
|
-
|
693
|
-
|
879
|
+
name: 'required',
|
880
|
+
label: '是否必填',
|
881
|
+
mode: 'horizontal',
|
882
|
+
horizontal: {
|
883
|
+
justify: true,
|
884
|
+
left: 8
|
885
|
+
},
|
886
|
+
inputClassName: 'is-inline '
|
694
887
|
},
|
695
888
|
|
696
|
-
|
889
|
+
/**
|
890
|
+
* 表单项描述description
|
891
|
+
*/
|
892
|
+
'description': {
|
697
893
|
name: 'description',
|
698
894
|
type: 'textarea',
|
699
|
-
label: '描述',
|
895
|
+
label: tipedLabel('描述', '表单项控件下方浅色文字描述'),
|
896
|
+
maxRows: 2,
|
700
897
|
pipeIn: (value: any, data: any) => value || data.desc || ''
|
701
898
|
},
|
702
899
|
|
703
|
-
options: {
|
900
|
+
'options': {
|
704
901
|
label: '选项 Options',
|
705
902
|
name: 'options',
|
706
903
|
type: 'combo',
|
@@ -780,7 +977,7 @@ const tpls: {
|
|
780
977
|
]
|
781
978
|
},
|
782
979
|
|
783
|
-
tree: {
|
980
|
+
'tree': {
|
784
981
|
label: '选项 Options',
|
785
982
|
name: 'options',
|
786
983
|
type: 'combo',
|
@@ -810,103 +1007,86 @@ const tpls: {
|
|
810
1007
|
]
|
811
1008
|
},
|
812
1009
|
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
1010
|
+
'leftFixed': {
|
1011
|
+
name: 'horizontal.leftFixed',
|
1012
|
+
type: 'button-group-select',
|
1013
|
+
visibleOn: 'data.horizontal && data.horizontal.leftFixed',
|
1014
|
+
label: '宽度',
|
1015
|
+
options: [
|
1016
|
+
{
|
1017
|
+
label: '小',
|
1018
|
+
value: 'sm'
|
1019
|
+
},
|
1020
|
+
|
1021
|
+
{
|
1022
|
+
label: '中',
|
1023
|
+
value: 'normal'
|
1024
|
+
},
|
1025
|
+
|
1026
|
+
{
|
1027
|
+
label: '大',
|
1028
|
+
value: 'lg'
|
1029
|
+
}
|
1030
|
+
]
|
830
1031
|
},
|
831
1032
|
|
832
|
-
|
833
|
-
type: 'combo',
|
834
|
-
syncDefaultValue: false,
|
1033
|
+
'leftRate': {
|
835
1034
|
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
|
-
};
|
1035
|
+
type: 'input-range',
|
1036
|
+
visibleOn: 'data.horizontal && !data.horizontal.leftFixed',
|
1037
|
+
min: 1,
|
1038
|
+
max: 11,
|
1039
|
+
step: 1,
|
1040
|
+
label: tipedLabel('比例', '12 等份,标题宽度占比 n/12'),
|
1041
|
+
pipeIn(v: any) {
|
1042
|
+
return v.left || 3;
|
849
1043
|
},
|
850
|
-
pipeOut
|
851
|
-
|
1044
|
+
pipeOut(v: any) {
|
1045
|
+
return {left: v, right: 12 - v};
|
1046
|
+
}
|
1047
|
+
},
|
852
1048
|
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
1049
|
+
'horizontal': () => [
|
1050
|
+
{
|
1051
|
+
type: 'button-group-select',
|
1052
|
+
label: '标题宽度',
|
1053
|
+
name: 'horizontal',
|
1054
|
+
options: [
|
1055
|
+
{label: '继承', value: 'formHorizontal'},
|
1056
|
+
{label: '固宽', value: 'leftFixed'},
|
1057
|
+
{label: '比例', value: 'leftRate'}
|
1058
|
+
],
|
1059
|
+
pipeIn(v: any) {
|
1060
|
+
if (!v) {
|
1061
|
+
return 'formHorizontal';
|
1062
|
+
}
|
1063
|
+
if (v.leftFixed) {
|
1064
|
+
return 'leftFixed';
|
1065
|
+
}
|
1066
|
+
return 'leftRate';
|
1067
|
+
},
|
1068
|
+
pipeOut(v: any) {
|
1069
|
+
const defaultData = {
|
1070
|
+
formHorizontal: undefined,
|
1071
|
+
leftFixed: {leftFixed: 'normal'},
|
1072
|
+
leftRate: {left: 3, right: 9}
|
1073
|
+
};
|
1074
|
+
|
1075
|
+
// @ts-ignore
|
1076
|
+
return defaultData[v];
|
1077
|
+
},
|
1078
|
+
visibleOn: 'this.mode == "horizontal" && this.label !== false'
|
858
1079
|
},
|
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
|
-
},
|
1080
|
+
{
|
1081
|
+
type: 'container',
|
1082
|
+
className: 'ae-ExtendMore mb-3',
|
1083
|
+
visibleOn:
|
1084
|
+
'this.mode == "horizontal" && this.horizontal && this.label !== false',
|
1085
|
+
body: [getSchemaTpl('leftFixed'), getSchemaTpl('leftRate')]
|
1086
|
+
}
|
1087
|
+
],
|
908
1088
|
|
909
|
-
subFormItemMode: {
|
1089
|
+
'subFormItemMode': {
|
910
1090
|
label: '子表单展示模式',
|
911
1091
|
name: 'subFormMode',
|
912
1092
|
type: 'button-group-select',
|
@@ -938,14 +1118,12 @@ const tpls: {
|
|
938
1118
|
]
|
939
1119
|
},
|
940
1120
|
|
941
|
-
subFormHorizontalMode: {
|
1121
|
+
'subFormHorizontalMode': {
|
1122
|
+
type: 'switch',
|
942
1123
|
label: '子表单水平占比设置',
|
943
1124
|
name: 'subFormHorizontal',
|
944
|
-
type: 'switch',
|
945
1125
|
onText: '继承',
|
946
1126
|
offText: '自定义',
|
947
|
-
mode: 'inline',
|
948
|
-
className: 'w-full',
|
949
1127
|
inputClassName: 'text-sm',
|
950
1128
|
visibleOn: 'this.subFormMode == "horizontal"',
|
951
1129
|
pipeIn: (value: any) => !value,
|
@@ -957,7 +1135,7 @@ const tpls: {
|
|
957
1135
|
}
|
958
1136
|
},
|
959
1137
|
|
960
|
-
subFormHorizontal: {
|
1138
|
+
'subFormHorizontal': {
|
961
1139
|
type: 'combo',
|
962
1140
|
syncDefaultValue: false,
|
963
1141
|
visibleOn: 'data.subFormMode == "horizontal" && data.subFormHorizontal',
|
@@ -1033,7 +1211,7 @@ const tpls: {
|
|
1033
1211
|
]
|
1034
1212
|
},
|
1035
1213
|
|
1036
|
-
validations: (function () {
|
1214
|
+
'validations': (function () {
|
1037
1215
|
const options = [
|
1038
1216
|
// {
|
1039
1217
|
// label: '必填',
|
@@ -1290,7 +1468,7 @@ const tpls: {
|
|
1290
1468
|
};
|
1291
1469
|
})(),
|
1292
1470
|
|
1293
|
-
validationErrors: (function () {
|
1471
|
+
'validationErrors': (function () {
|
1294
1472
|
const options = [
|
1295
1473
|
// {
|
1296
1474
|
// label: '必填',
|
@@ -1520,12 +1698,10 @@ const tpls: {
|
|
1520
1698
|
};
|
1521
1699
|
})(),
|
1522
1700
|
|
1523
|
-
submitOnChange: {
|
1524
|
-
label: '修改即提交',
|
1701
|
+
'submitOnChange': {
|
1525
1702
|
type: 'switch',
|
1703
|
+
label: '修改即提交',
|
1526
1704
|
name: 'submitOnChange',
|
1527
|
-
mode: 'inline',
|
1528
|
-
className: 'w-full',
|
1529
1705
|
labelRemark: {
|
1530
1706
|
trigger: 'click',
|
1531
1707
|
className: 'm-l-xs',
|
@@ -1535,27 +1711,23 @@ const tpls: {
|
|
1535
1711
|
}
|
1536
1712
|
},
|
1537
1713
|
|
1538
|
-
validateOnChange: {
|
1539
|
-
type: '
|
1714
|
+
'validateOnChange': {
|
1715
|
+
type: 'select',
|
1540
1716
|
name: 'validateOnChange',
|
1541
|
-
label: '
|
1542
|
-
description: '默认为当表单提交过则每次修改都触发验证。',
|
1543
|
-
size: 'xs',
|
1544
|
-
mode: 'inline',
|
1545
|
-
className: 'w-full',
|
1717
|
+
label: '校验触发',
|
1546
1718
|
options: [
|
1547
1719
|
{
|
1548
|
-
label: '
|
1720
|
+
label: '提交后每次修改即触发',
|
1549
1721
|
value: ''
|
1550
1722
|
},
|
1551
1723
|
|
1552
1724
|
{
|
1553
|
-
label: '
|
1725
|
+
label: '修改即触发',
|
1554
1726
|
value: true
|
1555
1727
|
},
|
1556
1728
|
|
1557
1729
|
{
|
1558
|
-
label: '
|
1730
|
+
label: '提交触发',
|
1559
1731
|
value: false
|
1560
1732
|
}
|
1561
1733
|
],
|
@@ -1563,85 +1735,7 @@ const tpls: {
|
|
1563
1735
|
pipeOut: (value: any) => (value === '' ? undefined : !!value)
|
1564
1736
|
},
|
1565
1737
|
|
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: {
|
1738
|
+
'initFetch': {
|
1645
1739
|
type: 'group',
|
1646
1740
|
label: '是否初始加载',
|
1647
1741
|
visibleOn: 'this.initApi',
|
@@ -1691,155 +1785,210 @@ const tpls: {
|
|
1691
1785
|
]
|
1692
1786
|
},
|
1693
1787
|
|
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
|
-
},
|
1788
|
+
'disabled': {
|
1789
|
+
type: 'ae-StatusControl',
|
1790
|
+
label: '禁用',
|
1791
|
+
mode: 'normal',
|
1792
|
+
name: 'disabled',
|
1793
|
+
expressionName: 'disabledOn'
|
1794
|
+
},
|
1713
1795
|
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
},
|
1796
|
+
'readonly': {
|
1797
|
+
type: 'ae-StatusControl',
|
1798
|
+
label: '只读',
|
1799
|
+
mode: 'normal',
|
1800
|
+
name: 'readOnly',
|
1801
|
+
expressionName: 'readOnlyOn'
|
1802
|
+
},
|
1722
1803
|
|
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
|
-
},
|
1804
|
+
'visible': {
|
1805
|
+
type: 'ae-StatusControl',
|
1806
|
+
label: '可见',
|
1807
|
+
mode: 'normal',
|
1808
|
+
name: 'visible',
|
1809
|
+
expressionName: 'visibleOn'
|
1810
|
+
},
|
1738
1811
|
|
1739
|
-
|
1740
|
-
|
1741
|
-
|
1742
|
-
|
1743
|
-
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1747
|
-
content:
|
1748
|
-
'纯粹的 JS 语法,this 指向当前数据层。文档:<a href="https://baidu.github.io/amis/docs/concepts/expression">表达式语法</a>',
|
1749
|
-
placement: 'left'
|
1750
|
-
},
|
1751
|
-
type: 'input-text',
|
1752
|
-
visibleOn: 'typeof this.disabled !== "boolean"',
|
1753
|
-
className: 'm-b-none'
|
1754
|
-
}
|
1755
|
-
]
|
1756
|
-
};
|
1812
|
+
// 新版配置面板兼容 [可见] 状态
|
1813
|
+
'newVisible': {
|
1814
|
+
type: 'ae-StatusControl',
|
1815
|
+
label: '可见',
|
1816
|
+
mode: 'normal',
|
1817
|
+
name: 'visible',
|
1818
|
+
expressionName: 'visibleOn',
|
1819
|
+
visibleOn:"data.visible || data.visible === false || data.visibleOn !== undefined"
|
1757
1820
|
},
|
1758
1821
|
|
1759
|
-
|
1822
|
+
'hidden': {
|
1823
|
+
type: 'ae-StatusControl',
|
1824
|
+
label: '隐藏',
|
1825
|
+
mode: 'normal',
|
1826
|
+
name: 'hidden',
|
1827
|
+
expressionName: 'hiddenOn'
|
1828
|
+
},
|
1829
|
+
|
1830
|
+
'maximum': {
|
1831
|
+
type: 'input-number',
|
1832
|
+
label: '最大值'
|
1833
|
+
},
|
1834
|
+
|
1835
|
+
'minimum': {
|
1836
|
+
type: 'input-number',
|
1837
|
+
label: '最小值'
|
1838
|
+
},
|
1839
|
+
|
1840
|
+
'switchDefaultValue': {
|
1760
1841
|
type: 'switch',
|
1842
|
+
label: '默认值设置',
|
1761
1843
|
name: 'value',
|
1762
|
-
label: '设置默认值',
|
1763
|
-
mode: 'inline',
|
1764
|
-
className: 'w-full',
|
1765
1844
|
pipeIn: (value: any) => typeof value !== 'undefined',
|
1766
1845
|
pipeOut: (value: any, origin: any, data: any) => (value ? '' : undefined),
|
1767
|
-
|
1846
|
+
labelRemark: {
|
1847
|
+
trigger: ['hover', 'focus'],
|
1848
|
+
setting: true,
|
1849
|
+
title: '',
|
1850
|
+
content: '不设置时根据 name 获取'
|
1851
|
+
}
|
1768
1852
|
},
|
1769
1853
|
|
1770
|
-
multiple: {
|
1771
|
-
|
1854
|
+
'multiple': (schema: any = {}) => ({
|
1855
|
+
type: 'ae-Switch-More',
|
1856
|
+
mode: 'normal',
|
1772
1857
|
name: 'multiple',
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
1858
|
+
label: '可多选',
|
1859
|
+
value: false,
|
1860
|
+
hiddenOnDefault: true,
|
1861
|
+
formType: 'extend',
|
1862
|
+
form: {
|
1863
|
+
body: schema.replace
|
1864
|
+
? schema.body
|
1865
|
+
: [
|
1866
|
+
getSchemaTpl('joinValues'),
|
1867
|
+
getSchemaTpl('delimiter'),
|
1868
|
+
getSchemaTpl('extractValue'),
|
1869
|
+
...[schema.body || []]
|
1870
|
+
]
|
1871
|
+
}
|
1872
|
+
}),
|
1873
|
+
|
1874
|
+
'checkAll': () => [
|
1875
|
+
getSchemaTpl('switch', {
|
1876
|
+
label: '可全选',
|
1877
|
+
name: 'checkAll',
|
1878
|
+
value: false,
|
1879
|
+
visibleOn: 'data.multiple'
|
1880
|
+
}),
|
1881
|
+
{
|
1882
|
+
type: 'container',
|
1883
|
+
className: 'ae-ExtendMore mb-2',
|
1884
|
+
visibleOn: 'data.checkAll && data.multiple',
|
1885
|
+
body: [
|
1886
|
+
getSchemaTpl('switch', {
|
1887
|
+
label: '默认全选',
|
1888
|
+
name: 'defaultCheckAll',
|
1889
|
+
value: false
|
1890
|
+
}),
|
1891
|
+
{
|
1892
|
+
type: 'input-text',
|
1893
|
+
name: 'checkAllLabel',
|
1894
|
+
label: '选项文案',
|
1895
|
+
value: '全选',
|
1896
|
+
mode: 'row'
|
1897
|
+
}
|
1898
|
+
]
|
1899
|
+
}
|
1900
|
+
],
|
1789
1901
|
|
1790
|
-
|
1902
|
+
'joinValues': () =>
|
1903
|
+
getSchemaTpl('switch', {
|
1904
|
+
label: tipedLabel(
|
1905
|
+
'拼接值',
|
1906
|
+
'开启后将选中的选项 value 的值用连接符拼接起来,作为当前表单项的值'
|
1907
|
+
),
|
1908
|
+
name: 'joinValues',
|
1909
|
+
visibleOn: 'data.multiple',
|
1910
|
+
value: true
|
1911
|
+
}),
|
1912
|
+
|
1913
|
+
'delimiter': {
|
1791
1914
|
type: 'input-text',
|
1792
1915
|
name: 'delimiter',
|
1793
|
-
label: '
|
1916
|
+
label: tipedLabel('拼接符', '将多个值拼接成一个字符串的连接符号'),
|
1794
1917
|
visibleOn: 'data.multiple && data.joinValues',
|
1795
1918
|
pipeIn: defaultValue(',')
|
1796
1919
|
},
|
1797
1920
|
|
1798
|
-
extractValue: {
|
1921
|
+
'extractValue': {
|
1799
1922
|
type: 'switch',
|
1923
|
+
label: tipedLabel(
|
1924
|
+
'仅提取值',
|
1925
|
+
'开启后将选中项的 value 封装为数组,关闭后则将整个选项数据封装为数组。'
|
1926
|
+
),
|
1800
1927
|
name: 'extractValue',
|
1801
|
-
|
1802
|
-
|
1803
|
-
|
1804
|
-
visibleOn: 'data.joinValues === false',
|
1805
|
-
pipeIn: defaultValue(false),
|
1806
|
-
description: '开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。'
|
1928
|
+
inputClassName: 'is-inline',
|
1929
|
+
visibleOn: 'data.multiple && data.joinValues === false',
|
1930
|
+
pipeIn: defaultValue(false)
|
1807
1931
|
},
|
1808
1932
|
|
1809
|
-
creatable: {
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1933
|
+
'creatable': (schema: Partial<SchemaObject> = {}) => {
|
1934
|
+
return {
|
1935
|
+
label: tipedLabel('可创建', '配置事件动作可插入或拦截默认交互'),
|
1936
|
+
type: 'ae-switch-more',
|
1937
|
+
mode: 'normal',
|
1938
|
+
name: 'creatable',
|
1939
|
+
...schema
|
1940
|
+
};
|
1815
1941
|
},
|
1816
1942
|
|
1817
|
-
|
1818
|
-
|
1943
|
+
'addApi': () =>
|
1944
|
+
getSchemaTpl('apiControl', {
|
1945
|
+
label: '新增接口',
|
1946
|
+
name: 'addApi',
|
1947
|
+
visibleOn: 'data.creatable'
|
1948
|
+
}),
|
1949
|
+
|
1950
|
+
'createBtnLabel': {
|
1951
|
+
label: '按钮名称',
|
1819
1952
|
name: 'createBtnLabel',
|
1820
1953
|
type: 'input-text',
|
1821
|
-
|
1822
|
-
placeholder: '新增选项',
|
1823
|
-
className: 'w-full'
|
1954
|
+
placeholder: '新建'
|
1824
1955
|
},
|
1825
1956
|
|
1826
|
-
editable: {
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1830
|
-
|
1831
|
-
|
1957
|
+
'editable': (schema: Partial<SchemaObject> = {}) => {
|
1958
|
+
return {
|
1959
|
+
label: tipedLabel('可编辑', '配置事件动作可插入或拦截默认交互'),
|
1960
|
+
type: 'ae-switch-more',
|
1961
|
+
mode: 'normal',
|
1962
|
+
name: 'editable',
|
1963
|
+
...schema
|
1964
|
+
};
|
1832
1965
|
},
|
1833
1966
|
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1967
|
+
'editApi': () =>
|
1968
|
+
getSchemaTpl('apiControl', {
|
1969
|
+
label: '编辑接口',
|
1970
|
+
name: 'editApi',
|
1971
|
+
visibleOn: 'data.editable'
|
1972
|
+
}),
|
1973
|
+
|
1974
|
+
'removable': (schema: Partial<SchemaObject> = {}) => {
|
1975
|
+
return {
|
1976
|
+
label: tipedLabel('可删除', '配置事件动作可插入或拦截默认交互'),
|
1977
|
+
type: 'ae-switch-more',
|
1978
|
+
mode: 'normal',
|
1979
|
+
name: 'removable',
|
1980
|
+
...schema
|
1981
|
+
};
|
1840
1982
|
},
|
1841
1983
|
|
1842
|
-
|
1984
|
+
'deleteApi': () =>
|
1985
|
+
getSchemaTpl('apiControl', {
|
1986
|
+
label: '删除接口',
|
1987
|
+
name: 'deleteApi',
|
1988
|
+
visibleOn: 'data.removable'
|
1989
|
+
}),
|
1990
|
+
|
1991
|
+
'ref': () => {
|
1843
1992
|
// {
|
1844
1993
|
// type: 'input-text',
|
1845
1994
|
// name: '$ref',
|
@@ -1849,17 +1998,22 @@ const tpls: {
|
|
1849
1998
|
return null;
|
1850
1999
|
},
|
1851
2000
|
|
1852
|
-
imageUrl: {
|
2001
|
+
'imageUrl': {
|
1853
2002
|
type: 'input-text',
|
1854
2003
|
label: '图片'
|
1855
2004
|
},
|
1856
2005
|
|
1857
|
-
|
2006
|
+
'backgroundImageUrl': {
|
2007
|
+
type: 'input-text',
|
2008
|
+
label: '图片路径'
|
2009
|
+
},
|
2010
|
+
|
2011
|
+
'fileUrl': {
|
1858
2012
|
type: 'input-text',
|
1859
2013
|
label: '文件'
|
1860
2014
|
},
|
1861
2015
|
|
1862
|
-
markdownBody: {
|
2016
|
+
'markdownBody': {
|
1863
2017
|
name: 'value',
|
1864
2018
|
type: 'editor',
|
1865
2019
|
language: 'markdown',
|
@@ -1870,7 +2024,7 @@ const tpls: {
|
|
1870
2024
|
}
|
1871
2025
|
},
|
1872
2026
|
|
1873
|
-
richText: {
|
2027
|
+
'richText': {
|
1874
2028
|
label: '富文本',
|
1875
2029
|
type: 'input-rich-text',
|
1876
2030
|
buttons: [
|
@@ -1901,18 +2055,20 @@ const tpls: {
|
|
1901
2055
|
size: 'lg'
|
1902
2056
|
},
|
1903
2057
|
|
1904
|
-
showCounter: {
|
1905
|
-
label: '是否显示计数器',
|
1906
|
-
name: 'showCounter',
|
2058
|
+
'showCounter': {
|
1907
2059
|
type: 'switch',
|
1908
|
-
|
1909
|
-
|
2060
|
+
label: '计数器',
|
2061
|
+
name: 'showCounter',
|
2062
|
+
inputClassName: 'is-inline'
|
1910
2063
|
},
|
1911
2064
|
|
1912
|
-
borderMode: {
|
1913
|
-
type: 'select',
|
2065
|
+
'borderMode': {
|
1914
2066
|
name: 'borderMode',
|
1915
2067
|
label: '边框模式',
|
2068
|
+
type: 'button-group-select',
|
2069
|
+
size: 'sm',
|
2070
|
+
mode: 'row',
|
2071
|
+
className: 'ae-buttonGroupSelect--justify',
|
1916
2072
|
options: [
|
1917
2073
|
{label: '全边框', value: 'full'},
|
1918
2074
|
{label: '半边框', value: 'half'},
|
@@ -1920,10 +2076,432 @@ const tpls: {
|
|
1920
2076
|
]
|
1921
2077
|
},
|
1922
2078
|
|
1923
|
-
|
2079
|
+
'searchable': () =>
|
2080
|
+
getSchemaTpl('switch', {
|
2081
|
+
label: '可检索',
|
2082
|
+
name: 'searchable'
|
2083
|
+
}),
|
2084
|
+
|
2085
|
+
'sortable': {
|
2086
|
+
type: 'switch',
|
2087
|
+
label: '可排序',
|
2088
|
+
name: 'sortable'
|
2089
|
+
},
|
2090
|
+
|
2091
|
+
'selectFirst': {
|
2092
|
+
type: 'switch',
|
2093
|
+
label: '是否默认选择第一个',
|
2094
|
+
name: 'selectFirst'
|
2095
|
+
},
|
2096
|
+
|
2097
|
+
'hideNodePathLabel': {
|
2098
|
+
type: 'switch',
|
2099
|
+
label: '隐藏选中节点的祖先节点文本信息',
|
2100
|
+
name: 'hideNodePathLabel'
|
2101
|
+
},
|
2102
|
+
|
2103
|
+
'clearValueOnHidden': () =>
|
2104
|
+
getSchemaTpl('switch', {
|
2105
|
+
type: 'switch',
|
2106
|
+
horizontal: {left: 8, justify: true},
|
2107
|
+
label: tipedLabel(
|
2108
|
+
'隐藏时删除字段',
|
2109
|
+
'当前表单项隐藏时,表单提交数据中会删除该表单项的值'
|
2110
|
+
),
|
2111
|
+
name: 'clearValueOnHidden'
|
2112
|
+
}),
|
2113
|
+
|
2114
|
+
'utc': {
|
2115
|
+
type: 'switch',
|
2116
|
+
label: tipedLabel(
|
2117
|
+
'UTC转换',
|
2118
|
+
'开启后,提交数据和展示数据将进行UTC转换;存在跨地域用户的应用建议开启'
|
2119
|
+
),
|
2120
|
+
name: 'utc',
|
2121
|
+
inputClassName: 'is-inline'
|
2122
|
+
},
|
2123
|
+
|
2124
|
+
'embed': {
|
2125
|
+
type: 'switch',
|
2126
|
+
label: '内嵌模式',
|
2127
|
+
name: 'embed'
|
2128
|
+
},
|
2129
|
+
|
2130
|
+
'buttonLevel': {
|
2131
|
+
label: '按钮样式',
|
2132
|
+
type: 'select',
|
2133
|
+
name: 'level',
|
2134
|
+
options: [
|
2135
|
+
{
|
2136
|
+
label: '默认',
|
2137
|
+
value: 'default',
|
2138
|
+
level: 'default'
|
2139
|
+
},
|
2140
|
+
{
|
2141
|
+
label: '链接',
|
2142
|
+
value: 'link',
|
2143
|
+
level: 'link'
|
2144
|
+
},
|
2145
|
+
{
|
2146
|
+
label: '主色',
|
2147
|
+
value: 'primary',
|
2148
|
+
level: 'primary'
|
2149
|
+
},
|
2150
|
+
|
2151
|
+
{
|
2152
|
+
label: '淡色',
|
2153
|
+
value: 'light',
|
2154
|
+
level: 'light'
|
2155
|
+
},
|
2156
|
+
{
|
2157
|
+
label: '深色',
|
2158
|
+
value: 'dark',
|
2159
|
+
level: 'dark'
|
2160
|
+
},
|
2161
|
+
|
2162
|
+
{
|
2163
|
+
label: '提示',
|
2164
|
+
value: 'info',
|
2165
|
+
level: 'info'
|
2166
|
+
},
|
2167
|
+
{
|
2168
|
+
label: '成功',
|
2169
|
+
value: 'success',
|
2170
|
+
level: 'success'
|
2171
|
+
},
|
2172
|
+
{
|
2173
|
+
label: '警告',
|
2174
|
+
value: 'warning',
|
2175
|
+
level: 'warning'
|
2176
|
+
},
|
2177
|
+
{
|
2178
|
+
label: '严重',
|
2179
|
+
value: 'danger',
|
2180
|
+
level: 'danger'
|
2181
|
+
},
|
2182
|
+
{
|
2183
|
+
label: '次要',
|
2184
|
+
value: 'secondary',
|
2185
|
+
level: 'secondary'
|
2186
|
+
},
|
2187
|
+
{
|
2188
|
+
label: '加强',
|
2189
|
+
value: 'enhance',
|
2190
|
+
level: 'enhance'
|
2191
|
+
}
|
2192
|
+
],
|
2193
|
+
pipeIn: defaultValue('default')
|
2194
|
+
},
|
2195
|
+
|
2196
|
+
'uploadType': {
|
2197
|
+
label: '上传方式',
|
2198
|
+
name: 'uploadType',
|
2199
|
+
type: 'select',
|
2200
|
+
value: 'fileReceptor',
|
2201
|
+
options: [
|
2202
|
+
{
|
2203
|
+
label: '文件接收器',
|
2204
|
+
value: 'fileReceptor'
|
2205
|
+
},
|
2206
|
+
|
2207
|
+
{
|
2208
|
+
label: '对象存储',
|
2209
|
+
value: 'bos'
|
2210
|
+
}
|
2211
|
+
]
|
2212
|
+
},
|
2213
|
+
|
2214
|
+
'bos': {
|
2215
|
+
label: '存储仓库',
|
2216
|
+
type: 'select',
|
2217
|
+
name: 'bos',
|
2218
|
+
value: 'default',
|
2219
|
+
options: [
|
2220
|
+
{
|
2221
|
+
label: '平台默认',
|
2222
|
+
value: 'default'
|
2223
|
+
}
|
2224
|
+
]
|
2225
|
+
},
|
2226
|
+
|
2227
|
+
'proxy': {
|
2228
|
+
type: 'switch',
|
2229
|
+
label: '后端代理',
|
2230
|
+
name: 'proxy',
|
2231
|
+
mode: 'horizontal',
|
2232
|
+
horizontal: {
|
2233
|
+
justify: true,
|
2234
|
+
left: 8
|
2235
|
+
},
|
2236
|
+
inputClassName: 'is-inline'
|
2237
|
+
},
|
2238
|
+
|
2239
|
+
/**
|
2240
|
+
* 选项控件
|
2241
|
+
*/
|
2242
|
+
'optionControl': {
|
2243
|
+
label: '数据',
|
2244
|
+
mode: 'normal',
|
2245
|
+
name: 'options',
|
2246
|
+
type: 'ae-optionControl'
|
2247
|
+
},
|
2248
|
+
|
2249
|
+
'badge': {
|
2250
|
+
label: '角标',
|
2251
|
+
name: 'badge',
|
2252
|
+
type: 'ae-badge'
|
2253
|
+
},
|
2254
|
+
|
2255
|
+
/**
|
2256
|
+
* 接口控件
|
2257
|
+
*/
|
2258
|
+
'apiControl': (patch: any = {}) => {
|
2259
|
+
const {name, label, value, description, sampleBuilder, ...rest} = patch;
|
2260
|
+
|
2261
|
+
return {
|
2262
|
+
type: 'ae-apiControl',
|
2263
|
+
label,
|
2264
|
+
name,
|
2265
|
+
description,
|
2266
|
+
mode: 'normal',
|
2267
|
+
labelRemark: sampleBuilder
|
2268
|
+
? {
|
2269
|
+
icon: '',
|
2270
|
+
label: '示例',
|
2271
|
+
title: '接口返回示例',
|
2272
|
+
tooltipClassName: 'ae-ApiSample-tooltip',
|
2273
|
+
render: (data: any) => (
|
2274
|
+
<Html
|
2275
|
+
className="ae-ApiSample"
|
2276
|
+
inline={false}
|
2277
|
+
html={`
|
2278
|
+
<pre><code>${sampleBuilder(data)}</code></pre>
|
2279
|
+
`}
|
2280
|
+
/>
|
2281
|
+
),
|
2282
|
+
trigger: 'click',
|
2283
|
+
className: 'm-l-xs',
|
2284
|
+
rootClose: true,
|
2285
|
+
placement: 'left'
|
2286
|
+
}
|
2287
|
+
: undefined,
|
2288
|
+
...rest
|
2289
|
+
};
|
2290
|
+
},
|
2291
|
+
|
2292
|
+
/**
|
2293
|
+
* 接口控件
|
2294
|
+
*/
|
2295
|
+
'actionApiControl': (patch: any = {}) => {
|
2296
|
+
const {name, label, value, description, sampleBuilder, ...rest} = patch;
|
2297
|
+
|
2298
|
+
return {
|
2299
|
+
type: 'ae-actionApiControl',
|
2300
|
+
label,
|
2301
|
+
name,
|
2302
|
+
description,
|
2303
|
+
mode: 'normal',
|
2304
|
+
labelRemark: sampleBuilder
|
2305
|
+
? {
|
2306
|
+
icon: '',
|
2307
|
+
label: '示例',
|
2308
|
+
title: '接口返回示例',
|
2309
|
+
tooltipClassName: 'ae-ApiSample-tooltip',
|
2310
|
+
render: (data: any) => (
|
2311
|
+
<Html
|
2312
|
+
className="ae-ApiSample"
|
2313
|
+
inline={false}
|
2314
|
+
html={`
|
2315
|
+
<pre><code>${sampleBuilder(data)}</code></pre>
|
2316
|
+
`}
|
2317
|
+
/>
|
2318
|
+
),
|
2319
|
+
trigger: 'click',
|
2320
|
+
className: 'm-l-xs',
|
2321
|
+
rootClose: true,
|
2322
|
+
placement: 'left'
|
2323
|
+
}
|
2324
|
+
: undefined,
|
2325
|
+
...rest
|
2326
|
+
};
|
2327
|
+
},
|
2328
|
+
|
2329
|
+
'validation': (config: {
|
2330
|
+
tag: ValidatorTag | ((ctx: any) => ValidatorTag);
|
2331
|
+
}) => {
|
2332
|
+
let a = {
|
2333
|
+
title: '校验',
|
2334
|
+
body: [
|
2335
|
+
{
|
2336
|
+
type: 'ae-validationControl',
|
2337
|
+
mode: 'normal',
|
2338
|
+
...config
|
2339
|
+
// pipeIn: (value: any, data: any) => {
|
2340
|
+
// // return reduce(value, (arr: any, item) => {
|
2341
|
+
// // if (typeof item === 'string') {
|
2342
|
+
// // arr.push(item);
|
2343
|
+
// // }
|
2344
|
+
// // else {
|
2345
|
+
// // let isAdd = false;
|
2346
|
+
// // // 优先判断是否具备可展示条件
|
2347
|
+
// // forEach(item?.isShow, (val, key) => {
|
2348
|
+
// // if ([...val].includes(data?.data[key])) {
|
2349
|
+
// // isAdd = true;
|
2350
|
+
// // return false;
|
2351
|
+
// // }
|
2352
|
+
// // })
|
2353
|
+
// // !isAdd && forEach(item?.isHidden, (val, key) => {
|
2354
|
+
// // const hasExist = [...val].includes(data?.data[key]);
|
2355
|
+
// // isAdd = hasExist ? false : true;
|
2356
|
+
// // if (hasExist) {
|
2357
|
+
// // return false;
|
2358
|
+
// // }
|
2359
|
+
// // })
|
2360
|
+
// // isAdd && arr.push(item.option);
|
2361
|
+
// // }
|
2362
|
+
// // return arr;
|
2363
|
+
// // }, []);
|
2364
|
+
// },
|
2365
|
+
},
|
2366
|
+
getSchemaTpl('validateOnChange')
|
2367
|
+
]
|
2368
|
+
};
|
2369
|
+
return a;
|
2370
|
+
},
|
2371
|
+
/**
|
2372
|
+
* 表单项校验控件
|
2373
|
+
*/
|
2374
|
+
'validationControl': (value: Array<ValidationOptions> = []) => ({
|
2375
|
+
type: 'ae-validationControl',
|
2376
|
+
label: '校验规则',
|
2377
|
+
mode: 'normal',
|
2378
|
+
pipeIn: (value: any, data: any) => {
|
2379
|
+
return reduce(
|
2380
|
+
value,
|
2381
|
+
(arr: any, item) => {
|
2382
|
+
if (typeof item === 'string') {
|
2383
|
+
arr.push(item);
|
2384
|
+
} else {
|
2385
|
+
let isAdd = false;
|
2386
|
+
// 优先判断是否具备可展示条件
|
2387
|
+
forEach(item?.isShow, (val, key) => {
|
2388
|
+
if ([...val].includes(data?.data[key])) {
|
2389
|
+
isAdd = true;
|
2390
|
+
return false;
|
2391
|
+
}
|
2392
|
+
return true;
|
2393
|
+
});
|
2394
|
+
!isAdd &&
|
2395
|
+
forEach(item?.isHidden, (val, key) => {
|
2396
|
+
const hasExist = [...val].includes(data?.data[key]);
|
2397
|
+
isAdd = hasExist ? false : true;
|
2398
|
+
if (hasExist) {
|
2399
|
+
return false;
|
2400
|
+
}
|
2401
|
+
return true;
|
2402
|
+
});
|
2403
|
+
isAdd && arr.push(item.option);
|
2404
|
+
}
|
2405
|
+
return arr;
|
2406
|
+
},
|
2407
|
+
[]
|
2408
|
+
);
|
2409
|
+
},
|
2410
|
+
value
|
2411
|
+
}),
|
2412
|
+
|
2413
|
+
/**
|
2414
|
+
* 表达式编辑器控件
|
2415
|
+
*/
|
2416
|
+
'formulaControl': (schema: object = {}) => {
|
2417
|
+
return {
|
2418
|
+
type: 'ae-formulaControl',
|
2419
|
+
...schema
|
2420
|
+
};
|
2421
|
+
},
|
2422
|
+
|
2423
|
+
/**
|
2424
|
+
* 日期范围快捷键组件
|
2425
|
+
*/
|
2426
|
+
'dateShortCutControl': (schema: object = {}) => {
|
2427
|
+
return {
|
2428
|
+
type: 'ae-DateShortCutControl',
|
2429
|
+
...schema
|
2430
|
+
};
|
2431
|
+
},
|
2432
|
+
|
2433
|
+
'eventControl': (schema: any = {}) => {
|
2434
|
+
return {
|
2435
|
+
type: 'ae-eventControl',
|
2436
|
+
mode: 'normal',
|
2437
|
+
...schema
|
2438
|
+
};
|
2439
|
+
},
|
2440
|
+
|
2441
|
+
'style:formItem': ({renderer, schema}: any) => {
|
2442
|
+
return {
|
2443
|
+
title: '表单项',
|
2444
|
+
key: 'formItem',
|
2445
|
+
body: [
|
2446
|
+
getSchemaTpl('formItemMode'),
|
2447
|
+
getSchemaTpl('labelHide'),
|
2448
|
+
getSchemaTpl('horizontal'),
|
2449
|
+
renderer?.sizeMutable !== false ? getSchemaTpl('formItemSize') : null
|
2450
|
+
// getSchemaTpl('formItemInline')
|
2451
|
+
].concat(schema)
|
2452
|
+
};
|
2453
|
+
},
|
2454
|
+
|
2455
|
+
'style:classNames': (config: {
|
2456
|
+
schema: SchemaCollection;
|
2457
|
+
isFormItem: boolean;
|
2458
|
+
}) => {
|
2459
|
+
const {isFormItem = true, schema = []} = config || {};
|
2460
|
+
|
2461
|
+
return {
|
2462
|
+
title: 'CSS 类名',
|
2463
|
+
body: (isFormItem
|
2464
|
+
? [
|
2465
|
+
getSchemaTpl('className', {
|
2466
|
+
label: '表单项'
|
2467
|
+
}),
|
2468
|
+
getSchemaTpl('className', {
|
2469
|
+
label: '标签',
|
2470
|
+
name: 'labelClassName'
|
2471
|
+
}),
|
2472
|
+
getSchemaTpl('className', {
|
2473
|
+
label: '控件',
|
2474
|
+
name: 'inputClassName'
|
2475
|
+
})
|
2476
|
+
]
|
2477
|
+
: [
|
2478
|
+
getSchemaTpl('className', {
|
2479
|
+
label: '外层'
|
2480
|
+
})
|
2481
|
+
]
|
2482
|
+
).concat(schema)
|
2483
|
+
};
|
2484
|
+
},
|
2485
|
+
|
2486
|
+
'style:others': (schemas: any[] = []) => ({
|
2487
|
+
title: '其他项',
|
2488
|
+
body: [...schemas]
|
2489
|
+
}),
|
2490
|
+
|
2491
|
+
'data': {
|
1924
2492
|
type: 'input-kv',
|
1925
2493
|
name: 'data',
|
1926
2494
|
label: '初始静态数据'
|
2495
|
+
},
|
2496
|
+
|
2497
|
+
'app-page': {
|
2498
|
+
type: 'nested-select',
|
2499
|
+
label: '选择页面',
|
2500
|
+
name: 'link',
|
2501
|
+
mode: 'horizontal',
|
2502
|
+
size: 'lg',
|
2503
|
+
required: true,
|
2504
|
+
options: []
|
1927
2505
|
}
|
1928
2506
|
};
|
1929
2507
|
|
@@ -2115,23 +2693,165 @@ export const styleTpl = {
|
|
2115
2693
|
}
|
2116
2694
|
]
|
2117
2695
|
};
|
2118
|
-
|
2696
|
+
|
2697
|
+
/**
|
2698
|
+
* 通用CSS Style控件
|
2699
|
+
* @param {string | Array<string>} exclude 需要隐藏的配置key
|
2700
|
+
*/
|
2701
|
+
tpls['style:common'] = (exclude: string[] | string) => {
|
2702
|
+
// key统一转换成Kebab case,eg: boxShadow => bos-shadow
|
2703
|
+
exclude = (exclude
|
2704
|
+
? Array.isArray(exclude)
|
2705
|
+
? exclude
|
2706
|
+
: [exclude]
|
2707
|
+
: []
|
2708
|
+
).map((key: string) => kebabCase(key));
|
2709
|
+
|
2710
|
+
return [
|
2711
|
+
{
|
2712
|
+
header: '布局',
|
2713
|
+
key: 'layout',
|
2714
|
+
body: [
|
2715
|
+
{
|
2716
|
+
type: 'style-display',
|
2717
|
+
label: false,
|
2718
|
+
name: 'style'
|
2719
|
+
}
|
2720
|
+
].filter(comp => !~exclude.indexOf(comp.type.replace(/^style-/i, '')))
|
2721
|
+
},
|
2722
|
+
{
|
2723
|
+
header: '文字',
|
2724
|
+
key: 'font',
|
2725
|
+
body: [
|
2726
|
+
{
|
2727
|
+
type: 'style-font',
|
2728
|
+
label: false,
|
2729
|
+
name: 'style'
|
2730
|
+
}
|
2731
|
+
]
|
2732
|
+
},
|
2733
|
+
{
|
2734
|
+
header: '内外边距',
|
2735
|
+
key: 'box-model',
|
2736
|
+
body: [
|
2737
|
+
{
|
2738
|
+
type: 'style-box-model',
|
2739
|
+
label: false,
|
2740
|
+
name: 'style'
|
2741
|
+
}
|
2742
|
+
]
|
2743
|
+
},
|
2744
|
+
{
|
2745
|
+
header: '背景',
|
2746
|
+
key: 'background',
|
2747
|
+
body: [
|
2748
|
+
{
|
2749
|
+
type: 'style-background',
|
2750
|
+
label: false,
|
2751
|
+
name: 'style'
|
2752
|
+
}
|
2753
|
+
]
|
2754
|
+
},
|
2755
|
+
{
|
2756
|
+
header: '边框',
|
2757
|
+
key: 'border',
|
2758
|
+
body: [
|
2759
|
+
{
|
2760
|
+
type: 'style-border',
|
2761
|
+
label: false,
|
2762
|
+
name: 'style'
|
2763
|
+
}
|
2764
|
+
]
|
2765
|
+
},
|
2766
|
+
{
|
2767
|
+
header: '阴影',
|
2768
|
+
key: 'box-shadow',
|
2769
|
+
body: [
|
2770
|
+
{
|
2771
|
+
type: 'style-box-shadow',
|
2772
|
+
label: false,
|
2773
|
+
name: 'style.boxShadow'
|
2774
|
+
}
|
2775
|
+
]
|
2776
|
+
},
|
2777
|
+
{
|
2778
|
+
header: '其他',
|
2779
|
+
key: 'other',
|
2780
|
+
body: [
|
2781
|
+
{
|
2782
|
+
label: '透明度',
|
2783
|
+
name: 'style.opacity',
|
2784
|
+
min: 0,
|
2785
|
+
max: 1,
|
2786
|
+
step: 0.05,
|
2787
|
+
type: 'input-range',
|
2788
|
+
pipeIn: defaultValue(1),
|
2789
|
+
marks: {
|
2790
|
+
'0%': '0',
|
2791
|
+
'50%': '0.5',
|
2792
|
+
'100%': '1'
|
2793
|
+
}
|
2794
|
+
},
|
2795
|
+
{
|
2796
|
+
label: '光标类型',
|
2797
|
+
name: 'style.cursor',
|
2798
|
+
type: 'select',
|
2799
|
+
mode: 'row',
|
2800
|
+
menuTpl: {
|
2801
|
+
type: 'html',
|
2802
|
+
html:
|
2803
|
+
"<span style='cursor:${value};'>${label}</span><code class='ae-Code'>${value}</code>",
|
2804
|
+
className: 'ae-selection-code'
|
2805
|
+
},
|
2806
|
+
pipIn: defaultValue('default'),
|
2807
|
+
options: [
|
2808
|
+
{label: '默认', value: 'default'},
|
2809
|
+
{label: '自动', value: 'auto'},
|
2810
|
+
{label: '无指针', value: 'none'},
|
2811
|
+
{label: '悬浮', value: 'pointer'},
|
2812
|
+
{label: '帮助', value: 'help'},
|
2813
|
+
{label: '文本', value: 'text'},
|
2814
|
+
{label: '单元格', value: 'cell'},
|
2815
|
+
{label: '交叉指针', value: 'crosshair'},
|
2816
|
+
{label: '可移动', value: 'move'},
|
2817
|
+
{label: '禁用', value: 'not-allowed'},
|
2818
|
+
{label: '可抓取', value: 'grab'},
|
2819
|
+
{label: '放大', value: 'zoom-in'},
|
2820
|
+
{label: '缩小', value: 'zoom-out'}
|
2821
|
+
]
|
2822
|
+
}
|
2823
|
+
]
|
2824
|
+
}
|
2825
|
+
].filter(item => !~exclude.indexOf(item.key));
|
2826
|
+
};
|
2827
|
+
|
2828
|
+
export function getCollapseCate(config: {
|
2829
|
+
name: string;
|
2830
|
+
body: SchemaCollection;
|
2831
|
+
visibleOn?: string;
|
2832
|
+
tools: SchemaCollection;
|
2833
|
+
}) {
|
2834
|
+
return;
|
2835
|
+
}
|
2119
2836
|
|
2120
2837
|
export function getSchemaTpl(name: string, patch?: object): any {
|
2121
|
-
const tpl = tpls[name];
|
2838
|
+
const tpl = tpls[name] || {};
|
2839
|
+
let schema = null;
|
2122
2840
|
|
2123
2841
|
if (typeof tpl === 'function') {
|
2124
|
-
|
2842
|
+
schema = tpl(patch);
|
2843
|
+
} else {
|
2844
|
+
schema = tpl
|
2845
|
+
? patch
|
2846
|
+
? {
|
2847
|
+
...tpl,
|
2848
|
+
...patch
|
2849
|
+
}
|
2850
|
+
: tpl
|
2851
|
+
: null;
|
2125
2852
|
}
|
2126
2853
|
|
2127
|
-
return
|
2128
|
-
? patch
|
2129
|
-
? {
|
2130
|
-
...tpl,
|
2131
|
-
...patch
|
2132
|
-
}
|
2133
|
-
: tpl
|
2134
|
-
: null;
|
2854
|
+
return schema;
|
2135
2855
|
}
|
2136
2856
|
|
2137
2857
|
export function setSchemaTpl(name: string, value: any) {
|
@@ -2150,6 +2870,21 @@ export function valuePipeOut(value: any) {
|
|
2150
2870
|
}
|
2151
2871
|
}
|
2152
2872
|
|
2873
|
+
export function undefinedPipeOut(value: any) {
|
2874
|
+
if (Array.isArray(value)) {
|
2875
|
+
return value.length ? value : undefined;
|
2876
|
+
}
|
2877
|
+
|
2878
|
+
if (typeof value === 'string') {
|
2879
|
+
return value ? value : undefined;
|
2880
|
+
}
|
2881
|
+
|
2882
|
+
if (typeof value === 'object') {
|
2883
|
+
return Object.keys(value).length ? value : undefined;
|
2884
|
+
}
|
2885
|
+
return value;
|
2886
|
+
}
|
2887
|
+
|
2153
2888
|
export function defaultValue(defaultValue: any, strictMode: boolean = true) {
|
2154
2889
|
return strictMode
|
2155
2890
|
? (value: any) => (typeof value === 'undefined' ? defaultValue : value)
|