@steedos/service-plugin-amis 2.3.6 → 2.3.7
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/client/amis.render.client.js +35 -150
- package/main/default/client/load.assets.client.js +2 -9
- package/main/default/client/tailwind.client.js +10 -29
- package/main/default/objects/pages/fields/render_engine.field.yml +11 -0
- package/main/default/objects/pages/pages.object.yml +2 -0
- package/main/default/pages/apps_form.page.amis.json +9 -22
- package/main/default/pages/apps_form.page.yml +2 -0
- package/main/default/pages/generate_object_tabs.page.amis.json +2 -2
- package/main/default/pages/listview_form.page.amis.json +1 -34
- package/main/default/pages/object_layouts.page.amis.json +4 -1
- package/main/default/pages/space_user_info_record.page.amis.json +6 -1
- package/main/default/services/amis.service.js +1 -1
- package/package.json +4 -10
- package/public/amis/amis.css +18 -1
- package/public/translations/amis/zh-CN.json +2 -2
- package/main/default/pages/action_field_updates.page.amis.json +0 -294
- package/main/default/pages/action_field_updates.page.yml +0 -12
- package/public/tailwind/tailwind-base.css +0 -514
- package/public/tailwind/tailwind-steedos.css +0 -454
- package/src/styles/tailwind-base.css +0 -1
- package/src/styles/tailwind.css +0 -3
- package/tailwind.config.js +0 -24
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"type": "page",
|
|
3
|
-
"body": [
|
|
4
|
-
{
|
|
5
|
-
"type": "service",
|
|
6
|
-
"className": "p-0",
|
|
7
|
-
"name": "page_edit_${recordId}",
|
|
8
|
-
"api": {
|
|
9
|
-
"method": "post",
|
|
10
|
-
"url": "${context.rootUrl}/graphql",
|
|
11
|
-
"adaptor": "\n if(payload.data.data){\n var data = payload.data.data[0];\n if(data){\n \n \n //初始化接口返回的字段移除字段值为null的字段\n for (key in data){\n if(data[key] === null){\n delete data[key];\n }\n }\n };\n payload.data = data;\n delete payload.extensions;\n }\n return payload;\n ",
|
|
12
|
-
"data": {
|
|
13
|
-
"query": "{data:action_field_updates(filters:[\"_id\", \"=\", \"${recordId}\"]){_id,name,label,object_name,target_object,field_name,operation,formula,literal_value,description,reevaluate_on_change,undirect,created,created_by,modified,modified_by,_display:_ui{object_name,target_object,field_name,operation,reevaluate_on_change,undirect,created,created_by,modified,modified_by}, \n recordPermissions: _permissions{\n allowCreate,\n allowCreateFiles,\n allowDelete,\n allowDeleteFiles,\n allowEdit,\n allowEditFiles,\n allowRead,\n allowReadFiles,\n disabled_actions,\n disabled_list_views,\n field_permissions,\n modifyAllFiles,\n modifyAllRecords,\n modifyAssignCompanysRecords,\n modifyCompanyRecords,\n uneditable_fields,\n unreadable_fields,\n unrelated_objects,\n viewAllFiles,\n viewAllRecords,\n viewAssignCompanysRecords,\n viewCompanyRecords,\n }\n }}"
|
|
14
|
-
},
|
|
15
|
-
"headers": {
|
|
16
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
17
|
-
},
|
|
18
|
-
"sendOn": "!!this.recordId",
|
|
19
|
-
"cache": 100
|
|
20
|
-
},
|
|
21
|
-
"initFetch": null,
|
|
22
|
-
"body": [
|
|
23
|
-
{
|
|
24
|
-
"type": "form",
|
|
25
|
-
"title": "",
|
|
26
|
-
"body": [
|
|
27
|
-
{
|
|
28
|
-
"type": "fieldSet",
|
|
29
|
-
"id": "u:3ce1d050bcac",
|
|
30
|
-
"title": "通用",
|
|
31
|
-
"collapsable": true,
|
|
32
|
-
"body": [
|
|
33
|
-
{
|
|
34
|
-
"name": "name",
|
|
35
|
-
"label": "API 名称",
|
|
36
|
-
"required": true,
|
|
37
|
-
"type": "input-text",
|
|
38
|
-
"className": "m-1",
|
|
39
|
-
"labelClassName": "text-left",
|
|
40
|
-
"clearValueOnHidden": true,
|
|
41
|
-
"fieldName": "name",
|
|
42
|
-
"id": "u:8ebca359c714"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"name": "label",
|
|
46
|
-
"label": "显示名称",
|
|
47
|
-
"required": true,
|
|
48
|
-
"type": "input-text",
|
|
49
|
-
"className": "m-1",
|
|
50
|
-
"labelClassName": "text-left",
|
|
51
|
-
"clearValueOnHidden": true,
|
|
52
|
-
"fieldName": "label",
|
|
53
|
-
"id": "u:124c34a09c5c"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"name": "object_name",
|
|
57
|
-
"label": "对象",
|
|
58
|
-
"required": false,
|
|
59
|
-
"type": "select",
|
|
60
|
-
"joinValues": false,
|
|
61
|
-
"extractValue": true,
|
|
62
|
-
"autoComplete": {
|
|
63
|
-
"method": "post",
|
|
64
|
-
"url": "${context.rootUrl}/graphql",
|
|
65
|
-
"data": {
|
|
66
|
-
"query": "{objects(filters: [\"_id\", \"=\", \"-1\"]){_id}}",
|
|
67
|
-
"$": "$$",
|
|
68
|
-
"$term": "$term",
|
|
69
|
-
"$value": "$object_name._id",
|
|
70
|
-
"rfield": "${object_name}"
|
|
71
|
-
},
|
|
72
|
-
"requestAdaptor": "\n var filters = '[]';\n var top = 10;\n if(api.data.$term){\n filters = '[\"name\", \"contains\", \"'+ api.data.$term +'\"]';\n }else if(api.data.$value){\n filters = '[\"_id\", \"=\", \"'+ api.data.$value +'\"]';\n }\n api.data.query = api.data.query.replace(/{__filters}/g, filters).replace('{__top}', top);\n return api;\n ",
|
|
73
|
-
"adaptor": "\n payload.data.options = eval(function anonymous(\n) {\n\n return Steedos.getObjectsOptions();\n\n})(api.data);\n return payload;\n "
|
|
74
|
-
},
|
|
75
|
-
"className": "m-1",
|
|
76
|
-
"labelClassName": "text-left",
|
|
77
|
-
"clearValueOnHidden": true,
|
|
78
|
-
"fieldName": "object_name",
|
|
79
|
-
"id": "u:0f2e40f882e2"
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
"name": "target_object",
|
|
83
|
-
"label": "要更新的对象",
|
|
84
|
-
"required": false,
|
|
85
|
-
"type": "select",
|
|
86
|
-
"joinValues": false,
|
|
87
|
-
"extractValue": true,
|
|
88
|
-
"autoComplete": {
|
|
89
|
-
"method": "post",
|
|
90
|
-
"url": "${context.rootUrl}/graphql",
|
|
91
|
-
"data": {
|
|
92
|
-
"query": "{objects(filters: [\"_id\", \"=\", \"-1\"]){_id}}",
|
|
93
|
-
"$": "$$",
|
|
94
|
-
"$term": "$term",
|
|
95
|
-
"$value": "$target_object._id",
|
|
96
|
-
"object_name": "$object_name",
|
|
97
|
-
"rfield": "${object_name}"
|
|
98
|
-
},
|
|
99
|
-
"requestAdaptor": "\n var filters = '[]';\n var top = 10;\n if(api.data.$term){\n filters = '[\"name\", \"contains\", \"'+ api.data.$term +'\"]';\n }else if(api.data.$value){\n filters = '[\"_id\", \"=\", \"'+ api.data.$value +'\"]';\n }\n api.data.query = api.data.query.replace(/{__filters}/g, filters).replace('{__top}', top);\n return api;\n ",
|
|
100
|
-
"adaptor": "\n payload.data.options = eval(function anonymous(doc\n) {\n\n var object = Creator.objectsByName[doc.object_name];\n if(object){\n var _options = [{label: object.label, value: object.name}];\n _.forEach(object.fields, function (field, fname) {\n if(field && field.type === 'master_detail' && _.isString(field.reference_to)){\n var referenceToObject = Creator.objectsByName[field.reference_to];\n if(referenceToObject){\n _options.push({\n label: referenceToObject.label,\n value: field.name,\n });\n }\n }\n });\n return _options;\n }\n return [];\n\n})(api.data);\n return payload;\n "
|
|
101
|
-
},
|
|
102
|
-
"className": "m-1",
|
|
103
|
-
"labelClassName": "text-left",
|
|
104
|
-
"clearValueOnHidden": true,
|
|
105
|
-
"fieldName": "target_object",
|
|
106
|
-
"id": "u:dd1c95753238"
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
"name": "field_name",
|
|
110
|
-
"label": "要更新的字段",
|
|
111
|
-
"required": false,
|
|
112
|
-
"type": "select",
|
|
113
|
-
"joinValues": false,
|
|
114
|
-
"extractValue": true,
|
|
115
|
-
"autoComplete": {
|
|
116
|
-
"method": "post",
|
|
117
|
-
"url": "${context.rootUrl}/graphql",
|
|
118
|
-
"data": {
|
|
119
|
-
"query": "{objects(filters: [\"_id\", \"=\", \"-1\"]){_id}}",
|
|
120
|
-
"$": "$$",
|
|
121
|
-
"$term": "$term",
|
|
122
|
-
"$value": "$field_name._id",
|
|
123
|
-
"object_name": "$object_name",
|
|
124
|
-
"target_object": "$target_object",
|
|
125
|
-
"rfield": "${object_name}"
|
|
126
|
-
},
|
|
127
|
-
"requestAdaptor": "\n var filters = '[]';\n var top = 10;\n if(api.data.$term){\n filters = '[\"name\", \"contains\", \"'+ api.data.$term +'\"]';\n }else if(api.data.$value){\n filters = '[\"_id\", \"=\", \"'+ api.data.$value +'\"]';\n }\n api.data.query = api.data.query.replace(/{__filters}/g, filters).replace('{__top}', top);\n return api;\n ",
|
|
128
|
-
"adaptor": "\n payload.data.options = eval(function anonymous(doc\n) {\n\n var mainObjectName = null;\n if(doc.target_object && doc.target_object != doc.object_name){\n mainObjectName = Creator.objectsByName[doc.object_name].fields[doc.target_object].reference_to;\n }else{\n mainObjectName = doc.object_name;\n }\n var object = Creator.objectsByName[mainObjectName];\n if(object){\n var _options = [];\n _.forEach(object.fields, function (field, fname) {\n if([\"formula\", \"summary\", \"autonumber\"].indexOf(field.type) < 0){\n /*公式、累计汇总、自动编号三种字段类型是只读的,不允许字段更新来变更其值*/\n _options.push({\n label: field.label,\n value: field.name,\n });\n }\n });\n return _options;\n }\n return [];\n\n})(api.data);\n return payload;\n "
|
|
129
|
-
},
|
|
130
|
-
"className": "m-1",
|
|
131
|
-
"labelClassName": "text-left",
|
|
132
|
-
"clearValueOnHidden": true,
|
|
133
|
-
"fieldName": "field_name",
|
|
134
|
-
"id": "u:204fadb7cef0"
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
"name": "operation",
|
|
138
|
-
"label": "新字段值类型",
|
|
139
|
-
"required": false,
|
|
140
|
-
"type": "select",
|
|
141
|
-
"joinValues": false,
|
|
142
|
-
"extractValue": true,
|
|
143
|
-
"autoComplete": {
|
|
144
|
-
"method": "post",
|
|
145
|
-
"url": "${context.rootUrl}/graphql",
|
|
146
|
-
"data": {
|
|
147
|
-
"query": "{objects(filters: [\"_id\", \"=\", \"-1\"]){_id}}",
|
|
148
|
-
"$": "$$",
|
|
149
|
-
"$term": "$term",
|
|
150
|
-
"$value": "$operation._id",
|
|
151
|
-
"field_name": "$field_name",
|
|
152
|
-
"target_object": "$target_object",
|
|
153
|
-
"object_name": "$object_name",
|
|
154
|
-
"rfield": "${object_name}"
|
|
155
|
-
},
|
|
156
|
-
"requestAdaptor": "\n var filters = '[]';\n var top = 10;\n if(api.data.$term){\n filters = '[\"name\", \"contains\", \"'+ api.data.$term +'\"]';\n }else if(api.data.$value){\n filters = '[\"_id\", \"=\", \"'+ api.data.$value +'\"]';\n }\n api.data.query = api.data.query.replace(/{__filters}/g, filters).replace('{__top}', top);\n return api;\n ",
|
|
157
|
-
"adaptor": "\n payload.data.options = eval(function anonymous(doc\n) {\n\n var mainObjectName = null;\n if(doc.target_object && doc.target_object != doc.object_name){\n mainObjectName = Creator.objectsByName[doc.object_name].fields[doc.target_object].reference_to;\n }else{\n mainObjectName = doc.object_name;\n }\n var object = Creator.objectsByName[mainObjectName];\n if(object && doc.field_name){\n var _options = [];\n var field = object.fields[doc.field_name];\n if(field && field.type != 'boolean'){\n _options.push({\n label: TAPi18n.__(\"action_field_updates_field_operation_options_null\"),\n value: 'null',\n }) \n }\n _options.push({\n label: TAPi18n.__(\"action_field_updates_field_operation_options_formula\"),\n value: 'formula',\n });\n _options.push({\n label: TAPi18n.__(\"action_field_updates_field_operation_options_literal\"),\n value: 'literal',\n })\n return _options;\n }\n return [];\n\n})(api.data);\n return payload;\n "
|
|
158
|
-
},
|
|
159
|
-
"className": "m-1",
|
|
160
|
-
"labelClassName": "text-left",
|
|
161
|
-
"clearValueOnHidden": true,
|
|
162
|
-
"fieldName": "operation",
|
|
163
|
-
"id": "u:627e520855b5",
|
|
164
|
-
"multiple": false
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
"name": "formula",
|
|
168
|
-
"label": "公式",
|
|
169
|
-
"required": false,
|
|
170
|
-
"type": "textarea",
|
|
171
|
-
"tpl": "<b><%=data.formula%></b>",
|
|
172
|
-
"className": "col-span-2 m-1",
|
|
173
|
-
"labelClassName": "text-left",
|
|
174
|
-
"clearValueOnHidden": true,
|
|
175
|
-
"fieldName": "formula",
|
|
176
|
-
"id": "u:20766a86a9f4",
|
|
177
|
-
"hiddenOn": "this.operation != 'formula'"
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
"type": "service",
|
|
181
|
-
"id": "u:d201a629c160",
|
|
182
|
-
"body": [],
|
|
183
|
-
"messages": {},
|
|
184
|
-
"schemaApi": {
|
|
185
|
-
"method": "get",
|
|
186
|
-
"url": "${context.rootUrl}/service/api/@${object_name}/uiSchema?field_name=${field_name}&operation=${operation}",
|
|
187
|
-
"adaptor": "const formData = api.body;\nconst target_field_name = formData.field_name;\nconst target_object_uiSchema = payload;\nconst target_fields = target_object_uiSchema && target_object_uiSchema.fields;\nconst target_field_type = target_fields && target_fields[target_field_name].type;\nlet literal_value_schema = {\n \"type\": \"text\",\n \"name\": \"literal_value\",\n \"label\": \"指定新字段值\",\n \"required\": false,\n \"is_wide\": true,\n \"labelClassName\": \"text-left\"\n}\nif (target_field_type) {\n literal_value_schema = Object.assign({}, target_object_uiSchema.fields[target_field_name], {\n name: \"literal_value\",\n label: \"指定新字段值\",\n disabled: false,\n readonly: false,\n is_wide: true\n });\n}\npayload = {\n \"status\": 0,\n \"msg\": \"\",\n \"data\": {\n \"body\": [\n {\n \"type\": \"steedos-field\",\n \"field\": literal_value_schema,\n \"name\": \"literal_value\",\n \"clearValueOnHidden\": true,\n \"fieldName\": \"literal_value\",\n \"visibleOn\": \"this.operation === 'literal'\"\n }\n ]\n }\n}\nreturn payload;",
|
|
188
|
-
"sendOn": "!!this.object_name && !!this.field_name && this.operation === 'literal'",
|
|
189
|
-
"headers": {
|
|
190
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
191
|
-
},
|
|
192
|
-
"data": {
|
|
193
|
-
"&": "$$"
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
"name": "description",
|
|
199
|
-
"label": "描述",
|
|
200
|
-
"required": false,
|
|
201
|
-
"type": "textarea",
|
|
202
|
-
"tpl": "<b><%=data.description%></b>",
|
|
203
|
-
"className": "col-span-2 m-1",
|
|
204
|
-
"labelClassName": "text-left",
|
|
205
|
-
"clearValueOnHidden": true,
|
|
206
|
-
"fieldName": "description",
|
|
207
|
-
"id": "u:16a7ebd835a6"
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
"name": "reevaluate_on_change",
|
|
211
|
-
"label": "字段更改后重新评估工作流规则",
|
|
212
|
-
"required": false,
|
|
213
|
-
"type": "checkbox",
|
|
214
|
-
"tpl": null,
|
|
215
|
-
"className": "m-1",
|
|
216
|
-
"labelClassName": "text-left",
|
|
217
|
-
"clearValueOnHidden": true,
|
|
218
|
-
"fieldName": "reevaluate_on_change",
|
|
219
|
-
"id": "u:b9baf683b6b0"
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
"name": "undirect",
|
|
223
|
-
"label": "触发对象触发器、工作流规则、字段验证规则",
|
|
224
|
-
"required": false,
|
|
225
|
-
"type": "checkbox",
|
|
226
|
-
"tpl": null,
|
|
227
|
-
"className": "m-1",
|
|
228
|
-
"labelClassName": "text-left",
|
|
229
|
-
"clearValueOnHidden": true,
|
|
230
|
-
"fieldName": "undirect",
|
|
231
|
-
"id": "u:b86f699bbe4f"
|
|
232
|
-
}
|
|
233
|
-
]
|
|
234
|
-
}
|
|
235
|
-
],
|
|
236
|
-
"id": "u:f57077c2a95f",
|
|
237
|
-
"mode": "horizontal",
|
|
238
|
-
"persistData": false,
|
|
239
|
-
"promptPageLeave": true,
|
|
240
|
-
"name": "form_edit_${recordId}",
|
|
241
|
-
"debug": false,
|
|
242
|
-
"submitText": "",
|
|
243
|
-
"api": {
|
|
244
|
-
"method": "post",
|
|
245
|
-
"url": "${context.rootUrl}/graphql",
|
|
246
|
-
"data": {
|
|
247
|
-
"objectName": "${objectName}",
|
|
248
|
-
"$": "$$",
|
|
249
|
-
"recordId": "${recordId}",
|
|
250
|
-
"modalName": "${modalName}"
|
|
251
|
-
},
|
|
252
|
-
"requestAdaptor": "\n \n const formData = api.data.$;\n for (key in formData){\n // image、select等字段清空值后保存的空字符串转换为null。\n if(formData[key] === ''){\n formData[key] = null;\n }\n }\n const objectName = api.data.objectName;\n const fieldsName = Object.keys(formData);\n delete formData.created;\n delete formData.created_by;\n delete formData.modified;\n delete formData.modified_by;\n delete formData._display;\n delete formData.created;\r\ndelete formData.created_by;\r\ndelete formData.modified;\r\ndelete formData.modified_by;\n \n \n let query = `mutation{record: ${objectName}__insert(doc: {__saveData}){_id}}`;\n if(formData.recordId && formData.recordId !='new'){\n query = `mutation{record: ${objectName}__update(id: \"${formData._id}\", doc: {__saveData}){_id}}`;\n };\n delete formData._id;\n let __saveData = JSON.stringify(JSON.stringify(formData));\n \n api.data = {query: query.replace('{__saveData}', __saveData)};\n return api;\n ",
|
|
253
|
-
"responseData": {
|
|
254
|
-
"recordId": "${record._id}"
|
|
255
|
-
},
|
|
256
|
-
"adaptor": "\n if(payload.errors){\n payload.status = 2;\n payload.msg = payload.errors[0].message;\n }\n return payload;\n ",
|
|
257
|
-
"headers": {
|
|
258
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
259
|
-
}
|
|
260
|
-
},
|
|
261
|
-
"initFetch": true,
|
|
262
|
-
"panelClassName": "m-0 sm:rounded-lg shadow-none",
|
|
263
|
-
"bodyClassName": "p-0",
|
|
264
|
-
"className": "steedos-amis-form",
|
|
265
|
-
"onEvent": {
|
|
266
|
-
"submitSucc": {
|
|
267
|
-
"weight": 0,
|
|
268
|
-
"actions": [
|
|
269
|
-
{
|
|
270
|
-
"componentId": "listview_action_field_updates",
|
|
271
|
-
"actionType": "reload",
|
|
272
|
-
"expression": "!!listViewId"
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
"actionType": "custom",
|
|
276
|
-
"script": "\n const { recordId, listViewId } = context.props.data;\n const data = event.data;\n const appId = data.appId;\n const objectName = data.objectName;\n // 在记录详细界面时isRecordDetail为true\n // TODO: isRecordDetail这个判断需要优化\n const isRecordDetail = !!data.$master && data.$master.$master?.recordId;\n if(recordId){\n // 编辑记录时,刷新主表单\n doAction({\n componentId: `detail_${recordId}`,\n actionType: \"reload\",\n expression: `!${listViewId}`\n });\n }\n else if(!isRecordDetail){\n // 在列表视图界面新建记录时跳转到详细页面\n const jumpTo = event.context.env && event.context.env.jumpTo;\n if(jumpTo){\n const newRecordId = data.result.data?.recordId;\n jumpTo(\"/app/\" + appId + \"/\" + objectName + \"/view/\" + newRecordId);\n }\n }\n "
|
|
277
|
-
}
|
|
278
|
-
]
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
],
|
|
283
|
-
"initApi": null
|
|
284
|
-
}
|
|
285
|
-
],
|
|
286
|
-
"data": {
|
|
287
|
-
"objectName": "action_field_updates",
|
|
288
|
-
"context": {}
|
|
289
|
-
},
|
|
290
|
-
"regions": [
|
|
291
|
-
"body"
|
|
292
|
-
],
|
|
293
|
-
"bodyClassName": ""
|
|
294
|
-
}
|