@steedos-widgets/sortable 6.3.0-beta.5 → 6.3.0-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.
@@ -25871,7 +25871,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25871
25871
  });
25872
25872
 
25873
25873
  // 把自动填充规则中依赖的字段也加到api请求中
25874
- let autoFillMapping = !field.multiple && field.auto_fill_mapping;
25874
+ let autoFillMapping = field.auto_fill_mapping;
25875
25875
  if (autoFillMapping && autoFillMapping.length) {
25876
25876
  autoFillMapping.forEach(function (item) {
25877
25877
  if(!lodash.exports.find(tableFields, function(f){
@@ -26343,7 +26343,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
26343
26343
  ];
26344
26344
 
26345
26345
  // 把自动填充规则中依赖的字段也加到api请求中
26346
- let autoFillMapping = !field.multiple && field.auto_fill_mapping;
26346
+ let autoFillMapping = field.auto_fill_mapping;
26347
26347
  if (autoFillMapping && autoFillMapping.length) {
26348
26348
  autoFillMapping.forEach(function (item) {
26349
26349
  queryFields.push(refObjectConfig.fields[item.from]);
@@ -26483,7 +26483,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
26483
26483
  var optionsFilters = [["${valueFieldKey}", optionsFiltersOp, []]];
26484
26484
  if (defaultValue && !api.data.$term) {
26485
26485
  const defaultValueOptionsQueryData = ${JSON.stringify(defaultValueOptionsQueryData)};
26486
- const defaultValueOptionsQuery = defaultValueOptionsQueryData?.query?.replace(/^{/,"").replace(/}$/,"");
26486
+ const defaultValueOptionsQuery = defaultValueOptionsQueryData && defaultValueOptionsQueryData.query && defaultValueOptionsQueryData.query.replace(/^{/,"").replace(/}$/,"");
26487
26487
  // 字段值单独请求,没值的时候在请求中返回空
26488
26488
  optionsFilters = [["${valueFieldKey}", optionsFiltersOp, defaultValue]];
26489
26489
  if(filters.length > 0){
@@ -26585,14 +26585,25 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
26585
26585
  }
26586
26586
 
26587
26587
  async function getAutoFill(field, refObject) {
26588
- let autoFillMapping = !field.multiple && field.auto_fill_mapping;
26588
+ let autoFillMapping = field.auto_fill_mapping;
26589
26589
  if (autoFillMapping && autoFillMapping.length) {
26590
26590
  let fillMapping = {};
26591
+ if (field.multiple) {
26592
+ autoFillMapping.forEach(function (item) {
26593
+ //from的字段类型为lookup、master_detail、select时,需要保留数组格式;其他类型需要转变为字符串格式
26594
+ if (lodash.exports.includes(["lookup","master_detail","select"], refObject.fields[item.from].type)) {
26595
+ fillMapping[item.to] = `\${items | pick:${item.from}}`;
26596
+ } else {
26597
+ fillMapping[item.to] = `\${items | pick:${item.from} | join}`;
26598
+ }
26599
+ });
26600
+ }else {
26601
+ autoFillMapping.forEach(function (item) {
26602
+ fillMapping[item.to] = `\${${item.from}}`;
26603
+ });
26604
+ }
26591
26605
  // let fieldsForApi = [];
26592
- autoFillMapping.forEach(function (item) {
26593
- fillMapping[item.to] = `\${${item.from}}`;
26594
- // fieldsForApi.push(item.from);
26595
- });
26606
+ // fieldsForApi.push(item.from);
26596
26607
  // let api = {
26597
26608
  // // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
26598
26609
  // "url": `/api/v1/${refObject.name}/\${${field.name}}?fields=${JSON.stringify(fieldsForApi)}`,
@@ -26694,7 +26705,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
26694
26705
  amisSchema = lodash.exports.defaultsDeep({}, pageAmisSchema, amisSchema);
26695
26706
  }
26696
26707
  }
26697
- const autoFill = await getAutoFill(field);
26708
+ const autoFill = await getAutoFill(field, refObject);
26698
26709
  if(autoFill){
26699
26710
  amisSchema.autoFill = autoFill;
26700
26711
  // 这里不配置initAutoFill值,按amis规则initAutoFill默认值为fillIfNotSet处理--需要amis sdk 版本 > 3.6.3-patch.6(不包括)版本
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos-widgets/sortable",
3
- "version": "6.3.0-beta.5",
3
+ "version": "6.3.0-beta.7",
4
4
  "main": "dist/sortable.cjs.js",
5
5
  "module": "dist/sortable.esm.js",
6
6
  "unpkg": "dist/sortable.umd.js",
@@ -45,7 +45,7 @@
45
45
  "dependencies": {
46
46
  "@dnd-kit/core": "^6.0.5",
47
47
  "@dnd-kit/sortable": "^7.0.1",
48
- "@steedos-widgets/amis-lib": "6.3.0-beta.5"
48
+ "@steedos-widgets/amis-lib": "6.3.0-beta.7"
49
49
  },
50
- "gitHead": "008b005e5116225ad4188e769bdc5633cbdeb7d7"
50
+ "gitHead": "2c8f17e15b18b910c9bb48ce1ca68ffb2e171d78"
51
51
  }