@steedos-widgets/amis-object 1.3.0-beta.9 → 1.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-object.cjs.css +128 -17
- package/dist/amis-object.cjs.js +678 -699
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +128 -17
- package/dist/amis-object.esm.js +560 -581
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +128 -17
- package/dist/amis-object.umd.js +188 -156
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +16 -16
- package/package.json +3 -3
package/dist/amis-object.cjs.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var
|
|
6
|
+
var _$1 = require('lodash');
|
|
7
7
|
var antd = require('antd');
|
|
8
8
|
var ReactDOM = require('react-dom');
|
|
9
9
|
|
|
@@ -28,8 +28,8 @@ function _interopNamespace(e) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
31
|
-
var
|
|
32
|
-
var
|
|
31
|
+
var _$1__namespace = /*#__PURE__*/_interopNamespace(_$1);
|
|
32
|
+
var _$1__default = /*#__PURE__*/_interopDefaultLegacy(_$1);
|
|
33
33
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
34
34
|
|
|
35
35
|
/******************************************************************************
|
|
@@ -3281,7 +3281,7 @@ const getEvn = (router)=>{
|
|
|
3281
3281
|
};
|
|
3282
3282
|
|
|
3283
3283
|
const registerRenders = (assets)=>{
|
|
3284
|
-
if(!
|
|
3284
|
+
if(!_$1.isEmpty(assets) && _$1.isArray(assets)){
|
|
3285
3285
|
let amisLib = amisRequire('amis');
|
|
3286
3286
|
|
|
3287
3287
|
const registerMap = {
|
|
@@ -3291,9 +3291,9 @@ const registerRenders = (assets)=>{
|
|
|
3291
3291
|
};
|
|
3292
3292
|
|
|
3293
3293
|
let amisReact = amisRequire('react');
|
|
3294
|
-
|
|
3294
|
+
_$1.each(assets, (asset)=>{
|
|
3295
3295
|
// 防止组件重复注册
|
|
3296
|
-
if(!
|
|
3296
|
+
if(!_$1.find(RegisterRenders, (componentName)=>{ return componentName === asset.componentName})){
|
|
3297
3297
|
let Component = Builder.components.find(item => item.name === asset.componentName);
|
|
3298
3298
|
let AmisWrapper = Component.class;
|
|
3299
3299
|
if(asset.componentType === 'amisSchema'){
|
|
@@ -3483,7 +3483,7 @@ function getRootUrl(defaultRootUrl){
|
|
|
3483
3483
|
}
|
|
3484
3484
|
|
|
3485
3485
|
function setRootUrl(rootUrl){
|
|
3486
|
-
if(
|
|
3486
|
+
if(_$1.endsWith(rootUrl, '/')){
|
|
3487
3487
|
rootUrl = rootUrl.substring(0, rootUrl.length-1);
|
|
3488
3488
|
}
|
|
3489
3489
|
localStorage.setItem("steedos:rootUrl", rootUrl);
|
|
@@ -3498,7 +3498,7 @@ const getSteedosAuth = () => {
|
|
|
3498
3498
|
// name: Meteor.user().name //TODO: 使用steedos 函数. 此属性在上传附件时使用
|
|
3499
3499
|
// }
|
|
3500
3500
|
// }
|
|
3501
|
-
return Object.assign( {},
|
|
3501
|
+
return Object.assign( {}, _$1.cloneDeep(STEEDOS_AUTH) || {}, getBuilderContext$1() || {});
|
|
3502
3502
|
};
|
|
3503
3503
|
|
|
3504
3504
|
/*
|
|
@@ -3551,8 +3551,8 @@ const Router$1 = {
|
|
|
3551
3551
|
/*
|
|
3552
3552
|
* @Author: baozhoutao@steedos.com
|
|
3553
3553
|
* @Date: 2022-07-20 16:29:22
|
|
3554
|
-
* @LastEditors:
|
|
3555
|
-
* @LastEditTime: 2023-
|
|
3554
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
3555
|
+
* @LastEditTime: 2023-09-08 14:09:48
|
|
3556
3556
|
* @Description:
|
|
3557
3557
|
*/
|
|
3558
3558
|
|
|
@@ -3565,11 +3565,40 @@ function getContrastColor(bgColor) {
|
|
|
3565
3565
|
return brightness < 128 ? "#ffffff" : "#000000";
|
|
3566
3566
|
}
|
|
3567
3567
|
|
|
3568
|
+
function getLookupListView(refObjectConfig) {
|
|
3569
|
+
if(!refObjectConfig){
|
|
3570
|
+
return null;
|
|
3571
|
+
}
|
|
3572
|
+
const listNameAll = "all";
|
|
3573
|
+
const listNameLookup = "lookup";
|
|
3574
|
+
let listViewAll, listViewLookup;
|
|
3575
|
+
|
|
3576
|
+
_.each(
|
|
3577
|
+
refObjectConfig.list_views,
|
|
3578
|
+
(view, name) => {
|
|
3579
|
+
if (name === listNameAll) {
|
|
3580
|
+
listViewAll = view;
|
|
3581
|
+
if(!listViewAll.name){
|
|
3582
|
+
listViewAll.name = name;
|
|
3583
|
+
}
|
|
3584
|
+
}
|
|
3585
|
+
else if (name === listNameLookup) {
|
|
3586
|
+
listViewLookup = view;
|
|
3587
|
+
if(!listViewLookup.name){
|
|
3588
|
+
listViewLookup.name = name;
|
|
3589
|
+
}
|
|
3590
|
+
}
|
|
3591
|
+
}
|
|
3592
|
+
);
|
|
3593
|
+
let listView = listViewLookup || listViewAll;
|
|
3594
|
+
return listView;
|
|
3595
|
+
}
|
|
3596
|
+
|
|
3568
3597
|
/*
|
|
3569
3598
|
* @Author: baozhoutao@steedos.com
|
|
3570
3599
|
* @Date: 2022-05-23 09:53:08
|
|
3571
3600
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
3572
|
-
* @LastEditTime: 2023-08-
|
|
3601
|
+
* @LastEditTime: 2023-08-29 15:04:39
|
|
3573
3602
|
* @Description:
|
|
3574
3603
|
*/
|
|
3575
3604
|
|
|
@@ -3624,7 +3653,7 @@ function getSelectTpl(field){
|
|
|
3624
3653
|
}
|
|
3625
3654
|
function getSelectMap(selectOptions){
|
|
3626
3655
|
let map = {};
|
|
3627
|
-
|
|
3656
|
+
_$1.forEach(selectOptions,(option)=>{
|
|
3628
3657
|
const optionValue = option.value + '';
|
|
3629
3658
|
const optionColor = option.color + '';
|
|
3630
3659
|
if(optionColor){
|
|
@@ -3673,7 +3702,7 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
3673
3702
|
linkTarget = "target='_blank'";
|
|
3674
3703
|
}
|
|
3675
3704
|
|
|
3676
|
-
const
|
|
3705
|
+
const onlyDisplayLookLabel = ctx.onlyDisplayLookLabel;
|
|
3677
3706
|
|
|
3678
3707
|
let fieldDataStrTpl = `data._display.${field.name}`;
|
|
3679
3708
|
|
|
@@ -3684,7 +3713,7 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
3684
3713
|
if(_.isString(field.reference_to) || !field.reference_to){
|
|
3685
3714
|
if(field.multiple){
|
|
3686
3715
|
let labelTpl = `<%=item.label%>`;
|
|
3687
|
-
if(!
|
|
3716
|
+
if(!onlyDisplayLookLabel){
|
|
3688
3717
|
const href = Router$1.getObjectDetailPath({
|
|
3689
3718
|
formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
|
|
3690
3719
|
});
|
|
@@ -3702,7 +3731,7 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
3702
3731
|
objectNameTpl = `\${${field.name}.objectName}`;
|
|
3703
3732
|
recordIdTpl = `\${${field.name}.value}`;
|
|
3704
3733
|
}
|
|
3705
|
-
if(!
|
|
3734
|
+
if(!onlyDisplayLookLabel){
|
|
3706
3735
|
const href = Router$1.getObjectDetailPath({
|
|
3707
3736
|
formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
|
|
3708
3737
|
});
|
|
@@ -3714,7 +3743,7 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
3714
3743
|
|
|
3715
3744
|
}else {
|
|
3716
3745
|
let labelTpl = `<%=item.label%>`;
|
|
3717
|
-
if(!
|
|
3746
|
+
if(!onlyDisplayLookLabel){
|
|
3718
3747
|
const href = Router$1.getObjectDetailPath({
|
|
3719
3748
|
formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
|
|
3720
3749
|
});
|
|
@@ -3767,7 +3796,7 @@ function getLocationTpl(field){
|
|
|
3767
3796
|
}
|
|
3768
3797
|
|
|
3769
3798
|
async function getFieldTpl (field, options){
|
|
3770
|
-
if((field.is_name || field.name === options.labelFieldName) && !options.
|
|
3799
|
+
if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLookLabel){
|
|
3771
3800
|
return getNameTpl(field, options)
|
|
3772
3801
|
}
|
|
3773
3802
|
switch (field.type) {
|
|
@@ -3811,10 +3840,10 @@ async function getFieldsTemplate(fields, display){
|
|
|
3811
3840
|
let fieldsName = ['_id'];
|
|
3812
3841
|
let displayFields = [];
|
|
3813
3842
|
let fieldsArr = [];
|
|
3814
|
-
if(
|
|
3843
|
+
if(_$1__namespace.isArray(fields)){
|
|
3815
3844
|
fieldsArr = fields;
|
|
3816
3845
|
}else {
|
|
3817
|
-
fieldsArr =
|
|
3846
|
+
fieldsArr = _$1__namespace.values(fields);
|
|
3818
3847
|
}
|
|
3819
3848
|
for (const field of fieldsArr) {
|
|
3820
3849
|
//graphql 的 ui\display 中使用的字段需要先在query中查询. 否则会返回null
|
|
@@ -3828,10 +3857,10 @@ async function getFieldsTemplate(fields, display){
|
|
|
3828
3857
|
}else {
|
|
3829
3858
|
fieldsName.push( field.alias ? `${field.alias}:${field.name}` : field.name);
|
|
3830
3859
|
}
|
|
3831
|
-
if(
|
|
3860
|
+
if(_$1.includes(['time','date','datetime','boolean','number','currency'], field.type)){
|
|
3832
3861
|
fieldsName.push(`${field.name}`);
|
|
3833
3862
|
}
|
|
3834
|
-
if(
|
|
3863
|
+
if(_$1.includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
|
|
3835
3864
|
displayFields.push(`${field.name}`);
|
|
3836
3865
|
}
|
|
3837
3866
|
}else {
|
|
@@ -3842,11 +3871,11 @@ async function getFieldsTemplate(fields, display){
|
|
|
3842
3871
|
}
|
|
3843
3872
|
}
|
|
3844
3873
|
|
|
3845
|
-
displayFields =
|
|
3846
|
-
fieldsName =
|
|
3874
|
+
displayFields = _$1__namespace.uniq(displayFields);
|
|
3875
|
+
fieldsName = _$1__namespace.uniq(fieldsName);
|
|
3847
3876
|
let expandFieldsQuery = "";
|
|
3848
3877
|
if(expandFields.length > 0){
|
|
3849
|
-
|
|
3878
|
+
_$1__namespace.each(expandFields, function(field){
|
|
3850
3879
|
expandFieldsQuery = expandFieldsQuery + `${field.expandInfo.fieldName}__expand{${field.expandInfo.displayName}}`;
|
|
3851
3880
|
});
|
|
3852
3881
|
}
|
|
@@ -3854,7 +3883,7 @@ async function getFieldsTemplate(fields, display){
|
|
|
3854
3883
|
if(displayFields.length > 0){
|
|
3855
3884
|
return `${fieldsName.join(',')},${expandFieldsQuery},_display:_ui{${displayFields.join(',')}}`;
|
|
3856
3885
|
}
|
|
3857
|
-
return
|
|
3886
|
+
return _$1.trimEnd(`${fieldsName.join(' ')},${expandFieldsQuery}`, ",")
|
|
3858
3887
|
}
|
|
3859
3888
|
|
|
3860
3889
|
function getRecordPermissionsTemplate(){
|
|
@@ -3935,7 +3964,7 @@ function getScriptForRemoveUrlPrefixForImgFields(fields){
|
|
|
3935
3964
|
let imgFieldsKeys = [];
|
|
3936
3965
|
let imgFields = {};
|
|
3937
3966
|
fields.forEach((item)=>{
|
|
3938
|
-
if(
|
|
3967
|
+
if(_$1.includes(['image','avatar'], item.type)){
|
|
3939
3968
|
imgFieldsKeys.push(item.name);
|
|
3940
3969
|
imgFields[item.name] = {
|
|
3941
3970
|
name: item.name,
|
|
@@ -4073,7 +4102,7 @@ async function getFindQuery(object, recordId, fields, options){
|
|
|
4073
4102
|
}
|
|
4074
4103
|
}
|
|
4075
4104
|
var treeFields = '';
|
|
4076
|
-
if(object.enable_tree &&
|
|
4105
|
+
if(object.enable_tree && _$1__namespace.includes(_$1__namespace.keys(object.fields), 'parent') && _$1__namespace.includes(_$1__namespace.keys(object.fields), 'children')){
|
|
4077
4106
|
treeFields = ',parent,children';
|
|
4078
4107
|
}
|
|
4079
4108
|
|
|
@@ -4137,7 +4166,7 @@ function getApi$2 (isMobile){
|
|
|
4137
4166
|
}
|
|
4138
4167
|
}
|
|
4139
4168
|
|
|
4140
|
-
var frontend_field_group_generalization$1 = "
|
|
4169
|
+
var frontend_field_group_generalization$1 = "General";
|
|
4141
4170
|
var frontend_download$1 = "Download";
|
|
4142
4171
|
var frontend_form_save$1 = "Save";
|
|
4143
4172
|
var frontend_form_save_and_new$1 = "Save and New";
|
|
@@ -4822,10 +4851,7 @@ async function getSearchApi(field, ctx) {
|
|
|
4822
4851
|
}
|
|
4823
4852
|
|
|
4824
4853
|
function getRefListViewSort$1(refObject){
|
|
4825
|
-
|
|
4826
|
-
refObject.list_views,
|
|
4827
|
-
(view, name) => name === "all"
|
|
4828
|
-
);
|
|
4854
|
+
let listView = getLookupListView(refObject);
|
|
4829
4855
|
let sort = "";
|
|
4830
4856
|
if(listView){
|
|
4831
4857
|
sort = getListViewSort(listView);
|
|
@@ -4907,7 +4933,7 @@ const getValueByPath = function (formData, path) {
|
|
|
4907
4933
|
if (path === '#' || !path) {
|
|
4908
4934
|
return formData || {};
|
|
4909
4935
|
} else if (typeof path === 'string') {
|
|
4910
|
-
return
|
|
4936
|
+
return _$1.get(formData, path);
|
|
4911
4937
|
} else {
|
|
4912
4938
|
console.error('path has to be a string');
|
|
4913
4939
|
}
|
|
@@ -5334,257 +5360,92 @@ const getSchema$2 = (uiSchema) => {
|
|
|
5334
5360
|
title: instance.t('frontend_import_data'),
|
|
5335
5361
|
body: [
|
|
5336
5362
|
{
|
|
5337
|
-
type: "form",
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
api: {
|
|
5346
|
-
method: "post",
|
|
5347
|
-
url: "${context.rootUrl}/graphql",
|
|
5348
|
-
data: {
|
|
5349
|
-
objectName: "queue_import_history",
|
|
5350
|
-
$: "$$",
|
|
5351
|
-
},
|
|
5352
|
-
requestAdaptor:
|
|
5353
|
-
"\n const formData = api.data.$;\n for (key in formData){\n // image、select等字段清空值后保存的空字符串转换为null。\n if(formData[key] === ''){\n formData[key] = null;\n }\n }\n const objectName = api.data.objectName;\n const fieldsName = Object.keys(formData);\n delete formData.created;\n delete formData.created_by;\n delete formData.modified;\n delete formData.modified_by;\n delete formData._display;\n delete formData.success_count;\ndelete formData.failure_count;\ndelete formData.total_count;\ndelete formData.start_time;\ndelete formData.end_time;\ndelete formData.state;\ndelete formData.error;\ndelete formData.created;\ndelete formData.created_by;\ndelete formData.modified;\ndelete formData.modified_by;\n \n \n let fileFieldsKeys = [\"file\"];\n let fileFields = {\"file\":{\"name\":\"file\"}};\n fileFieldsKeys.forEach((item)=>{\n let fileFieldValue = formData[item];\n if(fileFieldValue){\n // 因为表单初始化接口的接收适配器中为file字段值重写了值及格式(为了字段编辑时正常显示附件名、点击附件名正常下载),所以保存时还原(为了字段值保存时正常保存id)。\n if(fileFields[item].multiple){\n if(fileFieldValue instanceof Array && fileFieldValue.length){\n formData[item] = fileFieldValue.map((value)=>{ \n if(typeof value === 'object'){\n return value.value;\n }else{\n return value;\n }\n });\n }\n }else{\n formData[item] = typeof fileFieldValue === 'object' ? fileFieldValue.value : fileFieldValue;\n }\n }\n })\n \n let query = `mutation{record: ${objectName}__insert(doc: {__saveData}){_id}}`;\n if(formData.recordId && formData.recordId !='new'){\n query = `mutation{record: ${objectName}__update(id: \"${formData._id}\", doc: {__saveData}){_id}}`;\n };\n delete formData._id;\n let __saveData = JSON.stringify(JSON.stringify(formData));\n \n api.data = {query: query.replace('{__saveData}', __saveData)};\n return api;\n ",
|
|
5354
|
-
responseData: {
|
|
5355
|
-
recordId: "${record._id}",
|
|
5356
|
-
},
|
|
5357
|
-
adaptor:
|
|
5358
|
-
"console.log('payload', payload)\n return payload;\n ",
|
|
5359
|
-
headers: {
|
|
5360
|
-
Authorization:
|
|
5361
|
-
"Bearer ${context.tenantId},${context.authToken}",
|
|
5362
|
-
},
|
|
5363
|
-
dataType: "json",
|
|
5363
|
+
"type": "steedos-object-form",
|
|
5364
|
+
"label": "对象表单",
|
|
5365
|
+
"objectApiName": "queue_import_history",
|
|
5366
|
+
"recordId": "",
|
|
5367
|
+
"mode": "edit",
|
|
5368
|
+
"layout": "normal",
|
|
5369
|
+
"defaultData":{
|
|
5370
|
+
"object_name": "${objectName}"
|
|
5364
5371
|
},
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
},
|
|
5394
|
-
headers: {
|
|
5395
|
-
Authorization:
|
|
5396
|
-
"Bearer ${context.tenantId},${context.authToken}",
|
|
5397
|
-
},
|
|
5398
|
-
requestAdaptor:
|
|
5399
|
-
"\n var filters = '[]';\n var top = 10;\n if(api.data.$term){\n filters = '[\"name\", \"contains\", \"'+ api.data.$term +'\"]';\n }else if(api.data.$value){\n filters = '[\"_id\", \"=\", \"'+ api.data.$value +'\"]';\n }\n api.data.query = api.data.query.replace(/{__filters}/g, filters).replace('{__top}', top);\n return api;\n ",
|
|
5400
|
-
},
|
|
5401
|
-
className: "m-1",
|
|
5402
|
-
labelClassName: "text-left",
|
|
5403
|
-
clearValueOnHidden: false,
|
|
5404
|
-
id: "u:04295fee3896",
|
|
5405
|
-
multiple: false,
|
|
5406
|
-
hidden: true,
|
|
5407
|
-
},
|
|
5408
|
-
{
|
|
5409
|
-
name: "queue_import",
|
|
5410
|
-
label: instance.t('frontend_import_data_queue_import'),
|
|
5411
|
-
required: true,
|
|
5412
|
-
type: "picker",
|
|
5413
|
-
labelField: "description",
|
|
5414
|
-
valueField: "_id",
|
|
5415
|
-
modalMode: "dialog",
|
|
5416
|
-
source: {
|
|
5417
|
-
method: "post",
|
|
5418
|
-
url: "${context.rootUrl}/graphql",
|
|
5419
|
-
data: {
|
|
5420
|
-
orderBy: "${orderBy}",
|
|
5421
|
-
orderDir: "${orderDir}",
|
|
5422
|
-
pageNo: "${page}",
|
|
5423
|
-
pageSize: "${perPage}",
|
|
5424
|
-
query:
|
|
5425
|
-
'{rows:queue_import(filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"){_id,description,object_name,encoding,template_url,_display:_ui{object_name,encoding}},count:queue_import__count(filters:{__filters})}',
|
|
5426
|
-
$term: "$term",
|
|
5427
|
-
$self: "$$",
|
|
5372
|
+
"fieldsExtend":{
|
|
5373
|
+
"object_name": {
|
|
5374
|
+
"amis": {
|
|
5375
|
+
"hidden": true
|
|
5376
|
+
}
|
|
5377
|
+
}
|
|
5378
|
+
},
|
|
5379
|
+
"form": {
|
|
5380
|
+
debug: false,
|
|
5381
|
+
resetAfterSubmit: false,
|
|
5382
|
+
initApi: {
|
|
5383
|
+
url: '/api/v1/queue_import_history/${recordId}?fields=["state"]',
|
|
5384
|
+
sendOn: 'this.recordId',
|
|
5385
|
+
responseData: {
|
|
5386
|
+
importState: "${state}"
|
|
5387
|
+
}
|
|
5388
|
+
},
|
|
5389
|
+
interval: 3000,
|
|
5390
|
+
stopAutoRefreshWhen: "this.importState === 'finished'",
|
|
5391
|
+
initFetch: false,
|
|
5392
|
+
onEvent: {
|
|
5393
|
+
inited: {
|
|
5394
|
+
weight: 0,
|
|
5395
|
+
actions: [
|
|
5396
|
+
{
|
|
5397
|
+
"actionType": "broadcast",
|
|
5398
|
+
"args": {
|
|
5399
|
+
"eventName": `@data.changed.${uiSchema.name}`
|
|
5428
5400
|
},
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5401
|
+
"data": {
|
|
5402
|
+
"objectName": `${uiSchema.name}`,
|
|
5403
|
+
"displayAs": "${displayAs}",
|
|
5404
|
+
"recordId": "xxxx" //不可以省略,否则会进入进入记录详细页面
|
|
5432
5405
|
},
|
|
5433
|
-
|
|
5434
|
-
"\n const selfData = JSON.parse(JSON.stringify(api.data.$self));\n var filters = [];\n var pageSize = api.data.pageSize || 10;\n var pageNo = api.data.pageNo || 1;\n var skip = (pageNo - 1) * pageSize;\n var orderBy = api.data.orderBy || '';\n var orderDir = api.data.orderDir || '';\n var sort = orderBy + ' ' + orderDir;\n var allowSearchFields = [\"description\"];\n if(api.data.$term){\n filters = [[\"name\", \"contains\", \"'+ api.data.$term +'\"]];\n }else if(selfData.op === 'loadOptions' && selfData.value){\n if(selfData.value && selfData.value.indexOf(',') > 0){\n filters = [[\"_id\", \"=\", selfData.value.split(',')]];\n }else{\n filters = [[\"_id\", \"=\", selfData.value]];\n }\n }\n if(allowSearchFields){\n allowSearchFields.forEach(function(key){\n const keyValue = selfData[key];\n if(keyValue){\n filters.push([key, \"contains\", keyValue]);\n }\n })\n }\n\n const filtersFunction = function(filters, values){return ['object_name', '=', values.object_name]};\n\n if(filtersFunction){\n const _filters = filtersFunction(filters, api.data.$self.__super.__super);\n if(_filters && _filters.length > 0){\n filters.push(_filters);\n }\n }\n\n api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim());\n return api;\n ",
|
|
5435
|
-
adaptor:
|
|
5436
|
-
"\n const enable_tree = undefined;\n if(enable_tree){\n const records = payload.data.rows;\n const treeRecords = [];\n const getChildren = (records, childrenIds)=>{\n if(!childrenIds){\n return;\n }\n const children = _.filter(records, (record)=>{\n return _.includes(childrenIds, record._id)\n });\n _.each(children, (item)=>{\n if(item.children){\n item.children = getChildren(records, item.children)\n }\n })\n return children;\n }\n\n _.each(records, (record)=>{\n if(!record.parent){\n treeRecords.push(Object.assign({}, record, {children: getChildren(records, record.children)}));\n }\n });\n payload.data.rows = treeRecords;\n }\n return payload;\n ",
|
|
5406
|
+
"expression": "this.importState === 'finished'"
|
|
5437
5407
|
},
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
name: "object_name",
|
|
5464
|
-
label: instance.t('frontend_import_data_object_name'),
|
|
5465
|
-
type: "tpl",
|
|
5466
|
-
tpl: '<a href="/app/undefined/${_display.object_name.objectName}/view/${_display.object_name.value}">${_display.object_name.label}</a>',
|
|
5467
|
-
className: "whitespace-nowrap",
|
|
5468
|
-
html: null,
|
|
5469
|
-
},
|
|
5470
|
-
{
|
|
5471
|
-
name: "encoding",
|
|
5472
|
-
label: instance.t('frontend_import_data_queue_import_encoding'),
|
|
5473
|
-
type: "tpl",
|
|
5474
|
-
tpl: "<div>${_display.encoding}</div>",
|
|
5475
|
-
className: "whitespace-nowrap",
|
|
5476
|
-
html: null,
|
|
5477
|
-
},
|
|
5478
|
-
{
|
|
5479
|
-
name: "template_url",
|
|
5480
|
-
label: instance.t('frontend_import_data_queue_import_template_url'),
|
|
5481
|
-
type: "button-group",
|
|
5482
|
-
buttons: [
|
|
5483
|
-
{
|
|
5484
|
-
type: "button",
|
|
5485
|
-
label: instance.t('frontend_download'),
|
|
5486
|
-
visibleOn: "${template_url}",
|
|
5487
|
-
level: "link",
|
|
5488
|
-
actionType: "download",
|
|
5489
|
-
api:{
|
|
5490
|
-
url: "${template_url}",
|
|
5491
|
-
method: "get",
|
|
5492
|
-
headers: {
|
|
5493
|
-
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
5494
|
-
}
|
|
5495
|
-
}
|
|
5496
|
-
}
|
|
5497
|
-
],
|
|
5498
|
-
options: {
|
|
5499
|
-
html: true
|
|
5408
|
+
{
|
|
5409
|
+
"actionType": "closeDialog",
|
|
5410
|
+
"expression": "this.importState === 'finished'"
|
|
5411
|
+
}
|
|
5412
|
+
]
|
|
5413
|
+
},
|
|
5414
|
+
submitSucc: {
|
|
5415
|
+
weight: 0,
|
|
5416
|
+
actions: [
|
|
5417
|
+
{
|
|
5418
|
+
args: {
|
|
5419
|
+
api: {
|
|
5420
|
+
url: "${context.rootUrl}/api/data/initiateImport",
|
|
5421
|
+
method: "post",
|
|
5422
|
+
data: {
|
|
5423
|
+
eventData: "${event.data}",
|
|
5424
|
+
},
|
|
5425
|
+
dataType: "json",
|
|
5426
|
+
requestAdaptor:
|
|
5427
|
+
"\napi.data = {\n importObjectHistoryId: api.body.eventData.result.data.recordId\n}\nreturn api;",
|
|
5428
|
+
adaptor:
|
|
5429
|
+
"payload.status = payload.status === 'success' ? 0 : payload.status;\nconsole.log(\"payload ssss==>\", payload)\nreturn payload;",
|
|
5430
|
+
headers: {
|
|
5431
|
+
Authorization:
|
|
5432
|
+
"Bearer ${context.tenantId},${context.authToken}",
|
|
5500
5433
|
},
|
|
5501
|
-
className: "whitespace-nowrap",
|
|
5502
|
-
},
|
|
5503
|
-
null,
|
|
5504
|
-
],
|
|
5505
|
-
syncLocation: false,
|
|
5506
|
-
keepItemSelectionOnPageChange: true,
|
|
5507
|
-
checkOnItemClick: false,
|
|
5508
|
-
autoFillHeight: false,
|
|
5509
|
-
},
|
|
5510
|
-
joinValues: false,
|
|
5511
|
-
extractValue: true,
|
|
5512
|
-
className: "m-1",
|
|
5513
|
-
labelClassName: "text-left",
|
|
5514
|
-
clearValueOnHidden: true,
|
|
5515
|
-
id: "u:401df27113e0",
|
|
5516
|
-
},
|
|
5517
|
-
{
|
|
5518
|
-
name: "file",
|
|
5519
|
-
label: instance.t('frontend_import_data_file'),
|
|
5520
|
-
required: true,
|
|
5521
|
-
type: "input-file",
|
|
5522
|
-
accept: ".xlsx,.xls",
|
|
5523
|
-
className: "m-1",
|
|
5524
|
-
labelClassName: "text-left",
|
|
5525
|
-
clearValueOnHidden: true,
|
|
5526
|
-
useChunk: false,
|
|
5527
|
-
receiver: {
|
|
5528
|
-
method: "post",
|
|
5529
|
-
url: "${context.rootUrl}/s3/files",
|
|
5530
|
-
data: {
|
|
5531
|
-
$: "$$",
|
|
5532
|
-
context: "${context}",
|
|
5533
|
-
},
|
|
5534
|
-
adaptor:
|
|
5535
|
-
'\n const { context } = api.body; \n var rootUrl = context.rootUrl + "/api/files/files/";\n payload = {\n status: response.status == 200 ? 0 : response.status,\n msg: response.statusText,\n data: {\n value: payload._id,\n name: payload.original.name,\n url: rootUrl + payload._id,\n }\n }\n return payload;\n ',
|
|
5536
|
-
headers: {
|
|
5537
|
-
Authorization:
|
|
5538
|
-
"Bearer ${context.tenantId},${context.authToken}",
|
|
5539
|
-
},
|
|
5540
|
-
},
|
|
5541
|
-
id: "u:0213f2cc365b",
|
|
5542
|
-
},
|
|
5543
|
-
],
|
|
5544
|
-
id: "u:4899c260d667",
|
|
5545
|
-
},
|
|
5546
|
-
],
|
|
5547
|
-
panelClassName: "m-0 sm:rounded-lg shadow-none",
|
|
5548
|
-
bodyClassName: "p-0",
|
|
5549
|
-
className: "p-4 sm:p-0 steedos-amis-form",
|
|
5550
|
-
label: "对象表单",
|
|
5551
|
-
objectApiName: "queue_import_history",
|
|
5552
|
-
id: "u:e4ef598eed61",
|
|
5553
|
-
onEvent: {
|
|
5554
|
-
submitSucc: {
|
|
5555
|
-
weight: 0,
|
|
5556
|
-
actions: [
|
|
5557
|
-
{
|
|
5558
|
-
args: {
|
|
5559
|
-
api: {
|
|
5560
|
-
url: "${context.rootUrl}/api/data/initiateImport",
|
|
5561
|
-
method: "post",
|
|
5562
|
-
data: {
|
|
5563
|
-
eventData: "${event.data}",
|
|
5564
5434
|
},
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
adaptor:
|
|
5569
|
-
"payload.status = payload.status === 'success' ? 0 : payload.status;\nconsole.log(\"payload ssss==>\", payload)\nreturn payload;",
|
|
5570
|
-
headers: {
|
|
5571
|
-
Authorization:
|
|
5572
|
-
"Bearer ${context.tenantId},${context.authToken}",
|
|
5435
|
+
messages: {
|
|
5436
|
+
success: instance.t('frontend_import_data_message_success'),
|
|
5437
|
+
failed: instance.t('frontend_import_data_message_failed'),
|
|
5573
5438
|
},
|
|
5574
5439
|
},
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
failed: instance.t('frontend_import_data_message_failed'),
|
|
5578
|
-
},
|
|
5440
|
+
actionType: "ajax",
|
|
5441
|
+
expression: "event.data.result",
|
|
5579
5442
|
},
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
},
|
|
5583
|
-
],
|
|
5443
|
+
],
|
|
5444
|
+
},
|
|
5584
5445
|
},
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
}
|
|
5446
|
+
closeDialogOnSubmit: false,
|
|
5447
|
+
}
|
|
5448
|
+
}
|
|
5588
5449
|
],
|
|
5589
5450
|
id: "u:dc05498d3bd4",
|
|
5590
5451
|
closeOnEsc: false,
|
|
@@ -5774,7 +5635,7 @@ const StandardButtons = {
|
|
|
5774
5635
|
getStandardImportData: async (uiSchema, ctx)=>{
|
|
5775
5636
|
return {
|
|
5776
5637
|
type: 'amis_button',
|
|
5777
|
-
amis_schema: await getSchema$2()
|
|
5638
|
+
amis_schema: await getSchema$2(uiSchema)
|
|
5778
5639
|
}
|
|
5779
5640
|
},
|
|
5780
5641
|
getStandardOpenView: async (uiSchema, ctx)=>{
|
|
@@ -5804,7 +5665,7 @@ function getButtonVisibleOn$1(button){
|
|
|
5804
5665
|
visible = button._visible;
|
|
5805
5666
|
}
|
|
5806
5667
|
|
|
5807
|
-
if(
|
|
5668
|
+
if(_$1__namespace.isBoolean(visible)){
|
|
5808
5669
|
visible = visible.toString();
|
|
5809
5670
|
}
|
|
5810
5671
|
|
|
@@ -5832,7 +5693,7 @@ function getButtonVisibleOn$1(button){
|
|
|
5832
5693
|
|
|
5833
5694
|
const getButtonVisible = (button, ctx) => {
|
|
5834
5695
|
if (button._visible) {
|
|
5835
|
-
if (
|
|
5696
|
+
if (_$1__namespace.startsWith(_$1__namespace.trim(button._visible), "function")) {
|
|
5836
5697
|
window.eval("var fun = " + button._visible);
|
|
5837
5698
|
button.visible = fun;
|
|
5838
5699
|
} else if (isExpression$1(button._visible)) {
|
|
@@ -5847,7 +5708,7 @@ const getButtonVisible = (button, ctx) => {
|
|
|
5847
5708
|
};
|
|
5848
5709
|
}
|
|
5849
5710
|
}
|
|
5850
|
-
if (
|
|
5711
|
+
if (_$1__namespace.isFunction(button.visible)) {
|
|
5851
5712
|
try {
|
|
5852
5713
|
return button.visible(ctx);
|
|
5853
5714
|
} catch (error) {
|
|
@@ -5869,7 +5730,7 @@ const standardButtonsTodo = {
|
|
|
5869
5730
|
} = this;
|
|
5870
5731
|
const listViewRef = SteedosUI?.getRef(scopeId || listViewId).getComponentById(`listview_${uiSchema.name}`);
|
|
5871
5732
|
|
|
5872
|
-
if(
|
|
5733
|
+
if(_$1__namespace.isEmpty(listViewRef.props.store.toJSON().selectedItems)){
|
|
5873
5734
|
listViewRef.handleAction({}, {
|
|
5874
5735
|
"actionType": "toast",
|
|
5875
5736
|
"toast": {
|
|
@@ -5896,19 +5757,19 @@ const standardButtonsTodo = {
|
|
|
5896
5757
|
*/
|
|
5897
5758
|
const getButtons = (uiSchema, ctx) => {
|
|
5898
5759
|
const disabledButtons = uiSchema.permissions && uiSchema.permissions.disabled_actions;
|
|
5899
|
-
let buttons =
|
|
5900
|
-
if (
|
|
5901
|
-
buttons =
|
|
5902
|
-
return
|
|
5760
|
+
let buttons = _$1__namespace.sortBy(_$1__namespace.values(uiSchema.actions), "sort");
|
|
5761
|
+
if (_$1__namespace.has(uiSchema, "allow_customActions")) {
|
|
5762
|
+
buttons = _$1__namespace.filter(buttons, (button) => {
|
|
5763
|
+
return _$1__namespace.include(uiSchema.allow_customActions, button.name); // || _.include(_.keys(Creator.getObject('base').actions) || {}, button.name)
|
|
5903
5764
|
});
|
|
5904
5765
|
}
|
|
5905
|
-
if (
|
|
5906
|
-
buttons =
|
|
5907
|
-
return !
|
|
5766
|
+
if (_$1__namespace.has(uiSchema, "exclude_actions")) {
|
|
5767
|
+
buttons = _$1__namespace.filter(buttons, (button) => {
|
|
5768
|
+
return !_$1__namespace.include(uiSchema.exclude_actions, button.name);
|
|
5908
5769
|
});
|
|
5909
5770
|
}
|
|
5910
5771
|
|
|
5911
|
-
|
|
5772
|
+
_$1__namespace.each(buttons, (button) => {
|
|
5912
5773
|
button.objectName = uiSchema.name;
|
|
5913
5774
|
if (
|
|
5914
5775
|
ctx.isMobile &&
|
|
@@ -5927,7 +5788,7 @@ const getButtons = (uiSchema, ctx) => {
|
|
|
5927
5788
|
ctx.isMobile &&
|
|
5928
5789
|
["cms_files", "cfs.files.filerecord"].indexOf(uiSchema.name) > -1
|
|
5929
5790
|
) {
|
|
5930
|
-
|
|
5791
|
+
_$1__namespace.map(buttons, (button) => {
|
|
5931
5792
|
if (button.name === "standard_edit") {
|
|
5932
5793
|
button.on = "record_more";
|
|
5933
5794
|
}
|
|
@@ -5937,14 +5798,14 @@ const getButtons = (uiSchema, ctx) => {
|
|
|
5937
5798
|
});
|
|
5938
5799
|
}
|
|
5939
5800
|
|
|
5940
|
-
return
|
|
5941
|
-
return
|
|
5801
|
+
return _$1__namespace.filter(buttons, (button) => {
|
|
5802
|
+
return _$1__namespace.indexOf(disabledButtons, button.name) < 0 && button.name != 'standard_query';
|
|
5942
5803
|
});
|
|
5943
5804
|
};
|
|
5944
5805
|
|
|
5945
5806
|
const getListViewButtons = (uiSchema, ctx) => {
|
|
5946
5807
|
const buttons = getButtons(uiSchema, ctx);
|
|
5947
|
-
const listButtons =
|
|
5808
|
+
const listButtons = _$1__namespace.filter(buttons, (button) => {
|
|
5948
5809
|
return button.on == "list";
|
|
5949
5810
|
});
|
|
5950
5811
|
return listButtons;
|
|
@@ -5952,23 +5813,23 @@ const getListViewButtons = (uiSchema, ctx) => {
|
|
|
5952
5813
|
|
|
5953
5814
|
const getObjectDetailButtons = (uiSchema, ctx) => {
|
|
5954
5815
|
const buttons = getButtons(uiSchema, ctx);
|
|
5955
|
-
const detailButtons =
|
|
5816
|
+
const detailButtons = _$1__namespace.filter(buttons, (button) => {
|
|
5956
5817
|
return button.on == "record" || button.on == "record_only";
|
|
5957
5818
|
});
|
|
5958
|
-
return
|
|
5819
|
+
return _$1__namespace.sortBy(detailButtons, "sort");
|
|
5959
5820
|
};
|
|
5960
5821
|
|
|
5961
5822
|
const getObjectDetailMoreButtons = (uiSchema, ctx) => {
|
|
5962
5823
|
const buttons = getButtons(uiSchema, ctx);
|
|
5963
|
-
const moreButtons =
|
|
5824
|
+
const moreButtons = _$1__namespace.filter(buttons, (button) => {
|
|
5964
5825
|
return button.on == "record_more" || button.on == "record_only_more";
|
|
5965
5826
|
});
|
|
5966
|
-
return
|
|
5827
|
+
return _$1__namespace.sortBy(moreButtons, "sort");
|
|
5967
5828
|
};
|
|
5968
5829
|
|
|
5969
5830
|
const getListViewItemButtons = async (uiSchema, ctx)=>{
|
|
5970
5831
|
const buttons = getButtons(uiSchema, ctx);
|
|
5971
|
-
const listButtons =
|
|
5832
|
+
const listButtons = _$1__namespace.filter(buttons, (button) => {
|
|
5972
5833
|
return button.on == "record" || button.on == "list_item" || button.on === 'record_more';
|
|
5973
5834
|
});
|
|
5974
5835
|
return listButtons;
|
|
@@ -5985,7 +5846,7 @@ const getObjectRelatedListButtons = (uiSchema, ctx)=>{
|
|
|
5985
5846
|
// });
|
|
5986
5847
|
// return relatedListButtons;
|
|
5987
5848
|
const buttons = getButtons(uiSchema, ctx);
|
|
5988
|
-
const listButtons =
|
|
5849
|
+
const listButtons = _$1__namespace.filter(buttons, (button) => {
|
|
5989
5850
|
return button.on == "list";
|
|
5990
5851
|
});
|
|
5991
5852
|
return listButtons;
|
|
@@ -6002,7 +5863,7 @@ const getButton = async (objectName, buttonName, ctx)=>{
|
|
|
6002
5863
|
const uiSchema = await getUISchema(objectName);
|
|
6003
5864
|
if(uiSchema){
|
|
6004
5865
|
const buttons = await getButtons(uiSchema, ctx);
|
|
6005
|
-
const button =
|
|
5866
|
+
const button = _$1__namespace.find(buttons, (button)=>{
|
|
6006
5867
|
return button.name === buttonName
|
|
6007
5868
|
});
|
|
6008
5869
|
|
|
@@ -6088,13 +5949,13 @@ const execute = (button, props) => {
|
|
|
6088
5949
|
return; //TODO 弹出提示未配置todo
|
|
6089
5950
|
}
|
|
6090
5951
|
|
|
6091
|
-
if (
|
|
6092
|
-
if (
|
|
5952
|
+
if (_$1__namespace.isString(button.todo)) {
|
|
5953
|
+
if (_$1__namespace.startsWith(_$1__namespace.trim(button.todo), "function")) {
|
|
6093
5954
|
window.eval("var fun = " + button.todo);
|
|
6094
5955
|
button.todo = fun;
|
|
6095
5956
|
}
|
|
6096
5957
|
}
|
|
6097
|
-
if (
|
|
5958
|
+
if (_$1__namespace.isFunction(button.todo)) {
|
|
6098
5959
|
const todoThis = {
|
|
6099
5960
|
objectName: props.objectName,
|
|
6100
5961
|
object_name: props.objectName,
|
|
@@ -6119,7 +5980,7 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
|
|
|
6119
5980
|
recordId: recordId,
|
|
6120
5981
|
objectName: name
|
|
6121
5982
|
});
|
|
6122
|
-
let amisButtonsSchema =
|
|
5983
|
+
let amisButtonsSchema = _$1__namespace.map(buttons, (button) => {
|
|
6123
5984
|
return {
|
|
6124
5985
|
type: 'steedos-object-button',
|
|
6125
5986
|
name: button.name,
|
|
@@ -6129,7 +5990,7 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
|
|
|
6129
5990
|
}
|
|
6130
5991
|
});
|
|
6131
5992
|
let moreButtonsVisibleOn = '';
|
|
6132
|
-
let dropdownButtons =
|
|
5993
|
+
let dropdownButtons = _$1__namespace.map(moreButtons, (button, index) => {
|
|
6133
5994
|
if(index === 0){
|
|
6134
5995
|
moreButtonsVisibleOn = getButtonVisibleOn$1(button);
|
|
6135
5996
|
}else {
|
|
@@ -6172,11 +6033,11 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
6172
6033
|
"vertical": true,
|
|
6173
6034
|
"tiled": true,
|
|
6174
6035
|
"buttons": [
|
|
6175
|
-
...
|
|
6036
|
+
..._$1__namespace.map(buttons, (button)=>{
|
|
6176
6037
|
button.className += ' w-full';
|
|
6177
6038
|
return button;
|
|
6178
6039
|
}),
|
|
6179
|
-
...
|
|
6040
|
+
..._$1__namespace.map(moreButtons, (button)=>{
|
|
6180
6041
|
button.className += ' w-full';
|
|
6181
6042
|
return button;
|
|
6182
6043
|
})
|
|
@@ -6221,6 +6082,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
6221
6082
|
return {
|
|
6222
6083
|
"type": "button",
|
|
6223
6084
|
"icon": "fa fa-angle-down",
|
|
6085
|
+
"className": "mr-0",
|
|
6224
6086
|
"onEvent": {
|
|
6225
6087
|
"click": {
|
|
6226
6088
|
"actions": [
|
|
@@ -6237,7 +6099,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
6237
6099
|
"vertical": true,
|
|
6238
6100
|
"tiled": true,
|
|
6239
6101
|
"buttons": [
|
|
6240
|
-
...
|
|
6102
|
+
..._$1__namespace.map(buttons, (button)=>{
|
|
6241
6103
|
return {
|
|
6242
6104
|
type: 'steedos-object-button',
|
|
6243
6105
|
name: button.name,
|
|
@@ -6266,7 +6128,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
6266
6128
|
}
|
|
6267
6129
|
}
|
|
6268
6130
|
}else {
|
|
6269
|
-
return
|
|
6131
|
+
return _$1__namespace.map(buttons, (button) => {
|
|
6270
6132
|
return {
|
|
6271
6133
|
type: 'steedos-object-button',
|
|
6272
6134
|
name: button.name,
|
|
@@ -6299,7 +6161,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
6299
6161
|
"vertical": true,
|
|
6300
6162
|
"tiled": true,
|
|
6301
6163
|
"buttons": [
|
|
6302
|
-
...
|
|
6164
|
+
..._$1__namespace.map(buttons, (button)=>{
|
|
6303
6165
|
return {
|
|
6304
6166
|
type: 'steedos-object-button',
|
|
6305
6167
|
name: button.name,
|
|
@@ -6328,7 +6190,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
6328
6190
|
}
|
|
6329
6191
|
}
|
|
6330
6192
|
}else {
|
|
6331
|
-
return
|
|
6193
|
+
return _$1__namespace.map(buttons, (button) => {
|
|
6332
6194
|
return {
|
|
6333
6195
|
type: 'steedos-object-button',
|
|
6334
6196
|
name: button.name,
|
|
@@ -6921,9 +6783,13 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6921
6783
|
function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
6922
6784
|
const { icon, label } = objectSchema;
|
|
6923
6785
|
const listViewButtonOptions = [];
|
|
6924
|
-
|
|
6786
|
+
_$1.each(
|
|
6925
6787
|
objectSchema.list_views,
|
|
6926
6788
|
(listView, name) => {
|
|
6789
|
+
if(name === "lookup"){
|
|
6790
|
+
// 内置lookup为弹出选择专用视图,不显示在列表切换区域
|
|
6791
|
+
return;
|
|
6792
|
+
}
|
|
6927
6793
|
listViewButtonOptions.push({
|
|
6928
6794
|
type: "button",
|
|
6929
6795
|
label: listView.label,
|
|
@@ -8413,6 +8279,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
8413
8279
|
|
|
8414
8280
|
return {
|
|
8415
8281
|
"type": "tooltip-wrapper",
|
|
8282
|
+
"id": "steedos_crud_toolbar_quick_search",
|
|
8416
8283
|
"align": "right",
|
|
8417
8284
|
"title": "",
|
|
8418
8285
|
"content": "可搜索字段:" + searchableFieldsLabel.join(","),
|
|
@@ -8444,76 +8311,134 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8444
8311
|
if(isMobile){
|
|
8445
8312
|
showDisplayAs = false;
|
|
8446
8313
|
}
|
|
8314
|
+
let toolbarCount;
|
|
8315
|
+
if(!hiddenCount){
|
|
8316
|
+
toolbarCount = {
|
|
8317
|
+
"type": "tpl",
|
|
8318
|
+
"tpl": "${count} " + instance.t('frontend_record_sum')
|
|
8319
|
+
};
|
|
8320
|
+
}
|
|
8321
|
+
let toolbarReloadButton;
|
|
8447
8322
|
if(formFactor === 'SMALL'){
|
|
8448
|
-
const onReloadScript = `
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
`;
|
|
8323
|
+
// const onReloadScript = `
|
|
8324
|
+
// const scope = event.context.scoped;
|
|
8325
|
+
// var listView = scope.parent.getComponents().find(function(n){
|
|
8326
|
+
// return n.props.type === "crud";
|
|
8327
|
+
// });
|
|
8328
|
+
// listView.handleChangePage(1);
|
|
8329
|
+
// `;
|
|
8330
|
+
// toolbarReloadButton = {
|
|
8331
|
+
// // "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页,这在加载更多按钮的翻页模式下会有问题
|
|
8332
|
+
// "type": "button",
|
|
8333
|
+
// "align": "right",
|
|
8334
|
+
// //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
8335
|
+
// // "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8336
|
+
// "tooltipPlacement": "top",
|
|
8337
|
+
// "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
8338
|
+
// "label": "",
|
|
8339
|
+
// "icon": "fa fa-sync",
|
|
8340
|
+
// "visibleOn": "${!showFieldsFilter}",
|
|
8341
|
+
// "onEvent": {
|
|
8342
|
+
// "click": {
|
|
8343
|
+
// "actions": [
|
|
8344
|
+
// {
|
|
8345
|
+
// "actionType": "custom",
|
|
8346
|
+
// "script": onReloadScript
|
|
8347
|
+
// }
|
|
8348
|
+
// ]
|
|
8349
|
+
// }
|
|
8350
|
+
// },
|
|
8351
|
+
// };
|
|
8352
|
+
|
|
8353
|
+
// 后续如果换成加载更多按钮的翻页模式的话,不可以直接使用下面的reload,需要换成上面的自定义脚本模式
|
|
8354
|
+
toolbarReloadButton = {
|
|
8355
|
+
"type": "reload",
|
|
8356
|
+
"align": "right",
|
|
8357
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
8358
|
+
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8359
|
+
"tooltip":"",
|
|
8360
|
+
"tooltipPlacement": "top",
|
|
8361
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
8362
|
+
};
|
|
8363
|
+
}
|
|
8364
|
+
else {
|
|
8365
|
+
toolbarReloadButton = {
|
|
8366
|
+
"type": "reload",
|
|
8367
|
+
"align": "right",
|
|
8368
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
8369
|
+
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8370
|
+
"tooltip":"",
|
|
8371
|
+
"tooltipPlacement": "top",
|
|
8372
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
8373
|
+
};
|
|
8374
|
+
}
|
|
8375
|
+
let toolbarFilter;
|
|
8376
|
+
if(filterVisible){
|
|
8377
|
+
toolbarFilter ={
|
|
8378
|
+
"label": instance.t('frontend_button_search_tooltip'),
|
|
8379
|
+
"icon": "fa fa-filter",
|
|
8380
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
8381
|
+
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
8382
|
+
// "tooltipPlacement": "top",
|
|
8383
|
+
"type": "button",
|
|
8384
|
+
"badge": {
|
|
8385
|
+
"offset": [
|
|
8386
|
+
-5,
|
|
8387
|
+
1
|
|
8388
|
+
],
|
|
8389
|
+
"size":8,
|
|
8390
|
+
"animation": true,
|
|
8391
|
+
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
8392
|
+
},
|
|
8393
|
+
"align": "right",
|
|
8394
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
8395
|
+
"onEvent": {
|
|
8396
|
+
"click": {
|
|
8397
|
+
"actions": [
|
|
8398
|
+
{
|
|
8399
|
+
"actionType": "custom",
|
|
8400
|
+
"script": onFieldsFilterToggleScript
|
|
8401
|
+
}
|
|
8402
|
+
]
|
|
8403
|
+
}
|
|
8404
|
+
},
|
|
8405
|
+
"id": "steedos_crud_toolbar_filter"
|
|
8406
|
+
};
|
|
8407
|
+
}
|
|
8408
|
+
let toolbarDisplayAsButton = getDisplayAsButton(mainObject?.name);
|
|
8409
|
+
let toolbarDQuickSearchBox = getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName });
|
|
8410
|
+
|
|
8411
|
+
// toolbars返回的数组元素不可以是空对象{},比如hiddenCount ? {} : {"type": "tpl",...},因为空对象最终还是会生成一个空的.antd-Crud-toolbar-item dom
|
|
8412
|
+
// 当出现空的.antd-Crud-toolbar-item dom时会影响toolbar元素的maring-right css样式计算,如果有动态需要应该加到动态数组变量toolbars中
|
|
8413
|
+
let toolbars = [];
|
|
8414
|
+
if(formFactor === 'SMALL'){
|
|
8415
|
+
if(toolbarCount){
|
|
8416
|
+
toolbars.push(toolbarCount);
|
|
8417
|
+
}
|
|
8418
|
+
toolbars.push(toolbarReloadButton);
|
|
8419
|
+
if(toolbarFilter){
|
|
8420
|
+
toolbars.push(toolbarFilter);
|
|
8421
|
+
}
|
|
8422
|
+
toolbars.push(toolbarDisplayAsButton);
|
|
8423
|
+
toolbars.push(toolbarDQuickSearchBox);
|
|
8455
8424
|
return [
|
|
8456
8425
|
// "bulkActions",
|
|
8457
8426
|
...(headerToolbarItems || []),
|
|
8458
|
-
|
|
8459
|
-
"type": "tpl",
|
|
8460
|
-
"tpl": "${count} " + instance.t('frontend_record_sum')
|
|
8461
|
-
},
|
|
8462
|
-
{
|
|
8463
|
-
// "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
|
|
8464
|
-
"type": "button",
|
|
8465
|
-
"align": "right",
|
|
8466
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
8467
|
-
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8468
|
-
"tooltipPlacement": "top",
|
|
8469
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
8470
|
-
"label": "",
|
|
8471
|
-
"icon": "fa fa-sync",
|
|
8472
|
-
"visibleOn": "${!showFieldsFilter}",
|
|
8473
|
-
"onEvent": {
|
|
8474
|
-
"click": {
|
|
8475
|
-
"actions": [
|
|
8476
|
-
{
|
|
8477
|
-
"actionType": "custom",
|
|
8478
|
-
"script": onReloadScript
|
|
8479
|
-
}
|
|
8480
|
-
]
|
|
8481
|
-
}
|
|
8482
|
-
},
|
|
8483
|
-
},
|
|
8484
|
-
filterVisible ? {
|
|
8485
|
-
"label": instance.t('frontend_button_search_tooltip'),
|
|
8486
|
-
"icon": "fa fa-search",
|
|
8487
|
-
"type": "button",
|
|
8488
|
-
"tooltipPlacement": "top",
|
|
8489
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
8490
|
-
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
8491
|
-
"badge": {
|
|
8492
|
-
"offset": [
|
|
8493
|
-
-5,
|
|
8494
|
-
1
|
|
8495
|
-
],
|
|
8496
|
-
"size":8,
|
|
8497
|
-
"animation": true,
|
|
8498
|
-
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
8499
|
-
},
|
|
8500
|
-
"align": "right",
|
|
8501
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
8502
|
-
"onEvent": {
|
|
8503
|
-
"click": {
|
|
8504
|
-
"actions": [
|
|
8505
|
-
{
|
|
8506
|
-
"actionType": "custom",
|
|
8507
|
-
"script": onFieldsFilterToggleScript
|
|
8508
|
-
}
|
|
8509
|
-
]
|
|
8510
|
-
}
|
|
8511
|
-
}
|
|
8512
|
-
} : {},
|
|
8513
|
-
getDisplayAsButton(mainObject?.name),
|
|
8514
|
-
getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName })
|
|
8427
|
+
...toolbars,
|
|
8515
8428
|
]
|
|
8516
8429
|
}else {
|
|
8430
|
+
if(toolbarCount){
|
|
8431
|
+
toolbars.push(toolbarCount);
|
|
8432
|
+
}
|
|
8433
|
+
if(toolbarFilter){
|
|
8434
|
+
toolbars.push(toolbarFilter);
|
|
8435
|
+
}
|
|
8436
|
+
toolbars.push(toolbarReloadButton);
|
|
8437
|
+
if(mainObject?.permissions?.allowCreateListViews){
|
|
8438
|
+
toolbars.push(getSettingListviewToolbarButtonSchema());
|
|
8439
|
+
}
|
|
8440
|
+
toolbars.push(toolbarDisplayAsButton);
|
|
8441
|
+
toolbars.push(toolbarDQuickSearchBox);
|
|
8517
8442
|
return [
|
|
8518
8443
|
// "filter-toggler",
|
|
8519
8444
|
...(headerToolbarItems || []),
|
|
@@ -8522,56 +8447,12 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8522
8447
|
"type": "columns-toggler",
|
|
8523
8448
|
"className": "hidden"
|
|
8524
8449
|
},
|
|
8450
|
+
...toolbars,
|
|
8525
8451
|
// {
|
|
8526
8452
|
// "type": "columns-toggler",
|
|
8527
8453
|
// "className": "mr-2"
|
|
8528
8454
|
// },
|
|
8529
|
-
hiddenCount ? {} : {
|
|
8530
|
-
"type": "tpl",
|
|
8531
|
-
"tpl": "${count} " + instance.t('frontend_record_sum')
|
|
8532
|
-
},
|
|
8533
|
-
filterVisible ? {
|
|
8534
|
-
"label": instance.t('frontend_button_search_tooltip'),
|
|
8535
|
-
"icon": "fa fa-filter",
|
|
8536
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
8537
|
-
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
8538
|
-
// "tooltipPlacement": "top",
|
|
8539
|
-
"type": "button",
|
|
8540
|
-
"badge": {
|
|
8541
|
-
"offset": [
|
|
8542
|
-
-5,
|
|
8543
|
-
1
|
|
8544
|
-
],
|
|
8545
|
-
"size":8,
|
|
8546
|
-
"animation": true,
|
|
8547
|
-
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
8548
|
-
},
|
|
8549
|
-
"align": "right",
|
|
8550
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
8551
|
-
"onEvent": {
|
|
8552
|
-
"click": {
|
|
8553
|
-
"actions": [
|
|
8554
|
-
{
|
|
8555
|
-
"actionType": "custom",
|
|
8556
|
-
"script": onFieldsFilterToggleScript
|
|
8557
|
-
}
|
|
8558
|
-
]
|
|
8559
|
-
}
|
|
8560
|
-
}
|
|
8561
|
-
} : {},
|
|
8562
|
-
{
|
|
8563
|
-
"type": "reload",
|
|
8564
|
-
"align": "right",
|
|
8565
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
8566
|
-
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8567
|
-
"tooltip":"",
|
|
8568
|
-
"tooltipPlacement": "top",
|
|
8569
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
8570
|
-
},
|
|
8571
8455
|
// getExportExcelToolbarButtonSchema(),
|
|
8572
|
-
mainObject?.permissions?.allowCreateListViews ? getSettingListviewToolbarButtonSchema() : {},
|
|
8573
|
-
getDisplayAsButton(mainObject?.name),
|
|
8574
|
-
getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName }),
|
|
8575
8456
|
// {
|
|
8576
8457
|
// "type": "drag-toggler",
|
|
8577
8458
|
// "align": "right"
|
|
@@ -8772,10 +8653,8 @@ async function getDeferApi(field, ctx) {
|
|
|
8772
8653
|
}
|
|
8773
8654
|
|
|
8774
8655
|
function getRefListViewSort(refObject){
|
|
8775
|
-
|
|
8776
|
-
|
|
8777
|
-
(view, name) => name === "all"
|
|
8778
|
-
);
|
|
8656
|
+
let listView = getLookupListView(refObject);
|
|
8657
|
+
|
|
8779
8658
|
let sort = "";
|
|
8780
8659
|
if(listView){
|
|
8781
8660
|
sort = getListViewSort(listView);
|
|
@@ -8865,12 +8744,11 @@ const getReferenceTo = async (field)=>{
|
|
|
8865
8744
|
}
|
|
8866
8745
|
};
|
|
8867
8746
|
|
|
8868
|
-
function getLookupSapceUserTreeSchema(){
|
|
8869
|
-
const
|
|
8747
|
+
function getLookupSapceUserTreeSchema(isMobile){
|
|
8748
|
+
const treeSchema = {
|
|
8870
8749
|
"type": "input-tree",
|
|
8871
|
-
"className":
|
|
8750
|
+
"className":"steedos-select-user-tree",
|
|
8872
8751
|
"inputClassName": "p-0",
|
|
8873
|
-
"id": "u:7fd77b7915b0",
|
|
8874
8752
|
"source": {
|
|
8875
8753
|
"method": "post",
|
|
8876
8754
|
"url": "${context.rootUrl}/graphql",
|
|
@@ -8901,6 +8779,10 @@ function getLookupSapceUserTreeSchema(){
|
|
|
8901
8779
|
});
|
|
8902
8780
|
listView.handleFilterSubmit(Object.assign({}, filterFormValues));
|
|
8903
8781
|
`
|
|
8782
|
+
},
|
|
8783
|
+
{
|
|
8784
|
+
"actionType": "custom",
|
|
8785
|
+
"script": " if(window.innerWidth < 768){ document.querySelector('.steedos-select-user-sidebar').classList.remove('steedos-select-user-sidebar-open'); }"
|
|
8904
8786
|
}
|
|
8905
8787
|
]
|
|
8906
8788
|
}
|
|
@@ -8925,18 +8807,56 @@ function getLookupSapceUserTreeSchema(){
|
|
|
8925
8807
|
"placeholder": "查找部门"
|
|
8926
8808
|
},
|
|
8927
8809
|
"unfoldedLevel": 2,
|
|
8928
|
-
"style": {
|
|
8929
|
-
"max-height": "100%",
|
|
8930
|
-
"position": "absolute",
|
|
8931
|
-
"left": "-330px",
|
|
8932
|
-
"width": "320px",
|
|
8933
|
-
"bottom": 0,
|
|
8934
|
-
"top": "0",
|
|
8935
|
-
"overflow": "auto",
|
|
8936
|
-
"min-height":"300px"
|
|
8937
|
-
},
|
|
8938
8810
|
"originPosition": "left-top"
|
|
8939
|
-
}
|
|
8811
|
+
};
|
|
8812
|
+
const tree = [];
|
|
8813
|
+
if(isMobile){
|
|
8814
|
+
tree.push({
|
|
8815
|
+
type: "action",
|
|
8816
|
+
body:[
|
|
8817
|
+
{
|
|
8818
|
+
type: "action",
|
|
8819
|
+
body:[
|
|
8820
|
+
treeSchema
|
|
8821
|
+
],
|
|
8822
|
+
className:"h-full w-[240px]"
|
|
8823
|
+
}
|
|
8824
|
+
],
|
|
8825
|
+
className: "absolute inset-0 steedos-select-user-sidebar",
|
|
8826
|
+
"onEvent": {
|
|
8827
|
+
"click": {
|
|
8828
|
+
"actions": [
|
|
8829
|
+
{
|
|
8830
|
+
"actionType": "custom",
|
|
8831
|
+
"script": "document.querySelector('.steedos-select-user-sidebar').classList.remove('steedos-select-user-sidebar-open')"
|
|
8832
|
+
}
|
|
8833
|
+
]
|
|
8834
|
+
}
|
|
8835
|
+
},
|
|
8836
|
+
id: "steedos_crud_toolbar_select_user_tree"
|
|
8837
|
+
});
|
|
8838
|
+
tree.push({
|
|
8839
|
+
"type": "button",
|
|
8840
|
+
"label": "组织",
|
|
8841
|
+
"icon": "fa fa-sitemap",
|
|
8842
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
8843
|
+
"align": "left",
|
|
8844
|
+
"onEvent": {
|
|
8845
|
+
"click": {
|
|
8846
|
+
"actions": [
|
|
8847
|
+
{
|
|
8848
|
+
"actionType": "custom",
|
|
8849
|
+
"script": "document.querySelector('.steedos-select-user-sidebar').classList.toggle('steedos-select-user-sidebar-open')"
|
|
8850
|
+
}
|
|
8851
|
+
]
|
|
8852
|
+
}
|
|
8853
|
+
},
|
|
8854
|
+
"id": "steedos_crud_toolbar_organization_button"
|
|
8855
|
+
});
|
|
8856
|
+
}else {
|
|
8857
|
+
tree.push(treeSchema);
|
|
8858
|
+
}
|
|
8859
|
+
|
|
8940
8860
|
return tree;
|
|
8941
8861
|
}
|
|
8942
8862
|
|
|
@@ -8951,24 +8871,19 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
8951
8871
|
ctx.objectName = refObjectConfig.name;
|
|
8952
8872
|
|
|
8953
8873
|
let tableFields = [];
|
|
8954
|
-
let i = 0;
|
|
8955
8874
|
const searchableFields = [];
|
|
8956
8875
|
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
const listName = "all";
|
|
8876
|
+
let fieldsArr = [];
|
|
8960
8877
|
|
|
8961
8878
|
const isMobile = window.innerWidth < 768;
|
|
8962
8879
|
|
|
8963
|
-
|
|
8964
|
-
|
|
8965
|
-
(listView, name) => name === listName
|
|
8966
|
-
);
|
|
8880
|
+
let listView = getLookupListView(refObjectConfig);
|
|
8881
|
+
let listName = listView && listView.name;
|
|
8967
8882
|
if (listView && listView.columns) {
|
|
8968
|
-
|
|
8969
|
-
if (
|
|
8883
|
+
_$1__namespace.each(listView.columns, function (column) {
|
|
8884
|
+
if (_$1__namespace.isString(column) && refObjectConfig.fields[column]) {
|
|
8970
8885
|
fieldsArr.push(refObjectConfig.fields[column]);
|
|
8971
|
-
} else if (
|
|
8886
|
+
} else if (_$1__namespace.isObject(column) && refObjectConfig.fields[column.field]) {
|
|
8972
8887
|
fieldsArr.push(
|
|
8973
8888
|
Object.assign({}, refObjectConfig.fields[column.field], {
|
|
8974
8889
|
width: column.width,
|
|
@@ -8978,28 +8893,27 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
8978
8893
|
}
|
|
8979
8894
|
});
|
|
8980
8895
|
}else {
|
|
8981
|
-
|
|
8896
|
+
_$1__namespace.each(refObjectConfig.fields, (field, field_name)=>{
|
|
8982
8897
|
if(field_name != '_id' && !field.hidden){
|
|
8983
|
-
if(!
|
|
8898
|
+
if(!_$1__namespace.has(field, "name")){
|
|
8984
8899
|
field.name = field_name;
|
|
8985
8900
|
}
|
|
8986
8901
|
fieldsArr.push(field);
|
|
8987
8902
|
}
|
|
8988
8903
|
});
|
|
8904
|
+
// 没有视图权限时,取对象上前5个字段,按sort_no排序
|
|
8905
|
+
fieldsArr = _$1__namespace.sortBy(fieldsArr, "sort_no").slice(0,5);
|
|
8989
8906
|
}
|
|
8990
8907
|
|
|
8991
|
-
|
|
8992
|
-
if(
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
i++;
|
|
8997
|
-
tableFields.push(field);
|
|
8998
|
-
}
|
|
8908
|
+
_$1__namespace.each(fieldsArr,function(field){
|
|
8909
|
+
if(!_$1__namespace.find(tableFields, function(f){
|
|
8910
|
+
return f.name === field.name
|
|
8911
|
+
})){
|
|
8912
|
+
tableFields.push(field);
|
|
8999
8913
|
}
|
|
9000
8914
|
});
|
|
9001
8915
|
|
|
9002
|
-
|
|
8916
|
+
_$1__namespace.each(refObjectConfig.fields, function (field) {
|
|
9003
8917
|
if(isFieldQuickSearchable(field, refObjectConfig.NAME_FIELD_KEY)){
|
|
9004
8918
|
searchableFields.push(field.name);
|
|
9005
8919
|
}
|
|
@@ -9010,7 +8924,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
9010
8924
|
[referenceTo.valueField.name]: referenceTo.valueField
|
|
9011
8925
|
};
|
|
9012
8926
|
|
|
9013
|
-
|
|
8927
|
+
_$1__namespace.each(tableFields, (tableField)=>{
|
|
9014
8928
|
if(!tableField.hidden){
|
|
9015
8929
|
fields[tableField.name] = tableField;
|
|
9016
8930
|
}
|
|
@@ -9026,7 +8940,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
9026
8940
|
if(source.url && !ctx.inFilterForm){
|
|
9027
8941
|
const depend_on = [];
|
|
9028
8942
|
const sendOn = [];
|
|
9029
|
-
|
|
8943
|
+
_$1__namespace.each(field.depend_on, (fName)=>{
|
|
9030
8944
|
depend_on.push(`depend_on_${fName}=\${${fName}}`);
|
|
9031
8945
|
sendOn.push(`this.${fName}`);
|
|
9032
8946
|
});
|
|
@@ -9189,13 +9103,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
9189
9103
|
}
|
|
9190
9104
|
|
|
9191
9105
|
let pickerSchema = null;
|
|
9192
|
-
|
|
9193
|
-
pickerSchema = await getListSchema$1(tableFields, {
|
|
9194
|
-
top: top,
|
|
9195
|
-
...ctx,
|
|
9196
|
-
actions: false
|
|
9197
|
-
});
|
|
9198
|
-
}else {
|
|
9106
|
+
{
|
|
9199
9107
|
pickerSchema = await getTableSchema$1(tableFields, {
|
|
9200
9108
|
labelFieldName: refObjectConfig.NAME_FIELD_KEY,
|
|
9201
9109
|
top: top,
|
|
@@ -9206,13 +9114,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
9206
9114
|
pickerSchema.affixHeader = false;
|
|
9207
9115
|
|
|
9208
9116
|
var headerToolbarItems = [];
|
|
9209
|
-
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"
|
|
9210
|
-
|
|
9211
|
-
|
|
9212
|
-
"margin-left":"330px",
|
|
9213
|
-
"min-height": "300px"
|
|
9214
|
-
};
|
|
9215
|
-
pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
|
|
9117
|
+
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
|
|
9118
|
+
headerToolbarItems = getLookupSapceUserTreeSchema(isMobile);
|
|
9119
|
+
pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
|
|
9216
9120
|
}
|
|
9217
9121
|
|
|
9218
9122
|
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
|
|
@@ -9308,13 +9212,25 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
9308
9212
|
pickerSchema = Object.assign({}, pickerSchema, field.pickerSchema);
|
|
9309
9213
|
}
|
|
9310
9214
|
|
|
9215
|
+
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && isMobile){
|
|
9216
|
+
//手机端选人控件只保留部分toolbar
|
|
9217
|
+
pickerSchema.headerToolbar = pickerSchema.headerToolbar && pickerSchema.headerToolbar.filter(function(item){
|
|
9218
|
+
if(["steedos_crud_toolbar_quick_search","steedos_crud_toolbar_filter","steedos_crud_toolbar_select_user_tree","steedos_crud_toolbar_organization_button"].indexOf(item.id) > -1){
|
|
9219
|
+
return true;
|
|
9220
|
+
}else {
|
|
9221
|
+
return false;
|
|
9222
|
+
}
|
|
9223
|
+
});
|
|
9224
|
+
pickerSchema.footerToolbar = ["pagination"];
|
|
9225
|
+
}
|
|
9226
|
+
|
|
9311
9227
|
const data = {
|
|
9312
9228
|
type: getAmisStaticFieldType('picker', readonly),
|
|
9313
9229
|
modalTitle: instance.t('frontend_form_please_select') + " " + refObjectConfig.label,
|
|
9314
9230
|
labelField: referenceTo.labelField.name,
|
|
9315
9231
|
valueField: referenceTo.valueField.name,
|
|
9316
|
-
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey
|
|
9317
|
-
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
|
|
9232
|
+
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
|
|
9233
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
9318
9234
|
modalMode: 'dialog', //TODO 设置 dialog 或者 drawer,用来配置弹出方式
|
|
9319
9235
|
source: source,
|
|
9320
9236
|
size: "lg",
|
|
@@ -9380,10 +9296,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
9380
9296
|
}
|
|
9381
9297
|
|
|
9382
9298
|
const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
|
|
9383
|
-
|
|
9384
|
-
refObjectConfig.list_views,
|
|
9385
|
-
(listView, name) => name === "all"
|
|
9386
|
-
);
|
|
9299
|
+
let listView = getLookupListView(refObjectConfig);
|
|
9387
9300
|
|
|
9388
9301
|
let sort = "";
|
|
9389
9302
|
if(listView){
|
|
@@ -9394,7 +9307,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
9394
9307
|
if(apiInfo.url && !ctx.inFilterForm){
|
|
9395
9308
|
const depend_on = [];
|
|
9396
9309
|
const sendOn = [];
|
|
9397
|
-
|
|
9310
|
+
_$1__namespace.each(field.depend_on, (fName)=>{
|
|
9398
9311
|
depend_on.push(`depend_on_${fName}=\${${fName}}`);
|
|
9399
9312
|
sendOn.push(`this.${fName}`);
|
|
9400
9313
|
});
|
|
@@ -9407,7 +9320,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
9407
9320
|
apiInfo.data.$term = "$term";
|
|
9408
9321
|
// apiInfo.data.$value = `$${field.name}.${referenceTo ? referenceTo.valueField.name : '_id'}`;
|
|
9409
9322
|
apiInfo.data.$value = ctx.isRefToMutiple ? `$${field.name}.ids` : `$${field.name}`;
|
|
9410
|
-
|
|
9323
|
+
_$1__namespace.each(field.depend_on, function(fName){
|
|
9411
9324
|
apiInfo.data[fName] = `$${fName}`;
|
|
9412
9325
|
});
|
|
9413
9326
|
apiInfo.data['$'] = `$$`;
|
|
@@ -9494,8 +9407,8 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
9494
9407
|
joinValues: false,
|
|
9495
9408
|
extractValue: true,
|
|
9496
9409
|
clearable: true,
|
|
9497
|
-
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey
|
|
9498
|
-
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
|
|
9410
|
+
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
|
|
9411
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
9499
9412
|
// labelField: labelField,
|
|
9500
9413
|
// valueField: valueField,
|
|
9501
9414
|
source: apiInfo,
|
|
@@ -9548,7 +9461,7 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
9548
9461
|
tpl: getRelatedFieldTpl(field, ctx)
|
|
9549
9462
|
}
|
|
9550
9463
|
}
|
|
9551
|
-
if(field.reference_to && !
|
|
9464
|
+
if(field.reference_to && !_$1__namespace.isString(field.reference_to) && !readonly){
|
|
9552
9465
|
return {
|
|
9553
9466
|
type: 'steedos-field-lookup',
|
|
9554
9467
|
field,
|
|
@@ -9564,6 +9477,7 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
9564
9477
|
}
|
|
9565
9478
|
|
|
9566
9479
|
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
|
|
9480
|
+
ctx.onlyDisplayLookLabel = true;
|
|
9567
9481
|
if(ctx.idsDependOn){
|
|
9568
9482
|
// ids人员点选模式
|
|
9569
9483
|
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
@@ -9577,7 +9491,7 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
9577
9491
|
// 此处不参考 steedos 的 enable_enhanced_lookup 规则. 如果默认是开启弹出选择,用户选择过程操作太繁琐, 所以默认是关闭弹出选择.
|
|
9578
9492
|
// 由于amis picker 目前不支持联动, 配置了depend_on时, 使用使用select ,以支持联动
|
|
9579
9493
|
// TODO: 确认 amis picker 支持联动时, 清理field.depend_on判断
|
|
9580
|
-
if(refObject.enable_enhanced_lookup == true &&
|
|
9494
|
+
if(refObject.enable_enhanced_lookup == true && _$1__namespace.isEmpty(field.depend_on)){
|
|
9581
9495
|
return await lookupToAmisPicker(field, readonly, ctx);
|
|
9582
9496
|
}else if(refObject.enable_tree) {
|
|
9583
9497
|
return await lookupToAmisTreeSelect(field, readonly, Object.assign({}, ctx, {
|
|
@@ -9617,7 +9531,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
9617
9531
|
|
|
9618
9532
|
const tableFields = [referenceTo.labelField];
|
|
9619
9533
|
|
|
9620
|
-
const source = await getApi$1(refObjectConfig, null, fields, {expand: true, alias: 'rows', queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}`});
|
|
9534
|
+
const source = await getApi$1(refObjectConfig, null, fields, {expand: true, alias: 'rows', queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
|
|
9621
9535
|
|
|
9622
9536
|
source.data.$term = "$term";
|
|
9623
9537
|
source.data.$self = "$$";
|
|
@@ -9626,6 +9540,12 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
9626
9540
|
source.sendOn = `\${${idsDependOn} && ${idsDependOn}.length}`;
|
|
9627
9541
|
source.url = `${source.url}&depend_on_${idsDependOn}=\${${idsDependOn}|join}`;
|
|
9628
9542
|
}
|
|
9543
|
+
|
|
9544
|
+
let listView = getLookupListView(refObjectConfig);
|
|
9545
|
+
let sort = "";
|
|
9546
|
+
if(listView){
|
|
9547
|
+
sort = getListViewSort(listView);
|
|
9548
|
+
}
|
|
9629
9549
|
|
|
9630
9550
|
source.requestAdaptor = `
|
|
9631
9551
|
const selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
@@ -9633,6 +9553,10 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
9633
9553
|
var pageSize = api.data.pageSize || 1000;
|
|
9634
9554
|
var pageNo = api.data.pageNo || 1;
|
|
9635
9555
|
var skip = (pageNo - 1) * pageSize;
|
|
9556
|
+
var orderBy = api.data.orderBy || '';
|
|
9557
|
+
var orderDir = api.data.orderDir || '';
|
|
9558
|
+
var sort = orderBy + ' ' + orderDir;
|
|
9559
|
+
sort = orderBy ? sort : "${sort}";
|
|
9636
9560
|
if(selfData.op === 'loadOptions' && selfData.value){
|
|
9637
9561
|
if(selfData.value && selfData.value.indexOf(',') > 0){
|
|
9638
9562
|
filters = [["${referenceTo.valueField.name}", "=", selfData.value.split(',')]];
|
|
@@ -9650,7 +9574,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
9650
9574
|
filters.push(["${referenceTo.valueField.name}", "=", ids]);
|
|
9651
9575
|
}
|
|
9652
9576
|
|
|
9653
|
-
api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip);
|
|
9577
|
+
api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim());
|
|
9654
9578
|
return api;
|
|
9655
9579
|
`;
|
|
9656
9580
|
|
|
@@ -9667,6 +9591,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
9667
9591
|
pickerSchema = await getTableSchema$1(tableFields, {
|
|
9668
9592
|
labelFieldName: refObjectConfig.NAME_FIELD_KEY,
|
|
9669
9593
|
top: top,
|
|
9594
|
+
isLookup: true,
|
|
9670
9595
|
...ctx
|
|
9671
9596
|
});
|
|
9672
9597
|
|
|
@@ -9680,8 +9605,8 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
9680
9605
|
valueField: referenceTo.valueField.name,
|
|
9681
9606
|
modalMode: 'dialog',
|
|
9682
9607
|
source: source,
|
|
9683
|
-
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey
|
|
9684
|
-
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
|
|
9608
|
+
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
|
|
9609
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
9685
9610
|
size: "lg",
|
|
9686
9611
|
pickerSchema: pickerSchema,
|
|
9687
9612
|
joinValues: false,
|
|
@@ -9709,8 +9634,8 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
9709
9634
|
/*
|
|
9710
9635
|
* @Author: baozhoutao@steedos.com
|
|
9711
9636
|
* @Date: 2023-01-13 17:27:54
|
|
9712
|
-
* @LastEditors:
|
|
9713
|
-
* @LastEditTime: 2023-
|
|
9637
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
9638
|
+
* @LastEditTime: 2023-08-28 17:45:38
|
|
9714
9639
|
* @Description:
|
|
9715
9640
|
*/
|
|
9716
9641
|
|
|
@@ -9772,18 +9697,47 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
|
|
|
9772
9697
|
|
|
9773
9698
|
const getHtmlFieldSchema = (field, readonly, ctx)=>{
|
|
9774
9699
|
if(readonly){
|
|
9700
|
+
// return {
|
|
9701
|
+
// "type": "control",
|
|
9702
|
+
// "label": field.label,
|
|
9703
|
+
// "body": {
|
|
9704
|
+
// "type": "html",
|
|
9705
|
+
// "name": field.name
|
|
9706
|
+
// }
|
|
9707
|
+
// }
|
|
9775
9708
|
return {
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9709
|
+
"type": "input-rich-text",
|
|
9710
|
+
"receiver": "${context.rootUrl}/s3/images",
|
|
9711
|
+
"name": field.name,
|
|
9712
|
+
"options": {
|
|
9713
|
+
"menu": {
|
|
9714
|
+
"insert": {
|
|
9715
|
+
"title": "Insert",
|
|
9716
|
+
"items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
|
|
9717
|
+
}
|
|
9718
|
+
},
|
|
9719
|
+
"plugins": [
|
|
9720
|
+
"autoresize"
|
|
9721
|
+
],
|
|
9722
|
+
// "max_height": 2000,
|
|
9723
|
+
"statusbar": false,
|
|
9724
|
+
"readonly": true,
|
|
9725
|
+
"toolbar": false,
|
|
9726
|
+
"menubar": false
|
|
9782
9727
|
}
|
|
9728
|
+
}
|
|
9783
9729
|
}else {
|
|
9784
9730
|
return {
|
|
9785
9731
|
"type": "input-rich-text",
|
|
9786
9732
|
"receiver": "${context.rootUrl}/s3/images",
|
|
9733
|
+
"options":{
|
|
9734
|
+
"menu": {
|
|
9735
|
+
"insert": {
|
|
9736
|
+
"title": "Insert",
|
|
9737
|
+
"items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
|
|
9738
|
+
}
|
|
9739
|
+
}
|
|
9740
|
+
},
|
|
9787
9741
|
"name": field.name
|
|
9788
9742
|
}
|
|
9789
9743
|
// return {
|
|
@@ -9829,14 +9783,17 @@ const AmisFormInputs = [
|
|
|
9829
9783
|
|
|
9830
9784
|
function getAmisStaticFieldType(type, readonly, options){
|
|
9831
9785
|
if(!readonly){
|
|
9832
|
-
if(
|
|
9786
|
+
if(_$1__namespace.includes(AmisFormInputs, type)){
|
|
9833
9787
|
return `input-${type}`;
|
|
9834
9788
|
}else if(type === 'location'){
|
|
9835
9789
|
return "location-picker"
|
|
9836
9790
|
}
|
|
9837
9791
|
return type;
|
|
9838
9792
|
}
|
|
9839
|
-
if(
|
|
9793
|
+
if(_$1__namespace.includes(['text','image'], type)){
|
|
9794
|
+
if('text' === type && options && options.amis && options.amis.tpl){
|
|
9795
|
+
return 'static';
|
|
9796
|
+
}
|
|
9840
9797
|
if('image' === type && options && options.multiple){
|
|
9841
9798
|
return `static-images`;
|
|
9842
9799
|
}
|
|
@@ -10026,8 +9983,8 @@ function getAmisFieldType(sField){
|
|
|
10026
9983
|
}
|
|
10027
9984
|
function getObjectFieldSubFields(mainField, fields){
|
|
10028
9985
|
const newMainField = Object.assign({subFields: []}, mainField);
|
|
10029
|
-
const subFields =
|
|
10030
|
-
let result = field.name.startsWith(`${mainField.name}.`) &&
|
|
9986
|
+
const subFields = _$1__namespace.filter(fields, function(field){
|
|
9987
|
+
let result = field.name.startsWith(`${mainField.name}.`) && _$1__namespace.split(field.name, ".").length < 3;
|
|
10031
9988
|
if(result){
|
|
10032
9989
|
field._prefix = `${mainField.name}.`;
|
|
10033
9990
|
}
|
|
@@ -10039,7 +9996,7 @@ function getObjectFieldSubFields(mainField, fields){
|
|
|
10039
9996
|
|
|
10040
9997
|
function getGridFieldSubFields(mainField, fields){
|
|
10041
9998
|
const newMainField = Object.assign({subFields: []}, mainField);
|
|
10042
|
-
const subFields =
|
|
9999
|
+
const subFields = _$1__namespace.filter(fields, function(field){
|
|
10043
10000
|
let result = field.name.startsWith(`${mainField.name}.`);
|
|
10044
10001
|
if(result){
|
|
10045
10002
|
field._prefix = `${mainField.name}.`;
|
|
@@ -10058,13 +10015,13 @@ function getGridFieldSubFields(mainField, fields){
|
|
|
10058
10015
|
function getPermissionFields(object, userSession){
|
|
10059
10016
|
const permissionFields = [];
|
|
10060
10017
|
const fieldsArr = [];
|
|
10061
|
-
|
|
10062
|
-
if(!
|
|
10018
|
+
_$1__namespace.each(object.fields , (field, field_name)=>{
|
|
10019
|
+
if(!_$1__namespace.has(field, "name")){
|
|
10063
10020
|
field.name = field_name;
|
|
10064
10021
|
}
|
|
10065
10022
|
fieldsArr.push(field);
|
|
10066
10023
|
});
|
|
10067
|
-
|
|
10024
|
+
_$1__namespace.each(_$1__namespace.sortBy(fieldsArr, "sort_no"), function(field){
|
|
10068
10025
|
if(!field.hidden){
|
|
10069
10026
|
permissionFields.push( Object.assign({}, field, {permission: {allowEdit: true}}));
|
|
10070
10027
|
}
|
|
@@ -10076,7 +10033,7 @@ function getGridFieldSubFields(mainField, fields){
|
|
|
10076
10033
|
function getSelectFieldOptions(field){
|
|
10077
10034
|
const dataType = field.data_type || 'text';
|
|
10078
10035
|
const options = [];
|
|
10079
|
-
|
|
10036
|
+
_$1__namespace.each(field.options, (item)=>{
|
|
10080
10037
|
switch (dataType) {
|
|
10081
10038
|
case 'number':
|
|
10082
10039
|
options.push({label: item.label, value: Number(item.value), icon: item.icon});
|
|
@@ -10096,10 +10053,10 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
10096
10053
|
// console.log('convertSFieldToAmisField====>', field, readonly, ctx)
|
|
10097
10054
|
const isMobile = window.innerWidth <= 768;
|
|
10098
10055
|
// 创建人和修改人、创建时间和修改时间不显示
|
|
10099
|
-
if(
|
|
10056
|
+
if(_$1__namespace.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
|
|
10100
10057
|
return;
|
|
10101
10058
|
}
|
|
10102
|
-
const baseData = {name: ctx.fieldNamePrefix ? `${ctx.fieldNamePrefix}${field.name}` : field.name, label: field.label, labelRemark: field.inlineHelpText, required:
|
|
10059
|
+
const baseData = {name: ctx.fieldNamePrefix ? `${ctx.fieldNamePrefix}${field.name}` : field.name, label: field.label, labelRemark: field.inlineHelpText, required: _$1__namespace.has(ctx, 'required') ? ctx.required : field.required};
|
|
10103
10060
|
let convertData = {
|
|
10104
10061
|
};
|
|
10105
10062
|
// if(_.includes(OMIT_FIELDS, field.name)){
|
|
@@ -10107,7 +10064,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
10107
10064
|
// }
|
|
10108
10065
|
switch (field.type) {
|
|
10109
10066
|
case 'text':
|
|
10110
|
-
convertData.type = getAmisStaticFieldType('text', readonly);
|
|
10067
|
+
convertData.type = getAmisStaticFieldType('text', readonly, field);
|
|
10111
10068
|
break;
|
|
10112
10069
|
case 'textarea':
|
|
10113
10070
|
convertData.type = getAmisStaticFieldType('textarea', readonly);
|
|
@@ -10547,14 +10504,14 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
10547
10504
|
}
|
|
10548
10505
|
break;
|
|
10549
10506
|
}
|
|
10550
|
-
if(!
|
|
10507
|
+
if(!_$1__namespace.isEmpty(convertData)){
|
|
10551
10508
|
if(field.is_wide || convertData.type === 'group'){
|
|
10552
10509
|
convertData.className = 'col-span-2 m-1';
|
|
10553
10510
|
}else {
|
|
10554
10511
|
convertData.className = 'm-1';
|
|
10555
10512
|
}
|
|
10556
10513
|
if(readonly){
|
|
10557
|
-
convertData.className = `${convertData.className}
|
|
10514
|
+
convertData.className = `${convertData.className} border-b`;
|
|
10558
10515
|
}
|
|
10559
10516
|
if(readonly){
|
|
10560
10517
|
convertData.quickEdit = false;
|
|
@@ -10576,7 +10533,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
10576
10533
|
}
|
|
10577
10534
|
}
|
|
10578
10535
|
|
|
10579
|
-
if(
|
|
10536
|
+
if(_$1__namespace.isString(baseData.required)){
|
|
10580
10537
|
if(baseData.required.startsWith("{{")){
|
|
10581
10538
|
baseData.requiredOn = `${baseData.required.substring(2, baseData.required.length -2).replace(/formData./g, 'data.')}`;
|
|
10582
10539
|
delete baseData.required;
|
|
@@ -10609,12 +10566,12 @@ async function getFieldSearchable(perField, permissionFields, ctx){
|
|
|
10609
10566
|
|
|
10610
10567
|
let fieldNamePrefix = '__searchable__';
|
|
10611
10568
|
if(field.name.indexOf(".") < 0){
|
|
10612
|
-
let _field =
|
|
10613
|
-
if(
|
|
10569
|
+
let _field = _$1.cloneDeep(field);
|
|
10570
|
+
if(_$1.includes(['textarea', 'html', 'code', 'autonumber'], field.type)){
|
|
10614
10571
|
_field.type = 'text';
|
|
10615
10572
|
}
|
|
10616
10573
|
|
|
10617
|
-
if(
|
|
10574
|
+
if(_$1.includes(['formula', 'summary'], field.type)){
|
|
10618
10575
|
_field.type = field.data_type;
|
|
10619
10576
|
_field.precision = field.precision;
|
|
10620
10577
|
_field.scale = field.scale;
|
|
@@ -10691,7 +10648,7 @@ if(typeof window != 'undefined'){
|
|
|
10691
10648
|
|
|
10692
10649
|
|
|
10693
10650
|
function isFieldTypeSearchable(fieldType) {
|
|
10694
|
-
return !
|
|
10651
|
+
return !_$1__namespace.includes(
|
|
10695
10652
|
[
|
|
10696
10653
|
"grid",
|
|
10697
10654
|
"avatar",
|
|
@@ -10763,7 +10720,7 @@ async function getQuickEditSchema(field, options){
|
|
|
10763
10720
|
if (field.disabled) {
|
|
10764
10721
|
quickEditSchema = false;
|
|
10765
10722
|
} else {
|
|
10766
|
-
var fieldSchema = await convertSFieldToAmisField(field, false,
|
|
10723
|
+
var fieldSchema = await convertSFieldToAmisField(field, false, _$1__namespace.omit(options, 'buttons'));
|
|
10767
10724
|
//存在属性上可编辑,实际不可编辑的字段,convertSFieldToAmisField函数可能会返回undefined,如summary
|
|
10768
10725
|
if (!!fieldSchema) {
|
|
10769
10726
|
quickEditSchema.body.push(fieldSchema);
|
|
@@ -11024,7 +10981,10 @@ function getFieldWidth(width){
|
|
|
11024
10981
|
}
|
|
11025
10982
|
|
|
11026
10983
|
async function getTableColumns$1(fields, options){
|
|
11027
|
-
const columns = [
|
|
10984
|
+
const columns = [];
|
|
10985
|
+
if(!options.isLookup){
|
|
10986
|
+
columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
|
|
10987
|
+
}
|
|
11028
10988
|
const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
|
|
11029
10989
|
|
|
11030
10990
|
for (const field of fields) {
|
|
@@ -11160,7 +11120,7 @@ async function getTableColumns$1(fields, options){
|
|
|
11160
11120
|
}
|
|
11161
11121
|
}
|
|
11162
11122
|
// columns.push(getOperation(fields));
|
|
11163
|
-
if(!
|
|
11123
|
+
if(!_$1__namespace.some(columns, { name: options.labelFieldName })){
|
|
11164
11124
|
const href = Router$1.getObjectDetailPath({
|
|
11165
11125
|
...options, formFactor: options.formFactor, appId: "${appId}", objectName: options.objectName || "${objectName}", recordId: `\${${options.idFieldName}}`
|
|
11166
11126
|
});
|
|
@@ -11259,7 +11219,7 @@ async function getMobileTableColumns(fields, options){
|
|
|
11259
11219
|
let tpl = "";
|
|
11260
11220
|
if(field.is_name || field.name === options.labelFieldName){
|
|
11261
11221
|
nameField = field;
|
|
11262
|
-
options.
|
|
11222
|
+
options.onlyDisplayLookLabel = true;
|
|
11263
11223
|
tpl = await getFieldTpl(field, options);
|
|
11264
11224
|
}
|
|
11265
11225
|
else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
|
|
@@ -11268,12 +11228,13 @@ async function getMobileTableColumns(fields, options){
|
|
|
11268
11228
|
}
|
|
11269
11229
|
else {
|
|
11270
11230
|
if(field.type === 'lookup' || field.type === 'master_detail'){
|
|
11271
|
-
options.
|
|
11231
|
+
options.onlyDisplayLookLabel = true;
|
|
11272
11232
|
}
|
|
11273
11233
|
tpl = await getFieldTpl(field, options);
|
|
11274
11234
|
}
|
|
11275
11235
|
if(!tpl){
|
|
11276
|
-
|
|
11236
|
+
//qhd需求简易处理,加上raw以支持审批王名称字段通过颜色区分缓急,若之后手机端列表支持配置amis,则可以去掉
|
|
11237
|
+
tpl = `\${${field.name} | raw}`;
|
|
11277
11238
|
}
|
|
11278
11239
|
if(!field.hidden && !field.extra){
|
|
11279
11240
|
tpls.push({ field, tpl });
|
|
@@ -11373,7 +11334,7 @@ function getButtonVisibleOn(button){
|
|
|
11373
11334
|
visible = button._visible;
|
|
11374
11335
|
}
|
|
11375
11336
|
|
|
11376
|
-
if(
|
|
11337
|
+
if(_$1.isBoolean(visible)){
|
|
11377
11338
|
visible = visible.toString();
|
|
11378
11339
|
}
|
|
11379
11340
|
|
|
@@ -11400,8 +11361,8 @@ function getButtonVisibleOn(button){
|
|
|
11400
11361
|
async function getTableOperation(ctx){
|
|
11401
11362
|
const buttons = ctx.buttons;
|
|
11402
11363
|
const operationButtons = [];
|
|
11403
|
-
|
|
11404
|
-
if(
|
|
11364
|
+
_$1.each(buttons, (button)=>{
|
|
11365
|
+
if(_$1.isBoolean(button.visible)){
|
|
11405
11366
|
button.visible = button.visible.toString();
|
|
11406
11367
|
}
|
|
11407
11368
|
// operationButtons.push({
|
|
@@ -11469,7 +11430,12 @@ async function getTableSchema$1(fields, options){
|
|
|
11469
11430
|
options = {};
|
|
11470
11431
|
}
|
|
11471
11432
|
let columns = [];
|
|
11472
|
-
|
|
11433
|
+
let useMobileColumns = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
|
|
11434
|
+
if(isLookup){
|
|
11435
|
+
// 在lookup手机端列表模式调式好之前不使用getMobileTableColumns
|
|
11436
|
+
useMobileColumns = false;
|
|
11437
|
+
}
|
|
11438
|
+
if(useMobileColumns){
|
|
11473
11439
|
columns = await getMobileTableColumns(fields, options);
|
|
11474
11440
|
}
|
|
11475
11441
|
else {
|
|
@@ -11489,7 +11455,7 @@ async function getTableSchema$1(fields, options){
|
|
|
11489
11455
|
columns: columns,
|
|
11490
11456
|
syncLocation: false,
|
|
11491
11457
|
keepItemSelectionOnPageChange: true,
|
|
11492
|
-
checkOnItemClick: false,
|
|
11458
|
+
checkOnItemClick: isLookup ? true : false,
|
|
11493
11459
|
labelTpl: `\${${options.labelFieldName}}`,
|
|
11494
11460
|
autoFillHeight: false, // 自动高度效果不理想,先关闭
|
|
11495
11461
|
columnsTogglable: false,
|
|
@@ -11509,8 +11475,8 @@ async function getTableApi(mainObject, fields, options){
|
|
|
11509
11475
|
const searchableFields = [];
|
|
11510
11476
|
let { filter, filtersFunction, sort, top, setDataToComponentId = '' } = options;
|
|
11511
11477
|
|
|
11512
|
-
if(
|
|
11513
|
-
filter =
|
|
11478
|
+
if(_$1__namespace.isArray(filter)){
|
|
11479
|
+
filter = _$1__namespace.map(filter, function(item){
|
|
11514
11480
|
if(item.operation){
|
|
11515
11481
|
return [item.field, item.operation, item.value];
|
|
11516
11482
|
}else {
|
|
@@ -11526,7 +11492,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
11526
11492
|
baseFilters = filter;
|
|
11527
11493
|
}
|
|
11528
11494
|
|
|
11529
|
-
|
|
11495
|
+
_$1__namespace.each(mainObject.fields, function (field) {
|
|
11530
11496
|
if (isFieldQuickSearchable(field, mainObject.NAME_FIELD_KEY)) {
|
|
11531
11497
|
searchableFields.push(field.name);
|
|
11532
11498
|
}
|
|
@@ -11537,7 +11503,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
11537
11503
|
// 含有optionsFunction属性, 无reference_to属性的lookup字段
|
|
11538
11504
|
const lookupFields = {};
|
|
11539
11505
|
fields.forEach((item)=>{
|
|
11540
|
-
if(
|
|
11506
|
+
if(_$1__namespace.includes(['image','avatar','file'], item.type)){
|
|
11541
11507
|
fileFieldsKeys.push(item.name);
|
|
11542
11508
|
fileFields[item.name] = {
|
|
11543
11509
|
name: item.name,
|
|
@@ -11545,7 +11511,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
11545
11511
|
multiple: item.multiple
|
|
11546
11512
|
};
|
|
11547
11513
|
}
|
|
11548
|
-
if(
|
|
11514
|
+
if(_$1__namespace.includes(['lookup'], item.type) && !item.reference_to ){
|
|
11549
11515
|
lookupFields[item.name] = item;
|
|
11550
11516
|
}
|
|
11551
11517
|
});
|
|
@@ -11720,7 +11686,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
11720
11686
|
sort: sort.trim(),
|
|
11721
11687
|
pageSize: pageSize,
|
|
11722
11688
|
skip: skip,
|
|
11723
|
-
fields: ${JSON.stringify(
|
|
11689
|
+
fields: ${JSON.stringify(_$1__namespace.map(fields, 'name'))}
|
|
11724
11690
|
}));
|
|
11725
11691
|
return api;
|
|
11726
11692
|
`;
|
|
@@ -11861,10 +11827,10 @@ const API_CACHE = 100;
|
|
|
11861
11827
|
|
|
11862
11828
|
function getReadonlyFormAdaptor(object, fields, options){
|
|
11863
11829
|
let scriptStr = '';
|
|
11864
|
-
const selectFields =
|
|
11865
|
-
const gridAndObjectFieldsName =
|
|
11866
|
-
|
|
11867
|
-
if(!
|
|
11830
|
+
const selectFields = _$1__namespace.filter(fields, function(field){return field.name.indexOf('.') < 0 && ((field.type == 'select' && field.options) || ((field.type == 'lookup' || field.type == 'master_detail') && !field.reference_to))});
|
|
11831
|
+
const gridAndObjectFieldsName = _$1__namespace.map(_$1__namespace.filter(fields, function(field){return field.name.indexOf('.') < 0 && (field.type === 'object' || field.type === 'grid')}), 'name');
|
|
11832
|
+
_$1__namespace.each(selectFields, function(field){
|
|
11833
|
+
if(!_$1__namespace.includes(OMIT_FIELDS, field.name)){
|
|
11868
11834
|
field.name;
|
|
11869
11835
|
if(field.options){
|
|
11870
11836
|
const options = JSON.stringify({options: field.options});
|
|
@@ -11897,7 +11863,7 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
11897
11863
|
// }
|
|
11898
11864
|
// })
|
|
11899
11865
|
|
|
11900
|
-
var fieldNames =
|
|
11866
|
+
var fieldNames = _$1__namespace.map(fields, function(n){return n.name});
|
|
11901
11867
|
return `
|
|
11902
11868
|
if(payload.data.data.length === 0){
|
|
11903
11869
|
var isEditor = !!${options && options.isEditor};
|
|
@@ -11970,7 +11936,7 @@ function getScriptForAddUrlPrefixForImgFields(fields){
|
|
|
11970
11936
|
let imgFieldsKeys = [];
|
|
11971
11937
|
let imgFields = {};
|
|
11972
11938
|
fields.forEach((item)=>{
|
|
11973
|
-
if(
|
|
11939
|
+
if(_$1__namespace.includes(['image','avatar'], item.type)){
|
|
11974
11940
|
imgFieldsKeys.push(item.name);
|
|
11975
11941
|
imgFields[item.name] = {
|
|
11976
11942
|
name: item.name,
|
|
@@ -12113,7 +12079,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
12113
12079
|
var defaultValues = {};
|
|
12114
12080
|
_.each(uiSchema && uiSchema.fields, function(field){
|
|
12115
12081
|
var value = SteedosUI.getFieldDefaultValue(field, api.body.global);
|
|
12116
|
-
if(value){
|
|
12082
|
+
if(!_.isNil(value)){
|
|
12117
12083
|
defaultValues[field.name] = value;
|
|
12118
12084
|
}
|
|
12119
12085
|
});
|
|
@@ -12227,8 +12193,8 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
12227
12193
|
top = 200;
|
|
12228
12194
|
}
|
|
12229
12195
|
|
|
12230
|
-
if (
|
|
12231
|
-
filter =
|
|
12196
|
+
if (_$1__default["default"].isArray(filter)) {
|
|
12197
|
+
filter = _$1__default["default"].map(filter, function (item) {
|
|
12232
12198
|
if (item.operation) {
|
|
12233
12199
|
return [item.field, item.operation, item.value];
|
|
12234
12200
|
} else {
|
|
@@ -12240,7 +12206,7 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
12240
12206
|
filter = [];
|
|
12241
12207
|
}
|
|
12242
12208
|
|
|
12243
|
-
|
|
12209
|
+
_$1__default["default"].each(fields, function (field) {
|
|
12244
12210
|
if (field.searchable) {
|
|
12245
12211
|
searchableFields.push(field.name);
|
|
12246
12212
|
}
|
|
@@ -12435,7 +12401,7 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
12435
12401
|
options = {};
|
|
12436
12402
|
}
|
|
12437
12403
|
|
|
12438
|
-
calendarOptions = Object.assign({}, DEFAULT_CALENDAR_OPTIONS,
|
|
12404
|
+
calendarOptions = Object.assign({}, DEFAULT_CALENDAR_OPTIONS, _$1.omitBy(calendarOptions, _$1.isNil));
|
|
12439
12405
|
|
|
12440
12406
|
const titleFields = calendarOptions.title || [
|
|
12441
12407
|
calendarOptions.startDateExpr,
|
|
@@ -12444,7 +12410,7 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
12444
12410
|
calendarOptions.textExpr
|
|
12445
12411
|
];
|
|
12446
12412
|
let fields = [];
|
|
12447
|
-
|
|
12413
|
+
_$1.each(titleFields, function (n) {
|
|
12448
12414
|
if (objectSchema.fields[n]) {
|
|
12449
12415
|
fields.push(objectSchema.fields[n]);
|
|
12450
12416
|
}
|
|
@@ -12586,10 +12552,10 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
12586
12552
|
startTime: '08:00',
|
|
12587
12553
|
endTime: '18:00',
|
|
12588
12554
|
};
|
|
12589
|
-
if (!
|
|
12555
|
+
if (!_$1.isEmpty(calendarOptions.startDayHour)) {
|
|
12590
12556
|
businessHours.startTime = `${calendarOptions.startDayHour}:00`;
|
|
12591
12557
|
}
|
|
12592
|
-
if (!
|
|
12558
|
+
if (!_$1.isEmpty(calendarOptions.endDayHour)) {
|
|
12593
12559
|
businessHours.endTime = `${calendarOptions.endDayHour}:00`;
|
|
12594
12560
|
}
|
|
12595
12561
|
|
|
@@ -12771,16 +12737,17 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
12771
12737
|
/*
|
|
12772
12738
|
* @Author: baozhoutao@steedos.com
|
|
12773
12739
|
* @Date: 2022-05-26 16:02:08
|
|
12774
|
-
* @LastEditors:
|
|
12775
|
-
* @LastEditTime: 2023-
|
|
12740
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
12741
|
+
* @LastEditTime: 2023-09-05 15:42:26
|
|
12776
12742
|
* @Description:
|
|
12777
12743
|
*/
|
|
12778
12744
|
|
|
12779
|
-
const getFieldSchemaArray = (formFields) => {
|
|
12745
|
+
const getFieldSchemaArray = (formFields, ctx) => {
|
|
12780
12746
|
let fieldSchemaArray = [];
|
|
12781
12747
|
fieldSchemaArray.length = 0;
|
|
12748
|
+
const recordId = ctx && ctx.recordId;
|
|
12782
12749
|
|
|
12783
|
-
|
|
12750
|
+
_$1__namespace.forEach(formFields, (field) => {
|
|
12784
12751
|
if (!field.group || field.group == 'null' || field.group == '-')
|
|
12785
12752
|
field.group = instance.t('frontend_field_group_generalization');
|
|
12786
12753
|
const fieldName = field.name;
|
|
@@ -12790,8 +12757,14 @@ const getFieldSchemaArray = (formFields) => {
|
|
|
12790
12757
|
field.is_wide = true;
|
|
12791
12758
|
}
|
|
12792
12759
|
|
|
12760
|
+
let forceHidden = false;
|
|
12761
|
+
if(!recordId && field.readonly){
|
|
12762
|
+
// 新建记录时,只读字段先隐藏,后续支持显示后,即任务:https://github.com/steedos/steedos-platform/issues/3164 完成后再放开
|
|
12763
|
+
forceHidden = true;
|
|
12764
|
+
}
|
|
12765
|
+
|
|
12793
12766
|
if (!isObjectField) {
|
|
12794
|
-
if (!field.hidden) {
|
|
12767
|
+
if (!field.hidden && !forceHidden) {
|
|
12795
12768
|
fieldSchemaArray.push(Object.assign({ name: fieldName }, field, { permission: { allowEdit: true } }));
|
|
12796
12769
|
}
|
|
12797
12770
|
}
|
|
@@ -12803,8 +12776,8 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
|
|
|
12803
12776
|
if (!ctx) {
|
|
12804
12777
|
ctx = {};
|
|
12805
12778
|
}
|
|
12806
|
-
const sectionFields =
|
|
12807
|
-
if (sectionFields.length ==
|
|
12779
|
+
const sectionFields = _$1__namespace.filter(fieldSchemaArray, { 'group': sectionName });
|
|
12780
|
+
if (sectionFields.length == _$1__namespace.filter(sectionFields, ['hidden', true]).length) {
|
|
12808
12781
|
return;
|
|
12809
12782
|
}
|
|
12810
12783
|
|
|
@@ -12830,7 +12803,7 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
|
|
|
12830
12803
|
}
|
|
12831
12804
|
|
|
12832
12805
|
// fieldSet 已支持显隐控制
|
|
12833
|
-
const sectionFieldsVisibleOn =
|
|
12806
|
+
const sectionFieldsVisibleOn = _$1__namespace.map(_$1__namespace.compact(_$1__namespace.map(fieldSetBody, 'visibleOn')), (visibleOn) => {
|
|
12834
12807
|
let visible = visibleOn;
|
|
12835
12808
|
if(visible.indexOf('${')>-1){
|
|
12836
12809
|
visible = visible.substring(visible.indexOf('{')+1, visible.indexOf('}'));
|
|
@@ -12862,8 +12835,8 @@ const getSections = async (permissionFields, formFields, ctx) => {
|
|
|
12862
12835
|
if (!ctx) {
|
|
12863
12836
|
ctx = {};
|
|
12864
12837
|
}
|
|
12865
|
-
const fieldSchemaArray = getFieldSchemaArray(formFields);
|
|
12866
|
-
const _sections =
|
|
12838
|
+
const fieldSchemaArray = getFieldSchemaArray(formFields, ctx);
|
|
12839
|
+
const _sections = _$1__namespace.groupBy(fieldSchemaArray, 'group');
|
|
12867
12840
|
const sections = [];
|
|
12868
12841
|
var sectionVisibleOns = [];
|
|
12869
12842
|
for (const key in _sections) {
|
|
@@ -12936,9 +12909,9 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
12936
12909
|
// 源码出处:https://github.com/nodeutils/defaults-deep
|
|
12937
12910
|
const defaultsDeep = (...args)=>{
|
|
12938
12911
|
let output = {};
|
|
12939
|
-
|
|
12940
|
-
|
|
12941
|
-
return
|
|
12912
|
+
_$1.toArray(args).reverse().forEach(item=> {
|
|
12913
|
+
_$1.mergeWith(output, item, (objectValue, sourceValue) => {
|
|
12914
|
+
return _$1.isArray(sourceValue) ? sourceValue : undefined;
|
|
12942
12915
|
});
|
|
12943
12916
|
});
|
|
12944
12917
|
return output;
|
|
@@ -13053,7 +13026,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
13053
13026
|
const table = await getTableSchema$1(fields, Object.assign({idFieldName: objectSchema.idFieldName, labelFieldName: labelFieldName, permissions:objectSchema.permissions,enable_inline_edit:objectSchema.enable_inline_edit}, options));
|
|
13054
13027
|
delete table.mode;
|
|
13055
13028
|
//image与avatar需要在提交修改时特别处理
|
|
13056
|
-
const imageNames =
|
|
13029
|
+
const imageNames = _$1__default["default"].compact(_$1__default["default"].map(_$1__default["default"].filter(fields, (field) => ["image","avatar"].includes(field.type)), 'name'));
|
|
13057
13030
|
const quickSaveApiRequestAdaptor = `
|
|
13058
13031
|
var graphqlOrder = "";
|
|
13059
13032
|
var imageNames = ${JSON.stringify(imageNames)};
|
|
@@ -13083,7 +13056,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
13083
13056
|
}
|
|
13084
13057
|
`;
|
|
13085
13058
|
let autoFillHeight = true;
|
|
13086
|
-
if(options.isRelated ||
|
|
13059
|
+
if(options.isRelated || window.innerWidth < 768){
|
|
13087
13060
|
autoFillHeight = false;
|
|
13088
13061
|
}
|
|
13089
13062
|
|
|
@@ -13124,16 +13097,16 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
13124
13097
|
if (headerSchema || footerSchema) {
|
|
13125
13098
|
let wrappedBody = [body];
|
|
13126
13099
|
if (headerSchema) {
|
|
13127
|
-
if(
|
|
13128
|
-
wrappedBody =
|
|
13100
|
+
if(_$1__default["default"].isArray(headerSchema)){
|
|
13101
|
+
wrappedBody = _$1__default["default"].union(headerSchema,wrappedBody);
|
|
13129
13102
|
}
|
|
13130
13103
|
else {
|
|
13131
13104
|
wrappedBody.unshift(headerSchema);
|
|
13132
13105
|
}
|
|
13133
13106
|
}
|
|
13134
13107
|
if (footerSchema) {
|
|
13135
|
-
if(
|
|
13136
|
-
wrappedBody =
|
|
13108
|
+
if(_$1__default["default"].isArray(footerSchema)){
|
|
13109
|
+
wrappedBody = _$1__default["default"].union(wrappedBody,footerSchema);
|
|
13137
13110
|
}
|
|
13138
13111
|
else {
|
|
13139
13112
|
wrappedBody.push(footerSchema);
|
|
@@ -13176,7 +13149,7 @@ const getFormFields = (objectSchema, formProps)=>{
|
|
|
13176
13149
|
|
|
13177
13150
|
let fields = {};
|
|
13178
13151
|
// 以uiSchema fields 为基础, 遍历字段, 并更新字段定义
|
|
13179
|
-
|
|
13152
|
+
_$1__default["default"].forEach(objectSchema.fields, (field, fieldName)=>{
|
|
13180
13153
|
if(!lodash.has(field, "name")){
|
|
13181
13154
|
field.name = fieldName;
|
|
13182
13155
|
}
|
|
@@ -13187,9 +13160,9 @@ const getFormFields = (objectSchema, formProps)=>{
|
|
|
13187
13160
|
}
|
|
13188
13161
|
});
|
|
13189
13162
|
|
|
13190
|
-
if(!
|
|
13163
|
+
if(!_$1__default["default"].isEmpty(includedFields) && _$1__default["default"].isArray(includedFields)){
|
|
13191
13164
|
const includedFieldsMap = {};
|
|
13192
|
-
|
|
13165
|
+
_$1__default["default"].each(includedFields, (fName, index)=>{
|
|
13193
13166
|
if(fields[fName]){
|
|
13194
13167
|
includedFieldsMap[fName] = Object.assign({}, fields[fName], {sort_no: index});
|
|
13195
13168
|
}
|
|
@@ -13197,21 +13170,21 @@ const getFormFields = (objectSchema, formProps)=>{
|
|
|
13197
13170
|
fields = includedFieldsMap;
|
|
13198
13171
|
}
|
|
13199
13172
|
|
|
13200
|
-
if(!
|
|
13201
|
-
|
|
13173
|
+
if(!_$1__default["default"].isEmpty(excludedFields) && _$1__default["default"].isArray(excludedFields)){
|
|
13174
|
+
_$1__default["default"].each(excludedFields, (fName)=>{
|
|
13202
13175
|
delete fields[fName];
|
|
13203
13176
|
});
|
|
13204
13177
|
}
|
|
13205
13178
|
|
|
13206
|
-
return lodash.sortBy(
|
|
13179
|
+
return lodash.sortBy(_$1__default["default"].values(fields), "sort_no");
|
|
13207
13180
|
};
|
|
13208
13181
|
|
|
13209
13182
|
async function getObjectForm(objectSchema, ctx){
|
|
13210
13183
|
const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "normal", labelAlign, tabId, appId, defaults } = ctx;
|
|
13211
|
-
const fields =
|
|
13184
|
+
const fields = _$1__default["default"].values(objectSchema.fields);
|
|
13212
13185
|
const formFields = getFormFields(objectSchema, ctx);
|
|
13213
13186
|
const formSchema = defaults && defaults.formSchema || {};
|
|
13214
|
-
if(
|
|
13187
|
+
if(_$1__default["default"].has(formSchema, 'className')){
|
|
13215
13188
|
formSchema.className = 'steedos-amis-form';
|
|
13216
13189
|
}
|
|
13217
13190
|
if(!formSchema.id){
|
|
@@ -13295,7 +13268,7 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
13295
13268
|
|
|
13296
13269
|
async function getObjectDetail(objectSchema, recordId, ctx){
|
|
13297
13270
|
const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "normal", labelAlign, formInitProps } = ctx;
|
|
13298
|
-
const fields =
|
|
13271
|
+
const fields = _$1__default["default"].values(objectSchema.fields);
|
|
13299
13272
|
const formFields = getFormFields(objectSchema, ctx);
|
|
13300
13273
|
const serviceId = `service_detail_page`;
|
|
13301
13274
|
return {
|
|
@@ -13322,7 +13295,7 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
13322
13295
|
"formData": "$$"
|
|
13323
13296
|
},
|
|
13324
13297
|
wrapWithPanel: false,
|
|
13325
|
-
body: await getFormBody(
|
|
13298
|
+
body: await getFormBody(_$1.map(fields, (field)=>{field.readonly = true; return field;}), _$1.map(formFields, (field)=>{field.readonly = true; return field;}), Object.assign({}, ctx, {showSystemFields: true})),
|
|
13326
13299
|
className: 'steedos-amis-form bg-white',
|
|
13327
13300
|
actions: [], // 不显示表单默认的提交按钮
|
|
13328
13301
|
onEvent: {
|
|
@@ -13391,7 +13364,7 @@ const getGraphqlFieldsQuery$1 = (fields)=>{
|
|
|
13391
13364
|
const fieldsName = ['_id'];
|
|
13392
13365
|
fields.push('record_permissions');
|
|
13393
13366
|
//TODO 此处需要考虑相关对象查询
|
|
13394
|
-
|
|
13367
|
+
_$1.each(fields, (fieldName)=>{
|
|
13395
13368
|
if(fieldName.indexOf('.') > -1){
|
|
13396
13369
|
fieldName = fieldName.split('.')[0];
|
|
13397
13370
|
}
|
|
@@ -13428,7 +13401,7 @@ const getRecord = async (objectName, recordId, fields)=>{
|
|
|
13428
13401
|
const getRelatedsCount = async (masterRecordId, relateds) => {
|
|
13429
13402
|
const relatedQuery = [];
|
|
13430
13403
|
|
|
13431
|
-
|
|
13404
|
+
_$1.each(relateds, (relate)=>{
|
|
13432
13405
|
relatedQuery.push(`${relate.object_name}: ${relate.object_name}__count(filters: [["${relate.foreign_key}","=","${masterRecordId}"]])`);
|
|
13433
13406
|
});
|
|
13434
13407
|
|
|
@@ -13456,7 +13429,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
13456
13429
|
* @Author: baozhoutao@steedos.com
|
|
13457
13430
|
* @Date: 2022-07-05 15:55:39
|
|
13458
13431
|
* @LastEditors: liaodaxue
|
|
13459
|
-
* @LastEditTime: 2023-08-
|
|
13432
|
+
* @LastEditTime: 2023-08-28 14:55:23
|
|
13460
13433
|
* @Description:
|
|
13461
13434
|
*/
|
|
13462
13435
|
|
|
@@ -13474,11 +13447,11 @@ function str2function(
|
|
|
13474
13447
|
}
|
|
13475
13448
|
|
|
13476
13449
|
const getRelatedFieldValue = (masterObjectName, record_id, uiSchema, foreign_key) => {
|
|
13477
|
-
const relatedField =
|
|
13450
|
+
const relatedField = _$1.find(uiSchema.fields, (field) => {
|
|
13478
13451
|
return foreign_key === field?.name
|
|
13479
13452
|
});
|
|
13480
13453
|
// console.log(`getRelatedFieldValue`, relatedField, uiSchema, foreign_key)
|
|
13481
|
-
if (!
|
|
13454
|
+
if (!_$1.isString(relatedField.reference_to)) {
|
|
13482
13455
|
return { o: masterObjectName, ids: [record_id] }
|
|
13483
13456
|
} else if (relatedField.multiple) {
|
|
13484
13457
|
return [record_id]
|
|
@@ -13496,7 +13469,7 @@ async function getObjectRelatedList(
|
|
|
13496
13469
|
const uiSchema = await getUISchema(objectName);
|
|
13497
13470
|
const related = [];
|
|
13498
13471
|
const relatedLists = [].concat(uiSchema.related_lists || []);
|
|
13499
|
-
if(!
|
|
13472
|
+
if(!_$1.isEmpty(relatedLists)){
|
|
13500
13473
|
for (const relatedList of relatedLists) {
|
|
13501
13474
|
const arr = relatedList.related_field_fullname.split(".");
|
|
13502
13475
|
const foreign_key = arr[2] ? arr[1]+'.'+arr[2] : arr[1];
|
|
@@ -13549,18 +13522,18 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
13549
13522
|
const mainObjectUiSchema = await getUISchema(objectName);
|
|
13550
13523
|
if(mainObjectUiSchema){
|
|
13551
13524
|
const mainRelatedLists = mainObjectUiSchema.related_lists || [];
|
|
13552
|
-
if(!
|
|
13525
|
+
if(!_$1.isEmpty(mainRelatedLists)){
|
|
13553
13526
|
for (const relatedList of mainRelatedLists) {
|
|
13554
13527
|
const arr = relatedList.related_field_fullname.split(".");
|
|
13555
13528
|
const foreign_key_value = arr[2] ? arr[1]+'.'+arr[2] : arr[1];
|
|
13556
13529
|
mainRelated[arr[0]] = foreign_key_value;
|
|
13557
13530
|
}
|
|
13558
13531
|
}else {
|
|
13559
|
-
const details =
|
|
13532
|
+
const details = _$1.union(mainObjectUiSchema.details,mainObjectUiSchema.lookup_details) || [];
|
|
13560
13533
|
for (const detail of details) {
|
|
13561
13534
|
const arr = detail.split(".");
|
|
13562
13535
|
const foreign_key_value = arr[2] ? arr[1]+'.'+arr[2] : arr[1];
|
|
13563
|
-
if(!
|
|
13536
|
+
if(!_$1.has(mainRelated,arr[0])){
|
|
13564
13537
|
mainRelated[arr[0]] = foreign_key_value;
|
|
13565
13538
|
}
|
|
13566
13539
|
}
|
|
@@ -13602,11 +13575,16 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
13602
13575
|
// }
|
|
13603
13576
|
const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel, ctx);
|
|
13604
13577
|
const componentId = `steedos-record-related-list-${relatedObjectName}`;
|
|
13578
|
+
const isMobile = window.innerWidth < 768;
|
|
13579
|
+
let headerToolbar = [];
|
|
13580
|
+
if(!isMobile){
|
|
13581
|
+
headerToolbar.push("bulkActions");
|
|
13582
|
+
}
|
|
13605
13583
|
const options = {
|
|
13606
13584
|
globalFilter,
|
|
13607
13585
|
defaults: {
|
|
13608
13586
|
listSchema: {
|
|
13609
|
-
headerToolbar
|
|
13587
|
+
headerToolbar,
|
|
13610
13588
|
columnsTogglable: false,
|
|
13611
13589
|
onEvent: {
|
|
13612
13590
|
[`@data.changed.${relatedObjectName}`]: {
|
|
@@ -13662,7 +13640,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
13662
13640
|
*/
|
|
13663
13641
|
function getDefaultRelatedListProps(uiSchema, listName, ctx) {
|
|
13664
13642
|
// console.log('getDefaultRelatedListProps==>', uiSchema, listName, ctx)
|
|
13665
|
-
const listView =
|
|
13643
|
+
const listView = _$1.find(
|
|
13666
13644
|
uiSchema.list_views,
|
|
13667
13645
|
(listView, name) => {
|
|
13668
13646
|
// 日历视图不在相关子表中出现
|
|
@@ -13693,7 +13671,7 @@ function getDefaultRelatedListProps(uiSchema, listName, ctx) {
|
|
|
13693
13671
|
// }
|
|
13694
13672
|
filtersFunction = listView && listView._filters;
|
|
13695
13673
|
}else {
|
|
13696
|
-
const isNameField =
|
|
13674
|
+
const isNameField = _$1.find(
|
|
13697
13675
|
uiSchema.fields,
|
|
13698
13676
|
(field,name)=>{
|
|
13699
13677
|
return field.is_name;
|
|
@@ -13826,19 +13804,19 @@ const setUISchemaCache = (key, value) => {
|
|
|
13826
13804
|
};
|
|
13827
13805
|
|
|
13828
13806
|
const getUISchemaCache = (key) => {
|
|
13829
|
-
return
|
|
13807
|
+
return _$1.cloneDeep(UI_SCHEMA_CACHE[key]);
|
|
13830
13808
|
};
|
|
13831
13809
|
|
|
13832
13810
|
const hasUISchemaCache = (key) => {
|
|
13833
|
-
return
|
|
13811
|
+
return _$1.has(UI_SCHEMA_CACHE, key);
|
|
13834
13812
|
};
|
|
13835
13813
|
|
|
13836
13814
|
function getListViewColumns(listView, formFactor) {
|
|
13837
13815
|
let listViewColumns = [];
|
|
13838
13816
|
if (formFactor === "SMALL") {
|
|
13839
|
-
listViewColumns = !
|
|
13817
|
+
listViewColumns = !_$1.isEmpty(listView.mobile_columns)
|
|
13840
13818
|
? listView.mobile_columns
|
|
13841
|
-
:
|
|
13819
|
+
: _$1.slice(listView.columns, 0, 4);
|
|
13842
13820
|
} else {
|
|
13843
13821
|
listViewColumns = listView.columns;
|
|
13844
13822
|
}
|
|
@@ -13847,8 +13825,8 @@ function getListViewColumns(listView, formFactor) {
|
|
|
13847
13825
|
function getListViewSort(listView) {
|
|
13848
13826
|
let sort = '';
|
|
13849
13827
|
if(listView && listView.sort && listView.sort.length){
|
|
13850
|
-
|
|
13851
|
-
if(
|
|
13828
|
+
_$1.each(listView.sort,function(item,index){
|
|
13829
|
+
if(_$1.isArray(item)){
|
|
13852
13830
|
const field_name = item[0];
|
|
13853
13831
|
const order = item[1] || '';
|
|
13854
13832
|
let sortStr = field_name + ' ' + order;
|
|
@@ -13871,14 +13849,14 @@ function getListViewFilter(listView){
|
|
|
13871
13849
|
const userId = getUserId();
|
|
13872
13850
|
let filters = listView.filters;
|
|
13873
13851
|
if(listView.filter_scope === 'mine'){
|
|
13874
|
-
if(
|
|
13852
|
+
if(_$1__default["default"].isEmpty(filters)){
|
|
13875
13853
|
filters = [["owner", "=", userId]];
|
|
13876
13854
|
}else {
|
|
13877
|
-
if(
|
|
13855
|
+
if(_$1__default["default"].isString(filters) && _$1__default["default"].startsWith(_$1__default["default"].trim(filters), "function")){
|
|
13878
13856
|
filters = new Function(`return ${filters}`);
|
|
13879
13857
|
filters = filters();
|
|
13880
13858
|
}
|
|
13881
|
-
if(
|
|
13859
|
+
if(_$1__default["default"].isArray(filters)){
|
|
13882
13860
|
filters.push(["owner", "=", userId]);
|
|
13883
13861
|
}else {
|
|
13884
13862
|
console.debug(`listView filters is not array`, listView);
|
|
@@ -13894,9 +13872,9 @@ function getListViewFilter(listView){
|
|
|
13894
13872
|
|
|
13895
13873
|
function formatUISchemaCache(objectName, uiSchema){
|
|
13896
13874
|
setUISchemaCache(objectName, uiSchema);
|
|
13897
|
-
|
|
13875
|
+
_$1.each(uiSchema.fields, (field)=>{
|
|
13898
13876
|
try {
|
|
13899
|
-
if(field.type === "lookup" && field._reference_to &&
|
|
13877
|
+
if(field.type === "lookup" && field._reference_to && _$1__default["default"].isString(field._reference_to)){
|
|
13900
13878
|
field.reference_to = eval(`(${field._reference_to})`)();
|
|
13901
13879
|
}
|
|
13902
13880
|
} catch (exception) {
|
|
@@ -13904,9 +13882,9 @@ function formatUISchemaCache(objectName, uiSchema){
|
|
|
13904
13882
|
console.error(exception);
|
|
13905
13883
|
}
|
|
13906
13884
|
});
|
|
13907
|
-
|
|
13885
|
+
_$1.each(uiSchema.list_views, (v, k)=>{
|
|
13908
13886
|
v.name = k;
|
|
13909
|
-
if(!
|
|
13887
|
+
if(!_$1.has(v, 'columns')){
|
|
13910
13888
|
v.columns = uiSchema.list_views.all.columns;
|
|
13911
13889
|
}
|
|
13912
13890
|
});
|
|
@@ -14004,7 +13982,7 @@ async function getListSchema(
|
|
|
14004
13982
|
if(!uiSchema){
|
|
14005
13983
|
return {}
|
|
14006
13984
|
}
|
|
14007
|
-
const listView =
|
|
13985
|
+
const listView = _$1.find(
|
|
14008
13986
|
uiSchema.list_views,
|
|
14009
13987
|
(listView, name) => {
|
|
14010
13988
|
// 传入listViewName空值则取第一个
|
|
@@ -14021,7 +13999,7 @@ async function getListSchema(
|
|
|
14021
13999
|
|
|
14022
14000
|
// 直接返回自定义的列表视图schema
|
|
14023
14001
|
if(listView.enable_amis_schema && listView.amis_schema){
|
|
14024
|
-
const amisSchema =
|
|
14002
|
+
const amisSchema = _$1.isString(listView.amis_schema) ? JSON.parse(listView.amis_schema) : listView.amis_schema;
|
|
14025
14003
|
return {
|
|
14026
14004
|
uiSchema,
|
|
14027
14005
|
isCustomAmisSchema: true,
|
|
@@ -14096,7 +14074,7 @@ async function getListSchema(
|
|
|
14096
14074
|
perPage: localListViewProps.perPage
|
|
14097
14075
|
};
|
|
14098
14076
|
}
|
|
14099
|
-
defaults.listSchema =
|
|
14077
|
+
defaults.listSchema = _$1.defaultsDeep({}, listSchema, defaults.listSchema || {});
|
|
14100
14078
|
}
|
|
14101
14079
|
}
|
|
14102
14080
|
catch (ex) {
|
|
@@ -14167,12 +14145,12 @@ async function getTableSchema(
|
|
|
14167
14145
|
|
|
14168
14146
|
let fields = [];
|
|
14169
14147
|
for(const column of columns){
|
|
14170
|
-
if (
|
|
14148
|
+
if (_$1.isString(column)) {
|
|
14171
14149
|
if(column.indexOf('.') > 0){
|
|
14172
14150
|
const fieldName = column.split('.')[0];
|
|
14173
14151
|
const displayName = column.split('.')[1];
|
|
14174
14152
|
const filedInfo = uiSchema.fields[fieldName];
|
|
14175
|
-
if(filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') &&
|
|
14153
|
+
if(filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && _$1.isString(filedInfo.reference_to) ){
|
|
14176
14154
|
const rfUiSchema = await getUISchema(filedInfo.reference_to);
|
|
14177
14155
|
const rfFieldInfo = rfUiSchema.fields[displayName];
|
|
14178
14156
|
fields.push(Object.assign({}, rfFieldInfo, {name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: {fieldName, displayName}}));
|
|
@@ -14182,12 +14160,12 @@ async function getTableSchema(
|
|
|
14182
14160
|
fields.push(uiSchema.fields[column]);
|
|
14183
14161
|
}
|
|
14184
14162
|
}
|
|
14185
|
-
} else if (
|
|
14163
|
+
} else if (_$1.isObject(column)) {
|
|
14186
14164
|
if(column.field.indexOf('.') > 0){
|
|
14187
14165
|
const fieldName = column.field.split('.')[0];
|
|
14188
14166
|
const displayName = column.field.split('.')[1];
|
|
14189
14167
|
const filedInfo = uiSchema.fields[fieldName];
|
|
14190
|
-
if(filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') &&
|
|
14168
|
+
if(filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && _$1.isString(filedInfo.reference_to) ){
|
|
14191
14169
|
const rfUiSchema = await getUISchema(filedInfo.reference_to);
|
|
14192
14170
|
const rfFieldInfo = rfUiSchema.fields[displayName];
|
|
14193
14171
|
fields.push(Object.assign({}, rfFieldInfo,
|
|
@@ -14216,10 +14194,10 @@ async function getTableSchema(
|
|
|
14216
14194
|
const extraColumns = ctx.extraColumns;
|
|
14217
14195
|
|
|
14218
14196
|
if (extraColumns) {
|
|
14219
|
-
|
|
14220
|
-
if (
|
|
14197
|
+
_$1.each(extraColumns, function (column) {
|
|
14198
|
+
if (_$1.isString(column)) {
|
|
14221
14199
|
fields.push({ extra: true, name: column });
|
|
14222
|
-
} else if (
|
|
14200
|
+
} else if (_$1.isObject(column)) {
|
|
14223
14201
|
fields.push({ extra: true, name: column.field });
|
|
14224
14202
|
}
|
|
14225
14203
|
});
|
|
@@ -14404,7 +14382,7 @@ async function getObjectRelated(
|
|
|
14404
14382
|
const refField = await getField(objectName, relatedFieldName);
|
|
14405
14383
|
if (
|
|
14406
14384
|
refField._reference_to ||
|
|
14407
|
-
(refField.reference_to && !
|
|
14385
|
+
(refField.reference_to && !_$1.isString(refField.reference_to))
|
|
14408
14386
|
) {
|
|
14409
14387
|
filter = [
|
|
14410
14388
|
[`${relatedFieldName}/o`, "=", masterObjectName],
|
|
@@ -14585,7 +14563,7 @@ async function getListviewInitSchema(objectApiName, listViewName, ctx) {
|
|
|
14585
14563
|
ctx = {};
|
|
14586
14564
|
}
|
|
14587
14565
|
const uiSchema = await getUISchema(objectApiName);
|
|
14588
|
-
const listView =
|
|
14566
|
+
const listView = _$1.find(
|
|
14589
14567
|
uiSchema.list_views,
|
|
14590
14568
|
(listView, name) => {
|
|
14591
14569
|
return name === listViewName;
|
|
@@ -14714,7 +14692,7 @@ const getEnv = (k) =>{
|
|
|
14714
14692
|
};
|
|
14715
14693
|
|
|
14716
14694
|
const setEnvs = (data) =>{
|
|
14717
|
-
|
|
14695
|
+
_$1.map(data, (v, k)=>{
|
|
14718
14696
|
PUBLIC_ENV[k] = v;
|
|
14719
14697
|
});
|
|
14720
14698
|
};
|
|
@@ -14922,12 +14900,12 @@ const conditionItemToFilters = (item) => {
|
|
|
14922
14900
|
// }
|
|
14923
14901
|
const filterToConditionItem = (filter) => {
|
|
14924
14902
|
if (filter.length === 3) {
|
|
14925
|
-
const op =
|
|
14903
|
+
const op = _$1__default["default"].findKey(opMaps, (value) => {
|
|
14926
14904
|
return value === filter[1];
|
|
14927
14905
|
});
|
|
14928
14906
|
if (
|
|
14929
14907
|
op === "between" &&
|
|
14930
|
-
|
|
14908
|
+
_$1__default["default"].includes(DATE_DATETIME_BETWEEN_VALUES, filter[2])
|
|
14931
14909
|
) {
|
|
14932
14910
|
return {
|
|
14933
14911
|
left: {
|
|
@@ -14952,7 +14930,7 @@ const filterToConditionItem = (filter) => {
|
|
|
14952
14930
|
};
|
|
14953
14931
|
|
|
14954
14932
|
const filterObjectToArray = (filter) => {
|
|
14955
|
-
if (!
|
|
14933
|
+
if (!_$1__default["default"].isArray(filter) && _$1__default["default"].isObject(filter)) {
|
|
14956
14934
|
return [filter.field, filter.operation, filter.value];
|
|
14957
14935
|
}
|
|
14958
14936
|
return filter;
|
|
@@ -15006,12 +14984,12 @@ const filtersToConditions = (filters) => {
|
|
|
15006
14984
|
const registerRemoteAssets = async (assetUrls)=>{
|
|
15007
14985
|
if(assetUrls && assetUrls.length > 0){
|
|
15008
14986
|
let assetUrlsArray = assetUrls;
|
|
15009
|
-
if(
|
|
14987
|
+
if(_$1.isString(assetUrlsArray)){
|
|
15010
14988
|
assetUrlsArray = assetUrlsArray.split(',');
|
|
15011
14989
|
}
|
|
15012
14990
|
await Builder.registerRemoteAssets(assetUrlsArray);
|
|
15013
|
-
const amisComps =
|
|
15014
|
-
return
|
|
14991
|
+
const amisComps = _$1.filter(Builder.registry['meta-components'], function(item){ return item.componentName && item.amis?.render});
|
|
14992
|
+
return _$1.map(amisComps, (item)=>{
|
|
15015
14993
|
return { componentType: item.componentType, componentName: item.componentName, ...item.amis.render}
|
|
15016
14994
|
})
|
|
15017
14995
|
}else {
|
|
@@ -15892,10 +15870,10 @@ const getAttachmentUploadInput = async (instance)=>{
|
|
|
15892
15870
|
* @Description:
|
|
15893
15871
|
*/
|
|
15894
15872
|
const getRelatedRecords = async (instance)=>{
|
|
15895
|
-
if(!instance.record_ids ||
|
|
15873
|
+
if(!instance.record_ids || _$1.isEmpty(instance.record_ids)){
|
|
15896
15874
|
return ;
|
|
15897
15875
|
}
|
|
15898
|
-
return
|
|
15876
|
+
return _$1.map(instance.record_ids, (item)=>{
|
|
15899
15877
|
return {
|
|
15900
15878
|
type: 'tpl',
|
|
15901
15879
|
tpl: `<a href='/app/-/${item.o}/view/${item.ids[0]}' target='_blank'>相关台账信息</a>`
|
|
@@ -15993,7 +15971,7 @@ const getInstanceApprovalHistory = async ()=>{
|
|
|
15993
15971
|
|
|
15994
15972
|
const getSelectOptions = (field) => {
|
|
15995
15973
|
const options = [];
|
|
15996
|
-
|
|
15974
|
+
_$1.each(field.options.split("\n"), (item) => {
|
|
15997
15975
|
var foo = item.split(":");
|
|
15998
15976
|
if (foo.length == 2) {
|
|
15999
15977
|
options.push({ label: foo[0], value: foo[1] });
|
|
@@ -16294,7 +16272,7 @@ const getFieldEditTpl = async (field, label)=>{
|
|
|
16294
16272
|
// tpl.labelField = labelField;
|
|
16295
16273
|
// tpl.valueField = "_value";
|
|
16296
16274
|
tpl.source = {
|
|
16297
|
-
url:
|
|
16275
|
+
url: _$1.startsWith(field.url, "http")
|
|
16298
16276
|
? field.url
|
|
16299
16277
|
: `\${context.rootUrl}${field.url}`,
|
|
16300
16278
|
method: "get",
|
|
@@ -16359,12 +16337,12 @@ const getFieldReadonlyTpl = async (field, label)=>{
|
|
|
16359
16337
|
mode: "horizontal",
|
|
16360
16338
|
className: "m-none p-none form-control",
|
|
16361
16339
|
};
|
|
16362
|
-
if(
|
|
16340
|
+
if(_$1.includes(['text'], field.type)){
|
|
16363
16341
|
tpl.type = `static-${field.type}`;
|
|
16364
16342
|
}else if(field.type === 'select'){
|
|
16365
16343
|
const options = getSelectOptions(field);
|
|
16366
16344
|
const map = {};
|
|
16367
|
-
|
|
16345
|
+
_$1.each(options , (item)=>{
|
|
16368
16346
|
map[item.value] = item.label;
|
|
16369
16347
|
});
|
|
16370
16348
|
tpl.type = 'static';
|
|
@@ -16508,13 +16486,13 @@ const getFormTrs = async (instance) => {
|
|
|
16508
16486
|
const trs = [];
|
|
16509
16487
|
let tdFields = [];
|
|
16510
16488
|
let fields = [];
|
|
16511
|
-
|
|
16489
|
+
_$1.each(instance.fields, (field) => {
|
|
16512
16490
|
fields.push(field);
|
|
16513
16491
|
if (field.type === "section" && field.fields) {
|
|
16514
16492
|
fields = fields.concat(field.fields);
|
|
16515
16493
|
}
|
|
16516
16494
|
});
|
|
16517
|
-
|
|
16495
|
+
_$1.each(fields, (field, index) => {
|
|
16518
16496
|
if (field.is_wide) {
|
|
16519
16497
|
if (tdFields.length != 0) {
|
|
16520
16498
|
trs.push(tdFields);
|
|
@@ -16921,18 +16899,18 @@ const getOpinionFieldStepsName = (field, top_keywords) => {
|
|
|
16921
16899
|
*/
|
|
16922
16900
|
|
|
16923
16901
|
const getTrace = ({ instance, traceId }) => {
|
|
16924
|
-
return
|
|
16902
|
+
return _$1.find(instance.traces, (trace) => {
|
|
16925
16903
|
return trace._id === traceId;
|
|
16926
16904
|
});
|
|
16927
16905
|
};
|
|
16928
16906
|
|
|
16929
16907
|
const getUserApprove = ({ instance, userId }) => {
|
|
16930
|
-
const currentTrace =
|
|
16908
|
+
const currentTrace = _$1.find(instance.traces, (trace) => {
|
|
16931
16909
|
return trace.is_finished != true;
|
|
16932
16910
|
});
|
|
16933
16911
|
let currentApprove = null;
|
|
16934
16912
|
if (currentTrace) {
|
|
16935
|
-
currentApprove =
|
|
16913
|
+
currentApprove = _$1.find(currentTrace.approves, (approve) => {
|
|
16936
16914
|
return approve.is_finished != true && approve.handler == userId;
|
|
16937
16915
|
});
|
|
16938
16916
|
}
|
|
@@ -16940,8 +16918,8 @@ const getUserApprove = ({ instance, userId }) => {
|
|
|
16940
16918
|
//传阅的approve返回最新一条
|
|
16941
16919
|
if (!currentApprove || currentApprove.type == "cc") {
|
|
16942
16920
|
// 当前是传阅
|
|
16943
|
-
|
|
16944
|
-
|
|
16921
|
+
_$1__default["default"].each(instance.traces, function (t) {
|
|
16922
|
+
_$1__default["default"].each(t.approves, function (a) {
|
|
16945
16923
|
if (a.type == "cc" && a.handler == userId && a.is_finished == false) {
|
|
16946
16924
|
currentApprove = a;
|
|
16947
16925
|
}
|
|
@@ -16972,7 +16950,7 @@ const getApproveValues = ({ instance, trace, step, approve, box }) => {
|
|
|
16972
16950
|
//TODO
|
|
16973
16951
|
instanceValues = instance.values;
|
|
16974
16952
|
} else {
|
|
16975
|
-
if (
|
|
16953
|
+
if (_$1.isEmpty(approve.values)) {
|
|
16976
16954
|
instanceValues = instance.values;
|
|
16977
16955
|
} else {
|
|
16978
16956
|
instanceValues = approve.values;
|
|
@@ -16996,7 +16974,7 @@ const getFlowVersion = (instance) => {
|
|
|
16996
16974
|
if (instance.flow.current._id === instance.flow_version) {
|
|
16997
16975
|
return instance.flow.current;
|
|
16998
16976
|
} else {
|
|
16999
|
-
return
|
|
16977
|
+
return _$1.find(instance.flow.historys, (history) => {
|
|
17000
16978
|
return history._id === instance.flow_version;
|
|
17001
16979
|
});
|
|
17002
16980
|
}
|
|
@@ -17006,14 +16984,14 @@ const getFormVersion = (instance) => {
|
|
|
17006
16984
|
if (instance.form.current._id === instance.form_version) {
|
|
17007
16985
|
return instance.form.current;
|
|
17008
16986
|
} else {
|
|
17009
|
-
return
|
|
16987
|
+
return _$1.find(instance.form.historys, (history) => {
|
|
17010
16988
|
return history._id === instance.form_version;
|
|
17011
16989
|
});
|
|
17012
16990
|
}
|
|
17013
16991
|
};
|
|
17014
16992
|
|
|
17015
16993
|
const getStep = ({ flowVersion, stepId }) => {
|
|
17016
|
-
return
|
|
16994
|
+
return _$1.find(flowVersion.steps, (step) => {
|
|
17017
16995
|
return step._id === stepId;
|
|
17018
16996
|
});
|
|
17019
16997
|
};
|
|
@@ -17031,7 +17009,7 @@ const getLastCCStep = ({ traces }, userId) => {
|
|
|
17031
17009
|
|
|
17032
17010
|
while (i >= 0) {
|
|
17033
17011
|
if (!trace_id && traces[i].is_finished) {
|
|
17034
|
-
|
|
17012
|
+
_$1__default["default"].each(traces[i].approves, function (ap) {
|
|
17035
17013
|
if (!trace_id) {
|
|
17036
17014
|
if (
|
|
17037
17015
|
ap.is_finished &&
|
|
@@ -17054,7 +17032,7 @@ const getLastCCStep = ({ traces }, userId) => {
|
|
|
17054
17032
|
};
|
|
17055
17033
|
|
|
17056
17034
|
const isCurrentStepOpinionField = (field, currentStep)=>{
|
|
17057
|
-
return
|
|
17035
|
+
return _$1__default["default"].includes(_$1__default["default"].map(getOpinionFieldStepsName(field), 'stepName'), currentStep?.name);
|
|
17058
17036
|
};
|
|
17059
17037
|
|
|
17060
17038
|
const getInstanceInfo = async ({ instanceId, box }) => {
|
|
@@ -17123,7 +17101,7 @@ const getInstanceInfo = async ({ instanceId, box }) => {
|
|
|
17123
17101
|
step = getStep({ flowVersion, stepId: trace.step });
|
|
17124
17102
|
}
|
|
17125
17103
|
|
|
17126
|
-
let currentStep = getStep({ flowVersion, stepId:
|
|
17104
|
+
let currentStep = getStep({ flowVersion, stepId: _$1__default["default"].last(instance.traces).step });
|
|
17127
17105
|
|
|
17128
17106
|
const lastCCStep = getLastCCStep(instance, userId);
|
|
17129
17107
|
|
|
@@ -17155,7 +17133,7 @@ const getInstanceInfo = async ({ instanceId, box }) => {
|
|
|
17155
17133
|
approveValues: values,
|
|
17156
17134
|
title: instance.name || instance.form.name,
|
|
17157
17135
|
name: instance.name || instance.form.name,
|
|
17158
|
-
fields:
|
|
17136
|
+
fields: _$1__default["default"].map(formVersion.fields, (field) => {
|
|
17159
17137
|
return Object.assign({}, field, {
|
|
17160
17138
|
permission: userApprove?.type != 'cc' && (step?.permissions[field.code] || ( isCurrentStepOpinionField(field, step) ? 'editable' : '')),
|
|
17161
17139
|
}) ;
|
|
@@ -17173,10 +17151,10 @@ const getInstanceInfo = async ({ instanceId, box }) => {
|
|
|
17173
17151
|
forward_from_instance: instance.forward_from_instance,
|
|
17174
17152
|
cc_users: instance.cc_users,
|
|
17175
17153
|
traces: instance.traces,
|
|
17176
|
-
historyApproves:
|
|
17154
|
+
historyApproves: _$1__default["default"].map(instance.traces, (trace) => {
|
|
17177
17155
|
return Object.assign(
|
|
17178
17156
|
{
|
|
17179
|
-
children:
|
|
17157
|
+
children: _$1__default["default"].map(trace.approves, (approve) => {
|
|
17180
17158
|
let finishDate = approve.finish_date;
|
|
17181
17159
|
let judge = approve.judge;
|
|
17182
17160
|
let userName = approve.user_name;
|
|
@@ -17359,7 +17337,7 @@ var getSchema = function (field, value, ctx) { return __awaiter(void 0, void 0,
|
|
|
17359
17337
|
switch (_a.label) {
|
|
17360
17338
|
case 0:
|
|
17361
17339
|
refTo = field.reference_to;
|
|
17362
|
-
if (refTo &&
|
|
17340
|
+
if (refTo && _$1.isFunction(refTo)) {
|
|
17363
17341
|
refTo = refTo();
|
|
17364
17342
|
}
|
|
17365
17343
|
leftName = "".concat(field.name, "__left");
|
|
@@ -17394,7 +17372,7 @@ var getSchema = function (field, value, ctx) { return __awaiter(void 0, void 0,
|
|
|
17394
17372
|
if (!ctx) {
|
|
17395
17373
|
ctx = {};
|
|
17396
17374
|
}
|
|
17397
|
-
ctx.isRefToMutiple =
|
|
17375
|
+
ctx.isRefToMutiple = _$1.isArray(refTo);
|
|
17398
17376
|
return [4 /*yield*/, lookupToAmisSelect(Object.assign({}, field, { reference_to: value.o }), false, ctx)];
|
|
17399
17377
|
case 4:
|
|
17400
17378
|
rightSchema = _a.sent();
|
|
@@ -17468,8 +17446,8 @@ var AmisObjectFieldLookup = function (props) {
|
|
|
17468
17446
|
if (fieldName.endsWith("_left")) {
|
|
17469
17447
|
fieldValue.ids = [];
|
|
17470
17448
|
}
|
|
17471
|
-
if (
|
|
17472
|
-
fieldValue.ids =
|
|
17449
|
+
if (_$1.isString(fieldValue.ids)) {
|
|
17450
|
+
fieldValue.ids = _$1.compact(fieldValue.ids.split(','));
|
|
17473
17451
|
}
|
|
17474
17452
|
return [4 /*yield*/, amisDispatchEvent('change', createObject(data, {
|
|
17475
17453
|
fieldValue: fieldValue
|
|
@@ -17542,12 +17520,12 @@ var AmisObjectButton = function (props) {
|
|
|
17542
17520
|
// console.log('AmisObjectButton===>', button, className);
|
|
17543
17521
|
if (button.type === "amis_button") {
|
|
17544
17522
|
var amisSchema = button.amis_schema;
|
|
17545
|
-
var schema =
|
|
17523
|
+
var schema = _$1.isString(amisSchema) ? JSON.parse(amisSchema) : amisSchema;
|
|
17546
17524
|
if (schema && schema.body.length > 0) {
|
|
17547
17525
|
delete schema.body[0]['visibleOn'];
|
|
17548
17526
|
}
|
|
17549
17527
|
if (schema && className) {
|
|
17550
|
-
schema.className = schema.className + ' ' + className;
|
|
17528
|
+
schema.className = schema.className + ' steedos-object-button ' + className;
|
|
17551
17529
|
}
|
|
17552
17530
|
var renderData = Object.assign(data, { objectName: objectName, app_id: appId, className: className });
|
|
17553
17531
|
if (data._id) {
|
|
@@ -17557,7 +17535,7 @@ var AmisObjectButton = function (props) {
|
|
|
17557
17535
|
renderData.listViewId = data.listViewId;
|
|
17558
17536
|
}
|
|
17559
17537
|
if (schema) {
|
|
17560
|
-
schema.data =
|
|
17538
|
+
schema.data = _$1.defaultsDeep({}, renderData, getDefaultRenderData(), schema.data);
|
|
17561
17539
|
}
|
|
17562
17540
|
return (React__default["default"].createElement(React__default["default"].Fragment, null, button && amisSchema ? (React__default["default"].createElement(React__default["default"].Fragment, null, render('body', schema, {
|
|
17563
17541
|
// 这里的信息会作为 props 传递给子组件,一般情况下都不需要这个,
|
|
@@ -17568,12 +17546,12 @@ var AmisObjectButton = function (props) {
|
|
|
17568
17546
|
}))) : null));
|
|
17569
17547
|
}
|
|
17570
17548
|
else {
|
|
17571
|
-
return (React__default["default"].createElement("button", { onClick: buttonClick, className: "antd-Button antd-Button--default antd-Button--size-default ".concat(className ? className : '') }, button.label));
|
|
17549
|
+
return (React__default["default"].createElement("button", { onClick: buttonClick, className: "antd-Button antd-Button--default antd-Button--size-default steedos-object-button ".concat(className ? className : '') }, button.label));
|
|
17572
17550
|
}
|
|
17573
17551
|
};
|
|
17574
17552
|
|
|
17575
17553
|
var getMenu = function (render, buttons, btnClassName, props) {
|
|
17576
|
-
return
|
|
17554
|
+
return _$1.map(buttons, function (button) {
|
|
17577
17555
|
if (btnClassName) {
|
|
17578
17556
|
button.className = "".concat(button.className, " ").concat(btnClassName);
|
|
17579
17557
|
}
|
|
@@ -17594,7 +17572,7 @@ var SteedosDropdownButton = function (props) {
|
|
|
17594
17572
|
env.fetcher(onOpenApi, createObject(data, {})).then(function (result) {
|
|
17595
17573
|
var openData = (result === null || result === void 0 ? void 0 : result.hasOwnProperty('ok')) ? result.data : result;
|
|
17596
17574
|
setMenu(getMenu(render, buttons, btnClassName, {
|
|
17597
|
-
data: createObject(data,
|
|
17575
|
+
data: createObject(data, _$1.defaultsDeep(openData, data))
|
|
17598
17576
|
}));
|
|
17599
17577
|
}).catch(function (e) {
|
|
17600
17578
|
console.error(e);
|
|
@@ -17735,11 +17713,11 @@ var SteedosLoading = function (props) {
|
|
|
17735
17713
|
*/
|
|
17736
17714
|
var SteedosSkeleton = function (props) {
|
|
17737
17715
|
var body = props.body, render = props.render, _a = props.bodyClassName, bodyClassName = _a === void 0 ? "" : _a, _b = props.config, config = _b === void 0 ? {} : _b;
|
|
17738
|
-
if (
|
|
17716
|
+
if (_$1.isString(config)) {
|
|
17739
17717
|
config = JSON.parse(config);
|
|
17740
17718
|
}
|
|
17741
17719
|
var active = config.active, avatar = config.avatar, loading = config.loading, paragraph = config.paragraph, round = config.round, title = config.title;
|
|
17742
|
-
loading =
|
|
17720
|
+
loading = _$1.isBoolean(loading) ? loading : loading === 'true';
|
|
17743
17721
|
// console.log("SteedosSkeleton====>", loading, config, typeof loading)
|
|
17744
17722
|
return React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
17745
17723
|
React__default["default"].createElement(antd.Skeleton, { active: active, avatar: avatar, loading: loading, paragraph: paragraph, round: round, title: title }),
|
|
@@ -17755,8 +17733,8 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
17755
17733
|
case 0:
|
|
17756
17734
|
$schema = props.$schema, recordId = props.recordId, defaultData = props.defaultData, mode = props.mode, layout = props.layout, labelAlign = props.labelAlign, appId = props.appId, fieldsExtend = props.fieldsExtend, _a = props.excludedFields, excludedFields = _a === void 0 ? null : _a, _b = props.fields, fields = _b === void 0 ? null : _b, _c = props.form, form = _c === void 0 ? {} : _c, _d = props.className, className = _d === void 0 ? "" : _d, initApiRequestAdaptor = props.initApiRequestAdaptor, initApiAdaptor = props.initApiAdaptor, apiRequestAdaptor = props.apiRequestAdaptor, apiAdaptor = props.apiAdaptor, enableTabs = props.enableTabs, tabsMode = props.tabsMode;
|
|
17757
17735
|
objectApiName = props.objectApiName || "space_users";
|
|
17758
|
-
schemaKeys =
|
|
17759
|
-
formSchema =
|
|
17736
|
+
schemaKeys = _$1.difference(_$1.keys($schema), ["id", "form", "type", "mode", "layout", "defaultData"]);
|
|
17737
|
+
formSchema = _$1.pick(props, schemaKeys);
|
|
17760
17738
|
defaults = {
|
|
17761
17739
|
formSchema: Object.assign({}, formSchema, form)
|
|
17762
17740
|
};
|
|
@@ -17771,7 +17749,7 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
17771
17749
|
fields: fields
|
|
17772
17750
|
};
|
|
17773
17751
|
try {
|
|
17774
|
-
options.fieldsExtend =
|
|
17752
|
+
options.fieldsExtend = _$1.isString(fieldsExtend) ? JSON.parse(fieldsExtend) : fieldsExtend;
|
|
17775
17753
|
}
|
|
17776
17754
|
catch (error) {
|
|
17777
17755
|
console.warn(error);
|
|
@@ -17820,12 +17798,12 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
17820
17798
|
// if(objectApiName){
|
|
17821
17799
|
// formData.objectName = objectApiName;
|
|
17822
17800
|
// }
|
|
17823
|
-
if (
|
|
17801
|
+
if (_$1.has(props, "recordId") && $schema.recordId !== "${recordId}") {
|
|
17824
17802
|
formData.recordId = props.recordId;
|
|
17825
17803
|
}
|
|
17826
17804
|
amisSchema.className = "steedos-object-form ".concat(className);
|
|
17827
17805
|
amisSchema.data = Object.assign(amisSchema.data, formData, { global: globalData, uiSchema: uiSchema });
|
|
17828
|
-
if (
|
|
17806
|
+
if (_$1.has(props, 'objectApiName')) {
|
|
17829
17807
|
amisSchema.data.objectName = objectApiName;
|
|
17830
17808
|
}
|
|
17831
17809
|
return [2 /*return*/, amisSchema];
|
|
@@ -17869,7 +17847,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
17869
17847
|
return [4 /*yield*/, getUISchema(objectApiName, false)];
|
|
17870
17848
|
case 1:
|
|
17871
17849
|
uiSchema = _j.sent();
|
|
17872
|
-
listView =
|
|
17850
|
+
listView = _$1.find(uiSchema.list_views, function (listView, name) {
|
|
17873
17851
|
// 传入listViewName空值则取第一个
|
|
17874
17852
|
if (!listName) {
|
|
17875
17853
|
listName = name;
|
|
@@ -17887,8 +17865,8 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
17887
17865
|
}
|
|
17888
17866
|
listName = listView.name;
|
|
17889
17867
|
if (!(ctx && ctx.defaults)) {
|
|
17890
|
-
schemaKeys =
|
|
17891
|
-
listSchema =
|
|
17868
|
+
schemaKeys = _$1.difference(_$1.keys($schema), ["type", "showHeader", "id", "crud"]);
|
|
17869
|
+
listSchema = _$1.pick(props, schemaKeys);
|
|
17892
17870
|
// className不传入crud组件,crud单独识别crudClassName属性
|
|
17893
17871
|
listSchema.className = crudClassName;
|
|
17894
17872
|
listSchema.onEvent = {}; // 为啥要将一个内置event放在此处?
|
|
@@ -17924,16 +17902,16 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
17924
17902
|
headerSchema = getObjectListHeader$1(uiSchema, listName, ctx);
|
|
17925
17903
|
}
|
|
17926
17904
|
serviceData = Object.assign({}, { showDisplayAs: showDisplayAs, displayAs: displayAs, recordPermissions: uiSchema.permissions, _id: null, $listviewId: listName });
|
|
17927
|
-
if (
|
|
17905
|
+
if (_$1.has(props, 'objectApiName')) {
|
|
17928
17906
|
serviceData.objectName = objectApiName;
|
|
17929
17907
|
}
|
|
17930
|
-
if (
|
|
17908
|
+
if (_$1.has(props, 'listName') && _$1.has(props, '$$editor')) {
|
|
17931
17909
|
serviceData.listName = listName;
|
|
17932
17910
|
}
|
|
17933
|
-
if (!
|
|
17911
|
+
if (!_$1.has(data, 'uiSchema')) {
|
|
17934
17912
|
serviceData.uiSchema = uiSchema;
|
|
17935
17913
|
}
|
|
17936
|
-
serviceData.defaultListName = listName ? listName : (_h =
|
|
17914
|
+
serviceData.defaultListName = listName ? listName : (_h = _$1.first(_$1.values(uiSchema.list_views))) === null || _h === void 0 ? void 0 : _h.name;
|
|
17937
17915
|
// console.timeEnd('AmisObjectListView')
|
|
17938
17916
|
// console.log('serviceData===>', serviceData)
|
|
17939
17917
|
// console.log('headerSchema===>', headerSchema)
|
|
@@ -17944,7 +17922,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
17944
17922
|
body: [{
|
|
17945
17923
|
"type": "wrapper",
|
|
17946
17924
|
"size": "none",
|
|
17947
|
-
"className": "flex flex-1
|
|
17925
|
+
"className": "flex flex-1 h-full",
|
|
17948
17926
|
body: [
|
|
17949
17927
|
sideSchema ? {
|
|
17950
17928
|
"type": "wrapper",
|
|
@@ -17994,7 +17972,7 @@ function getTableColumns(columns, includedFields, fieldsExtend) {
|
|
|
17994
17972
|
}
|
|
17995
17973
|
var tableColumns = [];
|
|
17996
17974
|
var _fieldsExtend = fieldsExtend;
|
|
17997
|
-
if (
|
|
17975
|
+
if (_$1.isString(_fieldsExtend)) {
|
|
17998
17976
|
try {
|
|
17999
17977
|
_fieldsExtend = JSON.parse(_fieldsExtend);
|
|
18000
17978
|
}
|
|
@@ -18002,7 +17980,7 @@ function getTableColumns(columns, includedFields, fieldsExtend) {
|
|
|
18002
17980
|
_fieldsExtend = {};
|
|
18003
17981
|
}
|
|
18004
17982
|
}
|
|
18005
|
-
|
|
17983
|
+
_$1.each(includedFields, function (fName) {
|
|
18006
17984
|
var extend = {};
|
|
18007
17985
|
try {
|
|
18008
17986
|
extend = _fieldsExtend[fName] || {};
|
|
@@ -18032,8 +18010,8 @@ var AmisObjectTable = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
18032
18010
|
defaults = {};
|
|
18033
18011
|
objectApiName = props.objectApiName || "space_users";
|
|
18034
18012
|
if (!(ctx && ctx.defaults)) {
|
|
18035
|
-
schemaKeys =
|
|
18036
|
-
listSchema =
|
|
18013
|
+
schemaKeys = _$1.difference(_$1.keys($schema), ["type", "objectApiName", "columns", "extraColumns", "id", "crud"]);
|
|
18014
|
+
listSchema = _$1.pick(props, schemaKeys);
|
|
18037
18015
|
// className不传入crud组件,crud单独识别crudClassName属性
|
|
18038
18016
|
listSchema.className = "";
|
|
18039
18017
|
defaults = {
|
|
@@ -18053,12 +18031,12 @@ var AmisObjectTable = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
18053
18031
|
amisSchemaData = Object.assign({}, data, defaultData);
|
|
18054
18032
|
appId = (data === null || data === void 0 ? void 0 : data.appId) || (defaultData === null || defaultData === void 0 ? void 0 : defaultData.appId);
|
|
18055
18033
|
// ctx中值为undefined的属性不能保留,否则会导致 filters等被覆盖。
|
|
18056
|
-
ctx =
|
|
18034
|
+
ctx = _$1.pickBy(ctx, function (value) { return value !== undefined; });
|
|
18057
18035
|
return [4 /*yield*/, getTableSchema(appId, objectApiName, columns, __assign$2(__assign$2({ filters: tableFilters, filtersFunction: filtersFunction, top: top, sort: sort, sortField: sortField, sortOrder: sortOrder, extraColumns: extraColumns, defaults: defaults }, ctx), { setDataToComponentId: setDataToComponentId, requestAdaptor: requestAdaptor, adaptor: adaptor, filterVisible: filterVisible, headerToolbarItems: headerToolbarItems }))];
|
|
18058
18036
|
case 1:
|
|
18059
18037
|
amisSchema = (_e.sent()).amisSchema;
|
|
18060
18038
|
amisSchema.data = Object.assign({}, amisSchema.data, amisSchemaData);
|
|
18061
|
-
if (
|
|
18039
|
+
if (_$1.has(props, 'objectApiName')) {
|
|
18062
18040
|
amisSchema.data.objectName = objectApiName;
|
|
18063
18041
|
}
|
|
18064
18042
|
amisSchema.className = "steedos-object-table h-full flex flex-col ".concat(className);
|
|
@@ -18168,7 +18146,7 @@ var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
18168
18146
|
// recordDetailData.recordId = recordId;
|
|
18169
18147
|
// }
|
|
18170
18148
|
// schema.data = Object.assign({}, schema.data, recordDetailData);
|
|
18171
|
-
if (
|
|
18149
|
+
if (_$1.has(props, "recordId") && $schema.recordId !== "${recordId}") {
|
|
18172
18150
|
schema.data.recordId = props.recordId;
|
|
18173
18151
|
}
|
|
18174
18152
|
schema.className = className;
|
|
@@ -18233,14 +18211,14 @@ var AmisRecordDetailRelatedList = function (props) { return __awaiter(void 0, vo
|
|
|
18233
18211
|
}];
|
|
18234
18212
|
}
|
|
18235
18213
|
formData = {};
|
|
18236
|
-
if (
|
|
18214
|
+
if (_$1.has(props, "recordId") && $schema.recordId !== "${recordId}") {
|
|
18237
18215
|
formData.recordId = recordId;
|
|
18238
18216
|
}
|
|
18239
18217
|
return [4 /*yield*/, getRecordDetailRelatedListSchema(objectApiName, recordId, relatedObjectApiName, relatedKey, { top: top, perPage: perPage, appId: appId, relatedLabel: relatedLabel, className: className, formFactor: formFactor, columns: columns, sort: sort, filters: filters, visible_on: visible_on, isRelated: true, hiddenEmptyTable: hiddenEmptyTable, requestAdaptor: requestAdaptor, adaptor: adaptor })];
|
|
18240
18218
|
case 1:
|
|
18241
18219
|
schema = (_c.sent()).amisSchema;
|
|
18242
18220
|
schema.data = Object.assign(schema.data || {}, formData);
|
|
18243
|
-
if (
|
|
18221
|
+
if (_$1.has(props, "recordId") && $schema.recordId !== "${recordId}") {
|
|
18244
18222
|
schema.data = Object.assign(schema.data, {
|
|
18245
18223
|
_master: {
|
|
18246
18224
|
record: (_b = data === null || data === void 0 ? void 0 : data._master) === null || _b === void 0 ? void 0 : _b.record,
|
|
@@ -18284,13 +18262,13 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
|
|
|
18284
18262
|
}];
|
|
18285
18263
|
}
|
|
18286
18264
|
staticRecordId = '';
|
|
18287
|
-
if (
|
|
18265
|
+
if (_$1.has(props, "recordId") && $schema.recordId !== "${recordId}") {
|
|
18288
18266
|
staticRecordId = recordId;
|
|
18289
18267
|
}
|
|
18290
18268
|
return [2 /*return*/, {
|
|
18291
18269
|
type: 'service',
|
|
18292
18270
|
className: "steedos-record-detail-related-lists",
|
|
18293
|
-
body:
|
|
18271
|
+
body: _$1.map(relatedLists, function (item) {
|
|
18294
18272
|
var relatedList = {
|
|
18295
18273
|
type: 'steedos-object-related-listview',
|
|
18296
18274
|
objectApiName: objectApiName,
|
|
@@ -18379,6 +18357,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
18379
18357
|
if (isMobile) {
|
|
18380
18358
|
dialogSchema = {
|
|
18381
18359
|
"type": "service",
|
|
18360
|
+
"className": "steedos-apps-service",
|
|
18382
18361
|
"affixFooter": false,
|
|
18383
18362
|
"body": [
|
|
18384
18363
|
{
|
|
@@ -18615,7 +18594,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
18615
18594
|
],
|
|
18616
18595
|
}
|
|
18617
18596
|
],
|
|
18618
|
-
"className": "",
|
|
18597
|
+
"className": "steedos-apps-service",
|
|
18619
18598
|
"visibleOn": "",
|
|
18620
18599
|
"clearValueOnHidden": false,
|
|
18621
18600
|
"visible": true,
|
|
@@ -18749,7 +18728,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
18749
18728
|
schemaApi: {
|
|
18750
18729
|
"method": "get",
|
|
18751
18730
|
"url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
|
|
18752
|
-
"adaptor": "\n try {\n console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n })\n })\n } else {\n var tabGroup = _.find(tab_groups, {\"group_name\": groupName});\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": tabGroup && tabGroup.default_open != false,\n \"children\": _.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n }\n })\n }) \n }\n });\n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n });\n })\n }\n\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n console.log('payload===2==>', payload)\n return payload;\n "),
|
|
18731
|
+
"adaptor": "\n try {\n console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n })\n })\n } else {\n var tabGroup = _.find(tab_groups, {\"group_name\": groupName});\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": tabGroup && tabGroup.default_open != false,\n \"isGroup\": true,\n \"children\": _.sortBy(_.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n }\n }),(tab) => {return tab.index})\n }) \n }\n });\n \n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n });\n })\n }\n //\u4EE5\u4E0B\u4E3Anav\u7B2C\u4E00\u5C42\u6392\u5E8F\uFF0C\u5305\u62EC\u5206\u7EC4\u4E0E\u9009\u9879\u5361\n let groupLength = ((payload.tab_groups && payload.tab_groups.length) || 0) + 1000;\n data.nav = _.sortBy(data.nav, function(tab){\n if(tab.isGroup){\n return _.findIndex(payload.tab_groups, function(group){\n return group.group_name === tab.label;\n });\n }else{\n return groupLength + tab.index;\n }\n })\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n console.log('payload===2==>', payload)\n return payload;\n "),
|
|
18753
18732
|
"headers": {
|
|
18754
18733
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
18755
18734
|
}
|
|
@@ -18800,7 +18779,7 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
|
|
|
18800
18779
|
schemaApi: {
|
|
18801
18780
|
"method": "get",
|
|
18802
18781
|
"url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus?mobile=true"),
|
|
18803
|
-
"adaptor": "\n try {\n if(payload.children.length == 0){\n payload.data = {};\n return payload\n }\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"\";\n let sum = 0;\n _.each(payload.children, (tab)=>{\n sum++;\n const classIcon = tab.icon.replace(/_/g,\"-\");\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n if(sum >= 5){\n data.nav.push({\n \"label\": {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\"slds-icon slds-icon_container slds-icon-standard-`+classIcon+` flex-shrink-0 h-10 w-10\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg><span>${tab.name}</span><i class=\"fa fa-angle-right\" aria-hidden=\"true\" style=\"position: absolute;right: 20px;color: #bababa;\"></i></span>`,\n className:'h-full flex items-center'\n },\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n });\n }else{\n data.nav.push({\n \"label\": {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 truncate text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\"slds-icon slds-icon_container slds-icon-standard-`+classIcon+` flex-shrink-0 h-10 w-10\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg><span class=\"truncate\" style=\"max-width: 20vw\">${tab.name}</span></span>`,\n className:'h-full flex items-center'\n },\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n });\n }\n })\n
|
|
18782
|
+
"adaptor": "\n try {\n if(payload.children.length == 0){\n payload.data = {};\n return payload\n }\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"\";\n let sum = 0;\n payload.children = _.sortBy(payload.children, function(tab){\n return tab.index;\n })\n _.each(payload.children, (tab)=>{\n sum++;\n const classIcon = tab.icon.replace(/_/g,\"-\");\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n if(sum >= 5){\n data.nav.push({\n \"label\": {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\"slds-icon slds-icon_container slds-icon-standard-`+classIcon+` flex-shrink-0 h-10 w-10\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg><span>${tab.name}</span><i class=\"fa fa-angle-right\" aria-hidden=\"true\" style=\"position: absolute;right: 20px;color: #bababa;\"></i></span>`,\n className:'h-full flex items-center'\n },\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n });\n }else{\n data.nav.push({\n \"label\": {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 truncate text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\"slds-icon slds-icon_container slds-icon-standard-`+classIcon+` flex-shrink-0 h-10 w-10\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg><span class=\"truncate\" style=\"max-width: 20vw\">${tab.name}</span></span>`,\n className:'h-full flex items-center'\n },\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n });\n }\n })\n payload.data = {\n \"type\": \"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"footerService\",\n \"body\": {\n \"type\": \"nav\",\n className: \"").concat(className, "\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": {\n \"enable\": true,\n \"maxVisibleCount\": 4,\n \"overflowPopoverClassName\": \"steedos-global-footer-popup\",\n \"overflowLabel\":{\n \"type\": 'tpl',\n \"tpl\": `<span class=' truncate text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\"!fill-slate-500 flex-shrink-0 !h-10 !w-10\" style=\"padding:7px\"><use xlink:href=\"/assets/icons/utility-sprite/svg/symbols.svg#rows\"></use></svg><span class=\"truncate\" style=\"max-width: 20vw\">").concat(instance.t('frontend_menu'), "</span></span>`,\n \"className\":'h-full flex items-center'\n },\n \"overflowIndicator\":\"\"\n },\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"footerService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"footerService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n }\n ]\n }\n }\n }\n \n };\n } catch (error) {\n console.log(`error`, error)\n }\n return payload;\n "),
|
|
18804
18783
|
"headers": {
|
|
18805
18784
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
18806
18785
|
}
|
|
@@ -18815,7 +18794,7 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
|
|
|
18815
18794
|
* @Author: baozhoutao@steedos.com
|
|
18816
18795
|
* @Date: 2022-09-01 14:44:57
|
|
18817
18796
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
18818
|
-
* @LastEditTime: 2023-08-
|
|
18797
|
+
* @LastEditTime: 2023-08-28 15:04:28
|
|
18819
18798
|
* @Description:
|
|
18820
18799
|
*/
|
|
18821
18800
|
var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -18960,7 +18939,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
18960
18939
|
"name": "notifications",
|
|
18961
18940
|
"items": {
|
|
18962
18941
|
"type": "tpl",
|
|
18963
|
-
"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-slate-700'>\n <%=data.body%>\n </div>\n <div class='mt-1 text-slate-700'>\n <%=moment(data.created).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>",
|
|
18942
|
+
"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-slate-700'>\n <%=data.body%>\n </div>\n <div class='mt-1 text-slate-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>",
|
|
18964
18943
|
"id": "u:07ece657c7b7",
|
|
18965
18944
|
"onEvent": {
|
|
18966
18945
|
"click": {
|
|
@@ -19424,22 +19403,22 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
19424
19403
|
steedosField = null;
|
|
19425
19404
|
field = props.field, _a = props.readonly, readonly = _a === void 0 ? false : _a, _b = props.ctx, ctx = _b === void 0 ? {} : _b, config = props.config, $schema = props.$schema, fStatic = props.static;
|
|
19426
19405
|
// console.log(`AmisSteedosField`, props)
|
|
19427
|
-
if ($schema.config &&
|
|
19406
|
+
if ($schema.config && _$1.isString($schema.config)) {
|
|
19428
19407
|
$schema.config = JSON.parse($schema.config);
|
|
19429
19408
|
props.config = $schema.config;
|
|
19430
19409
|
}
|
|
19431
|
-
if (
|
|
19410
|
+
if (_$1.isString(ctx)) {
|
|
19432
19411
|
ctx = JSON.parse(ctx);
|
|
19433
19412
|
}
|
|
19434
19413
|
if (config) {
|
|
19435
19414
|
steedosField = config;
|
|
19436
|
-
if (
|
|
19415
|
+
if (_$1.isString(steedosField)) {
|
|
19437
19416
|
steedosField = JSON.parse(config);
|
|
19438
19417
|
}
|
|
19439
19418
|
}
|
|
19440
19419
|
else {
|
|
19441
19420
|
steedosField = field;
|
|
19442
|
-
if (
|
|
19421
|
+
if (_$1.isString(field)) {
|
|
19443
19422
|
steedosField = JSON.parse(field);
|
|
19444
19423
|
}
|
|
19445
19424
|
}
|
|
@@ -19451,7 +19430,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
19451
19430
|
if (!props.data[steedosField.name]) {
|
|
19452
19431
|
return [2 /*return*/, {}];
|
|
19453
19432
|
}
|
|
19454
|
-
if (!
|
|
19433
|
+
if (!_$1.isString(steedosField.reference_to)) return [3 /*break*/, 3];
|
|
19455
19434
|
return [4 /*yield*/, getReferenceTo(steedosField)];
|
|
19456
19435
|
case 2:
|
|
19457
19436
|
referenceTo = _h.sent();
|
|
@@ -19460,7 +19439,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
19460
19439
|
valueFieldKey = referenceTo && ((_c = referenceTo.valueField) === null || _c === void 0 ? void 0 : _c.name) || '_id';
|
|
19461
19440
|
labelFieldKey = referenceTo && ((_d = referenceTo.labelField) === null || _d === void 0 ? void 0 : _d.name) || 'name';
|
|
19462
19441
|
value = props.data[steedosField.name];
|
|
19463
|
-
if (
|
|
19442
|
+
if (_$1.isString(value)) {
|
|
19464
19443
|
value = [value];
|
|
19465
19444
|
}
|
|
19466
19445
|
filters = [referenceToField, "in", value];
|
|
@@ -19489,7 +19468,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
19489
19468
|
"url": "${context.rootUrl}/graphql",
|
|
19490
19469
|
"requestAdaptor": "\n api.data = {\n query: '{options:".concat(objectName, "(filters: ").concat(JSON.stringify(filters), "){label: ").concat(labelFieldKey, ",value: ").concat(valueFieldKey, "}}'\n }\n return api;\n ")
|
|
19491
19470
|
}
|
|
19492
|
-
},
|
|
19471
|
+
}, _$1.pick(steedosField.amis || {}, ['className', 'inline', 'label', 'labelAlign', 'name', 'labelRemark', 'description', 'placeholder', 'staticClassName', 'staticLabelClassName', 'staticInputClassName', 'staticSchema']));
|
|
19493
19472
|
// console.log(`AmisSteedosField return schema`, schema)
|
|
19494
19473
|
return [2 /*return*/, schema];
|
|
19495
19474
|
case 6: return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
@@ -19510,8 +19489,8 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
19510
19489
|
/*
|
|
19511
19490
|
* @Author: baozhoutao@steedos.com
|
|
19512
19491
|
* @Date: 2023-01-14 16:41:24
|
|
19513
|
-
* @LastEditors:
|
|
19514
|
-
* @LastEditTime: 2023-
|
|
19492
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
19493
|
+
* @LastEditTime: 2023-09-05 17:06:44
|
|
19515
19494
|
* @Description:
|
|
19516
19495
|
*/
|
|
19517
19496
|
var getSelectFlowSchema = function (id, props) {
|
|
@@ -19659,7 +19638,7 @@ var getSelectFlowSchema = function (id, props) {
|
|
|
19659
19638
|
method: "post",
|
|
19660
19639
|
url: "${context.rootUrl}/graphql?keywords=${keywords}",
|
|
19661
19640
|
requestAdaptor: "\n const keywords = api.body.keywords || '';\n const appId = '".concat(data.app_id || "", "';\n api.data = {\n query: `\n {\n options: flows__getList(action: \"").concat(action, "\", keywords: \"${keywords}\", appId: \"${appId}\", distributeInstanceId: \"").concat(distributeInstanceId, "\", distributeStepId: \"").concat(distributeStepId, "\"){\n value:_id\n label:name\n children: flows{\n value: _id,\n label: name\n }\n }\n }\n `\n }\n "),
|
|
19662
|
-
adaptor: "\n var options = payload.data.options;\n if(options){\n options.forEach(function(item,index) {\n if(item.value != 'startFlows' && (!item.children || item.children.length == 0)){\n payload.data.options.splice(index,1)\n }\n })\n }\n return payload;\n ",
|
|
19641
|
+
adaptor: "\n var options = payload.data.options;\n if(options){\n options.forEach(function(item,index) {\n if(item.value != 'startFlows' && (!item.children || item.children.length == 0)){\n payload.data.options.splice(index,1)\n }\n })\n }\n if(payload.data.options.length === 1 && payload.data.options[0].children.length === 1){\n payload.data.value = payload.data.options[0].children[0].value\n }\n return payload;\n ",
|
|
19663
19642
|
"headers": {
|
|
19664
19643
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
19665
19644
|
}
|
|
@@ -19674,7 +19653,7 @@ var getSelectFlowSchema = function (id, props) {
|
|
|
19674
19653
|
*/
|
|
19675
19654
|
var AmisSelectFlow = function (props) {
|
|
19676
19655
|
//mode: "input-tree" | "tree-select"
|
|
19677
|
-
var _a = props.mode, mode = _a === void 0 ? "input-tree" : _a, _b = props.id, id = _b === void 0 ? "selectFlow" +
|
|
19656
|
+
var _a = props.mode, mode = _a === void 0 ? "input-tree" : _a, _b = props.id, id = _b === void 0 ? "selectFlow" + _$1.random(10000, 99999) : _b;
|
|
19678
19657
|
console.log("AmisSelectFlow props", props);
|
|
19679
19658
|
var inputId = "".concat(id, "_input");
|
|
19680
19659
|
var flowSchema = getSelectFlowSchema(inputId, props);
|
|
@@ -19905,7 +19884,7 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
19905
19884
|
});
|
|
19906
19885
|
}); };
|
|
19907
19886
|
|
|
19908
|
-
var __assign=function(){return (__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},StandardObjects={Base:{Actions:{standard_query:{visible:function(e,t,r){return !1}},standard_new:{visible:function(e,t,r){return "cms_files"!==e&&"instances"!==e&&(r?r.allowCreate:void 0)}},standard_edit:{visible:function(e,t,r){if(r)return r.allowEdit}},standard_delete:{visible:function(e,t,r){if(r)return r.allowDelete}},standard_import_data:{visible:function(e,t,r){var n=this.object;if(r)return r.allowCreate&&n.hasImportTemplates}},standard_approve:{visible:function(e,t,r){return !1}},standard_view_instance:{visible:function(e,t,r){return !1}},standard_submit_for_approval:{visible:function(e,t,r){return window.Steedos.ProcessManager.allowSubmit.apply(this,[e,t])},todo:function(e,t){return window.Steedos.ProcessManager.submit.apply(this,[e,t])}},standard_follow:{visible:function(e,t,r){return !1}},standard_delete_many:{visible:function(e,t,r){return !RegExp("\\w+/view/\\w+").test(location.pathname)&&(r?r.allowDelete:void 0)}},standard_export_excel:{visible:function(e,t,r){return !1}}}}},authRequest=function(e,t){var s=null;e=Steedos.absoluteUrl(e);try{var r=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],n={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(r&&r.length)return r.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){s=e;},error:function(e,t,r){var n,o;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,o=void(s={error:n}),o=n.reason||n.message||n,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),s}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}const newFunctionComponent=o=>e=>{const[t,r]=React.useState(!0);var n=()=>{r(!1);};return ___default.has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React__default["default"].createElement(o,_extends({visible:t,onCancel:n,onClose:n},{width:"70%",style:{width:"70%",maxWidth:"950px",minWidth:"480px"}},e))},newComponentRender=(r,n)=>(e,t)=>{e.name||(e.name=r+"-"+(e.name||"default")),(t=t||document.getElementById(`steedos-${r}-root-`+e.name))||((t=document.createElement("div")).setAttribute("id",`steedos-${r}-root-`+e.name),document.body.appendChild(t));e=React__default["default"].createElement(newFunctionComponent(n),e);ReactDOM.createRoot(t).render(e);},Modal=___default.assign(newComponentRender("modal",antd.Modal),{info:antd.Modal.info,success:antd.Modal.success,error:antd.Modal.error,warning:antd.Modal.warning,confirm:antd.Modal.confirm}),Drawer=newComponentRender("drawer",antd.Drawer),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),___default.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):___default.isEmpty(t)?e.filters:[e.filters,"and",t]},getFirstListView:async e=>{e=await window.getUISchema(e);return _.first(_.sortBy(_.values(e.list_views),"sort_no"))}},Router={getAppPath({appId:e}){return "/app/"+e},getPagePath(){},getObjectListViewPath({appId:e,objectName:t,listViewName:r}){return `/app/${e}/${t}/grid/`+r},getObjectDetailPath({appId:e,objectName:t,recordId:r}){return `/app/${e}/${t}/view/`+r},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:r,objectName:n,foreignKey:o}){return `/app/${e}/${t}/${r}/${n}/grid?related_field_name=`+o}};var withModalWrap=function(t,e){return function(e){return React.createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=React.createElement(e,__assign({},t));return ReactDOM__default["default"].render(e,r)};const safeRunFunction=(t,r,n,o)=>{try{var s=window.Creator;if(!!(!s||!s.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return ___default.isNil(r)||(e=___default.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)))},parseSingleExpression=function(t,e,r,n){var o,s=function(e,t){return "#"!==t&&t?"string"==typeof t?_.get(e,t):void console.error("path has to be a string"):e||{}}(e=void 0===e?{}:e,function(e){return "string"!=typeof e||1===(e=e.split(".")).length?"#":(e.pop(),e.join("."))}(r))||{};if("string"!=typeof t)return t;o="__G_L_O_B_A_L__",e="\n return "+t.substring(2,t.length-2).replace(/\bformData\b/g,JSON.stringify(e).replace(/\bglobal\b/g,o)).replace(/\bglobal\b/g,JSON.stringify(n)).replace(new RegExp("\\b"+o+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(s));try{return Function(e)()}catch(e){return console.log(e,t,r),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,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")?`{${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})`)),___default.isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),___default.isString(r)&&(r=getCompatibleDefaultValueExpression(r,e.multiple));var n=isExpression(r);return n&&(r=parseSingleExpression(r,{},"#",t)),"select"===e.type&&(t=e.data_type||"text",!r||n||e.multiple||("text"!==t||___default.isString(r)?"number"!==t||___default.isNumber(r)?"boolean"!==t||___default.isBoolean(r)||(r="true"===r):r=Number(r):r=String(r))),r};function getTreeOptions(t,e){const o=e?.valueField||"value";e?.labelField;const r=e?.unfoldedNum||1,n=[],s=(t,r,n)=>{var e;if(r)return e=_.filter(t,e=>_.includes(r,e[o])),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=s(t,e.children,n-1))):e.children&&(e.children=s(t,e.children,n));}),e};for(var i=t,a=0;a<i.length;a++)if(i[a].noParent=0,i[a].unfolded=!1,i[a].parent){let e=1;for(var l=0;l<i.length;l++)i[a].parent==i[l][o]&&(e=0);1==e&&(i[a].noParent=1);}else i[a].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=r?(e.unfolded=!0,n.push(Object.assign({},e,{children:s(t,e.children,r-1)}))):n.push(Object.assign({},e,{children:s(t,e.children,r)})));}),n}function getClosestAmisComponentByType(t,r,n){let o=(n=n||{}).name;var e=n.direction||"up";let s=t.getComponents().find(function(e){return e.props.type===r&&(!o||e.props.name===o)});if(s)return s;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(s=getClosestAmisComponentByType(t.children[e],r,n));e++);return s}}else if("up"===e&&t.parent)return getClosestAmisComponentByType(t.parent,r,n)}function isFilterFormValuesEmpty(e){let t=!0;var e=_.pickBy(e,function(e,t){return /^__searchable__/g.test(t)});return _.isEmpty(e)||(e=_.omitBy(e,function(e){return _.isNil(e)||_.isObject(e)&&_.isEmpty(e)||_.isArray(e)&&_.isEmpty(e.filter(function(e){return !_.isNil(e)}))||_.isString(e)&&0===e.length}),_.isEmpty(e)||(t=!1)),t}const SteedosUI$1=Object.assign({},{render:render,Router:Router,ListView:ListView,Object:SObject,Modal:Modal,Drawer:Drawer,refs:{},getRef(e){return SteedosUI$1.refs[e]},router:{go:(e,t)=>{var r=window.FlowRouter;if(t)return r?r.go(t):window.open(t);r?r.reload():console.warn("暂不支持自动跳转",e);},reload:()=>{console.log("reload");}},message:antd.message,notification:antd.notification,components:{Button:antd.Button,Space:antd.Space},getRefId:({type:e,appId:t,name:r})=>{switch(e){case"listview":return `amis-${t}-${r}-listview`;case"form":return `amis-${t}-${r}-form`;case"detail":return `amis-${t}-${r}-detail`;default:return `amis-${t}-${r}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType,isFilterFormValuesEmpty:isFilterFormValuesEmpty,getSearchFilter:e=>{var o=[];return _.each(e,(e,t)=>{var r,n;_.isEmpty(e)&&!_.isBoolean(e)||(_.startsWith(t,"__searchable__between__")?o.push([""+t.replace("__searchable__between__",""),"between",e]):_.startsWith(t,"__searchable__")&&(_.isString(e)?o.push([""+t.replace("__searchable__",""),"contains",e]):_.isObject(e)&&e.o?(n=[[(r=""+t.replace("__searchable__",""))+"/o","=",e.o]],e.ids.length&&n.push([r+"/ids","=",e.ids]),o.push(n)):o.push([""+t.replace("__searchable__",""),"=",e])));}),o},getKeywordsSearchFilter:(e,t)=>{const o=[];var s;return e&&t&&(s=e.split(/\s+/),s=___default.compact(s),t.forEach(function(r,e){let n=[];1==s.length?n=[r,"contains",s[0]]:s.forEach(function(e,t){n.push([r,"contains",e]),t<s.length-1&&n.push("or");}),n.length&&(o.push(n),e<t.length-1&&o.push("or"));})),o}});var getBuilderContext=function(){return "undefined"==typeof window?{}:Builder.settings.context||Builder.settings},Steedos$1=__assign({getRootUrl:function(e){var t=getBuilderContext();return t.rootUrl||("undefined"!=typeof window?window.localStorage.getItem("steedos:rootUrl"):"")||e},absoluteUrl:function(e){return void 0===e&&(e=""),"".concat(Steedos$1.getRootUrl()).concat(e)},getTenantId:function(){try{var e=getBuilderContext().tenantId;return (e=window.location.search&&!e?new URLSearchParams(window.location.search).get("X-Space-Id"):e)?e:null}catch(e){console.error(e);}},getAuthorization:function(){try{var e=getBuilderContext(),t=e.tenantId,r=e.authToken;return t&&r?"Bearer ".concat(t,",").concat(r):null}catch(e){console.error(e);}},authRequest:authRequest,StandardObjects:StandardObjects},Expression);"undefined"==typeof window||window.Steedos||(window.Steedos=Steedos$1),"undefined"==typeof window||window.SteedosUI||(window.SteedosUI=SteedosUI$1);
|
|
19887
|
+
var __assign=function(){return (__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},StandardObjects={Base:{Actions:{standard_query:{visible:function(e,t,r){return !1}},standard_new:{visible:function(e,t,r){return "cms_files"!==e&&"instances"!==e&&(r?r.allowCreate:void 0)}},standard_edit:{visible:function(e,t,r){if(r)return r.allowEdit}},standard_delete:{visible:function(e,t,r){if(r)return r.allowDelete}},standard_import_data:{visible:function(e,t,r){var n=this.object;if(r)return r.allowCreate&&n.hasImportTemplates}},standard_approve:{visible:function(e,t,r){return !1}},standard_view_instance:{visible:function(e,t,r){return !1}},standard_submit_for_approval:{visible:function(e,t,r){return window.Steedos.ProcessManager.allowSubmit.apply(this,[e,t])},todo:function(e,t){return window.Steedos.ProcessManager.submit.apply(this,[e,t])}},standard_follow:{visible:function(e,t,r){return !1}},standard_delete_many:{visible:function(e,t,r){return !RegExp("\\w+/view/\\w+").test(location.pathname)&&(r?r.allowDelete:void 0)}},standard_export_excel:{visible:function(e,t,r){return !1}}}}},authRequest=function(e,t){var s=null;e=Steedos.absoluteUrl(e);try{var r=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],n={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(r&&r.length)return r.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){s=e;},error:function(e,t,r){var n,o;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,o=void(s={error:n}),o=n.reason||n.message||n,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),s}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}const newFunctionComponent=o=>e=>{const[t,r]=React.useState(!0);var n=()=>{r(!1);};return _$1.has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React__default["default"].createElement(o,_extends({visible:t,onCancel:n,onClose:n},{width:"70%",style:{width:"70%",maxWidth:"950px",minWidth:"480px"}},e))},newComponentRender=(r,n)=>(e,t)=>{e.name||(e.name=r+"-"+(e.name||"default")),(t=t||document.getElementById(`steedos-${r}-root-`+e.name))||((t=document.createElement("div")).setAttribute("id",`steedos-${r}-root-`+e.name),document.body.appendChild(t));e=React__default["default"].createElement(newFunctionComponent(n),e);ReactDOM.createRoot(t).render(e);},Modal=_$1.assign(newComponentRender("modal",antd.Modal),{info:antd.Modal.info,success:antd.Modal.success,error:antd.Modal.error,warning:antd.Modal.warning,confirm:antd.Modal.confirm}),Drawer=newComponentRender("drawer",antd.Drawer),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),_$1.each(e,e=>{-1<e.indexOf(".")&&(e=e.split(".")[0]),t.push(""+e);}),""+t.join(" ")},getFindOneQuery=(e,t,r)=>{e=e.replace(/\./g,"_");r=getGraphqlFieldsQuery(r);let n="";t=[`id: "${t}"`];return `{record:${e}__findOne${n=0<t.length?`(${t.join(",")})`:n}{${r}}}`},SObject={getRecord:async(e,t,r)=>{return (await fetchAPI("/graphql",{method:"post",body:JSON.stringify({query:getFindOneQuery(e,t,r)})})).data.record},getUISchema:async(e,t)=>getUISchema(e,t)},canSaveFilter=e=>!(!e._id||e.owner!==getSteedosAuth()?.userId),ListView={showFilter:(e,{listView:t,data:r})=>{canSaveFilter(t);r.filters&&(r.filters=filtersToConditions(r.filters));},getVisibleFilter:(e,t)=>{return t||(canSaveFilter(e)?e.filters:void 0)},getQueryFilter:(e,t)=>{return canSaveFilter(e)?ListView.getVisibleFilter(e,t):_$1.isEmpty(t)?e.filters:[e.filters,"and",t]},getFirstListView:async e=>{e=await window.getUISchema(e);return _.first(_.sortBy(_.values(e.list_views),"sort_no"))}},Router={getAppPath({appId:e}){return "/app/"+e},getPagePath(){},getObjectListViewPath({appId:e,objectName:t,listViewName:r}){return `/app/${e}/${t}/grid/`+r},getObjectDetailPath({appId:e,objectName:t,recordId:r}){return `/app/${e}/${t}/view/`+r},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:r,objectName:n,foreignKey:o}){return `/app/${e}/${t}/${r}/${n}/grid?related_field_name=`+o}};var withModalWrap=function(t,e){return function(e){return React.createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=React.createElement(e,__assign({},t));return ReactDOM__default["default"].render(e,r)};const safeRunFunction=(t,r,n,o)=>{try{var s=window.Creator;if(!!(!s||!s.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return _$1.isNil(r)||(e=_$1.isArray(r)?r:[r]),t.bind(o||{})(...e)}catch(e){return console.log(e),n}};function safeEval(js){try{return eval(js)}catch(e){console.error(e,js);}}const isExpression=function(e){var t,r;return "string"==typeof e&&(t=/^{{(function.+)}}$/,r=/^{{(.+=>.+)}}$/,!("string"!=typeof e||!e.match(/^{{(.+)}}$/)||e.match(t)||e.match(r)))},parseSingleExpression=function(t,e,r,n){var o,s=function(e,t){return "#"!==t&&t?"string"==typeof t?_.get(e,t):void console.error("path has to be a string"):e||{}}(e=void 0===e?{}:e,function(e){return "string"!=typeof e||1===(e=e.split(".")).length?"#":(e.pop(),e.join("."))}(r))||{};if("string"!=typeof t)return t;o="__G_L_O_B_A_L__",e="\n return "+t.substring(2,t.length-2).replace(/\bformData\b/g,JSON.stringify(e).replace(/\bglobal\b/g,o)).replace(/\bglobal\b/g,JSON.stringify(n)).replace(new RegExp("\\b"+o+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(s));try{return Function(e)()}catch(e){return console.log(e,t,r),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,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")?`{${express}}`.replace("{{","{{global."):`{${express}}`.replace("{{","{{formData."),multiple&&(result=result.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),reg2.test(express)&&(-1<express.indexOf("function")||-1<express.indexOf("=>"))){let regex=/\{\{([\s\S]*)\}\}/,matches=regex.exec(express);if(matches&&1<matches.length){let functionCode=matches[1];result=eval("("+functionCode+")")();}}return result},getFieldDefaultValue=(e,t)=>{if(!e)return null;let r=e.defaultValue;e._defaultValue&&(r=safeEval(`(${e._defaultValue})`)),_$1.isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),_$1.isString(r)&&(r=getCompatibleDefaultValueExpression(r,e.multiple));var n=isExpression(r);switch(n&&(r=parseSingleExpression(r,{},"#",t)),e.type){case"select":var o=e.data_type||"text";!r||n||e.multiple||("text"!==o||_$1.isString(r)?"number"===o&&_$1.isString(r)?r=Number(r):"boolean"===o&&_$1.isString(r)&&(r="true"===r.toLowerCase()||"1"===r):r=String(r));break;case"number":_$1.isString(r)&&(r=Number(r));break;case"boolean":_$1.isString(r)?r="true"===r.toLowerCase()||"1"===r:_$1.isBoolean(r)||(r=!1);}return r};function getTreeOptions(t,e){const o=e?.valueField||"value";e?.labelField;const r=e?.unfoldedNum||1,n=[],s=(t,r,n)=>{var e;if(r)return e=_.filter(t,e=>_.includes(r,e[o])),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=s(t,e.children,n-1))):e.children&&(e.children=s(t,e.children,n));}),e};for(var i=t,a=0;a<i.length;a++)if(i[a].noParent=0,i[a].unfolded=!1,i[a].parent){let e=1;for(var l=0;l<i.length;l++)i[a].parent==i[l][o]&&(e=0);1==e&&(i[a].noParent=1);}else i[a].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=r?(e.unfolded=!0,n.push(Object.assign({},e,{children:s(t,e.children,r-1)}))):n.push(Object.assign({},e,{children:s(t,e.children,r)})));}),n}function getClosestAmisComponentByType(t,r,n){let o=(n=n||{}).name;var e=n.direction||"up";let s=t.getComponents().find(function(e){return e.props.type===r&&(!o||e.props.name===o)});if(s)return s;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(s=getClosestAmisComponentByType(t.children[e],r,n));e++);return s}}else if("up"===e&&t.parent)return getClosestAmisComponentByType(t.parent,r,n)}function isFilterFormValuesEmpty(e){let t=!0;var e=_.pickBy(e,function(e,t){return /^__searchable__/g.test(t)});return _.isEmpty(e)||(e=_.omitBy(e,function(e){return _.isNil(e)||_.isObject(e)&&_.isEmpty(e)||_.isArray(e)&&_.isEmpty(e.filter(function(e){return !_.isNil(e)}))||_.isString(e)&&0===e.length}),_.isEmpty(e)||(t=!1)),t}const SteedosUI$1=Object.assign({},{render:render,Router:Router,ListView:ListView,Object:SObject,Modal:Modal,Drawer:Drawer,refs:{},getRef(e){return SteedosUI$1.refs[e]},router:{go:(e,t)=>{var r=window.FlowRouter;if(t)return r?r.go(t):window.open(t);r?r.reload():console.warn("暂不支持自动跳转",e);},reload:()=>{console.log("reload");}},message:antd.message,notification:antd.notification,components:{Button:antd.Button,Space:antd.Space},getRefId:({type:e,appId:t,name:r})=>{switch(e){case"listview":return `amis-${t}-${r}-listview`;case"form":return `amis-${t}-${r}-form`;case"detail":return `amis-${t}-${r}-detail`;default:return `amis-${t}-${r}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType,isFilterFormValuesEmpty:isFilterFormValuesEmpty,getSearchFilter:e=>{var o=[];return _.each(e,(e,t)=>{var r,n;_.isEmpty(e)&&!_.isBoolean(e)||(_.startsWith(t,"__searchable__between__")?o.push([""+t.replace("__searchable__between__",""),"between",e]):_.startsWith(t,"__searchable__")&&(_.isString(e)?o.push([""+t.replace("__searchable__",""),"contains",e]):_.isObject(e)&&e.o?(n=[[(r=""+t.replace("__searchable__",""))+"/o","=",e.o]],e.ids.length&&n.push([r+"/ids","=",e.ids]),o.push(n)):o.push([""+t.replace("__searchable__",""),"=",e])));}),o},getKeywordsSearchFilter:(e,t)=>{const o=[];var s;return e&&t&&(s=e.split(/\s+/),s=_$1.compact(s),t.forEach(function(r,e){let n=[];1==s.length?n=[r,"contains",s[0]]:s.forEach(function(e,t){n.push([r,"contains",e]),t<s.length-1&&n.push("or");}),n.length&&(o.push(n),e<t.length-1&&o.push("or"));})),o}});var getBuilderContext=function(){return "undefined"==typeof window?{}:Builder.settings.context||Builder.settings},Steedos$1=__assign({getRootUrl:function(e){var t=getBuilderContext();return t.rootUrl||("undefined"!=typeof window?window.localStorage.getItem("steedos:rootUrl"):"")||e},absoluteUrl:function(e){return void 0===e&&(e=""),"".concat(Steedos$1.getRootUrl()).concat(e)},getTenantId:function(){try{var e=getBuilderContext().tenantId;return (e=window.location.search&&!e?new URLSearchParams(window.location.search).get("X-Space-Id"):e)?e:null}catch(e){console.error(e);}},getAuthorization:function(){try{var e=getBuilderContext(),t=e.tenantId,r=e.authToken;return t&&r?"Bearer ".concat(t,",").concat(r):null}catch(e){console.error(e);}},authRequest:authRequest,StandardObjects:StandardObjects},Expression);"undefined"==typeof window||window.Steedos||(window.Steedos=Steedos$1),"undefined"==typeof window||window.SteedosUI||(window.SteedosUI=SteedosUI$1);
|
|
19909
19888
|
|
|
19910
19889
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
19911
19890
|
__proto__: null,
|