@steedos-widgets/sortable 3.6.14 → 6.3.0-beta.10

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.
@@ -54141,10 +54141,23 @@ function getNameTpl(field, ctx){
54141
54141
  if(ctx && ctx.isLookup){
54142
54142
  linkTarget = "target='_blank'";
54143
54143
  }
54144
+ let nameLabel = field.name;
54145
+ //若字段类型是lookup,则按照相关表tpl的label规则显示;若是其它类型,则显示_display或字段本身的值
54146
+ if (field.type == "lookup") {
54147
+ if(!field.reference_to && (field.optionsFunction || field._optionsFunction || field.options)){
54148
+ if(!field.isTableField){
54149
+ nameLabel = `\${${field.name}__label}`;
54150
+ }
54151
+ } else {
54152
+ nameLabel = `\${_display.${field.name}.label}`;
54153
+ }
54154
+ } else {
54155
+ nameLabel = `\${_display.${field.name} || ${field.name}}`;
54156
+ }
54144
54157
  if(ctx.isRelated && window.innerWidth >= 768){
54145
- return `<a href="${href}" ${linkTarget} onclick="return false;">\${${field.name} | raw}</a>`
54158
+ return `<a href="${href}" ${linkTarget} onclick="return false;">\${${nameLabel} | raw}</a>`
54146
54159
  }else {
54147
- return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
54160
+ return `<a href="${href}" ${linkTarget}>\${${nameLabel} | raw}</a>`
54148
54161
  }
54149
54162
  }
54150
54163
 
@@ -54269,7 +54282,7 @@ function getLocationTpl(field){
54269
54282
  }
54270
54283
 
54271
54284
  async function getFieldTpl (field, options){
54272
- if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLookLabel){
54285
+ if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLookLabel && field.multiple !== true){
54273
54286
  return getNameTpl(field, options)
54274
54287
  }
54275
54288
  switch (field.type) {
@@ -55658,7 +55671,7 @@ async function getTableColumns(object, fields, options){
55658
55671
  "title": "&nbsp;",
55659
55672
  "headerClassName": "hidden",
55660
55673
  "size": "lg",
55661
- "bodyClassName": "p-0 m-0",
55674
+ "bodyClassName": "p-0 m-0 bg-gray-100",
55662
55675
  "closeOnEsc": true,
55663
55676
  "closeOnOutside": true,
55664
55677
  "resizable": true,
@@ -56520,7 +56533,8 @@ const getSchema$5 = async (uiSchema, ctx) => {
56520
56533
  type: 'button',
56521
56534
  actionType: 'confirm',
56522
56535
  label: instance.t('frontend_form_save'),
56523
- primary: true
56536
+ primary: true,
56537
+ close: `object_actions_drawer_${uiSchema.name}`
56524
56538
  },
56525
56539
  ]
56526
56540
  }
