@steedos-widgets/amis-lib 1.1.7 → 1.1.9

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
@@ -380,7 +380,7 @@ const Router = {
380
380
  * @Author: baozhoutao@steedos.com
381
381
  * @Date: 2022-05-23 09:53:08
382
382
  * @LastEditors: baozhoutao@steedos.com
383
- * @LastEditTime: 2023-03-09 10:00:44
383
+ * @LastEditTime: 2023-04-10 11:22:54
384
384
  * @Description:
385
385
  */
386
386
 
@@ -575,6 +575,7 @@ async function getFieldTpl (field, options){
575
575
  case 'number':
576
576
  case 'currency':
577
577
  return await getNumberTpl(field);
578
+ case 'percent':
578
579
  case 'formula':
579
580
  case 'summary':
580
581
  return getUiFieldTpl(field)
@@ -607,7 +608,7 @@ async function getFieldsTemplate(fields, expand){
607
608
  if(includes(['time','date','datetime','boolean','number','currency'], field.type)){
608
609
  fieldsName.push(`${field.name}`);
609
610
  }
610
- if(includes(['time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
611
+ if(includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
611
612
  displayFields.push(`${field.name}`);
612
613
  }
613
614
  }
@@ -3290,17 +3291,22 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
3290
3291
  async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
3291
3292
  }
3292
3293
 
3293
- const getDisplayAsButton = function(showDisplayAs){
3294
+ const getDisplayAsButton = function(objectName, showDisplayAs){
3295
+ let displayAs = Router$1.getTabDisplayAs(objectName);
3294
3296
  let buttons = [
3295
3297
  {
3296
3298
  "type": "button",
3297
3299
  "label": "表格",
3298
- "onClick": "const url = document.location.pathname + '?display=grid'; props.env.jumpTo(url);"
3300
+ "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');",
3301
+ "rightIcon": displayAs != 'split' ? "fa fa-check" : null,
3302
+ "rightIconClassName": "m-l-sm"
3299
3303
  },
3300
3304
  {
3301
3305
  "type": "button",
3302
3306
  "label": "分栏视图",
3303
- "onClick": "const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);"
3307
+ "onClick": "const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
3308
+ "rightIcon": displayAs === 'split' ? "fa fa-check" : null,
3309
+ "rightIconClassName": "m-l-sm"
3304
3310
  }
3305
3311
  ];
3306
3312
  return {
@@ -3442,7 +3448,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3442
3448
  }
3443
3449
  }
3444
3450
  },
3445
- showDisplayAs? getDisplayAsButton() : {}
3451
+ showDisplayAs? getDisplayAsButton(mainObject?.name) : {}
3446
3452
  ]
3447
3453
  }else {
3448
3454
  return [
@@ -3523,7 +3529,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3523
3529
  }
3524
3530
  }
3525
3531
  },
3526
- showDisplayAs? getDisplayAsButton() : {}
3532
+ showDisplayAs? getDisplayAsButton(showDisplayAs) : {}
3527
3533
  // {
3528
3534
  // "type": "search-box",
3529
3535
  // "align": "right",
@@ -5765,7 +5771,7 @@ async function getObjectCRUD(objectSchema, fields, options){
5765
5771
  keepItemSelectionOnPageChange: true,
5766
5772
  api: await getTableApi(objectSchema, fields, options),
5767
5773
  hiddenOn: options.tableHiddenOn,
5768
- autoFillHeight: true,
5774
+ autoFillHeight: options.isRelated ? false : true,
5769
5775
  className: `flex-auto ${crudClassName || ""}`,
5770
5776
  crudClassName: crudClassName,
5771
5777
  },
@@ -5925,6 +5931,10 @@ async function getObjectForm(objectSchema, ctx){
5925
5931
  "objectName": "${_master.objectName}"
5926
5932
  },
5927
5933
  "expression": `\${_master.objectName != '${objectSchema.name}' && _master.objectName}`
5934
+ },
5935
+ {
5936
+ "args": {},
5937
+ "actionType": "closeDialog"
5928
5938
  }
5929
5939
  ]
5930
5940
  }