@steedos-widgets/amis-object 1.2.0 → 1.2.2

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.
@@ -1748,8 +1748,8 @@
1748
1748
  /*
1749
1749
  * @Author: baozhoutao@steedos.com
1750
1750
  * @Date: 2022-11-01 15:51:00
1751
- * @LastEditors: Please set LastEditors
1752
- * @LastEditTime: 2023-04-11 13:58:24
1751
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
1752
+ * @LastEditTime: 2023-04-16 17:04:16
1753
1753
  * @Description:
1754
1754
  */
1755
1755
 
@@ -1827,6 +1827,7 @@
1827
1827
  "context": "${context}",
1828
1828
  "global": "${global}",
1829
1829
  "listViewId": "${listViewId}",
1830
+ "displayAs": "${displayAs}",
1830
1831
  "uiSchema": "${uiSchema}",
1831
1832
  "isLookup": "${isLookup}",
1832
1833
  "listName": "${listName}"
@@ -1970,8 +1971,8 @@
1970
1971
  /*
1971
1972
  * @Author: 殷亮辉 yinlianghui@hotoa.com
1972
1973
  * @Date: 2023-03-22 09:31:21
1973
- * @LastEditors: baozhoutao@steedos.com
1974
- * @LastEditTime: 2023-04-06 16:04:20
1974
+ * @LastEditors: Please set LastEditors
1975
+ * @LastEditTime: 2023-04-12 10:35:36
1975
1976
  */
1976
1977
  const getSchema$2 = (uiSchema)=>{
1977
1978
  return {
@@ -2026,7 +2027,8 @@
2026
2027
  "eventName": "@data.changed.${_master.objectName}"
2027
2028
  },
2028
2029
  "data": {
2029
- "objectName": "${_master.objectName}"
2030
+ "objectName": "${_master.objectName}",
2031
+ "_isRelated": "${_isRelated}"
2030
2032
  },
2031
2033
  "expression": `\${_master.objectName != '${uiSchema.name}' && _master.objectName}`
2032
2034
  }
@@ -3742,6 +3744,9 @@
3742
3744
  };
3743
3745
  };
3744
3746
 
3747
+
3748
+
3749
+
3745
3750
  const onFieldsFilterToggleScript = `
3746
3751
  const scope = event.context.scoped;
3747
3752
  const filterForm = scope.getComponents().find(function(n){
@@ -3759,7 +3764,6 @@ setTimeout(()=>{
3759
3764
 
3760
3765
  function getExportApiRequestAdaptorScript(){
3761
3766
  return `
3762
- console.log(api.url);
3763
3767
  // 获取列表视图的属性
3764
3768
  let uiSchema = api.body.uiSchema;
3765
3769
  let list_views = uiSchema.list_views;
