@steedos/service-plugin-amis 2.3.0 → 2.3.1-beta.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.
@@ -6,6 +6,22 @@
6
6
  * @Description:
7
7
  */
8
8
  const AmisSchema = require('./utils/amis-schema');
9
+ const AmisLib = require('@steedos-widgets/amis-lib');
10
+ const objectql = require("@steedos/objectql");
11
+ const steedosI18n = require("@steedos/i18n");
12
+ const clone = require("clone");
13
+
14
+ const getObjectConfig = async function(objectName){
15
+ const object = clone(objectql.getObject(objectName).toConfig());
16
+ // let lng = objectql.getUserLocale(userSession);
17
+ let lng = "zh-CN";//先写死中文,后续拟通过环境变量配置语言
18
+ steedosI18n.translationObject(lng, object.name, object);
19
+ return object;
20
+ }
21
+
22
+ AmisLib.setUISchemaFunction(async function(objectName, force){
23
+ return await getObjectConfig(objectName);
24
+ });
9
25
 
10
26
  module.exports = {
11
27
  name: "amis",
@@ -88,9 +104,19 @@ module.exports = {
88
104
  }
89
105
  },
90
106
  getInitSchema: {
91
- handler({type, objectApiName, formFactor, userSession}) {
92
- if(type === 'form' && objectApiName){
93
- return AmisSchema.getRecordSchema(objectApiName, '${recordId}', false, userSession);
107
+ async handler({type, objectApiName, formFactor, userSession}) {
108
+ if(objectApiName){
109
+ let schema;
110
+ switch(type){
111
+ case "form":
112
+ schema = await AmisLib.getFormSchema(objectApiName, {recordId: '${recordId}'});
113
+ break;
114
+ case "list":
115
+ schema = await AmisLib.getListSchema(null, objectApiName, "all");
116
+ break;
117
+ }
118
+ return schema && schema.amisSchema || {};
119
+ // return AmisSchema.getRecordSchema(objectApiName, '${recordId}', false, userSession);
94
120
  }
95
121
  }
96
122
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/service-plugin-amis",
3
- "version": "2.3.0",
3
+ "version": "2.3.1-beta.2",
4
4
  "main": "package.service.js",
5
5
  "scripts": {
6
6
  "build": "node .scripts/build.tailwind.js"
@@ -10,5 +10,8 @@
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
13
- "gitHead": "b00e79e6fb8549b2fabed7b6cd6d4847775ba5df"
13
+ "dependencies": {
14
+ "@steedos-widgets/amis-lib": "^0.0.7"
15
+ },
16
+ "gitHead": "90c8b343e760df21f482433b89fdc95e076ca566"
14
17
  }
@@ -83,4 +83,17 @@ body{
83
83
  .ant-modal-root .amis-scope .antd-Panel-footerWrap{
84
84
  position: fixed;
85
85
  }
86
+ }
87
+
88
+ /* fix: https://github.com/baidu/amis/issues/5073 */
89
+ .antd-CBGroup-toolbar .antd-CBGroup-toolbarConditionAdd .antd-ButtonGroup>.antd-Button:first-child {
90
+ margin-right: 1.5rem;
91
+ }
92
+
93
+ /* fix: https://github.com/steedos/steedos-platform/issues/3898 */
94
+ .ant-drawer.ant-drawer-right{
95
+ left: auto;
96
+ }
97
+ .ant-drawer.ant-drawer-bottom{
98
+ top: auto;
86
99
  }