@steedos/standard-object-database 2.3.1 → 2.3.2-beta.10
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/objectTranslations/object_listviews.en/object_listviews.en.objectTranslation.yml +2 -0
- package/main/default/objectTranslations/object_listviews.zh-CN/object_listviews.zh-CN.objectTranslation.yml +6 -0
- package/main/default/objects/object_listviews/buttons/amis_buttons.button.yml +59 -0
- package/main/default/objects/object_listviews.action.js +7 -1
- package/main/default/objects/object_listviews.object.yml +7 -1
- package/main/default/objects/objects.object.yml +6 -3
- package/main/default/routes/amis_button_design.router.js +1 -1
- package/main/default/routes/amis_listview_design.router.js +1 -1
- package/main/default/routes/listview.router.js +42 -2
- package/main/default/triggers/object_layouts.trigger.js +6 -3
- package/package.json +5 -2
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
name: amis_buttons
|
|
2
|
+
amis_schema: |-
|
|
3
|
+
{
|
|
4
|
+
"type": "service",
|
|
5
|
+
"body": [
|
|
6
|
+
{
|
|
7
|
+
"type": "button",
|
|
8
|
+
"label": "重置",
|
|
9
|
+
"id": "u:76144dacd93c",
|
|
10
|
+
"onEvent": {
|
|
11
|
+
"click": {
|
|
12
|
+
"actions": [
|
|
13
|
+
{
|
|
14
|
+
"args": {
|
|
15
|
+
"api": {
|
|
16
|
+
"url": "${context.rootUrl}/api/listview/${record_id}/amis-schema/reset",
|
|
17
|
+
"method": "post",
|
|
18
|
+
"headers": {
|
|
19
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"messages": {}
|
|
23
|
+
},
|
|
24
|
+
"actionType": "ajax"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"tooltip": "重置列表视图Amis Schema",
|
|
30
|
+
"tooltipPlacement": "top",
|
|
31
|
+
"className": "slds-button slds-button--neutral p-0"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"regions": [
|
|
35
|
+
"body"
|
|
36
|
+
],
|
|
37
|
+
"data": {
|
|
38
|
+
"context": {
|
|
39
|
+
"rootUrl": "https://5000-steedos-steedosplatform-uwiv6wkdp2o.ws-us77.gitpod.io"
|
|
40
|
+
},
|
|
41
|
+
"app_id": "",
|
|
42
|
+
"tab_id": "",
|
|
43
|
+
"object_name": "",
|
|
44
|
+
"dataComponentId": "",
|
|
45
|
+
"record_id": "",
|
|
46
|
+
"record": {},
|
|
47
|
+
"permissions": {}
|
|
48
|
+
},
|
|
49
|
+
"id": "u:9a37e91e4b8d",
|
|
50
|
+
"bodyClassName": "p-0"
|
|
51
|
+
}
|
|
52
|
+
is_enable: true
|
|
53
|
+
label: AmisSchema
|
|
54
|
+
'on': record_only
|
|
55
|
+
type: amis_button
|
|
56
|
+
visible: !!js/function |
|
|
57
|
+
function (object_name, record_id, record_permissions, record) {
|
|
58
|
+
return Creator.baseObject.actions.standard_edit.visible() && !record.is_system && record.enable_amis_schema;
|
|
59
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: baozhoutao@steedos.com
|
|
3
3
|
* @Date: 2022-03-28 09:35:34
|
|
4
4
|
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
-
* @LastEditTime: 2022-11-
|
|
5
|
+
* @LastEditTime: 2022-11-17 13:23:15
|
|
6
6
|
* @Description:
|
|
7
7
|
*/
|
|
8
8
|
module.exports = {
|
|
@@ -96,6 +96,12 @@ module.exports = {
|
|
|
96
96
|
showDesignVisible: function (object_name, record_id, record_permissions) {
|
|
97
97
|
var perms= {};
|
|
98
98
|
var record = Creator.getObjectRecord(object_name, record_id);
|
|
99
|
+
if(!record){
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
if(!record.enable_amis_schema){
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
99
105
|
if (record_permissions) {
|
|
100
106
|
perms = record_permissions;
|
|
101
107
|
} else {
|
|
@@ -280,13 +280,19 @@ fields:
|
|
|
280
280
|
readonly: true
|
|
281
281
|
visible_on: "{{global.mode ==='read' ? true : false}}"
|
|
282
282
|
disabled: true
|
|
283
|
+
enable_amis_schema:
|
|
284
|
+
label: Enable
|
|
285
|
+
type: boolean
|
|
286
|
+
group: custom
|
|
287
|
+
required: false
|
|
283
288
|
amis_schema:
|
|
284
289
|
label: Amis Schema
|
|
285
290
|
type: code
|
|
291
|
+
group: custom
|
|
286
292
|
language: json
|
|
287
293
|
required: false
|
|
288
294
|
is_wide: true
|
|
289
|
-
# visible_on: "{{formData.
|
|
295
|
+
# visible_on: "{{formData.enable_amis_schema}}"
|
|
290
296
|
paging:
|
|
291
297
|
enabled: false
|
|
292
298
|
list_views:
|
|
@@ -72,6 +72,7 @@ fields:
|
|
|
72
72
|
type: boolean
|
|
73
73
|
label: Enable Search
|
|
74
74
|
group: Switch
|
|
75
|
+
hidden: true
|
|
75
76
|
enable_files:
|
|
76
77
|
type: boolean
|
|
77
78
|
label: Enable Files
|
|
@@ -99,6 +100,7 @@ fields:
|
|
|
99
100
|
defaultValue: false
|
|
100
101
|
label: Enable Share
|
|
101
102
|
group: Switch
|
|
103
|
+
hidden: true
|
|
102
104
|
enable_workflow:
|
|
103
105
|
type: boolean
|
|
104
106
|
label: Enable Workflow
|
|
@@ -111,6 +113,7 @@ fields:
|
|
|
111
113
|
type: boolean
|
|
112
114
|
label: Enable Chatter
|
|
113
115
|
group: Switch
|
|
116
|
+
hidden: true
|
|
114
117
|
enable_inline_edit:
|
|
115
118
|
type: boolean
|
|
116
119
|
defaultValue: true
|
|
@@ -460,9 +463,9 @@ actions:
|
|
|
460
463
|
show_object:
|
|
461
464
|
label: Preview
|
|
462
465
|
on: record
|
|
463
|
-
copy_odata:
|
|
464
|
-
|
|
465
|
-
|
|
466
|
+
# copy_odata:
|
|
467
|
+
# label: Copy OData URL
|
|
468
|
+
# on: record
|
|
466
469
|
createDefaultRecordView:
|
|
467
470
|
on: record_only_more
|
|
468
471
|
label: 创建默认页面布局
|
|
@@ -5,14 +5,54 @@
|
|
|
5
5
|
* @LastEditTime: 2022-08-05 15:41:30
|
|
6
6
|
* @Description:
|
|
7
7
|
*/
|
|
8
|
-
const
|
|
9
|
-
const router = express.Router();
|
|
8
|
+
const router =require('@steedos/router').staticRouter()
|
|
10
9
|
const core = require('@steedos/core');
|
|
11
10
|
const objectql = require('@steedos/objectql');
|
|
12
11
|
|
|
12
|
+
const callObjectServiceAction = async function(actionName, userSession, data){
|
|
13
|
+
const broker = objectql.getSteedosSchema().broker;
|
|
14
|
+
return broker.call(actionName, data || {}, { meta: { user: userSession}})
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const getUISchema = async function(objectName, userSession){
|
|
18
|
+
return await callObjectServiceAction(`@${objectName}.getRecordView`, userSession);
|
|
19
|
+
}
|
|
20
|
+
|
|
13
21
|
router.post('/api/listview/filters', core.requireAuthentication, async function (req, res) {
|
|
14
22
|
const {id, filters} = req.body;
|
|
15
23
|
const record = await objectql.getObject('object_listviews').directUpdate(id, {filters: filters})
|
|
16
24
|
res.status(200).send(record);
|
|
17
25
|
});
|
|
26
|
+
|
|
27
|
+
router.post('/api/listview/:id/amis-schema/clear', core.requireAuthentication, async function (req, res) {
|
|
28
|
+
const { id } = req.params;
|
|
29
|
+
const record = await objectql.getObject('object_listviews').directUpdate(id, { amis_schema: "" });
|
|
30
|
+
res.status(200).send(record);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
router.post('/api/listview/:id/amis-schema/reset', core.requireAuthentication, async function (req, res) {
|
|
34
|
+
try {
|
|
35
|
+
const userSession = req.user;
|
|
36
|
+
const { id } = req.params;
|
|
37
|
+
const listviews = await objectql.getObject('object_listviews').directFind({filters: [['_id', '=', id]],fields: ["object_name", "name"]});
|
|
38
|
+
let listview;
|
|
39
|
+
if(listviews && listviews.length > 0){
|
|
40
|
+
listview = listviews[0];
|
|
41
|
+
}
|
|
42
|
+
else{
|
|
43
|
+
res.status(500).send(`The listview for id "${id}" Not found`);
|
|
44
|
+
}
|
|
45
|
+
const AmisLib = require('@steedos-widgets/amis-lib');
|
|
46
|
+
AmisLib.setUISchemaFunction(async function(objectName, force){
|
|
47
|
+
return await getUISchema(objectName, userSession);
|
|
48
|
+
});
|
|
49
|
+
let schema = await AmisLib.getListviewInitSchema(listview.object_name, listview.name);
|
|
50
|
+
const record = await objectql.getObject('object_listviews').directUpdate(id, { amis_schema: schema });
|
|
51
|
+
res.status(200).send(record);
|
|
52
|
+
|
|
53
|
+
} catch (error) {
|
|
54
|
+
res.status(500).send(error.message);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
18
58
|
exports.default = router;
|
|
@@ -3,11 +3,14 @@ const objectql = require('@steedos/objectql');
|
|
|
3
3
|
const auth = require('@steedos/auth');
|
|
4
4
|
const InternalData = require('@steedos/standard-objects').internalData;
|
|
5
5
|
const util = require('@steedos/standard-objects').util
|
|
6
|
-
function check(objectName, profiles, id){
|
|
6
|
+
function check(spaceId, objectName, profiles, id){
|
|
7
7
|
let query = {
|
|
8
8
|
object_name: objectName,
|
|
9
9
|
profiles: {$in: profiles}
|
|
10
10
|
}
|
|
11
|
+
if(spaceId){
|
|
12
|
+
query.space = spaceId;
|
|
13
|
+
}
|
|
11
14
|
if(id){
|
|
12
15
|
query._id = {$ne: id}
|
|
13
16
|
}
|
|
@@ -38,7 +41,7 @@ const getInternalLatouts = async function(sourceLayouts, filters){
|
|
|
38
41
|
module.exports = {
|
|
39
42
|
beforeInsert: async function(){
|
|
40
43
|
let doc = this.doc
|
|
41
|
-
check(doc.object_name, doc.profiles);
|
|
44
|
+
check(this.spaceId, doc.object_name, doc.profiles);
|
|
42
45
|
|
|
43
46
|
await util.checkAPIName(this.object_name, 'name', this.doc.name, undefined, [['is_system','!=', true], ['object_name','=', doc.object_name]]);
|
|
44
47
|
|
|
@@ -54,7 +57,7 @@ module.exports = {
|
|
|
54
57
|
let doc = this.doc
|
|
55
58
|
let id = this.id
|
|
56
59
|
let record = Creator.getCollection("object_layouts").findOne({_id: id}) || {};
|
|
57
|
-
check(doc.object_name || record.object_name, doc.profiles || record.profiles, id);
|
|
60
|
+
check(this.spaceId, doc.object_name || record.object_name, doc.profiles || record.profiles, id);
|
|
58
61
|
if (_.has(doc, 'name')) {
|
|
59
62
|
await util.checkAPIName(this.object_name, 'name', doc.name, this.id, [['is_system','!=', true], ['object_name','=', doc.object_name || record.object_name]]);
|
|
60
63
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/standard-object-database",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2-beta.10",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -10,7 +10,10 @@
|
|
|
10
10
|
"steedos"
|
|
11
11
|
],
|
|
12
12
|
"description": "steedos package",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@steedos-widgets/amis-lib": "^0.0.10"
|
|
15
|
+
},
|
|
13
16
|
"repository": {},
|
|
14
17
|
"license": "MIT",
|
|
15
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "44b1617fea53eb016e82e72174e1d33bdbfe3fd1"
|
|
16
19
|
}
|