@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.cjs.js
CHANGED
|
@@ -532,8 +532,8 @@ function getComparableAmisVersion() {
|
|
|
532
532
|
/*
|
|
533
533
|
* @Author: baozhoutao@steedos.com
|
|
534
534
|
* @Date: 2022-05-23 09:53:08
|
|
535
|
-
* @LastEditors:
|
|
536
|
-
* @LastEditTime:
|
|
535
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
536
|
+
* @LastEditTime: 2024-11-17 13:10:08
|
|
537
537
|
* @Description:
|
|
538
538
|
*/
|
|
539
539
|
|
|
@@ -604,9 +604,6 @@ function getSelectMap(selectOptions){
|
|
|
604
604
|
}
|
|
605
605
|
|
|
606
606
|
function getNameTplUrl(field, ctx){
|
|
607
|
-
// if(ctx.objectName === 'cms_files'){
|
|
608
|
-
// return "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}"
|
|
609
|
-
// }
|
|
610
607
|
const href = Router.getObjectDetailPath({
|
|
611
608
|
...ctx, formFactor: ctx.formFactor, appId: "${appId}", objectName: ctx.objectName || "${objectName}", recordId: `\${${ctx.idFieldName}}`
|
|
612
609
|
});
|
|
@@ -690,10 +687,9 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
690
687
|
const href = Router.getObjectDetailPath({
|
|
691
688
|
formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
|
|
692
689
|
});
|
|
693
|
-
if
|
|
694
|
-
// 相关表字段,包括列表视图、对象表格组件中的lookup/master_detail字段,在PC端显示时,点击字段值,不跳转到详情页而是右侧弹出drawer
|
|
690
|
+
if(ctx.isRelated && window.innerWidth >= 768){
|
|
695
691
|
labelTpl = `<a href="${href}" ${linkTarget} onclick="return false;">${labelTpl}</a>`;
|
|
696
|
-
}
|
|
692
|
+
}else {
|
|
697
693
|
labelTpl = `<a href="${href}" ${linkTarget}>${labelTpl}</a>`;
|
|
698
694
|
}
|
|
699
695
|
|
|
@@ -1423,7 +1419,7 @@ const getAmisFileEditSchema = (steedosField)=>{
|
|
|
1423
1419
|
receiver: {
|
|
1424
1420
|
method: "post",
|
|
1425
1421
|
dataType: "form-data",
|
|
1426
|
-
url: `\${context.rootUrl}/
|
|
1422
|
+
url: `\${context.rootUrl}/api/v6/files/cfs.${tableName}.filerecord`,
|
|
1427
1423
|
requestAdaptor: `
|
|
1428
1424
|
const superData = (typeof context != 'undefined') ? context : api.body;
|
|
1429
1425
|
const { _master, global } = superData;
|
|
@@ -1446,14 +1442,14 @@ const getAmisFileEditSchema = (steedosField)=>{
|
|
|
1446
1442
|
adaptor: `
|
|
1447
1443
|
const superData = (typeof context != 'undefined') ? context : api.body;
|
|
1448
1444
|
const { context:pageContext } = superData;
|
|
1449
|
-
var rootUrl = pageContext.rootUrl + "/api/files
|
|
1445
|
+
var rootUrl = pageContext.rootUrl + "/api/v6/files/download/cfs.${tableName}.filerecord/";
|
|
1450
1446
|
payload = {
|
|
1451
1447
|
status: response.status == 200 ? 0 : response.status,
|
|
1452
1448
|
msg: response.statusText,
|
|
1453
1449
|
data: {
|
|
1454
1450
|
value: payload._id,
|
|
1455
1451
|
name: payload.original.name,
|
|
1456
|
-
url: rootUrl + payload._id,
|
|
1452
|
+
url: rootUrl + payload._id + "/" + payload.original.name,
|
|
1457
1453
|
}
|
|
1458
1454
|
}
|
|
1459
1455
|
return payload;
|
|
@@ -1924,12 +1920,7 @@ async function getQuickEditSchema(object, columnField, options){
|
|
|
1924
1920
|
if (field.disabled) {
|
|
1925
1921
|
quickEditSchema = false;
|
|
1926
1922
|
} else {
|
|
1927
|
-
var
|
|
1928
|
-
defaults: Object.assign({}, options.defaults, {
|
|
1929
|
-
formSchema: quickEditSchema
|
|
1930
|
-
})
|
|
1931
|
-
});
|
|
1932
|
-
var fieldSchema = await convertSFieldToAmisField(field, false, fieldCtx);
|
|
1923
|
+
var fieldSchema = await convertSFieldToAmisField(field, false, ___namespace.omit(options, 'buttons'));
|
|
1933
1924
|
//存在属性上可编辑,实际不可编辑的字段,convertSFieldToAmisField函数可能会返回undefined,如summary
|
|
1934
1925
|
if (!!fieldSchema) {
|
|
1935
1926
|
quickEditSchema.body.push(fieldSchema);
|
|
@@ -2362,19 +2353,14 @@ function getFieldWidth(width){
|
|
|
2362
2353
|
}
|
|
2363
2354
|
|
|
2364
2355
|
async function getColumnItemOnClick(field, options){
|
|
2365
|
-
|
|
2366
|
-
if(!(field.is_name || field.name === options.labelFieldName)){
|
|
2367
|
-
objectApiName = field.reference_to;
|
|
2368
|
-
}
|
|
2369
|
-
const recordPage = await getPage({ type: 'record', appId: options.appId, objectName: objectApiName, formFactor: options.formFactor });
|
|
2356
|
+
const recordPage = await getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor });
|
|
2370
2357
|
const drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
|
|
2371
2358
|
"recordId": `\${${options.idFieldName}}`,
|
|
2372
2359
|
"data": {
|
|
2373
2360
|
...recordPage.schema.data,
|
|
2374
2361
|
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
2375
2362
|
"recordLoaded": false, // 重置数据加载状态
|
|
2376
|
-
"recordId": `\${${options.idFieldName}}
|
|
2377
|
-
"_tableObjectName": options.objectName
|
|
2363
|
+
"recordId": `\${${options.idFieldName}}`//审批微页面依赖了作用域中的recordId
|
|
2378
2364
|
}
|
|
2379
2365
|
}) : {
|
|
2380
2366
|
"type": "steedos-record-detail",
|
|
@@ -2385,16 +2371,12 @@ async function getColumnItemOnClick(field, options){
|
|
|
2385
2371
|
"data": {
|
|
2386
2372
|
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
2387
2373
|
"recordLoaded": false, // 重置数据加载状态
|
|
2388
|
-
"_tableObjectName": options.objectName
|
|
2389
2374
|
}
|
|
2390
2375
|
};
|
|
2391
2376
|
|
|
2392
2377
|
if(!(field.is_name || field.name === options.labelFieldName)){
|
|
2393
2378
|
drawerRecordDetailSchema.objectApiName = field.reference_to;
|
|
2394
2379
|
drawerRecordDetailSchema.recordId = `\${_display.${field.name}.value}`;
|
|
2395
|
-
// if (recordPage){
|
|
2396
|
-
// drawerRecordDetailSchema.data.recordId = `\${_display.${field.name}.value}`
|
|
2397
|
-
// }
|
|
2398
2380
|
}
|
|
2399
2381
|
return {
|
|
2400
2382
|
"click": {
|
|
@@ -2544,32 +2526,6 @@ async function getTableColumns(object, fields, options){
|
|
|
2544
2526
|
static: true,
|
|
2545
2527
|
}, fieldAmis, {name: field.name});
|
|
2546
2528
|
}
|
|
2547
|
-
else if(field.type === 'lookup' || field.type === 'master_detail'){
|
|
2548
|
-
columnItem = Object.assign({}, {
|
|
2549
|
-
type: "static-wrapper",
|
|
2550
|
-
name: field.name,
|
|
2551
|
-
label: field.label,
|
|
2552
|
-
sortable: field.sortable,
|
|
2553
|
-
width: getFieldWidth(field.width),
|
|
2554
|
-
toggled: field.toggled,
|
|
2555
|
-
className,
|
|
2556
|
-
size: "none",
|
|
2557
|
-
inputClassName: "inline",
|
|
2558
|
-
body: {
|
|
2559
|
-
type: "steedos-field",
|
|
2560
|
-
static: true,
|
|
2561
|
-
tableObjectName: options.objectName,
|
|
2562
|
-
config: {
|
|
2563
|
-
type: "lookup",
|
|
2564
|
-
reference_to: field.reference_to,
|
|
2565
|
-
name: field.name,
|
|
2566
|
-
label: null,
|
|
2567
|
-
multiple: field.multiple,
|
|
2568
|
-
amis: Object.assign({}, fieldAmis, { label: null })
|
|
2569
|
-
}
|
|
2570
|
-
}
|
|
2571
|
-
}, fieldAmis, {name: field.name});
|
|
2572
|
-
}
|
|
2573
2529
|
else {
|
|
2574
2530
|
const tpl = await getFieldTpl(field, options);
|
|
2575
2531
|
let type = 'static-text';
|
|
@@ -2618,20 +2574,10 @@ async function getTableColumns(object, fields, options){
|
|
|
2618
2574
|
columnItem.defaultColor = null;
|
|
2619
2575
|
}
|
|
2620
2576
|
|
|
2621
|
-
|
|
2622
|
-
// if (options.isRelated){
|
|
2623
|
-
// // 子表列表上,Lookup字段和名称字段都需要点击事件
|
|
2624
|
-
// needClickEvent = ((field.is_name || field.name === options.labelFieldName) || ((field.type == 'lookup' || field.type == 'master_detail') && _.isString(field.reference_to) && field.multiple != true));
|
|
2625
|
-
// }
|
|
2626
|
-
// else {// if (isObjectListview)
|
|
2627
|
-
// // 列表视图、对象表格中,Lookup字段需要点击事件
|
|
2628
|
-
// needClickEvent = (field.type == 'lookup' || field.type == 'master_detail') && _.isString(field.reference_to) && field.multiple != true;
|
|
2629
|
-
// }
|
|
2630
|
-
// lookup字段走steedos-field组件了,所以这里只需要判断子表名称字段才额外加点击事件弹出右侧详情
|
|
2631
|
-
needClickEvent = options.isRelated && (field.is_name || field.name === options.labelFieldName);
|
|
2632
|
-
if(window.innerWidth >= 768 && needClickEvent){
|
|
2577
|
+
if(window.innerWidth >= 768 && ((field.is_name || field.name === options.labelFieldName) || ((field.type == 'lookup' || field.type == 'master_detail') && ___namespace.isString(field.reference_to) && field.multiple != true)) && options.isRelated){
|
|
2633
2578
|
columnItem.onEvent = await getColumnItemOnClick(field, options);
|
|
2634
2579
|
}
|
|
2580
|
+
|
|
2635
2581
|
}
|
|
2636
2582
|
}
|
|
2637
2583
|
if(columnItem){
|
|
@@ -2898,7 +2844,9 @@ function getButtonVisibleOn$1(button){
|
|
|
2898
2844
|
// return 'false';
|
|
2899
2845
|
// }
|
|
2900
2846
|
if(visible.trim().startsWith('function')){
|
|
2901
|
-
|
|
2847
|
+
visible = visible.replace('function', 'function __visible');
|
|
2848
|
+
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)}})()`;
|
|
2849
|
+
return visibleStr;
|
|
2902
2850
|
}
|
|
2903
2851
|
return visible;
|
|
2904
2852
|
}
|
|
@@ -3150,10 +3098,10 @@ async function getTableApi(mainObject, fields, options){
|
|
|
3150
3098
|
let valueField = mainObject.key_field || '_id';
|
|
3151
3099
|
const api = await getApi$1(mainObject, null, fields, {count: options.queryCount, alias: 'rows', limit: top, queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
|
|
3152
3100
|
|
|
3153
|
-
api.url
|
|
3154
|
-
if(options.isRelated){
|
|
3155
|
-
|
|
3156
|
-
}
|
|
3101
|
+
api.url;//设计器上对象表格组件需要切换对象重新请求列表数据
|
|
3102
|
+
// if(options.isRelated){
|
|
3103
|
+
// api.url += "&recordId=${_master.recordId}";
|
|
3104
|
+
// }
|
|
3157
3105
|
api.cache = 3000;
|
|
3158
3106
|
api.data.$term = "$term";
|
|
3159
3107
|
api.data.term = "$term";
|
|
@@ -3287,7 +3235,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
3287
3235
|
const refField = self.uiSchema.fields[relatedKey];
|
|
3288
3236
|
const masterRecord = self._master.record;
|
|
3289
3237
|
const masterObjectName = self._master.objectName;
|
|
3290
|
-
let relatedValue =
|
|
3238
|
+
let relatedValue = masterRecord._id;
|
|
3291
3239
|
if(refField && refField.reference_to_field && refField.reference_to_field != '_id'){
|
|
3292
3240
|
relatedValue = masterRecord[refField.reference_to_field]
|
|
3293
3241
|
}
|
|
@@ -3328,6 +3276,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
3328
3276
|
skip: skip,
|
|
3329
3277
|
fields: ${JSON.stringify(___namespace.map(fields, 'name'))}
|
|
3330
3278
|
}));
|
|
3279
|
+
// console.log('table requestAdaptor', api);
|
|
3331
3280
|
return api;
|
|
3332
3281
|
`;
|
|
3333
3282
|
api.adaptor = `
|
|
@@ -3465,17 +3414,15 @@ async function getTableApi(mainObject, fields, options){
|
|
|
3465
3414
|
}
|
|
3466
3415
|
// 标记加载过,后续优先从本地存储中加载相关参数
|
|
3467
3416
|
payload.data.loaded= true;
|
|
3468
|
-
|
|
3469
3417
|
const setDataToComponentId = "${setDataToComponentId}";
|
|
3470
3418
|
if(setDataToComponentId){
|
|
3471
3419
|
//https://github.com/baidu/amis/pull/6807 .parent的改动是为适应3.2getComponentById的规则改动,不影响2.9
|
|
3472
|
-
var scope =
|
|
3420
|
+
var scope = context._scoped;
|
|
3473
3421
|
var scopeParent = scope && scope.parent;
|
|
3474
3422
|
var setDataToComponent = scopeParent && scopeParent.getComponentById(setDataToComponentId);
|
|
3475
3423
|
if(setDataToComponent){
|
|
3476
3424
|
setDataToComponent.setData({$count: payload.data.count});
|
|
3477
3425
|
}
|
|
3478
|
-
// SteedosUI.getRef(api.body.$self.$scopeId)?.parent?.getComponentById(setDataToComponentId)?.setData({$count: payload.data.count})
|
|
3479
3426
|
};
|
|
3480
3427
|
let formFactor = "${options.formFactor}";
|
|
3481
3428
|
if(formFactor !== "SMALL"){
|
|
@@ -3540,7 +3487,7 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3540
3487
|
}
|
|
3541
3488
|
if(field.multiple){
|
|
3542
3489
|
scriptStr = scriptStr + `data.${field.name}__label = _.map(_.filter(${field.name}Options, function(option){return _.includes(data.${field.name}, option.value)}), 'label');`;
|
|
3543
|
-
}else {
|
|
3490
|
+
}else if(scriptStr != ''){
|
|
3544
3491
|
scriptStr = scriptStr + `var ${field.name}Selected = _.find(${field.name}Options, function(option){return data.${field.name} == option.value});`;
|
|
3545
3492
|
scriptStr = scriptStr + `data.${field.name}__label = ${field.name}Selected ? ${field.name}Selected.label:null;`;
|
|
3546
3493
|
}
|
|
@@ -3588,6 +3535,7 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3588
3535
|
payload.data.data = [emptyDoc];
|
|
3589
3536
|
}
|
|
3590
3537
|
else{
|
|
3538
|
+
console.log('无法找到记录', api, payload, context)
|
|
3591
3539
|
return {
|
|
3592
3540
|
status: 2,
|
|
3593
3541
|
msg: "${i18next__default["default"].t('frontend_no_records_found')}"
|
|
@@ -3614,13 +3562,12 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3614
3562
|
console.error(e)
|
|
3615
3563
|
}
|
|
3616
3564
|
payload.data = data;
|
|
3617
|
-
payload.data.__objectName = "${object.name}";
|
|
3618
3565
|
payload.data.record = record;
|
|
3619
3566
|
payload.data.NAME_FIELD_VALUE = ${nameLabel} || record.name;
|
|
3620
3567
|
payload.data._master = {
|
|
3621
3568
|
record: record,
|
|
3622
|
-
objectName: "
|
|
3623
|
-
recordId:
|
|
3569
|
+
objectName: "\${objectName}",
|
|
3570
|
+
recordId: "\${recordId}"
|
|
3624
3571
|
}
|
|
3625
3572
|
window.postMessage(Object.assign({type: "record.loaded"}, {record: record}), "*")
|
|
3626
3573
|
}
|
|
@@ -3646,7 +3593,7 @@ async function getReadonlyFormInitApi(object, recordId, fields, options){
|
|
|
3646
3593
|
}
|
|
3647
3594
|
return {
|
|
3648
3595
|
method: "post",
|
|
3649
|
-
url: getApi$2()
|
|
3596
|
+
url: getApi$2(),
|
|
3650
3597
|
cache: API_CACHE,
|
|
3651
3598
|
requestAdaptor: `
|
|
3652
3599
|
${options && options.initApiRequestAdaptor || ''}
|
|
@@ -3737,7 +3684,7 @@ function getScriptForRewriteValueForFileFields(fields){
|
|
|
3737
3684
|
return {
|
|
3738
3685
|
value: fileFieldValue[index],
|
|
3739
3686
|
name: item.name,
|
|
3740
|
-
url: item.url
|
|
3687
|
+
url: item.url,
|
|
3741
3688
|
state: "uploaded"
|
|
3742
3689
|
}
|
|
3743
3690
|
});
|
|
@@ -3747,7 +3694,7 @@ function getScriptForRewriteValueForFileFields(fields){
|
|
|
3747
3694
|
data[item] = [{
|
|
3748
3695
|
value: fileFieldValue,
|
|
3749
3696
|
name: fileFieldDisplayValue.name,
|
|
3750
|
-
url: fileFieldDisplayValue.url
|
|
3697
|
+
url: fileFieldDisplayValue.url,
|
|
3751
3698
|
state: "uploaded"
|
|
3752
3699
|
}];
|
|
3753
3700
|
}
|
|
@@ -3768,7 +3715,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
3768
3715
|
|
|
3769
3716
|
return {
|
|
3770
3717
|
method: "post",
|
|
3771
|
-
url: getApi$2()
|
|
3718
|
+
url: getApi$2(),
|
|
3772
3719
|
// sendOn: "!!this.recordId",
|
|
3773
3720
|
cache: API_CACHE,
|
|
3774
3721
|
requestAdaptor: `
|
|
@@ -4529,6 +4476,11 @@ var __assign = function() {
|
|
|
4529
4476
|
return t;
|
|
4530
4477
|
};
|
|
4531
4478
|
return __assign.apply(this, arguments);
|
|
4479
|
+
};
|
|
4480
|
+
|
|
4481
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
4482
|
+
var e = new Error(message);
|
|
4483
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
4532
4484
|
};
|
|
4533
4485
|
|
|
4534
4486
|
/**
|
|
@@ -4918,7 +4870,7 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
4918
4870
|
// 如果新建记录时复制的数据中有omit或其他不相关字段数据时不应该一起保存到数据库,
|
|
4919
4871
|
// 原规则见:https://github.com/steedos/steedos-frontend/issues/297
|
|
4920
4872
|
_.forEach(selectedRowResponseResult, (val, key) => {
|
|
4921
|
-
if (fieldsKeys.indexOf(key) > -1 && fields[key].omit !== true) {
|
|
4873
|
+
if (fieldsKeys.indexOf(key) > -1 && fields[key].omit !== true && key != 'owner') {
|
|
4922
4874
|
defaultData[key] = val;
|
|
4923
4875
|
}
|
|
4924
4876
|
})
|
|
@@ -4928,7 +4880,7 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
4928
4880
|
if(_master && _master._isRelated){
|
|
4929
4881
|
const relatedKey = _master.relatedKey;
|
|
4930
4882
|
const masterObjectName = _master.objectName;
|
|
4931
|
-
const recordId = _master.recordId;
|
|
4883
|
+
const recordId = _master.recordId || _master.record._id;
|
|
4932
4884
|
let relatedKeySaveValue = recordId;
|
|
4933
4885
|
const relatedField = fields[relatedKey];
|
|
4934
4886
|
if(relatedField && relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
|
|
@@ -4953,7 +4905,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
4953
4905
|
formSchema.defaultData = defaultData;
|
|
4954
4906
|
}
|
|
4955
4907
|
}
|
|
4956
|
-
|
|
4957
4908
|
return {
|
|
4958
4909
|
data: formSchema
|
|
4959
4910
|
};
|
|
@@ -5178,8 +5129,8 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
5178
5129
|
/*
|
|
5179
5130
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
5180
5131
|
* @Date: 2023-03-22 09:31:21
|
|
5181
|
-
* @LastEditors:
|
|
5182
|
-
* @LastEditTime:
|
|
5132
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
5133
|
+
* @LastEditTime: 2024-02-18 16:06:21
|
|
5183
5134
|
*/
|
|
5184
5135
|
const getSchema$3 = (uiSchema)=>{
|
|
5185
5136
|
return {
|
|
@@ -5239,17 +5190,6 @@ const getSchema$3 = (uiSchema)=>{
|
|
|
5239
5190
|
"_isRelated": "${_isRelated}"
|
|
5240
5191
|
},
|
|
5241
5192
|
"expression": `\${_master.objectName != '${uiSchema.name}' && _master.objectName}`
|
|
5242
|
-
},
|
|
5243
|
-
// 列表视图、对象表格组件上的lookup字段,点开右侧弹出drawer窗口,删除记录后刷新列表
|
|
5244
|
-
{
|
|
5245
|
-
"actionType": "broadcast",
|
|
5246
|
-
"args": {
|
|
5247
|
-
"eventName": "@data.changed.${_tableObjectName}"
|
|
5248
|
-
},
|
|
5249
|
-
"data": {
|
|
5250
|
-
"objectName": "${_tableObjectName}"
|
|
5251
|
-
},
|
|
5252
|
-
"expression": `\${_tableObjectName != '${uiSchema.name}' && _tableObjectName}`
|
|
5253
5193
|
}
|
|
5254
5194
|
]
|
|
5255
5195
|
}
|
|
@@ -5541,9 +5481,7 @@ const StandardButtons = {
|
|
|
5541
5481
|
objectName,
|
|
5542
5482
|
uiSchema
|
|
5543
5483
|
} = this;
|
|
5544
|
-
const
|
|
5545
|
-
const scope = this.scope || SteedosUI?.getRef(scopeId);
|
|
5546
|
-
//https://github.com/baidu/amis/pull/6807 .parent的改动是为适应3.2getComponentById的规则改动,不影响2.9
|
|
5484
|
+
const scope = this.scope;
|
|
5547
5485
|
const listViewRef = scope.parent?.getComponentById(`listview_${uiSchema.name}`);
|
|
5548
5486
|
if(_.isEmpty(listViewRef.props.store.toJSON().selectedItems)){
|
|
5549
5487
|
listViewRef.handleAction({}, {
|
|
@@ -5606,9 +5544,7 @@ function getButtonVisibleOn(button){
|
|
|
5606
5544
|
// return 'false';
|
|
5607
5545
|
// }
|
|
5608
5546
|
if(visible.trim().startsWith('function')){
|
|
5609
|
-
visible =
|
|
5610
|
-
object: uiSchema
|
|
5611
|
-
}, [objectName, typeof _id === 'undefined' ? null: _id, typeof record === 'undefined' ? (typeof recordPermissions === 'undefined' ? {} : recordPermissions) : record.recordPermissions, data])`;
|
|
5547
|
+
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)}})()`;
|
|
5612
5548
|
}
|
|
5613
5549
|
}
|
|
5614
5550
|
|
|
@@ -5906,7 +5842,7 @@ const execute = (button, props) => {
|
|
|
5906
5842
|
...props,
|
|
5907
5843
|
action: button
|
|
5908
5844
|
};
|
|
5909
|
-
return button.todo.apply(todoThis, [todoThis.objectName, todoThis.recordId]);
|
|
5845
|
+
return button.todo.apply(todoThis, [todoThis.objectName, todoThis.recordId, props.record?.record?.recordPermissions, props.record]);
|
|
5910
5846
|
}
|
|
5911
5847
|
};
|
|
5912
5848
|
|
|
@@ -6403,21 +6339,6 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6403
6339
|
let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service", {name: "service_object_table_crud"});
|
|
6404
6340
|
crudService && crudService.setData({isFieldsFilterEmpty: true, showFieldsFilter: false});
|
|
6405
6341
|
`;
|
|
6406
|
-
/**
|
|
6407
|
-
给lookup字段配置filter_form_data时可以配置为amis变量,也可以配置为事态key-value键值对象值:
|
|
6408
|
-
```
|
|
6409
|
-
"filter_form_data": "${selectedPublicGroupFilterFormData|toJson}"
|
|
6410
|
-
```
|
|
6411
|
-
or
|
|
6412
|
-
```
|
|
6413
|
-
"filter_form_data": {
|
|
6414
|
-
"public_group_ids": [
|
|
6415
|
-
"67addbef39f9a4503789b38d"
|
|
6416
|
-
]
|
|
6417
|
-
}
|
|
6418
|
-
```
|
|
6419
|
-
*/
|
|
6420
|
-
const filterFormValues = ctx.filter_form_data;
|
|
6421
6342
|
const dataProviderInited = `
|
|
6422
6343
|
const searchableFields = ${JSON.stringify(searchableFields)};
|
|
6423
6344
|
const autoOpenFilter = ${autoOpenFilter};
|
|
@@ -6455,16 +6376,6 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6455
6376
|
}
|
|
6456
6377
|
setData({ filterFormSearchableFields: defaultSearchableFields });
|
|
6457
6378
|
if(isLookup){
|
|
6458
|
-
let filterFormValues = ${_.isObject(filterFormValues) ? JSON.stringify(filterFormValues) : ('"' + filterFormValues + '"')} || {};
|
|
6459
|
-
const isAmisFormula = typeof filterFormValues === "string" && filterFormValues.indexOf("\${") > -1;
|
|
6460
|
-
if (isAmisFormula){
|
|
6461
|
-
filterFormValues = AmisCore.evaluate(filterFormValues, data) || {};
|
|
6462
|
-
}
|
|
6463
|
-
if (_.isObject(filterFormValues) || !_.isEmpty(filterFormValues)){
|
|
6464
|
-
let fields = data.uiSchema && data.uiSchema.fields;
|
|
6465
|
-
filterFormValues = SteedosUI.getSearchFilterFormValues(filterFormValues, fields);
|
|
6466
|
-
setData({ ...filterFormValues });
|
|
6467
|
-
}
|
|
6468
6379
|
// looup字段过滤器不在本地缓存记住过滤条件,所以初始始终隐藏过滤器
|
|
6469
6380
|
setData({ showFieldsFilter: autoOpenFilter });
|
|
6470
6381
|
}
|
|
@@ -6756,15 +6667,13 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6756
6667
|
"actionType": "custom",
|
|
6757
6668
|
"script": onSearchableFieldsChangeScript
|
|
6758
6669
|
},
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
// }
|
|
6767
|
-
// },
|
|
6670
|
+
{
|
|
6671
|
+
"actionType": "click",
|
|
6672
|
+
"componentId": btnSearchId,
|
|
6673
|
+
"args": {
|
|
6674
|
+
"__from_fields_filter_settings_confirm": true
|
|
6675
|
+
}
|
|
6676
|
+
},
|
|
6768
6677
|
{
|
|
6769
6678
|
"componentId": "",
|
|
6770
6679
|
"args": {},
|
|
@@ -6875,6 +6784,10 @@ const getNewListviewButtonSchema = ()=>{
|
|
|
6875
6784
|
"blank": false
|
|
6876
6785
|
},
|
|
6877
6786
|
"actionType": "url",
|
|
6787
|
+
},
|
|
6788
|
+
{
|
|
6789
|
+
"actionType": "custom",
|
|
6790
|
+
"script": "window.location.reload();"
|
|
6878
6791
|
}
|
|
6879
6792
|
]
|
|
6880
6793
|
}
|
|
@@ -7744,6 +7657,7 @@ function getObjectListHeader(objectSchema, listViewName, ctx) {
|
|
|
7744
7657
|
"body": body,
|
|
7745
7658
|
"className": `sm:rounded-tl sm:rounded-tr p-4 -mb-4`
|
|
7746
7659
|
}];
|
|
7660
|
+
// console.log(`getObjectListHeader`, objectSchema, listViewName, ctx)
|
|
7747
7661
|
return headerSchema;
|
|
7748
7662
|
}
|
|
7749
7663
|
|
|
@@ -7765,7 +7679,7 @@ function getBackButtonSchema(){
|
|
|
7765
7679
|
},
|
|
7766
7680
|
"body":[{
|
|
7767
7681
|
"type": "button",
|
|
7768
|
-
"visibleOn": "${window:innerWidth > 768 &&
|
|
7682
|
+
"visibleOn": "${window:innerWidth > 768 && display !== 'split'}",
|
|
7769
7683
|
"className":"flex mr-4",
|
|
7770
7684
|
"onEvent": {
|
|
7771
7685
|
"click": {
|
|
@@ -7836,12 +7750,12 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
7836
7750
|
);
|
|
7837
7751
|
|
|
7838
7752
|
let backButtonsSchema = null;
|
|
7839
|
-
|
|
7753
|
+
|
|
7840
7754
|
if(options.showBackButton != false){
|
|
7841
7755
|
backButtonsSchema = getBackButtonSchema();
|
|
7842
7756
|
}
|
|
7843
7757
|
|
|
7844
|
-
|
|
7758
|
+
console.log(`getObjectRecordDetailHeader==> backButtonsSchema`, backButtonsSchema);
|
|
7845
7759
|
|
|
7846
7760
|
const reg = new RegExp('_', 'g');
|
|
7847
7761
|
const standardIcon = icon && icon.replace(reg, '-');
|
|
@@ -7998,7 +7912,9 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
7998
7912
|
details.push({
|
|
7999
7913
|
type: 'steedos-field',
|
|
8000
7914
|
static: true,
|
|
8001
|
-
config: field,
|
|
7915
|
+
config: Object.assign({}, field, {
|
|
7916
|
+
description: null
|
|
7917
|
+
})
|
|
8002
7918
|
});
|
|
8003
7919
|
}
|
|
8004
7920
|
});
|
|
@@ -8081,7 +7997,7 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
8081
7997
|
"body": [
|
|
8082
7998
|
{
|
|
8083
7999
|
"type": "tpl",
|
|
8084
|
-
"tpl": `<a class="text-black text-base font-bold hover:font-bold" href="/app/\${appId}/\${_master.objectName}/\${_master.
|
|
8000
|
+
"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>`,
|
|
8085
8001
|
"inline": false,
|
|
8086
8002
|
"wrapperComponent": "",
|
|
8087
8003
|
"className": "",
|
|
@@ -8178,6 +8094,10 @@ const getCopyListviewButtonSchema = ()=>{
|
|
|
8178
8094
|
"blank": false
|
|
8179
8095
|
},
|
|
8180
8096
|
"actionType": "url",
|
|
8097
|
+
},
|
|
8098
|
+
{
|
|
8099
|
+
"actionType": "custom",
|
|
8100
|
+
"script": "window.location.reload();"
|
|
8181
8101
|
}
|
|
8182
8102
|
]
|
|
8183
8103
|
}
|
|
@@ -8345,6 +8265,10 @@ const getRenameListviewButtonSchema = ()=>{
|
|
|
8345
8265
|
},
|
|
8346
8266
|
"actionType": "url",
|
|
8347
8267
|
},
|
|
8268
|
+
{
|
|
8269
|
+
"actionType": "custom",
|
|
8270
|
+
"script": "window.location.reload();"
|
|
8271
|
+
}
|
|
8348
8272
|
]
|
|
8349
8273
|
}
|
|
8350
8274
|
}
|
|
@@ -8471,11 +8395,8 @@ const getSetListviewFiltersButtonSchema = ()=>{
|
|
|
8471
8395
|
"weight": 0,
|
|
8472
8396
|
"actions": [
|
|
8473
8397
|
{
|
|
8474
|
-
"
|
|
8475
|
-
|
|
8476
|
-
"blank": false
|
|
8477
|
-
},
|
|
8478
|
-
"actionType": "url",
|
|
8398
|
+
"actionType": "custom",
|
|
8399
|
+
"script": "window.location.reload(); //doAction({'actionType': 'rebuild', 'componentId': `service_listview_${event.data.targetObjectName}`})"
|
|
8479
8400
|
}
|
|
8480
8401
|
]
|
|
8481
8402
|
}
|
|
@@ -8625,11 +8546,8 @@ const getSetListviewColumnsButtonSchema = ()=>{
|
|
|
8625
8546
|
"weight": 0,
|
|
8626
8547
|
"actions": [
|
|
8627
8548
|
{
|
|
8628
|
-
"
|
|
8629
|
-
|
|
8630
|
-
"blank": false
|
|
8631
|
-
},
|
|
8632
|
-
"actionType": "url"
|
|
8549
|
+
"actionType": "custom",
|
|
8550
|
+
"script": "window.location.reload(); //doAction({'actionType': 'rebuild', 'componentId': `service_listview_${event.data.targetObjectName}`})"
|
|
8633
8551
|
}
|
|
8634
8552
|
]
|
|
8635
8553
|
}
|
|
@@ -8778,11 +8696,8 @@ const getSetListviewSortButtonSchema = ()=>{
|
|
|
8778
8696
|
"weight": 0,
|
|
8779
8697
|
"actions": [
|
|
8780
8698
|
{
|
|
8781
|
-
"
|
|
8782
|
-
|
|
8783
|
-
"blank": false
|
|
8784
|
-
},
|
|
8785
|
-
"actionType": "url"
|
|
8699
|
+
"actionType": "custom",
|
|
8700
|
+
"script": "window.location.reload(); //doAction({'actionType': 'rebuild', 'componentId': `service_listview_${event.data.targetObjectName}`})"
|
|
8786
8701
|
}
|
|
8787
8702
|
]
|
|
8788
8703
|
}
|
|
@@ -8903,6 +8818,10 @@ const getDeleteListviewButtonSchema = ()=>{
|
|
|
8903
8818
|
"blank": false
|
|
8904
8819
|
},
|
|
8905
8820
|
"expression": "data.delete == 1"
|
|
8821
|
+
},
|
|
8822
|
+
{
|
|
8823
|
+
"actionType": "custom",
|
|
8824
|
+
"script": "window.location.reload();"
|
|
8906
8825
|
}
|
|
8907
8826
|
]
|
|
8908
8827
|
}
|
|
@@ -9772,12 +9691,12 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
9772
9691
|
payload.status = 2;
|
|
9773
9692
|
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
9774
9693
|
}
|
|
9775
|
-
var scope = SteedosUI.getRef(context.scopeId);
|
|
9776
|
-
var scopeParent = scope && scope.parent;
|
|
9777
|
-
var crudScoped = scopeParent.getComponentById('${body.id}');
|
|
9778
|
-
setTimeout(()=>{
|
|
9779
|
-
|
|
9780
|
-
}, 500);
|
|
9694
|
+
// var scope = SteedosUI.getRef(context.scopeId);
|
|
9695
|
+
// var scopeParent = scope && scope.parent;
|
|
9696
|
+
// var crudScoped = scopeParent.getComponentById('${body.id}');
|
|
9697
|
+
// setTimeout(()=>{
|
|
9698
|
+
// crudScoped && crudScoped.control.updateAutoFillHeight();
|
|
9699
|
+
// }, 500);
|
|
9781
9700
|
return payload;
|
|
9782
9701
|
`;
|
|
9783
9702
|
|
|
@@ -9984,17 +9903,6 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
9984
9903
|
},
|
|
9985
9904
|
"expression": `\${_master.objectName != '${objectSchema.name}' && _master.objectName}`
|
|
9986
9905
|
},
|
|
9987
|
-
// 列表视图、对象表格组件上的lookup字段,点开右侧弹出drawer窗口,修改记录后刷新列表
|
|
9988
|
-
{
|
|
9989
|
-
"actionType": "broadcast",
|
|
9990
|
-
"args": {
|
|
9991
|
-
"eventName": "@data.changed.${_tableObjectName}"
|
|
9992
|
-
},
|
|
9993
|
-
"data": {
|
|
9994
|
-
"objectName": "${_tableObjectName}"
|
|
9995
|
-
},
|
|
9996
|
-
"expression": `\${_tableObjectName != '${objectSchema.name}' && _tableObjectName}`
|
|
9997
|
-
},
|
|
9998
9906
|
...submitSuccActions,
|
|
9999
9907
|
// {
|
|
10000
9908
|
// "actionType": "custom",
|
|
@@ -10098,7 +10006,7 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
10098
10006
|
}
|
|
10099
10007
|
|
|
10100
10008
|
amisSchema.body[0].body = await getFormSchemaWithDataFilter(amisSchema.body[0].body, { formDataFilter, onFormDataFilter, amisData, env });
|
|
10101
|
-
// console.log('getObjectDetail=====>', amisSchema);
|
|
10009
|
+
// console.log('getObjectDetail=====>', amisSchema, objectSchema, recordId, ctx);
|
|
10102
10010
|
return amisSchema;
|
|
10103
10011
|
}
|
|
10104
10012
|
|
|
@@ -10597,7 +10505,7 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
|
|
|
10597
10505
|
* @Author: baozhoutao@steedos.com
|
|
10598
10506
|
* @Date: 2022-07-05 15:55:39
|
|
10599
10507
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
10600
|
-
* @LastEditTime:
|
|
10508
|
+
* @LastEditTime: 2025-04-22 17:44:32
|
|
10601
10509
|
* @Description:
|
|
10602
10510
|
*/
|
|
10603
10511
|
|
|
@@ -10706,7 +10614,7 @@ function formatUISchemaCache(objectName, uiSchema){
|
|
|
10706
10614
|
});
|
|
10707
10615
|
}
|
|
10708
10616
|
|
|
10709
|
-
async function getUISchema(objectName, force) {
|
|
10617
|
+
async function getUISchema(objectName, force, retry = true) {
|
|
10710
10618
|
if (!objectName) {
|
|
10711
10619
|
return;
|
|
10712
10620
|
}
|
|
@@ -10722,7 +10630,13 @@ async function getUISchema(objectName, force) {
|
|
|
10722
10630
|
const url = `/service/api/@${objectName.replace(/\./g, "_")}/uiSchema`;
|
|
10723
10631
|
uiSchema = await fetchAPI(url, { method: "get" });
|
|
10724
10632
|
}
|
|
10725
|
-
|
|
10633
|
+
|
|
10634
|
+
if(!uiSchema && retry){
|
|
10635
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
10636
|
+
return getUISchema(objectName, force, false);
|
|
10637
|
+
}
|
|
10638
|
+
|
|
10639
|
+
if(!uiSchema && retry == false){
|
|
10726
10640
|
return ;
|
|
10727
10641
|
}
|
|
10728
10642
|
formatUISchemaCache(objectName, uiSchema);
|
|
@@ -10733,7 +10647,16 @@ async function getUISchema(objectName, force) {
|
|
|
10733
10647
|
return getUISchemaCache(objectName);
|
|
10734
10648
|
}
|
|
10735
10649
|
|
|
10736
|
-
|
|
10650
|
+
// 阻塞等待函数,单位毫秒
|
|
10651
|
+
function wait(milliseconds) {
|
|
10652
|
+
const start = new Date().getTime();
|
|
10653
|
+
let now = start;
|
|
10654
|
+
while (now - start < milliseconds) {
|
|
10655
|
+
now = new Date().getTime();
|
|
10656
|
+
}
|
|
10657
|
+
}
|
|
10658
|
+
|
|
10659
|
+
function getUISchemaSync$1(objectName, force, retry = true) {
|
|
10737
10660
|
if (!objectName) {
|
|
10738
10661
|
return;
|
|
10739
10662
|
}
|
|
@@ -10749,7 +10672,12 @@ function getUISchemaSync$1(objectName, force) {
|
|
|
10749
10672
|
async: false,
|
|
10750
10673
|
});
|
|
10751
10674
|
|
|
10752
|
-
if(!uiSchema){
|
|
10675
|
+
if(!uiSchema && retry){
|
|
10676
|
+
wait(2000); // 阻塞等待3秒
|
|
10677
|
+
return getUISchemaSync$1(objectName, force, false)
|
|
10678
|
+
}
|
|
10679
|
+
|
|
10680
|
+
if(!uiSchema && retry == false){
|
|
10753
10681
|
return ;
|
|
10754
10682
|
}
|
|
10755
10683
|
formatUISchemaCache(objectName, uiSchema);
|
|
@@ -10794,6 +10722,7 @@ async function getListSchema(
|
|
|
10794
10722
|
listViewName,
|
|
10795
10723
|
ctx = {}
|
|
10796
10724
|
) {
|
|
10725
|
+
// console.log('getListSchema', objectName, listView, ctx)
|
|
10797
10726
|
const uiSchema = await getUISchema(objectName);
|
|
10798
10727
|
if(!uiSchema){
|
|
10799
10728
|
return {}
|
|
@@ -10824,6 +10753,7 @@ async function getListSchema(
|
|
|
10824
10753
|
}
|
|
10825
10754
|
|
|
10826
10755
|
let listViewColumns = getListViewColumns(listView, ctx.formFactor);
|
|
10756
|
+
// console.log('getListSchema listViewColumns', objectName, listView, listViewColumns)
|
|
10827
10757
|
let sort = getListViewSort(listView);
|
|
10828
10758
|
let listviewFilter = getListViewFilter(listView);
|
|
10829
10759
|
let listview_filters = listView && listView._filters;
|
|
@@ -11030,7 +10960,7 @@ async function getTableSchema(
|
|
|
11030
10960
|
columns,
|
|
11031
10961
|
ctx = {}
|
|
11032
10962
|
) {
|
|
11033
|
-
// console.
|
|
10963
|
+
// console.log('getTableSchema', columns);
|
|
11034
10964
|
const uiSchema = await getUISchema(objectName);
|
|
11035
10965
|
|
|
11036
10966
|
let sort = ctx.sort;
|
|
@@ -11064,7 +10994,7 @@ async function getTableSchema(
|
|
|
11064
10994
|
};
|
|
11065
10995
|
crudOptions.amisData = createObject(ctx.amisData || {}, {});
|
|
11066
10996
|
const amisSchema = await getObjectCRUD(uiSchema, fields, crudOptions);
|
|
11067
|
-
// console.
|
|
10997
|
+
// console.log('getTableSchema', amisSchema, uiSchema);
|
|
11068
10998
|
return {
|
|
11069
10999
|
uiSchema,
|
|
11070
11000
|
amisSchema,
|
|
@@ -11101,8 +11031,7 @@ async function getRecordDetailHeaderSchema(objectName,recordId, options){
|
|
|
11101
11031
|
}
|
|
11102
11032
|
|
|
11103
11033
|
async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
11104
|
-
const uiSchema = await getUISchema(objectName);
|
|
11105
|
-
|
|
11034
|
+
const uiSchema = await getUISchema(objectName);
|
|
11106
11035
|
const relatedLists = await getObjectRelatedList(objectName);
|
|
11107
11036
|
const detailed = {
|
|
11108
11037
|
"title": i18next__default["default"].t('frontend_record_detail_tab_detailed'),
|
|
@@ -11141,22 +11070,10 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
11141
11070
|
if(relatedLists.length){
|
|
11142
11071
|
content.tabs.push(related);
|
|
11143
11072
|
}
|
|
11144
|
-
const contents = [content];
|
|
11145
|
-
if (uiSchema.enable_chatter && window.BuilderLiveblocks) {
|
|
11146
|
-
const chatter = {
|
|
11147
|
-
"type": "rooms-provider",
|
|
11148
|
-
"baseUrl": "${context.rootUrl}",
|
|
11149
|
-
"body": [
|
|
11150
|
-
{
|
|
11151
|
-
"type": "rooms-comments",
|
|
11152
|
-
"className": "flex flex-col gap-3 m-4",
|
|
11153
|
-
"roomId": "objects:${objectName}:${recordId}",
|
|
11154
|
-
}
|
|
11155
|
-
]
|
|
11156
|
-
};
|
|
11157
|
-
contents.push(chatter);
|
|
11158
|
-
}
|
|
11159
11073
|
// content.tabs = reverse(content.tabs)
|
|
11074
|
+
if(content.tabs.length == 1){
|
|
11075
|
+
content.className += " steedos-record-tabs--single";
|
|
11076
|
+
}
|
|
11160
11077
|
return {
|
|
11161
11078
|
uiSchema,
|
|
11162
11079
|
amisSchema: {
|
|
@@ -11171,7 +11088,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
11171
11088
|
"showButtons": props.showButtons,
|
|
11172
11089
|
"showBackButton": props.showBackButton,
|
|
11173
11090
|
},
|
|
11174
|
-
|
|
11091
|
+
content
|
|
11175
11092
|
],
|
|
11176
11093
|
"objectApiName": "${objectName}",
|
|
11177
11094
|
"recordId": "${recordId}",
|
|
@@ -11955,42 +11872,14 @@ function getLookupSapceUserTreeSchema(isMobile){
|
|
|
11955
11872
|
{
|
|
11956
11873
|
"actionType": "custom",
|
|
11957
11874
|
"script": `
|
|
11958
|
-
console.log("lookup-tree-event.data:",event.data);
|
|
11959
|
-
console.log("lookup-tree-event.data.value.label:",event.data.value.label);
|
|
11960
|
-
console.log("lookup-tree-event.data.value.value:",event.data.value.value);
|
|
11961
11875
|
const scope = event.context.scoped;
|
|
11962
|
-
var
|
|
11876
|
+
var filterFormValues={
|
|
11963
11877
|
"__searchable__organizations_parents":event.data.value.value
|
|
11964
11878
|
}
|
|
11965
|
-
|
|
11966
|
-
|
|
11967
|
-
// });
|
|
11968
|
-
// listView.handleFilterSubmit(Object.assign({}, filterFormValues));
|
|
11969
|
-
let __lookupField = event.data.__lookupField;
|
|
11970
|
-
let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
|
|
11971
|
-
var filterForm = scope.getComponents().find(function(n){
|
|
11972
|
-
return n.props.type === "form";
|
|
11879
|
+
var listView = scope.parent.getComponents().find(function(n){
|
|
11880
|
+
return n.props.type === "crud";
|
|
11973
11881
|
});
|
|
11974
|
-
|
|
11975
|
-
filterFormValues = JSON.parse(JSON.stringify(filterFormValues)); //只取当层数据域中数据,去除__super层数据
|
|
11976
|
-
const changedFilterFormValues = _.pickBy(filterFormValues, function(n,k){return /^__searchable__/.test(k);});
|
|
11977
|
-
Object.assign(changedFilterFormValues, treeFilterFormValues);
|
|
11978
|
-
// 同步__changedFilterFormValues中的值
|
|
11979
|
-
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
11980
|
-
if(__lookupField){
|
|
11981
|
-
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
11982
|
-
if(__lookupField.reference_to_field){
|
|
11983
|
-
lookupTag += "__" + __lookupField.reference_to_field;
|
|
11984
|
-
}
|
|
11985
|
-
__changedFilterFormValuesKey += lookupTag;
|
|
11986
|
-
}
|
|
11987
|
-
if(crud){
|
|
11988
|
-
let crudData = crud.getData();
|
|
11989
|
-
crudData[__changedFilterFormValuesKey] = changedFilterFormValues;
|
|
11990
|
-
crud.setData(crudData);
|
|
11991
|
-
}
|
|
11992
|
-
filterForm.setData(treeFilterFormValues);
|
|
11993
|
-
filterForm.handleFormSubmit(event);
|
|
11882
|
+
listView.handleFilterSubmit(Object.assign({}, filterFormValues));
|
|
11994
11883
|
`
|
|
11995
11884
|
},
|
|
11996
11885
|
{
|
|
@@ -12208,7 +12097,6 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12208
12097
|
// field.name可能是带点的名称,比如审批王中子表字段'instances.instances_submitter',如果不替换掉点,会造成审批王表单中新建子表行时报错
|
|
12209
12098
|
let keywordsSearchBoxName = `__keywords_lookup__${field.name.replace(/\./g, "_")}__to__${refObjectConfig.name}`;
|
|
12210
12099
|
|
|
12211
|
-
const filterFormValues = field.filter_form_data;
|
|
12212
12100
|
source.requestAdaptor = `
|
|
12213
12101
|
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
12214
12102
|
let __lookupField = api.data.$self.__lookupField;
|
|
@@ -12251,20 +12139,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12251
12139
|
}
|
|
12252
12140
|
}
|
|
12253
12141
|
|
|
12254
|
-
|
|
12255
|
-
if (selfData.op !== 'loadOptions'){
|
|
12256
|
-
filterFormValues = ${___namespace.isObject(filterFormValues) ? JSON.stringify(filterFormValues) : ('"' + filterFormValues + '"')} || {};
|
|
12257
|
-
const isAmisFormula = typeof filterFormValues === "string" && filterFormValues.indexOf("\${") > -1;
|
|
12258
|
-
if (isAmisFormula){
|
|
12259
|
-
filterFormValues = AmisCore.evaluate(filterFormValues, context) || {};
|
|
12260
|
-
}
|
|
12261
|
-
if (_.isObject(filterFormValues) || !_.isEmpty(filterFormValues)){
|
|
12262
|
-
let fields = api.data.$self.uiSchema && api.data.$self.uiSchema.fields;
|
|
12263
|
-
filterFormValues = SteedosUI.getSearchFilterFormValues(filterFormValues, fields);
|
|
12264
|
-
}
|
|
12265
|
-
}
|
|
12266
|
-
|
|
12267
|
-
var searchableFilter = SteedosUI.getSearchFilter(Object.assign({}, { ...filterFormValues }, selfData)) || [];
|
|
12142
|
+
var searchableFilter = SteedosUI.getSearchFilter(selfData) || [];
|
|
12268
12143
|
|
|
12269
12144
|
if(searchableFilter.length > 0){
|
|
12270
12145
|
if(filters.length > 0 ){
|
|
@@ -12454,7 +12329,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12454
12329
|
return payload;
|
|
12455
12330
|
`;
|
|
12456
12331
|
}
|
|
12457
|
-
let top =
|
|
12332
|
+
let top = 20;
|
|
12458
12333
|
|
|
12459
12334
|
if(refObjectConfig.paging && refObjectConfig.paging.enabled === false){
|
|
12460
12335
|
top = 1000;
|
|
@@ -12504,8 +12379,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12504
12379
|
keywordsSearchBoxName,
|
|
12505
12380
|
searchable_fields: field.searchable_fields,
|
|
12506
12381
|
auto_open_filter: field.auto_open_filter,
|
|
12507
|
-
show_left_filter: field.show_left_filter
|
|
12508
|
-
filter_form_data: field.filter_form_data
|
|
12382
|
+
show_left_filter: field.show_left_filter
|
|
12509
12383
|
});
|
|
12510
12384
|
}
|
|
12511
12385
|
pickerSchema.data = Object.assign({}, pickerSchema.data, {
|
|
@@ -12572,7 +12446,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12572
12446
|
}
|
|
12573
12447
|
|
|
12574
12448
|
const ctx = ${JSON.stringify(ctx)};
|
|
12575
|
-
const componentId = ctx.defaults
|
|
12449
|
+
const componentId = ctx.defaults.formSchema.id;
|
|
12576
12450
|
doAction({
|
|
12577
12451
|
actionType: 'setValue',
|
|
12578
12452
|
componentId: componentId,
|
|
@@ -12999,10 +12873,6 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
12999
12873
|
}
|
|
13000
12874
|
let amisSchema;
|
|
13001
12875
|
// 默认使用下拉框模式显示lookup选项,只能配置了enable_enhanced_lookup才使用弹出增强模式
|
|
13002
|
-
if(enableEnhancedLookup == true && field.amis && field.amis.type && field.amis.type !== 'picker'){
|
|
13003
|
-
// 如果配置了amis.type且其值不是picker,则不使用弹出增强模式
|
|
13004
|
-
enableEnhancedLookup = false;
|
|
13005
|
-
}
|
|
13006
12876
|
if(enableEnhancedLookup == true){
|
|
13007
12877
|
amisSchema = await lookupToAmisPicker(field, readonly, ctx);
|
|
13008
12878
|
}else if(refObject.enable_tree) {
|
|
@@ -14134,16 +14004,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
14134
14004
|
return convertData
|
|
14135
14005
|
}
|
|
14136
14006
|
// if(ctx.mode === 'edit'){
|
|
14137
|
-
let convertDataResult;
|
|
14138
|
-
if(convertData.type == "steedos-field"){
|
|
14139
|
-
// 如果是steedos-field,不能把amis属性合并到steedos-field根属性中,要合并也是合并到steedos-field的config.amis中
|
|
14140
|
-
// 而steedos-field字段的amis属性本身就在config.amis中了,所以这里不需要再合并field.amis
|
|
14141
|
-
// 目前测试到受影响的是,把字段的amis属性配置为{"type": "checkboxes"}时,ObjectForm只读模式下,lookup字段返回的是type为steedos-field的组件,此时field.amis中的type不应该合并到steedos-field根属性中
|
|
14142
|
-
convertDataResult = Object.assign({}, baseData, convertData, { labelClassName: 'text-left', clearValueOnHidden: true, fieldName: field.name}, {name: baseData.name});
|
|
14143
|
-
}
|
|
14144
|
-
else {
|
|
14145
|
-
convertDataResult = Object.assign({}, baseData, convertData, { labelClassName: 'text-left', clearValueOnHidden: true, fieldName: field.name}, field.amis, {name: baseData.name});
|
|
14146
|
-
}
|
|
14007
|
+
let convertDataResult = Object.assign({}, baseData, convertData, { labelClassName: 'text-left', clearValueOnHidden: true, fieldName: field.name}, field.amis, {name: baseData.name});
|
|
14147
14008
|
// 只读时file字段的外层control层若存在name,内部each组件存在问题
|
|
14148
14009
|
if(readonly && field.type == "file") {
|
|
14149
14010
|
convertDataResult.name = "";
|