@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.cjs.js
CHANGED
|
@@ -1039,11 +1039,7 @@ function getRecordPermissionsTemplate(){
|
|
|
1039
1039
|
}
|
|
1040
1040
|
|
|
1041
1041
|
async function getFindOneQuery$1(object, recordId, fields, options){
|
|
1042
|
-
let queryOptions = ""
|
|
1043
|
-
|
|
1044
|
-
if(recordId){
|
|
1045
|
-
queryOptions = `(filters:["${object.idFieldName}", "=", "${recordId}"])`;
|
|
1046
|
-
}
|
|
1042
|
+
let queryOptions = `(filters:["${object.idFieldName}", "=", "\${recordId}"])`;
|
|
1047
1043
|
let alias = "data";
|
|
1048
1044
|
if(options){
|
|
1049
1045
|
if(options.alias){
|
|
@@ -1752,8 +1748,8 @@ var config = {
|
|
|
1752
1748
|
/*
|
|
1753
1749
|
* @Author: baozhoutao@steedos.com
|
|
1754
1750
|
* @Date: 2022-11-01 15:51:00
|
|
1755
|
-
* @LastEditors:
|
|
1756
|
-
* @LastEditTime: 2023-
|
|
1751
|
+
* @LastEditors: Please set LastEditors
|
|
1752
|
+
* @LastEditTime: 2023-04-08 12:05:19
|
|
1757
1753
|
* @Description:
|
|
1758
1754
|
*/
|
|
1759
1755
|
|
|
@@ -1771,6 +1767,32 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
1771
1767
|
if (payload && payload.schema) {
|
|
1772
1768
|
formSchema = _.isString(payload.schema) ? JSON.parse(payload.schema) : payload.schema;
|
|
1773
1769
|
}
|
|
1770
|
+
|
|
1771
|
+
const _master = api.body._master;
|
|
1772
|
+
if(_master && _master._isRelated){
|
|
1773
|
+
const relatedKey = _master.relatedKey;
|
|
1774
|
+
const masterObjectName = _master.objectName;
|
|
1775
|
+
const recordId = _master.recordId;
|
|
1776
|
+
const fields = ${JSON.stringify(uiSchema.fields)};
|
|
1777
|
+
const relatedField = fields[relatedKey];
|
|
1778
|
+
let defaultData = {};
|
|
1779
|
+
let relatedKeyValue;
|
|
1780
|
+
if(!_.isString(relatedField.reference_to)){
|
|
1781
|
+
relatedKeyValue = { o: masterObjectName, ids: [recordId] };
|
|
1782
|
+
}else if (relatedField.multiple) {
|
|
1783
|
+
relatedKeyValue = [recordId];
|
|
1784
|
+
} else {
|
|
1785
|
+
relatedKeyValue = recordId;
|
|
1786
|
+
}
|
|
1787
|
+
defaultData[relatedKey]=relatedKeyValue;
|
|
1788
|
+
if(payload.schema){
|
|
1789
|
+
// 表单微页面第一层要求是page
|
|
1790
|
+
formSchema.data.defaultData = defaultData;
|
|
1791
|
+
}else{
|
|
1792
|
+
formSchema.defaultData = defaultData;
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1774
1796
|
return {
|
|
1775
1797
|
data: formSchema
|
|
1776
1798
|
};
|
|
@@ -1794,6 +1816,8 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
1794
1816
|
"data": {
|
|
1795
1817
|
"$master": "$$",
|
|
1796
1818
|
"_master": "${_master}",
|
|
1819
|
+
"_master._isRelated": "${_isRelated}",
|
|
1820
|
+
"_master.relatedKey": "${relatedKey}",
|
|
1797
1821
|
"defaultData": "${defaultData}",
|
|
1798
1822
|
"appId": "${appId}",
|
|
1799
1823
|
"objectName": "${objectName}",
|
|
@@ -1812,7 +1836,8 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
1812
1836
|
"messages": {},
|
|
1813
1837
|
"schemaApi": {
|
|
1814
1838
|
"data": {
|
|
1815
|
-
"isLookup": "${isLookup}"
|
|
1839
|
+
"isLookup": "${isLookup}",
|
|
1840
|
+
"_master": "${_master}"
|
|
1816
1841
|
},
|
|
1817
1842
|
"url": "${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}",
|
|
1818
1843
|
"method": "get",
|
|
@@ -2333,7 +2358,7 @@ const StandardButtons = {
|
|
|
2333
2358
|
getStandardNew: async (uiSchema, ctx)=>{
|
|
2334
2359
|
return {
|
|
2335
2360
|
type: 'amis_button',
|
|
2336
|
-
amis_schema: await getSchema$4()
|
|
2361
|
+
amis_schema: await getSchema$4(uiSchema)
|
|
2337
2362
|
}
|
|
2338
2363
|
},
|
|
2339
2364
|
getStandardEdit: async (uiSchema, ctx)=>{
|
|
@@ -2417,7 +2442,7 @@ function getButtonVisibleOn$1(button){
|
|
|
2417
2442
|
if(visible.trim().startsWith('function')){
|
|
2418
2443
|
return `${visible}.apply({
|
|
2419
2444
|
object: uiSchema
|
|
2420
|
-
}, [objectName, _id, typeof record === 'undefined' ? (typeof recordPermissions === 'undefined' ? {} : recordPermissions) : record.recordPermissions, data])`
|
|
2445
|
+
}, [objectName, typeof _id === 'undefined' ? null: _id, typeof record === 'undefined' ? (typeof recordPermissions === 'undefined' ? {} : recordPermissions) : record.recordPermissions, data])`
|
|
2421
2446
|
}
|
|
2422
2447
|
return visible;
|
|
2423
2448
|
}
|
|
@@ -3547,9 +3572,8 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
3547
3572
|
|
|
3548
3573
|
let body = [
|
|
3549
3574
|
{
|
|
3550
|
-
"type": "
|
|
3551
|
-
"
|
|
3552
|
-
data: { "&":"$$", objectName: name, _id: recordId, recordPermissions: "${record.recordPermissions}", uiSchema: objectSchema},
|
|
3575
|
+
"type": "wrapper",
|
|
3576
|
+
"className": "p-0",
|
|
3553
3577
|
"body": [
|
|
3554
3578
|
{
|
|
3555
3579
|
"type": "grid",
|
|
@@ -3557,14 +3581,14 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
3557
3581
|
"className": "flex justify-between"
|
|
3558
3582
|
}
|
|
3559
3583
|
],
|
|
3560
|
-
"messages": {},
|
|
3561
3584
|
"hiddenOn": "${recordLoaded != true}"
|
|
3562
3585
|
}
|
|
3563
3586
|
];
|
|
3564
3587
|
|
|
3565
3588
|
if(showRecordTitle){
|
|
3566
3589
|
body.push({
|
|
3567
|
-
"type": "
|
|
3590
|
+
"type": "wrapper",
|
|
3591
|
+
"className": "p-0",
|
|
3568
3592
|
"body": [
|
|
3569
3593
|
{
|
|
3570
3594
|
"type": "grid",
|
|
@@ -3572,16 +3596,15 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
3572
3596
|
"className": "flex justify-between"
|
|
3573
3597
|
}
|
|
3574
3598
|
],
|
|
3575
|
-
"messages": {},
|
|
3576
3599
|
"hiddenOn": "${recordLoaded == true}"
|
|
3577
3600
|
});
|
|
3578
3601
|
}
|
|
3579
3602
|
|
|
3580
3603
|
return {
|
|
3581
3604
|
type: 'service',
|
|
3582
|
-
|
|
3605
|
+
id: `page_readonly_${name}_header`,
|
|
3583
3606
|
name: `page`,
|
|
3584
|
-
data: {
|
|
3607
|
+
data: { objectName: name, _id: recordId, recordPermissions: objectSchema.permissions, uiSchema: objectSchema, record: "${record}" },
|
|
3585
3608
|
body: body,
|
|
3586
3609
|
className: ''
|
|
3587
3610
|
}
|
|
@@ -3636,7 +3659,7 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
3636
3659
|
"body": [
|
|
3637
3660
|
{
|
|
3638
3661
|
"type": "tpl",
|
|
3639
|
-
"tpl": `<a class="text-black text-base font-bold" href="/app/\${appId}/\${
|
|
3662
|
+
"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>`,
|
|
3640
3663
|
"inline": false,
|
|
3641
3664
|
"wrapperComponent": "",
|
|
3642
3665
|
"className": "",
|
|
@@ -3677,17 +3700,22 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
3677
3700
|
async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
|
|
3678
3701
|
}
|
|
3679
3702
|
|
|
3680
|
-
const getDisplayAsButton = function(showDisplayAs){
|
|
3703
|
+
const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
3704
|
+
let displayAs = Router$1.getTabDisplayAs(objectName);
|
|
3681
3705
|
let buttons = [
|
|
3682
3706
|
{
|
|
3683
3707
|
"type": "button",
|
|
3684
3708
|
"label": "表格",
|
|
3685
|
-
"onClick": "
|
|
3709
|
+
"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');",
|
|
3710
|
+
"rightIcon": displayAs != 'split' ? "fa fa-check" : null,
|
|
3711
|
+
"rightIconClassName": "m-l-sm"
|
|
3686
3712
|
},
|
|
3687
3713
|
{
|
|
3688
3714
|
"type": "button",
|
|
3689
3715
|
"label": "分栏视图",
|
|
3690
|
-
"onClick": "const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);"
|
|
3716
|
+
"onClick": "const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
|
|
3717
|
+
"rightIcon": displayAs === 'split' ? "fa fa-check" : null,
|
|
3718
|
+
"rightIconClassName": "m-l-sm"
|
|
3691
3719
|
}
|
|
3692
3720
|
];
|
|
3693
3721
|
return {
|
|
@@ -3829,7 +3857,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3829
3857
|
}
|
|
3830
3858
|
}
|
|
3831
3859
|
},
|
|
3832
|
-
showDisplayAs? getDisplayAsButton() : {}
|
|
3860
|
+
showDisplayAs? getDisplayAsButton(mainObject?.name) : {}
|
|
3833
3861
|
]
|
|
3834
3862
|
}else {
|
|
3835
3863
|
return [
|
|
@@ -3910,7 +3938,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3910
3938
|
}
|
|
3911
3939
|
}
|
|
3912
3940
|
},
|
|
3913
|
-
showDisplayAs? getDisplayAsButton() : {}
|
|
3941
|
+
showDisplayAs? getDisplayAsButton(showDisplayAs) : {}
|
|
3914
3942
|
// {
|
|
3915
3943
|
// "type": "search-box",
|
|
3916
3944
|
// "align": "right",
|
|
@@ -4189,6 +4217,90 @@ const getReferenceTo = async (field)=>{
|
|
|
4189
4217
|
}
|
|
4190
4218
|
};
|
|
4191
4219
|
|
|
4220
|
+
function getLookupSapceUserTreeSchema(){
|
|
4221
|
+
const tree = [{
|
|
4222
|
+
"type": "input-tree",
|
|
4223
|
+
"className": "",
|
|
4224
|
+
"id": "u:7fd77b7915b0",
|
|
4225
|
+
"source": {
|
|
4226
|
+
"method": "post",
|
|
4227
|
+
"url": "${context.rootUrl}/graphql",
|
|
4228
|
+
"headers": {
|
|
4229
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4230
|
+
},
|
|
4231
|
+
"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 ",
|
|
4232
|
+
"requestAdaptor": "\n ",
|
|
4233
|
+
"data": {
|
|
4234
|
+
"query": "{options:organizations(filters:[\"hidden\", \"!=\", true],sort:\"sort_no desc\"){value:_id label:name,parent,children}}"
|
|
4235
|
+
},
|
|
4236
|
+
"messages": {
|
|
4237
|
+
},
|
|
4238
|
+
"cache": 300000
|
|
4239
|
+
},
|
|
4240
|
+
"onEvent": {
|
|
4241
|
+
"change": {
|
|
4242
|
+
"actions": [
|
|
4243
|
+
{
|
|
4244
|
+
"actionType": "custom",
|
|
4245
|
+
"script": `
|
|
4246
|
+
debugger;
|
|
4247
|
+
const scope = event.context.scoped;
|
|
4248
|
+
//TODO: 将form中的value一同加入筛选内
|
|
4249
|
+
// var filterForm = scope.parent.parent.getComponents().find(function(n){
|
|
4250
|
+
// return n.props.type === "form";
|
|
4251
|
+
// });
|
|
4252
|
+
// var filterFormValues = filterForm.getValues();
|
|
4253
|
+
filterFormValues={
|
|
4254
|
+
"__searchable__organizations_parents":event.data.value.value
|
|
4255
|
+
}
|
|
4256
|
+
var listView = scope.parent.getComponents().find(function(n){
|
|
4257
|
+
return n.props.type === "crud";
|
|
4258
|
+
});
|
|
4259
|
+
const removedValues = {};
|
|
4260
|
+
// for(var k in filterFormValues){
|
|
4261
|
+
// if(filterFormValues[k] === "" && !filterFormValues.hasOwnProperty(k)){
|
|
4262
|
+
// removedValues[k] = "";
|
|
4263
|
+
// }
|
|
4264
|
+
// }
|
|
4265
|
+
listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
|
|
4266
|
+
`
|
|
4267
|
+
}
|
|
4268
|
+
]
|
|
4269
|
+
}
|
|
4270
|
+
},
|
|
4271
|
+
"label": "",
|
|
4272
|
+
"name": "organizations",
|
|
4273
|
+
"multiple": false,
|
|
4274
|
+
"joinValues": false,
|
|
4275
|
+
"clearValueOnHidden": false,
|
|
4276
|
+
"fieldName": "organizations",
|
|
4277
|
+
"hideRoot": true,
|
|
4278
|
+
"initiallyOpen": false,
|
|
4279
|
+
"extractValue": true,
|
|
4280
|
+
"onlyChildren": true,
|
|
4281
|
+
"treeContainerClassName": "no-border",
|
|
4282
|
+
"showIcon": false,
|
|
4283
|
+
"enableNodePath": false,
|
|
4284
|
+
"autoCheckChildren": false,
|
|
4285
|
+
"searchable": true,
|
|
4286
|
+
"searchConfig": {
|
|
4287
|
+
"sticky": true
|
|
4288
|
+
},
|
|
4289
|
+
"unfoldedLevel": 2,
|
|
4290
|
+
"style": {
|
|
4291
|
+
"max-height": "100%",
|
|
4292
|
+
"position": "absolute",
|
|
4293
|
+
"left": "-190px",
|
|
4294
|
+
"width": "190px",
|
|
4295
|
+
"bottom": 0,
|
|
4296
|
+
"top": "0",
|
|
4297
|
+
"overflow": "auto",
|
|
4298
|
+
"min-height":"300px"
|
|
4299
|
+
},
|
|
4300
|
+
"originPosition": "left-top"
|
|
4301
|
+
}];
|
|
4302
|
+
return tree;
|
|
4303
|
+
}
|
|
4192
4304
|
|
|
4193
4305
|
async function lookupToAmisPicker(field, readonly, ctx){
|
|
4194
4306
|
let referenceTo = await getReferenceTo(field);
|
|
@@ -4431,7 +4543,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
4431
4543
|
...ctx
|
|
4432
4544
|
});
|
|
4433
4545
|
|
|
4434
|
-
|
|
4546
|
+
var headerToolbarItems = [];
|
|
4547
|
+
const isMobile = window.innerWidth < 768;
|
|
4548
|
+
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && !isMobile){
|
|
4549
|
+
headerToolbarItems = getLookupSapceUserTreeSchema();
|
|
4550
|
+
pickerSchema["style"] = {
|
|
4551
|
+
"margin-left":"200px",
|
|
4552
|
+
"min-height": "300px"
|
|
4553
|
+
};
|
|
4554
|
+
}
|
|
4555
|
+
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, ctx.formFactor, { headerToolbarItems });
|
|
4435
4556
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
4436
4557
|
if (isAllowCreate) {
|
|
4437
4558
|
const new_button = await getSchema$4(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
@@ -4439,15 +4560,18 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
4439
4560
|
pickerSchema.headerToolbar.push(new_button);
|
|
4440
4561
|
}
|
|
4441
4562
|
pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar();
|
|
4442
|
-
if
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4563
|
+
//TODO: 等待放大镜bug修复,if会去掉,始终显示放大镜
|
|
4564
|
+
if(referenceTo.objectName != "space_users" || field.reference_to_field != "user"){
|
|
4565
|
+
if (ctx.filterVisible !== false) {
|
|
4566
|
+
let filterLoopCount = ctx.filterLoopCount || 0;
|
|
4567
|
+
filterLoopCount++;
|
|
4568
|
+
// 可以传入filterVisible为false防止死循环
|
|
4569
|
+
pickerSchema.filter = await getObjectFilter(refObjectConfig, fields, {
|
|
4570
|
+
isLookup: true,
|
|
4571
|
+
...ctx,
|
|
4572
|
+
filterLoopCount,
|
|
4573
|
+
});
|
|
4574
|
+
}
|
|
4451
4575
|
}
|
|
4452
4576
|
pickerSchema.data = Object.assign({}, pickerSchema.data, {
|
|
4453
4577
|
"&": "$$",
|
|
@@ -4695,7 +4819,7 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
4695
4819
|
if(ctx.idsDependOn || field.amis){
|
|
4696
4820
|
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
4697
4821
|
}
|
|
4698
|
-
return await lookupToAmisSelectUser(field, readonly, ctx);
|
|
4822
|
+
// return await lookupToAmisSelectUser(field, readonly, ctx);
|
|
4699
4823
|
}
|
|
4700
4824
|
|
|
4701
4825
|
const refObject = await getUISchema(referenceTo.objectName);
|
|
@@ -5676,8 +5800,9 @@ function getReadonlyFormAdaptor(fields){
|
|
|
5676
5800
|
async function getReadonlyFormInitApi(object, recordId, fields, options){
|
|
5677
5801
|
return {
|
|
5678
5802
|
method: "post",
|
|
5679
|
-
url: getApi$2()+"
|
|
5803
|
+
url: getApi$2()+"&recordId=${recordId}",
|
|
5680
5804
|
cache: API_CACHE,
|
|
5805
|
+
// requestAdaptor: "console.log('getReadonlyFormInitApi requestAdaptor', api);return api;",
|
|
5681
5806
|
adaptor: getReadonlyFormAdaptor(fields),
|
|
5682
5807
|
data: await getFindOneQuery$1(object, recordId, fields, options),
|
|
5683
5808
|
headers: {
|
|
@@ -5784,6 +5909,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
5784
5909
|
data.global = "${global}";
|
|
5785
5910
|
data.context = "${context}";
|
|
5786
5911
|
data.defaultData = "${defaultData}";
|
|
5912
|
+
|
|
5787
5913
|
return {
|
|
5788
5914
|
method: "post",
|
|
5789
5915
|
url: getApi$2(),
|
|
@@ -6152,7 +6278,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
6152
6278
|
keepItemSelectionOnPageChange: true,
|
|
6153
6279
|
api: await getTableApi(objectSchema, fields, options),
|
|
6154
6280
|
hiddenOn: options.tableHiddenOn,
|
|
6155
|
-
autoFillHeight: true,
|
|
6281
|
+
autoFillHeight: options.isRelated ? false : true,
|
|
6156
6282
|
className: `flex-auto ${crudClassName || ""}`,
|
|
6157
6283
|
crudClassName: crudClassName,
|
|
6158
6284
|
},
|
|
@@ -6195,11 +6321,11 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
6195
6321
|
id: `service_${id}`,
|
|
6196
6322
|
name: `page`,
|
|
6197
6323
|
data: {
|
|
6198
|
-
objectName: objectSchema.name,
|
|
6199
|
-
_id: null,
|
|
6324
|
+
// objectName: objectSchema.name,
|
|
6325
|
+
// _id: null,
|
|
6200
6326
|
recordPermissions: objectSchema.permissions,
|
|
6201
6327
|
uiSchema: objectSchema,
|
|
6202
|
-
loaded: false //crud接收适配器中设置为true,否则就是刷新浏览器第一次加载
|
|
6328
|
+
// loaded: false //crud接收适配器中设置为true,否则就是刷新浏览器第一次加载
|
|
6203
6329
|
},
|
|
6204
6330
|
body: body
|
|
6205
6331
|
}
|
|
@@ -6312,6 +6438,10 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
6312
6438
|
"objectName": "${_master.objectName}"
|
|
6313
6439
|
},
|
|
6314
6440
|
"expression": `\${_master.objectName != '${objectSchema.name}' && _master.objectName}`
|
|
6441
|
+
},
|
|
6442
|
+
{
|
|
6443
|
+
"args": {},
|
|
6444
|
+
"actionType": "closeDialog"
|
|
6315
6445
|
}
|
|
6316
6446
|
]
|
|
6317
6447
|
}
|
|
@@ -6658,7 +6788,7 @@ function getButtonVisibleOn(button){
|
|
|
6658
6788
|
// return 'false';
|
|
6659
6789
|
// }
|
|
6660
6790
|
if(visible.trim().startsWith('function')){
|
|
6661
|
-
return `${visible}(objectName, _id, typeof record === 'undefined' ? (typeof recordPermissions === 'undefined' ? {} : recordPermissions) : record.recordPermissions, data)`
|
|
6791
|
+
return `${visible}(objectName, typeof _id === 'undefined' ? null: _id, typeof record === 'undefined' ? (typeof recordPermissions === 'undefined' ? {} : recordPermissions) : record.recordPermissions, data)`
|
|
6662
6792
|
}
|
|
6663
6793
|
return visible;
|
|
6664
6794
|
}
|
|
@@ -6823,6 +6953,11 @@ async function getTableApi(mainObject, fields, options){
|
|
|
6823
6953
|
|
|
6824
6954
|
let valueField = mainObject.key_field || '_id';
|
|
6825
6955
|
const api = await getApi(mainObject, null, fields, {count: options.queryCount, alias: 'rows', limit: top, queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
|
|
6956
|
+
|
|
6957
|
+
if(options.isRelated){
|
|
6958
|
+
api.url += "&recordId=${recordId}";
|
|
6959
|
+
}
|
|
6960
|
+
|
|
6826
6961
|
api.data.$term = "$term";
|
|
6827
6962
|
api.data.$self = "$$";
|
|
6828
6963
|
api.data.filter = "$filter";
|
|
@@ -6942,11 +7077,36 @@ async function getTableApi(mainObject, fields, options){
|
|
|
6942
7077
|
if(!_.isEmpty(systemFilters)){
|
|
6943
7078
|
filters = systemFilters;
|
|
6944
7079
|
};
|
|
6945
|
-
|
|
6946
7080
|
if(api.data.$self.additionalFilters){
|
|
6947
7081
|
userFilters.push(api.data.$self.additionalFilters)
|
|
6948
7082
|
}
|
|
6949
7083
|
|
|
7084
|
+
if(api.data.$self._isRelated){
|
|
7085
|
+
const self = api.data.$self;
|
|
7086
|
+
const relatedKey = self.relatedKey;
|
|
7087
|
+
const recordId = self.recordId;
|
|
7088
|
+
const refField = self.uiSchema.fields[relatedKey];
|
|
7089
|
+
const masterRecord = self._master.record;
|
|
7090
|
+
const masterObjectName = self._master.objectName;
|
|
7091
|
+
let relatedValue = recordId;
|
|
7092
|
+
if(refField.reference_to_field && refField.reference_to_field != '_id'){
|
|
7093
|
+
relatedValue = masterRecord[refField.reference_to_field]
|
|
7094
|
+
}
|
|
7095
|
+
let relatedFilters;
|
|
7096
|
+
if (
|
|
7097
|
+
refField._reference_to ||
|
|
7098
|
+
(refField.reference_to && !_.isString(refField.reference_to))
|
|
7099
|
+
) {
|
|
7100
|
+
relatedFilters = [
|
|
7101
|
+
[relatedKey + "/o", "=", masterObjectName],
|
|
7102
|
+
[relatedKey + "/ids", "=", relatedValue],
|
|
7103
|
+
];
|
|
7104
|
+
} else {
|
|
7105
|
+
relatedFilters = [relatedKey, "=", relatedValue];
|
|
7106
|
+
}
|
|
7107
|
+
userFilters.push(relatedFilters)
|
|
7108
|
+
}
|
|
7109
|
+
|
|
6950
7110
|
if(!_.isEmpty(userFilters)){
|
|
6951
7111
|
if(_.isEmpty(filters)){
|
|
6952
7112
|
filters = userFilters;
|
|
@@ -7069,7 +7229,7 @@ async function getApi(object, recordId, fields, options){
|
|
|
7069
7229
|
const data = await getFindQuery(object, recordId, fields, options);
|
|
7070
7230
|
return {
|
|
7071
7231
|
method: "post",
|
|
7072
|
-
url: getApi$2(),
|
|
7232
|
+
url: getApi$2(), // + "&recordId=${recordId}"
|
|
7073
7233
|
data: data,
|
|
7074
7234
|
headers: {
|
|
7075
7235
|
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
@@ -7703,8 +7863,8 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
7703
7863
|
/*
|
|
7704
7864
|
* @Author: baozhoutao@steedos.com
|
|
7705
7865
|
* @Date: 2022-07-05 15:55:39
|
|
7706
|
-
* @LastEditors:
|
|
7707
|
-
* @LastEditTime: 2023-
|
|
7866
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
7867
|
+
* @LastEditTime: 2023-04-08 18:14:55
|
|
7708
7868
|
* @Description:
|
|
7709
7869
|
*/
|
|
7710
7870
|
|
|
@@ -7776,7 +7936,7 @@ async function getObjectRelatedList(
|
|
|
7776
7936
|
|
|
7777
7937
|
// 获取单个相关表
|
|
7778
7938
|
async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObjectName, relatedKey, ctx){
|
|
7779
|
-
let { top, perPage,
|
|
7939
|
+
let { top, perPage, appId, relatedLabel, className, columns, sort, filters, visible_on } = ctx;
|
|
7780
7940
|
// console.log('getRecordDetailRelatedListSchema==>',objectName,recordId,relatedObjectName)
|
|
7781
7941
|
const relatedObjectUiSchema = await getUISchema(relatedObjectName);
|
|
7782
7942
|
if(!relatedObjectUiSchema){
|
|
@@ -7811,6 +7971,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
7811
7971
|
relatedKey = mainRelated[relatedObjectName];
|
|
7812
7972
|
}
|
|
7813
7973
|
let globalFilter = null;
|
|
7974
|
+
// TODO: refField变量去掉,写到amis运行时脚本中,uiSchema.fields[relatedKey];可以取到
|
|
7814
7975
|
const refField = await getField(relatedObjectName, relatedKey);
|
|
7815
7976
|
|
|
7816
7977
|
if(!refField){
|
|
@@ -7826,23 +7987,23 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
7826
7987
|
}
|
|
7827
7988
|
}
|
|
7828
7989
|
|
|
7829
|
-
let relatedValue = recordId;
|
|
7830
|
-
if(refField.reference_to_field && refField.reference_to_field != '_id'){
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
}
|
|
7990
|
+
let relatedValue = "${recordId}";
|
|
7991
|
+
// if(refField.reference_to_field && refField.reference_to_field != '_id'){
|
|
7992
|
+
// const masterRecord = await getRecord(objectName, recordId, [refField.reference_to_field]);
|
|
7993
|
+
// relatedValue = masterRecord[refField.reference_to_field]
|
|
7994
|
+
// }
|
|
7834
7995
|
|
|
7835
|
-
if (
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
) {
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
} else {
|
|
7844
|
-
|
|
7845
|
-
}
|
|
7996
|
+
// if (
|
|
7997
|
+
// refField._reference_to ||
|
|
7998
|
+
// (refField.reference_to && !isString(refField.reference_to))
|
|
7999
|
+
// ) {
|
|
8000
|
+
// globalFilter = [
|
|
8001
|
+
// [`${relatedKey}/o`, "=", objectName],
|
|
8002
|
+
// [`${relatedKey}/ids`, "=", relatedValue],
|
|
8003
|
+
// ];
|
|
8004
|
+
// } else {
|
|
8005
|
+
// globalFilter = [`${relatedKey}`, "=", relatedValue];
|
|
8006
|
+
// }
|
|
7846
8007
|
const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel);
|
|
7847
8008
|
const componentId = `steedos-record-related-list-${relatedObjectName}`;
|
|
7848
8009
|
const options = {
|
|
@@ -7867,9 +8028,9 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
7867
8028
|
top: top,
|
|
7868
8029
|
perPage: perPage,
|
|
7869
8030
|
setDataToComponentId: componentId,
|
|
7870
|
-
tableHiddenOn: hiddenEmptyTable ? "this.$count === 0" : null,
|
|
8031
|
+
// tableHiddenOn: hiddenEmptyTable ? "this.$count === 0" : null,
|
|
7871
8032
|
appId: appId,
|
|
7872
|
-
crudClassName: 'border-t border-slate-300',
|
|
8033
|
+
crudClassName: 'border-t border-slate-300 hidden',
|
|
7873
8034
|
...ctx
|
|
7874
8035
|
};
|
|
7875
8036
|
const amisSchema= (await getRelatedListSchema(relatedObjectName, 'all', options)).amisSchema;
|
|
@@ -7881,15 +8042,9 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
7881
8042
|
amisSchema: {
|
|
7882
8043
|
type: "service",
|
|
7883
8044
|
id: componentId,
|
|
7884
|
-
className: `steedos-record-related-list rounded border border-slate-300 bg-gray-100 mb-4 ${className}`,
|
|
8045
|
+
className: `steedos-record-related-list ${componentId} rounded border border-slate-300 bg-gray-100 mb-4 ${className}`,
|
|
7885
8046
|
data: {
|
|
7886
|
-
"&": "$$",
|
|
7887
|
-
appId: "${appId}",
|
|
7888
|
-
app_id: "${appId}",
|
|
7889
|
-
masterObjectName: objectName,
|
|
7890
|
-
masterRecordId: "${recordId}",
|
|
7891
8047
|
relatedKey: relatedKey,
|
|
7892
|
-
objectName: relatedObjectName,
|
|
7893
8048
|
listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
|
|
7894
8049
|
_isRelated: true
|
|
7895
8050
|
},
|
|
@@ -7897,12 +8052,6 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
7897
8052
|
{
|
|
7898
8053
|
...amisSchema,
|
|
7899
8054
|
data: {
|
|
7900
|
-
"&": "$$",
|
|
7901
|
-
appId: "${appId}",
|
|
7902
|
-
app_id: "${appId}",
|
|
7903
|
-
relatedKey: relatedKey,
|
|
7904
|
-
objectName: "${objectName}",
|
|
7905
|
-
recordId: "${masterRecordId}",
|
|
7906
8055
|
defaultData: {
|
|
7907
8056
|
...{[relatedKey]: getRelatedFieldValue(objectName, relatedValue, relatedObjectUiSchema, relatedKey)}
|
|
7908
8057
|
}
|
|
@@ -7946,13 +8095,13 @@ function getDefaultRelatedListProps(uiSchema, listName, ctx) {
|
|
|
7946
8095
|
columns = getListViewColumns(listView, ctx.formFactor);
|
|
7947
8096
|
sort = getListViewSort(listView);
|
|
7948
8097
|
filter = getListViewFilter(listView);
|
|
7949
|
-
if(
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
}else if(ctx.globalFilter && (!filter || !filter.length)){
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
}
|
|
8098
|
+
// if(isArray(ctx.globalFilter) && ctx.globalFilter.length && isArray(filter) && filter.length){
|
|
8099
|
+
// // 都有值
|
|
8100
|
+
// filter = [ctx.globalFilter, 'and', filter]
|
|
8101
|
+
// }else if(ctx.globalFilter && (!filter || !filter.length)){
|
|
8102
|
+
// // globalFilter有值,filter无值
|
|
8103
|
+
// filter = ctx.globalFilter;
|
|
8104
|
+
// }
|
|
7956
8105
|
filtersFunction = listView && listView._filters;
|
|
7957
8106
|
}else {
|
|
7958
8107
|
const isNameField = ___default.find(
|
|
@@ -7962,9 +8111,9 @@ function getDefaultRelatedListProps(uiSchema, listName, ctx) {
|
|
|
7962
8111
|
}
|
|
7963
8112
|
);
|
|
7964
8113
|
columns = isNameField ? [isNameField.name] : ['name'];
|
|
7965
|
-
if(ctx.globalFilter){
|
|
7966
|
-
|
|
7967
|
-
}
|
|
8114
|
+
// if(ctx.globalFilter){
|
|
8115
|
+
// filter = ctx.globalFilter;
|
|
8116
|
+
// }
|
|
7968
8117
|
}
|
|
7969
8118
|
|
|
7970
8119
|
return {
|
|
@@ -7988,7 +8137,7 @@ function getRelatedListProps(uiSchema, listViewName, ctx) {
|
|
|
7988
8137
|
return {
|
|
7989
8138
|
columns: ctx.columns,
|
|
7990
8139
|
sort,
|
|
7991
|
-
filter: ctx.globalFilter,
|
|
8140
|
+
// filter: ctx.globalFilter,
|
|
7992
8141
|
filtersFunction: filtersFunction
|
|
7993
8142
|
}
|
|
7994
8143
|
} else {
|
|
@@ -8027,6 +8176,16 @@ async function getRelatedListSchema(
|
|
|
8027
8176
|
delete ctx.filters;
|
|
8028
8177
|
|
|
8029
8178
|
delete ctx.globalFilter;
|
|
8179
|
+
|
|
8180
|
+
const adaptor = `
|
|
8181
|
+
if(setDataToComponentId){
|
|
8182
|
+
if(payload.data.count){
|
|
8183
|
+
setTimeout(function(){
|
|
8184
|
+
window.$("." + setDataToComponentId + " .antd-Crud").removeClass("hidden");
|
|
8185
|
+
}, 10);
|
|
8186
|
+
}
|
|
8187
|
+
};
|
|
8188
|
+
`;
|
|
8030
8189
|
const amisSchema = {
|
|
8031
8190
|
"type": "steedos-object-table",
|
|
8032
8191
|
"objectApiName": objectName,
|
|
@@ -8035,6 +8194,8 @@ async function getRelatedListSchema(
|
|
|
8035
8194
|
"filters": listviewFilter,
|
|
8036
8195
|
"filtersFunction": filtersFunction,
|
|
8037
8196
|
"sort": listViewSort,
|
|
8197
|
+
"filterVisible": false,
|
|
8198
|
+
adaptor,
|
|
8038
8199
|
"ctx": ctx
|
|
8039
8200
|
};
|
|
8040
8201
|
// console.log(`getRelatedListSchema amisSchema`, amisSchema);
|
|
@@ -8047,8 +8208,8 @@ async function getRelatedListSchema(
|
|
|
8047
8208
|
/*
|
|
8048
8209
|
* @Author: baozhoutao@steedos.com
|
|
8049
8210
|
* @Date: 2022-07-05 15:55:39
|
|
8050
|
-
* @LastEditors:
|
|
8051
|
-
* @LastEditTime: 2023-
|
|
8211
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
8212
|
+
* @LastEditTime: 2023-04-08 17:31:57
|
|
8052
8213
|
* @Description:
|
|
8053
8214
|
*/
|
|
8054
8215
|
|
|
@@ -8220,14 +8381,14 @@ async function getField(objectName, fieldName) {
|
|
|
8220
8381
|
async function getFormSchema(objectName, ctx) {
|
|
8221
8382
|
const uiSchema = await getUISchema(objectName);
|
|
8222
8383
|
const amisSchema = await getObjectForm(uiSchema, ctx);
|
|
8223
|
-
|
|
8384
|
+
console.log(`getFormSchema====>`, amisSchema);
|
|
8224
8385
|
return {
|
|
8225
8386
|
uiSchema,
|
|
8226
8387
|
amisSchema,
|
|
8227
8388
|
};
|
|
8228
8389
|
}
|
|
8229
8390
|
|
|
8230
|
-
// 获取只读页面
|
|
8391
|
+
// 获取只读页面 recordId 已废弃, 函数签名保持不变, 但recordId变量不可再使用, 请使用运行时的${recordId}
|
|
8231
8392
|
async function getViewSchema(objectName, recordId, ctx) {
|
|
8232
8393
|
const uiSchema = await getUISchema(objectName);
|
|
8233
8394
|
const amisSchema = await getObjectDetail(uiSchema, recordId, ctx);
|
|
@@ -8412,6 +8573,7 @@ async function getTableSchema(
|
|
|
8412
8573
|
headerToolbarItems: ctx.headerToolbarItems,
|
|
8413
8574
|
buttons: await getListViewItemButtons(uiSchema, ctx)
|
|
8414
8575
|
});
|
|
8576
|
+
// console.log('getTableSchema====>amisSchema', amisSchema)
|
|
8415
8577
|
return {
|
|
8416
8578
|
uiSchema,
|
|
8417
8579
|
amisSchema,
|
|
@@ -8510,15 +8672,8 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
8510
8672
|
"data": {
|
|
8511
8673
|
"name": `\${event.data.record.${uiSchema?.NAME_FIELD_KEY || 'name'}}`,
|
|
8512
8674
|
"record": `\${event.data.record}`,
|
|
8513
|
-
"
|
|
8514
|
-
|
|
8515
|
-
},
|
|
8516
|
-
{
|
|
8517
|
-
"actionType": "reload",
|
|
8518
|
-
"componentId": `page_readonly_${objectName}_header`, //刷新标题, 详细页面header service 嵌套太多, 导致仅刷新第一层service无法更新recordName
|
|
8519
|
-
"data": {
|
|
8520
|
-
"name": `\${event.data.record.${uiSchema?.NAME_FIELD_KEY || 'name'}}`,
|
|
8521
|
-
"record": `\${event.data.record}`,
|
|
8675
|
+
"_id": "\${event.data.record._id}",
|
|
8676
|
+
"recordId": "\${event.data.record._id}",
|
|
8522
8677
|
"recordLoaded": true,
|
|
8523
8678
|
}
|
|
8524
8679
|
}
|
|
@@ -8528,10 +8683,10 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
8528
8683
|
},
|
|
8529
8684
|
content
|
|
8530
8685
|
],
|
|
8531
|
-
data: {
|
|
8532
|
-
|
|
8533
|
-
|
|
8534
|
-
},
|
|
8686
|
+
// data: {
|
|
8687
|
+
// "_master.objectName": "${objectName}",
|
|
8688
|
+
// "_master.recordId": "${recordId}"
|
|
8689
|
+
// },
|
|
8535
8690
|
onEvent: {
|
|
8536
8691
|
"recordLoaded": {
|
|
8537
8692
|
"actions": [
|
|
@@ -8539,10 +8694,10 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
8539
8694
|
"actionType": "reload",
|
|
8540
8695
|
"data": {
|
|
8541
8696
|
"name": `\${record.${uiSchema.NAME_FIELD_KEY || 'name'}}`,
|
|
8542
|
-
"_master.record": `\${record}`,
|
|
8543
|
-
// 不清楚reload 如何给对象下的某个key复制, 所以此处重复设置_master的objectName、recordId
|
|
8544
|
-
"_master.objectName": "${objectName}",
|
|
8545
|
-
"_master.recordId": "${recordId}"
|
|
8697
|
+
// "_master.record": `\${record}`,
|
|
8698
|
+
// // 不清楚reload 如何给对象下的某个key复制, 所以此处重复设置_master的objectName、recordId
|
|
8699
|
+
// "_master.objectName": "${objectName}",
|
|
8700
|
+
// "_master.recordId": "${recordId}"
|
|
8546
8701
|
}
|
|
8547
8702
|
}
|
|
8548
8703
|
]
|
|
@@ -8553,51 +8708,6 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
8553
8708
|
}
|
|
8554
8709
|
}
|
|
8555
8710
|
|
|
8556
|
-
// export async function getRecordDetailRelatedListSchema(objectName,recordId,relatedObjectName){
|
|
8557
|
-
// // console.log('b==>',objectName,recordId,relatedObjectName)
|
|
8558
|
-
// const relatedObjectUiSchema = await getUISchema(relatedObjectName);
|
|
8559
|
-
// const { list_views, label , icon, fields } = relatedObjectUiSchema;
|
|
8560
|
-
// const firstListViewName = keys(list_views)[0];
|
|
8561
|
-
// const relatedKey = findKey(fields, function(field) {
|
|
8562
|
-
// return ["lookup","master_detail"].indexOf(field.type) > -1 && field.reference_to === objectName;
|
|
8563
|
-
// });
|
|
8564
|
-
// const globalFilter = [relatedKey,'=',recordId];
|
|
8565
|
-
// const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema);
|
|
8566
|
-
// const options = {
|
|
8567
|
-
// globalFilter,
|
|
8568
|
-
// defaults: {
|
|
8569
|
-
// listSchema: { headerToolbar:[],columnsTogglable:false },
|
|
8570
|
-
// headerSchema: recordRelatedListHeader
|
|
8571
|
-
// },
|
|
8572
|
-
// showHeader: true
|
|
8573
|
-
// }
|
|
8574
|
-
// const amisSchema= (await getListSchema(null, relatedObjectName, firstListViewName, options)).amisSchema;
|
|
8575
|
-
// return {
|
|
8576
|
-
// uiSchema: relatedObjectUiSchema,
|
|
8577
|
-
// amisSchema: {
|
|
8578
|
-
// type: "service",
|
|
8579
|
-
// data: {
|
|
8580
|
-
// masterObjectName: objectName,
|
|
8581
|
-
// masterRecordId: "${recordId}",
|
|
8582
|
-
// relatedKey: relatedKey,
|
|
8583
|
-
// objectName: relatedObjectName,
|
|
8584
|
-
// listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
|
|
8585
|
-
// },
|
|
8586
|
-
// body:[
|
|
8587
|
-
// {
|
|
8588
|
-
// ...amisSchema,
|
|
8589
|
-
// data: {
|
|
8590
|
-
// filter: ["${relatedKey}", "=", "${masterRecordId}"],
|
|
8591
|
-
// objectName: "${objectName}",
|
|
8592
|
-
// recordId: "${masterRecordId}",
|
|
8593
|
-
// ...{[relatedKey]: getRelatedFieldValue(objectName, "${recordId}", relatedSchema.uiSchema, relatedKey)}
|
|
8594
|
-
// }
|
|
8595
|
-
// }
|
|
8596
|
-
// ]
|
|
8597
|
-
// }
|
|
8598
|
-
// };
|
|
8599
|
-
// }
|
|
8600
|
-
|
|
8601
8711
|
|
|
8602
8712
|
// 获取单个相关表
|
|
8603
8713
|
async function getObjectRelated(
|
|
@@ -11493,6 +11603,7 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
|
|
|
11493
11603
|
getListViewItemButtons: getListViewItemButtons,
|
|
11494
11604
|
getListViewSort: getListViewSort,
|
|
11495
11605
|
getListviewInitSchema: getListviewInitSchema,
|
|
11606
|
+
getLookupSapceUserTreeSchema: getLookupSapceUserTreeSchema,
|
|
11496
11607
|
getNotifications: getNotifications,
|
|
11497
11608
|
getObjectDetailButtons: getObjectDetailButtons,
|
|
11498
11609
|
getObjectDetailMoreButtons: getObjectDetailMoreButtons,
|
|
@@ -11758,7 +11869,13 @@ var AmisObjectButton = function (props) {
|
|
|
11758
11869
|
// if(className){
|
|
11759
11870
|
// schema.className = schema.className + ' ' + className;
|
|
11760
11871
|
// }
|
|
11761
|
-
var renderData = Object.assign(data, {
|
|
11872
|
+
var renderData = Object.assign(data, { objectName: objectName, app_id: appId, className: className });
|
|
11873
|
+
if (data._id) {
|
|
11874
|
+
renderData.recordId = data._id;
|
|
11875
|
+
}
|
|
11876
|
+
if (data.listViewId) {
|
|
11877
|
+
renderData.listViewId = data.listViewId;
|
|
11878
|
+
}
|
|
11762
11879
|
if (schema) {
|
|
11763
11880
|
schema.data = ___default.defaultsDeep({}, renderData, getDefaultRenderData(), schema.data);
|
|
11764
11881
|
}
|
|
@@ -11927,13 +12044,13 @@ var SteedosLoading = function (props) {
|
|
|
11927
12044
|
};
|
|
11928
12045
|
|
|
11929
12046
|
var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
11930
|
-
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;
|
|
12047
|
+
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;
|
|
11931
12048
|
return __generator(this, function (_d) {
|
|
11932
12049
|
switch (_d.label) {
|
|
11933
12050
|
case 0:
|
|
11934
|
-
$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;
|
|
12051
|
+
$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;
|
|
11935
12052
|
objectApiName = props.objectApiName || "space_users";
|
|
11936
|
-
schemaKeys = ___default.difference(___default.keys($schema), ["type", "mode", "layout"]);
|
|
12053
|
+
schemaKeys = ___default.difference(___default.keys($schema), ["type", "mode", "layout", "defaultData"]);
|
|
11937
12054
|
formSchema = ___default.pick(props, schemaKeys);
|
|
11938
12055
|
defaults = {
|
|
11939
12056
|
formSchema: formSchema
|
|
@@ -11966,17 +12083,12 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
11966
12083
|
case 1:
|
|
11967
12084
|
schema = _d.sent();
|
|
11968
12085
|
amisSchema = schema.amisSchema;
|
|
12086
|
+
if (defaultData) {
|
|
12087
|
+
amisSchema.data.defaultData = __assign$2({ "&": "${defaultData}" }, defaultData);
|
|
12088
|
+
}
|
|
11969
12089
|
uiSchema = schema.uiSchema;
|
|
11970
12090
|
return [3 /*break*/, 4];
|
|
11971
|
-
case 2:
|
|
11972
|
-
// formInitProps
|
|
11973
|
-
if (!recordId) {
|
|
11974
|
-
// 只读界面只返回一条记录
|
|
11975
|
-
options.formInitProps = {
|
|
11976
|
-
queryOptions: "top: 1"
|
|
11977
|
-
};
|
|
11978
|
-
}
|
|
11979
|
-
return [4 /*yield*/, getViewSchema(objectApiName, recordId, options)];
|
|
12091
|
+
case 2: return [4 /*yield*/, getViewSchema(objectApiName, recordId, options)];
|
|
11980
12092
|
case 3:
|
|
11981
12093
|
schema = _d.sent();
|
|
11982
12094
|
amisSchema = schema.amisSchema;
|
|
@@ -11984,13 +12096,13 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
11984
12096
|
_d.label = 4;
|
|
11985
12097
|
case 4:
|
|
11986
12098
|
formData = {};
|
|
11987
|
-
formData.recordId = recordId || null;
|
|
11988
|
-
if
|
|
11989
|
-
|
|
11990
|
-
}
|
|
12099
|
+
// formData.recordId = recordId || null;
|
|
12100
|
+
// if(objectApiName){
|
|
12101
|
+
// formData.objectName = objectApiName;
|
|
12102
|
+
// }
|
|
11991
12103
|
amisSchema.className = "steedos-object-form ".concat(className);
|
|
11992
|
-
amisSchema.data = Object.assign(
|
|
11993
|
-
// console.log(
|
|
12104
|
+
amisSchema.data = Object.assign(amisSchema.data, formData, { global: globalData, uiSchema: uiSchema });
|
|
12105
|
+
// console.log(`===AmisObjectForm=amisSchema==`, amisSchema)
|
|
11994
12106
|
return [2 /*return*/, amisSchema];
|
|
11995
12107
|
}
|
|
11996
12108
|
});
|
|
@@ -12117,7 +12229,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
12117
12229
|
]
|
|
12118
12230
|
}];
|
|
12119
12231
|
}
|
|
12120
|
-
serviceData = Object.assign({},
|
|
12232
|
+
serviceData = Object.assign({}, { listName: listName, uiSchema: uiSchema, showDisplayAs: showDisplayAs, displayAs: displayAs, recordPermissions: uiSchema.permissions, _id: null, $listviewId: listName });
|
|
12121
12233
|
return [2 /*return*/, {
|
|
12122
12234
|
"type": "service",
|
|
12123
12235
|
"body": body,
|
|
@@ -12155,11 +12267,11 @@ function getTableColumns(columns, includedFields, fieldsExtend) {
|
|
|
12155
12267
|
return tableColumns;
|
|
12156
12268
|
}
|
|
12157
12269
|
var AmisObjectTable = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
12158
|
-
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;
|
|
12159
|
-
return __generator(this, function (
|
|
12160
|
-
switch (
|
|
12270
|
+
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;
|
|
12271
|
+
return __generator(this, function (_d) {
|
|
12272
|
+
switch (_d.label) {
|
|
12161
12273
|
case 0:
|
|
12162
|
-
$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;
|
|
12274
|
+
$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;
|
|
12163
12275
|
ctx = props.ctx;
|
|
12164
12276
|
if (!ctx) {
|
|
12165
12277
|
ctx = {};
|
|
@@ -12193,11 +12305,12 @@ var AmisObjectTable = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
12193
12305
|
appId = (data === null || data === void 0 ? void 0 : data.appId) || (defaultData === null || defaultData === void 0 ? void 0 : defaultData.appId);
|
|
12194
12306
|
// ctx中值为undefined的属性不能保留,否则会导致 filters等被覆盖。
|
|
12195
12307
|
ctx = ___default.pickBy(ctx, function (value) { return value !== undefined; });
|
|
12196
|
-
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 }))];
|
|
12308
|
+
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 }))];
|
|
12197
12309
|
case 1:
|
|
12198
|
-
amisSchema = (
|
|
12310
|
+
amisSchema = (_d.sent()).amisSchema;
|
|
12199
12311
|
amisSchema.data = Object.assign({}, amisSchema.data, amisSchemaData);
|
|
12200
12312
|
amisSchema.className = "steedos-object-table h-full flex flex-col ".concat(className);
|
|
12313
|
+
// console.log(`AmisObjectTable===>amisSchema`, amisSchema)
|
|
12201
12314
|
return [2 /*return*/, amisSchema];
|
|
12202
12315
|
}
|
|
12203
12316
|
});
|
|
@@ -12306,16 +12419,17 @@ var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
12306
12419
|
}); };
|
|
12307
12420
|
|
|
12308
12421
|
var AmisRecordDetailRelatedList = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
12309
|
-
var objectApiName, recordId, relatedObjectApiName, relatedKey, top, perPage,
|
|
12422
|
+
var objectApiName, recordId, relatedObjectApiName, relatedKey, top, perPage, appId, relatedLabel, _a, className, columns, sort, filters, visible_on, formFactor, schema;
|
|
12310
12423
|
return __generator(this, function (_b) {
|
|
12311
12424
|
switch (_b.label) {
|
|
12312
12425
|
case 0:
|
|
12313
|
-
objectApiName = props.objectApiName, recordId = props.recordId, relatedObjectApiName = props.relatedObjectApiName, props.data, relatedKey = props.relatedKey, top = props.top, perPage = props.perPage,
|
|
12426
|
+
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;
|
|
12314
12427
|
formFactor = props.formFactor;
|
|
12315
12428
|
if (!formFactor) {
|
|
12316
12429
|
formFactor = window.innerWidth < 768 ? 'SMALL' : 'LARGE';
|
|
12317
12430
|
}
|
|
12318
|
-
if (!objectApiName || !relatedObjectApiName
|
|
12431
|
+
if (!objectApiName || !relatedObjectApiName) {
|
|
12432
|
+
// if(!objectApiName || !relatedObjectApiName || !recordId){
|
|
12319
12433
|
return [2 /*return*/, {
|
|
12320
12434
|
"type": "alert",
|
|
12321
12435
|
"body": "缺少父级对象、父级记录或相关列表对象属性",
|
|
@@ -12324,7 +12438,7 @@ var AmisRecordDetailRelatedList = function (props) { return __awaiter(void 0, vo
|
|
|
12324
12438
|
"className": "mb-3"
|
|
12325
12439
|
}];
|
|
12326
12440
|
}
|
|
12327
|
-
return [4 /*yield*/, getRecordDetailRelatedListSchema(objectApiName, recordId, relatedObjectApiName, relatedKey, { top: top, perPage: perPage,
|
|
12441
|
+
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 })];
|
|
12328
12442
|
case 1:
|
|
12329
12443
|
schema = (_b.sent()).amisSchema;
|
|
12330
12444
|
return [2 /*return*/, schema];
|
|
@@ -12333,12 +12447,13 @@ var AmisRecordDetailRelatedList = function (props) { return __awaiter(void 0, vo
|
|
|
12333
12447
|
}); };
|
|
12334
12448
|
|
|
12335
12449
|
var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
12336
|
-
var objectApiName,
|
|
12450
|
+
var objectApiName, _a, perPage, relatedLists;
|
|
12337
12451
|
return __generator(this, function (_b) {
|
|
12338
12452
|
switch (_b.label) {
|
|
12339
12453
|
case 0:
|
|
12340
|
-
objectApiName = props.objectApiName,
|
|
12341
|
-
if (!objectApiName
|
|
12454
|
+
objectApiName = props.objectApiName, props.recordId, props.data, _a = props.perPage, perPage = _a === void 0 ? 5 : _a;
|
|
12455
|
+
if (!objectApiName) {
|
|
12456
|
+
// if(!objectApiName || !recordId){
|
|
12342
12457
|
return [2 /*return*/, {
|
|
12343
12458
|
"type": "alert",
|
|
12344
12459
|
"body": "缺少父级对象或父级记录属性",
|
|
@@ -12367,7 +12482,7 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
|
|
|
12367
12482
|
return {
|
|
12368
12483
|
type: 'steedos-object-related-listview',
|
|
12369
12484
|
objectApiName: objectApiName,
|
|
12370
|
-
recordId: recordId,
|
|
12485
|
+
// recordId: recordId,
|
|
12371
12486
|
relatedObjectApiName: item.object_name,
|
|
12372
12487
|
foreign_key: item.foreign_key,
|
|
12373
12488
|
relatedKey: item.foreign_key,
|
|
@@ -13172,35 +13287,39 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
13172
13287
|
* @Author: baozhoutao@steedos.com
|
|
13173
13288
|
* @Date: 2023-01-14 16:41:24
|
|
13174
13289
|
* @LastEditors: baozhoutao@steedos.com
|
|
13175
|
-
* @LastEditTime: 2023-03-23
|
|
13290
|
+
* @LastEditTime: 2023-03-23 18:00:25
|
|
13176
13291
|
* @Description:
|
|
13177
13292
|
*/
|
|
13178
13293
|
var getSelectFlowSchema = function (id, props) {
|
|
13179
13294
|
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;
|
|
13180
|
-
|
|
13181
|
-
|
|
13182
|
-
|
|
13183
|
-
|
|
13184
|
-
|
|
13185
|
-
|
|
13186
|
-
|
|
13187
|
-
|
|
13188
|
-
|
|
13189
|
-
|
|
13190
|
-
|
|
13191
|
-
|
|
13192
|
-
|
|
13193
|
-
|
|
13194
|
-
|
|
13195
|
-
|
|
13196
|
-
|
|
13197
|
-
|
|
13198
|
-
|
|
13199
|
-
|
|
13200
|
-
|
|
13201
|
-
|
|
13202
|
-
|
|
13203
|
-
|
|
13295
|
+
console.log("=====onEvent", onEvent);
|
|
13296
|
+
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": {
|
|
13297
|
+
// type: "button",
|
|
13298
|
+
type: "tpl",
|
|
13299
|
+
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>",
|
|
13300
|
+
"onEvent": {
|
|
13301
|
+
"click": {
|
|
13302
|
+
"weight": 0,
|
|
13303
|
+
"actions": [
|
|
13304
|
+
{
|
|
13305
|
+
actionType: 'custom',
|
|
13306
|
+
script: "console.log('====event', event), event.preventDefault(); event.stopPropagation()"
|
|
13307
|
+
},
|
|
13308
|
+
{
|
|
13309
|
+
"args": {
|
|
13310
|
+
"api": {
|
|
13311
|
+
"url": "/aaa",
|
|
13312
|
+
"method": "get",
|
|
13313
|
+
"messages": {}
|
|
13314
|
+
}
|
|
13315
|
+
},
|
|
13316
|
+
"actionType": "download",
|
|
13317
|
+
"stopPropagation": true
|
|
13318
|
+
}
|
|
13319
|
+
]
|
|
13320
|
+
}
|
|
13321
|
+
}
|
|
13322
|
+
}, "source": {
|
|
13204
13323
|
"method": "post",
|
|
13205
13324
|
"url": "${context.rootUrl}/graphql?keywords=${keywords}",
|
|
13206
13325
|
"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 "),
|
|
@@ -13310,14 +13429,19 @@ var PageListView = function (props) { return __awaiter(void 0, void 0, void 0, f
|
|
|
13310
13429
|
"showHeader": true,
|
|
13311
13430
|
"showDisplayAs": (defaultFormFactor !== 'SMALL'),
|
|
13312
13431
|
"formFactor": formFactor,
|
|
13313
|
-
"className": (displayAs === 'split') ? 'w-full' : 'p-0 flex-1
|
|
13432
|
+
"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'
|
|
13314
13433
|
};
|
|
13315
|
-
defData = __assign$2(__assign$2({}, $schema.data), { objectName: objectApiName, listViewId: listViewId,
|
|
13434
|
+
defData = __assign$2(__assign$2({}, $schema.data), { objectName: objectApiName, listViewId: listViewId,
|
|
13435
|
+
// listName: listName || listviewId,
|
|
13436
|
+
appId: appId, formFactor: formFactor, displayAs: displayAs });
|
|
13437
|
+
if (listName) {
|
|
13438
|
+
defData.listName = listName || listviewId;
|
|
13439
|
+
}
|
|
13316
13440
|
// console.log("defData====>", defData)
|
|
13317
13441
|
return [2 /*return*/, {
|
|
13318
13442
|
type: 'service',
|
|
13319
13443
|
data: defData,
|
|
13320
|
-
"className": (displayAs === 'grid') ? 'h-full' : 'p-0 flex flex-1 overflow-hidden h-full',
|
|
13444
|
+
"className": (displayAs === 'grid') ? 'h-full sm:p-3' : 'p-0 flex flex-1 overflow-hidden h-full',
|
|
13321
13445
|
body: (displayAs === 'grid') ? ___default.defaultsDeep({ data: defData }, listSchema) : [
|
|
13322
13446
|
{
|
|
13323
13447
|
"type": "wrapper",
|
|
@@ -13336,11 +13460,11 @@ var PageListView = function (props) { return __awaiter(void 0, void 0, void 0, f
|
|
|
13336
13460
|
}); };
|
|
13337
13461
|
|
|
13338
13462
|
var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13339
|
-
var defaultFormFactor, appId, objectApiName,
|
|
13463
|
+
var defaultFormFactor, appId, objectApiName, display, sideObject, sideListviewId, $schema, displayAs, formFactor, listPage, recordSchema, recordPage, listSchema, defData;
|
|
13340
13464
|
return __generator(this, function (_a) {
|
|
13341
13465
|
switch (_a.label) {
|
|
13342
13466
|
case 0:
|
|
13343
|
-
defaultFormFactor = props.formFactor, appId = props.appId, objectApiName = props.objectApiName,
|
|
13467
|
+
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;
|
|
13344
13468
|
if (display)
|
|
13345
13469
|
Router$1.setTabDisplayAs(objectApiName, display);
|
|
13346
13470
|
displayAs = (defaultFormFactor === 'SMALL') ? 'grid' : display ? display : sideObject ? 'split' : Router$1.getTabDisplayAs(objectApiName);
|
|
@@ -13349,7 +13473,6 @@ var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
13349
13473
|
case 1:
|
|
13350
13474
|
listPage = _a.sent();
|
|
13351
13475
|
recordSchema = {};
|
|
13352
|
-
if (!recordId) return [3 /*break*/, 3];
|
|
13353
13476
|
return [4 /*yield*/, getPage({ type: 'record', appId: appId, objectName: objectApiName, formFactor: defaultFormFactor })];
|
|
13354
13477
|
case 2:
|
|
13355
13478
|
recordPage = _a.sent();
|
|
@@ -13360,13 +13483,36 @@ var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
13360
13483
|
"body": [
|
|
13361
13484
|
{
|
|
13362
13485
|
"type": "steedos-record-detail",
|
|
13363
|
-
"recordId": "${recordId}",
|
|
13486
|
+
// "recordId": "${recordId}",
|
|
13364
13487
|
"objectApiName": "${objectName}",
|
|
13365
13488
|
className: "sm:m-3",
|
|
13366
13489
|
appId: appId,
|
|
13367
13490
|
}
|
|
13368
13491
|
],
|
|
13369
13492
|
};
|
|
13493
|
+
recordSchema = {
|
|
13494
|
+
"type": "service",
|
|
13495
|
+
"body": [recordSchema],
|
|
13496
|
+
data: {
|
|
13497
|
+
"_master.objectName": "${objectName}",
|
|
13498
|
+
"_master.recordId": "${recordId}"
|
|
13499
|
+
},
|
|
13500
|
+
onEvent: {
|
|
13501
|
+
"recordLoaded": {
|
|
13502
|
+
"actions": [
|
|
13503
|
+
{
|
|
13504
|
+
"actionType": "reload",
|
|
13505
|
+
"data": {
|
|
13506
|
+
"_master.record": "${record}",
|
|
13507
|
+
// 不清楚reload 如何给对象下的某个key复制, 所以此处重复设置_master的objectName、recordId
|
|
13508
|
+
"_master.objectName": "${objectName}",
|
|
13509
|
+
"_master.recordId": "${recordId}"
|
|
13510
|
+
}
|
|
13511
|
+
}
|
|
13512
|
+
]
|
|
13513
|
+
}
|
|
13514
|
+
}
|
|
13515
|
+
};
|
|
13370
13516
|
_a.label = 3;
|
|
13371
13517
|
case 3:
|
|
13372
13518
|
listSchema = listPage ? JSON.parse(listPage.schema) : {
|
|
@@ -13377,7 +13523,10 @@ var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
13377
13523
|
"showDisplayAs": true,
|
|
13378
13524
|
"formFactor": 'SMALL',
|
|
13379
13525
|
};
|
|
13380
|
-
defData = __assign$2(__assign$2({}, $schema.data), { objectName: objectApiName, listViewId: sideListviewId, listName: sideListviewId,
|
|
13526
|
+
defData = __assign$2(__assign$2({}, $schema.data), { objectName: objectApiName, listViewId: sideListviewId, listName: sideListviewId,
|
|
13527
|
+
// recordId: "${recordId}",
|
|
13528
|
+
// appId: appId,
|
|
13529
|
+
formFactor: formFactor, displayAs: displayAs });
|
|
13381
13530
|
// console.log('defData====>', defData)
|
|
13382
13531
|
return [2 /*return*/, {
|
|
13383
13532
|
type: 'service',
|
|
@@ -13400,7 +13549,7 @@ var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
13400
13549
|
});
|
|
13401
13550
|
}); };
|
|
13402
13551
|
|
|
13403
|
-
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){
|
|
13552
|
+
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);
|
|
13404
13553
|
|
|
13405
13554
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
13406
13555
|
__proto__: null,
|