@steedos/service-plugin-amis 2.4.0-beta.42 → 2.4.0-beta.43
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.
|
@@ -89,6 +89,23 @@
|
|
|
89
89
|
setSchema(result)
|
|
90
90
|
}
|
|
91
91
|
}, [JSON.stringify($schema)])
|
|
92
|
+
|
|
93
|
+
if (!schema)
|
|
94
|
+
return render('body', {
|
|
95
|
+
"type": "wrapper",
|
|
96
|
+
"className": "h-full flex items-center justify-center",
|
|
97
|
+
"body": {
|
|
98
|
+
"type": "spinner",
|
|
99
|
+
"show": true
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
if (props.env.enableAMISDebug && schema) {
|
|
104
|
+
console.groupCollapsed("steedos debug", `Render ${asset.componentName}`);
|
|
105
|
+
console.trace('Component: ', props, 'Generated Amis Schema: ', schema);
|
|
106
|
+
console.groupEnd();
|
|
107
|
+
}
|
|
108
|
+
|
|
92
109
|
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) : ''));
|
|
93
110
|
}
|
|
94
111
|
}
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"modalName": "${modalName}"
|
|
20
20
|
},
|
|
21
21
|
"requestAdaptor": "const formData = api.data.$;\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;\n\n//数据格式转换\nformData.columns = lodash.map(formData.columns, (item) => {\n return { field: item };\n});\n\nformData.sort = lodash.map(formData.sort, (item) => {\n const arr = item.split(':');\n return { field_name: arr[0], order: arr[1]};\n});\n\nformData.mobile_columns = lodash.map(formData.mobile_columns, (item) => {\n return { field: item };\n});\n\nformData.searchable_fields = lodash.map(formData.searchable_fields, (item) => {\n return { field: item };\n});\n\n\nif (formData._filters_type_controller === 'conditions' && formData._filters_conditions) {\n formData.filters = window.amisConvert.conditionsToFilters(formData._filters_conditions);\n // formData.filters = JSON.stringify(window.amisConvert.conditionsToFilters(formData._filters_conditions), null, 4);\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\nlet query = `mutation{record: ${objectName}__insert(doc: {__saveData}){_id}}`;\nif (formData.recordId) {\n query = `mutation{record: ${objectName}__update(id: \"${formData.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;",
|
|
22
|
+
"adaptor": "if (payload.errors) {\n payload.status = 2;\n payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;\n}\nreturn payload;",
|
|
22
23
|
"responseData": {
|
|
23
24
|
"recordId": "${record._id}"
|
|
24
25
|
},
|
|
25
26
|
"headers": {
|
|
26
27
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
27
|
-
}
|
|
28
|
-
"adaptor": "\nvar object_name = Session.get(\"object_name\");\nif (window.FlowRouter && window.FlowRouter.current().route.pathDef === '/app/:app_id/:object_name/grid/:list_view_id' && object_name != 'object_listviews') {\n var app_id = Session.get(\"app_id\");\n var list_view_id = payload.data.record._id;\n var url = \"/app/\" + app_id + \"/\" + object_name + \"/grid/\" + list_view_id;\n SteedosUI.router.go({ objectName: api.body.objectName, recordId: payload.data.record._id, type: api.body.recordId ? 'edit' : 'new' }, url);\n} else { \n SteedosUI.router.go({objectName: api.body.objectName, recordId: payload.data.record._id, type: api.body.recordId ? 'edit': 'new'});\n}\n\nreturn payload;\n "
|
|
28
|
+
}
|
|
29
29
|
},
|
|
30
30
|
"initApi": {
|
|
31
31
|
"method": "post",
|
|
@@ -517,7 +517,23 @@
|
|
|
517
517
|
"actionsClassName": "p-sm b-t b-light text-center",
|
|
518
518
|
"className": "steedos-amis-form",
|
|
519
519
|
"language": "javascript",
|
|
520
|
-
"id": "listview_form"
|
|
520
|
+
"id": "listview_form",
|
|
521
|
+
"onEvent": {
|
|
522
|
+
"submitSucc": {
|
|
523
|
+
"weight": 0,
|
|
524
|
+
"actions": [
|
|
525
|
+
{
|
|
526
|
+
"actionType": "broadcast",
|
|
527
|
+
"args": {
|
|
528
|
+
"eventName": "@data.changed.object_listviews"
|
|
529
|
+
},
|
|
530
|
+
"data": {
|
|
531
|
+
"objectName": "object_listviews"
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
]
|
|
535
|
+
}
|
|
536
|
+
}
|
|
521
537
|
}
|
|
522
538
|
],
|
|
523
539
|
"regions": [
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"modalName": "${modalName}"
|
|
19
19
|
},
|
|
20
20
|
"requestAdaptor": "\n \n const formData = api.data.$;\n for (key in formData){\n // image、select等字段清空值后保存的空字符串转换为null。\n if(formData[key] === ''){\n formData[key] = null;\n }\n }\n const objectName = api.data.objectName;\n const fieldsName = Object.keys(formData);\n delete formData.created;\n delete formData.created_by;\n delete formData.modified;\n delete formData.modified_by;\n delete formData._display;\n delete formData.sort_order_options;\n delete formData.buttons_options;\n delete formData.fields_options;\n delete formData.field_groups_options;\n delete formData.related_lists_options;\n delete formData.related_object_fields_options;\n delete formData.isLookup;\n\n let query = `mutation{record: ${objectName}__insert(doc: {__saveData}){_id}}`;\n if(formData.recordId){\n query = `mutation{record: ${objectName}__update(id: \"${formData.recordId}\", doc: {__saveData}){_id}}`;\n };\n delete formData._id;\n let __saveData = JSON.stringify(JSON.stringify(formData));\n \n api.data = {query: query.replace('{__saveData}', __saveData)};\n return api;\n ",
|
|
21
|
+
"adaptor": "if (payload.errors) {\n payload.status = 2;\n payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;\n}\nreturn payload;",
|
|
21
22
|
"responseData": {
|
|
22
23
|
"recordId": "${record._id}"
|
|
23
24
|
},
|
|
24
|
-
"adaptor": "var modal = SteedosUI.getRef(api.body.modalName);\nmodal && modal.close();\n SteedosUI.router.go({objectName: api.body.objectName, recordId: payload.data.record._id, type: api.body.recordId ? 'edit': 'new'});\n return payload;\n ",
|
|
25
25
|
"headers": {
|
|
26
26
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
27
27
|
}
|
|
@@ -863,6 +863,20 @@
|
|
|
863
863
|
"script": "// 新建页面布局时初始化related_lists默认值,字段值是CRUD表格控件渲染,新建页面布局时,不会自动填充到form中,需要手动填充\nconst initDefaultRelatedLists = function (input, rowValue, prop_name) {\n const superValues = input.__super.__super || {};\n if (superValues.recordId) {\n // 编辑记录本来就会初始化相关字段值,不需要再初始化\n return;\n }\n return {\n related_lists: superValues.related_lists,\n }\n}\n\nconst eventData = event.data;\ndoAction({\n actionType: 'setValue',\n componentId: \"object-layout-form\",\n args: {\n value: initDefaultRelatedLists(eventData)\n }\n});\n"
|
|
864
864
|
}
|
|
865
865
|
]
|
|
866
|
+
},
|
|
867
|
+
"submitSucc": {
|
|
868
|
+
"weight": 0,
|
|
869
|
+
"actions": [
|
|
870
|
+
{
|
|
871
|
+
"actionType": "broadcast",
|
|
872
|
+
"args": {
|
|
873
|
+
"eventName": "@data.changed.object_layouts"
|
|
874
|
+
},
|
|
875
|
+
"data": {
|
|
876
|
+
"objectName": "object_layouts"
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
]
|
|
866
880
|
}
|
|
867
881
|
},
|
|
868
882
|
"data": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-plugin-amis",
|
|
3
|
-
"version": "2.4.0-beta.
|
|
3
|
+
"version": "2.4.0-beta.43",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "yarn build:tailwind-base && yarn build:tailwind",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@steedos-widgets/amis-lib": "^1.0.22"
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "a04deddef8e15dc49c4d66bb252bda0ecd9edb37",
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"tailwindcss": "3.2.4"
|
|
22
22
|
}
|