@steedos-widgets/amis-object 6.3.0-beta.9 → 6.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/amis/AmisAppLauncher.d.ts +268 -3
- package/dist/amis/AmisInputTable.d.ts +1 -0
- package/dist/amis/AmisRecordDetailHeader.d.ts +1 -0
- package/dist/amis-object.cjs.css +94 -31
- package/dist/amis-object.cjs.js +1932 -1131
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +94 -31
- package/dist/amis-object.esm.js +1932 -1131
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +94 -31
- package/dist/amis-object.umd.js +349 -288
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +21 -21
- package/dist/meta.js +31 -23
- package/package.json +3 -3
package/dist/amis-object.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": `\${${field.name}}`,
|
|
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": `\${${field.name}}`,
|
|
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/\${${steedosField.name}}" ${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){
|
|
@@ -5306,7 +5485,7 @@ async function getTableColumns$1(object, fields, options){
|
|
|
5306
5485
|
}
|
|
5307
5486
|
//增加quickEdit属性,实现快速编辑
|
|
5308
5487
|
const quickEditSchema = allowEdit ? await getQuickEditSchema(object, field, options) : allowEdit;
|
|
5309
|
-
let className =
|
|
5488
|
+
let className = `steedos-table-${field.type}-field`;
|
|
5310
5489
|
const bowserType = getBowserType();
|
|
5311
5490
|
if(bowserType === "Safari"){
|
|
5312
5491
|
className += " whitespace-nowrap ";
|
|
@@ -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
|
-
|
|
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为弹出选择专用视图,根据用户权限被禁用的视图,不显示在列表切换区域
|
|
9687
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
|
}
|
|
@@ -10286,10 +11055,10 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
10286
11055
|
async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
|
|
10287
11056
|
}
|
|
10288
11057
|
|
|
10289
|
-
const
|
|
11058
|
+
const getCopyListviewButtonSchema = ()=>{
|
|
10290
11059
|
return {
|
|
10291
11060
|
"type": "button",
|
|
10292
|
-
"label": instance.t('
|
|
11061
|
+
"label": instance.t('frontend_listview_control_clone_label'),
|
|
10293
11062
|
"onEvent": {
|
|
10294
11063
|
"click": {
|
|
10295
11064
|
"weight": 0,
|
|
@@ -10297,14 +11066,14 @@ const getNewListviewButtonSchema = ()=>{
|
|
|
10297
11066
|
{
|
|
10298
11067
|
"dialog": {
|
|
10299
11068
|
"type": "dialog",
|
|
10300
|
-
"title": instance.t('
|
|
11069
|
+
"title": instance.t('frontend_listview_control_clone_title'),
|
|
10301
11070
|
"data": {
|
|
10302
11071
|
//"&":"$$",2.7、2.9、3.0在此处失效
|
|
10303
|
-
"
|
|
11072
|
+
"listName": "${listName}",
|
|
11073
|
+
"targetObjectName": "${objectName}",
|
|
10304
11074
|
"list_view": "${uiSchema.list_views[listName]}",
|
|
10305
11075
|
"appId": "${appId}",
|
|
10306
11076
|
"global": "${global}",
|
|
10307
|
-
"targetObjectName": "${objectName}",
|
|
10308
11077
|
"context": "${context}"
|
|
10309
11078
|
},
|
|
10310
11079
|
"body": [
|
|
@@ -10318,8 +11087,7 @@ const getNewListviewButtonSchema = ()=>{
|
|
|
10318
11087
|
"defaultData": {
|
|
10319
11088
|
"&": "${list_view}",
|
|
10320
11089
|
"name":"",
|
|
10321
|
-
"label":"",
|
|
10322
|
-
"filters":"",
|
|
11090
|
+
"label": instance.t('frontend_listview_control_clone_defaultData_label_start') + " ${list_view.label} " + instance.t('frontend_listview_control_clone_defaultData_label_end'),
|
|
10323
11091
|
"shared":false,
|
|
10324
11092
|
"object_name": "${targetObjectName}",
|
|
10325
11093
|
"_id":"",
|
|
@@ -10331,15 +11099,14 @@ const getNewListviewButtonSchema = ()=>{
|
|
|
10331
11099
|
"company_ids": null,
|
|
10332
11100
|
"is_system": false
|
|
10333
11101
|
},
|
|
10334
|
-
"fieldsExtend": fieldsExtend$
|
|
10335
|
-
"fields": fields
|
|
11102
|
+
"fieldsExtend": fieldsExtend$4(),
|
|
11103
|
+
"fields": fields(),
|
|
10336
11104
|
"onEvent": {
|
|
10337
11105
|
"submitSucc": {
|
|
10338
11106
|
"weight": 0,
|
|
10339
11107
|
"actions": [
|
|
10340
11108
|
{
|
|
10341
11109
|
"args": {
|
|
10342
|
-
// 直接使用recordId不能拿到数据,只能通过result里面拿数据
|
|
10343
11110
|
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
10344
11111
|
"blank": false
|
|
10345
11112
|
},
|
|
@@ -10347,11 +11114,7 @@ const getNewListviewButtonSchema = ()=>{
|
|
|
10347
11114
|
}
|
|
10348
11115
|
]
|
|
10349
11116
|
}
|
|
10350
|
-
}
|
|
10351
|
-
"messages": {
|
|
10352
|
-
"success": instance.t('frontend_listview_control_new_message_success'),
|
|
10353
|
-
"failed": instance.t('frontend_listview_control_new_message_failed')
|
|
10354
|
-
},
|
|
11117
|
+
}
|
|
10355
11118
|
}
|
|
10356
11119
|
],
|
|
10357
11120
|
"showCloseButton": true,
|
|
@@ -10369,18 +11132,20 @@ const getNewListviewButtonSchema = ()=>{
|
|
|
10369
11132
|
}
|
|
10370
11133
|
};
|
|
10371
11134
|
|
|
10372
|
-
function fields
|
|
11135
|
+
function fields(){
|
|
10373
11136
|
return [
|
|
10374
11137
|
"label",
|
|
10375
11138
|
"name",
|
|
10376
11139
|
"object_name",
|
|
10377
11140
|
"filter_scope",
|
|
10378
11141
|
"show_count",
|
|
10379
|
-
"columns",
|
|
10380
|
-
"
|
|
11142
|
+
"columns.$.field",
|
|
11143
|
+
"columns.$.width",
|
|
11144
|
+
"sort.$.field_name",
|
|
11145
|
+
"sort.$.order",
|
|
10381
11146
|
"filters",
|
|
10382
|
-
"mobile_columns",
|
|
10383
|
-
"searchable_fields",
|
|
11147
|
+
"mobile_columns.$.field",
|
|
11148
|
+
"searchable_fields.$.field",
|
|
10384
11149
|
"is_system",
|
|
10385
11150
|
"shared",
|
|
10386
11151
|
"shared_to",
|
|
@@ -10388,213 +11153,7 @@ function fields$1(){
|
|
|
10388
11153
|
]
|
|
10389
11154
|
}
|
|
10390
11155
|
|
|
10391
|
-
function fieldsExtend$
|
|
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
|
|
10494
|
-
}
|
|
10495
|
-
}
|
|
10496
|
-
}
|
|
10497
|
-
}
|
|
10498
|
-
|
|
10499
|
-
const getCopyListviewButtonSchema = ()=>{
|
|
10500
|
-
return {
|
|
10501
|
-
"type": "button",
|
|
10502
|
-
"label": instance.t('frontend_listview_control_clone_label'),
|
|
10503
|
-
"onEvent": {
|
|
10504
|
-
"click": {
|
|
10505
|
-
"weight": 0,
|
|
10506
|
-
"actions": [
|
|
10507
|
-
{
|
|
10508
|
-
"dialog": {
|
|
10509
|
-
"type": "dialog",
|
|
10510
|
-
"title": instance.t('frontend_listview_control_clone_title'),
|
|
10511
|
-
"data": {
|
|
10512
|
-
//"&":"$$",2.7、2.9、3.0在此处失效
|
|
10513
|
-
"listName": "${listName}",
|
|
10514
|
-
"targetObjectName": "${objectName}",
|
|
10515
|
-
"list_view": "${uiSchema.list_views[listName]}",
|
|
10516
|
-
"appId": "${appId}",
|
|
10517
|
-
"global": "${global}",
|
|
10518
|
-
"context": "${context}"
|
|
10519
|
-
},
|
|
10520
|
-
"body": [
|
|
10521
|
-
{
|
|
10522
|
-
"type": "steedos-object-form",
|
|
10523
|
-
"label": "对象表单",
|
|
10524
|
-
"objectApiName": "object_listviews",
|
|
10525
|
-
"recordId": "",
|
|
10526
|
-
"mode": "edit",
|
|
10527
|
-
"layout": "normal",
|
|
10528
|
-
"defaultData": {
|
|
10529
|
-
"&": "${list_view}",
|
|
10530
|
-
"name":"",
|
|
10531
|
-
"label": instance.t('frontend_listview_control_clone_defaultData_label_start') + " ${list_view.label} " + instance.t('frontend_listview_control_clone_defaultData_label_end'),
|
|
10532
|
-
"shared":false,
|
|
10533
|
-
"object_name": "${targetObjectName}",
|
|
10534
|
-
"_id":"",
|
|
10535
|
-
"shared_to": null,
|
|
10536
|
-
"shared_to_organizations": null,
|
|
10537
|
-
"locked": false,
|
|
10538
|
-
"owner": null,
|
|
10539
|
-
"company_id": null,
|
|
10540
|
-
"company_ids": null,
|
|
10541
|
-
"is_system": false
|
|
10542
|
-
},
|
|
10543
|
-
"fieldsExtend": fieldsExtend$4(),
|
|
10544
|
-
"fields": fields(),
|
|
10545
|
-
"onEvent": {
|
|
10546
|
-
"submitSucc": {
|
|
10547
|
-
"weight": 0,
|
|
10548
|
-
"actions": [
|
|
10549
|
-
{
|
|
10550
|
-
"args": {
|
|
10551
|
-
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
10552
|
-
"blank": false
|
|
10553
|
-
},
|
|
10554
|
-
"actionType": "url",
|
|
10555
|
-
}
|
|
10556
|
-
]
|
|
10557
|
-
}
|
|
10558
|
-
}
|
|
10559
|
-
}
|
|
10560
|
-
],
|
|
10561
|
-
"showCloseButton": true,
|
|
10562
|
-
"showErrorMsg": true,
|
|
10563
|
-
"showLoading": true,
|
|
10564
|
-
"closeOnEsc": false,
|
|
10565
|
-
"dataMapSwitch": false,
|
|
10566
|
-
"size": "lg"
|
|
10567
|
-
},
|
|
10568
|
-
"actionType": "dialog"
|
|
10569
|
-
}
|
|
10570
|
-
]
|
|
10571
|
-
}
|
|
10572
|
-
}
|
|
10573
|
-
}
|
|
10574
|
-
};
|
|
10575
|
-
|
|
10576
|
-
function fields(){
|
|
10577
|
-
return [
|
|
10578
|
-
"label",
|
|
10579
|
-
"name",
|
|
10580
|
-
"object_name",
|
|
10581
|
-
"filter_scope",
|
|
10582
|
-
"show_count",
|
|
10583
|
-
"columns.$.field",
|
|
10584
|
-
"columns.$.width",
|
|
10585
|
-
"sort.$.field_name",
|
|
10586
|
-
"sort.$.order",
|
|
10587
|
-
"filters",
|
|
10588
|
-
"mobile_columns.$.field",
|
|
10589
|
-
"searchable_fields.$.field",
|
|
10590
|
-
"is_system",
|
|
10591
|
-
"shared",
|
|
10592
|
-
"shared_to",
|
|
10593
|
-
"shared_to_organizations"
|
|
10594
|
-
]
|
|
10595
|
-
}
|
|
10596
|
-
|
|
10597
|
-
function fieldsExtend$4(){
|
|
11156
|
+
function fieldsExtend$4(){
|
|
10598
11157
|
return {
|
|
10599
11158
|
"label": {
|
|
10600
11159
|
"group": "",
|
|
@@ -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){
|
|
@@ -16282,6 +16872,8 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
16282
16872
|
if(gridSub){
|
|
16283
16873
|
delete gridSub.name;
|
|
16284
16874
|
delete gridSub.label;
|
|
16875
|
+
//去除重复样式
|
|
16876
|
+
gridSub.className = gridSub.className.replace('border-b', '');
|
|
16285
16877
|
convertData.items.push(
|
|
16286
16878
|
Object.assign({}, gridSub, {label: subField.label}, subField.amis, {
|
|
16287
16879
|
name: subFieldName
|
|
@@ -16336,6 +16928,10 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
16336
16928
|
}
|
|
16337
16929
|
// if(ctx.mode === 'edit'){
|
|
16338
16930
|
let convertDataResult = Object.assign({}, baseData, convertData, { labelClassName: 'text-left', clearValueOnHidden: true, fieldName: field.name}, field.amis, {name: baseData.name});
|
|
16931
|
+
// 只读时file字段的外层control层若存在name,内部each组件存在问题
|
|
16932
|
+
if(readonly && field.type == "file") {
|
|
16933
|
+
convertDataResult.name = "";
|
|
16934
|
+
}
|
|
16339
16935
|
// console.log("convertDataResult:", convertDataResult);
|
|
16340
16936
|
return convertDataResult;
|
|
16341
16937
|
// }else{
|
|
@@ -16555,13 +17151,17 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
|
|
|
16555
17151
|
// console.log(`perField.type object ===> field`, field)
|
|
16556
17152
|
}
|
|
16557
17153
|
if (field.name.indexOf(".") < 0) {
|
|
17154
|
+
let _field = _.cloneDeep(field);
|
|
17155
|
+
if(field.type === "select" && field.data_type && field.data_type != "text"){
|
|
17156
|
+
_field.type = field.data_type;
|
|
17157
|
+
}
|
|
16558
17158
|
if(field.type === "steedos-field"){
|
|
16559
17159
|
// 如果是steedos-field则不需要通过convertSFieldToAmisField函数转换,因为steedos-field组件会转换
|
|
16560
|
-
fieldSetBody.push(
|
|
17160
|
+
fieldSetBody.push(_field);
|
|
16561
17161
|
}
|
|
16562
17162
|
else {
|
|
16563
17163
|
ctx.__formFields = formFields;
|
|
16564
|
-
const amisField = await convertSFieldToAmisField(
|
|
17164
|
+
const amisField = await convertSFieldToAmisField(_field, _field.readonly, ctx);
|
|
16565
17165
|
// 如果steedos-field稳定了,可以放开下面的代码直接用组件统一渲染字段
|
|
16566
17166
|
// const amisField = {
|
|
16567
17167
|
// "type": "steedos-field",
|
|
@@ -16714,24 +17314,24 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
16714
17314
|
/*
|
|
16715
17315
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
16716
17316
|
* @Date: 2024-01-18 15:12:41
|
|
16717
|
-
* @LastEditors:
|
|
16718
|
-
* @LastEditTime: 2024-
|
|
17317
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
17318
|
+
* @LastEditTime: 2024-05-20 13:46:41
|
|
16719
17319
|
*/
|
|
16720
17320
|
/**
|
|
16721
17321
|
* 生成符合标准uuid格式的36位满足唯一性的随机串
|
|
16722
17322
|
* @returns uuid
|
|
16723
17323
|
*/
|
|
16724
17324
|
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
|
-
);
|
|
17325
|
+
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, function (c) {
|
|
17326
|
+
return (c ^ window.crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
|
|
17327
|
+
});
|
|
16728
17328
|
}
|
|
16729
17329
|
|
|
16730
17330
|
/*
|
|
16731
17331
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
16732
17332
|
* @Date: 2023-11-15 09:50:22
|
|
16733
17333
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
16734
|
-
* @LastEditTime: 2024-
|
|
17334
|
+
* @LastEditTime: 2024-06-14 06:31:33
|
|
16735
17335
|
*/
|
|
16736
17336
|
|
|
16737
17337
|
/**
|
|
@@ -16950,7 +17550,8 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
16950
17550
|
return {
|
|
16951
17551
|
"type": "steedos-field",
|
|
16952
17552
|
"config": Object.assign({}, field, {
|
|
16953
|
-
label: false
|
|
17553
|
+
label: false,
|
|
17554
|
+
description: null
|
|
16954
17555
|
}),
|
|
16955
17556
|
// quickEdit: {
|
|
16956
17557
|
// "type": "steedos-field",
|
|
@@ -16967,7 +17568,8 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
16967
17568
|
return {
|
|
16968
17569
|
"type": "steedos-field",
|
|
16969
17570
|
"config": Object.assign({}, field, {
|
|
16970
|
-
label: false
|
|
17571
|
+
label: false,
|
|
17572
|
+
description: null
|
|
16971
17573
|
}),
|
|
16972
17574
|
inInputTable: true,
|
|
16973
17575
|
"static": true,
|
|
@@ -17801,6 +18403,7 @@ async function getButtonActions(props, mode) {
|
|
|
17801
18403
|
"__parentForm": mode == "new" ? "$$" : parentFormData,
|
|
17802
18404
|
"_master": "${_master}",
|
|
17803
18405
|
"global": "${global}",
|
|
18406
|
+
"context": "${context}",
|
|
17804
18407
|
"uiSchema": "${uiSchema}",
|
|
17805
18408
|
"index": "${index}",//amis组件自带行索引,在节点嵌套情况下,当前节点如果是children属性下的子节点时,这里的index是当前节点在children中的索引,而不是外层父节点的index
|
|
17806
18409
|
"parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
@@ -17925,6 +18528,7 @@ async function getButtonActions(props, mode) {
|
|
|
17925
18528
|
"__parentForm": parentFormData,
|
|
17926
18529
|
"_master": "${_master}",
|
|
17927
18530
|
"global": "${global}",
|
|
18531
|
+
"context": "${context}",
|
|
17928
18532
|
"uiSchema": "${uiSchema}",
|
|
17929
18533
|
"index": "${index}",
|
|
17930
18534
|
"parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
@@ -18211,7 +18815,8 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
18211
18815
|
}
|
|
18212
18816
|
return value;
|
|
18213
18817
|
},
|
|
18214
|
-
"required": props.required
|
|
18818
|
+
"required": props.required,
|
|
18819
|
+
"description": props.description
|
|
18215
18820
|
};
|
|
18216
18821
|
if (buttonsForColumnOperations.length) {
|
|
18217
18822
|
inputTableSchema.columns.unshift({
|
|
@@ -21082,6 +21687,7 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
|
|
|
21082
21687
|
setUISchemaFunction: setUISchemaFunction,
|
|
21083
21688
|
setVariable: setVariable,
|
|
21084
21689
|
standardButtonsTodo: standardButtonsTodo,
|
|
21690
|
+
uuidv4: uuidv4,
|
|
21085
21691
|
i18next: instance
|
|
21086
21692
|
});
|
|
21087
21693
|
|
|
@@ -21359,7 +21965,12 @@ var SteedosDropdownButton = function (props) {
|
|
|
21359
21965
|
}
|
|
21360
21966
|
}
|
|
21361
21967
|
};
|
|
21362
|
-
return (React.createElement(Dropdown, { menu: { items: menu }, trigger: trigger, onOpenChange: onOpenChange, placement: placement, overlayClassName: overlayClassName, arrow: arrow
|
|
21968
|
+
return (React.createElement(Dropdown, { menu: { items: menu }, trigger: trigger, onOpenChange: onOpenChange, placement: placement, overlayClassName: overlayClassName, arrow: arrow, getPopupContainer: function (button) {
|
|
21969
|
+
// 未配置getPopupContainer属性时,默认container为body,这里判断到dropdown button是在drawer中时,统一把container配置为drawer本身
|
|
21970
|
+
// 这样就可以解决drawer内点击dropdown button组件下拉菜单中的按钮时不应该自动关闭drawer的问题
|
|
21971
|
+
var drawerBody = window.$(button).closest(".amis-dialog-widget .antd-Drawer-body")[0];
|
|
21972
|
+
return drawerBody || document.querySelector("body");
|
|
21973
|
+
} },
|
|
21363
21974
|
React.createElement("button", { className: "slds-button slds-button_icon slds-button_icon-border-filled slds-button_icon-x-small ".concat(className ? className : '') },
|
|
21364
21975
|
React.createElement("svg", { className: "w-4 h-4 fill-gray-500" },
|
|
21365
21976
|
React.createElement("use", { xlinkHref: "/assets/icons/utility-sprite/svg/symbols.svg#down" })))));
|
|
@@ -21938,7 +22549,7 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
|
|
|
21938
22549
|
return __generator(this, function (_d) {
|
|
21939
22550
|
switch (_d.label) {
|
|
21940
22551
|
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;
|
|
22552
|
+
_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
22553
|
return [4 /*yield*/, getUISchema(props.objectApiName || "space_users", false)];
|
|
21943
22554
|
case 1:
|
|
21944
22555
|
_d.sent();
|
|
@@ -21948,7 +22559,7 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
|
|
|
21948
22559
|
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
22560
|
case 2:
|
|
21950
22561
|
schema = (_d.sent()).amisSchema;
|
|
21951
|
-
schema.className
|
|
22562
|
+
schema.className += " " + className;
|
|
21952
22563
|
config = Object.assign({}, schema, { onEvent: onEvent });
|
|
21953
22564
|
if (!(schemaFilter && typeof schemaFilter === 'string')) return [3 /*break*/, 6];
|
|
21954
22565
|
schemaFilterFun = new Function('config', 'props', schemaFilter);
|
|
@@ -22240,12 +22851,12 @@ var AmisProvider = function (props) { return __awaiter(void 0, void 0, void 0, f
|
|
|
22240
22851
|
/*
|
|
22241
22852
|
* @Author: baozhoutao@steedos.com
|
|
22242
22853
|
* @Date: 2022-09-01 14:44:57
|
|
22243
|
-
* @LastEditors:
|
|
22244
|
-
* @LastEditTime: 2024-
|
|
22854
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
22855
|
+
* @LastEditTime: 2024-05-14 15:12:49
|
|
22245
22856
|
* @Description:
|
|
22246
22857
|
*/
|
|
22247
22858
|
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;
|
|
22859
|
+
var app, data, className, _a, showAppName, _b, appNameClassName, _c, customElements, _d, showAppIcon, formFactor, isMobile, on_click_script, mobile_blank_script, convertAppVisibleOnScript, pcInitApiAdaptorScript, mobileInitApiAdaptorScript, dialogSchema, badgeText, overlaySchema;
|
|
22249
22860
|
return __generator(this, function (_e) {
|
|
22250
22861
|
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
22862
|
if (!app) {
|
|
@@ -22255,117 +22866,15 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
22255
22866
|
isMobile = formFactor === "SMALL" ? true : false;
|
|
22256
22867
|
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
22868
|
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 ";
|
|
22869
|
+
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 ";
|
|
22870
|
+
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 ");
|
|
22871
|
+
mobileInitApiAdaptorScript = "\n let app_items = payload;\n ".concat(convertAppVisibleOnScript, "\n payload = {\n app_items\n }\n return payload;\n ");
|
|
22258
22872
|
dialogSchema = {};
|
|
22259
22873
|
badgeText = "${IF(${id} == 'approve_workflow',${ss:keyvalues.badge.value|pick:'workflow'},${ss:keyvalues.badge.value|pick:${id}}) | toInt}";
|
|
22260
|
-
if (isMobile) {
|
|
22874
|
+
if (!isMobile) {
|
|
22261
22875
|
dialogSchema = {
|
|
22262
22876
|
"type": "service",
|
|
22263
|
-
"
|
|
22264
|
-
"affixFooter": false,
|
|
22265
|
-
"body": [
|
|
22266
|
-
{
|
|
22267
|
-
"type": "each",
|
|
22268
|
-
"name": "app_items",
|
|
22269
|
-
"items": {
|
|
22270
|
-
"type": "button",
|
|
22271
|
-
"level": "link",
|
|
22272
|
-
"body": [
|
|
22273
|
-
{
|
|
22274
|
-
"type": "tpl",
|
|
22275
|
-
"tpl": "<div class='flex flex-col justify-center'><div class='text-center'><svg class='w-12 h-12 slds-icon slds-icon_container slds-icon-standard-${REPLACE(icon, '_', '-' )}' aria-hidden='true'><use xlink:href='/assets/icons/standard-sprite/svg/symbols.svg#${icon}'></use></svg></div><div class='text-center text-lg'>${name}</div></div>",
|
|
22276
|
-
"badge": {
|
|
22277
|
-
"mode": "text",
|
|
22278
|
-
"text": badgeText,
|
|
22279
|
-
"visibleOn": badgeText,
|
|
22280
|
-
"overflowCount": 99,
|
|
22281
|
-
"style": {
|
|
22282
|
-
"right": "50%",
|
|
22283
|
-
"margin-right": "-23px",
|
|
22284
|
-
"height": "20px",
|
|
22285
|
-
"border-radius": "10px",
|
|
22286
|
-
"font-size": "16px",
|
|
22287
|
-
"line-height": "18px"
|
|
22288
|
-
}
|
|
22289
|
-
}
|
|
22290
|
-
}
|
|
22291
|
-
],
|
|
22292
|
-
"onEvent": {
|
|
22293
|
-
"click": {
|
|
22294
|
-
"actions": [
|
|
22295
|
-
{
|
|
22296
|
-
"actionType": "closeDialog"
|
|
22297
|
-
},
|
|
22298
|
-
{
|
|
22299
|
-
"actionType": "link",
|
|
22300
|
-
"args": {
|
|
22301
|
-
"link": "${path}"
|
|
22302
|
-
},
|
|
22303
|
-
"expression": "${AND(!blank , !on_click)}"
|
|
22304
|
-
},
|
|
22305
|
-
{
|
|
22306
|
-
"actionType": "custom",
|
|
22307
|
-
"script": mobile_blank_script,
|
|
22308
|
-
"expression": "${AND(blank , !on_click)}"
|
|
22309
|
-
},
|
|
22310
|
-
{
|
|
22311
|
-
"actionType": "custom",
|
|
22312
|
-
"script": on_click_script,
|
|
22313
|
-
"expression": "${on_click}"
|
|
22314
|
-
}
|
|
22315
|
-
]
|
|
22316
|
-
}
|
|
22317
|
-
},
|
|
22318
|
-
"className": "block w-1/3 py-4",
|
|
22319
|
-
"style": {
|
|
22320
|
-
"display": "inline-flex",
|
|
22321
|
-
"justify-content": "center"
|
|
22322
|
-
}
|
|
22323
|
-
},
|
|
22324
|
-
"className": "flex flex-wrap",
|
|
22325
|
-
"id": "u:a98e9f6fb4db"
|
|
22326
|
-
}
|
|
22327
|
-
],
|
|
22328
|
-
"clearValueOnHidden": false,
|
|
22329
|
-
"visible": true,
|
|
22330
|
-
"messages": {},
|
|
22331
|
-
"api": {
|
|
22332
|
-
"method": "get",
|
|
22333
|
-
"url": "${context.rootUrl}/service/api/apps/menus?mobile=true",
|
|
22334
|
-
"headers": {
|
|
22335
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22336
|
-
},
|
|
22337
|
-
"adaptor": "\nlet app_items = payload;\npayload = {\n app_items\n}\nreturn payload;",
|
|
22338
|
-
"messages": {}
|
|
22339
|
-
},
|
|
22340
|
-
"onEvent": {
|
|
22341
|
-
"@data.changed.steedos_keyvalues": {
|
|
22342
|
-
"actions": [
|
|
22343
|
-
{
|
|
22344
|
-
"actionType": "reload"
|
|
22345
|
-
}
|
|
22346
|
-
]
|
|
22347
|
-
},
|
|
22348
|
-
"fetchInited": {
|
|
22349
|
-
"actions": [
|
|
22350
|
-
{
|
|
22351
|
-
"actionType": "broadcast",
|
|
22352
|
-
"args": {
|
|
22353
|
-
"eventName": "@appsLoaded"
|
|
22354
|
-
},
|
|
22355
|
-
"data": {
|
|
22356
|
-
"apps": "${event.data.app_items}"
|
|
22357
|
-
}
|
|
22358
|
-
}
|
|
22359
|
-
]
|
|
22360
|
-
}
|
|
22361
|
-
},
|
|
22362
|
-
"id": "u:2c8bd22d4ea8"
|
|
22363
|
-
};
|
|
22364
|
-
}
|
|
22365
|
-
else {
|
|
22366
|
-
dialogSchema = {
|
|
22367
|
-
"type": "service",
|
|
22368
|
-
"id": "u:0f6224a0836f",
|
|
22877
|
+
"id": "u:0f6224a0836f",
|
|
22369
22878
|
"affixFooter": false,
|
|
22370
22879
|
"body": [
|
|
22371
22880
|
{
|
|
@@ -22383,63 +22892,64 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
22383
22892
|
{
|
|
22384
22893
|
"type": "each",
|
|
22385
22894
|
"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
|
-
|
|
22895
|
+
"items": [{
|
|
22896
|
+
"type": "button",
|
|
22897
|
+
"level": "link",
|
|
22898
|
+
"body": [{
|
|
22899
|
+
"type": "tpl",
|
|
22900
|
+
"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>",
|
|
22901
|
+
"badge": {
|
|
22902
|
+
"mode": "text",
|
|
22903
|
+
"text": badgeText,
|
|
22904
|
+
"visibleOn": badgeText,
|
|
22905
|
+
"className": "w-full",
|
|
22906
|
+
"overflowCount": 99,
|
|
22907
|
+
"style": {
|
|
22908
|
+
"top": "20px",
|
|
22909
|
+
"left": "37px",
|
|
22910
|
+
"height": "20px",
|
|
22911
|
+
"border-radius": "10px",
|
|
22912
|
+
"line-height": "18px",
|
|
22913
|
+
"margin-left": "${" + badgeText + ">9?(" + badgeText + ">99?'-21px':'-11px'):'0'}",
|
|
22914
|
+
"right": "auto",
|
|
22915
|
+
"font-size": "16px"
|
|
22916
|
+
}
|
|
22407
22917
|
}
|
|
22408
|
-
}
|
|
22409
|
-
|
|
22410
|
-
|
|
22411
|
-
|
|
22412
|
-
|
|
22413
|
-
|
|
22414
|
-
"actionType": "closeDialog"
|
|
22415
|
-
},
|
|
22416
|
-
{
|
|
22417
|
-
"actionType": "link",
|
|
22418
|
-
"args": {
|
|
22419
|
-
"link": "${path}"
|
|
22918
|
+
}],
|
|
22919
|
+
"onEvent": {
|
|
22920
|
+
"click": {
|
|
22921
|
+
"actions": [
|
|
22922
|
+
{
|
|
22923
|
+
"actionType": "closeDialog"
|
|
22420
22924
|
},
|
|
22421
|
-
|
|
22422
|
-
|
|
22423
|
-
|
|
22424
|
-
|
|
22425
|
-
|
|
22426
|
-
"
|
|
22427
|
-
"blank": true
|
|
22925
|
+
{
|
|
22926
|
+
"actionType": "link",
|
|
22927
|
+
"args": {
|
|
22928
|
+
"link": "${path}"
|
|
22929
|
+
},
|
|
22930
|
+
"expression": "${AND(!blank , !on_click)}"
|
|
22428
22931
|
},
|
|
22429
|
-
|
|
22430
|
-
|
|
22431
|
-
|
|
22432
|
-
|
|
22433
|
-
|
|
22434
|
-
|
|
22435
|
-
|
|
22436
|
-
|
|
22437
|
-
|
|
22438
|
-
|
|
22439
|
-
|
|
22440
|
-
|
|
22441
|
-
|
|
22442
|
-
|
|
22932
|
+
{
|
|
22933
|
+
"actionType": "url",
|
|
22934
|
+
"args": {
|
|
22935
|
+
"url": "${path}",
|
|
22936
|
+
"blank": true
|
|
22937
|
+
},
|
|
22938
|
+
"expression": "${AND(blank , !on_click)}"
|
|
22939
|
+
},
|
|
22940
|
+
{
|
|
22941
|
+
"actionType": "custom",
|
|
22942
|
+
"script": on_click_script,
|
|
22943
|
+
"expression": "${!!on_click}"
|
|
22944
|
+
}
|
|
22945
|
+
]
|
|
22946
|
+
}
|
|
22947
|
+
},
|
|
22948
|
+
"inline": true,
|
|
22949
|
+
"style": {},
|
|
22950
|
+
"visibleOn": "${visible_on}",
|
|
22951
|
+
"className": "slds-p-horizontal_small slds-size_1-of-1 slds-medium-size_1-of-3"
|
|
22952
|
+
}],
|
|
22443
22953
|
"className": "slds-grid slds-wrap slds-grid_pull-padded"
|
|
22444
22954
|
}
|
|
22445
22955
|
]
|
|
@@ -22524,20 +23034,149 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
22524
23034
|
},
|
|
22525
23035
|
"api": {
|
|
22526
23036
|
"method": "get",
|
|
23037
|
+
"cache": "10000",
|
|
22527
23038
|
"url": "${context.rootUrl}/service/api/apps/menus?mobile=" + isMobile,
|
|
22528
23039
|
"data": null,
|
|
22529
23040
|
"headers": {
|
|
22530
23041
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22531
23042
|
},
|
|
22532
|
-
"adaptor":
|
|
23043
|
+
"adaptor": pcInitApiAdaptorScript
|
|
22533
23044
|
}
|
|
22534
23045
|
};
|
|
22535
23046
|
}
|
|
23047
|
+
overlaySchema = {
|
|
23048
|
+
"type": "service",
|
|
23049
|
+
"className": isMobile ? "steedos-apps-service" : "steedos-apps-service w-96",
|
|
23050
|
+
"affixFooter": false,
|
|
23051
|
+
"body": [
|
|
23052
|
+
{
|
|
23053
|
+
"type": "each",
|
|
23054
|
+
"source": isMobile ? "${app_items}" : "${ARRAYFILTER(app_items, (item,index) => index<=8)}",
|
|
23055
|
+
"items": {
|
|
23056
|
+
"type": "button",
|
|
23057
|
+
"level": "link",
|
|
23058
|
+
"body": [
|
|
23059
|
+
{
|
|
23060
|
+
"type": "tpl",
|
|
23061
|
+
"tpl": "<div class='flex flex-col justify-center'><div class='text-center'><svg class='w-12 h-12 slds-icon slds-icon_container slds-icon-standard-${REPLACE(icon, '_', '-' )}' aria-hidden='true'><use xlink:href='/assets/icons/standard-sprite/svg/symbols.svg#${icon}'></use></svg></div><div class='text-center text-lg'>${name}</div></div>",
|
|
23062
|
+
"badge": {
|
|
23063
|
+
"mode": "text",
|
|
23064
|
+
"text": badgeText,
|
|
23065
|
+
"visibleOn": badgeText,
|
|
23066
|
+
"overflowCount": 99,
|
|
23067
|
+
"style": {
|
|
23068
|
+
"right": "50%",
|
|
23069
|
+
"margin-right": "-23px",
|
|
23070
|
+
"height": "20px",
|
|
23071
|
+
"border-radius": "10px",
|
|
23072
|
+
"font-size": "16px",
|
|
23073
|
+
"line-height": "18px"
|
|
23074
|
+
}
|
|
23075
|
+
}
|
|
23076
|
+
}
|
|
23077
|
+
],
|
|
23078
|
+
"onEvent": {
|
|
23079
|
+
"click": {
|
|
23080
|
+
"actions": [
|
|
23081
|
+
{
|
|
23082
|
+
"actionType": "closeDialog"
|
|
23083
|
+
},
|
|
23084
|
+
{
|
|
23085
|
+
"actionType": "link",
|
|
23086
|
+
"args": {
|
|
23087
|
+
"link": "${path}"
|
|
23088
|
+
},
|
|
23089
|
+
"expression": "${AND(!blank , !on_click)}"
|
|
23090
|
+
},
|
|
23091
|
+
{
|
|
23092
|
+
"actionType": "custom",
|
|
23093
|
+
"script": mobile_blank_script,
|
|
23094
|
+
"expression": "${AND(blank , !on_click)}"
|
|
23095
|
+
},
|
|
23096
|
+
{
|
|
23097
|
+
"actionType": "custom",
|
|
23098
|
+
"script": on_click_script,
|
|
23099
|
+
"expression": "${on_click}"
|
|
23100
|
+
}
|
|
23101
|
+
]
|
|
23102
|
+
}
|
|
23103
|
+
},
|
|
23104
|
+
"visibleOn": "${visible_on}",
|
|
23105
|
+
"className": "block w-1/3 py-4",
|
|
23106
|
+
"style": {
|
|
23107
|
+
"display": "inline-flex",
|
|
23108
|
+
"justify-content": "center"
|
|
23109
|
+
}
|
|
23110
|
+
},
|
|
23111
|
+
"className": "flex flex-wrap",
|
|
23112
|
+
"id": "u:a98e9f6fb4db"
|
|
23113
|
+
},
|
|
23114
|
+
isMobile ? null : {
|
|
23115
|
+
"type": "divider",
|
|
23116
|
+
"className": "m-0"
|
|
23117
|
+
},
|
|
23118
|
+
isMobile ? null : {
|
|
23119
|
+
"type": "button",
|
|
23120
|
+
"level": "link",
|
|
23121
|
+
"label": "更多",
|
|
23122
|
+
"className": "w-full h-10",
|
|
23123
|
+
"actionType": "dialog",
|
|
23124
|
+
"dialog": {
|
|
23125
|
+
"size": "xl",
|
|
23126
|
+
"title": {
|
|
23127
|
+
"type": "tpl",
|
|
23128
|
+
"tpl": instance.t('frontend_application_launcher'),
|
|
23129
|
+
"className": "block text-xl text-center"
|
|
23130
|
+
},
|
|
23131
|
+
"actions": [],
|
|
23132
|
+
"body": [
|
|
23133
|
+
dialogSchema
|
|
23134
|
+
]
|
|
23135
|
+
}
|
|
23136
|
+
}
|
|
23137
|
+
],
|
|
23138
|
+
"clearValueOnHidden": false,
|
|
23139
|
+
"visible": true,
|
|
23140
|
+
"messages": {},
|
|
23141
|
+
"api": {
|
|
23142
|
+
"method": "get",
|
|
23143
|
+
"cache": "10000",
|
|
23144
|
+
"url": "${context.rootUrl}/service/api/apps/menus?mobile=true",
|
|
23145
|
+
"headers": {
|
|
23146
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23147
|
+
},
|
|
23148
|
+
"adaptor": mobileInitApiAdaptorScript,
|
|
23149
|
+
"messages": {}
|
|
23150
|
+
},
|
|
23151
|
+
"onEvent": {
|
|
23152
|
+
"@data.changed.steedos_keyvalues": {
|
|
23153
|
+
"actions": [
|
|
23154
|
+
{
|
|
23155
|
+
"actionType": "reload"
|
|
23156
|
+
}
|
|
23157
|
+
]
|
|
23158
|
+
},
|
|
23159
|
+
"fetchInited": {
|
|
23160
|
+
"actions": [
|
|
23161
|
+
{
|
|
23162
|
+
"actionType": "broadcast",
|
|
23163
|
+
"args": {
|
|
23164
|
+
"eventName": "@appsLoaded"
|
|
23165
|
+
},
|
|
23166
|
+
"data": {
|
|
23167
|
+
"apps": "${event.data.app_items}"
|
|
23168
|
+
}
|
|
23169
|
+
}
|
|
23170
|
+
]
|
|
23171
|
+
}
|
|
23172
|
+
},
|
|
23173
|
+
"id": "u:2c8bd22d4ea8"
|
|
23174
|
+
};
|
|
22536
23175
|
return [2 /*return*/, {
|
|
22537
23176
|
"type": "service",
|
|
22538
23177
|
className: className,
|
|
22539
23178
|
"body": [
|
|
22540
|
-
{
|
|
23179
|
+
isMobile ? {
|
|
22541
23180
|
"type": "button",
|
|
22542
23181
|
"actionType": "dialog",
|
|
22543
23182
|
"className": "flex items-center",
|
|
@@ -22572,10 +23211,43 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
22572
23211
|
},
|
|
22573
23212
|
"actions": [],
|
|
22574
23213
|
"body": [
|
|
22575
|
-
|
|
23214
|
+
overlaySchema
|
|
22576
23215
|
]
|
|
22577
23216
|
},
|
|
22578
23217
|
"id": "u:b5dc095e1c11"
|
|
23218
|
+
} : {
|
|
23219
|
+
"type": "steedos-dropdown",
|
|
23220
|
+
"placement": "bottomRight",
|
|
23221
|
+
"trigger": [
|
|
23222
|
+
"click"
|
|
23223
|
+
],
|
|
23224
|
+
"body": __spreadArray([
|
|
23225
|
+
{
|
|
23226
|
+
"type": "tpl",
|
|
23227
|
+
"className": "flex items-center",
|
|
23228
|
+
"tpl": "<div aria-haspopup='true' title='".concat(instance.t('frontend_open_app_launcher'), "' class='slds-icon-waffle_container slds-context-bar__button' type='button'><span class='slds-icon-waffle'><span class='slds-r1'></span><span class='slds-r2'></span><span class='slds-r3'></span><span class='slds-r4'></span><span class='slds-r5'></span><span class='slds-r6'></span><span class='slds-r7'></span><span class='slds-r8'></span><span class='slds-r9'></span></span></div>"),
|
|
23229
|
+
"badge": {
|
|
23230
|
+
"visibleOn": "${ss:keyvalues.badge.value.workflow | toInt}",
|
|
23231
|
+
"offset": [3, -3],
|
|
23232
|
+
"style": {
|
|
23233
|
+
"width": "8px",
|
|
23234
|
+
"height": "8px"
|
|
23235
|
+
}
|
|
23236
|
+
},
|
|
23237
|
+
"hiddenOn": "".concat(!showAppIcon)
|
|
23238
|
+
},
|
|
23239
|
+
{
|
|
23240
|
+
type: 'tpl',
|
|
23241
|
+
className: "text-xl ml-4 mr-4 text-black nowrap ".concat(appNameClassName, " "),
|
|
23242
|
+
tpl: '${app.name}',
|
|
23243
|
+
hiddenOn: "".concat(!!app || !!!showAppName)
|
|
23244
|
+
}
|
|
23245
|
+
], __read(customElements), false),
|
|
23246
|
+
"overlay": [
|
|
23247
|
+
overlaySchema
|
|
23248
|
+
],
|
|
23249
|
+
"className": "flex items-center",
|
|
23250
|
+
"open": false
|
|
22579
23251
|
}
|
|
22580
23252
|
],
|
|
22581
23253
|
"id": "u:06ee48db134a",
|
|
@@ -22690,21 +23362,261 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22690
23362
|
"headers": {
|
|
22691
23363
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22692
23364
|
}
|
|
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
|
-
*/
|
|
23365
|
+
}
|
|
23366
|
+
};
|
|
23367
|
+
}
|
|
23368
|
+
console.log("payload===>", schema);
|
|
23369
|
+
return [2 /*return*/, schema];
|
|
23370
|
+
});
|
|
23371
|
+
}); };
|
|
23372
|
+
|
|
23373
|
+
/*
|
|
23374
|
+
* @Author: baozhoutao@steedos.com
|
|
23375
|
+
* @Date: 2022-09-01 14:44:57
|
|
23376
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
23377
|
+
* @LastEditTime: 2024-05-29 11:45:57
|
|
23378
|
+
* @Description:
|
|
23379
|
+
*/
|
|
23380
|
+
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";
|
|
23381
|
+
var getNotificationBadgeButton = function () {
|
|
23382
|
+
var isMobile = window.innerWidth < 768;
|
|
23383
|
+
var listContent = {
|
|
23384
|
+
"type": "page",
|
|
23385
|
+
"body": [
|
|
23386
|
+
{
|
|
23387
|
+
"type": "service",
|
|
23388
|
+
"className": "service-global-header-notifications-list",
|
|
23389
|
+
"body": [
|
|
23390
|
+
{
|
|
23391
|
+
"type": "panel",
|
|
23392
|
+
"title": instance.t('frontend_notifications'),
|
|
23393
|
+
"className": "steedos-header-toolbar-notifications-panel " + (isMobile ? "" : "min-w-[300px] max-w-md"),
|
|
23394
|
+
"body": [
|
|
23395
|
+
{
|
|
23396
|
+
"type": "each",
|
|
23397
|
+
"className": "overflow-auto max-h-96 steedos-header-toolbar-notifications-list",
|
|
23398
|
+
"name": "notifications",
|
|
23399
|
+
"items": {
|
|
23400
|
+
"type": "tpl",
|
|
23401
|
+
"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>",
|
|
23402
|
+
"id": "u:07ece657c7b7",
|
|
23403
|
+
"onEvent": {
|
|
23404
|
+
"click": {
|
|
23405
|
+
"weight": 0,
|
|
23406
|
+
"actions": [
|
|
23407
|
+
{
|
|
23408
|
+
"args": {
|
|
23409
|
+
"options": {},
|
|
23410
|
+
"api": {
|
|
23411
|
+
"url": "${context.rootUrl}/api/v4/notifications/${_id}/read?rootUrl=&appId=${appId}&async=true",
|
|
23412
|
+
"method": "get",
|
|
23413
|
+
"messages": {},
|
|
23414
|
+
"headers": {
|
|
23415
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23416
|
+
},
|
|
23417
|
+
"adaptor": "payload = {\n status: 0,\n msg: '',\n data: {\n redirect: payload.redirect || payload \n }} \nreturn payload;"
|
|
23418
|
+
// "adaptor": notificationReadAdaptor
|
|
23419
|
+
}
|
|
23420
|
+
},
|
|
23421
|
+
"actionType": "ajax"
|
|
23422
|
+
},
|
|
23423
|
+
// {
|
|
23424
|
+
// "actionType": "custom",
|
|
23425
|
+
// "script": "if(Meteor.isCordova){window.open(Meteor.absoluteUrl(event.data.responseResult.responseData.redirect), '_blank')}else{window.open(event.data.responseResult.responseData.redirect, '_blank')}",
|
|
23426
|
+
// "expression": "${!!event.data.responseResult.responseData.redirect}",
|
|
23427
|
+
// },
|
|
23428
|
+
{
|
|
23429
|
+
// PC端保持原样,新窗口打开
|
|
23430
|
+
"actionType": "custom",
|
|
23431
|
+
"script": "window.open(event.data.responseResult.responseData.redirect, '_blank')",
|
|
23432
|
+
"expression": "${!!event.data.responseResult.responseData.redirect && window:innerWidth > 768}"
|
|
23433
|
+
},
|
|
23434
|
+
{
|
|
23435
|
+
// 手机端改为直接跳路由,因为新窗口打开顶部会显示url地址栏
|
|
23436
|
+
"actionType": "link",
|
|
23437
|
+
"args": {
|
|
23438
|
+
"link": "${redirect}"
|
|
23439
|
+
},
|
|
23440
|
+
"expression": "${!!event.data.responseResult.responseData.redirect && window:innerWidth <= 768}"
|
|
23441
|
+
},
|
|
23442
|
+
{
|
|
23443
|
+
"actionType": "cancel",
|
|
23444
|
+
"componentId": "steedos_header_toolbar_notifications_dialog",
|
|
23445
|
+
"expression": "${!!event.data.responseResult.responseData.redirect && window:innerWidth <= 768}"
|
|
23446
|
+
}
|
|
23447
|
+
]
|
|
23448
|
+
}
|
|
23449
|
+
}
|
|
23450
|
+
},
|
|
23451
|
+
"id": "u:18da41dab9ca"
|
|
23452
|
+
},
|
|
23453
|
+
],
|
|
23454
|
+
actions: [
|
|
23455
|
+
{
|
|
23456
|
+
"type": "button",
|
|
23457
|
+
"label": instance.t('frontend_notifications_close_dialog'),
|
|
23458
|
+
"visibleOn": "${window:innerWidth <= 768}",
|
|
23459
|
+
"close": true
|
|
23460
|
+
},
|
|
23461
|
+
{
|
|
23462
|
+
"type": "button",
|
|
23463
|
+
"label": instance.t('frontend_notifications_allread'),
|
|
23464
|
+
"id": "u:5530f3779e3a",
|
|
23465
|
+
"onEvent": {
|
|
23466
|
+
"click": {
|
|
23467
|
+
"actions": [
|
|
23468
|
+
{
|
|
23469
|
+
"actionType": "custom",
|
|
23470
|
+
"script": beforeMarkReadAllScript
|
|
23471
|
+
},
|
|
23472
|
+
{
|
|
23473
|
+
"componentId": "",
|
|
23474
|
+
"args": {
|
|
23475
|
+
"api": {
|
|
23476
|
+
"url": "${context.rootUrl}/api/v4/notifications/all/markReadAll",
|
|
23477
|
+
"method": "post",
|
|
23478
|
+
"headers": {
|
|
23479
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23480
|
+
}
|
|
23481
|
+
},
|
|
23482
|
+
"messages": {
|
|
23483
|
+
"success": instance.t('frontend_notifications_allread_message')
|
|
23484
|
+
}
|
|
23485
|
+
},
|
|
23486
|
+
"actionType": "ajax"
|
|
23487
|
+
},
|
|
23488
|
+
{
|
|
23489
|
+
"componentId": "service_global_header_notifications_unread_count",
|
|
23490
|
+
"actionType": "reload",
|
|
23491
|
+
"expression": "${needToReload}"
|
|
23492
|
+
},
|
|
23493
|
+
{
|
|
23494
|
+
"componentId": "service_global_header_notifications_list",
|
|
23495
|
+
"actionType": "reload",
|
|
23496
|
+
"expression": "${needToReload}"
|
|
23497
|
+
}
|
|
23498
|
+
],
|
|
23499
|
+
"weight": 0
|
|
23500
|
+
}
|
|
23501
|
+
}
|
|
23502
|
+
}
|
|
23503
|
+
]
|
|
23504
|
+
},
|
|
23505
|
+
],
|
|
23506
|
+
"id": "service_global_header_notifications_list",
|
|
23507
|
+
"onEvent": {
|
|
23508
|
+
"@data.changed.notifications": {
|
|
23509
|
+
"actions": [
|
|
23510
|
+
{
|
|
23511
|
+
"actionType": "reload"
|
|
23512
|
+
}
|
|
23513
|
+
]
|
|
23514
|
+
}
|
|
23515
|
+
},
|
|
23516
|
+
"messages": {},
|
|
23517
|
+
"api": {
|
|
23518
|
+
"method": "post",
|
|
23519
|
+
"url": "${context.rootUrl}/graphql",
|
|
23520
|
+
"data": {
|
|
23521
|
+
"&": "$$",
|
|
23522
|
+
"context": "${context}",
|
|
23523
|
+
"userId": "${context.userId}"
|
|
23524
|
+
},
|
|
23525
|
+
"dataType": "json",
|
|
23526
|
+
"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}",
|
|
23527
|
+
"headers": {
|
|
23528
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23529
|
+
},
|
|
23530
|
+
"adaptor": "return payload.data"
|
|
23531
|
+
},
|
|
23532
|
+
}
|
|
23533
|
+
],
|
|
23534
|
+
"onEvent": {
|
|
23535
|
+
"init": {
|
|
23536
|
+
"actions": [
|
|
23537
|
+
{
|
|
23538
|
+
"actionType": "custom",
|
|
23539
|
+
"script": "window.$('.service-global-header-notifications-list').closest('.amis-dialog-widget').addClass('steedos-header-toolbar-notifications-dialog');"
|
|
23540
|
+
}
|
|
23541
|
+
]
|
|
23542
|
+
}
|
|
23543
|
+
},
|
|
23544
|
+
"bodyClassName": "p-0"
|
|
23545
|
+
};
|
|
23546
|
+
var badgeButtonContent = {
|
|
23547
|
+
"type": "service",
|
|
23548
|
+
"body": [
|
|
23549
|
+
{
|
|
23550
|
+
"type": "steedos-badge",
|
|
23551
|
+
"body": [
|
|
23552
|
+
{
|
|
23553
|
+
"type": "steedos-icon",
|
|
23554
|
+
"category": "utility",
|
|
23555
|
+
"name": "notification",
|
|
23556
|
+
"colorVariant": "default",
|
|
23557
|
+
"className": "slds-button_icon slds-global-header__icon"
|
|
23558
|
+
}
|
|
23559
|
+
],
|
|
23560
|
+
"count": "${unReadCount}"
|
|
23561
|
+
},
|
|
23562
|
+
],
|
|
23563
|
+
"id": "service_global_header_notifications_unread_count",
|
|
23564
|
+
"messages": {},
|
|
23565
|
+
"api": {
|
|
23566
|
+
"method": "post",
|
|
23567
|
+
"url": "${context.rootUrl}/graphql",
|
|
23568
|
+
"data": {
|
|
23569
|
+
"&": "$$",
|
|
23570
|
+
"context": "${context}",
|
|
23571
|
+
"userId": "${context.userId}"
|
|
23572
|
+
},
|
|
23573
|
+
"dataType": "json",
|
|
23574
|
+
"requestAdaptor": "const { userId } = api.data;\napi.data = {\n query: `{\n unReadCount: notifications__count(filters: [[\"owner\",\"=\",\"${userId}\"], [\"is_read\", \"!=\", true]])\n }`\n}",
|
|
23575
|
+
"headers": {
|
|
23576
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23577
|
+
},
|
|
23578
|
+
"adaptor": "return payload.data"
|
|
23579
|
+
},
|
|
23580
|
+
"onEvent": {
|
|
23581
|
+
"@data.changed.notifications": {
|
|
23582
|
+
"actions": [
|
|
23583
|
+
{
|
|
23584
|
+
"actionType": "reload"
|
|
23585
|
+
}
|
|
23586
|
+
]
|
|
23587
|
+
}
|
|
23588
|
+
},
|
|
23589
|
+
// "interval": 30000,
|
|
23590
|
+
"silentPolling": true
|
|
23591
|
+
};
|
|
23592
|
+
return isMobile ? {
|
|
23593
|
+
"type": "button",
|
|
23594
|
+
"body": badgeButtonContent,
|
|
23595
|
+
"actionType": "dialog",
|
|
23596
|
+
"dialog": {
|
|
23597
|
+
"title": "",
|
|
23598
|
+
"id": "steedos_header_toolbar_notifications_dialog",
|
|
23599
|
+
"body": listContent,
|
|
23600
|
+
"actions": [],
|
|
23601
|
+
"showCloseButton": false,
|
|
23602
|
+
"closeOnOutside": true
|
|
23603
|
+
}
|
|
23604
|
+
} : {
|
|
23605
|
+
"type": "steedos-dropdown",
|
|
23606
|
+
"placement": "bottomRight",
|
|
23607
|
+
"trigger": [
|
|
23608
|
+
"click"
|
|
23609
|
+
],
|
|
23610
|
+
"body": [
|
|
23611
|
+
badgeButtonContent
|
|
23612
|
+
],
|
|
23613
|
+
"overlay": [
|
|
23614
|
+
listContent
|
|
23615
|
+
],
|
|
23616
|
+
"className": "antd-Action steedos-header-toolbar-notifications",
|
|
23617
|
+
"open": false
|
|
23618
|
+
};
|
|
23619
|
+
};
|
|
22708
23620
|
var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22709
23621
|
var _a, className, data, _b, logoutScript, _c, customButtons, avatarSrc;
|
|
22710
23622
|
var _d, _e;
|
|
@@ -22730,7 +23642,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
22730
23642
|
{
|
|
22731
23643
|
"componentId": "",
|
|
22732
23644
|
"args": {
|
|
22733
|
-
"url": "https://
|
|
23645
|
+
"url": "https://docs.steedos.com/zh-CN"
|
|
22734
23646
|
},
|
|
22735
23647
|
"actionType": "url"
|
|
22736
23648
|
}
|
|
@@ -22856,172 +23768,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
22856
23768
|
}
|
|
22857
23769
|
]
|
|
22858
23770
|
},
|
|
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
|
-
},
|
|
23771
|
+
getNotificationBadgeButton(),
|
|
23025
23772
|
{
|
|
23026
23773
|
"type": "steedos-dropdown",
|
|
23027
23774
|
"placement": "bottomRight",
|
|
@@ -23196,7 +23943,7 @@ var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23196
23943
|
body: [
|
|
23197
23944
|
{
|
|
23198
23945
|
"type": "wrapper",
|
|
23199
|
-
"className": "bg-white sticky p-0 top-0 z-40 w-full flex-none backdrop-blur transition-colors duration-500 lg:z-
|
|
23946
|
+
"className": "bg-white sticky p-0 top-0 z-40 w-full flex-none backdrop-blur transition-colors duration-500 lg:z-[1000] border-b-[3px] border-sky-500 border-solid steedos-header-container sm:shadow",
|
|
23200
23947
|
body: [
|
|
23201
23948
|
{
|
|
23202
23949
|
"type": "wrapper",
|
|
@@ -23432,51 +24179,67 @@ function getAmisStaticFieldType(type, data_type, options) {
|
|
|
23432
24179
|
}
|
|
23433
24180
|
return type;
|
|
23434
24181
|
}
|
|
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
|
-
}
|
|
24182
|
+
function getLookupLinkOnClick(field, options) {
|
|
24183
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
24184
|
+
var recordPage, drawerRecordDetailSchema;
|
|
24185
|
+
return __generator(this, function (_a) {
|
|
24186
|
+
switch (_a.label) {
|
|
24187
|
+
case 0: return [4 /*yield*/, getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor })];
|
|
24188
|
+
case 1:
|
|
24189
|
+
recordPage = _a.sent();
|
|
24190
|
+
drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
|
|
24191
|
+
"recordId": "${value}",
|
|
24192
|
+
"data": __assign$2(__assign$2({}, recordPage.schema.data), { "_inDrawer": true, "recordLoaded": false })
|
|
24193
|
+
}) : {
|
|
24194
|
+
"type": "steedos-record-detail",
|
|
24195
|
+
"objectApiName": "${objectName}",
|
|
24196
|
+
"recordId": "${value}",
|
|
24197
|
+
"showBackButton": false,
|
|
24198
|
+
"showButtons": true,
|
|
24199
|
+
"data": {
|
|
24200
|
+
"_inDrawer": true,
|
|
24201
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
23461
24202
|
}
|
|
23462
|
-
|
|
23463
|
-
|
|
23464
|
-
|
|
23465
|
-
|
|
23466
|
-
|
|
24203
|
+
};
|
|
24204
|
+
return [2 /*return*/, {
|
|
24205
|
+
"click": {
|
|
24206
|
+
"actions": [
|
|
24207
|
+
{
|
|
24208
|
+
"actionType": "drawer",
|
|
24209
|
+
"drawer": {
|
|
24210
|
+
"type": "drawer",
|
|
24211
|
+
"title": " ",
|
|
24212
|
+
"headerClassName": "hidden",
|
|
24213
|
+
"size": "lg",
|
|
24214
|
+
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
24215
|
+
"closeOnEsc": true,
|
|
24216
|
+
"closeOnOutside": true,
|
|
24217
|
+
"resizable": true,
|
|
24218
|
+
"actions": [],
|
|
24219
|
+
"body": [
|
|
24220
|
+
drawerRecordDetailSchema
|
|
24221
|
+
],
|
|
24222
|
+
"className": "steedos-record-detail-drawer app-popover"
|
|
24223
|
+
},
|
|
24224
|
+
"preventDefault": true
|
|
24225
|
+
}
|
|
24226
|
+
]
|
|
24227
|
+
}
|
|
24228
|
+
}];
|
|
23467
24229
|
}
|
|
23468
|
-
|
|
23469
|
-
}
|
|
23470
|
-
}
|
|
24230
|
+
});
|
|
24231
|
+
});
|
|
24232
|
+
}
|
|
23471
24233
|
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 (
|
|
24234
|
+
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;
|
|
24235
|
+
var _p, _q, _r, _s, _t, _u, _v, _w, _x, e_1, _y;
|
|
24236
|
+
var _z, _0, _1, _2, _3, _4;
|
|
24237
|
+
return __generator(this, function (_5) {
|
|
24238
|
+
switch (_5.label) {
|
|
23477
24239
|
case 0:
|
|
23478
24240
|
steedosField = null;
|
|
23479
24241
|
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;
|
|
24242
|
+
_c = props.data || {}, appId = _c.appId, formFactor = _c.formFactor;
|
|
23480
24243
|
// console.log(`AmisSteedosField`, props)
|
|
23481
24244
|
// if($schema.config && isString($schema.config)){
|
|
23482
24245
|
// $schema.config = JSON.parse($schema.config)
|
|
@@ -23504,10 +24267,10 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23504
24267
|
// 字段配置为只读,强制走fStatic模式,加上_display判断是为了不影响历史代码,比如直接在ObjectForm中调用steedos-field组件
|
|
23505
24268
|
fStatic = true;
|
|
23506
24269
|
}
|
|
23507
|
-
|
|
24270
|
+
_5.label = 1;
|
|
23508
24271
|
case 1:
|
|
23509
|
-
|
|
23510
|
-
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/,
|
|
24272
|
+
_5.trys.push([1, 31, , 32]);
|
|
24273
|
+
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/, 14];
|
|
23511
24274
|
lookupATagClick = 'onclick="return false;"';
|
|
23512
24275
|
if (window.innerWidth < 768) {
|
|
23513
24276
|
lookupATagClick = "";
|
|
@@ -23532,23 +24295,23 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23532
24295
|
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
24296
|
}
|
|
23534
24297
|
}
|
|
23535
|
-
source = ((
|
|
24298
|
+
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
24299
|
fieldBaseProps = {
|
|
23537
24300
|
multiple: steedosField.multiple,
|
|
23538
24301
|
name: steedosField.name,
|
|
23539
24302
|
label: steedosField.label,
|
|
23540
24303
|
static: true,
|
|
23541
24304
|
required: steedosField.required,
|
|
23542
|
-
className: "".concat(className || '', " ").concat(((
|
|
24305
|
+
className: "".concat(className || '', " ").concat(((_1 = steedosField.amis) === null || _1 === void 0 ? void 0 : _1.className) || '')
|
|
23543
24306
|
};
|
|
23544
24307
|
if (!inInputTable) return [3 /*break*/, 2];
|
|
23545
24308
|
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'select', source: source });
|
|
23546
|
-
return [3 /*break*/,
|
|
24309
|
+
return [3 /*break*/, 13];
|
|
23547
24310
|
case 2:
|
|
23548
24311
|
referenceTo_1 = steedosField.reference_to;
|
|
23549
|
-
if (!referenceTo_1) return [3 /*break*/,
|
|
24312
|
+
if (!referenceTo_1) return [3 /*break*/, 13];
|
|
23550
24313
|
if (isArray(referenceTo_1)) {
|
|
23551
|
-
fieldValue = (
|
|
24314
|
+
fieldValue = (_2 = props.data) === null || _2 === void 0 ? void 0 : _2[steedosField.name];
|
|
23552
24315
|
if (fieldValue && fieldValue.o) {
|
|
23553
24316
|
referenceTo_1 = fieldValue.o;
|
|
23554
24317
|
}
|
|
@@ -23562,157 +24325,195 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23562
24325
|
}
|
|
23563
24326
|
return [4 /*yield*/, getUISchema(referenceTo_1)];
|
|
23564
24327
|
case 3:
|
|
23565
|
-
fieldRefObject =
|
|
23566
|
-
if (!(props.data._display && has(props.data._display, steedosField.name))) return [3 /*break*/,
|
|
23567
|
-
|
|
24328
|
+
fieldRefObject = _5.sent();
|
|
24329
|
+
if (!(props.data._display && has(props.data._display, steedosField.name))) return [3 /*break*/, 7];
|
|
24330
|
+
_e = (_d = Object).assign;
|
|
24331
|
+
_f = [{}, fieldBaseProps];
|
|
24332
|
+
_p = {
|
|
23568
24333
|
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
|
-
]
|
|
24334
|
+
name: null
|
|
24335
|
+
};
|
|
24336
|
+
_q = {
|
|
24337
|
+
type: 'wrapper',
|
|
24338
|
+
className: "steedos-field-lookup-wrapper p-0",
|
|
24339
|
+
"wrapWithPanel": false,
|
|
24340
|
+
"actions": [],
|
|
24341
|
+
visibleOn: "${_display.".concat(steedosField.name, "}")
|
|
24342
|
+
};
|
|
24343
|
+
_r = {
|
|
24344
|
+
type: 'each',
|
|
24345
|
+
placeholder: "",
|
|
24346
|
+
className: "steedos-field-lookup-each flex flex-wrap gap-2",
|
|
24347
|
+
source: "${_display.".concat(steedosField.name, "|asArray}")
|
|
24348
|
+
};
|
|
24349
|
+
_s = {
|
|
24350
|
+
type: 'static',
|
|
24351
|
+
labelClassName: "hidden",
|
|
24352
|
+
label: false,
|
|
24353
|
+
className: 'm-0',
|
|
24354
|
+
tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\" ".concat(lookupATagClick, ">${label}</a>"),
|
|
24355
|
+
popOver: fieldRefObject.compactLayouts && window.innerWidth >= 768 ? {
|
|
24356
|
+
"trigger": "hover",
|
|
24357
|
+
"className": "steedos-record-detail-popover",
|
|
24358
|
+
"position": "left-bottom",
|
|
24359
|
+
"showIcon": false,
|
|
24360
|
+
"title": false,
|
|
24361
|
+
"offset": {
|
|
24362
|
+
"top": 0,
|
|
24363
|
+
"left": 20
|
|
23616
24364
|
},
|
|
23617
|
-
|
|
24365
|
+
"body": [
|
|
24366
|
+
{
|
|
24367
|
+
"type": "steedos-record-mini",
|
|
24368
|
+
"objectApiName": "${objectName}",
|
|
24369
|
+
"recordId": "${value}",
|
|
24370
|
+
"showButtons": false,
|
|
24371
|
+
"showBackButton": false,
|
|
24372
|
+
"data": {
|
|
24373
|
+
"objectName": "${objectName}",
|
|
24374
|
+
"recordId": "${value}",
|
|
24375
|
+
}
|
|
24376
|
+
}
|
|
24377
|
+
]
|
|
24378
|
+
} : null
|
|
24379
|
+
};
|
|
24380
|
+
if (!(window.innerWidth < 768)) return [3 /*break*/, 4];
|
|
24381
|
+
_g = null;
|
|
24382
|
+
return [3 /*break*/, 6];
|
|
24383
|
+
case 4: return [4 /*yield*/, getLookupLinkOnClick(steedosField, {
|
|
24384
|
+
appId: appId,
|
|
24385
|
+
objectName: referenceTo_1,
|
|
24386
|
+
formFactor: formFactor
|
|
24387
|
+
})];
|
|
24388
|
+
case 5:
|
|
24389
|
+
_g = _5.sent();
|
|
24390
|
+
_5.label = 6;
|
|
24391
|
+
case 6:
|
|
24392
|
+
fieldBaseProps = _e.apply(_d, _f.concat([(_p.body = [(_q.body = [
|
|
24393
|
+
(_r.items = (
|
|
24394
|
+
// onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
|
|
24395
|
+
_s.onEvent = _g,
|
|
24396
|
+
_s),
|
|
24397
|
+
_r)
|
|
24398
|
+
],
|
|
24399
|
+
_q), {
|
|
23618
24400
|
type: 'static',
|
|
23619
24401
|
tpl: '-',
|
|
23620
|
-
className: "".concat(fieldBaseProps.className || '', " text-muted"),
|
|
24402
|
+
className: "".concat(fieldBaseProps.className || '', " text-muted !border-b-0"),
|
|
23621
24403
|
hiddenOn: "${_display.".concat(steedosField.name, "}"),
|
|
23622
|
-
}]
|
|
23623
|
-
|
|
23624
|
-
return [3 /*break*/,
|
|
23625
|
-
case
|
|
23626
|
-
case
|
|
23627
|
-
res =
|
|
23628
|
-
valueOptions_1 = ((
|
|
23629
|
-
fieldValue = (
|
|
24404
|
+
}],
|
|
24405
|
+
_p)]));
|
|
24406
|
+
return [3 /*break*/, 13];
|
|
24407
|
+
case 7: return [4 /*yield*/, env.fetcher(source, props.data)];
|
|
24408
|
+
case 8:
|
|
24409
|
+
res = _5.sent();
|
|
24410
|
+
valueOptions_1 = ((_3 = res === null || res === void 0 ? void 0 : res.data) === null || _3 === void 0 ? void 0 : _3.options) || [];
|
|
24411
|
+
fieldValue = (_4 = props.data) === null || _4 === void 0 ? void 0 : _4[steedosField.name];
|
|
23630
24412
|
values = fieldValue;
|
|
23631
24413
|
if (isString(values)) {
|
|
23632
24414
|
values = [values];
|
|
23633
24415
|
}
|
|
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
|
-
}
|
|
24416
|
+
if (!(values && values.length > 0)) return [3 /*break*/, 12];
|
|
24417
|
+
disPlayValue_1 = [];
|
|
24418
|
+
each(values, function (value) {
|
|
24419
|
+
var option = valueOptions_1.find(function (item) { return item.value === value; });
|
|
24420
|
+
if (option) {
|
|
24421
|
+
disPlayValue_1.push({
|
|
24422
|
+
objectName: referenceTo_1,
|
|
24423
|
+
value: option._id || option.value,
|
|
24424
|
+
label: option.label
|
|
24425
|
+
});
|
|
24426
|
+
}
|
|
24427
|
+
});
|
|
24428
|
+
_j = (_h = Object).assign;
|
|
24429
|
+
_k = [{}, fieldBaseProps];
|
|
24430
|
+
_t = { type: 'control', name: null };
|
|
24431
|
+
_u = {
|
|
24432
|
+
type: 'form',
|
|
24433
|
+
className: "steedos-field-lookup-wrapper p-0",
|
|
24434
|
+
"wrapWithPanel": false,
|
|
24435
|
+
"actions": [],
|
|
24436
|
+
data: (_v = {},
|
|
24437
|
+
_v[steedosField.name] = disPlayValue_1,
|
|
24438
|
+
_v)
|
|
24439
|
+
};
|
|
24440
|
+
_w = {
|
|
24441
|
+
type: 'each',
|
|
24442
|
+
placeholder: "",
|
|
24443
|
+
className: "steedos-field-lookup-each flex flex-wrap gap-2",
|
|
24444
|
+
source: "${".concat(steedosField.name, "}")
|
|
24445
|
+
};
|
|
24446
|
+
_x = {
|
|
24447
|
+
type: 'static',
|
|
24448
|
+
className: 'm-0',
|
|
24449
|
+
tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\" ".concat(lookupATagClick, ">${label}</a>"),
|
|
24450
|
+
popOver: fieldRefObject.compactLayouts && window.innerWidth >= 768 ? {
|
|
24451
|
+
"trigger": "hover",
|
|
24452
|
+
"className": "steedos-record-detail-popover",
|
|
24453
|
+
"position": "left-bottom",
|
|
24454
|
+
"showIcon": false,
|
|
24455
|
+
"title": false,
|
|
24456
|
+
"offset": {
|
|
24457
|
+
"top": 0,
|
|
24458
|
+
"left": 20
|
|
24459
|
+
},
|
|
24460
|
+
"body": [
|
|
24461
|
+
{
|
|
24462
|
+
"type": "steedos-record-mini",
|
|
24463
|
+
"objectApiName": "${objectName}",
|
|
24464
|
+
"recordId": "${value}",
|
|
24465
|
+
"showButtons": false,
|
|
24466
|
+
"showBackButton": false,
|
|
24467
|
+
"data": {
|
|
24468
|
+
"objectName": "${objectName}",
|
|
24469
|
+
"recordId": "${value}",
|
|
23690
24470
|
}
|
|
23691
|
-
|
|
23692
|
-
|
|
23693
|
-
|
|
23694
|
-
|
|
23695
|
-
|
|
23696
|
-
|
|
23697
|
-
|
|
23698
|
-
case
|
|
24471
|
+
}
|
|
24472
|
+
]
|
|
24473
|
+
} : null
|
|
24474
|
+
};
|
|
24475
|
+
if (!(window.innerWidth < 768)) return [3 /*break*/, 9];
|
|
24476
|
+
_l = null;
|
|
24477
|
+
return [3 /*break*/, 11];
|
|
24478
|
+
case 9: return [4 /*yield*/, getLookupLinkOnClick(steedosField, {
|
|
24479
|
+
appId: appId,
|
|
24480
|
+
objectName: referenceTo_1,
|
|
24481
|
+
formFactor: formFactor
|
|
24482
|
+
})];
|
|
24483
|
+
case 10:
|
|
24484
|
+
_l = _5.sent();
|
|
24485
|
+
_5.label = 11;
|
|
24486
|
+
case 11:
|
|
24487
|
+
fieldBaseProps = _j.apply(_h, _k.concat([(_t.body = (_u.body = [
|
|
24488
|
+
(_w.items = (
|
|
24489
|
+
// onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
|
|
24490
|
+
_x.onEvent = _l,
|
|
24491
|
+
_x),
|
|
24492
|
+
_w)
|
|
24493
|
+
],
|
|
24494
|
+
_u), _t)]));
|
|
24495
|
+
return [3 /*break*/, 13];
|
|
24496
|
+
case 12:
|
|
24497
|
+
fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'static', tpl: '-', className: "".concat(fieldBaseProps.className || '', " text-muted") });
|
|
24498
|
+
_5.label = 13;
|
|
24499
|
+
case 13:
|
|
23699
24500
|
schema = Object.assign({}, fieldBaseProps, pick(steedosField.amis || {}, ['className', 'inline', 'label', 'labelAlign', 'name', 'labelRemark', 'description', 'placeholder', 'staticClassName', 'staticLabelClassName', 'staticInputClassName', 'staticSchema']));
|
|
23700
24501
|
schema.placeholder = "";
|
|
23701
24502
|
// console.log(`steedos field [lookup] schema:`, schema)
|
|
23702
24503
|
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 =
|
|
24504
|
+
case 14:
|
|
24505
|
+
if (!fStatic) return [3 /*break*/, 28];
|
|
24506
|
+
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/, 16];
|
|
24507
|
+
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, true, ctx)];
|
|
24508
|
+
case 15:
|
|
24509
|
+
fieldSchema = _5.sent();
|
|
23709
24510
|
if (steedosField.type === 'file' && fieldSchema.disabled) {
|
|
23710
24511
|
fieldValue = fieldSchema.value;
|
|
23711
24512
|
if (fieldValue && fieldValue.length) {
|
|
23712
24513
|
hasImageOrFile_1 = false;
|
|
23713
24514
|
forEach(fieldValue, function (item) {
|
|
23714
24515
|
var fileName = item.name;
|
|
23715
|
-
if ([".pdf", ".jpg", ".jpeg", ".png", ".gif"].indexOf(fileName.slice(-4)) > -1) {
|
|
24516
|
+
if ([".pdf", ".jpg", ".jpeg", ".png", ".gif"].indexOf(fileName.toLowerCase().slice(-4)) > -1) {
|
|
23716
24517
|
hasImageOrFile_1 = true;
|
|
23717
24518
|
}
|
|
23718
24519
|
});
|
|
@@ -23724,7 +24525,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23724
24525
|
var fileName = item.name;
|
|
23725
24526
|
var fileUrl = item.url;
|
|
23726
24527
|
var filePreviewHtml = '';
|
|
23727
|
-
if ([".pdf", ".jpg", ".jpeg", ".png", ".gif"].indexOf(fileName.slice(-4)) > -1) {
|
|
24528
|
+
if ([".pdf", ".jpg", ".jpeg", ".png", ".gif"].indexOf(fileName.toLowerCase().slice(-4)) > -1) {
|
|
23728
24529
|
var indexOfQuestionMark = fileUrl.indexOf('?');
|
|
23729
24530
|
if (indexOfQuestionMark > -1) {
|
|
23730
24531
|
var filePreviewUrl = fileUrl.substring(0, indexOfQuestionMark);
|
|
@@ -23741,60 +24542,60 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23741
24542
|
}
|
|
23742
24543
|
}
|
|
23743
24544
|
return [2 /*return*/, fieldSchema];
|
|
23744
|
-
case
|
|
24545
|
+
case 16:
|
|
23745
24546
|
schema = Object.assign({}, steedosField, {
|
|
23746
24547
|
type: getAmisStaticFieldType(steedosField.type, steedosField.data_type, steedosField),
|
|
23747
24548
|
static: true,
|
|
23748
24549
|
label: steedosField.label
|
|
23749
24550
|
});
|
|
23750
|
-
if (!(steedosField.type === "time" || steedosField.type === "input-time-range")) return [3 /*break*/,
|
|
24551
|
+
if (!(steedosField.type === "time" || steedosField.type === "input-time-range")) return [3 /*break*/, 17];
|
|
23751
24552
|
Object.assign(schema, {
|
|
23752
24553
|
inputFormat: 'HH:mm',
|
|
23753
24554
|
timeFormat: 'HH:mm',
|
|
23754
24555
|
format: '1970-01-01THH:mm:00.000[Z]',
|
|
23755
24556
|
});
|
|
23756
|
-
return [3 /*break*/,
|
|
23757
|
-
case
|
|
23758
|
-
if (!(steedosField.type === "percent")) return [3 /*break*/,
|
|
24557
|
+
return [3 /*break*/, 27];
|
|
24558
|
+
case 17:
|
|
24559
|
+
if (!(steedosField.type === "percent")) return [3 /*break*/, 18];
|
|
23759
24560
|
Object.assign(schema, {
|
|
23760
24561
|
"percent": steedosField.scale ? steedosField.scale : true
|
|
23761
24562
|
});
|
|
23762
|
-
return [3 /*break*/,
|
|
23763
|
-
case
|
|
23764
|
-
if (!(steedosField.type === "password")) return [3 /*break*/,
|
|
24563
|
+
return [3 /*break*/, 27];
|
|
24564
|
+
case 18:
|
|
24565
|
+
if (!(steedosField.type === "password")) return [3 /*break*/, 19];
|
|
23765
24566
|
Object.assign(schema, {
|
|
23766
24567
|
"tpl": "******"
|
|
23767
24568
|
});
|
|
23768
|
-
return [3 /*break*/,
|
|
23769
|
-
case
|
|
23770
|
-
if (!(steedosField.type === "select")) return [3 /*break*/,
|
|
24569
|
+
return [3 /*break*/, 27];
|
|
24570
|
+
case 19:
|
|
24571
|
+
if (!(steedosField.type === "select")) return [3 /*break*/, 20];
|
|
23771
24572
|
map = getSelectMap(steedosField.options);
|
|
23772
24573
|
Object.assign(schema, {
|
|
23773
24574
|
"placeholder": "",
|
|
23774
24575
|
"map": map
|
|
23775
24576
|
});
|
|
23776
|
-
return [3 /*break*/,
|
|
23777
|
-
case
|
|
23778
|
-
if (!(steedosField.type === "color")) return [3 /*break*/,
|
|
24577
|
+
return [3 /*break*/, 27];
|
|
24578
|
+
case 20:
|
|
24579
|
+
if (!(steedosField.type === "color")) return [3 /*break*/, 21];
|
|
23779
24580
|
Object.assign(schema, {
|
|
23780
24581
|
"defaultColor": null
|
|
23781
24582
|
});
|
|
23782
|
-
return [3 /*break*/,
|
|
23783
|
-
case
|
|
23784
|
-
if (!(steedosField.type === "number" || steedosField.type === 'currency')) return [3 /*break*/,
|
|
24583
|
+
return [3 /*break*/, 27];
|
|
24584
|
+
case 21:
|
|
24585
|
+
if (!(steedosField.type === "number" || steedosField.type === 'currency')) return [3 /*break*/, 22];
|
|
23785
24586
|
// amis input-number和number组件中的precision表示小数位数,并不是魔方平台的精度概念,要转换下,否则小数点后会显示很多的0
|
|
23786
24587
|
Object.assign(schema, {
|
|
23787
24588
|
"precision": steedosField.scale || 0,
|
|
23788
24589
|
"kilobitSeparator": steedosField.enable_thousands //识别enable_thousands,控制千分位分隔符
|
|
23789
24590
|
});
|
|
23790
|
-
return [3 /*break*/,
|
|
23791
|
-
case
|
|
23792
|
-
if (!(steedosField.type === "table")) return [3 /*break*/,
|
|
24591
|
+
return [3 /*break*/, 27];
|
|
24592
|
+
case 22:
|
|
24593
|
+
if (!(steedosField.type === "table")) return [3 /*break*/, 23];
|
|
23793
24594
|
if (steedosField.subFields) {
|
|
23794
24595
|
tableFields = [];
|
|
23795
24596
|
try {
|
|
23796
|
-
for (
|
|
23797
|
-
subField =
|
|
24597
|
+
for (_m = __values(steedosField.subFields), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
24598
|
+
subField = _o.value;
|
|
23798
24599
|
if (!subField.name.endsWith(".$")) {
|
|
23799
24600
|
subFieldName = subField.name.replace("".concat(steedosField._prefix || '').concat(steedosField.name, ".$."), '').replace("".concat(steedosField.name, "."), '');
|
|
23800
24601
|
// const gridSub = await convertSFieldToAmisField(Object.assign({}, subField, {name: subFieldName, isTableField: true}), readonly, ctx);
|
|
@@ -23805,7 +24606,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23805
24606
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
23806
24607
|
finally {
|
|
23807
24608
|
try {
|
|
23808
|
-
if (
|
|
24609
|
+
if (_o && !_o.done && (_y = _m.return)) _y.call(_m);
|
|
23809
24610
|
}
|
|
23810
24611
|
finally { if (e_1) throw e_1.error; }
|
|
23811
24612
|
}
|
|
@@ -23821,9 +24622,9 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23821
24622
|
}
|
|
23822
24623
|
});
|
|
23823
24624
|
}
|
|
23824
|
-
return [3 /*break*/,
|
|
23825
|
-
case
|
|
23826
|
-
if (!(steedosField.type === "image")) return [3 /*break*/,
|
|
24625
|
+
return [3 /*break*/, 27];
|
|
24626
|
+
case 23:
|
|
24627
|
+
if (!(steedosField.type === "image")) return [3 /*break*/, 24];
|
|
23827
24628
|
Object.assign(schema, {
|
|
23828
24629
|
enlargeAble: true,
|
|
23829
24630
|
showToolbar: true,
|
|
@@ -23854,15 +24655,15 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23854
24655
|
return value;
|
|
23855
24656
|
}
|
|
23856
24657
|
});
|
|
23857
|
-
return [3 /*break*/,
|
|
23858
|
-
case
|
|
23859
|
-
if (!(steedosField.type === "file")) return [3 /*break*/,
|
|
23860
|
-
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField,
|
|
23861
|
-
case
|
|
24658
|
+
return [3 /*break*/, 27];
|
|
24659
|
+
case 24:
|
|
24660
|
+
if (!(steedosField.type === "file")) return [3 /*break*/, 26];
|
|
24661
|
+
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, true, ctx)];
|
|
24662
|
+
case 25:
|
|
23862
24663
|
// 附件static模式先保持原来的逻辑,依赖_display,审批王中相关功能在creator中
|
|
23863
24664
|
// convertSFieldToAmisField中会合并steedosField.amis,所以也不需要再次合并steedosField.amis,直接return就好
|
|
23864
|
-
return [2 /*return*/,
|
|
23865
|
-
case
|
|
24665
|
+
return [2 /*return*/, _5.sent()];
|
|
24666
|
+
case 26:
|
|
23866
24667
|
if (steedosField.type === 'formula' || steedosField.type === 'summary') {
|
|
23867
24668
|
if (steedosField.data_type === 'number' || steedosField.data_type === 'currency') {
|
|
23868
24669
|
Object.assign(schema, {
|
|
@@ -23923,11 +24724,11 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23923
24724
|
disabled: true
|
|
23924
24725
|
});
|
|
23925
24726
|
}
|
|
23926
|
-
|
|
23927
|
-
case
|
|
24727
|
+
_5.label = 27;
|
|
24728
|
+
case 27:
|
|
23928
24729
|
Object.assign(schema, steedosField.amis || {});
|
|
23929
24730
|
return [2 /*return*/, schema];
|
|
23930
|
-
case
|
|
24731
|
+
case 28:
|
|
23931
24732
|
if (!ctx.className) {
|
|
23932
24733
|
ctx.className = className;
|
|
23933
24734
|
}
|
|
@@ -23988,16 +24789,16 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
23988
24789
|
}
|
|
23989
24790
|
}
|
|
23990
24791
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
23991
|
-
case
|
|
23992
|
-
schema =
|
|
24792
|
+
case 29:
|
|
24793
|
+
schema = _5.sent();
|
|
23993
24794
|
// console.log(`AmisSteedosField return schema`, schema)
|
|
23994
24795
|
return [2 /*return*/, schema];
|
|
23995
|
-
case
|
|
23996
|
-
case
|
|
23997
|
-
error_1 =
|
|
24796
|
+
case 30: return [3 /*break*/, 32];
|
|
24797
|
+
case 31:
|
|
24798
|
+
error_1 = _5.sent();
|
|
23998
24799
|
console.log("error", error_1);
|
|
23999
|
-
return [3 /*break*/,
|
|
24000
|
-
case
|
|
24800
|
+
return [3 /*break*/, 32];
|
|
24801
|
+
case 32: return [2 /*return*/, null];
|
|
24001
24802
|
}
|
|
24002
24803
|
});
|
|
24003
24804
|
}); };
|
|
@@ -24240,7 +25041,7 @@ var AmisInputTable = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
24240
25041
|
return __generator(this, function (_a) {
|
|
24241
25042
|
switch (_a.label) {
|
|
24242
25043
|
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;
|
|
25044
|
+
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
25045
|
extendProps = {};
|
|
24245
25046
|
if (props.disabledOn || props.disabled) {
|
|
24246
25047
|
extendProps["addable"] = false;
|
|
@@ -24501,7 +25302,7 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
24501
25302
|
});
|
|
24502
25303
|
}); };
|
|
24503
25304
|
|
|
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);
|
|
25305
|
+
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
25306
|
|
|
24506
25307
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
24507
25308
|
__proto__: null,
|