@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.
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useEffect, createElement } from 'react';
2
2
  import * as ___default from 'lodash';
3
- import ___default__default, { isEmpty, isArray, each, find, endsWith, cloneDeep, map, includes, toArray, mergeWith, isString, union, has, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, filter, get, forEach, isBoolean, omitBy, isNil, startsWith, isFunction, compact, difference, keys, pick, first, values, pickBy, random, assign, isNumber } from 'lodash';
3
+ import ___default__default, { isEmpty, isArray, each, find, endsWith, cloneDeep, includes, toArray, mergeWith, isString, union, has, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, map, filter, get, forEach, isBoolean, omitBy, isNil, startsWith, isFunction, compact, difference, keys, pick, first, values, pickBy, random, assign, isNumber } from 'lodash';
4
4
  import { Dropdown, Tabs, Spin, Badge, Skeleton, Modal as Modal$1, message, notification, Button, Space, Drawer as Drawer$1 } from 'antd';
5
5
  import ReactDOM, { createRoot } from 'react-dom';
6
6
 
@@ -2597,7 +2597,7 @@ const getListViewItemButtons = async (uiSchema, ctx)=>{
2597
2597
  return listButtons;
2598
2598
  };
2599
2599
 
2600
- const getObjectRelatedListButtons = async (uiSchema, ctx)=>{
2600
+ const getObjectRelatedListButtons = (uiSchema, ctx)=>{
2601
2601
  // const buttons = getButtons(uiSchema, ctx);
2602
2602
  // const relatedListButtons = _.filter(buttons, (button) => {
2603
2603
  // if(button.objectName === 'cms_files'){
@@ -2884,6 +2884,67 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
2884
2884
  }
2885
2885
  };
2886
2886
 