@@ -58738,7 +58752,7 @@ async function getObjectFilter(objectSchema, fields, options) {
58738
58752
  * @Author: baozhoutao@steedos.com
58739
58753
  * @Date: 2022-07-05 15:55:39
58740
58754
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
58741
- * @LastEditTime: 2024-02-23 16:37:06
58755
+ * @LastEditTime: 2024-04-26 16:46:44
58742
58756
  * @Description:
58743
58757
  */
58744
58758
 
@@ -58971,37 +58985,44 @@ async function getListSchema(
58971
58985
  * 本次存储代码段
58972
58986
  */
58973
58987
  try {
58974
- const listViewPropsStoreKey = location.pathname + "/crud";
58975
- let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
58976
- /**
58977
- * localListViewProps规范来自crud请求api中api.data.$self参数值的。
58978
- * 比如:{"perPage":20,"page":1,"__searchable__name":"7","__searchable__between__n1__c":[null,null],"filter":[["name","contains","a"]]}
58979
- * __searchable__...:顶部放大镜搜索条件
58980
- * filter:右侧过滤器
58981
- * perPage:每页条数
58982
- * page:当前页码
58983
- * orderBy:排序字段
58984
- * orderDir:排序方向
58985
- */
58986
- if (localListViewProps) {
58987
- localListViewProps = JSON.parse(localListViewProps);
58988
- // localListViewProps.perPage = 3;
58989
- let listSchema = {};
58990
- if(localListViewProps.orderBy){
58991
- listSchema.orderBy = localListViewProps.orderBy;
58992
- }
58993
- if(localListViewProps.orderDir){
58994
- listSchema.orderDir = localListViewProps.orderDir;
58995
- }
58988
+ const listViewPropsStoreKey = location.pathname + "/crud";
58989
+ let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
58990
+ /**
58991
+ * localListViewProps规范来自crud请求api中api.data.$self参数值的。
58992
+ * 比如:{"perPage":20,"page":1,"__searchable__name":"7","__searchable__between__n1__c":[null,null],"filter":[["name","contains","a"]]}
58993
+ * __searchable__...:顶部放大镜搜索条件
58994
+ * filter:右侧过滤器
58995
+ * perPage:每页条数
58996
+ * page:当前页码
58997
+ * orderBy:排序字段
58998
+ * orderDir:排序方向
58999
+ */
59000
+ if (localListViewProps) {
59001
+ localListViewProps = JSON.parse(localListViewProps);
59002
+ // localListViewProps.perPage = 3;
59003
+ let listSchema = {};
59004
+ if (localListViewProps.orderBy) {
59005
+ listSchema.orderBy = localListViewProps.orderBy;
59006
+ }
59007
+ if (localListViewProps.orderDir) {
59008
+ listSchema.orderDir = localListViewProps.orderDir;
59009
+ }
58996
59010
 
58997
- if(localListViewProps.perPage){
58998
- listSchema.perPage = localListViewProps.perPage;
59011
+ if (localListViewProps.perPage) {
59012
+ listSchema.perPage = localListViewProps.perPage;
59013
+ }
59014
+ defaults.listSchema = lodash.exports.defaultsDeep({}, listSchema, defaults.listSchema || {});
58999
59015
  }
59000
- defaults.listSchema = lodash.exports.defaultsDeep({}, listSchema, defaults.listSchema || {});
59001
- }
59002
59016
  }
59003
59017
  catch (ex) {
59004
- console.error("本地存储中crud参数解析异常:", ex);
59018
+ console.error("本地存储中crud参数解析异常:", ex);
59019
+ }
59020
+
59021
+ if (window.innerWidth > 768) {
59022
+ // 列表视图组件PC端高度自动计算实现满屏效果,手机端不需要满屏效果,所以不用autofillheight,且允许重写微页面中重新组件autoFillHeight属性
59023
+ defaults.listSchema = lodash.exports.defaultsDeep({}, defaults.listSchema || {}, {
59024
+ autoFillHeight: true
59025
+ });
59005
59026
  }
59006
59027
 
59007
59028
  ctx.defaults = defaults;
@@ -59562,7 +59583,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
59562
59583
  });
59563
59584
 
59564
59585
  // 把自动填充规则中依赖的字段也加到api请求中
59565
- let autoFillMapping = !field.multiple && field.auto_fill_mapping;
59586
+ let autoFillMapping = field.auto_fill_mapping;
59566
59587
  if (autoFillMapping && autoFillMapping.length) {
59567
59588
  autoFillMapping.forEach(function (item) {
59568
59589
  if(!lodash.exports.find(tableFields, function(f){
@@ -59712,7 +59733,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
59712
59733
  // 如果当前元素不是数组,则处理该元素
59713
59734
  // 下面正则用于匹配amis公式\${}
59714
59735
  if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
59715
- arr[i] = currentAmis.evaluate(arr[i], api.data.$);
59736
+ arr[i] = currentAmis.evaluate(arr[i], api.data.$self);
59716
59737
  }
59717
59738
  }
59718
59739
  }
@@ -60034,7 +60055,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
60034
60055
  ];
60035
60056
 
60036
60057
  // 把自动填充规则中依赖的字段也加到api请求中
60037
- let autoFillMapping = !field.multiple && field.auto_fill_mapping;
60058
+ let autoFillMapping = field.auto_fill_mapping;
60038
60059
  if (autoFillMapping && autoFillMapping.length) {
60039
60060
  autoFillMapping.forEach(function (item) {
60040
60061
  queryFields.push(refObjectConfig.fields[item.from]);
@@ -60129,7 +60150,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
60129
60150
  // 如果当前元素不是数组,则处理该元素
60130
60151
  // 下面正则用于匹配amis公式\${}
60131
60152
  if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
60132
- arr[i] = currentAmis.evaluate(arr[i], api.data.$);
60153
+ arr[i] = currentAmis.evaluate(arr[i], api.data.$self);
60133
60154
  }
60134
60155
  }
60135
60156
  }
@@ -60276,14 +60297,25 @@ async function getApi(object, recordId, fields, options){
60276
60297
  }
60277
60298
 
60278
60299
  async function getAutoFill(field, refObject) {
60279
- let autoFillMapping = !field.multiple && field.auto_fill_mapping;
60300
+ let autoFillMapping = field.auto_fill_mapping;
60280
60301
  if (autoFillMapping && autoFillMapping.length) {
60281
60302
  let fillMapping = {};
60303
+ if (field.multiple) {
60304
+ autoFillMapping.forEach(function (item) {
60305
+ //from的字段类型为lookup、master_detail、select时,需要保留数组格式;其他类型需要转变为字符串格式
60306
+ if (lodash.exports.includes(["lookup","master_detail","select"], refObject.fields[item.from].type)) {
60307
+ fillMapping[item.to] = `\${items | pick:${item.from}}`;
60308
+ } else {
60309
+ fillMapping[item.to] = `\${items | pick:${item.from} | join}`;
60310
+ }
60311
+ });
60312
+ }else {
60313
+ autoFillMapping.forEach(function (item) {
60314
+ fillMapping[item.to] = `\${${item.from}}`;
60315
+ });
60316
+ }
60282
60317
  // let fieldsForApi = [];
60283
- autoFillMapping.forEach(function (item) {
60284
- fillMapping[item.to] = `\${${item.from}}`;
60285
- // fieldsForApi.push(item.from);
60286
- });
60318
+ // fieldsForApi.push(item.from);
60287
60319
  // let api = {
60288
60320
  // // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
60289
60321
  // "url": `/api/v1/${refObject.name}/\${${field.name}}?fields=${JSON.stringify(fieldsForApi)}`,
@@ -60385,7 +60417,7 @@ async function lookupToAmis(field, readonly, ctx){
60385
60417
  amisSchema = lodash.exports.defaultsDeep({}, pageAmisSchema, amisSchema);
60386
60418
  }
60387
60419
  }
60388
- const autoFill = await getAutoFill(field);
60420
+ const autoFill = await getAutoFill(field, refObject);
60389
60421
  if(autoFill){
60390
60422
  amisSchema.autoFill = autoFill;
60391
60423
  // 这里不配置initAutoFill值,按amis规则initAutoFill默认值为fillIfNotSet处理--需要amis sdk 版本 > 3.6.3-patch.6(不包括)版本