@steedos-widgets/amis-lib 1.1.7 → 1.1.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
@@ -1,7 +1,7 @@
1
1
  import * as _$1 from 'lodash';
2
2
  import ___default, { isEmpty, isArray, each, find, endsWith, cloneDeep, includes, get, map, keys, sortBy, compact, toArray, mergeWith, isBoolean, omitBy, isNil, isString, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, has, filter, startsWith } from 'lodash';
3
- import isPlainObject from 'lodash/isPlainObject';
4
3
  import { Router as Router$1, getSteedosAuth as getSteedosAuth$1, lookupToAmis as lookupToAmis$1, fetchAPI as fetchAPI$1 } from '@steedos-widgets/amis-lib';
4
+ import isPlainObject from 'lodash/isPlainObject';
5
5
 
6
6
  /*
7
7
  * @Author: baozhoutao@steedos.com
@@ -3290,17 +3290,22 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
3290
3290
  async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
3291
3291
  }
3292
3292
 
3293
- const getDisplayAsButton = function(showDisplayAs){
3293
+ const getDisplayAsButton = function(objectName, showDisplayAs){
3294
+ let displayAs = Router$1.getTabDisplayAs(objectName);
3294
3295
  let buttons = [
3295
3296
  {
3296
3297
  "type": "button",
3297
3298
  "label": "表格",
3298
- "onClick": "const url = document.location.pathname + '?display=grid'; props.env.jumpTo(url);"
3299
+ "onClick": "let url = document.location.pathname; var urlSearch = new URLSearchParams(document.location.search); if(urlSearch.get(\"side_object\") && urlSearch.get(\"side_listview_id\")){url=`/app/${props.data.appId}/${urlSearch.get(\"side_object\")}/grid/${urlSearch.get(\"side_listview_id\")}`;}; props.env.jumpTo(url + '?display=grid');",
3300
+ "rightIcon": displayAs != 'split' ? "fa fa-check" : null,
3301
+ "rightIconClassName": "m-l-sm"
3299
3302
  },
3300
3303
  {
3301
3304
  "type": "button",
3302
3305
  "label": "分栏视图",
3303
- "onClick": "const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);"
3306
+ "onClick": "const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
3307
+ "rightIcon": displayAs === 'split' ? "fa fa-check" : null,
3308
+ "rightIconClassName": "m-l-sm"
3304
3309
  }
3305
3310
  ];
3306
3311
  return {
@@ -3442,7 +3447,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3442
3447
  }
3443
3448
  }
3444
3449
  },
3445
- showDisplayAs? getDisplayAsButton() : {}
3450
+ showDisplayAs? getDisplayAsButton(mainObject?.name) : {}
3446
3451
  ]
3447
3452
  }else {
3448
3453
  return [
@@ -3523,7 +3528,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3523
3528
  }
3524
3529
  }
3525
3530
  },
3526
- showDisplayAs? getDisplayAsButton() : {}
3531
+ showDisplayAs? getDisplayAsButton(showDisplayAs) : {}
3527
3532
  // {
3528
3533
  // "type": "search-box",
3529
3534
  // "align": "right",
@@ -5765,7 +5770,7 @@ async function getObjectCRUD(objectSchema, fields, options){
5765
5770
  keepItemSelectionOnPageChange: true,
5766
5771
  api: await getTableApi(objectSchema, fields, options),
5767
5772
  hiddenOn: options.tableHiddenOn,
5768
- autoFillHeight: true,
5773
+ autoFillHeight: options.isRelated ? false : true,
5769
5774
  className: `flex-auto ${crudClassName || ""}`,
5770
5775
  crudClassName: crudClassName,
5771
5776
  },
@@ -5925,6 +5930,10 @@ async function getObjectForm(objectSchema, ctx){
5925
5930
  "objectName": "${_master.objectName}"
5926
5931
  },
5927
5932
  "expression": `\${_master.objectName != '${objectSchema.name}' && _master.objectName}`
5933
+ },
5934
+ {
5935
+ "args": {},
5936
+ "actionType": "closeDialog"
5928
5937
  }
5929
5938
  ]
5930
5939
  }