2887
+ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
2888
+ const buttons = getObjectRelatedListButtons(objectSchema, ctx);
2889
+ if(ctx.formFactor === 'SMALL'){
2890
+ return {
2891
+ "type": "button",
2892
+ "icon": "fa fa-angle-down",
2893
+ "onEvent": {
2894
+ "click": {
2895
+ "actions": [
2896
+ {
2897
+ "actionType": "drawer",
2898
+ "drawer": {
2899
+ "type": "drawer",
2900
+ "title": "操作",
2901
+ "body": [
2902
+ {
2903
+ "type": "button-group",
2904
+ "vertical": true,
2905
+ "tiled": true,
2906
+ "buttons": [
2907
+ ...___default__default.map(buttons, (button)=>{
2908
+ return {
2909
+ type: 'steedos-object-button',
2910
+ name: button.name,
2911
+ objectName: button.objectName,
2912
+ visibleOn: getButtonVisibleOn$1(button),
2913
+ className: `button_${button.name} w-full`
2914
+ }
2915
+ })
2916
+ ],
2917
+ "btnLevel": "enhance",
2918
+ "className": "w-full",
2919
+ "btnClassName": "w-full",
2920
+ "size": "lg"
2921
+ }
2922
+ ],
2923
+ "position": "bottom",
2924
+ "closeOnOutside": true,
2925
+ "resizable": false,
2926
+ "className": "buttons-drawer",
2927
+ "bodyClassName": "m-none p-none",
2928
+ "actions": []
2929
+ }
2930
+ }
2931
+ ]
2932
+ }
2933
+ }
2934
+ }
2935
+ }else {
2936
+ return ___default__default.map(buttons, (button) => {
2937
+ return {
2938
+ type: 'steedos-object-button',
2939
+ name: button.name,
2940
+ objectName: button.objectName,
2941
+ visibleOn: getButtonVisibleOn$1(button),
2942
+ className: `button_${button.name}`
2943
+ }
2944
+ });
2945
+ }
2946
+ };
2947
+
2887
2948
  async function getObjectFieldsFilterButtonSchema(objectSchema) {
2888
2949
  // const amisListViewId = `listview_${objectSchema.name}`;
2889
2950
  return {
@@ -2936,11 +2997,11 @@ async function getObjectFieldsFilterFormSchema(ctx) {
2936
2997
  payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
2937
2998
  }
2938
2999
  const selfData = api.body.$self;
2939
- const filterFormSearchableFields = selfData.filterFormSearchableFields;
2940
3000
  const uiSchema = selfData.uiSchema;
2941
3001
  const fields = uiSchema.fields;
2942
- const searchableFields = [];
2943
-
3002
+ const filterFormSearchableFields = (selfData.filterFormSearchableFields || []).filter(function(item){
3003
+ return !!fields[item]
3004
+ });
2944
3005
  const resolveAll = function(values){
2945
3006
  payload.data = {
2946
3007
  "body": values
@@ -2955,21 +3016,7 @@ async function getObjectFieldsFilterFormSchema(ctx) {
2955
3016
  return Promise.all(filterFormSearchableFields.map(function (item) {
2956
3017
  const field = _.clone(fields[item]);
2957
3018
  if (
2958
- field && !_.includes(
2959
- [
2960
- "grid",
2961
- "avatar",
2962
- "image",
2963
- "object",
2964
- "[object]",
2965
- "[Object]",
2966
- "[grid]",
2967
- "[text]",
2968
- "audio",
2969
- "file",
2970
- ],
2971
- field.type
2972
- )
3019
+ field && window.isFieldTypeSearchable(field.type)
2973
3020
  ) {
2974
3021
  delete field.defaultValue;
2975
3022
  delete field.required;
@@ -3066,6 +3113,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3066
3113
  }
3067
3114
  }
3068
3115
  }
3116
+ filterForm.reset();
3069
3117
  listView.handleFilterSubmit(removedValues);
3070
3118
  const filterService = filterForm.context.getComponents().find(function(n){
3071
3119
  return n.props.type === "service";
@@ -3328,9 +3376,27 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3328
3376
  "headers": {
3329
3377
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
3330
3378
  },
3331
- "data": null,
3379
+ "data": {
3380
+ "$self": "$$"
3381
+ },
3332
3382
  "requestAdaptor": "",
3333
- "adaptor": ""
3383
+ "adaptor": `
3384
+ if(payload.errors){
3385
+ payload.status = 2;
3386
+ payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
3387
+ }
3388
+ const selfData = api.body.$self;
3389
+ const uiSchema = selfData.uiSchema;
3390
+ const fields = uiSchema.fields;
3391
+ const options = (payload.data?.options || []).filter(function(item){
3392
+ let field = fields[item.value];
3393
+ return !!field && window.isFieldTypeSearchable(field.type)
3394
+ });
3395
+ payload.data = {
3396
+ "options": options
3397
+ };
3398
+ return payload;
3399
+ `
3334
3400
  },
3335
3401
  "options": [],
3336
3402
  "required": true,
@@ -3493,6 +3559,7 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
3493
3559
  "rightIcon": "fa fa-caret-down",
3494
3560
  "size": "sm",
3495
3561
  "hideCaret": true,
3562
+ "closeOnClick": true,
3496
3563
  "btnClassName": "!bg-transparent !border-none !hover:border-none text-lg h-5 font-bold p-0 text-black leading-none",
3497
3564
  "buttons": listViewButtonOptions
3498
3565
  }
@@ -3677,12 +3744,47 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
3677
3744
  "type": "grid",
3678
3745
  "columns": [
3679
3746
  {
3680
- "body": {
3747
+ "body": [{
3748
+ "type": "service",
3749
+ "onEvent": {
3750
+ "@history_paths.changed": {
3751
+ "actions": [
3752
+ {
3753
+ "actionType": "reload"
3754
+ }
3755
+ ]
3756
+ }
3757
+ },
3758
+ "body":[{
3759
+ "type": "button",
3760
+ "visibleOn": "${window:innerWidth > 768 && window:historyPaths.length > 1}",
3761
+ "className":"flex mr-2",
3762
+ "onEvent": {
3763
+ "click": {
3764
+ "actions": [
3765
+ {
3766
+ "actionType": "custom",
3767
+ "script": "Steedos.goBack()"
3768
+ }
3769
+ ]
3770
+ }
3771
+ },
3772
+ "body": [
3773
+ {
3774
+ "type": "steedos-icon",
3775
+ "category": "utility",
3776
+ "name": "back",
3777
+ "colorVariant": "default",
3778
+ "className": "slds-button_icon slds-global-header__icon"
3779
+ }
3780
+ ]
3781
+ }]
3782
+ },{
3681
3783
  "type": "tpl",
3682
3784
  "className": "block",
3683
3785
  // "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'>`
3684
3786
  "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>`
3685
- },
3787
+ }],
3686
3788
  "md": "auto",
3687
3789
  "className": "",
3688
3790
  "columnClassName": "flex justify-center items-center"
@@ -3769,18 +3871,9 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
3769
3871
  * @param {*} relatedObjectSchema 相关对象UISchema
3770
3872
  * @returns amisSchema
3771
3873
  */
3772
- async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relatedLabel) {
3874
+ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relatedLabel, ctx) {
3773
3875
  const { icon, label } = relatedObjectSchema;
3774
- const buttons = await getObjectRelatedListButtons(relatedObjectSchema, {});
3775
- let amisButtonsSchema = map(buttons, (button) => {
3776
- return {
3777
- type: 'steedos-object-button',
3778
- name: button.name,
3779
- objectName: button.objectName,
3780
- visibleOn: getButtonVisibleOn$1(button),
3781
- className: `button_${button.name}`
3782
- }
3783
- });
3876
+ let amisButtonsSchema = getObjectRecordDetailRelatedListButtonsSchemas(relatedObjectSchema, {formFactor: ctx.formFactor});
3784
3877
  const reg = new RegExp('_', 'g');
3785
3878
  const standardIcon = icon && icon.replace(reg, '-');
3786
3879
  const recordRelatedListHeader = {
@@ -3853,83 +3946,44 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
3853
3946
  async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
3854
3947
  }
3855
3948
 
3856
- const getDisplayAsButton = function(objectName, showDisplayAs){
3857
- let displayAs = Router$1.getTabDisplayAs(objectName);
3858
- let buttons = [
3859
- {
3860
- "type": "button",
3861
- "label": "表格",
3862
- "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');",
3863
- "rightIcon": displayAs != 'split' ? "fa fa-check" : null,
3864
- "rightIconClassName": "m-l-sm"
3865
- },
3866
- {
3867
- "type": "button",
3868
- "label": "分栏视图",
3869
- "onClick": "const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
3870
- "rightIcon": displayAs === 'split' ? "fa fa-check" : null,
3871
- "rightIconClassName": "m-l-sm"
3949
+ const getExportExcelToolbarButtonSchema = ()=>{
3950
+ return {
3951
+ "type": "button",
3952
+ "icon": "fa fa-download",
3953
+ "align": "right",
3954
+ "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
3955
+ "tooltipPlacement": "bottom",
3956
+ "visibleOn": "${!isLookup && global.user.is_space_admin}",
3957
+ "tooltip": "导出Excel",
3958
+ "onEvent": {
3959
+ "click": {
3960
+ "weight": 0,
3961
+ "actions": [
3962
+ {
3963
+ "args": {
3964
+ "api": {
3965
+ "url": "${context.rootUrl}/api/record/export/${objectName}",
3966
+ "method": "get",
3967
+ "messages": {},
3968
+ "requestAdaptor": `${requestAdaptor$1()}`,
3969
+ "data": {
3970
+ "uiSchema": "${uiSchema}",
3971
+ "listName": "${listName}"
3972
+ },
3973
+ "headers": {
3974
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
3975
+ }
3976
+ }
3977
+ },
3978
+ "actionType": "download"
3979
+ }
3980
+ ]
3981
+ }
3982
+ }
3872
3983
  }
3873
- ];
3874
- return {
3875
- "type": "dropdown-button",
3876
- "icon": "fa fa-table-columns",
3877
- "btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
3878
- "align": "right",
3879
- "visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
3880
- "buttons": [
3881
- {
3882
- "label": "显示为",
3883
- "children": buttons
3884
- }
3885
- ]
3886
- };
3887
3984
  };
3888
3985
 
3889
-
3890
-
3891
-
3892
- const onFieldsFilterToggleScript = `
3893
- const scope = event.context.scoped;
3894
- const filterForm = scope.getComponents().find(function(n){
3895
- return n.props.type === "form";
3896
- });
3897
- const filterService = filterForm.context.getComponents().find(function(n){
3898
- return n.props.type === "service";
3899
- });
3900
- // filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
3901
- let resizeWindow = function(){
3902
- //触发amis crud 高度重算
3903
- setTimeout(()=>{
3904
- window.dispatchEvent(new Event("resize"))
3905
- }, 500);
3906
- }
3907
- let isMobile = Steedos.isMobile();
3908
- if(filterService.props.data.showFieldsFilter){
3909
- if(isMobile){
3910
- // 手机上只能通过取消按钮来关闭搜索栏
3911
- return;
3912
- }
3913
- let buttonCancel = SteedosUI.getClosestAmisComponentByType(filterForm.context, "button", {
3914
- direction: "down",
3915
- name: "btn_filter_form_cancel"
3916
- });
3917
- buttonCancel.props.dispatchEvent('click', {}).then(function(){
3918
- resizeWindow();
3919
- });
3920
- }
3921
- else{
3922
- filterService.setData({showFieldsFilter: true});
3923
- resizeWindow();
3924
- if(isMobile){
3925
- // 手机端在显示搜索栏时隐藏刷新按钮
3926
- let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
3927
- crudService && crudService.setData({showFieldsFilter: true});
3928
- }
3929
- }
3930
- `;
3931
-
3932
- function getExportApiRequestAdaptorScript(){
3986
+ function requestAdaptor$1(){
3933
3987
  return `
3934
3988
  // 获取列表视图的属性
3935
3989
  let uiSchema = api.body.uiSchema;
@@ -3983,667 +4037,1101 @@ function getExportApiRequestAdaptorScript(){
3983
4037
  `
3984
4038
  }
3985
4039
 
3986
- function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false, hiddenCount = false, headerToolbarItems, filterVisible = true} = {}){
3987
- // console.log(`getObjectHeaderToolbar====>`, filterVisible)
3988
- const isMobile = window.innerWidth < 768;
3989
- if(isMobile){
3990
- showDisplayAs = false;
3991
- }
3992
- if(formFactor === 'SMALL'){
3993
- const onReloadScript = `
3994
- const scope = event.context.scoped;
3995
- var listView = scope.parent.getComponents().find(function(n){
3996
- return n.props.type === "crud";
3997
- });
3998
- listView.handleChangePage(1);
3999
- `;
4000
- return [
4001
- // "bulkActions",
4002
- ...(headerToolbarItems || []),
4003
- hiddenCount ? {} :{
4004
- "type": "tpl",
4005
- "tpl": "${count} 个项目"
4006
- },
4007
- {
4008
- // "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
4040
+ const getNewListviewButtonSchema = ()=>{
4041
+ return {
4009
4042
  "type": "button",
4010
- "align": "right",
4011
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
4012
- "label": "",
4013
- "icon": "fa fa-sync",
4014
- "visibleOn": "${!showFieldsFilter}",
4043
+ "label": "新建",
4015
4044
  "onEvent": {
4016
4045
  "click": {
4046
+ "weight": 0,
4017
4047
  "actions": [
4018
4048
  {
4019
- "actionType": "custom",
4020
- "script": onReloadScript
4049
+ "dialog": {
4050
+ "type": "dialog",
4051
+ "title": "新建 列表视图",
4052
+ "data": {
4053
+ "&": "$$",
4054
+ "all": "${uiSchema.list_views.all}",
4055
+ "list_view": "${uiSchema.list_views[listName]}",
4056
+ "appId": "${appId}",
4057
+ "global": "${global}",
4058
+ "targetObjectName": "${objectName}",
4059
+ },
4060
+ "body": [
4061
+ {
4062
+ "type": "steedos-object-form",
4063
+ "label": "对象表单",
4064
+ "objectApiName": "object_listviews",
4065
+ "recordId": "",
4066
+ "mode": "edit",
4067
+ "defaultData": {
4068
+ "&": "${list_view}",
4069
+ "name":"",
4070
+ "label":"",
4071
+ "filters":"",
4072
+ "shared":false
4073
+ },
4074
+ "fieldsExtend": fieldsExtend$4(),
4075
+ "fields": fields$1(),
4076
+ "onEvent": {
4077
+ "submitSucc": {
4078
+ "weight": 0,
4079
+ "actions": [
4080
+ {
4081
+ "args": {
4082
+ // 直接使用recordId不能拿到数据,只能通过result里面拿数据
4083
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
4084
+ "blank": false
4085
+ },
4086
+ "actionType": "url",
4087
+ }
4088
+ ]
4089
+ }
4090
+ },
4091
+ "messages": {
4092
+ "success": "成功",
4093
+ "failed": "失败"
4094
+ },
4095
+ }
4096
+ ],
4097
+ "showCloseButton": true,
4098
+ "showErrorMsg": true,
4099
+ "showLoading": true,
4100
+ "closeOnEsc": false,
4101
+ "dataMapSwitch": false,
4102
+ "size": "lg"
4103
+ },
4104
+ "actionType": "dialog"
4021
4105
  }
4022
4106
  ]
4023
4107
  }
4024
- },
4025
- },
4026
- filterVisible ? {
4027
- "label": "",
4028
- "icon": "fa fa-search",
4029
- "type": "button",
4030
- "badge": {
4031
- "offsetx": [
4032
- -2,
4033
- 2
4034
- ],
4035
- "size":8,
4036
- "animation": true,
4037
- "visibleOn": "${isFieldsFilterEmpty == false}"
4038
- },
4039
- "align": "right",
4040
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
4108
+ }
4109
+ }
4110
+ };
4111
+
4112
+ function fields$1(){
4113
+ return [
4114
+ "label",
4115
+ "name",
4116
+ "object_name",
4117
+ "filter_scope",
4118
+ "show_count",
4119
+ "columns.$.field",
4120
+ "columns.$.width",
4121
+ "sort.$.field_name",
4122
+ "sort.$.order",
4123
+ "filters",
4124
+ "mobile_columns.$.field",
4125
+ "searchable_fields.$.field",
4126
+ "is_system",
4127
+ "shared"
4128
+ ]
4129
+ }
4130
+
4131
+ function fieldsExtend$4(){
4132
+ return {
4133
+ "label": {
4134
+ "is_wide": true
4135
+ },
4136
+ "name": {
4137
+ "amis": {
4138
+ "hidden": true
4139
+ }
4140
+ },
4141
+ "object_name": {
4142
+ "amis": {
4143
+ "hidden": true
4144
+ }
4145
+ },
4146
+ "filter_scope": {
4147
+ "amis": {
4148
+ "hidden": true
4149
+ }
4150
+ },
4151
+ "columns": {
4152
+ "amis": {
4153
+ "hidden": true
4154
+ }
4155
+ },
4156
+ "filter_fields": {
4157
+ "amis": {
4158
+ "hidden": true
4159
+ }
4160
+ },
4161
+ "scrolling_mode": {
4162
+ "amis": {
4163
+ "hidden": true
4164
+ }
4165
+ },
4166
+ "sort": {
4167
+ "amis": {
4168
+ "hidden": true
4169
+ }
4170
+ },
4171
+ "show_count": {
4172
+ "amis": {
4173
+ "hidden": true
4174
+ }
4175
+ },
4176
+ "type": {
4177
+ "amis": {
4178
+ "hidden": true
4179
+ }
4180
+ },
4181
+ "shared": {
4182
+ "amis": {
4183
+ "visibleOn": "${global.user.is_space_admin}"
4184
+ }
4185
+ }
4186
+ }
4187
+ }
4188
+
4189
+ const getCopyListviewButtonSchema = ()=>{
4190
+ return {
4191
+ "type": "button",
4192
+ "label": "复制",
4041
4193
  "onEvent": {
4042
4194
  "click": {
4195
+ "weight": 0,
4043
4196
  "actions": [
4044
4197
  {
4045
- "actionType": "custom",
4046
- "script": onFieldsFilterToggleScript
4198
+ "dialog": {
4199
+ "type": "dialog",
4200
+ "title": "复制 列表视图",
4201
+ "data": {
4202
+ "&": "$$",
4203
+ "listName": "${listName}",
4204
+ "targetObjectName": "${objectName}",
4205
+ "list_view": "${uiSchema.list_views[listName]}",
4206
+ "appId": "${appId}",
4207
+ "global": "${global}"
4208
+ },
4209
+ "body": [
4210
+ {
4211
+ "type": "steedos-object-form",
4212
+ "label": "对象表单",
4213
+ "objectApiName": "object_listviews",
4214
+ "recordId": "",
4215
+ "mode": "edit",
4216
+ "defaultData": {
4217
+ "&": "${list_view}",
4218
+ "name":"",
4219
+ "label": "${list_view.label} 的副本",
4220
+ "shared":false
4221
+ },
4222
+ "fieldsExtend": fieldsExtend$3(),
4223
+ "fields": fields(),
4224
+ "onEvent": {
4225
+ "submitSucc": {
4226
+ "weight": 0,
4227
+ "actions": [
4228
+ {
4229
+ "args": {
4230
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
4231
+ "blank": false
4232
+ },
4233
+ "actionType": "url",
4234
+ }
4235
+ ]
4236
+ }
4237
+ }
4238
+ }
4239
+ ],
4240
+ "showCloseButton": true,
4241
+ "showErrorMsg": true,
4242
+ "showLoading": true,
4243
+ "closeOnEsc": false,
4244
+ "dataMapSwitch": false,
4245
+ "size": "lg"
4246
+ },
4247
+ "actionType": "dialog"
4047
4248
  }
4048
4249
  ]
4049
4250
  }
4050
4251
  }
4051
- } : {},
4052
- getDisplayAsButton(mainObject?.name)
4252
+ }
4253
+ };
4254
+
4255
+ function fields(){
4256
+ return [
4257
+ "label",
4258
+ "name",
4259
+ "object_name",
4260
+ "filter_scope",
4261
+ "show_count",
4262
+ "columns.$.field",
4263
+ "columns.$.width",
4264
+ "sort.$.field_name",
4265
+ "sort.$.order",
4266
+ "filters",
4267
+ "mobile_columns.$.field",
4268
+ "searchable_fields.$.field",
4269
+ "is_system",
4270
+ "shared"
4053
4271
  ]
4054
- }else {
4055
- return [
4056
- // "filter-toggler",
4057
- ...(headerToolbarItems || []),
4058
- "bulkActions",
4059
- {
4060
- "type": "columns-toggler",
4061
- "className": "hidden"
4062
- },
4063
- // {
4064
- // "type": "columns-toggler",
4065
- // "className": "mr-2"
4066
- // },
4067
- hiddenCount ? {} : {
4068
- "type": "tpl",
4069
- "tpl": "${count} 个项目"
4070
- },
4071
- {
4072
- "type": "reload",
4073
- "align": "right",
4074
- "tooltipPlacement": "bottom",
4075
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
4076
- },
4077
- {
4272
+ }
4273
+
4274
+ function fieldsExtend$3(){
4275
+ return {
4276
+ "label": {
4277
+ "is_wide": true
4278
+ },
4279
+ "name": {
4280
+ "is_wide": true,
4281
+ "amis": {
4282
+ "hidden": true
4283
+ }
4284
+ },
4285
+ "object_name": {
4286
+ "amis": {
4287
+ "hidden": true
4288
+ }
4289
+ },
4290
+ "filter_scope": {
4291
+ "amis": {
4292
+ "hidden": true
4293
+ }
4294
+ },
4295
+ "columns": {
4296
+ "amis": {
4297
+ "hidden": true
4298
+ }
4299
+ },
4300
+ "filter_fields": {
4301
+ "amis": {
4302
+ "hidden": true
4303
+ }
4304
+ },
4305
+ "scrolling_mode": {
4306
+ "amis": {
4307
+ "hidden": true
4308
+ }
4309
+ },
4310
+ "sort": {
4311
+ "amis": {
4312
+ "hidden": true
4313
+ }
4314
+ },
4315
+ "show_count": {
4316
+ "amis": {
4317
+ "hidden": true
4318
+ }
4319
+ },
4320
+ "type": {
4321
+ "amis": {
4322
+ "hidden": true
4323
+ }
4324
+ },
4325
+ "shared": {
4326
+ "amis": {
4327
+ "visibleOn": "${global.user.is_space_admin}"
4328
+ }
4329
+ }
4330
+ }
4331
+ }
4332
+
4333
+ const getRenameListviewButtonSchema = ()=>{
4334
+ return {
4078
4335
  "type": "button",
4079
- "label": "",
4080
- "icon": "fa fa-download",
4081
- "align": "right",
4082
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
4083
- "tooltipPlacement": "bottom",
4084
- "visibleOn": "${!isLookup && global.user.is_space_admin}",
4085
- "tooltip": "导出Excel",
4336
+ "label": "重命名",
4337
+ "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4086
4338
  "onEvent": {
4087
4339
  "click": {
4088
4340
  "weight": 0,
4089
4341
  "actions": [
4090
4342
  {
4091
- "args": {
4092
- "api": {
4093
- "url": "${context.rootUrl}/api/record/export/${objectName}",
4094
- "method": "get",
4095
- "messages": {},
4096
- "requestAdaptor": `${getExportApiRequestAdaptorScript()}`,
4097
- "data": {
4098
- "uiSchema": "${uiSchema}",
4099
- "listName": "${listName}"
4100
- },
4101
- "headers": {
4102
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
4343
+ "dialog": {
4344
+ "type": "dialog",
4345
+ "title": "重命名 列表视图",
4346
+ "data": {
4347
+ "targetObjectName": "${objectName}",
4348
+ "recordId": "${uiSchema.list_views[listName]._id}",
4349
+ "appId": "${appId}"
4350
+ },
4351
+ "body": [
4352
+ {
4353
+ "type": "steedos-object-form",
4354
+ "label": "对象表单",
4355
+ "objectApiName": "object_listviews",
4356
+ "recordId": "${recordId}",
4357
+ "mode": "edit",
4358
+ "fields": [
4359
+ "label"
4360
+ ],
4361
+ "fieldsExtend": "{\n \"label\":{\n \"is_wide\": true\n }\n}",
4362
+ "onEvent": {
4363
+ "submitSucc": {
4364
+ "weight": 0,
4365
+ "actions": [
4366
+ {
4367
+ "args": {
4368
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${name}",
4369
+ "blank": false
4370
+ },
4371
+ "actionType": "url",
4372
+ },
4373
+ ]
4374
+ }
4375
+ }
4103
4376
  }
4104
- }
4377
+ ],
4378
+ "showCloseButton": true,
4379
+ "showErrorMsg": true,
4380
+ "showLoading": true,
4381
+ "size": "lg"
4105
4382
  },
4106
- "actionType": "download"
4383
+ "actionType": "dialog"
4107
4384
  }
4108
4385
  ]
4109
4386
  }
4110
4387
  }
4111
- },
4112
- filterVisible ? {
4113
- "label": "",
4114
- "icon": "fa fa-search",
4388
+ }
4389
+ };
4390
+
4391
+ const getSetListviewShareButtonSchema = ()=>{
4392
+ return {
4115
4393
  "type": "button",
4116
- "align": "right",
4117
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
4394
+ "label": "共享设置",
4395
+ "disabledOn": "!(global.user.is_space_admin && !!uiSchema.list_views[listName].owner)",
4118
4396
  "onEvent": {
4119
4397
  "click": {
4398
+ "weight": 0,
4120
4399
  "actions": [
4121
4400
  {
4122
- "actionType": "custom",
4123
- "script": onFieldsFilterToggleScript
4401
+ "dialog": {
4402
+ "type": "dialog",
4403
+ "title": "共享设置",
4404
+ "data": {
4405
+ "recordId": "${uiSchema.list_views[listName]._id}",
4406
+ },
4407
+ "body": [
4408
+ {
4409
+ "type": "steedos-object-form",
4410
+ "label": "对象表单",
4411
+ "objectApiName": "object_listviews",
4412
+ "recordId": "${recordId}",
4413
+ "mode": "edit",
4414
+ "fields": [
4415
+ "shared"
4416
+ ]
4417
+ }
4418
+ ],
4419
+ "showCloseButton": true,
4420
+ "showErrorMsg": true,
4421
+ "showLoading": true,
4422
+ "closeOnEsc": false,
4423
+ "dataMapSwitch": false,
4424
+ "size": "md"
4425
+ },
4426
+ "actionType": "dialog"
4124
4427
  }
4125
4428
  ]
4126
4429
  }
4127
4430
  }
4128
- } : {},
4129
- {
4130
- "type": "dropdown-button",
4131
- "trigger": "click",
4132
- "icon": "fa fa-cog",
4133
- "btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
4134
- "align": "right",
4135
- "visibleOn": "${!isLookup}",
4136
- "buttons": [
4137
- {
4138
- "label": "列表视图操作",
4139
- "children": [
4431
+ }
4432
+ };
4433
+
4434
+ const getSetListviewFiltersButtonSchema = ()=>{
4435
+ return {
4436
+ "type": "button",
4437
+ "label": "过滤设置",
4438
+ "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4439
+ "onEvent": {
4440
+ "click": {
4441
+ "weight": 0,
4442
+ "actions": [
4140
4443
  {
4141
- "type": "button",
4142
- "label": "新建",
4143
- "onEvent": {
4144
- "click": {
4145
- "weight": 0,
4146
- "actions": [
4147
- {
4148
- "dialog": {
4149
- "type": "dialog",
4150
- "title": "新建 列表视图",
4151
- "data": {
4152
- "&": "$$",
4153
- "all": "${uiSchema.list_views.all}",
4154
- "list_view": "${uiSchema.list_views[listName]}",
4155
- "appId": "${appId}",
4156
- "global": "${global}",
4157
- "targetObjectName": "${objectName}",
4158
- },
4159
- "body": [
4444
+ "dialog": {
4445
+ "type": "dialog",
4446
+ "title": "过滤设置",
4447
+ "data": {
4448
+ "targetObjectName": "${objectName}",
4449
+ "recordId": "${uiSchema.list_views[listName]._id}",
4450
+ "listName": "${listName}",
4451
+ "appId": "${appId}"
4452
+ },
4453
+ "body": [
4454
+ {
4455
+ "type": "steedos-object-form",
4456
+ "label": "对象表单",
4457
+ "objectApiName": "object_listviews",
4458
+ "recordId": "${recordId}",
4459
+ "mode": "edit",
4460
+ "fields": [
4461
+ "filters"
4462
+ ],
4463
+ "initApiAdaptor": initApiAdaptor$2(),
4464
+ "apiRequestAdaptor": apiRequestAdaptor$2(),
4465
+ "fieldsExtend": fieldsExtend$2(),
4466
+ "onEvent": {
4467
+ "submitSucc": {
4468
+ "weight": 0,
4469
+ "actions": [
4160
4470
  {
4161
- "type": "steedos-object-form",
4162
- "label": "对象表单",
4163
- "objectApiName": "object_listviews",
4164
- "recordId": "",
4165
- "mode": "edit",
4166
- "defaultData": {
4167
- "&": "${list_view}",
4168
- "name":"",
4169
- "label":"",
4170
- "filters":"",
4171
- "shared":false
4172
- },
4173
- "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}",
4174
- "fields": [
4175
- "label",
4176
- "name",
4177
- "object_name",
4178
- "filter_scope",
4179
- "show_count",
4180
- "columns.$.field",
4181
- "columns.$.width",
4182
- "sort.$.field_name",
4183
- "sort.$.order",
4184
- "filters",
4185
- "mobile_columns.$.field",
4186
- "searchable_fields.$.field",
4187
- "is_system",
4188
- "shared"
4189
- ],
4190
- "onEvent": {
4191
- "submitSucc": {
4192
- "weight": 0,
4193
- "actions": [
4194
- {
4195
- "args": {
4196
- // 直接使用recordId不能拿到数据,只能通过result里面拿数据
4197
- "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
4198
- "blank": false
4199
- },
4200
- "actionType": "url",
4201
- }
4202
- ]
4203
- }
4204
- },
4205
- "messages": {
4206
- "success": "成功",
4207
- "failed": "失败"
4471
+ "args": {
4472
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
4473
+ "blank": false
4208
4474
  },
4475
+ "actionType": "url",
4209
4476
  }
4210
- ],
4211
- "showCloseButton": true,
4212
- "showErrorMsg": true,
4213
- "showLoading": true,
4214
- "closeOnEsc": false,
4215
- "dataMapSwitch": false,
4216
- "size": "lg"
4217
- },
4218
- "actionType": "dialog"
4477
+ ]
4478
+ }
4219
4479
  }
4220
- ]
4221
- }
4222
- }
4223
- },
4224
- {
4225
- "type": "button",
4226
- "label": "复制",
4227
- "onEvent": {
4228
- "click": {
4229
- "weight": 0,
4230
- "actions": [
4231
- {
4232
- "dialog": {
4233
- "type": "dialog",
4234
- "title": "复制 列表视图",
4235
- "data": {
4236
- "&": "$$",
4237
- "listName": "${listName}",
4238
- "targetObjectName": "${objectName}",
4239
- "list_view": "${uiSchema.list_views[listName]}",
4240
- "appId": "${appId}",
4241
- "global": "${global}"
4242
- },
4243
- "body": [
4244
- {
4245
- "type": "steedos-object-form",
4246
- "label": "对象表单",
4247
- "objectApiName": "object_listviews",
4248
- "recordId": "",
4249
- "mode": "edit",
4250
- "fields": [
4251
- ],
4252
- "defaultData": {
4253
- "&": "${list_view}",
4254
- "name":"",
4255
- "label": "${list_view.label}的副本",
4256
- "shared":false
4257
- },
4258
- "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}",
4259
- "fields": [
4260
- "label",
4261
- "name",
4262
- "object_name",
4263
- "filter_scope",
4264
- "show_count",
4265
- "columns.$.field",
4266
- "columns.$.width",
4267
- "sort.$.field_name",
4268
- "sort.$.order",
4269
- "filters",
4270
- "mobile_columns.$.field",
4271
- "searchable_fields.$.field",
4272
- "is_system",
4273
- "shared"
4274
- ],
4275
- "onEvent": {
4276
- "submitSucc": {
4277
- "weight": 0,
4278
- "actions": [
4279
- {
4280
- "args": {
4281
- "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
4282
- "blank": false
4283
- },
4284
- "actionType": "url",
4285
- }
4286
- ]
4287
- }
4288
- }
4289
- }
4290
- ],
4291
- "showCloseButton": true,
4292
- "showErrorMsg": true,
4293
- "showLoading": true,
4294
- "closeOnEsc": false,
4295
- "dataMapSwitch": false,
4296
- "size": "lg"
4297
- },
4298
- "actionType": "dialog"
4299
- }
4300
- ]
4301
- }
4302
- }
4303
- },
4304
- {
4305
- "type": "button",
4306
- "label": "重命名",
4307
- "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4308
- "onEvent": {
4309
- "click": {
4310
- "weight": 0,
4311
- "actions": [
4312
- {
4313
- "dialog": {
4314
- "type": "dialog",
4315
- "title": "重命名 列表视图",
4316
- "data": {
4317
- "targetObjectName": "${objectName}",
4318
- "recordId": "${uiSchema.list_views[listName]._id}",
4319
- "appId": "${appId}"
4320
- },
4321
- "body": [
4322
- {
4323
- "type": "steedos-object-form",
4324
- "label": "对象表单",
4325
- "objectApiName": "object_listviews",
4326
- "recordId": "${recordId}",
4327
- "mode": "edit",
4328
- "fields": [
4329
- "label"
4330
- ],
4331
- "fieldsExtend": "{\n \"label\":{\n \"is_wide\": true\n }\n}",
4332
- "onEvent": {
4333
- "submitSucc": {
4334
- "weight": 0,
4335
- "actions": [
4336
- {
4337
- "args": {
4338
- "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${name}",
4339
- "blank": false
4340
- },
4341
- "actionType": "url",
4342
- },
4343
- ]
4344
- }
4345
- }
4346
- }
4347
- ],
4348
- "showCloseButton": true,
4349
- "showErrorMsg": true,
4350
- "showLoading": true,
4351
- "size": "lg"
4352
- },
4353
- "actionType": "dialog"
4354
- }
4355
- ]
4356
- }
4357
- }
4358
- },
4480
+ }
4481
+ ],
4482
+ "showCloseButton": true,
4483
+ "showErrorMsg": true,
4484
+ "showLoading": true,
4485
+ "closeOnEsc": false,
4486
+ "dataMapSwitch": false,
4487
+ "size": "lg"
4488
+ },
4489
+ "actionType": "dialog"
4490
+ }
4491
+ ]
4492
+ }
4493
+ }
4494
+ }
4495
+ };
4496
+
4497
+
4498
+ function initApiAdaptor$2(){
4499
+ return `
4500
+ const recordId_tmp = api.body.recordId;
4501
+ let data_tmp;
4502
+ if (recordId_tmp) {
4503
+ data_tmp = payload.data;
4504
+ // 数据格式转换
4505
+ if (data_tmp) {
4506
+ if (data_tmp.filters && lodash.isString(data_tmp.filters)) {
4507
+ try {
4508
+ data_tmp.filters = JSON.parse(data_tmp.filters);
4509
+ } catch (e) { }
4510
+ }
4511
+
4512
+ if (data_tmp.filters && lodash.isString(data_tmp.filters)) {
4513
+ data_tmp._filters_type_controller = 'function';
4514
+ } else {
4515
+ data_tmp._filters_type_controller = 'conditions'
4516
+ }
4517
+
4518
+ if (data_tmp._filters_type_controller === 'conditions') {
4519
+ data_tmp._filters_conditions = window.amisConvert.filtersToConditions(data_tmp.filters || []);
4520
+ data_tmp.filters = data_tmp._filters_conditions;
4521
+ } else {
4522
+ data_tmp._filters_function = data_tmp.filters;
4523
+ }
4524
+ }
4525
+ }
4526
+ for (key in data_tmp) {
4527
+ if (data_tmp[key] === null) {
4528
+ delete data_tmp[key];
4529
+ }
4530
+ }
4531
+ payload.data = Object.assign(payload.data, data_tmp);
4532
+ delete payload.extensions;
4533
+ return payload;
4534
+ `
4535
+ }
4536
+
4537
+ function apiRequestAdaptor$2(){
4538
+ return `
4539
+ const recordId = api.body.recordId;
4540
+ if (formData._filters_type_controller === 'conditions' && formData._filters_conditions) {
4541
+ formData.filters = window.amisConvert.conditionsToFilters(formData.filters);
4542
+ } else {
4543
+ formData.filters = formData._filters_function || null;
4544
+ }
4545
+
4546
+ delete formData._filters_type_controller;
4547
+ delete formData._filters_conditions;
4548
+ delete formData._filters_function;
4549
+
4550
+ query = 'mutation{record: ' + objectName + '__insert(doc: {__saveData}){_id}}';
4551
+ if (api.body.recordId) {
4552
+ query = 'mutation{record: ' + objectName + '__update(id: "' + recordId + '", doc: {__saveData}){_id}}';
4553
+ };
4554
+ __saveData = JSON.stringify(JSON.stringify(formData));
4555
+ api.data = { query: query.replace('{__saveData}', __saveData) };
4556
+ return api;
4557
+ `
4558
+ }
4559
+
4560
+ function fieldsExtend$2(){
4561
+ return {
4562
+ "filters": {
4563
+ "visible_on": "true",
4564
+ "amis": {
4565
+ "type": "condition-builder",
4566
+ "label": "条件组件1",
4567
+ "source": {
4568
+ "method": "get",
4569
+ "url": "${context.rootUrl}/service/api/amis-metadata-listviews/getFilterFields?objectName=${targetObjectName}",
4570
+ "dataType": "json",
4571
+ "headers": {
4572
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
4573
+ }
4574
+ }
4575
+ }
4576
+ }
4577
+ }
4578
+ }
4579
+
4580
+ const getSetListviewColumnsButtonSchema = ()=>{
4581
+ return {
4582
+ "type": "button",
4583
+ "label": "显示的列",
4584
+ "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4585
+ "onEvent": {
4586
+ "click": {
4587
+ "weight": 0,
4588
+ "actions": [
4359
4589
  {
4360
- "type": "button",
4361
- "label": "共享设置",
4362
- "disabledOn": "!(global.user.is_space_admin && !!uiSchema.list_views[listName].owner)",
4363
- "onEvent": {
4364
- "click": {
4365
- "weight": 0,
4366
- "actions": [
4367
- {
4368
- "dialog": {
4369
- "type": "dialog",
4370
- "title": "共享设置",
4371
- "data": {
4372
- "recordId": "${uiSchema.list_views[listName]._id}",
4373
- },
4374
- "body": [
4590
+ "args": {},
4591
+ "dialog": {
4592
+ "type": "dialog",
4593
+ "title": "显示的列",
4594
+ "data": {
4595
+ "&": "$$",
4596
+ "targetObjectName": "${objectName}",
4597
+ "recordId": "${uiSchema.list_views[listName]._id}",
4598
+ "listName": "${listName}",
4599
+ "appId": "${appId}"
4600
+ },
4601
+ "body": [
4602
+ {
4603
+ "type": "steedos-object-form",
4604
+ "label": "对象表单",
4605
+ "objectApiName": "object_listviews",
4606
+ "recordId": "${recordId}",
4607
+ "mode": "edit",
4608
+ "fieldsExtend": fieldsExtend$1(),
4609
+ "initApiAdaptor": initApiAdaptor$1(),
4610
+ "apiRequestAdaptor": apiRequestAdaptor$1(),
4611
+ "fields": [
4612
+ "columns",
4613
+ "mobile_columns"
4614
+ ],
4615
+ "onEvent": {
4616
+ "submitSucc": {
4617
+ "weight": 0,
4618
+ "actions": [
4375
4619
  {
4376
- "type": "steedos-object-form",
4377
- "label": "对象表单",
4378
- "objectApiName": "object_listviews",
4379
- "recordId": "${recordId}",
4380
- "mode": "edit",
4381
- "fields": [
4382
- "shared"
4383
- ]
4620
+ "args": {
4621
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
4622
+ "blank": false
4623
+ },
4624
+ "actionType": "url"
4384
4625
  }
4385
- ],
4386
- "showCloseButton": true,
4387
- "showErrorMsg": true,
4388
- "showLoading": true,
4389
- "closeOnEsc": false,
4390
- "dataMapSwitch": false,
4391
- "size": "md"
4392
- },
4393
- "actionType": "dialog"
4626
+ ]
4627
+ }
4394
4628
  }
4395
- ]
4396
- }
4397
- }
4398
- },
4629
+ }
4630
+ ],
4631
+ "searchable": true,
4632
+ "showCloseButton": true,
4633
+ "showErrorMsg": true,
4634
+ "showLoading": true,
4635
+ "size": "lg"
4636
+ },
4637
+ "actionType": "dialog"
4638
+ }
4639
+ ]
4640
+ }
4641
+ }
4642
+ }
4643
+ };
4644
+
4645
+ function fieldsExtend$1(){
4646
+ return {
4647
+ "columns": {
4648
+ "amis": {
4649
+ "type": "transfer",
4650
+ "sortable": true,
4651
+ "searchable": true,
4652
+ "source": {
4653
+ "method": "get",
4654
+ "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${targetObjectName}/fields/options",
4655
+ "headers": {
4656
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
4657
+ }
4658
+ }
4659
+ }
4660
+ },
4661
+ "mobile_columns": {
4662
+ "group": "手机端",
4663
+ "amis": {
4664
+ "type": "transfer",
4665
+ "sortable": true,
4666
+ "searchable": true,
4667
+ "source": {
4668
+ "method": "get",
4669
+ "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${targetObjectName}/fields/options",
4670
+ "headers": {
4671
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
4672
+ }
4673
+ }
4674
+ }
4675
+ }
4676
+ }
4677
+ }
4678
+
4679
+ function initApiAdaptor$1(){
4680
+ return `
4681
+ const recordId_tmp = api.body.recordId;
4682
+ let columns_tmp = {}, mobile_columns_tmp = {};
4683
+ if (recordId_tmp) {
4684
+ columns_tmp = payload.data.columns;
4685
+ mobile_columns_tmp = payload.data.mobile_columns;
4686
+ if (columns_tmp) {
4687
+ columns_tmp = lodash.map(columns_tmp, 'field');
4688
+ }
4689
+ if (mobile_columns_tmp) {
4690
+ mobile_columns_tmp = lodash.map(mobile_columns_tmp, 'field');
4691
+ }
4692
+ }
4693
+ payload.data.columns = columns_tmp;
4694
+ payload.data.mobile_columns = mobile_columns_tmp;
4695
+
4696
+ delete payload.extensions;
4697
+ return payload;
4698
+ `
4699
+ }
4700
+
4701
+ function apiRequestAdaptor$1(){
4702
+ return `
4703
+ const formData_tmp = api.body.$;
4704
+ const objectName_tmp = api.body.objectName;
4705
+ const recordId_tmp = api.body.recordId;
4706
+
4707
+ if (typeof formData_tmp.columns == 'string') {
4708
+ formData_tmp.columns = formData_tmp.columns?.split(',');
4709
+ }
4710
+ if (typeof formData_tmp.mobile_columns == 'string') {
4711
+ formData_tmp.mobile_columns = formData_tmp.mobile_columns?.split(',');
4712
+ }
4713
+
4714
+ // 数据格式转换
4715
+ formData_tmp.columns = lodash.map(formData_tmp.columns, (item) => {
4716
+ return { field: item };
4717
+ });
4718
+ formData.mobile_columns = lodash.map(formData.mobile_columns, (item) => {
4719
+ return { field: item };
4720
+ });
4721
+
4722
+ let query_tmp = 'mutation{record: ' + objectName_tmp + '__insert(doc: {__saveData}){_id}}';
4723
+ if (api.body.recordId) {
4724
+ query_tmp = 'mutation{record: ' + objectName_tmp + '__update(id: "' + recordId_tmp +'", doc: {__saveData}){_id}}';
4725
+ };
4726
+ delete formData_tmp._id;
4727
+ let __saveData_tmp = JSON.stringify(JSON.stringify(formData_tmp));
4728
+ api.data = { query: query_tmp.replace('{__saveData}', __saveData_tmp) };
4729
+
4730
+ return api;
4731
+ `
4732
+ }
4733
+
4734
+ const getSetListviewSortButtonSchema = ()=>{
4735
+ return {
4736
+ "type": "button",
4737
+ "label": "默认排序规则",
4738
+ "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4739
+ "onEvent": {
4740
+ "click": {
4741
+ "weight": 0,
4742
+ "actions": [
4399
4743
  {
4400
- "type": "button",
4401
- "label": "过滤设置",
4402
- "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4403
- "onEvent": {
4404
- "click": {
4405
- "weight": 0,
4406
- "actions": [
4407
- {
4408
- "dialog": {
4409
- "type": "dialog",
4410
- "title": "过滤设置",
4411
- "data": {
4412
- "targetObjectName": "${objectName}",
4413
- "objectName": "${objectName}",
4414
- "recordId": "${uiSchema.list_views[listName]._id}",
4415
- "listName": "${listName}",
4416
- "appId": "${appId}"
4417
- },
4418
- "body": [
4744
+ "dialog": {
4745
+ "type": "dialog",
4746
+ "title": "弹框标题",
4747
+ "data": {
4748
+ "&": "$$",
4749
+ "targetObjectName": "${objectName}",
4750
+ "recordId": "${uiSchema.list_views[listName]._id}",
4751
+ "listName": "${listName}",
4752
+ "appId": "${appId}"
4753
+ },
4754
+ "body": [
4755
+ {
4756
+ "type": "steedos-object-form",
4757
+ "label": "对象表单",
4758
+ "objectApiName": "object_listviews",
4759
+ "recordId": "${recordId}",
4760
+ "className": "",
4761
+ "id": "u:061f158b4c5a",
4762
+ "mode": "edit",
4763
+ "fields": [
4764
+ "sort",
4765
+ "sort.$.field_name",
4766
+ "sort.$.order"
4767
+ ],
4768
+ "onEvent": {
4769
+ "submitSucc": {
4770
+ "weight": 0,
4771
+ "actions": [
4419
4772
  {
4420
- "type": "steedos-object-form",
4421
- "label": "对象表单",
4422
- "objectApiName": "object_listviews",
4423
- "recordId": "${recordId}",
4424
- "mode": "edit",
4425
- "fields": [
4426
- "filters"
4427
- ],
4428
- "initApiRequestAdaptor": "",
4429
- "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;",
4430
- "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",
4431
- "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}",
4432
- "onEvent": {
4433
- "submitSucc": {
4434
- "weight": 0,
4435
- "actions": [
4436
- {
4437
- "args": {
4438
- "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
4439
- "blank": false
4440
- },
4441
- "actionType": "url",
4442
- }
4443
- ]
4444
- }
4445
- }
4773
+ "args": {
4774
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
4775
+ "blank": false
4776
+ },
4777
+ "actionType": "url"
4446
4778
  }
4447
- ],
4448
- "showCloseButton": true,
4449
- "showErrorMsg": true,
4450
- "showLoading": true,
4451
- "closeOnEsc": false,
4452
- "dataMapSwitch": false,
4453
- "size": "lg"
4454
- },
4455
- "actionType": "dialog"
4456
- }
4457
- ]
4458
- }
4459
- }
4460
- },
4779
+ ]
4780
+ }
4781
+ },
4782
+ "fieldsExtend": fieldsExtend(),
4783
+ "initApiAdaptor": initApiAdaptor(),
4784
+ "apiRequestAdaptor": apiRequestAdaptor()
4785
+ }
4786
+ ],
4787
+ "showCloseButton": true,
4788
+ "showErrorMsg": true,
4789
+ "showLoading": true,
4790
+ "id": "u:d3f6947b6acf",
4791
+ "size": "lg"
4792
+ },
4793
+ "actionType": "dialog"
4794
+ }
4795
+ ]
4796
+ }
4797
+ }
4798
+ }
4799
+ };
4800
+
4801
+ function fieldsExtend(){
4802
+ return {
4803
+ "sort": {
4804
+ "amis": {
4805
+ "type": "tabs-transfer",
4806
+ "sortable": true,
4807
+ "searchable": true,
4808
+ "source": {
4809
+ "method": "get",
4810
+ "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${targetObjectName}/sortFields/options",
4811
+ "headers": {
4812
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
4813
+ }
4814
+ }
4815
+ }
4816
+ }
4817
+ }
4818
+ }
4819
+
4820
+ function initApiAdaptor(){
4821
+ return `
4822
+ let sort;
4823
+ if (recordId) {
4824
+ sort = payload.data.sort;
4825
+ //数据格式转换
4826
+ if (sort instanceof Array) {
4827
+ sort = lodash.map(sort, (item) => {
4828
+ return item.field_name + ':' + (item.order || 'asc')
4829
+ });
4830
+ }
4831
+ }
4832
+ payload.data.sort = sort;
4833
+ delete payload.extensions;
4834
+ return payload;
4835
+ `
4836
+ }
4837
+
4838
+ function apiRequestAdaptor(){
4839
+ return `
4840
+ const recordId = api.body.recordId;
4841
+ //数据格式转换
4842
+ if (typeof formData.sort == 'string') {
4843
+ formData.sort = formData.sort?.split(',');
4844
+ }
4845
+ formData.sort = lodash.map(formData.sort, (item) => {
4846
+ const arr = item.split(':');
4847
+ return { field_name: arr[0], order: arr[1] };
4848
+ });
4849
+ if (recordId) {
4850
+ query = 'mutation{record: ' + objectName + '__update(id: "' + recordId + '", doc: {__saveData}){_id}}';
4851
+ }
4852
+ __saveData = JSON.stringify(JSON.stringify(formData));
4853
+ api.data = { query: query.replace('{__saveData}', __saveData) };
4854
+ return api;
4855
+ `
4856
+ }
4857
+
4858
+ const getDeleteListviewButtonSchema = ()=>{
4859
+ return {
4860
+ "type": "button",
4861
+ "label": "删除",
4862
+ "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4863
+ "confirmText": "如果您删除此列表视图,该视图将为所有具备访问权限的用户永久删除。是否确定要删除?",
4864
+ "onEvent": {
4865
+ "click": {
4866
+ "actions": [
4461
4867
  {
4462
- "type": "button",
4463
- "label": "显示的列",
4464
- "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4465
- "onEvent": {
4466
- "click": {
4467
- "weight": 0,
4468
- "actions": [
4469
- {
4470
- "args": {},
4471
- "dialog": {
4472
- "type": "dialog",
4473
- "title": "显示的列",
4474
- "data": {
4475
- "&": "$$",
4476
- "targetObjectName": "${objectName}",
4477
- "objectName": "${objectName}",
4478
- "recordId": "${uiSchema.list_views[listName]._id}",
4479
- "listName": "${listName}",
4480
- "appId": "${appId}"
4481
- },
4482
- "body": [
4483
- {
4484
- "type": "steedos-object-form",
4485
- "label": "对象表单",
4486
- "objectApiName": "object_listviews",
4487
- "recordId": "${recordId}",
4488
- "mode": "edit",
4489
- "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}",
4490
- "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;",
4491
- "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;",
4492
- "fields": [
4493
- "columns",
4494
- "mobile_columns"
4495
- ],
4496
- "onEvent": {
4497
- "submitSucc": {
4498
- "weight": 0,
4499
- "actions": [
4500
- {
4501
- "args": {
4502
- "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
4503
- "blank": false
4504
- },
4505
- "actionType": "url"
4506
- }
4507
- ]
4508
- }
4509
- }
4510
- }
4511
- ],
4512
- "searchable": true,
4513
- "showCloseButton": true,
4514
- "showErrorMsg": true,
4515
- "showLoading": true,
4516
- "size": "lg"
4517
- },
4518
- "actionType": "dialog"
4519
- }
4520
- ]
4868
+ "actionType": "ajax",
4869
+ "args": {
4870
+ "api": {
4871
+ "url": "${context.rootUrl}/graphql",
4872
+ "method": "post",
4873
+ "headers": {
4874
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
4875
+ },
4876
+ "data": {
4877
+ "&": "$$",
4878
+ "uiSchema": "${uiSchema}",
4879
+ "recordId": "${uiSchema.list_views[listName]._id}"
4880
+ },
4881
+ "messages": {
4882
+ "success": "删除成功"
4883
+ },
4884
+ "requestAdaptor": requestAdaptor(),
4885
+ "adaptor": adaptor(),
4521
4886
  }
4522
4887
  }
4523
4888
  },
4524
4889
  {
4525
- "type": "button",
4526
- "label": "默认排序规则",
4527
- "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4528
- "onEvent": {
4529
- "click": {
4530
- "weight": 0,
4531
- "actions": [
4532
- {
4533
- "dialog": {
4534
- "type": "dialog",
4535
- "title": "弹框标题",
4536
- "data": {
4537
- "&": "$$",
4538
- "targetObjectName": "${objectName}",
4539
- "objectName": "${objectName}",
4540
- "recordId": "${uiSchema.list_views[listName]._id}",
4541
- "listName": "${listName}",
4542
- "appId": "${appId}"
4543
- },
4544
- "body": [
4545
- {
4546
- "type": "steedos-object-form",
4547
- "label": "对象表单",
4548
- "objectApiName": "object_listviews",
4549
- "recordId": "${recordId}",
4550
- "className": "",
4551
- "id": "u:061f158b4c5a",
4552
- "mode": "edit",
4553
- "fields": [
4554
- "sort",
4555
- "sort.$.field_name",
4556
- "sort.$.order"
4557
- ],
4558
- "onEvent": {
4559
- "submitSucc": {
4560
- "weight": 0,
4561
- "actions": [
4562
- {
4563
- "args": {
4564
- "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
4565
- "blank": false
4566
- },
4567
- "actionType": "url"
4568
- }
4569
- ]
4570
- }
4571
- },
4572
- "fieldsExtend": "{\n \"sort\": {\n \"amis\": {\n \"type\": \"tabs-transfer\",\n \"sortable\": true,\n \"searchable\": true,\n \"source\": {\n \"method\": \"get\",\n \"url\": \"${context.rootUrl}/service/api/amis-metadata-objects/objects/${objectName}/sortFields/options\",\n \"headers\": {\n \"Authorization\": \"Bearer ${context.tenantId},${context.authToken}\"\n }\n }\n }\n }\n}",
4573
- "initApiAdaptor": "let sort;\nif (recordId) {\n sort = payload.data.sort;\n //数据格式转换\n if (sort instanceof Array) {\n sort = lodash.map(sort, (item) => {\n return item.field_name + ':' + (item.order || 'asc')\n });\n }\n}\npayload.data.sort = sort;\ndelete payload.extensions;",
4574
- "apiRequestAdaptor": "const recordId = api.body.recordId;\n//数据格式转换\nif (typeof formData.sort == 'string') {\n formData.sort = formData.sort?.split(',');\n}\nformData.sort = lodash.map(formData.sort, (item) => {\n const arr = item.split(':');\n return { field_name: arr[0], order: arr[1] };\n});\nif (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"
4575
- }
4576
- ],
4577
- "showCloseButton": true,
4578
- "showErrorMsg": true,
4579
- "showLoading": true,
4580
- "id": "u:d3f6947b6acf",
4581
- "size": "lg"
4582
- },
4583
- "actionType": "dialog"
4584
- }
4585
- ]
4586
- }
4587
- }
4588
- },
4890
+ "actionType": "url",
4891
+ "args": {
4892
+ "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/all",
4893
+ "blank": false
4894
+ },
4895
+ "expression": "data.delete == 1"
4896
+ }
4897
+ ]
4898
+ }
4899
+ }
4900
+ }
4901
+ };
4902
+
4903
+
4904
+ function requestAdaptor(){
4905
+ return `
4906
+ const { recordId } = api.body;
4907
+ var deleteArray = [];
4908
+ if (recordId) { deleteArray.push(\`delete:object_listviews__delete(id: "\${recordId}")\`); }
4909
+ api.data = { query: \`mutation{\${deleteArray.join(',')}}\` };
4910
+ return api;
4911
+ `
4912
+ }
4913
+
4914
+ function adaptor(){
4915
+ return `
4916
+ if (payload.errors) {
4917
+ payload.status = 2;
4918
+ payload.msg = payload.errors[0].message;
4919
+ }
4920
+ return payload;
4921
+ `
4922
+ }
4923
+
4924
+ const getSettingListviewToolbarButtonSchema = ()=>{
4925
+ return {
4926
+ "type": "dropdown-button",
4927
+ "trigger": "click",
4928
+ "icon": "fa fa-cog",
4929
+ "btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
4930
+ "align": "right",
4931
+ "visibleOn": "${!isLookup}",
4932
+ "buttons": [
4933
+ {
4934
+ "label": "列表视图操作",
4935
+ "children": [
4936
+ getNewListviewButtonSchema(),
4937
+ getCopyListviewButtonSchema(),
4938
+ getRenameListviewButtonSchema(),
4939
+ getSetListviewShareButtonSchema(),
4940
+ getSetListviewFiltersButtonSchema(),
4941
+ getSetListviewColumnsButtonSchema(),
4942
+ getSetListviewSortButtonSchema(),
4943
+ getDeleteListviewButtonSchema()
4944
+ ]
4945
+ }
4946
+ ]
4947
+ }
4948
+ };
4949
+
4950
+ const getDisplayAsButton = function(objectName, showDisplayAs){
4951
+ let displayAs = Router$1.getTabDisplayAs(objectName);
4952
+ let buttons = [
4953
+ {
4954
+ "type": "button",
4955
+ "label": "表格",
4956
+ "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');",
4957
+ "rightIcon": displayAs != 'split' ? "fa fa-check" : null,
4958
+ "rightIconClassName": "m-l-sm"
4959
+ },
4960
+ {
4961
+ "type": "button",
4962
+ "label": "分栏视图",
4963
+ "onClick": "const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
4964
+ "rightIcon": displayAs === 'split' ? "fa fa-check" : null,
4965
+ "rightIconClassName": "m-l-sm"
4966
+ }
4967
+ ];
4968
+ return {
4969
+ "type": "dropdown-button",
4970
+ "icon": "fa fa-table-columns",
4971
+ "btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
4972
+ "align": "right",
4973
+ "visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
4974
+ "buttons": [
4975
+ {
4976
+ "label": "显示为",
4977
+ "children": buttons
4978
+ }
4979
+ ]
4980
+ };
4981
+ };
4982
+
4983
+
4984
+ const onFieldsFilterToggleScript = `
4985
+ const scope = event.context.scoped;
4986
+ const filterForm = scope.getComponents().find(function(n){
4987
+ return n.props.type === "form";
4988
+ });
4989
+ const filterService = filterForm.context.getComponents().find(function(n){
4990
+ return n.props.type === "service";
4991
+ });
4992
+ // filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
4993
+ let resizeWindow = function(){
4994
+ //触发amis crud 高度重算
4995
+ setTimeout(()=>{
4996
+ window.dispatchEvent(new Event("resize"))
4997
+ }, 500);
4998
+ }
4999
+ let isMobile = Steedos.isMobile();
5000
+ if(filterService.props.data.showFieldsFilter){
5001
+ if(isMobile){
5002
+ // 手机上只能通过取消按钮来关闭搜索栏
5003
+ return;
5004
+ }
5005
+ let buttonCancel = SteedosUI.getClosestAmisComponentByType(filterForm.context, "button", {
5006
+ direction: "down",
5007
+ name: "btn_filter_form_cancel"
5008
+ });
5009
+ buttonCancel.props.dispatchEvent('click', {}).then(function(){
5010
+ resizeWindow();
5011
+ });
5012
+ }
5013
+ else{
5014
+ filterService.setData({showFieldsFilter: true});
5015
+ resizeWindow();
5016
+ if(isMobile){
5017
+ // 手机端在显示搜索栏时隐藏刷新按钮
5018
+ let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
5019
+ crudService && crudService.setData({showFieldsFilter: true});
5020
+ }
5021
+ }
5022
+ `;
5023
+
5024
+
5025
+ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false, hiddenCount = false, headerToolbarItems, filterVisible = true} = {}){
5026
+ // console.log(`getObjectHeaderToolbar====>`, filterVisible)
5027
+ const isMobile = window.innerWidth < 768;
5028
+ if(isMobile){
5029
+ showDisplayAs = false;
5030
+ }
5031
+ if(formFactor === 'SMALL'){
5032
+ const onReloadScript = `
5033
+ const scope = event.context.scoped;
5034
+ var listView = scope.parent.getComponents().find(function(n){
5035
+ return n.props.type === "crud";
5036
+ });
5037
+ listView.handleChangePage(1);
5038
+ `;
5039
+ return [
5040
+ // "bulkActions",
5041
+ ...(headerToolbarItems || []),
5042
+ hiddenCount ? {} :{
5043
+ "type": "tpl",
5044
+ "tpl": "${count} 个项目"
5045
+ },
5046
+ {
5047
+ // "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
5048
+ "type": "button",
5049
+ "align": "right",
5050
+ "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
5051
+ "label": "",
5052
+ "icon": "fa fa-sync",
5053
+ "visibleOn": "${!showFieldsFilter}",
5054
+ "onEvent": {
5055
+ "click": {
5056
+ "actions": [
4589
5057
  {
4590
- "type": "button",
4591
- "label": "删除",
4592
- "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4593
- "confirmText": "如果您删除此列表视图,该视图将为所有具备访问权限的用户永久删除。是否确定要删除?",
4594
- "onEvent": {
4595
- "click": {
4596
- "actions": [
4597
- {
4598
- "actionType": "ajax",
4599
- "args": {
4600
- "api": {
4601
- "url": "${context.rootUrl}/graphql",
4602
- "method": "post",
4603
- "headers": {
4604
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
4605
- },
4606
- "data": {
4607
- "&": "$$",
4608
- "uiSchema": "${uiSchema}",
4609
- "recordId": "${uiSchema.list_views[listName]._id}"
4610
- },
4611
- "messages": {
4612
- "success": "删除成功"
4613
- },
4614
- "requestAdaptor": "const { recordId } = api.body;\nvar deleteArray = [];\nif (recordId) { deleteArray.push(`delete:object_listviews__delete(id: \"${recordId}\")`); }\napi.data = { query: `mutation{${deleteArray.join(',')}}` };\n return api;\n",
4615
- "adaptor": "if (payload.errors) {\n payload.status = 2;\n payload.msg = payload.errors[0].message;\n}\nreturn payload;",
4616
- }
4617
- }
4618
- },
4619
- {
4620
- "actionType": "url",
4621
- "args": {
4622
- "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/all",
4623
- "blank": false
4624
- },
4625
- "expression": "data.delete == 1"
4626
- }
4627
- ]
4628
- }
4629
- }
4630
- },
5058
+ "actionType": "custom",
5059
+ "script": onReloadScript
5060
+ }
5061
+ ]
5062
+ }
5063
+ },
5064
+ },
5065
+ filterVisible ? {
5066
+ "label": "",
5067
+ "icon": "fa fa-search",
5068
+ "type": "button",
5069
+ "badge": {
5070
+ "offset": [
5071
+ -5,
5072
+ 1
5073
+ ],
5074
+ "size":8,
5075
+ "animation": true,
5076
+ "visibleOn": "${isFieldsFilterEmpty == false}"
5077
+ },
5078
+ "align": "right",
5079
+ "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
5080
+ "onEvent": {
5081
+ "click": {
5082
+ "actions": [
4631
5083
  {
4632
- "type": "button",
4633
- "visibleOn": "${false}",
4634
- "label": "保存宽度(todo)"
4635
- },
4636
- // {
4637
- // type: 'steedos-object-button',
4638
- // name: 'standard_delete',
4639
- // objectName: 'test0321__c',
4640
- // // visibleOn: getButtonVisibleOn(button),
4641
- // className: 'antd-Button--default'
4642
- // }
5084
+ "actionType": "custom",
5085
+ "script": onFieldsFilterToggleScript
5086
+ }
4643
5087
  ]
4644
5088
  }
4645
- ]
5089
+ }
5090
+ } : {},
5091
+ getDisplayAsButton(mainObject?.name)
5092
+ ]
5093
+ }else {
5094
+ return [
5095
+ // "filter-toggler",
5096
+ ...(headerToolbarItems || []),
5097
+ "bulkActions",
5098
+ {
5099
+ "type": "columns-toggler",
5100
+ "className": "hidden"
5101
+ },
5102
+ // {
5103
+ // "type": "columns-toggler",
5104
+ // "className": "mr-2"
5105
+ // },
5106
+ hiddenCount ? {} : {
5107
+ "type": "tpl",
5108
+ "tpl": "${count} 个项目"
5109
+ },
5110
+ {
5111
+ "type": "reload",
5112
+ "align": "right",
5113
+ "tooltipPlacement": "bottom",
5114
+ "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
4646
5115
  },
5116
+ getExportExcelToolbarButtonSchema(),
5117
+ filterVisible ? {
5118
+ "label": "",
5119
+ "icon": "fa fa-search",
5120
+ "type": "button",
5121
+ "align": "right",
5122
+ "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
5123
+ "onEvent": {
5124
+ "click": {
5125
+ "actions": [
5126
+ {
5127
+ "actionType": "custom",
5128
+ "script": onFieldsFilterToggleScript
5129
+ }
5130
+ ]
5131
+ }
5132
+ }
5133
+ } : {},
5134
+ getSettingListviewToolbarButtonSchema(),
4647
5135
  getDisplayAsButton(showDisplayAs)
4648
5136
  // {
4649
5137
  // "type": "search-box",
@@ -5122,20 +5610,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
5122
5610
  }
5123
5611
  }
5124
5612
 
5125
- var searchableFilter = [];
5126
- _.each(selfData, (value, key)=>{
5127
- if(!_.isEmpty(value) || _.isBoolean(value)){
5128
- if(_.startsWith(key, '__searchable__between__')){
5129
- searchableFilter.push([\`\${key.replace("__searchable__between__", "")}\`, "between", value])
5130
- }else if(_.startsWith(key, '__searchable__')){
5131
- if(_.isString(value)){
5132
- searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "contains", value])
5133
- }else{
5134
- searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "=", value])
5135
- }
5136
- }
5137
- }
5138
- });
5613
+ var searchableFilter = SteedosUI.getSearchFilter(selfData) || [];
5139
5614
 
5140
5615
  if(searchableFilter.length > 0){
5141
5616
  if(filters.length > 0 ){
@@ -6557,6 +7032,29 @@ if(typeof window != 'undefined'){
6557
7032
  window.getFieldSearchable = getFieldSearchable;
6558
7033
  }
6559
7034
 
7035
+
7036
+ function isFieldTypeSearchable(fieldType) {
7037
+ return !___default.includes(
7038
+ [
7039
+ "grid",
7040
+ "avatar",
7041
+ "image",
7042
+ "object",
7043
+ "[object]",
7044
+ "[Object]",
7045
+ "[grid]",
7046
+ "[text]",
7047
+ "audio",
7048
+ "file",
7049
+ ],
7050
+ fieldType
7051
+ )
7052
+ }
7053
+
7054
+ if (typeof window != 'undefined') {
7055
+ window.isFieldTypeSearchable = isFieldTypeSearchable;
7056
+ }
7057
+
6560
7058
  var index = /*#__PURE__*/Object.freeze({
6561
7059
  __proto__: null,
6562
7060
  OMIT_FIELDS: OMIT_FIELDS,
@@ -6568,6 +7066,7 @@ var index = /*#__PURE__*/Object.freeze({
6568
7066
  getSelectFieldOptions: getSelectFieldOptions,
6569
7067
  convertSFieldToAmisField: convertSFieldToAmisField,
6570
7068
  getFieldSearchable: getFieldSearchable,
7069
+ isFieldTypeSearchable: isFieldTypeSearchable,
6571
7070
  getAmisStaticFieldType: getAmisStaticFieldType
6572
7071
  });
6573
7072
 
@@ -7179,7 +7678,7 @@ async function getObjectCRUD(objectSchema, fields, options){
7179
7678
  id: `service_${id}`,
7180
7679
  name: `page`,
7181
7680
  data: {
7182
- // objectName: objectSchema.name,
7681
+ objectName: objectSchema.name,
7183
7682
  // _id: null,
7184
7683
  recordPermissions: objectSchema.permissions,
7185
7684
  uiSchema: objectSchema,
@@ -7997,20 +8496,8 @@ async function getTableApi(mainObject, fields, options){
7997
8496
  }else if(selfData.op === 'loadOptions' && selfData.value){
7998
8497
  userFilters = [["${valueField.name}", "=", selfData.value]];
7999
8498
  }
8000
- var searchableFilter = [];
8001
- _.each(selfData, (value, key)=>{
8002
- if(!_.isEmpty(value) || _.isBoolean(value)){
8003
- if(_.startsWith(key, '__searchable__between__')){
8004
- searchableFilter.push([\`\${key.replace("__searchable__between__", "")}\`, "between", value])
8005
- }else if(_.startsWith(key, '__searchable__')){
8006
- if(_.isString(value)){
8007
- searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "contains", value])
8008
- }else{
8009
- searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "=", value])
8010
- }
8011
- }
8012
- }
8013
- });
8499
+
8500
+ var searchableFilter = SteedosUI.getSearchFilter(selfData) || [];
8014
8501
 
8015
8502
  if(searchableFilter.length > 0){
8016
8503
  if(userFilters.length > 0 ){
@@ -8281,20 +8768,7 @@ async function getCalendarApi(mainObject, fields, options) {
8281
8768
  }else if(selfData.op === 'loadOptions' && selfData.value){
8282
8769
  filters = [["${valueField.name}", "=", selfData.value]];
8283
8770
  }
8284
- var searchableFilter = [];
8285
- _.each(selfData, (value, key)=>{
8286
- if(!_.isEmpty(value) || _.isBoolean(value)){
8287
- if(_.startsWith(key, '__searchable__between__')){
8288
- searchableFilter.push([\`\${key.replace("__searchable__between__", "")}\`, "between", value])
8289
- }else if(_.startsWith(key, '__searchable__')){
8290
- if(_.isString(value)){
8291
- searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "contains", value])
8292
- }else{
8293
- searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "=", value])
8294
- }
8295
- }
8296
- }
8297
- });
8771
+ var searchableFilter = SteedosUI.getSearchFilter(selfData) || [];
8298
8772
 
8299
8773
  if(searchableFilter.length > 0){
8300
8774
  if(filters.length > 0 ){
@@ -8820,7 +9294,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
8820
9294
  * @Author: baozhoutao@steedos.com
8821
9295
  * @Date: 2022-07-05 15:55:39
8822
9296
  * @LastEditors: Please set LastEditors
8823
- * @LastEditTime: 2023-05-08 16:34:25
9297
+ * @LastEditTime: 2023-05-17 09:09:33
8824
9298
  * @Description:
8825
9299
  */
8826
9300
 
@@ -8960,7 +9434,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
8960
9434
  // } else {
8961
9435
  // globalFilter = [`${relatedKey}`, "=", relatedValue];
8962
9436
  // }
8963
- const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel);
9437
+ const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel, ctx);
8964
9438
  const componentId = `steedos-record-related-list-${relatedObjectName}`;
8965
9439
  const options = {
8966
9440
  globalFilter,
@@ -12609,6 +13083,7 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
12609
13083
  getObjectListHeaderSecordLine: getObjectListHeaderSecordLine,
12610
13084
  getObjectListViewButtonsSchemas: getObjectListViewButtonsSchemas,
12611
13085
  getObjectRecordDetailHeader: getObjectRecordDetailHeader,
13086
+ getObjectRecordDetailRelatedListButtonsSchemas: getObjectRecordDetailRelatedListButtonsSchemas,
12612
13087
  getObjectRecordDetailRelatedListHeader: getObjectRecordDetailRelatedListHeader,
12613
13088
  getObjectRelated: getObjectRelated,
12614
13089
  getObjectRelatedList: getObjectRelatedList,
@@ -13506,11 +13981,12 @@ var AmisRecordService = function (props) { return __awaiter(void 0, void 0, void
13506
13981
  }); };
13507
13982
 
13508
13983
  var AmisRecordDetailRelatedList = function (props) { return __awaiter(void 0, void 0, void 0, function () {
13509
- var $schema, objectApiName, recordId, relatedObjectApiName, relatedKey, top, perPage, hiddenEmptyTable, appId, relatedLabel, _a, className, columns, sort, filters, visible_on, requestAdaptor, adaptor, formFactor, formData, schema;
13510
- return __generator(this, function (_b) {
13511
- switch (_b.label) {
13984
+ var $schema, objectApiName, recordId, relatedObjectApiName, data, relatedKey, top, perPage, hiddenEmptyTable, appId, relatedLabel, _a, className, columns, sort, filters, visible_on, requestAdaptor, adaptor, formFactor, formData, schema;
13985
+ var _b;
13986
+ return __generator(this, function (_c) {
13987
+ switch (_c.label) {
13512
13988
  case 0:
13513
- $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;
13989
+ $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;
13514
13990
  formFactor = props.formFactor;
13515
13991
  if (!formFactor) {
13516
13992
  formFactor = window.innerWidth < 768 ? 'SMALL' : 'LARGE';
@@ -13531,8 +14007,17 @@ var AmisRecordDetailRelatedList = function (props) { return __awaiter(void 0, vo
13531
14007
  }
13532
14008
  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 })];
13533
14009
  case 1:
13534
- schema = (_b.sent()).amisSchema;
14010
+ schema = (_c.sent()).amisSchema;
13535
14011
  schema.data = Object.assign(schema.data, formData);
14012
+ if (has(props, "recordId") && $schema.recordId !== "${recordId}") {
14013
+ schema.data = Object.assign(schema.data, {
14014
+ _master: {
14015
+ record: (_b = data === null || data === void 0 ? void 0 : data._master) === null || _b === void 0 ? void 0 : _b.record,
14016
+ objectName: objectApiName,
14017
+ recordId: recordId
14018
+ }
14019
+ });
14020
+ }
13536
14021
  return [2 /*return*/, schema];
13537
14022
  }
13538
14023
  });
@@ -14204,7 +14689,16 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
14204
14689
  },
14205
14690
  "adaptor": "return payload.data"
14206
14691
  },
14207
- "interval": 30000,
14692
+ "onEvent": {
14693
+ "@data.changed.notifications": {
14694
+ "actions": [
14695
+ {
14696
+ "actionType": "reload"
14697
+ }
14698
+ ]
14699
+ }
14700
+ },
14701
+ // "interval": 30000,
14208
14702
  "silentPolling": true
14209
14703
  }
14210
14704
  ],
@@ -14292,6 +14786,15 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
14292
14786
  },
14293
14787
  ],
14294
14788
  "id": "u:aba521eed5b7",
14789
+ "onEvent": {
14790
+ "@data.changed.notifications": {
14791
+ "actions": [
14792
+ {
14793
+ "actionType": "reload"
14794
+ }
14795
+ ]
14796
+ }
14797
+ },
14295
14798
  "messages": {},
14296
14799
  "api": {
14297
14800
  "method": "post",
@@ -14450,8 +14953,8 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
14450
14953
  /*
14451
14954
  * @Author: baozhoutao@steedos.com
14452
14955
  * @Date: 2022-09-01 14:44:57
14453
- * @LastEditors: baozhoutao@steedos.com
14454
- * @LastEditTime: 2023-04-11 13:51:50
14956
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
14957
+ * @LastEditTime: 2023-05-17 17:26:22
14455
14958
  * @Description:
14456
14959
  */
14457
14960
  var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void 0, function () {
@@ -14472,8 +14975,17 @@ var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void
14472
14975
  "className": 'flex w-full px-4 h-[50px] p-0 justify-between items-center steedos-header-container-line-one',
14473
14976
  "body": [
14474
14977
  {
14475
- type: "wrapper",
14978
+ type: "service",
14476
14979
  className: 'p-0 flex flex-1 items-center',
14980
+ "onEvent": {
14981
+ "@history_paths.changed": {
14982
+ "actions": [
14983
+ {
14984
+ "actionType": "reload"
14985
+ }
14986
+ ]
14987
+ }
14988
+ },
14477
14989
  body: [
14478
14990
  {
14479
14991
  "type": "button",
@@ -14500,10 +15012,35 @@ var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void
14500
15012
  }
14501
15013
  ],
14502
15014
  },
15015
+ {
15016
+ "type": "button",
15017
+ "visibleOn": "${window:innerWidth < 768 && window:historyPaths.length > 1}",
15018
+ "className": "flex",
15019
+ "onEvent": {
15020
+ "click": {
15021
+ "actions": [
15022
+ {
15023
+ "actionType": "custom",
15024
+ "script": "Steedos.goBack()"
15025
+ }
15026
+ ]
15027
+ }
15028
+ },
15029
+ "body": [
15030
+ {
15031
+ "type": "steedos-icon",
15032
+ "category": "utility",
15033
+ "name": "chevronleft",
15034
+ "colorVariant": "default",
15035
+ "className": "slds-button_icon slds-global-header__icon"
15036
+ }
15037
+ ]
15038
+ },
14503
15039
  {
14504
15040
  "className": 'block h-10 w-auto mr-4',
14505
15041
  "type": "tpl",
14506
15042
  "tpl": "<a href='/app' class='flex items-center '><img class='block h-10 w-auto' src='".concat(logoSrc, "'></a>"),
15043
+ "hiddenOn": "${window:innerWidth < 768 && window:historyPaths.length > 1}"
14507
15044
  },
14508
15045
  ],
14509
15046
  },
@@ -14722,6 +15259,7 @@ var getSelectFlowSchema = function (id, props) {
14722
15259
  "method": "post",
14723
15260
  "url": "${context.rootUrl}/graphql?keywords=${keywords}",
14724
15261
  "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 "),
15262
+ "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 ",
14725
15263
  "headers": {
14726
15264
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
14727
15265
  }
@@ -14965,7 +15503,7 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
14965
15503
  });
14966
15504
  }); };
14967
15505
 
14968
- 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]=useState(!0);var r=()=>{n(!1);};return has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{n(!0);},close:r}),React.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.createElement(newFunctionComponent(r),e);createRoot(t).render(e);},Modal=assign(newComponentRender("modal",Modal$1),{info:Modal$1.info,success:Modal$1.success,error:Modal$1.error,warning:Modal$1.warning,confirm:Modal$1.confirm}),Drawer=newComponentRender("drawer",Drawer$1),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),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):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 createElement(t,e)}},render=function(e,t,n,r){e=withModalWrap(e),e=createElement(e,__assign({},t));return ReactDOM.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 isNil(n)||(e=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})`)),isFunction(n)&&(n=safeRunFunction(n,[],null,{name:e.name})),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||isString(n)?"number"!==t||isNumber(n)?"boolean"!==t||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:message,notification:notification,components:{Button:Button,Space: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);
15506
+ 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]=useState(!0);var n=()=>{r(!1);};return has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React.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.createElement(newFunctionComponent(n),e);createRoot(t).render(e);},Modal=assign(newComponentRender("modal",Modal$1),{info:Modal$1.info,success:Modal$1.success,error:Modal$1.error,warning:Modal$1.warning,confirm:Modal$1.confirm}),Drawer=newComponentRender("drawer",Drawer$1),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),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):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 createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=createElement(e,__assign({},t));return ReactDOM.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 isNil(r)||(e=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})`)),isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),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||isString(r)?"number"!==t||isNumber(r)?"boolean"!==t||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:message,notification:notification,components:{Button:Button,Space: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);
14969
15507
 
14970
15508
  var index_esm = /*#__PURE__*/Object.freeze({
14971
15509
  __proto__: null,