@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.
@@ -8,6 +8,11 @@ export declare const AmisRecordService: (props: any) => Promise<{
8
8
  componentId: string;
9
9
  expression: string;
10
10
  script?: undefined;
11
+ } | {
12
+ actionType: string;
13
+ expression: string;
14
+ componentId?: undefined;
15
+ script?: undefined;
11
16
  } | {
12
17
  actionType: string;
13
18
  script: string;
@@ -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
  }
@@ -3664,8 +3664,8 @@ function getComparableAmisVersion() {
3664
3664
  /*
3665
3665
  * @Author: baozhoutao@steedos.com
3666
3666
  * @Date: 2022-05-23 09:53:08
3667
- * @LastEditors: liaodaxue
3668
- * @LastEditTime: 2024-01-17 16:00:27
3667
+ * @LastEditors: baozhoutao@steedos.com
3668
+ * @LastEditTime: 2024-02-19 11:57:49
3669
3669
  * @Description:
3670
3670
  */
3671
3671
 
@@ -3751,7 +3751,11 @@ function getNameTpl(field, ctx){
3751
3751
  if(ctx && ctx.isLookup){
3752
3752
  linkTarget = "target='_blank'";
3753
3753
  }
3754
- return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
3754
+ if(ctx.isRelated){
3755
+ return `<a href="${href}" ${linkTarget} onclick="return false;">\${${field.name} | raw}</a>`
3756
+ }else {
3757
+ return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
3758
+ }
3755
3759
  }
3756
3760
 
3757
3761
  function getRelatedFieldTpl(field, ctx){
@@ -3780,6 +3784,9 @@ function getRelatedFieldTpl(field, ctx){
3780
3784
  if(_.isString(field.reference_to) || !field.reference_to){
3781
3785
  if(field.multiple){
3782
3786
  let labelTpl = `<%=item.label%>`;
3787
+ if(ctx.isRelated){
3788
+ linkTarget = "target='_blank'";
3789
+ }
3783
3790
  if(!onlyDisplayLookLabel){
3784
3791
  const href = Router$1.getObjectDetailPath({
3785
3792
  formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
@@ -3802,7 +3809,12 @@ function getRelatedFieldTpl(field, ctx){
3802
3809
  const href = Router$1.getObjectDetailPath({
3803
3810
  formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
3804
3811
  });
3805
- labelTpl = `<a href="${href}" ${linkTarget}>${labelTpl}</a>`;
3812
+ if(ctx.isRelated){
3813
+ labelTpl = `<a href="${href}" ${linkTarget} onclick="return false;">${labelTpl}</a>`;
3814
+ }else {
3815
+ labelTpl = `<a href="${href}" ${linkTarget}>${labelTpl}</a>`;
3816
+ }
3817
+
3806
3818
  }
3807
3819
  tpl = labelTpl;
3808
3820
  }
@@ -3917,27 +3929,29 @@ async function getFieldsTemplate(fields, display){
3917
3929
  fieldsArr = _$1__namespace.values(fields);
3918
3930
  }
3919
3931
  for (const field of fieldsArr) {
3920
- //graphql 的 ui\display 中使用的字段需要先在query中查询. 否则会返回null
3921
- if(field.expand){
3922
- expandFields.push(field);
3923
- }else {
3924
- if(field.name.indexOf('.') < 0){
3925
- if(display && (field.type == 'lookup' || field.type == 'master_detail')){
3926
- fieldsName.push(`${field.name}`);
3927
- displayFields.push(`${field.name}`);
3932
+ if(field.name){
3933
+ //graphql 的 ui\display 中使用的字段需要先在query中查询. 否则会返回null
3934
+ if(field.expand){
3935
+ expandFields.push(field);
3936
+ }else {
3937
+ if(field.name.indexOf('.') < 0){
3938
+ if(display && (field.type == 'lookup' || field.type == 'master_detail')){
3939
+ fieldsName.push(`${field.name}`);
3940
+ displayFields.push(`${field.name}`);
3941
+ }else {
3942
+ fieldsName.push( field.alias ? `${field.alias}:${field.name}` : field.name);
3943
+ }
3944
+ if(_$1.includes(['time','date','datetime','boolean','number','currency'], field.type)){
3945
+ fieldsName.push(`${field.name}`);
3946
+ }
3947
+ if(_$1.includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
3948
+ displayFields.push(`${field.name}`);
3949
+ }
3928
3950
  }else {
3929
- fieldsName.push( field.alias ? `${field.alias}:${field.name}` : field.name);
3930
- }
3931
- if(_$1.includes(['time','date','datetime','boolean','number','currency'], field.type)){
3932
- fieldsName.push(`${field.name}`);
3951
+ objectFieldName = field.name.split('.')[0];
3952
+ fieldsName.push(objectFieldName);
3953
+ displayFields.push(objectFieldName);
3933
3954
  }
3934
- if(_$1.includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
3935
- displayFields.push(`${field.name}`);
3936
- }
3937
- }else {
3938
- objectFieldName = field.name.split('.')[0];
3939
- fieldsName.push(objectFieldName);
3940
- displayFields.push(objectFieldName);
3941
3955
  }
3942
3956
  }
3943
3957
  }
@@ -5451,6 +5465,54 @@ async function getTableColumns$1(fields, options){
5451
5465
  columnItem.type = 'color';
5452
5466
  columnItem.defaultColor = null;
5453
5467
  }
5468
+
5469
+ if(((field.is_name || field.name === options.labelFieldName) || ((field.type == 'lookup' || field.type == 'master_detail') && _$1__namespace.isString(field.reference_to) && field.multiple != true)) && options.isRelated){
5470
+
5471
+ const drawerRecordDetailSchema = {
5472
+ "type": "steedos-record-detail",
5473
+ "objectApiName": "${objectName}",
5474
+ "recordId": `\${${options.idFieldName}}`,
5475
+ "showBackButton": false,
5476
+ "showButtons": true,
5477
+ "data": {
5478
+ "_inDrawer": true, // 用于判断是否在抽屉中
5479
+ "recordLoaded": false, // 重置数据加载状态
5480
+ }
5481
+ };
5482
+
5483
+
5484
+ if(!(field.is_name || field.name === options.labelFieldName)){
5485
+ drawerRecordDetailSchema.objectApiName = field.reference_to;
5486
+ drawerRecordDetailSchema.recordId = `\${_display.${field.name}.value}`;
5487
+ }
5488
+
5489
+ columnItem.onEvent = {
5490
+ "click": {
5491
+ "actions": [
5492
+ {
5493
+ "actionType": "drawer",
5494
+ "drawer": {
5495
+ "type": "drawer",
5496
+ "title": "&nbsp;",
5497
+ "headerClassName": "",
5498
+ "size": "lg",
5499
+ "bodyClassName": "p-0 m-0 border-t",
5500
+ "closeOnEsc": true,
5501
+ "resizable": true,
5502
+ "actions": [],
5503
+ "body": [
5504
+ drawerRecordDetailSchema
5505
+ ],
5506
+ "className": "app-popover",
5507
+ "id": "u:fc5f055afa8c"
5508
+ },
5509
+ "preventDefault": true
5510
+ }
5511
+ ]
5512
+ }
5513
+ };
5514
+ }
5515
+
5454
5516
  }
5455
5517
  }
5456
5518
  if(columnItem){
@@ -7683,8 +7745,8 @@ const parseSingleExpression$1 = function (func, formData, dataPath, global, user
7683
7745
  /*
7684
7746
  * @Author: baozhoutao@steedos.com
7685
7747
  * @Date: 2022-11-01 15:51:00
7686
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
7687
- * @LastEditTime: 2023-09-25 14:53:05
7748
+ * @LastEditors: baozhoutao@steedos.com
7749
+ * @LastEditTime: 2024-02-18 18:37:35
7688
7750
  * @Description:
7689
7751
  */
7690
7752
 
@@ -7724,13 +7786,13 @@ const getSchema$5 = async (uiSchema, ctx) => {
7724
7786
  const recordId = _master.recordId;
7725
7787
  let relatedKeySaveValue = recordId;
7726
7788
  const relatedField = fields[relatedKey];
7727
- if(relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
7789
+ if(relatedField && relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
7728
7790
  relatedKeySaveValue = _master.record[relatedField.reference_to_field];
7729
7791
  }
7730
7792
  let relatedKeyValue;
7731
- if(!_.isString(relatedField.reference_to)){
7793
+ if(relatedField && !_.isString(relatedField.reference_to)){
7732
7794
  relatedKeyValue = { o: masterObjectName, ids: [relatedKeySaveValue] };
7733
- }else if (relatedField.multiple) {
7795
+ }else if (relatedField && relatedField.multiple) {
7734
7796
  relatedKeyValue = [relatedKeySaveValue];
7735
7797
  } else {
7736
7798
  relatedKeyValue = relatedKeySaveValue;
@@ -8014,8 +8076,8 @@ const getSchema$4 = async (uiSchema, ctx) => {
8014
8076
  /*
8015
8077
  * @Author: 殷亮辉 yinlianghui@hotoa.com
8016
8078
  * @Date: 2023-03-22 09:31:21
8017
- * @LastEditors: Please set LastEditors
8018
- * @LastEditTime: 2023-04-12 10:35:36
8079
+ * @LastEditors: baozhoutao@steedos.com
8080
+ * @LastEditTime: 2024-02-18 16:06:21
8019
8081
  */
8020
8082
  const getSchema$3 = (uiSchema)=>{
8021
8083
  return {
@@ -8061,7 +8123,8 @@ const getSchema$3 = (uiSchema)=>{
8061
8123
  },
8062
8124
  "data": {
8063
8125
  "objectName": `${uiSchema.name}`,
8064
- "__deletedRecord": true
8126
+ "__deletedRecord": true,
8127
+ "_inDrawer": "${_inDrawer}"
8065
8128
  }
8066
8129
  },
8067
8130
  {
@@ -12346,8 +12409,8 @@ const getRecordPermissions = async (objectName, recordId)=>{
12346
12409
  /*
12347
12410
  * @Author: baozhoutao@steedos.com
12348
12411
  * @Date: 2022-07-05 15:55:39
12349
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
12350
- * @LastEditTime: 2024-02-08 16:10:52
12412
+ * @LastEditors: baozhoutao@steedos.com
12413
+ * @LastEditTime: 2024-02-18 14:46:50
12351
12414
  * @Description:
12352
12415
  */
12353
12416
 
@@ -12481,7 +12544,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
12481
12544
  // globalFilter = [`${relatedKey}`, "=", relatedValue];
12482
12545
  // }
12483
12546
  const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel, ctx);
12484
- const componentId = `steedos-record-related-list-${relatedObjectName}`;
12547
+ const componentId = `steedos-record-related-list-${relatedObjectName}_${new Date().getTime()}`;
12485
12548
  const isMobile = window.innerWidth < 768;
12486
12549
  let headerToolbar = [];
12487
12550
  if(!isMobile){
@@ -12755,8 +12818,8 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
12755
12818
  /*
12756
12819
  * @Author: baozhoutao@steedos.com
12757
12820
  * @Date: 2022-07-05 15:55:39
12758
- * @LastEditors: liaodaxue
12759
- * @LastEditTime: 2024-02-05 17:56:27
12821
+ * @LastEditors: baozhoutao@steedos.com
12822
+ * @LastEditTime: 2024-02-18 16:05:21
12760
12823
  * @Description:
12761
12824
  */
12762
12825
 
@@ -13325,10 +13388,14 @@ async function getRecordServiceSchema(objectName, appId, props = {}, body) {
13325
13388
  "componentId": serviceId,
13326
13389
  "expression": "this.__deletedRecord != true"
13327
13390
  },
13391
+ {
13392
+ "actionType": "closeDialog",
13393
+ "expression": "this.__deletedRecord === true && this._inDrawer === true"
13394
+ },
13328
13395
  {
13329
13396
  "actionType": "custom",
13330
13397
  "script": "window.goBack()",
13331
- "expression": "this.__deletedRecord === true"
13398
+ "expression": "this.__deletedRecord === true && this._inDrawer != true"
13332
13399
  }
13333
13400
  ]
13334
13401
  },
@@ -21557,7 +21624,8 @@ var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void
21557
21624
  if (body) {
21558
21625
  schema.body = body;
21559
21626
  }
21560
- // console.log(`AmisRecordDetail====schema==>`, schema)
21627
+ // console.log(`AmisRecordDetail====schema==>`, schema);
21628
+ schema.data = Object.assign({}, $schema.data, schema.data);
21561
21629
  return [2 /*return*/, schema];
21562
21630
  }
21563
21631
  });
@@ -21567,7 +21635,7 @@ var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void
21567
21635
  * @Author: baozhoutao@steedos.com
21568
21636
  * @Date: 2022-12-08 10:32:17
21569
21637
  * @LastEditors: baozhoutao@steedos.com
21570
- * @LastEditTime: 2024-01-16 14:09:23
21638
+ * @LastEditTime: 2024-02-18 16:05:56
21571
21639
  * @Description:
21572
21640
  */
21573
21641
  var AmisRecordService = function (props) { return __awaiter(void 0, void 0, void 0, function () {