@steedos-widgets/sortable 6.3.0-beta.5 → 6.3.0-beta.6

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.
@@ -59566,7 +59566,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
59566
59566
  });
59567
59567
 
59568
59568
  // 把自动填充规则中依赖的字段也加到api请求中
59569
- let autoFillMapping = !field.multiple && field.auto_fill_mapping;
59569
+ let autoFillMapping = field.auto_fill_mapping;
59570
59570
  if (autoFillMapping && autoFillMapping.length) {
59571
59571
  autoFillMapping.forEach(function (item) {
59572
59572
  if(!lodash.exports.find(tableFields, function(f){
@@ -60038,7 +60038,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
60038
60038
  ];
60039
60039
 
60040
60040
  // 把自动填充规则中依赖的字段也加到api请求中
60041
- let autoFillMapping = !field.multiple && field.auto_fill_mapping;
60041
+ let autoFillMapping = field.auto_fill_mapping;
60042
60042
  if (autoFillMapping && autoFillMapping.length) {
60043
60043
  autoFillMapping.forEach(function (item) {
60044
60044
  queryFields.push(refObjectConfig.fields[item.from]);
@@ -60280,14 +60280,25 @@ async function getApi(object, recordId, fields, options){
60280
60280
  }
60281
60281
 
60282
60282
  async function getAutoFill(field, refObject) {
60283
- let autoFillMapping = !field.multiple && field.auto_fill_mapping;
60283
+ let autoFillMapping = field.auto_fill_mapping;
60284
60284
  if (autoFillMapping && autoFillMapping.length) {
60285
60285
  let fillMapping = {};
60286
+ if (field.multiple) {
60287
+ autoFillMapping.forEach(function (item) {
60288
+ //from的字段类型为lookup、master_detail、select时,需要保留数组格式;其他类型需要转变为字符串格式
60289
+ if (lodash.exports.includes(["lookup","master_detail","select"], refObject.fields[item.from].type)) {
60290
+ fillMapping[item.to] = `\${items | pick:${item.from}}`;
60291
+ } else {
60292
+ fillMapping[item.to] = `\${items | pick:${item.from} | join}`;
60293
+ }
60294
+ });
60295
+ }else {
60296
+ autoFillMapping.forEach(function (item) {
60297
+ fillMapping[item.to] = `\${${item.from}}`;
60298
+ });
60299
+ }
60286
60300
  // let fieldsForApi = [];
60287
- autoFillMapping.forEach(function (item) {
60288
- fillMapping[item.to] = `\${${item.from}}`;
60289
- // fieldsForApi.push(item.from);
60290
- });
60301
+ // fieldsForApi.push(item.from);
60291
60302
  // let api = {
60292
60303
  // // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
60293
60304
  // "url": `/api/v1/${refObject.name}/\${${field.name}}?fields=${JSON.stringify(fieldsForApi)}`,
@@ -60389,7 +60400,7 @@ async function lookupToAmis(field, readonly, ctx){
60389
60400
  amisSchema = lodash.exports.defaultsDeep({}, pageAmisSchema, amisSchema);
60390
60401
  }
60391
60402
  }
60392
- const autoFill = await getAutoFill(field);
60403
+ const autoFill = await getAutoFill(field, refObject);
60393
60404
  if(autoFill){
60394
60405
  amisSchema.autoFill = autoFill;
60395
60406
  // 这里不配置initAutoFill值,按amis规则initAutoFill默认值为fillIfNotSet处理--需要amis sdk 版本 > 3.6.3-patch.6(不包括)版本