@steedos-widgets/sortable 3.6.13 → 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) {
@@ -54411,7 +54424,7 @@ async function getFindQuery(object, recordId, fields, options){
54411
54424
  function getApi$2 (isMobile){
54412
54425
  if(isMobile);else {
54413
54426
  // return __meteor_runtime_config__.ROOT_URL_PATH_PREFIX + "/graphql"
54414
- return `\${context.rootUrl}/graphql?reload=\${additionalFilters}`
54427
+ return `\${context.rootUrl}/graphql?reload=\${additionalFilters|join}`
54415
54428
  }
54416
54429
  }
54417
54430
 
@@ -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
  }
@@ -58326,6 +58340,10 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
58326
58340
  // const scope = event.context.scoped;
58327
58341
  // 如果点击过顶部搜索栏表单的取消按钮,会把此处event.data.__super.__super.__super中的搜索表单项的所有字段设置为null
58328
58342
  // 点击取消按钮后继续在表单项中输入过滤条件且最后没有点击回车按键或点击表单项搜索按钮的话,在快速搜索中点击回车按钮提交搜索会所顶部搜索表单中的字段值清空
58343
+ let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
58344
+ if(!filterForm){
58345
+ return;
58346
+ }
58329
58347
  let isLookup = event.data.isLookup;
58330
58348
  let __lookupField = event.data.__lookupField;
58331
58349
  let __changedFilterFormValuesKey = "__changedFilterFormValues";
@@ -58336,9 +58354,8 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
58336
58354
  }
58337
58355
  __changedFilterFormValuesKey += lookupTag;
58338
58356
  }
58339
- let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
58340
58357
  setTimeout(function(){
58341
- filterForm.setValues(event.data[__changedFilterFormValuesKey]);
58358
+ filterForm && filterForm.setValues(event.data[__changedFilterFormValuesKey]);
58342
58359
  }, 500);
