@steedos/service-plugin-amis 2.2.51-beta.4 → 2.2.51-beta.7
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.
|
@@ -18,9 +18,32 @@
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
try {
|
|
21
|
+
window['attrAccept'] = function (file, acceptedFiles) {
|
|
22
|
+
if (file && acceptedFiles) {
|
|
23
|
+
var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(',');
|
|
24
|
+
var fileName = file.name || '';
|
|
25
|
+
var mimeType = (file.type || '').toLowerCase();
|
|
26
|
+
var baseMimeType = mimeType.replace(/\/.*$/, '');
|
|
27
|
+
return acceptedFilesArray.some(function (type) {
|
|
28
|
+
var validType = type.trim().toLowerCase();
|
|
29
|
+
|
|
30
|
+
if (validType.charAt(0) === '.') {
|
|
31
|
+
return fileName.toLowerCase().endsWith(validType);
|
|
32
|
+
} else if (validType.endsWith('/*')) {
|
|
33
|
+
// This is something like a image/* mime type
|
|
34
|
+
return baseMimeType === validType.replace(/\/.*$/, '');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return mimeType === validType;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
|
|
21
44
|
// 加载Amis SDK: 如果直接放到body中会导致meteor 编译后的 cordova.js 加载报错
|
|
22
45
|
let amisSDKScript = document.createElement("script");
|
|
23
|
-
amisSDKScript.setAttribute("src", Steedos.absoluteUrl('/unpkg.com/@steedos-ui/amis/dist/amis-sdk.umd.min.js'));
|
|
46
|
+
amisSDKScript.setAttribute("src", Steedos.absoluteUrl('/unpkg.com/@steedos-ui/amis@2.2.26/dist/amis-sdk.umd.min.js'));
|
|
24
47
|
document.getElementsByTagName("head")[0].appendChild(amisSDKScript);
|
|
25
48
|
} catch (error) {
|
|
26
49
|
console.error(error)
|
|
@@ -288,6 +288,21 @@ module.exports = {
|
|
|
288
288
|
operators: getFieldOperators(field.type)
|
|
289
289
|
});
|
|
290
290
|
break;
|
|
291
|
+
case 'boolean':
|
|
292
|
+
case 'toggle':
|
|
293
|
+
fields.push({
|
|
294
|
+
label: field.label,
|
|
295
|
+
type: "select",
|
|
296
|
+
name: field.name,
|
|
297
|
+
options: [
|
|
298
|
+
{label: "是", value: true},
|
|
299
|
+
{label: "否", value: false}
|
|
300
|
+
],
|
|
301
|
+
operators: [
|
|
302
|
+
"equal",
|
|
303
|
+
"not_equal"
|
|
304
|
+
]
|
|
305
|
+
});
|
|
291
306
|
default:
|
|
292
307
|
break;
|
|
293
308
|
}
|
|
@@ -49,7 +49,16 @@ function lookupToAmisPicker(field, readonly){
|
|
|
49
49
|
const tableFields = [referenceTo.valueField];
|
|
50
50
|
let i = 0;
|
|
51
51
|
const searchableFields = [];
|
|
52
|
-
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
const fieldsArr = [];
|
|
55
|
+
_.each(refObjectConfig.fields , (field, field_name)=>{
|
|
56
|
+
if(!_.has(field, "name")){
|
|
57
|
+
field.name = field_name
|
|
58
|
+
}
|
|
59
|
+
fieldsArr.push(field)
|
|
60
|
+
})
|
|
61
|
+
_.each(_.sortBy(fieldsArr, "sort_no"),function(field){
|
|
53
62
|
if(i < 5){
|
|
54
63
|
if(!_.find(tableFields, function(f){
|
|
55
64
|
return f.name === field.name
|
|
@@ -69,7 +78,9 @@ function lookupToAmisPicker(field, readonly){
|
|
|
69
78
|
};
|
|
70
79
|
|
|
71
80
|
_.each(tableFields, (tableField)=>{
|
|
72
|
-
|
|
81
|
+
if(!tableField.hidden){
|
|
82
|
+
fields[tableField.name] = tableField;
|
|
83
|
+
}
|
|
73
84
|
});
|
|
74
85
|
|
|
75
86
|
const source = getApi({
|
|
@@ -121,7 +132,8 @@ function lookupToAmisPicker(field, readonly){
|
|
|
121
132
|
pickerSchema: Table.getTableSchema(tableFields, {
|
|
122
133
|
top: top
|
|
123
134
|
}),
|
|
124
|
-
joinValues: false
|
|
135
|
+
joinValues: false,
|
|
136
|
+
extractValue: true
|
|
125
137
|
}
|
|
126
138
|
if(field.multiple){
|
|
127
139
|
data.multiple = true
|
|
@@ -213,7 +225,7 @@ function getApi(object, recordId, fields, options){
|
|
|
213
225
|
return {
|
|
214
226
|
method: "post",
|
|
215
227
|
url: graphql.getApi(),
|
|
216
|
-
data: graphql.getFindQuery(object, recordId, fields, Object.assign(options, {expand:
|
|
228
|
+
data: graphql.getFindQuery(object, recordId, fields, Object.assign(options, {expand: true}))
|
|
217
229
|
}
|
|
218
230
|
}
|
|
219
231
|
|
|
@@ -33,7 +33,7 @@ function getOperation(fields){
|
|
|
33
33
|
function getDetailColumn(){}
|
|
34
34
|
|
|
35
35
|
function getTableColumns(fields){
|
|
36
|
-
const columns = [{name: '_index',type: 'text', width: 32}];
|
|
36
|
+
const columns = [{name: '_index',type: 'text', width: 32, placeholder: ""}];
|
|
37
37
|
_.each(fields, function(field){
|
|
38
38
|
|
|
39
39
|
const tpl = Tpl.getFieldTpl(field);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-plugin-amis",
|
|
3
|
-
"version": "2.2.51-beta.
|
|
3
|
+
"version": "2.2.51-beta.7",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"scripts": {},
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public"
|
|
10
10
|
},
|
|
11
|
-
"gitHead": "
|
|
11
|
+
"gitHead": "d8dbf833dff1292793a80dd01c2df6f76c26f5af"
|
|
12
12
|
}
|