@steedos-widgets/amis-object 3.6.3 → 3.6.4-beta.1

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.
@@ -918,6 +918,9 @@ fieldset.antd-Collapse > legend{
918
918
  .border-r {
919
919
  border-right-width: 1px
920
920
  }
921
+ .border-t {
922
+ border-top-width: 1px
923
+ }
921
924
  .border-solid {
922
925
  border-style: solid
923
926
  }
@@ -3636,8 +3636,8 @@ function getComparableAmisVersion() {
3636
3636
  /*
3637
3637
  * @Author: baozhoutao@steedos.com
3638
3638
  * @Date: 2022-05-23 09:53:08
3639
- * @LastEditors: liaodaxue
3640
- * @LastEditTime: 2024-01-17 16:00:27
3639
+ * @LastEditors: baozhoutao@steedos.com
3640
+ * @LastEditTime: 2024-02-19 11:57:49
3641
3641
  * @Description:
3642
3642
  */
3643
3643
 
@@ -3723,7 +3723,11 @@ function getNameTpl(field, ctx){
3723
3723
  if(ctx && ctx.isLookup){
3724
3724
  linkTarget = "target='_blank'";
3725
3725
  }
3726
- return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
3726
+ if(ctx.isRelated){
3727
+ return `<a href="${href}" ${linkTarget} onclick="return false;">\${${field.name} | raw}</a>`
3728
+ }else {
3729
+ return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
3730
+ }
3727
3731
  }
3728
3732
 
3729
3733
  function getRelatedFieldTpl(field, ctx){
@@ -3752,6 +3756,9 @@ function getRelatedFieldTpl(field, ctx){
3752
3756
  if(_.isString(field.reference_to) || !field.reference_to){
3753
3757
  if(field.multiple){
3754
3758
  let labelTpl = `<%=item.label%>`;
3759
+ if(ctx.isRelated){
3760
+ linkTarget = "target='_blank'";
3761
+ }
3755
3762
  if(!onlyDisplayLookLabel){
3756
3763
  const href = Router$1.getObjectDetailPath({
3757
3764
  formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
@@ -3774,7 +3781,12 @@ function getRelatedFieldTpl(field, ctx){
3774
3781
  const href = Router$1.getObjectDetailPath({
3775
3782
  formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
3776
3783
  });
3777
- labelTpl = `<a href="${href}" ${linkTarget}>${labelTpl}</a>`;
3784
+ if(ctx.isRelated){
3785
+ labelTpl = `<a href="${href}" ${linkTarget} onclick="return false;">${labelTpl}</a>`;
3786
+ }else {
3787
+ labelTpl = `<a href="${href}" ${linkTarget}>${labelTpl}</a>`;
3788
+ }
3789
+
3778
3790
  }
3779
3791
  tpl = labelTpl;
3780
3792
  }
@@ -3889,27 +3901,29 @@ async function getFieldsTemplate(fields, display){
3889
3901
  fieldsArr = _$1.values(fields);
3890
3902
  }
3891
3903
  for (const field of fieldsArr) {
3892
- //graphql 的 ui\display 中使用的字段需要先在query中查询. 否则会返回null
3893
- if(field.expand){
3894
- expandFields.push(field);
3895
- }else {
3896
- if(field.name.indexOf('.') < 0){
3897
- if(display && (field.type == 'lookup' || field.type == 'master_detail')){
3898
- fieldsName.push(`${field.name}`);
3899
- displayFields.push(`${field.name}`);
3904
+ if(field.name){
3905
+ //graphql 的 ui\display 中使用的字段需要先在query中查询. 否则会返回null
3906
+ if(field.expand){
3907
+ expandFields.push(field);
3908
+ }else {
3909
+ if(field.name.indexOf('.') < 0){
3910
+ if(display && (field.type == 'lookup' || field.type == 'master_detail')){
3911
+ fieldsName.push(`${field.name}`);
3912
+ displayFields.push(`${field.name}`);
3913
+ }else {
3914
+ fieldsName.push( field.alias ? `${field.alias}:${field.name}` : field.name);
3915
+ }
3916
+ if(includes(['time','date','datetime','boolean','number','currency'], field.type)){
3917
+ fieldsName.push(`${field.name}`);
3918
+ }
3919
+ if(includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
3920
+ displayFields.push(`${field.name}`);
3921
+ }
3900
3922
  }else {
3901
- fieldsName.push( field.alias ? `${field.alias}:${field.name}` : field.name);
3902
- }
3903
- if(includes(['time','date','datetime','boolean','number','currency'], field.type)){
3904
- fieldsName.push(`${field.name}`);
3923
+ objectFieldName = field.name.split('.')[0];
3924
+ fieldsName.push(objectFieldName);
3925
+ displayFields.push(objectFieldName);
3905
3926
  }
3906
- if(includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
3907
- displayFields.push(`${field.name}`);
3908
- }
3909
- }else {
3910
- objectFieldName = field.name.split('.')[0];
3911
- fieldsName.push(objectFieldName);
3912
- displayFields.push(objectFieldName);
3913
3927
  }
3914
3928
  }
3915
3929
  }
@@ -5423,6 +5437,54 @@ async function getTableColumns$1(fields, options){
5423
5437
  columnItem.type = 'color';
5424
5438
  columnItem.defaultColor = null;
5425
5439
  }
5440
+
5441
+ if(((field.is_name || field.name === options.labelFieldName) || ((field.type == 'lookup' || field.type == 'master_detail') && _$1.isString(field.reference_to) && field.multiple != true)) && options.isRelated){
5442
+
5443
+ const drawerRecordDetailSchema = {
5444
+ "type": "steedos-record-detail",
5445
+ "objectApiName": "${objectName}",
5446
+ "recordId": `\${${options.idFieldName}}`,
5447
+ "showBackButton": false,
5448
+ "showButtons": true,
5449
+ "data": {
5450
+ "_inDrawer": true, // 用于判断是否在抽屉中
5451
+ "recordLoaded": false, // 重置数据加载状态
5452
+ }
5453
+ };
5454
+
5455
+
5456
+ if(!(field.is_name || field.name === options.labelFieldName)){
5457
+ drawerRecordDetailSchema.objectApiName = field.reference_to;
5458
+ drawerRecordDetailSchema.recordId = `\${_display.${field.name}.value}`;
5459
+ }
5460
+
5461
+ columnItem.onEvent = {
5462
+ "click": {
5463
+ "actions": [
5464
+ {
5465
+ "actionType": "drawer",
5466
+ "drawer": {
5467
+ "type": "drawer",
5468
+ "title": "&nbsp;",
5469
+ "headerClassName": "",
5470
+ "size": "lg",
5471
+ "bodyClassName": "p-0 m-0 border-t",
5472
+ "closeOnEsc": true,
5473
+ "resizable": true,
5474
+ "actions": [],
5475
+ "body": [
5476
+ drawerRecordDetailSchema
5477
+ ],
5478
+ "className": "app-popover",
5479
+ "id": "u:fc5f055afa8c"
5480
+ },
5481
+ "preventDefault": true
5482
+ }
5483
+ ]
5484
+ }
5485
+ };
5486
+ }
5487
+
5426
5488
  }
5427
5489
  }
5428
5490
  if(columnItem){
@@ -7655,8 +7717,8 @@ const parseSingleExpression$1 = function (func, formData, dataPath, global, user
7655
7717
  /*
7656
7718
  * @Author: baozhoutao@steedos.com
7657
7719
  * @Date: 2022-11-01 15:51:00
7658
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
7659
- * @LastEditTime: 2023-09-25 14:53:05
7720
+ * @LastEditors: baozhoutao@steedos.com
7721
+ * @LastEditTime: 2024-02-18 18:37:35
7660
7722
  * @Description:
7661
7723
  */
7662
7724
 
@@ -7696,13 +7758,13 @@ const getSchema$5 = async (uiSchema, ctx) => {
7696
7758
  const recordId = _master.recordId;
7697
7759
  let relatedKeySaveValue = recordId;
7698
7760
  const relatedField = fields[relatedKey];
7699
- if(relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
7761
+ if(relatedField && relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
7700
7762
  relatedKeySaveValue = _master.record[relatedField.reference_to_field];
7701
7763
  }
7702
7764
  let relatedKeyValue;
7703
- if(!_.isString(relatedField.reference_to)){
7765
+ if(relatedField && !_.isString(relatedField.reference_to)){
7704
7766
  relatedKeyValue = { o: masterObjectName, ids: [relatedKeySaveValue] };
7705
- }else if (relatedField.multiple) {
7767
+ }else if (relatedField && relatedField.multiple) {
7706
7768
  relatedKeyValue = [relatedKeySaveValue];
7707
7769
  } else {
7708
7770
  relatedKeyValue = relatedKeySaveValue;
@@ -7986,8 +8048,8 @@ const getSchema$4 = async (uiSchema, ctx) => {
7986
8048
  /*
7987
8049
  * @Author: 殷亮辉 yinlianghui@hotoa.com
7988
8050
  * @Date: 2023-03-22 09:31:21
7989
- * @LastEditors: Please set LastEditors
7990
- * @LastEditTime: 2023-04-12 10:35:36
8051
+ * @LastEditors: baozhoutao@steedos.com
8052
+ * @LastEditTime: 2024-02-18 16:06:21
7991
8053
  */
7992
8054
  const getSchema$3 = (uiSchema)=>{
7993
8055
  return {
@@ -8033,7 +8095,8 @@ const getSchema$3 = (uiSchema)=>{
8033
8095
  },
8034
8096
  "data": {
8035
8097
  "objectName": `${uiSchema.name}`,
8036
- "__deletedRecord": true
8098
+ "__deletedRecord": true,
8099
+ "_inDrawer": "${_inDrawer}"
8037
8100
  }
8038
8101
  },
8039
8102
  {
@@ -12318,8 +12381,8 @@ const getRecordPermissions = async (objectName, recordId)=>{
12318
12381
  /*
12319
12382
  * @Author: baozhoutao@steedos.com
12320
12383
  * @Date: 2022-07-05 15:55:39
12321
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
12322
- * @LastEditTime: 2024-02-08 16:10:52
12384
+ * @LastEditors: baozhoutao@steedos.com
12385
+ * @LastEditTime: 2024-02-18 14:46:50
12323
12386
  * @Description:
12324
12387
  */
12325
12388
 
@@ -12453,7 +12516,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
12453
12516
  // globalFilter = [`${relatedKey}`, "=", relatedValue];
12454
12517
  // }
12455
12518
  const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel, ctx);
12456
- const componentId = `steedos-record-related-list-${relatedObjectName}`;
12519
+ const componentId = `steedos-record-related-list-${relatedObjectName}_${new Date().getTime()}`;
12457
12520
  const isMobile = window.innerWidth < 768;
12458
12521
  let headerToolbar = [];
12459
12522
  if(!isMobile){
@@ -12727,8 +12790,8 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
12727
12790
  /*
12728
12791
  * @Author: baozhoutao@steedos.com
12729
12792
  * @Date: 2022-07-05 15:55:39
12730
- * @LastEditors: liaodaxue
12731
- * @LastEditTime: 2024-02-05 17:56:27
12793
+ * @LastEditors: baozhoutao@steedos.com
12794
+ * @LastEditTime: 2024-02-18 16:05:21
12732
12795
  * @Description:
12733
12796
  */
12734
12797
 
@@ -13297,10 +13360,14 @@ async function getRecordServiceSchema(objectName, appId, props = {}, body) {
13297
13360
  "componentId": serviceId,
13298
13361
  "expression": "this.__deletedRecord != true"
13299
13362
  },
13363
+ {
13364
+ "actionType": "closeDialog",
13365
+ "expression": "this.__deletedRecord === true && this._inDrawer === true"
13366
+ },
13300
13367
  {
13301
13368
  "actionType": "custom",
13302
13369
  "script": "window.goBack()",
13303
- "expression": "this.__deletedRecord === true"
13370
+ "expression": "this.__deletedRecord === true && this._inDrawer != true"
13304
13371
  }
13305
13372
  ]
13306
13373
  },
@@ -21529,7 +21596,8 @@ var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void
21529
21596
  if (body) {
21530
21597
  schema.body = body;
21531
21598
  }
21532
- // console.log(`AmisRecordDetail====schema==>`, schema)
21599
+ // console.log(`AmisRecordDetail====schema==>`, schema);
21600
+ schema.data = Object.assign({}, $schema.data, schema.data);
21533
21601
  return [2 /*return*/, schema];
21534
21602
  }
21535
21603
  });
@@ -21539,7 +21607,7 @@ var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void
21539
21607
  * @Author: baozhoutao@steedos.com
21540
21608
  * @Date: 2022-12-08 10:32:17
21541
21609
  * @LastEditors: baozhoutao@steedos.com
21542
- * @LastEditTime: 2024-01-16 14:09:23
21610
+ * @LastEditTime: 2024-02-18 16:05:56
21543
21611
  * @Description:
21544
21612
  */
21545
21613
  var AmisRecordService = function (props) { return __awaiter(void 0, void 0, void 0, function () {