@steedos-widgets/amis-object 6.3.0-beta.6 → 6.3.0-beta.8

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.
@@ -441,6 +441,17 @@ fieldset.antd-Collapse > legend{
441
441
  .antd-Tree .antd-Tree-list .antd-Tree-item .antd-Tree-itemLabel-item .antd-Tree-itemText >.antd-Wrapper{
442
442
  width: 100%;
443
443
  }
444
+
445
+ @media (max-width: 768px){
446
+ .antd-Modal-footer{
447
+ flex-wrap: wrap;
448
+ }
449
+ .antd-Modal-footer .antd-Dialog-info{
450
+ flex-basis: 100%;
451
+ text-align: center;
452
+ margin-bottom: 0.5rem;
453
+ }
454
+ }
444
455
  .ant-dropdown{
445
456
  z-index: 1400;
446
457
  }
@@ -3751,10 +3751,23 @@ function getNameTpl(field, ctx){
3751
3751
  if(ctx && ctx.isLookup){
3752
3752
  linkTarget = "target='_blank'";
3753
3753
  }
3754
+ let nameLabel = field.name;
3755
+ //若字段类型是lookup,则按照相关表tpl的label规则显示;若是其它类型,则显示_display或字段本身的值
3756
+ if (field.type == "lookup") {
3757
+ if(!field.reference_to && (field.optionsFunction || field._optionsFunction || field.options)){
3758
+ if(!field.isTableField){
3759
+ nameLabel = `\${${field.name}__label}`;
3760
+ }
3761
+ } else {
3762
+ nameLabel = `\${_display.${field.name}.label}`;
3763
+ }
3764
+ } else {
3765
+ nameLabel = `\${_display.${field.name} || ${field.name}}`;
3766
+ }
3754
3767
  if(ctx.isRelated && window.innerWidth >= 768){
3755
- return `<a href="${href}" ${linkTarget} onclick="return false;">\${${field.name} | raw}</a>`
3768
+ return `<a href="${href}" ${linkTarget} onclick="return false;">\${${nameLabel} | raw}</a>`
3756
3769
  }else {
3757
- return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
3770
+ return `<a href="${href}" ${linkTarget}>\${${nameLabel} | raw}</a>`
3758
3771
  }
3759
3772
  }
3760
3773
 
@@ -3879,7 +3892,7 @@ function getLocationTpl(field){
3879
3892
  }
3880
3893
 
3881
3894
  async function getFieldTpl (field, options){
3882
- if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLookLabel){
3895
+ if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLookLabel && field.multiple !== true){
3883
3896
  return getNameTpl(field, options)
3884
3897
  }
3885
3898
  switch (field.type) {
@@ -5352,7 +5365,7 @@ async function getTableColumns$1(object, fields, options){
5352
5365
  var file_id = data.versions && data.versions[0] && data.versions[0]._id;
5353
5366
  window.previewFile && window.previewFile({file_name, file_id});
5354
5367
  `;
5355
- columnItem = {
5368
+ columnItem = Object.assign({}, {
5356
5369
  "type": "button",
5357
5370
  "label": `<%=data.versions ? data.name : "${field.label}"%>`,
5358
5371
  className,
@@ -5384,7 +5397,7 @@ async function getTableColumns$1(object, fields, options){
5384
5397
  ]
5385
5398
  }
5386
5399
  }
5387
- };
5400
+ }, fieldAmis);
5388
5401
  }else if(field.type === 'toggle'){
5389
5402
  columnItem = Object.assign({}, {
5390
5403
  type: "switch",
@@ -6436,6 +6449,19 @@ function getReadonlyFormAdaptor(object, fields, options){
6436
6449
  // })
6437
6450
 
6438
6451
  var fieldNames = _$1__namespace.map(fields, function(n){return n.name});
6452
+ var nameField = object.fields[object.NAME_FIELD_KEY];
6453
+ let nameLabel = nameField.name;
6454
+ if (nameField.type == "lookup") {
6455
+ if(!nameField.reference_to && (nameField.optionsFunction || nameField._optionsFunction || nameField.options)){
6456
+ if(!nameField.isTableField){
6457
+ nameLabel = `record.${nameField.name}__label`;
6458
+ }
6459
+ } else {
6460
+ nameLabel = `record._display.${nameField.name}.label`;
6461
+ }
6462
+ } else {
6463
+ nameLabel = `record._display.${nameField.name} || record.${nameField.name}`;
6464
+ }
6439
6465
  return `
6440
6466
  if(payload.data.data.length === 0){
6441
6467
  var isEditor = !!${options && options.isEditor};
@@ -6477,8 +6503,7 @@ function getReadonlyFormAdaptor(object, fields, options){
6477
6503
  payload.data = data;
6478
6504
  payload.data.__objectName = "${object.name}";
6479
6505
  payload.data.record = record;
6480
-
6481
- payload.data.NAME_FIELD_VALUE = record.${object.NAME_FIELD_KEY || 'name'};
6506
+ payload.data.NAME_FIELD_VALUE = ${nameLabel} || record.name;
6482
6507
  payload.data._master = {
6483
6508
  record: record,
6484
6509
  objectName: "${object.name}",
@@ -15038,7 +15063,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
15038
15063
  var optionsFilters = [["${valueFieldKey}", optionsFiltersOp, []]];
15039
15064
  if (defaultValue && !api.data.$term) {
15040
15065
  const defaultValueOptionsQueryData = ${JSON.stringify(defaultValueOptionsQueryData)};
15041
- const defaultValueOptionsQuery = defaultValueOptionsQueryData?.query?.replace(/^{/,"").replace(/}$/,"");
15066
+ const defaultValueOptionsQuery = defaultValueOptionsQueryData && defaultValueOptionsQueryData.query && defaultValueOptionsQueryData.query.replace(/^{/,"").replace(/}$/,"");
15042
15067
  // 字段值单独请求,没值的时候在请求中返回空
15043
15068
  optionsFilters = [["${valueFieldKey}", optionsFiltersOp, defaultValue]];
15044
15069
  if(filters.length > 0){