@steedos-widgets/amis-object 6.3.0-beta.8 → 6.3.0
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/AmisInputTable.d.ts +1 -0
- package/dist/amis/AmisRecordDetailHeader.d.ts +1 -0
- package/dist/amis-object.cjs.css +108 -13
- package/dist/amis-object.cjs.js +1811 -1077
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +108 -13
- package/dist/amis-object.esm.js +1811 -1077
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +108 -13
- package/dist/amis-object.umd.js +347 -288
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +21 -21
- package/dist/meta.js +31 -23
- package/package.json +3 -3
package/dist/amis-object.cjs.js
CHANGED
|
@@ -3736,9 +3736,9 @@ function getSelectMap(selectOptions){
|
|
|
3736
3736
|
}
|
|
3737
3737
|
|
|
3738
3738
|
function getNameTplUrl(field, ctx){
|
|
3739
|
-
if(ctx.objectName === 'cms_files'){
|
|
3740
|
-
|
|
3741
|
-
}
|
|
3739
|
+
// if(ctx.objectName === 'cms_files'){
|
|
3740
|
+
// return "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}"
|
|
3741
|
+
// }
|
|
3742
3742
|
const href = Router$1.getObjectDetailPath({
|
|
3743
3743
|
...ctx, formFactor: ctx.formFactor, appId: "${appId}", objectName: ctx.objectName || "${objectName}", recordId: `\${${ctx.idFieldName}}`
|
|
3744
3744
|
});
|
|
@@ -3753,7 +3753,7 @@ function getNameTpl(field, ctx){
|
|
|
3753
3753
|
}
|
|
3754
3754
|
let nameLabel = field.name;
|
|
3755
3755
|
//若字段类型是lookup,则按照相关表tpl的label规则显示;若是其它类型,则显示_display或字段本身的值
|
|
3756
|
-
if (field.type == "lookup") {
|
|
3756
|
+
if (field.type == "lookup" || field.type == "master_detail") {
|
|
3757
3757
|
if(!field.reference_to && (field.optionsFunction || field._optionsFunction || field.options)){
|
|
3758
3758
|
if(!field.isTableField){
|
|
3759
3759
|
nameLabel = `\${${field.name}__label}`;
|
|
@@ -3928,12 +3928,15 @@ async function getFieldTpl (field, options){
|
|
|
3928
3928
|
}
|
|
3929
3929
|
}
|
|
3930
3930
|
|
|
3931
|
-
async function getFieldsTemplate(fields, display){
|
|
3931
|
+
async function getFieldsTemplate(object, fields, display){
|
|
3932
3932
|
let expandFields = [];
|
|
3933
3933
|
if(display != false){
|
|
3934
3934
|
display = true;
|
|
3935
3935
|
}
|
|
3936
3936
|
let fieldsName = ['_id'];
|
|
3937
|
+
if(!object.datasource || object.datasource === 'default' || object.datasource === 'meteor'){
|
|
3938
|
+
fieldsName.push('space');
|
|
3939
|
+
}
|
|
3937
3940
|
let displayFields = [];
|
|
3938
3941
|
let fieldsArr = [];
|
|
3939
3942
|
if(_$1__namespace.isArray(fields)){
|
|
@@ -4029,7 +4032,7 @@ async function getFindOneQuery$1(object, recordId, fields, options){
|
|
|
4029
4032
|
}
|
|
4030
4033
|
}
|
|
4031
4034
|
return {
|
|
4032
|
-
query: `{${alias}:${object.name}${queryOptions}{${await getFieldsTemplate(fields)}, ${getRecordPermissionsTemplate()}}}`
|
|
4035
|
+
query: `{${alias}:${object.name}${queryOptions}{${await getFieldsTemplate(object, fields)}, ${getRecordPermissionsTemplate()}}}`
|
|
4033
4036
|
}
|
|
4034
4037
|
}
|
|
4035
4038
|
|
|
@@ -4218,7 +4221,7 @@ async function getFindQuery(object, recordId, fields, options){
|
|
|
4218
4221
|
// return item.replace(/^{/,"").replace(/}$/,"");
|
|
4219
4222
|
// }).join(",")) : "";
|
|
4220
4223
|
|
|
4221
|
-
const fieldsTemplate = `${await getFieldsTemplate(fields, options.expand)}${treeFields}${cfsFields}`;
|
|
4224
|
+
const fieldsTemplate = `${await getFieldsTemplate(object, fields, options.expand)}${treeFields}${cfsFields}`;
|
|
4222
4225
|
|
|
4223
4226
|
return {
|
|
4224
4227
|
orderBy: "${orderBy}",
|
|
@@ -4266,7 +4269,7 @@ function getRecordPermissionsQuery(object, recordId, options){
|
|
|
4266
4269
|
function getApi$2 (isMobile){
|
|
4267
4270
|
if(isMobile);else {
|
|
4268
4271
|
// return __meteor_runtime_config__.ROOT_URL_PATH_PREFIX + "/graphql"
|
|
4269
|
-
return `\${context.rootUrl}/graphql?reload=\${additionalFilters}`
|
|
4272
|
+
return `\${context.rootUrl}/graphql?reload=\${additionalFilters|join}`
|
|
4270
4273
|
}
|
|
4271
4274
|
}
|
|
4272
4275
|
|
|
@@ -4334,6 +4337,29 @@ function getAmisStaticFieldType$1(type, readonly, options){
|
|
|
4334
4337
|
}
|
|
4335
4338
|
}
|
|
4336
4339
|
|
|
4340
|
+
/*
|
|
4341
|
+
* @Author: baozhoutao@steedos.com
|
|
4342
|
+
* @Date: 2022-07-13 15:18:03
|
|
4343
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
4344
|
+
* @LastEditTime: 2023-04-11 10:34:26
|
|
4345
|
+
* @Description:
|
|
4346
|
+
*/
|
|
4347
|
+
|
|
4348
|
+
async function getPage({type, pageId = '', appId, objectName = '', recordId = '', formFactor = 'LARGE'}){
|
|
4349
|
+
const api = `/api/pageSchema/${type}?app=${appId}&objectApiName=${objectName}&recordId=${recordId}&pageId=${pageId}&formFactor=${formFactor}`;
|
|
4350
|
+
const page = await fetchAPI(api);
|
|
4351
|
+
if (page && page.schema) {
|
|
4352
|
+
page.schema = JSON.parse(page.schema);
|
|
4353
|
+
if(page.schema.data){
|
|
4354
|
+
delete page.schema.data.recordId;
|
|
4355
|
+
delete page.schema.data.objectName;
|
|
4356
|
+
delete page.schema.data.context;
|
|
4357
|
+
delete page.schema.data.global;
|
|
4358
|
+
}
|
|
4359
|
+
return page;
|
|
4360
|
+
}
|
|
4361
|
+
}
|
|
4362
|
+
|
|
4337
4363
|
/*
|
|
4338
4364
|
* @Author: baozhoutao@steedos.com
|
|
4339
4365
|
* @Date: 2022-10-28 14:15:09
|
|
@@ -4357,9 +4383,74 @@ const getAmisFieldType$1 = (steedosField, readonly)=>{
|
|
|
4357
4383
|
return getAmisStaticFieldType$1(steedosField.type === 'avatar' ? 'image' : steedosField.type, readonly, {multiple: steedosField.multiple});
|
|
4358
4384
|
};
|
|
4359
4385
|
|
|
4360
|
-
|
|
4386
|
+
async function getLookupLinkOnClick$1(field, options) {
|
|
4387
|
+
const recordPage = await getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor });
|
|
4388
|
+
|
|
4389
|
+
const drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
|
|
4390
|
+
"recordId": "${value}",
|
|
4391
|
+
"data": {
|
|
4392
|
+
...recordPage.schema.data,
|
|
4393
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
4394
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
4395
|
+
"objectName": options.objectName,
|
|
4396
|
+
}
|
|
4397
|
+
}) : {
|
|
4398
|
+
"type": "steedos-record-detail",
|
|
4399
|
+
"objectApiName": options.objectName,
|
|
4400
|
+
"recordId": "${value}",
|
|
4401
|
+
"showBackButton": false,
|
|
4402
|
+
"showButtons": true,
|
|
4403
|
+
"data": {
|
|
4404
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
4405
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
4406
|
+
}
|
|
4407
|
+
};
|
|
4408
|
+
return {
|
|
4409
|
+
"click": {
|
|
4410
|
+
"actions": [
|
|
4411
|
+
// {
|
|
4412
|
+
// "type": "custom",
|
|
4413
|
+
// "script": `
|
|
4414
|
+
// let fileRecordId = url.match(${regFileRecordId})[2];
|
|
4415
|
+
// console.log('fileRecordId:',fileRecordId);
|
|
4416
|
+
// event.data.recordId = fileRecordId;
|
|
4417
|
+
// `,
|
|
4418
|
+
// },
|
|
4419
|
+
{
|
|
4420
|
+
"actionType": "drawer",
|
|
4421
|
+
"drawer": {
|
|
4422
|
+
"type": "drawer",
|
|
4423
|
+
"title": " ",
|
|
4424
|
+
"headerClassName": "hidden",
|
|
4425
|
+
"size": "lg",
|
|
4426
|
+
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
4427
|
+
"closeOnEsc": true,
|
|
4428
|
+
"closeOnOutside": true,
|
|
4429
|
+
"resizable": true,
|
|
4430
|
+
"actions": [],
|
|
4431
|
+
"body": [
|
|
4432
|
+
drawerRecordDetailSchema
|
|
4433
|
+
],
|
|
4434
|
+
"className": "steedos-record-detail-drawer app-popover"
|
|
4435
|
+
},
|
|
4436
|
+
"preventDefault": true
|
|
4437
|
+
}
|
|
4438
|
+
]
|
|
4439
|
+
}
|
|
4440
|
+
}
|
|
4441
|
+
}
|
|
4442
|
+
|
|
4443
|
+
const getAmisFileReadonlySchema = async (steedosField,ctx = {})=>{
|
|
4361
4444
|
const type = steedosField.type;
|
|
4445
|
+
const { appId, formFactor } = ctx.amisData || {};
|
|
4362
4446
|
const amisFieldType = getAmisFieldType$1(steedosField, true);
|
|
4447
|
+
|
|
4448
|
+
let lookupATagClick = 'onclick="return false;"';
|
|
4449
|
+
|
|
4450
|
+
if(window.innerWidth < 768){
|
|
4451
|
+
lookupATagClick = "";
|
|
4452
|
+
}
|
|
4453
|
+
|
|
4363
4454
|
if(_.includes(['avatar','image'], type)){
|
|
4364
4455
|
return {
|
|
4365
4456
|
type: amisFieldType,
|
|
@@ -4394,13 +4485,34 @@ const getAmisFileReadonlySchema = (steedosField)=>{
|
|
|
4394
4485
|
}
|
|
4395
4486
|
}
|
|
4396
4487
|
} : {
|
|
4397
|
-
type: amisFieldType,
|
|
4398
|
-
tpl: `
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4488
|
+
// type: amisFieldType,
|
|
4489
|
+
// tpl: `
|
|
4490
|
+
// <% let fileData = data._display.${steedosField.name}; if (fileData) { %>
|
|
4491
|
+
// <% if(!Array.isArray(fileData)){ fileData = [fileData]} %>
|
|
4492
|
+
// <% fileData.forEach(function(item) { %>
|
|
4493
|
+
// <a href='<%= item.url %>' target='_self' class='block'><%= item.name %></a>
|
|
4494
|
+
// <% });} %>`
|
|
4495
|
+
"type": "control",
|
|
4496
|
+
"body": {
|
|
4497
|
+
type: 'each',
|
|
4498
|
+
placeholder: "",
|
|
4499
|
+
// className: `steedos-field-lookup-each flex flex-wrap gap-2`,
|
|
4500
|
+
source: `\${_display.${steedosField.name}|asArray}`,
|
|
4501
|
+
items: {
|
|
4502
|
+
type: 'static',
|
|
4503
|
+
labelClassName: "hidden",
|
|
4504
|
+
label: false,
|
|
4505
|
+
className: 'm-0',
|
|
4506
|
+
tpl: `<a href="/app/-/cfs_files_filerecord/view/\${value}" ${lookupATagClick}>\${name}</a>`,
|
|
4507
|
+
// tpl: "<%= item.name >",
|
|
4508
|
+
// onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
|
|
4509
|
+
onEvent: window.innerWidth < 768 ? null : await getLookupLinkOnClick$1(steedosField, {
|
|
4510
|
+
appId,
|
|
4511
|
+
objectName: "cfs_files_filerecord",
|
|
4512
|
+
formFactor
|
|
4513
|
+
})
|
|
4514
|
+
}
|
|
4515
|
+
}
|
|
4404
4516
|
}
|
|
4405
4517
|
}
|
|
4406
4518
|
};
|
|
@@ -4462,8 +4574,8 @@ const getAmisFileEditSchema = (steedosField)=>{
|
|
|
4462
4574
|
return convertData;
|
|
4463
4575
|
};
|
|
4464
4576
|
|
|
4465
|
-
const getAmisFileSchema = (steedosField, readonly)=>{
|
|
4466
|
-
return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
|
|
4577
|
+
const getAmisFileSchema = async (steedosField, readonly, ctx)=>{
|
|
4578
|
+
return readonly ? await getAmisFileReadonlySchema(steedosField,ctx) : getAmisFileEditSchema(steedosField);
|
|
4467
4579
|
};
|
|
4468
4580
|
|
|
4469
4581
|
var frontend_field_group_generalization$1 = "General";
|
|
@@ -4480,6 +4592,7 @@ var frontend_form_confirm$1 = "Confirm";
|
|
|
4480
4592
|
var frontend_form_delete$1 = "Delete";
|
|
4481
4593
|
var frontend_form_view$1 = "view";
|
|
4482
4594
|
var frontend_form_details$1 = "details";
|
|
4595
|
+
var frontend_form_validation_failed_url$1 = "The URL format is incorrect";
|
|
4483
4596
|
var frontend_delete_confirm_text$1 = "Are you sure you want to delete this item?";
|
|
4484
4597
|
var frontend_delete_many_selected_required$1 = "Please select the item to be deleted";
|
|
4485
4598
|
var frontend_delete_many_confirm_text$1 = "Are you sure you want to delete?";
|
|
@@ -4536,6 +4649,7 @@ var frontend_setup$1 = "Setup";
|
|
|
4536
4649
|
var frontend_notifications$1 = "Notifications";
|
|
4537
4650
|
var frontend_notifications_allread$1 = "Mark all as read";
|
|
4538
4651
|
var frontend_notifications_allread_message$1 = "All marked as read";
|
|
4652
|
+
var frontend_notifications_close_dialog$1 = "Close";
|
|
4539
4653
|
var frontend_profile$1 = "Profile";
|
|
4540
4654
|
var switch_space$1 = "Switch Space";
|
|
4541
4655
|
var frontend_about$1 = "About";
|
|
@@ -4568,6 +4682,7 @@ var en_us = {
|
|
|
4568
4682
|
frontend_form_delete: frontend_form_delete$1,
|
|
4569
4683
|
frontend_form_view: frontend_form_view$1,
|
|
4570
4684
|
frontend_form_details: frontend_form_details$1,
|
|
4685
|
+
frontend_form_validation_failed_url: frontend_form_validation_failed_url$1,
|
|
4571
4686
|
frontend_delete_confirm_text: frontend_delete_confirm_text$1,
|
|
4572
4687
|
frontend_delete_many_selected_required: frontend_delete_many_selected_required$1,
|
|
4573
4688
|
frontend_delete_many_confirm_text: frontend_delete_many_confirm_text$1,
|
|
@@ -4624,6 +4739,7 @@ var en_us = {
|
|
|
4624
4739
|
frontend_notifications: frontend_notifications$1,
|
|
4625
4740
|
frontend_notifications_allread: frontend_notifications_allread$1,
|
|
4626
4741
|
frontend_notifications_allread_message: frontend_notifications_allread_message$1,
|
|
4742
|
+
frontend_notifications_close_dialog: frontend_notifications_close_dialog$1,
|
|
4627
4743
|
frontend_profile: frontend_profile$1,
|
|
4628
4744
|
switch_space: switch_space$1,
|
|
4629
4745
|
frontend_about: frontend_about$1,
|
|
@@ -4657,6 +4773,7 @@ var frontend_form_confirm = "确认";
|
|
|
4657
4773
|
var frontend_form_delete = "删除";
|
|
4658
4774
|
var frontend_form_view = "查看";
|
|
4659
4775
|
var frontend_form_details = "详情";
|
|
4776
|
+
var frontend_form_validation_failed_url = "URL 格式不正确";
|
|
4660
4777
|
var frontend_delete_confirm_text = "确定要删除此项目?";
|
|
4661
4778
|
var frontend_delete_many_selected_required = "请选择要删除的项";
|
|
4662
4779
|
var frontend_delete_many_confirm_text = "确定要删除吗?";
|
|
@@ -4714,6 +4831,7 @@ var frontend_setup = "设置";
|
|
|
4714
4831
|
var frontend_notifications = "通知";
|
|
4715
4832
|
var frontend_notifications_allread = "全部标记为已读";
|
|
4716
4833
|
var frontend_notifications_allread_message = "已全部标记为已读";
|
|
4834
|
+
var frontend_notifications_close_dialog = "关闭";
|
|
4717
4835
|
var frontend_profile = "个人资料";
|
|
4718
4836
|
var switch_space = "切换工作区";
|
|
4719
4837
|
var frontend_about = "关于";
|
|
@@ -4746,6 +4864,7 @@ var zh_cn = {
|
|
|
4746
4864
|
frontend_form_delete: frontend_form_delete,
|
|
4747
4865
|
frontend_form_view: frontend_form_view,
|
|
4748
4866
|
frontend_form_details: frontend_form_details,
|
|
4867
|
+
frontend_form_validation_failed_url: frontend_form_validation_failed_url,
|
|
4749
4868
|
frontend_delete_confirm_text: frontend_delete_confirm_text,
|
|
4750
4869
|
frontend_delete_many_selected_required: frontend_delete_many_selected_required,
|
|
4751
4870
|
frontend_delete_many_confirm_text: frontend_delete_many_confirm_text,
|
|
@@ -4803,6 +4922,7 @@ var zh_cn = {
|
|
|
4803
4922
|
frontend_notifications: frontend_notifications,
|
|
4804
4923
|
frontend_notifications_allread: frontend_notifications_allread,
|
|
4805
4924
|
frontend_notifications_allread_message: frontend_notifications_allread_message,
|
|
4925
|
+
frontend_notifications_close_dialog: frontend_notifications_close_dialog,
|
|
4806
4926
|
frontend_profile: frontend_profile,
|
|
4807
4927
|
switch_space: switch_space,
|
|
4808
4928
|
frontend_about: frontend_about,
|
|
@@ -4975,7 +5095,12 @@ async function getQuickEditSchema(object, columnField, options){
|
|
|
4975
5095
|
break;
|
|
4976
5096
|
case "percent":
|
|
4977
5097
|
TempDisplayField = `
|
|
4978
|
-
|
|
5098
|
+
if(event.data.value){
|
|
5099
|
+
_display["${field.name}"] = event.data.value.toFixed(${field.scale}) + '%';
|
|
5100
|
+
} else {
|
|
5101
|
+
_display["${field.name}"] = event.data.value;
|
|
5102
|
+
}
|
|
5103
|
+
|
|
4979
5104
|
`;
|
|
4980
5105
|
quickEditSchema.body[0].onEvent["change"] = quickEditOnEvent(TempDisplayField);
|
|
4981
5106
|
break;
|
|
@@ -5319,6 +5444,60 @@ function getFieldWidth(width){
|
|
|
5319
5444
|
}
|
|
5320
5445
|
}
|
|
5321
5446
|
|
|
5447
|
+
async function getColumnItemOnClick(field, options){
|
|
5448
|
+
const recordPage = await getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor });
|
|
5449
|
+
const drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
|
|
5450
|
+
"recordId": `\${${options.idFieldName}}`,
|
|
5451
|
+
"data": {
|
|
5452
|
+
...recordPage.schema.data,
|
|
5453
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
5454
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
5455
|
+
"recordId": `\${${options.idFieldName}}`//审批微页面依赖了作用域中的recordId
|
|
5456
|
+
}
|
|
5457
|
+
}) : {
|
|
5458
|
+
"type": "steedos-record-detail",
|
|
5459
|
+
"objectApiName": "${objectName}",
|
|
5460
|
+
"recordId": `\${${options.idFieldName}}`,
|
|
5461
|
+
"showBackButton": false,
|
|
5462
|
+
"showButtons": true,
|
|
5463
|
+
"data": {
|
|
5464
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
5465
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
5466
|
+
}
|
|
5467
|
+
};
|
|
5468
|
+
|
|
5469
|
+
if(!(field.is_name || field.name === options.labelFieldName)){
|
|
5470
|
+
drawerRecordDetailSchema.objectApiName = field.reference_to;
|
|
5471
|
+
drawerRecordDetailSchema.recordId = `\${_display.${field.name}.value}`;
|
|
5472
|
+
}
|
|
5473
|
+
return {
|
|
5474
|
+
"click": {
|
|
5475
|
+
"actions": [
|
|
5476
|
+
{
|
|
5477
|
+
"actionType": "drawer",
|
|
5478
|
+
"drawer": {
|
|
5479
|
+
"type": "drawer",
|
|
5480
|
+
"title": " ",
|
|
5481
|
+
"headerClassName": "hidden",
|
|
5482
|
+
"size": "lg",
|
|
5483
|
+
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
5484
|
+
"closeOnEsc": true,
|
|
5485
|
+
"closeOnOutside": true,
|
|
5486
|
+
"resizable": true,
|
|
5487
|
+
"actions": [],
|
|
5488
|
+
"body": [
|
|
5489
|
+
drawerRecordDetailSchema
|
|
5490
|
+
],
|
|
5491
|
+
"className": "steedos-record-detail-drawer app-popover",
|
|
5492
|
+
"id": "u:fc5f055afa8c"
|
|
5493
|
+
},
|
|
5494
|
+
"preventDefault": true
|
|
5495
|
+
}
|
|
5496
|
+
]
|
|
5497
|
+
}
|
|
5498
|
+
};
|
|
5499
|
+
}
|
|
5500
|
+
|
|
5322
5501
|
async function getTableColumns$1(object, fields, options){
|
|
5323
5502
|
const columns = [];
|
|
5324
5503
|
if(!options.isLookup && !options.isInputTable){
|
|
@@ -5358,7 +5537,10 @@ async function getTableColumns$1(object, fields, options){
|
|
|
5358
5537
|
delete fieldAmis?.className;
|
|
5359
5538
|
|
|
5360
5539
|
let columnItem;
|
|
5361
|
-
|
|
5540
|
+
|
|
5541
|
+
// PC客户端点击名称字段直接预览
|
|
5542
|
+
let isNode = !!(window && window.nw && window.nw.require);
|
|
5543
|
+
if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files' && isNode){
|
|
5362
5544
|
const previewFileScript = `
|
|
5363
5545
|
var data = event.data;
|
|
5364
5546
|
var file_name = data.versions ? data.name : "${field.label}";
|
|
@@ -5373,20 +5555,20 @@ async function getTableColumns$1(object, fields, options){
|
|
|
5373
5555
|
"onEvent": {
|
|
5374
5556
|
"click": {
|
|
5375
5557
|
"actions": [
|
|
5376
|
-
{
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
},
|
|
5558
|
+
// {
|
|
5559
|
+
// "args": {
|
|
5560
|
+
// "api": {
|
|
5561
|
+
// "url": "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}",
|
|
5562
|
+
// "method": "get",
|
|
5563
|
+
// "headers": {
|
|
5564
|
+
// "Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
5565
|
+
// }
|
|
5566
|
+
// }
|
|
5567
|
+
// },
|
|
5568
|
+
// "actionType": "download",
|
|
5569
|
+
// // "expression": "!!!window?.nw?.require"//浏览器上直接下载
|
|
5570
|
+
// "expression": "!!!(window && window.nw && window.nw.require)"//浏览器上直接下载
|
|
5571
|
+
// },
|
|
5390
5572
|
{
|
|
5391
5573
|
"args": {},
|
|
5392
5574
|
"actionType": "custom",
|
|
@@ -5417,7 +5599,7 @@ async function getTableColumns$1(object, fields, options){
|
|
|
5417
5599
|
toggled: field.toggled,
|
|
5418
5600
|
static: true,
|
|
5419
5601
|
className,
|
|
5420
|
-
...getAmisFileReadonlySchema(field)
|
|
5602
|
+
...await getAmisFileReadonlySchema(field)
|
|
5421
5603
|
}, fieldAmis, {name: field.name});
|
|
5422
5604
|
}
|
|
5423
5605
|
else if(field.type === 'select'){
|
|
@@ -5484,51 +5666,7 @@ async function getTableColumns$1(object, fields, options){
|
|
|
5484
5666
|
}
|
|
5485
5667
|
|
|
5486
5668
|
if(window.innerWidth >= 768 && ((field.is_name || field.name === options.labelFieldName) || ((field.type == 'lookup' || field.type == 'master_detail') && _$1__namespace.isString(field.reference_to) && field.multiple != true)) && options.isRelated){
|
|
5487
|
-
|
|
5488
|
-
const drawerRecordDetailSchema = {
|
|
5489
|
-
"type": "steedos-record-detail",
|
|
5490
|
-
"objectApiName": "${objectName}",
|
|
5491
|
-
"recordId": `\${${options.idFieldName}}`,
|
|
5492
|
-
"showBackButton": false,
|
|
5493
|
-
"showButtons": true,
|
|
5494
|
-
"data": {
|
|
5495
|
-
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
5496
|
-
"recordLoaded": false, // 重置数据加载状态
|
|
5497
|
-
}
|
|
5498
|
-
};
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
if(!(field.is_name || field.name === options.labelFieldName)){
|
|
5502
|
-
drawerRecordDetailSchema.objectApiName = field.reference_to;
|
|
5503
|
-
drawerRecordDetailSchema.recordId = `\${_display.${field.name}.value}`;
|
|
5504
|
-
}
|
|
5505
|
-
|
|
5506
|
-
columnItem.onEvent = {
|
|
5507
|
-
"click": {
|
|
5508
|
-
"actions": [
|
|
5509
|
-
{
|
|
5510
|
-
"actionType": "drawer",
|
|
5511
|
-
"drawer": {
|
|
5512
|
-
"type": "drawer",
|
|
5513
|
-
"title": " ",
|
|
5514
|
-
"headerClassName": "hidden",
|
|
5515
|
-
"size": "lg",
|
|
5516
|
-
"bodyClassName": "p-0 m-0",
|
|
5517
|
-
"closeOnEsc": true,
|
|
5518
|
-
"closeOnOutside": true,
|
|
5519
|
-
"resizable": true,
|
|
5520
|
-
"actions": [],
|
|
5521
|
-
"body": [
|
|
5522
|
-
drawerRecordDetailSchema
|
|
5523
|
-
],
|
|
5524
|
-
"className": "steedos-record-detail-drawer app-popover",
|
|
5525
|
-
"id": "u:fc5f055afa8c"
|
|
5526
|
-
},
|
|
5527
|
-
"preventDefault": true
|
|
5528
|
-
}
|
|
5529
|
-
]
|
|
5530
|
-
}
|
|
5531
|
-
};
|
|
5669
|
+
columnItem.onEvent = await getColumnItemOnClick(field, options);
|
|
5532
5670
|
}
|
|
5533
5671
|
|
|
5534
5672
|
}
|
|
@@ -5741,17 +5879,23 @@ async function getMobileTableColumns(fields, options){
|
|
|
5741
5879
|
onEvent: {
|
|
5742
5880
|
"click": {
|
|
5743
5881
|
"actions": [
|
|
5882
|
+
// {
|
|
5883
|
+
// "args": {
|
|
5884
|
+
// "api": {
|
|
5885
|
+
// "url": url,
|
|
5886
|
+
// "method": "get",
|
|
5887
|
+
// "headers": {
|
|
5888
|
+
// "Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
5889
|
+
// }
|
|
5890
|
+
// }
|
|
5891
|
+
// },
|
|
5892
|
+
// "actionType": "download"
|
|
5893
|
+
// }
|
|
5744
5894
|
{
|
|
5895
|
+
"actionType": "link",
|
|
5745
5896
|
"args": {
|
|
5746
|
-
"
|
|
5747
|
-
|
|
5748
|
-
"method": "get",
|
|
5749
|
-
"headers": {
|
|
5750
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
5751
|
-
}
|
|
5752
|
-
}
|
|
5753
|
-
},
|
|
5754
|
-
"actionType": "download"
|
|
5897
|
+
"link": url
|
|
5898
|
+
}
|
|
5755
5899
|
}
|
|
5756
5900
|
],
|
|
5757
5901
|
"weight": 0
|
|
@@ -6450,8 +6594,8 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
6450
6594
|
|
|
6451
6595
|
var fieldNames = _$1__namespace.map(fields, function(n){return n.name});
|
|
6452
6596
|
var nameField = object.fields[object.NAME_FIELD_KEY];
|
|
6453
|
-
let nameLabel = nameField.name;
|
|
6454
|
-
if (nameField.type == "lookup") {
|
|
6597
|
+
let nameLabel = nameField && nameField.name;
|
|
6598
|
+
if (nameField && (nameField.type == "lookup" || nameField.type == "master_detail")) {
|
|
6455
6599
|
if(!nameField.reference_to && (nameField.optionsFunction || nameField._optionsFunction || nameField.options)){
|
|
6456
6600
|
if(!nameField.isTableField){
|
|
6457
6601
|
nameLabel = `record.${nameField.name}__label`;
|
|
@@ -6459,8 +6603,8 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
6459
6603
|
} else {
|
|
6460
6604
|
nameLabel = `record._display.${nameField.name}.label`;
|
|
6461
6605
|
}
|
|
6462
|
-
} else {
|
|
6463
|
-
nameLabel = `record._display.${nameField.name}
|
|
6606
|
+
} else if (nameField){
|
|
6607
|
+
nameLabel = `(record._display ? record._display.${nameField.name} : record.${nameField.name})`;
|
|
6464
6608
|
}
|
|
6465
6609
|
return `
|
|
6466
6610
|
if(payload.data.data.length === 0){
|
|
@@ -7843,16 +7987,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
7843
7987
|
data: formSchema
|
|
7844
7988
|
};
|
|
7845
7989
|
`;
|
|
7846
|
-
const onDialogCancelScript = `
|
|
7847
|
-
// 这里加setTimeout是因为amis的Bug,它会先触发cancel事件执行此脚本关闭父窗口然后再关闭子窗口
|
|
7848
|
-
// 正确的顺序应该是先关闭子窗口再关闭父窗口,顺序错了会造成第二次点击新建按钮的时候异常
|
|
7849
|
-
setTimeout(function(){
|
|
7850
|
-
doAction({
|
|
7851
|
-
"actionType": "cancel",
|
|
7852
|
-
"componentId": "object_actions_drawer_${uiSchema.name}"
|
|
7853
|
-
});
|
|
7854
|
-
}, 200);
|
|
7855
|
-
`;
|
|
7856
7990
|
const getSelectedRowsScript = `
|
|
7857
7991
|
const isLookup = event.data.isLookup;
|
|
7858
7992
|
if(isLookup){
|
|
@@ -7942,17 +8076,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
7942
8076
|
"closeOnEsc": false,
|
|
7943
8077
|
"closeOnOutside": false,
|
|
7944
8078
|
"size": "lg",
|
|
7945
|
-
"onEvent": {
|
|
7946
|
-
"cancel": {
|
|
7947
|
-
"actions": [
|
|
7948
|
-
{
|
|
7949
|
-
"actionType": "custom",
|
|
7950
|
-
"script": onDialogCancelScript,
|
|
7951
|
-
"expression": "${window:innerWidth < 768}",
|
|
7952
|
-
}
|
|
7953
|
-
]
|
|
7954
|
-
}
|
|
7955
|
-
},
|
|
7956
8079
|
"actions": [
|
|
7957
8080
|
{
|
|
7958
8081
|
type: 'button',
|
|
@@ -7988,34 +8111,11 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
7988
8111
|
}
|
|
7989
8112
|
};
|
|
7990
8113
|
|
|
7991
|
-
/*
|
|
7992
|
-
* @Author: baozhoutao@steedos.com
|
|
7993
|
-
* @Date: 2022-07-13 15:18:03
|
|
7994
|
-
* @LastEditors: baozhoutao@steedos.com
|
|
7995
|
-
* @LastEditTime: 2023-04-11 10:34:26
|
|
7996
|
-
* @Description:
|
|
7997
|
-
*/
|
|
7998
|
-
|
|
7999
|
-
async function getPage({type, pageId = '', appId, objectName = '', recordId = '', formFactor = 'LARGE'}){
|
|
8000
|
-
const api = `/api/pageSchema/${type}?app=${appId}&objectApiName=${objectName}&recordId=${recordId}&pageId=${pageId}&formFactor=${formFactor}`;
|
|
8001
|
-
const page = await fetchAPI(api);
|
|
8002
|
-
if (page && page.schema) {
|
|
8003
|
-
page.schema = JSON.parse(page.schema);
|
|
8004
|
-
if(page.schema.data){
|
|
8005
|
-
delete page.schema.data.recordId;
|
|
8006
|
-
delete page.schema.data.objectName;
|
|
8007
|
-
delete page.schema.data.context;
|
|
8008
|
-
delete page.schema.data.global;
|
|
8009
|
-
}
|
|
8010
|
-
return page;
|
|
8011
|
-
}
|
|
8012
|
-
}
|
|
8013
|
-
|
|
8014
8114
|
/*
|
|
8015
8115
|
* @Author: baozhoutao@steedos.com
|
|
8016
8116
|
* @Date: 2022-11-01 15:49:58
|
|
8017
|
-
* @LastEditors:
|
|
8018
|
-
* @LastEditTime:
|
|
8117
|
+
* @LastEditors: yinlianghui@hotoa.com yinlianghui@hotoa.com
|
|
8118
|
+
* @LastEditTime: 2024-05-19 10:01:07
|
|
8019
8119
|
* @Description:
|
|
8020
8120
|
*/
|
|
8021
8121
|
|
|
@@ -8045,16 +8145,6 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
8045
8145
|
: page.schema;
|
|
8046
8146
|
}
|
|
8047
8147
|
|
|
8048
|
-
const onDialogCancelScript = `
|
|
8049
|
-
// 这里加setTimeout是因为amis的Bug,它会先触发cancel事件执行此脚本关闭父窗口然后再关闭子窗口
|
|
8050
|
-
// 正确的顺序应该是先关闭子窗口再关闭父窗口,顺序错了会造成第二次点击编辑按钮的时候异常
|
|
8051
|
-
setTimeout(function(){
|
|
8052
|
-
doAction({
|
|
8053
|
-
"actionType": "cancel",
|
|
8054
|
-
"componentId": "object_actions_drawer_${uiSchema.name}"
|
|
8055
|
-
});
|
|
8056
|
-
}, 200);
|
|
8057
|
-
`;
|
|
8058
8148
|
|
|
8059
8149
|
return {
|
|
8060
8150
|
type: "service",
|
|
@@ -8077,18 +8167,26 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
8077
8167
|
closeOnEsc: false,
|
|
8078
8168
|
closeOnOutside: false,
|
|
8079
8169
|
showCloseButton: true,
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
"
|
|
8083
|
-
|
|
8084
|
-
|
|
8085
|
-
"actionType": "custom",
|
|
8086
|
-
"script": onDialogCancelScript,
|
|
8087
|
-
"expression": "${window:innerWidth < 768}",
|
|
8088
|
-
}
|
|
8089
|
-
]
|
|
8090
|
-
}
|
|
8170
|
+
"data": {
|
|
8171
|
+
"&": "$$",
|
|
8172
|
+
"_master": "${_master}",
|
|
8173
|
+
"_master._isRelated": "${_isRelated}",
|
|
8174
|
+
"_master.relatedKey": "${relatedKey}"
|
|
8091
8175
|
},
|
|
8176
|
+
size: "lg",
|
|
8177
|
+
"actions": [
|
|
8178
|
+
{
|
|
8179
|
+
type: 'button',
|
|
8180
|
+
actionType: 'cancel',
|
|
8181
|
+
label: instance.t('frontend_form_cancel')
|
|
8182
|
+
},
|
|
8183
|
+
{
|
|
8184
|
+
type: 'button',
|
|
8185
|
+
actionType: 'confirm',
|
|
8186
|
+
label: instance.t('frontend_form_save'),
|
|
8187
|
+
primary: true
|
|
8188
|
+
},
|
|
8189
|
+
]
|
|
8092
8190
|
},
|
|
8093
8191
|
},
|
|
8094
8192
|
],
|
|
@@ -8868,6 +8966,100 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
|
|
|
8868
8966
|
};
|
|
8869
8967
|
};
|
|
8870
8968
|
|
|
8969
|
+
const getDropdown = (dropdownButtons)=>{
|
|
8970
|
+
const dropdown = {
|
|
8971
|
+
"type": "dropdown-button",
|
|
8972
|
+
"icon": "fa fa-angle-down",
|
|
8973
|
+
"size": "sm",
|
|
8974
|
+
"hideCaret": true,
|
|
8975
|
+
"className": "mr-0 steedos-mobile-header-drop-down",
|
|
8976
|
+
"closeOnClick": true,
|
|
8977
|
+
"menuClassName": "buttons-drawer fixed bg-none border-0 shadow-none",
|
|
8978
|
+
"align": "right",
|
|
8979
|
+
"body": [
|
|
8980
|
+
{
|
|
8981
|
+
"type": "action",
|
|
8982
|
+
"style": {
|
|
8983
|
+
"z-index": 1,
|
|
8984
|
+
"background": "var(--Drawer-overlay-bg)",
|
|
8985
|
+
"height": "100%",
|
|
8986
|
+
"width": "100%",
|
|
8987
|
+
"padding": "0",
|
|
8988
|
+
"margin": "0",
|
|
8989
|
+
"border-radius": "0"
|
|
8990
|
+
}
|
|
8991
|
+
},
|
|
8992
|
+
{
|
|
8993
|
+
"type": "wrapper",
|
|
8994
|
+
"style": {
|
|
8995
|
+
"position": "fixed",
|
|
8996
|
+
"bottom": 0,
|
|
8997
|
+
"z-index": 2,
|
|
8998
|
+
"width": "100vw",
|
|
8999
|
+
"left": "0",
|
|
9000
|
+
"padding": "0",
|
|
9001
|
+
"background": "white",
|
|
9002
|
+
"box-shadow": "0 -10px 10px -10px rgba(0, 0, 0, 0.2)"
|
|
9003
|
+
},
|
|
9004
|
+
"body": [
|
|
9005
|
+
{
|
|
9006
|
+
"type": "flex",
|
|
9007
|
+
"justify": "space-between",
|
|
9008
|
+
"items": [
|
|
9009
|
+
{
|
|
9010
|
+
"type": "tpl",
|
|
9011
|
+
"tpl": "操作",
|
|
9012
|
+
"style": {
|
|
9013
|
+
"padding": "4px 12px",
|
|
9014
|
+
"align-items": "center",
|
|
9015
|
+
"display": "flex"
|
|
9016
|
+
}
|
|
9017
|
+
},
|
|
9018
|
+
{
|
|
9019
|
+
"type": "action",
|
|
9020
|
+
"label": "",
|
|
9021
|
+
"icon": "fa fa-times",
|
|
9022
|
+
"level": "link",
|
|
9023
|
+
"style": {
|
|
9024
|
+
"color": "black"
|
|
9025
|
+
},
|
|
9026
|
+
}
|
|
9027
|
+
],
|
|
9028
|
+
"style": {
|
|
9029
|
+
"padding-top": "0.5rem",
|
|
9030
|
+
"padding-bottom": "0.5rem",
|
|
9031
|
+
"border-bottom": "var(--Drawer-content-borderWidth) solid var(--Drawer-header-borderColor)"
|
|
9032
|
+
}
|
|
9033
|
+
},
|
|
9034
|
+
{
|
|
9035
|
+
"type": "wrapper",
|
|
9036
|
+
"body": [
|
|
9037
|
+
{
|
|
9038
|
+
"type": "button-group",
|
|
9039
|
+
"id": "u:fd837823be5b",
|
|
9040
|
+
"vertical": true,
|
|
9041
|
+
"tiled": true,
|
|
9042
|
+
"buttons": dropdownButtons,
|
|
9043
|
+
"className": "w-full overflow-auto",
|
|
9044
|
+
"btnClassName": "w-full",
|
|
9045
|
+
"size": "lg"
|
|
9046
|
+
}
|
|
9047
|
+
],
|
|
9048
|
+
"style": {
|
|
9049
|
+
"padding": "0",
|
|
9050
|
+
"overflow": "auto",
|
|
9051
|
+
"max-height": "70vh"
|
|
9052
|
+
}
|
|
9053
|
+
}
|
|
9054
|
+
|
|
9055
|
+
]
|
|
9056
|
+
}
|
|
9057
|
+
]
|
|
9058
|
+
};
|
|
9059
|
+
|
|
9060
|
+
return dropdown;
|
|
9061
|
+
};
|
|
9062
|
+
|
|
8871
9063
|
const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
8872
9064
|
const { buttons, moreButtons, moreButtonsVisibleOn } = getObjectDetailHeaderButtons(objectSchema, recordId);
|
|
8873
9065
|
if(ctx.formFactor === 'SMALL'){
|
|
@@ -8891,46 +9083,7 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
8891
9083
|
}
|
|
8892
9084
|
});
|
|
8893
9085
|
|
|
8894
|
-
return [
|
|
8895
|
-
{
|
|
8896
|
-
"type": "button",
|
|
8897
|
-
"icon": "fa fa-angle-down",
|
|
8898
|
-
"visibleOn": phoneMoreButtonsVisibleOn,
|
|
8899
|
-
"onEvent": {
|
|
8900
|
-
"click": {
|
|
8901
|
-
"actions": [
|
|
8902
|
-
{
|
|
8903
|
-
"actionType": "drawer",
|
|
8904
|
-
"drawer": {
|
|
8905
|
-
"type": "drawer",
|
|
8906
|
-
"title": instance.t('frontend_operation'),
|
|
8907
|
-
"id": "object_actions_drawer_" + objectSchema.name,
|
|
8908
|
-
"body": [
|
|
8909
|
-
{
|
|
8910
|
-
"type": "button-group",
|
|
8911
|
-
"id": "u:fd837823be5b",
|
|
8912
|
-
"vertical": true,
|
|
8913
|
-
"tiled": true,
|
|
8914
|
-
"buttons": dropdownButtons,
|
|
8915
|
-
"btnLevel": "enhance",
|
|
8916
|
-
"className": "w-full",
|
|
8917
|
-
"btnClassName": "w-full",
|
|
8918
|
-
"size": "lg"
|
|
8919
|
-
}
|
|
8920
|
-
],
|
|
8921
|
-
"position": "bottom",
|
|
8922
|
-
"closeOnOutside": true,
|
|
8923
|
-
"resizable": false,
|
|
8924
|
-
"className": "buttons-drawer",
|
|
8925
|
-
"bodyClassName": "m-none p-none",
|
|
8926
|
-
"actions": []
|
|
8927
|
-
}
|
|
8928
|
-
}
|
|
8929
|
-
]
|
|
8930
|
-
}
|
|
8931
|
-
}
|
|
8932
|
-
}
|
|
8933
|
-
]
|
|
9086
|
+
return [getDropdown(dropdownButtons)];
|
|
8934
9087
|
}else {
|
|
8935
9088
|
if(moreButtons.length > 0){
|
|
8936
9089
|
const dropdownButtonsSchema = {
|
|
@@ -8951,54 +9104,16 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
8951
9104
|
const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
8952
9105
|
const buttons = getListViewButtons(objectSchema, ctx);
|
|
8953
9106
|
if(ctx.formFactor === 'SMALL'){
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
{
|
|
8962
|
-
"actionType": "drawer",
|
|
8963
|
-
"drawer": {
|
|
8964
|
-
"type": "drawer",
|
|
8965
|
-
"title": instance.t('frontend_operation'),
|
|
8966
|
-
"id": "object_actions_drawer_" + objectSchema.name,
|
|
8967
|
-
"body": [
|
|
8968
|
-
{
|
|
8969
|
-
"type": "button-group",
|
|
8970
|
-
"id": "u:fd837823be5b",
|
|
8971
|
-
"vertical": true,
|
|
8972
|
-
"tiled": true,
|
|
8973
|
-
"buttons": [
|
|
8974
|
-
..._$1__namespace.map(buttons, (button)=>{
|
|
8975
|
-
return {
|
|
8976
|
-
type: 'steedos-object-button',
|
|
8977
|
-
name: button.name,
|
|
8978
|
-
objectName: button.objectName,
|
|
8979
|
-
visibleOn: getButtonVisibleOn(button),
|
|
8980
|
-
className: `button_${button.name} w-full`
|
|
8981
|
-
}
|
|
8982
|
-
})
|
|
8983
|
-
],
|
|
8984
|
-
"btnLevel": "enhance",
|
|
8985
|
-
"className": "w-full",
|
|
8986
|
-
"btnClassName": "w-full",
|
|
8987
|
-
"size": "lg"
|
|
8988
|
-
}
|
|
8989
|
-
],
|
|
8990
|
-
"position": "bottom",
|
|
8991
|
-
"closeOnOutside": true,
|
|
8992
|
-
"resizable": false,
|
|
8993
|
-
"className": "buttons-drawer",
|
|
8994
|
-
"bodyClassName": "m-none p-none",
|
|
8995
|
-
"actions": []
|
|
8996
|
-
}
|
|
8997
|
-
}
|
|
8998
|
-
]
|
|
8999
|
-
}
|
|
9107
|
+
const dropdownButtons = _$1__namespace.map(buttons, (button)=>{
|
|
9108
|
+
return {
|
|
9109
|
+
type: 'steedos-object-button',
|
|
9110
|
+
name: button.name,
|
|
9111
|
+
objectName: button.objectName,
|
|
9112
|
+
visibleOn: getButtonVisibleOn(button),
|
|
9113
|
+
className: `button_${button.name} w-full`
|
|
9000
9114
|
}
|
|
9001
|
-
|
|
9115
|
+
});
|
|
9116
|
+
return getDropdown(dropdownButtons);
|
|
9002
9117
|
}else {
|
|
9003
9118
|
return _$1__namespace.map(buttons, (button) => {
|
|
9004
9119
|
return {
|
|
@@ -9015,55 +9130,19 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
9015
9130
|
const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
|
|
9016
9131
|
const buttons = getObjectRelatedListButtons(objectSchema, ctx);
|
|
9017
9132
|
if(ctx.formFactor === 'SMALL'){
|
|
9018
|
-
|
|
9019
|
-
|
|
9020
|
-
|
|
9021
|
-
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
"actionType": "drawer",
|
|
9026
|
-
"drawer": {
|
|
9027
|
-
"type": "drawer",
|
|
9028
|
-
"title": instance.t('frontend_operation'),
|
|
9029
|
-
"id": "object_actions_drawer_" + objectSchema.name,
|
|
9030
|
-
"body": [
|
|
9031
|
-
{
|
|
9032
|
-
"type": "button-group",
|
|
9033
|
-
"vertical": true,
|
|
9034
|
-
"tiled": true,
|
|
9035
|
-
"buttons": [
|
|
9036
|
-
..._$1__namespace.map(buttons, (button)=>{
|
|
9037
|
-
return {
|
|
9038
|
-
type: 'steedos-object-button',
|
|
9039
|
-
name: button.name,
|
|
9040
|
-
objectName: button.objectName,
|
|
9041
|
-
visibleOn: getButtonVisibleOn(button),
|
|
9042
|
-
className: `button_${button.name} w-full`
|
|
9043
|
-
}
|
|
9044
|
-
})
|
|
9045
|
-
],
|
|
9046
|
-
"btnLevel": "enhance",
|
|
9047
|
-
"className": "w-full",
|
|
9048
|
-
"btnClassName": "w-full",
|
|
9049
|
-
"size": "lg"
|
|
9050
|
-
}
|
|
9051
|
-
],
|
|
9052
|
-
"position": "bottom",
|
|
9053
|
-
"closeOnOutside": true,
|
|
9054
|
-
"resizable": false,
|
|
9055
|
-
"className": "buttons-drawer",
|
|
9056
|
-
"bodyClassName": "m-none p-none",
|
|
9057
|
-
"actions": []
|
|
9058
|
-
}
|
|
9059
|
-
}
|
|
9060
|
-
]
|
|
9061
|
-
}
|
|
9133
|
+
const dropdownButtons = _$1__namespace.map(buttons, (button)=>{
|
|
9134
|
+
return {
|
|
9135
|
+
type: 'steedos-object-button',
|
|
9136
|
+
name: button.name,
|
|
9137
|
+
objectName: button.objectName,
|
|
9138
|
+
visibleOn: getButtonVisibleOn(button),
|
|
9139
|
+
className: `button_${button.name} w-full`
|
|
9062
9140
|
}
|
|
9063
|
-
|
|
9141
|
+
});
|
|
9142
|
+
return [getDropdown(dropdownButtons)];
|
|
9064
9143
|
}else {
|
|
9065
9144
|
return _$1__namespace.map(buttons, (button) => {
|
|
9066
|
-
return {
|
|
9145
|
+
return {
|
|
9067
9146
|
type: 'steedos-object-button',
|
|
9068
9147
|
name: button.name,
|
|
9069
9148
|
objectName: button.objectName,
|
|
@@ -9698,6 +9777,217 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
9698
9777
|
};
|
|
9699
9778
|
}
|
|
9700
9779
|
|
|
9780
|
+
const getNewListviewButtonSchema = ()=>{
|
|
9781
|
+
return {
|
|
9782
|
+
"type": "button",
|
|
9783
|
+
"label": instance.t('frontend_listview_control_new_label'),
|
|
9784
|
+
"className": "steedos-listview-new-button",
|
|
9785
|
+
"onEvent": {
|
|
9786
|
+
"click": {
|
|
9787
|
+
"weight": 0,
|
|
9788
|
+
"actions": [
|
|
9789
|
+
{
|
|
9790
|
+
"dialog": {
|
|
9791
|
+
"type": "dialog",
|
|
9792
|
+
"title": instance.t('frontend_listview_control_new_title'),
|
|
9793
|
+
"data": {
|
|
9794
|
+
//"&":"$$",2.7、2.9、3.0在此处失效
|
|
9795
|
+
"all": "${uiSchema.list_views.all}",
|
|
9796
|
+
"list_view": "${uiSchema.list_views[listName]}",
|
|
9797
|
+
"appId": "${appId}",
|
|
9798
|
+
"global": "${global}",
|
|
9799
|
+
"targetObjectName": "${objectName}",
|
|
9800
|
+
"context": "${context}"
|
|
9801
|
+
},
|
|
9802
|
+
"body": [
|
|
9803
|
+
{
|
|
9804
|
+
"type": "steedos-object-form",
|
|
9805
|
+
"label": "对象表单",
|
|
9806
|
+
"objectApiName": "object_listviews",
|
|
9807
|
+
"recordId": "",
|
|
9808
|
+
"mode": "edit",
|
|
9809
|
+
"layout": "normal",
|
|
9810
|
+
"defaultData": {
|
|
9811
|
+
"&": "${list_view}",
|
|
9812
|
+
"name":"",
|
|
9813
|
+
"label":"",
|
|
9814
|
+
"filters":"",
|
|
9815
|
+
"shared":false,
|
|
9816
|
+
"object_name": "${targetObjectName}",
|
|
9817
|
+
"_id":"",
|
|
9818
|
+
"shared_to": null,
|
|
9819
|
+
"shared_to_organizations": null,
|
|
9820
|
+
"locked": false,
|
|
9821
|
+
"owner": null,
|
|
9822
|
+
"company_id": null,
|
|
9823
|
+
"company_ids": null,
|
|
9824
|
+
"is_system": false
|
|
9825
|
+
},
|
|
9826
|
+
"fieldsExtend": fieldsExtend$5(),
|
|
9827
|
+
"fields": fields$1(),
|
|
9828
|
+
"onEvent": {
|
|
9829
|
+
"submitSucc": {
|
|
9830
|
+
"weight": 0,
|
|
9831
|
+
"actions": [
|
|
9832
|
+
{
|
|
9833
|
+
"args": {
|
|
9834
|
+
// 直接使用recordId不能拿到数据,只能通过result里面拿数据
|
|
9835
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
9836
|
+
"blank": false
|
|
9837
|
+
},
|
|
9838
|
+
"actionType": "url",
|
|
9839
|
+
}
|
|
9840
|
+
]
|
|
9841
|
+
}
|
|
9842
|
+
},
|
|
9843
|
+
"messages": {
|
|
9844
|
+
"success": instance.t('frontend_listview_control_new_message_success'),
|
|
9845
|
+
"failed": instance.t('frontend_listview_control_new_message_failed')
|
|
9846
|
+
},
|
|
9847
|
+
}
|
|
9848
|
+
],
|
|
9849
|
+
"showCloseButton": true,
|
|
9850
|
+
"showErrorMsg": true,
|
|
9851
|
+
"showLoading": true,
|
|
9852
|
+
"closeOnEsc": false,
|
|
9853
|
+
"dataMapSwitch": false,
|
|
9854
|
+
"size": "lg"
|
|
9855
|
+
},
|
|
9856
|
+
"actionType": "dialog"
|
|
9857
|
+
}
|
|
9858
|
+
]
|
|
9859
|
+
}
|
|
9860
|
+
}
|
|
9861
|
+
}
|
|
9862
|
+
};
|
|
9863
|
+
|
|
9864
|
+
function fields$1(){
|
|
9865
|
+
return [
|
|
9866
|
+
"label",
|
|
9867
|
+
"name",
|
|
9868
|
+
"object_name",
|
|
9869
|
+
"filter_scope",
|
|
9870
|
+
"show_count",
|
|
9871
|
+
"columns",
|
|
9872
|
+
"sort",
|
|
9873
|
+
"filters",
|
|
9874
|
+
"mobile_columns",
|
|
9875
|
+
"searchable_fields",
|
|
9876
|
+
"is_system",
|
|
9877
|
+
"shared",
|
|
9878
|
+
"shared_to",
|
|
9879
|
+
"shared_to_organizations"
|
|
9880
|
+
]
|
|
9881
|
+
}
|
|
9882
|
+
|
|
9883
|
+
function fieldsExtend$5(){
|
|
9884
|
+
return {
|
|
9885
|
+
"group": "",
|
|
9886
|
+
"label": {
|
|
9887
|
+
"group": "",
|
|
9888
|
+
"is_wide": true
|
|
9889
|
+
},
|
|
9890
|
+
"name": {
|
|
9891
|
+
"group": "",
|
|
9892
|
+
"amis": {
|
|
9893
|
+
"hidden": true,
|
|
9894
|
+
"required": false
|
|
9895
|
+
}
|
|
9896
|
+
},
|
|
9897
|
+
"object_name": {
|
|
9898
|
+
"group": "",
|
|
9899
|
+
"amis": {
|
|
9900
|
+
"hidden": true
|
|
9901
|
+
}
|
|
9902
|
+
},
|
|
9903
|
+
"filter_scope": {
|
|
9904
|
+
"group": "",
|
|
9905
|
+
"amis": {
|
|
9906
|
+
"hidden": true,
|
|
9907
|
+
"required": false
|
|
9908
|
+
}
|
|
9909
|
+
},
|
|
9910
|
+
"columns": {
|
|
9911
|
+
"group": "",
|
|
9912
|
+
"amis": {
|
|
9913
|
+
"hidden": true,
|
|
9914
|
+
"required": false
|
|
9915
|
+
}
|
|
9916
|
+
},
|
|
9917
|
+
"mobile_columns":{
|
|
9918
|
+
"group": "",
|
|
9919
|
+
"amis": {
|
|
9920
|
+
"hidden": true,
|
|
9921
|
+
"required": false
|
|
9922
|
+
}
|
|
9923
|
+
},
|
|
9924
|
+
"searchable_fields":{
|
|
9925
|
+
"group": "",
|
|
9926
|
+
"amis": {
|
|
9927
|
+
"hidden": true,
|
|
9928
|
+
"required": false
|
|
9929
|
+
}
|
|
9930
|
+
},
|
|
9931
|
+
"filter_fields": {
|
|
9932
|
+
"group": "",
|
|
9933
|
+
"amis": {
|
|
9934
|
+
"hidden": true,
|
|
9935
|
+
"required": false
|
|
9936
|
+
}
|
|
9937
|
+
},
|
|
9938
|
+
"scrolling_mode": {
|
|
9939
|
+
"group": "",
|
|
9940
|
+
"amis": {
|
|
9941
|
+
"hidden": true,
|
|
9942
|
+
"required": false
|
|
9943
|
+
}
|
|
9944
|
+
},
|
|
9945
|
+
"sort": {
|
|
9946
|
+
"group": "",
|
|
9947
|
+
"amis": {
|
|
9948
|
+
"hidden": true,
|
|
9949
|
+
"required": false
|
|
9950
|
+
}
|
|
9951
|
+
},
|
|
9952
|
+
"show_count": {
|
|
9953
|
+
"group": "",
|
|
9954
|
+
"amis": {
|
|
9955
|
+
"hidden": true,
|
|
9956
|
+
"required": false
|
|
9957
|
+
}
|
|
9958
|
+
},
|
|
9959
|
+
"type": {
|
|
9960
|
+
"group": "",
|
|
9961
|
+
"amis": {
|
|
9962
|
+
"hidden": true,
|
|
9963
|
+
"required": false
|
|
9964
|
+
}
|
|
9965
|
+
},
|
|
9966
|
+
"shared": {
|
|
9967
|
+
"group": "",
|
|
9968
|
+
"amis": {
|
|
9969
|
+
"visibleOn": "${false}"
|
|
9970
|
+
}
|
|
9971
|
+
},
|
|
9972
|
+
"shared_to": {
|
|
9973
|
+
"group": "",
|
|
9974
|
+
"amis":{
|
|
9975
|
+
"type": "radios",
|
|
9976
|
+
"inline": false
|
|
9977
|
+
}
|
|
9978
|
+
},
|
|
9979
|
+
"shared_to_organizations": {
|
|
9980
|
+
"group": ""
|
|
9981
|
+
},
|
|
9982
|
+
"filters": {
|
|
9983
|
+
"group": "",
|
|
9984
|
+
"amis": {
|
|
9985
|
+
"hidden": true
|
|
9986
|
+
}
|
|
9987
|
+
}
|
|
9988
|
+
}
|
|
9989
|
+
}
|
|
9990
|
+
|
|
9701
9991
|
/**
|
|
9702
9992
|
* 列表视图顶部第一行amisSchema
|
|
9703
9993
|
* @param {*} objectSchema 对象UISchema
|
|
@@ -9707,16 +9997,482 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
9707
9997
|
const { icon, label } = objectSchema;
|
|
9708
9998
|
const disabled_list_views = objectSchema.permissions.disabled_list_views;
|
|
9709
9999
|
const listViewButtonOptions = [];
|
|
9710
|
-
|
|
9711
|
-
|
|
9712
|
-
(
|
|
9713
|
-
|
|
9714
|
-
|
|
9715
|
-
|
|
10000
|
+
const initApiAdaptor = `
|
|
10001
|
+
var data;
|
|
10002
|
+
if (recordId) {
|
|
10003
|
+
data = payload.data || { _filters_type_controller: 'conditions' };
|
|
10004
|
+
//数据格式转换
|
|
10005
|
+
if (data) {
|
|
10006
|
+
data.sort = lodash.map(data.sort, (item) => {
|
|
10007
|
+
return item.field_name + ":" + item.order;
|
|
10008
|
+
});
|
|
10009
|
+
data.searchable_fields = lodash.map(data.searchable_fields, 'field');
|
|
10010
|
+
|
|
10011
|
+
if (data.filters && lodash.isString(data.filters)) {
|
|
10012
|
+
try {
|
|
10013
|
+
data.filters = JSON.parse(data.filters);
|
|
10014
|
+
} catch (e) { }
|
|
10015
|
+
}
|
|
10016
|
+
|
|
10017
|
+
if (data.filters && lodash.isString(data.filters)) {
|
|
10018
|
+
data._filters_type_controller = 'function';
|
|
10019
|
+
} else {
|
|
10020
|
+
data._filters_type_controller = 'conditions'
|
|
10021
|
+
}
|
|
10022
|
+
|
|
10023
|
+
if (data._filters_type_controller === 'conditions') {
|
|
10024
|
+
data._filters_conditions = window.amisConvert.filtersToConditions(data.filters || []);
|
|
10025
|
+
} else {
|
|
10026
|
+
data._filters_function = data.filters;
|
|
10027
|
+
}
|
|
10028
|
+
}
|
|
10029
|
+
} else {
|
|
10030
|
+
const uiSchema = api.body.uiSchema;
|
|
10031
|
+
const contextDefaultData = context && context.data && context.data.defaultData; const defaultData = api.body.defaultData || contextDefaultData;
|
|
10032
|
+
let defaultValues = {};
|
|
10033
|
+
_.each(uiSchema && uiSchema.fields, function (field) {
|
|
10034
|
+
var value = SteedosUI.getFieldDefaultValue(field, api.body.global);
|
|
10035
|
+
if (!_.isNil(value)) {
|
|
10036
|
+
defaultValues[field.name] = value;
|
|
10037
|
+
}
|
|
10038
|
+
});
|
|
10039
|
+
if (defaultData && _.isObject(defaultData) && !_.isArray(defaultData)) {
|
|
10040
|
+
data = Object.assign({}, defaultValues, defaultData);
|
|
10041
|
+
}else{data = Object.assign({}, defaultValues) }
|
|
10042
|
+
}
|
|
10043
|
+
for (key in data) {
|
|
10044
|
+
if (data[key] === null) {
|
|
10045
|
+
delete data[key];
|
|
10046
|
+
}
|
|
10047
|
+
}
|
|
10048
|
+
payload.data = data;
|
|
10049
|
+
delete payload.extensions; if (data.is_enable != false) { data.is_enable = true; };
|
|
10050
|
+
return payload;
|
|
10051
|
+
`;
|
|
10052
|
+
const apiRequestAdaptor = `
|
|
10053
|
+
delete formData.created;
|
|
10054
|
+
delete formData.created_by;
|
|
10055
|
+
delete formData.modified;
|
|
10056
|
+
delete formData.modified_by;
|
|
10057
|
+
delete formData._display;
|
|
10058
|
+
|
|
10059
|
+
//数据格式转换
|
|
10060
|
+
formData.sort = lodash.map(formData.sort, (item) => {
|
|
10061
|
+
const arr = item.split(':');
|
|
10062
|
+
return { field_name: arr[0], order: arr[1] };
|
|
10063
|
+
});
|
|
10064
|
+
|
|
10065
|
+
formData.searchable_fields = lodash.map(formData.searchable_fields, (item) => {
|
|
10066
|
+
return { field: item };
|
|
10067
|
+
});
|
|
10068
|
+
|
|
10069
|
+
if (!formData._filters_type_controller) {
|
|
10070
|
+
formData._filters_type_controller = 'conditions';
|
|
10071
|
+
}
|
|
10072
|
+
|
|
10073
|
+
if (formData._filters_type_controller === 'conditions' && formData._filters_conditions) {
|
|
10074
|
+
formData.filters = window.amisConvert.conditionsToFilters(formData._filters_conditions);
|
|
10075
|
+
// formData.filters = JSON.stringify(window.amisConvert.conditionsToFilters(formData._filters_conditions), null, 4);
|
|
10076
|
+
} else {
|
|
10077
|
+
formData.filters = formData._filters_function || null;
|
|
10078
|
+
}
|
|
10079
|
+
|
|
10080
|
+
delete formData._filters_type_controller;
|
|
10081
|
+
delete formData._filters_conditions;
|
|
10082
|
+
delete formData._filters_function;
|
|
10083
|
+
|
|
10084
|
+
query = \`mutation{record: object_listviews__insert(doc: {__saveData}){_id}}\`;
|
|
10085
|
+
if (formData.recordId) {
|
|
10086
|
+
query = \`mutation{record: object_listviews__update(id: "\` + formData._id + \`", doc: {__saveData}){_id}}\`;
|
|
10087
|
+
};
|
|
10088
|
+
__saveData = JSON.stringify(JSON.stringify(formData));
|
|
10089
|
+
|
|
10090
|
+
api.data = { query: query.replace('{__saveData}', __saveData) };
|
|
10091
|
+
return api;
|
|
10092
|
+
`;
|
|
10093
|
+
_$1.each(
|
|
10094
|
+
objectSchema.list_views,
|
|
10095
|
+
(listView, name) => {
|
|
10096
|
+
if(name === "lookup" || (disabled_list_views && disabled_list_views.indexOf(listView._id)>-1)){
|
|
10097
|
+
// 内置lookup为弹出选择专用视图,根据用户权限被禁用的视图,不显示在列表切换区域
|
|
10098
|
+
return;
|
|
9716
10099
|
}
|
|
9717
10100
|
listViewButtonOptions.push({
|
|
9718
10101
|
type: "button",
|
|
9719
10102
|
label: listView.label,
|
|
10103
|
+
body: [
|
|
10104
|
+
{
|
|
10105
|
+
"type": "flex",
|
|
10106
|
+
"alignItems": "center",
|
|
10107
|
+
"justify": "space-between",
|
|
10108
|
+
"items": [
|
|
10109
|
+
{
|
|
10110
|
+
"type": "tpl",
|
|
10111
|
+
"tpl": listView.label
|
|
10112
|
+
},
|
|
10113
|
+
{
|
|
10114
|
+
"type": "button",
|
|
10115
|
+
"className": "steedos-listview-edit-button ml-3",
|
|
10116
|
+
"icon": "fa fa-edit",
|
|
10117
|
+
"actionType": "dialog",
|
|
10118
|
+
"hiddenOn": `!((global.user.is_space_admin || global.userId == '${listView.owner || ""}') && !!'${listView.owner || ""}')`,
|
|
10119
|
+
"dialog": {
|
|
10120
|
+
"type": "dialog",
|
|
10121
|
+
"title": "编辑 列表视图",
|
|
10122
|
+
"data": {
|
|
10123
|
+
"object_name": "${objectName}",
|
|
10124
|
+
"recordId": listView._id,
|
|
10125
|
+
"listName": "${listName}",
|
|
10126
|
+
"appId": "${appId}",
|
|
10127
|
+
"context": "${context}",
|
|
10128
|
+
"global": "${global}",
|
|
10129
|
+
"_id": listView._id
|
|
10130
|
+
},
|
|
10131
|
+
"body": [
|
|
10132
|
+
{
|
|
10133
|
+
"type": "steedos-object-form",
|
|
10134
|
+
"label": "对象表单",
|
|
10135
|
+
"objectApiName": "object_listviews",
|
|
10136
|
+
"recordId": "${recordId}",
|
|
10137
|
+
"className": "sm:rounded sm:border-gray-300 bg-white",
|
|
10138
|
+
"layout": "horizontal",
|
|
10139
|
+
"form": {
|
|
10140
|
+
"id": "form_object_listviews"
|
|
10141
|
+
},
|
|
10142
|
+
"mode": "edit",
|
|
10143
|
+
"enableTabs": true,
|
|
10144
|
+
"fields": [
|
|
10145
|
+
"label",
|
|
10146
|
+
"sort_no",
|
|
10147
|
+
"crud_mode",
|
|
10148
|
+
"shared",
|
|
10149
|
+
"shared_to",
|
|
10150
|
+
'shared_to_organizations',
|
|
10151
|
+
"columns",
|
|
10152
|
+
"columns.$",
|
|
10153
|
+
"columns.$.field",
|
|
10154
|
+
"columns.$.width",
|
|
10155
|
+
"columns.$.wrap",
|
|
10156
|
+
"mobile_columns",
|
|
10157
|
+
"mobile_columns.$",
|
|
10158
|
+
"mobile_columns.$.field",
|
|
10159
|
+
"sort",
|
|
10160
|
+
"sort.$",
|
|
10161
|
+
"sort.$.field_name",
|
|
10162
|
+
"sort.$.order",
|
|
10163
|
+
"filters",
|
|
10164
|
+
"searchable_fields",
|
|
10165
|
+
"searchable_fields.$",
|
|
10166
|
+
"searchable_fields.$.field",
|
|
10167
|
+
],
|
|
10168
|
+
"tabsMode": "line",
|
|
10169
|
+
"fieldsExtend": {
|
|
10170
|
+
"columns": {
|
|
10171
|
+
"amis": {
|
|
10172
|
+
"showIndex": true,
|
|
10173
|
+
"footerToolbar": [
|
|
10174
|
+
{
|
|
10175
|
+
"type": "button",
|
|
10176
|
+
"label": "${'object_listviews.listview_form.field_set' | t}",
|
|
10177
|
+
"actionType": "dialog",
|
|
10178
|
+
"dialog": {
|
|
10179
|
+
"type": "dialog",
|
|
10180
|
+
"title": "${'object_listviews.listview_form.displayed_columns' | t}",
|
|
10181
|
+
"size": "md",
|
|
10182
|
+
"body": [
|
|
10183
|
+
{
|
|
10184
|
+
"type": "transfer",
|
|
10185
|
+
"options": [
|
|
10186
|
+
],
|
|
10187
|
+
"multiple": true,
|
|
10188
|
+
"id": "u:92c0b3cccca0",
|
|
10189
|
+
"required": true,
|
|
10190
|
+
"placeholder": "-",
|
|
10191
|
+
"className": "col-span-2 m-0",
|
|
10192
|
+
"checkAll": false,
|
|
10193
|
+
"searchable": true,
|
|
10194
|
+
"sortable": true,
|
|
10195
|
+
"itemHeight": 40,
|
|
10196
|
+
"source": {
|
|
10197
|
+
"method": "get",
|
|
10198
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
|
|
10199
|
+
"headers": {
|
|
10200
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
10201
|
+
},
|
|
10202
|
+
"requestAdaptor": "",
|
|
10203
|
+
"adaptor": ""
|
|
10204
|
+
},
|
|
10205
|
+
"joinValues": false,
|
|
10206
|
+
"extractValue": true,
|
|
10207
|
+
"name": "columns_quick_select",
|
|
10208
|
+
"value": "${columns|pick:field|split}"
|
|
10209
|
+
}
|
|
10210
|
+
],
|
|
10211
|
+
"onEvent": {
|
|
10212
|
+
"confirm": {
|
|
10213
|
+
"actions": [
|
|
10214
|
+
{
|
|
10215
|
+
"actionType": "custom",
|
|
10216
|
+
"script": "const columns = [];\nconst columns_quick_select = _.cloneDeep(event.data.columns_quick_select);\n_.forEach(columns_quick_select, function (field) {\n const column_field = _.find(event.data.columns, { field });\n if (column_field) {\n columns.push(column_field)\n } else {\n columns.push({\n field\n })\n }\n});\ndoAction({\n \"componentId\": \"form_object_listviews\",\n \"actionType\": \"setValue\",\n \"args\": {\n \"value\": {\n columns\n }\n }\n});"
|
|
10217
|
+
}
|
|
10218
|
+
]
|
|
10219
|
+
}
|
|
10220
|
+
}
|
|
10221
|
+
}
|
|
10222
|
+
}
|
|
10223
|
+
],
|
|
10224
|
+
"addable": false,
|
|
10225
|
+
"draggable": false,
|
|
10226
|
+
"columns": [
|
|
10227
|
+
{
|
|
10228
|
+
"name": "field",
|
|
10229
|
+
"inlineEditMode": false
|
|
10230
|
+
},
|
|
10231
|
+
{
|
|
10232
|
+
"name": "width",
|
|
10233
|
+
"width": 100
|
|
10234
|
+
},
|
|
10235
|
+
{
|
|
10236
|
+
"name": "wrap",
|
|
10237
|
+
"width": 50
|
|
10238
|
+
}
|
|
10239
|
+
],
|
|
10240
|
+
"enableDialog": false
|
|
10241
|
+
}
|
|
10242
|
+
},
|
|
10243
|
+
"sort": {
|
|
10244
|
+
"label": "",
|
|
10245
|
+
"amis": {
|
|
10246
|
+
"type": "tabs-transfer",
|
|
10247
|
+
"options": [
|
|
10248
|
+
],
|
|
10249
|
+
"id": "u:32f3e4e73115",
|
|
10250
|
+
"strictMode": true,
|
|
10251
|
+
"itemHeight": 40,
|
|
10252
|
+
"source": {
|
|
10253
|
+
"method": "get",
|
|
10254
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/sortFields/options",
|
|
10255
|
+
"headers": {
|
|
10256
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
10257
|
+
},
|
|
10258
|
+
"data": null,
|
|
10259
|
+
"requestAdaptor": "",
|
|
10260
|
+
"adaptor": "",
|
|
10261
|
+
"sendOn": "!!this.object_name"
|
|
10262
|
+
},
|
|
10263
|
+
"visibleOn": "!!this.object_name",
|
|
10264
|
+
"sortable": true,
|
|
10265
|
+
"className": "col-span-2 m-0",
|
|
10266
|
+
"searchable": true,
|
|
10267
|
+
"checkAll": false,
|
|
10268
|
+
"clearValueOnHidden": false,
|
|
10269
|
+
"joinValues": false,
|
|
10270
|
+
"extractValue": true,
|
|
10271
|
+
"en-US": {
|
|
10272
|
+
"label": "Default Sort Order"
|
|
10273
|
+
},
|
|
10274
|
+
"multiple": true
|
|
10275
|
+
}
|
|
10276
|
+
},
|
|
10277
|
+
"filters": {
|
|
10278
|
+
"label": "",
|
|
10279
|
+
"amis": {
|
|
10280
|
+
"type": "group",
|
|
10281
|
+
"body": [
|
|
10282
|
+
{
|
|
10283
|
+
"type": "radios",
|
|
10284
|
+
"label": "${'object_listviews.listview_form.filter_configuration_method' | t}",
|
|
10285
|
+
"name": "_filters_type_controller",
|
|
10286
|
+
"options": [
|
|
10287
|
+
{
|
|
10288
|
+
"label": "${'object_listviews.listview_form.conditions_combination' | t}",
|
|
10289
|
+
"value": "conditions"
|
|
10290
|
+
},
|
|
10291
|
+
{
|
|
10292
|
+
"label": "${'object_listviews.listview_form.javascript' | t}",
|
|
10293
|
+
"value": "function"
|
|
10294
|
+
}
|
|
10295
|
+
],
|
|
10296
|
+
"id": "u:318671bc196c",
|
|
10297
|
+
"joinValues": true,
|
|
10298
|
+
"className": "col-span-2 m-0",
|
|
10299
|
+
"language": "javascript",
|
|
10300
|
+
"visibleOn": "false",
|
|
10301
|
+
"en-US": {
|
|
10302
|
+
"label": "Controller"
|
|
10303
|
+
}
|
|
10304
|
+
},
|
|
10305
|
+
{
|
|
10306
|
+
"type": "condition-builder",
|
|
10307
|
+
"label": "",
|
|
10308
|
+
"labelClassName": "none",
|
|
10309
|
+
"name": "_filters_conditions",
|
|
10310
|
+
"description": "",
|
|
10311
|
+
"id": "u:a9f2232e30d7",
|
|
10312
|
+
"source": {
|
|
10313
|
+
"method": "get",
|
|
10314
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-listviews/getFilterFields?objectName=${object_name}",
|
|
10315
|
+
"dataType": "json",
|
|
10316
|
+
"headers": {
|
|
10317
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
10318
|
+
}
|
|
10319
|
+
},
|
|
10320
|
+
"disabled": false,
|
|
10321
|
+
"className": "col-span-2 m-0",
|
|
10322
|
+
"visibleOn": "!!this.object_name",
|
|
10323
|
+
"en-US": {
|
|
10324
|
+
"label": "Filters Conditions"
|
|
10325
|
+
}
|
|
10326
|
+
},
|
|
10327
|
+
{
|
|
10328
|
+
"type": "editor",
|
|
10329
|
+
"label": "${'object_listviews.listview_form.javascript' | t}",
|
|
10330
|
+
"name": "_filters_function",
|
|
10331
|
+
"id": "u:84714ec9abba",
|
|
10332
|
+
"visibleOn": "!!this.object_name && !!this._filters_type_controller && _filters_type_controller== 'function'",
|
|
10333
|
+
"className": "col-span-2 m-0",
|
|
10334
|
+
"labelClassName": "hidden"
|
|
10335
|
+
}
|
|
10336
|
+
]
|
|
10337
|
+
}
|
|
10338
|
+
},
|
|
10339
|
+
"mobile_columns": {
|
|
10340
|
+
"amis": {
|
|
10341
|
+
"showIndex": true,
|
|
10342
|
+
"footerToolbar": [
|
|
10343
|
+
{
|
|
10344
|
+
"type": "button",
|
|
10345
|
+
"label": "${'object_listviews.listview_form.field_set' | t}",
|
|
10346
|
+
"actionType": "dialog",
|
|
10347
|
+
"dialog": {
|
|
10348
|
+
"type": "dialog",
|
|
10349
|
+
"title": "${'object_listviews.listview_form.displayed_columns' | t}",
|
|
10350
|
+
"size": "md",
|
|
10351
|
+
"body": [
|
|
10352
|
+
{
|
|
10353
|
+
"type": "transfer",
|
|
10354
|
+
"options": [
|
|
10355
|
+
],
|
|
10356
|
+
"multiple": true,
|
|
10357
|
+
"id": "u:92c0b3cccca0",
|
|
10358
|
+
"required": true,
|
|
10359
|
+
"placeholder": "-",
|
|
10360
|
+
"className": "col-span-2 m-0",
|
|
10361
|
+
"itemHeight": 40,
|
|
10362
|
+
"checkAll": false,
|
|
10363
|
+
"searchable": true,
|
|
10364
|
+
"sortable": true,
|
|
10365
|
+
"source": {
|
|
10366
|
+
"method": "get",
|
|
10367
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
|
|
10368
|
+
"headers": {
|
|
10369
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
10370
|
+
},
|
|
10371
|
+
"requestAdaptor": "",
|
|
10372
|
+
"adaptor": ""
|
|
10373
|
+
},
|
|
10374
|
+
"joinValues": false,
|
|
10375
|
+
"extractValue": true,
|
|
10376
|
+
"name": "columns_quick_select",
|
|
10377
|
+
"value": "${mobile_columns|pick:field|split}"
|
|
10378
|
+
}
|
|
10379
|
+
],
|
|
10380
|
+
"onEvent": {
|
|
10381
|
+
"confirm": {
|
|
10382
|
+
"actions": [
|
|
10383
|
+
{
|
|
10384
|
+
"actionType": "custom",
|
|
10385
|
+
"script": "const mobile_columns = [];\nconst columns_quick_select = _.cloneDeep(event.data.columns_quick_select);\n_.forEach(columns_quick_select, function (field) {\n const column_field = _.find(event.data.mobile_columns, { field });\n if (column_field) {\n mobile_columns.push(column_field)\n } else {\n mobile_columns.push({\n field\n })\n }\n});\ndoAction({\n \"componentId\": \"form_object_listviews\",\n \"actionType\": \"setValue\",\n \"args\": {\n \"value\": {\n mobile_columns\n }\n }\n});"
|
|
10386
|
+
}
|
|
10387
|
+
]
|
|
10388
|
+
}
|
|
10389
|
+
}
|
|
10390
|
+
}
|
|
10391
|
+
}
|
|
10392
|
+
],
|
|
10393
|
+
"columns": [
|
|
10394
|
+
{
|
|
10395
|
+
"name": "field",
|
|
10396
|
+
"inlineEditMode": false
|
|
10397
|
+
}
|
|
10398
|
+
],
|
|
10399
|
+
"addable": false,
|
|
10400
|
+
"draggable": false,
|
|
10401
|
+
"enableDialog": false
|
|
10402
|
+
}
|
|
10403
|
+
},
|
|
10404
|
+
"searchable_fields": {
|
|
10405
|
+
"label": "",
|
|
10406
|
+
"amis": {
|
|
10407
|
+
"type": "transfer",
|
|
10408
|
+
"options": [
|
|
10409
|
+
],
|
|
10410
|
+
"selectMode": "list",
|
|
10411
|
+
"searchable": true,
|
|
10412
|
+
"searchApi": "",
|
|
10413
|
+
"sortable": true,
|
|
10414
|
+
"mode": "normal",
|
|
10415
|
+
"searchResultMode": "list",
|
|
10416
|
+
"joinValues": false,
|
|
10417
|
+
"extractValue": true,
|
|
10418
|
+
"itemHeight": 40,
|
|
10419
|
+
"source": {
|
|
10420
|
+
"method": "get",
|
|
10421
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
|
|
10422
|
+
"headers": {
|
|
10423
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
10424
|
+
},
|
|
10425
|
+
"data": null,
|
|
10426
|
+
"requestAdaptor": "",
|
|
10427
|
+
"adaptor": "",
|
|
10428
|
+
"sendOn": "!!this.object_name"
|
|
10429
|
+
},
|
|
10430
|
+
"visibleOn": "!!this.object_name",
|
|
10431
|
+
"className": "col-span-2 m-0",
|
|
10432
|
+
"multiple": true,
|
|
10433
|
+
"id": "u:adb91066539e"
|
|
10434
|
+
}
|
|
10435
|
+
},
|
|
10436
|
+
"shared_to": {
|
|
10437
|
+
"amis":{
|
|
10438
|
+
"type": "radios",
|
|
10439
|
+
"inline": false
|
|
10440
|
+
},
|
|
10441
|
+
"group": "",
|
|
10442
|
+
"is_wide": true
|
|
10443
|
+
}
|
|
10444
|
+
},
|
|
10445
|
+
initApiAdaptor,
|
|
10446
|
+
apiRequestAdaptor,
|
|
10447
|
+
"onEvent": {
|
|
10448
|
+
"submitSucc": {
|
|
10449
|
+
"weight": 0,
|
|
10450
|
+
"actions": [
|
|
10451
|
+
{
|
|
10452
|
+
"args": {
|
|
10453
|
+
"url": "${context.rootUrl}/app/${appId}/${object_name}/grid/${name}",
|
|
10454
|
+
"blank": false
|
|
10455
|
+
},
|
|
10456
|
+
"actionType": "url",
|
|
10457
|
+
},
|
|
10458
|
+
]
|
|
10459
|
+
}
|
|
10460
|
+
},
|
|
10461
|
+
"id": "u:ce9e3fcc411a"
|
|
10462
|
+
}
|
|
10463
|
+
],
|
|
10464
|
+
"className": "steedos-overflow-visible-dialog",
|
|
10465
|
+
"showCloseButton": true,
|
|
10466
|
+
"showErrorMsg": true,
|
|
10467
|
+
"showLoading": true,
|
|
10468
|
+
"closeOnEsc": false,
|
|
10469
|
+
"dataMapSwitch": false,
|
|
10470
|
+
"size": "lg"
|
|
10471
|
+
}
|
|
10472
|
+
}
|
|
10473
|
+
]
|
|
10474
|
+
}
|
|
10475
|
+
],
|
|
9720
10476
|
actionType: "link",
|
|
9721
10477
|
link: `/app/\${appId}/${objectSchema.name}/grid/${name}`
|
|
9722
10478
|
});
|
|
@@ -9750,6 +10506,8 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
9750
10506
|
"visibleOn": "${display == 'split'?true:false}"
|
|
9751
10507
|
});
|
|
9752
10508
|
}
|
|
10509
|
+
const listviewNewButton = getNewListviewButtonSchema();
|
|
10510
|
+
listviewNewButton.visibleOn = "global.user.is_space_admin";
|
|
9753
10511
|
return {
|
|
9754
10512
|
"type": "grid",
|
|
9755
10513
|
"columns": [
|
|
@@ -9780,14 +10538,24 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
9780
10538
|
},
|
|
9781
10539
|
{
|
|
9782
10540
|
"type": "dropdown-button",
|
|
9783
|
-
"className": "",
|
|
10541
|
+
"className": "steedos-listview-change-button",
|
|
9784
10542
|
"label": "\${listName ? uiSchema.list_views[listName].label : uiSchema.list_views[defaultListName].label}",
|
|
9785
10543
|
"rightIcon": "fa fa-caret-down",
|
|
9786
10544
|
"size": "sm",
|
|
9787
10545
|
"hideCaret": true,
|
|
9788
10546
|
"closeOnClick": true,
|
|
9789
10547
|
"btnClassName": "!bg-transparent !border-none !hover:border-none text-lg h-5 font-bold p-0 text-black leading-none",
|
|
9790
|
-
"buttons":
|
|
10548
|
+
"buttons": [
|
|
10549
|
+
...listViewButtonOptions,
|
|
10550
|
+
{
|
|
10551
|
+
"children": [
|
|
10552
|
+
{
|
|
10553
|
+
"type": "divider"
|
|
10554
|
+
}
|
|
10555
|
+
]
|
|
10556
|
+
},
|
|
10557
|
+
listviewNewButton
|
|
10558
|
+
]
|
|
9791
10559
|
}
|
|
9792
10560
|
],
|
|
9793
10561
|
"md": "",
|
|
@@ -9943,6 +10711,7 @@ function getObjectListHeader$1(objectSchema, listViewName, ctx) {
|
|
|
9943
10711
|
function getBackButtonSchema(){
|
|
9944
10712
|
return {
|
|
9945
10713
|
"type": "service",
|
|
10714
|
+
"className": "steedos-object-record-detail-header-back-button",
|
|
9946
10715
|
"onEvent": {
|
|
9947
10716
|
"@history_paths.changed": {
|
|
9948
10717
|
"actions": [
|
|
@@ -10229,7 +10998,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
10229
10998
|
id: `page_readonly_${name}_header`,
|
|
10230
10999
|
name: `page`,
|
|
10231
11000
|
body: body,
|
|
10232
|
-
className:
|
|
11001
|
+
className: "steedos-object-record-detail-header"
|
|
10233
11002
|
}
|
|
10234
11003
|
|
|
10235
11004
|
}
|
|
@@ -10249,279 +11018,69 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
10249
11018
|
"body": [
|
|
10250
11019
|
{
|
|
10251
11020
|
"type": "grid",
|
|
10252
|
-
"valign": "middle",
|
|
10253
|
-
"columns": [
|
|
10254
|
-
{
|
|
10255
|
-
"body": [
|
|
10256
|
-
{
|
|
10257
|
-
"type": "grid",
|
|
10258
|
-
"valign": "middle",
|
|
10259
|
-
"className": "flex justify-between",
|
|
10260
|
-
"columns": [
|
|
10261
|
-
{
|
|
10262
|
-
"body": {
|
|
10263
|
-
"type": "tpl",
|
|
10264
|
-
"className": "block",
|
|
10265
|
-
// "tpl": `<img class=\"slds-icon_small slds-icon_container slds-icon-standard-${standardIcon}\" src=\"\${context.rootUrl}/unpkg.com/@salesforce-ux/design-system/assets/icons/standard/${icon}.svg\" />`
|
|
10266
|
-
"tpl":`<svg class="w-6 h-6 slds-icon slds-icon_container slds-icon-standard-${standardIcon}" aria-hidden="true"><use xlink:href="/assets/icons/standard-sprite/svg/symbols.svg#${icon}"></use></svg>`
|
|
10267
|
-
},
|
|
10268
|
-
"md": "auto",
|
|
10269
|
-
"className": "",
|
|
10270
|
-
"columnClassName": "flex justify-center items-center"
|
|
10271
|
-
},
|
|
10272
|
-
{
|
|
10273
|
-
"body": [
|
|
10274
|
-
{
|
|
10275
|
-
"type": "tpl",
|
|
10276
|
-
"tpl": `<a class="text-black text-base font-bold hover:font-bold" href="/app/\${appId}/\${_master.objectName}/\${_master.recordId}/\${objectName}/grid?related_field_name=\${relatedKey}">${relatedLabel}(\${$count})</a>`,
|
|
10277
|
-
"inline": false,
|
|
10278
|
-
"wrapperComponent": "",
|
|
10279
|
-
"className": "",
|
|
10280
|
-
}
|
|
10281
|
-
],
|
|
10282
|
-
"md": "",
|
|
10283
|
-
"valign": "middle",
|
|
10284
|
-
"columnClassName": "p-l-xs"
|
|
10285
|
-
}
|
|
10286
|
-
]
|
|
10287
|
-
}
|
|
10288
|
-
],
|
|
10289
|
-
"md": "auto"
|
|
10290
|
-
},
|
|
10291
|
-
{
|
|
10292
|
-
"body": {
|
|
10293
|
-
"type": "flex",
|
|
10294
|
-
"items": amisButtonsSchema,
|
|
10295
|
-
},
|
|
10296
|
-
"md": "auto"
|
|
10297
|
-
}
|
|
10298
|
-
],
|
|
10299
|
-
"className": "flex justify-between min-h-8 items-center"
|
|
10300
|
-
}
|
|
10301
|
-
],
|
|
10302
|
-
"className": "steedos-record-related-header py-2 px-3 bg-gray-50 border rounded"
|
|
10303
|
-
};
|
|
10304
|
-
return recordRelatedListHeader;
|
|
10305
|
-
}
|
|
10306
|
-
|
|
10307
|
-
/**
|
|
10308
|
-
* 点击记录详细界面相关表顶部标题进入的相关表页面的顶部amisSchema
|
|
10309
|
-
* @param {*} objectSchema
|
|
10310
|
-
* @param {*} recordId
|
|
10311
|
-
* @param {*} relatedObjectName
|
|
10312
|
-
* @returns amisSchema
|
|
10313
|
-
*/
|
|
10314
|
-
async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
|
|
10315
|
-
}
|
|
10316
|
-
|
|
10317
|
-
const getNewListviewButtonSchema = ()=>{
|
|
10318
|
-
return {
|
|
10319
|
-
"type": "button",
|
|
10320
|
-
"label": instance.t('frontend_listview_control_new_label'),
|
|
10321
|
-
"onEvent": {
|
|
10322
|
-
"click": {
|
|
10323
|
-
"weight": 0,
|
|
10324
|
-
"actions": [
|
|
10325
|
-
{
|
|
10326
|
-
"dialog": {
|
|
10327
|
-
"type": "dialog",
|
|
10328
|
-
"title": instance.t('frontend_listview_control_new_title'),
|
|
10329
|
-
"data": {
|
|
10330
|
-
//"&":"$$",2.7、2.9、3.0在此处失效
|
|
10331
|
-
"all": "${uiSchema.list_views.all}",
|
|
10332
|
-
"list_view": "${uiSchema.list_views[listName]}",
|
|
10333
|
-
"appId": "${appId}",
|
|
10334
|
-
"global": "${global}",
|
|
10335
|
-
"targetObjectName": "${objectName}",
|
|
10336
|
-
"context": "${context}"
|
|
10337
|
-
},
|
|
10338
|
-
"body": [
|
|
10339
|
-
{
|
|
10340
|
-
"type": "steedos-object-form",
|
|
10341
|
-
"label": "对象表单",
|
|
10342
|
-
"objectApiName": "object_listviews",
|
|
10343
|
-
"recordId": "",
|
|
10344
|
-
"mode": "edit",
|
|
10345
|
-
"layout": "normal",
|
|
10346
|
-
"defaultData": {
|
|
10347
|
-
"&": "${list_view}",
|
|
10348
|
-
"name":"",
|
|
10349
|
-
"label":"",
|
|
10350
|
-
"filters":"",
|
|
10351
|
-
"shared":false,
|
|
10352
|
-
"object_name": "${targetObjectName}",
|
|
10353
|
-
"_id":"",
|
|
10354
|
-
"shared_to": null,
|
|
10355
|
-
"shared_to_organizations": null,
|
|
10356
|
-
"locked": false,
|
|
10357
|
-
"owner": null,
|
|
10358
|
-
"company_id": null,
|
|
10359
|
-
"company_ids": null,
|
|
10360
|
-
"is_system": false
|
|
10361
|
-
},
|
|
10362
|
-
"fieldsExtend": fieldsExtend$5(),
|
|
10363
|
-
"fields": fields$1(),
|
|
10364
|
-
"onEvent": {
|
|
10365
|
-
"submitSucc": {
|
|
10366
|
-
"weight": 0,
|
|
10367
|
-
"actions": [
|
|
10368
|
-
{
|
|
10369
|
-
"args": {
|
|
10370
|
-
// 直接使用recordId不能拿到数据,只能通过result里面拿数据
|
|
10371
|
-
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
10372
|
-
"blank": false
|
|
10373
|
-
},
|
|
10374
|
-
"actionType": "url",
|
|
10375
|
-
}
|
|
10376
|
-
]
|
|
10377
|
-
}
|
|
10378
|
-
},
|
|
10379
|
-
"messages": {
|
|
10380
|
-
"success": instance.t('frontend_listview_control_new_message_success'),
|
|
10381
|
-
"failed": instance.t('frontend_listview_control_new_message_failed')
|
|
10382
|
-
},
|
|
10383
|
-
}
|
|
10384
|
-
],
|
|
10385
|
-
"showCloseButton": true,
|
|
10386
|
-
"showErrorMsg": true,
|
|
10387
|
-
"showLoading": true,
|
|
10388
|
-
"closeOnEsc": false,
|
|
10389
|
-
"dataMapSwitch": false,
|
|
10390
|
-
"size": "lg"
|
|
10391
|
-
},
|
|
10392
|
-
"actionType": "dialog"
|
|
10393
|
-
}
|
|
10394
|
-
]
|
|
10395
|
-
}
|
|
10396
|
-
}
|
|
10397
|
-
}
|
|
10398
|
-
};
|
|
10399
|
-
|
|
10400
|
-
function fields$1(){
|
|
10401
|
-
return [
|
|
10402
|
-
"label",
|
|
10403
|
-
"name",
|
|
10404
|
-
"object_name",
|
|
10405
|
-
"filter_scope",
|
|
10406
|
-
"show_count",
|
|
10407
|
-
"columns",
|
|
10408
|
-
"sort",
|
|
10409
|
-
"filters",
|
|
10410
|
-
"mobile_columns",
|
|
10411
|
-
"searchable_fields",
|
|
10412
|
-
"is_system",
|
|
10413
|
-
"shared",
|
|
10414
|
-
"shared_to",
|
|
10415
|
-
"shared_to_organizations"
|
|
10416
|
-
]
|
|
10417
|
-
}
|
|
10418
|
-
|
|
10419
|
-
function fieldsExtend$5(){
|
|
10420
|
-
return {
|
|
10421
|
-
"group": "",
|
|
10422
|
-
"label": {
|
|
10423
|
-
"group": "",
|
|
10424
|
-
"is_wide": true
|
|
10425
|
-
},
|
|
10426
|
-
"name": {
|
|
10427
|
-
"group": "",
|
|
10428
|
-
"amis": {
|
|
10429
|
-
"hidden": true,
|
|
10430
|
-
"required": false
|
|
10431
|
-
}
|
|
10432
|
-
},
|
|
10433
|
-
"object_name": {
|
|
10434
|
-
"group": "",
|
|
10435
|
-
"amis": {
|
|
10436
|
-
"hidden": true
|
|
10437
|
-
}
|
|
10438
|
-
},
|
|
10439
|
-
"filter_scope": {
|
|
10440
|
-
"group": "",
|
|
10441
|
-
"amis": {
|
|
10442
|
-
"hidden": true,
|
|
10443
|
-
"required": false
|
|
10444
|
-
}
|
|
10445
|
-
},
|
|
10446
|
-
"columns": {
|
|
10447
|
-
"group": "",
|
|
10448
|
-
"amis": {
|
|
10449
|
-
"hidden": true,
|
|
10450
|
-
"required": false
|
|
10451
|
-
}
|
|
10452
|
-
},
|
|
10453
|
-
"mobile_columns":{
|
|
10454
|
-
"group": "",
|
|
10455
|
-
"amis": {
|
|
10456
|
-
"hidden": true,
|
|
10457
|
-
"required": false
|
|
10458
|
-
}
|
|
10459
|
-
},
|
|
10460
|
-
"searchable_fields":{
|
|
10461
|
-
"group": "",
|
|
10462
|
-
"amis": {
|
|
10463
|
-
"hidden": true,
|
|
10464
|
-
"required": false
|
|
10465
|
-
}
|
|
10466
|
-
},
|
|
10467
|
-
"filter_fields": {
|
|
10468
|
-
"group": "",
|
|
10469
|
-
"amis": {
|
|
10470
|
-
"hidden": true,
|
|
10471
|
-
"required": false
|
|
10472
|
-
}
|
|
10473
|
-
},
|
|
10474
|
-
"scrolling_mode": {
|
|
10475
|
-
"group": "",
|
|
10476
|
-
"amis": {
|
|
10477
|
-
"hidden": true,
|
|
10478
|
-
"required": false
|
|
10479
|
-
}
|
|
10480
|
-
},
|
|
10481
|
-
"sort": {
|
|
10482
|
-
"group": "",
|
|
10483
|
-
"amis": {
|
|
10484
|
-
"hidden": true,
|
|
10485
|
-
"required": false
|
|
10486
|
-
}
|
|
10487
|
-
},
|
|
10488
|
-
"show_count": {
|
|
10489
|
-
"group": "",
|
|
10490
|
-
"amis": {
|
|
10491
|
-
"hidden": true,
|
|
10492
|
-
"required": false
|
|
10493
|
-
}
|
|
10494
|
-
},
|
|
10495
|
-
"type": {
|
|
10496
|
-
"group": "",
|
|
10497
|
-
"amis": {
|
|
10498
|
-
"hidden": true,
|
|
10499
|
-
"required": false
|
|
10500
|
-
}
|
|
10501
|
-
},
|
|
10502
|
-
"shared": {
|
|
10503
|
-
"group": "",
|
|
10504
|
-
"amis": {
|
|
10505
|
-
"visibleOn": "${false}"
|
|
10506
|
-
}
|
|
10507
|
-
},
|
|
10508
|
-
"shared_to": {
|
|
10509
|
-
"group": "",
|
|
10510
|
-
"amis":{
|
|
10511
|
-
"type": "radios",
|
|
10512
|
-
"inline": false
|
|
10513
|
-
}
|
|
10514
|
-
},
|
|
10515
|
-
"shared_to_organizations": {
|
|
10516
|
-
"group": ""
|
|
10517
|
-
},
|
|
10518
|
-
"filters": {
|
|
10519
|
-
"group": "",
|
|
10520
|
-
"amis": {
|
|
10521
|
-
"hidden": true
|
|
11021
|
+
"valign": "middle",
|
|
11022
|
+
"columns": [
|
|
11023
|
+
{
|
|
11024
|
+
"body": [
|
|
11025
|
+
{
|
|
11026
|
+
"type": "grid",
|
|
11027
|
+
"valign": "middle",
|
|
11028
|
+
"className": "flex justify-between",
|
|
11029
|
+
"columns": [
|
|
11030
|
+
{
|
|
11031
|
+
"body": {
|
|
11032
|
+
"type": "tpl",
|
|
11033
|
+
"className": "block",
|
|
11034
|
+
// "tpl": `<img class=\"slds-icon_small slds-icon_container slds-icon-standard-${standardIcon}\" src=\"\${context.rootUrl}/unpkg.com/@salesforce-ux/design-system/assets/icons/standard/${icon}.svg\" />`
|
|
11035
|
+
"tpl":`<svg class="w-6 h-6 slds-icon slds-icon_container slds-icon-standard-${standardIcon}" aria-hidden="true"><use xlink:href="/assets/icons/standard-sprite/svg/symbols.svg#${icon}"></use></svg>`
|
|
11036
|
+
},
|
|
11037
|
+
"md": "auto",
|
|
11038
|
+
"className": "",
|
|
11039
|
+
"columnClassName": "flex justify-center items-center"
|
|
11040
|
+
},
|
|
11041
|
+
{
|
|
11042
|
+
"body": [
|
|
11043
|
+
{
|
|
11044
|
+
"type": "tpl",
|
|
11045
|
+
"tpl": `<a class="text-black text-base font-bold hover:font-bold" href="/app/\${appId}/\${_master.objectName}/\${_master.recordId}/\${objectName}/grid?related_field_name=\${relatedKey}">${relatedLabel}(\${$count})</a>`,
|
|
11046
|
+
"inline": false,
|
|
11047
|
+
"wrapperComponent": "",
|
|
11048
|
+
"className": "",
|
|
11049
|
+
}
|
|
11050
|
+
],
|
|
11051
|
+
"md": "",
|
|
11052
|
+
"valign": "middle",
|
|
11053
|
+
"columnClassName": "p-l-xs"
|
|
11054
|
+
}
|
|
11055
|
+
]
|
|
11056
|
+
}
|
|
11057
|
+
],
|
|
11058
|
+
"md": "auto"
|
|
11059
|
+
},
|
|
11060
|
+
{
|
|
11061
|
+
"body": {
|
|
11062
|
+
"type": "flex",
|
|
11063
|
+
"items": amisButtonsSchema,
|
|
11064
|
+
},
|
|
11065
|
+
"md": "auto"
|
|
11066
|
+
}
|
|
11067
|
+
],
|
|
11068
|
+
"className": "flex justify-between min-h-8 items-center"
|
|
10522
11069
|
}
|
|
10523
|
-
|
|
10524
|
-
|
|
11070
|
+
],
|
|
11071
|
+
"className": "steedos-record-related-header py-2 px-3 bg-gray-50 border rounded"
|
|
11072
|
+
};
|
|
11073
|
+
return recordRelatedListHeader;
|
|
11074
|
+
}
|
|
11075
|
+
|
|
11076
|
+
/**
|
|
11077
|
+
* 点击记录详细界面相关表顶部标题进入的相关表页面的顶部amisSchema
|
|
11078
|
+
* @param {*} objectSchema
|
|
11079
|
+
* @param {*} recordId
|
|
11080
|
+
* @param {*} relatedObjectName
|
|
11081
|
+
* @returns amisSchema
|
|
11082
|
+
*/
|
|
11083
|
+
async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
|
|
10525
11084
|
}
|
|
10526
11085
|
|
|
10527
11086
|
const getCopyListviewButtonSchema = ()=>{
|
|
@@ -11489,6 +12048,10 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
11489
12048
|
// const scope = event.context.scoped;
|
|
11490
12049
|
// 如果点击过顶部搜索栏表单的取消按钮,会把此处event.data.__super.__super.__super中的搜索表单项的所有字段设置为null
|
|
11491
12050
|
// 点击取消按钮后继续在表单项中输入过滤条件且最后没有点击回车按键或点击表单项搜索按钮的话,在快速搜索中点击回车按钮提交搜索会所顶部搜索表单中的字段值清空
|
|
12051
|
+
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
12052
|
+
if(!filterForm){
|
|
12053
|
+
return;
|
|
12054
|
+
}
|
|
11492
12055
|
let isLookup = event.data.isLookup;
|
|
11493
12056
|
let __lookupField = event.data.__lookupField;
|
|
11494
12057
|
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
@@ -11499,9 +12062,8 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
11499
12062
|
}
|
|
11500
12063
|
__changedFilterFormValuesKey += lookupTag;
|
|
11501
12064
|
}
|
|
11502
|
-
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
11503
12065
|
setTimeout(function(){
|
|
11504
|
-
filterForm.setValues(event.data[__changedFilterFormValuesKey]);
|
|
12066
|
+
filterForm && filterForm.setValues(event.data[__changedFilterFormValuesKey]);
|
|
11505
12067
|
}, 500);
|
|
11506
12068
|
`;
|
|
11507
12069
|
|
|
@@ -12166,6 +12728,8 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
12166
12728
|
//将_display放入crud的columns的倒数第二列中(最后一列会影响固定列),可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
12167
12729
|
body.columns.splice(body.columns.length -1 , 0, {name: '_display',type: 'static', width: 1, placeholder: "",id: objectSchema.name + "_display_${_index}", tpl: "${''}"});
|
|
12168
12730
|
}
|
|
12731
|
+
// 去除数组中的异常值,如null,undefined等
|
|
12732
|
+
body.columns = _$1__default["default"].compact(body.columns);
|
|
12169
12733
|
|
|
12170
12734
|
if (defaults) {
|
|
12171
12735
|
const headerSchema = defaults.headerSchema;
|
|
@@ -13302,15 +13866,15 @@ async function getListSchema(
|
|
|
13302
13866
|
async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
|
|
13303
13867
|
let fields = [];
|
|
13304
13868
|
for (const column of columns) {
|
|
13869
|
+
let columnField, fieldName, displayName, filedInfo, rfUiSchema, rfFieldInfo;
|
|
13305
13870
|
if (_$1.isString(column)) {
|
|
13306
|
-
let columnField;
|
|
13307
13871
|
if (column.indexOf('.') > 0) {
|
|
13308
|
-
|
|
13309
|
-
|
|
13310
|
-
|
|
13872
|
+
fieldName = column.split('.')[0];
|
|
13873
|
+
displayName = column.split('.')[1];
|
|
13874
|
+
filedInfo = uiSchema.fields[fieldName];
|
|
13311
13875
|
if (filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && _$1.isString(filedInfo.reference_to)) {
|
|
13312
|
-
|
|
13313
|
-
|
|
13876
|
+
rfUiSchema = await getUISchema(filedInfo.reference_to);
|
|
13877
|
+
rfFieldInfo = rfUiSchema.fields[displayName];
|
|
13314
13878
|
columnField = Object.assign({}, rfFieldInfo, { name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: { fieldName, displayName } }, ctx);
|
|
13315
13879
|
}else if(filedInfo && filedInfo.type === 'object'){
|
|
13316
13880
|
columnField = uiSchema.fields[column];
|
|
@@ -13334,14 +13898,13 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
|
|
|
13334
13898
|
}
|
|
13335
13899
|
|
|
13336
13900
|
} else if (_$1.isObject(column)) {
|
|
13337
|
-
let columnField;
|
|
13338
13901
|
if (column.field.indexOf('.') > 0) {
|
|
13339
|
-
|
|
13340
|
-
|
|
13341
|
-
|
|
13902
|
+
fieldName = column.field.split('.')[0];
|
|
13903
|
+
displayName = column.field.split('.')[1];
|
|
13904
|
+
filedInfo = uiSchema.fields[fieldName];
|
|
13342
13905
|
if (filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && _$1.isString(filedInfo.reference_to)) {
|
|
13343
|
-
|
|
13344
|
-
|
|
13906
|
+
rfUiSchema = await getUISchema(filedInfo.reference_to);
|
|
13907
|
+
rfFieldInfo = rfUiSchema.fields[displayName];
|
|
13345
13908
|
columnField = Object.assign({}, rfFieldInfo, ctx,
|
|
13346
13909
|
{ name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: { fieldName, displayName } },
|
|
13347
13910
|
{
|
|
@@ -13349,6 +13912,8 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
|
|
|
13349
13912
|
wrap: column.wrap // wrap = true 是没效果的
|
|
13350
13913
|
}
|
|
13351
13914
|
);
|
|
13915
|
+
} else if (filedInfo && filedInfo.type === 'object') {
|
|
13916
|
+
columnField = uiSchema.fields[column.field];
|
|
13352
13917
|
}
|
|
13353
13918
|
} else {
|
|
13354
13919
|
if (uiSchema.fields[column.field]) {
|
|
@@ -13483,7 +14048,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
13483
14048
|
};
|
|
13484
14049
|
const content = {
|
|
13485
14050
|
"type": "tabs",
|
|
13486
|
-
"className": "steedos-record-tabs bg-white p-4
|
|
14051
|
+
"className": "steedos-record-tabs bg-white p-4 sm:m-2 sm:border sm:rounded",
|
|
13487
14052
|
"contentClassName": "bg-none",
|
|
13488
14053
|
"tabs": [
|
|
13489
14054
|
detailed
|
|
@@ -14590,7 +15155,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
14590
15155
|
}
|
|
14591
15156
|
|
|
14592
15157
|
var fieldFilters = ${JSON.stringify(field.filters)};
|
|
14593
|
-
var currentAmis = amisRequire('amis');
|
|
15158
|
+
var currentAmis = (window.amisRequire && window.amisRequire('amis')) || Amis;
|
|
14594
15159
|
//递归fieldFilters数组,检查每一个元素,判断若是公式,就仅把它解析
|
|
14595
15160
|
function traverseNestedArray(arr) {
|
|
14596
15161
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -14601,7 +15166,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
14601
15166
|
// 如果当前元素不是数组,则处理该元素
|
|
14602
15167
|
// 下面正则用于匹配amis公式\${}
|
|
14603
15168
|
if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
|
|
14604
|
-
|
|
15169
|
+
try{
|
|
15170
|
+
arr[i] = currentAmis.evaluate(arr[i], api.context);
|
|
15171
|
+
}catch(ex){
|
|
15172
|
+
console.error("运行lookup过滤公式时出现错误:",ex);
|
|
15173
|
+
}
|
|
14605
15174
|
}
|
|
14606
15175
|
}
|
|
14607
15176
|
}
|
|
@@ -14762,8 +15331,8 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
14762
15331
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
14763
15332
|
const isCreate = _$1__namespace.isBoolean(field.create) ? field.create : true;
|
|
14764
15333
|
// lookup字段配置过滤条件就强制不显示新建按钮
|
|
14765
|
-
let
|
|
14766
|
-
if (isAllowCreate && isCreate && !
|
|
15334
|
+
let hasFilters = !_$1__namespace.isEmpty(field.filters) || !!field.filtersFunction || !!field._filtersFunction;
|
|
15335
|
+
if (isAllowCreate && isCreate && !hasFilters) {
|
|
14767
15336
|
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
14768
15337
|
new_button.align = "right";
|
|
14769
15338
|
// 保持快速搜索放在最左侧,新建按钮往里插,而不是push到最后
|
|
@@ -15007,7 +15576,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
15007
15576
|
// }
|
|
15008
15577
|
|
|
15009
15578
|
var fieldFilters = ${JSON.stringify(field.filters)};
|
|
15010
|
-
var currentAmis = amisRequire('amis');
|
|
15579
|
+
var currentAmis = (window.amisRequire && window.amisRequire('amis')) || Amis;
|
|
15011
15580
|
//递归fieldFilters数组,检查每一个元素,判断若是公式,就仅把它解析
|
|
15012
15581
|
function traverseNestedArray(arr) {
|
|
15013
15582
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -15018,7 +15587,11 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
15018
15587
|
// 如果当前元素不是数组,则处理该元素
|
|
15019
15588
|
// 下面正则用于匹配amis公式\${}
|
|
15020
15589
|
if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
|
|
15021
|
-
|
|
15590
|
+
try{
|
|
15591
|
+
arr[i] = currentAmis.evaluate(arr[i], api.context);
|
|
15592
|
+
}catch(ex){
|
|
15593
|
+
console.error("运行lookup过滤公式时出现错误:",ex);
|
|
15594
|
+
}
|
|
15022
15595
|
}
|
|
15023
15596
|
}
|
|
15024
15597
|
}
|
|
@@ -15430,8 +16003,8 @@ if(typeof window != 'undefined'){
|
|
|
15430
16003
|
/*
|
|
15431
16004
|
* @Author: baozhoutao@steedos.com
|
|
15432
16005
|
* @Date: 2023-01-13 17:27:54
|
|
15433
|
-
* @LastEditors:
|
|
15434
|
-
* @LastEditTime: 2024-
|
|
16006
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
16007
|
+
* @LastEditTime: 2024-06-07 13:39:34
|
|
15435
16008
|
* @Description:
|
|
15436
16009
|
*/
|
|
15437
16010
|
|
|
@@ -15468,6 +16041,7 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
|
|
|
15468
16041
|
"name": field.name,
|
|
15469
16042
|
"labelClassName": "none",
|
|
15470
16043
|
"language": "markdown",
|
|
16044
|
+
"options": field.amis ? field.amis.editorOptions : null
|
|
15471
16045
|
}
|
|
15472
16046
|
]
|
|
15473
16047
|
},
|
|
@@ -16124,6 +16698,21 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
16124
16698
|
type: getAmisStaticFieldType$1('url', readonly, field),
|
|
16125
16699
|
static: readonly ? true : false
|
|
16126
16700
|
};
|
|
16701
|
+
if(!readonly){
|
|
16702
|
+
// amis input-url控件不支持相对路径,这里支持下
|
|
16703
|
+
// 如果要使用amis原生input-url控件的默认的isUrl验证效果或自定义字段validations效果,配置字段的amis.validations属性即可,配置为null或空字符串则使用amis默认的isUrl效果
|
|
16704
|
+
let fieldAmisValidations = field.amis?.validations;
|
|
16705
|
+
if(typeof fieldAmisValidations === "undefined"){
|
|
16706
|
+
Object.assign(convertData, {
|
|
16707
|
+
"validations": {
|
|
16708
|
+
"matchRegexp": "^((http:\\/\\/|https:\\/\\/|ftp:\\/\\/|sftp:\\/\\/)+([^\\s\\/\\.]+(\\.[^\\s\\/\\.]+)+))*(\\/[^\\s\\.\\/]+)*$"
|
|
16709
|
+
},
|
|
16710
|
+
"validationErrors": {
|
|
16711
|
+
"matchRegexp": instance.t('frontend_form_validation_failed_url')//"URL 格式不正确"
|
|
16712
|
+
}
|
|
16713
|
+
});
|
|
16714
|
+
}
|
|
16715
|
+
}
|
|
16127
16716
|
if(readonly && field.show_as_qr){
|
|
16128
16717
|
convertData = {
|
|
16129
16718
|
type: "control",
|
|
@@ -16189,13 +16778,13 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
16189
16778
|
};
|
|
16190
16779
|
break;
|
|
16191
16780
|
case 'avatar':
|
|
16192
|
-
convertData = getAmisFileSchema(field, readonly);
|
|
16781
|
+
convertData = await getAmisFileSchema(field, readonly, ctx);
|
|
16193
16782
|
break;
|
|
16194
16783
|
case 'image':
|
|
16195
|
-
convertData = getAmisFileSchema(field, readonly);
|
|
16784
|
+
convertData = await getAmisFileSchema(field, readonly, ctx);
|
|
16196
16785
|
break;
|
|
16197
16786
|
case 'file':
|
|
16198
|
-
convertData = getAmisFileSchema(field, readonly);
|
|
16787
|
+
convertData = await getAmisFileSchema(field, readonly, ctx);
|
|
16199
16788
|
break;
|
|
16200
16789
|
case 'formula':
|
|
16201
16790
|
if(readonly){
|
|
@@ -16743,24 +17332,24 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
16743
17332
|
/*
|
|
16744
17333
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
16745
17334
|
* @Date: 2024-01-18 15:12:41
|
|
16746
|
-
* @LastEditors:
|
|
16747
|
-
* @LastEditTime: 2024-
|
|
17335
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
17336
|
+
* @LastEditTime: 2024-05-20 13:46:41
|
|
16748
17337
|
*/
|
|
16749
17338
|
/**
|
|
16750
17339
|
* 生成符合标准uuid格式的36位满足唯一性的随机串
|
|
16751
17340
|
* @returns uuid
|
|
16752
17341
|
*/
|
|
16753
17342
|
function uuidv4() {
|
|
16754
|
-
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, c
|
|
16755
|
-
(c ^ window.crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
|
16756
|
-
);
|
|
17343
|
+
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, function (c) {
|
|
17344
|
+
return (c ^ window.crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
|
|
17345
|
+
});
|
|
16757
17346
|
}
|
|
16758
17347
|
|
|
16759
17348
|
/*
|
|
16760
17349
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
16761
17350
|
* @Date: 2023-11-15 09:50:22
|
|
16762
17351
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
16763
|
-
* @LastEditTime: 2024-
|
|
17352
|
+
* @LastEditTime: 2024-06-14 06:31:33
|
|
16764
17353
|
*/
|
|
16765
17354
|
|
|
16766
17355
|
/**
|
|
@@ -16979,7 +17568,8 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
16979
17568
|
return {
|
|
16980
17569
|
"type": "steedos-field",
|
|
16981
17570
|
"config": Object.assign({}, field, {
|
|
16982
|
-
label: false
|
|
17571
|
+
label: false,
|
|
17572
|
+
description: null
|
|
16983
17573
|
}),
|
|
16984
17574
|
// quickEdit: {
|
|
16985
17575
|
// "type": "steedos-field",
|
|
@@ -16996,7 +17586,8 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
16996
17586
|
return {
|
|
16997
17587
|
"type": "steedos-field",
|
|
16998
17588
|
"config": Object.assign({}, field, {
|
|
16999
|
-
label: false
|
|
17589
|
+
label: false,
|
|
17590
|
+
description: null
|
|
17000
17591
|
}),
|
|
17001
17592
|
inInputTable: true,
|
|
17002
17593
|
"static": true,
|
|
@@ -17830,6 +18421,7 @@ async function getButtonActions(props, mode) {
|
|
|
17830
18421
|
"__parentForm": mode == "new" ? "$$" : parentFormData,
|
|
17831
18422
|
"_master": "${_master}",
|
|
17832
18423
|
"global": "${global}",
|
|
18424
|
+
"context": "${context}",
|
|
17833
18425
|
"uiSchema": "${uiSchema}",
|
|
17834
18426
|
"index": "${index}",//amis组件自带行索引,在节点嵌套情况下,当前节点如果是children属性下的子节点时,这里的index是当前节点在children中的索引,而不是外层父节点的index
|
|
17835
18427
|
"parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
@@ -17954,6 +18546,7 @@ async function getButtonActions(props, mode) {
|
|
|
17954
18546
|
"__parentForm": parentFormData,
|
|
17955
18547
|
"_master": "${_master}",
|
|
17956
18548
|
"global": "${global}",
|
|
18549
|
+
"context": "${context}",
|
|
17957
18550
|
"uiSchema": "${uiSchema}",
|
|
17958
18551
|
"index": "${index}",
|
|
17959
18552
|
"parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
@@ -18240,7 +18833,8 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
18240
18833
|
}
|
|
18241
18834
|
return value;
|
|
18242
18835
|
},
|
|
18243
|
-
"required": props.required
|
|
18836
|
+
"required": props.required,
|
|
18837
|
+
"description": props.description
|
|
18244
18838
|
};
|
|
18245
18839
|
if (buttonsForColumnOperations.length) {
|
|
18246
18840
|
inputTableSchema.columns.unshift({
|
|
@@ -21111,6 +21705,7 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
|
|
|
21111
21705
|
setUISchemaFunction: setUISchemaFunction,
|
|
21112
21706
|
setVariable: setVariable,
|
|
21113
21707
|
standardButtonsTodo: standardButtonsTodo,
|
|
21708
|
+
uuidv4: uuidv4,
|
|
21114
21709
|
i18next: instance
|
|
21115
21710
|
});
|
|
21116
21711
|
|
|
@@ -21388,7 +21983,12 @@ var SteedosDropdownButton = function (props) {
|
|
|
21388
21983
|
}
|
|
21389
21984
|
}
|
|
21390
21985
|
};
|
|
21391
|
-
return (React__default["default"].createElement(antd.Dropdown, { menu: { items: menu }, trigger: trigger, onOpenChange: onOpenChange, placement: placement, overlayClassName: overlayClassName, arrow: arrow
|
|
21986
|
+
return (React__default["default"].createElement(antd.Dropdown, { menu: { items: menu }, trigger: trigger, onOpenChange: onOpenChange, placement: placement, overlayClassName: overlayClassName, arrow: arrow, getPopupContainer: function (button) {
|
|
21987
|
+
// 未配置getPopupContainer属性时,默认container为body,这里判断到dropdown button是在drawer中时,统一把container配置为drawer本身
|
|
21988
|
+
// 这样就可以解决drawer内点击dropdown button组件下拉菜单中的按钮时不应该自动关闭drawer的问题
|
|
21989
|
+
var drawerBody = window.$(button).closest(".amis-dialog-widget .antd-Drawer-body")[0];
|
|
21990
|
+
return drawerBody || document.querySelector("body");
|
|
21991
|
+
} },
|
|
21392
21992
|
React__default["default"].createElement("button", { className: "slds-button slds-button_icon slds-button_icon-border-filled slds-button_icon-x-small ".concat(className ? className : '') },
|
|
21393
21993
|
React__default["default"].createElement("svg", { className: "w-4 h-4 fill-gray-500" },
|
|
21394
21994
|
React__default["default"].createElement("use", { xlinkHref: "/assets/icons/utility-sprite/svg/symbols.svg#down" })))));
|
|
@@ -21967,7 +22567,7 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
|
|
|
21967
22567
|
return __generator(this, function (_d) {
|
|
21968
22568
|
switch (_d.label) {
|
|
21969
22569
|
case 0:
|
|
21970
|
-
_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;
|
|
22570
|
+
_a = props.className, className = _a === void 0 ? 'sm:sticky top-0 sm:z-10 p-0 bg-gray-50' : _a, schemaFilter = props.schemaFilter, showButtons = props.showButtons, showBackButton = props.showBackButton;
|
|
21971
22571
|
return [4 /*yield*/, getUISchema(props.objectApiName || "space_users", false)];
|
|
21972
22572
|
case 1:
|
|
21973
22573
|
_d.sent();
|
|
@@ -21977,7 +22577,7 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
|
|
|
21977
22577
|
return [4 /*yield*/, getRecordDetailHeaderSchema(objectApiName, recordId, { showRecordTitle: showRecordTitle, formFactor: props.data.formFactor, showButtons: showButtons, showBackButton: showBackButton, display: props.data.display, _inDrawer: props.data._inDrawer })];
|
|
21978
22578
|
case 2:
|
|
21979
22579
|
schema = (_d.sent()).amisSchema;
|
|
21980
|
-
schema.className
|
|
22580
|
+
schema.className += " " + className;
|
|
21981
22581
|
config = Object.assign({}, schema, { onEvent: onEvent });
|
|
21982
22582
|
if (!(schemaFilter && typeof schemaFilter === 'string')) return [3 /*break*/, 6];
|
|
21983
22583
|
schemaFilterFun = new Function('config', 'props', schemaFilter);
|
|
@@ -22269,12 +22869,12 @@ var AmisProvider = function (props) { return __awaiter(void 0, void 0, void 0, f
|
|
|
22269
22869
|
/*
|
|
22270
22870
|
* @Author: baozhoutao@steedos.com
|
|
22271
22871
|
* @Date: 2022-09-01 14:44:57
|
|
22272
|
-
* @LastEditors:
|
|
22273
|
-
* @LastEditTime: 2024-
|
|
22872
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
22873
|
+
* @LastEditTime: 2024-05-14 15:12:49
|
|
22274
22874
|
* @Description:
|
|
22275
22875
|
*/
|
|
22276
22876
|
var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22277
|
-
var app, data, className, _a, showAppName, _b, appNameClassName, _c, customElements, _d, showAppIcon, formFactor, isMobile, on_click_script, mobile_blank_script, dialogSchema, badgeText;
|
|
22877
|
+
var app, data, className, _a, showAppName, _b, appNameClassName, _c, customElements, _d, showAppIcon, formFactor, isMobile, on_click_script, mobile_blank_script, convertAppVisibleOnScript, pcInitApiAdaptorScript, mobileInitApiAdaptorScript, dialogSchema, badgeText;
|
|
22278
22878
|
return __generator(this, function (_e) {
|
|
22279
22879
|
app = props.app, data = props.data, className = props.className, _a = props.showAppName, showAppName = _a === void 0 ? true : _a, _b = props.appNameClassName, appNameClassName = _b === void 0 ? '' : _b, _c = props.customElements, customElements = _c === void 0 ? [] : _c, _d = props.showAppIcon, showAppIcon = _d === void 0 ? true : _d;
|
|
22280
22880
|
if (!app) {
|
|
@@ -22284,6 +22884,9 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
22284
22884
|
isMobile = formFactor === "SMALL" ? true : false;
|
|
22285
22885
|
on_click_script = "\n var evalFunString = \"(function(){\" + event.data.on_click + \"})()\";\n try{\n eval(evalFunString);\n }\n catch(e){\n console.error(\"catch some error when eval the on_click script for app link:\");\n console.error(e.message + \"\\r\\n\" + e.stack);\n }\n ";
|
|
22286
22886
|
mobile_blank_script = "\n if(event.data.path[0] == \"/\"){\n Steedos.openWindow(event.data.context.rootUrl + event.data.path)\n }else{\n Steedos.openWindow(event.data.path)\n }\n ";
|
|
22887
|
+
convertAppVisibleOnScript = "\n var currentAmis = amisRequire('amis');\n app_items.forEach((item) => {\n let visible_on = item.visible_on && item.visible_on.trim();\n if(visible_on){\n // amis visibleOn\u5C5E\u6027\u4E2D\u7684\u8868\u8FBE\u5F0F\u6765\u81EA\u4F5C\u7528\u57DF\u4E2D\u53D8\u91CF\u65F6,amis\u4E0D\u8BA4,\u6240\u4EE5\u8FD9\u91CC\u628A\u516C\u5F0F\u8868\u8FBE\u5F0F\u63D0\u524D\u8FD0\u884C\u4E0B\n try{\n visible_on = currentAmis.evaluate(visible_on, BuilderAmisObject.AmisLib.createObject(context, item));\n item.visible_on = visible_on;\n }\n catch(ex){\n console.error(\"\u8FD0\u884C\u5E94\u7528\u201C\" + item.name + \"\u201D\u7684\u663E\u793A\u516C\u5F0F\u8868\u8FBE\u5F0F\u65F6\u51FA\u73B0\u9519\u8BEF:\",ex);\n item.visible_on = false;\n }\n }\n else{\n item.visible_on = true;\n }\n });\n ";
|
|
22888
|
+
pcInitApiAdaptorScript = "\n let app_items = payload;\n let object_items = [];\n let objects = [];\n app_items.forEach((item) => {\n item.children.forEach((i) => {\n if (objects.indexOf(i.id) < 0) {\n objects.push(i.id);\n if(i.type != 'url' && i.type != 'page'){object_items.push(i);}\n }\n })\n })\n ".concat(convertAppVisibleOnScript, "\n payload = {\n app_items,\n object_items\n }\n return payload;\n ");
|
|
22889
|
+
mobileInitApiAdaptorScript = "\n let app_items = payload;\n ".concat(convertAppVisibleOnScript, "\n payload = {\n app_items\n }\n return payload;\n ");
|
|
22287
22890
|
dialogSchema = {};
|
|
22288
22891
|
badgeText = "${IF(${id} == 'approve_workflow',${ss:keyvalues.badge.value|pick:'workflow'},${ss:keyvalues.badge.value|pick:${id}}) | toInt}";
|
|
22289
22892
|
if (isMobile) {
|
|
@@ -22344,6 +22947,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
22344
22947
|
]
|
|
22345
22948
|
}
|
|
22346
22949
|
},
|
|
22950
|
+
"visibleOn": "${visible_on}",
|
|
22347
22951
|
"className": "block w-1/3 py-4",
|
|
22348
22952
|
"style": {
|
|
22349
22953
|
"display": "inline-flex",
|
|
@@ -22363,7 +22967,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
22363
22967
|
"headers": {
|
|
22364
22968
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22365
22969
|
},
|
|
22366
|
-
"adaptor":
|
|
22970
|
+
"adaptor": mobileInitApiAdaptorScript,
|
|
22367
22971
|
"messages": {}
|
|
22368
22972
|
},
|
|
22369
22973
|
"onEvent": {
|
|
@@ -22412,63 +23016,64 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
22412
23016
|
{
|
|
22413
23017
|
"type": "each",
|
|
22414
23018
|
"name": "app_items",
|
|
22415
|
-
"items": {
|
|
22416
|
-
|
|
22417
|
-
|
|
22418
|
-
|
|
22419
|
-
|
|
22420
|
-
|
|
22421
|
-
|
|
22422
|
-
|
|
22423
|
-
|
|
22424
|
-
|
|
22425
|
-
|
|
22426
|
-
|
|
22427
|
-
|
|
22428
|
-
|
|
22429
|
-
|
|
22430
|
-
|
|
22431
|
-
|
|
22432
|
-
|
|
22433
|
-
|
|
22434
|
-
|
|
22435
|
-
|
|
23019
|
+
"items": [{
|
|
23020
|
+
"type": "button",
|
|
23021
|
+
"level": "link",
|
|
23022
|
+
"body": [{
|
|
23023
|
+
"type": "tpl",
|
|
23024
|
+
"tpl": "<div class='slds-app-launcher__tile slds-text-link_reset'><div class='slds-app-launcher__tile-figure'><svg class='w-12 h-12 slds-icon slds-icon_container slds-icon-standard-${REPLACE(icon, '_', '-')}' aria-hidden='true'><use xlink:href='/assets/icons/standard-sprite/svg/symbols.svg#${icon}'></use></svg><span class='slds-assistive-text'>${name}</span></div><div class='slds-app-launcher__tile-body'><span class='slds-link text-blue-600 text-lg'><span title='${name}'>${name}</span></span><div style='display: -webkit-box; -webkit-line-clamp: 1;-webkit-box-orient: vertical;overflow: hidden;'><span title='${description}'>${description}</span></div></div></div>",
|
|
23025
|
+
"badge": {
|
|
23026
|
+
"mode": "text",
|
|
23027
|
+
"text": badgeText,
|
|
23028
|
+
"visibleOn": badgeText,
|
|
23029
|
+
"className": "w-full",
|
|
23030
|
+
"overflowCount": 99,
|
|
23031
|
+
"style": {
|
|
23032
|
+
"top": "20px",
|
|
23033
|
+
"left": "37px",
|
|
23034
|
+
"height": "20px",
|
|
23035
|
+
"border-radius": "10px",
|
|
23036
|
+
"line-height": "18px",
|
|
23037
|
+
"margin-left": "${" + badgeText + ">9?(" + badgeText + ">99?'-21px':'-11px'):'0'}",
|
|
23038
|
+
"right": "auto",
|
|
23039
|
+
"font-size": "16px"
|
|
23040
|
+
}
|
|
22436
23041
|
}
|
|
22437
|
-
}
|
|
22438
|
-
|
|
22439
|
-
|
|
22440
|
-
|
|
22441
|
-
|
|
22442
|
-
|
|
22443
|
-
"actionType": "closeDialog"
|
|
22444
|
-
},
|
|
22445
|
-
{
|
|
22446
|
-
"actionType": "link",
|
|
22447
|
-
"args": {
|
|
22448
|
-
"link": "${path}"
|
|
23042
|
+
}],
|
|
23043
|
+
"onEvent": {
|
|
23044
|
+
"click": {
|
|
23045
|
+
"actions": [
|
|
23046
|
+
{
|
|
23047
|
+
"actionType": "closeDialog"
|
|
22449
23048
|
},
|
|
22450
|
-
|
|
22451
|
-
|
|
22452
|
-
|
|
22453
|
-
|
|
22454
|
-
|
|
22455
|
-
"
|
|
22456
|
-
"blank": true
|
|
23049
|
+
{
|
|
23050
|
+
"actionType": "link",
|
|
23051
|
+
"args": {
|
|
23052
|
+
"link": "${path}"
|
|
23053
|
+
},
|
|
23054
|
+
"expression": "${AND(!blank , !on_click)}"
|
|
22457
23055
|
},
|
|
22458
|
-
|
|
22459
|
-
|
|
22460
|
-
|
|
22461
|
-
|
|
22462
|
-
|
|
22463
|
-
|
|
22464
|
-
|
|
22465
|
-
|
|
22466
|
-
|
|
22467
|
-
|
|
22468
|
-
|
|
22469
|
-
|
|
22470
|
-
|
|
22471
|
-
|
|
23056
|
+
{
|
|
23057
|
+
"actionType": "url",
|
|
23058
|
+
"args": {
|
|
23059
|
+
"url": "${path}",
|
|
23060
|
+
"blank": true
|
|
23061
|
+
},
|
|
23062
|
+
"expression": "${AND(blank , !on_click)}"
|
|
23063
|
+
},
|
|
23064
|
+
{
|
|
23065
|
+
"actionType": "custom",
|
|
23066
|
+
"script": on_click_script,
|
|
23067
|
+
"expression": "${!!on_click}"
|
|
23068
|
+
}
|
|
23069
|
+
]
|
|
23070
|
+
}
|
|
23071
|
+
},
|
|
23072
|
+
"inline": true,
|
|
23073
|
+
"style": {},
|
|
23074
|
+
"visibleOn": "${visible_on}",
|
|
23075
|
+
"className": "slds-p-horizontal_small slds-size_1-of-1 slds-medium-size_1-of-3"
|
|
23076
|
+
}],
|
|
22472
23077
|
"className": "slds-grid slds-wrap slds-grid_pull-padded"
|
|
22473
23078
|
}
|
|
22474
23079
|
]
|
|
@@ -22558,7 +23163,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
22558
23163
|
"headers": {
|
|
22559
23164
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22560
23165
|
},
|
|
22561
|
-
"adaptor":
|
|
23166
|
+
"adaptor": pcInitApiAdaptorScript
|
|
22562
23167
|
}
|
|
22563
23168
|
};
|
|
22564
23169
|
}
|
|
@@ -22661,7 +23266,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
22661
23266
|
schemaApi: {
|
|
22662
23267
|
"method": "get",
|
|
22663
23268
|
"url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
|
|
22664
|
-
"adaptor": "\n try {\n // console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"").concat(data.tabId, "\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n })\n })\n } else {\n var tabGroup = _.find(tab_groups, {\"group_name\": groupName});\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": tabGroup && tabGroup.default_open != false,\n \"isGroup\": true,\n \"children\": _.sortBy(_.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n }\n }),(tab) => {return tab.index})\n }) \n }\n });\n \n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n });\n })\n }\n //\u4EE5\u4E0B\u4E3Anav\u7B2C\u4E00\u5C42\u6392\u5E8F\uFF0C\u5305\u62EC\u5206\u7EC4\u4E0E\u9009\u9879\u5361\n // let groupLength = ((payload.tab_groups && payload.tab_groups.length) || 0) + 1000;\n data.nav = _.sortBy(data.nav, function(tab){\n if(tab.isGroup){\n return _.findIndex(payload.tab_groups, function(group){\n return group.group_name === tab.label;\n });\n }else{\n // \u6CA1\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u6309index\u6392\u5217\u5728\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u524D\u65B9\n return (tab.index || 0) - 1000;\n }\n })\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav,\n \"keyvalues\": \"${ss:keyvalues}\"\n },\n \"id\": \"appMenuService\",\n \"onEvent\": {\n \"@data.changed.steedos_keyvalues\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"args\": {\n \"value\": {\n \"keyvalues\": \"${event.data.keyvalues}\"\n }\n }\n }\n ]\n }\n },\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n //\u5DE6\u5C42\u663E\u793A\u65F6\u5BA1\u6279\u5355\u663E\u793Abadge\u6570\u91CF\n \"itemBadge\": {\n \"mode\": \"text\",\n \"text\": \"").concat(badgeText, "\",\n \"visibleOn\": \"${id == 'instance_tasks'}\",\n \"overflowCount\": 99,\n \"style\": stacked?{\n \"right\": \"20%\",\n \"margin-right\": \"-23px\",\n \"height\": \"20px\",\n \"border-radius\": \"10px\",\n \"font-size\": \"16px\",\n \"line-height\": \"18px\",\n \"top\": \"50%\"\n }:{\n \"transform\": \"translate(calc(50% - 17px), calc(-50% + 10px))\",\n \"border-radius\": \"6.5px\",\n \"height\": \"15px\",\n \"line-height\": \"13px\",\n \"padding\": \"0px 4px\",\n \"font-size\": \"12px\"\n }\n },\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n // console.log('payload===2==>', payload)\n return payload;\n "),
|
|
23269
|
+
"adaptor": "\n try {\n // console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"").concat(data.tabId, "\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n tab.iconClass = (tab.icon || 'account').replaceAll('_', '-');\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='whitespace-normal leading-6 block no-underline group flex items-center text-[14px] rounded-md'><svg class=\"slds-icon_container slds-icon-standard-${ tab.iconClass } slds-icon !fill-white rounded-xl mr-2 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"searchKey\": tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n })\n })\n } else {\n var tabGroup = _.find(tab_groups, {\"group_name\": groupName});\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": tabGroup && tabGroup.default_open != false,\n \"isGroup\": true,\n \"children\": _.sortBy(_.map(tabs, (tab) => {\n tab.iconClass = (tab.icon || 'account').replaceAll('_', '-');\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='whitespace-normal leading-6 block no-underline group flex items-center text-[14px] rounded-md'><svg class=\"slds-icon_container slds-icon-standard-${ tab.iconClass } !fill-white slds-icon rounded-xl mr-2 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"searchKey\": tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n }\n }),(tab) => {return tab.index})\n }) \n }\n });\n \n }else{\n _.each(payload.children, (tab)=>{\n tab.iconClass = (tab.icon || 'account').replaceAll('_', '-');\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='whitespace-normal leading-6 block no-underline group flex items-center text-[14px] rounded-md'><svg class=\"slds-icon_container slds-icon-standard-${ tab.iconClass } slds-icon !fill-white rounded-xl mr-2 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"searchKey\": tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n });\n })\n }\n //\u4EE5\u4E0B\u4E3Anav\u7B2C\u4E00\u5C42\u6392\u5E8F\uFF0C\u5305\u62EC\u5206\u7EC4\u4E0E\u9009\u9879\u5361\n // let groupLength = ((payload.tab_groups && payload.tab_groups.length) || 0) + 1000;\n data.nav = _.sortBy(data.nav, function(tab){\n if(tab.isGroup){\n return _.findIndex(payload.tab_groups, function(group){\n return group.group_name === tab.label;\n });\n }else{\n // \u6CA1\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u6309index\u6392\u5217\u5728\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u524D\u65B9\n return (tab.index || 0) - 1000;\n }\n })\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav,\n \"keyvalues\": \"${ss:keyvalues}\"\n },\n \"id\": \"appMenuService\",\n \"onEvent\": {\n \"@data.changed.steedos_keyvalues\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"args\": {\n \"value\": {\n \"keyvalues\": \"${event.data.keyvalues}\"\n }\n }\n }\n ]\n }\n },\n \"body\":{\n \"type\": \"nav\",\n \"searchable\": ").concat(stacked, ",\n \"searchConfig\": {\n \"placeholder\": \"\u641C\u7D22\u83DC\u5355\",\n \"matchFunc\": \"return link.searchKey && link.searchKey.indexOf(keyword)>=0;\"\n },\n className: \"").concat(className, " text-black steedos-app-menu ").concat(stacked ? 'stacked' : '', "\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n //\u5DE6\u5C42\u663E\u793A\u65F6\u5BA1\u6279\u5355\u663E\u793Abadge\u6570\u91CF\n \"itemBadge\": {\n \"mode\": \"text\",\n \"text\": \"").concat(badgeText, "\",\n \"visibleOn\": \"${id == 'instance_tasks'}\",\n \"overflowCount\": 99,\n \"style\": stacked?{\n \"right\": \"20%\",\n \"margin-right\": \"-23px\",\n \"height\": \"20px\",\n \"border-radius\": \"10px\",\n \"font-size\": \"16px\",\n \"line-height\": \"18px\",\n \"top\": \"50%\"\n }:{\n \"transform\": \"translate(calc(50% - 17px), calc(-50% + 10px))\",\n \"border-radius\": \"6.5px\",\n \"height\": \"15px\",\n \"line-height\": \"13px\",\n \"padding\": \"0px 4px\",\n \"font-size\": \"12px\"\n }\n },\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n // console.log('payload===2==>', payload)\n return payload;\n "),
|
|
22665
23270
|
"headers": {
|
|
22666
23271
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22667
23272
|
}
|
|
@@ -22719,21 +23324,261 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22719
23324
|
"headers": {
|
|
22720
23325
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22721
23326
|
}
|
|
22722
|
-
}
|
|
22723
|
-
};
|
|
22724
|
-
}
|
|
22725
|
-
console.log("payload===>", schema);
|
|
22726
|
-
return [2 /*return*/, schema];
|
|
22727
|
-
});
|
|
22728
|
-
}); };
|
|
22729
|
-
|
|
22730
|
-
/*
|
|
22731
|
-
* @Author: baozhoutao@steedos.com
|
|
22732
|
-
* @Date: 2022-09-01 14:44:57
|
|
22733
|
-
* @LastEditors:
|
|
22734
|
-
* @LastEditTime: 2024-
|
|
22735
|
-
* @Description:
|
|
22736
|
-
*/
|
|
23327
|
+
}
|
|
23328
|
+
};
|
|
23329
|
+
}
|
|
23330
|
+
console.log("payload===>", schema);
|
|
23331
|
+
return [2 /*return*/, schema];
|
|
23332
|
+
});
|
|
23333
|
+
}); };
|
|
23334
|
+
|
|
23335
|
+
/*
|
|
23336
|
+
* @Author: baozhoutao@steedos.com
|
|
23337
|
+
* @Date: 2022-09-01 14:44:57
|
|
23338
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
23339
|
+
* @LastEditTime: 2024-05-29 11:45:57
|
|
23340
|
+
* @Description:
|
|
23341
|
+
*/
|
|
23342
|
+
var beforeMarkReadAllScript = "\n var hasUnRead = !!db.notifications.find({'$or':[{'is_read': null},{'is_read': false}]}).count();\n // \u6CA1\u6709\u8BA2\u9605\u5230\u672A\u8BFB\u901A\u77E5\u65F6\u9700\u8981\u989D\u5916\u5355\u72EC\u89E6\u53D1\u91CD\u65B0\u8BF7\u6C42\u901A\u77E5\u5217\u8868\u53CA\u672A\u8BFB\u6570\u91CF\n // \u5982\u679C\u6709\u8BA2\u9605\u5230\u7684\u8BDD\uFF0C\u56E0\u4E3A\u76D1\u542C\u8BA2\u9605\u5230\u7684\u901A\u77E5\u8BB0\u5F55\u53D8\u5316\uFF0C\u6709\u53D8\u5316\u4F1A\u89E6\u53D1@data.changed.notifications\u4E8B\u4EF6\uFF0C\u4ECE\u800C\u4F1A\u81EA\u52A8\u89E6\u53D1\u91CD\u65B0\u8BF7\u6C42\u901A\u77E5\u5217\u8868\u53CA\u672A\u8BFB\u6570\u91CF\n event.data.needToReload = !hasUnRead;\n";
|
|
23343
|
+
var getNotificationBadgeButton = function () {
|
|
23344
|
+
var isMobile = window.innerWidth < 768;
|
|
23345
|
+
var listContent = {
|
|
23346
|
+
"type": "page",
|
|
23347
|
+
"body": [
|
|
23348
|
+
{
|
|
23349
|
+
"type": "service",
|
|
23350
|
+
"className": "service-global-header-notifications-list",
|
|
23351
|
+
"body": [
|
|
23352
|
+
{
|
|
23353
|
+
"type": "panel",
|
|
23354
|
+
"title": instance.t('frontend_notifications'),
|
|
23355
|
+
"className": "steedos-header-toolbar-notifications-panel " + (isMobile ? "" : "min-w-[300px] max-w-md"),
|
|
23356
|
+
"body": [
|
|
23357
|
+
{
|
|
23358
|
+
"type": "each",
|
|
23359
|
+
"className": "overflow-auto max-h-96 steedos-header-toolbar-notifications-list",
|
|
23360
|
+
"name": "notifications",
|
|
23361
|
+
"items": {
|
|
23362
|
+
"type": "tpl",
|
|
23363
|
+
"tpl": "<div class='flex items-center p-4 hover:bg-sky-50'>\n <img src='<%=data.context.rootUrl + \"/avatar/\" + data.from%>' alt='' class='h-10 w-10 flex-none rounded-full'>\n <div class='ml-4 flex-auto'>\n <div class='font-medium'>\n <span class='text-primary'><%=data.name%></span>\n </div>\n <div class='mt-1 text-gray-700'>\n <%=data.body%>\n </div>\n <div class='mt-1 text-gray-700'>\n <%=moment(data.created).locale(data.global.user.language).fromNow()%>\n <abbr class='slds-text-link slds-m-horizontal_xxx-small <%=data.is_read ? 'hidden' : ''%>' title='unread'>\u25CF</abbr>\n </div>\n </div>\n </div>",
|
|
23364
|
+
"id": "u:07ece657c7b7",
|
|
23365
|
+
"onEvent": {
|
|
23366
|
+
"click": {
|
|
23367
|
+
"weight": 0,
|
|
23368
|
+
"actions": [
|
|
23369
|
+
{
|
|
23370
|
+
"args": {
|
|
23371
|
+
"options": {},
|
|
23372
|
+
"api": {
|
|
23373
|
+
"url": "${context.rootUrl}/api/v4/notifications/${_id}/read?rootUrl=&appId=${appId}&async=true",
|
|
23374
|
+
"method": "get",
|
|
23375
|
+
"messages": {},
|
|
23376
|
+
"headers": {
|
|
23377
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23378
|
+
},
|
|
23379
|
+
"adaptor": "payload = {\n status: 0,\n msg: '',\n data: {\n redirect: payload.redirect || payload \n }} \nreturn payload;"
|
|
23380
|
+
// "adaptor": notificationReadAdaptor
|
|
23381
|
+
}
|
|
23382
|
+
},
|
|
23383
|
+
"actionType": "ajax"
|
|
23384
|
+
},
|
|
23385
|
+
// {
|
|
23386
|
+
// "actionType": "custom",
|
|
23387
|
+
// "script": "if(Meteor.isCordova){window.open(Meteor.absoluteUrl(event.data.responseResult.responseData.redirect), '_blank')}else{window.open(event.data.responseResult.responseData.redirect, '_blank')}",
|
|
23388
|
+
// "expression": "${!!event.data.responseResult.responseData.redirect}",
|
|
23389
|
+
// },
|
|
23390
|
+
{
|
|
23391
|
+
// PC端保持原样,新窗口打开
|
|
23392
|
+
"actionType": "custom",
|
|
23393
|
+
"script": "window.open(event.data.responseResult.responseData.redirect, '_blank')",
|
|
23394
|
+
"expression": "${!!event.data.responseResult.responseData.redirect && window:innerWidth > 768}"
|
|
23395
|
+
},
|
|
23396
|
+
{
|
|
23397
|
+
// 手机端改为直接跳路由,因为新窗口打开顶部会显示url地址栏
|
|
23398
|
+
"actionType": "link",
|
|
23399
|
+
"args": {
|
|
23400
|
+
"link": "${redirect}"
|
|
23401
|
+
},
|
|
23402
|
+
"expression": "${!!event.data.responseResult.responseData.redirect && window:innerWidth <= 768}"
|
|
23403
|
+
},
|
|
23404
|
+
{
|
|
23405
|
+
"actionType": "cancel",
|
|
23406
|
+
"componentId": "steedos_header_toolbar_notifications_dialog",
|
|
23407
|
+
"expression": "${!!event.data.responseResult.responseData.redirect && window:innerWidth <= 768}"
|
|
23408
|
+
}
|
|
23409
|
+
]
|
|
23410
|
+
}
|
|
23411
|
+
}
|
|
23412
|
+
},
|
|
23413
|
+
"id": "u:18da41dab9ca"
|
|
23414
|
+
},
|
|
23415
|
+
],
|
|
23416
|
+
actions: [
|
|
23417
|
+
{
|
|
23418
|
+
"type": "button",
|
|
23419
|
+
"label": instance.t('frontend_notifications_close_dialog'),
|
|
23420
|
+
"visibleOn": "${window:innerWidth <= 768}",
|
|
23421
|
+
"close": true
|
|
23422
|
+
},
|
|
23423
|
+
{
|
|
23424
|
+
"type": "button",
|
|
23425
|
+
"label": instance.t('frontend_notifications_allread'),
|
|
23426
|
+
"id": "u:5530f3779e3a",
|
|
23427
|
+
"onEvent": {
|
|
23428
|
+
"click": {
|
|
23429
|
+
"actions": [
|
|
23430
|
+
{
|
|
23431
|
+
"actionType": "custom",
|
|
23432
|
+
"script": beforeMarkReadAllScript
|
|
23433
|
+
},
|
|
23434
|
+
{
|
|
23435
|
+
"componentId": "",
|
|
23436
|
+
"args": {
|
|
23437
|
+
"api": {
|
|
23438
|
+
"url": "${context.rootUrl}/api/v4/notifications/all/markReadAll",
|
|
23439
|
+
"method": "post",
|
|
23440
|
+
"headers": {
|
|
23441
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23442
|
+
}
|
|
23443
|
+
},
|
|
23444
|
+
"messages": {
|
|
23445
|
+
"success": instance.t('frontend_notifications_allread_message')
|
|
23446
|
+
}
|
|
23447
|
+
},
|
|
23448
|
+
"actionType": "ajax"
|
|
23449
|
+
},
|
|
23450
|
+
{
|
|
23451
|
+
"componentId": "service_global_header_notifications_unread_count",
|
|
23452
|
+
"actionType": "reload",
|
|
23453
|
+
"expression": "${needToReload}"
|
|
23454
|
+
},
|
|
23455
|
+
{
|
|
23456
|
+
"componentId": "service_global_header_notifications_list",
|
|
23457
|
+
"actionType": "reload",
|
|
23458
|
+
"expression": "${needToReload}"
|
|
23459
|
+
}
|
|
23460
|
+
],
|
|
23461
|
+
"weight": 0
|
|
23462
|
+
}
|
|
23463
|
+
}
|
|
23464
|
+
}
|
|
23465
|
+
]
|
|
23466
|
+
},
|
|
23467
|
+
],
|
|
23468
|
+
"id": "service_global_header_notifications_list",
|
|
23469
|
+
"onEvent": {
|
|
23470
|
+
"@data.changed.notifications": {
|
|
23471
|
+
"actions": [
|
|
23472
|
+
{
|
|
23473
|
+
"actionType": "reload"
|
|
23474
|
+
}
|
|
23475
|
+
]
|
|
23476
|
+
}
|
|
23477
|
+
},
|
|
23478
|
+
"messages": {},
|
|
23479
|
+
"api": {
|
|
23480
|
+
"method": "post",
|
|
23481
|
+
"url": "${context.rootUrl}/graphql",
|
|
23482
|
+
"data": {
|
|
23483
|
+
"&": "$$",
|
|
23484
|
+
"context": "${context}",
|
|
23485
|
+
"userId": "${context.userId}"
|
|
23486
|
+
},
|
|
23487
|
+
"dataType": "json",
|
|
23488
|
+
"requestAdaptor": "const { userId } = api.data;\napi.data = {\n query: `{\n notifications(filters: [\"owner\",\"=\",\"${userId}\"], sort: \"created desc,name\", top : 10){\n _id,name,body,related_to,related_name,url,owner,is_read,from,created\n } }`\n}",
|
|
23489
|
+
"headers": {
|
|
23490
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23491
|
+
},
|
|
23492
|
+
"adaptor": "return payload.data"
|
|
23493
|
+
},
|
|
23494
|
+
}
|
|
23495
|
+
],
|
|
23496
|
+
"onEvent": {
|
|
23497
|
+
"init": {
|
|
23498
|
+
"actions": [
|
|
23499
|
+
{
|
|
23500
|
+
"actionType": "custom",
|
|
23501
|
+
"script": "window.$('.service-global-header-notifications-list').closest('.amis-dialog-widget').addClass('steedos-header-toolbar-notifications-dialog');"
|
|
23502
|
+
}
|
|
23503
|
+
]
|
|
23504
|
+
}
|
|
23505
|
+
},
|
|
23506
|
+
"bodyClassName": "p-0"
|
|
23507
|
+
};
|
|
23508
|
+
var badgeButtonContent = {
|
|
23509
|
+
"type": "service",
|
|
23510
|
+
"body": [
|
|
23511
|
+
{
|
|
23512
|
+
"type": "steedos-badge",
|
|
23513
|
+
"body": [
|
|
23514
|
+
{
|
|
23515
|
+
"type": "steedos-icon",
|
|
23516
|
+
"category": "utility",
|
|
23517
|
+
"name": "notification",
|
|
23518
|
+
"colorVariant": "default",
|
|
23519
|
+
"className": "slds-button_icon slds-global-header__icon"
|
|
23520
|
+
}
|
|
23521
|
+
],
|
|
23522
|
+
"count": "${unReadCount}"
|
|
23523
|
+
},
|
|
23524
|
+
],
|
|
23525
|
+
"id": "service_global_header_notifications_unread_count",
|
|
23526
|
+
"messages": {},
|
|
23527
|
+
"api": {
|
|
23528
|
+
"method": "post",
|
|
23529
|
+
"url": "${context.rootUrl}/graphql",
|
|
23530
|
+
"data": {
|
|
23531
|
+
"&": "$$",
|
|
23532
|
+
"context": "${context}",
|
|
23533
|
+
"userId": "${context.userId}"
|
|
23534
|
+
},
|
|
23535
|
+
"dataType": "json",
|
|
23536
|
+
"requestAdaptor": "const { userId } = api.data;\napi.data = {\n query: `{\n unReadCount: notifications__count(filters: [[\"owner\",\"=\",\"${userId}\"], [\"is_read\", \"!=\", true]])\n }`\n}",
|
|
23537
|
+
"headers": {
|
|
23538
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23539
|
+
},
|
|
23540
|
+
"adaptor": "return payload.data"
|
|
23541
|
+
},
|
|
23542
|
+
"onEvent": {
|
|
23543
|
+
"@data.changed.notifications": {
|
|
23544
|
+
"actions": [
|
|
23545
|
+
{
|
|
23546
|
+
"actionType": "reload"
|
|
23547
|
+
}
|
|
23548
|
+
]
|
|
23549
|
+
}
|
|
23550
|
+
},
|
|
23551
|
+
// "interval": 30000,
|
|
23552
|
+
"silentPolling": true
|
|
23553
|
+
};
|
|
23554
|
+
return isMobile ? {
|
|
23555
|
+
"type": "button",
|
|
23556
|
+
"body": badgeButtonContent,
|
|
23557
|
+
"actionType": "dialog",
|
|
23558
|
+
"dialog": {
|
|
23559
|
+
"title": "",
|
|
23560
|
+
"id": "steedos_header_toolbar_notifications_dialog",
|
|
23561
|
+
"body": listContent,
|
|
23562
|
+
"actions": [],
|
|
23563
|
+
"showCloseButton": false,
|
|
23564
|
+
"closeOnOutside": true
|
|
23565
|
+
}
|
|
23566
|
+
} : {
|
|
23567
|
+
"type": "steedos-dropdown",
|
|
23568
|
+
"placement": "bottomRight",
|
|
23569
|
+
"trigger": [
|
|
23570
|
+
"click"
|
|
23571
|
+
],
|
|
23572
|
+
"body": [
|
|
23573
|
+
badgeButtonContent
|
|
23574
|
+
],
|
|
23575
|
+
"overlay": [
|
|
23576
|
+
listContent
|
|
23577
|
+
],
|
|
23578
|
+
"className": "antd-Action steedos-header-toolbar-notifications",
|
|
23579
|
+
"open": false
|
|
23580
|
+
};
|
|
23581
|
+
};
|
|
22737
23582
|
var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22738
23583
|
var _a, className, data, _b, logoutScript, _c, customButtons, avatarSrc;
|
|
22739
23584
|
var _d, _e;
|
|
@@ -22759,7 +23604,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
22759
23604
|
{
|
|
22760
23605
|
"componentId": "",
|
|
22761
23606
|
"args": {
|
|
22762
|
-
"url": "https://
|
|
23607
|
+
"url": "https://docs.steedos.com/zh-CN"
|
|
22763
23608
|
},
|
|
22764
23609
|
"actionType": "url"
|
|
22765
23610
|
}
|
|
@@ -22885,172 +23730,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
22885
23730
|
}
|
|
22886
23731
|
]
|
|
22887
23732
|
},
|
|
22888
|
-
|
|
22889
|
-
"type": "steedos-dropdown",
|
|
22890
|
-
"placement": "bottomRight",
|
|
22891
|
-
"trigger": [
|
|
22892
|
-
"click"
|
|
22893
|
-
],
|
|
22894
|
-
"body": [
|
|
22895
|
-
{
|
|
22896
|
-
"type": "service",
|
|
22897
|
-
"body": [
|
|
22898
|
-
{
|
|
22899
|
-
"type": "steedos-badge",
|
|
22900
|
-
"body": [
|
|
22901
|
-
{
|
|
22902
|
-
"type": "steedos-icon",
|
|
22903
|
-
"category": "utility",
|
|
22904
|
-
"name": "notification",
|
|
22905
|
-
"colorVariant": "default",
|
|
22906
|
-
"className": "slds-button_icon slds-global-header__icon"
|
|
22907
|
-
}
|
|
22908
|
-
],
|
|
22909
|
-
"count": "${unReadCount}"
|
|
22910
|
-
},
|
|
22911
|
-
],
|
|
22912
|
-
"id": "u:aba521eed5b7",
|
|
22913
|
-
"messages": {},
|
|
22914
|
-
"api": {
|
|
22915
|
-
"method": "post",
|
|
22916
|
-
"url": "${context.rootUrl}/graphql",
|
|
22917
|
-
"data": {
|
|
22918
|
-
"&": "$$",
|
|
22919
|
-
"context": "${context}",
|
|
22920
|
-
"userId": "${context.userId}"
|
|
22921
|
-
},
|
|
22922
|
-
"dataType": "json",
|
|
22923
|
-
"requestAdaptor": "const { userId } = api.data;\napi.data = {\n query: `{\n unReadCount: notifications__count(filters: [[\"owner\",\"=\",\"${userId}\"], [\"is_read\", \"!=\", true]])\n }`\n}",
|
|
22924
|
-
"headers": {
|
|
22925
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22926
|
-
},
|
|
22927
|
-
"adaptor": "return payload.data"
|
|
22928
|
-
},
|
|
22929
|
-
"onEvent": {
|
|
22930
|
-
"@data.changed.notifications": {
|
|
22931
|
-
"actions": [
|
|
22932
|
-
{
|
|
22933
|
-
"actionType": "reload"
|
|
22934
|
-
}
|
|
22935
|
-
]
|
|
22936
|
-
}
|
|
22937
|
-
},
|
|
22938
|
-
// "interval": 30000,
|
|
22939
|
-
"silentPolling": true
|
|
22940
|
-
}
|
|
22941
|
-
],
|
|
22942
|
-
"overlay": [
|
|
22943
|
-
{
|
|
22944
|
-
"type": "service",
|
|
22945
|
-
"body": [
|
|
22946
|
-
{
|
|
22947
|
-
"type": "panel",
|
|
22948
|
-
"title": instance.t('frontend_notifications'),
|
|
22949
|
-
"className": "min-w-[300px] max-w-md",
|
|
22950
|
-
"body": [
|
|
22951
|
-
{
|
|
22952
|
-
"type": "each",
|
|
22953
|
-
className: "overflow-auto max-h-96",
|
|
22954
|
-
"name": "notifications",
|
|
22955
|
-
"items": {
|
|
22956
|
-
"type": "tpl",
|
|
22957
|
-
"tpl": "<div class='flex items-center p-4 hover:bg-sky-50'>\n <img src='<%=data.context.rootUrl + \"/avatar/\" + data.from%>' alt='' class='h-10 w-10 flex-none rounded-full'>\n <div class='ml-4 flex-auto'>\n <div class='font-medium'>\n <span class='text-primary'><%=data.name%></span>\n </div>\n <div class='mt-1 text-gray-700'>\n <%=data.body%>\n </div>\n <div class='mt-1 text-gray-700'>\n <%=moment(data.created).locale(data.global.user.language).fromNow()%>\n <abbr class='slds-text-link slds-m-horizontal_xxx-small <%=data.is_read ? 'hidden' : ''%>' title='unread'>\u25CF</abbr>\n </div>\n </div>\n </div>",
|
|
22958
|
-
"id": "u:07ece657c7b7",
|
|
22959
|
-
"onEvent": {
|
|
22960
|
-
"click": {
|
|
22961
|
-
"weight": 0,
|
|
22962
|
-
"actions": [
|
|
22963
|
-
{
|
|
22964
|
-
"args": {
|
|
22965
|
-
"options": {},
|
|
22966
|
-
"api": {
|
|
22967
|
-
"url": "${context.rootUrl}/api/v4/notifications/${_id}/read?rootUrl=&appId=${appId}&async=true",
|
|
22968
|
-
"method": "get",
|
|
22969
|
-
"messages": {},
|
|
22970
|
-
"headers": {
|
|
22971
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22972
|
-
},
|
|
22973
|
-
"adaptor": "payload = {\n status: 0,\n msg: '',\n data: {\n redirect: payload.redirect || payload \n }} \nreturn payload;"
|
|
22974
|
-
}
|
|
22975
|
-
},
|
|
22976
|
-
"actionType": "ajax"
|
|
22977
|
-
},
|
|
22978
|
-
{
|
|
22979
|
-
"actionType": "custom",
|
|
22980
|
-
"script": "if(Meteor.isCordova){window.open(Meteor.absoluteUrl(event.data.responseResult.responseData.redirect), '_blank')}else{window.open(event.data.responseResult.responseData.redirect, '_blank')}",
|
|
22981
|
-
"expression": "${!!event.data.responseResult.responseData.redirect}",
|
|
22982
|
-
}
|
|
22983
|
-
]
|
|
22984
|
-
}
|
|
22985
|
-
}
|
|
22986
|
-
},
|
|
22987
|
-
"id": "u:18da41dab9ca"
|
|
22988
|
-
},
|
|
22989
|
-
],
|
|
22990
|
-
actions: [
|
|
22991
|
-
{
|
|
22992
|
-
"type": "button",
|
|
22993
|
-
"label": instance.t('frontend_notifications_allread'),
|
|
22994
|
-
"id": "u:5530f3779e3a",
|
|
22995
|
-
"onEvent": {
|
|
22996
|
-
"click": {
|
|
22997
|
-
"actions": [
|
|
22998
|
-
{
|
|
22999
|
-
"componentId": "",
|
|
23000
|
-
"args": {
|
|
23001
|
-
"api": {
|
|
23002
|
-
"url": "${context.rootUrl}/api/v4/notifications/all/markReadAll",
|
|
23003
|
-
"method": "post",
|
|
23004
|
-
"headers": {
|
|
23005
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23006
|
-
}
|
|
23007
|
-
},
|
|
23008
|
-
"messages": {
|
|
23009
|
-
"success": instance.t('frontend_notifications_allread_message')
|
|
23010
|
-
}
|
|
23011
|
-
},
|
|
23012
|
-
"actionType": "ajax"
|
|
23013
|
-
}
|
|
23014
|
-
],
|
|
23015
|
-
"weight": 0
|
|
23016
|
-
}
|
|
23017
|
-
}
|
|
23018
|
-
}
|
|
23019
|
-
]
|
|
23020
|
-
},
|
|
23021
|
-
],
|
|
23022
|
-
"id": "u:aba521eed5b7",
|
|
23023
|
-
"onEvent": {
|
|
23024
|
-
"@data.changed.notifications": {
|
|
23025
|
-
"actions": [
|
|
23026
|
-
{
|
|
23027
|
-
"actionType": "reload"
|
|
23028
|
-
}
|
|
23029
|
-
]
|
|
23030
|
-
}
|
|
23031
|
-
},
|
|
23032
|
-
"messages": {},
|
|
23033
|
-
"api": {
|
|
23034
|
-
"method": "post",
|
|
23035
|
-
"url": "${context.rootUrl}/graphql",
|
|
23036
|
-
"data": {
|
|
23037
|
-
"&": "$$",
|
|
23038
|
-
"context": "${context}",
|
|
23039
|
-
"userId": "${context.userId}"
|
|
23040
|
-
},
|
|
23041
|
-
"dataType": "json",
|
|
23042
|
-
"requestAdaptor": "const { userId } = api.data;\napi.data = {\n query: `{\n notifications(filters: [\"owner\",\"=\",\"${userId}\"], sort: \"created desc,name\", top : 10){\n _id,name,body,related_to,related_name,url,owner,is_read,from,created\n } }`\n}",
|
|
23043
|
-
"headers": {
|
|
23044
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23045
|
-
},
|
|
23046
|
-
"adaptor": "return payload.data"
|
|
23047
|
-
},
|
|
23048
|
-
}
|
|
23049
|
-
],
|
|
23050
|
-
"id": "u:857e8161c96b",
|
|
23051
|
-
"className": "antd-Action steedos-header-toolbar-notifications",
|
|
23052
|
-
"open": false
|
|
23053
|
-
},
|
|
23733
|
+
getNotificationBadgeButton(),
|
|
23054
23734
|
{
|
|
23055
23735
|
"type": "steedos-dropdown",
|
|
23056
23736
|
"placement": "bottomRight",
|
|
@@ -23361,7 +24041,7 @@ var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23361
24041
|
body: [
|
|
23362
24042
|
{
|
|
23363
24043
|
type: "wrapper",
|
|
23364
|
-
className: 'sidebar-wrapper px-0
|
|
24044
|
+
className: 'sidebar-wrapper px-0 py-3 pb-16 fixed z-20 h-full h-fill ease-in-out duration-300 flex flex-col border-r overflow-y-auto bg-gray-50 border-gray-200 block -translate-x-0 sm:w-[220px] w-64',
|
|
23365
24045
|
body: [
|
|
23366
24046
|
{
|
|
23367
24047
|
"type": "steedos-app-launcher",
|
|
@@ -23461,51 +24141,67 @@ function getAmisStaticFieldType(type, data_type, options) {
|
|
|
23461
24141
|
}
|
|
23462
24142
|
return type;
|
|
23463
24143
|
}
|
|
23464
|
-
|
|
23465
|
-
|
|
23466
|
-
|
|
23467
|
-
|
|
23468
|
-
|
|
23469
|
-
|
|
23470
|
-
|
|
23471
|
-
|
|
23472
|
-
|
|
23473
|
-
|
|
23474
|
-
|
|
23475
|
-
|
|
23476
|
-
|
|
23477
|
-
|
|
23478
|
-
|
|
23479
|
-
|
|
23480
|
-
|
|
23481
|
-
|
|
23482
|
-
"
|
|
23483
|
-
"
|
|
23484
|
-
"showBackButton": false,
|
|
23485
|
-
"showButtons": true,
|
|
23486
|
-
"data": {
|
|
23487
|
-
"_inDrawer": true,
|
|
23488
|
-
"recordLoaded": false, // 重置数据加载状态
|
|
23489
|
-
}
|
|
24144
|
+
function getLookupLinkOnClick(field, options) {
|
|
24145
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
24146
|
+
var recordPage, drawerRecordDetailSchema;
|
|
24147
|
+
return __generator(this, function (_a) {
|
|
24148
|
+
switch (_a.label) {
|
|
24149
|
+
case 0: return [4 /*yield*/, getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor })];
|
|
24150
|
+
case 1:
|
|
24151
|
+
recordPage = _a.sent();
|
|
24152
|
+
drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
|
|
24153
|
+
"recordId": "${value}",
|
|
24154
|
+
"data": __assign$2(__assign$2({}, recordPage.schema.data), { "_inDrawer": true, "recordLoaded": false })
|
|
24155
|
+
}) : {
|
|
24156
|
+
"type": "steedos-record-detail",
|
|
24157
|
+
"objectApiName": "${objectName}",
|
|
24158
|
+
"recordId": "${value}",
|
|
24159
|
+
"showBackButton": false,
|
|
24160
|
+
"showButtons": true,
|
|
24161
|
+
"data": {
|
|
24162
|
+
"_inDrawer": true,
|
|
24163
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
23490
24164
|
}
|
|
23491
|
-
|
|
23492
|
-
|
|
23493
|
-
|
|
23494
|
-
|
|
23495
|
-
|
|
24165
|
+
};
|
|
24166
|
+
return [2 /*return*/, {
|
|
24167
|
+
"click": {
|
|
24168
|
+
"actions": [
|
|
24169
|
+
{
|
|
24170
|
+
"actionType": "drawer",
|
|
24171
|
+
"drawer": {
|
|
24172
|
+
"type": "drawer",
|
|
24173
|
+
"title": " ",
|
|
24174
|
+
"headerClassName": "hidden",
|
|
24175
|
+
"size": "lg",
|
|
24176
|
+
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
24177
|
+
"closeOnEsc": true,
|
|
24178
|
+
"closeOnOutside": true,
|
|
24179
|
+
"resizable": true,
|
|
24180
|
+
"actions": [],
|
|
24181
|
+
"body": [
|
|
24182
|
+
drawerRecordDetailSchema
|
|
24183
|
+
],
|
|
24184
|
+
"className": "steedos-record-detail-drawer app-popover"
|
|
24185
|
+
},
|
|
24186
|
+
"preventDefault": true
|
|
24187
|
+
}
|
|
24188
|
+
]
|
|
24189
|
+
}
|
|
24190
|
+
}];
|
|
23496
24191
|
}
|
|
23497
|
-
|
|
23498
|
-
}
|
|
23499
|
-
}
|
|
24192
|
+
});
|
|
24193
|
+
});
|
|
24194
|
+
}
|
|
23500
24195
|
var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
23501
|
-
var steedosField, field, _a, readonly, _b, ctx, config, fStatic, env, inInputTable, className, lookupATagClick, defaultSource, source, fieldBaseProps, referenceTo_1, fieldValue, fieldRefObject, res, valueOptions_1, fieldValue, values, disPlayValue_1, schema, fieldSchema, fieldValue, hasImageOrFile_1, fieldHtml_1, schema, map, tableFields,
|
|
23502
|
-
var
|
|
23503
|
-
var
|
|
23504
|
-
return __generator(this, function (
|
|
23505
|
-
switch (
|
|
24196
|
+
var steedosField, field, _a, readonly, _b, ctx, config, fStatic, env, inInputTable, className, _c, appId, formFactor, lookupATagClick, defaultSource, source, fieldBaseProps, referenceTo_1, fieldValue, fieldRefObject, _d, _e, _f, _g, res, valueOptions_1, fieldValue, values, disPlayValue_1, _h, _j, _k, _l, schema, fieldSchema, fieldValue, hasImageOrFile_1, fieldHtml_1, schema, map, tableFields, _m, _o, subField, subFieldName, fieldAmis, schema, error_1;
|
|
24197
|
+
var _p, _q, _r, _s, _t, _u, _v, _w, _x, e_1, _y;
|
|
24198
|
+
var _z, _0, _1, _2, _3, _4;
|
|
24199
|
+
return __generator(this, function (_5) {
|
|
24200
|
+
switch (_5.label) {
|
|
23506
24201
|
case 0:
|
|
23507
24202
|
steedosField = null;
|
|
23508
24203
|
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;
|
|
24204
|
+
_c = props.data || {}, appId = _c.appId, formFactor = _c.formFactor;
|
|
23509
24205
|
// console.log(`AmisSteedosField`, props)
|
|
23510
24206
|
// if($schema.config && isString($schema.config)){
|
|
23511
24207
|
// $schema.config = JSON.parse($schema.config)
|
|
@@ -23533,10 +24229,10 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23533
24229
|
// 字段配置为只读,强制走fStatic模式,加上_display判断是为了不影响历史代码,比如直接在ObjectForm中调用steedos-field组件
|
|
23534
24230
|
fStatic = true;
|
|
23535
24231
|
}
|
|
23536
|
-
|
|
24232
|
+
_5.label = 1;
|
|
23537
24233
|
case 1:
|
|
23538
|
-
|
|
23539
|
-
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/,
|
|
24234
|
+
_5.trys.push([1, 31, , 32]);
|
|
24235
|
+
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/, 14];
|
|
23540
24236
|
lookupATagClick = 'onclick="return false;"';
|
|
23541
24237
|
if (window.innerWidth < 768) {
|
|
23542
24238
|
lookupATagClick = "";
|
|
@@ -23561,23 +24257,23 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23561
24257
|
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 ");
|
|
23562
24258
|
}
|
|
23563
24259
|
}
|
|
23564
|
-
source = ((
|
|
24260
|
+
source = ((_z = steedosField.amis) === null || _z === void 0 ? void 0 : _z.source) || ((_0 = steedosField.amis) === null || _0 === void 0 ? void 0 : _0.autoComplete) || defaultSource;
|
|
23565
24261
|
fieldBaseProps = {
|
|
23566
24262
|
multiple: steedosField.multiple,
|
|
23567
24263
|
name: steedosField.name,
|
|
23568
24264
|
label: steedosField.label,
|
|
23569
24265
|
static: true,
|
|
23570
24266
|
required: steedosField.required,
|
|
23571
|
-
className: "".concat(className || '', " ").concat(((
|
|
24267
|
+
className: "".concat(className || '', " ").concat(((_1 = steedosField.amis) === null || _1 === void 0 ? void 0 : _1.className) || '')
|
|
23572
24268
|
};
|
|
23573
24269
|
if (!inInputTable) return [3 /*break*/, 2];
|
|
23574
24270
|
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'select', source: source });
|
|
23575
|
-
return [3 /*break*/,
|
|
24271
|
+
return [3 /*break*/, 13];
|
|
23576
24272
|
case 2:
|
|
23577
24273
|
referenceTo_1 = steedosField.reference_to;
|
|
23578
|
-
if (!referenceTo_1) return [3 /*break*/,
|
|
24274
|
+
if (!referenceTo_1) return [3 /*break*/, 13];
|
|
23579
24275
|
if (_$1.isArray(referenceTo_1)) {
|
|
23580
|
-
fieldValue = (
|
|
24276
|
+
fieldValue = (_2 = props.data) === null || _2 === void 0 ? void 0 : _2[steedosField.name];
|
|
23581
24277
|
if (fieldValue && fieldValue.o) {
|
|
23582
24278
|
referenceTo_1 = fieldValue.o;
|
|
23583
24279
|
}
|
|
@@ -23591,150 +24287,188 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23591
24287
|
}
|
|
23592
24288
|
return [4 /*yield*/, getUISchema(referenceTo_1)];
|
|
23593
24289
|
case 3:
|
|
23594
|
-
fieldRefObject =
|
|
23595
|
-
if (!(props.data._display && _$1.has(props.data._display, steedosField.name))) return [3 /*break*/,
|
|
23596
|
-
|
|
24290
|
+
fieldRefObject = _5.sent();
|
|
24291
|
+
if (!(props.data._display && _$1.has(props.data._display, steedosField.name))) return [3 /*break*/, 7];
|
|
24292
|
+
_e = (_d = Object).assign;
|
|
24293
|
+
_f = [{}, fieldBaseProps];
|
|
24294
|
+
_p = {
|
|
23597
24295
|
type: 'control',
|
|
23598
|
-
name: null
|
|
23599
|
-
|
|
23600
|
-
|
|
23601
|
-
|
|
23602
|
-
|
|
23603
|
-
|
|
23604
|
-
|
|
23605
|
-
|
|
23606
|
-
|
|
23607
|
-
|
|
23608
|
-
|
|
23609
|
-
|
|
23610
|
-
|
|
23611
|
-
|
|
23612
|
-
|
|
23613
|
-
|
|
23614
|
-
|
|
23615
|
-
|
|
23616
|
-
|
|
23617
|
-
|
|
23618
|
-
|
|
23619
|
-
|
|
23620
|
-
|
|
23621
|
-
|
|
23622
|
-
|
|
23623
|
-
|
|
23624
|
-
|
|
23625
|
-
|
|
23626
|
-
|
|
23627
|
-
|
|
23628
|
-
{
|
|
23629
|
-
"type": "steedos-record-mini",
|
|
23630
|
-
"objectApiName": "${objectName}",
|
|
23631
|
-
"recordId": "${value}",
|
|
23632
|
-
"showButtons": false,
|
|
23633
|
-
"showBackButton": false,
|
|
23634
|
-
"data": {
|
|
23635
|
-
"objectName": "${objectName}",
|
|
23636
|
-
"recordId": "${value}",
|
|
23637
|
-
}
|
|
23638
|
-
}
|
|
23639
|
-
]
|
|
23640
|
-
} : null,
|
|
23641
|
-
onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
|
|
23642
|
-
}
|
|
23643
|
-
}
|
|
23644
|
-
]
|
|
24296
|
+
name: null
|
|
24297
|
+
};
|
|
24298
|
+
_q = {
|
|
24299
|
+
type: 'wrapper',
|
|
24300
|
+
className: "steedos-field-lookup-wrapper p-0",
|
|
24301
|
+
"wrapWithPanel": false,
|
|
24302
|
+
"actions": [],
|
|
24303
|
+
visibleOn: "${_display.".concat(steedosField.name, "}")
|
|
24304
|
+
};
|
|
24305
|
+
_r = {
|
|
24306
|
+
type: 'each',
|
|
24307
|
+
placeholder: "",
|
|
24308
|
+
className: "steedos-field-lookup-each flex flex-wrap gap-2",
|
|
24309
|
+
source: "${_display.".concat(steedosField.name, "|asArray}")
|
|
24310
|
+
};
|
|
24311
|
+
_s = {
|
|
24312
|
+
type: 'static',
|
|
24313
|
+
labelClassName: "hidden",
|
|
24314
|
+
label: false,
|
|
24315
|
+
className: 'm-0',
|
|
24316
|
+
tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\" ".concat(lookupATagClick, ">${label}</a>"),
|
|
24317
|
+
popOver: fieldRefObject.compactLayouts && window.innerWidth >= 768 ? {
|
|
24318
|
+
"trigger": "hover",
|
|
24319
|
+
"className": "steedos-record-detail-popover",
|
|
24320
|
+
"position": "left-bottom",
|
|
24321
|
+
"showIcon": false,
|
|
24322
|
+
"title": false,
|
|
24323
|
+
"offset": {
|
|
24324
|
+
"top": 0,
|
|
24325
|
+
"left": 20
|
|
23645
24326
|
},
|
|
23646
|
-
|
|
24327
|
+
"body": [
|
|
24328
|
+
{
|
|
24329
|
+
"type": "steedos-record-mini",
|
|
24330
|
+
"objectApiName": "${objectName}",
|
|
24331
|
+
"recordId": "${value}",
|
|
24332
|
+
"showButtons": false,
|
|
24333
|
+
"showBackButton": false,
|
|
24334
|
+
"data": {
|
|
24335
|
+
"objectName": "${objectName}",
|
|
24336
|
+
"recordId": "${value}",
|
|
24337
|
+
}
|
|
24338
|
+
}
|
|
24339
|
+
]
|
|
24340
|
+
} : null
|
|
24341
|
+
};
|
|
24342
|
+
if (!(window.innerWidth < 768)) return [3 /*break*/, 4];
|
|
24343
|
+
_g = null;
|
|
24344
|
+
return [3 /*break*/, 6];
|
|
24345
|
+
case 4: return [4 /*yield*/, getLookupLinkOnClick(steedosField, {
|
|
24346
|
+
appId: appId,
|
|
24347
|
+
objectName: referenceTo_1,
|
|
24348
|
+
formFactor: formFactor
|
|
24349
|
+
})];
|
|
24350
|
+
case 5:
|
|
24351
|
+
_g = _5.sent();
|
|
24352
|
+
_5.label = 6;
|
|
24353
|
+
case 6:
|
|
24354
|
+
fieldBaseProps = _e.apply(_d, _f.concat([(_p.body = [(_q.body = [
|
|
24355
|
+
(_r.items = (
|
|
24356
|
+
// onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
|
|
24357
|
+
_s.onEvent = _g,
|
|
24358
|
+
_s),
|
|
24359
|
+
_r)
|
|
24360
|
+
],
|
|
24361
|
+
_q), {
|
|
23647
24362
|
type: 'static',
|
|
23648
24363
|
tpl: '-',
|
|
23649
24364
|
className: "".concat(fieldBaseProps.className || '', " text-muted"),
|
|
23650
24365
|
hiddenOn: "${_display.".concat(steedosField.name, "}"),
|
|
23651
|
-
}]
|
|
23652
|
-
|
|
23653
|
-
return [3 /*break*/,
|
|
23654
|
-
case
|
|
23655
|
-
case
|
|
23656
|
-
res =
|
|
23657
|
-
valueOptions_1 = ((
|
|
23658
|
-
fieldValue = (
|
|
24366
|
+
}],
|
|
24367
|
+
_p)]));
|
|
24368
|
+
return [3 /*break*/, 13];
|
|
24369
|
+
case 7: return [4 /*yield*/, env.fetcher(source, props.data)];
|
|
24370
|
+
case 8:
|
|
24371
|
+
res = _5.sent();
|
|
24372
|
+
valueOptions_1 = ((_3 = res === null || res === void 0 ? void 0 : res.data) === null || _3 === void 0 ? void 0 : _3.options) || [];
|
|
24373
|
+
fieldValue = (_4 = props.data) === null || _4 === void 0 ? void 0 : _4[steedosField.name];
|
|
23659
24374
|
values = fieldValue;
|
|
23660
24375
|
if (_$1.isString(values)) {
|
|
23661
24376
|
values = [values];
|
|
23662
24377
|
}
|
|
23663
|
-
if (values && values.length > 0)
|
|
23664
|
-
|
|
23665
|
-
|
|
23666
|
-
|
|
23667
|
-
|
|
23668
|
-
|
|
23669
|
-
|
|
23670
|
-
|
|
23671
|
-
|
|
23672
|
-
|
|
23673
|
-
|
|
23674
|
-
|
|
23675
|
-
|
|
23676
|
-
|
|
23677
|
-
|
|
23678
|
-
|
|
23679
|
-
|
|
23680
|
-
|
|
23681
|
-
|
|
23682
|
-
|
|
23683
|
-
|
|
23684
|
-
|
|
23685
|
-
|
|
23686
|
-
|
|
23687
|
-
|
|
23688
|
-
|
|
23689
|
-
|
|
23690
|
-
|
|
23691
|
-
|
|
23692
|
-
|
|
23693
|
-
|
|
23694
|
-
|
|
23695
|
-
|
|
23696
|
-
|
|
23697
|
-
|
|
23698
|
-
|
|
23699
|
-
|
|
23700
|
-
|
|
23701
|
-
|
|
23702
|
-
|
|
23703
|
-
|
|
23704
|
-
|
|
23705
|
-
|
|
23706
|
-
|
|
23707
|
-
|
|
23708
|
-
|
|
23709
|
-
|
|
23710
|
-
|
|
23711
|
-
|
|
23712
|
-
|
|
23713
|
-
|
|
23714
|
-
|
|
23715
|
-
|
|
23716
|
-
|
|
23717
|
-
onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
|
|
23718
|
-
}
|
|
24378
|
+
if (!(values && values.length > 0)) return [3 /*break*/, 12];
|
|
24379
|
+
disPlayValue_1 = [];
|
|
24380
|
+
_$1.each(values, function (value) {
|
|
24381
|
+
var option = valueOptions_1.find(function (item) { return item.value === value; });
|
|
24382
|
+
if (option) {
|
|
24383
|
+
disPlayValue_1.push({
|
|
24384
|
+
objectName: referenceTo_1,
|
|
24385
|
+
value: option._id || option.value,
|
|
24386
|
+
label: option.label
|
|
24387
|
+
});
|
|
24388
|
+
}
|
|
24389
|
+
});
|
|
24390
|
+
_j = (_h = Object).assign;
|
|
24391
|
+
_k = [{}, fieldBaseProps];
|
|
24392
|
+
_t = { type: 'control', name: null };
|
|
24393
|
+
_u = {
|
|
24394
|
+
type: 'form',
|
|
24395
|
+
className: "steedos-field-lookup-wrapper p-0",
|
|
24396
|
+
"wrapWithPanel": false,
|
|
24397
|
+
"actions": [],
|
|
24398
|
+
data: (_v = {},
|
|
24399
|
+
_v[steedosField.name] = disPlayValue_1,
|
|
24400
|
+
_v)
|
|
24401
|
+
};
|
|
24402
|
+
_w = {
|
|
24403
|
+
type: 'each',
|
|
24404
|
+
placeholder: "",
|
|
24405
|
+
className: "steedos-field-lookup-each flex flex-wrap gap-2",
|
|
24406
|
+
source: "${".concat(steedosField.name, "}")
|
|
24407
|
+
};
|
|
24408
|
+
_x = {
|
|
24409
|
+
type: 'static',
|
|
24410
|
+
className: 'm-0',
|
|
24411
|
+
tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\" ".concat(lookupATagClick, ">${label}</a>"),
|
|
24412
|
+
popOver: fieldRefObject.compactLayouts && window.innerWidth >= 768 ? {
|
|
24413
|
+
"trigger": "hover",
|
|
24414
|
+
"className": "steedos-record-detail-popover",
|
|
24415
|
+
"position": "left-bottom",
|
|
24416
|
+
"showIcon": false,
|
|
24417
|
+
"title": false,
|
|
24418
|
+
"offset": {
|
|
24419
|
+
"top": 0,
|
|
24420
|
+
"left": 20
|
|
24421
|
+
},
|
|
24422
|
+
"body": [
|
|
24423
|
+
{
|
|
24424
|
+
"type": "steedos-record-mini",
|
|
24425
|
+
"objectApiName": "${objectName}",
|
|
24426
|
+
"recordId": "${value}",
|
|
24427
|
+
"showButtons": false,
|
|
24428
|
+
"showBackButton": false,
|
|
24429
|
+
"data": {
|
|
24430
|
+
"objectName": "${objectName}",
|
|
24431
|
+
"recordId": "${value}",
|
|
23719
24432
|
}
|
|
23720
|
-
|
|
23721
|
-
|
|
23722
|
-
|
|
23723
|
-
|
|
23724
|
-
|
|
23725
|
-
|
|
23726
|
-
|
|
23727
|
-
case
|
|
24433
|
+
}
|
|
24434
|
+
]
|
|
24435
|
+
} : null
|
|
24436
|
+
};
|
|
24437
|
+
if (!(window.innerWidth < 768)) return [3 /*break*/, 9];
|
|
24438
|
+
_l = null;
|
|
24439
|
+
return [3 /*break*/, 11];
|
|
24440
|
+
case 9: return [4 /*yield*/, getLookupLinkOnClick(steedosField, {
|
|
24441
|
+
appId: appId,
|
|
24442
|
+
objectName: referenceTo_1,
|
|
24443
|
+
formFactor: formFactor
|
|
24444
|
+
})];
|
|
24445
|
+
case 10:
|
|
24446
|
+
_l = _5.sent();
|
|
24447
|
+
_5.label = 11;
|
|
24448
|
+
case 11:
|
|
24449
|
+
fieldBaseProps = _j.apply(_h, _k.concat([(_t.body = (_u.body = [
|
|
24450
|
+
(_w.items = (
|
|
24451
|
+
// onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
|
|
24452
|
+
_x.onEvent = _l,
|
|
24453
|
+
_x),
|
|
24454
|
+
_w)
|
|
24455
|
+
],
|
|
24456
|
+
_u), _t)]));
|
|
24457
|
+
return [3 /*break*/, 13];
|
|
24458
|
+
case 12:
|
|
24459
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'static', tpl: '-', className: "".concat(fieldBaseProps.className || '', " text-muted") });
|
|
24460
|
+
_5.label = 13;
|
|
24461
|
+
case 13:
|
|
23728
24462
|
schema = Object.assign({}, fieldBaseProps, _$1.pick(steedosField.amis || {}, ['className', 'inline', 'label', 'labelAlign', 'name', 'labelRemark', 'description', 'placeholder', 'staticClassName', 'staticLabelClassName', 'staticInputClassName', 'staticSchema']));
|
|
23729
24463
|
schema.placeholder = "";
|
|
23730
24464
|
// console.log(`steedos field [lookup] schema:`, schema)
|
|
23731
24465
|
return [2 /*return*/, schema];
|
|
23732
|
-
case
|
|
23733
|
-
if (!fStatic) return [3 /*break*/,
|
|
23734
|
-
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/,
|
|
23735
|
-
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField,
|
|
23736
|
-
case
|
|
23737
|
-
fieldSchema =
|
|
24466
|
+
case 14:
|
|
24467
|
+
if (!fStatic) return [3 /*break*/, 28];
|
|
24468
|
+
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/, 16];
|
|
24469
|
+
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, true, ctx)];
|
|
24470
|
+
case 15:
|
|
24471
|
+
fieldSchema = _5.sent();
|
|
23738
24472
|
if (steedosField.type === 'file' && fieldSchema.disabled) {
|
|
23739
24473
|
fieldValue = fieldSchema.value;
|
|
23740
24474
|
if (fieldValue && fieldValue.length) {
|
|
@@ -23770,60 +24504,60 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23770
24504
|
}
|
|
23771
24505
|
}
|
|
23772
24506
|
return [2 /*return*/, fieldSchema];
|
|
23773
|
-
case
|
|
24507
|
+
case 16:
|
|
23774
24508
|
schema = Object.assign({}, steedosField, {
|
|
23775
24509
|
type: getAmisStaticFieldType(steedosField.type, steedosField.data_type, steedosField),
|
|
23776
24510
|
static: true,
|
|
23777
24511
|
label: steedosField.label
|
|
23778
24512
|
});
|
|
23779
|
-
if (!(steedosField.type === "time" || steedosField.type === "input-time-range")) return [3 /*break*/,
|
|
24513
|
+
if (!(steedosField.type === "time" || steedosField.type === "input-time-range")) return [3 /*break*/, 17];
|
|
23780
24514
|
Object.assign(schema, {
|
|
23781
24515
|
inputFormat: 'HH:mm',
|
|
23782
24516
|
timeFormat: 'HH:mm',
|
|
23783
24517
|
format: '1970-01-01THH:mm:00.000[Z]',
|
|
23784
24518
|
});
|
|
23785
|
-
return [3 /*break*/,
|
|
23786
|
-
case
|
|
23787
|
-
if (!(steedosField.type === "percent")) return [3 /*break*/,
|
|
24519
|
+
return [3 /*break*/, 27];
|
|
24520
|
+
case 17:
|
|
24521
|
+
if (!(steedosField.type === "percent")) return [3 /*break*/, 18];
|
|
23788
24522
|
Object.assign(schema, {
|
|
23789
24523
|
"percent": steedosField.scale ? steedosField.scale : true
|
|
23790
24524
|
});
|
|
23791
|
-
return [3 /*break*/,
|
|
23792
|
-
case
|
|
23793
|
-
if (!(steedosField.type === "password")) return [3 /*break*/,
|
|
24525
|
+
return [3 /*break*/, 27];
|
|
24526
|
+
case 18:
|
|
24527
|
+
if (!(steedosField.type === "password")) return [3 /*break*/, 19];
|
|
23794
24528
|
Object.assign(schema, {
|
|
23795
24529
|
"tpl": "******"
|
|
23796
24530
|
});
|
|
23797
|
-
return [3 /*break*/,
|
|
23798
|
-
case
|
|
23799
|
-
if (!(steedosField.type === "select")) return [3 /*break*/,
|
|
24531
|
+
return [3 /*break*/, 27];
|
|
24532
|
+
case 19:
|
|
24533
|
+
if (!(steedosField.type === "select")) return [3 /*break*/, 20];
|
|
23800
24534
|
map = getSelectMap(steedosField.options);
|
|
23801
24535
|
Object.assign(schema, {
|
|
23802
24536
|
"placeholder": "",
|
|
23803
24537
|
"map": map
|
|
23804
24538
|
});
|
|
23805
|
-
return [3 /*break*/,
|
|
23806
|
-
case
|
|
23807
|
-
if (!(steedosField.type === "color")) return [3 /*break*/,
|
|
24539
|
+
return [3 /*break*/, 27];
|
|
24540
|
+
case 20:
|
|
24541
|
+
if (!(steedosField.type === "color")) return [3 /*break*/, 21];
|
|
23808
24542
|
Object.assign(schema, {
|
|
23809
24543
|
"defaultColor": null
|
|
23810
24544
|
});
|
|
23811
|
-
return [3 /*break*/,
|
|
23812
|
-
case
|
|
23813
|
-
if (!(steedosField.type === "number" || steedosField.type === 'currency')) return [3 /*break*/,
|
|
24545
|
+
return [3 /*break*/, 27];
|
|
24546
|
+
case 21:
|
|
24547
|
+
if (!(steedosField.type === "number" || steedosField.type === 'currency')) return [3 /*break*/, 22];
|
|
23814
24548
|
// amis input-number和number组件中的precision表示小数位数,并不是魔方平台的精度概念,要转换下,否则小数点后会显示很多的0
|
|
23815
24549
|
Object.assign(schema, {
|
|
23816
24550
|
"precision": steedosField.scale || 0,
|
|
23817
24551
|
"kilobitSeparator": steedosField.enable_thousands //识别enable_thousands,控制千分位分隔符
|
|
23818
24552
|
});
|
|
23819
|
-
return [3 /*break*/,
|
|
23820
|
-
case
|
|
23821
|
-
if (!(steedosField.type === "table")) return [3 /*break*/,
|
|
24553
|
+
return [3 /*break*/, 27];
|
|
24554
|
+
case 22:
|
|
24555
|
+
if (!(steedosField.type === "table")) return [3 /*break*/, 23];
|
|
23822
24556
|
if (steedosField.subFields) {
|
|
23823
24557
|
tableFields = [];
|
|
23824
24558
|
try {
|
|
23825
|
-
for (
|
|
23826
|
-
subField =
|
|
24559
|
+
for (_m = __values(steedosField.subFields), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
24560
|
+
subField = _o.value;
|
|
23827
24561
|
if (!subField.name.endsWith(".$")) {
|
|
23828
24562
|
subFieldName = subField.name.replace("".concat(steedosField._prefix || '').concat(steedosField.name, ".$."), '').replace("".concat(steedosField.name, "."), '');
|
|
23829
24563
|
// const gridSub = await convertSFieldToAmisField(Object.assign({}, subField, {name: subFieldName, isTableField: true}), readonly, ctx);
|
|
@@ -23834,7 +24568,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23834
24568
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
23835
24569
|
finally {
|
|
23836
24570
|
try {
|
|
23837
|
-
if (
|
|
24571
|
+
if (_o && !_o.done && (_y = _m.return)) _y.call(_m);
|
|
23838
24572
|
}
|
|
23839
24573
|
finally { if (e_1) throw e_1.error; }
|
|
23840
24574
|
}
|
|
@@ -23850,9 +24584,9 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23850
24584
|
}
|
|
23851
24585
|
});
|
|
23852
24586
|
}
|
|
23853
|
-
return [3 /*break*/,
|
|
23854
|
-
case
|
|
23855
|
-
if (!(steedosField.type === "image")) return [3 /*break*/,
|
|
24587
|
+
return [3 /*break*/, 27];
|
|
24588
|
+
case 23:
|
|
24589
|
+
if (!(steedosField.type === "image")) return [3 /*break*/, 24];
|
|
23856
24590
|
Object.assign(schema, {
|
|
23857
24591
|
enlargeAble: true,
|
|
23858
24592
|
showToolbar: true,
|
|
@@ -23883,15 +24617,15 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23883
24617
|
return value;
|
|
23884
24618
|
}
|
|
23885
24619
|
});
|
|
23886
|
-
return [3 /*break*/,
|
|
23887
|
-
case
|
|
23888
|
-
if (!(steedosField.type === "file")) return [3 /*break*/,
|
|
23889
|
-
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField,
|
|
23890
|
-
case
|
|
24620
|
+
return [3 /*break*/, 27];
|
|
24621
|
+
case 24:
|
|
24622
|
+
if (!(steedosField.type === "file")) return [3 /*break*/, 26];
|
|
24623
|
+
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, true, ctx)];
|
|
24624
|
+
case 25:
|
|
23891
24625
|
// 附件static模式先保持原来的逻辑,依赖_display,审批王中相关功能在creator中
|
|
23892
24626
|
// convertSFieldToAmisField中会合并steedosField.amis,所以也不需要再次合并steedosField.amis,直接return就好
|
|
23893
|
-
return [2 /*return*/,
|
|
23894
|
-
case
|
|
24627
|
+
return [2 /*return*/, _5.sent()];
|
|
24628
|
+
case 26:
|
|
23895
24629
|
if (steedosField.type === 'formula' || steedosField.type === 'summary') {
|
|
23896
24630
|
if (steedosField.data_type === 'number' || steedosField.data_type === 'currency') {
|
|
23897
24631
|
Object.assign(schema, {
|
|
@@ -23952,11 +24686,11 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23952
24686
|
disabled: true
|
|
23953
24687
|
});
|
|
23954
24688
|
}
|
|
23955
|
-
|
|
23956
|
-
case
|
|
24689
|
+
_5.label = 27;
|
|
24690
|
+
case 27:
|
|
23957
24691
|
Object.assign(schema, steedosField.amis || {});
|
|
23958
24692
|
return [2 /*return*/, schema];
|
|
23959
|
-
case
|
|
24693
|
+
case 28:
|
|
23960
24694
|
if (!ctx.className) {
|
|
23961
24695
|
ctx.className = className;
|
|
23962
24696
|
}
|
|
@@ -24017,16 +24751,16 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24017
24751
|
}
|
|
24018
24752
|
}
|
|
24019
24753
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
24020
|
-
case
|
|
24021
|
-
schema =
|
|
24754
|
+
case 29:
|
|
24755
|
+
schema = _5.sent();
|
|
24022
24756
|
// console.log(`AmisSteedosField return schema`, schema)
|
|
24023
24757
|
return [2 /*return*/, schema];
|
|
24024
|
-
case
|
|
24025
|
-
case
|
|
24026
|
-
error_1 =
|
|
24758
|
+
case 30: return [3 /*break*/, 32];
|
|
24759
|
+
case 31:
|
|
24760
|
+
error_1 = _5.sent();
|
|
24027
24761
|
console.log("error", error_1);
|
|
24028
|
-
return [3 /*break*/,
|
|
24029
|
-
case
|
|
24762
|
+
return [3 /*break*/, 32];
|
|
24763
|
+
case 32: return [2 /*return*/, null];
|
|
24030
24764
|
}
|
|
24031
24765
|
});
|
|
24032
24766
|
}); };
|
|
@@ -24269,7 +25003,7 @@ var AmisInputTable = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
24269
25003
|
return __generator(this, function (_a) {
|
|
24270
25004
|
switch (_a.label) {
|
|
24271
25005
|
case 0:
|
|
24272
|
-
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, props.disabledOn, props.disabled, props.visibleOn, props.visible, props.hiddenOn, props.hidden, props.enableDialog, props.enableTree;
|
|
25006
|
+
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, props.disabledOn, props.disabled, props.visibleOn, props.visible, props.hiddenOn, props.hidden, props.enableDialog, props.enableTree, props.description;
|
|
24273
25007
|
extendProps = {};
|
|
24274
25008
|
if (props.disabledOn || props.disabled) {
|
|
24275
25009
|
extendProps["addable"] = false;
|
|
@@ -24409,7 +25143,7 @@ var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24409
25143
|
recordPage = _a.sent();
|
|
24410
25144
|
recordSchema = recordPage ? recordPage.schema : {
|
|
24411
25145
|
"type": "wrapper",
|
|
24412
|
-
"className": "steedos-record-content overflow-y-auto p-0 m-0 flex-1 h-full",
|
|
25146
|
+
"className": "steedos-record-content overflow-y-auto p-0 m-0 flex-1 h-full bg-gray-100",
|
|
24413
25147
|
"name": "amis-".concat(appId, "-").concat(objectApiName, "-detail"),
|
|
24414
25148
|
"body": [
|
|
24415
25149
|
{
|
|
@@ -24530,7 +25264,7 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
24530
25264
|
});
|
|
24531
25265
|
}); };
|
|
24532
25266
|
|
|
24533
|
-
var __assign=function(){return (__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);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 o=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){o=e;},error:function(e,t,r){var n,a;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,a=void(o={error:n}),a=n.reason||n.message||n,console.error(a)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),o}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=a=>e=>{const[t,r]=React.useState(!0);var n=()=>{r(!1);};return _$1.has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React__default["default"].createElement(a,_extends({visible:t,onCancel:n,onClose:n},{width:"70%",style:{width:"70%",maxWidth:"950px",minWidth:"480px"}},e))},newComponentRender=(r,n)=>(e,t)=>{e.name||(e.name=r+"-"+(e.name||"default")),(t=t||document.getElementById(`steedos-${r}-root-`+e.name))||((t=document.createElement("div")).setAttribute("id",`steedos-${r}-root-`+e.name),document.body.appendChild(t));e=React__default["default"].createElement(newFunctionComponent(n),e);ReactDOM.createRoot(t).render(e);},Modal=_$1.assign(newComponentRender("modal",antd.Modal),{info:antd.Modal.info,success:antd.Modal.success,error:antd.Modal.error,warning:antd.Modal.warning,confirm:antd.Modal.confirm}),Drawer=newComponentRender("drawer",antd.Drawer),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),_$1.each(e,e=>{-1<e.indexOf(".")&&(e=e.split(".")[0]),t.push(""+e);}),""+t.join(" ")},getFindOneQuery=(e,t,r)=>{e=e.replace(/\./g,"_");r=getGraphqlFieldsQuery(r);let n="";t=[`id: "${t}"`];return `{record:${e}__findOne${n=0<t.length?`(${t.join(",")})`:n}{${r}}}`},SObject={getRecord:async(e,t,r)=>{return (await fetchAPI("/graphql",{method:"post",body:JSON.stringify({query:getFindOneQuery(e,t,r)})})).data.record},getUISchema:async(e,t)=>getUISchema(e,t)},canSaveFilter=e=>!(!e._id||e.owner!==getSteedosAuth()?.userId),ListView={showFilter:(e,{listView:t,data:r})=>{canSaveFilter(t);r.filters&&(r.filters=filtersToConditions(r.filters));},getVisibleFilter:(e,t)=>{return t||(canSaveFilter(e)?e.filters:void 0)},getQueryFilter:(e,t)=>{return canSaveFilter(e)?ListView.getVisibleFilter(e,t):_$1.isEmpty(t)?e.filters:[e.filters,"and",t]},getFirstListView:async e=>{e=await window.getUISchema(e);return _.first(_.sortBy(_.values(e.list_views),"sort_no"))}},Router={getAppPath({appId:e}){return "/app/"+e},getPagePath(){},getObjectListViewPath({appId:e,objectName:t,listViewName:r}){return `/app/${e}/${t}/grid/`+r},getObjectDetailPath({appId:e,objectName:t,recordId:r}){return `/app/${e}/${t}/view/`+r},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:r,objectName:n,foreignKey:a}){return `/app/${e}/${t}/${r}/${n}/grid?related_field_name=`+a}};var withModalWrap=function(t,e){return function(e){return React.createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=React.createElement(e,__assign({},t));return ReactDOM__default["default"].render(e,r)};const safeRunFunction=(t,r,n,a)=>{try{var o=window.Creator;if(!!(!o||!o.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return _$1.isNil(r)||(e=_$1.isArray(r)?r:[r]),t.bind(a||{})(...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 a,o;if(n&&Object.assign(n,getGlobalNowData()),o=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;a="__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,a)).replace(/\bglobal\b/g,JSON.stringify(n)).replace(new RegExp("\\b"+a+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(o));try{return Function(e)()}catch(e){return console.log(e,t,r),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,getGlobalNowData:getGlobalNowData,parseSingleExpression:parseSingleExpression});const getCompatibleDefaultValueExpression=(express,multiple)=>{const reg=/^\{\w+(\.*\w+)*\}$/,reg2=/^{{[\s\S]*}}$/;let result=express;if(reg.test(express)&&(result=-1<express.indexOf("userId")||-1<express.indexOf("spaceId")||-1<express.indexOf("user.")||-1<express.indexOf("now")||-1<express.indexOf("today")||-1<express.indexOf("timeNow")?`{${express}}`.replace("{{","{{global."):`{${express}}`.replace("{{","{{formData."),multiple&&(result=result.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),reg2.test(express)&&(-1<express.indexOf("function")||-1<express.indexOf("=>"))){let regex=/\{\{([\s\S]*)\}\}/,matches=regex.exec(express);if(matches&&1<matches.length){let functionCode=matches[1];result=eval("("+functionCode+")")();}}return result},getFieldDefaultValue=(e,t)=>{if(!e)return null;let r=e.defaultValue;e._defaultValue&&(r=safeEval(`(${e._defaultValue})`)),_$1.isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),_$1.isString(r)&&(r=getCompatibleDefaultValueExpression(r,e.multiple));var n=isExpression(r);switch(n&&("date"===e.type?r=r.replace(/\bglobal.now\b/g,"global.today"):"time"===e.type&&(r=r.replace(/\bglobal.now\b/g,"global.timeNow")),r=parseSingleExpression(r,{},"#",t)),e.type){case"select":var a=e.data_type||"text";!r||n||e.multiple||("text"!==a||_$1.isString(r)?"number"===a&&_$1.isString(r)?r=Number(r):"boolean"===a&&_$1.isString(r)&&(r="true"===r.toLowerCase()||"1"===r):r=String(r));break;case"number":_$1.isString(r)&&(r=Number(r));break;case"boolean":_$1.isString(r)?r="true"===r.toLowerCase()||"1"===r:_$1.isBoolean(r)||(r=!1);break;case"time":if(_$1.isDate(r))return moment(r).format("1970-01-01THH:mm:00.000[Z]");case"date":if(_$1.isDate(r))return moment(r).format("YYYY-MM-DDT00:00:00.000[Z]");case"datetime":if(_$1.isDate(r))return moment(r).format("YYYY-MM-DDTHH:mm:00.000Z")}return r};function getTreeOptions(t,e){const a=e?.valueField||"value";e?.labelField;const r=e?.unfoldedNum||1,n=[],o=(e,t,r,n)=>{return e.children&&"object"==typeof e.children[0]?e.children:r?(e=_.filter(t,e=>_.includes(r,e[a])),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=o(e,t,e.children,n-1))):e.children&&(e.children=o(e,t,e.children,n));}),e):void 0};for(var s=t,i=0;i<s.length;i++)if(s[i].noParent=0,s[i].unfolded=!1,s[i].parent){let e=1;for(var l=0;l<s.length;l++)s[i].parent==s[l][a]&&(e=0);1==e&&(s[i].noParent=1);}else s[i].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=r?(e.unfolded=!0,n.push(Object.assign({},e,{children:o(e,t,e.children,r-1)}))):n.push(Object.assign({},e,{children:o(e,t,e.children,r)})));}),n}function getClosestAmisComponentByType(t,r,n){let a=(n=n||{}).name;var e=n.direction||"up";let o=t.getComponents().find(function(e){return e.props.type===r&&(!a||e.props.name===a)});if(o)return o;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(o=getClosestAmisComponentByType(t.children[e],r,n));e++);return o}}else if("up"===e&&t.parent)return getClosestAmisComponentByType(t.parent,r,n)}function isFilterFormValuesEmpty(e){let t=!0;var e=_.pickBy(e,function(e,t){return /^__searchable__/g.test(t)});return _.isEmpty(e)||(e=_.omitBy(e,function(e){return _.isNil(e)||_.isObject(e)&&_.isEmpty(e)||_.isArray(e)&&_.isEmpty(e.filter(function(e){return !_.isNil(e)}))||_.isString(e)&&0===e.length}),_.isEmpty(e)||(t=!1)),t}const SteedosUI$1=Object.assign({},{render:render,Router:Router,ListView:ListView,Object:SObject,Modal:Modal,Drawer:Drawer,refs:{},getRef(e){return SteedosUI$1.refs[e]},router:{go:(e,t)=>{var r=window.FlowRouter;if(t)return r?r.go(t):window.open(t);r?r.reload():console.warn("暂不支持自动跳转",e);},reload:()=>{console.log("reload");}},message:antd.message,notification:antd.notification,components:{Button:antd.Button,Space:antd.Space},getRefId:({type:e,appId:t,name:r})=>{switch(e){case"listview":return `amis-${t}-${r}-listview`;case"form":return `amis-${t}-${r}-form`;case"detail":return `amis-${t}-${r}-detail`;default:return `amis-${t}-${r}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType,isFilterFormValuesEmpty:isFilterFormValuesEmpty,getSearchFilter:e=>{var a=[];return _.each(e,(e,t)=>{var r,n;_.isEmpty(e)&&!_.isBoolean(e)||(_.startsWith(t,"__searchable__between__")?a.push([""+t.replace("__searchable__between__",""),"between",e]):_.startsWith(t,"__searchable__")&&(_.isString(e)?a.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]),a.push(n)):a.push([""+t.replace("__searchable__",""),"=",e])));}),a},getKeywordsSearchFilter:(e,t)=>{const a=[];var o;return e&&t&&(o=e.split(/\s+/),o=_$1.compact(o),t.forEach(function(r,e){let n=[];1==o.length?n=[r,"contains",o[0]]:o.forEach(function(e,t){n.push([r,"contains",e]),t<o.length-1&&n.push("or");}),n.length&&(a.push(n),e<t.length-1&&a.push("or"));})),a},getFormulaVariables:(e,t=!0)=>{const r=[];return _$1.isEmpty(e)||(r.push({label:"表单字段",children:[]}),lodash.forEach(e,function(e){r[0].children.push({label:e.label,value:e.value});})),t&&r.push({label:"全局变量",children:[{label:"用户ID",value:"global['userId']"},{label:"工作区ID",value:"global['spaceId']"},{label:"只读/编辑模式",value:"global['mode']"},{label:"用户",children:[{label:"姓名",value:"global['user']['name']"},{label:"邮件",value:"global['user']['email']"},{label:"语言",value:"global['user']['language']"},{label:"简档",value:"global['user']['profile']"},{label:"权限集",value:"global['user']['roles']"},{label:"主部门ID",value:"global['user']['organization']['_id']"},{label:"部门(多选)",value:"global['user']['organizations']"},{label:"部门(含上级)",value:"global['user']['organizations_parents']"},{label:"主分部ID",value:"global['user']['company_id']"},{label:"分部(多选)",value:"global['user']['company_ids']"},{label:"人员ID",value:"global['user']['spaceUserId']"},{label:"是否是工作区管理员",value:"global['user']['is_space_admin']"}]}]}),r}});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);
|
|
25267
|
+
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 a=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){a=e;},error:function(e,t,r){var n,o;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,o=void(a={error:n}),o=n.reason||n.message||n,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),a}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}const newFunctionComponent=o=>e=>{const[t,r]=React.useState(!0);var n=()=>{r(!1);};return _$1.has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React__default["default"].createElement(o,_extends({visible:t,onCancel:n,onClose:n},{width:"70%",style:{width:"70%",maxWidth:"950px",minWidth:"480px"}},e))},newComponentRender=(r,n)=>(e,t)=>{e.name||(e.name=r+"-"+(e.name||"default")),(t=t||document.getElementById(`steedos-${r}-root-`+e.name))||((t=document.createElement("div")).setAttribute("id",`steedos-${r}-root-`+e.name),document.body.appendChild(t));e=React__default["default"].createElement(newFunctionComponent(n),e);ReactDOM.createRoot(t).render(e);},Modal=_$1.assign(newComponentRender("modal",antd.Modal),{info:antd.Modal.info,success:antd.Modal.success,error:antd.Modal.error,warning:antd.Modal.warning,confirm:antd.Modal.confirm}),Drawer=newComponentRender("drawer",antd.Drawer),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),_$1.each(e,e=>{-1<e.indexOf(".")&&(e=e.split(".")[0]),t.push(""+e);}),""+t.join(" ")},getFindOneQuery=(e,t,r)=>{e=e.replace(/\./g,"_");r=getGraphqlFieldsQuery(r);let n="";t=[`id: "${t}"`];return `{record:${e}__findOne${n=0<t.length?`(${t.join(",")})`:n}{${r}}}`},SObject={getRecord:async(e,t,r)=>{return (await fetchAPI("/graphql",{method:"post",body:JSON.stringify({query:getFindOneQuery(e,t,r)})})).data.record},getUISchema:async(e,t)=>getUISchema(e,t)},canSaveFilter=e=>!(!e._id||e.owner!==getSteedosAuth()?.userId),ListView={showFilter:(e,{listView:t,data:r})=>{canSaveFilter(t);r.filters&&(r.filters=filtersToConditions(r.filters));},getVisibleFilter:(e,t)=>{return t||(canSaveFilter(e)?e.filters:void 0)},getQueryFilter:(e,t)=>{return canSaveFilter(e)?ListView.getVisibleFilter(e,t):_$1.isEmpty(t)?e.filters:[e.filters,"and",t]},getFirstListView:async e=>{e=await window.getUISchema(e);return _.first(_.sortBy(_.values(e.list_views),"sort_no"))}},Router={getAppPath({appId:e}){return "/app/"+e},getPagePath(){},getObjectListViewPath({appId:e,objectName:t,listViewName:r}){return `/app/${e}/${t}/grid/`+r},getObjectDetailPath({appId:e,objectName:t,recordId:r}){return `/app/${e}/${t}/view/`+r},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:r,objectName:n,foreignKey:o}){return `/app/${e}/${t}/${r}/${n}/grid?related_field_name=`+o}};var withModalWrap=function(t,e){return function(e){return React.createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=React.createElement(e,__assign({},t));return ReactDOM__default["default"].render(e,r)};const safeRunFunction=(t,r,n,o)=>{try{var a=window.Creator;if(!!(!a||!a.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return _$1.isNil(r)||(e=_$1.isArray(r)?r:[r]),t.bind(o||{})(...e)}catch(e){return console.log(e),n}};function safeEval(js){try{return eval(js)}catch(e){console.error(e,js);}}const isExpression=function(e){var t,r;return "string"==typeof e&&(t=/^{{(function.+)}}$/,r=/^{{(.+=>.+)}}$/,!("string"!=typeof e||!e.match(/^{{(.+)}}$/)||e.match(t)||e.match(r)))},getMoment=()=>window.amisRequire?window.amisRequire("moment"):window.moment||void 0,getGlobalNowData=()=>{var e=new Date,t=getMoment();let r=t().utc(),n=(r.set("hours",0),r.set("minutes",0),r.set("seconds",0),r.set("milliseconds",0),r=r.toDate(),t());return n.set("year",1970),n.set("month",0),n.set("date",1),n.set("hours",n.hours()+n.utcOffset()/60),n.set("seconds",0),n.set("milliseconds",0),n=n.toDate(),{now:e,today:r,timeNow:n}},parseSingleExpression=function(t,e,r,n){var o,a;if(n&&Object.assign(n,getGlobalNowData()),a=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(a));try{return Function(e)()}catch(e){return console.log(e,t,r),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,getGlobalNowData:getGlobalNowData,parseSingleExpression:parseSingleExpression});const getCompatibleDefaultValueExpression=(express,multiple)=>{const reg=/^\{\w+(\.*\w+)*\}$/,reg2=/^{{[\s\S]*}}$/;let result=express;if(reg.test(express)&&(result=-1<express.indexOf("userId")||-1<express.indexOf("spaceId")||-1<express.indexOf("user.")||-1<express.indexOf("now")||-1<express.indexOf("today")||-1<express.indexOf("timeNow")?`{${express}}`.replace("{{","{{global."):`{${express}}`.replace("{{","{{formData."),multiple&&(result=result.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),reg2.test(express)&&(-1<express.indexOf("function")||-1<express.indexOf("=>"))){let regex=/\{\{([\s\S]*)\}\}/,matches=regex.exec(express);if(matches&&1<matches.length){let functionCode=matches[1];result=eval("("+functionCode+")")();}}return result},getFieldDefaultValue=(e,t)=>{if(!e)return null;let r=e.defaultValue;e._defaultValue&&(r=safeEval(`(${e._defaultValue})`)),_$1.isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),_$1.isString(r)&&(r=getCompatibleDefaultValueExpression(r,e.multiple));var n=isExpression(r);switch(n&&("date"===e.type?r=r.replace(/\bglobal.now\b/g,"global.today"):"time"===e.type&&(r=r.replace(/\bglobal.now\b/g,"global.timeNow")),r=parseSingleExpression(r,{},"#",t)),e.type){case"select":var o=e.data_type||"text";!r||n||e.multiple||("text"!==o||_$1.isString(r)?"number"===o&&_$1.isString(r)?r=Number(r):"boolean"===o&&_$1.isString(r)&&(r="true"===r.toLowerCase()||"1"===r):r=String(r));break;case"number":_$1.isString(r)&&(r=Number(r));break;case"boolean":_$1.isString(r)?r="true"===r.toLowerCase()||"1"===r:_$1.isBoolean(r)||(r=!1);break;case"time":if(_$1.isDate(r))return moment(r).format("1970-01-01THH:mm:00.000[Z]");case"date":if(_$1.isDate(r))return moment(r).format("YYYY-MM-DDT00:00:00.000[Z]");case"datetime":if(_$1.isDate(r))return moment(r).format("YYYY-MM-DDTHH:mm:00.000Z")}return r};function getTreeOptions(t,e){const o=e?.valueField||"value";e?.labelField;const r=e?.unfoldedNum||1,n=[],a=(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=a(e,t,e.children,n-1))):e.children&&(e.children=a(e,t,e.children,n));}),e):void 0};for(var s=t,i=0;i<s.length;i++)if(s[i].noParent=0,s[i].unfolded=!1,s[i].parent){let e=1;for(var l=0;l<s.length;l++)s[i].parent==s[l][o]&&(e=0);1==e&&(s[i].noParent=1);}else s[i].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=r?(e.unfolded=!0,n.push(Object.assign({},e,{children:a(e,t,e.children,r-1)}))):n.push(Object.assign({},e,{children:a(e,t,e.children,r)})));}),n}function getClosestAmisComponentByType(t,r,n){let o=(n=n||{}).name;var e=n.direction||"up";let a=t.getComponents().find(function(e){return e.props.type===r&&(!o||e.props.name===o)});if(a)return a;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(a=getClosestAmisComponentByType(t.children[e],r,n));e++);return a}}else if("up"===e&&t.parent)return getClosestAmisComponentByType(t.parent,r,n)}function isFilterFormValuesEmpty(e){let t=!0;var e=_.pickBy(e,function(e,t){return /^__searchable__/g.test(t)});return _.isEmpty(e)||(e=_.omitBy(e,function(e){return _.isNil(e)||_.isObject(e)&&_.isEmpty(e)||_.isArray(e)&&_.isEmpty(e.filter(function(e){return !_.isNil(e)}))||_.isString(e)&&0===e.length}),_.isEmpty(e)||(t=!1)),t}const SteedosUI$1=Object.assign({},{render:render,Router:Router,ListView:ListView,Object:SObject,Modal:Modal,Drawer:Drawer,refs:{},getRef(e){return SteedosUI$1.refs[e]},router:{go:(e,t)=>{var r=window.FlowRouter;if(t)return r?r.go(t):window.open(t);r?r.reload():console.warn("暂不支持自动跳转",e);},reload:()=>{console.log("reload");}},message:antd.message,notification:antd.notification,components:{Button:antd.Button,Space:antd.Space},getRefId:({type:e,appId:t,name:r})=>{switch(e){case"listview":return `amis-${t}-${r}-listview`;case"form":return `amis-${t}-${r}-form`;case"detail":return `amis-${t}-${r}-detail`;default:return `amis-${t}-${r}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType,isFilterFormValuesEmpty:isFilterFormValuesEmpty,getSearchFilter:e=>{var o=[];return _.each(e,(e,t)=>{var r,n;_.isEmpty(e)&&!_.isBoolean(e)||(_.startsWith(t,"__searchable__between__")?o.push([""+t.replace("__searchable__between__",""),"between",e]):_.startsWith(t,"__searchable__")&&(_.isString(e)?o.push([""+t.replace("__searchable__",""),"contains",e]):_.isObject(e)&&e.o?(n=[[(r=""+t.replace("__searchable__",""))+"/o","=",e.o]],e.ids.length&&n.push([r+"/ids","=",e.ids]),o.push(n)):o.push([""+t.replace("__searchable__",""),"=",e])));}),o},getKeywordsSearchFilter:(e,t)=>{const o=[];var a;return e&&t&&(a=e.split(/\s+/),a=_$1.compact(a),t.forEach(function(r,e){let n=[];1==a.length?n=[r,"contains",a[0]]:a.forEach(function(e,t){n.push([r,"contains",e]),t<a.length-1&&n.push("or");}),n.length&&(o.push(n),e<t.length-1&&o.push("or"));})),o},getFormulaVariables:(e,t=!0)=>{const r=[];return _$1.isEmpty(e)||(r.push({label:"表单字段",children:[]}),lodash.forEach(e,function(e){r[0].children.push({label:e.label,value:e.value});})),t&&r.push({label:"全局变量",children:[{label:"用户ID",value:"global['userId']"},{label:"工作区ID",value:"global['spaceId']"},{label:"用户",children:[{label:"姓名",value:"global['user']['name']"},{label:"邮件",value:"global['user']['email']"},{label:"语言",value:"global['user']['language']"},{label:"简档",value:"global['user']['profile']"},{label:"权限集",value:"global['user']['roles']"},{label:"主部门ID",value:"global['user']['organization']['_id']"},{label:"部门(含上级)",value:"global['user']['organizations_parents']"},{label:"主分部ID",value:"global['user']['company_id']"},{label:"分部(多选)",value:"global['user']['company_ids']"},{label:"人员ID",value:"global['user']['spaceUserId']"},{label:"是否是工作区管理员",value:"global['user']['is_space_admin']"}]}]}),r}});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);
|
|
24534
25268
|
|
|
24535
25269
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
24536
25270
|
__proto__: null,
|