@steedos-widgets/amis-object 1.2.10 → 1.2.12

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.
@@ -1 +1,2 @@
1
+ import './AmisObjectForm.less';
1
2
  export declare const AmisObjectForm: (props: any) => Promise<any>;
@@ -1,3 +1,4 @@
1
+ import './AmisRecordDetailHeader.less';
1
2
  export declare const AmisRecordDetailHeader: (props: any) => Promise<{
2
3
  type: string;
3
4
  id: string;
@@ -73,6 +74,7 @@ export declare const AmisRecordDetailHeader: (props: any) => Promise<{
73
74
  })[];
74
75
  className: string;
75
76
  }[];
77
+ columnClassName: string;
76
78
  md: string;
77
79
  } | {
78
80
  body: {
@@ -124,6 +126,7 @@ export declare const AmisRecordDetailHeader: (props: any) => Promise<{
124
126
  };
125
127
  };
126
128
  md: string;
129
+ columnClassName?: undefined;
127
130
  })[];
128
131
  className: string;
129
132
  }[];
@@ -1,4 +1,3 @@
1
- import './AmisObjectForm.less';
2
1
  export * from './AmisObjectForm';
3
2
  export * from './AmisObjectListview';
4
3
  export * from './AmisObjectTable';
@@ -561,6 +561,9 @@ body {
561
561
  .max-w-md {
562
562
  max-width: 28rem
563
563
  }
564
+ .flex-initial {
565
+ flex: 0 1 auto
566
+ }
564
567
  .flex-auto {
565
568
  flex: 1 1 auto
566
569
  }
@@ -1235,6 +1238,16 @@ body {
1235
1238
  column-gap: 1rem;
1236
1239
  }
1237
1240
 
1241
+ @media (max-width: 768px) {
1242
+ .record-detail-header-name {
1243
+ display: -webkit-box;
1244
+ overflow: hidden;
1245
+ text-overflow: ellipsis;
1246
+ -webkit-line-clamp: 2;
1247
+ -webkit-box-orient: vertical;
1248
+ }
1249
+ }
1250
+
1238
1251
  .steedos-context-bar .antd-Nav-list {
1239
1252
  border-bottom: 0px;
1240
1253
  height: 40px;
@@ -790,7 +790,7 @@ function getContrastColor(bgColor) {
790
790
  * @Author: baozhoutao@steedos.com
791
791
  * @Date: 2022-05-23 09:53:08
792
792
  * @LastEditors: Please set LastEditors
793
- * @LastEditTime: 2023-05-18 16:34:39
793
+ * @LastEditTime: 2023-05-22 15:13:18
794
794
  * @Description:
795
795
  */
796
796
 
@@ -847,8 +847,9 @@ function getSelectMap(selectOptions){
847
847
  let map = {};
848
848
  ___default.forEach(selectOptions,(option)=>{
849
849
  const optionValue = option.value + '';
850
- if(option.color){
851
- const background = option.color.charAt(0) === '#' ? option.color : '#'+option.color;
850
+ const optionColor = option.color + '';
851
+ if(optionColor){
852
+ const background = optionColor.charAt(0) === '#' ? optionColor : '#'+optionColor;
852
853
  const color = getContrastColor(background);
853
854
  const optionColorStyle = 'background:'+background+';color:'+color;
854
855
  map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
@@ -2254,9 +2255,10 @@ const getSchema$1 = (uiSchema) => {
2254
2255
  {
2255
2256
  name: "template_url",
2256
2257
  label: "导入模板",
2257
- type: "tpl",
2258
- // type: "markdown",
2259
- // html: true,
2258
+ type: "markdown",
2259
+ options: {
2260
+ html: true
2261
+ },
2260
2262
  className: "whitespace-nowrap",
2261
2263
  },
2262
2264
  null,
@@ -2801,7 +2803,14 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
2801
2803
  className: `button_${button.name}`
2802
2804
  }
2803
2805
  });
2804
- let dropdownButtons = ___default__default["default"].map(moreButtons, (button) => {
2806
+ let moreButtonsVisibleOn = '';
2807
+ let dropdownButtons = ___default__default["default"].map(moreButtons, (button, index) => {
2808
+ if(index === 0){
2809
+ moreButtonsVisibleOn = getButtonVisibleOn$1(button);
2810
+ }else {
2811
+ moreButtonsVisibleOn = moreButtonsVisibleOn + ' || ' +getButtonVisibleOn$1(button);
2812
+ }
2813
+
2805
2814
  return {
2806
2815
  type: 'steedos-object-button',
2807
2816
  name: button.name,
@@ -2811,12 +2820,13 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
2811
2820
  });
2812
2821
  return {
2813
2822
  buttons: amisButtonsSchema,
2814
- moreButtons: dropdownButtons
2823
+ moreButtons: dropdownButtons,
2824
+ moreButtonsVisibleOn
2815
2825
  };
2816
2826
  };
2817
2827
 
2818
2828
  const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
2819
- const { buttons, moreButtons } = getObjectDetailHeaderButtons(objectSchema, recordId);
2829
+ const { buttons, moreButtons, moreButtonsVisibleOn } = getObjectDetailHeaderButtons(objectSchema, recordId);
2820
2830
  if(ctx.formFactor === 'SMALL'){
2821
2831
  return {
2822
2832
  "type": "button",
@@ -2871,7 +2881,8 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
2871
2881
  type: "steedos-dropdown-button",
2872
2882
  label: "",
2873
2883
  buttons: moreButtons,
2874
- className: 'slds-icon'
2884
+ className: 'slds-icon',
2885
+ visibleOn: moreButtonsVisibleOn
2875
2886
  };
2876
2887
  buttons.push(dropdownButtonsSchema);
2877
2888
  }
@@ -3103,6 +3114,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3103
3114
  if (!ctx) {
3104
3115
  ctx = {};
3105
3116
  }
3117
+ const btnSearchId = "btn_filter_form_search_" + new Date().getTime();
3106
3118
  const filterFormSchema = await getObjectFieldsFilterFormSchema(ctx);
3107
3119
  const onSearchScript = `
3108
3120
  const scope = event.context.scoped;
@@ -3119,7 +3131,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3119
3131
  // // 这会造成handleFilterSubmit时把移除掉的搜索项字段之前的值加到过滤条件中
3120
3132
  // for(var k in filterFormValues){
3121
3133
  // if(filterFormValues[k] === "" && !filterFormValues.hasOwnProperty(k)){
3122
- // removedValues[k] = "";
3134
+ // removedValues[k] = null;
3123
3135
  // }
3124
3136
  // }
3125
3137
  // listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
@@ -3158,7 +3170,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3158
3170
  const removedValues = {};
3159
3171
  for(var k in filterFormValues){
3160
3172
  if(/^__searchable__/.test(k)){
3161
- removedValues[k] = "";
3173
+ removedValues[k] = null;
3162
3174
  }
3163
3175
  }
3164
3176
  if(!event.data.isLookup){
@@ -3169,7 +3181,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3169
3181
  if(localListViewProps){
3170
3182
  localListViewProps = JSON.parse(localListViewProps);
3171
3183
  for(var k in localListViewProps){
3172
- removedValues[k] = "";
3184
+ removedValues[k] = null;
3173
3185
  }
3174
3186
  }
3175
3187
  }
@@ -3327,7 +3339,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3327
3339
  });
3328
3340
  const removedValues = {};
3329
3341
  removedKeys.forEach(function(key){
3330
- removedValues[key] = "";
3342
+ removedValues[key] = null;
3331
3343
  });
3332
3344
  filterForm.setValues(removedValues);//这里使用filterInnerForm也可以
3333
3345
 
@@ -3340,10 +3352,14 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3340
3352
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
3341
3353
  if(localListViewProps){
3342
3354
  localListViewProps = JSON.parse(localListViewProps);
3343
- // const removedValues = {};
3344
- removedKeys.forEach(function(key){
3345
- delete localListViewProps[key];
3346
- // removedValues[key] = "";
3355
+ _.each(localListViewProps, function(n,k){
3356
+ // __searchable__开头的不在searchableFields范围则清除其值
3357
+ let isRemoved = !!removedFields.find(function(fieldName){
3358
+ return new RegExp("__searchable__\.*" + fieldName + "$").test(k);
3359
+ });
3360
+ if(isRemoved){
3361
+ delete localListViewProps[k];
3362
+ }
3347
3363
  });
3348
3364
  sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify(localListViewProps));
3349
3365
  }
@@ -3377,9 +3393,10 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3377
3393
  "body": [
3378
3394
  {
3379
3395
  "type": "button",
3396
+ "id": btnSearchId,
3380
3397
  "label": "搜索",
3381
3398
  "icon": "fa fa-search",
3382
- "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
3399
+ // "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
3383
3400
  "onEvent": {
3384
3401
  "click": {
3385
3402
  "actions": [
@@ -3395,7 +3412,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3395
3412
  "type": "button",
3396
3413
  "label": "取消",
3397
3414
  "name": "btn_filter_form_cancel",
3398
- "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
3415
+ // "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
3399
3416
  "onEvent": {
3400
3417
  "click": {
3401
3418
  "actions": [
@@ -3510,6 +3527,10 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3510
3527
  "actionType": "custom",
3511
3528
  "script": onSearchableFieldsChangeScript
3512
3529
  },
3530
+ {
3531
+ "actionType": "click",
3532
+ "componentId": btnSearchId
3533
+ },
3513
3534
  {
3514
3535
  "componentId": "",
3515
3536
  "args": {},
@@ -3864,7 +3885,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
3864
3885
  // "tpl": "${(record && uiSchema && record[uiSchema.NAME_FIELD_KEY]) || name}",
3865
3886
  "inline": false,
3866
3887
  "wrapperComponent": "",
3867
- "className": "leading-5 text-xl font-bold"
3888
+ "className": "record-detail-header-name leading-5 text-xl font-bold"
3868
3889
  }
3869
3890
  ],
3870
3891
  "columnClassName": "p-l-xs"
@@ -3873,6 +3894,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
3873
3894
  "className": "flex justify-between"
3874
3895
  }
3875
3896
  ],
3897
+ "columnClassName": "flex-initial",
3876
3898
  "md": "auto",
3877
3899
  });
3878
3900
  }
@@ -3893,7 +3915,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
3893
3915
  {
3894
3916
  "type": "grid",
3895
3917
  "columns": gridBody,
3896
- "className": "flex justify-between"
3918
+ "className": "flex justify-between flex-nowrap"
3897
3919
  }
3898
3920
  ],
3899
3921
  "hiddenOn": "${recordLoaded != true}"
@@ -4110,12 +4132,13 @@ const getNewListviewButtonSchema = ()=>{
4110
4132
  "type": "dialog",
4111
4133
  "title": "新建 列表视图",
4112
4134
  "data": {
4113
- "&": "$$",
4135
+ //"&":"$$",2.7、2.9、3.0在此处失效
4114
4136
  "all": "${uiSchema.list_views.all}",
4115
4137
  "list_view": "${uiSchema.list_views[listName]}",
4116
4138
  "appId": "${appId}",
4117
4139
  "global": "${global}",
4118
4140
  "targetObjectName": "${objectName}",
4141
+ "context": "${context}"
4119
4142
  },
4120
4143
  "body": [
4121
4144
  {
@@ -4259,12 +4282,13 @@ const getCopyListviewButtonSchema = ()=>{
4259
4282
  "type": "dialog",
4260
4283
  "title": "复制 列表视图",
4261
4284
  "data": {
4262
- "&": "$$",
4285
+ //"&":"$$",2.7、2.9、3.0在此处失效
4263
4286
  "listName": "${listName}",
4264
4287
  "targetObjectName": "${objectName}",
4265
4288
  "list_view": "${uiSchema.list_views[listName]}",
4266
4289
  "appId": "${appId}",
4267
- "global": "${global}"
4290
+ "global": "${global}",
4291
+ "context": "${context}"
4268
4292
  },
4269
4293
  "body": [
4270
4294
  {
@@ -4406,7 +4430,8 @@ const getRenameListviewButtonSchema = ()=>{
4406
4430
  "data": {
4407
4431
  "targetObjectName": "${objectName}",
4408
4432
  "recordId": "${uiSchema.list_views[listName]._id}",
4409
- "appId": "${appId}"
4433
+ "appId": "${appId}",
4434
+ "context": "${context}"
4410
4435
  },
4411
4436
  "body": [
4412
4437
  {
@@ -4463,6 +4488,7 @@ const getSetListviewShareButtonSchema = ()=>{
4463
4488
  "title": "共享设置",
4464
4489
  "data": {
4465
4490
  "recordId": "${uiSchema.list_views[listName]._id}",
4491
+ "context": "${context}"
4466
4492
  },
4467
4493
  "body": [
4468
4494
  {
@@ -4508,7 +4534,8 @@ const getSetListviewFiltersButtonSchema = ()=>{
4508
4534
  "targetObjectName": "${objectName}",
4509
4535
  "recordId": "${uiSchema.list_views[listName]._id}",
4510
4536
  "listName": "${listName}",
4511
- "appId": "${appId}"
4537
+ "appId": "${appId}",
4538
+ "context": "${context}"
4512
4539
  },
4513
4540
  "body": [
4514
4541
  {
@@ -4652,11 +4679,12 @@ const getSetListviewColumnsButtonSchema = ()=>{
4652
4679
  "type": "dialog",
4653
4680
  "title": "显示的列",
4654
4681
  "data": {
4655
- "&": "$$",
4682
+ //"&":"$$",2.7、2.9、3.0在此处失效
4656
4683
  "targetObjectName": "${objectName}",
4657
4684
  "recordId": "${uiSchema.list_views[listName]._id}",
4658
4685
  "listName": "${listName}",
4659
- "appId": "${appId}"
4686
+ "appId": "${appId}",
4687
+ "context": "${context}"
4660
4688
  },
4661
4689
  "body": [
4662
4690
  {
@@ -4805,11 +4833,12 @@ const getSetListviewSortButtonSchema = ()=>{
4805
4833
  "type": "dialog",
4806
4834
  "title": "默认排序规则",
4807
4835
  "data": {
4808
- "&": "$$",
4836
+ //"&":"$$",2.7、2.9、3.0在此处失效
4809
4837
  "targetObjectName": "${objectName}",
4810
4838
  "recordId": "${uiSchema.list_views[listName]._id}",
4811
4839
  "listName": "${listName}",
4812
- "appId": "${appId}"
4840
+ "appId": "${appId}",
4841
+ "context": "${context}"
4813
4842
  },
4814
4843
  "body": [
4815
4844
  {
@@ -5499,24 +5528,13 @@ function getLookupSapceUserTreeSchema(){
5499
5528
  "actionType": "custom",
5500
5529
  "script": `
5501
5530
  const scope = event.context.scoped;
5502
- //TODO: 将form中的value一同加入筛选内
5503
- // var filterForm = scope.parent.parent.getComponents().find(function(n){
5504
- // return n.props.type === "form";
5505
- // });
5506
- // var filterFormValues = filterForm.getValues();
5507
- filterFormValues={
5531
+ var filterFormValues={
5508
5532
  "__searchable__organizations_parents":event.data.value.value
5509
5533
  }
5510
5534
  var listView = scope.parent.getComponents().find(function(n){
5511
5535
  return n.props.type === "crud";
5512
5536
  });
5513
- const removedValues = {};
5514
- // for(var k in filterFormValues){
5515
- // if(filterFormValues[k] === "" && !filterFormValues.hasOwnProperty(k)){
5516
- // removedValues[k] = "";
5517
- // }
5518
- // }
5519
- listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
5537
+ listView.handleFilterSubmit(Object.assign({}, filterFormValues));
5520
5538
  `
5521
5539
  }
5522
5540
  ]
@@ -5630,7 +5648,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
5630
5648
 
5631
5649
  const source = await getApi$1(refObjectConfig, null, fields, {expand: true, alias: 'rows', queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
5632
5650
 
5633
- if(source.url){
5651
+ if(source.url && !ctx.inFilterForm){
5634
5652
  const depend_on = [];
5635
5653
  const sendOn = [];
5636
5654
  ___default__namespace.each(field.depend_on, (fName)=>{
@@ -5694,9 +5712,10 @@ async function lookupToAmisPicker(field, readonly, ctx){
5694
5712
  filters.push(fieldFilters);
5695
5713
  }
5696
5714
 
5715
+ const inFilterForm = ${ctx.inFilterForm};
5697
5716
  const filtersFunction = ${field.filtersFunction || field._filtersFunction};
5698
5717
 
5699
- if(filtersFunction){
5718
+ if(filtersFunction && !inFilterForm){
5700
5719
  const _filters = filtersFunction(filters, api.data.$self.__super.__super);
5701
5720
  if(_filters && _filters.length > 0){
5702
5721
  filters.push(_filters);
@@ -5916,7 +5935,8 @@ async function lookupToAmisSelect(field, readonly, ctx){
5916
5935
  sort = getListViewSort(listView);
5917
5936
  }
5918
5937
 
5919
- if(apiInfo.url){
5938
+ // 列表视图搜索栏中,即inFilterForm=true时,不需要执行depend_on
5939
+ if(apiInfo.url && !ctx.inFilterForm){
5920
5940
  const depend_on = [];
5921
5941
  const sendOn = [];
5922
5942
  ___default__namespace.each(field.depend_on, (fName)=>{
@@ -5953,9 +5973,10 @@ async function lookupToAmisSelect(field, readonly, ctx){
5953
5973
  filters.push(fieldFilters);
5954
5974
  }
5955
5975
 
5976
+ const inFilterForm = ${ctx.inFilterForm};
5956
5977
  const filtersFunction = ${field.filtersFunction || field._filtersFunction};
5957
5978
 
5958
- if(filtersFunction){
5979
+ if(filtersFunction && !inFilterForm){
5959
5980
  const _filters = filtersFunction(filters, api.data.$);
5960
5981
  if(_filters && _filters.length > 0){
5961
5982
  filters.push(_filters);
@@ -5981,7 +6002,14 @@ async function lookupToAmisSelect(field, readonly, ctx){
5981
6002
  referenceTo ? referenceTo.valueField.name : '';
5982
6003
  if(field.optionsFunction || field._optionsFunction){
5983
6004
  apiInfo.adaptor = `
5984
- payload.data.options = eval(${field.optionsFunction || field._optionsFunction})(api.data.$);
6005
+ var options = eval(${field.optionsFunction || field._optionsFunction})(api.data.$);
6006
+ if(api.data.$term){
6007
+ options = _.filter(options, function(o) {
6008
+ var label = o.label;
6009
+ return label.toLowerCase().indexOf(api.data.$term.toLowerCase()) > -1;
6010
+ });
6011
+ }
6012
+ payload.data.options = options;
5985
6013
  return payload;
5986
6014
  `;
5987
6015
  }
@@ -6117,7 +6145,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
6117
6145
  source.data.$term = "$term";
6118
6146
  source.data.$self = "$$";
6119
6147
 
6120
- if(idsDependOn && source.url){
6148
+ if(idsDependOn && source.url && !ctx.inFilterForm){
6121
6149
  source.sendOn = `\${${idsDependOn} && ${idsDependOn}.length}`;
6122
6150
  source.url = `${source.url}&depend_on_${idsDependOn}=\${${idsDependOn}|join}`;
6123
6151
  }
@@ -6959,7 +6987,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
6959
6987
  convertData.className = fieldTypeClassName;
6960
6988
  }
6961
6989
 
6962
- if(field.visible_on){
6990
+ if(field.visible_on && !ctx.inFilterForm){
6963
6991
  // convertData.visibleOn = `\$${field.visible_on.substring(1, field.visible_on.length -1).replace(/formData./g, '')}`;
6964
6992
  if(field.visible_on.startsWith("{{")){
6965
6993
  convertData.visibleOn = `${field.visible_on.substring(2, field.visible_on.length -2).replace(/formData./g, 'data.')}`;
@@ -7052,7 +7080,7 @@ async function getFieldSearchable(perField, permissionFields, ctx){
7052
7080
  _field.multiple = true;
7053
7081
  _field.is_wide = false;
7054
7082
  _field.defaultValue = undefined;
7055
- const amisField = await convertSFieldToAmisField(_field, false, Object.assign({}, ctx, {fieldNamePrefix: fieldNamePrefix, required: false, showSystemFields: true}));
7083
+ const amisField = await convertSFieldToAmisField(_field, false, Object.assign({}, ctx, {fieldNamePrefix: fieldNamePrefix, required: false, showSystemFields: true, inFilterForm: true}));
7056
7084
  if(amisField){
7057
7085
  return amisField;
7058
7086
  }
@@ -7892,11 +7920,12 @@ async function getObjectDetail(objectSchema, recordId, ctx){
7892
7920
  "expression": "this.__deletedRecord != true"
7893
7921
  },
7894
7922
  {
7895
- "args": {
7896
- "url": "/app/${appId}/${objectName}/grid/${side_listview_id}",
7897
- "blank": false
7898
- },
7899
- "actionType": "link",
7923
+ // "args": {
7924
+ // "url": "/app/${appId}/${objectName}/grid/${side_listview_id}",
7925
+ // "blank": false
7926
+ // },
7927
+ "actionType": "custom",
7928
+ "script": "Steedos.goBack()",
7900
7929
  "expression": "this.__deletedRecord === true"
7901
7930
  }
7902
7931
  ]
@@ -8054,7 +8083,7 @@ async function getTableColumns$1(fields, options){
8054
8083
  tpl: tpl,
8055
8084
  toggled: field.toggled,
8056
8085
  className,
8057
- html: field.type === 'html' ? true : null
8086
+ options: field.type === 'html' ? {html: true} : null
8058
8087
  // toggled: true
8059
8088
  }, field.amis, {name: field.name}));
8060
8089
  }
@@ -13934,13 +13963,6 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
13934
13963
  });
13935
13964
  }); };
13936
13965
 
13937
- /*
13938
- * @Author: baozhoutao@steedos.com
13939
- * @Date: 2022-12-08 10:32:17
13940
- * @LastEditors: baozhoutao@steedos.com
13941
- * @LastEditTime: 2023-04-13 18:40:42
13942
- * @Description:
13943
- */
13944
13966
  var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void 0, function () {
13945
13967
  var className, $schema, appId, _a, objectApiName, body, schema;
13946
13968
  return __generator(this, function (_b) {
@@ -14524,7 +14546,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
14524
14546
  schemaApi: {
14525
14547
  "method": "get",
14526
14548
  "url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
14527
- "adaptor": "\n try {\n console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target\n // active: selectedId === tab.id,\n })\n })\n } else {\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": true,\n \"children\": _.map(tabs, (tab) => {\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target\n // active: selectedId === tab.id,\n }\n })\n }) \n }\n });\n }else{\n _.each(payload.children, (tab)=>{\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target\n // active: selectedId === tab.id,\n });\n })\n }\n payload.data = {\n \"type\": \"nav\",\n className: \"").concat(className, "\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"links\": data.nav,\n };\n } catch (error) {\n console.log(`error`, error)\n }\n console.log('payload===2==>', payload)\n return payload;\n "),
14549
+ "adaptor": "\n try {\n console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target\n // active: selectedId === tab.id,\n })\n })\n } else {\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": _.find(tab_groups, {\"group_name\": groupName})?.default_open != false,\n \"children\": _.map(tabs, (tab) => {\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target\n // active: selectedId === tab.id,\n }\n })\n }) \n }\n });\n }else{\n _.each(payload.children, (tab)=>{\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target\n // active: selectedId === tab.id,\n });\n })\n }\n payload.data = {\n \"type\": \"nav\",\n className: \"").concat(className, "\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"links\": data.nav,\n };\n } catch (error) {\n console.log(`error`, error)\n }\n console.log('payload===2==>', payload)\n return payload;\n "),
14528
14550
  "headers": {
14529
14551
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
14530
14552
  }