@steedos-widgets/amis-object 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.
@@ -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-21 17:19:30
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 && window.innerWidth >= 768){
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 && window.innerWidth >= 768){
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);
3951
+ objectFieldName = field.name.split('.')[0];
3952
+ fieldsName.push(objectFieldName);
3953
+ displayFields.push(objectFieldName);
3930
3954
  }
3931
- if(_$1.includes(['time','date','datetime','boolean','number','currency'], field.type)){
3932
- fieldsName.push(`${field.name}`);
3933
- }
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,55 @@ async function getTableColumns$1(fields, options){
5451
5465
  columnItem.type = 'color';
5452
5466
  columnItem.defaultColor = null;
5453
5467
  }
5468
+
5469
+ if(window.innerWidth >= 768 && ((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": "hidden",
5498
+ "size": "lg",
5499
+ "bodyClassName": "p-0 m-0",
5500
+ "closeOnEsc": true,
5501
+ "closeOnOutside": true,
5502
+ "resizable": true,
5503
+ "actions": [],
5504
+ "body": [
5505
+ drawerRecordDetailSchema
5506
+ ],
5507
+ "className": "steedos-record-detail-drawer app-popover",
5508
+ "id": "u:fc5f055afa8c"
5509
+ },
5510
+ "preventDefault": true
5511
+ }
5512
+ ]
5513
+ }
5514
+ };
5515
+ }
5516
+
5454
5517
  }
5455
5518
  }
