@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.
@@ -1,7 +1,7 @@
1
1
  import React, { useState, useEffect, createElement } from 'react';
2
2
  import * as ___default from 'lodash';
3
3
  import ___default__default, { isEmpty, isArray, each, find, endsWith, cloneDeep, includes, map, keys, sortBy, compact, toArray, mergeWith, isString, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, filter, get, isBoolean, omitBy, isNil, has, startsWith, isFunction, difference, pick, pickBy, random, assign, isNumber } from 'lodash';
4
- import { Dropdown, Tabs, Spin, Badge, Modal as Modal$1, message, notification, Button, Space, Drawer as Drawer$1 } from 'antd';
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
 
7
7
  /******************************************************************************
@@ -1722,8 +1722,8 @@ var config = {
1722
1722
  /*
1723
1723
  * @Author: baozhoutao@steedos.com
1724
1724
  * @Date: 2022-11-01 15:51:00
1725
- * @LastEditors: Please set LastEditors
1726
- * @LastEditTime: 2023-04-11 13:58:24
1725
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
1726
+ * @LastEditTime: 2023-04-16 17:04:16
1727
1727
  * @Description:
1728
1728
  */
1729
1729
 
@@ -1801,6 +1801,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
1801
1801
  "context": "${context}",
1802
1802
  "global": "${global}",
1803
1803
  "listViewId": "${listViewId}",
1804
+ "displayAs": "${displayAs}",
1804
1805
  "uiSchema": "${uiSchema}",
1805
1806
  "isLookup": "${isLookup}",
1806
1807
  "listName": "${listName}"
@@ -1944,8 +1945,8 @@ const getSchema$3 = async (uiSchema, ctx) => {
1944
1945
  /*
1945
1946
  * @Author: 殷亮辉 yinlianghui@hotoa.com
1946
1947
  * @Date: 2023-03-22 09:31:21
1947
- * @LastEditors: baozhoutao@steedos.com
1948
- * @LastEditTime: 2023-04-06 16:04:20
1948
+ * @LastEditors: Please set LastEditors
1949
+ * @LastEditTime: 2023-04-12 10:35:36
1949
1950
  */
1950
1951
  const getSchema$2 = (uiSchema)=>{
1951
1952
  return {
@@ -2000,7 +2001,8 @@ const getSchema$2 = (uiSchema)=>{
2000
2001
  "eventName": "@data.changed.${_master.objectName}"
2001
2002
  },
2002
2003
  "data": {
2003
- "objectName": "${_master.objectName}"
2004
+ "objectName": "${_master.objectName}",
2005
+ "_isRelated": "${_isRelated}"
2004
2006
  },
2005
2007
  "expression": `\${_master.objectName != '${uiSchema.name}' && _master.objectName}`
2006
2008
  }
@@ -3716,6 +3718,9 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
3716
3718
  };
3717
3719
  };
3718
3720
 
3721
+
3722
+
3723
+
3719
3724
  const onFieldsFilterToggleScript = `
3720
3725
  const scope = event.context.scoped;
3721
3726
  const filterForm = scope.getComponents().find(function(n){
@@ -3733,7 +3738,6 @@ setTimeout(()=>{
3733
3738
 
3734
3739
  function getExportApiRequestAdaptorScript(){
3735
3740
  return `
3736
- console.log(api.url);
3737
3741
  // 获取列表视图的属性
3738
3742
  let uiSchema = api.body.uiSchema;
3739
3743
  let list_views = uiSchema.list_views;
