@steedos/service-plugin-amis 3.0.0-beta.9 → 3.0.0-beta.92
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 +2 -44
- package/main/default/pages/action_field_updates_form.page.amis.json +11 -8
- package/main/default/pages/listview_form.page.amis.json +1 -12
- package/main/default/services/amis-design.service.js +2 -1
- package/main/default/services/metadata/listviews.service.js +7 -2
- package/main/default/services/utils/page-schema.js +3 -3
- package/package.json +2 -2
- package/public/tailwind/tailwind-steedos.css +16 -13
- package/main/default/pages/apps_form.page.amis.json +0 -336
- package/main/default/pages/apps_form.page.yml +0 -12
|
@@ -29,11 +29,6 @@
|
|
|
29
29
|
|
|
30
30
|
return true;
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
// 加载Amis SDK: 如果直接放到body中会导致 meteor 编译后的 cordova.js 加载报错
|
|
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);
|
|
37
32
|
} catch (error) {
|
|
38
33
|
console.error(error)
|
|
39
34
|
};
|
|
@@ -257,13 +252,8 @@
|
|
|
257
252
|
|
|
258
253
|
// 主要是支持 nav 中的跳转
|
|
259
254
|
if (action && to && action.target) {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
return;
|
|
263
|
-
}else{
|
|
264
|
-
window.open(to, action.target);
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
255
|
+
window.open(to, action.target);
|
|
256
|
+
return;
|
|
267
257
|
}
|
|
268
258
|
|
|
269
259
|
if (/^https?:\/\//.test(to)) {
|
|
@@ -281,10 +271,6 @@
|
|
|
281
271
|
}
|
|
282
272
|
// url是相对路径
|
|
283
273
|
if(config.url && (!/^http[s]?:\/\//i.test(config.url))){
|
|
284
|
-
if(Meteor.isCordova){
|
|
285
|
-
config.url = Meteor.absoluteUrl(config.url)
|
|
286
|
-
}
|
|
287
|
-
|
|
288
274
|
if(!config.headers){
|
|
289
275
|
config.headers = {}
|
|
290
276
|
}
|
|
@@ -292,17 +278,6 @@
|
|
|
292
278
|
if(!config.headers.Authorization && Builder.settings.context && Builder.settings.context.tenantId && Builder.settings.context.authToken){
|
|
293
279
|
config.headers.Authorization = `Bearer ${Builder.settings.context.tenantId},${Builder.settings.context.authToken}`;
|
|
294
280
|
}
|
|
295
|
-
}else if(config.url && Meteor.isCordova && Builder.settings.context && Builder.settings.context.rootUrl && config.url.startsWith(Builder.settings.context.rootUrl)){
|
|
296
|
-
// 是绝对路径,且是cordova环境, 且以root url开头, 则自动处理认证
|
|
297
|
-
if(Meteor.isCordova){
|
|
298
|
-
if(!config.headers){
|
|
299
|
-
config.headers = {}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
if(!config.headers.Authorization && Builder.settings.context && Builder.settings.context.tenantId && Builder.settings.context.authToken){
|
|
303
|
-
config.headers.Authorization = `Bearer ${Builder.settings.context.tenantId},${Builder.settings.context.authToken}`;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
281
|
}
|
|
307
282
|
return config;
|
|
308
283
|
},
|
|
@@ -418,23 +393,6 @@
|
|
|
418
393
|
};
|
|
419
394
|
|
|
420
395
|
const initMonaco = ()=>{
|
|
421
|
-
|
|
422
|
-
// const { detect } = require('detect-browser');
|
|
423
|
-
|
|
424
|
-
// const browser = detect();
|
|
425
|
-
|
|
426
|
-
// // 低于86版的chrome 不支持code类型字段及功能
|
|
427
|
-
// if (browser && browser.name === 'chrome' && Number(browser.version.split(".")[0]) < 86) {
|
|
428
|
-
// return Promise.resolve(true)
|
|
429
|
-
// }
|
|
430
|
-
|
|
431
|
-
// // 手机版暂不支持code类型字段.
|
|
432
|
-
// if(Meteor.isCordova){
|
|
433
|
-
// return Promise.resolve(true)
|
|
434
|
-
// }else{
|
|
435
|
-
// return Builder.initMonaco()
|
|
436
|
-
// }
|
|
437
|
-
|
|
438
396
|
return Promise.resolve(true)
|
|
439
397
|
}
|
|
440
398
|
//Amis SDK 中已清理了monaco, 所以这里需要提前注册,否则会导致amis code类型报错
|
|
@@ -141,16 +141,19 @@
|
|
|
141
141
|
"multiple": false
|
|
142
142
|
},
|
|
143
143
|
{
|
|
144
|
-
"
|
|
145
|
-
"
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
144
|
+
"type": "service",
|
|
145
|
+
"schemaApi": {
|
|
146
|
+
"method": "get",
|
|
147
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${target_object}/fields/options",
|
|
148
|
+
"cache": 30000,
|
|
149
|
+
"adaptor": "const field = {label: t('action_field_updates.action_field_updates_form.formula')}; const variables = SteedosUI.getFormulaVariables(payload.data.options);\n var fieldSchema={label: field.label, type:'input-formula', name: 'formula', 'evalMode': false, variableMode: 'tabs', variables: variables, labelRemark: field.inlineHelpText, description: field.description } \n return {...payload, data:fieldSchema};",
|
|
150
|
+
"trackExpression": "${target_object}",
|
|
151
|
+
"sendOn": "${target_object}"
|
|
152
|
+
},
|
|
153
|
+
"dsType": "api",
|
|
154
|
+
"id": "u:508198dbfac7",
|
|
149
155
|
"className": "col-span-2 m-1",
|
|
150
156
|
"labelClassName": "text-left",
|
|
151
|
-
"clearValueOnHidden": true,
|
|
152
|
-
"fieldName": "formula",
|
|
153
|
-
"id": "u:20766a86a9f4",
|
|
154
157
|
"hiddenOn": "this.operation != 'formula'"
|
|
155
158
|
},
|
|
156
159
|
{
|
|
@@ -289,7 +289,7 @@
|
|
|
289
289
|
}
|
|
290
290
|
},
|
|
291
291
|
"initApiAdaptor": "\nvar data;\nif (recordId) {\n data = payload.data || { _filters_type_controller: 'conditions' };\n //数据格式转换\n if (data) {\n data.sort = lodash.map(data.sort, (item) => {\n return item.field_name + \":\" + item.order;\n });\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 uiSchema = api.body.uiSchema;\n const contextDefaultData = context && context.data && context.data.defaultData; const defaultData = api.body.defaultData || contextDefaultData;\n let defaultValues = {};\n _.each(uiSchema && uiSchema.fields, function (field) {\n var value = SteedosUI.getFieldDefaultValue(field, api.body.global);\n if (!_.isNil(value)) {\n defaultValues[field.name] = value;\n }\n });\n if (defaultData && _.isObject(defaultData) && !_.isArray(defaultData)) {\n data = Object.assign({}, defaultValues, defaultData); \n }else{data = Object.assign({}, defaultValues) } \n}\nfor (key in data) {\n if (data[key] === null) {\n delete data[key];\n }\n}\npayload.data = data;\ndelete payload.extensions; if (data.is_enable != false) { data.is_enable = true; };\nreturn payload;",
|
|
292
|
-
"apiRequestAdaptor": "delete formData.created;\ndelete formData.created_by;\ndelete formData.modified;\ndelete formData.modified_by;\ndelete formData._display;\n\n//数据格式转换\nformData.sort = lodash.map(formData.sort, (item) => {\n const arr = item.split(':');\n return { field_name: arr[0], order: arr[1] };\n});\n\nformData.searchable_fields = lodash.map(formData.searchable_fields, (item) => {\n return { field: item };\n});\n\nif (!formData._filters_type_controller) {\n formData._filters_type_controller = 'conditions';\n}\n\nif (formData._filters_type_controller === 'conditions' && formData._filters_conditions) {\n formData.filters = window.amisConvert.conditionsToFilters(formData._filters_conditions);\n // formData.filters = JSON.stringify(window.amisConvert.conditionsToFilters(formData._filters_conditions), null, 4);\n} else {\n formData.filters = formData._filters_function || null;\n}\n\ndelete formData._filters_type_controller;\ndelete formData._filters_conditions;\ndelete formData._filters_function;\n\nquery = `mutation{record: object_listviews__insert(doc: {__saveData}){_id}}`;\nif (formData.recordId) {\n query = `mutation{record: object_listviews__update(id: \"` +
|
|
292
|
+
"apiRequestAdaptor": "delete formData.created;\ndelete formData.created_by;\ndelete formData.modified;\ndelete formData.modified_by;\ndelete formData._display;\n\n//数据格式转换\nformData.sort = lodash.map(formData.sort, (item) => {\n const arr = item.split(':');\n return { field_name: arr[0], order: arr[1] };\n});\n\nformData.searchable_fields = lodash.map(formData.searchable_fields, (item) => {\n return { field: item };\n});\n\nif (!formData._filters_type_controller) {\n formData._filters_type_controller = 'conditions';\n}\n\nif (formData._filters_type_controller === 'conditions' && formData._filters_conditions) {\n formData.filters = window.amisConvert.conditionsToFilters(formData._filters_conditions);\n // formData.filters = JSON.stringify(window.amisConvert.conditionsToFilters(formData._filters_conditions), null, 4);\n} else {\n formData.filters = formData._filters_function || null;\n}\n\ndelete formData._filters_type_controller;\ndelete formData._filters_conditions;\ndelete formData._filters_function;\n\nquery = `mutation{record: object_listviews__insert(doc: {__saveData}){_id}}`;\nif (formData.recordId) {\n query = `mutation{record: object_listviews__update(id: \"` + api.body.recordId + `\", doc: {__saveData}){_id}}`;\n};\n__saveData = JSON.stringify(JSON.stringify(formData));\n\napi.data = { query: query.replace('{__saveData}', __saveData) };\nreturn api;",
|
|
293
293
|
"id": "u:ce9e3fcc411a"
|
|
294
294
|
}
|
|
295
295
|
],
|
|
@@ -304,16 +304,5 @@
|
|
|
304
304
|
"initApi": null,
|
|
305
305
|
"initFetch": null,
|
|
306
306
|
"id": "u:6ada123f9d4a",
|
|
307
|
-
"onEvent": {
|
|
308
|
-
"init": {
|
|
309
|
-
"weight": 0,
|
|
310
|
-
"actions": [
|
|
311
|
-
{
|
|
312
|
-
"actionType": "custom",
|
|
313
|
-
"script": "//初始化时给外层dialog加上类名,使过滤组件popover正常显示\n$('.steedos-object-listview-form-page').closest('.amis-dialog-widget.antd-Modal').addClass('steedos-overflow-visible-dialog');"
|
|
314
|
-
}
|
|
315
|
-
]
|
|
316
|
-
}
|
|
317
|
-
},
|
|
318
307
|
"className": "steedos-object-listview-form-page"
|
|
319
308
|
}
|
|
@@ -302,8 +302,9 @@ module.exports = {
|
|
|
302
302
|
fields: 1
|
|
303
303
|
}
|
|
304
304
|
};
|
|
305
|
+
const forceUnHiddenObjectNames = ["cms_files", "tasks", "notes", "events", "instances", "approvals", "process_instance_history", "audit_records"];
|
|
305
306
|
let objects = _.map(_.filter((allObjects), (obj)=>{
|
|
306
|
-
return obj.hidden != true;
|
|
307
|
+
return obj.hidden != true || forceUnHiddenObjectNames.includes(obj.name);
|
|
307
308
|
}), (obj)=>{
|
|
308
309
|
return {
|
|
309
310
|
name: obj.name,
|
|
@@ -195,7 +195,7 @@ const getField = (objectName, fieldName, type, lng)=>{
|
|
|
195
195
|
case 'date':
|
|
196
196
|
// 华炎魔方中日期字段存的是utc的0点
|
|
197
197
|
field = {
|
|
198
|
-
type: "
|
|
198
|
+
type: "text",
|
|
199
199
|
format: "YYYY-MM-DDT00:00:00+00:00",
|
|
200
200
|
operators: getFieldOperators("date", lng)
|
|
201
201
|
};
|
|
@@ -203,7 +203,7 @@ const getField = (objectName, fieldName, type, lng)=>{
|
|
|
203
203
|
case 'datetime':
|
|
204
204
|
// 即amis中日期时间控件的format默认值为"YYYY-MM-DDTHH:mm+08:00"正好满足需求
|
|
205
205
|
field = {
|
|
206
|
-
type: "
|
|
206
|
+
type: "text",
|
|
207
207
|
operators: getFieldOperators("datetime", lng)
|
|
208
208
|
};
|
|
209
209
|
break;
|
|
@@ -217,6 +217,11 @@ const getField = (objectName, fieldName, type, lng)=>{
|
|
|
217
217
|
break;
|
|
218
218
|
case 'lookup':
|
|
219
219
|
case 'master_detail':
|
|
220
|
+
field = {
|
|
221
|
+
type: 'text',
|
|
222
|
+
operators: getFieldOperators("select", lng)
|
|
223
|
+
};
|
|
224
|
+
break;
|
|
220
225
|
case 'select':
|
|
221
226
|
field = {
|
|
222
227
|
type: 'select',
|
|
@@ -41,7 +41,7 @@ const getListPageInitSchema = function (objectApiName) {
|
|
|
41
41
|
return {
|
|
42
42
|
type: 'page',
|
|
43
43
|
name: getScopeId(objectApiName, "list"),
|
|
44
|
-
bodyClassName: '',
|
|
44
|
+
bodyClassName: 'p-0',
|
|
45
45
|
regions: [
|
|
46
46
|
"body"
|
|
47
47
|
],
|
|
@@ -88,7 +88,7 @@ const getRecordPageInitSchema = async function (objectApiName, userSession) {
|
|
|
88
88
|
}
|
|
89
89
|
const content = {
|
|
90
90
|
"type": "tabs",
|
|
91
|
-
"className": "steedos-record-tabs bg-white p-4 sm:m-
|
|
91
|
+
"className": "steedos-record-tabs bg-white p-4 sm:m-4 sm:shadow sm:rounded",
|
|
92
92
|
"tabs": [
|
|
93
93
|
detailed
|
|
94
94
|
]
|
|
@@ -112,7 +112,7 @@ const getRecordPageInitSchema = async function (objectApiName, userSession) {
|
|
|
112
112
|
name: getScopeId(objectApiName, "record_detail"),
|
|
113
113
|
objectApiName: "${objectName}",
|
|
114
114
|
bodyClassName: '',
|
|
115
|
-
className: "object-detail-page steedos-record-content overflow-y-auto p-0 m-0 flex-1 h-full bg-gray-
|
|
115
|
+
className: "object-detail-page steedos-record-content overflow-y-auto p-0 m-0 flex-1 h-full bg-gray-50",
|
|
116
116
|
regions: [
|
|
117
117
|
"body"
|
|
118
118
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-plugin-amis",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.92",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "yarn build:tailwind-base && yarn build:tailwind",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "16a684ff645d0a9b745e4b49309f2c63d6a41395",
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"tailwindcss": "3.2.4"
|
|
19
19
|
}
|
|
@@ -114,10 +114,6 @@
|
|
|
114
114
|
margin-right: 1.75rem
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
.mt-3 {
|
|
118
|
-
margin-top: 0.75rem
|
|
119
|
-
}
|
|
120
|
-
|
|
121
117
|
.mt-2 {
|
|
122
118
|
margin-top: 0.5rem
|
|
123
119
|
}
|
|
@@ -126,14 +122,14 @@
|
|
|
126
122
|
margin-right: 1rem
|
|
127
123
|
}
|
|
128
124
|
|
|
129
|
-
.mb-2 {
|
|
130
|
-
margin-bottom: 0.5rem
|
|
131
|
-
}
|
|
132
|
-
|
|
133
125
|
.-mt-3 {
|
|
134
126
|
margin-top: -0.75rem
|
|
135
127
|
}
|
|
136
128
|
|
|
129
|
+
.mb-2 {
|
|
130
|
+
margin-bottom: 0.5rem
|
|
131
|
+
}
|
|
132
|
+
|
|
137
133
|
.block {
|
|
138
134
|
display: block
|
|
139
135
|
}
|
|
@@ -218,6 +214,10 @@
|
|
|
218
214
|
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))
|
|
219
215
|
}
|
|
220
216
|
|
|
217
|
+
.flex-col {
|
|
218
|
+
flex-direction: column
|
|
219
|
+
}
|
|
220
|
+
|
|
221
221
|
.items-center {
|
|
222
222
|
align-items: center
|
|
223
223
|
}
|
|
@@ -230,6 +230,10 @@
|
|
|
230
230
|
justify-content: space-between
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
.gap-3 {
|
|
234
|
+
gap: 0.75rem
|
|
235
|
+
}
|
|
236
|
+
|
|
233
237
|
.overflow-auto {
|
|
234
238
|
overflow: auto
|
|
235
239
|
}
|
|
@@ -258,11 +262,6 @@
|
|
|
258
262
|
border-width: 0px
|
|
259
263
|
}
|
|
260
264
|
|
|
261
|
-
.border-y {
|
|
262
|
-
border-top-width: 1px;
|
|
263
|
-
border-bottom-width: 1px
|
|
264
|
-
}
|
|
265
|
-
|
|
266
265
|
.border-b {
|
|
267
266
|
border-bottom-width: 1px
|
|
268
267
|
}
|
|
@@ -271,6 +270,10 @@
|
|
|
271
270
|
border-right-width: 1px
|
|
272
271
|
}
|
|
273
272
|
|
|
273
|
+
.border-none {
|
|
274
|
+
border-style: none
|
|
275
|
+
}
|
|
276
|
+
|
|
274
277
|
.border-gray-200 {
|
|
275
278
|
--tw-border-opacity: 1;
|
|
276
279
|
border-color: rgb(229 231 235 / var(--tw-border-opacity))
|
|
@@ -1,336 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"type": "page",
|
|
3
|
-
"title": "Welcome to Steedos",
|
|
4
|
-
"body": [
|
|
5
|
-
{
|
|
6
|
-
"type": "steedos-object-form",
|
|
7
|
-
"className": "sm:border sm:rounded sm:border-gray-300 bg-white p-4",
|
|
8
|
-
"label": "对象表单",
|
|
9
|
-
"objectApiName": "apps",
|
|
10
|
-
"recordId": "${recordId}",
|
|
11
|
-
"mode": "edit",
|
|
12
|
-
"fieldsExtend": {
|
|
13
|
-
"tab_items": {
|
|
14
|
-
"amis": {
|
|
15
|
-
"name": "tab_items",
|
|
16
|
-
"type": "steedos-input-table",
|
|
17
|
-
"label": "",
|
|
18
|
-
"showIndex": true,
|
|
19
|
-
"source": "${tab_items}",
|
|
20
|
-
"strictMode": true,
|
|
21
|
-
"affixHeader": false,
|
|
22
|
-
"editable": true,
|
|
23
|
-
"addable": false,
|
|
24
|
-
"removable": true,
|
|
25
|
-
"draggable": false,
|
|
26
|
-
"fields": [
|
|
27
|
-
{
|
|
28
|
-
"label": "${'apps.apps_form.tab' | t}",
|
|
29
|
-
"type": "lookup",
|
|
30
|
-
"multiple": false,
|
|
31
|
-
"is_wide": false,
|
|
32
|
-
"required": true,
|
|
33
|
-
"reference_to": "tabs",
|
|
34
|
-
"reference_to_field": "name",
|
|
35
|
-
"sort_no": 30,
|
|
36
|
-
"name": "tab_name",
|
|
37
|
-
"hidden": false,
|
|
38
|
-
"readonly": false,
|
|
39
|
-
"disabled": false,
|
|
40
|
-
"_prefix": "tab_items."
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"label": "${'apps.apps_form.tab_grouping' | t}",
|
|
44
|
-
"name": "group",
|
|
45
|
-
"_prefix": "tab_items.",
|
|
46
|
-
"type": "text",
|
|
47
|
-
"amis": {
|
|
48
|
-
"type": "select",
|
|
49
|
-
"source": "${tab_groups|pick:group_name}",
|
|
50
|
-
"onEvent": {
|
|
51
|
-
"change": {
|
|
52
|
-
"actions": [
|
|
53
|
-
{
|
|
54
|
-
"actionType": "custom",
|
|
55
|
-
"script": "const tabGroupKey = \"group\";const getTabsSortFun = function (groupNames) { return function (m, n) { var tempM = !!m[tabGroupKey] ? 1 : 0; var tempN = !!n[tabGroupKey] ? 1 : 0; if (!m[tabGroupKey] || !n[tabGroupKey]) { return tempM - tempN; } return groupNames.indexOf(m[tabGroupKey]) - groupNames.indexOf(n[tabGroupKey]); };};const quickEidtSaveForTab = function (input, prop_name) { const currentPropValue = input.value; const rowValue = input.__super; const formValue = input.__super.__super; const tab_name = rowValue.tab_name; rowValue[prop_name] = currentPropValue; delete rowValue.index; let newTabs = formValue.tab_items.map(function (item) { if (item.tab_name == tab_name) { return Object.assign({}, item, rowValue); } else { return item; } }); const tabGroups = input.__super.__super.tab_groups; const groupNames = _.compact(_.map(tabGroups, \"group_name\")); if (groupNames && groupNames.length) { newTabs.sort(getTabsSortFun(groupNames)); } return { tab_items: newTabs }};const eventData = event.data;const newTabTtemsProp = quickEidtSaveForTab(eventData, \"group\");setTimeout(function () { doAction({ actionType: 'setValue', componentId: \"object_form\", args: { value: newTabTtemsProp } });},300);"
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
"placeholder": "-"
|
|
61
|
-
},
|
|
62
|
-
"className": "m-0",
|
|
63
|
-
"checkAll": false,
|
|
64
|
-
"selectFirst": false,
|
|
65
|
-
"searchable": true,
|
|
66
|
-
"clearable": true,
|
|
67
|
-
"multiple": false,
|
|
68
|
-
"mode": "inline"
|
|
69
|
-
}
|
|
70
|
-
],
|
|
71
|
-
"columns": [
|
|
72
|
-
{
|
|
73
|
-
"name": "tab_name",
|
|
74
|
-
"inlineEditMode": false
|
|
75
|
-
},
|
|
76
|
-
"group"
|
|
77
|
-
],
|
|
78
|
-
"headerToolbar": [
|
|
79
|
-
{
|
|
80
|
-
"type": "service",
|
|
81
|
-
"id": "tabs-options-service",
|
|
82
|
-
"className": "mb-2",
|
|
83
|
-
"body": [
|
|
84
|
-
{
|
|
85
|
-
"type": "button",
|
|
86
|
-
"id": "u:a35a2276145d",
|
|
87
|
-
"label": "${'apps.apps_form.tab_generate' | t}",
|
|
88
|
-
"onEvent": {
|
|
89
|
-
"click": {
|
|
90
|
-
"actions": [
|
|
91
|
-
{
|
|
92
|
-
"script": "const appId = null; const page = Steedos.Page.getPage('app', appId, null, null, 'generate_object_tabs'); if (page && page.schema) { const pageSchema = JSON.parse(page.schema); let formSchema = pageSchema.body[0]; formSchema.canAccessSuperData = false; formSchema.wrapWithPanel = false; formSchema.className = 'steedos-amis-form'; const title = t('apps.apps_form.tab_generate_title'); doAction({ 'actionType': 'dialog', 'dialog': { 'type': 'dialog', 'title': title, 'body': formSchema, 'size': 'lg' } }); }",
|
|
93
|
-
"actionType": "custom"
|
|
94
|
-
}
|
|
95
|
-
],
|
|
96
|
-
"weight": 0
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
"tpl": "内容"
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
"type": "button",
|
|
103
|
-
"label": "${'apps.apps_form.tab_set' | t}",
|
|
104
|
-
"id": "u:853b890ab524",
|
|
105
|
-
"actionType": "dialog",
|
|
106
|
-
"dialog": {
|
|
107
|
-
"type": "dialog",
|
|
108
|
-
"title": "${'apps.apps_form.tab_set' | t}",
|
|
109
|
-
"body": [
|
|
110
|
-
{
|
|
111
|
-
"type": "transfer",
|
|
112
|
-
"name": "picked_tabs",
|
|
113
|
-
"value": "${tab_items|pick:tab_name}",
|
|
114
|
-
"sortable": true,
|
|
115
|
-
"source": "${tabs_options}",
|
|
116
|
-
"searchable": true,
|
|
117
|
-
"itemHeight": 40,
|
|
118
|
-
"id": "u:f2d36873abd1"
|
|
119
|
-
}
|
|
120
|
-
],
|
|
121
|
-
"onEvent": {
|
|
122
|
-
"confirm": {
|
|
123
|
-
"actions": [
|
|
124
|
-
{
|
|
125
|
-
"actionType": "custom",
|
|
126
|
-
"script": "const tabGroupKey = 'group';const getTabsSortFun = function (groupNames) { return function (m, n) { var tempM = !!m[tabGroupKey] ? 1 : 0; var tempN = !!n[tabGroupKey] ? 1 : 0; if (!m[tabGroupKey] || !n[tabGroupKey]) { return tempM - tempN; } return groupNames.indexOf(m[tabGroupKey]) - groupNames.indexOf(n[tabGroupKey]); };};const clearTabs = function (input) { return { tab_items: [] }};const convertDataForTabs = function (input) { let pickedTabs = input.picked_tabs || []; const superTabs = _.keyBy(input.__super.tab_items, 'tab_name'); if (typeof pickedTabs === 'string') { pickedTabs = pickedTabs.split(','); } const tabOptions = _.keyBy(input.__super.tabs_options, 'value'); const convertedTabs = pickedTabs.map(function (tab_name) { const superTab = superTabs[tab_name]; if (superTab) { return superTab; } else { const tabOption = tabOptions[tab_name]; return { tab_name: tab_name, group: tabOption.group } } }); const tabGroups = input.__super.tab_groups; const groupNames = _.compact(_.map(tabGroups, 'group_name')); if (groupNames && groupNames.length) { convertedTabs.sort(getTabsSortFun(groupNames)); } return { tab_items: convertedTabs }};const eventData = event.data;doAction({ actionType: 'setValue', componentId: 'object_form', args: { value: convertDataForTabs(eventData) }});doAction({ actionType: 'setValue', componentId: 'tabs-options-service', args: { value: convertDataForTabs(eventData) }});"
|
|
127
|
-
}
|
|
128
|
-
]
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
"size": "lg",
|
|
132
|
-
"id": "u:9c93896a73cf",
|
|
133
|
-
"closeOnEsc": false,
|
|
134
|
-
"closeOnOutside": false,
|
|
135
|
-
"showCloseButton": true,
|
|
136
|
-
"showErrorMsg": true,
|
|
137
|
-
"showLoading": true,
|
|
138
|
-
"dataMapSwitch": false
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
"type": "button",
|
|
143
|
-
"label": "${'apps.apps_form.tab_grouping_set' | t}",
|
|
144
|
-
"actionType": "dialog",
|
|
145
|
-
"dialog": {
|
|
146
|
-
"title": "${'apps.apps_form.tab_grouping_set' | t}",
|
|
147
|
-
"body": [
|
|
148
|
-
{
|
|
149
|
-
"type": "input-table",
|
|
150
|
-
"name": "setting_groups",
|
|
151
|
-
"value": "${tab_groups}",
|
|
152
|
-
"addable": true,
|
|
153
|
-
"draggable": true,
|
|
154
|
-
"editable": true,
|
|
155
|
-
"needConfirm": false,
|
|
156
|
-
"columns": [
|
|
157
|
-
{
|
|
158
|
-
"name": "group_name",
|
|
159
|
-
"label": "${'apps.apps_form.tab_grouping_name' | t}",
|
|
160
|
-
"id": "u:383c7744b499"
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
"name": "default_open",
|
|
164
|
-
"label": "${'apps.apps_form.tab_grouping_open' | t}",
|
|
165
|
-
"id": "u:7a243c84ed66",
|
|
166
|
-
"type": "checkbox",
|
|
167
|
-
"value": true
|
|
168
|
-
}
|
|
169
|
-
],
|
|
170
|
-
"removable": true,
|
|
171
|
-
"id": "setting_groups"
|
|
172
|
-
}
|
|
173
|
-
],
|
|
174
|
-
"onEvent": {
|
|
175
|
-
"confirm": {
|
|
176
|
-
"actions": [
|
|
177
|
-
{
|
|
178
|
-
"actionType": "custom",
|
|
179
|
-
"script": "const tabGroupKey = 'group';\nconst getTabsSortFun = function (groupNames) {\n return function (m, n) {\n var tempM = !!m[tabGroupKey] ? 1 : 0;\n var tempN = !!n[tabGroupKey] ? 1 : 0;\n if (!m[tabGroupKey] || !n[tabGroupKey]) {\n return tempM - tempN;\n }\n return groupNames.indexOf(m[tabGroupKey]) - groupNames.indexOf(n[tabGroupKey]);\n };\n};\nconst clearTabs = function (input) { return { tab_items: [] } };\nconst convertDataForGroups = function (input) {\n \n const settingGroups = input.setting_groups || [];\n const convertedGroups = _.uniqBy(settingGroups.map(function (item) {\n return { group_name: item.group_name, default_open: item.default_open }\n }), 'group_name');\n const groupNames = _.compact(_.map(convertedGroups, 'group_name'));\n const tab_items = input.tab_items;\n tab_items?.sort(getTabsSortFun(groupNames));\n \n return { tab_groups: convertedGroups, tab_items: tab_items }\n};\nconst eventData = event.data;\ndoAction(\n {\n actionType: 'setValue',\n componentId: 'object_form',\n args: { value: convertDataForGroups(eventData) }\n }\n);"
|
|
180
|
-
}
|
|
181
|
-
]
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
"type": "dialog",
|
|
185
|
-
"size": "lg",
|
|
186
|
-
"id": "setting_groups",
|
|
187
|
-
"closeOnEsc": false,
|
|
188
|
-
"closeOnOutside": false,
|
|
189
|
-
"showCloseButton": true,
|
|
190
|
-
"showErrorMsg": true,
|
|
191
|
-
"showLoading": true,
|
|
192
|
-
"dataMapSwitch": false
|
|
193
|
-
},
|
|
194
|
-
"id": "u:111b043b193c"
|
|
195
|
-
}
|
|
196
|
-
],
|
|
197
|
-
"messages": {
|
|
198
|
-
},
|
|
199
|
-
"api": {
|
|
200
|
-
"method": "post",
|
|
201
|
-
"url": "${context.rootUrl}/graphql",
|
|
202
|
-
"adaptor": "let data = payload.data;\ndata.tabs_options = [];\nif (data.options && data.options.length) {\n data.tabs_options = data.options.map(function (option) {\n option.label = option.label + '(' + option.value + ')';\n return option;\n });\n}\nif (!api.body.recordId) {\n const defaultValues = {\n is_creator: true,\n mobile: true,\n visible: true,\n sort: 9100\n };\n data = Object.assign({}, data, defaultValues);\n}\ndelete data.options;\npayload.data = data;\nreturn payload; ",
|
|
203
|
-
"data": {
|
|
204
|
-
"query": "{options:tabs{_id label:label value:name,type,object,desktop,mobile}}",
|
|
205
|
-
"recordId": "${recordId}"
|
|
206
|
-
},
|
|
207
|
-
"headers": {
|
|
208
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
209
|
-
},
|
|
210
|
-
"messages": {
|
|
211
|
-
},
|
|
212
|
-
"requestAdaptor": ""
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
],
|
|
216
|
-
"enableDialog": false,
|
|
217
|
-
"id": "u:7949aecf0ca9"
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
"objects": {
|
|
221
|
-
"amis": {
|
|
222
|
-
"name": "objects",
|
|
223
|
-
"type": "select",
|
|
224
|
-
"className": "m-0",
|
|
225
|
-
"labelClassName": "text-left",
|
|
226
|
-
"id": "u:4e5047e44905",
|
|
227
|
-
"joinValues": false,
|
|
228
|
-
"extractValue": true,
|
|
229
|
-
"labelField": "label",
|
|
230
|
-
"valueField": "value",
|
|
231
|
-
"multiple": true,
|
|
232
|
-
"checkAll": false,
|
|
233
|
-
"searchable": true,
|
|
234
|
-
"menuTpl": "",
|
|
235
|
-
"source": {
|
|
236
|
-
"method": "get",
|
|
237
|
-
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/options",
|
|
238
|
-
"headers": {
|
|
239
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
"autoComplete": ""
|
|
243
|
-
}
|
|
244
|
-
},
|
|
245
|
-
"mobile_objects": {
|
|
246
|
-
"amis": {
|
|
247
|
-
"name": "mobile_objects",
|
|
248
|
-
"type": "select",
|
|
249
|
-
"className": "m-0",
|
|
250
|
-
"labelClassName": "text-left",
|
|
251
|
-
"id": "u:cfaeb2f857a8",
|
|
252
|
-
"joinValues": false,
|
|
253
|
-
"extractValue": true,
|
|
254
|
-
"labelField": "label",
|
|
255
|
-
"valueField": "value",
|
|
256
|
-
"multiple": true,
|
|
257
|
-
"checkAll": false,
|
|
258
|
-
"searchable": true,
|
|
259
|
-
"menuTpl": "",
|
|
260
|
-
"source": {
|
|
261
|
-
"method": "get",
|
|
262
|
-
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/options",
|
|
263
|
-
"messages": {
|
|
264
|
-
},
|
|
265
|
-
"headers": {
|
|
266
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
267
|
-
}
|
|
268
|
-
},
|
|
269
|
-
"autoComplete": ""
|
|
270
|
-
}
|
|
271
|
-
},
|
|
272
|
-
"visible_on": {
|
|
273
|
-
"amis": {
|
|
274
|
-
"type": "control",
|
|
275
|
-
"body": [
|
|
276
|
-
{
|
|
277
|
-
"type": "service",
|
|
278
|
-
"id": "u:edcd865de7d8",
|
|
279
|
-
"body": [
|
|
280
|
-
{
|
|
281
|
-
"type": "input-formula",
|
|
282
|
-
"name": "visible_on",
|
|
283
|
-
"evalMode": false,
|
|
284
|
-
"variableMode": "tabs",
|
|
285
|
-
"variables": "${visibleOnVariables}",
|
|
286
|
-
"visibleOn": "${visibleOnVariables}",
|
|
287
|
-
"id": "u:618105d5bfad",
|
|
288
|
-
"labelClassName": "none"
|
|
289
|
-
}
|
|
290
|
-
],
|
|
291
|
-
"api": {
|
|
292
|
-
"method": "get",
|
|
293
|
-
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/apps/fields/options",
|
|
294
|
-
"cache": 30000,
|
|
295
|
-
"adaptor": "const visibleOnVariables = SteedosUI.getFormulaVariables(payload.data.options);\nconst defaultValueVariables = [visibleOnVariables[1]];\npayload = {\n data: {\n visibleOnVariables,\n defaultValueVariables\n }\n};\nreturn payload;",
|
|
296
|
-
"headers": {
|
|
297
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
298
|
-
}
|
|
299
|
-
},
|
|
300
|
-
"dsType": "api"
|
|
301
|
-
}
|
|
302
|
-
],
|
|
303
|
-
"id": "u:996ef29c6851"
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
},
|
|
307
|
-
"enableTabs": true,
|
|
308
|
-
"debug": false,
|
|
309
|
-
"initApiRequestAdaptor": "",
|
|
310
|
-
"initApiAdaptor": "var data = payload.data;\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}\nif (data._id && !data.tab_items) {\n const tabOptions = data.tabs_options || [];\n const tabItems = [];\n // 把应用中原来tabs属性值添加到新的tab_items属性的默认值中\n if (data.tabs && data.tabs.length) {\n data.tabs.forEach(function (item) {\n tabItems.push({ tab_name: item });\n });\n }\n const 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属性的默认值中\n if (data.objects && data.objects.length) {\n pushObjectsToTabItems(data.objects);\n }\n // 把应用中原来mobile_objects属性值添加到新的tab_items属性的默认值中\n if (data.mobile_objects && data.mobile_objects.length) {\n pushObjectsToTabItems(data.mobile_objects);\n }\n data.tab_items = tabItems;\n}\n\npayload.data = data;\ndelete payload.extensions;\nreturn payload;\n ",
|
|
311
|
-
"apiRequestAdaptor": "delete formData.tabs_options;\nconst recordId = formData.recordId;\n\n// 新加字段tab_items,值同步回传到老字段tabs中兼容老UI界面\nformData.tabs = [];\nif (formData.tab_items && formData.tab_items.length) { \n formData.tabs = formData.tab_items.map(function (item) { return item.tab_name; });\n}\n\n/*\ntab_items存储为:\ntab_items: {\n test1:{\n group:\"xxx\"\n },\n test3:{\n group:\"yyy\"\n }\n}\n而不是:\ntab_items: [\n {\n \"index\":1,\n \"group\":\"xxx\"\n },\n {\n \"index\":2,\n \"group\":\"yyy\"\n }\n]\n*/\nif (formData.tab_items) { \n formData.tab_items = _.keyBy(formData.tab_items, \"tab_name\")\n let tempIndex = 0;\n _.each(formData.tab_items, function (n, k) {\n tempIndex++;\n n.index = tempIndex;\n delete n.tab_name;\n });\n}\n\nquery = `mutation{record: ${objectName}__insert(doc: {__saveData}){_id}}`;\nif(recordId){\n query = `mutation{record: ${objectName}__update(id: \"${recordId}\", doc: {__saveData}){_id}}`;\n};\n__saveData = JSON.stringify(JSON.stringify(formData));\n\napi.data = {query: query.replace('{__saveData}', __saveData)};\nreturn api;\n",
|
|
312
|
-
"apiAdaptor": "",
|
|
313
|
-
"form": {
|
|
314
|
-
"id": "object_form"
|
|
315
|
-
},
|
|
316
|
-
"id": "u:e1c1a841d373",
|
|
317
|
-
"tabsMode": "line"
|
|
318
|
-
}
|
|
319
|
-
],
|
|
320
|
-
"regions": [
|
|
321
|
-
"body"
|
|
322
|
-
],
|
|
323
|
-
"data": {
|
|
324
|
-
"objectName": "apps",
|
|
325
|
-
"initialValues": {},
|
|
326
|
-
"appId": "builder",
|
|
327
|
-
"title": "",
|
|
328
|
-
"context": {
|
|
329
|
-
"rootUrl": "http://127.0.0.1:5800",
|
|
330
|
-
"tenantId": "64a4d6dd7fe9acaf8c330a37",
|
|
331
|
-
"userId": "683e09cd-8482-4034-bd29-5a30643e6c0f",
|
|
332
|
-
"authToken": "2906ff4353c25cfe291352f899ba3446aa5577f3de7ad60e1aa500c60dee7ca6fb446412f1c9693775b4cc"
|
|
333
|
-
}
|
|
334
|
-
},
|
|
335
|
-
"id": "u:de840f3523f2"
|
|
336
|
-
}
|