@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/index.esm.js CHANGED
@@ -1585,8 +1585,8 @@ const getSchema$3 = async (uiSchema, ctx) => {
1585
1585
  /*
1586
1586
  * @Author: 殷亮辉 yinlianghui@hotoa.com
1587
1587
  * @Date: 2023-03-22 09:31:21
1588
- * @LastEditors: baozhoutao@steedos.com
1589
- * @LastEditTime: 2023-04-06 16:04:20
1588
+ * @LastEditors: Please set LastEditors
1589
+ * @LastEditTime: 2023-04-12 10:35:36
1590
1590
  */
1591
1591
  const getSchema$2 = (uiSchema)=>{
1592
1592
  return {
@@ -1641,7 +1641,8 @@ const getSchema$2 = (uiSchema)=>{
1641
1641
  "eventName": "@data.changed.${_master.objectName}"
1642
1642
  },
1643
1643
  "data": {
1644
- "objectName": "${_master.objectName}"
1644
+ "objectName": "${_master.objectName}",
1645
+ "_isRelated": "${_isRelated}"
1645
1646
  },
1646
1647
  "expression": `\${_master.objectName != '${uiSchema.name}' && _master.objectName}`
1647
1648
  }
@@ -3357,6 +3358,9 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
3357
3358
  };
3358
3359
  };
3359
3360
 
3361
+
3362
+
3363
+
3360
3364
  const onFieldsFilterToggleScript = `
3361
3365
  const scope = event.context.scoped;
3362
3366
  const filterForm = scope.getComponents().find(function(n){
@@ -3374,7 +3378,6 @@ setTimeout(()=>{
3374
3378
 
3375
3379
  function getExportApiRequestAdaptorScript(){
3376
3380
  return `
3377
- console.log(api.url);
3378
3381
  // 获取列表视图的属性
3379
3382
  let uiSchema = api.body.uiSchema;
3380
3383
  let list_views = uiSchema.list_views;
