@steedos/service-plugin-amis 2.5.0-beta.1 → 2.5.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/main/default/client/amis.render.client.js +23 -24
- package/main/default/pages/apps_form.page.amis.json +78 -68
- package/main/default/pages/listview_form.page.amis.json +1 -1
- package/main/default/services/amis-design.service.js +6 -6
- package/main/default/services/amis.service.js +2 -2
- package/main/default/services/utils/page-schema.js +11 -56
- package/package.json +2 -2
- package/public/tailwind/tailwind-steedos.css +109 -6
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
const { $schema, body, render } = props
|
|
82
82
|
const [schema, setSchema] = amisReact.useState(null);
|
|
83
83
|
amisReact.useEffect(()=>{
|
|
84
|
-
console.log("AmisWrapper===>==useEffect==", comp.amis.render.type, JSON.stringify(props.data?.recordId))
|
|
84
|
+
// console.log("AmisWrapper===>==useEffect==", comp.amis.render.type, JSON.stringify(props.data?.recordId))
|
|
85
85
|
const result = Component.class(props);
|
|
86
86
|
if(result.then && typeof result.then === 'function'){
|
|
87
87
|
result.then((data)=>{
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
// console.log("AmisWrapper===>==useEffect==result", result)
|
|
93
93
|
setSchema(result)
|
|
94
94
|
}
|
|
95
|
-
}, [JSON.stringify($schema)
|
|
95
|
+
}, [JSON.stringify($schema)]) //, JSON.stringify(props.data)
|
|
96
96
|
|
|
97
97
|
if (!schema)
|
|
98
98
|
return render('body', {
|
|
@@ -109,8 +109,7 @@
|
|
|
109
109
|
console.trace('Component: ', props, 'Generated Amis Schema: ', schema);
|
|
110
110
|
console.groupEnd();
|
|
111
111
|
}
|
|
112
|
-
|
|
113
|
-
return amisReact.createElement(amisReact.Fragment, null, amisReact.createElement(amisReact.Fragment, null, schema && render ? render('body', schema) : ''), amisReact.createElement(amisReact.Fragment, null, render ? render('body', body) : ''));
|
|
112
|
+
return amisReact.createElement(amisReact.Fragment, null, amisReact.createElement(amisReact.Fragment, null, schema && render ? render('body', schema) : ''));
|
|
114
113
|
}
|
|
115
114
|
}
|
|
116
115
|
// 注册amis渲染器
|
|
@@ -220,33 +219,33 @@
|
|
|
220
219
|
// return div;
|
|
221
220
|
// },
|
|
222
221
|
jumpTo: (to, action) => {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
222
|
+
if (to === 'goBack') {
|
|
223
|
+
return window.history.back();
|
|
224
|
+
}
|
|
226
225
|
|
|
227
|
-
|
|
226
|
+
to = normalizeLink(to);
|
|
228
227
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
228
|
+
if (action && action.actionType === 'url') {
|
|
229
|
+
action.blank === false ? (window.location.href = to) : window.open(to);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
233
232
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
233
|
+
// 主要是支持 nav 中的跳转
|
|
234
|
+
if (action && to && action.target) {
|
|
235
|
+
window.open(to, action.target);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
239
238
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
239
|
+
if (/^https?:\/\//.test(to)) {
|
|
240
|
+
window.location.replace(to);
|
|
241
|
+
} else {
|
|
242
|
+
FlowRouter.go(to);
|
|
243
|
+
}
|
|
245
244
|
},
|
|
246
245
|
theme: 'antd',
|
|
247
246
|
isCurrentUrl: isCurrentUrl,
|
|
248
247
|
};
|
|
249
|
-
|
|
248
|
+
// 已弃用
|
|
250
249
|
const AmisRender = function (props) {
|
|
251
250
|
let env = props.env;
|
|
252
251
|
const schema = props.schema;
|
|
@@ -338,10 +337,10 @@
|
|
|
338
337
|
return scoped = ref
|
|
339
338
|
}
|
|
340
339
|
|
|
341
|
-
|
|
342
340
|
const amisScope = amisRequire('amis/embed').embed(root, schema, {data, name, locale: getAmisLng()}, Object.assign({}, AmisEnv, env))
|
|
343
341
|
if(window.SteedosUI && refName){
|
|
344
342
|
SteedosUI.refs[refName] = amisScope;
|
|
343
|
+
SteedosUI.refs[refName].__$schema = schema;
|
|
345
344
|
}
|
|
346
345
|
};
|
|
347
346
|
|
|
@@ -2,62 +2,64 @@
|
|
|
2
2
|
"type": "page",
|
|
3
3
|
"body": [
|
|
4
4
|
{
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"promptPageLeave": true,
|
|
10
|
-
"name": "form_edit_${recordId}",
|
|
11
|
-
"title": "",
|
|
5
|
+
"type": "service",
|
|
6
|
+
"className": "col-span-2 m-0",
|
|
7
|
+
"id": "tabs-options-service",
|
|
8
|
+
"affixFooter": false,
|
|
12
9
|
"api": {
|
|
13
10
|
"method": "post",
|
|
14
11
|
"url": "${context.rootUrl}/graphql",
|
|
12
|
+
"adaptor": "let data = payload.data;\ndata.tabs_options = [];\nif (data.options && data.options.length) {\n data.tabs_options = data.options.map(function (option) { \n option.label = option.label + \"(\" + option.value + \")\";\n return option;\n });\n}\ndelete data.options\npayload.data = data;\nreturn payload;\n",
|
|
15
13
|
"data": {
|
|
16
|
-
"
|
|
17
|
-
"recordId": "${recordId}",
|
|
18
|
-
"modalName": "${modalName}",
|
|
19
|
-
"objectName": "${objectName}"
|
|
20
|
-
},
|
|
21
|
-
"requestAdaptor": "\nconst formData = api.data.$;\nconst recordId = formData.recordId;\nfor (key in formData){\n // image、select等字段清空值后保存的空字符串转换为null。\n if(formData[key] === ''){\n formData[key] = null;\n }\n}\nconst objectName = api.data.objectName;\nconst fieldsName = Object.keys(formData);\ndelete formData.created;\ndelete formData.created_by;\ndelete formData.modified;\ndelete formData.modified_by;\ndelete formData._display;\ndelete formData.tabs_options;\ndelete formData.tab_groups_options;\ndelete formData.sldsIconsOptions;\ndelete formData.recordId;\n\n// 新加字段tab_items,值同步回传到老字段tabs中兼容老UI界面\nformData.tabs = [];\nif (formData.tab_items && formData.tab_items.length) { \n formData.tabs = formData.tab_items.map(function (item) { return item.tab_name; });\n}\n\n/*\ntab_items存储为:\ntab_items: {\n test1:{\n group:\"xxx\"\n },\n test3:{\n group:\"yyy\"\n }\n}\n而不是:\ntab_items: [\n {\n \"index\":1,\n \"group\":\"xxx\"\n },\n {\n \"index\":2,\n \"group\":\"yyy\"\n }\n]\n*/\nif (formData.tab_items) { \n formData.tab_items = _.keyBy(formData.tab_items, \"tab_name\")\n let tempIndex = 0;\n _.each(formData.tab_items, function (n, k) {\n tempIndex++;\n n.index = tempIndex;\n delete n.tab_name;\n });\n}\n\nlet query = `mutation{record: ${objectName}__insert(doc: {__saveData}){_id}}`;\nif(recordId){\n query = `mutation{record: ${objectName}__update(id: \"${recordId}\", doc: {__saveData}){_id}}`;\n};\ndelete formData._id;\nlet __saveData = JSON.stringify(JSON.stringify(formData));\n\napi.data = {query: query.replace('{__saveData}', __saveData)};\nreturn api;\n",
|
|
22
|
-
"responseData": {
|
|
23
|
-
"recordId": "${record._id}"
|
|
14
|
+
"query": "{options:tabs{_id label:label value:name,type,object,desktop,mobile}}"
|
|
24
15
|
},
|
|
25
|
-
"adaptor": "\nif (payload.errors) {\n payload.status = 2;\n payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;\n}\nreturn payload;",
|
|
26
16
|
"headers": {
|
|
27
17
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
28
18
|
}
|
|
29
19
|
},
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
"url": "${context.rootUrl}/graphql",
|
|
33
|
-
"sendOn": "!!this.recordId",
|
|
34
|
-
"adaptor": "var data = payload.data.data[0];\nif(data){\n //初始化接口返回的字段移除字段值为null的字段\n for (key in data){\n if(data[key] === null){\n delete data[key];\n }\n }\n};\nif (data.tab_items && !_.isArray(data.tab_items)) {\n // 数据库中存储的是对象格式而不是数组,转换为数组用于界面显示\n let arrTabItems = [];\n _.each(data.tab_items, function (n, k) {\n n.tab_name = k;\n delete n.index;\n arrTabItems.push(n);\n });\n data.tab_items = arrTabItems;\n}\npayload.data = data;\ndelete payload.extensions;\nreturn payload;\n ",
|
|
35
|
-
"data": {
|
|
36
|
-
"query": "{data:apps(filters:[\"_id\", \"=\", \"${recordId}\"]){_id,name,code,icon_slds,visible, showSidebar, description,tabs,tab_items,tab_groups,objects,mobile_objects,is_creator,mobile,sort,url,is_use_ie,is_use_iframe,is_new_window,on_click,auth_name,secret,is_system,from_code_id,instance_state,created,created_by:created_by__expand{_id,name},modified,modified_by:modified_by__expand{_id,name},_display{visible,is_creator,mobile,is_use_ie,is_use_iframe,is_new_window,is_system,instance_state,created,modified}}}"
|
|
37
|
-
},
|
|
38
|
-
"headers": {
|
|
39
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
"initFetch": true,
|
|
20
|
+
"placeholder": "-",
|
|
21
|
+
"messages": {},
|
|
43
22
|
"body": [
|
|
44
23
|
{
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
24
|
+
"className": "steedos-amis-form",
|
|
25
|
+
"type": "form",
|
|
26
|
+
"mode": "normal",
|
|
27
|
+
"persistData": false,
|
|
28
|
+
"canAccessSuperData": false,
|
|
29
|
+
"promptPageLeave": true,
|
|
30
|
+
"name": "form_edit_${recordId}",
|
|
31
|
+
"title": "",
|
|
49
32
|
"api": {
|
|
50
33
|
"method": "post",
|
|
51
34
|
"url": "${context.rootUrl}/graphql",
|
|
52
|
-
"adaptor": "let data = payload.data;\ndata.tabs_options = [];\nif (data.options && data.options.length) {\n data.tabs_options = data.options.map(function (option) { \n option.label = option.label + \"(\" + option.value + \")\";\n return option;\n });\n}\ndelete data.options\npayload.data = data;\nreturn payload;\n",
|
|
53
35
|
"data": {
|
|
54
|
-
"
|
|
36
|
+
"$": "$$",
|
|
37
|
+
"recordId": "${recordId}",
|
|
38
|
+
"modalName": "${modalName}",
|
|
39
|
+
"objectName": "${objectName}"
|
|
40
|
+
},
|
|
41
|
+
"requestAdaptor": "\nconst formData = api.data.$;\nconst recordId = formData.recordId;\nfor (key in formData){\n // image、select等字段清空值后保存的空字符串转换为null。\n if(formData[key] === ''){\n formData[key] = null;\n }\n}\nconst objectName = api.data.objectName;\nconst fieldsName = Object.keys(formData);\ndelete formData.created;\ndelete formData.created_by;\ndelete formData.modified;\ndelete formData.modified_by;\ndelete formData._display;\ndelete formData.tabs_options;\ndelete formData.tab_groups_options;\ndelete formData.sldsIconsOptions;\ndelete formData.recordId;\n\n// 新加字段tab_items,值同步回传到老字段tabs中兼容老UI界面\nformData.tabs = [];\nif (formData.tab_items && formData.tab_items.length) { \n formData.tabs = formData.tab_items.map(function (item) { return item.tab_name; });\n}\n\n/*\ntab_items存储为:\ntab_items: {\n test1:{\n group:\"xxx\"\n },\n test3:{\n group:\"yyy\"\n }\n}\n而不是:\ntab_items: [\n {\n \"index\":1,\n \"group\":\"xxx\"\n },\n {\n \"index\":2,\n \"group\":\"yyy\"\n }\n]\n*/\nif (formData.tab_items) { \n formData.tab_items = _.keyBy(formData.tab_items, \"tab_name\")\n let tempIndex = 0;\n _.each(formData.tab_items, function (n, k) {\n tempIndex++;\n n.index = tempIndex;\n delete n.tab_name;\n });\n}\n\nlet query = `mutation{record: ${objectName}__insert(doc: {__saveData}){_id}}`;\nif(recordId){\n query = `mutation{record: ${objectName}__update(id: \"${recordId}\", doc: {__saveData}){_id}}`;\n};\ndelete formData._id;\nlet __saveData = JSON.stringify(JSON.stringify(formData));\n\napi.data = {query: query.replace('{__saveData}', __saveData)};\nreturn api;\n",
|
|
42
|
+
"responseData": {
|
|
43
|
+
"recordId": "${record._id}"
|
|
44
|
+
},
|
|
45
|
+
"adaptor": "\nif (payload.errors) {\n payload.status = 2;\n payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;\n}\nreturn payload;",
|
|
46
|
+
"headers": {
|
|
47
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"initApi": {
|
|
51
|
+
"method": "post",
|
|
52
|
+
"url": "${context.rootUrl}/graphql",
|
|
53
|
+
"sendOn": "!!this.recordId",
|
|
54
|
+
"adaptor": "var data = payload.data.data[0];\nif(data){\n //初始化接口返回的字段移除字段值为null的字段\n for (key in data){\n if(data[key] === null){\n delete data[key];\n }\n }\n};\nif (data.tab_items && !_.isArray(data.tab_items)) {\n // 数据库中存储的是对象格式而不是数组,转换为数组用于界面显示\n let arrTabItems = [];\n _.each(data.tab_items, function (n, k) {\n n.tab_name = k;\n delete n.index;\n arrTabItems.push(n);\n });\n data.tab_items = arrTabItems;\n}\npayload.data = data;\ndelete payload.extensions;\nreturn payload;\n ",
|
|
55
|
+
"data": {
|
|
56
|
+
"query": "{data:apps(filters:[\"_id\", \"=\", \"${recordId}\"]){_id,name,code,icon_slds,visible, showSidebar, enable_nav_schema, description,tabs,tab_items,tab_groups,objects,mobile_objects,is_creator,mobile,sort,url,is_use_ie,is_use_iframe,is_new_window,on_click,auth_name,secret,is_system,from_code_id,instance_state,created,created_by:created_by__expand{_id,name},modified,modified_by:modified_by__expand{_id,name},_display{visible,is_creator,mobile,is_use_ie,is_use_iframe,is_new_window,is_system,instance_state,created,modified}}}"
|
|
55
57
|
},
|
|
56
58
|
"headers": {
|
|
57
59
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
58
60
|
}
|
|
59
61
|
},
|
|
60
|
-
"
|
|
62
|
+
"initFetch": true,
|
|
61
63
|
"body": [
|
|
62
64
|
{
|
|
63
65
|
"type": "tabs",
|
|
@@ -506,6 +508,15 @@
|
|
|
506
508
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
507
509
|
}
|
|
508
510
|
}
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
"name": "enable_nav_schema",
|
|
514
|
+
"label": "启用自定义导航",
|
|
515
|
+
"type": "checkbox",
|
|
516
|
+
"tpl": null,
|
|
517
|
+
"className": "m-0",
|
|
518
|
+
"labelClassName": "text-left",
|
|
519
|
+
"id": "u:07a8a4c5f89"
|
|
509
520
|
}
|
|
510
521
|
],
|
|
511
522
|
"size": "none"
|
|
@@ -518,39 +529,38 @@
|
|
|
518
529
|
"contentClassName": ""
|
|
519
530
|
}
|
|
520
531
|
],
|
|
521
|
-
"
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
"script": "const data = context.props.data;\nif (!data._id) { \n return;\n}\nif (data.tab_items) {\n return;\n}\n\nconst tabOptions = data.tabs_options || [];\nconst tabItems = [];\n// 把应用中原来tabs属性值添加到新的tab_items属性的默认值中\nif (data.tabs && data.tabs.length) {\n data.tabs.forEach(function (item) {\n tabItems.push({ tab_name: item });\n });\n}\nconst pushObjectsToTabItems = function (objects) {\n objects.forEach(function (item) {\n // 已经有绑定到指定对象的选项卡就不添加\n let existObjectItem = !!tabItems.find(function (tabItem) {\n return !!tabOptions.find(function (option) {\n return tabItem.tab_name === tabItem.value && option.object === item;\n });\n });\n if (existObjectItem) {\n return;\n }\n // 找到指向指定对象的选项卡\n let tempOption = tabOptions.find(function (option) {\n return option.type === \"object\" && option.object === item;\n });\n if (!tempOption) {\n return;\n }\n // 选项卡名称如果重复了就不添加\n let existTabItem = !!tabItems.find(function (tabItem) {\n return tabItem.tab_name === tempOption.value;\n });\n if (existTabItem) {\n return;\n }\n if (tempOption) {\n tabItems.push({ tab_name: tempOption.value });\n }\n });\n}\n// 把应用中原来objects属性值添加到新的tab_items属性的默认值中\nif (data.objects && data.objects.length) {\n pushObjectsToTabItems(data.objects);\n}\n// 把应用中原来mobile_objects属性值添加到新的tab_items属性的默认值中\nif (data.mobile_objects && data.mobile_objects.length) {\n pushObjectsToTabItems(data.mobile_objects);\n}\n\ndoAction({\n actionType: 'setValue',\n args: {\n \"value\": { tab_items: tabItems }\n }\n});"
|
|
535
|
-
}
|
|
536
|
-
]
|
|
537
|
-
},
|
|
538
|
-
"submitSucc": {
|
|
539
|
-
"weight": 0,
|
|
540
|
-
"actions": [
|
|
541
|
-
{
|
|
542
|
-
"actionType": "broadcast",
|
|
543
|
-
"args": {
|
|
544
|
-
"eventName": "@data.changed.apps"
|
|
532
|
+
"panelClassName": "m-0 -mt-3",
|
|
533
|
+
"actions": false,
|
|
534
|
+
"actionsClassName": "p-sm b-t b-light text-center",
|
|
535
|
+
"affixFooter": false,
|
|
536
|
+
"debug": false,
|
|
537
|
+
"onEvent": {
|
|
538
|
+
"inited": {
|
|
539
|
+
"actions": [
|
|
540
|
+
{
|
|
541
|
+
"actionType": "custom",
|
|
542
|
+
"script": "const data = context.props.data;\nif (!data._id) { \n return;\n}\nif (data.tab_items) {\n return;\n}\n\nconst tabOptions = data.tabs_options || [];\nconst tabItems = [];\n// 把应用中原来tabs属性值添加到新的tab_items属性的默认值中\nif (data.tabs && data.tabs.length) {\n data.tabs.forEach(function (item) {\n tabItems.push({ tab_name: item });\n });\n}\nconst pushObjectsToTabItems = function (objects) {\n objects.forEach(function (item) {\n // 已经有绑定到指定对象的选项卡就不添加\n let existObjectItem = !!tabItems.find(function (tabItem) {\n return !!tabOptions.find(function (option) {\n return tabItem.tab_name === tabItem.value && option.object === item;\n });\n });\n if (existObjectItem) {\n return;\n }\n // 找到指向指定对象的选项卡\n let tempOption = tabOptions.find(function (option) {\n return option.type === \"object\" && option.object === item;\n });\n if (!tempOption) {\n return;\n }\n // 选项卡名称如果重复了就不添加\n let existTabItem = !!tabItems.find(function (tabItem) {\n return tabItem.tab_name === tempOption.value;\n });\n if (existTabItem) {\n return;\n }\n if (tempOption) {\n tabItems.push({ tab_name: tempOption.value });\n }\n });\n}\n// 把应用中原来objects属性值添加到新的tab_items属性的默认值中\nif (data.objects && data.objects.length) {\n pushObjectsToTabItems(data.objects);\n}\n// 把应用中原来mobile_objects属性值添加到新的tab_items属性的默认值中\nif (data.mobile_objects && data.mobile_objects.length) {\n pushObjectsToTabItems(data.mobile_objects);\n}\n\ndoAction({\n actionType: 'setValue',\n args: {\n \"value\": { tab_items: tabItems }\n }\n});"
|
|
543
|
+
}
|
|
544
|
+
]
|
|
545
545
|
},
|
|
546
|
-
"
|
|
547
|
-
"
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
546
|
+
"submitSucc": {
|
|
547
|
+
"weight": 0,
|
|
548
|
+
"actions": [
|
|
549
|
+
{
|
|
550
|
+
"actionType": "broadcast",
|
|
551
|
+
"args": {
|
|
552
|
+
"eventName": "@data.changed.apps"
|
|
553
|
+
},
|
|
554
|
+
"data": {
|
|
555
|
+
"objectName": "apps"
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
]
|
|
559
|
+
}
|
|
560
|
+
},
|
|
561
|
+
"id": "apps-form"
|
|
562
|
+
}
|
|
563
|
+
]
|
|
554
564
|
}
|
|
555
565
|
],
|
|
556
566
|
"regions": [
|
|
@@ -234,15 +234,15 @@ module.exports = {
|
|
|
234
234
|
*/
|
|
235
235
|
const relatedListObjects = [];
|
|
236
236
|
const relationsInfo = await object.getRelationsInfo();
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
237
|
+
let details = relationsInfo && relationsInfo.details;
|
|
238
|
+
const lookupDetails = relationsInfo && relationsInfo.lookup_details;
|
|
239
|
+
details = _.union(details, lookupDetails);
|
|
240
240
|
|
|
241
241
|
_.each(details, function(related){
|
|
242
242
|
/*related可能是一个lookup_details,它是对象而不是字符串,从中取出key值*/
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
243
|
+
if(typeof related !== "string"){
|
|
244
|
+
relatedListObjects.push(related.objectName)
|
|
245
|
+
}
|
|
246
246
|
let foo = related.split('.');
|
|
247
247
|
let rObjectName = foo[0];
|
|
248
248
|
relatedListObjects.push(rObjectName);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author: baozhoutao@steedos.com
|
|
3
3
|
* @Date: 2022-05-19 11:38:30
|
|
4
|
-
* @LastEditors:
|
|
5
|
-
* @LastEditTime: 2023-
|
|
4
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
+
* @LastEditTime: 2023-04-19 13:20:20
|
|
6
6
|
* @Description:
|
|
7
7
|
*/
|
|
8
8
|
const PageSchema = require('./utils/page-schema');
|
|
@@ -100,67 +100,22 @@ const getRecordPageInitSchema = async function (objectApiName, userSession) {
|
|
|
100
100
|
if (hasRelatedLists) {
|
|
101
101
|
content.tabs.push(related)
|
|
102
102
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
"objectApiName": "${objectName}",
|
|
110
|
-
"recordId": "${recordId}",
|
|
111
|
-
onEvent: {
|
|
112
|
-
"recordLoaded": {
|
|
113
|
-
"actions": [
|
|
114
|
-
{
|
|
115
|
-
"actionType": "reload",
|
|
116
|
-
"data": {
|
|
117
|
-
"name": `\${event.data.record.${uiSchema.NAME_FIELD_KEY || 'name'}}`,
|
|
118
|
-
"record": `\${event.data.record}`,
|
|
119
|
-
"recordLoaded": true,
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
"actionType": "reload",
|
|
124
|
-
"componentId": `page_readonly_${objectApiName}_header`, //刷新标题, 详细页面header service 嵌套太多, 导致仅刷新第一层service无法更新recordName
|
|
125
|
-
"data": {
|
|
126
|
-
"name": `\${event.data.record.${uiSchema.NAME_FIELD_KEY || 'name'}}`,
|
|
127
|
-
"record": `\${event.data.record}`,
|
|
128
|
-
"recordLoaded": true,
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
]
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
content
|
|
136
|
-
],
|
|
137
|
-
data: {
|
|
138
|
-
"_master.objectName": "${objectName}",
|
|
139
|
-
"_master.recordId": "${recordId}"
|
|
140
|
-
},
|
|
141
|
-
onEvent: {
|
|
142
|
-
"recordLoaded": {
|
|
143
|
-
"actions": [
|
|
144
|
-
{
|
|
145
|
-
"actionType": "reload",
|
|
146
|
-
"data": {
|
|
147
|
-
"name": `\${record.${uiSchema.NAME_FIELD_KEY || 'name'}}`,
|
|
148
|
-
"_master.record": `\${record}`,
|
|
149
|
-
// 不清楚reload 如何给对象下的某个key复制, 所以此处重复设置_master的objectName、recordId
|
|
150
|
-
"_master.objectName": "${objectName}",
|
|
151
|
-
"_master.recordId": "${recordId}"
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
]
|
|
155
|
-
}
|
|
103
|
+
body = [
|
|
104
|
+
{
|
|
105
|
+
"type": "steedos-record-detail-header",
|
|
106
|
+
"label": "标题面板",
|
|
107
|
+
"objectApiName": "${objectName}",
|
|
108
|
+
"recordId": "${recordId}"
|
|
156
109
|
},
|
|
157
|
-
|
|
158
|
-
|
|
110
|
+
content
|
|
111
|
+
];
|
|
159
112
|
return {
|
|
160
|
-
type: '
|
|
113
|
+
type: 'steedos-record-service',
|
|
161
114
|
id: `page_${objectApiName}_record_detail`,
|
|
162
115
|
name: getScopeId(objectApiName, "record_detail"),
|
|
116
|
+
objectApiName: "${objectName}",
|
|
163
117
|
bodyClassName: '',
|
|
118
|
+
className: "object-detail-page",
|
|
164
119
|
regions: [
|
|
165
120
|
"body"
|
|
166
121
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-plugin-amis",
|
|
3
|
-
"version": "2.5.0-beta.
|
|
3
|
+
"version": "2.5.0-beta.11",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "yarn build:tailwind-base && yarn build:tailwind",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "72a894aab5a9d4e277d0464decda0ba39f2f50bb",
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"tailwindcss": "3.2.4"
|
|
19
19
|
}
|
|
@@ -89,10 +89,6 @@
|
|
|
89
89
|
margin: 0px
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
.m-3 {
|
|
93
|
-
margin: 0.75rem
|
|
94
|
-
}
|
|
95
|
-
|
|
96
92
|
.mx-4 {
|
|
97
93
|
margin-left: 1rem;
|
|
98
94
|
margin-right: 1rem
|
|
@@ -132,12 +128,20 @@
|
|
|
132
128
|
margin-top: -0.75rem
|
|
133
129
|
}
|
|
134
130
|
|
|
131
|
+
.mb-4 {
|
|
132
|
+
margin-bottom: 1rem
|
|
133
|
+
}
|
|
134
|
+
|
|
135
135
|
.mt-3 {
|
|
136
136
|
margin-top: 0.75rem
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
.mb-
|
|
140
|
-
margin-bottom:
|
|
139
|
+
.mb-0 {
|
|
140
|
+
margin-bottom: 0px
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.ml-2 {
|
|
144
|
+
margin-left: 0.5rem
|
|
141
145
|
}
|
|
142
146
|
|
|
143
147
|
.block {
|
|
@@ -200,11 +204,23 @@
|
|
|
200
204
|
width: 50%
|
|
201
205
|
}
|
|
202
206
|
|
|
207
|
+
.w-96 {
|
|
208
|
+
width: 24rem
|
|
209
|
+
}
|
|
210
|
+
|
|
203
211
|
.min-w-max {
|
|
204
212
|
min-width: -moz-max-content;
|
|
205
213
|
min-width: max-content
|
|
206
214
|
}
|
|
207
215
|
|
|
216
|
+
.min-w-\[240px\] {
|
|
217
|
+
min-width: 240px
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.min-w-\[200px\] {
|
|
221
|
+
min-width: 200px
|
|
222
|
+
}
|
|
223
|
+
|
|
208
224
|
.flex-none {
|
|
209
225
|
flex: none
|
|
210
226
|
}
|
|
@@ -213,6 +229,10 @@
|
|
|
213
229
|
flex: 1 1 0%
|
|
214
230
|
}
|
|
215
231
|
|
|
232
|
+
.flex-shrink-0 {
|
|
233
|
+
flex-shrink: 0
|
|
234
|
+
}
|
|
235
|
+
|
|
216
236
|
.-translate-x-0 {
|
|
217
237
|
--tw-translate-x: -0px;
|
|
218
238
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))
|
|
@@ -247,6 +267,10 @@
|
|
|
247
267
|
column-gap: 0.75rem
|
|
248
268
|
}
|
|
249
269
|
|
|
270
|
+
.overflow-auto {
|
|
271
|
+
overflow: auto
|
|
272
|
+
}
|
|
273
|
+
|
|
250
274
|
.overflow-hidden {
|
|
251
275
|
overflow: hidden
|
|
252
276
|
}
|
|
@@ -255,6 +279,10 @@
|
|
|
255
279
|
overflow-y: auto
|
|
256
280
|
}
|
|
257
281
|
|
|
282
|
+
.rounded {
|
|
283
|
+
border-radius: 0.25rem
|
|
284
|
+
}
|
|
285
|
+
|
|
258
286
|
.border-b-\[3px\] {
|
|
259
287
|
border-bottom-width: 3px
|
|
260
288
|
}
|
|
@@ -286,11 +314,26 @@
|
|
|
286
314
|
border-color: rgb(203 213 225 / var(--tw-border-opacity))
|
|
287
315
|
}
|
|
288
316
|
|
|
317
|
+
.border-gray-200 {
|
|
318
|
+
--tw-border-opacity: 1;
|
|
319
|
+
border-color: rgb(229 231 235 / var(--tw-border-opacity))
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.border-gray-300 {
|
|
323
|
+
--tw-border-opacity: 1;
|
|
324
|
+
border-color: rgb(209 213 219 / var(--tw-border-opacity))
|
|
325
|
+
}
|
|
326
|
+
|
|
289
327
|
.bg-white {
|
|
290
328
|
--tw-bg-opacity: 1;
|
|
291
329
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity))
|
|
292
330
|
}
|
|
293
331
|
|
|
332
|
+
.bg-gray-100 {
|
|
333
|
+
--tw-bg-opacity: 1;
|
|
334
|
+
background-color: rgb(243 244 246 / var(--tw-bg-opacity))
|
|
335
|
+
}
|
|
336
|
+
|
|
294
337
|
.p-0 {
|
|
295
338
|
padding: 0px
|
|
296
339
|
}
|
|
@@ -299,6 +342,10 @@
|
|
|
299
342
|
padding: 1rem
|
|
300
343
|
}
|
|
301
344
|
|
|
345
|
+
.p-2 {
|
|
346
|
+
padding: 0.5rem
|
|
347
|
+
}
|
|
348
|
+
|
|
302
349
|
.px-4 {
|
|
303
350
|
padding-left: 1rem;
|
|
304
351
|
padding-right: 1rem
|
|
@@ -329,6 +376,16 @@
|
|
|
329
376
|
padding-bottom: 0.5rem
|
|
330
377
|
}
|
|
331
378
|
|
|
379
|
+
.py-5 {
|
|
380
|
+
padding-top: 1.25rem;
|
|
381
|
+
padding-bottom: 1.25rem
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.py-1 {
|
|
385
|
+
padding-top: 0.25rem;
|
|
386
|
+
padding-bottom: 0.25rem
|
|
387
|
+
}
|
|
388
|
+
|
|
332
389
|
.pr-4 {
|
|
333
390
|
padding-right: 1rem
|
|
334
391
|
}
|
|
@@ -369,6 +426,18 @@
|
|
|
369
426
|
text-align: center
|
|
370
427
|
}
|
|
371
428
|
|
|
429
|
+
.text-lg {
|
|
430
|
+
font-size: 16px
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.text-xl {
|
|
434
|
+
font-size: 18px
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.font-bold {
|
|
438
|
+
font-weight: 700
|
|
439
|
+
}
|
|
440
|
+
|
|
372
441
|
.lowercase {
|
|
373
442
|
text-transform: lowercase
|
|
374
443
|
}
|
|
@@ -390,6 +459,11 @@
|
|
|
390
459
|
color: rgb(0 0 0 / var(--tw-text-opacity))
|
|
391
460
|
}
|
|
392
461
|
|
|
462
|
+
.text-gray-500 {
|
|
463
|
+
--tw-text-opacity: 1;
|
|
464
|
+
color: rgb(107 114 128 / var(--tw-text-opacity))
|
|
465
|
+
}
|
|
466
|
+
|
|
393
467
|
.underline {
|
|
394
468
|
text-decoration-line: underline
|
|
395
469
|
}
|
|
@@ -428,11 +502,20 @@
|
|
|
428
502
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1)
|
|
429
503
|
}
|
|
430
504
|
|
|
505
|
+
.focus\:outline-none:focus {
|
|
506
|
+
outline: 2px solid transparent;
|
|
507
|
+
outline-offset: 2px
|
|
508
|
+
}
|
|
509
|
+
|
|
431
510
|
@media (min-width: 640px) {
|
|
432
511
|
.sm\:mt-\[90px\] {
|
|
433
512
|
margin-top: 90px
|
|
434
513
|
}
|
|
435
514
|
|
|
515
|
+
.sm\:mt-3 {
|
|
516
|
+
margin-top: 0.75rem
|
|
517
|
+
}
|
|
518
|
+
|
|
436
519
|
.sm\:w-\[220px\] {
|
|
437
520
|
width: 220px
|
|
438
521
|
}
|
|
@@ -454,6 +537,10 @@
|
|
|
454
537
|
border-color: rgb(209 213 219 / var(--tw-border-opacity))
|
|
455
538
|
}
|
|
456
539
|
|
|
540
|
+
.sm\:p-3 {
|
|
541
|
+
padding: 0.75rem
|
|
542
|
+
}
|
|
543
|
+
|
|
457
544
|
.sm\:shadow {
|
|
458
545
|
--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
459
546
|
--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);
|
|
@@ -465,4 +552,20 @@
|
|
|
465
552
|
.lg\:z-50 {
|
|
466
553
|
z-index: 50
|
|
467
554
|
}
|
|
555
|
+
|
|
556
|
+
.lg\:order-first {
|
|
557
|
+
order: -9999
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
.lg\:order-last {
|
|
561
|
+
order: 9999
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
.lg\:flex {
|
|
565
|
+
display: flex
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
.lg\:flex-col {
|
|
569
|
+
flex-direction: column
|
|
570
|
+
}
|
|
468
571
|
}
|