@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.
@@ -20446,10 +20446,23 @@
20446
20446
  if(ctx && ctx.isLookup){
20447
20447
  linkTarget = "target='_blank'";
20448
20448
  }
20449
+ let nameLabel = field.name;
20450
+ //若字段类型是lookup,则按照相关表tpl的label规则显示;若是其它类型,则显示_display或字段本身的值
20451
+ if (field.type == "lookup") {
20452
+ if(!field.reference_to && (field.optionsFunction || field._optionsFunction || field.options)){
20453
+ if(!field.isTableField){
20454
+ nameLabel = `\${${field.name}__label}`;
20455
+ }
20456
+ } else {
20457
+ nameLabel = `\${_display.${field.name}.label}`;
20458
+ }
20459
+ } else {
20460
+ nameLabel = `\${_display.${field.name} || ${field.name}}`;
20461
+ }
20449
20462
  if(ctx.isRelated && window.innerWidth >= 768){
20450
- return `<a href="${href}" ${linkTarget} onclick="return false;">\${${field.name} | raw}</a>`
20463
+ return `<a href="${href}" ${linkTarget} onclick="return false;">\${${nameLabel} | raw}</a>`
20451
20464
  }else {
20452
- return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
20465
+ return `<a href="${href}" ${linkTarget}>\${${nameLabel} | raw}</a>`
20453
20466
  }
20454
20467
  }
20455
20468
 
@@ -20574,7 +20587,7 @@
20574
20587
  }
20575
20588
 
20576
20589
  async function getFieldTpl (field, options){
20577
- if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLookLabel){
20590
+ if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLookLabel && field.multiple !== true){
20578
20591
  return getNameTpl(field, options)
20579
20592
  }
20580
20593
  switch (field.type) {
@@ -20716,7 +20729,7 @@
20716
20729
  function getApi$2 (isMobile){
20717
20730
  if(isMobile);else {
20718
20731
  // return __meteor_runtime_config__.ROOT_URL_PATH_PREFIX + "/graphql"
20719
- return `\${context.rootUrl}/graphql?reload=\${additionalFilters}`
20732
+ return `\${context.rootUrl}/graphql?reload=\${additionalFilters|join}`
20720
20733
  }
20721
20734
  }
20722
20735
 
@@ -21963,7 +21976,7 @@
21963
21976
  "title": "&nbsp;",
21964
21977
  "headerClassName": "hidden",
21965
21978
  "size": "lg",
21966
- "bodyClassName": "p-0 m-0",
21979
+ "bodyClassName": "p-0 m-0 bg-gray-100",
21967
21980
  "closeOnEsc": true,
21968
21981
  "closeOnOutside": true,
21969
21982
  "resizable": true,
@@ -22825,7 +22838,8 @@
22825
22838
  type: 'button',
22826
22839
  actionType: 'confirm',
22827
22840
  label: instance.t('frontend_form_save'),
22828
- primary: true
22841
+ primary: true,
22842
+ close: `object_actions_drawer_${uiSchema.name}`
22829
22843
  },
22830
22844
  ]
22831
22845
  }
@@ -24631,6 +24645,10 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24631
24645
  // const scope = event.context.scoped;
24632
24646
  // 如果点击过顶部搜索栏表单的取消按钮,会把此处event.data.__super.__super.__super中的搜索表单项的所有字段设置为null
24633
24647
  // 点击取消按钮后继续在表单项中输入过滤条件且最后没有点击回车按键或点击表单项搜索按钮的话,在快速搜索中点击回车按钮提交搜索会所顶部搜索表单中的字段值清空
24648
+ let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
24649
+ if(!filterForm){
24650
+ return;
24651
+ }
24634
24652
  let isLookup = event.data.isLookup;
24635
24653
  let __lookupField = event.data.__lookupField;
24636
24654
  let __changedFilterFormValuesKey = "__changedFilterFormValues";
@@ -24641,9 +24659,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24641
24659
  }
24642
24660
  __changedFilterFormValuesKey += lookupTag;
24643
24661
  }
24644
- let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
24645
24662
  setTimeout(function(){
24646
- filterForm.setValues(event.data[__changedFilterFormValuesKey]);
24663
+ filterForm && filterForm.setValues(event.data[__changedFilterFormValuesKey]);
24647
24664
  }, 500);
