@steedos-widgets/amis-object 3.6.2-beta.2 → 3.6.2-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/amis/AmisGlobalHeader.d.ts +1 -31
- package/dist/amis/AmisInputTable.d.ts +25 -14
- package/dist/amis/AmisRecordDetail.d.ts +5 -7
- package/dist/amis/AmisRecordDetailHeader.d.ts +1 -56
- package/dist/amis/AmisRecordDetailMini.d.ts +31 -0
- package/dist/amis/AmisRecordService.d.ts +42 -6
- package/dist/amis/index.d.ts +1 -0
- package/dist/amis-object.cjs.css +521 -236
- package/dist/amis-object.cjs.js +1835 -639
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +521 -236
- package/dist/amis-object.esm.js +1835 -640
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +521 -236
- package/dist/amis-object.umd.js +431 -241
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +21 -21
- package/dist/meta.js +507 -395
- package/dist/metas/AmisRecordDetailMini.d.ts +2 -0
- package/dist/pages/PageObject.d.ts +1 -0
- package/dist/tailwind-base.css +37 -6
- package/package.json +3 -3
package/dist/amis-object.esm.js
CHANGED
|
@@ -3493,22 +3493,29 @@ const getSteedosAuth = () => {
|
|
|
3493
3493
|
* @Description:
|
|
3494
3494
|
*/
|
|
3495
3495
|
|
|
3496
|
-
|
|
3497
3496
|
const Router$1 = {
|
|
3498
3497
|
getTabDisplayAs(tab_id){
|
|
3498
|
+
const uiSchema = getUISchemaSync$1(tab_id, false);
|
|
3499
3499
|
var urlSearch = new URLSearchParams(document.location.search);
|
|
3500
3500
|
if(urlSearch.has('display')){
|
|
3501
3501
|
return urlSearch.get('display')
|
|
3502
3502
|
}
|
|
3503
3503
|
const key = `tab_${tab_id}_display`;
|
|
3504
3504
|
// const key = `page_display`;
|
|
3505
|
-
const value =
|
|
3506
|
-
|
|
3505
|
+
const value = sessionStorage.getItem(key);
|
|
3506
|
+
let defaultDisplay = "grid";
|
|
3507
|
+
if(uiSchema.enable_split){
|
|
3508
|
+
defaultDisplay = "split";
|
|
3509
|
+
}
|
|
3510
|
+
if(window.innerWidth <= 768){
|
|
3511
|
+
return "grid";
|
|
3512
|
+
}
|
|
3513
|
+
return value ? value : defaultDisplay;
|
|
3507
3514
|
},
|
|
3508
3515
|
|
|
3509
3516
|
setTabDisplayAs(tab_id, displayAs){
|
|
3510
3517
|
const key = `tab_${tab_id}_display`;
|
|
3511
|
-
|
|
3518
|
+
sessionStorage.setItem(key, displayAs);
|
|
3512
3519
|
},
|
|
3513
3520
|
getAppPath({formFactor, appId}){
|
|
3514
3521
|
return `/app/${appId}`;
|
|
@@ -3535,8 +3542,8 @@ const Router$1 = {
|
|
|
3535
3542
|
/*
|
|
3536
3543
|
* @Author: baozhoutao@steedos.com
|
|
3537
3544
|
* @Date: 2022-07-20 16:29:22
|
|
3538
|
-
* @LastEditors:
|
|
3539
|
-
* @LastEditTime:
|
|
3545
|
+
* @LastEditors: liaodaxue
|
|
3546
|
+
* @LastEditTime: 2024-01-25 14:44:17
|
|
3540
3547
|
* @Description:
|
|
3541
3548
|
*/
|
|
3542
3549
|
|
|
@@ -3608,11 +3615,30 @@ function getComparableAmisVersion() {
|
|
|
3608
3615
|
}
|
|
3609
3616
|
}
|
|
3610
3617
|
|
|
3618
|
+
/**
|
|
3619
|
+
* 判断浏览器类型
|
|
3620
|
+
* @returns 按需返回浏览器类型;
|
|
3621
|
+
*/
|
|
3622
|
+
function getBowserType() {
|
|
3623
|
+
const userAgent = navigator.userAgent;
|
|
3624
|
+
if (userAgent.indexOf("Chrome")!== -1 && userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Edg") === -1) {
|
|
3625
|
+
return "Chrome";
|
|
3626
|
+
} else if (userAgent.indexOf("Firefox") !== -1) {
|
|
3627
|
+
return "Firefox";
|
|
3628
|
+
} else if (userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Chrome") === -1 && userAgent.indexOf("Edge") === -1) {
|
|
3629
|
+
return "Safari";
|
|
3630
|
+
} else if (userAgent.indexOf("Edg") !== -1) {
|
|
3631
|
+
return "Edge";
|
|
3632
|
+
} else {
|
|
3633
|
+
return "Unknown browser"; // 其他浏览器...(可根据自己需要确定是否新增其他浏览器的判断)
|
|
3634
|
+
}
|
|
3635
|
+
}
|
|
3636
|
+
|
|
3611
3637
|
/*
|
|
3612
3638
|
* @Author: baozhoutao@steedos.com
|
|
3613
3639
|
* @Date: 2022-05-23 09:53:08
|
|
3614
3640
|
* @LastEditors: liaodaxue
|
|
3615
|
-
* @LastEditTime:
|
|
3641
|
+
* @LastEditTime: 2024-01-17 16:00:27
|
|
3616
3642
|
* @Description:
|
|
3617
3643
|
*/
|
|
3618
3644
|
|
|
@@ -3684,7 +3710,7 @@ function getSelectMap(selectOptions){
|
|
|
3684
3710
|
|
|
3685
3711
|
function getNameTplUrl(field, ctx){
|
|
3686
3712
|
if(ctx.objectName === 'cms_files'){
|
|
3687
|
-
return
|
|
3713
|
+
return "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}"
|
|
3688
3714
|
}
|
|
3689
3715
|
const href = Router$1.getObjectDetailPath({
|
|
3690
3716
|
...ctx, formFactor: ctx.formFactor, appId: "${appId}", objectName: ctx.objectName || "${objectName}", recordId: `\${${ctx.idFieldName}}`
|
|
@@ -4430,6 +4456,7 @@ var frontend_notifications$1 = "Notifications";
|
|
|
4430
4456
|
var frontend_notifications_allread$1 = "Mark all as read";
|
|
4431
4457
|
var frontend_notifications_allread_message$1 = "All marked as read";
|
|
4432
4458
|
var frontend_profile$1 = "Profile";
|
|
4459
|
+
var switch_space$1 = "Switch Space";
|
|
4433
4460
|
var frontend_about$1 = "About";
|
|
4434
4461
|
var frontend_log_out$1 = "Log out";
|
|
4435
4462
|
var frontend_listview_warning_start$1 = "The current ";
|
|
@@ -4517,6 +4544,7 @@ var en_us = {
|
|
|
4517
4544
|
frontend_notifications_allread: frontend_notifications_allread$1,
|
|
4518
4545
|
frontend_notifications_allread_message: frontend_notifications_allread_message$1,
|
|
4519
4546
|
frontend_profile: frontend_profile$1,
|
|
4547
|
+
switch_space: switch_space$1,
|
|
4520
4548
|
frontend_about: frontend_about$1,
|
|
4521
4549
|
frontend_log_out: frontend_log_out$1,
|
|
4522
4550
|
frontend_listview_warning_start: frontend_listview_warning_start$1,
|
|
@@ -4556,9 +4584,9 @@ var frontend_display_type_is_split = "分栏视图";
|
|
|
4556
4584
|
var frontend_display_as = "显示为";
|
|
4557
4585
|
var frontend_record_sum = "个项目";
|
|
4558
4586
|
var frontend_button_reload_tooltip = "刷新";
|
|
4559
|
-
var frontend_button_search_tooltip = "
|
|
4587
|
+
var frontend_button_search_tooltip = "搜索";
|
|
4560
4588
|
var frontend_fields_filter_button_search = "搜索";
|
|
4561
|
-
var frontend_fields_filter_button_settings = "
|
|
4589
|
+
var frontend_fields_filter_button_settings = "选择搜索项";
|
|
4562
4590
|
var frontend_button_listview_control_tooltip = "列表视图控制";
|
|
4563
4591
|
var frontend_button_listview_control_label = "列表视图控制";
|
|
4564
4592
|
var frontend_listview_control_columns = "显示的列";
|
|
@@ -4606,6 +4634,7 @@ var frontend_notifications = "通知";
|
|
|
4606
4634
|
var frontend_notifications_allread = "全部标记为已读";
|
|
4607
4635
|
var frontend_notifications_allread_message = "已全部标记为已读";
|
|
4608
4636
|
var frontend_profile = "个人资料";
|
|
4637
|
+
var switch_space = "切换工作区";
|
|
4609
4638
|
var frontend_about = "关于";
|
|
4610
4639
|
var frontend_log_out = "注销";
|
|
4611
4640
|
var frontend_listview_warning_start = "当前";
|
|
@@ -4694,6 +4723,7 @@ var zh_cn = {
|
|
|
4694
4723
|
frontend_notifications_allread: frontend_notifications_allread,
|
|
4695
4724
|
frontend_notifications_allread_message: frontend_notifications_allread_message,
|
|
4696
4725
|
frontend_profile: frontend_profile,
|
|
4726
|
+
switch_space: switch_space,
|
|
4697
4727
|
frontend_about: frontend_about,
|
|
4698
4728
|
frontend_log_out: frontend_log_out,
|
|
4699
4729
|
frontend_listview_warning_start: frontend_listview_warning_start,
|
|
@@ -5007,7 +5037,8 @@ async function getQuickEditSchema(field, options){
|
|
|
5007
5037
|
"failed": "失败了呢。。"
|
|
5008
5038
|
}
|
|
5009
5039
|
}
|
|
5010
|
-
}
|
|
5040
|
+
},
|
|
5041
|
+
"expression": "${!recordPermissions.modifyAllRecords}"
|
|
5011
5042
|
},
|
|
5012
5043
|
{
|
|
5013
5044
|
"actionType": "setValue",
|
|
@@ -5023,7 +5054,7 @@ async function getQuickEditSchema(field, options){
|
|
|
5023
5054
|
"componentId": quickEditId,
|
|
5024
5055
|
"args": {
|
|
5025
5056
|
"value":{
|
|
5026
|
-
"quickedit_record_permissions": "${event.data}"
|
|
5057
|
+
"quickedit_record_permissions": "${recordPermissions.modifyAllRecords ? {'allowEdit': true} : event.data}"
|
|
5027
5058
|
}
|
|
5028
5059
|
}
|
|
5029
5060
|
}
|
|
@@ -5087,7 +5118,7 @@ async function getQuickEditSchema(field, options){
|
|
|
5087
5118
|
`
|
|
5088
5119
|
}
|
|
5089
5120
|
},
|
|
5090
|
-
"expression":"${event.data.value}"
|
|
5121
|
+
"expression":"${event.data.value && !recordPermissions.modifyAllRecords}"
|
|
5091
5122
|
},
|
|
5092
5123
|
{
|
|
5093
5124
|
"actionType": "setValue",
|
|
@@ -5118,10 +5149,20 @@ async function getQuickEditSchema(field, options){
|
|
|
5118
5149
|
"script": `
|
|
5119
5150
|
const noPermission = event.data.noPermission;
|
|
5120
5151
|
const crudComponent = event.context.scoped.getComponentById("${options.crudId}");
|
|
5121
|
-
|
|
5152
|
+
let selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
|
|
5122
5153
|
noPermission.forEach(function (item) {
|
|
5123
5154
|
crudComponent && crudComponent.unSelectItem(_.find(selectedItems,{_id:item}));
|
|
5155
|
+
_.remove(selectedItems, (selected) => selected._id === item);
|
|
5124
5156
|
})
|
|
5157
|
+
doAction({
|
|
5158
|
+
"componentId": "${quickEditId}",
|
|
5159
|
+
"actionType": "setValue",
|
|
5160
|
+
"args": {
|
|
5161
|
+
"value": {
|
|
5162
|
+
selectedItems
|
|
5163
|
+
}
|
|
5164
|
+
}
|
|
5165
|
+
});
|
|
5125
5166
|
`
|
|
5126
5167
|
},
|
|
5127
5168
|
{
|
|
@@ -5182,7 +5223,7 @@ async function getQuickEditSchema(field, options){
|
|
|
5182
5223
|
}
|
|
5183
5224
|
|
|
5184
5225
|
function getFieldWidth(width){
|
|
5185
|
-
const defaultWidth =
|
|
5226
|
+
const defaultWidth = null;
|
|
5186
5227
|
if(typeof width == 'string'){
|
|
5187
5228
|
if(isNaN(width)){
|
|
5188
5229
|
return width || defaultWidth;
|
|
@@ -5212,18 +5253,35 @@ async function getTableColumns$1(fields, options){
|
|
|
5212
5253
|
//增加quickEdit属性,实现快速编辑
|
|
5213
5254
|
const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
|
|
5214
5255
|
let className = "";
|
|
5215
|
-
|
|
5256
|
+
const bowserType = getBowserType();
|
|
5257
|
+
if(bowserType === "Safari"){
|
|
5216
5258
|
className += " whitespace-nowrap ";
|
|
5217
5259
|
}else {
|
|
5218
|
-
|
|
5260
|
+
if(field.wrap != true){
|
|
5261
|
+
className += " whitespace-nowrap ";
|
|
5262
|
+
}else {
|
|
5263
|
+
className += " break-words ";
|
|
5264
|
+
}
|
|
5265
|
+
}
|
|
5266
|
+
|
|
5267
|
+
if (typeof field.amis?.className == "object") {
|
|
5268
|
+
className = {
|
|
5269
|
+
[className]: "true",
|
|
5270
|
+
...field.amis.className
|
|
5271
|
+
};
|
|
5272
|
+
} else if (typeof field.amis?.className == "string") {
|
|
5273
|
+
className = `${className} ${field.amis.className} `;
|
|
5219
5274
|
}
|
|
5275
|
+
let fieldAmis = _$1.clone(field.amis);
|
|
5276
|
+
delete fieldAmis?.className;
|
|
5277
|
+
|
|
5220
5278
|
let columnItem;
|
|
5221
5279
|
if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
|
|
5222
5280
|
const previewFileScript = `
|
|
5223
5281
|
var data = event.data;
|
|
5224
5282
|
var file_name = data.versions ? data.name : "${field.label}";
|
|
5225
|
-
var file_id = data._id;
|
|
5226
|
-
|
|
5283
|
+
var file_id = data.versions && data.versions[0] && data.versions[0]._id;
|
|
5284
|
+
window.previewFile && window.previewFile({file_name, file_id});
|
|
5227
5285
|
`;
|
|
5228
5286
|
columnItem = {
|
|
5229
5287
|
"type": "button",
|
|
@@ -5248,11 +5306,11 @@ async function getTableColumns$1(fields, options){
|
|
|
5248
5306
|
"expression": "!!!(window && window.nw && window.nw.require)"//浏览器上直接下载
|
|
5249
5307
|
},
|
|
5250
5308
|
{
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5309
|
+
"args": {},
|
|
5310
|
+
"actionType": "custom",
|
|
5311
|
+
"script": previewFileScript,
|
|
5312
|
+
// "expression": "!!window?.nw?.require" //PC客户端预览附件
|
|
5313
|
+
"expression": "!!(window && window.nw && window.nw.require)"//PC客户端预览附件
|
|
5256
5314
|
}
|
|
5257
5315
|
]
|
|
5258
5316
|
}
|
|
@@ -5267,7 +5325,7 @@ async function getTableColumns$1(fields, options){
|
|
|
5267
5325
|
toggled: field.toggled,
|
|
5268
5326
|
static: true,
|
|
5269
5327
|
className,
|
|
5270
|
-
},
|
|
5328
|
+
}, fieldAmis, {name: field.name});
|
|
5271
5329
|
}else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
|
|
5272
5330
|
columnItem = Object.assign({}, {
|
|
5273
5331
|
type: "switch",
|
|
@@ -5278,7 +5336,7 @@ async function getTableColumns$1(fields, options){
|
|
|
5278
5336
|
static: true,
|
|
5279
5337
|
className,
|
|
5280
5338
|
...getAmisFileReadonlySchema(field)
|
|
5281
|
-
},
|
|
5339
|
+
}, fieldAmis, {name: field.name});
|
|
5282
5340
|
}
|
|
5283
5341
|
else if(field.type === 'select'){
|
|
5284
5342
|
const map = getSelectMap(field.options);
|
|
@@ -5293,7 +5351,7 @@ async function getTableColumns$1(fields, options){
|
|
|
5293
5351
|
className,
|
|
5294
5352
|
inputClassName: "inline",
|
|
5295
5353
|
static: true,
|
|
5296
|
-
},
|
|
5354
|
+
}, fieldAmis, {name: field.name});
|
|
5297
5355
|
}
|
|
5298
5356
|
else {
|
|
5299
5357
|
const tpl = await getFieldTpl(field, options);
|
|
@@ -5312,23 +5370,14 @@ async function getTableColumns$1(fields, options){
|
|
|
5312
5370
|
if(field.type === 'textarea'){
|
|
5313
5371
|
className += 'min-w-56';
|
|
5314
5372
|
}
|
|
5315
|
-
if(field.type === 'date'){
|
|
5316
|
-
|
|
5317
|
-
}
|
|
5318
|
-
if(field.type === 'datetime'){
|
|
5319
|
-
|
|
5320
|
-
}
|
|
5373
|
+
// if(field.type === 'date'){
|
|
5374
|
+
// className += 'date-min-w';
|
|
5375
|
+
// }
|
|
5376
|
+
// if(field.type === 'datetime'){
|
|
5377
|
+
// className += 'datetime-min-w';
|
|
5378
|
+
// }
|
|
5321
5379
|
|
|
5322
5380
|
//field上的amis属性里的clssname需要单独判断类型合并
|
|
5323
|
-
if (typeof field.amis?.className == "object") {
|
|
5324
|
-
className = {
|
|
5325
|
-
[className]: "true",
|
|
5326
|
-
...field.amis.className
|
|
5327
|
-
};
|
|
5328
|
-
} else if (typeof field.amis?.className == "string") {
|
|
5329
|
-
className = `${className} ${field.amis.className} `;
|
|
5330
|
-
}
|
|
5331
|
-
delete field.amis?.className;
|
|
5332
5381
|
|
|
5333
5382
|
if(!field.hidden && !field.extra){
|
|
5334
5383
|
columnItem = Object.assign({}, {
|
|
@@ -5345,7 +5394,7 @@ async function getTableColumns$1(fields, options){
|
|
|
5345
5394
|
static: true,
|
|
5346
5395
|
options: field.type === 'html' ? {html: true} : null
|
|
5347
5396
|
// toggled: true
|
|
5348
|
-
},
|
|
5397
|
+
}, fieldAmis, {name: field.name});
|
|
5349
5398
|
|
|
5350
5399
|
if(field.type === 'color'){
|
|
5351
5400
|
columnItem.type = 'color';
|
|
@@ -5412,7 +5461,7 @@ function getMobileLines(tpls){
|
|
|
5412
5461
|
}
|
|
5413
5462
|
if(isLeft){
|
|
5414
5463
|
// 左侧半行
|
|
5415
|
-
lineChildrenClassName = "steedos-listview-item-left truncate";
|
|
5464
|
+
lineChildrenClassName = "steedos-listview-item-left truncate h-5";
|
|
5416
5465
|
if(item.field.is_wide){
|
|
5417
5466
|
// 左侧全行样式可以单独写,如果需要配置两行省略号效果,可以加样式类 two-lines-truncate
|
|
5418
5467
|
lineChildrenClassName = "steedos-listview-item-wide";
|
|
@@ -5424,7 +5473,7 @@ function getMobileLines(tpls){
|
|
|
5424
5473
|
}
|
|
5425
5474
|
else {
|
|
5426
5475
|
// 右侧半行,这里加样式类 flex flex-shrink-0,是为了省略号只显示在左半行,右半行文字一般比较短,如果也加省略号效果的话,左侧文字多的话,右侧没几个字就显示省略号了
|
|
5427
|
-
lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0";
|
|
5476
|
+
lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0 h-5";
|
|
5428
5477
|
}
|
|
5429
5478
|
//支持字段amis属性配置classname,识别classname的类型,与原样式合并
|
|
5430
5479
|
var className;
|
|
@@ -5535,8 +5584,16 @@ async function getMobileTableColumns(fields, options){
|
|
|
5535
5584
|
"actions": [
|
|
5536
5585
|
{
|
|
5537
5586
|
"script": `
|
|
5538
|
-
let cms_url =
|
|
5539
|
-
|
|
5587
|
+
let cms_url = '';
|
|
5588
|
+
let value = event.data.versions[0];
|
|
5589
|
+
if(value){
|
|
5590
|
+
if(value.url){
|
|
5591
|
+
cms_url = value.url;
|
|
5592
|
+
}else{
|
|
5593
|
+
cms_url = Steedos.absoluteUrl("/api/files/files/"+value+"?download=true");
|
|
5594
|
+
}
|
|
5595
|
+
}
|
|
5596
|
+
Steedos.cordovaDownload(encodeURI(cms_url), event.data.name);
|
|
5540
5597
|
`,
|
|
5541
5598
|
"actionType": "custom"
|
|
5542
5599
|
}
|
|
@@ -5651,7 +5708,8 @@ async function getTableOperation(ctx){
|
|
|
5651
5708
|
label: " ",
|
|
5652
5709
|
fixed: 'right',
|
|
5653
5710
|
labelClassName: 'text-center',
|
|
5654
|
-
|
|
5711
|
+
//TODO:目前3.6.3-patch.3版本中对于动态classname处理存在问题,简单处理固定列问题,等待amis解决crud的columns不支持动态classname的问题
|
|
5712
|
+
className: 'text-center steedos-listview-operation w-10 is-sticky is-sticky-right is-sticky-first-right',
|
|
5655
5713
|
buttons: [
|
|
5656
5714
|
{
|
|
5657
5715
|
"type": "steedos-dropdown-button",
|
|
@@ -5747,7 +5805,7 @@ async function getTableSchema$1(fields, options){
|
|
|
5747
5805
|
}
|
|
5748
5806
|
return {
|
|
5749
5807
|
mode: "cards",
|
|
5750
|
-
perPageAvailable: [
|
|
5808
|
+
perPageAvailable: [20, 50, 100, 500],
|
|
5751
5809
|
name: "thelist",
|
|
5752
5810
|
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
5753
5811
|
className: "",
|
|
@@ -5780,7 +5838,7 @@ async function getTableSchema$1(fields, options){
|
|
|
5780
5838
|
|
|
5781
5839
|
return {
|
|
5782
5840
|
mode: "table",
|
|
5783
|
-
perPageAvailable: [
|
|
5841
|
+
perPageAvailable: [20, 50, 100, 500],
|
|
5784
5842
|
name: "thelist",
|
|
5785
5843
|
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
5786
5844
|
className: "",
|
|
@@ -6035,6 +6093,21 @@ async function getTableApi(mainObject, fields, options){
|
|
|
6035
6093
|
return api;
|
|
6036
6094
|
`;
|
|
6037
6095
|
api.adaptor = `
|
|
6096
|
+
let fields = ${JSON.stringify(_$1.map(fields, 'name'))};
|
|
6097
|
+
// 这里把行数据中所有为空的字段值配置为空字符串,是因为amis有bug:crud的columns中的列如果type为static-前缀的话,行数据中该字段为空的话会显示为父作用域中同名变量值,见:https://github.com/baidu/amis/issues/9556
|
|
6098
|
+
(payload.data.rows || []).forEach((itemRow) => {
|
|
6099
|
+
(fields || []).forEach((itemField) => {
|
|
6100
|
+
if(itemField && itemField.indexOf(".") > -1){
|
|
6101
|
+
return;
|
|
6102
|
+
}
|
|
6103
|
+
if(itemField && (itemRow[itemField] === undefined || itemRow[itemField] === null)){
|
|
6104
|
+
// 这里itemRow中不存在 itemField 属性,或者值为null时都会有“显示为父作用域中的同名变量值”的问题,所以null和undefined都要重置为空字符串
|
|
6105
|
+
// 实测数字、下拉框、多选lookup等字段类型重置为空字符串都不会有问题,而且实测amis from组件的清空表单字段值功能就是把表单中的各种字段类型设置为空字符串,所以看起来也符合amis规范
|
|
6106
|
+
itemRow[itemField] = "";
|
|
6107
|
+
}
|
|
6108
|
+
});
|
|
6109
|
+
});
|
|
6110
|
+
|
|
6038
6111
|
if(api.body.listName == "recent"){
|
|
6039
6112
|
payload.data.rows = _.sortBy(payload.data.rows, function(item){
|
|
6040
6113
|
return _.indexOf(api.body._ids, item._id)
|
|
@@ -6059,7 +6132,13 @@ async function getTableApi(mainObject, fields, options){
|
|
|
6059
6132
|
value = [value]
|
|
6060
6133
|
};
|
|
6061
6134
|
if(field.type === 'file'){
|
|
6062
|
-
item[key] = value
|
|
6135
|
+
// item[key] = value
|
|
6136
|
+
// PC客户端附件子表列表点击标题预览附件功能依赖了_id,所以这里拼出来
|
|
6137
|
+
let itemKeyValue = item[key];
|
|
6138
|
+
item[key] = value.map(function(item, index){
|
|
6139
|
+
item._id = itemKeyValue[index];
|
|
6140
|
+
return item;
|
|
6141
|
+
});
|
|
6063
6142
|
}else{
|
|
6064
6143
|
item[key] = _.map(value, (item)=>{
|
|
6065
6144
|
if(field.type === 'image'){
|
|
@@ -6101,15 +6180,8 @@ async function getTableApi(mainObject, fields, options){
|
|
|
6101
6180
|
}
|
|
6102
6181
|
});
|
|
6103
6182
|
};
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
isTreeOptionsComputed = true;
|
|
6107
|
-
}
|
|
6108
|
-
if(!isTreeOptionsComputed){
|
|
6109
|
-
// 如果api接口设置在缓存,缓存期间并不会重新请求接口,payload.data.rows是上次计算后的结果
|
|
6110
|
-
payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
|
|
6111
|
-
assignIndexToTreeRecords(payload.data.rows, '');
|
|
6112
|
-
}
|
|
6183
|
+
payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
|
|
6184
|
+
assignIndexToTreeRecords(payload.data.rows, '');
|
|
6113
6185
|
}
|
|
6114
6186
|
|
|
6115
6187
|
|
|
@@ -6166,12 +6238,15 @@ async function getTableApi(mainObject, fields, options){
|
|
|
6166
6238
|
}
|
|
6167
6239
|
// SteedosUI.getRef(api.body.$self.$scopeId)?.parent?.getComponentById(setDataToComponentId)?.setData({$count: payload.data.count})
|
|
6168
6240
|
};
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6241
|
+
let formFactor = "${options.formFactor}";
|
|
6242
|
+
if(formFactor !== "SMALL"){
|
|
6243
|
+
const listviewComponent = $(".steedos-object-listview .antd-Table-table");
|
|
6244
|
+
const firstListviewComponent = listviewComponent && listviewComponent[0];
|
|
6245
|
+
if(firstListviewComponent){
|
|
6246
|
+
setTimeout(()=>{
|
|
6247
|
+
firstListviewComponent.scrollIntoView();
|
|
6248
|
+
}, 600);
|
|
6249
|
+
}
|
|
6175
6250
|
}
|
|
6176
6251
|
${options.adaptor || ''}
|
|
6177
6252
|
return payload;
|
|
@@ -6284,12 +6359,21 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
6284
6359
|
}
|
|
6285
6360
|
payload.data = data;
|
|
6286
6361
|
payload.data.__objectName = "${object.name}";
|
|
6287
|
-
payload.data.
|
|
6362
|
+
payload.data.record = record;
|
|
6363
|
+
|
|
6364
|
+
payload.data.NAME_FIELD_VALUE = record.${object.NAME_FIELD_KEY || 'name'};
|
|
6365
|
+
payload.data._master = {
|
|
6366
|
+
record: record,
|
|
6367
|
+
objectName: "${object.name}",
|
|
6368
|
+
recordId: record._id
|
|
6369
|
+
}
|
|
6288
6370
|
window.postMessage(Object.assign({type: "record.loaded"}, {record: record}), "*")
|
|
6289
6371
|
}
|
|
6290
6372
|
if(payload.errors){
|
|
6291
6373
|
payload.status = 2;
|
|
6292
6374
|
payload.msg = payload.errors[0].message;
|
|
6375
|
+
}else{
|
|
6376
|
+
payload.data.recordLoaded = true;
|
|
6293
6377
|
}
|
|
6294
6378
|
${options && options.initApiAdaptor || ''}
|
|
6295
6379
|
return payload;
|
|
@@ -6432,7 +6516,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
6432
6516
|
cache: API_CACHE,
|
|
6433
6517
|
requestAdaptor: `
|
|
6434
6518
|
// 所有不想在network请求中发送的数据都应该从data中分离出来,data变量只需要留下query才需要发送出去
|
|
6435
|
-
var { recordId, objectName, uiSchema, global, context, ...data} = api.data;
|
|
6519
|
+
var { recordId, objectName, uiSchema, global, context, _master, ...data} = api.data;
|
|
6436
6520
|
if(!recordId){
|
|
6437
6521
|
// 新建则不请求任何数据
|
|
6438
6522
|
data.query = "{data:" + objectName + "(filters: " + JSON.stringify(["_id", "=", null]) + ", top: 1){_id}}";
|
|
@@ -6510,10 +6594,11 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
6510
6594
|
...initialValues
|
|
6511
6595
|
}
|
|
6512
6596
|
${options.initApiAdaptor || ''}
|
|
6597
|
+
// console.log('getEditFormInitApi======>', payload);
|
|
6513
6598
|
return payload;
|
|
6514
6599
|
`,
|
|
6515
6600
|
responseData: {
|
|
6516
|
-
|
|
6601
|
+
"&": "$$",
|
|
6517
6602
|
editFormInited: true
|
|
6518
6603
|
},
|
|
6519
6604
|
data: data,
|
|
@@ -6552,6 +6637,18 @@ function getBatchDelete(objectName){
|
|
|
6552
6637
|
return {
|
|
6553
6638
|
method: 'post',
|
|
6554
6639
|
url: getApi$2(),
|
|
6640
|
+
adaptor: `
|
|
6641
|
+
if(payload.errors){
|
|
6642
|
+
payload.data.deleteErrorMessage = [];
|
|
6643
|
+
payload.errors.forEach(function(error){
|
|
6644
|
+
let errorRecord = error.path.map(function (item) {
|
|
6645
|
+
return item.split('delete__')[1].to_float() + 1;
|
|
6646
|
+
}).toString();
|
|
6647
|
+
payload.data.deleteErrorMessage.push("第" + errorRecord + "条记录删除出现异常,报错信息为(" + (window.t ? window.t(error.message) : error.message) + ")");
|
|
6648
|
+
})
|
|
6649
|
+
}
|
|
6650
|
+
return payload;
|
|
6651
|
+
`,
|
|
6555
6652
|
requestAdaptor: `
|
|
6556
6653
|
var ids = api.data.ids.split(",");
|
|
6557
6654
|
var deleteArray = [];
|
|
@@ -7346,7 +7443,7 @@ async function getListBody(fields, options){
|
|
|
7346
7443
|
|
|
7347
7444
|
function getDefaultParams(options){
|
|
7348
7445
|
return {
|
|
7349
|
-
perPage: options.top || options.perPage ||
|
|
7446
|
+
perPage: options.top || options.perPage || 20
|
|
7350
7447
|
}
|
|
7351
7448
|
}
|
|
7352
7449
|
|
|
@@ -7549,7 +7646,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
7549
7646
|
"objectApiName": "\${objectName}",
|
|
7550
7647
|
"recordId": "",
|
|
7551
7648
|
"mode": "edit",
|
|
7552
|
-
"layout": "normal"
|
|
7553
7649
|
};
|
|
7554
7650
|
|
|
7555
7651
|
if (payload && payload.schema) {
|
|
@@ -7981,9 +8077,16 @@ const getSchema$2 = (uiSchema) => {
|
|
|
7981
8077
|
"form": {
|
|
7982
8078
|
debug: false,
|
|
7983
8079
|
resetAfterSubmit: false,
|
|
8080
|
+
data: {
|
|
8081
|
+
editFormInited: true,
|
|
8082
|
+
},
|
|
7984
8083
|
initApi: {
|
|
8084
|
+
method: 'GET',
|
|
7985
8085
|
url: '/api/v1/queue_import_history/${recordId}?fields=["state"]',
|
|
7986
8086
|
sendOn: 'this.recordId',
|
|
8087
|
+
data: null,
|
|
8088
|
+
requestAdaptor: "return api;",
|
|
8089
|
+
adaptor: "return payload;",
|
|
7987
8090
|
responseData: {
|
|
7988
8091
|
importState: "${state}"
|
|
7989
8092
|
}
|
|
@@ -8254,7 +8357,7 @@ const StandardButtons = {
|
|
|
8254
8357
|
}
|
|
8255
8358
|
};
|
|
8256
8359
|
|
|
8257
|
-
const getGlobalData
|
|
8360
|
+
const getGlobalData = () => {
|
|
8258
8361
|
return {
|
|
8259
8362
|
now: new Date(),
|
|
8260
8363
|
};
|
|
@@ -8313,7 +8416,7 @@ const getButtonVisible = (button, ctx) => {
|
|
|
8313
8416
|
button._visible,
|
|
8314
8417
|
props.record,
|
|
8315
8418
|
"#",
|
|
8316
|
-
getGlobalData
|
|
8419
|
+
getGlobalData(),
|
|
8317
8420
|
props.userSession
|
|
8318
8421
|
);
|
|
8319
8422
|
};
|
|
@@ -8855,7 +8958,7 @@ async function getObjectFieldsFilterFormSchema(ctx) {
|
|
|
8855
8958
|
const formSchema = {
|
|
8856
8959
|
"type": "service",
|
|
8857
8960
|
"visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
|
|
8858
|
-
"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-
|
|
8961
|
+
"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",
|
|
8859
8962
|
"style":{
|
|
8860
8963
|
"max-height":ctx.formFactor === 'SMALL'?"30vh":"unset"
|
|
8861
8964
|
},
|
|
@@ -9442,7 +9545,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
9442
9545
|
"className": "slds-filters"
|
|
9443
9546
|
},
|
|
9444
9547
|
"size": "xs",
|
|
9445
|
-
"className": `border-
|
|
9548
|
+
"className": `border-y slds-grid slds-grid_vertical slds-nowrap ${!ctx.isLookup && "mt-2"}`,
|
|
9446
9549
|
"visibleOn": "this.showFieldsFilter",
|
|
9447
9550
|
},
|
|
9448
9551
|
"className": "bg-white"
|
|
@@ -9630,7 +9733,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
9630
9733
|
"icon": "fa fa-refresh",
|
|
9631
9734
|
"actionType": "reload",
|
|
9632
9735
|
"target": amisListViewId,
|
|
9633
|
-
"className": "bg-white p-2 rounded
|
|
9736
|
+
"className": "bg-white p-2 rounded text-gray-500"
|
|
9634
9737
|
},
|
|
9635
9738
|
fieldsFilterButtonSchema,
|
|
9636
9739
|
// {
|
|
@@ -9638,7 +9741,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
9638
9741
|
// "label": "",
|
|
9639
9742
|
// "icon": "fa fa-filter",
|
|
9640
9743
|
// "actionType": "custom",
|
|
9641
|
-
// "className": "bg-transparent p-2 rounded
|
|
9744
|
+
// "className": "bg-transparent p-2 rounded text-gray-500",
|
|
9642
9745
|
// "id": "u:c20cb87d96c9",
|
|
9643
9746
|
// "onEvent": {
|
|
9644
9747
|
// "click": {
|
|
@@ -9686,11 +9789,53 @@ function getObjectListHeader$1(objectSchema, listViewName, ctx) {
|
|
|
9686
9789
|
let headerSchema = [{
|
|
9687
9790
|
"type": "wrapper",
|
|
9688
9791
|
"body": body,
|
|
9689
|
-
"className": `
|
|
9792
|
+
"className": `sm:rounded-tl sm:rounded-tr p-4 -mb-4`
|
|
9690
9793
|
}];
|
|
9691
9794
|
return headerSchema;
|
|
9692
9795
|
}
|
|
9693
9796
|
|
|
9797
|
+
function getBackButtonSchema(){
|
|
9798
|
+
return {
|
|
9799
|
+
"type": "service",
|
|
9800
|
+
"onEvent": {
|
|
9801
|
+
"@history_paths.changed": {
|
|
9802
|
+
"actions": [
|
|
9803
|
+
{
|
|
9804
|
+
"actionType": "reload",
|
|
9805
|
+
// amis 3.6需要传入data来触发下面的window:historyPaths重新计算,此问题随机偶发,加上data后正常
|
|
9806
|
+
"data": {
|
|
9807
|
+
}
|
|
9808
|
+
}
|
|
9809
|
+
]
|
|
9810
|
+
}
|
|
9811
|
+
},
|
|
9812
|
+
"body":[{
|
|
9813
|
+
"type": "button",
|
|
9814
|
+
"visibleOn": "${window:innerWidth > 768 && (window:historyPaths.length > 1 || window:historyPaths[0].params.record_id) && display !== 'split'}",
|
|
9815
|
+
"className":"flex mr-4",
|
|
9816
|
+
"onEvent": {
|
|
9817
|
+
"click": {
|
|
9818
|
+
"actions": [
|
|
9819
|
+
{
|
|
9820
|
+
"actionType": "custom",
|
|
9821
|
+
"script": "window.goBack()"
|
|
9822
|
+
}
|
|
9823
|
+
]
|
|
9824
|
+
}
|
|
9825
|
+
},
|
|
9826
|
+
"body": [
|
|
9827
|
+
{
|
|
9828
|
+
"type": "steedos-icon",
|
|
9829
|
+
"category": "utility",
|
|
9830
|
+
"name": "back",
|
|
9831
|
+
"colorVariant": "default",
|
|
9832
|
+
"className": "slds-button_icon slds-global-header__icon w-4"
|
|
9833
|
+
}
|
|
9834
|
+
]
|
|
9835
|
+
}]
|
|
9836
|
+
}
|
|
9837
|
+
}
|
|
9838
|
+
|
|
9694
9839
|
/**
|
|
9695
9840
|
* 记录详细界面顶部头amisSchema,也是标题面板组件的amisSchema
|
|
9696
9841
|
* @param {*} objectSchema 对象UISchema
|
|
@@ -9699,11 +9844,21 @@ function getObjectListHeader$1(objectSchema, listViewName, ctx) {
|
|
|
9699
9844
|
* @returns amisSchema
|
|
9700
9845
|
*/
|
|
9701
9846
|
async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
9847
|
+
// console.log(`getObjectRecordDetailHeader====>`, options)
|
|
9702
9848
|
const { showRecordTitle = true } = options || {};
|
|
9703
9849
|
// console.log('getObjectRecordDetailHeader==>', objectSchema, recordId)
|
|
9704
9850
|
const { name, label, icon, NAME_FIELD_KEY } = objectSchema;
|
|
9705
9851
|
|
|
9706
|
-
let amisButtonsSchema =
|
|
9852
|
+
let amisButtonsSchema = [];
|
|
9853
|
+
if(options.showButtons != false){
|
|
9854
|
+
amisButtonsSchema = getObjectDetailButtonsSchemas(objectSchema, recordId, options);
|
|
9855
|
+
}
|
|
9856
|
+
|
|
9857
|
+
let backButtonsSchema = null;
|
|
9858
|
+
|
|
9859
|
+
if(options.showBackButton != false){
|
|
9860
|
+
backButtonsSchema = getBackButtonSchema();
|
|
9861
|
+
}
|
|
9707
9862
|
|
|
9708
9863
|
// console.log(`getObjectRecordDetailHeader==>`, amisButtonsSchema)
|
|
9709
9864
|
|
|
@@ -9718,45 +9873,9 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
9718
9873
|
"type": "grid",
|
|
9719
9874
|
"columns": [
|
|
9720
9875
|
{
|
|
9721
|
-
"body": [
|
|
9722
|
-
|
|
9723
|
-
|
|
9724
|
-
"@history_paths.changed": {
|
|
9725
|
-
"actions": [
|
|
9726
|
-
{
|
|
9727
|
-
"actionType": "reload",
|
|
9728
|
-
// amis 3.6需要传入data来触发下面的window:historyPaths重新计算,此问题随机偶发,加上data后正常
|
|
9729
|
-
"data": {
|
|
9730
|
-
}
|
|
9731
|
-
}
|
|
9732
|
-
]
|
|
9733
|
-
}
|
|
9734
|
-
},
|
|
9735
|
-
"body":[{
|
|
9736
|
-
"type": "button",
|
|
9737
|
-
"visibleOn": "${window:innerWidth > 768 && (window:historyPaths.length > 1 || window:historyPaths[0].params.record_id) && display !== 'split'}",
|
|
9738
|
-
"className":"flex mr-4",
|
|
9739
|
-
"onEvent": {
|
|
9740
|
-
"click": {
|
|
9741
|
-
"actions": [
|
|
9742
|
-
{
|
|
9743
|
-
"actionType": "custom",
|
|
9744
|
-
"script": "window.goBack()"
|
|
9745
|
-
}
|
|
9746
|
-
]
|
|
9747
|
-
}
|
|
9748
|
-
},
|
|
9749
|
-
"body": [
|
|
9750
|
-
{
|
|
9751
|
-
"type": "steedos-icon",
|
|
9752
|
-
"category": "utility",
|
|
9753
|
-
"name": "back",
|
|
9754
|
-
"colorVariant": "default",
|
|
9755
|
-
"className": "slds-button_icon slds-global-header__icon w-4"
|
|
9756
|
-
}
|
|
9757
|
-
]
|
|
9758
|
-
}]
|
|
9759
|
-
},{
|
|
9876
|
+
"body": [
|
|
9877
|
+
backButtonsSchema
|
|
9878
|
+
,{
|
|
9760
9879
|
"type": "tpl",
|
|
9761
9880
|
"className": "block",
|
|
9762
9881
|
// "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'>`
|
|
@@ -9777,8 +9896,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
9777
9896
|
},
|
|
9778
9897
|
{
|
|
9779
9898
|
"type": "tpl",
|
|
9780
|
-
"tpl": "${
|
|
9781
|
-
// "tpl": "${(record && uiSchema && record[uiSchema.NAME_FIELD_KEY]) || name}",
|
|
9899
|
+
"tpl": "${NAME_FIELD_VALUE}",
|
|
9782
9900
|
"inline": false,
|
|
9783
9901
|
"wrapperComponent": "",
|
|
9784
9902
|
"className": "record-detail-header-name leading-5 text-xl font-bold"
|
|
@@ -9806,7 +9924,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
9806
9924
|
let body = [
|
|
9807
9925
|
{
|
|
9808
9926
|
"type": "wrapper",
|
|
9809
|
-
"className": "p-
|
|
9927
|
+
"className": "p-4 border-b",
|
|
9810
9928
|
"body": [
|
|
9811
9929
|
{
|
|
9812
9930
|
"type": "grid",
|
|
@@ -9821,7 +9939,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
9821
9939
|
if(showRecordTitle){
|
|
9822
9940
|
body.push({
|
|
9823
9941
|
"type": "wrapper",
|
|
9824
|
-
"className": "p-
|
|
9942
|
+
"className": "p-4",
|
|
9825
9943
|
"body": [
|
|
9826
9944
|
{
|
|
9827
9945
|
"type": "grid",
|
|
@@ -9833,11 +9951,76 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
9833
9951
|
});
|
|
9834
9952
|
}
|
|
9835
9953
|
|
|
9954
|
+
let max = 10;
|
|
9955
|
+
if(options.formFactor === 'SMALL'){
|
|
9956
|
+
max = 4;
|
|
9957
|
+
}else {
|
|
9958
|
+
|
|
9959
|
+
let divWidth = window.innerWidth;
|
|
9960
|
+
|
|
9961
|
+
if(options.display === 'split'){
|
|
9962
|
+
divWidth = divWidth - 388;
|
|
9963
|
+
}
|
|
9964
|
+
|
|
9965
|
+
if(document.body.classList.contains('sidebar')){
|
|
9966
|
+
divWidth = divWidth - 210;
|
|
9967
|
+
}
|
|
9968
|
+
|
|
9969
|
+
// 根据屏幕宽度计算显示数量, 使高亮字段只占1行
|
|
9970
|
+
max = Math.trunc(divWidth / 200 );
|
|
9971
|
+
if(max > 10){
|
|
9972
|
+
max = 10;
|
|
9973
|
+
}
|
|
9974
|
+
}
|
|
9975
|
+
|
|
9976
|
+
// console.log('=======================max=========================', max)
|
|
9977
|
+
|
|
9978
|
+
if(objectSchema.compactLayouts){
|
|
9979
|
+
const details = [];
|
|
9980
|
+
_.each(_.slice(_.difference(objectSchema.compactLayouts, [objectSchema.NAME_FIELD_KEY]), 0, max), (fieldName)=>{
|
|
9981
|
+
const field = objectSchema.fields[fieldName];
|
|
9982
|
+
if(field){
|
|
9983
|
+
details.push({
|
|
9984
|
+
type: 'steedos-field',
|
|
9985
|
+
static: true,
|
|
9986
|
+
config: field,
|
|
9987
|
+
});
|
|
9988
|
+
}
|
|
9989
|
+
});
|
|
9990
|
+
|
|
9991
|
+
// 注意: 以下注释不能删除. tailwind css 动态编译时会识别以下注释, 生成对应的样式
|
|
9992
|
+
// lg:grid-cols-1
|
|
9993
|
+
// lg:grid-cols-2
|
|
9994
|
+
// lg:grid-cols-3
|
|
9995
|
+
// lg:grid-cols-4
|
|
9996
|
+
// lg:grid-cols-5
|
|
9997
|
+
// lg:grid-cols-6
|
|
9998
|
+
// lg:grid-cols-7
|
|
9999
|
+
// lg:grid-cols-8
|
|
10000
|
+
// lg:grid-cols-9
|
|
10001
|
+
// lg:grid-cols-10
|
|
10002
|
+
// lg:grid-cols-11
|
|
10003
|
+
// lg:grid-cols-12
|
|
10004
|
+
|
|
10005
|
+
body.push({
|
|
10006
|
+
"type": "wrapper",
|
|
10007
|
+
"body": {
|
|
10008
|
+
"type": "form",
|
|
10009
|
+
// "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
|
|
10010
|
+
"className": `gap-2 grid grid-cols-1 lg:grid-cols-${max}`,
|
|
10011
|
+
"wrapWithPanel": false,
|
|
10012
|
+
"actions": [],
|
|
10013
|
+
"body": details,
|
|
10014
|
+
"hiddenOn": "${recordLoaded != true}"
|
|
10015
|
+
},
|
|
10016
|
+
"className": "steedos-record-compact-layouts p-4 bg-white compact-layouts border-b"
|
|
10017
|
+
});
|
|
10018
|
+
}
|
|
10019
|
+
|
|
9836
10020
|
return {
|
|
9837
10021
|
type: 'service',
|
|
9838
10022
|
id: `page_readonly_${name}_header`,
|
|
9839
10023
|
name: `page`,
|
|
9840
|
-
data: { objectName: name, _id: recordId, recordPermissions: objectSchema.permissions, uiSchema: objectSchema, record: "${record}" },
|
|
9841
10024
|
body: body,
|
|
9842
10025
|
className: ''
|
|
9843
10026
|
}
|
|
@@ -9909,7 +10092,7 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
9909
10092
|
"className": "flex justify-between"
|
|
9910
10093
|
}
|
|
9911
10094
|
],
|
|
9912
|
-
"className": "
|
|
10095
|
+
"className": "steedos-record-related-header py-2 px-3 bg-gray-50 border"
|
|
9913
10096
|
};
|
|
9914
10097
|
return recordRelatedListHeader;
|
|
9915
10098
|
}
|
|
@@ -10867,7 +11050,7 @@ const getSettingListviewToolbarButtonSchema = ()=>{
|
|
|
10867
11050
|
"icon": "fa fa-cog",
|
|
10868
11051
|
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
10869
11052
|
// "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
|
|
10870
|
-
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded
|
|
11053
|
+
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
|
|
10871
11054
|
"align": "right",
|
|
10872
11055
|
"visibleOn": "${!isLookup}",
|
|
10873
11056
|
"buttons": [
|
|
@@ -10894,14 +11077,14 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
|
10894
11077
|
{
|
|
10895
11078
|
"type": "button",
|
|
10896
11079
|
"label": instance.t('frontend_display_type_is_table'),
|
|
10897
|
-
"onClick": "const key = 'tab_"+objectName+"_display';
|
|
11080
|
+
"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');",
|
|
10898
11081
|
"rightIcon": displayAs != 'split' ? "fa fa-check" : null,
|
|
10899
11082
|
"rightIconClassName": "m-l-sm"
|
|
10900
11083
|
},
|
|
10901
11084
|
{
|
|
10902
11085
|
"type": "button",
|
|
10903
11086
|
"label": instance.t('frontend_display_type_is_split'),
|
|
10904
|
-
"onClick": "const key = 'tab_"+objectName+"_display';
|
|
11087
|
+
"onClick": "const key = 'tab_"+objectName+"_display';sessionStorage.setItem(key, 'split');const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
|
|
10905
11088
|
"rightIcon": displayAs === 'split' ? "fa fa-check" : null,
|
|
10906
11089
|
"rightIconClassName": "m-l-sm"
|
|
10907
11090
|
}
|
|
@@ -10912,7 +11095,7 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
|
10912
11095
|
"icon": "fa fa-table-columns",
|
|
10913
11096
|
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
10914
11097
|
// "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
|
|
10915
|
-
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded
|
|
11098
|
+
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
|
|
10916
11099
|
"align": "right",
|
|
10917
11100
|
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
10918
11101
|
"buttons": [
|
|
@@ -11044,7 +11227,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
11044
11227
|
{
|
|
11045
11228
|
"type": "search-box",
|
|
11046
11229
|
"name": keywordsSearchBoxName,
|
|
11047
|
-
"placeholder": "
|
|
11230
|
+
"placeholder": "快捷搜索",
|
|
11048
11231
|
"value": crudKeywords,
|
|
11049
11232
|
// "clearable": true,//因为清除并不会触发失去焦点事件,只有禁用,但是它会触发change事件,所以等升级到amis 3.4+后可以重新放开
|
|
11050
11233
|
"clearAndSubmit": true,
|
|
@@ -11105,7 +11288,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
11105
11288
|
// //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
11106
11289
|
// // "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
11107
11290
|
// "tooltipPlacement": "top",
|
|
11108
|
-
// "className": "bg-white p-2 rounded
|
|
11291
|
+
// "className": "bg-white p-2 rounded text-gray-500",
|
|
11109
11292
|
// "label": "",
|
|
11110
11293
|
// "icon": "fa fa-sync",
|
|
11111
11294
|
// "visibleOn": "${!showFieldsFilter}",
|
|
@@ -11129,7 +11312,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
11129
11312
|
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
11130
11313
|
"tooltip":"",
|
|
11131
11314
|
"tooltipPlacement": "top",
|
|
11132
|
-
"className": "bg-white p-2 rounded
|
|
11315
|
+
"className": "bg-white p-2 rounded text-gray-500"
|
|
11133
11316
|
};
|
|
11134
11317
|
}
|
|
11135
11318
|
else {
|
|
@@ -11140,7 +11323,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
11140
11323
|
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
11141
11324
|
"tooltip":"",
|
|
11142
11325
|
"tooltipPlacement": "top",
|
|
11143
|
-
"className": "bg-white p-2 rounded
|
|
11326
|
+
"className": "bg-white p-2 rounded text-gray-500"
|
|
11144
11327
|
};
|
|
11145
11328
|
}
|
|
11146
11329
|
let toolbarFilter;
|
|
@@ -11162,7 +11345,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
11162
11345
|
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
11163
11346
|
},
|
|
11164
11347
|
"align": "right",
|
|
11165
|
-
"className": "bg-white p-2 rounded
|
|
11348
|
+
"className": "bg-white p-2 rounded text-gray-500",
|
|
11166
11349
|
"onEvent": {
|
|
11167
11350
|
"click": {
|
|
11168
11351
|
"actions": [
|
|
@@ -11248,7 +11431,10 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
11248
11431
|
// ]
|
|
11249
11432
|
if(options.displayAs === 'split'){
|
|
11250
11433
|
return [
|
|
11251
|
-
|
|
11434
|
+
{
|
|
11435
|
+
"type": "switch-per-page",
|
|
11436
|
+
"visibleOn": "${count >= 20}"
|
|
11437
|
+
},
|
|
11252
11438
|
{
|
|
11253
11439
|
"type": "pagination",
|
|
11254
11440
|
"maxButtons": 5,
|
|
@@ -11270,7 +11456,6 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
11270
11456
|
else {
|
|
11271
11457
|
if(options && options.isRelated){
|
|
11272
11458
|
return [
|
|
11273
|
-
"statistics",
|
|
11274
11459
|
{
|
|
11275
11460
|
"type": "pagination",
|
|
11276
11461
|
"maxButtons": 10,
|
|
@@ -11283,7 +11468,6 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
11283
11468
|
const no_pagination = mainObject.paging && (mainObject.paging.enabled === false);
|
|
11284
11469
|
const is_lookup = options.isLookup;
|
|
11285
11470
|
const commonConfig = [
|
|
11286
|
-
"statistics",
|
|
11287
11471
|
{
|
|
11288
11472
|
"type": "pagination",
|
|
11289
11473
|
"maxButtons": 10,
|
|
@@ -11294,7 +11478,10 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
11294
11478
|
if (no_pagination && is_lookup) {
|
|
11295
11479
|
return commonConfig;
|
|
11296
11480
|
} else {
|
|
11297
|
-
return [
|
|
11481
|
+
return [{
|
|
11482
|
+
"type": "switch-per-page",
|
|
11483
|
+
"visibleOn": "${count >= 20}"
|
|
11484
|
+
}, ...commonConfig];
|
|
11298
11485
|
}
|
|
11299
11486
|
}
|
|
11300
11487
|
}
|
|
@@ -11318,7 +11505,6 @@ async function getObjectFilter(objectSchema, fields, options) {
|
|
|
11318
11505
|
"timeOut": 1000
|
|
11319
11506
|
}
|
|
11320
11507
|
});
|
|
11321
|
-
resizeWindow();
|
|
11322
11508
|
const scope = event.context.scoped;
|
|
11323
11509
|
// let filterFormValues = event.data;
|
|
11324
11510
|
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
@@ -11402,6 +11588,29 @@ function getBulkActions(objectSchema){
|
|
|
11402
11588
|
"className": "hidden",
|
|
11403
11589
|
"id": "batchDelete",
|
|
11404
11590
|
"api": getBatchDelete(objectSchema.name),
|
|
11591
|
+
"feedback": {
|
|
11592
|
+
"title": "删除警告",
|
|
11593
|
+
"visibleOn": "${deleteErrorMessage}",
|
|
11594
|
+
"body": [
|
|
11595
|
+
{
|
|
11596
|
+
"type": "each",
|
|
11597
|
+
"name": "deleteErrorMessage",
|
|
11598
|
+
"items": {
|
|
11599
|
+
"type": "alert",
|
|
11600
|
+
"body": "${item}",
|
|
11601
|
+
"level": "danger",
|
|
11602
|
+
"className": "mb-3"
|
|
11603
|
+
}
|
|
11604
|
+
}
|
|
11605
|
+
],
|
|
11606
|
+
"actions": [
|
|
11607
|
+
{
|
|
11608
|
+
"type": "button",
|
|
11609
|
+
"actionType": "close",
|
|
11610
|
+
"label": "关闭"
|
|
11611
|
+
}
|
|
11612
|
+
]
|
|
11613
|
+
}
|
|
11405
11614
|
}
|
|
11406
11615
|
// {
|
|
11407
11616
|
// "label": "批量修改",
|
|
@@ -11462,7 +11671,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11462
11671
|
const bodyProps = {
|
|
11463
11672
|
// toolbar: getToolbar(),
|
|
11464
11673
|
// headerToolbar: getObjectHeaderToolbar(objectSchema, options.formFactor, {showDisplayAs}),
|
|
11465
|
-
headerToolbarClassName: "px-4 py-2 border-
|
|
11674
|
+
headerToolbarClassName: "px-4 py-2 border-b",
|
|
11466
11675
|
footerToolbar: getObjectFooterToolbar(objectSchema, options.formFactor, {
|
|
11467
11676
|
...options,
|
|
11468
11677
|
disableStatistics: options.queryCount === false
|
|
@@ -11598,7 +11807,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11598
11807
|
// "is-steedos-crud-data-empty": "${!items || COUNT(items) == 0}"
|
|
11599
11808
|
// },
|
|
11600
11809
|
bodyClassName: {
|
|
11601
|
-
"
|
|
11810
|
+
"mb-0": true,
|
|
11602
11811
|
"is-steedos-crud-data-empty": "${!items || COUNT(items) == 0}"
|
|
11603
11812
|
},
|
|
11604
11813
|
crudClassName: crudClassName,
|
|
@@ -11609,16 +11818,11 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11609
11818
|
headers: {
|
|
11610
11819
|
Authorization: "Bearer ${context.tenantId},${context.authToken}",
|
|
11611
11820
|
},
|
|
11612
|
-
requestAdaptor: quickSaveApiRequestAdaptor
|
|
11613
|
-
adaptor: `
|
|
11614
|
-
if(payload.errors){
|
|
11615
|
-
payload.status = 2;
|
|
11616
|
-
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
11617
|
-
}
|
|
11618
|
-
return payload;
|
|
11619
|
-
`
|
|
11821
|
+
requestAdaptor: quickSaveApiRequestAdaptor
|
|
11620
11822
|
},
|
|
11621
|
-
rowClassNameExpr
|
|
11823
|
+
// 外层data发生变化的时候, 不会重新渲染rowClassNameExpr, 所以先用css标记tr唯一标识
|
|
11824
|
+
// 使用表达式给tr添加初始选中状态
|
|
11825
|
+
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 %>"
|
|
11622
11826
|
}, bodyProps);
|
|
11623
11827
|
|
|
11624
11828
|
}
|
|
@@ -11631,9 +11835,23 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11631
11835
|
crudModeClassName = `steedos-crud-mode-${body.mode}`;
|
|
11632
11836
|
}
|
|
11633
11837
|
|
|
11838
|
+
body.quickSaveApi.adaptor = `
|
|
11839
|
+
if(payload.errors){
|
|
11840
|
+
payload.status = 2;
|
|
11841
|
+
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
11842
|
+
}
|
|
11843
|
+
var scope = SteedosUI.getRef(context.scopeId);
|
|
11844
|
+
var scopeParent = scope && scope.parent;
|
|
11845
|
+
var crudScoped = scopeParent.getComponentById('${body.id}');
|
|
11846
|
+
setTimeout(()=>{
|
|
11847
|
+
crudScoped && crudScoped.control.updateAutoFillHeight();
|
|
11848
|
+
}, 500);
|
|
11849
|
+
return payload;
|
|
11850
|
+
`;
|
|
11851
|
+
|
|
11634
11852
|
if(body.columns && options.formFactor != 'SMALL'){
|
|
11635
11853
|
//将_display放入crud的columns的倒数第二列中(最后一列会影响固定列),可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
11636
|
-
body.columns.splice(body.columns.length -
|
|
11854
|
+
body.columns.splice(body.columns.length -1 , 0, {name: '_display',type: 'static', width: 1, placeholder: "",id: objectSchema.name + "_display_${_index}", tpl: "${''}"});
|
|
11637
11855
|
}
|
|
11638
11856
|
|
|
11639
11857
|
if (defaults) {
|
|
@@ -11691,11 +11909,6 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11691
11909
|
}
|
|
11692
11910
|
}
|
|
11693
11911
|
|
|
11694
|
-
const getGlobalData = (mode)=>{
|
|
11695
|
-
const user = getSteedosAuth();
|
|
11696
|
-
return {mode: mode, user: user, spaceId: user.spaceId, userId: user.userId}
|
|
11697
|
-
};
|
|
11698
|
-
|
|
11699
11912
|
const getFormFields$1 = (objectSchema, formProps)=>{
|
|
11700
11913
|
/**
|
|
11701
11914
|
* fieldsExtend: 重写字段定义
|
|
@@ -11757,7 +11970,7 @@ async function getFormSchemaWithDataFilter(form, options = {}){
|
|
|
11757
11970
|
}
|
|
11758
11971
|
|
|
11759
11972
|
async function getObjectForm(objectSchema, ctx){
|
|
11760
|
-
const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "
|
|
11973
|
+
const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign, tabId, appId, defaults, submitSuccActions = [],
|
|
11761
11974
|
formDataFilter, onFormDataFilter, amisData, env } = ctx;
|
|
11762
11975
|
const fields = _$1__default.values(objectSchema.fields);
|
|
11763
11976
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
@@ -11773,9 +11986,7 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
11773
11986
|
id: `service_${formSchema.id}`,
|
|
11774
11987
|
className: 'p-0',
|
|
11775
11988
|
name: `page_edit_${recordId}`,
|
|
11776
|
-
api: await getEditFormInitApi(objectSchema, recordId, fields, ctx),
|
|
11777
11989
|
data:{
|
|
11778
|
-
editFormInited: false,
|
|
11779
11990
|
...amisData
|
|
11780
11991
|
},
|
|
11781
11992
|
// data: {global: getGlobalData('edit'), recordId: recordId, objectName: objectSchema.name, context: {rootUrl: getRootUrl(), tenantId: getTenantId(), authToken: getAuthToken()}},
|
|
@@ -11784,8 +11995,9 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
11784
11995
|
body: [defaultsDeep({}, formSchema, {
|
|
11785
11996
|
type: "form",
|
|
11786
11997
|
mode: layout,
|
|
11998
|
+
initApi: await getEditFormInitApi(objectSchema, recordId, fields, ctx),
|
|
11787
11999
|
data: {
|
|
11788
|
-
|
|
12000
|
+
editFormInited: false,
|
|
11789
12001
|
},
|
|
11790
12002
|
labelAlign,
|
|
11791
12003
|
persistData: false,
|
|
@@ -11799,11 +12011,15 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
11799
12011
|
submitText: "", // amis 表单不显示提交按钮, 表单提交由项目代码接管
|
|
11800
12012
|
api: await getSaveApi(objectSchema, recordId, fields, ctx),
|
|
11801
12013
|
initFetch: recordId != 'new',
|
|
11802
|
-
body:
|
|
12014
|
+
body: {
|
|
12015
|
+
type: 'wrapper',
|
|
12016
|
+
className: 'p-0 m-0',
|
|
12017
|
+
body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups})),
|
|
12018
|
+
hiddenOn: "${editFormInited != true}",
|
|
12019
|
+
},
|
|
11803
12020
|
panelClassName:'m-0 sm:rounded-lg shadow-none border-none',
|
|
11804
12021
|
bodyClassName: 'p-0',
|
|
11805
12022
|
className: 'steedos-amis-form',
|
|
11806
|
-
hiddenOn: "${editFormInited != true}",
|
|
11807
12023
|
onEvent: {
|
|
11808
12024
|
"submitSucc": {
|
|
11809
12025
|
"weight": 0,
|
|
@@ -11848,7 +12064,7 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
11848
12064
|
}
|
|
11849
12065
|
|
|
11850
12066
|
async function getObjectDetail(objectSchema, recordId, ctx){
|
|
11851
|
-
const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "
|
|
12067
|
+
const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign,
|
|
11852
12068
|
formDataFilter, onFormDataFilter, amisData, env } = ctx;
|
|
11853
12069
|
const fields = _$1__default.values(objectSchema.fields);
|
|
11854
12070
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
@@ -11857,8 +12073,7 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
11857
12073
|
type: 'service',
|
|
11858
12074
|
name: `page_readonly_${recordId}`,
|
|
11859
12075
|
id: serviceId,
|
|
11860
|
-
|
|
11861
|
-
api: await getReadonlyFormInitApi(objectSchema, recordId, fields, ctx),
|
|
12076
|
+
// api: await getReadonlyFormInitApi(objectSchema, recordId, fields, ctx),
|
|
11862
12077
|
body: [
|
|
11863
12078
|
{
|
|
11864
12079
|
"type": "wrapper", //form 的 hiddenOn 会导致 form onEvent 异常, 使用wrapper包裹一次form,并在wrapper上控制显隐
|
|
@@ -11884,60 +12099,41 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
11884
12099
|
),
|
|
11885
12100
|
className: 'steedos-amis-form bg-white',
|
|
11886
12101
|
actions: [], // 不显示表单默认的提交按钮
|
|
11887
|
-
onEvent: {
|
|
11888
|
-
[`@data.changed.${objectSchema.name}`]: { // 由于amis service 组件的 onEvent 存在bug ,此处借助form来刷新 上层 service https://github.com/baidu/amis/issues/6294
|
|
11889
|
-
"actions": [
|
|
11890
|
-
{
|
|
11891
|
-
"actionType": "reload",
|
|
11892
|
-
"componentId": serviceId,
|
|
11893
|
-
"expression": "this.__deletedRecord != true"
|
|
11894
|
-
},
|
|
11895
|
-
{
|
|
11896
|
-
// "args": {
|
|
11897
|
-
// "url": "/app/${appId}/${objectName}/grid/${side_listview_id}",
|
|
11898
|
-
// "blank": false
|
|
11899
|
-
// },
|
|
11900
|
-
"actionType": "custom",
|
|
11901
|
-
"script": "window.goBack()",
|
|
11902
|
-
"expression": "this.__deletedRecord === true"
|
|
11903
|
-
}
|
|
11904
|
-
]
|
|
11905
|
-
}
|
|
11906
|
-
}
|
|
11907
12102
|
},
|
|
11908
12103
|
}
|
|
11909
12104
|
],
|
|
11910
|
-
onEvent: {
|
|
11911
|
-
|
|
11912
|
-
|
|
11913
|
-
|
|
11914
|
-
|
|
11915
|
-
|
|
11916
|
-
|
|
11917
|
-
|
|
11918
|
-
|
|
11919
|
-
|
|
11920
|
-
|
|
11921
|
-
|
|
11922
|
-
|
|
11923
|
-
|
|
11924
|
-
|
|
11925
|
-
|
|
11926
|
-
|
|
11927
|
-
|
|
11928
|
-
|
|
11929
|
-
|
|
11930
|
-
|
|
11931
|
-
|
|
11932
|
-
|
|
11933
|
-
|
|
11934
|
-
|
|
11935
|
-
|
|
11936
|
-
|
|
11937
|
-
}
|
|
12105
|
+
// onEvent: {
|
|
12106
|
+
// "fetchInited": {
|
|
12107
|
+
// "weight": 0,
|
|
12108
|
+
// "actions": [
|
|
12109
|
+
// {
|
|
12110
|
+
// actionType: 'broadcast',
|
|
12111
|
+
// eventName: "recordLoaded",
|
|
12112
|
+
// args: {
|
|
12113
|
+
// eventName: "recordLoaded"
|
|
12114
|
+
// },
|
|
12115
|
+
// data: {
|
|
12116
|
+
// objectName: "${event.data.__objectName}",
|
|
12117
|
+
// record: "${event.data.__record}"
|
|
12118
|
+
// },
|
|
12119
|
+
// expression: "${event.data.__response.error != true}"
|
|
12120
|
+
// },
|
|
12121
|
+
// {
|
|
12122
|
+
// "actionType": "setValue",
|
|
12123
|
+
// "args": {
|
|
12124
|
+
// value: {
|
|
12125
|
+
// "recordLoaded": true,
|
|
12126
|
+
// }
|
|
12127
|
+
// },
|
|
12128
|
+
// expression: "${event.data.__response.error != true}"
|
|
12129
|
+
// }
|
|
12130
|
+
// ]
|
|
12131
|
+
// }
|
|
12132
|
+
// }
|
|
11938
12133
|
};
|
|
11939
12134
|
|
|
11940
12135
|
amisSchema.body[0].body = await getFormSchemaWithDataFilter(amisSchema.body[0].body, { formDataFilter, onFormDataFilter, amisData, env });
|
|
12136
|
+
// console.log('getObjectDetail=====>', amisSchema);
|
|
11941
12137
|
return amisSchema;
|
|
11942
12138
|
}
|
|
11943
12139
|
|
|
@@ -12017,8 +12213,8 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
12017
12213
|
/*
|
|
12018
12214
|
* @Author: baozhoutao@steedos.com
|
|
12019
12215
|
* @Date: 2022-07-05 15:55:39
|
|
12020
|
-
* @LastEditors:
|
|
12021
|
-
* @LastEditTime:
|
|
12216
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
12217
|
+
* @LastEditTime: 2024-01-24 10:18:17
|
|
12022
12218
|
* @Description:
|
|
12023
12219
|
*/
|
|
12024
12220
|
|
|
@@ -12117,7 +12313,9 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
12117
12313
|
const foreign_key_value = arr[2] ? arr[1]+'.'+arr[2] : arr[1];
|
|
12118
12314
|
mainRelated[arr[0]] = foreign_key_value;
|
|
12119
12315
|
}
|
|
12120
|
-
}
|
|
12316
|
+
}
|
|
12317
|
+
// 防止related_lists中没有相关子表,但是details中有相关子表的情况
|
|
12318
|
+
if(!mainRelated[relatedObjectName]){
|
|
12121
12319
|
const details = union(mainObjectUiSchema.details,mainObjectUiSchema.lookup_details) || [];
|
|
12122
12320
|
for (const detail of details) {
|
|
12123
12321
|
const arr = detail.split(".");
|
|
@@ -12193,7 +12391,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
12193
12391
|
setDataToComponentId: componentId,
|
|
12194
12392
|
// tableHiddenOn: hiddenEmptyTable ? "this.$count === 0" : null,
|
|
12195
12393
|
appId: appId,
|
|
12196
|
-
crudClassName: '
|
|
12394
|
+
crudClassName: 'steedos-record-related-crud hidden',
|
|
12197
12395
|
refField,
|
|
12198
12396
|
...ctx
|
|
12199
12397
|
};
|
|
@@ -12206,7 +12404,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
12206
12404
|
amisSchema: {
|
|
12207
12405
|
type: "service",
|
|
12208
12406
|
id: componentId,
|
|
12209
|
-
className: `steedos-record-related-list
|
|
12407
|
+
className: `steedos-record-related-list mb-4 last:mb-0 ${componentId} ${className}`,
|
|
12210
12408
|
data: {
|
|
12211
12409
|
relatedKey: relatedKey,
|
|
12212
12410
|
listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
|
|
@@ -12398,11 +12596,44 @@ async function getRelatedListSchema(
|
|
|
12398
12596
|
};
|
|
12399
12597
|
}
|
|
12400
12598
|
|
|
12599
|
+
async function getObjectRelatedListsMiniSchema(objectApiName){
|
|
12600
|
+
const relatedLists = await getObjectRelatedList(objectApiName);
|
|
12601
|
+
|
|
12602
|
+
const relatedListsMiniSchema = [];
|
|
12603
|
+
|
|
12604
|
+
for (const relatedList of relatedLists) {
|
|
12605
|
+
relatedListsMiniSchema.push(
|
|
12606
|
+
{
|
|
12607
|
+
type: 'steedos-record-detail-list-mini',
|
|
12608
|
+
objectApiName: objectApiName,
|
|
12609
|
+
// recordId: recordId,
|
|
12610
|
+
formFactor: formFactor,
|
|
12611
|
+
relatedObjectApiName: relatedList.object_name,
|
|
12612
|
+
foreign_key: relatedList.foreign_key,
|
|
12613
|
+
relatedKey: relatedList.foreign_key,
|
|
12614
|
+
columns: relatedList.columns,
|
|
12615
|
+
sort: relatedList.sort,
|
|
12616
|
+
filters: relatedList.filters,
|
|
12617
|
+
visible_on: relatedList.visible_on,
|
|
12618
|
+
perPage: relatedList.page_size || perPage,
|
|
12619
|
+
hiddenEmptyTable: true,
|
|
12620
|
+
relatedLabel: relatedList.label
|
|
12621
|
+
}
|
|
12622
|
+
);
|
|
12623
|
+
}
|
|
12624
|
+
|
|
12625
|
+
return {
|
|
12626
|
+
type: 'wrapper',
|
|
12627
|
+
className: "steedos-record-detail-related-lists-mini",
|
|
12628
|
+
body: relatedListsMiniSchema
|
|
12629
|
+
}
|
|
12630
|
+
}
|
|
12631
|
+
|
|
12401
12632
|
/*
|
|
12402
12633
|
* @Author: baozhoutao@steedos.com
|
|
12403
12634
|
* @Date: 2022-07-05 15:55:39
|
|
12404
|
-
* @LastEditors:
|
|
12405
|
-
* @LastEditTime:
|
|
12635
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
12636
|
+
* @LastEditTime: 2024-01-16 11:14:34
|
|
12406
12637
|
* @Description:
|
|
12407
12638
|
*/
|
|
12408
12639
|
|
|
@@ -12574,7 +12805,7 @@ async function getField(objectName, fieldName) {
|
|
|
12574
12805
|
async function getFormSchema(objectName, ctx) {
|
|
12575
12806
|
const uiSchema = await getUISchema(objectName);
|
|
12576
12807
|
const amisSchema = await getObjectForm(uiSchema, ctx);
|
|
12577
|
-
console.log(`getFormSchema====>`, amisSchema)
|
|
12808
|
+
// console.log(`getFormSchema====>`, amisSchema)
|
|
12578
12809
|
return {
|
|
12579
12810
|
uiSchema,
|
|
12580
12811
|
amisSchema,
|
|
@@ -12900,110 +13131,164 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
12900
13131
|
"label": "对象表单",
|
|
12901
13132
|
"objectApiName": "${objectName}",
|
|
12902
13133
|
"recordId": "${recordId}",
|
|
12903
|
-
"id": "u:d4a495811d57",
|
|
12904
13134
|
appId: appId
|
|
12905
13135
|
}
|
|
12906
13136
|
],
|
|
12907
|
-
"id": "u:5d4e7e3f6ecc"
|
|
12908
13137
|
};
|
|
12909
13138
|
const related = {
|
|
12910
13139
|
"title": instance.t('frontend_record_detail_tab_related'),
|
|
12911
|
-
"className": "px-0
|
|
13140
|
+
"className": "px-0 py-4",
|
|
12912
13141
|
"body": [
|
|
12913
13142
|
{
|
|
12914
13143
|
"type": "steedos-object-related-lists",
|
|
12915
13144
|
"label": "相关列表",
|
|
12916
13145
|
"objectApiName": "${objectName}",
|
|
12917
13146
|
"recordId": "${recordId}",
|
|
12918
|
-
"id": "u:3b85b7b7a7f6",
|
|
12919
13147
|
appId: appId
|
|
12920
13148
|
}
|
|
12921
13149
|
],
|
|
12922
|
-
"id": "u:1a0326aeec2b"
|
|
12923
13150
|
};
|
|
12924
13151
|
const content = {
|
|
12925
13152
|
"type": "tabs",
|
|
12926
|
-
"className": "
|
|
13153
|
+
"className": "steedos-record-tabs bg-white p-4 mt-3 border-y",
|
|
13154
|
+
"contentClassName": "bg-none",
|
|
12927
13155
|
"tabs": [
|
|
12928
13156
|
detailed
|
|
12929
13157
|
],
|
|
12930
|
-
"id": "u:a649e4094a12"
|
|
12931
13158
|
};
|
|
12932
13159
|
if(relatedLists.length){
|
|
12933
13160
|
content.tabs.push(related);
|
|
12934
13161
|
}
|
|
13162
|
+
// content.tabs = reverse(content.tabs)
|
|
12935
13163
|
return {
|
|
12936
13164
|
uiSchema,
|
|
12937
13165
|
amisSchema: {
|
|
12938
|
-
"type": "service",
|
|
13166
|
+
"type": "steedos-record-service",
|
|
12939
13167
|
"body": [
|
|
12940
13168
|
{
|
|
12941
13169
|
"type": "steedos-record-detail-header",
|
|
12942
13170
|
"label": "标题面板",
|
|
12943
13171
|
"objectApiName": "${objectName}",
|
|
12944
13172
|
"recordId": "${recordId}",
|
|
12945
|
-
"id": "u:48d2c28eb755"
|
|
13173
|
+
"id": "u:48d2c28eb755",
|
|
13174
|
+
"showButtons": props.showButtons,
|
|
13175
|
+
"showBackButton": props.showBackButton,
|
|
12946
13176
|
},
|
|
12947
13177
|
content
|
|
12948
13178
|
],
|
|
12949
|
-
|
|
12950
|
-
|
|
12951
|
-
|
|
12952
|
-
},
|
|
12953
|
-
onEvent: {
|
|
12954
|
-
"recordLoaded": {
|
|
12955
|
-
"actions": [
|
|
12956
|
-
{
|
|
12957
|
-
"actionType": "reload",
|
|
12958
|
-
"data": {
|
|
12959
|
-
"name": `\${record.${uiSchema.NAME_FIELD_KEY || 'name'}}`,
|
|
12960
|
-
"_master.record": `\${record}`,
|
|
12961
|
-
// 不清楚reload 如何给对象下的某个key复制, 所以此处重复设置_master的objectName、recordId
|
|
12962
|
-
"_master.objectName": "${objectName}",
|
|
12963
|
-
"_master.recordId": "${recordId}"
|
|
12964
|
-
}
|
|
12965
|
-
}
|
|
12966
|
-
]
|
|
12967
|
-
},
|
|
12968
|
-
...props.onEvent
|
|
12969
|
-
},
|
|
13179
|
+
"objectApiName": "${objectName}",
|
|
13180
|
+
"recordId": "${recordId}",
|
|
13181
|
+
onEvent: props.onEvent,
|
|
12970
13182
|
}
|
|
12971
13183
|
}
|
|
12972
13184
|
}
|
|
12973
13185
|
|
|
12974
|
-
async function getRecordServiceSchema(objectName, appId, props = {}) {
|
|
13186
|
+
async function getRecordServiceSchema(objectName, appId, props = {}, body) {
|
|
12975
13187
|
const uiSchema = await getUISchema(objectName);
|
|
13188
|
+
const fields = _$1__default.values(uiSchema.fields);
|
|
13189
|
+
const serviceId = `u:steedos-record-service-${objectName}`;
|
|
12976
13190
|
return {
|
|
12977
13191
|
uiSchema,
|
|
12978
13192
|
amisSchema: {
|
|
12979
|
-
|
|
12980
|
-
"
|
|
12981
|
-
data: {
|
|
12982
|
-
"_master.objectName": "${objectName}",
|
|
12983
|
-
"_master.recordId": "${recordId}"
|
|
12984
|
-
},
|
|
12985
|
-
"style": {
|
|
12986
|
-
"padding": "var(--Page-body-padding)",
|
|
12987
|
-
...props.style
|
|
12988
|
-
},
|
|
13193
|
+
type: 'service',
|
|
13194
|
+
className: "p-0 m-0",
|
|
12989
13195
|
onEvent: {
|
|
12990
|
-
|
|
13196
|
+
[`@data.changed.${objectName}`]: {
|
|
12991
13197
|
"actions": [
|
|
12992
13198
|
{
|
|
12993
13199
|
"actionType": "reload",
|
|
12994
|
-
"
|
|
12995
|
-
|
|
12996
|
-
|
|
12997
|
-
|
|
12998
|
-
|
|
12999
|
-
|
|
13000
|
-
|
|
13200
|
+
"componentId": serviceId,
|
|
13201
|
+
"expression": "this.__deletedRecord != true"
|
|
13202
|
+
},
|
|
13203
|
+
{
|
|
13204
|
+
"actionType": "custom",
|
|
13205
|
+
"script": "window.goBack()",
|
|
13206
|
+
"expression": "this.__deletedRecord === true"
|
|
13001
13207
|
}
|
|
13002
13208
|
]
|
|
13003
13209
|
},
|
|
13004
|
-
|
|
13210
|
+
},
|
|
13211
|
+
body: {
|
|
13212
|
+
"type": "service",
|
|
13213
|
+
id: serviceId,
|
|
13214
|
+
className: 'steedos-record-service p-0',
|
|
13215
|
+
api: await getReadonlyFormInitApi(uiSchema, props.recordId, fields, props),
|
|
13216
|
+
body: {
|
|
13217
|
+
"type": "wrapper",
|
|
13218
|
+
"className": "p-0 m-0",
|
|
13219
|
+
"body": body || [],
|
|
13220
|
+
"hiddenOn": "${recordLoaded != true}"
|
|
13221
|
+
},
|
|
13222
|
+
data: {
|
|
13223
|
+
"_master.objectName": "${objectName}",
|
|
13224
|
+
"_master.recordId": "${recordId}",
|
|
13225
|
+
...(props.data || {})
|
|
13226
|
+
},
|
|
13227
|
+
"style": {
|
|
13228
|
+
// "padding": "var(--Page-body-padding)",
|
|
13229
|
+
...props.style
|
|
13230
|
+
},
|
|
13231
|
+
onEvent: {
|
|
13232
|
+
// 如果定义了fetchInited,则无法接收到广播事件@data.changed
|
|
13233
|
+
"fetchInited": {
|
|
13234
|
+
"weight": 0,
|
|
13235
|
+
"actions": [
|
|
13236
|
+
{
|
|
13237
|
+
actionType: 'broadcast',
|
|
13238
|
+
eventName: "recordLoaded",
|
|
13239
|
+
data: {
|
|
13240
|
+
objectName: "${event.data.__objectName}",
|
|
13241
|
+
record: "${event.data.record}"
|
|
13242
|
+
},
|
|
13243
|
+
expression: "${event.data.__response.error != true}"
|
|
13244
|
+
},
|
|
13245
|
+
]
|
|
13246
|
+
},
|
|
13247
|
+
...props.onEvent
|
|
13248
|
+
}
|
|
13005
13249
|
}
|
|
13006
13250
|
}
|
|
13251
|
+
|
|
13252
|
+
|
|
13253
|
+
}
|
|
13254
|
+
}
|
|
13255
|
+
|
|
13256
|
+
async function getRecordDetailMiniSchema(objectName, appId, props = {}){
|
|
13257
|
+
const uiSchema = await getUISchema(objectName);
|
|
13258
|
+
const fields = _$1__default.values(uiSchema.fields);
|
|
13259
|
+
|
|
13260
|
+
props.initApiAdaptor = 'payload.data=Object.assign({}, payload.data, payload.data.record); payload.data._finished=true; console.log("payload data is ====>", payload)';
|
|
13261
|
+
|
|
13262
|
+
// TODO 处理相关表
|
|
13263
|
+
// getObjectRelatedListsMiniSchema
|
|
13264
|
+
|
|
13265
|
+
return {
|
|
13266
|
+
type: "form",
|
|
13267
|
+
wrapWithPanel: false,
|
|
13268
|
+
actions: [],
|
|
13269
|
+
initApi: await getReadonlyFormInitApi(uiSchema, props.recordId, fields, props),
|
|
13270
|
+
body: {
|
|
13271
|
+
"type": "wrapper",
|
|
13272
|
+
"className": "p-0 m-0",
|
|
13273
|
+
"body": [
|
|
13274
|
+
{
|
|
13275
|
+
"type": "steedos-record-detail-header",
|
|
13276
|
+
"showButtons": false,
|
|
13277
|
+
"showBackButton": false,
|
|
13278
|
+
"objectApiName": "${objectName}",
|
|
13279
|
+
"recordId": "${recordId}",
|
|
13280
|
+
},
|
|
13281
|
+
// {
|
|
13282
|
+
// "type": "steedos-object-related-lists",
|
|
13283
|
+
// "label": "相关列表",
|
|
13284
|
+
// "objectApiName": "${objectName}",
|
|
13285
|
+
// "staticRecordId": "${recordId}",
|
|
13286
|
+
// formFactor: "SMALL",
|
|
13287
|
+
// appId: appId
|
|
13288
|
+
// }
|
|
13289
|
+
],
|
|
13290
|
+
"hiddenOn": "${_finished != true}"
|
|
13291
|
+
}
|
|
13007
13292
|
}
|
|
13008
13293
|
}
|
|
13009
13294
|
|
|
@@ -13566,17 +13851,13 @@ function getReferenceToSync(field) {
|
|
|
13566
13851
|
|
|
13567
13852
|
function getLookupSapceUserTreeSchema(isMobile){
|
|
13568
13853
|
let apiAdaptor = `
|
|
13569
|
-
// console.log("===getLookupSapceUserTreeSchema===", JSON.stringify(payload));
|
|
13570
13854
|
const records = payload.data.options;
|
|
13571
|
-
let isTreeOptionsComputed = false;
|
|
13572
|
-
if(records.length === 1 && records[0].children){
|
|
13573
|
-
isTreeOptionsComputed = true;
|
|
13574
|
-
}
|
|
13575
|
-
if(isTreeOptionsComputed){
|
|
13576
|
-
return payload;
|
|
13577
|
-
}
|
|
13578
13855
|
const treeRecords = [];
|
|
13579
|
-
const getChildren = (records, childrenIds) => {
|
|
13856
|
+
const getChildren = (currentRecord, records, childrenIds) => {
|
|
13857
|
+
if (currentRecord.children && typeof currentRecord.children[0] === "object") {
|
|
13858
|
+
// 考虑api配置了cache缓存的话,不会请求接口但是会重新进这个接收适配器脚本且payload.data.options返回的会是上一次计算结果,这里直接返回计算过的children
|
|
13859
|
+
return currentRecord.children;
|
|
13860
|
+
}
|
|
13580
13861
|
if (!childrenIds) {
|
|
13581
13862
|
return;
|
|
13582
13863
|
}
|
|
@@ -13585,7 +13866,7 @@ function getLookupSapceUserTreeSchema(isMobile){
|
|
|
13585
13866
|
});
|
|
13586
13867
|
_.each(children, (item) => {
|
|
13587
13868
|
if (item.children) {
|
|
13588
|
-
item.children = getChildren(records, item.children)
|
|
13869
|
+
item.children = getChildren(item, records, item.children)
|
|
13589
13870
|
}else{
|
|
13590
13871
|
item.children = [];
|
|
13591
13872
|
}
|
|
@@ -13611,7 +13892,7 @@ function getLookupSapceUserTreeSchema(isMobile){
|
|
|
13611
13892
|
|
|
13612
13893
|
_.each(records, (record) => {
|
|
13613
13894
|
if (record.noParent == 1) {
|
|
13614
|
-
treeRecords.push(Object.assign({}, record, { children: getChildren(records, record.children) }));
|
|
13895
|
+
treeRecords.push(Object.assign({}, record, { children: getChildren(record, records, record.children) }));
|
|
13615
13896
|
}
|
|
13616
13897
|
});
|
|
13617
13898
|
console.log(treeRecords)
|
|
@@ -13661,6 +13942,7 @@ function getLookupSapceUserTreeSchema(isMobile){
|
|
|
13661
13942
|
}
|
|
13662
13943
|
},
|
|
13663
13944
|
"label": "",
|
|
13945
|
+
"mode": "normal",
|
|
13664
13946
|
"name": "organizations",
|
|
13665
13947
|
"multiple": false,
|
|
13666
13948
|
"joinValues": false,
|
|
@@ -13803,6 +14085,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
13803
14085
|
}
|
|
13804
14086
|
});
|
|
13805
14087
|
|
|
14088
|
+
let listviewFilter = getListViewFilter(listView);
|
|
14089
|
+
let listviewFiltersFunction = listView && listView._filters;
|
|
14090
|
+
|
|
13806
14091
|
let sort = "";
|
|
13807
14092
|
if(listView){
|
|
13808
14093
|
sort = getListViewSort(listView);
|
|
@@ -13849,7 +14134,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
13849
14134
|
Object.assign(api.data.$self, __changedSearchBoxValues, __changedFilterFormValues);
|
|
13850
14135
|
}
|
|
13851
14136
|
const selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
13852
|
-
var filters = [];
|
|
14137
|
+
${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
|
|
13853
14138
|
var pageSize = api.data.pageSize || 10;
|
|
13854
14139
|
var pageNo = api.data.pageNo || 1;
|
|
13855
14140
|
var skip = (pageNo - 1) * pageSize;
|
|
@@ -13911,6 +14196,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
13911
14196
|
}
|
|
13912
14197
|
|
|
13913
14198
|
const inFilterForm = ${ctx.inFilterForm};
|
|
14199
|
+
|
|
14200
|
+
const listviewFiltersFunction = ${listviewFiltersFunction};
|
|
14201
|
+
|
|
14202
|
+
if(listviewFiltersFunction && !inFilterForm){
|
|
14203
|
+
const _filters0 = listviewFiltersFunction(filters, api.data.$self.__super);
|
|
14204
|
+
if(_filters0 && _filters0.length){
|
|
14205
|
+
filters.push(_filters0);
|
|
14206
|
+
}
|
|
14207
|
+
}
|
|
14208
|
+
|
|
13914
14209
|
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
13915
14210
|
|
|
13916
14211
|
if(filtersFunction && !inFilterForm){
|
|
@@ -14029,13 +14324,15 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
14029
14324
|
|
|
14030
14325
|
pickerSchema.affixHeader = false;
|
|
14031
14326
|
|
|
14032
|
-
|
|
14327
|
+
|
|
14328
|
+
|
|
14329
|
+
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { isLookup: true, keywordsSearchBoxName });
|
|
14330
|
+
|
|
14033
14331
|
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
|
|
14034
|
-
|
|
14332
|
+
pickerSchema.headerToolbar.push(getLookupSapceUserTreeSchema(isMobile));
|
|
14035
14333
|
pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
|
|
14036
14334
|
}
|
|
14037
|
-
|
|
14038
|
-
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
|
|
14335
|
+
|
|
14039
14336
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
14040
14337
|
const isCreate = _$1.isBoolean(field.create) ? field.create : true;
|
|
14041
14338
|
// lookup字段配置过滤条件就强制不显示新建按钮
|
|
@@ -14148,6 +14445,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
14148
14445
|
pickerSchema.footerToolbar = ["pagination"];
|
|
14149
14446
|
}
|
|
14150
14447
|
|
|
14448
|
+
if(field.inlineHelpText){
|
|
14449
|
+
pickerSchema.toolbarClassName = "hasHelpText";
|
|
14450
|
+
pickerSchema.headerToolbar = [{
|
|
14451
|
+
"type": "tpl",
|
|
14452
|
+
"tpl": field.inlineHelpText,
|
|
14453
|
+
"className": "text-secondary"
|
|
14454
|
+
}, ...pickerSchema.headerToolbar];
|
|
14455
|
+
}
|
|
14456
|
+
pickerSchema.className = (pickerSchema.className || "") + " steedos-lookup-crud";
|
|
14457
|
+
|
|
14151
14458
|
const data = {
|
|
14152
14459
|
type: getAmisStaticFieldType$1('picker', readonly),
|
|
14153
14460
|
modalTitle: instance.t('frontend_form_please_select') + " " + refObjectConfig.label,
|
|
@@ -14223,6 +14530,9 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
14223
14530
|
const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
|
|
14224
14531
|
let listView = getLookupListView(refObjectConfig);
|
|
14225
14532
|
|
|
14533
|
+
let listviewFilter = getListViewFilter(listView);
|
|
14534
|
+
let listviewFiltersFunction = listView && listView._filters;
|
|
14535
|
+
|
|
14226
14536
|
let sort = "";
|
|
14227
14537
|
if(listView){
|
|
14228
14538
|
sort = getListViewSort(listView);
|
|
@@ -14252,7 +14562,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
14252
14562
|
apiInfo.data['rfield'] = `\${object_name}`;
|
|
14253
14563
|
// [["_id", "=", "$${field.name}._id"],"or",["name", "contains", "$term"]]
|
|
14254
14564
|
apiInfo.requestAdaptor = `
|
|
14255
|
-
var filters = [];
|
|
14565
|
+
${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
|
|
14256
14566
|
var top = 200;
|
|
14257
14567
|
if(api.data.$term){
|
|
14258
14568
|
filters = [["${referenceTo?.NAME_FIELD_KEY || 'name'}", "contains", api.data.$term]];
|
|
@@ -14275,6 +14585,16 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
14275
14585
|
}
|
|
14276
14586
|
|
|
14277
14587
|
const inFilterForm = ${ctx.inFilterForm};
|
|
14588
|
+
|
|
14589
|
+
const listviewFiltersFunction = ${listviewFiltersFunction};
|
|
14590
|
+
|
|
14591
|
+
if(listviewFiltersFunction && !inFilterForm){
|
|
14592
|
+
const _filters0 = listviewFiltersFunction(filters, api.data.$);
|
|
14593
|
+
if(_filters0 && _filters0.length){
|
|
14594
|
+
filters.push(_filters0);
|
|
14595
|
+
}
|
|
14596
|
+
}
|
|
14597
|
+
|
|
14278
14598
|
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
14279
14599
|
|
|
14280
14600
|
if(filtersFunction && !inFilterForm){
|
|
@@ -14397,9 +14717,17 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
14397
14717
|
}
|
|
14398
14718
|
// console.log(`lookupToAmis====`, field, readonly, ctx)
|
|
14399
14719
|
if(readonly){
|
|
14400
|
-
|
|
14401
|
-
|
|
14402
|
-
|
|
14720
|
+
if(field.reference_to){
|
|
14721
|
+
return {
|
|
14722
|
+
type: 'steedos-field',
|
|
14723
|
+
config: field,
|
|
14724
|
+
static: true
|
|
14725
|
+
}
|
|
14726
|
+
}else {
|
|
14727
|
+
return {
|
|
14728
|
+
type: getAmisStaticFieldType$1('picker', readonly),
|
|
14729
|
+
tpl: getRelatedFieldTpl(field, ctx)
|
|
14730
|
+
}
|
|
14403
14731
|
}
|
|
14404
14732
|
}
|
|
14405
14733
|
if(field.reference_to && !_$1.isString(field.reference_to) && !readonly){
|
|
@@ -15051,13 +15379,31 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15051
15379
|
};
|
|
15052
15380
|
break;
|
|
15053
15381
|
case 'input-datetime-range':
|
|
15382
|
+
// convertData = {
|
|
15383
|
+
// type: "input-datetime-range",
|
|
15384
|
+
// inputFormat: 'YYYY-MM-DD HH:mm',
|
|
15385
|
+
// format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
15386
|
+
// tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
|
|
15387
|
+
// utc: true,
|
|
15388
|
+
// joinValues: false
|
|
15389
|
+
// }
|
|
15390
|
+
// 日期时间字段,按日期方式展现显示控件,用户不用关心小时分钟
|
|
15054
15391
|
convertData = {
|
|
15055
|
-
type: "input-
|
|
15056
|
-
inputFormat:
|
|
15392
|
+
type: "input-date-range",
|
|
15393
|
+
inputFormat: "YYYY-MM-DD HH:mm",
|
|
15057
15394
|
format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
15058
15395
|
tpl: readonly ? getDateTimeTpl(field) : null,
|
|
15059
15396
|
utc: true,
|
|
15060
|
-
joinValues: false
|
|
15397
|
+
joinValues: false,
|
|
15398
|
+
"shortcuts": [
|
|
15399
|
+
"thismonth",
|
|
15400
|
+
"2monthsago",
|
|
15401
|
+
"3monthslater",
|
|
15402
|
+
"prevquarter",
|
|
15403
|
+
"thisquarter",
|
|
15404
|
+
"thisyear",
|
|
15405
|
+
"lastYear"
|
|
15406
|
+
]
|
|
15061
15407
|
};
|
|
15062
15408
|
break;
|
|
15063
15409
|
case 'datetime':
|
|
@@ -15108,7 +15454,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15108
15454
|
convertData = {
|
|
15109
15455
|
type: getAmisStaticFieldType$1('datetime', readonly),
|
|
15110
15456
|
inputFormat: 'YYYY-MM-DD HH:mm',
|
|
15111
|
-
format: 'YYYY-MM-DDTHH:mm:
|
|
15457
|
+
format: 'YYYY-MM-DDTHH:mm:00.000Z',
|
|
15112
15458
|
tpl: readonly ? getDateTimeTpl(field) : null,
|
|
15113
15459
|
utc: true,
|
|
15114
15460
|
};
|
|
@@ -15239,6 +15585,36 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15239
15585
|
convertData = {
|
|
15240
15586
|
type: 'static-text'
|
|
15241
15587
|
};
|
|
15588
|
+
}else if(field.autonumber_enable_modify){
|
|
15589
|
+
convertData = {
|
|
15590
|
+
"type": "input-group",
|
|
15591
|
+
"body": [
|
|
15592
|
+
{
|
|
15593
|
+
"type": "input-text",
|
|
15594
|
+
"name": field.name
|
|
15595
|
+
},
|
|
15596
|
+
{
|
|
15597
|
+
"type": "button",
|
|
15598
|
+
"label": "自动获取",
|
|
15599
|
+
"actionType": "ajax",
|
|
15600
|
+
"api": {
|
|
15601
|
+
"url": `\${context.rootUrl}/api/autonumber/generator/\${objectName}/${field.name}`,
|
|
15602
|
+
"method": "post",
|
|
15603
|
+
"headers": {
|
|
15604
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
15605
|
+
},
|
|
15606
|
+
"adaptor": `
|
|
15607
|
+
payload.data["${field.name}"] = payload.data && payload.data.autonumber;
|
|
15608
|
+
delete payload.data.autonumber;
|
|
15609
|
+
return payload;
|
|
15610
|
+
`
|
|
15611
|
+
},
|
|
15612
|
+
"messages": {
|
|
15613
|
+
"success": "获取成功"
|
|
15614
|
+
}
|
|
15615
|
+
}
|
|
15616
|
+
]
|
|
15617
|
+
};
|
|
15242
15618
|
}
|
|
15243
15619
|
break;
|
|
15244
15620
|
case 'url':
|
|
@@ -15393,11 +15769,9 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15393
15769
|
if(field.subFields){
|
|
15394
15770
|
convertData = {
|
|
15395
15771
|
type: 'steedos-input-table',
|
|
15396
|
-
showIndex: true,
|
|
15397
15772
|
editable: !readonly,
|
|
15398
15773
|
addable: !readonly,
|
|
15399
15774
|
removable: !readonly,
|
|
15400
|
-
draggable: !readonly,
|
|
15401
15775
|
fields: [],
|
|
15402
15776
|
amis:{
|
|
15403
15777
|
columnsTogglable: false
|
|
@@ -15449,9 +15823,9 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15449
15823
|
if(field.is_wide || convertData.type === 'group'){
|
|
15450
15824
|
convertData.className = 'col-span-2 m-0';
|
|
15451
15825
|
}else {
|
|
15452
|
-
convertData.className = 'm-
|
|
15826
|
+
convertData.className = 'm-0';
|
|
15453
15827
|
}
|
|
15454
|
-
if(readonly){
|
|
15828
|
+
if(readonly && ctx.mode !== 'edit'){
|
|
15455
15829
|
convertData.className = `${convertData.className} border-b`;
|
|
15456
15830
|
}
|
|
15457
15831
|
if(readonly){
|
|
@@ -15474,6 +15848,10 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15474
15848
|
}
|
|
15475
15849
|
}
|
|
15476
15850
|
|
|
15851
|
+
if(ctx.amisData && ctx.amisData._master && ctx.amisData._master.relatedKey === field.name){
|
|
15852
|
+
convertData.className = `${convertData.className || ''} hidden`;
|
|
15853
|
+
}
|
|
15854
|
+
|
|
15477
15855
|
if(_$1.isString(baseData.required)){
|
|
15478
15856
|
if(baseData.required.startsWith("{{")){
|
|
15479
15857
|
baseData.requiredOn = `${baseData.required.substring(2, baseData.required.length -2).replace(/formData./g, 'data.')}`;
|
|
@@ -15542,8 +15920,9 @@ async function getFieldSearchable(perField, permissionFields, ctx){
|
|
|
15542
15920
|
fieldNamePrefix = `${fieldNamePrefix}between__`;
|
|
15543
15921
|
}
|
|
15544
15922
|
if(_field.type === 'datetime'){
|
|
15545
|
-
//
|
|
15546
|
-
|
|
15923
|
+
// 这里如果想把搜索范围展示效果改为日期范围,不可以直接改为input-date-range,因为它们规则不一样,包括时区规则和小时分秒的存值规则都不一样
|
|
15924
|
+
// 所以想改为展示日期范围效果,只能改input-datetime-range类型本身的属性来实现
|
|
15925
|
+
_field.type = 'input-datetime-range';
|
|
15547
15926
|
_field.is_wide = true;
|
|
15548
15927
|
fieldNamePrefix = `${fieldNamePrefix}between__`;
|
|
15549
15928
|
}
|
|
@@ -15729,6 +16108,13 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
|
|
|
15729
16108
|
}
|
|
15730
16109
|
}
|
|
15731
16110
|
|
|
16111
|
+
fieldSetBody.forEach((field)=>{
|
|
16112
|
+
//判断label是否存在,不存在时将label的空占位元素隐藏
|
|
16113
|
+
if(!field.label){
|
|
16114
|
+
field.labelClassName = "none";
|
|
16115
|
+
}
|
|
16116
|
+
});
|
|
16117
|
+
|
|
15732
16118
|
// fieldSet 已支持显隐控制
|
|
15733
16119
|
const sectionFieldsVisibleOn = _$1.map(_$1.compact(_$1.map(fieldSetBody, 'visibleOn')), (visibleOn) => {
|
|
15734
16120
|
let visible = visibleOn;
|
|
@@ -15851,19 +16237,200 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
15851
16237
|
return await getSections(permissionFields, formFields, ctx);
|
|
15852
16238
|
}
|
|
15853
16239
|
|
|
16240
|
+
/*
|
|
16241
|
+
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
16242
|
+
* @Date: 2024-01-18 15:12:41
|
|
16243
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
16244
|
+
* @LastEditTime: 2024-01-18 15:12:49
|
|
16245
|
+
*/
|
|
16246
|
+
/**
|
|
16247
|
+
* 生成符合标准uuid格式的36位满足唯一性的随机串
|
|
16248
|
+
* @returns uuid
|
|
16249
|
+
*/
|
|
16250
|
+
function uuidv4() {
|
|
16251
|
+
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, c =>
|
|
16252
|
+
(c ^ window.crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
|
16253
|
+
);
|
|
16254
|
+
}
|
|
16255
|
+
|
|
15854
16256
|
/*
|
|
15855
16257
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
15856
16258
|
* @Date: 2023-11-15 09:50:22
|
|
15857
|
-
* @LastEditors:
|
|
15858
|
-
* @LastEditTime: 2024-01-
|
|
16259
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
16260
|
+
* @LastEditTime: 2024-01-26 17:47:16
|
|
16261
|
+
*/
|
|
16262
|
+
|
|
16263
|
+
/**
|
|
16264
|
+
* 子表组件字段值中每行数据补上字段值为空的的字段值,把值统一设置为空字符串,是为了解决amis amis 3.6/6.0 input-table组件bug:行中字段值为空时会显示为父作用域中的同名变量值,见:https://github.com/baidu/amis/issues/9520
|
|
16265
|
+
* amis #9520修正后此函数及相关代码可以移除
|
|
16266
|
+
* @param {*} value 子表组件字段值,数组
|
|
16267
|
+
* @param {*} fields 子表组件fields属性,数组
|
|
16268
|
+
* @returns 转换后的子表组件字段值
|
|
16269
|
+
*/
|
|
16270
|
+
function getTableValueWithEmptyValue(value, fields) {
|
|
16271
|
+
return (value || []).map((itemValue) => {
|
|
16272
|
+
//这里不clone的话,会造成在pipeIn函数执行该函数后像pipeOut一样最终输出到表单项中,即库里字段值会被改了
|
|
16273
|
+
const newItemValue = clone(itemValue);
|
|
16274
|
+
(fields || []).forEach((itemField) => {
|
|
16275
|
+
if(itemField.name && (newItemValue[itemField.name] === undefined || newItemValue[itemField.name] === null)){
|
|
16276
|
+
// 这里newItemValue中不存在 itemField.name 属性,或者值为null时都会有“显示为父作用域中的同名变量值”的问题,所以null和undefined都要重置为空字符串
|
|
16277
|
+
// 实测数字、下拉框、多选lookup等字段类型重置为空字符串都不会有问题,而且实测amis from组件的清空表单字段值功能就是把表单中的各种字段类型设置为空字符串,所以看起来也符合amis规范
|
|
16278
|
+
newItemValue[itemField.name] = "";
|
|
16279
|
+
}
|
|
16280
|
+
if (newItemValue.children) {
|
|
16281
|
+
newItemValue.children = getTableValueWithEmptyValue(newItemValue.children, fields);
|
|
16282
|
+
}
|
|
16283
|
+
});
|
|
16284
|
+
return newItemValue;
|
|
16285
|
+
});
|
|
16286
|
+
}
|
|
16287
|
+
|
|
16288
|
+
/**
|
|
16289
|
+
* 把子表组件字段值中每行数据中经过上面getTableValueWithEmptyValue函数空字段值移除
|
|
16290
|
+
* amis #9520修正后此函数及相关代码可以移除
|
|
16291
|
+
* @param {*} value 子表组件字段值,数组
|
|
16292
|
+
* @param {*} fields 子表组件fields属性,数组
|
|
16293
|
+
* @returns 转换后的子表组件字段值
|
|
16294
|
+
*/
|
|
16295
|
+
function getTableValueWithoutEmptyValue(value, fields) {
|
|
16296
|
+
return (value || []).map((itemValue) => {
|
|
16297
|
+
const newItemValue = clone(itemValue);
|
|
16298
|
+
(fields || []).forEach((itemField) => {
|
|
16299
|
+
if(itemField.name && (newItemValue[itemField.name] === "" || newItemValue[itemField.name] === undefined || newItemValue[itemField.name] === null)){
|
|
16300
|
+
// 这里额外把null和undefined值也删除掉纯粹是没必要输出保存它们
|
|
16301
|
+
delete newItemValue[itemField.name];
|
|
16302
|
+
}
|
|
16303
|
+
if (newItemValue.children) {
|
|
16304
|
+
newItemValue.children = getTableValueWithoutEmptyValue(newItemValue.children, fields);
|
|
16305
|
+
}
|
|
16306
|
+
});
|
|
16307
|
+
return newItemValue;
|
|
16308
|
+
});
|
|
16309
|
+
}
|
|
16310
|
+
|
|
16311
|
+
function getTablePrimaryKey(props) {
|
|
16312
|
+
return props.primaryKey || "_id";
|
|
16313
|
+
}
|
|
16314
|
+
|
|
16315
|
+
/**
|
|
16316
|
+
* 子表组件字段值中每行数据的补上唯一标识字段值,其值为随机uuid
|
|
16317
|
+
* @param {*} value 子表组件字段值,数组
|
|
16318
|
+
* @param {*} primaryKey 主键字段名,一般为_id
|
|
16319
|
+
* @returns 转换后的子表组件字段值
|
|
16320
|
+
*/
|
|
16321
|
+
function getTableValueWithPrimaryKeyValue(value, primaryKey) {
|
|
16322
|
+
if (!primaryKey) {
|
|
16323
|
+
return value;
|
|
16324
|
+
}
|
|
16325
|
+
return (value || []).map((itemValue) => {
|
|
16326
|
+
//这里不clone的话,会造成在pipeIn函数执行该函数后像pipeOut一样最终输出到表单项中,即库里把primaryKey字段值保存了
|
|
16327
|
+
const newItemValue = clone(itemValue);
|
|
16328
|
+
if (newItemValue[primaryKey]) {
|
|
16329
|
+
if (newItemValue.children) {
|
|
16330
|
+
newItemValue.children = getTableValueWithPrimaryKeyValue(newItemValue.children, primaryKey);
|
|
16331
|
+
}
|
|
16332
|
+
return newItemValue;
|
|
16333
|
+
}
|
|
16334
|
+
else {
|
|
16335
|
+
newItemValue[primaryKey] = uuidv4();
|
|
16336
|
+
if (newItemValue.children) {
|
|
16337
|
+
newItemValue.children = getTableValueWithPrimaryKeyValue(newItemValue.children, primaryKey);
|
|
16338
|
+
}
|
|
16339
|
+
return newItemValue;
|
|
16340
|
+
}
|
|
16341
|
+
});
|
|
16342
|
+
}
|
|
16343
|
+
|
|
16344
|
+
/**
|
|
16345
|
+
* 子表组件字段值中每行数据的移除唯一标识字段值,因为该字段值一般只作临时标记,不存库
|
|
16346
|
+
* @param {*} value 子表组件字段值,数组
|
|
16347
|
+
* @param {*} primaryKey 主键字段名,一般为_id
|
|
16348
|
+
* @returns 转换后的子表组件字段值
|
|
16349
|
+
*/
|
|
16350
|
+
function getTableValueWithoutPrimaryKeyValue(value, primaryKey) {
|
|
16351
|
+
if (!primaryKey) {
|
|
16352
|
+
return value;
|
|
16353
|
+
}
|
|
16354
|
+
return (value || []).map((itemValue) => {
|
|
16355
|
+
//这里clone只是为了保险,不是必须的,每次修改子表数据是否都会生成新的primaryKey字段值是由pipeOut中识别autoGeneratePrimaryKeyValue决定的,跟这里没关系
|
|
16356
|
+
const newItemValue = clone(itemValue);
|
|
16357
|
+
if (newItemValue.children) {
|
|
16358
|
+
newItemValue.children = getTableValueWithoutPrimaryKeyValue(newItemValue.children, primaryKey);
|
|
16359
|
+
}
|
|
16360
|
+
delete newItemValue[primaryKey];
|
|
16361
|
+
return newItemValue;
|
|
16362
|
+
});
|
|
16363
|
+
}
|
|
16364
|
+
|
|
16365
|
+
/**
|
|
16366
|
+
* 子表组件字段值中每行数据的键值key移除指定前缀
|
|
16367
|
+
* @param {*} value 子表组件字段值,数组
|
|
16368
|
+
* @param {*} fieldPrefix 字段前缀
|
|
16369
|
+
* @returns 转换后的子表组件字段值
|
|
15859
16370
|
*/
|
|
16371
|
+
function getTableValueWithoutFieldPrefix(value, fieldPrefix) {
|
|
16372
|
+
let convertedValue = [];
|
|
16373
|
+
(value || []).forEach((itemValue) => {
|
|
16374
|
+
var newItemValue = {};
|
|
16375
|
+
for (let n in itemValue) {
|
|
16376
|
+
if (itemValue.hasOwnProperty(n)) {
|
|
16377
|
+
newItemValue[n.replace(new RegExp(`^${fieldPrefix}`), "")] = itemValue[n];
|
|
16378
|
+
}
|
|
16379
|
+
}
|
|
16380
|
+
convertedValue.push(newItemValue);
|
|
16381
|
+
});
|
|
16382
|
+
return convertedValue;
|
|
16383
|
+
}
|
|
16384
|
+
|
|
16385
|
+
/**
|
|
16386
|
+
* 子表组件字段值中每行数据的键值key补上指定前缀
|
|
16387
|
+
* @param {*} value 子表组件字段值,数组
|
|
16388
|
+
* @param {*} fieldPrefix 字段前缀
|
|
16389
|
+
* @param {*} primaryKey 主键字段名,主键不参与被键值key规则,需要排除,审批王amis表单也是这个规则
|
|
16390
|
+
* @returns 转换后的子表组件字段值
|
|
16391
|
+
*/
|
|
16392
|
+
function getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey) {
|
|
16393
|
+
let convertedValue = [];
|
|
16394
|
+
(value || []).forEach((itemValue) => {
|
|
16395
|
+
var newItemValue = {};
|
|
16396
|
+
for (let n in itemValue) {
|
|
16397
|
+
if (itemValue.hasOwnProperty(n) && typeof itemValue[n] !== undefined && n !== primaryKey) {
|
|
16398
|
+
newItemValue[`${fieldPrefix}${n}`] = itemValue[n];
|
|
16399
|
+
}
|
|
16400
|
+
}
|
|
16401
|
+
if (primaryKey && itemValue[primaryKey]) {
|
|
16402
|
+
newItemValue[primaryKey] = itemValue[primaryKey];
|
|
16403
|
+
}
|
|
16404
|
+
convertedValue.push(newItemValue);
|
|
16405
|
+
});
|
|
16406
|
+
return convertedValue;
|
|
16407
|
+
}
|
|
16408
|
+
|
|
16409
|
+
/**
|
|
16410
|
+
* 子表组件字段集合属性中每个字段name移除指定前缀
|
|
16411
|
+
* @param {*} fields 子表组件字段集合,数组
|
|
16412
|
+
* @param {*} fieldPrefix 字段前缀
|
|
16413
|
+
* @returns 转换后的子表组件字段值
|
|
16414
|
+
*/
|
|
16415
|
+
function getTableFieldsWithoutFieldPrefix(fields, fieldPrefix) {
|
|
16416
|
+
return (fields || []).map((item) => {
|
|
16417
|
+
const newItem = clone(item);//这里不clone的话,会造成子表组件重新render,从而审批王那边点开子表行编辑窗口时报错
|
|
16418
|
+
newItem.name = newItem.name.replace(new RegExp(`^${fieldPrefix}`), "");
|
|
16419
|
+
return newItem;
|
|
16420
|
+
});
|
|
16421
|
+
}
|
|
15860
16422
|
|
|
15861
16423
|
/**
|
|
15862
16424
|
* @param {*} props
|
|
15863
16425
|
* @param {*} mode edit/new/readonly
|
|
15864
16426
|
*/
|
|
15865
16427
|
function getFormFields(props, mode = "edit") {
|
|
15866
|
-
|
|
16428
|
+
let fieldPrefix = props.fieldPrefix;
|
|
16429
|
+
let fields = props.fields || [];
|
|
16430
|
+
if (fieldPrefix) {
|
|
16431
|
+
fields = getTableFieldsWithoutFieldPrefix(fields, fieldPrefix);
|
|
16432
|
+
}
|
|
16433
|
+
return (fields || []).map(function (item) {
|
|
15867
16434
|
let formItem = {
|
|
15868
16435
|
"type": "steedos-field",
|
|
15869
16436
|
"name": item.name,
|
|
@@ -15883,6 +16450,7 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
15883
16450
|
name: field.name,
|
|
15884
16451
|
quickEdit: {
|
|
15885
16452
|
"type": "steedos-field",
|
|
16453
|
+
"mode": "inline",
|
|
15886
16454
|
"config": Object.assign({}, field, {
|
|
15887
16455
|
label: false
|
|
15888
16456
|
})
|
|
@@ -15935,7 +16503,12 @@ async function getInputTableColumns(props) {
|
|
|
15935
16503
|
let inlineEditMode = props.inlineEditMode;
|
|
15936
16504
|
let showAsInlineEditMode = inlineEditMode && props.editable;
|
|
15937
16505
|
// 实测过,直接不生成对应的隐藏column并不会对input-table值造成丢失问题,隐藏的列字段值能正常维护
|
|
15938
|
-
|
|
16506
|
+
|
|
16507
|
+
let fieldPrefix = props.fieldPrefix;
|
|
16508
|
+
let fields = props.fields || [];
|
|
16509
|
+
if (fieldPrefix) {
|
|
16510
|
+
fields = getTableFieldsWithoutFieldPrefix(fields, fieldPrefix);
|
|
16511
|
+
}
|
|
15939
16512
|
if (columns && columns.length) {
|
|
15940
16513
|
return columns.map(function (column) {
|
|
15941
16514
|
let field, extendColumnProps = {};
|
|
@@ -15957,8 +16530,26 @@ async function getInputTableColumns(props) {
|
|
|
15957
16530
|
}
|
|
15958
16531
|
}
|
|
15959
16532
|
if (field) {
|
|
15960
|
-
let
|
|
15961
|
-
|
|
16533
|
+
let mode = typeof extendColumnProps.inlineEditMode === "boolean" ?
|
|
16534
|
+
extendColumnProps.inlineEditMode : showAsInlineEditMode;
|
|
16535
|
+
let tableCell = getInputTableCell(field, mode);
|
|
16536
|
+
let className = "";
|
|
16537
|
+
//判断是否换行,目前规则默认换行
|
|
16538
|
+
if(extendColumnProps.wrap != true){
|
|
16539
|
+
className += " whitespace-nowrap ";
|
|
16540
|
+
}else {
|
|
16541
|
+
className += " break-words ";
|
|
16542
|
+
}
|
|
16543
|
+
//合并classname
|
|
16544
|
+
if (typeof extendColumnProps.className == "object") {
|
|
16545
|
+
className = {
|
|
16546
|
+
[className]: "true",
|
|
16547
|
+
...extendColumnProps.className
|
|
16548
|
+
};
|
|
16549
|
+
} else if (typeof extendColumnProps.className == "string") {
|
|
16550
|
+
className = `${className} ${extendColumnProps.className} `;
|
|
16551
|
+
}
|
|
16552
|
+
return Object.assign({}, tableCell, extendColumnProps, {className});
|
|
15962
16553
|
}
|
|
15963
16554
|
else {
|
|
15964
16555
|
return column;
|
|
@@ -15968,6 +16559,7 @@ async function getInputTableColumns(props) {
|
|
|
15968
16559
|
else {
|
|
15969
16560
|
return fields.map(function (field) {
|
|
15970
16561
|
let tableCell = getInputTableCell(field, showAsInlineEditMode);
|
|
16562
|
+
tableCell.className = " whitespace-nowrap ";
|
|
15971
16563
|
return tableCell;
|
|
15972
16564
|
}) || [];
|
|
15973
16565
|
}
|
|
@@ -15980,7 +16572,7 @@ async function getInputTableColumns(props) {
|
|
|
15980
16572
|
*/
|
|
15981
16573
|
function getFormPagination(props, mode) {
|
|
15982
16574
|
let showPagination = true;
|
|
15983
|
-
if(mode === "new" && !!!props.editable){
|
|
16575
|
+
if (mode === "new" && !!!props.editable) {
|
|
15984
16576
|
//不允许编辑只允许新建时不应该让用户操作翻页
|
|
15985
16577
|
showPagination = false;
|
|
15986
16578
|
}
|
|
@@ -15996,23 +16588,41 @@ function getFormPagination(props, mode) {
|
|
|
15996
16588
|
let __formId = "${formId}";
|
|
15997
16589
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
15998
16590
|
let pageChangeDirection = context.props.pageChangeDirection;
|
|
16591
|
+
let mode = "${mode}";
|
|
15999
16592
|
// event.data中的index和__page分别表示当前要把表单数据提交到的行索引和用于标定下一页页码的当前页页码
|
|
16000
16593
|
// 一般来说__page = index + 1,但是可以让event.data中传入__page和index值不是这种联系。
|
|
16001
16594
|
// 比如__page设置为3,index设置为0表示把当前表单数据提交到第一页,但是跳转到第4页,弹出的表单中底下的新增和复制按钮依赖了此功能
|
|
16002
16595
|
// let currentPage = currentIndex + 1;
|
|
16003
16596
|
let currentPage = event.data.__page;
|
|
16004
16597
|
let currentIndex = event.data.index;
|
|
16005
|
-
|
|
16006
|
-
|
|
16007
|
-
|
|
16008
|
-
|
|
16009
|
-
|
|
16010
|
-
|
|
16011
|
-
|
|
16012
|
-
|
|
16013
|
-
|
|
16598
|
+
if(mode !== "readonly"){
|
|
16599
|
+
// 新建编辑时,翻页才需要把当前页表单保存,只读时直接翻页即可
|
|
16600
|
+
// 翻页到下一页之前需要先把当前页改动的内容保存到中间变量__tableItems中
|
|
16601
|
+
let currentFormValues = scope.getComponentById(__formId).getValues();
|
|
16602
|
+
// 这里不clone的话,其值会带上__super属性
|
|
16603
|
+
currentFormValues = _.clone(currentFormValues);
|
|
16604
|
+
var parent = event.data.parent;
|
|
16605
|
+
var __parentIndex = event.data.__parentIndex;
|
|
16606
|
+
if(parent){
|
|
16607
|
+
fieldValue[__parentIndex].children[currentIndex] = currentFormValues;
|
|
16608
|
+
// 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
|
|
16609
|
+
fieldValue[__parentIndex] = Object.assign({}, fieldValue[__parentIndex], {
|
|
16610
|
+
children: fieldValue[__parentIndex].children,
|
|
16611
|
+
__fix_rerender_after_children_modified_tag: new Date().getTime()
|
|
16612
|
+
});
|
|
16014
16613
|
}
|
|
16015
|
-
|
|
16614
|
+
else{
|
|
16615
|
+
fieldValue[currentIndex] = currentFormValues;
|
|
16616
|
+
}
|
|
16617
|
+
// 翻页到下一页前需要同时把改动的内容保存到最终正式的表单字段中,所以额外给正式表单字段执行一次setValue
|
|
16618
|
+
doAction({
|
|
16619
|
+
"componentId": "${props.id}",
|
|
16620
|
+
"actionType": "setValue",
|
|
16621
|
+
"args": {
|
|
16622
|
+
"value": fieldValue
|
|
16623
|
+
}
|
|
16624
|
+
});
|
|
16625
|
+
}
|
|
16016
16626
|
|
|
16017
16627
|
// 以下是翻页逻辑,翻到下一页并把下一页内容显示到表单上
|
|
16018
16628
|
let targetPage;
|
|
@@ -16061,9 +16671,14 @@ function getFormPagination(props, mode) {
|
|
|
16061
16671
|
"onEvent": {
|
|
16062
16672
|
"click": {
|
|
16063
16673
|
"actions": [
|
|
16674
|
+
{
|
|
16675
|
+
"actionType": "validate",
|
|
16676
|
+
"componentId": formId
|
|
16677
|
+
},
|
|
16064
16678
|
{
|
|
16065
16679
|
"actionType": "custom",
|
|
16066
|
-
"script": onPageChangeScript
|
|
16680
|
+
"script": onPageChangeScript,
|
|
16681
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
16067
16682
|
}
|
|
16068
16683
|
]
|
|
16069
16684
|
}
|
|
@@ -16071,7 +16686,8 @@ function getFormPagination(props, mode) {
|
|
|
16071
16686
|
},
|
|
16072
16687
|
{
|
|
16073
16688
|
"type": "tpl",
|
|
16074
|
-
|
|
16689
|
+
// 这里用__super.parent,加__super是为了防止当前记录有字段名为parent的重名变量
|
|
16690
|
+
"tpl": "${__page}/${__super.parent ? COMPACT(__tableItems[__parentIndex]['children']).length : COMPACT(__tableItems).length}"
|
|
16075
16691
|
},
|
|
16076
16692
|
{
|
|
16077
16693
|
"type": "button",
|
|
@@ -16079,15 +16695,22 @@ function getFormPagination(props, mode) {
|
|
|
16079
16695
|
"icon": `fa fa-angle-right`,
|
|
16080
16696
|
"level": "link",
|
|
16081
16697
|
"pageChangeDirection": "next",
|
|
16082
|
-
"disabledOn": showPagination ? "${__page >= __tableItems.length}" : "true",
|
|
16698
|
+
// "disabledOn": showPagination ? "${__page >= __tableItems.length}" : "true",
|
|
16699
|
+
// 这里用__super.parent,加__super是为了防止当前记录有字段名为parent的重名变量
|
|
16700
|
+
"disabledOn": showPagination ? "${__page >= (__super.parent ? COMPACT(__tableItems[__parentIndex]['children']).length : COMPACT(__tableItems).length)}" : "true",
|
|
16083
16701
|
"size": "sm",
|
|
16084
16702
|
"id": buttonNextId,
|
|
16085
16703
|
"onEvent": {
|
|
16086
16704
|
"click": {
|
|
16087
16705
|
"actions": [
|
|
16706
|
+
{
|
|
16707
|
+
"actionType": "validate",
|
|
16708
|
+
"componentId": formId
|
|
16709
|
+
},
|
|
16088
16710
|
{
|
|
16089
16711
|
"actionType": "custom",
|
|
16090
|
-
"script": onPageChangeScript
|
|
16712
|
+
"script": onPageChangeScript,
|
|
16713
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
16091
16714
|
}
|
|
16092
16715
|
]
|
|
16093
16716
|
}
|
|
@@ -16108,18 +16731,19 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16108
16731
|
// console.log("==getFormPaginationWrapper===", props, mode);
|
|
16109
16732
|
let serviceId = getComponentId("form_pagination", props.id);
|
|
16110
16733
|
let tableServiceId = getComponentId("table_service", props.id);
|
|
16734
|
+
let primaryKey = getTablePrimaryKey(props);
|
|
16111
16735
|
let innerForm = Object.assign({}, form, {
|
|
16112
16736
|
"data": {
|
|
16113
16737
|
// 这里加__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
|
|
16114
16738
|
// 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
|
|
16115
|
-
"&": "${__tableItems[__super.index]}"
|
|
16739
|
+
"&": "${__super.parent ? __tableItems[__parentIndex]['children'][__super.index] : __tableItems[__super.index]}"
|
|
16116
16740
|
}
|
|
16117
16741
|
});
|
|
16118
16742
|
let formBody = [
|
|
16119
16743
|
{
|
|
16120
16744
|
"type": "wrapper",
|
|
16121
16745
|
"size": "none",
|
|
16122
|
-
"className": "flex justify-end sticky top-0 right-0 left-0 z-20 bg-white
|
|
16746
|
+
"className": "flex justify-end sticky top-0 right-0 left-0 z-20 bg-white",
|
|
16123
16747
|
"body": [
|
|
16124
16748
|
getFormPagination(props, mode)
|
|
16125
16749
|
]
|
|
@@ -16135,7 +16759,7 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16135
16759
|
}
|
|
16136
16760
|
];
|
|
16137
16761
|
let onServiceInitedScript = `
|
|
16138
|
-
//
|
|
16762
|
+
// 以下脚本解决了有时弹出编辑表单时,表单中的值比最后一次编辑保存的值会延迟一拍。
|
|
16139
16763
|
// 比如:inlineEditMode模式时,用户在表格单元格中直接修改数据,然后弹出的表单form中并没有包含单元格中修改的内容
|
|
16140
16764
|
// 另外有的地方在非inlineEditMode模式时也会有这种延迟一拍问题,比如对象字段中下拉框类型字段的”选择项“属性
|
|
16141
16765
|
// 再比如工作流规则详细页面修改了子表字段”时间触发器“值后,在只读界面点击查看按钮弹出的表单中__tableItems值是修改前的值
|
|
@@ -16148,8 +16772,13 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16148
16772
|
// 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
16149
16773
|
// 这里如果不.clone的话,在弹出窗口中显示的子表组件,添加行后点窗口的取消按钮关闭窗口后无法把之前的操作还原,即把之前添加的行自动移除
|
|
16150
16774
|
let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"] || []);
|
|
16775
|
+
let fieldPrefix = "${props.fieldPrefix || ''}";
|
|
16776
|
+
if(fieldPrefix){
|
|
16777
|
+
let getTableValueWithoutFieldPrefix = new Function('v', 'f', "return (" + ${getTableValueWithoutFieldPrefix.toString()} + ")(v, f)");
|
|
16778
|
+
lastestFieldValue = getTableValueWithoutFieldPrefix(lastestFieldValue, fieldPrefix);
|
|
16779
|
+
}
|
|
16151
16780
|
//不可以直接像event.data.__tableItems = lastestFieldValue; 这样整个赋值,否则作用域会断
|
|
16152
|
-
let mode = "${mode}";
|
|
16781
|
+
let mode = "${mode || ''}";
|
|
16153
16782
|
if(mode === "new"){
|
|
16154
16783
|
// 点击子表组件底部新增按钮时新增一条空白行并自动翻页到新增行
|
|
16155
16784
|
// 注意点击弹出的子表行详细表单中的新增按钮不会进此service init事件函数中
|
|
@@ -16170,6 +16799,26 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16170
16799
|
event.data.__tableItems.forEach(function(n,i){
|
|
16171
16800
|
event.data.__tableItems[i] = lastestFieldValue[i];
|
|
16172
16801
|
});
|
|
16802
|
+
|
|
16803
|
+
var parent = event.data.parent;
|
|
16804
|
+
var fieldValue = event.data.__tableItems;
|
|
16805
|
+
if(parent){
|
|
16806
|
+
// 如果是子行,即在节点嵌套情况下,当前节点如果是children属性下的子节点时,则算出其所属父行的索引值
|
|
16807
|
+
var primaryKey = "${primaryKey}";
|
|
16808
|
+
event.data.__parentIndex = _.findIndex(fieldValue, function(item){
|
|
16809
|
+
return item[primaryKey] == parent[primaryKey];
|
|
16810
|
+
});
|
|
16811
|
+
if(event.data.__parentIndex < 0){
|
|
16812
|
+
let tableId = "${props.id}";
|
|
16813
|
+
let table = scope.getComponentById(tableId)
|
|
16814
|
+
// autoGeneratePrimaryKeyValue不为true的情况下,即子表组件input-table的pipeOut函数中会移除表单了子表字段的primaryKey字段值,
|
|
16815
|
+
// 此时行primaryKey字段值为空,但是pipeIn函数中已经为input-table自动生成过primaryKey字段值了,只是没有输出到表单字段值中而已
|
|
16816
|
+
// 所以上面从表单字段值中没找到__parentIndex,是因为此时行primaryKey字段值只经过pipeIn保存到table组件内而没有保存到tableService
|
|
16817
|
+
event.data.__parentIndex = _.findIndex(table.props.value, function(item){
|
|
16818
|
+
return item[primaryKey] == parent[primaryKey];
|
|
16819
|
+
});
|
|
16820
|
+
}
|
|
16821
|
+
}
|
|
16173
16822
|
`;
|
|
16174
16823
|
let schema = {
|
|
16175
16824
|
"type": "service",
|
|
@@ -16190,6 +16839,7 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16190
16839
|
// "body": formBody,
|
|
16191
16840
|
"data": {
|
|
16192
16841
|
"__page": "${index + 1}",
|
|
16842
|
+
"__parentIndex": null,//兼容节点嵌套情况,即节点中有children属性时,这里记录当前节点所属上层节点index,只支持向上找一层,不支持多层
|
|
16193
16843
|
// "__total": `\${${props.name}.length}`,
|
|
16194
16844
|
// "__total": "${__tableItems.length}",
|
|
16195
16845
|
// "__paginationServiceId": serviceId,
|
|
@@ -16216,6 +16866,7 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16216
16866
|
async function getForm(props, mode = "edit", formId) {
|
|
16217
16867
|
let formFields = getFormFields(props, mode);
|
|
16218
16868
|
let body = await getFormBody(null, formFields);
|
|
16869
|
+
let primaryKey = getTablePrimaryKey(props);
|
|
16219
16870
|
if (!formId) {
|
|
16220
16871
|
formId = getComponentId("form", props.id);
|
|
16221
16872
|
}
|
|
@@ -16234,10 +16885,41 @@ async function getForm(props, mode = "edit", formId) {
|
|
|
16234
16885
|
// 新增行弹出编辑行表单,在弹出之前已经不用先增加一行,因为在翻页service初始化的时候会判断mode为new时自动新增一行
|
|
16235
16886
|
let onEditItemSubmitScript = `
|
|
16236
16887
|
// let fieldValue = _.cloneDeep(event.data["${props.name}"]);
|
|
16888
|
+
let removeEmptyItems = function(items){
|
|
16889
|
+
let i = _.findIndex(items, function(item){
|
|
16890
|
+
return item === undefined
|
|
16891
|
+
});
|
|
16892
|
+
if(i > -1){
|
|
16893
|
+
items.splice(i, 1);
|
|
16894
|
+
removeEmptyItems(items);
|
|
16895
|
+
}
|
|
16896
|
+
}
|
|
16897
|
+
// 因为删除时只是把input-table组件中的行数据删除了,并没有把父层service中的行删除,所以__tableItems会有值为undefined的数据,需要移除掉
|
|
16898
|
+
// 不用event.data.__tableItems = _.compact(event.data.__tableItems)是因为会把__tableItems变量保存到表单中
|
|
16899
|
+
removeEmptyItems(event.data.__tableItems);
|
|
16237
16900
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
16238
16901
|
//这里加__super.__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
|
|
16239
16902
|
// 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
|
|
16240
|
-
fieldValue[event.data.__super.__super.index] = JSON.parse(JSON.stringify(event.data));
|
|
16903
|
+
// fieldValue[event.data.__super.__super.index] = JSON.parse(JSON.stringify(event.data));
|
|
16904
|
+
var currentIndex = event.data.__super.__super.index;
|
|
16905
|
+
var currentFormValues = JSON.parse(JSON.stringify(event.data));
|
|
16906
|
+
var parent = event.data.__super.__super.parent;
|
|
16907
|
+
var __parentIndex = event.data.__super.__super.__parentIndex;
|
|
16908
|
+
let uuidv4 = new Function("return (" + ${uuidv4.toString()} + ")()");
|
|
16909
|
+
var primaryKey = "${primaryKey}";
|
|
16910
|
+
if(parent){
|
|
16911
|
+
fieldValue[__parentIndex].children[currentIndex] = currentFormValues;
|
|
16912
|
+
// 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
|
|
16913
|
+
fieldValue[__parentIndex] = Object.assign({}, fieldValue[__parentIndex], {
|
|
16914
|
+
children: fieldValue[__parentIndex].children,
|
|
16915
|
+
__fix_rerender_after_children_modified_tag: new Date().getTime()
|
|
16916
|
+
});
|
|
16917
|
+
}
|
|
16918
|
+
else{
|
|
16919
|
+
// 这里currentFormValues中如果没有primaryKey字段值不用处理,因为组件的pipeIn/pipeOut中会为每行自动生成
|
|
16920
|
+
// 也不用担心复制行时_id会重复,因为点击复制按钮时已经处理过了
|
|
16921
|
+
fieldValue[currentIndex] = currentFormValues;
|
|
16922
|
+
}
|
|
16241
16923
|
doAction({
|
|
16242
16924
|
"componentId": "${props.id}",
|
|
16243
16925
|
"actionType": "setValue",
|
|
@@ -16333,13 +17015,14 @@ async function getForm(props, mode = "edit", formId) {
|
|
|
16333
17015
|
*/
|
|
16334
17016
|
async function getButtonActions(props, mode) {
|
|
16335
17017
|
let actions = [];
|
|
17018
|
+
let primaryKey = getTablePrimaryKey(props);
|
|
16336
17019
|
let formId = getComponentId("form", props.id);
|
|
16337
17020
|
let dialogId = getComponentId("dialog", props.id);
|
|
16338
17021
|
let buttonNextId = getComponentId("button_next", props.id);
|
|
16339
17022
|
let formPaginationId = getComponentId("form_pagination", props.id);
|
|
16340
17023
|
let parentFormData = "${__super.__super.__super.__super || {}}";
|
|
16341
17024
|
let amisVersion = getComparableAmisVersion();
|
|
16342
|
-
if(amisVersion < 3.6){
|
|
17025
|
+
if (amisVersion < 3.6) {
|
|
16343
17026
|
parentFormData = "${__super.__super || {}}";
|
|
16344
17027
|
}
|
|
16345
17028
|
if (mode == "new" || mode == "edit") {
|
|
@@ -16375,9 +17058,42 @@ async function getButtonActions(props, mode) {
|
|
|
16375
17058
|
// };
|
|
16376
17059
|
let onSaveAndNewItemScript = `
|
|
16377
17060
|
let scope = event.context.scoped;
|
|
17061
|
+
let removeEmptyItems = function(items){
|
|
17062
|
+
let i = _.findIndex(items, function(item){
|
|
17063
|
+
return item === undefined
|
|
17064
|
+
});
|
|
17065
|
+
if(i > -1){
|
|
17066
|
+
items.splice(i, 1);
|
|
17067
|
+
removeEmptyItems(items);
|
|
17068
|
+
}
|
|
17069
|
+
}
|
|
17070
|
+
// 因为删除时只是把input-table组件中的行数据删除了,并没有把父层service中的行删除,所以__tableItems会有值为undefined的数据,需要移除掉
|
|
17071
|
+
// 不用event.data.__tableItems = _.compact(event.data.__tableItems)是因为会把__tableItems变量保存到表单中
|
|
17072
|
+
removeEmptyItems(event.data.__tableItems);
|
|
16378
17073
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
16379
17074
|
// 新建一条空白行并保存到子表组件
|
|
16380
|
-
|
|
17075
|
+
var parent = event.data.__super.parent;
|
|
17076
|
+
var primaryKey = "${primaryKey}";
|
|
17077
|
+
var __parentIndex = parent && _.findIndex(fieldValue, function(item){
|
|
17078
|
+
return item[primaryKey] == parent[primaryKey];
|
|
17079
|
+
});
|
|
17080
|
+
if(parent && __parentIndex < 0){
|
|
17081
|
+
let tableId = "${props.id}";
|
|
17082
|
+
let table = scope.getComponentById(tableId)
|
|
17083
|
+
// autoGeneratePrimaryKeyValue不为true的情况下,即子表组件input-table的pipeOut函数中会移除表单了子表字段的primaryKey字段值,
|
|
17084
|
+
// 此时行primaryKey字段值为空,但是pipeIn函数中已经为input-table自动生成过primaryKey字段值了,只是没有输出到表单字段值中而已
|
|
17085
|
+
// 所以上面从表单字段值中没找到__parentIndex,是因为此时行primaryKey字段值只经过pipeIn保存到table组件内而没有保存到tableService
|
|
17086
|
+
__parentIndex = _.findIndex(table.props.value, function(item){
|
|
17087
|
+
return item[primaryKey] == parent[primaryKey];
|
|
17088
|
+
});
|
|
17089
|
+
}
|
|
17090
|
+
if(parent){
|
|
17091
|
+
fieldValue[__parentIndex].children.push({});
|
|
17092
|
+
// 这里实测不需要fieldValue[__parentIndex] = ... 来重写整个父行让子表回显,所以没加相关代码
|
|
17093
|
+
}
|
|
17094
|
+
else{
|
|
17095
|
+
fieldValue.push({});
|
|
17096
|
+
}
|
|
16381
17097
|
doAction({
|
|
16382
17098
|
"componentId": "${props.id}",
|
|
16383
17099
|
"actionType": "setValue",
|
|
@@ -16389,7 +17105,13 @@ async function getButtonActions(props, mode) {
|
|
|
16389
17105
|
let __paginationServiceId = "${formPaginationId}";
|
|
16390
17106
|
let __paginationData = scope.getComponentById(__paginationServiceId).getData();
|
|
16391
17107
|
event.data.index = __paginationData.index;
|
|
16392
|
-
|
|
17108
|
+
if(parent){
|
|
17109
|
+
event.data.__page = fieldValue[__parentIndex].children.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
17110
|
+
event.data.__parentIndex = __parentIndex; //执行下面的翻页按钮事件中依赖了__parentIndex值
|
|
17111
|
+
}
|
|
17112
|
+
else{
|
|
17113
|
+
event.data.__page = fieldValue.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
17114
|
+
}
|
|
16393
17115
|
// 触发翻页按钮事件,实现保存当前页数据并跳转到最后一行
|
|
16394
17116
|
scope.getComponentById(buttonNextId).props.dispatchEvent("click", event.data);
|
|
16395
17117
|
`;
|
|
@@ -16398,9 +17120,49 @@ async function getButtonActions(props, mode) {
|
|
|
16398
17120
|
let __formId = "${formId}";
|
|
16399
17121
|
// let newItem = JSON.parse(JSON.stringify(event.data));
|
|
16400
17122
|
let newItem = scope.getComponentById(__formId).getValues();//这里不可以用event.data,因为其拿到的是弹出表单时的初始值,不是用户实时填写的数据
|
|
17123
|
+
newItem = _.clone(newItem);
|
|
17124
|
+
let removeEmptyItems = function(items){
|
|
17125
|
+
let i = _.findIndex(items, function(item){
|
|
17126
|
+
return item === undefined
|
|
17127
|
+
});
|
|
17128
|
+
if(i > -1){
|
|
17129
|
+
items.splice(i, 1);
|
|
17130
|
+
removeEmptyItems(items);
|
|
17131
|
+
}
|
|
17132
|
+
}
|
|
17133
|
+
// 因为删除时只是把input-table组件中的行数据删除了,并没有把父层service中的行删除,所以__tableItems会有值为undefined的数据,需要移除掉
|
|
17134
|
+
// 不用event.data.__tableItems = _.compact(event.data.__tableItems)是因为会把__tableItems变量保存到表单中
|
|
17135
|
+
removeEmptyItems(event.data.__tableItems);
|
|
16401
17136
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
16402
17137
|
// 复制当前页数据到新建行并保存到子表组件
|
|
16403
|
-
fieldValue.push(newItem);
|
|
17138
|
+
// fieldValue.push(newItem);
|
|
17139
|
+
var parent = event.data.__super.parent;
|
|
17140
|
+
var primaryKey = "${primaryKey}";
|
|
17141
|
+
var __parentIndex = parent && _.findIndex(fieldValue, function(item){
|
|
17142
|
+
return item[primaryKey] == parent[primaryKey];
|
|
17143
|
+
});
|
|
17144
|
+
if(parent && __parentIndex < 0){
|
|
17145
|
+
let tableId = "${props.id}";
|
|
17146
|
+
let table = scope.getComponentById(tableId)
|
|
17147
|
+
// autoGeneratePrimaryKeyValue不为true的情况下,即子表组件input-table的pipeOut函数中会移除表单了子表字段的primaryKey字段值,
|
|
17148
|
+
// 此时行primaryKey字段值为空,但是pipeIn函数中已经为input-table自动生成过primaryKey字段值了,只是没有输出到表单字段值中而已
|
|
17149
|
+
// 所以上面从表单字段值中没找到__parentIndex,是因为此时行primaryKey字段值只经过pipeIn保存到table组件内而没有保存到tableService
|
|
17150
|
+
__parentIndex = _.findIndex(table.props.value, function(item){
|
|
17151
|
+
return item[primaryKey] == parent[primaryKey];
|
|
17152
|
+
});
|
|
17153
|
+
}
|
|
17154
|
+
if(newItem[primaryKey]){
|
|
17155
|
+
// 如果newItem已经有主键字段值,则重新生成新的主键值,否则会重复。
|
|
17156
|
+
let uuidv4 = new Function("return (" + ${uuidv4.toString()} + ")()");
|
|
17157
|
+
newItem[primaryKey] = uuidv4();
|
|
17158
|
+
}
|
|
17159
|
+
if(parent){
|
|
17160
|
+
fieldValue[__parentIndex].children.push(newItem);
|
|
17161
|
+
// 这里实测不需要fieldValue[__parentIndex] = ... 来重写整个父行让子表回显,所以没加相关代码
|
|
17162
|
+
}
|
|
17163
|
+
else{
|
|
17164
|
+
fieldValue.push(newItem);
|
|
17165
|
+
}
|
|
16404
17166
|
doAction({
|
|
16405
17167
|
"componentId": "${props.id}",
|
|
16406
17168
|
"actionType": "setValue",
|
|
@@ -16412,19 +17174,25 @@ async function getButtonActions(props, mode) {
|
|
|
16412
17174
|
let __paginationServiceId = "${formPaginationId}";
|
|
16413
17175
|
let __paginationData = scope.getComponentById(__paginationServiceId).getData();
|
|
16414
17176
|
event.data.index = __paginationData.index;
|
|
16415
|
-
|
|
17177
|
+
if(parent){
|
|
17178
|
+
event.data.__page = fieldValue[__parentIndex].children.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
17179
|
+
event.data.__parentIndex = __parentIndex; //执行下面的翻页按钮事件中依赖了__parentIndex值
|
|
17180
|
+
}
|
|
17181
|
+
else{
|
|
17182
|
+
event.data.__page = fieldValue.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
17183
|
+
}
|
|
16416
17184
|
// 触发翻页按钮事件,实现保存当前页数据并跳转到最后一行
|
|
16417
17185
|
scope.getComponentById(buttonNextId).props.dispatchEvent("click", event.data);
|
|
16418
17186
|
`;
|
|
16419
17187
|
let dialogButtons = [
|
|
16420
17188
|
{
|
|
16421
|
-
|
|
16422
|
-
|
|
16423
|
-
|
|
16424
|
-
|
|
17189
|
+
"type": "button",
|
|
17190
|
+
"label": "完成",
|
|
17191
|
+
"actionType": "confirm",
|
|
17192
|
+
"level": "primary"
|
|
16425
17193
|
}
|
|
16426
17194
|
];
|
|
16427
|
-
if(props.addable){
|
|
17195
|
+
if (props.addable) {
|
|
16428
17196
|
// 有新增行权限时额外添加新增和复制按钮
|
|
16429
17197
|
dialogButtons = [
|
|
16430
17198
|
{
|
|
@@ -16434,9 +17202,14 @@ async function getButtonActions(props, mode) {
|
|
|
16434
17202
|
"onEvent": {
|
|
16435
17203
|
"click": {
|
|
16436
17204
|
"actions": [
|
|
17205
|
+
{
|
|
17206
|
+
"actionType": "validate",
|
|
17207
|
+
"componentId": formId
|
|
17208
|
+
},
|
|
16437
17209
|
{
|
|
16438
17210
|
"actionType": "custom",
|
|
16439
|
-
"script": onSaveAndNewItemScript
|
|
17211
|
+
"script": onSaveAndNewItemScript,
|
|
17212
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
16440
17213
|
}
|
|
16441
17214
|
]
|
|
16442
17215
|
}
|
|
@@ -16449,9 +17222,14 @@ async function getButtonActions(props, mode) {
|
|
|
16449
17222
|
"onEvent": {
|
|
16450
17223
|
"click": {
|
|
16451
17224
|
"actions": [
|
|
17225
|
+
{
|
|
17226
|
+
"actionType": "validate",
|
|
17227
|
+
"componentId": formId
|
|
17228
|
+
},
|
|
16452
17229
|
{
|
|
16453
17230
|
"actionType": "custom",
|
|
16454
|
-
"script": onSaveAndCopyItemScript
|
|
17231
|
+
"script": onSaveAndCopyItemScript,
|
|
17232
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
16455
17233
|
}
|
|
16456
17234
|
]
|
|
16457
17235
|
}
|
|
@@ -16488,12 +17266,15 @@ async function getButtonActions(props, mode) {
|
|
|
16488
17266
|
"_master": "${_master}",
|
|
16489
17267
|
"global": "${global}",
|
|
16490
17268
|
"uiSchema": "${uiSchema}",
|
|
16491
|
-
"index": "${index}"
|
|
17269
|
+
"index": "${index}",//amis组件自带行索引,在节点嵌套情况下,当前节点如果是children属性下的子节点时,这里的index是当前节点在children中的索引,而不是外层父节点的index
|
|
17270
|
+
"parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
16492
17271
|
// "__tableItems": `\${${props.name}}`
|
|
16493
17272
|
// 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
|
|
16494
17273
|
// 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
|
|
16495
17274
|
// "__tableItems": `\${${props.name}|json|toJson}`
|
|
16496
|
-
|
|
17275
|
+
// 在节点嵌套情况下,当前节点正好是带children属性的节点的话,这里弹出的dialog映射到的会是children数组,这是amis目前的规则,
|
|
17276
|
+
// 所以这里加判断有children时,用__super.__super让映射到正确的作用域层,如果不加,则__tableItems取到的会是children数组,而不是整个子表组件的值
|
|
17277
|
+
"__tableItems": `\${((children ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
|
|
16497
17278
|
},
|
|
16498
17279
|
"actions": dialogButtons,
|
|
16499
17280
|
"onEvent": {
|
|
@@ -16516,35 +17297,39 @@ async function getButtonActions(props, mode) {
|
|
|
16516
17297
|
Object.assign(actionShowEditDialog.dialog, props.dialog);
|
|
16517
17298
|
}
|
|
16518
17299
|
if (mode == "new") {
|
|
16519
|
-
`
|
|
16520
|
-
|
|
16521
|
-
|
|
16522
|
-
|
|
16523
|
-
|
|
16524
|
-
|
|
16525
|
-
|
|
16526
|
-
|
|
16527
|
-
|
|
16528
|
-
|
|
16529
|
-
|
|
16530
|
-
|
|
16531
|
-
|
|
16532
|
-
|
|
16533
|
-
|
|
16534
|
-
|
|
16535
|
-
|
|
16536
|
-
|
|
16537
|
-
|
|
16538
|
-
|
|
16539
|
-
|
|
16540
|
-
|
|
16541
|
-
|
|
16542
|
-
|
|
16543
|
-
|
|
16544
|
-
|
|
16545
|
-
|
|
16546
|
-
|
|
16547
|
-
`;
|
|
17300
|
+
// let onNewLineScript = `
|
|
17301
|
+
// let newItem = {};
|
|
17302
|
+
// if(event.data["${props.name}"]){
|
|
17303
|
+
// // let fieldValue = event.data.__tableItems;
|
|
17304
|
+
// // 这里不用__tableItems是因为新建的时候没有翻页,里面没有也不需要走__tableItems变量
|
|
17305
|
+
// // let fieldValue = _.clone(event.data["${props.name}"]);
|
|
17306
|
+
// let fieldValue = event.data["${props.name}"];
|
|
17307
|
+
// fieldValue.push(newItem);
|
|
17308
|
+
// doAction({
|
|
17309
|
+
// "componentId": "${props.id}",
|
|
17310
|
+
// "actionType": "setValue",
|
|
17311
|
+
// "args": {
|
|
17312
|
+
// "value": fieldValue
|
|
17313
|
+
// }
|
|
17314
|
+
// });
|
|
17315
|
+
// event.data.index = fieldValue.length - 1;
|
|
17316
|
+
// }
|
|
17317
|
+
// else{
|
|
17318
|
+
// // 这里不可以执行event.data["${props.name}"]=[newItem],数据域会断掉
|
|
17319
|
+
// doAction({
|
|
17320
|
+
// "componentId": "${props.id}",
|
|
17321
|
+
// "actionType": "setValue",
|
|
17322
|
+
// "args": {
|
|
17323
|
+
// "value": [newItem]
|
|
17324
|
+
// }
|
|
17325
|
+
// });
|
|
17326
|
+
// event.data.index = 1;
|
|
17327
|
+
// }
|
|
17328
|
+
// `;
|
|
17329
|
+
// let actionNewLine = {
|
|
17330
|
+
// "actionType": "custom",
|
|
17331
|
+
// "script": onNewLineScript
|
|
17332
|
+
// };
|
|
16548
17333
|
// 新增行时不需要在弹出编辑表单前先加一行,因为会在编辑表单所在service初始化时判断到是新增就自动增加一行,因为这里拿不到event.data.__tableItems,也无法变更其值
|
|
16549
17334
|
// actions = [actionNewLine, actionShowEditDialog];
|
|
16550
17335
|
actions = [actionShowEditDialog];
|
|
@@ -16579,15 +17364,20 @@ async function getButtonActions(props, mode) {
|
|
|
16579
17364
|
// 映射到中间变量__parentForm而不是直接用&展开映射是为了避免表单中字段名与作用域中变量重名
|
|
16580
17365
|
// "__parentForm": "${__super.__super || {}}",
|
|
16581
17366
|
"__parentForm": parentFormData,
|
|
17367
|
+
"_master": "${_master}",
|
|
16582
17368
|
"global": "${global}",
|
|
16583
17369
|
"uiSchema": "${uiSchema}",
|
|
16584
17370
|
"index": "${index}",
|
|
17371
|
+
"parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
16585
17372
|
// "__tableItems": `\${${props.name}}`
|
|
16586
17373
|
// 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
|
|
16587
17374
|
// 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
|
|
16588
17375
|
// "__tableItems": `\${${props.name}|json|toJson}`
|
|
16589
|
-
"__tableItems": `\${(
|
|
16590
|
-
|
|
17376
|
+
// "__tableItems": `\${((__super.parent ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
|
|
17377
|
+
// 在节点嵌套情况下,当前节点正好是带children属性的节点的话,这里弹出的dialog映射到的会是children数组,这是amis目前的规则,
|
|
17378
|
+
// 所以这里加判断有children时,用__super.__super让映射到正确的作用域层,如果不加,则__tableItems取到的会是children数组,而不是整个子表组件的值
|
|
17379
|
+
"__tableItems": `\${((children ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
|
|
17380
|
+
},
|
|
16591
17381
|
}
|
|
16592
17382
|
}
|
|
16593
17383
|
];
|
|
@@ -16602,8 +17392,40 @@ async function getButtonActions(props, mode) {
|
|
|
16602
17392
|
let wrapperServiceData = wrapperService.getData();
|
|
16603
17393
|
// 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
16604
17394
|
// 这里_.clone是因为字段设计布局设置分组这种弹出窗口中的子表组件,直接删除后,点取消无法还原
|
|
17395
|
+
// 也因为这里clone没有直接删除,所以弹出编辑表单提交事件中event.data.__tableItems中取到的值会有被删除的行数据为undefined
|
|
16605
17396
|
let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"]);
|
|
16606
|
-
|
|
17397
|
+
var currentIndex = event.data.index;
|
|
17398
|
+
var parent = event.data.__super.parent;
|
|
17399
|
+
var primaryKey = "${primaryKey}";
|
|
17400
|
+
var __parentIndex = parent && _.findIndex(lastestFieldValue, function(item){
|
|
17401
|
+
return item[primaryKey] == parent[primaryKey];
|
|
17402
|
+
});
|
|
17403
|
+
if(parent && __parentIndex < 0){
|
|
17404
|
+
let tableId = "${props.id}";
|
|
17405
|
+
let table = scope.getComponentById(tableId)
|
|
17406
|
+
// autoGeneratePrimaryKeyValue不为true的情况下,即子表组件input-table的pipeOut函数中会移除表单了子表字段的primaryKey字段值,
|
|
17407
|
+
// 此时行primaryKey字段值为空,但是pipeIn函数中已经为input-table自动生成过primaryKey字段值了,只是没有输出到表单字段值中而已
|
|
17408
|
+
// 所以上面从表单字段值中没找到__parentIndex,是因为此时行primaryKey字段值只经过pipeIn保存到table组件内而没有保存到tableService
|
|
17409
|
+
__parentIndex = _.findIndex(table.props.value, function(item){
|
|
17410
|
+
return item[primaryKey] == parent[primaryKey];
|
|
17411
|
+
});
|
|
17412
|
+
}
|
|
17413
|
+
if(parent){
|
|
17414
|
+
lastestFieldValue[__parentIndex].children.splice(currentIndex, 1);
|
|
17415
|
+
// 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
|
|
17416
|
+
lastestFieldValue[__parentIndex] = Object.assign({}, lastestFieldValue[__parentIndex], {
|
|
17417
|
+
children: lastestFieldValue[__parentIndex].children,
|
|
17418
|
+
__fix_rerender_after_children_modified_tag: new Date().getTime()
|
|
17419
|
+
});
|
|
17420
|
+
}
|
|
17421
|
+
else{
|
|
17422
|
+
lastestFieldValue.splice(currentIndex, 1);
|
|
17423
|
+
}
|
|
17424
|
+
let fieldPrefix = "${props.fieldPrefix || ''}";
|
|
17425
|
+
if(fieldPrefix){
|
|
17426
|
+
let getTableValueWithoutFieldPrefix = new Function('v', 'f', "return (" + ${getTableValueWithoutFieldPrefix.toString()} + ")(v, f)");
|
|
17427
|
+
lastestFieldValue = getTableValueWithoutFieldPrefix(lastestFieldValue, fieldPrefix);
|
|
17428
|
+
}
|
|
16607
17429
|
doAction({
|
|
16608
17430
|
"componentId": "${props.id}",
|
|
16609
17431
|
"actionType": "setValue",
|
|
@@ -16673,58 +17495,104 @@ async function getButtonView(props) {
|
|
|
16673
17495
|
|
|
16674
17496
|
async function getButtonDelete(props) {
|
|
16675
17497
|
return {
|
|
16676
|
-
"type": "button",
|
|
16677
|
-
"label": "",
|
|
16678
|
-
"icon": "fa fa-trash-alt",//不可以用fa-trash-o,因为设计字段布局界面中弹出的设置分组列表中显示不了这个图标
|
|
17498
|
+
"type": "dropdown-button",
|
|
16679
17499
|
"level": "link",
|
|
16680
|
-
"
|
|
16681
|
-
|
|
16682
|
-
|
|
17500
|
+
"icon": "fa fa-trash-alt",
|
|
17501
|
+
"size": "xs",
|
|
17502
|
+
"hideCaret": true,
|
|
17503
|
+
"closeOnClick": true,
|
|
17504
|
+
"body": [
|
|
17505
|
+
{
|
|
17506
|
+
"type": "wrapper",
|
|
17507
|
+
"size": "md",
|
|
17508
|
+
"className": "w-80",
|
|
17509
|
+
"body": [
|
|
17510
|
+
{
|
|
17511
|
+
"tpl": "确定要删除吗?",
|
|
17512
|
+
"type": "tpl"
|
|
17513
|
+
},
|
|
17514
|
+
{
|
|
17515
|
+
"type": "flex",
|
|
17516
|
+
"justify": "flex-end",
|
|
17517
|
+
"className": "mt-3",
|
|
17518
|
+
"items": [
|
|
17519
|
+
{
|
|
17520
|
+
"type": "button",
|
|
17521
|
+
"label": "取消",
|
|
17522
|
+
"className": "mr-2"
|
|
17523
|
+
},
|
|
17524
|
+
{
|
|
17525
|
+
"type": "button",
|
|
17526
|
+
"label": "删除",
|
|
17527
|
+
"level": "danger",
|
|
17528
|
+
"onEvent": {
|
|
17529
|
+
"click": {
|
|
17530
|
+
"actions": await getButtonActions(props, "delete")
|
|
17531
|
+
}
|
|
17532
|
+
}
|
|
17533
|
+
}
|
|
17534
|
+
]
|
|
17535
|
+
}
|
|
17536
|
+
]
|
|
16683
17537
|
}
|
|
16684
|
-
|
|
16685
|
-
}
|
|
17538
|
+
]
|
|
17539
|
+
}
|
|
16686
17540
|
}
|
|
16687
17541
|
|
|
17542
|
+
|
|
16688
17543
|
const getAmisInputTableSchema = async (props) => {
|
|
16689
17544
|
if (!props.id) {
|
|
16690
17545
|
props.id = "steedos_input_table_" + props.name + "_" + Math.random().toString(36).substr(2, 9);
|
|
16691
17546
|
}
|
|
17547
|
+
let primaryKey = getTablePrimaryKey(props);
|
|
17548
|
+
let showOperation = props.showOperation;
|
|
17549
|
+
if (showOperation !== false) {
|
|
17550
|
+
showOperation = true;
|
|
17551
|
+
}
|
|
17552
|
+
let fieldPrefix = props.fieldPrefix;
|
|
17553
|
+
let fields = props.fields || [];
|
|
17554
|
+
if (fieldPrefix) {
|
|
17555
|
+
fields = getTableFieldsWithoutFieldPrefix(fields, fieldPrefix);
|
|
17556
|
+
}
|
|
16692
17557
|
let serviceId = getComponentId("table_service", props.id);
|
|
16693
17558
|
let buttonsForColumnOperations = [];
|
|
16694
17559
|
let inlineEditMode = props.inlineEditMode;
|
|
16695
17560
|
let showAsInlineEditMode = inlineEditMode && props.editable;
|
|
16696
|
-
if (
|
|
16697
|
-
|
|
16698
|
-
|
|
16699
|
-
|
|
16700
|
-
|
|
16701
|
-
|
|
16702
|
-
|
|
16703
|
-
|
|
16704
|
-
|
|
16705
|
-
|
|
16706
|
-
|
|
16707
|
-
|
|
17561
|
+
if (showOperation) {
|
|
17562
|
+
if (props.editable) {
|
|
17563
|
+
let showEditButton = true;
|
|
17564
|
+
if (showAsInlineEditMode) {
|
|
17565
|
+
// 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
|
|
17566
|
+
showEditButton = true;
|
|
17567
|
+
// // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
|
|
17568
|
+
// if (props.columns && props.columns.length > 0 && props.columns.length < fields.length) {
|
|
17569
|
+
// showEditButton = true;
|
|
17570
|
+
// }
|
|
17571
|
+
// else {
|
|
17572
|
+
// showEditButton = false;
|
|
17573
|
+
// }
|
|
17574
|
+
}
|
|
17575
|
+
// 编辑时显示编辑按钮
|
|
17576
|
+
if (showEditButton) {
|
|
17577
|
+
let buttonEditSchema = await getButtonEdit(props, showAsInlineEditMode);
|
|
17578
|
+
buttonsForColumnOperations.push(buttonEditSchema);
|
|
17579
|
+
}
|
|
16708
17580
|
}
|
|
16709
|
-
|
|
16710
|
-
|
|
16711
|
-
|
|
16712
|
-
|
|
17581
|
+
else {
|
|
17582
|
+
// 只读时显示查看按钮
|
|
17583
|
+
// 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < fields.length)
|
|
17584
|
+
let buttonViewSchema = await getButtonView(props);
|
|
17585
|
+
buttonsForColumnOperations.push(buttonViewSchema);
|
|
17586
|
+
}
|
|
17587
|
+
if (props.removable) {
|
|
17588
|
+
let buttonDeleteSchema = await getButtonDelete(props);
|
|
17589
|
+
buttonsForColumnOperations.push(buttonDeleteSchema);
|
|
16713
17590
|
}
|
|
16714
17591
|
}
|
|
16715
|
-
|
|
16716
|
-
// 只读时显示查看按钮
|
|
16717
|
-
// 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length)
|
|
16718
|
-
let buttonViewSchema = await getButtonView(props);
|
|
16719
|
-
buttonsForColumnOperations.push(buttonViewSchema);
|
|
16720
|
-
}
|
|
16721
|
-
if (props.removable) {
|
|
16722
|
-
let buttonDeleteSchema = await getButtonDelete(props);
|
|
16723
|
-
buttonsForColumnOperations.push(buttonDeleteSchema);
|
|
16724
|
-
}
|
|
17592
|
+
let amis = props["input-table"] || props.amis || {};//额外支持"input-table"代替amis属性,是因为在字段yml文件中用amis作为key不好理解
|
|
16725
17593
|
let inputTableSchema = {
|
|
16726
17594
|
"type": "input-table",
|
|
16727
|
-
"
|
|
17595
|
+
"mode": "normal",
|
|
16728
17596
|
"name": props.name,
|
|
16729
17597
|
//不可以addable/editable/removable设置为true,因为会在原生的操作列显示操作按钮图标,此开关实测只控制这个按钮显示不会影响功能
|
|
16730
17598
|
// "addable": props.addable,
|
|
@@ -16739,7 +17607,53 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
16739
17607
|
"strictMode": props.strictMode,
|
|
16740
17608
|
"showTableAddBtn": false,
|
|
16741
17609
|
"showFooterAddBtn": false,
|
|
16742
|
-
"className": props.tableClassName
|
|
17610
|
+
"className": props.tableClassName,
|
|
17611
|
+
"pipeIn": (value, data) => {
|
|
17612
|
+
if (fieldPrefix) {
|
|
17613
|
+
value = getTableValueWithoutFieldPrefix(value, fieldPrefix);
|
|
17614
|
+
}
|
|
17615
|
+
value = getTableValueWithEmptyValue(value, fields);
|
|
17616
|
+
if (primaryKey) {
|
|
17617
|
+
// 这里临时给每行数据补上primaryKey字段值,如果库里不需要保存这里补上的字段值,pipeOut中会识别autoGeneratePrimaryKeyValue属性选择最终移除这里补上的字段值
|
|
17618
|
+
// 这里始终自动生成primaryKey字段值,而不是只在pipeOut输出整个子表字段值时才生成,是因为要支持当数据库里保存的子表字段行数据没有primaryKey字段值时的行嵌套模式(即节点的children属性)功能
|
|
17619
|
+
// 这里要注意,流程详细设置界面的字段设置功能中的子表组件中,数据库里保存的子表字段行数据是有primaryKey字段值的,它不依赖这里自动生成行primaryKey值功能
|
|
17620
|
+
value = getTableValueWithPrimaryKeyValue(value, primaryKey);
|
|
17621
|
+
}
|
|
17622
|
+
if (amis.pipeIn) {
|
|
17623
|
+
if (typeof amis.pipeIn === 'function') {
|
|
17624
|
+
return amis.pipeIn(value, data);
|
|
17625
|
+
}
|
|
17626
|
+
}
|
|
17627
|
+
return value;
|
|
17628
|
+
},
|
|
17629
|
+
"pipeOut": (value, data) => {
|
|
17630
|
+
value = (value || []).map(function (item) {
|
|
17631
|
+
delete item.__fix_rerender_after_children_modified_tag;
|
|
17632
|
+
return item;
|
|
17633
|
+
});
|
|
17634
|
+
if (fieldPrefix) {
|
|
17635
|
+
value = getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey);
|
|
17636
|
+
}
|
|
17637
|
+
value = getTableValueWithoutEmptyValue(value, fields);
|
|
17638
|
+
if (props.autoGeneratePrimaryKeyValue === true) {
|
|
17639
|
+
// 如果需要把自动生成的primaryKey值输出保存的库中,则补全所有行中的primaryKey值
|
|
17640
|
+
// 这里如果不全部补全的话,初始从库里返回的字段值中拿到的行没primaryKey值的话就不会自动补上
|
|
17641
|
+
value = getTableValueWithPrimaryKeyValue(value, primaryKey);
|
|
17642
|
+
}
|
|
17643
|
+
else {
|
|
17644
|
+
// 默认情况下,也就是没有配置autoGeneratePrimaryKey时,最终输出的字段值要移除行中的primaryKey值
|
|
17645
|
+
// 需要注意如果没有配置autoGeneratePrimaryKey时,因为每次弹出行编辑窗口保存后都会先后进入pipeOut和pipeIn,
|
|
17646
|
+
// 这里删除掉了primaryKey值,所以primaryKey值每次弹出编辑窗口保存后都会给每行重新生成新的primaryKey值
|
|
17647
|
+
// 只有autoGeneratePrimaryKey配置为true时,每行的primaryKey字段值才会始终保持不变
|
|
17648
|
+
value = getTableValueWithoutPrimaryKeyValue(value, primaryKey);
|
|
17649
|
+
}
|
|
17650
|
+
if (amis.pipeOut) {
|
|
17651
|
+
if (typeof amis.pipeOut === 'function') {
|
|
17652
|
+
return amis.pipeOut(value, data);
|
|
17653
|
+
}
|
|
17654
|
+
}
|
|
17655
|
+
return value;
|
|
17656
|
+
}
|
|
16743
17657
|
};
|
|
16744
17658
|
if (buttonsForColumnOperations.length) {
|
|
16745
17659
|
inputTableSchema.columns.push({
|
|
@@ -16749,20 +17663,22 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
16749
17663
|
"width": buttonsForColumnOperations.length > 1 ? "60px" : "20px"
|
|
16750
17664
|
});
|
|
16751
17665
|
}
|
|
16752
|
-
if (showAsInlineEditMode) {
|
|
16753
|
-
|
|
16754
|
-
|
|
16755
|
-
|
|
17666
|
+
// if (showAsInlineEditMode) {
|
|
17667
|
+
// // 因为要支持不同的列上配置inlineEditMode属性,所有不可以把整个子表组件都设置为inlineEditMode
|
|
17668
|
+
// inputTableSchema.needConfirm = false;
|
|
17669
|
+
// }
|
|
16756
17670
|
if (amis) {
|
|
16757
17671
|
// 支持配置amis属性重写或添加最终生成的input-table中任何属性。
|
|
16758
17672
|
delete amis.id;//如果steedos-input-table组件配置了amis.id属性,会造成新建编辑行功能不生效
|
|
17673
|
+
delete amis.pipeIn;//该属性在上面合并过了
|
|
17674
|
+
delete amis.pipeOut;//该属性在上面合并过了
|
|
16759
17675
|
Object.assign(inputTableSchema, amis);
|
|
16760
17676
|
}
|
|
16761
|
-
const isAnyFieldHasDependOn = (
|
|
17677
|
+
const isAnyFieldHasDependOn = (fields || []).find(function (item) {
|
|
16762
17678
|
return item.depend_on;
|
|
16763
17679
|
});
|
|
16764
17680
|
if (isAnyFieldHasDependOn) {
|
|
16765
|
-
// 有任意一个子字段有depend_on
|
|
17681
|
+
// 有任意一个子字段有depend_on属性时,强制设置禁用静态模式,因为strictMode模式下,dependOn的字段值变更后,不会rerender整个子表
|
|
16766
17682
|
Object.assign(inputTableSchema, {
|
|
16767
17683
|
strictMode: false
|
|
16768
17684
|
});
|
|
@@ -16791,11 +17707,31 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
16791
17707
|
"body": headerToolbar
|
|
16792
17708
|
});
|
|
16793
17709
|
}
|
|
17710
|
+
let className = "steedos-input-table";
|
|
17711
|
+
|
|
17712
|
+
if (typeof props.className == "object") {
|
|
17713
|
+
className = {
|
|
17714
|
+
[className]: "true",
|
|
17715
|
+
...props.className
|
|
17716
|
+
};
|
|
17717
|
+
} else if (typeof props.className == "string") {
|
|
17718
|
+
className = `${className} ${props.className} `;
|
|
17719
|
+
}
|
|
17720
|
+
|
|
16794
17721
|
let schema = {
|
|
16795
|
-
"type": "
|
|
16796
|
-
"body":
|
|
16797
|
-
|
|
16798
|
-
|
|
17722
|
+
"type": "control",
|
|
17723
|
+
"body": {
|
|
17724
|
+
"type": "service",
|
|
17725
|
+
"body": schemaBody,
|
|
17726
|
+
"id": serviceId
|
|
17727
|
+
},
|
|
17728
|
+
"label": props.label,
|
|
17729
|
+
"labelClassName": props.label ? props.labelClassName : "none",
|
|
17730
|
+
"labelRemark": props.labelRemark,
|
|
17731
|
+
"labelAlign": props.labelAlign,
|
|
17732
|
+
//控制control的mode属性,https://aisuda.bce.baidu.com/amis/zh-CN/components/form/formitem#表单项展示
|
|
17733
|
+
"mode": props.mode || null,
|
|
17734
|
+
className
|
|
16799
17735
|
};
|
|
16800
17736
|
// console.log("===schema===", schema);
|
|
16801
17737
|
return schema;
|
|
@@ -16867,7 +17803,7 @@ async function getListPageInitSchema(objectApiName, formFactor, userSession) {
|
|
|
16867
17803
|
// 获取
|
|
16868
17804
|
async function getRecordPageInitSchema(objectApiName){
|
|
16869
17805
|
const relatedList = await getObjectRelatedList(objectApiName);
|
|
16870
|
-
|
|
17806
|
+
await getUISchema(objectApiName);
|
|
16871
17807
|
let body = [
|
|
16872
17808
|
// detailHeaderAmisSchema,
|
|
16873
17809
|
{
|
|
@@ -16875,28 +17811,7 @@ async function getRecordPageInitSchema(objectApiName){
|
|
|
16875
17811
|
"label": "标题面板",
|
|
16876
17812
|
"objectApiName": "${objectName}",
|
|
16877
17813
|
"recordId": "${recordId}",
|
|
16878
|
-
"onEvent": {
|
|
16879
|
-
"recordLoaded": {
|
|
16880
|
-
"actions": [
|
|
16881
|
-
{
|
|
16882
|
-
"actionType": "setValue",
|
|
16883
|
-
"args": {
|
|
16884
|
-
"value": {
|
|
16885
|
-
"recordLoaded": true,
|
|
16886
|
-
}
|
|
16887
|
-
}
|
|
16888
|
-
},
|
|
16889
|
-
{
|
|
16890
|
-
"actionType": "reload",
|
|
16891
|
-
"data": {
|
|
16892
|
-
"name": `\${record.${uiSchema?.NAME_FIELD_KEY || 'name'}}`,
|
|
16893
|
-
"record": `\${record}`,
|
|
16894
|
-
"recordLoaded": true,
|
|
16895
|
-
}
|
|
16896
|
-
}
|
|
16897
|
-
]
|
|
16898
|
-
}
|
|
16899
|
-
}
|
|
17814
|
+
"onEvent": {}
|
|
16900
17815
|
}
|
|
16901
17816
|
];
|
|
16902
17817
|
let contentBody = {
|
|
@@ -19529,9 +20444,11 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
|
|
|
19529
20444
|
getObjectRelatedList: getObjectRelatedList,
|
|
19530
20445
|
getObjectRelatedListButtons: getObjectRelatedListButtons,
|
|
19531
20446
|
getObjectRelatedListHeader: getObjectRelatedListHeader,
|
|
20447
|
+
getObjectRelatedListsMiniSchema: getObjectRelatedListsMiniSchema,
|
|
19532
20448
|
getPage: getPage,
|
|
19533
20449
|
getRecord: getRecord,
|
|
19534
20450
|
getRecordDetailHeaderSchema: getRecordDetailHeaderSchema,
|
|
20451
|
+
getRecordDetailMiniSchema: getRecordDetailMiniSchema,
|
|
19535
20452
|
getRecordDetailRelatedListSchema: getRecordDetailRelatedListSchema,
|
|
19536
20453
|
getRecordDetailSchema: getRecordDetailSchema,
|
|
19537
20454
|
getRecordPageInitSchema: getRecordPageInitSchema,
|
|
@@ -19713,10 +20630,11 @@ var AmisObjectFieldLookup = function (props) {
|
|
|
19713
20630
|
};
|
|
19714
20631
|
|
|
19715
20632
|
var AmisObjectButton = function (props) {
|
|
19716
|
-
|
|
20633
|
+
var _a;
|
|
20634
|
+
// console.log(`AmisObjectButton=====》`, props)
|
|
19717
20635
|
var objectName = props.objectName, name = props.name, data = props.data, render = props.render, className = props.className, listViewId = props.listViewId;
|
|
19718
|
-
var
|
|
19719
|
-
var
|
|
20636
|
+
var _b = __read(useState(), 2), button = _b[0], setButton = _b[1];
|
|
20637
|
+
var _c = __read(useState(), 2), uiSchema = _c[0], setUiSchema = _c[1];
|
|
19720
20638
|
//TODO 处理上下文参数
|
|
19721
20639
|
var appId = data.appId;
|
|
19722
20640
|
var formFactor = data.formFactor;
|
|
@@ -19785,6 +20703,7 @@ var AmisObjectButton = function (props) {
|
|
|
19785
20703
|
}
|
|
19786
20704
|
if (renderData) {
|
|
19787
20705
|
delete renderData.event;
|
|
20706
|
+
(_a = renderData.record) === null || _a === void 0 ? true : delete _a.event;
|
|
19788
20707
|
}
|
|
19789
20708
|
schema.data = defaultsDeep$1({}, renderData, getDefaultRenderData(), schema.data);
|
|
19790
20709
|
delete schema.data.event;
|
|
@@ -19990,11 +20909,11 @@ var SteedosSkeleton = function (props) {
|
|
|
19990
20909
|
};
|
|
19991
20910
|
|
|
19992
20911
|
var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
19993
|
-
var $schema, recordId, defaultData, mode, layout, labelAlign, appId, fieldsExtend,
|
|
19994
|
-
return __generator(this, function (
|
|
19995
|
-
switch (
|
|
20912
|
+
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;
|
|
20913
|
+
return __generator(this, function (_f) {
|
|
20914
|
+
switch (_f.label) {
|
|
19996
20915
|
case 0:
|
|
19997
|
-
$schema = props.$schema, recordId = props.recordId, defaultData = props.defaultData, mode = props.mode,
|
|
20916
|
+
$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;
|
|
19998
20917
|
objectApiName = props.objectApiName || "space_users";
|
|
19999
20918
|
schemaKeys = difference(keys($schema), ["id", "form", "type", "mode", "layout", "defaultData", "formDataFilter", "onFormDataFilter", "env"]);
|
|
20000
20919
|
formSchema = pick(props, schemaKeys);
|
|
@@ -20041,7 +20960,7 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
20041
20960
|
env: env
|
|
20042
20961
|
}))];
|
|
20043
20962
|
case 1:
|
|
20044
|
-
schema =
|
|
20963
|
+
schema = _f.sent();
|
|
20045
20964
|
amisSchema = schema.amisSchema;
|
|
20046
20965
|
uiSchema = schema.uiSchema;
|
|
20047
20966
|
return [3 /*break*/, 4];
|
|
@@ -20060,10 +20979,10 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
20060
20979
|
env: env
|
|
20061
20980
|
}))];
|
|
20062
20981
|
case 3:
|
|
20063
|
-
schema =
|
|
20982
|
+
schema = _f.sent();
|
|
20064
20983
|
amisSchema = schema.amisSchema;
|
|
20065
20984
|
uiSchema = schema.uiSchema;
|
|
20066
|
-
|
|
20985
|
+
_f.label = 4;
|
|
20067
20986
|
case 4:
|
|
20068
20987
|
formData = {};
|
|
20069
20988
|
// formData.recordId = recordId || null;
|
|
@@ -20074,7 +20993,8 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
20074
20993
|
formData.recordId = props.recordId;
|
|
20075
20994
|
}
|
|
20076
20995
|
amisSchema.className = "steedos-object-form ".concat(className);
|
|
20077
|
-
|
|
20996
|
+
// console.log('AmisObjectForm amisSchema======>', amisSchema)
|
|
20997
|
+
amisSchema.data = Object.assign({}, amisSchema.data || {}, formData, { global: globalData, uiSchema: uiSchema });
|
|
20078
20998
|
if (has(props, 'objectApiName')) {
|
|
20079
20999
|
amisSchema.data.objectName = objectApiName;
|
|
20080
21000
|
}
|
|
@@ -20230,7 +21150,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
20230
21150
|
type: "service",
|
|
20231
21151
|
data: serviceData,
|
|
20232
21152
|
style: style,
|
|
20233
|
-
className: "".concat(className, " sm:bg-gray-
|
|
21153
|
+
className: "".concat(className, " sm:bg-gray-50 h-full steedos-object-listview ").concat(displayAs === 'split' ? 'sm:border-r' : 'sm:border-r'),
|
|
20234
21154
|
body: [{
|
|
20235
21155
|
"type": "wrapper",
|
|
20236
21156
|
"size": "none",
|
|
@@ -20253,7 +21173,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
20253
21173
|
{
|
|
20254
21174
|
"type": "service",
|
|
20255
21175
|
"id": "service_schema_api_" + objectApiName,
|
|
20256
|
-
"className": " steedos-object-listview-content grow",
|
|
21176
|
+
"className": " steedos-object-listview-content md:overflow-auto grow",
|
|
20257
21177
|
"schemaApi": {
|
|
20258
21178
|
// 这里url上加objectApiName属性是因为设计器中切换对象时不会变更列表视图界面,不可以用objectName=${objectName}使用作用域中objectName变量是因为设计器那边不会监听识别data变化来render组件
|
|
20259
21179
|
"url": "${context.rootUrl}/graphql?objectName=" + objectApiName + "&listName=${listName}&display=${display}&rebuildOn=" + rebuildOn,
|
|
@@ -20263,7 +21183,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
20263
21183
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
20264
21184
|
},
|
|
20265
21185
|
"requestAdaptor": "api.data={query: '{spaces__findOne(id: \"none\"){_id,name}}'};return api;",
|
|
20266
|
-
"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
|
|
21186
|
+
"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 ")
|
|
20267
21187
|
},
|
|
20268
21188
|
// "body": body,
|
|
20269
21189
|
// "data": serviceData
|
|
@@ -20421,34 +21341,18 @@ var AmisObjectCalendar = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
20421
21341
|
}); };
|
|
20422
21342
|
|
|
20423
21343
|
var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
20424
|
-
var _a, className, schemaFilter,
|
|
21344
|
+
var _a, className, schemaFilter, showButtons, showBackButton, defaultOnEvent, recordId, _b, onEvent, _c, showRecordTitle, objectApiName, schema, config, schemaFilterFun, _config, e_1;
|
|
20425
21345
|
return __generator(this, function (_d) {
|
|
20426
21346
|
switch (_d.label) {
|
|
20427
21347
|
case 0:
|
|
20428
|
-
_a = props.className, className = _a === void 0 ? 'sm:sticky top-0 z-10
|
|
21348
|
+
_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;
|
|
20429
21349
|
return [4 /*yield*/, getUISchema(props.objectApiName || "space_users", false)];
|
|
20430
21350
|
case 1:
|
|
20431
|
-
|
|
20432
|
-
defaultOnEvent = {
|
|
20433
|
-
"recordLoaded": {
|
|
20434
|
-
"actions": [
|
|
20435
|
-
{
|
|
20436
|
-
"actionType": "reload",
|
|
20437
|
-
"data": {
|
|
20438
|
-
"name": "${event.data.record.".concat((objectUiSchema === null || objectUiSchema === void 0 ? void 0 : objectUiSchema.NAME_FIELD_KEY) || 'name', "}"),
|
|
20439
|
-
"record": "${event.data.record}",
|
|
20440
|
-
"_id": "\${event.data.record._id}",
|
|
20441
|
-
"recordId": "\${event.data.record._id}",
|
|
20442
|
-
"recordLoaded": true,
|
|
20443
|
-
},
|
|
20444
|
-
"expression": "${event.data.objectName == '".concat(objectUiSchema === null || objectUiSchema === void 0 ? void 0 : objectUiSchema.name, "'}")
|
|
20445
|
-
}
|
|
20446
|
-
]
|
|
20447
|
-
}
|
|
20448
|
-
};
|
|
21351
|
+
_d.sent();
|
|
21352
|
+
defaultOnEvent = {};
|
|
20449
21353
|
props.$schema, recordId = props.recordId, _b = props.onEvent, onEvent = _b === void 0 ? defaultOnEvent : _b, _c = props.showRecordTitle, showRecordTitle = _c === void 0 ? true : _c;
|
|
20450
21354
|
objectApiName = props.objectApiName || "space_users";
|
|
20451
|
-
return [4 /*yield*/, getRecordDetailHeaderSchema(objectApiName, recordId, { showRecordTitle: showRecordTitle, formFactor: props.data.formFactor })];
|
|
21355
|
+
return [4 /*yield*/, getRecordDetailHeaderSchema(objectApiName, recordId, { showRecordTitle: showRecordTitle, formFactor: props.data.formFactor, showButtons: showButtons, showBackButton: showBackButton, display: props.data.display })];
|
|
20452
21356
|
case 2:
|
|
20453
21357
|
schema = (_d.sent()).amisSchema;
|
|
20454
21358
|
schema.className = className;
|
|
@@ -20467,18 +21371,20 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
|
|
|
20467
21371
|
e_1 = _d.sent();
|
|
20468
21372
|
console.warn(e_1);
|
|
20469
21373
|
return [3 /*break*/, 6];
|
|
20470
|
-
case 6:
|
|
21374
|
+
case 6:
|
|
21375
|
+
// console.log(`AmisRecordDetailHeader==>`, config)
|
|
21376
|
+
return [2 /*return*/, config];
|
|
20471
21377
|
}
|
|
20472
21378
|
});
|
|
20473
21379
|
}); };
|
|
20474
21380
|
|
|
20475
21381
|
var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
20476
|
-
var className, $schema, appId, _a, objectApiName, body, schema;
|
|
21382
|
+
var className, $schema, appId, _a, objectApiName, body, showButtons, showBackButton, schema;
|
|
20477
21383
|
return __generator(this, function (_b) {
|
|
20478
21384
|
switch (_b.label) {
|
|
20479
21385
|
case 0:
|
|
20480
|
-
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;
|
|
20481
|
-
return [4 /*yield*/, getRecordDetailSchema(objectApiName, appId)];
|
|
21386
|
+
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;
|
|
21387
|
+
return [4 /*yield*/, getRecordDetailSchema(objectApiName, appId, { showButtons: showButtons, showBackButton: showBackButton })];
|
|
20482
21388
|
case 1:
|
|
20483
21389
|
schema = (_b.sent()).amisSchema;
|
|
20484
21390
|
// 在非记录页组件下全局作用域下无recordId,会导致表单接口sendOn始终为false,无法发起请求。
|
|
@@ -20488,8 +21394,17 @@ var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
20488
21394
|
// }
|
|
20489
21395
|
// schema.data = Object.assign({}, schema.data, recordDetailData);
|
|
20490
21396
|
if (has(props, "recordId") && $schema.recordId !== "${recordId}") {
|
|
21397
|
+
if (!schema.data) {
|
|
21398
|
+
schema.data = {};
|
|
21399
|
+
}
|
|
20491
21400
|
schema.data.recordId = props.recordId;
|
|
20492
21401
|
}
|
|
21402
|
+
if (has(props, "objectApiName") && props.objectApiName && $schema.objectApiName !== "${objectName}") {
|
|
21403
|
+
if (!schema.data) {
|
|
21404
|
+
schema.data = {};
|
|
21405
|
+
}
|
|
21406
|
+
schema.data.objectName = props.objectApiName;
|
|
21407
|
+
}
|
|
20493
21408
|
schema.className = className;
|
|
20494
21409
|
if (body) {
|
|
20495
21410
|
schema.body = body;
|
|
@@ -20503,28 +21418,39 @@ var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
20503
21418
|
/*
|
|
20504
21419
|
* @Author: baozhoutao@steedos.com
|
|
20505
21420
|
* @Date: 2022-12-08 10:32:17
|
|
20506
|
-
* @LastEditors:
|
|
20507
|
-
* @LastEditTime:
|
|
21421
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
21422
|
+
* @LastEditTime: 2024-01-16 14:09:23
|
|
20508
21423
|
* @Description:
|
|
20509
21424
|
*/
|
|
20510
21425
|
var AmisRecordService = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
20511
|
-
var className, _a, objectApiName, body, style, schema;
|
|
21426
|
+
var className, $schema, appId, _a, objectApiName, body, style, recordId, options, schema;
|
|
20512
21427
|
return __generator(this, function (_b) {
|
|
20513
21428
|
switch (_b.label) {
|
|
20514
21429
|
case 0:
|
|
20515
|
-
className = props.className, props.$schema, props.appId, _a = props.objectApiName, objectApiName = _a === void 0 ? "space_users" : _a, props.
|
|
20516
|
-
|
|
21430
|
+
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;
|
|
21431
|
+
if (has($schema.data, "recordId") && $schema.data.recordId !== "${recordId}") {
|
|
21432
|
+
recordId = $schema.data.recordId;
|
|
21433
|
+
}
|
|
21434
|
+
if (has($schema.data, "objectName") && $schema.data.objectName !== "${objectName}") {
|
|
21435
|
+
objectApiName = $schema.data.objectName;
|
|
21436
|
+
}
|
|
21437
|
+
options = { onEvent: $schema.onEvent, data: $schema.data, recordId: recordId };
|
|
21438
|
+
if (props.$$editor) {
|
|
21439
|
+
options.isEditor = true;
|
|
21440
|
+
}
|
|
21441
|
+
return [4 /*yield*/, getRecordServiceSchema(objectApiName, appId, options, body)];
|
|
20517
21442
|
case 1:
|
|
20518
21443
|
schema = (_b.sent()).amisSchema;
|
|
20519
|
-
if (body) {
|
|
20520
|
-
schema.body = body;
|
|
20521
|
-
}
|
|
20522
21444
|
if (className) {
|
|
20523
21445
|
schema.className = className;
|
|
20524
21446
|
}
|
|
20525
21447
|
if (style) {
|
|
21448
|
+
if (!schema.style) {
|
|
21449
|
+
schema.style = {};
|
|
21450
|
+
}
|
|
20526
21451
|
Object.assign(schema.style, style);
|
|
20527
21452
|
}
|
|
21453
|
+
// console.log(`AmisRecordService====schema==>`, schema)
|
|
20528
21454
|
return [2 /*return*/, schema];
|
|
20529
21455
|
}
|
|
20530
21456
|
});
|
|
@@ -20581,7 +21507,7 @@ var AmisRecordDetailRelatedList = function (props) { return __awaiter(void 0, vo
|
|
|
20581
21507
|
}); };
|
|
20582
21508
|
|
|
20583
21509
|
var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
20584
|
-
var $schema, objectApiName, recordId, _a, perPage, relatedLists, staticRecordId;
|
|
21510
|
+
var $schema, objectApiName, recordId, _a, perPage, formFactor, relatedLists, staticRecordId;
|
|
20585
21511
|
return __generator(this, function (_b) {
|
|
20586
21512
|
switch (_b.label) {
|
|
20587
21513
|
case 0:
|
|
@@ -20596,7 +21522,10 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
|
|
|
20596
21522
|
"className": "mb-3"
|
|
20597
21523
|
}];
|
|
20598
21524
|
}
|
|
20599
|
-
props.formFactor;
|
|
21525
|
+
formFactor = props.formFactor;
|
|
21526
|
+
if (!formFactor) {
|
|
21527
|
+
formFactor = window.innerWidth < 768 ? 'SMALL' : 'LARGE';
|
|
21528
|
+
}
|
|
20600
21529
|
return [4 /*yield*/, getObjectRelatedList(objectApiName)];
|
|
20601
21530
|
case 1:
|
|
20602
21531
|
relatedLists = _b.sent();
|
|
@@ -20609,11 +21538,12 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
|
|
|
20609
21538
|
"className": "mb-3"
|
|
20610
21539
|
}];
|
|
20611
21540
|
}
|
|
20612
|
-
staticRecordId =
|
|
21541
|
+
staticRecordId = props.staticRecordId;
|
|
20613
21542
|
// 在设计器中的设计状态,当上层有recordId具体值,相关表组件的$schema.recordId的默认值就是 "${recordId}"; 会导致获取不到 _master, 进而导致组件显示不了数据。
|
|
20614
21543
|
if (has(props, "recordId") && ($schema.recordId !== "${recordId}" || (props.$$editor && props.recordId !== "${recordId}"))) {
|
|
20615
21544
|
staticRecordId = recordId;
|
|
20616
21545
|
}
|
|
21546
|
+
// console.log('relatedLists======>', relatedLists, staticRecordId)
|
|
20617
21547
|
return [2 /*return*/, {
|
|
20618
21548
|
type: 'service',
|
|
20619
21549
|
className: "steedos-record-detail-related-lists",
|
|
@@ -20622,6 +21552,7 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
|
|
|
20622
21552
|
type: 'steedos-object-related-listview',
|
|
20623
21553
|
objectApiName: objectApiName,
|
|
20624
21554
|
// recordId: recordId,
|
|
21555
|
+
formFactor: formFactor,
|
|
20625
21556
|
relatedObjectApiName: item.object_name,
|
|
20626
21557
|
foreign_key: item.foreign_key,
|
|
20627
21558
|
relatedKey: item.foreign_key,
|
|
@@ -20636,6 +21567,7 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
|
|
|
20636
21567
|
if (staticRecordId) {
|
|
20637
21568
|
relatedList.recordId = staticRecordId;
|
|
20638
21569
|
}
|
|
21570
|
+
// console.log('relatedList=====>', relatedList)
|
|
20639
21571
|
return relatedList;
|
|
20640
21572
|
})
|
|
20641
21573
|
}];
|
|
@@ -21148,7 +22080,7 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21148
22080
|
* @Author: baozhoutao@steedos.com
|
|
21149
22081
|
* @Date: 2022-09-01 14:44:57
|
|
21150
22082
|
* @LastEditors: baozhoutao@steedos.com
|
|
21151
|
-
* @LastEditTime:
|
|
22083
|
+
* @LastEditTime: 2024-01-31 14:43:14
|
|
21152
22084
|
* @Description:
|
|
21153
22085
|
*/
|
|
21154
22086
|
var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -21196,33 +22128,108 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
21196
22128
|
"label": instance.t('frontend_help')
|
|
21197
22129
|
},
|
|
21198
22130
|
{
|
|
21199
|
-
"type": "button",
|
|
21200
|
-
"
|
|
21201
|
-
"
|
|
21202
|
-
|
|
21203
|
-
|
|
21204
|
-
|
|
21205
|
-
|
|
21206
|
-
|
|
21207
|
-
|
|
21208
|
-
|
|
21209
|
-
|
|
22131
|
+
"type": "dropdown-button",
|
|
22132
|
+
"label": false,
|
|
22133
|
+
"trigger": "click",
|
|
22134
|
+
"level": "link",
|
|
22135
|
+
"btnClassName": "p-0 m-0",
|
|
22136
|
+
"icon": "fa fa-cog text-xl slds-button_icon m-0",
|
|
22137
|
+
"align": "right",
|
|
22138
|
+
"hideCaret": true,
|
|
22139
|
+
"buttons": [
|
|
22140
|
+
{
|
|
22141
|
+
"type": "button",
|
|
22142
|
+
"hiddenOn": "window.innerWidth < 768",
|
|
22143
|
+
"onEvent": {
|
|
22144
|
+
"click": {
|
|
22145
|
+
"actions": [
|
|
22146
|
+
{
|
|
22147
|
+
"args": {
|
|
22148
|
+
"url": "/app/admin"
|
|
22149
|
+
},
|
|
22150
|
+
"actionType": "url"
|
|
22151
|
+
}
|
|
22152
|
+
]
|
|
21210
22153
|
}
|
|
21211
|
-
|
|
21212
|
-
|
|
21213
|
-
|
|
21214
|
-
|
|
21215
|
-
|
|
22154
|
+
},
|
|
22155
|
+
"id": "u:b5d0ab3a32b5",
|
|
22156
|
+
"level": "link",
|
|
22157
|
+
"label": instance.t('frontend_setup')
|
|
22158
|
+
},
|
|
22159
|
+
// {
|
|
22160
|
+
// "type": "divider",
|
|
22161
|
+
// "className": "m-0",
|
|
22162
|
+
// "visibleOn": "${window:Meteor.settings.public.enable_saas != true && global.user.is_space_admin == true}"
|
|
22163
|
+
// },
|
|
21216
22164
|
{
|
|
21217
|
-
"type": "
|
|
21218
|
-
"
|
|
21219
|
-
"
|
|
21220
|
-
"
|
|
21221
|
-
|
|
21222
|
-
|
|
22165
|
+
"type": "button",
|
|
22166
|
+
"label": "编辑对象",
|
|
22167
|
+
"className": "flex",
|
|
22168
|
+
"onEvent": {
|
|
22169
|
+
"click": {
|
|
22170
|
+
"actions": [
|
|
22171
|
+
{
|
|
22172
|
+
"actionType": "ajax",
|
|
22173
|
+
"outputVar": "responseResult",
|
|
22174
|
+
"args": {
|
|
22175
|
+
"api": {
|
|
22176
|
+
"url": "/api/v1/objects/search",
|
|
22177
|
+
"data": {
|
|
22178
|
+
"filters": ["name", "=", "${window:FlowRouter|routerParams|pick:object_name}"],
|
|
22179
|
+
"fields": ["_id"]
|
|
22180
|
+
},
|
|
22181
|
+
"method": "post",
|
|
22182
|
+
"messages": {}
|
|
22183
|
+
}
|
|
22184
|
+
}
|
|
22185
|
+
},
|
|
22186
|
+
{
|
|
22187
|
+
"args": {
|
|
22188
|
+
"url": "/app/admin/objects/view/${responseResult.items[0]._id}",
|
|
22189
|
+
},
|
|
22190
|
+
"actionType": "url"
|
|
22191
|
+
}
|
|
22192
|
+
]
|
|
22193
|
+
}
|
|
22194
|
+
},
|
|
22195
|
+
"level": "link",
|
|
22196
|
+
"visibleOn": "${window:Meteor.settings.public.enable_saas != true && global.user.is_space_admin == true && window:FlowRouter|isObjectRouter}"
|
|
22197
|
+
},
|
|
22198
|
+
{
|
|
22199
|
+
"type": "button",
|
|
22200
|
+
"label": "编辑页面",
|
|
22201
|
+
"className": "flex",
|
|
22202
|
+
"onEvent": {
|
|
22203
|
+
"click": {
|
|
22204
|
+
"actions": [
|
|
22205
|
+
{
|
|
22206
|
+
"actionType": "ajax",
|
|
22207
|
+
"outputVar": "responseResult",
|
|
22208
|
+
"args": {
|
|
22209
|
+
"api": {
|
|
22210
|
+
"url": "/api/v1/pages/search",
|
|
22211
|
+
"data": {
|
|
22212
|
+
"filters": ["name", "=", "${window:FlowRouter|routerParams|pick:page_id}"],
|
|
22213
|
+
"fields": ["_id"]
|
|
22214
|
+
},
|
|
22215
|
+
"method": "post",
|
|
22216
|
+
"messages": {}
|
|
22217
|
+
}
|
|
22218
|
+
}
|
|
22219
|
+
},
|
|
22220
|
+
{
|
|
22221
|
+
"args": {
|
|
22222
|
+
"url": "/app/admin/pages/view/${responseResult.items[0]._id}"
|
|
22223
|
+
},
|
|
22224
|
+
"actionType": "url"
|
|
22225
|
+
}
|
|
22226
|
+
]
|
|
22227
|
+
}
|
|
22228
|
+
},
|
|
22229
|
+
"level": "link",
|
|
22230
|
+
"visibleOn": "${window:Meteor.settings.public.enable_saas != true && global.user.is_space_admin == true && window:FlowRouter|isPageRouter}"
|
|
21223
22231
|
}
|
|
21224
|
-
]
|
|
21225
|
-
"label": instance.t('frontend_setup')
|
|
22232
|
+
]
|
|
21226
22233
|
},
|
|
21227
22234
|
{
|
|
21228
22235
|
"type": "steedos-dropdown",
|
|
@@ -21479,6 +22486,26 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
21479
22486
|
},
|
|
21480
22487
|
"level": "link"
|
|
21481
22488
|
},
|
|
22489
|
+
{
|
|
22490
|
+
"type": "button",
|
|
22491
|
+
"label": instance.t('switch_space'),
|
|
22492
|
+
"className": "flex",
|
|
22493
|
+
"onEvent": {
|
|
22494
|
+
"click": {
|
|
22495
|
+
"actions": [
|
|
22496
|
+
{
|
|
22497
|
+
"args": {
|
|
22498
|
+
"url": "/accounts/a/#/select-space",
|
|
22499
|
+
"blank": false
|
|
22500
|
+
},
|
|
22501
|
+
"actionType": "url"
|
|
22502
|
+
}
|
|
22503
|
+
]
|
|
22504
|
+
}
|
|
22505
|
+
},
|
|
22506
|
+
"level": "link",
|
|
22507
|
+
"visibleOn": "${window:Meteor.settings.public.enable_saas}"
|
|
22508
|
+
},
|
|
21482
22509
|
{
|
|
21483
22510
|
"type": "button",
|
|
21484
22511
|
"label": instance.t('frontend_about'),
|
|
@@ -21530,14 +22557,14 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
21530
22557
|
/*
|
|
21531
22558
|
* @Author: baozhoutao@steedos.com
|
|
21532
22559
|
* @Date: 2022-09-01 14:44:57
|
|
21533
|
-
* @LastEditors:
|
|
21534
|
-
* @LastEditTime: 2024-01-
|
|
22560
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
22561
|
+
* @LastEditTime: 2024-01-16 13:45:42
|
|
21535
22562
|
* @Description:
|
|
21536
22563
|
*/
|
|
21537
22564
|
var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
21538
|
-
var logoSrc, isMobile, schema;
|
|
22565
|
+
var logoSrc, customButtons, isMobile, schema;
|
|
21539
22566
|
return __generator(this, function (_a) {
|
|
21540
|
-
logoSrc = props.logoSrc;
|
|
22567
|
+
logoSrc = props.logoSrc, customButtons = props.customButtons;
|
|
21541
22568
|
isMobile = window.innerWidth <= 768;
|
|
21542
22569
|
schema = {
|
|
21543
22570
|
"type": "wrapper",
|
|
@@ -21628,39 +22655,7 @@ var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21628
22655
|
"label": "Global Header",
|
|
21629
22656
|
className: 'flex flex-nowrap gap-x-3 items-center',
|
|
21630
22657
|
logoutScript: "window.signOut();",
|
|
21631
|
-
customButtons:
|
|
21632
|
-
{
|
|
21633
|
-
"type": "button",
|
|
21634
|
-
"className": "toggle-sidebar",
|
|
21635
|
-
"visibleOn": "${AND(app.showSidebar,!" + isMobile + ")}",
|
|
21636
|
-
"onEvent": {
|
|
21637
|
-
"click": {
|
|
21638
|
-
"actions": [
|
|
21639
|
-
{
|
|
21640
|
-
"actionType": "custom",
|
|
21641
|
-
"script": "document.body.classList.toggle('sidebar-open')",
|
|
21642
|
-
}
|
|
21643
|
-
]
|
|
21644
|
-
}
|
|
21645
|
-
},
|
|
21646
|
-
"body": [
|
|
21647
|
-
{
|
|
21648
|
-
"type": "steedos-icon",
|
|
21649
|
-
"category": "utility",
|
|
21650
|
-
"name": "rows",
|
|
21651
|
-
"colorVariant": "default",
|
|
21652
|
-
"id": "u:afc3a08e8cf3",
|
|
21653
|
-
"className": "slds-button_icon slds-global-header__icon"
|
|
21654
|
-
}
|
|
21655
|
-
],
|
|
21656
|
-
},
|
|
21657
|
-
{
|
|
21658
|
-
"type": "steedos-app-launcher",
|
|
21659
|
-
"showAppName": false,
|
|
21660
|
-
"appId": "${app.id}",
|
|
21661
|
-
"visibleOn": "${isMobile}"
|
|
21662
|
-
}
|
|
21663
|
-
]
|
|
22658
|
+
customButtons: customButtons
|
|
21664
22659
|
}
|
|
21665
22660
|
],
|
|
21666
22661
|
},
|
|
@@ -21776,13 +22771,13 @@ function getAmisStaticFieldType(type, data_type, options) {
|
|
|
21776
22771
|
return "switch";
|
|
21777
22772
|
}
|
|
21778
22773
|
else if (type === 'currency') {
|
|
21779
|
-
return "number";
|
|
22774
|
+
return "input-number";
|
|
21780
22775
|
}
|
|
21781
22776
|
else if (type === 'autonumber') {
|
|
21782
22777
|
return "input-text"; //不可以用text,因为会出现字段label显示不出来的问题
|
|
21783
22778
|
}
|
|
21784
22779
|
else if (type === 'percent') {
|
|
21785
|
-
return "number";
|
|
22780
|
+
return "input-number";
|
|
21786
22781
|
}
|
|
21787
22782
|
else if (type === 'formula' || type === 'summary') {
|
|
21788
22783
|
return getAmisStaticFieldType(data_type, null, options);
|
|
@@ -21796,17 +22791,20 @@ function getAmisStaticFieldType(type, data_type, options) {
|
|
|
21796
22791
|
}
|
|
21797
22792
|
return "static-image";
|
|
21798
22793
|
}
|
|
22794
|
+
else if (type === 'textarea') {
|
|
22795
|
+
return 'static';
|
|
22796
|
+
}
|
|
21799
22797
|
return type;
|
|
21800
22798
|
}
|
|
21801
22799
|
var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
21802
|
-
var steedosField, field, _a, readonly, _b, ctx, config, fStatic, env, inInputTable, defaultSource, source, fieldBaseProps,
|
|
21803
|
-
var e_1,
|
|
21804
|
-
var
|
|
21805
|
-
return __generator(this, function (
|
|
21806
|
-
switch (
|
|
22800
|
+
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;
|
|
22801
|
+
var _e, e_1, _f;
|
|
22802
|
+
var _g, _h, _j, _k, _l, _m;
|
|
22803
|
+
return __generator(this, function (_o) {
|
|
22804
|
+
switch (_o.label) {
|
|
21807
22805
|
case 0:
|
|
21808
22806
|
steedosField = null;
|
|
21809
|
-
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;
|
|
22807
|
+
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;
|
|
21810
22808
|
// console.log(`AmisSteedosField`, props)
|
|
21811
22809
|
// if($schema.config && isString($schema.config)){
|
|
21812
22810
|
// $schema.config = JSON.parse($schema.config)
|
|
@@ -21834,14 +22832,14 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21834
22832
|
// 字段配置为只读,强制走fStatic模式,加上_display判断是为了不影响历史代码,比如直接在ObjectForm中调用steedos-field组件
|
|
21835
22833
|
fStatic = true;
|
|
21836
22834
|
}
|
|
21837
|
-
|
|
22835
|
+
_o.label = 1;
|
|
21838
22836
|
case 1:
|
|
21839
|
-
|
|
21840
|
-
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/,
|
|
22837
|
+
_o.trys.push([1, 24, , 25]);
|
|
22838
|
+
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/, 7];
|
|
21841
22839
|
defaultSource = {
|
|
21842
22840
|
"method": "post",
|
|
21843
22841
|
"url": "${context.rootUrl}/graphql",
|
|
21844
|
-
"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 "),
|
|
22842
|
+
"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 "),
|
|
21845
22843
|
"trackExpression": "${" + steedosField.name + "}",
|
|
21846
22844
|
"cache": 3000
|
|
21847
22845
|
};
|
|
@@ -21858,50 +22856,180 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21858
22856
|
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 ");
|
|
21859
22857
|
}
|
|
21860
22858
|
}
|
|
21861
|
-
source = ((
|
|
22859
|
+
source = ((_g = steedosField.amis) === null || _g === void 0 ? void 0 : _g.source) || ((_h = steedosField.amis) === null || _h === void 0 ? void 0 : _h.autoComplete) || defaultSource;
|
|
21862
22860
|
fieldBaseProps = {
|
|
21863
22861
|
multiple: steedosField.multiple,
|
|
21864
22862
|
name: steedosField.name,
|
|
21865
22863
|
label: steedosField.label,
|
|
21866
22864
|
static: true,
|
|
21867
|
-
|
|
22865
|
+
required: steedosField.required,
|
|
22866
|
+
className: "".concat(className || '', " ").concat(((_j = steedosField.amis) === null || _j === void 0 ? void 0 : _j.className) || '')
|
|
21868
22867
|
};
|
|
21869
22868
|
if (!inInputTable) return [3 /*break*/, 2];
|
|
21870
22869
|
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'select', source: source });
|
|
21871
|
-
return [3 /*break*/,
|
|
22870
|
+
return [3 /*break*/, 6];
|
|
21872
22871
|
case 2:
|
|
21873
|
-
|
|
21874
|
-
return [
|
|
22872
|
+
referenceTo_1 = steedosField.reference_to;
|
|
22873
|
+
if (!referenceTo_1) return [3 /*break*/, 6];
|
|
22874
|
+
if (isArray(referenceTo_1)) {
|
|
22875
|
+
fieldValue = (_k = props.data) === null || _k === void 0 ? void 0 : _k[steedosField.name];
|
|
22876
|
+
if (fieldValue && fieldValue.o) {
|
|
22877
|
+
referenceTo_1 = fieldValue.o;
|
|
22878
|
+
}
|
|
22879
|
+
else {
|
|
22880
|
+
referenceTo_1 = referenceTo_1[0];
|
|
22881
|
+
}
|
|
22882
|
+
}
|
|
22883
|
+
steedosField.reference_to_field;
|
|
22884
|
+
if (referenceTo_1 === 'users') {
|
|
22885
|
+
referenceTo_1 = 'space_users';
|
|
22886
|
+
}
|
|
22887
|
+
return [4 /*yield*/, getUISchema(referenceTo_1)];
|
|
21875
22888
|
case 3:
|
|
21876
|
-
|
|
21877
|
-
|
|
21878
|
-
|
|
21879
|
-
if (
|
|
21880
|
-
|
|
21881
|
-
|
|
21882
|
-
|
|
21883
|
-
|
|
21884
|
-
|
|
21885
|
-
|
|
21886
|
-
|
|
21887
|
-
|
|
21888
|
-
|
|
21889
|
-
|
|
22889
|
+
fieldRefObject = _o.sent();
|
|
22890
|
+
if (!(props.data._display && has(props.data._display, steedosField.name))) return [3 /*break*/, 4];
|
|
22891
|
+
disPlayValue = get$1(props.data._display, steedosField.name);
|
|
22892
|
+
if (disPlayValue) {
|
|
22893
|
+
if (!isArray(disPlayValue) && isObject$1(disPlayValue)) {
|
|
22894
|
+
disPlayValue = [disPlayValue];
|
|
22895
|
+
}
|
|
22896
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, {
|
|
22897
|
+
type: 'control',
|
|
22898
|
+
name: null,
|
|
22899
|
+
body: {
|
|
22900
|
+
type: 'wrapper',
|
|
22901
|
+
className: "steedos-field-lookup-wrapper p-0",
|
|
22902
|
+
"wrapWithPanel": false,
|
|
22903
|
+
"actions": [],
|
|
22904
|
+
body: [
|
|
22905
|
+
{
|
|
22906
|
+
type: 'each',
|
|
22907
|
+
placeholder: "",
|
|
22908
|
+
className: "steedos-field-lookup-each flex flex-wrap gap-2",
|
|
22909
|
+
source: "${_display.".concat(steedosField.name, "|asArray}"),
|
|
22910
|
+
items: {
|
|
22911
|
+
type: 'static',
|
|
22912
|
+
labelClassName: "hidden",
|
|
22913
|
+
label: false,
|
|
22914
|
+
className: 'm-0',
|
|
22915
|
+
tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\">${label}</a>",
|
|
22916
|
+
popOver: fieldRefObject.compactLayouts ? {
|
|
22917
|
+
"trigger": "hover",
|
|
22918
|
+
"className": "steedos-record-detail-popover",
|
|
22919
|
+
"position": "left-bottom",
|
|
22920
|
+
"showIcon": false,
|
|
22921
|
+
"title": false,
|
|
22922
|
+
"offset": {
|
|
22923
|
+
"top": 0,
|
|
22924
|
+
"left": 20
|
|
22925
|
+
},
|
|
22926
|
+
"body": [
|
|
22927
|
+
{
|
|
22928
|
+
"type": "steedos-record-mini",
|
|
22929
|
+
"objectApiName": "${objectName}",
|
|
22930
|
+
"recordId": "${value}",
|
|
22931
|
+
"showButtons": false,
|
|
22932
|
+
"showBackButton": false,
|
|
22933
|
+
"data": {
|
|
22934
|
+
"objectName": "${objectName}",
|
|
22935
|
+
"recordId": "${value}"
|
|
22936
|
+
}
|
|
22937
|
+
}
|
|
22938
|
+
]
|
|
22939
|
+
} : null
|
|
22940
|
+
}
|
|
22941
|
+
}
|
|
22942
|
+
]
|
|
21890
22943
|
}
|
|
21891
22944
|
});
|
|
21892
22945
|
}
|
|
21893
|
-
|
|
21894
|
-
|
|
21895
|
-
|
|
22946
|
+
else {
|
|
22947
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'static', tpl: '-', className: "".concat(fieldBaseProps.className || '', " text-muted") });
|
|
22948
|
+
}
|
|
22949
|
+
return [3 /*break*/, 6];
|
|
22950
|
+
case 4: return [4 /*yield*/, env.fetcher(source, props.data)];
|
|
22951
|
+
case 5:
|
|
22952
|
+
res = _o.sent();
|
|
22953
|
+
valueOptions_1 = ((_l = res === null || res === void 0 ? void 0 : res.data) === null || _l === void 0 ? void 0 : _l.options) || [];
|
|
22954
|
+
fieldValue = (_m = props.data) === null || _m === void 0 ? void 0 : _m[steedosField.name];
|
|
22955
|
+
values = fieldValue;
|
|
22956
|
+
if (isString(values)) {
|
|
22957
|
+
values = [values];
|
|
22958
|
+
}
|
|
22959
|
+
if (values && values.length > 0) {
|
|
22960
|
+
disPlayValue_1 = [];
|
|
22961
|
+
each(values, function (value) {
|
|
22962
|
+
var option = valueOptions_1.find(function (item) { return item.value === value; });
|
|
22963
|
+
if (option) {
|
|
22964
|
+
disPlayValue_1.push({
|
|
22965
|
+
objectName: referenceTo_1,
|
|
22966
|
+
value: option._id || option.value,
|
|
22967
|
+
label: option.label
|
|
22968
|
+
});
|
|
22969
|
+
}
|
|
22970
|
+
});
|
|
22971
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'control', name: null, body: {
|
|
22972
|
+
type: 'form',
|
|
22973
|
+
className: "steedos-field-lookup-wrapper p-0",
|
|
22974
|
+
"wrapWithPanel": false,
|
|
22975
|
+
"actions": [],
|
|
22976
|
+
data: (_e = {},
|
|
22977
|
+
_e[steedosField.name] = disPlayValue_1,
|
|
22978
|
+
_e),
|
|
22979
|
+
body: [
|
|
22980
|
+
{
|
|
22981
|
+
type: 'each',
|
|
22982
|
+
placeholder: "",
|
|
22983
|
+
className: "steedos-field-lookup-each flex flex-wrap gap-2",
|
|
22984
|
+
source: "${".concat(steedosField.name, "}"),
|
|
22985
|
+
items: {
|
|
22986
|
+
type: 'static',
|
|
22987
|
+
className: 'm-0',
|
|
22988
|
+
tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\">${label}</a>",
|
|
22989
|
+
popOver: fieldRefObject.compactLayouts ? {
|
|
22990
|
+
"trigger": "hover",
|
|
22991
|
+
"className": "steedos-record-detail-popover",
|
|
22992
|
+
"position": "left-bottom",
|
|
22993
|
+
"showIcon": false,
|
|
22994
|
+
"title": false,
|
|
22995
|
+
"offset": {
|
|
22996
|
+
"top": 0,
|
|
22997
|
+
"left": 20
|
|
22998
|
+
},
|
|
22999
|
+
"body": [
|
|
23000
|
+
{
|
|
23001
|
+
"type": "steedos-record-mini",
|
|
23002
|
+
"objectApiName": "${objectName}",
|
|
23003
|
+
"recordId": "${value}",
|
|
23004
|
+
"showButtons": false,
|
|
23005
|
+
"showBackButton": false,
|
|
23006
|
+
"data": {
|
|
23007
|
+
"objectName": "${objectName}",
|
|
23008
|
+
"recordId": "${value}"
|
|
23009
|
+
}
|
|
23010
|
+
}
|
|
23011
|
+
]
|
|
23012
|
+
} : null
|
|
23013
|
+
}
|
|
23014
|
+
}
|
|
23015
|
+
]
|
|
23016
|
+
} });
|
|
23017
|
+
}
|
|
23018
|
+
else {
|
|
23019
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'static', tpl: '-', className: "".concat(fieldBaseProps.className || '', " text-muted") });
|
|
23020
|
+
}
|
|
23021
|
+
_o.label = 6;
|
|
23022
|
+
case 6:
|
|
21896
23023
|
schema = Object.assign({}, fieldBaseProps, pick(steedosField.amis || {}, ['className', 'inline', 'label', 'labelAlign', 'name', 'labelRemark', 'description', 'placeholder', 'staticClassName', 'staticLabelClassName', 'staticInputClassName', 'staticSchema']));
|
|
21897
23024
|
schema.placeholder = "";
|
|
23025
|
+
// console.log(`steedos field [lookup] schema:`, schema)
|
|
21898
23026
|
return [2 /*return*/, schema];
|
|
21899
|
-
case
|
|
21900
|
-
if (!fStatic) return [3 /*break*/,
|
|
21901
|
-
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/,
|
|
23027
|
+
case 7:
|
|
23028
|
+
if (!fStatic) return [3 /*break*/, 21];
|
|
23029
|
+
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/, 9];
|
|
21902
23030
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
21903
|
-
case
|
|
21904
|
-
fieldSchema =
|
|
23031
|
+
case 8:
|
|
23032
|
+
fieldSchema = _o.sent();
|
|
21905
23033
|
if (steedosField.type === 'file' && fieldSchema.disabled) {
|
|
21906
23034
|
fieldValue = fieldSchema.value;
|
|
21907
23035
|
if (fieldValue && fieldValue.length) {
|
|
@@ -21937,59 +23065,59 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21937
23065
|
}
|
|
21938
23066
|
}
|
|
21939
23067
|
return [2 /*return*/, fieldSchema];
|
|
21940
|
-
case
|
|
23068
|
+
case 9:
|
|
21941
23069
|
schema = Object.assign({}, steedosField, {
|
|
21942
23070
|
type: getAmisStaticFieldType(steedosField.type, steedosField.data_type, steedosField),
|
|
21943
23071
|
static: true,
|
|
21944
23072
|
label: steedosField.label
|
|
21945
23073
|
});
|
|
21946
|
-
if (!(steedosField.type === "time")) return [3 /*break*/,
|
|
23074
|
+
if (!(steedosField.type === "time")) return [3 /*break*/, 10];
|
|
21947
23075
|
Object.assign(schema, {
|
|
21948
23076
|
inputFormat: 'HH:mm',
|
|
21949
23077
|
timeFormat: 'HH:mm',
|
|
21950
23078
|
format: '1970-01-01THH:mm:00.000[Z]',
|
|
21951
23079
|
});
|
|
21952
|
-
return [3 /*break*/,
|
|
21953
|
-
case
|
|
21954
|
-
if (!(steedosField.type === "percent")) return [3 /*break*/,
|
|
23080
|
+
return [3 /*break*/, 20];
|
|
23081
|
+
case 10:
|
|
23082
|
+
if (!(steedosField.type === "percent")) return [3 /*break*/, 11];
|
|
21955
23083
|
Object.assign(schema, {
|
|
21956
23084
|
"percent": steedosField.scale ? steedosField.scale : true
|
|
21957
23085
|
});
|
|
21958
|
-
return [3 /*break*/,
|
|
21959
|
-
case
|
|
21960
|
-
if (!(steedosField.type === "password")) return [3 /*break*/,
|
|
23086
|
+
return [3 /*break*/, 20];
|
|
23087
|
+
case 11:
|
|
23088
|
+
if (!(steedosField.type === "password")) return [3 /*break*/, 12];
|
|
21961
23089
|
Object.assign(schema, {
|
|
21962
23090
|
"revealPassword": false //没生效,需要用样式隐藏
|
|
21963
23091
|
});
|
|
21964
|
-
return [3 /*break*/,
|
|
21965
|
-
case
|
|
21966
|
-
if (!(steedosField.type === "select")) return [3 /*break*/,
|
|
23092
|
+
return [3 /*break*/, 20];
|
|
23093
|
+
case 12:
|
|
23094
|
+
if (!(steedosField.type === "select")) return [3 /*break*/, 13];
|
|
21967
23095
|
Object.assign(schema, {
|
|
21968
23096
|
"placeholder": ""
|
|
21969
23097
|
});
|
|
21970
|
-
return [3 /*break*/,
|
|
21971
|
-
case
|
|
21972
|
-
if (!(steedosField.type === "color")) return [3 /*break*/,
|
|
23098
|
+
return [3 /*break*/, 20];
|
|
23099
|
+
case 13:
|
|
23100
|
+
if (!(steedosField.type === "color")) return [3 /*break*/, 14];
|
|
21973
23101
|
Object.assign(schema, {
|
|
21974
23102
|
"defaultColor": null
|
|
21975
23103
|
});
|
|
21976
|
-
return [3 /*break*/,
|
|
21977
|
-
case
|
|
21978
|
-
if (!(steedosField.type === "number")) return [3 /*break*/,
|
|
23104
|
+
return [3 /*break*/, 20];
|
|
23105
|
+
case 14:
|
|
23106
|
+
if (!(steedosField.type === "number" || steedosField.type === 'currency')) return [3 /*break*/, 15];
|
|
21979
23107
|
// amis input-number和number组件中的precision表示小数位数,并不是魔方平台的精度概念,要转换下,否则小数点后会显示很多的0
|
|
21980
23108
|
Object.assign(schema, {
|
|
21981
23109
|
"precision": steedosField.scale || 0
|
|
21982
23110
|
});
|
|
21983
|
-
return [3 /*break*/,
|
|
21984
|
-
case
|
|
21985
|
-
if (!(steedosField.type === "table")) return [3 /*break*/,
|
|
23111
|
+
return [3 /*break*/, 20];
|
|
23112
|
+
case 15:
|
|
23113
|
+
if (!(steedosField.type === "table")) return [3 /*break*/, 16];
|
|
21986
23114
|
if (steedosField.subFields) {
|
|
21987
23115
|
tableFields = [];
|
|
21988
23116
|
try {
|
|
21989
|
-
for (_c = __values(
|
|
23117
|
+
for (_c = __values(steedosField.subFields), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
21990
23118
|
subField = _d.value;
|
|
21991
23119
|
if (!subField.name.endsWith(".$")) {
|
|
21992
|
-
subFieldName = subField.name.replace("".concat(
|
|
23120
|
+
subFieldName = subField.name.replace("".concat(steedosField._prefix || '').concat(steedosField.name, ".$."), '').replace("".concat(steedosField.name, "."), '');
|
|
21993
23121
|
// const gridSub = await convertSFieldToAmisField(Object.assign({}, subField, {name: subFieldName, isTableField: true}), readonly, ctx);
|
|
21994
23122
|
tableFields.push(Object.assign({}, subField, { name: subFieldName }));
|
|
21995
23123
|
}
|
|
@@ -21998,13 +23126,12 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21998
23126
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
21999
23127
|
finally {
|
|
22000
23128
|
try {
|
|
22001
|
-
if (_d && !_d.done && (
|
|
23129
|
+
if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
|
|
22002
23130
|
}
|
|
22003
23131
|
finally { if (e_1) throw e_1.error; }
|
|
22004
23132
|
}
|
|
22005
23133
|
Object.assign(schema, {
|
|
22006
23134
|
type: 'steedos-input-table',
|
|
22007
|
-
showIndex: true,
|
|
22008
23135
|
editable: false,
|
|
22009
23136
|
addable: false,
|
|
22010
23137
|
removable: false,
|
|
@@ -22015,9 +23142,9 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22015
23142
|
}
|
|
22016
23143
|
});
|
|
22017
23144
|
}
|
|
22018
|
-
return [3 /*break*/,
|
|
22019
|
-
case
|
|
22020
|
-
if (!(steedosField.type === "image")) return [3 /*break*/,
|
|
23145
|
+
return [3 /*break*/, 20];
|
|
23146
|
+
case 16:
|
|
23147
|
+
if (!(steedosField.type === "image")) return [3 /*break*/, 17];
|
|
22021
23148
|
Object.assign(schema, {
|
|
22022
23149
|
enlargeAble: true,
|
|
22023
23150
|
showToolbar: true,
|
|
@@ -22048,18 +23175,32 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22048
23175
|
return value;
|
|
22049
23176
|
}
|
|
22050
23177
|
});
|
|
22051
|
-
return [3 /*break*/,
|
|
22052
|
-
case
|
|
22053
|
-
if (!(steedosField.type === "file")) return [3 /*break*/,
|
|
23178
|
+
return [3 /*break*/, 20];
|
|
23179
|
+
case 17:
|
|
23180
|
+
if (!(steedosField.type === "file")) return [3 /*break*/, 19];
|
|
22054
23181
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
22055
|
-
case
|
|
23182
|
+
case 18:
|
|
22056
23183
|
// 附件static模式先保持原来的逻辑,依赖_display,审批王中相关功能在creator中
|
|
22057
23184
|
// convertSFieldToAmisField中会合并steedosField.amis,所以也不需要再次合并steedosField.amis,直接return就好
|
|
22058
|
-
return [2 /*return*/,
|
|
22059
|
-
case
|
|
23185
|
+
return [2 /*return*/, _o.sent()];
|
|
23186
|
+
case 19:
|
|
23187
|
+
if (steedosField.type === 'formula' || steedosField.type === 'summary') {
|
|
23188
|
+
if (steedosField.data_type === 'number' || steedosField.data_type === 'currency') {
|
|
23189
|
+
Object.assign(schema, {
|
|
23190
|
+
"precision": steedosField.scale || 0
|
|
23191
|
+
});
|
|
23192
|
+
}
|
|
23193
|
+
}
|
|
23194
|
+
else if (steedosField.type === 'textarea') {
|
|
23195
|
+
Object.assign(schema, {
|
|
23196
|
+
tpl: "<%=(data.".concat(steedosField.name, " || \"\").split(\"\\n\").join('<br>')%>")
|
|
23197
|
+
});
|
|
23198
|
+
}
|
|
23199
|
+
_o.label = 20;
|
|
23200
|
+
case 20:
|
|
22060
23201
|
Object.assign(schema, steedosField.amis || {});
|
|
22061
23202
|
return [2 /*return*/, schema];
|
|
22062
|
-
case
|
|
23203
|
+
case 21:
|
|
22063
23204
|
fieldAmis = steedosField.amis || {};
|
|
22064
23205
|
if (!props.data.hasOwnProperty("_display")) {
|
|
22065
23206
|
// 有_display时保持原来的逻辑不变,不走以下新的逻辑,审批王中会特意传入_display以跳过后面新加的代码
|
|
@@ -22117,16 +23258,16 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22117
23258
|
}
|
|
22118
23259
|
}
|
|
22119
23260
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
22120
|
-
case
|
|
22121
|
-
schema =
|
|
23261
|
+
case 22:
|
|
23262
|
+
schema = _o.sent();
|
|
22122
23263
|
// console.log(`AmisSteedosField return schema`, schema)
|
|
22123
23264
|
return [2 /*return*/, schema];
|
|
22124
|
-
case
|
|
22125
|
-
case
|
|
22126
|
-
error_1 =
|
|
23265
|
+
case 23: return [3 /*break*/, 25];
|
|
23266
|
+
case 24:
|
|
23267
|
+
error_1 = _o.sent();
|
|
22127
23268
|
console.log("error", error_1);
|
|
22128
|
-
return [3 /*break*/,
|
|
22129
|
-
case
|
|
23269
|
+
return [3 /*break*/, 25];
|
|
23270
|
+
case 25: return [2 /*return*/, null];
|
|
22130
23271
|
}
|
|
22131
23272
|
});
|
|
22132
23273
|
}); };
|
|
@@ -22369,7 +23510,7 @@ var AmisInputTable = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
22369
23510
|
return __generator(this, function (_a) {
|
|
22370
23511
|
switch (_a.label) {
|
|
22371
23512
|
case 0:
|
|
22372
|
-
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;
|
|
23513
|
+
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;
|
|
22373
23514
|
return [4 /*yield*/, getAmisInputTableSchema(props)];
|
|
22374
23515
|
case 1:
|
|
22375
23516
|
amisSchema = _a.sent();
|
|
@@ -22379,6 +23520,46 @@ var AmisInputTable = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
22379
23520
|
});
|
|
22380
23521
|
}); };
|
|
22381
23522
|
|
|
23523
|
+
var AmisRecordDetailMini = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
23524
|
+
var $schema, appId, _a, objectApiName, recordId, schemaData, options, schema;
|
|
23525
|
+
return __generator(this, function (_b) {
|
|
23526
|
+
switch (_b.label) {
|
|
23527
|
+
case 0:
|
|
23528
|
+
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;
|
|
23529
|
+
schemaData = {};
|
|
23530
|
+
if (has(props.data, "recordId") && props.data.recordId !== "${recordId}") {
|
|
23531
|
+
recordId = props.data.recordId;
|
|
23532
|
+
schemaData.recordId = recordId;
|
|
23533
|
+
}
|
|
23534
|
+
if (has(props.data, "value")) {
|
|
23535
|
+
recordId = props.data.value;
|
|
23536
|
+
schemaData.recordId = recordId;
|
|
23537
|
+
}
|
|
23538
|
+
if (has(props.data, "objectName") && props.data.objectName !== "${objectName}") {
|
|
23539
|
+
objectApiName = props.data.objectName;
|
|
23540
|
+
schemaData.objectName = objectApiName;
|
|
23541
|
+
}
|
|
23542
|
+
options = {
|
|
23543
|
+
onEvent: $schema.onEvent,
|
|
23544
|
+
data: $schema.data,
|
|
23545
|
+
recordId: recordId
|
|
23546
|
+
};
|
|
23547
|
+
if (props.$$editor) {
|
|
23548
|
+
options.isEditor = true;
|
|
23549
|
+
}
|
|
23550
|
+
console.log("AmisRecordDetailMini==2=>", objectApiName, options);
|
|
23551
|
+
return [4 /*yield*/, getRecordDetailMiniSchema(objectApiName, appId, options)];
|
|
23552
|
+
case 1:
|
|
23553
|
+
schema = _b.sent();
|
|
23554
|
+
if (!isEmpty(schemaData)) {
|
|
23555
|
+
schema.data = schemaData;
|
|
23556
|
+
}
|
|
23557
|
+
// console.log(`AmisRecordDetailMini===>`, schema)
|
|
23558
|
+
return [2 /*return*/, schema];
|
|
23559
|
+
}
|
|
23560
|
+
});
|
|
23561
|
+
}); };
|
|
23562
|
+
|
|
22382
23563
|
var PageListView = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22383
23564
|
var formFactor, appId, objectApiName, display, data, _display, page, listSchema;
|
|
22384
23565
|
return __generator(this, function (_b) {
|
|
@@ -22452,14 +23633,14 @@ var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22452
23633
|
recordPage = _a.sent();
|
|
22453
23634
|
recordSchema = recordPage ? recordPage.schema : {
|
|
22454
23635
|
"type": "wrapper",
|
|
22455
|
-
"className": "overflow-y-auto p-0 m-0 flex-1 h-full",
|
|
23636
|
+
"className": "steedos-record-content overflow-y-auto p-0 m-0 flex-1 h-full",
|
|
22456
23637
|
"name": "amis-".concat(appId, "-").concat(objectApiName, "-detail"),
|
|
22457
23638
|
"body": [
|
|
22458
23639
|
{
|
|
22459
23640
|
"type": "steedos-record-detail",
|
|
22460
23641
|
// "recordId": "${recordId}",
|
|
22461
23642
|
"objectApiName": "${objectName}",
|
|
22462
|
-
className: "sm:m-3",
|
|
23643
|
+
// className: "sm:m-3",
|
|
22463
23644
|
appId: appId,
|
|
22464
23645
|
}
|
|
22465
23646
|
],
|
|
@@ -22474,7 +23655,7 @@ var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22474
23655
|
"actions": [
|
|
22475
23656
|
{
|
|
22476
23657
|
"actionType": "custom",
|
|
22477
|
-
"script": "window.Steedos && window.Steedos.setDocumentTitle && Steedos.setDocumentTitle({pageName: event.data.record.name})"
|
|
23658
|
+
"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');"
|
|
22478
23659
|
}
|
|
22479
23660
|
]
|
|
22480
23661
|
}
|
|
@@ -22553,13 +23734,27 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
22553
23734
|
"visibleOn": "${pageType !== 'record' && pageType !== 'list'}"
|
|
22554
23735
|
}
|
|
22555
23736
|
]
|
|
22556
|
-
}
|
|
23737
|
+
},
|
|
23738
|
+
// onEvent: {
|
|
23739
|
+
// "recordLoaded": {
|
|
23740
|
+
// "actions": [
|
|
23741
|
+
// {
|
|
23742
|
+
// "actionType": "setValue",
|
|
23743
|
+
// "args": {
|
|
23744
|
+
// "value": {
|
|
23745
|
+
// "steedos_selected_recordId": "${event.data.record._id}"
|
|
23746
|
+
// }
|
|
23747
|
+
// }
|
|
23748
|
+
// }
|
|
23749
|
+
// ]
|
|
23750
|
+
// }
|
|
23751
|
+
// }
|
|
22557
23752
|
}];
|
|
22558
23753
|
}
|
|
22559
23754
|
});
|
|
22560
23755
|
}); };
|
|
22561
23756
|
|
|
22562
|
-
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]=useState(!0);var n=()=>{r(!1);};return has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React.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.createElement(newFunctionComponent(n),e);createRoot(t).render(e);},Modal=assign(newComponentRender("modal",Modal$1),{info:Modal$1.info,success:Modal$1.success,error:Modal$1.error,warning:Modal$1.warning,confirm:Modal$1.confirm}),Drawer=newComponentRender("drawer",Drawer$1),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),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):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 createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=createElement(e,__assign({},t));return ReactDOM.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 isNil(r)||(e=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})`)),isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),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||isString(r)?"number"===o&&isString(r)?r=Number(r):"boolean"===o&&isString(r)&&(r="true"===r.toLowerCase()||"1"===r):r=String(r));break;case"number":isString(r)&&(r=Number(r));break;case"boolean":isString(r)?r="true"===r.toLowerCase()||"1"===r: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:message,notification:notification,components:{Button:Button,Space: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=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);
|
|
23757
|
+
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]=useState(!0);var n=()=>{r(!1);};return has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React.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.createElement(newFunctionComponent(n),e);createRoot(t).render(e);},Modal=assign(newComponentRender("modal",Modal$1),{info:Modal$1.info,success:Modal$1.success,error:Modal$1.error,warning:Modal$1.warning,confirm:Modal$1.confirm}),Drawer=newComponentRender("drawer",Drawer$1),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),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):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 createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=createElement(e,__assign({},t));return ReactDOM.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 isNil(r)||(e=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})`)),isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),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||isString(r)?"number"===o&&isString(r)?r=Number(r):"boolean"===o&&isString(r)&&(r="true"===r.toLowerCase()||"1"===r):r=String(r));break;case"number":isString(r)&&(r=Number(r));break;case"boolean":isString(r)?r="true"===r.toLowerCase()||"1"===r: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:message,notification:notification,components:{Button:Button,Space: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=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);
|
|
22563
23758
|
|
|
22564
23759
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
22565
23760
|
__proto__: null,
|
|
@@ -22567,5 +23762,5 @@ var index_esm = /*#__PURE__*/Object.freeze({
|
|
|
22567
23762
|
SteedosUI: SteedosUI$1
|
|
22568
23763
|
});
|
|
22569
23764
|
|
|
22570
|
-
export { AmisAppLauncher, AmisAppMenu, AmisGlobalFooter, AmisGlobalHeader, AmisGlobalHeaderToolbar, AmisInputTable, AmisInstanceDetail, index_esm$1 as AmisLib, AmisLogo, AmisObjectButton, AmisObjectCalendar, AmisObjectFieldLookup, AmisObjectForm, AmisObjectListView, AmisObjectTable, AmisProvider, AmisRecordDetail, AmisRecordDetailHeader, AmisRecordDetailRelatedList, AmisRecordDetailRelatedLists, AmisRecordService, AmisSelectFlow, AmisSelectUser, AmisSteedosField, FromNow, PageListView, PageObject, PageRecordDetail, SteedosBadge, SteedosBadgeRibbon, SteedosDropdown, SteedosDropdownButton, SteedosIcon, index_esm as SteedosLib, SteedosLoading, SteedosSkeleton };
|
|
23765
|
+
export { AmisAppLauncher, AmisAppMenu, AmisGlobalFooter, AmisGlobalHeader, AmisGlobalHeaderToolbar, AmisInputTable, AmisInstanceDetail, index_esm$1 as AmisLib, AmisLogo, AmisObjectButton, AmisObjectCalendar, AmisObjectFieldLookup, AmisObjectForm, AmisObjectListView, AmisObjectTable, AmisProvider, AmisRecordDetail, AmisRecordDetailHeader, AmisRecordDetailMini, AmisRecordDetailRelatedList, AmisRecordDetailRelatedLists, AmisRecordService, AmisSelectFlow, AmisSelectUser, AmisSteedosField, FromNow, PageListView, PageObject, PageRecordDetail, SteedosBadge, SteedosBadgeRibbon, SteedosDropdown, SteedosDropdownButton, SteedosIcon, index_esm as SteedosLib, SteedosLoading, SteedosSkeleton };
|
|
22571
23766
|
//# sourceMappingURL=amis-object.esm.js.map
|