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