@bit-sun/business-component 2.0.39-alpha.6 → 2.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.fatherrc.ts +1 -3
- package/.umirc.ts +6 -6
- package/dist/components/Business/BsSulaQueryTable/setting.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.esm.js +2699 -8096
- package/dist/index.js +2689 -8091
- package/package.json +4 -10
- package/src/assets/list-no-img.svg +22 -0
- package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +0 -1
- package/src/components/Business/BsLayouts/utils.tsx +4 -1
- package/src/components/Business/BsSulaQueryTable/index.tsx +93 -123
- package/src/components/Business/BsSulaQueryTable/setting.tsx +55 -71
- package/src/components/Business/BsSulaQueryTable/utils.tsx +5 -8
- package/src/components/Business/DetailPageWrapper/index.tsx +1 -1
- package/src/components/Business/columnSettingTable/index.tsx +25 -19
- package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +25 -19
- package/src/components/Functional/DataImport/index.tsx +6 -0
- package/src/components/Functional/DataValidation/index.md +1 -0
- package/src/components/Functional/DataValidation/index.tsx +8 -2
- package/src/index.ts +0 -2
- package/src/styles/bsDefault.less +11 -0
- package/dist/components/Business/JsonQueryTable/drawer/index.d.ts +0 -2
- package/dist/components/Business/JsonQueryTable/index.d.ts +0 -3
- package/src/assets/defaultBusiness.less +0 -1896
- package/src/components/Business/JsonQueryTable/configButton/index.js +0 -20
- package/src/components/Business/JsonQueryTable/configTree/component/compactArrayView.js +0 -25
- package/src/components/Business/JsonQueryTable/configTree/component/compactObjectView.js +0 -30
- package/src/components/Business/JsonQueryTable/configTree/index.js +0 -82
- package/src/components/Business/JsonQueryTable/configTree/index.less +0 -44
- package/src/components/Business/JsonQueryTable/configTree/parser/highlight.js +0 -57
- package/src/components/Business/JsonQueryTable/configTree/parser/index.js +0 -124
- package/src/components/Business/JsonQueryTable/configTree/render/iconRender.js +0 -29
- package/src/components/Business/JsonQueryTable/configTree/render/nameRender.js +0 -22
- package/src/components/Business/JsonQueryTable/configTree/treeNode.js +0 -116
- package/src/components/Business/JsonQueryTable/drawer/index.tsx +0 -12
- package/src/components/Business/JsonQueryTable/index.md +0 -92
- package/src/components/Business/JsonQueryTable/index.tsx +0 -95
- package/src/components/Business/JsonQueryTable/jsonEditor/index.js +0 -340
- package/src/components/Business/JsonQueryTable/jsonEditor/index.less +0 -22
- package/src/components/Business/JsonQueryTable/jsonEditor/lint/basicType.js +0 -147
- package/src/components/Business/JsonQueryTable/jsonEditor/lint/index.js +0 -388
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/actions.js +0 -118
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/dependency.js +0 -22
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/index.js +0 -21
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/request.js +0 -65
- package/src/utils/getFormMode.js +0 -12
- package/src/utils/serialize.js +0 -8
|
@@ -1,388 +0,0 @@
|
|
|
1
|
-
import * as basicTypes from './basicType';
|
|
2
|
-
let monaco;
|
|
3
|
-
let editor;
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
isArrayType,
|
|
7
|
-
isStringType,
|
|
8
|
-
isNumberType,
|
|
9
|
-
isBooleanType,
|
|
10
|
-
isNameType,
|
|
11
|
-
isFieldRenderType,
|
|
12
|
-
isLayoutType,
|
|
13
|
-
isObjectType,
|
|
14
|
-
isMethodType,
|
|
15
|
-
isFunctionType,
|
|
16
|
-
isModeType,
|
|
17
|
-
isColumnRender,
|
|
18
|
-
isActionType,
|
|
19
|
-
} = basicTypes;
|
|
20
|
-
|
|
21
|
-
const errorMarks = (node, message = '类型错误') => {
|
|
22
|
-
const name = node?.key?.name || node?.key?.value || node.value || '';
|
|
23
|
-
const { loc } = node;
|
|
24
|
-
|
|
25
|
-
monaco.editor.setModelMarkers(editor.getModel(), 'propFunc', [
|
|
26
|
-
{
|
|
27
|
-
startLineNumber: loc.start.line,
|
|
28
|
-
startColumn: loc.start.column + 1,
|
|
29
|
-
endLineNumber: loc.end.line,
|
|
30
|
-
endColumn: loc.end.column + 1,
|
|
31
|
-
message: `${name} ${message}`,
|
|
32
|
-
severity: monaco.MarkerSeverity.Error,
|
|
33
|
-
},
|
|
34
|
-
]);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
function requiredValidate(field, name) {
|
|
38
|
-
const nameList = Array.isArray(name) ? name : [name];
|
|
39
|
-
const { properties } = field;
|
|
40
|
-
if (!properties) return;
|
|
41
|
-
if (
|
|
42
|
-
!properties.some(item => {
|
|
43
|
-
const itemName = item?.key?.name || item?.key?.value || item.value;
|
|
44
|
-
return nameList.some(v => itemName === v);
|
|
45
|
-
})
|
|
46
|
-
) {
|
|
47
|
-
errorMarks(field, `缺少必填项${name}`);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default (data, _monaco, _editor) => {
|
|
52
|
-
if (!data) return;
|
|
53
|
-
monaco = _monaco;
|
|
54
|
-
editor = _editor;
|
|
55
|
-
const { properties = [] } = data;
|
|
56
|
-
|
|
57
|
-
properties.forEach(node => {
|
|
58
|
-
const { key } = node;
|
|
59
|
-
const name = key?.name || key?.value;
|
|
60
|
-
if (node?.loc?.start?.column < 5) {
|
|
61
|
-
// 仅对最外层校验,内部校验直接处理外部字段
|
|
62
|
-
validate(node, name);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
function validate(node, name) {
|
|
68
|
-
/**
|
|
69
|
-
* fields字段校验
|
|
70
|
-
*/
|
|
71
|
-
const fieldTypes = ['fields'];
|
|
72
|
-
if (fieldTypes.includes(name)) {
|
|
73
|
-
if (!isArrayType(node)) {
|
|
74
|
-
errorMarks(node, '应为数组类型');
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
const { elements } = node.value || {};
|
|
78
|
-
elements.forEach(field => {
|
|
79
|
-
if (!isObjectType(field)) {
|
|
80
|
-
errorMarks(field, '应为对象类型');
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const { properties } = field;
|
|
85
|
-
if (!properties) return;
|
|
86
|
-
if (
|
|
87
|
-
!properties.some(item => {
|
|
88
|
-
const itemName = item?.key?.name || item?.key?.value || item.value;
|
|
89
|
-
return itemName === 'fields';
|
|
90
|
-
})
|
|
91
|
-
) {
|
|
92
|
-
requiredValidate(field, 'name');
|
|
93
|
-
requiredValidate(field, ['field', 'render']);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
properties.forEach(item => {
|
|
97
|
-
const itemName = item?.key?.name || item?.key?.value || item.value;
|
|
98
|
-
if (itemName === 'name' && !isNameType(item)) {
|
|
99
|
-
errorMarks(item);
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
if (itemName === 'label') {
|
|
103
|
-
if (!isStringType(item)) {
|
|
104
|
-
errorMarks(item);
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
if (itemName === 'field') {
|
|
109
|
-
if (!isFieldRenderType(item)) {
|
|
110
|
-
errorMarks(item);
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
if (isObjectType(item)) {
|
|
114
|
-
const { properties: renderProperties } = item.value;
|
|
115
|
-
if (!renderProperties) return;
|
|
116
|
-
renderProperties.forEach(renderItem => {
|
|
117
|
-
const renderItemName =
|
|
118
|
-
renderItem.key.name || renderItem.key.value;
|
|
119
|
-
if (renderItemName === 'type') {
|
|
120
|
-
if (!isStringType(renderItem) && !isFunctionType(renderItem)) {
|
|
121
|
-
errorMarks(renderItem);
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (itemName === 'valuePropName' && !isStringType(item)) {
|
|
130
|
-
errorMarks(item);
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
if (itemName === 'rules' && !isArrayType(item)) {
|
|
134
|
-
errorMarks(item);
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
if (itemName === 'wrapFormItem' && !isBooleanType(item)) {
|
|
138
|
-
errorMarks(item);
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
if (itemName === 'initialDisabled' && !isBooleanType(item)) {
|
|
142
|
-
errorMarks(item);
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
if (itemName === 'initialVisible' && !isBooleanType(item)) {
|
|
146
|
-
errorMarks(item);
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
if (itemName === 'dependency') {
|
|
150
|
-
if (!isObjectType(item)) {
|
|
151
|
-
errorMarks(item);
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
const { properties: depProperties } = item.value;
|
|
155
|
-
if (!depProperties) return;
|
|
156
|
-
depProperties.forEach(depItem => {
|
|
157
|
-
const depName = depItem.key.name || depItem.key.value;
|
|
158
|
-
const depType = ['value', 'source', 'disabled', 'visible'];
|
|
159
|
-
if (!depType.includes(depName)) {
|
|
160
|
-
errorMarks(
|
|
161
|
-
depType,
|
|
162
|
-
'dependency 只可以包含value source disabled visible四种类型',
|
|
163
|
-
);
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
if (!isObjectType(depItem)) {
|
|
167
|
-
errorMarks(depItem);
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
const { properties: depItemProperties } = depItem.value;
|
|
171
|
-
if (!depItemProperties) return;
|
|
172
|
-
depItemProperties.forEach(depNode => {
|
|
173
|
-
const depNodeName = depNode.key.name || depNode.key.value;
|
|
174
|
-
const allowDepTypes = [
|
|
175
|
-
'relates',
|
|
176
|
-
'inputs',
|
|
177
|
-
'cases',
|
|
178
|
-
'ignores',
|
|
179
|
-
'type',
|
|
180
|
-
'output',
|
|
181
|
-
'defaultOutput',
|
|
182
|
-
];
|
|
183
|
-
if (!allowDepTypes.includes(depNodeName)) {
|
|
184
|
-
errorMarks(depNode, '多余类型');
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (depNodeName === 'relates') {
|
|
189
|
-
if (!isArrayType(depNode)) {
|
|
190
|
-
errorMarks(depNode);
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
if (depNodeName === 'inputs') {
|
|
195
|
-
if (!isArrayType(depNode)) {
|
|
196
|
-
errorMarks(depNode);
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
if (depNodeName === 'cases') {
|
|
201
|
-
if (!isArrayType(depNode)) {
|
|
202
|
-
errorMarks(depNode);
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
if (depNodeName === 'ignores') {
|
|
207
|
-
if (!isArrayType(depNode)) {
|
|
208
|
-
errorMarks(depNode);
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
if (itemName === 'render' && !isFieldRenderType(item)) {
|
|
217
|
-
errorMarks(item);
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* layout
|
|
226
|
-
*/
|
|
227
|
-
if (name === 'layout') {
|
|
228
|
-
if (!isLayoutType(node)) {
|
|
229
|
-
errorMarks(node);
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* 请求校验
|
|
236
|
-
*/
|
|
237
|
-
const fetchType = [
|
|
238
|
-
'remoteSource',
|
|
239
|
-
'remoteDataSource',
|
|
240
|
-
'remoteValues',
|
|
241
|
-
'submit',
|
|
242
|
-
];
|
|
243
|
-
if (fetchType.includes(name)) {
|
|
244
|
-
if (!isObjectType(node)) {
|
|
245
|
-
errorMarks(node, '应为对象类型');
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
requiredValidate(node.value, 'url');
|
|
249
|
-
const { properties } = node.value;
|
|
250
|
-
if (!properties) return;
|
|
251
|
-
properties.forEach(item => {
|
|
252
|
-
const itemName = item.key.name || item.key.value;
|
|
253
|
-
if (itemName === 'url' && !isStringType(item)) {
|
|
254
|
-
errorMarks(item);
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
if (itemName === 'method' && !isMethodType(item)) {
|
|
258
|
-
errorMarks(item);
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
if (itemName === 'params' && !isObjectType(item)) {
|
|
262
|
-
errorMarks(item);
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
if (itemName === 'extraParams' && !isObjectType(item)) {
|
|
266
|
-
errorMarks(item);
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
if (itemName === 'convertParams' && !isFunctionType(item)) {
|
|
270
|
-
errorMarks(item);
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
if (itemName === 'converter' && !isFunctionType(item)) {
|
|
274
|
-
errorMarks(item);
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* columns
|
|
282
|
-
*/
|
|
283
|
-
if (name === 'columns') {
|
|
284
|
-
if (!isArrayType(node)) {
|
|
285
|
-
errorMarks(node);
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
const { elements } = node.value || {};
|
|
290
|
-
elements.forEach(column => {
|
|
291
|
-
if (!isObjectType(column)) {
|
|
292
|
-
errorMarks(column, '应为对象类型');
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
const { properties } = column;
|
|
297
|
-
if (!properties) return;
|
|
298
|
-
properties.forEach(item => {
|
|
299
|
-
const itemName = item?.key?.name || item?.key?.value || item.value;
|
|
300
|
-
if (itemName === 'key') {
|
|
301
|
-
if (!isStringType(item)) {
|
|
302
|
-
errorMarks(item, '应为字符串类型');
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
if (itemName === 'title') {
|
|
307
|
-
if (!isStringType(item)) {
|
|
308
|
-
errorMarks(item, '应为字符串类型');
|
|
309
|
-
return;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
if (itemName === 'render') {
|
|
313
|
-
if (!isColumnRender(item)) {
|
|
314
|
-
errorMarks(item);
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
});
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* mode
|
|
324
|
-
*/
|
|
325
|
-
|
|
326
|
-
if (name === 'mode') {
|
|
327
|
-
if (!isModeType(node)) {
|
|
328
|
-
errorMarks(node, 'mode可选类型为view create edit');
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* action
|
|
335
|
-
*/
|
|
336
|
-
if (name === 'actionsRender' || name === 'leftActionsRender') {
|
|
337
|
-
if (!isActionType(node)) {
|
|
338
|
-
errorMarks(node);
|
|
339
|
-
return;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* formItem
|
|
345
|
-
*/
|
|
346
|
-
if (name === 'itemLayout') {
|
|
347
|
-
if (!isObjectType(node)) {
|
|
348
|
-
errorMarks(node);
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
const { properties } = node.value;
|
|
353
|
-
properties.forEach(item => {
|
|
354
|
-
const itemName = item?.key?.name || item?.key?.value || item.value;
|
|
355
|
-
if (itemName === 'span') {
|
|
356
|
-
if (!isNumberType(item)) {
|
|
357
|
-
errorMarks(item);
|
|
358
|
-
return;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
if (itemName === 'gutter') {
|
|
362
|
-
if (!isNumberType(item)) {
|
|
363
|
-
errorMarks(item);
|
|
364
|
-
return;
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
if (itemName === 'offset') {
|
|
368
|
-
if (!isNumberType(item)) {
|
|
369
|
-
errorMarks(item);
|
|
370
|
-
return;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
if (itemName === 'labelCol') {
|
|
375
|
-
if (!isObjectType(item)) {
|
|
376
|
-
errorMarks(item);
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
if (itemName === 'wrapperCol') {
|
|
381
|
-
if (!isObjectType(item)) {
|
|
382
|
-
errorMarks(item);
|
|
383
|
-
return;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
});
|
|
387
|
-
}
|
|
388
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
export default monaco => [
|
|
2
|
-
{
|
|
3
|
-
type: 'action',
|
|
4
|
-
label: 'back',
|
|
5
|
-
detail: '返回上一级',
|
|
6
|
-
kind: monaco.languages.CompletionItemKind.Property,
|
|
7
|
-
insertTextRules:
|
|
8
|
-
monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
9
|
-
insertText: "'back'",
|
|
10
|
-
documentation: {
|
|
11
|
-
value: ``,
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
type: 'action',
|
|
16
|
-
label: 'request',
|
|
17
|
-
detail: '请求',
|
|
18
|
-
kind: monaco.languages.CompletionItemKind.Property,
|
|
19
|
-
insertTextRules:
|
|
20
|
-
monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
21
|
-
insertText:
|
|
22
|
-
'{\n type: "request",\n url: "${1:\u002Fsula.json}",\n method: "${2:get}",\n},',
|
|
23
|
-
documentation: {
|
|
24
|
-
value: ``,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
type: 'action',
|
|
29
|
-
label: 'forward',
|
|
30
|
-
detail: '前进一级',
|
|
31
|
-
kind: monaco.languages.CompletionItemKind.Property,
|
|
32
|
-
insertTextRules:
|
|
33
|
-
monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
34
|
-
insertText: "'forward'",
|
|
35
|
-
documentation: {
|
|
36
|
-
value: ``,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
type: 'action',
|
|
41
|
-
label: 'modalform',
|
|
42
|
-
detail: '弹框表单插件',
|
|
43
|
-
kind: monaco.languages.CompletionItemKind.Property,
|
|
44
|
-
insertTextRules:
|
|
45
|
-
monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
46
|
-
insertText:
|
|
47
|
-
'{\n type: "modalform",\n title: "Title",\n mode: "edit",\n fields: [\n {\n name: "input",\n label: "input",\n field: {\n type: "input",\n props: {\n placeholder: "请输入"\n }\n },\n rules: [\n {\n required: true,\n message: "请输入"\n }\n ]\n }\n ],\n remoteValues: {\n url: "\u002Fdetail.json",\n method: "post",\n params: {\n id: 1,\n },\n },\n submit: {\n url: "\u002Fadd.json",\n method: "post"\n },\n},',
|
|
48
|
-
documentation: {
|
|
49
|
-
value: `
|
|
50
|
-
属性名 | 描述 | 类型
|
|
51
|
-
---|:--:|---:
|
|
52
|
-
fields | 表单配置 | -
|
|
53
|
-
title | 弹框标题 | -
|
|
54
|
-
mode | 表单模式 | -
|
|
55
|
-
remoteValues | 远程表单值的请求配置 | -
|
|
56
|
-
submit | 提交表单数据的请求配置 | -
|
|
57
|
-
`,
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
type: 'action',
|
|
62
|
-
label: 'drawerform',
|
|
63
|
-
detail: '弹框表单插件',
|
|
64
|
-
kind: monaco.languages.CompletionItemKind.Property,
|
|
65
|
-
insertTextRules:
|
|
66
|
-
monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
67
|
-
insertText:
|
|
68
|
-
'{\n type: "drawerform",\n title: "Title",\n mode: "edit",\n fields: [\n {\n name: "input",\n label: "input",\n field: {\n type: "input",\n props: {\n placeholder: "请输入"\n }\n },\n rules: [\n {\n required: true,\n message: "请输入"\n }\n ]\n }\n ],\n remoteValues: {\n url: "\u002Fdetail.json",\n method: "post",\n params: {\n id: 1,\n },\n },\n submit: {\n url: "\u002Fadd.json",\n method: "post"\n },\n},',
|
|
69
|
-
documentation: {
|
|
70
|
-
value: `
|
|
71
|
-
属性名 | 描述 | 类型
|
|
72
|
-
---|:--:|---:
|
|
73
|
-
fields | 表单配置 | -
|
|
74
|
-
title | 抽屉标题 | -
|
|
75
|
-
mode | 表单模式 | -
|
|
76
|
-
remoteValues | 远程表单值的请求配置 | -
|
|
77
|
-
submit | 提交表单数据的请求配置 | -
|
|
78
|
-
`,
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
type: 'action',
|
|
83
|
-
label: 'refreshtable',
|
|
84
|
-
detail: '刷新表格',
|
|
85
|
-
kind: monaco.languages.CompletionItemKind.Property,
|
|
86
|
-
insertTextRules:
|
|
87
|
-
monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
88
|
-
insertText: "'refreshtable'",
|
|
89
|
-
documentation: {
|
|
90
|
-
value: ``,
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
type: 'action',
|
|
95
|
-
label: 'resettable',
|
|
96
|
-
detail: '重置表格',
|
|
97
|
-
kind: monaco.languages.CompletionItemKind.Property,
|
|
98
|
-
insertTextRules:
|
|
99
|
-
monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
100
|
-
insertText: "'resettable'",
|
|
101
|
-
documentation: {
|
|
102
|
-
value: ``,
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
type: 'action',
|
|
107
|
-
label: 'route',
|
|
108
|
-
detail: '路由跳转',
|
|
109
|
-
kind: monaco.languages.CompletionItemKind.Property,
|
|
110
|
-
insertTextRules:
|
|
111
|
-
monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
112
|
-
insertText:
|
|
113
|
-
'{\n type: "route",\n path: "${1:\u002Fcreate}",\n params: {\n "${2:mode}": "${3:create}"\n },\n},',
|
|
114
|
-
documentation: {
|
|
115
|
-
value: ``,
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
];
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export default monaco => [
|
|
2
|
-
{
|
|
3
|
-
type: 'dependency',
|
|
4
|
-
label: 'dependency',
|
|
5
|
-
detail: '级联插件',
|
|
6
|
-
kind: monaco.languages.CompletionItemKind.Property,
|
|
7
|
-
insertTextRules:
|
|
8
|
-
monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
9
|
-
insertText:
|
|
10
|
-
'dependency: {\n ${1:value}: {\n relates: ["${2:relateName}"],\n inputs: [["${3:relateValue}"]],\n output: ${4:"outputValue"},\n ignores: [[${5:"ignoreValue"}]],\n defaultOutput: ${6:"value"},\n },\n},',
|
|
11
|
-
documentation: {
|
|
12
|
-
value: `### 表单级联配置 [文档](https://doc.sula.now.sh/zh/plugin/form-dependency.html)
|
|
13
|
-
#### 可选value visible source disabled 配置
|
|
14
|
-
* **relates** 受哪项表单影响
|
|
15
|
-
* **inputs** relates数组对应的表单值
|
|
16
|
-
* **output** 匹配到inputs时 输出值
|
|
17
|
-
* **ignores** relates忽略的值
|
|
18
|
-
* **defaultOutput** 匹配ignores或未匹配到inputs时,输出值
|
|
19
|
-
`,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
];
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import dependency from './dependency';
|
|
2
|
-
import actions from './actions';
|
|
3
|
-
import request from './request';
|
|
4
|
-
|
|
5
|
-
function registerSuggestions(monaco) {
|
|
6
|
-
monaco.languages.registerCompletionItemProvider('javascript', {
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
provideCompletionItems(model, position) {
|
|
9
|
-
// 其他提示
|
|
10
|
-
return {
|
|
11
|
-
suggestions: [
|
|
12
|
-
...dependency(monaco),
|
|
13
|
-
...actions(monaco),
|
|
14
|
-
...request(monaco),
|
|
15
|
-
],
|
|
16
|
-
};
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default registerSuggestions;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
export default monaco => [
|
|
2
|
-
{
|
|
3
|
-
type: 'fetch',
|
|
4
|
-
label: 'remoteDataSource',
|
|
5
|
-
detail: '远程表单值',
|
|
6
|
-
kind: monaco.languages.CompletionItemKind.Property,
|
|
7
|
-
insertTextRules:
|
|
8
|
-
monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
9
|
-
insertText:
|
|
10
|
-
"remoteDataSource: {\n url: '${1:\u002Fsula.json}',\n method: '${2:GET}',\n params: {\n '${3:name}': '${4:sula}'\n },\n convertParams({ params }) {\n return params;\n },\n converter({ data }) {\n return data;\n },\n},",
|
|
11
|
-
documentation: {
|
|
12
|
-
value: `
|
|
13
|
-
属性名 | 描述 | 类型
|
|
14
|
-
---|:--:|---:
|
|
15
|
-
url | 请求地址 |string
|
|
16
|
-
method| 请求方法 |'post' 'get'
|
|
17
|
-
params | 请求参数 | object
|
|
18
|
-
convertParams | 请求参数转换方法 | (ctx, config) => params
|
|
19
|
-
converter | 返回参数转换方法 | (ctx, config) => any
|
|
20
|
-
`,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
type: 'fetch',
|
|
25
|
-
label: 'remoteSource',
|
|
26
|
-
detail: '远程数据源',
|
|
27
|
-
kind: monaco.languages.CompletionItemKind.Property,
|
|
28
|
-
insertTextRules:
|
|
29
|
-
monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
30
|
-
insertText:
|
|
31
|
-
"remoteSource: {\n url: '${1:\u002Fsula.json}',\n method: '${2:GET}',\n params: {\n '${3:name}': '${4:sula}'\n },\n convertParams({ params }) {\n return params\n },\n converter({ data }) {\n return data;\n },\n},",
|
|
32
|
-
documentation: {
|
|
33
|
-
value: `
|
|
34
|
-
属性名 | 描述 | 类型
|
|
35
|
-
---|:--:|---:
|
|
36
|
-
url | 请求地址 |string
|
|
37
|
-
method| 请求方法 |'post' 'get'
|
|
38
|
-
params | 请求参数 | object
|
|
39
|
-
convertParams | 请求参数转换方法 | (ctx, config) => params
|
|
40
|
-
converter | 返回参数转换方法 | (ctx, config) => any
|
|
41
|
-
`,
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
type: 'fetch',
|
|
46
|
-
label: 'remoteValues',
|
|
47
|
-
detail: '远程数据值',
|
|
48
|
-
kind: monaco.languages.CompletionItemKind.Property,
|
|
49
|
-
insertTextRules:
|
|
50
|
-
monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
51
|
-
insertText:
|
|
52
|
-
"remoteValues: {\n url: '${1:\u002Fsula.json}',\n method: '${2:GET}',\n params: {\n '${3:name}': '${4:sula}'\n },\n convertParams({ params }) {\n return params\n },\n converter({ data }) {\n return data;\n },\n},",
|
|
53
|
-
documentation: {
|
|
54
|
-
value: `
|
|
55
|
-
属性名 | 描述 | 类型
|
|
56
|
-
---|:--:|---:
|
|
57
|
-
url | 请求地址 |string
|
|
58
|
-
method| 请求方法 |'post' 'get'
|
|
59
|
-
params | 请求参数 | object
|
|
60
|
-
convertParams | 请求参数转换方法 | (ctx, config) => params
|
|
61
|
-
converter | 返回参数转换方法 | (ctx, config) => any
|
|
62
|
-
`,
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
];
|
package/src/utils/getFormMode.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const getFormMode = props => {
|
|
2
|
-
let mode = 'create';
|
|
3
|
-
const { path } = props.match;
|
|
4
|
-
if (path.includes('edit')) {
|
|
5
|
-
mode = 'edit';
|
|
6
|
-
} else if (path.includes('view') || path.includes('detail')) {
|
|
7
|
-
mode = 'view';
|
|
8
|
-
}
|
|
9
|
-
return mode;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export default getFormMode;
|