@steedos-widgets/amis-lib 6.3.0-beta.4 → 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.
package/dist/index.esm.js CHANGED
@@ -9079,6 +9079,10 @@ async function getFormSchemaWithDataFilter(form, options = {}){
9079
9079
  async function getObjectForm(objectSchema, ctx){
9080
9080
  const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign, tabId, appId, defaults, submitSuccActions = [],
9081
9081
  formDataFilter, onFormDataFilter, amisData, env } = ctx;
9082
+ //优先识别组件上的enableTabs属性,若不存在,则识别对象上定义的
9083
+ if (typeof ctx.enableTabs !== 'boolean') {
9084
+ ctx.enableTabs = objectSchema.enable_form_tabs;
9085
+ }
9082
9086
  const fields = ___default.values(objectSchema.fields);
9083
9087
  const formFields = getFormFields$1(objectSchema, ctx);
9084
9088
  const formSchema = defaults && defaults.formSchema || {};
@@ -9740,7 +9744,7 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
9740
9744
  * @Author: baozhoutao@steedos.com
9741
9745
  * @Date: 2022-07-05 15:55:39
9742
9746
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
9743
- * @LastEditTime: 2024-04-25 19:01:52
9747
+ * @LastEditTime: 2024-04-26 16:46:44
9744
9748
  * @Description:
9745
9749
  */
9746
9750
 
@@ -10031,10 +10035,6 @@ async function getListSchema(
10031
10035
  if (localListViewProps.perPage) {
10032
10036
  listSchema.perPage = localListViewProps.perPage;
10033
10037
  }
10034
- if (window.innerWidth > 768) {
10035
- // 列表视图组件PC端高度自动计算实现满屏效果,手机端不需要满屏效果,所以不用autofillheight
10036
- listSchema.autoFillHeight = true;
10037
- }
10038
10038
  defaults.listSchema = defaultsDeep$1({}, listSchema, defaults.listSchema || {});
10039
10039
  }
10040
10040
  }
@@ -10042,6 +10042,13 @@ async function getListSchema(
10042
10042
  console.error("本地存储中crud参数解析异常:", ex);
10043
10043
  }
10044
10044
 
10045
+ if (window.innerWidth > 768) {
10046
+ // 列表视图组件PC端高度自动计算实现满屏效果,手机端不需要满屏效果,所以不用autofillheight,且允许重写微页面中重新组件autoFillHeight属性
10047
+ defaults.listSchema = defaultsDeep$1({}, defaults.listSchema || {}, {
10048
+ autoFillHeight: true
10049
+ });
10050
+ }
10051
+
10045
10052
  ctx.defaults = defaults;
10046
10053
 
10047
10054
  if (listViewName == "recent") {
@@ -11238,7 +11245,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
11238
11245
  });
11239
11246
 
11240
11247
  // 把自动填充规则中依赖的字段也加到api请求中
11241
- let autoFillMapping = !field.multiple && field.auto_fill_mapping;
11248
+ let autoFillMapping = field.auto_fill_mapping;
11242
11249
  if (autoFillMapping && autoFillMapping.length) {
11243
11250
  autoFillMapping.forEach(function (item) {
11244
11251
  if(!_$1.find(tableFields, function(f){
@@ -11710,7 +11717,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
11710
11717
  ];
11711
11718
 
11712
11719
  // 把自动填充规则中依赖的字段也加到api请求中
11713
- let autoFillMapping = !field.multiple && field.auto_fill_mapping;
11720
+ let autoFillMapping = field.auto_fill_mapping;
11714
11721
  if (autoFillMapping && autoFillMapping.length) {
11715
11722
  autoFillMapping.forEach(function (item) {
11716
11723
  queryFields.push(refObjectConfig.fields[item.from]);
@@ -11952,14 +11959,25 @@ async function getApi(object, recordId, fields, options){
11952
11959
  }
11953
11960
 
11954
11961
  async function getAutoFill(field, refObject) {
11955
- let autoFillMapping = !field.multiple && field.auto_fill_mapping;
11962
+ let autoFillMapping = field.auto_fill_mapping;
11956
11963
  if (autoFillMapping && autoFillMapping.length) {
11957
11964
  let fillMapping = {};
11965
+ if (field.multiple) {
11966
+ autoFillMapping.forEach(function (item) {
11967
+ //from的字段类型为lookup、master_detail、select时,需要保留数组格式;其他类型需要转变为字符串格式
11968
+ if (_$1.includes(["lookup","master_detail","select"], refObject.fields[item.from].type)) {
11969
+ fillMapping[item.to] = `\${items | pick:${item.from}}`;
11970
+ } else {
11971
+ fillMapping[item.to] = `\${items | pick:${item.from} | join}`;
11972
+ }
11973
+ });
11974
+ }else {
11975
+ autoFillMapping.forEach(function (item) {
11976
+ fillMapping[item.to] = `\${${item.from}}`;
11977
+ });
11978
+ }
11958
11979
  // let fieldsForApi = [];
11959
- autoFillMapping.forEach(function (item) {
11960
- fillMapping[item.to] = `\${${item.from}}`;
11961
- // fieldsForApi.push(item.from);
11962
- });
11980
+ // fieldsForApi.push(item.from);
11963
11981
  // let api = {
11964
11982
  // // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
11965
11983
  // "url": `/api/v1/${refObject.name}/\${${field.name}}?fields=${JSON.stringify(fieldsForApi)}`,
@@ -12061,7 +12079,7 @@ async function lookupToAmis(field, readonly, ctx){
12061
12079
  amisSchema = _$1.defaultsDeep({}, pageAmisSchema, amisSchema);
12062
12080
  }
12063
12081
  }
12064
- const autoFill = await getAutoFill(field);
12082
+ const autoFill = await getAutoFill(field, refObject);
12065
12083
  if(autoFill){
12066
12084
  amisSchema.autoFill = autoFill;
12067
12085
  // 这里不配置initAutoFill值,按amis规则initAutoFill默认值为fillIfNotSet处理--需要amis sdk 版本 > 3.6.3-patch.6(不包括)版本