@@ -3782,12 +3786,12 @@ function getExportApiRequestAdaptorScript(){
3782
3786
  if (filters && filters.length > 0) {
3783
3787
  api.url = api.url + "&filters=" + JSON.stringify(filters);
3784
3788
  }
3785
- console.log(api.url);
3786
3789
  return api;
3787
3790
  `
3788
3791
  }
3789
3792
 
3790
- function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false, hiddenCount = false, headerToolbarItems} = {}){
3793
+ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false, hiddenCount = false, headerToolbarItems, filterVisible = true} = {}){
3794
+ // console.log(`getObjectHeaderToolbar====>`, filterVisible)
3791
3795
  const isMobile = window.innerWidth < 768;
3792
3796
  if(isMobile){
3793
3797
  showDisplayAs = false;
@@ -3824,7 +3828,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3824
3828
  }
3825
3829
  },
3826
3830
  },
3827
- {
3831
+ filterVisible ? {
3828
3832
  "label": "",
3829
3833
  "icon": "fa fa-search",
3830
3834
  "type": "button",
@@ -3840,7 +3844,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3840
3844
  ]
3841
3845
  }
3842
3846
  }
3843
- },
3847
+ } : {},
3844
3848
  showDisplayAs? getDisplayAsButton(mainObject?.name) : {}
3845
3849
  ]
3846
3850
  }else {
@@ -3856,10 +3860,6 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3856
3860
  // "type": "columns-toggler",
3857
3861
  // "className": "mr-2"
3858
3862
  // },
3859
- // {
3860
- // "type": "export-excel",
3861
- // "align": "right"
3862
- // },
3863
3863
  hiddenCount ? {} : {
3864
3864
  "type": "tpl",
3865
3865
  "tpl": "${count} 个项目"
@@ -3905,7 +3905,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3905
3905
  }
3906
3906
  }
3907
3907
  },
3908
- {
3908
+ filterVisible ? {
3909
3909
  "label": "",
3910
3910
  "icon": "fa fa-search",
3911
3911
  "type": "button",
@@ -3921,8 +3921,524 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3921
3921
  ]
3922
3922
  }
3923
3923
  }
3924
+ } : {},
3925
+ {
3926
+ "type": "dropdown-button",
3927
+ "trigger": "click",
3928
+ "icon": "fa fa-cog",
3929
+ "btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
3930
+ "align": "right",
3931
+ "visibleOn": "${!isLookup}",
3932
+ "buttons": [
3933
+ {
3934
+ "label": "列表视图操作",
3935
+ "children": [
3936
+ {
3937
+ "type": "button",
3938
+ "label": "新建",
3939
+ "onEvent": {
3940
+ "click": {
3941
+ "weight": 0,
3942
+ "actions": [
3943
+ {
3944
+ "dialog": {
3945
+ "type": "dialog",
3946
+ "title": "新建 列表视图",
3947
+ "data": {
3948
+ "&": "$$",
3949
+ "all": "${uiSchema.list_views.all}",
3950
+ "list_view": "${uiSchema.list_views[listName]}",
3951
+ "appId": "${appId}",
3952
+ "global": "${global}",
3953
+ "objectName": "${objectName}",
3954
+ },
3955
+ "body": [
3956
+ {
3957
+ "type": "steedos-object-form",
3958
+ "label": "对象表单",
3959
+ "objectApiName": "object_listviews",
3960
+ "recordId": "",
3961
+ "mode": "edit",
3962
+ "defaultData": {
3963
+ "&": "${list_view}",
3964
+ "name":"",
3965
+ "label":"",
3966
+ "filters":"",
3967
+ "shared":false
3968
+ },
3969
+ "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}",
3970
+ "fields": [
3971
+ "label",
3972
+ "name",
3973
+ "object_name",
3974
+ "filter_scope",
3975
+ "show_count",
3976
+ "columns.$.field",
3977
+ "columns.$.width",
3978
+ "sort.$.field_name",
3979
+ "sort.$.order",
3980
+ "filters",
3981
+ "mobile_columns.$.field",
3982
+ "searchable_fields.$.field",
3983
+ "is_system",
3984
+ "shared"
3985
+ ],
3986
+ "onEvent": {
3987
+ "submitSucc": {
3988
+ "weight": 0,
3989
+ "actions": [
3990
+ {
3991
+ "args": {
3992
+ // 直接使用recordId不能拿到数据,只能通过result里面拿数据
3993
+ "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/listview_${result.data.recordId|lowerCase}",
3994
+ "blank": false
3995
+ },
3996
+ "actionType": "url",
3997
+ }
3998
+ ]
3999
+ }
4000
+ },
4001
+ "messages": {
4002
+ "success": "成功",
4003
+ "failed": "失败"
4004
+ },
4005
+ }
4006
+ ],
4007
+ "showCloseButton": true,
4008
+ "showErrorMsg": true,
4009
+ "showLoading": true,
4010
+ "closeOnEsc": false,
4011
+ "dataMapSwitch": false,
4012
+ "size": "lg"
4013
+ },
4014
+ "actionType": "dialog"
4015
+ }
4016
+ ]
4017
+ }
4018
+ }
4019
+ },
4020
+ {
4021
+ "type": "button",
4022
+ "label": "复制",
4023
+ "onEvent": {
4024
+ "click": {
4025
+ "weight": 0,
4026
+ "actions": [
4027
+ {
4028
+ "dialog": {
4029
+ "type": "dialog",
4030
+ "title": "复制 列表视图",
4031
+ "data": {
4032
+ "&": "$$",
4033
+ "listName": "${listName}",
4034
+ "objectName": "${objectName}",
4035
+ "list_view": "${uiSchema.list_views[listName]}",
4036
+ "appId": "${appId}",
4037
+ "global": "${global}"
4038
+ },
4039
+ "body": [
4040
+ {
4041
+ "type": "steedos-object-form",
4042
+ "label": "对象表单",
4043
+ "objectApiName": "object_listviews",
4044
+ "recordId": "",
4045
+ "mode": "edit",
4046
+ "fields": [
4047
+ ],
4048
+ "defaultData": {
4049
+ "&": "${list_view}",
4050
+ "name":"",
4051
+ "label": "${list_view.label}的副本",
4052
+ "shared":false
4053
+ },
4054
+ "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}",
4055
+ "fields": [
4056
+ "label",
4057
+ "name",
4058
+ "object_name",
4059
+ "filter_scope",
4060
+ "show_count",
4061
+ "columns.$.field",
4062
+ "columns.$.width",
4063
+ "sort.$.field_name",
4064
+ "sort.$.order",
4065
+ "filters",
4066
+ "mobile_columns.$.field",
4067
+ "searchable_fields.$.field",
4068
+ "is_system",
4069
+ "shared"
4070
+ ],
4071
+ "onEvent": {
4072
+ "submitSucc": {
4073
+ "weight": 0,
4074
+ "actions": [
4075
+ {
4076
+ "args": {
4077
+ "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/listview_${result.data.recordId|lowerCase}",
4078
+ "blank": false
4079
+ },
4080
+ "actionType": "url",
4081
+ }
4082
+ ]
4083
+ }
4084
+ }
4085
+ }
4086
+ ],
4087
+ "showCloseButton": true,
4088
+ "showErrorMsg": true,
4089
+ "showLoading": true,
4090
+ "closeOnEsc": false,
4091
+ "dataMapSwitch": false,
4092
+ "size": "lg"
4093
+ },
4094
+ "actionType": "dialog"
4095
+ }
4096
+ ]
4097
+ }
4098
+ }
4099
+ },
4100
+ {
4101
+ "type": "button",
4102
+ "label": "重命名",
4103
+ "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4104
+ "onEvent": {
4105
+ "click": {
4106
+ "weight": 0,
4107
+ "actions": [
4108
+ {
4109
+ "dialog": {
4110
+ "type": "dialog",
4111
+ "title": "重命名 列表视图",
4112
+ "data": {
4113
+ "objectName": "${objectName}",
4114
+ "recordId": "${uiSchema.list_views[listName]._id}",
4115
+ "appId": "${appId}"
4116
+ },
4117
+ "body": [
4118
+ {
4119
+ "type": "steedos-object-form",
4120
+ "label": "对象表单",
4121
+ "objectApiName": "object_listviews",
4122
+ "recordId": "${recordId}",
4123
+ "mode": "edit",
4124
+ "fields": [
4125
+ "label"
4126
+ ],
4127
+ "fieldsExtend": "{\n \"label\":{\n \"is_wide\": true\n }\n}",
4128
+ "onEvent": {
4129
+ "submitSucc": {
4130
+ "weight": 0,
4131
+ "actions": [
4132
+ {
4133
+ "args": {
4134
+ "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${name}",
4135
+ "blank": false
4136
+ },
4137
+ "actionType": "url",
4138
+ },
4139
+ ]
4140
+ }
4141
+ }
4142
+ }
4143
+ ],
4144
+ "showCloseButton": true,
4145
+ "showErrorMsg": true,
4146
+ "showLoading": true,
4147
+ "size": "lg"
4148
+ },
4149
+ "actionType": "dialog"
4150
+ }
4151
+ ]
4152
+ }
4153
+ }
4154
+ },
4155
+ {
4156
+ "type": "button",
4157
+ "label": "共享设置",
4158
+ "disabledOn": "!(global.user.is_space_admin && !!uiSchema.list_views[listName].owner)",
4159
+ "onEvent": {
4160
+ "click": {
4161
+ "weight": 0,
4162
+ "actions": [
4163
+ {
4164
+ "dialog": {
4165
+ "type": "dialog",
4166
+ "title": "共享设置",
4167
+ "data": {
4168
+ "recordId": "${uiSchema.list_views[listName]._id}",
4169
+ },
4170
+ "body": [
4171
+ {
4172
+ "type": "steedos-object-form",
4173
+ "label": "对象表单",
4174
+ "objectApiName": "object_listviews",
4175
+ "recordId": "${recordId}",
4176
+ "mode": "edit",
4177
+ "fields": [
4178
+ "shared"
4179
+ ]
4180
+ }
4181
+ ],
4182
+ "showCloseButton": true,
4183
+ "showErrorMsg": true,
4184
+ "showLoading": true,
4185
+ "closeOnEsc": false,
4186
+ "dataMapSwitch": false,
4187
+ "size": "md"
4188
+ },
4189
+ "actionType": "dialog"
4190
+ }
4191
+ ]
4192
+ }
4193
+ }
4194
+ },
4195
+ {
4196
+ "type": "button",
4197
+ "label": "过滤设置",
4198
+ "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4199
+ "onEvent": {
4200
+ "click": {
4201
+ "weight": 0,
4202
+ "actions": [
4203
+ {
4204
+ "dialog": {
4205
+ "type": "dialog",
4206
+ "title": "过滤设置",
4207
+ "data": {
4208
+ "objectName": "${objectName}",
4209
+ "recordId": "${uiSchema.list_views[listName]._id}",
4210
+ "listName": "${listName}",
4211
+ "appId": "${appId}"
4212
+ },
4213
+ "body": [
4214
+ {
4215
+ "type": "steedos-object-form",
4216
+ "label": "对象表单",
4217
+ "objectApiName": "object_listviews",
4218
+ "recordId": "${recordId}",
4219
+ "mode": "edit",
4220
+ "initApiAdaptor": "",
4221
+ "fields": [
4222
+ "filters"
4223
+ ],
4224
+ "initApiRequestAdaptor": "",
4225
+ "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;",
4226
+ "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",
4227
+ "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}",
4228
+ "onEvent": {
4229
+ "submitSucc": {
4230
+ "weight": 0,
4231
+ "actions": [
4232
+ {
4233
+ "args": {
4234
+ "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${listName}",
4235
+ "blank": false
4236
+ },
4237
+ "actionType": "url",
4238
+ }
4239
+ ]
4240
+ }
4241
+ }
4242
+ }
4243
+ ],
4244
+ "showCloseButton": true,
4245
+ "showErrorMsg": true,
4246
+ "showLoading": true,
4247
+ "closeOnEsc": false,
4248
+ "dataMapSwitch": false,
4249
+ "size": "lg"
4250
+ },
4251
+ "actionType": "dialog"
4252
+ }
4253
+ ]
4254
+ }
4255
+ }
4256
+ },
4257
+ {
4258
+ "type": "button",
4259
+ "label": "显示的列",
4260
+ "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4261
+ "onEvent": {
4262
+ "click": {
4263
+ "weight": 0,
4264
+ "actions": [
4265
+ {
4266
+ "args": {},
4267
+ "dialog": {
4268
+ "type": "dialog",
4269
+ "title": "显示的列",
4270
+ "data": {
4271
+ "&": "$$",
4272
+ "objectName": "${objectName}",
4273
+ "recordId": "${uiSchema.list_views[listName]._id}",
4274
+ "listName": "${listName}",
4275
+ "appId": "${appId}"
4276
+ },
4277
+ "body": [
4278
+ {
4279
+ "type": "steedos-object-form",
4280
+ "label": "对象表单",
4281
+ "objectApiName": "object_listviews",
4282
+ "recordId": "${recordId}",
4283
+ "mode": "edit",
4284
+ "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}",
4285
+ "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;",
4286
+ "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;",
4287
+ "fields": [
4288
+ "columns",
4289
+ "mobile_columns"
4290
+ ],
4291
+ "onEvent": {
4292
+ "submitSucc": {
4293
+ "weight": 0,
4294
+ "actions": [
4295
+ {
4296
+ "args": {
4297
+ "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${listName}",
4298
+ "blank": false
4299
+ },
4300
+ "actionType": "url"
4301
+ }
4302
+ ]
4303
+ }
4304
+ }
4305
+ }
4306
+ ],
4307
+ "searchable": true,
4308
+ "showCloseButton": true,
4309
+ "showErrorMsg": true,
4310
+ "showLoading": true,
4311
+ "size": "lg"
4312
+ },
4313
+ "actionType": "dialog"
4314
+ }
4315
+ ]
4316
+ }
4317
+ }
4318
+ },
4319
+ {
4320
+ "type": "button",
4321
+ "label": "默认排序规则",
4322
+ "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4323
+ "onEvent": {
4324
+ "click": {
4325
+ "weight": 0,
4326
+ "actions": [
4327
+ {
4328
+ "dialog": {
4329
+ "type": "dialog",
4330
+ "title": "弹框标题",
4331
+ "data": {
4332
+ "&": "$$",
4333
+ "objectName": "${objectName}",
4334
+ "recordId": "${uiSchema.list_views[listName]._id}",
4335
+ "listName": "${listName}",
4336
+ "appId": "${appId}"
4337
+ },
4338
+ "body": [
4339
+ {
4340
+ "type": "steedos-object-form",
4341
+ "label": "对象表单",
4342
+ "objectApiName": "object_listviews",
4343
+ "recordId": "${recordId}",
4344
+ "className": "",
4345
+ "id": "u:061f158b4c5a",
4346
+ "mode": "edit",
4347
+ "fields": [
4348
+ "sort",
4349
+ "sort.$.field_name",
4350
+ "sort.$.order"
4351
+ ],
4352
+ "onEvent": {
4353
+ "submitSucc": {
4354
+ "weight": 0,
4355
+ "actions": [
4356
+ {
4357
+ "args": {
4358
+ "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${listName}",
4359
+ "blank": false
4360
+ },
4361
+ "actionType": "url"
4362
+ }
4363
+ ]
4364
+ }
4365
+ },
4366
+ "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}",
4367
+ "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;",
4368
+ "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"
4369
+ }
4370
+ ],
4371
+ "showCloseButton": true,
4372
+ "showErrorMsg": true,
4373
+ "showLoading": true,
4374
+ "id": "u:d3f6947b6acf",
4375
+ "size": "lg"
4376
+ },
4377
+ "actionType": "dialog"
4378
+ }
4379
+ ]
4380
+ }
4381
+ }
4382
+ },
4383
+ {
4384
+ "type": "button",
4385
+ "label": "删除",
4386
+ "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4387
+ "confirmText": "如果您删除此列表视图,该视图将为所有具备访问权限的用户永久删除。是否确定要删除?",
4388
+ "onEvent": {
4389
+ "click": {
4390
+ "actions": [
4391
+ {
4392
+ "actionType": "ajax",
4393
+ "args": {
4394
+ "api": {
4395
+ "url": "${context.rootUrl}/graphql",
4396
+ "method": "post",
4397
+ "headers": {
4398
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
4399
+ },
4400
+ "data": {
4401
+ "&": "$$",
4402
+ "uiSchema": "${uiSchema}",
4403
+ "recordId": "${uiSchema.list_views[listName]._id}"
4404
+ },
4405
+ "messages": {
4406
+ "success": "删除成功"
4407
+ },
4408
+ "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",
4409
+ "adaptor": "if (payload.errors) {\n payload.status = 2;\n payload.msg = payload.errors[0].message;\n}\nreturn payload;",
4410
+ }
4411
+ }
4412
+ },
4413
+ {
4414
+ "actionType": "url",
4415
+ "args": {
4416
+ "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/all",
4417
+ "blank": false
4418
+ },
4419
+ "expression": "data.delete == 1"
4420
+ }
4421
+ ]
4422
+ }
4423
+ }
4424
+ },
4425
+ {
4426
+ "type": "button",
4427
+ "visibleOn": "${false}",
4428
+ "label": "保存宽度(todo)"
4429
+ },
4430
+ // {
4431
+ // type: 'steedos-object-button',
4432
+ // name: 'standard_delete',
4433
+ // objectName: 'test0321__c',
4434
+ // // visibleOn: getButtonVisibleOn(button),
4435
+ // className: 'antd-Button--default'
4436
+ // }
4437
+ ]
4438
+ }
4439
+ ]
3924
4440
  },
3925
- showDisplayAs? getDisplayAsButton(showDisplayAs) : {}
4441
+ showDisplayAs ? getDisplayAsButton(showDisplayAs) : {}
3926
4442
  // {
3927
4443
  // "type": "search-box",
3928
4444
  // "align": "right",
@@ -4205,6 +4721,7 @@ function getLookupSapceUserTreeSchema(){
4205
4721
  const tree = [{
4206
4722
  "type": "input-tree",
4207
4723
  "className": "",
4724
+ "inputClassName": "pl-0",
4208
4725
  "id": "u:7fd77b7915b0",
4209
4726
  "source": {
4210
4727
  "method": "post",
@@ -4227,7 +4744,6 @@ function getLookupSapceUserTreeSchema(){
4227
4744
  {
4228
4745
  "actionType": "custom",
4229
4746
  "script": `
4230
- debugger;
4231
4747
  const scope = event.context.scoped;
4232
4748
  //TODO: 将form中的value一同加入筛选内
4233
4749
  // var filterForm = scope.parent.parent.getComponents().find(function(n){
@@ -4274,10 +4790,10 @@ function getLookupSapceUserTreeSchema(){
4274
4790
  "style": {
4275
4791
  "max-height": "100%",
4276
4792
  "position": "absolute",
4277
- "left": "-190px",
4793
+ "left": "-200px",
4278
4794
  "width": "190px",
4279
4795
  "bottom": 0,
4280
- "top": "0",
4796
+ "top": "-14px",
4281
4797
  "overflow": "auto",
4282
4798
  "min-height":"300px"
4283
4799
  },
@@ -5711,7 +6227,7 @@ var index = /*#__PURE__*/Object.freeze({
5711
6227
 
5712
6228
  const API_CACHE = 100;
5713
6229
 
5714
- function getReadonlyFormAdaptor(fields){
6230
+ function getReadonlyFormAdaptor(object, fields){
5715
6231
  let scriptStr = '';
5716
6232
  const selectFields = ___default.filter(fields, function(field){return field.name.indexOf('.') < 0 && ((field.type == 'select' && field.options) || ((field.type == 'lookup' || field.type == 'master_detail') && !field.reference_to))});
5717
6233
  const gridAndObjectFieldsName = ___default.map(___default.filter(fields, function(field){return field.name.indexOf('.') < 0 && (field.type === 'object' || field.type === 'grid')}), 'name');
@@ -5770,6 +6286,7 @@ function getReadonlyFormAdaptor(fields){
5770
6286
  console.error(e)
5771
6287
  }
5772
6288
  payload.data = data;
6289
+ payload.data.__objectName = "${object.name}";
5773
6290
  payload.data.__record = record;
5774
6291
  window.postMessage(Object.assign({type: "record.loaded"}, {record: record}), "*")
5775
6292
  }
@@ -5787,7 +6304,7 @@ async function getReadonlyFormInitApi(object, recordId, fields, options){
5787
6304
  url: getApi$2()+"&recordId=${recordId}",
5788
6305
  cache: API_CACHE,
5789
6306
  // requestAdaptor: "console.log('getReadonlyFormInitApi requestAdaptor', api);return api;",
5790
- adaptor: getReadonlyFormAdaptor(fields),
6307
+ adaptor: getReadonlyFormAdaptor(object, fields),
5791
6308
  data: await getFindOneQuery$1(object, recordId, fields, options),
5792
6309
  headers: {
5793
6310
  Authorization: "Bearer ${context.tenantId},${context.authToken}"
@@ -6185,11 +6702,11 @@ function getBulkActions(objectSchema){
6185
6702
  }
6186
6703
 
6187
6704
  async function getObjectCRUD(objectSchema, fields, options){
6705
+ // console.time('getObjectCRUD');
6188
6706
  const { top, perPage, showDisplayAs = false, displayAs, crudClassName = "" } = options;
6189
6707
  const nonpaged = objectSchema.paging && objectSchema.paging.enabled === false;
6190
6708
  const isTreeObject = objectSchema.enable_tree;
6191
6709
  const bulkActions = getBulkActions(objectSchema);
6192
-
6193
6710
  const bodyProps = {
6194
6711
  // toolbar: getToolbar(),
6195
6712
  // headerToolbar: getObjectHeaderToolbar(objectSchema, options.formFactor, {showDisplayAs}),
@@ -6218,11 +6735,12 @@ async function getObjectCRUD(objectSchema, fields, options){
6218
6735
  options.queryCount = false;
6219
6736
  }
6220
6737
  }
6221
-
6738
+ // console.log(`getObjectHeaderToolbar====2===>`, options.filterVisible)
6222
6739
  bodyProps.headerToolbar = getObjectHeaderToolbar(objectSchema, options.formFactor, {
6223
6740
  showDisplayAs,
6224
6741
  hiddenCount: options.queryCount === false,
6225
- headerToolbarItems: options.headerToolbarItems
6742
+ headerToolbarItems: options.headerToolbarItems,
6743
+ filterVisible: options.filterVisible
6226
6744
  });
6227
6745
 
6228
6746
 
@@ -6297,7 +6815,7 @@ async function getObjectCRUD(objectSchema, fields, options){
6297
6815
  body = wrappedBody;
6298
6816
  }
6299
6817
  }
6300
-
6818
+ // console.timeEnd('getObjectCRUD');
6301
6819
  // TODO: data应该只留loaded,其他属性都改为从上层传递下来
6302
6820
  return {
6303
6821
  type: 'service',
@@ -6419,7 +6937,8 @@ async function getObjectForm(objectSchema, ctx){
6419
6937
  "eventName": "@data.changed.${_master.objectName}"
6420
6938
  },
6421
6939
  "data": {
6422
- "objectName": "${_master.objectName}"
6940
+ "objectName": "${_master.objectName}",
6941
+ "_isRelated": "${_isRelated || _master._isRelated}"
6423
6942
  },
6424
6943
  "expression": `\${_master.objectName != '${objectSchema.name}' && _master.objectName}`
6425
6944
  },
@@ -6503,6 +7022,7 @@ async function getObjectDetail(objectSchema, recordId, ctx){
6503
7022
  eventName: "recordLoaded"
6504
7023
  },
6505
7024
  data: {
7025
+ objectName: "${event.data.__objectName}",
6506
7026
  record: "${event.data.__record}"
6507
7027
  }
6508
7028
  },
@@ -6939,7 +7459,7 @@ async function getTableApi(mainObject, fields, options){
6939
7459
  const api = await getApi(mainObject, null, fields, {count: options.queryCount, alias: 'rows', limit: top, queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
6940
7460
 
6941
7461
  if(options.isRelated){
6942
- api.url += "&recordId=${recordId}";
7462
+ api.url += "&recordId=${_master.recordId}";
6943
7463
  }
6944
7464
 
6945
7465
  api.data.$term = "$term";
@@ -8184,7 +8704,7 @@ async function getRelatedListSchema(
8184
8704
  * @Author: baozhoutao@steedos.com
8185
8705
  * @Date: 2022-07-05 15:55:39
8186
8706
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
8187
- * @LastEditTime: 2023-04-11 11:28:11
8707
+ * @LastEditTime: 2023-04-14 11:10:07
8188
8708
  * @Description:
8189
8709
  */
8190
8710
 
@@ -8484,7 +9004,8 @@ async function getListSchema(
8484
9004
  "ctx": ctx,
8485
9005
  "requestAdaptor": listView.requestAdaptor,
8486
9006
  "adaptor": listView.adaptor,
8487
- "headerToolbarItems": ctx.headerToolbarItems
9007
+ "headerToolbarItems": ctx.headerToolbarItems,
9008
+ "filterVisible": ctx.filterVisible
8488
9009
  };
8489
9010
  return {
8490
9011
  uiSchema,
@@ -8499,6 +9020,7 @@ async function getTableSchema(
8499
9020
  columns,
8500
9021
  ctx = {}
8501
9022
  ) {
9023
+ // console.time('getTableSchema');
8502
9024
  const uiSchema = await getUISchema(objectName);
8503
9025
 
8504
9026
  let sort = ctx.sort;
@@ -8549,6 +9071,7 @@ async function getTableSchema(
8549
9071
  buttons: await getListViewItemButtons(uiSchema, ctx)
8550
9072
  });
8551
9073
  // console.log('getTableSchema====>amisSchema', amisSchema)
9074
+ // console.timeEnd('getTableSchema');
8552
9075
  return {
8553
9076
  uiSchema,
8554
9077
  amisSchema,
@@ -8667,6 +9190,41 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
8667
9190
  }
8668
9191
  }
8669
9192
 
9193
+ async function getRecordServiceSchema(objectName, appId, props = {}) {
9194
+ const uiSchema = await getUISchema(objectName);
9195
+ return {
9196
+ uiSchema,
9197
+ amisSchema: {
9198
+ "type": "service",
9199
+ "body": [],
9200
+ data: {
9201
+ "_master.objectName": "${objectName}",
9202
+ "_master.recordId": "${recordId}"
9203
+ },
9204
+ "style": {
9205
+ "padding": "var(--Page-body-padding)",
9206
+ ...props.style
9207
+ },
9208
+ onEvent: {
9209
+ "recordLoaded": {
9210
+ "actions": [
9211
+ {
9212
+ "actionType": "reload",
9213
+ "data": {
9214
+ "name": `\${record.${uiSchema.NAME_FIELD_KEY || 'name'}}`,
9215
+ "_master.record": `\${record}`,
9216
+ // 不清楚reload 如何给对象下的某个key复制, 所以此处重复设置_master的objectName、recordId
9217
+ "_master.objectName": "${objectName}",
9218
+ "_master.recordId": "${recordId}"
9219
+ }
9220
+ }
9221
+ ]
9222
+ },
9223
+ ...props.onEvent
9224
+ }
9225
+ }
9226
+ }
9227
+ }
8670
9228
 
8671
9229
  // 获取单个相关表
8672
9230
  async function getObjectRelated(
@@ -11586,6 +12144,7 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
11586
12144
  getRecordDetailSchema: getRecordDetailSchema,
11587
12145
  getRecordPageInitSchema: getRecordPageInitSchema,
11588
12146
  getRecordPermissions: getRecordPermissions,
12147
+ getRecordServiceSchema: getRecordServiceSchema,
11589
12148
  getRelatedFieldValue: getRelatedFieldValue,
11590
12149
  getRelatedListSchema: getRelatedListSchema,
11591
12150
  getRelatedsCount: getRelatedsCount,
@@ -12002,6 +12561,28 @@ var SteedosLoading = function (props) {
12002
12561
  React.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" }))));
12003
12562
  };
12004
12563
 
12564
+ /*
12565
+ * @Author: baozhoutao@steedos.com
12566
+ * @Date: 2023-04-07 18:31:31
12567
+ * @LastEditors: baozhoutao@steedos.com
12568
+ * @LastEditTime: 2023-04-12 14:25:02
12569
+ * @Description:
12570
+ */
12571
+ var SteedosSkeleton = function (props) {
12572
+ var body = props.body, render = props.render, _a = props.bodyClassName, bodyClassName = _a === void 0 ? "" : _a, _b = props.config, config = _b === void 0 ? {} : _b;
12573
+ if (isString(config)) {
12574
+ config = JSON.parse(config);
12575
+ }
12576
+ var active = config.active, avatar = config.avatar, loading = config.loading, paragraph = config.paragraph, round = config.round, title = config.title;
12577
+ loading = isBoolean(loading) ? loading : loading === 'true';
12578
+ // console.log("SteedosSkeleton====>", loading, config, typeof loading)
12579
+ return React.createElement(React.Fragment, null,
12580
+ React.createElement(Skeleton, { active: active, avatar: avatar, loading: loading, paragraph: paragraph, round: round, title: title }),
12581
+ React.createElement("div", { className: loading ? 'hidden w-full h-full' : 'w-full h-full' }, body ? (React.createElement("div", { className: "steedos-skeleton-body ".concat(bodyClassName) }, render('body', body, {
12582
+ // 这里的信息会作为 props 传递给子组件,一般情况下都不需要这个
12583
+ }))) : null));
12584
+ };
12585
+
12005
12586
  var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0, function () {
12006
12587
  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;
12007
12588
  return __generator(this, function (_d) {
@@ -12043,6 +12624,8 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
12043
12624
  schema = _d.sent();
12044
12625
  amisSchema = schema.amisSchema;
12045
12626
  if (defaultData) {
12627
+ // 让ObjectForm支持props中的dafaultData属性与上层组件配置的defaultData混合
12628
+ // 为了解决相关表新建时如果是表单类型微页面,因为找不到ObjectForm在哪层而造成无法设置ObjectForm的defaultData的问题
12046
12629
  amisSchema.data.defaultData = __assign$2({ "&": "${defaultData}" }, defaultData);
12047
12630
  }
12048
12631
  uiSchema = schema.uiSchema;
@@ -12059,6 +12642,9 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
12059
12642
  // if(objectApiName){
12060
12643
  // formData.objectName = objectApiName;
12061
12644
  // }
12645
+ if (has(props, "recordId") && $schema.recordId !== "${recordId}") {
12646
+ formData.recordId = props.recordId;
12647
+ }
12062
12648
  amisSchema.className = "steedos-object-form ".concat(className);
12063
12649
  amisSchema.data = Object.assign(amisSchema.data, formData, { global: globalData, uiSchema: uiSchema });
12064
12650
  // console.log(`===AmisObjectForm=amisSchema==`, amisSchema)
@@ -12068,11 +12654,11 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
12068
12654
  }); };
12069
12655
 
12070
12656
  var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, void 0, function () {
12071
- 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;
12072
- return __generator(this, function (_e) {
12073
- switch (_e.label) {
12657
+ 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;
12658
+ return __generator(this, function (_f) {
12659
+ switch (_f.label) {
12074
12660
  case 0:
12075
- $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;
12661
+ $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;
12076
12662
  ctx = props.ctx;
12077
12663
  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);
12078
12664
  defaults = {};
@@ -12099,7 +12685,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
12099
12685
  }
12100
12686
  return [4 /*yield*/, getUISchema(objectApiName, false)];
12101
12687
  case 1:
12102
- objectUiSchema = _e.sent();
12688
+ objectUiSchema = _f.sent();
12103
12689
  listView = find(objectUiSchema.list_views, function (listView, name) {
12104
12690
  // 传入listViewName空值则取第一个
12105
12691
  if (!listName) {
@@ -12131,11 +12717,11 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
12131
12717
  "blank": false
12132
12718
  },
12133
12719
  "actionType": "link",
12134
- "expression": "${!!!event.data.recordId && event.data.__deletedRecord != true}" //是新建, 则进入详细页面.
12720
+ "expression": "${!!!event.data.recordId && event.data.__deletedRecord != true && event.data._isRelated != true}" //是新建, 则进入详细页面.
12135
12721
  },
12136
12722
  {
12137
12723
  "actionType": "reload",
12138
- "expression": "${event.data.recordId || event.data.__deletedRecord === true}" //不是新建, 则刷新列表
12724
+ "expression": "${(event.data.recordId || event.data.__deletedRecord === true || event.data.displayAs === 'split') && event.data._isRelated != true}" //不是新建, 或分栏模式下新建主对象记录, 则刷新列表
12139
12725
  }
12140
12726
  ]
12141
12727
  };
@@ -12153,9 +12739,9 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
12153
12739
  }
12154
12740
  amisSchemaData = Object.assign({}, data, defaultData);
12155
12741
  listViewId = (ctx === null || ctx === void 0 ? void 0 : ctx.listViewId) || amisSchemaData.listViewId;
12156
- 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 }))];
12742
+ 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 }))];
12157
12743
  case 2:
12158
- schema = (_e.sent());
12744
+ schema = (_f.sent());
12159
12745
  amisSchema = schema.amisSchema;
12160
12746
  uiSchema = schema.uiSchema;
12161
12747
  body = [amisSchema];
@@ -12176,19 +12762,20 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
12176
12762
  {
12177
12763
  "type": "wrapper",
12178
12764
  "size": "none",
12179
- "className": "flex-shrink-0 min-w-[200px] overflow-y-auto border-r border-gray-200 lg:order-first lg:flex lg:flex-col",
12765
+ "className": "flex-shrink-0 min-w-[200px] h-full border-r border-gray-200 lg:order-first lg:flex lg:flex-col",
12180
12766
  "body": sideSchema
12181
12767
  },
12182
12768
  {
12183
12769
  "type": "wrapper",
12184
12770
  "size": "none",
12185
- "className": "flex-1 overflow-y-auto focus:outline-none lg:order-last w-96",
12771
+ "className": "flex-1 focus:outline-none lg:order-last w-96 h-full",
12186
12772
  "body": body
12187
12773
  },
12188
12774
  ]
12189
12775
  }];
12190
12776
  }
12191
12777
  serviceData = Object.assign({}, { listName: listName, uiSchema: uiSchema, showDisplayAs: showDisplayAs, displayAs: displayAs, recordPermissions: uiSchema.permissions, _id: null, $listviewId: listName });
12778
+ // console.timeEnd('AmisObjectListView')
12192
12779
  return [2 /*return*/, {
12193
12780
  "type": "service",
12194
12781
  "body": body,
@@ -12270,6 +12857,7 @@ var AmisObjectTable = function (props) { return __awaiter(void 0, void 0, void 0
12270
12857
  amisSchema.data = Object.assign({}, amisSchema.data, amisSchemaData);
12271
12858
  amisSchema.className = "steedos-object-table h-full flex flex-col ".concat(className);
12272
12859
  // console.log(`AmisObjectTable===>amisSchema`, amisSchema)
12860
+ // console.timeEnd('AmisObjectTable')
12273
12861
  return [2 /*return*/, amisSchema];
12274
12862
  }
12275
12863
  });
@@ -12327,7 +12915,8 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
12327
12915
  "_id": "\${event.data.record._id}",
12328
12916
  "recordId": "\${event.data.record._id}",
12329
12917
  "recordLoaded": true,
12330
- }
12918
+ },
12919
+ "expression": "${event.data.objectName == '".concat(objectUiSchema === null || objectUiSchema === void 0 ? void 0 : objectUiSchema.name, "'}")
12331
12920
  }
