amis-editor 4.2.0-beta.0 → 5.1.8
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/6dbcbb49b6fd405190a9.png +0 -0
- package/dist/component/Editor.d.ts +16 -0
- package/dist/component/RegionWrapper.d.ts +10 -0
- package/dist/component/VRenderer.d.ts +10 -0
- package/dist/component/base/ShortcutKey.d.ts +23 -0
- package/dist/component/control/APIControl.d.ts +1158 -0
- package/dist/component/control/ActionAPIControl.d.ts +1158 -0
- package/dist/component/control/BadgeControl.d.ts +133 -0
- package/dist/component/control/BaseControl.d.ts +248 -0
- package/dist/component/control/DataBindingControl.d.ts +14 -0
- package/dist/component/control/DataPickerControl.d.ts +13 -0
- package/dist/component/control/DateShortCutControl.d.ts +83 -0
- package/dist/component/control/FormulaControl.d.ts +51 -0
- package/dist/component/{Control → control}/OptionControl.d.ts +23 -34
- package/dist/component/{Control → control}/PopoverEdit.d.ts +1 -1
- package/dist/component/control/StatusControl.d.ts +39 -0
- package/dist/component/control/SwitchMoreControl.d.ts +224 -0
- package/dist/component/control/ValidationControl.d.ts +65 -0
- package/dist/component/control/ValidationItem.d.ts +46 -0
- package/dist/component/control/style-control/Background.d.ts +17 -0
- package/dist/component/control/style-control/Border.d.ts +18 -0
- package/dist/component/control/style-control/BoxModel.d.ts +17 -0
- package/dist/component/control/style-control/BoxShadow.d.ts +18 -0
- package/dist/component/control/style-control/Display.d.ts +14 -0
- package/dist/component/control/style-control/Font.d.ts +16 -0
- package/dist/component/control/style-control/font-family.d.ts +11 -0
- package/dist/component/control/style-control/transformation.d.ts +29 -0
- package/dist/component/control/style-control/types.d.ts +8 -0
- package/dist/component/schemaTpl.d.ts +8 -0
- package/dist/component/validator.d.ts +62 -0
- package/dist/dnd/index.d.ts +1 -1
- package/dist/event-action/action-config-panel.d.ts +8 -0
- package/dist/event-action/actions.d.ts +3 -0
- package/dist/event-action/comp-action-select.d.ts +11 -0
- package/dist/event-action/config.d.ts +13 -0
- package/dist/event-action/index.d.ts +459 -0
- package/dist/event-action/schema.d.ts +32 -0
- package/dist/exports.min.js +1 -1
- package/dist/index.d.ts +24 -5
- package/dist/index.min.js +1 -1
- package/dist/manager.d.ts +46 -1
- package/dist/plugin/Alert.d.ts +4 -2
- package/dist/plugin/Button.d.ts +5 -1
- package/dist/plugin/ButtonGroup.d.ts +13 -34
- package/dist/plugin/ButtonToolbar.d.ts +4 -10
- package/dist/plugin/CRUD.d.ts +2 -0
- package/dist/plugin/Chart.d.ts +2 -0
- package/dist/plugin/Collapse.d.ts +1 -0
- package/dist/plugin/CollapseGroup.d.ts +28 -4
- package/dist/plugin/Container.d.ts +2 -1
- package/dist/plugin/Dialog.d.ts +12 -2
- package/dist/plugin/Drawer.d.ts +12 -2
- package/dist/plugin/DropDownButton.d.ts +11 -11
- package/dist/plugin/Form/ButtonGroupSelect.d.ts +7 -2
- package/dist/plugin/Form/ButtonToolbar.d.ts +8 -7
- package/dist/plugin/Form/ChainedSelect.d.ts +3 -0
- package/dist/plugin/Form/Checkbox.d.ts +7 -2
- package/dist/plugin/Form/Checkboxes.d.ts +8 -2
- package/dist/plugin/Form/CodeEditor.d.ts +7 -22
- package/dist/plugin/Form/Combo.d.ts +3 -0
- package/dist/plugin/Form/Control.d.ts +6 -2
- package/dist/plugin/Form/DiffEditor.d.ts +7 -1
- package/dist/plugin/Form/Form.d.ts +6 -0
- package/dist/plugin/Form/Formula.d.ts +1 -25
- package/dist/plugin/Form/InputDate.d.ts +8 -2
- package/dist/plugin/Form/InputDateRange.d.ts +8 -2
- package/dist/plugin/Form/InputDateTime.d.ts +4 -4
- package/dist/plugin/Form/InputDateTimeRange.d.ts +4 -4
- package/dist/plugin/Form/InputEmail.d.ts +1 -0
- package/dist/plugin/Form/InputExcel.d.ts +6 -41
- package/dist/plugin/Form/InputFile.d.ts +7 -3
- package/dist/plugin/Form/InputKV.d.ts +6 -0
- package/dist/plugin/Form/InputMonth.d.ts +1 -0
- package/dist/plugin/Form/InputMonthRange.d.ts +4 -4
- package/dist/plugin/Form/InputPassword.d.ts +1 -0
- package/dist/plugin/Form/InputQuarter.d.ts +1 -0
- package/dist/plugin/Form/InputQuarterRange.d.ts +4 -4
- package/dist/plugin/Form/InputRange.d.ts +3 -0
- package/dist/plugin/Form/InputRating.d.ts +9 -3
- package/dist/plugin/Form/InputText.d.ts +24 -2
- package/dist/plugin/Form/InputTime.d.ts +3 -3
- package/dist/plugin/Form/InputTimeRange.d.ts +20 -0
- package/dist/plugin/Form/InputTree.d.ts +6 -2
- package/dist/plugin/Form/InputURL.d.ts +1 -0
- package/dist/plugin/Form/InputYear.d.ts +1 -0
- package/dist/plugin/Form/InputYearRange.d.ts +20 -0
- package/dist/plugin/Form/ListSelect.d.ts +6 -2
- package/dist/plugin/Form/LocationPicker.d.ts +1 -31
- package/dist/plugin/Form/NestedSelect.d.ts +5 -2
- package/dist/plugin/Form/Radios.d.ts +7 -2
- package/dist/plugin/Form/Select.d.ts +7 -2
- package/dist/plugin/Form/Switch.d.ts +7 -2
- package/dist/plugin/Form/TabsTransfer.d.ts +5 -2
- package/dist/plugin/Form/Textarea.d.ts +7 -1
- package/dist/plugin/Form/Transfer.d.ts +5 -2
- package/dist/plugin/Form/TreeSelect.d.ts +6 -2
- package/dist/plugin/IFrame.d.ts +2 -2
- package/dist/plugin/Nav.d.ts +1 -116
- package/dist/plugin/Others/Action.d.ts +5 -1
- package/dist/plugin/Page.d.ts +5 -2
- package/dist/plugin/Progress.d.ts +5 -1
- package/dist/plugin/Table.d.ts +2 -0
- package/dist/plugin/Tabs.d.ts +33 -2
- package/dist/plugin/TooltipWrapper.d.ts +10 -0
- package/dist/plugin/Tpl.d.ts +2 -1
- package/dist/plugin/Wizard.d.ts +4 -1
- package/dist/plugin.d.ts +37 -1
- package/dist/store/editor.d.ts +65 -38
- package/dist/store/node.d.ts +16 -0
- package/dist/style.css +1 -1
- package/dist/util.d.ts +36 -3
- package/package.json +14 -9
- package/src/component/schemaTpl.tsx +1198 -474
- package/src/plugin/.DS_Store +0 -0
- package/src/plugin/Alert.tsx +69 -48
- package/src/plugin/AnchorNav.tsx +1 -0
- package/src/plugin/Audio.tsx +9 -15
- package/src/plugin/Avatar.tsx +2 -1
- package/src/plugin/Breadcrumb.tsx +2 -1
- package/src/plugin/Button.tsx +257 -188
- package/src/plugin/ButtonGroup.tsx +99 -38
- package/src/plugin/ButtonToolbar.tsx +7 -13
- package/src/plugin/CRUD.tsx +77 -135
- package/src/plugin/Card.tsx +1 -0
- package/src/plugin/Cards.tsx +8 -14
- package/src/plugin/Carousel.tsx +1 -1
- package/src/plugin/Chart.tsx +26 -14
- package/src/plugin/Collapse.tsx +78 -78
- package/src/plugin/CollapseGroup.tsx +165 -83
- package/src/plugin/Container.tsx +59 -6
- package/src/plugin/Custom.tsx +2 -8
- package/src/plugin/CustomRegion.tsx +4 -3
- package/src/plugin/Dialog.tsx +55 -24
- package/src/plugin/Drawer.tsx +65 -35
- package/src/plugin/DropDownButton.tsx +95 -79
- package/src/plugin/Flex.tsx +123 -65
- package/src/plugin/Form/ButtonGroupSelect.tsx +114 -26
- package/src/plugin/Form/ButtonToolbar.tsx +62 -55
- package/src/plugin/Form/ChainedSelect.tsx +45 -0
- package/src/plugin/Form/Checkbox.tsx +122 -33
- package/src/plugin/Form/Checkboxes.tsx +154 -87
- package/src/plugin/Form/CodeEditor.tsx +163 -34
- package/src/plugin/Form/Combo.tsx +104 -65
- package/src/plugin/Form/Control.tsx +16 -70
- package/src/plugin/Form/DiffEditor.tsx +158 -54
- package/src/plugin/Form/FieldSet.tsx +6 -11
- package/src/plugin/Form/Form.tsx +277 -70
- package/src/plugin/Form/Formula.tsx +8 -14
- package/src/plugin/Form/InputArray.tsx +7 -16
- package/src/plugin/Form/InputCity.tsx +1 -1
- package/src/plugin/Form/InputDate.tsx +344 -121
- package/src/plugin/Form/InputDateRange.tsx +303 -161
- package/src/plugin/Form/InputDateTime.tsx +6 -150
- package/src/plugin/Form/InputDateTimeRange.tsx +7 -187
- package/src/plugin/Form/InputEmail.tsx +1 -0
- package/src/plugin/Form/InputExcel.tsx +70 -27
- package/src/plugin/Form/InputFile.tsx +326 -152
- package/src/plugin/Form/InputImage.tsx +1 -1
- package/src/plugin/Form/InputKV.tsx +61 -0
- package/src/plugin/Form/InputMonth.tsx +3 -1
- package/src/plugin/Form/InputMonthRange.tsx +6 -160
- package/src/plugin/Form/InputNumber.tsx +1 -1
- package/src/plugin/Form/InputPassword.tsx +2 -0
- package/src/plugin/Form/InputQuarter.tsx +3 -1
- package/src/plugin/Form/InputQuarterRange.tsx +6 -160
- package/src/plugin/Form/InputRange.tsx +74 -4
- package/src/plugin/Form/InputRating.tsx +347 -35
- package/src/plugin/Form/InputRichText.tsx +2 -3
- package/src/plugin/Form/InputTable.tsx +33 -49
- package/src/plugin/Form/InputTag.tsx +1 -1
- package/src/plugin/Form/InputText.tsx +310 -132
- package/src/plugin/Form/InputTime.tsx +4 -53
- package/src/plugin/Form/InputTimeRange.tsx +41 -0
- package/src/plugin/Form/InputTree.tsx +196 -46
- package/src/plugin/Form/InputURL.tsx +2 -0
- package/src/plugin/Form/InputYear.tsx +2 -0
- package/src/plugin/Form/InputYearRange.tsx +41 -0
- package/src/plugin/Form/Item.tsx +17 -18
- package/src/plugin/Form/ListSelect.tsx +75 -20
- package/src/plugin/Form/LocationPicker.tsx +2 -7
- package/src/plugin/Form/MatrixCheckboxes.tsx +1 -1
- package/src/plugin/Form/NestedSelect.tsx +110 -43
- package/src/plugin/Form/Picker.tsx +2 -5
- package/src/plugin/Form/Radios.tsx +122 -52
- package/src/plugin/Form/Select.tsx +239 -168
- package/src/plugin/Form/Static.tsx +1 -1
- package/src/plugin/Form/Switch.tsx +170 -58
- package/src/plugin/Form/TabsTransfer.tsx +175 -79
- package/src/plugin/Form/Textarea.tsx +146 -36
- package/src/plugin/Form/Transfer.tsx +295 -233
- package/src/plugin/Form/TreeSelect.tsx +287 -146
- package/src/plugin/Grid.tsx +340 -312
- package/src/plugin/HBox.tsx +1 -0
- package/src/plugin/IFrame.tsx +21 -12
- package/src/plugin/Image.tsx +7 -12
- package/src/plugin/Images.tsx +7 -12
- package/src/plugin/Link.tsx +6 -12
- package/src/plugin/List.tsx +6 -10
- package/src/plugin/ListItem.tsx +1 -0
- package/src/plugin/Nav.tsx +7 -9
- package/src/plugin/Others/Action.tsx +16 -10
- package/src/plugin/Others/BasicToolbar.tsx +4 -1
- package/src/plugin/Others/TableCell.tsx +19 -39
- package/src/plugin/Page.tsx +315 -229
- package/src/plugin/Panel.tsx +6 -7
- package/src/plugin/Plain.tsx +3 -6
- package/src/plugin/Progress.tsx +234 -94
- package/src/plugin/Service.tsx +10 -6
- package/src/plugin/Table.tsx +49 -20
- package/src/plugin/TableView.tsx +212 -106
- package/src/plugin/Tabs.tsx +306 -146
- package/src/plugin/TooltipWrapper.tsx +231 -135
- package/src/plugin/Tpl.tsx +68 -52
- package/src/plugin/Video.tsx +9 -20
- package/src/plugin/Wizard.tsx +537 -336
- package/src/plugin/Wrapper.tsx +82 -61
- package/src/plugin.ts +66 -4
- package/static/empty.png +0 -0
- package/dist/component/Control/APIControl.d.ts +0 -504
- package/dist/component/Control/ValidationControl.d.ts +0 -30
- package/dist/component/remarkTpl.d.ts +0 -150
package/src/plugin/Progress.tsx
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import {registerEditorPlugin} from '../manager';
|
2
2
|
import {BaseEventContext, BasePlugin} from '../plugin';
|
3
3
|
import {defaultValue, getSchemaTpl} from '../component/schemaTpl';
|
4
|
+
import {tipedLabel} from '../component/control/BaseControl';
|
4
5
|
|
5
6
|
export class ProgressPlugin extends BasePlugin {
|
6
7
|
// 关联渲染器名字
|
@@ -9,6 +10,7 @@ export class ProgressPlugin extends BasePlugin {
|
|
9
10
|
|
10
11
|
// 组件名称
|
11
12
|
name = '进度展示';
|
13
|
+
searchKeywords = '进度条、progress';
|
12
14
|
isBaseComponent = true;
|
13
15
|
description = '用来展示进度。可配置各个进度段用不同的颜色展示。';
|
14
16
|
docLink = '/amis/zh-CN/components/progress';
|
@@ -16,109 +18,247 @@ export class ProgressPlugin extends BasePlugin {
|
|
16
18
|
icon = 'fa fa-angle-double-right';
|
17
19
|
scaffold = {
|
18
20
|
type: 'progress',
|
19
|
-
value: 66
|
21
|
+
value: 66,
|
22
|
+
strokeWidth: 6
|
20
23
|
};
|
21
24
|
previewSchema = {
|
22
25
|
...this.scaffold
|
23
26
|
};
|
24
27
|
|
25
28
|
panelTitle = '进度';
|
29
|
+
|
30
|
+
panelJustify = true;
|
31
|
+
|
26
32
|
panelBodyCreator = (context: BaseEventContext) => {
|
27
|
-
const
|
28
|
-
return [
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
const isFormItem = !!context?.info.renderer.isFormItem;
|
34
|
+
return getSchemaTpl('tabs', [
|
35
|
+
{
|
36
|
+
title: '属性',
|
37
|
+
body: getSchemaTpl('collapseGroup', [
|
38
|
+
{
|
39
|
+
title: '基本',
|
40
|
+
body: [
|
41
|
+
{
|
42
|
+
label: '类型',
|
43
|
+
name: 'mode',
|
44
|
+
type: 'select',
|
45
|
+
option: '继承',
|
46
|
+
value: 'line',
|
47
|
+
tiled: true,
|
48
|
+
options: [
|
49
|
+
{
|
50
|
+
label: '线形',
|
51
|
+
value: 'line'
|
52
|
+
},
|
53
|
+
|
54
|
+
{
|
55
|
+
label: '圆形',
|
56
|
+
value: 'circle'
|
57
|
+
},
|
58
|
+
|
59
|
+
{
|
60
|
+
label: '仪表盘',
|
61
|
+
value: 'dashboard'
|
62
|
+
}
|
63
|
+
],
|
64
|
+
onChange: (
|
65
|
+
value: any,
|
66
|
+
oldValue: boolean,
|
67
|
+
model: any,
|
68
|
+
form: any
|
69
|
+
) => {
|
70
|
+
if (value === 'circle') {
|
71
|
+
form.setValueByName('gapDegree', 0);
|
72
|
+
form.setValueByName('gapPosition', '');
|
73
|
+
} else if (value === 'dashboard') {
|
74
|
+
form.setValueByName('gapDegree', 75);
|
75
|
+
form.setValueByName('gapPosition', 'bottom');
|
76
|
+
}
|
77
|
+
}
|
78
|
+
},
|
79
|
+
{
|
80
|
+
type: 'input-number',
|
81
|
+
name: 'value',
|
82
|
+
label: '默认值',
|
83
|
+
min: 0,
|
84
|
+
max: 100
|
85
|
+
},
|
86
|
+
getSchemaTpl('menuTpl', {
|
87
|
+
name: 'valueTpl'
|
88
|
+
}),
|
89
|
+
|
90
|
+
getSchemaTpl('switch', {
|
91
|
+
name: 'showLabel',
|
92
|
+
label: '进度值',
|
93
|
+
pipeIn: defaultValue(true)
|
94
|
+
}),
|
95
|
+
|
96
|
+
getSchemaTpl('placeholder', {
|
97
|
+
value: '-',
|
98
|
+
placeholder: '无数据空位提示',
|
99
|
+
label: tipedLabel('占位提示', '数据字段未定义时的值,不包括0')
|
100
|
+
})
|
101
|
+
]
|
102
|
+
},
|
103
|
+
getSchemaTpl('status', {isFormItem})
|
104
|
+
])
|
105
|
+
},
|
106
|
+
{
|
107
|
+
title: '外观',
|
108
|
+
body: getSchemaTpl('collapseGroup', [
|
109
|
+
{
|
110
|
+
title: '基本',
|
111
|
+
body: [
|
112
|
+
{
|
113
|
+
type: 'select',
|
114
|
+
name: 'progressClassName',
|
115
|
+
label: '尺寸',
|
116
|
+
value: '',
|
117
|
+
options: [
|
118
|
+
{
|
119
|
+
label: '极小',
|
120
|
+
value: 'w-xs'
|
121
|
+
},
|
122
|
+
|
123
|
+
{
|
124
|
+
label: '小',
|
125
|
+
value: 'w-sm'
|
126
|
+
},
|
127
|
+
|
128
|
+
{
|
129
|
+
label: '中',
|
130
|
+
value: 'w-md'
|
131
|
+
},
|
132
|
+
|
133
|
+
{
|
134
|
+
label: '大',
|
135
|
+
value: 'w-lg'
|
136
|
+
},
|
137
|
+
|
138
|
+
{
|
139
|
+
label: '默认',
|
140
|
+
value: ''
|
141
|
+
}
|
142
|
+
]
|
143
|
+
},
|
144
|
+
{
|
145
|
+
type: 'input-number',
|
146
|
+
name: 'strokeWidth',
|
147
|
+
label: '线条宽度',
|
148
|
+
value: 6,
|
149
|
+
min: 0,
|
150
|
+
max: 100
|
151
|
+
},
|
152
|
+
{
|
153
|
+
type: 'input-number',
|
154
|
+
name: 'gapDegree',
|
155
|
+
visibleOn: 'data.mode === "dashboard"',
|
156
|
+
label: '缺口角度',
|
157
|
+
value: 75,
|
158
|
+
min: 0,
|
159
|
+
max: 295
|
160
|
+
},
|
161
|
+
{
|
162
|
+
label: '缺口位置',
|
163
|
+
name: 'gapPosition',
|
164
|
+
type: 'button-group-select',
|
165
|
+
visibleOn: 'data.mode === "dashboard"',
|
166
|
+
value: defaultValue('bottom'),
|
167
|
+
tiled: true,
|
168
|
+
options: [
|
169
|
+
{
|
170
|
+
label: '上',
|
171
|
+
value: 'top'
|
172
|
+
},
|
173
|
+
|
174
|
+
{
|
175
|
+
label: '下',
|
176
|
+
value: 'bottom'
|
177
|
+
},
|
178
|
+
|
179
|
+
{
|
180
|
+
label: '左',
|
181
|
+
value: 'left'
|
182
|
+
},
|
183
|
+
{
|
184
|
+
label: '右',
|
185
|
+
value: 'right'
|
186
|
+
}
|
187
|
+
]
|
188
|
+
},
|
189
|
+
getSchemaTpl('switch', {
|
190
|
+
name: 'animate',
|
191
|
+
label: '显示动画',
|
192
|
+
visibleOn: 'data.mode === "line"'
|
193
|
+
}),
|
194
|
+
{
|
195
|
+
type: 'button-group-select',
|
196
|
+
name: 'style',
|
197
|
+
label: '样式',
|
198
|
+
visibleOn: 'data.mode === "line"',
|
199
|
+
options: [
|
200
|
+
{
|
201
|
+
label: '纯色',
|
202
|
+
value: 'purity'
|
203
|
+
},
|
204
|
+
{
|
205
|
+
label: '条纹',
|
206
|
+
value: 'stripe'
|
207
|
+
}
|
208
|
+
],
|
209
|
+
pipeIn: (value: any, form: any) => {
|
210
|
+
return form.data?.stripe ? 'stripe' : 'purity';
|
211
|
+
},
|
212
|
+
onChange(value: any, oldValue: boolean, model: any, form: any) {
|
213
|
+
form.setValueByName('stripe', value === 'stripe');
|
39
214
|
}
|
40
|
-
: null,
|
41
|
-
|
42
|
-
{
|
43
|
-
name: 'showLabel',
|
44
|
-
type: 'switch',
|
45
|
-
mode: 'inline',
|
46
|
-
pipeIn: defaultValue(true),
|
47
|
-
label: '是否显示文字'
|
48
|
-
},
|
49
|
-
|
50
|
-
{
|
51
|
-
name: 'stripe',
|
52
|
-
type: 'switch',
|
53
|
-
mode: 'inline',
|
54
|
-
label: '是否显示条纹'
|
55
|
-
},
|
56
|
-
|
57
|
-
{
|
58
|
-
name: 'animate',
|
59
|
-
type: 'switch',
|
60
|
-
mode: 'inline',
|
61
|
-
label: '是否显示动画'
|
62
|
-
},
|
63
|
-
|
64
|
-
{
|
65
|
-
name: 'map',
|
66
|
-
label: '等级配置',
|
67
|
-
type: 'input-array',
|
68
|
-
items: {
|
69
|
-
type: 'input-text'
|
70
215
|
},
|
71
|
-
|
72
|
-
|
73
|
-
'
|
74
|
-
'
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
title: '显隐',
|
118
|
-
body: [getSchemaTpl('ref'), getSchemaTpl('visible')]
|
119
|
-
}
|
120
|
-
])
|
121
|
-
];
|
216
|
+
{
|
217
|
+
name: 'map',
|
218
|
+
type: 'combo',
|
219
|
+
mode: 'normal',
|
220
|
+
multiple: true,
|
221
|
+
label: tipedLabel(
|
222
|
+
'颜色',
|
223
|
+
'分配不同的值段,用不同的颜色提示用户'
|
224
|
+
),
|
225
|
+
items: [
|
226
|
+
{
|
227
|
+
type: 'input-number',
|
228
|
+
name: 'value',
|
229
|
+
placeholder: 'value',
|
230
|
+
required: true,
|
231
|
+
columnClassName: 'w-xs',
|
232
|
+
unique: true,
|
233
|
+
min: 0,
|
234
|
+
step: 10,
|
235
|
+
precision: 0
|
236
|
+
},
|
237
|
+
{
|
238
|
+
placeholder: 'color',
|
239
|
+
type: 'input-color',
|
240
|
+
name: 'color',
|
241
|
+
required: true
|
242
|
+
}
|
243
|
+
],
|
244
|
+
value: [
|
245
|
+
{color: '#dc3545', value: 20},
|
246
|
+
{color: '#fad733', value: 60},
|
247
|
+
{color: '#28a745', value: 100}
|
248
|
+
],
|
249
|
+
pipeIn: (value: any) => {
|
250
|
+
return Array.isArray(value) ? value : [];
|
251
|
+
}
|
252
|
+
}
|
253
|
+
]
|
254
|
+
},
|
255
|
+
getSchemaTpl('style:classNames', {
|
256
|
+
schema: [],
|
257
|
+
isFormItem
|
258
|
+
})
|
259
|
+
])
|
260
|
+
}
|
261
|
+
]);
|
122
262
|
};
|
123
263
|
}
|
124
264
|
|
package/src/plugin/Service.tsx
CHANGED
@@ -3,6 +3,7 @@ import React from 'react';
|
|
3
3
|
import {registerEditorPlugin} from '../manager';
|
4
4
|
import {BaseEventContext, BasePlugin, RegionConfig} from '../plugin';
|
5
5
|
import {getSchemaTpl} from '../component/schemaTpl';
|
6
|
+
import {getEventControlConfig} from '../util';
|
6
7
|
|
7
8
|
export class ServicePlugin extends BasePlugin {
|
8
9
|
// 关联渲染器名字
|
@@ -82,15 +83,14 @@ export class ServicePlugin extends BasePlugin {
|
|
82
83
|
step: 500,
|
83
84
|
description: '设置后将自动定时刷新,单位 ms'
|
84
85
|
},
|
85
|
-
|
86
|
+
|
87
|
+
getSchemaTpl('switch', {
|
86
88
|
name: 'silentPolling',
|
87
89
|
label: '静默加载',
|
88
|
-
mode: 'inline',
|
89
|
-
className: 'block',
|
90
|
-
type: 'switch',
|
91
90
|
visibleOn: '!!data.interval',
|
92
91
|
description: '设置自动定时刷新是否显示加载动画'
|
93
|
-
},
|
92
|
+
}),
|
93
|
+
|
94
94
|
{
|
95
95
|
name: 'stopAutoRefreshWhen',
|
96
96
|
label: '停止定时刷新检测',
|
@@ -152,7 +152,11 @@ export class ServicePlugin extends BasePlugin {
|
|
152
152
|
body: [
|
153
153
|
getSchemaTpl('ref'),
|
154
154
|
getSchemaTpl('name'),
|
155
|
-
getSchemaTpl('visible')
|
155
|
+
getSchemaTpl('visible'),
|
156
|
+
getSchemaTpl('eventControl', {
|
157
|
+
name: 'onEvent',
|
158
|
+
...getEventControlConfig(this.manager, context)
|
159
|
+
})
|
156
160
|
]
|
157
161
|
}
|
158
162
|
]);
|
package/src/plugin/Table.tsx
CHANGED
@@ -15,6 +15,7 @@ import {defaultValue, getSchemaTpl} from '../component/schemaTpl';
|
|
15
15
|
import {repeatArray} from '../util';
|
16
16
|
import {setVariable} from 'amis-core';
|
17
17
|
import {mockValue} from '../mocker';
|
18
|
+
import {EditorNodeType} from '../store/node';
|
18
19
|
import {SchemaObject} from 'amis/lib/Schema';
|
19
20
|
|
20
21
|
export class TablePlugin extends BasePlugin {
|
@@ -242,43 +243,31 @@ export class TablePlugin extends BasePlugin {
|
|
242
243
|
description: '自动即列数量大于5个时自动开启'
|
243
244
|
},
|
244
245
|
|
245
|
-
{
|
246
|
+
getSchemaTpl('switch', {
|
246
247
|
name: 'affixHeader',
|
247
|
-
type: 'switch',
|
248
248
|
label: '是否固顶表头',
|
249
|
-
mode: 'inline',
|
250
|
-
className: 'w-full',
|
251
249
|
pipeIn: defaultValue(true)
|
252
|
-
},
|
250
|
+
}),
|
253
251
|
|
254
|
-
{
|
252
|
+
getSchemaTpl('switch', {
|
255
253
|
name: 'showHeader',
|
256
|
-
type: 'switch',
|
257
|
-
mode: 'inline',
|
258
|
-
className: 'w-full',
|
259
254
|
label: '是否显示头部',
|
260
255
|
pipeIn: defaultValue(true)
|
261
|
-
},
|
256
|
+
}),
|
262
257
|
|
263
|
-
{
|
258
|
+
getSchemaTpl('switch', {
|
264
259
|
name: 'showFooter',
|
265
|
-
type: 'switch',
|
266
|
-
mode: 'inline',
|
267
|
-
className: 'w-full',
|
268
260
|
label: '是否显示底部',
|
269
261
|
pipeIn: defaultValue(true)
|
270
|
-
},
|
262
|
+
}),
|
271
263
|
|
272
|
-
{
|
264
|
+
getSchemaTpl('switch', {
|
273
265
|
name: 'footable',
|
274
|
-
type: 'switch',
|
275
|
-
mode: 'inline',
|
276
|
-
className: 'w-full',
|
277
266
|
label: '是否开启单条底部展示',
|
278
267
|
description:
|
279
268
|
'如果列太多显示会很臃肿,可以考虑把部分列放在当前行的底部展示',
|
280
269
|
pipeIn: (value: any) => !!value
|
281
|
-
},
|
270
|
+
}),
|
282
271
|
|
283
272
|
{
|
284
273
|
name: 'footable.expand',
|
@@ -423,6 +412,46 @@ export class TablePlugin extends BasePlugin {
|
|
423
412
|
};
|
424
413
|
}
|
425
414
|
}
|
415
|
+
|
416
|
+
async buildDataSchemas(node: EditorNodeType, region?: EditorNodeType) {
|
417
|
+
const itemsSchema: any = {
|
418
|
+
$id: 'tableRow',
|
419
|
+
type: 'object',
|
420
|
+
properties: {}
|
421
|
+
};
|
422
|
+
const columns: EditorNodeType = node.children.find(
|
423
|
+
item => item.isRegion && item.region === 'columns'
|
424
|
+
);
|
425
|
+
|
426
|
+
for (let current of columns.children) {
|
427
|
+
const schema = current.schema;
|
428
|
+
if (schema.name) {
|
429
|
+
itemsSchema.properties[schema.name] = current.info?.plugin
|
430
|
+
?.buildDataSchemas
|
431
|
+
? await current.info.plugin.buildDataSchemas(current, region)
|
432
|
+
: {
|
433
|
+
type: 'string',
|
434
|
+
title: schema.label || schema.name,
|
435
|
+
description: schema.description
|
436
|
+
};
|
437
|
+
}
|
438
|
+
}
|
439
|
+
|
440
|
+
if (region?.region === 'columns') {
|
441
|
+
return itemsSchema;
|
442
|
+
}
|
443
|
+
|
444
|
+
return {
|
445
|
+
$id: 'table',
|
446
|
+
type: 'object',
|
447
|
+
properties: {
|
448
|
+
items: {
|
449
|
+
type: 'array',
|
450
|
+
items: itemsSchema
|
451
|
+
}
|
452
|
+
}
|
453
|
+
};
|
454
|
+
}
|
426
455
|
}
|
427
456
|
|
428
457
|
registerEditorPlugin(TablePlugin);
|