@steedos-widgets/amis-lib 6.3.13-beta.3 → 6.10.1-beta.13
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 +129 -268
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +129 -268
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +82 -122
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/fields/index.d.ts +1 -1
- package/dist/types/lib/converter/amis/fields_filter.d.ts +10 -1
- package/dist/types/lib/converter/amis/header.d.ts +10 -1
- package/dist/types/lib/converter/amis/toolbar.d.ts +10 -1
- package/dist/types/lib/converter/amis/toolbars/setting_listview/columns.d.ts +1 -4
- package/dist/types/lib/converter/amis/toolbars/setting_listview/copy.d.ts +7 -2
- package/dist/types/lib/converter/amis/toolbars/setting_listview/delete.d.ts +7 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview/filters.d.ts +1 -4
- package/dist/types/lib/converter/amis/toolbars/setting_listview/new.d.ts +7 -2
- package/dist/types/lib/converter/amis/toolbars/setting_listview/rename.d.ts +7 -2
- package/dist/types/lib/converter/amis/toolbars/setting_listview/sort.d.ts +1 -4
- package/dist/types/lib/converter/amis/toolbars/setting_listview.d.ts +31 -18
- package/dist/types/lib/objects.d.ts +2 -2
- package/dist/types/schema/standard_delete.amis.d.ts +0 -13
- package/dist/types/standard/button.d.ts +0 -13
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -505,8 +505,8 @@ function getComparableAmisVersion() {
|
|
|
505
505
|
/*
|
|
506
506
|
* @Author: baozhoutao@steedos.com
|
|
507
507
|
* @Date: 2022-05-23 09:53:08
|
|
508
|
-
* @LastEditors:
|
|
509
|
-
* @LastEditTime:
|
|
508
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
509
|
+
* @LastEditTime: 2024-11-17 13:10:08
|
|
510
510
|
* @Description:
|
|
511
511
|
*/
|
|
512
512
|
|
|
@@ -577,9 +577,6 @@ function getSelectMap(selectOptions){
|
|
|
577
577
|
}
|
|
578
578
|
|
|
579
579
|
function getNameTplUrl(field, ctx){
|
|
580
|
-
// if(ctx.objectName === 'cms_files'){
|
|
581
|
-
// return "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}"
|
|
582
|
-
// }
|
|
583
580
|
const href = Router.getObjectDetailPath({
|
|
584
581
|
...ctx, formFactor: ctx.formFactor, appId: "${appId}", objectName: ctx.objectName || "${objectName}", recordId: `\${${ctx.idFieldName}}`
|
|
585
582
|
});
|
|
@@ -663,10 +660,9 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
663
660
|
const href = Router.getObjectDetailPath({
|
|
664
661
|
formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
|
|
665
662
|
});
|
|
666
|
-
if
|
|
667
|
-
// 相关表字段,包括列表视图、对象表格组件中的lookup/master_detail字段,在PC端显示时,点击字段值,不跳转到详情页而是右侧弹出drawer
|
|
663
|
+
if(ctx.isRelated && window.innerWidth >= 768){
|
|
668
664
|
labelTpl = `<a href="${href}" ${linkTarget} onclick="return false;">${labelTpl}</a>`;
|
|
669
|
-
}
|
|
665
|
+
}else {
|
|
670
666
|
labelTpl = `<a href="${href}" ${linkTarget}>${labelTpl}</a>`;
|
|
671
667
|
}
|
|
672
668
|
|
|
@@ -1396,7 +1392,7 @@ const getAmisFileEditSchema = (steedosField)=>{
|
|
|
1396
1392
|
receiver: {
|
|
1397
1393
|
method: "post",
|
|
1398
1394
|
dataType: "form-data",
|
|
1399
|
-
url: `\${context.rootUrl}/
|
|
1395
|
+
url: `\${context.rootUrl}/api/v6/files/cfs.${tableName}.filerecord`,
|
|
1400
1396
|
requestAdaptor: `
|
|
1401
1397
|
const superData = (typeof context != 'undefined') ? context : api.body;
|
|
1402
1398
|
const { _master, global } = superData;
|
|
@@ -1419,14 +1415,14 @@ const getAmisFileEditSchema = (steedosField)=>{
|
|
|
1419
1415
|
adaptor: `
|
|
1420
1416
|
const superData = (typeof context != 'undefined') ? context : api.body;
|
|
1421
1417
|
const { context:pageContext } = superData;
|
|
1422
|
-
var rootUrl = pageContext.rootUrl + "/api/files
|
|
1418
|
+
var rootUrl = pageContext.rootUrl + "/api/v6/files/download/cfs.${tableName}.filerecord/";
|
|
1423
1419
|
payload = {
|
|
1424
1420
|
status: response.status == 200 ? 0 : response.status,
|
|
1425
1421
|
msg: response.statusText,
|
|
1426
1422
|
data: {
|
|
1427
1423
|
value: payload._id,
|
|
1428
1424
|
name: payload.original.name,
|
|
1429
|
-
url: rootUrl + payload._id,
|
|
1425
|
+
url: rootUrl + payload._id + "/" + payload.original.name,
|
|
1430
1426
|
}
|
|
1431
1427
|
}
|
|
1432
1428
|
return payload;
|
|
@@ -1897,12 +1893,7 @@ async function getQuickEditSchema(object, columnField, options){
|
|
|
1897
1893
|
if (field.disabled) {
|
|
1898
1894
|
quickEditSchema = false;
|
|
1899
1895
|
} else {
|
|
1900
|
-
var
|
|
1901
|
-
defaults: Object.assign({}, options.defaults, {
|
|
1902
|
-
formSchema: quickEditSchema
|
|
1903
|
-
})
|
|
1904
|
-
});
|
|
1905
|
-
var fieldSchema = await convertSFieldToAmisField(field, false, fieldCtx);
|
|
1896
|
+
var fieldSchema = await convertSFieldToAmisField(field, false, _$1.omit(options, 'buttons'));
|
|
1906
1897
|
//存在属性上可编辑,实际不可编辑的字段,convertSFieldToAmisField函数可能会返回undefined,如summary
|
|
1907
1898
|
if (!!fieldSchema) {
|
|
1908
1899
|
quickEditSchema.body.push(fieldSchema);
|
|
@@ -2335,19 +2326,14 @@ function getFieldWidth(width){
|
|
|
2335
2326
|
}
|
|
2336
2327
|
|
|
2337
2328
|
async function getColumnItemOnClick(field, options){
|
|
2338
|
-
|
|
2339
|
-
if(!(field.is_name || field.name === options.labelFieldName)){
|
|
2340
|
-
objectApiName = field.reference_to;
|
|
2341
|
-
}
|
|
2342
|
-
const recordPage = await getPage({ type: 'record', appId: options.appId, objectName: objectApiName, formFactor: options.formFactor });
|
|
2329
|
+
const recordPage = await getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor });
|
|
2343
2330
|
const drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
|
|
2344
2331
|
"recordId": `\${${options.idFieldName}}`,
|
|
2345
2332
|
"data": {
|
|
2346
2333
|
...recordPage.schema.data,
|
|
2347
2334
|
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
2348
2335
|
"recordLoaded": false, // 重置数据加载状态
|
|
2349
|
-
"recordId": `\${${options.idFieldName}}
|
|
2350
|
-
"_tableObjectName": options.objectName
|
|
2336
|
+
"recordId": `\${${options.idFieldName}}`//审批微页面依赖了作用域中的recordId
|
|
2351
2337
|
}
|
|
2352
2338
|
}) : {
|
|
2353
2339
|
"type": "steedos-record-detail",
|
|
@@ -2358,16 +2344,12 @@ async function getColumnItemOnClick(field, options){
|
|
|
2358
2344
|
"data": {
|
|
2359
2345
|
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
2360
2346
|
"recordLoaded": false, // 重置数据加载状态
|
|
2361
|
-
"_tableObjectName": options.objectName
|
|
2362
2347
|
}
|
|
2363
2348
|
};
|
|
2364
2349
|
|
|
2365
2350
|
if(!(field.is_name || field.name === options.labelFieldName)){
|
|
2366
2351
|
drawerRecordDetailSchema.objectApiName = field.reference_to;
|
|
2367
2352
|
drawerRecordDetailSchema.recordId = `\${_display.${field.name}.value}`;
|
|
2368
|
-
// if (recordPage){
|
|
2369
|
-
// drawerRecordDetailSchema.data.recordId = `\${_display.${field.name}.value}`
|
|
2370
|
-
// }
|
|
2371
2353
|
}
|
|
2372
2354
|
return {
|
|
2373
2355
|
"click": {
|
|
@@ -2517,32 +2499,6 @@ async function getTableColumns(object, fields, options){
|
|
|
2517
2499
|
static: true,
|
|
2518
2500
|
}, fieldAmis, {name: field.name});
|
|
2519
2501
|
}
|
|
2520
|
-
else if(field.type === 'lookup' || field.type === 'master_detail'){
|
|
2521
|
-
columnItem = Object.assign({}, {
|
|
2522
|
-
type: "static-wrapper",
|
|
2523
|
-
name: field.name,
|
|
2524
|
-
label: field.label,
|
|
2525
|
-
sortable: field.sortable,
|
|
2526
|
-
width: getFieldWidth(field.width),
|
|
2527
|
-
toggled: field.toggled,
|
|
2528
|
-
className,
|
|
2529
|
-
size: "none",
|
|
2530
|
-
inputClassName: "inline",
|
|
2531
|
-
body: {
|
|
2532
|
-
type: "steedos-field",
|
|
2533
|
-
static: true,
|
|
2534
|
-
tableObjectName: options.objectName,
|
|
2535
|
-
config: {
|
|
2536
|
-
type: "lookup",
|
|
2537
|
-
reference_to: field.reference_to,
|
|
2538
|
-
name: field.name,
|
|
2539
|
-
label: null,
|
|
2540
|
-
multiple: field.multiple,
|
|
2541
|
-
amis: Object.assign({}, fieldAmis, { label: null })
|
|
2542
|
-
}
|
|
2543
|
-
}
|
|
2544
|
-
}, fieldAmis, {name: field.name});
|
|
2545
|
-
}
|
|
2546
2502
|
else {
|
|
2547
2503
|
const tpl = await getFieldTpl(field, options);
|
|
2548
2504
|
let type = 'static-text';
|
|
@@ -2591,20 +2547,10 @@ async function getTableColumns(object, fields, options){
|
|
|
2591
2547
|
columnItem.defaultColor = null;
|
|
2592
2548
|
}
|
|
2593
2549
|
|
|
2594
|
-
|
|
2595
|
-
// if (options.isRelated){
|
|
2596
|
-
// // 子表列表上,Lookup字段和名称字段都需要点击事件
|
|
2597
|
-
// needClickEvent = ((field.is_name || field.name === options.labelFieldName) || ((field.type == 'lookup' || field.type == 'master_detail') && _.isString(field.reference_to) && field.multiple != true));
|
|
2598
|
-
// }
|
|
2599
|
-
// else {// if (isObjectListview)
|
|
2600
|
-
// // 列表视图、对象表格中,Lookup字段需要点击事件
|
|
2601
|
-
// needClickEvent = (field.type == 'lookup' || field.type == 'master_detail') && _.isString(field.reference_to) && field.multiple != true;
|
|
2602
|
-
// }
|
|
2603
|
-
// lookup字段走steedos-field组件了,所以这里只需要判断子表名称字段才额外加点击事件弹出右侧详情
|
|
2604
|
-
needClickEvent = options.isRelated && (field.is_name || field.name === options.labelFieldName);
|
|
2605
|
-
if(window.innerWidth >= 768 && needClickEvent){
|
|
2550
|
+
if(window.innerWidth >= 768 && ((field.is_name || field.name === options.labelFieldName) || ((field.type == 'lookup' || field.type == 'master_detail') && _$1.isString(field.reference_to) && field.multiple != true)) && options.isRelated){
|
|
2606
2551
|
columnItem.onEvent = await getColumnItemOnClick(field, options);
|
|
2607
2552
|
}
|
|
2553
|
+
|
|
2608
2554
|
}
|
|
2609
2555
|
}
|
|
2610
2556
|
if(columnItem){
|
|
@@ -2871,7 +2817,9 @@ function getButtonVisibleOn$1(button){
|
|
|
2871
2817
|
// return 'false';
|
|
2872
2818
|
// }
|
|
2873
2819
|
if(visible.trim().startsWith('function')){
|
|
2874
|
-
|
|
2820
|
+
visible = visible.replace('function', 'function __visible');
|
|
2821
|
+
const visibleStr = `(function _visible(){try{return (${visible})(objectName, typeof _id === 'undefined' ? null: _id, typeof record === 'undefined' ? (typeof recordPermissions === 'undefined' ? {} : recordPermissions) : record.recordPermissions, data)}catch(e){console.error(e)}})()`;
|
|
2822
|
+
return visibleStr;
|
|
2875
2823
|
}
|
|
2876
2824
|
return visible;
|
|
2877
2825
|
}
|
|
@@ -3123,10 +3071,10 @@ async function getTableApi(mainObject, fields, options){
|
|
|
3123
3071
|
let valueField = mainObject.key_field || '_id';
|
|
3124
3072
|
const api = await getApi$1(mainObject, null, fields, {count: options.queryCount, alias: 'rows', limit: top, queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
|
|
3125
3073
|
|
|
3126
|
-
api.url
|
|
3127
|
-
if(options.isRelated){
|
|
3128
|
-
|
|
3129
|
-
}
|
|
3074
|
+
api.url;//设计器上对象表格组件需要切换对象重新请求列表数据
|
|
3075
|
+
// if(options.isRelated){
|
|
3076
|
+
// api.url += "&recordId=${_master.recordId}";
|
|
3077
|
+
// }
|
|
3130
3078
|
api.cache = 3000;
|
|
3131
3079
|
api.data.$term = "$term";
|
|
3132
3080
|
api.data.term = "$term";
|
|
@@ -3260,7 +3208,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
3260
3208
|
const refField = self.uiSchema.fields[relatedKey];
|
|
3261
3209
|
const masterRecord = self._master.record;
|
|
3262
3210
|
const masterObjectName = self._master.objectName;
|
|
3263
|
-
let relatedValue =
|
|
3211
|
+
let relatedValue = masterRecord._id;
|
|
3264
3212
|
if(refField && refField.reference_to_field && refField.reference_to_field != '_id'){
|
|
3265
3213
|
relatedValue = masterRecord[refField.reference_to_field]
|
|
3266
3214
|
}
|
|
@@ -3301,6 +3249,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
3301
3249
|
skip: skip,
|
|
3302
3250
|
fields: ${JSON.stringify(_$1.map(fields, 'name'))}
|
|
3303
3251
|
}));
|
|
3252
|
+
// console.log('table requestAdaptor', api);
|
|
3304
3253
|
return api;
|
|
3305
3254
|
`;
|
|
3306
3255
|
api.adaptor = `
|
|
@@ -3438,17 +3387,15 @@ async function getTableApi(mainObject, fields, options){
|
|
|
3438
3387
|
}
|
|
3439
3388
|
// 标记加载过,后续优先从本地存储中加载相关参数
|
|
3440
3389
|
payload.data.loaded= true;
|
|
3441
|
-
|
|
3442
3390
|
const setDataToComponentId = "${setDataToComponentId}";
|
|
3443
3391
|
if(setDataToComponentId){
|
|
3444
3392
|
//https://github.com/baidu/amis/pull/6807 .parent的改动是为适应3.2getComponentById的规则改动,不影响2.9
|
|
3445
|
-
var scope =
|
|
3393
|
+
var scope = context._scoped;
|
|
3446
3394
|
var scopeParent = scope && scope.parent;
|
|
3447
3395
|
var setDataToComponent = scopeParent && scopeParent.getComponentById(setDataToComponentId);
|
|
3448
3396
|
if(setDataToComponent){
|
|
3449
3397
|
setDataToComponent.setData({$count: payload.data.count});
|
|
3450
3398
|
}
|
|
3451
|
-
// SteedosUI.getRef(api.body.$self.$scopeId)?.parent?.getComponentById(setDataToComponentId)?.setData({$count: payload.data.count})
|
|
3452
3399
|
};
|
|
3453
3400
|
let formFactor = "${options.formFactor}";
|
|
3454
3401
|
if(formFactor !== "SMALL"){
|
|
@@ -3513,7 +3460,7 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3513
3460
|
}
|
|
3514
3461
|
if(field.multiple){
|
|
3515
3462
|
scriptStr = scriptStr + `data.${field.name}__label = _.map(_.filter(${field.name}Options, function(option){return _.includes(data.${field.name}, option.value)}), 'label');`;
|
|
3516
|
-
}else {
|
|
3463
|
+
}else if(scriptStr != ''){
|
|
3517
3464
|
scriptStr = scriptStr + `var ${field.name}Selected = _.find(${field.name}Options, function(option){return data.${field.name} == option.value});`;
|
|
3518
3465
|
scriptStr = scriptStr + `data.${field.name}__label = ${field.name}Selected ? ${field.name}Selected.label:null;`;
|
|
3519
3466
|
}
|
|
@@ -3561,6 +3508,7 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3561
3508
|
payload.data.data = [emptyDoc];
|
|
3562
3509
|
}
|
|
3563
3510
|
else{
|
|
3511
|
+
console.log('无法找到记录', api, payload, context)
|
|
3564
3512
|
return {
|
|
3565
3513
|
status: 2,
|
|
3566
3514
|
msg: "${i18next.t('frontend_no_records_found')}"
|
|
@@ -3587,13 +3535,12 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3587
3535
|
console.error(e)
|
|
3588
3536
|
}
|
|
3589
3537
|
payload.data = data;
|
|
3590
|
-
payload.data.__objectName = "${object.name}";
|
|
3591
3538
|
payload.data.record = record;
|
|
3592
3539
|
payload.data.NAME_FIELD_VALUE = ${nameLabel} || record.name;
|
|
3593
3540
|
payload.data._master = {
|
|
3594
3541
|
record: record,
|
|
3595
|
-
objectName: "
|
|
3596
|
-
recordId:
|
|
3542
|
+
objectName: "\${objectName}",
|
|
3543
|
+
recordId: "\${recordId}"
|
|
3597
3544
|
}
|
|
3598
3545
|
window.postMessage(Object.assign({type: "record.loaded"}, {record: record}), "*")
|
|
3599
3546
|
}
|
|
@@ -3619,7 +3566,7 @@ async function getReadonlyFormInitApi(object, recordId, fields, options){
|
|
|
3619
3566
|
}
|
|
3620
3567
|
return {
|
|
3621
3568
|
method: "post",
|
|
3622
|
-
url: getApi$2()
|
|
3569
|
+
url: getApi$2(),
|
|
3623
3570
|
cache: API_CACHE,
|
|
3624
3571
|
requestAdaptor: `
|
|
3625
3572
|
${options && options.initApiRequestAdaptor || ''}
|
|
@@ -3710,7 +3657,7 @@ function getScriptForRewriteValueForFileFields(fields){
|
|
|
3710
3657
|
return {
|
|
3711
3658
|
value: fileFieldValue[index],
|
|
3712
3659
|
name: item.name,
|
|
3713
|
-
url: item.url
|
|
3660
|
+
url: item.url,
|
|
3714
3661
|
state: "uploaded"
|
|
3715
3662
|
}
|
|
3716
3663
|
});
|
|
@@ -3720,7 +3667,7 @@ function getScriptForRewriteValueForFileFields(fields){
|
|
|
3720
3667
|
data[item] = [{
|
|
3721
3668
|
value: fileFieldValue,
|
|
3722
3669
|
name: fileFieldDisplayValue.name,
|
|
3723
|
-
url: fileFieldDisplayValue.url
|
|
3670
|
+
url: fileFieldDisplayValue.url,
|
|
3724
3671
|
state: "uploaded"
|
|
3725
3672
|
}];
|
|
3726
3673
|
}
|
|
@@ -3741,7 +3688,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
3741
3688
|
|
|
3742
3689
|
return {
|
|
3743
3690
|
method: "post",
|
|
3744
|
-
url: getApi$2()
|
|
3691
|
+
url: getApi$2(),
|
|
3745
3692
|
// sendOn: "!!this.recordId",
|
|
3746
3693
|
cache: API_CACHE,
|
|
3747
3694
|
requestAdaptor: `
|
|
@@ -4502,6 +4449,11 @@ var __assign = function() {
|
|
|
4502
4449
|
return t;
|
|
4503
4450
|
};
|
|
4504
4451
|
return __assign.apply(this, arguments);
|
|
4452
|
+
};
|
|
4453
|
+
|
|
4454
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
4455
|
+
var e = new Error(message);
|
|
4456
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
4505
4457
|
};
|
|
4506
4458
|
|
|
4507
4459
|
/**
|
|
@@ -4891,7 +4843,7 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
4891
4843
|
// 如果新建记录时复制的数据中有omit或其他不相关字段数据时不应该一起保存到数据库,
|
|
4892
4844
|
// 原规则见:https://github.com/steedos/steedos-frontend/issues/297
|
|
4893
4845
|
_.forEach(selectedRowResponseResult, (val, key) => {
|
|
4894
|
-
if (fieldsKeys.indexOf(key) > -1 && fields[key].omit !== true) {
|
|
4846
|
+
if (fieldsKeys.indexOf(key) > -1 && fields[key].omit !== true && key != 'owner') {
|
|
4895
4847
|
defaultData[key] = val;
|
|
4896
4848
|
}
|
|
4897
4849
|
})
|
|
@@ -4901,7 +4853,7 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
4901
4853
|
if(_master && _master._isRelated){
|
|
4902
4854
|
const relatedKey = _master.relatedKey;
|
|
4903
4855
|
const masterObjectName = _master.objectName;
|
|
4904
|
-
const recordId = _master.recordId;
|
|
4856
|
+
const recordId = _master.recordId || _master.record._id;
|
|
4905
4857
|
let relatedKeySaveValue = recordId;
|
|
4906
4858
|
const relatedField = fields[relatedKey];
|
|
4907
4859
|
if(relatedField && relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
|
|
@@ -4926,7 +4878,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
4926
4878
|
formSchema.defaultData = defaultData;
|
|
4927
4879
|
}
|
|
4928
4880
|
}
|
|
4929
|
-
|
|
4930
4881
|
return {
|
|
4931
4882
|
data: formSchema
|
|
4932
4883
|
};
|
|
@@ -5151,8 +5102,8 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
5151
5102
|
/*
|
|
5152
5103
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
5153
5104
|
* @Date: 2023-03-22 09:31:21
|
|
5154
|
-
* @LastEditors:
|
|
5155
|
-
* @LastEditTime:
|
|
5105
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
5106
|
+
* @LastEditTime: 2024-02-18 16:06:21
|
|
5156
5107
|
*/
|
|
5157
5108
|
const getSchema$3 = (uiSchema)=>{
|
|
5158
5109
|
return {
|
|
@@ -5212,17 +5163,6 @@ const getSchema$3 = (uiSchema)=>{
|
|
|
5212
5163
|
"_isRelated": "${_isRelated}"
|
|
5213
5164
|
},
|
|
5214
5165
|
"expression": `\${_master.objectName != '${uiSchema.name}' && _master.objectName}`
|
|
5215
|
-
},
|
|
5216
|
-
// 列表视图、对象表格组件上的lookup字段,点开右侧弹出drawer窗口,删除记录后刷新列表
|
|
5217
|
-
{
|
|
5218
|
-
"actionType": "broadcast",
|
|
5219
|
-
"args": {
|
|
5220
|
-
"eventName": "@data.changed.${_tableObjectName}"
|
|
5221
|
-
},
|
|
5222
|
-
"data": {
|
|
5223
|
-
"objectName": "${_tableObjectName}"
|
|
5224
|
-
},
|
|
5225
|
-
"expression": `\${_tableObjectName != '${uiSchema.name}' && _tableObjectName}`
|
|
5226
5166
|
}
|
|
5227
5167
|
]
|
|
5228
5168
|
}
|
|
@@ -5514,9 +5454,7 @@ const StandardButtons = {
|
|
|
5514
5454
|
objectName,
|
|
5515
5455
|
uiSchema
|
|
5516
5456
|
} = this;
|
|
5517
|
-
const
|
|
5518
|
-
const scope = this.scope || SteedosUI?.getRef(scopeId);
|
|
5519
|
-
//https://github.com/baidu/amis/pull/6807 .parent的改动是为适应3.2getComponentById的规则改动,不影响2.9
|
|
5457
|
+
const scope = this.scope;
|
|
5520
5458
|
const listViewRef = scope.parent?.getComponentById(`listview_${uiSchema.name}`);
|
|
5521
5459
|
if(_.isEmpty(listViewRef.props.store.toJSON().selectedItems)){
|
|
5522
5460
|
listViewRef.handleAction({}, {
|
|
@@ -5579,9 +5517,7 @@ function getButtonVisibleOn(button){
|
|
|
5579
5517
|
// return 'false';
|
|
5580
5518
|
// }
|
|
5581
5519
|
if(visible.trim().startsWith('function')){
|
|
5582
|
-
visible =
|
|
5583
|
-
object: uiSchema
|
|
5584
|
-
}, [objectName, typeof _id === 'undefined' ? null: _id, typeof record === 'undefined' ? (typeof recordPermissions === 'undefined' ? {} : recordPermissions) : record.recordPermissions, data])`;
|
|
5520
|
+
visible = `(function(){try{const fun = ${visible}; return fun.apply({}, [objectName, typeof _id === 'undefined' ? null: _id, typeof record === 'undefined' ? (typeof recordPermissions === 'undefined' ? {} : recordPermissions) : record.recordPermissions, data])}catch(e){console.error(e)}})()`;
|
|
5585
5521
|
}
|
|
5586
5522
|
}
|
|
5587
5523
|
|
|
@@ -5879,7 +5815,7 @@ const execute = (button, props) => {
|
|
|
5879
5815
|
...props,
|
|
5880
5816
|
action: button
|
|
5881
5817
|
};
|
|
5882
|
-
return button.todo.apply(todoThis, [todoThis.objectName, todoThis.recordId]);
|
|
5818
|
+
return button.todo.apply(todoThis, [todoThis.objectName, todoThis.recordId, props.record?.record?.recordPermissions, props.record]);
|
|
5883
5819
|
}
|
|
5884
5820
|
};
|
|
5885
5821
|
|
|
@@ -6376,21 +6312,6 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6376
6312
|
let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service", {name: "service_object_table_crud"});
|
|
6377
6313
|
crudService && crudService.setData({isFieldsFilterEmpty: true, showFieldsFilter: false});
|
|
6378
6314
|
`;
|
|
6379
|
-
/**
|
|
6380
|
-
给lookup字段配置filter_form_data时可以配置为amis变量,也可以配置为事态key-value键值对象值:
|
|
6381
|
-
```
|
|
6382
|
-
"filter_form_data": "${selectedPublicGroupFilterFormData|toJson}"
|
|
6383
|
-
```
|
|
6384
|
-
or
|
|
6385
|
-
```
|
|
6386
|
-
"filter_form_data": {
|
|
6387
|
-
"public_group_ids": [
|
|
6388
|
-
"67addbef39f9a4503789b38d"
|
|
6389
|
-
]
|
|
6390
|
-
}
|
|
6391
|
-
```
|
|
6392
|
-
*/
|
|
6393
|
-
const filterFormValues = ctx.filter_form_data;
|
|
6394
6315
|
const dataProviderInited = `
|
|
6395
6316
|
const searchableFields = ${JSON.stringify(searchableFields)};
|
|
6396
6317
|
const autoOpenFilter = ${autoOpenFilter};
|
|
@@ -6428,16 +6349,6 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6428
6349
|
}
|
|
6429
6350
|
setData({ filterFormSearchableFields: defaultSearchableFields });
|
|
6430
6351
|
if(isLookup){
|
|
6431
|
-
let filterFormValues = ${_.isObject(filterFormValues) ? JSON.stringify(filterFormValues) : ('"' + filterFormValues + '"')} || {};
|
|
6432
|
-
const isAmisFormula = typeof filterFormValues === "string" && filterFormValues.indexOf("\${") > -1;
|
|
6433
|
-
if (isAmisFormula){
|
|
6434
|
-
filterFormValues = AmisCore.evaluate(filterFormValues, data) || {};
|
|
6435
|
-
}
|
|
6436
|
-
if (_.isObject(filterFormValues) || !_.isEmpty(filterFormValues)){
|
|
6437
|
-
let fields = data.uiSchema && data.uiSchema.fields;
|
|
6438
|
-
filterFormValues = SteedosUI.getSearchFilterFormValues(filterFormValues, fields);
|
|
6439
|
-
setData({ ...filterFormValues });
|
|
6440
|
-
}
|
|
6441
6352
|
// looup字段过滤器不在本地缓存记住过滤条件,所以初始始终隐藏过滤器
|
|
6442
6353
|
setData({ showFieldsFilter: autoOpenFilter });
|
|
6443
6354
|
}
|
|
@@ -6729,15 +6640,13 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6729
6640
|
"actionType": "custom",
|
|
6730
6641
|
"script": onSearchableFieldsChangeScript
|
|
6731
6642
|
},
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
// }
|
|
6740
|
-
// },
|
|
6643
|
+
{
|
|
6644
|
+
"actionType": "click",
|
|
6645
|
+
"componentId": btnSearchId,
|
|
6646
|
+
"args": {
|
|
6647
|
+
"__from_fields_filter_settings_confirm": true
|
|
6648
|
+
}
|
|
6649
|
+
},
|
|
6741
6650
|
{
|
|
6742
6651
|
"componentId": "",
|
|
6743
6652
|
"args": {},
|
|
@@ -6848,6 +6757,10 @@ const getNewListviewButtonSchema = ()=>{
|
|
|
6848
6757
|
"blank": false
|
|
6849
6758
|
},
|
|
6850
6759
|
"actionType": "url",
|
|
6760
|
+
},
|
|
6761
|
+
{
|
|
6762
|
+
"actionType": "custom",
|
|
6763
|
+
"script": "window.location.reload();"
|
|
6851
6764
|
}
|
|
6852
6765
|
]
|
|
6853
6766
|
}
|
|
@@ -7717,6 +7630,7 @@ function getObjectListHeader(objectSchema, listViewName, ctx) {
|
|
|
7717
7630
|
"body": body,
|
|
7718
7631
|
"className": `sm:rounded-tl sm:rounded-tr p-4 -mb-4`
|
|
7719
7632
|
}];
|
|
7633
|
+
// console.log(`getObjectListHeader`, objectSchema, listViewName, ctx)
|
|
7720
7634
|
return headerSchema;
|
|
7721
7635
|
}
|
|
7722
7636
|
|
|
@@ -7738,7 +7652,7 @@ function getBackButtonSchema(){
|
|
|
7738
7652
|
},
|
|
7739
7653
|
"body":[{
|
|
7740
7654
|
"type": "button",
|
|
7741
|
-
"visibleOn": "${window:innerWidth > 768 &&
|
|
7655
|
+
"visibleOn": "${window:innerWidth > 768 && display !== 'split'}",
|
|
7742
7656
|
"className":"flex mr-4",
|
|
7743
7657
|
"onEvent": {
|
|
7744
7658
|
"click": {
|
|
@@ -7809,12 +7723,12 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
7809
7723
|
);
|
|
7810
7724
|
|
|
7811
7725
|
let backButtonsSchema = null;
|
|
7812
|
-
|
|
7726
|
+
|
|
7813
7727
|
if(options.showBackButton != false){
|
|
7814
7728
|
backButtonsSchema = getBackButtonSchema();
|
|
7815
7729
|
}
|
|
7816
7730
|
|
|
7817
|
-
|
|
7731
|
+
console.log(`getObjectRecordDetailHeader==> backButtonsSchema`, backButtonsSchema);
|
|
7818
7732
|
|
|
7819
7733
|
const reg = new RegExp('_', 'g');
|
|
7820
7734
|
const standardIcon = icon && icon.replace(reg, '-');
|
|
@@ -7971,7 +7885,9 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
7971
7885
|
details.push({
|
|
7972
7886
|
type: 'steedos-field',
|
|
7973
7887
|
static: true,
|
|
7974
|
-
config: field,
|
|
7888
|
+
config: Object.assign({}, field, {
|
|
7889
|
+
description: null
|
|
7890
|
+
})
|
|
7975
7891
|
});
|
|
7976
7892
|
}
|
|
7977
7893
|
});
|
|
@@ -8054,7 +7970,7 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
8054
7970
|
"body": [
|
|
8055
7971
|
{
|
|
8056
7972
|
"type": "tpl",
|
|
8057
|
-
"tpl": `<a class="text-black text-base font-bold hover:font-bold" href="/app/\${appId}/\${_master.objectName}/\${_master.
|
|
7973
|
+
"tpl": `<a class="text-black text-base font-bold hover:font-bold" href="/app/\${appId}/\${_master.objectName}/\${_master.record._id}/\${objectName}/grid?related_field_name=\${relatedKey}">${relatedLabel}(\${$count})</a>`,
|
|
8058
7974
|
"inline": false,
|
|
8059
7975
|
"wrapperComponent": "",
|
|
8060
7976
|
"className": "",
|
|
@@ -8151,6 +8067,10 @@ const getCopyListviewButtonSchema = ()=>{
|
|
|
8151
8067
|
"blank": false
|
|
8152
8068
|
},
|
|
8153
8069
|
"actionType": "url",
|
|
8070
|
+
},
|
|
8071
|
+
{
|
|
8072
|
+
"actionType": "custom",
|
|
8073
|
+
"script": "window.location.reload();"
|
|
8154
8074
|
}
|
|
8155
8075
|
]
|
|
8156
8076
|
}
|
|
@@ -8318,6 +8238,10 @@ const getRenameListviewButtonSchema = ()=>{
|
|
|
8318
8238
|
},
|
|
8319
8239
|
"actionType": "url",
|
|
8320
8240
|
},
|
|
8241
|
+
{
|
|
8242
|
+
"actionType": "custom",
|
|
8243
|
+
"script": "window.location.reload();"
|
|
8244
|
+
}
|
|
8321
8245
|
]
|
|
8322
8246
|
}
|
|
8323
8247
|
}
|
|
@@ -8444,11 +8368,8 @@ const getSetListviewFiltersButtonSchema = ()=>{
|
|
|
8444
8368
|
"weight": 0,
|
|
8445
8369
|
"actions": [
|
|
8446
8370
|
{
|
|
8447
|
-
"
|
|
8448
|
-
|
|
8449
|
-
"blank": false
|
|
8450
|
-
},
|
|
8451
|
-
"actionType": "url",
|
|
8371
|
+
"actionType": "custom",
|
|
8372
|
+
"script": "window.location.reload(); //doAction({'actionType': 'rebuild', 'componentId': `service_listview_${event.data.targetObjectName}`})"
|
|
8452
8373
|
}
|
|
8453
8374
|
]
|
|
8454
8375
|
}
|
|
@@ -8598,11 +8519,8 @@ const getSetListviewColumnsButtonSchema = ()=>{
|
|
|
8598
8519
|
"weight": 0,
|
|
8599
8520
|
"actions": [
|
|
8600
8521
|
{
|
|
8601
|
-
"
|
|
8602
|
-
|
|
8603
|
-
"blank": false
|
|
8604
|
-
},
|
|
8605
|
-
"actionType": "url"
|
|
8522
|
+
"actionType": "custom",
|
|
8523
|
+
"script": "window.location.reload(); //doAction({'actionType': 'rebuild', 'componentId': `service_listview_${event.data.targetObjectName}`})"
|
|
8606
8524
|
}
|
|
8607
8525
|
]
|
|
8608
8526
|
}
|
|
@@ -8751,11 +8669,8 @@ const getSetListviewSortButtonSchema = ()=>{
|
|
|
8751
8669
|
"weight": 0,
|
|
8752
8670
|
"actions": [
|
|
8753
8671
|
{
|
|
8754
|
-
"
|
|
8755
|
-
|
|
8756
|
-
"blank": false
|
|
8757
|
-
},
|
|
8758
|
-
"actionType": "url"
|
|
8672
|
+
"actionType": "custom",
|
|
8673
|
+
"script": "window.location.reload(); //doAction({'actionType': 'rebuild', 'componentId': `service_listview_${event.data.targetObjectName}`})"
|
|
8759
8674
|
}
|
|
8760
8675
|
]
|
|
8761
8676
|
}
|
|
@@ -8876,6 +8791,10 @@ const getDeleteListviewButtonSchema = ()=>{
|
|
|
8876
8791
|
"blank": false
|
|
8877
8792
|
},
|
|
8878
8793
|
"expression": "data.delete == 1"
|
|
8794
|
+
},
|
|
8795
|
+
{
|
|
8796
|
+
"actionType": "custom",
|
|
8797
|
+
"script": "window.location.reload();"
|
|
8879
8798
|
}
|
|
8880
8799
|
]
|
|
8881
8800
|
}
|
|
@@ -9745,12 +9664,12 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
9745
9664
|
payload.status = 2;
|
|
9746
9665
|
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
9747
9666
|
}
|
|
9748
|
-
var scope = SteedosUI.getRef(context.scopeId);
|
|
9749
|
-
var scopeParent = scope && scope.parent;
|
|
9750
|
-
var crudScoped = scopeParent.getComponentById('${body.id}');
|
|
9751
|
-
setTimeout(()=>{
|
|
9752
|
-
|
|
9753
|
-
}, 500);
|
|
9667
|
+
// var scope = SteedosUI.getRef(context.scopeId);
|
|
9668
|
+
// var scopeParent = scope && scope.parent;
|
|
9669
|
+
// var crudScoped = scopeParent.getComponentById('${body.id}');
|
|
9670
|
+
// setTimeout(()=>{
|
|
9671
|
+
// crudScoped && crudScoped.control.updateAutoFillHeight();
|
|
9672
|
+
// }, 500);
|
|
9754
9673
|
return payload;
|
|
9755
9674
|
`;
|
|
9756
9675
|
|
|
@@ -9957,17 +9876,6 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
9957
9876
|
},
|
|
9958
9877
|
"expression": `\${_master.objectName != '${objectSchema.name}' && _master.objectName}`
|
|
9959
9878
|
},
|
|
9960
|
-
// 列表视图、对象表格组件上的lookup字段,点开右侧弹出drawer窗口,修改记录后刷新列表
|
|
9961
|
-
{
|
|
9962
|
-
"actionType": "broadcast",
|
|
9963
|
-
"args": {
|
|
9964
|
-
"eventName": "@data.changed.${_tableObjectName}"
|
|
9965
|
-
},
|
|
9966
|
-
"data": {
|
|
9967
|
-
"objectName": "${_tableObjectName}"
|
|
9968
|
-
},
|
|
9969
|
-
"expression": `\${_tableObjectName != '${objectSchema.name}' && _tableObjectName}`
|
|
9970
|
-
},
|
|
9971
9879
|
...submitSuccActions,
|
|
9972
9880
|
// {
|
|
9973
9881
|
// "actionType": "custom",
|
|
@@ -10071,7 +9979,7 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
10071
9979
|
}
|
|
10072
9980
|
|
|
10073
9981
|
amisSchema.body[0].body = await getFormSchemaWithDataFilter(amisSchema.body[0].body, { formDataFilter, onFormDataFilter, amisData, env });
|
|
10074
|
-
// console.log('getObjectDetail=====>', amisSchema);
|
|
9982
|
+
// console.log('getObjectDetail=====>', amisSchema, objectSchema, recordId, ctx);
|
|
10075
9983
|
return amisSchema;
|
|
10076
9984
|
}
|
|
10077
9985
|
|
|
@@ -10570,7 +10478,7 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
|
|
|
10570
10478
|
* @Author: baozhoutao@steedos.com
|
|
10571
10479
|
* @Date: 2022-07-05 15:55:39
|
|
10572
10480
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
10573
|
-
* @LastEditTime:
|
|
10481
|
+
* @LastEditTime: 2025-04-22 17:44:32
|
|
10574
10482
|
* @Description:
|
|
10575
10483
|
*/
|
|
10576
10484
|
|
|
@@ -10679,7 +10587,7 @@ function formatUISchemaCache(objectName, uiSchema){
|
|
|
10679
10587
|
});
|
|
10680
10588
|
}
|
|
10681
10589
|
|
|
10682
|
-
async function getUISchema(objectName, force) {
|
|
10590
|
+
async function getUISchema(objectName, force, retry = true) {
|
|
10683
10591
|
if (!objectName) {
|
|
10684
10592
|
return;
|
|
10685
10593
|
}
|
|
@@ -10695,7 +10603,13 @@ async function getUISchema(objectName, force) {
|
|
|
10695
10603
|
const url = `/service/api/@${objectName.replace(/\./g, "_")}/uiSchema`;
|
|
10696
10604
|
uiSchema = await fetchAPI(url, { method: "get" });
|
|
10697
10605
|
}
|
|
10698
|
-
|
|
10606
|
+
|
|
10607
|
+
if(!uiSchema && retry){
|
|
10608
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
10609
|
+
return getUISchema(objectName, force, false);
|
|
10610
|
+
}
|
|
10611
|
+
|
|
10612
|
+
if(!uiSchema && retry == false){
|
|
10699
10613
|
return ;
|
|
10700
10614
|
}
|
|
10701
10615
|
formatUISchemaCache(objectName, uiSchema);
|
|
@@ -10706,7 +10620,16 @@ async function getUISchema(objectName, force) {
|
|
|
10706
10620
|
return getUISchemaCache(objectName);
|
|
10707
10621
|
}
|
|
10708
10622
|
|
|
10709
|
-
|
|
10623
|
+
// 阻塞等待函数,单位毫秒
|
|
10624
|
+
function wait(milliseconds) {
|
|
10625
|
+
const start = new Date().getTime();
|
|
10626
|
+
let now = start;
|
|
10627
|
+
while (now - start < milliseconds) {
|
|
10628
|
+
now = new Date().getTime();
|
|
10629
|
+
}
|
|
10630
|
+
}
|
|
10631
|
+
|
|
10632
|
+
function getUISchemaSync$1(objectName, force, retry = true) {
|
|
10710
10633
|
if (!objectName) {
|
|
10711
10634
|
return;
|
|
10712
10635
|
}
|
|
@@ -10722,7 +10645,12 @@ function getUISchemaSync$1(objectName, force) {
|
|
|
10722
10645
|
async: false,
|
|
10723
10646
|
});
|
|
10724
10647
|
|
|
10725
|
-
if(!uiSchema){
|
|
10648
|
+
if(!uiSchema && retry){
|
|
10649
|
+
wait(2000); // 阻塞等待3秒
|
|
10650
|
+
return getUISchemaSync$1(objectName, force, false)
|
|
10651
|
+
}
|
|
10652
|
+
|
|
10653
|
+
if(!uiSchema && retry == false){
|
|
10726
10654
|
return ;
|
|
10727
10655
|
}
|
|
10728
10656
|
formatUISchemaCache(objectName, uiSchema);
|
|
@@ -10767,6 +10695,7 @@ async function getListSchema(
|
|
|
10767
10695
|
listViewName,
|
|
10768
10696
|
ctx = {}
|
|
10769
10697
|
) {
|
|
10698
|
+
// console.log('getListSchema', objectName, listView, ctx)
|
|
10770
10699
|
const uiSchema = await getUISchema(objectName);
|
|
10771
10700
|
if(!uiSchema){
|
|
10772
10701
|
return {}
|
|
@@ -10797,6 +10726,7 @@ async function getListSchema(
|
|
|
10797
10726
|
}
|
|
10798
10727
|
|
|
10799
10728
|
let listViewColumns = getListViewColumns(listView, ctx.formFactor);
|
|
10729
|
+
// console.log('getListSchema listViewColumns', objectName, listView, listViewColumns)
|
|
10800
10730
|
let sort = getListViewSort(listView);
|
|
10801
10731
|
let listviewFilter = getListViewFilter(listView);
|
|
10802
10732
|
let listview_filters = listView && listView._filters;
|
|
@@ -11003,7 +10933,7 @@ async function getTableSchema(
|
|
|
11003
10933
|
columns,
|
|
11004
10934
|
ctx = {}
|
|
11005
10935
|
) {
|
|
11006
|
-
// console.
|
|
10936
|
+
// console.log('getTableSchema', columns);
|
|
11007
10937
|
const uiSchema = await getUISchema(objectName);
|
|
11008
10938
|
|
|
11009
10939
|
let sort = ctx.sort;
|
|
@@ -11037,7 +10967,7 @@ async function getTableSchema(
|
|
|
11037
10967
|
};
|
|
11038
10968
|
crudOptions.amisData = createObject(ctx.amisData || {}, {});
|
|
11039
10969
|
const amisSchema = await getObjectCRUD(uiSchema, fields, crudOptions);
|
|
11040
|
-
// console.
|
|
10970
|
+
// console.log('getTableSchema', amisSchema, uiSchema);
|
|
11041
10971
|
return {
|
|
11042
10972
|
uiSchema,
|
|
11043
10973
|
amisSchema,
|
|
@@ -11074,8 +11004,7 @@ async function getRecordDetailHeaderSchema(objectName,recordId, options){
|
|
|
11074
11004
|
}
|
|
11075
11005
|
|
|
11076
11006
|
async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
11077
|
-
const uiSchema = await getUISchema(objectName);
|
|
11078
|
-
|
|
11007
|
+
const uiSchema = await getUISchema(objectName);
|
|
11079
11008
|
const relatedLists = await getObjectRelatedList(objectName);
|
|
11080
11009
|
const detailed = {
|
|
11081
11010
|
"title": i18next.t('frontend_record_detail_tab_detailed'),
|
|
@@ -11114,22 +11043,10 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
11114
11043
|
if(relatedLists.length){
|
|
11115
11044
|
content.tabs.push(related);
|
|
11116
11045
|
}
|
|
11117
|
-
const contents = [content];
|
|
11118
|
-
if (uiSchema.enable_chatter && window.BuilderLiveblocks) {
|
|
11119
|
-
const chatter = {
|
|
11120
|
-
"type": "rooms-provider",
|
|
11121
|
-
"baseUrl": "${context.rootUrl}",
|
|
11122
|
-
"body": [
|
|
11123
|
-
{
|
|
11124
|
-
"type": "rooms-comments",
|
|
11125
|
-
"className": "flex flex-col gap-3 m-4",
|
|
11126
|
-
"roomId": "objects:${objectName}:${recordId}",
|
|
11127
|
-
}
|
|
11128
|
-
]
|
|
11129
|
-
};
|
|
11130
|
-
contents.push(chatter);
|
|
11131
|
-
}
|
|
11132
11046
|
// content.tabs = reverse(content.tabs)
|
|
11047
|
+
if(content.tabs.length == 1){
|
|
11048
|
+
content.className += " steedos-record-tabs--single";
|
|
11049
|
+
}
|
|
11133
11050
|
return {
|
|
11134
11051
|
uiSchema,
|
|
11135
11052
|
amisSchema: {
|
|
@@ -11144,7 +11061,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
11144
11061
|
"showButtons": props.showButtons,
|
|
11145
11062
|
"showBackButton": props.showBackButton,
|
|
11146
11063
|
},
|
|
11147
|
-
|
|
11064
|
+
content
|
|
11148
11065
|
],
|
|
11149
11066
|
"objectApiName": "${objectName}",
|
|
11150
11067
|
"recordId": "${recordId}",
|
|
@@ -11928,42 +11845,14 @@ function getLookupSapceUserTreeSchema(isMobile){
|
|
|
11928
11845
|
{
|
|
11929
11846
|
"actionType": "custom",
|
|
11930
11847
|
"script": `
|
|
11931
|
-
console.log("lookup-tree-event.data:",event.data);
|
|
11932
|
-
console.log("lookup-tree-event.data.value.label:",event.data.value.label);
|
|
11933
|
-
console.log("lookup-tree-event.data.value.value:",event.data.value.value);
|
|
11934
11848
|
const scope = event.context.scoped;
|
|
11935
|
-
var
|
|
11849
|
+
var filterFormValues={
|
|
11936
11850
|
"__searchable__organizations_parents":event.data.value.value
|
|
11937
11851
|
}
|
|
11938
|
-
|
|
11939
|
-
|
|
11940
|
-
// });
|
|
11941
|
-
// listView.handleFilterSubmit(Object.assign({}, filterFormValues));
|
|
11942
|
-
let __lookupField = event.data.__lookupField;
|
|
11943
|
-
let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
|
|
11944
|
-
var filterForm = scope.getComponents().find(function(n){
|
|
11945
|
-
return n.props.type === "form";
|
|
11852
|
+
var listView = scope.parent.getComponents().find(function(n){
|
|
11853
|
+
return n.props.type === "crud";
|
|
11946
11854
|
});
|
|
11947
|
-
|
|
11948
|
-
filterFormValues = JSON.parse(JSON.stringify(filterFormValues)); //只取当层数据域中数据,去除__super层数据
|
|
11949
|
-
const changedFilterFormValues = _.pickBy(filterFormValues, function(n,k){return /^__searchable__/.test(k);});
|
|
11950
|
-
Object.assign(changedFilterFormValues, treeFilterFormValues);
|
|
11951
|
-
// 同步__changedFilterFormValues中的值
|
|
11952
|
-
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
11953
|
-
if(__lookupField){
|
|
11954
|
-
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
11955
|
-
if(__lookupField.reference_to_field){
|
|
11956
|
-
lookupTag += "__" + __lookupField.reference_to_field;
|
|
11957
|
-
}
|
|
11958
|
-
__changedFilterFormValuesKey += lookupTag;
|
|
11959
|
-
}
|
|
11960
|
-
if(crud){
|
|
11961
|
-
let crudData = crud.getData();
|
|
11962
|
-
crudData[__changedFilterFormValuesKey] = changedFilterFormValues;
|
|
11963
|
-
crud.setData(crudData);
|
|
11964
|
-
}
|
|
11965
|
-
filterForm.setData(treeFilterFormValues);
|
|
11966
|
-
filterForm.handleFormSubmit(event);
|
|
11855
|
+
listView.handleFilterSubmit(Object.assign({}, filterFormValues));
|
|
11967
11856
|
`
|
|
11968
11857
|
},
|
|
11969
11858
|
{
|
|
@@ -12181,7 +12070,6 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12181
12070
|
// field.name可能是带点的名称,比如审批王中子表字段'instances.instances_submitter',如果不替换掉点,会造成审批王表单中新建子表行时报错
|
|
12182
12071
|
let keywordsSearchBoxName = `__keywords_lookup__${field.name.replace(/\./g, "_")}__to__${refObjectConfig.name}`;
|
|
12183
12072
|
|
|
12184
|
-
const filterFormValues = field.filter_form_data;
|
|
12185
12073
|
source.requestAdaptor = `
|
|
12186
12074
|
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
12187
12075
|
let __lookupField = api.data.$self.__lookupField;
|
|
@@ -12224,20 +12112,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12224
12112
|
}
|
|
12225
12113
|
}
|
|
12226
12114
|
|
|
12227
|
-
|
|
12228
|
-
if (selfData.op !== 'loadOptions'){
|
|
12229
|
-
filterFormValues = ${_$1.isObject(filterFormValues) ? JSON.stringify(filterFormValues) : ('"' + filterFormValues + '"')} || {};
|
|
12230
|
-
const isAmisFormula = typeof filterFormValues === "string" && filterFormValues.indexOf("\${") > -1;
|
|
12231
|
-
if (isAmisFormula){
|
|
12232
|
-
filterFormValues = AmisCore.evaluate(filterFormValues, context) || {};
|
|
12233
|
-
}
|
|
12234
|
-
if (_.isObject(filterFormValues) || !_.isEmpty(filterFormValues)){
|
|
12235
|
-
let fields = api.data.$self.uiSchema && api.data.$self.uiSchema.fields;
|
|
12236
|
-
filterFormValues = SteedosUI.getSearchFilterFormValues(filterFormValues, fields);
|
|
12237
|
-
}
|
|
12238
|
-
}
|
|
12239
|
-
|
|
12240
|
-
var searchableFilter = SteedosUI.getSearchFilter(Object.assign({}, { ...filterFormValues }, selfData)) || [];
|
|
12115
|
+
var searchableFilter = SteedosUI.getSearchFilter(selfData) || [];
|
|
12241
12116
|
|
|
12242
12117
|
if(searchableFilter.length > 0){
|
|
12243
12118
|
if(filters.length > 0 ){
|
|
@@ -12427,7 +12302,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12427
12302
|
return payload;
|
|
12428
12303
|
`;
|
|
12429
12304
|
}
|
|
12430
|
-
let top =
|
|
12305
|
+
let top = 20;
|
|
12431
12306
|
|
|
12432
12307
|
if(refObjectConfig.paging && refObjectConfig.paging.enabled === false){
|
|
12433
12308
|
top = 1000;
|
|
@@ -12477,8 +12352,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12477
12352
|
keywordsSearchBoxName,
|
|
12478
12353
|
searchable_fields: field.searchable_fields,
|
|
12479
12354
|
auto_open_filter: field.auto_open_filter,
|
|
12480
|
-
show_left_filter: field.show_left_filter
|
|
12481
|
-
filter_form_data: field.filter_form_data
|
|
12355
|
+
show_left_filter: field.show_left_filter
|
|
12482
12356
|
});
|
|
12483
12357
|
}
|
|
12484
12358
|
pickerSchema.data = Object.assign({}, pickerSchema.data, {
|
|
@@ -12545,7 +12419,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12545
12419
|
}
|
|
12546
12420
|
|
|
12547
12421
|
const ctx = ${JSON.stringify(ctx)};
|
|
12548
|
-
const componentId = ctx.defaults
|
|
12422
|
+
const componentId = ctx.defaults.formSchema.id;
|
|
12549
12423
|
doAction({
|
|
12550
12424
|
actionType: 'setValue',
|
|
12551
12425
|
componentId: componentId,
|
|
@@ -12972,10 +12846,6 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
12972
12846
|
}
|
|
12973
12847
|
let amisSchema;
|
|
12974
12848
|
// 默认使用下拉框模式显示lookup选项,只能配置了enable_enhanced_lookup才使用弹出增强模式
|
|
12975
|
-
if(enableEnhancedLookup == true && field.amis && field.amis.type && field.amis.type !== 'picker'){
|
|
12976
|
-
// 如果配置了amis.type且其值不是picker,则不使用弹出增强模式
|
|
12977
|
-
enableEnhancedLookup = false;
|
|
12978
|
-
}
|
|
12979
12849
|
if(enableEnhancedLookup == true){
|
|
12980
12850
|
amisSchema = await lookupToAmisPicker(field, readonly, ctx);
|
|
12981
12851
|
}else if(refObject.enable_tree) {
|
|
@@ -14107,16 +13977,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
14107
13977
|
return convertData
|
|
14108
13978
|
}
|
|
14109
13979
|
// if(ctx.mode === 'edit'){
|
|
14110
|
-
let convertDataResult;
|
|
14111
|
-
if(convertData.type == "steedos-field"){
|
|
14112
|
-
// 如果是steedos-field,不能把amis属性合并到steedos-field根属性中,要合并也是合并到steedos-field的config.amis中
|
|
14113
|
-
// 而steedos-field字段的amis属性本身就在config.amis中了,所以这里不需要再合并field.amis
|
|
14114
|
-
// 目前测试到受影响的是,把字段的amis属性配置为{"type": "checkboxes"}时,ObjectForm只读模式下,lookup字段返回的是type为steedos-field的组件,此时field.amis中的type不应该合并到steedos-field根属性中
|
|
14115
|
-
convertDataResult = Object.assign({}, baseData, convertData, { labelClassName: 'text-left', clearValueOnHidden: true, fieldName: field.name}, {name: baseData.name});
|
|
14116
|
-
}
|
|
14117
|
-
else {
|
|
14118
|
-
convertDataResult = Object.assign({}, baseData, convertData, { labelClassName: 'text-left', clearValueOnHidden: true, fieldName: field.name}, field.amis, {name: baseData.name});
|
|
14119
|
-
}
|
|
13980
|
+
let convertDataResult = Object.assign({}, baseData, convertData, { labelClassName: 'text-left', clearValueOnHidden: true, fieldName: field.name}, field.amis, {name: baseData.name});
|
|
14120
13981
|
// 只读时file字段的外层control层若存在name,内部each组件存在问题
|
|
14121
13982
|
if(readonly && field.type == "file") {
|
|
14122
13983
|
convertDataResult.name = "";
|