@steedos-widgets/amis-object 3.6.2-beta.2 → 3.6.2-beta.21
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 +25 -14
- 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 +521 -236
- package/dist/amis-object.cjs.js +1835 -639
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +521 -236
- package/dist/amis-object.esm.js +1835 -640
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +521 -236
- package/dist/amis-object.umd.js +431 -241
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +21 -21
- package/dist/meta.js +507 -395
- 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,29 @@ 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
|
+
if(window.innerWidth <= 768){
|
|
3539
|
+
return "grid";
|
|
3540
|
+
}
|
|
3541
|
+
return value ? value : defaultDisplay;
|
|
3535
3542
|
},
|
|
3536
3543
|
|
|
3537
3544
|
setTabDisplayAs(tab_id, displayAs){
|
|
3538
3545
|
const key = `tab_${tab_id}_display`;
|
|
3539
|
-
|
|
3546
|
+
sessionStorage.setItem(key, displayAs);
|
|
3540
3547
|
},
|
|
3541
3548
|
getAppPath({formFactor, appId}){
|
|
3542
3549
|
return `/app/${appId}`;
|
|
@@ -3563,8 +3570,8 @@ const Router$1 = {
|
|
|
3563
3570
|
/*
|
|
3564
3571
|
* @Author: baozhoutao@steedos.com
|
|
3565
3572
|
* @Date: 2022-07-20 16:29:22
|
|
3566
|
-
* @LastEditors:
|
|
3567
|
-
* @LastEditTime:
|
|
3573
|
+
* @LastEditors: liaodaxue
|
|
3574
|
+
* @LastEditTime: 2024-01-25 14:44:17
|
|
3568
3575
|
* @Description:
|
|
3569
3576
|
*/
|
|
3570
3577
|
|
|
@@ -3636,11 +3643,30 @@ function getComparableAmisVersion() {
|
|
|
3636
3643
|
}
|
|
3637
3644
|
}
|
|
3638
3645
|
|
|
3646
|
+
/**
|
|
3647
|
+
* 判断浏览器类型
|
|
3648
|
+
* @returns 按需返回浏览器类型;
|
|
3649
|
+
*/
|
|
3650
|
+
function getBowserType() {
|
|
3651
|
+
const userAgent = navigator.userAgent;
|
|
3652
|
+
if (userAgent.indexOf("Chrome")!== -1 && userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Edg") === -1) {
|
|
3653
|
+
return "Chrome";
|
|
3654
|
+
} else if (userAgent.indexOf("Firefox") !== -1) {
|
|
3655
|
+
return "Firefox";
|
|
3656
|
+
} else if (userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Chrome") === -1 && userAgent.indexOf("Edge") === -1) {
|
|
3657
|
+
return "Safari";
|
|
3658
|
+
} else if (userAgent.indexOf("Edg") !== -1) {
|
|
3659
|
+
return "Edge";
|
|
3660
|
+
} else {
|
|
3661
|
+
return "Unknown browser"; // 其他浏览器...(可根据自己需要确定是否新增其他浏览器的判断)
|
|
3662
|
+
}
|
|
3663
|
+
}
|
|
3664
|
+
|
|
3639
3665
|
/*
|
|
3640
3666
|
* @Author: baozhoutao@steedos.com
|
|
3641
3667
|
* @Date: 2022-05-23 09:53:08
|
|
3642
3668
|
* @LastEditors: liaodaxue
|
|
3643
|
-
* @LastEditTime:
|
|
3669
|
+
* @LastEditTime: 2024-01-17 16:00:27
|
|
3644
3670
|
* @Description:
|
|
3645
3671
|
*/
|
|
3646
3672
|
|
|
@@ -3712,7 +3738,7 @@ function getSelectMap(selectOptions){
|
|
|
3712
3738
|
|
|
3713
3739
|
function getNameTplUrl(field, ctx){
|
|
3714
3740
|
if(ctx.objectName === 'cms_files'){
|
|
3715
|
-
return
|
|
3741
|
+
return "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}"
|
|
3716
3742
|
}
|
|
3717
3743
|
const href = Router$1.getObjectDetailPath({
|
|
3718
3744
|
...ctx, formFactor: ctx.formFactor, appId: "${appId}", objectName: ctx.objectName || "${objectName}", recordId: `\${${ctx.idFieldName}}`
|
|
@@ -4458,6 +4484,7 @@ var frontend_notifications$1 = "Notifications";
|
|
|
4458
4484
|
var frontend_notifications_allread$1 = "Mark all as read";
|
|
4459
4485
|
var frontend_notifications_allread_message$1 = "All marked as read";
|
|
4460
4486
|
var frontend_profile$1 = "Profile";
|
|
4487
|
+
var switch_space$1 = "Switch Space";
|
|
4461
4488
|
var frontend_about$1 = "About";
|
|
4462
4489
|
var frontend_log_out$1 = "Log out";
|
|
4463
4490
|
var frontend_listview_warning_start$1 = "The current ";
|
|
@@ -4545,6 +4572,7 @@ var en_us = {
|
|
|
4545
4572
|
frontend_notifications_allread: frontend_notifications_allread$1,
|
|
4546
4573
|
frontend_notifications_allread_message: frontend_notifications_allread_message$1,
|
|
4547
4574
|
frontend_profile: frontend_profile$1,
|
|
4575
|
+
switch_space: switch_space$1,
|
|
4548
4576
|
frontend_about: frontend_about$1,
|
|
4549
4577
|
frontend_log_out: frontend_log_out$1,
|
|
4550
4578
|
frontend_listview_warning_start: frontend_listview_warning_start$1,
|
|
@@ -4584,9 +4612,9 @@ var frontend_display_type_is_split = "分栏视图";
|
|
|
4584
4612
|
var frontend_display_as = "显示为";
|
|
4585
4613
|
var frontend_record_sum = "个项目";
|
|
4586
4614
|
var frontend_button_reload_tooltip = "刷新";
|
|
4587
|
-
var frontend_button_search_tooltip = "
|
|
4615
|
+
var frontend_button_search_tooltip = "搜索";
|
|
4588
4616
|
var frontend_fields_filter_button_search = "搜索";
|
|
4589
|
-
var frontend_fields_filter_button_settings = "
|
|
4617
|
+
var frontend_fields_filter_button_settings = "选择搜索项";
|
|
4590
4618
|
var frontend_button_listview_control_tooltip = "列表视图控制";
|
|
4591
4619
|
var frontend_button_listview_control_label = "列表视图控制";
|
|
4592
4620
|
var frontend_listview_control_columns = "显示的列";
|
|
@@ -4634,6 +4662,7 @@ var frontend_notifications = "通知";
|
|
|
4634
4662
|
var frontend_notifications_allread = "全部标记为已读";
|
|
4635
4663
|
var frontend_notifications_allread_message = "已全部标记为已读";
|
|
4636
4664
|
var frontend_profile = "个人资料";
|
|
4665
|
+
var switch_space = "切换工作区";
|
|
4637
4666
|
var frontend_about = "关于";
|
|
4638
4667
|
var frontend_log_out = "注销";
|
|
4639
4668
|
var frontend_listview_warning_start = "当前";
|
|
@@ -4722,6 +4751,7 @@ var zh_cn = {
|
|
|
4722
4751
|
frontend_notifications_allread: frontend_notifications_allread,
|
|
4723
4752
|
frontend_notifications_allread_message: frontend_notifications_allread_message,
|
|
4724
4753
|
frontend_profile: frontend_profile,
|
|
4754
|
+
switch_space: switch_space,
|
|
4725
4755
|
frontend_about: frontend_about,
|
|
4726
4756
|
frontend_log_out: frontend_log_out,
|
|
4727
4757
|
frontend_listview_warning_start: frontend_listview_warning_start,
|
|
@@ -5035,7 +5065,8 @@ async function getQuickEditSchema(field, options){
|
|
|
5035
5065
|
"failed": "失败了呢。。"
|
|
5036
5066
|
}
|
|
5037
5067
|
}
|
|
5038
|
-
}
|
|
5068
|
+
},
|
|
5069
|
+
"expression": "${!recordPermissions.modifyAllRecords}"
|
|
5039
5070
|
},
|
|
5040
5071
|
{
|
|
5041
5072
|
"actionType": "setValue",
|
|
@@ -5051,7 +5082,7 @@ async function getQuickEditSchema(field, options){
|
|
|
5051
5082
|
"componentId": quickEditId,
|
|
5052
5083
|
"args": {
|
|
5053
5084
|
"value":{
|
|
5054
|
-
"quickedit_record_permissions": "${event.data}"
|
|
5085
|
+
"quickedit_record_permissions": "${recordPermissions.modifyAllRecords ? {'allowEdit': true} : event.data}"
|
|
5055
5086
|
}
|
|
5056
5087
|
}
|
|
5057
5088
|
}
|
|
@@ -5115,7 +5146,7 @@ async function getQuickEditSchema(field, options){
|
|
|
5115
5146
|
`
|
|
5116
5147
|
}
|
|
5117
5148
|
},
|
|
5118
|
-
"expression":"${event.data.value}"
|
|
5149
|
+
"expression":"${event.data.value && !recordPermissions.modifyAllRecords}"
|
|
5119
5150
|
},
|
|
5120
5151
|
{
|
|
5121
5152
|
"actionType": "setValue",
|
|
@@ -5146,10 +5177,20 @@ async function getQuickEditSchema(field, options){
|
|
|
5146
5177
|
"script": `
|
|
5147
5178
|
const noPermission = event.data.noPermission;
|
|
5148
5179
|
const crudComponent = event.context.scoped.getComponentById("${options.crudId}");
|
|
5149
|
-
|
|
5180
|
+
let selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
|
|
5150
5181
|
noPermission.forEach(function (item) {
|
|
5151
5182
|
crudComponent && crudComponent.unSelectItem(_.find(selectedItems,{_id:item}));
|
|
5183
|
+
_.remove(selectedItems, (selected) => selected._id === item);
|
|
5152
5184
|
})
|
|
5185
|
+
doAction({
|
|
5186
|
+
"componentId": "${quickEditId}",
|
|
5187
|
+
"actionType": "setValue",
|
|
5188
|
+
"args": {
|
|
5189
|
+
"value": {
|
|
5190
|
+
selectedItems
|
|
5191
|
+
}
|
|
5192
|
+
}
|
|
5193
|
+
});
|
|
5153
5194
|
`
|
|
5154
5195
|
},
|
|
5155
5196
|
{
|
|
@@ -5210,7 +5251,7 @@ async function getQuickEditSchema(field, options){
|
|
|
5210
5251
|
}
|
|
5211
5252
|
|
|
5212
5253
|
function getFieldWidth(width){
|
|
5213
|
-
const defaultWidth =
|
|
5254
|
+
const defaultWidth = null;
|
|
5214
5255
|
if(typeof width == 'string'){
|
|
5215
5256
|
if(isNaN(width)){
|
|
5216
5257
|
return width || defaultWidth;
|
|
@@ -5240,18 +5281,35 @@ async function getTableColumns$1(fields, options){
|
|
|
5240
5281
|
//增加quickEdit属性,实现快速编辑
|
|
5241
5282
|
const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
|
|
5242
5283
|
let className = "";
|
|
5243
|
-
|
|
5284
|
+
const bowserType = getBowserType();
|
|
5285
|
+
if(bowserType === "Safari"){
|
|
5244
5286
|
className += " whitespace-nowrap ";
|
|
5245
5287
|
}else {
|
|
5246
|
-
|
|
5288
|
+
if(field.wrap != true){
|
|
5289
|
+
className += " whitespace-nowrap ";
|
|
5290
|
+
}else {
|
|
5291
|
+
className += " break-words ";
|
|
5292
|
+
}
|
|
5293
|
+
}
|
|
5294
|
+
|
|
5295
|
+
if (typeof field.amis?.className == "object") {
|
|
5296
|
+
className = {
|
|
5297
|
+
[className]: "true",
|
|
5298
|
+
...field.amis.className
|
|
5299
|
+
};
|
|
5300
|
+
} else if (typeof field.amis?.className == "string") {
|
|
5301
|
+
className = `${className} ${field.amis.className} `;
|
|
5247
5302
|
}
|
|
5303
|
+
let fieldAmis = _$1__namespace.clone(field.amis);
|
|
5304
|
+
delete fieldAmis?.className;
|
|
5305
|
+
|
|
5248
5306
|
let columnItem;
|
|
5249
5307
|
if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
|
|
5250
5308
|
const previewFileScript = `
|
|
5251
5309
|
var data = event.data;
|
|
5252
5310
|
var file_name = data.versions ? data.name : "${field.label}";
|
|
5253
|
-
var file_id = data._id;
|
|
5254
|
-
|
|
5311
|
+
var file_id = data.versions && data.versions[0] && data.versions[0]._id;
|
|
5312
|
+
window.previewFile && window.previewFile({file_name, file_id});
|
|
5255
5313
|
`;
|
|
5256
5314
|
columnItem = {
|
|
5257
5315
|
"type": "button",
|
|
@@ -5276,11 +5334,11 @@ async function getTableColumns$1(fields, options){
|
|
|
5276
5334
|
"expression": "!!!(window && window.nw && window.nw.require)"//浏览器上直接下载
|
|
5277
5335
|
},
|
|
5278
5336
|
{
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5337
|
+
"args": {},
|
|
5338
|
+
"actionType": "custom",
|
|
5339
|
+
"script": previewFileScript,
|
|
5340
|
+
// "expression": "!!window?.nw?.require" //PC客户端预览附件
|
|
5341
|
+
"expression": "!!(window && window.nw && window.nw.require)"//PC客户端预览附件
|
|
5284
5342
|
}
|
|
5285
5343
|
]
|
|
5286
5344
|
}
|
|
@@ -5295,7 +5353,7 @@ async function getTableColumns$1(fields, options){
|
|
|
5295
5353
|
toggled: field.toggled,
|
|
5296
5354
|
static: true,
|
|
5297
5355
|
className,
|
|
5298
|
-
},
|
|
5356
|
+
}, fieldAmis, {name: field.name});
|
|
5299
5357
|
}else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
|
|
5300
5358
|
columnItem = Object.assign({}, {
|
|
5301
5359
|
type: "switch",
|
|
@@ -5306,7 +5364,7 @@ async function getTableColumns$1(fields, options){
|
|
|
5306
5364
|
static: true,
|
|
5307
5365
|
className,
|
|
5308
5366
|
...getAmisFileReadonlySchema(field)
|
|
5309
|
-
},
|
|
5367
|
+
}, fieldAmis, {name: field.name});
|
|
5310
5368
|
}
|
|
5311
5369
|
else if(field.type === 'select'){
|
|
5312
5370
|
const map = getSelectMap(field.options);
|
|
@@ -5321,7 +5379,7 @@ async function getTableColumns$1(fields, options){
|
|
|
5321
5379
|
className,
|
|
5322
5380
|
inputClassName: "inline",
|
|
5323
5381
|
static: true,
|
|
5324
|
-
},
|
|
5382
|
+
}, fieldAmis, {name: field.name});
|
|
5325
5383
|
}
|
|
5326
5384
|
else {
|
|
5327
5385
|
const tpl = await getFieldTpl(field, options);
|
|
@@ -5340,23 +5398,14 @@ async function getTableColumns$1(fields, options){
|
|
|
5340
5398
|
if(field.type === 'textarea'){
|
|
5341
5399
|
className += 'min-w-56';
|
|
5342
5400
|
}
|
|
5343
|
-
if(field.type === 'date'){
|
|
5344
|
-
|
|
5345
|
-
}
|
|
5346
|
-
if(field.type === 'datetime'){
|
|
5347
|
-
|
|
5348
|
-
}
|
|
5401
|
+
// if(field.type === 'date'){
|
|
5402
|
+
// className += 'date-min-w';
|
|
5403
|
+
// }
|
|
5404
|
+
// if(field.type === 'datetime'){
|
|
5405
|
+
// className += 'datetime-min-w';
|
|
5406
|
+
// }
|
|
5349
5407
|
|
|
5350
5408
|
//field上的amis属性里的clssname需要单独判断类型合并
|
|
5351
|
-
if (typeof field.amis?.className == "object") {
|
|
5352
|
-
className = {
|
|
5353
|
-
[className]: "true",
|
|
5354
|
-
...field.amis.className
|
|
5355
|
-
};
|
|
5356
|
-
} else if (typeof field.amis?.className == "string") {
|
|
5357
|
-
className = `${className} ${field.amis.className} `;
|
|
5358
|
-
}
|
|
5359
|
-
delete field.amis?.className;
|
|
5360
5409
|
|
|
5361
5410
|
if(!field.hidden && !field.extra){
|
|
5362
5411
|
columnItem = Object.assign({}, {
|
|
@@ -5373,7 +5422,7 @@ async function getTableColumns$1(fields, options){
|
|
|
5373
5422
|
static: true,
|
|
5374
5423
|
options: field.type === 'html' ? {html: true} : null
|
|
5375
5424
|
// toggled: true
|
|
5376
|
-
},
|
|
5425
|
+
}, fieldAmis, {name: field.name});
|
|
5377
5426
|
|
|
5378
5427
|
if(field.type === 'color'){
|
|
5379
5428
|
columnItem.type = 'color';
|
|
@@ -5440,7 +5489,7 @@ function getMobileLines(tpls){
|
|
|
5440
5489
|
}
|
|
5441
5490
|
if(isLeft){
|
|
5442
5491
|
// 左侧半行
|
|
5443
|
-
lineChildrenClassName = "steedos-listview-item-left truncate";
|
|
5492
|
+
lineChildrenClassName = "steedos-listview-item-left truncate h-5";
|
|
5444
5493
|
if(item.field.is_wide){
|
|
5445
5494
|
// 左侧全行样式可以单独写,如果需要配置两行省略号效果,可以加样式类 two-lines-truncate
|
|
5446
5495
|
lineChildrenClassName = "steedos-listview-item-wide";
|
|
@@ -5452,7 +5501,7 @@ function getMobileLines(tpls){
|
|
|
5452
5501
|
}
|
|
5453
5502
|
else {
|
|
5454
5503
|
// 右侧半行,这里加样式类 flex flex-shrink-0,是为了省略号只显示在左半行,右半行文字一般比较短,如果也加省略号效果的话,左侧文字多的话,右侧没几个字就显示省略号了
|
|
5455
|
-
lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0";
|
|
5504
|
+
lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0 h-5";
|
|
5456
5505
|
}
|
|
5457
5506
|
//支持字段amis属性配置classname,识别classname的类型,与原样式合并
|
|
5458
5507
|
var className;
|
|
@@ -5563,8 +5612,16 @@ async function getMobileTableColumns(fields, options){
|
|
|
5563
5612
|
"actions": [
|
|
5564
5613
|
{
|
|
5565
5614
|
"script": `
|
|
5566
|
-
let cms_url =
|
|
5567
|
-
|
|
5615
|
+
let cms_url = '';
|
|
5616
|
+
let value = event.data.versions[0];
|
|
5617
|
+
if(value){
|
|
5618
|
+
if(value.url){
|
|
5619
|
+
cms_url = value.url;
|
|
5620
|
+
}else{
|
|
5621
|
+
cms_url = Steedos.absoluteUrl("/api/files/files/"+value+"?download=true");
|
|
5622
|
+
}
|
|
5623
|
+
}
|
|
5624
|
+
Steedos.cordovaDownload(encodeURI(cms_url), event.data.name);
|
|
5568
5625
|
`,
|
|
5569
5626
|
"actionType": "custom"
|
|
5570
5627
|
}
|
|
@@ -5679,7 +5736,8 @@ async function getTableOperation(ctx){
|
|
|
5679
5736
|
label: " ",
|
|
5680
5737
|
fixed: 'right',
|
|
5681
5738
|
labelClassName: 'text-center',
|
|
5682
|
-
|
|
5739
|
+
//TODO:目前3.6.3-patch.3版本中对于动态classname处理存在问题,简单处理固定列问题,等待amis解决crud的columns不支持动态classname的问题
|
|
5740
|
+
className: 'text-center steedos-listview-operation w-10 is-sticky is-sticky-right is-sticky-first-right',
|
|
5683
5741
|
buttons: [
|
|
5684
5742
|
{
|
|
5685
5743
|
"type": "steedos-dropdown-button",
|
|
@@ -5775,7 +5833,7 @@ async function getTableSchema$1(fields, options){
|
|
|
5775
5833
|
}
|
|
5776
5834
|
return {
|
|
5777
5835
|
mode: "cards",
|
|
5778
|
-
perPageAvailable: [
|
|
5836
|
+
perPageAvailable: [20, 50, 100, 500],
|
|
5779
5837
|
name: "thelist",
|
|
5780
5838
|
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
5781
5839
|
className: "",
|
|
@@ -5808,7 +5866,7 @@ async function getTableSchema$1(fields, options){
|
|
|
5808
5866
|
|
|
5809
5867
|
return {
|
|
5810
5868
|
mode: "table",
|
|
5811
|
-
perPageAvailable: [
|
|
5869
|
+
perPageAvailable: [20, 50, 100, 500],
|
|
5812
5870
|
name: "thelist",
|
|
5813
5871
|
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
5814
5872
|
className: "",
|
|
@@ -6063,6 +6121,21 @@ async function getTableApi(mainObject, fields, options){
|
|
|
6063
6121
|
return api;
|
|
6064
6122
|
`;
|
|
6065
6123
|
api.adaptor = `
|
|
6124
|
+
let fields = ${JSON.stringify(_$1__namespace.map(fields, 'name'))};
|
|
6125
|
+
// 这里把行数据中所有为空的字段值配置为空字符串,是因为amis有bug:crud的columns中的列如果type为static-前缀的话,行数据中该字段为空的话会显示为父作用域中同名变量值,见:https://github.com/baidu/amis/issues/9556
|
|
6126
|
+
(payload.data.rows || []).forEach((itemRow) => {
|
|
6127
|
+
(fields || []).forEach((itemField) => {
|
|
6128
|
+
if(itemField && itemField.indexOf(".") > -1){
|
|
6129
|
+
return;
|
|
6130
|
+
}
|
|
6131
|
+
if(itemField && (itemRow[itemField] === undefined || itemRow[itemField] === null)){
|
|
6132
|
+
// 这里itemRow中不存在 itemField 属性,或者值为null时都会有“显示为父作用域中的同名变量值”的问题,所以null和undefined都要重置为空字符串
|
|
6133
|
+
// 实测数字、下拉框、多选lookup等字段类型重置为空字符串都不会有问题,而且实测amis from组件的清空表单字段值功能就是把表单中的各种字段类型设置为空字符串,所以看起来也符合amis规范
|
|
6134
|
+
itemRow[itemField] = "";
|
|
6135
|
+
}
|
|
6136
|
+
});
|
|
6137
|
+
});
|
|
6138
|
+
|
|
6066
6139
|
if(api.body.listName == "recent"){
|
|
6067
6140
|
payload.data.rows = _.sortBy(payload.data.rows, function(item){
|
|
6068
6141
|
return _.indexOf(api.body._ids, item._id)
|
|
@@ -6087,7 +6160,13 @@ async function getTableApi(mainObject, fields, options){
|
|
|
6087
6160
|
value = [value]
|
|
6088
6161
|
};
|
|
6089
6162
|
if(field.type === 'file'){
|
|
6090
|
-
item[key] = value
|
|
6163
|
+
// item[key] = value
|
|
6164
|
+
// PC客户端附件子表列表点击标题预览附件功能依赖了_id,所以这里拼出来
|
|
6165
|
+
let itemKeyValue = item[key];
|
|
6166
|
+
item[key] = value.map(function(item, index){
|
|
6167
|
+
item._id = itemKeyValue[index];
|
|
6168
|
+
return item;
|
|
6169
|
+
});
|
|
6091
6170
|
}else{
|
|
6092
6171
|
item[key] = _.map(value, (item)=>{
|
|
6093
6172
|
if(field.type === 'image'){
|
|
@@ -6129,15 +6208,8 @@ async function getTableApi(mainObject, fields, options){
|
|
|
6129
6208
|
}
|
|
6130
6209
|
});
|
|
6131
6210
|
};
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
isTreeOptionsComputed = true;
|
|
6135
|
-
}
|
|
6136
|
-
if(!isTreeOptionsComputed){
|
|
6137
|
-
// 如果api接口设置在缓存,缓存期间并不会重新请求接口,payload.data.rows是上次计算后的结果
|
|
6138
|
-
payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
|
|
6139
|
-
assignIndexToTreeRecords(payload.data.rows, '');
|
|
6140
|
-
}
|
|
6211
|
+
payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
|
|
6212
|
+
assignIndexToTreeRecords(payload.data.rows, '');
|
|
6141
6213
|
}
|
|
6142
6214
|
|
|
6143
6215
|
|
|
@@ -6194,12 +6266,15 @@ async function getTableApi(mainObject, fields, options){
|
|
|
6194
6266
|
}
|
|
6195
6267
|
// SteedosUI.getRef(api.body.$self.$scopeId)?.parent?.getComponentById(setDataToComponentId)?.setData({$count: payload.data.count})
|
|
6196
6268
|
};
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6269
|
+
let formFactor = "${options.formFactor}";
|
|
6270
|
+
if(formFactor !== "SMALL"){
|
|
6271
|
+
const listviewComponent = $(".steedos-object-listview .antd-Table-table");
|
|
6272
|
+
const firstListviewComponent = listviewComponent && listviewComponent[0];
|
|
6273
|
+
if(firstListviewComponent){
|
|
6274
|
+
setTimeout(()=>{
|
|
6275
|
+
firstListviewComponent.scrollIntoView();
|
|
6276
|
+
}, 600);
|
|
6277
|
+
}
|
|
6203
6278
|
}
|
|
6204
6279
|
${options.adaptor || ''}
|
|
6205
6280
|
return payload;
|
|
@@ -6312,12 +6387,21 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
6312
6387
|
}
|
|
6313
6388
|
payload.data = data;
|
|
6314
6389
|
payload.data.__objectName = "${object.name}";
|
|
6315
|
-
payload.data.
|
|
6390
|
+
payload.data.record = record;
|
|
6391
|
+
|
|
6392
|
+
payload.data.NAME_FIELD_VALUE = record.${object.NAME_FIELD_KEY || 'name'};
|
|
6393
|
+
payload.data._master = {
|
|
6394
|
+
record: record,
|
|
6395
|
+
objectName: "${object.name}",
|
|
6396
|
+
recordId: record._id
|
|
6397
|
+
}
|
|
6316
6398
|
window.postMessage(Object.assign({type: "record.loaded"}, {record: record}), "*")
|
|
6317
6399
|
}
|
|
6318
6400
|
if(payload.errors){
|
|
6319
6401
|
payload.status = 2;
|
|
6320
6402
|
payload.msg = payload.errors[0].message;
|
|
6403
|
+
}else{
|
|
6404
|
+
payload.data.recordLoaded = true;
|
|
6321
6405
|
}
|
|
6322
6406
|
${options && options.initApiAdaptor || ''}
|
|
6323
6407
|
return payload;
|
|
@@ -6460,7 +6544,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
6460
6544
|
cache: API_CACHE,
|
|
6461
6545
|
requestAdaptor: `
|
|
6462
6546
|
// 所有不想在network请求中发送的数据都应该从data中分离出来,data变量只需要留下query才需要发送出去
|
|
6463
|
-
var { recordId, objectName, uiSchema, global, context, ...data} = api.data;
|
|
6547
|
+
var { recordId, objectName, uiSchema, global, context, _master, ...data} = api.data;
|
|
6464
6548
|
if(!recordId){
|
|
6465
6549
|
// 新建则不请求任何数据
|
|
6466
6550
|
data.query = "{data:" + objectName + "(filters: " + JSON.stringify(["_id", "=", null]) + ", top: 1){_id}}";
|
|
@@ -6538,10 +6622,11 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
6538
6622
|
...initialValues
|
|
6539
6623
|
}
|
|
6540
6624
|
${options.initApiAdaptor || ''}
|
|
6625
|
+
// console.log('getEditFormInitApi======>', payload);
|
|
6541
6626
|
return payload;
|
|
6542
6627
|
`,
|
|
6543
6628
|
responseData: {
|
|
6544
|
-
|
|
6629
|
+
"&": "$$",
|
|
6545
6630
|
editFormInited: true
|
|
6546
6631
|
},
|
|
6547
6632
|
data: data,
|
|
@@ -6580,6 +6665,18 @@ function getBatchDelete(objectName){
|
|
|
6580
6665
|
return {
|
|
6581
6666
|
method: 'post',
|
|
6582
6667
|
url: getApi$2(),
|
|
6668
|
+
adaptor: `
|
|
6669
|
+
if(payload.errors){
|
|
6670
|
+
payload.data.deleteErrorMessage = [];
|
|
6671
|
+
payload.errors.forEach(function(error){
|
|
6672
|
+
let errorRecord = error.path.map(function (item) {
|
|
6673
|
+
return item.split('delete__')[1].to_float() + 1;
|
|
6674
|
+
}).toString();
|
|
6675
|
+
payload.data.deleteErrorMessage.push("第" + errorRecord + "条记录删除出现异常,报错信息为(" + (window.t ? window.t(error.message) : error.message) + ")");
|
|
6676
|
+
})
|
|
6677
|
+
}
|
|
6678
|
+
return payload;
|
|
6679
|
+
`,
|
|
6583
6680
|
requestAdaptor: `
|
|
6584
6681
|
var ids = api.data.ids.split(",");
|
|
6585
6682
|
var deleteArray = [];
|
|
@@ -7374,7 +7471,7 @@ async function getListBody(fields, options){
|
|
|
7374
7471
|
|
|
7375
7472
|
function getDefaultParams(options){
|
|
7376
7473
|
return {
|
|
7377
|
-
perPage: options.top || options.perPage ||
|
|
7474
|
+
perPage: options.top || options.perPage || 20
|
|
7378
7475
|
}
|
|
7379
7476
|
}
|
|
7380
7477
|
|
|
@@ -7577,7 +7674,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
7577
7674
|
"objectApiName": "\${objectName}",
|
|
7578
7675
|
"recordId": "",
|
|
7579
7676
|
"mode": "edit",
|
|
7580
|
-
"layout": "normal"
|
|
7581
7677
|
};
|
|
7582
7678
|
|
|
7583
7679
|
if (payload && payload.schema) {
|
|
@@ -8009,9 +8105,16 @@ const getSchema$2 = (uiSchema) => {
|
|
|
8009
8105
|
"form": {
|
|
8010
8106
|
debug: false,
|
|
8011
8107
|
resetAfterSubmit: false,
|
|
8108
|
+
data: {
|
|
8109
|
+
editFormInited: true,
|
|
8110
|
+
},
|
|
8012
8111
|
initApi: {
|
|
8112
|
+
method: 'GET',
|
|
8013
8113
|
url: '/api/v1/queue_import_history/${recordId}?fields=["state"]',
|
|
8014
8114
|
sendOn: 'this.recordId',
|
|
8115
|
+
data: null,
|
|
8116
|
+
requestAdaptor: "return api;",
|
|
8117
|
+
adaptor: "return payload;",
|
|
8015
8118
|
responseData: {
|
|
8016
8119
|
importState: "${state}"
|
|
8017
8120
|
}
|
|
@@ -8282,7 +8385,7 @@ const StandardButtons = {
|
|
|
8282
8385
|
}
|
|
8283
8386
|
};
|
|
8284
8387
|
|
|
8285
|
-
const getGlobalData
|
|
8388
|
+
const getGlobalData = () => {
|
|
8286
8389
|
return {
|
|
8287
8390
|
now: new Date(),
|
|
8288
8391
|
};
|
|
@@ -8341,7 +8444,7 @@ const getButtonVisible = (button, ctx) => {
|
|
|
8341
8444
|
button._visible,
|
|
8342
8445
|
props.record,
|
|
8343
8446
|
"#",
|
|
8344
|
-
getGlobalData
|
|
8447
|
+
getGlobalData(),
|
|
8345
8448
|
props.userSession
|
|
8346
8449
|
);
|
|
8347
8450
|
};
|
|
@@ -8883,7 +8986,7 @@ async function getObjectFieldsFilterFormSchema(ctx) {
|
|
|
8883
8986
|
const formSchema = {
|
|
8884
8987
|
"type": "service",
|
|
8885
8988
|
"visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
|
|
8886
|
-
"className": ctx.formFactor === 'SMALL' ? "slds-filters__body p-0 mb-2 overflow-y-auto overflow-x-hidden" : "slds-filters__body p-0 sm:grid sm:gap-
|
|
8989
|
+
"className": ctx.formFactor === 'SMALL' ? "slds-filters__body p-0 mb-2 overflow-y-auto overflow-x-hidden" : "slds-filters__body p-0 sm:grid sm:gap-4 sm:grid-cols-4 p-2",
|
|
8887
8990
|
"style":{
|
|
8888
8991
|
"max-height":ctx.formFactor === 'SMALL'?"30vh":"unset"
|
|
8889
8992
|
},
|
|
@@ -9470,7 +9573,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
9470
9573
|
"className": "slds-filters"
|
|
9471
9574
|
},
|
|
9472
9575
|
"size": "xs",
|
|
9473
|
-
"className": `border-
|
|
9576
|
+
"className": `border-y slds-grid slds-grid_vertical slds-nowrap ${!ctx.isLookup && "mt-2"}`,
|
|
9474
9577
|
"visibleOn": "this.showFieldsFilter",
|
|
9475
9578
|
},
|
|
9476
9579
|
"className": "bg-white"
|
|
@@ -9658,7 +9761,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
9658
9761
|
"icon": "fa fa-refresh",
|
|
9659
9762
|
"actionType": "reload",
|
|
9660
9763
|
"target": amisListViewId,
|
|
9661
|
-
"className": "bg-white p-2 rounded
|
|
9764
|
+
"className": "bg-white p-2 rounded text-gray-500"
|
|
9662
9765
|
},
|
|
9663
9766
|
fieldsFilterButtonSchema,
|
|
9664
9767
|
// {
|
|
@@ -9666,7 +9769,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
9666
9769
|
// "label": "",
|
|
9667
9770
|
// "icon": "fa fa-filter",
|
|
9668
9771
|
// "actionType": "custom",
|
|
9669
|
-
// "className": "bg-transparent p-2 rounded
|
|
9772
|
+
// "className": "bg-transparent p-2 rounded text-gray-500",
|
|
9670
9773
|
// "id": "u:c20cb87d96c9",
|
|
9671
9774
|
// "onEvent": {
|
|
9672
9775
|
// "click": {
|
|
@@ -9714,11 +9817,53 @@ function getObjectListHeader$1(objectSchema, listViewName, ctx) {
|
|
|
9714
9817
|
let headerSchema = [{
|
|
9715
9818
|
"type": "wrapper",
|
|
9716
9819
|
"body": body,
|
|
9717
|
-
"className": `
|
|
9820
|
+
"className": `sm:rounded-tl sm:rounded-tr p-4 -mb-4`
|
|
9718
9821
|
}];
|
|
9719
9822
|
return headerSchema;
|
|
9720
9823
|
}
|
|
9721
9824
|
|
|
9825
|
+
function getBackButtonSchema(){
|
|
9826
|
+
return {
|
|
9827
|
+
"type": "service",
|
|
9828
|
+
"onEvent": {
|
|
9829
|
+
"@history_paths.changed": {
|
|
9830
|
+
"actions": [
|
|
9831
|
+
{
|
|
9832
|
+
"actionType": "reload",
|
|
9833
|
+
// amis 3.6需要传入data来触发下面的window:historyPaths重新计算,此问题随机偶发,加上data后正常
|
|
9834
|
+
"data": {
|
|
9835
|
+
}
|
|
9836
|
+
}
|
|
9837
|
+
]
|
|
9838
|
+
}
|
|
9839
|
+
},
|
|
9840
|
+
"body":[{
|
|
9841
|
+
"type": "button",
|
|
9842
|
+
"visibleOn": "${window:innerWidth > 768 && (window:historyPaths.length > 1 || window:historyPaths[0].params.record_id) && display !== 'split'}",
|
|
9843
|
+
"className":"flex mr-4",
|
|
9844
|
+
"onEvent": {
|
|
9845
|
+
"click": {
|
|
9846
|
+
"actions": [
|
|
9847
|
+
{
|
|
9848
|
+
"actionType": "custom",
|
|
9849
|
+
"script": "window.goBack()"
|
|
9850
|
+
}
|
|
9851
|
+
]
|
|
9852
|
+
}
|
|
9853
|
+
},
|
|
9854
|
+
"body": [
|
|
9855
|
+
{
|
|
9856
|
+
"type": "steedos-icon",
|
|
9857
|
+
"category": "utility",
|
|
9858
|
+
"name": "back",
|
|
9859
|
+
"colorVariant": "default",
|
|
9860
|
+
"className": "slds-button_icon slds-global-header__icon w-4"
|
|
9861
|
+
}
|
|
9862
|
+
]
|
|
9863
|
+
}]
|
|
9864
|
+
}
|
|
9865
|
+
}
|
|
9866
|
+
|
|
9722
9867
|
/**
|
|
9723
9868
|
* 记录详细界面顶部头amisSchema,也是标题面板组件的amisSchema
|
|
9724
9869
|
* @param {*} objectSchema 对象UISchema
|
|
@@ -9727,11 +9872,21 @@ function getObjectListHeader$1(objectSchema, listViewName, ctx) {
|
|
|
9727
9872
|
* @returns amisSchema
|
|
9728
9873
|
*/
|
|
9729
9874
|
async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
9875
|
+
// console.log(`getObjectRecordDetailHeader====>`, options)
|
|
9730
9876
|
const { showRecordTitle = true } = options || {};
|
|
9731
9877
|
// console.log('getObjectRecordDetailHeader==>', objectSchema, recordId)
|
|
9732
9878
|
const { name, label, icon, NAME_FIELD_KEY } = objectSchema;
|
|
9733
9879
|
|
|
9734
|
-
let amisButtonsSchema =
|
|
9880
|
+
let amisButtonsSchema = [];
|
|
9881
|
+
if(options.showButtons != false){
|
|
9882
|
+
amisButtonsSchema = getObjectDetailButtonsSchemas(objectSchema, recordId, options);
|
|
9883
|
+
}
|
|
9884
|
+
|
|
9885
|
+
let backButtonsSchema = null;
|
|
9886
|
+
|
|
9887
|
+
if(options.showBackButton != false){
|
|
9888
|
+
backButtonsSchema = getBackButtonSchema();
|
|
9889
|
+
}
|
|
9735
9890
|
|
|
9736
9891
|
// console.log(`getObjectRecordDetailHeader==>`, amisButtonsSchema)
|
|
9737
9892
|
|
|
@@ -9746,45 +9901,9 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
9746
9901
|
"type": "grid",
|
|
9747
9902
|
"columns": [
|
|
9748
9903
|
{
|
|
9749
|
-
"body": [
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
"@history_paths.changed": {
|
|
9753
|
-
"actions": [
|
|
9754
|
-
{
|
|
9755
|
-
"actionType": "reload",
|
|
9756
|
-
// amis 3.6需要传入data来触发下面的window:historyPaths重新计算,此问题随机偶发,加上data后正常
|
|
9757
|
-
"data": {
|
|
9758
|
-
}
|
|
9759
|
-
}
|
|
9760
|
-
]
|
|
9761
|
-
}
|
|
9762
|
-
},
|
|
9763
|
-
"body":[{
|
|
9764
|
-
"type": "button",
|
|
9765
|
-
"visibleOn": "${window:innerWidth > 768 && (window:historyPaths.length > 1 || window:historyPaths[0].params.record_id) && display !== 'split'}",
|
|
9766
|
-
"className":"flex mr-4",
|
|
9767
|
-
"onEvent": {
|
|
9768
|
-
"click": {
|
|
9769
|
-
"actions": [
|
|
9770
|
-
{
|
|
9771
|
-
"actionType": "custom",
|
|
9772
|
-
"script": "window.goBack()"
|
|
9773
|
-
}
|
|
9774
|
-
]
|
|
9775
|
-
}
|
|
9776
|
-
},
|
|
9777
|
-
"body": [
|
|
9778
|
-
{
|
|
9779
|
-
"type": "steedos-icon",
|
|
9780
|
-
"category": "utility",
|
|
9781
|
-
"name": "back",
|
|
9782
|
-
"colorVariant": "default",
|
|
9783
|
-
"className": "slds-button_icon slds-global-header__icon w-4"
|
|
9784
|
-
}
|
|
9785
|
-
]
|
|
9786
|
-
}]
|
|
9787
|
-
},{
|
|
9904
|
+
"body": [
|
|
9905
|
+
backButtonsSchema
|
|
9906
|
+
,{
|
|
9788
9907
|
"type": "tpl",
|
|
9789
9908
|
"className": "block",
|
|
9790
9909
|
// "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'>`
|
|
@@ -9805,8 +9924,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
9805
9924
|
},
|
|
9806
9925
|
{
|
|
9807
9926
|
"type": "tpl",
|
|
9808
|
-
"tpl": "${
|
|
9809
|
-
// "tpl": "${(record && uiSchema && record[uiSchema.NAME_FIELD_KEY]) || name}",
|
|
9927
|
+
"tpl": "${NAME_FIELD_VALUE}",
|
|
9810
9928
|
"inline": false,
|
|
9811
9929
|
"wrapperComponent": "",
|
|
9812
9930
|
"className": "record-detail-header-name leading-5 text-xl font-bold"
|
|
@@ -9834,7 +9952,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
9834
9952
|
let body = [
|
|
9835
9953
|
{
|
|
9836
9954
|
"type": "wrapper",
|
|
9837
|
-
"className": "p-
|
|
9955
|
+
"className": "p-4 border-b",
|
|
9838
9956
|
"body": [
|
|
9839
9957
|
{
|
|
9840
9958
|
"type": "grid",
|
|
@@ -9849,7 +9967,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
9849
9967
|
if(showRecordTitle){
|
|
9850
9968
|
body.push({
|
|
9851
9969
|
"type": "wrapper",
|
|
9852
|
-
"className": "p-
|
|
9970
|
+
"className": "p-4",
|
|
9853
9971
|
"body": [
|
|
9854
9972
|
{
|
|
9855
9973
|
"type": "grid",
|
|
@@ -9861,11 +9979,76 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
9861
9979
|
});
|
|
9862
9980
|
}
|
|
9863
9981
|
|
|
9982
|
+
let max = 10;
|
|
9983
|
+
if(options.formFactor === 'SMALL'){
|
|
9984
|
+
max = 4;
|
|
9985
|
+
}else {
|
|
9986
|
+
|
|
9987
|
+
let divWidth = window.innerWidth;
|
|
9988
|
+
|
|
9989
|
+
if(options.display === 'split'){
|
|
9990
|
+
divWidth = divWidth - 388;
|
|
9991
|
+
}
|
|
9992
|
+
|
|
9993
|
+
if(document.body.classList.contains('sidebar')){
|
|
9994
|
+
divWidth = divWidth - 210;
|
|
9995
|
+
}
|
|
9996
|
+
|
|
9997
|
+
// 根据屏幕宽度计算显示数量, 使高亮字段只占1行
|
|
9998
|
+
max = Math.trunc(divWidth / 200 );
|
|
9999
|
+
if(max > 10){
|
|
10000
|
+
max = 10;
|
|
10001
|
+
}
|
|
10002
|
+
}
|
|
10003
|
+
|
|
10004
|
+
// console.log('=======================max=========================', max)
|
|
10005
|
+
|
|
10006
|
+
if(objectSchema.compactLayouts){
|
|
10007
|
+
const details = [];
|
|
10008
|
+
_.each(_.slice(_.difference(objectSchema.compactLayouts, [objectSchema.NAME_FIELD_KEY]), 0, max), (fieldName)=>{
|
|
10009
|
+
const field = objectSchema.fields[fieldName];
|
|
10010
|
+
if(field){
|
|
10011
|
+
details.push({
|
|
10012
|
+
type: 'steedos-field',
|
|
10013
|
+
static: true,
|
|
10014
|
+
config: field,
|
|
10015
|
+
});
|
|
10016
|
+
}
|
|
10017
|
+
});
|
|
10018
|
+
|
|
10019
|
+
// 注意: 以下注释不能删除. tailwind css 动态编译时会识别以下注释, 生成对应的样式
|
|
10020
|
+
// lg:grid-cols-1
|
|
10021
|
+
// lg:grid-cols-2
|
|
10022
|
+
// lg:grid-cols-3
|
|
10023
|
+
// lg:grid-cols-4
|
|
10024
|
+
// lg:grid-cols-5
|
|
10025
|
+
// lg:grid-cols-6
|
|
10026
|
+
// lg:grid-cols-7
|
|
10027
|
+
// lg:grid-cols-8
|
|
10028
|
+
// lg:grid-cols-9
|
|
10029
|
+
// lg:grid-cols-10
|
|
10030
|
+
// lg:grid-cols-11
|
|
10031
|
+
// lg:grid-cols-12
|
|
10032
|
+
|
|
10033
|
+
body.push({
|
|
10034
|
+
"type": "wrapper",
|
|
10035
|
+
"body": {
|
|
10036
|
+
"type": "form",
|
|
10037
|
+
// "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
|
|
10038
|
+
"className": `gap-2 grid grid-cols-1 lg:grid-cols-${max}`,
|
|
10039
|
+
"wrapWithPanel": false,
|
|
10040
|
+
"actions": [],
|
|
10041
|
+
"body": details,
|
|
10042
|
+
"hiddenOn": "${recordLoaded != true}"
|
|
10043
|
+
},
|
|
10044
|
+
"className": "steedos-record-compact-layouts p-4 bg-white compact-layouts border-b"
|
|
10045
|
+
});
|
|
10046
|
+
}
|
|
10047
|
+
|
|
9864
10048
|
return {
|
|
9865
10049
|
type: 'service',
|
|
9866
10050
|
id: `page_readonly_${name}_header`,
|
|
9867
10051
|
name: `page`,
|
|
9868
|
-
data: { objectName: name, _id: recordId, recordPermissions: objectSchema.permissions, uiSchema: objectSchema, record: "${record}" },
|
|
9869
10052
|
body: body,
|
|
9870
10053
|
className: ''
|
|
9871
10054
|
}
|
|
@@ -9937,7 +10120,7 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
9937
10120
|
"className": "flex justify-between"
|
|
9938
10121
|
}
|
|
9939
10122
|
],
|
|
9940
|
-
"className": "
|
|
10123
|
+
"className": "steedos-record-related-header py-2 px-3 bg-gray-50 border"
|
|
9941
10124
|
};
|
|
9942
10125
|
return recordRelatedListHeader;
|
|
9943
10126
|
}
|
|
@@ -10895,7 +11078,7 @@ const getSettingListviewToolbarButtonSchema = ()=>{
|
|
|
10895
11078
|
"icon": "fa fa-cog",
|
|
10896
11079
|
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
10897
11080
|
// "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
|
|
10898
|
-
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded
|
|
11081
|
+
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
|
|
10899
11082
|
"align": "right",
|
|
10900
11083
|
"visibleOn": "${!isLookup}",
|
|
10901
11084
|
"buttons": [
|
|
@@ -10922,14 +11105,14 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
|
10922
11105
|
{
|
|
10923
11106
|
"type": "button",
|
|
10924
11107
|
"label": instance.t('frontend_display_type_is_table'),
|
|
10925
|
-
"onClick": "const key = 'tab_"+objectName+"_display';
|
|
11108
|
+
"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');",
|
|
10926
11109
|
"rightIcon": displayAs != 'split' ? "fa fa-check" : null,
|
|
10927
11110
|
"rightIconClassName": "m-l-sm"
|
|
10928
11111
|
},
|
|
10929
11112
|
{
|
|
10930
11113
|
"type": "button",
|
|
10931
11114
|
"label": instance.t('frontend_display_type_is_split'),
|
|
10932
|
-
"onClick": "const key = 'tab_"+objectName+"_display';
|
|
11115
|
+
"onClick": "const key = 'tab_"+objectName+"_display';sessionStorage.setItem(key, 'split');const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
|
|
10933
11116
|
"rightIcon": displayAs === 'split' ? "fa fa-check" : null,
|
|
10934
11117
|
"rightIconClassName": "m-l-sm"
|
|
10935
11118
|
}
|
|
@@ -10940,7 +11123,7 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
|
10940
11123
|
"icon": "fa fa-table-columns",
|
|
10941
11124
|
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
10942
11125
|
// "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
|
|
10943
|
-
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded
|
|
11126
|
+
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
|
|
10944
11127
|
"align": "right",
|
|
10945
11128
|
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
10946
11129
|
"buttons": [
|
|
@@ -11072,7 +11255,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
11072
11255
|
{
|
|
11073
11256
|
"type": "search-box",
|
|
11074
11257
|
"name": keywordsSearchBoxName,
|
|
11075
|
-
"placeholder": "
|
|
11258
|
+
"placeholder": "快捷搜索",
|
|
11076
11259
|
"value": crudKeywords,
|
|
11077
11260
|
// "clearable": true,//因为清除并不会触发失去焦点事件,只有禁用,但是它会触发change事件,所以等升级到amis 3.4+后可以重新放开
|
|
11078
11261
|
"clearAndSubmit": true,
|
|
@@ -11133,7 +11316,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
11133
11316
|
// //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
11134
11317
|
// // "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
11135
11318
|
// "tooltipPlacement": "top",
|
|
11136
|
-
// "className": "bg-white p-2 rounded
|
|
11319
|
+
// "className": "bg-white p-2 rounded text-gray-500",
|
|
11137
11320
|
// "label": "",
|
|
11138
11321
|
// "icon": "fa fa-sync",
|
|
11139
11322
|
// "visibleOn": "${!showFieldsFilter}",
|
|
@@ -11157,7 +11340,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
11157
11340
|
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
11158
11341
|
"tooltip":"",
|
|
11159
11342
|
"tooltipPlacement": "top",
|
|
11160
|
-
"className": "bg-white p-2 rounded
|
|
11343
|
+
"className": "bg-white p-2 rounded text-gray-500"
|
|
11161
11344
|
};
|
|
11162
11345
|
}
|
|
11163
11346
|
else {
|
|
@@ -11168,7 +11351,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
11168
11351
|
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
11169
11352
|
"tooltip":"",
|
|
11170
11353
|
"tooltipPlacement": "top",
|
|
11171
|
-
"className": "bg-white p-2 rounded
|
|
11354
|
+
"className": "bg-white p-2 rounded text-gray-500"
|
|
11172
11355
|
};
|
|
11173
11356
|
}
|
|
11174
11357
|
let toolbarFilter;
|
|
@@ -11190,7 +11373,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
11190
11373
|
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
11191
11374
|
},
|
|
11192
11375
|
"align": "right",
|
|
11193
|
-
"className": "bg-white p-2 rounded
|
|
11376
|
+
"className": "bg-white p-2 rounded text-gray-500",
|
|
11194
11377
|
"onEvent": {
|
|
11195
11378
|
"click": {
|
|
11196
11379
|
"actions": [
|
|
@@ -11276,7 +11459,10 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
11276
11459
|
// ]
|
|
11277
11460
|
if(options.displayAs === 'split'){
|
|
11278
11461
|
return [
|
|
11279
|
-
|
|
11462
|
+
{
|
|
11463
|
+
"type": "switch-per-page",
|
|
11464
|
+
"visibleOn": "${count >= 20}"
|
|
11465
|
+
},
|
|
11280
11466
|
{
|
|
11281
11467
|
"type": "pagination",
|
|
11282
11468
|
"maxButtons": 5,
|
|
@@ -11298,7 +11484,6 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
11298
11484
|
else {
|
|
11299
11485
|
if(options && options.isRelated){
|
|
11300
11486
|
return [
|
|
11301
|
-
"statistics",
|
|
11302
11487
|
{
|
|
11303
11488
|
"type": "pagination",
|
|
11304
11489
|
"maxButtons": 10,
|
|
@@ -11311,7 +11496,6 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
11311
11496
|
const no_pagination = mainObject.paging && (mainObject.paging.enabled === false);
|
|
11312
11497
|
const is_lookup = options.isLookup;
|
|
11313
11498
|
const commonConfig = [
|
|
11314
|
-
"statistics",
|
|
11315
11499
|
{
|
|
11316
11500
|
"type": "pagination",
|
|
11317
11501
|
"maxButtons": 10,
|
|
@@ -11322,7 +11506,10 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
11322
11506
|
if (no_pagination && is_lookup) {
|
|
11323
11507
|
return commonConfig;
|
|
11324
11508
|
} else {
|
|
11325
|
-
return [
|
|
11509
|
+
return [{
|
|
11510
|
+
"type": "switch-per-page",
|
|
11511
|
+
"visibleOn": "${count >= 20}"
|
|
11512
|
+
}, ...commonConfig];
|
|
11326
11513
|
}
|
|
11327
11514
|
}
|
|
11328
11515
|
}
|
|
@@ -11346,7 +11533,6 @@ async function getObjectFilter(objectSchema, fields, options) {
|
|
|
11346
11533
|
"timeOut": 1000
|
|
11347
11534
|
}
|
|
11348
11535
|
});
|
|
11349
|
-
resizeWindow();
|
|
11350
11536
|
const scope = event.context.scoped;
|
|
11351
11537
|
// let filterFormValues = event.data;
|
|
11352
11538
|
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
@@ -11430,6 +11616,29 @@ function getBulkActions(objectSchema){
|
|
|
11430
11616
|
"className": "hidden",
|
|
11431
11617
|
"id": "batchDelete",
|
|
11432
11618
|
"api": getBatchDelete(objectSchema.name),
|
|
11619
|
+
"feedback": {
|
|
11620
|
+
"title": "删除警告",
|
|
11621
|
+
"visibleOn": "${deleteErrorMessage}",
|
|
11622
|
+
"body": [
|
|
11623
|
+
{
|
|
11624
|
+
"type": "each",
|
|
11625
|
+
"name": "deleteErrorMessage",
|
|
11626
|
+
"items": {
|
|
11627
|
+
"type": "alert",
|
|
11628
|
+
"body": "${item}",
|
|
11629
|
+
"level": "danger",
|
|
11630
|
+
"className": "mb-3"
|
|
11631
|
+
}
|
|
11632
|
+
}
|
|
11633
|
+
],
|
|
11634
|
+
"actions": [
|
|
11635
|
+
{
|
|
11636
|
+
"type": "button",
|
|
11637
|
+
"actionType": "close",
|
|
11638
|
+
"label": "关闭"
|
|
11639
|
+
}
|
|
11640
|
+
]
|
|
11641
|
+
}
|
|
11433
11642
|
}
|
|
11434
11643
|
// {
|
|
11435
11644
|
// "label": "批量修改",
|
|
@@ -11490,7 +11699,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11490
11699
|
const bodyProps = {
|
|
11491
11700
|
// toolbar: getToolbar(),
|
|
11492
11701
|
// headerToolbar: getObjectHeaderToolbar(objectSchema, options.formFactor, {showDisplayAs}),
|
|
11493
|
-
headerToolbarClassName: "px-4 py-2 border-
|
|
11702
|
+
headerToolbarClassName: "px-4 py-2 border-b",
|
|
11494
11703
|
footerToolbar: getObjectFooterToolbar(objectSchema, options.formFactor, {
|
|
11495
11704
|
...options,
|
|
11496
11705
|
disableStatistics: options.queryCount === false
|
|
@@ -11626,7 +11835,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11626
11835
|
// "is-steedos-crud-data-empty": "${!items || COUNT(items) == 0}"
|
|
11627
11836
|
// },
|
|
11628
11837
|
bodyClassName: {
|
|
11629
|
-
"
|
|
11838
|
+
"mb-0": true,
|
|
11630
11839
|
"is-steedos-crud-data-empty": "${!items || COUNT(items) == 0}"
|
|
11631
11840
|
},
|
|
11632
11841
|
crudClassName: crudClassName,
|
|
@@ -11637,16 +11846,11 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11637
11846
|
headers: {
|
|
11638
11847
|
Authorization: "Bearer ${context.tenantId},${context.authToken}",
|
|
11639
11848
|
},
|
|
11640
|
-
requestAdaptor: quickSaveApiRequestAdaptor
|
|
11641
|
-
adaptor: `
|
|
11642
|
-
if(payload.errors){
|
|
11643
|
-
payload.status = 2;
|
|
11644
|
-
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
11645
|
-
}
|
|
11646
|
-
return payload;
|
|
11647
|
-
`
|
|
11849
|
+
requestAdaptor: quickSaveApiRequestAdaptor
|
|
11648
11850
|
},
|
|
11649
|
-
rowClassNameExpr
|
|
11851
|
+
// 外层data发生变化的时候, 不会重新渲染rowClassNameExpr, 所以先用css标记tr唯一标识
|
|
11852
|
+
// 使用表达式给tr添加初始选中状态
|
|
11853
|
+
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 %>"
|
|
11650
11854
|
}, bodyProps);
|
|
11651
11855
|
|
|
11652
11856
|
}
|
|
@@ -11659,9 +11863,23 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11659
11863
|
crudModeClassName = `steedos-crud-mode-${body.mode}`;
|
|
11660
11864
|
}
|
|
11661
11865
|
|
|
11866
|
+
body.quickSaveApi.adaptor = `
|
|
11867
|
+
if(payload.errors){
|
|
11868
|
+
payload.status = 2;
|
|
11869
|
+
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
11870
|
+
}
|
|
11871
|
+
var scope = SteedosUI.getRef(context.scopeId);
|
|
11872
|
+
var scopeParent = scope && scope.parent;
|
|
11873
|
+
var crudScoped = scopeParent.getComponentById('${body.id}');
|
|
11874
|
+
setTimeout(()=>{
|
|
11875
|
+
crudScoped && crudScoped.control.updateAutoFillHeight();
|
|
11876
|
+
}, 500);
|
|
11877
|
+
return payload;
|
|
11878
|
+
`;
|
|
11879
|
+
|
|
11662
11880
|
if(body.columns && options.formFactor != 'SMALL'){
|
|
11663
11881
|
//将_display放入crud的columns的倒数第二列中(最后一列会影响固定列),可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
11664
|
-
body.columns.splice(body.columns.length -
|
|
11882
|
+
body.columns.splice(body.columns.length -1 , 0, {name: '_display',type: 'static', width: 1, placeholder: "",id: objectSchema.name + "_display_${_index}", tpl: "${''}"});
|
|
11665
11883
|
}
|
|
11666
11884
|
|
|
11667
11885
|
if (defaults) {
|
|
@@ -11719,11 +11937,6 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11719
11937
|
}
|
|
11720
11938
|
}
|
|
11721
11939
|
|
|
11722
|
-
const getGlobalData = (mode)=>{
|
|
11723
|
-
const user = getSteedosAuth();
|
|
11724
|
-
return {mode: mode, user: user, spaceId: user.spaceId, userId: user.userId}
|
|
11725
|
-
};
|
|
11726
|
-
|
|
11727
11940
|
const getFormFields$1 = (objectSchema, formProps)=>{
|
|
11728
11941
|
/**
|
|
11729
11942
|
* fieldsExtend: 重写字段定义
|
|
@@ -11785,7 +11998,7 @@ async function getFormSchemaWithDataFilter(form, options = {}){
|
|
|
11785
11998
|
}
|
|
11786
11999
|
|
|
11787
12000
|
async function getObjectForm(objectSchema, ctx){
|
|
11788
|
-
const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "
|
|
12001
|
+
const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign, tabId, appId, defaults, submitSuccActions = [],
|
|
11789
12002
|
formDataFilter, onFormDataFilter, amisData, env } = ctx;
|
|
11790
12003
|
const fields = _$1__default["default"].values(objectSchema.fields);
|
|
11791
12004
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
@@ -11801,9 +12014,7 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
11801
12014
|
id: `service_${formSchema.id}`,
|
|
11802
12015
|
className: 'p-0',
|
|
11803
12016
|
name: `page_edit_${recordId}`,
|
|
11804
|
-
api: await getEditFormInitApi(objectSchema, recordId, fields, ctx),
|
|
11805
12017
|
data:{
|
|
11806
|
-
editFormInited: false,
|
|
11807
12018
|
...amisData
|
|
11808
12019
|
},
|
|
11809
12020
|
// data: {global: getGlobalData('edit'), recordId: recordId, objectName: objectSchema.name, context: {rootUrl: getRootUrl(), tenantId: getTenantId(), authToken: getAuthToken()}},
|
|
@@ -11812,8 +12023,9 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
11812
12023
|
body: [defaultsDeep({}, formSchema, {
|
|
11813
12024
|
type: "form",
|
|
11814
12025
|
mode: layout,
|
|
12026
|
+
initApi: await getEditFormInitApi(objectSchema, recordId, fields, ctx),
|
|
11815
12027
|
data: {
|
|
11816
|
-
|
|
12028
|
+
editFormInited: false,
|
|
11817
12029
|
},
|
|
11818
12030
|
labelAlign,
|
|
11819
12031
|
persistData: false,
|
|
@@ -11827,11 +12039,15 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
11827
12039
|
submitText: "", // amis 表单不显示提交按钮, 表单提交由项目代码接管
|
|
11828
12040
|
api: await getSaveApi(objectSchema, recordId, fields, ctx),
|
|
11829
12041
|
initFetch: recordId != 'new',
|
|
11830
|
-
body:
|
|
12042
|
+
body: {
|
|
12043
|
+
type: 'wrapper',
|
|
12044
|
+
className: 'p-0 m-0',
|
|
12045
|
+
body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups})),
|
|
12046
|
+
hiddenOn: "${editFormInited != true}",
|
|
12047
|
+
},
|
|
11831
12048
|
panelClassName:'m-0 sm:rounded-lg shadow-none border-none',
|
|
11832
12049
|
bodyClassName: 'p-0',
|
|
11833
12050
|
className: 'steedos-amis-form',
|
|
11834
|
-
hiddenOn: "${editFormInited != true}",
|
|
11835
12051
|
onEvent: {
|
|
11836
12052
|
"submitSucc": {
|
|
11837
12053
|
"weight": 0,
|
|
@@ -11876,7 +12092,7 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
11876
12092
|
}
|
|
11877
12093
|
|
|
11878
12094
|
async function getObjectDetail(objectSchema, recordId, ctx){
|
|
11879
|
-
const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "
|
|
12095
|
+
const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign,
|
|
11880
12096
|
formDataFilter, onFormDataFilter, amisData, env } = ctx;
|
|
11881
12097
|
const fields = _$1__default["default"].values(objectSchema.fields);
|
|
11882
12098
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
@@ -11885,8 +12101,7 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
11885
12101
|
type: 'service',
|
|
11886
12102
|
name: `page_readonly_${recordId}`,
|
|
11887
12103
|
id: serviceId,
|
|
11888
|
-
|
|
11889
|
-
api: await getReadonlyFormInitApi(objectSchema, recordId, fields, ctx),
|
|
12104
|
+
// api: await getReadonlyFormInitApi(objectSchema, recordId, fields, ctx),
|
|
11890
12105
|
body: [
|
|
11891
12106
|
{
|
|
11892
12107
|
"type": "wrapper", //form 的 hiddenOn 会导致 form onEvent 异常, 使用wrapper包裹一次form,并在wrapper上控制显隐
|
|
@@ -11912,60 +12127,41 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
11912
12127
|
),
|
|
11913
12128
|
className: 'steedos-amis-form bg-white',
|
|
11914
12129
|
actions: [], // 不显示表单默认的提交按钮
|
|
11915
|
-
onEvent: {
|
|
11916
|
-
[`@data.changed.${objectSchema.name}`]: { // 由于amis service 组件的 onEvent 存在bug ,此处借助form来刷新 上层 service https://github.com/baidu/amis/issues/6294
|
|
11917
|
-
"actions": [
|
|
11918
|
-
{
|
|
11919
|
-
"actionType": "reload",
|
|
11920
|
-
"componentId": serviceId,
|
|
11921
|
-
"expression": "this.__deletedRecord != true"
|
|
11922
|
-
},
|
|
11923
|
-
{
|
|
11924
|
-
// "args": {
|
|
11925
|
-
// "url": "/app/${appId}/${objectName}/grid/${side_listview_id}",
|
|
11926
|
-
// "blank": false
|
|
11927
|
-
// },
|
|
11928
|
-
"actionType": "custom",
|
|
11929
|
-
"script": "window.goBack()",
|
|
11930
|
-
"expression": "this.__deletedRecord === true"
|
|
11931
|
-
}
|
|
11932
|
-
]
|
|
11933
|
-
}
|
|
11934
|
-
}
|
|
11935
12130
|
},
|
|
11936
12131
|
}
|
|
11937
12132
|
],
|
|
11938
|
-
onEvent: {
|
|
11939
|
-
|
|
11940
|
-
|
|
11941
|
-
|
|
11942
|
-
|
|
11943
|
-
|
|
11944
|
-
|
|
11945
|
-
|
|
11946
|
-
|
|
11947
|
-
|
|
11948
|
-
|
|
11949
|
-
|
|
11950
|
-
|
|
11951
|
-
|
|
11952
|
-
|
|
11953
|
-
|
|
11954
|
-
|
|
11955
|
-
|
|
11956
|
-
|
|
11957
|
-
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
|
|
11961
|
-
|
|
11962
|
-
|
|
11963
|
-
|
|
11964
|
-
|
|
11965
|
-
}
|
|
12133
|
+
// onEvent: {
|
|
12134
|
+
// "fetchInited": {
|
|
12135
|
+
// "weight": 0,
|
|
12136
|
+
// "actions": [
|
|
12137
|
+
// {
|
|
12138
|
+
// actionType: 'broadcast',
|
|
12139
|
+
// eventName: "recordLoaded",
|
|
12140
|
+
// args: {
|
|
12141
|
+
// eventName: "recordLoaded"
|
|
12142
|
+
// },
|
|
12143
|
+
// data: {
|
|
12144
|
+
// objectName: "${event.data.__objectName}",
|
|
12145
|
+
// record: "${event.data.__record}"
|
|
12146
|
+
// },
|
|
12147
|
+
// expression: "${event.data.__response.error != true}"
|
|
12148
|
+
// },
|
|
12149
|
+
// {
|
|
12150
|
+
// "actionType": "setValue",
|
|
12151
|
+
// "args": {
|
|
12152
|
+
// value: {
|
|
12153
|
+
// "recordLoaded": true,
|
|
12154
|
+
// }
|
|
12155
|
+
// },
|
|
12156
|
+
// expression: "${event.data.__response.error != true}"
|
|
12157
|
+
// }
|
|
12158
|
+
// ]
|
|
12159
|
+
// }
|
|
12160
|
+
// }
|
|
11966
12161
|
};
|
|
11967
12162
|
|
|
11968
12163
|
amisSchema.body[0].body = await getFormSchemaWithDataFilter(amisSchema.body[0].body, { formDataFilter, onFormDataFilter, amisData, env });
|
|
12164
|
+
// console.log('getObjectDetail=====>', amisSchema);
|
|
11969
12165
|
return amisSchema;
|
|
11970
12166
|
}
|
|
11971
12167
|
|
|
@@ -12045,8 +12241,8 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
12045
12241
|
/*
|
|
12046
12242
|
* @Author: baozhoutao@steedos.com
|
|
12047
12243
|
* @Date: 2022-07-05 15:55:39
|
|
12048
|
-
* @LastEditors:
|
|
12049
|
-
* @LastEditTime:
|
|
12244
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
12245
|
+
* @LastEditTime: 2024-01-24 10:18:17
|
|
12050
12246
|
* @Description:
|
|
12051
12247
|
*/
|
|
12052
12248
|
|
|
@@ -12145,7 +12341,9 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
12145
12341
|
const foreign_key_value = arr[2] ? arr[1]+'.'+arr[2] : arr[1];
|
|
12146
12342
|
mainRelated[arr[0]] = foreign_key_value;
|
|
12147
12343
|
}
|
|
12148
|
-
}
|
|
12344
|
+
}
|
|
12345
|
+
// 防止related_lists中没有相关子表,但是details中有相关子表的情况
|
|
12346
|
+
if(!mainRelated[relatedObjectName]){
|
|
12149
12347
|
const details = _$1.union(mainObjectUiSchema.details,mainObjectUiSchema.lookup_details) || [];
|
|
12150
12348
|
for (const detail of details) {
|
|
12151
12349
|
const arr = detail.split(".");
|
|
@@ -12221,7 +12419,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
12221
12419
|
setDataToComponentId: componentId,
|
|
12222
12420
|
// tableHiddenOn: hiddenEmptyTable ? "this.$count === 0" : null,
|
|
12223
12421
|
appId: appId,
|
|
12224
|
-
crudClassName: '
|
|
12422
|
+
crudClassName: 'steedos-record-related-crud hidden',
|
|
12225
12423
|
refField,
|
|
12226
12424
|
...ctx
|
|
12227
12425
|
};
|
|
@@ -12234,7 +12432,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
12234
12432
|
amisSchema: {
|
|
12235
12433
|
type: "service",
|
|
12236
12434
|
id: componentId,
|
|
12237
|
-
className: `steedos-record-related-list
|
|
12435
|
+
className: `steedos-record-related-list mb-4 last:mb-0 ${componentId} ${className}`,
|
|
12238
12436
|
data: {
|
|
12239
12437
|
relatedKey: relatedKey,
|
|
12240
12438
|
listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
|
|
@@ -12426,11 +12624,44 @@ async function getRelatedListSchema(
|
|
|
12426
12624
|
};
|
|
12427
12625
|
}
|
|
12428
12626
|
|
|
12627
|
+
async function getObjectRelatedListsMiniSchema(objectApiName){
|
|
12628
|
+
const relatedLists = await getObjectRelatedList(objectApiName);
|
|
12629
|
+
|
|
12630
|
+
const relatedListsMiniSchema = [];
|
|
12631
|
+
|
|
12632
|
+
for (const relatedList of relatedLists) {
|
|
12633
|
+
relatedListsMiniSchema.push(
|
|
12634
|
+
{
|
|
12635
|
+
type: 'steedos-record-detail-list-mini',
|
|
12636
|
+
objectApiName: objectApiName,
|
|
12637
|
+
// recordId: recordId,
|
|
12638
|
+
formFactor: formFactor,
|
|
12639
|
+
relatedObjectApiName: relatedList.object_name,
|
|
12640
|
+
foreign_key: relatedList.foreign_key,
|
|
12641
|
+
relatedKey: relatedList.foreign_key,
|
|
12642
|
+
columns: relatedList.columns,
|
|
12643
|
+
sort: relatedList.sort,
|
|
12644
|
+
filters: relatedList.filters,
|
|
12645
|
+
visible_on: relatedList.visible_on,
|
|
12646
|
+
perPage: relatedList.page_size || perPage,
|
|
12647
|
+
hiddenEmptyTable: true,
|
|
12648
|
+
relatedLabel: relatedList.label
|
|
12649
|
+
}
|
|
12650
|
+
);
|
|
12651
|
+
}
|
|
12652
|
+
|
|
12653
|
+
return {
|
|
12654
|
+
type: 'wrapper',
|
|
12655
|
+
className: "steedos-record-detail-related-lists-mini",
|
|
12656
|
+
body: relatedListsMiniSchema
|
|
12657
|
+
}
|
|
12658
|
+
}
|
|
12659
|
+
|
|
12429
12660
|
/*
|
|
12430
12661
|
* @Author: baozhoutao@steedos.com
|
|
12431
12662
|
* @Date: 2022-07-05 15:55:39
|
|
12432
|
-
* @LastEditors:
|
|
12433
|
-
* @LastEditTime:
|
|
12663
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
12664
|
+
* @LastEditTime: 2024-01-16 11:14:34
|
|
12434
12665
|
* @Description:
|
|
12435
12666
|
*/
|
|
12436
12667
|
|
|
@@ -12602,7 +12833,7 @@ async function getField(objectName, fieldName) {
|
|
|
12602
12833
|
async function getFormSchema(objectName, ctx) {
|
|
12603
12834
|
const uiSchema = await getUISchema(objectName);
|
|
12604
12835
|
const amisSchema = await getObjectForm(uiSchema, ctx);
|
|
12605
|
-
console.log(`getFormSchema====>`, amisSchema)
|
|
12836
|
+
// console.log(`getFormSchema====>`, amisSchema)
|
|
12606
12837
|
return {
|
|
12607
12838
|
uiSchema,
|
|
12608
12839
|
amisSchema,
|
|
@@ -12928,110 +13159,164 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
12928
13159
|
"label": "对象表单",
|
|
12929
13160
|
"objectApiName": "${objectName}",
|
|
12930
13161
|
"recordId": "${recordId}",
|
|
12931
|
-
"id": "u:d4a495811d57",
|
|
12932
13162
|
appId: appId
|
|
12933
13163
|
}
|
|
12934
13164
|
],
|
|
12935
|
-
"id": "u:5d4e7e3f6ecc"
|
|
12936
13165
|
};
|
|
12937
13166
|
const related = {
|
|
12938
13167
|
"title": instance.t('frontend_record_detail_tab_related'),
|
|
12939
|
-
"className": "px-0
|
|
13168
|
+
"className": "px-0 py-4",
|
|
12940
13169
|
"body": [
|
|
12941
13170
|
{
|
|
12942
13171
|
"type": "steedos-object-related-lists",
|
|
12943
13172
|
"label": "相关列表",
|
|
12944
13173
|
"objectApiName": "${objectName}",
|
|
12945
13174
|
"recordId": "${recordId}",
|
|
12946
|
-
"id": "u:3b85b7b7a7f6",
|
|
12947
13175
|
appId: appId
|
|
12948
13176
|
}
|
|
12949
13177
|
],
|
|
12950
|
-
"id": "u:1a0326aeec2b"
|
|
12951
13178
|
};
|
|
12952
13179
|
const content = {
|
|
12953
13180
|
"type": "tabs",
|
|
12954
|
-
"className": "
|
|
13181
|
+
"className": "steedos-record-tabs bg-white p-4 mt-3 border-y",
|
|
13182
|
+
"contentClassName": "bg-none",
|
|
12955
13183
|
"tabs": [
|
|
12956
13184
|
detailed
|
|
12957
13185
|
],
|
|
12958
|
-
"id": "u:a649e4094a12"
|
|
12959
13186
|
};
|
|
12960
13187
|
if(relatedLists.length){
|
|
12961
13188
|
content.tabs.push(related);
|
|
12962
13189
|
}
|
|
13190
|
+
// content.tabs = reverse(content.tabs)
|
|
12963
13191
|
return {
|
|
12964
13192
|
uiSchema,
|
|
12965
13193
|
amisSchema: {
|
|
12966
|
-
"type": "service",
|
|
13194
|
+
"type": "steedos-record-service",
|
|
12967
13195
|
"body": [
|
|
12968
13196
|
{
|
|
12969
13197
|
"type": "steedos-record-detail-header",
|
|
12970
13198
|
"label": "标题面板",
|
|
12971
13199
|
"objectApiName": "${objectName}",
|
|
12972
13200
|
"recordId": "${recordId}",
|
|
12973
|
-
"id": "u:48d2c28eb755"
|
|
13201
|
+
"id": "u:48d2c28eb755",
|
|
13202
|
+
"showButtons": props.showButtons,
|
|
13203
|
+
"showBackButton": props.showBackButton,
|
|
12974
13204
|
},
|
|
12975
13205
|
content
|
|
12976
13206
|
],
|
|
12977
|
-
|
|
12978
|
-
|
|
12979
|
-
|
|
12980
|
-
},
|
|
12981
|
-
onEvent: {
|
|
12982
|
-
"recordLoaded": {
|
|
12983
|
-
"actions": [
|
|
12984
|
-
{
|
|
12985
|
-
"actionType": "reload",
|
|
12986
|
-
"data": {
|
|
12987
|
-
"name": `\${record.${uiSchema.NAME_FIELD_KEY || 'name'}}`,
|
|
12988
|
-
"_master.record": `\${record}`,
|
|
12989
|
-
// 不清楚reload 如何给对象下的某个key复制, 所以此处重复设置_master的objectName、recordId
|
|
12990
|
-
"_master.objectName": "${objectName}",
|
|
12991
|
-
"_master.recordId": "${recordId}"
|
|
12992
|
-
}
|
|
12993
|
-
}
|
|
12994
|
-
]
|
|
12995
|
-
},
|
|
12996
|
-
...props.onEvent
|
|
12997
|
-
},
|
|
13207
|
+
"objectApiName": "${objectName}",
|
|
13208
|
+
"recordId": "${recordId}",
|
|
13209
|
+
onEvent: props.onEvent,
|
|
12998
13210
|
}
|
|
12999
13211
|
}
|
|
13000
13212
|
}
|
|
13001
13213
|
|
|
13002
|
-
async function getRecordServiceSchema(objectName, appId, props = {}) {
|
|
13214
|
+
async function getRecordServiceSchema(objectName, appId, props = {}, body) {
|
|
13003
13215
|
const uiSchema = await getUISchema(objectName);
|
|
13216
|
+
const fields = _$1__default["default"].values(uiSchema.fields);
|
|
13217
|
+
const serviceId = `u:steedos-record-service-${objectName}`;
|
|
13004
13218
|
return {
|
|
13005
13219
|
uiSchema,
|
|
13006
13220
|
amisSchema: {
|
|
13007
|
-
|
|
13008
|
-
"
|
|
13009
|
-
data: {
|
|
13010
|
-
"_master.objectName": "${objectName}",
|
|
13011
|
-
"_master.recordId": "${recordId}"
|
|
13012
|
-
},
|
|
13013
|
-
"style": {
|
|
13014
|
-
"padding": "var(--Page-body-padding)",
|
|
13015
|
-
...props.style
|
|
13016
|
-
},
|
|
13221
|
+
type: 'service',
|
|
13222
|
+
className: "p-0 m-0",
|
|
13017
13223
|
onEvent: {
|
|
13018
|
-
|
|
13224
|
+
[`@data.changed.${objectName}`]: {
|
|
13019
13225
|
"actions": [
|
|
13020
13226
|
{
|
|
13021
13227
|
"actionType": "reload",
|
|
13022
|
-
"
|
|
13023
|
-
|
|
13024
|
-
|
|
13025
|
-
|
|
13026
|
-
|
|
13027
|
-
|
|
13028
|
-
|
|
13228
|
+
"componentId": serviceId,
|
|
13229
|
+
"expression": "this.__deletedRecord != true"
|
|
13230
|
+
},
|
|
13231
|
+
{
|
|
13232
|
+
"actionType": "custom",
|
|
13233
|
+
"script": "window.goBack()",
|
|
13234
|
+
"expression": "this.__deletedRecord === true"
|
|
13029
13235
|
}
|
|
13030
13236
|
]
|
|
13031
13237
|
},
|
|
13032
|
-
|
|
13238
|
+
},
|
|
13239
|
+
body: {
|
|
13240
|
+
"type": "service",
|
|
13241
|
+
id: serviceId,
|
|
13242
|
+
className: 'steedos-record-service p-0',
|
|
13243
|
+
api: await getReadonlyFormInitApi(uiSchema, props.recordId, fields, props),
|
|
13244
|
+
body: {
|
|
13245
|
+
"type": "wrapper",
|
|
13246
|
+
"className": "p-0 m-0",
|
|
13247
|
+
"body": body || [],
|
|
13248
|
+
"hiddenOn": "${recordLoaded != true}"
|
|
13249
|
+
},
|
|
13250
|
+
data: {
|
|
13251
|
+
"_master.objectName": "${objectName}",
|
|
13252
|
+
"_master.recordId": "${recordId}",
|
|
13253
|
+
...(props.data || {})
|
|
13254
|
+
},
|
|
13255
|
+
"style": {
|
|
13256
|
+
// "padding": "var(--Page-body-padding)",
|
|
13257
|
+
...props.style
|
|
13258
|
+
},
|
|
13259
|
+
onEvent: {
|
|
13260
|
+
// 如果定义了fetchInited,则无法接收到广播事件@data.changed
|
|
13261
|
+
"fetchInited": {
|
|
13262
|
+
"weight": 0,
|
|
13263
|
+
"actions": [
|
|
13264
|
+
{
|
|
13265
|
+
actionType: 'broadcast',
|
|
13266
|
+
eventName: "recordLoaded",
|
|
13267
|
+
data: {
|
|
13268
|
+
objectName: "${event.data.__objectName}",
|
|
13269
|
+
record: "${event.data.record}"
|
|
13270
|
+
},
|
|
13271
|
+
expression: "${event.data.__response.error != true}"
|
|
13272
|
+
},
|
|
13273
|
+
]
|
|
13274
|
+
},
|
|
13275
|
+
...props.onEvent
|
|
13276
|
+
}
|
|
13033
13277
|
}
|
|
13034
13278
|
}
|
|
13279
|
+
|
|
13280
|
+
|
|
13281
|
+
}
|
|
13282
|
+
}
|
|
13283
|
+
|
|
13284
|
+
async function getRecordDetailMiniSchema(objectName, appId, props = {}){
|
|
13285
|
+
const uiSchema = await getUISchema(objectName);
|
|
13286
|
+
const fields = _$1__default["default"].values(uiSchema.fields);
|
|
13287
|
+
|
|
13288
|
+
props.initApiAdaptor = 'payload.data=Object.assign({}, payload.data, payload.data.record); payload.data._finished=true; console.log("payload data is ====>", payload)';
|
|
13289
|
+
|
|
13290
|
+
// TODO 处理相关表
|
|
13291
|
+
// getObjectRelatedListsMiniSchema
|
|
13292
|
+
|
|
13293
|
+
return {
|
|
13294
|
+
type: "form",
|
|
13295
|
+
wrapWithPanel: false,
|
|
13296
|
+
actions: [],
|
|
13297
|
+
initApi: await getReadonlyFormInitApi(uiSchema, props.recordId, fields, props),
|
|
13298
|
+
body: {
|
|
13299
|
+
"type": "wrapper",
|
|
13300
|
+
"className": "p-0 m-0",
|
|
13301
|
+
"body": [
|
|
13302
|
+
{
|
|
13303
|
+
"type": "steedos-record-detail-header",
|
|
13304
|
+
"showButtons": false,
|
|
13305
|
+
"showBackButton": false,
|
|
13306
|
+
"objectApiName": "${objectName}",
|
|
13307
|
+
"recordId": "${recordId}",
|
|
13308
|
+
},
|
|
13309
|
+
// {
|
|
13310
|
+
// "type": "steedos-object-related-lists",
|
|
13311
|
+
// "label": "相关列表",
|
|
13312
|
+
// "objectApiName": "${objectName}",
|
|
13313
|
+
// "staticRecordId": "${recordId}",
|
|
13314
|
+
// formFactor: "SMALL",
|
|
13315
|
+
// appId: appId
|
|
13316
|
+
// }
|
|
13317
|
+
],
|
|
13318
|
+
"hiddenOn": "${_finished != true}"
|
|
13319
|
+
}
|
|
13035
13320
|
}
|
|
13036
13321
|
}
|
|
13037
13322
|
|
|
@@ -13594,17 +13879,13 @@ function getReferenceToSync(field) {
|
|
|
13594
13879
|
|
|
13595
13880
|
function getLookupSapceUserTreeSchema(isMobile){
|
|
13596
13881
|
let apiAdaptor = `
|
|
13597
|
-
// console.log("===getLookupSapceUserTreeSchema===", JSON.stringify(payload));
|
|
13598
13882
|
const records = payload.data.options;
|
|
13599
|
-
let isTreeOptionsComputed = false;
|
|
13600
|
-
if(records.length === 1 && records[0].children){
|
|
13601
|
-
isTreeOptionsComputed = true;
|
|
13602
|
-
}
|
|
13603
|
-
if(isTreeOptionsComputed){
|
|
13604
|
-
return payload;
|
|
13605
|
-
}
|
|
13606
13883
|
const treeRecords = [];
|
|
13607
|
-
const getChildren = (records, childrenIds) => {
|
|
13884
|
+
const getChildren = (currentRecord, records, childrenIds) => {
|
|
13885
|
+
if (currentRecord.children && typeof currentRecord.children[0] === "object") {
|
|
13886
|
+
// 考虑api配置了cache缓存的话,不会请求接口但是会重新进这个接收适配器脚本且payload.data.options返回的会是上一次计算结果,这里直接返回计算过的children
|
|
13887
|
+
return currentRecord.children;
|
|
13888
|
+
}
|
|
13608
13889
|
if (!childrenIds) {
|
|
13609
13890
|
return;
|
|
13610
13891
|
}
|
|
@@ -13613,7 +13894,7 @@ function getLookupSapceUserTreeSchema(isMobile){
|
|
|
13613
13894
|
});
|
|
13614
13895
|
_.each(children, (item) => {
|
|
13615
13896
|
if (item.children) {
|
|
13616
|
-
item.children = getChildren(records, item.children)
|
|
13897
|
+
item.children = getChildren(item, records, item.children)
|
|
13617
13898
|
}else{
|
|
13618
13899
|
item.children = [];
|
|
13619
13900
|
}
|
|
@@ -13639,7 +13920,7 @@ function getLookupSapceUserTreeSchema(isMobile){
|
|
|
13639
13920
|
|
|
13640
13921
|
_.each(records, (record) => {
|
|
13641
13922
|
if (record.noParent == 1) {
|
|
13642
|
-
treeRecords.push(Object.assign({}, record, { children: getChildren(records, record.children) }));
|
|
13923
|
+
treeRecords.push(Object.assign({}, record, { children: getChildren(record, records, record.children) }));
|
|
13643
13924
|
}
|
|
13644
13925
|
});
|
|
13645
13926
|
console.log(treeRecords)
|
|
@@ -13689,6 +13970,7 @@ function getLookupSapceUserTreeSchema(isMobile){
|
|
|
13689
13970
|
}
|
|
13690
13971
|
},
|
|
13691
13972
|
"label": "",
|
|
13973
|
+
"mode": "normal",
|
|
13692
13974
|
"name": "organizations",
|
|
13693
13975
|
"multiple": false,
|
|
13694
13976
|
"joinValues": false,
|
|
@@ -13831,6 +14113,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
13831
14113
|
}
|
|
13832
14114
|
});
|
|
13833
14115
|
|
|
14116
|
+
let listviewFilter = getListViewFilter(listView);
|
|
14117
|
+
let listviewFiltersFunction = listView && listView._filters;
|
|
14118
|
+
|
|
13834
14119
|
let sort = "";
|
|
13835
14120
|
if(listView){
|
|
13836
14121
|
sort = getListViewSort(listView);
|
|
@@ -13877,7 +14162,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
13877
14162
|
Object.assign(api.data.$self, __changedSearchBoxValues, __changedFilterFormValues);
|
|
13878
14163
|
}
|
|
13879
14164
|
const selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
13880
|
-
var filters = [];
|
|
14165
|
+
${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
|
|
13881
14166
|
var pageSize = api.data.pageSize || 10;
|
|
13882
14167
|
var pageNo = api.data.pageNo || 1;
|
|
13883
14168
|
var skip = (pageNo - 1) * pageSize;
|
|
@@ -13939,6 +14224,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
13939
14224
|
}
|
|
13940
14225
|
|
|
13941
14226
|
const inFilterForm = ${ctx.inFilterForm};
|
|
14227
|
+
|
|
14228
|
+
const listviewFiltersFunction = ${listviewFiltersFunction};
|
|
14229
|
+
|
|
14230
|
+
if(listviewFiltersFunction && !inFilterForm){
|
|
14231
|
+
const _filters0 = listviewFiltersFunction(filters, api.data.$self.__super);
|
|
14232
|
+
if(_filters0 && _filters0.length){
|
|
14233
|
+
filters.push(_filters0);
|
|
14234
|
+
}
|
|
14235
|
+
}
|
|
14236
|
+
|
|
13942
14237
|
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
13943
14238
|
|
|
13944
14239
|
if(filtersFunction && !inFilterForm){
|
|
@@ -14057,13 +14352,15 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
14057
14352
|
|
|
14058
14353
|
pickerSchema.affixHeader = false;
|
|
14059
14354
|
|
|
14060
|
-
|
|
14355
|
+
|
|
14356
|
+
|
|
14357
|
+
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { isLookup: true, keywordsSearchBoxName });
|
|
14358
|
+
|
|
14061
14359
|
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
|
|
14062
|
-
|
|
14360
|
+
pickerSchema.headerToolbar.push(getLookupSapceUserTreeSchema(isMobile));
|
|
14063
14361
|
pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
|
|
14064
14362
|
}
|
|
14065
|
-
|
|
14066
|
-
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
|
|
14363
|
+
|
|
14067
14364
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
14068
14365
|
const isCreate = _$1__namespace.isBoolean(field.create) ? field.create : true;
|
|
14069
14366
|
// lookup字段配置过滤条件就强制不显示新建按钮
|
|
@@ -14176,6 +14473,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
14176
14473
|
pickerSchema.footerToolbar = ["pagination"];
|
|
14177
14474
|
}
|
|
14178
14475
|
|
|
14476
|
+
if(field.inlineHelpText){
|
|
14477
|
+
pickerSchema.toolbarClassName = "hasHelpText";
|
|
14478
|
+
pickerSchema.headerToolbar = [{
|
|
14479
|
+
"type": "tpl",
|
|
14480
|
+
"tpl": field.inlineHelpText,
|
|
14481
|
+
"className": "text-secondary"
|
|
14482
|
+
}, ...pickerSchema.headerToolbar];
|
|
14483
|
+
}
|
|
14484
|
+
pickerSchema.className = (pickerSchema.className || "") + " steedos-lookup-crud";
|
|
14485
|
+
|
|
14179
14486
|
const data = {
|
|
14180
14487
|
type: getAmisStaticFieldType$1('picker', readonly),
|
|
14181
14488
|
modalTitle: instance.t('frontend_form_please_select') + " " + refObjectConfig.label,
|
|
@@ -14251,6 +14558,9 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
14251
14558
|
const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
|
|
14252
14559
|
let listView = getLookupListView(refObjectConfig);
|
|
14253
14560
|
|
|
14561
|
+
let listviewFilter = getListViewFilter(listView);
|
|
14562
|
+
let listviewFiltersFunction = listView && listView._filters;
|
|
14563
|
+
|
|
14254
14564
|
let sort = "";
|
|
14255
14565
|
if(listView){
|
|
14256
14566
|
sort = getListViewSort(listView);
|
|
@@ -14280,7 +14590,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
14280
14590
|
apiInfo.data['rfield'] = `\${object_name}`;
|
|
14281
14591
|
// [["_id", "=", "$${field.name}._id"],"or",["name", "contains", "$term"]]
|
|
14282
14592
|
apiInfo.requestAdaptor = `
|
|
14283
|
-
var filters = [];
|
|
14593
|
+
${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
|
|
14284
14594
|
var top = 200;
|
|
14285
14595
|
if(api.data.$term){
|
|
14286
14596
|
filters = [["${referenceTo?.NAME_FIELD_KEY || 'name'}", "contains", api.data.$term]];
|
|
@@ -14303,6 +14613,16 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
14303
14613
|
}
|
|
14304
14614
|
|
|
14305
14615
|
const inFilterForm = ${ctx.inFilterForm};
|
|
14616
|
+
|
|
14617
|
+
const listviewFiltersFunction = ${listviewFiltersFunction};
|
|
14618
|
+
|
|
14619
|
+
if(listviewFiltersFunction && !inFilterForm){
|
|
14620
|
+
const _filters0 = listviewFiltersFunction(filters, api.data.$);
|
|
14621
|
+
if(_filters0 && _filters0.length){
|
|
14622
|
+
filters.push(_filters0);
|
|
14623
|
+
}
|
|
14624
|
+
}
|
|
14625
|
+
|
|
14306
14626
|
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
14307
14627
|
|
|
14308
14628
|
if(filtersFunction && !inFilterForm){
|
|
@@ -14425,9 +14745,17 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
14425
14745
|
}
|
|
14426
14746
|
// console.log(`lookupToAmis====`, field, readonly, ctx)
|
|
14427
14747
|
if(readonly){
|
|
14428
|
-
|
|
14429
|
-
|
|
14430
|
-
|
|
14748
|
+
if(field.reference_to){
|
|
14749
|
+
return {
|
|
14750
|
+
type: 'steedos-field',
|
|
14751
|
+
config: field,
|
|
14752
|
+
static: true
|
|
14753
|
+
}
|
|
14754
|
+
}else {
|
|
14755
|
+
return {
|
|
14756
|
+
type: getAmisStaticFieldType$1('picker', readonly),
|
|
14757
|
+
tpl: getRelatedFieldTpl(field, ctx)
|
|
14758
|
+
}
|
|
14431
14759
|
}
|
|
14432
14760
|
}
|
|
14433
14761
|
if(field.reference_to && !_$1__namespace.isString(field.reference_to) && !readonly){
|
|
@@ -15079,13 +15407,31 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15079
15407
|
};
|
|
15080
15408
|
break;
|
|
15081
15409
|
case 'input-datetime-range':
|
|
15410
|
+
// convertData = {
|
|
15411
|
+
// type: "input-datetime-range",
|
|
15412
|
+
// inputFormat: 'YYYY-MM-DD HH:mm',
|
|
15413
|
+
// format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
15414
|
+
// tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
|
|
15415
|
+
// utc: true,
|
|
15416
|
+
// joinValues: false
|
|
15417
|
+
// }
|
|
15418
|
+
// 日期时间字段,按日期方式展现显示控件,用户不用关心小时分钟
|
|
15082
15419
|
convertData = {
|
|
15083
|
-
type: "input-
|
|
15084
|
-
inputFormat:
|
|
15420
|
+
type: "input-date-range",
|
|
15421
|
+
inputFormat: "YYYY-MM-DD HH:mm",
|
|
15085
15422
|
format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
15086
15423
|
tpl: readonly ? getDateTimeTpl(field) : null,
|
|
15087
15424
|
utc: true,
|
|
15088
|
-
joinValues: false
|
|
15425
|
+
joinValues: false,
|
|
15426
|
+
"shortcuts": [
|
|
15427
|
+
"thismonth",
|
|
15428
|
+
"2monthsago",
|
|
15429
|
+
"3monthslater",
|
|
15430
|
+
"prevquarter",
|
|
15431
|
+
"thisquarter",
|
|
15432
|
+
"thisyear",
|
|
15433
|
+
"lastYear"
|
|
15434
|
+
]
|
|
15089
15435
|
};
|
|
15090
15436
|
break;
|
|
15091
15437
|
case 'datetime':
|
|
@@ -15136,7 +15482,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15136
15482
|
convertData = {
|
|
15137
15483
|
type: getAmisStaticFieldType$1('datetime', readonly),
|
|
15138
15484
|
inputFormat: 'YYYY-MM-DD HH:mm',
|
|
15139
|
-
format: 'YYYY-MM-DDTHH:mm:
|
|
15485
|
+
format: 'YYYY-MM-DDTHH:mm:00.000Z',
|
|
15140
15486
|
tpl: readonly ? getDateTimeTpl(field) : null,
|
|
15141
15487
|
utc: true,
|
|
15142
15488
|
};
|
|
@@ -15267,6 +15613,36 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15267
15613
|
convertData = {
|
|
15268
15614
|
type: 'static-text'
|
|
15269
15615
|
};
|
|
15616
|
+
}else if(field.autonumber_enable_modify){
|
|
15617
|
+
convertData = {
|
|
15618
|
+
"type": "input-group",
|
|
15619
|
+
"body": [
|
|
15620
|
+
{
|
|
15621
|
+
"type": "input-text",
|
|
15622
|
+
"name": field.name
|
|
15623
|
+
},
|
|
15624
|
+
{
|
|
15625
|
+
"type": "button",
|
|
15626
|
+
"label": "自动获取",
|
|
15627
|
+
"actionType": "ajax",
|
|
15628
|
+
"api": {
|
|
15629
|
+
"url": `\${context.rootUrl}/api/autonumber/generator/\${objectName}/${field.name}`,
|
|
15630
|
+
"method": "post",
|
|
15631
|
+
"headers": {
|
|
15632
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
15633
|
+
},
|
|
15634
|
+
"adaptor": `
|
|
15635
|
+
payload.data["${field.name}"] = payload.data && payload.data.autonumber;
|
|
15636
|
+
delete payload.data.autonumber;
|
|
15637
|
+
return payload;
|
|
15638
|
+
`
|
|
15639
|
+
},
|
|
15640
|
+
"messages": {
|
|
15641
|
+
"success": "获取成功"
|
|
15642
|
+
}
|
|
15643
|
+
}
|
|
15644
|
+
]
|
|
15645
|
+
};
|
|
15270
15646
|
}
|
|
15271
15647
|
break;
|
|
15272
15648
|
case 'url':
|
|
@@ -15421,11 +15797,9 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15421
15797
|
if(field.subFields){
|
|
15422
15798
|
convertData = {
|
|
15423
15799
|
type: 'steedos-input-table',
|
|
15424
|
-
showIndex: true,
|
|
15425
15800
|
editable: !readonly,
|
|
15426
15801
|
addable: !readonly,
|
|
15427
15802
|
removable: !readonly,
|
|
15428
|
-
draggable: !readonly,
|
|
15429
15803
|
fields: [],
|
|
15430
15804
|
amis:{
|
|
15431
15805
|
columnsTogglable: false
|
|
@@ -15477,9 +15851,9 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15477
15851
|
if(field.is_wide || convertData.type === 'group'){
|
|
15478
15852
|
convertData.className = 'col-span-2 m-0';
|
|
15479
15853
|
}else {
|
|
15480
|
-
convertData.className = 'm-
|
|
15854
|
+
convertData.className = 'm-0';
|
|
15481
15855
|
}
|
|
15482
|
-
if(readonly){
|
|
15856
|
+
if(readonly && ctx.mode !== 'edit'){
|
|
15483
15857
|
convertData.className = `${convertData.className} border-b`;
|
|
15484
15858
|
}
|
|
15485
15859
|
if(readonly){
|
|
@@ -15502,6 +15876,10 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15502
15876
|
}
|
|
15503
15877
|
}
|
|
15504
15878
|
|
|
15879
|
+
if(ctx.amisData && ctx.amisData._master && ctx.amisData._master.relatedKey === field.name){
|
|
15880
|
+
convertData.className = `${convertData.className || ''} hidden`;
|
|
15881
|
+
}
|
|
15882
|
+
|
|
15505
15883
|
if(_$1__namespace.isString(baseData.required)){
|
|
15506
15884
|
if(baseData.required.startsWith("{{")){
|
|
15507
15885
|
baseData.requiredOn = `${baseData.required.substring(2, baseData.required.length -2).replace(/formData./g, 'data.')}`;
|
|
@@ -15570,8 +15948,9 @@ async function getFieldSearchable(perField, permissionFields, ctx){
|
|
|
15570
15948
|
fieldNamePrefix = `${fieldNamePrefix}between__`;
|
|
15571
15949
|
}
|
|
15572
15950
|
if(_field.type === 'datetime'){
|
|
15573
|
-
//
|
|
15574
|
-
|
|
15951
|
+
// 这里如果想把搜索范围展示效果改为日期范围,不可以直接改为input-date-range,因为它们规则不一样,包括时区规则和小时分秒的存值规则都不一样
|
|
15952
|
+
// 所以想改为展示日期范围效果,只能改input-datetime-range类型本身的属性来实现
|
|
15953
|
+
_field.type = 'input-datetime-range';
|
|
15575
15954
|
_field.is_wide = true;
|
|
15576
15955
|
fieldNamePrefix = `${fieldNamePrefix}between__`;
|
|
15577
15956
|
}
|
|
@@ -15757,6 +16136,13 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
|
|
|
15757
16136
|
}
|
|
15758
16137
|
}
|
|
15759
16138
|
|
|
16139
|
+
fieldSetBody.forEach((field)=>{
|
|
16140
|
+
//判断label是否存在,不存在时将label的空占位元素隐藏
|
|
16141
|
+
if(!field.label){
|
|
16142
|
+
field.labelClassName = "none";
|
|
16143
|
+
}
|
|
16144
|
+
});
|
|
16145
|
+
|
|
15760
16146
|
// fieldSet 已支持显隐控制
|
|
15761
16147
|
const sectionFieldsVisibleOn = _$1__namespace.map(_$1__namespace.compact(_$1__namespace.map(fieldSetBody, 'visibleOn')), (visibleOn) => {
|
|
15762
16148
|
let visible = visibleOn;
|
|
@@ -15879,19 +16265,200 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
15879
16265
|
return await getSections(permissionFields, formFields, ctx);
|
|
15880
16266
|
}
|
|
15881
16267
|
|
|
16268
|
+
/*
|
|
16269
|
+
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
16270
|
+
* @Date: 2024-01-18 15:12:41
|
|
16271
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
16272
|
+
* @LastEditTime: 2024-01-18 15:12:49
|
|
16273
|
+
*/
|
|
16274
|
+
/**
|
|
16275
|
+
* 生成符合标准uuid格式的36位满足唯一性的随机串
|
|
16276
|
+
* @returns uuid
|
|
16277
|
+
*/
|
|
16278
|
+
function uuidv4() {
|
|
16279
|
+
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, c =>
|
|
16280
|
+
(c ^ window.crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
|
16281
|
+
);
|
|
16282
|
+
}
|
|
16283
|
+
|
|
15882
16284
|
/*
|
|
15883
16285
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
15884
16286
|
* @Date: 2023-11-15 09:50:22
|
|
15885
|
-
* @LastEditors:
|
|
15886
|
-
* @LastEditTime: 2024-01-
|
|
16287
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
16288
|
+
* @LastEditTime: 2024-01-26 17:47:16
|
|
16289
|
+
*/
|
|
16290
|
+
|
|
16291
|
+
/**
|
|
16292
|
+
* 子表组件字段值中每行数据补上字段值为空的的字段值,把值统一设置为空字符串,是为了解决amis amis 3.6/6.0 input-table组件bug:行中字段值为空时会显示为父作用域中的同名变量值,见:https://github.com/baidu/amis/issues/9520
|
|
16293
|
+
* amis #9520修正后此函数及相关代码可以移除
|
|
16294
|
+
* @param {*} value 子表组件字段值,数组
|
|
16295
|
+
* @param {*} fields 子表组件fields属性,数组
|
|
16296
|
+
* @returns 转换后的子表组件字段值
|
|
16297
|
+
*/
|
|
16298
|
+
function getTableValueWithEmptyValue(value, fields) {
|
|
16299
|
+
return (value || []).map((itemValue) => {
|
|
16300
|
+
//这里不clone的话,会造成在pipeIn函数执行该函数后像pipeOut一样最终输出到表单项中,即库里字段值会被改了
|
|
16301
|
+
const newItemValue = _$1.clone(itemValue);
|
|
16302
|
+
(fields || []).forEach((itemField) => {
|
|
16303
|
+
if(itemField.name && (newItemValue[itemField.name] === undefined || newItemValue[itemField.name] === null)){
|
|
16304
|
+
// 这里newItemValue中不存在 itemField.name 属性,或者值为null时都会有“显示为父作用域中的同名变量值”的问题,所以null和undefined都要重置为空字符串
|
|
16305
|
+
// 实测数字、下拉框、多选lookup等字段类型重置为空字符串都不会有问题,而且实测amis from组件的清空表单字段值功能就是把表单中的各种字段类型设置为空字符串,所以看起来也符合amis规范
|
|
16306
|
+
newItemValue[itemField.name] = "";
|
|
16307
|
+
}
|
|
16308
|
+
if (newItemValue.children) {
|
|
16309
|
+
newItemValue.children = getTableValueWithEmptyValue(newItemValue.children, fields);
|
|
16310
|
+
}
|
|
16311
|
+
});
|
|
16312
|
+
return newItemValue;
|
|
16313
|
+
});
|
|
16314
|
+
}
|
|
16315
|
+
|
|
16316
|
+
/**
|
|
16317
|
+
* 把子表组件字段值中每行数据中经过上面getTableValueWithEmptyValue函数空字段值移除
|
|
16318
|
+
* amis #9520修正后此函数及相关代码可以移除
|
|
16319
|
+
* @param {*} value 子表组件字段值,数组
|
|
16320
|
+
* @param {*} fields 子表组件fields属性,数组
|
|
16321
|
+
* @returns 转换后的子表组件字段值
|
|
16322
|
+
*/
|
|
16323
|
+
function getTableValueWithoutEmptyValue(value, fields) {
|
|
16324
|
+
return (value || []).map((itemValue) => {
|
|
16325
|
+
const newItemValue = _$1.clone(itemValue);
|
|
16326
|
+
(fields || []).forEach((itemField) => {
|
|
16327
|
+
if(itemField.name && (newItemValue[itemField.name] === "" || newItemValue[itemField.name] === undefined || newItemValue[itemField.name] === null)){
|
|
16328
|
+
// 这里额外把null和undefined值也删除掉纯粹是没必要输出保存它们
|
|
16329
|
+
delete newItemValue[itemField.name];
|
|
16330
|
+
}
|
|
16331
|
+
if (newItemValue.children) {
|
|
16332
|
+
newItemValue.children = getTableValueWithoutEmptyValue(newItemValue.children, fields);
|
|
16333
|
+
}
|
|
16334
|
+
});
|
|
16335
|
+
return newItemValue;
|
|
16336
|
+
});
|
|
16337
|
+
}
|
|
16338
|
+
|
|
16339
|
+
function getTablePrimaryKey(props) {
|
|
16340
|
+
return props.primaryKey || "_id";
|
|
16341
|
+
}
|
|
16342
|
+
|
|
16343
|
+
/**
|
|
16344
|
+
* 子表组件字段值中每行数据的补上唯一标识字段值,其值为随机uuid
|
|
16345
|
+
* @param {*} value 子表组件字段值,数组
|
|
16346
|
+
* @param {*} primaryKey 主键字段名,一般为_id
|
|
16347
|
+
* @returns 转换后的子表组件字段值
|
|
16348
|
+
*/
|
|
16349
|
+
function getTableValueWithPrimaryKeyValue(value, primaryKey) {
|
|
16350
|
+
if (!primaryKey) {
|
|
16351
|
+
return value;
|
|
16352
|
+
}
|
|
16353
|
+
return (value || []).map((itemValue) => {
|
|
16354
|
+
//这里不clone的话,会造成在pipeIn函数执行该函数后像pipeOut一样最终输出到表单项中,即库里把primaryKey字段值保存了
|
|
16355
|
+
const newItemValue = _$1.clone(itemValue);
|
|
16356
|
+
if (newItemValue[primaryKey]) {
|
|
16357
|
+
if (newItemValue.children) {
|
|
16358
|
+
newItemValue.children = getTableValueWithPrimaryKeyValue(newItemValue.children, primaryKey);
|
|
16359
|
+
}
|
|
16360
|
+
return newItemValue;
|
|
16361
|
+
}
|
|
16362
|
+
else {
|
|
16363
|
+
newItemValue[primaryKey] = uuidv4();
|
|
16364
|
+
if (newItemValue.children) {
|
|
16365
|
+
newItemValue.children = getTableValueWithPrimaryKeyValue(newItemValue.children, primaryKey);
|
|
16366
|
+
}
|
|
16367
|
+
return newItemValue;
|
|
16368
|
+
}
|
|
16369
|
+
});
|
|
16370
|
+
}
|
|
16371
|
+
|
|
16372
|
+
/**
|
|
16373
|
+
* 子表组件字段值中每行数据的移除唯一标识字段值,因为该字段值一般只作临时标记,不存库
|
|
16374
|
+
* @param {*} value 子表组件字段值,数组
|
|
16375
|
+
* @param {*} primaryKey 主键字段名,一般为_id
|
|
16376
|
+
* @returns 转换后的子表组件字段值
|
|
16377
|
+
*/
|
|
16378
|
+
function getTableValueWithoutPrimaryKeyValue(value, primaryKey) {
|
|
16379
|
+
if (!primaryKey) {
|
|
16380
|
+
return value;
|
|
16381
|
+
}
|
|
16382
|
+
return (value || []).map((itemValue) => {
|
|
16383
|
+
//这里clone只是为了保险,不是必须的,每次修改子表数据是否都会生成新的primaryKey字段值是由pipeOut中识别autoGeneratePrimaryKeyValue决定的,跟这里没关系
|
|
16384
|
+
const newItemValue = _$1.clone(itemValue);
|
|
16385
|
+
if (newItemValue.children) {
|
|
16386
|
+
newItemValue.children = getTableValueWithoutPrimaryKeyValue(newItemValue.children, primaryKey);
|
|
16387
|
+
}
|
|
16388
|
+
delete newItemValue[primaryKey];
|
|
16389
|
+
return newItemValue;
|
|
16390
|
+
});
|
|
16391
|
+
}
|
|
16392
|
+
|
|
16393
|
+
/**
|
|
16394
|
+
* 子表组件字段值中每行数据的键值key移除指定前缀
|
|
16395
|
+
* @param {*} value 子表组件字段值,数组
|
|
16396
|
+
* @param {*} fieldPrefix 字段前缀
|
|
16397
|
+
* @returns 转换后的子表组件字段值
|
|
15887
16398
|
*/
|
|
16399
|
+
function getTableValueWithoutFieldPrefix(value, fieldPrefix) {
|
|
16400
|
+
let convertedValue = [];
|
|
16401
|
+
(value || []).forEach((itemValue) => {
|
|
16402
|
+
var newItemValue = {};
|
|
16403
|
+
for (let n in itemValue) {
|
|
16404
|
+
if (itemValue.hasOwnProperty(n)) {
|
|
16405
|
+
newItemValue[n.replace(new RegExp(`^${fieldPrefix}`), "")] = itemValue[n];
|
|
16406
|
+
}
|
|
16407
|
+
}
|
|
16408
|
+
convertedValue.push(newItemValue);
|
|
16409
|
+
});
|
|
16410
|
+
return convertedValue;
|
|
16411
|
+
}
|
|
16412
|
+
|
|
16413
|
+
/**
|
|
16414
|
+
* 子表组件字段值中每行数据的键值key补上指定前缀
|
|
16415
|
+
* @param {*} value 子表组件字段值,数组
|
|
16416
|
+
* @param {*} fieldPrefix 字段前缀
|
|
16417
|
+
* @param {*} primaryKey 主键字段名,主键不参与被键值key规则,需要排除,审批王amis表单也是这个规则
|
|
16418
|
+
* @returns 转换后的子表组件字段值
|
|
16419
|
+
*/
|
|
16420
|
+
function getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey) {
|
|
16421
|
+
let convertedValue = [];
|
|
16422
|
+
(value || []).forEach((itemValue) => {
|
|
16423
|
+
var newItemValue = {};
|
|
16424
|
+
for (let n in itemValue) {
|
|
16425
|
+
if (itemValue.hasOwnProperty(n) && typeof itemValue[n] !== undefined && n !== primaryKey) {
|
|
16426
|
+
newItemValue[`${fieldPrefix}${n}`] = itemValue[n];
|
|
16427
|
+
}
|
|
16428
|
+
}
|
|
16429
|
+
if (primaryKey && itemValue[primaryKey]) {
|
|
16430
|
+
newItemValue[primaryKey] = itemValue[primaryKey];
|
|
16431
|
+
}
|
|
16432
|
+
convertedValue.push(newItemValue);
|
|
16433
|
+
});
|
|
16434
|
+
return convertedValue;
|
|
16435
|
+
}
|
|
16436
|
+
|
|
16437
|
+
/**
|
|
16438
|
+
* 子表组件字段集合属性中每个字段name移除指定前缀
|
|
16439
|
+
* @param {*} fields 子表组件字段集合,数组
|
|
16440
|
+
* @param {*} fieldPrefix 字段前缀
|
|
16441
|
+
* @returns 转换后的子表组件字段值
|
|
16442
|
+
*/
|
|
16443
|
+
function getTableFieldsWithoutFieldPrefix(fields, fieldPrefix) {
|
|
16444
|
+
return (fields || []).map((item) => {
|
|
16445
|
+
const newItem = _$1.clone(item);//这里不clone的话,会造成子表组件重新render,从而审批王那边点开子表行编辑窗口时报错
|
|
16446
|
+
newItem.name = newItem.name.replace(new RegExp(`^${fieldPrefix}`), "");
|
|
16447
|
+
return newItem;
|
|
16448
|
+
});
|
|
16449
|
+
}
|
|
15888
16450
|
|
|
15889
16451
|
/**
|
|
15890
16452
|
* @param {*} props
|
|
15891
16453
|
* @param {*} mode edit/new/readonly
|
|
15892
16454
|
*/
|
|
15893
16455
|
function getFormFields(props, mode = "edit") {
|
|
15894
|
-
|
|
16456
|
+
let fieldPrefix = props.fieldPrefix;
|
|
16457
|
+
let fields = props.fields || [];
|
|
16458
|
+
if (fieldPrefix) {
|
|
16459
|
+
fields = getTableFieldsWithoutFieldPrefix(fields, fieldPrefix);
|
|
16460
|
+
}
|
|
16461
|
+
return (fields || []).map(function (item) {
|
|
15895
16462
|
let formItem = {
|
|
15896
16463
|
"type": "steedos-field",
|
|
15897
16464
|
"name": item.name,
|
|
@@ -15911,6 +16478,7 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
15911
16478
|
name: field.name,
|
|
15912
16479
|
quickEdit: {
|
|
15913
16480
|
"type": "steedos-field",
|
|
16481
|
+
"mode": "inline",
|
|
15914
16482
|
"config": Object.assign({}, field, {
|
|
15915
16483
|
label: false
|
|
15916
16484
|
})
|
|
@@ -15963,7 +16531,12 @@ async function getInputTableColumns(props) {
|
|
|
15963
16531
|
let inlineEditMode = props.inlineEditMode;
|
|
15964
16532
|
let showAsInlineEditMode = inlineEditMode && props.editable;
|
|
15965
16533
|
// 实测过,直接不生成对应的隐藏column并不会对input-table值造成丢失问题,隐藏的列字段值能正常维护
|
|
15966
|
-
|
|
16534
|
+
|
|
16535
|
+
let fieldPrefix = props.fieldPrefix;
|
|
16536
|
+
let fields = props.fields || [];
|
|
16537
|
+
if (fieldPrefix) {
|
|
16538
|
+
fields = getTableFieldsWithoutFieldPrefix(fields, fieldPrefix);
|
|
16539
|
+
}
|
|
15967
16540
|
if (columns && columns.length) {
|
|
15968
16541
|
return columns.map(function (column) {
|
|
15969
16542
|
let field, extendColumnProps = {};
|
|
@@ -15985,8 +16558,26 @@ async function getInputTableColumns(props) {
|
|
|
15985
16558
|
}
|
|
15986
16559
|
}
|
|
15987
16560
|
if (field) {
|
|
15988
|
-
let
|
|
15989
|
-
|
|
16561
|
+
let mode = typeof extendColumnProps.inlineEditMode === "boolean" ?
|
|
16562
|
+
extendColumnProps.inlineEditMode : showAsInlineEditMode;
|
|
16563
|
+
let tableCell = getInputTableCell(field, mode);
|
|
16564
|
+
let className = "";
|
|
16565
|
+
//判断是否换行,目前规则默认换行
|
|
16566
|
+
if(extendColumnProps.wrap != true){
|
|
16567
|
+
className += " whitespace-nowrap ";
|
|
16568
|
+
}else {
|
|
16569
|
+
className += " break-words ";
|
|
16570
|
+
}
|
|
16571
|
+
//合并classname
|
|
16572
|
+
if (typeof extendColumnProps.className == "object") {
|
|
16573
|
+
className = {
|
|
16574
|
+
[className]: "true",
|
|
16575
|
+
...extendColumnProps.className
|
|
16576
|
+
};
|
|
16577
|
+
} else if (typeof extendColumnProps.className == "string") {
|
|
16578
|
+
className = `${className} ${extendColumnProps.className} `;
|
|
16579
|
+
}
|
|
16580
|
+
return Object.assign({}, tableCell, extendColumnProps, {className});
|
|
15990
16581
|
}
|
|
15991
16582
|
else {
|
|
15992
16583
|
return column;
|
|
@@ -15996,6 +16587,7 @@ async function getInputTableColumns(props) {
|
|
|
15996
16587
|
else {
|
|
15997
16588
|
return fields.map(function (field) {
|
|
15998
16589
|
let tableCell = getInputTableCell(field, showAsInlineEditMode);
|
|
16590
|
+
tableCell.className = " whitespace-nowrap ";
|
|
15999
16591
|
return tableCell;
|
|
16000
16592
|
}) || [];
|
|
16001
16593
|
}
|
|
@@ -16008,7 +16600,7 @@ async function getInputTableColumns(props) {
|
|
|
16008
16600
|
*/
|
|
16009
16601
|
function getFormPagination(props, mode) {
|
|
16010
16602
|
let showPagination = true;
|
|
16011
|
-
if(mode === "new" && !!!props.editable){
|
|
16603
|
+
if (mode === "new" && !!!props.editable) {
|
|
16012
16604
|
//不允许编辑只允许新建时不应该让用户操作翻页
|
|
16013
16605
|
showPagination = false;
|
|
16014
16606
|
}
|
|
@@ -16024,23 +16616,41 @@ function getFormPagination(props, mode) {
|
|
|
16024
16616
|
let __formId = "${formId}";
|
|
16025
16617
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
16026
16618
|
let pageChangeDirection = context.props.pageChangeDirection;
|
|
16619
|
+
let mode = "${mode}";
|
|
16027
16620
|
// event.data中的index和__page分别表示当前要把表单数据提交到的行索引和用于标定下一页页码的当前页页码
|
|
16028
16621
|
// 一般来说__page = index + 1,但是可以让event.data中传入__page和index值不是这种联系。
|
|
16029
16622
|
// 比如__page设置为3,index设置为0表示把当前表单数据提交到第一页,但是跳转到第4页,弹出的表单中底下的新增和复制按钮依赖了此功能
|
|
16030
16623
|
// let currentPage = currentIndex + 1;
|
|
16031
16624
|
let currentPage = event.data.__page;
|
|
16032
16625
|
let currentIndex = event.data.index;
|
|
16033
|
-
|
|
16034
|
-
|
|
16035
|
-
|
|
16036
|
-
|
|
16037
|
-
|
|
16038
|
-
|
|
16039
|
-
|
|
16040
|
-
|
|
16041
|
-
|
|
16626
|
+
if(mode !== "readonly"){
|
|
16627
|
+
// 新建编辑时,翻页才需要把当前页表单保存,只读时直接翻页即可
|
|
16628
|
+
// 翻页到下一页之前需要先把当前页改动的内容保存到中间变量__tableItems中
|
|
16629
|
+
let currentFormValues = scope.getComponentById(__formId).getValues();
|
|
16630
|
+
// 这里不clone的话,其值会带上__super属性
|
|
16631
|
+
currentFormValues = _.clone(currentFormValues);
|
|
16632
|
+
var parent = event.data.parent;
|
|
16633
|
+
var __parentIndex = event.data.__parentIndex;
|
|
16634
|
+
if(parent){
|
|
16635
|
+
fieldValue[__parentIndex].children[currentIndex] = currentFormValues;
|
|
16636
|
+
// 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
|
|
16637
|
+
fieldValue[__parentIndex] = Object.assign({}, fieldValue[__parentIndex], {
|
|
16638
|
+
children: fieldValue[__parentIndex].children,
|
|
16639
|
+
__fix_rerender_after_children_modified_tag: new Date().getTime()
|
|
16640
|
+
});
|
|
16042
16641
|
}
|
|
16043
|
-
|
|
16642
|
+
else{
|
|
16643
|
+
fieldValue[currentIndex] = currentFormValues;
|
|
16644
|
+
}
|
|
16645
|
+
// 翻页到下一页前需要同时把改动的内容保存到最终正式的表单字段中,所以额外给正式表单字段执行一次setValue
|
|
16646
|
+
doAction({
|
|
16647
|
+
"componentId": "${props.id}",
|
|
16648
|
+
"actionType": "setValue",
|
|
16649
|
+
"args": {
|
|
16650
|
+
"value": fieldValue
|
|
16651
|
+
}
|
|
16652
|
+
});
|
|
16653
|
+
}
|
|
16044
16654
|
|
|
16045
16655
|
// 以下是翻页逻辑,翻到下一页并把下一页内容显示到表单上
|
|
16046
16656
|
let targetPage;
|
|
@@ -16089,9 +16699,14 @@ function getFormPagination(props, mode) {
|
|
|
16089
16699
|
"onEvent": {
|
|
16090
16700
|
"click": {
|
|
16091
16701
|
"actions": [
|
|
16702
|
+
{
|
|
16703
|
+
"actionType": "validate",
|
|
16704
|
+
"componentId": formId
|
|
16705
|
+
},
|
|
16092
16706
|
{
|
|
16093
16707
|
"actionType": "custom",
|
|
16094
|
-
"script": onPageChangeScript
|
|
16708
|
+
"script": onPageChangeScript,
|
|
16709
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
16095
16710
|
}
|
|
16096
16711
|
]
|
|
16097
16712
|
}
|
|
@@ -16099,7 +16714,8 @@ function getFormPagination(props, mode) {
|
|
|
16099
16714
|
},
|
|
16100
16715
|
{
|
|
16101
16716
|
"type": "tpl",
|
|
16102
|
-
|
|
16717
|
+
// 这里用__super.parent,加__super是为了防止当前记录有字段名为parent的重名变量
|
|
16718
|
+
"tpl": "${__page}/${__super.parent ? COMPACT(__tableItems[__parentIndex]['children']).length : COMPACT(__tableItems).length}"
|
|
16103
16719
|
},
|
|
16104
16720
|
{
|
|
16105
16721
|
"type": "button",
|
|
@@ -16107,15 +16723,22 @@ function getFormPagination(props, mode) {
|
|
|
16107
16723
|
"icon": `fa fa-angle-right`,
|
|
16108
16724
|
"level": "link",
|
|
16109
16725
|
"pageChangeDirection": "next",
|
|
16110
|
-
"disabledOn": showPagination ? "${__page >= __tableItems.length}" : "true",
|
|
16726
|
+
// "disabledOn": showPagination ? "${__page >= __tableItems.length}" : "true",
|
|
16727
|
+
// 这里用__super.parent,加__super是为了防止当前记录有字段名为parent的重名变量
|
|
16728
|
+
"disabledOn": showPagination ? "${__page >= (__super.parent ? COMPACT(__tableItems[__parentIndex]['children']).length : COMPACT(__tableItems).length)}" : "true",
|
|
16111
16729
|
"size": "sm",
|
|
16112
16730
|
"id": buttonNextId,
|
|
16113
16731
|
"onEvent": {
|
|
16114
16732
|
"click": {
|
|
16115
16733
|
"actions": [
|
|
16734
|
+
{
|
|
16735
|
+
"actionType": "validate",
|
|
16736
|
+
"componentId": formId
|
|
16737
|
+
},
|
|
16116
16738
|
{
|
|
16117
16739
|
"actionType": "custom",
|
|
16118
|
-
"script": onPageChangeScript
|
|
16740
|
+
"script": onPageChangeScript,
|
|
16741
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
16119
16742
|
}
|
|
16120
16743
|
]
|
|
16121
16744
|
}
|
|
@@ -16136,18 +16759,19 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16136
16759
|
// console.log("==getFormPaginationWrapper===", props, mode);
|
|
16137
16760
|
let serviceId = getComponentId("form_pagination", props.id);
|
|
16138
16761
|
let tableServiceId = getComponentId("table_service", props.id);
|
|
16762
|
+
let primaryKey = getTablePrimaryKey(props);
|
|
16139
16763
|
let innerForm = Object.assign({}, form, {
|
|
16140
16764
|
"data": {
|
|
16141
16765
|
// 这里加__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
|
|
16142
16766
|
// 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
|
|
16143
|
-
"&": "${__tableItems[__super.index]}"
|
|
16767
|
+
"&": "${__super.parent ? __tableItems[__parentIndex]['children'][__super.index] : __tableItems[__super.index]}"
|
|
16144
16768
|
}
|
|
16145
16769
|
});
|
|
16146
16770
|
let formBody = [
|
|
16147
16771
|
{
|
|
16148
16772
|
"type": "wrapper",
|
|
16149
16773
|
"size": "none",
|
|
16150
|
-
"className": "flex justify-end sticky top-0 right-0 left-0 z-20 bg-white
|
|
16774
|
+
"className": "flex justify-end sticky top-0 right-0 left-0 z-20 bg-white",
|
|
16151
16775
|
"body": [
|
|
16152
16776
|
getFormPagination(props, mode)
|
|
16153
16777
|
]
|
|
@@ -16163,7 +16787,7 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16163
16787
|
}
|
|
16164
16788
|
];
|
|
16165
16789
|
let onServiceInitedScript = `
|
|
16166
|
-
//
|
|
16790
|
+
// 以下脚本解决了有时弹出编辑表单时,表单中的值比最后一次编辑保存的值会延迟一拍。
|
|
16167
16791
|
// 比如:inlineEditMode模式时,用户在表格单元格中直接修改数据,然后弹出的表单form中并没有包含单元格中修改的内容
|
|
16168
16792
|
// 另外有的地方在非inlineEditMode模式时也会有这种延迟一拍问题,比如对象字段中下拉框类型字段的”选择项“属性
|
|
16169
16793
|
// 再比如工作流规则详细页面修改了子表字段”时间触发器“值后,在只读界面点击查看按钮弹出的表单中__tableItems值是修改前的值
|
|
@@ -16176,8 +16800,13 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16176
16800
|
// 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
16177
16801
|
// 这里如果不.clone的话,在弹出窗口中显示的子表组件,添加行后点窗口的取消按钮关闭窗口后无法把之前的操作还原,即把之前添加的行自动移除
|
|
16178
16802
|
let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"] || []);
|
|
16803
|
+
let fieldPrefix = "${props.fieldPrefix || ''}";
|
|
16804
|
+
if(fieldPrefix){
|
|
16805
|
+
let getTableValueWithoutFieldPrefix = new Function('v', 'f', "return (" + ${getTableValueWithoutFieldPrefix.toString()} + ")(v, f)");
|
|
16806
|
+
lastestFieldValue = getTableValueWithoutFieldPrefix(lastestFieldValue, fieldPrefix);
|
|
16807
|
+
}
|
|
16179
16808
|
//不可以直接像event.data.__tableItems = lastestFieldValue; 这样整个赋值,否则作用域会断
|
|
16180
|
-
let mode = "${mode}";
|
|
16809
|
+
let mode = "${mode || ''}";
|
|
16181
16810
|
if(mode === "new"){
|
|
16182
16811
|
// 点击子表组件底部新增按钮时新增一条空白行并自动翻页到新增行
|
|
16183
16812
|
// 注意点击弹出的子表行详细表单中的新增按钮不会进此service init事件函数中
|
|
@@ -16198,6 +16827,26 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16198
16827
|
event.data.__tableItems.forEach(function(n,i){
|
|
16199
16828
|
event.data.__tableItems[i] = lastestFieldValue[i];
|
|
16200
16829
|
});
|
|
16830
|
+
|
|
16831
|
+
var parent = event.data.parent;
|
|
16832
|
+
var fieldValue = event.data.__tableItems;
|
|
16833
|
+
if(parent){
|
|
16834
|
+
// 如果是子行,即在节点嵌套情况下,当前节点如果是children属性下的子节点时,则算出其所属父行的索引值
|
|
16835
|
+
var primaryKey = "${primaryKey}";
|
|
16836
|
+
event.data.__parentIndex = _.findIndex(fieldValue, function(item){
|
|
16837
|
+
return item[primaryKey] == parent[primaryKey];
|
|
16838
|
+
});
|
|
16839
|
+
if(event.data.__parentIndex < 0){
|
|
16840
|
+
let tableId = "${props.id}";
|
|
16841
|
+
let table = scope.getComponentById(tableId)
|
|
16842
|
+
// autoGeneratePrimaryKeyValue不为true的情况下,即子表组件input-table的pipeOut函数中会移除表单了子表字段的primaryKey字段值,
|
|
16843
|
+
// 此时行primaryKey字段值为空,但是pipeIn函数中已经为input-table自动生成过primaryKey字段值了,只是没有输出到表单字段值中而已
|
|
16844
|
+
// 所以上面从表单字段值中没找到__parentIndex,是因为此时行primaryKey字段值只经过pipeIn保存到table组件内而没有保存到tableService
|
|
16845
|
+
event.data.__parentIndex = _.findIndex(table.props.value, function(item){
|
|
16846
|
+
return item[primaryKey] == parent[primaryKey];
|
|
16847
|
+
});
|
|
16848
|
+
}
|
|
16849
|
+
}
|
|
16201
16850
|
`;
|
|
16202
16851
|
let schema = {
|
|
16203
16852
|
"type": "service",
|
|
@@ -16218,6 +16867,7 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16218
16867
|
// "body": formBody,
|
|
16219
16868
|
"data": {
|
|
16220
16869
|
"__page": "${index + 1}",
|
|
16870
|
+
"__parentIndex": null,//兼容节点嵌套情况,即节点中有children属性时,这里记录当前节点所属上层节点index,只支持向上找一层,不支持多层
|
|
16221
16871
|
// "__total": `\${${props.name}.length}`,
|
|
16222
16872
|
// "__total": "${__tableItems.length}",
|
|
16223
16873
|
// "__paginationServiceId": serviceId,
|
|
@@ -16244,6 +16894,7 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16244
16894
|
async function getForm(props, mode = "edit", formId) {
|
|
16245
16895
|
let formFields = getFormFields(props, mode);
|
|
16246
16896
|
let body = await getFormBody(null, formFields);
|
|
16897
|
+
let primaryKey = getTablePrimaryKey(props);
|
|
16247
16898
|
if (!formId) {
|
|
16248
16899
|
formId = getComponentId("form", props.id);
|
|
16249
16900
|
}
|
|
@@ -16262,10 +16913,41 @@ async function getForm(props, mode = "edit", formId) {
|
|
|
16262
16913
|
// 新增行弹出编辑行表单,在弹出之前已经不用先增加一行,因为在翻页service初始化的时候会判断mode为new时自动新增一行
|
|
16263
16914
|
let onEditItemSubmitScript = `
|
|
16264
16915
|
// let fieldValue = _.cloneDeep(event.data["${props.name}"]);
|
|
16916
|
+
let removeEmptyItems = function(items){
|
|
16917
|
+
let i = _.findIndex(items, function(item){
|
|
16918
|
+
return item === undefined
|
|
16919
|
+
});
|
|
16920
|
+
if(i > -1){
|
|
16921
|
+
items.splice(i, 1);
|
|
16922
|
+
removeEmptyItems(items);
|
|
16923
|
+
}
|
|
16924
|
+
}
|
|
16925
|
+
// 因为删除时只是把input-table组件中的行数据删除了,并没有把父层service中的行删除,所以__tableItems会有值为undefined的数据,需要移除掉
|
|
16926
|
+
// 不用event.data.__tableItems = _.compact(event.data.__tableItems)是因为会把__tableItems变量保存到表单中
|
|
16927
|
+
removeEmptyItems(event.data.__tableItems);
|
|
16265
16928
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
16266
16929
|
//这里加__super.__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
|
|
16267
16930
|
// 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
|
|
16268
|
-
fieldValue[event.data.__super.__super.index] = JSON.parse(JSON.stringify(event.data));
|
|
16931
|
+
// fieldValue[event.data.__super.__super.index] = JSON.parse(JSON.stringify(event.data));
|
|
16932
|
+
var currentIndex = event.data.__super.__super.index;
|
|
16933
|
+
var currentFormValues = JSON.parse(JSON.stringify(event.data));
|
|
16934
|
+
var parent = event.data.__super.__super.parent;
|
|
16935
|
+
var __parentIndex = event.data.__super.__super.__parentIndex;
|
|
16936
|
+
let uuidv4 = new Function("return (" + ${uuidv4.toString()} + ")()");
|
|
16937
|
+
var primaryKey = "${primaryKey}";
|
|
16938
|
+
if(parent){
|
|
16939
|
+
fieldValue[__parentIndex].children[currentIndex] = currentFormValues;
|
|
16940
|
+
// 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
|
|
16941
|
+
fieldValue[__parentIndex] = Object.assign({}, fieldValue[__parentIndex], {
|
|
16942
|
+
children: fieldValue[__parentIndex].children,
|
|
16943
|
+
__fix_rerender_after_children_modified_tag: new Date().getTime()
|
|
16944
|
+
});
|
|
16945
|
+
}
|
|
16946
|
+
else{
|
|
16947
|
+
// 这里currentFormValues中如果没有primaryKey字段值不用处理,因为组件的pipeIn/pipeOut中会为每行自动生成
|
|
16948
|
+
// 也不用担心复制行时_id会重复,因为点击复制按钮时已经处理过了
|
|
16949
|
+
fieldValue[currentIndex] = currentFormValues;
|
|
16950
|
+
}
|
|
16269
16951
|
doAction({
|
|
16270
16952
|
"componentId": "${props.id}",
|
|
16271
16953
|
"actionType": "setValue",
|
|
@@ -16361,13 +17043,14 @@ async function getForm(props, mode = "edit", formId) {
|
|
|
16361
17043
|
*/
|
|
16362
17044
|
async function getButtonActions(props, mode) {
|
|
16363
17045
|
let actions = [];
|
|
17046
|
+
let primaryKey = getTablePrimaryKey(props);
|
|
16364
17047
|
let formId = getComponentId("form", props.id);
|
|
16365
17048
|
let dialogId = getComponentId("dialog", props.id);
|
|
16366
17049
|
let buttonNextId = getComponentId("button_next", props.id);
|
|
16367
17050
|
let formPaginationId = getComponentId("form_pagination", props.id);
|
|
16368
17051
|
let parentFormData = "${__super.__super.__super.__super || {}}";
|
|
16369
17052
|
let amisVersion = getComparableAmisVersion();
|
|
16370
|
-
if(amisVersion < 3.6){
|
|
17053
|
+
if (amisVersion < 3.6) {
|
|
16371
17054
|
parentFormData = "${__super.__super || {}}";
|
|
16372
17055
|
}
|
|
16373
17056
|
if (mode == "new" || mode == "edit") {
|
|
@@ -16403,9 +17086,42 @@ async function getButtonActions(props, mode) {
|
|
|
16403
17086
|
// };
|
|
16404
17087
|
let onSaveAndNewItemScript = `
|
|
16405
17088
|
let scope = event.context.scoped;
|
|
17089
|
+
let removeEmptyItems = function(items){
|
|
17090
|
+
let i = _.findIndex(items, function(item){
|
|
17091
|
+
return item === undefined
|
|
17092
|
+
});
|
|
17093
|
+
if(i > -1){
|
|
17094
|
+
items.splice(i, 1);
|
|
17095
|
+
removeEmptyItems(items);
|
|
17096
|
+
}
|
|
17097
|
+
}
|
|
17098
|
+
// 因为删除时只是把input-table组件中的行数据删除了,并没有把父层service中的行删除,所以__tableItems会有值为undefined的数据,需要移除掉
|
|
17099
|
+
// 不用event.data.__tableItems = _.compact(event.data.__tableItems)是因为会把__tableItems变量保存到表单中
|
|
17100
|
+
removeEmptyItems(event.data.__tableItems);
|
|
16406
17101
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
16407
17102
|
// 新建一条空白行并保存到子表组件
|
|
16408
|
-
|
|
17103
|
+
var parent = event.data.__super.parent;
|
|
17104
|
+
var primaryKey = "${primaryKey}";
|
|
17105
|
+
var __parentIndex = parent && _.findIndex(fieldValue, function(item){
|
|
17106
|
+
return item[primaryKey] == parent[primaryKey];
|
|
17107
|
+
});
|
|
17108
|
+
if(parent && __parentIndex < 0){
|
|
17109
|
+
let tableId = "${props.id}";
|
|
17110
|
+
let table = scope.getComponentById(tableId)
|
|
17111
|
+
// autoGeneratePrimaryKeyValue不为true的情况下,即子表组件input-table的pipeOut函数中会移除表单了子表字段的primaryKey字段值,
|
|
17112
|
+
// 此时行primaryKey字段值为空,但是pipeIn函数中已经为input-table自动生成过primaryKey字段值了,只是没有输出到表单字段值中而已
|
|
17113
|
+
// 所以上面从表单字段值中没找到__parentIndex,是因为此时行primaryKey字段值只经过pipeIn保存到table组件内而没有保存到tableService
|
|
17114
|
+
__parentIndex = _.findIndex(table.props.value, function(item){
|
|
17115
|
+
return item[primaryKey] == parent[primaryKey];
|
|
17116
|
+
});
|
|
17117
|
+
}
|
|
17118
|
+
if(parent){
|
|
17119
|
+
fieldValue[__parentIndex].children.push({});
|
|
17120
|
+
// 这里实测不需要fieldValue[__parentIndex] = ... 来重写整个父行让子表回显,所以没加相关代码
|
|
17121
|
+
}
|
|
17122
|
+
else{
|
|
17123
|
+
fieldValue.push({});
|
|
17124
|
+
}
|
|
16409
17125
|
doAction({
|
|
16410
17126
|
"componentId": "${props.id}",
|
|
16411
17127
|
"actionType": "setValue",
|
|
@@ -16417,7 +17133,13 @@ async function getButtonActions(props, mode) {
|
|
|
16417
17133
|
let __paginationServiceId = "${formPaginationId}";
|
|
16418
17134
|
let __paginationData = scope.getComponentById(__paginationServiceId).getData();
|
|
16419
17135
|
event.data.index = __paginationData.index;
|
|
16420
|
-
|
|
17136
|
+
if(parent){
|
|
17137
|
+
event.data.__page = fieldValue[__parentIndex].children.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
17138
|
+
event.data.__parentIndex = __parentIndex; //执行下面的翻页按钮事件中依赖了__parentIndex值
|
|
17139
|
+
}
|
|
17140
|
+
else{
|
|
17141
|
+
event.data.__page = fieldValue.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
17142
|
+
}
|
|
16421
17143
|
// 触发翻页按钮事件,实现保存当前页数据并跳转到最后一行
|
|
16422
17144
|
scope.getComponentById(buttonNextId).props.dispatchEvent("click", event.data);
|
|
16423
17145
|
`;
|
|
@@ -16426,9 +17148,49 @@ async function getButtonActions(props, mode) {
|
|
|
16426
17148
|
let __formId = "${formId}";
|
|
16427
17149
|
// let newItem = JSON.parse(JSON.stringify(event.data));
|
|
16428
17150
|
let newItem = scope.getComponentById(__formId).getValues();//这里不可以用event.data,因为其拿到的是弹出表单时的初始值,不是用户实时填写的数据
|
|
17151
|
+
newItem = _.clone(newItem);
|
|
17152
|
+
let removeEmptyItems = function(items){
|
|
17153
|
+
let i = _.findIndex(items, function(item){
|
|
17154
|
+
return item === undefined
|
|
17155
|
+
});
|
|
17156
|
+
if(i > -1){
|
|
17157
|
+
items.splice(i, 1);
|
|
17158
|
+
removeEmptyItems(items);
|
|
17159
|
+
}
|
|
17160
|
+
}
|
|
17161
|
+
// 因为删除时只是把input-table组件中的行数据删除了,并没有把父层service中的行删除,所以__tableItems会有值为undefined的数据,需要移除掉
|
|
17162
|
+
// 不用event.data.__tableItems = _.compact(event.data.__tableItems)是因为会把__tableItems变量保存到表单中
|
|
17163
|
+
removeEmptyItems(event.data.__tableItems);
|
|
16429
17164
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
16430
17165
|
// 复制当前页数据到新建行并保存到子表组件
|
|
16431
|
-
fieldValue.push(newItem);
|
|
17166
|
+
// fieldValue.push(newItem);
|
|
17167
|
+
var parent = event.data.__super.parent;
|
|
17168
|
+
var primaryKey = "${primaryKey}";
|
|
17169
|
+
var __parentIndex = parent && _.findIndex(fieldValue, function(item){
|
|
17170
|
+
return item[primaryKey] == parent[primaryKey];
|
|
17171
|
+
});
|
|
17172
|
+
if(parent && __parentIndex < 0){
|
|
17173
|
+
let tableId = "${props.id}";
|
|
17174
|
+
let table = scope.getComponentById(tableId)
|
|
17175
|
+
// autoGeneratePrimaryKeyValue不为true的情况下,即子表组件input-table的pipeOut函数中会移除表单了子表字段的primaryKey字段值,
|
|
17176
|
+
// 此时行primaryKey字段值为空,但是pipeIn函数中已经为input-table自动生成过primaryKey字段值了,只是没有输出到表单字段值中而已
|
|
17177
|
+
// 所以上面从表单字段值中没找到__parentIndex,是因为此时行primaryKey字段值只经过pipeIn保存到table组件内而没有保存到tableService
|
|
17178
|
+
__parentIndex = _.findIndex(table.props.value, function(item){
|
|
17179
|
+
return item[primaryKey] == parent[primaryKey];
|
|
17180
|
+
});
|
|
17181
|
+
}
|
|
17182
|
+
if(newItem[primaryKey]){
|
|
17183
|
+
// 如果newItem已经有主键字段值,则重新生成新的主键值,否则会重复。
|
|
17184
|
+
let uuidv4 = new Function("return (" + ${uuidv4.toString()} + ")()");
|
|
17185
|
+
newItem[primaryKey] = uuidv4();
|
|
17186
|
+
}
|
|
17187
|
+
if(parent){
|
|
17188
|
+
fieldValue[__parentIndex].children.push(newItem);
|
|
17189
|
+
// 这里实测不需要fieldValue[__parentIndex] = ... 来重写整个父行让子表回显,所以没加相关代码
|
|
17190
|
+
}
|
|
17191
|
+
else{
|
|
17192
|
+
fieldValue.push(newItem);
|
|
17193
|
+
}
|
|
16432
17194
|
doAction({
|
|
16433
17195
|
"componentId": "${props.id}",
|
|
16434
17196
|
"actionType": "setValue",
|
|
@@ -16440,19 +17202,25 @@ async function getButtonActions(props, mode) {
|
|
|
16440
17202
|
let __paginationServiceId = "${formPaginationId}";
|
|
16441
17203
|
let __paginationData = scope.getComponentById(__paginationServiceId).getData();
|
|
16442
17204
|
event.data.index = __paginationData.index;
|
|
16443
|
-
|
|
17205
|
+
if(parent){
|
|
17206
|
+
event.data.__page = fieldValue[__parentIndex].children.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
17207
|
+
event.data.__parentIndex = __parentIndex; //执行下面的翻页按钮事件中依赖了__parentIndex值
|
|
17208
|
+
}
|
|
17209
|
+
else{
|
|
17210
|
+
event.data.__page = fieldValue.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
17211
|
+
}
|
|
16444
17212
|
// 触发翻页按钮事件,实现保存当前页数据并跳转到最后一行
|
|
16445
17213
|
scope.getComponentById(buttonNextId).props.dispatchEvent("click", event.data);
|
|
16446
17214
|
`;
|
|
16447
17215
|
let dialogButtons = [
|
|
16448
17216
|
{
|
|
16449
|
-
|
|
16450
|
-
|
|
16451
|
-
|
|
16452
|
-
|
|
17217
|
+
"type": "button",
|
|
17218
|
+
"label": "完成",
|
|
17219
|
+
"actionType": "confirm",
|
|
17220
|
+
"level": "primary"
|
|
16453
17221
|
}
|
|
16454
17222
|
];
|
|
16455
|
-
if(props.addable){
|
|
17223
|
+
if (props.addable) {
|
|
16456
17224
|
// 有新增行权限时额外添加新增和复制按钮
|
|
16457
17225
|
dialogButtons = [
|
|
16458
17226
|
{
|
|
@@ -16462,9 +17230,14 @@ async function getButtonActions(props, mode) {
|
|
|
16462
17230
|
"onEvent": {
|
|
16463
17231
|
"click": {
|
|
16464
17232
|
"actions": [
|
|
17233
|
+
{
|
|
17234
|
+
"actionType": "validate",
|
|
17235
|
+
"componentId": formId
|
|
17236
|
+
},
|
|
16465
17237
|
{
|
|
16466
17238
|
"actionType": "custom",
|
|
16467
|
-
"script": onSaveAndNewItemScript
|
|
17239
|
+
"script": onSaveAndNewItemScript,
|
|
17240
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
16468
17241
|
}
|
|
16469
17242
|
]
|
|
16470
17243
|
}
|
|
@@ -16477,9 +17250,14 @@ async function getButtonActions(props, mode) {
|
|
|
16477
17250
|
"onEvent": {
|
|
16478
17251
|
"click": {
|
|
16479
17252
|
"actions": [
|
|
17253
|
+
{
|
|
17254
|
+
"actionType": "validate",
|
|
17255
|
+
"componentId": formId
|
|
17256
|
+
},
|
|
16480
17257
|
{
|
|
16481
17258
|
"actionType": "custom",
|
|
16482
|
-
"script": onSaveAndCopyItemScript
|
|
17259
|
+
"script": onSaveAndCopyItemScript,
|
|
17260
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
16483
17261
|
}
|
|
16484
17262
|
]
|
|
16485
17263
|
}
|
|
@@ -16516,12 +17294,15 @@ async function getButtonActions(props, mode) {
|
|
|
16516
17294
|
"_master": "${_master}",
|
|
16517
17295
|
"global": "${global}",
|
|
16518
17296
|
"uiSchema": "${uiSchema}",
|
|
16519
|
-
"index": "${index}"
|
|
17297
|
+
"index": "${index}",//amis组件自带行索引,在节点嵌套情况下,当前节点如果是children属性下的子节点时,这里的index是当前节点在children中的索引,而不是外层父节点的index
|
|
17298
|
+
"parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
16520
17299
|
// "__tableItems": `\${${props.name}}`
|
|
16521
17300
|
// 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
|
|
16522
17301
|
// 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
|
|
16523
17302
|
// "__tableItems": `\${${props.name}|json|toJson}`
|
|
16524
|
-
|
|
17303
|
+
// 在节点嵌套情况下,当前节点正好是带children属性的节点的话,这里弹出的dialog映射到的会是children数组,这是amis目前的规则,
|
|
17304
|
+
// 所以这里加判断有children时,用__super.__super让映射到正确的作用域层,如果不加,则__tableItems取到的会是children数组,而不是整个子表组件的值
|
|
17305
|
+
"__tableItems": `\${((children ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
|
|
16525
17306
|
},
|
|
16526
17307
|
"actions": dialogButtons,
|
|
16527
17308
|
"onEvent": {
|
|
@@ -16544,35 +17325,39 @@ async function getButtonActions(props, mode) {
|
|
|
16544
17325
|
Object.assign(actionShowEditDialog.dialog, props.dialog);
|
|
16545
17326
|
}
|
|
16546
17327
|
if (mode == "new") {
|
|
16547
|
-
`
|
|
16548
|
-
|
|
16549
|
-
|
|
16550
|
-
|
|
16551
|
-
|
|
16552
|
-
|
|
16553
|
-
|
|
16554
|
-
|
|
16555
|
-
|
|
16556
|
-
|
|
16557
|
-
|
|
16558
|
-
|
|
16559
|
-
|
|
16560
|
-
|
|
16561
|
-
|
|
16562
|
-
|
|
16563
|
-
|
|
16564
|
-
|
|
16565
|
-
|
|
16566
|
-
|
|
16567
|
-
|
|
16568
|
-
|
|
16569
|
-
|
|
16570
|
-
|
|
16571
|
-
|
|
16572
|
-
|
|
16573
|
-
|
|
16574
|
-
|
|
16575
|
-
`;
|
|
17328
|
+
// let onNewLineScript = `
|
|
17329
|
+
// let newItem = {};
|
|
17330
|
+
// if(event.data["${props.name}"]){
|
|
17331
|
+
// // let fieldValue = event.data.__tableItems;
|
|
17332
|
+
// // 这里不用__tableItems是因为新建的时候没有翻页,里面没有也不需要走__tableItems变量
|
|
17333
|
+
// // let fieldValue = _.clone(event.data["${props.name}"]);
|
|
17334
|
+
// let fieldValue = event.data["${props.name}"];
|
|
17335
|
+
// fieldValue.push(newItem);
|
|
17336
|
+
// doAction({
|
|
17337
|
+
// "componentId": "${props.id}",
|
|
17338
|
+
// "actionType": "setValue",
|
|
17339
|
+
// "args": {
|
|
17340
|
+
// "value": fieldValue
|
|
17341
|
+
// }
|
|
17342
|
+
// });
|
|
17343
|
+
// event.data.index = fieldValue.length - 1;
|
|
17344
|
+
// }
|
|
17345
|
+
// else{
|
|
17346
|
+
// // 这里不可以执行event.data["${props.name}"]=[newItem],数据域会断掉
|
|
17347
|
+
// doAction({
|
|
17348
|
+
// "componentId": "${props.id}",
|
|
17349
|
+
// "actionType": "setValue",
|
|
17350
|
+
// "args": {
|
|
17351
|
+
// "value": [newItem]
|
|
17352
|
+
// }
|
|
17353
|
+
// });
|
|
17354
|
+
// event.data.index = 1;
|
|
17355
|
+
// }
|
|
17356
|
+
// `;
|
|
17357
|
+
// let actionNewLine = {
|
|
17358
|
+
// "actionType": "custom",
|
|
17359
|
+
// "script": onNewLineScript
|
|
17360
|
+
// };
|
|
16576
17361
|
// 新增行时不需要在弹出编辑表单前先加一行,因为会在编辑表单所在service初始化时判断到是新增就自动增加一行,因为这里拿不到event.data.__tableItems,也无法变更其值
|
|
16577
17362
|
// actions = [actionNewLine, actionShowEditDialog];
|
|
16578
17363
|
actions = [actionShowEditDialog];
|
|
@@ -16607,15 +17392,20 @@ async function getButtonActions(props, mode) {
|
|
|
16607
17392
|
// 映射到中间变量__parentForm而不是直接用&展开映射是为了避免表单中字段名与作用域中变量重名
|
|
16608
17393
|
// "__parentForm": "${__super.__super || {}}",
|
|
16609
17394
|
"__parentForm": parentFormData,
|
|
17395
|
+
"_master": "${_master}",
|
|
16610
17396
|
"global": "${global}",
|
|
16611
17397
|
"uiSchema": "${uiSchema}",
|
|
16612
17398
|
"index": "${index}",
|
|
17399
|
+
"parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
16613
17400
|
// "__tableItems": `\${${props.name}}`
|
|
16614
17401
|
// 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
|
|
16615
17402
|
// 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
|
|
16616
17403
|
// "__tableItems": `\${${props.name}|json|toJson}`
|
|
16617
|
-
"__tableItems": `\${(
|
|
16618
|
-
|
|
17404
|
+
// "__tableItems": `\${((__super.parent ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
|
|
17405
|
+
// 在节点嵌套情况下,当前节点正好是带children属性的节点的话,这里弹出的dialog映射到的会是children数组,这是amis目前的规则,
|
|
17406
|
+
// 所以这里加判断有children时,用__super.__super让映射到正确的作用域层,如果不加,则__tableItems取到的会是children数组,而不是整个子表组件的值
|
|
17407
|
+
"__tableItems": `\${((children ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
|
|
17408
|
+
},
|
|
16619
17409
|
}
|
|
16620
17410
|
}
|
|
16621
17411
|
];
|
|
@@ -16630,8 +17420,40 @@ async function getButtonActions(props, mode) {
|
|
|
16630
17420
|
let wrapperServiceData = wrapperService.getData();
|
|
16631
17421
|
// 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
16632
17422
|
// 这里_.clone是因为字段设计布局设置分组这种弹出窗口中的子表组件,直接删除后,点取消无法还原
|
|
17423
|
+
// 也因为这里clone没有直接删除,所以弹出编辑表单提交事件中event.data.__tableItems中取到的值会有被删除的行数据为undefined
|
|
16633
17424
|
let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"]);
|
|
16634
|
-
|
|
17425
|
+
var currentIndex = event.data.index;
|
|
17426
|
+
var parent = event.data.__super.parent;
|
|
17427
|
+
var primaryKey = "${primaryKey}";
|
|
17428
|
+
var __parentIndex = parent && _.findIndex(lastestFieldValue, function(item){
|
|
17429
|
+
return item[primaryKey] == parent[primaryKey];
|
|
17430
|
+
});
|
|
17431
|
+
if(parent && __parentIndex < 0){
|
|
17432
|
+
let tableId = "${props.id}";
|
|
17433
|
+
let table = scope.getComponentById(tableId)
|
|
17434
|
+
// autoGeneratePrimaryKeyValue不为true的情况下,即子表组件input-table的pipeOut函数中会移除表单了子表字段的primaryKey字段值,
|
|
17435
|
+
// 此时行primaryKey字段值为空,但是pipeIn函数中已经为input-table自动生成过primaryKey字段值了,只是没有输出到表单字段值中而已
|
|
17436
|
+
// 所以上面从表单字段值中没找到__parentIndex,是因为此时行primaryKey字段值只经过pipeIn保存到table组件内而没有保存到tableService
|
|
17437
|
+
__parentIndex = _.findIndex(table.props.value, function(item){
|
|
17438
|
+
return item[primaryKey] == parent[primaryKey];
|
|
17439
|
+
});
|
|
17440
|
+
}
|
|
17441
|
+
if(parent){
|
|
17442
|
+
lastestFieldValue[__parentIndex].children.splice(currentIndex, 1);
|
|
17443
|
+
// 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
|
|
17444
|
+
lastestFieldValue[__parentIndex] = Object.assign({}, lastestFieldValue[__parentIndex], {
|
|
17445
|
+
children: lastestFieldValue[__parentIndex].children,
|
|
17446
|
+
__fix_rerender_after_children_modified_tag: new Date().getTime()
|
|
17447
|
+
});
|
|
17448
|
+
}
|
|
17449
|
+
else{
|
|
17450
|
+
lastestFieldValue.splice(currentIndex, 1);
|
|
17451
|
+
}
|
|
17452
|
+
let fieldPrefix = "${props.fieldPrefix || ''}";
|
|
17453
|
+
if(fieldPrefix){
|
|
17454
|
+
let getTableValueWithoutFieldPrefix = new Function('v', 'f', "return (" + ${getTableValueWithoutFieldPrefix.toString()} + ")(v, f)");
|
|
17455
|
+
lastestFieldValue = getTableValueWithoutFieldPrefix(lastestFieldValue, fieldPrefix);
|
|
17456
|
+
}
|
|
16635
17457
|
doAction({
|
|
16636
17458
|
"componentId": "${props.id}",
|
|
16637
17459
|
"actionType": "setValue",
|
|
@@ -16701,58 +17523,104 @@ async function getButtonView(props) {
|
|
|
16701
17523
|
|
|
16702
17524
|
async function getButtonDelete(props) {
|
|
16703
17525
|
return {
|
|
16704
|
-
"type": "button",
|
|
16705
|
-
"label": "",
|
|
16706
|
-
"icon": "fa fa-trash-alt",//不可以用fa-trash-o,因为设计字段布局界面中弹出的设置分组列表中显示不了这个图标
|
|
17526
|
+
"type": "dropdown-button",
|
|
16707
17527
|
"level": "link",
|
|
16708
|
-
"
|
|
16709
|
-
|
|
16710
|
-
|
|
17528
|
+
"icon": "fa fa-trash-alt",
|
|
17529
|
+
"size": "xs",
|
|
17530
|
+
"hideCaret": true,
|
|
17531
|
+
"closeOnClick": true,
|
|
17532
|
+
"body": [
|
|
17533
|
+
{
|
|
17534
|
+
"type": "wrapper",
|
|
17535
|
+
"size": "md",
|
|
17536
|
+
"className": "w-80",
|
|
17537
|
+
"body": [
|
|
17538
|
+
{
|
|
17539
|
+
"tpl": "确定要删除吗?",
|
|
17540
|
+
"type": "tpl"
|
|
17541
|
+
},
|
|
17542
|
+
{
|
|
17543
|
+
"type": "flex",
|
|
17544
|
+
"justify": "flex-end",
|
|
17545
|
+
"className": "mt-3",
|
|
17546
|
+
"items": [
|
|
17547
|
+
{
|
|
17548
|
+
"type": "button",
|
|
17549
|
+
"label": "取消",
|
|
17550
|
+
"className": "mr-2"
|
|
17551
|
+
},
|
|
17552
|
+
{
|
|
17553
|
+
"type": "button",
|
|
17554
|
+
"label": "删除",
|
|
17555
|
+
"level": "danger",
|
|
17556
|
+
"onEvent": {
|
|
17557
|
+
"click": {
|
|
17558
|
+
"actions": await getButtonActions(props, "delete")
|
|
17559
|
+
}
|
|
17560
|
+
}
|
|
17561
|
+
}
|
|
17562
|
+
]
|
|
17563
|
+
}
|
|
17564
|
+
]
|
|
16711
17565
|
}
|
|
16712
|
-
|
|
16713
|
-
}
|
|
17566
|
+
]
|
|
17567
|
+
}
|
|
16714
17568
|
}
|
|
16715
17569
|
|
|
17570
|
+
|
|
16716
17571
|
const getAmisInputTableSchema = async (props) => {
|
|
16717
17572
|
if (!props.id) {
|
|
16718
17573
|
props.id = "steedos_input_table_" + props.name + "_" + Math.random().toString(36).substr(2, 9);
|
|
16719
17574
|
}
|
|
17575
|
+
let primaryKey = getTablePrimaryKey(props);
|
|
17576
|
+
let showOperation = props.showOperation;
|
|
17577
|
+
if (showOperation !== false) {
|
|
17578
|
+
showOperation = true;
|
|
17579
|
+
}
|
|
17580
|
+
let fieldPrefix = props.fieldPrefix;
|
|
17581
|
+
let fields = props.fields || [];
|
|
17582
|
+
if (fieldPrefix) {
|
|
17583
|
+
fields = getTableFieldsWithoutFieldPrefix(fields, fieldPrefix);
|
|
17584
|
+
}
|
|
16720
17585
|
let serviceId = getComponentId("table_service", props.id);
|
|
16721
17586
|
let buttonsForColumnOperations = [];
|
|
16722
17587
|
let inlineEditMode = props.inlineEditMode;
|
|
16723
17588
|
let showAsInlineEditMode = inlineEditMode && props.editable;
|
|
16724
|
-
if (
|
|
16725
|
-
|
|
16726
|
-
|
|
16727
|
-
|
|
16728
|
-
|
|
16729
|
-
|
|
16730
|
-
|
|
16731
|
-
|
|
16732
|
-
|
|
16733
|
-
|
|
16734
|
-
|
|
16735
|
-
|
|
17589
|
+
if (showOperation) {
|
|
17590
|
+
if (props.editable) {
|
|
17591
|
+
let showEditButton = true;
|
|
17592
|
+
if (showAsInlineEditMode) {
|
|
17593
|
+
// 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
|
|
17594
|
+
showEditButton = true;
|
|
17595
|
+
// // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
|
|
17596
|
+
// if (props.columns && props.columns.length > 0 && props.columns.length < fields.length) {
|
|
17597
|
+
// showEditButton = true;
|
|
17598
|
+
// }
|
|
17599
|
+
// else {
|
|
17600
|
+
// showEditButton = false;
|
|
17601
|
+
// }
|
|
17602
|
+
}
|
|
17603
|
+
// 编辑时显示编辑按钮
|
|
17604
|
+
if (showEditButton) {
|
|
17605
|
+
let buttonEditSchema = await getButtonEdit(props, showAsInlineEditMode);
|
|
17606
|
+
buttonsForColumnOperations.push(buttonEditSchema);
|
|
17607
|
+
}
|
|
16736
17608
|
}
|
|
16737
|
-
|
|
16738
|
-
|
|
16739
|
-
|
|
16740
|
-
|
|
17609
|
+
else {
|
|
17610
|
+
// 只读时显示查看按钮
|
|
17611
|
+
// 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < fields.length)
|
|
17612
|
+
let buttonViewSchema = await getButtonView(props);
|
|
17613
|
+
buttonsForColumnOperations.push(buttonViewSchema);
|
|
17614
|
+
}
|
|
17615
|
+
if (props.removable) {
|
|
17616
|
+
let buttonDeleteSchema = await getButtonDelete(props);
|
|
17617
|
+
buttonsForColumnOperations.push(buttonDeleteSchema);
|
|
16741
17618
|
}
|
|
16742
17619
|
}
|
|
16743
|
-
|
|
16744
|
-
// 只读时显示查看按钮
|
|
16745
|
-
// 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length)
|
|
16746
|
-
let buttonViewSchema = await getButtonView(props);
|
|
16747
|
-
buttonsForColumnOperations.push(buttonViewSchema);
|
|
16748
|
-
}
|
|
16749
|
-
if (props.removable) {
|
|
16750
|
-
let buttonDeleteSchema = await getButtonDelete(props);
|
|
16751
|
-
buttonsForColumnOperations.push(buttonDeleteSchema);
|
|
16752
|
-
}
|
|
17620
|
+
let amis = props["input-table"] || props.amis || {};//额外支持"input-table"代替amis属性,是因为在字段yml文件中用amis作为key不好理解
|
|
16753
17621
|
let inputTableSchema = {
|
|
16754
17622
|
"type": "input-table",
|
|
16755
|
-
"
|
|
17623
|
+
"mode": "normal",
|
|
16756
17624
|
"name": props.name,
|
|
16757
17625
|
//不可以addable/editable/removable设置为true,因为会在原生的操作列显示操作按钮图标,此开关实测只控制这个按钮显示不会影响功能
|
|
16758
17626
|
// "addable": props.addable,
|
|
@@ -16767,7 +17635,53 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
16767
17635
|
"strictMode": props.strictMode,
|
|
16768
17636
|
"showTableAddBtn": false,
|
|
16769
17637
|
"showFooterAddBtn": false,
|
|
16770
|
-
"className": props.tableClassName
|
|
17638
|
+
"className": props.tableClassName,
|
|
17639
|
+
"pipeIn": (value, data) => {
|
|
17640
|
+
if (fieldPrefix) {
|
|
17641
|
+
value = getTableValueWithoutFieldPrefix(value, fieldPrefix);
|
|
17642
|
+
}
|
|
17643
|
+
value = getTableValueWithEmptyValue(value, fields);
|
|
17644
|
+
if (primaryKey) {
|
|
17645
|
+
// 这里临时给每行数据补上primaryKey字段值,如果库里不需要保存这里补上的字段值,pipeOut中会识别autoGeneratePrimaryKeyValue属性选择最终移除这里补上的字段值
|
|
17646
|
+
// 这里始终自动生成primaryKey字段值,而不是只在pipeOut输出整个子表字段值时才生成,是因为要支持当数据库里保存的子表字段行数据没有primaryKey字段值时的行嵌套模式(即节点的children属性)功能
|
|
17647
|
+
// 这里要注意,流程详细设置界面的字段设置功能中的子表组件中,数据库里保存的子表字段行数据是有primaryKey字段值的,它不依赖这里自动生成行primaryKey值功能
|
|
17648
|
+
value = getTableValueWithPrimaryKeyValue(value, primaryKey);
|
|
17649
|
+
}
|
|
17650
|
+
if (amis.pipeIn) {
|
|
17651
|
+
if (typeof amis.pipeIn === 'function') {
|
|
17652
|
+
return amis.pipeIn(value, data);
|
|
17653
|
+
}
|
|
17654
|
+
}
|
|
17655
|
+
return value;
|
|
17656
|
+
},
|
|
17657
|
+
"pipeOut": (value, data) => {
|
|
17658
|
+
value = (value || []).map(function (item) {
|
|
17659
|
+
delete item.__fix_rerender_after_children_modified_tag;
|
|
17660
|
+
return item;
|
|
17661
|
+
});
|
|
17662
|
+
if (fieldPrefix) {
|
|
17663
|
+
value = getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey);
|
|
17664
|
+
}
|
|
17665
|
+
value = getTableValueWithoutEmptyValue(value, fields);
|
|
17666
|
+
if (props.autoGeneratePrimaryKeyValue === true) {
|
|
17667
|
+
// 如果需要把自动生成的primaryKey值输出保存的库中,则补全所有行中的primaryKey值
|
|
17668
|
+
// 这里如果不全部补全的话,初始从库里返回的字段值中拿到的行没primaryKey值的话就不会自动补上
|
|
17669
|
+
value = getTableValueWithPrimaryKeyValue(value, primaryKey);
|
|
17670
|
+
}
|
|
17671
|
+
else {
|
|
17672
|
+
// 默认情况下,也就是没有配置autoGeneratePrimaryKey时,最终输出的字段值要移除行中的primaryKey值
|
|
17673
|
+
// 需要注意如果没有配置autoGeneratePrimaryKey时,因为每次弹出行编辑窗口保存后都会先后进入pipeOut和pipeIn,
|
|
17674
|
+
// 这里删除掉了primaryKey值,所以primaryKey值每次弹出编辑窗口保存后都会给每行重新生成新的primaryKey值
|
|
17675
|
+
// 只有autoGeneratePrimaryKey配置为true时,每行的primaryKey字段值才会始终保持不变
|
|
17676
|
+
value = getTableValueWithoutPrimaryKeyValue(value, primaryKey);
|
|
17677
|
+
}
|
|
17678
|
+
if (amis.pipeOut) {
|
|
17679
|
+
if (typeof amis.pipeOut === 'function') {
|
|
17680
|
+
return amis.pipeOut(value, data);
|
|
17681
|
+
}
|
|
17682
|
+
}
|
|
17683
|
+
return value;
|
|
17684
|
+
}
|
|
16771
17685
|
};
|
|
16772
17686
|
if (buttonsForColumnOperations.length) {
|
|
16773
17687
|
inputTableSchema.columns.push({
|
|
@@ -16777,20 +17691,22 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
16777
17691
|
"width": buttonsForColumnOperations.length > 1 ? "60px" : "20px"
|
|
16778
17692
|
});
|
|
16779
17693
|
}
|
|
16780
|
-
if (showAsInlineEditMode) {
|
|
16781
|
-
|
|
16782
|
-
|
|
16783
|
-
|
|
17694
|
+
// if (showAsInlineEditMode) {
|
|
17695
|
+
// // 因为要支持不同的列上配置inlineEditMode属性,所有不可以把整个子表组件都设置为inlineEditMode
|
|
17696
|
+
// inputTableSchema.needConfirm = false;
|
|
17697
|
+
// }
|
|
16784
17698
|
if (amis) {
|
|
16785
17699
|
// 支持配置amis属性重写或添加最终生成的input-table中任何属性。
|
|
16786
17700
|
delete amis.id;//如果steedos-input-table组件配置了amis.id属性,会造成新建编辑行功能不生效
|
|
17701
|
+
delete amis.pipeIn;//该属性在上面合并过了
|
|
17702
|
+
delete amis.pipeOut;//该属性在上面合并过了
|
|
16787
17703
|
Object.assign(inputTableSchema, amis);
|
|
16788
17704
|
}
|
|
16789
|
-
const isAnyFieldHasDependOn = (
|
|
17705
|
+
const isAnyFieldHasDependOn = (fields || []).find(function (item) {
|
|
16790
17706
|
return item.depend_on;
|
|
16791
17707
|
});
|
|
16792
17708
|
if (isAnyFieldHasDependOn) {
|
|
16793
|
-
// 有任意一个子字段有depend_on
|
|
17709
|
+
// 有任意一个子字段有depend_on属性时,强制设置禁用静态模式,因为strictMode模式下,dependOn的字段值变更后,不会rerender整个子表
|
|
16794
17710
|
Object.assign(inputTableSchema, {
|
|
16795
17711
|
strictMode: false
|
|
16796
17712
|
});
|
|
@@ -16819,11 +17735,31 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
16819
17735
|
"body": headerToolbar
|
|
16820
17736
|
});
|
|
16821
17737
|
}
|
|
17738
|
+
let className = "steedos-input-table";
|
|
17739
|
+
|
|
17740
|
+
if (typeof props.className == "object") {
|
|
17741
|
+
className = {
|
|
17742
|
+
[className]: "true",
|
|
17743
|
+
...props.className
|
|
17744
|
+
};
|
|
17745
|
+
} else if (typeof props.className == "string") {
|
|
17746
|
+
className = `${className} ${props.className} `;
|
|
17747
|
+
}
|
|
17748
|
+
|
|
16822
17749
|
let schema = {
|
|
16823
|
-
"type": "
|
|
16824
|
-
"body":
|
|
16825
|
-
|
|
16826
|
-
|
|
17750
|
+
"type": "control",
|
|
17751
|
+
"body": {
|
|
17752
|
+
"type": "service",
|
|
17753
|
+
"body": schemaBody,
|
|
17754
|
+
"id": serviceId
|
|
17755
|
+
},
|
|
17756
|
+
"label": props.label,
|
|
17757
|
+
"labelClassName": props.label ? props.labelClassName : "none",
|
|
17758
|
+
"labelRemark": props.labelRemark,
|
|
17759
|
+
"labelAlign": props.labelAlign,
|
|
17760
|
+
//控制control的mode属性,https://aisuda.bce.baidu.com/amis/zh-CN/components/form/formitem#表单项展示
|
|
17761
|
+
"mode": props.mode || null,
|
|
17762
|
+
className
|
|
16827
17763
|
};
|
|
16828
17764
|
// console.log("===schema===", schema);
|
|
16829
17765
|
return schema;
|
|
@@ -16895,7 +17831,7 @@ async function getListPageInitSchema(objectApiName, formFactor, userSession) {
|
|
|
16895
17831
|
// 获取
|
|
16896
17832
|
async function getRecordPageInitSchema(objectApiName){
|
|
16897
17833
|
const relatedList = await getObjectRelatedList(objectApiName);
|
|
16898
|
-
|
|
17834
|
+
await getUISchema(objectApiName);
|
|
16899
17835
|
let body = [
|
|
16900
17836
|
// detailHeaderAmisSchema,
|
|
16901
17837
|
{
|
|
@@ -16903,28 +17839,7 @@ async function getRecordPageInitSchema(objectApiName){
|
|
|
16903
17839
|
"label": "标题面板",
|
|
16904
17840
|
"objectApiName": "${objectName}",
|
|
16905
17841
|
"recordId": "${recordId}",
|
|
16906
|
-
"onEvent": {
|
|
16907
|
-
"recordLoaded": {
|
|
16908
|
-
"actions": [
|
|
16909
|
-
{
|
|
16910
|
-
"actionType": "setValue",
|
|
16911
|
-
"args": {
|
|
16912
|
-
"value": {
|
|
16913
|
-
"recordLoaded": true,
|
|
16914
|
-
}
|
|
16915
|
-
}
|
|
16916
|
-
},
|
|
16917
|
-
{
|
|
16918
|
-
"actionType": "reload",
|
|
16919
|
-
"data": {
|
|
16920
|
-
"name": `\${record.${uiSchema?.NAME_FIELD_KEY || 'name'}}`,
|
|
16921
|
-
"record": `\${record}`,
|
|
16922
|
-
"recordLoaded": true,
|
|
16923
|
-
}
|
|
16924
|
-
}
|
|
16925
|
-
]
|
|
16926
|
-
}
|
|
16927
|
-
}
|
|
17842
|
+
"onEvent": {}
|
|
16928
17843
|
}
|
|
16929
17844
|
];
|
|
16930
17845
|
let contentBody = {
|
|
@@ -19557,9 +20472,11 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
|
|
|
19557
20472
|
getObjectRelatedList: getObjectRelatedList,
|
|
19558
20473
|
getObjectRelatedListButtons: getObjectRelatedListButtons,
|
|
19559
20474
|
getObjectRelatedListHeader: getObjectRelatedListHeader,
|
|
20475
|
+
getObjectRelatedListsMiniSchema: getObjectRelatedListsMiniSchema,
|
|
19560
20476
|
getPage: getPage,
|
|
19561
20477
|
getRecord: getRecord,
|
|
19562
20478
|
getRecordDetailHeaderSchema: getRecordDetailHeaderSchema,
|
|
20479
|
+
getRecordDetailMiniSchema: getRecordDetailMiniSchema,
|
|
19563
20480
|
getRecordDetailRelatedListSchema: getRecordDetailRelatedListSchema,
|
|
19564
20481
|
getRecordDetailSchema: getRecordDetailSchema,
|
|
19565
20482
|
getRecordPageInitSchema: getRecordPageInitSchema,
|
|
@@ -19741,10 +20658,11 @@ var AmisObjectFieldLookup = function (props) {
|
|
|
19741
20658
|
};
|
|
19742
20659
|
|
|
19743
20660
|
var AmisObjectButton = function (props) {
|
|
19744
|
-
|
|
20661
|
+
var _a;
|
|
20662
|
+
// console.log(`AmisObjectButton=====》`, props)
|
|
19745
20663
|
var objectName = props.objectName, name = props.name, data = props.data, render = props.render, className = props.className, listViewId = props.listViewId;
|
|
19746
|
-
var
|
|
19747
|
-
var
|
|
20664
|
+
var _b = __read(React.useState(), 2), button = _b[0], setButton = _b[1];
|
|
20665
|
+
var _c = __read(React.useState(), 2), uiSchema = _c[0], setUiSchema = _c[1];
|
|
19748
20666
|
//TODO 处理上下文参数
|
|
19749
20667
|
var appId = data.appId;
|
|
19750
20668
|
var formFactor = data.formFactor;
|
|
@@ -19813,6 +20731,7 @@ var AmisObjectButton = function (props) {
|
|
|
19813
20731
|
}
|
|
19814
20732
|
if (renderData) {
|
|
19815
20733
|
delete renderData.event;
|
|
20734
|
+
(_a = renderData.record) === null || _a === void 0 ? true : delete _a.event;
|
|
19816
20735
|
}
|
|
19817
20736
|
schema.data = _$1.defaultsDeep({}, renderData, getDefaultRenderData(), schema.data);
|
|
19818
20737
|
delete schema.data.event;
|
|
@@ -20018,11 +20937,11 @@ var SteedosSkeleton = function (props) {
|
|
|
20018
20937
|
};
|
|
20019
20938
|
|
|
20020
20939
|
var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
20021
|
-
var $schema, recordId, defaultData, mode, layout, labelAlign, appId, fieldsExtend,
|
|
20022
|
-
return __generator(this, function (
|
|
20023
|
-
switch (
|
|
20940
|
+
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;
|
|
20941
|
+
return __generator(this, function (_f) {
|
|
20942
|
+
switch (_f.label) {
|
|
20024
20943
|
case 0:
|
|
20025
|
-
$schema = props.$schema, recordId = props.recordId, defaultData = props.defaultData, mode = props.mode,
|
|
20944
|
+
$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;
|
|
20026
20945
|
objectApiName = props.objectApiName || "space_users";
|
|
20027
20946
|
schemaKeys = _$1.difference(_$1.keys($schema), ["id", "form", "type", "mode", "layout", "defaultData", "formDataFilter", "onFormDataFilter", "env"]);
|
|
20028
20947
|
formSchema = _$1.pick(props, schemaKeys);
|
|
@@ -20069,7 +20988,7 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
20069
20988
|
env: env
|
|
20070
20989
|
}))];
|
|
20071
20990
|
case 1:
|
|
20072
|
-
schema =
|
|
20991
|
+
schema = _f.sent();
|
|
20073
20992
|
amisSchema = schema.amisSchema;
|
|
20074
20993
|
uiSchema = schema.uiSchema;
|
|
20075
20994
|
return [3 /*break*/, 4];
|
|
@@ -20088,10 +21007,10 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
20088
21007
|
env: env
|
|
20089
21008
|
}))];
|
|
20090
21009
|
case 3:
|
|
20091
|
-
schema =
|
|
21010
|
+
schema = _f.sent();
|
|
20092
21011
|
amisSchema = schema.amisSchema;
|
|
20093
21012
|
uiSchema = schema.uiSchema;
|
|
20094
|
-
|
|
21013
|
+
_f.label = 4;
|
|
20095
21014
|
case 4:
|
|
20096
21015
|
formData = {};
|
|
20097
21016
|
// formData.recordId = recordId || null;
|
|
@@ -20102,7 +21021,8 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
20102
21021
|
formData.recordId = props.recordId;
|
|
20103
21022
|
}
|
|
20104
21023
|
amisSchema.className = "steedos-object-form ".concat(className);
|
|
20105
|
-
|
|
21024
|
+
// console.log('AmisObjectForm amisSchema======>', amisSchema)
|
|
21025
|
+
amisSchema.data = Object.assign({}, amisSchema.data || {}, formData, { global: globalData, uiSchema: uiSchema });
|
|
20106
21026
|
if (_$1.has(props, 'objectApiName')) {
|
|
20107
21027
|
amisSchema.data.objectName = objectApiName;
|
|
20108
21028
|
}
|
|
@@ -20258,7 +21178,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
20258
21178
|
type: "service",
|
|
20259
21179
|
data: serviceData,
|
|
20260
21180
|
style: style,
|
|
20261
|
-
className: "".concat(className, " sm:bg-gray-
|
|
21181
|
+
className: "".concat(className, " sm:bg-gray-50 h-full steedos-object-listview ").concat(displayAs === 'split' ? 'sm:border-r' : 'sm:border-r'),
|
|
20262
21182
|
body: [{
|
|
20263
21183
|
"type": "wrapper",
|
|
20264
21184
|
"size": "none",
|
|
@@ -20281,7 +21201,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
20281
21201
|
{
|
|
20282
21202
|
"type": "service",
|
|
20283
21203
|
"id": "service_schema_api_" + objectApiName,
|
|
20284
|
-
"className": " steedos-object-listview-content grow",
|
|
21204
|
+
"className": " steedos-object-listview-content md:overflow-auto grow",
|
|
20285
21205
|
"schemaApi": {
|
|
20286
21206
|
// 这里url上加objectApiName属性是因为设计器中切换对象时不会变更列表视图界面,不可以用objectName=${objectName}使用作用域中objectName变量是因为设计器那边不会监听识别data变化来render组件
|
|
20287
21207
|
"url": "${context.rootUrl}/graphql?objectName=" + objectApiName + "&listName=${listName}&display=${display}&rebuildOn=" + rebuildOn,
|
|
@@ -20291,7 +21211,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
20291
21211
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
20292
21212
|
},
|
|
20293
21213
|
"requestAdaptor": "api.data={query: '{spaces__findOne(id: \"none\"){_id,name}}'};return api;",
|
|
20294
|
-
"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
|
|
21214
|
+
"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 ")
|
|
20295
21215
|
},
|
|
20296
21216
|
// "body": body,
|
|
20297
21217
|
// "data": serviceData
|
|
@@ -20449,34 +21369,18 @@ var AmisObjectCalendar = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
20449
21369
|
}); };
|
|
20450
21370
|
|
|
20451
21371
|
var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
20452
|
-
var _a, className, schemaFilter,
|
|
21372
|
+
var _a, className, schemaFilter, showButtons, showBackButton, defaultOnEvent, recordId, _b, onEvent, _c, showRecordTitle, objectApiName, schema, config, schemaFilterFun, _config, e_1;
|
|
20453
21373
|
return __generator(this, function (_d) {
|
|
20454
21374
|
switch (_d.label) {
|
|
20455
21375
|
case 0:
|
|
20456
|
-
_a = props.className, className = _a === void 0 ? 'sm:sticky top-0 z-10
|
|
21376
|
+
_a = props.className, className = _a === void 0 ? 'sm:sticky top-0 z-10 p-0 bg-gray-50' : _a, schemaFilter = props.schemaFilter, showButtons = props.showButtons, showBackButton = props.showBackButton;
|
|
20457
21377
|
return [4 /*yield*/, getUISchema(props.objectApiName || "space_users", false)];
|
|
20458
21378
|
case 1:
|
|
20459
|
-
|
|
20460
|
-
defaultOnEvent = {
|
|
20461
|
-
"recordLoaded": {
|
|
20462
|
-
"actions": [
|
|
20463
|
-
{
|
|
20464
|
-
"actionType": "reload",
|
|
20465
|
-
"data": {
|
|
20466
|
-
"name": "${event.data.record.".concat((objectUiSchema === null || objectUiSchema === void 0 ? void 0 : objectUiSchema.NAME_FIELD_KEY) || 'name', "}"),
|
|
20467
|
-
"record": "${event.data.record}",
|
|
20468
|
-
"_id": "\${event.data.record._id}",
|
|
20469
|
-
"recordId": "\${event.data.record._id}",
|
|
20470
|
-
"recordLoaded": true,
|
|
20471
|
-
},
|
|
20472
|
-
"expression": "${event.data.objectName == '".concat(objectUiSchema === null || objectUiSchema === void 0 ? void 0 : objectUiSchema.name, "'}")
|
|
20473
|
-
}
|
|
20474
|
-
]
|
|
20475
|
-
}
|
|
20476
|
-
};
|
|
21379
|
+
_d.sent();
|
|
21380
|
+
defaultOnEvent = {};
|
|
20477
21381
|
props.$schema, recordId = props.recordId, _b = props.onEvent, onEvent = _b === void 0 ? defaultOnEvent : _b, _c = props.showRecordTitle, showRecordTitle = _c === void 0 ? true : _c;
|
|
20478
21382
|
objectApiName = props.objectApiName || "space_users";
|
|
20479
|
-
return [4 /*yield*/, getRecordDetailHeaderSchema(objectApiName, recordId, { showRecordTitle: showRecordTitle, formFactor: props.data.formFactor })];
|
|
21383
|
+
return [4 /*yield*/, getRecordDetailHeaderSchema(objectApiName, recordId, { showRecordTitle: showRecordTitle, formFactor: props.data.formFactor, showButtons: showButtons, showBackButton: showBackButton, display: props.data.display })];
|
|
20480
21384
|
case 2:
|
|
20481
21385
|
schema = (_d.sent()).amisSchema;
|
|
20482
21386
|
schema.className = className;
|
|
@@ -20495,18 +21399,20 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
|
|
|
20495
21399
|
e_1 = _d.sent();
|
|
20496
21400
|
console.warn(e_1);
|
|
20497
21401
|
return [3 /*break*/, 6];
|
|
20498
|
-
case 6:
|
|
21402
|
+
case 6:
|
|
21403
|
+
// console.log(`AmisRecordDetailHeader==>`, config)
|
|
21404
|
+
return [2 /*return*/, config];
|
|
20499
21405
|
}
|
|
20500
21406
|
});
|
|
20501
21407
|
}); };
|
|
20502
21408
|
|
|
20503
21409
|
var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
20504
|
-
var className, $schema, appId, _a, objectApiName, body, schema;
|
|
21410
|
+
var className, $schema, appId, _a, objectApiName, body, showButtons, showBackButton, schema;
|
|
20505
21411
|
return __generator(this, function (_b) {
|
|
20506
21412
|
switch (_b.label) {
|
|
20507
21413
|
case 0:
|
|
20508
|
-
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;
|
|
20509
|
-
return [4 /*yield*/, getRecordDetailSchema(objectApiName, appId)];
|
|
21414
|
+
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;
|
|
21415
|
+
return [4 /*yield*/, getRecordDetailSchema(objectApiName, appId, { showButtons: showButtons, showBackButton: showBackButton })];
|
|
20510
21416
|
case 1:
|
|
20511
21417
|
schema = (_b.sent()).amisSchema;
|
|
20512
21418
|
// 在非记录页组件下全局作用域下无recordId,会导致表单接口sendOn始终为false,无法发起请求。
|
|
@@ -20516,8 +21422,17 @@ var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
20516
21422
|
// }
|
|
20517
21423
|
// schema.data = Object.assign({}, schema.data, recordDetailData);
|
|
20518
21424
|
if (_$1.has(props, "recordId") && $schema.recordId !== "${recordId}") {
|
|
21425
|
+
if (!schema.data) {
|
|
21426
|
+
schema.data = {};
|
|
21427
|
+
}
|
|
20519
21428
|
schema.data.recordId = props.recordId;
|
|
20520
21429
|
}
|
|
21430
|
+
if (_$1.has(props, "objectApiName") && props.objectApiName && $schema.objectApiName !== "${objectName}") {
|
|
21431
|
+
if (!schema.data) {
|
|
21432
|
+
schema.data = {};
|
|
21433
|
+
}
|
|
21434
|
+
schema.data.objectName = props.objectApiName;
|
|
21435
|
+
}
|
|
20521
21436
|
schema.className = className;
|
|
20522
21437
|
if (body) {
|
|
20523
21438
|
schema.body = body;
|
|
@@ -20531,28 +21446,39 @@ var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
20531
21446
|
/*
|
|
20532
21447
|
* @Author: baozhoutao@steedos.com
|
|
20533
21448
|
* @Date: 2022-12-08 10:32:17
|
|
20534
|
-
* @LastEditors:
|
|
20535
|
-
* @LastEditTime:
|
|
21449
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
21450
|
+
* @LastEditTime: 2024-01-16 14:09:23
|
|
20536
21451
|
* @Description:
|
|
20537
21452
|
*/
|
|
20538
21453
|
var AmisRecordService = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
20539
|
-
var className, _a, objectApiName, body, style, schema;
|
|
21454
|
+
var className, $schema, appId, _a, objectApiName, body, style, recordId, options, schema;
|
|
20540
21455
|
return __generator(this, function (_b) {
|
|
20541
21456
|
switch (_b.label) {
|
|
20542
21457
|
case 0:
|
|
20543
|
-
className = props.className, props.$schema, props.appId, _a = props.objectApiName, objectApiName = _a === void 0 ? "space_users" : _a, props.
|
|
20544
|
-
|
|
21458
|
+
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;
|
|
21459
|
+
if (_$1.has($schema.data, "recordId") && $schema.data.recordId !== "${recordId}") {
|
|
21460
|
+
recordId = $schema.data.recordId;
|
|
21461
|
+
}
|
|
21462
|
+
if (_$1.has($schema.data, "objectName") && $schema.data.objectName !== "${objectName}") {
|
|
21463
|
+
objectApiName = $schema.data.objectName;
|
|
21464
|
+
}
|
|
21465
|
+
options = { onEvent: $schema.onEvent, data: $schema.data, recordId: recordId };
|
|
21466
|
+
if (props.$$editor) {
|
|
21467
|
+
options.isEditor = true;
|
|
21468
|
+
}
|
|
21469
|
+
return [4 /*yield*/, getRecordServiceSchema(objectApiName, appId, options, body)];
|
|
20545
21470
|
case 1:
|
|
20546
21471
|
schema = (_b.sent()).amisSchema;
|
|
20547
|
-
if (body) {
|
|
20548
|
-
schema.body = body;
|
|
20549
|
-
}
|
|
20550
21472
|
if (className) {
|
|
20551
21473
|
schema.className = className;
|
|
20552
21474
|
}
|
|
20553
21475
|
if (style) {
|
|
21476
|
+
if (!schema.style) {
|
|
21477
|
+
schema.style = {};
|
|
21478
|
+
}
|
|
20554
21479
|
Object.assign(schema.style, style);
|
|
20555
21480
|
}
|
|
21481
|
+
// console.log(`AmisRecordService====schema==>`, schema)
|
|
20556
21482
|
return [2 /*return*/, schema];
|
|
20557
21483
|
}
|
|
20558
21484
|
});
|
|
@@ -20609,7 +21535,7 @@ var AmisRecordDetailRelatedList = function (props) { return __awaiter(void 0, vo
|
|
|
20609
21535
|
}); };
|
|
20610
21536
|
|
|
20611
21537
|
var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
20612
|
-
var $schema, objectApiName, recordId, _a, perPage, relatedLists, staticRecordId;
|
|
21538
|
+
var $schema, objectApiName, recordId, _a, perPage, formFactor, relatedLists, staticRecordId;
|
|
20613
21539
|
return __generator(this, function (_b) {
|
|
20614
21540
|
switch (_b.label) {
|
|
20615
21541
|
case 0:
|
|
@@ -20624,7 +21550,10 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
|
|
|
20624
21550
|
"className": "mb-3"
|
|
20625
21551
|
}];
|
|
20626
21552
|
}
|
|
20627
|
-
props.formFactor;
|
|
21553
|
+
formFactor = props.formFactor;
|
|
21554
|
+
if (!formFactor) {
|
|
21555
|
+
formFactor = window.innerWidth < 768 ? 'SMALL' : 'LARGE';
|
|
21556
|
+
}
|
|
20628
21557
|
return [4 /*yield*/, getObjectRelatedList(objectApiName)];
|
|
20629
21558
|
case 1:
|
|
20630
21559
|
relatedLists = _b.sent();
|
|
@@ -20637,11 +21566,12 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
|
|
|
20637
21566
|
"className": "mb-3"
|
|
20638
21567
|
}];
|
|
20639
21568
|
}
|
|
20640
|
-
staticRecordId =
|
|
21569
|
+
staticRecordId = props.staticRecordId;
|
|
20641
21570
|
// 在设计器中的设计状态,当上层有recordId具体值,相关表组件的$schema.recordId的默认值就是 "${recordId}"; 会导致获取不到 _master, 进而导致组件显示不了数据。
|
|
20642
21571
|
if (_$1.has(props, "recordId") && ($schema.recordId !== "${recordId}" || (props.$$editor && props.recordId !== "${recordId}"))) {
|
|
20643
21572
|
staticRecordId = recordId;
|
|
20644
21573
|
}
|
|
21574
|
+
// console.log('relatedLists======>', relatedLists, staticRecordId)
|
|
20645
21575
|
return [2 /*return*/, {
|
|
20646
21576
|
type: 'service',
|
|
20647
21577
|
className: "steedos-record-detail-related-lists",
|
|
@@ -20650,6 +21580,7 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
|
|
|
20650
21580
|
type: 'steedos-object-related-listview',
|
|
20651
21581
|
objectApiName: objectApiName,
|
|
20652
21582
|
// recordId: recordId,
|
|
21583
|
+
formFactor: formFactor,
|
|
20653
21584
|
relatedObjectApiName: item.object_name,
|
|
20654
21585
|
foreign_key: item.foreign_key,
|
|
20655
21586
|
relatedKey: item.foreign_key,
|
|
@@ -20664,6 +21595,7 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
|
|
|
20664
21595
|
if (staticRecordId) {
|
|
20665
21596
|
relatedList.recordId = staticRecordId;
|
|
20666
21597
|
}
|
|
21598
|
+
// console.log('relatedList=====>', relatedList)
|
|
20667
21599
|
return relatedList;
|
|
20668
21600
|
})
|
|
20669
21601
|
}];
|
|
@@ -21176,7 +22108,7 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21176
22108
|
* @Author: baozhoutao@steedos.com
|
|
21177
22109
|
* @Date: 2022-09-01 14:44:57
|
|
21178
22110
|
* @LastEditors: baozhoutao@steedos.com
|
|
21179
|
-
* @LastEditTime:
|
|
22111
|
+
* @LastEditTime: 2024-01-31 14:43:14
|
|
21180
22112
|
* @Description:
|
|
21181
22113
|
*/
|
|
21182
22114
|
var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -21224,33 +22156,108 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
21224
22156
|
"label": instance.t('frontend_help')
|
|
21225
22157
|
},
|
|
21226
22158
|
{
|
|
21227
|
-
"type": "button",
|
|
21228
|
-
"
|
|
21229
|
-
"
|
|
21230
|
-
|
|
21231
|
-
|
|
21232
|
-
|
|
21233
|
-
|
|
21234
|
-
|
|
21235
|
-
|
|
21236
|
-
|
|
21237
|
-
|
|
22159
|
+
"type": "dropdown-button",
|
|
22160
|
+
"label": false,
|
|
22161
|
+
"trigger": "click",
|
|
22162
|
+
"level": "link",
|
|
22163
|
+
"btnClassName": "p-0 m-0",
|
|
22164
|
+
"icon": "fa fa-cog text-xl slds-button_icon m-0",
|
|
22165
|
+
"align": "right",
|
|
22166
|
+
"hideCaret": true,
|
|
22167
|
+
"buttons": [
|
|
22168
|
+
{
|
|
22169
|
+
"type": "button",
|
|
22170
|
+
"hiddenOn": "window.innerWidth < 768",
|
|
22171
|
+
"onEvent": {
|
|
22172
|
+
"click": {
|
|
22173
|
+
"actions": [
|
|
22174
|
+
{
|
|
22175
|
+
"args": {
|
|
22176
|
+
"url": "/app/admin"
|
|
22177
|
+
},
|
|
22178
|
+
"actionType": "url"
|
|
22179
|
+
}
|
|
22180
|
+
]
|
|
21238
22181
|
}
|
|
21239
|
-
|
|
21240
|
-
|
|
21241
|
-
|
|
21242
|
-
|
|
21243
|
-
|
|
22182
|
+
},
|
|
22183
|
+
"id": "u:b5d0ab3a32b5",
|
|
22184
|
+
"level": "link",
|
|
22185
|
+
"label": instance.t('frontend_setup')
|
|
22186
|
+
},
|
|
22187
|
+
// {
|
|
22188
|
+
// "type": "divider",
|
|
22189
|
+
// "className": "m-0",
|
|
22190
|
+
// "visibleOn": "${window:Meteor.settings.public.enable_saas != true && global.user.is_space_admin == true}"
|
|
22191
|
+
// },
|
|
21244
22192
|
{
|
|
21245
|
-
"type": "
|
|
21246
|
-
"
|
|
21247
|
-
"
|
|
21248
|
-
"
|
|
21249
|
-
|
|
21250
|
-
|
|
22193
|
+
"type": "button",
|
|
22194
|
+
"label": "编辑对象",
|
|
22195
|
+
"className": "flex",
|
|
22196
|
+
"onEvent": {
|
|
22197
|
+
"click": {
|
|
22198
|
+
"actions": [
|
|
22199
|
+
{
|
|
22200
|
+
"actionType": "ajax",
|
|
22201
|
+
"outputVar": "responseResult",
|
|
22202
|
+
"args": {
|
|
22203
|
+
"api": {
|
|
22204
|
+
"url": "/api/v1/objects/search",
|
|
22205
|
+
"data": {
|
|
22206
|
+
"filters": ["name", "=", "${window:FlowRouter|routerParams|pick:object_name}"],
|
|
22207
|
+
"fields": ["_id"]
|
|
22208
|
+
},
|
|
22209
|
+
"method": "post",
|
|
22210
|
+
"messages": {}
|
|
22211
|
+
}
|
|
22212
|
+
}
|
|
22213
|
+
},
|
|
22214
|
+
{
|
|
22215
|
+
"args": {
|
|
22216
|
+
"url": "/app/admin/objects/view/${responseResult.items[0]._id}",
|
|
22217
|
+
},
|
|
22218
|
+
"actionType": "url"
|
|
22219
|
+
}
|
|
22220
|
+
]
|
|
22221
|
+
}
|
|
22222
|
+
},
|
|
22223
|
+
"level": "link",
|
|
22224
|
+
"visibleOn": "${window:Meteor.settings.public.enable_saas != true && global.user.is_space_admin == true && window:FlowRouter|isObjectRouter}"
|
|
22225
|
+
},
|
|
22226
|
+
{
|
|
22227
|
+
"type": "button",
|
|
22228
|
+
"label": "编辑页面",
|
|
22229
|
+
"className": "flex",
|
|
22230
|
+
"onEvent": {
|
|
22231
|
+
"click": {
|
|
22232
|
+
"actions": [
|
|
22233
|
+
{
|
|
22234
|
+
"actionType": "ajax",
|
|
22235
|
+
"outputVar": "responseResult",
|
|
22236
|
+
"args": {
|
|
22237
|
+
"api": {
|
|
22238
|
+
"url": "/api/v1/pages/search",
|
|
22239
|
+
"data": {
|
|
22240
|
+
"filters": ["name", "=", "${window:FlowRouter|routerParams|pick:page_id}"],
|
|
22241
|
+
"fields": ["_id"]
|
|
22242
|
+
},
|
|
22243
|
+
"method": "post",
|
|
22244
|
+
"messages": {}
|
|
22245
|
+
}
|
|
22246
|
+
}
|
|
22247
|
+
},
|
|
22248
|
+
{
|
|
22249
|
+
"args": {
|
|
22250
|
+
"url": "/app/admin/pages/view/${responseResult.items[0]._id}"
|
|
22251
|
+
},
|
|
22252
|
+
"actionType": "url"
|
|
22253
|
+
}
|
|
22254
|
+
]
|
|
22255
|
+
}
|
|
22256
|
+
},
|
|
22257
|
+
"level": "link",
|
|
22258
|
+
"visibleOn": "${window:Meteor.settings.public.enable_saas != true && global.user.is_space_admin == true && window:FlowRouter|isPageRouter}"
|
|
21251
22259
|
}
|
|
21252
|
-
]
|
|
21253
|
-
"label": instance.t('frontend_setup')
|
|
22260
|
+
]
|
|
21254
22261
|
},
|
|
21255
22262
|
{
|
|
21256
22263
|
"type": "steedos-dropdown",
|
|
@@ -21507,6 +22514,26 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
21507
22514
|
},
|
|
21508
22515
|
"level": "link"
|
|
21509
22516
|
},
|
|
22517
|
+
{
|
|
22518
|
+
"type": "button",
|
|
22519
|
+
"label": instance.t('switch_space'),
|
|
22520
|
+
"className": "flex",
|
|
22521
|
+
"onEvent": {
|
|
22522
|
+
"click": {
|
|
22523
|
+
"actions": [
|
|
22524
|
+
{
|
|
22525
|
+
"args": {
|
|
22526
|
+
"url": "/accounts/a/#/select-space",
|
|
22527
|
+
"blank": false
|
|
22528
|
+
},
|
|
22529
|
+
"actionType": "url"
|
|
22530
|
+
}
|
|
22531
|
+
]
|
|
22532
|
+
}
|
|
22533
|
+
},
|
|
22534
|
+
"level": "link",
|
|
22535
|
+
"visibleOn": "${window:Meteor.settings.public.enable_saas}"
|
|
22536
|
+
},
|
|
21510
22537
|
{
|
|
21511
22538
|
"type": "button",
|
|
21512
22539
|
"label": instance.t('frontend_about'),
|
|
@@ -21558,14 +22585,14 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
21558
22585
|
/*
|
|
21559
22586
|
* @Author: baozhoutao@steedos.com
|
|
21560
22587
|
* @Date: 2022-09-01 14:44:57
|
|
21561
|
-
* @LastEditors:
|
|
21562
|
-
* @LastEditTime: 2024-01-
|
|
22588
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
22589
|
+
* @LastEditTime: 2024-01-16 13:45:42
|
|
21563
22590
|
* @Description:
|
|
21564
22591
|
*/
|
|
21565
22592
|
var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
21566
|
-
var logoSrc, isMobile, schema;
|
|
22593
|
+
var logoSrc, customButtons, isMobile, schema;
|
|
21567
22594
|
return __generator(this, function (_a) {
|
|
21568
|
-
logoSrc = props.logoSrc;
|
|
22595
|
+
logoSrc = props.logoSrc, customButtons = props.customButtons;
|
|
21569
22596
|
isMobile = window.innerWidth <= 768;
|
|
21570
22597
|
schema = {
|
|
21571
22598
|
"type": "wrapper",
|
|
@@ -21656,39 +22683,7 @@ var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21656
22683
|
"label": "Global Header",
|
|
21657
22684
|
className: 'flex flex-nowrap gap-x-3 items-center',
|
|
21658
22685
|
logoutScript: "window.signOut();",
|
|
21659
|
-
customButtons:
|
|
21660
|
-
{
|
|
21661
|
-
"type": "button",
|
|
21662
|
-
"className": "toggle-sidebar",
|
|
21663
|
-
"visibleOn": "${AND(app.showSidebar,!" + isMobile + ")}",
|
|
21664
|
-
"onEvent": {
|
|
21665
|
-
"click": {
|
|
21666
|
-
"actions": [
|
|
21667
|
-
{
|
|
21668
|
-
"actionType": "custom",
|
|
21669
|
-
"script": "document.body.classList.toggle('sidebar-open')",
|
|
21670
|
-
}
|
|
21671
|
-
]
|
|
21672
|
-
}
|
|
21673
|
-
},
|
|
21674
|
-
"body": [
|
|
21675
|
-
{
|
|
21676
|
-
"type": "steedos-icon",
|
|
21677
|
-
"category": "utility",
|
|
21678
|
-
"name": "rows",
|
|
21679
|
-
"colorVariant": "default",
|
|
21680
|
-
"id": "u:afc3a08e8cf3",
|
|
21681
|
-
"className": "slds-button_icon slds-global-header__icon"
|
|
21682
|
-
}
|
|
21683
|
-
],
|
|
21684
|
-
},
|
|
21685
|
-
{
|
|
21686
|
-
"type": "steedos-app-launcher",
|
|
21687
|
-
"showAppName": false,
|
|
21688
|
-
"appId": "${app.id}",
|
|
21689
|
-
"visibleOn": "${isMobile}"
|
|
21690
|
-
}
|
|
21691
|
-
]
|
|
22686
|
+
customButtons: customButtons
|
|
21692
22687
|
}
|
|
21693
22688
|
],
|
|
21694
22689
|
},
|
|
@@ -21804,13 +22799,13 @@ function getAmisStaticFieldType(type, data_type, options) {
|
|
|
21804
22799
|
return "switch";
|
|
21805
22800
|
}
|
|
21806
22801
|
else if (type === 'currency') {
|
|
21807
|
-
return "number";
|
|
22802
|
+
return "input-number";
|
|
21808
22803
|
}
|
|
21809
22804
|
else if (type === 'autonumber') {
|
|
21810
22805
|
return "input-text"; //不可以用text,因为会出现字段label显示不出来的问题
|
|
21811
22806
|
}
|
|
21812
22807
|
else if (type === 'percent') {
|
|
21813
|
-
return "number";
|
|
22808
|
+
return "input-number";
|
|
21814
22809
|
}
|
|
21815
22810
|
else if (type === 'formula' || type === 'summary') {
|
|
21816
22811
|
return getAmisStaticFieldType(data_type, null, options);
|
|
@@ -21824,17 +22819,20 @@ function getAmisStaticFieldType(type, data_type, options) {
|
|
|
21824
22819
|
}
|
|
21825
22820
|
return "static-image";
|
|
21826
22821
|
}
|
|
22822
|
+
else if (type === 'textarea') {
|
|
22823
|
+
return 'static';
|
|
22824
|
+
}
|
|
21827
22825
|
return type;
|
|
21828
22826
|
}
|
|
21829
22827
|
var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
21830
|
-
var steedosField, field, _a, readonly, _b, ctx, config, fStatic, env, inInputTable, defaultSource, source, fieldBaseProps,
|
|
21831
|
-
var e_1,
|
|
21832
|
-
var
|
|
21833
|
-
return __generator(this, function (
|
|
21834
|
-
switch (
|
|
22828
|
+
var steedosField, field, _a, readonly, _b, ctx, config, fStatic, env, inInputTable, className, defaultSource, source, fieldBaseProps, referenceTo_1, fieldValue, 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;
|
|
22829
|
+
var _e, e_1, _f;
|
|
22830
|
+
var _g, _h, _j, _k, _l, _m;
|
|
22831
|
+
return __generator(this, function (_o) {
|
|
22832
|
+
switch (_o.label) {
|
|
21835
22833
|
case 0:
|
|
21836
22834
|
steedosField = null;
|
|
21837
|
-
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;
|
|
22835
|
+
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;
|
|
21838
22836
|
// console.log(`AmisSteedosField`, props)
|
|
21839
22837
|
// if($schema.config && isString($schema.config)){
|
|
21840
22838
|
// $schema.config = JSON.parse($schema.config)
|
|
@@ -21862,14 +22860,14 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21862
22860
|
// 字段配置为只读,强制走fStatic模式,加上_display判断是为了不影响历史代码,比如直接在ObjectForm中调用steedos-field组件
|
|
21863
22861
|
fStatic = true;
|
|
21864
22862
|
}
|
|
21865
|
-
|
|
22863
|
+
_o.label = 1;
|
|
21866
22864
|
case 1:
|
|
21867
|
-
|
|
21868
|
-
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/,
|
|
22865
|
+
_o.trys.push([1, 24, , 25]);
|
|
22866
|
+
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/, 7];
|
|
21869
22867
|
defaultSource = {
|
|
21870
22868
|
"method": "post",
|
|
21871
22869
|
"url": "${context.rootUrl}/graphql",
|
|
21872
|
-
"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 "),
|
|
22870
|
+
"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 "),
|
|
21873
22871
|
"trackExpression": "${" + steedosField.name + "}",
|
|
21874
22872
|
"cache": 3000
|
|
21875
22873
|
};
|
|
@@ -21886,50 +22884,180 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21886
22884
|
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 ");
|
|
21887
22885
|
}
|
|
21888
22886
|
}
|
|
21889
|
-
source = ((
|
|
22887
|
+
source = ((_g = steedosField.amis) === null || _g === void 0 ? void 0 : _g.source) || ((_h = steedosField.amis) === null || _h === void 0 ? void 0 : _h.autoComplete) || defaultSource;
|
|
21890
22888
|
fieldBaseProps = {
|
|
21891
22889
|
multiple: steedosField.multiple,
|
|
21892
22890
|
name: steedosField.name,
|
|
21893
22891
|
label: steedosField.label,
|
|
21894
22892
|
static: true,
|
|
21895
|
-
|
|
22893
|
+
required: steedosField.required,
|
|
22894
|
+
className: "".concat(className || '', " ").concat(((_j = steedosField.amis) === null || _j === void 0 ? void 0 : _j.className) || '')
|
|
21896
22895
|
};
|
|
21897
22896
|
if (!inInputTable) return [3 /*break*/, 2];
|
|
21898
22897
|
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'select', source: source });
|
|
21899
|
-
return [3 /*break*/,
|
|
22898
|
+
return [3 /*break*/, 6];
|
|
21900
22899
|
case 2:
|
|
21901
|
-
|
|
21902
|
-
return [
|
|
22900
|
+
referenceTo_1 = steedosField.reference_to;
|
|
22901
|
+
if (!referenceTo_1) return [3 /*break*/, 6];
|
|
22902
|
+
if (_$1.isArray(referenceTo_1)) {
|
|
22903
|
+
fieldValue = (_k = props.data) === null || _k === void 0 ? void 0 : _k[steedosField.name];
|
|
22904
|
+
if (fieldValue && fieldValue.o) {
|
|
22905
|
+
referenceTo_1 = fieldValue.o;
|
|
22906
|
+
}
|
|
22907
|
+
else {
|
|
22908
|
+
referenceTo_1 = referenceTo_1[0];
|
|
22909
|
+
}
|
|
22910
|
+
}
|
|
22911
|
+
steedosField.reference_to_field;
|
|
22912
|
+
if (referenceTo_1 === 'users') {
|
|
22913
|
+
referenceTo_1 = 'space_users';
|
|
22914
|
+
}
|
|
22915
|
+
return [4 /*yield*/, getUISchema(referenceTo_1)];
|
|
21903
22916
|
case 3:
|
|
21904
|
-
|
|
21905
|
-
|
|
21906
|
-
|
|
21907
|
-
if (
|
|
21908
|
-
|
|
21909
|
-
|
|
21910
|
-
|
|
21911
|
-
|
|
21912
|
-
|
|
21913
|
-
|
|
21914
|
-
|
|
21915
|
-
|
|
21916
|
-
|
|
21917
|
-
|
|
22917
|
+
fieldRefObject = _o.sent();
|
|
22918
|
+
if (!(props.data._display && _$1.has(props.data._display, steedosField.name))) return [3 /*break*/, 4];
|
|
22919
|
+
disPlayValue = _$1.get(props.data._display, steedosField.name);
|
|
22920
|
+
if (disPlayValue) {
|
|
22921
|
+
if (!_$1.isArray(disPlayValue) && _$1.isObject(disPlayValue)) {
|
|
22922
|
+
disPlayValue = [disPlayValue];
|
|
22923
|
+
}
|
|
22924
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, {
|
|
22925
|
+
type: 'control',
|
|
22926
|
+
name: null,
|
|
22927
|
+
body: {
|
|
22928
|
+
type: 'wrapper',
|
|
22929
|
+
className: "steedos-field-lookup-wrapper p-0",
|
|
22930
|
+
"wrapWithPanel": false,
|
|
22931
|
+
"actions": [],
|
|
22932
|
+
body: [
|
|
22933
|
+
{
|
|
22934
|
+
type: 'each',
|
|
22935
|
+
placeholder: "",
|
|
22936
|
+
className: "steedos-field-lookup-each flex flex-wrap gap-2",
|
|
22937
|
+
source: "${_display.".concat(steedosField.name, "|asArray}"),
|
|
22938
|
+
items: {
|
|
22939
|
+
type: 'static',
|
|
22940
|
+
labelClassName: "hidden",
|
|
22941
|
+
label: false,
|
|
22942
|
+
className: 'm-0',
|
|
22943
|
+
tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\">${label}</a>",
|
|
22944
|
+
popOver: fieldRefObject.compactLayouts ? {
|
|
22945
|
+
"trigger": "hover",
|
|
22946
|
+
"className": "steedos-record-detail-popover",
|
|
22947
|
+
"position": "left-bottom",
|
|
22948
|
+
"showIcon": false,
|
|
22949
|
+
"title": false,
|
|
22950
|
+
"offset": {
|
|
22951
|
+
"top": 0,
|
|
22952
|
+
"left": 20
|
|
22953
|
+
},
|
|
22954
|
+
"body": [
|
|
22955
|
+
{
|
|
22956
|
+
"type": "steedos-record-mini",
|
|
22957
|
+
"objectApiName": "${objectName}",
|
|
22958
|
+
"recordId": "${value}",
|
|
22959
|
+
"showButtons": false,
|
|
22960
|
+
"showBackButton": false,
|
|
22961
|
+
"data": {
|
|
22962
|
+
"objectName": "${objectName}",
|
|
22963
|
+
"recordId": "${value}"
|
|
22964
|
+
}
|
|
22965
|
+
}
|
|
22966
|
+
]
|
|
22967
|
+
} : null
|
|
22968
|
+
}
|
|
22969
|
+
}
|
|
22970
|
+
]
|
|
21918
22971
|
}
|
|
21919
22972
|
});
|
|
21920
22973
|
}
|
|
21921
|
-
|
|
21922
|
-
|
|
21923
|
-
|
|
22974
|
+
else {
|
|
22975
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'static', tpl: '-', className: "".concat(fieldBaseProps.className || '', " text-muted") });
|
|
22976
|
+
}
|
|
22977
|
+
return [3 /*break*/, 6];
|
|
22978
|
+
case 4: return [4 /*yield*/, env.fetcher(source, props.data)];
|
|
22979
|
+
case 5:
|
|
22980
|
+
res = _o.sent();
|
|
22981
|
+
valueOptions_1 = ((_l = res === null || res === void 0 ? void 0 : res.data) === null || _l === void 0 ? void 0 : _l.options) || [];
|
|
22982
|
+
fieldValue = (_m = props.data) === null || _m === void 0 ? void 0 : _m[steedosField.name];
|
|
22983
|
+
values = fieldValue;
|
|
22984
|
+
if (_$1.isString(values)) {
|
|
22985
|
+
values = [values];
|
|
22986
|
+
}
|
|
22987
|
+
if (values && values.length > 0) {
|
|
22988
|
+
disPlayValue_1 = [];
|
|
22989
|
+
_$1.each(values, function (value) {
|
|
22990
|
+
var option = valueOptions_1.find(function (item) { return item.value === value; });
|
|
22991
|
+
if (option) {
|
|
22992
|
+
disPlayValue_1.push({
|
|
22993
|
+
objectName: referenceTo_1,
|
|
22994
|
+
value: option._id || option.value,
|
|
22995
|
+
label: option.label
|
|
22996
|
+
});
|
|
22997
|
+
}
|
|
22998
|
+
});
|
|
22999
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'control', name: null, body: {
|
|
23000
|
+
type: 'form',
|
|
23001
|
+
className: "steedos-field-lookup-wrapper p-0",
|
|
23002
|
+
"wrapWithPanel": false,
|
|
23003
|
+
"actions": [],
|
|
23004
|
+
data: (_e = {},
|
|
23005
|
+
_e[steedosField.name] = disPlayValue_1,
|
|
23006
|
+
_e),
|
|
23007
|
+
body: [
|
|
23008
|
+
{
|
|
23009
|
+
type: 'each',
|
|
23010
|
+
placeholder: "",
|
|
23011
|
+
className: "steedos-field-lookup-each flex flex-wrap gap-2",
|
|
23012
|
+
source: "${".concat(steedosField.name, "}"),
|
|
23013
|
+
items: {
|
|
23014
|
+
type: 'static',
|
|
23015
|
+
className: 'm-0',
|
|
23016
|
+
tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\">${label}</a>",
|
|
23017
|
+
popOver: fieldRefObject.compactLayouts ? {
|
|
23018
|
+
"trigger": "hover",
|
|
23019
|
+
"className": "steedos-record-detail-popover",
|
|
23020
|
+
"position": "left-bottom",
|
|
23021
|
+
"showIcon": false,
|
|
23022
|
+
"title": false,
|
|
23023
|
+
"offset": {
|
|
23024
|
+
"top": 0,
|
|
23025
|
+
"left": 20
|
|
23026
|
+
},
|
|
23027
|
+
"body": [
|
|
23028
|
+
{
|
|
23029
|
+
"type": "steedos-record-mini",
|
|
23030
|
+
"objectApiName": "${objectName}",
|
|
23031
|
+
"recordId": "${value}",
|
|
23032
|
+
"showButtons": false,
|
|
23033
|
+
"showBackButton": false,
|
|
23034
|
+
"data": {
|
|
23035
|
+
"objectName": "${objectName}",
|
|
23036
|
+
"recordId": "${value}"
|
|
23037
|
+
}
|
|
23038
|
+
}
|
|
23039
|
+
]
|
|
23040
|
+
} : null
|
|
23041
|
+
}
|
|
23042
|
+
}
|
|
23043
|
+
]
|
|
23044
|
+
} });
|
|
23045
|
+
}
|
|
23046
|
+
else {
|
|
23047
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'static', tpl: '-', className: "".concat(fieldBaseProps.className || '', " text-muted") });
|
|
23048
|
+
}
|
|
23049
|
+
_o.label = 6;
|
|
23050
|
+
case 6:
|
|
21924
23051
|
schema = Object.assign({}, fieldBaseProps, _$1.pick(steedosField.amis || {}, ['className', 'inline', 'label', 'labelAlign', 'name', 'labelRemark', 'description', 'placeholder', 'staticClassName', 'staticLabelClassName', 'staticInputClassName', 'staticSchema']));
|
|
21925
23052
|
schema.placeholder = "";
|
|
23053
|
+
// console.log(`steedos field [lookup] schema:`, schema)
|
|
21926
23054
|
return [2 /*return*/, schema];
|
|
21927
|
-
case
|
|
21928
|
-
if (!fStatic) return [3 /*break*/,
|
|
21929
|
-
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/,
|
|
23055
|
+
case 7:
|
|
23056
|
+
if (!fStatic) return [3 /*break*/, 21];
|
|
23057
|
+
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/, 9];
|
|
21930
23058
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
21931
|
-
case
|
|
21932
|
-
fieldSchema =
|
|
23059
|
+
case 8:
|
|
23060
|
+
fieldSchema = _o.sent();
|
|
21933
23061
|
if (steedosField.type === 'file' && fieldSchema.disabled) {
|
|
21934
23062
|
fieldValue = fieldSchema.value;
|
|
21935
23063
|
if (fieldValue && fieldValue.length) {
|
|
@@ -21965,59 +23093,59 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21965
23093
|
}
|
|
21966
23094
|
}
|
|
21967
23095
|
return [2 /*return*/, fieldSchema];
|
|
21968
|
-
case
|
|
23096
|
+
case 9:
|
|
21969
23097
|
schema = Object.assign({}, steedosField, {
|
|
21970
23098
|
type: getAmisStaticFieldType(steedosField.type, steedosField.data_type, steedosField),
|
|
21971
23099
|
static: true,
|
|
21972
23100
|
label: steedosField.label
|
|
21973
23101
|
});
|
|
21974
|
-
if (!(steedosField.type === "time")) return [3 /*break*/,
|
|
23102
|
+
if (!(steedosField.type === "time")) return [3 /*break*/, 10];
|
|
21975
23103
|
Object.assign(schema, {
|
|
21976
23104
|
inputFormat: 'HH:mm',
|
|
21977
23105
|
timeFormat: 'HH:mm',
|
|
21978
23106
|
format: '1970-01-01THH:mm:00.000[Z]',
|
|
21979
23107
|
});
|
|
21980
|
-
return [3 /*break*/,
|
|
21981
|
-
case
|
|
21982
|
-
if (!(steedosField.type === "percent")) return [3 /*break*/,
|
|
23108
|
+
return [3 /*break*/, 20];
|
|
23109
|
+
case 10:
|
|
23110
|
+
if (!(steedosField.type === "percent")) return [3 /*break*/, 11];
|
|
21983
23111
|
Object.assign(schema, {
|
|
21984
23112
|
"percent": steedosField.scale ? steedosField.scale : true
|
|
21985
23113
|
});
|
|
21986
|
-
return [3 /*break*/,
|
|
21987
|
-
case
|
|
21988
|
-
if (!(steedosField.type === "password")) return [3 /*break*/,
|
|
23114
|
+
return [3 /*break*/, 20];
|
|
23115
|
+
case 11:
|
|
23116
|
+
if (!(steedosField.type === "password")) return [3 /*break*/, 12];
|
|
21989
23117
|
Object.assign(schema, {
|
|
21990
23118
|
"revealPassword": false //没生效,需要用样式隐藏
|
|
21991
23119
|
});
|
|
21992
|
-
return [3 /*break*/,
|
|
21993
|
-
case
|
|
21994
|
-
if (!(steedosField.type === "select")) return [3 /*break*/,
|
|
23120
|
+
return [3 /*break*/, 20];
|
|
23121
|
+
case 12:
|
|
23122
|
+
if (!(steedosField.type === "select")) return [3 /*break*/, 13];
|
|
21995
23123
|
Object.assign(schema, {
|
|
21996
23124
|
"placeholder": ""
|
|
21997
23125
|
});
|
|
21998
|
-
return [3 /*break*/,
|
|
21999
|
-
case
|
|
22000
|
-
if (!(steedosField.type === "color")) return [3 /*break*/,
|
|
23126
|
+
return [3 /*break*/, 20];
|
|
23127
|
+
case 13:
|
|
23128
|
+
if (!(steedosField.type === "color")) return [3 /*break*/, 14];
|
|
22001
23129
|
Object.assign(schema, {
|
|
22002
23130
|
"defaultColor": null
|
|
22003
23131
|
});
|
|
22004
|
-
return [3 /*break*/,
|
|
22005
|
-
case
|
|
22006
|
-
if (!(steedosField.type === "number")) return [3 /*break*/,
|
|
23132
|
+
return [3 /*break*/, 20];
|
|
23133
|
+
case 14:
|
|
23134
|
+
if (!(steedosField.type === "number" || steedosField.type === 'currency')) return [3 /*break*/, 15];
|
|
22007
23135
|
// amis input-number和number组件中的precision表示小数位数,并不是魔方平台的精度概念,要转换下,否则小数点后会显示很多的0
|
|
22008
23136
|
Object.assign(schema, {
|
|
22009
23137
|
"precision": steedosField.scale || 0
|
|
22010
23138
|
});
|
|
22011
|
-
return [3 /*break*/,
|
|
22012
|
-
case
|
|
22013
|
-
if (!(steedosField.type === "table")) return [3 /*break*/,
|
|
23139
|
+
return [3 /*break*/, 20];
|
|
23140
|
+
case 15:
|
|
23141
|
+
if (!(steedosField.type === "table")) return [3 /*break*/, 16];
|
|
22014
23142
|
if (steedosField.subFields) {
|
|
22015
23143
|
tableFields = [];
|
|
22016
23144
|
try {
|
|
22017
|
-
for (_c = __values(
|
|
23145
|
+
for (_c = __values(steedosField.subFields), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
22018
23146
|
subField = _d.value;
|
|
22019
23147
|
if (!subField.name.endsWith(".$")) {
|
|
22020
|
-
subFieldName = subField.name.replace("".concat(
|
|
23148
|
+
subFieldName = subField.name.replace("".concat(steedosField._prefix || '').concat(steedosField.name, ".$."), '').replace("".concat(steedosField.name, "."), '');
|
|
22021
23149
|
// const gridSub = await convertSFieldToAmisField(Object.assign({}, subField, {name: subFieldName, isTableField: true}), readonly, ctx);
|
|
22022
23150
|
tableFields.push(Object.assign({}, subField, { name: subFieldName }));
|
|
22023
23151
|
}
|
|
@@ -22026,13 +23154,12 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22026
23154
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
22027
23155
|
finally {
|
|
22028
23156
|
try {
|
|
22029
|
-
if (_d && !_d.done && (
|
|
23157
|
+
if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
|
|
22030
23158
|
}
|
|
22031
23159
|
finally { if (e_1) throw e_1.error; }
|
|
22032
23160
|
}
|
|
22033
23161
|
Object.assign(schema, {
|
|
22034
23162
|
type: 'steedos-input-table',
|
|
22035
|
-
showIndex: true,
|
|
22036
23163
|
editable: false,
|
|
22037
23164
|
addable: false,
|
|
22038
23165
|
removable: false,
|
|
@@ -22043,9 +23170,9 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22043
23170
|
}
|
|
22044
23171
|
});
|
|
22045
23172
|
}
|
|
22046
|
-
return [3 /*break*/,
|
|
22047
|
-
case
|
|
22048
|
-
if (!(steedosField.type === "image")) return [3 /*break*/,
|
|
23173
|
+
return [3 /*break*/, 20];
|
|
23174
|
+
case 16:
|
|
23175
|
+
if (!(steedosField.type === "image")) return [3 /*break*/, 17];
|
|
22049
23176
|
Object.assign(schema, {
|
|
22050
23177
|
enlargeAble: true,
|
|
22051
23178
|
showToolbar: true,
|
|
@@ -22076,18 +23203,32 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22076
23203
|
return value;
|
|
22077
23204
|
}
|
|
22078
23205
|
});
|
|
22079
|
-
return [3 /*break*/,
|
|
22080
|
-
case
|
|
22081
|
-
if (!(steedosField.type === "file")) return [3 /*break*/,
|
|
23206
|
+
return [3 /*break*/, 20];
|
|
23207
|
+
case 17:
|
|
23208
|
+
if (!(steedosField.type === "file")) return [3 /*break*/, 19];
|
|
22082
23209
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
22083
|
-
case
|
|
23210
|
+
case 18:
|
|
22084
23211
|
// 附件static模式先保持原来的逻辑,依赖_display,审批王中相关功能在creator中
|
|
22085
23212
|
// convertSFieldToAmisField中会合并steedosField.amis,所以也不需要再次合并steedosField.amis,直接return就好
|
|
22086
|
-
return [2 /*return*/,
|
|
22087
|
-
case
|
|
23213
|
+
return [2 /*return*/, _o.sent()];
|
|
23214
|
+
case 19:
|
|
23215
|
+
if (steedosField.type === 'formula' || steedosField.type === 'summary') {
|
|
23216
|
+
if (steedosField.data_type === 'number' || steedosField.data_type === 'currency') {
|
|
23217
|
+
Object.assign(schema, {
|
|
23218
|
+
"precision": steedosField.scale || 0
|
|
23219
|
+
});
|
|
23220
|
+
}
|
|
23221
|
+
}
|
|
23222
|
+
else if (steedosField.type === 'textarea') {
|
|
23223
|
+
Object.assign(schema, {
|
|
23224
|
+
tpl: "<%=(data.".concat(steedosField.name, " || \"\").split(\"\\n\").join('<br>')%>")
|
|
23225
|
+
});
|
|
23226
|
+
}
|
|
23227
|
+
_o.label = 20;
|
|
23228
|
+
case 20:
|
|
22088
23229
|
Object.assign(schema, steedosField.amis || {});
|
|
22089
23230
|
return [2 /*return*/, schema];
|
|
22090
|
-
case
|
|
23231
|
+
case 21:
|
|
22091
23232
|
fieldAmis = steedosField.amis || {};
|
|
22092
23233
|
if (!props.data.hasOwnProperty("_display")) {
|
|
22093
23234
|
// 有_display时保持原来的逻辑不变,不走以下新的逻辑,审批王中会特意传入_display以跳过后面新加的代码
|
|
@@ -22145,16 +23286,16 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22145
23286
|
}
|
|
22146
23287
|
}
|
|
22147
23288
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
22148
|
-
case
|
|
22149
|
-
schema =
|
|
23289
|
+
case 22:
|
|
23290
|
+
schema = _o.sent();
|
|
22150
23291
|
// console.log(`AmisSteedosField return schema`, schema)
|
|
22151
23292
|
return [2 /*return*/, schema];
|
|
22152
|
-
case
|
|
22153
|
-
case
|
|
22154
|
-
error_1 =
|
|
23293
|
+
case 23: return [3 /*break*/, 25];
|
|
23294
|
+
case 24:
|
|
23295
|
+
error_1 = _o.sent();
|
|
22155
23296
|
console.log("error", error_1);
|
|
22156
|
-
return [3 /*break*/,
|
|
22157
|
-
case
|
|
23297
|
+
return [3 /*break*/, 25];
|
|
23298
|
+
case 25: return [2 /*return*/, null];
|
|
22158
23299
|
}
|
|
22159
23300
|
});
|
|
22160
23301
|
}); };
|
|
@@ -22397,7 +23538,7 @@ var AmisInputTable = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
22397
23538
|
return __generator(this, function (_a) {
|
|
22398
23539
|
switch (_a.label) {
|
|
22399
23540
|
case 0:
|
|
22400
|
-
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;
|
|
23541
|
+
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, props.autoGeneratePrimaryKeyValue, props.mode;
|
|
22401
23542
|
return [4 /*yield*/, getAmisInputTableSchema(props)];
|
|
22402
23543
|
case 1:
|
|
22403
23544
|
amisSchema = _a.sent();
|
|
@@ -22407,6 +23548,46 @@ var AmisInputTable = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
22407
23548
|
});
|
|
22408
23549
|
}); };
|
|
22409
23550
|
|
|
23551
|
+
var AmisRecordDetailMini = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
23552
|
+
var $schema, appId, _a, objectApiName, recordId, schemaData, options, schema;
|
|
23553
|
+
return __generator(this, function (_b) {
|
|
23554
|
+
switch (_b.label) {
|
|
23555
|
+
case 0:
|
|
23556
|
+
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;
|
|
23557
|
+
schemaData = {};
|
|
23558
|
+
if (_$1.has(props.data, "recordId") && props.data.recordId !== "${recordId}") {
|
|
23559
|
+
recordId = props.data.recordId;
|
|
23560
|
+
schemaData.recordId = recordId;
|
|
23561
|
+
}
|
|
23562
|
+
if (_$1.has(props.data, "value")) {
|
|
23563
|
+
recordId = props.data.value;
|
|
23564
|
+
schemaData.recordId = recordId;
|
|
23565
|
+
}
|
|
23566
|
+
if (_$1.has(props.data, "objectName") && props.data.objectName !== "${objectName}") {
|
|
23567
|
+
objectApiName = props.data.objectName;
|
|
23568
|
+
schemaData.objectName = objectApiName;
|
|
23569
|
+
}
|
|
23570
|
+
options = {
|
|
23571
|
+
onEvent: $schema.onEvent,
|
|
23572
|
+
data: $schema.data,
|
|
23573
|
+
recordId: recordId
|
|
23574
|
+
};
|
|
23575
|
+
if (props.$$editor) {
|
|
23576
|
+
options.isEditor = true;
|
|
23577
|
+
}
|
|
23578
|
+
console.log("AmisRecordDetailMini==2=>", objectApiName, options);
|
|
23579
|
+
return [4 /*yield*/, getRecordDetailMiniSchema(objectApiName, appId, options)];
|
|
23580
|
+
case 1:
|
|
23581
|
+
schema = _b.sent();
|
|
23582
|
+
if (!_$1.isEmpty(schemaData)) {
|
|
23583
|
+
schema.data = schemaData;
|
|
23584
|
+
}
|
|
23585
|
+
// console.log(`AmisRecordDetailMini===>`, schema)
|
|
23586
|
+
return [2 /*return*/, schema];
|
|
23587
|
+
}
|
|
23588
|
+
});
|
|
23589
|
+
}); };
|
|
23590
|
+
|
|
22410
23591
|
var PageListView = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22411
23592
|
var formFactor, appId, objectApiName, display, data, _display, page, listSchema;
|
|
22412
23593
|
return __generator(this, function (_b) {
|
|
@@ -22480,14 +23661,14 @@ var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22480
23661
|
recordPage = _a.sent();
|
|
22481
23662
|
recordSchema = recordPage ? recordPage.schema : {
|
|
22482
23663
|
"type": "wrapper",
|
|
22483
|
-
"className": "overflow-y-auto p-0 m-0 flex-1 h-full",
|
|
23664
|
+
"className": "steedos-record-content overflow-y-auto p-0 m-0 flex-1 h-full",
|
|
22484
23665
|
"name": "amis-".concat(appId, "-").concat(objectApiName, "-detail"),
|
|
22485
23666
|
"body": [
|
|
22486
23667
|
{
|
|
22487
23668
|
"type": "steedos-record-detail",
|
|
22488
23669
|
// "recordId": "${recordId}",
|
|
22489
23670
|
"objectApiName": "${objectName}",
|
|
22490
|
-
className: "sm:m-3",
|
|
23671
|
+
// className: "sm:m-3",
|
|
22491
23672
|
appId: appId,
|
|
22492
23673
|
}
|
|
22493
23674
|
],
|
|
@@ -22502,7 +23683,7 @@ var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22502
23683
|
"actions": [
|
|
22503
23684
|
{
|
|
22504
23685
|
"actionType": "custom",
|
|
22505
|
-
"script": "window.Steedos && window.Steedos.setDocumentTitle && Steedos.setDocumentTitle({pageName: event.data.record.name})"
|
|
23686
|
+
"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');"
|
|
22506
23687
|
}
|
|
22507
23688
|
]
|
|
22508
23689
|
}
|
|
@@ -22581,13 +23762,27 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
22581
23762
|
"visibleOn": "${pageType !== 'record' && pageType !== 'list'}"
|
|
22582
23763
|
}
|
|
22583
23764
|
]
|
|
22584
|
-
}
|
|
23765
|
+
},
|
|
23766
|
+
// onEvent: {
|
|
23767
|
+
// "recordLoaded": {
|
|
23768
|
+
// "actions": [
|
|
23769
|
+
// {
|
|
23770
|
+
// "actionType": "setValue",
|
|
23771
|
+
// "args": {
|
|
23772
|
+
// "value": {
|
|
23773
|
+
// "steedos_selected_recordId": "${event.data.record._id}"
|
|
23774
|
+
// }
|
|
23775
|
+
// }
|
|
23776
|
+
// }
|
|
23777
|
+
// ]
|
|
23778
|
+
// }
|
|
23779
|
+
// }
|
|
22585
23780
|
}];
|
|
22586
23781
|
}
|
|
22587
23782
|
});
|
|
22588
23783
|
}); };
|
|
22589
23784
|
|
|
22590
|
-
var __assign=function(){return (__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},StandardObjects={Base:{Actions:{standard_query:{visible:function(e,t,r){return !1}},standard_new:{visible:function(e,t,r){return "cms_files"!==e&&"instances"!==e&&(r?r.allowCreate:void 0)}},standard_edit:{visible:function(e,t,r){if(r)return r.allowEdit}},standard_delete:{visible:function(e,t,r){if(r)return r.allowDelete}},standard_import_data:{visible:function(e,t,r){var n=this.object;if(r)return r.allowCreate&&n.hasImportTemplates}},standard_approve:{visible:function(e,t,r){return !1}},standard_view_instance:{visible:function(e,t,r){return !1}},standard_submit_for_approval:{visible:function(e,t,r){return window.Steedos.ProcessManager.allowSubmit.apply(this,[e,t])},todo:function(e,t){return window.Steedos.ProcessManager.submit.apply(this,[e,t])}},standard_follow:{visible:function(e,t,r){return !1}},standard_delete_many:{visible:function(e,t,r){return !RegExp("\\w+/view/\\w+").test(location.pathname)&&(r?r.allowDelete:void 0)}},standard_export_excel:{visible:function(e,t,r){return !1}}}}},authRequest=function(e,t){var s=null;e=Steedos.absoluteUrl(e);try{var r=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],n={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(r&&r.length)return r.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){s=e;},error:function(e,t,r){var n,o;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,o=void(s={error:n}),o=n.reason||n.message||n,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),s}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}const newFunctionComponent=o=>e=>{const[t,r]=React.useState(!0);var n=()=>{r(!1);};return _$1.has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React__default["default"].createElement(o,_extends({visible:t,onCancel:n,onClose:n},{width:"70%",style:{width:"70%",maxWidth:"950px",minWidth:"480px"}},e))},newComponentRender=(r,n)=>(e,t)=>{e.name||(e.name=r+"-"+(e.name||"default")),(t=t||document.getElementById(`steedos-${r}-root-`+e.name))||((t=document.createElement("div")).setAttribute("id",`steedos-${r}-root-`+e.name),document.body.appendChild(t));e=React__default["default"].createElement(newFunctionComponent(n),e);ReactDOM.createRoot(t).render(e);},Modal=_$1.assign(newComponentRender("modal",antd.Modal),{info:antd.Modal.info,success:antd.Modal.success,error:antd.Modal.error,warning:antd.Modal.warning,confirm:antd.Modal.confirm}),Drawer=newComponentRender("drawer",antd.Drawer),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),_$1.each(e,e=>{-1<e.indexOf(".")&&(e=e.split(".")[0]),t.push(""+e);}),""+t.join(" ")},getFindOneQuery=(e,t,r)=>{e=e.replace(/\./g,"_");r=getGraphqlFieldsQuery(r);let n="";t=[`id: "${t}"`];return `{record:${e}__findOne${n=0<t.length?`(${t.join(",")})`:n}{${r}}}`},SObject={getRecord:async(e,t,r)=>{return (await fetchAPI("/graphql",{method:"post",body:JSON.stringify({query:getFindOneQuery(e,t,r)})})).data.record},getUISchema:async(e,t)=>getUISchema(e,t)},canSaveFilter=e=>!(!e._id||e.owner!==getSteedosAuth()?.userId),ListView={showFilter:(e,{listView:t,data:r})=>{canSaveFilter(t);r.filters&&(r.filters=filtersToConditions(r.filters));},getVisibleFilter:(e,t)=>{return t||(canSaveFilter(e)?e.filters:void 0)},getQueryFilter:(e,t)=>{return canSaveFilter(e)?ListView.getVisibleFilter(e,t):_$1.isEmpty(t)?e.filters:[e.filters,"and",t]},getFirstListView:async e=>{e=await window.getUISchema(e);return _.first(_.sortBy(_.values(e.list_views),"sort_no"))}},Router={getAppPath({appId:e}){return "/app/"+e},getPagePath(){},getObjectListViewPath({appId:e,objectName:t,listViewName:r}){return `/app/${e}/${t}/grid/`+r},getObjectDetailPath({appId:e,objectName:t,recordId:r}){return `/app/${e}/${t}/view/`+r},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:r,objectName:n,foreignKey:o}){return `/app/${e}/${t}/${r}/${n}/grid?related_field_name=`+o}};var withModalWrap=function(t,e){return function(e){return React.createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=React.createElement(e,__assign({},t));return ReactDOM__default["default"].render(e,r)};const safeRunFunction=(t,r,n,o)=>{try{var s=window.Creator;if(!!(!s||!s.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return _$1.isNil(r)||(e=_$1.isArray(r)?r:[r]),t.bind(o||{})(...e)}catch(e){return console.log(e),n}};function safeEval(js){try{return eval(js)}catch(e){console.error(e,js);}}const isExpression=function(e){var t,r;return "string"==typeof e&&(t=/^{{(function.+)}}$/,r=/^{{(.+=>.+)}}$/,!("string"!=typeof e||!e.match(/^{{(.+)}}$/)||e.match(t)||e.match(r)))},getMoment=()=>window.amisRequire?window.amisRequire("moment"):window.moment||void 0,getGlobalNowData=()=>{var e=new Date,t=getMoment();let r=t().utc(),n=(r.set("hours",0),r.set("minutes",0),r.set("seconds",0),r.set("milliseconds",0),r=r.toDate(),t());return n.set("year",1970),n.set("month",0),n.set("date",1),n.set("hours",n.hours()+n.utcOffset()/60),n.set("seconds",0),n.set("milliseconds",0),n=n.toDate(),{now:e,today:r,timeNow:n}},parseSingleExpression=function(t,e,r,n){var o,s;if(n&&Object.assign(n,getGlobalNowData()),s=function(e,t){return "#"!==t&&t?"string"==typeof t?_.get(e,t):void console.error("path has to be a string"):e||{}}(e=void 0===e?{}:e,function(e){return "string"!=typeof e||1===(e=e.split(".")).length?"#":(e.pop(),e.join("."))}(r))||{},"string"!=typeof t)return t;o="__G_L_O_B_A_L__",e="\n return "+t.substring(2,t.length-2).replace(/\bformData\b/g,JSON.stringify(e).replace(/\bglobal\b/g,o)).replace(/\bglobal\b/g,JSON.stringify(n)).replace(new RegExp("\\b"+o+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(s));try{return Function(e)()}catch(e){return console.log(e,t,r),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,getGlobalNowData:getGlobalNowData,parseSingleExpression:parseSingleExpression});const getCompatibleDefaultValueExpression=(express,multiple)=>{const reg=/^\{\w+(\.*\w+)*\}$/,reg2=/^{{[\s\S]*}}$/;let result=express;if(reg.test(express)&&(result=-1<express.indexOf("userId")||-1<express.indexOf("spaceId")||-1<express.indexOf("user.")||-1<express.indexOf("now")||-1<express.indexOf("today")||-1<express.indexOf("timeNow")?`{${express}}`.replace("{{","{{global."):`{${express}}`.replace("{{","{{formData."),multiple&&(result=result.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),reg2.test(express)&&(-1<express.indexOf("function")||-1<express.indexOf("=>"))){let regex=/\{\{([\s\S]*)\}\}/,matches=regex.exec(express);if(matches&&1<matches.length){let functionCode=matches[1];result=eval("("+functionCode+")")();}}return result},getFieldDefaultValue=(e,t)=>{if(!e)return null;let r=e.defaultValue;e._defaultValue&&(r=safeEval(`(${e._defaultValue})`)),_$1.isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),_$1.isString(r)&&(r=getCompatibleDefaultValueExpression(r,e.multiple));var n=isExpression(r);switch(n&&("date"===e.type?r=r.replace(/\bglobal.now\b/g,"global.today"):"time"===e.type&&(r=r.replace(/\bglobal.now\b/g,"global.timeNow")),r=parseSingleExpression(r,{},"#",t)),e.type){case"select":var o=e.data_type||"text";!r||n||e.multiple||("text"!==o||_$1.isString(r)?"number"===o&&_$1.isString(r)?r=Number(r):"boolean"===o&&_$1.isString(r)&&(r="true"===r.toLowerCase()||"1"===r):r=String(r));break;case"number":_$1.isString(r)&&(r=Number(r));break;case"boolean":_$1.isString(r)?r="true"===r.toLowerCase()||"1"===r:_$1.isBoolean(r)||(r=!1);}return r};function getTreeOptions(t,e){const o=e?.valueField||"value";e?.labelField;const r=e?.unfoldedNum||1,n=[],s=(t,r,n)=>{var e;if(r)return e=_.filter(t,e=>_.includes(r,e[o])),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=s(t,e.children,n-1))):e.children&&(e.children=s(t,e.children,n));}),e};for(var a=t,i=0;i<a.length;i++)if(a[i].noParent=0,a[i].unfolded=!1,a[i].parent){let e=1;for(var l=0;l<a.length;l++)a[i].parent==a[l][o]&&(e=0);1==e&&(a[i].noParent=1);}else a[i].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=r?(e.unfolded=!0,n.push(Object.assign({},e,{children:s(t,e.children,r-1)}))):n.push(Object.assign({},e,{children:s(t,e.children,r)})));}),n}function getClosestAmisComponentByType(t,r,n){let o=(n=n||{}).name;var e=n.direction||"up";let s=t.getComponents().find(function(e){return e.props.type===r&&(!o||e.props.name===o)});if(s)return s;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(s=getClosestAmisComponentByType(t.children[e],r,n));e++);return s}}else if("up"===e&&t.parent)return getClosestAmisComponentByType(t.parent,r,n)}function isFilterFormValuesEmpty(e){let t=!0;var e=_.pickBy(e,function(e,t){return /^__searchable__/g.test(t)});return _.isEmpty(e)||(e=_.omitBy(e,function(e){return _.isNil(e)||_.isObject(e)&&_.isEmpty(e)||_.isArray(e)&&_.isEmpty(e.filter(function(e){return !_.isNil(e)}))||_.isString(e)&&0===e.length}),_.isEmpty(e)||(t=!1)),t}const SteedosUI$1=Object.assign({},{render:render,Router:Router,ListView:ListView,Object:SObject,Modal:Modal,Drawer:Drawer,refs:{},getRef(e){return SteedosUI$1.refs[e]},router:{go:(e,t)=>{var r=window.FlowRouter;if(t)return r?r.go(t):window.open(t);r?r.reload():console.warn("暂不支持自动跳转",e);},reload:()=>{console.log("reload");}},message:antd.message,notification:antd.notification,components:{Button:antd.Button,Space:antd.Space},getRefId:({type:e,appId:t,name:r})=>{switch(e){case"listview":return `amis-${t}-${r}-listview`;case"form":return `amis-${t}-${r}-form`;case"detail":return `amis-${t}-${r}-detail`;default:return `amis-${t}-${r}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType,isFilterFormValuesEmpty:isFilterFormValuesEmpty,getSearchFilter:e=>{var o=[];return _.each(e,(e,t)=>{var r,n;_.isEmpty(e)&&!_.isBoolean(e)||(_.startsWith(t,"__searchable__between__")?o.push([""+t.replace("__searchable__between__",""),"between",e]):_.startsWith(t,"__searchable__")&&(_.isString(e)?o.push([""+t.replace("__searchable__",""),"contains",e]):_.isObject(e)&&e.o?(n=[[(r=""+t.replace("__searchable__",""))+"/o","=",e.o]],e.ids.length&&n.push([r+"/ids","=",e.ids]),o.push(n)):o.push([""+t.replace("__searchable__",""),"=",e])));}),o},getKeywordsSearchFilter:(e,t)=>{const o=[];var s;return e&&t&&(s=e.split(/\s+/),s=_$1.compact(s),t.forEach(function(r,e){let n=[];1==s.length?n=[r,"contains",s[0]]:s.forEach(function(e,t){n.push([r,"contains",e]),t<s.length-1&&n.push("or");}),n.length&&(o.push(n),e<t.length-1&&o.push("or"));})),o}});var getBuilderContext=function(){return "undefined"==typeof window?{}:Builder.settings.context||Builder.settings},Steedos$1=__assign({getRootUrl:function(e){var t=getBuilderContext();return t.rootUrl||("undefined"!=typeof window?window.localStorage.getItem("steedos:rootUrl"):"")||e},absoluteUrl:function(e){return void 0===e&&(e=""),"".concat(Steedos$1.getRootUrl()).concat(e)},getTenantId:function(){try{var e=getBuilderContext().tenantId;return (e=window.location.search&&!e?new URLSearchParams(window.location.search).get("X-Space-Id"):e)?e:null}catch(e){console.error(e);}},getAuthorization:function(){try{var e=getBuilderContext(),t=e.tenantId,r=e.authToken;return t&&r?"Bearer ".concat(t,",").concat(r):null}catch(e){console.error(e);}},authRequest:authRequest,StandardObjects:StandardObjects},Expression);"undefined"==typeof window||window.Steedos||(window.Steedos=Steedos$1),"undefined"==typeof window||window.SteedosUI||(window.SteedosUI=SteedosUI$1);
|
|
23785
|
+
var __assign=function(){return (__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},StandardObjects={Base:{Actions:{standard_query:{visible:function(e,t,r){return !1}},standard_new:{visible:function(e,t,r){return "cms_files"!==e&&"instances"!==e&&(r?r.allowCreate:void 0)}},standard_edit:{visible:function(e,t,r){if(r)return r.allowEdit}},standard_delete:{visible:function(e,t,r){if(r)return r.allowDelete}},standard_import_data:{visible:function(e,t,r){var n=this.object;if(r)return r.allowCreate&&n.hasImportTemplates}},standard_approve:{visible:function(e,t,r){return !1}},standard_view_instance:{visible:function(e,t,r){return !1}},standard_submit_for_approval:{visible:function(e,t,r){return window.Steedos.ProcessManager.allowSubmit.apply(this,[e,t])},todo:function(e,t){return window.Steedos.ProcessManager.submit.apply(this,[e,t])}},standard_follow:{visible:function(e,t,r){return !1}},standard_delete_many:{visible:function(e,t,r){return !RegExp("\\w+/view/\\w+").test(location.pathname)&&(r?r.allowDelete:void 0)}},standard_export_excel:{visible:function(e,t,r){return !1}}}}},authRequest=function(e,t){var s=null;e=Steedos.absoluteUrl(e);try{var r=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],n={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(r&&r.length)return r.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){s=e;},error:function(e,t,r){var n,o;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,o=void(s={error:n}),o=n.reason||n.message||n,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),s}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}const newFunctionComponent=o=>e=>{const[t,r]=React.useState(!0);var n=()=>{r(!1);};return _$1.has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React__default["default"].createElement(o,_extends({visible:t,onCancel:n,onClose:n},{width:"70%",style:{width:"70%",maxWidth:"950px",minWidth:"480px"}},e))},newComponentRender=(r,n)=>(e,t)=>{e.name||(e.name=r+"-"+(e.name||"default")),(t=t||document.getElementById(`steedos-${r}-root-`+e.name))||((t=document.createElement("div")).setAttribute("id",`steedos-${r}-root-`+e.name),document.body.appendChild(t));e=React__default["default"].createElement(newFunctionComponent(n),e);ReactDOM.createRoot(t).render(e);},Modal=_$1.assign(newComponentRender("modal",antd.Modal),{info:antd.Modal.info,success:antd.Modal.success,error:antd.Modal.error,warning:antd.Modal.warning,confirm:antd.Modal.confirm}),Drawer=newComponentRender("drawer",antd.Drawer),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),_$1.each(e,e=>{-1<e.indexOf(".")&&(e=e.split(".")[0]),t.push(""+e);}),""+t.join(" ")},getFindOneQuery=(e,t,r)=>{e=e.replace(/\./g,"_");r=getGraphqlFieldsQuery(r);let n="";t=[`id: "${t}"`];return `{record:${e}__findOne${n=0<t.length?`(${t.join(",")})`:n}{${r}}}`},SObject={getRecord:async(e,t,r)=>{return (await fetchAPI("/graphql",{method:"post",body:JSON.stringify({query:getFindOneQuery(e,t,r)})})).data.record},getUISchema:async(e,t)=>getUISchema(e,t)},canSaveFilter=e=>!(!e._id||e.owner!==getSteedosAuth()?.userId),ListView={showFilter:(e,{listView:t,data:r})=>{canSaveFilter(t);r.filters&&(r.filters=filtersToConditions(r.filters));},getVisibleFilter:(e,t)=>{return t||(canSaveFilter(e)?e.filters:void 0)},getQueryFilter:(e,t)=>{return canSaveFilter(e)?ListView.getVisibleFilter(e,t):_$1.isEmpty(t)?e.filters:[e.filters,"and",t]},getFirstListView:async e=>{e=await window.getUISchema(e);return _.first(_.sortBy(_.values(e.list_views),"sort_no"))}},Router={getAppPath({appId:e}){return "/app/"+e},getPagePath(){},getObjectListViewPath({appId:e,objectName:t,listViewName:r}){return `/app/${e}/${t}/grid/`+r},getObjectDetailPath({appId:e,objectName:t,recordId:r}){return `/app/${e}/${t}/view/`+r},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:r,objectName:n,foreignKey:o}){return `/app/${e}/${t}/${r}/${n}/grid?related_field_name=`+o}};var withModalWrap=function(t,e){return function(e){return React.createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=React.createElement(e,__assign({},t));return ReactDOM__default["default"].render(e,r)};const safeRunFunction=(t,r,n,o)=>{try{var s=window.Creator;if(!!(!s||!s.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return _$1.isNil(r)||(e=_$1.isArray(r)?r:[r]),t.bind(o||{})(...e)}catch(e){return console.log(e),n}};function safeEval(js){try{return eval(js)}catch(e){console.error(e,js);}}const isExpression=function(e){var t,r;return "string"==typeof e&&(t=/^{{(function.+)}}$/,r=/^{{(.+=>.+)}}$/,!("string"!=typeof e||!e.match(/^{{(.+)}}$/)||e.match(t)||e.match(r)))},getMoment=()=>window.amisRequire?window.amisRequire("moment"):window.moment||void 0,getGlobalNowData=()=>{var e=new Date,t=getMoment();let r=t().utc(),n=(r.set("hours",0),r.set("minutes",0),r.set("seconds",0),r.set("milliseconds",0),r=r.toDate(),t());return n.set("year",1970),n.set("month",0),n.set("date",1),n.set("hours",n.hours()+n.utcOffset()/60),n.set("seconds",0),n.set("milliseconds",0),n=n.toDate(),{now:e,today:r,timeNow:n}},parseSingleExpression=function(t,e,r,n){var o,s;if(n&&Object.assign(n,getGlobalNowData()),s=function(e,t){return "#"!==t&&t?"string"==typeof t?_.get(e,t):void console.error("path has to be a string"):e||{}}(e=void 0===e?{}:e,function(e){return "string"!=typeof e||1===(e=e.split(".")).length?"#":(e.pop(),e.join("."))}(r))||{},"string"!=typeof t)return t;o="__G_L_O_B_A_L__",e="\n return "+t.substring(2,t.length-2).replace(/\bformData\b/g,JSON.stringify(e).replace(/\bglobal\b/g,o)).replace(/\bglobal\b/g,JSON.stringify(n)).replace(new RegExp("\\b"+o+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(s));try{return Function(e)()}catch(e){return console.log(e,t,r),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,getGlobalNowData:getGlobalNowData,parseSingleExpression:parseSingleExpression});const getCompatibleDefaultValueExpression=(express,multiple)=>{const reg=/^\{\w+(\.*\w+)*\}$/,reg2=/^{{[\s\S]*}}$/;let result=express;if(reg.test(express)&&(result=-1<express.indexOf("userId")||-1<express.indexOf("spaceId")||-1<express.indexOf("user.")||-1<express.indexOf("now")||-1<express.indexOf("today")||-1<express.indexOf("timeNow")?`{${express}}`.replace("{{","{{global."):`{${express}}`.replace("{{","{{formData."),multiple&&(result=result.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),reg2.test(express)&&(-1<express.indexOf("function")||-1<express.indexOf("=>"))){let regex=/\{\{([\s\S]*)\}\}/,matches=regex.exec(express);if(matches&&1<matches.length){let functionCode=matches[1];result=eval("("+functionCode+")")();}}return result},getFieldDefaultValue=(e,t)=>{if(!e)return null;let r=e.defaultValue;e._defaultValue&&(r=safeEval(`(${e._defaultValue})`)),_$1.isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),_$1.isString(r)&&(r=getCompatibleDefaultValueExpression(r,e.multiple));var n=isExpression(r);switch(n&&("date"===e.type?r=r.replace(/\bglobal.now\b/g,"global.today"):"time"===e.type&&(r=r.replace(/\bglobal.now\b/g,"global.timeNow")),r=parseSingleExpression(r,{},"#",t)),e.type){case"select":var o=e.data_type||"text";!r||n||e.multiple||("text"!==o||_$1.isString(r)?"number"===o&&_$1.isString(r)?r=Number(r):"boolean"===o&&_$1.isString(r)&&(r="true"===r.toLowerCase()||"1"===r):r=String(r));break;case"number":_$1.isString(r)&&(r=Number(r));break;case"boolean":_$1.isString(r)?r="true"===r.toLowerCase()||"1"===r:_$1.isBoolean(r)||(r=!1);}return r};function getTreeOptions(t,e){const o=e?.valueField||"value";e?.labelField;const r=e?.unfoldedNum||1,n=[],s=(e,t,r,n)=>{return e.children&&"object"==typeof e.children[0]?e.children:r?(e=_.filter(t,e=>_.includes(r,e[o])),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=s(e,t,e.children,n-1))):e.children&&(e.children=s(e,t,e.children,n));}),e):void 0};for(var i=t,a=0;a<i.length;a++)if(i[a].noParent=0,i[a].unfolded=!1,i[a].parent){let e=1;for(var l=0;l<i.length;l++)i[a].parent==i[l][o]&&(e=0);1==e&&(i[a].noParent=1);}else i[a].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=r?(e.unfolded=!0,n.push(Object.assign({},e,{children:s(e,t,e.children,r-1)}))):n.push(Object.assign({},e,{children:s(e,t,e.children,r)})));}),n}function getClosestAmisComponentByType(t,r,n){let o=(n=n||{}).name;var e=n.direction||"up";let s=t.getComponents().find(function(e){return e.props.type===r&&(!o||e.props.name===o)});if(s)return s;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(s=getClosestAmisComponentByType(t.children[e],r,n));e++);return s}}else if("up"===e&&t.parent)return getClosestAmisComponentByType(t.parent,r,n)}function isFilterFormValuesEmpty(e){let t=!0;var e=_.pickBy(e,function(e,t){return /^__searchable__/g.test(t)});return _.isEmpty(e)||(e=_.omitBy(e,function(e){return _.isNil(e)||_.isObject(e)&&_.isEmpty(e)||_.isArray(e)&&_.isEmpty(e.filter(function(e){return !_.isNil(e)}))||_.isString(e)&&0===e.length}),_.isEmpty(e)||(t=!1)),t}const SteedosUI$1=Object.assign({},{render:render,Router:Router,ListView:ListView,Object:SObject,Modal:Modal,Drawer:Drawer,refs:{},getRef(e){return SteedosUI$1.refs[e]},router:{go:(e,t)=>{var r=window.FlowRouter;if(t)return r?r.go(t):window.open(t);r?r.reload():console.warn("暂不支持自动跳转",e);},reload:()=>{console.log("reload");}},message:antd.message,notification:antd.notification,components:{Button:antd.Button,Space:antd.Space},getRefId:({type:e,appId:t,name:r})=>{switch(e){case"listview":return `amis-${t}-${r}-listview`;case"form":return `amis-${t}-${r}-form`;case"detail":return `amis-${t}-${r}-detail`;default:return `amis-${t}-${r}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType,isFilterFormValuesEmpty:isFilterFormValuesEmpty,getSearchFilter:e=>{var o=[];return _.each(e,(e,t)=>{var r,n;_.isEmpty(e)&&!_.isBoolean(e)||(_.startsWith(t,"__searchable__between__")?o.push([""+t.replace("__searchable__between__",""),"between",e]):_.startsWith(t,"__searchable__")&&(_.isString(e)?o.push([""+t.replace("__searchable__",""),"contains",e]):_.isObject(e)&&e.o?(n=[[(r=""+t.replace("__searchable__",""))+"/o","=",e.o]],e.ids.length&&n.push([r+"/ids","=",e.ids]),o.push(n)):o.push([""+t.replace("__searchable__",""),"=",e])));}),o},getKeywordsSearchFilter:(e,t)=>{const o=[];var s;return e&&t&&(s=e.split(/\s+/),s=_$1.compact(s),t.forEach(function(r,e){let n=[];1==s.length?n=[r,"contains",s[0]]:s.forEach(function(e,t){n.push([r,"contains",e]),t<s.length-1&&n.push("or");}),n.length&&(o.push(n),e<t.length-1&&o.push("or"));})),o}});var getBuilderContext=function(){return "undefined"==typeof window?{}:Builder.settings.context||Builder.settings},Steedos$1=__assign({getRootUrl:function(e){var t=getBuilderContext();return t.rootUrl||("undefined"!=typeof window?window.localStorage.getItem("steedos:rootUrl"):"")||e},absoluteUrl:function(e){return void 0===e&&(e=""),"".concat(Steedos$1.getRootUrl()).concat(e)},getTenantId:function(){try{var e=getBuilderContext().tenantId;return (e=window.location.search&&!e?new URLSearchParams(window.location.search).get("X-Space-Id"):e)?e:null}catch(e){console.error(e);}},getAuthorization:function(){try{var e=getBuilderContext(),t=e.tenantId,r=e.authToken;return t&&r?"Bearer ".concat(t,",").concat(r):null}catch(e){console.error(e);}},authRequest:authRequest,StandardObjects:StandardObjects},Expression);"undefined"==typeof window||window.Steedos||(window.Steedos=Steedos$1),"undefined"==typeof window||window.SteedosUI||(window.SteedosUI=SteedosUI$1);
|
|
22591
23786
|
|
|
22592
23787
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
22593
23788
|
__proto__: null,
|
|
@@ -22613,6 +23808,7 @@ exports.AmisObjectTable = AmisObjectTable;
|
|
|
22613
23808
|
exports.AmisProvider = AmisProvider;
|
|
22614
23809
|
exports.AmisRecordDetail = AmisRecordDetail;
|
|
22615
23810
|
exports.AmisRecordDetailHeader = AmisRecordDetailHeader;
|
|
23811
|
+
exports.AmisRecordDetailMini = AmisRecordDetailMini;
|
|
22616
23812
|
exports.AmisRecordDetailRelatedList = AmisRecordDetailRelatedList;
|
|
22617
23813
|
exports.AmisRecordDetailRelatedLists = AmisRecordDetailRelatedLists;
|
|
22618
23814
|
exports.AmisRecordService = AmisRecordService;
|