@steedos/service-plugin-amis 2.3.1 → 2.3.2-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.
@@ -130,60 +130,6 @@
130
130
  "labelClassName": "text-left",
131
131
  "id": "u:fc07a5376a46"
132
132
  },
133
- {
134
- "name": "objects",
135
- "label": "桌面主菜单(已作废)",
136
- "type": "select",
137
- "className": "m-0",
138
- "labelClassName": "text-left",
139
- "id": "u:4e5047e44905",
140
- "joinValues": false,
141
- "extractValue": true,
142
- "labelField": "label",
143
- "valueField": "value",
144
- "multiple": true,
145
- "checkAll": false,
146
- "searchable": true,
147
- "source": {
148
- "method": "get",
149
- "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/options",
150
- "headers": {
151
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
152
- }
153
- }
154
- },
155
- {
156
- "name": "mobile_objects",
157
- "label": "手机主菜单(已作废)",
158
- "type": "select",
159
- "className": "m-0",
160
- "labelClassName": "text-left",
161
- "id": "u:cfaeb2f857a8",
162
- "joinValues": false,
163
- "extractValue": true,
164
- "labelField": "label",
165
- "valueField": "value",
166
- "multiple": true,
167
- "checkAll": false,
168
- "searchable": true,
169
- "source": {
170
- "method": "get",
171
- "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/options",
172
- "messages": {},
173
- "headers": {
174
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
175
- }
176
- }
177
- },
178
- {
179
- "name": "description",
180
- "label": "描述",
181
- "type": "textarea",
182
- "className": "col-span-2 m-0",
183
- "labelClassName": "text-left",
184
- "id": "u:40d99f2da55a",
185
- "tpl": "<b><%=data.description%></b>"
186
- },
187
133
  {
188
134
  "name": "is_creator",
189
135
  "label": "在桌面中显示此应用",
@@ -210,6 +156,15 @@
210
156
  "className": "m-0",
211
157
  "labelClassName": "text-left",
212
158
  "id": "u:07a8a4c5f875"
159
+ },
160
+ {
161
+ "name": "description",
162
+ "label": "描述",
163
+ "type": "textarea",
164
+ "className": "col-span-2 m-0",
165
+ "labelClassName": "text-left",
166
+ "id": "u:40d99f2da55a",
167
+ "tpl": "<b><%=data.description%></b>"
213
168
  }
214
169
  ],
215
170
  "id": "u:0b870f195836",
@@ -489,6 +444,63 @@
489
444
  }
490
445
  ],
491
446
  "id": "u:17ecc1ec4435"
447
+ },
448
+ {
449
+ "title": "其他",
450
+ "body": [
451
+ {
452
+ "type": "wrapper",
453
+ "className": "form-content",
454
+ "body": [
455
+ {
456
+ "name": "objects",
457
+ "label": "桌面主菜单(已作废)",
458
+ "type": "select",
459
+ "className": "m-0",
460
+ "labelClassName": "text-left",
461
+ "id": "u:4e5047e44905",
462
+ "joinValues": false,
463
+ "extractValue": true,
464
+ "labelField": "label",
465
+ "valueField": "value",
466
+ "multiple": true,
467
+ "checkAll": false,
468
+ "searchable": true,
469
+ "source": {
470
+ "method": "get",
471
+ "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/options",
472
+ "headers": {
473
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
474
+ }
475
+ }
476
+ },
477
+ {
478
+ "name": "mobile_objects",
479
+ "label": "手机主菜单(已作废)",
480
+ "type": "select",
481
+ "className": "m-0",
482
+ "labelClassName": "text-left",
483
+ "id": "u:cfaeb2f857a8",
484
+ "joinValues": false,
485
+ "extractValue": true,
486
+ "labelField": "label",
487
+ "valueField": "value",
488
+ "multiple": true,
489
+ "checkAll": false,
490
+ "searchable": true,
491
+ "source": {
492
+ "method": "get",
493
+ "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/options",
494
+ "messages": {},
495
+ "headers": {
496
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
497
+ }
498
+ }
499
+ }
500
+ ],
501
+ "size": "none"
502
+ }
503
+ ]
492
504
  }
493
505
  ],
494
506
  "tabsMode": "line",
@@ -33,7 +33,7 @@
33
33
  "cache": 100,
34
34
  "adaptor": "var data = payload.data.data[0] || { _filters_type_controller: 'conditions' };\n//数据格式转换\nif (data) {\n data.columns = lodash.map(data.columns, 'field');\n data.sort = lodash.map(data.sort, (item) => {\n return `${item.field_name}:${item.order || 'asc'}`\n });\n data.mobile_columns = lodash.map(data.mobile_columns, 'field');\n\n if (data.filters && lodash.isString(data.filters)) {\n try {\n data.filters = JSON.parse(data.filters);\n }catch(e){}\n }\n\n if (data.filters && lodash.isString(data.filters)) {\n data._filters_type_controller = 'function';\n } else {\n data._filters_type_controller = 'conditions'\n }\n\n if (data._filters_type_controller === 'conditions') {\n data._filters_conditions = window.amisConvert.filtersToConditions(data.filters || []);\n } else {\n data._filters_function = data.filters;\n }\n}\npayload.data = data;\ndelete payload.extensions;\nreturn payload;",
