@steedos-widgets/amis-object 1.2.10 → 1.2.11

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,
@@ -3103,6 +3105,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3103
3105
  if (!ctx) {
3104
3106
  ctx = {};
3105
3107
  }
3108
+ const btnSearchId = "btn_filter_form_search_" + new Date().getTime();
3106
3109
  const filterFormSchema = await getObjectFieldsFilterFormSchema(ctx);
3107
3110
  const onSearchScript = `
3108
3111
  const scope = event.context.scoped;
@@ -3119,7 +3122,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3119
3122
  // // 这会造成handleFilterSubmit时把移除掉的搜索项字段之前的值加到过滤条件中
3120
3123
  // for(var k in filterFormValues){
3121
3124
  // if(filterFormValues[k] === "" && !filterFormValues.hasOwnProperty(k)){
3122
- // removedValues[k] = "";
3125
+ // removedValues[k] = null;
3123
3126
  // }
3124
3127
  // }
3125
3128
  // listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
@@ -3158,7 +3161,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3158
3161
  const removedValues = {};
3159
3162
  for(var k in filterFormValues){
3160
3163
  if(/^__searchable__/.test(k)){
3161
- removedValues[k] = "";
3164
+ removedValues[k] = null;
3162
3165
  }
3163
3166
  }
3164
3167
  if(!event.data.isLookup){
@@ -3169,7 +3172,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3169
3172
  if(localListViewProps){
3170
3173
  localListViewProps = JSON.parse(localListViewProps);
3171
3174
  for(var k in localListViewProps){
3172
- removedValues[k] = "";
3175
+ removedValues[k] = null;
3173
3176
  }
3174
3177
  }
3175
3178
  }
@@ -3327,7 +3330,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3327
3330
  });
3328
3331
  const removedValues = {};
3329
3332
  removedKeys.forEach(function(key){
3330
- removedValues[key] = "";
3333
+ removedValues[key] = null;
3331
3334
  });
3332
3335
  filterForm.setValues(removedValues);//这里使用filterInnerForm也可以
3333
3336
 
@@ -3340,10 +3343,14 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3340
3343
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
3341
3344
  if(localListViewProps){
3342
3345
  localListViewProps = JSON.parse(localListViewProps);
3343
- // const removedValues = {};
3344
- removedKeys.forEach(function(key){
3345
- delete localListViewProps[key];
3346
- // removedValues[key] = "";
3346
+ _.each(localListViewProps, function(n,k){
3347
+ // __searchable__开头的不在searchableFields范围则清除其值
3348
+ let isRemoved = !!removedFields.find(function(fieldName){
3349
+ return new RegExp("__searchable__\.*" + fieldName + "$").test(k);
3350
+ });
3351
+ if(isRemoved){
3352
+ delete localListViewProps[k];
3353
+ }
3347
3354
  });
3348
3355
  sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify(localListViewProps));
3349
3356
  }
@@ -3377,9 +3384,10 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3377
3384
  "body": [
3378
3385
  {
3379
3386
  "type": "button",
3387
+ "id": btnSearchId,
3380
3388
  "label": "搜索",
3381
3389
  "icon": "fa fa-search",
3382
- "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
3390
+ // "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
3383
3391
  "onEvent": {
3384
3392
  "click": {
3385
3393
  "actions": [
@@ -3395,7 +3403,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3395
3403
  "type": "button",
3396
3404
  "label": "取消",
3397
3405
  "name": "btn_filter_form_cancel",
3398
- "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
3406
+ // "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
3399
3407
  "onEvent": {
3400
3408
  "click": {
3401
3409
  "actions": [
@@ -3510,6 +3518,10 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3510
3518
  "actionType": "custom",
3511
3519
  "script": onSearchableFieldsChangeScript
3512
3520
  },
3521
+ {
3522
+ "actionType": "click",
3523
+ "componentId": btnSearchId
3524
+ },
3513
3525
  {
3514
3526
  "componentId": "",
3515
3527
  "args": {},
@@ -3864,7 +3876,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
3864
3876
  // "tpl": "${(record && uiSchema && record[uiSchema.NAME_FIELD_KEY]) || name}",
3865
3877
  "inline": false,
3866
3878
  "wrapperComponent": "",
3867
- "className": "leading-5 text-xl font-bold"
3879
+ "className": "record-detail-header-name leading-5 text-xl font-bold"
3868
3880
  }
3869
3881
  ],
3870
3882
  "columnClassName": "p-l-xs"
@@ -3873,6 +3885,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
3873
3885
  "className": "flex justify-between"
3874
3886
  }
3875
3887
  ],
3888
+ "columnClassName": "flex-initial",
3876
3889
  "md": "auto",
3877
3890
  });
3878
3891
  }
@@ -3893,7 +3906,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
3893
3906
  {
3894
3907
  "type": "grid",
3895
3908
  "columns": gridBody,
3896
- "className": "flex justify-between"
3909
+ "className": "flex justify-between flex-nowrap"
3897
3910
  }
3898
3911
  ],
3899
3912
  "hiddenOn": "${recordLoaded != true}"
@@ -4110,12 +4123,13 @@ const getNewListviewButtonSchema = ()=>{
4110
4123
  "type": "dialog",
4111
4124
  "title": "新建 列表视图",
4112
4125
  "data": {
4113
- "&": "$$",
4126
+ //"&":"$$",2.7、2.9、3.0在此处失效
4114
4127
  "all": "${uiSchema.list_views.all}",
4115
4128
  "list_view": "${uiSchema.list_views[listName]}",
4116
4129
  "appId": "${appId}",
4117
4130
  "global": "${global}",
4118
4131
  "targetObjectName": "${objectName}",
4132
+ "context": "${context}"
4119
4133
  },
4120
4134
  "body": [
4121
4135
  {
@@ -4259,12 +4273,13 @@ const getCopyListviewButtonSchema = ()=>{
4259
4273
  "type": "dialog",
4260
4274
  "title": "复制 列表视图",
4261
4275
  "data": {
4262
- "&": "$$",
4276
+ //"&":"$$",2.7、2.9、3.0在此处失效
4263
4277
  "listName": "${listName}",
4264
4278
  "targetObjectName": "${objectName}",
4265
4279
  "list_view": "${uiSchema.list_views[listName]}",
4266
4280
  "appId": "${appId}",
4267
- "global": "${global}"
4281
+ "global": "${global}",
4282
+ "context": "${context}"
4268
4283
  },
4269
4284
  "body": [
4270
4285
  {
@@ -4406,7 +4421,8 @@ const getRenameListviewButtonSchema = ()=>{
4406
4421
  "data": {
4407
4422
  "targetObjectName": "${objectName}",
4408
4423
  "recordId": "${uiSchema.list_views[listName]._id}",
4409
- "appId": "${appId}"
4424
+ "appId": "${appId}",
4425
+ "context": "${context}"
4410
4426
  },
4411
4427
  "body": [
4412
4428
  {
@@ -4463,6 +4479,7 @@ const getSetListviewShareButtonSchema = ()=>{
4463
4479
  "title": "共享设置",
4464
4480
  "data": {
4465
4481
  "recordId": "${uiSchema.list_views[listName]._id}",
4482
+ "context": "${context}"
4466
4483
  },
4467
4484
  "body": [
4468
4485
  {
@@ -4508,7 +4525,8 @@ const getSetListviewFiltersButtonSchema = ()=>{
4508
4525
  "targetObjectName": "${objectName}",
4509
4526
  "recordId": "${uiSchema.list_views[listName]._id}",
4510
4527
  "listName": "${listName}",
4511
- "appId": "${appId}"
4528
+ "appId": "${appId}",
4529
+ "context": "${context}"
4512
4530
  },
4513
4531
  "body": [
4514
4532
  {
@@ -4652,11 +4670,12 @@ const getSetListviewColumnsButtonSchema = ()=>{
4652
4670
  "type": "dialog",
4653
4671
  "title": "显示的列",
4654
4672
  "data": {
4655
- "&": "$$",
4673
+ //"&":"$$",2.7、2.9、3.0在此处失效
4656
4674
  "targetObjectName": "${objectName}",
4657
4675
  "recordId": "${uiSchema.list_views[listName]._id}",
4658
4676
  "listName": "${listName}",
4659
- "appId": "${appId}"
4677
+ "appId": "${appId}",
4678
+ "context": "${context}"
4660
4679
  },
4661
4680
  "body": [
4662
4681
  {
@@ -4805,11 +4824,12 @@ const getSetListviewSortButtonSchema = ()=>{
4805
4824
  "type": "dialog",
4806
4825
  "title": "默认排序规则",
4807
4826
  "data": {
4808
- "&": "$$",
4827
+ //"&":"$$",2.7、2.9、3.0在此处失效
4809
4828
  "targetObjectName": "${objectName}",
4810
4829
  "recordId": "${uiSchema.list_views[listName]._id}",
4811
4830
  "listName": "${listName}",
4812
- "appId": "${appId}"
4831
+ "appId": "${appId}",
4832
+ "context": "${context}"
4813
4833
  },
4814
4834
  "body": [
4815
4835
  {
@@ -5499,24 +5519,13 @@ function getLookupSapceUserTreeSchema(){
5499
5519
  "actionType": "custom",
5500
5520
  "script": `
