@steedos-widgets/amis-object 1.2.8 → 1.2.9
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/amis/AmisGlobalHeader.d.ts +32 -1
- package/dist/amis/AmisObjectTable.d.ts +1 -0
- package/dist/amis/AmisRecordDetailHeader.d.ts +35 -2
- package/dist/amis-object.cjs.js +1302 -764
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.js +1303 -765
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.js +1302 -764
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +11 -11
- package/package.json +3 -3
package/dist/amis-object.cjs.js
CHANGED
|
@@ -2625,7 +2625,7 @@ const getListViewItemButtons = async (uiSchema, ctx)=>{
|
|
|
2625
2625
|
return listButtons;
|
|
2626
2626
|
};
|
|
2627
2627
|
|
|
2628
|
-
const getObjectRelatedListButtons =
|
|
2628
|
+
const getObjectRelatedListButtons = (uiSchema, ctx)=>{
|
|
2629
2629
|
// const buttons = getButtons(uiSchema, ctx);
|
|
2630
2630
|
// const relatedListButtons = _.filter(buttons, (button) => {
|
|
2631
2631
|
// if(button.objectName === 'cms_files'){
|
|
@@ -2912,6 +2912,67 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
2912
2912
|
}
|
|
2913
2913
|
};
|
|
2914
2914
|
|
|
2915
|
+
const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
|
|
2916
|
+
const buttons = getObjectRelatedListButtons(objectSchema, ctx);
|
|
2917
|
+
if(ctx.formFactor === 'SMALL'){
|
|
2918
|
+
return {
|
|
2919
|
+
"type": "button",
|
|
2920
|
+
"icon": "fa fa-angle-down",
|
|
2921
|
+
"onEvent": {
|
|
2922
|
+
"click": {
|
|
2923
|
+
"actions": [
|
|
2924
|
+
{
|
|
2925
|
+
"actionType": "drawer",
|
|
2926
|
+
"drawer": {
|
|
2927
|
+
"type": "drawer",
|
|
2928
|
+
"title": "操作",
|
|
2929
|
+
"body": [
|
|
2930
|
+
{
|
|
2931
|
+
"type": "button-group",
|
|
2932
|
+
"vertical": true,
|
|
2933
|
+
"tiled": true,
|
|
2934
|
+
"buttons": [
|
|
2935
|
+
...___default__default["default"].map(buttons, (button)=>{
|
|
2936
|
+
return {
|
|
2937
|
+
type: 'steedos-object-button',
|
|
2938
|
+
name: button.name,
|
|
2939
|
+
objectName: button.objectName,
|
|
2940
|
+
visibleOn: getButtonVisibleOn$1(button),
|
|
2941
|
+
className: `button_${button.name} w-full`
|
|
2942
|
+
}
|
|
2943
|
+
})
|
|
2944
|
+
],
|
|
2945
|
+
"btnLevel": "enhance",
|
|
2946
|
+
"className": "w-full",
|
|
2947
|
+
"btnClassName": "w-full",
|
|
2948
|
+
"size": "lg"
|
|
2949
|
+
}
|
|
2950
|
+
],
|
|
2951
|
+
"position": "bottom",
|
|
2952
|
+
"closeOnOutside": true,
|
|
2953
|
+
"resizable": false,
|
|
2954
|
+
"className": "buttons-drawer",
|
|
2955
|
+
"bodyClassName": "m-none p-none",
|
|
2956
|
+
"actions": []
|
|
2957
|
+
}
|
|
2958
|
+
}
|
|
2959
|
+
]
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
}
|
|
2963
|
+
}else {
|
|
2964
|
+
return ___default__default["default"].map(buttons, (button) => {
|
|
2965
|
+
return {
|
|
2966
|
+
type: 'steedos-object-button',
|
|
2967
|
+
name: button.name,
|
|
2968
|
+
objectName: button.objectName,
|
|
2969
|
+
visibleOn: getButtonVisibleOn$1(button),
|
|
2970
|
+
className: `button_${button.name}`
|
|
2971
|
+
}
|
|
2972
|
+
});
|
|
2973
|
+
}
|
|
2974
|
+
};
|
|
2975
|
+
|
|
2915
2976
|
async function getObjectFieldsFilterButtonSchema(objectSchema) {
|
|
2916
2977
|
// const amisListViewId = `listview_${objectSchema.name}`;
|
|
2917
2978
|
return {
|
|
@@ -2964,11 +3025,11 @@ async function getObjectFieldsFilterFormSchema(ctx) {
|
|
|
2964
3025
|
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
2965
3026
|
}
|
|
2966
3027
|
const selfData = api.body.$self;
|
|
2967
|
-
const filterFormSearchableFields = selfData.filterFormSearchableFields;
|
|
2968
3028
|
const uiSchema = selfData.uiSchema;
|
|
2969
3029
|
const fields = uiSchema.fields;
|
|
2970
|
-
const
|
|
2971
|
-
|
|
3030
|
+
const filterFormSearchableFields = (selfData.filterFormSearchableFields || []).filter(function(item){
|
|
3031
|
+
return !!fields[item]
|
|
3032
|
+
});
|
|
2972
3033
|
const resolveAll = function(values){
|
|
2973
3034
|
payload.data = {
|
|
2974
3035
|
"body": values
|
|
@@ -2983,21 +3044,7 @@ async function getObjectFieldsFilterFormSchema(ctx) {
|
|
|
2983
3044
|
return Promise.all(filterFormSearchableFields.map(function (item) {
|
|
2984
3045
|
const field = _.clone(fields[item]);
|
|
2985
3046
|
if (
|
|
2986
|
-
field &&
|
|
2987
|
-
[
|
|
2988
|
-
"grid",
|
|
2989
|
-
"avatar",
|
|
2990
|
-
"image",
|
|
2991
|
-
"object",
|
|
2992
|
-
"[object]",
|
|
2993
|
-
"[Object]",
|
|
2994
|
-
"[grid]",
|
|
2995
|
-
"[text]",
|
|
2996
|
-
"audio",
|
|
2997
|
-
"file",
|
|
2998
|
-
],
|
|
2999
|
-
field.type
|
|
3000
|
-
)
|
|
3047
|
+
field && window.isFieldTypeSearchable(field.type)
|
|
3001
3048
|
) {
|
|
3002
3049
|
delete field.defaultValue;
|
|
3003
3050
|
delete field.required;
|
|
@@ -3094,6 +3141,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
3094
3141
|
}
|
|
3095
3142
|
}
|
|
3096
3143
|
}
|
|
3144
|
+
filterForm.reset();
|
|
3097
3145
|
listView.handleFilterSubmit(removedValues);
|
|
3098
3146
|
const filterService = filterForm.context.getComponents().find(function(n){
|
|
3099
3147
|
return n.props.type === "service";
|
|
@@ -3356,9 +3404,27 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
3356
3404
|
"headers": {
|
|
3357
3405
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
3358
3406
|
},
|
|
3359
|
-
"data":
|
|
3407
|
+
"data": {
|
|
3408
|
+
"$self": "$$"
|
|
3409
|
+
},
|
|
3360
3410
|
"requestAdaptor": "",
|
|
3361
|
-
"adaptor":
|
|
3411
|
+
"adaptor": `
|
|
3412
|
+
if(payload.errors){
|
|
3413
|
+
payload.status = 2;
|
|
3414
|
+
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
3415
|
+
}
|
|
3416
|
+
const selfData = api.body.$self;
|
|
3417
|
+
const uiSchema = selfData.uiSchema;
|
|
3418
|
+
const fields = uiSchema.fields;
|
|
3419
|
+
const options = (payload.data?.options || []).filter(function(item){
|
|
3420
|
+
let field = fields[item.value];
|
|
3421
|
+
return !!field && window.isFieldTypeSearchable(field.type)
|
|
3422
|
+
});
|
|
3423
|
+
payload.data = {
|
|
3424
|
+
"options": options
|
|
3425
|
+
};
|
|
3426
|
+
return payload;
|
|
3427
|
+
`
|
|
3362
3428
|
},
|
|
3363
3429
|
"options": [],
|
|
3364
3430
|
"required": true,
|
|
@@ -3521,6 +3587,7 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
3521
3587
|
"rightIcon": "fa fa-caret-down",
|
|
3522
3588
|
"size": "sm",
|
|
3523
3589
|
"hideCaret": true,
|
|
3590
|
+
"closeOnClick": true,
|
|
3524
3591
|
"btnClassName": "!bg-transparent !border-none !hover:border-none text-lg h-5 font-bold p-0 text-black leading-none",
|
|
3525
3592
|
"buttons": listViewButtonOptions
|
|
3526
3593
|
}
|
|
@@ -3705,12 +3772,47 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
3705
3772
|
"type": "grid",
|
|
3706
3773
|
"columns": [
|
|
3707
3774
|
{
|
|
3708
|
-
"body": {
|
|
3775
|
+
"body": [{
|
|
3776
|
+
"type": "service",
|
|
3777
|
+
"onEvent": {
|
|
3778
|
+
"@history_paths.changed": {
|
|
3779
|
+
"actions": [
|
|
3780
|
+
{
|
|
3781
|
+
"actionType": "reload"
|
|
3782
|
+
}
|
|
3783
|
+
]
|
|
3784
|
+
}
|
|
3785
|
+
},
|
|
3786
|
+
"body":[{
|
|
3787
|
+
"type": "button",
|
|
3788
|
+
"visibleOn": "${window:innerWidth > 768 && window:historyPaths.length > 1}",
|
|
3789
|
+
"className":"flex mr-2",
|
|
3790
|
+
"onEvent": {
|
|
3791
|
+
"click": {
|
|
3792
|
+
"actions": [
|
|
3793
|
+
{
|
|
3794
|
+
"actionType": "custom",
|
|
3795
|
+
"script": "Steedos.goBack()"
|
|
3796
|
+
}
|
|
3797
|
+
]
|
|
3798
|
+
}
|
|
3799
|
+
},
|
|
3800
|
+
"body": [
|
|
3801
|
+
{
|
|
3802
|
+
"type": "steedos-icon",
|
|
3803
|
+
"category": "utility",
|
|
3804
|
+
"name": "back",
|
|
3805
|
+
"colorVariant": "default",
|
|
3806
|
+
"className": "slds-button_icon slds-global-header__icon"
|
|
3807
|
+
}
|
|
3808
|
+
]
|
|
3809
|
+
}]
|
|
3810
|
+
},{
|
|
3709
3811
|
"type": "tpl",
|
|
3710
3812
|
"className": "block",
|
|
3711
3813
|
// "tpl": `<img class='slds-icon slds-icon_container slds-icon-standard-${standardIcon}' src='\${context.rootUrl}/unpkg.com/@salesforce-ux/design-system/assets/icons/standard/${icon}.svg'>`
|
|
3712
3814
|
"tpl":`<svg class="slds-icon slds-icon_container slds-icon-standard-${standardIcon} slds-page-header__icon" aria-hidden="true"><use xlink:href="/assets/icons/standard-sprite/svg/symbols.svg#${icon}"></use></svg>`
|
|
3713
|
-
},
|
|
3815
|
+
}],
|
|
3714
3816
|
"md": "auto",
|
|
3715
3817
|
"className": "",
|
|
3716
3818
|
"columnClassName": "flex justify-center items-center"
|
|
@@ -3797,18 +3899,9 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
3797
3899
|
* @param {*} relatedObjectSchema 相关对象UISchema
|
|
3798
3900
|
* @returns amisSchema
|
|
3799
3901
|
*/
|
|
3800
|
-
async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relatedLabel) {
|
|
3902
|
+
async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relatedLabel, ctx) {
|
|
3801
3903
|
const { icon, label } = relatedObjectSchema;
|
|
3802
|
-
|
|
3803
|
-
let amisButtonsSchema = ___default.map(buttons, (button) => {
|
|
3804
|
-
return {
|
|
3805
|
-
type: 'steedos-object-button',
|
|
3806
|
-
name: button.name,
|
|
3807
|
-
objectName: button.objectName,
|
|
3808
|
-
visibleOn: getButtonVisibleOn$1(button),
|
|
3809
|
-
className: `button_${button.name}`
|
|
3810
|
-
}
|
|
3811
|
-
});
|
|
3904
|
+
let amisButtonsSchema = getObjectRecordDetailRelatedListButtonsSchemas(relatedObjectSchema, {formFactor: ctx.formFactor});
|
|
3812
3905
|
const reg = new RegExp('_', 'g');
|
|
3813
3906
|
const standardIcon = icon && icon.replace(reg, '-');
|
|
3814
3907
|
const recordRelatedListHeader = {
|
|
@@ -3881,83 +3974,44 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
3881
3974
|
async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
|
|
3882
3975
|
}
|
|
3883
3976
|
|
|
3884
|
-
const
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3977
|
+
const getExportExcelToolbarButtonSchema = ()=>{
|
|
3978
|
+
return {
|
|
3979
|
+
"type": "button",
|
|
3980
|
+
"icon": "fa fa-download",
|
|
3981
|
+
"align": "right",
|
|
3982
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
3983
|
+
"tooltipPlacement": "bottom",
|
|
3984
|
+
"visibleOn": "${!isLookup && global.user.is_space_admin}",
|
|
3985
|
+
"tooltip": "导出Excel",
|
|
3986
|
+
"onEvent": {
|
|
3987
|
+
"click": {
|
|
3988
|
+
"weight": 0,
|
|
3989
|
+
"actions": [
|
|
3990
|
+
{
|
|
3991
|
+
"args": {
|
|
3992
|
+
"api": {
|
|
3993
|
+
"url": "${context.rootUrl}/api/record/export/${objectName}",
|
|
3994
|
+
"method": "get",
|
|
3995
|
+
"messages": {},
|
|
3996
|
+
"requestAdaptor": `${requestAdaptor$1()}`,
|
|
3997
|
+
"data": {
|
|
3998
|
+
"uiSchema": "${uiSchema}",
|
|
3999
|
+
"listName": "${listName}"
|
|
4000
|
+
},
|
|
4001
|
+
"headers": {
|
|
4002
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4003
|
+
}
|
|
4004
|
+
}
|
|
4005
|
+
},
|
|
4006
|
+
"actionType": "download"
|
|
4007
|
+
}
|
|
4008
|
+
]
|
|
4009
|
+
}
|
|
4010
|
+
}
|
|
3900
4011
|
}
|
|
3901
|
-
];
|
|
3902
|
-
return {
|
|
3903
|
-
"type": "dropdown-button",
|
|
3904
|
-
"icon": "fa fa-table-columns",
|
|
3905
|
-
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
3906
|
-
"align": "right",
|
|
3907
|
-
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
3908
|
-
"buttons": [
|
|
3909
|
-
{
|
|
3910
|
-
"label": "显示为",
|
|
3911
|
-
"children": buttons
|
|
3912
|
-
}
|
|
3913
|
-
]
|
|
3914
|
-
};
|
|
3915
4012
|
};
|
|
3916
4013
|
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
const onFieldsFilterToggleScript = `
|
|
3921
|
-
const scope = event.context.scoped;
|
|
3922
|
-
const filterForm = scope.getComponents().find(function(n){
|
|
3923
|
-
return n.props.type === "form";
|
|
3924
|
-
});
|
|
3925
|
-
const filterService = filterForm.context.getComponents().find(function(n){
|
|
3926
|
-
return n.props.type === "service";
|
|
3927
|
-
});
|
|
3928
|
-
// filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
|
|
3929
|
-
let resizeWindow = function(){
|
|
3930
|
-
//触发amis crud 高度重算
|
|
3931
|
-
setTimeout(()=>{
|
|
3932
|
-
window.dispatchEvent(new Event("resize"))
|
|
3933
|
-
}, 500);
|
|
3934
|
-
}
|
|
3935
|
-
let isMobile = Steedos.isMobile();
|
|
3936
|
-
if(filterService.props.data.showFieldsFilter){
|
|
3937
|
-
if(isMobile){
|
|
3938
|
-
// 手机上只能通过取消按钮来关闭搜索栏
|
|
3939
|
-
return;
|
|
3940
|
-
}
|
|
3941
|
-
let buttonCancel = SteedosUI.getClosestAmisComponentByType(filterForm.context, "button", {
|
|
3942
|
-
direction: "down",
|
|
3943
|
-
name: "btn_filter_form_cancel"
|
|
3944
|
-
});
|
|
3945
|
-
buttonCancel.props.dispatchEvent('click', {}).then(function(){
|
|
3946
|
-
resizeWindow();
|
|
3947
|
-
});
|
|
3948
|
-
}
|
|
3949
|
-
else{
|
|
3950
|
-
filterService.setData({showFieldsFilter: true});
|
|
3951
|
-
resizeWindow();
|
|
3952
|
-
if(isMobile){
|
|
3953
|
-
// 手机端在显示搜索栏时隐藏刷新按钮
|
|
3954
|
-
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
3955
|
-
crudService && crudService.setData({showFieldsFilter: true});
|
|
3956
|
-
}
|
|
3957
|
-
}
|
|
3958
|
-
`;
|
|
3959
|
-
|
|
3960
|
-
function getExportApiRequestAdaptorScript(){
|
|
4014
|
+
function requestAdaptor$1(){
|
|
3961
4015
|
return `
|
|
3962
4016
|
// 获取列表视图的属性
|
|
3963
4017
|
let uiSchema = api.body.uiSchema;
|
|
@@ -4011,667 +4065,1101 @@ function getExportApiRequestAdaptorScript(){
|
|
|
4011
4065
|
`
|
|
4012
4066
|
}
|
|
4013
4067
|
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
const isMobile = window.innerWidth < 768;
|
|
4017
|
-
if(isMobile){
|
|
4018
|
-
showDisplayAs = false;
|
|
4019
|
-
}
|
|
4020
|
-
if(formFactor === 'SMALL'){
|
|
4021
|
-
const onReloadScript = `
|
|
4022
|
-
const scope = event.context.scoped;
|
|
4023
|
-
var listView = scope.parent.getComponents().find(function(n){
|
|
4024
|
-
return n.props.type === "crud";
|
|
4025
|
-
});
|
|
4026
|
-
listView.handleChangePage(1);
|
|
4027
|
-
`;
|
|
4028
|
-
return [
|
|
4029
|
-
// "bulkActions",
|
|
4030
|
-
...(headerToolbarItems || []),
|
|
4031
|
-
hiddenCount ? {} :{
|
|
4032
|
-
"type": "tpl",
|
|
4033
|
-
"tpl": "${count} 个项目"
|
|
4034
|
-
},
|
|
4035
|
-
{
|
|
4036
|
-
// "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
|
|
4068
|
+
const getNewListviewButtonSchema = ()=>{
|
|
4069
|
+
return {
|
|
4037
4070
|
"type": "button",
|
|
4038
|
-
"
|
|
4039
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4040
|
-
"label": "",
|
|
4041
|
-
"icon": "fa fa-sync",
|
|
4042
|
-
"visibleOn": "${!showFieldsFilter}",
|
|
4071
|
+
"label": "新建",
|
|
4043
4072
|
"onEvent": {
|
|
4044
4073
|
"click": {
|
|
4074
|
+
"weight": 0,
|
|
4045
4075
|
"actions": [
|
|
4046
4076
|
{
|
|
4047
|
-
"
|
|
4048
|
-
|
|
4077
|
+
"dialog": {
|
|
4078
|
+
"type": "dialog",
|
|
4079
|
+
"title": "新建 列表视图",
|
|
4080
|
+
"data": {
|
|
4081
|
+
"&": "$$",
|
|
4082
|
+
"all": "${uiSchema.list_views.all}",
|
|
4083
|
+
"list_view": "${uiSchema.list_views[listName]}",
|
|
4084
|
+
"appId": "${appId}",
|
|
4085
|
+
"global": "${global}",
|
|
4086
|
+
"targetObjectName": "${objectName}",
|
|
4087
|
+
},
|
|
4088
|
+
"body": [
|
|
4089
|
+
{
|
|
4090
|
+
"type": "steedos-object-form",
|
|
4091
|
+
"label": "对象表单",
|
|
4092
|
+
"objectApiName": "object_listviews",
|
|
4093
|
+
"recordId": "",
|
|
4094
|
+
"mode": "edit",
|
|
4095
|
+
"defaultData": {
|
|
4096
|
+
"&": "${list_view}",
|
|
4097
|
+
"name":"",
|
|
4098
|
+
"label":"",
|
|
4099
|
+
"filters":"",
|
|
4100
|
+
"shared":false
|
|
4101
|
+
},
|
|
4102
|
+
"fieldsExtend": fieldsExtend$4(),
|
|
4103
|
+
"fields": fields$1(),
|
|
4104
|
+
"onEvent": {
|
|
4105
|
+
"submitSucc": {
|
|
4106
|
+
"weight": 0,
|
|
4107
|
+
"actions": [
|
|
4108
|
+
{
|
|
4109
|
+
"args": {
|
|
4110
|
+
// 直接使用recordId不能拿到数据,只能通过result里面拿数据
|
|
4111
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
4112
|
+
"blank": false
|
|
4113
|
+
},
|
|
4114
|
+
"actionType": "url",
|
|
4115
|
+
}
|
|
4116
|
+
]
|
|
4117
|
+
}
|
|
4118
|
+
},
|
|
4119
|
+
"messages": {
|
|
4120
|
+
"success": "成功",
|
|
4121
|
+
"failed": "失败"
|
|
4122
|
+
},
|
|
4123
|
+
}
|
|
4124
|
+
],
|
|
4125
|
+
"showCloseButton": true,
|
|
4126
|
+
"showErrorMsg": true,
|
|
4127
|
+
"showLoading": true,
|
|
4128
|
+
"closeOnEsc": false,
|
|
4129
|
+
"dataMapSwitch": false,
|
|
4130
|
+
"size": "lg"
|
|
4131
|
+
},
|
|
4132
|
+
"actionType": "dialog"
|
|
4049
4133
|
}
|
|
4050
4134
|
]
|
|
4051
4135
|
}
|
|
4052
|
-
}
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4136
|
+
}
|
|
4137
|
+
}
|
|
4138
|
+
};
|
|
4139
|
+
|
|
4140
|
+
function fields$1(){
|
|
4141
|
+
return [
|
|
4142
|
+
"label",
|
|
4143
|
+
"name",
|
|
4144
|
+
"object_name",
|
|
4145
|
+
"filter_scope",
|
|
4146
|
+
"show_count",
|
|
4147
|
+
"columns.$.field",
|
|
4148
|
+
"columns.$.width",
|
|
4149
|
+
"sort.$.field_name",
|
|
4150
|
+
"sort.$.order",
|
|
4151
|
+
"filters",
|
|
4152
|
+
"mobile_columns.$.field",
|
|
4153
|
+
"searchable_fields.$.field",
|
|
4154
|
+
"is_system",
|
|
4155
|
+
"shared"
|
|
4156
|
+
]
|
|
4157
|
+
}
|
|
4158
|
+
|
|
4159
|
+
function fieldsExtend$4(){
|
|
4160
|
+
return {
|
|
4161
|
+
"label": {
|
|
4162
|
+
"is_wide": true
|
|
4163
|
+
},
|
|
4164
|
+
"name": {
|
|
4165
|
+
"amis": {
|
|
4166
|
+
"hidden": true
|
|
4167
|
+
}
|
|
4168
|
+
},
|
|
4169
|
+
"object_name": {
|
|
4170
|
+
"amis": {
|
|
4171
|
+
"hidden": true
|
|
4172
|
+
}
|
|
4173
|
+
},
|
|
4174
|
+
"filter_scope": {
|
|
4175
|
+
"amis": {
|
|
4176
|
+
"hidden": true
|
|
4177
|
+
}
|
|
4178
|
+
},
|
|
4179
|
+
"columns": {
|
|
4180
|
+
"amis": {
|
|
4181
|
+
"hidden": true
|
|
4182
|
+
}
|
|
4183
|
+
},
|
|
4184
|
+
"filter_fields": {
|
|
4185
|
+
"amis": {
|
|
4186
|
+
"hidden": true
|
|
4187
|
+
}
|
|
4188
|
+
},
|
|
4189
|
+
"scrolling_mode": {
|
|
4190
|
+
"amis": {
|
|
4191
|
+
"hidden": true
|
|
4192
|
+
}
|
|
4193
|
+
},
|
|
4194
|
+
"sort": {
|
|
4195
|
+
"amis": {
|
|
4196
|
+
"hidden": true
|
|
4197
|
+
}
|
|
4198
|
+
},
|
|
4199
|
+
"show_count": {
|
|
4200
|
+
"amis": {
|
|
4201
|
+
"hidden": true
|
|
4202
|
+
}
|
|
4203
|
+
},
|
|
4204
|
+
"type": {
|
|
4205
|
+
"amis": {
|
|
4206
|
+
"hidden": true
|
|
4207
|
+
}
|
|
4208
|
+
},
|
|
4209
|
+
"shared": {
|
|
4210
|
+
"amis": {
|
|
4211
|
+
"visibleOn": "${global.user.is_space_admin}"
|
|
4212
|
+
}
|
|
4213
|
+
}
|
|
4214
|
+
}
|
|
4215
|
+
}
|
|
4216
|
+
|
|
4217
|
+
const getCopyListviewButtonSchema = ()=>{
|
|
4218
|
+
return {
|
|
4219
|
+
"type": "button",
|
|
4220
|
+
"label": "复制",
|
|
4069
4221
|
"onEvent": {
|
|
4070
4222
|
"click": {
|
|
4223
|
+
"weight": 0,
|
|
4071
4224
|
"actions": [
|
|
4072
4225
|
{
|
|
4073
|
-
"
|
|
4074
|
-
|
|
4226
|
+
"dialog": {
|
|
4227
|
+
"type": "dialog",
|
|
4228
|
+
"title": "复制 列表视图",
|
|
4229
|
+
"data": {
|
|
4230
|
+
"&": "$$",
|
|
4231
|
+
"listName": "${listName}",
|
|
4232
|
+
"targetObjectName": "${objectName}",
|
|
4233
|
+
"list_view": "${uiSchema.list_views[listName]}",
|
|
4234
|
+
"appId": "${appId}",
|
|
4235
|
+
"global": "${global}"
|
|
4236
|
+
},
|
|
4237
|
+
"body": [
|
|
4238
|
+
{
|
|
4239
|
+
"type": "steedos-object-form",
|
|
4240
|
+
"label": "对象表单",
|
|
4241
|
+
"objectApiName": "object_listviews",
|
|
4242
|
+
"recordId": "",
|
|
4243
|
+
"mode": "edit",
|
|
4244
|
+
"defaultData": {
|
|
4245
|
+
"&": "${list_view}",
|
|
4246
|
+
"name":"",
|
|
4247
|
+
"label": "${list_view.label} 的副本",
|
|
4248
|
+
"shared":false
|
|
4249
|
+
},
|
|
4250
|
+
"fieldsExtend": fieldsExtend$3(),
|
|
4251
|
+
"fields": fields(),
|
|
4252
|
+
"onEvent": {
|
|
4253
|
+
"submitSucc": {
|
|
4254
|
+
"weight": 0,
|
|
4255
|
+
"actions": [
|
|
4256
|
+
{
|
|
4257
|
+
"args": {
|
|
4258
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
4259
|
+
"blank": false
|
|
4260
|
+
},
|
|
4261
|
+
"actionType": "url",
|
|
4262
|
+
}
|
|
4263
|
+
]
|
|
4264
|
+
}
|
|
4265
|
+
}
|
|
4266
|
+
}
|
|
4267
|
+
],
|
|
4268
|
+
"showCloseButton": true,
|
|
4269
|
+
"showErrorMsg": true,
|
|
4270
|
+
"showLoading": true,
|
|
4271
|
+
"closeOnEsc": false,
|
|
4272
|
+
"dataMapSwitch": false,
|
|
4273
|
+
"size": "lg"
|
|
4274
|
+
},
|
|
4275
|
+
"actionType": "dialog"
|
|
4075
4276
|
}
|
|
4076
4277
|
]
|
|
4077
4278
|
}
|
|
4078
4279
|
}
|
|
4079
|
-
|
|
4080
|
-
|
|
4280
|
+
}
|
|
4281
|
+
};
|
|
4282
|
+
|
|
4283
|
+
function fields(){
|
|
4284
|
+
return [
|
|
4285
|
+
"label",
|
|
4286
|
+
"name",
|
|
4287
|
+
"object_name",
|
|
4288
|
+
"filter_scope",
|
|
4289
|
+
"show_count",
|
|
4290
|
+
"columns.$.field",
|
|
4291
|
+
"columns.$.width",
|
|
4292
|
+
"sort.$.field_name",
|
|
4293
|
+
"sort.$.order",
|
|
4294
|
+
"filters",
|
|
4295
|
+
"mobile_columns.$.field",
|
|
4296
|
+
"searchable_fields.$.field",
|
|
4297
|
+
"is_system",
|
|
4298
|
+
"shared"
|
|
4081
4299
|
]
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
"
|
|
4098
|
-
}
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
"
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4300
|
+
}
|
|
4301
|
+
|
|
4302
|
+
function fieldsExtend$3(){
|
|
4303
|
+
return {
|
|
4304
|
+
"label": {
|
|
4305
|
+
"is_wide": true
|
|
4306
|
+
},
|
|
4307
|
+
"name": {
|
|
4308
|
+
"is_wide": true,
|
|
4309
|
+
"amis": {
|
|
4310
|
+
"hidden": true
|
|
4311
|
+
}
|
|
4312
|
+
},
|
|
4313
|
+
"object_name": {
|
|
4314
|
+
"amis": {
|
|
4315
|
+
"hidden": true
|
|
4316
|
+
}
|
|
4317
|
+
},
|
|
4318
|
+
"filter_scope": {
|
|
4319
|
+
"amis": {
|
|
4320
|
+
"hidden": true
|
|
4321
|
+
}
|
|
4322
|
+
},
|
|
4323
|
+
"columns": {
|
|
4324
|
+
"amis": {
|
|
4325
|
+
"hidden": true
|
|
4326
|
+
}
|
|
4327
|
+
},
|
|
4328
|
+
"filter_fields": {
|
|
4329
|
+
"amis": {
|
|
4330
|
+
"hidden": true
|
|
4331
|
+
}
|
|
4332
|
+
},
|
|
4333
|
+
"scrolling_mode": {
|
|
4334
|
+
"amis": {
|
|
4335
|
+
"hidden": true
|
|
4336
|
+
}
|
|
4337
|
+
},
|
|
4338
|
+
"sort": {
|
|
4339
|
+
"amis": {
|
|
4340
|
+
"hidden": true
|
|
4341
|
+
}
|
|
4342
|
+
},
|
|
4343
|
+
"show_count": {
|
|
4344
|
+
"amis": {
|
|
4345
|
+
"hidden": true
|
|
4346
|
+
}
|
|
4347
|
+
},
|
|
4348
|
+
"type": {
|
|
4349
|
+
"amis": {
|
|
4350
|
+
"hidden": true
|
|
4351
|
+
}
|
|
4352
|
+
},
|
|
4353
|
+
"shared": {
|
|
4354
|
+
"amis": {
|
|
4355
|
+
"visibleOn": "${global.user.is_space_admin}"
|
|
4356
|
+
}
|
|
4357
|
+
}
|
|
4358
|
+
}
|
|
4359
|
+
}
|
|
4360
|
+
|
|
4361
|
+
const getRenameListviewButtonSchema = ()=>{
|
|
4362
|
+
return {
|
|
4106
4363
|
"type": "button",
|
|
4107
|
-
"label": "",
|
|
4108
|
-
"
|
|
4109
|
-
"align": "right",
|
|
4110
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4111
|
-
"tooltipPlacement": "bottom",
|
|
4112
|
-
"visibleOn": "${!isLookup && global.user.is_space_admin}",
|
|
4113
|
-
"tooltip": "导出Excel",
|
|
4364
|
+
"label": "重命名",
|
|
4365
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4114
4366
|
"onEvent": {
|
|
4115
4367
|
"click": {
|
|
4116
4368
|
"weight": 0,
|
|
4117
4369
|
"actions": [
|
|
4118
4370
|
{
|
|
4119
|
-
"
|
|
4120
|
-
"
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
"
|
|
4124
|
-
"
|
|
4125
|
-
"
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
"
|
|
4371
|
+
"dialog": {
|
|
4372
|
+
"type": "dialog",
|
|
4373
|
+
"title": "重命名 列表视图",
|
|
4374
|
+
"data": {
|
|
4375
|
+
"targetObjectName": "${objectName}",
|
|
4376
|
+
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4377
|
+
"appId": "${appId}"
|
|
4378
|
+
},
|
|
4379
|
+
"body": [
|
|
4380
|
+
{
|
|
4381
|
+
"type": "steedos-object-form",
|
|
4382
|
+
"label": "对象表单",
|
|
4383
|
+
"objectApiName": "object_listviews",
|
|
4384
|
+
"recordId": "${recordId}",
|
|
4385
|
+
"mode": "edit",
|
|
4386
|
+
"fields": [
|
|
4387
|
+
"label"
|
|
4388
|
+
],
|
|
4389
|
+
"fieldsExtend": "{\n \"label\":{\n \"is_wide\": true\n }\n}",
|
|
4390
|
+
"onEvent": {
|
|
4391
|
+
"submitSucc": {
|
|
4392
|
+
"weight": 0,
|
|
4393
|
+
"actions": [
|
|
4394
|
+
{
|
|
4395
|
+
"args": {
|
|
4396
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${name}",
|
|
4397
|
+
"blank": false
|
|
4398
|
+
},
|
|
4399
|
+
"actionType": "url",
|
|
4400
|
+
},
|
|
4401
|
+
]
|
|
4402
|
+
}
|
|
4403
|
+
}
|
|
4131
4404
|
}
|
|
4132
|
-
|
|
4405
|
+
],
|
|
4406
|
+
"showCloseButton": true,
|
|
4407
|
+
"showErrorMsg": true,
|
|
4408
|
+
"showLoading": true,
|
|
4409
|
+
"size": "lg"
|
|
4133
4410
|
},
|
|
4134
|
-
"actionType": "
|
|
4411
|
+
"actionType": "dialog"
|
|
4135
4412
|
}
|
|
4136
4413
|
]
|
|
4137
4414
|
}
|
|
4138
4415
|
}
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4416
|
+
}
|
|
4417
|
+
};
|
|
4418
|
+
|
|
4419
|
+
const getSetListviewShareButtonSchema = ()=>{
|
|
4420
|
+
return {
|
|
4143
4421
|
"type": "button",
|
|
4144
|
-
"
|
|
4145
|
-
"
|
|
4422
|
+
"label": "共享设置",
|
|
4423
|
+
"disabledOn": "!(global.user.is_space_admin && !!uiSchema.list_views[listName].owner)",
|
|
4146
4424
|
"onEvent": {
|
|
4147
4425
|
"click": {
|
|
4426
|
+
"weight": 0,
|
|
4148
4427
|
"actions": [
|
|
4149
4428
|
{
|
|
4150
|
-
"
|
|
4151
|
-
|
|
4429
|
+
"dialog": {
|
|
4430
|
+
"type": "dialog",
|
|
4431
|
+
"title": "共享设置",
|
|
4432
|
+
"data": {
|
|
4433
|
+
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4434
|
+
},
|
|
4435
|
+
"body": [
|
|
4436
|
+
{
|
|
4437
|
+
"type": "steedos-object-form",
|
|
4438
|
+
"label": "对象表单",
|
|
4439
|
+
"objectApiName": "object_listviews",
|
|
4440
|
+
"recordId": "${recordId}",
|
|
4441
|
+
"mode": "edit",
|
|
4442
|
+
"fields": [
|
|
4443
|
+
"shared"
|
|
4444
|
+
]
|
|
4445
|
+
}
|
|
4446
|
+
],
|
|
4447
|
+
"showCloseButton": true,
|
|
4448
|
+
"showErrorMsg": true,
|
|
4449
|
+
"showLoading": true,
|
|
4450
|
+
"closeOnEsc": false,
|
|
4451
|
+
"dataMapSwitch": false,
|
|
4452
|
+
"size": "md"
|
|
4453
|
+
},
|
|
4454
|
+
"actionType": "dialog"
|
|
4152
4455
|
}
|
|
4153
4456
|
]
|
|
4154
4457
|
}
|
|
4155
4458
|
}
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
"
|
|
4162
|
-
"
|
|
4163
|
-
"
|
|
4164
|
-
"
|
|
4165
|
-
{
|
|
4166
|
-
"
|
|
4167
|
-
"
|
|
4459
|
+
}
|
|
4460
|
+
};
|
|
4461
|
+
|
|
4462
|
+
const getSetListviewFiltersButtonSchema = ()=>{
|
|
4463
|
+
return {
|
|
4464
|
+
"type": "button",
|
|
4465
|
+
"label": "过滤设置",
|
|
4466
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4467
|
+
"onEvent": {
|
|
4468
|
+
"click": {
|
|
4469
|
+
"weight": 0,
|
|
4470
|
+
"actions": [
|
|
4168
4471
|
{
|
|
4169
|
-
"
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
"
|
|
4173
|
-
"
|
|
4174
|
-
"
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4472
|
+
"dialog": {
|
|
4473
|
+
"type": "dialog",
|
|
4474
|
+
"title": "过滤设置",
|
|
4475
|
+
"data": {
|
|
4476
|
+
"targetObjectName": "${objectName}",
|
|
4477
|
+
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4478
|
+
"listName": "${listName}",
|
|
4479
|
+
"appId": "${appId}"
|
|
4480
|
+
},
|
|
4481
|
+
"body": [
|
|
4482
|
+
{
|
|
4483
|
+
"type": "steedos-object-form",
|
|
4484
|
+
"label": "对象表单",
|
|
4485
|
+
"objectApiName": "object_listviews",
|
|
4486
|
+
"recordId": "${recordId}",
|
|
4487
|
+
"mode": "edit",
|
|
4488
|
+
"fields": [
|
|
4489
|
+
"filters"
|
|
4490
|
+
],
|
|
4491
|
+
"initApiAdaptor": initApiAdaptor$2(),
|
|
4492
|
+
"apiRequestAdaptor": apiRequestAdaptor$2(),
|
|
4493
|
+
"fieldsExtend": fieldsExtend$2(),
|
|
4494
|
+
"onEvent": {
|
|
4495
|
+
"submitSucc": {
|
|
4496
|
+
"weight": 0,
|
|
4497
|
+
"actions": [
|
|
4188
4498
|
{
|
|
4189
|
-
"
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
"recordId": "",
|
|
4193
|
-
"mode": "edit",
|
|
4194
|
-
"defaultData": {
|
|
4195
|
-
"&": "${list_view}",
|
|
4196
|
-
"name":"",
|
|
4197
|
-
"label":"",
|
|
4198
|
-
"filters":"",
|
|
4199
|
-
"shared":false
|
|
4200
|
-
},
|
|
4201
|
-
"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}",
|
|
4202
|
-
"fields": [
|
|
4203
|
-
"label",
|
|
4204
|
-
"name",
|
|
4205
|
-
"object_name",
|
|
4206
|
-
"filter_scope",
|
|
4207
|
-
"show_count",
|
|
4208
|
-
"columns.$.field",
|
|
4209
|
-
"columns.$.width",
|
|
4210
|
-
"sort.$.field_name",
|
|
4211
|
-
"sort.$.order",
|
|
4212
|
-
"filters",
|
|
4213
|
-
"mobile_columns.$.field",
|
|
4214
|
-
"searchable_fields.$.field",
|
|
4215
|
-
"is_system",
|
|
4216
|
-
"shared"
|
|
4217
|
-
],
|
|
4218
|
-
"onEvent": {
|
|
4219
|
-
"submitSucc": {
|
|
4220
|
-
"weight": 0,
|
|
4221
|
-
"actions": [
|
|
4222
|
-
{
|
|
4223
|
-
"args": {
|
|
4224
|
-
// 直接使用recordId不能拿到数据,只能通过result里面拿数据
|
|
4225
|
-
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
4226
|
-
"blank": false
|
|
4227
|
-
},
|
|
4228
|
-
"actionType": "url",
|
|
4229
|
-
}
|
|
4230
|
-
]
|
|
4231
|
-
}
|
|
4232
|
-
},
|
|
4233
|
-
"messages": {
|
|
4234
|
-
"success": "成功",
|
|
4235
|
-
"failed": "失败"
|
|
4499
|
+
"args": {
|
|
4500
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
4501
|
+
"blank": false
|
|
4236
4502
|
},
|
|
4503
|
+
"actionType": "url",
|
|
4237
4504
|
}
|
|
4238
|
-
]
|
|
4239
|
-
|
|
4240
|
-
"showErrorMsg": true,
|
|
4241
|
-
"showLoading": true,
|
|
4242
|
-
"closeOnEsc": false,
|
|
4243
|
-
"dataMapSwitch": false,
|
|
4244
|
-
"size": "lg"
|
|
4245
|
-
},
|
|
4246
|
-
"actionType": "dialog"
|
|
4505
|
+
]
|
|
4506
|
+
}
|
|
4247
4507
|
}
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
"label"
|
|
4358
|
-
],
|
|
4359
|
-
"fieldsExtend": "{\n \"label\":{\n \"is_wide\": true\n }\n}",
|
|
4360
|
-
"onEvent": {
|
|
4361
|
-
"submitSucc": {
|
|
4362
|
-
"weight": 0,
|
|
4363
|
-
"actions": [
|
|
4364
|
-
{
|
|
4365
|
-
"args": {
|
|
4366
|
-
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${name}",
|
|
4367
|
-
"blank": false
|
|
4368
|
-
},
|
|
4369
|
-
"actionType": "url",
|
|
4370
|
-
},
|
|
4371
|
-
]
|
|
4372
|
-
}
|
|
4373
|
-
}
|
|
4374
|
-
}
|
|
4375
|
-
],
|
|
4376
|
-
"showCloseButton": true,
|
|
4377
|
-
"showErrorMsg": true,
|
|
4378
|
-
"showLoading": true,
|
|
4379
|
-
"size": "lg"
|
|
4380
|
-
},
|
|
4381
|
-
"actionType": "dialog"
|
|
4382
|
-
}
|
|
4383
|
-
]
|
|
4384
|
-
}
|
|
4385
|
-
}
|
|
4386
|
-
},
|
|
4508
|
+
}
|
|
4509
|
+
],
|
|
4510
|
+
"showCloseButton": true,
|
|
4511
|
+
"showErrorMsg": true,
|
|
4512
|
+
"showLoading": true,
|
|
4513
|
+
"closeOnEsc": false,
|
|
4514
|
+
"dataMapSwitch": false,
|
|
4515
|
+
"size": "lg"
|
|
4516
|
+
},
|
|
4517
|
+
"actionType": "dialog"
|
|
4518
|
+
}
|
|
4519
|
+
]
|
|
4520
|
+
}
|
|
4521
|
+
}
|
|
4522
|
+
}
|
|
4523
|
+
};
|
|
4524
|
+
|
|
4525
|
+
|
|
4526
|
+
function initApiAdaptor$2(){
|
|
4527
|
+
return `
|
|
4528
|
+
const recordId_tmp = api.body.recordId;
|
|
4529
|
+
let data_tmp;
|
|
4530
|
+
if (recordId_tmp) {
|
|
4531
|
+
data_tmp = payload.data;
|
|
4532
|
+
// 数据格式转换
|
|
4533
|
+
if (data_tmp) {
|
|
4534
|
+
if (data_tmp.filters && lodash.isString(data_tmp.filters)) {
|
|
4535
|
+
try {
|
|
4536
|
+
data_tmp.filters = JSON.parse(data_tmp.filters);
|
|
4537
|
+
} catch (e) { }
|
|
4538
|
+
}
|
|
4539
|
+
|
|
4540
|
+
if (data_tmp.filters && lodash.isString(data_tmp.filters)) {
|
|
4541
|
+
data_tmp._filters_type_controller = 'function';
|
|
4542
|
+
} else {
|
|
4543
|
+
data_tmp._filters_type_controller = 'conditions'
|
|
4544
|
+
}
|
|
4545
|
+
|
|
4546
|
+
if (data_tmp._filters_type_controller === 'conditions') {
|
|
4547
|
+
data_tmp._filters_conditions = window.amisConvert.filtersToConditions(data_tmp.filters || []);
|
|
4548
|
+
data_tmp.filters = data_tmp._filters_conditions;
|
|
4549
|
+
} else {
|
|
4550
|
+
data_tmp._filters_function = data_tmp.filters;
|
|
4551
|
+
}
|
|
4552
|
+
}
|
|
4553
|
+
}
|
|
4554
|
+
for (key in data_tmp) {
|
|
4555
|
+
if (data_tmp[key] === null) {
|
|
4556
|
+
delete data_tmp[key];
|
|
4557
|
+
}
|
|
4558
|
+
}
|
|
4559
|
+
payload.data = Object.assign(payload.data, data_tmp);
|
|
4560
|
+
delete payload.extensions;
|
|
4561
|
+
return payload;
|
|
4562
|
+
`
|
|
4563
|
+
}
|
|
4564
|
+
|
|
4565
|
+
function apiRequestAdaptor$2(){
|
|
4566
|
+
return `
|
|
4567
|
+
const recordId = api.body.recordId;
|
|
4568
|
+
if (formData._filters_type_controller === 'conditions' && formData._filters_conditions) {
|
|
4569
|
+
formData.filters = window.amisConvert.conditionsToFilters(formData.filters);
|
|
4570
|
+
} else {
|
|
4571
|
+
formData.filters = formData._filters_function || null;
|
|
4572
|
+
}
|
|
4573
|
+
|
|
4574
|
+
delete formData._filters_type_controller;
|
|
4575
|
+
delete formData._filters_conditions;
|
|
4576
|
+
delete formData._filters_function;
|
|
4577
|
+
|
|
4578
|
+
query = 'mutation{record: ' + objectName + '__insert(doc: {__saveData}){_id}}';
|
|
4579
|
+
if (api.body.recordId) {
|
|
4580
|
+
query = 'mutation{record: ' + objectName + '__update(id: "' + recordId + '", doc: {__saveData}){_id}}';
|
|
4581
|
+
};
|
|
4582
|
+
__saveData = JSON.stringify(JSON.stringify(formData));
|
|
4583
|
+
api.data = { query: query.replace('{__saveData}', __saveData) };
|
|
4584
|
+
return api;
|
|
4585
|
+
`
|
|
4586
|
+
}
|
|
4587
|
+
|
|
4588
|
+
function fieldsExtend$2(){
|
|
4589
|
+
return {
|
|
4590
|
+
"filters": {
|
|
4591
|
+
"visible_on": "true",
|
|
4592
|
+
"amis": {
|
|
4593
|
+
"type": "condition-builder",
|
|
4594
|
+
"label": "条件组件1",
|
|
4595
|
+
"source": {
|
|
4596
|
+
"method": "get",
|
|
4597
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-listviews/getFilterFields?objectName=${targetObjectName}",
|
|
4598
|
+
"dataType": "json",
|
|
4599
|
+
"headers": {
|
|
4600
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4601
|
+
}
|
|
4602
|
+
}
|
|
4603
|
+
}
|
|
4604
|
+
}
|
|
4605
|
+
}
|
|
4606
|
+
}
|
|
4607
|
+
|
|
4608
|
+
const getSetListviewColumnsButtonSchema = ()=>{
|
|
4609
|
+
return {
|
|
4610
|
+
"type": "button",
|
|
4611
|
+
"label": "显示的列",
|
|
4612
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4613
|
+
"onEvent": {
|
|
4614
|
+
"click": {
|
|
4615
|
+
"weight": 0,
|
|
4616
|
+
"actions": [
|
|
4387
4617
|
{
|
|
4388
|
-
"
|
|
4389
|
-
"
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
"
|
|
4393
|
-
"
|
|
4394
|
-
"
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4618
|
+
"args": {},
|
|
4619
|
+
"dialog": {
|
|
4620
|
+
"type": "dialog",
|
|
4621
|
+
"title": "显示的列",
|
|
4622
|
+
"data": {
|
|
4623
|
+
"&": "$$",
|
|
4624
|
+
"targetObjectName": "${objectName}",
|
|
4625
|
+
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4626
|
+
"listName": "${listName}",
|
|
4627
|
+
"appId": "${appId}"
|
|
4628
|
+
},
|
|
4629
|
+
"body": [
|
|
4630
|
+
{
|
|
4631
|
+
"type": "steedos-object-form",
|
|
4632
|
+
"label": "对象表单",
|
|
4633
|
+
"objectApiName": "object_listviews",
|
|
4634
|
+
"recordId": "${recordId}",
|
|
4635
|
+
"mode": "edit",
|
|
4636
|
+
"fieldsExtend": fieldsExtend$1(),
|
|
4637
|
+
"initApiAdaptor": initApiAdaptor$1(),
|
|
4638
|
+
"apiRequestAdaptor": apiRequestAdaptor$1(),
|
|
4639
|
+
"fields": [
|
|
4640
|
+
"columns",
|
|
4641
|
+
"mobile_columns"
|
|
4642
|
+
],
|
|
4643
|
+
"onEvent": {
|
|
4644
|
+
"submitSucc": {
|
|
4645
|
+
"weight": 0,
|
|
4646
|
+
"actions": [
|
|
4403
4647
|
{
|
|
4404
|
-
"
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
"
|
|
4409
|
-
"fields": [
|
|
4410
|
-
"shared"
|
|
4411
|
-
]
|
|
4648
|
+
"args": {
|
|
4649
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
4650
|
+
"blank": false
|
|
4651
|
+
},
|
|
4652
|
+
"actionType": "url"
|
|
4412
4653
|
}
|
|
4413
|
-
]
|
|
4414
|
-
|
|
4415
|
-
"showErrorMsg": true,
|
|
4416
|
-
"showLoading": true,
|
|
4417
|
-
"closeOnEsc": false,
|
|
4418
|
-
"dataMapSwitch": false,
|
|
4419
|
-
"size": "md"
|
|
4420
|
-
},
|
|
4421
|
-
"actionType": "dialog"
|
|
4654
|
+
]
|
|
4655
|
+
}
|
|
4422
4656
|
}
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4657
|
+
}
|
|
4658
|
+
],
|
|
4659
|
+
"searchable": true,
|
|
4660
|
+
"showCloseButton": true,
|
|
4661
|
+
"showErrorMsg": true,
|
|
4662
|
+
"showLoading": true,
|
|
4663
|
+
"size": "lg"
|
|
4664
|
+
},
|
|
4665
|
+
"actionType": "dialog"
|
|
4666
|
+
}
|
|
4667
|
+
]
|
|
4668
|
+
}
|
|
4669
|
+
}
|
|
4670
|
+
}
|
|
4671
|
+
};
|
|
4672
|
+
|
|
4673
|
+
function fieldsExtend$1(){
|
|
4674
|
+
return {
|
|
4675
|
+
"columns": {
|
|
4676
|
+
"amis": {
|
|
4677
|
+
"type": "transfer",
|
|
4678
|
+
"sortable": true,
|
|
4679
|
+
"searchable": true,
|
|
4680
|
+
"source": {
|
|
4681
|
+
"method": "get",
|
|
4682
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${targetObjectName}/fields/options",
|
|
4683
|
+
"headers": {
|
|
4684
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4685
|
+
}
|
|
4686
|
+
}
|
|
4687
|
+
}
|
|
4688
|
+
},
|
|
4689
|
+
"mobile_columns": {
|
|
4690
|
+
"group": "手机端",
|
|
4691
|
+
"amis": {
|
|
4692
|
+
"type": "transfer",
|
|
4693
|
+
"sortable": true,
|
|
4694
|
+
"searchable": true,
|
|
4695
|
+
"source": {
|
|
4696
|
+
"method": "get",
|
|
4697
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${targetObjectName}/fields/options",
|
|
4698
|
+
"headers": {
|
|
4699
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4700
|
+
}
|
|
4701
|
+
}
|
|
4702
|
+
}
|
|
4703
|
+
}
|
|
4704
|
+
}
|
|
4705
|
+
}
|
|
4706
|
+
|
|
4707
|
+
function initApiAdaptor$1(){
|
|
4708
|
+
return `
|
|
4709
|
+
const recordId_tmp = api.body.recordId;
|
|
4710
|
+
let columns_tmp = {}, mobile_columns_tmp = {};
|
|
4711
|
+
if (recordId_tmp) {
|
|
4712
|
+
columns_tmp = payload.data.columns;
|
|
4713
|
+
mobile_columns_tmp = payload.data.mobile_columns;
|
|
4714
|
+
if (columns_tmp) {
|
|
4715
|
+
columns_tmp = lodash.map(columns_tmp, 'field');
|
|
4716
|
+
}
|
|
4717
|
+
if (mobile_columns_tmp) {
|
|
4718
|
+
mobile_columns_tmp = lodash.map(mobile_columns_tmp, 'field');
|
|
4719
|
+
}
|
|
4720
|
+
}
|
|
4721
|
+
payload.data.columns = columns_tmp;
|
|
4722
|
+
payload.data.mobile_columns = mobile_columns_tmp;
|
|
4723
|
+
|
|
4724
|
+
delete payload.extensions;
|
|
4725
|
+
return payload;
|
|
4726
|
+
`
|
|
4727
|
+
}
|
|
4728
|
+
|
|
4729
|
+
function apiRequestAdaptor$1(){
|
|
4730
|
+
return `
|
|
4731
|
+
const formData_tmp = api.body.$;
|
|
4732
|
+
const objectName_tmp = api.body.objectName;
|
|
4733
|
+
const recordId_tmp = api.body.recordId;
|
|
4734
|
+
|
|
4735
|
+
if (typeof formData_tmp.columns == 'string') {
|
|
4736
|
+
formData_tmp.columns = formData_tmp.columns?.split(',');
|
|
4737
|
+
}
|
|
4738
|
+
if (typeof formData_tmp.mobile_columns == 'string') {
|
|
4739
|
+
formData_tmp.mobile_columns = formData_tmp.mobile_columns?.split(',');
|
|
4740
|
+
}
|
|
4741
|
+
|
|
4742
|
+
// 数据格式转换
|
|
4743
|
+
formData_tmp.columns = lodash.map(formData_tmp.columns, (item) => {
|
|
4744
|
+
return { field: item };
|
|
4745
|
+
});
|
|
4746
|
+
formData.mobile_columns = lodash.map(formData.mobile_columns, (item) => {
|
|
4747
|
+
return { field: item };
|
|
4748
|
+
});
|
|
4749
|
+
|
|
4750
|
+
let query_tmp = 'mutation{record: ' + objectName_tmp + '__insert(doc: {__saveData}){_id}}';
|
|
4751
|
+
if (api.body.recordId) {
|
|
4752
|
+
query_tmp = 'mutation{record: ' + objectName_tmp + '__update(id: "' + recordId_tmp +'", doc: {__saveData}){_id}}';
|
|
4753
|
+
};
|
|
4754
|
+
delete formData_tmp._id;
|
|
4755
|
+
let __saveData_tmp = JSON.stringify(JSON.stringify(formData_tmp));
|
|
4756
|
+
api.data = { query: query_tmp.replace('{__saveData}', __saveData_tmp) };
|
|
4757
|
+
|
|
4758
|
+
return api;
|
|
4759
|
+
`
|
|
4760
|
+
}
|
|
4761
|
+
|
|
4762
|
+
const getSetListviewSortButtonSchema = ()=>{
|
|
4763
|
+
return {
|
|
4764
|
+
"type": "button",
|
|
4765
|
+
"label": "默认排序规则",
|
|
4766
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4767
|
+
"onEvent": {
|
|
4768
|
+
"click": {
|
|
4769
|
+
"weight": 0,
|
|
4770
|
+
"actions": [
|
|
4427
4771
|
{
|
|
4428
|
-
"
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
"
|
|
4434
|
-
"
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4772
|
+
"dialog": {
|
|
4773
|
+
"type": "dialog",
|
|
4774
|
+
"title": "弹框标题",
|
|
4775
|
+
"data": {
|
|
4776
|
+
"&": "$$",
|
|
4777
|
+
"targetObjectName": "${objectName}",
|
|
4778
|
+
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4779
|
+
"listName": "${listName}",
|
|
4780
|
+
"appId": "${appId}"
|
|
4781
|
+
},
|
|
4782
|
+
"body": [
|
|
4783
|
+
{
|
|
4784
|
+
"type": "steedos-object-form",
|
|
4785
|
+
"label": "对象表单",
|
|
4786
|
+
"objectApiName": "object_listviews",
|
|
4787
|
+
"recordId": "${recordId}",
|
|
4788
|
+
"className": "",
|
|
4789
|
+
"id": "u:061f158b4c5a",
|
|
4790
|
+
"mode": "edit",
|
|
4791
|
+
"fields": [
|
|
4792
|
+
"sort",
|
|
4793
|
+
"sort.$.field_name",
|
|
4794
|
+
"sort.$.order"
|
|
4795
|
+
],
|
|
4796
|
+
"onEvent": {
|
|
4797
|
+
"submitSucc": {
|
|
4798
|
+
"weight": 0,
|
|
4799
|
+
"actions": [
|
|
4447
4800
|
{
|
|
4448
|
-
"
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
"
|
|
4453
|
-
"fields": [
|
|
4454
|
-
"filters"
|
|
4455
|
-
],
|
|
4456
|
-
"initApiRequestAdaptor": "",
|
|
4457
|
-
"initApiAdaptor": "const recordId_tmp = api.body.recordId;\nlet data_tmp;\nif (recordId_tmp) {\n data_tmp = payload.data;\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 = Object.assign(payload.data, data_tmp);\ndelete payload.extensions;",
|
|
4458
|
-
"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",
|
|
4459
|
-
"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}",
|
|
4460
|
-
"onEvent": {
|
|
4461
|
-
"submitSucc": {
|
|
4462
|
-
"weight": 0,
|
|
4463
|
-
"actions": [
|
|
4464
|
-
{
|
|
4465
|
-
"args": {
|
|
4466
|
-
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
4467
|
-
"blank": false
|
|
4468
|
-
},
|
|
4469
|
-
"actionType": "url",
|
|
4470
|
-
}
|
|
4471
|
-
]
|
|
4472
|
-
}
|
|
4473
|
-
}
|
|
4801
|
+
"args": {
|
|
4802
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
4803
|
+
"blank": false
|
|
4804
|
+
},
|
|
4805
|
+
"actionType": "url"
|
|
4474
4806
|
}
|
|
4475
|
-
]
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4807
|
+
]
|
|
4808
|
+
}
|
|
4809
|
+
},
|
|
4810
|
+
"fieldsExtend": fieldsExtend(),
|
|
4811
|
+
"initApiAdaptor": initApiAdaptor(),
|
|
4812
|
+
"apiRequestAdaptor": apiRequestAdaptor()
|
|
4813
|
+
}
|
|
4814
|
+
],
|
|
4815
|
+
"showCloseButton": true,
|
|
4816
|
+
"showErrorMsg": true,
|
|
4817
|
+
"showLoading": true,
|
|
4818
|
+
"id": "u:d3f6947b6acf",
|
|
4819
|
+
"size": "lg"
|
|
4820
|
+
},
|
|
4821
|
+
"actionType": "dialog"
|
|
4822
|
+
}
|
|
4823
|
+
]
|
|
4824
|
+
}
|
|
4825
|
+
}
|
|
4826
|
+
}
|
|
4827
|
+
};
|
|
4828
|
+
|
|
4829
|
+
function fieldsExtend(){
|
|
4830
|
+
return {
|
|
4831
|
+
"sort": {
|
|
4832
|
+
"amis": {
|
|
4833
|
+
"type": "tabs-transfer",
|
|
4834
|
+
"sortable": true,
|
|
4835
|
+
"searchable": true,
|
|
4836
|
+
"source": {
|
|
4837
|
+
"method": "get",
|
|
4838
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${targetObjectName}/sortFields/options",
|
|
4839
|
+
"headers": {
|
|
4840
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4841
|
+
}
|
|
4842
|
+
}
|
|
4843
|
+
}
|
|
4844
|
+
}
|
|
4845
|
+
}
|
|
4846
|
+
}
|
|
4847
|
+
|
|
4848
|
+
function initApiAdaptor(){
|
|
4849
|
+
return `
|
|
4850
|
+
let sort;
|
|
4851
|
+
if (recordId) {
|
|
4852
|
+
sort = payload.data.sort;
|
|
4853
|
+
//数据格式转换
|
|
4854
|
+
if (sort instanceof Array) {
|
|
4855
|
+
sort = lodash.map(sort, (item) => {
|
|
4856
|
+
return item.field_name + ':' + (item.order || 'asc')
|
|
4857
|
+
});
|
|
4858
|
+
}
|
|
4859
|
+
}
|
|
4860
|
+
payload.data.sort = sort;
|
|
4861
|
+
delete payload.extensions;
|
|
4862
|
+
return payload;
|
|
4863
|
+
`
|
|
4864
|
+
}
|
|
4865
|
+
|
|
4866
|
+
function apiRequestAdaptor(){
|
|
4867
|
+
return `
|
|
4868
|
+
const recordId = api.body.recordId;
|
|
4869
|
+
//数据格式转换
|
|
4870
|
+
if (typeof formData.sort == 'string') {
|
|
4871
|
+
formData.sort = formData.sort?.split(',');
|
|
4872
|
+
}
|
|
4873
|
+
formData.sort = lodash.map(formData.sort, (item) => {
|
|
4874
|
+
const arr = item.split(':');
|
|
4875
|
+
return { field_name: arr[0], order: arr[1] };
|
|
4876
|
+
});
|
|
4877
|
+
if (recordId) {
|
|
4878
|
+
query = 'mutation{record: ' + objectName + '__update(id: "' + recordId + '", doc: {__saveData}){_id}}';
|
|
4879
|
+
}
|
|
4880
|
+
__saveData = JSON.stringify(JSON.stringify(formData));
|
|
4881
|
+
api.data = { query: query.replace('{__saveData}', __saveData) };
|
|
4882
|
+
return api;
|
|
4883
|
+
`
|
|
4884
|
+
}
|
|
4885
|
+
|
|
4886
|
+
const getDeleteListviewButtonSchema = ()=>{
|
|
4887
|
+
return {
|
|
4888
|
+
"type": "button",
|
|
4889
|
+
"label": "删除",
|
|
4890
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4891
|
+
"confirmText": "如果您删除此列表视图,该视图将为所有具备访问权限的用户永久删除。是否确定要删除?",
|
|
4892
|
+
"onEvent": {
|
|
4893
|
+
"click": {
|
|
4894
|
+
"actions": [
|
|
4489
4895
|
{
|
|
4490
|
-
"
|
|
4491
|
-
"
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
"
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
"appId": "${appId}"
|
|
4509
|
-
},
|
|
4510
|
-
"body": [
|
|
4511
|
-
{
|
|
4512
|
-
"type": "steedos-object-form",
|
|
4513
|
-
"label": "对象表单",
|
|
4514
|
-
"objectApiName": "object_listviews",
|
|
4515
|
-
"recordId": "${recordId}",
|
|
4516
|
-
"mode": "edit",
|
|
4517
|
-
"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}",
|
|
4518
|
-
"initApiAdaptor": "const recordId_tmp = api.body.recordId;\nlet columns_tmp = {}, mobile_columns_tmp = {};\nif (recordId_tmp) {\n columns_tmp = payload.data.columns;\n mobile_columns_tmp = payload.data.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.columns = columns_tmp;\npayload.data.mobile_columns = mobile_columns_tmp;\n\ndelete payload.extensions;\nreturn payload;",
|
|
4519
|
-
"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;",
|
|
4520
|
-
"fields": [
|
|
4521
|
-
"columns",
|
|
4522
|
-
"mobile_columns"
|
|
4523
|
-
],
|
|
4524
|
-
"onEvent": {
|
|
4525
|
-
"submitSucc": {
|
|
4526
|
-
"weight": 0,
|
|
4527
|
-
"actions": [
|
|
4528
|
-
{
|
|
4529
|
-
"args": {
|
|
4530
|
-
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
4531
|
-
"blank": false
|
|
4532
|
-
},
|
|
4533
|
-
"actionType": "url"
|
|
4534
|
-
}
|
|
4535
|
-
]
|
|
4536
|
-
}
|
|
4537
|
-
}
|
|
4538
|
-
}
|
|
4539
|
-
],
|
|
4540
|
-
"searchable": true,
|
|
4541
|
-
"showCloseButton": true,
|
|
4542
|
-
"showErrorMsg": true,
|
|
4543
|
-
"showLoading": true,
|
|
4544
|
-
"size": "lg"
|
|
4545
|
-
},
|
|
4546
|
-
"actionType": "dialog"
|
|
4547
|
-
}
|
|
4548
|
-
]
|
|
4896
|
+
"actionType": "ajax",
|
|
4897
|
+
"args": {
|
|
4898
|
+
"api": {
|
|
4899
|
+
"url": "${context.rootUrl}/graphql",
|
|
4900
|
+
"method": "post",
|
|
4901
|
+
"headers": {
|
|
4902
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4903
|
+
},
|
|
4904
|
+
"data": {
|
|
4905
|
+
"&": "$$",
|
|
4906
|
+
"uiSchema": "${uiSchema}",
|
|
4907
|
+
"recordId": "${uiSchema.list_views[listName]._id}"
|
|
4908
|
+
},
|
|
4909
|
+
"messages": {
|
|
4910
|
+
"success": "删除成功"
|
|
4911
|
+
},
|
|
4912
|
+
"requestAdaptor": requestAdaptor(),
|
|
4913
|
+
"adaptor": adaptor(),
|
|
4549
4914
|
}
|
|
4550
4915
|
}
|
|
4551
4916
|
},
|
|
4552
4917
|
{
|
|
4553
|
-
"
|
|
4554
|
-
"
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4918
|
+
"actionType": "url",
|
|
4919
|
+
"args": {
|
|
4920
|
+
"url": "${context.rootUrl}/app/${appId}/${objectName}/grid/all",
|
|
4921
|
+
"blank": false
|
|
4922
|
+
},
|
|
4923
|
+
"expression": "data.delete == 1"
|
|
4924
|
+
}
|
|
4925
|
+
]
|
|
4926
|
+
}
|
|
4927
|
+
}
|
|
4928
|
+
}
|
|
4929
|
+
};
|
|
4930
|
+
|
|
4931
|
+
|
|
4932
|
+
function requestAdaptor(){
|
|
4933
|
+
return `
|
|
4934
|
+
const { recordId } = api.body;
|
|
4935
|
+
var deleteArray = [];
|
|
4936
|
+
if (recordId) { deleteArray.push(\`delete:object_listviews__delete(id: "\${recordId}")\`); }
|
|
4937
|
+
api.data = { query: \`mutation{\${deleteArray.join(',')}}\` };
|
|
4938
|
+
return api;
|
|
4939
|
+
`
|
|
4940
|
+
}
|
|
4941
|
+
|
|
4942
|
+
function adaptor(){
|
|
4943
|
+
return `
|
|
4944
|
+
if (payload.errors) {
|
|
4945
|
+
payload.status = 2;
|
|
4946
|
+
payload.msg = payload.errors[0].message;
|
|
4947
|
+
}
|
|
4948
|
+
return payload;
|
|
4949
|
+
`
|
|
4950
|
+
}
|
|
4951
|
+
|
|
4952
|
+
const getSettingListviewToolbarButtonSchema = ()=>{
|
|
4953
|
+
return {
|
|
4954
|
+
"type": "dropdown-button",
|
|
4955
|
+
"trigger": "click",
|
|
4956
|
+
"icon": "fa fa-cog",
|
|
4957
|
+
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4958
|
+
"align": "right",
|
|
4959
|
+
"visibleOn": "${!isLookup}",
|
|
4960
|
+
"buttons": [
|
|
4961
|
+
{
|
|
4962
|
+
"label": "列表视图操作",
|
|
4963
|
+
"children": [
|
|
4964
|
+
getNewListviewButtonSchema(),
|
|
4965
|
+
getCopyListviewButtonSchema(),
|
|
4966
|
+
getRenameListviewButtonSchema(),
|
|
4967
|
+
getSetListviewShareButtonSchema(),
|
|
4968
|
+
getSetListviewFiltersButtonSchema(),
|
|
4969
|
+
getSetListviewColumnsButtonSchema(),
|
|
4970
|
+
getSetListviewSortButtonSchema(),
|
|
4971
|
+
getDeleteListviewButtonSchema()
|
|
4972
|
+
]
|
|
4973
|
+
}
|
|
4974
|
+
]
|
|
4975
|
+
}
|
|
4976
|
+
};
|
|
4977
|
+
|
|
4978
|
+
const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
4979
|
+
let displayAs = Router$1.getTabDisplayAs(objectName);
|
|
4980
|
+
let buttons = [
|
|
4981
|
+
{
|
|
4982
|
+
"type": "button",
|
|
4983
|
+
"label": "表格",
|
|
4984
|
+
"onClick": "let url = document.location.pathname; var urlSearch = new URLSearchParams(document.location.search); if(urlSearch.get(\"side_object\") && urlSearch.get(\"side_listview_id\")){url=`/app/${props.data.appId}/${urlSearch.get(\"side_object\")}/grid/${urlSearch.get(\"side_listview_id\")}`;}; props.env.jumpTo(url + '?display=grid');",
|
|
4985
|
+
"rightIcon": displayAs != 'split' ? "fa fa-check" : null,
|
|
4986
|
+
"rightIconClassName": "m-l-sm"
|
|
4987
|
+
},
|
|
4988
|
+
{
|
|
4989
|
+
"type": "button",
|
|
4990
|
+
"label": "分栏视图",
|
|
4991
|
+
"onClick": "const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
|
|
4992
|
+
"rightIcon": displayAs === 'split' ? "fa fa-check" : null,
|
|
4993
|
+
"rightIconClassName": "m-l-sm"
|
|
4994
|
+
}
|
|
4995
|
+
];
|
|
4996
|
+
return {
|
|
4997
|
+
"type": "dropdown-button",
|
|
4998
|
+
"icon": "fa fa-table-columns",
|
|
4999
|
+
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5000
|
+
"align": "right",
|
|
5001
|
+
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
5002
|
+
"buttons": [
|
|
5003
|
+
{
|
|
5004
|
+
"label": "显示为",
|
|
5005
|
+
"children": buttons
|
|
5006
|
+
}
|
|
5007
|
+
]
|
|
5008
|
+
};
|
|
5009
|
+
};
|
|
5010
|
+
|
|
5011
|
+
|
|
5012
|
+
const onFieldsFilterToggleScript = `
|
|
5013
|
+
const scope = event.context.scoped;
|
|
5014
|
+
const filterForm = scope.getComponents().find(function(n){
|
|
5015
|
+
return n.props.type === "form";
|
|
5016
|
+
});
|
|
5017
|
+
const filterService = filterForm.context.getComponents().find(function(n){
|
|
5018
|
+
return n.props.type === "service";
|
|
5019
|
+
});
|
|
5020
|
+
// filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
|
|
5021
|
+
let resizeWindow = function(){
|
|
5022
|
+
//触发amis crud 高度重算
|
|
5023
|
+
setTimeout(()=>{
|
|
5024
|
+
window.dispatchEvent(new Event("resize"))
|
|
5025
|
+
}, 500);
|
|
5026
|
+
}
|
|
5027
|
+
let isMobile = Steedos.isMobile();
|
|
5028
|
+
if(filterService.props.data.showFieldsFilter){
|
|
5029
|
+
if(isMobile){
|
|
5030
|
+
// 手机上只能通过取消按钮来关闭搜索栏
|
|
5031
|
+
return;
|
|
5032
|
+
}
|
|
5033
|
+
let buttonCancel = SteedosUI.getClosestAmisComponentByType(filterForm.context, "button", {
|
|
5034
|
+
direction: "down",
|
|
5035
|
+
name: "btn_filter_form_cancel"
|
|
5036
|
+
});
|
|
5037
|
+
buttonCancel.props.dispatchEvent('click', {}).then(function(){
|
|
5038
|
+
resizeWindow();
|
|
5039
|
+
});
|
|
5040
|
+
}
|
|
5041
|
+
else{
|
|
5042
|
+
filterService.setData({showFieldsFilter: true});
|
|
5043
|
+
resizeWindow();
|
|
5044
|
+
if(isMobile){
|
|
5045
|
+
// 手机端在显示搜索栏时隐藏刷新按钮
|
|
5046
|
+
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
5047
|
+
crudService && crudService.setData({showFieldsFilter: true});
|
|
5048
|
+
}
|
|
5049
|
+
}
|
|
5050
|
+
`;
|
|
5051
|
+
|
|
5052
|
+
|
|
5053
|
+
function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false, hiddenCount = false, headerToolbarItems, filterVisible = true} = {}){
|
|
5054
|
+
// console.log(`getObjectHeaderToolbar====>`, filterVisible)
|
|
5055
|
+
const isMobile = window.innerWidth < 768;
|
|
5056
|
+
if(isMobile){
|
|
5057
|
+
showDisplayAs = false;
|
|
5058
|
+
}
|
|
5059
|
+
if(formFactor === 'SMALL'){
|
|
5060
|
+
const onReloadScript = `
|
|
5061
|
+
const scope = event.context.scoped;
|
|
5062
|
+
var listView = scope.parent.getComponents().find(function(n){
|
|
5063
|
+
return n.props.type === "crud";
|
|
5064
|
+
});
|
|
5065
|
+
listView.handleChangePage(1);
|
|
5066
|
+
`;
|
|
5067
|
+
return [
|
|
5068
|
+
// "bulkActions",
|
|
5069
|
+
...(headerToolbarItems || []),
|
|
5070
|
+
hiddenCount ? {} :{
|
|
5071
|
+
"type": "tpl",
|
|
5072
|
+
"tpl": "${count} 个项目"
|
|
5073
|
+
},
|
|
5074
|
+
{
|
|
5075
|
+
// "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
|
|
5076
|
+
"type": "button",
|
|
5077
|
+
"align": "right",
|
|
5078
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5079
|
+
"label": "",
|
|
5080
|
+
"icon": "fa fa-sync",
|
|
5081
|
+
"visibleOn": "${!showFieldsFilter}",
|
|
5082
|
+
"onEvent": {
|
|
5083
|
+
"click": {
|
|
5084
|
+
"actions": [
|
|
4617
5085
|
{
|
|
4618
|
-
"
|
|
4619
|
-
"
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
"adaptor": "if (payload.errors) {\n payload.status = 2;\n payload.msg = payload.errors[0].message;\n}\nreturn payload;",
|
|
4644
|
-
}
|
|
4645
|
-
}
|
|
4646
|
-
},
|
|
4647
|
-
{
|
|
4648
|
-
"actionType": "url",
|
|
4649
|
-
"args": {
|
|
4650
|
-
"url": "${context.rootUrl}/app/${appId}/${objectName}/grid/all",
|
|
4651
|
-
"blank": false
|
|
4652
|
-
},
|
|
4653
|
-
"expression": "data.delete == 1"
|
|
4654
|
-
}
|
|
4655
|
-
]
|
|
4656
|
-
}
|
|
4657
|
-
}
|
|
4658
|
-
},
|
|
5086
|
+
"actionType": "custom",
|
|
5087
|
+
"script": onReloadScript
|
|
5088
|
+
}
|
|
5089
|
+
]
|
|
5090
|
+
}
|
|
5091
|
+
},
|
|
5092
|
+
},
|
|
5093
|
+
filterVisible ? {
|
|
5094
|
+
"label": "",
|
|
5095
|
+
"icon": "fa fa-search",
|
|
5096
|
+
"type": "button",
|
|
5097
|
+
"badge": {
|
|
5098
|
+
"offset": [
|
|
5099
|
+
-5,
|
|
5100
|
+
1
|
|
5101
|
+
],
|
|
5102
|
+
"size":8,
|
|
5103
|
+
"animation": true,
|
|
5104
|
+
"visibleOn": "${isFieldsFilterEmpty == false}"
|
|
5105
|
+
},
|
|
5106
|
+
"align": "right",
|
|
5107
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5108
|
+
"onEvent": {
|
|
5109
|
+
"click": {
|
|
5110
|
+
"actions": [
|
|
4659
5111
|
{
|
|
4660
|
-
"
|
|
4661
|
-
"
|
|
4662
|
-
|
|
4663
|
-
},
|
|
4664
|
-
// {
|
|
4665
|
-
// type: 'steedos-object-button',
|
|
4666
|
-
// name: 'standard_delete',
|
|
4667
|
-
// objectName: 'test0321__c',
|
|
4668
|
-
// // visibleOn: getButtonVisibleOn(button),
|
|
4669
|
-
// className: 'antd-Button--default'
|
|
4670
|
-
// }
|
|
5112
|
+
"actionType": "custom",
|
|
5113
|
+
"script": onFieldsFilterToggleScript
|
|
5114
|
+
}
|
|
4671
5115
|
]
|
|
4672
5116
|
}
|
|
4673
|
-
|
|
5117
|
+
}
|
|
5118
|
+
} : {},
|
|
5119
|
+
getDisplayAsButton(mainObject?.name)
|
|
5120
|
+
]
|
|
5121
|
+
}else {
|
|
5122
|
+
return [
|
|
5123
|
+
// "filter-toggler",
|
|
5124
|
+
...(headerToolbarItems || []),
|
|
5125
|
+
"bulkActions",
|
|
5126
|
+
{
|
|
5127
|
+
"type": "columns-toggler",
|
|
5128
|
+
"className": "hidden"
|
|
5129
|
+
},
|
|
5130
|
+
// {
|
|
5131
|
+
// "type": "columns-toggler",
|
|
5132
|
+
// "className": "mr-2"
|
|
5133
|
+
// },
|
|
5134
|
+
hiddenCount ? {} : {
|
|
5135
|
+
"type": "tpl",
|
|
5136
|
+
"tpl": "${count} 个项目"
|
|
5137
|
+
},
|
|
5138
|
+
{
|
|
5139
|
+
"type": "reload",
|
|
5140
|
+
"align": "right",
|
|
5141
|
+
"tooltipPlacement": "bottom",
|
|
5142
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
4674
5143
|
},
|
|
5144
|
+
getExportExcelToolbarButtonSchema(),
|
|
5145
|
+
filterVisible ? {
|
|
5146
|
+
"label": "",
|
|
5147
|
+
"icon": "fa fa-search",
|
|
5148
|
+
"type": "button",
|
|
5149
|
+
"align": "right",
|
|
5150
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5151
|
+
"onEvent": {
|
|
5152
|
+
"click": {
|
|
5153
|
+
"actions": [
|
|
5154
|
+
{
|
|
5155
|
+
"actionType": "custom",
|
|
5156
|
+
"script": onFieldsFilterToggleScript
|
|
5157
|
+
}
|
|
5158
|
+
]
|
|
5159
|
+
}
|
|
5160
|
+
}
|
|
5161
|
+
} : {},
|
|
5162
|
+
getSettingListviewToolbarButtonSchema(),
|
|
4675
5163
|
getDisplayAsButton(showDisplayAs)
|
|
4676
5164
|
// {
|
|
4677
5165
|
// "type": "search-box",
|
|
@@ -5150,20 +5638,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5150
5638
|
}
|
|
5151
5639
|
}
|
|
5152
5640
|
|
|
5153
|
-
var searchableFilter = [];
|
|
5154
|
-
_.each(selfData, (value, key)=>{
|
|
5155
|
-
if(!_.isEmpty(value) || _.isBoolean(value)){
|
|
5156
|
-
if(_.startsWith(key, '__searchable__between__')){
|
|
5157
|
-
searchableFilter.push([\`\${key.replace("__searchable__between__", "")}\`, "between", value])
|
|
5158
|
-
}else if(_.startsWith(key, '__searchable__')){
|
|
5159
|
-
if(_.isString(value)){
|
|
5160
|
-
searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "contains", value])
|
|
5161
|
-
}else{
|
|
5162
|
-
searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "=", value])
|
|
5163
|
-
}
|
|
5164
|
-
}
|
|
5165
|
-
}
|
|
5166
|
-
});
|
|
5641
|
+
var searchableFilter = SteedosUI.getSearchFilter(selfData) || [];
|
|
5167
5642
|
|
|
5168
5643
|
if(searchableFilter.length > 0){
|
|
5169
5644
|
if(filters.length > 0 ){
|
|
@@ -6585,6 +7060,29 @@ if(typeof window != 'undefined'){
|
|
|
6585
7060
|
window.getFieldSearchable = getFieldSearchable;
|
|
6586
7061
|
}
|
|
6587
7062
|
|
|
7063
|
+
|
|
7064
|
+
function isFieldTypeSearchable(fieldType) {
|
|
7065
|
+
return !___default__namespace.includes(
|
|
7066
|
+
[
|
|
7067
|
+
"grid",
|
|
7068
|
+
"avatar",
|
|
7069
|
+
"image",
|
|
7070
|
+
"object",
|
|
7071
|
+
"[object]",
|
|
7072
|
+
"[Object]",
|
|
7073
|
+
"[grid]",
|
|
7074
|
+
"[text]",
|
|
7075
|
+
"audio",
|
|
7076
|
+
"file",
|
|
7077
|
+
],
|
|
7078
|
+
fieldType
|
|
7079
|
+
)
|
|
7080
|
+
}
|
|
7081
|
+
|
|
7082
|
+
if (typeof window != 'undefined') {
|
|
7083
|
+
window.isFieldTypeSearchable = isFieldTypeSearchable;
|
|
7084
|
+
}
|
|
7085
|
+
|
|
6588
7086
|
var index = /*#__PURE__*/Object.freeze({
|
|
6589
7087
|
__proto__: null,
|
|
6590
7088
|
OMIT_FIELDS: OMIT_FIELDS,
|
|
@@ -6596,6 +7094,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
6596
7094
|
getSelectFieldOptions: getSelectFieldOptions,
|
|
6597
7095
|
convertSFieldToAmisField: convertSFieldToAmisField,
|
|
6598
7096
|
getFieldSearchable: getFieldSearchable,
|
|
7097
|
+
isFieldTypeSearchable: isFieldTypeSearchable,
|
|
6599
7098
|
getAmisStaticFieldType: getAmisStaticFieldType
|
|
6600
7099
|
});
|
|
6601
7100
|
|
|
@@ -7207,7 +7706,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
7207
7706
|
id: `service_${id}`,
|
|
7208
7707
|
name: `page`,
|
|
7209
7708
|
data: {
|
|
7210
|
-
|
|
7709
|
+
objectName: objectSchema.name,
|
|
7211
7710
|
// _id: null,
|
|
7212
7711
|
recordPermissions: objectSchema.permissions,
|
|
7213
7712
|
uiSchema: objectSchema,
|
|
@@ -8025,20 +8524,8 @@ async function getTableApi(mainObject, fields, options){
|
|
|
8025
8524
|
}else if(selfData.op === 'loadOptions' && selfData.value){
|
|
8026
8525
|
userFilters = [["${valueField.name}", "=", selfData.value]];
|
|
8027
8526
|
}
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
if(!_.isEmpty(value) || _.isBoolean(value)){
|
|
8031
|
-
if(_.startsWith(key, '__searchable__between__')){
|
|
8032
|
-
searchableFilter.push([\`\${key.replace("__searchable__between__", "")}\`, "between", value])
|
|
8033
|
-
}else if(_.startsWith(key, '__searchable__')){
|
|
8034
|
-
if(_.isString(value)){
|
|
8035
|
-
searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "contains", value])
|
|
8036
|
-
}else{
|
|
8037
|
-
searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "=", value])
|
|
8038
|
-
}
|
|
8039
|
-
}
|
|
8040
|
-
}
|
|
8041
|
-
});
|
|
8527
|
+
|
|
8528
|
+
var searchableFilter = SteedosUI.getSearchFilter(selfData) || [];
|
|
8042
8529
|
|
|
8043
8530
|
if(searchableFilter.length > 0){
|
|
8044
8531
|
if(userFilters.length > 0 ){
|
|
@@ -8309,20 +8796,7 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
8309
8796
|
}else if(selfData.op === 'loadOptions' && selfData.value){
|
|
8310
8797
|
filters = [["${valueField.name}", "=", selfData.value]];
|
|
8311
8798
|
}
|
|
8312
|
-
var searchableFilter = [];
|
|
8313
|
-
_.each(selfData, (value, key)=>{
|
|
8314
|
-
if(!_.isEmpty(value) || _.isBoolean(value)){
|
|
8315
|
-
if(_.startsWith(key, '__searchable__between__')){
|
|
8316
|
-
searchableFilter.push([\`\${key.replace("__searchable__between__", "")}\`, "between", value])
|
|
8317
|
-
}else if(_.startsWith(key, '__searchable__')){
|
|
8318
|
-
if(_.isString(value)){
|
|
8319
|
-
searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "contains", value])
|
|
8320
|
-
}else{
|
|
8321
|
-
searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "=", value])
|
|
8322
|
-
}
|
|
8323
|
-
}
|
|
8324
|
-
}
|
|
8325
|
-
});
|
|
8799
|
+
var searchableFilter = SteedosUI.getSearchFilter(selfData) || [];
|
|
8326
8800
|
|
|
8327
8801
|
if(searchableFilter.length > 0){
|
|
8328
8802
|
if(filters.length > 0 ){
|
|
@@ -8848,7 +9322,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
8848
9322
|
* @Author: baozhoutao@steedos.com
|
|
8849
9323
|
* @Date: 2022-07-05 15:55:39
|
|
8850
9324
|
* @LastEditors: Please set LastEditors
|
|
8851
|
-
* @LastEditTime: 2023-05-
|
|
9325
|
+
* @LastEditTime: 2023-05-17 09:09:33
|
|
8852
9326
|
* @Description:
|
|
8853
9327
|
*/
|
|
8854
9328
|
|
|
@@ -8988,7 +9462,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
8988
9462
|
// } else {
|
|
8989
9463
|
// globalFilter = [`${relatedKey}`, "=", relatedValue];
|
|
8990
9464
|
// }
|
|
8991
|
-
const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel);
|
|
9465
|
+
const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel, ctx);
|
|
8992
9466
|
const componentId = `steedos-record-related-list-${relatedObjectName}`;
|
|
8993
9467
|
const options = {
|
|
8994
9468
|
globalFilter,
|
|
@@ -12637,6 +13111,7 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
|
|
|
12637
13111
|
getObjectListHeaderSecordLine: getObjectListHeaderSecordLine,
|
|
12638
13112
|
getObjectListViewButtonsSchemas: getObjectListViewButtonsSchemas,
|
|
12639
13113
|
getObjectRecordDetailHeader: getObjectRecordDetailHeader,
|
|
13114
|
+
getObjectRecordDetailRelatedListButtonsSchemas: getObjectRecordDetailRelatedListButtonsSchemas,
|
|
12640
13115
|
getObjectRecordDetailRelatedListHeader: getObjectRecordDetailRelatedListHeader,
|
|
12641
13116
|
getObjectRelated: getObjectRelated,
|
|
12642
13117
|
getObjectRelatedList: getObjectRelatedList,
|
|
@@ -13534,11 +14009,12 @@ var AmisRecordService = function (props) { return __awaiter(void 0, void 0, void
|
|
|
13534
14009
|
}); };
|
|
13535
14010
|
|
|
13536
14011
|
var AmisRecordDetailRelatedList = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13537
|
-
var $schema, objectApiName, recordId, relatedObjectApiName, relatedKey, top, perPage, hiddenEmptyTable, appId, relatedLabel, _a, className, columns, sort, filters, visible_on, requestAdaptor, adaptor, formFactor, formData, schema;
|
|
13538
|
-
|
|
13539
|
-
|
|
14012
|
+
var $schema, objectApiName, recordId, relatedObjectApiName, data, relatedKey, top, perPage, hiddenEmptyTable, appId, relatedLabel, _a, className, columns, sort, filters, visible_on, requestAdaptor, adaptor, formFactor, formData, schema;
|
|
14013
|
+
var _b;
|
|
14014
|
+
return __generator(this, function (_c) {
|
|
14015
|
+
switch (_c.label) {
|
|
13540
14016
|
case 0:
|
|
13541
|
-
$schema = props.$schema, objectApiName = props.objectApiName, recordId = props.recordId, relatedObjectApiName = props.relatedObjectApiName, props.data, relatedKey = props.relatedKey, top = props.top, perPage = props.perPage, hiddenEmptyTable = props.hiddenEmptyTable, appId = props.appId, relatedLabel = props.relatedLabel, _a = props.className, className = _a === void 0 ? '' : _a, columns = props.columns, sort = props.sort, filters = props.filters, visible_on = props.visible_on, requestAdaptor = props.requestAdaptor, adaptor = props.adaptor;
|
|
14017
|
+
$schema = props.$schema, objectApiName = props.objectApiName, recordId = props.recordId, relatedObjectApiName = props.relatedObjectApiName, data = props.data, relatedKey = props.relatedKey, top = props.top, perPage = props.perPage, hiddenEmptyTable = props.hiddenEmptyTable, appId = props.appId, relatedLabel = props.relatedLabel, _a = props.className, className = _a === void 0 ? '' : _a, columns = props.columns, sort = props.sort, filters = props.filters, visible_on = props.visible_on, requestAdaptor = props.requestAdaptor, adaptor = props.adaptor;
|
|
13542
14018
|
formFactor = props.formFactor;
|
|
13543
14019
|
if (!formFactor) {
|
|
13544
14020
|
formFactor = window.innerWidth < 768 ? 'SMALL' : 'LARGE';
|
|
@@ -13559,8 +14035,17 @@ var AmisRecordDetailRelatedList = function (props) { return __awaiter(void 0, vo
|
|
|
13559
14035
|
}
|
|
13560
14036
|
return [4 /*yield*/, getRecordDetailRelatedListSchema(objectApiName, recordId, relatedObjectApiName, relatedKey, { top: top, perPage: perPage, appId: appId, relatedLabel: relatedLabel, className: className, formFactor: formFactor, columns: columns, sort: sort, filters: filters, visible_on: visible_on, isRelated: true, hiddenEmptyTable: hiddenEmptyTable, requestAdaptor: requestAdaptor, adaptor: adaptor })];
|
|
13561
14037
|
case 1:
|
|
13562
|
-
schema = (
|
|
14038
|
+
schema = (_c.sent()).amisSchema;
|
|
13563
14039
|
schema.data = Object.assign(schema.data, formData);
|
|
14040
|
+
if (___default.has(props, "recordId") && $schema.recordId !== "${recordId}") {
|
|
14041
|
+
schema.data = Object.assign(schema.data, {
|
|
14042
|
+
_master: {
|
|
14043
|
+
record: (_b = data === null || data === void 0 ? void 0 : data._master) === null || _b === void 0 ? void 0 : _b.record,
|
|
14044
|
+
objectName: objectApiName,
|
|
14045
|
+
recordId: recordId
|
|
14046
|
+
}
|
|
14047
|
+
});
|
|
14048
|
+
}
|
|
13564
14049
|
return [2 /*return*/, schema];
|
|
13565
14050
|
}
|
|
13566
14051
|
});
|
|
@@ -14232,7 +14717,16 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
14232
14717
|
},
|
|
14233
14718
|
"adaptor": "return payload.data"
|
|
14234
14719
|
},
|
|
14235
|
-
"
|
|
14720
|
+
"onEvent": {
|
|
14721
|
+
"@data.changed.notifications": {
|
|
14722
|
+
"actions": [
|
|
14723
|
+
{
|
|
14724
|
+
"actionType": "reload"
|
|
14725
|
+
}
|
|
14726
|
+
]
|
|
14727
|
+
}
|
|
14728
|
+
},
|
|
14729
|
+
// "interval": 30000,
|
|
14236
14730
|
"silentPolling": true
|
|
14237
14731
|
}
|
|
14238
14732
|
],
|
|
@@ -14320,6 +14814,15 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
14320
14814
|
},
|
|
14321
14815
|
],
|
|
14322
14816
|
"id": "u:aba521eed5b7",
|
|
14817
|
+
"onEvent": {
|
|
14818
|
+
"@data.changed.notifications": {
|
|
14819
|
+
"actions": [
|
|
14820
|
+
{
|
|
14821
|
+
"actionType": "reload"
|
|
14822
|
+
}
|
|
14823
|
+
]
|
|
14824
|
+
}
|
|
14825
|
+
},
|
|
14323
14826
|
"messages": {},
|
|
14324
14827
|
"api": {
|
|
14325
14828
|
"method": "post",
|
|
@@ -14478,8 +14981,8 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
14478
14981
|
/*
|
|
14479
14982
|
* @Author: baozhoutao@steedos.com
|
|
14480
14983
|
* @Date: 2022-09-01 14:44:57
|
|
14481
|
-
* @LastEditors:
|
|
14482
|
-
* @LastEditTime: 2023-
|
|
14984
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
14985
|
+
* @LastEditTime: 2023-05-17 17:26:22
|
|
14483
14986
|
* @Description:
|
|
14484
14987
|
*/
|
|
14485
14988
|
var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -14500,8 +15003,17 @@ var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void
|
|
|
14500
15003
|
"className": 'flex w-full px-4 h-[50px] p-0 justify-between items-center steedos-header-container-line-one',
|
|
14501
15004
|
"body": [
|
|
14502
15005
|
{
|
|
14503
|
-
type: "
|
|
15006
|
+
type: "service",
|
|
14504
15007
|
className: 'p-0 flex flex-1 items-center',
|
|
15008
|
+
"onEvent": {
|
|
15009
|
+
"@history_paths.changed": {
|
|
15010
|
+
"actions": [
|
|
15011
|
+
{
|
|
15012
|
+
"actionType": "reload"
|
|
15013
|
+
}
|
|
15014
|
+
]
|
|
15015
|
+
}
|
|
15016
|
+
},
|
|
14505
15017
|
body: [
|
|
14506
15018
|
{
|
|
14507
15019
|
"type": "button",
|
|
@@ -14528,10 +15040,35 @@ var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void
|
|
|
14528
15040
|
}
|
|
14529
15041
|
],
|
|
14530
15042
|
},
|
|
15043
|
+
{
|
|
15044
|
+
"type": "button",
|
|
15045
|
+
"visibleOn": "${window:innerWidth < 768 && window:historyPaths.length > 1}",
|
|
15046
|
+
"className": "flex",
|
|
15047
|
+
"onEvent": {
|
|
15048
|
+
"click": {
|
|
15049
|
+
"actions": [
|
|
15050
|
+
{
|
|
15051
|
+
"actionType": "custom",
|
|
15052
|
+
"script": "Steedos.goBack()"
|
|
15053
|
+
}
|
|
15054
|
+
]
|
|
15055
|
+
}
|
|
15056
|
+
},
|
|
15057
|
+
"body": [
|
|
15058
|
+
{
|
|
15059
|
+
"type": "steedos-icon",
|
|
15060
|
+
"category": "utility",
|
|
15061
|
+
"name": "chevronleft",
|
|
15062
|
+
"colorVariant": "default",
|
|
15063
|
+
"className": "slds-button_icon slds-global-header__icon"
|
|
15064
|
+
}
|
|
15065
|
+
]
|
|
15066
|
+
},
|
|
14531
15067
|
{
|
|
14532
15068
|
"className": 'block h-10 w-auto mr-4',
|
|
14533
15069
|
"type": "tpl",
|
|
14534
15070
|
"tpl": "<a href='/app' class='flex items-center '><img class='block h-10 w-auto' src='".concat(logoSrc, "'></a>"),
|
|
15071
|
+
"hiddenOn": "${window:innerWidth < 768 && window:historyPaths.length > 1}"
|
|
14535
15072
|
},
|
|
14536
15073
|
],
|
|
14537
15074
|
},
|
|
@@ -14750,6 +15287,7 @@ var getSelectFlowSchema = function (id, props) {
|
|
|
14750
15287
|
"method": "post",
|
|
14751
15288
|
"url": "${context.rootUrl}/graphql?keywords=${keywords}",
|
|
14752
15289
|
"requestAdaptor": "\n const keywords = api.body.keywords || '';\n const appId = '".concat(data.app_id || '', "';\n api.data = {\n query: `\n {\n options: flows__getList(action: \"").concat(action, "\", keywords: \"${keywords}\", appId: \"${appId}\", distributeInstanceId: \"").concat(distributeInstanceId, "\", distributeStepId: \"").concat(distributeStepId, "\"){\n value:_id\n label:name\n children: flows{\n value: _id,\n label: name\n }\n }\n }\n `\n }\n "),
|
|
15290
|
+
"adaptor": "\n payload.data.options?.forEach(function(item,index) {\n if(!item.children || item.children.length == 0){\n payload.data.options.splice(index)\n }\n })\n return payload;\n ",
|
|
14753
15291
|
"headers": {
|
|
14754
15292
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
14755
15293
|
}
|
|
@@ -14993,7 +15531,7 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
14993
15531
|
});
|
|
14994
15532
|
}); };
|
|
14995
15533
|
|
|
14996
|
-
var __assign=function(){return (__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},StandardObjects={Base:{Actions:{standard_query:{visible:function(e,t,n){return !1}},standard_new:{visible:function(e,t,n){return "cms_files"!==e&&"instances"!==e&&(n?n.allowCreate:void 0)}},standard_edit:{visible:function(e,t,n){if(n)return n.allowEdit}},standard_delete:{visible:function(e,t,n){if(n)return n.allowDelete}},standard_import_data:{visible:function(e,t,n){var r=this.object;if(n)return n.allowCreate&&r.hasImportTemplates}},standard_approve:{visible:function(e,t,n){return !1}},standard_view_instance:{visible:function(e,t,n){return !1}},standard_submit_for_approval:{visible:function(e,t,n){return window.Steedos.ProcessManager.allowSubmit.apply(this,[e,t])},todo:function(e,t){return window.Steedos.ProcessManager.submit.apply(this,[e,t])}},standard_follow:{visible:function(e,t,n){return !1}},standard_delete_many:{visible:function(e,t,n){return !RegExp("\\w+/view/\\w+").test(location.pathname)&&(n?n.allowDelete:void 0)}}}}},authRequest=function(e,t){var i=null;e=Steedos.absoluteUrl(e);try{var n=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],r={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(n&&n.length)return n.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){i=e;},error:function(e,t,n){var r,o;e.responseJSON&&e.responseJSON.error?(r=e.responseJSON.error,o=void(i={error:r}),o=r.reason||r.message||r,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},r,t)),i}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,r=arguments[t];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);}return e}).apply(this,arguments)}const newFunctionComponent=o=>e=>{const[t,n]=React.useState(!0);var r=()=>{n(!1);};return ___default.has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{n(!0);},close:r}),React__default["default"].createElement(o,_extends({visible:t,onCancel:r,onClose:r},{width:"70%",style:{width:"70%",maxWidth:"950px",minWidth:"480px"}},e))},newComponentRender=(n,r)=>(e,t)=>{e.name||(e.name=n+"-"+(e.name||"default")),(t=t||document.getElementById(`steedos-${n}-root-`+e.name))||((t=document.createElement("div")).setAttribute("id",`steedos-${n}-root-`+e.name),document.body.appendChild(t));e=React__default["default"].createElement(newFunctionComponent(r),e);ReactDOM.createRoot(t).render(e);},Modal=___default.assign(newComponentRender("modal",antd.Modal),{info:antd.Modal.info,success:antd.Modal.success,error:antd.Modal.error,warning:antd.Modal.warning,confirm:antd.Modal.confirm}),Drawer=newComponentRender("drawer",antd.Drawer),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),___default.each(e,e=>{-1<e.indexOf(".")&&(e=e.split(".")[0]),t.push(""+e);}),""+t.join(" ")},getFindOneQuery=(e,t,n)=>{e=e.replace(/\./g,"_");n=getGraphqlFieldsQuery(n);let r="";t=[`id: "${t}"`];return `{record:${e}__findOne${r=0<t.length?`(${t.join(",")})`:r}{${n}}}`},SObject={getRecord:async(e,t,n)=>{return (await fetchAPI("/graphql",{method:"post",body:JSON.stringify({query:getFindOneQuery(e,t,n)})})).data.record},getUISchema:async(e,t)=>getUISchema(e,t)},canSaveFilter=e=>!(!e._id||e.owner!==getSteedosAuth()?.userId),ListView={showFilter:(e,{listView:t,data:n})=>{canSaveFilter(t);n.filters&&(n.filters=filtersToConditions(n.filters));},getVisibleFilter:(e,t)=>{return t||(canSaveFilter(e)?e.filters:void 0)},getQueryFilter:(e,t)=>{return canSaveFilter(e)?ListView.getVisibleFilter(e,t):___default.isEmpty(t)?e.filters:[e.filters,"and",t]},getFirstListView:async e=>{e=await window.getUISchema(e);return _.first(_.sortBy(_.values(e.list_views),"sort_no"))}},Router={getAppPath({appId:e}){return "/app/"+e},getPagePath(){},getObjectListViewPath({appId:e,objectName:t,listViewName:n}){return `/app/${e}/${t}/grid/`+n},getObjectDetailPath({appId:e,objectName:t,recordId:n}){return `/app/${e}/${t}/view/`+n},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:n,objectName:r,foreignKey:o}){return `/app/${e}/${t}/${n}/${r}/grid?related_field_name=`+o}};var withModalWrap=function(t,e){return function(e){return React.createElement(t,e)}},render=function(e,t,n,r){e=withModalWrap(e),e=React.createElement(e,__assign({},t));return ReactDOM__default["default"].render(e,n)};const safeRunFunction=(t,n,r,o)=>{try{var i=window.Creator;if(!!(!i||!i.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return ___default.isNil(n)||(e=___default.isArray(n)?n:[n]),t.bind(o||{})(...e)}catch(e){return console.log(e),r}};function safeEval(js){try{return eval(js)}catch(e){console.error(e,js);}}const isExpression=function(e){var t,n;return "string"==typeof e&&(t=/^{{(function.+)}}$/,n=/^{{(.+=>.+)}}$/,!("string"!=typeof e||!e.match(/^{{(.+)}}$/)||e.match(t)||e.match(n)))},parseSingleExpression=function(t,e,n,r){var o,i=function(e,t){return "#"!==t&&t?"string"==typeof t?_.get(e,t):void console.error("path has to be a string"):e||{}}(e=void 0===e?{}:e,function(e){return "string"!=typeof e||1===(e=e.split(".")).length?"#":(e.pop(),e.join("."))}(n))||{};if("string"!=typeof t)return t;o="__G_L_O_B_A_L__",e="\n return "+t.substring(2,t.length-2).replace(/\bformData\b/g,JSON.stringify(e).replace(/\bglobal\b/g,o)).replace(/\bglobal\b/g,JSON.stringify(r)).replace(new RegExp("\\b"+o+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(i));try{return Function(e)()}catch(e){return console.log(e,t,n),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,parseSingleExpression:parseSingleExpression});const getCompatibleDefaultValueExpression=(e,t)=>{let n=e;return /^\{\w+(\.*\w+)*\}$/.test(e)&&(n=-1<e.indexOf("userId")||-1<e.indexOf("spaceId")||-1<e.indexOf("user.")||-1<e.indexOf("now")?`{${e}}`.replace("{{","{{global."):`{${e}}`.replace("{{","{{formData."),t&&(n=n.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),n},getFieldDefaultValue=(e,t)=>{if(!e)return null;let n=e.defaultValue;e._defaultValue&&(n=safeEval(`(${e._defaultValue})`)),___default.isFunction(n)&&(n=safeRunFunction(n,[],null,{name:e.name})),___default.isString(n)&&(n=getCompatibleDefaultValueExpression(n,e.multiple));var r=isExpression(n);return r&&(n=parseSingleExpression(n,{},"#",t)),"select"===e.type&&(t=e.data_type||"text",!n||r||e.multiple||("text"!==t||___default.isString(n)?"number"!==t||___default.isNumber(n)?"boolean"!==t||___default.isBoolean(n)||(n="true"===n):n=Number(n):n=String(n))),n};function getTreeOptions(t,e){const o=e?.valueField||"value";e?.labelField;const n=e?.unfoldedNum||1,r=[],i=(t,n,r)=>{var e;if(n)return e=_.filter(t,e=>_.includes(n,e[o])),_.each(e,e=>{1<=r?(e.unfolded=!0,e.children&&(e.children=i(t,e.children,r-1))):e.children&&(e.children=i(t,e.children,r));}),e};for(var a=t,s=0;s<a.length;s++)if(a[s].noParent=0,a[s].unfolded=!1,a[s].parent){let e=1;for(var l=0;l<a.length;l++)a[s].parent==a[l][o]&&(e=0);1==e&&(a[s].noParent=1);}else a[s].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=n?(e.unfolded=!0,r.push(Object.assign({},e,{children:i(t,e.children,n-1)}))):r.push(Object.assign({},e,{children:i(t,e.children,n)})));}),r}function getClosestAmisComponentByType(t,n,r){let o=(r=r||{}).name;var e=r.direction||"up";let i=t.getComponents().find(function(e){return e.props.type===n&&(!o||e.props.name===o)});if(i)return i;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(i=getClosestAmisComponentByType(t.children[e],n,r));e++);return i}}else if("up"===e&&t.parent)return getClosestAmisComponentByType(t.parent,n,r)}function isFilterFormValuesEmpty(e){let t=!0;var e=_.pickBy(e,function(e,t){return /^__searchable__/g.test(t)});return _.isEmpty(e)||(e=_.omitBy(e,function(e){return _.isNil(e)||_.isObject(e)&&_.isEmpty(e)||_.isArray(e)&&_.isEmpty(e.filter(function(e){return !_.isNil(e)}))||_.isString(e)&&0===e.length}),_.isEmpty(e)||(t=!1)),t}const SteedosUI$1=Object.assign({},{render:render,Router:Router,ListView:ListView,Object:SObject,Modal:Modal,Drawer:Drawer,refs:{},getRef(e){return SteedosUI$1.refs[e]},router:{go:(e,t)=>{var n=window.FlowRouter;if(t)return n?n.go(t):window.open(t);n?n.reload():console.warn("暂不支持自动跳转",e);},reload:()=>{console.log("reload");}},message:antd.message,notification:antd.notification,components:{Button:antd.Button,Space:antd.Space},getRefId:({type:e,appId:t,name:n})=>{switch(e){case"listview":return `amis-${t}-${n}-listview`;case"form":return `amis-${t}-${n}-form`;case"detail":return `amis-${t}-${n}-detail`;default:return `amis-${t}-${n}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType,isFilterFormValuesEmpty:isFilterFormValuesEmpty});var getBuilderContext=function(){return "undefined"==typeof window?{}:Builder.settings.context||Builder.settings},Steedos$1=__assign({getRootUrl:function(e){var t=getBuilderContext();return t.rootUrl||("undefined"!=typeof window?window.localStorage.getItem("steedos:rootUrl"):"")||e},absoluteUrl:function(e){return void 0===e&&(e=""),"".concat(Steedos$1.getRootUrl()).concat(e)},getTenantId:function(){try{var e=getBuilderContext().tenantId;return (e=window.location.search&&!e?new URLSearchParams(window.location.search).get("X-Space-Id"):e)?e:null}catch(e){console.error(e);}},getAuthorization:function(){try{var e=getBuilderContext(),t=e.tenantId,n=e.authToken;return t&&n?"Bearer ".concat(t,",").concat(n):null}catch(e){console.error(e);}},authRequest:authRequest,StandardObjects:StandardObjects},Expression);"undefined"==typeof window||window.Steedos||(window.Steedos=Steedos$1),"undefined"==typeof window||window.SteedosUI||(window.SteedosUI=SteedosUI$1);
|
|
15534
|
+
var __assign=function(){return (__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},StandardObjects={Base:{Actions:{standard_query:{visible:function(e,t,r){return !1}},standard_new:{visible:function(e,t,r){return "cms_files"!==e&&"instances"!==e&&(r?r.allowCreate:void 0)}},standard_edit:{visible:function(e,t,r){if(r)return r.allowEdit}},standard_delete:{visible:function(e,t,r){if(r)return r.allowDelete}},standard_import_data:{visible:function(e,t,r){var n=this.object;if(r)return r.allowCreate&&n.hasImportTemplates}},standard_approve:{visible:function(e,t,r){return !1}},standard_view_instance:{visible:function(e,t,r){return !1}},standard_submit_for_approval:{visible:function(e,t,r){return window.Steedos.ProcessManager.allowSubmit.apply(this,[e,t])},todo:function(e,t){return window.Steedos.ProcessManager.submit.apply(this,[e,t])}},standard_follow:{visible:function(e,t,r){return !1}},standard_delete_many:{visible:function(e,t,r){return !RegExp("\\w+/view/\\w+").test(location.pathname)&&(r?r.allowDelete:void 0)}}}}},authRequest=function(e,t){var i=null;e=Steedos.absoluteUrl(e);try{var r=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],n={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(r&&r.length)return r.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){i=e;},error:function(e,t,r){var n,o;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,o=void(i={error:n}),o=n.reason||n.message||n,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),i}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}const newFunctionComponent=o=>e=>{const[t,r]=React.useState(!0);var n=()=>{r(!1);};return ___default.has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React__default["default"].createElement(o,_extends({visible:t,onCancel:n,onClose:n},{width:"70%",style:{width:"70%",maxWidth:"950px",minWidth:"480px"}},e))},newComponentRender=(r,n)=>(e,t)=>{e.name||(e.name=r+"-"+(e.name||"default")),(t=t||document.getElementById(`steedos-${r}-root-`+e.name))||((t=document.createElement("div")).setAttribute("id",`steedos-${r}-root-`+e.name),document.body.appendChild(t));e=React__default["default"].createElement(newFunctionComponent(n),e);ReactDOM.createRoot(t).render(e);},Modal=___default.assign(newComponentRender("modal",antd.Modal),{info:antd.Modal.info,success:antd.Modal.success,error:antd.Modal.error,warning:antd.Modal.warning,confirm:antd.Modal.confirm}),Drawer=newComponentRender("drawer",antd.Drawer),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),___default.each(e,e=>{-1<e.indexOf(".")&&(e=e.split(".")[0]),t.push(""+e);}),""+t.join(" ")},getFindOneQuery=(e,t,r)=>{e=e.replace(/\./g,"_");r=getGraphqlFieldsQuery(r);let n="";t=[`id: "${t}"`];return `{record:${e}__findOne${n=0<t.length?`(${t.join(",")})`:n}{${r}}}`},SObject={getRecord:async(e,t,r)=>{return (await fetchAPI("/graphql",{method:"post",body:JSON.stringify({query:getFindOneQuery(e,t,r)})})).data.record},getUISchema:async(e,t)=>getUISchema(e,t)},canSaveFilter=e=>!(!e._id||e.owner!==getSteedosAuth()?.userId),ListView={showFilter:(e,{listView:t,data:r})=>{canSaveFilter(t);r.filters&&(r.filters=filtersToConditions(r.filters));},getVisibleFilter:(e,t)=>{return t||(canSaveFilter(e)?e.filters:void 0)},getQueryFilter:(e,t)=>{return canSaveFilter(e)?ListView.getVisibleFilter(e,t):___default.isEmpty(t)?e.filters:[e.filters,"and",t]},getFirstListView:async e=>{e=await window.getUISchema(e);return _.first(_.sortBy(_.values(e.list_views),"sort_no"))}},Router={getAppPath({appId:e}){return "/app/"+e},getPagePath(){},getObjectListViewPath({appId:e,objectName:t,listViewName:r}){return `/app/${e}/${t}/grid/`+r},getObjectDetailPath({appId:e,objectName:t,recordId:r}){return `/app/${e}/${t}/view/`+r},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:r,objectName:n,foreignKey:o}){return `/app/${e}/${t}/${r}/${n}/grid?related_field_name=`+o}};var withModalWrap=function(t,e){return function(e){return React.createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=React.createElement(e,__assign({},t));return ReactDOM__default["default"].render(e,r)};const safeRunFunction=(t,r,n,o)=>{try{var i=window.Creator;if(!!(!i||!i.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return ___default.isNil(r)||(e=___default.isArray(r)?r:[r]),t.bind(o||{})(...e)}catch(e){return console.log(e),n}};function safeEval(js){try{return eval(js)}catch(e){console.error(e,js);}}const isExpression=function(e){var t,r;return "string"==typeof e&&(t=/^{{(function.+)}}$/,r=/^{{(.+=>.+)}}$/,!("string"!=typeof e||!e.match(/^{{(.+)}}$/)||e.match(t)||e.match(r)))},parseSingleExpression=function(t,e,r,n){var o,i=function(e,t){return "#"!==t&&t?"string"==typeof t?_.get(e,t):void console.error("path has to be a string"):e||{}}(e=void 0===e?{}:e,function(e){return "string"!=typeof e||1===(e=e.split(".")).length?"#":(e.pop(),e.join("."))}(r))||{};if("string"!=typeof t)return t;o="__G_L_O_B_A_L__",e="\n return "+t.substring(2,t.length-2).replace(/\bformData\b/g,JSON.stringify(e).replace(/\bglobal\b/g,o)).replace(/\bglobal\b/g,JSON.stringify(n)).replace(new RegExp("\\b"+o+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(i));try{return Function(e)()}catch(e){return console.log(e,t,r),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,parseSingleExpression:parseSingleExpression});const getCompatibleDefaultValueExpression=(e,t)=>{let r=e;return /^\{\w+(\.*\w+)*\}$/.test(e)&&(r=-1<e.indexOf("userId")||-1<e.indexOf("spaceId")||-1<e.indexOf("user.")||-1<e.indexOf("now")?`{${e}}`.replace("{{","{{global."):`{${e}}`.replace("{{","{{formData."),t&&(r=r.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),r},getFieldDefaultValue=(e,t)=>{if(!e)return null;let r=e.defaultValue;e._defaultValue&&(r=safeEval(`(${e._defaultValue})`)),___default.isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),___default.isString(r)&&(r=getCompatibleDefaultValueExpression(r,e.multiple));var n=isExpression(r);return n&&(r=parseSingleExpression(r,{},"#",t)),"select"===e.type&&(t=e.data_type||"text",!r||n||e.multiple||("text"!==t||___default.isString(r)?"number"!==t||___default.isNumber(r)?"boolean"!==t||___default.isBoolean(r)||(r="true"===r):r=Number(r):r=String(r))),r};function getTreeOptions(t,e){const o=e?.valueField||"value";e?.labelField;const r=e?.unfoldedNum||1,n=[],i=(t,r,n)=>{var e;if(r)return e=_.filter(t,e=>_.includes(r,e[o])),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=i(t,e.children,n-1))):e.children&&(e.children=i(t,e.children,n));}),e};for(var a=t,s=0;s<a.length;s++)if(a[s].noParent=0,a[s].unfolded=!1,a[s].parent){let e=1;for(var l=0;l<a.length;l++)a[s].parent==a[l][o]&&(e=0);1==e&&(a[s].noParent=1);}else a[s].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=r?(e.unfolded=!0,n.push(Object.assign({},e,{children:i(t,e.children,r-1)}))):n.push(Object.assign({},e,{children:i(t,e.children,r)})));}),n}function getClosestAmisComponentByType(t,r,n){let o=(n=n||{}).name;var e=n.direction||"up";let i=t.getComponents().find(function(e){return e.props.type===r&&(!o||e.props.name===o)});if(i)return i;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(i=getClosestAmisComponentByType(t.children[e],r,n));e++);return i}}else if("up"===e&&t.parent)return getClosestAmisComponentByType(t.parent,r,n)}function isFilterFormValuesEmpty(e){let t=!0;var e=_.pickBy(e,function(e,t){return /^__searchable__/g.test(t)});return _.isEmpty(e)||(e=_.omitBy(e,function(e){return _.isNil(e)||_.isObject(e)&&_.isEmpty(e)||_.isArray(e)&&_.isEmpty(e.filter(function(e){return !_.isNil(e)}))||_.isString(e)&&0===e.length}),_.isEmpty(e)||(t=!1)),t}const SteedosUI$1=Object.assign({},{render:render,Router:Router,ListView:ListView,Object:SObject,Modal:Modal,Drawer:Drawer,refs:{},getRef(e){return SteedosUI$1.refs[e]},router:{go:(e,t)=>{var r=window.FlowRouter;if(t)return r?r.go(t):window.open(t);r?r.reload():console.warn("暂不支持自动跳转",e);},reload:()=>{console.log("reload");}},message:antd.message,notification:antd.notification,components:{Button:antd.Button,Space:antd.Space},getRefId:({type:e,appId:t,name:r})=>{switch(e){case"listview":return `amis-${t}-${r}-listview`;case"form":return `amis-${t}-${r}-form`;case"detail":return `amis-${t}-${r}-detail`;default:return `amis-${t}-${r}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType,isFilterFormValuesEmpty:isFilterFormValuesEmpty,getSearchFilter:e=>{var r=[];return _.each(e,(e,t)=>{_.isEmpty(e)&&!_.isBoolean(e)||(_.startsWith(t,"__searchable__between__")?r.push([""+t.replace("__searchable__between__",""),"between",e]):_.startsWith(t,"__searchable__")&&(_.isString(e)?r.push([""+t.replace("__searchable__",""),"contains",e]):r.push([""+t.replace("__searchable__",""),"=",e])));}),r}});var getBuilderContext=function(){return "undefined"==typeof window?{}:Builder.settings.context||Builder.settings},Steedos$1=__assign({getRootUrl:function(e){var t=getBuilderContext();return t.rootUrl||("undefined"!=typeof window?window.localStorage.getItem("steedos:rootUrl"):"")||e},absoluteUrl:function(e){return void 0===e&&(e=""),"".concat(Steedos$1.getRootUrl()).concat(e)},getTenantId:function(){try{var e=getBuilderContext().tenantId;return (e=window.location.search&&!e?new URLSearchParams(window.location.search).get("X-Space-Id"):e)?e:null}catch(e){console.error(e);}},getAuthorization:function(){try{var e=getBuilderContext(),t=e.tenantId,r=e.authToken;return t&&r?"Bearer ".concat(t,",").concat(r):null}catch(e){console.error(e);}},authRequest:authRequest,StandardObjects:StandardObjects},Expression);"undefined"==typeof window||window.Steedos||(window.Steedos=Steedos$1),"undefined"==typeof window||window.SteedosUI||(window.SteedosUI=SteedosUI$1);
|
|
14997
15535
|
|
|
14998
15536
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
14999
15537
|
__proto__: null,
|