@steedos-widgets/amis-lib 1.3.4-beta.6 → 1.3.4-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.
package/dist/index.esm.js CHANGED
@@ -1830,7 +1830,7 @@ const parseSingleExpression = function (func, formData, dataPath, global, userSe
1830
1830
  * @Author: baozhoutao@steedos.com
1831
1831
  * @Date: 2022-11-01 15:51:00
1832
1832
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
1833
- * @LastEditTime: 2023-09-23 11:25:18
1833
+ * @LastEditTime: 2023-09-25 14:53:05
1834
1834
  * @Description:
1835
1835
  */
1836
1836
 
@@ -1909,10 +1909,15 @@ const getSchema$5 = async (uiSchema, ctx) => {
1909
1909
  }, 200);
1910
1910
  `;
1911
1911
  const getSelectedRowsScript = `
1912
+ const isLookup = event.data.isLookup;
1913
+ if(isLookup){
1914
+ // lookup弹出窗口的新建功能不需要支持复制新建
1915
+ return;
1916
+ }
1912
1917
  const uiSchema = event.data.uiSchema;
1913
1918
  const objectName = event.data.objectName;
1914
1919
  const listViewRef = event.context.scoped.getComponentById("listview_" + objectName);
1915
- const selectedItems = listViewRef.props.store.toJSON().selectedItems || [];
1920
+ const selectedItems = listViewRef && listViewRef.props.store.toJSON().selectedItems || [];
1916
1921
  event.data.selectedIds = _.map(selectedItems, uiSchema.idFieldName || '_id');
1917
1922
  `;
1918
1923
  return {
@@ -10216,6 +10221,13 @@ async function getObjectCRUD(objectSchema, fields, options){
10216
10221
  Authorization: "Bearer ${context.tenantId},${context.authToken}",
10217
10222
  },
10218
10223
  requestAdaptor: quickSaveApiRequestAdaptor,
10224
+ adaptor: `
10225
+ if(payload.errors){
10226
+ payload.status = 2;
10227
+ payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
10228
+ }
10229
+ return payload;
10230
+ `
10219
10231
  },
10220
10232
  rowClassNameExpr: options.rowClassNameExpr
10221
10233
  }, bodyProps);
@@ -10560,7 +10572,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
10560
10572
  * @Author: baozhoutao@steedos.com
10561
10573
  * @Date: 2022-07-05 15:55:39
10562
10574
  * @LastEditors: liaodaxue
10563
- * @LastEditTime: 2023-08-28 14:55:23
10575
+ * @LastEditTime: 2023-09-25 17:18:08
10564
10576
  * @Description:
10565
10577
  */
10566
10578
 
@@ -10736,6 +10748,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
10736
10748
  // tableHiddenOn: hiddenEmptyTable ? "this.$count === 0" : null,
10737
10749
  appId: appId,
10738
10750
  crudClassName: 'border-t border-gray-300 hidden',
10751
+ refField,
10739
10752
  ...ctx
10740
10753
  };
10741
10754
  const amisSchema= (await getRelatedListSchema(relatedObjectName, 'all', options)).amisSchema;
@@ -10850,10 +10863,33 @@ async function getRelatedListSchema(
10850
10863
  ctx
10851
10864
  ) {
10852
10865
  const uiSchema = await getUISchema(objectName);
10853
- const listView = uiSchema.list_views;
10866
+ const listView = find(
10867
+ uiSchema.list_views,
10868
+ (listView, name) => {
10869
+ // 传入listViewName空值则取第一个
10870
+ if(!listViewName){
10871
+ listViewName = name;
10872
+ }
10873
+ return name === listViewName || listView._id === listViewName;
10874
+ }
10875
+ );
10854
10876
  const listViewProps = getRelatedListProps(uiSchema,listViewName, ctx);
10855
10877
  // console.log('listViewProps==>', listViewProps)
10856
10878
  const {columns: listViewColumns, sort: listViewSort, filter: listviewFilter, filtersFunction } = listViewProps;
10879
+
10880
+ const refFieldName = ctx.refField && ctx.refField.name;
10881
+
10882
+ let relatedListColumns = listViewColumns;
10883
+ if(refFieldName){
10884
+ relatedListColumns = listViewColumns.filter(function(columnItem){
10885
+ if(typeof columnItem === "string"){
10886
+ return columnItem !== refFieldName;
10887
+ }
10888
+ else {
10889
+ return columnItem.field !== refFieldName;
10890
+ }
10891
+ });
10892
+ }
10857
10893
 
10858
10894
  const defaults = ctx.defaults || {};
10859
10895
 
@@ -10891,7 +10927,7 @@ async function getRelatedListSchema(
10891
10927
  const amisSchema = {
10892
10928
  "type": "steedos-object-table",
10893
10929
  "objectApiName": objectName,
10894
- "columns": listViewColumns,
10930
+ "columns": relatedListColumns,
10895
10931
  "extraColumns": listView.extra_columns,
10896
10932
  "filters": listviewFilter,
10897
10933
  "filtersFunction": filtersFunction,