5501
5521
  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={
5522
+ var filterFormValues={
5508
5523
  "__searchable__organizations_parents":event.data.value.value
5509
5524
  }
5510
5525
  var listView = scope.parent.getComponents().find(function(n){
5511
5526
  return n.props.type === "crud";
5512
5527
  });
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));
5528
+ listView.handleFilterSubmit(Object.assign({}, filterFormValues));
5520
5529
  `
5521
5530
  }
5522
5531
  ]
@@ -5630,7 +5639,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
5630
5639
 
5631
5640
  const source = await getApi$1(refObjectConfig, null, fields, {expand: true, alias: 'rows', queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
5632
5641
 
5633
- if(source.url){
5642
+ if(source.url && !ctx.inFilterForm){
5634
5643
  const depend_on = [];
5635
5644
  const sendOn = [];
5636
5645
  ___default__namespace.each(field.depend_on, (fName)=>{
@@ -5694,9 +5703,10 @@ async function lookupToAmisPicker(field, readonly, ctx){
5694
5703
  filters.push(fieldFilters);
5695
5704
  }
5696
5705
 
5706
+ const inFilterForm = ${ctx.inFilterForm};
5697
5707
  const filtersFunction = ${field.filtersFunction || field._filtersFunction};
5698
5708
 
5699
- if(filtersFunction){
5709
+ if(filtersFunction && !inFilterForm){
5700
5710
  const _filters = filtersFunction(filters, api.data.$self.__super.__super);
5701
5711
  if(_filters && _filters.length > 0){
5702
5712
  filters.push(_filters);
@@ -5916,7 +5926,8 @@ async function lookupToAmisSelect(field, readonly, ctx){
5916
5926
  sort = getListViewSort(listView);
5917
5927
  }
5918
5928
 
5919
- if(apiInfo.url){
5929
+ // 列表视图搜索栏中,即inFilterForm=true时,不需要执行depend_on
5930
+ if(apiInfo.url && !ctx.inFilterForm){
5920
5931
  const depend_on = [];
5921
5932
  const sendOn = [];
5922
5933
  ___default__namespace.each(field.depend_on, (fName)=>{
@@ -5953,9 +5964,10 @@ async function lookupToAmisSelect(field, readonly, ctx){
5953
5964
  filters.push(fieldFilters);
5954
5965
  }
5955
5966
 
5967
+ const inFilterForm = ${ctx.inFilterForm};
5956
5968
  const filtersFunction = ${field.filtersFunction || field._filtersFunction};
5957
5969
 
5958
- if(filtersFunction){
5970
+ if(filtersFunction && !inFilterForm){
5959
5971
  const _filters = filtersFunction(filters, api.data.$);
5960
5972
  if(_filters && _filters.length > 0){
5961
5973
  filters.push(_filters);
@@ -5981,7 +5993,14 @@ async function lookupToAmisSelect(field, readonly, ctx){
5981
5993
  referenceTo ? referenceTo.valueField.name : '';
5982
5994
  if(field.optionsFunction || field._optionsFunction){
5983
5995
  apiInfo.adaptor = `
