@steedos-widgets/amis-object 6.3.0-beta.9 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/amis/AmisInputTable.d.ts +1 -0
- package/dist/amis/AmisRecordDetailHeader.d.ts +1 -0
- package/dist/amis-object.cjs.css +82 -10
- package/dist/amis-object.cjs.js +1797 -1062
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +82 -10
- package/dist/amis-object.esm.js +1797 -1062
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +82 -10
- package/dist/amis-object.umd.js +345 -286
- 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.esm.js
CHANGED
|
@@ -3708,9 +3708,9 @@ function getSelectMap(selectOptions){
|
|
|
3708
3708
|
}
|
|
3709
3709
|
|
|
3710
3710
|
function getNameTplUrl(field, ctx){
|
|
3711
|
-
if(ctx.objectName === 'cms_files'){
|
|
3712
|
-
|
|
3713
|
-
}
|
|
3711
|
+
// if(ctx.objectName === 'cms_files'){
|
|
3712
|
+
// return "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}"
|
|
3713
|
+
// }
|
|
3714
3714
|
const href = Router$1.getObjectDetailPath({
|
|
3715
3715
|
...ctx, formFactor: ctx.formFactor, appId: "${appId}", objectName: ctx.objectName || "${objectName}", recordId: `\${${ctx.idFieldName}}`
|
|
3716
3716
|
});
|
|
@@ -3725,7 +3725,7 @@ function getNameTpl(field, ctx){
|
|
|
3725
3725
|
}
|
|
3726
3726
|
let nameLabel = field.name;
|
|
3727
3727
|
//若字段类型是lookup,则按照相关表tpl的label规则显示;若是其它类型,则显示_display或字段本身的值
|
|
3728
|
-
if (field.type == "lookup") {
|
|
3728
|
+
if (field.type == "lookup" || field.type == "master_detail") {
|
|
3729
3729
|
if(!field.reference_to && (field.optionsFunction || field._optionsFunction || field.options)){
|
|
3730
3730
|
if(!field.isTableField){
|
|
3731
3731
|
nameLabel = `\${${field.name}__label}`;
|
|
@@ -3900,12 +3900,15 @@ async function getFieldTpl (field, options){
|
|
|
3900
3900
|
}
|
|
3901
3901
|
}
|
|
3902
3902
|
|
|
3903
|
-
async function getFieldsTemplate(fields, display){
|
|
3903
|
+
async function getFieldsTemplate(object, fields, display){
|
|
3904
3904
|
let expandFields = [];
|
|
3905
3905
|
if(display != false){
|
|
3906
3906
|
display = true;
|
|
3907
3907
|
}
|
|
3908
3908
|
let fieldsName = ['_id'];
|
|
3909
|
+
if(!object.datasource || object.datasource === 'default' || object.datasource === 'meteor'){
|
|
3910
|
+
fieldsName.push('space');
|
|
3911
|
+
}
|
|
3909
3912
|
let displayFields = [];
|
|
3910
3913
|
let fieldsArr = [];
|
|
3911
3914
|
if(_$1.isArray(fields)){
|
|
@@ -4001,7 +4004,7 @@ async function getFindOneQuery$1(object, recordId, fields, options){
|
|
|
4001
4004
|
}
|
|
4002
4005
|
}
|
|
4003
4006
|
return {
|
|
4004
|
-
query: `{${alias}:${object.name}${queryOptions}{${await getFieldsTemplate(fields)}, ${getRecordPermissionsTemplate()}}}`
|
|
4007
|
+
query: `{${alias}:${object.name}${queryOptions}{${await getFieldsTemplate(object, fields)}, ${getRecordPermissionsTemplate()}}}`
|
|
4005
4008
|
}
|
|
4006
4009
|
}
|
|
4007
4010
|
|
|
@@ -4190,7 +4193,7 @@ async function getFindQuery(object, recordId, fields, options){
|
|
|
4190
4193
|
// return item.replace(/^{/,"").replace(/}$/,"");
|
|
4191
4194
|
// }).join(",")) : "";
|
|
4192
4195
|
|
|
4193
|
-
const fieldsTemplate = `${await getFieldsTemplate(fields, options.expand)}${treeFields}${cfsFields}`;
|
|
4196
|
+
const fieldsTemplate = `${await getFieldsTemplate(object, fields, options.expand)}${treeFields}${cfsFields}`;
|
|
4194
4197
|
|
|
4195
4198
|
return {
|
|
4196
4199
|
orderBy: "${orderBy}",
|
|
@@ -4238,7 +4241,7 @@ function getRecordPermissionsQuery(object, recordId, options){
|
|
|
4238
4241
|
function getApi$2 (isMobile){
|
|
4239
4242
|
if(isMobile);else {
|
|
4240
4243
|
// return __meteor_runtime_config__.ROOT_URL_PATH_PREFIX + "/graphql"
|
|
4241
|
-
return `\${context.rootUrl}/graphql?reload=\${additionalFilters}`
|
|
4244
|
+
return `\${context.rootUrl}/graphql?reload=\${additionalFilters|join}`
|
|
4242
4245
|
}
|
|
4243
4246
|
}
|
|
4244
4247
|
|
|
@@ -4306,6 +4309,29 @@ function getAmisStaticFieldType$1(type, readonly, options){
|
|
|
4306
4309
|
}
|
|
4307
4310
|
}
|
|
4308
4311
|
|
|
4312
|
+
/*
|
|
4313
|
+
* @Author: baozhoutao@steedos.com
|
|
4314
|
+
* @Date: 2022-07-13 15:18:03
|
|
4315
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
4316
|
+
* @LastEditTime: 2023-04-11 10:34:26
|
|
4317
|
+
* @Description:
|
|
4318
|
+
*/
|
|
4319
|
+
|
|
4320
|
+
async function getPage({type, pageId = '', appId, objectName = '', recordId = '', formFactor = 'LARGE'}){
|
|
4321
|
+
const api = `/api/pageSchema/${type}?app=${appId}&objectApiName=${objectName}&recordId=${recordId}&pageId=${pageId}&formFactor=${formFactor}`;
|
|
4322
|
+
const page = await fetchAPI(api);
|
|
4323
|
+
if (page && page.schema) {
|
|
4324
|
+
page.schema = JSON.parse(page.schema);
|
|
4325
|
+
if(page.schema.data){
|
|
4326
|
+
delete page.schema.data.recordId;
|
|
4327
|
+
delete page.schema.data.objectName;
|
|
4328
|
+
delete page.schema.data.context;
|
|
4329
|
+
delete page.schema.data.global;
|
|
4330
|
+
}
|
|
4331
|
+
return page;
|
|
4332
|
+
}
|
|
4333
|
+
}
|
|
4334
|
+
|
|
4309
4335
|
/*
|
|
4310
4336
|
* @Author: baozhoutao@steedos.com
|
|
4311
4337
|
* @Date: 2022-10-28 14:15:09
|
|
@@ -4329,9 +4355,74 @@ const getAmisFieldType$1 = (steedosField, readonly)=>{
|
|
|
4329
4355
|
return getAmisStaticFieldType$1(steedosField.type === 'avatar' ? 'image' : steedosField.type, readonly, {multiple: steedosField.multiple});
|
|
4330
4356
|
};
|
|
4331
4357
|
|
|
4332
|
-
|
|
4358
|
+
async function getLookupLinkOnClick$1(field, options) {
|
|
4359
|
+
const recordPage = await getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor });
|
|
4360
|
+
|
|
4361
|
+
const drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
|
|
4362
|
+
"recordId": "${value}",
|
|
4363
|
+
"data": {
|
|
4364
|
+
...recordPage.schema.data,
|
|
4365
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
4366
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
4367
|
+
"objectName": options.objectName,
|
|
4368
|
+
}
|
|
4369
|
+
}) : {
|
|
4370
|
+
"type": "steedos-record-detail",
|
|
4371
|
+
"objectApiName": options.objectName,
|
|
4372
|
+
"recordId": "${value}",
|
|
4373
|
+
"showBackButton": false,
|
|
4374
|
+
"showButtons": true,
|
|
4375
|
+
"data": {
|
|
4376
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
4377
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
4378
|
+
}
|
|
4379
|
+
};
|
|
4380
|
+
return {
|
|
4381
|
+
"click": {
|
|
4382
|
+
"actions": [
|
|
4383
|
+
// {
|
|
4384
|
+
// "type": "custom",
|
|
4385
|
+
// "script": `
|
|
4386
|
+
// let fileRecordId = url.match(${regFileRecordId})[2];
|
|
4387
|
+
// console.log('fileRecordId:',fileRecordId);
|
|
4388
|
+
// event.data.recordId = fileRecordId;
|
|
4389
|
+
// `,
|
|
4390
|
+
// },
|
|
4391
|
+
{
|
|
4392
|
+
"actionType": "drawer",
|
|
4393
|
+
"drawer": {
|
|
4394
|
+
"type": "drawer",
|
|
4395
|
+
"title": " ",
|
|
4396
|
+
"headerClassName": "hidden",
|
|
4397
|
+
"size": "lg",
|
|
4398
|
+
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
4399
|
+
"closeOnEsc": true,
|
|
4400
|
+
"closeOnOutside": true,
|
|
4401
|
+
"resizable": true,
|
|
4402
|
+
"actions": [],
|
|
4403
|
+
"body": [
|
|
4404
|
+
drawerRecordDetailSchema
|
|
4405
|
+
],
|
|
4406
|
+
"className": "steedos-record-detail-drawer app-popover"
|
|
4407
|
+
},
|
|
4408
|
+
"preventDefault": true
|
|
4409
|
+
}
|
|
4410
|
+
]
|
|
4411
|
+
}
|
|
4412
|
+
}
|
|
4413
|
+
}
|
|
4414
|
+
|
|
4415
|
+
const getAmisFileReadonlySchema = async (steedosField,ctx = {})=>{
|
|
4333
4416
|
const type = steedosField.type;
|
|
4417
|
+
const { appId, formFactor } = ctx.amisData || {};
|
|
4334
4418
|
const amisFieldType = getAmisFieldType$1(steedosField, true);
|
|
4419
|
+
|
|
4420
|
+
let lookupATagClick = 'onclick="return false;"';
|
|
4421
|
+
|
|
4422
|
+
if(window.innerWidth < 768){
|
|
4423
|
+
lookupATagClick = "";
|
|
4424
|
+
}
|
|
4425
|
+
|
|
4335
4426
|
if(_.includes(['avatar','image'], type)){
|
|
4336
4427
|
return {
|
|
4337
4428
|
type: amisFieldType,
|
|
@@ -4366,13 +4457,34 @@ const getAmisFileReadonlySchema = (steedosField)=>{
|
|
|
4366
4457
|
}
|
|
4367
4458
|
}
|
|
4368
4459
|
} : {
|
|
4369
|
-
type: amisFieldType,
|
|
4370
|
-
tpl: `
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4460
|
+
// type: amisFieldType,
|
|
4461
|
+
// tpl: `
|
|
4462
|
+
// <% let fileData = data._display.${steedosField.name}; if (fileData) { %>
|
|
4463
|
+
// <% if(!Array.isArray(fileData)){ fileData = [fileData]} %>
|
|
4464
|
+
// <% fileData.forEach(function(item) { %>
|
|
4465
|
+
// <a href='<%= item.url %>' target='_self' class='block'><%= item.name %></a>
|
|
4466
|
+
// <% });} %>`
|
|
4467
|
+
"type": "control",
|
|
4468
|
+
"body": {
|
|
4469
|
+
type: 'each',
|
|
4470
|
+
placeholder: "",
|
|
4471
|
+
// className: `steedos-field-lookup-each flex flex-wrap gap-2`,
|
|
4472
|
+
source: `\${_display.${steedosField.name}|asArray}`,
|
|
4473
|
+
items: {
|
|
4474
|
+
type: 'static',
|
|
4475
|
+
labelClassName: "hidden",
|
|
4476
|
+
label: false,
|
|
4477
|
+
className: 'm-0',
|
|
4478
|
+
tpl: `<a href="/app/-/cfs_files_filerecord/view/\${value}" ${lookupATagClick}>\${name}</a>`,
|
|
4479
|
+
// tpl: "<%= item.name >",
|
|
4480
|
+
// onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
|
|
4481
|
+
onEvent: window.innerWidth < 768 ? null : await getLookupLinkOnClick$1(steedosField, {
|
|
4482
|
+
appId,
|
|
4483
|
+
objectName: "cfs_files_filerecord",
|
|
4484
|
+
formFactor
|
|
4485
|
+
})
|
|
4486
|
+
}
|
|
4487
|
+
}
|
|
4376
4488
|
}
|
|
4377
4489
|
}
|
|
4378
4490
|
};
|
|
@@ -4434,8 +4546,8 @@ const getAmisFileEditSchema = (steedosField)=>{
|
|
|
4434
4546
|
return convertData;
|
|
4435
4547
|
};
|
|
4436
4548
|
|
|
4437
|
-
const getAmisFileSchema = (steedosField, readonly)=>{
|
|
4438
|
-
return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
|
|
4549
|
+
const getAmisFileSchema = async (steedosField, readonly, ctx)=>{
|
|
4550
|
+
return readonly ? await getAmisFileReadonlySchema(steedosField,ctx) : getAmisFileEditSchema(steedosField);
|
|
4439
4551
|
};
|
|
4440
4552
|
|
|
4441
4553
|
var frontend_field_group_generalization$1 = "General";
|
|
@@ -4452,6 +4564,7 @@ var frontend_form_confirm$1 = "Confirm";
|
|
|
4452
4564
|
var frontend_form_delete$1 = "Delete";
|
|
4453
4565
|
var frontend_form_view$1 = "view";
|
|
4454
4566
|
var frontend_form_details$1 = "details";
|
|
4567
|
+
var frontend_form_validation_failed_url$1 = "The URL format is incorrect";
|
|
4455
4568
|
var frontend_delete_confirm_text$1 = "Are you sure you want to delete this item?";
|
|
4456
4569
|
var frontend_delete_many_selected_required$1 = "Please select the item to be deleted";
|
|
4457
4570
|
var frontend_delete_many_confirm_text$1 = "Are you sure you want to delete?";
|
|
@@ -4508,6 +4621,7 @@ var frontend_setup$1 = "Setup";
|
|
|
4508
4621
|
var frontend_notifications$1 = "Notifications";
|
|
4509
4622
|
var frontend_notifications_allread$1 = "Mark all as read";
|
|
4510
4623
|
var frontend_notifications_allread_message$1 = "All marked as read";
|
|
4624
|
+
var frontend_notifications_close_dialog$1 = "Close";
|
|
4511
4625
|
var frontend_profile$1 = "Profile";
|
|
4512
4626
|
var switch_space$1 = "Switch Space";
|
|
4513
4627
|
var frontend_about$1 = "About";
|
|
@@ -4540,6 +4654,7 @@ var en_us = {
|
|
|
4540
4654
|
frontend_form_delete: frontend_form_delete$1,
|
|
4541
4655
|
frontend_form_view: frontend_form_view$1,
|
|
4542
4656
|
frontend_form_details: frontend_form_details$1,
|
|
4657
|
+
frontend_form_validation_failed_url: frontend_form_validation_failed_url$1,
|
|
4543
4658
|
frontend_delete_confirm_text: frontend_delete_confirm_text$1,
|
|
4544
4659
|
frontend_delete_many_selected_required: frontend_delete_many_selected_required$1,
|
|
4545
4660
|
frontend_delete_many_confirm_text: frontend_delete_many_confirm_text$1,
|
|
@@ -4596,6 +4711,7 @@ var en_us = {
|
|
|
4596
4711
|
frontend_notifications: frontend_notifications$1,
|
|
4597
4712
|
frontend_notifications_allread: frontend_notifications_allread$1,
|
|
4598
4713
|
frontend_notifications_allread_message: frontend_notifications_allread_message$1,
|
|
4714
|
+
frontend_notifications_close_dialog: frontend_notifications_close_dialog$1,
|
|
4599
4715
|
frontend_profile: frontend_profile$1,
|
|
4600
4716
|
switch_space: switch_space$1,
|
|
4601
4717
|
frontend_about: frontend_about$1,
|
|
@@ -4629,6 +4745,7 @@ var frontend_form_confirm = "确认";
|
|
|
4629
4745
|
var frontend_form_delete = "删除";
|
|
4630
4746
|
var frontend_form_view = "查看";
|
|
4631
4747
|
var frontend_form_details = "详情";
|
|
4748
|
+
var frontend_form_validation_failed_url = "URL 格式不正确";
|
|
4632
4749
|
var frontend_delete_confirm_text = "确定要删除此项目?";
|
|
4633
4750
|
var frontend_delete_many_selected_required = "请选择要删除的项";
|
|
4634
4751
|
var frontend_delete_many_confirm_text = "确定要删除吗?";
|
|
@@ -4686,6 +4803,7 @@ var frontend_setup = "设置";
|
|
|
4686
4803
|
var frontend_notifications = "通知";
|
|
4687
4804
|
var frontend_notifications_allread = "全部标记为已读";
|
|
4688
4805
|
var frontend_notifications_allread_message = "已全部标记为已读";
|
|
4806
|
+
var frontend_notifications_close_dialog = "关闭";
|
|
4689
4807
|
var frontend_profile = "个人资料";
|
|
4690
4808
|
var switch_space = "切换工作区";
|
|
4691
4809
|
var frontend_about = "关于";
|
|
@@ -4718,6 +4836,7 @@ var zh_cn = {
|
|
|
4718
4836
|
frontend_form_delete: frontend_form_delete,
|
|
4719
4837
|
frontend_form_view: frontend_form_view,
|
|
4720
4838
|
frontend_form_details: frontend_form_details,
|
|
4839
|
+
frontend_form_validation_failed_url: frontend_form_validation_failed_url,
|
|
4721
4840
|
frontend_delete_confirm_text: frontend_delete_confirm_text,
|
|
4722
4841
|
frontend_delete_many_selected_required: frontend_delete_many_selected_required,
|
|
4723
4842
|
frontend_delete_many_confirm_text: frontend_delete_many_confirm_text,
|
|
@@ -4775,6 +4894,7 @@ var zh_cn = {
|
|
|
4775
4894
|
frontend_notifications: frontend_notifications,
|
|
4776
4895
|
frontend_notifications_allread: frontend_notifications_allread,
|
|
4777
4896
|
frontend_notifications_allread_message: frontend_notifications_allread_message,
|
|
4897
|
+
frontend_notifications_close_dialog: frontend_notifications_close_dialog,
|
|
4778
4898
|
frontend_profile: frontend_profile,
|
|
4779
4899
|
switch_space: switch_space,
|
|
4780
4900
|
frontend_about: frontend_about,
|
|
@@ -4947,7 +5067,12 @@ async function getQuickEditSchema(object, columnField, options){
|
|
|
4947
5067
|
break;
|
|
4948
5068
|
case "percent":
|
|
4949
5069
|
TempDisplayField = `
|
|
4950
|
-
|
|
5070
|
+
if(event.data.value){
|
|
5071
|
+
_display["${field.name}"] = event.data.value.toFixed(${field.scale}) + '%';
|
|
5072
|
+
} else {
|
|
5073
|
+
_display["${field.name}"] = event.data.value;
|
|
5074
|
+
}
|
|
5075
|
+
|
|
4951
5076
|
`;
|
|
4952
5077
|
quickEditSchema.body[0].onEvent["change"] = quickEditOnEvent(TempDisplayField);
|
|
4953
5078
|
break;
|
|
@@ -5291,6 +5416,60 @@ function getFieldWidth(width){
|
|
|
5291
5416
|
}
|
|
5292
5417
|
}
|
|
5293
5418
|
|
|
5419
|
+
async function getColumnItemOnClick(field, options){
|
|
5420
|
+
const recordPage = await getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor });
|
|
5421
|
+
const drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
|
|
5422
|
+
"recordId": `\${${options.idFieldName}}`,
|
|
5423
|
+
"data": {
|
|
5424
|
+
...recordPage.schema.data,
|
|
5425
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
5426
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
5427
|
+
"recordId": `\${${options.idFieldName}}`//审批微页面依赖了作用域中的recordId
|
|
5428
|
+
}
|
|
5429
|
+
}) : {
|
|
5430
|
+
"type": "steedos-record-detail",
|
|
5431
|
+
"objectApiName": "${objectName}",
|
|
5432
|
+
"recordId": `\${${options.idFieldName}}`,
|
|
5433
|
+
"showBackButton": false,
|
|
5434
|
+
"showButtons": true,
|
|
5435
|
+
"data": {
|
|
5436
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
5437
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
5438
|
+
}
|
|
5439
|
+
};
|
|
5440
|
+
|
|
5441
|
+
if(!(field.is_name || field.name === options.labelFieldName)){
|
|
5442
|
+
drawerRecordDetailSchema.objectApiName = field.reference_to;
|
|
5443
|
+
drawerRecordDetailSchema.recordId = `\${_display.${field.name}.value}`;
|
|
5444
|
+
}
|
|
5445
|
+
return {
|
|
5446
|
+
"click": {
|
|
5447
|
+
"actions": [
|
|
5448
|
+
{
|
|
5449
|
+
"actionType": "drawer",
|
|
5450
|
+
"drawer": {
|
|
5451
|
+
"type": "drawer",
|
|
5452
|
+
"title": " ",
|
|
5453
|
+
"headerClassName": "hidden",
|
|
5454
|
+
"size": "lg",
|
|
5455
|
+
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
5456
|
+
"closeOnEsc": true,
|
|
5457
|
+
"closeOnOutside": true,
|
|
5458
|
+
"resizable": true,
|
|
5459
|
+
"actions": [],
|
|
5460
|
+
"body": [
|
|
5461
|
+
drawerRecordDetailSchema
|
|
5462
|
+
],
|
|
5463
|
+
"className": "steedos-record-detail-drawer app-popover",
|
|
5464
|
+
"id": "u:fc5f055afa8c"
|
|
5465
|
+
},
|
|
5466
|
+
"preventDefault": true
|
|
5467
|
+
}
|
|
5468
|
+
]
|
|
5469
|
+
}
|
|
5470
|
+
};
|
|
5471
|
+
}
|
|
5472
|
+
|
|
5294
5473
|
async function getTableColumns$1(object, fields, options){
|
|
5295
5474
|
const columns = [];
|
|
5296
5475
|
if(!options.isLookup && !options.isInputTable){
|
|
@@ -5330,7 +5509,10 @@ async function getTableColumns$1(object, fields, options){
|
|
|
5330
5509
|
delete fieldAmis?.className;
|
|
5331
5510
|
|
|
5332
5511
|
let columnItem;
|
|
5333
|
-
|
|
5512
|
+
|
|
5513
|
+
// PC客户端点击名称字段直接预览
|
|
5514
|
+
let isNode = !!(window && window.nw && window.nw.require);
|
|
5515
|
+
if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files' && isNode){
|
|
5334
5516
|
const previewFileScript = `
|
|
5335
5517
|
var data = event.data;
|
|
5336
5518
|
var file_name = data.versions ? data.name : "${field.label}";
|
|
@@ -5345,20 +5527,20 @@ async function getTableColumns$1(object, fields, options){
|
|
|
5345
5527
|
"onEvent": {
|
|
5346
5528
|
"click": {
|
|
5347
5529
|
"actions": [
|
|
5348
|
-
{
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
},
|
|
5530
|
+
// {
|
|
5531
|
+
// "args": {
|
|
5532
|
+
// "api": {
|
|
5533
|
+
// "url": "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}",
|
|
5534
|
+
// "method": "get",
|
|
5535
|
+
// "headers": {
|
|
5536
|
+
// "Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
5537
|
+
// }
|
|
5538
|
+
// }
|
|
5539
|
+
// },
|
|
5540
|
+
// "actionType": "download",
|
|
5541
|
+
// // "expression": "!!!window?.nw?.require"//浏览器上直接下载
|
|
5542
|
+
// "expression": "!!!(window && window.nw && window.nw.require)"//浏览器上直接下载
|
|
5543
|
+
// },
|
|
5362
5544
|
{
|
|
5363
5545
|
"args": {},
|
|
5364
5546
|
"actionType": "custom",
|
|
@@ -5389,7 +5571,7 @@ async function getTableColumns$1(object, fields, options){
|
|
|
5389
5571
|
toggled: field.toggled,
|
|
5390
5572
|
static: true,
|
|
5391
5573
|
className,
|
|
5392
|
-
...getAmisFileReadonlySchema(field)
|
|
5574
|
+
...await getAmisFileReadonlySchema(field)
|
|
5393
5575
|
}, fieldAmis, {name: field.name});
|
|
5394
5576
|
}
|
|
5395
5577
|
else if(field.type === 'select'){
|
|
@@ -5456,51 +5638,7 @@ async function getTableColumns$1(object, fields, options){
|
|
|
5456
5638
|
}
|
|
5457
5639
|
|
|
5458
5640
|
if(window.innerWidth >= 768 && ((field.is_name || field.name === options.labelFieldName) || ((field.type == 'lookup' || field.type == 'master_detail') && _$1.isString(field.reference_to) && field.multiple != true)) && options.isRelated){
|
|
5459
|
-
|
|
5460
|
-
const drawerRecordDetailSchema = {
|
|
5461
|
-
"type": "steedos-record-detail",
|
|
5462
|
-
"objectApiName": "${objectName}",
|
|
5463
|
-
"recordId": `\${${options.idFieldName}}`,
|
|
5464
|
-
"showBackButton": false,
|
|
5465
|
-
"showButtons": true,
|
|
5466
|
-
"data": {
|
|
5467
|
-
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
5468
|
-
"recordLoaded": false, // 重置数据加载状态
|
|
5469
|
-
}
|
|
5470
|
-
};
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
if(!(field.is_name || field.name === options.labelFieldName)){
|
|
5474
|
-
drawerRecordDetailSchema.objectApiName = field.reference_to;
|
|
5475
|
-
drawerRecordDetailSchema.recordId = `\${_display.${field.name}.value}`;
|
|
5476
|
-
}
|
|
5477
|
-
|
|
5478
|
-
columnItem.onEvent = {
|
|
5479
|
-
"click": {
|
|
5480
|
-
"actions": [
|
|
5481
|
-
{
|
|
5482
|
-
"actionType": "drawer",
|
|
5483
|
-
"drawer": {
|
|
5484
|
-
"type": "drawer",
|
|
5485
|
-
"title": " ",
|
|
5486
|
-
"headerClassName": "hidden",
|
|
5487
|
-
"size": "lg",
|
|
5488
|
-
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
5489
|
-
"closeOnEsc": true,
|
|
5490
|
-
"closeOnOutside": true,
|
|
5491
|
-
"resizable": true,
|
|
5492
|
-
"actions": [],
|
|
5493
|
-
"body": [
|
|
5494
|
-
drawerRecordDetailSchema
|
|
5495
|
-
],
|
|
5496
|
-
"className": "steedos-record-detail-drawer app-popover",
|
|
5497
|
-
"id": "u:fc5f055afa8c"
|
|
5498
|
-
},
|
|
5499
|
-
"preventDefault": true
|
|
5500
|
-
}
|
|
5501
|
-
]
|
|
5502
|
-
}
|
|
5503
|
-
};
|
|
5641
|
+
columnItem.onEvent = await getColumnItemOnClick(field, options);
|
|
5504
5642
|
}
|
|
5505
5643
|
|
|
5506
5644
|
}
|
|
@@ -5713,17 +5851,23 @@ async function getMobileTableColumns(fields, options){
|
|
|
5713
5851
|
onEvent: {
|
|
5714
5852
|
"click": {
|
|
5715
5853
|
"actions": [
|
|
5854
|
+
// {
|
|
5855
|
+
// "args": {
|
|
5856
|
+
// "api": {
|
|
5857
|
+
// "url": url,
|
|
5858
|
+
// "method": "get",
|
|
5859
|
+
// "headers": {
|
|
5860
|
+
// "Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
5861
|
+
// }
|
|
5862
|
+
// }
|
|
5863
|
+
// },
|
|
5864
|
+
// "actionType": "download"
|
|
5865
|
+
// }
|
|
5716
5866
|
{
|
|
5867
|
+
"actionType": "link",
|
|
5717
5868
|
"args": {
|
|
5718
|
-
"
|
|
5719
|
-
|
|
5720
|
-
"method": "get",
|
|
5721
|
-
"headers": {
|
|
5722
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
5723
|
-
}
|
|
5724
|
-
}
|
|
5725
|
-
},
|
|
5726
|
-
"actionType": "download"
|
|
5869
|
+
"link": url
|
|
5870
|
+
}
|
|
5727
5871
|
}
|
|
5728
5872
|
],
|
|
5729
5873
|
"weight": 0
|
|
@@ -6422,8 +6566,8 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
6422
6566
|
|
|
6423
6567
|
var fieldNames = _$1.map(fields, function(n){return n.name});
|
|
6424
6568
|
var nameField = object.fields[object.NAME_FIELD_KEY];
|
|
6425
|
-
let nameLabel = nameField.name;
|
|
6426
|
-
if (nameField.type == "lookup") {
|
|
6569
|
+
let nameLabel = nameField && nameField.name;
|
|
6570
|
+
if (nameField && (nameField.type == "lookup" || nameField.type == "master_detail")) {
|
|
6427
6571
|
if(!nameField.reference_to && (nameField.optionsFunction || nameField._optionsFunction || nameField.options)){
|
|
6428
6572
|
if(!nameField.isTableField){
|
|
6429
6573
|
nameLabel = `record.${nameField.name}__label`;
|
|
@@ -6431,8 +6575,8 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
6431
6575
|
} else {
|
|
6432
6576
|
nameLabel = `record._display.${nameField.name}.label`;
|
|
6433
6577
|
}
|
|
6434
|
-
} else {
|
|
6435
|
-
nameLabel = `record._display.${nameField.name}
|
|
6578
|
+
} else if (nameField){
|
|
6579
|
+
nameLabel = `(record._display ? record._display.${nameField.name} : record.${nameField.name})`;
|
|
6436
6580
|
}
|
|
6437
6581
|
return `
|
|
6438
6582
|
if(payload.data.data.length === 0){
|
|
@@ -7815,16 +7959,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
7815
7959
|
data: formSchema
|
|
7816
7960
|
};
|
|
7817
7961
|
`;
|
|
7818
|
-
const onDialogCancelScript = `
|
|
7819
|
-
// 这里加setTimeout是因为amis的Bug,它会先触发cancel事件执行此脚本关闭父窗口然后再关闭子窗口
|
|
7820
|
-
// 正确的顺序应该是先关闭子窗口再关闭父窗口,顺序错了会造成第二次点击新建按钮的时候异常
|
|
7821
|
-
setTimeout(function(){
|
|
7822
|
-
doAction({
|
|
7823
|
-
"actionType": "cancel",
|
|
7824
|
-
"componentId": "object_actions_drawer_${uiSchema.name}"
|
|
7825
|
-
});
|
|
7826
|
-
}, 200);
|
|
7827
|
-
`;
|
|
7828
7962
|
const getSelectedRowsScript = `
|
|
7829
7963
|
const isLookup = event.data.isLookup;
|
|
7830
7964
|
if(isLookup){
|
|
@@ -7914,17 +8048,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
7914
8048
|
"closeOnEsc": false,
|
|
7915
8049
|
"closeOnOutside": false,
|
|
7916
8050
|
"size": "lg",
|
|
7917
|
-
"onEvent": {
|
|
7918
|
-
"cancel": {
|
|
7919
|
-
"actions": [
|
|
7920
|
-
{
|
|
7921
|
-
"actionType": "custom",
|
|
7922
|
-
"script": onDialogCancelScript,
|
|
7923
|
-
"expression": "${window:innerWidth < 768}",
|
|
7924
|
-
}
|
|
7925
|
-
]
|
|
7926
|
-
}
|
|
7927
|
-
},
|
|
7928
8051
|
"actions": [
|
|
7929
8052
|
{
|
|
7930
8053
|
type: 'button',
|
|
@@ -7960,34 +8083,11 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
7960
8083
|
}
|
|
7961
8084
|
};
|
|
7962
8085
|
|
|
7963
|
-
/*
|
|
7964
|
-
* @Author: baozhoutao@steedos.com
|
|
7965
|
-
* @Date: 2022-07-13 15:18:03
|
|
7966
|
-
* @LastEditors: baozhoutao@steedos.com
|
|
7967
|
-
* @LastEditTime: 2023-04-11 10:34:26
|
|
7968
|
-
* @Description:
|
|
7969
|
-
*/
|
|
7970
|
-
|
|
7971
|
-
async function getPage({type, pageId = '', appId, objectName = '', recordId = '', formFactor = 'LARGE'}){
|
|
7972
|
-
const api = `/api/pageSchema/${type}?app=${appId}&objectApiName=${objectName}&recordId=${recordId}&pageId=${pageId}&formFactor=${formFactor}`;
|
|
7973
|
-
const page = await fetchAPI(api);
|
|
7974
|
-
if (page && page.schema) {
|
|
7975
|
-
page.schema = JSON.parse(page.schema);
|
|
7976
|
-
if(page.schema.data){
|
|
7977
|
-
delete page.schema.data.recordId;
|
|
7978
|
-
delete page.schema.data.objectName;
|
|
7979
|
-
delete page.schema.data.context;
|
|
7980
|
-
delete page.schema.data.global;
|
|
7981
|
-
}
|
|
7982
|
-
return page;
|
|
7983
|
-
}
|
|
7984
|
-
}
|
|
7985
|
-
|
|
7986
8086
|
/*
|
|
7987
8087
|
* @Author: baozhoutao@steedos.com
|
|
7988
8088
|
* @Date: 2022-11-01 15:49:58
|
|
7989
|
-
* @LastEditors:
|
|
7990
|
-
* @LastEditTime:
|
|
8089
|
+
* @LastEditors: yinlianghui@hotoa.com yinlianghui@hotoa.com
|
|
8090
|
+
* @LastEditTime: 2024-05-19 10:01:07
|
|
7991
8091
|
* @Description:
|
|
7992
8092
|
*/
|
|
7993
8093
|
|
|
@@ -8017,16 +8117,6 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
8017
8117
|
: page.schema;
|
|
8018
8118
|
}
|
|
8019
8119
|
|
|
8020
|
-
const onDialogCancelScript = `
|
|
8021
|
-
// 这里加setTimeout是因为amis的Bug,它会先触发cancel事件执行此脚本关闭父窗口然后再关闭子窗口
|
|
8022
|
-
// 正确的顺序应该是先关闭子窗口再关闭父窗口,顺序错了会造成第二次点击编辑按钮的时候异常
|
|
8023
|
-
setTimeout(function(){
|
|
8024
|
-
doAction({
|
|
8025
|
-
"actionType": "cancel",
|
|
8026
|
-
"componentId": "object_actions_drawer_${uiSchema.name}"
|
|
8027
|
-
});
|
|
8028
|
-
}, 200);
|
|
8029
|
-
`;
|
|
8030
8120
|
|
|
8031
8121
|
return {
|
|
8032
8122
|
type: "service",
|
|
@@ -8049,18 +8139,26 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
8049
8139
|
closeOnEsc: false,
|
|
8050
8140
|
closeOnOutside: false,
|
|
8051
8141
|
showCloseButton: true,
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
"
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
"actionType": "custom",
|
|
8058
|
-
"script": onDialogCancelScript,
|
|
8059
|
-
"expression": "${window:innerWidth < 768}",
|
|
8060
|
-
}
|
|
8061
|
-
]
|
|
8062
|
-
}
|
|
8142
|
+
"data": {
|
|
8143
|
+
"&": "$$",
|
|
8144
|
+
"_master": "${_master}",
|
|
8145
|
+
"_master._isRelated": "${_isRelated}",
|
|
8146
|
+
"_master.relatedKey": "${relatedKey}"
|
|
8063
8147
|
},
|
|
8148
|
+
size: "lg",
|
|
8149
|
+
"actions": [
|
|
8150
|
+
{
|
|
8151
|
+
type: 'button',
|
|
8152
|
+
actionType: 'cancel',
|
|
8153
|
+
label: instance.t('frontend_form_cancel')
|
|
8154
|
+
},
|
|
8155
|
+
{
|
|
8156
|
+
type: 'button',
|
|
8157
|
+
actionType: 'confirm',
|
|
8158
|
+
label: instance.t('frontend_form_save'),
|
|
8159
|
+
primary: true
|
|
8160
|
+
},
|
|
8161
|
+
]
|
|
8064
8162
|
},
|
|
8065
8163
|
},
|
|
8066
8164
|
],
|
|
@@ -8840,6 +8938,100 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
|
|
|
8840
8938
|
};
|
|
8841
8939
|
};
|
|
8842
8940
|
|
|
8941
|
+
const getDropdown = (dropdownButtons)=>{
|
|
8942
|
+
const dropdown = {
|
|
8943
|
+
"type": "dropdown-button",
|
|
8944
|
+
"icon": "fa fa-angle-down",
|
|
8945
|
+
"size": "sm",
|
|
8946
|
+
"hideCaret": true,
|
|
8947
|
+
"className": "mr-0 steedos-mobile-header-drop-down",
|
|
8948
|
+
"closeOnClick": true,
|
|
8949
|
+
"menuClassName": "buttons-drawer fixed bg-none border-0 shadow-none",
|
|
8950
|
+
"align": "right",
|
|
8951
|
+
"body": [
|
|
8952
|
+
{
|
|
8953
|
+
"type": "action",
|
|
8954
|
+
"style": {
|
|
8955
|
+
"z-index": 1,
|
|
8956
|
+
"background": "var(--Drawer-overlay-bg)",
|
|
8957
|
+
"height": "100%",
|
|
8958
|
+
"width": "100%",
|
|
8959
|
+
"padding": "0",
|
|
8960
|
+
"margin": "0",
|
|
8961
|
+
"border-radius": "0"
|
|
8962
|
+
}
|
|
8963
|
+
},
|
|
8964
|
+
{
|
|
8965
|
+
"type": "wrapper",
|
|
8966
|
+
"style": {
|
|
8967
|
+
"position": "fixed",
|
|
8968
|
+
"bottom": 0,
|
|
8969
|
+
"z-index": 2,
|
|
8970
|
+
"width": "100vw",
|
|
8971
|
+
"left": "0",
|
|
8972
|
+
"padding": "0",
|
|
8973
|
+
"background": "white",
|
|
8974
|
+
"box-shadow": "0 -10px 10px -10px rgba(0, 0, 0, 0.2)"
|
|
8975
|
+
},
|
|
8976
|
+
"body": [
|
|
8977
|
+
{
|
|
8978
|
+
"type": "flex",
|
|
8979
|
+
"justify": "space-between",
|
|
8980
|
+
"items": [
|
|
8981
|
+
{
|
|
8982
|
+
"type": "tpl",
|
|
8983
|
+
"tpl": "操作",
|
|
8984
|
+
"style": {
|
|
8985
|
+
"padding": "4px 12px",
|
|
8986
|
+
"align-items": "center",
|
|
8987
|
+
"display": "flex"
|
|
8988
|
+
}
|
|
8989
|
+
},
|
|
8990
|
+
{
|
|
8991
|
+
"type": "action",
|
|
8992
|
+
"label": "",
|
|
8993
|
+
"icon": "fa fa-times",
|
|
8994
|
+
"level": "link",
|
|
8995
|
+
"style": {
|
|
8996
|
+
"color": "black"
|
|
8997
|
+
},
|
|
8998
|
+
}
|
|
8999
|
+
],
|
|
9000
|
+
"style": {
|
|
9001
|
+
"padding-top": "0.5rem",
|
|
9002
|
+
"padding-bottom": "0.5rem",
|
|
9003
|
+
"border-bottom": "var(--Drawer-content-borderWidth) solid var(--Drawer-header-borderColor)"
|
|
9004
|
+
}
|
|
9005
|
+
},
|
|
9006
|
+
{
|
|
9007
|
+
"type": "wrapper",
|
|
9008
|
+
"body": [
|
|
9009
|
+
{
|
|
9010
|
+
"type": "button-group",
|
|
9011
|
+
"id": "u:fd837823be5b",
|
|
9012
|
+
"vertical": true,
|
|
9013
|
+
"tiled": true,
|
|
9014
|
+
"buttons": dropdownButtons,
|
|
9015
|
+
"className": "w-full overflow-auto",
|
|
9016
|
+
"btnClassName": "w-full",
|
|
9017
|
+
"size": "lg"
|
|
9018
|
+
}
|
|
9019
|
+
],
|
|
9020
|
+
"style": {
|
|
9021
|
+
"padding": "0",
|
|
9022
|
+
"overflow": "auto",
|
|
9023
|
+
"max-height": "70vh"
|
|
9024
|
+
}
|
|
9025
|
+
}
|
|
9026
|
+
|
|
9027
|
+
]
|
|
9028
|
+
}
|
|
9029
|
+
]
|
|
9030
|
+
};
|
|
9031
|
+
|
|
9032
|
+
return dropdown;
|
|
9033
|
+
};
|
|
9034
|
+
|
|
8843
9035
|
const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
8844
9036
|
const { buttons, moreButtons, moreButtonsVisibleOn } = getObjectDetailHeaderButtons(objectSchema, recordId);
|
|
8845
9037
|
if(ctx.formFactor === 'SMALL'){
|
|
@@ -8863,46 +9055,7 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
8863
9055
|
}
|
|
8864
9056
|
});
|
|
8865
9057
|
|
|
8866
|
-
return [
|
|
8867
|
-
{
|
|
8868
|
-
"type": "button",
|
|
8869
|
-
"icon": "fa fa-angle-down",
|
|
8870
|
-
"visibleOn": phoneMoreButtonsVisibleOn,
|
|
8871
|
-
"onEvent": {
|
|
8872
|
-
"click": {
|
|
8873
|
-
"actions": [
|
|
8874
|
-
{
|
|
8875
|
-
"actionType": "drawer",
|
|
8876
|
-
"drawer": {
|
|
8877
|
-
"type": "drawer",
|
|
8878
|
-
"title": instance.t('frontend_operation'),
|
|
8879
|
-
"id": "object_actions_drawer_" + objectSchema.name,
|
|
8880
|
-
"body": [
|
|
8881
|
-
{
|
|
8882
|
-
"type": "button-group",
|
|
8883
|
-
"id": "u:fd837823be5b",
|
|
8884
|
-
"vertical": true,
|
|
8885
|
-
"tiled": true,
|
|
8886
|
-
"buttons": dropdownButtons,
|
|
8887
|
-
"btnLevel": "enhance",
|
|
8888
|
-
"className": "w-full",
|
|
8889
|
-
"btnClassName": "w-full",
|
|
8890
|
-
"size": "lg"
|
|
8891
|
-
}
|
|
8892
|
-
],
|
|
8893
|
-
"position": "bottom",
|
|
8894
|
-
"closeOnOutside": true,
|
|
8895
|
-
"resizable": false,
|
|
8896
|
-
"className": "buttons-drawer",
|
|
8897
|
-
"bodyClassName": "m-none p-none",
|
|
8898
|
-
"actions": []
|
|
8899
|
-
}
|
|
8900
|
-
}
|
|
8901
|
-
]
|
|
8902
|
-
}
|
|
8903
|
-
}
|
|
8904
|
-
}
|
|
8905
|
-
]
|
|
9058
|
+
return [getDropdown(dropdownButtons)];
|
|
8906
9059
|
}else {
|
|
8907
9060
|
if(moreButtons.length > 0){
|
|
8908
9061
|
const dropdownButtonsSchema = {
|
|
@@ -8923,54 +9076,16 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
8923
9076
|
const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
8924
9077
|
const buttons = getListViewButtons(objectSchema, ctx);
|
|
8925
9078
|
if(ctx.formFactor === 'SMALL'){
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
{
|
|
8934
|
-
"actionType": "drawer",
|
|
8935
|
-
"drawer": {
|
|
8936
|
-
"type": "drawer",
|
|
8937
|
-
"title": instance.t('frontend_operation'),
|
|
8938
|
-
"id": "object_actions_drawer_" + objectSchema.name,
|
|
8939
|
-
"body": [
|
|
8940
|
-
{
|
|
8941
|
-
"type": "button-group",
|
|
8942
|
-
"id": "u:fd837823be5b",
|
|
8943
|
-
"vertical": true,
|
|
8944
|
-
"tiled": true,
|
|
8945
|
-
"buttons": [
|
|
8946
|
-
..._$1.map(buttons, (button)=>{
|
|
8947
|
-
return {
|
|
8948
|
-
type: 'steedos-object-button',
|
|
8949
|
-
name: button.name,
|
|
8950
|
-
objectName: button.objectName,
|
|
8951
|
-
visibleOn: getButtonVisibleOn(button),
|
|
8952
|
-
className: `button_${button.name} w-full`
|
|
8953
|
-
}
|
|
8954
|
-
})
|
|
8955
|
-
],
|
|
8956
|
-
"btnLevel": "enhance",
|
|
8957
|
-
"className": "w-full",
|
|
8958
|
-
"btnClassName": "w-full",
|
|
8959
|
-
"size": "lg"
|
|
8960
|
-
}
|
|
8961
|
-
],
|
|
8962
|
-
"position": "bottom",
|
|
8963
|
-
"closeOnOutside": true,
|
|
8964
|
-
"resizable": false,
|
|
8965
|
-
"className": "buttons-drawer",
|
|
8966
|
-
"bodyClassName": "m-none p-none",
|
|
8967
|
-
"actions": []
|
|
8968
|
-
}
|
|
8969
|
-
}
|
|
8970
|
-
]
|
|
8971
|
-
}
|
|
9079
|
+
const dropdownButtons = _$1.map(buttons, (button)=>{
|
|
9080
|
+
return {
|
|
9081
|
+
type: 'steedos-object-button',
|
|
9082
|
+
name: button.name,
|
|
9083
|
+
objectName: button.objectName,
|
|
9084
|
+
visibleOn: getButtonVisibleOn(button),
|
|
9085
|
+
className: `button_${button.name} w-full`
|
|
8972
9086
|
}
|
|
8973
|
-
|
|
9087
|
+
});
|
|
9088
|
+
return getDropdown(dropdownButtons);
|
|
8974
9089
|
}else {
|
|
8975
9090
|
return _$1.map(buttons, (button) => {
|
|
8976
9091
|
return {
|
|
@@ -8987,55 +9102,19 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
8987
9102
|
const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
|
|
8988
9103
|
const buttons = getObjectRelatedListButtons(objectSchema, ctx);
|
|
8989
9104
|
if(ctx.formFactor === 'SMALL'){
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
|
|
8997
|
-
"actionType": "drawer",
|
|
8998
|
-
"drawer": {
|
|
8999
|
-
"type": "drawer",
|
|
9000
|
-
"title": instance.t('frontend_operation'),
|
|
9001
|
-
"id": "object_actions_drawer_" + objectSchema.name,
|
|
9002
|
-
"body": [
|
|
9003
|
-
{
|
|
9004
|
-
"type": "button-group",
|
|
9005
|
-
"vertical": true,
|
|
9006
|
-
"tiled": true,
|
|
9007
|
-
"buttons": [
|
|
9008
|
-
..._$1.map(buttons, (button)=>{
|
|
9009
|
-
return {
|
|
9010
|
-
type: 'steedos-object-button',
|
|
9011
|
-
name: button.name,
|
|
9012
|
-
objectName: button.objectName,
|
|
9013
|
-
visibleOn: getButtonVisibleOn(button),
|
|
9014
|
-
className: `button_${button.name} w-full`
|
|
9015
|
-
}
|
|
9016
|
-
})
|
|
9017
|
-
],
|
|
9018
|
-
"btnLevel": "enhance",
|
|
9019
|
-
"className": "w-full",
|
|
9020
|
-
"btnClassName": "w-full",
|
|
9021
|
-
"size": "lg"
|
|
9022
|
-
}
|
|
9023
|
-
],
|
|
9024
|
-
"position": "bottom",
|
|
9025
|
-
"closeOnOutside": true,
|
|
9026
|
-
"resizable": false,
|
|
9027
|
-
"className": "buttons-drawer",
|
|
9028
|
-
"bodyClassName": "m-none p-none",
|
|
9029
|
-
"actions": []
|
|
9030
|
-
}
|
|
9031
|
-
}
|
|
9032
|
-
]
|
|
9033
|
-
}
|
|
9105
|
+
const dropdownButtons = _$1.map(buttons, (button)=>{
|
|
9106
|
+
return {
|
|
9107
|
+
type: 'steedos-object-button',
|
|
9108
|
+
name: button.name,
|
|
9109
|
+
objectName: button.objectName,
|
|
9110
|
+
visibleOn: getButtonVisibleOn(button),
|
|
9111
|
+
className: `button_${button.name} w-full`
|
|
9034
9112
|
}
|
|
9035
|
-
|
|
9113
|
+
});
|
|
9114
|
+
return [getDropdown(dropdownButtons)];
|
|
9036
9115
|
}else {
|
|
9037
9116
|
return _$1.map(buttons, (button) => {
|
|
9038
|
-
return {
|
|
9117
|
+
return {
|
|
9039
9118
|
type: 'steedos-object-button',
|
|
9040
9119
|
name: button.name,
|
|
9041
9120
|
objectName: button.objectName,
|
|
@@ -9670,6 +9749,217 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
9670
9749
|
};
|
|
9671
9750
|
}
|
|
9672
9751
|
|
|
9752
|
+
const getNewListviewButtonSchema = ()=>{
|
|
9753
|
+
return {
|
|
9754
|
+
"type": "button",
|
|
9755
|
+
"label": instance.t('frontend_listview_control_new_label'),
|
|
9756
|
+
"className": "steedos-listview-new-button",
|
|
9757
|
+
"onEvent": {
|
|
9758
|
+
"click": {
|
|
9759
|
+
"weight": 0,
|
|
9760
|
+
"actions": [
|
|
9761
|
+
{
|
|
9762
|
+
"dialog": {
|
|
9763
|
+
"type": "dialog",
|
|
9764
|
+
"title": instance.t('frontend_listview_control_new_title'),
|
|
9765
|
+
"data": {
|
|
9766
|
+
//"&":"$$",2.7、2.9、3.0在此处失效
|
|
9767
|
+
"all": "${uiSchema.list_views.all}",
|
|
9768
|
+
"list_view": "${uiSchema.list_views[listName]}",
|
|
9769
|
+
"appId": "${appId}",
|
|
9770
|
+
"global": "${global}",
|
|
9771
|
+
"targetObjectName": "${objectName}",
|
|
9772
|
+
"context": "${context}"
|
|
9773
|
+
},
|
|
9774
|
+
"body": [
|
|
9775
|
+
{
|
|
9776
|
+
"type": "steedos-object-form",
|
|
9777
|
+
"label": "对象表单",
|
|
9778
|
+
"objectApiName": "object_listviews",
|
|
9779
|
+
"recordId": "",
|
|
9780
|
+
"mode": "edit",
|
|
9781
|
+
"layout": "normal",
|
|
9782
|
+
"defaultData": {
|
|
9783
|
+
"&": "${list_view}",
|
|
9784
|
+
"name":"",
|
|
9785
|
+
"label":"",
|
|
9786
|
+
"filters":"",
|
|
9787
|
+
"shared":false,
|
|
9788
|
+
"object_name": "${targetObjectName}",
|
|
9789
|
+
"_id":"",
|
|
9790
|
+
"shared_to": null,
|
|
9791
|
+
"shared_to_organizations": null,
|
|
9792
|
+
"locked": false,
|
|
9793
|
+
"owner": null,
|
|
9794
|
+
"company_id": null,
|
|
9795
|
+
"company_ids": null,
|
|
9796
|
+
"is_system": false
|
|
9797
|
+
},
|
|
9798
|
+
"fieldsExtend": fieldsExtend$5(),
|
|
9799
|
+
"fields": fields$1(),
|
|
9800
|
+
"onEvent": {
|
|
9801
|
+
"submitSucc": {
|
|
9802
|
+
"weight": 0,
|
|
9803
|
+
"actions": [
|
|
9804
|
+
{
|
|
9805
|
+
"args": {
|
|
9806
|
+
// 直接使用recordId不能拿到数据,只能通过result里面拿数据
|
|
9807
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
9808
|
+
"blank": false
|
|
9809
|
+
},
|
|
9810
|
+
"actionType": "url",
|
|
9811
|
+
}
|
|
9812
|
+
]
|
|
9813
|
+
}
|
|
9814
|
+
},
|
|
9815
|
+
"messages": {
|
|
9816
|
+
"success": instance.t('frontend_listview_control_new_message_success'),
|
|
9817
|
+
"failed": instance.t('frontend_listview_control_new_message_failed')
|
|
9818
|
+
},
|
|
9819
|
+
}
|
|
9820
|
+
],
|
|
9821
|
+
"showCloseButton": true,
|
|
9822
|
+
"showErrorMsg": true,
|
|
9823
|
+
"showLoading": true,
|
|
9824
|
+
"closeOnEsc": false,
|
|
9825
|
+
"dataMapSwitch": false,
|
|
9826
|
+
"size": "lg"
|
|
9827
|
+
},
|
|
9828
|
+
"actionType": "dialog"
|
|
9829
|
+
}
|
|
9830
|
+
]
|
|
9831
|
+
}
|
|
9832
|
+
}
|
|
9833
|
+
}
|
|
9834
|
+
};
|
|
9835
|
+
|
|
9836
|
+
function fields$1(){
|
|
9837
|
+
return [
|
|
9838
|
+
"label",
|
|
9839
|
+
"name",
|
|
9840
|
+
"object_name",
|
|
9841
|
+
"filter_scope",
|
|
9842
|
+
"show_count",
|
|
9843
|
+
"columns",
|
|
9844
|
+
"sort",
|
|
9845
|
+
"filters",
|
|
9846
|
+
"mobile_columns",
|
|
9847
|
+
"searchable_fields",
|
|
9848
|
+
"is_system",
|
|
9849
|
+
"shared",
|
|
9850
|
+
"shared_to",
|
|
9851
|
+
"shared_to_organizations"
|
|
9852
|
+
]
|
|
9853
|
+
}
|
|
9854
|
+
|
|
9855
|
+
function fieldsExtend$5(){
|
|
9856
|
+
return {
|
|
9857
|
+
"group": "",
|
|
9858
|
+
"label": {
|
|
9859
|
+
"group": "",
|
|
9860
|
+
"is_wide": true
|
|
9861
|
+
},
|
|
9862
|
+
"name": {
|
|
9863
|
+
"group": "",
|
|
9864
|
+
"amis": {
|
|
9865
|
+
"hidden": true,
|
|
9866
|
+
"required": false
|
|
9867
|
+
}
|
|
9868
|
+
},
|
|
9869
|
+
"object_name": {
|
|
9870
|
+
"group": "",
|
|
9871
|
+
"amis": {
|
|
9872
|
+
"hidden": true
|
|
9873
|
+
}
|
|
9874
|
+
},
|
|
9875
|
+
"filter_scope": {
|
|
9876
|
+
"group": "",
|
|
9877
|
+
"amis": {
|
|
9878
|
+
"hidden": true,
|
|
9879
|
+
"required": false
|
|
9880
|
+
}
|
|
9881
|
+
},
|
|
9882
|
+
"columns": {
|
|
9883
|
+
"group": "",
|
|
9884
|
+
"amis": {
|
|
9885
|
+
"hidden": true,
|
|
9886
|
+
"required": false
|
|
9887
|
+
}
|
|
9888
|
+
},
|
|
9889
|
+
"mobile_columns":{
|
|
9890
|
+
"group": "",
|
|
9891
|
+
"amis": {
|
|
9892
|
+
"hidden": true,
|
|
9893
|
+
"required": false
|
|
9894
|
+
}
|
|
9895
|
+
},
|
|
9896
|
+
"searchable_fields":{
|
|
9897
|
+
"group": "",
|
|
9898
|
+
"amis": {
|
|
9899
|
+
"hidden": true,
|
|
9900
|
+
"required": false
|
|
9901
|
+
}
|
|
9902
|
+
},
|
|
9903
|
+
"filter_fields": {
|
|
9904
|
+
"group": "",
|
|
9905
|
+
"amis": {
|
|
9906
|
+
"hidden": true,
|
|
9907
|
+
"required": false
|
|
9908
|
+
}
|
|
9909
|
+
},
|
|
9910
|
+
"scrolling_mode": {
|
|
9911
|
+
"group": "",
|
|
9912
|
+
"amis": {
|
|
9913
|
+
"hidden": true,
|
|
9914
|
+
"required": false
|
|
9915
|
+
}
|
|
9916
|
+
},
|
|
9917
|
+
"sort": {
|
|
9918
|
+
"group": "",
|
|
9919
|
+
"amis": {
|
|
9920
|
+
"hidden": true,
|
|
9921
|
+
"required": false
|
|
9922
|
+
}
|
|
9923
|
+
},
|
|
9924
|
+
"show_count": {
|
|
9925
|
+
"group": "",
|
|
9926
|
+
"amis": {
|
|
9927
|
+
"hidden": true,
|
|
9928
|
+
"required": false
|
|
9929
|
+
}
|
|
9930
|
+
},
|
|
9931
|
+
"type": {
|
|
9932
|
+
"group": "",
|
|
9933
|
+
"amis": {
|
|
9934
|
+
"hidden": true,
|
|
9935
|
+
"required": false
|
|
9936
|
+
}
|
|
9937
|
+
},
|
|
9938
|
+
"shared": {
|
|
9939
|
+
"group": "",
|
|
9940
|
+
"amis": {
|
|
9941
|
+
"visibleOn": "${false}"
|
|
9942
|
+
}
|
|
9943
|
+
},
|
|
9944
|
+
"shared_to": {
|
|
9945
|
+
"group": "",
|
|
9946
|
+
"amis":{
|
|
9947
|
+
"type": "radios",
|
|
9948
|
+
"inline": false
|
|
9949
|
+
}
|
|
9950
|
+
},
|
|
9951
|
+
"shared_to_organizations": {
|
|
9952
|
+
"group": ""
|
|
9953
|
+
},
|
|
9954
|
+
"filters": {
|
|
9955
|
+
"group": "",
|
|
9956
|
+
"amis": {
|
|
9957
|
+
"hidden": true
|
|
9958
|
+
}
|
|
9959
|
+
}
|
|
9960
|
+
}
|
|
9961
|
+
}
|
|
9962
|
+
|
|
9673
9963
|
/**
|
|
9674
9964
|
* 列表视图顶部第一行amisSchema
|
|
9675
9965
|
* @param {*} objectSchema 对象UISchema
|
|
@@ -9679,16 +9969,482 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
9679
9969
|
const { icon, label } = objectSchema;
|
|
9680
9970
|
const disabled_list_views = objectSchema.permissions.disabled_list_views;
|
|
9681
9971
|
const listViewButtonOptions = [];
|
|
9682
|
-
|
|
9683
|
-
|
|
9684
|
-
(
|
|
9685
|
-
|
|
9686
|
-
|
|
9687
|
-
|
|
9972
|
+
const initApiAdaptor = `
|
|
9973
|
+
var data;
|
|
9974
|
+
if (recordId) {
|
|
9975
|
+
data = payload.data || { _filters_type_controller: 'conditions' };
|
|
9976
|
+
//数据格式转换
|
|
9977
|
+
if (data) {
|
|
9978
|
+
data.sort = lodash.map(data.sort, (item) => {
|
|
9979
|
+
return item.field_name + ":" + item.order;
|
|
9980
|
+
});
|
|
9981
|
+
data.searchable_fields = lodash.map(data.searchable_fields, 'field');
|
|
9982
|
+
|
|
9983
|
+
if (data.filters && lodash.isString(data.filters)) {
|
|
9984
|
+
try {
|
|
9985
|
+
data.filters = JSON.parse(data.filters);
|
|
9986
|
+
} catch (e) { }
|
|
9987
|
+
}
|
|
9988
|
+
|
|
9989
|
+
if (data.filters && lodash.isString(data.filters)) {
|
|
9990
|
+
data._filters_type_controller = 'function';
|
|
9991
|
+
} else {
|
|
9992
|
+
data._filters_type_controller = 'conditions'
|
|
9993
|
+
}
|
|
9994
|
+
|
|
9995
|
+
if (data._filters_type_controller === 'conditions') {
|
|
9996
|
+
data._filters_conditions = window.amisConvert.filtersToConditions(data.filters || []);
|
|
9997
|
+
} else {
|
|
9998
|
+
data._filters_function = data.filters;
|
|
9999
|
+
}
|
|
10000
|
+
}
|
|
10001
|
+
} else {
|
|
10002
|
+
const uiSchema = api.body.uiSchema;
|
|
10003
|
+
const contextDefaultData = context && context.data && context.data.defaultData; const defaultData = api.body.defaultData || contextDefaultData;
|
|
10004
|
+
let defaultValues = {};
|
|
10005
|
+
_.each(uiSchema && uiSchema.fields, function (field) {
|
|
10006
|
+
var value = SteedosUI.getFieldDefaultValue(field, api.body.global);
|
|
10007
|
+
if (!_.isNil(value)) {
|
|
10008
|
+
defaultValues[field.name] = value;
|
|
10009
|
+
}
|
|
10010
|
+
});
|
|
10011
|
+
if (defaultData && _.isObject(defaultData) && !_.isArray(defaultData)) {
|
|
10012
|
+
data = Object.assign({}, defaultValues, defaultData);
|
|
10013
|
+
}else{data = Object.assign({}, defaultValues) }
|
|
10014
|
+
}
|
|
10015
|
+
for (key in data) {
|
|
10016
|
+
if (data[key] === null) {
|
|
10017
|
+
delete data[key];
|
|
10018
|
+
}
|
|
10019
|
+
}
|
|
10020
|
+
payload.data = data;
|
|
10021
|
+
delete payload.extensions; if (data.is_enable != false) { data.is_enable = true; };
|
|
10022
|
+
return payload;
|
|
10023
|
+
`;
|
|
10024
|
+
const apiRequestAdaptor = `
|
|
10025
|
+
delete formData.created;
|
|
10026
|
+
delete formData.created_by;
|
|
10027
|
+
delete formData.modified;
|
|
10028
|
+
delete formData.modified_by;
|
|
10029
|
+
delete formData._display;
|
|
10030
|
+
|
|
10031
|
+
//数据格式转换
|
|
10032
|
+
formData.sort = lodash.map(formData.sort, (item) => {
|
|
10033
|
+
const arr = item.split(':');
|
|
10034
|
+
return { field_name: arr[0], order: arr[1] };
|
|
10035
|
+
});
|
|
10036
|
+
|
|
10037
|
+
formData.searchable_fields = lodash.map(formData.searchable_fields, (item) => {
|
|
10038
|
+
return { field: item };
|
|
10039
|
+
});
|
|
10040
|
+
|
|
10041
|
+
if (!formData._filters_type_controller) {
|
|
10042
|
+
formData._filters_type_controller = 'conditions';
|
|
10043
|
+
}
|
|
10044
|
+
|
|
10045
|
+
if (formData._filters_type_controller === 'conditions' && formData._filters_conditions) {
|
|
10046
|
+
formData.filters = window.amisConvert.conditionsToFilters(formData._filters_conditions);
|
|
10047
|
+
// formData.filters = JSON.stringify(window.amisConvert.conditionsToFilters(formData._filters_conditions), null, 4);
|
|
10048
|
+
} else {
|
|
10049
|
+
formData.filters = formData._filters_function || null;
|
|
10050
|
+
}
|
|
10051
|
+
|
|
10052
|
+
delete formData._filters_type_controller;
|
|
10053
|
+
delete formData._filters_conditions;
|
|
10054
|
+
delete formData._filters_function;
|
|
10055
|
+
|
|
10056
|
+
query = \`mutation{record: object_listviews__insert(doc: {__saveData}){_id}}\`;
|
|
10057
|
+
if (formData.recordId) {
|
|
10058
|
+
query = \`mutation{record: object_listviews__update(id: "\` + formData._id + \`", doc: {__saveData}){_id}}\`;
|
|
10059
|
+
};
|
|
10060
|
+
__saveData = JSON.stringify(JSON.stringify(formData));
|
|
10061
|
+
|
|
10062
|
+
api.data = { query: query.replace('{__saveData}', __saveData) };
|
|
10063
|
+
return api;
|
|
10064
|
+
`;
|
|
10065
|
+
each(
|
|
10066
|
+
objectSchema.list_views,
|
|
10067
|
+
(listView, name) => {
|
|
10068
|
+
if(name === "lookup" || (disabled_list_views && disabled_list_views.indexOf(listView._id)>-1)){
|
|
10069
|
+
// 内置lookup为弹出选择专用视图,根据用户权限被禁用的视图,不显示在列表切换区域
|
|
10070
|
+
return;
|
|
9688
10071
|
}
|
|
9689
10072
|
listViewButtonOptions.push({
|
|
9690
10073
|
type: "button",
|
|
9691
10074
|
label: listView.label,
|
|
10075
|
+
body: [
|
|
10076
|
+
{
|
|
10077
|
+
"type": "flex",
|
|
10078
|
+
"alignItems": "center",
|
|
10079
|
+
"justify": "space-between",
|
|
10080
|
+
"items": [
|
|
10081
|
+
{
|
|
10082
|
+
"type": "tpl",
|
|
10083
|
+
"tpl": listView.label
|
|
10084
|
+
},
|
|
10085
|
+
{
|
|
10086
|
+
"type": "button",
|
|
10087
|
+
"className": "steedos-listview-edit-button ml-3",
|
|
10088
|
+
"icon": "fa fa-edit",
|
|
10089
|
+
"actionType": "dialog",
|
|
10090
|
+
"hiddenOn": `!((global.user.is_space_admin || global.userId == '${listView.owner || ""}') && !!'${listView.owner || ""}')`,
|
|
10091
|
+
"dialog": {
|
|
10092
|
+
"type": "dialog",
|
|
10093
|
+
"title": "编辑 列表视图",
|
|
10094
|
+
"data": {
|
|
10095
|
+
"object_name": "${objectName}",
|
|
10096
|
+
"recordId": listView._id,
|
|
10097
|
+
"listName": "${listName}",
|
|
10098
|
+
"appId": "${appId}",
|
|
10099
|
+
"context": "${context}",
|
|
10100
|
+
"global": "${global}",
|
|
10101
|
+
"_id": listView._id
|
|
10102
|
+
},
|
|
10103
|
+
"body": [
|
|
10104
|
+
{
|
|
10105
|
+
"type": "steedos-object-form",
|
|
10106
|
+
"label": "对象表单",
|
|
10107
|
+
"objectApiName": "object_listviews",
|
|
10108
|
+
"recordId": "${recordId}",
|
|
10109
|
+
"className": "sm:rounded sm:border-gray-300 bg-white",
|
|
10110
|
+
"layout": "horizontal",
|
|
10111
|
+
"form": {
|
|
10112
|
+
"id": "form_object_listviews"
|
|
10113
|
+
},
|
|
10114
|
+
"mode": "edit",
|
|
10115
|
+
"enableTabs": true,
|
|
10116
|
+
"fields": [
|
|
10117
|
+
"label",
|
|
10118
|
+
"sort_no",
|
|
10119
|
+
"crud_mode",
|
|
10120
|
+
"shared",
|
|
10121
|
+
"shared_to",
|
|
10122
|
+
'shared_to_organizations',
|
|
10123
|
+
"columns",
|
|
10124
|
+
"columns.$",
|
|
10125
|
+
"columns.$.field",
|
|
10126
|
+
"columns.$.width",
|
|
10127
|
+
"columns.$.wrap",
|
|
10128
|
+
"mobile_columns",
|
|
10129
|
+
"mobile_columns.$",
|
|
10130
|
+
"mobile_columns.$.field",
|
|
10131
|
+
"sort",
|
|
10132
|
+
"sort.$",
|
|
10133
|
+
"sort.$.field_name",
|
|
10134
|
+
"sort.$.order",
|
|
10135
|
+
"filters",
|
|
10136
|
+
"searchable_fields",
|
|
10137
|
+
"searchable_fields.$",
|
|
10138
|
+
"searchable_fields.$.field",
|
|
10139
|
+
],
|
|
10140
|
+
"tabsMode": "line",
|
|
10141
|
+
"fieldsExtend": {
|
|
10142
|
+
"columns": {
|
|
10143
|
+
"amis": {
|
|
10144
|
+
"showIndex": true,
|
|
10145
|
+
"footerToolbar": [
|
|
10146
|
+
{
|
|
10147
|
+
"type": "button",
|
|
10148
|
+
"label": "${'object_listviews.listview_form.field_set' | t}",
|
|
10149
|
+
"actionType": "dialog",
|
|
10150
|
+
"dialog": {
|
|
10151
|
+
"type": "dialog",
|
|
10152
|
+
"title": "${'object_listviews.listview_form.displayed_columns' | t}",
|
|
10153
|
+
"size": "md",
|
|
10154
|
+
"body": [
|
|
10155
|
+
{
|
|
10156
|
+
"type": "transfer",
|
|
10157
|
+
"options": [
|
|
10158
|
+
],
|
|
10159
|
+
"multiple": true,
|
|
10160
|
+
"id": "u:92c0b3cccca0",
|
|
10161
|
+
"required": true,
|
|
10162
|
+
"placeholder": "-",
|
|
10163
|
+
"className": "col-span-2 m-0",
|
|
10164
|
+
"checkAll": false,
|
|
10165
|
+
"searchable": true,
|
|
10166
|
+
"sortable": true,
|
|
10167
|
+
"itemHeight": 40,
|
|
10168
|
+
"source": {
|
|
10169
|
+
"method": "get",
|
|
10170
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
|
|
10171
|
+
"headers": {
|
|
10172
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
10173
|
+
},
|
|
10174
|
+
"requestAdaptor": "",
|
|
10175
|
+
"adaptor": ""
|
|
10176
|
+
},
|
|
10177
|
+
"joinValues": false,
|
|
10178
|
+
"extractValue": true,
|
|
10179
|
+
"name": "columns_quick_select",
|
|
10180
|
+
"value": "${columns|pick:field|split}"
|
|
10181
|
+
}
|
|
10182
|
+
],
|
|
10183
|
+
"onEvent": {
|
|
10184
|
+
"confirm": {
|
|
10185
|
+
"actions": [
|
|
10186
|
+
{
|
|
10187
|
+
"actionType": "custom",
|
|
10188
|
+
"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});"
|
|
10189
|
+
}
|
|
10190
|
+
]
|
|
10191
|
+
}
|
|
10192
|
+
}
|
|
10193
|
+
}
|
|
10194
|
+
}
|
|
10195
|
+
],
|
|
10196
|
+
"addable": false,
|
|
10197
|
+
"draggable": false,
|
|
10198
|
+
"columns": [
|
|
10199
|
+
{
|
|
10200
|
+
"name": "field",
|
|
10201
|
+
"inlineEditMode": false
|
|
10202
|
+
},
|
|
10203
|
+
{
|
|
10204
|
+
"name": "width",
|
|
10205
|
+
"width": 100
|
|
10206
|
+
},
|
|
10207
|
+
{
|
|
10208
|
+
"name": "wrap",
|
|
10209
|
+
"width": 50
|
|
10210
|
+
}
|
|
10211
|
+
],
|
|
10212
|
+
"enableDialog": false
|
|
10213
|
+
}
|
|
10214
|
+
},
|
|
10215
|
+
"sort": {
|
|
10216
|
+
"label": "",
|
|
10217
|
+
"amis": {
|
|
10218
|
+
"type": "tabs-transfer",
|
|
10219
|
+
"options": [
|
|
10220
|
+
],
|
|
10221
|
+
"id": "u:32f3e4e73115",
|
|
10222
|
+
"strictMode": true,
|
|
10223
|
+
"itemHeight": 40,
|
|
10224
|
+
"source": {
|
|
10225
|
+
"method": "get",
|
|
10226
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/sortFields/options",
|
|
10227
|
+
"headers": {
|
|
10228
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
10229
|
+
},
|
|
10230
|
+
"data": null,
|
|
10231
|
+
"requestAdaptor": "",
|
|
10232
|
+
"adaptor": "",
|
|
10233
|
+
"sendOn": "!!this.object_name"
|
|
10234
|
+
},
|
|
10235
|
+
"visibleOn": "!!this.object_name",
|
|
10236
|
+
"sortable": true,
|
|
10237
|
+
"className": "col-span-2 m-0",
|
|
10238
|
+
"searchable": true,
|
|
10239
|
+
"checkAll": false,
|
|
10240
|
+
"clearValueOnHidden": false,
|
|
10241
|
+
"joinValues": false,
|
|
10242
|
+
"extractValue": true,
|
|
10243
|
+
"en-US": {
|
|
10244
|
+
"label": "Default Sort Order"
|
|
10245
|
+
},
|
|
10246
|
+
"multiple": true
|
|
10247
|
+
}
|
|
10248
|
+
},
|
|
10249
|
+
"filters": {
|
|
10250
|
+
"label": "",
|
|
10251
|
+
"amis": {
|
|
10252
|
+
"type": "group",
|
|
10253
|
+
"body": [
|
|
10254
|
+
{
|
|
10255
|
+
"type": "radios",
|
|
10256
|
+
"label": "${'object_listviews.listview_form.filter_configuration_method' | t}",
|
|
10257
|
+
"name": "_filters_type_controller",
|
|
10258
|
+
"options": [
|
|
10259
|
+
{
|
|
10260
|
+
"label": "${'object_listviews.listview_form.conditions_combination' | t}",
|
|
10261
|
+
"value": "conditions"
|
|
10262
|
+
},
|
|
10263
|
+
{
|
|
10264
|
+
"label": "${'object_listviews.listview_form.javascript' | t}",
|
|
10265
|
+
"value": "function"
|
|
10266
|
+
}
|
|
10267
|
+
],
|
|
10268
|
+
"id": "u:318671bc196c",
|
|
10269
|
+
"joinValues": true,
|
|
10270
|
+
"className": "col-span-2 m-0",
|
|
10271
|
+
"language": "javascript",
|
|
10272
|
+
"visibleOn": "false",
|
|
10273
|
+
"en-US": {
|
|
10274
|
+
"label": "Controller"
|
|
10275
|
+
}
|
|
10276
|
+
},
|
|
10277
|
+
{
|
|
10278
|
+
"type": "condition-builder",
|
|
10279
|
+
"label": "",
|
|
10280
|
+
"labelClassName": "none",
|
|
10281
|
+
"name": "_filters_conditions",
|
|
10282
|
+
"description": "",
|
|
10283
|
+
"id": "u:a9f2232e30d7",
|
|
10284
|
+
"source": {
|
|
10285
|
+
"method": "get",
|
|
10286
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-listviews/getFilterFields?objectName=${object_name}",
|
|
10287
|
+
"dataType": "json",
|
|
10288
|
+
"headers": {
|
|
10289
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
10290
|
+
}
|
|
10291
|
+
},
|
|
10292
|
+
"disabled": false,
|
|
10293
|
+
"className": "col-span-2 m-0",
|
|
10294
|
+
"visibleOn": "!!this.object_name",
|
|
10295
|
+
"en-US": {
|
|
10296
|
+
"label": "Filters Conditions"
|
|
10297
|
+
}
|
|
10298
|
+
},
|
|
10299
|
+
{
|
|
10300
|
+
"type": "editor",
|
|
10301
|
+
"label": "${'object_listviews.listview_form.javascript' | t}",
|
|
10302
|
+
"name": "_filters_function",
|
|
10303
|
+
"id": "u:84714ec9abba",
|
|
10304
|
+
"visibleOn": "!!this.object_name && !!this._filters_type_controller && _filters_type_controller== 'function'",
|
|
10305
|
+
"className": "col-span-2 m-0",
|
|
10306
|
+
"labelClassName": "hidden"
|
|
10307
|
+
}
|
|
10308
|
+
]
|
|
10309
|
+
}
|
|
10310
|
+
},
|
|
10311
|
+
"mobile_columns": {
|
|
10312
|
+
"amis": {
|
|
10313
|
+
"showIndex": true,
|
|
10314
|
+
"footerToolbar": [
|
|
10315
|
+
{
|
|
10316
|
+
"type": "button",
|
|
10317
|
+
"label": "${'object_listviews.listview_form.field_set' | t}",
|
|
10318
|
+
"actionType": "dialog",
|
|
10319
|
+
"dialog": {
|
|
10320
|
+
"type": "dialog",
|
|
10321
|
+
"title": "${'object_listviews.listview_form.displayed_columns' | t}",
|
|
10322
|
+
"size": "md",
|
|
10323
|
+
"body": [
|
|
10324
|
+
{
|
|
10325
|
+
"type": "transfer",
|
|
10326
|
+
"options": [
|
|
10327
|
+
],
|
|
10328
|
+
"multiple": true,
|
|
10329
|
+
"id": "u:92c0b3cccca0",
|
|
10330
|
+
"required": true,
|
|
10331
|
+
"placeholder": "-",
|
|
10332
|
+
"className": "col-span-2 m-0",
|
|
10333
|
+
"itemHeight": 40,
|
|
10334
|
+
"checkAll": false,
|
|
10335
|
+
"searchable": true,
|
|
10336
|
+
"sortable": true,
|
|
10337
|
+
"source": {
|
|
10338
|
+
"method": "get",
|
|
10339
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
|
|
10340
|
+
"headers": {
|
|
10341
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
10342
|
+
},
|
|
10343
|
+
"requestAdaptor": "",
|
|
10344
|
+
"adaptor": ""
|
|
10345
|
+
},
|
|
10346
|
+
"joinValues": false,
|
|
10347
|
+
"extractValue": true,
|
|
10348
|
+
"name": "columns_quick_select",
|
|
10349
|
+
"value": "${mobile_columns|pick:field|split}"
|
|
10350
|
+
}
|
|
10351
|
+
],
|
|
10352
|
+
"onEvent": {
|
|
10353
|
+
"confirm": {
|
|
10354
|
+
"actions": [
|
|
10355
|
+
{
|
|
10356
|
+
"actionType": "custom",
|
|
10357
|
+
"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});"
|
|
10358
|
+
}
|
|
10359
|
+
]
|
|
10360
|
+
}
|
|
10361
|
+
}
|
|
10362
|
+
}
|
|
10363
|
+
}
|
|
10364
|
+
],
|
|
10365
|
+
"columns": [
|
|
10366
|
+
{
|
|
10367
|
+
"name": "field",
|
|
10368
|
+
"inlineEditMode": false
|
|
10369
|
+
}
|
|
10370
|
+
],
|
|
10371
|
+
"addable": false,
|
|
10372
|
+
"draggable": false,
|
|
10373
|
+
"enableDialog": false
|
|
10374
|
+
}
|
|
10375
|
+
},
|
|
10376
|
+
"searchable_fields": {
|
|
10377
|
+
"label": "",
|
|
10378
|
+
"amis": {
|
|
10379
|
+
"type": "transfer",
|
|
10380
|
+
"options": [
|
|
10381
|
+
],
|
|
10382
|
+
"selectMode": "list",
|
|
10383
|
+
"searchable": true,
|
|
10384
|
+
"searchApi": "",
|
|
10385
|
+
"sortable": true,
|
|
10386
|
+
"mode": "normal",
|
|
10387
|
+
"searchResultMode": "list",
|
|
10388
|
+
"joinValues": false,
|
|
10389
|
+
"extractValue": true,
|
|
10390
|
+
"itemHeight": 40,
|
|
10391
|
+
"source": {
|
|
10392
|
+
"method": "get",
|
|
10393
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
|
|
10394
|
+
"headers": {
|
|
10395
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
10396
|
+
},
|
|
10397
|
+
"data": null,
|
|
10398
|
+
"requestAdaptor": "",
|
|
10399
|
+
"adaptor": "",
|
|
10400
|
+
"sendOn": "!!this.object_name"
|
|
10401
|
+
},
|
|
10402
|
+
"visibleOn": "!!this.object_name",
|
|
10403
|
+
"className": "col-span-2 m-0",
|
|
10404
|
+
"multiple": true,
|
|
10405
|
+
"id": "u:adb91066539e"
|
|
10406
|
+
}
|
|
10407
|
+
},
|
|
10408
|
+
"shared_to": {
|
|
10409
|
+
"amis":{
|
|
10410
|
+
"type": "radios",
|
|
10411
|
+
"inline": false
|
|
10412
|
+
},
|
|
10413
|
+
"group": "",
|
|
10414
|
+
"is_wide": true
|
|
10415
|
+
}
|
|
10416
|
+
},
|
|
10417
|
+
initApiAdaptor,
|
|
10418
|
+
apiRequestAdaptor,
|
|
10419
|
+
"onEvent": {
|
|
10420
|
+
"submitSucc": {
|
|
10421
|
+
"weight": 0,
|
|
10422
|
+
"actions": [
|
|
10423
|
+
{
|
|
10424
|
+
"args": {
|
|
10425
|
+
"url": "${context.rootUrl}/app/${appId}/${object_name}/grid/${name}",
|
|
10426
|
+
"blank": false
|
|
10427
|
+
},
|
|
10428
|
+
"actionType": "url",
|
|
10429
|
+
},
|
|
10430
|
+
]
|
|
10431
|
+
}
|
|
10432
|
+
},
|
|
10433
|
+
"id": "u:ce9e3fcc411a"
|
|
10434
|
+
}
|
|
10435
|
+
],
|
|
10436
|
+
"className": "steedos-overflow-visible-dialog",
|
|
10437
|
+
"showCloseButton": true,
|
|
10438
|
+
"showErrorMsg": true,
|
|
10439
|
+
"showLoading": true,
|
|
10440
|
+
"closeOnEsc": false,
|
|
10441
|
+
"dataMapSwitch": false,
|
|
10442
|
+
"size": "lg"
|
|
10443
|
+
}
|
|
10444
|
+
}
|
|
10445
|
+
]
|
|
10446
|
+
}
|
|
10447
|
+
],
|
|
9692
10448
|
actionType: "link",
|
|
9693
10449
|
link: `/app/\${appId}/${objectSchema.name}/grid/${name}`
|
|
9694
10450
|
});
|
|
@@ -9722,6 +10478,8 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
9722
10478
|
"visibleOn": "${display == 'split'?true:false}"
|
|
9723
10479
|
});
|
|
9724
10480
|
}
|
|
10481
|
+
const listviewNewButton = getNewListviewButtonSchema();
|
|
10482
|
+
listviewNewButton.visibleOn = "global.user.is_space_admin";
|
|
9725
10483
|
return {
|
|
9726
10484
|
"type": "grid",
|
|
9727
10485
|
"columns": [
|
|
@@ -9752,14 +10510,24 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
9752
10510
|
},
|
|
9753
10511
|
{
|
|
9754
10512
|
"type": "dropdown-button",
|
|
9755
|
-
"className": "",
|
|
10513
|
+
"className": "steedos-listview-change-button",
|
|
9756
10514
|
"label": "\${listName ? uiSchema.list_views[listName].label : uiSchema.list_views[defaultListName].label}",
|
|
9757
10515
|
"rightIcon": "fa fa-caret-down",
|
|
9758
10516
|
"size": "sm",
|
|
9759
10517
|
"hideCaret": true,
|
|
9760
10518
|
"closeOnClick": true,
|
|
9761
10519
|
"btnClassName": "!bg-transparent !border-none !hover:border-none text-lg h-5 font-bold p-0 text-black leading-none",
|
|
9762
|
-
"buttons":
|
|
10520
|
+
"buttons": [
|
|
10521
|
+
...listViewButtonOptions,
|
|
10522
|
+
{
|
|
10523
|
+
"children": [
|
|
10524
|
+
{
|
|
10525
|
+
"type": "divider"
|
|
10526
|
+
}
|
|
10527
|
+
]
|
|
10528
|
+
},
|
|
10529
|
+
listviewNewButton
|
|
10530
|
+
]
|
|
9763
10531
|
}
|
|
9764
10532
|
],
|
|
9765
10533
|
"md": "",
|
|
@@ -9915,6 +10683,7 @@ function getObjectListHeader$1(objectSchema, listViewName, ctx) {
|
|
|
9915
10683
|
function getBackButtonSchema(){
|
|
9916
10684
|
return {
|
|
9917
10685
|
"type": "service",
|
|
10686
|
+
"className": "steedos-object-record-detail-header-back-button",
|
|
9918
10687
|
"onEvent": {
|
|
9919
10688
|
"@history_paths.changed": {
|
|
9920
10689
|
"actions": [
|
|
@@ -10201,7 +10970,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
10201
10970
|
id: `page_readonly_${name}_header`,
|
|
10202
10971
|
name: `page`,
|
|
10203
10972
|
body: body,
|
|
10204
|
-
className:
|
|
10973
|
+
className: "steedos-object-record-detail-header"
|
|
10205
10974
|
}
|
|
10206
10975
|
|
|
10207
10976
|
}
|
|
@@ -10221,279 +10990,69 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
10221
10990
|
"body": [
|
|
10222
10991
|
{
|
|
10223
10992
|
"type": "grid",
|
|
10224
|
-
"valign": "middle",
|
|
10225
|
-
"columns": [
|
|
10226
|
-
{
|
|
10227
|
-
"body": [
|
|
10228
|
-
{
|
|
10229
|
-
"type": "grid",
|
|
10230
|
-
"valign": "middle",
|
|
10231
|
-
"className": "flex justify-between",
|
|
10232
|
-
"columns": [
|
|
10233
|
-
{
|
|
10234
|
-
"body": {
|
|
10235
|
-
"type": "tpl",
|
|
10236
|
-
"className": "block",
|
|
10237
|
-
// "tpl": `<img class=\"slds-icon_small slds-icon_container slds-icon-standard-${standardIcon}\" src=\"\${context.rootUrl}/unpkg.com/@salesforce-ux/design-system/assets/icons/standard/${icon}.svg\" />`
|
|
10238
|
-
"tpl":`<svg class="w-6 h-6 slds-icon slds-icon_container slds-icon-standard-${standardIcon}" aria-hidden="true"><use xlink:href="/assets/icons/standard-sprite/svg/symbols.svg#${icon}"></use></svg>`
|
|
10239
|
-
},
|
|
10240
|
-
"md": "auto",
|
|
10241
|
-
"className": "",
|
|
10242
|
-
"columnClassName": "flex justify-center items-center"
|
|
10243
|
-
},
|
|
10244
|
-
{
|
|
10245
|
-
"body": [
|
|
10246
|
-
{
|
|
10247
|
-
"type": "tpl",
|
|
10248
|
-
"tpl": `<a class="text-black text-base font-bold hover:font-bold" href="/app/\${appId}/\${_master.objectName}/\${_master.recordId}/\${objectName}/grid?related_field_name=\${relatedKey}">${relatedLabel}(\${$count})</a>`,
|
|
10249
|
-
"inline": false,
|
|
10250
|
-
"wrapperComponent": "",
|
|
10251
|
-
"className": "",
|
|
10252
|
-
}
|
|
10253
|
-
],
|
|
10254
|
-
"md": "",
|
|
10255
|
-
"valign": "middle",
|
|
10256
|
-
"columnClassName": "p-l-xs"
|
|
10257
|
-
}
|
|
10258
|
-
]
|
|
10259
|
-
}
|
|
10260
|
-
],
|
|
10261
|
-
"md": "auto"
|
|
10262
|
-
},
|
|
10263
|
-
{
|
|
10264
|
-
"body": {
|
|
10265
|
-
"type": "flex",
|
|
10266
|
-
"items": amisButtonsSchema,
|
|
10267
|
-
},
|
|
10268
|
-
"md": "auto"
|
|
10269
|
-
}
|
|
10270
|
-
],
|
|
10271
|
-
"className": "flex justify-between min-h-8 items-center"
|
|
10272
|
-
}
|
|
10273
|
-
],
|
|
10274
|
-
"className": "steedos-record-related-header py-2 px-3 bg-gray-50 border rounded"
|
|
10275
|
-
};
|
|
10276
|
-
return recordRelatedListHeader;
|
|
10277
|
-
}
|
|
10278
|
-
|
|
10279
|
-
/**
|
|
10280
|
-
* 点击记录详细界面相关表顶部标题进入的相关表页面的顶部amisSchema
|
|
10281
|
-
* @param {*} objectSchema
|
|
10282
|
-
* @param {*} recordId
|
|
10283
|
-
* @param {*} relatedObjectName
|
|
10284
|
-
* @returns amisSchema
|
|
10285
|
-
*/
|
|
10286
|
-
async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
|
|
10287
|
-
}
|
|
10288
|
-
|
|
10289
|
-
const getNewListviewButtonSchema = ()=>{
|
|
10290
|
-
return {
|
|
10291
|
-
"type": "button",
|
|
10292
|
-
"label": instance.t('frontend_listview_control_new_label'),
|
|
10293
|
-
"onEvent": {
|
|
10294
|
-
"click": {
|
|
10295
|
-
"weight": 0,
|
|
10296
|
-
"actions": [
|
|
10297
|
-
{
|
|
10298
|
-
"dialog": {
|
|
10299
|
-
"type": "dialog",
|
|
10300
|
-
"title": instance.t('frontend_listview_control_new_title'),
|
|
10301
|
-
"data": {
|
|
10302
|
-
//"&":"$$",2.7、2.9、3.0在此处失效
|
|
10303
|
-
"all": "${uiSchema.list_views.all}",
|
|
10304
|
-
"list_view": "${uiSchema.list_views[listName]}",
|
|
10305
|
-
"appId": "${appId}",
|
|
10306
|
-
"global": "${global}",
|
|
10307
|
-
"targetObjectName": "${objectName}",
|
|
10308
|
-
"context": "${context}"
|
|
10309
|
-
},
|
|
10310
|
-
"body": [
|
|
10311
|
-
{
|
|
10312
|
-
"type": "steedos-object-form",
|
|
10313
|
-
"label": "对象表单",
|
|
10314
|
-
"objectApiName": "object_listviews",
|
|
10315
|
-
"recordId": "",
|
|
10316
|
-
"mode": "edit",
|
|
10317
|
-
"layout": "normal",
|
|
10318
|
-
"defaultData": {
|
|
10319
|
-
"&": "${list_view}",
|
|
10320
|
-
"name":"",
|
|
10321
|
-
"label":"",
|
|
10322
|
-
"filters":"",
|
|
10323
|
-
"shared":false,
|
|
10324
|
-
"object_name": "${targetObjectName}",
|
|
10325
|
-
"_id":"",
|
|
10326
|
-
"shared_to": null,
|
|
10327
|
-
"shared_to_organizations": null,
|
|
10328
|
-
"locked": false,
|
|
10329
|
-
"owner": null,
|
|
10330
|
-
"company_id": null,
|
|
10331
|
-
"company_ids": null,
|
|
10332
|
-
"is_system": false
|
|
10333
|
-
},
|
|
10334
|
-
"fieldsExtend": fieldsExtend$5(),
|
|
10335
|
-
"fields": fields$1(),
|
|
10336
|
-
"onEvent": {
|
|
10337
|
-
"submitSucc": {
|
|
10338
|
-
"weight": 0,
|
|
10339
|
-
"actions": [
|
|
10340
|
-
{
|
|
10341
|
-
"args": {
|
|
10342
|
-
// 直接使用recordId不能拿到数据,只能通过result里面拿数据
|
|
10343
|
-
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
10344
|
-
"blank": false
|
|
10345
|
-
},
|
|
10346
|
-
"actionType": "url",
|
|
10347
|
-
}
|
|
10348
|
-
]
|
|
10349
|
-
}
|
|
10350
|
-
},
|
|
10351
|
-
"messages": {
|
|
10352
|
-
"success": instance.t('frontend_listview_control_new_message_success'),
|
|
10353
|
-
"failed": instance.t('frontend_listview_control_new_message_failed')
|
|
10354
|
-
},
|
|
10355
|
-
}
|
|
10356
|
-
],
|
|
10357
|
-
"showCloseButton": true,
|
|
10358
|
-
"showErrorMsg": true,
|
|
10359
|
-
"showLoading": true,
|
|
10360
|
-
"closeOnEsc": false,
|
|
10361
|
-
"dataMapSwitch": false,
|
|
10362
|
-
"size": "lg"
|
|
10363
|
-
},
|
|
10364
|
-
"actionType": "dialog"
|
|
10365
|
-
}
|
|
10366
|
-
]
|
|
10367
|
-
}
|
|
10368
|
-
}
|
|
10369
|
-
}
|
|
10370
|
-
};
|
|
10371
|
-
|
|
10372
|
-
function fields$1(){
|
|
10373
|
-
return [
|
|
10374
|
-
"label",
|
|
10375
|
-
"name",
|
|
10376
|
-
"object_name",
|
|
10377
|
-
"filter_scope",
|
|
10378
|
-
"show_count",
|
|
10379
|
-
"columns",
|
|
10380
|
-
"sort",
|
|
10381
|
-
"filters",
|
|
10382
|
-
"mobile_columns",
|
|
10383
|
-
"searchable_fields",
|
|
10384
|
-
"is_system",
|
|
10385
|
-
"shared",
|
|
10386
|
-
"shared_to",
|
|
10387
|
-
"shared_to_organizations"
|
|
10388
|
-
]
|
|
10389
|
-
}
|
|
10390
|
-
|
|
10391
|
-
function fieldsExtend$5(){
|
|
10392
|
-
return {
|
|
10393
|
-
"group": "",
|
|
10394
|
-
"label": {
|
|
10395
|
-
"group": "",
|
|
10396
|
-
"is_wide": true
|
|
10397
|
-
},
|
|
10398
|
-
"name": {
|
|
10399
|
-
"group": "",
|
|
10400
|
-
"amis": {
|
|
10401
|
-
"hidden": true,
|
|
10402
|
-
"required": false
|
|
10403
|
-
}
|
|
10404
|
-
},
|
|
10405
|
-
"object_name": {
|
|
10406
|
-
"group": "",
|
|
10407
|
-
"amis": {
|
|
10408
|
-
"hidden": true
|
|
10409
|
-
}
|
|
10410
|
-
},
|
|
10411
|
-
"filter_scope": {
|
|
10412
|
-
"group": "",
|
|
10413
|
-
"amis": {
|
|
10414
|
-
"hidden": true,
|
|
10415
|
-
"required": false
|
|
10416
|
-
}
|
|
10417
|
-
},
|
|
10418
|
-
"columns": {
|
|
10419
|
-
"group": "",
|
|
10420
|
-
"amis": {
|
|
10421
|
-
"hidden": true,
|
|
10422
|
-
"required": false
|
|
10423
|
-
}
|
|
10424
|
-
},
|
|
10425
|
-
"mobile_columns":{
|
|
10426
|
-
"group": "",
|
|
10427
|
-
"amis": {
|
|
10428
|
-
"hidden": true,
|
|
10429
|
-
"required": false
|
|
10430
|
-
}
|
|
10431
|
-
},
|
|
10432
|
-
"searchable_fields":{
|
|
10433
|
-
"group": "",
|
|
10434
|
-
"amis": {
|
|
10435
|
-
"hidden": true,
|
|
10436
|
-
"required": false
|
|
10437
|
-
}
|
|
10438
|
-
},
|
|
10439
|
-
"filter_fields": {
|
|
10440
|
-
"group": "",
|
|
10441
|
-
"amis": {
|
|
10442
|
-
"hidden": true,
|
|
10443
|
-
"required": false
|
|
10444
|
-
}
|
|
10445
|
-
},
|
|
10446
|
-
"scrolling_mode": {
|
|
10447
|
-
"group": "",
|
|
10448
|
-
"amis": {
|
|
10449
|
-
"hidden": true,
|
|
10450
|
-
"required": false
|
|
10451
|
-
}
|
|
10452
|
-
},
|
|
10453
|
-
"sort": {
|
|
10454
|
-
"group": "",
|
|
10455
|
-
"amis": {
|
|
10456
|
-
"hidden": true,
|
|
10457
|
-
"required": false
|
|
10458
|
-
}
|
|
10459
|
-
},
|
|
10460
|
-
"show_count": {
|
|
10461
|
-
"group": "",
|
|
10462
|
-
"amis": {
|
|
10463
|
-
"hidden": true,
|
|
10464
|
-
"required": false
|
|
10465
|
-
}
|
|
10466
|
-
},
|
|
10467
|
-
"type": {
|
|
10468
|
-
"group": "",
|
|
10469
|
-
"amis": {
|
|
10470
|
-
"hidden": true,
|
|
10471
|
-
"required": false
|
|
10472
|
-
}
|
|
10473
|
-
},
|
|
10474
|
-
"shared": {
|
|
10475
|
-
"group": "",
|
|
10476
|
-
"amis": {
|
|
10477
|
-
"visibleOn": "${false}"
|
|
10478
|
-
}
|
|
10479
|
-
},
|
|
10480
|
-
"shared_to": {
|
|
10481
|
-
"group": "",
|
|
10482
|
-
"amis":{
|
|
10483
|
-
"type": "radios",
|
|
10484
|
-
"inline": false
|
|
10485
|
-
}
|
|
10486
|
-
},
|
|
10487
|
-
"shared_to_organizations": {
|
|
10488
|
-
"group": ""
|
|
10489
|
-
},
|
|
10490
|
-
"filters": {
|
|
10491
|
-
"group": "",
|
|
10492
|
-
"amis": {
|
|
10493
|
-
"hidden": true
|
|
10993
|
+
"valign": "middle",
|
|
10994
|
+
"columns": [
|
|
10995
|
+
{
|
|
10996
|
+
"body": [
|
|
10997
|
+
{
|
|
10998
|
+
"type": "grid",
|
|
10999
|
+
"valign": "middle",
|
|
11000
|
+
"className": "flex justify-between",
|
|
11001
|
+
"columns": [
|
|
11002
|
+
{
|
|
11003
|
+
"body": {
|
|
11004
|
+
"type": "tpl",
|
|
11005
|
+
"className": "block",
|
|
11006
|
+
// "tpl": `<img class=\"slds-icon_small slds-icon_container slds-icon-standard-${standardIcon}\" src=\"\${context.rootUrl}/unpkg.com/@salesforce-ux/design-system/assets/icons/standard/${icon}.svg\" />`
|
|
11007
|
+
"tpl":`<svg class="w-6 h-6 slds-icon slds-icon_container slds-icon-standard-${standardIcon}" aria-hidden="true"><use xlink:href="/assets/icons/standard-sprite/svg/symbols.svg#${icon}"></use></svg>`
|
|
11008
|
+
},
|
|
11009
|
+
"md": "auto",
|
|
11010
|
+
"className": "",
|
|
11011
|
+
"columnClassName": "flex justify-center items-center"
|
|
11012
|
+
},
|
|
11013
|
+
{
|
|
11014
|
+
"body": [
|
|
11015
|
+
{
|
|
11016
|
+
"type": "tpl",
|
|
11017
|
+
"tpl": `<a class="text-black text-base font-bold hover:font-bold" href="/app/\${appId}/\${_master.objectName}/\${_master.recordId}/\${objectName}/grid?related_field_name=\${relatedKey}">${relatedLabel}(\${$count})</a>`,
|
|
11018
|
+
"inline": false,
|
|
11019
|
+
"wrapperComponent": "",
|
|
11020
|
+
"className": "",
|
|
11021
|
+
}
|
|
11022
|
+
],
|
|
11023
|
+
"md": "",
|
|
11024
|
+
"valign": "middle",
|
|
11025
|
+
"columnClassName": "p-l-xs"
|
|
11026
|
+
}
|
|
11027
|
+
]
|
|
11028
|
+
}
|
|
11029
|
+
],
|
|
11030
|
+
"md": "auto"
|
|
11031
|
+
},
|
|
11032
|
+
{
|
|
11033
|
+
"body": {
|
|
11034
|
+
"type": "flex",
|
|
11035
|
+
"items": amisButtonsSchema,
|
|
11036
|
+
},
|
|
11037
|
+
"md": "auto"
|
|
11038
|
+
}
|
|
11039
|
+
],
|
|
11040
|
+
"className": "flex justify-between min-h-8 items-center"
|
|
10494
11041
|
}
|
|
10495
|
-
|
|
10496
|
-
|
|
11042
|
+
],
|
|
11043
|
+
"className": "steedos-record-related-header py-2 px-3 bg-gray-50 border rounded"
|
|
11044
|
+
};
|
|
11045
|
+
return recordRelatedListHeader;
|
|
11046
|
+
}
|
|
11047
|
+
|
|
11048
|
+
/**
|
|
11049
|
+
* 点击记录详细界面相关表顶部标题进入的相关表页面的顶部amisSchema
|
|
11050
|
+
* @param {*} objectSchema
|
|
11051
|
+
* @param {*} recordId
|
|
11052
|
+
* @param {*} relatedObjectName
|
|
11053
|
+
* @returns amisSchema
|
|
11054
|
+
*/
|
|
11055
|
+
async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
|
|
10497
11056
|
}
|
|
10498
11057
|
|
|
10499
11058
|
const getCopyListviewButtonSchema = ()=>{
|
|
@@ -11461,6 +12020,10 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
11461
12020
|
// const scope = event.context.scoped;
|
|
11462
12021
|
// 如果点击过顶部搜索栏表单的取消按钮,会把此处event.data.__super.__super.__super中的搜索表单项的所有字段设置为null
|
|
11463
12022
|
// 点击取消按钮后继续在表单项中输入过滤条件且最后没有点击回车按键或点击表单项搜索按钮的话,在快速搜索中点击回车按钮提交搜索会所顶部搜索表单中的字段值清空
|
|
12023
|
+
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
12024
|
+
if(!filterForm){
|
|
12025
|
+
return;
|
|
12026
|
+
}
|
|
11464
12027
|
let isLookup = event.data.isLookup;
|
|
11465
12028
|
let __lookupField = event.data.__lookupField;
|
|
11466
12029
|
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
@@ -11471,9 +12034,8 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
11471
12034
|
}
|
|
11472
12035
|
__changedFilterFormValuesKey += lookupTag;
|
|
11473
12036
|
}
|
|
11474
|
-
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
11475
12037
|
setTimeout(function(){
|
|
11476
|
-
filterForm.setValues(event.data[__changedFilterFormValuesKey]);
|
|
12038
|
+
filterForm && filterForm.setValues(event.data[__changedFilterFormValuesKey]);
|
|
11477
12039
|
}, 500);
|
|
11478
12040
|
`;
|
|
11479
12041
|
|
|
@@ -12138,6 +12700,8 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
12138
12700
|
//将_display放入crud的columns的倒数第二列中(最后一列会影响固定列),可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
12139
12701
|
body.columns.splice(body.columns.length -1 , 0, {name: '_display',type: 'static', width: 1, placeholder: "",id: objectSchema.name + "_display_${_index}", tpl: "${''}"});
|
|
12140
12702
|
}
|
|
12703
|
+
// 去除数组中的异常值,如null,undefined等
|
|
12704
|
+
body.columns = _$1__default.compact(body.columns);
|
|
12141
12705
|
|
|
12142
12706
|
if (defaults) {
|
|
12143
12707
|
const headerSchema = defaults.headerSchema;
|
|
@@ -13320,6 +13884,8 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
|
|
|
13320
13884
|
wrap: column.wrap // wrap = true 是没效果的
|
|
13321
13885
|
}
|
|
13322
13886
|
);
|
|
13887
|
+
} else if (filedInfo && filedInfo.type === 'object') {
|
|
13888
|
+
columnField = uiSchema.fields[column.field];
|
|
13323
13889
|
}
|
|
13324
13890
|
} else {
|
|
13325
13891
|
if (uiSchema.fields[column.field]) {
|
|
@@ -13454,7 +14020,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
13454
14020
|
};
|
|
13455
14021
|
const content = {
|
|
13456
14022
|
"type": "tabs",
|
|
13457
|
-
"className": "steedos-record-tabs bg-white p-4 m-2 border rounded",
|
|
14023
|
+
"className": "steedos-record-tabs bg-white p-4 sm:m-2 sm:border sm:rounded",
|
|
13458
14024
|
"contentClassName": "bg-none",
|
|
13459
14025
|
"tabs": [
|
|
13460
14026
|
detailed
|
|
@@ -14561,7 +15127,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
14561
15127
|
}
|
|
14562
15128
|
|
|
14563
15129
|
var fieldFilters = ${JSON.stringify(field.filters)};
|
|
14564
|
-
var currentAmis = amisRequire('amis');
|
|
15130
|
+
var currentAmis = (window.amisRequire && window.amisRequire('amis')) || Amis;
|
|
14565
15131
|
//递归fieldFilters数组,检查每一个元素,判断若是公式,就仅把它解析
|
|
14566
15132
|
function traverseNestedArray(arr) {
|
|
14567
15133
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -14572,7 +15138,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
14572
15138
|
// 如果当前元素不是数组,则处理该元素
|
|
14573
15139
|
// 下面正则用于匹配amis公式\${}
|
|
14574
15140
|
if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
|
|
14575
|
-
|
|
15141
|
+
try{
|
|
15142
|
+
arr[i] = currentAmis.evaluate(arr[i], api.context);
|
|
15143
|
+
}catch(ex){
|
|
15144
|
+
console.error("运行lookup过滤公式时出现错误:",ex);
|
|
15145
|
+
}
|
|
14576
15146
|
}
|
|
14577
15147
|
}
|
|
14578
15148
|
}
|
|
@@ -14733,8 +15303,8 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
14733
15303
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
14734
15304
|
const isCreate = _$1.isBoolean(field.create) ? field.create : true;
|
|
14735
15305
|
// lookup字段配置过滤条件就强制不显示新建按钮
|
|
14736
|
-
let
|
|
14737
|
-
if (isAllowCreate && isCreate && !
|
|
15306
|
+
let hasFilters = !_$1.isEmpty(field.filters) || !!field.filtersFunction || !!field._filtersFunction;
|
|
15307
|
+
if (isAllowCreate && isCreate && !hasFilters) {
|
|
14738
15308
|
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
14739
15309
|
new_button.align = "right";
|
|
14740
15310
|
// 保持快速搜索放在最左侧,新建按钮往里插,而不是push到最后
|
|
@@ -14978,7 +15548,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
14978
15548
|
// }
|
|
14979
15549
|
|
|
14980
15550
|
var fieldFilters = ${JSON.stringify(field.filters)};
|
|
14981
|
-
var currentAmis = amisRequire('amis');
|
|
15551
|
+
var currentAmis = (window.amisRequire && window.amisRequire('amis')) || Amis;
|
|
14982
15552
|
//递归fieldFilters数组,检查每一个元素,判断若是公式,就仅把它解析
|
|
14983
15553
|
function traverseNestedArray(arr) {
|
|
14984
15554
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -14989,7 +15559,11 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
14989
15559
|
// 如果当前元素不是数组,则处理该元素
|
|
14990
15560
|
// 下面正则用于匹配amis公式\${}
|
|
14991
15561
|
if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
|
|
14992
|
-
|
|
15562
|
+
try{
|
|
15563
|
+
arr[i] = currentAmis.evaluate(arr[i], api.context);
|
|
15564
|
+
}catch(ex){
|
|
15565
|
+
console.error("运行lookup过滤公式时出现错误:",ex);
|
|
15566
|
+
}
|
|
14993
15567
|
}
|
|
14994
15568
|
}
|
|
14995
15569
|
}
|
|
@@ -15401,8 +15975,8 @@ if(typeof window != 'undefined'){
|
|
|
15401
15975
|
/*
|
|
15402
15976
|
* @Author: baozhoutao@steedos.com
|
|
15403
15977
|
* @Date: 2023-01-13 17:27:54
|
|
15404
|
-
* @LastEditors:
|
|
15405
|
-
* @LastEditTime: 2024-
|
|
15978
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
15979
|
+
* @LastEditTime: 2024-06-07 13:39:34
|
|
15406
15980
|
* @Description:
|
|
15407
15981
|
*/
|
|
15408
15982
|
|
|
@@ -15439,6 +16013,7 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
|
|
|
15439
16013
|
"name": field.name,
|
|
15440
16014
|
"labelClassName": "none",
|
|
15441
16015
|
"language": "markdown",
|
|
16016
|
+
"options": field.amis ? field.amis.editorOptions : null
|
|
15442
16017
|
}
|
|
15443
16018
|
]
|
|
15444
16019
|
},
|
|
@@ -16095,6 +16670,21 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
16095
16670
|
type: getAmisStaticFieldType$1('url', readonly, field),
|
|
16096
16671
|
static: readonly ? true : false
|
|
16097
16672
|
};
|
|
16673
|
+
if(!readonly){
|
|
16674
|
+
// amis input-url控件不支持相对路径,这里支持下
|
|
16675
|
+
// 如果要使用amis原生input-url控件的默认的isUrl验证效果或自定义字段validations效果,配置字段的amis.validations属性即可,配置为null或空字符串则使用amis默认的isUrl效果
|
|
16676
|
+
let fieldAmisValidations = field.amis?.validations;
|
|
16677
|
+
if(typeof fieldAmisValidations === "undefined"){
|
|
16678
|
+
Object.assign(convertData, {
|
|
16679
|
+
"validations": {
|
|
16680
|
+
"matchRegexp": "^((http:\\/\\/|https:\\/\\/|ftp:\\/\\/|sftp:\\/\\/)+([^\\s\\/\\.]+(\\.[^\\s\\/\\.]+)+))*(\\/[^\\s\\.\\/]+)*$"
|
|
16681
|
+
},
|
|
16682
|
+
"validationErrors": {
|
|
16683
|
+
"matchRegexp": instance.t('frontend_form_validation_failed_url')//"URL 格式不正确"
|
|
16684
|
+
}
|
|
16685
|
+
});
|
|
16686
|
+
}
|
|
16687
|
+
}
|
|
16098
16688
|
if(readonly && field.show_as_qr){
|
|
16099
16689
|
convertData = {
|
|
16100
16690
|
type: "control",
|
|
@@ -16160,13 +16750,13 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
16160
16750
|
};
|
|
16161
16751
|
break;
|
|
16162
16752
|
case 'avatar':
|
|
16163
|
-
convertData = getAmisFileSchema(field, readonly);
|
|
16753
|
+
convertData = await getAmisFileSchema(field, readonly, ctx);
|
|
16164
16754
|
break;
|
|
16165
16755
|
case 'image':
|
|
16166
|
-
convertData = getAmisFileSchema(field, readonly);
|
|
16756
|
+
convertData = await getAmisFileSchema(field, readonly, ctx);
|
|
16167
16757
|
break;
|
|
16168
16758
|
case 'file':
|
|
16169
|
-
convertData = getAmisFileSchema(field, readonly);
|
|
16759
|
+
convertData = await getAmisFileSchema(field, readonly, ctx);
|
|
16170
16760
|
break;
|
|
16171
16761
|
case 'formula':
|
|
16172
16762
|
if(readonly){
|
|
@@ -16714,24 +17304,24 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
16714
17304
|
/*
|
|
16715
17305
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
16716
17306
|
* @Date: 2024-01-18 15:12:41
|
|
16717
|
-
* @LastEditors:
|
|
16718
|
-
* @LastEditTime: 2024-
|
|
17307
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
17308
|
+
* @LastEditTime: 2024-05-20 13:46:41
|
|
16719
17309
|
*/
|
|
16720
17310
|
/**
|
|
16721
17311
|
* 生成符合标准uuid格式的36位满足唯一性的随机串
|
|
16722
17312
|
* @returns uuid
|
|
16723
17313
|
*/
|
|
16724
17314
|
function uuidv4() {
|
|
16725
|
-
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, c
|
|
16726
|
-
(c ^ window.crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
|
16727
|
-
);
|
|
17315
|
+
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, function (c) {
|
|
17316
|
+
return (c ^ window.crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
|
|
17317
|
+
});
|
|
16728
17318
|
}
|
|
16729
17319
|
|
|
16730
17320
|
/*
|
|
16731
17321
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
16732
17322
|
* @Date: 2023-11-15 09:50:22
|
|
16733
17323
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
16734
|
-
* @LastEditTime: 2024-
|
|
17324
|
+
* @LastEditTime: 2024-06-14 06:31:33
|
|
16735
17325
|
*/
|
|
16736
17326
|
|
|
16737
17327
|
/**
|
|
@@ -16950,7 +17540,8 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
16950
17540
|
return {
|
|
16951
17541
|
"type": "steedos-field",
|
|
16952
17542
|
"config": Object.assign({}, field, {
|
|
16953
|
-
label: false
|
|
17543
|
+
label: false,
|
|
17544
|
+
description: null
|
|
16954
17545
|
}),
|
|
16955
17546
|
// quickEdit: {
|
|
16956
17547
|
// "type": "steedos-field",
|
|
@@ -16967,7 +17558,8 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
16967
17558
|
return {
|
|
16968
17559
|
"type": "steedos-field",
|
|
16969
17560
|
"config": Object.assign({}, field, {
|
|
16970
|
-
label: false
|
|
17561
|
+
label: false,
|
|
17562
|
+
description: null
|
|
16971
17563
|
}),
|
|
16972
17564
|
inInputTable: true,
|
|
16973
17565
|
"static": true,
|
|
@@ -17801,6 +18393,7 @@ async function getButtonActions(props, mode) {
|
|
|
17801
18393
|
"__parentForm": mode == "new" ? "$$" : parentFormData,
|
|
17802
18394
|
"_master": "${_master}",
|
|
17803
18395
|
"global": "${global}",
|
|
18396
|
+
"context": "${context}",
|
|
17804
18397
|
"uiSchema": "${uiSchema}",
|
|
17805
18398
|
"index": "${index}",//amis组件自带行索引,在节点嵌套情况下,当前节点如果是children属性下的子节点时,这里的index是当前节点在children中的索引,而不是外层父节点的index
|
|
17806
18399
|
"parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
@@ -17925,6 +18518,7 @@ async function getButtonActions(props, mode) {
|
|
|
17925
18518
|
"__parentForm": parentFormData,
|
|
17926
18519
|
"_master": "${_master}",
|
|
17927
18520
|
"global": "${global}",
|
|
18521
|
+
"context": "${context}",
|
|
17928
18522
|
"uiSchema": "${uiSchema}",
|
|
17929
18523
|
"index": "${index}",
|
|
17930
18524
|
"parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
@@ -18211,7 +18805,8 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
18211
18805
|
}
|
|
18212
18806
|
return value;
|
|
18213
18807
|
},
|
|
18214
|
-
"required": props.required
|
|
18808
|
+
"required": props.required,
|
|
18809
|
+
"description": props.description
|
|
18215
18810
|
};
|
|
18216
18811
|
if (buttonsForColumnOperations.length) {
|
|
18217
18812
|
inputTableSchema.columns.unshift({
|
|
@@ -21082,6 +21677,7 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
|
|
|
21082
21677
|
setUISchemaFunction: setUISchemaFunction,
|
|
21083
21678
|
setVariable: setVariable,
|
|
21084
21679
|
standardButtonsTodo: standardButtonsTodo,
|
|
21680
|
+
uuidv4: uuidv4,
|
|
21085
21681
|
i18next: instance
|
|
21086
21682
|
});
|
|
21087
21683
|
|
|
@@ -21359,7 +21955,12 @@ var SteedosDropdownButton = function (props) {
|
|
|
21359
21955
|
}
|
|
21360
21956
|
}
|
|
21361
21957
|
};
|
|
21362
|
-
return (React.createElement(Dropdown, { menu: { items: menu }, trigger: trigger, onOpenChange: onOpenChange, placement: placement, overlayClassName: overlayClassName, arrow: arrow
|
|
21958
|
+
return (React.createElement(Dropdown, { menu: { items: menu }, trigger: trigger, onOpenChange: onOpenChange, placement: placement, overlayClassName: overlayClassName, arrow: arrow, getPopupContainer: function (button) {
|
|
21959
|
+
// 未配置getPopupContainer属性时,默认container为body,这里判断到dropdown button是在drawer中时,统一把container配置为drawer本身
|
|
21960
|
+
// 这样就可以解决drawer内点击dropdown button组件下拉菜单中的按钮时不应该自动关闭drawer的问题
|
|
21961
|
+
var drawerBody = window.$(button).closest(".amis-dialog-widget .antd-Drawer-body")[0];
|
|
21962
|
+
return drawerBody || document.querySelector("body");
|
|
21963
|
+
} },
|
|
21363
21964
|
React.createElement("button", { className: "slds-button slds-button_icon slds-button_icon-border-filled slds-button_icon-x-small ".concat(className ? className : '') },
|
|
21364
21965
|
React.createElement("svg", { className: "w-4 h-4 fill-gray-500" },
|
|
21365
21966
|
React.createElement("use", { xlinkHref: "/assets/icons/utility-sprite/svg/symbols.svg#down" })))));
|
|
@@ -21938,7 +22539,7 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
|
|
|
21938
22539
|
return __generator(this, function (_d) {
|
|
21939
22540
|
switch (_d.label) {
|
|
21940
22541
|
case 0:
|
|
21941
|
-
_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;
|
|
22542
|
+
_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;
|
|
21942
22543
|
return [4 /*yield*/, getUISchema(props.objectApiName || "space_users", false)];
|
|
21943
22544
|
case 1:
|
|
21944
22545
|
_d.sent();
|
|
@@ -21948,7 +22549,7 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
|
|
|
21948
22549
|
return [4 /*yield*/, getRecordDetailHeaderSchema(objectApiName, recordId, { showRecordTitle: showRecordTitle, formFactor: props.data.formFactor, showButtons: showButtons, showBackButton: showBackButton, display: props.data.display, _inDrawer: props.data._inDrawer })];
|
|
21949
22550
|
case 2:
|
|
21950
22551
|
schema = (_d.sent()).amisSchema;
|
|
21951
|
-
schema.className
|
|
22552
|
+
schema.className += " " + className;
|
|
21952
22553
|
config = Object.assign({}, schema, { onEvent: onEvent });
|
|
21953
22554
|
if (!(schemaFilter && typeof schemaFilter === 'string')) return [3 /*break*/, 6];
|
|
21954
22555
|
schemaFilterFun = new Function('config', 'props', schemaFilter);
|
|
@@ -22240,12 +22841,12 @@ var AmisProvider = function (props) { return __awaiter(void 0, void 0, void 0, f
|
|
|
22240
22841
|
/*
|
|
22241
22842
|
* @Author: baozhoutao@steedos.com
|
|
22242
22843
|
* @Date: 2022-09-01 14:44:57
|
|
22243
|
-
* @LastEditors:
|
|
22244
|
-
* @LastEditTime: 2024-
|
|
22844
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
22845
|
+
* @LastEditTime: 2024-05-14 15:12:49
|
|
22245
22846
|
* @Description:
|
|
22246
22847
|
*/
|
|
22247
22848
|
var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22248
|
-
var app, data, className, _a, showAppName, _b, appNameClassName, _c, customElements, _d, showAppIcon, formFactor, isMobile, on_click_script, mobile_blank_script, dialogSchema, badgeText;
|
|
22849
|
+
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;
|
|
22249
22850
|
return __generator(this, function (_e) {
|
|
22250
22851
|
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;
|
|
22251
22852
|
if (!app) {
|
|
@@ -22255,6 +22856,9 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
22255
22856
|
isMobile = formFactor === "SMALL" ? true : false;
|
|
22256
22857
|
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 ";
|
|
22257
22858
|
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 ";
|
|
22859
|
+
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 ";
|
|
22860
|
+
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 ");
|
|
22861
|
+
mobileInitApiAdaptorScript = "\n let app_items = payload;\n ".concat(convertAppVisibleOnScript, "\n payload = {\n app_items\n }\n return payload;\n ");
|
|
22258
22862
|
dialogSchema = {};
|
|
22259
22863
|
badgeText = "${IF(${id} == 'approve_workflow',${ss:keyvalues.badge.value|pick:'workflow'},${ss:keyvalues.badge.value|pick:${id}}) | toInt}";
|
|
22260
22864
|
if (isMobile) {
|
|
@@ -22315,6 +22919,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
22315
22919
|
]
|
|
22316
22920
|
}
|
|
22317
22921
|
},
|
|
22922
|
+
"visibleOn": "${visible_on}",
|
|
22318
22923
|
"className": "block w-1/3 py-4",
|
|
22319
22924
|
"style": {
|
|
22320
22925
|
"display": "inline-flex",
|
|
@@ -22334,7 +22939,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
22334
22939
|
"headers": {
|
|
22335
22940
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22336
22941
|
},
|
|
22337
|
-
"adaptor":
|
|
22942
|
+
"adaptor": mobileInitApiAdaptorScript,
|
|
22338
22943
|
"messages": {}
|
|
22339
22944
|
},
|
|
22340
22945
|
"onEvent": {
|
|
@@ -22383,63 +22988,64 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
22383
22988
|
{
|
|
22384
22989
|
"type": "each",
|
|
22385
22990
|
"name": "app_items",
|
|
22386
|
-
"items": {
|
|
22387
|
-
|
|
22388
|
-
|
|
22389
|
-
|
|
22390
|
-
|
|
22391
|
-
|
|
22392
|
-
|
|
22393
|
-
|
|
22394
|
-
|
|
22395
|
-
|
|
22396
|
-
|
|
22397
|
-
|
|
22398
|
-
|
|
22399
|
-
|
|
22400
|
-
|
|
22401
|
-
|
|
22402
|
-
|
|
22403
|
-
|
|
22404
|
-
|
|
22405
|
-
|
|
22406
|
-
|
|
22991
|
+
"items": [{
|
|
22992
|
+
"type": "button",
|
|
22993
|
+
"level": "link",
|
|
22994
|
+
"body": [{
|
|
22995
|
+
"type": "tpl",
|
|
22996
|
+
"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>",
|
|
22997
|
+
"badge": {
|
|
22998
|
+
"mode": "text",
|
|
22999
|
+
"text": badgeText,
|
|
23000
|
+
"visibleOn": badgeText,
|
|
23001
|
+
"className": "w-full",
|
|
23002
|
+
"overflowCount": 99,
|
|
23003
|
+
"style": {
|
|
23004
|
+
"top": "20px",
|
|
23005
|
+
"left": "37px",
|
|
23006
|
+
"height": "20px",
|
|
23007
|
+
"border-radius": "10px",
|
|
23008
|
+
"line-height": "18px",
|
|
23009
|
+
"margin-left": "${" + badgeText + ">9?(" + badgeText + ">99?'-21px':'-11px'):'0'}",
|
|
23010
|
+
"right": "auto",
|
|
23011
|
+
"font-size": "16px"
|
|
23012
|
+
}
|
|
22407
23013
|
}
|
|
22408
|
-
}
|
|
22409
|
-
|
|
22410
|
-
|
|
22411
|
-
|
|
22412
|
-
|
|
22413
|
-
|
|
22414
|
-
"actionType": "closeDialog"
|
|
22415
|
-
},
|
|
22416
|
-
{
|
|
22417
|
-
"actionType": "link",
|
|
22418
|
-
"args": {
|
|
22419
|
-
"link": "${path}"
|
|
23014
|
+
}],
|
|
23015
|
+
"onEvent": {
|
|
23016
|
+
"click": {
|
|
23017
|
+
"actions": [
|
|
23018
|
+
{
|
|
23019
|
+
"actionType": "closeDialog"
|
|
22420
23020
|
},
|
|
22421
|
-
|
|
22422
|
-
|
|
22423
|
-
|
|
22424
|
-
|
|
22425
|
-
|
|
22426
|
-
"
|
|
22427
|
-
"blank": true
|
|
23021
|
+
{
|
|
23022
|
+
"actionType": "link",
|
|
23023
|
+
"args": {
|
|
23024
|
+
"link": "${path}"
|
|
23025
|
+
},
|
|
23026
|
+
"expression": "${AND(!blank , !on_click)}"
|
|
22428
23027
|
},
|
|
22429
|
-
|
|
22430
|
-
|
|
22431
|
-
|
|
22432
|
-
|
|
22433
|
-
|
|
22434
|
-
|
|
22435
|
-
|
|
22436
|
-
|
|
22437
|
-
|
|
22438
|
-
|
|
22439
|
-
|
|
22440
|
-
|
|
22441
|
-
|
|
22442
|
-
|
|
23028
|
+
{
|
|
23029
|
+
"actionType": "url",
|
|
23030
|
+
"args": {
|
|
23031
|
+
"url": "${path}",
|
|
23032
|
+
"blank": true
|
|
23033
|
+
},
|
|
23034
|
+
"expression": "${AND(blank , !on_click)}"
|
|
23035
|
+
},
|
|
23036
|
+
{
|
|
23037
|
+
"actionType": "custom",
|
|
23038
|
+
"script": on_click_script,
|
|
23039
|
+
"expression": "${!!on_click}"
|
|
23040
|
+
}
|
|
23041
|
+
]
|
|
23042
|
+
}
|
|
23043
|
+
},
|
|
23044
|
+
"inline": true,
|
|
23045
|
+
"style": {},
|
|
23046
|
+
"visibleOn": "${visible_on}",
|
|
23047
|
+
"className": "slds-p-horizontal_small slds-size_1-of-1 slds-medium-size_1-of-3"
|
|
23048
|
+
}],
|
|
22443
23049
|
"className": "slds-grid slds-wrap slds-grid_pull-padded"
|
|
22444
23050
|
}
|
|
22445
23051
|
]
|
|
@@ -22529,7 +23135,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
22529
23135
|
"headers": {
|
|
22530
23136
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22531
23137
|
},
|
|
22532
|
-
"adaptor":
|
|
23138
|
+
"adaptor": pcInitApiAdaptorScript
|
|
22533
23139
|
}
|
|
22534
23140
|
};
|
|
22535
23141
|
}
|
|
@@ -22690,21 +23296,261 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22690
23296
|
"headers": {
|
|
22691
23297
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22692
23298
|
}
|
|
22693
|
-
}
|
|
22694
|
-
};
|
|
22695
|
-
}
|
|
22696
|
-
console.log("payload===>", schema);
|
|
22697
|
-
return [2 /*return*/, schema];
|
|
22698
|
-
});
|
|
22699
|
-
}); };
|
|
22700
|
-
|
|
22701
|
-
/*
|
|
22702
|
-
* @Author: baozhoutao@steedos.com
|
|
22703
|
-
* @Date: 2022-09-01 14:44:57
|
|
22704
|
-
* @LastEditors:
|
|
22705
|
-
* @LastEditTime: 2024-
|
|
22706
|
-
* @Description:
|
|
22707
|
-
*/
|
|
23299
|
+
}
|
|
23300
|
+
};
|
|
23301
|
+
}
|
|
23302
|
+
console.log("payload===>", schema);
|
|
23303
|
+
return [2 /*return*/, schema];
|
|
23304
|
+
});
|
|
23305
|
+
}); };
|
|
23306
|
+
|
|
23307
|
+
/*
|
|
23308
|
+
* @Author: baozhoutao@steedos.com
|
|
23309
|
+
* @Date: 2022-09-01 14:44:57
|
|
23310
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
23311
|
+
* @LastEditTime: 2024-05-29 11:45:57
|
|
23312
|
+
* @Description:
|
|
23313
|
+
*/
|
|
23314
|
+
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";
|
|
23315
|
+
var getNotificationBadgeButton = function () {
|
|
23316
|
+
var isMobile = window.innerWidth < 768;
|
|
23317
|
+
var listContent = {
|
|
23318
|
+
"type": "page",
|
|
23319
|
+
"body": [
|
|
23320
|
+
{
|
|
23321
|
+
"type": "service",
|
|
23322
|
+
"className": "service-global-header-notifications-list",
|
|
23323
|
+
"body": [
|
|
23324
|
+
{
|
|
23325
|
+
"type": "panel",
|
|
23326
|
+
"title": instance.t('frontend_notifications'),
|
|
23327
|
+
"className": "steedos-header-toolbar-notifications-panel " + (isMobile ? "" : "min-w-[300px] max-w-md"),
|
|
23328
|
+
"body": [
|
|
23329
|
+
{
|
|
23330
|
+
"type": "each",
|
|
23331
|
+
"className": "overflow-auto max-h-96 steedos-header-toolbar-notifications-list",
|
|
23332
|
+
"name": "notifications",
|
|
23333
|
+
"items": {
|
|
23334
|
+
"type": "tpl",
|
|
23335
|
+
"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>",
|
|
23336
|
+
"id": "u:07ece657c7b7",
|
|
23337
|
+
"onEvent": {
|
|
23338
|
+
"click": {
|
|
23339
|
+
"weight": 0,
|
|
23340
|
+
"actions": [
|
|
23341
|
+
{
|
|
23342
|
+
"args": {
|
|
23343
|
+
"options": {},
|
|
23344
|
+
"api": {
|
|
23345
|
+
"url": "${context.rootUrl}/api/v4/notifications/${_id}/read?rootUrl=&appId=${appId}&async=true",
|
|
23346
|
+
"method": "get",
|
|
23347
|
+
"messages": {},
|
|
23348
|
+
"headers": {
|
|
23349
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23350
|
+
},
|
|
23351
|
+
"adaptor": "payload = {\n status: 0,\n msg: '',\n data: {\n redirect: payload.redirect || payload \n }} \nreturn payload;"
|
|
23352
|
+
// "adaptor": notificationReadAdaptor
|
|
23353
|
+
}
|
|
23354
|
+
},
|
|
23355
|
+
"actionType": "ajax"
|
|
23356
|
+
},
|
|
23357
|
+
// {
|
|
23358
|
+
// "actionType": "custom",
|
|
23359
|
+
// "script": "if(Meteor.isCordova){window.open(Meteor.absoluteUrl(event.data.responseResult.responseData.redirect), '_blank')}else{window.open(event.data.responseResult.responseData.redirect, '_blank')}",
|
|
23360
|
+
// "expression": "${!!event.data.responseResult.responseData.redirect}",
|
|
23361
|
+
// },
|
|
23362
|
+
{
|
|
23363
|
+
// PC端保持原样,新窗口打开
|
|
23364
|
+
"actionType": "custom",
|
|
23365
|
+
"script": "window.open(event.data.responseResult.responseData.redirect, '_blank')",
|
|
23366
|
+
"expression": "${!!event.data.responseResult.responseData.redirect && window:innerWidth > 768}"
|
|
23367
|
+
},
|
|
23368
|
+
{
|
|
23369
|
+
// 手机端改为直接跳路由,因为新窗口打开顶部会显示url地址栏
|
|
23370
|
+
"actionType": "link",
|
|
23371
|
+
"args": {
|
|
23372
|
+
"link": "${redirect}"
|
|
23373
|
+
},
|
|
23374
|
+
"expression": "${!!event.data.responseResult.responseData.redirect && window:innerWidth <= 768}"
|
|
23375
|
+
},
|
|
23376
|
+
{
|
|
23377
|
+
"actionType": "cancel",
|
|
23378
|
+
"componentId": "steedos_header_toolbar_notifications_dialog",
|
|
23379
|
+
"expression": "${!!event.data.responseResult.responseData.redirect && window:innerWidth <= 768}"
|
|
23380
|
+
}
|
|
23381
|
+
]
|
|
23382
|
+
}
|
|
23383
|
+
}
|
|
23384
|
+
},
|
|
23385
|
+
"id": "u:18da41dab9ca"
|
|
23386
|
+
},
|
|
23387
|
+
],
|
|
23388
|
+
actions: [
|
|
23389
|
+
{
|
|
23390
|
+
"type": "button",
|
|
23391
|
+
"label": instance.t('frontend_notifications_close_dialog'),
|
|
23392
|
+
"visibleOn": "${window:innerWidth <= 768}",
|
|
23393
|
+
"close": true
|
|
23394
|
+
},
|
|
23395
|
+
{
|
|
23396
|
+
"type": "button",
|
|
23397
|
+
"label": instance.t('frontend_notifications_allread'),
|
|
23398
|
+
"id": "u:5530f3779e3a",
|
|
23399
|
+
"onEvent": {
|
|
23400
|
+
"click": {
|
|
23401
|
+
"actions": [
|
|
23402
|
+
{
|
|
23403
|
+
"actionType": "custom",
|
|
23404
|
+
"script": beforeMarkReadAllScript
|
|
23405
|
+
},
|
|
23406
|
+
{
|
|
23407
|
+
"componentId": "",
|
|
23408
|
+
"args": {
|
|
23409
|
+
"api": {
|
|
23410
|
+
"url": "${context.rootUrl}/api/v4/notifications/all/markReadAll",
|
|
23411
|
+
"method": "post",
|
|
23412
|
+
"headers": {
|
|
23413
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23414
|
+
}
|
|
23415
|
+
},
|
|
23416
|
+
"messages": {
|
|
23417
|
+
"success": instance.t('frontend_notifications_allread_message')
|
|
23418
|
+
}
|
|
23419
|
+
},
|
|
23420
|
+
"actionType": "ajax"
|
|
23421
|
+
},
|
|
23422
|
+
{
|
|
23423
|
+
"componentId": "service_global_header_notifications_unread_count",
|
|
23424
|
+
"actionType": "reload",
|
|
23425
|
+
"expression": "${needToReload}"
|
|
23426
|
+
},
|
|
23427
|
+
{
|
|
23428
|
+
"componentId": "service_global_header_notifications_list",
|
|
23429
|
+
"actionType": "reload",
|
|
23430
|
+
"expression": "${needToReload}"
|
|
23431
|
+
}
|
|
23432
|
+
],
|
|
23433
|
+
"weight": 0
|
|
23434
|
+
}
|
|
23435
|
+
}
|
|
23436
|
+
}
|
|
23437
|
+
]
|
|
23438
|
+
},
|
|
23439
|
+
],
|
|
23440
|
+
"id": "service_global_header_notifications_list",
|
|
23441
|
+
"onEvent": {
|
|
23442
|
+
"@data.changed.notifications": {
|
|
23443
|
+
"actions": [
|
|
23444
|
+
{
|
|
23445
|
+
"actionType": "reload"
|
|
23446
|
+
}
|
|
23447
|
+
]
|
|
23448
|
+
}
|
|
23449
|
+
},
|
|
23450
|
+
"messages": {},
|
|
23451
|
+
"api": {
|
|
23452
|
+
"method": "post",
|
|
23453
|
+
"url": "${context.rootUrl}/graphql",
|
|
23454
|
+
"data": {
|
|
23455
|
+
"&": "$$",
|
|
23456
|
+
"context": "${context}",
|
|
23457
|
+
"userId": "${context.userId}"
|
|
23458
|
+
},
|
|
23459
|
+
"dataType": "json",
|
|
23460
|
+
"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}",
|
|
23461
|
+
"headers": {
|
|
23462
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23463
|
+
},
|
|
23464
|
+
"adaptor": "return payload.data"
|
|
23465
|
+
},
|
|
23466
|
+
}
|
|
23467
|
+
],
|
|
23468
|
+
"onEvent": {
|
|
23469
|
+
"init": {
|
|
23470
|
+
"actions": [
|
|
23471
|
+
{
|
|
23472
|
+
"actionType": "custom",
|
|
23473
|
+
"script": "window.$('.service-global-header-notifications-list').closest('.amis-dialog-widget').addClass('steedos-header-toolbar-notifications-dialog');"
|
|
23474
|
+
}
|
|
23475
|
+
]
|
|
23476
|
+
}
|
|
23477
|
+
},
|
|
23478
|
+
"bodyClassName": "p-0"
|
|
23479
|
+
};
|
|
23480
|
+
var badgeButtonContent = {
|
|
23481
|
+
"type": "service",
|
|
23482
|
+
"body": [
|
|
23483
|
+
{
|
|
23484
|
+
"type": "steedos-badge",
|
|
23485
|
+
"body": [
|
|
23486
|
+
{
|
|
23487
|
+
"type": "steedos-icon",
|
|
23488
|
+
"category": "utility",
|
|
23489
|
+
"name": "notification",
|
|
23490
|
+
"colorVariant": "default",
|
|
23491
|
+
"className": "slds-button_icon slds-global-header__icon"
|
|
23492
|
+
}
|
|
23493
|
+
],
|
|
23494
|
+
"count": "${unReadCount}"
|
|
23495
|
+
},
|
|
23496
|
+
],
|
|
23497
|
+
"id": "service_global_header_notifications_unread_count",
|
|
23498
|
+
"messages": {},
|
|
23499
|
+
"api": {
|
|
23500
|
+
"method": "post",
|
|
23501
|
+
"url": "${context.rootUrl}/graphql",
|
|
23502
|
+
"data": {
|
|
23503
|
+
"&": "$$",
|
|
23504
|
+
"context": "${context}",
|
|
23505
|
+
"userId": "${context.userId}"
|
|
23506
|
+
},
|
|
23507
|
+
"dataType": "json",
|
|
23508
|
+
"requestAdaptor": "const { userId } = api.data;\napi.data = {\n query: `{\n unReadCount: notifications__count(filters: [[\"owner\",\"=\",\"${userId}\"], [\"is_read\", \"!=\", true]])\n }`\n}",
|
|
23509
|
+
"headers": {
|
|
23510
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23511
|
+
},
|
|
23512
|
+
"adaptor": "return payload.data"
|
|
23513
|
+
},
|
|
23514
|
+
"onEvent": {
|
|
23515
|
+
"@data.changed.notifications": {
|
|
23516
|
+
"actions": [
|
|
23517
|
+
{
|
|
23518
|
+
"actionType": "reload"
|
|
23519
|
+
}
|
|
23520
|
+
]
|
|
23521
|
+
}
|
|
23522
|
+
},
|
|
23523
|
+
// "interval": 30000,
|
|
23524
|
+
"silentPolling": true
|
|
23525
|
+
};
|
|
23526
|
+
return isMobile ? {
|
|
23527
|
+
"type": "button",
|
|
23528
|
+
"body": badgeButtonContent,
|
|
23529
|
+
"actionType": "dialog",
|
|
23530
|
+
"dialog": {
|
|
23531
|
+
"title": "",
|
|
23532
|
+
"id": "steedos_header_toolbar_notifications_dialog",
|
|
23533
|
+
"body": listContent,
|
|
23534
|
+
"actions": [],
|
|
23535
|
+
"showCloseButton": false,
|
|
23536
|
+
"closeOnOutside": true
|
|
23537
|
+
}
|
|
23538
|
+
} : {
|
|
23539
|
+
"type": "steedos-dropdown",
|
|
23540
|
+
"placement": "bottomRight",
|
|
23541
|
+
"trigger": [
|
|
23542
|
+
"click"
|
|
23543
|
+
],
|
|
23544
|
+
"body": [
|
|
23545
|
+
badgeButtonContent
|
|
23546
|
+
],
|
|
23547
|
+
"overlay": [
|
|
23548
|
+
listContent
|
|
23549
|
+
],
|
|
23550
|
+
"className": "antd-Action steedos-header-toolbar-notifications",
|
|
23551
|
+
"open": false
|
|
23552
|
+
};
|
|
23553
|
+
};
|
|
22708
23554
|
var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22709
23555
|
var _a, className, data, _b, logoutScript, _c, customButtons, avatarSrc;
|
|
22710
23556
|
var _d, _e;
|
|
@@ -22730,7 +23576,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
22730
23576
|
{
|
|
22731
23577
|
"componentId": "",
|
|
22732
23578
|
"args": {
|
|
22733
|
-
"url": "https://
|
|
23579
|
+
"url": "https://docs.steedos.com/zh-CN"
|
|
22734
23580
|
},
|
|
22735
23581
|
"actionType": "url"
|
|
22736
23582
|
}
|
|
@@ -22856,172 +23702,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
22856
23702
|
}
|
|
22857
23703
|
]
|
|
22858
23704
|
},
|
|
22859
|
-
|
|
22860
|
-
"type": "steedos-dropdown",
|
|
22861
|
-
"placement": "bottomRight",
|
|
22862
|
-
"trigger": [
|
|
22863
|
-
"click"
|
|
22864
|
-
],
|
|
22865
|
-
"body": [
|
|
22866
|
-
{
|
|
22867
|
-
"type": "service",
|
|
22868
|
-
"body": [
|
|
22869
|
-
{
|
|
22870
|
-
"type": "steedos-badge",
|
|
22871
|
-
"body": [
|
|
22872
|
-
{
|
|
22873
|
-
"type": "steedos-icon",
|
|
22874
|
-
"category": "utility",
|
|
22875
|
-
"name": "notification",
|
|
22876
|
-
"colorVariant": "default",
|
|
22877
|
-
"className": "slds-button_icon slds-global-header__icon"
|
|
22878
|
-
}
|
|
22879
|
-
],
|
|
22880
|
-
"count": "${unReadCount}"
|
|
22881
|
-
},
|
|
22882
|
-
],
|
|
22883
|
-
"id": "u:aba521eed5b7",
|
|
22884
|
-
"messages": {},
|
|
22885
|
-
"api": {
|
|
22886
|
-
"method": "post",
|
|
22887
|
-
"url": "${context.rootUrl}/graphql",
|
|
22888
|
-
"data": {
|
|
22889
|
-
"&": "$$",
|
|
22890
|
-
"context": "${context}",
|
|
22891
|
-
"userId": "${context.userId}"
|
|
22892
|
-
},
|
|
22893
|
-
"dataType": "json",
|
|
22894
|
-
"requestAdaptor": "const { userId } = api.data;\napi.data = {\n query: `{\n unReadCount: notifications__count(filters: [[\"owner\",\"=\",\"${userId}\"], [\"is_read\", \"!=\", true]])\n }`\n}",
|
|
22895
|
-
"headers": {
|
|
22896
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22897
|
-
},
|
|
22898
|
-
"adaptor": "return payload.data"
|
|
22899
|
-
},
|
|
22900
|
-
"onEvent": {
|
|
22901
|
-
"@data.changed.notifications": {
|
|
22902
|
-
"actions": [
|
|
22903
|
-
{
|
|
22904
|
-
"actionType": "reload"
|
|
22905
|
-
}
|
|
22906
|
-
]
|
|
22907
|
-
}
|
|
22908
|
-
},
|
|
22909
|
-
// "interval": 30000,
|
|
22910
|
-
"silentPolling": true
|
|
22911
|
-
}
|
|
22912
|
-
],
|
|
22913
|
-
"overlay": [
|
|
22914
|
-
{
|
|
22915
|
-
"type": "service",
|
|
22916
|
-
"body": [
|
|
22917
|
-
{
|
|
22918
|
-
"type": "panel",
|
|
22919
|
-
"title": instance.t('frontend_notifications'),
|
|
22920
|
-
"className": "min-w-[300px] max-w-md",
|
|
22921
|
-
"body": [
|
|
22922
|
-
{
|
|
22923
|
-
"type": "each",
|
|
22924
|
-
className: "overflow-auto max-h-96",
|
|
22925
|
-
"name": "notifications",
|
|
22926
|
-
"items": {
|
|
22927
|
-
"type": "tpl",
|
|
22928
|
-
"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>",
|
|
22929
|
-
"id": "u:07ece657c7b7",
|
|
22930
|
-
"onEvent": {
|
|
22931
|
-
"click": {
|
|
22932
|
-
"weight": 0,
|
|
22933
|
-
"actions": [
|
|
22934
|
-
{
|
|
22935
|
-
"args": {
|
|
22936
|
-
"options": {},
|
|
22937
|
-
"api": {
|
|
22938
|
-
"url": "${context.rootUrl}/api/v4/notifications/${_id}/read?rootUrl=&appId=${appId}&async=true",
|
|
22939
|
-
"method": "get",
|
|
22940
|
-
"messages": {},
|
|
22941
|
-
"headers": {
|
|
22942
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22943
|
-
},
|
|
22944
|
-
"adaptor": "payload = {\n status: 0,\n msg: '',\n data: {\n redirect: payload.redirect || payload \n }} \nreturn payload;"
|
|
22945
|
-
}
|
|
22946
|
-
},
|
|
22947
|
-
"actionType": "ajax"
|
|
22948
|
-
},
|
|
22949
|
-
{
|
|
22950
|
-
"actionType": "custom",
|
|
22951
|
-
"script": "if(Meteor.isCordova){window.open(Meteor.absoluteUrl(event.data.responseResult.responseData.redirect), '_blank')}else{window.open(event.data.responseResult.responseData.redirect, '_blank')}",
|
|
22952
|
-
"expression": "${!!event.data.responseResult.responseData.redirect}",
|
|
22953
|
-
}
|
|
22954
|
-
]
|
|
22955
|
-
}
|
|
22956
|
-
}
|
|
22957
|
-
},
|
|
22958
|
-
"id": "u:18da41dab9ca"
|
|
22959
|
-
},
|
|
22960
|
-
],
|
|
22961
|
-
actions: [
|
|
22962
|
-
{
|
|
22963
|
-
"type": "button",
|
|
22964
|
-
"label": instance.t('frontend_notifications_allread'),
|
|
22965
|
-
"id": "u:5530f3779e3a",
|
|
22966
|
-
"onEvent": {
|
|
22967
|
-
"click": {
|
|
22968
|
-
"actions": [
|
|
22969
|
-
{
|
|
22970
|
-
"componentId": "",
|
|
22971
|
-
"args": {
|
|
22972
|
-
"api": {
|
|
22973
|
-
"url": "${context.rootUrl}/api/v4/notifications/all/markReadAll",
|
|
22974
|
-
"method": "post",
|
|
22975
|
-
"headers": {
|
|
22976
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22977
|
-
}
|
|
22978
|
-
},
|
|
22979
|
-
"messages": {
|
|
22980
|
-
"success": instance.t('frontend_notifications_allread_message')
|
|
22981
|
-
}
|
|
22982
|
-
},
|
|
22983
|
-
"actionType": "ajax"
|
|
22984
|
-
}
|
|
22985
|
-
],
|
|
22986
|
-
"weight": 0
|
|
22987
|
-
}
|
|
22988
|
-
}
|
|
22989
|
-
}
|
|
22990
|
-
]
|
|
22991
|
-
},
|
|
22992
|
-
],
|
|
22993
|
-
"id": "u:aba521eed5b7",
|
|
22994
|
-
"onEvent": {
|
|
22995
|
-
"@data.changed.notifications": {
|
|
22996
|
-
"actions": [
|
|
22997
|
-
{
|
|
22998
|
-
"actionType": "reload"
|
|
22999
|
-
}
|
|
23000
|
-
]
|
|
23001
|
-
}
|
|
23002
|
-
},
|
|
23003
|
-
"messages": {},
|
|
23004
|
-
"api": {
|
|
23005
|
-
"method": "post",
|
|
23006
|
-
"url": "${context.rootUrl}/graphql",
|
|
23007
|
-
"data": {
|
|
23008
|
-
"&": "$$",
|
|
23009
|
-
"context": "${context}",
|
|
23010
|
-
"userId": "${context.userId}"
|
|
23011
|
-
},
|
|
23012
|
-
"dataType": "json",
|
|
23013
|
-
"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}",
|
|
23014
|
-
"headers": {
|
|
23015
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23016
|
-
},
|
|
23017
|
-
"adaptor": "return payload.data"
|
|
23018
|
-
},
|
|
23019
|
-
}
|
|
23020
|
-
],
|
|
23021
|
-
"id": "u:857e8161c96b",
|
|
23022
|
-
"className": "antd-Action steedos-header-toolbar-notifications",
|
|
23023
|
-
"open": false
|
|
23024
|
-
},
|
|
23705
|
+
getNotificationBadgeButton(),
|
|
23025
23706
|
{
|
|
23026
23707
|
"type": "steedos-dropdown",
|
|
23027
23708
|
"placement": "bottomRight",
|
|
@@ -23432,51 +24113,67 @@ function getAmisStaticFieldType(type, data_type, options) {
|
|
|
23432
24113
|
}
|
|
23433
24114
|
return type;
|
|
23434
24115
|
}
|
|
23435
|
-
|
|
23436
|
-
|
|
23437
|
-
|
|
23438
|
-
|
|
23439
|
-
|
|
23440
|
-
|
|
23441
|
-
|
|
23442
|
-
|
|
23443
|
-
|
|
23444
|
-
|
|
23445
|
-
|
|
23446
|
-
|
|
23447
|
-
|
|
23448
|
-
|
|
23449
|
-
|
|
23450
|
-
|
|
23451
|
-
|
|
23452
|
-
|
|
23453
|
-
"
|
|
23454
|
-
"
|
|
23455
|
-
"showBackButton": false,
|
|
23456
|
-
"showButtons": true,
|
|
23457
|
-
"data": {
|
|
23458
|
-
"_inDrawer": true,
|
|
23459
|
-
"recordLoaded": false, // 重置数据加载状态
|
|
23460
|
-
}
|
|
24116
|
+
function getLookupLinkOnClick(field, options) {
|
|
24117
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
24118
|
+
var recordPage, drawerRecordDetailSchema;
|
|
24119
|
+
return __generator(this, function (_a) {
|
|
24120
|
+
switch (_a.label) {
|
|
24121
|
+
case 0: return [4 /*yield*/, getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor })];
|
|
24122
|
+
case 1:
|
|
24123
|
+
recordPage = _a.sent();
|
|
24124
|
+
drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
|
|
24125
|
+
"recordId": "${value}",
|
|
24126
|
+
"data": __assign$2(__assign$2({}, recordPage.schema.data), { "_inDrawer": true, "recordLoaded": false })
|
|
24127
|
+
}) : {
|
|
24128
|
+
"type": "steedos-record-detail",
|
|
24129
|
+
"objectApiName": "${objectName}",
|
|
24130
|
+
"recordId": "${value}",
|
|
24131
|
+
"showBackButton": false,
|
|
24132
|
+
"showButtons": true,
|
|
24133
|
+
"data": {
|
|
24134
|
+
"_inDrawer": true,
|
|
24135
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
23461
24136
|
}
|
|
23462
|
-
|
|
23463
|
-
|
|
23464
|
-
|
|
23465
|
-
|
|
23466
|
-
|
|
24137
|
+
};
|
|
24138
|
+
return [2 /*return*/, {
|
|
24139
|
+
"click": {
|
|
24140
|
+
"actions": [
|
|
24141
|
+
{
|
|
24142
|
+
"actionType": "drawer",
|
|
24143
|
+
"drawer": {
|
|
24144
|
+
"type": "drawer",
|
|
24145
|
+
"title": " ",
|
|
24146
|
+
"headerClassName": "hidden",
|
|
24147
|
+
"size": "lg",
|
|
24148
|
+
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
24149
|
+
"closeOnEsc": true,
|
|
24150
|
+
"closeOnOutside": true,
|
|
24151
|
+
"resizable": true,
|
|
24152
|
+
"actions": [],
|
|
24153
|
+
"body": [
|
|
24154
|
+
drawerRecordDetailSchema
|
|
24155
|
+
],
|
|
24156
|
+
"className": "steedos-record-detail-drawer app-popover"
|
|
24157
|
+
},
|
|
24158
|
+
"preventDefault": true
|
|
24159
|
+
}
|
|
24160
|
+
]
|
|
24161
|
+
}
|
|
24162
|
+
}];
|
|
23467
24163
|
}
|
|
23468
|
-
|
|
23469
|
-
}
|
|
23470
|
-
}
|
|
24164
|
+
});
|
|
24165
|
+
});
|
|
24166
|
+
}
|
|
23471
24167
|
var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
23472
|
-
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,
|
|
23473
|
-
var
|
|
23474
|
-
var
|
|
23475
|
-
return __generator(this, function (
|
|
23476
|
-
switch (
|
|
24168
|
+
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;
|
|
24169
|
+
var _p, _q, _r, _s, _t, _u, _v, _w, _x, e_1, _y;
|
|
24170
|
+
var _z, _0, _1, _2, _3, _4;
|
|
24171
|
+
return __generator(this, function (_5) {
|
|
24172
|
+
switch (_5.label) {
|
|
23477
24173
|
case 0:
|
|
23478
24174
|
steedosField = null;
|
|
23479
24175
|
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;
|
|
24176
|
+
_c = props.data || {}, appId = _c.appId, formFactor = _c.formFactor;
|
|
23480
24177
|
// console.log(`AmisSteedosField`, props)
|
|
23481
24178
|
// if($schema.config && isString($schema.config)){
|
|
23482
24179
|
// $schema.config = JSON.parse($schema.config)
|
|
@@ -23504,10 +24201,10 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23504
24201
|
// 字段配置为只读,强制走fStatic模式,加上_display判断是为了不影响历史代码,比如直接在ObjectForm中调用steedos-field组件
|
|
23505
24202
|
fStatic = true;
|
|
23506
24203
|
}
|
|
23507
|
-
|
|
24204
|
+
_5.label = 1;
|
|
23508
24205
|
case 1:
|
|
23509
|
-
|
|
23510
|
-
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/,
|
|
24206
|
+
_5.trys.push([1, 31, , 32]);
|
|
24207
|
+
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/, 14];
|
|
23511
24208
|
lookupATagClick = 'onclick="return false;"';
|
|
23512
24209
|
if (window.innerWidth < 768) {
|
|
23513
24210
|
lookupATagClick = "";
|
|
@@ -23532,23 +24229,23 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23532
24229
|
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 ");
|
|
23533
24230
|
}
|
|
23534
24231
|
}
|
|
23535
|
-
source = ((
|
|
24232
|
+
source = ((_z = steedosField.amis) === null || _z === void 0 ? void 0 : _z.source) || ((_0 = steedosField.amis) === null || _0 === void 0 ? void 0 : _0.autoComplete) || defaultSource;
|
|
23536
24233
|
fieldBaseProps = {
|
|
23537
24234
|
multiple: steedosField.multiple,
|
|
23538
24235
|
name: steedosField.name,
|
|
23539
24236
|
label: steedosField.label,
|
|
23540
24237
|
static: true,
|
|
23541
24238
|
required: steedosField.required,
|
|
23542
|
-
className: "".concat(className || '', " ").concat(((
|
|
24239
|
+
className: "".concat(className || '', " ").concat(((_1 = steedosField.amis) === null || _1 === void 0 ? void 0 : _1.className) || '')
|
|
23543
24240
|
};
|
|
23544
24241
|
if (!inInputTable) return [3 /*break*/, 2];
|
|
23545
24242
|
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'select', source: source });
|
|
23546
|
-
return [3 /*break*/,
|
|
24243
|
+
return [3 /*break*/, 13];
|
|
23547
24244
|
case 2:
|
|
23548
24245
|
referenceTo_1 = steedosField.reference_to;
|
|
23549
|
-
if (!referenceTo_1) return [3 /*break*/,
|
|
24246
|
+
if (!referenceTo_1) return [3 /*break*/, 13];
|
|
23550
24247
|
if (isArray(referenceTo_1)) {
|
|
23551
|
-
fieldValue = (
|
|
24248
|
+
fieldValue = (_2 = props.data) === null || _2 === void 0 ? void 0 : _2[steedosField.name];
|
|
23552
24249
|
if (fieldValue && fieldValue.o) {
|
|
23553
24250
|
referenceTo_1 = fieldValue.o;
|
|
23554
24251
|
}
|
|
@@ -23562,150 +24259,188 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23562
24259
|
}
|
|
23563
24260
|
return [4 /*yield*/, getUISchema(referenceTo_1)];
|
|
23564
24261
|
case 3:
|
|
23565
|
-
fieldRefObject =
|
|
23566
|
-
if (!(props.data._display && has(props.data._display, steedosField.name))) return [3 /*break*/,
|
|
23567
|
-
|
|
24262
|
+
fieldRefObject = _5.sent();
|
|
24263
|
+
if (!(props.data._display && has(props.data._display, steedosField.name))) return [3 /*break*/, 7];
|
|
24264
|
+
_e = (_d = Object).assign;
|
|
24265
|
+
_f = [{}, fieldBaseProps];
|
|
24266
|
+
_p = {
|
|
23568
24267
|
type: 'control',
|
|
23569
|
-
name: null
|
|
23570
|
-
|
|
23571
|
-
|
|
23572
|
-
|
|
23573
|
-
|
|
23574
|
-
|
|
23575
|
-
|
|
23576
|
-
|
|
23577
|
-
|
|
23578
|
-
|
|
23579
|
-
|
|
23580
|
-
|
|
23581
|
-
|
|
23582
|
-
|
|
23583
|
-
|
|
23584
|
-
|
|
23585
|
-
|
|
23586
|
-
|
|
23587
|
-
|
|
23588
|
-
|
|
23589
|
-
|
|
23590
|
-
|
|
23591
|
-
|
|
23592
|
-
|
|
23593
|
-
|
|
23594
|
-
|
|
23595
|
-
|
|
23596
|
-
|
|
23597
|
-
|
|
23598
|
-
|
|
23599
|
-
{
|
|
23600
|
-
"type": "steedos-record-mini",
|
|
23601
|
-
"objectApiName": "${objectName}",
|
|
23602
|
-
"recordId": "${value}",
|
|
23603
|
-
"showButtons": false,
|
|
23604
|
-
"showBackButton": false,
|
|
23605
|
-
"data": {
|
|
23606
|
-
"objectName": "${objectName}",
|
|
23607
|
-
"recordId": "${value}",
|
|
23608
|
-
}
|
|
23609
|
-
}
|
|
23610
|
-
]
|
|
23611
|
-
} : null,
|
|
23612
|
-
onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
|
|
23613
|
-
}
|
|
23614
|
-
}
|
|
23615
|
-
]
|
|
24268
|
+
name: null
|
|
24269
|
+
};
|
|
24270
|
+
_q = {
|
|
24271
|
+
type: 'wrapper',
|
|
24272
|
+
className: "steedos-field-lookup-wrapper p-0",
|
|
24273
|
+
"wrapWithPanel": false,
|
|
24274
|
+
"actions": [],
|
|
24275
|
+
visibleOn: "${_display.".concat(steedosField.name, "}")
|
|
24276
|
+
};
|
|
24277
|
+
_r = {
|
|
24278
|
+
type: 'each',
|
|
24279
|
+
placeholder: "",
|
|
24280
|
+
className: "steedos-field-lookup-each flex flex-wrap gap-2",
|
|
24281
|
+
source: "${_display.".concat(steedosField.name, "|asArray}")
|
|
24282
|
+
};
|
|
24283
|
+
_s = {
|
|
24284
|
+
type: 'static',
|
|
24285
|
+
labelClassName: "hidden",
|
|
24286
|
+
label: false,
|
|
24287
|
+
className: 'm-0',
|
|
24288
|
+
tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\" ".concat(lookupATagClick, ">${label}</a>"),
|
|
24289
|
+
popOver: fieldRefObject.compactLayouts && window.innerWidth >= 768 ? {
|
|
24290
|
+
"trigger": "hover",
|
|
24291
|
+
"className": "steedos-record-detail-popover",
|
|
24292
|
+
"position": "left-bottom",
|
|
24293
|
+
"showIcon": false,
|
|
24294
|
+
"title": false,
|
|
24295
|
+
"offset": {
|
|
24296
|
+
"top": 0,
|
|
24297
|
+
"left": 20
|
|
23616
24298
|
},
|
|
23617
|
-
|
|
24299
|
+
"body": [
|
|
24300
|
+
{
|
|
24301
|
+
"type": "steedos-record-mini",
|
|
24302
|
+
"objectApiName": "${objectName}",
|
|
24303
|
+
"recordId": "${value}",
|
|
24304
|
+
"showButtons": false,
|
|
24305
|
+
"showBackButton": false,
|
|
24306
|
+
"data": {
|
|
24307
|
+
"objectName": "${objectName}",
|
|
24308
|
+
"recordId": "${value}",
|
|
24309
|
+
}
|
|
24310
|
+
}
|
|
24311
|
+
]
|
|
24312
|
+
} : null
|
|
24313
|
+
};
|
|
24314
|
+
if (!(window.innerWidth < 768)) return [3 /*break*/, 4];
|
|
24315
|
+
_g = null;
|
|
24316
|
+
return [3 /*break*/, 6];
|
|
24317
|
+
case 4: return [4 /*yield*/, getLookupLinkOnClick(steedosField, {
|
|
24318
|
+
appId: appId,
|
|
24319
|
+
objectName: referenceTo_1,
|
|
24320
|
+
formFactor: formFactor
|
|
24321
|
+
})];
|
|
24322
|
+
case 5:
|
|
24323
|
+
_g = _5.sent();
|
|
24324
|
+
_5.label = 6;
|
|
24325
|
+
case 6:
|
|
24326
|
+
fieldBaseProps = _e.apply(_d, _f.concat([(_p.body = [(_q.body = [
|
|
24327
|
+
(_r.items = (
|
|
24328
|
+
// onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
|
|
24329
|
+
_s.onEvent = _g,
|
|
24330
|
+
_s),
|
|
24331
|
+
_r)
|
|
24332
|
+
],
|
|
24333
|
+
_q), {
|
|
23618
24334
|
type: 'static',
|
|
23619
24335
|
tpl: '-',
|
|
23620
24336
|
className: "".concat(fieldBaseProps.className || '', " text-muted"),
|
|
23621
24337
|
hiddenOn: "${_display.".concat(steedosField.name, "}"),
|
|
23622
|
-
}]
|
|
23623
|
-
|
|
23624
|
-
return [3 /*break*/,
|
|
23625
|
-
case
|
|
23626
|
-
case
|
|
23627
|
-
res =
|
|
23628
|
-
valueOptions_1 = ((
|
|
23629
|
-
fieldValue = (
|
|
24338
|
+
}],
|
|
24339
|
+
_p)]));
|
|
24340
|
+
return [3 /*break*/, 13];
|
|
24341
|
+
case 7: return [4 /*yield*/, env.fetcher(source, props.data)];
|
|
24342
|
+
case 8:
|
|
24343
|
+
res = _5.sent();
|
|
24344
|
+
valueOptions_1 = ((_3 = res === null || res === void 0 ? void 0 : res.data) === null || _3 === void 0 ? void 0 : _3.options) || [];
|
|
24345
|
+
fieldValue = (_4 = props.data) === null || _4 === void 0 ? void 0 : _4[steedosField.name];
|
|
23630
24346
|
values = fieldValue;
|
|
23631
24347
|
if (isString(values)) {
|
|
23632
24348
|
values = [values];
|
|
23633
24349
|
}
|
|
23634
|
-
if (values && values.length > 0)
|
|
23635
|
-
|
|
23636
|
-
|
|
23637
|
-
|
|
23638
|
-
|
|
23639
|
-
|
|
23640
|
-
|
|
23641
|
-
|
|
23642
|
-
|
|
23643
|
-
|
|
23644
|
-
|
|
23645
|
-
|
|
23646
|
-
|
|
23647
|
-
|
|
23648
|
-
|
|
23649
|
-
|
|
23650
|
-
|
|
23651
|
-
|
|
23652
|
-
|
|
23653
|
-
|
|
23654
|
-
|
|
23655
|
-
|
|
23656
|
-
|
|
23657
|
-
|
|
23658
|
-
|
|
23659
|
-
|
|
23660
|
-
|
|
23661
|
-
|
|
23662
|
-
|
|
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
|
-
onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
|
|
23689
|
-
}
|
|
24350
|
+
if (!(values && values.length > 0)) return [3 /*break*/, 12];
|
|
24351
|
+
disPlayValue_1 = [];
|
|
24352
|
+
each(values, function (value) {
|
|
24353
|
+
var option = valueOptions_1.find(function (item) { return item.value === value; });
|
|
24354
|
+
if (option) {
|
|
24355
|
+
disPlayValue_1.push({
|
|
24356
|
+
objectName: referenceTo_1,
|
|
24357
|
+
value: option._id || option.value,
|
|
24358
|
+
label: option.label
|
|
24359
|
+
});
|
|
24360
|
+
}
|
|
24361
|
+
});
|
|
24362
|
+
_j = (_h = Object).assign;
|
|
24363
|
+
_k = [{}, fieldBaseProps];
|
|
24364
|
+
_t = { type: 'control', name: null };
|
|
24365
|
+
_u = {
|
|
24366
|
+
type: 'form',
|
|
24367
|
+
className: "steedos-field-lookup-wrapper p-0",
|
|
24368
|
+
"wrapWithPanel": false,
|
|
24369
|
+
"actions": [],
|
|
24370
|
+
data: (_v = {},
|
|
24371
|
+
_v[steedosField.name] = disPlayValue_1,
|
|
24372
|
+
_v)
|
|
24373
|
+
};
|
|
24374
|
+
_w = {
|
|
24375
|
+
type: 'each',
|
|
24376
|
+
placeholder: "",
|
|
24377
|
+
className: "steedos-field-lookup-each flex flex-wrap gap-2",
|
|
24378
|
+
source: "${".concat(steedosField.name, "}")
|
|
24379
|
+
};
|
|
24380
|
+
_x = {
|
|
24381
|
+
type: 'static',
|
|
24382
|
+
className: 'm-0',
|
|
24383
|
+
tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\" ".concat(lookupATagClick, ">${label}</a>"),
|
|
24384
|
+
popOver: fieldRefObject.compactLayouts && window.innerWidth >= 768 ? {
|
|
24385
|
+
"trigger": "hover",
|
|
24386
|
+
"className": "steedos-record-detail-popover",
|
|
24387
|
+
"position": "left-bottom",
|
|
24388
|
+
"showIcon": false,
|
|
24389
|
+
"title": false,
|
|
24390
|
+
"offset": {
|
|
24391
|
+
"top": 0,
|
|
24392
|
+
"left": 20
|
|
24393
|
+
},
|
|
24394
|
+
"body": [
|
|
24395
|
+
{
|
|
24396
|
+
"type": "steedos-record-mini",
|
|
24397
|
+
"objectApiName": "${objectName}",
|
|
24398
|
+
"recordId": "${value}",
|
|
24399
|
+
"showButtons": false,
|
|
24400
|
+
"showBackButton": false,
|
|
24401
|
+
"data": {
|
|
24402
|
+
"objectName": "${objectName}",
|
|
24403
|
+
"recordId": "${value}",
|
|
23690
24404
|
}
|
|
23691
|
-
|
|
23692
|
-
|
|
23693
|
-
|
|
23694
|
-
|
|
23695
|
-
|
|
23696
|
-
|
|
23697
|
-
|
|
23698
|
-
case
|
|
24405
|
+
}
|
|
24406
|
+
]
|
|
24407
|
+
} : null
|
|
24408
|
+
};
|
|
24409
|
+
if (!(window.innerWidth < 768)) return [3 /*break*/, 9];
|
|
24410
|
+
_l = null;
|
|
24411
|
+
return [3 /*break*/, 11];
|
|
24412
|
+
case 9: return [4 /*yield*/, getLookupLinkOnClick(steedosField, {
|
|
24413
|
+
appId: appId,
|
|
24414
|
+
objectName: referenceTo_1,
|
|
24415
|
+
formFactor: formFactor
|
|
24416
|
+
})];
|
|
24417
|
+
case 10:
|
|
24418
|
+
_l = _5.sent();
|
|
24419
|
+
_5.label = 11;
|
|
24420
|
+
case 11:
|
|
24421
|
+
fieldBaseProps = _j.apply(_h, _k.concat([(_t.body = (_u.body = [
|
|
24422
|
+
(_w.items = (
|
|
24423
|
+
// onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
|
|
24424
|
+
_x.onEvent = _l,
|
|
24425
|
+
_x),
|
|
24426
|
+
_w)
|
|
24427
|
+
],
|
|
24428
|
+
_u), _t)]));
|
|
24429
|
+
return [3 /*break*/, 13];
|
|
24430
|
+
case 12:
|
|
24431
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'static', tpl: '-', className: "".concat(fieldBaseProps.className || '', " text-muted") });
|
|
24432
|
+
_5.label = 13;
|
|
24433
|
+
case 13:
|
|
23699
24434
|
schema = Object.assign({}, fieldBaseProps, pick(steedosField.amis || {}, ['className', 'inline', 'label', 'labelAlign', 'name', 'labelRemark', 'description', 'placeholder', 'staticClassName', 'staticLabelClassName', 'staticInputClassName', 'staticSchema']));
|
|
23700
24435
|
schema.placeholder = "";
|
|
23701
24436
|
// console.log(`steedos field [lookup] schema:`, schema)
|
|
23702
24437
|
return [2 /*return*/, schema];
|
|
23703
|
-
case
|
|
23704
|
-
if (!fStatic) return [3 /*break*/,
|
|
23705
|
-
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/,
|
|
23706
|
-
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField,
|
|
23707
|
-
case
|
|
23708
|
-
fieldSchema =
|
|
24438
|
+
case 14:
|
|
24439
|
+
if (!fStatic) return [3 /*break*/, 28];
|
|
24440
|
+
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/, 16];
|
|
24441
|
+
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, true, ctx)];
|
|
24442
|
+
case 15:
|
|
24443
|
+
fieldSchema = _5.sent();
|
|
23709
24444
|
if (steedosField.type === 'file' && fieldSchema.disabled) {
|
|
23710
24445
|
fieldValue = fieldSchema.value;
|
|
23711
24446
|
if (fieldValue && fieldValue.length) {
|
|
@@ -23741,60 +24476,60 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23741
24476
|
}
|
|
23742
24477
|
}
|
|
23743
24478
|
return [2 /*return*/, fieldSchema];
|
|
23744
|
-
case
|
|
24479
|
+
case 16:
|
|
23745
24480
|
schema = Object.assign({}, steedosField, {
|
|
23746
24481
|
type: getAmisStaticFieldType(steedosField.type, steedosField.data_type, steedosField),
|
|
23747
24482
|
static: true,
|
|
23748
24483
|
label: steedosField.label
|
|
23749
24484
|
});
|
|
23750
|
-
if (!(steedosField.type === "time" || steedosField.type === "input-time-range")) return [3 /*break*/,
|
|
24485
|
+
if (!(steedosField.type === "time" || steedosField.type === "input-time-range")) return [3 /*break*/, 17];
|
|
23751
24486
|
Object.assign(schema, {
|
|
23752
24487
|
inputFormat: 'HH:mm',
|
|
23753
24488
|
timeFormat: 'HH:mm',
|
|
23754
24489
|
format: '1970-01-01THH:mm:00.000[Z]',
|
|
23755
24490
|
});
|
|
23756
|
-
return [3 /*break*/,
|
|
23757
|
-
case
|
|
23758
|
-
if (!(steedosField.type === "percent")) return [3 /*break*/,
|
|
24491
|
+
return [3 /*break*/, 27];
|
|
24492
|
+
case 17:
|
|
24493
|
+
if (!(steedosField.type === "percent")) return [3 /*break*/, 18];
|
|
23759
24494
|
Object.assign(schema, {
|
|
23760
24495
|
"percent": steedosField.scale ? steedosField.scale : true
|
|
23761
24496
|
});
|
|
23762
|
-
return [3 /*break*/,
|
|
23763
|
-
case
|
|
23764
|
-
if (!(steedosField.type === "password")) return [3 /*break*/,
|
|
24497
|
+
return [3 /*break*/, 27];
|
|
24498
|
+
case 18:
|
|
24499
|
+
if (!(steedosField.type === "password")) return [3 /*break*/, 19];
|
|
23765
24500
|
Object.assign(schema, {
|
|
23766
24501
|
"tpl": "******"
|
|
23767
24502
|
});
|
|
23768
|
-
return [3 /*break*/,
|
|
23769
|
-
case
|
|
23770
|
-
if (!(steedosField.type === "select")) return [3 /*break*/,
|
|
24503
|
+
return [3 /*break*/, 27];
|
|
24504
|
+
case 19:
|
|
24505
|
+
if (!(steedosField.type === "select")) return [3 /*break*/, 20];
|
|
23771
24506
|
map = getSelectMap(steedosField.options);
|
|
23772
24507
|
Object.assign(schema, {
|
|
23773
24508
|
"placeholder": "",
|
|
23774
24509
|
"map": map
|
|
23775
24510
|
});
|
|
23776
|
-
return [3 /*break*/,
|
|
23777
|
-
case
|
|
23778
|
-
if (!(steedosField.type === "color")) return [3 /*break*/,
|
|
24511
|
+
return [3 /*break*/, 27];
|
|
24512
|
+
case 20:
|
|
24513
|
+
if (!(steedosField.type === "color")) return [3 /*break*/, 21];
|
|
23779
24514
|
Object.assign(schema, {
|
|
23780
24515
|
"defaultColor": null
|
|
23781
24516
|
});
|
|
23782
|
-
return [3 /*break*/,
|
|
23783
|
-
case
|
|
23784
|
-
if (!(steedosField.type === "number" || steedosField.type === 'currency')) return [3 /*break*/,
|
|
24517
|
+
return [3 /*break*/, 27];
|
|
24518
|
+
case 21:
|
|
24519
|
+
if (!(steedosField.type === "number" || steedosField.type === 'currency')) return [3 /*break*/, 22];
|
|
23785
24520
|
// amis input-number和number组件中的precision表示小数位数,并不是魔方平台的精度概念,要转换下,否则小数点后会显示很多的0
|
|
23786
24521
|
Object.assign(schema, {
|
|
23787
24522
|
"precision": steedosField.scale || 0,
|
|
23788
24523
|
"kilobitSeparator": steedosField.enable_thousands //识别enable_thousands,控制千分位分隔符
|
|
23789
24524
|
});
|
|
23790
|
-
return [3 /*break*/,
|
|
23791
|
-
case
|
|
23792
|
-
if (!(steedosField.type === "table")) return [3 /*break*/,
|
|
24525
|
+
return [3 /*break*/, 27];
|
|
24526
|
+
case 22:
|
|
24527
|
+
if (!(steedosField.type === "table")) return [3 /*break*/, 23];
|
|
23793
24528
|
if (steedosField.subFields) {
|
|
23794
24529
|
tableFields = [];
|
|
23795
24530
|
try {
|
|
23796
|
-
for (
|
|
23797
|
-
subField =
|
|
24531
|
+
for (_m = __values(steedosField.subFields), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
24532
|
+
subField = _o.value;
|
|
23798
24533
|
if (!subField.name.endsWith(".$")) {
|
|
23799
24534
|
subFieldName = subField.name.replace("".concat(steedosField._prefix || '').concat(steedosField.name, ".$."), '').replace("".concat(steedosField.name, "."), '');
|
|
23800
24535
|
// const gridSub = await convertSFieldToAmisField(Object.assign({}, subField, {name: subFieldName, isTableField: true}), readonly, ctx);
|
|
@@ -23805,7 +24540,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23805
24540
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
23806
24541
|
finally {
|
|
23807
24542
|
try {
|
|
23808
|
-
if (
|
|
24543
|
+
if (_o && !_o.done && (_y = _m.return)) _y.call(_m);
|
|
23809
24544
|
}
|
|
23810
24545
|
finally { if (e_1) throw e_1.error; }
|
|
23811
24546
|
}
|
|
@@ -23821,9 +24556,9 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23821
24556
|
}
|
|
23822
24557
|
});
|
|
23823
24558
|
}
|
|
23824
|
-
return [3 /*break*/,
|
|
23825
|
-
case
|
|
23826
|
-
if (!(steedosField.type === "image")) return [3 /*break*/,
|
|
24559
|
+
return [3 /*break*/, 27];
|
|
24560
|
+
case 23:
|
|
24561
|
+
if (!(steedosField.type === "image")) return [3 /*break*/, 24];
|
|
23827
24562
|
Object.assign(schema, {
|
|
23828
24563
|
enlargeAble: true,
|
|
23829
24564
|
showToolbar: true,
|
|
@@ -23854,15 +24589,15 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23854
24589
|
return value;
|
|
23855
24590
|
}
|
|
23856
24591
|
});
|
|
23857
|
-
return [3 /*break*/,
|
|
23858
|
-
case
|
|
23859
|
-
if (!(steedosField.type === "file")) return [3 /*break*/,
|
|
23860
|
-
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField,
|
|
23861
|
-
case
|
|
24592
|
+
return [3 /*break*/, 27];
|
|
24593
|
+
case 24:
|
|
24594
|
+
if (!(steedosField.type === "file")) return [3 /*break*/, 26];
|
|
24595
|
+
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, true, ctx)];
|
|
24596
|
+
case 25:
|
|
23862
24597
|
// 附件static模式先保持原来的逻辑,依赖_display,审批王中相关功能在creator中
|
|
23863
24598
|
// convertSFieldToAmisField中会合并steedosField.amis,所以也不需要再次合并steedosField.amis,直接return就好
|
|
23864
|
-
return [2 /*return*/,
|
|
23865
|
-
case
|
|
24599
|
+
return [2 /*return*/, _5.sent()];
|
|
24600
|
+
case 26:
|
|
23866
24601
|
if (steedosField.type === 'formula' || steedosField.type === 'summary') {
|
|
23867
24602
|
if (steedosField.data_type === 'number' || steedosField.data_type === 'currency') {
|
|
23868
24603
|
Object.assign(schema, {
|
|
@@ -23923,11 +24658,11 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23923
24658
|
disabled: true
|
|
23924
24659
|
});
|
|
23925
24660
|
}
|
|
23926
|
-
|
|
23927
|
-
case
|
|
24661
|
+
_5.label = 27;
|
|
24662
|
+
case 27:
|
|
23928
24663
|
Object.assign(schema, steedosField.amis || {});
|
|
23929
24664
|
return [2 /*return*/, schema];
|
|
23930
|
-
case
|
|
24665
|
+
case 28:
|
|
23931
24666
|
if (!ctx.className) {
|
|
23932
24667
|
ctx.className = className;
|
|
23933
24668
|
}
|
|
@@ -23988,16 +24723,16 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23988
24723
|
}
|
|
23989
24724
|
}
|
|
23990
24725
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
23991
|
-
case
|
|
23992
|
-
schema =
|
|
24726
|
+
case 29:
|
|
24727
|
+
schema = _5.sent();
|
|
23993
24728
|
// console.log(`AmisSteedosField return schema`, schema)
|
|
23994
24729
|
return [2 /*return*/, schema];
|
|
23995
|
-
case
|
|
23996
|
-
case
|
|
23997
|
-
error_1 =
|
|
24730
|
+
case 30: return [3 /*break*/, 32];
|
|
24731
|
+
case 31:
|
|
24732
|
+
error_1 = _5.sent();
|
|
23998
24733
|
console.log("error", error_1);
|
|
23999
|
-
return [3 /*break*/,
|
|
24000
|
-
case
|
|
24734
|
+
return [3 /*break*/, 32];
|
|
24735
|
+
case 32: return [2 /*return*/, null];
|
|
24001
24736
|
}
|
|
24002
24737
|
});
|
|
24003
24738
|
}); };
|
|
@@ -24240,7 +24975,7 @@ var AmisInputTable = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
24240
24975
|
return __generator(this, function (_a) {
|
|
24241
24976
|
switch (_a.label) {
|
|
24242
24977
|
case 0:
|
|
24243
|
-
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;
|
|
24978
|
+
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;
|
|
24244
24979
|
extendProps = {};
|
|
24245
24980
|
if (props.disabledOn || props.disabled) {
|
|
24246
24981
|
extendProps["addable"] = false;
|
|
@@ -24501,7 +25236,7 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
24501
25236
|
});
|
|
24502
25237
|
}); };
|
|
24503
25238
|
|
|
24504
|
-
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]=useState(!0);var n=()=>{r(!1);};return has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React.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.createElement(newFunctionComponent(n),e);createRoot(t).render(e);},Modal=assign(newComponentRender("modal",Modal$1),{info:Modal$1.info,success:Modal$1.success,error:Modal$1.error,warning:Modal$1.warning,confirm:Modal$1.confirm}),Drawer=newComponentRender("drawer",Drawer$1),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),each(e,e=>{-1<e.indexOf(".")&&(e=e.split(".")[0]),t.push(""+e);}),""+t.join(" ")},getFindOneQuery=(e,t,r)=>{e=e.replace(/\./g,"_");r=getGraphqlFieldsQuery(r);let n="";t=[`id: "${t}"`];return `{record:${e}__findOne${n=0<t.length?`(${t.join(",")})`:n}{${r}}}`},SObject={getRecord:async(e,t,r)=>{return (await fetchAPI("/graphql",{method:"post",body:JSON.stringify({query:getFindOneQuery(e,t,r)})})).data.record},getUISchema:async(e,t)=>getUISchema(e,t)},canSaveFilter=e=>!(!e._id||e.owner!==getSteedosAuth()?.userId),ListView={showFilter:(e,{listView:t,data:r})=>{canSaveFilter(t);r.filters&&(r.filters=filtersToConditions(r.filters));},getVisibleFilter:(e,t)=>{return t||(canSaveFilter(e)?e.filters:void 0)},getQueryFilter:(e,t)=>{return canSaveFilter(e)?ListView.getVisibleFilter(e,t):isEmpty(t)?e.filters:[e.filters,"and",t]},getFirstListView:async e=>{e=await window.getUISchema(e);return _.first(_.sortBy(_.values(e.list_views),"sort_no"))}},Router={getAppPath({appId:e}){return "/app/"+e},getPagePath(){},getObjectListViewPath({appId:e,objectName:t,listViewName:r}){return `/app/${e}/${t}/grid/`+r},getObjectDetailPath({appId:e,objectName:t,recordId:r}){return `/app/${e}/${t}/view/`+r},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:r,objectName:n,foreignKey:a}){return `/app/${e}/${t}/${r}/${n}/grid?related_field_name=`+a}};var withModalWrap=function(t,e){return function(e){return createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=createElement(e,__assign({},t));return ReactDOM.render(e,r)};const safeRunFunction=(t,r,n,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 isNil(r)||(e=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})`)),isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),isString(r)&&(r=getCompatibleDefaultValueExpression(r,e.multiple));var n=isExpression(r);switch(n&&("date"===e.type?r=r.replace(/\bglobal.now\b/g,"global.today"):"time"===e.type&&(r=r.replace(/\bglobal.now\b/g,"global.timeNow")),r=parseSingleExpression(r,{},"#",t)),e.type){case"select":var a=e.data_type||"text";!r||n||e.multiple||("text"!==a||isString(r)?"number"===a&&isString(r)?r=Number(r):"boolean"===a&&isString(r)&&(r="true"===r.toLowerCase()||"1"===r):r=String(r));break;case"number":isString(r)&&(r=Number(r));break;case"boolean":isString(r)?r="true"===r.toLowerCase()||"1"===r:isBoolean(r)||(r=!1);break;case"time":if(isDate(r))return moment(r).format("1970-01-01THH:mm:00.000[Z]");case"date":if(isDate(r))return moment(r).format("YYYY-MM-DDT00:00:00.000[Z]");case"datetime":if(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:message,notification:notification,components:{Button:Button,Space:Space},getRefId:({type:e,appId:t,name:r})=>{switch(e){case"listview":return `amis-${t}-${r}-listview`;case"form":return `amis-${t}-${r}-form`;case"detail":return `amis-${t}-${r}-detail`;default:return `amis-${t}-${r}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType,isFilterFormValuesEmpty:isFilterFormValuesEmpty,getSearchFilter:e=>{var 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=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 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);
|
|
25239
|
+
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]=useState(!0);var n=()=>{r(!1);};return has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React.createElement(o,_extends({visible:t,onCancel:n,onClose:n},{width:"70%",style:{width:"70%",maxWidth:"950px",minWidth:"480px"}},e))},newComponentRender=(r,n)=>(e,t)=>{e.name||(e.name=r+"-"+(e.name||"default")),(t=t||document.getElementById(`steedos-${r}-root-`+e.name))||((t=document.createElement("div")).setAttribute("id",`steedos-${r}-root-`+e.name),document.body.appendChild(t));e=React.createElement(newFunctionComponent(n),e);createRoot(t).render(e);},Modal=assign(newComponentRender("modal",Modal$1),{info:Modal$1.info,success:Modal$1.success,error:Modal$1.error,warning:Modal$1.warning,confirm:Modal$1.confirm}),Drawer=newComponentRender("drawer",Drawer$1),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),each(e,e=>{-1<e.indexOf(".")&&(e=e.split(".")[0]),t.push(""+e);}),""+t.join(" ")},getFindOneQuery=(e,t,r)=>{e=e.replace(/\./g,"_");r=getGraphqlFieldsQuery(r);let n="";t=[`id: "${t}"`];return `{record:${e}__findOne${n=0<t.length?`(${t.join(",")})`:n}{${r}}}`},SObject={getRecord:async(e,t,r)=>{return (await fetchAPI("/graphql",{method:"post",body:JSON.stringify({query:getFindOneQuery(e,t,r)})})).data.record},getUISchema:async(e,t)=>getUISchema(e,t)},canSaveFilter=e=>!(!e._id||e.owner!==getSteedosAuth()?.userId),ListView={showFilter:(e,{listView:t,data:r})=>{canSaveFilter(t);r.filters&&(r.filters=filtersToConditions(r.filters));},getVisibleFilter:(e,t)=>{return t||(canSaveFilter(e)?e.filters:void 0)},getQueryFilter:(e,t)=>{return canSaveFilter(e)?ListView.getVisibleFilter(e,t):isEmpty(t)?e.filters:[e.filters,"and",t]},getFirstListView:async e=>{e=await window.getUISchema(e);return _.first(_.sortBy(_.values(e.list_views),"sort_no"))}},Router={getAppPath({appId:e}){return "/app/"+e},getPagePath(){},getObjectListViewPath({appId:e,objectName:t,listViewName:r}){return `/app/${e}/${t}/grid/`+r},getObjectDetailPath({appId:e,objectName:t,recordId:r}){return `/app/${e}/${t}/view/`+r},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:r,objectName:n,foreignKey:o}){return `/app/${e}/${t}/${r}/${n}/grid?related_field_name=`+o}};var withModalWrap=function(t,e){return function(e){return createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=createElement(e,__assign({},t));return ReactDOM.render(e,r)};const safeRunFunction=(t,r,n,o)=>{try{var 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 isNil(r)||(e=isArray(r)?r:[r]),t.bind(o||{})(...e)}catch(e){return console.log(e),n}};function safeEval(js){try{return eval(js)}catch(e){console.error(e,js);}}const isExpression=function(e){var t,r;return "string"==typeof e&&(t=/^{{(function.+)}}$/,r=/^{{(.+=>.+)}}$/,!("string"!=typeof e||!e.match(/^{{(.+)}}$/)||e.match(t)||e.match(r)))},getMoment=()=>window.amisRequire?window.amisRequire("moment"):window.moment||void 0,getGlobalNowData=()=>{var e=new Date,t=getMoment();let r=t().utc(),n=(r.set("hours",0),r.set("minutes",0),r.set("seconds",0),r.set("milliseconds",0),r=r.toDate(),t());return n.set("year",1970),n.set("month",0),n.set("date",1),n.set("hours",n.hours()+n.utcOffset()/60),n.set("seconds",0),n.set("milliseconds",0),n=n.toDate(),{now:e,today:r,timeNow:n}},parseSingleExpression=function(t,e,r,n){var o,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})`)),isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),isString(r)&&(r=getCompatibleDefaultValueExpression(r,e.multiple));var n=isExpression(r);switch(n&&("date"===e.type?r=r.replace(/\bglobal.now\b/g,"global.today"):"time"===e.type&&(r=r.replace(/\bglobal.now\b/g,"global.timeNow")),r=parseSingleExpression(r,{},"#",t)),e.type){case"select":var o=e.data_type||"text";!r||n||e.multiple||("text"!==o||isString(r)?"number"===o&&isString(r)?r=Number(r):"boolean"===o&&isString(r)&&(r="true"===r.toLowerCase()||"1"===r):r=String(r));break;case"number":isString(r)&&(r=Number(r));break;case"boolean":isString(r)?r="true"===r.toLowerCase()||"1"===r:isBoolean(r)||(r=!1);break;case"time":if(isDate(r))return moment(r).format("1970-01-01THH:mm:00.000[Z]");case"date":if(isDate(r))return moment(r).format("YYYY-MM-DDT00:00:00.000[Z]");case"datetime":if(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:message,notification:notification,components:{Button:Button,Space:Space},getRefId:({type:e,appId:t,name:r})=>{switch(e){case"listview":return `amis-${t}-${r}-listview`;case"form":return `amis-${t}-${r}-form`;case"detail":return `amis-${t}-${r}-detail`;default:return `amis-${t}-${r}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType,isFilterFormValuesEmpty:isFilterFormValuesEmpty,getSearchFilter:e=>{var o=[];return _.each(e,(e,t)=>{var r,n;_.isEmpty(e)&&!_.isBoolean(e)||(_.startsWith(t,"__searchable__between__")?o.push([""+t.replace("__searchable__between__",""),"between",e]):_.startsWith(t,"__searchable__")&&(_.isString(e)?o.push([""+t.replace("__searchable__",""),"contains",e]):_.isObject(e)&&e.o?(n=[[(r=""+t.replace("__searchable__",""))+"/o","=",e.o]],e.ids.length&&n.push([r+"/ids","=",e.ids]),o.push(n)):o.push([""+t.replace("__searchable__",""),"=",e])));}),o},getKeywordsSearchFilter:(e,t)=>{const o=[];var a;return e&&t&&(a=e.split(/\s+/),a=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 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);
|
|
24505
25240
|
|
|
24506
25241
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
24507
25242
|
__proto__: null,
|