@steedos-widgets/sortable 3.6.3 → 3.6.4-beta.2

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,7 +20446,11 @@
20446
20446
  if(ctx && ctx.isLookup){
20447
20447
  linkTarget = "target='_blank'";
20448
20448
  }
20449
- return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
20449
+ if(ctx.isRelated && window.innerWidth >= 768){
20450
+ return `<a href="${href}" ${linkTarget} onclick="return false;">\${${field.name} | raw}</a>`
20451
+ }else {
20452
+ return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
20453
+ }
20450
20454
  }
20451
20455
 
20452
20456
  function getRelatedFieldTpl(field, ctx){
@@ -20475,6 +20479,9 @@
20475
20479
  if(_.isString(field.reference_to) || !field.reference_to){
20476
20480
  if(field.multiple){
20477
20481
  let labelTpl = `<%=item.label%>`;
20482
+ if(ctx.isRelated){
20483
+ linkTarget = "target='_blank'";
20484
+ }
20478
20485
  if(!onlyDisplayLookLabel){
20479
20486
  const href = Router.getObjectDetailPath({
20480
20487
  formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
@@ -20497,7 +20504,12 @@
20497
20504
  const href = Router.getObjectDetailPath({
20498
20505
  formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
20499
20506
  });
20500
- labelTpl = `<a href="${href}" ${linkTarget}>${labelTpl}</a>`;
20507
+ if(ctx.isRelated && window.innerWidth >= 768){
20508
+ labelTpl = `<a href="${href}" ${linkTarget} onclick="return false;">${labelTpl}</a>`;
20509
+ }else {
20510
+ labelTpl = `<a href="${href}" ${linkTarget}>${labelTpl}</a>`;
20511
+ }
20512
+
20501
20513
  }
20502
20514
  tpl = labelTpl;
20503
20515
  }
@@ -20612,27 +20624,29 @@
20612
20624
  fieldsArr = lodash.exports.values(fields);
20613
20625
  }
20614
20626
  for (const field of fieldsArr) {
20615
- //graphql 的 ui\display 中使用的字段需要先在query中查询. 否则会返回null
20616
- if(field.expand){
20617
- expandFields.push(field);
20618
- }else {
20619
- if(field.name.indexOf('.') < 0){
20620
- if(display && (field.type == 'lookup' || field.type == 'master_detail')){
20621
- fieldsName.push(`${field.name}`);
20622
- displayFields.push(`${field.name}`);
20627
+ if(field.name){
20628
+ //graphql 的 ui\display 中使用的字段需要先在query中查询. 否则会返回null
20629
+ if(field.expand){
20630
+ expandFields.push(field);
20631
+ }else {
20632
+ if(field.name.indexOf('.') < 0){
20633
+ if(display && (field.type == 'lookup' || field.type == 'master_detail')){
20634
+ fieldsName.push(`${field.name}`);
20635
+ displayFields.push(`${field.name}`);
20636
+ }else {
20637
+ fieldsName.push( field.alias ? `${field.alias}:${field.name}` : field.name);
20638
+ }
20639
+ if(lodash.exports.includes(['time','date','datetime','boolean','number','currency'], field.type)){
20640
+ fieldsName.push(`${field.name}`);
20641
+ }
20642
+ if(lodash.exports.includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
20643
+ displayFields.push(`${field.name}`);
20644
+ }
20623
20645
  }else {
20624
- fieldsName.push( field.alias ? `${field.alias}:${field.name}` : field.name);
20646
+ objectFieldName = field.name.split('.')[0];
20647
+ fieldsName.push(objectFieldName);
20648
+ displayFields.push(objectFieldName);
20625
20649
  }
20626
- if(lodash.exports.includes(['time','date','datetime','boolean','number','currency'], field.type)){
20627
- fieldsName.push(`${field.name}`);
20628
- }
20629
- if(lodash.exports.includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
20630
- displayFields.push(`${field.name}`);
20631
- }
20632
- }else {
20633
- objectFieldName = field.name.split('.')[0];
20634
- fieldsName.push(objectFieldName);
20635
- displayFields.push(objectFieldName);
20636
20650
  }
20637
20651
  }
20638
20652
  }
@@ -21914,6 +21928,55 @@
21914
21928
  columnItem.type = 'color';
21915
21929
  columnItem.defaultColor = null;
21916
21930
  }
21931
+
21932
+ if(window.innerWidth >= 768 && ((field.is_name || field.name === options.labelFieldName) || ((field.type == 'lookup' || field.type == 'master_detail') && lodash.exports.isString(field.reference_to) && field.multiple != true)) && options.isRelated){
21933
+
21934
+ const drawerRecordDetailSchema = {
21935
+ "type": "steedos-record-detail",
21936
+ "objectApiName": "${objectName}",
21937
+ "recordId": `\${${options.idFieldName}}`,
21938
+ "showBackButton": false,
21939
+ "showButtons": true,
21940
+ "data": {
21941
+ "_inDrawer": true, // 用于判断是否在抽屉中
21942
+ "recordLoaded": false, // 重置数据加载状态
21943
+ }
21944
+ };
21945
+
21946
+
21947
+ if(!(field.is_name || field.name === options.labelFieldName)){
21948
+ drawerRecordDetailSchema.objectApiName = field.reference_to;
21949
+ drawerRecordDetailSchema.recordId = `\${_display.${field.name}.value}`;
21950
+ }
21951
+
21952
+ columnItem.onEvent = {
21953
+ "click": {
21954
+ "actions": [
21955
+ {
21956
+ "actionType": "drawer",
21957
+ "drawer": {
21958
+ "type": "drawer",
21959
+ "title": "&nbsp;",
21960
+ "headerClassName": "hidden",
21961
+ "size": "lg",
21962
+ "bodyClassName": "p-0 m-0",
21963
+ "closeOnEsc": true,
21964
+ "closeOnOutside": true,
21965
+ "resizable": true,
21966
+ "actions": [],
21967
+ "body": [
21968
+ drawerRecordDetailSchema
21969
+ ],
21970
+ "className": "steedos-record-detail-drawer app-popover",
21971
+ "id": "u:fc5f055afa8c"
21972
+ },
21973
+ "preventDefault": true
21974
+ }
21975
+ ]
21976
+ }
21977
+ };
21978
+ }
21979
+
21917
21980
  }
21918
21981
  }
21919
21982
  if(columnItem){
@@ -21962,7 +22025,7 @@
21962
22025
  let isNewLine = false;
21963
22026
  let isLeft = true;
21964
22027
  let lineChildrenClassName = "";
21965
- let lineClassName = "flex items-center justify-between";
22028
+ let lineClassName = "flex items-center justify-between mb-1";
21966
22029
  tpls.forEach(function(item){
21967
22030
  if(isNewLine && lines.length < maxLineCount){
21968
22031
  lines.push({
@@ -22563,8 +22626,8 @@
22563
22626
  /*
22564
22627
  * @Author: baozhoutao@steedos.com
22565
22628
  * @Date: 2022-11-01 15:51:00
22566
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
22567
- * @LastEditTime: 2023-09-25 14:53:05
22629
+ * @LastEditors: baozhoutao@steedos.com
22630
+ * @LastEditTime: 2024-02-18 18:37:35
22568
22631
  * @Description:
22569
22632
  */
22570
22633
 
@@ -22604,13 +22667,13 @@
22604
22667
  const recordId = _master.recordId;
22605
22668
  let relatedKeySaveValue = recordId;
22606
22669
  const relatedField = fields[relatedKey];
22607
- if(relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
22670
+ if(relatedField && relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
22608
22671
  relatedKeySaveValue = _master.record[relatedField.reference_to_field];
22609
22672
  }
22610
22673
  let relatedKeyValue;
22611
- if(!_.isString(relatedField.reference_to)){
22674
+ if(relatedField && !_.isString(relatedField.reference_to)){
22612
22675
  relatedKeyValue = { o: masterObjectName, ids: [relatedKeySaveValue] };
22613
- }else if (relatedField.multiple) {
22676
+ }else if (relatedField && relatedField.multiple) {
22614
22677
  relatedKeyValue = [relatedKeySaveValue];
22615
22678
  } else {
22616
22679
  relatedKeyValue = relatedKeySaveValue;
@@ -24945,8 +25008,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24945
25008
  /*
24946
25009
  * @Author: baozhoutao@steedos.com
24947
25010
  * @Date: 2022-07-05 15:55:39
24948
- * @LastEditors: liaodaxue
24949
- * @LastEditTime: 2024-02-05 17:56:27
25011
+ * @LastEditors: baozhoutao@steedos.com
25012
+ * @LastEditTime: 2024-02-18 16:05:21
24950
25013
  * @Description:
24951
25014
  */
24952
25015
 
@@ -26385,6 +26448,33 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
26385
26448
  }
26386
26449
  }
26387
26450
 
26451
+ async function getAutoFill(field, refObject) {
26452
+ let autoFillMapping = field.auto_fill_mapping;
26453
+ if (autoFillMapping && autoFillMapping.length) {
26454
+ let fillMapping = {};
26455
+ let fieldsForApi = [];
26456
+ autoFillMapping.forEach(function (item) {
26457
+ fillMapping[item.to] = `\${${item.from}}`;
26458
+ fieldsForApi.push(item.from);
26459
+ });
26460
+ // let api = {
26461
+ // // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
26462
+ // "url": `/api/v1/${refObject.name}/\${${field.name}}?fields=${JSON.stringify(fieldsForApi)}`,
26463
+ // // "responseData": {
26464
+ // // "name": "${name}"
26465
+ // // },
26466
+ // "silent": false
26467
+ // }
26468
+ // return {
26469
+ // fillMapping,
26470
+ // // api
26471
+ // }
26472
+ // 因为autoFill中配置了api的话,在表单初始化(比如新建记录)时并不会触发执行autoFill,所以只能暂时不用api
26473
+ // 给amis报过问题了,见:https://github.com/baidu/amis/issues/9631
26474
+ return fillMapping;
26475
+ }
26476
+ }
26477
+
26388
26478
  async function lookupToAmis(field, readonly, ctx){
26389
26479
  if(!ctx){
26390
26480
  ctx = {};
@@ -26468,6 +26558,10 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
26468
26558
  amisSchema = lodash.exports.defaultsDeep({}, pageAmisSchema, amisSchema);
26469
26559
  }
26470
26560
  }
26561
+ const autoFill = await getAutoFill(field);
26562
+ if(autoFill){
26563
+ amisSchema.autoFill = autoFill;
26564
+ }
26471
26565
  return amisSchema;
26472
26566
  }
26473
26567
 
@@ -26639,6 +26733,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
26639
26733
  {
26640
26734
  "type": "editor",
26641
26735
  "name": field.name,
26736
+ "labelClassName": "none",
26642
26737
  "language": "markdown",
26643
26738
  }
26644
26739
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos-widgets/sortable",
3
- "version": "3.6.3",
3
+ "version": "3.6.4-beta.2",
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.3"
48
+ "@steedos-widgets/amis-lib": "3.6.4-beta.2"
49
49
  },
50
- "gitHead": "7452deb6cf82a1c24e1f645cd2d243efa126521b"
50
+ "gitHead": "74e7975b7f134d1192dea186f90e0a1c6c11275c"
51
51
  }