5984
- payload.data.options = eval(${field.optionsFunction || field._optionsFunction})(api.data.$);
5996
+ var options = eval(${field.optionsFunction || field._optionsFunction})(api.data.$);
5997
+ if(api.data.$term){
5998
+ options = _.filter(options, function(o) {
5999
+ var label = o.label;
6000
+ return label.toLowerCase().indexOf(api.data.$term.toLowerCase()) > -1;
6001
+ });
6002
+ }
6003
+ payload.data.options = options;
5985
6004
  return payload;
5986
6005
  `;
5987
6006
  }
@@ -6117,7 +6136,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
6117
6136
  source.data.$term = "$term";
6118
6137
  source.data.$self = "$$";
6119
6138
 
6120
- if(idsDependOn && source.url){
6139
+ if(idsDependOn && source.url && !ctx.inFilterForm){
6121
6140
  source.sendOn = `\${${idsDependOn} && ${idsDependOn}.length}`;
6122
6141
  source.url = `${source.url}&depend_on_${idsDependOn}=\${${idsDependOn}|join}`;
6123
6142
  }
@@ -6959,7 +6978,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
6959
6978
  convertData.className = fieldTypeClassName;
6960
6979
  }
6961
6980
 
6962
- if(field.visible_on){
6981
+ if(field.visible_on && !ctx.inFilterForm){
6963
6982
  // convertData.visibleOn = `\$${field.visible_on.substring(1, field.visible_on.length -1).replace(/formData./g, '')}`;
6964
6983
  if(field.visible_on.startsWith("{{")){
6965
6984
  convertData.visibleOn = `${field.visible_on.substring(2, field.visible_on.length -2).replace(/formData./g, 'data.')}`;
@@ -7052,7 +7071,7 @@ async function getFieldSearchable(perField, permissionFields, ctx){
7052
7071
  _field.multiple = true;
7053
7072
  _field.is_wide = false;
7054
7073
  _field.defaultValue = undefined;
7055
- const amisField = await convertSFieldToAmisField(_field, false, Object.assign({}, ctx, {fieldNamePrefix: fieldNamePrefix, required: false, showSystemFields: true}));
7074
+ const amisField = await convertSFieldToAmisField(_field, false, Object.assign({}, ctx, {fieldNamePrefix: fieldNamePrefix, required: false, showSystemFields: true, inFilterForm: true}));
7056
7075
  if(amisField){
7057
7076
  return amisField;
7058
7077
  }
@@ -8054,7 +8073,7 @@ async function getTableColumns$1(fields, options){
8054
8073
  tpl: tpl,
8055
8074
  toggled: field.toggled,
8056
8075
  className,
8057
- html: field.type === 'html' ? true : null
8076
+ options: field.type === 'html' ? {html: true} : null
8058
8077
  // toggled: true
8059
8078
  }, field.amis, {name: field.name}));
8060
8079
  }
@@ -13934,13 +13953,6 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
13934
13953
  });
13935
13954
  }); };
13936
13955
 
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
13956
  var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void 0, function () {
13945
13957
  var className, $schema, appId, _a, objectApiName, body, schema;
13946
13958
  return __generator(this, function (_b) {
@@ -14524,7 +14536,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
14524
14536
  schemaApi: {
14525
14537
  "method": "get",
14526
14538
  "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 "),
14539
+ "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
14540
  "headers": {
14529
14541
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
14530
14542
  }