@steedos-widgets/amis-lib 1.3.0-beta.8 → 1.3.0
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/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +460 -485
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +460 -485
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +107 -75
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/buttons.d.ts +1 -0
- package/dist/types/lib/converter/amis/fields/editor.d.ts +27 -8
- package/dist/types/lib/converter/amis/fields/index.d.ts +1 -1
- package/dist/types/lib/converter/amis/fields/lookup.d.ts +87 -61
- package/dist/types/lib/converter/amis/fields/table.d.ts +1 -24
- package/dist/types/lib/converter/amis/header.d.ts +9 -1
- package/dist/types/lib/converter/amis/util.d.ts +1 -0
- package/dist/types/schema/standard_import_data.amis.d.ts +62 -227
- package/dist/types/standard/button.d.ts +62 -227
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -409,8 +409,8 @@ const Router = {
|
|
|
409
409
|
/*
|
|
410
410
|
* @Author: baozhoutao@steedos.com
|
|
411
411
|
* @Date: 2022-07-20 16:29:22
|
|
412
|
-
* @LastEditors:
|
|
413
|
-
* @LastEditTime: 2023-
|
|
412
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
413
|
+
* @LastEditTime: 2023-09-06 18:59:40
|
|
414
414
|
* @Description:
|
|
415
415
|
*/
|
|
416
416
|
|
|
@@ -423,11 +423,37 @@ function getContrastColor(bgColor) {
|
|
|
423
423
|
return brightness < 128 ? "#ffffff" : "#000000";
|
|
424
424
|
}
|
|
425
425
|
|
|
426
|
+
function getLookupListView(refObjectConfig) {
|
|
427
|
+
const listNameAll = "all";
|
|
428
|
+
const listNameLookup = "lookup";
|
|
429
|
+
let listViewAll, listViewLookup;
|
|
430
|
+
|
|
431
|
+
_.each(
|
|
432
|
+
refObjectConfig.list_views,
|
|
433
|
+
(view, name) => {
|
|
434
|
+
if (name === listNameAll) {
|
|
435
|
+
listViewAll = view;
|
|
436
|
+
if(!listViewAll.name){
|
|
437
|
+
listViewAll.name = name;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
else if (name === listNameLookup) {
|
|
441
|
+
listViewLookup = view;
|
|
442
|
+
if(!listViewLookup.name){
|
|
443
|
+
listViewLookup.name = name;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
);
|
|
448
|
+
let listView = listViewLookup || listViewAll;
|
|
449
|
+
return listView;
|
|
450
|
+
}
|
|
451
|
+
|
|
426
452
|
/*
|
|
427
453
|
* @Author: baozhoutao@steedos.com
|
|
428
454
|
* @Date: 2022-05-23 09:53:08
|
|
429
455
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
430
|
-
* @LastEditTime: 2023-08-
|
|
456
|
+
* @LastEditTime: 2023-08-29 15:04:39
|
|
431
457
|
* @Description:
|
|
432
458
|
*/
|
|
433
459
|
|
|
@@ -531,7 +557,7 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
531
557
|
linkTarget = "target='_blank'";
|
|
532
558
|
}
|
|
533
559
|
|
|
534
|
-
const
|
|
560
|
+
const onlyDisplayLookLabel = ctx.onlyDisplayLookLabel;
|
|
535
561
|
|
|
536
562
|
let fieldDataStrTpl = `data._display.${field.name}`;
|
|
537
563
|
|
|
@@ -542,7 +568,7 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
542
568
|
if(_.isString(field.reference_to) || !field.reference_to){
|
|
543
569
|
if(field.multiple){
|
|
544
570
|
let labelTpl = `<%=item.label%>`;
|
|
545
|
-
if(!
|
|
571
|
+
if(!onlyDisplayLookLabel){
|
|
546
572
|
const href = Router.getObjectDetailPath({
|
|
547
573
|
formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
|
|
548
574
|
});
|
|
@@ -560,7 +586,7 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
560
586
|
objectNameTpl = `\${${field.name}.objectName}`;
|
|
561
587
|
recordIdTpl = `\${${field.name}.value}`;
|
|
562
588
|
}
|
|
563
|
-
if(!
|
|
589
|
+
if(!onlyDisplayLookLabel){
|
|
564
590
|
const href = Router.getObjectDetailPath({
|
|
565
591
|
formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
|
|
566
592
|
});
|
|
@@ -572,7 +598,7 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
572
598
|
|
|
573
599
|
}else {
|
|
574
600
|
let labelTpl = `<%=item.label%>`;
|
|
575
|
-
if(!
|
|
601
|
+
if(!onlyDisplayLookLabel){
|
|
576
602
|
const href = Router.getObjectDetailPath({
|
|
577
603
|
formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
|
|
578
604
|
});
|
|
@@ -625,7 +651,7 @@ function getLocationTpl(field){
|
|
|
625
651
|
}
|
|
626
652
|
|
|
627
653
|
async function getFieldTpl (field, options){
|
|
628
|
-
if((field.is_name || field.name === options.labelFieldName) && !options.
|
|
654
|
+
if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLookLabel){
|
|
629
655
|
return getNameTpl(field, options)
|
|
630
656
|
}
|
|
631
657
|
switch (field.type) {
|
|
@@ -995,7 +1021,7 @@ function getApi$2 (isMobile){
|
|
|
995
1021
|
}
|
|
996
1022
|
}
|
|
997
1023
|
|
|
998
|
-
var frontend_field_group_generalization$1 = "
|
|
1024
|
+
var frontend_field_group_generalization$1 = "General";
|
|
999
1025
|
var frontend_download$1 = "Download";
|
|
1000
1026
|
var frontend_form_save$1 = "Save";
|
|
1001
1027
|
var frontend_form_save_and_new$1 = "Save and New";
|
|
@@ -1680,10 +1706,7 @@ async function getSearchApi(field, ctx) {
|
|
|
1680
1706
|
}
|
|
1681
1707
|
|
|
1682
1708
|
function getRefListViewSort$1(refObject){
|
|
1683
|
-
|
|
1684
|
-
refObject.list_views,
|
|
1685
|
-
(view, name) => name === "all"
|
|
1686
|
-
);
|
|
1709
|
+
let listView = getLookupListView(refObject);
|
|
1687
1710
|
let sort = "";
|
|
1688
1711
|
if(listView){
|
|
1689
1712
|
sort = getListViewSort(listView);
|
|
@@ -2192,257 +2215,92 @@ const getSchema$2 = (uiSchema) => {
|
|
|
2192
2215
|
title: i18next__default["default"].t('frontend_import_data'),
|
|
2193
2216
|
body: [
|
|
2194
2217
|
{
|
|
2195
|
-
type: "form",
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
api: {
|
|
2204
|
-
method: "post",
|
|
2205
|
-
url: "${context.rootUrl}/graphql",
|
|
2206
|
-
data: {
|
|
2207
|
-
objectName: "queue_import_history",
|
|
2208
|
-
$: "$$",
|
|
2209
|
-
},
|
|
2210
|
-
requestAdaptor:
|
|
2211
|
-
"\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.success_count;\ndelete formData.failure_count;\ndelete formData.total_count;\ndelete formData.start_time;\ndelete formData.end_time;\ndelete formData.state;\ndelete formData.error;\ndelete formData.created;\ndelete formData.created_by;\ndelete formData.modified;\ndelete formData.modified_by;\n \n \n let fileFieldsKeys = [\"file\"];\n let fileFields = {\"file\":{\"name\":\"file\"}};\n fileFieldsKeys.forEach((item)=>{\n let fileFieldValue = formData[item];\n if(fileFieldValue){\n // 因为表单初始化接口的接收适配器中为file字段值重写了值及格式(为了字段编辑时正常显示附件名、点击附件名正常下载),所以保存时还原(为了字段值保存时正常保存id)。\n if(fileFields[item].multiple){\n if(fileFieldValue instanceof Array && fileFieldValue.length){\n formData[item] = fileFieldValue.map((value)=>{ \n if(typeof value === 'object'){\n return value.value;\n }else{\n return value;\n }\n });\n }\n }else{\n formData[item] = typeof fileFieldValue === 'object' ? fileFieldValue.value : fileFieldValue;\n }\n }\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 ",
|
|
2212
|
-
responseData: {
|
|
2213
|
-
recordId: "${record._id}",
|
|
2214
|
-
},
|
|
2215
|
-
adaptor:
|
|
2216
|
-
"console.log('payload', payload)\n return payload;\n ",
|
|
2217
|
-
headers: {
|
|
2218
|
-
Authorization:
|
|
2219
|
-
"Bearer ${context.tenantId},${context.authToken}",
|
|
2220
|
-
},
|
|
2221
|
-
dataType: "json",
|
|
2218
|
+
"type": "steedos-object-form",
|
|
2219
|
+
"label": "对象表单",
|
|
2220
|
+
"objectApiName": "queue_import_history",
|
|
2221
|
+
"recordId": "",
|
|
2222
|
+
"mode": "edit",
|
|
2223
|
+
"layout": "normal",
|
|
2224
|
+
"defaultData":{
|
|
2225
|
+
"object_name": "${objectName}"
|
|
2222
2226
|
},
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
},
|
|
2252
|
-
headers: {
|
|
2253
|
-
Authorization:
|
|
2254
|
-
"Bearer ${context.tenantId},${context.authToken}",
|
|
2255
|
-
},
|
|
2256
|
-
requestAdaptor:
|
|
2257
|
-
"\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 ",
|
|
2258
|
-
},
|
|
2259
|
-
className: "m-1",
|
|
2260
|
-
labelClassName: "text-left",
|
|
2261
|
-
clearValueOnHidden: false,
|
|
2262
|
-
id: "u:04295fee3896",
|
|
2263
|
-
multiple: false,
|
|
2264
|
-
hidden: true,
|
|
2265
|
-
},
|
|
2266
|
-
{
|
|
2267
|
-
name: "queue_import",
|
|
2268
|
-
label: i18next__default["default"].t('frontend_import_data_queue_import'),
|
|
2269
|
-
required: true,
|
|
2270
|
-
type: "picker",
|
|
2271
|
-
labelField: "description",
|
|
2272
|
-
valueField: "_id",
|
|
2273
|
-
modalMode: "dialog",
|
|
2274
|
-
source: {
|
|
2275
|
-
method: "post",
|
|
2276
|
-
url: "${context.rootUrl}/graphql",
|
|
2277
|
-
data: {
|
|
2278
|
-
orderBy: "${orderBy}",
|
|
2279
|
-
orderDir: "${orderDir}",
|
|
2280
|
-
pageNo: "${page}",
|
|
2281
|
-
pageSize: "${perPage}",
|
|
2282
|
-
query:
|
|
2283
|
-
'{rows:queue_import(filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"){_id,description,object_name,encoding,template_url,_display:_ui{object_name,encoding}},count:queue_import__count(filters:{__filters})}',
|
|
2284
|
-
$term: "$term",
|
|
2285
|
-
$self: "$$",
|
|
2227
|
+
"fieldsExtend":{
|
|
2228
|
+
"object_name": {
|
|
2229
|
+
"amis": {
|
|
2230
|
+
"hidden": true
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
},
|
|
2234
|
+
"form": {
|
|
2235
|
+
debug: false,
|
|
2236
|
+
resetAfterSubmit: false,
|
|
2237
|
+
initApi: {
|
|
2238
|
+
url: '/api/v1/queue_import_history/${recordId}?fields=["state"]',
|
|
2239
|
+
sendOn: 'this.recordId',
|
|
2240
|
+
responseData: {
|
|
2241
|
+
importState: "${state}"
|
|
2242
|
+
}
|
|
2243
|
+
},
|
|
2244
|
+
interval: 3000,
|
|
2245
|
+
stopAutoRefreshWhen: "this.importState === 'finished'",
|
|
2246
|
+
initFetch: false,
|
|
2247
|
+
onEvent: {
|
|
2248
|
+
inited: {
|
|
2249
|
+
weight: 0,
|
|
2250
|
+
actions: [
|
|
2251
|
+
{
|
|
2252
|
+
"actionType": "broadcast",
|
|
2253
|
+
"args": {
|
|
2254
|
+
"eventName": `@data.changed.${uiSchema.name}`
|
|
2286
2255
|
},
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2256
|
+
"data": {
|
|
2257
|
+
"objectName": `${uiSchema.name}`,
|
|
2258
|
+
"displayAs": "${displayAs}",
|
|
2259
|
+
"recordId": "xxxx" //不可以省略,否则会进入进入记录详细页面
|
|
2290
2260
|
},
|
|
2291
|
-
|
|
2292
|
-
"\n const selfData = JSON.parse(JSON.stringify(api.data.$self));\n var filters = [];\n var pageSize = api.data.pageSize || 10;\n var pageNo = api.data.pageNo || 1;\n var skip = (pageNo - 1) * pageSize;\n var orderBy = api.data.orderBy || '';\n var orderDir = api.data.orderDir || '';\n var sort = orderBy + ' ' + orderDir;\n var allowSearchFields = [\"description\"];\n if(api.data.$term){\n filters = [[\"name\", \"contains\", \"'+ api.data.$term +'\"]];\n }else if(selfData.op === 'loadOptions' && selfData.value){\n if(selfData.value && selfData.value.indexOf(',') > 0){\n filters = [[\"_id\", \"=\", selfData.value.split(',')]];\n }else{\n filters = [[\"_id\", \"=\", selfData.value]];\n }\n }\n if(allowSearchFields){\n allowSearchFields.forEach(function(key){\n const keyValue = selfData[key];\n if(keyValue){\n filters.push([key, \"contains\", keyValue]);\n }\n })\n }\n\n const filtersFunction = function(filters, values){return ['object_name', '=', values.object_name]};\n\n if(filtersFunction){\n const _filters = filtersFunction(filters, api.data.$self.__super.__super);\n if(_filters && _filters.length > 0){\n filters.push(_filters);\n }\n }\n\n api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim());\n return api;\n ",
|
|
2293
|
-
adaptor:
|
|
2294
|
-
"\n const enable_tree = undefined;\n if(enable_tree){\n const records = payload.data.rows;\n const treeRecords = [];\n const getChildren = (records, childrenIds)=>{\n if(!childrenIds){\n return;\n }\n const children = _.filter(records, (record)=>{\n return _.includes(childrenIds, record._id)\n });\n _.each(children, (item)=>{\n if(item.children){\n item.children = getChildren(records, item.children)\n }\n })\n return children;\n }\n\n _.each(records, (record)=>{\n if(!record.parent){\n treeRecords.push(Object.assign({}, record, {children: getChildren(records, record.children)}));\n }\n });\n payload.data.rows = treeRecords;\n }\n return payload;\n ",
|
|
2261
|
+
"expression": "this.importState === 'finished'"
|
|
2295
2262
|
},
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
name: "object_name",
|
|
2322
|
-
label: i18next__default["default"].t('frontend_import_data_object_name'),
|
|
2323
|
-
type: "tpl",
|
|
2324
|
-
tpl: '<a href="/app/undefined/${_display.object_name.objectName}/view/${_display.object_name.value}">${_display.object_name.label}</a>',
|
|
2325
|
-
className: "whitespace-nowrap",
|
|
2326
|
-
html: null,
|
|
2327
|
-
},
|
|
2328
|
-
{
|
|
2329
|
-
name: "encoding",
|
|
2330
|
-
label: i18next__default["default"].t('frontend_import_data_queue_import_encoding'),
|
|
2331
|
-
type: "tpl",
|
|
2332
|
-
tpl: "<div>${_display.encoding}</div>",
|
|
2333
|
-
className: "whitespace-nowrap",
|
|
2334
|
-
html: null,
|
|
2335
|
-
},
|
|
2336
|
-
{
|
|
2337
|
-
name: "template_url",
|
|
2338
|
-
label: i18next__default["default"].t('frontend_import_data_queue_import_template_url'),
|
|
2339
|
-
type: "button-group",
|
|
2340
|
-
buttons: [
|
|
2341
|
-
{
|
|
2342
|
-
type: "button",
|
|
2343
|
-
label: i18next__default["default"].t('frontend_download'),
|
|
2344
|
-
visibleOn: "${template_url}",
|
|
2345
|
-
level: "link",
|
|
2346
|
-
actionType: "download",
|
|
2347
|
-
api:{
|
|
2348
|
-
url: "${template_url}",
|
|
2349
|
-
method: "get",
|
|
2350
|
-
headers: {
|
|
2351
|
-
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
2352
|
-
}
|
|
2353
|
-
}
|
|
2354
|
-
}
|
|
2355
|
-
],
|
|
2356
|
-
options: {
|
|
2357
|
-
html: true
|
|
2263
|
+
{
|
|
2264
|
+
"actionType": "closeDialog",
|
|
2265
|
+
"expression": "this.importState === 'finished'"
|
|
2266
|
+
}
|
|
2267
|
+
]
|
|
2268
|
+
},
|
|
2269
|
+
submitSucc: {
|
|
2270
|
+
weight: 0,
|
|
2271
|
+
actions: [
|
|
2272
|
+
{
|
|
2273
|
+
args: {
|
|
2274
|
+
api: {
|
|
2275
|
+
url: "${context.rootUrl}/api/data/initiateImport",
|
|
2276
|
+
method: "post",
|
|
2277
|
+
data: {
|
|
2278
|
+
eventData: "${event.data}",
|
|
2279
|
+
},
|
|
2280
|
+
dataType: "json",
|
|
2281
|
+
requestAdaptor:
|
|
2282
|
+
"\napi.data = {\n importObjectHistoryId: api.body.eventData.result.data.recordId\n}\nreturn api;",
|
|
2283
|
+
adaptor:
|
|
2284
|
+
"payload.status = payload.status === 'success' ? 0 : payload.status;\nconsole.log(\"payload ssss==>\", payload)\nreturn payload;",
|
|
2285
|
+
headers: {
|
|
2286
|
+
Authorization:
|
|
2287
|
+
"Bearer ${context.tenantId},${context.authToken}",
|
|
2358
2288
|
},
|
|
2359
|
-
className: "whitespace-nowrap",
|
|
2360
|
-
},
|
|
2361
|
-
null,
|
|
2362
|
-
],
|
|
2363
|
-
syncLocation: false,
|
|
2364
|
-
keepItemSelectionOnPageChange: true,
|
|
2365
|
-
checkOnItemClick: false,
|
|
2366
|
-
autoFillHeight: false,
|
|
2367
|
-
},
|
|
2368
|
-
joinValues: false,
|
|
2369
|
-
extractValue: true,
|
|
2370
|
-
className: "m-1",
|
|
2371
|
-
labelClassName: "text-left",
|
|
2372
|
-
clearValueOnHidden: true,
|
|
2373
|
-
id: "u:401df27113e0",
|
|
2374
|
-
},
|
|
2375
|
-
{
|
|
2376
|
-
name: "file",
|
|
2377
|
-
label: i18next__default["default"].t('frontend_import_data_file'),
|
|
2378
|
-
required: true,
|
|
2379
|
-
type: "input-file",
|
|
2380
|
-
accept: ".xlsx,.xls",
|
|
2381
|
-
className: "m-1",
|
|
2382
|
-
labelClassName: "text-left",
|
|
2383
|
-
clearValueOnHidden: true,
|
|
2384
|
-
useChunk: false,
|
|
2385
|
-
receiver: {
|
|
2386
|
-
method: "post",
|
|
2387
|
-
url: "${context.rootUrl}/s3/files",
|
|
2388
|
-
data: {
|
|
2389
|
-
$: "$$",
|
|
2390
|
-
context: "${context}",
|
|
2391
|
-
},
|
|
2392
|
-
adaptor:
|
|
2393
|
-
'\n const { context } = api.body; \n var rootUrl = context.rootUrl + "/api/files/files/";\n payload = {\n status: response.status == 200 ? 0 : response.status,\n msg: response.statusText,\n data: {\n value: payload._id,\n name: payload.original.name,\n url: rootUrl + payload._id,\n }\n }\n return payload;\n ',
|
|
2394
|
-
headers: {
|
|
2395
|
-
Authorization:
|
|
2396
|
-
"Bearer ${context.tenantId},${context.authToken}",
|
|
2397
|
-
},
|
|
2398
|
-
},
|
|
2399
|
-
id: "u:0213f2cc365b",
|
|
2400
|
-
},
|
|
2401
|
-
],
|
|
2402
|
-
id: "u:4899c260d667",
|
|
2403
|
-
},
|
|
2404
|
-
],
|
|
2405
|
-
panelClassName: "m-0 sm:rounded-lg shadow-none",
|
|
2406
|
-
bodyClassName: "p-0",
|
|
2407
|
-
className: "p-4 sm:p-0 steedos-amis-form",
|
|
2408
|
-
label: "对象表单",
|
|
2409
|
-
objectApiName: "queue_import_history",
|
|
2410
|
-
id: "u:e4ef598eed61",
|
|
2411
|
-
onEvent: {
|
|
2412
|
-
submitSucc: {
|
|
2413
|
-
weight: 0,
|
|
2414
|
-
actions: [
|
|
2415
|
-
{
|
|
2416
|
-
args: {
|
|
2417
|
-
api: {
|
|
2418
|
-
url: "${context.rootUrl}/api/data/initiateImport",
|
|
2419
|
-
method: "post",
|
|
2420
|
-
data: {
|
|
2421
|
-
eventData: "${event.data}",
|
|
2422
2289
|
},
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
adaptor:
|
|
2427
|
-
"payload.status = payload.status === 'success' ? 0 : payload.status;\nconsole.log(\"payload ssss==>\", payload)\nreturn payload;",
|
|
2428
|
-
headers: {
|
|
2429
|
-
Authorization:
|
|
2430
|
-
"Bearer ${context.tenantId},${context.authToken}",
|
|
2290
|
+
messages: {
|
|
2291
|
+
success: i18next__default["default"].t('frontend_import_data_message_success'),
|
|
2292
|
+
failed: i18next__default["default"].t('frontend_import_data_message_failed'),
|
|
2431
2293
|
},
|
|
2432
2294
|
},
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
failed: i18next__default["default"].t('frontend_import_data_message_failed'),
|
|
2436
|
-
},
|
|
2295
|
+
actionType: "ajax",
|
|
2296
|
+
expression: "event.data.result",
|
|
2437
2297
|
},
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
},
|
|
2441
|
-
],
|
|
2298
|
+
],
|
|
2299
|
+
},
|
|
2442
2300
|
},
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
}
|
|
2301
|
+
closeDialogOnSubmit: false,
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2446
2304
|
],
|
|
2447
2305
|
id: "u:dc05498d3bd4",
|
|
2448
2306
|
closeOnEsc: false,
|
|
@@ -2632,7 +2490,7 @@ const StandardButtons = {
|
|
|
2632
2490
|
getStandardImportData: async (uiSchema, ctx)=>{
|
|
2633
2491
|
return {
|
|
2634
2492
|
type: 'amis_button',
|
|
2635
|
-
amis_schema: await getSchema$2()
|
|
2493
|
+
amis_schema: await getSchema$2(uiSchema)
|
|
2636
2494
|
}
|
|
2637
2495
|
},
|
|
2638
2496
|
getStandardOpenView: async (uiSchema, ctx)=>{
|
|
@@ -2662,7 +2520,7 @@ function getButtonVisibleOn$1(button){
|
|
|
2662
2520
|
visible = button._visible;
|
|
2663
2521
|
}
|
|
2664
2522
|
|
|
2665
|
-
if(
|
|
2523
|
+
if(___namespace.isBoolean(visible)){
|
|
2666
2524
|
visible = visible.toString();
|
|
2667
2525
|
}
|
|
2668
2526
|
|
|
@@ -2690,7 +2548,7 @@ function getButtonVisibleOn$1(button){
|
|
|
2690
2548
|
|
|
2691
2549
|
const getButtonVisible = (button, ctx) => {
|
|
2692
2550
|
if (button._visible) {
|
|
2693
|
-
if (
|
|
2551
|
+
if (___namespace.startsWith(___namespace.trim(button._visible), "function")) {
|
|
2694
2552
|
window.eval("var fun = " + button._visible);
|
|
2695
2553
|
button.visible = fun;
|
|
2696
2554
|
} else if (isExpression(button._visible)) {
|
|
@@ -2705,7 +2563,7 @@ const getButtonVisible = (button, ctx) => {
|
|
|
2705
2563
|
};
|
|
2706
2564
|
}
|
|
2707
2565
|
}
|
|
2708
|
-
if (
|
|
2566
|
+
if (___namespace.isFunction(button.visible)) {
|
|
2709
2567
|
try {
|
|
2710
2568
|
return button.visible(ctx);
|
|
2711
2569
|
} catch (error) {
|
|
@@ -2727,7 +2585,7 @@ const standardButtonsTodo = {
|
|
|
2727
2585
|
} = this;
|
|
2728
2586
|
const listViewRef = SteedosUI?.getRef(scopeId || listViewId).getComponentById(`listview_${uiSchema.name}`);
|
|
2729
2587
|
|
|
2730
|
-
if(
|
|
2588
|
+
if(___namespace.isEmpty(listViewRef.props.store.toJSON().selectedItems)){
|
|
2731
2589
|
listViewRef.handleAction({}, {
|
|
2732
2590
|
"actionType": "toast",
|
|
2733
2591
|
"toast": {
|
|
@@ -2754,19 +2612,19 @@ const standardButtonsTodo = {
|
|
|
2754
2612
|
*/
|
|
2755
2613
|
const getButtons = (uiSchema, ctx) => {
|
|
2756
2614
|
const disabledButtons = uiSchema.permissions && uiSchema.permissions.disabled_actions;
|
|
2757
|
-
let buttons =
|
|
2758
|
-
if (
|
|
2759
|
-
buttons =
|
|
2760
|
-
return
|
|
2615
|
+
let buttons = ___namespace.sortBy(___namespace.values(uiSchema.actions), "sort");
|
|
2616
|
+
if (___namespace.has(uiSchema, "allow_customActions")) {
|
|
2617
|
+
buttons = ___namespace.filter(buttons, (button) => {
|
|
2618
|
+
return ___namespace.include(uiSchema.allow_customActions, button.name); // || _.include(_.keys(Creator.getObject('base').actions) || {}, button.name)
|
|
2761
2619
|
});
|
|
2762
2620
|
}
|
|
2763
|
-
if (
|
|
2764
|
-
buttons =
|
|
2765
|
-
return !
|
|
2621
|
+
if (___namespace.has(uiSchema, "exclude_actions")) {
|
|
2622
|
+
buttons = ___namespace.filter(buttons, (button) => {
|
|
2623
|
+
return !___namespace.include(uiSchema.exclude_actions, button.name);
|
|
2766
2624
|
});
|
|
2767
2625
|
}
|
|
2768
2626
|
|
|
2769
|
-
|
|
2627
|
+
___namespace.each(buttons, (button) => {
|
|
2770
2628
|
button.objectName = uiSchema.name;
|
|
2771
2629
|
if (
|
|
2772
2630
|
ctx.isMobile &&
|
|
@@ -2785,7 +2643,7 @@ const getButtons = (uiSchema, ctx) => {
|
|
|
2785
2643
|
ctx.isMobile &&
|
|
2786
2644
|
["cms_files", "cfs.files.filerecord"].indexOf(uiSchema.name) > -1
|
|
2787
2645
|
) {
|
|
2788
|
-
|
|
2646
|
+
___namespace.map(buttons, (button) => {
|
|
2789
2647
|
if (button.name === "standard_edit") {
|
|
2790
2648
|
button.on = "record_more";
|
|
2791
2649
|
}
|
|
@@ -2795,14 +2653,14 @@ const getButtons = (uiSchema, ctx) => {
|
|
|
2795
2653
|
});
|
|
2796
2654
|
}
|
|
2797
2655
|
|
|
2798
|
-
return
|
|
2799
|
-
return
|
|
2656
|
+
return ___namespace.filter(buttons, (button) => {
|
|
2657
|
+
return ___namespace.indexOf(disabledButtons, button.name) < 0 && button.name != 'standard_query';
|
|
2800
2658
|
});
|
|
2801
2659
|
};
|
|
2802
2660
|
|
|
2803
2661
|
const getListViewButtons = (uiSchema, ctx) => {
|
|
2804
2662
|
const buttons = getButtons(uiSchema, ctx);
|
|
2805
|
-
const listButtons =
|
|
2663
|
+
const listButtons = ___namespace.filter(buttons, (button) => {
|
|
2806
2664
|
return button.on == "list";
|
|
2807
2665
|
});
|
|
2808
2666
|
return listButtons;
|
|
@@ -2810,23 +2668,23 @@ const getListViewButtons = (uiSchema, ctx) => {
|
|
|
2810
2668
|
|
|
2811
2669
|
const getObjectDetailButtons = (uiSchema, ctx) => {
|
|
2812
2670
|
const buttons = getButtons(uiSchema, ctx);
|
|
2813
|
-
const detailButtons =
|
|
2671
|
+
const detailButtons = ___namespace.filter(buttons, (button) => {
|
|
2814
2672
|
return button.on == "record" || button.on == "record_only";
|
|
2815
2673
|
});
|
|
2816
|
-
return
|
|
2674
|
+
return ___namespace.sortBy(detailButtons, "sort");
|
|
2817
2675
|
};
|
|
2818
2676
|
|
|
2819
2677
|
const getObjectDetailMoreButtons = (uiSchema, ctx) => {
|
|
2820
2678
|
const buttons = getButtons(uiSchema, ctx);
|
|
2821
|
-
const moreButtons =
|
|
2679
|
+
const moreButtons = ___namespace.filter(buttons, (button) => {
|
|
2822
2680
|
return button.on == "record_more" || button.on == "record_only_more";
|
|
2823
2681
|
});
|
|
2824
|
-
return
|
|
2682
|
+
return ___namespace.sortBy(moreButtons, "sort");
|
|
2825
2683
|
};
|
|
2826
2684
|
|
|
2827
2685
|
const getListViewItemButtons = async (uiSchema, ctx)=>{
|
|
2828
2686
|
const buttons = getButtons(uiSchema, ctx);
|
|
2829
|
-
const listButtons =
|
|
2687
|
+
const listButtons = ___namespace.filter(buttons, (button) => {
|
|
2830
2688
|
return button.on == "record" || button.on == "list_item" || button.on === 'record_more';
|
|
2831
2689
|
});
|
|
2832
2690
|
return listButtons;
|
|
@@ -2843,7 +2701,7 @@ const getObjectRelatedListButtons = (uiSchema, ctx)=>{
|
|
|
2843
2701
|
// });
|
|
2844
2702
|
// return relatedListButtons;
|
|
2845
2703
|
const buttons = getButtons(uiSchema, ctx);
|
|
2846
|
-
const listButtons =
|
|
2704
|
+
const listButtons = ___namespace.filter(buttons, (button) => {
|
|
2847
2705
|
return button.on == "list";
|
|
2848
2706
|
});
|
|
2849
2707
|
return listButtons;
|
|
@@ -2860,7 +2718,7 @@ const getButton = async (objectName, buttonName, ctx)=>{
|
|
|
2860
2718
|
const uiSchema = await getUISchema(objectName);
|
|
2861
2719
|
if(uiSchema){
|
|
2862
2720
|
const buttons = await getButtons(uiSchema, ctx);
|
|
2863
|
-
const button =
|
|
2721
|
+
const button = ___namespace.find(buttons, (button)=>{
|
|
2864
2722
|
return button.name === buttonName
|
|
2865
2723
|
});
|
|
2866
2724
|
|
|
@@ -2946,13 +2804,13 @@ const execute = (button, props) => {
|
|
|
2946
2804
|
return; //TODO 弹出提示未配置todo
|
|
2947
2805
|
}
|
|
2948
2806
|
|
|
2949
|
-
if (
|
|
2950
|
-
if (
|
|
2807
|
+
if (___namespace.isString(button.todo)) {
|
|
2808
|
+
if (___namespace.startsWith(___namespace.trim(button.todo), "function")) {
|
|
2951
2809
|
window.eval("var fun = " + button.todo);
|
|
2952
2810
|
button.todo = fun;
|
|
2953
2811
|
}
|
|
2954
2812
|
}
|
|
2955
|
-
if (
|
|
2813
|
+
if (___namespace.isFunction(button.todo)) {
|
|
2956
2814
|
const todoThis = {
|
|
2957
2815
|
objectName: props.objectName,
|
|
2958
2816
|
object_name: props.objectName,
|
|
@@ -2977,7 +2835,7 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
|
|
|
2977
2835
|
recordId: recordId,
|
|
2978
2836
|
objectName: name
|
|
2979
2837
|
});
|
|
2980
|
-
let amisButtonsSchema =
|
|
2838
|
+
let amisButtonsSchema = ___namespace.map(buttons, (button) => {
|
|
2981
2839
|
return {
|
|
2982
2840
|
type: 'steedos-object-button',
|
|
2983
2841
|
name: button.name,
|
|
@@ -2987,7 +2845,7 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
|
|
|
2987
2845
|
}
|
|
2988
2846
|
});
|
|
2989
2847
|
let moreButtonsVisibleOn = '';
|
|
2990
|
-
let dropdownButtons =
|
|
2848
|
+
let dropdownButtons = ___namespace.map(moreButtons, (button, index) => {
|
|
2991
2849
|
if(index === 0){
|
|
2992
2850
|
moreButtonsVisibleOn = getButtonVisibleOn$1(button);
|
|
2993
2851
|
}else {
|
|
@@ -3030,11 +2888,11 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
3030
2888
|
"vertical": true,
|
|
3031
2889
|
"tiled": true,
|
|
3032
2890
|
"buttons": [
|
|
3033
|
-
...
|
|
2891
|
+
...___namespace.map(buttons, (button)=>{
|
|
3034
2892
|
button.className += ' w-full';
|
|
3035
2893
|
return button;
|
|
3036
2894
|
}),
|
|
3037
|
-
...
|
|
2895
|
+
...___namespace.map(moreButtons, (button)=>{
|
|
3038
2896
|
button.className += ' w-full';
|
|
3039
2897
|
return button;
|
|
3040
2898
|
})
|
|
@@ -3079,6 +2937,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3079
2937
|
return {
|
|
3080
2938
|
"type": "button",
|
|
3081
2939
|
"icon": "fa fa-angle-down",
|
|
2940
|
+
"className": "mr-0",
|
|
3082
2941
|
"onEvent": {
|
|
3083
2942
|
"click": {
|
|
3084
2943
|
"actions": [
|
|
@@ -3095,7 +2954,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3095
2954
|
"vertical": true,
|
|
3096
2955
|
"tiled": true,
|
|
3097
2956
|
"buttons": [
|
|
3098
|
-
...
|
|
2957
|
+
...___namespace.map(buttons, (button)=>{
|
|
3099
2958
|
return {
|
|
3100
2959
|
type: 'steedos-object-button',
|
|
3101
2960
|
name: button.name,
|
|
@@ -3124,7 +2983,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3124
2983
|
}
|
|
3125
2984
|
}
|
|
3126
2985
|
}else {
|
|
3127
|
-
return
|
|
2986
|
+
return ___namespace.map(buttons, (button) => {
|
|
3128
2987
|
return {
|
|
3129
2988
|
type: 'steedos-object-button',
|
|
3130
2989
|
name: button.name,
|
|
@@ -3157,7 +3016,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3157
3016
|
"vertical": true,
|
|
3158
3017
|
"tiled": true,
|
|
3159
3018
|
"buttons": [
|
|
3160
|
-
...
|
|
3019
|
+
...___namespace.map(buttons, (button)=>{
|
|
3161
3020
|
return {
|
|
3162
3021
|
type: 'steedos-object-button',
|
|
3163
3022
|
name: button.name,
|
|
@@ -3186,7 +3045,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3186
3045
|
}
|
|
3187
3046
|
}
|
|
3188
3047
|
}else {
|
|
3189
|
-
return
|
|
3048
|
+
return ___namespace.map(buttons, (button) => {
|
|
3190
3049
|
return {
|
|
3191
3050
|
type: 'steedos-object-button',
|
|
3192
3051
|
name: button.name,
|
|
@@ -3782,6 +3641,10 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
3782
3641
|
_$1.each(
|
|
3783
3642
|
objectSchema.list_views,
|
|
3784
3643
|
(listView, name) => {
|
|
3644
|
+
if(name === "lookup"){
|
|
3645
|
+
// 内置lookup为弹出选择专用视图,不显示在列表切换区域
|
|
3646
|
+
return;
|
|
3647
|
+
}
|
|
3785
3648
|
listViewButtonOptions.push({
|
|
3786
3649
|
type: "button",
|
|
3787
3650
|
label: listView.label,
|
|
@@ -5271,6 +5134,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
5271
5134
|
|
|
5272
5135
|
return {
|
|
5273
5136
|
"type": "tooltip-wrapper",
|
|
5137
|
+
"id": "steedos_crud_toolbar_quick_search",
|
|
5274
5138
|
"align": "right",
|
|
5275
5139
|
"title": "",
|
|
5276
5140
|
"content": "可搜索字段:" + searchableFieldsLabel.join(","),
|
|
@@ -5302,76 +5166,134 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
5302
5166
|
if(isMobile){
|
|
5303
5167
|
showDisplayAs = false;
|
|
5304
5168
|
}
|
|
5169
|
+
let toolbarCount;
|
|
5170
|
+
if(!hiddenCount){
|
|
5171
|
+
toolbarCount = {
|
|
5172
|
+
"type": "tpl",
|
|
5173
|
+
"tpl": "${count} " + i18next__default["default"].t('frontend_record_sum')
|
|
5174
|
+
};
|
|
5175
|
+
}
|
|
5176
|
+
let toolbarReloadButton;
|
|
5305
5177
|
if(formFactor === 'SMALL'){
|
|
5306
|
-
const onReloadScript = `
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
`;
|
|
5178
|
+
// const onReloadScript = `
|
|
5179
|
+
// const scope = event.context.scoped;
|
|
5180
|
+
// var listView = scope.parent.getComponents().find(function(n){
|
|
5181
|
+
// return n.props.type === "crud";
|
|
5182
|
+
// });
|
|
5183
|
+
// listView.handleChangePage(1);
|
|
5184
|
+
// `;
|
|
5185
|
+
// toolbarReloadButton = {
|
|
5186
|
+
// // "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页,这在加载更多按钮的翻页模式下会有问题
|
|
5187
|
+
// "type": "button",
|
|
5188
|
+
// "align": "right",
|
|
5189
|
+
// //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5190
|
+
// // "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5191
|
+
// "tooltipPlacement": "top",
|
|
5192
|
+
// "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5193
|
+
// "label": "",
|
|
5194
|
+
// "icon": "fa fa-sync",
|
|
5195
|
+
// "visibleOn": "${!showFieldsFilter}",
|
|
5196
|
+
// "onEvent": {
|
|
5197
|
+
// "click": {
|
|
5198
|
+
// "actions": [
|
|
5199
|
+
// {
|
|
5200
|
+
// "actionType": "custom",
|
|
5201
|
+
// "script": onReloadScript
|
|
5202
|
+
// }
|
|
5203
|
+
// ]
|
|
5204
|
+
// }
|
|
5205
|
+
// },
|
|
5206
|
+
// };
|
|
5207
|
+
|
|
5208
|
+
// 后续如果换成加载更多按钮的翻页模式的话,不可以直接使用下面的reload,需要换成上面的自定义脚本模式
|
|
5209
|
+
toolbarReloadButton = {
|
|
5210
|
+
"type": "reload",
|
|
5211
|
+
"align": "right",
|
|
5212
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5213
|
+
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5214
|
+
"tooltip":"",
|
|
5215
|
+
"tooltipPlacement": "top",
|
|
5216
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5217
|
+
};
|
|
5218
|
+
}
|
|
5219
|
+
else {
|
|
5220
|
+
toolbarReloadButton = {
|
|
5221
|
+
"type": "reload",
|
|
5222
|
+
"align": "right",
|
|
5223
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5224
|
+
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5225
|
+
"tooltip":"",
|
|
5226
|
+
"tooltipPlacement": "top",
|
|
5227
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5228
|
+
};
|
|
5229
|
+
}
|
|
5230
|
+
let toolbarFilter;
|
|
5231
|
+
if(filterVisible){
|
|
5232
|
+
toolbarFilter ={
|
|
5233
|
+
"label": i18next__default["default"].t('frontend_button_search_tooltip'),
|
|
5234
|
+
"icon": "fa fa-filter",
|
|
5235
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5236
|
+
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5237
|
+
// "tooltipPlacement": "top",
|
|
5238
|
+
"type": "button",
|
|
5239
|
+
"badge": {
|
|
5240
|
+
"offset": [
|
|
5241
|
+
-5,
|
|
5242
|
+
1
|
|
5243
|
+
],
|
|
5244
|
+
"size":8,
|
|
5245
|
+
"animation": true,
|
|
5246
|
+
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
5247
|
+
},
|
|
5248
|
+
"align": "right",
|
|
5249
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5250
|
+
"onEvent": {
|
|
5251
|
+
"click": {
|
|
5252
|
+
"actions": [
|
|
5253
|
+
{
|
|
5254
|
+
"actionType": "custom",
|
|
5255
|
+
"script": onFieldsFilterToggleScript
|
|
5256
|
+
}
|
|
5257
|
+
]
|
|
5258
|
+
}
|
|
5259
|
+
},
|
|
5260
|
+
"id": "steedos_crud_toolbar_filter"
|
|
5261
|
+
};
|
|
5262
|
+
}
|
|
5263
|
+
let toolbarDisplayAsButton = getDisplayAsButton(mainObject?.name);
|
|
5264
|
+
let toolbarDQuickSearchBox = getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName });
|
|
5265
|
+
|
|
5266
|
+
// toolbars返回的数组元素不可以是空对象{},比如hiddenCount ? {} : {"type": "tpl",...},因为空对象最终还是会生成一个空的.antd-Crud-toolbar-item dom
|
|
5267
|
+
// 当出现空的.antd-Crud-toolbar-item dom时会影响toolbar元素的maring-right css样式计算,如果有动态需要应该加到动态数组变量toolbars中
|
|
5268
|
+
let toolbars = [];
|
|
5269
|
+
if(formFactor === 'SMALL'){
|
|
5270
|
+
if(toolbarCount){
|
|
5271
|
+
toolbars.push(toolbarCount);
|
|
5272
|
+
}
|
|
5273
|
+
toolbars.push(toolbarReloadButton);
|
|
5274
|
+
if(toolbarFilter){
|
|
5275
|
+
toolbars.push(toolbarFilter);
|
|
5276
|
+
}
|
|
5277
|
+
toolbars.push(toolbarDisplayAsButton);
|
|
5278
|
+
toolbars.push(toolbarDQuickSearchBox);
|
|
5313
5279
|
return [
|
|
5314
5280
|
// "bulkActions",
|
|
5315
5281
|
...(headerToolbarItems || []),
|
|
5316
|
-
|
|
5317
|
-
"type": "tpl",
|
|
5318
|
-
"tpl": "${count} " + i18next__default["default"].t('frontend_record_sum')
|
|
5319
|
-
},
|
|
5320
|
-
{
|
|
5321
|
-
// "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
|
|
5322
|
-
"type": "button",
|
|
5323
|
-
"align": "right",
|
|
5324
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5325
|
-
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5326
|
-
"tooltipPlacement": "top",
|
|
5327
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5328
|
-
"label": "",
|
|
5329
|
-
"icon": "fa fa-sync",
|
|
5330
|
-
"visibleOn": "${!showFieldsFilter}",
|
|
5331
|
-
"onEvent": {
|
|
5332
|
-
"click": {
|
|
5333
|
-
"actions": [
|
|
5334
|
-
{
|
|
5335
|
-
"actionType": "custom",
|
|
5336
|
-
"script": onReloadScript
|
|
5337
|
-
}
|
|
5338
|
-
]
|
|
5339
|
-
}
|
|
5340
|
-
},
|
|
5341
|
-
},
|
|
5342
|
-
filterVisible ? {
|
|
5343
|
-
"label": i18next__default["default"].t('frontend_button_search_tooltip'),
|
|
5344
|
-
"icon": "fa fa-search",
|
|
5345
|
-
"type": "button",
|
|
5346
|
-
"tooltipPlacement": "top",
|
|
5347
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5348
|
-
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5349
|
-
"badge": {
|
|
5350
|
-
"offset": [
|
|
5351
|
-
-5,
|
|
5352
|
-
1
|
|
5353
|
-
],
|
|
5354
|
-
"size":8,
|
|
5355
|
-
"animation": true,
|
|
5356
|
-
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
5357
|
-
},
|
|
5358
|
-
"align": "right",
|
|
5359
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5360
|
-
"onEvent": {
|
|
5361
|
-
"click": {
|
|
5362
|
-
"actions": [
|
|
5363
|
-
{
|
|
5364
|
-
"actionType": "custom",
|
|
5365
|
-
"script": onFieldsFilterToggleScript
|
|
5366
|
-
}
|
|
5367
|
-
]
|
|
5368
|
-
}
|
|
5369
|
-
}
|
|
5370
|
-
} : {},
|
|
5371
|
-
getDisplayAsButton(mainObject?.name),
|
|
5372
|
-
getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName })
|
|
5282
|
+
...toolbars,
|
|
5373
5283
|
]
|
|
5374
5284
|
}else {
|
|
5285
|
+
if(toolbarCount){
|
|
5286
|
+
toolbars.push(toolbarCount);
|
|
5287
|
+
}
|
|
5288
|
+
if(toolbarFilter){
|
|
5289
|
+
toolbars.push(toolbarFilter);
|
|
5290
|
+
}
|
|
5291
|
+
toolbars.push(toolbarReloadButton);
|
|
5292
|
+
if(mainObject?.permissions?.allowCreateListViews){
|
|
5293
|
+
toolbars.push(getSettingListviewToolbarButtonSchema());
|
|
5294
|
+
}
|
|
5295
|
+
toolbars.push(toolbarDisplayAsButton);
|
|
5296
|
+
toolbars.push(toolbarDQuickSearchBox);
|
|
5375
5297
|
return [
|
|
5376
5298
|
// "filter-toggler",
|
|
5377
5299
|
...(headerToolbarItems || []),
|
|
@@ -5380,56 +5302,12 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
5380
5302
|
"type": "columns-toggler",
|
|
5381
5303
|
"className": "hidden"
|
|
5382
5304
|
},
|
|
5305
|
+
...toolbars,
|
|
5383
5306
|
// {
|
|
5384
5307
|
// "type": "columns-toggler",
|
|
5385
5308
|
// "className": "mr-2"
|
|
5386
5309
|
// },
|
|
5387
|
-
hiddenCount ? {} : {
|
|
5388
|
-
"type": "tpl",
|
|
5389
|
-
"tpl": "${count} " + i18next__default["default"].t('frontend_record_sum')
|
|
5390
|
-
},
|
|
5391
|
-
filterVisible ? {
|
|
5392
|
-
"label": i18next__default["default"].t('frontend_button_search_tooltip'),
|
|
5393
|
-
"icon": "fa fa-filter",
|
|
5394
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5395
|
-
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5396
|
-
// "tooltipPlacement": "top",
|
|
5397
|
-
"type": "button",
|
|
5398
|
-
"badge": {
|
|
5399
|
-
"offset": [
|
|
5400
|
-
-5,
|
|
5401
|
-
1
|
|
5402
|
-
],
|
|
5403
|
-
"size":8,
|
|
5404
|
-
"animation": true,
|
|
5405
|
-
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
5406
|
-
},
|
|
5407
|
-
"align": "right",
|
|
5408
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5409
|
-
"onEvent": {
|
|
5410
|
-
"click": {
|
|
5411
|
-
"actions": [
|
|
5412
|
-
{
|
|
5413
|
-
"actionType": "custom",
|
|
5414
|
-
"script": onFieldsFilterToggleScript
|
|
5415
|
-
}
|
|
5416
|
-
]
|
|
5417
|
-
}
|
|
5418
|
-
}
|
|
5419
|
-
} : {},
|
|
5420
|
-
{
|
|
5421
|
-
"type": "reload",
|
|
5422
|
-
"align": "right",
|
|
5423
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5424
|
-
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5425
|
-
"tooltip":"",
|
|
5426
|
-
"tooltipPlacement": "top",
|
|
5427
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5428
|
-
},
|
|
5429
5310
|
// getExportExcelToolbarButtonSchema(),
|
|
5430
|
-
mainObject?.permissions?.allowCreateListViews ? getSettingListviewToolbarButtonSchema() : {},
|
|
5431
|
-
getDisplayAsButton(mainObject?.name),
|
|
5432
|
-
getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName }),
|
|
5433
5311
|
// {
|
|
5434
5312
|
// "type": "drag-toggler",
|
|
5435
5313
|
// "align": "right"
|
|
@@ -5630,10 +5508,8 @@ async function getDeferApi(field, ctx) {
|
|
|
5630
5508
|
}
|
|
5631
5509
|
|
|
5632
5510
|
function getRefListViewSort(refObject){
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
(view, name) => name === "all"
|
|
5636
|
-
);
|
|
5511
|
+
let listView = getLookupListView(refObject);
|
|
5512
|
+
|
|
5637
5513
|
let sort = "";
|
|
5638
5514
|
if(listView){
|
|
5639
5515
|
sort = getListViewSort(listView);
|
|
@@ -5723,12 +5599,11 @@ const getReferenceTo = async (field)=>{
|
|
|
5723
5599
|
}
|
|
5724
5600
|
};
|
|
5725
5601
|
|
|
5726
|
-
function getLookupSapceUserTreeSchema(){
|
|
5727
|
-
const
|
|
5602
|
+
function getLookupSapceUserTreeSchema(isMobile){
|
|
5603
|
+
const treeSchema = {
|
|
5728
5604
|
"type": "input-tree",
|
|
5729
|
-
"className":
|
|
5605
|
+
"className":"steedos-select-user-tree",
|
|
5730
5606
|
"inputClassName": "p-0",
|
|
5731
|
-
"id": "u:7fd77b7915b0",
|
|
5732
5607
|
"source": {
|
|
5733
5608
|
"method": "post",
|
|
5734
5609
|
"url": "${context.rootUrl}/graphql",
|
|
@@ -5759,6 +5634,10 @@ function getLookupSapceUserTreeSchema(){
|
|
|
5759
5634
|
});
|
|
5760
5635
|
listView.handleFilterSubmit(Object.assign({}, filterFormValues));
|
|
5761
5636
|
`
|
|
5637
|
+
},
|
|
5638
|
+
{
|
|
5639
|
+
"actionType": "custom",
|
|
5640
|
+
"script": " if(window.innerWidth < 768){ document.querySelector('.steedos-select-user-sidebar').classList.remove('steedos-select-user-sidebar-open'); }"
|
|
5762
5641
|
}
|
|
5763
5642
|
]
|
|
5764
5643
|
}
|
|
@@ -5783,18 +5662,56 @@ function getLookupSapceUserTreeSchema(){
|
|
|
5783
5662
|
"placeholder": "查找部门"
|
|
5784
5663
|
},
|
|
5785
5664
|
"unfoldedLevel": 2,
|
|
5786
|
-
"style": {
|
|
5787
|
-
"max-height": "100%",
|
|
5788
|
-
"position": "absolute",
|
|
5789
|
-
"left": "-330px",
|
|
5790
|
-
"width": "320px",
|
|
5791
|
-
"bottom": 0,
|
|
5792
|
-
"top": "0",
|
|
5793
|
-
"overflow": "auto",
|
|
5794
|
-
"min-height":"300px"
|
|
5795
|
-
},
|
|
5796
5665
|
"originPosition": "left-top"
|
|
5797
|
-
}
|
|
5666
|
+
};
|
|
5667
|
+
const tree = [];
|
|
5668
|
+
if(isMobile){
|
|
5669
|
+
tree.push({
|
|
5670
|
+
type: "action",
|
|
5671
|
+
body:[
|
|
5672
|
+
{
|
|
5673
|
+
type: "action",
|
|
5674
|
+
body:[
|
|
5675
|
+
treeSchema
|
|
5676
|
+
],
|
|
5677
|
+
className:"h-full w-[240px]"
|
|
5678
|
+
}
|
|
5679
|
+
],
|
|
5680
|
+
className: "absolute inset-0 steedos-select-user-sidebar",
|
|
5681
|
+
"onEvent": {
|
|
5682
|
+
"click": {
|
|
5683
|
+
"actions": [
|
|
5684
|
+
{
|
|
5685
|
+
"actionType": "custom",
|
|
5686
|
+
"script": "document.querySelector('.steedos-select-user-sidebar').classList.remove('steedos-select-user-sidebar-open')"
|
|
5687
|
+
}
|
|
5688
|
+
]
|
|
5689
|
+
}
|
|
5690
|
+
},
|
|
5691
|
+
id: "steedos_crud_toolbar_select_user_tree"
|
|
5692
|
+
});
|
|
5693
|
+
tree.push({
|
|
5694
|
+
"type": "button",
|
|
5695
|
+
"label": "组织",
|
|
5696
|
+
"icon": "fa fa-sitemap",
|
|
5697
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5698
|
+
"align": "left",
|
|
5699
|
+
"onEvent": {
|
|
5700
|
+
"click": {
|
|
5701
|
+
"actions": [
|
|
5702
|
+
{
|
|
5703
|
+
"actionType": "custom",
|
|
5704
|
+
"script": "document.querySelector('.steedos-select-user-sidebar').classList.toggle('steedos-select-user-sidebar-open')"
|
|
5705
|
+
}
|
|
5706
|
+
]
|
|
5707
|
+
}
|
|
5708
|
+
},
|
|
5709
|
+
"id": "steedos_crud_toolbar_organization_button"
|
|
5710
|
+
});
|
|
5711
|
+
}else {
|
|
5712
|
+
tree.push(treeSchema);
|
|
5713
|
+
}
|
|
5714
|
+
|
|
5798
5715
|
return tree;
|
|
5799
5716
|
}
|
|
5800
5717
|
|
|
@@ -5809,19 +5726,14 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5809
5726
|
ctx.objectName = refObjectConfig.name;
|
|
5810
5727
|
|
|
5811
5728
|
let tableFields = [];
|
|
5812
|
-
let i = 0;
|
|
5813
5729
|
const searchableFields = [];
|
|
5814
5730
|
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
const listName = "all";
|
|
5731
|
+
let fieldsArr = [];
|
|
5818
5732
|
|
|
5819
5733
|
const isMobile = window.innerWidth < 768;
|
|
5820
5734
|
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
(listView, name) => name === listName
|
|
5824
|
-
);
|
|
5735
|
+
let listView = getLookupListView(refObjectConfig);
|
|
5736
|
+
let listName = listView && listView.name;
|
|
5825
5737
|
if (listView && listView.columns) {
|
|
5826
5738
|
___namespace.each(listView.columns, function (column) {
|
|
5827
5739
|
if (___namespace.isString(column) && refObjectConfig.fields[column]) {
|
|
@@ -5836,7 +5748,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5836
5748
|
}
|
|
5837
5749
|
});
|
|
5838
5750
|
}else {
|
|
5839
|
-
___namespace.each(refObjectConfig.fields
|
|
5751
|
+
___namespace.each(refObjectConfig.fields, (field, field_name)=>{
|
|
5840
5752
|
if(field_name != '_id' && !field.hidden){
|
|
5841
5753
|
if(!___namespace.has(field, "name")){
|
|
5842
5754
|
field.name = field_name;
|
|
@@ -5844,16 +5756,15 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5844
5756
|
fieldsArr.push(field);
|
|
5845
5757
|
}
|
|
5846
5758
|
});
|
|
5759
|
+
// 没有视图权限时,取对象上前5个字段,按sort_no排序
|
|
5760
|
+
fieldsArr = ___namespace.sortBy(fieldsArr, "sort_no").slice(0,5);
|
|
5847
5761
|
}
|
|
5848
5762
|
|
|
5849
|
-
___namespace.each(
|
|
5850
|
-
if(
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
i++;
|
|
5855
|
-
tableFields.push(field);
|
|
5856
|
-
}
|
|
5763
|
+
___namespace.each(fieldsArr,function(field){
|
|
5764
|
+
if(!___namespace.find(tableFields, function(f){
|
|
5765
|
+
return f.name === field.name
|
|
5766
|
+
})){
|
|
5767
|
+
tableFields.push(field);
|
|
5857
5768
|
}
|
|
5858
5769
|
});
|
|
5859
5770
|
|
|
@@ -6047,13 +5958,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
6047
5958
|
}
|
|
6048
5959
|
|
|
6049
5960
|
let pickerSchema = null;
|
|
6050
|
-
|
|
6051
|
-
pickerSchema = await getListSchema$1(tableFields, {
|
|
6052
|
-
top: top,
|
|
6053
|
-
...ctx,
|
|
6054
|
-
actions: false
|
|
6055
|
-
});
|
|
6056
|
-
}else {
|
|
5961
|
+
{
|
|
6057
5962
|
pickerSchema = await getTableSchema$1(tableFields, {
|
|
6058
5963
|
labelFieldName: refObjectConfig.NAME_FIELD_KEY,
|
|
6059
5964
|
top: top,
|
|
@@ -6064,13 +5969,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
6064
5969
|
pickerSchema.affixHeader = false;
|
|
6065
5970
|
|
|
6066
5971
|
var headerToolbarItems = [];
|
|
6067
|
-
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
"margin-left":"330px",
|
|
6071
|
-
"min-height": "300px"
|
|
6072
|
-
};
|
|
6073
|
-
pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
|
|
5972
|
+
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
|
|
5973
|
+
headerToolbarItems = getLookupSapceUserTreeSchema(isMobile);
|
|
5974
|
+
pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
|
|
6074
5975
|
}
|
|
6075
5976
|
|
|
6076
5977
|
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
|
|
@@ -6166,13 +6067,25 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
6166
6067
|
pickerSchema = Object.assign({}, pickerSchema, field.pickerSchema);
|
|
6167
6068
|
}
|
|
6168
6069
|
|
|
6070
|
+
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && isMobile){
|
|
6071
|
+
//手机端选人控件只保留部分toolbar
|
|
6072
|
+
pickerSchema.headerToolbar = pickerSchema.headerToolbar && pickerSchema.headerToolbar.filter(function(item){
|
|
6073
|
+
if(["steedos_crud_toolbar_quick_search","steedos_crud_toolbar_filter","steedos_crud_toolbar_select_user_tree","steedos_crud_toolbar_organization_button"].indexOf(item.id) > -1){
|
|
6074
|
+
return true;
|
|
6075
|
+
}else {
|
|
6076
|
+
return false;
|
|
6077
|
+
}
|
|
6078
|
+
});
|
|
6079
|
+
pickerSchema.footerToolbar = ["pagination"];
|
|
6080
|
+
}
|
|
6081
|
+
|
|
6169
6082
|
const data = {
|
|
6170
6083
|
type: getAmisStaticFieldType('picker', readonly),
|
|
6171
6084
|
modalTitle: i18next__default["default"].t('frontend_form_please_select') + " " + refObjectConfig.label,
|
|
6172
6085
|
labelField: referenceTo.labelField.name,
|
|
6173
6086
|
valueField: referenceTo.valueField.name,
|
|
6174
|
-
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey
|
|
6175
|
-
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
|
|
6087
|
+
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
|
|
6088
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
6176
6089
|
modalMode: 'dialog', //TODO 设置 dialog 或者 drawer,用来配置弹出方式
|
|
6177
6090
|
source: source,
|
|
6178
6091
|
size: "lg",
|
|
@@ -6238,10 +6151,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
6238
6151
|
}
|
|
6239
6152
|
|
|
6240
6153
|
const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
|
|
6241
|
-
|
|
6242
|
-
refObjectConfig.list_views,
|
|
6243
|
-
(listView, name) => name === "all"
|
|
6244
|
-
);
|
|
6154
|
+
let listView = getLookupListView(refObjectConfig);
|
|
6245
6155
|
|
|
6246
6156
|
let sort = "";
|
|
6247
6157
|
if(listView){
|
|
@@ -6352,8 +6262,8 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
6352
6262
|
joinValues: false,
|
|
6353
6263
|
extractValue: true,
|
|
6354
6264
|
clearable: true,
|
|
6355
|
-
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey
|
|
6356
|
-
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
|
|
6265
|
+
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
|
|
6266
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
6357
6267
|
// labelField: labelField,
|
|
6358
6268
|
// valueField: valueField,
|
|
6359
6269
|
source: apiInfo,
|
|
@@ -6422,6 +6332,7 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
6422
6332
|
}
|
|
6423
6333
|
|
|
6424
6334
|
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
|
|
6335
|
+
ctx.onlyDisplayLookLabel = true;
|
|
6425
6336
|
if(ctx.idsDependOn){
|
|
6426
6337
|
// ids人员点选模式
|
|
6427
6338
|
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
@@ -6475,7 +6386,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6475
6386
|
|
|
6476
6387
|
const tableFields = [referenceTo.labelField];
|
|
6477
6388
|
|
|
6478
|
-
const source = await getApi$1(refObjectConfig, null, fields, {expand: true, alias: 'rows', queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}`});
|
|
6389
|
+
const source = await getApi$1(refObjectConfig, null, fields, {expand: true, alias: 'rows', queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
|
|
6479
6390
|
|
|
6480
6391
|
source.data.$term = "$term";
|
|
6481
6392
|
source.data.$self = "$$";
|
|
@@ -6484,6 +6395,12 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6484
6395
|
source.sendOn = `\${${idsDependOn} && ${idsDependOn}.length}`;
|
|
6485
6396
|
source.url = `${source.url}&depend_on_${idsDependOn}=\${${idsDependOn}|join}`;
|
|
6486
6397
|
}
|
|
6398
|
+
|
|
6399
|
+
let listView = getLookupListView(refObjectConfig);
|
|
6400
|
+
let sort = "";
|
|
6401
|
+
if(listView){
|
|
6402
|
+
sort = getListViewSort(listView);
|
|
6403
|
+
}
|
|
6487
6404
|
|
|
6488
6405
|
source.requestAdaptor = `
|
|
6489
6406
|
const selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
@@ -6491,6 +6408,10 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6491
6408
|
var pageSize = api.data.pageSize || 1000;
|
|
6492
6409
|
var pageNo = api.data.pageNo || 1;
|
|
6493
6410
|
var skip = (pageNo - 1) * pageSize;
|
|
6411
|
+
var orderBy = api.data.orderBy || '';
|
|
6412
|
+
var orderDir = api.data.orderDir || '';
|
|
6413
|
+
var sort = orderBy + ' ' + orderDir;
|
|
6414
|
+
sort = orderBy ? sort : "${sort}";
|
|
6494
6415
|
if(selfData.op === 'loadOptions' && selfData.value){
|
|
6495
6416
|
if(selfData.value && selfData.value.indexOf(',') > 0){
|
|
6496
6417
|
filters = [["${referenceTo.valueField.name}", "=", selfData.value.split(',')]];
|
|
@@ -6508,7 +6429,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6508
6429
|
filters.push(["${referenceTo.valueField.name}", "=", ids]);
|
|
6509
6430
|
}
|
|
6510
6431
|
|
|
6511
|
-
api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip);
|
|
6432
|
+
api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim());
|
|
6512
6433
|
return api;
|
|
6513
6434
|
`;
|
|
6514
6435
|
|
|
@@ -6525,6 +6446,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6525
6446
|
pickerSchema = await getTableSchema$1(tableFields, {
|
|
6526
6447
|
labelFieldName: refObjectConfig.NAME_FIELD_KEY,
|
|
6527
6448
|
top: top,
|
|
6449
|
+
isLookup: true,
|
|
6528
6450
|
...ctx
|
|
6529
6451
|
});
|
|
6530
6452
|
|
|
@@ -6538,8 +6460,8 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6538
6460
|
valueField: referenceTo.valueField.name,
|
|
6539
6461
|
modalMode: 'dialog',
|
|
6540
6462
|
source: source,
|
|
6541
|
-
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey
|
|
6542
|
-
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
|
|
6463
|
+
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
|
|
6464
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
6543
6465
|
size: "lg",
|
|
6544
6466
|
pickerSchema: pickerSchema,
|
|
6545
6467
|
joinValues: false,
|
|
@@ -6567,8 +6489,8 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6567
6489
|
/*
|
|
6568
6490
|
* @Author: baozhoutao@steedos.com
|
|
6569
6491
|
* @Date: 2023-01-13 17:27:54
|
|
6570
|
-
* @LastEditors:
|
|
6571
|
-
* @LastEditTime: 2023-
|
|
6492
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
6493
|
+
* @LastEditTime: 2023-08-28 17:45:38
|
|
6572
6494
|
* @Description:
|
|
6573
6495
|
*/
|
|
6574
6496
|
|
|
@@ -6630,18 +6552,47 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
|
|
|
6630
6552
|
|
|
6631
6553
|
const getHtmlFieldSchema = (field, readonly, ctx)=>{
|
|
6632
6554
|
if(readonly){
|
|
6555
|
+
// return {
|
|
6556
|
+
// "type": "control",
|
|
6557
|
+
// "label": field.label,
|
|
6558
|
+
// "body": {
|
|
6559
|
+
// "type": "html",
|
|
6560
|
+
// "name": field.name
|
|
6561
|
+
// }
|
|
6562
|
+
// }
|
|
6633
6563
|
return {
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6564
|
+
"type": "input-rich-text",
|
|
6565
|
+
"receiver": "${context.rootUrl}/s3/images",
|
|
6566
|
+
"name": field.name,
|
|
6567
|
+
"options": {
|
|
6568
|
+
"menu": {
|
|
6569
|
+
"insert": {
|
|
6570
|
+
"title": "Insert",
|
|
6571
|
+
"items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
|
|
6572
|
+
}
|
|
6573
|
+
},
|
|
6574
|
+
"plugins": [
|
|
6575
|
+
"autoresize"
|
|
6576
|
+
],
|
|
6577
|
+
// "max_height": 2000,
|
|
6578
|
+
"statusbar": false,
|
|
6579
|
+
"readonly": true,
|
|
6580
|
+
"toolbar": false,
|
|
6581
|
+
"menubar": false
|
|
6640
6582
|
}
|
|
6583
|
+
}
|
|
6641
6584
|
}else {
|
|
6642
6585
|
return {
|
|
6643
6586
|
"type": "input-rich-text",
|
|
6644
6587
|
"receiver": "${context.rootUrl}/s3/images",
|
|
6588
|
+
"options":{
|
|
6589
|
+
"menu": {
|
|
6590
|
+
"insert": {
|
|
6591
|
+
"title": "Insert",
|
|
6592
|
+
"items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
|
|
6593
|
+
}
|
|
6594
|
+
}
|
|
6595
|
+
},
|
|
6645
6596
|
"name": field.name
|
|
6646
6597
|
}
|
|
6647
6598
|
// return {
|
|
@@ -6695,6 +6646,9 @@ function getAmisStaticFieldType(type, readonly, options){
|
|
|
6695
6646
|
return type;
|
|
6696
6647
|
}
|
|
6697
6648
|
if(___namespace.includes(['text','image'], type)){
|
|
6649
|
+
if('text' === type && options && options.amis && options.amis.tpl){
|
|
6650
|
+
return 'static';
|
|
6651
|
+
}
|
|
6698
6652
|
if('image' === type && options && options.multiple){
|
|
6699
6653
|
return `static-images`;
|
|
6700
6654
|
}
|
|
@@ -6965,7 +6919,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
6965
6919
|
// }
|
|
6966
6920
|
switch (field.type) {
|
|
6967
6921
|
case 'text':
|
|
6968
|
-
convertData.type = getAmisStaticFieldType('text', readonly);
|
|
6922
|
+
convertData.type = getAmisStaticFieldType('text', readonly, field);
|
|
6969
6923
|
break;
|
|
6970
6924
|
case 'textarea':
|
|
6971
6925
|
convertData.type = getAmisStaticFieldType('textarea', readonly);
|
|
@@ -7412,7 +7366,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
7412
7366
|
convertData.className = 'm-1';
|
|
7413
7367
|
}
|
|
7414
7368
|
if(readonly){
|
|
7415
|
-
convertData.className = `${convertData.className}
|
|
7369
|
+
convertData.className = `${convertData.className} border-b`;
|
|
7416
7370
|
}
|
|
7417
7371
|
if(readonly){
|
|
7418
7372
|
convertData.quickEdit = false;
|
|
@@ -7882,7 +7836,10 @@ function getFieldWidth(width){
|
|
|
7882
7836
|
}
|
|
7883
7837
|
|
|
7884
7838
|
async function getTableColumns(fields, options){
|
|
7885
|
-
const columns = [
|
|
7839
|
+
const columns = [];
|
|
7840
|
+
if(!options.isLookup){
|
|
7841
|
+
columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
|
|
7842
|
+
}
|
|
7886
7843
|
const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
|
|
7887
7844
|
|
|
7888
7845
|
for (const field of fields) {
|
|
@@ -8117,7 +8074,7 @@ async function getMobileTableColumns(fields, options){
|
|
|
8117
8074
|
let tpl = "";
|
|
8118
8075
|
if(field.is_name || field.name === options.labelFieldName){
|
|
8119
8076
|
nameField = field;
|
|
8120
|
-
options.
|
|
8077
|
+
options.onlyDisplayLookLabel = true;
|
|
8121
8078
|
tpl = await getFieldTpl(field, options);
|
|
8122
8079
|
}
|
|
8123
8080
|
else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
|
|
@@ -8126,12 +8083,13 @@ async function getMobileTableColumns(fields, options){
|
|
|
8126
8083
|
}
|
|
8127
8084
|
else {
|
|
8128
8085
|
if(field.type === 'lookup' || field.type === 'master_detail'){
|
|
8129
|
-
options.
|
|
8086
|
+
options.onlyDisplayLookLabel = true;
|
|
8130
8087
|
}
|
|
8131
8088
|
tpl = await getFieldTpl(field, options);
|
|
8132
8089
|
}
|
|
8133
8090
|
if(!tpl){
|
|
8134
|
-
|
|
8091
|
+
//qhd需求简易处理,加上raw以支持审批王名称字段通过颜色区分缓急,若之后手机端列表支持配置amis,则可以去掉
|
|
8092
|
+
tpl = `\${${field.name} | raw}`;
|
|
8135
8093
|
}
|
|
8136
8094
|
if(!field.hidden && !field.extra){
|
|
8137
8095
|
tpls.push({ field, tpl });
|
|
@@ -8327,7 +8285,12 @@ async function getTableSchema$1(fields, options){
|
|
|
8327
8285
|
options = {};
|
|
8328
8286
|
}
|
|
8329
8287
|
let columns = [];
|
|
8330
|
-
|
|
8288
|
+
let useMobileColumns = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
|
|
8289
|
+
if(isLookup){
|
|
8290
|
+
// 在lookup手机端列表模式调式好之前不使用getMobileTableColumns
|
|
8291
|
+
useMobileColumns = false;
|
|
8292
|
+
}
|
|
8293
|
+
if(useMobileColumns){
|
|
8331
8294
|
columns = await getMobileTableColumns(fields, options);
|
|
8332
8295
|
}
|
|
8333
8296
|
else {
|
|
@@ -8347,7 +8310,7 @@ async function getTableSchema$1(fields, options){
|
|
|
8347
8310
|
columns: columns,
|
|
8348
8311
|
syncLocation: false,
|
|
8349
8312
|
keepItemSelectionOnPageChange: true,
|
|
8350
|
-
checkOnItemClick: false,
|
|
8313
|
+
checkOnItemClick: isLookup ? true : false,
|
|
8351
8314
|
labelTpl: `\${${options.labelFieldName}}`,
|
|
8352
8315
|
autoFillHeight: false, // 自动高度效果不理想,先关闭
|
|
8353
8316
|
columnsTogglable: false,
|
|
@@ -8971,7 +8934,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
8971
8934
|
var defaultValues = {};
|
|
8972
8935
|
_.each(uiSchema && uiSchema.fields, function(field){
|
|
8973
8936
|
var value = SteedosUI.getFieldDefaultValue(field, api.body.global);
|
|
8974
|
-
if(value){
|
|
8937
|
+
if(!_.isNil(value)){
|
|
8975
8938
|
defaultValues[field.name] = value;
|
|
8976
8939
|
}
|
|
8977
8940
|
});
|
|
@@ -9629,14 +9592,15 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
9629
9592
|
/*
|
|
9630
9593
|
* @Author: baozhoutao@steedos.com
|
|
9631
9594
|
* @Date: 2022-05-26 16:02:08
|
|
9632
|
-
* @LastEditors:
|
|
9633
|
-
* @LastEditTime: 2023-
|
|
9595
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
9596
|
+
* @LastEditTime: 2023-09-05 15:42:26
|
|
9634
9597
|
* @Description:
|
|
9635
9598
|
*/
|
|
9636
9599
|
|
|
9637
|
-
const getFieldSchemaArray = (formFields) => {
|
|
9600
|
+
const getFieldSchemaArray = (formFields, ctx) => {
|
|
9638
9601
|
let fieldSchemaArray = [];
|
|
9639
9602
|
fieldSchemaArray.length = 0;
|
|
9603
|
+
const recordId = ctx && ctx.recordId;
|
|
9640
9604
|
|
|
9641
9605
|
___namespace.forEach(formFields, (field) => {
|
|
9642
9606
|
if (!field.group || field.group == 'null' || field.group == '-')
|
|
@@ -9648,8 +9612,14 @@ const getFieldSchemaArray = (formFields) => {
|
|
|
9648
9612
|
field.is_wide = true;
|
|
9649
9613
|
}
|
|
9650
9614
|
|
|
9615
|
+
let forceHidden = false;
|
|
9616
|
+
if(!recordId && field.readonly){
|
|
9617
|
+
// 新建记录时,只读字段先隐藏,后续支持显示后,即任务:https://github.com/steedos/steedos-platform/issues/3164 完成后再放开
|
|
9618
|
+
forceHidden = true;
|
|
9619
|
+
}
|
|
9620
|
+
|
|
9651
9621
|
if (!isObjectField) {
|
|
9652
|
-
if (!field.hidden) {
|
|
9622
|
+
if (!field.hidden && !forceHidden) {
|
|
9653
9623
|
fieldSchemaArray.push(Object.assign({ name: fieldName }, field, { permission: { allowEdit: true } }));
|
|
9654
9624
|
}
|
|
9655
9625
|
}
|
|
@@ -9720,7 +9690,7 @@ const getSections = async (permissionFields, formFields, ctx) => {
|
|
|
9720
9690
|
if (!ctx) {
|
|
9721
9691
|
ctx = {};
|
|
9722
9692
|
}
|
|
9723
|
-
const fieldSchemaArray = getFieldSchemaArray(formFields);
|
|
9693
|
+
const fieldSchemaArray = getFieldSchemaArray(formFields, ctx);
|
|
9724
9694
|
const _sections = ___namespace.groupBy(fieldSchemaArray, 'group');
|
|
9725
9695
|
const sections = [];
|
|
9726
9696
|
var sectionVisibleOns = [];
|
|
@@ -9941,7 +9911,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
9941
9911
|
}
|
|
9942
9912
|
`;
|
|
9943
9913
|
let autoFillHeight = true;
|
|
9944
|
-
if(options.isRelated ||
|
|
9914
|
+
if(options.isRelated || window.innerWidth < 768){
|
|
9945
9915
|
autoFillHeight = false;
|
|
9946
9916
|
}
|
|
9947
9917
|
|
|
@@ -10314,7 +10284,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
10314
10284
|
* @Author: baozhoutao@steedos.com
|
|
10315
10285
|
* @Date: 2022-07-05 15:55:39
|
|
10316
10286
|
* @LastEditors: liaodaxue
|
|
10317
|
-
* @LastEditTime: 2023-08-
|
|
10287
|
+
* @LastEditTime: 2023-08-28 14:55:23
|
|
10318
10288
|
* @Description:
|
|
10319
10289
|
*/
|
|
10320
10290
|
|
|
@@ -10460,11 +10430,16 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
10460
10430
|
// }
|
|
10461
10431
|
const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel, ctx);
|
|
10462
10432
|
const componentId = `steedos-record-related-list-${relatedObjectName}`;
|
|
10433
|
+
const isMobile = window.innerWidth < 768;
|
|
10434
|
+
let headerToolbar = [];
|
|
10435
|
+
if(!isMobile){
|
|
10436
|
+
headerToolbar.push("bulkActions");
|
|
10437
|
+
}
|
|
10463
10438
|
const options = {
|
|
10464
10439
|
globalFilter,
|
|
10465
10440
|
defaults: {
|
|
10466
10441
|
listSchema: {
|
|
10467
|
-
headerToolbar
|
|
10442
|
+
headerToolbar,
|
|
10468
10443
|
columnsTogglable: false,
|
|
10469
10444
|
onEvent: {
|
|
10470
10445
|
[`@data.changed.${relatedObjectName}`]: {
|