@steedos/standard-object-database 2.5.16-beta.2 → 2.5.16-beta.4
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/objects/object_actions.action.js +34 -3
- package/main/default/objects/object_actions.object.js +4 -2
- package/main/default/objects/object_actions.object.yml +13 -1
- package/main/default/objects/object_layouts.action.js +4 -4
- package/main/default/objects/objects.action.js +1 -1
- package/main/default/pages/object_fields_form.page.amis.json +26 -0
- package/main/default/pages/object_fields_form.page.yml +12 -0
- package/main/default/triggers/object_actions.trigger.js +6 -2
- package/package.json +2 -2
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
* @Author: baozhoutao@steedos.com
|
|
3
3
|
* @Date: 2022-09-21 18:19:06
|
|
4
4
|
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
-
* @LastEditTime: 2023-
|
|
5
|
+
* @LastEditTime: 2023-10-16 13:58:08
|
|
6
6
|
* @Description:
|
|
7
7
|
*/
|
|
8
8
|
module.exports = {
|
|
9
9
|
showDesign: function (object_name, record_id) {
|
|
10
10
|
document.location = Steedos.absoluteUrl(`/api/amisButtonDesign?id=${record_id}&object=${this.record.record.object}&assetUrls=${Builder.settings.assetUrls}&locale=${Builder.settings.locale}`);
|
|
11
11
|
},
|
|
12
|
-
showDesignVisible: function (object_name, record_id, record_permissions) {
|
|
12
|
+
showDesignVisible: function (object_name, record_id, record_permissions, data) {
|
|
13
13
|
var perms;
|
|
14
|
-
var record = Creator.getObjectRecord(object_name, record_id);
|
|
14
|
+
var record = (data && data.record) || Creator.getObjectRecord(object_name, record_id);
|
|
15
15
|
if(record.type === 'amis_button'){
|
|
16
16
|
perms = {};
|
|
17
17
|
if (record_permissions) {
|
|
@@ -25,5 +25,36 @@ module.exports = {
|
|
|
25
25
|
return perms["allowEdit"];
|
|
26
26
|
}
|
|
27
27
|
return false;
|
|
28
|
+
},
|
|
29
|
+
customize: function (object_name, record_id, fields) {
|
|
30
|
+
var doc = Creator.odata.get(object_name, record_id);
|
|
31
|
+
var newDoc = {}
|
|
32
|
+
_.each(Creator.getObject(object_name).fields, function(v, k){
|
|
33
|
+
if(_.has(doc, k)){
|
|
34
|
+
newDoc[k] = doc[k]
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
delete newDoc.is_system;
|
|
38
|
+
|
|
39
|
+
let docName = doc.name
|
|
40
|
+
let docObjectName = doc.object
|
|
41
|
+
|
|
42
|
+
Creator.odata.insert(object_name, Object.assign(newDoc, {name: docName, object: docObjectName}), function(result, error){
|
|
43
|
+
if(result){
|
|
44
|
+
if(Session.get("object_name") === 'object_actions'){
|
|
45
|
+
FlowRouter.go(`/app/-/${object_name}/view/${result._id}`)
|
|
46
|
+
}else{
|
|
47
|
+
href = Creator.getObjectUrl(object_name, result._id);
|
|
48
|
+
window.open(href,'_blank','width=800, height=600, left=50, top= 50, toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes')
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
customizeVisible: function(object_name, record_id, record_permissions, data){
|
|
54
|
+
var record = data && data.record;
|
|
55
|
+
if(!record){
|
|
56
|
+
record = {}
|
|
57
|
+
}
|
|
58
|
+
return Creator.baseObject.actions.standard_new.visible() && record.is_system && record.type == 'amis_button';
|
|
28
59
|
}
|
|
29
60
|
}
|
|
@@ -76,7 +76,7 @@ function allowChangeObject(){
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
const triggers = {
|
|
80
80
|
// "after.insert.server.object_actions": {
|
|
81
81
|
// on: "server",
|
|
82
82
|
// when: "after.insert",
|
|
@@ -149,4 +149,6 @@ Creator.Objects.object_actions.triggers = {
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
Creator.Objects.object_actions.triggers = Object.assign(Creator.Objects.object_actions.triggers || {}, triggers);
|
|
@@ -96,7 +96,7 @@ fields:
|
|
|
96
96
|
type:
|
|
97
97
|
type: select
|
|
98
98
|
sort_no: 170
|
|
99
|
-
|
|
99
|
+
visible_on: "${false}"
|
|
100
100
|
options:
|
|
101
101
|
- label: Custom JavaScript
|
|
102
102
|
value: script
|
|
@@ -129,6 +129,14 @@ fields:
|
|
|
129
129
|
is_wide: true
|
|
130
130
|
hidden: true
|
|
131
131
|
visible_on: "{{formData.type == 'amis_button' ? true: false}}"
|
|
132
|
+
is_system:
|
|
133
|
+
type: boolean
|
|
134
|
+
label: System
|
|
135
|
+
# omit: true
|
|
136
|
+
readonly: true
|
|
137
|
+
visible_on: "{{global.mode ==='read' ? true : false}}"
|
|
138
|
+
disabled: true
|
|
139
|
+
sort_no: 500
|
|
132
140
|
form:
|
|
133
141
|
initialValues: !!js/function |
|
|
134
142
|
function(){
|
|
@@ -140,6 +148,9 @@ actions:
|
|
|
140
148
|
showDesign:
|
|
141
149
|
label: 设计器
|
|
142
150
|
on: record_only
|
|
151
|
+
customize:
|
|
152
|
+
label: 自定义
|
|
153
|
+
on: record_only
|
|
143
154
|
list_views:
|
|
144
155
|
all:
|
|
145
156
|
columns:
|
|
@@ -149,6 +160,7 @@ list_views:
|
|
|
149
160
|
- 'on'
|
|
150
161
|
- is_enable
|
|
151
162
|
- modified
|
|
163
|
+
- is_system
|
|
152
164
|
label: All
|
|
153
165
|
filter_scope: space
|
|
154
166
|
permission_set:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author: baozhoutao@steedos.com
|
|
3
3
|
* @Date: 2022-03-28 09:35:34
|
|
4
|
-
* @LastEditors:
|
|
5
|
-
* @LastEditTime: 2023-
|
|
4
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
+
* @LastEditTime: 2023-10-16 16:50:45
|
|
6
6
|
* @Description:
|
|
7
7
|
*/
|
|
8
8
|
module.exports = {
|
|
@@ -22,8 +22,8 @@ module.exports = {
|
|
|
22
22
|
FlowRouter.reload();
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
-
createDefaultRecordViewVisible: function(object_name, record_id, record_permissions){
|
|
26
|
-
if(!Creator.isSpaceAdmin()){
|
|
25
|
+
createDefaultRecordViewVisible: function(object_name, record_id, record_permissions, data){
|
|
26
|
+
if(!Creator.isSpaceAdmin() || data.record.name == 'users'){
|
|
27
27
|
return false
|
|
28
28
|
}
|
|
29
29
|
return true;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "service",
|
|
3
|
+
"body": [
|
|
4
|
+
{
|
|
5
|
+
"type": "steedos-object-form",
|
|
6
|
+
"label": "对象表单",
|
|
7
|
+
"objectApiName": "object_fields",
|
|
8
|
+
"recordId": "${recordId}",
|
|
9
|
+
"className": "",
|
|
10
|
+
"enableTabs": true,
|
|
11
|
+
"mode": "edit",
|
|
12
|
+
"layout": "normal",
|
|
13
|
+
"submitSuccActions": [
|
|
14
|
+
{
|
|
15
|
+
"actionType": "custom",
|
|
16
|
+
"script": "setTimeout(function(){doAction({'actionType': 'setValue','componentId': 'form_object_fields','args': {'value': {'sort_no': event.data.sort_no + 10}}})}, 300)"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"data": {
|
|
22
|
+
"context": {}
|
|
23
|
+
},
|
|
24
|
+
"name": "object_fields_form",
|
|
25
|
+
"id": "u:bb11df394baf"
|
|
26
|
+
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author: sunhaolin@hotoa.com
|
|
3
3
|
* @Date: 2022-05-28 11:07:57
|
|
4
|
-
* @LastEditors:
|
|
5
|
-
* @LastEditTime:
|
|
4
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
+
* @LastEditTime: 2023-10-16 13:58:22
|
|
6
6
|
* @Description:
|
|
7
7
|
*/
|
|
8
8
|
const InternalData = require('@steedos/standard-objects').internalData;
|
|
9
9
|
const objectql = require('@steedos/objectql');
|
|
10
10
|
const auth = require("@steedos/auth");
|
|
11
|
+
const sleep = async (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
11
12
|
module.exports = {
|
|
12
13
|
beforeInsert: async function(){
|
|
13
14
|
const { doc } = this;
|
|
@@ -94,5 +95,8 @@ module.exports = {
|
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
}
|
|
98
|
+
},
|
|
99
|
+
afterDelete: async function(){
|
|
100
|
+
await sleep(1000 * 2);
|
|
97
101
|
}
|
|
98
102
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/standard-object-database",
|
|
3
|
-
"version": "2.5.16-beta.
|
|
3
|
+
"version": "2.5.16-beta.4",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
},
|
|
16
16
|
"repository": {},
|
|
17
17
|
"license": "MIT",
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "ccb7b9147e269e1dd678765163340db756655199"
|
|
19
19
|
}
|