@steedos-widgets/amis-lib 1.2.0 → 1.2.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.
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +481 -24
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +481 -24
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +481 -24
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/fields/lookup.d.ts +1 -0
- package/dist/types/lib/converter/amis/toolbar.d.ts +2 -1
- package/dist/types/lib/objects.d.ts +2 -0
- package/dist/types/schema/standard_delete.amis.d.ts +2 -0
- package/dist/types/standard/button.d.ts +2 -0
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -1612,8 +1612,8 @@ const getSchema$3 = async (uiSchema, ctx) => {
|
|
|
1612
1612
|
/*
|
|
1613
1613
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
1614
1614
|
* @Date: 2023-03-22 09:31:21
|
|
1615
|
-
* @LastEditors:
|
|
1616
|
-
* @LastEditTime: 2023-04-
|
|
1615
|
+
* @LastEditors: Please set LastEditors
|
|
1616
|
+
* @LastEditTime: 2023-04-12 10:35:36
|
|
1617
1617
|
*/
|
|
1618
1618
|
const getSchema$2 = (uiSchema)=>{
|
|
1619
1619
|
return {
|
|
@@ -1668,7 +1668,8 @@ const getSchema$2 = (uiSchema)=>{
|
|
|
1668
1668
|
"eventName": "@data.changed.${_master.objectName}"
|
|
1669
1669
|
},
|
|
1670
1670
|
"data": {
|
|
1671
|
-
"objectName": "${_master.objectName}"
|
|
1671
|
+
"objectName": "${_master.objectName}",
|
|
1672
|
+
"_isRelated": "${_isRelated}"
|
|
1672
1673
|
},
|
|
1673
1674
|
"expression": `\${_master.objectName != '${uiSchema.name}' && _master.objectName}`
|
|
1674
1675
|
}
|
|
@@ -3384,6 +3385,9 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
|
3384
3385
|
};
|
|
3385
3386
|
};
|
|
3386
3387
|
|
|
3388
|
+
|
|
3389
|
+
|
|
3390
|
+
|
|
3387
3391
|
const onFieldsFilterToggleScript = `
|
|
3388
3392
|
const scope = event.context.scoped;
|
|
3389
3393
|
const filterForm = scope.getComponents().find(function(n){
|
|
@@ -3401,7 +3405,6 @@ setTimeout(()=>{
|
|
|
3401
3405
|
|
|
3402
3406
|
function getExportApiRequestAdaptorScript(){
|
|
3403
3407
|
return `
|
|
3404
|
-
console.log(api.url);
|
|
3405
3408
|
// 获取列表视图的属性
|
|
3406
3409
|
let uiSchema = api.body.uiSchema;
|
|
3407
3410
|
let list_views = uiSchema.list_views;
|
|
@@ -3450,12 +3453,12 @@ function getExportApiRequestAdaptorScript(){
|
|
|
3450
3453
|
if (filters && filters.length > 0) {
|
|
3451
3454
|
api.url = api.url + "&filters=" + JSON.stringify(filters);
|
|
3452
3455
|
}
|
|
3453
|
-
console.log(api.url);
|
|
3454
3456
|
return api;
|
|
3455
3457
|
`
|
|
3456
3458
|
}
|
|
3457
3459
|
|
|
3458
|
-
function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false, hiddenCount = false, headerToolbarItems} = {}){
|
|
3460
|
+
function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false, hiddenCount = false, headerToolbarItems, filterVisible = true} = {}){
|
|
3461
|
+
// console.log(`getObjectHeaderToolbar====>`, filterVisible)
|
|
3459
3462
|
const isMobile = window.innerWidth < 768;
|
|
3460
3463
|
if(isMobile){
|
|
3461
3464
|
showDisplayAs = false;
|
|
@@ -3492,7 +3495,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3492
3495
|
}
|
|
3493
3496
|
},
|
|
3494
3497
|
},
|
|
3495
|
-
{
|
|
3498
|
+
filterVisible ? {
|
|
3496
3499
|
"label": "",
|
|
3497
3500
|
"icon": "fa fa-search",
|
|
3498
3501
|
"type": "button",
|
|
@@ -3508,7 +3511,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3508
3511
|
]
|
|
3509
3512
|
}
|
|
3510
3513
|
}
|
|
3511
|
-
},
|
|
3514
|
+
} : {},
|
|
3512
3515
|
showDisplayAs? getDisplayAsButton(mainObject?.name) : {}
|
|
3513
3516
|
]
|
|
3514
3517
|
}else {
|
|
@@ -3524,10 +3527,6 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3524
3527
|
// "type": "columns-toggler",
|
|
3525
3528
|
// "className": "mr-2"
|
|
3526
3529
|
// },
|
|
3527
|
-
// {
|
|
3528
|
-
// "type": "export-excel",
|
|
3529
|
-
// "align": "right"
|
|
3530
|
-
// },
|
|
3531
3530
|
hiddenCount ? {} : {
|
|
3532
3531
|
"type": "tpl",
|
|
3533
3532
|
"tpl": "${count} 个项目"
|
|
@@ -3573,7 +3572,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3573
3572
|
}
|
|
3574
3573
|
}
|
|
3575
3574
|
},
|
|
3576
|
-
{
|
|
3575
|
+
filterVisible ? {
|
|
3577
3576
|
"label": "",
|
|
3578
3577
|
"icon": "fa fa-search",
|
|
3579
3578
|
"type": "button",
|
|
@@ -3589,8 +3588,460 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3589
3588
|
]
|
|
3590
3589
|
}
|
|
3591
3590
|
}
|
|
3591
|
+
} : {},
|
|
3592
|
+
{
|
|
3593
|
+
"type": "dropdown-button",
|
|
3594
|
+
"trigger": "click",
|
|
3595
|
+
"icon": "fa fa-cog",
|
|
3596
|
+
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
3597
|
+
"align": "right",
|
|
3598
|
+
"visibleOn": "${!isLookup}",
|
|
3599
|
+
"buttons": [
|
|
3600
|
+
{
|
|
3601
|
+
"label": "列表视图操作",
|
|
3602
|
+
"children": [
|
|
3603
|
+
{
|
|
3604
|
+
"type": "button",
|
|
3605
|
+
"label": "新建",
|
|
3606
|
+
"onEvent": {
|
|
3607
|
+
"click": {
|
|
3608
|
+
"weight": 0,
|
|
3609
|
+
"actions": [
|
|
3610
|
+
{
|
|
3611
|
+
"dialog": {
|
|
3612
|
+
"type": "dialog",
|
|
3613
|
+
"title": "新建 列表视图",
|
|
3614
|
+
"data": {
|
|
3615
|
+
"&": "$$",
|
|
3616
|
+
"all": "${uiSchema.list_views.all}",
|
|
3617
|
+
"list_view": "${uiSchema.list_views[listName]}",
|
|
3618
|
+
"appId": "${appId}",
|
|
3619
|
+
"global": "${global}",
|
|
3620
|
+
"objectName": "${objectName}",
|
|
3621
|
+
},
|
|
3622
|
+
"body": [
|
|
3623
|
+
{
|
|
3624
|
+
"type": "steedos-object-form",
|
|
3625
|
+
"label": "对象表单",
|
|
3626
|
+
"objectApiName": "object_listviews",
|
|
3627
|
+
"recordId": "",
|
|
3628
|
+
"mode": "edit",
|
|
3629
|
+
"defaultData": {
|
|
3630
|
+
"&": "${list_view}",
|
|
3631
|
+
"name":"",
|
|
3632
|
+
"label":"",
|
|
3633
|
+
"filters":"",
|
|
3634
|
+
"shared":false
|
|
3635
|
+
},
|
|
3636
|
+
"fieldsExtend": "{\n \"label\": {\n \"is_wide\": true\n },\n \"name\": {\n \"is_wide\": true,\n \"amis\": {\n \"hidden\": true\n }\n },\n \"object_name\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"filter_scope\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"columns\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"filter_fields\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"scrolling_mode\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"sort\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"show_count\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"type\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"shared\":{\n \"amis\":{\n \"visibleOn\":\"${global.user.is_space_admin}\"\n }\n}\n}",
|
|
3637
|
+
"fields": [
|
|
3638
|
+
"label",
|
|
3639
|
+
"name",
|
|
3640
|
+
"object_name",
|
|
3641
|
+
"filter_scope",
|
|
3642
|
+
"show_count",
|
|
3643
|
+
"columns.$.field",
|
|
3644
|
+
"columns.$.width",
|
|
3645
|
+
"sort.$.field_name",
|
|
3646
|
+
"sort.$.order",
|
|
3647
|
+
"filters",
|
|
3648
|
+
"mobile_columns.$.field",
|
|
3649
|
+
"searchable_fields.$.field",
|
|
3650
|
+
"is_system",
|
|
3651
|
+
"shared"
|
|
3652
|
+
],
|
|
3653
|
+
"onEvent": {
|
|
3654
|
+
"submitSucc": {
|
|
3655
|
+
"weight": 0,
|
|
3656
|
+
"actions": [
|
|
3657
|
+
{
|
|
3658
|
+
"args": {
|
|
3659
|
+
// 直接使用recordId不能拿到数据,只能通过result里面拿数据
|
|
3660
|
+
"url": "${context.rootUrl}/app/${appId}/${objectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
3661
|
+
"blank": false
|
|
3662
|
+
},
|
|
3663
|
+
"actionType": "url",
|
|
3664
|
+
}
|
|
3665
|
+
]
|
|
3666
|
+
}
|
|
3667
|
+
},
|
|
3668
|
+
"messages": {
|
|
3669
|
+
"success": "成功",
|
|
3670
|
+
"failed": "失败"
|
|
3671
|
+
},
|
|
3672
|
+
}
|
|
3673
|
+
],
|
|
3674
|
+
"showCloseButton": true,
|
|
3675
|
+
"showErrorMsg": true,
|
|
3676
|
+
"showLoading": true,
|
|
3677
|
+
"closeOnEsc": false,
|
|
3678
|
+
"dataMapSwitch": false,
|
|
3679
|
+
"size": "lg"
|
|
3680
|
+
},
|
|
3681
|
+
"actionType": "dialog"
|
|
3682
|
+
}
|
|
3683
|
+
]
|
|
3684
|
+
}
|
|
3685
|
+
}
|
|
3686
|
+
},
|
|
3687
|
+
{
|
|
3688
|
+
"type": "button",
|
|
3689
|
+
"label": "复制",
|
|
3690
|
+
"onEvent": {
|
|
3691
|
+
"click": {
|
|
3692
|
+
"weight": 0,
|
|
3693
|
+
"actions": [
|
|
3694
|
+
{
|
|
3695
|
+
"dialog": {
|
|
3696
|
+
"type": "dialog",
|
|
3697
|
+
"title": "复制 列表视图",
|
|
3698
|
+
"data": {
|
|
3699
|
+
"&": "$$",
|
|
3700
|
+
"listName": "${listName}",
|
|
3701
|
+
"objectName": "${objectName}",
|
|
3702
|
+
"list_view": "${uiSchema.list_views[listName]}",
|
|
3703
|
+
"appId": "${appId}",
|
|
3704
|
+
"global": "${global}"
|
|
3705
|
+
},
|
|
3706
|
+
"body": [
|
|
3707
|
+
{
|
|
3708
|
+
"type": "steedos-object-form",
|
|
3709
|
+
"label": "对象表单",
|
|
3710
|
+
"objectApiName": "object_listviews",
|
|
3711
|
+
"recordId": "",
|
|
3712
|
+
"mode": "edit",
|
|
3713
|
+
"fields": [
|
|
3714
|
+
],
|
|
3715
|
+
"defaultData": {
|
|
3716
|
+
"&": "${list_view}",
|
|
3717
|
+
"name":"",
|
|
3718
|
+
"label": "${list_view.label}的副本",
|
|
3719
|
+
"shared":false
|
|
3720
|
+
},
|
|
3721
|
+
"fieldsExtend": "{\n \"label\": {\n \"is_wide\": true\n },\n \"name\": {\n \"is_wide\": true,\n \"amis\": {\n \"hidden\": true\n }\n },\n \"object_name\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"filter_scope\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"columns\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"filter_fields\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"scrolling_mode\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"sort\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"show_count\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"type\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"shared\":{\n \"amis\":{\n \"visibleOn\":\"${global.user.is_space_admin}\"\n }\n}\n}",
|
|
3722
|
+
"fields": [
|
|
3723
|
+
"label",
|
|
3724
|
+
"name",
|
|
3725
|
+
"object_name",
|
|
3726
|
+
"filter_scope",
|
|
3727
|
+
"show_count",
|
|
3728
|
+
"columns.$.field",
|
|
3729
|
+
"columns.$.width",
|
|
3730
|
+
"sort.$.field_name",
|
|
3731
|
+
"sort.$.order",
|
|
3732
|
+
"filters",
|
|
3733
|
+
"mobile_columns.$.field",
|
|
3734
|
+
"searchable_fields.$.field",
|
|
3735
|
+
"is_system",
|
|
3736
|
+
"shared"
|
|
3737
|
+
],
|
|
3738
|
+
"onEvent": {
|
|
3739
|
+
"submitSucc": {
|
|
3740
|
+
"weight": 0,
|
|
3741
|
+
"actions": [
|
|
3742
|
+
{
|
|
3743
|
+
"args": {
|
|
3744
|
+
"url": "${context.rootUrl}/app/${appId}/${objectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
3745
|
+
"blank": false
|
|
3746
|
+
},
|
|
3747
|
+
"actionType": "url",
|
|
3748
|
+
}
|
|
3749
|
+
]
|
|
3750
|
+
}
|
|
3751
|
+
}
|
|
3752
|
+
}
|
|
3753
|
+
],
|
|
3754
|
+
"showCloseButton": true,
|
|
3755
|
+
"showErrorMsg": true,
|
|
3756
|
+
"showLoading": true,
|
|
3757
|
+
"closeOnEsc": false,
|
|
3758
|
+
"dataMapSwitch": false,
|
|
3759
|
+
"size": "lg"
|
|
3760
|
+
},
|
|
3761
|
+
"actionType": "dialog"
|
|
3762
|
+
}
|
|
3763
|
+
]
|
|
3764
|
+
}
|
|
3765
|
+
}
|
|
3766
|
+
},
|
|
3767
|
+
{
|
|
3768
|
+
"type": "button",
|
|
3769
|
+
"label": "重命名",
|
|
3770
|
+
"visibleOn": "(global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && ['all', 'recent', 'my'].indexOf(listName) == -1",
|
|
3771
|
+
"onEvent": {
|
|
3772
|
+
"click": {
|
|
3773
|
+
"weight": 0,
|
|
3774
|
+
"actions": [
|
|
3775
|
+
{
|
|
3776
|
+
"dialog": {
|
|
3777
|
+
"type": "dialog",
|
|
3778
|
+
"title": "重命名 列表视图",
|
|
3779
|
+
"data": {
|
|
3780
|
+
"objectName": "${objectName}",
|
|
3781
|
+
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
3782
|
+
"appId": "${appId}"
|
|
3783
|
+
},
|
|
3784
|
+
"body": [
|
|
3785
|
+
{
|
|
3786
|
+
"type": "steedos-object-form",
|
|
3787
|
+
"label": "对象表单",
|
|
3788
|
+
"objectApiName": "object_listviews",
|
|
3789
|
+
"recordId": "${recordId}",
|
|
3790
|
+
"mode": "edit",
|
|
3791
|
+
"fields": [
|
|
3792
|
+
"label"
|
|
3793
|
+
],
|
|
3794
|
+
"fieldsExtend": "{\n \"label\":{\n \"is_wide\": true\n }\n}",
|
|
3795
|
+
"onEvent": {
|
|
3796
|
+
"submitSucc": {
|
|
3797
|
+
"weight": 0,
|
|
3798
|
+
"actions": [
|
|
3799
|
+
{
|
|
3800
|
+
"args": {
|
|
3801
|
+
"url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${name}",
|
|
3802
|
+
"blank": false
|
|
3803
|
+
},
|
|
3804
|
+
"actionType": "url",
|
|
3805
|
+
},
|
|
3806
|
+
]
|
|
3807
|
+
}
|
|
3808
|
+
}
|
|
3809
|
+
}
|
|
3810
|
+
],
|
|
3811
|
+
"showCloseButton": true,
|
|
3812
|
+
"showErrorMsg": true,
|
|
3813
|
+
"showLoading": true,
|
|
3814
|
+
"size": "lg"
|
|
3815
|
+
},
|
|
3816
|
+
"actionType": "dialog"
|
|
3817
|
+
}
|
|
3818
|
+
]
|
|
3819
|
+
}
|
|
3820
|
+
}
|
|
3821
|
+
},
|
|
3822
|
+
{
|
|
3823
|
+
"type": "button",
|
|
3824
|
+
"label": "共享设置",
|
|
3825
|
+
"visibleOn": "global.user.is_space_admin && ['all', 'recent', 'my'].indexOf(listName) == -1",
|
|
3826
|
+
"onEvent": {
|
|
3827
|
+
"click": {
|
|
3828
|
+
"weight": 0,
|
|
3829
|
+
"actions": [
|
|
3830
|
+
{
|
|
3831
|
+
"dialog": {
|
|
3832
|
+
"type": "dialog",
|
|
3833
|
+
"title": "共享设置",
|
|
3834
|
+
"data": {
|
|
3835
|
+
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
3836
|
+
},
|
|
3837
|
+
"body": [
|
|
3838
|
+
{
|
|
3839
|
+
"type": "steedos-object-form",
|
|
3840
|
+
"label": "对象表单",
|
|
3841
|
+
"objectApiName": "object_listviews",
|
|
3842
|
+
"recordId": "${recordId}",
|
|
3843
|
+
"mode": "edit",
|
|
3844
|
+
"fields": [
|
|
3845
|
+
"shared"
|
|
3846
|
+
]
|
|
3847
|
+
}
|
|
3848
|
+
],
|
|
3849
|
+
"showCloseButton": true,
|
|
3850
|
+
"showErrorMsg": true,
|
|
3851
|
+
"showLoading": true,
|
|
3852
|
+
"closeOnEsc": false,
|
|
3853
|
+
"dataMapSwitch": false,
|
|
3854
|
+
"size": "md"
|
|
3855
|
+
},
|
|
3856
|
+
"actionType": "dialog"
|
|
3857
|
+
}
|
|
3858
|
+
]
|
|
3859
|
+
}
|
|
3860
|
+
}
|
|
3861
|
+
},
|
|
3862
|
+
{
|
|
3863
|
+
"type": "button",
|
|
3864
|
+
"label": "过滤设置",
|
|
3865
|
+
"visibleOn": "(global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && ['all', 'recent', 'my'].indexOf(listName) == -1",
|
|
3866
|
+
"onEvent": {
|
|
3867
|
+
"click": {
|
|
3868
|
+
"weight": 0,
|
|
3869
|
+
"actions": [
|
|
3870
|
+
{
|
|
3871
|
+
"dialog": {
|
|
3872
|
+
"type": "dialog",
|
|
3873
|
+
"title": "过滤设置",
|
|
3874
|
+
"data": {
|
|
3875
|
+
"objectName": "${objectName}",
|
|
3876
|
+
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
3877
|
+
"listName": "${listName}",
|
|
3878
|
+
"appId": "${appId}"
|
|
3879
|
+
},
|
|
3880
|
+
"body": [
|
|
3881
|
+
{
|
|
3882
|
+
"type": "steedos-object-form",
|
|
3883
|
+
"label": "对象表单",
|
|
3884
|
+
"objectApiName": "object_listviews",
|
|
3885
|
+
"recordId": "${recordId}",
|
|
3886
|
+
"mode": "edit",
|
|
3887
|
+
"initApiAdaptor": "",
|
|
3888
|
+
"fields": [
|
|
3889
|
+
"filters"
|
|
3890
|
+
],
|
|
3891
|
+
"initApiRequestAdaptor": "",
|
|
3892
|
+
"initApiAdaptor": "const recordId_tmp = api.body.recordId;\nlet data_tmp;\nif (recordId_tmp) {\n data_tmp = payload.data.initialValues;\n // 数据格式转换\n if (data_tmp) {\n if (data_tmp.filters && lodash.isString(data_tmp.filters)) {\n try {\n data_tmp.filters = JSON.parse(data_tmp.filters);\n } catch (e) { }\n }\n\n if (data_tmp.filters && lodash.isString(data_tmp.filters)) {\n data_tmp._filters_type_controller = 'function';\n } else {\n data_tmp._filters_type_controller = 'conditions'\n }\n\n if (data_tmp._filters_type_controller === 'conditions') {\n data_tmp._filters_conditions = window.amisConvert.filtersToConditions(data_tmp.filters || []);\n data_tmp.filters = data_tmp._filters_conditions;\n } else {\n data_tmp._filters_function = data_tmp.filters;\n }\n }\n}\nfor (key in data_tmp) {\n if (data_tmp[key] === null) {\n delete data_tmp[key];\n }\n}\npayload.data.initialValues = Object.assign(payload.data.initialValues, data_tmp);\ndelete payload.extensions;",
|
|
3893
|
+
"apiRequestAdaptor": "const recordId = api.body.recordId;\nif (formData._filters_type_controller === 'conditions' && formData._filters_conditions) {\n formData.filters = window.amisConvert.conditionsToFilters(formData.filters);\n} else {\n formData.filters = formData._filters_function || null;\n}\n\ndelete formData._filters_type_controller;\ndelete formData._filters_conditions;\ndelete formData._filters_function;\n// 字符串拼接(不支持ES6``语法)\nquery = 'mutation{record: ' + objectName + '__insert(doc: {__saveData}){_id}}';\nif (api.body.recordId) {\n query = 'mutation{record: ' + objectName + '__update(id: \"' + recordId + '\", doc: {__saveData}){_id}}';\n};\n__saveData = JSON.stringify(JSON.stringify(formData));\napi.data = { query: query.replace('{__saveData}', __saveData) };\n",
|
|
3894
|
+
"fieldsExtend": "{\"filters\": {\n \"visible_on\": \"true\",\n \"amis\": {\n \"type\": \"condition-builder\",\n \"label\": \"条件组件\",\n \"source\": {\n \"method\": \"get\",\n \"url\": \"${context.rootUrl}/service/api/amis-metadata-listviews/getFilterFields?objectName=${objectName}\",\n \"dataType\": \"json\",\n \"headers\": {\n \"Authorization\": \"Bearer ${context.tenantId},${context.authToken}\"\n }\n }\n }\n }\n}",
|
|
3895
|
+
"onEvent": {
|
|
3896
|
+
"submitSucc": {
|
|
3897
|
+
"weight": 0,
|
|
3898
|
+
"actions": [
|
|
3899
|
+
{
|
|
3900
|
+
"args": {
|
|
3901
|
+
"url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${listName}",
|
|
3902
|
+
"blank": false
|
|
3903
|
+
},
|
|
3904
|
+
"actionType": "url",
|
|
3905
|
+
}
|
|
3906
|
+
]
|
|
3907
|
+
}
|
|
3908
|
+
}
|
|
3909
|
+
}
|
|
3910
|
+
],
|
|
3911
|
+
"showCloseButton": true,
|
|
3912
|
+
"showErrorMsg": true,
|
|
3913
|
+
"showLoading": true,
|
|
3914
|
+
"closeOnEsc": false,
|
|
3915
|
+
"dataMapSwitch": false,
|
|
3916
|
+
"size": "lg"
|
|
3917
|
+
},
|
|
3918
|
+
"actionType": "dialog"
|
|
3919
|
+
}
|
|
3920
|
+
]
|
|
3921
|
+
}
|
|
3922
|
+
}
|
|
3923
|
+
},
|
|
3924
|
+
{
|
|
3925
|
+
"type": "button",
|
|
3926
|
+
"label": "显示的列",
|
|
3927
|
+
"visibleOn": "(global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && ['all', 'recent', 'my'].indexOf(listName) == -1",
|
|
3928
|
+
"onEvent": {
|
|
3929
|
+
"click": {
|
|
3930
|
+
"weight": 0,
|
|
3931
|
+
"actions": [
|
|
3932
|
+
{
|
|
3933
|
+
"args": {},
|
|
3934
|
+
"dialog": {
|
|
3935
|
+
"type": "dialog",
|
|
3936
|
+
"title": "显示的列",
|
|
3937
|
+
"data": {
|
|
3938
|
+
"&": "$$",
|
|
3939
|
+
"objectName": "${objectName}",
|
|
3940
|
+
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
3941
|
+
"listName": "${listName}",
|
|
3942
|
+
"appId": "${appId}"
|
|
3943
|
+
},
|
|
3944
|
+
"body": [
|
|
3945
|
+
{
|
|
3946
|
+
"type": "steedos-object-form",
|
|
3947
|
+
"label": "对象表单",
|
|
3948
|
+
"objectApiName": "object_listviews",
|
|
3949
|
+
"recordId": "${recordId}",
|
|
3950
|
+
"mode": "edit",
|
|
3951
|
+
"fieldsExtend": "{\n \"columns\": {\n \"amis\": {\n \"type\": \"transfer\",\n \"sortable\": true,\n \"searchable\": true,\n \"source\": {\n \"method\": \"get\",\n \"url\": \"${context.rootUrl}/service/api/amis-metadata-objects/objects/${objectName}/fields/options\",\n \"headers\": {\n \"Authorization\": \"Bearer ${context.tenantId},${context.authToken}\"\n }\n }\n }\n },\n \"mobile_columns\": {\n \"group\": \"手机端\",\n \"amis\": {\n \"type\": \"transfer\",\n \"sortable\": true,\n \"searchable\": true,\n \"source\": {\n \"method\": \"get\",\n \"url\": \"${context.rootUrl}/service/api/amis-metadata-objects/objects/${objectName}/fields/options\",\n \"headers\": {\n \"Authorization\": \"Bearer ${context.tenantId},${context.authToken}\"\n }\n }\n }\n }\n}",
|
|
3952
|
+
"initApiAdaptor": "const recordId_tmp = api.body.recordId;\nlet columns_tmp = {}, mobile_columns_tmp = {};\nif (recordId_tmp) {\n columns_tmp = payload.data.initialValues.columns;\n mobile_columns_tmp = payload.data.initialValues.mobile_columns;\n if (columns_tmp) {\n columns_tmp = lodash.map(columns_tmp, 'field');\n }\n if (mobile_columns_tmp) {\n mobile_columns_tmp = lodash.map(mobile_columns_tmp, 'field');\n }\n}\npayload.data.initialValues.columns = columns_tmp;\npayload.data.initialValues.mobile_columns = mobile_columns_tmp;\n\ndelete payload.extensions;\nreturn payload;",
|
|
3953
|
+
"apiRequestAdaptor": "const formData_tmp = api.body.$;\nconst objectName_tmp = api.body.objectName;\nconst recordId_tmp = api.body.recordId;\n\nif (typeof formData_tmp.columns == 'string') {\n formData_tmp.columns = formData_tmp.columns?.split(',');\n}\nif (typeof formData_tmp.mobile_columns == 'string') {\n formData_tmp.mobile_columns = formData_tmp.mobile_columns?.split(',');\n}\n\n// 数据格式转换\nformData_tmp.columns = lodash.map(formData_tmp.columns, (item) => {\n return { field: item };\n});\nformData.mobile_columns = lodash.map(formData.mobile_columns, (item) => {\n return { field: item };\n});\n\n// 字符串拼接(不支持ES6语法)\nlet query_tmp = 'mutation{record: ' + objectName_tmp + '__insert(doc: {__saveData}){_id}}';\nif (api.body.recordId) {\n query_tmp = 'mutation{record: ' + objectName_tmp + '__update(id: \"' + recordId_tmp +'\", doc: {__saveData}){_id}}';\n};\ndelete formData_tmp._id;\nlet __saveData_tmp = JSON.stringify(JSON.stringify(formData_tmp));\napi.data = { query: query_tmp.replace('{__saveData}', __saveData_tmp) };\n\nreturn api;",
|
|
3954
|
+
"fields": [
|
|
3955
|
+
"columns",
|
|
3956
|
+
"mobile_columns"
|
|
3957
|
+
],
|
|
3958
|
+
"onEvent": {
|
|
3959
|
+
"submitSucc": {
|
|
3960
|
+
"weight": 0,
|
|
3961
|
+
"actions": [
|
|
3962
|
+
{
|
|
3963
|
+
"args": {
|
|
3964
|
+
"url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${listName}",
|
|
3965
|
+
"blank": false
|
|
3966
|
+
},
|
|
3967
|
+
"actionType": "url"
|
|
3968
|
+
}
|
|
3969
|
+
]
|
|
3970
|
+
}
|
|
3971
|
+
}
|
|
3972
|
+
}
|
|
3973
|
+
],
|
|
3974
|
+
"searchable": true,
|
|
3975
|
+
"showCloseButton": true,
|
|
3976
|
+
"showErrorMsg": true,
|
|
3977
|
+
"showLoading": true,
|
|
3978
|
+
"size": "lg"
|
|
3979
|
+
},
|
|
3980
|
+
"actionType": "dialog"
|
|
3981
|
+
}
|
|
3982
|
+
]
|
|
3983
|
+
}
|
|
3984
|
+
}
|
|
3985
|
+
},
|
|
3986
|
+
{
|
|
3987
|
+
"type": "button",
|
|
3988
|
+
"label": "删除",
|
|
3989
|
+
"visibleOn": "(global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && ['all', 'recent', 'my'].indexOf(listName) == -1",
|
|
3990
|
+
"confirmText": "如果您删除此列表视图,该视图将为所有具备访问权限的用户永久删除。是否确定要删除?",
|
|
3991
|
+
"onEvent": {
|
|
3992
|
+
"click": {
|
|
3993
|
+
"actions": [
|
|
3994
|
+
{
|
|
3995
|
+
"actionType": "ajax",
|
|
3996
|
+
"args": {
|
|
3997
|
+
"api": {
|
|
3998
|
+
"url": "${context.rootUrl}/graphql",
|
|
3999
|
+
"method": "post",
|
|
4000
|
+
"headers": {
|
|
4001
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4002
|
+
},
|
|
4003
|
+
"data": {
|
|
4004
|
+
"&": "$$",
|
|
4005
|
+
"uiSchema": "${uiSchema}",
|
|
4006
|
+
"recordId": "${uiSchema.list_views[listName]._id}"
|
|
4007
|
+
},
|
|
4008
|
+
"messages": {
|
|
4009
|
+
"success": "删除成功"
|
|
4010
|
+
},
|
|
4011
|
+
"requestAdaptor": "const { recordId } = api.body;\nvar deleteArray = [];\nif (recordId) { deleteArray.push(`delete:object_listviews__delete(id: \"${recordId}\")`); }\napi.data = { query: `mutation{${deleteArray.join(',')}}` };\n return api;\n",
|
|
4012
|
+
"adaptor": "if (payload.errors) {\n payload.status = 2;\n payload.msg = payload.errors[0].message;\n}\nreturn payload;",
|
|
4013
|
+
}
|
|
4014
|
+
}
|
|
4015
|
+
},
|
|
4016
|
+
{
|
|
4017
|
+
"actionType": "url",
|
|
4018
|
+
"args": {
|
|
4019
|
+
"url": "${context.rootUrl}/app/${appId}/${objectName}/grid/all",
|
|
4020
|
+
"blank": false
|
|
4021
|
+
},
|
|
4022
|
+
"expression": "data.delete == 1"
|
|
4023
|
+
}
|
|
4024
|
+
]
|
|
4025
|
+
}
|
|
4026
|
+
}
|
|
4027
|
+
},
|
|
4028
|
+
{
|
|
4029
|
+
"type": "button",
|
|
4030
|
+
"visibleOn": "${false}",
|
|
4031
|
+
"label": "保存宽度(todo)"
|
|
4032
|
+
},
|
|
4033
|
+
// {
|
|
4034
|
+
// type: 'steedos-object-button',
|
|
4035
|
+
// name: 'standard_delete',
|
|
4036
|
+
// objectName: 'test0321__c',
|
|
4037
|
+
// // visibleOn: getButtonVisibleOn(button),
|
|
4038
|
+
// className: 'antd-Button--default'
|
|
4039
|
+
// }
|
|
4040
|
+
]
|
|
4041
|
+
}
|
|
4042
|
+
]
|
|
3592
4043
|
},
|
|
3593
|
-
showDisplayAs? getDisplayAsButton(showDisplayAs) : {}
|
|
4044
|
+
showDisplayAs ? getDisplayAsButton(showDisplayAs) : {}
|
|
3594
4045
|
// {
|
|
3595
4046
|
// "type": "search-box",
|
|
3596
4047
|
// "align": "right",
|
|
@@ -3873,6 +4324,7 @@ function getLookupSapceUserTreeSchema(){
|
|
|
3873
4324
|
const tree = [{
|
|
3874
4325
|
"type": "input-tree",
|
|
3875
4326
|
"className": "",
|
|
4327
|
+
"inputClassName": "pl-0",
|
|
3876
4328
|
"id": "u:7fd77b7915b0",
|
|
3877
4329
|
"source": {
|
|
3878
4330
|
"method": "post",
|
|
@@ -3942,10 +4394,10 @@ function getLookupSapceUserTreeSchema(){
|
|
|
3942
4394
|
"style": {
|
|
3943
4395
|
"max-height": "100%",
|
|
3944
4396
|
"position": "absolute",
|
|
3945
|
-
"left": "-
|
|
4397
|
+
"left": "-200px",
|
|
3946
4398
|
"width": "190px",
|
|
3947
4399
|
"bottom": 0,
|
|
3948
|
-
"top": "
|
|
4400
|
+
"top": "-14px",
|
|
3949
4401
|
"overflow": "auto",
|
|
3950
4402
|
"min-height":"300px"
|
|
3951
4403
|
},
|
|
@@ -5853,11 +6305,11 @@ function getBulkActions(objectSchema){
|
|
|
5853
6305
|
}
|
|
5854
6306
|
|
|
5855
6307
|
async function getObjectCRUD(objectSchema, fields, options){
|
|
6308
|
+
// console.time('getObjectCRUD');
|
|
5856
6309
|
const { top, perPage, showDisplayAs = false, displayAs, crudClassName = "" } = options;
|
|
5857
6310
|
const nonpaged = objectSchema.paging && objectSchema.paging.enabled === false;
|
|
5858
6311
|
const isTreeObject = objectSchema.enable_tree;
|
|
5859
6312
|
const bulkActions = getBulkActions(objectSchema);
|
|
5860
|
-
|
|
5861
6313
|
const bodyProps = {
|
|
5862
6314
|
// toolbar: getToolbar(),
|
|
5863
6315
|
// headerToolbar: getObjectHeaderToolbar(objectSchema, options.formFactor, {showDisplayAs}),
|
|
@@ -5886,11 +6338,12 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
5886
6338
|
options.queryCount = false;
|
|
5887
6339
|
}
|
|
5888
6340
|
}
|
|
5889
|
-
|
|
6341
|
+
// console.log(`getObjectHeaderToolbar====2===>`, options.filterVisible)
|
|
5890
6342
|
bodyProps.headerToolbar = getObjectHeaderToolbar(objectSchema, options.formFactor, {
|
|
5891
6343
|
showDisplayAs,
|
|
5892
6344
|
hiddenCount: options.queryCount === false,
|
|
5893
|
-
headerToolbarItems: options.headerToolbarItems
|
|
6345
|
+
headerToolbarItems: options.headerToolbarItems,
|
|
6346
|
+
filterVisible: options.filterVisible
|
|
5894
6347
|
});
|
|
5895
6348
|
|
|
5896
6349
|
|
|
@@ -5965,7 +6418,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
5965
6418
|
body = wrappedBody;
|
|
5966
6419
|
}
|
|
5967
6420
|
}
|
|
5968
|
-
|
|
6421
|
+
// console.timeEnd('getObjectCRUD');
|
|
5969
6422
|
// TODO: data应该只留loaded,其他属性都改为从上层传递下来
|
|
5970
6423
|
return {
|
|
5971
6424
|
type: 'service',
|
|
@@ -6087,7 +6540,8 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
6087
6540
|
"eventName": "@data.changed.${_master.objectName}"
|
|
6088
6541
|
},
|
|
6089
6542
|
"data": {
|
|
6090
|
-
"objectName": "${_master.objectName}"
|
|
6543
|
+
"objectName": "${_master.objectName}",
|
|
6544
|
+
"_isRelated": "${_isRelated || _master._isRelated}"
|
|
6091
6545
|
},
|
|
6092
6546
|
"expression": `\${_master.objectName != '${objectSchema.name}' && _master.objectName}`
|
|
6093
6547
|
},
|
|
@@ -7851,8 +8305,8 @@ async function getRelatedListSchema(
|
|
|
7851
8305
|
/*
|
|
7852
8306
|
* @Author: baozhoutao@steedos.com
|
|
7853
8307
|
* @Date: 2022-07-05 15:55:39
|
|
7854
|
-
* @LastEditors:
|
|
7855
|
-
* @LastEditTime: 2023-04-
|
|
8308
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
8309
|
+
* @LastEditTime: 2023-04-12 14:24:09
|
|
7856
8310
|
* @Description:
|
|
7857
8311
|
*/
|
|
7858
8312
|
|
|
@@ -8152,7 +8606,8 @@ async function getListSchema(
|
|
|
8152
8606
|
"ctx": ctx,
|
|
8153
8607
|
"requestAdaptor": listView.requestAdaptor,
|
|
8154
8608
|
"adaptor": listView.adaptor,
|
|
8155
|
-
"headerToolbarItems": ctx.headerToolbarItems
|
|
8609
|
+
"headerToolbarItems": ctx.headerToolbarItems,
|
|
8610
|
+
"filterVisible": ctx.filterVisible
|
|
8156
8611
|
};
|
|
8157
8612
|
return {
|
|
8158
8613
|
uiSchema,
|
|
@@ -8167,6 +8622,7 @@ async function getTableSchema(
|
|
|
8167
8622
|
columns,
|
|
8168
8623
|
ctx = {}
|
|
8169
8624
|
) {
|
|
8625
|
+
// console.time('getTableSchema');
|
|
8170
8626
|
const uiSchema = await getUISchema(objectName);
|
|
8171
8627
|
|
|
8172
8628
|
let sort = ctx.sort;
|
|
@@ -8217,6 +8673,7 @@ async function getTableSchema(
|
|
|
8217
8673
|
buttons: await getListViewItemButtons(uiSchema, ctx)
|
|
8218
8674
|
});
|
|
8219
8675
|
// console.log('getTableSchema====>amisSchema', amisSchema)
|
|
8676
|
+
// console.timeEnd('getTableSchema');
|
|
8220
8677
|
return {
|
|
8221
8678
|
uiSchema,
|
|
8222
8679
|
amisSchema,
|