@steedos-widgets/amis-object 1.1.7 → 1.2.0-beta.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/AmisObjectListview.d.ts +9 -1
- package/dist/amis/AmisObjectTable.d.ts +0 -3
- package/dist/amis/AmisRecordDetail.d.ts +4 -15
- package/dist/amis/AmisRecordDetailHeader.d.ts +2 -11
- package/dist/amis/AmisRecordDetailRelatedList.d.ts +1 -53
- package/dist/amis/AmisRecordDetailRelatedLists.d.ts +0 -1
- package/dist/amis-object.cjs.css +10 -0
- package/dist/amis-object.cjs.js +371 -222
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +10 -0
- package/dist/amis-object.esm.js +371 -222
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +10 -0
- package/dist/amis-object.umd.js +371 -222
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +13 -13
- package/package.json +3 -3
package/dist/amis-object.umd.js
CHANGED
|
@@ -1037,11 +1037,7 @@
|
|
|
1037
1037
|
}
|
|
1038
1038
|
|
|
1039
1039
|
async function getFindOneQuery$1(object, recordId, fields, options){
|
|
1040
|
-
let queryOptions = ""
|
|
1041
|
-
|
|
1042
|
-
if(recordId){
|
|
1043
|
-
queryOptions = `(filters:["${object.idFieldName}", "=", "${recordId}"])`;
|
|
1044
|
-
}
|
|
1040
|
+
let queryOptions = `(filters:["${object.idFieldName}", "=", "\${recordId}"])`;
|
|
1045
1041
|
let alias = "data";
|
|
1046
1042
|
if(options){
|
|
1047
1043
|
if(options.alias){
|
|
@@ -1750,8 +1746,8 @@
|
|
|
1750
1746
|
/*
|
|
1751
1747
|
* @Author: baozhoutao@steedos.com
|
|
1752
1748
|
* @Date: 2022-11-01 15:51:00
|
|
1753
|
-
* @LastEditors:
|
|
1754
|
-
* @LastEditTime: 2023-
|
|
1749
|
+
* @LastEditors: Please set LastEditors
|
|
1750
|
+
* @LastEditTime: 2023-04-08 12:05:19
|
|
1755
1751
|
* @Description:
|
|
1756
1752
|
*/
|
|
1757
1753
|
|
|
@@ -1769,6 +1765,32 @@
|
|
|
1769
1765
|
if (payload && payload.schema) {
|
|
1770
1766
|
formSchema = _.isString(payload.schema) ? JSON.parse(payload.schema) : payload.schema;
|
|
1771
1767
|
}
|
|
1768
|
+
|
|
1769
|
+
const _master = api.body._master;
|
|
1770
|
+
if(_master && _master._isRelated){
|
|
1771
|
+
const relatedKey = _master.relatedKey;
|
|
1772
|
+
const masterObjectName = _master.objectName;
|
|
1773
|
+
const recordId = _master.recordId;
|
|
1774
|
+
const fields = ${JSON.stringify(uiSchema.fields)};
|
|
1775
|
+
const relatedField = fields[relatedKey];
|
|
1776
|
+
let defaultData = {};
|
|
1777
|
+
let relatedKeyValue;
|
|
1778
|
+
if(!_.isString(relatedField.reference_to)){
|
|
1779
|
+
relatedKeyValue = { o: masterObjectName, ids: [recordId] };
|
|
1780
|
+
}else if (relatedField.multiple) {
|
|
1781
|
+
relatedKeyValue = [recordId];
|
|
1782
|
+
} else {
|
|
1783
|
+
relatedKeyValue = recordId;
|
|
1784
|
+
}
|
|
1785
|
+
defaultData[relatedKey]=relatedKeyValue;
|
|
1786
|
+
if(payload.schema){
|
|
1787
|
+
// 表单微页面第一层要求是page
|
|
1788
|
+
formSchema.data.defaultData = defaultData;
|
|
1789
|
+
}else{
|
|
1790
|
+
formSchema.defaultData = defaultData;
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1772
1794
|
return {
|
|
1773
1795
|
data: formSchema
|
|
1774
1796
|
};
|
|
@@ -1792,6 +1814,8 @@
|
|
|
1792
1814
|
"data": {
|
|
1793
1815
|
"$master": "$$",
|
|
1794
1816
|
"_master": "${_master}",
|
|
1817
|
+
"_master._isRelated": "${_isRelated}",
|
|
1818
|
+
"_master.relatedKey": "${relatedKey}",
|
|
1795
1819
|
"defaultData": "${defaultData}",
|
|
1796
1820
|
"appId": "${appId}",
|
|
1797
1821
|
"objectName": "${objectName}",
|
|
@@ -1810,7 +1834,8 @@
|
|
|
1810
1834
|
"messages": {},
|
|
1811
1835
|
"schemaApi": {
|
|
1812
1836
|
"data": {
|
|
1813
|
-
"isLookup": "${isLookup}"
|
|
1837
|
+
"isLookup": "${isLookup}",
|
|
1838
|
+
"_master": "${_master}"
|
|
1814
1839
|
},
|
|
1815
1840
|
"url": "${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}",
|
|
1816
1841
|
"method": "get",
|
|
@@ -2331,7 +2356,7 @@
|
|
|
2331
2356
|
getStandardNew: async (uiSchema, ctx)=>{
|
|
2332
2357
|
return {
|
|
2333
2358
|
type: 'amis_button',
|
|
2334
|
-
amis_schema: await getSchema$4()
|
|
2359
|
+
amis_schema: await getSchema$4(uiSchema)
|
|
2335
2360
|
}
|
|
2336
2361
|
},
|
|
2337
2362
|
getStandardEdit: async (uiSchema, ctx)=>{
|
|
@@ -2415,7 +2440,7 @@
|
|
|
2415
2440
|
if(visible.trim().startsWith('function')){
|
|
2416
2441
|
return `${visible}.apply({
|
|
2417
2442
|
object: uiSchema
|
|
2418
|
-
}, [objectName, _id, typeof record === 'undefined' ? (typeof recordPermissions === 'undefined' ? {} : recordPermissions) : record.recordPermissions, data])`
|
|
2443
|
+
}, [objectName, typeof _id === 'undefined' ? null: _id, typeof record === 'undefined' ? (typeof recordPermissions === 'undefined' ? {} : recordPermissions) : record.recordPermissions, data])`
|
|
2419
2444
|
}
|
|
2420
2445
|
return visible;
|
|
2421
2446
|
}
|
|
@@ -3545,9 +3570,8 @@
|
|
|
3545
3570
|
|
|
3546
3571
|
let body = [
|
|
3547
3572
|
{
|
|
3548
|
-
"type": "
|
|
3549
|
-
"
|
|
3550
|
-
data: { "&":"$$", objectName: name, _id: recordId, recordPermissions: "${record.recordPermissions}", uiSchema: objectSchema},
|
|
3573
|
+
"type": "wrapper",
|
|
3574
|
+
"className": "p-0",
|
|
3551
3575
|
"body": [
|
|
3552
3576
|
{
|
|
3553
3577
|
"type": "grid",
|
|
@@ -3555,14 +3579,14 @@
|
|
|
3555
3579
|
"className": "flex justify-between"
|
|
3556
3580
|
}
|
|
3557
3581
|
],
|
|
3558
|
-
"messages": {},
|
|
3559
3582
|
"hiddenOn": "${recordLoaded != true}"
|
|
3560
3583
|
}
|
|
3561
3584
|
];
|
|
3562
3585
|
|
|
3563
3586
|
if(showRecordTitle){
|
|
3564
3587
|
body.push({
|
|
3565
|
-
"type": "
|
|
3588
|
+
"type": "wrapper",
|
|
3589
|
+
"className": "p-0",
|
|
3566
3590
|
"body": [
|
|
3567
3591
|
{
|
|
3568
3592
|
"type": "grid",
|
|
@@ -3570,16 +3594,15 @@
|
|
|
3570
3594
|
"className": "flex justify-between"
|
|
3571
3595
|
}
|
|
3572
3596
|
],
|
|
3573
|
-
"messages": {},
|
|
3574
3597
|
"hiddenOn": "${recordLoaded == true}"
|
|
3575
3598
|
});
|
|
3576
3599
|
}
|
|
3577
3600
|
|
|
3578
3601
|
return {
|
|
3579
3602
|
type: 'service',
|
|
3580
|
-
|
|
3603
|
+
id: `page_readonly_${name}_header`,
|
|
3581
3604
|
name: `page`,
|
|
3582
|
-
data: {
|
|
3605
|
+
data: { objectName: name, _id: recordId, recordPermissions: objectSchema.permissions, uiSchema: objectSchema, record: "${record}" },
|
|
3583
3606
|
body: body,
|
|
3584
3607
|
className: ''
|
|
3585
3608
|
}
|
|
@@ -3634,7 +3657,7 @@
|
|
|
3634
3657
|
"body": [
|
|
3635
3658
|
{
|
|
3636
3659
|
"type": "tpl",
|
|
3637
|
-
"tpl": `<a class="text-black text-base font-bold" href="/app/\${appId}/\${
|
|
3660
|
+
"tpl": `<a class="text-black text-base font-bold" href="/app/\${appId}/\${_master.objectName}/\${_master.recordId}/\${objectName}/grid?related_field_name=\${relatedKey}">${relatedLabel}(\${$count})</a>`,
|
|
3638
3661
|
"inline": false,
|
|
3639
3662
|
"wrapperComponent": "",
|
|
3640
3663
|
"className": "",
|
|
@@ -3675,17 +3698,22 @@
|
|
|
3675
3698
|
async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
|
|
3676
3699
|
}
|
|
3677
3700
|
|
|
3678
|
-
const getDisplayAsButton = function(showDisplayAs){
|
|
3701
|
+
const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
3702
|
+
let displayAs = Router$1.getTabDisplayAs(objectName);
|
|
3679
3703
|
let buttons = [
|
|
3680
3704
|
{
|
|
3681
3705
|
"type": "button",
|
|
3682
3706
|
"label": "表格",
|
|
3683
|
-
"onClick": "
|
|
3707
|
+
"onClick": "let url = document.location.pathname; var urlSearch = new URLSearchParams(document.location.search); if(urlSearch.get(\"side_object\") && urlSearch.get(\"side_listview_id\")){url=`/app/${props.data.appId}/${urlSearch.get(\"side_object\")}/grid/${urlSearch.get(\"side_listview_id\")}`;}; props.env.jumpTo(url + '?display=grid');",
|
|
3708
|
+
"rightIcon": displayAs != 'split' ? "fa fa-check" : null,
|
|
3709
|
+
"rightIconClassName": "m-l-sm"
|
|
3684
3710
|
},
|
|
3685
3711
|
{
|
|
3686
3712
|
"type": "button",
|
|
3687
3713
|
"label": "分栏视图",
|
|
3688
|
-
"onClick": "const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);"
|
|
3714
|
+
"onClick": "const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
|
|
3715
|
+
"rightIcon": displayAs === 'split' ? "fa fa-check" : null,
|
|
3716
|
+
"rightIconClassName": "m-l-sm"
|
|
3689
3717
|
}
|
|
3690
3718
|
];
|
|
3691
3719
|
return {
|
|
@@ -3827,7 +3855,7 @@ setTimeout(()=>{
|
|
|
3827
3855
|
}
|
|
3828
3856
|
}
|
|
3829
3857
|
},
|
|
3830
|
-
showDisplayAs? getDisplayAsButton() : {}
|
|
3858
|
+
showDisplayAs? getDisplayAsButton(mainObject?.name) : {}
|
|
3831
3859
|
]
|
|
3832
3860
|
}else {
|
|
3833
3861
|
return [
|
|
@@ -3908,7 +3936,7 @@ setTimeout(()=>{
|
|
|
3908
3936
|
}
|
|
3909
3937
|
}
|
|
3910
3938
|
},
|
|
3911
|
-
showDisplayAs? getDisplayAsButton() : {}
|
|
3939
|
+
showDisplayAs? getDisplayAsButton(showDisplayAs) : {}
|
|
3912
3940
|
// {
|
|
3913
3941
|
// "type": "search-box",
|
|
3914
3942
|
// "align": "right",
|
|
@@ -4187,6 +4215,90 @@ setTimeout(()=>{
|
|
|
4187
4215
|
}
|
|
4188
4216
|
};
|
|
4189
4217
|
|
|
4218
|
+
function getLookupSapceUserTreeSchema(){
|
|
4219
|
+
const tree = [{
|
|
4220
|
+
"type": "input-tree",
|
|
4221
|
+
"className": "",
|
|
4222
|
+
"id": "u:7fd77b7915b0",
|
|
4223
|
+
"source": {
|
|
4224
|
+
"method": "post",
|
|
4225
|
+
"url": "${context.rootUrl}/graphql",
|
|
4226
|
+
"headers": {
|
|
4227
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4228
|
+
},
|
|
4229
|
+
"adaptor": "if (payload.data.treeCache == true) {\n return payload;\n }\n const records = payload.data.options;\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.value)\n });\n _.each(children, (item) => {\n if (item.children) {\n item.children = getChildren(records, item.children)\n }\n })\n return children;\n }\n\n const getRoot = (records) => {\n for (var i = 0; i < records.length; i++){\n records[i].noParent = 0;\n if (!!records[i].parent) {\n biaozhi = 1\n for (var j = 0; j < records.length; j++){\n if (records[i].parent == records[j].value)\n biaozhi = 0;\n }\n if (biaozhi == 1) records[i].noParent = 1;\n } else records[i].noParent = 1;\n }\n }\n getRoot(records);\n console.log(records)\n\n _.each(records, (record) => {\n if (record.noParent ==1) {\n treeRecords.push(Object.assign({}, record, { children: getChildren(records, record.children) }));\n }\n });\n console.log(treeRecords)\n\n payload.data.options = treeRecords;\n payload.data.treeCache = true;\n return payload;\n ",
|
|
4230
|
+
"requestAdaptor": "\n ",
|
|
4231
|
+
"data": {
|
|
4232
|
+
"query": "{options:organizations(filters:[\"hidden\", \"!=\", true],sort:\"sort_no desc\"){value:_id label:name,parent,children}}"
|
|
4233
|
+
},
|
|
4234
|
+
"messages": {
|
|
4235
|
+
},
|
|
4236
|
+
"cache": 300000
|
|
4237
|
+
},
|
|
4238
|
+
"onEvent": {
|
|
4239
|
+
"change": {
|
|
4240
|
+
"actions": [
|
|
4241
|
+
{
|
|
4242
|
+
"actionType": "custom",
|
|
4243
|
+
"script": `
|
|
4244
|
+
debugger;
|
|
4245
|
+
const scope = event.context.scoped;
|
|
4246
|
+
//TODO: 将form中的value一同加入筛选内
|
|
4247
|
+
// var filterForm = scope.parent.parent.getComponents().find(function(n){
|
|
4248
|
+
// return n.props.type === "form";
|
|
4249
|
+
// });
|
|
4250
|
+
// var filterFormValues = filterForm.getValues();
|
|
4251
|
+
filterFormValues={
|
|
4252
|
+
"__searchable__organizations_parents":event.data.value.value
|
|
4253
|
+
}
|
|
4254
|
+
var listView = scope.parent.getComponents().find(function(n){
|
|
4255
|
+
return n.props.type === "crud";
|
|
4256
|
+
});
|
|
4257
|
+
const removedValues = {};
|
|
4258
|
+
// for(var k in filterFormValues){
|
|
4259
|
+
// if(filterFormValues[k] === "" && !filterFormValues.hasOwnProperty(k)){
|
|
4260
|
+
// removedValues[k] = "";
|
|
4261
|
+
// }
|
|
4262
|
+
// }
|
|
4263
|
+
listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
|
|
4264
|
+
`
|
|
4265
|
+
}
|
|
4266
|
+
]
|
|
4267
|
+
}
|
|
4268
|
+
},
|
|
4269
|
+
"label": "",
|
|
4270
|
+
"name": "organizations",
|
|
4271
|
+
"multiple": false,
|
|
4272
|
+
"joinValues": false,
|
|
4273
|
+
"clearValueOnHidden": false,
|
|
4274
|
+
"fieldName": "organizations",
|
|
4275
|
+
"hideRoot": true,
|
|
4276
|
+
"initiallyOpen": false,
|
|
4277
|
+
"extractValue": true,
|
|
4278
|
+
"onlyChildren": true,
|
|
4279
|
+
"treeContainerClassName": "no-border",
|
|
4280
|
+
"showIcon": false,
|
|
4281
|
+
"enableNodePath": false,
|
|
4282
|
+
"autoCheckChildren": false,
|
|
4283
|
+
"searchable": true,
|
|
4284
|
+
"searchConfig": {
|
|
4285
|
+
"sticky": true
|
|
4286
|
+
},
|
|
4287
|
+
"unfoldedLevel": 2,
|
|
4288
|
+
"style": {
|
|
4289
|
+
"max-height": "100%",
|
|
4290
|
+
"position": "absolute",
|
|
4291
|
+
"left": "-190px",
|
|
4292
|
+
"width": "190px",
|
|
4293
|
+
"bottom": 0,
|
|
4294
|
+
"top": "0",
|
|
4295
|
+
"overflow": "auto",
|
|
4296
|
+
"min-height":"300px"
|
|
4297
|
+
},
|
|
4298
|
+
"originPosition": "left-top"
|
|
4299
|
+
}];
|
|
4300
|
+
return tree;
|
|
4301
|
+
}
|
|
4190
4302
|
|
|
4191
4303
|
async function lookupToAmisPicker(field, readonly, ctx){
|
|
4192
4304
|
let referenceTo = await getReferenceTo(field);
|
|
@@ -4429,7 +4541,16 @@ setTimeout(()=>{
|
|
|
4429
4541
|
...ctx
|
|
4430
4542
|
});
|
|
4431
4543
|
|
|
4432
|
-
|
|
4544
|
+
var headerToolbarItems = [];
|
|
4545
|
+
const isMobile = window.innerWidth < 768;
|
|
4546
|
+
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && !isMobile){
|
|
4547
|
+
headerToolbarItems = getLookupSapceUserTreeSchema();
|
|
4548
|
+
pickerSchema["style"] = {
|
|
4549
|
+
"margin-left":"200px",
|
|
4550
|
+
"min-height": "300px"
|
|
4551
|
+
};
|
|
4552
|
+
}
|
|
4553
|
+
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, ctx.formFactor, { headerToolbarItems });
|
|
4433
4554
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
4434
4555
|
if (isAllowCreate) {
|
|
4435
4556
|
const new_button = await getSchema$4(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
@@ -4437,15 +4558,18 @@ setTimeout(()=>{
|
|
|
4437
4558
|
pickerSchema.headerToolbar.push(new_button);
|
|
4438
4559
|
}
|
|
4439
4560
|
pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar();
|
|
4440
|
-
if
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4561
|
+
//TODO: 等待放大镜bug修复,if会去掉,始终显示放大镜
|
|
4562
|
+
if(referenceTo.objectName != "space_users" || field.reference_to_field != "user"){
|
|
4563
|
+
if (ctx.filterVisible !== false) {
|
|
4564
|
+
let filterLoopCount = ctx.filterLoopCount || 0;
|
|
4565
|
+
filterLoopCount++;
|
|
4566
|
+
// 可以传入filterVisible为false防止死循环
|
|
4567
|
+
pickerSchema.filter = await getObjectFilter(refObjectConfig, fields, {
|
|
4568
|
+
isLookup: true,
|
|
4569
|
+
...ctx,
|
|
4570
|
+
filterLoopCount,
|
|
4571
|
+
});
|
|
4572
|
+
}
|
|
4449
4573
|
}
|
|
4450
4574
|
pickerSchema.data = Object.assign({}, pickerSchema.data, {
|
|
4451
4575
|
"&": "$$",
|
|
@@ -4693,7 +4817,7 @@ setTimeout(()=>{
|
|
|
4693
4817
|
if(ctx.idsDependOn || field.amis){
|
|
4694
4818
|
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
4695
4819
|
}
|
|
4696
|
-
return await lookupToAmisSelectUser(field, readonly, ctx);
|
|
4820
|
+
// return await lookupToAmisSelectUser(field, readonly, ctx);
|
|
4697
4821
|
}
|
|
4698
4822
|
|
|
4699
4823
|
const refObject = await getUISchema(referenceTo.objectName);
|
|
@@ -5674,8 +5798,9 @@ setTimeout(()=>{
|
|
|
5674
5798
|
async function getReadonlyFormInitApi(object, recordId, fields, options){
|
|
5675
5799
|
return {
|
|
5676
5800
|
method: "post",
|
|
5677
|
-
url: getApi$2()+"
|
|
5801
|
+
url: getApi$2()+"&recordId=${recordId}",
|
|
5678
5802
|
cache: API_CACHE,
|
|
5803
|
+
// requestAdaptor: "console.log('getReadonlyFormInitApi requestAdaptor', api);return api;",
|
|
5679
5804
|
adaptor: getReadonlyFormAdaptor(fields),
|
|
5680
5805
|
data: await getFindOneQuery$1(object, recordId, fields, options),
|
|
5681
5806
|
headers: {
|
|
@@ -5782,6 +5907,7 @@ setTimeout(()=>{
|
|
|
5782
5907
|
data.global = "${global}";
|
|
5783
5908
|
data.context = "${context}";
|
|
5784
5909
|
data.defaultData = "${defaultData}";
|
|
5910
|
+
|
|
5785
5911
|
return {
|
|
5786
5912
|
method: "post",
|
|
5787
5913
|
url: getApi$2(),
|
|
@@ -6150,7 +6276,7 @@ setTimeout(()=>{
|
|
|
6150
6276
|
keepItemSelectionOnPageChange: true,
|
|
6151
6277
|
api: await getTableApi(objectSchema, fields, options),
|
|
6152
6278
|
hiddenOn: options.tableHiddenOn,
|
|
6153
|
-
autoFillHeight: true,
|
|
6279
|
+
autoFillHeight: options.isRelated ? false : true,
|
|
6154
6280
|
className: `flex-auto ${crudClassName || ""}`,
|
|
6155
6281
|
crudClassName: crudClassName,
|
|
6156
6282
|
},
|
|
@@ -6193,11 +6319,11 @@ setTimeout(()=>{
|
|
|
6193
6319
|
id: `service_${id}`,
|
|
6194
6320
|
name: `page`,
|
|
6195
6321
|
data: {
|
|
6196
|
-
objectName: objectSchema.name,
|
|
6197
|
-
_id: null,
|
|
6322
|
+
// objectName: objectSchema.name,
|
|
6323
|
+
// _id: null,
|
|
6198
6324
|
recordPermissions: objectSchema.permissions,
|
|
6199
6325
|
uiSchema: objectSchema,
|
|
6200
|
-
loaded: false //crud接收适配器中设置为true,否则就是刷新浏览器第一次加载
|
|
6326
|
+
// loaded: false //crud接收适配器中设置为true,否则就是刷新浏览器第一次加载
|
|
6201
6327
|
},
|
|
6202
6328
|
body: body
|
|
6203
6329
|
}
|
|
@@ -6310,6 +6436,10 @@ setTimeout(()=>{
|
|
|
6310
6436
|
"objectName": "${_master.objectName}"
|
|
6311
6437
|
},
|
|
6312
6438
|
"expression": `\${_master.objectName != '${objectSchema.name}' && _master.objectName}`
|
|
6439
|
+
},
|
|
6440
|
+
{
|
|
6441
|
+
"args": {},
|
|
6442
|
+
"actionType": "closeDialog"
|
|
6313
6443
|
}
|
|
6314
6444
|
]
|
|
6315
6445
|
}
|
|
@@ -6656,7 +6786,7 @@ setTimeout(()=>{
|
|
|
6656
6786
|
// return 'false';
|
|
6657
6787
|
// }
|
|
6658
6788
|
if(visible.trim().startsWith('function')){
|
|
6659
|
-
return `${visible}(objectName, _id, typeof record === 'undefined' ? (typeof recordPermissions === 'undefined' ? {} : recordPermissions) : record.recordPermissions, data)`
|
|
6789
|
+
return `${visible}(objectName, typeof _id === 'undefined' ? null: _id, typeof record === 'undefined' ? (typeof recordPermissions === 'undefined' ? {} : recordPermissions) : record.recordPermissions, data)`
|
|
6660
6790
|
}
|
|
6661
6791
|
return visible;
|
|
6662
6792
|
}
|
|
@@ -6821,6 +6951,11 @@ setTimeout(()=>{
|
|
|
6821
6951
|
|
|
6822
6952
|
let valueField = mainObject.key_field || '_id';
|
|
6823
6953
|
const api = await getApi(mainObject, null, fields, {count: options.queryCount, alias: 'rows', limit: top, queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
|
|
6954
|
+
|
|
6955
|
+
if(options.isRelated){
|
|
6956
|
+
api.url += "&recordId=${recordId}";
|
|
6957
|
+
}
|
|
6958
|
+
|
|
6824
6959
|
api.data.$term = "$term";
|
|
6825
6960
|
api.data.$self = "$$";
|
|
6826
6961
|
api.data.filter = "$filter";
|
|
@@ -6940,11 +7075,36 @@ setTimeout(()=>{
|
|
|
6940
7075
|
if(!_.isEmpty(systemFilters)){
|
|
6941
7076
|
filters = systemFilters;
|
|
6942
7077
|
};
|
|
6943
|
-
|
|
6944
7078
|
if(api.data.$self.additionalFilters){
|
|
6945
7079
|
userFilters.push(api.data.$self.additionalFilters)
|
|
6946
7080
|
}
|
|
6947
7081
|
|
|
7082
|
+
if(api.data.$self._isRelated){
|
|
7083
|
+
const self = api.data.$self;
|
|
7084
|
+
const relatedKey = self.relatedKey;
|
|
7085
|
+
const recordId = self.recordId;
|
|
7086
|
+
const refField = self.uiSchema.fields[relatedKey];
|
|
7087
|
+
const masterRecord = self._master.record;
|
|
7088
|
+
const masterObjectName = self._master.objectName;
|
|
7089
|
+
let relatedValue = recordId;
|
|
7090
|
+
if(refField.reference_to_field && refField.reference_to_field != '_id'){
|
|
7091
|
+
relatedValue = masterRecord[refField.reference_to_field]
|
|
7092
|
+
}
|
|
7093
|
+
let relatedFilters;
|
|
7094
|
+
if (
|
|
7095
|
+
refField._reference_to ||
|
|
7096
|
+
(refField.reference_to && !_.isString(refField.reference_to))
|
|
7097
|
+
) {
|
|
7098
|
+
relatedFilters = [
|
|
7099
|
+
[relatedKey + "/o", "=", masterObjectName],
|
|
7100
|
+
[relatedKey + "/ids", "=", relatedValue],
|
|
7101
|
+
];
|
|
7102
|
+
} else {
|
|
7103
|
+
relatedFilters = [relatedKey, "=", relatedValue];
|
|
7104
|
+
}
|
|
7105
|
+
userFilters.push(relatedFilters)
|
|
7106
|
+
}
|
|
7107
|
+
|
|
6948
7108
|
if(!_.isEmpty(userFilters)){
|
|
6949
7109
|
if(_.isEmpty(filters)){
|
|
6950
7110
|
filters = userFilters;
|
|
@@ -7067,7 +7227,7 @@ setTimeout(()=>{
|
|
|
7067
7227
|
const data = await getFindQuery(object, recordId, fields, options);
|
|
7068
7228
|
return {
|
|
7069
7229
|
method: "post",
|
|
7070
|
-
url: getApi$2(),
|
|
7230
|
+
url: getApi$2(), // + "&recordId=${recordId}"
|
|
7071
7231
|
data: data,
|
|
7072
7232
|
headers: {
|
|
7073
7233
|
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
@@ -7701,8 +7861,8 @@ setTimeout(()=>{
|
|
|
7701
7861
|
/*
|
|
7702
7862
|
* @Author: baozhoutao@steedos.com
|
|
7703
7863
|
* @Date: 2022-07-05 15:55:39
|
|
7704
|
-
* @LastEditors:
|
|
7705
|
-
* @LastEditTime: 2023-
|
|
7864
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
7865
|
+
* @LastEditTime: 2023-04-08 18:14:55
|
|
7706
7866
|
* @Description:
|
|
7707
7867
|
*/
|
|
7708
7868
|
|
|
@@ -7774,7 +7934,7 @@ setTimeout(()=>{
|
|
|
7774
7934
|
|
|
7775
7935
|
// 获取单个相关表
|
|
7776
7936
|
async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObjectName, relatedKey, ctx){
|
|
7777
|
-
let { top, perPage,
|
|
7937
|
+
let { top, perPage, appId, relatedLabel, className, columns, sort, filters, visible_on } = ctx;
|
|
7778
7938
|
// console.log('getRecordDetailRelatedListSchema==>',objectName,recordId,relatedObjectName)
|
|
7779
7939
|
const relatedObjectUiSchema = await getUISchema(relatedObjectName);
|
|
7780
7940
|
if(!relatedObjectUiSchema){
|
|
@@ -7809,6 +7969,7 @@ setTimeout(()=>{
|
|
|
7809
7969
|
relatedKey = mainRelated[relatedObjectName];
|
|
7810
7970
|
}
|
|
7811
7971
|
let globalFilter = null;
|
|
7972
|
+
// TODO: refField变量去掉,写到amis运行时脚本中,uiSchema.fields[relatedKey];可以取到
|
|
7812
7973
|
const refField = await getField(relatedObjectName, relatedKey);
|
|
7813
7974
|
|
|
7814
7975
|
if(!refField){
|
|
@@ -7824,23 +7985,23 @@ setTimeout(()=>{
|
|
|
7824
7985
|
}
|
|
7825
7986
|
}
|
|
7826
7987
|
|
|
7827
|
-
let relatedValue = recordId;
|
|
7828
|
-
if(refField.reference_to_field && refField.reference_to_field != '_id'){
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
}
|
|
7988
|
+
let relatedValue = "${recordId}";
|
|
7989
|
+
// if(refField.reference_to_field && refField.reference_to_field != '_id'){
|
|
7990
|
+
// const masterRecord = await getRecord(objectName, recordId, [refField.reference_to_field]);
|
|
7991
|
+
// relatedValue = masterRecord[refField.reference_to_field]
|
|
7992
|
+
// }
|
|
7832
7993
|
|
|
7833
|
-
if (
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
) {
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
} else {
|
|
7842
|
-
|
|
7843
|
-
}
|
|
7994
|
+
// if (
|
|
7995
|
+
// refField._reference_to ||
|
|
7996
|
+
// (refField.reference_to && !isString(refField.reference_to))
|
|
7997
|
+
// ) {
|
|
7998
|
+
// globalFilter = [
|
|
7999
|
+
// [`${relatedKey}/o`, "=", objectName],
|
|
8000
|
+
// [`${relatedKey}/ids`, "=", relatedValue],
|
|
8001
|
+
// ];
|
|
8002
|
+
// } else {
|
|
8003
|
+
// globalFilter = [`${relatedKey}`, "=", relatedValue];
|
|
8004
|
+
// }
|
|
7844
8005
|
const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel);
|
|
7845
8006
|
const componentId = `steedos-record-related-list-${relatedObjectName}`;
|
|
7846
8007
|
const options = {
|
|
@@ -7865,9 +8026,9 @@ setTimeout(()=>{
|
|
|
7865
8026
|
top: top,
|
|
7866
8027
|
perPage: perPage,
|
|
7867
8028
|
setDataToComponentId: componentId,
|
|
7868
|
-
tableHiddenOn: hiddenEmptyTable ? "this.$count === 0" : null,
|
|
8029
|
+
// tableHiddenOn: hiddenEmptyTable ? "this.$count === 0" : null,
|
|
7869
8030
|
appId: appId,
|
|
7870
|
-
crudClassName: 'border-t border-slate-300',
|
|
8031
|
+
crudClassName: 'border-t border-slate-300 hidden',
|
|
7871
8032
|
...ctx
|
|
7872
8033
|
};
|
|
7873
8034
|
const amisSchema= (await getRelatedListSchema(relatedObjectName, 'all', options)).amisSchema;
|
|
@@ -7879,15 +8040,9 @@ setTimeout(()=>{
|
|
|
7879
8040
|
amisSchema: {
|
|
7880
8041
|
type: "service",
|
|
7881
8042
|
id: componentId,
|
|
7882
|
-
className: `steedos-record-related-list rounded border border-slate-300 bg-gray-100 mb-4 ${className}`,
|
|
8043
|
+
className: `steedos-record-related-list ${componentId} rounded border border-slate-300 bg-gray-100 mb-4 ${className}`,
|
|
7883
8044
|
data: {
|
|
7884
|
-
"&": "$$",
|
|
7885
|
-
appId: "${appId}",
|
|
7886
|
-
app_id: "${appId}",
|
|
7887
|
-
masterObjectName: objectName,
|
|
7888
|
-
masterRecordId: "${recordId}",
|
|
7889
8045
|
relatedKey: relatedKey,
|
|
7890
|
-
objectName: relatedObjectName,
|
|
7891
8046
|
listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
|
|
7892
8047
|
_isRelated: true
|
|
7893
8048
|
},
|
|
@@ -7895,12 +8050,6 @@ setTimeout(()=>{
|
|
|
7895
8050
|
{
|
|
7896
8051
|
...amisSchema,
|
|
7897
8052
|
data: {
|
|
7898
|
-
"&": "$$",
|
|
7899
|
-
appId: "${appId}",
|
|
7900
|
-
app_id: "${appId}",
|
|
7901
|
-
relatedKey: relatedKey,
|
|
7902
|
-
objectName: "${objectName}",
|
|
7903
|
-
recordId: "${masterRecordId}",
|
|
7904
8053
|
defaultData: {
|
|
7905
8054
|
...{[relatedKey]: getRelatedFieldValue(objectName, relatedValue, relatedObjectUiSchema, relatedKey)}
|
|
7906
8055
|
}
|
|
@@ -7944,13 +8093,13 @@ setTimeout(()=>{
|
|
|
7944
8093
|
columns = getListViewColumns(listView, ctx.formFactor);
|
|
7945
8094
|
sort = getListViewSort(listView);
|
|
7946
8095
|
filter = getListViewFilter(listView);
|
|
7947
|
-
if(
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
}else if(ctx.globalFilter && (!filter || !filter.length)){
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
}
|
|
8096
|
+
// if(isArray(ctx.globalFilter) && ctx.globalFilter.length && isArray(filter) && filter.length){
|
|
8097
|
+
// // 都有值
|
|
8098
|
+
// filter = [ctx.globalFilter, 'and', filter]
|
|
8099
|
+
// }else if(ctx.globalFilter && (!filter || !filter.length)){
|
|
8100
|
+
// // globalFilter有值,filter无值
|
|
8101
|
+
// filter = ctx.globalFilter;
|
|
8102
|
+
// }
|
|
7954
8103
|
filtersFunction = listView && listView._filters;
|
|
7955
8104
|
}else {
|
|
7956
8105
|
const isNameField = ___default.find(
|
|
@@ -7960,9 +8109,9 @@ setTimeout(()=>{
|
|
|
7960
8109
|
}
|
|
7961
8110
|
);
|
|
7962
8111
|
columns = isNameField ? [isNameField.name] : ['name'];
|
|
7963
|
-
if(ctx.globalFilter){
|
|
7964
|
-
|
|
7965
|
-
}
|
|
8112
|
+
// if(ctx.globalFilter){
|
|
8113
|
+
// filter = ctx.globalFilter;
|
|
8114
|
+
// }
|
|
7966
8115
|
}
|
|
7967
8116
|
|
|
7968
8117
|
return {
|
|
@@ -7986,7 +8135,7 @@ setTimeout(()=>{
|
|
|
7986
8135
|
return {
|
|
7987
8136
|
columns: ctx.columns,
|
|
7988
8137
|
sort,
|
|
7989
|
-
filter: ctx.globalFilter,
|
|
8138
|
+
// filter: ctx.globalFilter,
|
|
7990
8139
|
filtersFunction: filtersFunction
|
|
7991
8140
|
}
|
|
7992
8141
|
} else {
|
|
@@ -8025,6 +8174,16 @@ setTimeout(()=>{
|
|
|
8025
8174
|
delete ctx.filters;
|
|
8026
8175
|
|
|
8027
8176
|
delete ctx.globalFilter;
|
|
8177
|
+
|
|
8178
|
+
const adaptor = `
|
|
8179
|
+
if(setDataToComponentId){
|
|
8180
|
+
if(payload.data.count){
|
|
8181
|
+
setTimeout(function(){
|
|
8182
|
+
window.$("." + setDataToComponentId + " .antd-Crud").removeClass("hidden");
|
|
8183
|
+
}, 10);
|
|
8184
|
+
}
|
|
8185
|
+
};
|
|
8186
|
+
`;
|
|
8028
8187
|
const amisSchema = {
|
|
8029
8188
|
"type": "steedos-object-table",
|
|
8030
8189
|
"objectApiName": objectName,
|
|
@@ -8033,6 +8192,8 @@ setTimeout(()=>{
|
|
|
8033
8192
|
"filters": listviewFilter,
|
|
8034
8193
|
"filtersFunction": filtersFunction,
|
|
8035
8194
|
"sort": listViewSort,
|
|
8195
|
+
"filterVisible": false,
|
|
8196
|
+
adaptor,
|
|
8036
8197
|
"ctx": ctx
|
|
8037
8198
|
};
|
|
8038
8199
|
// console.log(`getRelatedListSchema amisSchema`, amisSchema);
|
|
@@ -8045,8 +8206,8 @@ setTimeout(()=>{
|
|
|
8045
8206
|
/*
|
|
8046
8207
|
* @Author: baozhoutao@steedos.com
|
|
8047
8208
|
* @Date: 2022-07-05 15:55:39
|
|
8048
|
-
* @LastEditors:
|
|
8049
|
-
* @LastEditTime: 2023-
|
|
8209
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
8210
|
+
* @LastEditTime: 2023-04-08 17:31:57
|
|
8050
8211
|
* @Description:
|
|
8051
8212
|
*/
|
|
8052
8213
|
|
|
@@ -8218,14 +8379,14 @@ setTimeout(()=>{
|
|
|
8218
8379
|
async function getFormSchema(objectName, ctx) {
|
|
8219
8380
|
const uiSchema = await getUISchema(objectName);
|
|
8220
8381
|
const amisSchema = await getObjectForm(uiSchema, ctx);
|
|
8221
|
-
|
|
8382
|
+
console.log(`getFormSchema====>`, amisSchema);
|
|
8222
8383
|
return {
|
|
8223
8384
|
uiSchema,
|
|
8224
8385
|
amisSchema,
|
|
8225
8386
|
};
|
|
8226
8387
|
}
|
|
8227
8388
|
|
|
8228
|
-
// 获取只读页面
|
|
8389
|
+
// 获取只读页面 recordId 已废弃, 函数签名保持不变, 但recordId变量不可再使用, 请使用运行时的${recordId}
|
|
8229
8390
|
async function getViewSchema(objectName, recordId, ctx) {
|
|
8230
8391
|
const uiSchema = await getUISchema(objectName);
|
|
8231
8392
|
const amisSchema = await getObjectDetail(uiSchema, recordId, ctx);
|
|
@@ -8410,6 +8571,7 @@ setTimeout(()=>{
|
|
|
8410
8571
|
headerToolbarItems: ctx.headerToolbarItems,
|
|
8411
8572
|
buttons: await getListViewItemButtons(uiSchema, ctx)
|
|
8412
8573
|
});
|
|
8574
|
+
// console.log('getTableSchema====>amisSchema', amisSchema)
|
|
8413
8575
|
return {
|
|
8414
8576
|
uiSchema,
|
|
8415
8577
|
amisSchema,
|
|
@@ -8508,15 +8670,8 @@ setTimeout(()=>{
|
|
|
8508
8670
|
"data": {
|
|
8509
8671
|
"name": `\${event.data.record.${uiSchema?.NAME_FIELD_KEY || 'name'}}`,
|
|
8510
8672
|
"record": `\${event.data.record}`,
|
|
8511
|
-
"
|
|
8512
|
-
|
|
8513
|
-
},
|
|
8514
|
-
{
|
|
8515
|
-
"actionType": "reload",
|
|
8516
|
-
"componentId": `page_readonly_${objectName}_header`, //刷新标题, 详细页面header service 嵌套太多, 导致仅刷新第一层service无法更新recordName
|
|
8517
|
-
"data": {
|
|
8518
|
-
"name": `\${event.data.record.${uiSchema?.NAME_FIELD_KEY || 'name'}}`,
|
|
8519
|
-
"record": `\${event.data.record}`,
|
|
8673
|
+
"_id": "\${event.data.record._id}",
|
|
8674
|
+
"recordId": "\${event.data.record._id}",
|
|
8520
8675
|
"recordLoaded": true,
|
|
8521
8676
|
}
|
|
8522
8677
|
}
|
|
@@ -8526,10 +8681,10 @@ setTimeout(()=>{
|
|
|
8526
8681
|
},
|
|
8527
8682
|
content
|
|
8528
8683
|
],
|
|
8529
|
-
data: {
|
|
8530
|
-
|
|
8531
|
-
|
|
8532
|
-
},
|
|
8684
|
+
// data: {
|
|
8685
|
+
// "_master.objectName": "${objectName}",
|
|
8686
|
+
// "_master.recordId": "${recordId}"
|
|
8687
|
+
// },
|
|
8533
8688
|
onEvent: {
|
|
8534
8689
|
"recordLoaded": {
|
|
8535
8690
|
"actions": [
|
|
@@ -8537,10 +8692,10 @@ setTimeout(()=>{
|
|
|
8537
8692
|
"actionType": "reload",
|
|
8538
8693
|
"data": {
|
|
8539
8694
|
"name": `\${record.${uiSchema.NAME_FIELD_KEY || 'name'}}`,
|
|
8540
|
-
"_master.record": `\${record}`,
|
|
8541
|
-
// 不清楚reload 如何给对象下的某个key复制, 所以此处重复设置_master的objectName、recordId
|
|
8542
|
-
"_master.objectName": "${objectName}",
|
|
8543
|
-
"_master.recordId": "${recordId}"
|
|
8695
|
+
// "_master.record": `\${record}`,
|
|
8696
|
+
// // 不清楚reload 如何给对象下的某个key复制, 所以此处重复设置_master的objectName、recordId
|
|
8697
|
+
// "_master.objectName": "${objectName}",
|
|
8698
|
+
// "_master.recordId": "${recordId}"
|
|
8544
8699
|
}
|
|
8545
8700
|
}
|
|
8546
8701
|
]
|
|
@@ -8551,51 +8706,6 @@ setTimeout(()=>{
|
|
|
8551
8706
|
}
|
|
8552
8707
|
}
|
|
8553
8708
|
|
|
8554
|
-
// export async function getRecordDetailRelatedListSchema(objectName,recordId,relatedObjectName){
|
|
8555
|
-
// // console.log('b==>',objectName,recordId,relatedObjectName)
|
|
8556
|
-
// const relatedObjectUiSchema = await getUISchema(relatedObjectName);
|
|
8557
|
-
// const { list_views, label , icon, fields } = relatedObjectUiSchema;
|
|
8558
|
-
// const firstListViewName = keys(list_views)[0];
|
|
8559
|
-
// const relatedKey = findKey(fields, function(field) {
|
|
8560
|
-
// return ["lookup","master_detail"].indexOf(field.type) > -1 && field.reference_to === objectName;
|
|
8561
|
-
// });
|
|
8562
|
-
// const globalFilter = [relatedKey,'=',recordId];
|
|
8563
|
-
// const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema);
|
|
8564
|
-
// const options = {
|
|
8565
|
-
// globalFilter,
|
|
8566
|
-
// defaults: {
|
|
8567
|
-
// listSchema: { headerToolbar:[],columnsTogglable:false },
|
|
8568
|
-
// headerSchema: recordRelatedListHeader
|
|
8569
|
-
// },
|
|
8570
|
-
// showHeader: true
|
|
8571
|
-
// }
|
|
8572
|
-
// const amisSchema= (await getListSchema(null, relatedObjectName, firstListViewName, options)).amisSchema;
|
|
8573
|
-
// return {
|
|
8574
|
-
// uiSchema: relatedObjectUiSchema,
|
|
8575
|
-
// amisSchema: {
|
|
8576
|
-
// type: "service",
|
|
8577
|
-
// data: {
|
|
8578
|
-
// masterObjectName: objectName,
|
|
8579
|
-
// masterRecordId: "${recordId}",
|
|
8580
|
-
// relatedKey: relatedKey,
|
|
8581
|
-
// objectName: relatedObjectName,
|
|
8582
|
-
// listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
|
|
8583
|
-
// },
|
|
8584
|
-
// body:[
|
|
8585
|
-
// {
|
|
8586
|
-
// ...amisSchema,
|
|
8587
|
-
// data: {
|
|
8588
|
-
// filter: ["${relatedKey}", "=", "${masterRecordId}"],
|
|
8589
|
-
// objectName: "${objectName}",
|
|
8590
|
-
// recordId: "${masterRecordId}",
|
|
8591
|
-
// ...{[relatedKey]: getRelatedFieldValue(objectName, "${recordId}", relatedSchema.uiSchema, relatedKey)}
|
|
8592
|
-
// }
|
|
8593
|
-
// }
|
|
8594
|
-
// ]
|
|
8595
|
-
// }
|
|
8596
|
-
// };
|
|
8597
|
-
// }
|
|
8598
|
-
|
|
8599
8709
|
|
|
8600
8710
|
// 获取单个相关表
|
|
8601
8711
|
async function getObjectRelated(
|
|
@@ -11491,6 +11601,7 @@ setTimeout(()=>{
|
|
|
11491
11601
|
getListViewItemButtons: getListViewItemButtons,
|
|
11492
11602
|
getListViewSort: getListViewSort,
|
|
11493
11603
|
getListviewInitSchema: getListviewInitSchema,
|
|
11604
|
+
getLookupSapceUserTreeSchema: getLookupSapceUserTreeSchema,
|
|
11494
11605
|
getNotifications: getNotifications,
|
|
11495
11606
|
getObjectDetailButtons: getObjectDetailButtons,
|
|
11496
11607
|
getObjectDetailMoreButtons: getObjectDetailMoreButtons,
|
|
@@ -11756,7 +11867,13 @@ setTimeout(()=>{
|
|
|
11756
11867
|
// if(className){
|
|
11757
11868
|
// schema.className = schema.className + ' ' + className;
|
|
11758
11869
|
// }
|
|
11759
|
-
var renderData = Object.assign(data, {
|
|
11870
|
+
var renderData = Object.assign(data, { objectName: objectName, app_id: appId, className: className });
|
|
11871
|
+
if (data._id) {
|
|
11872
|
+
renderData.recordId = data._id;
|
|
11873
|
+
}
|
|
11874
|
+
if (data.listViewId) {
|
|
11875
|
+
renderData.listViewId = data.listViewId;
|
|
11876
|
+
}
|
|
11760
11877
|
if (schema) {
|
|
11761
11878
|
schema.data = ___default.defaultsDeep({}, renderData, getDefaultRenderData(), schema.data);
|
|
11762
11879
|
}
|
|
@@ -11925,13 +12042,13 @@ setTimeout(()=>{
|
|
|
11925
12042
|
};
|
|
11926
12043
|
|
|
11927
12044
|
var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
11928
|
-
var $schema, recordId, mode, layout, labelAlign, appId, fieldsExtend, _a, excludedFields, _b, fields, _c, className, initApiRequestAdaptor, initApiAdaptor, apiRequestAdaptor, apiAdaptor, objectApiName, schemaKeys, formSchema, defaults, options, globalData, amisSchema, uiSchema, schema, schema, formData;
|
|
12045
|
+
var $schema, recordId, defaultData, mode, layout, labelAlign, appId, fieldsExtend, _a, excludedFields, _b, fields, _c, className, initApiRequestAdaptor, initApiAdaptor, apiRequestAdaptor, apiAdaptor, objectApiName, schemaKeys, formSchema, defaults, options, globalData, amisSchema, uiSchema, schema, schema, formData;
|
|
11929
12046
|
return __generator(this, function (_d) {
|
|
11930
12047
|
switch (_d.label) {
|
|
11931
12048
|
case 0:
|
|
11932
|
-
$schema = props.$schema, recordId = props.recordId, 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.className, className = _c === void 0 ? "" : _c, initApiRequestAdaptor = props.initApiRequestAdaptor, initApiAdaptor = props.initApiAdaptor, apiRequestAdaptor = props.apiRequestAdaptor, apiAdaptor = props.apiAdaptor;
|
|
12049
|
+
$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.className, className = _c === void 0 ? "" : _c, initApiRequestAdaptor = props.initApiRequestAdaptor, initApiAdaptor = props.initApiAdaptor, apiRequestAdaptor = props.apiRequestAdaptor, apiAdaptor = props.apiAdaptor;
|
|
11933
12050
|
objectApiName = props.objectApiName || "space_users";
|
|
11934
|
-
schemaKeys = ___default.difference(___default.keys($schema), ["type", "mode", "layout"]);
|
|
12051
|
+
schemaKeys = ___default.difference(___default.keys($schema), ["type", "mode", "layout", "defaultData"]);
|
|
11935
12052
|
formSchema = ___default.pick(props, schemaKeys);
|
|
11936
12053
|
defaults = {
|
|
11937
12054
|
formSchema: formSchema
|
|
@@ -11964,17 +12081,12 @@ setTimeout(()=>{
|
|
|
11964
12081
|
case 1:
|
|
11965
12082
|
schema = _d.sent();
|
|
11966
12083
|
amisSchema = schema.amisSchema;
|
|
12084
|
+
if (defaultData) {
|
|
12085
|
+
amisSchema.data.defaultData = __assign$2({ "&": "${defaultData}" }, defaultData);
|
|
12086
|
+
}
|
|
11967
12087
|
uiSchema = schema.uiSchema;
|
|
11968
12088
|
return [3 /*break*/, 4];
|
|
11969
|
-
case 2:
|
|
11970
|
-
// formInitProps
|
|
11971
|
-
if (!recordId) {
|
|
11972
|
-
// 只读界面只返回一条记录
|
|
11973
|
-
options.formInitProps = {
|
|
11974
|
-
queryOptions: "top: 1"
|
|
11975
|
-
};
|
|
11976
|
-
}
|
|
11977
|
-
return [4 /*yield*/, getViewSchema(objectApiName, recordId, options)];
|
|
12089
|
+
case 2: return [4 /*yield*/, getViewSchema(objectApiName, recordId, options)];
|
|
11978
12090
|
case 3:
|
|
11979
12091
|
schema = _d.sent();
|
|
11980
12092
|
amisSchema = schema.amisSchema;
|
|
@@ -11982,13 +12094,13 @@ setTimeout(()=>{
|
|
|
11982
12094
|
_d.label = 4;
|
|
11983
12095
|
case 4:
|
|
11984
12096
|
formData = {};
|
|
11985
|
-
formData.recordId = recordId || null;
|
|
11986
|
-
if
|
|
11987
|
-
|
|
11988
|
-
}
|
|
12097
|
+
// formData.recordId = recordId || null;
|
|
12098
|
+
// if(objectApiName){
|
|
12099
|
+
// formData.objectName = objectApiName;
|
|
12100
|
+
// }
|
|
11989
12101
|
amisSchema.className = "steedos-object-form ".concat(className);
|
|
11990
|
-
amisSchema.data = Object.assign(
|
|
11991
|
-
// console.log(
|
|
12102
|
+
amisSchema.data = Object.assign(amisSchema.data, formData, { global: globalData, uiSchema: uiSchema });
|
|
12103
|
+
// console.log(`===AmisObjectForm=amisSchema==`, amisSchema)
|
|
11992
12104
|
return [2 /*return*/, amisSchema];
|
|
11993
12105
|
}
|
|
11994
12106
|
});
|
|
@@ -12115,7 +12227,7 @@ setTimeout(()=>{
|
|
|
12115
12227
|
]
|
|
12116
12228
|
}];
|
|
12117
12229
|
}
|
|
12118
|
-
serviceData = Object.assign({},
|
|
12230
|
+
serviceData = Object.assign({}, { listName: listName, uiSchema: uiSchema, showDisplayAs: showDisplayAs, displayAs: displayAs, recordPermissions: uiSchema.permissions, _id: null, $listviewId: listName });
|
|
12119
12231
|
return [2 /*return*/, {
|
|
12120
12232
|
"type": "service",
|
|
12121
12233
|
"body": body,
|
|
@@ -12153,11 +12265,11 @@ setTimeout(()=>{
|
|
|
12153
12265
|
return tableColumns;
|
|
12154
12266
|
}
|
|
12155
12267
|
var AmisObjectTable = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
12156
|
-
var $schema, filters, filtersFunction, amisCondition, top, headerSchema, includedFields, fieldsExtend, sort, sortField, sortOrder, extraColumns, data, defaultData, _a, formFactor, _b, className, requestAdaptor, adaptor, headerToolbarItems, ctx, columns, defaults, objectApiName, schemaKeys, listSchema, setDataToComponentId, amisFilters, tableFilters, amisSchemaData, appId, amisSchema;
|
|
12157
|
-
return __generator(this, function (
|
|
12158
|
-
switch (
|
|
12268
|
+
var $schema, filters, filtersFunction, amisCondition, top, headerSchema, includedFields, fieldsExtend, sort, sortField, sortOrder, extraColumns, data, defaultData, _a, formFactor, _b, className, requestAdaptor, adaptor, _c, filterVisible, headerToolbarItems, ctx, columns, defaults, objectApiName, schemaKeys, listSchema, setDataToComponentId, amisFilters, tableFilters, amisSchemaData, appId, amisSchema;
|
|
12269
|
+
return __generator(this, function (_d) {
|
|
12270
|
+
switch (_d.label) {
|
|
12159
12271
|
case 0:
|
|
12160
|
-
$schema = props.$schema, filters = props.filters, filtersFunction = props.filtersFunction, amisCondition = props.amisCondition, top = props.top, headerSchema = props.headerSchema, includedFields = props.fields, fieldsExtend = props.fieldsExtend, sort = props.sort, sortField = props.sortField, sortOrder = props.sortOrder, extraColumns = props.extraColumns, data = props.data, defaultData = props.defaultData, _a = props.formFactor, formFactor = _a === void 0 ? window.innerWidth < 768 ? 'SMALL' : 'LARGE' : _a, _b = props.className, className = _b === void 0 ? "" : _b, requestAdaptor = props.requestAdaptor, adaptor = props.adaptor, headerToolbarItems = props.headerToolbarItems;
|
|
12272
|
+
$schema = props.$schema, filters = props.filters, filtersFunction = props.filtersFunction, amisCondition = props.amisCondition, top = props.top, headerSchema = props.headerSchema, includedFields = props.fields, fieldsExtend = props.fieldsExtend, sort = props.sort, sortField = props.sortField, sortOrder = props.sortOrder, extraColumns = props.extraColumns, data = props.data, defaultData = props.defaultData, _a = props.formFactor, formFactor = _a === void 0 ? window.innerWidth < 768 ? 'SMALL' : 'LARGE' : _a, _b = props.className, className = _b === void 0 ? "" : _b, requestAdaptor = props.requestAdaptor, adaptor = props.adaptor, _c = props.filterVisible, filterVisible = _c === void 0 ? true : _c, headerToolbarItems = props.headerToolbarItems;
|
|
12161
12273
|
ctx = props.ctx;
|
|
12162
12274
|
if (!ctx) {
|
|
12163
12275
|
ctx = {};
|
|
@@ -12191,11 +12303,12 @@ setTimeout(()=>{
|
|
|
12191
12303
|
appId = (data === null || data === void 0 ? void 0 : data.appId) || (defaultData === null || defaultData === void 0 ? void 0 : defaultData.appId);
|
|
12192
12304
|
// ctx中值为undefined的属性不能保留,否则会导致 filters等被覆盖。
|
|
12193
12305
|
ctx = ___default.pickBy(ctx, function (value) { return value !== undefined; });
|
|
12194
|
-
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, headerToolbarItems: headerToolbarItems }))];
|
|
12306
|
+
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 }))];
|
|
12195
12307
|
case 1:
|
|
12196
|
-
amisSchema = (
|
|
12308
|
+
amisSchema = (_d.sent()).amisSchema;
|
|
12197
12309
|
amisSchema.data = Object.assign({}, amisSchema.data, amisSchemaData);
|
|
12198
12310
|
amisSchema.className = "steedos-object-table h-full flex flex-col ".concat(className);
|
|
12311
|
+
// console.log(`AmisObjectTable===>amisSchema`, amisSchema)
|
|
12199
12312
|
return [2 /*return*/, amisSchema];
|
|
12200
12313
|
}
|
|
12201
12314
|
});
|
|
@@ -12304,16 +12417,17 @@ setTimeout(()=>{
|
|
|
12304
12417
|
}); };
|
|
12305
12418
|
|
|
12306
12419
|
var AmisRecordDetailRelatedList = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
12307
|
-
var objectApiName, recordId, relatedObjectApiName, relatedKey, top, perPage,
|
|
12420
|
+
var objectApiName, recordId, relatedObjectApiName, relatedKey, top, perPage, appId, relatedLabel, _a, className, columns, sort, filters, visible_on, formFactor, schema;
|
|
12308
12421
|
return __generator(this, function (_b) {
|
|
12309
12422
|
switch (_b.label) {
|
|
12310
12423
|
case 0:
|
|
12311
|
-
objectApiName = props.objectApiName, recordId = props.recordId, relatedObjectApiName = props.relatedObjectApiName, props.data, relatedKey = props.relatedKey, top = props.top, perPage = props.perPage,
|
|
12424
|
+
objectApiName = props.objectApiName, recordId = props.recordId, relatedObjectApiName = props.relatedObjectApiName, props.data, relatedKey = props.relatedKey, top = props.top, perPage = props.perPage, appId = props.appId, relatedLabel = props.relatedLabel, _a = props.className, className = _a === void 0 ? '' : _a, columns = props.columns, sort = props.sort, filters = props.filters, visible_on = props.visible_on;
|
|
12312
12425
|
formFactor = props.formFactor;
|
|
12313
12426
|
if (!formFactor) {
|
|
12314
12427
|
formFactor = window.innerWidth < 768 ? 'SMALL' : 'LARGE';
|
|
12315
12428
|
}
|
|
12316
|
-
if (!objectApiName || !relatedObjectApiName
|
|
12429
|
+
if (!objectApiName || !relatedObjectApiName) {
|
|
12430
|
+
// if(!objectApiName || !relatedObjectApiName || !recordId){
|
|
12317
12431
|
return [2 /*return*/, {
|
|
12318
12432
|
"type": "alert",
|
|
12319
12433
|
"body": "缺少父级对象、父级记录或相关列表对象属性",
|
|
@@ -12322,7 +12436,7 @@ setTimeout(()=>{
|
|
|
12322
12436
|
"className": "mb-3"
|
|
12323
12437
|
}];
|
|
12324
12438
|
}
|
|
12325
|
-
return [4 /*yield*/, getRecordDetailRelatedListSchema(objectApiName, recordId, relatedObjectApiName, relatedKey, { top: top, perPage: perPage,
|
|
12439
|
+
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 })];
|
|
12326
12440
|
case 1:
|
|
12327
12441
|
schema = (_b.sent()).amisSchema;
|
|
12328
12442
|
return [2 /*return*/, schema];
|
|
@@ -12331,12 +12445,13 @@ setTimeout(()=>{
|
|
|
12331
12445
|
}); };
|
|
12332
12446
|
|
|
12333
12447
|
var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
12334
|
-
var objectApiName,
|
|
12448
|
+
var objectApiName, _a, perPage, relatedLists;
|
|
12335
12449
|
return __generator(this, function (_b) {
|
|
12336
12450
|
switch (_b.label) {
|
|
12337
12451
|
case 0:
|
|
12338
|
-
objectApiName = props.objectApiName,
|
|
12339
|
-
if (!objectApiName
|
|
12452
|
+
objectApiName = props.objectApiName, props.recordId, props.data, _a = props.perPage, perPage = _a === void 0 ? 5 : _a;
|
|
12453
|
+
if (!objectApiName) {
|
|
12454
|
+
// if(!objectApiName || !recordId){
|
|
12340
12455
|
return [2 /*return*/, {
|
|
12341
12456
|
"type": "alert",
|
|
12342
12457
|
"body": "缺少父级对象或父级记录属性",
|
|
@@ -12365,7 +12480,7 @@ setTimeout(()=>{
|
|
|
12365
12480
|
return {
|
|
12366
12481
|
type: 'steedos-object-related-listview',
|
|
12367
12482
|
objectApiName: objectApiName,
|
|
12368
|
-
recordId: recordId,
|
|
12483
|
+
// recordId: recordId,
|
|
12369
12484
|
relatedObjectApiName: item.object_name,
|
|
12370
12485
|
foreign_key: item.foreign_key,
|
|
12371
12486
|
relatedKey: item.foreign_key,
|
|
@@ -13170,35 +13285,39 @@ setTimeout(()=>{
|
|
|
13170
13285
|
* @Author: baozhoutao@steedos.com
|
|
13171
13286
|
* @Date: 2023-01-14 16:41:24
|
|
13172
13287
|
* @LastEditors: baozhoutao@steedos.com
|
|
13173
|
-
* @LastEditTime: 2023-03-23
|
|
13288
|
+
* @LastEditTime: 2023-03-23 18:00:25
|
|
13174
13289
|
* @Description:
|
|
13175
13290
|
*/
|
|
13176
13291
|
var getSelectFlowSchema = function (id, props) {
|
|
13177
13292
|
var label = props.label, data = props.data, name = props.name, required = props.required, _a = props.action, action = _a === void 0 ? 'query' : _a, _b = props.distributeInstanceId, distributeInstanceId = _b === void 0 ? "" : _b, _c = props.distributeStepId, distributeStepId = _c === void 0 ? "" : _c, _d = props.mode, mode = _d === void 0 ? 'input-tree' : _d, className = props.className, onEvent = props.onEvent, _e = props.multiple, multiple = _e === void 0 ? false : _e, delimiter = props.delimiter, joinValues = props.joinValues, extractValue = props.extractValue, searchable = props.searchable, _f = props.showIcon, showIcon = _f === void 0 ? true : _f, _g = props.showRadio, showRadio = _g === void 0 ? false : _g, showOutline = props.showOutline, initiallyOpen = props.initiallyOpen, unfoldedLevel = props.unfoldedLevel, treeContainerClassName = props.treeContainerClassName, _h = props.amis, amis = _h === void 0 ? {} : _h;
|
|
13178
|
-
|
|
13179
|
-
|
|
13180
|
-
|
|
13181
|
-
|
|
13182
|
-
|
|
13183
|
-
|
|
13184
|
-
|
|
13185
|
-
|
|
13186
|
-
|
|
13187
|
-
|
|
13188
|
-
|
|
13189
|
-
|
|
13190
|
-
|
|
13191
|
-
|
|
13192
|
-
|
|
13193
|
-
|
|
13194
|
-
|
|
13195
|
-
|
|
13196
|
-
|
|
13197
|
-
|
|
13198
|
-
|
|
13199
|
-
|
|
13200
|
-
|
|
13201
|
-
|
|
13293
|
+
console.log("=====onEvent", onEvent);
|
|
13294
|
+
return __assign$2({ "type": mode, "id": id, "label": label, "name": name, "options": [], "multiple": multiple, "delimiter": delimiter, "joinValues": joinValues, "extractValue": extractValue, "searchable": searchable, "showOutline": showOutline, "initiallyOpen": initiallyOpen, "unfoldedLevel": unfoldedLevel, "className": className, "required": required, "treeContainerClassName": treeContainerClassName, "menuTpl": {
|
|
13295
|
+
// type: "button",
|
|
13296
|
+
type: "tpl",
|
|
13297
|
+
tpl: "<div class='flex justify-between'><span>${label}</span><span class='rounded p-1 text-xs text-center w-14 ${children != null ? \'hidden\' : \'\'}'><button><i class='fa-regular fa-star'></i></button></span></div>",
|
|
13298
|
+
"onEvent": {
|
|
13299
|
+
"click": {
|
|
13300
|
+
"weight": 0,
|
|
13301
|
+
"actions": [
|
|
13302
|
+
{
|
|
13303
|
+
actionType: 'custom',
|
|
13304
|
+
script: "console.log('====event', event), event.preventDefault(); event.stopPropagation()"
|
|
13305
|
+
},
|
|
13306
|
+
{
|
|
13307
|
+
"args": {
|
|
13308
|
+
"api": {
|
|
13309
|
+
"url": "/aaa",
|
|
13310
|
+
"method": "get",
|
|
13311
|
+
"messages": {}
|
|
13312
|
+
}
|
|
13313
|
+
},
|
|
13314
|
+
"actionType": "download",
|
|
13315
|
+
"stopPropagation": true
|
|
13316
|
+
}
|
|
13317
|
+
]
|
|
13318
|
+
}
|
|
13319
|
+
}
|
|
13320
|
+
}, "source": {
|
|
13202
13321
|
"method": "post",
|
|
13203
13322
|
"url": "${context.rootUrl}/graphql?keywords=${keywords}",
|
|
13204
13323
|
"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 "),
|
|
@@ -13308,14 +13427,19 @@ setTimeout(()=>{
|
|
|
13308
13427
|
"showHeader": true,
|
|
13309
13428
|
"showDisplayAs": (defaultFormFactor !== 'SMALL'),
|
|
13310
13429
|
"formFactor": formFactor,
|
|
13311
|
-
"className": (displayAs === 'split') ? 'w-full' : 'p-0 flex-1
|
|
13430
|
+
"className": (displayAs === 'split') ? 'w-full' : 'p-0 flex-1 m-0 sm:border sm:shadow sm:rounded border-slate-300 border-solid bg-gray-100'
|
|
13312
13431
|
};
|
|
13313
|
-
defData = __assign$2(__assign$2({}, $schema.data), { objectName: objectApiName, listViewId: listViewId,
|
|
13432
|
+
defData = __assign$2(__assign$2({}, $schema.data), { objectName: objectApiName, listViewId: listViewId,
|
|
13433
|
+
// listName: listName || listviewId,
|
|
13434
|
+
appId: appId, formFactor: formFactor, displayAs: displayAs });
|
|
13435
|
+
if (listName) {
|
|
13436
|
+
defData.listName = listName || listviewId;
|
|
13437
|
+
}
|
|
13314
13438
|
// console.log("defData====>", defData)
|
|
13315
13439
|
return [2 /*return*/, {
|
|
13316
13440
|
type: 'service',
|
|
13317
13441
|
data: defData,
|
|
13318
|
-
"className": (displayAs === 'grid') ? 'h-full' : 'p-0 flex flex-1 overflow-hidden h-full',
|
|
13442
|
+
"className": (displayAs === 'grid') ? 'h-full sm:p-3' : 'p-0 flex flex-1 overflow-hidden h-full',
|
|
13319
13443
|
body: (displayAs === 'grid') ? ___default.defaultsDeep({ data: defData }, listSchema) : [
|
|
13320
13444
|
{
|
|
13321
13445
|
"type": "wrapper",
|
|
@@ -13334,11 +13458,11 @@ setTimeout(()=>{
|
|
|
13334
13458
|
}); };
|
|
13335
13459
|
|
|
13336
13460
|
var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13337
|
-
var defaultFormFactor, appId, objectApiName,
|
|
13461
|
+
var defaultFormFactor, appId, objectApiName, display, sideObject, sideListviewId, $schema, displayAs, formFactor, listPage, recordSchema, recordPage, listSchema, defData;
|
|
13338
13462
|
return __generator(this, function (_a) {
|
|
13339
13463
|
switch (_a.label) {
|
|
13340
13464
|
case 0:
|
|
13341
|
-
defaultFormFactor = props.formFactor, appId = props.appId, objectApiName = props.objectApiName,
|
|
13465
|
+
defaultFormFactor = props.formFactor, appId = props.appId, objectApiName = props.objectApiName, props.recordId, display = props.display, sideObject = props.sideObject, sideListviewId = props.sideListviewId, $schema = props.$schema, props.data;
|
|
13342
13466
|
if (display)
|
|
13343
13467
|
Router$1.setTabDisplayAs(objectApiName, display);
|
|
13344
13468
|
displayAs = (defaultFormFactor === 'SMALL') ? 'grid' : display ? display : sideObject ? 'split' : Router$1.getTabDisplayAs(objectApiName);
|
|
@@ -13347,7 +13471,6 @@ setTimeout(()=>{
|
|
|
13347
13471
|
case 1:
|
|
13348
13472
|
listPage = _a.sent();
|
|
13349
13473
|
recordSchema = {};
|
|
13350
|
-
if (!recordId) return [3 /*break*/, 3];
|
|
13351
13474
|
return [4 /*yield*/, getPage({ type: 'record', appId: appId, objectName: objectApiName, formFactor: defaultFormFactor })];
|
|
13352
13475
|
case 2:
|
|
13353
13476
|
recordPage = _a.sent();
|
|
@@ -13358,13 +13481,36 @@ setTimeout(()=>{
|
|
|
13358
13481
|
"body": [
|
|
13359
13482
|
{
|
|
13360
13483
|
"type": "steedos-record-detail",
|
|
13361
|
-
"recordId": "${recordId}",
|
|
13484
|
+
// "recordId": "${recordId}",
|
|
13362
13485
|
"objectApiName": "${objectName}",
|
|
13363
13486
|
className: "sm:m-3",
|
|
13364
13487
|
appId: appId,
|
|
13365
13488
|
}
|
|
13366
13489
|
],
|
|
13367
13490
|
};
|
|
13491
|
+
recordSchema = {
|
|
13492
|
+
"type": "service",
|
|
13493
|
+
"body": [recordSchema],
|
|
13494
|
+
data: {
|
|
13495
|
+
"_master.objectName": "${objectName}",
|
|
13496
|
+
"_master.recordId": "${recordId}"
|
|
13497
|
+
},
|
|
13498
|
+
onEvent: {
|
|
13499
|
+
"recordLoaded": {
|
|
13500
|
+
"actions": [
|
|
13501
|
+
{
|
|
13502
|
+
"actionType": "reload",
|
|
13503
|
+
"data": {
|
|
13504
|
+
"_master.record": "${record}",
|
|
13505
|
+
// 不清楚reload 如何给对象下的某个key复制, 所以此处重复设置_master的objectName、recordId
|
|
13506
|
+
"_master.objectName": "${objectName}",
|
|
13507
|
+
"_master.recordId": "${recordId}"
|
|
13508
|
+
}
|
|
13509
|
+
}
|
|
13510
|
+
]
|
|
13511
|
+
}
|
|
13512
|
+
}
|
|
13513
|
+
};
|
|
13368
13514
|
_a.label = 3;
|
|
13369
13515
|
case 3:
|
|
13370
13516
|
listSchema = listPage ? JSON.parse(listPage.schema) : {
|
|
@@ -13375,7 +13521,10 @@ setTimeout(()=>{
|
|
|
13375
13521
|
"showDisplayAs": true,
|
|
13376
13522
|
"formFactor": 'SMALL',
|
|
13377
13523
|
};
|
|
13378
|
-
defData = __assign$2(__assign$2({}, $schema.data), { objectName: objectApiName, listViewId: sideListviewId, listName: sideListviewId,
|
|
13524
|
+
defData = __assign$2(__assign$2({}, $schema.data), { objectName: objectApiName, listViewId: sideListviewId, listName: sideListviewId,
|
|
13525
|
+
// recordId: "${recordId}",
|
|
13526
|
+
// appId: appId,
|
|
13527
|
+
formFactor: formFactor, displayAs: displayAs });
|
|
13379
13528
|
// console.log('defData====>', defData)
|
|
13380
13529
|
return [2 /*return*/, {
|
|
13381
13530
|
type: 'service',
|
|
@@ -13398,7 +13547,7 @@ setTimeout(()=>{
|
|
|
13398
13547
|
});
|
|
13399
13548
|
}); };
|
|
13400
13549
|
|
|
13401
|
-
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)}}}}},authRequest=function(e,t){var a=null;e=Steedos.absoluteUrl(e);try{var r=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],n={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(r&&r.length)return r.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){a=e;},error:function(e,t,r){var n,o;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,o=void(a={error:n}),o=n.reason||n.message||n,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),a}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}const newFunctionComponent=o=>e=>{const[t,r]=React.useState(!0);var n=()=>{r(!1);};return ___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 a=window.Creator;if(!!(!a||!a.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return ___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,a=function(e,t){return "#"!==t&&t?"string"==typeof t?_.get(e,t):void console.error("path has to be a string"):e||{}}(e=void 0===e?{}:e,function(e){return "string"!=typeof e||1===(e=e.split(".")).length?"#":(e.pop(),e.join("."))}(r))||{};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(a));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=(e,t)=>{let r=e;return /^\{\w+(\.*\w+)*\}$/.test(e)&&(r=-1<e.indexOf("userId")||-1<e.indexOf("spaceId")||-1<e.indexOf("user.")||-1<e.indexOf("now")?`{${e}}`.replace("{{","{{global."):`{${e}}`.replace("{{","{{formData."),t&&(r=r.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),r},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 r=e?.unfoldedNum||1,n=[],o=(t,r,n)=>{var e;if(r)return e=_.filter(t,e=>_.includes(r,e.value)),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=o(t,e.children,n-1))):e.children&&(e.children=o(t,e.children,n));}),e};for(var a=t,i=0;i<a.length;i++)if(a[i].noParent=0,a[i].unfolded=!1,a[i].parent){
|
|
13550
|
+
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)}}}}},authRequest=function(e,t){var a=null;e=Steedos.absoluteUrl(e);try{var r=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],n={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(r&&r.length)return r.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){a=e;},error:function(e,t,r){var n,o;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,o=void(a={error:n}),o=n.reason||n.message||n,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),a}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}const newFunctionComponent=o=>e=>{const[t,r]=React.useState(!0);var n=()=>{r(!1);};return ___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 a=window.Creator;if(!!(!a||!a.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return ___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,a=function(e,t){return "#"!==t&&t?"string"==typeof t?_.get(e,t):void console.error("path has to be a string"):e||{}}(e=void 0===e?{}:e,function(e){return "string"!=typeof e||1===(e=e.split(".")).length?"#":(e.pop(),e.join("."))}(r))||{};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(a));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=(e,t)=>{let r=e;return /^\{\w+(\.*\w+)*\}$/.test(e)&&(r=-1<e.indexOf("userId")||-1<e.indexOf("spaceId")||-1<e.indexOf("user.")||-1<e.indexOf("now")?`{${e}}`.replace("{{","{{global."):`{${e}}`.replace("{{","{{formData."),t&&(r=r.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),r},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 r=e?.unfoldedNum||1,n=[],o=(t,r,n)=>{var e;if(r)return e=_.filter(t,e=>_.includes(r,e.value)),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=o(t,e.children,n-1))):e.children&&(e.children=o(t,e.children,n));}),e};for(var a=t,i=0;i<a.length;i++)if(a[i].noParent=0,a[i].unfolded=!1,a[i].parent){let e=1;for(var s=0;s<a.length;s++)a[i].parent==a[s].value&&(e=0);1==e&&(a[i].noParent=1);}else a[i].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=r?(e.unfolded=!0,n.push(Object.assign({},e,{children:o(t,e.children,r-1)}))):n.push(Object.assign({},e,{children:o(t,e.children,r)})));}),n}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});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);
|
|
13402
13551
|
|
|
13403
13552
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
13404
13553
|
__proto__: null,
|