5456
5519
  if(columnItem){
@@ -5499,7 +5562,7 @@ function getMobileLines(tpls){
5499
5562
  let isNewLine = false;
5500
5563
  let isLeft = true;
5501
5564
  let lineChildrenClassName = "";
5502
- let lineClassName = "flex items-center justify-between";
5565
+ let lineClassName = "flex items-center justify-between mb-1";
5503
5566
  tpls.forEach(function(item){
5504
5567
  if(isNewLine && lines.length < maxLineCount){
5505
5568
  lines.push({
@@ -7683,8 +7746,8 @@ const parseSingleExpression$1 = function (func, formData, dataPath, global, user
7683
7746
  /*
7684
7747
  * @Author: baozhoutao@steedos.com
7685
7748
  * @Date: 2022-11-01 15:51:00
7686
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
7687
- * @LastEditTime: 2023-09-25 14:53:05
7749
+ * @LastEditors: baozhoutao@steedos.com
7750
+ * @LastEditTime: 2024-02-18 18:37:35
7688
7751
  * @Description:
7689
7752
  */
7690
7753
 
@@ -7724,13 +7787,13 @@ const getSchema$5 = async (uiSchema, ctx) => {
7724
7787
  const recordId = _master.recordId;
7725
7788
  let relatedKeySaveValue = recordId;
7726
7789
  const relatedField = fields[relatedKey];
7727
- if(relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
7790
+ if(relatedField && relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
7728
7791
  relatedKeySaveValue = _master.record[relatedField.reference_to_field];
7729
7792
  }
7730
7793
  let relatedKeyValue;
7731
- if(!_.isString(relatedField.reference_to)){
7794
+ if(relatedField && !_.isString(relatedField.reference_to)){
7732
7795
  relatedKeyValue = { o: masterObjectName, ids: [relatedKeySaveValue] };
7733
- }else if (relatedField.multiple) {
7796
+ }else if (relatedField && relatedField.multiple) {
7734
7797
  relatedKeyValue = [relatedKeySaveValue];
7735
7798
  } else {
7736
7799
  relatedKeyValue = relatedKeySaveValue;
@@ -8014,8 +8077,8 @@ const getSchema$4 = async (uiSchema, ctx) => {
8014
8077
  /*
8015
8078
  * @Author: 殷亮辉 yinlianghui@hotoa.com
8016
8079
  * @Date: 2023-03-22 09:31:21
8017
- * @LastEditors: Please set LastEditors
8018
- * @LastEditTime: 2023-04-12 10:35:36
8080
+ * @LastEditors: baozhoutao@steedos.com
8081
+ * @LastEditTime: 2024-02-18 16:06:21
8019
8082
  */
8020
8083
  const getSchema$3 = (uiSchema)=>{
8021
8084
  return {
@@ -8061,7 +8124,8 @@ const getSchema$3 = (uiSchema)=>{
8061
8124
  },
8062
8125
  "data": {
8063
8126
  "objectName": `${uiSchema.name}`,
8064
- "__deletedRecord": true
8127
+ "__deletedRecord": true,
8128
+ "_inDrawer": "${_inDrawer}"
8065
8129
  }
8066
8130
  },
8067
8131
  {
@@ -8798,44 +8862,46 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
8798
8862
  }
8799
8863
  });
8800
8864
 
8801
- return {
8802
- "type": "button",
8803
- "icon": "fa fa-angle-down",
8804
- "visibleOn": phoneMoreButtonsVisibleOn,
8805
- "onEvent": {
8806
- "click": {
8807
- "actions": [
8808
- {
8809
- "actionType": "drawer",
8810
- "drawer": {
8811
- "type": "drawer",
8812
- "title": instance.t('frontend_operation'),
8813
- "id": "object_actions_drawer_" + objectSchema.name,
8814
- "body": [
8815
- {
8816
- "type": "button-group",
8817
- "id": "u:fd837823be5b",
8818
- "vertical": true,
8819
- "tiled": true,
8820
- "buttons": dropdownButtons,
8821
- "btnLevel": "enhance",
8822
- "className": "w-full",
8823
- "btnClassName": "w-full",
8824
- "size": "lg"
8865
+ return [
8866
+ {
8867
+ "type": "button",
8868
+ "icon": "fa fa-angle-down",
8869
+ "visibleOn": phoneMoreButtonsVisibleOn,
8870
+ "onEvent": {
8871
+ "click": {
8872
+ "actions": [
8873
+ {
8874
+ "actionType": "drawer",
8875
+ "drawer": {
8876
+ "type": "drawer",
8877
+ "title": instance.t('frontend_operation'),
8878
+ "id": "object_actions_drawer_" + objectSchema.name,
8879
+ "body": [
8880
+ {
8881
+ "type": "button-group",
8882
+ "id": "u:fd837823be5b",
8883
+ "vertical": true,
8884
+ "tiled": true,
8885
+ "buttons": dropdownButtons,
8886
+ "btnLevel": "enhance",
8887
+ "className": "w-full",
8888
+ "btnClassName": "w-full",
8889
+ "size": "lg"
8890
+ }
8891
+ ],
8892
+ "position": "bottom",
8893
+ "closeOnOutside": true,
8894
+ "resizable": false,
8895
+ "className": "buttons-drawer",
8896
+ "bodyClassName": "m-none p-none",
8897
+ "actions": []
8825
8898
  }
8826
- ],
8827
- "position": "bottom",
8828
- "closeOnOutside": true,
8829
- "resizable": false,
8830
- "className": "buttons-drawer",
8831
- "bodyClassName": "m-none p-none",
8832
- "actions": []
8833
- }
8899
+ }
8900
+ ]
8834
8901
  }
8835
- ]
8902
+ }
8836
8903
  }
8837
- }
8838
- }
8904
+ ]
8839
8905
  }else {
8840
8906
  if(moreButtons.length > 0){
8841
8907
  const dropdownButtonsSchema = {
@@ -9904,6 +9970,33 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
9904
9970
  amisButtonsSchema = getObjectDetailButtonsSchemas(objectSchema, recordId, options);
9905
9971
  }
9906
9972
 
9973
+ amisButtonsSchema.push(
9974
+ {
9975
+ "type": "button",
9976
+ "visibleOn": "${_inDrawer === true || _inRecordMini === true}",
9977
+ "className":"ant-dropdown-trigger slds-button slds-button_icon slds-button_icon-border-filled slds-button_icon-x-small slds-icon ml-1 flex",
9978
+ "onEvent": {
9979
+ "click": {
9980
+ "actions": [
9981
+ {
9982
+ "actionType": "custom",
9983
+ "script": "const data = event.data; window.open(`/app/${data.app_id}/${data.objectName}/view/${data.recordId}?side_object=${data.side_object}&side_listview_id=${data.side_listview_id}`)"
9984
+ }
9985
+ ]
9986
+ }
9987
+ },
9988
+ "body": [
9989
+ {
9990
+ "type": "steedos-icon",
9991
+ "category": "utility",
9992
+ "name": "new_window",
9993
+ "colorVariant": "default",
9994
+ "className": "slds-button_icon slds-global-header__icon w-4"
9995
+ }
9996
+ ]
9997
+ }
9998
+ );
9999
+
9907
10000
  let backButtonsSchema = null;
9908
10001
 
9909
10002
  if(options.showBackButton != false){
@@ -9924,7 +10017,32 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
9924
10017
  "columns": [
9925
10018
  {
9926
10019
  "body": [
9927
- backButtonsSchema
10020
+ backButtonsSchema,
10021
+ {
10022
+ "type": "button",
10023
+ "visibleOn": "${_inDrawer === true}",
10024
+ "className":"flex mr-4",
10025
+ "onEvent": {
10026
+ "click": {
10027
+ "actions": [
10028
+ {
10029
+ "componentId": "",
10030
+ "args": {},
10031
+ "actionType": "closeDrawer"
10032
+ }
10033
+ ]
10034
+ }
10035
+ },
10036
+ "body": [
10037
+ {
10038
+ "type": "steedos-icon",
10039
+ "category": "utility",
10040
+ "name": "close",
10041
+ "colorVariant": "default",
10042
+ "className": "slds-button_icon slds-global-header__icon w-4"
10043
+ }
10044
+ ]
10045
+ }
9928
10046
  ,{
9929
10047
  "type": "tpl",
9930
10048
  "className": "block",
@@ -10139,10 +10257,10 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
10139
10257
  "md": "auto"
10140
10258
  }
10141
10259
  ],
10142
- "className": "flex justify-between"
10260
+ "className": "flex justify-between min-h-8 items-center"
10143
10261
  }
10144
10262
  ],
10145
- "className": "steedos-record-related-header py-2 px-3 bg-gray-50 border"
10263
+ "className": "steedos-record-related-header py-2 px-3 bg-gray-50 border rounded"
10146
10264
  };
10147
10265
  return recordRelatedListHeader;
10148
10266
  }
@@ -12346,8 +12464,8 @@ const getRecordPermissions = async (objectName, recordId)=>{
12346
12464
  /*
12347
12465
  * @Author: baozhoutao@steedos.com
12348
12466
  * @Date: 2022-07-05 15:55:39
12349
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
12350
- * @LastEditTime: 2024-02-08 16:10:52
12467
+ * @LastEditors: baozhoutao@steedos.com
12468
+ * @LastEditTime: 2024-02-18 14:46:50
12351
12469
  * @Description:
12352
12470
  */
12353
12471
 
@@ -12481,7 +12599,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
12481
12599
  // globalFilter = [`${relatedKey}`, "=", relatedValue];
12482
12600
  // }
12483
12601
  const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel, ctx);
12484
- const componentId = `steedos-record-related-list-${relatedObjectName}`;
12602
+ const componentId = `steedos-record-related-list-${relatedObjectName}_${new Date().getTime()}`;
12485
12603
  const isMobile = window.innerWidth < 768;
12486
12604
  let headerToolbar = [];
12487
12605
  if(!isMobile){
@@ -12755,8 +12873,8 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
12755
12873
  /*
12756
12874
  * @Author: baozhoutao@steedos.com
12757
12875
  * @Date: 2022-07-05 15:55:39
12758
- * @LastEditors: liaodaxue
12759
- * @LastEditTime: 2024-02-05 17:56:27
12876
+ * @LastEditors: baozhoutao@steedos.com
12877
+ * @LastEditTime: 2024-02-18 16:05:21
12760
12878
  * @Description:
12761
12879
  */
12762
12880
 
@@ -13325,10 +13443,14 @@ async function getRecordServiceSchema(objectName, appId, props = {}, body) {
13325
13443
  "componentId": serviceId,
13326
13444
  "expression": "this.__deletedRecord != true"
13327
13445
  },
13446
+ {
13447
+ "actionType": "closeDialog",
13448
+ "expression": "this.__deletedRecord === true && this._inDrawer === true"
13449
+ },
13328
13450
  {
13329
13451
  "actionType": "custom",
13330
13452
  "script": "window.goBack()",
13331
- "expression": "this.__deletedRecord === true"
13453
+ "expression": "this.__deletedRecord === true && this._inDrawer != true"
13332
13454
  }
13333
13455
  ]
13334
13456
  },
@@ -14848,6 +14970,33 @@ async function getApi(object, recordId, fields, options){
14848
14970
  }
14849
14971
  }
14850
14972
 
14973
+ async function getAutoFill(field, refObject) {
14974
+ let autoFillMapping = field.auto_fill_mapping;
14975
+ if (autoFillMapping && autoFillMapping.length) {
14976
+ let fillMapping = {};
14977
+ let fieldsForApi = [];
14978
+ autoFillMapping.forEach(function (item) {
14979
+ fillMapping[item.to] = `\${${item.from}}`;
14980
+ fieldsForApi.push(item.from);
14981
+ });
14982
+ // let api = {
14983
+ // // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
14984
+ // "url": `/api/v1/${refObject.name}/\${${field.name}}?fields=${JSON.stringify(fieldsForApi)}`,
14985
+ // // "responseData": {
14986
+ // // "name": "${name}"
14987
+ // // },
14988
+ // "silent": false
14989
+ // }
14990
+ // return {
14991
+ // fillMapping,
14992
+ // // api
14993
+ // }
14994
+ // 因为autoFill中配置了api的话,在表单初始化(比如新建记录)时并不会触发执行autoFill,所以只能暂时不用api
14995
+ // 给amis报过问题了,见:https://github.com/baidu/amis/issues/9631
14996
+ return fillMapping;
14997
+ }
14998
+ }
14999
+
14851
15000
  async function lookupToAmis(field, readonly, ctx){
14852
15001
  if(!ctx){
14853
15002
  ctx = {};
@@ -14931,6 +15080,10 @@ async function lookupToAmis(field, readonly, ctx){
14931
15080
  amisSchema = _$1__namespace.defaultsDeep({}, pageAmisSchema, amisSchema);
14932
15081
  }
14933
15082
  }
15083
+ const autoFill = await getAutoFill(field);
15084
+ if(autoFill){
15085
+ amisSchema.autoFill = autoFill;
15086
+ }
14934
15087
  return amisSchema;
14935
15088
  }
14936
15089
 
@@ -15106,6 +15259,7 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
15106
15259
  {
15107
15260
  "type": "editor",
15108
15261
  "name": field.name,
15262
+ "labelClassName": "none",
15109
15263
  "language": "markdown",
15110
15264
  }
15111
15265
  ]
@@ -17603,7 +17757,9 @@ async function getButtonNew(props) {
17603
17757
  "actions": await getButtonActions(props, "new")
17604
17758
  }
17605
17759
  },
17606
- "level": "primary"
17760
+ "level": "link",
17761
+ "className": "text-gray-500",
17762
+ "size": "xs"
17607
17763
  };
17608
17764
  }
17609
17765
 
@@ -17613,6 +17769,7 @@ async function getButtonEdit(props, showAsInlineEditMode) {
17613
17769
  "label": "",
17614
17770
  "icon": `fa fa-${showAsInlineEditMode ? "expand-alt" : "pencil"}`,//inline edit模式时显示为放开按钮,只读时显示为笔按钮
17615
17771
  "level": "link",
17772
+ "className": "text-gray-400",
17616
17773
  "onEvent": {
17617
17774
  "click": {
17618
17775
  "actions": await getButtonActions(props, "edit")
@@ -17627,6 +17784,7 @@ async function getButtonView(props) {
17627
17784
  "label": "",
17628
17785
  "icon": "fa fa-expand-alt",//fa-external-link
17629
17786
  "level": "link",
17787
+ "className": "text-gray-400",
17630
17788
  "onEvent": {
17631
17789
  "click": {
17632
17790
  "actions": await getButtonActions(props, "readonly")
@@ -17639,6 +17797,7 @@ async function getButtonDelete(props) {
17639
17797
  return {
17640
17798
  "type": "dropdown-button",
17641
17799
  "level": "link",
17800
+ "btnClassName": "text-gray-400",
17642
17801
  "icon": "fa fa-trash-alt",
17643
17802
  "size": "xs",
17644
17803
  "hideCaret": true,
@@ -17873,6 +18032,10 @@ const getAmisInputTableSchema = async (props) => {
17873
18032
  "labelAlign": props.labelAlign,
17874
18033
  //控制control的mode属性,https://aisuda.bce.baidu.com/amis/zh-CN/components/form/formitem#表单项展示
17875
18034
  "mode": props.mode || null,
18035
+ "visibleOn": props.$schema.visibleOn,
18036
+ "visible": props.$schema.visible,
18037
+ "hiddenOn": props.$schema.hiddenOn,
18038
+ "hidden": props.$schema.hidden,
17876
18039
  className
17877
18040
  };
17878
18041
  // console.log("===schema===", schema);
@@ -20545,11 +20708,15 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
20545
20708
  getButtonVisibleOn: getButtonVisibleOn,
20546
20709
  getButtons: getButtons,
20547
20710
  getCalendarSchema: getCalendarSchema,
20711
+ getCreatedInfoTpl: getCreatedInfoTpl,
20712
+ getDateTimeTpl: getDateTimeTpl,
20713
+ getDateTpl: getDateTpl,
20548
20714
  getDefaultRenderData: getDefaultRenderData,
20549
20715
  getEnv: getEnv,
20550
20716
  getEnvs: getEnvs,
20551
20717
  getEvn: getEvn,
20552
20718
  getField: getField,
20719
+ getFieldTpl: getFieldTpl,
20553
20720
  getFileSrc: getFileSrc,
20554
20721
  getFlowFormSchema: getFlowFormSchema,
20555
20722
  getFormPageInitSchema: getFormPageInitSchema,
@@ -20566,8 +20733,14 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
20566
20733
  getListViewItemButtons: getListViewItemButtons,
20567
20734
  getListViewSort: getListViewSort,
20568
20735
  getListviewInitSchema: getListviewInitSchema,
20736
+ getLocationTpl: getLocationTpl,
20569
20737
  getLookupSapceUserTreeSchema: getLookupSapceUserTreeSchema,
20738
+ getLookupTpl: getLookupTpl,
20739
+ getModifiedInfoTpl: getModifiedInfoTpl,
20740
+ getNameTpl: getNameTpl,
20741
+ getNameTplUrl: getNameTplUrl,
20570
20742
  getNotifications: getNotifications,
20743
+ getNumberTpl: getNumberTpl,
20571
20744
  getObjectDetailButtons: getObjectDetailButtons,
20572
20745
  getObjectDetailButtonsSchemas: getObjectDetailButtonsSchemas,
20573
20746
  getObjectDetailMoreButtons: getObjectDetailMoreButtons,
@@ -20588,6 +20761,7 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
20588
20761
  getObjectRelatedListHeader: getObjectRelatedListHeader,
20589
20762
  getObjectRelatedListsMiniSchema: getObjectRelatedListsMiniSchema,
20590
20763
  getPage: getPage,
20764
+ getPasswordTpl: getPasswordTpl,
20591
20765
  getRecord: getRecord,
20592
20766
  getRecordDetailHeaderSchema: getRecordDetailHeaderSchema,
20593
20767
  getRecordDetailMiniSchema: getRecordDetailMiniSchema,
@@ -20596,21 +20770,29 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
20596
20770
  getRecordPageInitSchema: getRecordPageInitSchema,
20597
20771
  getRecordPermissions: getRecordPermissions,
20598
20772
  getRecordServiceSchema: getRecordServiceSchema,
20773
+ getRefObjectNameFieldName: getRefObjectNameFieldName,
20599
20774
  getReferenceTo: getReferenceTo,
20600
20775
  getReferenceToFieldSchema: getReferenceToFieldSchema,
20601
20776
  getReferenceToSync: getReferenceToSync,
20777
+ getRelatedFieldTpl: getRelatedFieldTpl,
20602
20778
  getRelatedFieldValue: getRelatedFieldValue,
20603
20779
  getRelatedListSchema: getRelatedListSchema,
20604
20780
  getRelatedsCount: getRelatedsCount,
20605
20781
  getRootUrl: getRootUrl,
20782
+ getSelectMap: getSelectMap,
20783
+ getSelectTpl: getSelectTpl,
20606
20784
  getSelectUserSchema: getSelectUserSchema,
20607
20785
  getSpaceUsersPickerAmisSchema: getSpaceUsersPickerAmisSchema,
20608
20786
  getSpaceUsersPickerSchema: getSpaceUsersPickerSchema,
20609
20787
  getSteedosAuth: getSteedosAuth,
20788
+ getSwitchTpl: getSwitchTpl,
20610
20789
  getTableSchema: getTableSchema,
20611
20790
  getTenantId: getTenantId,
20791
+ getTimeTpl: getTimeTpl,
20612
20792
  getUISchema: getUISchema,
20613
20793
  getUISchemaSync: getUISchemaSync$1,
20794
+ getUiFieldTpl: getUiFieldTpl,
20795
+ getUiFileSizeTpl: getUiFileSizeTpl,
20614
20796
  getUserId: getUserId,
20615
20797
  getViewSchema: getViewSchema,
20616
20798
  isExpression: isExpression$1,
@@ -21557,7 +21739,8 @@ var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void
21557
21739
  if (body) {
21558
21740
  schema.body = body;
21559
21741
  }
21560
- // console.log(`AmisRecordDetail====schema==>`, schema)
21742
+ // console.log(`AmisRecordDetail====schema==>`, schema);
21743
+ schema.data = Object.assign({}, $schema.data, schema.data);
21561
21744
  return [2 /*return*/, schema];
21562
21745
  }
21563
21746
  });
@@ -21567,7 +21750,7 @@ var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void
21567
21750
  * @Author: baozhoutao@steedos.com
21568
21751
  * @Date: 2022-12-08 10:32:17
21569
21752
  * @LastEditors: baozhoutao@steedos.com
21570
- * @LastEditTime: 2024-01-16 14:09:23
21753
+ * @LastEditTime: 2024-02-18 16:05:56
21571
21754
  * @Description:
21572
21755
  */
21573
21756
  var AmisRecordService = function (props) { return __awaiter(void 0, void 0, void 0, function () {
@@ -22961,10 +23144,58 @@ function getAmisStaticFieldType(type, data_type, options) {
22961
23144
  else if (type === 'textarea') {
22962
23145
  return 'static';
22963
23146
  }
23147
+ else if (type === 'html') {
23148
+ return 'input-rich-text';
23149
+ }
23150
+ else if (type === 'markdown') {
23151
+ return 'static-markdown';
23152
+ }
23153
+ else if (type === 'select') {
23154
+ return 'static-mapping';
23155
+ }
23156
+ else if (type === 'color') {
23157
+ return 'static-color';
23158
+ }
22964
23159
  return type;
22965
23160
  }
23161
+ var REFERENCE_VALUE_ITEM_ONCLICK = {
23162
+ "click": {
23163
+ "actions": [
23164
+ {
23165
+ "actionType": "drawer",
23166
+ "drawer": {
23167
+ "type": "drawer",
23168
+ "title": "&nbsp;",
23169
+ "headerClassName": "hidden",
23170
+ "size": "lg",
23171
+ "bodyClassName": "p-0 m-0",
23172
+ "closeOnEsc": true,
23173
+ "closeOnOutside": true,
23174
+ "resizable": true,
23175
+ "actions": [],
23176
+ "body": [
23177
+ {
23178
+ "type": "steedos-record-detail",
23179
+ "objectApiName": "${objectName}",
23180
+ "recordId": "${value}",
23181
+ "showBackButton": false,
23182
+ "showButtons": true,
23183
+ "data": {
23184
+ "_inDrawer": true,
23185
+ "recordLoaded": false, // 重置数据加载状态
23186
+ }
23187
+ }
23188
+ ],
23189
+ "className": "steedos-record-detail-drawer app-popover",
23190
+ "id": "u:fc5f055afa8c"
23191
+ },
23192
+ "preventDefault": true
23193
+ }
23194
+ ]
23195
+ }
23196
+ };
22966
23197
  var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void 0, function () {
22967
- var steedosField, field, _a, readonly, _b, ctx, config, fStatic, env, inInputTable, className, defaultSource, source, fieldBaseProps, referenceTo_1, fieldValue, fieldRefObject, disPlayValue, res, valueOptions_1, fieldValue, values, disPlayValue_1, schema, fieldSchema, fieldValue, hasImageOrFile_1, fieldHtml_1, schema, tableFields, _c, _d, subField, subFieldName, fieldAmis, schema, error_1;
23198
+ var steedosField, field, _a, readonly, _b, ctx, config, fStatic, env, inInputTable, className, lookupATagClick, defaultSource, source, fieldBaseProps, referenceTo_1, fieldValue, fieldRefObject, disPlayValue, res, valueOptions_1, fieldValue, values, disPlayValue_1, schema, fieldSchema, fieldValue, hasImageOrFile_1, fieldHtml_1, schema, map, tableFields, _c, _d, subField, subFieldName, fieldAmis, schema, error_1;
22968
23199
  var _e, e_1, _f;
22969
23200
  var _g, _h, _j, _k, _l, _m;
22970
23201
  return __generator(this, function (_o) {
@@ -23003,6 +23234,10 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
23003
23234
  case 1:
23004
23235
  _o.trys.push([1, 24, , 25]);
23005
23236
  if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/, 7];
23237
+ lookupATagClick = 'onclick="return false;"';
23238
+ if (window.innerWidth < 768) {
23239
+ lookupATagClick = "";
23240
+ }
23006
23241
  defaultSource = {
23007
23242
  "method": "post",
23008
23243
  "url": "${context.rootUrl}/graphql",
@@ -23079,8 +23314,8 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
23079
23314
  labelClassName: "hidden",
23080
23315
  label: false,
23081
23316
  className: 'm-0',
23082
- tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\">${label}</a>",
23083
- popOver: fieldRefObject.compactLayouts ? {
23317
+ tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\" ".concat(lookupATagClick, ">${label}</a>"),
23318
+ popOver: fieldRefObject.compactLayouts && window.innerWidth >= 768 ? {
23084
23319
  "trigger": "hover",
23085
23320
  "className": "steedos-record-detail-popover",
23086
23321
  "position": "left-bottom",
@@ -23099,11 +23334,12 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
23099
23334
  "showBackButton": false,
23100
23335
  "data": {
23101
23336
  "objectName": "${objectName}",
23102
- "recordId": "${value}"
23337
+ "recordId": "${value}",
23103
23338
  }
23104
23339
  }
23105
23340
  ]
23106
- } : null
23341
+ } : null,
23342
+ onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
23107
23343
  }
23108
23344
  }
23109
23345
  ]
@@ -23152,8 +23388,8 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
23152
23388
  items: {
23153
23389
  type: 'static',
23154
23390
  className: 'm-0',
23155
- tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\">${label}</a>",
23156
- popOver: fieldRefObject.compactLayouts ? {
23391
+ tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\" ".concat(lookupATagClick, ">${label}</a>"),
23392
+ popOver: fieldRefObject.compactLayouts && window.innerWidth >= 768 ? {
23157
23393
  "trigger": "hover",
23158
23394
  "className": "steedos-record-detail-popover",
23159
23395
  "position": "left-bottom",
@@ -23172,11 +23408,12 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
23172
23408
  "showBackButton": false,
23173
23409
  "data": {
23174
23410
  "objectName": "${objectName}",
23175
- "recordId": "${value}"
23411
+ "recordId": "${value}",
23176
23412
  }
23177
23413
  }
23178
23414
  ]
23179
- } : null
23415
+ } : null,
23416
+ onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
23180
23417
  }
23181
23418
  }
23182
23419
  ]
@@ -23259,8 +23496,10 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
23259
23496
  return [3 /*break*/, 20];
23260
23497
  case 12:
23261
23498
  if (!(steedosField.type === "select")) return [3 /*break*/, 13];
23499
+ map = getSelectMap(steedosField.options);
23262
23500
  Object.assign(schema, {
23263
- "placeholder": ""
23501
+ "placeholder": "",
23502
+ "map": map
23264
23503
  });
23265
23504
  return [3 /*break*/, 20];
23266
23505
  case 13:
@@ -23363,6 +23602,36 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
23363
23602
  tpl: "<%=(data.".concat(steedosField.name, " || \"\").split(\"\\n\").join('<br>')%>")
23364
23603
  });
23365
23604
  }
23605
+ else if (steedosField.type === 'html') {
23606
+ Object.assign(schema, {
23607
+ "receiver": "${context.rootUrl}/s3/images",
23608
+ "options": {
23609
+ "menu": {
23610
+ "insert": {
23611
+ "title": "Insert",
23612
+ "items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
23613
+ }
23614
+ },
23615
+ "plugins": [
23616
+ "autoresize"
23617
+ ],
23618
+ // "max_height": 2000,
23619
+ "statusbar": false,
23620
+ "readonly": true,
23621
+ "toolbar": false,
23622
+ "menubar": false
23623
+ }
23624
+ });
23625
+ }
23626
+ else if (steedosField.type === 'markdown') {
23627
+ Object.assign(schema, {
23628
+ "options": {
23629
+ "linkify": true,
23630
+ "html": true,
23631
+ "breaks": true
23632
+ }
23633
+ });
23634
+ }
23366
23635
  _o.label = 20;
23367
23636
  case 20:
23368
23637
  Object.assign(schema, steedosField.amis || {});
@@ -23676,12 +23945,18 @@ var AmisInstanceDetail = function (props) { return __awaiter(void 0, void 0, voi
23676
23945
  }); };
23677
23946
 
23678
23947
  var AmisInputTable = function (props) { return __awaiter(void 0, void 0, void 0, function () {
23679
- var amisSchema;
23948
+ var extendProps, amisSchema;
23680
23949
  return __generator(this, function (_a) {
23681
23950
  switch (_a.label) {
23682
23951
  case 0:
23683
- props.$schema, props.fields, props.name, props.id, props.data, props.columns, props.amis, props.className, props.tableClassName, props.headerToolbar, props.footerToolbar, props.inlineEditMode, props.strictMode, props.dialog, props.primaryKey, props.showOperation, props.fieldPrefix, props.autoGeneratePrimaryKeyValue, props.mode;
23684
- return [4 /*yield*/, getAmisInputTableSchema(props)];
23952
+ props.$schema, props.fields, props.name, props.id, props.data, props.columns, props.amis, props.className, props.tableClassName, props.headerToolbar, props.footerToolbar, props.inlineEditMode, props.strictMode, props.dialog, props.primaryKey, props.showOperation, props.fieldPrefix, props.autoGeneratePrimaryKeyValue, props.mode, props.disabledOn, props.disabled, props.visibleOn, props.visible, props.hiddenOn, props.hidden;
23953
+ extendProps = {};
23954
+ if (props.disabledOn || props.disabled) {
23955
+ extendProps["addable"] = false;
23956
+ extendProps["editable"] = false;
23957
+ extendProps["removable"] = false;
23958
+ }
23959
+ return [4 /*yield*/, getAmisInputTableSchema(Object.assign({}, props, extendProps))];
23685
23960
  case 1:
23686
23961
  amisSchema = _a.sent();
23687
23962
  // console.log("=AmisInputTable==amisSchema====", amisSchema);
@@ -23717,14 +23992,17 @@ var AmisRecordDetailMini = function (props) { return __awaiter(void 0, void 0, v
23717
23992
  if (props.$$editor) {
23718
23993
  options.isEditor = true;
23719
23994
  }
23720
- console.log("AmisRecordDetailMini==2=>", objectApiName, options);
23721
23995
  return [4 /*yield*/, getRecordDetailMiniSchema(objectApiName, appId, options)];
23722
23996
  case 1:
23723
23997
  schema = _b.sent();
23724
23998
  if (!_$1.isEmpty(schemaData)) {
23725
- schema.data = schemaData;
23999
+ schema.data = Object.assign({
24000
+ "_inDrawer": false,
24001
+ "_inRecordMini": true,
24002
+ "recordLoaded": false, // 重置数据加载状态
24003
+ }, schemaData);
23726
24004
  }
23727
- // console.log(`AmisRecordDetailMini===>`, schema)
24005
+ // console.log(`AmisRecordDetailMini===>`, schema)
23728
24006
  return [2 /*return*/, schema];
23729
24007
  }
23730
24008
  });