@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.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash'), require('lodash/isPlainObject'), require('@steedos-widgets/amis-lib')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'lodash', 'lodash/isPlainObject', '@steedos-widgets/amis-lib'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["amis-lib"] = {}, global._$1, global.isPlainObject, global.amisLib));
5
- })(this, (function (exports, _$1, isPlainObject, amisLib) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash'), require('@steedos-widgets/amis-lib'), require('lodash/isPlainObject')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'lodash', '@steedos-widgets/amis-lib', 'lodash/isPlainObject'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["amis-lib"] = {}, global._$1, global.amisLib, global.isPlainObject));
5
+ })(this, (function (exports, _$1, amisLib, isPlainObject) {
6
6
  const global = window;
7
7
 
8
8
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -406,7 +406,7 @@
406
406
  * @Author: baozhoutao@steedos.com
407
407
  * @Date: 2022-05-23 09:53:08
408
408
  * @LastEditors: baozhoutao@steedos.com
409
- * @LastEditTime: 2023-03-09 10:00:44
409
+ * @LastEditTime: 2023-04-10 11:22:54
410
410
  * @Description:
411
411
  */
412
412
 
@@ -601,6 +601,7 @@
601
601
  case 'number':
602
602
  case 'currency':
603
603
  return await getNumberTpl(field);
604
+ case 'percent':
604
605
  case 'formula':
605
606
  case 'summary':
606
607
  return getUiFieldTpl(field)
@@ -633,7 +634,7 @@
633
634
  if(_$1.includes(['time','date','datetime','boolean','number','currency'], field.type)){
634
635
  fieldsName.push(`${field.name}`);
635
636
  }
636
- if(_$1.includes(['time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
637
+ if(_$1.includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
637
638
  displayFields.push(`${field.name}`);
638
639
  }
639
640
  }
@@ -3316,17 +3317,22 @@
3316
3317
  async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
3317
3318
  }
3318
3319
 
3319
- const getDisplayAsButton = function(showDisplayAs){
3320
+ const getDisplayAsButton = function(objectName, showDisplayAs){
3321
+ let displayAs = amisLib.Router.getTabDisplayAs(objectName);
3320
3322
  let buttons = [
3321
3323
  {
3322
3324
  "type": "button",
3323
3325
  "label": "表格",
3324
- "onClick": "const url = document.location.pathname + '?display=grid'; props.env.jumpTo(url);"
3326
+ "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');",
3327
+ "rightIcon": displayAs != 'split' ? "fa fa-check" : null,
3328
+ "rightIconClassName": "m-l-sm"
3325
3329
  },
3326
3330
  {
3327
3331
  "type": "button",
3328
3332
  "label": "分栏视图",
3329
- "onClick": "const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);"
3333
+ "onClick": "const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
3334
+ "rightIcon": displayAs === 'split' ? "fa fa-check" : null,
3335
+ "rightIconClassName": "m-l-sm"
3330
3336
  }
3331
3337
  ];
3332
3338
  return {
@@ -3468,7 +3474,7 @@ setTimeout(()=>{
3468
3474
  }
3469
3475
  }
3470
3476
  },
3471
- showDisplayAs? getDisplayAsButton() : {}
3477
+ showDisplayAs? getDisplayAsButton(mainObject?.name) : {}
3472
3478
  ]
3473
3479
  }else {
3474
3480
  return [
@@ -3549,7 +3555,7 @@ setTimeout(()=>{
3549
3555
  }
3550
3556
  }
3551
3557
  },
3552
- showDisplayAs? getDisplayAsButton() : {}
3558
+ showDisplayAs? getDisplayAsButton(showDisplayAs) : {}
3553
3559
  // {
3554
3560
  // "type": "search-box",
3555
3561
  // "align": "right",
@@ -5791,7 +5797,7 @@ setTimeout(()=>{
5791
5797
  keepItemSelectionOnPageChange: true,
5792
5798
  api: await getTableApi(objectSchema, fields, options),
5793
5799
  hiddenOn: options.tableHiddenOn,
5794
- autoFillHeight: true,
5800
+ autoFillHeight: options.isRelated ? false : true,
5795
5801
  className: `flex-auto ${crudClassName || ""}`,
5796
5802
  crudClassName: crudClassName,
5797
5803
  },
@@ -5951,6 +5957,10 @@ setTimeout(()=>{
5951
5957
  "objectName": "${_master.objectName}"
5952
5958
  },
5953
5959
  "expression": `\${_master.objectName != '${objectSchema.name}' && _master.objectName}`
5960
+ },
5961
+ {
5962
+ "args": {},
5963
+ "actionType": "closeDialog"
5954
5964
  }
5955
5965
  ]
5956
5966
  }