24648
24665
  `;
24649
24666
 
@@ -25040,7 +25057,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25040
25057
  * @Author: baozhoutao@steedos.com
25041
25058
  * @Date: 2022-07-05 15:55:39
25042
25059
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
25043
- * @LastEditTime: 2024-02-23 16:37:06
25060
+ * @LastEditTime: 2024-04-26 16:46:44
25044
25061
  * @Description:
25045
25062
  */
25046
25063
 
@@ -25273,37 +25290,44 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25273
25290
  * 本次存储代码段
25274
25291
  */
25275
25292
  try {
25276
- const listViewPropsStoreKey = location.pathname + "/crud";
25277
- let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
25278
- /**
25279
- * localListViewProps规范来自crud请求api中api.data.$self参数值的。
25280
- * 比如:{"perPage":20,"page":1,"__searchable__name":"7","__searchable__between__n1__c":[null,null],"filter":[["name","contains","a"]]}
25281
- * __searchable__...:顶部放大镜搜索条件
25282
- * filter:右侧过滤器
25283
- * perPage:每页条数
25284
- * page:当前页码
25285
- * orderBy:排序字段
25286
- * orderDir:排序方向
25287
- */
25288
- if (localListViewProps) {
25289
- localListViewProps = JSON.parse(localListViewProps);
25290
- // localListViewProps.perPage = 3;
25291
- let listSchema = {};
25292
- if(localListViewProps.orderBy){
25293
- listSchema.orderBy = localListViewProps.orderBy;
25294
- }
25295
- if(localListViewProps.orderDir){
25296
- listSchema.orderDir = localListViewProps.orderDir;
25297
- }
25293
+ const listViewPropsStoreKey = location.pathname + "/crud";
25294
+ let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
25295
+ /**
25296
+ * localListViewProps规范来自crud请求api中api.data.$self参数值的。
25297
+ * 比如:{"perPage":20,"page":1,"__searchable__name":"7","__searchable__between__n1__c":[null,null],"filter":[["name","contains","a"]]}
25298
+ * __searchable__...:顶部放大镜搜索条件
25299
+ * filter:右侧过滤器
25300
+ * perPage:每页条数
25301
+ * page:当前页码
25302
+ * orderBy:排序字段
25303
+ * orderDir:排序方向
25304
+ */
25305
+ if (localListViewProps) {
25306
+ localListViewProps = JSON.parse(localListViewProps);
25307
+ // localListViewProps.perPage = 3;
25308
+ let listSchema = {};
25309
+ if (localListViewProps.orderBy) {
25310
+ listSchema.orderBy = localListViewProps.orderBy;
25311
+ }
25312
+ if (localListViewProps.orderDir) {
25313
+ listSchema.orderDir = localListViewProps.orderDir;
25314
+ }
25298
25315
 
25299
- if(localListViewProps.perPage){
25300
- listSchema.perPage = localListViewProps.perPage;
25316
+ if (localListViewProps.perPage) {
25317
+ listSchema.perPage = localListViewProps.perPage;
25318
+ }
25319
+ defaults.listSchema = lodash.exports.defaultsDeep({}, listSchema, defaults.listSchema || {});
25301
25320
  }
25302
- defaults.listSchema = lodash.exports.defaultsDeep({}, listSchema, defaults.listSchema || {});
25303
- }
25304
25321
  }
25305
25322
  catch (ex) {
25306
- console.error("本地存储中crud参数解析异常:", ex);
25323
+ console.error("本地存储中crud参数解析异常:", ex);
25324
+ }
25325
+
25326
+ if (window.innerWidth > 768) {
25327
+ // 列表视图组件PC端高度自动计算实现满屏效果,手机端不需要满屏效果,所以不用autofillheight,且允许重写微页面中重新组件autoFillHeight属性
25328
+ defaults.listSchema = lodash.exports.defaultsDeep({}, defaults.listSchema || {}, {
25329
+ autoFillHeight: true
25330
+ });
25307
25331
  }
25308
25332
 
25309
25333
  ctx.defaults = defaults;
@@ -25864,7 +25888,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25864
25888
  });
25865
25889
 
25866
25890
  // 把自动填充规则中依赖的字段也加到api请求中
25867
- let autoFillMapping = !field.multiple && field.auto_fill_mapping;
25891
+ let autoFillMapping = field.auto_fill_mapping;
25868
25892
  if (autoFillMapping && autoFillMapping.length) {
25869
25893
  autoFillMapping.forEach(function (item) {
25870
25894
  if(!lodash.exports.find(tableFields, function(f){
@@ -26014,7 +26038,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
26014
26038
  // 如果当前元素不是数组,则处理该元素
26015
26039
  // 下面正则用于匹配amis公式\${}
26016
26040
  if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
26017
- arr[i] = currentAmis.evaluate(arr[i], api.data.$);
26041
+ arr[i] = currentAmis.evaluate(arr[i], api.data.$self);
26018
26042
  }
26019
26043
  }
26020
26044
  }
@@ -26336,7 +26360,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
26336
26360
  ];
26337
26361
 
26338
26362
  // 把自动填充规则中依赖的字段也加到api请求中
26339
- let autoFillMapping = !field.multiple && field.auto_fill_mapping;
26363
+ let autoFillMapping = field.auto_fill_mapping;
26340
26364
  if (autoFillMapping && autoFillMapping.length) {
26341
26365
  autoFillMapping.forEach(function (item) {
26342
26366
  queryFields.push(refObjectConfig.fields[item.from]);
@@ -26431,7 +26455,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
26431
26455
  // 如果当前元素不是数组,则处理该元素
26432
26456
  // 下面正则用于匹配amis公式\${}
26433
26457
  if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
26434
- arr[i] = currentAmis.evaluate(arr[i], api.data.$);
26458
+ arr[i] = currentAmis.evaluate(arr[i], api.data.$self);
26435
26459
  }
26436
26460
  }
26437
26461
  }
@@ -26578,14 +26602,25 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
26578
26602
  }
26579
26603
 
26580
26604
  async function getAutoFill(field, refObject) {
26581
- let autoFillMapping = !field.multiple && field.auto_fill_mapping;
26605
+ let autoFillMapping = field.auto_fill_mapping;
26582
26606
  if (autoFillMapping && autoFillMapping.length) {
26583
26607
  let fillMapping = {};
26608
+ if (field.multiple) {
26609
+ autoFillMapping.forEach(function (item) {
26610
+ //from的字段类型为lookup、master_detail、select时,需要保留数组格式;其他类型需要转变为字符串格式
26611
+ if (lodash.exports.includes(["lookup","master_detail","select"], refObject.fields[item.from].type)) {
26612
+ fillMapping[item.to] = `\${items | pick:${item.from}}`;
26613
+ } else {
26614
+ fillMapping[item.to] = `\${items | pick:${item.from} | join}`;
26615
+ }
26616
+ });
26617
+ }else {
26618
+ autoFillMapping.forEach(function (item) {
26619
+ fillMapping[item.to] = `\${${item.from}}`;
26620
+ });
26621
+ }
26584
26622
  // let fieldsForApi = [];
26585
- autoFillMapping.forEach(function (item) {
26586
- fillMapping[item.to] = `\${${item.from}}`;
26587
- // fieldsForApi.push(item.from);
26588
- });
26623
+ // fieldsForApi.push(item.from);
26589
26624
  // let api = {
26590
26625
  // // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
26591
26626
  // "url": `/api/v1/${refObject.name}/\${${field.name}}?fields=${JSON.stringify(fieldsForApi)}`,
@@ -26687,7 +26722,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
26687
26722
  amisSchema = lodash.exports.defaultsDeep({}, pageAmisSchema, amisSchema);
26688
26723
  }
26689
26724
  }
26690
- const autoFill = await getAutoFill(field);
26725
+ const autoFill = await getAutoFill(field, refObject);
26691
26726
  if(autoFill){
26692
26727
  amisSchema.autoFill = autoFill;
26693
26728
  // 这里不配置initAutoFill值,按amis规则initAutoFill默认值为fillIfNotSet处理--需要amis sdk 版本 > 3.6.3-patch.6(不包括)版本
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos-widgets/sortable",
3
- "version": "3.6.13",
3
+ "version": "6.3.0-beta.10",
4
4
  "main": "dist/sortable.cjs.js",
5
5
  "module": "dist/sortable.esm.js",
6
6
  "unpkg": "dist/sortable.umd.js",
@@ -45,7 +45,7 @@
45
45
  "dependencies": {
46
46
  "@dnd-kit/core": "^6.0.5",
47
47
  "@dnd-kit/sortable": "^7.0.1",
48
- "@steedos-widgets/amis-lib": "3.6.13"
48
+ "@steedos-widgets/amis-lib": "6.3.0-beta.10"
49
49
  },
50
- "gitHead": "f0ceaf940b910c7881f216deec2cdd410ae94ce4"
50
+ "gitHead": "9bde0fd0766dc725e40940998b53e4f8fbeaea05"
51
51
  }