@steedos-widgets/amis-lib 6.10.1-beta.11 → 6.10.1-beta.13

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
@@ -577,9 +577,6 @@ function getSelectMap(selectOptions){
577
577
  }
578
578
 
579
579
  function getNameTplUrl(field, ctx){
580
- // if(ctx.objectName === 'cms_files'){
581
- // return "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}"
582
- // }
583
580
  const href = Router.getObjectDetailPath({
584
581
  ...ctx, formFactor: ctx.formFactor, appId: "${appId}", objectName: ctx.objectName || "${objectName}", recordId: `\${${ctx.idFieldName}}`
585
582
  });
@@ -3074,10 +3071,10 @@ async function getTableApi(mainObject, fields, options){
3074
3071
  let valueField = mainObject.key_field || '_id';
3075
3072
  const api = await getApi$1(mainObject, null, fields, {count: options.queryCount, alias: 'rows', limit: top, queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
3076
3073
 
3077
- api.url += "&objectName=${objectName}";//设计器上对象表格组件需要切换对象重新请求列表数据
3078
- if(options.isRelated){
3079
- api.url += "&recordId=${_master.recordId}";
3080
- }
3074
+ api.url;//设计器上对象表格组件需要切换对象重新请求列表数据
3075
+ // if(options.isRelated){
3076
+ // api.url += "&recordId=${_master.recordId}";
3077
+ // }
3081
3078
  api.cache = 3000;
3082
3079
  api.data.$term = "$term";
3083
3080
  api.data.term = "$term";
@@ -3463,7 +3460,7 @@ function getReadonlyFormAdaptor(object, fields, options){
3463
3460
  }
3464
3461
  if(field.multiple){
3465
3462
  scriptStr = scriptStr + `data.${field.name}__label = _.map(_.filter(${field.name}Options, function(option){return _.includes(data.${field.name}, option.value)}), 'label');`;
3466
- }else {
3463
+ }else if(scriptStr != ''){
3467
3464
  scriptStr = scriptStr + `var ${field.name}Selected = _.find(${field.name}Options, function(option){return data.${field.name} == option.value});`;
3468
3465
  scriptStr = scriptStr + `data.${field.name}__label = ${field.name}Selected ? ${field.name}Selected.label:null;`;
3469
3466
  }
@@ -3569,7 +3566,7 @@ async function getReadonlyFormInitApi(object, recordId, fields, options){
3569
3566
  }
3570
3567
  return {
3571
3568
  method: "post",
3572
- url: getApi$2() + '&objectName=${objectName}' + "&recordId=${recordId}",
3569
+ url: getApi$2(),
3573
3570
  cache: API_CACHE,
3574
3571
  requestAdaptor: `
3575
3572
  ${options && options.initApiRequestAdaptor || ''}
@@ -3660,7 +3657,7 @@ function getScriptForRewriteValueForFileFields(fields){
3660
3657
  return {
3661
3658
  value: fileFieldValue[index],
3662
3659
  name: item.name,
3663
- url: item.url + "?download=true",
3660
+ url: item.url,
3664
3661
  state: "uploaded"
3665
3662
  }
3666
3663
  });
@@ -3670,7 +3667,7 @@ function getScriptForRewriteValueForFileFields(fields){
3670
3667
  data[item] = [{
3671
3668
  value: fileFieldValue,
3672
3669
  name: fileFieldDisplayValue.name,
3673
- url: fileFieldDisplayValue.url + "?download=true",
3670
+ url: fileFieldDisplayValue.url,
3674
3671
  state: "uploaded"
3675
3672
  }];
3676
3673
  }
@@ -3691,7 +3688,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
3691
3688
 
3692
3689
  return {
3693
3690
  method: "post",
3694
- url: getApi$2() + '&objectName=${objectName}' + "&recordId=${recordId}",
3691
+ url: getApi$2(),
3695
3692
  // sendOn: "!!this.recordId",
3696
3693
  cache: API_CACHE,
3697
3694
  requestAdaptor: `
@@ -4846,7 +4843,7 @@ const getSchema$5 = async (uiSchema, ctx) => {
4846
4843
  // 如果新建记录时复制的数据中有omit或其他不相关字段数据时不应该一起保存到数据库,
4847
4844
  // 原规则见:https://github.com/steedos/steedos-frontend/issues/297
4848
4845
  _.forEach(selectedRowResponseResult, (val, key) => {
4849
- if (fieldsKeys.indexOf(key) > -1 && fields[key].omit !== true) {
4846
+ if (fieldsKeys.indexOf(key) > -1 && fields[key].omit !== true && key != 'owner') {
4850
4847
  defaultData[key] = val;
4851
4848
  }
4852
4849
  })
@@ -4856,7 +4853,7 @@ const getSchema$5 = async (uiSchema, ctx) => {
4856
4853
  if(_master && _master._isRelated){
4857
4854
  const relatedKey = _master.relatedKey;
4858
4855
  const masterObjectName = _master.objectName;
4859
- const recordId = _master.recordId;
4856
+ const recordId = _master.recordId || _master.record._id;
4860
4857
  let relatedKeySaveValue = recordId;
4861
4858
  const relatedField = fields[relatedKey];
4862
4859
  if(relatedField && relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
@@ -4881,7 +4878,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
4881
4878
  formSchema.defaultData = defaultData;
4882
4879
  }
4883
4880
  }
4884
-
4885
4881
  return {
4886
4882
  data: formSchema
4887
4883
  };
@@ -5521,9 +5517,7 @@ function getButtonVisibleOn(button){
5521
5517
  // return 'false';
5522
5518
  // }
5523
5519
  if(visible.trim().startsWith('function')){
5524
- visible = `(function(){try{const fun = ${visible}; return fun.apply({
5525
- object: uiSchema
5526
- }, [objectName, typeof _id === 'undefined' ? null: _id, typeof record === 'undefined' ? (typeof recordPermissions === 'undefined' ? {} : recordPermissions) : record.recordPermissions, data])}catch(e){console.error(e)}})()`;
5520
+ visible = `(function(){try{const fun = ${visible}; return fun.apply({}, [objectName, typeof _id === 'undefined' ? null: _id, typeof record === 'undefined' ? (typeof recordPermissions === 'undefined' ? {} : recordPermissions) : record.recordPermissions, data])}catch(e){console.error(e)}})()`;
5527
5521
  }
5528
5522
  }
5529
5523
 
@@ -7891,7 +7885,9 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
7891
7885
  details.push({
7892
7886
  type: 'steedos-field',
7893
7887
  static: true,
7894
- config: field,
7888
+ config: Object.assign({}, field, {
7889
+ description: null
7890
+ })
7895
7891
  });
7896
7892
  }
7897
7893
  });
@@ -10481,8 +10477,8 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
10481
10477
  /*
10482
10478
  * @Author: baozhoutao@steedos.com
10483
10479
  * @Date: 2022-07-05 15:55:39
10484
- * @LastEditors: baozhoutao@steedos.com
10485
- * @LastEditTime: 2025-03-07 16:48:27
10480
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
10481
+ * @LastEditTime: 2025-04-22 17:44:32
10486
10482
  * @Description:
10487
10483
  */
10488
10484
 
@@ -11048,6 +11044,9 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
11048
11044
  content.tabs.push(related);
11049
11045
  }
11050
11046
  // content.tabs = reverse(content.tabs)
11047
+ if(content.tabs.length == 1){
11048
+ content.className += " steedos-record-tabs--single";
11049
+ }
11051
11050
  return {
11052
11051
  uiSchema,
11053
11052
  amisSchema: {