@steedos-widgets/amis-object 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.
@@ -297,8 +297,8 @@ body {
297
297
  .top-0 {
298
298
  top: 0px
299
299
  }
300
- .z-50 {
301
- z-index: 50
300
+ .z-10 {
301
+ z-index: 10
302
302
  }
303
303
  .col-span-2 {
304
304
  grid-column: span 2 / span 2
@@ -840,6 +840,9 @@ body {
840
840
  .sm\:p-0 {
841
841
  padding: 0px
842
842
  }
843
+ .sm\:p-3 {
844
+ padding: 0.75rem
845
+ }
843
846
  .sm\:shadow {
844
847
  --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
845
848
  --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);
@@ -767,7 +767,7 @@ const Router$1 = {
767
767
  * @Author: baozhoutao@steedos.com
768
768
  * @Date: 2022-05-23 09:53:08
769
769
  * @LastEditors: baozhoutao@steedos.com
770
- * @LastEditTime: 2023-03-09 10:00:44
770
+ * @LastEditTime: 2023-04-10 11:22:54
771
771
  * @Description:
772
772
  */
773
773
 
@@ -962,6 +962,7 @@ async function getFieldTpl (field, options){
962
962
  case 'number':
963
963
  case 'currency':
964
964
  return await getNumberTpl(field);
965
+ case 'percent':
965
966
  case 'formula':
966
967
  case 'summary':
967
968
  return getUiFieldTpl(field)
@@ -994,7 +995,7 @@ async function getFieldsTemplate(fields, expand){
994
995
  if(___default.includes(['time','date','datetime','boolean','number','currency'], field.type)){
995
996
  fieldsName.push(`${field.name}`);
996
997
  }
997
- if(___default.includes(['time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
998
+ if(___default.includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
998
999
  displayFields.push(`${field.name}`);
999
1000
  }
1000
1001
  }
@@ -3677,17 +3678,22 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
3677
3678
  async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
3678
3679
  }
3679
3680
 
3680
- const getDisplayAsButton = function(showDisplayAs){
3681
+ const getDisplayAsButton = function(objectName, showDisplayAs){
3682
+ let displayAs = Router$1.getTabDisplayAs(objectName);
3681
3683
  let buttons = [
3682
3684
  {
3683
3685
  "type": "button",
3684
3686
  "label": "表格",
3685
- "onClick": "const url = document.location.pathname + '?display=grid'; props.env.jumpTo(url);"
3687
+ "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');",
3688
+ "rightIcon": displayAs != 'split' ? "fa fa-check" : null,
3689
+ "rightIconClassName": "m-l-sm"
3686
3690
  },
3687
3691
  {
3688
3692
  "type": "button",
3689
3693
  "label": "分栏视图",
3690
- "onClick": "const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);"
3694
+ "onClick": "const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
3695
+ "rightIcon": displayAs === 'split' ? "fa fa-check" : null,
3696
+ "rightIconClassName": "m-l-sm"
3691
3697
  }
3692
3698
  ];
3693
3699
  return {
@@ -3829,7 +3835,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3829
3835
  }
3830
3836
  }
3831
3837
  },
3832
- showDisplayAs? getDisplayAsButton() : {}
3838
+ showDisplayAs? getDisplayAsButton(mainObject?.name) : {}
3833
3839
  ]
3834
3840
  }else {
3835
3841
  return [
@@ -3910,7 +3916,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3910
3916
  }
3911
3917
  }
3912
3918
  },
3913
- showDisplayAs? getDisplayAsButton() : {}
3919
+ showDisplayAs? getDisplayAsButton(showDisplayAs) : {}
3914
3920
  // {
3915
3921
  // "type": "search-box",
3916
3922
  // "align": "right",
@@ -6152,7 +6158,7 @@ async function getObjectCRUD(objectSchema, fields, options){
6152
6158
  keepItemSelectionOnPageChange: true,
6153
6159
  api: await getTableApi(objectSchema, fields, options),
6154
6160
  hiddenOn: options.tableHiddenOn,
6155
- autoFillHeight: true,
6161
+ autoFillHeight: options.isRelated ? false : true,
6156
6162
  className: `flex-auto ${crudClassName || ""}`,
6157
6163
  crudClassName: crudClassName,
6158
6164
  },
@@ -6312,6 +6318,10 @@ async function getObjectForm(objectSchema, ctx){
6312
6318
  "objectName": "${_master.objectName}"
6313
6319
  },
6314
6320
  "expression": `\${_master.objectName != '${objectSchema.name}' && _master.objectName}`
6321
+ },
6322
+ {
6323
+ "args": {},
6324
+ "actionType": "closeDialog"
6315
6325
  }
6316
6326
  ]
6317
6327
  }
@@ -12240,7 +12250,7 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
12240
12250
  return __generator(this, function (_d) {
12241
12251
  switch (_d.label) {
12242
12252
  case 0:
12243
- _a = props.className, className = _a === void 0 ? 'sticky top-0 z-50 bg-gray-100 border-b sm:shadow sm:rounded sm:border border-slate-300 p-4' : _a;
12253
+ _a = props.className, className = _a === void 0 ? 'sticky top-0 z-10 bg-gray-100 border-b sm:shadow sm:rounded sm:border border-slate-300 p-4' : _a;
12244
12254
  return [4 /*yield*/, getUISchema(props.objectApiName || "space_users", false)];
12245
12255
  case 1:
12246
12256
  objectUiSchema = _d.sent();
@@ -12548,8 +12558,6 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
12548
12558
  "items": {
12549
12559
  "type": "button",
12550
12560
  "level": "link",
12551
- "actionType": "link",
12552
- "link": "${path}",
12553
12561
  "body": [{
12554
12562
  "type": "tpl",
12555
12563
  "tpl": "<div class='slds-app-launcher__tile slds-text-link_reset'><div class='slds-app-launcher__tile-figure'><svg class='w-12 h-12 slds-icon slds-icon_container slds-icon-standard-${REPLACE(icon, '_', '-')}' aria-hidden='true'><use xlink:href='/assets/icons/standard-sprite/svg/symbols.svg#${icon}'></use></svg><span class='slds-assistive-text'>${name}</span></div><div class='slds-app-launcher__tile-body'><span class='slds-link text-blue-600 text-lg'><span title='${name}'>${name}</span></span><div style='display: -webkit-box; -webkit-line-clamp: 1;-webkit-box-orient: vertical;overflow: hidden;'><span title='${description}'>${description}</span></div></div></div>",
@@ -12576,6 +12584,21 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
12576
12584
  "actions": [
12577
12585
  {
12578
12586
  "actionType": "closeDialog"
12587
+ },
12588
+ {
12589
+ "actionType": "link",
12590
+ "args": {
12591
+ "link": "${path}"
12592
+ },
12593
+ "expression": "${!blank}"
12594
+ },
12595
+ {
12596
+ "actionType": "url",
12597
+ "args": {
12598
+ "url": "${path}",
12599
+ "blank": true
12600
+ },
12601
+ "expression": "${blank}"
12579
12602
  }
12580
12603
  ]
12581
12604
  }
@@ -13310,14 +13333,14 @@ var PageListView = function (props) { return __awaiter(void 0, void 0, void 0, f
13310
13333
  "showHeader": true,
13311
13334
  "showDisplayAs": (defaultFormFactor !== 'SMALL'),
13312
13335
  "formFactor": formFactor,
13313
- "className": (displayAs === 'split') ? 'w-full' : 'p-0 flex-1 sm:m-3 sm:border sm:shadow sm:rounded border-slate-300 border-solid bg-gray-100'
13336
+ "className": (displayAs === 'split') ? 'w-full' : 'p-0 flex-1 m-0 sm:border sm:shadow sm:rounded border-slate-300 border-solid bg-gray-100'
13314
13337
  };
13315
13338
  defData = __assign$2(__assign$2({}, $schema.data), { objectName: objectApiName, listViewId: listViewId, listName: listName || listviewId, appId: appId, formFactor: formFactor, displayAs: displayAs });
13316
13339
  // console.log("defData====>", defData)
13317
13340
  return [2 /*return*/, {
13318
13341
  type: 'service',
13319
13342
  data: defData,
13320
- "className": (displayAs === 'grid') ? 'h-full' : 'p-0 flex flex-1 overflow-hidden h-full',
13343
+ "className": (displayAs === 'grid') ? 'h-full sm:p-3' : 'p-0 flex flex-1 overflow-hidden h-full',
13321
13344
  body: (displayAs === 'grid') ? ___default.defaultsDeep({ data: defData }, listSchema) : [
13322
13345
  {
13323
13346
  "type": "wrapper",