12332
12921
  ]
12333
12922
  }
@@ -12374,6 +12963,36 @@ var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void
12374
12963
  });
12375
12964
  }); };
12376
12965
 
12966
+ /*
12967
+ * @Author: baozhoutao@steedos.com
12968
+ * @Date: 2022-12-08 10:32:17
12969
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
12970
+ * @LastEditTime: 2023-04-14 11:30:21
12971
+ * @Description:
12972
+ */
12973
+ var AmisRecordService = function (props) { return __awaiter(void 0, void 0, void 0, function () {
12974
+ var className, _a, objectApiName, body, style, schema;
12975
+ return __generator(this, function (_b) {
12976
+ switch (_b.label) {
12977
+ case 0:
12978
+ 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;
12979
+ return [4 /*yield*/, getRecordServiceSchema(objectApiName)];
12980
+ case 1:
12981
+ schema = (_b.sent()).amisSchema;
12982
+ if (body) {
12983
+ schema.body = body;
12984
+ }
12985
+ if (className) {
12986
+ schema.className = className;
12987
+ }
12988
+ if (style) {
12989
+ Object.assign(schema.style, style);
12990
+ }
12991
+ return [2 /*return*/, schema];
12992
+ }
12993
+ });
12994
+ }); };
12995
+
12377
12996
  var AmisRecordDetailRelatedList = function (props) { return __awaiter(void 0, void 0, void 0, function () {
12378
12997
  var objectApiName, recordId, relatedObjectApiName, relatedKey, top, perPage, appId, relatedLabel, _a, className, columns, sort, filters, visible_on, formFactor, schema;
12379
12998
  return __generator(this, function (_b) {
@@ -13368,7 +13987,7 @@ var AmisInstanceDetail = function (props) { return __awaiter(void 0, void 0, voi
13368
13987
  }); };
13369
13988
 
13370
13989
  var PageListView = function (props) { return __awaiter(void 0, void 0, void 0, function () {
13371
- var defaultFormFactor, appId, objectApiName, listviewId, display, _a, $schema, listName, displayAs, formFactor, page, listViewId, listSchema, defData;
13990
+ var defaultFormFactor, appId, objectApiName, listviewId, display, _a, $schema, listName, displayAs, formFactor, page, listViewId, listSchema, defData, pageGridClassName, pageSplitClassName;
13372
13991
  return __generator(this, function (_b) {
13373
13992
  switch (_b.label) {
13374
13993
  case 0:
@@ -13406,11 +14025,12 @@ var PageListView = function (props) { return __awaiter(void 0, void 0, void 0, f
13406
14025
  if (listName) {
13407
14026
  defData.listName = listName || listviewId;
13408
14027
  }
13409
- // console.log("defData====>", defData)
14028
+ pageGridClassName = listSchema.pageGridClassName || 'h-full sm:p-3';
14029
+ pageSplitClassName = listSchema.pageSplitClassName || 'p-0 flex flex-1 overflow-hidden h-full';
13410
14030
  return [2 /*return*/, {
13411
14031
  type: 'service',
13412
14032
  data: defData,
13413
- "className": (displayAs === 'grid') ? 'h-full sm:p-3' : 'p-0 flex flex-1 overflow-hidden h-full',
14033
+ "className": (displayAs === 'grid') ? pageGridClassName : pageSplitClassName,
13414
14034
  body: (displayAs === 'grid') ? defaultsDeep$1({ data: defData }, listSchema) : [
13415
14035
  {
13416
14036
  "type": "wrapper",
@@ -13503,5 +14123,5 @@ var index_esm = /*#__PURE__*/Object.freeze({
13503
14123
  SteedosUI: SteedosUI$1
13504
14124
  });
13505
14125
 
13506
- export { AmisAppLauncher, AmisAppMenu, AmisGlobalHeader, AmisInstanceDetail, index_esm$1 as AmisLib, AmisLogo, AmisObjectButton, AmisObjectCalendar, AmisObjectFieldLookup, AmisObjectForm, AmisObjectListView, AmisObjectTable, AmisProvider, AmisRecordDetail, AmisRecordDetailHeader, AmisRecordDetailRelatedList, AmisRecordDetailRelatedLists, AmisSelectFlow, AmisSelectUser, AmisSteedosField, FromNow, PageListView, PageRecordDetail, SteedosBadge, SteedosBadgeRibbon, SteedosDropdown, SteedosDropdownButton, SteedosIcon, index_esm as SteedosLib, SteedosLoading };
14126
+ export { AmisAppLauncher, AmisAppMenu, AmisGlobalHeader, AmisInstanceDetail, index_esm$1 as AmisLib, AmisLogo, AmisObjectButton, AmisObjectCalendar, AmisObjectFieldLookup, AmisObjectForm, AmisObjectListView, AmisObjectTable, AmisProvider, AmisRecordDetail, AmisRecordDetailHeader, AmisRecordDetailRelatedList, AmisRecordDetailRelatedLists, AmisRecordService, AmisSelectFlow, AmisSelectUser, AmisSteedosField, FromNow, PageListView, PageRecordDetail, SteedosBadge, SteedosBadgeRibbon, SteedosDropdown, SteedosDropdownButton, SteedosIcon, index_esm as SteedosLib, SteedosLoading, SteedosSkeleton };
13507
14127
  //# sourceMappingURL=amis-object.esm.js.map