@steedos-widgets/amis-lib 6.3.12 → 6.3.13-beta.10
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 +28 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +28 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +8 -7
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -2536,6 +2536,7 @@ async function getTableColumns(object, fields, options){
|
|
|
2536
2536
|
type: "lookup",
|
|
2537
2537
|
reference_to: field.reference_to,
|
|
2538
2538
|
name: field.name,
|
|
2539
|
+
is_name: field.is_name,
|
|
2539
2540
|
label: null,
|
|
2540
2541
|
multiple: field.multiple,
|
|
2541
2542
|
amis: Object.assign({}, fieldAmis, { label: null })
|
|
@@ -3304,6 +3305,16 @@ async function getTableApi(mainObject, fields, options){
|
|
|
3304
3305
|
return api;
|
|
3305
3306
|
`;
|
|
3306
3307
|
api.adaptor = `
|
|
3308
|
+
|
|
3309
|
+
if(payload.errors && payload.errors.length > 0){
|
|
3310
|
+
return {
|
|
3311
|
+
status: 500,
|
|
3312
|
+
msg: payload.errors[0].message,
|
|
3313
|
+
data: {}
|
|
3314
|
+
}
|
|
3315
|
+
}
|
|
3316
|
+
|
|
3317
|
+
|
|
3307
3318
|
let fields = ${JSON.stringify(_$1.map(fields, 'name'))};
|
|
3308
3319
|
// 这里把行数据中所有为空的字段值配置为空字符串,是因为amis有bug:crud的columns中的列如果type为static-前缀的话,行数据中该字段为空的话会显示为父作用域中同名变量值,见:https://github.com/baidu/amis/issues/9556
|
|
3309
3320
|
(payload.data.rows || []).forEach((itemRow) => {
|
|
@@ -3549,7 +3560,7 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3549
3560
|
nameLabel = `(record._display && record._display.${nameField.name}) || record.${nameField.name}`;
|
|
3550
3561
|
}
|
|
3551
3562
|
return `
|
|
3552
|
-
if(payload.data.data.length === 0){
|
|
3563
|
+
if(!payload.data.data || payload.data.data.length === 0){
|
|
3553
3564
|
var isEditor = !!${options && options.isEditor};
|
|
3554
3565
|
if(isEditor){
|
|
3555
3566
|
var fieldNames = ${JSON.stringify(fieldNames)};
|
|
@@ -3595,6 +3606,11 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3595
3606
|
objectName: "${object.name}",
|
|
3596
3607
|
recordId: record._id
|
|
3597
3608
|
}
|
|
3609
|
+
if(window.location.pathname.endsWith("/"+record._id)){
|
|
3610
|
+
payload.data.mainRecord= {
|
|
3611
|
+
record
|
|
3612
|
+
};
|
|
3613
|
+
}
|
|
3598
3614
|
window.postMessage(Object.assign({type: "record.loaded"}, {record: record}), "*")
|
|
3599
3615
|
}
|
|
3600
3616
|
if(payload.errors){
|
|
@@ -5092,6 +5108,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
5092
5108
|
: page.schema;
|
|
5093
5109
|
}
|
|
5094
5110
|
|
|
5111
|
+
// console.log('formSchema====>', formSchema);
|
|
5095
5112
|
|
|
5096
5113
|
return {
|
|
5097
5114
|
type: "service",
|
|
@@ -5116,7 +5133,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
5116
5133
|
showCloseButton: true,
|
|
5117
5134
|
"data": {
|
|
5118
5135
|
"&": "$$",
|
|
5119
|
-
"_master": "${
|
|
5136
|
+
"_master": "${mainRecord}",
|
|
5120
5137
|
"_master._isRelated": "${_isRelated}",
|
|
5121
5138
|
"_master.relatedKey": "${relatedKey}"
|
|
5122
5139
|
},
|
|
@@ -10570,7 +10587,7 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
|
|
|
10570
10587
|
* @Author: baozhoutao@steedos.com
|
|
10571
10588
|
* @Date: 2022-07-05 15:55:39
|
|
10572
10589
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
10573
|
-
* @LastEditTime:
|
|
10590
|
+
* @LastEditTime: 2025-05-20 16:56:55
|
|
10574
10591
|
* @Description:
|
|
10575
10592
|
*/
|
|
10576
10593
|
|
|
@@ -10869,7 +10886,7 @@ async function getListSchema(
|
|
|
10869
10886
|
}
|
|
10870
10887
|
|
|
10871
10888
|
if (window.innerWidth > 768) {
|
|
10872
|
-
// 列表视图组件PC端高度自动计算实现满屏效果,手机端不需要满屏效果,所以不用autofillheight
|
|
10889
|
+
// 列表视图组件PC端高度自动计算实现满屏效果,手机端不需要满屏效果,所以不用autofillheight,且允许微页面中重写组件autoFillHeight属性
|
|
10873
10890
|
defaults.listSchema = defaultsDeep$1({}, defaults.listSchema || {}, {
|
|
10874
10891
|
autoFillHeight: true
|
|
10875
10892
|
});
|
|
@@ -12506,7 +12523,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12506
12523
|
{
|
|
12507
12524
|
"actionType": "custom",
|
|
12508
12525
|
"script": `
|
|
12509
|
-
|
|
12526
|
+
// lookup字段弹出列表,点击新建按钮,新建记录成功后,触发@data.changed.xxx,
|
|
12527
|
+
// 此时context.props.data值是lookup字段所在表单数据,经测试多层lookup弹出列表新建记录成功后context.props.data始终取的是最近一层的lookup字段所在表单数据,符合预期
|
|
12528
|
+
const masterRecord = context.props.data;//event.data._master && event.data._master.record;
|
|
12510
12529
|
const fieldConfig = ${JSON.stringify(field)};
|
|
12511
12530
|
let reference_to = fieldConfig.reference_to;
|
|
12512
12531
|
let saveValue;
|
|
@@ -12516,7 +12535,6 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12516
12535
|
}
|
|
12517
12536
|
const saveField = fieldConfig.reference_to_field || '_id';
|
|
12518
12537
|
const saveFieldValue = newRecord[saveField];
|
|
12519
|
-
|
|
12520
12538
|
if( fieldConfig._reference_to && (_.isArray(fieldConfig._reference_to) || _.isFunction(fieldConfig._reference_to) || fieldConfig._reference_to.startsWith('function') ) ){
|
|
12521
12539
|
|
|
12522
12540
|
const fieldValue = masterRecord ? masterRecord[fieldConfig.name] : {o: reference_to, ids: []};
|
|
@@ -12536,8 +12554,10 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12536
12554
|
|
|
12537
12555
|
}else{
|
|
12538
12556
|
if(fieldConfig.multiple){
|
|
12539
|
-
//
|
|
12540
|
-
|
|
12557
|
+
// const fieldValue = (masterRecord && masterRecord[fieldConfig.name]) || [];
|
|
12558
|
+
// 连续新建多个记录时,因为masterRecord获取的主记录不是实时的,所以只会勾选最后一个新建的记录
|
|
12559
|
+
// 而下面context.context.component指向的是lookup picker组件,可以直接取到用户实时勾选的记录。
|
|
12560
|
+
const fieldValue = context.context.component.props.store.toJSON().selectedItems
|
|
12541
12561
|
saveValue = fieldValue.concat(saveFieldValue);
|
|
12542
12562
|
}else{
|
|
12543
12563
|
saveValue = saveFieldValue;
|