@steedos/standard-object-database 2.7.0-beta.5 → 2.7.0-beta.6
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.
|
@@ -38,7 +38,58 @@ fields:
|
|
|
38
38
|
# omit: true
|
|
39
39
|
# hidden: true
|
|
40
40
|
label: Visible
|
|
41
|
-
|
|
41
|
+
is_wide: true
|
|
42
|
+
sort_no: 200
|
|
43
|
+
defaultValue: true
|
|
44
|
+
amis:
|
|
45
|
+
type: fieldSet
|
|
46
|
+
title: 状态
|
|
47
|
+
body:
|
|
48
|
+
- name: visible
|
|
49
|
+
label: 显示
|
|
50
|
+
type: switch
|
|
51
|
+
staticOn: ${global.mode==='edit'?false:true}
|
|
52
|
+
- name: visible_type
|
|
53
|
+
label: 条件
|
|
54
|
+
type: select
|
|
55
|
+
value: static
|
|
56
|
+
visibleOn: "${visible === true}"
|
|
57
|
+
clearable: false
|
|
58
|
+
staticOn: ${global.mode==='edit'?false:true}
|
|
59
|
+
options:
|
|
60
|
+
- label: 静态值
|
|
61
|
+
value: static
|
|
62
|
+
- label: 表达式
|
|
63
|
+
value: expression
|
|
64
|
+
visible_type:
|
|
65
|
+
name: visible_type
|
|
66
|
+
type: select
|
|
67
|
+
readonly: true
|
|
68
|
+
visible_on: "{{false}}"
|
|
69
|
+
visibleOn:
|
|
70
|
+
type: text
|
|
71
|
+
label: 表达式
|
|
72
|
+
is_wide: true
|
|
73
|
+
sort_no: 210
|
|
74
|
+
amis:
|
|
75
|
+
type: wrapper
|
|
76
|
+
body:
|
|
77
|
+
- type: input-text
|
|
78
|
+
name: visibleOn
|
|
79
|
+
static: true
|
|
80
|
+
label: 表达式
|
|
81
|
+
visibleOn: "${global.mode != 'edit'}"
|
|
82
|
+
- type: input-formula
|
|
83
|
+
name: visibleOn
|
|
84
|
+
mixedMode: true
|
|
85
|
+
label: 表达式
|
|
86
|
+
visibleOn: "${global.mode==='edit' && visible_type == 'expression'}"
|
|
87
|
+
variables:
|
|
88
|
+
- label: 当前记录
|
|
89
|
+
value: record
|
|
90
|
+
children:
|
|
91
|
+
- label: 名称
|
|
92
|
+
value: name
|
|
42
93
|
'on':
|
|
43
94
|
type: lookup
|
|
44
95
|
label: 'On'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: sunhaolin@hotoa.com
|
|
3
3
|
* @Date: 2022-05-28 11:07:57
|
|
4
4
|
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
-
* @LastEditTime:
|
|
5
|
+
* @LastEditTime: 2024-03-14 10:29:44
|
|
6
6
|
* @Description:
|
|
7
7
|
*/
|
|
8
8
|
const InternalData = require('@steedos/standard-objects').internalData;
|
|
@@ -12,20 +12,18 @@ const sleep = async (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
|
12
12
|
module.exports = {
|
|
13
13
|
beforeInsert: async function(){
|
|
14
14
|
const { doc } = this;
|
|
15
|
+
delete doc.visible_type
|
|
15
16
|
doc.visible;
|
|
16
17
|
},
|
|
17
18
|
beforeUpdate: async function(){
|
|
18
19
|
const { doc } = this;
|
|
20
|
+
delete doc.visible_type
|
|
19
21
|
doc.visible;
|
|
20
22
|
},
|
|
21
23
|
beforeFind: async function () {
|
|
22
24
|
delete this.query.fields;
|
|
23
25
|
},
|
|
24
26
|
|
|
25
|
-
beforeAggregate: async function () {
|
|
26
|
-
delete this.query.fields;
|
|
27
|
-
},
|
|
28
|
-
|
|
29
27
|
afterFind: async function(){
|
|
30
28
|
let filters = InternalData.parserFilters(this.query.filters)
|
|
31
29
|
const { spaceId } = this;
|
|
@@ -52,32 +50,15 @@ module.exports = {
|
|
|
52
50
|
}
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
|
-
},
|
|
56
|
-
afterAggregate: async function(){
|
|
57
|
-
let filters = InternalData.parserFilters(this.query.filters)
|
|
58
|
-
const { spaceId } = this;
|
|
59
|
-
|
|
60
|
-
let objectName = filters.object;
|
|
61
|
-
if(!objectName && filters._id && filters._id.indexOf(".") > -1){
|
|
62
|
-
objectName = filters._id.split('.')[0];
|
|
63
|
-
}
|
|
64
53
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
})) {
|
|
71
|
-
this.data.values.push(Object.assign({_id: `${objectName}.${doc.name}`}, doc));
|
|
72
|
-
}
|
|
73
|
-
})
|
|
74
|
-
const records = objectql.getSteedosSchema().metadataDriver.find(this.data.values, this.query, spaceId);
|
|
75
|
-
if (records.length > 0) {
|
|
76
|
-
this.data.values = records;
|
|
77
|
-
} else {
|
|
78
|
-
this.data.values.length = 0;
|
|
54
|
+
_.each(this.data.values, (item)=>{
|
|
55
|
+
if(item.visibleOn){
|
|
56
|
+
item.visible_type = "expression"
|
|
57
|
+
}else if(item.visible === true){
|
|
58
|
+
item.visible_type = "static"
|
|
79
59
|
}
|
|
80
|
-
}
|
|
60
|
+
})
|
|
61
|
+
|
|
81
62
|
},
|
|
82
63
|
afterCount: async function(){
|
|
83
64
|
delete this.query.fields;
|
|
@@ -95,6 +76,15 @@ module.exports = {
|
|
|
95
76
|
}
|
|
96
77
|
}
|
|
97
78
|
}
|
|
79
|
+
|
|
80
|
+
if(this.data.values){
|
|
81
|
+
if(this.data.values.visibleOn){
|
|
82
|
+
this.data.values.visible_type = "expression"
|
|
83
|
+
}else if(this.data.values.visible === true){
|
|
84
|
+
this.data.values.visible_type = "static"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
98
88
|
},
|
|
99
89
|
afterDelete: async function(){
|
|
100
90
|
await sleep(1000 * 2);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/standard-object-database",
|
|
3
|
-
"version": "2.7.0-beta.
|
|
3
|
+
"version": "2.7.0-beta.6",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
"description": "steedos package",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@steedos-widgets/amis-lib": "^1.0.22",
|
|
15
|
-
"@steedos/metadata-core": "2.7.0-beta.
|
|
16
|
-
"@steedos/standard-objects": "2.7.0-beta.
|
|
15
|
+
"@steedos/metadata-core": "2.7.0-beta.6",
|
|
16
|
+
"@steedos/standard-objects": "2.7.0-beta.6"
|
|
17
17
|
},
|
|
18
18
|
"repository": {},
|
|
19
19
|
"license": "MIT",
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "375ec701f921e76a94071d0c4004727d8dc6a8a4"
|
|
21
21
|
}
|