@steedos-widgets/amis-lib 1.3.0-beta.9 → 1.3.1
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 +463 -485
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +463 -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.esm.js
CHANGED
|
@@ -382,8 +382,8 @@ const Router = {
|
|
|
382
382
|
/*
|
|
383
383
|
* @Author: baozhoutao@steedos.com
|
|
384
384
|
* @Date: 2022-07-20 16:29:22
|
|
385
|
-
* @LastEditors:
|
|
386
|
-
* @LastEditTime: 2023-
|
|
385
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
386
|
+
* @LastEditTime: 2023-09-08 14:09:48
|
|
387
387
|
* @Description:
|
|
388
388
|
*/
|
|
389
389
|
|
|
@@ -396,11 +396,40 @@ function getContrastColor(bgColor) {
|
|
|
396
396
|
return brightness < 128 ? "#ffffff" : "#000000";
|
|
397
397
|
}
|
|
398
398
|
|
|
399
|
+
function getLookupListView(refObjectConfig) {
|
|
400
|
+
if(!refObjectConfig){
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
403
|
+
const listNameAll = "all";
|
|
404
|
+
const listNameLookup = "lookup";
|
|
405
|
+
let listViewAll, listViewLookup;
|
|
406
|
+
|
|
407
|
+
_.each(
|
|
408
|
+
refObjectConfig.list_views,
|
|
409
|
+
(view, name) => {
|
|
410
|
+
if (name === listNameAll) {
|
|
411
|
+
listViewAll = view;
|
|
412
|
+
if(!listViewAll.name){
|
|
413
|
+
listViewAll.name = name;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
else if (name === listNameLookup) {
|
|
417
|
+
listViewLookup = view;
|
|
418
|
+
if(!listViewLookup.name){
|
|
419
|
+
listViewLookup.name = name;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
);
|
|
424
|
+
let listView = listViewLookup || listViewAll;
|
|
425
|
+
return listView;
|
|
426
|
+
}
|
|
427
|
+
|
|
399
428
|
/*
|
|
400
429
|
* @Author: baozhoutao@steedos.com
|
|
401
430
|
* @Date: 2022-05-23 09:53:08
|
|
402
431
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
403
|
-
* @LastEditTime: 2023-08-
|
|
432
|
+
* @LastEditTime: 2023-08-29 15:04:39
|
|
404
433
|
* @Description:
|
|
405
434
|
*/
|
|
406
435
|
|
|
@@ -504,7 +533,7 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
504
533
|
linkTarget = "target='_blank'";
|
|
505
534
|
}
|
|
506
535
|
|
|
507
|
-
const
|
|
536
|
+
const onlyDisplayLookLabel = ctx.onlyDisplayLookLabel;
|
|
508
537
|
|
|
509
538
|
let fieldDataStrTpl = `data._display.${field.name}`;
|
|
510
539
|
|
|
@@ -515,7 +544,7 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
515
544
|
if(_.isString(field.reference_to) || !field.reference_to){
|
|
516
545
|
if(field.multiple){
|
|
517
546
|
let labelTpl = `<%=item.label%>`;
|
|
518
|
-
if(!
|
|
547
|
+
if(!onlyDisplayLookLabel){
|
|
519
548
|
const href = Router.getObjectDetailPath({
|
|
520
549
|
formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
|
|
521
550
|
});
|
|
@@ -533,7 +562,7 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
533
562
|
objectNameTpl = `\${${field.name}.objectName}`;
|
|
534
563
|
recordIdTpl = `\${${field.name}.value}`;
|
|
535
564
|
}
|
|
536
|
-
if(!
|
|
565
|
+
if(!onlyDisplayLookLabel){
|
|
537
566
|
const href = Router.getObjectDetailPath({
|
|
538
567
|
formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
|
|
539
568
|
});
|
|
@@ -545,7 +574,7 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
545
574
|
|
|
546
575
|
}else {
|
|
547
576
|
let labelTpl = `<%=item.label%>`;
|
|
548
|
-
if(!
|
|
577
|
+
if(!onlyDisplayLookLabel){
|
|
549
578
|
const href = Router.getObjectDetailPath({
|
|
550
579
|
formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
|
|
551
580
|
});
|
|
@@ -598,7 +627,7 @@ function getLocationTpl(field){
|
|
|
598
627
|
}
|
|
599
628
|
|
|
600
629
|
async function getFieldTpl (field, options){
|
|
601
|
-
if((field.is_name || field.name === options.labelFieldName) && !options.
|
|
630
|
+
if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLookLabel){
|
|
602
631
|
return getNameTpl(field, options)
|
|
603
632
|
}
|
|
604
633
|
switch (field.type) {
|
|
@@ -968,7 +997,7 @@ function getApi$2 (isMobile){
|
|
|
968
997
|
}
|
|
969
998
|
}
|
|
970
999
|
|
|
971
|
-
var frontend_field_group_generalization$1 = "
|
|
1000
|
+
var frontend_field_group_generalization$1 = "General";
|
|
972
1001
|
var frontend_download$1 = "Download";
|
|
973
1002
|
var frontend_form_save$1 = "Save";
|
|
974
1003
|
var frontend_form_save_and_new$1 = "Save and New";
|
|
@@ -1653,10 +1682,7 @@ async function getSearchApi(field, ctx) {
|
|
|
1653
1682
|
}
|
|
1654
1683
|
|
|
1655
1684
|
function getRefListViewSort$1(refObject){
|
|
1656
|
-
|
|
1657
|
-
refObject.list_views,
|
|
1658
|
-
(view, name) => name === "all"
|
|
1659
|
-
);
|
|
1685
|
+
let listView = getLookupListView(refObject);
|
|
1660
1686
|
let sort = "";
|
|
1661
1687
|
if(listView){
|
|
1662
1688
|
sort = getListViewSort(listView);
|
|
@@ -2165,257 +2191,92 @@ const getSchema$2 = (uiSchema) => {
|
|
|
2165
2191
|
title: i18next.t('frontend_import_data'),
|
|
2166
2192
|
body: [
|
|
2167
2193
|
{
|
|
2168
|
-
type: "form",
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
api: {
|
|
2177
|
-
method: "post",
|
|
2178
|
-
url: "${context.rootUrl}/graphql",
|
|
2179
|
-
data: {
|
|
2180
|
-
objectName: "queue_import_history",
|
|
2181
|
-
$: "$$",
|
|
2182
|
-
},
|
|
2183
|
-
requestAdaptor:
|
|
2184
|
-
"\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 ",
|
|
2185
|
-
responseData: {
|
|
2186
|
-
recordId: "${record._id}",
|
|
2187
|
-
},
|
|
2188
|
-
adaptor:
|
|
2189
|
-
"console.log('payload', payload)\n return payload;\n ",
|
|
2190
|
-
headers: {
|
|
2191
|
-
Authorization:
|
|
2192
|
-
"Bearer ${context.tenantId},${context.authToken}",
|
|
2193
|
-
},
|
|
2194
|
-
dataType: "json",
|
|
2194
|
+
"type": "steedos-object-form",
|
|
2195
|
+
"label": "对象表单",
|
|
2196
|
+
"objectApiName": "queue_import_history",
|
|
2197
|
+
"recordId": "",
|
|
2198
|
+
"mode": "edit",
|
|
2199
|
+
"layout": "normal",
|
|
2200
|
+
"defaultData":{
|
|
2201
|
+
"object_name": "${objectName}"
|
|
2195
2202
|
},
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
},
|
|
2225
|
-
headers: {
|
|
2226
|
-
Authorization:
|
|
2227
|
-
"Bearer ${context.tenantId},${context.authToken}",
|
|
2228
|
-
},
|
|
2229
|
-
requestAdaptor:
|
|
2230
|
-
"\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 ",
|
|
2231
|
-
},
|
|
2232
|
-
className: "m-1",
|
|
2233
|
-
labelClassName: "text-left",
|
|
2234
|
-
clearValueOnHidden: false,
|
|
2235
|
-
id: "u:04295fee3896",
|
|
2236
|
-
multiple: false,
|
|
2237
|
-
hidden: true,
|
|
2238
|
-
},
|
|
2239
|
-
{
|
|
2240
|
-
name: "queue_import",
|
|
2241
|
-
label: i18next.t('frontend_import_data_queue_import'),
|
|
2242
|
-
required: true,
|
|
2243
|
-
type: "picker",
|
|
2244
|
-
labelField: "description",
|
|
2245
|
-
valueField: "_id",
|
|
2246
|
-
modalMode: "dialog",
|
|
2247
|
-
source: {
|
|
2248
|
-
method: "post",
|
|
2249
|
-
url: "${context.rootUrl}/graphql",
|
|
2250
|
-
data: {
|
|
2251
|
-
orderBy: "${orderBy}",
|
|
2252
|
-
orderDir: "${orderDir}",
|
|
2253
|
-
pageNo: "${page}",
|
|
2254
|
-
pageSize: "${perPage}",
|
|
2255
|
-
query:
|
|
2256
|
-
'{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})}',
|
|
2257
|
-
$term: "$term",
|
|
2258
|
-
$self: "$$",
|
|
2203
|
+
"fieldsExtend":{
|
|
2204
|
+
"object_name": {
|
|
2205
|
+
"amis": {
|
|
2206
|
+
"hidden": true
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
},
|
|
2210
|
+
"form": {
|
|
2211
|
+
debug: false,
|
|
2212
|
+
resetAfterSubmit: false,
|
|
2213
|
+
initApi: {
|
|
2214
|
+
url: '/api/v1/queue_import_history/${recordId}?fields=["state"]',
|
|
2215
|
+
sendOn: 'this.recordId',
|
|
2216
|
+
responseData: {
|
|
2217
|
+
importState: "${state}"
|
|
2218
|
+
}
|
|
2219
|
+
},
|
|
2220
|
+
interval: 3000,
|
|
2221
|
+
stopAutoRefreshWhen: "this.importState === 'finished'",
|
|
2222
|
+
initFetch: false,
|
|
2223
|
+
onEvent: {
|
|
2224
|
+
inited: {
|
|
2225
|
+
weight: 0,
|
|
2226
|
+
actions: [
|
|
2227
|
+
{
|
|
2228
|
+
"actionType": "broadcast",
|
|
2229
|
+
"args": {
|
|
2230
|
+
"eventName": `@data.changed.${uiSchema.name}`
|
|
2259
2231
|
},
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2232
|
+
"data": {
|
|
2233
|
+
"objectName": `${uiSchema.name}`,
|
|
2234
|
+
"displayAs": "${displayAs}",
|
|
2235
|
+
"recordId": "xxxx" //不可以省略,否则会进入进入记录详细页面
|
|
2263
2236
|
},
|
|
2264
|
-
|
|
2265
|
-
"\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 ",
|
|
2266
|
-
adaptor:
|
|
2267
|
-
"\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 ",
|
|
2237
|
+
"expression": "this.importState === 'finished'"
|
|
2268
2238
|
},
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
name: "object_name",
|
|
2295
|
-
label: i18next.t('frontend_import_data_object_name'),
|
|
2296
|
-
type: "tpl",
|
|
2297
|
-
tpl: '<a href="/app/undefined/${_display.object_name.objectName}/view/${_display.object_name.value}">${_display.object_name.label}</a>',
|
|
2298
|
-
className: "whitespace-nowrap",
|
|
2299
|
-
html: null,
|
|
2300
|
-
},
|
|
2301
|
-
{
|
|
2302
|
-
name: "encoding",
|
|
2303
|
-
label: i18next.t('frontend_import_data_queue_import_encoding'),
|
|
2304
|
-
type: "tpl",
|
|
2305
|
-
tpl: "<div>${_display.encoding}</div>",
|
|
2306
|
-
className: "whitespace-nowrap",
|
|
2307
|
-
html: null,
|
|
2308
|
-
},
|
|
2309
|
-
{
|
|
2310
|
-
name: "template_url",
|
|
2311
|
-
label: i18next.t('frontend_import_data_queue_import_template_url'),
|
|
2312
|
-
type: "button-group",
|
|
2313
|
-
buttons: [
|
|
2314
|
-
{
|
|
2315
|
-
type: "button",
|
|
2316
|
-
label: i18next.t('frontend_download'),
|
|
2317
|
-
visibleOn: "${template_url}",
|
|
2318
|
-
level: "link",
|
|
2319
|
-
actionType: "download",
|
|
2320
|
-
api:{
|
|
2321
|
-
url: "${template_url}",
|
|
2322
|
-
method: "get",
|
|
2323
|
-
headers: {
|
|
2324
|
-
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
2325
|
-
}
|
|
2326
|
-
}
|
|
2327
|
-
}
|
|
2328
|
-
],
|
|
2329
|
-
options: {
|
|
2330
|
-
html: true
|
|
2239
|
+
{
|
|
2240
|
+
"actionType": "closeDialog",
|
|
2241
|
+
"expression": "this.importState === 'finished'"
|
|
2242
|
+
}
|
|
2243
|
+
]
|
|
2244
|
+
},
|
|
2245
|
+
submitSucc: {
|
|
2246
|
+
weight: 0,
|
|
2247
|
+
actions: [
|
|
2248
|
+
{
|
|
2249
|
+
args: {
|
|
2250
|
+
api: {
|
|
2251
|
+
url: "${context.rootUrl}/api/data/initiateImport",
|
|
2252
|
+
method: "post",
|
|
2253
|
+
data: {
|
|
2254
|
+
eventData: "${event.data}",
|
|
2255
|
+
},
|
|
2256
|
+
dataType: "json",
|
|
2257
|
+
requestAdaptor:
|
|
2258
|
+
"\napi.data = {\n importObjectHistoryId: api.body.eventData.result.data.recordId\n}\nreturn api;",
|
|
2259
|
+
adaptor:
|
|
2260
|
+
"payload.status = payload.status === 'success' ? 0 : payload.status;\nconsole.log(\"payload ssss==>\", payload)\nreturn payload;",
|
|
2261
|
+
headers: {
|
|
2262
|
+
Authorization:
|
|
2263
|
+
"Bearer ${context.tenantId},${context.authToken}",
|
|
2331
2264
|
},
|
|
2332
|
-
className: "whitespace-nowrap",
|
|
2333
|
-
},
|
|
2334
|
-
null,
|
|
2335
|
-
],
|
|
2336
|
-
syncLocation: false,
|
|
2337
|
-
keepItemSelectionOnPageChange: true,
|
|
2338
|
-
checkOnItemClick: false,
|
|
2339
|
-
autoFillHeight: false,
|
|
2340
|
-
},
|
|
2341
|
-
joinValues: false,
|
|
2342
|
-
extractValue: true,
|
|
2343
|
-
className: "m-1",
|
|
2344
|
-
labelClassName: "text-left",
|
|
2345
|
-
clearValueOnHidden: true,
|
|
2346
|
-
id: "u:401df27113e0",
|
|
2347
|
-
},
|
|
2348
|
-
{
|
|
2349
|
-
name: "file",
|
|
2350
|
-
label: i18next.t('frontend_import_data_file'),
|
|
2351
|
-
required: true,
|
|
2352
|
-
type: "input-file",
|
|
2353
|
-
accept: ".xlsx,.xls",
|
|
2354
|
-
className: "m-1",
|
|
2355
|
-
labelClassName: "text-left",
|
|
2356
|
-
clearValueOnHidden: true,
|
|
2357
|
-
useChunk: false,
|
|
2358
|
-
receiver: {
|
|
2359
|
-
method: "post",
|
|
2360
|
-
url: "${context.rootUrl}/s3/files",
|
|
2361
|
-
data: {
|
|
2362
|
-
$: "$$",
|
|
2363
|
-
context: "${context}",
|
|
2364
|
-
},
|
|
2365
|
-
adaptor:
|
|
2366
|
-
'\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 ',
|
|
2367
|
-
headers: {
|
|
2368
|
-
Authorization:
|
|
2369
|
-
"Bearer ${context.tenantId},${context.authToken}",
|
|
2370
|
-
},
|
|
2371
|
-
},
|
|
2372
|
-
id: "u:0213f2cc365b",
|
|
2373
|
-
},
|
|
2374
|
-
],
|
|
2375
|
-
id: "u:4899c260d667",
|
|
2376
|
-
},
|
|
2377
|
-
],
|
|
2378
|
-
panelClassName: "m-0 sm:rounded-lg shadow-none",
|
|
2379
|
-
bodyClassName: "p-0",
|
|
2380
|
-
className: "p-4 sm:p-0 steedos-amis-form",
|
|
2381
|
-
label: "对象表单",
|
|
2382
|
-
objectApiName: "queue_import_history",
|
|
2383
|
-
id: "u:e4ef598eed61",
|
|
2384
|
-
onEvent: {
|
|
2385
|
-
submitSucc: {
|
|
2386
|
-
weight: 0,
|
|
2387
|
-
actions: [
|
|
2388
|
-
{
|
|
2389
|
-
args: {
|
|
2390
|
-
api: {
|
|
2391
|
-
url: "${context.rootUrl}/api/data/initiateImport",
|
|
2392
|
-
method: "post",
|
|
2393
|
-
data: {
|
|
2394
|
-
eventData: "${event.data}",
|
|
2395
2265
|
},
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
adaptor:
|
|
2400
|
-
"payload.status = payload.status === 'success' ? 0 : payload.status;\nconsole.log(\"payload ssss==>\", payload)\nreturn payload;",
|
|
2401
|
-
headers: {
|
|
2402
|
-
Authorization:
|
|
2403
|
-
"Bearer ${context.tenantId},${context.authToken}",
|
|
2266
|
+
messages: {
|
|
2267
|
+
success: i18next.t('frontend_import_data_message_success'),
|
|
2268
|
+
failed: i18next.t('frontend_import_data_message_failed'),
|
|
2404
2269
|
},
|
|
2405
2270
|
},
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
failed: i18next.t('frontend_import_data_message_failed'),
|
|
2409
|
-
},
|
|
2271
|
+
actionType: "ajax",
|
|
2272
|
+
expression: "event.data.result",
|
|
2410
2273
|
},
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
},
|
|
2414
|
-
],
|
|
2274
|
+
],
|
|
2275
|
+
},
|
|
2415
2276
|
},
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
}
|
|
2277
|
+
closeDialogOnSubmit: false,
|
|
2278
|
+
}
|
|
2279
|
+
}
|
|
2419
2280
|
],
|
|
2420
2281
|
id: "u:dc05498d3bd4",
|
|
2421
2282
|
closeOnEsc: false,
|
|
@@ -2605,7 +2466,7 @@ const StandardButtons = {
|
|
|
2605
2466
|
getStandardImportData: async (uiSchema, ctx)=>{
|
|
2606
2467
|
return {
|
|
2607
2468
|
type: 'amis_button',
|
|
2608
|
-
amis_schema: await getSchema$2()
|
|
2469
|
+
amis_schema: await getSchema$2(uiSchema)
|
|
2609
2470
|
}
|
|
2610
2471
|
},
|
|
2611
2472
|
getStandardOpenView: async (uiSchema, ctx)=>{
|
|
@@ -2635,7 +2496,7 @@ function getButtonVisibleOn$1(button){
|
|
|
2635
2496
|
visible = button._visible;
|
|
2636
2497
|
}
|
|
2637
2498
|
|
|
2638
|
-
if(
|
|
2499
|
+
if(_$1.isBoolean(visible)){
|
|
2639
2500
|
visible = visible.toString();
|
|
2640
2501
|
}
|
|
2641
2502
|
|
|
@@ -2663,7 +2524,7 @@ function getButtonVisibleOn$1(button){
|
|
|
2663
2524
|
|
|
2664
2525
|
const getButtonVisible = (button, ctx) => {
|
|
2665
2526
|
if (button._visible) {
|
|
2666
|
-
if (
|
|
2527
|
+
if (_$1.startsWith(_$1.trim(button._visible), "function")) {
|
|
2667
2528
|
window.eval("var fun = " + button._visible);
|
|
2668
2529
|
button.visible = fun;
|
|
2669
2530
|
} else if (isExpression(button._visible)) {
|
|
@@ -2678,7 +2539,7 @@ const getButtonVisible = (button, ctx) => {
|
|
|
2678
2539
|
};
|
|
2679
2540
|
}
|
|
2680
2541
|
}
|
|
2681
|
-
if (
|
|
2542
|
+
if (_$1.isFunction(button.visible)) {
|
|
2682
2543
|
try {
|
|
2683
2544
|
return button.visible(ctx);
|
|
2684
2545
|
} catch (error) {
|
|
@@ -2700,7 +2561,7 @@ const standardButtonsTodo = {
|
|
|
2700
2561
|
} = this;
|
|
2701
2562
|
const listViewRef = SteedosUI?.getRef(scopeId || listViewId).getComponentById(`listview_${uiSchema.name}`);
|
|
2702
2563
|
|
|
2703
|
-
if(
|
|
2564
|
+
if(_$1.isEmpty(listViewRef.props.store.toJSON().selectedItems)){
|
|
2704
2565
|
listViewRef.handleAction({}, {
|
|
2705
2566
|
"actionType": "toast",
|
|
2706
2567
|
"toast": {
|
|
@@ -2727,19 +2588,19 @@ const standardButtonsTodo = {
|
|
|
2727
2588
|
*/
|
|
2728
2589
|
const getButtons = (uiSchema, ctx) => {
|
|
2729
2590
|
const disabledButtons = uiSchema.permissions && uiSchema.permissions.disabled_actions;
|
|
2730
|
-
let buttons =
|
|
2731
|
-
if (
|
|
2732
|
-
buttons =
|
|
2733
|
-
return
|
|
2591
|
+
let buttons = _$1.sortBy(_$1.values(uiSchema.actions), "sort");
|
|
2592
|
+
if (_$1.has(uiSchema, "allow_customActions")) {
|
|
2593
|
+
buttons = _$1.filter(buttons, (button) => {
|
|
2594
|
+
return _$1.include(uiSchema.allow_customActions, button.name); // || _.include(_.keys(Creator.getObject('base').actions) || {}, button.name)
|
|
2734
2595
|
});
|
|
2735
2596
|
}
|
|
2736
|
-
if (
|
|
2737
|
-
buttons =
|
|
2738
|
-
return !
|
|
2597
|
+
if (_$1.has(uiSchema, "exclude_actions")) {
|
|
2598
|
+
buttons = _$1.filter(buttons, (button) => {
|
|
2599
|
+
return !_$1.include(uiSchema.exclude_actions, button.name);
|
|
2739
2600
|
});
|
|
2740
2601
|
}
|
|
2741
2602
|
|
|
2742
|
-
|
|
2603
|
+
_$1.each(buttons, (button) => {
|
|
2743
2604
|
button.objectName = uiSchema.name;
|
|
2744
2605
|
if (
|
|
2745
2606
|
ctx.isMobile &&
|
|
@@ -2758,7 +2619,7 @@ const getButtons = (uiSchema, ctx) => {
|
|
|
2758
2619
|
ctx.isMobile &&
|
|
2759
2620
|
["cms_files", "cfs.files.filerecord"].indexOf(uiSchema.name) > -1
|
|
2760
2621
|
) {
|
|
2761
|
-
|
|
2622
|
+
_$1.map(buttons, (button) => {
|
|
2762
2623
|
if (button.name === "standard_edit") {
|
|
2763
2624
|
button.on = "record_more";
|
|
2764
2625
|
}
|
|
@@ -2768,14 +2629,14 @@ const getButtons = (uiSchema, ctx) => {
|
|
|
2768
2629
|
});
|
|
2769
2630
|
}
|
|
2770
2631
|
|
|
2771
|
-
return
|
|
2772
|
-
return
|
|
2632
|
+
return _$1.filter(buttons, (button) => {
|
|
2633
|
+
return _$1.indexOf(disabledButtons, button.name) < 0 && button.name != 'standard_query';
|
|
2773
2634
|
});
|
|
2774
2635
|
};
|
|
2775
2636
|
|
|
2776
2637
|
const getListViewButtons = (uiSchema, ctx) => {
|
|
2777
2638
|
const buttons = getButtons(uiSchema, ctx);
|
|
2778
|
-
const listButtons =
|
|
2639
|
+
const listButtons = _$1.filter(buttons, (button) => {
|
|
2779
2640
|
return button.on == "list";
|
|
2780
2641
|
});
|
|
2781
2642
|
return listButtons;
|
|
@@ -2783,23 +2644,23 @@ const getListViewButtons = (uiSchema, ctx) => {
|
|
|
2783
2644
|
|
|
2784
2645
|
const getObjectDetailButtons = (uiSchema, ctx) => {
|
|
2785
2646
|
const buttons = getButtons(uiSchema, ctx);
|
|
2786
|
-
const detailButtons =
|
|
2647
|
+
const detailButtons = _$1.filter(buttons, (button) => {
|
|
2787
2648
|
return button.on == "record" || button.on == "record_only";
|
|
2788
2649
|
});
|
|
2789
|
-
return
|
|
2650
|
+
return _$1.sortBy(detailButtons, "sort");
|
|
2790
2651
|
};
|
|
2791
2652
|
|
|
2792
2653
|
const getObjectDetailMoreButtons = (uiSchema, ctx) => {
|
|
2793
2654
|
const buttons = getButtons(uiSchema, ctx);
|
|
2794
|
-
const moreButtons =
|
|
2655
|
+
const moreButtons = _$1.filter(buttons, (button) => {
|
|
2795
2656
|
return button.on == "record_more" || button.on == "record_only_more";
|
|
2796
2657
|
});
|
|
2797
|
-
return
|
|
2658
|
+
return _$1.sortBy(moreButtons, "sort");
|
|
2798
2659
|
};
|
|
2799
2660
|
|
|
2800
2661
|
const getListViewItemButtons = async (uiSchema, ctx)=>{
|
|
2801
2662
|
const buttons = getButtons(uiSchema, ctx);
|
|
2802
|
-
const listButtons =
|
|
2663
|
+
const listButtons = _$1.filter(buttons, (button) => {
|
|
2803
2664
|
return button.on == "record" || button.on == "list_item" || button.on === 'record_more';
|
|
2804
2665
|
});
|
|
2805
2666
|
return listButtons;
|
|
@@ -2816,7 +2677,7 @@ const getObjectRelatedListButtons = (uiSchema, ctx)=>{
|
|
|
2816
2677
|
// });
|
|
2817
2678
|
// return relatedListButtons;
|
|
2818
2679
|
const buttons = getButtons(uiSchema, ctx);
|
|
2819
|
-
const listButtons =
|
|
2680
|
+
const listButtons = _$1.filter(buttons, (button) => {
|
|
2820
2681
|
return button.on == "list";
|
|
2821
2682
|
});
|
|
2822
2683
|
return listButtons;
|
|
@@ -2833,7 +2694,7 @@ const getButton = async (objectName, buttonName, ctx)=>{
|
|
|
2833
2694
|
const uiSchema = await getUISchema(objectName);
|
|
2834
2695
|
if(uiSchema){
|
|
2835
2696
|
const buttons = await getButtons(uiSchema, ctx);
|
|
2836
|
-
const button =
|
|
2697
|
+
const button = _$1.find(buttons, (button)=>{
|
|
2837
2698
|
return button.name === buttonName
|
|
2838
2699
|
});
|
|
2839
2700
|
|
|
@@ -2919,13 +2780,13 @@ const execute = (button, props) => {
|
|
|
2919
2780
|
return; //TODO 弹出提示未配置todo
|
|
2920
2781
|
}
|
|
2921
2782
|
|
|
2922
|
-
if (
|
|
2923
|
-
if (
|
|
2783
|
+
if (_$1.isString(button.todo)) {
|
|
2784
|
+
if (_$1.startsWith(_$1.trim(button.todo), "function")) {
|
|
2924
2785
|
window.eval("var fun = " + button.todo);
|
|
2925
2786
|
button.todo = fun;
|
|
2926
2787
|
}
|
|
2927
2788
|
}
|
|
2928
|
-
if (
|
|
2789
|
+
if (_$1.isFunction(button.todo)) {
|
|
2929
2790
|
const todoThis = {
|
|
2930
2791
|
objectName: props.objectName,
|
|
2931
2792
|
object_name: props.objectName,
|
|
@@ -2950,7 +2811,7 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
|
|
|
2950
2811
|
recordId: recordId,
|
|
2951
2812
|
objectName: name
|
|
2952
2813
|
});
|
|
2953
|
-
let amisButtonsSchema =
|
|
2814
|
+
let amisButtonsSchema = _$1.map(buttons, (button) => {
|
|
2954
2815
|
return {
|
|
2955
2816
|
type: 'steedos-object-button',
|
|
2956
2817
|
name: button.name,
|
|
@@ -2960,7 +2821,7 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
|
|
|
2960
2821
|
}
|
|
2961
2822
|
});
|
|
2962
2823
|
let moreButtonsVisibleOn = '';
|
|
2963
|
-
let dropdownButtons =
|
|
2824
|
+
let dropdownButtons = _$1.map(moreButtons, (button, index) => {
|
|
2964
2825
|
if(index === 0){
|
|
2965
2826
|
moreButtonsVisibleOn = getButtonVisibleOn$1(button);
|
|
2966
2827
|
}else {
|
|
@@ -3003,11 +2864,11 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
3003
2864
|
"vertical": true,
|
|
3004
2865
|
"tiled": true,
|
|
3005
2866
|
"buttons": [
|
|
3006
|
-
...
|
|
2867
|
+
..._$1.map(buttons, (button)=>{
|
|
3007
2868
|
button.className += ' w-full';
|
|
3008
2869
|
return button;
|
|
3009
2870
|
}),
|
|
3010
|
-
...
|
|
2871
|
+
..._$1.map(moreButtons, (button)=>{
|
|
3011
2872
|
button.className += ' w-full';
|
|
3012
2873
|
return button;
|
|
3013
2874
|
})
|
|
@@ -3052,6 +2913,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3052
2913
|
return {
|
|
3053
2914
|
"type": "button",
|
|
3054
2915
|
"icon": "fa fa-angle-down",
|
|
2916
|
+
"className": "mr-0",
|
|
3055
2917
|
"onEvent": {
|
|
3056
2918
|
"click": {
|
|
3057
2919
|
"actions": [
|
|
@@ -3068,7 +2930,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3068
2930
|
"vertical": true,
|
|
3069
2931
|
"tiled": true,
|
|
3070
2932
|
"buttons": [
|
|
3071
|
-
...
|
|
2933
|
+
..._$1.map(buttons, (button)=>{
|
|
3072
2934
|
return {
|
|
3073
2935
|
type: 'steedos-object-button',
|
|
3074
2936
|
name: button.name,
|
|
@@ -3097,7 +2959,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3097
2959
|
}
|
|
3098
2960
|
}
|
|
3099
2961
|
}else {
|
|
3100
|
-
return
|
|
2962
|
+
return _$1.map(buttons, (button) => {
|
|
3101
2963
|
return {
|
|
3102
2964
|
type: 'steedos-object-button',
|
|
3103
2965
|
name: button.name,
|
|
@@ -3130,7 +2992,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3130
2992
|
"vertical": true,
|
|
3131
2993
|
"tiled": true,
|
|
3132
2994
|
"buttons": [
|
|
3133
|
-
...
|
|
2995
|
+
..._$1.map(buttons, (button)=>{
|
|
3134
2996
|
return {
|
|
3135
2997
|
type: 'steedos-object-button',
|
|
3136
2998
|
name: button.name,
|
|
@@ -3159,7 +3021,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3159
3021
|
}
|
|
3160
3022
|
}
|
|
3161
3023
|
}else {
|
|
3162
|
-
return
|
|
3024
|
+
return _$1.map(buttons, (button) => {
|
|
3163
3025
|
return {
|
|
3164
3026
|
type: 'steedos-object-button',
|
|
3165
3027
|
name: button.name,
|
|
@@ -3755,6 +3617,10 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
3755
3617
|
each(
|
|
3756
3618
|
objectSchema.list_views,
|
|
3757
3619
|
(listView, name) => {
|
|
3620
|
+
if(name === "lookup"){
|
|
3621
|
+
// 内置lookup为弹出选择专用视图,不显示在列表切换区域
|
|
3622
|
+
return;
|
|
3623
|
+
}
|
|
3758
3624
|
listViewButtonOptions.push({
|
|
3759
3625
|
type: "button",
|
|
3760
3626
|
label: listView.label,
|
|
@@ -5244,6 +5110,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
5244
5110
|
|
|
5245
5111
|
return {
|
|
5246
5112
|
"type": "tooltip-wrapper",
|
|
5113
|
+
"id": "steedos_crud_toolbar_quick_search",
|
|
5247
5114
|
"align": "right",
|
|
5248
5115
|
"title": "",
|
|
5249
5116
|
"content": "可搜索字段:" + searchableFieldsLabel.join(","),
|
|
@@ -5275,76 +5142,134 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
5275
5142
|
if(isMobile){
|
|
5276
5143
|
showDisplayAs = false;
|
|
5277
5144
|
}
|
|
5145
|
+
let toolbarCount;
|
|
5146
|
+
if(!hiddenCount){
|
|
5147
|
+
toolbarCount = {
|
|
5148
|
+
"type": "tpl",
|
|
5149
|
+
"tpl": "${count} " + i18next.t('frontend_record_sum')
|
|
5150
|
+
};
|
|
5151
|
+
}
|
|
5152
|
+
let toolbarReloadButton;
|
|
5278
5153
|
if(formFactor === 'SMALL'){
|
|
5279
|
-
const onReloadScript = `
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
`;
|
|
5154
|
+
// const onReloadScript = `
|
|
5155
|
+
// const scope = event.context.scoped;
|
|
5156
|
+
// var listView = scope.parent.getComponents().find(function(n){
|
|
5157
|
+
// return n.props.type === "crud";
|
|
5158
|
+
// });
|
|
5159
|
+
// listView.handleChangePage(1);
|
|
5160
|
+
// `;
|
|
5161
|
+
// toolbarReloadButton = {
|
|
5162
|
+
// // "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页,这在加载更多按钮的翻页模式下会有问题
|
|
5163
|
+
// "type": "button",
|
|
5164
|
+
// "align": "right",
|
|
5165
|
+
// //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5166
|
+
// // "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5167
|
+
// "tooltipPlacement": "top",
|
|
5168
|
+
// "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5169
|
+
// "label": "",
|
|
5170
|
+
// "icon": "fa fa-sync",
|
|
5171
|
+
// "visibleOn": "${!showFieldsFilter}",
|
|
5172
|
+
// "onEvent": {
|
|
5173
|
+
// "click": {
|
|
5174
|
+
// "actions": [
|
|
5175
|
+
// {
|
|
5176
|
+
// "actionType": "custom",
|
|
5177
|
+
// "script": onReloadScript
|
|
5178
|
+
// }
|
|
5179
|
+
// ]
|
|
5180
|
+
// }
|
|
5181
|
+
// },
|
|
5182
|
+
// };
|
|
5183
|
+
|
|
5184
|
+
// 后续如果换成加载更多按钮的翻页模式的话,不可以直接使用下面的reload,需要换成上面的自定义脚本模式
|
|
5185
|
+
toolbarReloadButton = {
|
|
5186
|
+
"type": "reload",
|
|
5187
|
+
"align": "right",
|
|
5188
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5189
|
+
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5190
|
+
"tooltip":"",
|
|
5191
|
+
"tooltipPlacement": "top",
|
|
5192
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5193
|
+
};
|
|
5194
|
+
}
|
|
5195
|
+
else {
|
|
5196
|
+
toolbarReloadButton = {
|
|
5197
|
+
"type": "reload",
|
|
5198
|
+
"align": "right",
|
|
5199
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5200
|
+
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5201
|
+
"tooltip":"",
|
|
5202
|
+
"tooltipPlacement": "top",
|
|
5203
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5204
|
+
};
|
|
5205
|
+
}
|
|
5206
|
+
let toolbarFilter;
|
|
5207
|
+
if(filterVisible){
|
|
5208
|
+
toolbarFilter ={
|
|
5209
|
+
"label": i18next.t('frontend_button_search_tooltip'),
|
|
5210
|
+
"icon": "fa fa-filter",
|
|
5211
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5212
|
+
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5213
|
+
// "tooltipPlacement": "top",
|
|
5214
|
+
"type": "button",
|
|
5215
|
+
"badge": {
|
|
5216
|
+
"offset": [
|
|
5217
|
+
-5,
|
|
5218
|
+
1
|
|
5219
|
+
],
|
|
5220
|
+
"size":8,
|
|
5221
|
+
"animation": true,
|
|
5222
|
+
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
5223
|
+
},
|
|
5224
|
+
"align": "right",
|
|
5225
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5226
|
+
"onEvent": {
|
|
5227
|
+
"click": {
|
|
5228
|
+
"actions": [
|
|
5229
|
+
{
|
|
5230
|
+
"actionType": "custom",
|
|
5231
|
+
"script": onFieldsFilterToggleScript
|
|
5232
|
+
}
|
|
5233
|
+
]
|
|
5234
|
+
}
|
|
5235
|
+
},
|
|
5236
|
+
"id": "steedos_crud_toolbar_filter"
|
|
5237
|
+
};
|
|
5238
|
+
}
|
|
5239
|
+
let toolbarDisplayAsButton = getDisplayAsButton(mainObject?.name);
|
|
5240
|
+
let toolbarDQuickSearchBox = getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName });
|
|
5241
|
+
|
|
5242
|
+
// toolbars返回的数组元素不可以是空对象{},比如hiddenCount ? {} : {"type": "tpl",...},因为空对象最终还是会生成一个空的.antd-Crud-toolbar-item dom
|
|
5243
|
+
// 当出现空的.antd-Crud-toolbar-item dom时会影响toolbar元素的maring-right css样式计算,如果有动态需要应该加到动态数组变量toolbars中
|
|
5244
|
+
let toolbars = [];
|
|
5245
|
+
if(formFactor === 'SMALL'){
|
|
5246
|
+
if(toolbarCount){
|
|
5247
|
+
toolbars.push(toolbarCount);
|
|
5248
|
+
}
|
|
5249
|
+
toolbars.push(toolbarReloadButton);
|
|
5250
|
+
if(toolbarFilter){
|
|
5251
|
+
toolbars.push(toolbarFilter);
|
|
5252
|
+
}
|
|
5253
|
+
toolbars.push(toolbarDisplayAsButton);
|
|
5254
|
+
toolbars.push(toolbarDQuickSearchBox);
|
|
5286
5255
|
return [
|
|
5287
5256
|
// "bulkActions",
|
|
5288
5257
|
...(headerToolbarItems || []),
|
|
5289
|
-
|
|
5290
|
-
"type": "tpl",
|
|
5291
|
-
"tpl": "${count} " + i18next.t('frontend_record_sum')
|
|
5292
|
-
},
|
|
5293
|
-
{
|
|
5294
|
-
// "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
|
|
5295
|
-
"type": "button",
|
|
5296
|
-
"align": "right",
|
|
5297
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5298
|
-
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5299
|
-
"tooltipPlacement": "top",
|
|
5300
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5301
|
-
"label": "",
|
|
5302
|
-
"icon": "fa fa-sync",
|
|
5303
|
-
"visibleOn": "${!showFieldsFilter}",
|
|
5304
|
-
"onEvent": {
|
|
5305
|
-
"click": {
|
|
5306
|
-
"actions": [
|
|
5307
|
-
{
|
|
5308
|
-
"actionType": "custom",
|
|
5309
|
-
"script": onReloadScript
|
|
5310
|
-
}
|
|
5311
|
-
]
|
|
5312
|
-
}
|
|
5313
|
-
},
|
|
5314
|
-
},
|
|
5315
|
-
filterVisible ? {
|
|
5316
|
-
"label": i18next.t('frontend_button_search_tooltip'),
|
|
5317
|
-
"icon": "fa fa-search",
|
|
5318
|
-
"type": "button",
|
|
5319
|
-
"tooltipPlacement": "top",
|
|
5320
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5321
|
-
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5322
|
-
"badge": {
|
|
5323
|
-
"offset": [
|
|
5324
|
-
-5,
|
|
5325
|
-
1
|
|
5326
|
-
],
|
|
5327
|
-
"size":8,
|
|
5328
|
-
"animation": true,
|
|
5329
|
-
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
5330
|
-
},
|
|
5331
|
-
"align": "right",
|
|
5332
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5333
|
-
"onEvent": {
|
|
5334
|
-
"click": {
|
|
5335
|
-
"actions": [
|
|
5336
|
-
{
|
|
5337
|
-
"actionType": "custom",
|
|
5338
|
-
"script": onFieldsFilterToggleScript
|
|
5339
|
-
}
|
|
5340
|
-
]
|
|
5341
|
-
}
|
|
5342
|
-
}
|
|
5343
|
-
} : {},
|
|
5344
|
-
getDisplayAsButton(mainObject?.name),
|
|
5345
|
-
getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName })
|
|
5258
|
+
...toolbars,
|
|
5346
5259
|
]
|
|
5347
5260
|
}else {
|
|
5261
|
+
if(toolbarCount){
|
|
5262
|
+
toolbars.push(toolbarCount);
|
|
5263
|
+
}
|
|
5264
|
+
if(toolbarFilter){
|
|
5265
|
+
toolbars.push(toolbarFilter);
|
|
5266
|
+
}
|
|
5267
|
+
toolbars.push(toolbarReloadButton);
|
|
5268
|
+
if(mainObject?.permissions?.allowCreateListViews){
|
|
5269
|
+
toolbars.push(getSettingListviewToolbarButtonSchema());
|
|
5270
|
+
}
|
|
5271
|
+
toolbars.push(toolbarDisplayAsButton);
|
|
5272
|
+
toolbars.push(toolbarDQuickSearchBox);
|
|
5348
5273
|
return [
|
|
5349
5274
|
// "filter-toggler",
|
|
5350
5275
|
...(headerToolbarItems || []),
|
|
@@ -5353,56 +5278,12 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
5353
5278
|
"type": "columns-toggler",
|
|
5354
5279
|
"className": "hidden"
|
|
5355
5280
|
},
|
|
5281
|
+
...toolbars,
|
|
5356
5282
|
// {
|
|
5357
5283
|
// "type": "columns-toggler",
|
|
5358
5284
|
// "className": "mr-2"
|
|
5359
5285
|
// },
|
|
5360
|
-
hiddenCount ? {} : {
|
|
5361
|
-
"type": "tpl",
|
|
5362
|
-
"tpl": "${count} " + i18next.t('frontend_record_sum')
|
|
5363
|
-
},
|
|
5364
|
-
filterVisible ? {
|
|
5365
|
-
"label": i18next.t('frontend_button_search_tooltip'),
|
|
5366
|
-
"icon": "fa fa-filter",
|
|
5367
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5368
|
-
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5369
|
-
// "tooltipPlacement": "top",
|
|
5370
|
-
"type": "button",
|
|
5371
|
-
"badge": {
|
|
5372
|
-
"offset": [
|
|
5373
|
-
-5,
|
|
5374
|
-
1
|
|
5375
|
-
],
|
|
5376
|
-
"size":8,
|
|
5377
|
-
"animation": true,
|
|
5378
|
-
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
5379
|
-
},
|
|
5380
|
-
"align": "right",
|
|
5381
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5382
|
-
"onEvent": {
|
|
5383
|
-
"click": {
|
|
5384
|
-
"actions": [
|
|
5385
|
-
{
|
|
5386
|
-
"actionType": "custom",
|
|
5387
|
-
"script": onFieldsFilterToggleScript
|
|
5388
|
-
}
|
|
5389
|
-
]
|
|
5390
|
-
}
|
|
5391
|
-
}
|
|
5392
|
-
} : {},
|
|
5393
|
-
{
|
|
5394
|
-
"type": "reload",
|
|
5395
|
-
"align": "right",
|
|
5396
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5397
|
-
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5398
|
-
"tooltip":"",
|
|
5399
|
-
"tooltipPlacement": "top",
|
|
5400
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5401
|
-
},
|
|
5402
5286
|
// getExportExcelToolbarButtonSchema(),
|
|
5403
|
-
mainObject?.permissions?.allowCreateListViews ? getSettingListviewToolbarButtonSchema() : {},
|
|
5404
|
-
getDisplayAsButton(mainObject?.name),
|
|
5405
|
-
getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName }),
|
|
5406
5287
|
// {
|
|
5407
5288
|
// "type": "drag-toggler",
|
|
5408
5289
|
// "align": "right"
|
|
@@ -5603,10 +5484,8 @@ async function getDeferApi(field, ctx) {
|
|
|
5603
5484
|
}
|
|
5604
5485
|
|
|
5605
5486
|
function getRefListViewSort(refObject){
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
(view, name) => name === "all"
|
|
5609
|
-
);
|
|
5487
|
+
let listView = getLookupListView(refObject);
|
|
5488
|
+
|
|
5610
5489
|
let sort = "";
|
|
5611
5490
|
if(listView){
|
|
5612
5491
|
sort = getListViewSort(listView);
|
|
@@ -5696,12 +5575,11 @@ const getReferenceTo = async (field)=>{
|
|
|
5696
5575
|
}
|
|
5697
5576
|
};
|
|
5698
5577
|
|
|
5699
|
-
function getLookupSapceUserTreeSchema(){
|
|
5700
|
-
const
|
|
5578
|
+
function getLookupSapceUserTreeSchema(isMobile){
|
|
5579
|
+
const treeSchema = {
|
|
5701
5580
|
"type": "input-tree",
|
|
5702
|
-
"className":
|
|
5581
|
+
"className":"steedos-select-user-tree",
|
|
5703
5582
|
"inputClassName": "p-0",
|
|
5704
|
-
"id": "u:7fd77b7915b0",
|
|
5705
5583
|
"source": {
|
|
5706
5584
|
"method": "post",
|
|
5707
5585
|
"url": "${context.rootUrl}/graphql",
|
|
@@ -5732,6 +5610,10 @@ function getLookupSapceUserTreeSchema(){
|
|
|
5732
5610
|
});
|
|
5733
5611
|
listView.handleFilterSubmit(Object.assign({}, filterFormValues));
|
|
5734
5612
|
`
|
|
5613
|
+
},
|
|
5614
|
+
{
|
|
5615
|
+
"actionType": "custom",
|
|
5616
|
+
"script": " if(window.innerWidth < 768){ document.querySelector('.steedos-select-user-sidebar').classList.remove('steedos-select-user-sidebar-open'); }"
|
|
5735
5617
|
}
|
|
5736
5618
|
]
|
|
5737
5619
|
}
|
|
@@ -5756,18 +5638,56 @@ function getLookupSapceUserTreeSchema(){
|
|
|
5756
5638
|
"placeholder": "查找部门"
|
|
5757
5639
|
},
|
|
5758
5640
|
"unfoldedLevel": 2,
|
|
5759
|
-
"style": {
|
|
5760
|
-
"max-height": "100%",
|
|
5761
|
-
"position": "absolute",
|
|
5762
|
-
"left": "-330px",
|
|
5763
|
-
"width": "320px",
|
|
5764
|
-
"bottom": 0,
|
|
5765
|
-
"top": "0",
|
|
5766
|
-
"overflow": "auto",
|
|
5767
|
-
"min-height":"300px"
|
|
5768
|
-
},
|
|
5769
5641
|
"originPosition": "left-top"
|
|
5770
|
-
}
|
|
5642
|
+
};
|
|
5643
|
+
const tree = [];
|
|
5644
|
+
if(isMobile){
|
|
5645
|
+
tree.push({
|
|
5646
|
+
type: "action",
|
|
5647
|
+
body:[
|
|
5648
|
+
{
|
|
5649
|
+
type: "action",
|
|
5650
|
+
body:[
|
|
5651
|
+
treeSchema
|
|
5652
|
+
],
|
|
5653
|
+
className:"h-full w-[240px]"
|
|
5654
|
+
}
|
|
5655
|
+
],
|
|
5656
|
+
className: "absolute inset-0 steedos-select-user-sidebar",
|
|
5657
|
+
"onEvent": {
|
|
5658
|
+
"click": {
|
|
5659
|
+
"actions": [
|
|
5660
|
+
{
|
|
5661
|
+
"actionType": "custom",
|
|
5662
|
+
"script": "document.querySelector('.steedos-select-user-sidebar').classList.remove('steedos-select-user-sidebar-open')"
|
|
5663
|
+
}
|
|
5664
|
+
]
|
|
5665
|
+
}
|
|
5666
|
+
},
|
|
5667
|
+
id: "steedos_crud_toolbar_select_user_tree"
|
|
5668
|
+
});
|
|
5669
|
+
tree.push({
|
|
5670
|
+
"type": "button",
|
|
5671
|
+
"label": "组织",
|
|
5672
|
+
"icon": "fa fa-sitemap",
|
|
5673
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5674
|
+
"align": "left",
|
|
5675
|
+
"onEvent": {
|
|
5676
|
+
"click": {
|
|
5677
|
+
"actions": [
|
|
5678
|
+
{
|
|
5679
|
+
"actionType": "custom",
|
|
5680
|
+
"script": "document.querySelector('.steedos-select-user-sidebar').classList.toggle('steedos-select-user-sidebar-open')"
|
|
5681
|
+
}
|
|
5682
|
+
]
|
|
5683
|
+
}
|
|
5684
|
+
},
|
|
5685
|
+
"id": "steedos_crud_toolbar_organization_button"
|
|
5686
|
+
});
|
|
5687
|
+
}else {
|
|
5688
|
+
tree.push(treeSchema);
|
|
5689
|
+
}
|
|
5690
|
+
|
|
5771
5691
|
return tree;
|
|
5772
5692
|
}
|
|
5773
5693
|
|
|
@@ -5782,19 +5702,14 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5782
5702
|
ctx.objectName = refObjectConfig.name;
|
|
5783
5703
|
|
|
5784
5704
|
let tableFields = [];
|
|
5785
|
-
let i = 0;
|
|
5786
5705
|
const searchableFields = [];
|
|
5787
5706
|
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
const listName = "all";
|
|
5707
|
+
let fieldsArr = [];
|
|
5791
5708
|
|
|
5792
5709
|
const isMobile = window.innerWidth < 768;
|
|
5793
5710
|
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
(listView, name) => name === listName
|
|
5797
|
-
);
|
|
5711
|
+
let listView = getLookupListView(refObjectConfig);
|
|
5712
|
+
let listName = listView && listView.name;
|
|
5798
5713
|
if (listView && listView.columns) {
|
|
5799
5714
|
_$1.each(listView.columns, function (column) {
|
|
5800
5715
|
if (_$1.isString(column) && refObjectConfig.fields[column]) {
|
|
@@ -5809,7 +5724,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5809
5724
|
}
|
|
5810
5725
|
});
|
|
5811
5726
|
}else {
|
|
5812
|
-
_$1.each(refObjectConfig.fields
|
|
5727
|
+
_$1.each(refObjectConfig.fields, (field, field_name)=>{
|
|
5813
5728
|
if(field_name != '_id' && !field.hidden){
|
|
5814
5729
|
if(!_$1.has(field, "name")){
|
|
5815
5730
|
field.name = field_name;
|
|
@@ -5817,16 +5732,15 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5817
5732
|
fieldsArr.push(field);
|
|
5818
5733
|
}
|
|
5819
5734
|
});
|
|
5735
|
+
// 没有视图权限时,取对象上前5个字段,按sort_no排序
|
|
5736
|
+
fieldsArr = _$1.sortBy(fieldsArr, "sort_no").slice(0,5);
|
|
5820
5737
|
}
|
|
5821
5738
|
|
|
5822
|
-
_$1.each(
|
|
5823
|
-
if(
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
i++;
|
|
5828
|
-
tableFields.push(field);
|
|
5829
|
-
}
|
|
5739
|
+
_$1.each(fieldsArr,function(field){
|
|
5740
|
+
if(!_$1.find(tableFields, function(f){
|
|
5741
|
+
return f.name === field.name
|
|
5742
|
+
})){
|
|
5743
|
+
tableFields.push(field);
|
|
5830
5744
|
}
|
|
5831
5745
|
});
|
|
5832
5746
|
|
|
@@ -6020,13 +5934,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
6020
5934
|
}
|
|
6021
5935
|
|
|
6022
5936
|
let pickerSchema = null;
|
|
6023
|
-
|
|
6024
|
-
pickerSchema = await getListSchema$1(tableFields, {
|
|
6025
|
-
top: top,
|
|
6026
|
-
...ctx,
|
|
6027
|
-
actions: false
|
|
6028
|
-
});
|
|
6029
|
-
}else {
|
|
5937
|
+
{
|
|
6030
5938
|
pickerSchema = await getTableSchema$1(tableFields, {
|
|
6031
5939
|
labelFieldName: refObjectConfig.NAME_FIELD_KEY,
|
|
6032
5940
|
top: top,
|
|
@@ -6037,13 +5945,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
6037
5945
|
pickerSchema.affixHeader = false;
|
|
6038
5946
|
|
|
6039
5947
|
var headerToolbarItems = [];
|
|
6040
|
-
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
"margin-left":"330px",
|
|
6044
|
-
"min-height": "300px"
|
|
6045
|
-
};
|
|
6046
|
-
pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
|
|
5948
|
+
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
|
|
5949
|
+
headerToolbarItems = getLookupSapceUserTreeSchema(isMobile);
|
|
5950
|
+
pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
|
|
6047
5951
|
}
|
|
6048
5952
|
|
|
6049
5953
|
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
|
|
@@ -6139,13 +6043,25 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
6139
6043
|
pickerSchema = Object.assign({}, pickerSchema, field.pickerSchema);
|
|
6140
6044
|
}
|
|
6141
6045
|
|
|
6046
|
+
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && isMobile){
|
|
6047
|
+
//手机端选人控件只保留部分toolbar
|
|
6048
|
+
pickerSchema.headerToolbar = pickerSchema.headerToolbar && pickerSchema.headerToolbar.filter(function(item){
|
|
6049
|
+
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){
|
|
6050
|
+
return true;
|
|
6051
|
+
}else {
|
|
6052
|
+
return false;
|
|
6053
|
+
}
|
|
6054
|
+
});
|
|
6055
|
+
pickerSchema.footerToolbar = ["pagination"];
|
|
6056
|
+
}
|
|
6057
|
+
|
|
6142
6058
|
const data = {
|
|
6143
6059
|
type: getAmisStaticFieldType('picker', readonly),
|
|
6144
6060
|
modalTitle: i18next.t('frontend_form_please_select') + " " + refObjectConfig.label,
|
|
6145
6061
|
labelField: referenceTo.labelField.name,
|
|
6146
6062
|
valueField: referenceTo.valueField.name,
|
|
6147
|
-
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey
|
|
6148
|
-
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
|
|
6063
|
+
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
|
|
6064
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
6149
6065
|
modalMode: 'dialog', //TODO 设置 dialog 或者 drawer,用来配置弹出方式
|
|
6150
6066
|
source: source,
|
|
6151
6067
|
size: "lg",
|
|
@@ -6211,10 +6127,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
6211
6127
|
}
|
|
6212
6128
|
|
|
6213
6129
|
const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
|
|
6214
|
-
|
|
6215
|
-
refObjectConfig.list_views,
|
|
6216
|
-
(listView, name) => name === "all"
|
|
6217
|
-
);
|
|
6130
|
+
let listView = getLookupListView(refObjectConfig);
|
|
6218
6131
|
|
|
6219
6132
|
let sort = "";
|
|
6220
6133
|
if(listView){
|
|
@@ -6325,8 +6238,8 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
6325
6238
|
joinValues: false,
|
|
6326
6239
|
extractValue: true,
|
|
6327
6240
|
clearable: true,
|
|
6328
|
-
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey
|
|
6329
|
-
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
|
|
6241
|
+
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
|
|
6242
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
6330
6243
|
// labelField: labelField,
|
|
6331
6244
|
// valueField: valueField,
|
|
6332
6245
|
source: apiInfo,
|
|
@@ -6395,6 +6308,7 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
6395
6308
|
}
|
|
6396
6309
|
|
|
6397
6310
|
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
|
|
6311
|
+
ctx.onlyDisplayLookLabel = true;
|
|
6398
6312
|
if(ctx.idsDependOn){
|
|
6399
6313
|
// ids人员点选模式
|
|
6400
6314
|
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
@@ -6448,7 +6362,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6448
6362
|
|
|
6449
6363
|
const tableFields = [referenceTo.labelField];
|
|
6450
6364
|
|
|
6451
|
-
const source = await getApi$1(refObjectConfig, null, fields, {expand: true, alias: 'rows', queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}`});
|
|
6365
|
+
const source = await getApi$1(refObjectConfig, null, fields, {expand: true, alias: 'rows', queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
|
|
6452
6366
|
|
|
6453
6367
|
source.data.$term = "$term";
|
|
6454
6368
|
source.data.$self = "$$";
|
|
@@ -6457,6 +6371,12 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6457
6371
|
source.sendOn = `\${${idsDependOn} && ${idsDependOn}.length}`;
|
|
6458
6372
|
source.url = `${source.url}&depend_on_${idsDependOn}=\${${idsDependOn}|join}`;
|
|
6459
6373
|
}
|
|
6374
|
+
|
|
6375
|
+
let listView = getLookupListView(refObjectConfig);
|
|
6376
|
+
let sort = "";
|
|
6377
|
+
if(listView){
|
|
6378
|
+
sort = getListViewSort(listView);
|
|
6379
|
+
}
|
|
6460
6380
|
|
|
6461
6381
|
source.requestAdaptor = `
|
|
6462
6382
|
const selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
@@ -6464,6 +6384,10 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6464
6384
|
var pageSize = api.data.pageSize || 1000;
|
|
6465
6385
|
var pageNo = api.data.pageNo || 1;
|
|
6466
6386
|
var skip = (pageNo - 1) * pageSize;
|
|
6387
|
+
var orderBy = api.data.orderBy || '';
|
|
6388
|
+
var orderDir = api.data.orderDir || '';
|
|
6389
|
+
var sort = orderBy + ' ' + orderDir;
|
|
6390
|
+
sort = orderBy ? sort : "${sort}";
|
|
6467
6391
|
if(selfData.op === 'loadOptions' && selfData.value){
|
|
6468
6392
|
if(selfData.value && selfData.value.indexOf(',') > 0){
|
|
6469
6393
|
filters = [["${referenceTo.valueField.name}", "=", selfData.value.split(',')]];
|
|
@@ -6481,7 +6405,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6481
6405
|
filters.push(["${referenceTo.valueField.name}", "=", ids]);
|
|
6482
6406
|
}
|
|
6483
6407
|
|
|
6484
|
-
api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip);
|
|
6408
|
+
api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim());
|
|
6485
6409
|
return api;
|
|
6486
6410
|
`;
|
|
6487
6411
|
|
|
@@ -6498,6 +6422,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6498
6422
|
pickerSchema = await getTableSchema$1(tableFields, {
|
|
6499
6423
|
labelFieldName: refObjectConfig.NAME_FIELD_KEY,
|
|
6500
6424
|
top: top,
|
|
6425
|
+
isLookup: true,
|
|
6501
6426
|
...ctx
|
|
6502
6427
|
});
|
|
6503
6428
|
|
|
@@ -6511,8 +6436,8 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6511
6436
|
valueField: referenceTo.valueField.name,
|
|
6512
6437
|
modalMode: 'dialog',
|
|
6513
6438
|
source: source,
|
|
6514
|
-
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey
|
|
6515
|
-
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
|
|
6439
|
+
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
|
|
6440
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
6516
6441
|
size: "lg",
|
|
6517
6442
|
pickerSchema: pickerSchema,
|
|
6518
6443
|
joinValues: false,
|
|
@@ -6540,8 +6465,8 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6540
6465
|
/*
|
|
6541
6466
|
* @Author: baozhoutao@steedos.com
|
|
6542
6467
|
* @Date: 2023-01-13 17:27:54
|
|
6543
|
-
* @LastEditors:
|
|
6544
|
-
* @LastEditTime: 2023-
|
|
6468
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
6469
|
+
* @LastEditTime: 2023-08-28 17:45:38
|
|
6545
6470
|
* @Description:
|
|
6546
6471
|
*/
|
|
6547
6472
|
|
|
@@ -6603,18 +6528,47 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
|
|
|
6603
6528
|
|
|
6604
6529
|
const getHtmlFieldSchema = (field, readonly, ctx)=>{
|
|
6605
6530
|
if(readonly){
|
|
6531
|
+
// return {
|
|
6532
|
+
// "type": "control",
|
|
6533
|
+
// "label": field.label,
|
|
6534
|
+
// "body": {
|
|
6535
|
+
// "type": "html",
|
|
6536
|
+
// "name": field.name
|
|
6537
|
+
// }
|
|
6538
|
+
// }
|
|
6606
6539
|
return {
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6540
|
+
"type": "input-rich-text",
|
|
6541
|
+
"receiver": "${context.rootUrl}/s3/images",
|
|
6542
|
+
"name": field.name,
|
|
6543
|
+
"options": {
|
|
6544
|
+
"menu": {
|
|
6545
|
+
"insert": {
|
|
6546
|
+
"title": "Insert",
|
|
6547
|
+
"items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
|
|
6548
|
+
}
|
|
6549
|
+
},
|
|
6550
|
+
"plugins": [
|
|
6551
|
+
"autoresize"
|
|
6552
|
+
],
|
|
6553
|
+
// "max_height": 2000,
|
|
6554
|
+
"statusbar": false,
|
|
6555
|
+
"readonly": true,
|
|
6556
|
+
"toolbar": false,
|
|
6557
|
+
"menubar": false
|
|
6613
6558
|
}
|
|
6559
|
+
}
|
|
6614
6560
|
}else {
|
|
6615
6561
|
return {
|
|
6616
6562
|
"type": "input-rich-text",
|
|
6617
6563
|
"receiver": "${context.rootUrl}/s3/images",
|
|
6564
|
+
"options":{
|
|
6565
|
+
"menu": {
|
|
6566
|
+
"insert": {
|
|
6567
|
+
"title": "Insert",
|
|
6568
|
+
"items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
|
|
6569
|
+
}
|
|
6570
|
+
}
|
|
6571
|
+
},
|
|
6618
6572
|
"name": field.name
|
|
6619
6573
|
}
|
|
6620
6574
|
// return {
|
|
@@ -6668,6 +6622,9 @@ function getAmisStaticFieldType(type, readonly, options){
|
|
|
6668
6622
|
return type;
|
|
6669
6623
|
}
|
|
6670
6624
|
if(_$1.includes(['text','image'], type)){
|
|
6625
|
+
if('text' === type && options && options.amis && options.amis.tpl){
|
|
6626
|
+
return 'static';
|
|
6627
|
+
}
|
|
6671
6628
|
if('image' === type && options && options.multiple){
|
|
6672
6629
|
return `static-images`;
|
|
6673
6630
|
}
|
|
@@ -6938,7 +6895,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
6938
6895
|
// }
|
|
6939
6896
|
switch (field.type) {
|
|
6940
6897
|
case 'text':
|
|
6941
|
-
convertData.type = getAmisStaticFieldType('text', readonly);
|
|
6898
|
+
convertData.type = getAmisStaticFieldType('text', readonly, field);
|
|
6942
6899
|
break;
|
|
6943
6900
|
case 'textarea':
|
|
6944
6901
|
convertData.type = getAmisStaticFieldType('textarea', readonly);
|
|
@@ -7385,7 +7342,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
7385
7342
|
convertData.className = 'm-1';
|
|
7386
7343
|
}
|
|
7387
7344
|
if(readonly){
|
|
7388
|
-
convertData.className = `${convertData.className}
|
|
7345
|
+
convertData.className = `${convertData.className} border-b`;
|
|
7389
7346
|
}
|
|
7390
7347
|
if(readonly){
|
|
7391
7348
|
convertData.quickEdit = false;
|
|
@@ -7855,7 +7812,10 @@ function getFieldWidth(width){
|
|
|
7855
7812
|
}
|
|
7856
7813
|
|
|
7857
7814
|
async function getTableColumns(fields, options){
|
|
7858
|
-
const columns = [
|
|
7815
|
+
const columns = [];
|
|
7816
|
+
if(!options.isLookup){
|
|
7817
|
+
columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
|
|
7818
|
+
}
|
|
7859
7819
|
const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
|
|
7860
7820
|
|
|
7861
7821
|
for (const field of fields) {
|
|
@@ -8090,7 +8050,7 @@ async function getMobileTableColumns(fields, options){
|
|
|
8090
8050
|
let tpl = "";
|
|
8091
8051
|
if(field.is_name || field.name === options.labelFieldName){
|
|
8092
8052
|
nameField = field;
|
|
8093
|
-
options.
|
|
8053
|
+
options.onlyDisplayLookLabel = true;
|
|
8094
8054
|
tpl = await getFieldTpl(field, options);
|
|
8095
8055
|
}
|
|
8096
8056
|
else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
|
|
@@ -8099,12 +8059,13 @@ async function getMobileTableColumns(fields, options){
|
|
|
8099
8059
|
}
|
|
8100
8060
|
else {
|
|
8101
8061
|
if(field.type === 'lookup' || field.type === 'master_detail'){
|
|
8102
|
-
options.
|
|
8062
|
+
options.onlyDisplayLookLabel = true;
|
|
8103
8063
|
}
|
|
8104
8064
|
tpl = await getFieldTpl(field, options);
|
|
8105
8065
|
}
|
|
8106
8066
|
if(!tpl){
|
|
8107
|
-
|
|
8067
|
+
//qhd需求简易处理,加上raw以支持审批王名称字段通过颜色区分缓急,若之后手机端列表支持配置amis,则可以去掉
|
|
8068
|
+
tpl = `\${${field.name} | raw}`;
|
|
8108
8069
|
}
|
|
8109
8070
|
if(!field.hidden && !field.extra){
|
|
8110
8071
|
tpls.push({ field, tpl });
|
|
@@ -8300,7 +8261,12 @@ async function getTableSchema$1(fields, options){
|
|
|
8300
8261
|
options = {};
|
|
8301
8262
|
}
|
|
8302
8263
|
let columns = [];
|
|
8303
|
-
|
|
8264
|
+
let useMobileColumns = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
|
|
8265
|
+
if(isLookup){
|
|
8266
|
+
// 在lookup手机端列表模式调式好之前不使用getMobileTableColumns
|
|
8267
|
+
useMobileColumns = false;
|
|
8268
|
+
}
|
|
8269
|
+
if(useMobileColumns){
|
|
8304
8270
|
columns = await getMobileTableColumns(fields, options);
|
|
8305
8271
|
}
|
|
8306
8272
|
else {
|
|
@@ -8320,7 +8286,7 @@ async function getTableSchema$1(fields, options){
|
|
|
8320
8286
|
columns: columns,
|
|
8321
8287
|
syncLocation: false,
|
|
8322
8288
|
keepItemSelectionOnPageChange: true,
|
|
8323
|
-
checkOnItemClick: false,
|
|
8289
|
+
checkOnItemClick: isLookup ? true : false,
|
|
8324
8290
|
labelTpl: `\${${options.labelFieldName}}`,
|
|
8325
8291
|
autoFillHeight: false, // 自动高度效果不理想,先关闭
|
|
8326
8292
|
columnsTogglable: false,
|
|
@@ -8944,7 +8910,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
8944
8910
|
var defaultValues = {};
|
|
8945
8911
|
_.each(uiSchema && uiSchema.fields, function(field){
|
|
8946
8912
|
var value = SteedosUI.getFieldDefaultValue(field, api.body.global);
|
|
8947
|
-
if(value){
|
|
8913
|
+
if(!_.isNil(value)){
|
|
8948
8914
|
defaultValues[field.name] = value;
|
|
8949
8915
|
}
|
|
8950
8916
|
});
|
|
@@ -9602,14 +9568,15 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
9602
9568
|
/*
|
|
9603
9569
|
* @Author: baozhoutao@steedos.com
|
|
9604
9570
|
* @Date: 2022-05-26 16:02:08
|
|
9605
|
-
* @LastEditors:
|
|
9606
|
-
* @LastEditTime: 2023-
|
|
9571
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
9572
|
+
* @LastEditTime: 2023-09-05 15:42:26
|
|
9607
9573
|
* @Description:
|
|
9608
9574
|
*/
|
|
9609
9575
|
|
|
9610
|
-
const getFieldSchemaArray = (formFields) => {
|
|
9576
|
+
const getFieldSchemaArray = (formFields, ctx) => {
|
|
9611
9577
|
let fieldSchemaArray = [];
|
|
9612
9578
|
fieldSchemaArray.length = 0;
|
|
9579
|
+
const recordId = ctx && ctx.recordId;
|
|
9613
9580
|
|
|
9614
9581
|
_$1.forEach(formFields, (field) => {
|
|
9615
9582
|
if (!field.group || field.group == 'null' || field.group == '-')
|
|
@@ -9621,8 +9588,14 @@ const getFieldSchemaArray = (formFields) => {
|
|
|
9621
9588
|
field.is_wide = true;
|
|
9622
9589
|
}
|
|
9623
9590
|
|
|
9591
|
+
let forceHidden = false;
|
|
9592
|
+
if(!recordId && field.readonly){
|
|
9593
|
+
// 新建记录时,只读字段先隐藏,后续支持显示后,即任务:https://github.com/steedos/steedos-platform/issues/3164 完成后再放开
|
|
9594
|
+
forceHidden = true;
|
|
9595
|
+
}
|
|
9596
|
+
|
|
9624
9597
|
if (!isObjectField) {
|
|
9625
|
-
if (!field.hidden) {
|
|
9598
|
+
if (!field.hidden && !forceHidden) {
|
|
9626
9599
|
fieldSchemaArray.push(Object.assign({ name: fieldName }, field, { permission: { allowEdit: true } }));
|
|
9627
9600
|
}
|
|
9628
9601
|
}
|
|
@@ -9693,7 +9666,7 @@ const getSections = async (permissionFields, formFields, ctx) => {
|
|
|
9693
9666
|
if (!ctx) {
|
|
9694
9667
|
ctx = {};
|
|
9695
9668
|
}
|
|
9696
|
-
const fieldSchemaArray = getFieldSchemaArray(formFields);
|
|
9669
|
+
const fieldSchemaArray = getFieldSchemaArray(formFields, ctx);
|
|
9697
9670
|
const _sections = _$1.groupBy(fieldSchemaArray, 'group');
|
|
9698
9671
|
const sections = [];
|
|
9699
9672
|
var sectionVisibleOns = [];
|
|
@@ -9914,7 +9887,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
9914
9887
|
}
|
|
9915
9888
|
`;
|
|
9916
9889
|
let autoFillHeight = true;
|
|
9917
|
-
if(options.isRelated ||
|
|
9890
|
+
if(options.isRelated || window.innerWidth < 768){
|
|
9918
9891
|
autoFillHeight = false;
|
|
9919
9892
|
}
|
|
9920
9893
|
|
|
@@ -10287,7 +10260,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
10287
10260
|
* @Author: baozhoutao@steedos.com
|
|
10288
10261
|
* @Date: 2022-07-05 15:55:39
|
|
10289
10262
|
* @LastEditors: liaodaxue
|
|
10290
|
-
* @LastEditTime: 2023-08-
|
|
10263
|
+
* @LastEditTime: 2023-08-28 14:55:23
|
|
10291
10264
|
* @Description:
|
|
10292
10265
|
*/
|
|
10293
10266
|
|
|
@@ -10433,11 +10406,16 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
10433
10406
|
// }
|
|
10434
10407
|
const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel, ctx);
|
|
10435
10408
|
const componentId = `steedos-record-related-list-${relatedObjectName}`;
|
|
10409
|
+
const isMobile = window.innerWidth < 768;
|
|
10410
|
+
let headerToolbar = [];
|
|
10411
|
+
if(!isMobile){
|
|
10412
|
+
headerToolbar.push("bulkActions");
|
|
10413
|
+
}
|
|
10436
10414
|
const options = {
|
|
10437
10415
|
globalFilter,
|
|
10438
10416
|
defaults: {
|
|
10439
10417
|
listSchema: {
|
|
10440
|
-
headerToolbar
|
|
10418
|
+
headerToolbar,
|
|
10441
10419
|
columnsTogglable: false,
|
|
10442
10420
|
onEvent: {
|
|
10443
10421
|
[`@data.changed.${relatedObjectName}`]: {
|