@steedos-widgets/amis-object 6.3.0-beta.9 → 6.3.1
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/AmisAppLauncher.d.ts +268 -3
- package/dist/amis/AmisInputTable.d.ts +1 -0
- package/dist/amis/AmisRecordDetailHeader.d.ts +1 -0
- package/dist/amis-object.cjs.css +94 -31
- package/dist/amis-object.cjs.js +1932 -1131
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +94 -31
- package/dist/amis-object.esm.js +1932 -1131
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +94 -31
- package/dist/amis-object.umd.js +349 -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": `\${${field.name}}`,
|
|
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": `\${${field.name}}`,
|
|
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/\${${steedosField.name}}" ${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){
|
|
@@ -5334,7 +5513,7 @@ async function getTableColumns$1(object, fields, options){
|
|
|
5334
5513
|
}
|
|
5335
5514
|
//增加quickEdit属性,实现快速编辑
|
|
5336
5515
|
const quickEditSchema = allowEdit ? await getQuickEditSchema(object, field, options) : allowEdit;
|
|
5337
|
-
let className =
|
|
5516
|
+
let className = `steedos-table-${field.type}-field`;
|
|
5338
5517
|
const bowserType = getBowserType();
|
|
5339
5518
|
if(bowserType === "Safari"){
|
|
5340
5519
|
className += " whitespace-nowrap ";
|
|
@@ -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 bg-gray-100",
|
|
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
|
-
|
|
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为弹出选择专用视图,根据用户权限被禁用的视图,不显示在列表切换区域
|
|
9715
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
|
}
|
|
@@ -10314,10 +11083,10 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
10314
11083
|
async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
|
|
10315
11084
|
}
|
|
10316
11085
|
|
|
10317
|
-
const
|
|
11086
|
+
const getCopyListviewButtonSchema = ()=>{
|
|
10318
11087
|
return {
|
|
10319
11088
|
"type": "button",
|
|
10320
|
-
"label": instance.t('
|
|
11089
|
+
"label": instance.t('frontend_listview_control_clone_label'),
|
|
10321
11090
|
"onEvent": {
|
|
10322
11091
|
"click": {
|
|
10323
11092
|
"weight": 0,
|
|
@@ -10325,14 +11094,14 @@ const getNewListviewButtonSchema = ()=>{
|
|
|
10325
11094
|
{
|
|
10326
11095
|
"dialog": {
|
|
10327
11096
|
"type": "dialog",
|
|
10328
|
-
"title": instance.t('
|
|
11097
|
+
"title": instance.t('frontend_listview_control_clone_title'),
|
|
10329
11098
|
"data": {
|
|
10330
11099
|
//"&":"$$",2.7、2.9、3.0在此处失效
|
|
10331
|
-
"
|
|
11100
|
+
"listName": "${listName}",
|
|
11101
|
+
"targetObjectName": "${objectName}",
|
|
10332
11102
|
"list_view": "${uiSchema.list_views[listName]}",
|
|
10333
11103
|
"appId": "${appId}",
|
|
10334
11104
|
"global": "${global}",
|
|
10335
|
-
"targetObjectName": "${objectName}",
|
|
10336
11105
|
"context": "${context}"
|
|
10337
11106
|
},
|
|
10338
11107
|
"body": [
|
|
@@ -10346,8 +11115,7 @@ const getNewListviewButtonSchema = ()=>{
|
|
|
10346
11115
|
"defaultData": {
|
|
10347
11116
|
"&": "${list_view}",
|
|
10348
11117
|
"name":"",
|
|
10349
|
-
"label":"",
|
|
10350
|
-
"filters":"",
|
|
11118
|
+
"label": instance.t('frontend_listview_control_clone_defaultData_label_start') + " ${list_view.label} " + instance.t('frontend_listview_control_clone_defaultData_label_end'),
|
|
10351
11119
|
"shared":false,
|
|
10352
11120
|
"object_name": "${targetObjectName}",
|
|
10353
11121
|
"_id":"",
|
|
@@ -10359,15 +11127,14 @@ const getNewListviewButtonSchema = ()=>{
|
|
|
10359
11127
|
"company_ids": null,
|
|
10360
11128
|
"is_system": false
|
|
10361
11129
|
},
|
|
10362
|
-
"fieldsExtend": fieldsExtend$
|
|
10363
|
-
"fields": fields
|
|
11130
|
+
"fieldsExtend": fieldsExtend$4(),
|
|
11131
|
+
"fields": fields(),
|
|
10364
11132
|
"onEvent": {
|
|
10365
11133
|
"submitSucc": {
|
|
10366
11134
|
"weight": 0,
|
|
10367
11135
|
"actions": [
|
|
10368
11136
|
{
|
|
10369
11137
|
"args": {
|
|
10370
|
-
// 直接使用recordId不能拿到数据,只能通过result里面拿数据
|
|
10371
11138
|
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
10372
11139
|
"blank": false
|
|
10373
11140
|
},
|
|
@@ -10375,11 +11142,7 @@ const getNewListviewButtonSchema = ()=>{
|
|
|
10375
11142
|
}
|
|
10376
11143
|
]
|
|
10377
11144
|
}
|
|
10378
|
-
}
|
|
10379
|
-
"messages": {
|
|
10380
|
-
"success": instance.t('frontend_listview_control_new_message_success'),
|
|
10381
|
-
"failed": instance.t('frontend_listview_control_new_message_failed')
|
|
10382
|
-
},
|
|
11145
|
+
}
|
|
10383
11146
|
}
|
|
10384
11147
|
],
|
|
10385
11148
|
"showCloseButton": true,
|
|
@@ -10397,18 +11160,20 @@ const getNewListviewButtonSchema = ()=>{
|
|
|
10397
11160
|
}
|
|
10398
11161
|
};
|
|
10399
11162
|
|
|
10400
|
-
function fields
|
|
11163
|
+
function fields(){
|
|
10401
11164
|
return [
|
|
10402
11165
|
"label",
|
|
10403
11166
|
"name",
|
|
10404
11167
|
"object_name",
|
|
10405
11168
|
"filter_scope",
|
|
10406
11169
|
"show_count",
|
|
10407
|
-
"columns",
|
|
10408
|
-
"
|
|
11170
|
+
"columns.$.field",
|
|
11171
|
+
"columns.$.width",
|
|
11172
|
+
"sort.$.field_name",
|
|
11173
|
+
"sort.$.order",
|
|
10409
11174
|
"filters",
|
|
10410
|
-
"mobile_columns",
|
|
10411
|
-
"searchable_fields",
|
|
11175
|
+
"mobile_columns.$.field",
|
|
11176
|
+
"searchable_fields.$.field",
|
|
10412
11177
|
"is_system",
|
|
10413
11178
|
"shared",
|
|
10414
11179
|
"shared_to",
|
|
@@ -10416,213 +11181,7 @@ function fields$1(){
|
|
|
10416
11181
|
]
|
|
10417
11182
|
}
|
|
10418
11183
|
|
|
10419
|
-
function fieldsExtend$
|
|
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
|
|
10522
|
-
}
|
|
10523
|
-
}
|
|
10524
|
-
}
|
|
10525
|
-
}
|
|
10526
|
-
|
|
10527
|
-
const getCopyListviewButtonSchema = ()=>{
|
|
10528
|
-
return {
|
|
10529
|
-
"type": "button",
|
|
10530
|
-
"label": instance.t('frontend_listview_control_clone_label'),
|
|
10531
|
-
"onEvent": {
|
|
10532
|
-
"click": {
|
|
10533
|
-
"weight": 0,
|
|
10534
|
-
"actions": [
|
|
10535
|
-
{
|
|
10536
|
-
"dialog": {
|
|
10537
|
-
"type": "dialog",
|
|
10538
|
-
"title": instance.t('frontend_listview_control_clone_title'),
|
|
10539
|
-
"data": {
|
|
10540
|
-
//"&":"$$",2.7、2.9、3.0在此处失效
|
|
10541
|
-
"listName": "${listName}",
|
|
10542
|
-
"targetObjectName": "${objectName}",
|
|
10543
|
-
"list_view": "${uiSchema.list_views[listName]}",
|
|
10544
|
-
"appId": "${appId}",
|
|
10545
|
-
"global": "${global}",
|
|
10546
|
-
"context": "${context}"
|
|
10547
|
-
},
|
|
10548
|
-
"body": [
|
|
10549
|
-
{
|
|
10550
|
-
"type": "steedos-object-form",
|
|
10551
|
-
"label": "对象表单",
|
|
10552
|
-
"objectApiName": "object_listviews",
|
|
10553
|
-
"recordId": "",
|
|
10554
|
-
"mode": "edit",
|
|
10555
|
-
"layout": "normal",
|
|
10556
|
-
"defaultData": {
|
|
10557
|
-
"&": "${list_view}",
|
|
10558
|
-
"name":"",
|
|
10559
|
-
"label": instance.t('frontend_listview_control_clone_defaultData_label_start') + " ${list_view.label} " + instance.t('frontend_listview_control_clone_defaultData_label_end'),
|
|
10560
|
-
"shared":false,
|
|
10561
|
-
"object_name": "${targetObjectName}",
|
|
10562
|
-
"_id":"",
|
|
10563
|
-
"shared_to": null,
|
|
10564
|
-
"shared_to_organizations": null,
|
|
10565
|
-
"locked": false,
|
|
10566
|
-
"owner": null,
|
|
10567
|
-
"company_id": null,
|
|
10568
|
-
"company_ids": null,
|
|
10569
|
-
"is_system": false
|
|
10570
|
-
},
|
|
10571
|
-
"fieldsExtend": fieldsExtend$4(),
|
|
10572
|
-
"fields": fields(),
|
|
10573
|
-
"onEvent": {
|
|
10574
|
-
"submitSucc": {
|
|
10575
|
-
"weight": 0,
|
|
10576
|
-
"actions": [
|
|
10577
|
-
{
|
|
10578
|
-
"args": {
|
|
10579
|
-
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
10580
|
-
"blank": false
|
|
10581
|
-
},
|
|
10582
|
-
"actionType": "url",
|
|
10583
|
-
}
|
|
10584
|
-
]
|
|
10585
|
-
}
|
|
10586
|
-
}
|
|
10587
|
-
}
|
|
10588
|
-
],
|
|
10589
|
-
"showCloseButton": true,
|
|
10590
|
-
"showErrorMsg": true,
|
|
10591
|
-
"showLoading": true,
|
|
10592
|
-
"closeOnEsc": false,
|
|
10593
|
-
"dataMapSwitch": false,
|
|
10594
|
-
"size": "lg"
|
|
10595
|
-
},
|
|
10596
|
-
"actionType": "dialog"
|
|
10597
|
-
}
|
|
10598
|
-
]
|
|
10599
|
-
}
|
|
10600
|
-
}
|
|
10601
|
-
}
|
|
10602
|
-
};
|
|
10603
|
-
|
|
10604
|
-
function fields(){
|
|
10605
|
-
return [
|
|
10606
|
-
"label",
|
|
10607
|
-
"name",
|
|
10608
|
-
"object_name",
|
|
10609
|
-
"filter_scope",
|
|
10610
|
-
"show_count",
|
|
10611
|
-
"columns.$.field",
|
|
10612
|
-
"columns.$.width",
|
|
10613
|
-
"sort.$.field_name",
|
|
10614
|
-
"sort.$.order",
|
|
10615
|
-
"filters",
|
|
10616
|
-
"mobile_columns.$.field",
|
|
10617
|
-
"searchable_fields.$.field",
|
|
10618
|
-
"is_system",
|
|
10619
|
-
"shared",
|
|
10620
|
-
"shared_to",
|
|
10621
|
-
"shared_to_organizations"
|
|
10622
|
-
]
|
|
10623
|
-
}
|
|
10624
|
-
|
|
10625
|
-
function fieldsExtend$4(){
|
|
11184
|
+
function fieldsExtend$4(){
|
|
10626
11185
|
return {
|
|
10627
11186
|
"label": {
|
|
10628
11187
|
"group": "",
|
|
@@ -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;
|
|
@@ -13348,6 +13912,8 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
|
|
|
13348
13912
|
wrap: column.wrap // wrap = true 是没效果的
|
|
13349
13913
|
}
|
|
13350
13914
|
);
|
|
13915
|
+
} else if (filedInfo && filedInfo.type === 'object') {
|
|
13916
|
+
columnField = uiSchema.fields[column.field];
|
|
13351
13917
|
}
|
|
13352
13918
|
} else {
|
|
13353
13919
|
if (uiSchema.fields[column.field]) {
|
|
@@ -13482,7 +14048,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
13482
14048
|
};
|
|
13483
14049
|
const content = {
|
|
13484
14050
|
"type": "tabs",
|
|
13485
|
-
"className": "steedos-record-tabs bg-white p-4 m-2 border rounded",
|
|
14051
|
+
"className": "steedos-record-tabs bg-white p-4 sm:m-2 sm:border sm:rounded",
|
|
13486
14052
|
"contentClassName": "bg-none",
|
|
13487
14053
|
"tabs": [
|
|
13488
14054
|
detailed
|
|
@@ -14589,7 +15155,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
14589
15155
|
}
|
|
14590
15156
|
|
|
14591
15157
|
var fieldFilters = ${JSON.stringify(field.filters)};
|
|
14592
|
-
var currentAmis = amisRequire('amis');
|
|
15158
|
+
var currentAmis = (window.amisRequire && window.amisRequire('amis')) || Amis;
|
|
14593
15159
|
//递归fieldFilters数组,检查每一个元素,判断若是公式,就仅把它解析
|
|
14594
15160
|
function traverseNestedArray(arr) {
|
|
14595
15161
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -14600,7 +15166,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
14600
15166
|
// 如果当前元素不是数组,则处理该元素
|
|
14601
15167
|
// 下面正则用于匹配amis公式\${}
|
|
14602
15168
|
if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
|
|
14603
|
-
|
|
15169
|
+
try{
|
|
15170
|
+
arr[i] = currentAmis.evaluate(arr[i], api.context);
|
|
15171
|
+
}catch(ex){
|
|
15172
|
+
console.error("运行lookup过滤公式时出现错误:",ex);
|
|
15173
|
+
}
|
|
14604
15174
|
}
|
|
14605
15175
|
}
|
|
14606
15176
|
}
|
|
@@ -14761,8 +15331,8 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
14761
15331
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
14762
15332
|
const isCreate = _$1__namespace.isBoolean(field.create) ? field.create : true;
|
|
14763
15333
|
// lookup字段配置过滤条件就强制不显示新建按钮
|
|
14764
|
-
let
|
|
14765
|
-
if (isAllowCreate && isCreate && !
|
|
15334
|
+
let hasFilters = !_$1__namespace.isEmpty(field.filters) || !!field.filtersFunction || !!field._filtersFunction;
|
|
15335
|
+
if (isAllowCreate && isCreate && !hasFilters) {
|
|
14766
15336
|
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
14767
15337
|
new_button.align = "right";
|
|
14768
15338
|
// 保持快速搜索放在最左侧,新建按钮往里插,而不是push到最后
|
|
@@ -15006,7 +15576,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
15006
15576
|
// }
|
|
15007
15577
|
|
|
15008
15578
|
var fieldFilters = ${JSON.stringify(field.filters)};
|
|
15009
|
-
var currentAmis = amisRequire('amis');
|
|
15579
|
+
var currentAmis = (window.amisRequire && window.amisRequire('amis')) || Amis;
|
|
15010
15580
|
//递归fieldFilters数组,检查每一个元素,判断若是公式,就仅把它解析
|
|
15011
15581
|
function traverseNestedArray(arr) {
|
|
15012
15582
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -15017,7 +15587,11 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
15017
15587
|
// 如果当前元素不是数组,则处理该元素
|
|
15018
15588
|
// 下面正则用于匹配amis公式\${}
|
|
15019
15589
|
if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
|
|
15020
|
-
|
|
15590
|
+
try{
|
|
15591
|
+
arr[i] = currentAmis.evaluate(arr[i], api.context);
|
|
15592
|
+
}catch(ex){
|
|
15593
|
+
console.error("运行lookup过滤公式时出现错误:",ex);
|
|
15594
|
+
}
|
|
15021
15595
|
}
|
|
15022
15596
|
}
|
|
15023
15597
|
}
|
|
@@ -15429,8 +16003,8 @@ if(typeof window != 'undefined'){
|
|
|
15429
16003
|
/*
|
|
15430
16004
|
* @Author: baozhoutao@steedos.com
|
|
15431
16005
|
* @Date: 2023-01-13 17:27:54
|
|
15432
|
-
* @LastEditors:
|
|
15433
|
-
* @LastEditTime: 2024-
|
|
16006
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
16007
|
+
* @LastEditTime: 2024-06-07 13:39:34
|
|
15434
16008
|
* @Description:
|
|
15435
16009
|
*/
|
|
15436
16010
|
|
|
@@ -15467,6 +16041,7 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
|
|
|
15467
16041
|
"name": field.name,
|
|
15468
16042
|
"labelClassName": "none",
|
|
15469
16043
|
"language": "markdown",
|
|
16044
|
+
"options": field.amis ? field.amis.editorOptions : null
|
|
15470
16045
|
}
|
|
15471
16046
|
]
|
|
15472
16047
|
},
|
|
@@ -16123,6 +16698,21 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
16123
16698
|
type: getAmisStaticFieldType$1('url', readonly, field),
|
|
16124
16699
|
static: readonly ? true : false
|
|
16125
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
|
+
}
|
|
16126
16716
|
if(readonly && field.show_as_qr){
|
|
16127
16717
|
convertData = {
|
|
16128
16718
|
type: "control",
|
|
@@ -16188,13 +16778,13 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
16188
16778
|
};
|
|
16189
16779
|
break;
|
|
16190
16780
|
case 'avatar':
|
|
16191
|
-
convertData = getAmisFileSchema(field, readonly);
|
|
16781
|
+
convertData = await getAmisFileSchema(field, readonly, ctx);
|
|
16192
16782
|
break;
|
|
16193
16783
|
case 'image':
|
|
16194
|
-
convertData = getAmisFileSchema(field, readonly);
|
|
16784
|
+
convertData = await getAmisFileSchema(field, readonly, ctx);
|
|
16195
16785
|
break;
|
|
16196
16786
|
case 'file':
|
|
16197
|
-
convertData = getAmisFileSchema(field, readonly);
|
|
16787
|
+
convertData = await getAmisFileSchema(field, readonly, ctx);
|
|
16198
16788
|
break;
|
|
16199
16789
|
case 'formula':
|
|
16200
16790
|
if(readonly){
|
|
@@ -16310,6 +16900,8 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
16310
16900
|
if(gridSub){
|
|
16311
16901
|
delete gridSub.name;
|
|
16312
16902
|
delete gridSub.label;
|
|
16903
|
+
//去除重复样式
|
|
16904
|
+
gridSub.className = gridSub.className.replace('border-b', '');
|
|
16313
16905
|
convertData.items.push(
|
|
16314
16906
|
Object.assign({}, gridSub, {label: subField.label}, subField.amis, {
|
|
16315
16907
|
name: subFieldName
|
|
@@ -16364,6 +16956,10 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
16364
16956
|
}
|
|
16365
16957
|
// if(ctx.mode === 'edit'){
|
|
16366
16958
|
let convertDataResult = Object.assign({}, baseData, convertData, { labelClassName: 'text-left', clearValueOnHidden: true, fieldName: field.name}, field.amis, {name: baseData.name});
|
|
16959
|
+
// 只读时file字段的外层control层若存在name,内部each组件存在问题
|
|
16960
|
+
if(readonly && field.type == "file") {
|
|
16961
|
+
convertDataResult.name = "";
|
|
16962
|
+
}
|
|
16367
16963
|
// console.log("convertDataResult:", convertDataResult);
|
|
16368
16964
|
return convertDataResult;
|
|
16369
16965
|
// }else{
|
|
@@ -16583,13 +17179,17 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
|
|
|
16583
17179
|
// console.log(`perField.type object ===> field`, field)
|
|
16584
17180
|
}
|
|
16585
17181
|
if (field.name.indexOf(".") < 0) {
|
|
17182
|
+
let _field = _.cloneDeep(field);
|
|
17183
|
+
if(field.type === "select" && field.data_type && field.data_type != "text"){
|
|
17184
|
+
_field.type = field.data_type;
|
|
17185
|
+
}
|
|
16586
17186
|
if(field.type === "steedos-field"){
|
|
16587
17187
|
// 如果是steedos-field则不需要通过convertSFieldToAmisField函数转换,因为steedos-field组件会转换
|
|
16588
|
-
fieldSetBody.push(
|
|
17188
|
+
fieldSetBody.push(_field);
|
|
16589
17189
|
}
|
|
16590
17190
|
else {
|
|
16591
17191
|
ctx.__formFields = formFields;
|
|
16592
|
-
const amisField = await convertSFieldToAmisField(
|
|
17192
|
+
const amisField = await convertSFieldToAmisField(_field, _field.readonly, ctx);
|
|
16593
17193
|
// 如果steedos-field稳定了,可以放开下面的代码直接用组件统一渲染字段
|
|
16594
17194
|
// const amisField = {
|
|
16595
17195
|
// "type": "steedos-field",
|
|
@@ -16742,24 +17342,24 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
16742
17342
|
/*
|
|
16743
17343
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
16744
17344
|
* @Date: 2024-01-18 15:12:41
|
|
16745
|
-
* @LastEditors:
|
|
16746
|
-
* @LastEditTime: 2024-
|
|
17345
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
17346
|
+
* @LastEditTime: 2024-05-20 13:46:41
|
|
16747
17347
|
*/
|
|
16748
17348
|
/**
|
|
16749
17349
|
* 生成符合标准uuid格式的36位满足唯一性的随机串
|
|
16750
17350
|
* @returns uuid
|
|
16751
17351
|
*/
|
|
16752
17352
|
function uuidv4() {
|
|
16753
|
-
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, c
|
|
16754
|
-
(c ^ window.crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
|
16755
|
-
);
|
|
17353
|
+
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, function (c) {
|
|
17354
|
+
return (c ^ window.crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
|
|
17355
|
+
});
|
|
16756
17356
|
}
|
|
16757
17357
|
|
|
16758
17358
|
/*
|
|
16759
17359
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
16760
17360
|
* @Date: 2023-11-15 09:50:22
|
|
16761
17361
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
16762
|
-
* @LastEditTime: 2024-
|
|
17362
|
+
* @LastEditTime: 2024-06-14 06:31:33
|
|
16763
17363
|
*/
|
|
16764
17364
|
|
|
16765
17365
|
/**
|
|
@@ -16978,7 +17578,8 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
16978
17578
|
return {
|
|
16979
17579
|
"type": "steedos-field",
|
|
16980
17580
|
"config": Object.assign({}, field, {
|
|
16981
|
-
label: false
|
|
17581
|
+
label: false,
|
|
17582
|
+
description: null
|
|
16982
17583
|
}),
|
|
16983
17584
|
// quickEdit: {
|
|
16984
17585
|
// "type": "steedos-field",
|
|
@@ -16995,7 +17596,8 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
16995
17596
|
return {
|
|
16996
17597
|
"type": "steedos-field",
|
|
16997
17598
|
"config": Object.assign({}, field, {
|
|
16998
|
-
label: false
|
|
17599
|
+
label: false,
|
|
17600
|
+
description: null
|
|
16999
17601
|
}),
|
|
17000
17602
|
inInputTable: true,
|
|
17001
17603
|
"static": true,
|
|
@@ -17829,6 +18431,7 @@ async function getButtonActions(props, mode) {
|
|
|
17829
18431
|
"__parentForm": mode == "new" ? "$$" : parentFormData,
|
|
17830
18432
|
"_master": "${_master}",
|
|
17831
18433
|
"global": "${global}",
|
|
18434
|
+
"context": "${context}",
|
|
17832
18435
|
"uiSchema": "${uiSchema}",
|
|
17833
18436
|
"index": "${index}",//amis组件自带行索引,在节点嵌套情况下,当前节点如果是children属性下的子节点时,这里的index是当前节点在children中的索引,而不是外层父节点的index
|
|
17834
18437
|
"parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
@@ -17953,6 +18556,7 @@ async function getButtonActions(props, mode) {
|
|
|
17953
18556
|
"__parentForm": parentFormData,
|
|
17954
18557
|
"_master": "${_master}",
|
|
17955
18558
|
"global": "${global}",
|
|
18559
|
+
"context": "${context}",
|
|
17956
18560
|
"uiSchema": "${uiSchema}",
|
|
17957
18561
|
"index": "${index}",
|
|
17958
18562
|
"parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
@@ -18239,7 +18843,8 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
18239
18843
|
}
|
|
18240
18844
|
return value;
|
|
18241
18845
|
},
|
|
18242
|
-
"required": props.required
|
|
18846
|
+
"required": props.required,
|
|
18847
|
+
"description": props.description
|
|
18243
18848
|
};
|
|
18244
18849
|
if (buttonsForColumnOperations.length) {
|
|
18245
18850
|
inputTableSchema.columns.unshift({
|
|
@@ -21110,6 +21715,7 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
|
|
|
21110
21715
|
setUISchemaFunction: setUISchemaFunction,
|
|
21111
21716
|
setVariable: setVariable,
|
|
21112
21717
|
standardButtonsTodo: standardButtonsTodo,
|
|
21718
|
+
uuidv4: uuidv4,
|
|
21113
21719
|
i18next: instance
|
|
21114
21720
|
});
|
|
21115
21721
|
|
|
@@ -21387,7 +21993,12 @@ var SteedosDropdownButton = function (props) {
|
|
|
21387
21993
|
}
|
|
21388
21994
|
}
|
|
21389
21995
|
};
|
|
21390
|
-
return (React__default["default"].createElement(antd.Dropdown, { menu: { items: menu }, trigger: trigger, onOpenChange: onOpenChange, placement: placement, overlayClassName: overlayClassName, arrow: arrow
|
|
21996
|
+
return (React__default["default"].createElement(antd.Dropdown, { menu: { items: menu }, trigger: trigger, onOpenChange: onOpenChange, placement: placement, overlayClassName: overlayClassName, arrow: arrow, getPopupContainer: function (button) {
|
|
21997
|
+
// 未配置getPopupContainer属性时,默认container为body,这里判断到dropdown button是在drawer中时,统一把container配置为drawer本身
|
|
21998
|
+
// 这样就可以解决drawer内点击dropdown button组件下拉菜单中的按钮时不应该自动关闭drawer的问题
|
|
21999
|
+
var drawerBody = window.$(button).closest(".amis-dialog-widget .antd-Drawer-body")[0];
|
|
22000
|
+
return drawerBody || document.querySelector("body");
|
|
22001
|
+
} },
|
|
21391
22002
|
React__default["default"].createElement("button", { className: "slds-button slds-button_icon slds-button_icon-border-filled slds-button_icon-x-small ".concat(className ? className : '') },
|
|
21392
22003
|
React__default["default"].createElement("svg", { className: "w-4 h-4 fill-gray-500" },
|
|
21393
22004
|
React__default["default"].createElement("use", { xlinkHref: "/assets/icons/utility-sprite/svg/symbols.svg#down" })))));
|
|
@@ -21966,7 +22577,7 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
|
|
|
21966
22577
|
return __generator(this, function (_d) {
|
|
21967
22578
|
switch (_d.label) {
|
|
21968
22579
|
case 0:
|
|
21969
|
-
_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;
|
|
22580
|
+
_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;
|
|
21970
22581
|
return [4 /*yield*/, getUISchema(props.objectApiName || "space_users", false)];
|
|
21971
22582
|
case 1:
|
|
21972
22583
|
_d.sent();
|
|
@@ -21976,7 +22587,7 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
|
|
|
21976
22587
|
return [4 /*yield*/, getRecordDetailHeaderSchema(objectApiName, recordId, { showRecordTitle: showRecordTitle, formFactor: props.data.formFactor, showButtons: showButtons, showBackButton: showBackButton, display: props.data.display, _inDrawer: props.data._inDrawer })];
|
|
21977
22588
|
case 2:
|
|
21978
22589
|
schema = (_d.sent()).amisSchema;
|
|
21979
|
-
schema.className
|
|
22590
|
+
schema.className += " " + className;
|
|
21980
22591
|
config = Object.assign({}, schema, { onEvent: onEvent });
|
|
21981
22592
|
if (!(schemaFilter && typeof schemaFilter === 'string')) return [3 /*break*/, 6];
|
|
21982
22593
|
schemaFilterFun = new Function('config', 'props', schemaFilter);
|
|
@@ -22268,12 +22879,12 @@ var AmisProvider = function (props) { return __awaiter(void 0, void 0, void 0, f
|
|
|
22268
22879
|
/*
|
|
22269
22880
|
* @Author: baozhoutao@steedos.com
|
|
22270
22881
|
* @Date: 2022-09-01 14:44:57
|
|
22271
|
-
* @LastEditors:
|
|
22272
|
-
* @LastEditTime: 2024-
|
|
22882
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
22883
|
+
* @LastEditTime: 2024-05-14 15:12:49
|
|
22273
22884
|
* @Description:
|
|
22274
22885
|
*/
|
|
22275
22886
|
var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22276
|
-
var app, data, className, _a, showAppName, _b, appNameClassName, _c, customElements, _d, showAppIcon, formFactor, isMobile, on_click_script, mobile_blank_script, dialogSchema, badgeText;
|
|
22887
|
+
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, overlaySchema;
|
|
22277
22888
|
return __generator(this, function (_e) {
|
|
22278
22889
|
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;
|
|
22279
22890
|
if (!app) {
|
|
@@ -22283,117 +22894,15 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
22283
22894
|
isMobile = formFactor === "SMALL" ? true : false;
|
|
22284
22895
|
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 ";
|
|
22285
22896
|
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 ";
|
|
22897
|
+
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 ";
|
|
22898
|
+
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 ");
|
|
22899
|
+
mobileInitApiAdaptorScript = "\n let app_items = payload;\n ".concat(convertAppVisibleOnScript, "\n payload = {\n app_items\n }\n return payload;\n ");
|
|
22286
22900
|
dialogSchema = {};
|
|
22287
22901
|
badgeText = "${IF(${id} == 'approve_workflow',${ss:keyvalues.badge.value|pick:'workflow'},${ss:keyvalues.badge.value|pick:${id}}) | toInt}";
|
|
22288
|
-
if (isMobile) {
|
|
22902
|
+
if (!isMobile) {
|
|
22289
22903
|
dialogSchema = {
|
|
22290
22904
|
"type": "service",
|
|
22291
|
-
"
|
|
22292
|
-
"affixFooter": false,
|
|
22293
|
-
"body": [
|
|
22294
|
-
{
|
|
22295
|
-
"type": "each",
|
|
22296
|
-
"name": "app_items",
|
|
22297
|
-
"items": {
|
|
22298
|
-
"type": "button",
|
|
22299
|
-
"level": "link",
|
|
22300
|
-
"body": [
|
|
22301
|
-
{
|
|
22302
|
-
"type": "tpl",
|
|
22303
|
-
"tpl": "<div class='flex flex-col justify-center'><div class='text-center'><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></div><div class='text-center text-lg'>${name}</div></div>",
|
|
22304
|
-
"badge": {
|
|
22305
|
-
"mode": "text",
|
|
22306
|
-
"text": badgeText,
|
|
22307
|
-
"visibleOn": badgeText,
|
|
22308
|
-
"overflowCount": 99,
|
|
22309
|
-
"style": {
|
|
22310
|
-
"right": "50%",
|
|
22311
|
-
"margin-right": "-23px",
|
|
22312
|
-
"height": "20px",
|
|
22313
|
-
"border-radius": "10px",
|
|
22314
|
-
"font-size": "16px",
|
|
22315
|
-
"line-height": "18px"
|
|
22316
|
-
}
|
|
22317
|
-
}
|
|
22318
|
-
}
|
|
22319
|
-
],
|
|
22320
|
-
"onEvent": {
|
|
22321
|
-
"click": {
|
|
22322
|
-
"actions": [
|
|
22323
|
-
{
|
|
22324
|
-
"actionType": "closeDialog"
|
|
22325
|
-
},
|
|
22326
|
-
{
|
|
22327
|
-
"actionType": "link",
|
|
22328
|
-
"args": {
|
|
22329
|
-
"link": "${path}"
|
|
22330
|
-
},
|
|
22331
|
-
"expression": "${AND(!blank , !on_click)}"
|
|
22332
|
-
},
|
|
22333
|
-
{
|
|
22334
|
-
"actionType": "custom",
|
|
22335
|
-
"script": mobile_blank_script,
|
|
22336
|
-
"expression": "${AND(blank , !on_click)}"
|
|
22337
|
-
},
|
|
22338
|
-
{
|
|
22339
|
-
"actionType": "custom",
|
|
22340
|
-
"script": on_click_script,
|
|
22341
|
-
"expression": "${on_click}"
|
|
22342
|
-
}
|
|
22343
|
-
]
|
|
22344
|
-
}
|
|
22345
|
-
},
|
|
22346
|
-
"className": "block w-1/3 py-4",
|
|
22347
|
-
"style": {
|
|
22348
|
-
"display": "inline-flex",
|
|
22349
|
-
"justify-content": "center"
|
|
22350
|
-
}
|
|
22351
|
-
},
|
|
22352
|
-
"className": "flex flex-wrap",
|
|
22353
|
-
"id": "u:a98e9f6fb4db"
|
|
22354
|
-
}
|
|
22355
|
-
],
|
|
22356
|
-
"clearValueOnHidden": false,
|
|
22357
|
-
"visible": true,
|
|
22358
|
-
"messages": {},
|
|
22359
|
-
"api": {
|
|
22360
|
-
"method": "get",
|
|
22361
|
-
"url": "${context.rootUrl}/service/api/apps/menus?mobile=true",
|
|
22362
|
-
"headers": {
|
|
22363
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22364
|
-
},
|
|
22365
|
-
"adaptor": "\nlet app_items = payload;\npayload = {\n app_items\n}\nreturn payload;",
|
|
22366
|
-
"messages": {}
|
|
22367
|
-
},
|
|
22368
|
-
"onEvent": {
|
|
22369
|
-
"@data.changed.steedos_keyvalues": {
|
|
22370
|
-
"actions": [
|
|
22371
|
-
{
|
|
22372
|
-
"actionType": "reload"
|
|
22373
|
-
}
|
|
22374
|
-
]
|
|
22375
|
-
},
|
|
22376
|
-
"fetchInited": {
|
|
22377
|
-
"actions": [
|
|
22378
|
-
{
|
|
22379
|
-
"actionType": "broadcast",
|
|
22380
|
-
"args": {
|
|
22381
|
-
"eventName": "@appsLoaded"
|
|
22382
|
-
},
|
|
22383
|
-
"data": {
|
|
22384
|
-
"apps": "${event.data.app_items}"
|
|
22385
|
-
}
|
|
22386
|
-
}
|
|
22387
|
-
]
|
|
22388
|
-
}
|
|
22389
|
-
},
|
|
22390
|
-
"id": "u:2c8bd22d4ea8"
|
|
22391
|
-
};
|
|
22392
|
-
}
|
|
22393
|
-
else {
|
|
22394
|
-
dialogSchema = {
|
|
22395
|
-
"type": "service",
|
|
22396
|
-
"id": "u:0f6224a0836f",
|
|
22905
|
+
"id": "u:0f6224a0836f",
|
|
22397
22906
|
"affixFooter": false,
|
|
22398
22907
|
"body": [
|
|
22399
22908
|
{
|
|
@@ -22411,63 +22920,64 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
22411
22920
|
{
|
|
22412
22921
|
"type": "each",
|
|
22413
22922
|
"name": "app_items",
|
|
22414
|
-
"items": {
|
|
22415
|
-
|
|
22416
|
-
|
|
22417
|
-
|
|
22418
|
-
|
|
22419
|
-
|
|
22420
|
-
|
|
22421
|
-
|
|
22422
|
-
|
|
22423
|
-
|
|
22424
|
-
|
|
22425
|
-
|
|
22426
|
-
|
|
22427
|
-
|
|
22428
|
-
|
|
22429
|
-
|
|
22430
|
-
|
|
22431
|
-
|
|
22432
|
-
|
|
22433
|
-
|
|
22434
|
-
|
|
22923
|
+
"items": [{
|
|
22924
|
+
"type": "button",
|
|
22925
|
+
"level": "link",
|
|
22926
|
+
"body": [{
|
|
22927
|
+
"type": "tpl",
|
|
22928
|
+
"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>",
|
|
22929
|
+
"badge": {
|
|
22930
|
+
"mode": "text",
|
|
22931
|
+
"text": badgeText,
|
|
22932
|
+
"visibleOn": badgeText,
|
|
22933
|
+
"className": "w-full",
|
|
22934
|
+
"overflowCount": 99,
|
|
22935
|
+
"style": {
|
|
22936
|
+
"top": "20px",
|
|
22937
|
+
"left": "37px",
|
|
22938
|
+
"height": "20px",
|
|
22939
|
+
"border-radius": "10px",
|
|
22940
|
+
"line-height": "18px",
|
|
22941
|
+
"margin-left": "${" + badgeText + ">9?(" + badgeText + ">99?'-21px':'-11px'):'0'}",
|
|
22942
|
+
"right": "auto",
|
|
22943
|
+
"font-size": "16px"
|
|
22944
|
+
}
|
|
22435
22945
|
}
|
|
22436
|
-
}
|
|
22437
|
-
|
|
22438
|
-
|
|
22439
|
-
|
|
22440
|
-
|
|
22441
|
-
|
|
22442
|
-
"actionType": "closeDialog"
|
|
22443
|
-
},
|
|
22444
|
-
{
|
|
22445
|
-
"actionType": "link",
|
|
22446
|
-
"args": {
|
|
22447
|
-
"link": "${path}"
|
|
22946
|
+
}],
|
|
22947
|
+
"onEvent": {
|
|
22948
|
+
"click": {
|
|
22949
|
+
"actions": [
|
|
22950
|
+
{
|
|
22951
|
+
"actionType": "closeDialog"
|
|
22448
22952
|
},
|
|
22449
|
-
|
|
22450
|
-
|
|
22451
|
-
|
|
22452
|
-
|
|
22453
|
-
|
|
22454
|
-
"
|
|
22455
|
-
"blank": true
|
|
22953
|
+
{
|
|
22954
|
+
"actionType": "link",
|
|
22955
|
+
"args": {
|
|
22956
|
+
"link": "${path}"
|
|
22957
|
+
},
|
|
22958
|
+
"expression": "${AND(!blank , !on_click)}"
|
|
22456
22959
|
},
|
|
22457
|
-
|
|
22458
|
-
|
|
22459
|
-
|
|
22460
|
-
|
|
22461
|
-
|
|
22462
|
-
|
|
22463
|
-
|
|
22464
|
-
|
|
22465
|
-
|
|
22466
|
-
|
|
22467
|
-
|
|
22468
|
-
|
|
22469
|
-
|
|
22470
|
-
|
|
22960
|
+
{
|
|
22961
|
+
"actionType": "url",
|
|
22962
|
+
"args": {
|
|
22963
|
+
"url": "${path}",
|
|
22964
|
+
"blank": true
|
|
22965
|
+
},
|
|
22966
|
+
"expression": "${AND(blank , !on_click)}"
|
|
22967
|
+
},
|
|
22968
|
+
{
|
|
22969
|
+
"actionType": "custom",
|
|
22970
|
+
"script": on_click_script,
|
|
22971
|
+
"expression": "${!!on_click}"
|
|
22972
|
+
}
|
|
22973
|
+
]
|
|
22974
|
+
}
|
|
22975
|
+
},
|
|
22976
|
+
"inline": true,
|
|
22977
|
+
"style": {},
|
|
22978
|
+
"visibleOn": "${visible_on}",
|
|
22979
|
+
"className": "slds-p-horizontal_small slds-size_1-of-1 slds-medium-size_1-of-3"
|
|
22980
|
+
}],
|
|
22471
22981
|
"className": "slds-grid slds-wrap slds-grid_pull-padded"
|
|
22472
22982
|
}
|
|
22473
22983
|
]
|
|
@@ -22552,20 +23062,149 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
22552
23062
|
},
|
|
22553
23063
|
"api": {
|
|
22554
23064
|
"method": "get",
|
|
23065
|
+
"cache": "10000",
|
|
22555
23066
|
"url": "${context.rootUrl}/service/api/apps/menus?mobile=" + isMobile,
|
|
22556
23067
|
"data": null,
|
|
22557
23068
|
"headers": {
|
|
22558
23069
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22559
23070
|
},
|
|
22560
|
-
"adaptor":
|
|
23071
|
+
"adaptor": pcInitApiAdaptorScript
|
|
22561
23072
|
}
|
|
22562
23073
|
};
|
|
22563
23074
|
}
|
|
23075
|
+
overlaySchema = {
|
|
23076
|
+
"type": "service",
|
|
23077
|
+
"className": isMobile ? "steedos-apps-service" : "steedos-apps-service w-96",
|
|
23078
|
+
"affixFooter": false,
|
|
23079
|
+
"body": [
|
|
23080
|
+
{
|
|
23081
|
+
"type": "each",
|
|
23082
|
+
"source": isMobile ? "${app_items}" : "${ARRAYFILTER(app_items, (item,index) => index<=8)}",
|
|
23083
|
+
"items": {
|
|
23084
|
+
"type": "button",
|
|
23085
|
+
"level": "link",
|
|
23086
|
+
"body": [
|
|
23087
|
+
{
|
|
23088
|
+
"type": "tpl",
|
|
23089
|
+
"tpl": "<div class='flex flex-col justify-center'><div class='text-center'><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></div><div class='text-center text-lg'>${name}</div></div>",
|
|
23090
|
+
"badge": {
|
|
23091
|
+
"mode": "text",
|
|
23092
|
+
"text": badgeText,
|
|
23093
|
+
"visibleOn": badgeText,
|
|
23094
|
+
"overflowCount": 99,
|
|
23095
|
+
"style": {
|
|
23096
|
+
"right": "50%",
|
|
23097
|
+
"margin-right": "-23px",
|
|
23098
|
+
"height": "20px",
|
|
23099
|
+
"border-radius": "10px",
|
|
23100
|
+
"font-size": "16px",
|
|
23101
|
+
"line-height": "18px"
|
|
23102
|
+
}
|
|
23103
|
+
}
|
|
23104
|
+
}
|
|
23105
|
+
],
|
|
23106
|
+
"onEvent": {
|
|
23107
|
+
"click": {
|
|
23108
|
+
"actions": [
|
|
23109
|
+
{
|
|
23110
|
+
"actionType": "closeDialog"
|
|
23111
|
+
},
|
|
23112
|
+
{
|
|
23113
|
+
"actionType": "link",
|
|
23114
|
+
"args": {
|
|
23115
|
+
"link": "${path}"
|
|
23116
|
+
},
|
|
23117
|
+
"expression": "${AND(!blank , !on_click)}"
|
|
23118
|
+
},
|
|
23119
|
+
{
|
|
23120
|
+
"actionType": "custom",
|
|
23121
|
+
"script": mobile_blank_script,
|
|
23122
|
+
"expression": "${AND(blank , !on_click)}"
|
|
23123
|
+
},
|
|
23124
|
+
{
|
|
23125
|
+
"actionType": "custom",
|
|
23126
|
+
"script": on_click_script,
|
|
23127
|
+
"expression": "${on_click}"
|
|
23128
|
+
}
|
|
23129
|
+
]
|
|
23130
|
+
}
|
|
23131
|
+
},
|
|
23132
|
+
"visibleOn": "${visible_on}",
|
|
23133
|
+
"className": "block w-1/3 py-4",
|
|
23134
|
+
"style": {
|
|
23135
|
+
"display": "inline-flex",
|
|
23136
|
+
"justify-content": "center"
|
|
23137
|
+
}
|
|
23138
|
+
},
|
|
23139
|
+
"className": "flex flex-wrap",
|
|
23140
|
+
"id": "u:a98e9f6fb4db"
|
|
23141
|
+
},
|
|
23142
|
+
isMobile ? null : {
|
|
23143
|
+
"type": "divider",
|
|
23144
|
+
"className": "m-0"
|
|
23145
|
+
},
|
|
23146
|
+
isMobile ? null : {
|
|
23147
|
+
"type": "button",
|
|
23148
|
+
"level": "link",
|
|
23149
|
+
"label": "更多",
|
|
23150
|
+
"className": "w-full h-10",
|
|
23151
|
+
"actionType": "dialog",
|
|
23152
|
+
"dialog": {
|
|
23153
|
+
"size": "xl",
|
|
23154
|
+
"title": {
|
|
23155
|
+
"type": "tpl",
|
|
23156
|
+
"tpl": instance.t('frontend_application_launcher'),
|
|
23157
|
+
"className": "block text-xl text-center"
|
|
23158
|
+
},
|
|
23159
|
+
"actions": [],
|
|
23160
|
+
"body": [
|
|
23161
|
+
dialogSchema
|
|
23162
|
+
]
|
|
23163
|
+
}
|
|
23164
|
+
}
|
|
23165
|
+
],
|
|
23166
|
+
"clearValueOnHidden": false,
|
|
23167
|
+
"visible": true,
|
|
23168
|
+
"messages": {},
|
|
23169
|
+
"api": {
|
|
23170
|
+
"method": "get",
|
|
23171
|
+
"cache": "10000",
|
|
23172
|
+
"url": "${context.rootUrl}/service/api/apps/menus?mobile=true",
|
|
23173
|
+
"headers": {
|
|
23174
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23175
|
+
},
|
|
23176
|
+
"adaptor": mobileInitApiAdaptorScript,
|
|
23177
|
+
"messages": {}
|
|
23178
|
+
},
|
|
23179
|
+
"onEvent": {
|
|
23180
|
+
"@data.changed.steedos_keyvalues": {
|
|
23181
|
+
"actions": [
|
|
23182
|
+
{
|
|
23183
|
+
"actionType": "reload"
|
|
23184
|
+
}
|
|
23185
|
+
]
|
|
23186
|
+
},
|
|
23187
|
+
"fetchInited": {
|
|
23188
|
+
"actions": [
|
|
23189
|
+
{
|
|
23190
|
+
"actionType": "broadcast",
|
|
23191
|
+
"args": {
|
|
23192
|
+
"eventName": "@appsLoaded"
|
|
23193
|
+
},
|
|
23194
|
+
"data": {
|
|
23195
|
+
"apps": "${event.data.app_items}"
|
|
23196
|
+
}
|
|
23197
|
+
}
|
|
23198
|
+
]
|
|
23199
|
+
}
|
|
23200
|
+
},
|
|
23201
|
+
"id": "u:2c8bd22d4ea8"
|
|
23202
|
+
};
|
|
22564
23203
|
return [2 /*return*/, {
|
|
22565
23204
|
"type": "service",
|
|
22566
23205
|
className: className,
|
|
22567
23206
|
"body": [
|
|
22568
|
-
{
|
|
23207
|
+
isMobile ? {
|
|
22569
23208
|
"type": "button",
|
|
22570
23209
|
"actionType": "dialog",
|
|
22571
23210
|
"className": "flex items-center",
|
|
@@ -22600,10 +23239,43 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
22600
23239
|
},
|
|
22601
23240
|
"actions": [],
|
|
22602
23241
|
"body": [
|
|
22603
|
-
|
|
23242
|
+
overlaySchema
|
|
22604
23243
|
]
|
|
22605
23244
|
},
|
|
22606
23245
|
"id": "u:b5dc095e1c11"
|
|
23246
|
+
} : {
|
|
23247
|
+
"type": "steedos-dropdown",
|
|
23248
|
+
"placement": "bottomRight",
|
|
23249
|
+
"trigger": [
|
|
23250
|
+
"click"
|
|
23251
|
+
],
|
|
23252
|
+
"body": __spreadArray([
|
|
23253
|
+
{
|
|
23254
|
+
"type": "tpl",
|
|
23255
|
+
"className": "flex items-center",
|
|
23256
|
+
"tpl": "<div aria-haspopup='true' title='".concat(instance.t('frontend_open_app_launcher'), "' class='slds-icon-waffle_container slds-context-bar__button' type='button'><span class='slds-icon-waffle'><span class='slds-r1'></span><span class='slds-r2'></span><span class='slds-r3'></span><span class='slds-r4'></span><span class='slds-r5'></span><span class='slds-r6'></span><span class='slds-r7'></span><span class='slds-r8'></span><span class='slds-r9'></span></span></div>"),
|
|
23257
|
+
"badge": {
|
|
23258
|
+
"visibleOn": "${ss:keyvalues.badge.value.workflow | toInt}",
|
|
23259
|
+
"offset": [3, -3],
|
|
23260
|
+
"style": {
|
|
23261
|
+
"width": "8px",
|
|
23262
|
+
"height": "8px"
|
|
23263
|
+
}
|
|
23264
|
+
},
|
|
23265
|
+
"hiddenOn": "".concat(!showAppIcon)
|
|
23266
|
+
},
|
|
23267
|
+
{
|
|
23268
|
+
type: 'tpl',
|
|
23269
|
+
className: "text-xl ml-4 mr-4 text-black nowrap ".concat(appNameClassName, " "),
|
|
23270
|
+
tpl: '${app.name}',
|
|
23271
|
+
hiddenOn: "".concat(!!app || !!!showAppName)
|
|
23272
|
+
}
|
|
23273
|
+
], __read(customElements), false),
|
|
23274
|
+
"overlay": [
|
|
23275
|
+
overlaySchema
|
|
23276
|
+
],
|
|
23277
|
+
"className": "flex items-center",
|
|
23278
|
+
"open": false
|
|
22607
23279
|
}
|
|
22608
23280
|
],
|
|
22609
23281
|
"id": "u:06ee48db134a",
|
|
@@ -22718,21 +23390,261 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22718
23390
|
"headers": {
|
|
22719
23391
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22720
23392
|
}
|
|
22721
|
-
}
|
|
22722
|
-
};
|
|
22723
|
-
}
|
|
22724
|
-
console.log("payload===>", schema);
|
|
22725
|
-
return [2 /*return*/, schema];
|
|
22726
|
-
});
|
|
22727
|
-
}); };
|
|
22728
|
-
|
|
22729
|
-
/*
|
|
22730
|
-
* @Author: baozhoutao@steedos.com
|
|
22731
|
-
* @Date: 2022-09-01 14:44:57
|
|
22732
|
-
* @LastEditors:
|
|
22733
|
-
* @LastEditTime: 2024-
|
|
22734
|
-
* @Description:
|
|
22735
|
-
*/
|
|
23393
|
+
}
|
|
23394
|
+
};
|
|
23395
|
+
}
|
|
23396
|
+
console.log("payload===>", schema);
|
|
23397
|
+
return [2 /*return*/, schema];
|
|
23398
|
+
});
|
|
23399
|
+
}); };
|
|
23400
|
+
|
|
23401
|
+
/*
|
|
23402
|
+
* @Author: baozhoutao@steedos.com
|
|
23403
|
+
* @Date: 2022-09-01 14:44:57
|
|
23404
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
23405
|
+
* @LastEditTime: 2024-05-29 11:45:57
|
|
23406
|
+
* @Description:
|
|
23407
|
+
*/
|
|
23408
|
+
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";
|
|
23409
|
+
var getNotificationBadgeButton = function () {
|
|
23410
|
+
var isMobile = window.innerWidth < 768;
|
|
23411
|
+
var listContent = {
|
|
23412
|
+
"type": "page",
|
|
23413
|
+
"body": [
|
|
23414
|
+
{
|
|
23415
|
+
"type": "service",
|
|
23416
|
+
"className": "service-global-header-notifications-list",
|
|
23417
|
+
"body": [
|
|
23418
|
+
{
|
|
23419
|
+
"type": "panel",
|
|
23420
|
+
"title": instance.t('frontend_notifications'),
|
|
23421
|
+
"className": "steedos-header-toolbar-notifications-panel " + (isMobile ? "" : "min-w-[300px] max-w-md"),
|
|
23422
|
+
"body": [
|
|
23423
|
+
{
|
|
23424
|
+
"type": "each",
|
|
23425
|
+
"className": "overflow-auto max-h-96 steedos-header-toolbar-notifications-list",
|
|
23426
|
+
"name": "notifications",
|
|
23427
|
+
"items": {
|
|
23428
|
+
"type": "tpl",
|
|
23429
|
+
"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>",
|
|
23430
|
+
"id": "u:07ece657c7b7",
|
|
23431
|
+
"onEvent": {
|
|
23432
|
+
"click": {
|
|
23433
|
+
"weight": 0,
|
|
23434
|
+
"actions": [
|
|
23435
|
+
{
|
|
23436
|
+
"args": {
|
|
23437
|
+
"options": {},
|
|
23438
|
+
"api": {
|
|
23439
|
+
"url": "${context.rootUrl}/api/v4/notifications/${_id}/read?rootUrl=&appId=${appId}&async=true",
|
|
23440
|
+
"method": "get",
|
|
23441
|
+
"messages": {},
|
|
23442
|
+
"headers": {
|
|
23443
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23444
|
+
},
|
|
23445
|
+
"adaptor": "payload = {\n status: 0,\n msg: '',\n data: {\n redirect: payload.redirect || payload \n }} \nreturn payload;"
|
|
23446
|
+
// "adaptor": notificationReadAdaptor
|
|
23447
|
+
}
|
|
23448
|
+
},
|
|
23449
|
+
"actionType": "ajax"
|
|
23450
|
+
},
|
|
23451
|
+
// {
|
|
23452
|
+
// "actionType": "custom",
|
|
23453
|
+
// "script": "if(Meteor.isCordova){window.open(Meteor.absoluteUrl(event.data.responseResult.responseData.redirect), '_blank')}else{window.open(event.data.responseResult.responseData.redirect, '_blank')}",
|
|
23454
|
+
// "expression": "${!!event.data.responseResult.responseData.redirect}",
|
|
23455
|
+
// },
|
|
23456
|
+
{
|
|
23457
|
+
// PC端保持原样,新窗口打开
|
|
23458
|
+
"actionType": "custom",
|
|
23459
|
+
"script": "window.open(event.data.responseResult.responseData.redirect, '_blank')",
|
|
23460
|
+
"expression": "${!!event.data.responseResult.responseData.redirect && window:innerWidth > 768}"
|
|
23461
|
+
},
|
|
23462
|
+
{
|
|
23463
|
+
// 手机端改为直接跳路由,因为新窗口打开顶部会显示url地址栏
|
|
23464
|
+
"actionType": "link",
|
|
23465
|
+
"args": {
|
|
23466
|
+
"link": "${redirect}"
|
|
23467
|
+
},
|
|
23468
|
+
"expression": "${!!event.data.responseResult.responseData.redirect && window:innerWidth <= 768}"
|
|
23469
|
+
},
|
|
23470
|
+
{
|
|
23471
|
+
"actionType": "cancel",
|
|
23472
|
+
"componentId": "steedos_header_toolbar_notifications_dialog",
|
|
23473
|
+
"expression": "${!!event.data.responseResult.responseData.redirect && window:innerWidth <= 768}"
|
|
23474
|
+
}
|
|
23475
|
+
]
|
|
23476
|
+
}
|
|
23477
|
+
}
|
|
23478
|
+
},
|
|
23479
|
+
"id": "u:18da41dab9ca"
|
|
23480
|
+
},
|
|
23481
|
+
],
|
|
23482
|
+
actions: [
|
|
23483
|
+
{
|
|
23484
|
+
"type": "button",
|
|
23485
|
+
"label": instance.t('frontend_notifications_close_dialog'),
|
|
23486
|
+
"visibleOn": "${window:innerWidth <= 768}",
|
|
23487
|
+
"close": true
|
|
23488
|
+
},
|
|
23489
|
+
{
|
|
23490
|
+
"type": "button",
|
|
23491
|
+
"label": instance.t('frontend_notifications_allread'),
|
|
23492
|
+
"id": "u:5530f3779e3a",
|
|
23493
|
+
"onEvent": {
|
|
23494
|
+
"click": {
|
|
23495
|
+
"actions": [
|
|
23496
|
+
{
|
|
23497
|
+
"actionType": "custom",
|
|
23498
|
+
"script": beforeMarkReadAllScript
|
|
23499
|
+
},
|
|
23500
|
+
{
|
|
23501
|
+
"componentId": "",
|
|
23502
|
+
"args": {
|
|
23503
|
+
"api": {
|
|
23504
|
+
"url": "${context.rootUrl}/api/v4/notifications/all/markReadAll",
|
|
23505
|
+
"method": "post",
|
|
23506
|
+
"headers": {
|
|
23507
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23508
|
+
}
|
|
23509
|
+
},
|
|
23510
|
+
"messages": {
|
|
23511
|
+
"success": instance.t('frontend_notifications_allread_message')
|
|
23512
|
+
}
|
|
23513
|
+
},
|
|
23514
|
+
"actionType": "ajax"
|
|
23515
|
+
},
|
|
23516
|
+
{
|
|
23517
|
+
"componentId": "service_global_header_notifications_unread_count",
|
|
23518
|
+
"actionType": "reload",
|
|
23519
|
+
"expression": "${needToReload}"
|
|
23520
|
+
},
|
|
23521
|
+
{
|
|
23522
|
+
"componentId": "service_global_header_notifications_list",
|
|
23523
|
+
"actionType": "reload",
|
|
23524
|
+
"expression": "${needToReload}"
|
|
23525
|
+
}
|
|
23526
|
+
],
|
|
23527
|
+
"weight": 0
|
|
23528
|
+
}
|
|
23529
|
+
}
|
|
23530
|
+
}
|
|
23531
|
+
]
|
|
23532
|
+
},
|
|
23533
|
+
],
|
|
23534
|
+
"id": "service_global_header_notifications_list",
|
|
23535
|
+
"onEvent": {
|
|
23536
|
+
"@data.changed.notifications": {
|
|
23537
|
+
"actions": [
|
|
23538
|
+
{
|
|
23539
|
+
"actionType": "reload"
|
|
23540
|
+
}
|
|
23541
|
+
]
|
|
23542
|
+
}
|
|
23543
|
+
},
|
|
23544
|
+
"messages": {},
|
|
23545
|
+
"api": {
|
|
23546
|
+
"method": "post",
|
|
23547
|
+
"url": "${context.rootUrl}/graphql",
|
|
23548
|
+
"data": {
|
|
23549
|
+
"&": "$$",
|
|
23550
|
+
"context": "${context}",
|
|
23551
|
+
"userId": "${context.userId}"
|
|
23552
|
+
},
|
|
23553
|
+
"dataType": "json",
|
|
23554
|
+
"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}",
|
|
23555
|
+
"headers": {
|
|
23556
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23557
|
+
},
|
|
23558
|
+
"adaptor": "return payload.data"
|
|
23559
|
+
},
|
|
23560
|
+
}
|
|
23561
|
+
],
|
|
23562
|
+
"onEvent": {
|
|
23563
|
+
"init": {
|
|
23564
|
+
"actions": [
|
|
23565
|
+
{
|
|
23566
|
+
"actionType": "custom",
|
|
23567
|
+
"script": "window.$('.service-global-header-notifications-list').closest('.amis-dialog-widget').addClass('steedos-header-toolbar-notifications-dialog');"
|
|
23568
|
+
}
|
|
23569
|
+
]
|
|
23570
|
+
}
|
|
23571
|
+
},
|
|
23572
|
+
"bodyClassName": "p-0"
|
|
23573
|
+
};
|
|
23574
|
+
var badgeButtonContent = {
|
|
23575
|
+
"type": "service",
|
|
23576
|
+
"body": [
|
|
23577
|
+
{
|
|
23578
|
+
"type": "steedos-badge",
|
|
23579
|
+
"body": [
|
|
23580
|
+
{
|
|
23581
|
+
"type": "steedos-icon",
|
|
23582
|
+
"category": "utility",
|
|
23583
|
+
"name": "notification",
|
|
23584
|
+
"colorVariant": "default",
|
|
23585
|
+
"className": "slds-button_icon slds-global-header__icon"
|
|
23586
|
+
}
|
|
23587
|
+
],
|
|
23588
|
+
"count": "${unReadCount}"
|
|
23589
|
+
},
|
|
23590
|
+
],
|
|
23591
|
+
"id": "service_global_header_notifications_unread_count",
|
|
23592
|
+
"messages": {},
|
|
23593
|
+
"api": {
|
|
23594
|
+
"method": "post",
|
|
23595
|
+
"url": "${context.rootUrl}/graphql",
|
|
23596
|
+
"data": {
|
|
23597
|
+
"&": "$$",
|
|
23598
|
+
"context": "${context}",
|
|
23599
|
+
"userId": "${context.userId}"
|
|
23600
|
+
},
|
|
23601
|
+
"dataType": "json",
|
|
23602
|
+
"requestAdaptor": "const { userId } = api.data;\napi.data = {\n query: `{\n unReadCount: notifications__count(filters: [[\"owner\",\"=\",\"${userId}\"], [\"is_read\", \"!=\", true]])\n }`\n}",
|
|
23603
|
+
"headers": {
|
|
23604
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23605
|
+
},
|
|
23606
|
+
"adaptor": "return payload.data"
|
|
23607
|
+
},
|
|
23608
|
+
"onEvent": {
|
|
23609
|
+
"@data.changed.notifications": {
|
|
23610
|
+
"actions": [
|
|
23611
|
+
{
|
|
23612
|
+
"actionType": "reload"
|
|
23613
|
+
}
|
|
23614
|
+
]
|
|
23615
|
+
}
|
|
23616
|
+
},
|
|
23617
|
+
// "interval": 30000,
|
|
23618
|
+
"silentPolling": true
|
|
23619
|
+
};
|
|
23620
|
+
return isMobile ? {
|
|
23621
|
+
"type": "button",
|
|
23622
|
+
"body": badgeButtonContent,
|
|
23623
|
+
"actionType": "dialog",
|
|
23624
|
+
"dialog": {
|
|
23625
|
+
"title": "",
|
|
23626
|
+
"id": "steedos_header_toolbar_notifications_dialog",
|
|
23627
|
+
"body": listContent,
|
|
23628
|
+
"actions": [],
|
|
23629
|
+
"showCloseButton": false,
|
|
23630
|
+
"closeOnOutside": true
|
|
23631
|
+
}
|
|
23632
|
+
} : {
|
|
23633
|
+
"type": "steedos-dropdown",
|
|
23634
|
+
"placement": "bottomRight",
|
|
23635
|
+
"trigger": [
|
|
23636
|
+
"click"
|
|
23637
|
+
],
|
|
23638
|
+
"body": [
|
|
23639
|
+
badgeButtonContent
|
|
23640
|
+
],
|
|
23641
|
+
"overlay": [
|
|
23642
|
+
listContent
|
|
23643
|
+
],
|
|
23644
|
+
"className": "antd-Action steedos-header-toolbar-notifications",
|
|
23645
|
+
"open": false
|
|
23646
|
+
};
|
|
23647
|
+
};
|
|
22736
23648
|
var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22737
23649
|
var _a, className, data, _b, logoutScript, _c, customButtons, avatarSrc;
|
|
22738
23650
|
var _d, _e;
|
|
@@ -22758,7 +23670,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
22758
23670
|
{
|
|
22759
23671
|
"componentId": "",
|
|
22760
23672
|
"args": {
|
|
22761
|
-
"url": "https://
|
|
23673
|
+
"url": "https://docs.steedos.com/zh-CN"
|
|
22762
23674
|
},
|
|
22763
23675
|
"actionType": "url"
|
|
22764
23676
|
}
|
|
@@ -22884,172 +23796,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
22884
23796
|
}
|
|
22885
23797
|
]
|
|
22886
23798
|
},
|
|
22887
|
-
|
|
22888
|
-
"type": "steedos-dropdown",
|
|
22889
|
-
"placement": "bottomRight",
|
|
22890
|
-
"trigger": [
|
|
22891
|
-
"click"
|
|
22892
|
-
],
|
|
22893
|
-
"body": [
|
|
22894
|
-
{
|
|
22895
|
-
"type": "service",
|
|
22896
|
-
"body": [
|
|
22897
|
-
{
|
|
22898
|
-
"type": "steedos-badge",
|
|
22899
|
-
"body": [
|
|
22900
|
-
{
|
|
22901
|
-
"type": "steedos-icon",
|
|
22902
|
-
"category": "utility",
|
|
22903
|
-
"name": "notification",
|
|
22904
|
-
"colorVariant": "default",
|
|
22905
|
-
"className": "slds-button_icon slds-global-header__icon"
|
|
22906
|
-
}
|
|
22907
|
-
],
|
|
22908
|
-
"count": "${unReadCount}"
|
|
22909
|
-
},
|
|
22910
|
-
],
|
|
22911
|
-
"id": "u:aba521eed5b7",
|
|
22912
|
-
"messages": {},
|
|
22913
|
-
"api": {
|
|
22914
|
-
"method": "post",
|
|
22915
|
-
"url": "${context.rootUrl}/graphql",
|
|
22916
|
-
"data": {
|
|
22917
|
-
"&": "$$",
|
|
22918
|
-
"context": "${context}",
|
|
22919
|
-
"userId": "${context.userId}"
|
|
22920
|
-
},
|
|
22921
|
-
"dataType": "json",
|
|
22922
|
-
"requestAdaptor": "const { userId } = api.data;\napi.data = {\n query: `{\n unReadCount: notifications__count(filters: [[\"owner\",\"=\",\"${userId}\"], [\"is_read\", \"!=\", true]])\n }`\n}",
|
|
22923
|
-
"headers": {
|
|
22924
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22925
|
-
},
|
|
22926
|
-
"adaptor": "return payload.data"
|
|
22927
|
-
},
|
|
22928
|
-
"onEvent": {
|
|
22929
|
-
"@data.changed.notifications": {
|
|
22930
|
-
"actions": [
|
|
22931
|
-
{
|
|
22932
|
-
"actionType": "reload"
|
|
22933
|
-
}
|
|
22934
|
-
]
|
|
22935
|
-
}
|
|
22936
|
-
},
|
|
22937
|
-
// "interval": 30000,
|
|
22938
|
-
"silentPolling": true
|
|
22939
|
-
}
|
|
22940
|
-
],
|
|
22941
|
-
"overlay": [
|
|
22942
|
-
{
|
|
22943
|
-
"type": "service",
|
|
22944
|
-
"body": [
|
|
22945
|
-
{
|
|
22946
|
-
"type": "panel",
|
|
22947
|
-
"title": instance.t('frontend_notifications'),
|
|
22948
|
-
"className": "min-w-[300px] max-w-md",
|
|
22949
|
-
"body": [
|
|
22950
|
-
{
|
|
22951
|
-
"type": "each",
|
|
22952
|
-
className: "overflow-auto max-h-96",
|
|
22953
|
-
"name": "notifications",
|
|
22954
|
-
"items": {
|
|
22955
|
-
"type": "tpl",
|
|
22956
|
-
"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>",
|
|
22957
|
-
"id": "u:07ece657c7b7",
|
|
22958
|
-
"onEvent": {
|
|
22959
|
-
"click": {
|
|
22960
|
-
"weight": 0,
|
|
22961
|
-
"actions": [
|
|
22962
|
-
{
|
|
22963
|
-
"args": {
|
|
22964
|
-
"options": {},
|
|
22965
|
-
"api": {
|
|
22966
|
-
"url": "${context.rootUrl}/api/v4/notifications/${_id}/read?rootUrl=&appId=${appId}&async=true",
|
|
22967
|
-
"method": "get",
|
|
22968
|
-
"messages": {},
|
|
22969
|
-
"headers": {
|
|
22970
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22971
|
-
},
|
|
22972
|
-
"adaptor": "payload = {\n status: 0,\n msg: '',\n data: {\n redirect: payload.redirect || payload \n }} \nreturn payload;"
|
|
22973
|
-
}
|
|
22974
|
-
},
|
|
22975
|
-
"actionType": "ajax"
|
|
22976
|
-
},
|
|
22977
|
-
{
|
|
22978
|
-
"actionType": "custom",
|
|
22979
|
-
"script": "if(Meteor.isCordova){window.open(Meteor.absoluteUrl(event.data.responseResult.responseData.redirect), '_blank')}else{window.open(event.data.responseResult.responseData.redirect, '_blank')}",
|
|
22980
|
-
"expression": "${!!event.data.responseResult.responseData.redirect}",
|
|
22981
|
-
}
|
|
22982
|
-
]
|
|
22983
|
-
}
|
|
22984
|
-
}
|
|
22985
|
-
},
|
|
22986
|
-
"id": "u:18da41dab9ca"
|
|
22987
|
-
},
|
|
22988
|
-
],
|
|
22989
|
-
actions: [
|
|
22990
|
-
{
|
|
22991
|
-
"type": "button",
|
|
22992
|
-
"label": instance.t('frontend_notifications_allread'),
|
|
22993
|
-
"id": "u:5530f3779e3a",
|
|
22994
|
-
"onEvent": {
|
|
22995
|
-
"click": {
|
|
22996
|
-
"actions": [
|
|
22997
|
-
{
|
|
22998
|
-
"componentId": "",
|
|
22999
|
-
"args": {
|
|
23000
|
-
"api": {
|
|
23001
|
-
"url": "${context.rootUrl}/api/v4/notifications/all/markReadAll",
|
|
23002
|
-
"method": "post",
|
|
23003
|
-
"headers": {
|
|
23004
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23005
|
-
}
|
|
23006
|
-
},
|
|
23007
|
-
"messages": {
|
|
23008
|
-
"success": instance.t('frontend_notifications_allread_message')
|
|
23009
|
-
}
|
|
23010
|
-
},
|
|
23011
|
-
"actionType": "ajax"
|
|
23012
|
-
}
|
|
23013
|
-
],
|
|
23014
|
-
"weight": 0
|
|
23015
|
-
}
|
|
23016
|
-
}
|
|
23017
|
-
}
|
|
23018
|
-
]
|
|
23019
|
-
},
|
|
23020
|
-
],
|
|
23021
|
-
"id": "u:aba521eed5b7",
|
|
23022
|
-
"onEvent": {
|
|
23023
|
-
"@data.changed.notifications": {
|
|
23024
|
-
"actions": [
|
|
23025
|
-
{
|
|
23026
|
-
"actionType": "reload"
|
|
23027
|
-
}
|
|
23028
|
-
]
|
|
23029
|
-
}
|
|
23030
|
-
},
|
|
23031
|
-
"messages": {},
|
|
23032
|
-
"api": {
|
|
23033
|
-
"method": "post",
|
|
23034
|
-
"url": "${context.rootUrl}/graphql",
|
|
23035
|
-
"data": {
|
|
23036
|
-
"&": "$$",
|
|
23037
|
-
"context": "${context}",
|
|
23038
|
-
"userId": "${context.userId}"
|
|
23039
|
-
},
|
|
23040
|
-
"dataType": "json",
|
|
23041
|
-
"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}",
|
|
23042
|
-
"headers": {
|
|
23043
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23044
|
-
},
|
|
23045
|
-
"adaptor": "return payload.data"
|
|
23046
|
-
},
|
|
23047
|
-
}
|
|
23048
|
-
],
|
|
23049
|
-
"id": "u:857e8161c96b",
|
|
23050
|
-
"className": "antd-Action steedos-header-toolbar-notifications",
|
|
23051
|
-
"open": false
|
|
23052
|
-
},
|
|
23799
|
+
getNotificationBadgeButton(),
|
|
23053
23800
|
{
|
|
23054
23801
|
"type": "steedos-dropdown",
|
|
23055
23802
|
"placement": "bottomRight",
|
|
@@ -23224,7 +23971,7 @@ var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23224
23971
|
body: [
|
|
23225
23972
|
{
|
|
23226
23973
|
"type": "wrapper",
|
|
23227
|
-
"className": "bg-white sticky p-0 top-0 z-40 w-full flex-none backdrop-blur transition-colors duration-500 lg:z-
|
|
23974
|
+
"className": "bg-white sticky p-0 top-0 z-40 w-full flex-none backdrop-blur transition-colors duration-500 lg:z-[1000] border-b-[3px] border-sky-500 border-solid steedos-header-container sm:shadow",
|
|
23228
23975
|
body: [
|
|
23229
23976
|
{
|
|
23230
23977
|
"type": "wrapper",
|
|
@@ -23460,51 +24207,67 @@ function getAmisStaticFieldType(type, data_type, options) {
|
|
|
23460
24207
|
}
|
|
23461
24208
|
return type;
|
|
23462
24209
|
}
|
|
23463
|
-
|
|
23464
|
-
|
|
23465
|
-
|
|
23466
|
-
|
|
23467
|
-
|
|
23468
|
-
|
|
23469
|
-
|
|
23470
|
-
|
|
23471
|
-
|
|
23472
|
-
|
|
23473
|
-
|
|
23474
|
-
|
|
23475
|
-
|
|
23476
|
-
|
|
23477
|
-
|
|
23478
|
-
|
|
23479
|
-
|
|
23480
|
-
|
|
23481
|
-
"
|
|
23482
|
-
"
|
|
23483
|
-
"showBackButton": false,
|
|
23484
|
-
"showButtons": true,
|
|
23485
|
-
"data": {
|
|
23486
|
-
"_inDrawer": true,
|
|
23487
|
-
"recordLoaded": false, // 重置数据加载状态
|
|
23488
|
-
}
|
|
24210
|
+
function getLookupLinkOnClick(field, options) {
|
|
24211
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
24212
|
+
var recordPage, drawerRecordDetailSchema;
|
|
24213
|
+
return __generator(this, function (_a) {
|
|
24214
|
+
switch (_a.label) {
|
|
24215
|
+
case 0: return [4 /*yield*/, getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor })];
|
|
24216
|
+
case 1:
|
|
24217
|
+
recordPage = _a.sent();
|
|
24218
|
+
drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
|
|
24219
|
+
"recordId": "${value}",
|
|
24220
|
+
"data": __assign$2(__assign$2({}, recordPage.schema.data), { "_inDrawer": true, "recordLoaded": false })
|
|
24221
|
+
}) : {
|
|
24222
|
+
"type": "steedos-record-detail",
|
|
24223
|
+
"objectApiName": "${objectName}",
|
|
24224
|
+
"recordId": "${value}",
|
|
24225
|
+
"showBackButton": false,
|
|
24226
|
+
"showButtons": true,
|
|
24227
|
+
"data": {
|
|
24228
|
+
"_inDrawer": true,
|
|
24229
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
23489
24230
|
}
|
|
23490
|
-
|
|
23491
|
-
|
|
23492
|
-
|
|
23493
|
-
|
|
23494
|
-
|
|
24231
|
+
};
|
|
24232
|
+
return [2 /*return*/, {
|
|
24233
|
+
"click": {
|
|
24234
|
+
"actions": [
|
|
24235
|
+
{
|
|
24236
|
+
"actionType": "drawer",
|
|
24237
|
+
"drawer": {
|
|
24238
|
+
"type": "drawer",
|
|
24239
|
+
"title": " ",
|
|
24240
|
+
"headerClassName": "hidden",
|
|
24241
|
+
"size": "lg",
|
|
24242
|
+
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
24243
|
+
"closeOnEsc": true,
|
|
24244
|
+
"closeOnOutside": true,
|
|
24245
|
+
"resizable": true,
|
|
24246
|
+
"actions": [],
|
|
24247
|
+
"body": [
|
|
24248
|
+
drawerRecordDetailSchema
|
|
24249
|
+
],
|
|
24250
|
+
"className": "steedos-record-detail-drawer app-popover"
|
|
24251
|
+
},
|
|
24252
|
+
"preventDefault": true
|
|
24253
|
+
}
|
|
24254
|
+
]
|
|
24255
|
+
}
|
|
24256
|
+
}];
|
|
23495
24257
|
}
|
|
23496
|
-
|
|
23497
|
-
}
|
|
23498
|
-
}
|
|
24258
|
+
});
|
|
24259
|
+
});
|
|
24260
|
+
}
|
|
23499
24261
|
var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
23500
|
-
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,
|
|
23501
|
-
var
|
|
23502
|
-
var
|
|
23503
|
-
return __generator(this, function (
|
|
23504
|
-
switch (
|
|
24262
|
+
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;
|
|
24263
|
+
var _p, _q, _r, _s, _t, _u, _v, _w, _x, e_1, _y;
|
|
24264
|
+
var _z, _0, _1, _2, _3, _4;
|
|
24265
|
+
return __generator(this, function (_5) {
|
|
24266
|
+
switch (_5.label) {
|
|
23505
24267
|
case 0:
|
|
23506
24268
|
steedosField = null;
|
|
23507
24269
|
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;
|
|
24270
|
+
_c = props.data || {}, appId = _c.appId, formFactor = _c.formFactor;
|
|
23508
24271
|
// console.log(`AmisSteedosField`, props)
|
|
23509
24272
|
// if($schema.config && isString($schema.config)){
|
|
23510
24273
|
// $schema.config = JSON.parse($schema.config)
|
|
@@ -23532,10 +24295,10 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23532
24295
|
// 字段配置为只读,强制走fStatic模式,加上_display判断是为了不影响历史代码,比如直接在ObjectForm中调用steedos-field组件
|
|
23533
24296
|
fStatic = true;
|
|
23534
24297
|
}
|
|
23535
|
-
|
|
24298
|
+
_5.label = 1;
|
|
23536
24299
|
case 1:
|
|
23537
|
-
|
|
23538
|
-
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/,
|
|
24300
|
+
_5.trys.push([1, 31, , 32]);
|
|
24301
|
+
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/, 14];
|
|
23539
24302
|
lookupATagClick = 'onclick="return false;"';
|
|
23540
24303
|
if (window.innerWidth < 768) {
|
|
23541
24304
|
lookupATagClick = "";
|
|
@@ -23560,23 +24323,23 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23560
24323
|
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 ");
|
|
23561
24324
|
}
|
|
23562
24325
|
}
|
|
23563
|
-
source = ((
|
|
24326
|
+
source = ((_z = steedosField.amis) === null || _z === void 0 ? void 0 : _z.source) || ((_0 = steedosField.amis) === null || _0 === void 0 ? void 0 : _0.autoComplete) || defaultSource;
|
|
23564
24327
|
fieldBaseProps = {
|
|
23565
24328
|
multiple: steedosField.multiple,
|
|
23566
24329
|
name: steedosField.name,
|
|
23567
24330
|
label: steedosField.label,
|
|
23568
24331
|
static: true,
|
|
23569
24332
|
required: steedosField.required,
|
|
23570
|
-
className: "".concat(className || '', " ").concat(((
|
|
24333
|
+
className: "".concat(className || '', " ").concat(((_1 = steedosField.amis) === null || _1 === void 0 ? void 0 : _1.className) || '')
|
|
23571
24334
|
};
|
|
23572
24335
|
if (!inInputTable) return [3 /*break*/, 2];
|
|
23573
24336
|
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'select', source: source });
|
|
23574
|
-
return [3 /*break*/,
|
|
24337
|
+
return [3 /*break*/, 13];
|
|
23575
24338
|
case 2:
|
|
23576
24339
|
referenceTo_1 = steedosField.reference_to;
|
|
23577
|
-
if (!referenceTo_1) return [3 /*break*/,
|
|
24340
|
+
if (!referenceTo_1) return [3 /*break*/, 13];
|
|
23578
24341
|
if (_$1.isArray(referenceTo_1)) {
|
|
23579
|
-
fieldValue = (
|
|
24342
|
+
fieldValue = (_2 = props.data) === null || _2 === void 0 ? void 0 : _2[steedosField.name];
|
|
23580
24343
|
if (fieldValue && fieldValue.o) {
|
|
23581
24344
|
referenceTo_1 = fieldValue.o;
|
|
23582
24345
|
}
|
|
@@ -23590,157 +24353,195 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23590
24353
|
}
|
|
23591
24354
|
return [4 /*yield*/, getUISchema(referenceTo_1)];
|
|
23592
24355
|
case 3:
|
|
23593
|
-
fieldRefObject =
|
|
23594
|
-
if (!(props.data._display && _$1.has(props.data._display, steedosField.name))) return [3 /*break*/,
|
|
23595
|
-
|
|
24356
|
+
fieldRefObject = _5.sent();
|
|
24357
|
+
if (!(props.data._display && _$1.has(props.data._display, steedosField.name))) return [3 /*break*/, 7];
|
|
24358
|
+
_e = (_d = Object).assign;
|
|
24359
|
+
_f = [{}, fieldBaseProps];
|
|
24360
|
+
_p = {
|
|
23596
24361
|
type: 'control',
|
|
23597
|
-
name: null
|
|
23598
|
-
|
|
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
|
-
"type": "steedos-record-mini",
|
|
23629
|
-
"objectApiName": "${objectName}",
|
|
23630
|
-
"recordId": "${value}",
|
|
23631
|
-
"showButtons": false,
|
|
23632
|
-
"showBackButton": false,
|
|
23633
|
-
"data": {
|
|
23634
|
-
"objectName": "${objectName}",
|
|
23635
|
-
"recordId": "${value}",
|
|
23636
|
-
}
|
|
23637
|
-
}
|
|
23638
|
-
]
|
|
23639
|
-
} : null,
|
|
23640
|
-
onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
|
|
23641
|
-
}
|
|
23642
|
-
}
|
|
23643
|
-
]
|
|
24362
|
+
name: null
|
|
24363
|
+
};
|
|
24364
|
+
_q = {
|
|
24365
|
+
type: 'wrapper',
|
|
24366
|
+
className: "steedos-field-lookup-wrapper p-0",
|
|
24367
|
+
"wrapWithPanel": false,
|
|
24368
|
+
"actions": [],
|
|
24369
|
+
visibleOn: "${_display.".concat(steedosField.name, "}")
|
|
24370
|
+
};
|
|
24371
|
+
_r = {
|
|
24372
|
+
type: 'each',
|
|
24373
|
+
placeholder: "",
|
|
24374
|
+
className: "steedos-field-lookup-each flex flex-wrap gap-2",
|
|
24375
|
+
source: "${_display.".concat(steedosField.name, "|asArray}")
|
|
24376
|
+
};
|
|
24377
|
+
_s = {
|
|
24378
|
+
type: 'static',
|
|
24379
|
+
labelClassName: "hidden",
|
|
24380
|
+
label: false,
|
|
24381
|
+
className: 'm-0',
|
|
24382
|
+
tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\" ".concat(lookupATagClick, ">${label}</a>"),
|
|
24383
|
+
popOver: fieldRefObject.compactLayouts && window.innerWidth >= 768 ? {
|
|
24384
|
+
"trigger": "hover",
|
|
24385
|
+
"className": "steedos-record-detail-popover",
|
|
24386
|
+
"position": "left-bottom",
|
|
24387
|
+
"showIcon": false,
|
|
24388
|
+
"title": false,
|
|
24389
|
+
"offset": {
|
|
24390
|
+
"top": 0,
|
|
24391
|
+
"left": 20
|
|
23644
24392
|
},
|
|
23645
|
-
|
|
24393
|
+
"body": [
|
|
24394
|
+
{
|
|
24395
|
+
"type": "steedos-record-mini",
|
|
24396
|
+
"objectApiName": "${objectName}",
|
|
24397
|
+
"recordId": "${value}",
|
|
24398
|
+
"showButtons": false,
|
|
24399
|
+
"showBackButton": false,
|
|
24400
|
+
"data": {
|
|
24401
|
+
"objectName": "${objectName}",
|
|
24402
|
+
"recordId": "${value}",
|
|
24403
|
+
}
|
|
24404
|
+
}
|
|
24405
|
+
]
|
|
24406
|
+
} : null
|
|
24407
|
+
};
|
|
24408
|
+
if (!(window.innerWidth < 768)) return [3 /*break*/, 4];
|
|
24409
|
+
_g = null;
|
|
24410
|
+
return [3 /*break*/, 6];
|
|
24411
|
+
case 4: return [4 /*yield*/, getLookupLinkOnClick(steedosField, {
|
|
24412
|
+
appId: appId,
|
|
24413
|
+
objectName: referenceTo_1,
|
|
24414
|
+
formFactor: formFactor
|
|
24415
|
+
})];
|
|
24416
|
+
case 5:
|
|
24417
|
+
_g = _5.sent();
|
|
24418
|
+
_5.label = 6;
|
|
24419
|
+
case 6:
|
|
24420
|
+
fieldBaseProps = _e.apply(_d, _f.concat([(_p.body = [(_q.body = [
|
|
24421
|
+
(_r.items = (
|
|
24422
|
+
// onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
|
|
24423
|
+
_s.onEvent = _g,
|
|
24424
|
+
_s),
|
|
24425
|
+
_r)
|
|
24426
|
+
],
|
|
24427
|
+
_q), {
|
|
23646
24428
|
type: 'static',
|
|
23647
24429
|
tpl: '-',
|
|
23648
|
-
className: "".concat(fieldBaseProps.className || '', " text-muted"),
|
|
24430
|
+
className: "".concat(fieldBaseProps.className || '', " text-muted !border-b-0"),
|
|
23649
24431
|
hiddenOn: "${_display.".concat(steedosField.name, "}"),
|
|
23650
|
-
}]
|
|
23651
|
-
|
|
23652
|
-
return [3 /*break*/,
|
|
23653
|
-
case
|
|
23654
|
-
case
|
|
23655
|
-
res =
|
|
23656
|
-
valueOptions_1 = ((
|
|
23657
|
-
fieldValue = (
|
|
24432
|
+
}],
|
|
24433
|
+
_p)]));
|
|
24434
|
+
return [3 /*break*/, 13];
|
|
24435
|
+
case 7: return [4 /*yield*/, env.fetcher(source, props.data)];
|
|
24436
|
+
case 8:
|
|
24437
|
+
res = _5.sent();
|
|
24438
|
+
valueOptions_1 = ((_3 = res === null || res === void 0 ? void 0 : res.data) === null || _3 === void 0 ? void 0 : _3.options) || [];
|
|
24439
|
+
fieldValue = (_4 = props.data) === null || _4 === void 0 ? void 0 : _4[steedosField.name];
|
|
23658
24440
|
values = fieldValue;
|
|
23659
24441
|
if (_$1.isString(values)) {
|
|
23660
24442
|
values = [values];
|
|
23661
24443
|
}
|
|
23662
|
-
if (values && values.length > 0)
|
|
23663
|
-
|
|
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
|
-
onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
|
|
23717
|
-
}
|
|
24444
|
+
if (!(values && values.length > 0)) return [3 /*break*/, 12];
|
|
24445
|
+
disPlayValue_1 = [];
|
|
24446
|
+
_$1.each(values, function (value) {
|
|
24447
|
+
var option = valueOptions_1.find(function (item) { return item.value === value; });
|
|
24448
|
+
if (option) {
|
|
24449
|
+
disPlayValue_1.push({
|
|
24450
|
+
objectName: referenceTo_1,
|
|
24451
|
+
value: option._id || option.value,
|
|
24452
|
+
label: option.label
|
|
24453
|
+
});
|
|
24454
|
+
}
|
|
24455
|
+
});
|
|
24456
|
+
_j = (_h = Object).assign;
|
|
24457
|
+
_k = [{}, fieldBaseProps];
|
|
24458
|
+
_t = { type: 'control', name: null };
|
|
24459
|
+
_u = {
|
|
24460
|
+
type: 'form',
|
|
24461
|
+
className: "steedos-field-lookup-wrapper p-0",
|
|
24462
|
+
"wrapWithPanel": false,
|
|
24463
|
+
"actions": [],
|
|
24464
|
+
data: (_v = {},
|
|
24465
|
+
_v[steedosField.name] = disPlayValue_1,
|
|
24466
|
+
_v)
|
|
24467
|
+
};
|
|
24468
|
+
_w = {
|
|
24469
|
+
type: 'each',
|
|
24470
|
+
placeholder: "",
|
|
24471
|
+
className: "steedos-field-lookup-each flex flex-wrap gap-2",
|
|
24472
|
+
source: "${".concat(steedosField.name, "}")
|
|
24473
|
+
};
|
|
24474
|
+
_x = {
|
|
24475
|
+
type: 'static',
|
|
24476
|
+
className: 'm-0',
|
|
24477
|
+
tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\" ".concat(lookupATagClick, ">${label}</a>"),
|
|
24478
|
+
popOver: fieldRefObject.compactLayouts && window.innerWidth >= 768 ? {
|
|
24479
|
+
"trigger": "hover",
|
|
24480
|
+
"className": "steedos-record-detail-popover",
|
|
24481
|
+
"position": "left-bottom",
|
|
24482
|
+
"showIcon": false,
|
|
24483
|
+
"title": false,
|
|
24484
|
+
"offset": {
|
|
24485
|
+
"top": 0,
|
|
24486
|
+
"left": 20
|
|
24487
|
+
},
|
|
24488
|
+
"body": [
|
|
24489
|
+
{
|
|
24490
|
+
"type": "steedos-record-mini",
|
|
24491
|
+
"objectApiName": "${objectName}",
|
|
24492
|
+
"recordId": "${value}",
|
|
24493
|
+
"showButtons": false,
|
|
24494
|
+
"showBackButton": false,
|
|
24495
|
+
"data": {
|
|
24496
|
+
"objectName": "${objectName}",
|
|
24497
|
+
"recordId": "${value}",
|
|
23718
24498
|
}
|
|
23719
|
-
|
|
23720
|
-
|
|
23721
|
-
|
|
23722
|
-
|
|
23723
|
-
|
|
23724
|
-
|
|
23725
|
-
|
|
23726
|
-
case
|
|
24499
|
+
}
|
|
24500
|
+
]
|
|
24501
|
+
} : null
|
|
24502
|
+
};
|
|
24503
|
+
if (!(window.innerWidth < 768)) return [3 /*break*/, 9];
|
|
24504
|
+
_l = null;
|
|
24505
|
+
return [3 /*break*/, 11];
|
|
24506
|
+
case 9: return [4 /*yield*/, getLookupLinkOnClick(steedosField, {
|
|
24507
|
+
appId: appId,
|
|
24508
|
+
objectName: referenceTo_1,
|
|
24509
|
+
formFactor: formFactor
|
|
24510
|
+
})];
|
|
24511
|
+
case 10:
|
|
24512
|
+
_l = _5.sent();
|
|
24513
|
+
_5.label = 11;
|
|
24514
|
+
case 11:
|
|
24515
|
+
fieldBaseProps = _j.apply(_h, _k.concat([(_t.body = (_u.body = [
|
|
24516
|
+
(_w.items = (
|
|
24517
|
+
// onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
|
|
24518
|
+
_x.onEvent = _l,
|
|
24519
|
+
_x),
|
|
24520
|
+
_w)
|
|
24521
|
+
],
|
|
24522
|
+
_u), _t)]));
|
|
24523
|
+
return [3 /*break*/, 13];
|
|
24524
|
+
case 12:
|
|
24525
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'static', tpl: '-', className: "".concat(fieldBaseProps.className || '', " text-muted") });
|
|
24526
|
+
_5.label = 13;
|
|
24527
|
+
case 13:
|
|
23727
24528
|
schema = Object.assign({}, fieldBaseProps, _$1.pick(steedosField.amis || {}, ['className', 'inline', 'label', 'labelAlign', 'name', 'labelRemark', 'description', 'placeholder', 'staticClassName', 'staticLabelClassName', 'staticInputClassName', 'staticSchema']));
|
|
23728
24529
|
schema.placeholder = "";
|
|
23729
24530
|
// console.log(`steedos field [lookup] schema:`, schema)
|
|
23730
24531
|
return [2 /*return*/, schema];
|
|
23731
|
-
case
|
|
23732
|
-
if (!fStatic) return [3 /*break*/,
|
|
23733
|
-
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/,
|
|
23734
|
-
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField,
|
|
23735
|
-
case
|
|
23736
|
-
fieldSchema =
|
|
24532
|
+
case 14:
|
|
24533
|
+
if (!fStatic) return [3 /*break*/, 28];
|
|
24534
|
+
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/, 16];
|
|
24535
|
+
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, true, ctx)];
|
|
24536
|
+
case 15:
|
|
24537
|
+
fieldSchema = _5.sent();
|
|
23737
24538
|
if (steedosField.type === 'file' && fieldSchema.disabled) {
|
|
23738
24539
|
fieldValue = fieldSchema.value;
|
|
23739
24540
|
if (fieldValue && fieldValue.length) {
|
|
23740
24541
|
hasImageOrFile_1 = false;
|
|
23741
24542
|
_$1.forEach(fieldValue, function (item) {
|
|
23742
24543
|
var fileName = item.name;
|
|
23743
|
-
if ([".pdf", ".jpg", ".jpeg", ".png", ".gif"].indexOf(fileName.slice(-4)) > -1) {
|
|
24544
|
+
if ([".pdf", ".jpg", ".jpeg", ".png", ".gif"].indexOf(fileName.toLowerCase().slice(-4)) > -1) {
|
|
23744
24545
|
hasImageOrFile_1 = true;
|
|
23745
24546
|
}
|
|
23746
24547
|
});
|
|
@@ -23752,7 +24553,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23752
24553
|
var fileName = item.name;
|
|
23753
24554
|
var fileUrl = item.url;
|
|
23754
24555
|
var filePreviewHtml = '';
|
|
23755
|
-
if ([".pdf", ".jpg", ".jpeg", ".png", ".gif"].indexOf(fileName.slice(-4)) > -1) {
|
|
24556
|
+
if ([".pdf", ".jpg", ".jpeg", ".png", ".gif"].indexOf(fileName.toLowerCase().slice(-4)) > -1) {
|
|
23756
24557
|
var indexOfQuestionMark = fileUrl.indexOf('?');
|
|
23757
24558
|
if (indexOfQuestionMark > -1) {
|
|
23758
24559
|
var filePreviewUrl = fileUrl.substring(0, indexOfQuestionMark);
|
|
@@ -23769,60 +24570,60 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23769
24570
|
}
|
|
23770
24571
|
}
|
|
23771
24572
|
return [2 /*return*/, fieldSchema];
|
|
23772
|
-
case
|
|
24573
|
+
case 16:
|
|
23773
24574
|
schema = Object.assign({}, steedosField, {
|
|
23774
24575
|
type: getAmisStaticFieldType(steedosField.type, steedosField.data_type, steedosField),
|
|
23775
24576
|
static: true,
|
|
23776
24577
|
label: steedosField.label
|
|
23777
24578
|
});
|
|
23778
|
-
if (!(steedosField.type === "time" || steedosField.type === "input-time-range")) return [3 /*break*/,
|
|
24579
|
+
if (!(steedosField.type === "time" || steedosField.type === "input-time-range")) return [3 /*break*/, 17];
|
|
23779
24580
|
Object.assign(schema, {
|
|
23780
24581
|
inputFormat: 'HH:mm',
|
|
23781
24582
|
timeFormat: 'HH:mm',
|
|
23782
24583
|
format: '1970-01-01THH:mm:00.000[Z]',
|
|
23783
24584
|
});
|
|
23784
|
-
return [3 /*break*/,
|
|
23785
|
-
case
|
|
23786
|
-
if (!(steedosField.type === "percent")) return [3 /*break*/,
|
|
24585
|
+
return [3 /*break*/, 27];
|
|
24586
|
+
case 17:
|
|
24587
|
+
if (!(steedosField.type === "percent")) return [3 /*break*/, 18];
|
|
23787
24588
|
Object.assign(schema, {
|
|
23788
24589
|
"percent": steedosField.scale ? steedosField.scale : true
|
|
23789
24590
|
});
|
|
23790
|
-
return [3 /*break*/,
|
|
23791
|
-
case
|
|
23792
|
-
if (!(steedosField.type === "password")) return [3 /*break*/,
|
|
24591
|
+
return [3 /*break*/, 27];
|
|
24592
|
+
case 18:
|
|
24593
|
+
if (!(steedosField.type === "password")) return [3 /*break*/, 19];
|
|
23793
24594
|
Object.assign(schema, {
|
|
23794
24595
|
"tpl": "******"
|
|
23795
24596
|
});
|
|
23796
|
-
return [3 /*break*/,
|
|
23797
|
-
case
|
|
23798
|
-
if (!(steedosField.type === "select")) return [3 /*break*/,
|
|
24597
|
+
return [3 /*break*/, 27];
|
|
24598
|
+
case 19:
|
|
24599
|
+
if (!(steedosField.type === "select")) return [3 /*break*/, 20];
|
|
23799
24600
|
map = getSelectMap(steedosField.options);
|
|
23800
24601
|
Object.assign(schema, {
|
|
23801
24602
|
"placeholder": "",
|
|
23802
24603
|
"map": map
|
|
23803
24604
|
});
|
|
23804
|
-
return [3 /*break*/,
|
|
23805
|
-
case
|
|
23806
|
-
if (!(steedosField.type === "color")) return [3 /*break*/,
|
|
24605
|
+
return [3 /*break*/, 27];
|
|
24606
|
+
case 20:
|
|
24607
|
+
if (!(steedosField.type === "color")) return [3 /*break*/, 21];
|
|
23807
24608
|
Object.assign(schema, {
|
|
23808
24609
|
"defaultColor": null
|
|
23809
24610
|
});
|
|
23810
|
-
return [3 /*break*/,
|
|
23811
|
-
case
|
|
23812
|
-
if (!(steedosField.type === "number" || steedosField.type === 'currency')) return [3 /*break*/,
|
|
24611
|
+
return [3 /*break*/, 27];
|
|
24612
|
+
case 21:
|
|
24613
|
+
if (!(steedosField.type === "number" || steedosField.type === 'currency')) return [3 /*break*/, 22];
|
|
23813
24614
|
// amis input-number和number组件中的precision表示小数位数,并不是魔方平台的精度概念,要转换下,否则小数点后会显示很多的0
|
|
23814
24615
|
Object.assign(schema, {
|
|
23815
24616
|
"precision": steedosField.scale || 0,
|
|
23816
24617
|
"kilobitSeparator": steedosField.enable_thousands //识别enable_thousands,控制千分位分隔符
|
|
23817
24618
|
});
|
|
23818
|
-
return [3 /*break*/,
|
|
23819
|
-
case
|
|
23820
|
-
if (!(steedosField.type === "table")) return [3 /*break*/,
|
|
24619
|
+
return [3 /*break*/, 27];
|
|
24620
|
+
case 22:
|
|
24621
|
+
if (!(steedosField.type === "table")) return [3 /*break*/, 23];
|
|
23821
24622
|
if (steedosField.subFields) {
|
|
23822
24623
|
tableFields = [];
|
|
23823
24624
|
try {
|
|
23824
|
-
for (
|
|
23825
|
-
subField =
|
|
24625
|
+
for (_m = __values(steedosField.subFields), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
24626
|
+
subField = _o.value;
|
|
23826
24627
|
if (!subField.name.endsWith(".$")) {
|
|
23827
24628
|
subFieldName = subField.name.replace("".concat(steedosField._prefix || '').concat(steedosField.name, ".$."), '').replace("".concat(steedosField.name, "."), '');
|
|
23828
24629
|
// const gridSub = await convertSFieldToAmisField(Object.assign({}, subField, {name: subFieldName, isTableField: true}), readonly, ctx);
|
|
@@ -23833,7 +24634,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23833
24634
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
23834
24635
|
finally {
|
|
23835
24636
|
try {
|
|
23836
|
-
if (
|
|
24637
|
+
if (_o && !_o.done && (_y = _m.return)) _y.call(_m);
|
|
23837
24638
|
}
|
|
23838
24639
|
finally { if (e_1) throw e_1.error; }
|
|
23839
24640
|
}
|
|
@@ -23849,9 +24650,9 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23849
24650
|
}
|
|
23850
24651
|
});
|
|
23851
24652
|
}
|
|
23852
|
-
return [3 /*break*/,
|
|
23853
|
-
case
|
|
23854
|
-
if (!(steedosField.type === "image")) return [3 /*break*/,
|
|
24653
|
+
return [3 /*break*/, 27];
|
|
24654
|
+
case 23:
|
|
24655
|
+
if (!(steedosField.type === "image")) return [3 /*break*/, 24];
|
|
23855
24656
|
Object.assign(schema, {
|
|
23856
24657
|
enlargeAble: true,
|
|
23857
24658
|
showToolbar: true,
|
|
@@ -23882,15 +24683,15 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23882
24683
|
return value;
|
|
23883
24684
|
}
|
|
23884
24685
|
});
|
|
23885
|
-
return [3 /*break*/,
|
|
23886
|
-
case
|
|
23887
|
-
if (!(steedosField.type === "file")) return [3 /*break*/,
|
|
23888
|
-
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField,
|
|
23889
|
-
case
|
|
24686
|
+
return [3 /*break*/, 27];
|
|
24687
|
+
case 24:
|
|
24688
|
+
if (!(steedosField.type === "file")) return [3 /*break*/, 26];
|
|
24689
|
+
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, true, ctx)];
|
|
24690
|
+
case 25:
|
|
23890
24691
|
// 附件static模式先保持原来的逻辑,依赖_display,审批王中相关功能在creator中
|
|
23891
24692
|
// convertSFieldToAmisField中会合并steedosField.amis,所以也不需要再次合并steedosField.amis,直接return就好
|
|
23892
|
-
return [2 /*return*/,
|
|
23893
|
-
case
|
|
24693
|
+
return [2 /*return*/, _5.sent()];
|
|
24694
|
+
case 26:
|
|
23894
24695
|
if (steedosField.type === 'formula' || steedosField.type === 'summary') {
|
|
23895
24696
|
if (steedosField.data_type === 'number' || steedosField.data_type === 'currency') {
|
|
23896
24697
|
Object.assign(schema, {
|
|
@@ -23951,11 +24752,11 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23951
24752
|
disabled: true
|
|
23952
24753
|
});
|
|
23953
24754
|
}
|
|
23954
|
-
|
|
23955
|
-
case
|
|
24755
|
+
_5.label = 27;
|
|
24756
|
+
case 27:
|
|
23956
24757
|
Object.assign(schema, steedosField.amis || {});
|
|
23957
24758
|
return [2 /*return*/, schema];
|
|
23958
|
-
case
|
|
24759
|
+
case 28:
|
|
23959
24760
|
if (!ctx.className) {
|
|
23960
24761
|
ctx.className = className;
|
|
23961
24762
|
}
|
|
@@ -24016,16 +24817,16 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24016
24817
|
}
|
|
24017
24818
|
}
|
|
24018
24819
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
24019
|
-
case
|
|
24020
|
-
schema =
|
|
24820
|
+
case 29:
|
|
24821
|
+
schema = _5.sent();
|
|
24021
24822
|
// console.log(`AmisSteedosField return schema`, schema)
|
|
24022
24823
|
return [2 /*return*/, schema];
|
|
24023
|
-
case
|
|
24024
|
-
case
|
|
24025
|
-
error_1 =
|
|
24824
|
+
case 30: return [3 /*break*/, 32];
|
|
24825
|
+
case 31:
|
|
24826
|
+
error_1 = _5.sent();
|
|
24026
24827
|
console.log("error", error_1);
|
|
24027
|
-
return [3 /*break*/,
|
|
24028
|
-
case
|
|
24828
|
+
return [3 /*break*/, 32];
|
|
24829
|
+
case 32: return [2 /*return*/, null];
|
|
24029
24830
|
}
|
|
24030
24831
|
});
|
|
24031
24832
|
}); };
|
|
@@ -24268,7 +25069,7 @@ var AmisInputTable = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
24268
25069
|
return __generator(this, function (_a) {
|
|
24269
25070
|
switch (_a.label) {
|
|
24270
25071
|
case 0:
|
|
24271
|
-
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;
|
|
25072
|
+
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;
|
|
24272
25073
|
extendProps = {};
|
|
24273
25074
|
if (props.disabledOn || props.disabled) {
|
|
24274
25075
|
extendProps["addable"] = false;
|
|
@@ -24529,7 +25330,7 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
24529
25330
|
});
|
|
24530
25331
|
}); };
|
|
24531
25332
|
|
|
24532
|
-
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);
|
|
25333
|
+
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);
|
|
24533
25334
|
|
|
24534
25335
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
24535
25336
|
__proto__: null,
|