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
@@ -1,8 +1,16 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
defaultValue,
|
3
|
+
getSchemaTpl,
|
4
|
+
undefinedPipeOut
|
5
|
+
} from '../../component/schemaTpl';
|
2
6
|
import {registerEditorPlugin} from '../../manager';
|
3
|
-
import {BasePlugin} from '../../plugin';
|
7
|
+
import {BasePlugin, BaseEventContext} from '../../plugin';
|
8
|
+
import {formItemControl, tipedLabel} from '../../component/control/BaseControl';
|
9
|
+
import {getEventControlConfig, isObject} from '../../util';
|
10
|
+
import {ValidatorTag} from '../../component/validator';
|
11
|
+
import {RendererAction, RendererEvent} from '../../event-action';
|
4
12
|
|
5
|
-
export class
|
13
|
+
export class RateControlPlugin extends BasePlugin {
|
6
14
|
// 关联渲染器名字
|
7
15
|
rendererName = 'input-rating';
|
8
16
|
$schema = '/schemas/RatingControlSchema.json';
|
@@ -31,48 +39,352 @@ export class RatingControlPlugin extends BasePlugin {
|
|
31
39
|
}
|
32
40
|
]
|
33
41
|
};
|
42
|
+
notRenderFormZone = true;
|
34
43
|
|
35
44
|
panelTitle = '评分';
|
36
|
-
panelBody = [
|
37
|
-
getSchemaTpl('switchDefaultValue'),
|
38
45
|
|
46
|
+
count = 5;
|
47
|
+
|
48
|
+
// 事件定义
|
49
|
+
events: RendererEvent[] = [
|
39
50
|
{
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
51
|
+
eventName: 'change',
|
52
|
+
eventLabel: '值变化',
|
53
|
+
description: '评分值变化时触发',
|
54
|
+
dataSchema: [
|
55
|
+
{
|
56
|
+
type: 'object',
|
57
|
+
properties: {
|
58
|
+
'event.data.value': {
|
59
|
+
type: 'string',
|
60
|
+
title: '评分值'
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
]
|
65
|
+
}
|
66
|
+
];
|
45
67
|
|
68
|
+
// 动作定义
|
69
|
+
actions: RendererAction[] = [
|
46
70
|
{
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
value: 5
|
71
|
+
actionType: 'clear',
|
72
|
+
actionLabel: '清空',
|
73
|
+
description: '清空评分值'
|
51
74
|
},
|
52
75
|
{
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
className: 'w-full',
|
57
|
-
label: '允许半星',
|
58
|
-
value: false
|
76
|
+
actionType: 'reset',
|
77
|
+
actionLabel: '重置',
|
78
|
+
description: '将值重置为resetValue,若没有配置resetValue,则清空'
|
59
79
|
},
|
60
|
-
|
61
80
|
{
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
label: '可清除',
|
67
|
-
description: '是否允许再次点击后清除',
|
68
|
-
value: false
|
69
|
-
},
|
70
|
-
getSchemaTpl('className', {
|
71
|
-
label: '描述 CSS 类名',
|
72
|
-
name: 'descriptionClassName',
|
73
|
-
visibleOn: 'data.description'
|
74
|
-
})
|
81
|
+
actionType: 'setValue',
|
82
|
+
actionLabel: '赋值',
|
83
|
+
description: '触发组件数据更新'
|
84
|
+
}
|
75
85
|
];
|
86
|
+
|
87
|
+
panelJustify = true;
|
88
|
+
panelBodyCreator = (context: BaseEventContext) => {
|
89
|
+
return getSchemaTpl('tabs', [
|
90
|
+
{
|
91
|
+
title: '属性',
|
92
|
+
body: getSchemaTpl('collapseGroup', [
|
93
|
+
{
|
94
|
+
title: '基本',
|
95
|
+
body: [
|
96
|
+
getSchemaTpl('formItemName', {
|
97
|
+
required: true
|
98
|
+
}),
|
99
|
+
|
100
|
+
{
|
101
|
+
label: 'Label',
|
102
|
+
name: 'label',
|
103
|
+
type: 'input-text'
|
104
|
+
},
|
105
|
+
|
106
|
+
{
|
107
|
+
label: '最大值',
|
108
|
+
name: 'count',
|
109
|
+
type: 'input-number',
|
110
|
+
max: 10,
|
111
|
+
min: 1,
|
112
|
+
value: 5,
|
113
|
+
pipeIn: (value: number) => (this.count = value),
|
114
|
+
pipeOut: (value: number) => (this.count = value)
|
115
|
+
},
|
116
|
+
|
117
|
+
{
|
118
|
+
type: 'input-number',
|
119
|
+
name: 'value',
|
120
|
+
label: '默认值',
|
121
|
+
max: 10,
|
122
|
+
min: 0
|
123
|
+
},
|
124
|
+
|
125
|
+
getSchemaTpl('switch', {
|
126
|
+
name: 'allowClear',
|
127
|
+
label: tipedLabel('可清除', '是否允许再次点击后清除'),
|
128
|
+
value: false
|
129
|
+
}),
|
130
|
+
|
131
|
+
getSchemaTpl('switch', {
|
132
|
+
name: 'half',
|
133
|
+
label: '允许半星',
|
134
|
+
value: false
|
135
|
+
}),
|
136
|
+
|
137
|
+
getSchemaTpl('labelRemark'),
|
138
|
+
|
139
|
+
getSchemaTpl('remark'),
|
140
|
+
|
141
|
+
getSchemaTpl('combo-container', {
|
142
|
+
type: 'combo',
|
143
|
+
label: '描述',
|
144
|
+
mode: 'normal',
|
145
|
+
name: 'texts',
|
146
|
+
items: [
|
147
|
+
{
|
148
|
+
placeholder: 'Key',
|
149
|
+
type: 'input-number',
|
150
|
+
unique: true,
|
151
|
+
name: 'key',
|
152
|
+
columnClassName: 'w-xs flex-none',
|
153
|
+
min: 0,
|
154
|
+
step: 1,
|
155
|
+
max: 10,
|
156
|
+
precision: 0
|
157
|
+
},
|
158
|
+
|
159
|
+
{
|
160
|
+
placeholder: '描述内容',
|
161
|
+
type: 'input-text',
|
162
|
+
name: 'value'
|
163
|
+
}
|
164
|
+
],
|
165
|
+
draggable: false,
|
166
|
+
multiple: true,
|
167
|
+
pipeIn: (value: any) => {
|
168
|
+
if (!isObject(value)) {
|
169
|
+
return Array.isArray(value) ? value : [];
|
170
|
+
}
|
171
|
+
|
172
|
+
const res = Object.keys(value).map((item: any) => {
|
173
|
+
return {
|
174
|
+
key: item || 0,
|
175
|
+
value: value[item] || ''
|
176
|
+
};
|
177
|
+
}); //.filter((item: any) => item.key <= this.count);
|
178
|
+
|
179
|
+
return res;
|
180
|
+
},
|
181
|
+
pipeOut: (value: any[]) => {
|
182
|
+
if (!value.length) {
|
183
|
+
return undefined;
|
184
|
+
}
|
185
|
+
|
186
|
+
const res: any = {};
|
187
|
+
const findMinCanUsedKey = (
|
188
|
+
keys: string[],
|
189
|
+
max: number
|
190
|
+
): void | number => {
|
191
|
+
for (let i = 1; i <= max; i++) {
|
192
|
+
if (!keys.includes(String(i))) {
|
193
|
+
return i;
|
194
|
+
}
|
195
|
+
}
|
196
|
+
};
|
197
|
+
|
198
|
+
value.forEach(item => {
|
199
|
+
const key =
|
200
|
+
item.key !== undefined
|
201
|
+
? Number(item.key)
|
202
|
+
: findMinCanUsedKey(Object.keys(res), this.count);
|
203
|
+
|
204
|
+
// && key <= this.count
|
205
|
+
if (key) {
|
206
|
+
res[key] = item?.value || '';
|
207
|
+
}
|
208
|
+
});
|
209
|
+
|
210
|
+
return res;
|
211
|
+
}
|
212
|
+
})
|
213
|
+
]
|
214
|
+
},
|
215
|
+
getSchemaTpl('status', {isFormItem: true, readonly: true}),
|
216
|
+
getSchemaTpl('validation', {
|
217
|
+
tag: ValidatorTag.Check
|
218
|
+
})
|
219
|
+
])
|
220
|
+
},
|
221
|
+
{
|
222
|
+
title: '外观',
|
223
|
+
body: [
|
224
|
+
getSchemaTpl('collapseGroup', [
|
225
|
+
getSchemaTpl('style:formItem', {
|
226
|
+
renderer: context.info.renderer
|
227
|
+
}),
|
228
|
+
{
|
229
|
+
title: '图标',
|
230
|
+
body: [
|
231
|
+
{
|
232
|
+
type: 'ae-switch-more',
|
233
|
+
label: '自定义',
|
234
|
+
bulk: true,
|
235
|
+
mode: 'normal',
|
236
|
+
value: false,
|
237
|
+
formType: 'extend',
|
238
|
+
form: {
|
239
|
+
body: [
|
240
|
+
{
|
241
|
+
type: 'input-text',
|
242
|
+
label: '字符',
|
243
|
+
name: 'char'
|
244
|
+
}
|
245
|
+
]
|
246
|
+
},
|
247
|
+
pipeIn: (value: string) => {
|
248
|
+
if (typeof value === 'string' && value.length) {
|
249
|
+
return {
|
250
|
+
character: value
|
251
|
+
};
|
252
|
+
}
|
253
|
+
return undefined;
|
254
|
+
},
|
255
|
+
pipeOut: (value: any) => {
|
256
|
+
if (!isObject(value)) {
|
257
|
+
return undefined;
|
258
|
+
}
|
259
|
+
return typeof value.character === 'string'
|
260
|
+
? value.character
|
261
|
+
: undefined;
|
262
|
+
}
|
263
|
+
},
|
264
|
+
|
265
|
+
{
|
266
|
+
type: 'input-color',
|
267
|
+
label: tipedLabel('未选中色值', '默认未选中色值为 #e7e7e8'),
|
268
|
+
name: 'inactiveColor',
|
269
|
+
pipeIn: defaultValue('#e7e7e8'),
|
270
|
+
pipeOut: undefinedPipeOut
|
271
|
+
},
|
272
|
+
|
273
|
+
getSchemaTpl('combo-container', {
|
274
|
+
type: 'combo',
|
275
|
+
label: '选中色值',
|
276
|
+
mode: 'normal',
|
277
|
+
name: 'colors',
|
278
|
+
items: [
|
279
|
+
{
|
280
|
+
placeholder: 'Key',
|
281
|
+
type: 'input-number',
|
282
|
+
unique: true,
|
283
|
+
name: 'key',
|
284
|
+
columnClassName: 'w-xs flex-none',
|
285
|
+
min: 0,
|
286
|
+
max: 10,
|
287
|
+
step: 1,
|
288
|
+
precision: 0
|
289
|
+
},
|
290
|
+
|
291
|
+
{
|
292
|
+
placeholder: 'Value',
|
293
|
+
type: 'input-color',
|
294
|
+
name: 'value'
|
295
|
+
}
|
296
|
+
],
|
297
|
+
value: {
|
298
|
+
2: '#abadb1',
|
299
|
+
3: '#787b81',
|
300
|
+
5: '#ffa900'
|
301
|
+
},
|
302
|
+
draggable: false,
|
303
|
+
multiple: true,
|
304
|
+
pipeIn: (value: any) => {
|
305
|
+
if (!isObject(value)) {
|
306
|
+
return Array.isArray(value) ? value : [];
|
307
|
+
}
|
308
|
+
|
309
|
+
const res = Object.keys(value).map((item: any) => {
|
310
|
+
return {
|
311
|
+
key: item,
|
312
|
+
value: value[item] || ''
|
313
|
+
};
|
314
|
+
}); //.filter((item: any) => item.key <= this.count);
|
315
|
+
|
316
|
+
return res;
|
317
|
+
},
|
318
|
+
pipeOut: (value: any[]) => {
|
319
|
+
if (!value.length) {
|
320
|
+
return undefined;
|
321
|
+
}
|
322
|
+
|
323
|
+
const res: any = {};
|
324
|
+
const findMinCanUsedKey = (
|
325
|
+
keys: string[],
|
326
|
+
max: number
|
327
|
+
): void | number => {
|
328
|
+
for (let i = 1; i <= max; i++) {
|
329
|
+
if (!keys.includes(String(i))) {
|
330
|
+
return i;
|
331
|
+
}
|
332
|
+
}
|
333
|
+
};
|
334
|
+
|
335
|
+
value.forEach(item => {
|
336
|
+
const key =
|
337
|
+
item.key !== undefined
|
338
|
+
? Number(item.key)
|
339
|
+
: findMinCanUsedKey(Object.keys(res), this.count);
|
340
|
+
|
341
|
+
if (key) {
|
342
|
+
res[key] = item?.value || '';
|
343
|
+
}
|
344
|
+
});
|
345
|
+
|
346
|
+
return res;
|
347
|
+
}
|
348
|
+
})
|
349
|
+
]
|
350
|
+
},
|
351
|
+
{
|
352
|
+
title: '描述',
|
353
|
+
body: [
|
354
|
+
getSchemaTpl('horizontal-align', {
|
355
|
+
name: 'textPosition',
|
356
|
+
pipeIn: defaultValue('right')
|
357
|
+
})
|
358
|
+
]
|
359
|
+
},
|
360
|
+
getSchemaTpl('style:classNames', {
|
361
|
+
schema: [
|
362
|
+
getSchemaTpl('className', {
|
363
|
+
label: '图标',
|
364
|
+
name: 'charClassName'
|
365
|
+
}),
|
366
|
+
|
367
|
+
getSchemaTpl('className', {
|
368
|
+
label: '评分描述',
|
369
|
+
name: 'textClassName'
|
370
|
+
})
|
371
|
+
]
|
372
|
+
})
|
373
|
+
])
|
374
|
+
]
|
375
|
+
},
|
376
|
+
{
|
377
|
+
title: '事件',
|
378
|
+
className: 'p-none',
|
379
|
+
body: [
|
380
|
+
getSchemaTpl('eventControl', {
|
381
|
+
name: 'onEvent',
|
382
|
+
...getEventControlConfig(this.manager, context)
|
383
|
+
})
|
384
|
+
]
|
385
|
+
}
|
386
|
+
]);
|
387
|
+
};
|
76
388
|
}
|
77
389
|
|
78
|
-
registerEditorPlugin(
|
390
|
+
registerEditorPlugin(RateControlPlugin);
|
@@ -147,12 +147,11 @@ export class RichTextControlPlugin extends BasePlugin {
|
|
147
147
|
noBorder: true,
|
148
148
|
multiLine: true,
|
149
149
|
items: [
|
150
|
-
{
|
151
|
-
type: 'switch',
|
150
|
+
getSchemaTpl('switch', {
|
152
151
|
label: '是否显示菜单栏',
|
153
152
|
value: 'true',
|
154
153
|
name: 'menubar'
|
155
|
-
},
|
154
|
+
}),
|
156
155
|
{
|
157
156
|
type: 'input-number',
|
158
157
|
label: '高度',
|
@@ -100,7 +100,7 @@ export class TableControlPlugin extends BasePlugin {
|
|
100
100
|
type: 'select',
|
101
101
|
name: 'type',
|
102
102
|
placeholder: '类型',
|
103
|
-
value: '
|
103
|
+
value: 'text',
|
104
104
|
options: [
|
105
105
|
{
|
106
106
|
value: 'text',
|
@@ -177,13 +177,10 @@ export class TableControlPlugin extends BasePlugin {
|
|
177
177
|
}),
|
178
178
|
getSchemaTpl('label'),
|
179
179
|
getSchemaTpl('description'),
|
180
|
-
{
|
180
|
+
getSchemaTpl('switch', {
|
181
181
|
label: '是否可新增',
|
182
|
-
|
183
|
-
|
184
|
-
mode: 'inline',
|
185
|
-
className: 'w-full'
|
186
|
-
},
|
182
|
+
name: 'addable'
|
183
|
+
}),
|
187
184
|
{
|
188
185
|
type: 'input-text',
|
189
186
|
name: 'addBtnLabel',
|
@@ -195,6 +192,7 @@ export class TableControlPlugin extends BasePlugin {
|
|
195
192
|
name: 'addBtnIcon',
|
196
193
|
label: '增加按钮图标',
|
197
194
|
type: 'icon-picker',
|
195
|
+
className: 'fix-icon-picker-overflow',
|
198
196
|
visibleOn: 'data.addable'
|
199
197
|
},
|
200
198
|
getSchemaTpl('api', {
|
@@ -202,13 +200,10 @@ export class TableControlPlugin extends BasePlugin {
|
|
202
200
|
label: '新增时提交的 API',
|
203
201
|
visibleOn: 'data.addable'
|
204
202
|
}),
|
205
|
-
{
|
203
|
+
getSchemaTpl('switch', {
|
206
204
|
label: '是否可删除',
|
207
|
-
|
208
|
-
|
209
|
-
mode: 'inline',
|
210
|
-
className: 'w-full'
|
211
|
-
},
|
205
|
+
name: 'removable'
|
206
|
+
}),
|
212
207
|
{
|
213
208
|
type: 'input-text',
|
214
209
|
name: 'deleteBtnLabel',
|
@@ -220,6 +215,7 @@ export class TableControlPlugin extends BasePlugin {
|
|
220
215
|
name: 'deleteBtnIcon',
|
221
216
|
label: '删除按钮图标',
|
222
217
|
type: 'icon-picker',
|
218
|
+
className: 'fix-icon-picker-overflow',
|
223
219
|
visibleOn: 'data.removable'
|
224
220
|
},
|
225
221
|
getSchemaTpl('api', {
|
@@ -227,13 +223,10 @@ export class TableControlPlugin extends BasePlugin {
|
|
227
223
|
label: '删除时提交的 API',
|
228
224
|
visibleOn: 'data.removable'
|
229
225
|
}),
|
230
|
-
{
|
226
|
+
getSchemaTpl('switch', {
|
231
227
|
label: '是否可编辑',
|
232
|
-
|
233
|
-
|
234
|
-
mode: 'inline',
|
235
|
-
className: 'w-full'
|
236
|
-
},
|
228
|
+
name: 'editable'
|
229
|
+
}),
|
237
230
|
{
|
238
231
|
type: 'input-text',
|
239
232
|
name: 'editBtnLabel',
|
@@ -245,15 +238,13 @@ export class TableControlPlugin extends BasePlugin {
|
|
245
238
|
name: 'editBtnIcon',
|
246
239
|
label: '编辑按钮图标',
|
247
240
|
type: 'icon-picker',
|
241
|
+
className: 'fix-icon-picker-overflow',
|
248
242
|
visibleOn: 'data.editable'
|
249
243
|
},
|
250
|
-
{
|
244
|
+
getSchemaTpl('switch', {
|
251
245
|
label: '是否可复制',
|
252
|
-
|
253
|
-
|
254
|
-
mode: 'inline',
|
255
|
-
className: 'w-full'
|
256
|
-
},
|
246
|
+
name: 'copyable'
|
247
|
+
}),
|
257
248
|
{
|
258
249
|
type: 'input-text',
|
259
250
|
name: 'copyBtnLabel',
|
@@ -265,6 +256,7 @@ export class TableControlPlugin extends BasePlugin {
|
|
265
256
|
name: 'copyBtnIcon',
|
266
257
|
label: '复制按钮图标',
|
267
258
|
type: 'icon-picker',
|
259
|
+
className: 'fix-icon-picker-overflow',
|
268
260
|
visibleOn: 'data.copyable'
|
269
261
|
},
|
270
262
|
getSchemaTpl('api', {
|
@@ -283,6 +275,7 @@ export class TableControlPlugin extends BasePlugin {
|
|
283
275
|
name: 'confirmBtnIcon',
|
284
276
|
label: '确认编辑按钮图标',
|
285
277
|
type: 'icon-picker',
|
278
|
+
className: 'fix-icon-picker-overflow',
|
286
279
|
visibleOn: 'data.editable'
|
287
280
|
},
|
288
281
|
{
|
@@ -296,31 +289,25 @@ export class TableControlPlugin extends BasePlugin {
|
|
296
289
|
name: 'cancelBtnIcon',
|
297
290
|
label: '取消编辑按钮图标',
|
298
291
|
type: 'icon-picker',
|
292
|
+
className: 'fix-icon-picker-overflow',
|
299
293
|
visibleOn: 'data.editable'
|
300
294
|
},
|
301
|
-
{
|
295
|
+
getSchemaTpl('switch', {
|
302
296
|
label: '是否可拖拽排序',
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
},
|
308
|
-
{
|
297
|
+
name: 'draggable'
|
298
|
+
}),
|
299
|
+
|
300
|
+
getSchemaTpl('switch', {
|
309
301
|
label: '确认模式',
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
className: 'w-full'
|
314
|
-
},
|
315
|
-
{
|
302
|
+
name: 'needConfirm'
|
303
|
+
}),
|
304
|
+
getSchemaTpl('switch', {
|
316
305
|
label: '严格模式',
|
317
|
-
type: 'switch',
|
318
306
|
name: 'strictMode', // 同时需要配置strictMode
|
319
|
-
value: true
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
{
|
307
|
+
value: true
|
308
|
+
}),
|
309
|
+
|
310
|
+
getSchemaTpl('switch', {
|
324
311
|
label: '获取父级数据',
|
325
312
|
labelRemark: {
|
326
313
|
trigger: 'click',
|
@@ -330,7 +317,6 @@ export class TableControlPlugin extends BasePlugin {
|
|
330
317
|
'配置"canAccessSuperData": true 同时配置 "strictMode": false 开启此特性,初始会自动映射父级数据域的同名变量。需要注意的是,这里只会初始会映射,一旦修改过就是当前行数据为主了。也就是说,表单项类型的,只会起到初始值的作用',
|
331
318
|
placement: 'left'
|
332
319
|
},
|
333
|
-
type: 'switch',
|
334
320
|
onChange: (value: any, oldValue: any, model: any, form: any) => {
|
335
321
|
if (value && !oldValue) {
|
336
322
|
form.setValues({strictMode: false});
|
@@ -338,10 +324,8 @@ export class TableControlPlugin extends BasePlugin {
|
|
338
324
|
form.setValues({strictMode: true});
|
339
325
|
}
|
340
326
|
},
|
341
|
-
name: 'canAccessSuperData'
|
342
|
-
|
343
|
-
className: 'w-full'
|
344
|
-
}
|
327
|
+
name: 'canAccessSuperData' // 同时需要配置strictMode
|
328
|
+
})
|
345
329
|
])
|
346
330
|
},
|
347
331
|
{
|