@steedos/service-plugin-amis 2.4.0-beta.4 → 2.4.0-beta.40
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 +65 -33
- package/main/default/pages/action_field_updates.page.amis.json +266 -0
- package/main/default/pages/action_field_updates.page.yml +12 -0
- package/main/default/pages/apps_form.page.amis.json +22 -3
- package/main/default/pages/apps_form.page.yml +0 -2
- package/main/default/pages/generate_object_tabs.page.amis.json +3 -2
- package/main/default/pages/listview_form.page.amis.json +38 -4
- package/main/default/pages/object_layouts.page.amis.json +14 -27
- package/main/default/services/metadata/objects.service.js +2 -1
- package/package.json +6 -3
- package/public/amis/amis.css +0 -18
- package/public/tailwind/tailwind-steedos.css +82 -39
- package/public/translations/amis/zh-CN.json +2 -2
- package/main/default/client/load.assets.client.js +0 -26
- package/main/default/client/style.client.js +0 -24
- package/main/default/client/tailwind.client.js +0 -35
- package/main/default/objects/pages/fields/render_engine.field.yml +0 -11
- package/main/default/objects/pages/pages.object.yml +0 -2
|
@@ -6,23 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
; (function () {
|
|
8
8
|
|
|
9
|
-
const loadCss = (href)=>{
|
|
10
|
-
try {
|
|
11
|
-
// 加载Amis css
|
|
12
|
-
let amisStyle = document.createElement("link");
|
|
13
|
-
amisStyle.setAttribute("rel", "stylesheet");
|
|
14
|
-
amisStyle.setAttribute("type", "text/css");
|
|
15
|
-
amisStyle.setAttribute("href", href);
|
|
16
|
-
document.getElementsByTagName("head")[0].appendChild(amisStyle);
|
|
17
|
-
} catch (error) {
|
|
18
|
-
console.error(error)
|
|
19
|
-
};
|
|
20
|
-
}
|
|
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"))
|
|
24
|
-
loadCss(Steedos.absoluteUrl("/amis/amis.css"))
|
|
25
|
-
|
|
26
9
|
try {
|
|
27
10
|
window['attrAccept'] = function (file, acceptedFiles) {
|
|
28
11
|
if (file && acceptedFiles) {
|
|
@@ -48,9 +31,9 @@
|
|
|
48
31
|
}
|
|
49
32
|
|
|
50
33
|
// 加载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);
|
|
34
|
+
// let amisSDKScript = document.createElement("script");
|
|
35
|
+
// amisSDKScript.setAttribute("src", Steedos.absoluteUrl('/unpkg.com/amis/sdk/sdk.js'));
|
|
36
|
+
// document.getElementsByTagName("head")[0].appendChild(amisSDKScript);
|
|
54
37
|
} catch (error) {
|
|
55
38
|
console.error(error)
|
|
56
39
|
};
|
|
@@ -94,7 +77,7 @@
|
|
|
94
77
|
if(comp.componentType === 'amisSchema'){
|
|
95
78
|
let amisReact = amisRequire('react');
|
|
96
79
|
AmisWrapper = function(props){
|
|
97
|
-
const { body, render } = props
|
|
80
|
+
const { $schema, body, render } = props
|
|
98
81
|
const [schema, setSchema] = amisReact.useState(null);
|
|
99
82
|
amisReact.useEffect(()=>{
|
|
100
83
|
const result = Component.class(props);
|
|
@@ -105,7 +88,7 @@
|
|
|
105
88
|
}else{
|
|
106
89
|
setSchema(result)
|
|
107
90
|
}
|
|
108
|
-
}, [])
|
|
91
|
+
}, [JSON.stringify($schema)])
|
|
109
92
|
return amisReact.createElement(amisReact.Fragment, null, amisReact.createElement(amisReact.Fragment, null, schema && render ? render('body', schema) : ''), amisReact.createElement(amisReact.Fragment, null, render ? render('body', body) : ''));
|
|
110
93
|
}
|
|
111
94
|
}
|
|
@@ -203,7 +186,7 @@
|
|
|
203
186
|
console.error(`error`, error)
|
|
204
187
|
}
|
|
205
188
|
}
|
|
206
|
-
|
|
189
|
+
AmisEnv = {
|
|
207
190
|
// getModalContainer: (props)=>{
|
|
208
191
|
// let div = document.querySelector("#amisModalContainer");
|
|
209
192
|
// if(!div){
|
|
@@ -223,7 +206,7 @@
|
|
|
223
206
|
to = normalizeLink(to);
|
|
224
207
|
|
|
225
208
|
if (action && action.actionType === 'url') {
|
|
226
|
-
action.blank ===
|
|
209
|
+
action.blank === true ? window.open(to): (window.location.href = to);
|
|
227
210
|
return;
|
|
228
211
|
}
|
|
229
212
|
|
|
@@ -248,10 +231,13 @@
|
|
|
248
231
|
const schema = props.schema;
|
|
249
232
|
const data = props.data;
|
|
250
233
|
const name = props.name;
|
|
251
|
-
|
|
252
|
-
if(SteedosUI.refs[
|
|
253
|
-
if(SteedosUI.refs[
|
|
254
|
-
|
|
234
|
+
const refName = schema.name || schema.id;
|
|
235
|
+
if(SteedosUI.refs[refName]){
|
|
236
|
+
if(SteedosUI.refs[refName].unmount){
|
|
237
|
+
try {
|
|
238
|
+
SteedosUI.refs[refName].unmount()
|
|
239
|
+
} catch (Exception) {
|
|
240
|
+
}
|
|
255
241
|
}else{
|
|
256
242
|
console.log(`not find amis scope unmount`)
|
|
257
243
|
}
|
|
@@ -279,19 +265,65 @@
|
|
|
279
265
|
return scoped = ref
|
|
280
266
|
}
|
|
281
267
|
|
|
282
|
-
|
|
268
|
+
|
|
269
|
+
let amisReact = amisRequire('react');
|
|
270
|
+
|
|
271
|
+
amisReact.useEffect(()=>{
|
|
283
272
|
const amisScope = amisRequire('amis/embed').embed(`.steedos-amis-render-scope-${name}`,schema, {data, name, locale: getAmisLng()}, Object.assign({}, AmisEnv, env))
|
|
284
|
-
|
|
285
|
-
|
|
273
|
+
const refName = schema.name || schema.id;
|
|
274
|
+
if(window.SteedosUI && refName){
|
|
275
|
+
SteedosUI.refs[refName] = amisScope;
|
|
286
276
|
}
|
|
287
277
|
}, [])
|
|
288
|
-
return
|
|
278
|
+
return amisReact.createElement("div", {
|
|
289
279
|
className: "amis-scope"
|
|
290
|
-
},
|
|
280
|
+
}, amisReact.createElement("div", {
|
|
291
281
|
className: `steedos-amis-render-scope-${name}`
|
|
292
282
|
}));
|
|
293
283
|
};
|
|
294
284
|
|
|
285
|
+
window.renderAmis = function (root, schema, data, env) {
|
|
286
|
+
const refName = schema.name || schema.id;
|
|
287
|
+
if(SteedosUI.refs[refName]){
|
|
288
|
+
if(SteedosUI.refs[refName].unmount){
|
|
289
|
+
try {
|
|
290
|
+
SteedosUI.refs[refName].unmount()
|
|
291
|
+
} catch (Exception) {
|
|
292
|
+
}
|
|
293
|
+
}else{
|
|
294
|
+
console.log(`not find amis scope unmount`)
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// if(props.pageType === 'form'){
|
|
299
|
+
// env = Object.assign({
|
|
300
|
+
// getModalContainer: ()=>{
|
|
301
|
+
// return document.querySelector('.amis-scope');
|
|
302
|
+
// }
|
|
303
|
+
// }, env);
|
|
304
|
+
// }
|
|
305
|
+
schema.scopeRef = (ref) => {
|
|
306
|
+
try {
|
|
307
|
+
if(!window.amisScopes){
|
|
308
|
+
window.amisScopes = {};
|
|
309
|
+
}
|
|
310
|
+
if(name){
|
|
311
|
+
window.amisScopes[name] = ref;
|
|
312
|
+
}
|
|
313
|
+
} catch (error) {
|
|
314
|
+
console.error('error', error)
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
return scoped = ref
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
const amisScope = amisRequire('amis/embed').embed(root, schema, {data, name, locale: getAmisLng()}, Object.assign({}, AmisEnv, env))
|
|
322
|
+
if(window.SteedosUI && refName){
|
|
323
|
+
SteedosUI.refs[refName] = amisScope;
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
|
|
295
327
|
const initMonaco = ()=>{
|
|
296
328
|
|
|
297
329
|
// const { detect } = require('detect-browser');
|
|
@@ -0,0 +1,266 @@
|
|
|
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
|
+
"searchable": true,
|
|
63
|
+
"source": {
|
|
64
|
+
"method": "post",
|
|
65
|
+
"url": "${context.rootUrl}/graphql",
|
|
66
|
+
"data": {
|
|
67
|
+
"orderBy": "${orderBy}",
|
|
68
|
+
"orderDir": "${orderDir}",
|
|
69
|
+
"pageNo": "${page}",
|
|
70
|
+
"pageSize": "${perPage}",
|
|
71
|
+
"query": "{options:objects(filters: {__filters}, top: {__top}, sort: \"{__sort}\"){_id label:label value:name},count:objects__count(filters:{__filters}),defaultValueOptions:objects(filters:{__options_filters}){_id label:label value:name}}",
|
|
72
|
+
"$term": "$term",
|
|
73
|
+
"$value": "$object_name",
|
|
74
|
+
"$": "$$",
|
|
75
|
+
"rfield": "${object_name}"
|
|
76
|
+
},
|
|
77
|
+
"headers": {
|
|
78
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
79
|
+
},
|
|
80
|
+
"adaptor": "\n const data = payload.data;\n var defaultValueOptions = data.defaultValueOptions;\n // 字段值下拉选项合并到options中\n data.options = _.unionWith(defaultValueOptions, data.options, function(a,b){\n return a[\"value\"]=== b[\"value\"];\n });\n delete data.defaultValueOptions;\n payload.data.options = data.options;\n return payload;\n ",
|
|
81
|
+
"requestAdaptor": "\n var filters = [];\n var top = 10;\n if(api.data.$term){\n filters = [[\"label\", \"contains\", api.data.$term]];\n }\n // else if(api.data.$value){\n // filters = [[\"_id\", \"=\", api.data.$value]];\n // }\n\n var fieldFilters = undefined;\n if(fieldFilters && fieldFilters.length){\n filters.push(fieldFilters);\n }\n\n const filtersFunction = undefined;\n\n if(filtersFunction){\n const _filters = filtersFunction(filters, api.data.$);\n if(_filters && _filters.length > 0){\n filters.push(_filters);\n }\n }\n var sort = \"\";\n api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', top).replace('{__sort}', sort.trim());\n\n var defaultValue = api.data.$value;\n var optionsFiltersOp = \"=\";\n var optionsFilters = [[\"name\", optionsFiltersOp, []]];\n if (defaultValue && !api.data.$term) { \n // 字段值单独请求,没值的时候在请求中返回空\n optionsFilters = [[\"name\", optionsFiltersOp, defaultValue]];\n }\n api.data.query = api.data.query.replace(/{__options_filters}/g, JSON.stringify(optionsFilters));\n return api;\n "
|
|
82
|
+
},
|
|
83
|
+
"className": "m-1",
|
|
84
|
+
"labelClassName": "text-left",
|
|
85
|
+
"clearValueOnHidden": true,
|
|
86
|
+
"fieldName": "object_name",
|
|
87
|
+
"id": "u:0f2e40f882e2"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "target_object",
|
|
91
|
+
"label": "要更新的对象",
|
|
92
|
+
"required": false,
|
|
93
|
+
"type": "select",
|
|
94
|
+
"joinValues": false,
|
|
95
|
+
"extractValue": true,
|
|
96
|
+
"searchable": true,
|
|
97
|
+
"source": {
|
|
98
|
+
"method": "get",
|
|
99
|
+
"url": "${context.rootUrl}/service/api/action_field_updates/target_object/options?objectName=${object_name}"
|
|
100
|
+
},
|
|
101
|
+
"className": "m-1",
|
|
102
|
+
"labelClassName": "text-left",
|
|
103
|
+
"clearValueOnHidden": true,
|
|
104
|
+
"fieldName": "target_object",
|
|
105
|
+
"id": "u:dd1c95753238"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"name": "field_name",
|
|
109
|
+
"label": "要更新的字段",
|
|
110
|
+
"required": false,
|
|
111
|
+
"type": "select",
|
|
112
|
+
"joinValues": false,
|
|
113
|
+
"extractValue": true,
|
|
114
|
+
"searchable": true,
|
|
115
|
+
"source": {
|
|
116
|
+
"method": "get",
|
|
117
|
+
"url": "${context.rootUrl}/service/api/action_field_updates/field_name/options?objectName=${object_name}&targetObject=${target_object}"
|
|
118
|
+
},
|
|
119
|
+
"className": "m-1",
|
|
120
|
+
"labelClassName": "text-left",
|
|
121
|
+
"clearValueOnHidden": true,
|
|
122
|
+
"fieldName": "field_name",
|
|
123
|
+
"id": "u:204fadb7cef0"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"name": "operation",
|
|
127
|
+
"label": "新字段值类型",
|
|
128
|
+
"required": false,
|
|
129
|
+
"type": "select",
|
|
130
|
+
"joinValues": false,
|
|
131
|
+
"extractValue": true,
|
|
132
|
+
"source": {
|
|
133
|
+
"method": "get",
|
|
134
|
+
"url": "${context.rootUrl}/service/api/action_field_updates/operation/options?objectName=${object_name}&targetObject=${target_object}&fieldName=${field_name}"
|
|
135
|
+
},
|
|
136
|
+
"className": "m-1",
|
|
137
|
+
"labelClassName": "text-left",
|
|
138
|
+
"clearValueOnHidden": true,
|
|
139
|
+
"fieldName": "operation",
|
|
140
|
+
"id": "u:627e520855b5",
|
|
141
|
+
"multiple": false
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"name": "formula",
|
|
145
|
+
"label": "公式",
|
|
146
|
+
"required": false,
|
|
147
|
+
"type": "textarea",
|
|
148
|
+
"tpl": "<b><%=data.formula%></b>",
|
|
149
|
+
"className": "col-span-2 m-1",
|
|
150
|
+
"labelClassName": "text-left",
|
|
151
|
+
"clearValueOnHidden": true,
|
|
152
|
+
"fieldName": "formula",
|
|
153
|
+
"id": "u:20766a86a9f4",
|
|
154
|
+
"hiddenOn": "this.operation != 'formula'"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"type": "service",
|
|
158
|
+
"id": "u:d201a629c160",
|
|
159
|
+
"body": [],
|
|
160
|
+
"messages": {},
|
|
161
|
+
"schemaApi": {
|
|
162
|
+
"method": "get",
|
|
163
|
+
"url": "${context.rootUrl}/service/api/action_field_updates/literal_value/options?objectName=${object_name}&targetObject=${target_object}&fieldName=${field_name}&operation=${operation}",
|
|
164
|
+
"data": {
|
|
165
|
+
"&": "$$"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"name": "description",
|
|
171
|
+
"label": "描述",
|
|
172
|
+
"required": false,
|
|
173
|
+
"type": "textarea",
|
|
174
|
+
"tpl": "<b><%=data.description%></b>",
|
|
175
|
+
"className": "col-span-2 m-1",
|
|
176
|
+
"labelClassName": "text-left",
|
|
177
|
+
"clearValueOnHidden": true,
|
|
178
|
+
"fieldName": "description",
|
|
179
|
+
"id": "u:16a7ebd835a6"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"name": "reevaluate_on_change",
|
|
183
|
+
"label": "字段更改后重新评估工作流规则",
|
|
184
|
+
"required": false,
|
|
185
|
+
"type": "checkbox",
|
|
186
|
+
"tpl": null,
|
|
187
|
+
"className": "m-1",
|
|
188
|
+
"labelClassName": "text-left",
|
|
189
|
+
"clearValueOnHidden": true,
|
|
190
|
+
"fieldName": "reevaluate_on_change",
|
|
191
|
+
"id": "u:b9baf683b6b0"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"name": "undirect",
|
|
195
|
+
"label": "触发对象触发器、工作流规则、字段验证规则",
|
|
196
|
+
"required": false,
|
|
197
|
+
"type": "checkbox",
|
|
198
|
+
"tpl": null,
|
|
199
|
+
"className": "m-1",
|
|
200
|
+
"labelClassName": "text-left",
|
|
201
|
+
"clearValueOnHidden": true,
|
|
202
|
+
"fieldName": "undirect",
|
|
203
|
+
"id": "u:b86f699bbe4f"
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
],
|
|
208
|
+
"id": "u:f57077c2a95f",
|
|
209
|
+
"mode": "horizontal",
|
|
210
|
+
"persistData": false,
|
|
211
|
+
"promptPageLeave": true,
|
|
212
|
+
"name": "form_edit_${recordId}",
|
|
213
|
+
"debug": false,
|
|
214
|
+
"submitText": "",
|
|
215
|
+
"api": {
|
|
216
|
+
"method": "post",
|
|
217
|
+
"url": "${context.rootUrl}/graphql",
|
|
218
|
+
"data": {
|
|
219
|
+
"objectName": "${objectName}",
|
|
220
|
+
"$": "$$",
|
|
221
|
+
"recordId": "${recordId}",
|
|
222
|
+
"modalName": "${modalName}"
|
|
223
|
+
},
|
|
224
|
+
"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 ",
|
|
225
|
+
"responseData": {
|
|
226
|
+
"recordId": "${record._id}"
|
|
227
|
+
},
|
|
228
|
+
"adaptor": "\n if(payload.errors){\n payload.status = 2;\n payload.msg = payload.errors[0].message;\n }\n return payload;\n ",
|
|
229
|
+
"headers": {
|
|
230
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
"initFetch": true,
|
|
234
|
+
"panelClassName": "m-0 sm:rounded-lg shadow-none",
|
|
235
|
+
"bodyClassName": "p-0",
|
|
236
|
+
"className": "steedos-amis-form",
|
|
237
|
+
"onEvent": {
|
|
238
|
+
"submitSucc": {
|
|
239
|
+
"weight": 0,
|
|
240
|
+
"actions": [
|
|
241
|
+
{
|
|
242
|
+
"componentId": "listview_action_field_updates",
|
|
243
|
+
"actionType": "reload",
|
|
244
|
+
"expression": "!!listViewId"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"actionType": "custom",
|
|
248
|
+
"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._isRelated;\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 "
|
|
249
|
+
}
|
|
250
|
+
]
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
],
|
|
255
|
+
"initApi": null
|
|
256
|
+
}
|
|
257
|
+
],
|
|
258
|
+
"data": {
|
|
259
|
+
"objectName": "action_field_updates",
|
|
260
|
+
"context": {}
|
|
261
|
+
},
|
|
262
|
+
"regions": [
|
|
263
|
+
"body"
|
|
264
|
+
],
|
|
265
|
+
"bodyClassName": ""
|
|
266
|
+
}
|
|
@@ -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
|
|
@@ -381,7 +391,7 @@
|
|
|
381
391
|
{
|
|
382
392
|
"name": "url",
|
|
383
393
|
"label": "外部链接",
|
|
384
|
-
"type": "input-
|
|
394
|
+
"type": "input-text",
|
|
385
395
|
"className": "m-0",
|
|
386
396
|
"labelClassName": "text-left",
|
|
387
397
|
"id": "u:d7116a113670"
|
|
@@ -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
|
}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"requestAdaptor": "const formData = api.data.$;\napi.data = { objects: formData.objects };\nreturn api;",
|
|
22
22
|
"responseData": null,
|
|
23
|
-
"adaptor": "\nif (api.body.objectName === \"tabs\") {\n // 在tabs列表操作”对象选项卡“按钮,保存后需要刷新主列表\n
|
|
23
|
+
"adaptor": "\nif (api.body.objectName === \"tabs\") {\n // 在tabs列表操作”对象选项卡“按钮,保存后需要刷新主列表\n}\nreturn payload;\n ",
|
|
24
24
|
"headers": {
|
|
25
25
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
26
26
|
}
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"actions": [
|
|
64
64
|
{
|
|
65
65
|
"actionType": "custom",
|
|
66
|
-
"script": "const result = event.data.result;\nconst doneCount = result.data && result.data.doneCount || 0;\nconst myMsg = '已成功生成' + doneCount.toString() + \"条选项卡!\";\ndoAction({\n actionType: 'toast',\n args: {\n msg: myMsg,\n msgType: \"success\"\n }\n});\nconst errors = result.data && result.data.errors || [];\nif (errors && errors.length) { \n console.warn(\"以下对象未能生成选项卡:\");\n console.warn(JSON.stringify(errors));\n}\nconst
|
|
66
|
+
"script": "const result = event.data.result;\nconst doneCount = result.data && result.data.doneCount || 0;\nconst myMsg = '已成功生成' + doneCount.toString() + \"条选项卡!\";\ndoAction({\n actionType: 'toast',\n args: {\n msg: myMsg,\n msgType: \"success\"\n }\n});\nconst errors = result.data && result.data.errors || [];\nif (errors && errors.length) { \n console.warn(\"以下对象未能生成选项卡:\");\n console.warn(JSON.stringify(errors));\n}\nconst objectName = event.data.objectName;\nif (objectName === \"apps\") {\n // 在应用表单中生成选项卡后需要触发选项卡列表组件reload重新刷新列表\n doAction({\n actionType: 'reload',\n componentId: \"tabs-options-service\"\n });\n}\nelse {\n // 刷新主列表\n doAction({\n actionType: 'reload',\n componentId: `listview_${objectName}`\n });\n}"
|
|
67
67
|
}
|
|
68
68
|
]
|
|
69
69
|
}
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
],
|
|
76
76
|
"data": {
|
|
77
77
|
"context": {
|
|
78
|
+
"rootUrl": "http://127.0.0.1:5800"
|
|
78
79
|
}
|
|
79
80
|
},
|
|
80
81
|
"id": "u:3b0de7e88def",
|
|
@@ -31,11 +31,12 @@
|
|
|
31
31
|
"method": "post",
|
|
32
32
|
"url": "${context.rootUrl}/graphql?rf=1653731141728",
|
|
33
33
|
"cache": 100,
|
|
34
|
-
"adaptor": "
|
|
34
|
+
"adaptor": "const recordId = api.body.recordId;\nvar data;\nif (recordId) {\n console.log('recordId==>', recordId)\n data = payload.data.data[0] || { _filters_type_controller: 'conditions' };\n //数据格式转换\n if (data) {\n data.columns = lodash.map(data.columns, 'field');\n data.sort = lodash.map(data.sort, (item) => {\n return `${item.field_name}:${item.order || 'asc'}`\n });\n data.mobile_columns = lodash.map(data.mobile_columns, 'field');\n data.searchable_fields = lodash.map(data.searchable_fields, 'field');\n\n if (data.filters && lodash.isString(data.filters)) {\n try {\n data.filters = JSON.parse(data.filters);\n } catch (e) { }\n }\n\n if (data.filters && lodash.isString(data.filters)) {\n data._filters_type_controller = 'function';\n } else {\n data._filters_type_controller = 'conditions'\n }\n\n if (data._filters_type_controller === 'conditions') {\n data._filters_conditions = window.amisConvert.filtersToConditions(data.filters || []);\n } else {\n data._filters_function = data.filters;\n }\n }\n} else {\n const defaultData = api.body.defaultData;\n let defaultValues = {};\n // TODO:字段默认值后期添加\n if(defaultData && _.isObject(defaultData) && !_.isArray(defaultData)){\n data = Object.assign({}, defaultValues, defaultData)\n }\n}\nfor (key in data) {\n if (data[key] === null) {\n delete data[key];\n }\n}\npayload.data = data;\ndelete payload.extensions;\nreturn payload;",
|
|
35
35
|
"data": {
|
|
36
|
-
"
|
|
36
|
+
"recordId": "${recordId}",
|
|
37
|
+
"defaultData": "${defaultData}",
|
|
38
|
+
"query": "{data:object_listviews(filters:[\"_id\", \"=\", \"${recordId}\"]){_id,label,name,object_name,requestAdaptor,adaptor,filter_scope,shared,show_count,columns,filter_fields,sort,filters,filter_logic,mobile_columns,searchable_fields,sort_no,created,created_by:created_by__expand{_id,name},modified,modified_by:modified_by__expand{_id,name},enable_amis_schema,amis_schema,_display{shared,show_count,created,modified}}}"
|
|
37
39
|
},
|
|
38
|
-
"sendOn": "!!this.recordId",
|
|
39
40
|
"replaceData": false,
|
|
40
41
|
"responseData": {
|
|
41
42
|
"&": "$$"
|
|
@@ -298,7 +299,7 @@
|
|
|
298
299
|
"label": "js脚本",
|
|
299
300
|
"name": "_filters_function",
|
|
300
301
|
"id": "u:84714ec9abba",
|
|
301
|
-
"visibleOn": "!!this.object_name && _filters_type_controller == 'function'",
|
|
302
|
+
"visibleOn": "!!this.object_name && !!this._filters_type_controller && _filters_type_controller== 'function'",
|
|
302
303
|
"className": "col-span-2 m-0",
|
|
303
304
|
"labelClassName": "hidden"
|
|
304
305
|
}
|
|
@@ -442,6 +443,39 @@
|
|
|
442
443
|
"title": "searchable"
|
|
443
444
|
}
|
|
444
445
|
},
|
|
446
|
+
{
|
|
447
|
+
"type": "fieldSet",
|
|
448
|
+
"title": "数据接口",
|
|
449
|
+
"description": "获取列表数据的 api",
|
|
450
|
+
"collapsable": true,
|
|
451
|
+
"body": [
|
|
452
|
+
{
|
|
453
|
+
"type": "editor",
|
|
454
|
+
"name": "requestAdaptor",
|
|
455
|
+
"label": "发送适配器",
|
|
456
|
+
"required": false,
|
|
457
|
+
"language": "javascript",
|
|
458
|
+
"description": "函数签名:(api) => api, 数据在 api.data 中,修改后返回 api 对象。",
|
|
459
|
+
"className": "col-span-2 m-1",
|
|
460
|
+
"labelClassName": "text-left"
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
"type": "editor",
|
|
464
|
+
"name": "adaptor",
|
|
465
|
+
"label": "接收适配器",
|
|
466
|
+
"required": false,
|
|
467
|
+
"language": "javascript",
|
|
468
|
+
"description": "函数签名: (payload, response, api) => payload",
|
|
469
|
+
"className": "col-span-2 m-1",
|
|
470
|
+
"labelClassName": "text-left"
|
|
471
|
+
}
|
|
472
|
+
],
|
|
473
|
+
"collapsed": true,
|
|
474
|
+
"visibleOn": "!!this.object_name",
|
|
475
|
+
"en-US": {
|
|
476
|
+
"title": "API"
|
|
477
|
+
}
|
|
478
|
+
},
|
|
445
479
|
{
|
|
446
480
|
"type": "fieldSet",
|
|
447
481
|
"title": "高级",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"recordId": "${recordId}",
|
|
18
18
|
"modalName": "${modalName}"
|
|
19
19
|
},
|
|
20
|
-
"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.sort_order_options;\n delete formData.buttons_options;\n delete formData.fields_options;\n delete formData.field_groups_options;\n delete formData.related_lists_options;\n delete formData.related_object_fields_options;\n\n let query = `mutation{record: ${objectName}__insert(doc: {__saveData}){_id}}`;\n if(formData.recordId){\n query = `mutation{record: ${objectName}__update(id: \"${formData.recordId}\", 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 ",
|
|
20
|
+
"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.sort_order_options;\n delete formData.buttons_options;\n delete formData.fields_options;\n delete formData.field_groups_options;\n delete formData.related_lists_options;\n delete formData.related_object_fields_options;\n delete formData.isLookup;\n\n let query = `mutation{record: ${objectName}__insert(doc: {__saveData}){_id}}`;\n if(formData.recordId){\n query = `mutation{record: ${objectName}__update(id: \"${formData.recordId}\", 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 ",
|
|
21
21
|
"responseData": {
|
|
22
22
|
"recordId": "${record._id}"
|
|
23
23
|
},
|
|
@@ -29,10 +29,11 @@
|
|
|
29
29
|
"initApi": {
|
|
30
30
|
"method": "post",
|
|
31
31
|
"url": "${context.rootUrl}/graphql",
|
|
32
|
-
"sendOn": "!!this.recordId",
|
|
33
32
|
"cache": 100,
|
|
34
|
-
"adaptor": "
|
|
33
|
+
"adaptor": "const recordId = api.body.recordId;\nvar data;\nif (recordId) {\n data = payload.data.data[0];\n if (data) {\n data.object_name = data.object_name ? data.object_name.name : null;\n }\n}else{\n const defaultData = api.body.defaultData;\n let defaultValues = {};\n // TODO:字段默认值后期添加\n if (defaultData && _.isObject(defaultData) && !_.isArray(defaultData)) {\n data = Object.assign({}, defaultValues, defaultData)\n }\n}\n\n//初始化接口返回的字段移除字段值为null的字段\nfor (key in data){\n if(data[key] === null){\n delete data[key];\n }\n}\n\npayload.data = data;\ndelete payload.extensions;\nreturn payload;\n",
|
|
35
34
|
"data": {
|
|
35
|
+
"recordId": "${recordId}",
|
|
36
|
+
"defaultData": "${defaultData}",
|
|
36
37
|
"query": "{data:object_layouts(filters:[\"_id\", \"=\", \"${recordId}\"]){_id,name,label,object_name:object_name__expand{name,label},profiles,buttons,fields,related_lists,field_groups,created,created_by:created_by__expand{_id,name},modified,modified_by:modified_by__expand{_id,name},_display{created,modified}}}"
|
|
37
38
|
},
|
|
38
39
|
"headers": {
|
|
@@ -88,7 +89,7 @@
|
|
|
88
89
|
"id": "u:4e769995f638",
|
|
89
90
|
"source": {
|
|
90
91
|
"method": "get",
|
|
91
|
-
"url": "/service/api/amis-metadata-objects/objects/options",
|
|
92
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/options",
|
|
92
93
|
"headers": {
|
|
93
94
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
94
95
|
}
|
|
@@ -228,7 +229,8 @@
|
|
|
228
229
|
"id": "u:a0027ac6f8c1",
|
|
229
230
|
"closeOnEsc": false,
|
|
230
231
|
"closeOnOutside": false,
|
|
231
|
-
"showCloseButton": true
|
|
232
|
+
"showCloseButton": true,
|
|
233
|
+
"size": "md"
|
|
232
234
|
},
|
|
233
235
|
"label": "设置按钮",
|
|
234
236
|
"id": "u:1ac8afc8a9bb"
|
|
@@ -241,7 +243,7 @@
|
|
|
241
243
|
"id": "u:bef2e378d96f",
|
|
242
244
|
"api": {
|
|
243
245
|
"method": "get",
|
|
244
|
-
"url": "/service/api/amis-metadata-objects/objects/${object_name}/actions/options",
|
|
246
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/actions/options",
|
|
245
247
|
"adaptor": "let data = payload.data;\ndata.buttons_options = data.options;\ndelete data.options\npayload.data = data;\nreturn payload;\n",
|
|
246
248
|
"sendOn": "!!this.object_name",
|
|
247
249
|
"headers": {
|
|
@@ -496,7 +498,7 @@
|
|
|
496
498
|
"affixFooter": false,
|
|
497
499
|
"api": {
|
|
498
500
|
"method": "get",
|
|
499
|
-
"url": "/service/api/amis-metadata-objects/objects/${object_name}/fields/layout_options",
|
|
501
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/layout_options",
|
|
500
502
|
"adaptor": "let data = payload.data;\ndata.fields_options = data.options;\ndata.field_groups_options = lodash.uniq(lodash.compact(lodash.map(data.options, \"group\"))) || [];\ndelete data.options\npayload.data = data;\nreturn payload;\n",
|
|
501
503
|
"sendOn": "!!this.object_name",
|
|
502
504
|
"data": null,
|
|
@@ -536,7 +538,7 @@
|
|
|
536
538
|
"id": "u:dbadaff47153",
|
|
537
539
|
"api": {
|
|
538
540
|
"method": "get",
|
|
539
|
-
"url": "/service/api/amis-metadata-objects/objects/${object_name}/relatedLists/options",
|
|
541
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/relatedLists/options",
|
|
540
542
|
"sendOn": "!!this.object_name",
|
|
541
543
|
"adaptor": "let data = payload.data;\ndata.related_lists_options = data.options;\ndelete data.options\npayload.data = data;\nreturn payload;\n",
|
|
542
544
|
"headers": {
|
|
@@ -700,7 +702,9 @@
|
|
|
700
702
|
"name": "filters",
|
|
701
703
|
"label": "过滤规则",
|
|
702
704
|
"quickEdit": {
|
|
703
|
-
"type": "
|
|
705
|
+
"type": "editor",
|
|
706
|
+
"language": "javascript",
|
|
707
|
+
"description": "函数签名:(filters, data) => 自定义过滤条件, 数据在 data 中,修改后返回 自定义过滤条件",
|
|
704
708
|
"tpl": "<b><%=data.filters%></b>",
|
|
705
709
|
"className": "col-span-2 m-0",
|
|
706
710
|
"labelClassName": "text-left",
|
|
@@ -836,24 +840,7 @@
|
|
|
836
840
|
],
|
|
837
841
|
"panelClassName": "m-0 -mt-3",
|
|
838
842
|
"bodyClassName": "p-4",
|
|
839
|
-
"actions": [
|
|
840
|
-
{
|
|
841
|
-
"type": "button",
|
|
842
|
-
"label": "取消",
|
|
843
|
-
"actionType": "",
|
|
844
|
-
"level": "default",
|
|
845
|
-
"block": false,
|
|
846
|
-
"onClick": "SteedosUI.getRef(props.data.__super.modalName).close();",
|
|
847
|
-
"id": "u:bf2587b53d64"
|
|
848
|
-
},
|
|
849
|
-
{
|
|
850
|
-
"type": "button",
|
|
851
|
-
"label": "保存",
|
|
852
|
-
"actionType": "submit",
|
|
853
|
-
"level": "info",
|
|
854
|
-
"id": "u:08afd6e53cab"
|
|
855
|
-
}
|
|
856
|
-
],
|
|
843
|
+
"actions": [],
|
|
857
844
|
"actionsClassName": "p-sm b-t b-light text-center",
|
|
858
845
|
"className": "steedos-amis-form",
|
|
859
846
|
"checkAll": false,
|
|
@@ -302,9 +302,10 @@ module.exports = {
|
|
|
302
302
|
actionsArr.push(action)
|
|
303
303
|
})
|
|
304
304
|
return _.uniq(_.compact(_.map(_.sortBy(actionsArr, "sort"), (action)=>{
|
|
305
|
+
const label = action.label || action.name
|
|
305
306
|
return {
|
|
306
307
|
value: action.name,
|
|
307
|
-
label:
|
|
308
|
+
label: `${label}(${action.name})`
|
|
308
309
|
}
|
|
309
310
|
})));
|
|
310
311
|
}
|
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.40",
|
|
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.22"
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "19fb1590a63241875e23e7b83217e09bdc52162e",
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"tailwindcss": "3.2.4"
|
|
22
|
+
}
|
|
20
23
|
}
|
package/public/amis/amis.css
CHANGED
|
@@ -6,17 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
.page-template-root{
|
|
8
8
|
height: 100%;
|
|
9
|
-
background: #ffffff;
|
|
10
9
|
}
|
|
11
10
|
/* .amis-scope svg {
|
|
12
11
|
display: inline !important;
|
|
13
12
|
vertical-align: initial !important;
|
|
14
13
|
} */
|
|
15
14
|
|
|
16
|
-
body{
|
|
17
|
-
-webkit-font-smoothing: inherit !important;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
15
|
/* .row-main{
|
|
21
16
|
border-radius: 0.25rem
|
|
22
17
|
} */
|
|
@@ -52,15 +47,6 @@ body{
|
|
|
52
47
|
min-width: 100px;
|
|
53
48
|
}
|
|
54
49
|
|
|
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
50
|
|
|
65
51
|
/* fix checkbox 隐藏时导致滚动条异常 */
|
|
66
52
|
.steedos-amis-form .antd-Collapse .antd-Form--normal .antd-Checkbox input{
|
|
@@ -76,10 +62,6 @@ body{
|
|
|
76
62
|
border-bottom: none;
|
|
77
63
|
}
|
|
78
64
|
|
|
79
|
-
.steedos-amis-form .antd-Collapse .antd-Form--normal{
|
|
80
|
-
grid-template-columns: none !important;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
65
|
.ant-modal-root .amis-scope .antd-Panel-footerWrap{
|
|
84
66
|
position: fixed;
|
|
85
67
|
}
|
|
@@ -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,26 @@ 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 .m-
|
|
93
|
-
margin: 0.
|
|
92
|
+
body.steedos .m-3 {
|
|
93
|
+
margin: 0.75rem
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
body.steedos .mx-4 {
|
|
97
|
+
margin-left: 1rem;
|
|
98
|
+
margin-right: 1rem
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
body.steedos .my-2 {
|
|
102
|
+
margin-top: 0.5rem;
|
|
103
|
+
margin-bottom: 0.5rem
|
|
94
104
|
}
|
|
95
105
|
|
|
96
106
|
body.steedos .mr-4 {
|
|
@@ -117,6 +127,10 @@ body.steedos .-mt-3 {
|
|
|
117
127
|
margin-top: -0.75rem
|
|
118
128
|
}
|
|
119
129
|
|
|
130
|
+
body.steedos .mt-3 {
|
|
131
|
+
margin-top: 0.75rem
|
|
132
|
+
}
|
|
133
|
+
|
|
120
134
|
body.steedos .block {
|
|
121
135
|
display: block
|
|
122
136
|
}
|
|
@@ -145,22 +159,18 @@ body.steedos .hidden {
|
|
|
145
159
|
display: none
|
|
146
160
|
}
|
|
147
161
|
|
|
148
|
-
body.steedos .h
|
|
149
|
-
height:
|
|
162
|
+
body.steedos .h-full {
|
|
163
|
+
height: 100%
|
|
150
164
|
}
|
|
151
165
|
|
|
152
|
-
body.steedos .h
|
|
153
|
-
height:
|
|
166
|
+
body.steedos .h-\[50px\] {
|
|
167
|
+
height: 50px
|
|
154
168
|
}
|
|
155
169
|
|
|
156
170
|
body.steedos .h-10 {
|
|
157
171
|
height: 2.5rem
|
|
158
172
|
}
|
|
159
173
|
|
|
160
|
-
body.steedos .h-full {
|
|
161
|
-
height: 100%
|
|
162
|
-
}
|
|
163
|
-
|
|
164
174
|
body.steedos .w-full {
|
|
165
175
|
width: 100%
|
|
166
176
|
}
|
|
@@ -186,20 +196,16 @@ body.steedos .min-w-max {
|
|
|
186
196
|
min-width: max-content
|
|
187
197
|
}
|
|
188
198
|
|
|
189
|
-
body.steedos .flex-1 {
|
|
190
|
-
flex: 1 1 0%
|
|
191
|
-
}
|
|
192
|
-
|
|
193
199
|
body.steedos .flex-none {
|
|
194
200
|
flex: none
|
|
195
201
|
}
|
|
196
202
|
|
|
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))
|
|
203
|
+
body.steedos .flex-1 {
|
|
204
|
+
flex: 1 1 0%
|
|
200
205
|
}
|
|
201
206
|
|
|
202
|
-
body.steedos
|
|
207
|
+
body.steedos .-translate-x-0 {
|
|
208
|
+
--tw-translate-x: -0px;
|
|
203
209
|
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
210
|
}
|
|
205
211
|
|
|
@@ -228,6 +234,10 @@ body.steedos .gap-x-3 {
|
|
|
228
234
|
column-gap: 0.75rem
|
|
229
235
|
}
|
|
230
236
|
|
|
237
|
+
body.steedos .overflow-hidden {
|
|
238
|
+
overflow: hidden
|
|
239
|
+
}
|
|
240
|
+
|
|
231
241
|
body.steedos .overflow-y-auto {
|
|
232
242
|
overflow-y: auto
|
|
233
243
|
}
|
|
@@ -240,13 +250,12 @@ body.steedos .border-r {
|
|
|
240
250
|
border-right-width: 1px
|
|
241
251
|
}
|
|
242
252
|
|
|
243
|
-
body.steedos .border-
|
|
244
|
-
border-
|
|
253
|
+
body.steedos .border-b {
|
|
254
|
+
border-bottom-width: 1px
|
|
245
255
|
}
|
|
246
256
|
|
|
247
|
-
body.steedos .border-
|
|
248
|
-
|
|
249
|
-
border-color: rgb(203 213 225 / var(--tw-border-opacity))
|
|
257
|
+
body.steedos .border-solid {
|
|
258
|
+
border-style: solid
|
|
250
259
|
}
|
|
251
260
|
|
|
252
261
|
body.steedos .border-sky-500 {
|
|
@@ -259,6 +268,11 @@ body.steedos .border-slate-200 {
|
|
|
259
268
|
border-color: rgb(226 232 240 / var(--tw-border-opacity))
|
|
260
269
|
}
|
|
261
270
|
|
|
271
|
+
body.steedos .border-slate-300 {
|
|
272
|
+
--tw-border-opacity: 1;
|
|
273
|
+
border-color: rgb(203 213 225 / var(--tw-border-opacity))
|
|
274
|
+
}
|
|
275
|
+
|
|
262
276
|
body.steedos .bg-white {
|
|
263
277
|
--tw-bg-opacity: 1;
|
|
264
278
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity))
|
|
@@ -268,10 +282,6 @@ body.steedos .p-0 {
|
|
|
268
282
|
padding: 0px
|
|
269
283
|
}
|
|
270
284
|
|
|
271
|
-
body.steedos .p-3 {
|
|
272
|
-
padding: 0.75rem
|
|
273
|
-
}
|
|
274
|
-
|
|
275
285
|
body.steedos .p-4 {
|
|
276
286
|
padding: 1rem
|
|
277
287
|
}
|
|
@@ -281,6 +291,21 @@ body.steedos .px-4 {
|
|
|
281
291
|
padding-right: 1rem
|
|
282
292
|
}
|
|
283
293
|
|
|
294
|
+
body.steedos .px-0 {
|
|
295
|
+
padding-left: 0px;
|
|
296
|
+
padding-right: 0px
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
body.steedos .px-1 {
|
|
300
|
+
padding-left: 0.25rem;
|
|
301
|
+
padding-right: 0.25rem
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
body.steedos .py-3 {
|
|
305
|
+
padding-top: 0.75rem;
|
|
306
|
+
padding-bottom: 0.75rem
|
|
307
|
+
}
|
|
308
|
+
|
|
284
309
|
body.steedos .px-10 {
|
|
285
310
|
padding-left: 2.5rem;
|
|
286
311
|
padding-right: 2.5rem
|
|
@@ -291,6 +316,10 @@ body.steedos .py-2 {
|
|
|
291
316
|
padding-bottom: 0.5rem
|
|
292
317
|
}
|
|
293
318
|
|
|
319
|
+
body.steedos .pr-4 {
|
|
320
|
+
padding-right: 1rem
|
|
321
|
+
}
|
|
322
|
+
|
|
294
323
|
body.steedos .pl-4 {
|
|
295
324
|
padding-left: 1rem
|
|
296
325
|
}
|
|
@@ -299,8 +328,16 @@ body.steedos .pb-0 {
|
|
|
299
328
|
padding-bottom: 0px
|
|
300
329
|
}
|
|
301
330
|
|
|
302
|
-
body.steedos .pt-
|
|
303
|
-
padding-top:
|
|
331
|
+
body.steedos .pt-4 {
|
|
332
|
+
padding-top: 1rem
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
body.steedos .pb-16 {
|
|
336
|
+
padding-bottom: 4rem
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
body.steedos .pb-4 {
|
|
340
|
+
padding-bottom: 1rem
|
|
304
341
|
}
|
|
305
342
|
|
|
306
343
|
body.steedos .pl-1\.5 {
|
|
@@ -344,6 +381,12 @@ body.steedos .underline {
|
|
|
344
381
|
text-decoration-line: underline
|
|
345
382
|
}
|
|
346
383
|
|
|
384
|
+
body.steedos .shadow-none {
|
|
385
|
+
--tw-shadow: 0 0 #0000;
|
|
386
|
+
--tw-shadow-colored: 0 0 #0000;
|
|
387
|
+
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
|
|
388
|
+
}
|
|
389
|
+
|
|
347
390
|
body.steedos .filter {
|
|
348
391
|
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)
|
|
349
392
|
}
|
|
@@ -373,18 +416,18 @@ body.steedos .ease-in-out {
|
|
|
373
416
|
}
|
|
374
417
|
|
|
375
418
|
@media (min-width: 640px) {
|
|
376
|
-
body.steedos .sm\:
|
|
377
|
-
margin:
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
body.steedos .sm\:flex {
|
|
381
|
-
display: flex
|
|
419
|
+
body.steedos .sm\:mt-\[90px\] {
|
|
420
|
+
margin-top: 90px
|
|
382
421
|
}
|
|
383
422
|
|
|
384
423
|
body.steedos .sm\:w-\[220px\] {
|
|
385
424
|
width: 220px
|
|
386
425
|
}
|
|
387
426
|
|
|
427
|
+
body.steedos .sm\:rounded-lg {
|
|
428
|
+
border-radius: 0.5rem
|
|
429
|
+
}
|
|
430
|
+
|
|
388
431
|
body.steedos .sm\:rounded {
|
|
389
432
|
border-radius: 0.25rem
|
|
390
433
|
}
|
|
@@ -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": "删除组",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: baozhoutao@steedos.com
|
|
3
|
-
* @Date: 2022-12-09 18:23:36
|
|
4
|
-
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
-
* @LastEditTime: 2022-12-17 14:35:49
|
|
6
|
-
* @Description:
|
|
7
|
-
*/
|
|
8
|
-
// 解决多个react 问题. 注册组件时, 使用 amis 自带的 react , 运行 steedos 相关组件时, 使用 全局 react
|
|
9
|
-
window.addEventListener('message', function (event) {
|
|
10
|
-
const { data } = event;
|
|
11
|
-
if (data.type === 'Builder.loaded') {
|
|
12
|
-
if(Meteor.settings.public.page && Meteor.settings.public.page.assetUrls){
|
|
13
|
-
const defaultAssetsUrls = Meteor.settings.public.page.assetUrls.split(',')
|
|
14
|
-
Promise.all([
|
|
15
|
-
waitForThing(window, 'amis'),
|
|
16
|
-
]).then(()=>{
|
|
17
|
-
// window.__React = window.React;
|
|
18
|
-
// window.__ReactDOM = window.ReactDOM;
|
|
19
|
-
window.React = amisRequire('react');
|
|
20
|
-
window.ReactDOM = amisRequire('react-dom');
|
|
21
|
-
window.ReactDom = window.ReactDOM;
|
|
22
|
-
Builder.registerRemoteAssets(defaultAssetsUrls);
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
})
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
(function () {
|
|
2
|
-
try {
|
|
3
|
-
var styleCss = $(`<style>
|
|
4
|
-
.steedos .creator-content-wrapper .steedos-page .page-header-wrapper{
|
|
5
|
-
display: none;
|
|
6
|
-
}
|
|
7
|
-
.ant-modal.absolute .ant-modal-content{
|
|
8
|
-
/*使用绝对定位显示弹出窗口时,内层content最大高度不用限制*/
|
|
9
|
-
max-height: unset;
|
|
10
|
-
}
|
|
11
|
-
.page-form-object_layouts .steedos-amis-form .antd-Collapse .antd-Table-table .antd-Form--normal{
|
|
12
|
-
/*格式内的单元格空白太多*/
|
|
13
|
-
display: block!important;
|
|
14
|
-
}
|
|
15
|
-
.page-form-object_layouts .antd-Table .antd-Field--quickEditable .antd-PlainField{
|
|
16
|
-
/*快速编辑只读状态时编辑按钮不应该换行显示*/
|
|
17
|
-
display: inline;
|
|
18
|
-
}
|
|
19
|
-
</style>`);
|
|
20
|
-
$("head").append(styleCss);
|
|
21
|
-
} catch (error) {
|
|
22
|
-
console.log(error);
|
|
23
|
-
}
|
|
24
|
-
})();
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
try {
|
|
2
|
-
// 加载 tailwind
|
|
3
|
-
// if(typeof BigInt === 'undefined') {
|
|
4
|
-
// let tailwindStyle = document.createElement("link");
|
|
5
|
-
// tailwindStyle.setAttribute("rel", "stylesheet");
|
|
6
|
-
// tailwindStyle.setAttribute("type", "text/css");
|
|
7
|
-
// tailwindStyle.setAttribute("href", Steedos.absoluteUrl("/tailwind/tailwind.css"));
|
|
8
|
-
// document.getElementsByTagName("head")[0].appendChild(tailwindStyle);
|
|
9
|
-
// }else{
|
|
10
|
-
// let tailwindScript = document.createElement("script");
|
|
11
|
-
// tailwindScript.setAttribute("src", Steedos.absoluteUrl('/tailwind/tailwind.js'));
|
|
12
|
-
// document.getElementsByTagName("head")[0].appendChild(tailwindScript);
|
|
13
|
-
// }
|
|
14
|
-
|
|
15
|
-
const head = document.head || document.getElementsByTagName('head')[0]
|
|
16
|
-
|
|
17
|
-
let tailwindBase = document.createElement("link");
|
|
18
|
-
tailwindBase.setAttribute("rel", "stylesheet");
|
|
19
|
-
tailwindBase.setAttribute("type", "text/css");
|
|
20
|
-
tailwindBase.setAttribute("href", Steedos.absoluteUrl("/tailwind/tailwind-base.css"));
|
|
21
|
-
|
|
22
|
-
if (head.firstChild) {
|
|
23
|
-
head.insertBefore(tailwindBase, head.firstChild)
|
|
24
|
-
} else {
|
|
25
|
-
head.appendChild(tailwindBase)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
let tailwindStyle = document.createElement("link");
|
|
29
|
-
tailwindStyle.setAttribute("rel", "stylesheet");
|
|
30
|
-
tailwindStyle.setAttribute("type", "text/css");
|
|
31
|
-
tailwindStyle.setAttribute("href", Steedos.absoluteUrl("/tailwind/tailwind-steedos.css"));
|
|
32
|
-
head.appendChild(tailwindStyle)
|
|
33
|
-
} catch (error) {
|
|
34
|
-
console.error(error)
|
|
35
|
-
};
|