@steedos-widgets/amis-lib 1.3.4-beta.6 → 1.3.4-beta.8

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 {
@@ -5335,10 +5340,11 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
5335
5340
  // "filter-toggler",
5336
5341
  ...(headerToolbarItems || []),
5337
5342
  "bulkActions",
5338
- {
5339
- "type": "columns-toggler",
5340
- "className": "hidden"
5341
- },
5343
+ // 不能放开crud columns-toggler否则crud card模式会报错
5344
+ // {
5345
+ // "type": "columns-toggler",
5346
+ // "className": "hidden"
5347
+ // },
5342
5348
  ...toolbars,
5343
5349
  // {
5344
5350
  // "type": "columns-toggler",
@@ -10216,6 +10222,13 @@ async function getObjectCRUD(objectSchema, fields, options){
10216
10222
  Authorization: "Bearer ${context.tenantId},${context.authToken}",
10217
10223
  },
10218
10224
  requestAdaptor: quickSaveApiRequestAdaptor,
10225
+ adaptor: `
10226
+ if(payload.errors){
10227
+ payload.status = 2;
10228
+ payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
10229
+ }
10230
+ return payload;
10231
+ `
10219
10232
  },
10220
10233
  rowClassNameExpr: options.rowClassNameExpr
10221
10234
  }, bodyProps);
@@ -10560,7 +10573,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
10560
10573
  * @Author: baozhoutao@steedos.com
10561
10574
  * @Date: 2022-07-05 15:55:39
10562
10575
  * @LastEditors: liaodaxue
10563
- * @LastEditTime: 2023-08-28 14:55:23
10576
+ * @LastEditTime: 2023-09-25 17:18:08
10564
10577
  * @Description:
10565
10578
  */
10566
10579
 
@@ -10736,6 +10749,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
10736
10749
  // tableHiddenOn: hiddenEmptyTable ? "this.$count === 0" : null,
10737
10750
  appId: appId,
10738
10751
  crudClassName: 'border-t border-gray-300 hidden',
10752
+ refField,
10739
10753
  ...ctx
10740
10754
  };
10741
10755
  const amisSchema= (await getRelatedListSchema(relatedObjectName, 'all', options)).amisSchema;
@@ -10850,10 +10864,33 @@ async function getRelatedListSchema(
10850
10864
  ctx
10851
10865
  ) {
10852
10866
  const uiSchema = await getUISchema(objectName);
10853
- const listView = uiSchema.list_views;
10867
+ const listView = find(
10868
+ uiSchema.list_views,
10869
+ (listView, name) => {
10870
+ // 传入listViewName空值则取第一个
10871
+ if(!listViewName){
10872
+ listViewName = name;
10873
+ }
10874
+ return name === listViewName || listView._id === listViewName;
10875
+ }
10876
+ );
10854
10877
  const listViewProps = getRelatedListProps(uiSchema,listViewName, ctx);
10855
10878
  // console.log('listViewProps==>', listViewProps)
10856
10879
  const {columns: listViewColumns, sort: listViewSort, filter: listviewFilter, filtersFunction } = listViewProps;
10880
+
10881
+ const refFieldName = ctx.refField && ctx.refField.name;
10882
+
10883
+ let relatedListColumns = listViewColumns;
10884
+ if(refFieldName){
10885
+ relatedListColumns = listViewColumns.filter(function(columnItem){
10886
+ if(typeof columnItem === "string"){
10887
+ return columnItem !== refFieldName;
10888
+ }
10889
+ else {
10890
+ return columnItem.field !== refFieldName;
10891
+ }
10892
+ });
10893
+ }
10857
10894
 
10858
10895
  const defaults = ctx.defaults || {};
10859
10896
 
@@ -10891,7 +10928,7 @@ async function getRelatedListSchema(
10891
10928
  const amisSchema = {
10892
10929
  "type": "steedos-object-table",
10893
10930
  "objectApiName": objectName,
10894
- "columns": listViewColumns,
10931
+ "columns": relatedListColumns,
10895
10932
  "extraColumns": listView.extra_columns,
10896
10933
  "filters": listviewFilter,
10897
10934
  "filtersFunction": filtersFunction,