@steedos-widgets/amis-lib 6.3.0 → 6.3.2

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
@@ -1206,7 +1206,7 @@ async function getLookupLinkOnClick(field, options) {
1206
1206
  const recordPage = await getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor });
1207
1207
 
1208
1208
  const drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
1209
- "recordId": "${value}",
1209
+ "recordId": `\${${field.name}}`,
1210
1210
  "data": {
1211
1211
  ...recordPage.schema.data,
1212
1212
  "_inDrawer": true, // 用于判断是否在抽屉中
@@ -1216,7 +1216,7 @@ async function getLookupLinkOnClick(field, options) {
1216
1216
  }) : {
1217
1217
  "type": "steedos-record-detail",
1218
1218
  "objectApiName": options.objectName,
1219
- "recordId": "${value}",
1219
+ "recordId": `\${${field.name}}`,
1220
1220
  "showBackButton": false,
1221
1221
  "showButtons": true,
1222
1222
  "data": {
@@ -1322,7 +1322,7 @@ const getAmisFileReadonlySchema = async (steedosField,ctx = {})=>{
1322
1322
  labelClassName: "hidden",
1323
1323
  label: false,
1324
1324
  className: 'm-0',
1325
- tpl: `<a href="/app/-/cfs_files_filerecord/view/\${value}" ${lookupATagClick}>\${name}</a>`,
1325
+ tpl: `<a href="/app/-/cfs_files_filerecord/view/\${${steedosField.name}}" ${lookupATagClick}>\${name}</a>`,
1326
1326
  // tpl: "<%= item.name >",
1327
1327
  // onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
1328
1328
  onEvent: window.innerWidth < 768 ? null : await getLookupLinkOnClick(steedosField, {
@@ -1805,6 +1805,11 @@ async function getQuickEditSchema(object, columnField, options){
1805
1805
  const submitEvent = {
1806
1806
  submit: {
1807
1807
  actions: [
1808
+ {
1809
+ "actionType": "validate",
1810
+ "componentId": quickEditId,
1811
+ "outputVar": "form_validate_result"
1812
+ },
1808
1813
  {
1809
1814
  actionType: "custom",
1810
1815
  script: `
@@ -1821,10 +1826,12 @@ async function getQuickEditSchema(object, columnField, options){
1821
1826
  doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: "${options.objectName}" + "_display_" + event.data._index});
1822
1827
  doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + event.data._index});
1823
1828
  }
1824
- `
1829
+ `,
1830
+ expression: "${!form_validate_result.error}"
1825
1831
  },
1826
1832
  {
1827
- "actionType": "closeDialog"
1833
+ "actionType": "closeDialog",
1834
+ expression: "${!form_validate_result.error}"
1828
1835
  }
1829
1836
  ]
1830
1837
  }
@@ -2332,7 +2339,7 @@ async function getTableColumns(object, fields, options){
2332
2339
  }
2333
2340
  //增加quickEdit属性,实现快速编辑
2334
2341
  const quickEditSchema = allowEdit ? await getQuickEditSchema(object, field, options) : allowEdit;
2335
- let className = "";
2342
+ let className = `steedos-table-${field.type}-field`;
2336
2343
  const bowserType = getBowserType();
2337
2344
  if(bowserType === "Safari"){
2338
2345
  className += " whitespace-nowrap ";
@@ -3423,7 +3430,7 @@ function getReadonlyFormAdaptor(object, fields, options){
3423
3430
  nameLabel = `record._display.${nameField.name}.label`;
3424
3431
  }
3425
3432
  } else if (nameField){
3426
- nameLabel = `(record._display ? record._display.${nameField.name} : record.${nameField.name})`;
3433
+ nameLabel = `(record._display && record._display.${nameField.name}) || record.${nameField.name}`;
3427
3434
  }
3428
3435
  return `
3429
3436
  if(payload.data.data.length === 0){
@@ -3616,7 +3623,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
3616
3623
 
3617
3624
  return {
3618
3625
  method: "post",
3619
- url: getApi$2() + '&objectName=${objectName}' ,
3626
+ url: getApi$2() + '&objectName=${objectName}' + "&recordId=${recordId}",
3620
3627
  // sendOn: "!!this.recordId",
3621
3628
  cache: API_CACHE,
3622
3629
  requestAdaptor: `
@@ -13719,6 +13726,8 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
13719
13726
  if(gridSub){
13720
13727
  delete gridSub.name;
13721
13728
  delete gridSub.label;
13729
+ //去除重复样式
13730
+ gridSub.className = gridSub.className.replace('border-b', '');
13722
13731
  convertData.items.push(
13723
13732
  Object.assign({}, gridSub, {label: subField.label}, subField.amis, {
13724
13733
  name: subFieldName
@@ -13773,6 +13782,10 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
13773
13782
  }
13774
13783
  // if(ctx.mode === 'edit'){
13775
13784
  let convertDataResult = Object.assign({}, baseData, convertData, { labelClassName: 'text-left', clearValueOnHidden: true, fieldName: field.name}, field.amis, {name: baseData.name});
13785
+ // 只读时file字段的外层control层若存在name,内部each组件存在问题
13786
+ if(readonly && field.type == "file") {
13787
+ convertDataResult.name = "";
13788
+ }
13776
13789
  // console.log("convertDataResult:", convertDataResult);
13777
13790
  return convertDataResult;
13778
13791
  // }else{
@@ -13992,13 +14005,17 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
13992
14005
  // console.log(`perField.type object ===> field`, field)
13993
14006
  }
13994
14007
  if (field.name.indexOf(".") < 0) {
14008
+ let _field = _.cloneDeep(field);
14009
+ if(field.type === "select" && field.data_type && field.data_type != "text"){
14010
+ _field.type = field.data_type;
14011
+ }
13995
14012
  if(field.type === "steedos-field"){
13996
14013
  // 如果是steedos-field则不需要通过convertSFieldToAmisField函数转换,因为steedos-field组件会转换
13997
- fieldSetBody.push(field);
14014
+ fieldSetBody.push(_field);
13998
14015
  }
13999
14016
  else {
14000
14017
  ctx.__formFields = formFields;
14001
- const amisField = await convertSFieldToAmisField(field, field.readonly, ctx);
14018
+ const amisField = await convertSFieldToAmisField(_field, _field.readonly, ctx);
14002
14019
  // 如果steedos-field稳定了,可以放开下面的代码直接用组件统一渲染字段
14003
14020
  // const amisField = {
14004
14021
  // "type": "steedos-field",