@@ -3423,12 +3426,12 @@ function getExportApiRequestAdaptorScript(){
3423
3426
  if (filters && filters.length > 0) {
3424
3427
  api.url = api.url + "&filters=" + JSON.stringify(filters);
3425
3428
  }
3426
- console.log(api.url);
3427
3429
  return api;
3428
3430
  `
3429
3431
  }
3430
3432
 
3431
- function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false, hiddenCount = false, headerToolbarItems} = {}){
3433
+ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false, hiddenCount = false, headerToolbarItems, filterVisible = true} = {}){
3434
+ // console.log(`getObjectHeaderToolbar====>`, filterVisible)
3432
3435
  const isMobile = window.innerWidth < 768;
3433
3436
  if(isMobile){
3434
3437
  showDisplayAs = false;
@@ -3465,7 +3468,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3465
3468
  }
3466
3469
  },
3467
3470
  },
3468
- {
3471
+ filterVisible ? {
3469
3472
  "label": "",
3470
3473
  "icon": "fa fa-search",
3471
3474
  "type": "button",
@@ -3481,7 +3484,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3481
3484
  ]
3482
3485
  }
3483
3486
  }
3484
- },
3487
+ } : {},
3485
3488
  showDisplayAs? getDisplayAsButton(mainObject?.name) : {}
3486
3489
  ]
3487
3490
  }else {
@@ -3497,10 +3500,6 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3497
3500
  // "type": "columns-toggler",
3498
3501
  // "className": "mr-2"
3499
3502
  // },
3500
- // {
3501
- // "type": "export-excel",
3502
- // "align": "right"
3503
- // },
3504
3503
  hiddenCount ? {} : {
3505
3504
  "type": "tpl",
3506
3505
  "tpl": "${count} 个项目"
@@ -3546,7 +3545,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3546
3545
  }
3547
3546
  }
3548
3547
  },
3549
- {
3548
+ filterVisible ? {
3550
3549
  "label": "",
3551
3550
  "icon": "fa fa-search",
3552
3551
  "type": "button",
@@ -3562,8 +3561,460 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3562
3561
  ]
3563
3562
  }
3564
3563
  }
3564
+ } : {},
3565
+ {
3566
+ "type": "dropdown-button",
3567
+ "trigger": "click",
3568
+ "icon": "fa fa-cog",
3569
+ "btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
3570
+ "align": "right",
3571
+ "visibleOn": "${!isLookup}",
3572
+ "buttons": [
3573
+ {
3574
+ "label": "列表视图操作",
3575
+ "children": [
3576
+ {
3577
+ "type": "button",
3578
+ "label": "新建",
3579
+ "onEvent": {
3580
+ "click": {
3581
+ "weight": 0,
3582
+ "actions": [
3583
+ {
3584
+ "dialog": {
3585
+ "type": "dialog",
3586
+ "title": "新建 列表视图",
3587
+ "data": {
3588
+ "&": "$$",
3589
+ "all": "${uiSchema.list_views.all}",
3590
+ "list_view": "${uiSchema.list_views[listName]}",
3591
+ "appId": "${appId}",
3592
+ "global": "${global}",
3593
+ "objectName": "${objectName}",
3594
+ },
3595
+ "body": [
3596
+ {
3597
+ "type": "steedos-object-form",
3598
+ "label": "对象表单",
3599
+ "objectApiName": "object_listviews",
3600
+ "recordId": "",
3601
+ "mode": "edit",
3602
+ "defaultData": {
3603
+ "&": "${list_view}",
3604
+ "name":"",
3605
+ "label":"",
3606
+ "filters":"",
3607
+ "shared":false
3608
+ },
3609
+ "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}",
3610
+ "fields": [
3611
+ "label",
3612
+ "name",
3613
+ "object_name",
3614
+ "filter_scope",
3615
+ "show_count",
3616
+ "columns.$.field",
3617
+ "columns.$.width",
3618
+ "sort.$.field_name",
3619
+ "sort.$.order",
3620
+ "filters",
3621
+ "mobile_columns.$.field",
3622
+ "searchable_fields.$.field",
3623
+ "is_system",
3624
+ "shared"
3625
+ ],
3626
+ "onEvent": {
3627
+ "submitSucc": {
3628
+ "weight": 0,
3629
+ "actions": [
3630
+ {
3631
+ "args": {
3632
+ // 直接使用recordId不能拿到数据,只能通过result里面拿数据
3633
+ "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/listview_${result.data.recordId|lowerCase}",
3634
+ "blank": false
3635
+ },
3636
+ "actionType": "url",
3637
+ }
3638
+ ]
3639
+ }
3640
+ },
3641
+ "messages": {
3642
+ "success": "成功",
3643
+ "failed": "失败"
3644
+ },
3645
+ }
3646
+ ],
3647
+ "showCloseButton": true,
3648
+ "showErrorMsg": true,
3649
+ "showLoading": true,
3650
+ "closeOnEsc": false,
3651
+ "dataMapSwitch": false,
3652
+ "size": "lg"
3653
+ },
3654
+ "actionType": "dialog"
3655
+ }
3656
+ ]
3657
+ }
3658
+ }
3659
+ },
3660
+ {
3661
+ "type": "button",
3662
+ "label": "复制",
3663
+ "onEvent": {
3664
+ "click": {
3665
+ "weight": 0,
3666
+ "actions": [
3667
+ {
3668
+ "dialog": {
3669
+ "type": "dialog",
3670
+ "title": "复制 列表视图",
3671
+ "data": {
3672
+ "&": "$$",
3673
+ "listName": "${listName}",
3674
+ "objectName": "${objectName}",
3675
+ "list_view": "${uiSchema.list_views[listName]}",
3676
+ "appId": "${appId}",
3677
+ "global": "${global}"
3678
+ },
3679
+ "body": [
3680
+ {
3681
+ "type": "steedos-object-form",
3682
+ "label": "对象表单",
3683
+ "objectApiName": "object_listviews",
3684
+ "recordId": "",
3685
+ "mode": "edit",
3686
+ "fields": [
3687
+ ],
3688
+ "defaultData": {
3689
+ "&": "${list_view}",
3690
+ "name":"",
3691
+ "label": "${list_view.label}的副本",
3692
+ "shared":false
3693
+ },
3694
+ "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}",
3695
+ "fields": [
3696
+ "label",
3697
+ "name",
3698
+ "object_name",
3699
+ "filter_scope",
3700
+ "show_count",
3701
+ "columns.$.field",
3702
+ "columns.$.width",
3703
+ "sort.$.field_name",
3704
+ "sort.$.order",
3705
+ "filters",
3706
+ "mobile_columns.$.field",
3707
+ "searchable_fields.$.field",
3708
+ "is_system",
3709
+ "shared"
3710
+ ],
3711
+ "onEvent": {
3712
+ "submitSucc": {
3713
+ "weight": 0,
3714
+ "actions": [
3715
+ {
3716
+ "args": {
3717
+ "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/listview_${result.data.recordId|lowerCase}",
3718
+ "blank": false
3719
+ },
3720
+ "actionType": "url",
3721
+ }
3722
+ ]
3723
+ }
3724
+ }
3725
+ }
3726
+ ],
3727
+ "showCloseButton": true,
3728
+ "showErrorMsg": true,
3729
+ "showLoading": true,
3730
+ "closeOnEsc": false,
3731
+ "dataMapSwitch": false,
3732
+ "size": "lg"
3733
+ },
3734
+ "actionType": "dialog"
3735
+ }
3736
+ ]
3737
+ }
3738
+ }
3739
+ },
3740
+ {
3741
+ "type": "button",
3742
+ "label": "重命名",
3743
+ "visibleOn": "(global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && ['all', 'recent', 'my'].indexOf(listName) == -1",
3744
+ "onEvent": {
3745
+ "click": {
3746
+ "weight": 0,
3747
+ "actions": [
3748
+ {
3749
+ "dialog": {
3750
+ "type": "dialog",
3751
+ "title": "重命名 列表视图",
3752
+ "data": {
3753
+ "objectName": "${objectName}",
3754
+ "recordId": "${uiSchema.list_views[listName]._id}",
3755
+ "appId": "${appId}"
3756
+ },
3757
+ "body": [
3758
+ {
3759
+ "type": "steedos-object-form",
3760
+ "label": "对象表单",
3761
+ "objectApiName": "object_listviews",
3762
+ "recordId": "${recordId}",
3763
+ "mode": "edit",
3764
+ "fields": [
3765
+ "label"
3766
+ ],
3767
+ "fieldsExtend": "{\n \"label\":{\n \"is_wide\": true\n }\n}",
3768
+ "onEvent": {
3769
+ "submitSucc": {
3770
+ "weight": 0,
3771
+ "actions": [
3772
+ {
3773
+ "args": {
3774
+ "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${name}",
3775
+ "blank": false
3776
+ },
3777
+ "actionType": "url",
3778
+ },
3779
+ ]
3780
+ }
3781
+ }
3782
+ }
3783
+ ],
3784
+ "showCloseButton": true,
3785
+ "showErrorMsg": true,
3786
+ "showLoading": true,
3787
+ "size": "lg"
3788
+ },
3789
+ "actionType": "dialog"
3790
+ }
3791
+ ]
3792
+ }
3793
+ }
3794
+ },
3795
+ {
3796
+ "type": "button",
3797
+ "label": "共享设置",
3798
+ "visibleOn": "global.user.is_space_admin && ['all', 'recent', 'my'].indexOf(listName) == -1",
3799
+ "onEvent": {
3800
+ "click": {
3801
+ "weight": 0,
3802
+ "actions": [
3803
+ {
3804
+ "dialog": {
3805
+ "type": "dialog",
3806
+ "title": "共享设置",
3807
+ "data": {
3808
+ "recordId": "${uiSchema.list_views[listName]._id}",
3809
+ },
3810
+ "body": [
3811
+ {
3812
+ "type": "steedos-object-form",
3813
+ "label": "对象表单",
3814
+ "objectApiName": "object_listviews",
3815
+ "recordId": "${recordId}",
3816
+ "mode": "edit",
3817
+ "fields": [
3818
+ "shared"
3819
+ ]
3820
+ }
3821
+ ],
3822
+ "showCloseButton": true,
3823
+ "showErrorMsg": true,
3824
+ "showLoading": true,
3825
+ "closeOnEsc": false,
3826
+ "dataMapSwitch": false,
3827
+ "size": "md"
3828
+ },
3829
+ "actionType": "dialog"
3830
+ }
3831
+ ]
3832
+ }
3833
+ }
3834
+ },
3835
+ {
3836
+ "type": "button",
3837
+ "label": "过滤设置",
3838
+ "visibleOn": "(global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && ['all', 'recent', 'my'].indexOf(listName) == -1",
3839
+ "onEvent": {
3840
+ "click": {
3841
+ "weight": 0,
3842
+ "actions": [
3843
+ {
3844
+ "dialog": {
3845
+ "type": "dialog",
3846
+ "title": "过滤设置",
3847
+ "data": {
3848
+ "objectName": "${objectName}",
3849
+ "recordId": "${uiSchema.list_views[listName]._id}",
3850
+ "listName": "${listName}",
3851
+ "appId": "${appId}"
3852
+ },
3853
+ "body": [
3854
+ {
3855
+ "type": "steedos-object-form",
3856
+ "label": "对象表单",
3857
+ "objectApiName": "object_listviews",
3858
+ "recordId": "${recordId}",
3859
+ "mode": "edit",
3860
+ "initApiAdaptor": "",
3861
+ "fields": [
3862
+ "filters"
3863
+ ],
3864
+ "initApiRequestAdaptor": "",
3865
+ "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;",
3866
+ "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",
3867
+ "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}",
3868
+ "onEvent": {
3869
+ "submitSucc": {
3870
+ "weight": 0,
3871
+ "actions": [
3872
+ {
3873
+ "args": {
3874
+ "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${listName}",
3875
+ "blank": false
3876
+ },
3877
+ "actionType": "url",
3878
+ }
3879
+ ]
3880
+ }
3881
+ }
3882
+ }
3883
+ ],
3884
+ "showCloseButton": true,
3885
+ "showErrorMsg": true,
3886
+ "showLoading": true,
3887
+ "closeOnEsc": false,
3888
+ "dataMapSwitch": false,
3889
+ "size": "lg"
3890
+ },
3891
+ "actionType": "dialog"
3892
+ }
3893
+ ]
3894
+ }
3895
+ }
3896
+ },
3897
+ {
3898
+ "type": "button",
3899
+ "label": "显示的列",
3900
+ "visibleOn": "(global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && ['all', 'recent', 'my'].indexOf(listName) == -1",
3901
+ "onEvent": {
3902
+ "click": {
3903
+ "weight": 0,
3904
+ "actions": [
3905
+ {
3906
+ "args": {},
3907
+ "dialog": {
3908
+ "type": "dialog",
3909
+ "title": "显示的列",
3910
+ "data": {
3911
+ "&": "$$",
3912
+ "objectName": "${objectName}",
3913
+ "recordId": "${uiSchema.list_views[listName]._id}",
3914
+ "listName": "${listName}",
3915
+ "appId": "${appId}"
3916
+ },
3917
+ "body": [
3918
+ {
3919
+ "type": "steedos-object-form",
3920
+ "label": "对象表单",
3921
+ "objectApiName": "object_listviews",
3922
+ "recordId": "${recordId}",
3923
+ "mode": "edit",
3924
+ "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}",
3925
+ "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;",
3926
+ "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;",
3927
+ "fields": [
3928
+ "columns",
3929
+ "mobile_columns"
3930
+ ],
3931
+ "onEvent": {
3932
+ "submitSucc": {
3933
+ "weight": 0,
3934
+ "actions": [
3935
+ {
3936
+ "args": {
3937
+ "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${listName}",
3938
+ "blank": false
3939
+ },
3940
+ "actionType": "url"
3941
+ }
3942
+ ]
3943
+ }
3944
+ }
3945
+ }
3946
+ ],
3947
+ "searchable": true,
3948
+ "showCloseButton": true,
3949
+ "showErrorMsg": true,
3950
+ "showLoading": true,
3951
+ "size": "lg"
3952
+ },
3953
+ "actionType": "dialog"
3954
+ }
3955
+ ]
3956
+ }
3957
+ }
3958
+ },
3959
+ {
3960
+ "type": "button",
3961
+ "label": "删除",
3962
+ "visibleOn": "(global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && ['all', 'recent', 'my'].indexOf(listName) == -1",
3963
+ "confirmText": "如果您删除此列表视图,该视图将为所有具备访问权限的用户永久删除。是否确定要删除?",
3964
+ "onEvent": {
3965
+ "click": {
3966
+ "actions": [
3967
+ {
3968
+ "actionType": "ajax",
3969
+ "args": {
3970
+ "api": {
3971
+ "url": "${context.rootUrl}/graphql",
3972
+ "method": "post",
3973
+ "headers": {
3974
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
3975
+ },
3976
+ "data": {
3977
+ "&": "$$",
3978
+ "uiSchema": "${uiSchema}",
3979
+ "recordId": "${uiSchema.list_views[listName]._id}"
3980
+ },
3981
+ "messages": {
3982
+ "success": "删除成功"
3983
+ },
3984
+ "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",
3985
+ "adaptor": "if (payload.errors) {\n payload.status = 2;\n payload.msg = payload.errors[0].message;\n}\nreturn payload;",
3986
+ }
3987
+ }
3988
+ },
3989
+ {
3990
+ "actionType": "url",
3991
+ "args": {
3992
+ "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/all",
3993
+ "blank": false
3994
+ },
3995
+ "expression": "data.delete == 1"
3996
+ }
3997
+ ]
3998
+ }
3999
+ }
4000
+ },
4001
+ {
4002
+ "type": "button",
4003
+ "visibleOn": "${false}",
4004
+ "label": "保存宽度(todo)"
4005
+ },
4006
+ // {
4007
+ // type: 'steedos-object-button',
4008
+ // name: 'standard_delete',
4009
+ // objectName: 'test0321__c',
4010
+ // // visibleOn: getButtonVisibleOn(button),
4011
+ // className: 'antd-Button--default'
4012
+ // }
4013
+ ]
4014
+ }
4015
+ ]
3565
4016
  },
3566
- showDisplayAs? getDisplayAsButton(showDisplayAs) : {}
4017
+ showDisplayAs ? getDisplayAsButton(showDisplayAs) : {}
3567
4018
  // {
3568
4019
  // "type": "search-box",
3569
4020
  // "align": "right",
@@ -3846,6 +4297,7 @@ function getLookupSapceUserTreeSchema(){
3846
4297
  const tree = [{
3847
4298
  "type": "input-tree",
3848
4299
  "className": "",
4300
+ "inputClassName": "pl-0",
3849
4301
  "id": "u:7fd77b7915b0",
3850
4302
  "source": {
3851
4303
  "method": "post",
@@ -3915,10 +4367,10 @@ function getLookupSapceUserTreeSchema(){
3915
4367
  "style": {
3916
4368
  "max-height": "100%",
3917
4369
  "position": "absolute",
3918
- "left": "-190px",
4370
+ "left": "-200px",
3919
4371
  "width": "190px",
3920
4372
  "bottom": 0,
3921
- "top": "0",
4373
+ "top": "-14px",
3922
4374
  "overflow": "auto",
3923
4375
  "min-height":"300px"
3924
4376
  },
@@ -5826,11 +6278,11 @@ function getBulkActions(objectSchema){
5826
6278
  }
5827
6279
 
5828
6280
  async function getObjectCRUD(objectSchema, fields, options){
6281
+ // console.time('getObjectCRUD');
5829
6282
  const { top, perPage, showDisplayAs = false, displayAs, crudClassName = "" } = options;
5830
6283
  const nonpaged = objectSchema.paging && objectSchema.paging.enabled === false;
5831
6284
  const isTreeObject = objectSchema.enable_tree;
5832
6285
  const bulkActions = getBulkActions(objectSchema);
5833
-
5834
6286
  const bodyProps = {
5835
6287
  // toolbar: getToolbar(),
5836
6288
  // headerToolbar: getObjectHeaderToolbar(objectSchema, options.formFactor, {showDisplayAs}),
@@ -5859,11 +6311,12 @@ async function getObjectCRUD(objectSchema, fields, options){
5859
6311
  options.queryCount = false;
5860
6312
  }
5861
6313
  }
5862
-
6314
+ // console.log(`getObjectHeaderToolbar====2===>`, options.filterVisible)
5863
6315
  bodyProps.headerToolbar = getObjectHeaderToolbar(objectSchema, options.formFactor, {
5864
6316
  showDisplayAs,
5865
6317
  hiddenCount: options.queryCount === false,
5866
- headerToolbarItems: options.headerToolbarItems
6318
+ headerToolbarItems: options.headerToolbarItems,
6319
+ filterVisible: options.filterVisible
5867
6320
  });
5868
6321
 
5869
6322
 
@@ -5938,7 +6391,7 @@ async function getObjectCRUD(objectSchema, fields, options){
5938
6391
  body = wrappedBody;
5939
6392
  }
5940
6393
  }
5941
-
6394
+ // console.timeEnd('getObjectCRUD');
5942
6395
  // TODO: data应该只留loaded,其他属性都改为从上层传递下来
5943
6396
  return {
5944
6397
  type: 'service',
@@ -6060,7 +6513,8 @@ async function getObjectForm(objectSchema, ctx){
6060
6513
  "eventName": "@data.changed.${_master.objectName}"
6061
6514
  },
6062
6515
  "data": {
6063
- "objectName": "${_master.objectName}"
6516
+ "objectName": "${_master.objectName}",
6517
+ "_isRelated": "${_isRelated || _master._isRelated}"
6064
6518
  },
6065
6519
  "expression": `\${_master.objectName != '${objectSchema.name}' && _master.objectName}`
6066
6520
  },
@@ -7824,8 +8278,8 @@ async function getRelatedListSchema(
7824
8278
  /*
7825
8279
  * @Author: baozhoutao@steedos.com
7826
8280
  * @Date: 2022-07-05 15:55:39
7827
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
7828
- * @LastEditTime: 2023-04-11 11:28:11
8281
+ * @LastEditors: baozhoutao@steedos.com
8282
+ * @LastEditTime: 2023-04-12 14:24:09
7829
8283
  * @Description:
7830
8284
  */
7831
8285
 
@@ -8125,7 +8579,8 @@ async function getListSchema(
8125
8579
  "ctx": ctx,
8126
8580
  "requestAdaptor": listView.requestAdaptor,
8127
8581
  "adaptor": listView.adaptor,
8128
- "headerToolbarItems": ctx.headerToolbarItems
8582
+ "headerToolbarItems": ctx.headerToolbarItems,
8583
+ "filterVisible": ctx.filterVisible
8129
8584
  };
8130
8585
  return {
8131
8586
  uiSchema,
@@ -8140,6 +8595,7 @@ async function getTableSchema(
8140
8595
  columns,
8141
8596
  ctx = {}
8142
8597
  ) {
8598
+ // console.time('getTableSchema');
8143
8599
  const uiSchema = await getUISchema(objectName);
8144
8600
 
8145
8601
  let sort = ctx.sort;
@@ -8190,6 +8646,7 @@ async function getTableSchema(
8190
8646
  buttons: await getListViewItemButtons(uiSchema, ctx)
8191
8647
  });
8192
8648
  // console.log('getTableSchema====>amisSchema', amisSchema)
8649
+ // console.timeEnd('getTableSchema');
8193
8650
  return {
8194
8651
  uiSchema,
8195
8652
  amisSchema,