@steedos/standard-object-database 2.7.0-beta.21 → 2.7.0-beta.22
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_fields.object.yml +1 -1
- package/main/default/objects/objects.object.yml +2 -0
- package/main/default/pages/design_field_layout.page.amis.json +61 -39
- package/main/default/pages/object_fields_form.page.amis.json +29 -10
- package/main/default/services/object_fields.service.js +5 -3
- package/package.json +4 -4
|
@@ -327,7 +327,7 @@ fields:
|
|
|
327
327
|
label: Write requires master read
|
|
328
328
|
type: boolean
|
|
329
329
|
inlineHelpText: Sets the minimum sharing access level required on the master record to create, edit, or delete child records. This field applies only to master-detail or junction object custom field types. true—Allows users with “Read” access to the master record permission to create, edit, or delete child records. This setting makes sharing less restrictive. false—Allows users with “Read/Write” access to the master record permission to create, edit, or delete child records. This setting is more restrictive than true, and is the default value.
|
|
330
|
-
visible_on:
|
|
330
|
+
visible_on: "{{formData.type === 'master_detail' ? true: false}}"
|
|
331
331
|
sort_no: 200
|
|
332
332
|
amis:
|
|
333
333
|
disabledOn: "${is_system == true}"
|
|
@@ -99,8 +99,8 @@
|
|
|
99
99
|
],
|
|
100
100
|
"api": {
|
|
101
101
|
"method": "get",
|
|
102
|
-
"url": "${context.rootUrl}/service/api
|
|
103
|
-
"adaptor": "payload = {data: {variables: SteedosUI.getFormulaVariables(payload.
|
|
102
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${designObjectName}/fields/options",
|
|
103
|
+
"adaptor": "payload = {data: {variables: SteedosUI.getFormulaVariables(payload.data.options)}};return payload;",
|
|
104
104
|
"cache": 30000,
|
|
105
105
|
"headers": {
|
|
106
106
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
@@ -246,50 +246,72 @@
|
|
|
246
246
|
"title": "编辑字段",
|
|
247
247
|
"body": [
|
|
248
248
|
{
|
|
249
|
-
"type": "
|
|
250
|
-
"
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
"
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
"label",
|
|
259
|
-
"readonly",
|
|
260
|
-
"is_wide",
|
|
261
|
-
"visible_on"
|
|
262
|
-
],
|
|
263
|
-
"fieldsExtend": {
|
|
264
|
-
"label": {
|
|
265
|
-
"is_wide": true,
|
|
266
|
-
"group": ""
|
|
267
|
-
},
|
|
268
|
-
"readonly": {
|
|
269
|
-
"group": ""
|
|
249
|
+
"type": "service",
|
|
250
|
+
"body": {
|
|
251
|
+
"type": "steedos-object-form",
|
|
252
|
+
"label": "对象表单",
|
|
253
|
+
"objectApiName": "object_fields",
|
|
254
|
+
"recordId": "${_id}",
|
|
255
|
+
"mode": "edit",
|
|
256
|
+
"defaultData": {
|
|
257
|
+
"object": "${designObjectName}"
|
|
270
258
|
},
|
|
271
|
-
"
|
|
272
|
-
"
|
|
259
|
+
"fields": [
|
|
260
|
+
"label",
|
|
261
|
+
"readonly",
|
|
262
|
+
"is_wide",
|
|
263
|
+
"visible_on"
|
|
264
|
+
],
|
|
265
|
+
"fieldsExtend": {
|
|
266
|
+
"label": {
|
|
267
|
+
"is_wide": true,
|
|
268
|
+
"group": ""
|
|
269
|
+
},
|
|
270
|
+
"readonly": {
|
|
271
|
+
"group": ""
|
|
272
|
+
},
|
|
273
|
+
"is_wide": {
|
|
274
|
+
"group": ""
|
|
275
|
+
},
|
|
276
|
+
"visible_on": {
|
|
277
|
+
"group": "",
|
|
278
|
+
"amis": {
|
|
279
|
+
"type": "input-formula",
|
|
280
|
+
"name": "formula",
|
|
281
|
+
"evalMode": false,
|
|
282
|
+
"variableMode": "tabs",
|
|
283
|
+
"variables": "${variables}",
|
|
284
|
+
"visibleOn": "${variables}",
|
|
285
|
+
"id": "u:618105d5bfad"
|
|
286
|
+
}
|
|
287
|
+
}
|
|
273
288
|
},
|
|
274
|
-
"
|
|
275
|
-
|
|
289
|
+
"id": "u:b71796d3cb8c",
|
|
290
|
+
"className": "mb-4",
|
|
291
|
+
"apiRequestAdaptor": "api.data.query = api.data.query.replace('object_fields__update', 'object_fields__upsert')",
|
|
292
|
+
"onEvent": {
|
|
293
|
+
"submitSucc": {
|
|
294
|
+
"weight": 0,
|
|
295
|
+
"actions": [
|
|
296
|
+
{
|
|
297
|
+
"actionType": "custom",
|
|
298
|
+
"script": "setTimeout(() => {\n doAction({\n \"actionType\": \"broadcast\",\n \"args\": {\n \"eventName\": \"@data.changed.object_fields\"\n }\n });\n}, 500);\n\n\n"
|
|
299
|
+
}
|
|
300
|
+
]
|
|
301
|
+
}
|
|
276
302
|
}
|
|
277
303
|
},
|
|
278
|
-
"
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
"
|
|
283
|
-
|
|
284
|
-
"
|
|
285
|
-
{
|
|
286
|
-
"actionType": "custom",
|
|
287
|
-
"script": "setTimeout(() => {\n doAction({\n \"actionType\": \"broadcast\",\n \"args\": {\n \"eventName\": \"@data.changed.object_fields\"\n }\n });\n}, 500);\n\n\n"
|
|
288
|
-
}
|
|
289
|
-
]
|
|
304
|
+
"api": {
|
|
305
|
+
"method": "get",
|
|
306
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${designObjectName}/fields/options",
|
|
307
|
+
"adaptor": "payload = {data: {variables: SteedosUI.getFormulaVariables(payload.data.options)}};return payload;",
|
|
308
|
+
"cache": 30000,
|
|
309
|
+
"headers": {
|
|
310
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
290
311
|
}
|
|
291
312
|
}
|
|
292
313
|
}
|
|
314
|
+
|
|
293
315
|
],
|
|
294
316
|
"type": "dialog",
|
|
295
317
|
"data": {
|
|
@@ -23,6 +23,32 @@
|
|
|
23
23
|
"expression": "${!!event.data.defaultValue_formula}"
|
|
24
24
|
}
|
|
25
25
|
]
|
|
26
|
+
},
|
|
27
|
+
"inited": {
|
|
28
|
+
"actions": [
|
|
29
|
+
{
|
|
30
|
+
"actionType": "ajax",
|
|
31
|
+
"api": {
|
|
32
|
+
"method": "get",
|
|
33
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object}/fields/options",
|
|
34
|
+
"cache": 30000,
|
|
35
|
+
"adaptor": "const visibleOnVariables = SteedosUI.getFormulaVariables(payload.data.options);\nconst defaultValueVariables = [visibleOnVariables[1]];\npayload = {\n data: {\n visibleOnVariables,\n defaultValueVariables\n }\n};\nreturn payload;",
|
|
36
|
+
"headers": {
|
|
37
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"actionType": "setValue",
|
|
43
|
+
"args": {
|
|
44
|
+
"value": {
|
|
45
|
+
"visibleOnVariables": "${event.data.visibleOnVariables}",
|
|
46
|
+
"defaultValueVariables": "${event.data.defaultValueVariables}"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"componentId": "steedos_object_fields_service"
|
|
50
|
+
}
|
|
51
|
+
]
|
|
26
52
|
}
|
|
27
53
|
},
|
|
28
54
|
"initApiAdaptor": "const defaultValue_field_value = payload.data.defaultValue;\nif (defaultValue_field_value && _.isString(defaultValue_field_value) && defaultValue_field_value.indexOf('{') > -1) {\n payload.data.defaultValue_formula = defaultValue_field_value;\n delete payload.data.defaultValue;\n}\n\nif (recordId) {\n var data = payload.data;\n if (data) {\n data.filters = window.amisConvert.filtersToConditions(data.filters || []);\n }\n payload.data = data;\n}\nreturn payload;",
|
|
@@ -172,7 +198,8 @@
|
|
|
172
198
|
"name": "formula",
|
|
173
199
|
"evalMode": false,
|
|
174
200
|
"variableMode": "tabs",
|
|
175
|
-
"variables": "${
|
|
201
|
+
"variables": "${visibleOnVariables}",
|
|
202
|
+
"visibleOn": "${visibleOnVariables}",
|
|
176
203
|
"id": "u:618105d5bfad"
|
|
177
204
|
}
|
|
178
205
|
}
|
|
@@ -182,17 +209,9 @@
|
|
|
182
209
|
}
|
|
183
210
|
}
|
|
184
211
|
],
|
|
185
|
-
"api": {
|
|
186
|
-
"method": "get",
|
|
187
|
-
"url": "${context.rootUrl}/service/api/@${_master.record.name}/uiSchema",
|
|
188
|
-
"adaptor": "const VisibleVariables = SteedosUI.getFormulaVariables(payload.fields);\nconst defaultVariables = [VisibleVariables[1]];\npayload = {\n data: {\n VisibleVariables,\n defaultVariables\n }\n};\nreturn payload;",
|
|
189
|
-
"headers": {
|
|
190
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
212
|
"data": {
|
|
194
213
|
"context": {}
|
|
195
214
|
},
|
|
196
215
|
"name": "object_fields_form",
|
|
197
|
-
"id": "
|
|
216
|
+
"id": "steedos_object_fields_service"
|
|
198
217
|
}
|
|
@@ -125,7 +125,8 @@ module.exports = {
|
|
|
125
125
|
"clearValueOnHidden": true,
|
|
126
126
|
"fieldName": "defaultValue"
|
|
127
127
|
}
|
|
128
|
-
|
|
128
|
+
const regDoubleQuote = /\$\{([^}]*)\}/g; // 更改捕获组内容:([^}]*) 匹配非 } 字符
|
|
129
|
+
if(_.isString(value) && regDoubleQuote.test(value)){
|
|
129
130
|
// 只读时值是公式就显示公式
|
|
130
131
|
steedos_field = {
|
|
131
132
|
"type": "control",
|
|
@@ -135,7 +136,7 @@ module.exports = {
|
|
|
135
136
|
"label": translatedLabel,
|
|
136
137
|
"labelClassName": "text-left",
|
|
137
138
|
"type": "tpl",
|
|
138
|
-
"tpl": value.
|
|
139
|
+
"tpl": value.replace(regDoubleQuote, '\\${$1}')
|
|
139
140
|
}
|
|
140
141
|
}
|
|
141
142
|
}else if(['number','currency','percent'].includes(type)){
|
|
@@ -231,7 +232,8 @@ module.exports = {
|
|
|
231
232
|
"type": "input-formula",
|
|
232
233
|
"placeholder": "公式",
|
|
233
234
|
"variableMode": "tabs",
|
|
234
|
-
"variables": "${
|
|
235
|
+
"variables": "${defaultValueVariables}", //公式编辑器内引用的变量,在对象字段表单微页面内定义
|
|
236
|
+
"visibleOn": "${defaultValueVariables}",
|
|
235
237
|
// "disabledOn": "!!this.defaultValue && !!this.defaultValue.toString()",
|
|
236
238
|
"className": {
|
|
237
239
|
"defaultValue_field_formula": true,
|
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.22",
|
|
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.22",
|
|
16
|
+
"@steedos/standard-objects": "2.7.0-beta.22"
|
|
17
17
|
},
|
|
18
18
|
"repository": {},
|
|
19
19
|
"license": "MIT",
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "9d2b2604ee60a61f1bddfcbaf2df66dfb37abfde"
|
|
21
21
|
}
|