@steedos-widgets/amis-object 3.6.2-beta.2 → 3.6.2-beta.20
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 +474 -232
- package/dist/amis-object.cjs.js +1797 -631
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +474 -232
- package/dist/amis-object.esm.js +1797 -632
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +474 -232
- package/dist/amis-object.umd.js +427 -239
- 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",
|
|
@@ -5280,7 +5338,7 @@ async function getTableColumns$1(fields, options){
|
|
|
5280
5338
|
"actionType": "custom",
|
|
5281
5339
|
"script": previewFileScript,
|
|
5282
5340
|
// "expression": "!!window?.nw?.require" //PC客户端预览附件
|
|
5283
|
-
"expression": "
|
|
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,7 +5612,15 @@ async function getMobileTableColumns(fields, options){
|
|
|
5563
5612
|
"actions": [
|
|
5564
5613
|
{
|
|
5565
5614
|
"script": `
|
|
5566
|
-
let cms_url =
|
|
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 = "/api/files/files/"+value+"?download=true"
|
|
5622
|
+
}
|
|
5623
|
+
}
|
|
5567
5624
|
Steedos.cordovaDownload(encodeURI(Steedos.absoluteUrl(cms_url)), event.data.name);
|
|
5568
5625
|
`,
|
|
5569
5626
|
"actionType": "custom"
|
|
@@ -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: 'border-
|
|
12422
|
+
crudClassName: 'steedos-record-related-crud border-l border-r 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,115 +13159,169 @@ 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
|
+
|
|
13035
13281
|
}
|
|
13036
13282
|
}
|
|
13037
13283
|
|
|
13038
|
-
|
|
13039
|
-
|
|
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
|
+
}
|
|
13320
|
+
}
|
|
13321
|
+
}
|
|
13322
|
+
|
|
13323
|
+
// 获取单个相关表
|
|
13324
|
+
async function getObjectRelated(
|
|
13040
13325
|
{appName,
|
|
13041
13326
|
masterObjectName,
|
|
13042
13327
|
objectName,
|
|
@@ -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){
|
|
@@ -14251,6 +14546,9 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
14251
14546
|
const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
|
|
14252
14547
|
let listView = getLookupListView(refObjectConfig);
|
|
14253
14548
|
|
|
14549
|
+
let listviewFilter = getListViewFilter(listView);
|
|
14550
|
+
let listviewFiltersFunction = listView && listView._filters;
|
|
14551
|
+
|
|
14254
14552
|
let sort = "";
|
|
14255
14553
|
if(listView){
|
|
14256
14554
|
sort = getListViewSort(listView);
|
|
@@ -14280,7 +14578,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
14280
14578
|
apiInfo.data['rfield'] = `\${object_name}`;
|
|
14281
14579
|
// [["_id", "=", "$${field.name}._id"],"or",["name", "contains", "$term"]]
|
|
14282
14580
|
apiInfo.requestAdaptor = `
|
|
14283
|
-
var filters = [];
|
|
14581
|
+
${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
|
|
14284
14582
|
var top = 200;
|
|
14285
14583
|
if(api.data.$term){
|
|
14286
14584
|
filters = [["${referenceTo?.NAME_FIELD_KEY || 'name'}", "contains", api.data.$term]];
|
|
@@ -14303,6 +14601,16 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
14303
14601
|
}
|
|
14304
14602
|
|
|
14305
14603
|
const inFilterForm = ${ctx.inFilterForm};
|
|
14604
|
+
|
|
14605
|
+
const listviewFiltersFunction = ${listviewFiltersFunction};
|
|
14606
|
+
|
|
14607
|
+
if(listviewFiltersFunction && !inFilterForm){
|
|
14608
|
+
const _filters0 = listviewFiltersFunction(filters, api.data.$);
|
|
14609
|
+
if(_filters0 && _filters0.length){
|
|
14610
|
+
filters.push(_filters0);
|
|
14611
|
+
}
|
|
14612
|
+
}
|
|
14613
|
+
|
|
14306
14614
|
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
14307
14615
|
|
|
14308
14616
|
if(filtersFunction && !inFilterForm){
|
|
@@ -14425,9 +14733,17 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
14425
14733
|
}
|
|
14426
14734
|
// console.log(`lookupToAmis====`, field, readonly, ctx)
|
|
14427
14735
|
if(readonly){
|
|
14428
|
-
|
|
14429
|
-
|
|
14430
|
-
|
|
14736
|
+
if(field.reference_to){
|
|
14737
|
+
return {
|
|
14738
|
+
type: 'steedos-field',
|
|
14739
|
+
config: field,
|
|
14740
|
+
static: true
|
|
14741
|
+
}
|
|
14742
|
+
}else {
|
|
14743
|
+
return {
|
|
14744
|
+
type: getAmisStaticFieldType$1('picker', readonly),
|
|
14745
|
+
tpl: getRelatedFieldTpl(field, ctx)
|
|
14746
|
+
}
|
|
14431
14747
|
}
|
|
14432
14748
|
}
|
|
14433
14749
|
if(field.reference_to && !_$1__namespace.isString(field.reference_to) && !readonly){
|
|
@@ -15079,13 +15395,31 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15079
15395
|
};
|
|
15080
15396
|
break;
|
|
15081
15397
|
case 'input-datetime-range':
|
|
15398
|
+
// convertData = {
|
|
15399
|
+
// type: "input-datetime-range",
|
|
15400
|
+
// inputFormat: 'YYYY-MM-DD HH:mm',
|
|
15401
|
+
// format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
15402
|
+
// tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
|
|
15403
|
+
// utc: true,
|
|
15404
|
+
// joinValues: false
|
|
15405
|
+
// }
|
|
15406
|
+
// 日期时间字段,按日期方式展现显示控件,用户不用关心小时分钟
|
|
15082
15407
|
convertData = {
|
|
15083
|
-
type: "input-
|
|
15084
|
-
inputFormat:
|
|
15408
|
+
type: "input-date-range",
|
|
15409
|
+
inputFormat: "YYYY-MM-DD HH:mm",
|
|
15085
15410
|
format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
15086
15411
|
tpl: readonly ? getDateTimeTpl(field) : null,
|
|
15087
15412
|
utc: true,
|
|
15088
|
-
joinValues: false
|
|
15413
|
+
joinValues: false,
|
|
15414
|
+
"shortcuts": [
|
|
15415
|
+
"thismonth",
|
|
15416
|
+
"2monthsago",
|
|
15417
|
+
"3monthslater",
|
|
15418
|
+
"prevquarter",
|
|
15419
|
+
"thisquarter",
|
|
15420
|
+
"thisyear",
|
|
15421
|
+
"lastYear"
|
|
15422
|
+
]
|
|
15089
15423
|
};
|
|
15090
15424
|
break;
|
|
15091
15425
|
case 'datetime':
|
|
@@ -15136,7 +15470,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15136
15470
|
convertData = {
|
|
15137
15471
|
type: getAmisStaticFieldType$1('datetime', readonly),
|
|
15138
15472
|
inputFormat: 'YYYY-MM-DD HH:mm',
|
|
15139
|
-
format: 'YYYY-MM-DDTHH:mm:
|
|
15473
|
+
format: 'YYYY-MM-DDTHH:mm:00.000Z',
|
|
15140
15474
|
tpl: readonly ? getDateTimeTpl(field) : null,
|
|
15141
15475
|
utc: true,
|
|
15142
15476
|
};
|
|
@@ -15267,6 +15601,36 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15267
15601
|
convertData = {
|
|
15268
15602
|
type: 'static-text'
|
|
15269
15603
|
};
|
|
15604
|
+
}else if(field.autonumber_enable_modify){
|
|
15605
|
+
convertData = {
|
|
15606
|
+
"type": "input-group",
|
|
15607
|
+
"body": [
|
|
15608
|
+
{
|
|
15609
|
+
"type": "input-text",
|
|
15610
|
+
"name": field.name
|
|
15611
|
+
},
|
|
15612
|
+
{
|
|
15613
|
+
"type": "button",
|
|
15614
|
+
"label": "自动获取",
|
|
15615
|
+
"actionType": "ajax",
|
|
15616
|
+
"api": {
|
|
15617
|
+
"url": `\${context.rootUrl}/api/autonumber/generator/\${objectName}/${field.name}`,
|
|
15618
|
+
"method": "post",
|
|
15619
|
+
"headers": {
|
|
15620
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
15621
|
+
},
|
|
15622
|
+
"adaptor": `
|
|
15623
|
+
payload.data["${field.name}"] = payload.data && payload.data.autonumber;
|
|
15624
|
+
delete payload.data.autonumber;
|
|
15625
|
+
return payload;
|
|
15626
|
+
`
|
|
15627
|
+
},
|
|
15628
|
+
"messages": {
|
|
15629
|
+
"success": "获取成功"
|
|
15630
|
+
}
|
|
15631
|
+
}
|
|
15632
|
+
]
|
|
15633
|
+
};
|
|
15270
15634
|
}
|
|
15271
15635
|
break;
|
|
15272
15636
|
case 'url':
|
|
@@ -15421,11 +15785,9 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15421
15785
|
if(field.subFields){
|
|
15422
15786
|
convertData = {
|
|
15423
15787
|
type: 'steedos-input-table',
|
|
15424
|
-
showIndex: true,
|
|
15425
15788
|
editable: !readonly,
|
|
15426
15789
|
addable: !readonly,
|
|
15427
15790
|
removable: !readonly,
|
|
15428
|
-
draggable: !readonly,
|
|
15429
15791
|
fields: [],
|
|
15430
15792
|
amis:{
|
|
15431
15793
|
columnsTogglable: false
|
|
@@ -15477,9 +15839,9 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15477
15839
|
if(field.is_wide || convertData.type === 'group'){
|
|
15478
15840
|
convertData.className = 'col-span-2 m-0';
|
|
15479
15841
|
}else {
|
|
15480
|
-
convertData.className = 'm-
|
|
15842
|
+
convertData.className = 'm-0';
|
|
15481
15843
|
}
|
|
15482
|
-
if(readonly){
|
|
15844
|
+
if(readonly && ctx.mode !== 'edit'){
|
|
15483
15845
|
convertData.className = `${convertData.className} border-b`;
|
|
15484
15846
|
}
|
|
15485
15847
|
if(readonly){
|
|
@@ -15502,6 +15864,10 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15502
15864
|
}
|
|
15503
15865
|
}
|
|
15504
15866
|
|
|
15867
|
+
if(ctx.amisData && ctx.amisData._master && ctx.amisData._master.relatedKey === field.name){
|
|
15868
|
+
convertData.className = `${convertData.className || ''} hidden`;
|
|
15869
|
+
}
|
|
15870
|
+
|
|
15505
15871
|
if(_$1__namespace.isString(baseData.required)){
|
|
15506
15872
|
if(baseData.required.startsWith("{{")){
|
|
15507
15873
|
baseData.requiredOn = `${baseData.required.substring(2, baseData.required.length -2).replace(/formData./g, 'data.')}`;
|
|
@@ -15570,8 +15936,9 @@ async function getFieldSearchable(perField, permissionFields, ctx){
|
|
|
15570
15936
|
fieldNamePrefix = `${fieldNamePrefix}between__`;
|
|
15571
15937
|
}
|
|
15572
15938
|
if(_field.type === 'datetime'){
|
|
15573
|
-
//
|
|
15574
|
-
|
|
15939
|
+
// 这里如果想把搜索范围展示效果改为日期范围,不可以直接改为input-date-range,因为它们规则不一样,包括时区规则和小时分秒的存值规则都不一样
|
|
15940
|
+
// 所以想改为展示日期范围效果,只能改input-datetime-range类型本身的属性来实现
|
|
15941
|
+
_field.type = 'input-datetime-range';
|
|
15575
15942
|
_field.is_wide = true;
|
|
15576
15943
|
fieldNamePrefix = `${fieldNamePrefix}between__`;
|
|
15577
15944
|
}
|
|
@@ -15757,6 +16124,13 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
|
|
|
15757
16124
|
}
|
|
15758
16125
|
}
|
|
15759
16126
|
|
|
16127
|
+
fieldSetBody.forEach((field)=>{
|
|
16128
|
+
//判断label是否存在,不存在时将label的空占位元素隐藏
|
|
16129
|
+
if(!field.label){
|
|
16130
|
+
field.labelClassName = "none";
|
|
16131
|
+
}
|
|
16132
|
+
});
|
|
16133
|
+
|
|
15760
16134
|
// fieldSet 已支持显隐控制
|
|
15761
16135
|
const sectionFieldsVisibleOn = _$1__namespace.map(_$1__namespace.compact(_$1__namespace.map(fieldSetBody, 'visibleOn')), (visibleOn) => {
|
|
15762
16136
|
let visible = visibleOn;
|
|
@@ -15879,19 +16253,200 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
15879
16253
|
return await getSections(permissionFields, formFields, ctx);
|
|
15880
16254
|
}
|
|
15881
16255
|
|
|
16256
|
+
/*
|
|
16257
|
+
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
16258
|
+
* @Date: 2024-01-18 15:12:41
|
|
16259
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
16260
|
+
* @LastEditTime: 2024-01-18 15:12:49
|
|
16261
|
+
*/
|
|
16262
|
+
/**
|
|
16263
|
+
* 生成符合标准uuid格式的36位满足唯一性的随机串
|
|
16264
|
+
* @returns uuid
|
|
16265
|
+
*/
|
|
16266
|
+
function uuidv4() {
|
|
16267
|
+
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, c =>
|
|
16268
|
+
(c ^ window.crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
|
16269
|
+
);
|
|
16270
|
+
}
|
|
16271
|
+
|
|
15882
16272
|
/*
|
|
15883
16273
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
15884
16274
|
* @Date: 2023-11-15 09:50:22
|
|
15885
|
-
* @LastEditors:
|
|
15886
|
-
* @LastEditTime: 2024-01-
|
|
16275
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
16276
|
+
* @LastEditTime: 2024-01-26 17:47:16
|
|
16277
|
+
*/
|
|
16278
|
+
|
|
16279
|
+
/**
|
|
16280
|
+
* 子表组件字段值中每行数据补上字段值为空的的字段值,把值统一设置为空字符串,是为了解决amis amis 3.6/6.0 input-table组件bug:行中字段值为空时会显示为父作用域中的同名变量值,见:https://github.com/baidu/amis/issues/9520
|
|
16281
|
+
* amis #9520修正后此函数及相关代码可以移除
|
|
16282
|
+
* @param {*} value 子表组件字段值,数组
|
|
16283
|
+
* @param {*} fields 子表组件fields属性,数组
|
|
16284
|
+
* @returns 转换后的子表组件字段值
|
|
16285
|
+
*/
|
|
16286
|
+
function getTableValueWithEmptyValue(value, fields) {
|
|
16287
|
+
return (value || []).map((itemValue) => {
|
|
16288
|
+
//这里不clone的话,会造成在pipeIn函数执行该函数后像pipeOut一样最终输出到表单项中,即库里字段值会被改了
|
|
16289
|
+
const newItemValue = _$1.clone(itemValue);
|
|
16290
|
+
(fields || []).forEach((itemField) => {
|
|
16291
|
+
if(itemField.name && (newItemValue[itemField.name] === undefined || newItemValue[itemField.name] === null)){
|
|
16292
|
+
// 这里newItemValue中不存在 itemField.name 属性,或者值为null时都会有“显示为父作用域中的同名变量值”的问题,所以null和undefined都要重置为空字符串
|
|
16293
|
+
// 实测数字、下拉框、多选lookup等字段类型重置为空字符串都不会有问题,而且实测amis from组件的清空表单字段值功能就是把表单中的各种字段类型设置为空字符串,所以看起来也符合amis规范
|
|
16294
|
+
newItemValue[itemField.name] = "";
|
|
16295
|
+
}
|
|
16296
|
+
if (newItemValue.children) {
|
|
16297
|
+
newItemValue.children = getTableValueWithEmptyValue(newItemValue.children, fields);
|
|
16298
|
+
}
|
|
16299
|
+
});
|
|
16300
|
+
return newItemValue;
|
|
16301
|
+
});
|
|
16302
|
+
}
|
|
16303
|
+
|
|
16304
|
+
/**
|
|
16305
|
+
* 把子表组件字段值中每行数据中经过上面getTableValueWithEmptyValue函数空字段值移除
|
|
16306
|
+
* amis #9520修正后此函数及相关代码可以移除
|
|
16307
|
+
* @param {*} value 子表组件字段值,数组
|
|
16308
|
+
* @param {*} fields 子表组件fields属性,数组
|
|
16309
|
+
* @returns 转换后的子表组件字段值
|
|
16310
|
+
*/
|
|
16311
|
+
function getTableValueWithoutEmptyValue(value, fields) {
|
|
16312
|
+
return (value || []).map((itemValue) => {
|
|
16313
|
+
const newItemValue = _$1.clone(itemValue);
|
|
16314
|
+
(fields || []).forEach((itemField) => {
|
|
16315
|
+
if(itemField.name && (newItemValue[itemField.name] === "" || newItemValue[itemField.name] === undefined || newItemValue[itemField.name] === null)){
|
|
16316
|
+
// 这里额外把null和undefined值也删除掉纯粹是没必要输出保存它们
|
|
16317
|
+
delete newItemValue[itemField.name];
|
|
16318
|
+
}
|
|
16319
|
+
if (newItemValue.children) {
|
|
16320
|
+
newItemValue.children = getTableValueWithoutEmptyValue(newItemValue.children, fields);
|
|
16321
|
+
}
|
|
16322
|
+
});
|
|
16323
|
+
return newItemValue;
|
|
16324
|
+
});
|
|
16325
|
+
}
|
|
16326
|
+
|
|
16327
|
+
function getTablePrimaryKey(props) {
|
|
16328
|
+
return props.primaryKey || "_id";
|
|
16329
|
+
}
|
|
16330
|
+
|
|
16331
|
+
/**
|
|
16332
|
+
* 子表组件字段值中每行数据的补上唯一标识字段值,其值为随机uuid
|
|
16333
|
+
* @param {*} value 子表组件字段值,数组
|
|
16334
|
+
* @param {*} primaryKey 主键字段名,一般为_id
|
|
16335
|
+
* @returns 转换后的子表组件字段值
|
|
15887
16336
|
*/
|
|
16337
|
+
function getTableValueWithPrimaryKeyValue(value, primaryKey) {
|
|
16338
|
+
if (!primaryKey) {
|
|
16339
|
+
return value;
|
|
16340
|
+
}
|
|
16341
|
+
return (value || []).map((itemValue) => {
|
|
16342
|
+
//这里不clone的话,会造成在pipeIn函数执行该函数后像pipeOut一样最终输出到表单项中,即库里把primaryKey字段值保存了
|
|
16343
|
+
const newItemValue = _$1.clone(itemValue);
|
|
16344
|
+
if (newItemValue[primaryKey]) {
|
|
16345
|
+
if (newItemValue.children) {
|
|
16346
|
+
newItemValue.children = getTableValueWithPrimaryKeyValue(newItemValue.children, primaryKey);
|
|
16347
|
+
}
|
|
16348
|
+
return newItemValue;
|
|
16349
|
+
}
|
|
16350
|
+
else {
|
|
16351
|
+
newItemValue[primaryKey] = uuidv4();
|
|
16352
|
+
if (newItemValue.children) {
|
|
16353
|
+
newItemValue.children = getTableValueWithPrimaryKeyValue(newItemValue.children, primaryKey);
|
|
16354
|
+
}
|
|
16355
|
+
return newItemValue;
|
|
16356
|
+
}
|
|
16357
|
+
});
|
|
16358
|
+
}
|
|
16359
|
+
|
|
16360
|
+
/**
|
|
16361
|
+
* 子表组件字段值中每行数据的移除唯一标识字段值,因为该字段值一般只作临时标记,不存库
|
|
16362
|
+
* @param {*} value 子表组件字段值,数组
|
|
16363
|
+
* @param {*} primaryKey 主键字段名,一般为_id
|
|
16364
|
+
* @returns 转换后的子表组件字段值
|
|
16365
|
+
*/
|
|
16366
|
+
function getTableValueWithoutPrimaryKeyValue(value, primaryKey) {
|
|
16367
|
+
if (!primaryKey) {
|
|
16368
|
+
return value;
|
|
16369
|
+
}
|
|
16370
|
+
return (value || []).map((itemValue) => {
|
|
16371
|
+
//这里clone只是为了保险,不是必须的,每次修改子表数据是否都会生成新的primaryKey字段值是由pipeOut中识别autoGeneratePrimaryKeyValue决定的,跟这里没关系
|
|
16372
|
+
const newItemValue = _$1.clone(itemValue);
|
|
16373
|
+
if (newItemValue.children) {
|
|
16374
|
+
newItemValue.children = getTableValueWithoutPrimaryKeyValue(newItemValue.children, primaryKey);
|
|
16375
|
+
}
|
|
16376
|
+
delete newItemValue[primaryKey];
|
|
16377
|
+
return newItemValue;
|
|
16378
|
+
});
|
|
16379
|
+
}
|
|
16380
|
+
|
|
16381
|
+
/**
|
|
16382
|
+
* 子表组件字段值中每行数据的键值key移除指定前缀
|
|
16383
|
+
* @param {*} value 子表组件字段值,数组
|
|
16384
|
+
* @param {*} fieldPrefix 字段前缀
|
|
16385
|
+
* @returns 转换后的子表组件字段值
|
|
16386
|
+
*/
|
|
16387
|
+
function getTableValueWithoutFieldPrefix(value, fieldPrefix) {
|
|
16388
|
+
let convertedValue = [];
|
|
16389
|
+
(value || []).forEach((itemValue) => {
|
|
16390
|
+
var newItemValue = {};
|
|
16391
|
+
for (let n in itemValue) {
|
|
16392
|
+
if (itemValue.hasOwnProperty(n)) {
|
|
16393
|
+
newItemValue[n.replace(new RegExp(`^${fieldPrefix}`), "")] = itemValue[n];
|
|
16394
|
+
}
|
|
16395
|
+
}
|
|
16396
|
+
convertedValue.push(newItemValue);
|
|
16397
|
+
});
|
|
16398
|
+
return convertedValue;
|
|
16399
|
+
}
|
|
16400
|
+
|
|
16401
|
+
/**
|
|
16402
|
+
* 子表组件字段值中每行数据的键值key补上指定前缀
|
|
16403
|
+
* @param {*} value 子表组件字段值,数组
|
|
16404
|
+
* @param {*} fieldPrefix 字段前缀
|
|
16405
|
+
* @param {*} primaryKey 主键字段名,主键不参与被键值key规则,需要排除,审批王amis表单也是这个规则
|
|
16406
|
+
* @returns 转换后的子表组件字段值
|
|
16407
|
+
*/
|
|
16408
|
+
function getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey) {
|
|
16409
|
+
let convertedValue = [];
|
|
16410
|
+
(value || []).forEach((itemValue) => {
|
|
16411
|
+
var newItemValue = {};
|
|
16412
|
+
for (let n in itemValue) {
|
|
16413
|
+
if (itemValue.hasOwnProperty(n) && typeof itemValue[n] !== undefined && n !== primaryKey) {
|
|
16414
|
+
newItemValue[`${fieldPrefix}${n}`] = itemValue[n];
|
|
16415
|
+
}
|
|
16416
|
+
}
|
|
16417
|
+
if (primaryKey && itemValue[primaryKey]) {
|
|
16418
|
+
newItemValue[primaryKey] = itemValue[primaryKey];
|
|
16419
|
+
}
|
|
16420
|
+
convertedValue.push(newItemValue);
|
|
16421
|
+
});
|
|
16422
|
+
return convertedValue;
|
|
16423
|
+
}
|
|
16424
|
+
|
|
16425
|
+
/**
|
|
16426
|
+
* 子表组件字段集合属性中每个字段name移除指定前缀
|
|
16427
|
+
* @param {*} fields 子表组件字段集合,数组
|
|
16428
|
+
* @param {*} fieldPrefix 字段前缀
|
|
16429
|
+
* @returns 转换后的子表组件字段值
|
|
16430
|
+
*/
|
|
16431
|
+
function getTableFieldsWithoutFieldPrefix(fields, fieldPrefix) {
|
|
16432
|
+
return (fields || []).map((item) => {
|
|
16433
|
+
const newItem = _$1.clone(item);//这里不clone的话,会造成子表组件重新render,从而审批王那边点开子表行编辑窗口时报错
|
|
16434
|
+
newItem.name = newItem.name.replace(new RegExp(`^${fieldPrefix}`), "");
|
|
16435
|
+
return newItem;
|
|
16436
|
+
});
|
|
16437
|
+
}
|
|
15888
16438
|
|
|
15889
16439
|
/**
|
|
15890
16440
|
* @param {*} props
|
|
15891
16441
|
* @param {*} mode edit/new/readonly
|
|
15892
16442
|
*/
|
|
15893
16443
|
function getFormFields(props, mode = "edit") {
|
|
15894
|
-
|
|
16444
|
+
let fieldPrefix = props.fieldPrefix;
|
|
16445
|
+
let fields = props.fields || [];
|
|
16446
|
+
if (fieldPrefix) {
|
|
16447
|
+
fields = getTableFieldsWithoutFieldPrefix(fields, fieldPrefix);
|
|
16448
|
+
}
|
|
16449
|
+
return (fields || []).map(function (item) {
|
|
15895
16450
|
let formItem = {
|
|
15896
16451
|
"type": "steedos-field",
|
|
15897
16452
|
"name": item.name,
|
|
@@ -15911,6 +16466,7 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
15911
16466
|
name: field.name,
|
|
15912
16467
|
quickEdit: {
|
|
15913
16468
|
"type": "steedos-field",
|
|
16469
|
+
"mode": "inline",
|
|
15914
16470
|
"config": Object.assign({}, field, {
|
|
15915
16471
|
label: false
|
|
15916
16472
|
})
|
|
@@ -15963,7 +16519,12 @@ async function getInputTableColumns(props) {
|
|
|
15963
16519
|
let inlineEditMode = props.inlineEditMode;
|
|
15964
16520
|
let showAsInlineEditMode = inlineEditMode && props.editable;
|
|
15965
16521
|
// 实测过,直接不生成对应的隐藏column并不会对input-table值造成丢失问题,隐藏的列字段值能正常维护
|
|
15966
|
-
|
|
16522
|
+
|
|
16523
|
+
let fieldPrefix = props.fieldPrefix;
|
|
16524
|
+
let fields = props.fields || [];
|
|
16525
|
+
if (fieldPrefix) {
|
|
16526
|
+
fields = getTableFieldsWithoutFieldPrefix(fields, fieldPrefix);
|
|
16527
|
+
}
|
|
15967
16528
|
if (columns && columns.length) {
|
|
15968
16529
|
return columns.map(function (column) {
|
|
15969
16530
|
let field, extendColumnProps = {};
|
|
@@ -15985,7 +16546,9 @@ async function getInputTableColumns(props) {
|
|
|
15985
16546
|
}
|
|
15986
16547
|
}
|
|
15987
16548
|
if (field) {
|
|
15988
|
-
let
|
|
16549
|
+
let mode = typeof extendColumnProps.inlineEditMode === "boolean" ?
|
|
16550
|
+
extendColumnProps.inlineEditMode : showAsInlineEditMode;
|
|
16551
|
+
let tableCell = getInputTableCell(field, mode);
|
|
15989
16552
|
return Object.assign({}, tableCell, extendColumnProps);
|
|
15990
16553
|
}
|
|
15991
16554
|
else {
|
|
@@ -16008,7 +16571,7 @@ async function getInputTableColumns(props) {
|
|
|
16008
16571
|
*/
|
|
16009
16572
|
function getFormPagination(props, mode) {
|
|
16010
16573
|
let showPagination = true;
|
|
16011
|
-
if(mode === "new" && !!!props.editable){
|
|
16574
|
+
if (mode === "new" && !!!props.editable) {
|
|
16012
16575
|
//不允许编辑只允许新建时不应该让用户操作翻页
|
|
16013
16576
|
showPagination = false;
|
|
16014
16577
|
}
|
|
@@ -16024,23 +16587,41 @@ function getFormPagination(props, mode) {
|
|
|
16024
16587
|
let __formId = "${formId}";
|
|
16025
16588
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
16026
16589
|
let pageChangeDirection = context.props.pageChangeDirection;
|
|
16590
|
+
let mode = "${mode}";
|
|
16027
16591
|
// event.data中的index和__page分别表示当前要把表单数据提交到的行索引和用于标定下一页页码的当前页页码
|
|
16028
16592
|
// 一般来说__page = index + 1,但是可以让event.data中传入__page和index值不是这种联系。
|
|
16029
16593
|
// 比如__page设置为3,index设置为0表示把当前表单数据提交到第一页,但是跳转到第4页,弹出的表单中底下的新增和复制按钮依赖了此功能
|
|
16030
16594
|
// let currentPage = currentIndex + 1;
|
|
16031
16595
|
let currentPage = event.data.__page;
|
|
16032
16596
|
let currentIndex = event.data.index;
|
|
16033
|
-
|
|
16034
|
-
|
|
16035
|
-
|
|
16036
|
-
|
|
16037
|
-
|
|
16038
|
-
|
|
16039
|
-
|
|
16040
|
-
|
|
16041
|
-
|
|
16597
|
+
if(mode !== "readonly"){
|
|
16598
|
+
// 新建编辑时,翻页才需要把当前页表单保存,只读时直接翻页即可
|
|
16599
|
+
// 翻页到下一页之前需要先把当前页改动的内容保存到中间变量__tableItems中
|
|
16600
|
+
let currentFormValues = scope.getComponentById(__formId).getValues();
|
|
16601
|
+
// 这里不clone的话,其值会带上__super属性
|
|
16602
|
+
currentFormValues = _.clone(currentFormValues);
|
|
16603
|
+
var parent = event.data.parent;
|
|
16604
|
+
var __parentIndex = event.data.__parentIndex;
|
|
16605
|
+
if(parent){
|
|
16606
|
+
fieldValue[__parentIndex].children[currentIndex] = currentFormValues;
|
|
16607
|
+
// 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
|
|
16608
|
+
fieldValue[__parentIndex] = Object.assign({}, fieldValue[__parentIndex], {
|
|
16609
|
+
children: fieldValue[__parentIndex].children,
|
|
16610
|
+
__fix_rerender_after_children_modified_tag: new Date().getTime()
|
|
16611
|
+
});
|
|
16042
16612
|
}
|
|
16043
|
-
|
|
16613
|
+
else{
|
|
16614
|
+
fieldValue[currentIndex] = currentFormValues;
|
|
16615
|
+
}
|
|
16616
|
+
// 翻页到下一页前需要同时把改动的内容保存到最终正式的表单字段中,所以额外给正式表单字段执行一次setValue
|
|
16617
|
+
doAction({
|
|
16618
|
+
"componentId": "${props.id}",
|
|
16619
|
+
"actionType": "setValue",
|
|
16620
|
+
"args": {
|
|
16621
|
+
"value": fieldValue
|
|
16622
|
+
}
|
|
16623
|
+
});
|
|
16624
|
+
}
|
|
16044
16625
|
|
|
16045
16626
|
// 以下是翻页逻辑,翻到下一页并把下一页内容显示到表单上
|
|
16046
16627
|
let targetPage;
|
|
@@ -16089,9 +16670,14 @@ function getFormPagination(props, mode) {
|
|
|
16089
16670
|
"onEvent": {
|
|
16090
16671
|
"click": {
|
|
16091
16672
|
"actions": [
|
|
16673
|
+
{
|
|
16674
|
+
"actionType": "validate",
|
|
16675
|
+
"componentId": formId
|
|
16676
|
+
},
|
|
16092
16677
|
{
|
|
16093
16678
|
"actionType": "custom",
|
|
16094
|
-
"script": onPageChangeScript
|
|
16679
|
+
"script": onPageChangeScript,
|
|
16680
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
16095
16681
|
}
|
|
16096
16682
|
]
|
|
16097
16683
|
}
|
|
@@ -16099,7 +16685,8 @@ function getFormPagination(props, mode) {
|
|
|
16099
16685
|
},
|
|
16100
16686
|
{
|
|
16101
16687
|
"type": "tpl",
|
|
16102
|
-
|
|
16688
|
+
// 这里用__super.parent,加__super是为了防止当前记录有字段名为parent的重名变量
|
|
16689
|
+
"tpl": "${__page}/${__super.parent ? COMPACT(__tableItems[__parentIndex]['children']).length : COMPACT(__tableItems).length}"
|
|
16103
16690
|
},
|
|
16104
16691
|
{
|
|
16105
16692
|
"type": "button",
|
|
@@ -16107,15 +16694,22 @@ function getFormPagination(props, mode) {
|
|
|
16107
16694
|
"icon": `fa fa-angle-right`,
|
|
16108
16695
|
"level": "link",
|
|
16109
16696
|
"pageChangeDirection": "next",
|
|
16110
|
-
"disabledOn": showPagination ? "${__page >= __tableItems.length}" : "true",
|
|
16697
|
+
// "disabledOn": showPagination ? "${__page >= __tableItems.length}" : "true",
|
|
16698
|
+
// 这里用__super.parent,加__super是为了防止当前记录有字段名为parent的重名变量
|
|
16699
|
+
"disabledOn": showPagination ? "${__page >= (__super.parent ? COMPACT(__tableItems[__parentIndex]['children']).length : COMPACT(__tableItems).length)}" : "true",
|
|
16111
16700
|
"size": "sm",
|
|
16112
16701
|
"id": buttonNextId,
|
|
16113
16702
|
"onEvent": {
|
|
16114
16703
|
"click": {
|
|
16115
16704
|
"actions": [
|
|
16705
|
+
{
|
|
16706
|
+
"actionType": "validate",
|
|
16707
|
+
"componentId": formId
|
|
16708
|
+
},
|
|
16116
16709
|
{
|
|
16117
16710
|
"actionType": "custom",
|
|
16118
|
-
"script": onPageChangeScript
|
|
16711
|
+
"script": onPageChangeScript,
|
|
16712
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
16119
16713
|
}
|
|
16120
16714
|
]
|
|
16121
16715
|
}
|
|
@@ -16136,18 +16730,19 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16136
16730
|
// console.log("==getFormPaginationWrapper===", props, mode);
|
|
16137
16731
|
let serviceId = getComponentId("form_pagination", props.id);
|
|
16138
16732
|
let tableServiceId = getComponentId("table_service", props.id);
|
|
16733
|
+
let primaryKey = getTablePrimaryKey(props);
|
|
16139
16734
|
let innerForm = Object.assign({}, form, {
|
|
16140
16735
|
"data": {
|
|
16141
16736
|
// 这里加__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
|
|
16142
16737
|
// 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
|
|
16143
|
-
"&": "${__tableItems[__super.index]}"
|
|
16738
|
+
"&": "${__super.parent ? __tableItems[__parentIndex]['children'][__super.index] : __tableItems[__super.index]}"
|
|
16144
16739
|
}
|
|
16145
16740
|
});
|
|
16146
16741
|
let formBody = [
|
|
16147
16742
|
{
|
|
16148
16743
|
"type": "wrapper",
|
|
16149
16744
|
"size": "none",
|
|
16150
|
-
"className": "flex justify-end sticky top-0 right-0 left-0 z-20 bg-white
|
|
16745
|
+
"className": "flex justify-end sticky top-0 right-0 left-0 z-20 bg-white",
|
|
16151
16746
|
"body": [
|
|
16152
16747
|
getFormPagination(props, mode)
|
|
16153
16748
|
]
|
|
@@ -16163,7 +16758,7 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16163
16758
|
}
|
|
16164
16759
|
];
|
|
16165
16760
|
let onServiceInitedScript = `
|
|
16166
|
-
//
|
|
16761
|
+
// 以下脚本解决了有时弹出编辑表单时,表单中的值比最后一次编辑保存的值会延迟一拍。
|
|
16167
16762
|
// 比如:inlineEditMode模式时,用户在表格单元格中直接修改数据,然后弹出的表单form中并没有包含单元格中修改的内容
|
|
16168
16763
|
// 另外有的地方在非inlineEditMode模式时也会有这种延迟一拍问题,比如对象字段中下拉框类型字段的”选择项“属性
|
|
16169
16764
|
// 再比如工作流规则详细页面修改了子表字段”时间触发器“值后,在只读界面点击查看按钮弹出的表单中__tableItems值是修改前的值
|
|
@@ -16176,8 +16771,13 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16176
16771
|
// 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
16177
16772
|
// 这里如果不.clone的话,在弹出窗口中显示的子表组件,添加行后点窗口的取消按钮关闭窗口后无法把之前的操作还原,即把之前添加的行自动移除
|
|
16178
16773
|
let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"] || []);
|
|
16774
|
+
let fieldPrefix = "${props.fieldPrefix || ''}";
|
|
16775
|
+
if(fieldPrefix){
|
|
16776
|
+
let getTableValueWithoutFieldPrefix = new Function('v', 'f', "return (" + ${getTableValueWithoutFieldPrefix.toString()} + ")(v, f)");
|
|
16777
|
+
lastestFieldValue = getTableValueWithoutFieldPrefix(lastestFieldValue, fieldPrefix);
|
|
16778
|
+
}
|
|
16179
16779
|
//不可以直接像event.data.__tableItems = lastestFieldValue; 这样整个赋值,否则作用域会断
|
|
16180
|
-
let mode = "${mode}";
|
|
16780
|
+
let mode = "${mode || ''}";
|
|
16181
16781
|
if(mode === "new"){
|
|
16182
16782
|
// 点击子表组件底部新增按钮时新增一条空白行并自动翻页到新增行
|
|
16183
16783
|
// 注意点击弹出的子表行详细表单中的新增按钮不会进此service init事件函数中
|
|
@@ -16198,6 +16798,26 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16198
16798
|
event.data.__tableItems.forEach(function(n,i){
|
|
16199
16799
|
event.data.__tableItems[i] = lastestFieldValue[i];
|
|
16200
16800
|
});
|
|
16801
|
+
|
|
16802
|
+
var parent = event.data.parent;
|
|
16803
|
+
var fieldValue = event.data.__tableItems;
|
|
16804
|
+
if(parent){
|
|
16805
|
+
// 如果是子行,即在节点嵌套情况下,当前节点如果是children属性下的子节点时,则算出其所属父行的索引值
|
|
16806
|
+
var primaryKey = "${primaryKey}";
|
|
16807
|
+
event.data.__parentIndex = _.findIndex(fieldValue, function(item){
|
|
16808
|
+
return item[primaryKey] == parent[primaryKey];
|
|
16809
|
+
});
|
|
16810
|
+
if(event.data.__parentIndex < 0){
|
|
16811
|
+
let tableId = "${props.id}";
|
|
16812
|
+
let table = scope.getComponentById(tableId)
|
|
16813
|
+
// autoGeneratePrimaryKeyValue不为true的情况下,即子表组件input-table的pipeOut函数中会移除表单了子表字段的primaryKey字段值,
|
|
16814
|
+
// 此时行primaryKey字段值为空,但是pipeIn函数中已经为input-table自动生成过primaryKey字段值了,只是没有输出到表单字段值中而已
|
|
16815
|
+
// 所以上面从表单字段值中没找到__parentIndex,是因为此时行primaryKey字段值只经过pipeIn保存到table组件内而没有保存到tableService
|
|
16816
|
+
event.data.__parentIndex = _.findIndex(table.props.value, function(item){
|
|
16817
|
+
return item[primaryKey] == parent[primaryKey];
|
|
16818
|
+
});
|
|
16819
|
+
}
|
|
16820
|
+
}
|
|
16201
16821
|
`;
|
|
16202
16822
|
let schema = {
|
|
16203
16823
|
"type": "service",
|
|
@@ -16218,6 +16838,7 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16218
16838
|
// "body": formBody,
|
|
16219
16839
|
"data": {
|
|
16220
16840
|
"__page": "${index + 1}",
|
|
16841
|
+
"__parentIndex": null,//兼容节点嵌套情况,即节点中有children属性时,这里记录当前节点所属上层节点index,只支持向上找一层,不支持多层
|
|
16221
16842
|
// "__total": `\${${props.name}.length}`,
|
|
16222
16843
|
// "__total": "${__tableItems.length}",
|
|
16223
16844
|
// "__paginationServiceId": serviceId,
|
|
@@ -16244,6 +16865,7 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16244
16865
|
async function getForm(props, mode = "edit", formId) {
|
|
16245
16866
|
let formFields = getFormFields(props, mode);
|
|
16246
16867
|
let body = await getFormBody(null, formFields);
|
|
16868
|
+
let primaryKey = getTablePrimaryKey(props);
|
|
16247
16869
|
if (!formId) {
|
|
16248
16870
|
formId = getComponentId("form", props.id);
|
|
16249
16871
|
}
|
|
@@ -16262,10 +16884,41 @@ async function getForm(props, mode = "edit", formId) {
|
|
|
16262
16884
|
// 新增行弹出编辑行表单,在弹出之前已经不用先增加一行,因为在翻页service初始化的时候会判断mode为new时自动新增一行
|
|
16263
16885
|
let onEditItemSubmitScript = `
|
|
16264
16886
|
// let fieldValue = _.cloneDeep(event.data["${props.name}"]);
|
|
16887
|
+
let removeEmptyItems = function(items){
|
|
16888
|
+
let i = _.findIndex(items, function(item){
|
|
16889
|
+
return item === undefined
|
|
16890
|
+
});
|
|
16891
|
+
if(i > -1){
|
|
16892
|
+
items.splice(i, 1);
|
|
16893
|
+
removeEmptyItems(items);
|
|
16894
|
+
}
|
|
16895
|
+
}
|
|
16896
|
+
// 因为删除时只是把input-table组件中的行数据删除了,并没有把父层service中的行删除,所以__tableItems会有值为undefined的数据,需要移除掉
|
|
16897
|
+
// 不用event.data.__tableItems = _.compact(event.data.__tableItems)是因为会把__tableItems变量保存到表单中
|
|
16898
|
+
removeEmptyItems(event.data.__tableItems);
|
|
16265
16899
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
16266
16900
|
//这里加__super.__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
|
|
16267
16901
|
// 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
|
|
16268
|
-
fieldValue[event.data.__super.__super.index] = JSON.parse(JSON.stringify(event.data));
|
|
16902
|
+
// fieldValue[event.data.__super.__super.index] = JSON.parse(JSON.stringify(event.data));
|
|
16903
|
+
var currentIndex = event.data.__super.__super.index;
|
|
16904
|
+
var currentFormValues = JSON.parse(JSON.stringify(event.data));
|
|
16905
|
+
var parent = event.data.__super.__super.parent;
|
|
16906
|
+
var __parentIndex = event.data.__super.__super.__parentIndex;
|
|
16907
|
+
let uuidv4 = new Function("return (" + ${uuidv4.toString()} + ")()");
|
|
16908
|
+
var primaryKey = "${primaryKey}";
|
|
16909
|
+
if(parent){
|
|
16910
|
+
fieldValue[__parentIndex].children[currentIndex] = currentFormValues;
|
|
16911
|
+
// 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
|
|
16912
|
+
fieldValue[__parentIndex] = Object.assign({}, fieldValue[__parentIndex], {
|
|
16913
|
+
children: fieldValue[__parentIndex].children,
|
|
16914
|
+
__fix_rerender_after_children_modified_tag: new Date().getTime()
|
|
16915
|
+
});
|
|
16916
|
+
}
|
|
16917
|
+
else{
|
|
16918
|
+
// 这里currentFormValues中如果没有primaryKey字段值不用处理,因为组件的pipeIn/pipeOut中会为每行自动生成
|
|
16919
|
+
// 也不用担心复制行时_id会重复,因为点击复制按钮时已经处理过了
|
|
16920
|
+
fieldValue[currentIndex] = currentFormValues;
|
|
16921
|
+
}
|
|
16269
16922
|
doAction({
|
|
16270
16923
|
"componentId": "${props.id}",
|
|
16271
16924
|
"actionType": "setValue",
|
|
@@ -16361,13 +17014,14 @@ async function getForm(props, mode = "edit", formId) {
|
|
|
16361
17014
|
*/
|
|
16362
17015
|
async function getButtonActions(props, mode) {
|
|
16363
17016
|
let actions = [];
|
|
17017
|
+
let primaryKey = getTablePrimaryKey(props);
|
|
16364
17018
|
let formId = getComponentId("form", props.id);
|
|
16365
17019
|
let dialogId = getComponentId("dialog", props.id);
|
|
16366
17020
|
let buttonNextId = getComponentId("button_next", props.id);
|
|
16367
17021
|
let formPaginationId = getComponentId("form_pagination", props.id);
|
|
16368
17022
|
let parentFormData = "${__super.__super.__super.__super || {}}";
|
|
16369
17023
|
let amisVersion = getComparableAmisVersion();
|
|
16370
|
-
if(amisVersion < 3.6){
|
|
17024
|
+
if (amisVersion < 3.6) {
|
|
16371
17025
|
parentFormData = "${__super.__super || {}}";
|
|
16372
17026
|
}
|
|
16373
17027
|
if (mode == "new" || mode == "edit") {
|
|
@@ -16403,9 +17057,42 @@ async function getButtonActions(props, mode) {
|
|
|
16403
17057
|
// };
|
|
16404
17058
|
let onSaveAndNewItemScript = `
|
|
16405
17059
|
let scope = event.context.scoped;
|
|
17060
|
+
let removeEmptyItems = function(items){
|
|
17061
|
+
let i = _.findIndex(items, function(item){
|
|
17062
|
+
return item === undefined
|
|
17063
|
+
});
|
|
17064
|
+
if(i > -1){
|
|
17065
|
+
items.splice(i, 1);
|
|
17066
|
+
removeEmptyItems(items);
|
|
17067
|
+
}
|
|
17068
|
+
}
|
|
17069
|
+
// 因为删除时只是把input-table组件中的行数据删除了,并没有把父层service中的行删除,所以__tableItems会有值为undefined的数据,需要移除掉
|
|
17070
|
+
// 不用event.data.__tableItems = _.compact(event.data.__tableItems)是因为会把__tableItems变量保存到表单中
|
|
17071
|
+
removeEmptyItems(event.data.__tableItems);
|
|
16406
17072
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
16407
17073
|
// 新建一条空白行并保存到子表组件
|
|
16408
|
-
|
|
17074
|
+
var parent = event.data.__super.parent;
|
|
17075
|
+
var primaryKey = "${primaryKey}";
|
|
17076
|
+
var __parentIndex = parent && _.findIndex(fieldValue, function(item){
|
|
17077
|
+
return item[primaryKey] == parent[primaryKey];
|
|
17078
|
+
});
|
|
17079
|
+
if(parent && __parentIndex < 0){
|
|
17080
|
+
let tableId = "${props.id}";
|
|
17081
|
+
let table = scope.getComponentById(tableId)
|
|
17082
|
+
// autoGeneratePrimaryKeyValue不为true的情况下,即子表组件input-table的pipeOut函数中会移除表单了子表字段的primaryKey字段值,
|
|
17083
|
+
// 此时行primaryKey字段值为空,但是pipeIn函数中已经为input-table自动生成过primaryKey字段值了,只是没有输出到表单字段值中而已
|
|
17084
|
+
// 所以上面从表单字段值中没找到__parentIndex,是因为此时行primaryKey字段值只经过pipeIn保存到table组件内而没有保存到tableService
|
|
17085
|
+
__parentIndex = _.findIndex(table.props.value, function(item){
|
|
17086
|
+
return item[primaryKey] == parent[primaryKey];
|
|
17087
|
+
});
|
|
17088
|
+
}
|
|
17089
|
+
if(parent){
|
|
17090
|
+
fieldValue[__parentIndex].children.push({});
|
|
17091
|
+
// 这里实测不需要fieldValue[__parentIndex] = ... 来重写整个父行让子表回显,所以没加相关代码
|
|
17092
|
+
}
|
|
17093
|
+
else{
|
|
17094
|
+
fieldValue.push({});
|
|
17095
|
+
}
|
|
16409
17096
|
doAction({
|
|
16410
17097
|
"componentId": "${props.id}",
|
|
16411
17098
|
"actionType": "setValue",
|
|
@@ -16417,7 +17104,13 @@ async function getButtonActions(props, mode) {
|
|
|
16417
17104
|
let __paginationServiceId = "${formPaginationId}";
|
|
16418
17105
|
let __paginationData = scope.getComponentById(__paginationServiceId).getData();
|
|
16419
17106
|
event.data.index = __paginationData.index;
|
|
16420
|
-
|
|
17107
|
+
if(parent){
|
|
17108
|
+
event.data.__page = fieldValue[__parentIndex].children.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
17109
|
+
event.data.__parentIndex = __parentIndex; //执行下面的翻页按钮事件中依赖了__parentIndex值
|
|
17110
|
+
}
|
|
17111
|
+
else{
|
|
17112
|
+
event.data.__page = fieldValue.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
17113
|
+
}
|
|
16421
17114
|
// 触发翻页按钮事件,实现保存当前页数据并跳转到最后一行
|
|
16422
17115
|
scope.getComponentById(buttonNextId).props.dispatchEvent("click", event.data);
|
|
16423
17116
|
`;
|
|
@@ -16426,9 +17119,49 @@ async function getButtonActions(props, mode) {
|
|
|
16426
17119
|
let __formId = "${formId}";
|
|
16427
17120
|
// let newItem = JSON.parse(JSON.stringify(event.data));
|
|
16428
17121
|
let newItem = scope.getComponentById(__formId).getValues();//这里不可以用event.data,因为其拿到的是弹出表单时的初始值,不是用户实时填写的数据
|
|
17122
|
+
newItem = _.clone(newItem);
|
|
17123
|
+
let removeEmptyItems = function(items){
|
|
17124
|
+
let i = _.findIndex(items, function(item){
|
|
17125
|
+
return item === undefined
|
|
17126
|
+
});
|
|
17127
|
+
if(i > -1){
|
|
17128
|
+
items.splice(i, 1);
|
|
17129
|
+
removeEmptyItems(items);
|
|
17130
|
+
}
|
|
17131
|
+
}
|
|
17132
|
+
// 因为删除时只是把input-table组件中的行数据删除了,并没有把父层service中的行删除,所以__tableItems会有值为undefined的数据,需要移除掉
|
|
17133
|
+
// 不用event.data.__tableItems = _.compact(event.data.__tableItems)是因为会把__tableItems变量保存到表单中
|
|
17134
|
+
removeEmptyItems(event.data.__tableItems);
|
|
16429
17135
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
16430
17136
|
// 复制当前页数据到新建行并保存到子表组件
|
|
16431
|
-
fieldValue.push(newItem);
|
|
17137
|
+
// fieldValue.push(newItem);
|
|
17138
|
+
var parent = event.data.__super.parent;
|
|
17139
|
+
var primaryKey = "${primaryKey}";
|
|
17140
|
+
var __parentIndex = parent && _.findIndex(fieldValue, function(item){
|
|
17141
|
+
return item[primaryKey] == parent[primaryKey];
|
|
17142
|
+
});
|
|
17143
|
+
if(parent && __parentIndex < 0){
|
|
17144
|
+
let tableId = "${props.id}";
|
|
17145
|
+
let table = scope.getComponentById(tableId)
|
|
17146
|
+
// autoGeneratePrimaryKeyValue不为true的情况下,即子表组件input-table的pipeOut函数中会移除表单了子表字段的primaryKey字段值,
|
|
17147
|
+
// 此时行primaryKey字段值为空,但是pipeIn函数中已经为input-table自动生成过primaryKey字段值了,只是没有输出到表单字段值中而已
|
|
17148
|
+
// 所以上面从表单字段值中没找到__parentIndex,是因为此时行primaryKey字段值只经过pipeIn保存到table组件内而没有保存到tableService
|
|
17149
|
+
__parentIndex = _.findIndex(table.props.value, function(item){
|
|
17150
|
+
return item[primaryKey] == parent[primaryKey];
|
|
17151
|
+
});
|
|
17152
|
+
}
|
|
17153
|
+
if(newItem[primaryKey]){
|
|
17154
|
+
// 如果newItem已经有主键字段值,则重新生成新的主键值,否则会重复。
|
|
17155
|
+
let uuidv4 = new Function("return (" + ${uuidv4.toString()} + ")()");
|
|
17156
|
+
newItem[primaryKey] = uuidv4();
|
|
17157
|
+
}
|
|
17158
|
+
if(parent){
|
|
17159
|
+
fieldValue[__parentIndex].children.push(newItem);
|
|
17160
|
+
// 这里实测不需要fieldValue[__parentIndex] = ... 来重写整个父行让子表回显,所以没加相关代码
|
|
17161
|
+
}
|
|
17162
|
+
else{
|
|
17163
|
+
fieldValue.push(newItem);
|
|
17164
|
+
}
|
|
16432
17165
|
doAction({
|
|
16433
17166
|
"componentId": "${props.id}",
|
|
16434
17167
|
"actionType": "setValue",
|
|
@@ -16440,19 +17173,25 @@ async function getButtonActions(props, mode) {
|
|
|
16440
17173
|
let __paginationServiceId = "${formPaginationId}";
|
|
16441
17174
|
let __paginationData = scope.getComponentById(__paginationServiceId).getData();
|
|
16442
17175
|
event.data.index = __paginationData.index;
|
|
16443
|
-
|
|
17176
|
+
if(parent){
|
|
17177
|
+
event.data.__page = fieldValue[__parentIndex].children.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
17178
|
+
event.data.__parentIndex = __parentIndex; //执行下面的翻页按钮事件中依赖了__parentIndex值
|
|
17179
|
+
}
|
|
17180
|
+
else{
|
|
17181
|
+
event.data.__page = fieldValue.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
17182
|
+
}
|
|
16444
17183
|
// 触发翻页按钮事件,实现保存当前页数据并跳转到最后一行
|
|
16445
17184
|
scope.getComponentById(buttonNextId).props.dispatchEvent("click", event.data);
|
|
16446
17185
|
`;
|
|
16447
17186
|
let dialogButtons = [
|
|
16448
17187
|
{
|
|
16449
|
-
|
|
16450
|
-
|
|
16451
|
-
|
|
16452
|
-
|
|
17188
|
+
"type": "button",
|
|
17189
|
+
"label": "完成",
|
|
17190
|
+
"actionType": "confirm",
|
|
17191
|
+
"level": "primary"
|
|
16453
17192
|
}
|
|
16454
17193
|
];
|
|
16455
|
-
if(props.addable){
|
|
17194
|
+
if (props.addable) {
|
|
16456
17195
|
// 有新增行权限时额外添加新增和复制按钮
|
|
16457
17196
|
dialogButtons = [
|
|
16458
17197
|
{
|
|
@@ -16462,9 +17201,14 @@ async function getButtonActions(props, mode) {
|
|
|
16462
17201
|
"onEvent": {
|
|
16463
17202
|
"click": {
|
|
16464
17203
|
"actions": [
|
|
17204
|
+
{
|
|
17205
|
+
"actionType": "validate",
|
|
17206
|
+
"componentId": formId
|
|
17207
|
+
},
|
|
16465
17208
|
{
|
|
16466
17209
|
"actionType": "custom",
|
|
16467
|
-
"script": onSaveAndNewItemScript
|
|
17210
|
+
"script": onSaveAndNewItemScript,
|
|
17211
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
16468
17212
|
}
|
|
16469
17213
|
]
|
|
16470
17214
|
}
|
|
@@ -16477,9 +17221,14 @@ async function getButtonActions(props, mode) {
|
|
|
16477
17221
|
"onEvent": {
|
|
16478
17222
|
"click": {
|
|
16479
17223
|
"actions": [
|
|
17224
|
+
{
|
|
17225
|
+
"actionType": "validate",
|
|
17226
|
+
"componentId": formId
|
|
17227
|
+
},
|
|
16480
17228
|
{
|
|
16481
17229
|
"actionType": "custom",
|
|
16482
|
-
"script": onSaveAndCopyItemScript
|
|
17230
|
+
"script": onSaveAndCopyItemScript,
|
|
17231
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
16483
17232
|
}
|
|
16484
17233
|
]
|
|
16485
17234
|
}
|
|
@@ -16516,12 +17265,15 @@ async function getButtonActions(props, mode) {
|
|
|
16516
17265
|
"_master": "${_master}",
|
|
16517
17266
|
"global": "${global}",
|
|
16518
17267
|
"uiSchema": "${uiSchema}",
|
|
16519
|
-
"index": "${index}"
|
|
17268
|
+
"index": "${index}",//amis组件自带行索引,在节点嵌套情况下,当前节点如果是children属性下的子节点时,这里的index是当前节点在children中的索引,而不是外层父节点的index
|
|
17269
|
+
"parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
16520
17270
|
// "__tableItems": `\${${props.name}}`
|
|
16521
17271
|
// 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
|
|
16522
17272
|
// 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
|
|
16523
17273
|
// "__tableItems": `\${${props.name}|json|toJson}`
|
|
16524
|
-
|
|
17274
|
+
// 在节点嵌套情况下,当前节点正好是带children属性的节点的话,这里弹出的dialog映射到的会是children数组,这是amis目前的规则,
|
|
17275
|
+
// 所以这里加判断有children时,用__super.__super让映射到正确的作用域层,如果不加,则__tableItems取到的会是children数组,而不是整个子表组件的值
|
|
17276
|
+
"__tableItems": `\${((children ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
|
|
16525
17277
|
},
|
|
16526
17278
|
"actions": dialogButtons,
|
|
16527
17279
|
"onEvent": {
|
|
@@ -16544,35 +17296,39 @@ async function getButtonActions(props, mode) {
|
|
|
16544
17296
|
Object.assign(actionShowEditDialog.dialog, props.dialog);
|
|
16545
17297
|
}
|
|
16546
17298
|
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
|
-
`;
|
|
17299
|
+
// let onNewLineScript = `
|
|
17300
|
+
// let newItem = {};
|
|
17301
|
+
// if(event.data["${props.name}"]){
|
|
17302
|
+
// // let fieldValue = event.data.__tableItems;
|
|
17303
|
+
// // 这里不用__tableItems是因为新建的时候没有翻页,里面没有也不需要走__tableItems变量
|
|
17304
|
+
// // let fieldValue = _.clone(event.data["${props.name}"]);
|
|
17305
|
+
// let fieldValue = event.data["${props.name}"];
|
|
17306
|
+
// fieldValue.push(newItem);
|
|
17307
|
+
// doAction({
|
|
17308
|
+
// "componentId": "${props.id}",
|
|
17309
|
+
// "actionType": "setValue",
|
|
17310
|
+
// "args": {
|
|
17311
|
+
// "value": fieldValue
|
|
17312
|
+
// }
|
|
17313
|
+
// });
|
|
17314
|
+
// event.data.index = fieldValue.length - 1;
|
|
17315
|
+
// }
|
|
17316
|
+
// else{
|
|
17317
|
+
// // 这里不可以执行event.data["${props.name}"]=[newItem],数据域会断掉
|
|
17318
|
+
// doAction({
|
|
17319
|
+
// "componentId": "${props.id}",
|
|
17320
|
+
// "actionType": "setValue",
|
|
17321
|
+
// "args": {
|
|
17322
|
+
// "value": [newItem]
|
|
17323
|
+
// }
|
|
17324
|
+
// });
|
|
17325
|
+
// event.data.index = 1;
|
|
17326
|
+
// }
|
|
17327
|
+
// `;
|
|
17328
|
+
// let actionNewLine = {
|
|
17329
|
+
// "actionType": "custom",
|
|
17330
|
+
// "script": onNewLineScript
|
|
17331
|
+
// };
|
|
16576
17332
|
// 新增行时不需要在弹出编辑表单前先加一行,因为会在编辑表单所在service初始化时判断到是新增就自动增加一行,因为这里拿不到event.data.__tableItems,也无法变更其值
|
|
16577
17333
|
// actions = [actionNewLine, actionShowEditDialog];
|
|
16578
17334
|
actions = [actionShowEditDialog];
|
|
@@ -16607,15 +17363,20 @@ async function getButtonActions(props, mode) {
|
|
|
16607
17363
|
// 映射到中间变量__parentForm而不是直接用&展开映射是为了避免表单中字段名与作用域中变量重名
|
|
16608
17364
|
// "__parentForm": "${__super.__super || {}}",
|
|
16609
17365
|
"__parentForm": parentFormData,
|
|
17366
|
+
"_master": "${_master}",
|
|
16610
17367
|
"global": "${global}",
|
|
16611
17368
|
"uiSchema": "${uiSchema}",
|
|
16612
17369
|
"index": "${index}",
|
|
17370
|
+
"parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
16613
17371
|
// "__tableItems": `\${${props.name}}`
|
|
16614
17372
|
// 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
|
|
16615
17373
|
// 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
|
|
16616
17374
|
// "__tableItems": `\${${props.name}|json|toJson}`
|
|
16617
|
-
"__tableItems": `\${(
|
|
16618
|
-
|
|
17375
|
+
// "__tableItems": `\${((__super.parent ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
|
|
17376
|
+
// 在节点嵌套情况下,当前节点正好是带children属性的节点的话,这里弹出的dialog映射到的会是children数组,这是amis目前的规则,
|
|
17377
|
+
// 所以这里加判断有children时,用__super.__super让映射到正确的作用域层,如果不加,则__tableItems取到的会是children数组,而不是整个子表组件的值
|
|
17378
|
+
"__tableItems": `\${((children ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
|
|
17379
|
+
},
|
|
16619
17380
|
}
|
|
16620
17381
|
}
|
|
16621
17382
|
];
|
|
@@ -16630,8 +17391,40 @@ async function getButtonActions(props, mode) {
|
|
|
16630
17391
|
let wrapperServiceData = wrapperService.getData();
|
|
16631
17392
|
// 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
16632
17393
|
// 这里_.clone是因为字段设计布局设置分组这种弹出窗口中的子表组件,直接删除后,点取消无法还原
|
|
17394
|
+
// 也因为这里clone没有直接删除,所以弹出编辑表单提交事件中event.data.__tableItems中取到的值会有被删除的行数据为undefined
|
|
16633
17395
|
let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"]);
|
|
16634
|
-
|
|
17396
|
+
var currentIndex = event.data.index;
|
|
17397
|
+
var parent = event.data.__super.parent;
|
|
17398
|
+
var primaryKey = "${primaryKey}";
|
|
17399
|
+
var __parentIndex = parent && _.findIndex(lastestFieldValue, function(item){
|
|
17400
|
+
return item[primaryKey] == parent[primaryKey];
|
|
17401
|
+
});
|
|
17402
|
+
if(parent && __parentIndex < 0){
|
|
17403
|
+
let tableId = "${props.id}";
|
|
17404
|
+
let table = scope.getComponentById(tableId)
|
|
17405
|
+
// autoGeneratePrimaryKeyValue不为true的情况下,即子表组件input-table的pipeOut函数中会移除表单了子表字段的primaryKey字段值,
|
|
17406
|
+
// 此时行primaryKey字段值为空,但是pipeIn函数中已经为input-table自动生成过primaryKey字段值了,只是没有输出到表单字段值中而已
|
|
17407
|
+
// 所以上面从表单字段值中没找到__parentIndex,是因为此时行primaryKey字段值只经过pipeIn保存到table组件内而没有保存到tableService
|
|
17408
|
+
__parentIndex = _.findIndex(table.props.value, function(item){
|
|
17409
|
+
return item[primaryKey] == parent[primaryKey];
|
|
17410
|
+
});
|
|
17411
|
+
}
|
|
17412
|
+
if(parent){
|
|
17413
|
+
lastestFieldValue[__parentIndex].children.splice(currentIndex, 1);
|
|
17414
|
+
// 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
|
|
17415
|
+
lastestFieldValue[__parentIndex] = Object.assign({}, lastestFieldValue[__parentIndex], {
|
|
17416
|
+
children: lastestFieldValue[__parentIndex].children,
|
|
17417
|
+
__fix_rerender_after_children_modified_tag: new Date().getTime()
|
|
17418
|
+
});
|
|
17419
|
+
}
|
|
17420
|
+
else{
|
|
17421
|
+
lastestFieldValue.splice(currentIndex, 1);
|
|
17422
|
+
}
|
|
17423
|
+
let fieldPrefix = "${props.fieldPrefix || ''}";
|
|
17424
|
+
if(fieldPrefix){
|
|
17425
|
+
let getTableValueWithoutFieldPrefix = new Function('v', 'f', "return (" + ${getTableValueWithoutFieldPrefix.toString()} + ")(v, f)");
|
|
17426
|
+
lastestFieldValue = getTableValueWithoutFieldPrefix(lastestFieldValue, fieldPrefix);
|
|
17427
|
+
}
|
|
16635
17428
|
doAction({
|
|
16636
17429
|
"componentId": "${props.id}",
|
|
16637
17430
|
"actionType": "setValue",
|
|
@@ -16701,58 +17494,104 @@ async function getButtonView(props) {
|
|
|
16701
17494
|
|
|
16702
17495
|
async function getButtonDelete(props) {
|
|
16703
17496
|
return {
|
|
16704
|
-
"type": "button",
|
|
16705
|
-
"label": "",
|
|
16706
|
-
"icon": "fa fa-trash-alt",//不可以用fa-trash-o,因为设计字段布局界面中弹出的设置分组列表中显示不了这个图标
|
|
17497
|
+
"type": "dropdown-button",
|
|
16707
17498
|
"level": "link",
|
|
16708
|
-
"
|
|
16709
|
-
|
|
16710
|
-
|
|
17499
|
+
"icon": "fa fa-trash-alt",
|
|
17500
|
+
"size": "xs",
|
|
17501
|
+
"hideCaret": true,
|
|
17502
|
+
"closeOnClick": true,
|
|
17503
|
+
"body": [
|
|
17504
|
+
{
|
|
17505
|
+
"type": "wrapper",
|
|
17506
|
+
"size": "md",
|
|
17507
|
+
"className": "w-80",
|
|
17508
|
+
"body": [
|
|
17509
|
+
{
|
|
17510
|
+
"tpl": "确定要删除吗?",
|
|
17511
|
+
"type": "tpl"
|
|
17512
|
+
},
|
|
17513
|
+
{
|
|
17514
|
+
"type": "flex",
|
|
17515
|
+
"justify": "flex-end",
|
|
17516
|
+
"className": "mt-3",
|
|
17517
|
+
"items": [
|
|
17518
|
+
{
|
|
17519
|
+
"type": "button",
|
|
17520
|
+
"label": "取消",
|
|
17521
|
+
"className": "mr-2"
|
|
17522
|
+
},
|
|
17523
|
+
{
|
|
17524
|
+
"type": "button",
|
|
17525
|
+
"label": "删除",
|
|
17526
|
+
"level": "danger",
|
|
17527
|
+
"onEvent": {
|
|
17528
|
+
"click": {
|
|
17529
|
+
"actions": await getButtonActions(props, "delete")
|
|
17530
|
+
}
|
|
17531
|
+
}
|
|
17532
|
+
}
|
|
17533
|
+
]
|
|
17534
|
+
}
|
|
17535
|
+
]
|
|
16711
17536
|
}
|
|
16712
|
-
|
|
16713
|
-
}
|
|
17537
|
+
]
|
|
17538
|
+
}
|
|
16714
17539
|
}
|
|
16715
17540
|
|
|
17541
|
+
|
|
16716
17542
|
const getAmisInputTableSchema = async (props) => {
|
|
16717
17543
|
if (!props.id) {
|
|
16718
17544
|
props.id = "steedos_input_table_" + props.name + "_" + Math.random().toString(36).substr(2, 9);
|
|
16719
17545
|
}
|
|
17546
|
+
let primaryKey = getTablePrimaryKey(props);
|
|
17547
|
+
let showOperation = props.showOperation;
|
|
17548
|
+
if (showOperation !== false) {
|
|
17549
|
+
showOperation = true;
|
|
17550
|
+
}
|
|
17551
|
+
let fieldPrefix = props.fieldPrefix;
|
|
17552
|
+
let fields = props.fields || [];
|
|
17553
|
+
if (fieldPrefix) {
|
|
17554
|
+
fields = getTableFieldsWithoutFieldPrefix(fields, fieldPrefix);
|
|
17555
|
+
}
|
|
16720
17556
|
let serviceId = getComponentId("table_service", props.id);
|
|
16721
17557
|
let buttonsForColumnOperations = [];
|
|
16722
17558
|
let inlineEditMode = props.inlineEditMode;
|
|
16723
17559
|
let showAsInlineEditMode = inlineEditMode && props.editable;
|
|
16724
|
-
if (
|
|
16725
|
-
|
|
16726
|
-
|
|
16727
|
-
|
|
16728
|
-
|
|
16729
|
-
|
|
16730
|
-
|
|
16731
|
-
|
|
16732
|
-
|
|
16733
|
-
|
|
16734
|
-
|
|
16735
|
-
|
|
17560
|
+
if (showOperation) {
|
|
17561
|
+
if (props.editable) {
|
|
17562
|
+
let showEditButton = true;
|
|
17563
|
+
if (showAsInlineEditMode) {
|
|
17564
|
+
// 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
|
|
17565
|
+
showEditButton = true;
|
|
17566
|
+
// // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
|
|
17567
|
+
// if (props.columns && props.columns.length > 0 && props.columns.length < fields.length) {
|
|
17568
|
+
// showEditButton = true;
|
|
17569
|
+
// }
|
|
17570
|
+
// else {
|
|
17571
|
+
// showEditButton = false;
|
|
17572
|
+
// }
|
|
17573
|
+
}
|
|
17574
|
+
// 编辑时显示编辑按钮
|
|
17575
|
+
if (showEditButton) {
|
|
17576
|
+
let buttonEditSchema = await getButtonEdit(props, showAsInlineEditMode);
|
|
17577
|
+
buttonsForColumnOperations.push(buttonEditSchema);
|
|
17578
|
+
}
|
|
16736
17579
|
}
|
|
16737
|
-
|
|
16738
|
-
|
|
16739
|
-
|
|
16740
|
-
|
|
17580
|
+
else {
|
|
17581
|
+
// 只读时显示查看按钮
|
|
17582
|
+
// 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < fields.length)
|
|
17583
|
+
let buttonViewSchema = await getButtonView(props);
|
|
17584
|
+
buttonsForColumnOperations.push(buttonViewSchema);
|
|
17585
|
+
}
|
|
17586
|
+
if (props.removable) {
|
|
17587
|
+
let buttonDeleteSchema = await getButtonDelete(props);
|
|
17588
|
+
buttonsForColumnOperations.push(buttonDeleteSchema);
|
|
16741
17589
|
}
|
|
16742
17590
|
}
|
|
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
|
-
}
|
|
17591
|
+
let amis = props["input-table"] || props.amis || {};//额外支持"input-table"代替amis属性,是因为在字段yml文件中用amis作为key不好理解
|
|
16753
17592
|
let inputTableSchema = {
|
|
16754
17593
|
"type": "input-table",
|
|
16755
|
-
"
|
|
17594
|
+
"mode": "normal",
|
|
16756
17595
|
"name": props.name,
|
|
16757
17596
|
//不可以addable/editable/removable设置为true,因为会在原生的操作列显示操作按钮图标,此开关实测只控制这个按钮显示不会影响功能
|
|
16758
17597
|
// "addable": props.addable,
|
|
@@ -16767,7 +17606,53 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
16767
17606
|
"strictMode": props.strictMode,
|
|
16768
17607
|
"showTableAddBtn": false,
|
|
16769
17608
|
"showFooterAddBtn": false,
|
|
16770
|
-
"className": props.tableClassName
|
|
17609
|
+
"className": props.tableClassName,
|
|
17610
|
+
"pipeIn": (value, data) => {
|
|
17611
|
+
if (fieldPrefix) {
|
|
17612
|
+
value = getTableValueWithoutFieldPrefix(value, fieldPrefix);
|
|
17613
|
+
}
|
|
17614
|
+
value = getTableValueWithEmptyValue(value, fields);
|
|
17615
|
+
if (primaryKey) {
|
|
17616
|
+
// 这里临时给每行数据补上primaryKey字段值,如果库里不需要保存这里补上的字段值,pipeOut中会识别autoGeneratePrimaryKeyValue属性选择最终移除这里补上的字段值
|
|
17617
|
+
// 这里始终自动生成primaryKey字段值,而不是只在pipeOut输出整个子表字段值时才生成,是因为要支持当数据库里保存的子表字段行数据没有primaryKey字段值时的行嵌套模式(即节点的children属性)功能
|
|
17618
|
+
// 这里要注意,流程详细设置界面的字段设置功能中的子表组件中,数据库里保存的子表字段行数据是有primaryKey字段值的,它不依赖这里自动生成行primaryKey值功能
|
|
17619
|
+
value = getTableValueWithPrimaryKeyValue(value, primaryKey);
|
|
17620
|
+
}
|
|
17621
|
+
if (amis.pipeIn) {
|
|
17622
|
+
if (typeof amis.pipeIn === 'function') {
|
|
17623
|
+
return amis.pipeIn(value, data);
|
|
17624
|
+
}
|
|
17625
|
+
}
|
|
17626
|
+
return value;
|
|
17627
|
+
},
|
|
17628
|
+
"pipeOut": (value, data) => {
|
|
17629
|
+
value = (value || []).map(function (item) {
|
|
17630
|
+
delete item.__fix_rerender_after_children_modified_tag;
|
|
17631
|
+
return item;
|
|
17632
|
+
});
|
|
17633
|
+
if (fieldPrefix) {
|
|
17634
|
+
value = getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey);
|
|
17635
|
+
}
|
|
17636
|
+
value = getTableValueWithoutEmptyValue(value, fields);
|
|
17637
|
+
if (props.autoGeneratePrimaryKeyValue === true) {
|
|
17638
|
+
// 如果需要把自动生成的primaryKey值输出保存的库中,则补全所有行中的primaryKey值
|
|
17639
|
+
// 这里如果不全部补全的话,初始从库里返回的字段值中拿到的行没primaryKey值的话就不会自动补上
|
|
17640
|
+
value = getTableValueWithPrimaryKeyValue(value, primaryKey);
|
|
17641
|
+
}
|
|
17642
|
+
else {
|
|
17643
|
+
// 默认情况下,也就是没有配置autoGeneratePrimaryKey时,最终输出的字段值要移除行中的primaryKey值
|
|
17644
|
+
// 需要注意如果没有配置autoGeneratePrimaryKey时,因为每次弹出行编辑窗口保存后都会先后进入pipeOut和pipeIn,
|
|
17645
|
+
// 这里删除掉了primaryKey值,所以primaryKey值每次弹出编辑窗口保存后都会给每行重新生成新的primaryKey值
|
|
17646
|
+
// 只有autoGeneratePrimaryKey配置为true时,每行的primaryKey字段值才会始终保持不变
|
|
17647
|
+
value = getTableValueWithoutPrimaryKeyValue(value, primaryKey);
|
|
17648
|
+
}
|
|
17649
|
+
if (amis.pipeOut) {
|
|
17650
|
+
if (typeof amis.pipeOut === 'function') {
|
|
17651
|
+
return amis.pipeOut(value, data);
|
|
17652
|
+
}
|
|
17653
|
+
}
|
|
17654
|
+
return value;
|
|
17655
|
+
}
|
|
16771
17656
|
};
|
|
16772
17657
|
if (buttonsForColumnOperations.length) {
|
|
16773
17658
|
inputTableSchema.columns.push({
|
|
@@ -16777,20 +17662,22 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
16777
17662
|
"width": buttonsForColumnOperations.length > 1 ? "60px" : "20px"
|
|
16778
17663
|
});
|
|
16779
17664
|
}
|
|
16780
|
-
if (showAsInlineEditMode) {
|
|
16781
|
-
|
|
16782
|
-
|
|
16783
|
-
|
|
17665
|
+
// if (showAsInlineEditMode) {
|
|
17666
|
+
// // 因为要支持不同的列上配置inlineEditMode属性,所有不可以把整个子表组件都设置为inlineEditMode
|
|
17667
|
+
// inputTableSchema.needConfirm = false;
|
|
17668
|
+
// }
|
|
16784
17669
|
if (amis) {
|
|
16785
17670
|
// 支持配置amis属性重写或添加最终生成的input-table中任何属性。
|
|
16786
17671
|
delete amis.id;//如果steedos-input-table组件配置了amis.id属性,会造成新建编辑行功能不生效
|
|
17672
|
+
delete amis.pipeIn;//该属性在上面合并过了
|
|
17673
|
+
delete amis.pipeOut;//该属性在上面合并过了
|
|
16787
17674
|
Object.assign(inputTableSchema, amis);
|
|
16788
17675
|
}
|
|
16789
|
-
const isAnyFieldHasDependOn = (
|
|
17676
|
+
const isAnyFieldHasDependOn = (fields || []).find(function (item) {
|
|
16790
17677
|
return item.depend_on;
|
|
16791
17678
|
});
|
|
16792
17679
|
if (isAnyFieldHasDependOn) {
|
|
16793
|
-
// 有任意一个子字段有depend_on
|
|
17680
|
+
// 有任意一个子字段有depend_on属性时,强制设置禁用静态模式,因为strictMode模式下,dependOn的字段值变更后,不会rerender整个子表
|
|
16794
17681
|
Object.assign(inputTableSchema, {
|
|
16795
17682
|
strictMode: false
|
|
16796
17683
|
});
|
|
@@ -16819,11 +17706,31 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
16819
17706
|
"body": headerToolbar
|
|
16820
17707
|
});
|
|
16821
17708
|
}
|
|
17709
|
+
let className = "steedos-input-table";
|
|
17710
|
+
|
|
17711
|
+
if (typeof props.className == "object") {
|
|
17712
|
+
className = {
|
|
17713
|
+
[className]: "true",
|
|
17714
|
+
...props.className
|
|
17715
|
+
};
|
|
17716
|
+
} else if (typeof props.className == "string") {
|
|
17717
|
+
className = `${className} ${props.className} `;
|
|
17718
|
+
}
|
|
17719
|
+
|
|
16822
17720
|
let schema = {
|
|
16823
|
-
"type": "
|
|
16824
|
-
"body":
|
|
16825
|
-
|
|
16826
|
-
|
|
17721
|
+
"type": "control",
|
|
17722
|
+
"body": {
|
|
17723
|
+
"type": "service",
|
|
17724
|
+
"body": schemaBody,
|
|
17725
|
+
"id": serviceId
|
|
17726
|
+
},
|
|
17727
|
+
"label": props.label,
|
|
17728
|
+
"labelClassName": props.label ? props.labelClassName : "none",
|
|
17729
|
+
"labelRemark": props.labelRemark,
|
|
17730
|
+
"labelAlign": props.labelAlign,
|
|
17731
|
+
//控制control的mode属性,https://aisuda.bce.baidu.com/amis/zh-CN/components/form/formitem#表单项展示
|
|
17732
|
+
"mode": props.mode || null,
|
|
17733
|
+
className
|
|
16827
17734
|
};
|
|
16828
17735
|
// console.log("===schema===", schema);
|
|
16829
17736
|
return schema;
|
|
@@ -16895,7 +17802,7 @@ async function getListPageInitSchema(objectApiName, formFactor, userSession) {
|
|
|
16895
17802
|
// 获取
|
|
16896
17803
|
async function getRecordPageInitSchema(objectApiName){
|
|
16897
17804
|
const relatedList = await getObjectRelatedList(objectApiName);
|
|
16898
|
-
|
|
17805
|
+
await getUISchema(objectApiName);
|
|
16899
17806
|
let body = [
|
|
16900
17807
|
// detailHeaderAmisSchema,
|
|
16901
17808
|
{
|
|
@@ -16903,28 +17810,7 @@ async function getRecordPageInitSchema(objectApiName){
|
|
|
16903
17810
|
"label": "标题面板",
|
|
16904
17811
|
"objectApiName": "${objectName}",
|
|
16905
17812
|
"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
|
-
}
|
|
17813
|
+
"onEvent": {}
|
|
16928
17814
|
}
|
|
16929
17815
|
];
|
|
16930
17816
|
let contentBody = {
|
|
@@ -19557,9 +20443,11 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
|
|
|
19557
20443
|
getObjectRelatedList: getObjectRelatedList,
|
|
19558
20444
|
getObjectRelatedListButtons: getObjectRelatedListButtons,
|
|
19559
20445
|
getObjectRelatedListHeader: getObjectRelatedListHeader,
|
|
20446
|
+
getObjectRelatedListsMiniSchema: getObjectRelatedListsMiniSchema,
|
|
19560
20447
|
getPage: getPage,
|
|
19561
20448
|
getRecord: getRecord,
|
|
19562
20449
|
getRecordDetailHeaderSchema: getRecordDetailHeaderSchema,
|
|
20450
|
+
getRecordDetailMiniSchema: getRecordDetailMiniSchema,
|
|
19563
20451
|
getRecordDetailRelatedListSchema: getRecordDetailRelatedListSchema,
|
|
19564
20452
|
getRecordDetailSchema: getRecordDetailSchema,
|
|
19565
20453
|
getRecordPageInitSchema: getRecordPageInitSchema,
|
|
@@ -19741,10 +20629,11 @@ var AmisObjectFieldLookup = function (props) {
|
|
|
19741
20629
|
};
|
|
19742
20630
|
|
|
19743
20631
|
var AmisObjectButton = function (props) {
|
|
19744
|
-
|
|
20632
|
+
var _a;
|
|
20633
|
+
// console.log(`AmisObjectButton=====》`, props)
|
|
19745
20634
|
var objectName = props.objectName, name = props.name, data = props.data, render = props.render, className = props.className, listViewId = props.listViewId;
|
|
19746
|
-
var
|
|
19747
|
-
var
|
|
20635
|
+
var _b = __read(React.useState(), 2), button = _b[0], setButton = _b[1];
|
|
20636
|
+
var _c = __read(React.useState(), 2), uiSchema = _c[0], setUiSchema = _c[1];
|
|
19748
20637
|
//TODO 处理上下文参数
|
|
19749
20638
|
var appId = data.appId;
|
|
19750
20639
|
var formFactor = data.formFactor;
|
|
@@ -19813,6 +20702,7 @@ var AmisObjectButton = function (props) {
|
|
|
19813
20702
|
}
|
|
19814
20703
|
if (renderData) {
|
|
19815
20704
|
delete renderData.event;
|
|
20705
|
+
(_a = renderData.record) === null || _a === void 0 ? true : delete _a.event;
|
|
19816
20706
|
}
|
|
19817
20707
|
schema.data = _$1.defaultsDeep({}, renderData, getDefaultRenderData(), schema.data);
|
|
19818
20708
|
delete schema.data.event;
|
|
@@ -20018,11 +20908,11 @@ var SteedosSkeleton = function (props) {
|
|
|
20018
20908
|
};
|
|
20019
20909
|
|
|
20020
20910
|
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 (
|
|
20911
|
+
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;
|
|
20912
|
+
return __generator(this, function (_f) {
|
|
20913
|
+
switch (_f.label) {
|
|
20024
20914
|
case 0:
|
|
20025
|
-
$schema = props.$schema, recordId = props.recordId, defaultData = props.defaultData, mode = props.mode,
|
|
20915
|
+
$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
20916
|
objectApiName = props.objectApiName || "space_users";
|
|
20027
20917
|
schemaKeys = _$1.difference(_$1.keys($schema), ["id", "form", "type", "mode", "layout", "defaultData", "formDataFilter", "onFormDataFilter", "env"]);
|
|
20028
20918
|
formSchema = _$1.pick(props, schemaKeys);
|
|
@@ -20069,7 +20959,7 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
20069
20959
|
env: env
|
|
20070
20960
|
}))];
|
|
20071
20961
|
case 1:
|
|
20072
|
-
schema =
|
|
20962
|
+
schema = _f.sent();
|
|
20073
20963
|
amisSchema = schema.amisSchema;
|
|
20074
20964
|
uiSchema = schema.uiSchema;
|
|
20075
20965
|
return [3 /*break*/, 4];
|
|
@@ -20088,10 +20978,10 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
20088
20978
|
env: env
|
|
20089
20979
|
}))];
|
|
20090
20980
|
case 3:
|
|
20091
|
-
schema =
|
|
20981
|
+
schema = _f.sent();
|
|
20092
20982
|
amisSchema = schema.amisSchema;
|
|
20093
20983
|
uiSchema = schema.uiSchema;
|
|
20094
|
-
|
|
20984
|
+
_f.label = 4;
|
|
20095
20985
|
case 4:
|
|
20096
20986
|
formData = {};
|
|
20097
20987
|
// formData.recordId = recordId || null;
|
|
@@ -20102,7 +20992,8 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
20102
20992
|
formData.recordId = props.recordId;
|
|
20103
20993
|
}
|
|
20104
20994
|
amisSchema.className = "steedos-object-form ".concat(className);
|
|
20105
|
-
|
|
20995
|
+
// console.log('AmisObjectForm amisSchema======>', amisSchema)
|
|
20996
|
+
amisSchema.data = Object.assign({}, amisSchema.data || {}, formData, { global: globalData, uiSchema: uiSchema });
|
|
20106
20997
|
if (_$1.has(props, 'objectApiName')) {
|
|
20107
20998
|
amisSchema.data.objectName = objectApiName;
|
|
20108
20999
|
}
|
|
@@ -20258,7 +21149,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
20258
21149
|
type: "service",
|
|
20259
21150
|
data: serviceData,
|
|
20260
21151
|
style: style,
|
|
20261
|
-
className: "".concat(className, " sm:bg-gray-
|
|
21152
|
+
className: "".concat(className, " sm:bg-gray-50 h-full steedos-object-listview ").concat(displayAs === 'split' ? 'sm:border-r' : 'sm:border-r'),
|
|
20262
21153
|
body: [{
|
|
20263
21154
|
"type": "wrapper",
|
|
20264
21155
|
"size": "none",
|
|
@@ -20281,7 +21172,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
20281
21172
|
{
|
|
20282
21173
|
"type": "service",
|
|
20283
21174
|
"id": "service_schema_api_" + objectApiName,
|
|
20284
|
-
"className": " steedos-object-listview-content grow",
|
|
21175
|
+
"className": " steedos-object-listview-content md:overflow-auto grow",
|
|
20285
21176
|
"schemaApi": {
|
|
20286
21177
|
// 这里url上加objectApiName属性是因为设计器中切换对象时不会变更列表视图界面,不可以用objectName=${objectName}使用作用域中objectName变量是因为设计器那边不会监听识别data变化来render组件
|
|
20287
21178
|
"url": "${context.rootUrl}/graphql?objectName=" + objectApiName + "&listName=${listName}&display=${display}&rebuildOn=" + rebuildOn,
|
|
@@ -20291,7 +21182,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
20291
21182
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
20292
21183
|
},
|
|
20293
21184
|
"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
|
|
21185
|
+
"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
21186
|
},
|
|
20296
21187
|
// "body": body,
|
|
20297
21188
|
// "data": serviceData
|
|
@@ -20449,34 +21340,18 @@ var AmisObjectCalendar = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
20449
21340
|
}); };
|
|
20450
21341
|
|
|
20451
21342
|
var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
20452
|
-
var _a, className, schemaFilter,
|
|
21343
|
+
var _a, className, schemaFilter, showButtons, showBackButton, defaultOnEvent, recordId, _b, onEvent, _c, showRecordTitle, objectApiName, schema, config, schemaFilterFun, _config, e_1;
|
|
20453
21344
|
return __generator(this, function (_d) {
|
|
20454
21345
|
switch (_d.label) {
|
|
20455
21346
|
case 0:
|
|
20456
|
-
_a = props.className, className = _a === void 0 ? 'sm:sticky top-0 z-10
|
|
21347
|
+
_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
21348
|
return [4 /*yield*/, getUISchema(props.objectApiName || "space_users", false)];
|
|
20458
21349
|
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
|
-
};
|
|
21350
|
+
_d.sent();
|
|
21351
|
+
defaultOnEvent = {};
|
|
20477
21352
|
props.$schema, recordId = props.recordId, _b = props.onEvent, onEvent = _b === void 0 ? defaultOnEvent : _b, _c = props.showRecordTitle, showRecordTitle = _c === void 0 ? true : _c;
|
|
20478
21353
|
objectApiName = props.objectApiName || "space_users";
|
|
20479
|
-
return [4 /*yield*/, getRecordDetailHeaderSchema(objectApiName, recordId, { showRecordTitle: showRecordTitle, formFactor: props.data.formFactor })];
|
|
21354
|
+
return [4 /*yield*/, getRecordDetailHeaderSchema(objectApiName, recordId, { showRecordTitle: showRecordTitle, formFactor: props.data.formFactor, showButtons: showButtons, showBackButton: showBackButton, display: props.data.display })];
|
|
20480
21355
|
case 2:
|
|
20481
21356
|
schema = (_d.sent()).amisSchema;
|
|
20482
21357
|
schema.className = className;
|
|
@@ -20495,18 +21370,20 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
|
|
|
20495
21370
|
e_1 = _d.sent();
|
|
20496
21371
|
console.warn(e_1);
|
|
20497
21372
|
return [3 /*break*/, 6];
|
|
20498
|
-
case 6:
|
|
21373
|
+
case 6:
|
|
21374
|
+
// console.log(`AmisRecordDetailHeader==>`, config)
|
|
21375
|
+
return [2 /*return*/, config];
|
|
20499
21376
|
}
|
|
20500
21377
|
});
|
|
20501
21378
|
}); };
|
|
20502
21379
|
|
|
20503
21380
|
var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
20504
|
-
var className, $schema, appId, _a, objectApiName, body, schema;
|
|
21381
|
+
var className, $schema, appId, _a, objectApiName, body, showButtons, showBackButton, schema;
|
|
20505
21382
|
return __generator(this, function (_b) {
|
|
20506
21383
|
switch (_b.label) {
|
|
20507
21384
|
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)];
|
|
21385
|
+
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;
|
|
21386
|
+
return [4 /*yield*/, getRecordDetailSchema(objectApiName, appId, { showButtons: showButtons, showBackButton: showBackButton })];
|
|
20510
21387
|
case 1:
|
|
20511
21388
|
schema = (_b.sent()).amisSchema;
|
|
20512
21389
|
// 在非记录页组件下全局作用域下无recordId,会导致表单接口sendOn始终为false,无法发起请求。
|
|
@@ -20516,8 +21393,17 @@ var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
20516
21393
|
// }
|
|
20517
21394
|
// schema.data = Object.assign({}, schema.data, recordDetailData);
|
|
20518
21395
|
if (_$1.has(props, "recordId") && $schema.recordId !== "${recordId}") {
|
|
21396
|
+
if (!schema.data) {
|
|
21397
|
+
schema.data = {};
|
|
21398
|
+
}
|
|
20519
21399
|
schema.data.recordId = props.recordId;
|
|
20520
21400
|
}
|
|
21401
|
+
if (_$1.has(props, "objectApiName") && props.objectApiName && $schema.objectApiName !== "${objectName}") {
|
|
21402
|
+
if (!schema.data) {
|
|
21403
|
+
schema.data = {};
|
|
21404
|
+
}
|
|
21405
|
+
schema.data.objectName = props.objectApiName;
|
|
21406
|
+
}
|
|
20521
21407
|
schema.className = className;
|
|
20522
21408
|
if (body) {
|
|
20523
21409
|
schema.body = body;
|
|
@@ -20531,28 +21417,39 @@ var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
20531
21417
|
/*
|
|
20532
21418
|
* @Author: baozhoutao@steedos.com
|
|
20533
21419
|
* @Date: 2022-12-08 10:32:17
|
|
20534
|
-
* @LastEditors:
|
|
20535
|
-
* @LastEditTime:
|
|
21420
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
21421
|
+
* @LastEditTime: 2024-01-16 14:09:23
|
|
20536
21422
|
* @Description:
|
|
20537
21423
|
*/
|
|
20538
21424
|
var AmisRecordService = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
20539
|
-
var className, _a, objectApiName, body, style, schema;
|
|
21425
|
+
var className, $schema, appId, _a, objectApiName, body, style, recordId, options, schema;
|
|
20540
21426
|
return __generator(this, function (_b) {
|
|
20541
21427
|
switch (_b.label) {
|
|
20542
21428
|
case 0:
|
|
20543
|
-
className = props.className, props.$schema, props.appId, _a = props.objectApiName, objectApiName = _a === void 0 ? "space_users" : _a, props.
|
|
20544
|
-
|
|
21429
|
+
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;
|
|
21430
|
+
if (_$1.has($schema.data, "recordId") && $schema.data.recordId !== "${recordId}") {
|
|
21431
|
+
recordId = $schema.data.recordId;
|
|
21432
|
+
}
|
|
21433
|
+
if (_$1.has($schema.data, "objectName") && $schema.data.objectName !== "${objectName}") {
|
|
21434
|
+
objectApiName = $schema.data.objectName;
|
|
21435
|
+
}
|
|
21436
|
+
options = { onEvent: $schema.onEvent, data: $schema.data, recordId: recordId };
|
|
21437
|
+
if (props.$$editor) {
|
|
21438
|
+
options.isEditor = true;
|
|
21439
|
+
}
|
|
21440
|
+
return [4 /*yield*/, getRecordServiceSchema(objectApiName, appId, options, body)];
|
|
20545
21441
|
case 1:
|
|
20546
21442
|
schema = (_b.sent()).amisSchema;
|
|
20547
|
-
if (body) {
|
|
20548
|
-
schema.body = body;
|
|
20549
|
-
}
|
|
20550
21443
|
if (className) {
|
|
20551
21444
|
schema.className = className;
|
|
20552
21445
|
}
|
|
20553
21446
|
if (style) {
|
|
21447
|
+
if (!schema.style) {
|
|
21448
|
+
schema.style = {};
|
|
21449
|
+
}
|
|
20554
21450
|
Object.assign(schema.style, style);
|
|
20555
21451
|
}
|
|
21452
|
+
// console.log(`AmisRecordService====schema==>`, schema)
|
|
20556
21453
|
return [2 /*return*/, schema];
|
|
20557
21454
|
}
|
|
20558
21455
|
});
|
|
@@ -20609,7 +21506,7 @@ var AmisRecordDetailRelatedList = function (props) { return __awaiter(void 0, vo
|
|
|
20609
21506
|
}); };
|
|
20610
21507
|
|
|
20611
21508
|
var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
20612
|
-
var $schema, objectApiName, recordId, _a, perPage, relatedLists, staticRecordId;
|
|
21509
|
+
var $schema, objectApiName, recordId, _a, perPage, formFactor, relatedLists, staticRecordId;
|
|
20613
21510
|
return __generator(this, function (_b) {
|
|
20614
21511
|
switch (_b.label) {
|
|
20615
21512
|
case 0:
|
|
@@ -20624,7 +21521,10 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
|
|
|
20624
21521
|
"className": "mb-3"
|
|
20625
21522
|
}];
|
|
20626
21523
|
}
|
|
20627
|
-
props.formFactor;
|
|
21524
|
+
formFactor = props.formFactor;
|
|
21525
|
+
if (!formFactor) {
|
|
21526
|
+
formFactor = window.innerWidth < 768 ? 'SMALL' : 'LARGE';
|
|
21527
|
+
}
|
|
20628
21528
|
return [4 /*yield*/, getObjectRelatedList(objectApiName)];
|
|
20629
21529
|
case 1:
|
|
20630
21530
|
relatedLists = _b.sent();
|
|
@@ -20637,11 +21537,12 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
|
|
|
20637
21537
|
"className": "mb-3"
|
|
20638
21538
|
}];
|
|
20639
21539
|
}
|
|
20640
|
-
staticRecordId =
|
|
21540
|
+
staticRecordId = props.staticRecordId;
|
|
20641
21541
|
// 在设计器中的设计状态,当上层有recordId具体值,相关表组件的$schema.recordId的默认值就是 "${recordId}"; 会导致获取不到 _master, 进而导致组件显示不了数据。
|
|
20642
21542
|
if (_$1.has(props, "recordId") && ($schema.recordId !== "${recordId}" || (props.$$editor && props.recordId !== "${recordId}"))) {
|
|
20643
21543
|
staticRecordId = recordId;
|
|
20644
21544
|
}
|
|
21545
|
+
// console.log('relatedLists======>', relatedLists, staticRecordId)
|
|
20645
21546
|
return [2 /*return*/, {
|
|
20646
21547
|
type: 'service',
|
|
20647
21548
|
className: "steedos-record-detail-related-lists",
|
|
@@ -20650,6 +21551,7 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
|
|
|
20650
21551
|
type: 'steedos-object-related-listview',
|
|
20651
21552
|
objectApiName: objectApiName,
|
|
20652
21553
|
// recordId: recordId,
|
|
21554
|
+
formFactor: formFactor,
|
|
20653
21555
|
relatedObjectApiName: item.object_name,
|
|
20654
21556
|
foreign_key: item.foreign_key,
|
|
20655
21557
|
relatedKey: item.foreign_key,
|
|
@@ -20664,6 +21566,7 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
|
|
|
20664
21566
|
if (staticRecordId) {
|
|
20665
21567
|
relatedList.recordId = staticRecordId;
|
|
20666
21568
|
}
|
|
21569
|
+
// console.log('relatedList=====>', relatedList)
|
|
20667
21570
|
return relatedList;
|
|
20668
21571
|
})
|
|
20669
21572
|
}];
|
|
@@ -21176,7 +22079,7 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21176
22079
|
* @Author: baozhoutao@steedos.com
|
|
21177
22080
|
* @Date: 2022-09-01 14:44:57
|
|
21178
22081
|
* @LastEditors: baozhoutao@steedos.com
|
|
21179
|
-
* @LastEditTime:
|
|
22082
|
+
* @LastEditTime: 2024-01-31 14:43:14
|
|
21180
22083
|
* @Description:
|
|
21181
22084
|
*/
|
|
21182
22085
|
var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -21224,33 +22127,108 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
21224
22127
|
"label": instance.t('frontend_help')
|
|
21225
22128
|
},
|
|
21226
22129
|
{
|
|
21227
|
-
"type": "button",
|
|
21228
|
-
"
|
|
21229
|
-
"
|
|
21230
|
-
|
|
21231
|
-
|
|
21232
|
-
|
|
21233
|
-
|
|
21234
|
-
|
|
21235
|
-
|
|
21236
|
-
|
|
21237
|
-
|
|
22130
|
+
"type": "dropdown-button",
|
|
22131
|
+
"label": false,
|
|
22132
|
+
"trigger": "click",
|
|
22133
|
+
"level": "link",
|
|
22134
|
+
"btnClassName": "p-0 m-0",
|
|
22135
|
+
"icon": "fa fa-cog text-xl slds-button_icon m-0",
|
|
22136
|
+
"align": "right",
|
|
22137
|
+
"hideCaret": true,
|
|
22138
|
+
"buttons": [
|
|
22139
|
+
{
|
|
22140
|
+
"type": "button",
|
|
22141
|
+
"hiddenOn": "window.innerWidth < 768",
|
|
22142
|
+
"onEvent": {
|
|
22143
|
+
"click": {
|
|
22144
|
+
"actions": [
|
|
22145
|
+
{
|
|
22146
|
+
"args": {
|
|
22147
|
+
"url": "/app/admin"
|
|
22148
|
+
},
|
|
22149
|
+
"actionType": "url"
|
|
22150
|
+
}
|
|
22151
|
+
]
|
|
21238
22152
|
}
|
|
21239
|
-
|
|
21240
|
-
|
|
21241
|
-
|
|
21242
|
-
|
|
21243
|
-
|
|
22153
|
+
},
|
|
22154
|
+
"id": "u:b5d0ab3a32b5",
|
|
22155
|
+
"level": "link",
|
|
22156
|
+
"label": instance.t('frontend_setup')
|
|
22157
|
+
},
|
|
22158
|
+
// {
|
|
22159
|
+
// "type": "divider",
|
|
22160
|
+
// "className": "m-0",
|
|
22161
|
+
// "visibleOn": "${window:Meteor.settings.public.enable_saas != true && global.user.is_space_admin == true}"
|
|
22162
|
+
// },
|
|
21244
22163
|
{
|
|
21245
|
-
"type": "
|
|
21246
|
-
"
|
|
21247
|
-
"
|
|
21248
|
-
"
|
|
21249
|
-
|
|
21250
|
-
|
|
22164
|
+
"type": "button",
|
|
22165
|
+
"label": "编辑对象",
|
|
22166
|
+
"className": "flex",
|
|
22167
|
+
"onEvent": {
|
|
22168
|
+
"click": {
|
|
22169
|
+
"actions": [
|
|
22170
|
+
{
|
|
22171
|
+
"actionType": "ajax",
|
|
22172
|
+
"outputVar": "responseResult",
|
|
22173
|
+
"args": {
|
|
22174
|
+
"api": {
|
|
22175
|
+
"url": "/api/v1/objects/search",
|
|
22176
|
+
"data": {
|
|
22177
|
+
"filters": ["name", "=", "${window:FlowRouter|routerParams|pick:object_name}"],
|
|
22178
|
+
"fields": ["_id"]
|
|
22179
|
+
},
|
|
22180
|
+
"method": "post",
|
|
22181
|
+
"messages": {}
|
|
22182
|
+
}
|
|
22183
|
+
}
|
|
22184
|
+
},
|
|
22185
|
+
{
|
|
22186
|
+
"args": {
|
|
22187
|
+
"url": "/app/admin/objects/view/${responseResult.items[0]._id}",
|
|
22188
|
+
},
|
|
22189
|
+
"actionType": "url"
|
|
22190
|
+
}
|
|
22191
|
+
]
|
|
22192
|
+
}
|
|
22193
|
+
},
|
|
22194
|
+
"level": "link",
|
|
22195
|
+
"visibleOn": "${window:Meteor.settings.public.enable_saas != true && global.user.is_space_admin == true && window:FlowRouter|isObjectRouter}"
|
|
22196
|
+
},
|
|
22197
|
+
{
|
|
22198
|
+
"type": "button",
|
|
22199
|
+
"label": "编辑页面",
|
|
22200
|
+
"className": "flex",
|
|
22201
|
+
"onEvent": {
|
|
22202
|
+
"click": {
|
|
22203
|
+
"actions": [
|
|
22204
|
+
{
|
|
22205
|
+
"actionType": "ajax",
|
|
22206
|
+
"outputVar": "responseResult",
|
|
22207
|
+
"args": {
|
|
22208
|
+
"api": {
|
|
22209
|
+
"url": "/api/v1/pages/search",
|
|
22210
|
+
"data": {
|
|
22211
|
+
"filters": ["name", "=", "${window:FlowRouter|routerParams|pick:page_id}"],
|
|
22212
|
+
"fields": ["_id"]
|
|
22213
|
+
},
|
|
22214
|
+
"method": "post",
|
|
22215
|
+
"messages": {}
|
|
22216
|
+
}
|
|
22217
|
+
}
|
|
22218
|
+
},
|
|
22219
|
+
{
|
|
22220
|
+
"args": {
|
|
22221
|
+
"url": "/app/admin/pages/view/${responseResult.items[0]._id}"
|
|
22222
|
+
},
|
|
22223
|
+
"actionType": "url"
|
|
22224
|
+
}
|
|
22225
|
+
]
|
|
22226
|
+
}
|
|
22227
|
+
},
|
|
22228
|
+
"level": "link",
|
|
22229
|
+
"visibleOn": "${window:Meteor.settings.public.enable_saas != true && global.user.is_space_admin == true && window:FlowRouter|isPageRouter}"
|
|
21251
22230
|
}
|
|
21252
|
-
]
|
|
21253
|
-
"label": instance.t('frontend_setup')
|
|
22231
|
+
]
|
|
21254
22232
|
},
|
|
21255
22233
|
{
|
|
21256
22234
|
"type": "steedos-dropdown",
|
|
@@ -21507,6 +22485,26 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
21507
22485
|
},
|
|
21508
22486
|
"level": "link"
|
|
21509
22487
|
},
|
|
22488
|
+
{
|
|
22489
|
+
"type": "button",
|
|
22490
|
+
"label": instance.t('switch_space'),
|
|
22491
|
+
"className": "flex",
|
|
22492
|
+
"onEvent": {
|
|
22493
|
+
"click": {
|
|
22494
|
+
"actions": [
|
|
22495
|
+
{
|
|
22496
|
+
"args": {
|
|
22497
|
+
"url": "/accounts/a/#/select-space",
|
|
22498
|
+
"blank": false
|
|
22499
|
+
},
|
|
22500
|
+
"actionType": "url"
|
|
22501
|
+
}
|
|
22502
|
+
]
|
|
22503
|
+
}
|
|
22504
|
+
},
|
|
22505
|
+
"level": "link",
|
|
22506
|
+
"visibleOn": "${window:Meteor.settings.public.enable_saas}"
|
|
22507
|
+
},
|
|
21510
22508
|
{
|
|
21511
22509
|
"type": "button",
|
|
21512
22510
|
"label": instance.t('frontend_about'),
|
|
@@ -21558,14 +22556,14 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
21558
22556
|
/*
|
|
21559
22557
|
* @Author: baozhoutao@steedos.com
|
|
21560
22558
|
* @Date: 2022-09-01 14:44:57
|
|
21561
|
-
* @LastEditors:
|
|
21562
|
-
* @LastEditTime: 2024-01-
|
|
22559
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
22560
|
+
* @LastEditTime: 2024-01-16 13:45:42
|
|
21563
22561
|
* @Description:
|
|
21564
22562
|
*/
|
|
21565
22563
|
var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
21566
|
-
var logoSrc, isMobile, schema;
|
|
22564
|
+
var logoSrc, customButtons, isMobile, schema;
|
|
21567
22565
|
return __generator(this, function (_a) {
|
|
21568
|
-
logoSrc = props.logoSrc;
|
|
22566
|
+
logoSrc = props.logoSrc, customButtons = props.customButtons;
|
|
21569
22567
|
isMobile = window.innerWidth <= 768;
|
|
21570
22568
|
schema = {
|
|
21571
22569
|
"type": "wrapper",
|
|
@@ -21656,39 +22654,7 @@ var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21656
22654
|
"label": "Global Header",
|
|
21657
22655
|
className: 'flex flex-nowrap gap-x-3 items-center',
|
|
21658
22656
|
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
|
-
]
|
|
22657
|
+
customButtons: customButtons
|
|
21692
22658
|
}
|
|
21693
22659
|
],
|
|
21694
22660
|
},
|
|
@@ -21804,13 +22770,13 @@ function getAmisStaticFieldType(type, data_type, options) {
|
|
|
21804
22770
|
return "switch";
|
|
21805
22771
|
}
|
|
21806
22772
|
else if (type === 'currency') {
|
|
21807
|
-
return "number";
|
|
22773
|
+
return "input-number";
|
|
21808
22774
|
}
|
|
21809
22775
|
else if (type === 'autonumber') {
|
|
21810
22776
|
return "input-text"; //不可以用text,因为会出现字段label显示不出来的问题
|
|
21811
22777
|
}
|
|
21812
22778
|
else if (type === 'percent') {
|
|
21813
|
-
return "number";
|
|
22779
|
+
return "input-number";
|
|
21814
22780
|
}
|
|
21815
22781
|
else if (type === 'formula' || type === 'summary') {
|
|
21816
22782
|
return getAmisStaticFieldType(data_type, null, options);
|
|
@@ -21824,17 +22790,20 @@ function getAmisStaticFieldType(type, data_type, options) {
|
|
|
21824
22790
|
}
|
|
21825
22791
|
return "static-image";
|
|
21826
22792
|
}
|
|
22793
|
+
else if (type === 'textarea') {
|
|
22794
|
+
return 'static';
|
|
22795
|
+
}
|
|
21827
22796
|
return type;
|
|
21828
22797
|
}
|
|
21829
22798
|
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 (
|
|
22799
|
+
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;
|
|
22800
|
+
var _e, e_1, _f;
|
|
22801
|
+
var _g, _h, _j, _k, _l, _m;
|
|
22802
|
+
return __generator(this, function (_o) {
|
|
22803
|
+
switch (_o.label) {
|
|
21835
22804
|
case 0:
|
|
21836
22805
|
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;
|
|
22806
|
+
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
22807
|
// console.log(`AmisSteedosField`, props)
|
|
21839
22808
|
// if($schema.config && isString($schema.config)){
|
|
21840
22809
|
// $schema.config = JSON.parse($schema.config)
|
|
@@ -21862,14 +22831,14 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21862
22831
|
// 字段配置为只读,强制走fStatic模式,加上_display判断是为了不影响历史代码,比如直接在ObjectForm中调用steedos-field组件
|
|
21863
22832
|
fStatic = true;
|
|
21864
22833
|
}
|
|
21865
|
-
|
|
22834
|
+
_o.label = 1;
|
|
21866
22835
|
case 1:
|
|
21867
|
-
|
|
21868
|
-
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/,
|
|
22836
|
+
_o.trys.push([1, 24, , 25]);
|
|
22837
|
+
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/, 7];
|
|
21869
22838
|
defaultSource = {
|
|
21870
22839
|
"method": "post",
|
|
21871
22840
|
"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 "),
|
|
22841
|
+
"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
22842
|
"trackExpression": "${" + steedosField.name + "}",
|
|
21874
22843
|
"cache": 3000
|
|
21875
22844
|
};
|
|
@@ -21886,50 +22855,179 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21886
22855
|
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
22856
|
}
|
|
21888
22857
|
}
|
|
21889
|
-
source = ((
|
|
22858
|
+
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
22859
|
fieldBaseProps = {
|
|
21891
22860
|
multiple: steedosField.multiple,
|
|
21892
22861
|
name: steedosField.name,
|
|
21893
22862
|
label: steedosField.label,
|
|
21894
22863
|
static: true,
|
|
21895
|
-
|
|
22864
|
+
required: steedosField.required,
|
|
22865
|
+
className: "".concat(className || '', " ").concat(((_j = steedosField.amis) === null || _j === void 0 ? void 0 : _j.className) || '')
|
|
21896
22866
|
};
|
|
21897
22867
|
if (!inInputTable) return [3 /*break*/, 2];
|
|
21898
22868
|
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'select', source: source });
|
|
21899
|
-
return [3 /*break*/,
|
|
22869
|
+
return [3 /*break*/, 6];
|
|
21900
22870
|
case 2:
|
|
21901
|
-
|
|
21902
|
-
return [
|
|
22871
|
+
referenceTo_1 = steedosField.reference_to;
|
|
22872
|
+
if (!referenceTo_1) return [3 /*break*/, 6];
|
|
22873
|
+
if (_$1.isArray(referenceTo_1)) {
|
|
22874
|
+
fieldValue = (_k = props.data) === null || _k === void 0 ? void 0 : _k[steedosField.name];
|
|
22875
|
+
if (fieldValue && fieldValue.o) {
|
|
22876
|
+
referenceTo_1 = fieldValue.o;
|
|
22877
|
+
}
|
|
22878
|
+
else {
|
|
22879
|
+
referenceTo_1 = referenceTo_1[0];
|
|
22880
|
+
}
|
|
22881
|
+
}
|
|
22882
|
+
steedosField.reference_to_field;
|
|
22883
|
+
if (referenceTo_1 === 'users') {
|
|
22884
|
+
referenceTo_1 = 'space_users';
|
|
22885
|
+
}
|
|
22886
|
+
return [4 /*yield*/, getUISchema(referenceTo_1)];
|
|
21903
22887
|
case 3:
|
|
21904
|
-
|
|
21905
|
-
|
|
21906
|
-
|
|
21907
|
-
if (
|
|
21908
|
-
|
|
21909
|
-
|
|
21910
|
-
|
|
21911
|
-
|
|
21912
|
-
|
|
21913
|
-
|
|
21914
|
-
|
|
21915
|
-
|
|
21916
|
-
|
|
21917
|
-
|
|
22888
|
+
fieldRefObject = _o.sent();
|
|
22889
|
+
if (!(props.data._display && _$1.has(props.data._display, steedosField.name))) return [3 /*break*/, 4];
|
|
22890
|
+
disPlayValue = _$1.get(props.data._display, steedosField.name);
|
|
22891
|
+
if (disPlayValue) {
|
|
22892
|
+
if (!_$1.isArray(disPlayValue) && _$1.isObject(disPlayValue)) {
|
|
22893
|
+
disPlayValue = [disPlayValue];
|
|
22894
|
+
}
|
|
22895
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, {
|
|
22896
|
+
type: 'control',
|
|
22897
|
+
name: null,
|
|
22898
|
+
body: {
|
|
22899
|
+
type: 'wrapper',
|
|
22900
|
+
className: "steedos-field-lookup-wrapper p-0",
|
|
22901
|
+
"wrapWithPanel": false,
|
|
22902
|
+
"actions": [],
|
|
22903
|
+
body: [
|
|
22904
|
+
{
|
|
22905
|
+
type: 'each',
|
|
22906
|
+
placeholder: "",
|
|
22907
|
+
className: "steedos-field-lookup-each flex flex-wrap gap-2",
|
|
22908
|
+
source: "${_display.".concat(steedosField.name, "|asArray}"),
|
|
22909
|
+
items: {
|
|
22910
|
+
type: 'static',
|
|
22911
|
+
labelClassName: "hidden",
|
|
22912
|
+
label: false,
|
|
22913
|
+
className: 'm-0',
|
|
22914
|
+
tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\">${label}</a>",
|
|
22915
|
+
popOver: fieldRefObject.compactLayouts ? {
|
|
22916
|
+
"trigger": "hover",
|
|
22917
|
+
"className": "steedos-record-detail-popover",
|
|
22918
|
+
"position": "left-bottom",
|
|
22919
|
+
"showIcon": false,
|
|
22920
|
+
"title": false,
|
|
22921
|
+
"offset": {
|
|
22922
|
+
"top": 0,
|
|
22923
|
+
"left": 20
|
|
22924
|
+
},
|
|
22925
|
+
"body": [
|
|
22926
|
+
{
|
|
22927
|
+
"type": "steedos-record-mini",
|
|
22928
|
+
"objectApiName": "${objectName}",
|
|
22929
|
+
"recordId": "${value}",
|
|
22930
|
+
"showButtons": false,
|
|
22931
|
+
"showBackButton": false,
|
|
22932
|
+
"data": {
|
|
22933
|
+
"objectName": "${objectName}",
|
|
22934
|
+
"recordId": "${value}"
|
|
22935
|
+
}
|
|
22936
|
+
}
|
|
22937
|
+
]
|
|
22938
|
+
} : null
|
|
22939
|
+
}
|
|
22940
|
+
}
|
|
22941
|
+
]
|
|
21918
22942
|
}
|
|
21919
22943
|
});
|
|
21920
22944
|
}
|
|
21921
|
-
|
|
21922
|
-
|
|
21923
|
-
|
|
22945
|
+
else {
|
|
22946
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'static', tpl: '-', className: "".concat(fieldBaseProps.className || '', " text-muted") });
|
|
22947
|
+
}
|
|
22948
|
+
return [3 /*break*/, 6];
|
|
22949
|
+
case 4: return [4 /*yield*/, env.fetcher(source, props.data)];
|
|
22950
|
+
case 5:
|
|
22951
|
+
res = _o.sent();
|
|
22952
|
+
valueOptions_1 = ((_l = res === null || res === void 0 ? void 0 : res.data) === null || _l === void 0 ? void 0 : _l.options) || [];
|
|
22953
|
+
fieldValue = (_m = props.data) === null || _m === void 0 ? void 0 : _m[steedosField.name];
|
|
22954
|
+
values = fieldValue;
|
|
22955
|
+
if (_$1.isString(values)) {
|
|
22956
|
+
values = [values];
|
|
22957
|
+
}
|
|
22958
|
+
if (values && values.length > 0) {
|
|
22959
|
+
disPlayValue_1 = [];
|
|
22960
|
+
_$1.each(values, function (value) {
|
|
22961
|
+
var option = valueOptions_1.find(function (item) { return item.value === value; });
|
|
22962
|
+
if (option) {
|
|
22963
|
+
disPlayValue_1.push({
|
|
22964
|
+
objectName: referenceTo_1,
|
|
22965
|
+
value: option._id || option.value,
|
|
22966
|
+
label: option.label
|
|
22967
|
+
});
|
|
22968
|
+
}
|
|
22969
|
+
});
|
|
22970
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'control', name: null, body: {
|
|
22971
|
+
type: 'form',
|
|
22972
|
+
className: "steedos-field-lookup-wrapper p-0",
|
|
22973
|
+
"wrapWithPanel": false,
|
|
22974
|
+
"actions": [],
|
|
22975
|
+
data: (_e = {},
|
|
22976
|
+
_e[steedosField.name] = disPlayValue_1,
|
|
22977
|
+
_e),
|
|
22978
|
+
body: [
|
|
22979
|
+
{
|
|
22980
|
+
type: 'each',
|
|
22981
|
+
className: "steedos-field-lookup-each flex flex-wrap gap-2",
|
|
22982
|
+
source: "${".concat(steedosField.name, "}"),
|
|
22983
|
+
items: {
|
|
22984
|
+
type: 'static',
|
|
22985
|
+
className: 'm-0',
|
|
22986
|
+
tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\">${label}</a>",
|
|
22987
|
+
popOver: fieldRefObject.compactLayouts ? {
|
|
22988
|
+
"trigger": "hover",
|
|
22989
|
+
"className": "steedos-record-detail-popover",
|
|
22990
|
+
"position": "left-bottom",
|
|
22991
|
+
"showIcon": false,
|
|
22992
|
+
"title": false,
|
|
22993
|
+
"offset": {
|
|
22994
|
+
"top": 0,
|
|
22995
|
+
"left": 20
|
|
22996
|
+
},
|
|
22997
|
+
"body": [
|
|
22998
|
+
{
|
|
22999
|
+
"type": "steedos-record-mini",
|
|
23000
|
+
"objectApiName": "${objectName}",
|
|
23001
|
+
"recordId": "${value}",
|
|
23002
|
+
"showButtons": false,
|
|
23003
|
+
"showBackButton": false,
|
|
23004
|
+
"data": {
|
|
23005
|
+
"objectName": "${objectName}",
|
|
23006
|
+
"recordId": "${value}"
|
|
23007
|
+
}
|
|
23008
|
+
}
|
|
23009
|
+
]
|
|
23010
|
+
} : null
|
|
23011
|
+
}
|
|
23012
|
+
}
|
|
23013
|
+
]
|
|
23014
|
+
} });
|
|
23015
|
+
}
|
|
23016
|
+
else {
|
|
23017
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'static', tpl: '-', className: "".concat(fieldBaseProps.className || '', " text-muted") });
|
|
23018
|
+
}
|
|
23019
|
+
_o.label = 6;
|
|
23020
|
+
case 6:
|
|
21924
23021
|
schema = Object.assign({}, fieldBaseProps, _$1.pick(steedosField.amis || {}, ['className', 'inline', 'label', 'labelAlign', 'name', 'labelRemark', 'description', 'placeholder', 'staticClassName', 'staticLabelClassName', 'staticInputClassName', 'staticSchema']));
|
|
21925
23022
|
schema.placeholder = "";
|
|
23023
|
+
// console.log(`steedos field [lookup] schema:`, schema)
|
|
21926
23024
|
return [2 /*return*/, schema];
|
|
21927
|
-
case
|
|
21928
|
-
if (!fStatic) return [3 /*break*/,
|
|
21929
|
-
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/,
|
|
23025
|
+
case 7:
|
|
23026
|
+
if (!fStatic) return [3 /*break*/, 21];
|
|
23027
|
+
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/, 9];
|
|
21930
23028
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
21931
|
-
case
|
|
21932
|
-
fieldSchema =
|
|
23029
|
+
case 8:
|
|
23030
|
+
fieldSchema = _o.sent();
|
|
21933
23031
|
if (steedosField.type === 'file' && fieldSchema.disabled) {
|
|
21934
23032
|
fieldValue = fieldSchema.value;
|
|
21935
23033
|
if (fieldValue && fieldValue.length) {
|
|
@@ -21965,59 +23063,59 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21965
23063
|
}
|
|
21966
23064
|
}
|
|
21967
23065
|
return [2 /*return*/, fieldSchema];
|
|
21968
|
-
case
|
|
23066
|
+
case 9:
|
|
21969
23067
|
schema = Object.assign({}, steedosField, {
|
|
21970
23068
|
type: getAmisStaticFieldType(steedosField.type, steedosField.data_type, steedosField),
|
|
21971
23069
|
static: true,
|
|
21972
23070
|
label: steedosField.label
|
|
21973
23071
|
});
|
|
21974
|
-
if (!(steedosField.type === "time")) return [3 /*break*/,
|
|
23072
|
+
if (!(steedosField.type === "time")) return [3 /*break*/, 10];
|
|
21975
23073
|
Object.assign(schema, {
|
|
21976
23074
|
inputFormat: 'HH:mm',
|
|
21977
23075
|
timeFormat: 'HH:mm',
|
|
21978
23076
|
format: '1970-01-01THH:mm:00.000[Z]',
|
|
21979
23077
|
});
|
|
21980
|
-
return [3 /*break*/,
|
|
21981
|
-
case
|
|
21982
|
-
if (!(steedosField.type === "percent")) return [3 /*break*/,
|
|
23078
|
+
return [3 /*break*/, 20];
|
|
23079
|
+
case 10:
|
|
23080
|
+
if (!(steedosField.type === "percent")) return [3 /*break*/, 11];
|
|
21983
23081
|
Object.assign(schema, {
|
|
21984
23082
|
"percent": steedosField.scale ? steedosField.scale : true
|
|
21985
23083
|
});
|
|
21986
|
-
return [3 /*break*/,
|
|
21987
|
-
case
|
|
21988
|
-
if (!(steedosField.type === "password")) return [3 /*break*/,
|
|
23084
|
+
return [3 /*break*/, 20];
|
|
23085
|
+
case 11:
|
|
23086
|
+
if (!(steedosField.type === "password")) return [3 /*break*/, 12];
|
|
21989
23087
|
Object.assign(schema, {
|
|
21990
23088
|
"revealPassword": false //没生效,需要用样式隐藏
|
|
21991
23089
|
});
|
|
21992
|
-
return [3 /*break*/,
|
|
21993
|
-
case
|
|
21994
|
-
if (!(steedosField.type === "select")) return [3 /*break*/,
|
|
23090
|
+
return [3 /*break*/, 20];
|
|
23091
|
+
case 12:
|
|
23092
|
+
if (!(steedosField.type === "select")) return [3 /*break*/, 13];
|
|
21995
23093
|
Object.assign(schema, {
|
|
21996
23094
|
"placeholder": ""
|
|
21997
23095
|
});
|
|
21998
|
-
return [3 /*break*/,
|
|
21999
|
-
case
|
|
22000
|
-
if (!(steedosField.type === "color")) return [3 /*break*/,
|
|
23096
|
+
return [3 /*break*/, 20];
|
|
23097
|
+
case 13:
|
|
23098
|
+
if (!(steedosField.type === "color")) return [3 /*break*/, 14];
|
|
22001
23099
|
Object.assign(schema, {
|
|
22002
23100
|
"defaultColor": null
|
|
22003
23101
|
});
|
|
22004
|
-
return [3 /*break*/,
|
|
22005
|
-
case
|
|
22006
|
-
if (!(steedosField.type === "number")) return [3 /*break*/,
|
|
23102
|
+
return [3 /*break*/, 20];
|
|
23103
|
+
case 14:
|
|
23104
|
+
if (!(steedosField.type === "number" || steedosField.type === 'currency')) return [3 /*break*/, 15];
|
|
22007
23105
|
// amis input-number和number组件中的precision表示小数位数,并不是魔方平台的精度概念,要转换下,否则小数点后会显示很多的0
|
|
22008
23106
|
Object.assign(schema, {
|
|
22009
23107
|
"precision": steedosField.scale || 0
|
|
22010
23108
|
});
|
|
22011
|
-
return [3 /*break*/,
|
|
22012
|
-
case
|
|
22013
|
-
if (!(steedosField.type === "table")) return [3 /*break*/,
|
|
23109
|
+
return [3 /*break*/, 20];
|
|
23110
|
+
case 15:
|
|
23111
|
+
if (!(steedosField.type === "table")) return [3 /*break*/, 16];
|
|
22014
23112
|
if (steedosField.subFields) {
|
|
22015
23113
|
tableFields = [];
|
|
22016
23114
|
try {
|
|
22017
|
-
for (_c = __values(
|
|
23115
|
+
for (_c = __values(steedosField.subFields), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
22018
23116
|
subField = _d.value;
|
|
22019
23117
|
if (!subField.name.endsWith(".$")) {
|
|
22020
|
-
subFieldName = subField.name.replace("".concat(
|
|
23118
|
+
subFieldName = subField.name.replace("".concat(steedosField._prefix || '').concat(steedosField.name, ".$."), '').replace("".concat(steedosField.name, "."), '');
|
|
22021
23119
|
// const gridSub = await convertSFieldToAmisField(Object.assign({}, subField, {name: subFieldName, isTableField: true}), readonly, ctx);
|
|
22022
23120
|
tableFields.push(Object.assign({}, subField, { name: subFieldName }));
|
|
22023
23121
|
}
|
|
@@ -22026,13 +23124,12 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22026
23124
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
22027
23125
|
finally {
|
|
22028
23126
|
try {
|
|
22029
|
-
if (_d && !_d.done && (
|
|
23127
|
+
if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
|
|
22030
23128
|
}
|
|
22031
23129
|
finally { if (e_1) throw e_1.error; }
|
|
22032
23130
|
}
|
|
22033
23131
|
Object.assign(schema, {
|
|
22034
23132
|
type: 'steedos-input-table',
|
|
22035
|
-
showIndex: true,
|
|
22036
23133
|
editable: false,
|
|
22037
23134
|
addable: false,
|
|
22038
23135
|
removable: false,
|
|
@@ -22043,9 +23140,9 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22043
23140
|
}
|
|
22044
23141
|
});
|
|
22045
23142
|
}
|
|
22046
|
-
return [3 /*break*/,
|
|
22047
|
-
case
|
|
22048
|
-
if (!(steedosField.type === "image")) return [3 /*break*/,
|
|
23143
|
+
return [3 /*break*/, 20];
|
|
23144
|
+
case 16:
|
|
23145
|
+
if (!(steedosField.type === "image")) return [3 /*break*/, 17];
|
|
22049
23146
|
Object.assign(schema, {
|
|
22050
23147
|
enlargeAble: true,
|
|
22051
23148
|
showToolbar: true,
|
|
@@ -22076,18 +23173,32 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22076
23173
|
return value;
|
|
22077
23174
|
}
|
|
22078
23175
|
});
|
|
22079
|
-
return [3 /*break*/,
|
|
22080
|
-
case
|
|
22081
|
-
if (!(steedosField.type === "file")) return [3 /*break*/,
|
|
23176
|
+
return [3 /*break*/, 20];
|
|
23177
|
+
case 17:
|
|
23178
|
+
if (!(steedosField.type === "file")) return [3 /*break*/, 19];
|
|
22082
23179
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
22083
|
-
case
|
|
23180
|
+
case 18:
|
|
22084
23181
|
// 附件static模式先保持原来的逻辑,依赖_display,审批王中相关功能在creator中
|
|
22085
23182
|
// convertSFieldToAmisField中会合并steedosField.amis,所以也不需要再次合并steedosField.amis,直接return就好
|
|
22086
|
-
return [2 /*return*/,
|
|
22087
|
-
case
|
|
23183
|
+
return [2 /*return*/, _o.sent()];
|
|
23184
|
+
case 19:
|
|
23185
|
+
if (steedosField.type === 'formula' || steedosField.type === 'summary') {
|
|
23186
|
+
if (steedosField.data_type === 'number' || steedosField.data_type === 'currency') {
|
|
23187
|
+
Object.assign(schema, {
|
|
23188
|
+
"precision": steedosField.scale || 0
|
|
23189
|
+
});
|
|
23190
|
+
}
|
|
23191
|
+
}
|
|
23192
|
+
else if (steedosField.type === 'textarea') {
|
|
23193
|
+
Object.assign(schema, {
|
|
23194
|
+
tpl: "<%=(data.".concat(steedosField.name, " || \"\").split(\"\\n\").join('<br>')%>")
|
|
23195
|
+
});
|
|
23196
|
+
}
|
|
23197
|
+
_o.label = 20;
|
|
23198
|
+
case 20:
|
|
22088
23199
|
Object.assign(schema, steedosField.amis || {});
|
|
22089
23200
|
return [2 /*return*/, schema];
|
|
22090
|
-
case
|
|
23201
|
+
case 21:
|
|
22091
23202
|
fieldAmis = steedosField.amis || {};
|
|
22092
23203
|
if (!props.data.hasOwnProperty("_display")) {
|
|
22093
23204
|
// 有_display时保持原来的逻辑不变,不走以下新的逻辑,审批王中会特意传入_display以跳过后面新加的代码
|
|
@@ -22145,16 +23256,16 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22145
23256
|
}
|
|
22146
23257
|
}
|
|
22147
23258
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
22148
|
-
case
|
|
22149
|
-
schema =
|
|
23259
|
+
case 22:
|
|
23260
|
+
schema = _o.sent();
|
|
22150
23261
|
// console.log(`AmisSteedosField return schema`, schema)
|
|
22151
23262
|
return [2 /*return*/, schema];
|
|
22152
|
-
case
|
|
22153
|
-
case
|
|
22154
|
-
error_1 =
|
|
23263
|
+
case 23: return [3 /*break*/, 25];
|
|
23264
|
+
case 24:
|
|
23265
|
+
error_1 = _o.sent();
|
|
22155
23266
|
console.log("error", error_1);
|
|
22156
|
-
return [3 /*break*/,
|
|
22157
|
-
case
|
|
23267
|
+
return [3 /*break*/, 25];
|
|
23268
|
+
case 25: return [2 /*return*/, null];
|
|
22158
23269
|
}
|
|
22159
23270
|
});
|
|
22160
23271
|
}); };
|
|
@@ -22397,7 +23508,7 @@ var AmisInputTable = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
22397
23508
|
return __generator(this, function (_a) {
|
|
22398
23509
|
switch (_a.label) {
|
|
22399
23510
|
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;
|
|
23511
|
+
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
23512
|
return [4 /*yield*/, getAmisInputTableSchema(props)];
|
|
22402
23513
|
case 1:
|
|
22403
23514
|
amisSchema = _a.sent();
|
|
@@ -22407,6 +23518,46 @@ var AmisInputTable = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
22407
23518
|
});
|
|
22408
23519
|
}); };
|
|
22409
23520
|
|
|
23521
|
+
var AmisRecordDetailMini = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
23522
|
+
var $schema, appId, _a, objectApiName, recordId, schemaData, options, schema;
|
|
23523
|
+
return __generator(this, function (_b) {
|
|
23524
|
+
switch (_b.label) {
|
|
23525
|
+
case 0:
|
|
23526
|
+
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;
|
|
23527
|
+
schemaData = {};
|
|
23528
|
+
if (_$1.has(props.data, "recordId") && props.data.recordId !== "${recordId}") {
|
|
23529
|
+
recordId = props.data.recordId;
|
|
23530
|
+
schemaData.recordId = recordId;
|
|
23531
|
+
}
|
|
23532
|
+
if (_$1.has(props.data, "value")) {
|
|
23533
|
+
recordId = props.data.value;
|
|
23534
|
+
schemaData.recordId = recordId;
|
|
23535
|
+
}
|
|
23536
|
+
if (_$1.has(props.data, "objectName") && props.data.objectName !== "${objectName}") {
|
|
23537
|
+
objectApiName = props.data.objectName;
|
|
23538
|
+
schemaData.objectName = objectApiName;
|
|
23539
|
+
}
|
|
23540
|
+
options = {
|
|
23541
|
+
onEvent: $schema.onEvent,
|
|
23542
|
+
data: $schema.data,
|
|
23543
|
+
recordId: recordId
|
|
23544
|
+
};
|
|
23545
|
+
if (props.$$editor) {
|
|
23546
|
+
options.isEditor = true;
|
|
23547
|
+
}
|
|
23548
|
+
console.log("AmisRecordDetailMini==2=>", objectApiName, options);
|
|
23549
|
+
return [4 /*yield*/, getRecordDetailMiniSchema(objectApiName, appId, options)];
|
|
23550
|
+
case 1:
|
|
23551
|
+
schema = _b.sent();
|
|
23552
|
+
if (!_$1.isEmpty(schemaData)) {
|
|
23553
|
+
schema.data = schemaData;
|
|
23554
|
+
}
|
|
23555
|
+
// console.log(`AmisRecordDetailMini===>`, schema)
|
|
23556
|
+
return [2 /*return*/, schema];
|
|
23557
|
+
}
|
|
23558
|
+
});
|
|
23559
|
+
}); };
|
|
23560
|
+
|
|
22410
23561
|
var PageListView = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22411
23562
|
var formFactor, appId, objectApiName, display, data, _display, page, listSchema;
|
|
22412
23563
|
return __generator(this, function (_b) {
|
|
@@ -22480,14 +23631,14 @@ var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22480
23631
|
recordPage = _a.sent();
|
|
22481
23632
|
recordSchema = recordPage ? recordPage.schema : {
|
|
22482
23633
|
"type": "wrapper",
|
|
22483
|
-
"className": "overflow-y-auto p-0 m-0 flex-1 h-full",
|
|
23634
|
+
"className": "steedos-record-content overflow-y-auto p-0 m-0 flex-1 h-full",
|
|
22484
23635
|
"name": "amis-".concat(appId, "-").concat(objectApiName, "-detail"),
|
|
22485
23636
|
"body": [
|
|
22486
23637
|
{
|
|
22487
23638
|
"type": "steedos-record-detail",
|
|
22488
23639
|
// "recordId": "${recordId}",
|
|
22489
23640
|
"objectApiName": "${objectName}",
|
|
22490
|
-
className: "sm:m-3",
|
|
23641
|
+
// className: "sm:m-3",
|
|
22491
23642
|
appId: appId,
|
|
22492
23643
|
}
|
|
22493
23644
|
],
|
|
@@ -22502,7 +23653,7 @@ var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22502
23653
|
"actions": [
|
|
22503
23654
|
{
|
|
22504
23655
|
"actionType": "custom",
|
|
22505
|
-
"script": "window.Steedos && window.Steedos.setDocumentTitle && Steedos.setDocumentTitle({pageName: event.data.record.name})"
|
|
23656
|
+
"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
23657
|
}
|
|
22507
23658
|
]
|
|
22508
23659
|
}
|
|
@@ -22581,13 +23732,27 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
22581
23732
|
"visibleOn": "${pageType !== 'record' && pageType !== 'list'}"
|
|
22582
23733
|
}
|
|
22583
23734
|
]
|
|
22584
|
-
}
|
|
23735
|
+
},
|
|
23736
|
+
// onEvent: {
|
|
23737
|
+
// "recordLoaded": {
|
|
23738
|
+
// "actions": [
|
|
23739
|
+
// {
|
|
23740
|
+
// "actionType": "setValue",
|
|
23741
|
+
// "args": {
|
|
23742
|
+
// "value": {
|
|
23743
|
+
// "steedos_selected_recordId": "${event.data.record._id}"
|
|
23744
|
+
// }
|
|
23745
|
+
// }
|
|
23746
|
+
// }
|
|
23747
|
+
// ]
|
|
23748
|
+
// }
|
|
23749
|
+
// }
|
|
22585
23750
|
}];
|
|
22586
23751
|
}
|
|
22587
23752
|
});
|
|
22588
23753
|
}); };
|
|
22589
23754
|
|
|
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);
|
|
23755
|
+
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
23756
|
|
|
22592
23757
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
22593
23758
|
__proto__: null,
|
|
@@ -22613,6 +23778,7 @@ exports.AmisObjectTable = AmisObjectTable;
|
|
|
22613
23778
|
exports.AmisProvider = AmisProvider;
|
|
22614
23779
|
exports.AmisRecordDetail = AmisRecordDetail;
|
|
22615
23780
|
exports.AmisRecordDetailHeader = AmisRecordDetailHeader;
|
|
23781
|
+
exports.AmisRecordDetailMini = AmisRecordDetailMini;
|
|
22616
23782
|
exports.AmisRecordDetailRelatedList = AmisRecordDetailRelatedList;
|
|
22617
23783
|
exports.AmisRecordDetailRelatedLists = AmisRecordDetailRelatedLists;
|
|
22618
23784
|
exports.AmisRecordService = AmisRecordService;
|