@@ -3808,12 +3812,12 @@ setTimeout(()=>{
3808
3812
  if (filters && filters.length > 0) {
3809
3813
  api.url = api.url + "&filters=" + JSON.stringify(filters);
3810
3814
  }
3811
- console.log(api.url);
3812
3815
  return api;
3813
3816
  `
3814
3817
  }
3815
3818
 
3816
- function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false, hiddenCount = false, headerToolbarItems} = {}){
3819
+ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false, hiddenCount = false, headerToolbarItems, filterVisible = true} = {}){
3820
+ // console.log(`getObjectHeaderToolbar====>`, filterVisible)
3817
3821
  const isMobile = window.innerWidth < 768;
3818
3822
  if(isMobile){
3819
3823
  showDisplayAs = false;
@@ -3850,7 +3854,7 @@ setTimeout(()=>{
3850
3854
  }
3851
3855
  },
3852
3856
  },
3853
- {
3857
+ filterVisible ? {
3854
3858
  "label": "",
3855
3859
  "icon": "fa fa-search",
3856
3860
  "type": "button",
@@ -3866,7 +3870,7 @@ setTimeout(()=>{
3866
3870
  ]
3867
3871
  }
3868
3872
  }
3869
- },
3873
+ } : {},
3870
3874
  showDisplayAs? getDisplayAsButton(mainObject?.name) : {}
3871
3875
  ]
3872
3876
  }else {
@@ -3882,10 +3886,6 @@ setTimeout(()=>{
3882
3886
  // "type": "columns-toggler",
3883
3887
  // "className": "mr-2"
3884
3888
  // },
3885
- // {
3886
- // "type": "export-excel",
3887
- // "align": "right"
3888
- // },
3889
3889
  hiddenCount ? {} : {
3890
3890
  "type": "tpl",
3891
3891
  "tpl": "${count} 个项目"
@@ -3931,7 +3931,7 @@ setTimeout(()=>{
3931
3931
  }
3932
3932
  }
3933
3933
  },
3934
- {
3934
+ filterVisible ? {
3935
3935
  "label": "",
3936
3936
  "icon": "fa fa-search",
3937
3937
  "type": "button",
@@ -3947,8 +3947,524 @@ setTimeout(()=>{
3947
3947
  ]
3948
3948
  }
3949
3949
  }
3950
+ } : {},
3951
+ {
3952
+ "type": "dropdown-button",
3953
+ "trigger": "click",
3954
+ "icon": "fa fa-cog",
3955
+ "btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
3956
+ "align": "right",
3957
+ "visibleOn": "${!isLookup}",
3958
+ "buttons": [
3959
+ {
3960
+ "label": "列表视图操作",
3961
+ "children": [
3962
+ {
3963
+ "type": "button",
3964
+ "label": "新建",
3965
+ "onEvent": {
3966
+ "click": {
3967
+ "weight": 0,
3968
+ "actions": [
3969
+ {
3970
+ "dialog": {
3971
+ "type": "dialog",
3972
+ "title": "新建 列表视图",
3973
+ "data": {
3974
+ "&": "$$",
3975
+ "all": "${uiSchema.list_views.all}",
3976
+ "list_view": "${uiSchema.list_views[listName]}",
3977
+ "appId": "${appId}",
3978
+ "global": "${global}",
3979
+ "objectName": "${objectName}",
3980
+ },
3981
+ "body": [
3982
+ {
3983
+ "type": "steedos-object-form",
3984
+ "label": "对象表单",
3985
+ "objectApiName": "object_listviews",
3986
+ "recordId": "",
3987
+ "mode": "edit",
3988
+ "defaultData": {
3989
+ "&": "${list_view}",
3990
+ "name":"",
3991
+ "label":"",
3992
+ "filters":"",
3993
+ "shared":false
3994
+ },
3995
+ "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}",
3996
+ "fields": [
3997
+ "label",
3998
+ "name",
3999
+ "object_name",
4000
+ "filter_scope",
4001
+ "show_count",
4002
+ "columns.$.field",
4003
+ "columns.$.width",
4004
+ "sort.$.field_name",
4005
+ "sort.$.order",
4006
+ "filters",
4007
+ "mobile_columns.$.field",
4008
+ "searchable_fields.$.field",
4009
+ "is_system",
4010
+ "shared"
4011
+ ],
4012
+ "onEvent": {
4013
+ "submitSucc": {
4014
+ "weight": 0,
4015
+ "actions": [
4016
+ {
4017
+ "args": {
4018
+ // 直接使用recordId不能拿到数据,只能通过result里面拿数据
4019
+ "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/listview_${result.data.recordId|lowerCase}",
4020
+ "blank": false
4021
+ },
4022
+ "actionType": "url",
4023
+ }
4024
+ ]
4025
+ }
4026
+ },
4027
+ "messages": {
4028
+ "success": "成功",
4029
+ "failed": "失败"
4030
+ },
4031
+ }
4032
+ ],
4033
+ "showCloseButton": true,
4034
+ "showErrorMsg": true,
4035
+ "showLoading": true,
4036
+ "closeOnEsc": false,
4037
+ "dataMapSwitch": false,
4038
+ "size": "lg"
4039
+ },
4040
+ "actionType": "dialog"
4041
+ }
4042
+ ]
4043
+ }
4044
+ }
4045
+ },
4046
+ {
4047
+ "type": "button",
4048
+ "label": "复制",
4049
+ "onEvent": {
4050
+ "click": {
4051
+ "weight": 0,
4052
+ "actions": [
4053
+ {
4054
+ "dialog": {
4055
+ "type": "dialog",
4056
+ "title": "复制 列表视图",
4057
+ "data": {
4058
+ "&": "$$",
4059
+ "listName": "${listName}",
4060
+ "objectName": "${objectName}",
4061
+ "list_view": "${uiSchema.list_views[listName]}",
4062
+ "appId": "${appId}",
4063
+ "global": "${global}"
4064
+ },
4065
+ "body": [
4066
+ {
4067
+ "type": "steedos-object-form",
4068
+ "label": "对象表单",
4069
+ "objectApiName": "object_listviews",
4070
+ "recordId": "",
4071
+ "mode": "edit",
4072
+ "fields": [
4073
+ ],
4074
+ "defaultData": {
4075
+ "&": "${list_view}",
4076
+ "name":"",
4077
+ "label": "${list_view.label}的副本",
4078
+ "shared":false
4079
+ },
4080
+ "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}",
4081
+ "fields": [
4082
+ "label",
4083
+ "name",
4084
+ "object_name",
4085
+ "filter_scope",
4086
+ "show_count",
4087
+ "columns.$.field",
4088
+ "columns.$.width",
4089
+ "sort.$.field_name",
4090
+ "sort.$.order",
4091
+ "filters",
4092
+ "mobile_columns.$.field",
4093
+ "searchable_fields.$.field",
4094
+ "is_system",
4095
+ "shared"
4096
+ ],
4097
+ "onEvent": {
4098
+ "submitSucc": {
4099
+ "weight": 0,
4100
+ "actions": [
4101
+ {
4102
+ "args": {
4103
+ "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/listview_${result.data.recordId|lowerCase}",
4104
+ "blank": false
4105
+ },
4106
+ "actionType": "url",
4107
+ }
4108
+ ]
4109
+ }
4110
+ }
4111
+ }
4112
+ ],
4113
+ "showCloseButton": true,
4114
+ "showErrorMsg": true,
4115
+ "showLoading": true,
4116
+ "closeOnEsc": false,
4117
+ "dataMapSwitch": false,
4118
+ "size": "lg"
4119
+ },
4120
+ "actionType": "dialog"
4121
+ }
4122
+ ]
4123
+ }
4124
+ }
4125
+ },
4126
+ {
4127
+ "type": "button",
4128
+ "label": "重命名",
4129
+ "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4130
+ "onEvent": {
4131
+ "click": {
4132
+ "weight": 0,
4133
+ "actions": [
4134
+ {
4135
+ "dialog": {
4136
+ "type": "dialog",
4137
+ "title": "重命名 列表视图",
4138
+ "data": {
4139
+ "objectName": "${objectName}",
4140
+ "recordId": "${uiSchema.list_views[listName]._id}",
4141
+ "appId": "${appId}"
4142
+ },
4143
+ "body": [
4144
+ {
4145
+ "type": "steedos-object-form",
4146
+ "label": "对象表单",
4147
+ "objectApiName": "object_listviews",
4148
+ "recordId": "${recordId}",
4149
+ "mode": "edit",
4150
+ "fields": [
4151
+ "label"
4152
+ ],
4153
+ "fieldsExtend": "{\n \"label\":{\n \"is_wide\": true\n }\n}",
4154
+ "onEvent": {
4155
+ "submitSucc": {
4156
+ "weight": 0,
4157
+ "actions": [
4158
+ {
4159
+ "args": {
4160
+ "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${name}",
4161
+ "blank": false
4162
+ },
4163
+ "actionType": "url",
4164
+ },
4165
+ ]
4166
+ }
4167
+ }
4168
+ }
4169
+ ],
4170
+ "showCloseButton": true,
4171
+ "showErrorMsg": true,
4172
+ "showLoading": true,
4173
+ "size": "lg"
4174
+ },
4175
+ "actionType": "dialog"
4176
+ }
4177
+ ]
4178
+ }
4179
+ }
4180
+ },
4181
+ {
4182
+ "type": "button",
4183
+ "label": "共享设置",
4184
+ "disabledOn": "!(global.user.is_space_admin && !!uiSchema.list_views[listName].owner)",
4185
+ "onEvent": {
4186
+ "click": {
4187
+ "weight": 0,
4188
+ "actions": [
4189
+ {
4190
+ "dialog": {
4191
+ "type": "dialog",
4192
+ "title": "共享设置",
4193
+ "data": {
4194
+ "recordId": "${uiSchema.list_views[listName]._id}",
4195
+ },
4196
+ "body": [
4197
+ {
4198
+ "type": "steedos-object-form",
4199
+ "label": "对象表单",
4200
+ "objectApiName": "object_listviews",
4201
+ "recordId": "${recordId}",
4202
+ "mode": "edit",
4203
+ "fields": [
4204
+ "shared"
4205
+ ]
4206
+ }
4207
+ ],
4208
+ "showCloseButton": true,
4209
+ "showErrorMsg": true,
4210
+ "showLoading": true,
4211
+ "closeOnEsc": false,
4212
+ "dataMapSwitch": false,
4213
+ "size": "md"
4214
+ },
4215
+ "actionType": "dialog"
4216
+ }
4217
+ ]
4218
+ }
4219
+ }
4220
+ },
4221
+ {
4222
+ "type": "button",
4223
+ "label": "过滤设置",
4224
+ "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4225
+ "onEvent": {
4226
+ "click": {
4227
+ "weight": 0,
4228
+ "actions": [
4229
+ {
4230
+ "dialog": {
4231
+ "type": "dialog",
4232
+ "title": "过滤设置",
4233
+ "data": {
4234
+ "objectName": "${objectName}",
4235
+ "recordId": "${uiSchema.list_views[listName]._id}",
4236
+ "listName": "${listName}",
4237
+ "appId": "${appId}"
4238
+ },
4239
+ "body": [
4240
+ {
4241
+ "type": "steedos-object-form",
4242
+ "label": "对象表单",
4243
+ "objectApiName": "object_listviews",
4244
+ "recordId": "${recordId}",
4245
+ "mode": "edit",
4246
+ "initApiAdaptor": "",
4247
+ "fields": [
4248
+ "filters"
4249
+ ],
4250
+ "initApiRequestAdaptor": "",
4251
+ "initApiAdaptor": "const recordId_tmp = api.body.recordId;\nlet data_tmp;\nif (recordId_tmp) {\n data_tmp = payload.data.initialValues;\n // 数据格式转换\n if (data_tmp) {\n if (data_tmp.filters && lodash.isString(data_tmp.filters)) {\n try {\n data_tmp.filters = JSON.parse(data_tmp.filters);\n } catch (e) { }\n }\n\n if (data_tmp.filters && lodash.isString(data_tmp.filters)) {\n data_tmp._filters_type_controller = 'function';\n } else {\n data_tmp._filters_type_controller = 'conditions'\n }\n\n if (data_tmp._filters_type_controller === 'conditions') {\n data_tmp._filters_conditions = window.amisConvert.filtersToConditions(data_tmp.filters || []);\n data_tmp.filters = data_tmp._filters_conditions;\n } else {\n data_tmp._filters_function = data_tmp.filters;\n }\n }\n}\nfor (key in data_tmp) {\n if (data_tmp[key] === null) {\n delete data_tmp[key];\n }\n}\npayload.data.initialValues = Object.assign(payload.data.initialValues, data_tmp);\ndelete payload.extensions;",
4252
+ "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",
4253
+ "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}",
4254
+ "onEvent": {
4255
+ "submitSucc": {
4256
+ "weight": 0,
4257
+ "actions": [
4258
+ {
4259
+ "args": {
4260
+ "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${listName}",
4261
+ "blank": false
4262
+ },
4263
+ "actionType": "url",
4264
+ }
4265
+ ]
4266
+ }
4267
+ }
4268
+ }
4269
+ ],
4270
+ "showCloseButton": true,
4271
+ "showErrorMsg": true,
4272
+ "showLoading": true,
4273
+ "closeOnEsc": false,
4274
+ "dataMapSwitch": false,
4275
+ "size": "lg"
4276
+ },
4277
+ "actionType": "dialog"
4278
+ }
4279
+ ]
4280
+ }
4281
+ }
4282
+ },
4283
+ {
4284
+ "type": "button",
4285
+ "label": "显示的列",
4286
+ "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4287
+ "onEvent": {
4288
+ "click": {
4289
+ "weight": 0,
4290
+ "actions": [
4291
+ {
4292
+ "args": {},
4293
+ "dialog": {
4294
+ "type": "dialog",
4295
+ "title": "显示的列",
4296
+ "data": {
4297
+ "&": "$$",
4298
+ "objectName": "${objectName}",
4299
+ "recordId": "${uiSchema.list_views[listName]._id}",
4300
+ "listName": "${listName}",
4301
+ "appId": "${appId}"
4302
+ },
4303
+ "body": [
4304
+ {
4305
+ "type": "steedos-object-form",
4306
+ "label": "对象表单",
4307
+ "objectApiName": "object_listviews",
4308
+ "recordId": "${recordId}",
4309
+ "mode": "edit",
4310
+ "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}",
4311
+ "initApiAdaptor": "const recordId_tmp = api.body.recordId;\nlet columns_tmp = {}, mobile_columns_tmp = {};\nif (recordId_tmp) {\n columns_tmp = payload.data.initialValues.columns;\n mobile_columns_tmp = payload.data.initialValues.mobile_columns;\n if (columns_tmp) {\n columns_tmp = lodash.map(columns_tmp, 'field');\n }\n if (mobile_columns_tmp) {\n mobile_columns_tmp = lodash.map(mobile_columns_tmp, 'field');\n }\n}\npayload.data.initialValues.columns = columns_tmp;\npayload.data.initialValues.mobile_columns = mobile_columns_tmp;\n\ndelete payload.extensions;\nreturn payload;",
4312
+ "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;",
4313
+ "fields": [
4314
+ "columns",
4315
+ "mobile_columns"
4316
+ ],
4317
+ "onEvent": {
4318
+ "submitSucc": {
4319
+ "weight": 0,
4320
+ "actions": [
4321
+ {
4322
+ "args": {
4323
+ "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${listName}",
4324
+ "blank": false
4325
+ },
4326
+ "actionType": "url"
4327
+ }
4328
+ ]
4329
+ }
4330
+ }
4331
+ }
4332
+ ],
4333
+ "searchable": true,
4334
+ "showCloseButton": true,
4335
+ "showErrorMsg": true,
4336
+ "showLoading": true,
4337
+ "size": "lg"
4338
+ },
4339
+ "actionType": "dialog"
4340
+ }
4341
+ ]
4342
+ }
4343
+ }
4344
+ },
4345
+ {
4346
+ "type": "button",
4347
+ "label": "默认排序规则",
4348
+ "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4349
+ "onEvent": {
4350
+ "click": {
4351
+ "weight": 0,
4352
+ "actions": [
4353
+ {
4354
+ "dialog": {
4355
+ "type": "dialog",
4356
+ "title": "弹框标题",
4357
+ "data": {
4358
+ "&": "$$",
4359
+ "objectName": "${objectName}",
4360
+ "recordId": "${uiSchema.list_views[listName]._id}",
4361
+ "listName": "${listName}",
4362
+ "appId": "${appId}"
4363
+ },
4364
+ "body": [
4365
+ {
4366
+ "type": "steedos-object-form",
4367
+ "label": "对象表单",
4368
+ "objectApiName": "object_listviews",
4369
+ "recordId": "${recordId}",
4370
+ "className": "",
4371
+ "id": "u:061f158b4c5a",
4372
+ "mode": "edit",
4373
+ "fields": [
4374
+ "sort",
4375
+ "sort.$.field_name",
4376
+ "sort.$.order"
4377
+ ],
4378
+ "onEvent": {
4379
+ "submitSucc": {
4380
+ "weight": 0,
4381
+ "actions": [
4382
+ {
4383
+ "args": {
4384
+ "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${listName}",
4385
+ "blank": false
4386
+ },
4387
+ "actionType": "url"
4388
+ }
4389
+ ]
4390
+ }
4391
+ },
4392
+ "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}",
4393
+ "initApiAdaptor": "let sort;\nif (recordId) {\n sort = payload.data.initialValues.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.initialValues.sort = sort;\ndelete payload.extensions;",
4394
+ "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"
4395
+ }
4396
+ ],
4397
+ "showCloseButton": true,
4398
+ "showErrorMsg": true,
4399
+ "showLoading": true,
4400
+ "id": "u:d3f6947b6acf",
4401
+ "size": "lg"
4402
+ },
4403
+ "actionType": "dialog"
4404
+ }
4405
+ ]
4406
+ }
4407
+ }
4408
+ },
4409
+ {
4410
+ "type": "button",
4411
+ "label": "删除",
4412
+ "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4413
+ "confirmText": "如果您删除此列表视图,该视图将为所有具备访问权限的用户永久删除。是否确定要删除?",
4414
+ "onEvent": {
4415
+ "click": {
4416
+ "actions": [
4417
+ {
4418
+ "actionType": "ajax",
4419
+ "args": {
4420
+ "api": {
4421
+ "url": "${context.rootUrl}/graphql",
4422
+ "method": "post",
4423
+ "headers": {
4424
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
4425
+ },
4426
+ "data": {
4427
+ "&": "$$",
4428
+ "uiSchema": "${uiSchema}",
4429
+ "recordId": "${uiSchema.list_views[listName]._id}"
4430
+ },
4431
+ "messages": {
4432
+ "success": "删除成功"
4433
+ },
4434
+ "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",
4435
+ "adaptor": "if (payload.errors) {\n payload.status = 2;\n payload.msg = payload.errors[0].message;\n}\nreturn payload;",
4436
+ }
4437
+ }
4438
+ },
4439
+ {
4440
+ "actionType": "url",
4441
+ "args": {
4442
+ "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/all",
4443
+ "blank": false
4444
+ },
4445
+ "expression": "data.delete == 1"
4446
+ }
4447
+ ]
4448
+ }
4449
+ }
4450
+ },
4451
+ {
4452
+ "type": "button",
4453
+ "visibleOn": "${false}",
4454
+ "label": "保存宽度(todo)"
4455
+ },
4456
+ // {
4457
+ // type: 'steedos-object-button',
4458
+ // name: 'standard_delete',
4459
+ // objectName: 'test0321__c',
4460
+ // // visibleOn: getButtonVisibleOn(button),
4461
+ // className: 'antd-Button--default'
4462
+ // }
4463
+ ]
4464
+ }
4465
+ ]
3950
4466
  },
3951
- showDisplayAs? getDisplayAsButton(showDisplayAs) : {}
4467
+ showDisplayAs ? getDisplayAsButton(showDisplayAs) : {}
3952
4468
  // {
3953
4469
  // "type": "search-box",
3954
4470
  // "align": "right",
@@ -4231,6 +4747,7 @@ setTimeout(()=>{
4231
4747
  const tree = [{
4232
4748
  "type": "input-tree",
4233
4749
  "className": "",
4750
+ "inputClassName": "pl-0",
4234
4751
  "id": "u:7fd77b7915b0",
4235
4752
  "source": {
4236
4753
  "method": "post",
@@ -4253,7 +4770,6 @@ setTimeout(()=>{
4253
4770
  {
4254
4771
  "actionType": "custom",
4255
4772
  "script": `
4256
- debugger;
4257
4773
  const scope = event.context.scoped;
4258
4774
  //TODO: 将form中的value一同加入筛选内
4259
4775
  // var filterForm = scope.parent.parent.getComponents().find(function(n){
@@ -4300,10 +4816,10 @@ setTimeout(()=>{
4300
4816
  "style": {
4301
4817
  "max-height": "100%",
4302
4818
  "position": "absolute",
4303
- "left": "-190px",
4819
+ "left": "-200px",
4304
4820
  "width": "190px",
4305
4821
  "bottom": 0,
4306
- "top": "0",
4822
+ "top": "-14px",
4307
4823
  "overflow": "auto",
4308
4824
  "min-height":"300px"
4309
4825
  },
@@ -5737,7 +6253,7 @@ setTimeout(()=>{
5737
6253
 
5738
6254
  const API_CACHE = 100;
5739
6255
 
5740
- function getReadonlyFormAdaptor(fields){
6256
+ function getReadonlyFormAdaptor(object, fields){
5741
6257
  let scriptStr = '';
5742
6258
  const selectFields = ___default__namespace.filter(fields, function(field){return field.name.indexOf('.') < 0 && ((field.type == 'select' && field.options) || ((field.type == 'lookup' || field.type == 'master_detail') && !field.reference_to))});
5743
6259
  const gridAndObjectFieldsName = ___default__namespace.map(___default__namespace.filter(fields, function(field){return field.name.indexOf('.') < 0 && (field.type === 'object' || field.type === 'grid')}), 'name');
@@ -5796,6 +6312,7 @@ setTimeout(()=>{
5796
6312
  console.error(e)
5797
6313
  }
5798
6314
  payload.data = data;
6315
+ payload.data.__objectName = "${object.name}";
5799
6316
  payload.data.__record = record;
5800
6317
  window.postMessage(Object.assign({type: "record.loaded"}, {record: record}), "*")
5801
6318
  }
@@ -5813,7 +6330,7 @@ setTimeout(()=>{
5813
6330
  url: getApi$2()+"&recordId=${recordId}",
5814
6331
  cache: API_CACHE,
5815
6332
  // requestAdaptor: "console.log('getReadonlyFormInitApi requestAdaptor', api);return api;",
5816
- adaptor: getReadonlyFormAdaptor(fields),
6333
+ adaptor: getReadonlyFormAdaptor(object, fields),
5817
6334
  data: await getFindOneQuery$1(object, recordId, fields, options),
5818
6335
  headers: {
5819
6336
  Authorization: "Bearer ${context.tenantId},${context.authToken}"
@@ -6211,11 +6728,11 @@ setTimeout(()=>{
6211
6728
  }
6212
6729
 
6213
6730
  async function getObjectCRUD(objectSchema, fields, options){
6731
+ // console.time('getObjectCRUD');
6214
6732
  const { top, perPage, showDisplayAs = false, displayAs, crudClassName = "" } = options;
6215
6733
  const nonpaged = objectSchema.paging && objectSchema.paging.enabled === false;
6216
6734
  const isTreeObject = objectSchema.enable_tree;
6217
6735
  const bulkActions = getBulkActions(objectSchema);
6218
-
6219
6736
  const bodyProps = {
6220
6737
  // toolbar: getToolbar(),
6221
6738
  // headerToolbar: getObjectHeaderToolbar(objectSchema, options.formFactor, {showDisplayAs}),
@@ -6244,11 +6761,12 @@ setTimeout(()=>{
6244
6761
  options.queryCount = false;
6245
6762
  }
6246
6763
  }
6247
-
6764
+ // console.log(`getObjectHeaderToolbar====2===>`, options.filterVisible)
6248
6765
  bodyProps.headerToolbar = getObjectHeaderToolbar(objectSchema, options.formFactor, {
6249
6766
  showDisplayAs,
6250
6767
  hiddenCount: options.queryCount === false,
6251
- headerToolbarItems: options.headerToolbarItems
6768
+ headerToolbarItems: options.headerToolbarItems,
6769
+ filterVisible: options.filterVisible
6252
6770
  });
6253
6771
 
6254
6772
 
@@ -6323,7 +6841,7 @@ setTimeout(()=>{
6323
6841
  body = wrappedBody;
6324
6842
  }
6325
6843
  }
6326
-
6844
+ // console.timeEnd('getObjectCRUD');
6327
6845
  // TODO: data应该只留loaded,其他属性都改为从上层传递下来
6328
6846
  return {
6329
6847
  type: 'service',
@@ -6445,7 +6963,8 @@ setTimeout(()=>{
6445
6963
  "eventName": "@data.changed.${_master.objectName}"
6446
6964
  },
6447
6965
  "data": {
6448
- "objectName": "${_master.objectName}"
6966
+ "objectName": "${_master.objectName}",
6967
+ "_isRelated": "${_isRelated || _master._isRelated}"
6449
6968
  },
6450
6969
  "expression": `\${_master.objectName != '${objectSchema.name}' && _master.objectName}`
6451
6970
  },
@@ -6529,6 +7048,7 @@ setTimeout(()=>{
6529
7048
  eventName: "recordLoaded"
6530
7049
  },
6531
7050
  data: {
7051
+ objectName: "${event.data.__objectName}",
6532
7052
  record: "${event.data.__record}"
6533
7053
  }
6534
7054
  },
@@ -6965,7 +7485,7 @@ setTimeout(()=>{
6965
7485
  const api = await getApi(mainObject, null, fields, {count: options.queryCount, alias: 'rows', limit: top, queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
6966
7486
 
6967
7487
  if(options.isRelated){
6968
- api.url += "&recordId=${recordId}";
7488
+ api.url += "&recordId=${_master.recordId}";
6969
7489
  }
6970
7490
 
6971
7491
  api.data.$term = "$term";
@@ -8210,7 +8730,7 @@ setTimeout(()=>{
8210
8730
  * @Author: baozhoutao@steedos.com
8211
8731
  * @Date: 2022-07-05 15:55:39
8212
8732
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
8213
- * @LastEditTime: 2023-04-11 11:28:11
8733
+ * @LastEditTime: 2023-04-14 11:10:07
8214
8734
  * @Description:
8215
8735
  */
8216
8736
 
@@ -8510,7 +9030,8 @@ setTimeout(()=>{
8510
9030
  "ctx": ctx,
8511
9031
  "requestAdaptor": listView.requestAdaptor,
8512
9032
  "adaptor": listView.adaptor,
8513
- "headerToolbarItems": ctx.headerToolbarItems
9033
+ "headerToolbarItems": ctx.headerToolbarItems,
9034
+ "filterVisible": ctx.filterVisible
8514
9035
  };
8515
9036
  return {
8516
9037
  uiSchema,
@@ -8525,6 +9046,7 @@ setTimeout(()=>{
8525
9046
  columns,
8526
9047
  ctx = {}
8527
9048
  ) {
9049
+ // console.time('getTableSchema');
8528
9050
  const uiSchema = await getUISchema(objectName);
8529
9051
 
8530
9052
  let sort = ctx.sort;
@@ -8575,6 +9097,7 @@ setTimeout(()=>{
8575
9097
  buttons: await getListViewItemButtons(uiSchema, ctx)
8576
9098
  });
8577
9099
  // console.log('getTableSchema====>amisSchema', amisSchema)
9100
+ // console.timeEnd('getTableSchema');
8578
9101
  return {
8579
9102
  uiSchema,
8580
9103
  amisSchema,
@@ -8693,6 +9216,41 @@ setTimeout(()=>{
8693
9216
  }
8694
9217
  }
8695
9218
 
9219
+ async function getRecordServiceSchema(objectName, appId, props = {}) {
9220
+ const uiSchema = await getUISchema(objectName);
9221
+ return {
9222
+ uiSchema,
9223
+ amisSchema: {
9224
+ "type": "service",
9225
+ "body": [],
9226
+ data: {
9227
+ "_master.objectName": "${objectName}",
9228
+ "_master.recordId": "${recordId}"
9229
+ },
9230
+ "style": {
9231
+ "padding": "var(--Page-body-padding)",
9232
+ ...props.style
9233
+ },
9234
+ onEvent: {
9235
+ "recordLoaded": {
9236
+ "actions": [
9237
+ {
9238
+ "actionType": "reload",
9239
+ "data": {
9240
+ "name": `\${record.${uiSchema.NAME_FIELD_KEY || 'name'}}`,
9241
+ "_master.record": `\${record}`,
9242
+ // 不清楚reload 如何给对象下的某个key复制, 所以此处重复设置_master的objectName、recordId
9243
+ "_master.objectName": "${objectName}",
9244
+ "_master.recordId": "${recordId}"
9245
+ }
9246
+ }
9247
+ ]
9248
+ },
9249
+ ...props.onEvent
9250
+ }
9251
+ }
9252
+ }
9253
+ }
8696
9254
 
8697
9255
  // 获取单个相关表
8698
9256
  async function getObjectRelated(
@@ -11612,6 +12170,7 @@ setTimeout(()=>{
11612
12170
  getRecordDetailSchema: getRecordDetailSchema,
11613
12171
  getRecordPageInitSchema: getRecordPageInitSchema,
11614
12172
  getRecordPermissions: getRecordPermissions,
12173
+ getRecordServiceSchema: getRecordServiceSchema,
11615
12174
  getRelatedFieldValue: getRelatedFieldValue,
11616
12175
  getRelatedListSchema: getRelatedListSchema,
11617
12176
  getRelatedsCount: getRelatedsCount,
@@ -12028,6 +12587,28 @@ setTimeout(()=>{
12028
12587
  React__default["default"].createElement("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" }))));
12029
12588
  };
12030
12589
 
12590
+ /*
12591
+ * @Author: baozhoutao@steedos.com
12592
+ * @Date: 2023-04-07 18:31:31
12593
+ * @LastEditors: baozhoutao@steedos.com
12594
+ * @LastEditTime: 2023-04-12 14:25:02
12595
+ * @Description:
12596
+ */
12597
+ var SteedosSkeleton = function (props) {
12598
+ var body = props.body, render = props.render, _a = props.bodyClassName, bodyClassName = _a === void 0 ? "" : _a, _b = props.config, config = _b === void 0 ? {} : _b;
12599
+ if (___default.isString(config)) {
12600
+ config = JSON.parse(config);
12601
+ }
12602
+ var active = config.active, avatar = config.avatar, loading = config.loading, paragraph = config.paragraph, round = config.round, title = config.title;
12603
+ loading = ___default.isBoolean(loading) ? loading : loading === 'true';
12604
+ // console.log("SteedosSkeleton====>", loading, config, typeof loading)
12605
+ return React__default["default"].createElement(React__default["default"].Fragment, null,
12606
+ React__default["default"].createElement(antd.Skeleton, { active: active, avatar: avatar, loading: loading, paragraph: paragraph, round: round, title: title }),
12607
+ React__default["default"].createElement("div", { className: loading ? 'hidden w-full h-full' : 'w-full h-full' }, body ? (React__default["default"].createElement("div", { className: "steedos-skeleton-body ".concat(bodyClassName) }, render('body', body, {
12608
+ // 这里的信息会作为 props 传递给子组件,一般情况下都不需要这个
12609
+ }))) : null));
12610
+ };
12611
+
12031
12612
  var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0, function () {
12032
12613
  var $schema, recordId, defaultData, mode, layout, labelAlign, appId, fieldsExtend, _a, excludedFields, _b, fields, _c, className, initApiRequestAdaptor, initApiAdaptor, apiRequestAdaptor, apiAdaptor, objectApiName, schemaKeys, formSchema, defaults, options, globalData, amisSchema, uiSchema, schema, schema, formData;
12033
12614
  return __generator(this, function (_d) {
@@ -12069,6 +12650,8 @@ setTimeout(()=>{
12069
12650
  schema = _d.sent();
12070
12651
  amisSchema = schema.amisSchema;
12071
12652
  if (defaultData) {
12653
+ // 让ObjectForm支持props中的dafaultData属性与上层组件配置的defaultData混合
12654
+ // 为了解决相关表新建时如果是表单类型微页面,因为找不到ObjectForm在哪层而造成无法设置ObjectForm的defaultData的问题
12072
12655
  amisSchema.data.defaultData = __assign$2({ "&": "${defaultData}" }, defaultData);
12073
12656
  }
12074
12657
  uiSchema = schema.uiSchema;
@@ -12085,6 +12668,9 @@ setTimeout(()=>{
12085
12668
  // if(objectApiName){
12086
12669
  // formData.objectName = objectApiName;
12087
12670
  // }
12671
+ if (___default.has(props, "recordId") && $schema.recordId !== "${recordId}") {
12672
+ formData.recordId = props.recordId;
12673
+ }
12088
12674
  amisSchema.className = "steedos-object-form ".concat(className);
12089
12675
  amisSchema.data = Object.assign(amisSchema.data, formData, { global: globalData, uiSchema: uiSchema });
12090
12676
  // console.log(`===AmisObjectForm=amisSchema==`, amisSchema)
@@ -12094,11 +12680,11 @@ setTimeout(()=>{
12094
12680
  }); };
12095
12681
 
12096
12682
  var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, void 0, function () {
12097
- var $schema, top, perPage, _a, showHeader, headerSchema, data, defaultData, _b, className, crudClassName, _c, showDisplayAs, sideSchema, headerToolbarItems, ctx, listName, defaults, objectApiName, displayAs, formFactor, isMobile, objectUiSchema, listView, schemaKeys, listSchema, setDataToComponentId, amisSchemaData, listViewId, schema, amisSchema, uiSchema, body, firstLineSchema, serviceData;
12098
- return __generator(this, function (_e) {
12099
- switch (_e.label) {
12683
+ var $schema, top, perPage, _a, showHeader, headerSchema, data, defaultData, _b, className, crudClassName, _c, showDisplayAs, sideSchema, _e, filterVisible, headerToolbarItems, ctx, listName, defaults, objectApiName, displayAs, formFactor, isMobile, objectUiSchema, listView, schemaKeys, listSchema, setDataToComponentId, amisSchemaData, listViewId, schema, amisSchema, uiSchema, body, firstLineSchema, serviceData;
12684
+ return __generator(this, function (_f) {
12685
+ switch (_f.label) {
12100
12686
  case 0:
12101
- $schema = props.$schema, top = props.top, perPage = props.perPage, _a = props.showHeader, showHeader = _a === void 0 ? true : _a, headerSchema = props.headerSchema, data = props.data, defaultData = props.defaultData, _b = props.className, className = _b === void 0 ? "" : _b, crudClassName = props.crudClassName, _c = props.showDisplayAs, showDisplayAs = _c === void 0 ? false : _c, sideSchema = props.sideSchema, props.columnsTogglable, headerToolbarItems = props.headerToolbarItems;
12687
+ $schema = props.$schema, top = props.top, perPage = props.perPage, _a = props.showHeader, showHeader = _a === void 0 ? true : _a, headerSchema = props.headerSchema, data = props.data, defaultData = props.defaultData, _b = props.className, className = _b === void 0 ? "" : _b, crudClassName = props.crudClassName, _c = props.showDisplayAs, showDisplayAs = _c === void 0 ? false : _c, sideSchema = props.sideSchema, props.columnsTogglable, _e = props.filterVisible, filterVisible = _e === void 0 ? true : _e, headerToolbarItems = props.headerToolbarItems;
12102
12688
  ctx = props.ctx;
12103
12689
  listName = (defaultData === null || defaultData === void 0 ? void 0 : defaultData.listName) || (data === null || data === void 0 ? void 0 : data.listName) || (props === null || props === void 0 ? void 0 : props.listName);
12104
12690
  defaults = {};
@@ -12125,7 +12711,7 @@ setTimeout(()=>{
12125
12711
  }
12126
12712
  return [4 /*yield*/, getUISchema(objectApiName, false)];
12127
12713
  case 1:
12128
- objectUiSchema = _e.sent();
12714
+ objectUiSchema = _f.sent();
12129
12715
  listView = ___default.find(objectUiSchema.list_views, function (listView, name) {
12130
12716
  // 传入listViewName空值则取第一个
12131
12717
  if (!listName) {
@@ -12157,11 +12743,11 @@ setTimeout(()=>{
12157
12743
  "blank": false
12158
12744
  },
12159
12745
  "actionType": "link",
12160
- "expression": "${!!!event.data.recordId && event.data.__deletedRecord != true}" //是新建, 则进入详细页面.
12746
+ "expression": "${!!!event.data.recordId && event.data.__deletedRecord != true && event.data._isRelated != true}" //是新建, 则进入详细页面.
12161
12747
  },
12162
12748
  {
12163
12749
  "actionType": "reload",
12164
- "expression": "${event.data.recordId || event.data.__deletedRecord === true}" //不是新建, 则刷新列表
12750
+ "expression": "${(event.data.recordId || event.data.__deletedRecord === true || event.data.displayAs === 'split') && event.data._isRelated != true}" //不是新建, 或分栏模式下新建主对象记录, 则刷新列表
12165
12751
  }
12166
12752
  ]
12167
12753
  };
@@ -12179,9 +12765,9 @@ setTimeout(()=>{
12179
12765
  }
12180
12766
  amisSchemaData = Object.assign({}, data, defaultData);
12181
12767
  listViewId = (ctx === null || ctx === void 0 ? void 0 : ctx.listViewId) || amisSchemaData.listViewId;
12182
- return [4 /*yield*/, getListSchema(amisSchemaData.appId, objectApiName, listName, __assign$2(__assign$2({ top: top, perPage: perPage, showHeader: showHeader, defaults: defaults }, ctx), { listViewId: listViewId, setDataToComponentId: setDataToComponentId, filterVisible: true, showDisplayAs: showDisplayAs, displayAs: displayAs, headerToolbarItems: headerToolbarItems }))];
12768
+ return [4 /*yield*/, getListSchema(amisSchemaData.appId, objectApiName, listName, __assign$2(__assign$2({ top: top, perPage: perPage, showHeader: showHeader, defaults: defaults }, ctx), { listViewId: listViewId, setDataToComponentId: setDataToComponentId, filterVisible: filterVisible, showDisplayAs: showDisplayAs, displayAs: displayAs, headerToolbarItems: headerToolbarItems }))];
12183
12769
  case 2:
12184
- schema = (_e.sent());
12770
+ schema = (_f.sent());
12185
12771
  amisSchema = schema.amisSchema;
12186
12772
  uiSchema = schema.uiSchema;
12187
12773
  body = [amisSchema];
@@ -12202,19 +12788,20 @@ setTimeout(()=>{
12202
12788
  {
12203
12789
  "type": "wrapper",
12204
12790
  "size": "none",
12205
- "className": "flex-shrink-0 min-w-[200px] overflow-y-auto border-r border-gray-200 lg:order-first lg:flex lg:flex-col",
12791
+ "className": "flex-shrink-0 min-w-[200px] h-full border-r border-gray-200 lg:order-first lg:flex lg:flex-col",
12206
12792
  "body": sideSchema
12207
12793
  },
12208
12794
  {
12209
12795
  "type": "wrapper",
12210
12796
  "size": "none",
12211
- "className": "flex-1 overflow-y-auto focus:outline-none lg:order-last w-96",
12797
+ "className": "flex-1 focus:outline-none lg:order-last w-96 h-full",
12212
12798
  "body": body
12213
12799
  },
12214
12800
  ]
12215
12801
  }];
12216
12802
  }
12217
12803
  serviceData = Object.assign({}, { listName: listName, uiSchema: uiSchema, showDisplayAs: showDisplayAs, displayAs: displayAs, recordPermissions: uiSchema.permissions, _id: null, $listviewId: listName });
12804
+ // console.timeEnd('AmisObjectListView')
12218
12805
  return [2 /*return*/, {
12219
12806
  "type": "service",
12220
12807
  "body": body,
@@ -12296,6 +12883,7 @@ setTimeout(()=>{
12296
12883
  amisSchema.data = Object.assign({}, amisSchema.data, amisSchemaData);
12297
12884
  amisSchema.className = "steedos-object-table h-full flex flex-col ".concat(className);
12298
12885
  // console.log(`AmisObjectTable===>amisSchema`, amisSchema)
12886
+ // console.timeEnd('AmisObjectTable')
12299
12887
  return [2 /*return*/, amisSchema];
12300
12888
  }
12301
12889
  });
@@ -12353,7 +12941,8 @@ setTimeout(()=>{
12353
12941
  "_id": "\${event.data.record._id}",
12354
12942
  "recordId": "\${event.data.record._id}",
12355
12943
  "recordLoaded": true,
12356
- }
12944
+ },
12945
+ "expression": "${event.data.objectName == '".concat(objectUiSchema === null || objectUiSchema === void 0 ? void 0 : objectUiSchema.name, "'}")
12357
12946
  }
12358
12947
  ]
12359
12948
  }
@@ -12400,6 +12989,36 @@ setTimeout(()=>{
12400
12989
  });
12401
12990
  }); };
12402
12991
 
12992
+ /*
12993
+ * @Author: baozhoutao@steedos.com
12994
+ * @Date: 2022-12-08 10:32:17
12995
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
12996
+ * @LastEditTime: 2023-04-14 11:30:21
12997
+ * @Description:
12998
+ */
12999
+ var AmisRecordService = function (props) { return __awaiter(void 0, void 0, void 0, function () {
13000
+ var className, _a, objectApiName, body, style, schema;
13001
+ return __generator(this, function (_b) {
13002
+ switch (_b.label) {
13003
+ case 0:
13004
+ className = props.className, props.$schema, props.appId, _a = props.objectApiName, objectApiName = _a === void 0 ? "space_users" : _a, props.recordId, props.fields, body = props.body, style = props.style;
13005
+ return [4 /*yield*/, getRecordServiceSchema(objectApiName)];
13006
+ case 1:
13007
+ schema = (_b.sent()).amisSchema;
13008
+ if (body) {
13009
+ schema.body = body;
13010
+ }
13011
+ if (className) {
13012
+ schema.className = className;
13013
+ }
13014
+ if (style) {
13015
+ Object.assign(schema.style, style);
13016
+ }
13017
+ return [2 /*return*/, schema];
13018
+ }
13019
+ });
13020
+ }); };
13021
+
12403
13022
  var AmisRecordDetailRelatedList = function (props) { return __awaiter(void 0, void 0, void 0, function () {
12404
13023
  var objectApiName, recordId, relatedObjectApiName, relatedKey, top, perPage, appId, relatedLabel, _a, className, columns, sort, filters, visible_on, formFactor, schema;
12405
13024
  return __generator(this, function (_b) {
@@ -13394,7 +14013,7 @@ setTimeout(()=>{
13394
14013
  }); };
13395
14014
 
13396
14015
  var PageListView = function (props) { return __awaiter(void 0, void 0, void 0, function () {
13397
- var defaultFormFactor, appId, objectApiName, listviewId, display, _a, $schema, listName, displayAs, formFactor, page, listViewId, listSchema, defData;
14016
+ var defaultFormFactor, appId, objectApiName, listviewId, display, _a, $schema, listName, displayAs, formFactor, page, listViewId, listSchema, defData, pageGridClassName, pageSplitClassName;
13398
14017
  return __generator(this, function (_b) {
13399
14018
  switch (_b.label) {
13400
14019
  case 0:
@@ -13432,11 +14051,12 @@ setTimeout(()=>{
13432
14051
  if (listName) {
13433
14052
  defData.listName = listName || listviewId;
13434
14053
  }
13435
- // console.log("defData====>", defData)
14054
+ pageGridClassName = listSchema.pageGridClassName || 'h-full sm:p-3';
14055
+ pageSplitClassName = listSchema.pageSplitClassName || 'p-0 flex flex-1 overflow-hidden h-full';
13436
14056
  return [2 /*return*/, {
13437
14057
  type: 'service',
13438
14058
  data: defData,
13439
- "className": (displayAs === 'grid') ? 'h-full sm:p-3' : 'p-0 flex flex-1 overflow-hidden h-full',
14059
+ "className": (displayAs === 'grid') ? pageGridClassName : pageSplitClassName,
13440
14060
  body: (displayAs === 'grid') ? ___default.defaultsDeep({ data: defData }, listSchema) : [
13441
14061
  {
13442
14062
  "type": "wrapper",
@@ -13546,6 +14166,7 @@ setTimeout(()=>{
13546
14166
  exports.AmisRecordDetailHeader = AmisRecordDetailHeader;
13547
14167
  exports.AmisRecordDetailRelatedList = AmisRecordDetailRelatedList;
13548
14168
  exports.AmisRecordDetailRelatedLists = AmisRecordDetailRelatedLists;
14169
+ exports.AmisRecordService = AmisRecordService;
13549
14170
  exports.AmisSelectFlow = AmisSelectFlow;
13550
14171
  exports.AmisSelectUser = AmisSelectUser;
13551
14172
  exports.AmisSteedosField = AmisSteedosField;
@@ -13559,6 +14180,7 @@ setTimeout(()=>{
13559
14180
  exports.SteedosIcon = SteedosIcon;
13560
14181
  exports.SteedosLib = index_esm;
13561
14182
  exports.SteedosLoading = SteedosLoading;
14183
+ exports.SteedosSkeleton = SteedosSkeleton;
13562
14184
 
13563
14185
  Object.defineProperty(exports, '__esModule', { value: true });
13564
14186