@steedos-widgets/amis-object 1.2.9 → 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.
@@ -769,11 +769,28 @@ const Router$1 = {
769
769
 
770
770
  };
771
771
 
772
+ /*
773
+ * @Author: baozhoutao@steedos.com
774
+ * @Date: 2022-07-20 16:29:22
775
+ * @LastEditors: Please set LastEditors
776
+ * @LastEditTime: 2023-05-18 15:22:51
777
+ * @Description:
778
+ */
779
+
780
+ function getContrastColor(bgColor) {
781
+ var backgroundColor = (bgColor.charAt(0) === '#') ? bgColor.substring(1, 7) : bgColor;
782
+ var r = parseInt(backgroundColor.substr(0, 2), 16);
783
+ var g = parseInt(backgroundColor.substr(2, 2), 16);
784
+ var b = parseInt(backgroundColor.substr(4, 2), 16);
785
+ var brightness = (r * 299 + g * 587 + b * 114) / 1000;
786
+ return brightness < 128 ? "#ffffff" : "#000000";
787
+ }
788
+
772
789
  /*
773
790
  * @Author: baozhoutao@steedos.com
774
791
  * @Date: 2022-05-23 09:53:08
775
- * @LastEditors: baozhoutao@steedos.com
776
- * @LastEditTime: 2023-04-10 11:22:54
792
+ * @LastEditors: Please set LastEditors
793
+ * @LastEditTime: 2023-05-22 15:13:18
777
794
  * @Description:
778
795
  */
779
796
 
