@steedos/service-plugin-amis 2.4.10-beta.7 → 2.4.11-beta.1
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.
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
to = normalizeLink(to);
|
|
224
224
|
|
|
225
225
|
if (action && action.actionType === 'url') {
|
|
226
|
-
action.blank ===
|
|
226
|
+
action.blank === false ? (window.location.href = to) : window.open(to);
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
229
|
|
|
@@ -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}"
|
|
24
|
-
},
|
|
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
|
-
"headers": {
|
|
27
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
"initApi": {
|
|
31
|
-
"method": "post",
|
|
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}}}"
|
|
14
|
+
"query": "{options:tabs{_id label:label value:name,type,object,desktop,mobile}}"
|
|
37
15
|
},
|
|
38
16
|
"headers": {
|
|
39
17
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
40
18
|
}
|
|
41
19
|
},
|
|
42
|
-
"
|
|
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}"
|
|
55
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;",
|
|
56
46
|
"headers": {
|
|
57
47
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
58
48
|
}
|
|
59
49
|
},
|
|
60
|
-
"
|
|
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, 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}}}"
|
|
57
|
+
},
|
|
58
|
+
"headers": {
|
|
59
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"initFetch": true,
|
|
61
63
|
"body": [
|
|
62
64
|
{
|
|
63
65
|
"type": "tabs",
|
|
@@ -518,39 +520,38 @@
|
|
|
518
520
|
"contentClassName": ""
|
|
519
521
|
}
|
|
520
522
|
],
|
|
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"
|
|
523
|
+
"panelClassName": "m-0 -mt-3",
|
|
524
|
+
"actions": false,
|
|
525
|
+
"actionsClassName": "p-sm b-t b-light text-center",
|
|
526
|
+
"affixFooter": false,
|
|
527
|
+
"debug": false,
|
|
528
|
+
"onEvent": {
|
|
529
|
+
"inited": {
|
|
530
|
+
"actions": [
|
|
531
|
+
{
|
|
532
|
+
"actionType": "custom",
|
|
533
|
+
"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});"
|
|
534
|
+
}
|
|
535
|
+
]
|
|
545
536
|
},
|
|
546
|
-
"
|
|
547
|
-
"
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
537
|
+
"submitSucc": {
|
|
538
|
+
"weight": 0,
|
|
539
|
+
"actions": [
|
|
540
|
+
{
|
|
541
|
+
"actionType": "broadcast",
|
|
542
|
+
"args": {
|
|
543
|
+
"eventName": "@data.changed.apps"
|
|
544
|
+
},
|
|
545
|
+
"data": {
|
|
546
|
+
"objectName": "apps"
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
]
|
|
550
|
+
}
|
|
551
|
+
},
|
|
552
|
+
"id": "apps-form"
|
|
553
|
+
}
|
|
554
|
+
]
|
|
554
555
|
}
|
|
555
556
|
],
|
|
556
557
|
"regions": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-plugin-amis",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.11-beta.1",
|
|
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": "94de71d5fb570d39a0e367ee944d9fdc55246fb1",
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"tailwindcss": "3.2.4"
|
|
19
19
|
}
|