58343
58360
  `;
58344
58361
 
@@ -58735,7 +58752,7 @@ async function getObjectFilter(objectSchema, fields, options) {
58735
58752
  * @Author: baozhoutao@steedos.com
58736
58753
  * @Date: 2022-07-05 15:55:39
58737
58754
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
58738
- * @LastEditTime: 2024-02-23 16:37:06
58755
+ * @LastEditTime: 2024-04-26 16:46:44
58739
58756
  * @Description:
58740
58757
  */
58741
58758
 
@@ -58968,37 +58985,44 @@ async function getListSchema(
58968
58985
  * 本次存储代码段
58969
58986
  */
58970
58987
  try {
58971
- const listViewPropsStoreKey = location.pathname + "/crud";
58972
- let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
58973
- /**
58974
- * localListViewProps规范来自crud请求api中api.data.$self参数值的。
58975
- * 比如:{"perPage":20,"page":1,"__searchable__name":"7","__searchable__between__n1__c":[null,null],"filter":[["name","contains","a"]]}
58976
- * __searchable__...:顶部放大镜搜索条件
58977
- * filter:右侧过滤器
58978
- * perPage:每页条数
58979
- * page:当前页码
58980
- * orderBy:排序字段
58981
- * orderDir:排序方向
58982
- */
58983
- if (localListViewProps) {
58984
- localListViewProps = JSON.parse(localListViewProps);
58985
- // localListViewProps.perPage = 3;
58986
- let listSchema = {};
58987
- if(localListViewProps.orderBy){
58988
- listSchema.orderBy = localListViewProps.orderBy;
58989
- }
58990
- if(localListViewProps.orderDir){
58991
- listSchema.orderDir = localListViewProps.orderDir;
58992
- }
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
+ }
58993
59010
 
58994
- if(localListViewProps.perPage){
58995
- listSchema.perPage = localListViewProps.perPage;
59011
+ if (localListViewProps.perPage) {
59012
+ listSchema.perPage = localListViewProps.perPage;
59013
+ }
59014
+ defaults.listSchema = lodash.exports.defaultsDeep({}, listSchema, defaults.listSchema || {});
58996
59015
  }
58997
- defaults.listSchema = lodash.exports.defaultsDeep({}, listSchema, defaults.listSchema || {});
58998
- }
58999
59016
  }
59000
59017
  catch (ex) {
59001
- 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
+ });
59002
59026
  }
59003
59027
 
59004
59028
  ctx.defaults = defaults;
@@ -59559,7 +59583,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
59559
59583
  });
59560
59584
 
59561
59585
  // 把自动填充规则中依赖的字段也加到api请求中
59562
- let autoFillMapping = !field.multiple && field.auto_fill_mapping;
59586
+ let autoFillMapping = field.auto_fill_mapping;
59563
59587
  if (autoFillMapping && autoFillMapping.length) {
59564
59588
  autoFillMapping.forEach(function (item) {
59565
59589
  if(!lodash.exports.find(tableFields, function(f){
@@ -59709,7 +59733,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
59709
59733
  // 如果当前元素不是数组,则处理该元素
59710
59734
  // 下面正则用于匹配amis公式\${}
59711
59735
  if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
59712
- arr[i] = currentAmis.evaluate(arr[i], api.data.$);
59736
+ arr[i] = currentAmis.evaluate(arr[i], api.data.$self);
59713
59737
  }
59714
59738
  }
59715
59739
  }
@@ -60031,7 +60055,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
60031
60055
  ];
60032
60056
 
60033
60057
  // 把自动填充规则中依赖的字段也加到api请求中
60034
- let autoFillMapping = !field.multiple && field.auto_fill_mapping;
60058
+ let autoFillMapping = field.auto_fill_mapping;
60035
60059
  if (autoFillMapping && autoFillMapping.length) {
60036
60060
  autoFillMapping.forEach(function (item) {
60037
60061
  queryFields.push(refObjectConfig.fields[item.from]);
@@ -60126,7 +60150,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
60126
60150
  // 如果当前元素不是数组,则处理该元素
60127
60151
  // 下面正则用于匹配amis公式\${}
60128
60152
  if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
60129
- arr[i] = currentAmis.evaluate(arr[i], api.data.$);
60153
+ arr[i] = currentAmis.evaluate(arr[i], api.data.$self);
60130
60154
  }
60131
60155
  }
60132
60156
  }
@@ -60273,14 +60297,25 @@ async function getApi(object, recordId, fields, options){
60273
60297
  }
60274
60298
 
60275
60299
  async function getAutoFill(field, refObject) {
60276
- let autoFillMapping = !field.multiple && field.auto_fill_mapping;
60300
+ let autoFillMapping = field.auto_fill_mapping;
60277
60301
  if (autoFillMapping && autoFillMapping.length) {
60278
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
+ }
60279
60317
  // let fieldsForApi = [];
60280
- autoFillMapping.forEach(function (item) {
60281
- fillMapping[item.to] = `\${${item.from}}`;
60282
- // fieldsForApi.push(item.from);
60283
- });
60318
+ // fieldsForApi.push(item.from);
60284
60319
  // let api = {
60285
60320
  // // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
60286
60321
  // "url": `/api/v1/${refObject.name}/\${${field.name}}?fields=${JSON.stringify(fieldsForApi)}`,
@@ -60382,7 +60417,7 @@ async function lookupToAmis(field, readonly, ctx){
60382
60417
  amisSchema = lodash.exports.defaultsDeep({}, pageAmisSchema, amisSchema);
60383
60418
  }
60384
60419
  }
60385
- const autoFill = await getAutoFill(field);
60420
+ const autoFill = await getAutoFill(field, refObject);
60386
60421
  if(autoFill){
60387
60422
  amisSchema.autoFill = autoFill;
60388
60423
  // 这里不配置initAutoFill值,按amis规则initAutoFill默认值为fillIfNotSet处理--需要amis sdk 版本 > 3.6.3-patch.6(不包括)版本