@steedos/standard-object-database 2.5.1 → 2.5.3-beta.1
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_fields.en/object_fields.en.objectTranslation.yml +8 -4
- package/main/default/objectTranslations/object_fields.zh-CN/object_fields.zh-CN.objectTranslation.yml +8 -4
- package/main/default/objects/object_fields.object.yml +4 -2
- package/main/default/objects/objects.core.js +20 -19
- package/main/default/triggers/object_fields.trigger.js +2 -1
- package/main/default/triggers/object_validation_rules.trigger.js +4 -3
- package/package.json +2 -2
package/main/default/objectTranslations/object_fields.en/object_fields.en.objectTranslation.yml
CHANGED
|
@@ -88,10 +88,14 @@ fields:
|
|
|
88
88
|
label: Reference to
|
|
89
89
|
help:
|
|
90
90
|
description:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
depend_on:
|
|
92
|
+
label: Dependent Fields
|
|
93
|
+
help: If the value of the dependent field changes, the option value of the current field will also change accordingly。
|
|
94
|
+
description:
|
|
95
|
+
reference_to_field:
|
|
96
|
+
label: Reference to field
|
|
97
|
+
help: The value of the associated object saved to the current object field; For example, after object A is associated with object B, when A1 record is associated with B1 record, B1 record will be stored by default_ Save the ID in the A1 record. If the foreign key field is modified, the 'foreign key field' will be replaced_ Store the ID in the A1 record.
|
|
98
|
+
description: The default is the primary key, and the default value is _id.
|
|
95
99
|
filtersFunction:
|
|
96
100
|
label: filters Function
|
|
97
101
|
help:
|
|
@@ -81,10 +81,14 @@ fields:
|
|
|
81
81
|
label: 引用对象
|
|
82
82
|
help:
|
|
83
83
|
description:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
depend_on:
|
|
85
|
+
label: 依赖的字段
|
|
86
|
+
help: 联动字段;例如:A是B依赖的字段,当A字段值发生改变,B字段选项值会随之改变。
|
|
87
|
+
description:
|
|
88
|
+
reference_to_field:
|
|
89
|
+
label: 外键字段
|
|
90
|
+
help: 关联的对象保存到当前对象字段的值;例如:A对象关联B对象后,当A1记录关联了B1记录,默认会存B1记录的_id存到A1记录中。如果修改了外键字段后,会将“外键字段”替换_id存储到A1记录中。
|
|
91
|
+
description: '默认为主键,默认值是_id'
|
|
88
92
|
filtersFunction:
|
|
89
93
|
label: 过滤器函数
|
|
90
94
|
help:
|
|
@@ -201,6 +201,7 @@ fields:
|
|
|
201
201
|
type: lookup
|
|
202
202
|
group: Advanced
|
|
203
203
|
label: 依赖的字段
|
|
204
|
+
inlineHelpText: 联动字段;例如:A是B依赖的字段,当A字段值发生改变,B字段选项值会随之改变。
|
|
204
205
|
reference_to: object_fields
|
|
205
206
|
reference_to_field: name
|
|
206
207
|
multiple: true
|
|
@@ -219,7 +220,8 @@ fields:
|
|
|
219
220
|
reference_to_field:
|
|
220
221
|
type: lookup
|
|
221
222
|
group: Advanced
|
|
222
|
-
label:
|
|
223
|
+
label: 外键字段
|
|
224
|
+
inlineHelpText: 关联的对象保存到当前对象字段的值;例如:A对象关联B对象后,当A1记录关联了B1记录,默认会存B1记录的_id存到A1记录中。如果修改了外键字段后,会将“外键字段”替换_id存储到A1记录中。
|
|
223
225
|
description: '默认为主键'
|
|
224
226
|
reference_to: object_fields
|
|
225
227
|
reference_to_field: name
|
|
@@ -234,7 +236,7 @@ fields:
|
|
|
234
236
|
return ['_id', '=', 'no']
|
|
235
237
|
}
|
|
236
238
|
}
|
|
237
|
-
sort_no:
|
|
239
|
+
sort_no: 440
|
|
238
240
|
multiple:
|
|
239
241
|
type: boolean
|
|
240
242
|
label: Multiple
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
var objectql = require('@steedos/objectql');
|
|
2
|
+
const register = require('@steedos/metadata-registrar');
|
|
2
3
|
const clone = require('clone');
|
|
3
4
|
const defaultDatasourceName = 'default';
|
|
4
5
|
const defaultDatasourcesName = ['default','meteor'];
|
|
@@ -135,7 +136,7 @@ function loadDBObject(object){
|
|
|
135
136
|
objectql.extend(object, {fields: fields}, {actions: actions}, {relatedList: relatedList});
|
|
136
137
|
_.each(actions, function(action){
|
|
137
138
|
action._visible = action.visible;
|
|
138
|
-
|
|
139
|
+
register.addLazyLoadButtons(action.object, action);
|
|
139
140
|
})
|
|
140
141
|
}
|
|
141
142
|
|
|
@@ -189,17 +190,17 @@ function loadObject(doc, oldDoc) {
|
|
|
189
190
|
|
|
190
191
|
originalObject.isMain = true;
|
|
191
192
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
193
|
+
register.addObjectConfig(doc, datasourceName);
|
|
194
|
+
register.loadObjectLazyListViews(doc.name);
|
|
195
|
+
register.loadObjectLazyActions(doc.name);
|
|
196
|
+
register.loadActionScripts(doc.name);
|
|
197
|
+
register.loadObjectLazyMethods(doc.name);
|
|
198
|
+
register.loadObjectLazyListenners(doc.name);
|
|
199
|
+
register.loadObjectLazyButtons(doc.name);
|
|
199
200
|
//获取到继承后的对象
|
|
200
201
|
// const _doc = objectql.getObjectConfig(doc.name);
|
|
201
202
|
// console.log(`loadObject===>`, doc.name)
|
|
202
|
-
|
|
203
|
+
register.MetadataRegister.addObjectConfig(DB_OBJECT_SERVICE_NAME, originalObject).then(function(res){
|
|
203
204
|
if(res){
|
|
204
205
|
// datasource.setObject(doc.name, _doc);
|
|
205
206
|
// try {
|
|
@@ -215,7 +216,7 @@ function loadObject(doc, oldDoc) {
|
|
|
215
216
|
// loadObjectPermission(doc);
|
|
216
217
|
// }
|
|
217
218
|
|
|
218
|
-
|
|
219
|
+
broker.broadcast("$packages.statisticsActivatedPackages", {});
|
|
219
220
|
}
|
|
220
221
|
})
|
|
221
222
|
|
|
@@ -273,33 +274,33 @@ function reloadObject(changeLog){
|
|
|
273
274
|
case 'field':
|
|
274
275
|
if(data.event === 'remove'){
|
|
275
276
|
deleted.fields.push(data.value.name);
|
|
276
|
-
|
|
277
|
+
register.removeObjectFieldConfig(objectName, data.value);
|
|
277
278
|
}else{
|
|
278
279
|
if(data.event === 'update'){
|
|
279
280
|
if(data.value._previousName != data.value.name){
|
|
280
281
|
deleted.fields.push(data.value._previousName);
|
|
281
|
-
|
|
282
|
+
register.removeObjectFieldConfig(objectName, {name: data.value._previousName});
|
|
282
283
|
}
|
|
283
284
|
}
|
|
284
|
-
|
|
285
|
+
register.addObjectFieldConfig(objectName, data.value);
|
|
285
286
|
}
|
|
286
287
|
break;
|
|
287
288
|
case 'action':
|
|
288
289
|
if(data.event === 'remove'){
|
|
289
290
|
deleted.actions.push(data.value.name);
|
|
290
|
-
|
|
291
|
+
register.removeObjectButtonsConfig(objectName, data.value);
|
|
291
292
|
}else{
|
|
292
293
|
if(data.event === 'update'){
|
|
293
294
|
if(data.value._previousName != data.value.name){
|
|
294
295
|
deleted.actions.push(data.value._previousName);
|
|
295
|
-
|
|
296
|
+
register.removeObjectButtonsConfig(objectName, {name: data.value._previousName});
|
|
296
297
|
}
|
|
297
298
|
}
|
|
298
299
|
if(data.value.is_enable){
|
|
299
|
-
|
|
300
|
+
register.addObjectButtonsConfig(objectName, data.value);
|
|
300
301
|
}else{
|
|
301
302
|
deleted.actions.push(data.value.name);
|
|
302
|
-
|
|
303
|
+
register.removeObjectButtonsConfig(objectName, data.value);
|
|
303
304
|
}
|
|
304
305
|
}
|
|
305
306
|
break;
|
|
@@ -316,7 +317,7 @@ function reloadObject(changeLog){
|
|
|
316
317
|
return
|
|
317
318
|
}
|
|
318
319
|
//获取到最新的对象
|
|
319
|
-
const object =
|
|
320
|
+
const object = register.getOriginalObjectConfig(objectName);
|
|
320
321
|
|
|
321
322
|
let _mf = _.max(_.values(object.fields), function (field) { return field.sort_no; });
|
|
322
323
|
if(_mf && object.name){
|
|
@@ -341,7 +342,7 @@ function reloadObject(changeLog){
|
|
|
341
342
|
// } catch (error) {
|
|
342
343
|
// console.log('error', error);
|
|
343
344
|
// }
|
|
344
|
-
|
|
345
|
+
broker.broadcast("$packages.statisticsActivatedPackages", {});
|
|
345
346
|
}
|
|
346
347
|
})
|
|
347
348
|
}
|
|
@@ -4,6 +4,7 @@ const odataMongodb = require("@steedos/odata-v4-mongodb");
|
|
|
4
4
|
const clone = require('clone');
|
|
5
5
|
var objectCore = require('../objects/objects.core.js');
|
|
6
6
|
const objectql = require('@steedos/objectql');
|
|
7
|
+
const register = require('@steedos/metadata-registrar');
|
|
7
8
|
const auth = require('@steedos/auth');
|
|
8
9
|
const MAX_MASTER_DETAIL_LEAVE = objectql.MAX_MASTER_DETAIL_LEAVE;
|
|
9
10
|
const validateOptionValue = (value)=>{
|
|
@@ -198,7 +199,7 @@ const initSummaryDoc = async (doc) => {
|
|
|
198
199
|
if (!doc.summary_object) {
|
|
199
200
|
throw new Error("object_fields_error_summary_object_required");
|
|
200
201
|
}
|
|
201
|
-
let summaryObject =
|
|
202
|
+
let summaryObject = register.getObjectConfig(doc.summary_object);
|
|
202
203
|
let summaryConfig = {
|
|
203
204
|
summary_object: doc.summary_object,
|
|
204
205
|
summary_type: doc.summary_type,
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
const _ = require("underscore");
|
|
7
7
|
const util = require('@steedos/standard-objects').util;
|
|
8
8
|
const objectql = require("@steedos/objectql");
|
|
9
|
+
const register = require('@steedos/metadata-registrar')
|
|
9
10
|
const auth = require('@steedos/auth');
|
|
10
11
|
|
|
11
12
|
module.exports = {
|
|
@@ -17,7 +18,7 @@ module.exports = {
|
|
|
17
18
|
},
|
|
18
19
|
afterFind: async function(){
|
|
19
20
|
const { spaceId } = this;
|
|
20
|
-
let dataList =
|
|
21
|
+
let dataList = register.getAllObjectValidationRules();
|
|
21
22
|
if (!_.isEmpty(dataList)) {
|
|
22
23
|
dataList.forEach((doc) => {
|
|
23
24
|
if (!_.find(this.data.values, (value) => {
|
|
@@ -37,7 +38,7 @@ module.exports = {
|
|
|
37
38
|
},
|
|
38
39
|
afterAggregate: async function(){
|
|
39
40
|
const { spaceId } = this;
|
|
40
|
-
let dataList =
|
|
41
|
+
let dataList = register.getAllObjectValidationRules();
|
|
41
42
|
if (!_.isEmpty(dataList)) {
|
|
42
43
|
dataList.forEach((doc) => {
|
|
43
44
|
if (!_.find(this.data.values, (value) => {
|
|
@@ -61,7 +62,7 @@ module.exports = {
|
|
|
61
62
|
},
|
|
62
63
|
afterFindOne: async function(){
|
|
63
64
|
if (_.isEmpty(this.data.values)) {
|
|
64
|
-
const all =
|
|
65
|
+
const all = register.getAllObjectValidationRules();
|
|
65
66
|
const id = this.id;
|
|
66
67
|
this.data.values = _.find(all, function (item) {
|
|
67
68
|
return item._id === id
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/standard-object-database",
|
|
3
|
-
"version": "2.5.1",
|
|
3
|
+
"version": "2.5.3-beta.1",
|
|
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": "a2e723ed4256279e8e6fa9f67d7f607c83f8638f"
|
|
19
19
|
}
|