@steedos-widgets/amis-lib 3.6.2-beta.16 → 3.6.2-beta.18
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/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +68 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +68 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +19 -9
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -2128,7 +2128,7 @@ async function getTableColumns(fields, options){
|
|
|
2128
2128
|
var data = event.data;
|
|
2129
2129
|
var file_name = data.versions ? data.name : "${field.label}";
|
|
2130
2130
|
var file_id = data._id;
|
|
2131
|
-
|
|
2131
|
+
window.previewFile && window.previewFile({file_name, file_id});
|
|
2132
2132
|
`;
|
|
2133
2133
|
columnItem = {
|
|
2134
2134
|
"type": "button",
|
|
@@ -2157,7 +2157,7 @@ async function getTableColumns(fields, options){
|
|
|
2157
2157
|
"actionType": "custom",
|
|
2158
2158
|
"script": previewFileScript,
|
|
2159
2159
|
// "expression": "!!window?.nw?.require" //PC客户端预览附件
|
|
2160
|
-
"expression": "
|
|
2160
|
+
"expression": "!!(window && window.nw && window.nw.require)"//PC客户端预览附件
|
|
2161
2161
|
}
|
|
2162
2162
|
]
|
|
2163
2163
|
}
|
|
@@ -2940,6 +2940,18 @@ async function getTableApi(mainObject, fields, options){
|
|
|
2940
2940
|
return api;
|
|
2941
2941
|
`;
|
|
2942
2942
|
api.adaptor = `
|
|
2943
|
+
let fields = ${JSON.stringify(_$1.map(fields, 'name'))};
|
|
2944
|
+
// 这里把行数据中所有为空的字段值配置为空字符串,是因为amis有bug:crud的columns中的列如果type为static-前缀的话,行数据中该字段为空的话会显示为父作用域中同名变量值,见:https://github.com/baidu/amis/issues/9556
|
|
2945
|
+
(payload.data.rows || []).forEach((itemRow) => {
|
|
2946
|
+
(fields || []).forEach((itemField) => {
|
|
2947
|
+
if(itemField && (itemRow[itemField] === undefined || itemRow[itemField] === null)){
|
|
2948
|
+
// 这里itemRow中不存在 itemField 属性,或者值为null时都会有“显示为父作用域中的同名变量值”的问题,所以null和undefined都要重置为空字符串
|
|
2949
|
+
// 实测数字、下拉框、多选lookup等字段类型重置为空字符串都不会有问题,而且实测amis from组件的清空表单字段值功能就是把表单中的各种字段类型设置为空字符串,所以看起来也符合amis规范
|
|
2950
|
+
itemRow[itemField] = "";
|
|
2951
|
+
}
|
|
2952
|
+
});
|
|
2953
|
+
});
|
|
2954
|
+
|
|
2943
2955
|
if(api.body.listName == "recent"){
|
|
2944
2956
|
payload.data.rows = _.sortBy(payload.data.rows, function(item){
|
|
2945
2957
|
return _.indexOf(api.body._ids, item._id)
|
|
@@ -8331,7 +8343,6 @@ async function getObjectFilter(objectSchema, fields, options) {
|
|
|
8331
8343
|
"timeOut": 1000
|
|
8332
8344
|
}
|
|
8333
8345
|
});
|
|
8334
|
-
resizeWindow();
|
|
8335
8346
|
const scope = event.context.scoped;
|
|
8336
8347
|
// let filterFormValues = event.data;
|
|
8337
8348
|
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
@@ -8667,7 +8678,6 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8667
8678
|
payload.status = 2;
|
|
8668
8679
|
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
8669
8680
|
}
|
|
8670
|
-
debugger;
|
|
8671
8681
|
var scope = SteedosUI.getRef(context.scopeId);
|
|
8672
8682
|
var scopeParent = scope && scope.parent;
|
|
8673
8683
|
var crudScoped = scopeParent.getComponentById('${body.id}');
|
|
@@ -12195,13 +12205,31 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
12195
12205
|
};
|
|
12196
12206
|
break;
|
|
12197
12207
|
case 'input-datetime-range':
|
|
12208
|
+
// convertData = {
|
|
12209
|
+
// type: "input-datetime-range",
|
|
12210
|
+
// inputFormat: 'YYYY-MM-DD HH:mm',
|
|
12211
|
+
// format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
12212
|
+
// tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
|
|
12213
|
+
// utc: true,
|
|
12214
|
+
// joinValues: false
|
|
12215
|
+
// }
|
|
12216
|
+
// 日期时间字段,按日期方式展现显示控件,用户不用关心小时分钟
|
|
12198
12217
|
convertData = {
|
|
12199
|
-
type: "input-
|
|
12200
|
-
inputFormat:
|
|
12218
|
+
type: "input-date-range",
|
|
12219
|
+
inputFormat: "YYYY-MM-DD HH:mm",
|
|
12201
12220
|
format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
12202
12221
|
tpl: readonly ? getDateTimeTpl(field) : null,
|
|
12203
12222
|
utc: true,
|
|
12204
|
-
joinValues: false
|
|
12223
|
+
joinValues: false,
|
|
12224
|
+
"shortcuts": [
|
|
12225
|
+
"thismonth",
|
|
12226
|
+
"2monthsago",
|
|
12227
|
+
"3monthslater",
|
|
12228
|
+
"prevquarter",
|
|
12229
|
+
"thisquarter",
|
|
12230
|
+
"thisyear",
|
|
12231
|
+
"lastYear"
|
|
12232
|
+
]
|
|
12205
12233
|
};
|
|
12206
12234
|
break;
|
|
12207
12235
|
case 'datetime':
|
|
@@ -12383,6 +12411,36 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
12383
12411
|
convertData = {
|
|
12384
12412
|
type: 'static-text'
|
|
12385
12413
|
};
|
|
12414
|
+
}else if(field.autonumber_enable_modify){
|
|
12415
|
+
convertData = {
|
|
12416
|
+
"type": "input-group",
|
|
12417
|
+
"body": [
|
|
12418
|
+
{
|
|
12419
|
+
"type": "input-text",
|
|
12420
|
+
"name": field.name
|
|
12421
|
+
},
|
|
12422
|
+
{
|
|
12423
|
+
"type": "button",
|
|
12424
|
+
"label": "自动获取",
|
|
12425
|
+
"actionType": "ajax",
|
|
12426
|
+
"api": {
|
|
12427
|
+
"url": `\${context.rootUrl}/api/autonumber/generator/\${objectName}/${field.name}`,
|
|
12428
|
+
"method": "post",
|
|
12429
|
+
"headers": {
|
|
12430
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
12431
|
+
},
|
|
12432
|
+
"adaptor": `
|
|
12433
|
+
payload.data["${field.name}"] = payload.data && payload.data.autonumber;
|
|
12434
|
+
delete payload.data.autonumber;
|
|
12435
|
+
return payload;
|
|
12436
|
+
`
|
|
12437
|
+
},
|
|
12438
|
+
"messages": {
|
|
12439
|
+
"success": "获取成功"
|
|
12440
|
+
}
|
|
12441
|
+
}
|
|
12442
|
+
]
|
|
12443
|
+
};
|
|
12386
12444
|
}
|
|
12387
12445
|
break;
|
|
12388
12446
|
case 'url':
|
|
@@ -12688,8 +12746,9 @@ async function getFieldSearchable(perField, permissionFields, ctx){
|
|
|
12688
12746
|
fieldNamePrefix = `${fieldNamePrefix}between__`;
|
|
12689
12747
|
}
|
|
12690
12748
|
if(_field.type === 'datetime'){
|
|
12691
|
-
//
|
|
12692
|
-
|
|
12749
|
+
// 这里如果想把搜索范围展示效果改为日期范围,不可以直接改为input-date-range,因为它们规则不一样,包括时区规则和小时分秒的存值规则都不一样
|
|
12750
|
+
// 所以想改为展示日期范围效果,只能改input-datetime-range类型本身的属性来实现
|
|
12751
|
+
_field.type = 'input-datetime-range';
|
|
12693
12752
|
_field.is_wide = true;
|
|
12694
12753
|
fieldNamePrefix = `${fieldNamePrefix}between__`;
|
|
12695
12754
|
}
|