@steedos/service-plugin-amis 2.4.0-beta.2 → 2.4.0-beta.20
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 +52 -10
- package/main/default/pages/action_field_updates.page.amis.json +294 -0
- package/main/default/pages/action_field_updates.page.yml +12 -0
- package/main/default/pages/apps_form.page.amis.json +21 -2
- package/main/default/pages/apps_form.page.yml +0 -2
- package/package.json +6 -3
- package/public/amis/amis.css +0 -21
- package/public/tailwind/tailwind-steedos.css +82 -26
- package/public/translations/amis/zh-CN.json +2 -2
- package/main/default/objects/pages/fields/render_engine.field.yml +0 -11
- package/main/default/objects/pages/pages.object.yml +0 -2
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
// loadCss(Steedos.absoluteUrl("/unpkg.com/amis/sdk/sdk.css"))
|
|
22
|
-
loadCss(Steedos.absoluteUrl("/unpkg.com/amis/sdk/helper.css"))
|
|
23
|
-
loadCss(Steedos.absoluteUrl("/unpkg.com/amis/sdk/iconfont.css"))
|
|
22
|
+
// loadCss(Steedos.absoluteUrl("/unpkg.com/amis/sdk/helper.css"))
|
|
23
|
+
// loadCss(Steedos.absoluteUrl("/unpkg.com/amis/sdk/iconfont.css"))
|
|
24
24
|
loadCss(Steedos.absoluteUrl("/amis/amis.css"))
|
|
25
25
|
|
|
26
26
|
try {
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
// 加载Amis SDK: 如果直接放到body中会导致 meteor 编译后的 cordova.js 加载报错
|
|
51
|
-
let amisSDKScript = document.createElement("script");
|
|
52
|
-
amisSDKScript.setAttribute("src", Steedos.absoluteUrl('/unpkg.com/amis/sdk/sdk.js'));
|
|
53
|
-
document.getElementsByTagName("head")[0].appendChild(amisSDKScript);
|
|
51
|
+
// let amisSDKScript = document.createElement("script");
|
|
52
|
+
// amisSDKScript.setAttribute("src", Steedos.absoluteUrl('/unpkg.com/amis/sdk/sdk.js'));
|
|
53
|
+
// document.getElementsByTagName("head")[0].appendChild(amisSDKScript);
|
|
54
54
|
} catch (error) {
|
|
55
55
|
console.error(error)
|
|
56
56
|
};
|
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
console.error(`error`, error)
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
|
|
206
|
+
AmisEnv = {
|
|
207
207
|
// getModalContainer: (props)=>{
|
|
208
208
|
// let div = document.querySelector("#amisModalContainer");
|
|
209
209
|
// if(!div){
|
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
to = normalizeLink(to);
|
|
224
224
|
|
|
225
225
|
if (action && action.actionType === 'url') {
|
|
226
|
-
action.blank ===
|
|
226
|
+
action.blank === true ? window.open(to): (window.location.href = to);
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
229
|
|
|
@@ -279,19 +279,61 @@
|
|
|
279
279
|
return scoped = ref
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
|
|
282
|
+
|
|
283
|
+
let amisReact = amisRequire('react');
|
|
284
|
+
|
|
285
|
+
amisReact.useEffect(()=>{
|
|
283
286
|
const amisScope = amisRequire('amis/embed').embed(`.steedos-amis-render-scope-${name}`,schema, {data, name, locale: getAmisLng()}, Object.assign({}, AmisEnv, env))
|
|
284
287
|
if(window.SteedosUI && schema.name){
|
|
285
288
|
SteedosUI.refs[schema.name] = amisScope;
|
|
286
289
|
}
|
|
287
290
|
}, [])
|
|
288
|
-
return
|
|
291
|
+
return amisReact.createElement("div", {
|
|
289
292
|
className: "amis-scope"
|
|
290
|
-
},
|
|
293
|
+
}, amisReact.createElement("div", {
|
|
291
294
|
className: `steedos-amis-render-scope-${name}`
|
|
292
295
|
}));
|
|
293
296
|
};
|
|
294
297
|
|
|
298
|
+
window.renderAmis = function (root, schema, data, env) {
|
|
299
|
+
|
|
300
|
+
if(SteedosUI.refs[schema.name]){
|
|
301
|
+
if(SteedosUI.refs[schema.name].unmount){
|
|
302
|
+
SteedosUI.refs[schema.name].unmount()
|
|
303
|
+
}else{
|
|
304
|
+
console.log(`not find amis scope unmount`)
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// if(props.pageType === 'form'){
|
|
309
|
+
// env = Object.assign({
|
|
310
|
+
// getModalContainer: ()=>{
|
|
311
|
+
// return document.querySelector('.amis-scope');
|
|
312
|
+
// }
|
|
313
|
+
// }, env);
|
|
314
|
+
// }
|
|
315
|
+
schema.scopeRef = (ref) => {
|
|
316
|
+
try {
|
|
317
|
+
if(!window.amisScopes){
|
|
318
|
+
window.amisScopes = {};
|
|
319
|
+
}
|
|
320
|
+
if(name){
|
|
321
|
+
window.amisScopes[name] = ref;
|
|
322
|
+
}
|
|
323
|
+
} catch (error) {
|
|
324
|
+
console.error('error', error)
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
return scoped = ref
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
const amisScope = amisRequire('amis/embed').embed(root, schema, {data, name, locale: getAmisLng()}, Object.assign({}, AmisEnv, env))
|
|
332
|
+
if(window.SteedosUI && schema.name){
|
|
333
|
+
SteedosUI.refs[schema.name] = amisScope;
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
|
|
295
337
|
const initMonaco = ()=>{
|
|
296
338
|
|
|
297
339
|
// const { detect } = require('detect-browser');
|
|
@@ -0,0 +1,294 @@
|
|
|
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
|
+
}
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"sendOn": "!!this.recordId",
|
|
34
34
|
"adaptor": "var data = payload.data.data[0];\nif(data){\n //初始化接口返回的字段移除字段值为null的字段\n for (key in data){\n if(data[key] === null){\n delete data[key];\n }\n }\n};\nif (data.tab_items && !_.isArray(data.tab_items)) {\n // 数据库中存储的是对象格式而不是数组,转换为数组用于界面显示\n let arrTabItems = [];\n _.each(data.tab_items, function (n, k) {\n n.tab_name = k;\n delete n.index;\n arrTabItems.push(n);\n });\n data.tab_items = arrTabItems;\n}\npayload.data = data;\ndelete payload.extensions;\nreturn payload;\n ",
|
|
35
35
|
"data": {
|
|
36
|
-
"query": "{data:apps(filters:[\"_id\", \"=\", \"${recordId}\"]){_id,name,code,icon_slds,visible,description,tabs,tab_items,tab_groups,objects,mobile_objects,is_creator,mobile,sort,url,is_use_ie,is_use_iframe,is_new_window,on_click,auth_name,secret,is_system,from_code_id,instance_state,created,created_by:created_by__expand{_id,name},modified,modified_by:modified_by__expand{_id,name},_display{visible,is_creator,mobile,is_use_ie,is_use_iframe,is_new_window,is_system,instance_state,created,modified}}}"
|
|
36
|
+
"query": "{data:apps(filters:[\"_id\", \"=\", \"${recordId}\"]){_id,name,code,icon_slds,visible, showSidebar, description,tabs,tab_items,tab_groups,objects,mobile_objects,is_creator,mobile,sort,url,is_use_ie,is_use_iframe,is_new_window,on_click,auth_name,secret,is_system,from_code_id,instance_state,created,created_by:created_by__expand{_id,name},modified,modified_by:modified_by__expand{_id,name},_display{visible,is_creator,mobile,is_use_ie,is_use_iframe,is_new_window,is_system,instance_state,created,modified}}}"
|
|
37
37
|
},
|
|
38
38
|
"headers": {
|
|
39
39
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
@@ -157,6 +157,15 @@
|
|
|
157
157
|
"labelClassName": "text-left",
|
|
158
158
|
"id": "u:07a8a4c5f875"
|
|
159
159
|
},
|
|
160
|
+
{
|
|
161
|
+
"name": "showSidebar",
|
|
162
|
+
"label": "菜单显示在左侧",
|
|
163
|
+
"type": "checkbox",
|
|
164
|
+
"tpl": null,
|
|
165
|
+
"className": "m-0",
|
|
166
|
+
"labelClassName": "text-left",
|
|
167
|
+
"id": "u:07a8a4c5f877"
|
|
168
|
+
},
|
|
160
169
|
{
|
|
161
170
|
"name": "description",
|
|
162
171
|
"label": "描述",
|
|
@@ -356,6 +365,7 @@
|
|
|
356
365
|
}
|
|
357
366
|
}
|
|
358
367
|
],
|
|
368
|
+
"headerToolbarClassName": "px-1 py-3",
|
|
359
369
|
"id": "crud_tab_items",
|
|
360
370
|
"perPageAvailable": [
|
|
361
371
|
10
|
|
@@ -524,7 +534,16 @@
|
|
|
524
534
|
"script": "const data = context.props.data;\nif (!data._id) { \n return;\n}\nif (data.tab_items) {\n return;\n}\n\nconst tabOptions = data.tabs_options || [];\nconst tabItems = [];\n// 把应用中原来tabs属性值添加到新的tab_items属性的默认值中\nif (data.tabs && data.tabs.length) {\n data.tabs.forEach(function (item) {\n tabItems.push({ tab_name: item });\n });\n}\nconst pushObjectsToTabItems = function (objects) {\n objects.forEach(function (item) {\n // 已经有绑定到指定对象的选项卡就不添加\n let existObjectItem = !!tabItems.find(function (tabItem) {\n return !!tabOptions.find(function (option) {\n return tabItem.tab_name === tabItem.value && option.object === item;\n });\n });\n if (existObjectItem) {\n return;\n }\n // 找到指向指定对象的选项卡\n let tempOption = tabOptions.find(function (option) {\n return option.type === \"object\" && option.object === item;\n });\n if (!tempOption) {\n return;\n }\n // 选项卡名称如果重复了就不添加\n let existTabItem = !!tabItems.find(function (tabItem) {\n return tabItem.tab_name === tempOption.value;\n });\n if (existTabItem) {\n return;\n }\n if (tempOption) {\n tabItems.push({ tab_name: tempOption.value });\n }\n });\n}\n// 把应用中原来objects属性值添加到新的tab_items属性的默认值中\nif (data.objects && data.objects.length) {\n pushObjectsToTabItems(data.objects);\n}\n// 把应用中原来mobile_objects属性值添加到新的tab_items属性的默认值中\nif (data.mobile_objects && data.mobile_objects.length) {\n pushObjectsToTabItems(data.mobile_objects);\n}\n\ndoAction({\n actionType: 'setValue',\n args: {\n \"value\": { tab_items: tabItems }\n }\n});"
|
|
525
535
|
}
|
|
526
536
|
]
|
|
527
|
-
}
|
|
537
|
+
},
|
|
538
|
+
"submitSucc": {
|
|
539
|
+
"weight": 0,
|
|
540
|
+
"actions": [
|
|
541
|
+
{
|
|
542
|
+
"componentId": "listview_apps",
|
|
543
|
+
"actionType": "reload"
|
|
544
|
+
}
|
|
545
|
+
]
|
|
546
|
+
}
|
|
528
547
|
},
|
|
529
548
|
"id": "apps-form"
|
|
530
549
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-plugin-amis",
|
|
3
|
-
"version": "2.4.0-beta.
|
|
3
|
+
"version": "2.4.0-beta.20",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "yarn build:tailwind-base && yarn build:tailwind",
|
|
@@ -14,7 +14,10 @@
|
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@steedos-widgets/amis-lib": "^1.0.
|
|
17
|
+
"@steedos-widgets/amis-lib": "^1.0.20"
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "21e6705921d682193a70b10a2e0e402a3ca32539",
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"tailwindcss": "3.2.4"
|
|
22
|
+
}
|
|
20
23
|
}
|
package/public/amis/amis.css
CHANGED
|
@@ -13,10 +13,6 @@
|
|
|
13
13
|
vertical-align: initial !important;
|
|
14
14
|
} */
|
|
15
15
|
|
|
16
|
-
body{
|
|
17
|
-
-webkit-font-smoothing: inherit !important;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
16
|
/* .row-main{
|
|
21
17
|
border-radius: 0.25rem
|
|
22
18
|
} */
|
|
@@ -52,15 +48,6 @@ body{
|
|
|
52
48
|
min-width: 100px;
|
|
53
49
|
}
|
|
54
50
|
|
|
55
|
-
.steedos-amis-form .antd-Collapse .antd-Form--normal, .antd-Form--normal .antd-Tabs .antd-Tabs-content .antd-Tabs-pane .form-content{
|
|
56
|
-
display: grid!important;
|
|
57
|
-
grid-template-columns: repeat(2,minmax(0,1fr))!important;
|
|
58
|
-
grid-row-gap: 1rem!important;
|
|
59
|
-
row-gap: 1rem!important;
|
|
60
|
-
grid-column-gap: 1.5rem!important;
|
|
61
|
-
-moz-column-gap: 1.5rem!important;
|
|
62
|
-
column-gap: 1.5rem!important;
|
|
63
|
-
}
|
|
64
51
|
|
|
65
52
|
/* fix checkbox 隐藏时导致滚动条异常 */
|
|
66
53
|
.steedos-amis-form .antd-Collapse .antd-Form--normal .antd-Checkbox input{
|
|
@@ -76,10 +63,6 @@ body{
|
|
|
76
63
|
border-bottom: none;
|
|
77
64
|
}
|
|
78
65
|
|
|
79
|
-
.steedos-amis-form .antd-Collapse .antd-Form--normal{
|
|
80
|
-
grid-template-columns: none !important;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
66
|
.ant-modal-root .amis-scope .antd-Panel-footerWrap{
|
|
84
67
|
position: fixed;
|
|
85
68
|
}
|
|
@@ -105,7 +88,3 @@ body{
|
|
|
105
88
|
.ant-message{
|
|
106
89
|
z-index: 2600;
|
|
107
90
|
}
|
|
108
|
-
|
|
109
|
-
.page-list-view-root .amis-scope .antd-Table-headToolbar{
|
|
110
|
-
display: none;
|
|
111
|
-
}
|
|
@@ -54,10 +54,6 @@ body.steedos .absolute {
|
|
|
54
54
|
position: absolute
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
body.steedos .relative {
|
|
58
|
-
position: relative
|
|
59
|
-
}
|
|
60
|
-
|
|
61
57
|
body.steedos .sticky {
|
|
62
58
|
position: sticky
|
|
63
59
|
}
|
|
@@ -85,12 +81,22 @@ body.steedos .col-span-2 {
|
|
|
85
81
|
grid-column: span 2 / span 2
|
|
86
82
|
}
|
|
87
83
|
|
|
84
|
+
body.steedos .m-1 {
|
|
85
|
+
margin: 0.25rem
|
|
86
|
+
}
|
|
87
|
+
|
|
88
88
|
body.steedos .m-0 {
|
|
89
89
|
margin: 0px
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
body.steedos .
|
|
93
|
-
margin:
|
|
92
|
+
body.steedos .mx-4 {
|
|
93
|
+
margin-left: 1rem;
|
|
94
|
+
margin-right: 1rem
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
body.steedos .my-2 {
|
|
98
|
+
margin-top: 0.5rem;
|
|
99
|
+
margin-bottom: 0.5rem
|
|
94
100
|
}
|
|
95
101
|
|
|
96
102
|
body.steedos .mr-4 {
|
|
@@ -149,10 +155,6 @@ body.steedos .h-\[50px\] {
|
|
|
149
155
|
height: 50px
|
|
150
156
|
}
|
|
151
157
|
|
|
152
|
-
body.steedos .h-7 {
|
|
153
|
-
height: 1.75rem
|
|
154
|
-
}
|
|
155
|
-
|
|
156
158
|
body.steedos .h-10 {
|
|
157
159
|
height: 2.5rem
|
|
158
160
|
}
|
|
@@ -186,20 +188,16 @@ body.steedos .min-w-max {
|
|
|
186
188
|
min-width: max-content
|
|
187
189
|
}
|
|
188
190
|
|
|
189
|
-
body.steedos .flex-none {
|
|
190
|
-
flex: none
|
|
191
|
-
}
|
|
192
|
-
|
|
193
191
|
body.steedos .flex-1 {
|
|
194
192
|
flex: 1 1 0%
|
|
195
193
|
}
|
|
196
194
|
|
|
197
|
-
body.steedos
|
|
198
|
-
|
|
199
|
-
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))
|
|
195
|
+
body.steedos .flex-none {
|
|
196
|
+
flex: none
|
|
200
197
|
}
|
|
201
198
|
|
|
202
|
-
body.steedos
|
|
199
|
+
body.steedos .-translate-x-0 {
|
|
200
|
+
--tw-translate-x: -0px;
|
|
203
201
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))
|
|
204
202
|
}
|
|
205
203
|
|
|
@@ -228,6 +226,10 @@ body.steedos .gap-x-3 {
|
|
|
228
226
|
column-gap: 0.75rem
|
|
229
227
|
}
|
|
230
228
|
|
|
229
|
+
body.steedos .overflow-hidden {
|
|
230
|
+
overflow: hidden
|
|
231
|
+
}
|
|
232
|
+
|
|
231
233
|
body.steedos .overflow-y-auto {
|
|
232
234
|
overflow-y: auto
|
|
233
235
|
}
|
|
@@ -244,6 +246,11 @@ body.steedos .border-solid {
|
|
|
244
246
|
border-style: solid
|
|
245
247
|
}
|
|
246
248
|
|
|
249
|
+
body.steedos .border-slate-300 {
|
|
250
|
+
--tw-border-opacity: 1;
|
|
251
|
+
border-color: rgb(203 213 225 / var(--tw-border-opacity))
|
|
252
|
+
}
|
|
253
|
+
|
|
247
254
|
body.steedos .border-sky-500 {
|
|
248
255
|
--tw-border-opacity: 1;
|
|
249
256
|
border-color: rgb(14 165 233 / var(--tw-border-opacity))
|
|
@@ -259,10 +266,6 @@ body.steedos .bg-white {
|
|
|
259
266
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity))
|
|
260
267
|
}
|
|
261
268
|
|
|
262
|
-
body.steedos .p-3 {
|
|
263
|
-
padding: 0.75rem
|
|
264
|
-
}
|
|
265
|
-
|
|
266
269
|
body.steedos .p-0 {
|
|
267
270
|
padding: 0px
|
|
268
271
|
}
|
|
@@ -276,6 +279,21 @@ body.steedos .px-4 {
|
|
|
276
279
|
padding-right: 1rem
|
|
277
280
|
}
|
|
278
281
|
|
|
282
|
+
body.steedos .px-0 {
|
|
283
|
+
padding-left: 0px;
|
|
284
|
+
padding-right: 0px
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
body.steedos .px-1 {
|
|
288
|
+
padding-left: 0.25rem;
|
|
289
|
+
padding-right: 0.25rem
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
body.steedos .py-3 {
|
|
293
|
+
padding-top: 0.75rem;
|
|
294
|
+
padding-bottom: 0.75rem
|
|
295
|
+
}
|
|
296
|
+
|
|
279
297
|
body.steedos .px-10 {
|
|
280
298
|
padding-left: 2.5rem;
|
|
281
299
|
padding-right: 2.5rem
|
|
@@ -286,6 +304,10 @@ body.steedos .py-2 {
|
|
|
286
304
|
padding-bottom: 0.5rem
|
|
287
305
|
}
|
|
288
306
|
|
|
307
|
+
body.steedos .pr-4 {
|
|
308
|
+
padding-right: 1rem
|
|
309
|
+
}
|
|
310
|
+
|
|
289
311
|
body.steedos .pl-4 {
|
|
290
312
|
padding-left: 1rem
|
|
291
313
|
}
|
|
@@ -294,8 +316,16 @@ body.steedos .pb-0 {
|
|
|
294
316
|
padding-bottom: 0px
|
|
295
317
|
}
|
|
296
318
|
|
|
297
|
-
body.steedos .pt-
|
|
298
|
-
padding-top:
|
|
319
|
+
body.steedos .pt-4 {
|
|
320
|
+
padding-top: 1rem
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
body.steedos .pb-16 {
|
|
324
|
+
padding-bottom: 4rem
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
body.steedos .pb-4 {
|
|
328
|
+
padding-bottom: 1rem
|
|
299
329
|
}
|
|
300
330
|
|
|
301
331
|
body.steedos .pl-1\.5 {
|
|
@@ -339,6 +369,12 @@ body.steedos .underline {
|
|
|
339
369
|
text-decoration-line: underline
|
|
340
370
|
}
|
|
341
371
|
|
|
372
|
+
body.steedos .shadow-none {
|
|
373
|
+
--tw-shadow: 0 0 #0000;
|
|
374
|
+
--tw-shadow-colored: 0 0 #0000;
|
|
375
|
+
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
|
|
376
|
+
}
|
|
377
|
+
|
|
342
378
|
body.steedos .filter {
|
|
343
379
|
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)
|
|
344
380
|
}
|
|
@@ -368,14 +404,34 @@ body.steedos .ease-in-out {
|
|
|
368
404
|
}
|
|
369
405
|
|
|
370
406
|
@media (min-width: 640px) {
|
|
371
|
-
body.steedos .sm\:
|
|
372
|
-
|
|
407
|
+
body.steedos .sm\:m-3 {
|
|
408
|
+
margin: 0.75rem
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
body.steedos .sm\:mt-\[90px\] {
|
|
412
|
+
margin-top: 90px
|
|
373
413
|
}
|
|
374
414
|
|
|
375
415
|
body.steedos .sm\:w-\[220px\] {
|
|
376
416
|
width: 220px
|
|
377
417
|
}
|
|
378
418
|
|
|
419
|
+
body.steedos .sm\:rounded {
|
|
420
|
+
border-radius: 0.25rem
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
body.steedos .sm\:rounded-lg {
|
|
424
|
+
border-radius: 0.5rem
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
body.steedos .sm\:border {
|
|
428
|
+
border-width: 1px
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
body.steedos .sm\:p-3 {
|
|
432
|
+
padding: 0.75rem
|
|
433
|
+
}
|
|
434
|
+
|
|
379
435
|
body.steedos .sm\:shadow {
|
|
380
436
|
--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
381
437
|
--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);
|
|
@@ -282,8 +282,8 @@
|
|
|
282
282
|
"Editor.fullscreen": "全屏",
|
|
283
283
|
"Editor.exitFullscreen": "退出全屏",
|
|
284
284
|
"Condition.not": "非",
|
|
285
|
-
"Condition.and": "
|
|
286
|
-
"Condition.or": "
|
|
285
|
+
"Condition.and": "并",
|
|
286
|
+
"Condition.or": "或",
|
|
287
287
|
"Condition.add_cond": "添加条件",
|
|
288
288
|
"Condition.add_cond_group": "添加条件组",
|
|
289
289
|
"Condition.delete_cond_group": "删除组",
|