35
35
  "data": {
36
- "query": "{data:object_listviews(filters:[\"_id\", \"=\", \"${recordId}\"]){_id,label,name,object_name,filter_scope,shared,show_count,columns,filter_fields,sort,filters,filter_logic,mobile_columns,sort_no,created,created_by:created_by__expand{_id,name},modified,modified_by:modified_by__expand{_id,name},_display{shared,show_count,created,modified}}}"
36
+ "query": "{data:object_listviews(filters:[\"_id\", \"=\", \"${recordId}\"]){_id,label,name,object_name,filter_scope,shared,show_count,columns,filter_fields,sort,filters,filter_logic,mobile_columns,sort_no,created,created_by:created_by__expand{_id,name},modified,modified_by:modified_by__expand{_id,name},enable_amis_schema,amis_schema,_display{shared,show_count,created,modified}}}"
37
37
  },
38
38
  "sendOn": "!!this.recordId",
39
39
  "replaceData": false,
@@ -398,6 +398,38 @@
398
398
  "title": "Mobile"
399
399
  },
400
400
  "id": "u:51174159a42e"
401
+ },
402
+ {
403
+ "type": "fieldSet",
404
+ "title": "高级",
405
+ "collapsable": true,
406
+ "body": [
407
+ {
408
+ "name": "enable_amis_schema",
409
+ "type": "checkbox",
410
+ "tpl": null,
411
+ "className": "m-0",
412
+ "labelClassName": "text-left",
413
+ "option": "启用",
414
+ "en-US": {
415
+ "option": "Enable"
416
+ }
417
+ },
418
+ {
419
+ "type": "editor",
420
+ "name": "amis_schema",
421
+ "label": "Amis Schema",
422
+ "required": false,
423
+ "language": "json",
424
+ "className": "col-span-2 m-1",
425
+ "labelClassName": "text-left"
426
+ }
427
+ ],
428
+ "collapsed": true,
429
+ "visibleOn": "!!this.object_name",
430
+ "en-US": {
431
+ "title": "Advanced"
432
+ }
401
433
  }
402
434
  ],
403
435
  "panelClassName": "m-0",
@@ -6,50 +6,16 @@
6
6
  * @Description:
7
7
  */
8
8
  const AmisSchema = require('./utils/amis-schema');
9
- const AmisLib = require('@steedos-widgets/amis-lib');
10
9
  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 = objectql.getObject(objectName);
16
- const objectConfig = clone(object.toConfig());
17
- // TODO: 后续再支持附件子表
18
- // let relatedLists = []
19
- // if(objectConfig.enable_files){
20
- // relatedLists.push("cms_files.parent")
21
- // }
22
- const relationsInfo = await object.getRelationsInfo();
23
-
24
- // TODO: 跨工作区了,后续需要补充spaceId过滤条件
25
- const dbListViews = await objectql.getObject("object_listviews").directFind({
26
- filters: [['object_name', '=', objectName], ['shared', '=', true]]
27
- })
28
-
29
- objectConfig.list_views = Object.assign({}, objectConfig.list_views)
30
- _.each(dbListViews, function(dbListView){
31
- delete dbListView.created;
32
- delete dbListView.created_by;
33
- delete dbListView.modified;
34
- delete dbListView.modified_by;
35
- objectConfig.list_views[dbListView.name] = dbListView;
36
- })
37
-
38
- objectConfig.details = relationsInfo && relationsInfo.details;
39
- objectConfig.masters = relationsInfo && relationsInfo.masters;
40
- objectConfig.lookup_details = relationsInfo && relationsInfo.lookup_details;
41
- // TODO: 后续再支持related_lists
42
- // objectConfig.related_lists = relationsInfo && relationsInfo.related_lists;
43
-
44
- // let lng = objectql.getUserLocale(userSession);
45
- let lng = "zh-CN";//先写死中文,后续拟通过环境变量配置语言
46
- steedosI18n.translationObject(lng, object.name, objectConfig);
47
- return objectConfig;
10
+
11
+ const callObjectServiceAction = async function(actionName, userSession, data){
12
+ const broker = objectql.getSteedosSchema().broker;
13
+ return broker.call(actionName, data || {}, { meta: { user: userSession}})
48
14
  }
49
15
 
50
- AmisLib.setUISchemaFunction(async function(objectName, force){
51
- return await getObjectConfig(objectName);
52
- });
16
+ const getUISchema = async function(objectName, userSession){
17
+ return await callObjectServiceAction(`@${objectName}.getRecordView`, userSession);
18
+ }
53
19
 
54
20
  module.exports = {
55
21
  name: "amis",
@@ -133,6 +99,11 @@ module.exports = {
133
99
  },
134
100
  getInitSchema: {
135
101
  async handler({type, objectApiName, formFactor, userSession}) {
102
+
103
+ const AmisLib = require('@steedos-widgets/amis-lib');
104
+ AmisLib.setUISchemaFunction(async function(objectName, force){
105
+ return await getUISchema(objectName, userSession);
106
+ });
136
107
  if(objectApiName){
137
108
  let schema;
138
109
  switch(type){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/service-plugin-amis",
3
- "version": "2.3.1",
3
+ "version": "2.3.2-beta.11",
4
4
  "main": "package.service.js",
5
5
  "scripts": {
6
6
  "build": "node .scripts/build.tailwind.js"
@@ -11,7 +11,7 @@
11
11
  "access": "public"
12
12
  },
13
13
  "dependencies": {
14
- "@steedos-widgets/amis-lib": "^0.0.9"
14
+ "@steedos-widgets/amis-lib": "^0.0.10"
15
15
  },
16
- "gitHead": "f8938e298cec11b2f91172e0d3506079daa7d670"
16
+ "gitHead": "d12ce4f403be88d8cce5e7d0de8892c9b92b3899"
17
17
  }
@@ -96,4 +96,8 @@ body{
96
96
  }
97
97
  .ant-drawer.ant-drawer-bottom{
98
98
  top: auto;
99
+ }
100
+
101
+ .steedos-amis-button.slds-truncate{
102
+ overflow: inherit;
99
103
  }