@steedos-widgets/amis-lib 6.3.13-beta.7 → 6.3.13-beta.9
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 +14 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +14 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +4 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -3596,6 +3596,11 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3596
3596
|
objectName: "${object.name}",
|
|
3597
3597
|
recordId: record._id
|
|
3598
3598
|
}
|
|
3599
|
+
if(window.location.pathname.endsWith("/"+record._id)){
|
|
3600
|
+
payload.data.mainRecord= {
|
|
3601
|
+
record
|
|
3602
|
+
};
|
|
3603
|
+
}
|
|
3599
3604
|
window.postMessage(Object.assign({type: "record.loaded"}, {record: record}), "*")
|
|
3600
3605
|
}
|
|
3601
3606
|
if(payload.errors){
|
|
@@ -5093,6 +5098,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
5093
5098
|
: page.schema;
|
|
5094
5099
|
}
|
|
5095
5100
|
|
|
5101
|
+
// console.log('formSchema====>', formSchema);
|
|
5096
5102
|
|
|
5097
5103
|
return {
|
|
5098
5104
|
type: "service",
|
|
@@ -5117,7 +5123,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
5117
5123
|
showCloseButton: true,
|
|
5118
5124
|
"data": {
|
|
5119
5125
|
"&": "$$",
|
|
5120
|
-
"_master": "${
|
|
5126
|
+
"_master": "${mainRecord}",
|
|
5121
5127
|
"_master._isRelated": "${_isRelated}",
|
|
5122
5128
|
"_master.relatedKey": "${relatedKey}"
|
|
5123
5129
|
},
|
|
@@ -12507,7 +12513,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12507
12513
|
{
|
|
12508
12514
|
"actionType": "custom",
|
|
12509
12515
|
"script": `
|
|
12510
|
-
|
|
12516
|
+
// lookup字段弹出列表,点击新建按钮,新建记录成功后,触发@data.changed.xxx,
|
|
12517
|
+
// 此时context.props.data值是lookup字段所在表单数据,经测试多层lookup弹出列表新建记录成功后context.props.data始终取的是最近一层的lookup字段所在表单数据,符合预期
|
|
12518
|
+
const masterRecord = context.props.data;//event.data._master && event.data._master.record;
|
|
12511
12519
|
const fieldConfig = ${JSON.stringify(field)};
|
|
12512
12520
|
let reference_to = fieldConfig.reference_to;
|
|
12513
12521
|
let saveValue;
|
|
@@ -12517,7 +12525,6 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12517
12525
|
}
|
|
12518
12526
|
const saveField = fieldConfig.reference_to_field || '_id';
|
|
12519
12527
|
const saveFieldValue = newRecord[saveField];
|
|
12520
|
-
|
|
12521
12528
|
if( fieldConfig._reference_to && (_.isArray(fieldConfig._reference_to) || _.isFunction(fieldConfig._reference_to) || fieldConfig._reference_to.startsWith('function') ) ){
|
|
12522
12529
|
|
|
12523
12530
|
const fieldValue = masterRecord ? masterRecord[fieldConfig.name] : {o: reference_to, ids: []};
|
|
@@ -12537,8 +12544,10 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12537
12544
|
|
|
12538
12545
|
}else{
|
|
12539
12546
|
if(fieldConfig.multiple){
|
|
12540
|
-
//
|
|
12541
|
-
|
|
12547
|
+
// const fieldValue = (masterRecord && masterRecord[fieldConfig.name]) || [];
|
|
12548
|
+
// 连续新建多个记录时,因为masterRecord获取的主记录不是实时的,所以只会勾选最后一个新建的记录
|
|
12549
|
+
// 而下面context.context.component指向的是lookup picker组件,可以直接取到用户实时勾选的记录。
|
|
12550
|
+
const fieldValue = context.context.component.props.store.toJSON().selectedItems
|
|
12542
12551
|
saveValue = fieldValue.concat(saveFieldValue);
|
|
12543
12552
|
}else{
|
|
12544
12553
|
saveValue = saveFieldValue;
|