@@ -826,6 +843,22 @@ async function getRefObjectNameFieldName(field){
826
843
  function getSelectTpl(field){
827
844
  return `<div>\${_display.${field.name}}</div>`
828
845
  }
846
+ function getSelectMap(selectOptions){
847
+ let map = {};
848
+ ___default.forEach(selectOptions,(option)=>{
849
+ const optionValue = option.value + '';
850
+ const optionColor = option.color + '';
851
+ if(optionColor){
852
+ const background = optionColor.charAt(0) === '#' ? optionColor : '#'+optionColor;
853
+ const color = getContrastColor(background);
854
+ const optionColorStyle = 'background:'+background+';color:'+color;
855
+ map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
856
+ }else {
857
+ map[optionValue] = option.label;
858
+ }
859
+ });
860
+ return map;
861
+ }
829
862
 
830
863
  function getNameTplUrl(field, ctx){
831
864
  if(ctx.objectName === 'cms_files'){
@@ -2222,9 +2255,10 @@ const getSchema$1 = (uiSchema) => {
2222
2255
  {
2223
2256
  name: "template_url",
2224
2257
  label: "导入模板",
2225
- type: "tpl",
2226
- // type: "markdown",
2227
- // html: true,
2258
+ type: "markdown",
2259
+ options: {
2260
+ html: true
2261
+ },
2228
2262
  className: "whitespace-nowrap",
2229
2263
  },
2230
2264
  null,
@@ -3071,6 +3105,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3071
3105
  if (!ctx) {
3072
3106
  ctx = {};
3073
3107
  }
3108
+ const btnSearchId = "btn_filter_form_search_" + new Date().getTime();
3074
3109
  const filterFormSchema = await getObjectFieldsFilterFormSchema(ctx);
3075
3110
  const onSearchScript = `
3076
3111
  const scope = event.context.scoped;
@@ -3087,7 +3122,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3087
3122
  // // 这会造成handleFilterSubmit时把移除掉的搜索项字段之前的值加到过滤条件中
3088
3123
  // for(var k in filterFormValues){
3089
3124
  // if(filterFormValues[k] === "" && !filterFormValues.hasOwnProperty(k)){
3090
- // removedValues[k] = "";
3125
+ // removedValues[k] = null;
3091
3126
  // }
3092
3127
  // }
3093
3128
  // listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
@@ -3126,7 +3161,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3126
3161
  const removedValues = {};
3127
3162
  for(var k in filterFormValues){
3128
3163
  if(/^__searchable__/.test(k)){
3129
- removedValues[k] = "";
3164
+ removedValues[k] = null;
3130
3165
  }
3131
3166
  }
3132
3167
  if(!event.data.isLookup){
@@ -3137,7 +3172,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3137
3172
  if(localListViewProps){
3138
3173
  localListViewProps = JSON.parse(localListViewProps);
3139
3174
  for(var k in localListViewProps){
3140
- removedValues[k] = "";
3175
+ removedValues[k] = null;
3141
3176
  }
3142
3177
  }
3143
3178
  }
@@ -3295,7 +3330,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3295
3330
  });
3296
3331
  const removedValues = {};
3297
3332
  removedKeys.forEach(function(key){
3298
- removedValues[key] = "";
3333
+ removedValues[key] = null;
3299
3334
  });
3300
3335
  filterForm.setValues(removedValues);//这里使用filterInnerForm也可以
3301
3336
 
@@ -3308,10 +3343,14 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3308
3343
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
3309
3344
  if(localListViewProps){
3310
3345
  localListViewProps = JSON.parse(localListViewProps);
3311
- // const removedValues = {};
3312
- removedKeys.forEach(function(key){
3313
- delete localListViewProps[key];
3314
- // 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
+ }
3315
3354
  });
3316
3355
  sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify(localListViewProps));
3317
3356
  }
@@ -3345,9 +3384,10 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3345
3384
  "body": [
3346
3385
  {
3347
3386
  "type": "button",
3387
+ "id": btnSearchId,
3348
3388
  "label": "搜索",
3349
3389
  "icon": "fa fa-search",
3350
- "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
3390
+ // "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
3351
3391
  "onEvent": {
3352
3392
  "click": {
3353
3393
  "actions": [
@@ -3363,7 +3403,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3363
3403
  "type": "button",
3364
3404
  "label": "取消",
3365
3405
  "name": "btn_filter_form_cancel",
3366
- "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
3406
+ // "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
3367
3407
  "onEvent": {
3368
3408
  "click": {
3369
3409
  "actions": [
@@ -3478,6 +3518,10 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3478
3518
  "actionType": "custom",
3479
3519
  "script": onSearchableFieldsChangeScript
3480
3520
  },
3521
+ {
3522
+ "actionType": "click",
3523
+ "componentId": btnSearchId
3524
+ },
3481
3525
  {
3482
3526
  "componentId": "",
3483
3527
  "args": {},
@@ -3785,8 +3829,8 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
3785
3829
  },
3786
3830
  "body":[{
3787
3831
  "type": "button",
3788
- "visibleOn": "${window:innerWidth > 768 && window:historyPaths.length > 1}",
3789
- "className":"flex mr-2",
3832
+ "visibleOn": "${window:innerWidth > 768 && (window:historyPaths.length > 1 || window:historyPaths[0].params.record_id) && display !== 'split'}",
3833
+ "className":"flex mr-4",
3790
3834
  "onEvent": {
3791
3835
  "click": {
3792
3836
  "actions": [
@@ -3803,7 +3847,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
3803
3847
  "category": "utility",
3804
3848
  "name": "back",
3805
3849
  "colorVariant": "default",
3806
- "className": "slds-button_icon slds-global-header__icon"
3850
+ "className": "slds-button_icon slds-global-header__icon w-4"
3807
3851
  }
3808
3852
  ]
3809
3853
  }]
@@ -3832,7 +3876,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
3832
3876
  // "tpl": "${(record && uiSchema && record[uiSchema.NAME_FIELD_KEY]) || name}",
3833
3877
  "inline": false,
3834
3878
  "wrapperComponent": "",
3835
- "className": "leading-5 text-xl font-bold"
3879
+ "className": "record-detail-header-name leading-5 text-xl font-bold"
3836
3880
  }
3837
3881
  ],
3838
3882
  "columnClassName": "p-l-xs"
@@ -3841,6 +3885,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
3841
3885
  "className": "flex justify-between"
3842
3886
  }
3843
3887
  ],
3888
+ "columnClassName": "flex-initial",
3844
3889
  "md": "auto",
3845
3890
  });
3846
3891
  }
@@ -3861,7 +3906,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
3861
3906
  {
3862
3907
  "type": "grid",
3863
3908
  "columns": gridBody,
3864
- "className": "flex justify-between"
3909
+ "className": "flex justify-between flex-nowrap"
3865
3910
  }
3866
3911
  ],
3867
3912
  "hiddenOn": "${recordLoaded != true}"
@@ -4078,12 +4123,13 @@ const getNewListviewButtonSchema = ()=>{
4078
4123
  "type": "dialog",
4079
4124
  "title": "新建 列表视图",
4080
4125
  "data": {
4081
- "&": "$$",
4126
+ //"&":"$$",2.7、2.9、3.0在此处失效
4082
4127
  "all": "${uiSchema.list_views.all}",
4083
4128
  "list_view": "${uiSchema.list_views[listName]}",
4084
4129
  "appId": "${appId}",
4085
4130
  "global": "${global}",
4086
4131
  "targetObjectName": "${objectName}",
4132
+ "context": "${context}"
4087
4133
  },
4088
4134
  "body": [
4089
4135
  {
@@ -4227,12 +4273,13 @@ const getCopyListviewButtonSchema = ()=>{
4227
4273
  "type": "dialog",
4228
4274
  "title": "复制 列表视图",
4229
4275
  "data": {
4230
- "&": "$$",
4276
+ //"&":"$$",2.7、2.9、3.0在此处失效
4231
4277
  "listName": "${listName}",
4232
4278
  "targetObjectName": "${objectName}",
4233
4279
  "list_view": "${uiSchema.list_views[listName]}",
4234
4280
  "appId": "${appId}",
4235
- "global": "${global}"
4281
+ "global": "${global}",
4282
+ "context": "${context}"
4236
4283
  },
4237
4284
  "body": [
4238
4285
  {
@@ -4374,7 +4421,8 @@ const getRenameListviewButtonSchema = ()=>{
4374
4421
  "data": {
4375
4422
  "targetObjectName": "${objectName}",
4376
4423
  "recordId": "${uiSchema.list_views[listName]._id}",
4377
- "appId": "${appId}"
4424
+ "appId": "${appId}",
4425
+ "context": "${context}"
4378
4426
  },
4379
4427
  "body": [
4380
4428
  {
@@ -4431,6 +4479,7 @@ const getSetListviewShareButtonSchema = ()=>{
4431
4479
  "title": "共享设置",
4432
4480
  "data": {
4433
4481
  "recordId": "${uiSchema.list_views[listName]._id}",
4482
+ "context": "${context}"
4434
4483
  },
4435
4484
  "body": [
4436
4485
  {
@@ -4476,7 +4525,8 @@ const getSetListviewFiltersButtonSchema = ()=>{
4476
4525
  "targetObjectName": "${objectName}",
4477
4526
  "recordId": "${uiSchema.list_views[listName]._id}",
4478
4527
  "listName": "${listName}",
4479
- "appId": "${appId}"
4528
+ "appId": "${appId}",
4529
+ "context": "${context}"
4480
4530
  },
4481
4531
  "body": [
4482
4532
  {
@@ -4620,11 +4670,12 @@ const getSetListviewColumnsButtonSchema = ()=>{
4620
4670
  "type": "dialog",
4621
4671
  "title": "显示的列",
4622
4672
  "data": {
4623
- "&": "$$",
4673
+ //"&":"$$",2.7、2.9、3.0在此处失效
4624
4674
  "targetObjectName": "${objectName}",
4625
4675
  "recordId": "${uiSchema.list_views[listName]._id}",
4626
4676
  "listName": "${listName}",
4627
- "appId": "${appId}"
4677
+ "appId": "${appId}",
4678
+ "context": "${context}"
4628
4679
  },
4629
4680
  "body": [
4630
4681
  {
@@ -4771,13 +4822,14 @@ const getSetListviewSortButtonSchema = ()=>{
4771
4822
  {
4772
4823
  "dialog": {
4773
4824
  "type": "dialog",
4774
- "title": "弹框标题",
4825
+ "title": "默认排序规则",
4775
4826
  "data": {
4776
- "&": "$$",
4827
+ //"&":"$$",2.7、2.9、3.0在此处失效
4777
4828
  "targetObjectName": "${objectName}",
4778
4829
  "recordId": "${uiSchema.list_views[listName]._id}",
4779
4830
  "listName": "${listName}",
4780
- "appId": "${appId}"
4831
+ "appId": "${appId}",
4832
+ "context": "${context}"
4781
4833
  },
4782
4834
  "body": [
4783
4835
  {
@@ -5467,24 +5519,13 @@ function getLookupSapceUserTreeSchema(){
5467
5519
  "actionType": "custom",
5468
5520
  "script": `
5469
5521
  const scope = event.context.scoped;
5470
- //TODO: 将form中的value一同加入筛选内
5471
- // var filterForm = scope.parent.parent.getComponents().find(function(n){
5472
- // return n.props.type === "form";
5473
- // });
5474
- // var filterFormValues = filterForm.getValues();
5475
- filterFormValues={
5522
+ var filterFormValues={
5476
5523
  "__searchable__organizations_parents":event.data.value.value
5477
5524
  }
5478
5525
  var listView = scope.parent.getComponents().find(function(n){
5479
5526
  return n.props.type === "crud";
5480
5527
  });
5481
- const removedValues = {};
5482
- // for(var k in filterFormValues){
5483
- // if(filterFormValues[k] === "" && !filterFormValues.hasOwnProperty(k)){
5484
- // removedValues[k] = "";
5485
- // }
5486
- // }
5487
- listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
5528
+ listView.handleFilterSubmit(Object.assign({}, filterFormValues));
5488
5529
  `
5489
5530
  }
5490
5531
  ]
@@ -5598,7 +5639,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
5598
5639
 
5599
5640
  const source = await getApi$1(refObjectConfig, null, fields, {expand: true, alias: 'rows', queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
5600
5641
 
5601
- if(source.url){
5642
+ if(source.url && !ctx.inFilterForm){
5602
5643
  const depend_on = [];
5603
5644
  const sendOn = [];
5604
5645
  ___default__namespace.each(field.depend_on, (fName)=>{
@@ -5662,9 +5703,10 @@ async function lookupToAmisPicker(field, readonly, ctx){
5662
5703
  filters.push(fieldFilters);
5663
5704
  }
5664
5705
 
5706
+ const inFilterForm = ${ctx.inFilterForm};
5665
5707
  const filtersFunction = ${field.filtersFunction || field._filtersFunction};
5666
5708
 
5667
- if(filtersFunction){
5709
+ if(filtersFunction && !inFilterForm){
5668
5710
  const _filters = filtersFunction(filters, api.data.$self.__super.__super);
5669
5711
  if(_filters && _filters.length > 0){
5670
5712
  filters.push(_filters);
@@ -5884,7 +5926,8 @@ async function lookupToAmisSelect(field, readonly, ctx){
5884
5926
  sort = getListViewSort(listView);
5885
5927
  }
5886
5928
 
5887
- if(apiInfo.url){
5929
+ // 列表视图搜索栏中,即inFilterForm=true时,不需要执行depend_on
5930
+ if(apiInfo.url && !ctx.inFilterForm){
5888
5931
  const depend_on = [];
5889
5932
  const sendOn = [];
5890
5933
  ___default__namespace.each(field.depend_on, (fName)=>{
@@ -5921,9 +5964,10 @@ async function lookupToAmisSelect(field, readonly, ctx){
5921
5964
  filters.push(fieldFilters);
5922
5965
  }
5923
5966
 
5967
+ const inFilterForm = ${ctx.inFilterForm};
5924
5968
  const filtersFunction = ${field.filtersFunction || field._filtersFunction};
5925
5969
 
5926
- if(filtersFunction){
5970
+ if(filtersFunction && !inFilterForm){
5927
5971
  const _filters = filtersFunction(filters, api.data.$);
5928
5972
  if(_filters && _filters.length > 0){
5929
5973
  filters.push(_filters);
@@ -5949,7 +5993,14 @@ async function lookupToAmisSelect(field, readonly, ctx){
5949
5993
  referenceTo ? referenceTo.valueField.name : '';
5950
5994
  if(field.optionsFunction || field._optionsFunction){
5951
5995
  apiInfo.adaptor = `
5952
- 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;
5953
6004
  return payload;
5954
6005
  `;
5955
6006
  }
@@ -6085,7 +6136,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
6085
6136
  source.data.$term = "$term";
6086
6137
  source.data.$self = "$$";
6087
6138
 
6088
- if(idsDependOn && source.url){
6139
+ if(idsDependOn && source.url && !ctx.inFilterForm){
6089
6140
  source.sendOn = `\${${idsDependOn} && ${idsDependOn}.length}`;
6090
6141
  source.url = `${source.url}&depend_on_${idsDependOn}=\${${idsDependOn}|join}`;
6091
6142
  }
@@ -6371,23 +6422,6 @@ const getAmisFileSchema = (steedosField, readonly)=>{
6371
6422
  return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
6372
6423
  };
6373
6424
 
6374
- /*
6375
- * @Author: baozhoutao@steedos.com
6376
- * @Date: 2022-07-20 16:29:22
6377
- * @LastEditors: Please set LastEditors
6378
- * @LastEditTime: 2023-05-11 11:19:54
6379
- * @Description:
6380
- */
6381
-
6382
- function getContrastColor(bgColor) {
6383
- var backgroundColor = (bgColor.charAt(0) === '#') ? bgColor.substring(1, 7) : bgColor;
6384
- var r = parseInt(backgroundColor.substr(0, 2), 16);
6385
- var g = parseInt(backgroundColor.substr(2, 2), 16);
6386
- var b = parseInt(backgroundColor.substr(4, 2), 16);
6387
- var brightness = (r * 299 + g * 587 + b * 114) / 1000;
6388
- return brightness >= 128 ? "#000000" : "#ffffff";
6389
- }
6390
-
6391
6425
  const OMIT_FIELDS = ['created', 'created_by', 'modified', 'modified_by'];
6392
6426
  // const Lookup = require('./lookup');
6393
6427
 
@@ -6578,19 +6612,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
6578
6612
  // break;
6579
6613
  case 'select':
6580
6614
  if(readonly){
6581
- const selectOptions = field.options;
6582
- let map = {};
6583
- ___default__namespace.forEach(selectOptions,(option)=>{
6584
- const optionValue = option.value + '';
6585
- if(option.color){
6586
- const background = '#'+option.color;
6587
- const color = getContrastColor(background);
6588
- const optionColorStyle = 'background:'+background+';color:'+color;
6589
- map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
6590
- }else {
6591
- map[optionValue] = option.label;
6592
- }
6593
- });
6615
+ const map = getSelectMap(field.options);
6594
6616
  convertData = {
6595
6617
  type: "static-mapping",
6596
6618
  name: field.name,
@@ -6956,7 +6978,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
6956
6978
  convertData.className = fieldTypeClassName;
6957
6979
  }
6958
6980
 
6959
- if(field.visible_on){
6981
+ if(field.visible_on && !ctx.inFilterForm){
6960
6982
  // convertData.visibleOn = `\$${field.visible_on.substring(1, field.visible_on.length -1).replace(/formData./g, '')}`;
6961
6983
  if(field.visible_on.startsWith("{{")){
6962
6984
  convertData.visibleOn = `${field.visible_on.substring(2, field.visible_on.length -2).replace(/formData./g, 'data.')}`;
@@ -7049,7 +7071,7 @@ async function getFieldSearchable(perField, permissionFields, ctx){
7049
7071
  _field.multiple = true;
7050
7072
  _field.is_wide = false;
7051
7073
  _field.defaultValue = undefined;
7052
- 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}));
7053
7075
  if(amisField){
7054
7076
  return amisField;
7055
7077
  }
@@ -7289,7 +7311,8 @@ async function getEditFormInitApi(object, recordId, fields, options){
7289
7311
  data.global = "${global}";
7290
7312
  data.context = "${context}";
7291
7313
  data.defaultData = "${defaultData}";
7292
-
7314
+ data._master = "${_master}";
7315
+
7293
7316
  return {
7294
7317
  method: "post",
7295
7318
  url: getApi$2() + '&objectName=${objectName}' ,
@@ -7355,7 +7378,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
7355
7378
  formInitialValuesFun = new Function("return " + formInitialValuesFun)();
7356
7379
  }
7357
7380
  if(typeof formInitialValuesFun === "function"){
7358
- initialValues = formInitialValuesFun.apply({doc: defaultValues || {} , global: api.body.global})
7381
+ initialValues = formInitialValuesFun.apply({doc: defaultValues || {} , global: api.body.global, master: api.body._master })
7359
7382
  }
7360
7383
  }
7361
7384
  catch(ex){
@@ -8011,19 +8034,7 @@ async function getTableColumns$1(fields, options){
8011
8034
  }, field.amis, {name: field.name}));
8012
8035
  }
8013
8036
  else if(field.type === 'select'){
8014
- const selectOptions = field.options;
8015
- let map = {};
8016
- ___default.forEach(selectOptions,(option)=>{
8017
- const optionValue = option.value + '';
8018
- if(option.color){
8019
- const background = '#'+option.color;
8020
- const color = getContrastColor(background);
8021
- const optionColorStyle = 'background:'+background+';color:'+color;
8022
- map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
8023
- }else {
8024
- map[optionValue] = option.label;
8025
- }
8026
- });
8037
+ const map = getSelectMap(field.options);
8027
8038
  columns.push(Object.assign({}, {
8028
8039
  type: "mapping",
8029
8040
  name: field.name,
@@ -8062,7 +8073,7 @@ async function getTableColumns$1(fields, options){
8062
8073
  tpl: tpl,
8063
8074
  toggled: field.toggled,
8064
8075
  className,
8065
- html: field.type === 'html' ? true : null
8076
+ options: field.type === 'html' ? {html: true} : null
8066
8077
  // toggled: true
8067
8078
  }, field.amis, {name: field.name}));
8068
8079
  }
@@ -8576,11 +8587,10 @@ async function getTableApi(mainObject, fields, options){
8576
8587
  if(api.data.$self._isRelated){
8577
8588
  const self = api.data.$self;
8578
8589
  const relatedKey = self.relatedKey;
8579
- const recordId = self.recordId;
8580
8590
  const refField = self.uiSchema.fields[relatedKey];
8581
8591
  const masterRecord = self._master.record;
8582
8592
  const masterObjectName = self._master.objectName;
8583
- let relatedValue = recordId;
8593
+ let relatedValue = self._master.recordId;
8584
8594
  if(refField.reference_to_field && refField.reference_to_field != '_id'){
8585
8595
  relatedValue = masterRecord[refField.reference_to_field]
8586
8596
  }
@@ -13943,13 +13953,6 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
13943
13953
  });
13944
13954
  }); };
13945
13955
 
13946
- /*
13947
- * @Author: baozhoutao@steedos.com
13948
- * @Date: 2022-12-08 10:32:17
13949
- * @LastEditors: baozhoutao@steedos.com
13950
- * @LastEditTime: 2023-04-13 18:40:42
13951
- * @Description:
13952
- */
13953
13956
  var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void 0, function () {
13954
13957
  var className, $schema, appId, _a, objectApiName, body, schema;
13955
13958
  return __generator(this, function (_b) {
@@ -14533,7 +14536,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
14533
14536
  schemaApi: {
14534
14537
  "method": "get",
14535
14538
  "url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
14536
- "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 "),
14537
14540
  "headers": {
14538
14541
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
14539
14542
  }
@@ -14982,7 +14985,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
14982
14985
  * @Author: baozhoutao@steedos.com
14983
14986
  * @Date: 2022-09-01 14:44:57
14984
14987
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
14985
- * @LastEditTime: 2023-05-17 17:26:22
14988
+ * @LastEditTime: 2023-05-18 22:39:31
14986
14989
  * @Description:
14987
14990
  */
14988
14991
  var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void 0, function () {
@@ -15042,7 +15045,7 @@ var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void
15042
15045
  },
15043
15046
  {
15044
15047
  "type": "button",
15045
- "visibleOn": "${window:innerWidth < 768 && window:historyPaths.length > 1}",
15048
+ "visibleOn": "${window:innerWidth < 768 && (window:historyPaths.length > 1 || window:historyPaths[0].params.record_id)}",
15046
15049
  "className": "flex",
15047
15050
  "onEvent": {
15048
15051
  "click": {
@@ -15068,7 +15071,7 @@ var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void
15068
15071
  "className": 'block h-10 w-auto mr-4',
15069
15072
  "type": "tpl",
15070
15073
  "tpl": "<a href='/app' class='flex items-center '><img class='block h-10 w-auto' src='".concat(logoSrc, "'></a>"),
15071
- "hiddenOn": "${window:innerWidth < 768 && window:historyPaths.length > 1}"
15074
+ "hiddenOn": "${window:innerWidth < 768 && (window:historyPaths.length > 1 || window:historyPaths[0].params.record_id)}"
15072
15075
  },
15073
15076
  ],
15074
15077
  },