@steedos-widgets/amis-object 3.6.1 → 3.6.2-beta.10
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/amis/AmisGlobalHeader.d.ts +1 -31
- package/dist/amis/AmisInputTable.d.ts +1 -0
- package/dist/amis/AmisRecordDetail.d.ts +5 -7
- package/dist/amis/AmisRecordDetailHeader.d.ts +1 -56
- package/dist/amis/AmisRecordDetailMini.d.ts +31 -0
- package/dist/amis/AmisRecordService.d.ts +42 -6
- package/dist/amis/index.d.ts +1 -0
- package/dist/amis-object.cjs.css +435 -229
- package/dist/amis-object.cjs.js +1117 -489
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +435 -229
- package/dist/amis-object.esm.js +1117 -490
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +435 -229
- package/dist/amis-object.umd.js +326 -214
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +21 -21
- package/dist/meta.js +505 -393
- package/dist/metas/AmisRecordDetailMini.d.ts +2 -0
- package/dist/pages/PageObject.d.ts +1 -0
- package/dist/tailwind-base.css +37 -6
- package/package.json +3 -3
package/dist/amis-object.cjs.js
CHANGED
|
@@ -3521,22 +3521,26 @@ const getSteedosAuth = () => {
|
|
|
3521
3521
|
* @Description:
|
|
3522
3522
|
*/
|
|
3523
3523
|
|
|
3524
|
-
|
|
3525
3524
|
const Router$1 = {
|
|
3526
3525
|
getTabDisplayAs(tab_id){
|
|
3526
|
+
const uiSchema = getUISchemaSync$1(tab_id, false);
|
|
3527
3527
|
var urlSearch = new URLSearchParams(document.location.search);
|
|
3528
3528
|
if(urlSearch.has('display')){
|
|
3529
3529
|
return urlSearch.get('display')
|
|
3530
3530
|
}
|
|
3531
3531
|
const key = `tab_${tab_id}_display`;
|
|
3532
3532
|
// const key = `page_display`;
|
|
3533
|
-
const value =
|
|
3534
|
-
|
|
3533
|
+
const value = sessionStorage.getItem(key);
|
|
3534
|
+
let defaultDisplay = "grid";
|
|
3535
|
+
if(uiSchema.enable_split){
|
|
3536
|
+
defaultDisplay = "split";
|
|
3537
|
+
}
|
|
3538
|
+
return value ? value : defaultDisplay;
|
|
3535
3539
|
},
|
|
3536
3540
|
|
|
3537
3541
|
setTabDisplayAs(tab_id, displayAs){
|
|
3538
3542
|
const key = `tab_${tab_id}_display`;
|
|
3539
|
-
|
|
3543
|
+
sessionStorage.setItem(key, displayAs);
|
|
3540
3544
|
},
|
|
3541
3545
|
getAppPath({formFactor, appId}){
|
|
3542
3546
|
return `/app/${appId}`;
|
|
@@ -3640,7 +3644,7 @@ function getComparableAmisVersion() {
|
|
|
3640
3644
|
* @Author: baozhoutao@steedos.com
|
|
3641
3645
|
* @Date: 2022-05-23 09:53:08
|
|
3642
3646
|
* @LastEditors: liaodaxue
|
|
3643
|
-
* @LastEditTime:
|
|
3647
|
+
* @LastEditTime: 2024-01-17 16:00:27
|
|
3644
3648
|
* @Description:
|
|
3645
3649
|
*/
|
|
3646
3650
|
|
|
@@ -3712,7 +3716,7 @@ function getSelectMap(selectOptions){
|
|
|
3712
3716
|
|
|
3713
3717
|
function getNameTplUrl(field, ctx){
|
|
3714
3718
|
if(ctx.objectName === 'cms_files'){
|
|
3715
|
-
return
|
|
3719
|
+
return "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}"
|
|
3716
3720
|
}
|
|
3717
3721
|
const href = Router$1.getObjectDetailPath({
|
|
3718
3722
|
...ctx, formFactor: ctx.formFactor, appId: "${appId}", objectName: ctx.objectName || "${objectName}", recordId: `\${${ctx.idFieldName}}`
|
|
@@ -4584,9 +4588,9 @@ var frontend_display_type_is_split = "分栏视图";
|
|
|
4584
4588
|
var frontend_display_as = "显示为";
|
|
4585
4589
|
var frontend_record_sum = "个项目";
|
|
4586
4590
|
var frontend_button_reload_tooltip = "刷新";
|
|
4587
|
-
var frontend_button_search_tooltip = "
|
|
4591
|
+
var frontend_button_search_tooltip = "搜索";
|
|
4588
4592
|
var frontend_fields_filter_button_search = "搜索";
|
|
4589
|
-
var frontend_fields_filter_button_settings = "
|
|
4593
|
+
var frontend_fields_filter_button_settings = "选择搜索项";
|
|
4590
4594
|
var frontend_button_listview_control_tooltip = "列表视图控制";
|
|
4591
4595
|
var frontend_button_listview_control_label = "列表视图控制";
|
|
4592
4596
|
var frontend_listview_control_columns = "显示的列";
|
|
@@ -4785,16 +4789,17 @@ async function getQuickEditSchema(field, options){
|
|
|
4785
4789
|
{
|
|
4786
4790
|
actionType: "custom",
|
|
4787
4791
|
script: `
|
|
4792
|
+
console.log("asdasd");
|
|
4788
4793
|
let items = _.cloneDeep(event.data.items);
|
|
4789
4794
|
let selectedItems = _.cloneDeep(event.data.selectedItems);
|
|
4790
4795
|
if(event.data.isBatchEdit){
|
|
4791
4796
|
selectedItems.forEach(function(selectedItem){
|
|
4792
4797
|
selectedItem._display.${field.name} = event.data._display.${field.name};
|
|
4793
|
-
doAction({actionType: 'setValue', "args": {"value": selectedItem._display},componentId: ${options.objectName} + "_display_" + selectedItem._index});
|
|
4798
|
+
doAction({actionType: 'setValue', "args": {"value": selectedItem._display},componentId: "${options.objectName}" + "_display_" + selectedItem._index});
|
|
4794
4799
|
doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + selectedItem._index});
|
|
4795
4800
|
})
|
|
4796
4801
|
}else{
|
|
4797
|
-
doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: ${options.objectName} + "_display_" + event.data._index});
|
|
4802
|
+
doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: "${options.objectName}" + "_display_" + event.data._index});
|
|
4798
4803
|
doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + event.data._index});
|
|
4799
4804
|
}
|
|
4800
4805
|
`
|
|
@@ -5240,9 +5245,13 @@ async function getTableColumns$1(fields, options){
|
|
|
5240
5245
|
const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
|
|
5241
5246
|
let className = "";
|
|
5242
5247
|
if(field.wrap != true){
|
|
5243
|
-
|
|
5248
|
+
if(field.wrap != false && field.is_wide){
|
|
5249
|
+
className += " break-words ";
|
|
5250
|
+
}else {
|
|
5251
|
+
className += " whitespace-nowrap ";
|
|
5252
|
+
}
|
|
5244
5253
|
}else {
|
|
5245
|
-
className += " break-
|
|
5254
|
+
className += " break-words ";
|
|
5246
5255
|
}
|
|
5247
5256
|
let columnItem;
|
|
5248
5257
|
if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
|
|
@@ -5339,12 +5348,24 @@ async function getTableColumns$1(fields, options){
|
|
|
5339
5348
|
if(field.type === 'textarea'){
|
|
5340
5349
|
className += 'min-w-56';
|
|
5341
5350
|
}
|
|
5342
|
-
if(field.type === 'date'){
|
|
5343
|
-
|
|
5344
|
-
}
|
|
5345
|
-
if(field.type === 'datetime'){
|
|
5346
|
-
|
|
5351
|
+
// if(field.type === 'date'){
|
|
5352
|
+
// className += 'date-min-w';
|
|
5353
|
+
// }
|
|
5354
|
+
// if(field.type === 'datetime'){
|
|
5355
|
+
// className += 'datetime-min-w';
|
|
5356
|
+
// }
|
|
5357
|
+
|
|
5358
|
+
//field上的amis属性里的clssname需要单独判断类型合并
|
|
5359
|
+
if (typeof field.amis?.className == "object") {
|
|
5360
|
+
className = {
|
|
5361
|
+
[className]: "true",
|
|
5362
|
+
...field.amis.className
|
|
5363
|
+
};
|
|
5364
|
+
} else if (typeof field.amis?.className == "string") {
|
|
5365
|
+
className = `${className} ${field.amis.className} `;
|
|
5347
5366
|
}
|
|
5367
|
+
delete field.amis?.className;
|
|
5368
|
+
|
|
5348
5369
|
if(!field.hidden && !field.extra){
|
|
5349
5370
|
columnItem = Object.assign({}, {
|
|
5350
5371
|
name: field.name,
|
|
@@ -5427,7 +5448,7 @@ function getMobileLines(tpls){
|
|
|
5427
5448
|
}
|
|
5428
5449
|
if(isLeft){
|
|
5429
5450
|
// 左侧半行
|
|
5430
|
-
lineChildrenClassName = "steedos-listview-item-left truncate";
|
|
5451
|
+
lineChildrenClassName = "steedos-listview-item-left truncate h-5";
|
|
5431
5452
|
if(item.field.is_wide){
|
|
5432
5453
|
// 左侧全行样式可以单独写,如果需要配置两行省略号效果,可以加样式类 two-lines-truncate
|
|
5433
5454
|
lineChildrenClassName = "steedos-listview-item-wide";
|
|
@@ -5439,14 +5460,26 @@ function getMobileLines(tpls){
|
|
|
5439
5460
|
}
|
|
5440
5461
|
else {
|
|
5441
5462
|
// 右侧半行,这里加样式类 flex flex-shrink-0,是为了省略号只显示在左半行,右半行文字一般比较短,如果也加省略号效果的话,左侧文字多的话,右侧没几个字就显示省略号了
|
|
5442
|
-
lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0";
|
|
5463
|
+
lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0 h-5";
|
|
5464
|
+
}
|
|
5465
|
+
//支持字段amis属性配置classname,识别classname的类型,与原样式合并
|
|
5466
|
+
var className;
|
|
5467
|
+
if (typeof item.field.amis?.className == "object") {
|
|
5468
|
+
className = {
|
|
5469
|
+
[lineChildrenClassName]: "true",
|
|
5470
|
+
...item.field.amis.className
|
|
5471
|
+
};
|
|
5472
|
+
} else if (typeof item.field.amis?.className == "string") {
|
|
5473
|
+
className = `${lineChildrenClassName} ${item.field.amis.className} `;
|
|
5474
|
+
} else {
|
|
5475
|
+
className = lineChildrenClassName;
|
|
5443
5476
|
}
|
|
5444
5477
|
lineChildren.push({
|
|
5445
5478
|
"type": "tpl",
|
|
5446
5479
|
"tpl": item.tpl,
|
|
5447
|
-
|
|
5480
|
+
className
|
|
5448
5481
|
});
|
|
5449
|
-
|
|
5482
|
+
|
|
5450
5483
|
if(item.field.is_wide){
|
|
5451
5484
|
// 宽字段占整行
|
|
5452
5485
|
isLeft = true;
|
|
@@ -5496,8 +5529,7 @@ async function getMobileTableColumns(fields, options){
|
|
|
5496
5529
|
tpl = await getFieldTpl(field, options);
|
|
5497
5530
|
}
|
|
5498
5531
|
if(!tpl){
|
|
5499
|
-
|
|
5500
|
-
tpl = `\${${field.name} | raw}`;
|
|
5532
|
+
tpl = `\${${field.name}}`;
|
|
5501
5533
|
}
|
|
5502
5534
|
if(!field.hidden && !field.extra){
|
|
5503
5535
|
tpls.push({ field, tpl });
|
|
@@ -5510,7 +5542,7 @@ async function getMobileTableColumns(fields, options){
|
|
|
5510
5542
|
|
|
5511
5543
|
let column = {
|
|
5512
5544
|
name: nameField.name,
|
|
5513
|
-
label: nameField.label,
|
|
5545
|
+
label: options.displayAs == 'split' ? '' : nameField.label,
|
|
5514
5546
|
sortable: nameField.sortable,
|
|
5515
5547
|
type: "button",
|
|
5516
5548
|
level: "link",
|
|
@@ -5539,7 +5571,15 @@ async function getMobileTableColumns(fields, options){
|
|
|
5539
5571
|
"actions": [
|
|
5540
5572
|
{
|
|
5541
5573
|
"script": `
|
|
5542
|
-
let cms_url =
|
|
5574
|
+
let cms_url = '';
|
|
5575
|
+
let value = event.data.versions[0];
|
|
5576
|
+
if(value){
|
|
5577
|
+
if(value.url){
|
|
5578
|
+
cms_url = value.url;
|
|
5579
|
+
}else{
|
|
5580
|
+
cms_url = "/api/files/files/"+value+"?download=true"
|
|
5581
|
+
}
|
|
5582
|
+
}
|
|
5543
5583
|
Steedos.cordovaDownload(encodeURI(Steedos.absoluteUrl(cms_url)), event.data.name);
|
|
5544
5584
|
`,
|
|
5545
5585
|
"actionType": "custom"
|
|
@@ -5655,7 +5695,8 @@ async function getTableOperation(ctx){
|
|
|
5655
5695
|
label: " ",
|
|
5656
5696
|
fixed: 'right',
|
|
5657
5697
|
labelClassName: 'text-center',
|
|
5658
|
-
|
|
5698
|
+
//TODO:目前3.6.3-patch.3版本中对于动态classname处理存在问题,简单处理固定列问题,等待amis解决crud的columns不支持动态classname的问题
|
|
5699
|
+
className: 'text-center steedos-listview-operation w-10 is-sticky is-sticky-right is-sticky-first-right',
|
|
5659
5700
|
buttons: [
|
|
5660
5701
|
{
|
|
5661
5702
|
"type": "steedos-dropdown-button",
|
|
@@ -5751,7 +5792,7 @@ async function getTableSchema$1(fields, options){
|
|
|
5751
5792
|
}
|
|
5752
5793
|
return {
|
|
5753
5794
|
mode: "cards",
|
|
5754
|
-
perPageAvailable: [
|
|
5795
|
+
perPageAvailable: [20, 50, 100, 500],
|
|
5755
5796
|
name: "thelist",
|
|
5756
5797
|
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
5757
5798
|
className: "",
|
|
@@ -5784,7 +5825,7 @@ async function getTableSchema$1(fields, options){
|
|
|
5784
5825
|
|
|
5785
5826
|
return {
|
|
5786
5827
|
mode: "table",
|
|
5787
|
-
perPageAvailable: [
|
|
5828
|
+
perPageAvailable: [20, 50, 100, 500],
|
|
5788
5829
|
name: "thelist",
|
|
5789
5830
|
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
5790
5831
|
className: "",
|
|
@@ -6170,6 +6211,16 @@ async function getTableApi(mainObject, fields, options){
|
|
|
6170
6211
|
}
|
|
6171
6212
|
// SteedosUI.getRef(api.body.$self.$scopeId)?.parent?.getComponentById(setDataToComponentId)?.setData({$count: payload.data.count})
|
|
6172
6213
|
};
|
|
6214
|
+
let formFactor = "${options.formFactor}";
|
|
6215
|
+
if(formFactor !== "SMALL"){
|
|
6216
|
+
const listviewComponent = $(".steedos-object-listview .antd-Table-table");
|
|
6217
|
+
const firstListviewComponent = listviewComponent && listviewComponent[0];
|
|
6218
|
+
if(firstListviewComponent){
|
|
6219
|
+
setTimeout(()=>{
|
|
6220
|
+
firstListviewComponent.scrollIntoView();
|
|
6221
|
+
}, 600);
|
|
6222
|
+
}
|
|
6223
|
+
}
|
|
6173
6224
|
${options.adaptor || ''}
|
|
6174
6225
|
return payload;
|
|
6175
6226
|
`;
|
|
@@ -6281,12 +6332,21 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
6281
6332
|
}
|
|
6282
6333
|
payload.data = data;
|
|
6283
6334
|
payload.data.__objectName = "${object.name}";
|
|
6284
|
-
payload.data.
|
|
6335
|
+
payload.data.record = record;
|
|
6336
|
+
|
|
6337
|
+
payload.data.NAME_FIELD_VALUE = record.${object.NAME_FIELD_KEY || 'name'};
|
|
6338
|
+
payload.data._master = {
|
|
6339
|
+
record: record,
|
|
6340
|
+
objectName: "${object.name}",
|
|
6341
|
+
recordId: record._id
|
|
6342
|
+
}
|
|
6285
6343
|
window.postMessage(Object.assign({type: "record.loaded"}, {record: record}), "*")
|
|
6286
6344
|
}
|
|
6287
6345
|
if(payload.errors){
|
|
6288
6346
|
payload.status = 2;
|
|
6289
6347
|
payload.msg = payload.errors[0].message;
|
|
6348
|
+
}else{
|
|
6349
|
+
payload.data.recordLoaded = true;
|
|
6290
6350
|
}
|
|
6291
6351
|
${options && options.initApiAdaptor || ''}
|
|
6292
6352
|
return payload;
|
|
@@ -6429,7 +6489,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
6429
6489
|
cache: API_CACHE,
|
|
6430
6490
|
requestAdaptor: `
|
|
6431
6491
|
// 所有不想在network请求中发送的数据都应该从data中分离出来,data变量只需要留下query才需要发送出去
|
|
6432
|
-
var { recordId, objectName, uiSchema, global, context, ...data} = api.data;
|
|
6492
|
+
var { recordId, objectName, uiSchema, global, context, _master, ...data} = api.data;
|
|
6433
6493
|
if(!recordId){
|
|
6434
6494
|
// 新建则不请求任何数据
|
|
6435
6495
|
data.query = "{data:" + objectName + "(filters: " + JSON.stringify(["_id", "=", null]) + ", top: 1){_id}}";
|
|
@@ -6507,10 +6567,11 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
6507
6567
|
...initialValues
|
|
6508
6568
|
}
|
|
6509
6569
|
${options.initApiAdaptor || ''}
|
|
6570
|
+
// console.log('getEditFormInitApi======>', payload);
|
|
6510
6571
|
return payload;
|
|
6511
6572
|
`,
|
|
6512
6573
|
responseData: {
|
|
6513
|
-
|
|
6574
|
+
"&": "$$",
|
|
6514
6575
|
editFormInited: true
|
|
6515
6576
|
},
|
|
6516
6577
|
data: data,
|
|
@@ -6549,6 +6610,18 @@ function getBatchDelete(objectName){
|
|
|
6549
6610
|
return {
|
|
6550
6611
|
method: 'post',
|
|
6551
6612
|
url: getApi$2(),
|
|
6613
|
+
adaptor: `
|
|
6614
|
+
if(payload.errors){
|
|
6615
|
+
payload.data.deleteErrorMessage = [];
|
|
6616
|
+
payload.errors.forEach(function(error){
|
|
6617
|
+
let errorRecord = error.path.map(function (item) {
|
|
6618
|
+
return item.split('delete__')[1].to_float() + 1;
|
|
6619
|
+
}).toString();
|
|
6620
|
+
payload.data.deleteErrorMessage.push("第" + errorRecord + "条记录删除出现异常,报错信息为(" + (window.t ? window.t(error.message) : error.message) + ")");
|
|
6621
|
+
})
|
|
6622
|
+
}
|
|
6623
|
+
return payload;
|
|
6624
|
+
`,
|
|
6552
6625
|
requestAdaptor: `
|
|
6553
6626
|
var ids = api.data.ids.split(",");
|
|
6554
6627
|
var deleteArray = [];
|
|
@@ -7343,7 +7416,7 @@ async function getListBody(fields, options){
|
|
|
7343
7416
|
|
|
7344
7417
|
function getDefaultParams(options){
|
|
7345
7418
|
return {
|
|
7346
|
-
perPage: options.top || options.perPage ||
|
|
7419
|
+
perPage: options.top || options.perPage || 20
|
|
7347
7420
|
}
|
|
7348
7421
|
}
|
|
7349
7422
|
|
|
@@ -7546,7 +7619,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
7546
7619
|
"objectApiName": "\${objectName}",
|
|
7547
7620
|
"recordId": "",
|
|
7548
7621
|
"mode": "edit",
|
|
7549
|
-
"layout": "normal"
|
|
7550
7622
|
};
|
|
7551
7623
|
|
|
7552
7624
|
if (payload && payload.schema) {
|
|
@@ -8251,7 +8323,7 @@ const StandardButtons = {
|
|
|
8251
8323
|
}
|
|
8252
8324
|
};
|
|
8253
8325
|
|
|
8254
|
-
const getGlobalData
|
|
8326
|
+
const getGlobalData = () => {
|
|
8255
8327
|
return {
|
|
8256
8328
|
now: new Date(),
|
|
8257
8329
|
};
|
|
@@ -8310,7 +8382,7 @@ const getButtonVisible = (button, ctx) => {
|
|
|
8310
8382
|
button._visible,
|
|
8311
8383
|
props.record,
|
|
8312
8384
|
"#",
|
|
8313
|
-
getGlobalData
|
|
8385
|
+
getGlobalData(),
|
|
8314
8386
|
props.userSession
|
|
8315
8387
|
);
|
|
8316
8388
|
};
|
|
@@ -9688,6 +9760,48 @@ function getObjectListHeader$1(objectSchema, listViewName, ctx) {
|
|
|
9688
9760
|
return headerSchema;
|
|
9689
9761
|
}
|
|
9690
9762
|
|
|
9763
|
+
function getBackButtonSchema(){
|
|
9764
|
+
return {
|
|
9765
|
+
"type": "service",
|
|
9766
|
+
"onEvent": {
|
|
9767
|
+
"@history_paths.changed": {
|
|
9768
|
+
"actions": [
|
|
9769
|
+
{
|
|
9770
|
+
"actionType": "reload",
|
|
9771
|
+
// amis 3.6需要传入data来触发下面的window:historyPaths重新计算,此问题随机偶发,加上data后正常
|
|
9772
|
+
"data": {
|
|
9773
|
+
}
|
|
9774
|
+
}
|
|
9775
|
+
]
|
|
9776
|
+
}
|
|
9777
|
+
},
|
|
9778
|
+
"body":[{
|
|
9779
|
+
"type": "button",
|
|
9780
|
+
"visibleOn": "${window:innerWidth > 768 && (window:historyPaths.length > 1 || window:historyPaths[0].params.record_id) && display !== 'split'}",
|
|
9781
|
+
"className":"flex mr-4",
|
|
9782
|
+
"onEvent": {
|
|
9783
|
+
"click": {
|
|
9784
|
+
"actions": [
|
|
9785
|
+
{
|
|
9786
|
+
"actionType": "custom",
|
|
9787
|
+
"script": "window.goBack()"
|
|
9788
|
+
}
|
|
9789
|
+
]
|
|
9790
|
+
}
|
|
9791
|
+
},
|
|
9792
|
+
"body": [
|
|
9793
|
+
{
|
|
9794
|
+
"type": "steedos-icon",
|
|
9795
|
+
"category": "utility",
|
|
9796
|
+
"name": "back",
|
|
9797
|
+
"colorVariant": "default",
|
|
9798
|
+
"className": "slds-button_icon slds-global-header__icon w-4"
|
|
9799
|
+
}
|
|
9800
|
+
]
|
|
9801
|
+
}]
|
|
9802
|
+
}
|
|
9803
|
+
}
|
|
9804
|
+
|
|
9691
9805
|
/**
|
|
9692
9806
|
* 记录详细界面顶部头amisSchema,也是标题面板组件的amisSchema
|
|
9693
9807
|
* @param {*} objectSchema 对象UISchema
|
|
@@ -9696,11 +9810,21 @@ function getObjectListHeader$1(objectSchema, listViewName, ctx) {
|
|
|
9696
9810
|
* @returns amisSchema
|
|
9697
9811
|
*/
|
|
9698
9812
|
async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
9813
|
+
// console.log(`getObjectRecordDetailHeader====>`, options)
|
|
9699
9814
|
const { showRecordTitle = true } = options || {};
|
|
9700
9815
|
// console.log('getObjectRecordDetailHeader==>', objectSchema, recordId)
|
|
9701
9816
|
const { name, label, icon, NAME_FIELD_KEY } = objectSchema;
|
|
9702
9817
|
|
|
9703
|
-
let amisButtonsSchema =
|
|
9818
|
+
let amisButtonsSchema = [];
|
|
9819
|
+
if(options.showButtons != false){
|
|
9820
|
+
amisButtonsSchema = getObjectDetailButtonsSchemas(objectSchema, recordId, options);
|
|
9821
|
+
}
|
|
9822
|
+
|
|
9823
|
+
let backButtonsSchema = null;
|
|
9824
|
+
|
|
9825
|
+
if(options.showBackButton != false){
|
|
9826
|
+
backButtonsSchema = getBackButtonSchema();
|
|
9827
|
+
}
|
|
9704
9828
|
|
|
9705
9829
|
// console.log(`getObjectRecordDetailHeader==>`, amisButtonsSchema)
|
|
9706
9830
|
|
|
@@ -9715,45 +9839,9 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
9715
9839
|
"type": "grid",
|
|
9716
9840
|
"columns": [
|
|
9717
9841
|
{
|
|
9718
|
-
"body": [
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
"@history_paths.changed": {
|
|
9722
|
-
"actions": [
|
|
9723
|
-
{
|
|
9724
|
-
"actionType": "reload",
|
|
9725
|
-
// amis 3.6需要传入data来触发下面的window:historyPaths重新计算,此问题随机偶发,加上data后正常
|
|
9726
|
-
"data": {
|
|
9727
|
-
}
|
|
9728
|
-
}
|
|
9729
|
-
]
|
|
9730
|
-
}
|
|
9731
|
-
},
|
|
9732
|
-
"body":[{
|
|
9733
|
-
"type": "button",
|
|
9734
|
-
"visibleOn": "${window:innerWidth > 768 && (window:historyPaths.length > 1 || window:historyPaths[0].params.record_id) && display !== 'split'}",
|
|
9735
|
-
"className":"flex mr-4",
|
|
9736
|
-
"onEvent": {
|
|
9737
|
-
"click": {
|
|
9738
|
-
"actions": [
|
|
9739
|
-
{
|
|
9740
|
-
"actionType": "custom",
|
|
9741
|
-
"script": "window.goBack()"
|
|
9742
|
-
}
|
|
9743
|
-
]
|
|
9744
|
-
}
|
|
9745
|
-
},
|
|
9746
|
-
"body": [
|
|
9747
|
-
{
|
|
9748
|
-
"type": "steedos-icon",
|
|
9749
|
-
"category": "utility",
|
|
9750
|
-
"name": "back",
|
|
9751
|
-
"colorVariant": "default",
|
|
9752
|
-
"className": "slds-button_icon slds-global-header__icon w-4"
|
|
9753
|
-
}
|
|
9754
|
-
]
|
|
9755
|
-
}]
|
|
9756
|
-
},{
|
|
9842
|
+
"body": [
|
|
9843
|
+
backButtonsSchema
|
|
9844
|
+
,{
|
|
9757
9845
|
"type": "tpl",
|
|
9758
9846
|
"className": "block",
|
|
9759
9847
|
// "tpl": `<img class='slds-icon slds-icon_container slds-icon-standard-${standardIcon}' src='\${context.rootUrl}/unpkg.com/@salesforce-ux/design-system/assets/icons/standard/${icon}.svg'>`
|
|
@@ -9774,8 +9862,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
9774
9862
|
},
|
|
9775
9863
|
{
|
|
9776
9864
|
"type": "tpl",
|
|
9777
|
-
"tpl": "${
|
|
9778
|
-
// "tpl": "${(record && uiSchema && record[uiSchema.NAME_FIELD_KEY]) || name}",
|
|
9865
|
+
"tpl": "${NAME_FIELD_VALUE}",
|
|
9779
9866
|
"inline": false,
|
|
9780
9867
|
"wrapperComponent": "",
|
|
9781
9868
|
"className": "record-detail-header-name leading-5 text-xl font-bold"
|
|
@@ -9803,7 +9890,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
9803
9890
|
let body = [
|
|
9804
9891
|
{
|
|
9805
9892
|
"type": "wrapper",
|
|
9806
|
-
"className": "p-
|
|
9893
|
+
"className": "p-4 bg-gray-100 border-b",
|
|
9807
9894
|
"body": [
|
|
9808
9895
|
{
|
|
9809
9896
|
"type": "grid",
|
|
@@ -9818,7 +9905,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
9818
9905
|
if(showRecordTitle){
|
|
9819
9906
|
body.push({
|
|
9820
9907
|
"type": "wrapper",
|
|
9821
|
-
"className": "p-
|
|
9908
|
+
"className": "p-4",
|
|
9822
9909
|
"body": [
|
|
9823
9910
|
{
|
|
9824
9911
|
"type": "grid",
|
|
@@ -9830,11 +9917,76 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
9830
9917
|
});
|
|
9831
9918
|
}
|
|
9832
9919
|
|
|
9920
|
+
let max = 10;
|
|
9921
|
+
if(options.formFactor === 'SMALL'){
|
|
9922
|
+
max = 4;
|
|
9923
|
+
}else {
|
|
9924
|
+
|
|
9925
|
+
let divWidth = window.innerWidth;
|
|
9926
|
+
|
|
9927
|
+
if(options.display === 'split'){
|
|
9928
|
+
divWidth = divWidth - 388;
|
|
9929
|
+
}
|
|
9930
|
+
|
|
9931
|
+
if(document.body.classList.contains('sidebar')){
|
|
9932
|
+
divWidth = divWidth - 210;
|
|
9933
|
+
}
|
|
9934
|
+
|
|
9935
|
+
// 根据屏幕宽度计算显示数量, 使高亮字段只占1行
|
|
9936
|
+
max = Math.trunc(divWidth / 200 );
|
|
9937
|
+
if(max > 10){
|
|
9938
|
+
max = 10;
|
|
9939
|
+
}
|
|
9940
|
+
}
|
|
9941
|
+
|
|
9942
|
+
// console.log('=======================max=========================', max)
|
|
9943
|
+
|
|
9944
|
+
if(objectSchema.compactLayouts){
|
|
9945
|
+
const details = [];
|
|
9946
|
+
_.each(_.slice(_.difference(objectSchema.compactLayouts, [objectSchema.NAME_FIELD_KEY]), 0, max), (fieldName)=>{
|
|
9947
|
+
const field = objectSchema.fields[fieldName];
|
|
9948
|
+
if(field){
|
|
9949
|
+
details.push({
|
|
9950
|
+
type: 'steedos-field',
|
|
9951
|
+
static: true,
|
|
9952
|
+
config: field,
|
|
9953
|
+
});
|
|
9954
|
+
}
|
|
9955
|
+
});
|
|
9956
|
+
|
|
9957
|
+
// 注意: 以下注释不能删除. tailwind css 动态编译时会识别以下注释, 生成对应的样式
|
|
9958
|
+
// lg:grid-cols-1
|
|
9959
|
+
// lg:grid-cols-2
|
|
9960
|
+
// lg:grid-cols-3
|
|
9961
|
+
// lg:grid-cols-4
|
|
9962
|
+
// lg:grid-cols-5
|
|
9963
|
+
// lg:grid-cols-6
|
|
9964
|
+
// lg:grid-cols-7
|
|
9965
|
+
// lg:grid-cols-8
|
|
9966
|
+
// lg:grid-cols-9
|
|
9967
|
+
// lg:grid-cols-10
|
|
9968
|
+
// lg:grid-cols-11
|
|
9969
|
+
// lg:grid-cols-12
|
|
9970
|
+
|
|
9971
|
+
body.push({
|
|
9972
|
+
"type": "wrapper",
|
|
9973
|
+
"body": {
|
|
9974
|
+
"type": "form",
|
|
9975
|
+
// "className": "gap-2 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-5 3xl:grid-cols-8 4xl:grid-cols-8 5xl:grid-cols-10", //max-h-12 overflow-hidden
|
|
9976
|
+
"className": `gap-2 grid grid-cols-1 lg:grid-cols-${max}`,
|
|
9977
|
+
"wrapWithPanel": false,
|
|
9978
|
+
"actions": [],
|
|
9979
|
+
"body": details,
|
|
9980
|
+
"hiddenOn": "${recordLoaded != true}"
|
|
9981
|
+
},
|
|
9982
|
+
"className": "steedos-record-compact-layouts p-4 bg-white compact-layouts border-b"
|
|
9983
|
+
});
|
|
9984
|
+
}
|
|
9985
|
+
|
|
9833
9986
|
return {
|
|
9834
9987
|
type: 'service',
|
|
9835
9988
|
id: `page_readonly_${name}_header`,
|
|
9836
9989
|
name: `page`,
|
|
9837
|
-
data: { objectName: name, _id: recordId, recordPermissions: objectSchema.permissions, uiSchema: objectSchema, record: "${record}" },
|
|
9838
9990
|
body: body,
|
|
9839
9991
|
className: ''
|
|
9840
9992
|
}
|
|
@@ -9906,7 +10058,7 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
9906
10058
|
"className": "flex justify-between"
|
|
9907
10059
|
}
|
|
9908
10060
|
],
|
|
9909
|
-
"className": "
|
|
10061
|
+
"className": "steedos-record-related-header py-2 px-0"
|
|
9910
10062
|
};
|
|
9911
10063
|
return recordRelatedListHeader;
|
|
9912
10064
|
}
|
|
@@ -10891,14 +11043,14 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
|
10891
11043
|
{
|
|
10892
11044
|
"type": "button",
|
|
10893
11045
|
"label": instance.t('frontend_display_type_is_table'),
|
|
10894
|
-
"onClick": "const key = 'tab_"+objectName+"_display';
|
|
11046
|
+
"onClick": "const key = 'tab_"+objectName+"_display';sessionStorage.setItem(key, 'grid');let url = document.location.pathname; var urlSearch = new URLSearchParams(document.location.search); if(urlSearch.get(\"side_object\") && urlSearch.get(\"side_listview_id\")){url=`/app/${props.data.appId}/${urlSearch.get(\"side_object\")}/grid/${urlSearch.get(\"side_listview_id\")}`;}; props.env.jumpTo(url + '?display=grid');",
|
|
10895
11047
|
"rightIcon": displayAs != 'split' ? "fa fa-check" : null,
|
|
10896
11048
|
"rightIconClassName": "m-l-sm"
|
|
10897
11049
|
},
|
|
10898
11050
|
{
|
|
10899
11051
|
"type": "button",
|
|
10900
11052
|
"label": instance.t('frontend_display_type_is_split'),
|
|
10901
|
-
"onClick": "const key = 'tab_"+objectName+"_display';
|
|
11053
|
+
"onClick": "const key = 'tab_"+objectName+"_display';sessionStorage.setItem(key, 'split');const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
|
|
10902
11054
|
"rightIcon": displayAs === 'split' ? "fa fa-check" : null,
|
|
10903
11055
|
"rightIconClassName": "m-l-sm"
|
|
10904
11056
|
}
|
|
@@ -11041,7 +11193,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
11041
11193
|
{
|
|
11042
11194
|
"type": "search-box",
|
|
11043
11195
|
"name": keywordsSearchBoxName,
|
|
11044
|
-
"placeholder": "
|
|
11196
|
+
"placeholder": "快捷搜索",
|
|
11045
11197
|
"value": crudKeywords,
|
|
11046
11198
|
// "clearable": true,//因为清除并不会触发失去焦点事件,只有禁用,但是它会触发change事件,所以等升级到amis 3.4+后可以重新放开
|
|
11047
11199
|
"clearAndSubmit": true,
|
|
@@ -11245,7 +11397,10 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
11245
11397
|
// ]
|
|
11246
11398
|
if(options.displayAs === 'split'){
|
|
11247
11399
|
return [
|
|
11248
|
-
|
|
11400
|
+
{
|
|
11401
|
+
"type": "switch-per-page",
|
|
11402
|
+
"visibleOn": "${count >= 20}"
|
|
11403
|
+
},
|
|
11249
11404
|
{
|
|
11250
11405
|
"type": "pagination",
|
|
11251
11406
|
"maxButtons": 5,
|
|
@@ -11267,7 +11422,6 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
11267
11422
|
else {
|
|
11268
11423
|
if(options && options.isRelated){
|
|
11269
11424
|
return [
|
|
11270
|
-
"statistics",
|
|
11271
11425
|
{
|
|
11272
11426
|
"type": "pagination",
|
|
11273
11427
|
"maxButtons": 10,
|
|
@@ -11280,7 +11434,6 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
11280
11434
|
const no_pagination = mainObject.paging && (mainObject.paging.enabled === false);
|
|
11281
11435
|
const is_lookup = options.isLookup;
|
|
11282
11436
|
const commonConfig = [
|
|
11283
|
-
"statistics",
|
|
11284
11437
|
{
|
|
11285
11438
|
"type": "pagination",
|
|
11286
11439
|
"maxButtons": 10,
|
|
@@ -11291,7 +11444,10 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
11291
11444
|
if (no_pagination && is_lookup) {
|
|
11292
11445
|
return commonConfig;
|
|
11293
11446
|
} else {
|
|
11294
|
-
return [
|
|
11447
|
+
return [{
|
|
11448
|
+
"type": "switch-per-page",
|
|
11449
|
+
"visibleOn": "${count >= 20}"
|
|
11450
|
+
}, ...commonConfig];
|
|
11295
11451
|
}
|
|
11296
11452
|
}
|
|
11297
11453
|
}
|
|
@@ -11399,6 +11555,29 @@ function getBulkActions(objectSchema){
|
|
|
11399
11555
|
"className": "hidden",
|
|
11400
11556
|
"id": "batchDelete",
|
|
11401
11557
|
"api": getBatchDelete(objectSchema.name),
|
|
11558
|
+
"feedback": {
|
|
11559
|
+
"title": "删除警告",
|
|
11560
|
+
"visibleOn": "${deleteErrorMessage}",
|
|
11561
|
+
"body": [
|
|
11562
|
+
{
|
|
11563
|
+
"type": "each",
|
|
11564
|
+
"name": "deleteErrorMessage",
|
|
11565
|
+
"items": {
|
|
11566
|
+
"type": "alert",
|
|
11567
|
+
"body": "${item}",
|
|
11568
|
+
"level": "danger",
|
|
11569
|
+
"className": "mb-3"
|
|
11570
|
+
}
|
|
11571
|
+
}
|
|
11572
|
+
],
|
|
11573
|
+
"actions": [
|
|
11574
|
+
{
|
|
11575
|
+
"type": "button",
|
|
11576
|
+
"actionType": "close",
|
|
11577
|
+
"label": "关闭"
|
|
11578
|
+
}
|
|
11579
|
+
]
|
|
11580
|
+
}
|
|
11402
11581
|
}
|
|
11403
11582
|
// {
|
|
11404
11583
|
// "label": "批量修改",
|
|
@@ -11545,6 +11724,10 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11545
11724
|
const rowsDiff = _.cloneDeep(api.data.rowsDiff);
|
|
11546
11725
|
rowsDiff.forEach(function (item, index) {
|
|
11547
11726
|
for(key in item){
|
|
11727
|
+
// image、select等字段清空值后保存的空字符串转换为null。
|
|
11728
|
+
if(item[key] === ''){
|
|
11729
|
+
item[key] = null;
|
|
11730
|
+
}
|
|
11548
11731
|
if(_.includes(imageNames, key)){
|
|
11549
11732
|
if(typeof item[key] == "string"){
|
|
11550
11733
|
const match = item[key].match(/\\/([^\\/]+)$/);
|
|
@@ -11591,7 +11774,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11591
11774
|
// "is-steedos-crud-data-empty": "${!items || COUNT(items) == 0}"
|
|
11592
11775
|
// },
|
|
11593
11776
|
bodyClassName: {
|
|
11594
|
-
"
|
|
11777
|
+
"mb-0": true,
|
|
11595
11778
|
"is-steedos-crud-data-empty": "${!items || COUNT(items) == 0}"
|
|
11596
11779
|
},
|
|
11597
11780
|
crudClassName: crudClassName,
|
|
@@ -11611,7 +11794,9 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11611
11794
|
return payload;
|
|
11612
11795
|
`
|
|
11613
11796
|
},
|
|
11614
|
-
rowClassNameExpr
|
|
11797
|
+
// 外层data发生变化的时候, 不会重新渲染rowClassNameExpr, 所以先用css标记tr唯一标识
|
|
11798
|
+
// 使用表达式给tr添加初始选中状态
|
|
11799
|
+
rowClassNameExpr: options.rowClassNameExpr || "<%= data._id === data.recordId ? 'steedos-record-tr steedos-record-tr-' + data._id + ' steedos-record-selected' : 'steedos-record-tr steedos-record-tr-' + data._id %>"
|
|
11615
11800
|
}, bodyProps);
|
|
11616
11801
|
|
|
11617
11802
|
}
|
|
@@ -11626,7 +11811,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11626
11811
|
|
|
11627
11812
|
if(body.columns && options.formFactor != 'SMALL'){
|
|
11628
11813
|
//将_display放入crud的columns的倒数第二列中(最后一列会影响固定列),可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
11629
|
-
body.columns.splice(body.columns.length -
|
|
11814
|
+
body.columns.splice(body.columns.length -1 , 0, {name: '_display',type: 'static', width: 1, placeholder: "",id: objectSchema.name + "_display_${_index}", tpl: "${''}"});
|
|
11630
11815
|
}
|
|
11631
11816
|
|
|
11632
11817
|
if (defaults) {
|
|
@@ -11684,11 +11869,6 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11684
11869
|
}
|
|
11685
11870
|
}
|
|
11686
11871
|
|
|
11687
|
-
const getGlobalData = (mode)=>{
|
|
11688
|
-
const user = getSteedosAuth();
|
|
11689
|
-
return {mode: mode, user: user, spaceId: user.spaceId, userId: user.userId}
|
|
11690
|
-
};
|
|
11691
|
-
|
|
11692
11872
|
const getFormFields$1 = (objectSchema, formProps)=>{
|
|
11693
11873
|
/**
|
|
11694
11874
|
* fieldsExtend: 重写字段定义
|
|
@@ -11750,7 +11930,7 @@ async function getFormSchemaWithDataFilter(form, options = {}){
|
|
|
11750
11930
|
}
|
|
11751
11931
|
|
|
11752
11932
|
async function getObjectForm(objectSchema, ctx){
|
|
11753
|
-
const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "
|
|
11933
|
+
const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign, tabId, appId, defaults, submitSuccActions = [],
|
|
11754
11934
|
formDataFilter, onFormDataFilter, amisData, env } = ctx;
|
|
11755
11935
|
const fields = _$1__default["default"].values(objectSchema.fields);
|
|
11756
11936
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
@@ -11766,9 +11946,7 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
11766
11946
|
id: `service_${formSchema.id}`,
|
|
11767
11947
|
className: 'p-0',
|
|
11768
11948
|
name: `page_edit_${recordId}`,
|
|
11769
|
-
api: await getEditFormInitApi(objectSchema, recordId, fields, ctx),
|
|
11770
11949
|
data:{
|
|
11771
|
-
editFormInited: false,
|
|
11772
11950
|
...amisData
|
|
11773
11951
|
},
|
|
11774
11952
|
// data: {global: getGlobalData('edit'), recordId: recordId, objectName: objectSchema.name, context: {rootUrl: getRootUrl(), tenantId: getTenantId(), authToken: getAuthToken()}},
|
|
@@ -11777,8 +11955,9 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
11777
11955
|
body: [defaultsDeep({}, formSchema, {
|
|
11778
11956
|
type: "form",
|
|
11779
11957
|
mode: layout,
|
|
11958
|
+
initApi: await getEditFormInitApi(objectSchema, recordId, fields, ctx),
|
|
11780
11959
|
data: {
|
|
11781
|
-
|
|
11960
|
+
editFormInited: false,
|
|
11782
11961
|
},
|
|
11783
11962
|
labelAlign,
|
|
11784
11963
|
persistData: false,
|
|
@@ -11792,11 +11971,15 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
11792
11971
|
submitText: "", // amis 表单不显示提交按钮, 表单提交由项目代码接管
|
|
11793
11972
|
api: await getSaveApi(objectSchema, recordId, fields, ctx),
|
|
11794
11973
|
initFetch: recordId != 'new',
|
|
11795
|
-
body:
|
|
11974
|
+
body: {
|
|
11975
|
+
type: 'wrapper',
|
|
11976
|
+
className: 'p-0 m-0',
|
|
11977
|
+
body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups})),
|
|
11978
|
+
hiddenOn: "${editFormInited != true}",
|
|
11979
|
+
},
|
|
11796
11980
|
panelClassName:'m-0 sm:rounded-lg shadow-none border-none',
|
|
11797
11981
|
bodyClassName: 'p-0',
|
|
11798
11982
|
className: 'steedos-amis-form',
|
|
11799
|
-
hiddenOn: "${editFormInited != true}",
|
|
11800
11983
|
onEvent: {
|
|
11801
11984
|
"submitSucc": {
|
|
11802
11985
|
"weight": 0,
|
|
@@ -11841,7 +12024,7 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
11841
12024
|
}
|
|
11842
12025
|
|
|
11843
12026
|
async function getObjectDetail(objectSchema, recordId, ctx){
|
|
11844
|
-
const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "
|
|
12027
|
+
const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign,
|
|
11845
12028
|
formDataFilter, onFormDataFilter, amisData, env } = ctx;
|
|
11846
12029
|
const fields = _$1__default["default"].values(objectSchema.fields);
|
|
11847
12030
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
@@ -11850,8 +12033,7 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
11850
12033
|
type: 'service',
|
|
11851
12034
|
name: `page_readonly_${recordId}`,
|
|
11852
12035
|
id: serviceId,
|
|
11853
|
-
|
|
11854
|
-
api: await getReadonlyFormInitApi(objectSchema, recordId, fields, ctx),
|
|
12036
|
+
// api: await getReadonlyFormInitApi(objectSchema, recordId, fields, ctx),
|
|
11855
12037
|
body: [
|
|
11856
12038
|
{
|
|
11857
12039
|
"type": "wrapper", //form 的 hiddenOn 会导致 form onEvent 异常, 使用wrapper包裹一次form,并在wrapper上控制显隐
|
|
@@ -11877,60 +12059,41 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
11877
12059
|
),
|
|
11878
12060
|
className: 'steedos-amis-form bg-white',
|
|
11879
12061
|
actions: [], // 不显示表单默认的提交按钮
|
|
11880
|
-
onEvent: {
|
|
11881
|
-
[`@data.changed.${objectSchema.name}`]: { // 由于amis service 组件的 onEvent 存在bug ,此处借助form来刷新 上层 service https://github.com/baidu/amis/issues/6294
|
|
11882
|
-
"actions": [
|
|
11883
|
-
{
|
|
11884
|
-
"actionType": "reload",
|
|
11885
|
-
"componentId": serviceId,
|
|
11886
|
-
"expression": "this.__deletedRecord != true"
|
|
11887
|
-
},
|
|
11888
|
-
{
|
|
11889
|
-
// "args": {
|
|
11890
|
-
// "url": "/app/${appId}/${objectName}/grid/${side_listview_id}",
|
|
11891
|
-
// "blank": false
|
|
11892
|
-
// },
|
|
11893
|
-
"actionType": "custom",
|
|
11894
|
-
"script": "window.goBack()",
|
|
11895
|
-
"expression": "this.__deletedRecord === true"
|
|
11896
|
-
}
|
|
11897
|
-
]
|
|
11898
|
-
}
|
|
11899
|
-
}
|
|
11900
12062
|
},
|
|
11901
12063
|
}
|
|
11902
12064
|
],
|
|
11903
|
-
onEvent: {
|
|
11904
|
-
|
|
11905
|
-
|
|
11906
|
-
|
|
11907
|
-
|
|
11908
|
-
|
|
11909
|
-
|
|
11910
|
-
|
|
11911
|
-
|
|
11912
|
-
|
|
11913
|
-
|
|
11914
|
-
|
|
11915
|
-
|
|
11916
|
-
|
|
11917
|
-
|
|
11918
|
-
|
|
11919
|
-
|
|
11920
|
-
|
|
11921
|
-
|
|
11922
|
-
|
|
11923
|
-
|
|
11924
|
-
|
|
11925
|
-
|
|
11926
|
-
|
|
11927
|
-
|
|
11928
|
-
|
|
11929
|
-
|
|
11930
|
-
}
|
|
12065
|
+
// onEvent: {
|
|
12066
|
+
// "fetchInited": {
|
|
12067
|
+
// "weight": 0,
|
|
12068
|
+
// "actions": [
|
|
12069
|
+
// {
|
|
12070
|
+
// actionType: 'broadcast',
|
|
12071
|
+
// eventName: "recordLoaded",
|
|
12072
|
+
// args: {
|
|
12073
|
+
// eventName: "recordLoaded"
|
|
12074
|
+
// },
|
|
12075
|
+
// data: {
|
|
12076
|
+
// objectName: "${event.data.__objectName}",
|
|
12077
|
+
// record: "${event.data.__record}"
|
|
12078
|
+
// },
|
|
12079
|
+
// expression: "${event.data.__response.error != true}"
|
|
12080
|
+
// },
|
|
12081
|
+
// {
|
|
12082
|
+
// "actionType": "setValue",
|
|
12083
|
+
// "args": {
|
|
12084
|
+
// value: {
|
|
12085
|
+
// "recordLoaded": true,
|
|
12086
|
+
// }
|
|
12087
|
+
// },
|
|
12088
|
+
// expression: "${event.data.__response.error != true}"
|
|
12089
|
+
// }
|
|
12090
|
+
// ]
|
|
12091
|
+
// }
|
|
12092
|
+
// }
|
|
11931
12093
|
};
|
|
11932
12094
|
|
|
11933
12095
|
amisSchema.body[0].body = await getFormSchemaWithDataFilter(amisSchema.body[0].body, { formDataFilter, onFormDataFilter, amisData, env });
|
|
12096
|
+
// console.log('getObjectDetail=====>', amisSchema);
|
|
11934
12097
|
return amisSchema;
|
|
11935
12098
|
}
|
|
11936
12099
|
|
|
@@ -12010,8 +12173,8 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
12010
12173
|
/*
|
|
12011
12174
|
* @Author: baozhoutao@steedos.com
|
|
12012
12175
|
* @Date: 2022-07-05 15:55:39
|
|
12013
|
-
* @LastEditors:
|
|
12014
|
-
* @LastEditTime:
|
|
12176
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
12177
|
+
* @LastEditTime: 2024-01-15 10:34:46
|
|
12015
12178
|
* @Description:
|
|
12016
12179
|
*/
|
|
12017
12180
|
|
|
@@ -12186,7 +12349,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
12186
12349
|
setDataToComponentId: componentId,
|
|
12187
12350
|
// tableHiddenOn: hiddenEmptyTable ? "this.$count === 0" : null,
|
|
12188
12351
|
appId: appId,
|
|
12189
|
-
crudClassName: '
|
|
12352
|
+
crudClassName: 'steedos-record-related-crud hidden',
|
|
12190
12353
|
refField,
|
|
12191
12354
|
...ctx
|
|
12192
12355
|
};
|
|
@@ -12199,7 +12362,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
12199
12362
|
amisSchema: {
|
|
12200
12363
|
type: "service",
|
|
12201
12364
|
id: componentId,
|
|
12202
|
-
className: `steedos-record-related-list
|
|
12365
|
+
className: `steedos-record-related-list py-2 first:pt-0 border-b last:border-b-0 ${componentId} ${className}`,
|
|
12203
12366
|
data: {
|
|
12204
12367
|
relatedKey: relatedKey,
|
|
12205
12368
|
listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
|
|
@@ -12391,11 +12554,44 @@ async function getRelatedListSchema(
|
|
|
12391
12554
|
};
|
|
12392
12555
|
}
|
|
12393
12556
|
|
|
12557
|
+
async function getObjectRelatedListsMiniSchema(objectApiName){
|
|
12558
|
+
const relatedLists = await getObjectRelatedList(objectApiName);
|
|
12559
|
+
|
|
12560
|
+
const relatedListsMiniSchema = [];
|
|
12561
|
+
|
|
12562
|
+
for (const relatedList of relatedLists) {
|
|
12563
|
+
relatedListsMiniSchema.push(
|
|
12564
|
+
{
|
|
12565
|
+
type: 'steedos-record-detail-list-mini',
|
|
12566
|
+
objectApiName: objectApiName,
|
|
12567
|
+
// recordId: recordId,
|
|
12568
|
+
formFactor: formFactor,
|
|
12569
|
+
relatedObjectApiName: relatedList.object_name,
|
|
12570
|
+
foreign_key: relatedList.foreign_key,
|
|
12571
|
+
relatedKey: relatedList.foreign_key,
|
|
12572
|
+
columns: relatedList.columns,
|
|
12573
|
+
sort: relatedList.sort,
|
|
12574
|
+
filters: relatedList.filters,
|
|
12575
|
+
visible_on: relatedList.visible_on,
|
|
12576
|
+
perPage: relatedList.page_size || perPage,
|
|
12577
|
+
hiddenEmptyTable: true,
|
|
12578
|
+
relatedLabel: relatedList.label
|
|
12579
|
+
}
|
|
12580
|
+
);
|
|
12581
|
+
}
|
|
12582
|
+
|
|
12583
|
+
return {
|
|
12584
|
+
type: 'wrapper',
|
|
12585
|
+
className: "steedos-record-detail-related-lists-mini",
|
|
12586
|
+
body: relatedListsMiniSchema
|
|
12587
|
+
}
|
|
12588
|
+
}
|
|
12589
|
+
|
|
12394
12590
|
/*
|
|
12395
12591
|
* @Author: baozhoutao@steedos.com
|
|
12396
12592
|
* @Date: 2022-07-05 15:55:39
|
|
12397
|
-
* @LastEditors:
|
|
12398
|
-
* @LastEditTime:
|
|
12593
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
12594
|
+
* @LastEditTime: 2024-01-16 11:14:34
|
|
12399
12595
|
* @Description:
|
|
12400
12596
|
*/
|
|
12401
12597
|
|
|
@@ -12567,7 +12763,7 @@ async function getField(objectName, fieldName) {
|
|
|
12567
12763
|
async function getFormSchema(objectName, ctx) {
|
|
12568
12764
|
const uiSchema = await getUISchema(objectName);
|
|
12569
12765
|
const amisSchema = await getObjectForm(uiSchema, ctx);
|
|
12570
|
-
console.log(`getFormSchema====>`, amisSchema)
|
|
12766
|
+
// console.log(`getFormSchema====>`, amisSchema)
|
|
12571
12767
|
return {
|
|
12572
12768
|
uiSchema,
|
|
12573
12769
|
amisSchema,
|
|
@@ -12893,110 +13089,164 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
12893
13089
|
"label": "对象表单",
|
|
12894
13090
|
"objectApiName": "${objectName}",
|
|
12895
13091
|
"recordId": "${recordId}",
|
|
12896
|
-
"id": "u:d4a495811d57",
|
|
12897
13092
|
appId: appId
|
|
12898
13093
|
}
|
|
12899
13094
|
],
|
|
12900
|
-
"id": "u:5d4e7e3f6ecc"
|
|
12901
13095
|
};
|
|
12902
13096
|
const related = {
|
|
12903
13097
|
"title": instance.t('frontend_record_detail_tab_related'),
|
|
12904
|
-
"className": "px-0
|
|
13098
|
+
"className": "px-0 py-4",
|
|
12905
13099
|
"body": [
|
|
12906
13100
|
{
|
|
12907
13101
|
"type": "steedos-object-related-lists",
|
|
12908
13102
|
"label": "相关列表",
|
|
12909
13103
|
"objectApiName": "${objectName}",
|
|
12910
13104
|
"recordId": "${recordId}",
|
|
12911
|
-
"id": "u:3b85b7b7a7f6",
|
|
12912
13105
|
appId: appId
|
|
12913
13106
|
}
|
|
12914
13107
|
],
|
|
12915
|
-
"id": "u:1a0326aeec2b"
|
|
12916
13108
|
};
|
|
12917
13109
|
const content = {
|
|
12918
13110
|
"type": "tabs",
|
|
12919
|
-
"className": "
|
|
13111
|
+
"className": "steedos-record-tabs bg-white p-4 m-0 mt-2 border-y",
|
|
13112
|
+
"contentClassName": "bg-none",
|
|
12920
13113
|
"tabs": [
|
|
12921
13114
|
detailed
|
|
12922
13115
|
],
|
|
12923
|
-
"id": "u:a649e4094a12"
|
|
12924
13116
|
};
|
|
12925
13117
|
if(relatedLists.length){
|
|
12926
13118
|
content.tabs.push(related);
|
|
12927
13119
|
}
|
|
13120
|
+
// content.tabs = reverse(content.tabs)
|
|
12928
13121
|
return {
|
|
12929
13122
|
uiSchema,
|
|
12930
13123
|
amisSchema: {
|
|
12931
|
-
"type": "service",
|
|
13124
|
+
"type": "steedos-record-service",
|
|
12932
13125
|
"body": [
|
|
12933
13126
|
{
|
|
12934
13127
|
"type": "steedos-record-detail-header",
|
|
12935
13128
|
"label": "标题面板",
|
|
12936
13129
|
"objectApiName": "${objectName}",
|
|
12937
13130
|
"recordId": "${recordId}",
|
|
12938
|
-
"id": "u:48d2c28eb755"
|
|
13131
|
+
"id": "u:48d2c28eb755",
|
|
13132
|
+
"showButtons": props.showButtons,
|
|
13133
|
+
"showBackButton": props.showBackButton,
|
|
12939
13134
|
},
|
|
12940
13135
|
content
|
|
12941
13136
|
],
|
|
12942
|
-
|
|
12943
|
-
|
|
12944
|
-
|
|
12945
|
-
},
|
|
12946
|
-
onEvent: {
|
|
12947
|
-
"recordLoaded": {
|
|
12948
|
-
"actions": [
|
|
12949
|
-
{
|
|
12950
|
-
"actionType": "reload",
|
|
12951
|
-
"data": {
|
|
12952
|
-
"name": `\${record.${uiSchema.NAME_FIELD_KEY || 'name'}}`,
|
|
12953
|
-
"_master.record": `\${record}`,
|
|
12954
|
-
// 不清楚reload 如何给对象下的某个key复制, 所以此处重复设置_master的objectName、recordId
|
|
12955
|
-
"_master.objectName": "${objectName}",
|
|
12956
|
-
"_master.recordId": "${recordId}"
|
|
12957
|
-
}
|
|
12958
|
-
}
|
|
12959
|
-
]
|
|
12960
|
-
},
|
|
12961
|
-
...props.onEvent
|
|
12962
|
-
},
|
|
13137
|
+
"objectApiName": "${objectName}",
|
|
13138
|
+
"recordId": "${recordId}",
|
|
13139
|
+
onEvent: props.onEvent,
|
|
12963
13140
|
}
|
|
12964
13141
|
}
|
|
12965
13142
|
}
|
|
12966
13143
|
|
|
12967
|
-
async function getRecordServiceSchema(objectName, appId, props = {}) {
|
|
13144
|
+
async function getRecordServiceSchema(objectName, appId, props = {}, body) {
|
|
12968
13145
|
const uiSchema = await getUISchema(objectName);
|
|
13146
|
+
const fields = _$1__default["default"].values(uiSchema.fields);
|
|
13147
|
+
const serviceId = `u:steedos-record-service-${objectName}`;
|
|
12969
13148
|
return {
|
|
12970
13149
|
uiSchema,
|
|
12971
13150
|
amisSchema: {
|
|
12972
|
-
|
|
12973
|
-
"
|
|
12974
|
-
data: {
|
|
12975
|
-
"_master.objectName": "${objectName}",
|
|
12976
|
-
"_master.recordId": "${recordId}"
|
|
12977
|
-
},
|
|
12978
|
-
"style": {
|
|
12979
|
-
"padding": "var(--Page-body-padding)",
|
|
12980
|
-
...props.style
|
|
12981
|
-
},
|
|
13151
|
+
type: 'service',
|
|
13152
|
+
className: "p-0 m-0",
|
|
12982
13153
|
onEvent: {
|
|
12983
|
-
|
|
13154
|
+
[`@data.changed.${objectName}`]: {
|
|
12984
13155
|
"actions": [
|
|
12985
13156
|
{
|
|
12986
13157
|
"actionType": "reload",
|
|
12987
|
-
"
|
|
12988
|
-
|
|
12989
|
-
|
|
12990
|
-
|
|
12991
|
-
|
|
12992
|
-
|
|
12993
|
-
|
|
13158
|
+
"componentId": serviceId,
|
|
13159
|
+
"expression": "this.__deletedRecord != true"
|
|
13160
|
+
},
|
|
13161
|
+
{
|
|
13162
|
+
"actionType": "custom",
|
|
13163
|
+
"script": "window.goBack()",
|
|
13164
|
+
"expression": "this.__deletedRecord === true"
|
|
12994
13165
|
}
|
|
12995
13166
|
]
|
|
12996
13167
|
},
|
|
12997
|
-
|
|
13168
|
+
},
|
|
13169
|
+
body: {
|
|
13170
|
+
"type": "service",
|
|
13171
|
+
id: serviceId,
|
|
13172
|
+
className: 'steedos-record-service p-0',
|
|
13173
|
+
api: await getReadonlyFormInitApi(uiSchema, props.recordId, fields, props),
|
|
13174
|
+
body: {
|
|
13175
|
+
"type": "wrapper",
|
|
13176
|
+
"className": "p-0 m-0",
|
|
13177
|
+
"body": body || [],
|
|
13178
|
+
"hiddenOn": "${recordLoaded != true}"
|
|
13179
|
+
},
|
|
13180
|
+
data: {
|
|
13181
|
+
"_master.objectName": "${objectName}",
|
|
13182
|
+
"_master.recordId": "${recordId}",
|
|
13183
|
+
...(props.data || {})
|
|
13184
|
+
},
|
|
13185
|
+
"style": {
|
|
13186
|
+
// "padding": "var(--Page-body-padding)",
|
|
13187
|
+
...props.style
|
|
13188
|
+
},
|
|
13189
|
+
onEvent: {
|
|
13190
|
+
// 如果定义了fetchInited,则无法接收到广播事件@data.changed
|
|
13191
|
+
"fetchInited": {
|
|
13192
|
+
"weight": 0,
|
|
13193
|
+
"actions": [
|
|
13194
|
+
{
|
|
13195
|
+
actionType: 'broadcast',
|
|
13196
|
+
eventName: "recordLoaded",
|
|
13197
|
+
data: {
|
|
13198
|
+
objectName: "${event.data.__objectName}",
|
|
13199
|
+
record: "${event.data.record}"
|
|
13200
|
+
},
|
|
13201
|
+
expression: "${event.data.__response.error != true}"
|
|
13202
|
+
},
|
|
13203
|
+
]
|
|
13204
|
+
},
|
|
13205
|
+
...props.onEvent
|
|
13206
|
+
}
|
|
12998
13207
|
}
|
|
12999
13208
|
}
|
|
13209
|
+
|
|
13210
|
+
|
|
13211
|
+
}
|
|
13212
|
+
}
|
|
13213
|
+
|
|
13214
|
+
async function getRecordDetailMiniSchema(objectName, appId, props = {}){
|
|
13215
|
+
const uiSchema = await getUISchema(objectName);
|
|
13216
|
+
const fields = _$1__default["default"].values(uiSchema.fields);
|
|
13217
|
+
|
|
13218
|
+
props.initApiAdaptor = 'payload.data=Object.assign({}, payload.data, payload.data.record); payload.data._finished=true; console.log("payload data is ====>", payload)';
|
|
13219
|
+
|
|
13220
|
+
// TODO 处理相关表
|
|
13221
|
+
// getObjectRelatedListsMiniSchema
|
|
13222
|
+
|
|
13223
|
+
return {
|
|
13224
|
+
type: "form",
|
|
13225
|
+
wrapWithPanel: false,
|
|
13226
|
+
actions: [],
|
|
13227
|
+
initApi: await getReadonlyFormInitApi(uiSchema, props.recordId, fields, props),
|
|
13228
|
+
body: {
|
|
13229
|
+
"type": "wrapper",
|
|
13230
|
+
"className": "p-0 m-0",
|
|
13231
|
+
"body": [
|
|
13232
|
+
{
|
|
13233
|
+
"type": "steedos-record-detail-header",
|
|
13234
|
+
"showButtons": false,
|
|
13235
|
+
"showBackButton": false,
|
|
13236
|
+
"objectApiName": "${objectName}",
|
|
13237
|
+
"recordId": "${recordId}",
|
|
13238
|
+
},
|
|
13239
|
+
// {
|
|
13240
|
+
// "type": "steedos-object-related-lists",
|
|
13241
|
+
// "label": "相关列表",
|
|
13242
|
+
// "objectApiName": "${objectName}",
|
|
13243
|
+
// "staticRecordId": "${recordId}",
|
|
13244
|
+
// formFactor: "SMALL",
|
|
13245
|
+
// appId: appId
|
|
13246
|
+
// }
|
|
13247
|
+
],
|
|
13248
|
+
"hiddenOn": "${_finished != true}"
|
|
13249
|
+
}
|
|
13000
13250
|
}
|
|
13001
13251
|
}
|
|
13002
13252
|
|
|
@@ -13937,9 +14187,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
13937
14187
|
*/
|
|
13938
14188
|
if(enable_tree){
|
|
13939
14189
|
const rows = _.map(payload.data.rows, (item)=>{
|
|
13940
|
-
|
|
13941
|
-
|
|
13942
|
-
|
|
14190
|
+
if (!item.children) {
|
|
14191
|
+
return { ...item, children: [] };
|
|
14192
|
+
} else {
|
|
14193
|
+
return item;
|
|
14194
|
+
}
|
|
13943
14195
|
})
|
|
13944
14196
|
payload.data.rows = rows;
|
|
13945
14197
|
}
|
|
@@ -14388,9 +14640,17 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
14388
14640
|
}
|
|
14389
14641
|
// console.log(`lookupToAmis====`, field, readonly, ctx)
|
|
14390
14642
|
if(readonly){
|
|
14391
|
-
|
|
14392
|
-
|
|
14393
|
-
|
|
14643
|
+
if(field.reference_to){
|
|
14644
|
+
return {
|
|
14645
|
+
type: 'steedos-field',
|
|
14646
|
+
config: field,
|
|
14647
|
+
static: true
|
|
14648
|
+
}
|
|
14649
|
+
}else {
|
|
14650
|
+
return {
|
|
14651
|
+
type: getAmisStaticFieldType$1('picker', readonly),
|
|
14652
|
+
tpl: getRelatedFieldTpl(field, ctx)
|
|
14653
|
+
}
|
|
14394
14654
|
}
|
|
14395
14655
|
}
|
|
14396
14656
|
if(field.reference_to && !_$1__namespace.isString(field.reference_to) && !readonly){
|
|
@@ -15384,11 +15644,9 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15384
15644
|
if(field.subFields){
|
|
15385
15645
|
convertData = {
|
|
15386
15646
|
type: 'steedos-input-table',
|
|
15387
|
-
showIndex: true,
|
|
15388
15647
|
editable: !readonly,
|
|
15389
15648
|
addable: !readonly,
|
|
15390
15649
|
removable: !readonly,
|
|
15391
|
-
draggable: !readonly,
|
|
15392
15650
|
fields: [],
|
|
15393
15651
|
amis:{
|
|
15394
15652
|
columnsTogglable: false
|
|
@@ -15440,7 +15698,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15440
15698
|
if(field.is_wide || convertData.type === 'group'){
|
|
15441
15699
|
convertData.className = 'col-span-2 m-0';
|
|
15442
15700
|
}else {
|
|
15443
|
-
convertData.className = 'm-
|
|
15701
|
+
convertData.className = 'm-0';
|
|
15444
15702
|
}
|
|
15445
15703
|
if(readonly){
|
|
15446
15704
|
convertData.className = `${convertData.className} border-b`;
|
|
@@ -15465,6 +15723,10 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15465
15723
|
}
|
|
15466
15724
|
}
|
|
15467
15725
|
|
|
15726
|
+
if(ctx.amisData && ctx.amisData._master && ctx.amisData._master.relatedKey === field.name){
|
|
15727
|
+
convertData.className = `${convertData.className || ''} hidden`;
|
|
15728
|
+
}
|
|
15729
|
+
|
|
15468
15730
|
if(_$1__namespace.isString(baseData.required)){
|
|
15469
15731
|
if(baseData.required.startsWith("{{")){
|
|
15470
15732
|
baseData.requiredOn = `${baseData.required.substring(2, baseData.required.length -2).replace(/formData./g, 'data.')}`;
|
|
@@ -15845,9 +16107,61 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
15845
16107
|
/*
|
|
15846
16108
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
15847
16109
|
* @Date: 2023-11-15 09:50:22
|
|
15848
|
-
* @LastEditors:
|
|
15849
|
-
* @LastEditTime: 2024-01-
|
|
16110
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
16111
|
+
* @LastEditTime: 2024-01-18 10:29:57
|
|
16112
|
+
*/
|
|
16113
|
+
|
|
16114
|
+
/**
|
|
16115
|
+
* 子表组件字段值中每行数据的键值key移除指定前缀
|
|
16116
|
+
* @param {*} value 子表组件字段值,数组
|
|
16117
|
+
* @param {*} fieldPrefix 字段前缀
|
|
16118
|
+
* @returns 转换后的子表组件字段值
|
|
16119
|
+
*/
|
|
16120
|
+
function getTableValueWithoutFieldPrefix(value, fieldPrefix){
|
|
16121
|
+
let convertedValue = [];
|
|
16122
|
+
(value || []).forEach((itemValue)=>{
|
|
16123
|
+
var newItemValue = {};
|
|
16124
|
+
for(let n in itemValue){
|
|
16125
|
+
newItemValue[n.replace(new RegExp(`^${fieldPrefix}`), "")] = itemValue[n];
|
|
16126
|
+
}
|
|
16127
|
+
convertedValue.push(newItemValue);
|
|
16128
|
+
});
|
|
16129
|
+
return convertedValue;
|
|
16130
|
+
}
|
|
16131
|
+
|
|
16132
|
+
/**
|
|
16133
|
+
* 子表组件字段值中每行数据的键值key补上指定前缀
|
|
16134
|
+
* @param {*} value 子表组件字段值,数组
|
|
16135
|
+
* @param {*} fieldPrefix 字段前缀
|
|
16136
|
+
* @returns 转换后的子表组件字段值
|
|
16137
|
+
*/
|
|
16138
|
+
function getTableValuePrependFieldPrefix(value, fieldPrefix){
|
|
16139
|
+
let convertedValue = [];
|
|
16140
|
+
(value || []).forEach((itemValue)=>{
|
|
16141
|
+
var newItemValue = {};
|
|
16142
|
+
for(let n in itemValue){
|
|
16143
|
+
if(typeof itemValue[n] !== undefined){
|
|
16144
|
+
newItemValue[`${fieldPrefix}${n}`] = itemValue[n];
|
|
16145
|
+
}
|
|
16146
|
+
}
|
|
16147
|
+
convertedValue.push(newItemValue);
|
|
16148
|
+
});
|
|
16149
|
+
return convertedValue;
|
|
16150
|
+
}
|
|
16151
|
+
|
|
16152
|
+
/**
|
|
16153
|
+
* 子表组件字段集合属性中每个字段name移除指定前缀
|
|
16154
|
+
* @param {*} fields 子表组件字段集合,数组
|
|
16155
|
+
* @param {*} fieldPrefix 字段前缀
|
|
16156
|
+
* @returns 转换后的子表组件字段值
|
|
15850
16157
|
*/
|
|
16158
|
+
function getTableFieldsWithoutFieldPrefix(fields, fieldPrefix){
|
|
16159
|
+
return (fields || []).map((item) => {
|
|
16160
|
+
const newItem = _$1.clone(item);//这里不clone的话,会造成子表组件重新render,从而审批王那边点开子表行编辑窗口时报错
|
|
16161
|
+
newItem.name = newItem.name.replace(new RegExp(`^${fieldPrefix}`), "");
|
|
16162
|
+
return newItem;
|
|
16163
|
+
});
|
|
16164
|
+
}
|
|
15851
16165
|
|
|
15852
16166
|
/**
|
|
15853
16167
|
* @param {*} props
|
|
@@ -15995,7 +16309,19 @@ function getFormPagination(props, mode) {
|
|
|
15995
16309
|
let currentIndex = event.data.index;
|
|
15996
16310
|
// 翻页到下一页之前需要先把当前页改动的内容保存到中间变量__tableItems中
|
|
15997
16311
|
let currentFormValues = scope.getComponentById(__formId).getValues();
|
|
15998
|
-
|
|
16312
|
+
var parent = event.data.parent;
|
|
16313
|
+
var __parentIndex = event.data.__parentIndex;
|
|
16314
|
+
if(parent){
|
|
16315
|
+
fieldValue[__parentIndex].children[currentIndex] = currentFormValues;
|
|
16316
|
+
// 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
|
|
16317
|
+
fieldValue[__parentIndex] = Object.assign({}, fieldValue[__parentIndex], {
|
|
16318
|
+
children: fieldValue[__parentIndex].children,
|
|
16319
|
+
__fix_rerender_after_children_modified_tag: new Date().getTime()
|
|
16320
|
+
});
|
|
16321
|
+
}
|
|
16322
|
+
else{
|
|
16323
|
+
fieldValue[currentIndex] = currentFormValues;
|
|
16324
|
+
}
|
|
15999
16325
|
// 翻页到下一页前需要同时把改动的内容保存到最终正式的表单字段中,所以额外给正式表单字段执行一次setValue
|
|
16000
16326
|
doAction({
|
|
16001
16327
|
"componentId": "${props.id}",
|
|
@@ -16062,7 +16388,8 @@ function getFormPagination(props, mode) {
|
|
|
16062
16388
|
},
|
|
16063
16389
|
{
|
|
16064
16390
|
"type": "tpl",
|
|
16065
|
-
|
|
16391
|
+
// 这里用__super.parent,加__super是为了防止当前记录有字段名为parent的重名变量
|
|
16392
|
+
"tpl": "${__page}/${__super.parent ? __tableItems[__parentIndex]['children'].length : __tableItems.length}"
|
|
16066
16393
|
},
|
|
16067
16394
|
{
|
|
16068
16395
|
"type": "button",
|
|
@@ -16070,7 +16397,9 @@ function getFormPagination(props, mode) {
|
|
|
16070
16397
|
"icon": `fa fa-angle-right`,
|
|
16071
16398
|
"level": "link",
|
|
16072
16399
|
"pageChangeDirection": "next",
|
|
16073
|
-
"disabledOn": showPagination ? "${__page >= __tableItems.length}" : "true",
|
|
16400
|
+
// "disabledOn": showPagination ? "${__page >= __tableItems.length}" : "true",
|
|
16401
|
+
// 这里用__super.parent,加__super是为了防止当前记录有字段名为parent的重名变量
|
|
16402
|
+
"disabledOn": showPagination ? "${__page >= (__super.parent ? __tableItems[__parentIndex]['children'].length : __tableItems.length)}" : "true",
|
|
16074
16403
|
"size": "sm",
|
|
16075
16404
|
"id": buttonNextId,
|
|
16076
16405
|
"onEvent": {
|
|
@@ -16103,14 +16432,14 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16103
16432
|
"data": {
|
|
16104
16433
|
// 这里加__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
|
|
16105
16434
|
// 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
|
|
16106
|
-
"&": "${__tableItems[__super.index]}"
|
|
16435
|
+
"&": "${__super.parent ? __tableItems[__parentIndex]['children'][__super.index] : __tableItems[__super.index]}"
|
|
16107
16436
|
}
|
|
16108
16437
|
});
|
|
16109
16438
|
let formBody = [
|
|
16110
16439
|
{
|
|
16111
16440
|
"type": "wrapper",
|
|
16112
16441
|
"size": "none",
|
|
16113
|
-
"className": "flex justify-end sticky top-0 right-0 left-0 z-20 bg-white
|
|
16442
|
+
"className": "flex justify-end sticky top-0 right-0 left-0 z-20 bg-white",
|
|
16114
16443
|
"body": [
|
|
16115
16444
|
getFormPagination(props, mode)
|
|
16116
16445
|
]
|
|
@@ -16126,7 +16455,8 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16126
16455
|
}
|
|
16127
16456
|
];
|
|
16128
16457
|
let onServiceInitedScript = `
|
|
16129
|
-
|
|
16458
|
+
|
|
16459
|
+
// 以下脚本解决了有时弹出编辑表单时,表单中的值比最后一次编辑保存的值会延迟一拍。
|
|
16130
16460
|
// 比如:inlineEditMode模式时,用户在表格单元格中直接修改数据,然后弹出的表单form中并没有包含单元格中修改的内容
|
|
16131
16461
|
// 另外有的地方在非inlineEditMode模式时也会有这种延迟一拍问题,比如对象字段中下拉框类型字段的”选择项“属性
|
|
16132
16462
|
// 再比如工作流规则详细页面修改了子表字段”时间触发器“值后,在只读界面点击查看按钮弹出的表单中__tableItems值是修改前的值
|
|
@@ -16139,6 +16469,11 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16139
16469
|
// 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
16140
16470
|
// 这里如果不.clone的话,在弹出窗口中显示的子表组件,添加行后点窗口的取消按钮关闭窗口后无法把之前的操作还原,即把之前添加的行自动移除
|
|
16141
16471
|
let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"] || []);
|
|
16472
|
+
let fieldPrefix = "${props.fieldPrefix}";
|
|
16473
|
+
if(fieldPrefix){
|
|
16474
|
+
let getTableValueWithoutFieldPrefix = new Function('v', 'f', "return (" + ${getTableValueWithoutFieldPrefix.toString()} + ")(v, f)");
|
|
16475
|
+
lastestFieldValue = getTableValueWithoutFieldPrefix(lastestFieldValue, fieldPrefix);
|
|
16476
|
+
}
|
|
16142
16477
|
//不可以直接像event.data.__tableItems = lastestFieldValue; 这样整个赋值,否则作用域会断
|
|
16143
16478
|
let mode = "${mode}";
|
|
16144
16479
|
if(mode === "new"){
|
|
@@ -16161,6 +16496,16 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16161
16496
|
event.data.__tableItems.forEach(function(n,i){
|
|
16162
16497
|
event.data.__tableItems[i] = lastestFieldValue[i];
|
|
16163
16498
|
});
|
|
16499
|
+
|
|
16500
|
+
var parent = event.data.parent;
|
|
16501
|
+
var fieldValue = event.data.__tableItems;
|
|
16502
|
+
if(parent){
|
|
16503
|
+
// 如果是子行,即在节点嵌套情况下,当前节点如果是children属性下的子节点时,则算出其所属父行的索引值
|
|
16504
|
+
var primaryKey = "${props.primaryKey}";
|
|
16505
|
+
event.data.__parentIndex = _.findIndex(fieldValue, function(item){
|
|
16506
|
+
return item[primaryKey] == parent[primaryKey];
|
|
16507
|
+
});
|
|
16508
|
+
}
|
|
16164
16509
|
`;
|
|
16165
16510
|
let schema = {
|
|
16166
16511
|
"type": "service",
|
|
@@ -16181,6 +16526,7 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16181
16526
|
// "body": formBody,
|
|
16182
16527
|
"data": {
|
|
16183
16528
|
"__page": "${index + 1}",
|
|
16529
|
+
"__parentIndex": null,//兼容节点嵌套情况,即节点中有children属性时,这里记录当前节点所属上层节点index,只支持向上找一层,不支持多层
|
|
16184
16530
|
// "__total": `\${${props.name}.length}`,
|
|
16185
16531
|
// "__total": "${__tableItems.length}",
|
|
16186
16532
|
// "__paginationServiceId": serviceId,
|
|
@@ -16228,7 +16574,22 @@ async function getForm(props, mode = "edit", formId) {
|
|
|
16228
16574
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
16229
16575
|
//这里加__super.__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
|
|
16230
16576
|
// 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
|
|
16231
|
-
fieldValue[event.data.__super.__super.index] = JSON.parse(JSON.stringify(event.data));
|
|
16577
|
+
// fieldValue[event.data.__super.__super.index] = JSON.parse(JSON.stringify(event.data));
|
|
16578
|
+
var currentIndex = event.data.__super.__super.index;
|
|
16579
|
+
var currentFormValues = JSON.parse(JSON.stringify(event.data));
|
|
16580
|
+
var parent = event.data.__super.__super.parent;
|
|
16581
|
+
var __parentIndex = event.data.__super.__super.__parentIndex;
|
|
16582
|
+
if(parent){
|
|
16583
|
+
fieldValue[__parentIndex].children[currentIndex] = currentFormValues;
|
|
16584
|
+
// 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
|
|
16585
|
+
fieldValue[__parentIndex] = Object.assign({}, fieldValue[__parentIndex], {
|
|
16586
|
+
children: fieldValue[__parentIndex].children,
|
|
16587
|
+
__fix_rerender_after_children_modified_tag: new Date().getTime()
|
|
16588
|
+
});
|
|
16589
|
+
}
|
|
16590
|
+
else{
|
|
16591
|
+
fieldValue[currentIndex] = currentFormValues;
|
|
16592
|
+
}
|
|
16232
16593
|
doAction({
|
|
16233
16594
|
"componentId": "${props.id}",
|
|
16234
16595
|
"actionType": "setValue",
|
|
@@ -16368,7 +16729,18 @@ async function getButtonActions(props, mode) {
|
|
|
16368
16729
|
let scope = event.context.scoped;
|
|
16369
16730
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
16370
16731
|
// 新建一条空白行并保存到子表组件
|
|
16371
|
-
|
|
16732
|
+
var parent = event.data.__super.parent;
|
|
16733
|
+
var primaryKey = "${props.primaryKey}";
|
|
16734
|
+
var __parentIndex = parent && _.findIndex(fieldValue, function(item){
|
|
16735
|
+
return item[primaryKey] == parent[primaryKey];
|
|
16736
|
+
});
|
|
16737
|
+
if(parent){
|
|
16738
|
+
fieldValue[__parentIndex].children.push({});
|
|
16739
|
+
// 这里实测不需要fieldValue[__parentIndex] = ... 来重写整个父行让子表回显,所以没加相关代码
|
|
16740
|
+
}
|
|
16741
|
+
else{
|
|
16742
|
+
fieldValue.push({});
|
|
16743
|
+
}
|
|
16372
16744
|
doAction({
|
|
16373
16745
|
"componentId": "${props.id}",
|
|
16374
16746
|
"actionType": "setValue",
|
|
@@ -16380,7 +16752,13 @@ async function getButtonActions(props, mode) {
|
|
|
16380
16752
|
let __paginationServiceId = "${formPaginationId}";
|
|
16381
16753
|
let __paginationData = scope.getComponentById(__paginationServiceId).getData();
|
|
16382
16754
|
event.data.index = __paginationData.index;
|
|
16383
|
-
|
|
16755
|
+
if(parent){
|
|
16756
|
+
event.data.__page = fieldValue[__parentIndex].children.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
16757
|
+
event.data.__parentIndex = __parentIndex; //执行下面的翻页按钮事件中依赖了__parentIndex值
|
|
16758
|
+
}
|
|
16759
|
+
else{
|
|
16760
|
+
event.data.__page = fieldValue.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
16761
|
+
}
|
|
16384
16762
|
// 触发翻页按钮事件,实现保存当前页数据并跳转到最后一行
|
|
16385
16763
|
scope.getComponentById(buttonNextId).props.dispatchEvent("click", event.data);
|
|
16386
16764
|
`;
|
|
@@ -16391,7 +16769,19 @@ async function getButtonActions(props, mode) {
|
|
|
16391
16769
|
let newItem = scope.getComponentById(__formId).getValues();//这里不可以用event.data,因为其拿到的是弹出表单时的初始值,不是用户实时填写的数据
|
|
16392
16770
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
16393
16771
|
// 复制当前页数据到新建行并保存到子表组件
|
|
16394
|
-
fieldValue.push(newItem);
|
|
16772
|
+
// fieldValue.push(newItem);
|
|
16773
|
+
var parent = event.data.__super.parent;
|
|
16774
|
+
var primaryKey = "${props.primaryKey}";
|
|
16775
|
+
var __parentIndex = parent && _.findIndex(fieldValue, function(item){
|
|
16776
|
+
return item[primaryKey] == parent[primaryKey];
|
|
16777
|
+
});
|
|
16778
|
+
if(parent){
|
|
16779
|
+
fieldValue[__parentIndex].children.push(newItem);
|
|
16780
|
+
// 这里实测不需要fieldValue[__parentIndex] = ... 来重写整个父行让子表回显,所以没加相关代码
|
|
16781
|
+
}
|
|
16782
|
+
else{
|
|
16783
|
+
fieldValue.push(newItem);
|
|
16784
|
+
}
|
|
16395
16785
|
doAction({
|
|
16396
16786
|
"componentId": "${props.id}",
|
|
16397
16787
|
"actionType": "setValue",
|
|
@@ -16403,7 +16793,13 @@ async function getButtonActions(props, mode) {
|
|
|
16403
16793
|
let __paginationServiceId = "${formPaginationId}";
|
|
16404
16794
|
let __paginationData = scope.getComponentById(__paginationServiceId).getData();
|
|
16405
16795
|
event.data.index = __paginationData.index;
|
|
16406
|
-
|
|
16796
|
+
if(parent){
|
|
16797
|
+
event.data.__page = fieldValue[__parentIndex].children.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
16798
|
+
event.data.__parentIndex = __parentIndex; //执行下面的翻页按钮事件中依赖了__parentIndex值
|
|
16799
|
+
}
|
|
16800
|
+
else{
|
|
16801
|
+
event.data.__page = fieldValue.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
16802
|
+
}
|
|
16407
16803
|
// 触发翻页按钮事件,实现保存当前页数据并跳转到最后一行
|
|
16408
16804
|
scope.getComponentById(buttonNextId).props.dispatchEvent("click", event.data);
|
|
16409
16805
|
`;
|
|
@@ -16479,13 +16875,16 @@ async function getButtonActions(props, mode) {
|
|
|
16479
16875
|
"_master": "${_master}",
|
|
16480
16876
|
"global": "${global}",
|
|
16481
16877
|
"uiSchema": "${uiSchema}",
|
|
16482
|
-
"index": "${index}"
|
|
16878
|
+
"index": "${index}",//amis组件自带行索引,在节点嵌套情况下,当前节点如果是children属性下的子节点时,这里的index是当前节点在children中的索引,而不是外层父节点的index
|
|
16879
|
+
"parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
16483
16880
|
// "__tableItems": `\${${props.name}}`
|
|
16484
16881
|
// 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
|
|
16485
16882
|
// 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
|
|
16486
16883
|
// "__tableItems": `\${${props.name}|json|toJson}`
|
|
16487
|
-
|
|
16488
|
-
|
|
16884
|
+
// 在节点嵌套情况下,当前节点正好是带children属性的节点的话,这里弹出的dialog映射到的会是children数组,这是amis目前的规则,
|
|
16885
|
+
// 所以这里加判断有children时,用__super.__super让映射到正确的作用域层,如果不加,则__tableItems取到的会是children数组,而不是整个子表组件的值
|
|
16886
|
+
"__tableItems": `\${((children ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
|
|
16887
|
+
},
|
|
16489
16888
|
"actions": dialogButtons,
|
|
16490
16889
|
"onEvent": {
|
|
16491
16890
|
"confirm": {
|
|
@@ -16507,35 +16906,39 @@ async function getButtonActions(props, mode) {
|
|
|
16507
16906
|
Object.assign(actionShowEditDialog.dialog, props.dialog);
|
|
16508
16907
|
}
|
|
16509
16908
|
if (mode == "new") {
|
|
16510
|
-
`
|
|
16511
|
-
|
|
16512
|
-
|
|
16513
|
-
|
|
16514
|
-
|
|
16515
|
-
|
|
16516
|
-
|
|
16517
|
-
|
|
16518
|
-
|
|
16519
|
-
|
|
16520
|
-
|
|
16521
|
-
|
|
16522
|
-
|
|
16523
|
-
|
|
16524
|
-
|
|
16525
|
-
|
|
16526
|
-
|
|
16527
|
-
|
|
16528
|
-
|
|
16529
|
-
|
|
16530
|
-
|
|
16531
|
-
|
|
16532
|
-
|
|
16533
|
-
|
|
16534
|
-
|
|
16535
|
-
|
|
16536
|
-
|
|
16537
|
-
|
|
16538
|
-
`;
|
|
16909
|
+
// let onNewLineScript = `
|
|
16910
|
+
// let newItem = {};
|
|
16911
|
+
// if(event.data["${props.name}"]){
|
|
16912
|
+
// // let fieldValue = event.data.__tableItems;
|
|
16913
|
+
// // 这里不用__tableItems是因为新建的时候没有翻页,里面没有也不需要走__tableItems变量
|
|
16914
|
+
// // let fieldValue = _.clone(event.data["${props.name}"]);
|
|
16915
|
+
// let fieldValue = event.data["${props.name}"];
|
|
16916
|
+
// fieldValue.push(newItem);
|
|
16917
|
+
// doAction({
|
|
16918
|
+
// "componentId": "${props.id}",
|
|
16919
|
+
// "actionType": "setValue",
|
|
16920
|
+
// "args": {
|
|
16921
|
+
// "value": fieldValue
|
|
16922
|
+
// }
|
|
16923
|
+
// });
|
|
16924
|
+
// event.data.index = fieldValue.length - 1;
|
|
16925
|
+
// }
|
|
16926
|
+
// else{
|
|
16927
|
+
// // 这里不可以执行event.data["${props.name}"]=[newItem],数据域会断掉
|
|
16928
|
+
// doAction({
|
|
16929
|
+
// "componentId": "${props.id}",
|
|
16930
|
+
// "actionType": "setValue",
|
|
16931
|
+
// "args": {
|
|
16932
|
+
// "value": [newItem]
|
|
16933
|
+
// }
|
|
16934
|
+
// });
|
|
16935
|
+
// event.data.index = 1;
|
|
16936
|
+
// }
|
|
16937
|
+
// `;
|
|
16938
|
+
// let actionNewLine = {
|
|
16939
|
+
// "actionType": "custom",
|
|
16940
|
+
// "script": onNewLineScript
|
|
16941
|
+
// };
|
|
16539
16942
|
// 新增行时不需要在弹出编辑表单前先加一行,因为会在编辑表单所在service初始化时判断到是新增就自动增加一行,因为这里拿不到event.data.__tableItems,也无法变更其值
|
|
16540
16943
|
// actions = [actionNewLine, actionShowEditDialog];
|
|
16541
16944
|
actions = [actionShowEditDialog];
|
|
@@ -16570,15 +16973,17 @@ async function getButtonActions(props, mode) {
|
|
|
16570
16973
|
// 映射到中间变量__parentForm而不是直接用&展开映射是为了避免表单中字段名与作用域中变量重名
|
|
16571
16974
|
// "__parentForm": "${__super.__super || {}}",
|
|
16572
16975
|
"__parentForm": parentFormData,
|
|
16976
|
+
"_master": "${_master}",
|
|
16573
16977
|
"global": "${global}",
|
|
16574
16978
|
"uiSchema": "${uiSchema}",
|
|
16575
16979
|
"index": "${index}",
|
|
16980
|
+
"parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
16576
16981
|
// "__tableItems": `\${${props.name}}`
|
|
16577
16982
|
// 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
|
|
16578
16983
|
// 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
|
|
16579
16984
|
// "__tableItems": `\${${props.name}|json|toJson}`
|
|
16580
|
-
"__tableItems": `\${(
|
|
16581
|
-
|
|
16985
|
+
"__tableItems": `\${((__super.parent ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
|
|
16986
|
+
},
|
|
16582
16987
|
}
|
|
16583
16988
|
}
|
|
16584
16989
|
];
|
|
@@ -16594,7 +16999,23 @@ async function getButtonActions(props, mode) {
|
|
|
16594
16999
|
// 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
16595
17000
|
// 这里_.clone是因为字段设计布局设置分组这种弹出窗口中的子表组件,直接删除后,点取消无法还原
|
|
16596
17001
|
let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"]);
|
|
16597
|
-
|
|
17002
|
+
var currentIndex = event.data.index;
|
|
17003
|
+
var parent = event.data.__super.parent;
|
|
17004
|
+
var primaryKey = "${props.primaryKey}";
|
|
17005
|
+
var __parentIndex = parent && _.findIndex(lastestFieldValue, function(item){
|
|
17006
|
+
return item[primaryKey] == parent[primaryKey];
|
|
17007
|
+
});
|
|
17008
|
+
if(parent){
|
|
17009
|
+
lastestFieldValue[__parentIndex].children.splice(currentIndex, 1);
|
|
17010
|
+
// 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
|
|
17011
|
+
lastestFieldValue[__parentIndex] = Object.assign({}, lastestFieldValue[__parentIndex], {
|
|
17012
|
+
children: lastestFieldValue[__parentIndex].children,
|
|
17013
|
+
__fix_rerender_after_children_modified_tag: new Date().getTime()
|
|
17014
|
+
});
|
|
17015
|
+
}
|
|
17016
|
+
else{
|
|
17017
|
+
lastestFieldValue.splice(currentIndex, 1);
|
|
17018
|
+
}
|
|
16598
17019
|
doAction({
|
|
16599
17020
|
"componentId": "${props.id}",
|
|
16600
17021
|
"actionType": "setValue",
|
|
@@ -16680,39 +17101,53 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
16680
17101
|
if (!props.id) {
|
|
16681
17102
|
props.id = "steedos_input_table_" + props.name + "_" + Math.random().toString(36).substr(2, 9);
|
|
16682
17103
|
}
|
|
17104
|
+
if (!props.primaryKey) {
|
|
17105
|
+
props.primaryKey = "_id";
|
|
17106
|
+
}
|
|
17107
|
+
let showOperation = props.showOperation;
|
|
17108
|
+
if(showOperation !== false){
|
|
17109
|
+
showOperation = true;
|
|
17110
|
+
}
|
|
17111
|
+
// props.fieldPrefix = "project_milestone_";
|
|
17112
|
+
if (props.fieldPrefix) {
|
|
17113
|
+
props.fields = getTableFieldsWithoutFieldPrefix(props.fields, props.fieldPrefix);
|
|
17114
|
+
}
|
|
16683
17115
|
let serviceId = getComponentId("table_service", props.id);
|
|
16684
17116
|
let buttonsForColumnOperations = [];
|
|
16685
17117
|
let inlineEditMode = props.inlineEditMode;
|
|
16686
17118
|
let showAsInlineEditMode = inlineEditMode && props.editable;
|
|
16687
|
-
if
|
|
16688
|
-
|
|
16689
|
-
|
|
16690
|
-
|
|
16691
|
-
|
|
16692
|
-
|
|
16693
|
-
|
|
16694
|
-
|
|
16695
|
-
|
|
16696
|
-
|
|
16697
|
-
|
|
16698
|
-
|
|
17119
|
+
if(showOperation){
|
|
17120
|
+
if (props.editable) {
|
|
17121
|
+
let showEditButton = true;
|
|
17122
|
+
if (showAsInlineEditMode) {
|
|
17123
|
+
// 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
|
|
17124
|
+
showEditButton = true;
|
|
17125
|
+
// // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
|
|
17126
|
+
// if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length) {
|
|
17127
|
+
// showEditButton = true;
|
|
17128
|
+
// }
|
|
17129
|
+
// else {
|
|
17130
|
+
// showEditButton = false;
|
|
17131
|
+
// }
|
|
17132
|
+
}
|
|
17133
|
+
// 编辑时显示编辑按钮
|
|
17134
|
+
if (showEditButton) {
|
|
17135
|
+
let buttonEditSchema = await getButtonEdit(props, showAsInlineEditMode);
|
|
17136
|
+
buttonsForColumnOperations.push(buttonEditSchema);
|
|
17137
|
+
}
|
|
16699
17138
|
}
|
|
16700
|
-
|
|
16701
|
-
|
|
16702
|
-
|
|
16703
|
-
|
|
17139
|
+
else {
|
|
17140
|
+
// 只读时显示查看按钮
|
|
17141
|
+
// 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length)
|
|
17142
|
+
let buttonViewSchema = await getButtonView(props);
|
|
17143
|
+
buttonsForColumnOperations.push(buttonViewSchema);
|
|
17144
|
+
}
|
|
17145
|
+
if (props.removable) {
|
|
17146
|
+
let buttonDeleteSchema = await getButtonDelete(props);
|
|
17147
|
+
buttonsForColumnOperations.push(buttonDeleteSchema);
|
|
16704
17148
|
}
|
|
16705
17149
|
}
|
|
16706
|
-
|
|
16707
|
-
// 只读时显示查看按钮
|
|
16708
|
-
// 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length)
|
|
16709
|
-
let buttonViewSchema = await getButtonView(props);
|
|
16710
|
-
buttonsForColumnOperations.push(buttonViewSchema);
|
|
16711
|
-
}
|
|
16712
|
-
if (props.removable) {
|
|
16713
|
-
let buttonDeleteSchema = await getButtonDelete(props);
|
|
16714
|
-
buttonsForColumnOperations.push(buttonDeleteSchema);
|
|
16715
|
-
}
|
|
17150
|
+
let amis = props["input-table"] || props.amis;//额外支持"input-table"代替amis属性,是因为在字段yml文件中用amis作为key不好理解
|
|
16716
17151
|
let inputTableSchema = {
|
|
16717
17152
|
"type": "input-table",
|
|
16718
17153
|
"label": props.label,
|
|
@@ -16730,8 +17165,37 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
16730
17165
|
"strictMode": props.strictMode,
|
|
16731
17166
|
"showTableAddBtn": false,
|
|
16732
17167
|
"showFooterAddBtn": false,
|
|
16733
|
-
"className": props.tableClassName
|
|
17168
|
+
"className": props.tableClassName,
|
|
17169
|
+
"pipeOut": (value, data) => {
|
|
17170
|
+
value = (value || []).map(function(item){
|
|
17171
|
+
delete item.__fix_rerender_after_children_modified_tag;
|
|
17172
|
+
return item;
|
|
17173
|
+
});
|
|
17174
|
+
if(props.fieldPrefix){
|
|
17175
|
+
value = getTableValuePrependFieldPrefix(value, props.fieldPrefix);
|
|
17176
|
+
}
|
|
17177
|
+
if(amis.pipeOut){
|
|
17178
|
+
if(typeof amis.pipeOut === 'function'){
|
|
17179
|
+
return amis.pipeOut(value, data);
|
|
17180
|
+
}
|
|
17181
|
+
}
|
|
17182
|
+
return value;
|
|
17183
|
+
}
|
|
16734
17184
|
};
|
|
17185
|
+
if(amis.pipeIn){
|
|
17186
|
+
inputTableSchema.pipeIn = amis.pipeIn;
|
|
17187
|
+
}
|
|
17188
|
+
if(props.fieldPrefix){
|
|
17189
|
+
inputTableSchema.pipeIn = (value, data) => {
|
|
17190
|
+
value = getTableValueWithoutFieldPrefix(value, props.fieldPrefix);
|
|
17191
|
+
if(amis.pipeIn){
|
|
17192
|
+
if(typeof amis.pipeIn === 'function'){
|
|
17193
|
+
return amis.pipeIn(value, data);
|
|
17194
|
+
}
|
|
17195
|
+
}
|
|
17196
|
+
return value;
|
|
17197
|
+
};
|
|
17198
|
+
}
|
|
16735
17199
|
if (buttonsForColumnOperations.length) {
|
|
16736
17200
|
inputTableSchema.columns.push({
|
|
16737
17201
|
"name": "__op__",
|
|
@@ -16743,17 +17207,18 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
16743
17207
|
if (showAsInlineEditMode) {
|
|
16744
17208
|
inputTableSchema.needConfirm = false;
|
|
16745
17209
|
}
|
|
16746
|
-
let amis = props["input-table"] || props.amis;//额外支持"input-table"代替amis属性,是因为在字段yml文件中用amis作为key不好理解
|
|
16747
17210
|
if (amis) {
|
|
16748
17211
|
// 支持配置amis属性重写或添加最终生成的input-table中任何属性。
|
|
16749
17212
|
delete amis.id;//如果steedos-input-table组件配置了amis.id属性,会造成新建编辑行功能不生效
|
|
17213
|
+
delete amis.pipeIn;//该属性在上面合并过了
|
|
17214
|
+
delete amis.pipeOut;//该属性在上面合并过了
|
|
16750
17215
|
Object.assign(inputTableSchema, amis);
|
|
16751
17216
|
}
|
|
16752
17217
|
const isAnyFieldHasDependOn = (props.fields || []).find(function (item) {
|
|
16753
17218
|
return item.depend_on;
|
|
16754
17219
|
});
|
|
16755
17220
|
if (isAnyFieldHasDependOn) {
|
|
16756
|
-
// 有任意一个子字段有depend_on
|
|
17221
|
+
// 有任意一个子字段有depend_on属性时,强制设置禁用静态模式,因为strictMode模式下,dependOn的字段值变更后,不会rerender整个子表
|
|
16757
17222
|
Object.assign(inputTableSchema, {
|
|
16758
17223
|
strictMode: false
|
|
16759
17224
|
});
|
|
@@ -16858,7 +17323,7 @@ async function getListPageInitSchema(objectApiName, formFactor, userSession) {
|
|
|
16858
17323
|
// 获取
|
|
16859
17324
|
async function getRecordPageInitSchema(objectApiName){
|
|
16860
17325
|
const relatedList = await getObjectRelatedList(objectApiName);
|
|
16861
|
-
|
|
17326
|
+
await getUISchema(objectApiName);
|
|
16862
17327
|
let body = [
|
|
16863
17328
|
// detailHeaderAmisSchema,
|
|
16864
17329
|
{
|
|
@@ -16866,28 +17331,7 @@ async function getRecordPageInitSchema(objectApiName){
|
|
|
16866
17331
|
"label": "标题面板",
|
|
16867
17332
|
"objectApiName": "${objectName}",
|
|
16868
17333
|
"recordId": "${recordId}",
|
|
16869
|
-
"onEvent": {
|
|
16870
|
-
"recordLoaded": {
|
|
16871
|
-
"actions": [
|
|
16872
|
-
{
|
|
16873
|
-
"actionType": "setValue",
|
|
16874
|
-
"args": {
|
|
16875
|
-
"value": {
|
|
16876
|
-
"recordLoaded": true,
|
|
16877
|
-
}
|
|
16878
|
-
}
|
|
16879
|
-
},
|
|
16880
|
-
{
|
|
16881
|
-
"actionType": "reload",
|
|
16882
|
-
"data": {
|
|
16883
|
-
"name": `\${record.${uiSchema?.NAME_FIELD_KEY || 'name'}}`,
|
|
16884
|
-
"record": `\${record}`,
|
|
16885
|
-
"recordLoaded": true,
|
|
16886
|
-
}
|
|
16887
|
-
}
|
|
16888
|
-
]
|
|
16889
|
-
}
|
|
16890
|
-
}
|
|
17334
|
+
"onEvent": {}
|
|
16891
17335
|
}
|
|
16892
17336
|
];
|
|
16893
17337
|
let contentBody = {
|
|
@@ -19520,9 +19964,11 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
|
|
|
19520
19964
|
getObjectRelatedList: getObjectRelatedList,
|
|
19521
19965
|
getObjectRelatedListButtons: getObjectRelatedListButtons,
|
|
19522
19966
|
getObjectRelatedListHeader: getObjectRelatedListHeader,
|
|
19967
|
+
getObjectRelatedListsMiniSchema: getObjectRelatedListsMiniSchema,
|
|
19523
19968
|
getPage: getPage,
|
|
19524
19969
|
getRecord: getRecord,
|
|
19525
19970
|
getRecordDetailHeaderSchema: getRecordDetailHeaderSchema,
|
|
19971
|
+
getRecordDetailMiniSchema: getRecordDetailMiniSchema,
|
|
19526
19972
|
getRecordDetailRelatedListSchema: getRecordDetailRelatedListSchema,
|
|
19527
19973
|
getRecordDetailSchema: getRecordDetailSchema,
|
|
19528
19974
|
getRecordPageInitSchema: getRecordPageInitSchema,
|
|
@@ -19704,7 +20150,7 @@ var AmisObjectFieldLookup = function (props) {
|
|
|
19704
20150
|
};
|
|
19705
20151
|
|
|
19706
20152
|
var AmisObjectButton = function (props) {
|
|
19707
|
-
// console.log(`AmisObjectButton
|
|
20153
|
+
// console.log(`AmisObjectButton=====》`, props)
|
|
19708
20154
|
var objectName = props.objectName, name = props.name, data = props.data, render = props.render, className = props.className, listViewId = props.listViewId;
|
|
19709
20155
|
var _a = __read(React.useState(), 2), button = _a[0], setButton = _a[1];
|
|
19710
20156
|
var _b = __read(React.useState(), 2), uiSchema = _b[0], setUiSchema = _b[1];
|
|
@@ -19981,11 +20427,11 @@ var SteedosSkeleton = function (props) {
|
|
|
19981
20427
|
};
|
|
19982
20428
|
|
|
19983
20429
|
var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
19984
|
-
var $schema, recordId, defaultData, mode, layout, labelAlign, appId, fieldsExtend,
|
|
19985
|
-
return __generator(this, function (
|
|
19986
|
-
switch (
|
|
20430
|
+
var $schema, recordId, defaultData, mode, _a, layout, labelAlign, appId, fieldsExtend, _b, excludedFields, _c, fields, _d, form, _e, className, initApiRequestAdaptor, initApiAdaptor, apiRequestAdaptor, apiAdaptor, enableTabs, tabsMode, submitSuccActions, data, formDataFilter, onFormDataFilter, env, objectApiName, schemaKeys, formSchema, defaults, options, globalData, amisSchema, uiSchema, allData, schema, schema, formData, fieldsArray, excludedFieldsArray, InitApiResendOn;
|
|
20431
|
+
return __generator(this, function (_f) {
|
|
20432
|
+
switch (_f.label) {
|
|
19987
20433
|
case 0:
|
|
19988
|
-
$schema = props.$schema, recordId = props.recordId, defaultData = props.defaultData, mode = props.mode,
|
|
20434
|
+
$schema = props.$schema, recordId = props.recordId, defaultData = props.defaultData, mode = props.mode, _a = props.layout, layout = _a === void 0 ? "horizontal" : _a, labelAlign = props.labelAlign, appId = props.appId, fieldsExtend = props.fieldsExtend, _b = props.excludedFields, excludedFields = _b === void 0 ? null : _b, _c = props.fields, fields = _c === void 0 ? null : _c, _d = props.form, form = _d === void 0 ? {} : _d, _e = props.className, className = _e === void 0 ? "" : _e, initApiRequestAdaptor = props.initApiRequestAdaptor, initApiAdaptor = props.initApiAdaptor, apiRequestAdaptor = props.apiRequestAdaptor, apiAdaptor = props.apiAdaptor, enableTabs = props.enableTabs, tabsMode = props.tabsMode, submitSuccActions = props.submitSuccActions, data = props.data, formDataFilter = props.formDataFilter, onFormDataFilter = props.onFormDataFilter, env = props.env;
|
|
19989
20435
|
objectApiName = props.objectApiName || "space_users";
|
|
19990
20436
|
schemaKeys = _$1.difference(_$1.keys($schema), ["id", "form", "type", "mode", "layout", "defaultData", "formDataFilter", "onFormDataFilter", "env"]);
|
|
19991
20437
|
formSchema = _$1.pick(props, schemaKeys);
|
|
@@ -20032,7 +20478,7 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
20032
20478
|
env: env
|
|
20033
20479
|
}))];
|
|
20034
20480
|
case 1:
|
|
20035
|
-
schema =
|
|
20481
|
+
schema = _f.sent();
|
|
20036
20482
|
amisSchema = schema.amisSchema;
|
|
20037
20483
|
uiSchema = schema.uiSchema;
|
|
20038
20484
|
return [3 /*break*/, 4];
|
|
@@ -20051,10 +20497,10 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
20051
20497
|
env: env
|
|
20052
20498
|
}))];
|
|
20053
20499
|
case 3:
|
|
20054
|
-
schema =
|
|
20500
|
+
schema = _f.sent();
|
|
20055
20501
|
amisSchema = schema.amisSchema;
|
|
20056
20502
|
uiSchema = schema.uiSchema;
|
|
20057
|
-
|
|
20503
|
+
_f.label = 4;
|
|
20058
20504
|
case 4:
|
|
20059
20505
|
formData = {};
|
|
20060
20506
|
// formData.recordId = recordId || null;
|
|
@@ -20065,7 +20511,8 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
20065
20511
|
formData.recordId = props.recordId;
|
|
20066
20512
|
}
|
|
20067
20513
|
amisSchema.className = "steedos-object-form ".concat(className);
|
|
20068
|
-
|
|
20514
|
+
// console.log('AmisObjectForm amisSchema======>', amisSchema)
|
|
20515
|
+
amisSchema.data = Object.assign({}, amisSchema.data || {}, formData, { global: globalData, uiSchema: uiSchema });
|
|
20069
20516
|
if (_$1.has(props, 'objectApiName')) {
|
|
20070
20517
|
amisSchema.data.objectName = objectApiName;
|
|
20071
20518
|
}
|
|
@@ -20244,7 +20691,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
20244
20691
|
{
|
|
20245
20692
|
"type": "service",
|
|
20246
20693
|
"id": "service_schema_api_" + objectApiName,
|
|
20247
|
-
"className": " steedos-object-listview-content grow",
|
|
20694
|
+
"className": " steedos-object-listview-content md:overflow-auto grow",
|
|
20248
20695
|
"schemaApi": {
|
|
20249
20696
|
// 这里url上加objectApiName属性是因为设计器中切换对象时不会变更列表视图界面,不可以用objectName=${objectName}使用作用域中objectName变量是因为设计器那边不会监听识别data变化来render组件
|
|
20250
20697
|
"url": "${context.rootUrl}/graphql?objectName=" + objectApiName + "&listName=${listName}&display=${display}&rebuildOn=" + rebuildOn,
|
|
@@ -20254,7 +20701,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
20254
20701
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
20255
20702
|
},
|
|
20256
20703
|
"requestAdaptor": "api.data={query: '{spaces__findOne(id: \"none\"){_id,name}}'};return api;",
|
|
20257
|
-
"adaptor": "\n // console.log('service listview schemaApi adaptor....', api.body); \n let { appId, objectName, defaultListName: listName, display, formFactor: defaultFormFactor, uiSchema} = api.body;\n if(api.body.listName){\n listName = api.body.listName;\n }\n const listView = _.find(\n uiSchema.list_views,\n (listView, name) => {\n // \u4F20\u5165listViewName\u7A7A\u503C\u5219\u53D6\u7B2C\u4E00\u4E2A\n if(!listName){\n listName = name;\n }\n return name === listName || listView._id === listName;\n }\n );\n return new Promise((resolve)=>{\n const listViewSchemaProps = ".concat(JSON.stringify(listViewSchemaProps), ";\n const formFactor = ([\"split\"].indexOf(display) > -1) ? 'SMALL': defaultFormFactor;\n listViewSchemaProps.formFactor = formFactor;\n listViewSchemaProps.displayAs = display;\n // console.log(\"====listViewSchemaProps===>\", listName, display, listViewSchemaProps)\n const crud_mode = listView.crud_mode;\n if(crud_mode){\n if(!listViewSchemaProps.defaults.listSchema.mode){\n // \u8FD9\u91CC\u4F18\u5148\u8BA4\u5FAE\u9875\u9762\u4E2D\u4E3A\u5217\u8868\u89C6\u56FE\u7EC4\u4EF6\u914D\u7F6E\u7684crudMode\u53CAcrud.mode\u5C5E\u6027\uFF0C\n // \u53EA\u6709\u7EC4\u4EF6\u4E2D\u672A\u914D\u7F6E\u8BE5\u5C5E\u6027\u65F6\u624D\u53D6\u5143\u6570\u636E\u4E2D\u4E3A\u5F53\u524D\u5217\u8868\u89C6\u56FE\u914D\u7F6E\u7684crud_mode\u5C5E\u6027\u4F5C\u4E3Acrud\u7684mode\u503C\n // \u4E0D\u4F18\u5148\u8BA4\u5404\u4E2A\u5217\u8868\u89C6\u56FE\u5143\u6570\u636E\u4E2D\u7684\u914D\u7F6E\uFF0C\u662F\u56E0\u4E3A\u5728\u754C\u9762\u4E0A\u65B0\u5EFA\u7F16\u8F91\u5217\u8868\u89C6\u56FE\u65F6\uFF0Ccrud_mode\u5B57\u6BB5\u503C\u9ED8\u8BA4\u503C\u662Ftable\uFF0C\u8FD9\u4F1A\u8BA9\u5FAE\u9875\u9762\u4E2D\u5217\u8868\u89C6\u56FE\u7EC4\u4EF6\u4E2D\u914D\u7F6E\u7684crudMode\u53CAcrud.mode\u5C5E\u6027\u503C\u4E0D\u751F\u6548\n // \u5982\u679C\u60F3\u4F18\u5148\u8BA4\u5404\u4E2A\u5217\u8868\u89C6\u56FE\u5143\u6570\u636E\u4E2D\u7684\u914D\u7F6E\uFF0C\u53EA\u8981\u628A\u5FAE\u9875\u9762\u4E2D\u5217\u8868\u89C6\u56FE\u7EC4\u4EF6\u7684crudMode\u53CAcrud.mode\u5C5E\u6027\u503C\u6E05\u9664\u5373\u53EF\n listViewSchemaProps.defaults.listSchema.mode = crud_mode;\n }\n }\n window.getListSchema(appId, objectName, listName, listViewSchemaProps).then((schema)=>{\n try{\n const uiSchema = schema.uiSchema;\n const listView = _.find(\n uiSchema.list_views,\n (listView, name) => {\n // \u4F20\u5165listViewName\u7A7A\u503C\u5219\u53D6\u7B2C\u4E00\u4E2A\n if(!listName){\n listName = name;\n }\n return name === listName || listView._id === listName;\n }\n );\n if(listView){\n window.Steedos && window.Steedos.setDocumentTitle && window.Steedos.setDocumentTitle({pageName: listView.label || listView.name})\n }\n }catch(e){\n console.error(e)\n }\n payload.data = schema.amisSchema;\n
|
|
20704
|
+
"adaptor": "\n // console.log('service listview schemaApi adaptor....', api.body); \n let { appId, objectName, defaultListName: listName, display, formFactor: defaultFormFactor, uiSchema} = api.body;\n if(api.body.listName){\n listName = api.body.listName;\n }\n const listView = _.find(\n uiSchema.list_views,\n (listView, name) => {\n // \u4F20\u5165listViewName\u7A7A\u503C\u5219\u53D6\u7B2C\u4E00\u4E2A\n if(!listName){\n listName = name;\n }\n return name === listName || listView._id === listName;\n }\n );\n return new Promise((resolve)=>{\n const listViewSchemaProps = ".concat(JSON.stringify(listViewSchemaProps), ";\n const formFactor = ([\"split\"].indexOf(display) > -1) ? 'SMALL': defaultFormFactor;\n listViewSchemaProps.formFactor = formFactor;\n listViewSchemaProps.displayAs = display;\n // console.log(\"====listViewSchemaProps===>\", listName, display, listViewSchemaProps)\n const crud_mode = listView.crud_mode;\n if(crud_mode){\n if(!listViewSchemaProps.defaults.listSchema.mode){\n // \u8FD9\u91CC\u4F18\u5148\u8BA4\u5FAE\u9875\u9762\u4E2D\u4E3A\u5217\u8868\u89C6\u56FE\u7EC4\u4EF6\u914D\u7F6E\u7684crudMode\u53CAcrud.mode\u5C5E\u6027\uFF0C\n // \u53EA\u6709\u7EC4\u4EF6\u4E2D\u672A\u914D\u7F6E\u8BE5\u5C5E\u6027\u65F6\u624D\u53D6\u5143\u6570\u636E\u4E2D\u4E3A\u5F53\u524D\u5217\u8868\u89C6\u56FE\u914D\u7F6E\u7684crud_mode\u5C5E\u6027\u4F5C\u4E3Acrud\u7684mode\u503C\n // \u4E0D\u4F18\u5148\u8BA4\u5404\u4E2A\u5217\u8868\u89C6\u56FE\u5143\u6570\u636E\u4E2D\u7684\u914D\u7F6E\uFF0C\u662F\u56E0\u4E3A\u5728\u754C\u9762\u4E0A\u65B0\u5EFA\u7F16\u8F91\u5217\u8868\u89C6\u56FE\u65F6\uFF0Ccrud_mode\u5B57\u6BB5\u503C\u9ED8\u8BA4\u503C\u662Ftable\uFF0C\u8FD9\u4F1A\u8BA9\u5FAE\u9875\u9762\u4E2D\u5217\u8868\u89C6\u56FE\u7EC4\u4EF6\u4E2D\u914D\u7F6E\u7684crudMode\u53CAcrud.mode\u5C5E\u6027\u503C\u4E0D\u751F\u6548\n // \u5982\u679C\u60F3\u4F18\u5148\u8BA4\u5404\u4E2A\u5217\u8868\u89C6\u56FE\u5143\u6570\u636E\u4E2D\u7684\u914D\u7F6E\uFF0C\u53EA\u8981\u628A\u5FAE\u9875\u9762\u4E2D\u5217\u8868\u89C6\u56FE\u7EC4\u4EF6\u7684crudMode\u53CAcrud.mode\u5C5E\u6027\u503C\u6E05\u9664\u5373\u53EF\n listViewSchemaProps.defaults.listSchema.mode = crud_mode;\n }\n }\n window.getListSchema(appId, objectName, listName, listViewSchemaProps).then((schema)=>{\n try{\n const uiSchema = schema.uiSchema;\n const listView = _.find(\n uiSchema.list_views,\n (listView, name) => {\n // \u4F20\u5165listViewName\u7A7A\u503C\u5219\u53D6\u7B2C\u4E00\u4E2A\n if(!listName){\n listName = name;\n }\n return name === listName || listView._id === listName;\n }\n );\n if(listView){\n window.Steedos && window.Steedos.setDocumentTitle && window.Steedos.setDocumentTitle({pageName: listView.label || listView.name})\n }\n }catch(e){\n console.error(e)\n }\n payload.data = schema.amisSchema;\n resolve(payload)\n });\n });\n ")
|
|
20258
20705
|
},
|
|
20259
20706
|
// "body": body,
|
|
20260
20707
|
// "data": serviceData
|
|
@@ -20412,34 +20859,18 @@ var AmisObjectCalendar = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
20412
20859
|
}); };
|
|
20413
20860
|
|
|
20414
20861
|
var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
20415
|
-
var _a, className, schemaFilter,
|
|
20862
|
+
var _a, className, schemaFilter, showButtons, showBackButton, defaultOnEvent, recordId, _b, onEvent, _c, showRecordTitle, objectApiName, schema, config, schemaFilterFun, _config, e_1;
|
|
20416
20863
|
return __generator(this, function (_d) {
|
|
20417
20864
|
switch (_d.label) {
|
|
20418
20865
|
case 0:
|
|
20419
|
-
_a = props.className, className = _a === void 0 ? 'sm:sticky top-0 z-10 bg-gray-100
|
|
20866
|
+
_a = props.className, className = _a === void 0 ? 'sm:sticky top-0 z-10 p-0 bg-gray-100' : _a, schemaFilter = props.schemaFilter, showButtons = props.showButtons, showBackButton = props.showBackButton;
|
|
20420
20867
|
return [4 /*yield*/, getUISchema(props.objectApiName || "space_users", false)];
|
|
20421
20868
|
case 1:
|
|
20422
|
-
|
|
20423
|
-
defaultOnEvent = {
|
|
20424
|
-
"recordLoaded": {
|
|
20425
|
-
"actions": [
|
|
20426
|
-
{
|
|
20427
|
-
"actionType": "reload",
|
|
20428
|
-
"data": {
|
|
20429
|
-
"name": "${event.data.record.".concat((objectUiSchema === null || objectUiSchema === void 0 ? void 0 : objectUiSchema.NAME_FIELD_KEY) || 'name', "}"),
|
|
20430
|
-
"record": "${event.data.record}",
|
|
20431
|
-
"_id": "\${event.data.record._id}",
|
|
20432
|
-
"recordId": "\${event.data.record._id}",
|
|
20433
|
-
"recordLoaded": true,
|
|
20434
|
-
},
|
|
20435
|
-
"expression": "${event.data.objectName == '".concat(objectUiSchema === null || objectUiSchema === void 0 ? void 0 : objectUiSchema.name, "'}")
|
|
20436
|
-
}
|
|
20437
|
-
]
|
|
20438
|
-
}
|
|
20439
|
-
};
|
|
20869
|
+
_d.sent();
|
|
20870
|
+
defaultOnEvent = {};
|
|
20440
20871
|
props.$schema, recordId = props.recordId, _b = props.onEvent, onEvent = _b === void 0 ? defaultOnEvent : _b, _c = props.showRecordTitle, showRecordTitle = _c === void 0 ? true : _c;
|
|
20441
20872
|
objectApiName = props.objectApiName || "space_users";
|
|
20442
|
-
return [4 /*yield*/, getRecordDetailHeaderSchema(objectApiName, recordId, { showRecordTitle: showRecordTitle, formFactor: props.data.formFactor })];
|
|
20873
|
+
return [4 /*yield*/, getRecordDetailHeaderSchema(objectApiName, recordId, { showRecordTitle: showRecordTitle, formFactor: props.data.formFactor, showButtons: showButtons, showBackButton: showBackButton, display: props.data.display })];
|
|
20443
20874
|
case 2:
|
|
20444
20875
|
schema = (_d.sent()).amisSchema;
|
|
20445
20876
|
schema.className = className;
|
|
@@ -20458,18 +20889,20 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
|
|
|
20458
20889
|
e_1 = _d.sent();
|
|
20459
20890
|
console.warn(e_1);
|
|
20460
20891
|
return [3 /*break*/, 6];
|
|
20461
|
-
case 6:
|
|
20892
|
+
case 6:
|
|
20893
|
+
// console.log(`AmisRecordDetailHeader==>`, config)
|
|
20894
|
+
return [2 /*return*/, config];
|
|
20462
20895
|
}
|
|
20463
20896
|
});
|
|
20464
20897
|
}); };
|
|
20465
20898
|
|
|
20466
20899
|
var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
20467
|
-
var className, $schema, appId, _a, objectApiName, body, schema;
|
|
20900
|
+
var className, $schema, appId, _a, objectApiName, body, showButtons, showBackButton, schema;
|
|
20468
20901
|
return __generator(this, function (_b) {
|
|
20469
20902
|
switch (_b.label) {
|
|
20470
20903
|
case 0:
|
|
20471
|
-
className = props.className, $schema = props.$schema, appId = props.appId, _a = props.objectApiName, objectApiName = _a === void 0 ? "space_users" : _a, props.recordId, props.onEvent, props.defaultData, body = props.body;
|
|
20472
|
-
return [4 /*yield*/, getRecordDetailSchema(objectApiName, appId)];
|
|
20904
|
+
className = props.className, $schema = props.$schema, appId = props.appId, _a = props.objectApiName, objectApiName = _a === void 0 ? "space_users" : _a, props.recordId, props.onEvent, props.defaultData, body = props.body, showButtons = props.showButtons, showBackButton = props.showBackButton;
|
|
20905
|
+
return [4 /*yield*/, getRecordDetailSchema(objectApiName, appId, { showButtons: showButtons, showBackButton: showBackButton })];
|
|
20473
20906
|
case 1:
|
|
20474
20907
|
schema = (_b.sent()).amisSchema;
|
|
20475
20908
|
// 在非记录页组件下全局作用域下无recordId,会导致表单接口sendOn始终为false,无法发起请求。
|
|
@@ -20479,8 +20912,17 @@ var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
20479
20912
|
// }
|
|
20480
20913
|
// schema.data = Object.assign({}, schema.data, recordDetailData);
|
|
20481
20914
|
if (_$1.has(props, "recordId") && $schema.recordId !== "${recordId}") {
|
|
20915
|
+
if (!schema.data) {
|
|
20916
|
+
schema.data = {};
|
|
20917
|
+
}
|
|
20482
20918
|
schema.data.recordId = props.recordId;
|
|
20483
20919
|
}
|
|
20920
|
+
if (_$1.has(props, "objectApiName") && props.objectApiName && $schema.objectApiName !== "${objectName}") {
|
|
20921
|
+
if (!schema.data) {
|
|
20922
|
+
schema.data = {};
|
|
20923
|
+
}
|
|
20924
|
+
schema.data.objectName = props.objectApiName;
|
|
20925
|
+
}
|
|
20484
20926
|
schema.className = className;
|
|
20485
20927
|
if (body) {
|
|
20486
20928
|
schema.body = body;
|
|
@@ -20494,28 +20936,39 @@ var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
20494
20936
|
/*
|
|
20495
20937
|
* @Author: baozhoutao@steedos.com
|
|
20496
20938
|
* @Date: 2022-12-08 10:32:17
|
|
20497
|
-
* @LastEditors:
|
|
20498
|
-
* @LastEditTime:
|
|
20939
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
20940
|
+
* @LastEditTime: 2024-01-16 14:09:23
|
|
20499
20941
|
* @Description:
|
|
20500
20942
|
*/
|
|
20501
20943
|
var AmisRecordService = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
20502
|
-
var className, _a, objectApiName, body, style, schema;
|
|
20944
|
+
var className, $schema, appId, _a, objectApiName, body, style, recordId, options, schema;
|
|
20503
20945
|
return __generator(this, function (_b) {
|
|
20504
20946
|
switch (_b.label) {
|
|
20505
20947
|
case 0:
|
|
20506
|
-
className = props.className, props.$schema, props.appId, _a = props.objectApiName, objectApiName = _a === void 0 ? "space_users" : _a, props.
|
|
20507
|
-
|
|
20948
|
+
className = props.className, $schema = props.$schema, appId = props.appId, _a = props.objectApiName, objectApiName = _a === void 0 ? "space_users" : _a, props.fields, body = props.body, style = props.style, props.onEvent, recordId = props.recordId;
|
|
20949
|
+
if (_$1.has($schema.data, "recordId") && $schema.data.recordId !== "${recordId}") {
|
|
20950
|
+
recordId = $schema.data.recordId;
|
|
20951
|
+
}
|
|
20952
|
+
if (_$1.has($schema.data, "objectName") && $schema.data.objectName !== "${objectName}") {
|
|
20953
|
+
objectApiName = $schema.data.objectName;
|
|
20954
|
+
}
|
|
20955
|
+
options = { onEvent: $schema.onEvent, data: $schema.data, recordId: recordId };
|
|
20956
|
+
if (props.$$editor) {
|
|
20957
|
+
options.isEditor = true;
|
|
20958
|
+
}
|
|
20959
|
+
return [4 /*yield*/, getRecordServiceSchema(objectApiName, appId, options, body)];
|
|
20508
20960
|
case 1:
|
|
20509
20961
|
schema = (_b.sent()).amisSchema;
|
|
20510
|
-
if (body) {
|
|
20511
|
-
schema.body = body;
|
|
20512
|
-
}
|
|
20513
20962
|
if (className) {
|
|
20514
20963
|
schema.className = className;
|
|
20515
20964
|
}
|
|
20516
20965
|
if (style) {
|
|
20966
|
+
if (!schema.style) {
|
|
20967
|
+
schema.style = {};
|
|
20968
|
+
}
|
|
20517
20969
|
Object.assign(schema.style, style);
|
|
20518
20970
|
}
|
|
20971
|
+
// console.log(`AmisRecordService====schema==>`, schema)
|
|
20519
20972
|
return [2 /*return*/, schema];
|
|
20520
20973
|
}
|
|
20521
20974
|
});
|
|
@@ -20572,7 +21025,7 @@ var AmisRecordDetailRelatedList = function (props) { return __awaiter(void 0, vo
|
|
|
20572
21025
|
}); };
|
|
20573
21026
|
|
|
20574
21027
|
var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
20575
|
-
var $schema, objectApiName, recordId, _a, perPage, relatedLists, staticRecordId;
|
|
21028
|
+
var $schema, objectApiName, recordId, _a, perPage, formFactor, relatedLists, staticRecordId;
|
|
20576
21029
|
return __generator(this, function (_b) {
|
|
20577
21030
|
switch (_b.label) {
|
|
20578
21031
|
case 0:
|
|
@@ -20587,7 +21040,10 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
|
|
|
20587
21040
|
"className": "mb-3"
|
|
20588
21041
|
}];
|
|
20589
21042
|
}
|
|
20590
|
-
props.formFactor;
|
|
21043
|
+
formFactor = props.formFactor;
|
|
21044
|
+
if (!formFactor) {
|
|
21045
|
+
formFactor = window.innerWidth < 768 ? 'SMALL' : 'LARGE';
|
|
21046
|
+
}
|
|
20591
21047
|
return [4 /*yield*/, getObjectRelatedList(objectApiName)];
|
|
20592
21048
|
case 1:
|
|
20593
21049
|
relatedLists = _b.sent();
|
|
@@ -20600,11 +21056,12 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
|
|
|
20600
21056
|
"className": "mb-3"
|
|
20601
21057
|
}];
|
|
20602
21058
|
}
|
|
20603
|
-
staticRecordId =
|
|
21059
|
+
staticRecordId = props.staticRecordId;
|
|
20604
21060
|
// 在设计器中的设计状态,当上层有recordId具体值,相关表组件的$schema.recordId的默认值就是 "${recordId}"; 会导致获取不到 _master, 进而导致组件显示不了数据。
|
|
20605
21061
|
if (_$1.has(props, "recordId") && ($schema.recordId !== "${recordId}" || (props.$$editor && props.recordId !== "${recordId}"))) {
|
|
20606
21062
|
staticRecordId = recordId;
|
|
20607
21063
|
}
|
|
21064
|
+
// console.log('relatedLists======>', relatedLists, staticRecordId)
|
|
20608
21065
|
return [2 /*return*/, {
|
|
20609
21066
|
type: 'service',
|
|
20610
21067
|
className: "steedos-record-detail-related-lists",
|
|
@@ -20613,6 +21070,7 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
|
|
|
20613
21070
|
type: 'steedos-object-related-listview',
|
|
20614
21071
|
objectApiName: objectApiName,
|
|
20615
21072
|
// recordId: recordId,
|
|
21073
|
+
formFactor: formFactor,
|
|
20616
21074
|
relatedObjectApiName: item.object_name,
|
|
20617
21075
|
foreign_key: item.foreign_key,
|
|
20618
21076
|
relatedKey: item.foreign_key,
|
|
@@ -20627,6 +21085,7 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
|
|
|
20627
21085
|
if (staticRecordId) {
|
|
20628
21086
|
relatedList.recordId = staticRecordId;
|
|
20629
21087
|
}
|
|
21088
|
+
// console.log('relatedList=====>', relatedList)
|
|
20630
21089
|
return relatedList;
|
|
20631
21090
|
})
|
|
20632
21091
|
}];
|
|
@@ -21139,7 +21598,7 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21139
21598
|
* @Author: baozhoutao@steedos.com
|
|
21140
21599
|
* @Date: 2022-09-01 14:44:57
|
|
21141
21600
|
* @LastEditors: baozhoutao@steedos.com
|
|
21142
|
-
* @LastEditTime:
|
|
21601
|
+
* @LastEditTime: 2024-01-19 17:12:48
|
|
21143
21602
|
* @Description:
|
|
21144
21603
|
*/
|
|
21145
21604
|
var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -21451,6 +21910,26 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
21451
21910
|
}
|
|
21452
21911
|
]
|
|
21453
21912
|
},
|
|
21913
|
+
{
|
|
21914
|
+
"type": "button",
|
|
21915
|
+
"label": "切换工作区",
|
|
21916
|
+
"className": "flex",
|
|
21917
|
+
"onEvent": {
|
|
21918
|
+
"click": {
|
|
21919
|
+
"actions": [
|
|
21920
|
+
{
|
|
21921
|
+
"args": {
|
|
21922
|
+
"url": "/accounts/a/#/select-space",
|
|
21923
|
+
"blank": false
|
|
21924
|
+
},
|
|
21925
|
+
"actionType": "url"
|
|
21926
|
+
}
|
|
21927
|
+
]
|
|
21928
|
+
}
|
|
21929
|
+
},
|
|
21930
|
+
"level": "link",
|
|
21931
|
+
"visibleOn": "${window:Meteor.settings.public.enable_saas}"
|
|
21932
|
+
},
|
|
21454
21933
|
{
|
|
21455
21934
|
"type": "button",
|
|
21456
21935
|
"label": instance.t('frontend_profile'),
|
|
@@ -21521,14 +22000,14 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
21521
22000
|
/*
|
|
21522
22001
|
* @Author: baozhoutao@steedos.com
|
|
21523
22002
|
* @Date: 2022-09-01 14:44:57
|
|
21524
|
-
* @LastEditors:
|
|
21525
|
-
* @LastEditTime: 2024-01-
|
|
22003
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
22004
|
+
* @LastEditTime: 2024-01-16 13:45:42
|
|
21526
22005
|
* @Description:
|
|
21527
22006
|
*/
|
|
21528
22007
|
var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
21529
|
-
var logoSrc, isMobile, schema;
|
|
22008
|
+
var logoSrc, customButtons, isMobile, schema;
|
|
21530
22009
|
return __generator(this, function (_a) {
|
|
21531
|
-
logoSrc = props.logoSrc;
|
|
22010
|
+
logoSrc = props.logoSrc, customButtons = props.customButtons;
|
|
21532
22011
|
isMobile = window.innerWidth <= 768;
|
|
21533
22012
|
schema = {
|
|
21534
22013
|
"type": "wrapper",
|
|
@@ -21619,39 +22098,7 @@ var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21619
22098
|
"label": "Global Header",
|
|
21620
22099
|
className: 'flex flex-nowrap gap-x-3 items-center',
|
|
21621
22100
|
logoutScript: "window.signOut();",
|
|
21622
|
-
customButtons:
|
|
21623
|
-
{
|
|
21624
|
-
"type": "button",
|
|
21625
|
-
"className": "toggle-sidebar",
|
|
21626
|
-
"visibleOn": "${AND(app.showSidebar,!" + isMobile + ")}",
|
|
21627
|
-
"onEvent": {
|
|
21628
|
-
"click": {
|
|
21629
|
-
"actions": [
|
|
21630
|
-
{
|
|
21631
|
-
"actionType": "custom",
|
|
21632
|
-
"script": "document.body.classList.toggle('sidebar-open')",
|
|
21633
|
-
}
|
|
21634
|
-
]
|
|
21635
|
-
}
|
|
21636
|
-
},
|
|
21637
|
-
"body": [
|
|
21638
|
-
{
|
|
21639
|
-
"type": "steedos-icon",
|
|
21640
|
-
"category": "utility",
|
|
21641
|
-
"name": "rows",
|
|
21642
|
-
"colorVariant": "default",
|
|
21643
|
-
"id": "u:afc3a08e8cf3",
|
|
21644
|
-
"className": "slds-button_icon slds-global-header__icon"
|
|
21645
|
-
}
|
|
21646
|
-
],
|
|
21647
|
-
},
|
|
21648
|
-
{
|
|
21649
|
-
"type": "steedos-app-launcher",
|
|
21650
|
-
"showAppName": false,
|
|
21651
|
-
"appId": "${app.id}",
|
|
21652
|
-
"visibleOn": "${isMobile}"
|
|
21653
|
-
}
|
|
21654
|
-
]
|
|
22101
|
+
customButtons: customButtons
|
|
21655
22102
|
}
|
|
21656
22103
|
],
|
|
21657
22104
|
},
|
|
@@ -21767,13 +22214,13 @@ function getAmisStaticFieldType(type, data_type, options) {
|
|
|
21767
22214
|
return "switch";
|
|
21768
22215
|
}
|
|
21769
22216
|
else if (type === 'currency') {
|
|
21770
|
-
return "number";
|
|
22217
|
+
return "input-number";
|
|
21771
22218
|
}
|
|
21772
22219
|
else if (type === 'autonumber') {
|
|
21773
22220
|
return "input-text"; //不可以用text,因为会出现字段label显示不出来的问题
|
|
21774
22221
|
}
|
|
21775
22222
|
else if (type === 'percent') {
|
|
21776
|
-
return "number";
|
|
22223
|
+
return "input-number";
|
|
21777
22224
|
}
|
|
21778
22225
|
else if (type === 'formula' || type === 'summary') {
|
|
21779
22226
|
return getAmisStaticFieldType(data_type, null, options);
|
|
@@ -21790,14 +22237,14 @@ function getAmisStaticFieldType(type, data_type, options) {
|
|
|
21790
22237
|
return type;
|
|
21791
22238
|
}
|
|
21792
22239
|
var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
21793
|
-
var steedosField, field, _a, readonly, _b, ctx, config, fStatic, env, inInputTable, defaultSource, source, fieldBaseProps,
|
|
21794
|
-
var e_1,
|
|
21795
|
-
var
|
|
21796
|
-
return __generator(this, function (
|
|
21797
|
-
switch (
|
|
22240
|
+
var steedosField, field, _a, readonly, _b, ctx, config, fStatic, env, inInputTable, className, defaultSource, source, fieldBaseProps, referenceTo_1, fieldRefObject, disPlayValue, res, valueOptions_1, fieldValue, values, disPlayValue_1, schema, fieldSchema, fieldValue, hasImageOrFile_1, fieldHtml_1, schema, tableFields, _c, _d, subField, subFieldName, fieldAmis, schema, error_1;
|
|
22241
|
+
var _e, e_1, _f;
|
|
22242
|
+
var _g, _h, _j, _k, _l;
|
|
22243
|
+
return __generator(this, function (_m) {
|
|
22244
|
+
switch (_m.label) {
|
|
21798
22245
|
case 0:
|
|
21799
22246
|
steedosField = null;
|
|
21800
|
-
field = props.field, _a = props.readonly, readonly = _a === void 0 ? false : _a, _b = props.ctx, ctx = _b === void 0 ? {} : _b, config = props.config, props.$schema, fStatic = props.static, env = props.env, inInputTable = props.inInputTable;
|
|
22247
|
+
field = props.field, _a = props.readonly, readonly = _a === void 0 ? false : _a, _b = props.ctx, ctx = _b === void 0 ? {} : _b, config = props.config, props.$schema, fStatic = props.static, env = props.env, inInputTable = props.inInputTable, className = props.className;
|
|
21801
22248
|
// console.log(`AmisSteedosField`, props)
|
|
21802
22249
|
// if($schema.config && isString($schema.config)){
|
|
21803
22250
|
// $schema.config = JSON.parse($schema.config)
|
|
@@ -21825,14 +22272,14 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21825
22272
|
// 字段配置为只读,强制走fStatic模式,加上_display判断是为了不影响历史代码,比如直接在ObjectForm中调用steedos-field组件
|
|
21826
22273
|
fStatic = true;
|
|
21827
22274
|
}
|
|
21828
|
-
|
|
22275
|
+
_m.label = 1;
|
|
21829
22276
|
case 1:
|
|
21830
|
-
|
|
21831
|
-
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/,
|
|
22277
|
+
_m.trys.push([1, 24, , 25]);
|
|
22278
|
+
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/, 7];
|
|
21832
22279
|
defaultSource = {
|
|
21833
22280
|
"method": "post",
|
|
21834
22281
|
"url": "${context.rootUrl}/graphql",
|
|
21835
|
-
"requestAdaptor": "\n var steedosField = ".concat(JSON.stringify(steedosField), ";\n var objectName, filters, valueFieldKey, labelFieldKey;\n if(_.isString(steedosField.reference_to)){\n // reference_to\u4E3A\u5355\u9009\n const referenceTo = getReferenceToSync(steedosField);\n const referenceToField = steedosField.reference_to_field || '_id';\n\n objectName = referenceTo.objectName\n valueFieldKey = referenceTo && referenceTo.valueField?.name || '_id' ;\n labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';\n let value = _.get(api.data, steedosField.name);\n if(_.isString(value)){\n value = [value]\n }\n filters = [referenceToField, \"in\", value || []];\n if(objectName == \"object_fields\" || objectName == \"object_actions\"){\n //\u5BF9\u8C61\u4E3Aobject_fields\u65F6\uFF0C\u5FC5\u987B\u52A0\u4E0Aobject\u7684\u8FC7\u6EE4\u6761\u4EF6\n const filtersFunction = ").concat(steedosField.filtersFunction || steedosField._filtersFunction, ";\n if(filtersFunction){\n const _filters = filtersFunction(filters, api.data);\n if(_filters && _filters.length > 0){\n filters = [filters,_filters]\n }\n }\n }\n }else{\n // reference_to\u4E3A\u591A\u9009\n const _steedosField = {\n ...steedosField,\n reference_to: api.data[steedosField.name].o\n }\n const referenceTo = getReferenceToSync(_steedosField);\n const referenceToField = _steedosField.reference_to_field || '_id';\n\n objectName = referenceTo.objectName\n valueFieldKey = referenceTo && referenceTo.valueField?.name || '_id' ;\n labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';\n let value = api.data[_steedosField.name] && api.data[_steedosField.name].ids;\n filters = [referenceToField, \"in\", value || []];\n }\n api.data = {\n query: '{options:' + objectName + '(filters: ' + JSON.stringify(filters) + '){label: ' + labelFieldKey + ',value: ' + valueFieldKey + '}}'\n }\n return api;\n "),
|
|
22282
|
+
"requestAdaptor": "\n var steedosField = ".concat(JSON.stringify(steedosField), ";\n // console.log('defaultSource====>steedosField', steedosField);\n var objectName, filters, valueFieldKey, labelFieldKey;\n if(_.isString(steedosField.reference_to)){\n // reference_to\u4E3A\u5355\u9009\n const referenceTo = getReferenceToSync(steedosField);\n const referenceToField = steedosField.reference_to_field || '_id';\n\n objectName = referenceTo.objectName\n valueFieldKey = referenceTo && referenceTo.valueField?.name || '_id' ;\n labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';\n let value = _.get(api.data, steedosField.name);\n if(_.isString(value)){\n value = [value]\n }\n filters = [referenceToField, \"in\", value || []];\n if(objectName == \"object_fields\" || objectName == \"object_actions\"){\n //\u5BF9\u8C61\u4E3Aobject_fields\u65F6\uFF0C\u5FC5\u987B\u52A0\u4E0Aobject\u7684\u8FC7\u6EE4\u6761\u4EF6\n const filtersFunction = ").concat(steedosField.filtersFunction || steedosField._filtersFunction, ";\n if(filtersFunction){\n const _filters = filtersFunction(filters, api.data);\n if(_filters && _filters.length > 0){\n filters = [filters,_filters]\n }\n }\n }\n }else{\n // reference_to\u4E3A\u591A\u9009\n const _steedosField = {\n ...steedosField,\n reference_to: api.data[steedosField.name].o\n }\n const referenceTo = getReferenceToSync(_steedosField);\n const referenceToField = _steedosField.reference_to_field || '_id';\n\n objectName = referenceTo.objectName\n valueFieldKey = referenceTo && referenceTo.valueField?.name || '_id' ;\n labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';\n let value = api.data[_steedosField.name] && api.data[_steedosField.name].ids;\n filters = [referenceToField, \"in\", value || []];\n }\n\n // \u989D\u5916\u8FD4\u56DE_id\u5B57\u6BB5\n api.data = {\n query: '{options:' + objectName + '(filters: ' + JSON.stringify(filters) + '){label: ' + labelFieldKey + ',value: ' + valueFieldKey + ', _id}}'\n }\n return api;\n "),
|
|
21836
22283
|
"trackExpression": "${" + steedosField.name + "}",
|
|
21837
22284
|
"cache": 3000
|
|
21838
22285
|
};
|
|
@@ -21849,50 +22296,168 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21849
22296
|
defaultSource.adaptor = "\n var options = ".concat(JSON.stringify(steedosField.options), "\n if(api.body.$term){\n options = _.filter(options, function(o) {\n var label = o.label;\n return label.toLowerCase().indexOf(api.body.$term.toLowerCase()) > -1;\n });\n }\n if(!payload.data){\n payload.data = {};\n }\n payload.data.options = options;\n return payload;\n ");
|
|
21850
22297
|
}
|
|
21851
22298
|
}
|
|
21852
|
-
source = ((
|
|
22299
|
+
source = ((_g = steedosField.amis) === null || _g === void 0 ? void 0 : _g.source) || ((_h = steedosField.amis) === null || _h === void 0 ? void 0 : _h.autoComplete) || defaultSource;
|
|
21853
22300
|
fieldBaseProps = {
|
|
21854
22301
|
multiple: steedosField.multiple,
|
|
21855
22302
|
name: steedosField.name,
|
|
21856
22303
|
label: steedosField.label,
|
|
21857
22304
|
static: true,
|
|
21858
|
-
className: (
|
|
22305
|
+
className: "".concat(className || '', " ").concat(((_j = steedosField.amis) === null || _j === void 0 ? void 0 : _j.className) || '')
|
|
21859
22306
|
};
|
|
21860
22307
|
if (!inInputTable) return [3 /*break*/, 2];
|
|
21861
22308
|
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'select', source: source });
|
|
21862
|
-
return [3 /*break*/,
|
|
22309
|
+
return [3 /*break*/, 6];
|
|
21863
22310
|
case 2:
|
|
21864
|
-
|
|
21865
|
-
return [
|
|
22311
|
+
referenceTo_1 = steedosField.reference_to;
|
|
22312
|
+
if (!referenceTo_1) return [3 /*break*/, 6];
|
|
22313
|
+
steedosField.reference_to_field;
|
|
22314
|
+
if (referenceTo_1 === 'users') {
|
|
22315
|
+
referenceTo_1 = 'space_users';
|
|
22316
|
+
}
|
|
22317
|
+
return [4 /*yield*/, getUISchema(referenceTo_1)];
|
|
21866
22318
|
case 3:
|
|
21867
|
-
|
|
21868
|
-
|
|
21869
|
-
|
|
21870
|
-
if (
|
|
21871
|
-
|
|
21872
|
-
|
|
21873
|
-
|
|
21874
|
-
|
|
21875
|
-
|
|
21876
|
-
|
|
21877
|
-
|
|
21878
|
-
|
|
21879
|
-
|
|
21880
|
-
|
|
22319
|
+
fieldRefObject = _m.sent();
|
|
22320
|
+
if (!(props.data._display && _$1.has(props.data._display, steedosField.name))) return [3 /*break*/, 4];
|
|
22321
|
+
disPlayValue = props.data._display[steedosField.name];
|
|
22322
|
+
if (disPlayValue) {
|
|
22323
|
+
if (!_$1.isArray(disPlayValue) && _$1.isObject(disPlayValue)) {
|
|
22324
|
+
disPlayValue = [disPlayValue];
|
|
22325
|
+
}
|
|
22326
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, {
|
|
22327
|
+
type: 'control',
|
|
22328
|
+
name: null,
|
|
22329
|
+
body: {
|
|
22330
|
+
type: 'wrapper',
|
|
22331
|
+
className: "steedos-field-lookup-wrapper p-0",
|
|
22332
|
+
"wrapWithPanel": false,
|
|
22333
|
+
"actions": [],
|
|
22334
|
+
body: [
|
|
22335
|
+
{
|
|
22336
|
+
type: 'each',
|
|
22337
|
+
className: "steedos-field-lookup-each flex flex-wrap gap-2",
|
|
22338
|
+
source: "${_display.".concat(steedosField.name, "|asArray}"),
|
|
22339
|
+
items: {
|
|
22340
|
+
type: 'static',
|
|
22341
|
+
labelClassName: "hidden",
|
|
22342
|
+
label: false,
|
|
22343
|
+
className: 'm-0',
|
|
22344
|
+
tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\">${label}</a>",
|
|
22345
|
+
popOver: fieldRefObject.compactLayouts ? {
|
|
22346
|
+
"trigger": "hover",
|
|
22347
|
+
"className": "steedos-record-detail-popover",
|
|
22348
|
+
"position": "left-bottom",
|
|
22349
|
+
"showIcon": false,
|
|
22350
|
+
"title": false,
|
|
22351
|
+
"offset": {
|
|
22352
|
+
"top": 0,
|
|
22353
|
+
"left": 20
|
|
22354
|
+
},
|
|
22355
|
+
"body": [
|
|
22356
|
+
{
|
|
22357
|
+
"type": "steedos-record-mini",
|
|
22358
|
+
"objectApiName": "${objectName}",
|
|
22359
|
+
"recordId": "${value}",
|
|
22360
|
+
"showButtons": false,
|
|
22361
|
+
"showBackButton": false,
|
|
22362
|
+
"data": {
|
|
22363
|
+
"objectName": "${objectName}",
|
|
22364
|
+
"recordId": "${value}"
|
|
22365
|
+
}
|
|
22366
|
+
}
|
|
22367
|
+
]
|
|
22368
|
+
} : null
|
|
22369
|
+
}
|
|
22370
|
+
}
|
|
22371
|
+
]
|
|
21881
22372
|
}
|
|
21882
22373
|
});
|
|
21883
22374
|
}
|
|
21884
|
-
|
|
21885
|
-
|
|
21886
|
-
|
|
22375
|
+
else {
|
|
22376
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'static', tpl: '-', className: "".concat(fieldBaseProps.className || '', " text-muted") });
|
|
22377
|
+
}
|
|
22378
|
+
return [3 /*break*/, 6];
|
|
22379
|
+
case 4: return [4 /*yield*/, env.fetcher(source, props.data)];
|
|
22380
|
+
case 5:
|
|
22381
|
+
res = _m.sent();
|
|
22382
|
+
valueOptions_1 = ((_k = res === null || res === void 0 ? void 0 : res.data) === null || _k === void 0 ? void 0 : _k.options) || [];
|
|
22383
|
+
fieldValue = (_l = props.data) === null || _l === void 0 ? void 0 : _l[steedosField.name];
|
|
22384
|
+
values = fieldValue;
|
|
22385
|
+
if (_$1.isString(values)) {
|
|
22386
|
+
values = [values];
|
|
22387
|
+
}
|
|
22388
|
+
if (values && values.length > 0) {
|
|
22389
|
+
disPlayValue_1 = [];
|
|
22390
|
+
_$1.each(values, function (value) {
|
|
22391
|
+
var option = valueOptions_1.find(function (item) { return item.value === value; });
|
|
22392
|
+
if (option) {
|
|
22393
|
+
disPlayValue_1.push({
|
|
22394
|
+
objectName: referenceTo_1,
|
|
22395
|
+
value: option._id || option.value,
|
|
22396
|
+
label: option.label
|
|
22397
|
+
});
|
|
22398
|
+
}
|
|
22399
|
+
});
|
|
22400
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'control', name: null, body: {
|
|
22401
|
+
type: 'form',
|
|
22402
|
+
className: "steedos-field-lookup-wrapper p-0",
|
|
22403
|
+
"wrapWithPanel": false,
|
|
22404
|
+
"actions": [],
|
|
22405
|
+
data: (_e = {},
|
|
22406
|
+
_e[steedosField.name] = disPlayValue_1,
|
|
22407
|
+
_e),
|
|
22408
|
+
body: [
|
|
22409
|
+
{
|
|
22410
|
+
type: 'each',
|
|
22411
|
+
className: "steedos-field-lookup-each flex flex-wrap gap-2",
|
|
22412
|
+
source: "${".concat(steedosField.name, "}"),
|
|
22413
|
+
items: {
|
|
22414
|
+
type: 'static',
|
|
22415
|
+
className: 'm-0',
|
|
22416
|
+
tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\">${label}</a>",
|
|
22417
|
+
popOver: fieldRefObject.compactLayouts ? {
|
|
22418
|
+
"trigger": "hover",
|
|
22419
|
+
"className": "steedos-record-detail-popover",
|
|
22420
|
+
"position": "left-bottom",
|
|
22421
|
+
"showIcon": false,
|
|
22422
|
+
"title": false,
|
|
22423
|
+
"offset": {
|
|
22424
|
+
"top": 0,
|
|
22425
|
+
"left": 20
|
|
22426
|
+
},
|
|
22427
|
+
"body": [
|
|
22428
|
+
{
|
|
22429
|
+
"type": "steedos-record-mini",
|
|
22430
|
+
"objectApiName": "${objectName}",
|
|
22431
|
+
"recordId": "${value}",
|
|
22432
|
+
"showButtons": false,
|
|
22433
|
+
"showBackButton": false,
|
|
22434
|
+
"data": {
|
|
22435
|
+
"objectName": "${objectName}",
|
|
22436
|
+
"recordId": "${value}"
|
|
22437
|
+
}
|
|
22438
|
+
}
|
|
22439
|
+
]
|
|
22440
|
+
} : null
|
|
22441
|
+
}
|
|
22442
|
+
}
|
|
22443
|
+
]
|
|
22444
|
+
} });
|
|
22445
|
+
}
|
|
22446
|
+
else {
|
|
22447
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'static', tpl: '-', className: "".concat(fieldBaseProps.className || '', " text-muted") });
|
|
22448
|
+
}
|
|
22449
|
+
_m.label = 6;
|
|
22450
|
+
case 6:
|
|
21887
22451
|
schema = Object.assign({}, fieldBaseProps, _$1.pick(steedosField.amis || {}, ['className', 'inline', 'label', 'labelAlign', 'name', 'labelRemark', 'description', 'placeholder', 'staticClassName', 'staticLabelClassName', 'staticInputClassName', 'staticSchema']));
|
|
21888
22452
|
schema.placeholder = "";
|
|
22453
|
+
// console.log(`steedos field [lookup] schema:`, schema)
|
|
21889
22454
|
return [2 /*return*/, schema];
|
|
21890
|
-
case
|
|
21891
|
-
if (!fStatic) return [3 /*break*/,
|
|
21892
|
-
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/,
|
|
22455
|
+
case 7:
|
|
22456
|
+
if (!fStatic) return [3 /*break*/, 21];
|
|
22457
|
+
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/, 9];
|
|
21893
22458
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
21894
|
-
case
|
|
21895
|
-
fieldSchema =
|
|
22459
|
+
case 8:
|
|
22460
|
+
fieldSchema = _m.sent();
|
|
21896
22461
|
if (steedosField.type === 'file' && fieldSchema.disabled) {
|
|
21897
22462
|
fieldValue = fieldSchema.value;
|
|
21898
22463
|
if (fieldValue && fieldValue.length) {
|
|
@@ -21928,59 +22493,59 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21928
22493
|
}
|
|
21929
22494
|
}
|
|
21930
22495
|
return [2 /*return*/, fieldSchema];
|
|
21931
|
-
case
|
|
22496
|
+
case 9:
|
|
21932
22497
|
schema = Object.assign({}, steedosField, {
|
|
21933
22498
|
type: getAmisStaticFieldType(steedosField.type, steedosField.data_type, steedosField),
|
|
21934
22499
|
static: true,
|
|
21935
22500
|
label: steedosField.label
|
|
21936
22501
|
});
|
|
21937
|
-
if (!(steedosField.type === "time")) return [3 /*break*/,
|
|
22502
|
+
if (!(steedosField.type === "time")) return [3 /*break*/, 10];
|
|
21938
22503
|
Object.assign(schema, {
|
|
21939
22504
|
inputFormat: 'HH:mm',
|
|
21940
22505
|
timeFormat: 'HH:mm',
|
|
21941
22506
|
format: '1970-01-01THH:mm:00.000[Z]',
|
|
21942
22507
|
});
|
|
21943
|
-
return [3 /*break*/,
|
|
21944
|
-
case
|
|
21945
|
-
if (!(steedosField.type === "percent")) return [3 /*break*/,
|
|
22508
|
+
return [3 /*break*/, 20];
|
|
22509
|
+
case 10:
|
|
22510
|
+
if (!(steedosField.type === "percent")) return [3 /*break*/, 11];
|
|
21946
22511
|
Object.assign(schema, {
|
|
21947
22512
|
"percent": steedosField.scale ? steedosField.scale : true
|
|
21948
22513
|
});
|
|
21949
|
-
return [3 /*break*/,
|
|
21950
|
-
case
|
|
21951
|
-
if (!(steedosField.type === "password")) return [3 /*break*/,
|
|
22514
|
+
return [3 /*break*/, 20];
|
|
22515
|
+
case 11:
|
|
22516
|
+
if (!(steedosField.type === "password")) return [3 /*break*/, 12];
|
|
21952
22517
|
Object.assign(schema, {
|
|
21953
22518
|
"revealPassword": false //没生效,需要用样式隐藏
|
|
21954
22519
|
});
|
|
21955
|
-
return [3 /*break*/,
|
|
21956
|
-
case
|
|
21957
|
-
if (!(steedosField.type === "select")) return [3 /*break*/,
|
|
22520
|
+
return [3 /*break*/, 20];
|
|
22521
|
+
case 12:
|
|
22522
|
+
if (!(steedosField.type === "select")) return [3 /*break*/, 13];
|
|
21958
22523
|
Object.assign(schema, {
|
|
21959
22524
|
"placeholder": ""
|
|
21960
22525
|
});
|
|
21961
|
-
return [3 /*break*/,
|
|
21962
|
-
case
|
|
21963
|
-
if (!(steedosField.type === "color")) return [3 /*break*/,
|
|
22526
|
+
return [3 /*break*/, 20];
|
|
22527
|
+
case 13:
|
|
22528
|
+
if (!(steedosField.type === "color")) return [3 /*break*/, 14];
|
|
21964
22529
|
Object.assign(schema, {
|
|
21965
22530
|
"defaultColor": null
|
|
21966
22531
|
});
|
|
21967
|
-
return [3 /*break*/,
|
|
21968
|
-
case
|
|
21969
|
-
if (!(steedosField.type === "number")) return [3 /*break*/,
|
|
22532
|
+
return [3 /*break*/, 20];
|
|
22533
|
+
case 14:
|
|
22534
|
+
if (!(steedosField.type === "number" || steedosField.type === 'currency')) return [3 /*break*/, 15];
|
|
21970
22535
|
// amis input-number和number组件中的precision表示小数位数,并不是魔方平台的精度概念,要转换下,否则小数点后会显示很多的0
|
|
21971
22536
|
Object.assign(schema, {
|
|
21972
22537
|
"precision": steedosField.scale || 0
|
|
21973
22538
|
});
|
|
21974
|
-
return [3 /*break*/,
|
|
21975
|
-
case
|
|
21976
|
-
if (!(steedosField.type === "table")) return [3 /*break*/,
|
|
22539
|
+
return [3 /*break*/, 20];
|
|
22540
|
+
case 15:
|
|
22541
|
+
if (!(steedosField.type === "table")) return [3 /*break*/, 16];
|
|
21977
22542
|
if (steedosField.subFields) {
|
|
21978
22543
|
tableFields = [];
|
|
21979
22544
|
try {
|
|
21980
|
-
for (_c = __values(
|
|
22545
|
+
for (_c = __values(steedosField.subFields), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
21981
22546
|
subField = _d.value;
|
|
21982
22547
|
if (!subField.name.endsWith(".$")) {
|
|
21983
|
-
subFieldName = subField.name.replace("".concat(
|
|
22548
|
+
subFieldName = subField.name.replace("".concat(steedosField._prefix || '').concat(steedosField.name, ".$."), '').replace("".concat(steedosField.name, "."), '');
|
|
21984
22549
|
// const gridSub = await convertSFieldToAmisField(Object.assign({}, subField, {name: subFieldName, isTableField: true}), readonly, ctx);
|
|
21985
22550
|
tableFields.push(Object.assign({}, subField, { name: subFieldName }));
|
|
21986
22551
|
}
|
|
@@ -21989,13 +22554,12 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21989
22554
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
21990
22555
|
finally {
|
|
21991
22556
|
try {
|
|
21992
|
-
if (_d && !_d.done && (
|
|
22557
|
+
if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
|
|
21993
22558
|
}
|
|
21994
22559
|
finally { if (e_1) throw e_1.error; }
|
|
21995
22560
|
}
|
|
21996
22561
|
Object.assign(schema, {
|
|
21997
22562
|
type: 'steedos-input-table',
|
|
21998
|
-
showIndex: true,
|
|
21999
22563
|
editable: false,
|
|
22000
22564
|
addable: false,
|
|
22001
22565
|
removable: false,
|
|
@@ -22006,9 +22570,9 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22006
22570
|
}
|
|
22007
22571
|
});
|
|
22008
22572
|
}
|
|
22009
|
-
return [3 /*break*/,
|
|
22010
|
-
case
|
|
22011
|
-
if (!(steedosField.type === "image")) return [3 /*break*/,
|
|
22573
|
+
return [3 /*break*/, 20];
|
|
22574
|
+
case 16:
|
|
22575
|
+
if (!(steedosField.type === "image")) return [3 /*break*/, 17];
|
|
22012
22576
|
Object.assign(schema, {
|
|
22013
22577
|
enlargeAble: true,
|
|
22014
22578
|
showToolbar: true,
|
|
@@ -22039,18 +22603,27 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22039
22603
|
return value;
|
|
22040
22604
|
}
|
|
22041
22605
|
});
|
|
22042
|
-
return [3 /*break*/,
|
|
22043
|
-
case
|
|
22044
|
-
if (!(steedosField.type === "file")) return [3 /*break*/,
|
|
22606
|
+
return [3 /*break*/, 20];
|
|
22607
|
+
case 17:
|
|
22608
|
+
if (!(steedosField.type === "file")) return [3 /*break*/, 19];
|
|
22045
22609
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
22046
|
-
case
|
|
22610
|
+
case 18:
|
|
22047
22611
|
// 附件static模式先保持原来的逻辑,依赖_display,审批王中相关功能在creator中
|
|
22048
22612
|
// convertSFieldToAmisField中会合并steedosField.amis,所以也不需要再次合并steedosField.amis,直接return就好
|
|
22049
|
-
return [2 /*return*/,
|
|
22050
|
-
case
|
|
22613
|
+
return [2 /*return*/, _m.sent()];
|
|
22614
|
+
case 19:
|
|
22615
|
+
if (steedosField.type === 'formula' || steedosField.type === 'summary') {
|
|
22616
|
+
if (steedosField.data_type === 'number' || steedosField.data_type === 'currency') {
|
|
22617
|
+
Object.assign(schema, {
|
|
22618
|
+
"precision": steedosField.scale || 0
|
|
22619
|
+
});
|
|
22620
|
+
}
|
|
22621
|
+
}
|
|
22622
|
+
_m.label = 20;
|
|
22623
|
+
case 20:
|
|
22051
22624
|
Object.assign(schema, steedosField.amis || {});
|
|
22052
22625
|
return [2 /*return*/, schema];
|
|
22053
|
-
case
|
|
22626
|
+
case 21:
|
|
22054
22627
|
fieldAmis = steedosField.amis || {};
|
|
22055
22628
|
if (!props.data.hasOwnProperty("_display")) {
|
|
22056
22629
|
// 有_display时保持原来的逻辑不变,不走以下新的逻辑,审批王中会特意传入_display以跳过后面新加的代码
|
|
@@ -22108,16 +22681,16 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22108
22681
|
}
|
|
22109
22682
|
}
|
|
22110
22683
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
22111
|
-
case
|
|
22112
|
-
schema =
|
|
22684
|
+
case 22:
|
|
22685
|
+
schema = _m.sent();
|
|
22113
22686
|
// console.log(`AmisSteedosField return schema`, schema)
|
|
22114
22687
|
return [2 /*return*/, schema];
|
|
22115
|
-
case
|
|
22116
|
-
case
|
|
22117
|
-
error_1 =
|
|
22688
|
+
case 23: return [3 /*break*/, 25];
|
|
22689
|
+
case 24:
|
|
22690
|
+
error_1 = _m.sent();
|
|
22118
22691
|
console.log("error", error_1);
|
|
22119
|
-
return [3 /*break*/,
|
|
22120
|
-
case
|
|
22692
|
+
return [3 /*break*/, 25];
|
|
22693
|
+
case 25: return [2 /*return*/, null];
|
|
22121
22694
|
}
|
|
22122
22695
|
});
|
|
22123
22696
|
}); };
|
|
@@ -22360,7 +22933,7 @@ var AmisInputTable = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
22360
22933
|
return __generator(this, function (_a) {
|
|
22361
22934
|
switch (_a.label) {
|
|
22362
22935
|
case 0:
|
|
22363
|
-
props.$schema, props.fields, props.name, props.id, props.data, props.columns, props.amis, props.className, props.tableClassName, props.headerToolbar, props.footerToolbar, props.inlineEditMode, props.strictMode, props.dialog;
|
|
22936
|
+
props.$schema, props.fields, props.name, props.id, props.data, props.columns, props.amis, props.className, props.tableClassName, props.headerToolbar, props.footerToolbar, props.inlineEditMode, props.strictMode, props.dialog, props.primaryKey, props.showOperation, props.fieldPrefix;
|
|
22364
22937
|
return [4 /*yield*/, getAmisInputTableSchema(props)];
|
|
22365
22938
|
case 1:
|
|
22366
22939
|
amisSchema = _a.sent();
|
|
@@ -22370,6 +22943,46 @@ var AmisInputTable = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
22370
22943
|
});
|
|
22371
22944
|
}); };
|
|
22372
22945
|
|
|
22946
|
+
var AmisRecordDetailMini = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22947
|
+
var $schema, appId, _a, objectApiName, recordId, schemaData, options, schema;
|
|
22948
|
+
return __generator(this, function (_b) {
|
|
22949
|
+
switch (_b.label) {
|
|
22950
|
+
case 0:
|
|
22951
|
+
props.className, $schema = props.$schema, appId = props.appId, _a = props.objectApiName, objectApiName = _a === void 0 ? "space_users" : _a, props.fields, props.body, props.style, props.onEvent, recordId = props.recordId;
|
|
22952
|
+
schemaData = {};
|
|
22953
|
+
if (_$1.has(props.data, "recordId") && props.data.recordId !== "${recordId}") {
|
|
22954
|
+
recordId = props.data.recordId;
|
|
22955
|
+
schemaData.recordId = recordId;
|
|
22956
|
+
}
|
|
22957
|
+
if (_$1.has(props.data, "value")) {
|
|
22958
|
+
recordId = props.data.value;
|
|
22959
|
+
schemaData.recordId = recordId;
|
|
22960
|
+
}
|
|
22961
|
+
if (_$1.has(props.data, "objectName") && props.data.objectName !== "${objectName}") {
|
|
22962
|
+
objectApiName = props.data.objectName;
|
|
22963
|
+
schemaData.objectName = objectApiName;
|
|
22964
|
+
}
|
|
22965
|
+
options = {
|
|
22966
|
+
onEvent: $schema.onEvent,
|
|
22967
|
+
data: $schema.data,
|
|
22968
|
+
recordId: recordId
|
|
22969
|
+
};
|
|
22970
|
+
if (props.$$editor) {
|
|
22971
|
+
options.isEditor = true;
|
|
22972
|
+
}
|
|
22973
|
+
console.log("AmisRecordDetailMini==2=>", objectApiName, options);
|
|
22974
|
+
return [4 /*yield*/, getRecordDetailMiniSchema(objectApiName, appId, options)];
|
|
22975
|
+
case 1:
|
|
22976
|
+
schema = _b.sent();
|
|
22977
|
+
if (!_$1.isEmpty(schemaData)) {
|
|
22978
|
+
schema.data = schemaData;
|
|
22979
|
+
}
|
|
22980
|
+
// console.log(`AmisRecordDetailMini===>`, schema)
|
|
22981
|
+
return [2 /*return*/, schema];
|
|
22982
|
+
}
|
|
22983
|
+
});
|
|
22984
|
+
}); };
|
|
22985
|
+
|
|
22373
22986
|
var PageListView = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22374
22987
|
var formFactor, appId, objectApiName, display, data, _display, page, listSchema;
|
|
22375
22988
|
return __generator(this, function (_b) {
|
|
@@ -22443,14 +23056,14 @@ var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22443
23056
|
recordPage = _a.sent();
|
|
22444
23057
|
recordSchema = recordPage ? recordPage.schema : {
|
|
22445
23058
|
"type": "wrapper",
|
|
22446
|
-
"className": "overflow-y-auto p-0 m-0 flex-1 h-full",
|
|
23059
|
+
"className": "steedos-record-content overflow-y-auto p-0 m-0 flex-1 h-full",
|
|
22447
23060
|
"name": "amis-".concat(appId, "-").concat(objectApiName, "-detail"),
|
|
22448
23061
|
"body": [
|
|
22449
23062
|
{
|
|
22450
23063
|
"type": "steedos-record-detail",
|
|
22451
23064
|
// "recordId": "${recordId}",
|
|
22452
23065
|
"objectApiName": "${objectName}",
|
|
22453
|
-
className: "sm:m-3",
|
|
23066
|
+
// className: "sm:m-3",
|
|
22454
23067
|
appId: appId,
|
|
22455
23068
|
}
|
|
22456
23069
|
],
|
|
@@ -22465,7 +23078,7 @@ var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22465
23078
|
"actions": [
|
|
22466
23079
|
{
|
|
22467
23080
|
"actionType": "custom",
|
|
22468
|
-
"script": "window.Steedos && window.Steedos.setDocumentTitle && Steedos.setDocumentTitle({pageName: event.data.record.name})"
|
|
23081
|
+
"script": "window.Steedos && window.Steedos.setDocumentTitle && Steedos.setDocumentTitle({pageName: event.data.record.name}); $('.steedos-record-tr').removeClass('steedos-record-selected');$('.steedos-record-tr-'+event.data.record._id).addClass('steedos-record-selected');"
|
|
22469
23082
|
}
|
|
22470
23083
|
]
|
|
22471
23084
|
}
|
|
@@ -22544,7 +23157,21 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
22544
23157
|
"visibleOn": "${pageType !== 'record' && pageType !== 'list'}"
|
|
22545
23158
|
}
|
|
22546
23159
|
]
|
|
22547
|
-
}
|
|
23160
|
+
},
|
|
23161
|
+
// onEvent: {
|
|
23162
|
+
// "recordLoaded": {
|
|
23163
|
+
// "actions": [
|
|
23164
|
+
// {
|
|
23165
|
+
// "actionType": "setValue",
|
|
23166
|
+
// "args": {
|
|
23167
|
+
// "value": {
|
|
23168
|
+
// "steedos_selected_recordId": "${event.data.record._id}"
|
|
23169
|
+
// }
|
|
23170
|
+
// }
|
|
23171
|
+
// }
|
|
23172
|
+
// ]
|
|
23173
|
+
// }
|
|
23174
|
+
// }
|
|
22548
23175
|
}];
|
|
22549
23176
|
}
|
|
22550
23177
|
});
|
|
@@ -22576,6 +23203,7 @@ exports.AmisObjectTable = AmisObjectTable;
|
|
|
22576
23203
|
exports.AmisProvider = AmisProvider;
|
|
22577
23204
|
exports.AmisRecordDetail = AmisRecordDetail;
|
|
22578
23205
|
exports.AmisRecordDetailHeader = AmisRecordDetailHeader;
|
|
23206
|
+
exports.AmisRecordDetailMini = AmisRecordDetailMini;
|
|
22579
23207
|
exports.AmisRecordDetailRelatedList = AmisRecordDetailRelatedList;
|
|
22580
23208
|
exports.AmisRecordDetailRelatedLists = AmisRecordDetailRelatedLists;
|
|
22581
23209
|
exports.AmisRecordService = AmisRecordService;
|